summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSVN Migration <svn@php.net>2001-06-21 21:31:34 +0000
committerSVN Migration <svn@php.net>2001-06-21 21:31:34 +0000
commit2447117ac4586e90963283f6387f12a150f007dd (patch)
treeabf6b9bcf7f5a4d3b97f925b6428a1a8aeaf5838
parent7690887cf6729613cb3de062fe850c435239b127 (diff)
downloadphp-git-2447117ac4586e90963283f6387f12a150f007dd.tar.gz
This commit was manufactured by cvs2svn to create tagPRE_GRANULAR_GARBAGE_FIX
'PRE_GRANULAR_GARBAGE_FIX'.
-rw-r--r--CODING_STANDARDS218
-rw-r--r--CREDITS2
-rw-r--r--ChangeLog10554
-rw-r--r--ChangeLog.1999.gzbin78772 -> 0 bytes
-rw-r--r--ChangeLog.2000.gzbin159518 -> 0 bytes
-rw-r--r--EXTENSIONS426
-rw-r--r--INSTALL406
-rw-r--r--LICENSE75
-rw-r--r--Makefile.in62
-rw-r--r--NEWS1507
-rw-r--r--README.CVS-RULES105
-rw-r--r--README.EXT_SKEL185
-rw-r--r--README.QNX57
-rw-r--r--README.SELF-CONTAINED-EXTENSIONS174
-rw-r--r--README.STREAMS243
-rw-r--r--README.Zeus126
-rw-r--r--RELEASE_PROCESS186
-rw-r--r--TODO142
-rw-r--r--TODO-4.2.txt32
-rw-r--r--TSRM/LICENSE26
-rw-r--r--TSRM/Makefile.am6
-rw-r--r--TSRM/TODO2
-rw-r--r--TSRM/TSRM.c570
-rw-r--r--TSRM/TSRM.dsp186
-rw-r--r--TSRM/TSRM.h121
-rw-r--r--TSRM/acconfig.h1
-rw-r--r--TSRM/acinclude.m45
-rw-r--r--TSRM/build.mk43
-rwxr-xr-xTSRM/buildconf33
-rw-r--r--TSRM/configure.in33
-rw-r--r--TSRM/readdir.h44
-rw-r--r--TSRM/threads.m4157
-rw-r--r--TSRM/tsrm.m4124
-rw-r--r--TSRM/tsrm_config.w32.h15
-rw-r--r--TSRM/tsrm_config_common.h47
-rw-r--r--TSRM/tsrm_strtok_r.c63
-rw-r--r--TSRM/tsrm_strtok_r.h6
-rw-r--r--TSRM/tsrm_virtual_cwd.c795
-rw-r--r--TSRM/tsrm_virtual_cwd.h214
-rw-r--r--TSRM/tsrm_win32.c181
-rw-r--r--TSRM/tsrm_win32.h53
-rw-r--r--acconfig.h.in1
-rw-r--r--acinclude.m41116
-rw-r--r--apidoc-zend.txt276
-rw-r--r--apidoc.txt492
-rwxr-xr-xbuild/bsd_makefile34
-rw-r--r--build/build.mk71
-rw-r--r--build/build2.mk77
-rwxr-xr-xbuild/buildcheck.sh92
-rw-r--r--build/dynlib.mk24
-rwxr-xr-xbuild/fastgen.sh76
-rw-r--r--build/genif.sh41
-rw-r--r--build/library.mk23
-rw-r--r--build/ltlib.mk24
-rw-r--r--build/mkdep.awk75
-rw-r--r--build/print_include.awk6
-rw-r--r--build/program.mk23
-rw-r--r--build/rules.mk68
-rw-r--r--build/rules_common.mk76
-rw-r--r--build/rules_pear.mk76
-rwxr-xr-xbuild/shtool716
-rwxr-xr-xbuild/sysv_makefile34
-rwxr-xr-xbuildconf36
-rw-r--r--config.guess1371
-rw-r--r--config.sub1362
-rw-r--r--configure.in1040
-rwxr-xr-xcvsclean3
-rw-r--r--dynlib.m488
-rw-r--r--ext/Makefile.in4
-rw-r--r--ext/aspell/CREDITS2
-rw-r--r--ext/aspell/Makefile.in5
-rw-r--r--ext/aspell/aspell.c226
-rw-r--r--ext/aspell/config.m428
-rw-r--r--ext/aspell/php_aspell.h41
-rw-r--r--ext/bcmath/CREDITS2
-rw-r--r--ext/bcmath/Makefile.in11
-rw-r--r--ext/bcmath/bcmath.c504
-rw-r--r--ext/bcmath/config.m416
-rw-r--r--ext/bcmath/libbcmath/AUTHORS3
-rw-r--r--ext/bcmath/libbcmath/COPYING.LIB515
-rw-r--r--ext/bcmath/libbcmath/ChangeLog10
-rw-r--r--ext/bcmath/libbcmath/FAQ21
-rw-r--r--ext/bcmath/libbcmath/INSTALL9
-rw-r--r--ext/bcmath/libbcmath/Makefile.am12
-rw-r--r--ext/bcmath/libbcmath/Makefile.in9
-rw-r--r--ext/bcmath/libbcmath/NEWS3
-rw-r--r--ext/bcmath/libbcmath/README9
-rw-r--r--ext/bcmath/libbcmath/acconfig.h9
-rw-r--r--ext/bcmath/libbcmath/aclocal.m4127
-rw-r--r--ext/bcmath/libbcmath/config.h.in41
-rw-r--r--ext/bcmath/libbcmath/configure1859
-rw-r--r--ext/bcmath/libbcmath/configure.in18
-rw-r--r--ext/bcmath/libbcmath/doc/Makefile.am3
-rw-r--r--ext/bcmath/libbcmath/doc/Makefile.in171
-rw-r--r--ext/bcmath/libbcmath/doc/bcmath.11
-rw-r--r--ext/bcmath/libbcmath/install-sh238
-rw-r--r--ext/bcmath/libbcmath/missing134
-rw-r--r--ext/bcmath/libbcmath/mkinstalldirs36
-rw-r--r--ext/bcmath/libbcmath/src/Makefile.am22
-rw-r--r--ext/bcmath/libbcmath/src/Makefile.in7
-rw-r--r--ext/bcmath/libbcmath/src/add.c88
-rw-r--r--ext/bcmath/libbcmath/src/bcmath.h158
-rw-r--r--ext/bcmath/libbcmath/src/compare.c161
-rw-r--r--ext/bcmath/libbcmath/src/config.h9
-rw-r--r--ext/bcmath/libbcmath/src/debug.c70
-rw-r--r--ext/bcmath/libbcmath/src/div.c276
-rw-r--r--ext/bcmath/libbcmath/src/divmod.c91
-rw-r--r--ext/bcmath/libbcmath/src/doaddsub.c232
-rw-r--r--ext/bcmath/libbcmath/src/init.c135
-rw-r--r--ext/bcmath/libbcmath/src/int2num.c84
-rw-r--r--ext/bcmath/libbcmath/src/nearzero.c69
-rw-r--r--ext/bcmath/libbcmath/src/neg.c49
-rw-r--r--ext/bcmath/libbcmath/src/num2long.c70
-rw-r--r--ext/bcmath/libbcmath/src/num2str.c79
-rw-r--r--ext/bcmath/libbcmath/src/outofmem.c46
-rw-r--r--ext/bcmath/libbcmath/src/output.c212
-rw-r--r--ext/bcmath/libbcmath/src/private.h41
-rw-r--r--ext/bcmath/libbcmath/src/raise.c126
-rw-r--r--ext/bcmath/libbcmath/src/raisemod.c99
-rw-r--r--ext/bcmath/libbcmath/src/recmul.c304
-rw-r--r--ext/bcmath/libbcmath/src/rmzero.c55
-rw-r--r--ext/bcmath/libbcmath/src/rt.c65
-rw-r--r--ext/bcmath/libbcmath/src/sqrt.c131
-rw-r--r--ext/bcmath/libbcmath/src/str2num.c112
-rw-r--r--ext/bcmath/libbcmath/src/sub.c90
-rw-r--r--ext/bcmath/libbcmath/src/zero.c65
-rw-r--r--ext/bcmath/php_bcmath.h50
-rw-r--r--ext/bcmath/setup.stub6
-rw-r--r--ext/calendar/CREDITS0
-rw-r--r--ext/calendar/Makefile.in6
-rw-r--r--ext/calendar/cal_unix.c88
-rw-r--r--ext/calendar/calendar.c348
-rw-r--r--ext/calendar/config.m49
-rw-r--r--ext/calendar/dow.c76
-rw-r--r--ext/calendar/easter.c142
-rw-r--r--ext/calendar/french.c160
-rw-r--r--ext/calendar/gregor.c265
-rw-r--r--ext/calendar/jewish.c741
-rw-r--r--ext/calendar/julian.c249
-rw-r--r--ext/calendar/php_calendar.h32
-rw-r--r--ext/calendar/sdncal.h96
-rw-r--r--ext/ccvs/CREDITS2
-rw-r--r--ext/ccvs/Makefile.in8
-rw-r--r--ext/ccvs/TODO7
-rw-r--r--ext/ccvs/ccvs.c605
-rw-r--r--ext/ccvs/ccvs.h59
-rw-r--r--ext/ccvs/config.m426
-rw-r--r--ext/com/COM.c1743
-rw-r--r--ext/com/CREDITS2
-rw-r--r--ext/com/VARIANT.c432
-rw-r--r--ext/com/com.h43
-rw-r--r--ext/com/conversion.c889
-rw-r--r--ext/com/conversion.h14
-rw-r--r--ext/com/php_COM.h33
-rw-r--r--ext/com/php_VARIANT.h21
-rw-r--r--ext/cpdf/CREDITS2
-rw-r--r--ext/cpdf/Makefile.in5
-rw-r--r--ext/cpdf/config.m472
-rw-r--r--ext/cpdf/cpdf.c2715
-rw-r--r--ext/cpdf/cpdf.dsp111
-rw-r--r--ext/cpdf/php_cpdf.h121
-rw-r--r--ext/crack/CREDITS2
-rw-r--r--ext/crack/EXPERIMENTAL5
-rw-r--r--ext/crack/Makefile.in8
-rw-r--r--ext/crack/config.m431
-rw-r--r--ext/crack/crack.c282
-rw-r--r--ext/crack/php_crack.h54
-rw-r--r--ext/crack/tests/001.phpt23
-rw-r--r--ext/ctype/CREDITS2
-rw-r--r--ext/ctype/EXPERIMENTAL5
-rw-r--r--ext/ctype/Makefile.in8
-rw-r--r--ext/ctype/README5
-rw-r--r--ext/ctype/config.m427
-rw-r--r--ext/ctype/ctype.c330
-rw-r--r--ext/ctype/ctype.dsp107
-rw-r--r--ext/ctype/ctype.xml245
-rw-r--r--ext/ctype/php_ctype.h93
-rw-r--r--ext/ctype/tests/001.phpt41
-rw-r--r--ext/ctype/tests/002.phpt43
-rw-r--r--ext/curl/CREDITS2
-rw-r--r--ext/curl/Makefile.in7
-rw-r--r--ext/curl/config.m455
-rw-r--r--ext/curl/curl.c985
-rw-r--r--ext/curl/curl.dsp177
-rw-r--r--ext/curl/php_curl.h100
-rw-r--r--ext/cybercash/CREDITS2
-rw-r--r--ext/cybercash/Makefile.in5
-rw-r--r--ext/cybercash/config.m428
-rw-r--r--ext/cybercash/cybercash.c228
-rw-r--r--ext/cybercash/cybercash.dsp110
-rw-r--r--ext/cybercash/cybercash.h40
-rw-r--r--ext/cybercash/cyberlib.php215
-rw-r--r--ext/cybercash/test.php26
-rw-r--r--ext/cybermut/Makefile.in8
-rw-r--r--ext/cybermut/config.m449
-rw-r--r--ext/cybermut/cybermut.c183
-rw-r--r--ext/cybermut/cybermut.xml214
-rw-r--r--ext/cybermut/php_cybermut.h75
-rw-r--r--ext/cybermut/tests/001.phpt23
-rw-r--r--ext/db/CREDITS2
-rw-r--r--ext/db/Makefile.in5
-rw-r--r--ext/db/config.m459
-rw-r--r--ext/db/db.c1247
-rw-r--r--ext/db/db.dsp122
-rw-r--r--ext/db/php_db.h81
-rw-r--r--ext/db/tests/001.phpt13
-rw-r--r--ext/db/tests/002.phpt16
-rw-r--r--ext/db/tests/003.phpt17
-rw-r--r--ext/db/tests/004.phpt21
-rw-r--r--ext/db/tests/005.phpt25
-rw-r--r--ext/db/tests/006.phpt27
-rw-r--r--ext/dba/CREDITS2
-rw-r--r--ext/dba/Makefile.in8
-rw-r--r--ext/dba/config.m4235
-rw-r--r--ext/dba/dba.c518
-rw-r--r--ext/dba/dba.dsp157
-rw-r--r--ext/dba/dba_cdb.c218
-rw-r--r--ext/dba/dba_db2.c199
-rw-r--r--ext/dba/dba_db3.c206
-rw-r--r--ext/dba/dba_dbm.c184
-rw-r--r--ext/dba/dba_gdbm.c187
-rw-r--r--ext/dba/dba_ndbm.c164
-rw-r--r--ext/dba/php_cdb.h12
-rw-r--r--ext/dba/php_db2.h12
-rw-r--r--ext/dba/php_db3.h12
-rw-r--r--ext/dba/php_dba.h104
-rw-r--r--ext/dba/php_dbm.h12
-rw-r--r--ext/dba/php_gdbm.h12
-rw-r--r--ext/dba/php_ndbm.h12
-rw-r--r--ext/dba/setup.stub6
-rw-r--r--ext/dbase/CREDITS2
-rw-r--r--ext/dbase/Makefile.in6
-rw-r--r--ext/dbase/config.m411
-rw-r--r--ext/dbase/dbase.c784
-rw-r--r--ext/dbase/dbase.dsp151
-rw-r--r--ext/dbase/dbf.h94
-rw-r--r--ext/dbase/dbf_head.c271
-rw-r--r--ext/dbase/dbf_head.h9
-rw-r--r--ext/dbase/dbf_misc.c179
-rw-r--r--ext/dbase/dbf_misc.h13
-rw-r--r--ext/dbase/dbf_ndx.c191
-rw-r--r--ext/dbase/dbf_ndx.h98
-rw-r--r--ext/dbase/dbf_rec.c191
-rw-r--r--ext/dbase/dbf_rec.h10
-rw-r--r--ext/dbase/php_dbase.h44
-rw-r--r--ext/dbase/setup.stub4
-rw-r--r--ext/dbx/CREDITS7
-rw-r--r--ext/dbx/EXPERIMENTAL5
-rw-r--r--ext/dbx/INSTALL25
-rw-r--r--ext/dbx/Makefile.in6
-rw-r--r--ext/dbx/config.m47
-rw-r--r--ext/dbx/dbx.c770
-rw-r--r--ext/dbx/dbx.dsp149
-rw-r--r--ext/dbx/dbx.h56
-rw-r--r--ext/dbx/dbx_mssql.c248
-rw-r--r--ext/dbx/dbx_mssql.h58
-rw-r--r--ext/dbx/dbx_mysql.c247
-rw-r--r--ext/dbx/dbx_mysql.h58
-rw-r--r--ext/dbx/dbx_odbc.c259
-rw-r--r--ext/dbx/dbx_odbc.h58
-rw-r--r--ext/dbx/dbx_pgsql.c271
-rw-r--r--ext/dbx/dbx_pgsql.h54
-rw-r--r--ext/dbx/howto_extend_dbx.html316
-rw-r--r--ext/dbx/php_dbx.h95
-rw-r--r--ext/dbx/tests/001.phpt12
-rw-r--r--ext/dbx/tests/002.phpt25
-rw-r--r--ext/dbx/tests/003.phpt107
-rw-r--r--ext/dbx/tests/004.phpt30
-rw-r--r--ext/dbx/tests/005.phpt87
-rw-r--r--ext/dbx/tests/006.phpt55
-rw-r--r--ext/dbx/tests/007.phpt74
-rw-r--r--ext/dbx/tests/008.phpt146
-rw-r--r--ext/dbx/tests/dbx_test.p38
-rw-r--r--ext/dbx/tests/dbx_test.pgsql.script37
-rw-r--r--ext/dbx/tests/dbx_test.script38
-rw-r--r--ext/domxml/CREDITS2
-rw-r--r--ext/domxml/EXPERIMENTAL5
-rw-r--r--ext/domxml/Makefile.in8
-rw-r--r--ext/domxml/config.m466
-rw-r--r--ext/domxml/domxml.dsp114
-rw-r--r--ext/domxml/php_domxml.c2583
-rw-r--r--ext/domxml/php_domxml.h145
-rw-r--r--ext/dotnet/CREDITS2
-rw-r--r--ext/dotnet/EXPERIMENTAL5
-rw-r--r--ext/dotnet/README32
-rw-r--r--ext/dotnet/dotnet.cpp237
-rw-r--r--ext/dotnet/dotnet.dsp171
-rw-r--r--ext/dotnet/dotnet.php8
-rw-r--r--ext/dotnet/php_dotnet.h21
-rw-r--r--ext/ereg/ereg.c670
-rw-r--r--ext/ereg/php_ereg.h60
-rw-r--r--ext/ereg/php_regex.h45
-rw-r--r--ext/ereg/regex/COPYRIGHT20
-rw-r--r--ext/ereg/regex/Makefile.in5
-rw-r--r--ext/ereg/regex/README32
-rw-r--r--ext/ereg/regex/WHATSNEW92
-rw-r--r--ext/ereg/regex/cclass.h30
-rw-r--r--ext/ereg/regex/cname.h102
-rw-r--r--ext/ereg/regex/debug.c242
-rw-r--r--ext/ereg/regex/debug.ih14
-rw-r--r--ext/ereg/regex/engine.c1019
-rw-r--r--ext/ereg/regex/engine.ih35
-rw-r--r--ext/ereg/regex/main.c510
-rw-r--r--ext/ereg/regex/main.ih19
-rw-r--r--ext/ereg/regex/mkh76
-rw-r--r--ext/ereg/regex/regcomp.c1608
-rw-r--r--ext/ereg/regex/regcomp.ih53
-rw-r--r--ext/ereg/regex/regerror.c126
-rw-r--r--ext/ereg/regex/regerror.ih12
-rw-r--r--ext/ereg/regex/regex.3502
-rw-r--r--ext/ereg/regex/regex.7233
-rw-r--r--ext/ereg/regex/regex.dsp106
-rw-r--r--ext/ereg/regex/regex.dsw29
-rw-r--r--ext/ereg/regex/regex.h83
-rw-r--r--ext/ereg/regex/regex.mak304
-rw-r--r--ext/ereg/regex/regex2.h140
-rw-r--r--ext/ereg/regex/regex_extra.h23
-rw-r--r--ext/ereg/regex/regexec.c138
-rw-r--r--ext/ereg/regex/regfree.c37
-rw-r--r--ext/ereg/regex/split.c316
-rw-r--r--ext/ereg/regex/tests475
-rw-r--r--ext/ereg/regex/utils.h25
-rw-r--r--ext/ereg/tests/001.phpt9
-rw-r--r--ext/ereg/tests/002.phpt9
-rw-r--r--ext/ereg/tests/003.phpt10
-rw-r--r--ext/ereg/tests/004.phpt16
-rw-r--r--ext/ereg/tests/005.phpt20
-rw-r--r--ext/ereg/tests/006.phpt10
-rw-r--r--ext/ereg/tests/007.phpt12
-rw-r--r--ext/ereg/tests/008.phpt10
-rw-r--r--ext/ereg/tests/009.phpt19
-rw-r--r--ext/ereg/tests/010.phpt9
-rw-r--r--ext/ereg/tests/011.phpt9
-rw-r--r--ext/ereg/tests/012.phpt9
-rw-r--r--ext/ereg/tests/013.phpt9
-rw-r--r--ext/ereg/tests/014.phpt9
-rw-r--r--ext/ereg/tests/015.phpt8
-rw-r--r--ext/ereg/tests/016.phpt8
-rw-r--r--ext/exif/CREDITS2
-rw-r--r--ext/exif/Makefile.in7
-rw-r--r--ext/exif/config.m411
-rw-r--r--ext/exif/exif.c1232
-rw-r--r--ext/exif/exif.dsp113
-rw-r--r--ext/exif/php_exif.h24
-rwxr-xr-xext/ext_skel297
-rw-r--r--ext/fbsql/CREDITS2
-rw-r--r--ext/fbsql/EXPERIMENTAL5
-rw-r--r--ext/fbsql/Makefile.in10
-rw-r--r--ext/fbsql/Readme_w32.txt22
-rw-r--r--ext/fbsql/config.m441
-rw-r--r--ext/fbsql/fbsql.dsp171
-rw-r--r--ext/fbsql/php_fbsql.c3032
-rw-r--r--ext/fbsql/php_fbsql.h142
-rw-r--r--ext/fdf/CREDITS2
-rw-r--r--ext/fdf/Makefile.in6
-rw-r--r--ext/fdf/config.m441
-rw-r--r--ext/fdf/fdf.c769
-rw-r--r--ext/fdf/fdf.dsp114
-rw-r--r--ext/fdf/php_fdf.h61
-rw-r--r--ext/fdf/setup.stub7
-rw-r--r--ext/filepro/CREDITS2
-rw-r--r--ext/filepro/Makefile.in6
-rw-r--r--ext/filepro/config.m411
-rw-r--r--ext/filepro/filepro.c577
-rw-r--r--ext/filepro/filepro.dsp109
-rw-r--r--ext/filepro/php_filepro.h48
-rw-r--r--ext/filepro/setup.stub5
-rw-r--r--ext/fribidi/CREDITS0
-rw-r--r--ext/fribidi/Makefile.in9
-rw-r--r--ext/fribidi/README53
-rw-r--r--ext/fribidi/config.m474
-rwxr-xr-xext/fribidi/fribidi.c255
-rw-r--r--ext/fribidi/fribidi.php10
-rw-r--r--ext/fribidi/php_fribidi.h92
-rw-r--r--ext/ftp/CREDITS2
-rw-r--r--ext/ftp/Makefile.in6
-rw-r--r--ext/ftp/config.m411
-rw-r--r--ext/ftp/ftp.c1292
-rw-r--r--ext/ftp/ftp.h154
-rw-r--r--ext/ftp/php_ftp.c853
-rw-r--r--ext/ftp/php_ftp.h62
-rw-r--r--ext/gd/CREDITS2
-rw-r--r--ext/gd/Makefile.in7
-rw-r--r--ext/gd/config.m4250
-rw-r--r--ext/gd/gd.c3498
-rw-r--r--ext/gd/gd.dsp203
-rw-r--r--ext/gd/gd_ctx.c105
-rw-r--r--ext/gd/gdcache.c201
-rw-r--r--ext/gd/gdcache.h87
-rw-r--r--ext/gd/gdt1.c549
-rw-r--r--ext/gd/gdt1.h36
-rw-r--r--ext/gd/gdttf.c867
-rw-r--r--ext/gd/gdttf.h16
-rw-r--r--ext/gd/php_gd.h179
-rw-r--r--ext/gd/setup.stub6
-rw-r--r--ext/gettext/CREDITS2
-rw-r--r--ext/gettext/Makefile.in7
-rw-r--r--ext/gettext/config.m441
-rw-r--r--ext/gettext/gettext.c181
-rw-r--r--ext/gettext/gettext.dsp113
-rw-r--r--ext/gettext/php_gettext.h46
-rw-r--r--ext/gettext/setup.stub6
-rw-r--r--ext/gmp/Makefile.in9
-rw-r--r--ext/gmp/README5
-rw-r--r--ext/gmp/TODO22
-rw-r--r--ext/gmp/config.m427
-rw-r--r--ext/gmp/gmp.c1220
-rw-r--r--ext/gmp/php_gmp.h117
-rw-r--r--ext/gmp/tests/001.phpt23
-rw-r--r--ext/gmp/tests/002.phpt19
-rw-r--r--ext/hyperwave/CREDITS2
-rw-r--r--ext/hyperwave/Makefile.in5
-rw-r--r--ext/hyperwave/config.m418
-rw-r--r--ext/hyperwave/debug.h197
-rw-r--r--ext/hyperwave/hg_comm.c5845
-rw-r--r--ext/hyperwave/hg_comm.h238
-rw-r--r--ext/hyperwave/hw.c4474
-rw-r--r--ext/hyperwave/hw_error.h111
-rw-r--r--ext/hyperwave/hyperwave.dsp120
-rw-r--r--ext/hyperwave/php_hyperwave.h157
-rw-r--r--ext/hyperwave/setup.stub6
-rw-r--r--ext/icap/CREDITS2
-rw-r--r--ext/icap/Makefile.in7
-rw-r--r--ext/icap/config.m415
-rw-r--r--ext/icap/php_icap.c938
-rw-r--r--ext/icap/php_icap.h42
-rw-r--r--ext/iconv/EXPERIMENTAL5
-rw-r--r--ext/iconv/Makefile.in8
-rw-r--r--ext/iconv/config.m438
-rw-r--r--ext/iconv/iconv.c300
-rw-r--r--ext/iconv/iconv.dsp107
-rw-r--r--ext/iconv/php_iconv.h71
-rw-r--r--ext/iconv/tests/001.phpt18
-rw-r--r--ext/imap/CREDITS2
-rw-r--r--ext/imap/IMAP_Win32_HOWTO.txt32
-rw-r--r--ext/imap/Makefile.in7
-rw-r--r--ext/imap/config.m4140
-rw-r--r--ext/imap/imap.dsp167
-rw-r--r--ext/imap/imap.h103
-rw-r--r--ext/imap/php_imap.c4432
-rw-r--r--ext/imap/php_imap.h196
-rw-r--r--ext/imap/setup.stub7
-rw-r--r--ext/informix/CREDITS2
-rw-r--r--ext/informix/Makefile.in20
-rw-r--r--ext/informix/config.m474
-rw-r--r--ext/informix/ifx.dsp134
-rw-r--r--ext/informix/ifx.ec4809
-rw-r--r--ext/informix/php_informix.h216
-rw-r--r--ext/informix/setup.stub9
-rw-r--r--ext/informix/stub.c0
-rw-r--r--ext/ingres_ii/CREDITS2
-rw-r--r--ext/ingres_ii/EXPERIMENTAL5
-rw-r--r--ext/ingres_ii/Makefile.in8
-rw-r--r--ext/ingres_ii/README13
-rw-r--r--ext/ingres_ii/config.m434
-rw-r--r--ext/ingres_ii/ii.c1387
-rw-r--r--ext/ingres_ii/ii.h65
-rw-r--r--ext/ingres_ii/ingres.dsp111
-rw-r--r--ext/ingres_ii/php_ii.h110
-rw-r--r--ext/interbase/CREDITS2
-rw-r--r--ext/interbase/Makefile.in7
-rw-r--r--ext/interbase/config.m421
-rw-r--r--ext/interbase/interbase.c2930
-rw-r--r--ext/interbase/interbase.dsp113
-rw-r--r--ext/interbase/php_interbase.h186
-rw-r--r--ext/interbase/setup.stub7
-rw-r--r--ext/interbase/tests/001.phpt34
-rw-r--r--ext/interbase/tests/002.phpt35
-rw-r--r--ext/interbase/tests/003.phpt93
-rw-r--r--ext/interbase/tests/004.phpt179
-rw-r--r--ext/interbase/tests/005.phpt275
-rw-r--r--ext/interbase/tests/006.phpt227
-rwxr-xr-xext/interbase/tests/extension1
-rwxr-xr-xext/interbase/tests/interbase.inc77
-rw-r--r--ext/java/CREDITS2
-rw-r--r--ext/java/Makefile.in25
-rw-r--r--ext/java/README243
-rw-r--r--ext/java/config.m4118
-rw-r--r--ext/java/except.php23
-rw-r--r--ext/java/java.c795
-rw-r--r--ext/java/java.dsp258
-rw-r--r--ext/java/jawt.php27
-rw-r--r--ext/java/jver.php17
-rw-r--r--ext/java/reflect.java419
-rw-r--r--ext/ldap/CREDITS2
-rw-r--r--ext/ldap/LDAP_Win32_HOWTO.txt33
-rw-r--r--ext/ldap/Makefile.in7
-rw-r--r--ext/ldap/config.m493
-rw-r--r--ext/ldap/ldap.c2006
-rw-r--r--ext/ldap/ldap.dsp230
-rw-r--r--ext/ldap/php_ldap.h122
-rw-r--r--ext/ldap/setup.stub8
-rw-r--r--ext/mailparse/CREDITS2
-rw-r--r--ext/mailparse/EXPERIMENTAL5
-rw-r--r--ext/mailparse/Makefile.in15
-rw-r--r--ext/mailparse/README79
-rw-r--r--ext/mailparse/config.m413
-rw-r--r--ext/mailparse/libs.mk7
-rwxr-xr-xext/mailparse/mailparse.c800
-rw-r--r--ext/mailparse/mailparse_rfc822.h161
-rwxr-xr-xext/mailparse/php_mailparse.h90
-rwxr-xr-xext/mailparse/rfc2045.c1174
-rwxr-xr-xext/mailparse/rfc2045.h208
-rw-r--r--ext/mailparse/rfc2045acchk.c123
-rw-r--r--ext/mailparse/rfc2045acprep.c99
-rw-r--r--ext/mailparse/rfc2045appendurl.c137
-rwxr-xr-xext/mailparse/rfc2045cdecode.c90
-rw-r--r--ext/mailparse/rfc2045decode.c40
-rw-r--r--ext/mailparse/rfc2045find.c47
-rwxr-xr-xext/mailparse/rfc822.c716
-rw-r--r--ext/mailparse/rfc822_getaddr.c99
-rw-r--r--ext/mailparse/rfc822_getaddrs.c92
-rw-r--r--ext/mailparse/tests/001.phpt12
-rw-r--r--ext/mailparse/tests/002.phpt22
-rwxr-xr-xext/mailparse/try.php53
-rw-r--r--ext/mbstring/CREDITS2
-rw-r--r--ext/mbstring/EXPERIMENTAL5
-rw-r--r--ext/mbstring/Makefile.in7
-rw-r--r--ext/mbstring/README_PHP3-i18n-ja774
-rw-r--r--ext/mbstring/config.m423
-rw-r--r--ext/mbstring/mbfilter.c8470
-rw-r--r--ext/mbstring/mbfilter.h547
-rw-r--r--ext/mbstring/mbfilter_ja.c7334
-rw-r--r--ext/mbstring/mbfilter_ja.h98
-rw-r--r--ext/mbstring/mbstring.c2684
-rw-r--r--ext/mbstring/mbstring.dsp101
-rw-r--r--ext/mbstring/mbstring.h151
-rw-r--r--ext/mcal/CREDITS2
-rw-r--r--ext/mcal/Makefile.in7
-rw-r--r--ext/mcal/config.m448
-rw-r--r--ext/mcal/php_mcal.c1620
-rw-r--r--ext/mcal/php_mcal.h78
-rw-r--r--ext/mcrypt/CREDITS2
-rw-r--r--ext/mcrypt/Makefile.in7
-rw-r--r--ext/mcrypt/config.m443
-rw-r--r--ext/mcrypt/mcrypt.c1663
-rw-r--r--ext/mcrypt/mcrypt.dsp117
-rw-r--r--ext/mcrypt/php_mcrypt.h93
-rw-r--r--ext/mcrypt/setup.stub6
-rw-r--r--ext/mcrypt/tests/001.phpt31
-rw-r--r--ext/mhash/CREDITS2
-rw-r--r--ext/mhash/Makefile.in7
-rw-r--r--ext/mhash/config.m426
-rw-r--r--ext/mhash/mhash.c280
-rw-r--r--ext/mhash/mhash.dsp115
-rw-r--r--ext/mhash/php_mhash.h27
-rw-r--r--ext/mhash/setup.stub6
-rw-r--r--ext/ming/CREDITS2
-rw-r--r--ext/ming/EXPERIMENTAL5
-rw-r--r--ext/ming/Makefile.in8
-rw-r--r--ext/ming/config.m430
-rw-r--r--ext/ming/ming.c3046
-rw-r--r--ext/ming/ming.dsp107
-rw-r--r--ext/ming/php_ming.h164
-rw-r--r--ext/mnogosearch/CREDITS2
-rw-r--r--ext/mnogosearch/Makefile.in9
-rw-r--r--ext/mnogosearch/README17
-rw-r--r--ext/mnogosearch/config.m452
-rw-r--r--ext/mnogosearch/php_mnogo.c1249
-rw-r--r--ext/mnogosearch/php_mnogo.h88
-rw-r--r--ext/mnogosearch/setup.stub10
-rw-r--r--ext/mnogosearch/test.php137
-rw-r--r--ext/msql/CREDITS2
-rw-r--r--ext/msql/Makefile.in7
-rw-r--r--ext/msql/config.m440
-rw-r--r--ext/msql/msql.dsp107
-rw-r--r--ext/msql/php_msql.c1323
-rw-r--r--ext/msql/php_msql.h82
-rw-r--r--ext/msql/setup.stub11
-rw-r--r--ext/mssql/CREDITS2
-rw-r--r--ext/mssql/mssql.dsp117
-rw-r--r--ext/mssql/mssql_win32_howto.txt35
-rw-r--r--ext/mssql/php_mssql.c2128
-rw-r--r--ext/mssql/php_mssql.h166
-rw-r--r--ext/muscat/EXPERIMENTAL1
-rw-r--r--ext/muscat/LICENSE282
-rw-r--r--ext/muscat/LICENSE.about30
-rw-r--r--ext/muscat/Makefile.in7
-rw-r--r--ext/muscat/config.m435
-rw-r--r--ext/muscat/muscat.c356
-rw-r--r--ext/muscat/muscat.php10
-rw-r--r--ext/muscat/muscat_handles.h60
-rw-r--r--ext/muscat/muscat_net.c91
-rw-r--r--ext/muscat/muscat_net.h59
-rw-r--r--ext/muscat/php_muscat.h99
-rw-r--r--ext/mysql/CREDITS2
-rw-r--r--ext/mysql/Makefile.in10
-rw-r--r--ext/mysql/config.m4100
-rw-r--r--ext/mysql/libmysql/Makefile.in16
-rw-r--r--ext/mysql/libmysql/acinclude.m4355
-rw-r--r--ext/mysql/libmysql/array.c163
-rw-r--r--ext/mysql/libmysql/bchange.c25
-rw-r--r--ext/mysql/libmysql/bmove.c63
-rw-r--r--ext/mysql/libmysql/bmove_upp.c37
-rw-r--r--ext/mysql/libmysql/charset.c550
-rw-r--r--ext/mysql/libmysql/config-win.h293
-rw-r--r--ext/mysql/libmysql/ctype.c54
-rw-r--r--ext/mysql/libmysql/ctype_autoconf.c44
-rw-r--r--ext/mysql/libmysql/ctype_extra_sources.c82
-rw-r--r--ext/mysql/libmysql/dbug.c2076
-rw-r--r--ext/mysql/libmysql/dbug.h80
-rw-r--r--ext/mysql/libmysql/default.c384
-rw-r--r--ext/mysql/libmysql/dll.c98
-rw-r--r--ext/mysql/libmysql/errmsg.c68
-rw-r--r--ext/mysql/libmysql/errmsg.h41
-rw-r--r--ext/mysql/libmysql/errors.c78
-rwxr-xr-xext/mysql/libmysql/fix_copyright35
-rw-r--r--ext/mysql/libmysql/get_password.c198
-rw-r--r--ext/mysql/libmysql/global.h913
-rw-r--r--ext/mysql/libmysql/int2str.c141
-rw-r--r--ext/mysql/libmysql/is_prefix.c20
-rw-r--r--ext/mysql/libmysql/libmysql.c2566
-rw-r--r--ext/mysql/libmysql/libmysql.dsp585
-rw-r--r--ext/mysql/libmysql/list.c102
-rw-r--r--ext/mysql/libmysql/longlong2str.c129
-rw-r--r--ext/mysql/libmysql/m_ctype.h144
-rw-r--r--ext/mysql/libmysql/m_string.h227
-rw-r--r--ext/mysql/libmysql/mf_casecnv.c238
-rw-r--r--ext/mysql/libmysql/mf_dirname.c92
-rw-r--r--ext/mysql/libmysql/mf_fn_ext.c32
-rw-r--r--ext/mysql/libmysql/mf_format.c142
-rw-r--r--ext/mysql/libmysql/mf_loadpath.c40
-rw-r--r--ext/mysql/libmysql/mf_pack.c518
-rw-r--r--ext/mysql/libmysql/mf_path.c106
-rw-r--r--ext/mysql/libmysql/mf_unixpath.c19
-rw-r--r--ext/mysql/libmysql/mf_wcomp.c54
-rw-r--r--ext/mysql/libmysql/mulalloc.c39
-rw-r--r--ext/mysql/libmysql/my_alarm.h46
-rw-r--r--ext/mysql/libmysql/my_alloc.c140
-rw-r--r--ext/mysql/libmysql/my_compress.c73
-rw-r--r--ext/mysql/libmysql/my_config.h11
-rw-r--r--ext/mysql/libmysql/my_create.c50
-rw-r--r--ext/mysql/libmysql/my_delete.c22
-rw-r--r--ext/mysql/libmysql/my_dir.h86
-rw-r--r--ext/mysql/libmysql/my_div.c17
-rw-r--r--ext/mysql/libmysql/my_error.c110
-rw-r--r--ext/mysql/libmysql/my_fopen.c160
-rw-r--r--ext/mysql/libmysql/my_getwd.c172
-rw-r--r--ext/mysql/libmysql/my_init.c312
-rw-r--r--ext/mysql/libmysql/my_lib.c597
-rw-r--r--ext/mysql/libmysql/my_list.h33
-rw-r--r--ext/mysql/libmysql/my_malloc.c70
-rw-r--r--ext/mysql/libmysql/my_messnc.c22
-rw-r--r--ext/mysql/libmysql/my_net.c35
-rw-r--r--ext/mysql/libmysql/my_net.h27
-rw-r--r--ext/mysql/libmysql/my_once.c74
-rw-r--r--ext/mysql/libmysql/my_open.c113
-rw-r--r--ext/mysql/libmysql/my_pthread.c462
-rw-r--r--ext/mysql/libmysql/my_pthread.h565
-rw-r--r--ext/mysql/libmysql/my_read.c52
-rw-r--r--ext/mysql/libmysql/my_realloc.c51
-rw-r--r--ext/mysql/libmysql/my_static.c86
-rw-r--r--ext/mysql/libmysql/my_static.h56
-rw-r--r--ext/mysql/libmysql/my_sys.h589
-rw-r--r--ext/mysql/libmysql/my_tempnam.c128
-rw-r--r--ext/mysql/libmysql/my_thr_init.c212
-rw-r--r--ext/mysql/libmysql/my_wincond.c128
-rw-r--r--ext/mysql/libmysql/my_winthread.c105
-rw-r--r--ext/mysql/libmysql/my_write.c75
-rw-r--r--ext/mysql/libmysql/mysql.h294
-rw-r--r--ext/mysql/libmysql/mysql.m418
-rw-r--r--ext/mysql/libmysql/mysql_com.h225
-rw-r--r--ext/mysql/libmysql/mysql_version.h27
-rw-r--r--ext/mysql/libmysql/mysqld_error.h211
-rw-r--r--ext/mysql/libmysql/mysys_err.h47
-rw-r--r--ext/mysql/libmysql/mysys_priv.h18
-rw-r--r--ext/mysql/libmysql/net.c664
-rw-r--r--ext/mysql/libmysql/password.c178
-rw-r--r--ext/mysql/libmysql/raid.h147
-rw-r--r--ext/mysql/libmysql/safemalloc.c510
-rw-r--r--ext/mysql/libmysql/stamp-h.in1
-rw-r--r--ext/mysql/libmysql/str2int.c188
-rw-r--r--ext/mysql/libmysql/strcend.c42
-rw-r--r--ext/mysql/libmysql/strcont.c32
-rw-r--r--ext/mysql/libmysql/strend.c33
-rw-r--r--ext/mysql/libmysql/strfill.c22
-rw-r--r--ext/mysql/libmysql/string.c113
-rw-r--r--ext/mysql/libmysql/strinstr.c36
-rw-r--r--ext/mysql/libmysql/strmake.c39
-rw-r--r--ext/mysql/libmysql/strmov.c45
-rw-r--r--ext/mysql/libmysql/strnmov.c22
-rw-r--r--ext/mysql/libmysql/strto.c190
-rw-r--r--ext/mysql/libmysql/strtoll.c11
-rw-r--r--ext/mysql/libmysql/strtoull.c12
-rw-r--r--ext/mysql/libmysql/strxmov.c33
-rw-r--r--ext/mysql/libmysql/thr_alarm.h98
-rw-r--r--ext/mysql/libmysql/thr_mutex.c217
-rw-r--r--ext/mysql/libmysql/typelib.c92
-rwxr-xr-xext/mysql/libmysql/update_sources103
-rw-r--r--ext/mysql/libmysql/violite.c411
-rw-r--r--ext/mysql/libmysql/violite.h103
-rw-r--r--ext/mysql/mysql.dsp171
-rw-r--r--ext/mysql/php_mysql.c2066
-rw-r--r--ext/mysql/php_mysql.h123
-rw-r--r--ext/mysql/setup.stub7
-rw-r--r--ext/ncurses/CREDITS2
-rw-r--r--ext/ncurses/EXPERIMENTAL0
-rw-r--r--ext/ncurses/Makefile.in8
-rw-r--r--ext/ncurses/c-prototypes263
-rw-r--r--ext/ncurses/config.m444
-rw-r--r--ext/ncurses/example1.php28
-rw-r--r--ext/ncurses/ncurses.c179
-rw-r--r--ext/ncurses/ncurses.php10
-rw-r--r--ext/ncurses/ncurses_fe.c118
-rw-r--r--ext/ncurses/ncurses_functions.c928
-rw-r--r--ext/ncurses/php_ncurses.h83
-rw-r--r--ext/ncurses/php_ncurses_fe.h107
-rw-r--r--ext/ncurses/tests/001.phpt23
-rw-r--r--ext/notes/notes.dsp202
-rw-r--r--ext/notes/notes.dsw29
-rw-r--r--ext/notes/php_notes.c2762
-rw-r--r--ext/notes/php_notes.h47
-rw-r--r--ext/oci8/CREDITS2
-rw-r--r--ext/oci8/Makefile.in6
-rw-r--r--ext/oci8/config.m490
-rw-r--r--ext/oci8/oci8.c4927
-rw-r--r--ext/oci8/oci8.dsp113
-rw-r--r--ext/oci8/oci8.dsw29
-rw-r--r--ext/oci8/php_oci8.h220
-rw-r--r--ext/oci8/setup.stub6
-rw-r--r--ext/odbc/CREDITS2
-rw-r--r--ext/odbc/Makefile.in7
-rw-r--r--ext/odbc/config.m4547
-rw-r--r--ext/odbc/php_odbc.c3545
-rw-r--r--ext/odbc/php_odbc.h358
-rw-r--r--ext/odbc/php_velocis.h92
-rw-r--r--ext/odbc/setup.stub154
-rw-r--r--ext/odbc/velocis.c657
-rw-r--r--ext/openssl/CREDITS2
-rw-r--r--ext/openssl/EXPERIMENTAL5
-rw-r--r--ext/openssl/Makefile.in7
-rw-r--r--ext/openssl/README321
-rw-r--r--ext/openssl/config.m47
-rw-r--r--ext/openssl/openssl.c1879
-rw-r--r--ext/openssl/openssl.dsp107
-rw-r--r--ext/openssl/php_openssl.h67
-rw-r--r--ext/oracle/CREDITS2
-rw-r--r--ext/oracle/Makefile.in6
-rw-r--r--ext/oracle/config.m4165
-rw-r--r--ext/oracle/oracle.c1803
-rw-r--r--ext/oracle/oracle.dsp113
-rw-r--r--ext/oracle/php_oracle.h147
-rw-r--r--ext/oracle/setup.stub9
-rw-r--r--ext/ovrimos/CREDITS2
-rw-r--r--ext/ovrimos/Makefile.in7
-rw-r--r--ext/ovrimos/config.m428
-rw-r--r--ext/ovrimos/ovrimos.c1101
-rw-r--r--ext/ovrimos/php_ovrimos.h45
-rw-r--r--ext/ovrimos/setup.stub6
-rw-r--r--ext/pcntl/CREDITS2
-rw-r--r--ext/pcntl/EXPERIMENTAL5
-rw-r--r--ext/pcntl/Makefile.in8
-rw-r--r--ext/pcntl/README24
-rw-r--r--ext/pcntl/config.m415
-rwxr-xr-xext/pcntl/pcntl.c394
-rw-r--r--ext/pcntl/php_pcntl.h77
-rw-r--r--ext/pcntl/php_signal.c45
-rw-r--r--ext/pcntl/php_signal.h26
-rwxr-xr-xext/pcntl/test-pcntl.php35
-rwxr-xr-xext/pcntl/tests/001.exp0
-rwxr-xr-xext/pcntl/tests/001.out1
-rwxr-xr-xext/pcntl/tests/001.php14
-rw-r--r--ext/pcntl/tests/001.phpt22
-rw-r--r--ext/pcre/CREDITS2
-rw-r--r--ext/pcre/Makefile.in10
-rw-r--r--ext/pcre/config.m461
-rw-r--r--ext/pcre/config0.m461
-rw-r--r--ext/pcre/pcrelib/AUTHORS6
-rw-r--r--ext/pcre/pcrelib/COPYING46
-rw-r--r--ext/pcre/pcrelib/ChangeLog655
-rw-r--r--ext/pcre/pcrelib/INSTALL185
-rw-r--r--ext/pcre/pcrelib/LICENCE46
-rw-r--r--ext/pcre/pcrelib/Makefile.in7
-rw-r--r--ext/pcre/pcrelib/NEWS54
-rw-r--r--ext/pcre/pcrelib/NON-UNIX-USE50
-rw-r--r--ext/pcre/pcrelib/README270
-rwxr-xr-xext/pcre/pcrelib/RunTest148
-rw-r--r--ext/pcre/pcrelib/chartables.c183
-rw-r--r--ext/pcre/pcrelib/dftables.c148
-rw-r--r--ext/pcre/pcrelib/dll.mk60
-rw-r--r--ext/pcre/pcrelib/doc/Tech.Notes243
-rw-r--r--ext/pcre/pcrelib/doc/pcre.31810
-rw-r--r--ext/pcre/pcrelib/doc/pcre.html2397
-rw-r--r--ext/pcre/pcrelib/doc/pcre.txt2125
-rw-r--r--ext/pcre/pcrelib/doc/pcregrep.176
-rw-r--r--ext/pcre/pcrelib/doc/pcregrep.html105
-rw-r--r--ext/pcre/pcrelib/doc/pcregrep.txt87
-rw-r--r--ext/pcre/pcrelib/doc/pcreposix.3149
-rw-r--r--ext/pcre/pcrelib/doc/pcreposix.html191
-rw-r--r--ext/pcre/pcrelib/doc/pcreposix.txt159
-rw-r--r--ext/pcre/pcrelib/doc/pcretest.txt246
-rw-r--r--ext/pcre/pcrelib/doc/perltest.txt29
-rw-r--r--ext/pcre/pcrelib/get.c227
-rw-r--r--ext/pcre/pcrelib/internal.h385
-rw-r--r--ext/pcre/pcrelib/maketables.c132
-rw-r--r--ext/pcre/pcrelib/pcre-config.in59
-rw-r--r--ext/pcre/pcrelib/pcre.c5151
-rw-r--r--ext/pcre/pcrelib/pcre.def19
-rw-r--r--ext/pcre/pcrelib/pcre.h111
-rw-r--r--ext/pcre/pcrelib/pcregrep.c228
-rw-r--r--ext/pcre/pcrelib/pcreposix.c280
-rw-r--r--ext/pcre/pcrelib/pcreposix.h88
-rw-r--r--ext/pcre/pcrelib/pcretest.c1225
-rwxr-xr-xext/pcre/pcrelib/perltest169
-rwxr-xr-xext/pcre/pcrelib/perltest8208
-rw-r--r--ext/pcre/pcrelib/study.c397
-rw-r--r--ext/pcre/pcrelib/testdata/testinput11922
-rw-r--r--ext/pcre/pcrelib/testdata/testinput2712
-rw-r--r--ext/pcre/pcrelib/testdata/testinput31724
-rw-r--r--ext/pcre/pcrelib/testdata/testinput465
-rw-r--r--ext/pcre/pcrelib/testdata/testinput5118
-rw-r--r--ext/pcre/pcrelib/testdata/testinput652
-rw-r--r--ext/pcre/pcrelib/testdata/testoutput12966
-rw-r--r--ext/pcre/pcrelib/testdata/testoutput22075
-rw-r--r--ext/pcre/pcrelib/testdata/testoutput32991
-rw-r--r--ext/pcre/pcrelib/testdata/testoutput4116
-rw-r--r--ext/pcre/pcrelib/testdata/testoutput5242
-rw-r--r--ext/pcre/pcrelib/testdata/testoutput6185
-rw-r--r--ext/pcre/php_pcre.c1418
-rw-r--r--ext/pcre/php_pcre.h86
-rw-r--r--ext/pcre/setup.stub6
-rw-r--r--ext/pdf/CREDITS2
-rw-r--r--ext/pdf/Makefile.in8
-rw-r--r--ext/pdf/config.m4121
-rw-r--r--ext/pdf/pdf.c3161
-rw-r--r--ext/pdf/pdf.dsp114
-rw-r--r--ext/pdf/php_pdf.h183
-rw-r--r--ext/pdf/setup.stub7
-rw-r--r--ext/pfpro/CREDITS2
-rw-r--r--ext/pfpro/Makefile.in8
-rw-r--r--ext/pfpro/TODO12
-rw-r--r--ext/pfpro/config.m463
-rw-r--r--ext/pfpro/pfpro.c604
-rw-r--r--ext/pfpro/php_pfpro.h88
-rw-r--r--ext/pgsql/CREDITS2
-rw-r--r--ext/pgsql/Makefile.in9
-rw-r--r--ext/pgsql/config.m446
-rw-r--r--ext/pgsql/pgsql.c2002
-rw-r--r--ext/pgsql/pgsql.dsp167
-rw-r--r--ext/pgsql/php_pgsql.h155
-rw-r--r--ext/pgsql/setup.stub8
-rw-r--r--ext/posix/CREDITS2
-rw-r--r--ext/posix/Makefile.in6
-rw-r--r--ext/posix/config.m413
-rw-r--r--ext/posix/php_posix.h85
-rw-r--r--ext/posix/posix.c962
-rw-r--r--ext/pspell/CREDITS2
-rw-r--r--ext/pspell/Makefile.in7
-rw-r--r--ext/pspell/README51
-rw-r--r--ext/pspell/config.m433
-rw-r--r--ext/pspell/php_pspell.h52
-rw-r--r--ext/pspell/pspell.c805
-rw-r--r--ext/qtdom/CREDITS2
-rw-r--r--ext/qtdom/EXPERIMENTAL5
-rw-r--r--ext/qtdom/Makefile.in10
-rw-r--r--ext/qtdom/config.m434
-rw-r--r--ext/qtdom/qtdom.c279
-rw-r--r--ext/qtdom/qtdom.h87
-rw-r--r--ext/qtdom/qtdom.php10
-rw-r--r--ext/qtdom/qtdom_qt.cpp371
-rw-r--r--ext/qtdom/qtdom_qt.h67
-rw-r--r--ext/readline/CREDITS2
-rw-r--r--ext/readline/Makefile.in7
-rw-r--r--ext/readline/README.libedit4
-rw-r--r--ext/readline/config.m461
-rw-r--r--ext/readline/php_readline.h43
-rw-r--r--ext/readline/readline.c442
-rw-r--r--ext/readline/setup.stub3
-rw-r--r--ext/recode/CREDITS2
-rw-r--r--ext/recode/Makefile.in7
-rw-r--r--ext/recode/config.m465
-rw-r--r--ext/recode/php_recode.h89
-rw-r--r--ext/recode/recode.c231
-rw-r--r--ext/recode/setup.stub3
-rw-r--r--ext/rpc/CREDITS2
-rw-r--r--ext/rpc/Makefile.in25
-rw-r--r--ext/rpc/com/CREDITS2
-rw-r--r--ext/rpc/com/com_wrapper.c1743
-rw-r--r--ext/rpc/com/com_wrapper.h43
-rw-r--r--ext/rpc/com/conversion.c889
-rw-r--r--ext/rpc/com/conversion.h14
-rw-r--r--ext/rpc/com/php_com.h33
-rw-r--r--ext/rpc/com/php_variant.h21
-rw-r--r--ext/rpc/com/variant.c432
-rw-r--r--ext/rpc/dotnet/CREDITS2
-rw-r--r--ext/rpc/dotnet/EXPERIMENTAL5
-rw-r--r--ext/rpc/dotnet/README32
-rw-r--r--ext/rpc/dotnet/dotnet.cpp237
-rw-r--r--ext/rpc/dotnet/dotnet.dsp171
-rw-r--r--ext/rpc/dotnet/dotnet.php8
-rw-r--r--ext/rpc/dotnet/php_dotnet.h21
-rw-r--r--ext/rpc/java/CREDITS2
-rw-r--r--ext/rpc/java/Makefile.in25
-rw-r--r--ext/rpc/java/README243
-rw-r--r--ext/rpc/java/config.m4118
-rw-r--r--ext/rpc/java/except.php23
-rw-r--r--ext/rpc/java/java.c795
-rw-r--r--ext/rpc/java/java.dsp258
-rw-r--r--ext/rpc/java/jawt.php27
-rw-r--r--ext/rpc/java/jver.php17
-rw-r--r--ext/rpc/java/reflect.java419
-rw-r--r--ext/sablot/CREDITS2
-rw-r--r--ext/sablot/EXPERIMENTAL5
-rw-r--r--ext/sablot/Makefile.in8
-rw-r--r--ext/sablot/config.m469
-rw-r--r--ext/sablot/php_sablot.h150
-rw-r--r--ext/sablot/sablot.c1698
-rw-r--r--ext/sablot/sablot.dsp107
-rw-r--r--ext/satellite/CREDITS2
-rw-r--r--ext/satellite/EXPERIMENTAL5
-rw-r--r--ext/satellite/Makefile.in54
-rw-r--r--ext/satellite/README89
-rw-r--r--ext/satellite/class.c180
-rw-r--r--ext/satellite/class.h219
-rw-r--r--ext/satellite/common.c31
-rw-r--r--ext/satellite/common.h70
-rw-r--r--ext/satellite/config.m440
-rw-r--r--ext/satellite/corba.c131
-rw-r--r--ext/satellite/corba.h43
-rw-r--r--ext/satellite/enum.c174
-rw-r--r--ext/satellite/enum.h34
-rw-r--r--ext/satellite/findtype.c145
-rw-r--r--ext/satellite/findtype.h43
-rw-r--r--ext/satellite/hashtable.c101
-rw-r--r--ext/satellite/hashtable.h35
-rw-r--r--ext/satellite/namedvalue_to_zval.c315
-rw-r--r--ext/satellite/namedvalue_to_zval.h36
-rw-r--r--ext/satellite/object.c865
-rw-r--r--ext/satellite/object.h37
-rw-r--r--ext/satellite/php_orbit.c200
-rw-r--r--ext/satellite/php_orbit.h42
-rw-r--r--ext/satellite/struct.c330
-rw-r--r--ext/satellite/struct.h35
-rw-r--r--ext/satellite/typecode.c436
-rw-r--r--ext/satellite/typecode.h34
-rw-r--r--ext/satellite/typemanager.c596
-rw-r--r--ext/satellite/typemanager.h112
-rw-r--r--ext/satellite/zval_to_namedvalue.c480
-rw-r--r--ext/satellite/zval_to_namedvalue.h33
-rw-r--r--ext/session/CREDITS2
-rw-r--r--ext/session/Makefile.in7
-rw-r--r--ext/session/config.m439
-rw-r--r--ext/session/mod_files.c349
-rw-r--r--ext/session/mod_files.h27
-rw-r--r--ext/session/mod_files.sh16
-rw-r--r--ext/session/mod_mm.c365
-rw-r--r--ext/session/mod_mm.h41
-rw-r--r--ext/session/mod_user.c185
-rw-r--r--ext/session/mod_user.h39
-rw-r--r--ext/session/php_session.h205
-rw-r--r--ext/session/session.c1464
-rw-r--r--ext/session/setup.stub6
-rw-r--r--ext/session/tests/001.phpt27
-rw-r--r--ext/session/tests/002.phpt10
-rw-r--r--ext/session/tests/003.phpt36
-rw-r--r--ext/session/tests/004.phpt103
-rw-r--r--ext/session/tests/005.phpt138
-rw-r--r--ext/session/tests/006.phpt62
-rw-r--r--ext/shmop/CREDITS2
-rw-r--r--ext/shmop/Makefile.in8
-rw-r--r--ext/shmop/README65
-rw-r--r--ext/shmop/config.m48
-rw-r--r--ext/shmop/php_shmop.h81
-rw-r--r--ext/shmop/setup.stub5
-rw-r--r--ext/shmop/shmop.c353
-rw-r--r--ext/skeleton/CREDITS1
-rw-r--r--ext/skeleton/EXPERIMENTAL0
-rwxr-xr-xext/skeleton/create_stubs335
-rw-r--r--ext/skeleton/php_skeleton.h51
-rw-r--r--ext/skeleton/skeleton.c148
-rw-r--r--ext/skeleton/skeleton.php10
-rw-r--r--ext/skeleton/tests/001.phpt23
-rw-r--r--ext/snmp/CREDITS2
-rw-r--r--ext/snmp/Makefile.in9
-rw-r--r--ext/snmp/config.m474
-rw-r--r--ext/snmp/php_snmp.h49
-rw-r--r--ext/snmp/snmp.c415
-rw-r--r--ext/snmp/snmp.dsp109
-rw-r--r--ext/snmp/winsnmp.c243
-rw-r--r--ext/sockets/CREDITS2
-rw-r--r--ext/sockets/EXPERIMENTAL5
-rw-r--r--ext/sockets/Makefile.in7
-rw-r--r--ext/sockets/config.m414
-rw-r--r--ext/sockets/php_sockets.h119
-rw-r--r--ext/sockets/php_sockets_win.c175
-rw-r--r--ext/sockets/php_sockets_win.h83
-rw-r--r--ext/sockets/sockets.c1964
-rw-r--r--ext/sockets/sockets.dsp116
-rw-r--r--ext/sockets/sockets.php10
-rw-r--r--ext/standard/CREDITS3
-rw-r--r--ext/standard/Makefile.in18
-rw-r--r--ext/standard/array.c3127
-rw-r--r--ext/standard/assert.c334
-rw-r--r--ext/standard/base64.c201
-rw-r--r--ext/standard/base64.h37
-rw-r--r--ext/standard/basic_functions.c2627
-rw-r--r--ext/standard/basic_functions.h225
-rw-r--r--ext/standard/browscap.c268
-rw-r--r--ext/standard/config.m4232
-rw-r--r--ext/standard/crc32.c136
-rw-r--r--ext/standard/credits.c123
-rw-r--r--ext/standard/credits.h42
-rw-r--r--ext/standard/credits_ext.h89
-rw-r--r--ext/standard/credits_sapi.h24
-rw-r--r--ext/standard/crypt.c185
-rw-r--r--ext/standard/cyr_convert.c299
-rw-r--r--ext/standard/cyr_convert.h29
-rw-r--r--ext/standard/datetime.c832
-rw-r--r--ext/standard/datetime.h45
-rw-r--r--ext/standard/dir.c373
-rw-r--r--ext/standard/dl.c234
-rw-r--r--ext/standard/dl.h34
-rw-r--r--ext/standard/dns.c337
-rw-r--r--ext/standard/dns.h42
-rw-r--r--ext/standard/exec.c494
-rw-r--r--ext/standard/exec.h34
-rw-r--r--ext/standard/file.c2464
-rw-r--r--ext/standard/file.h125
-rw-r--r--ext/standard/filestat.c853
-rw-r--r--ext/standard/flock_compat.c225
-rw-r--r--ext/standard/flock_compat.h49
-rw-r--r--ext/standard/formatted_print.c670
-rw-r--r--ext/standard/fsock.c767
-rw-r--r--ext/standard/fsock.h88
-rw-r--r--ext/standard/ftp_fopen_wrapper.c324
-rw-r--r--ext/standard/head.c201
-rw-r--r--ext/standard/head.h31
-rw-r--r--ext/standard/html.c490
-rw-r--r--ext/standard/html.h36
-rw-r--r--ext/standard/http_fopen_wrapper.c316
-rw-r--r--ext/standard/image.c530
-rw-r--r--ext/standard/incomplete_class.c150
-rw-r--r--ext/standard/info.c574
-rw-r--r--ext/standard/info.h80
-rw-r--r--ext/standard/iptc.c395
-rw-r--r--ext/standard/lcg.c108
-rw-r--r--ext/standard/levenshtein.c162
-rw-r--r--ext/standard/link.c170
-rw-r--r--ext/standard/mail.c220
-rw-r--r--ext/standard/math.c730
-rw-r--r--ext/standard/md5.c377
-rw-r--r--ext/standard/md5.h63
-rw-r--r--ext/standard/metaphone.c473
-rw-r--r--ext/standard/microtime.c149
-rw-r--r--ext/standard/microtime.h28
-rw-r--r--ext/standard/output.c638
-rw-r--r--ext/standard/pack.c877
-rw-r--r--ext/standard/pack.h28
-rw-r--r--ext/standard/pageinfo.c140
-rw-r--r--ext/standard/pageinfo.h31
-rw-r--r--ext/standard/parsedate.y1028
-rw-r--r--ext/standard/php_array.h109
-rw-r--r--ext/standard/php_assert.h32
-rw-r--r--ext/standard/php_browscap.h29
-rw-r--r--ext/standard/php_crypt.h39
-rw-r--r--ext/standard/php_dir.h39
-rw-r--r--ext/standard/php_ext_syslog.h39
-rw-r--r--ext/standard/php_filestat.h76
-rw-r--r--ext/standard/php_fopen_wrapper.c58
-rw-r--r--ext/standard/php_fopen_wrappers.h30
-rw-r--r--ext/standard/php_image.h26
-rw-r--r--ext/standard/php_incomplete_class.h65
-rw-r--r--ext/standard/php_iptc.h27
-rw-r--r--ext/standard/php_lcg.h44
-rw-r--r--ext/standard/php_link.h33
-rw-r--r--ext/standard/php_mail.h33
-rw-r--r--ext/standard/php_math.h128
-rw-r--r--ext/standard/php_metaphone.h26
-rw-r--r--ext/standard/php_output.h94
-rw-r--r--ext/standard/php_parsedate.h26
-rw-r--r--ext/standard/php_rand.h61
-rw-r--r--ext/standard/php_smart_str.h91
-rw-r--r--ext/standard/php_smart_str_public.h30
-rw-r--r--ext/standard/php_standard.h67
-rw-r--r--ext/standard/php_string.h142
-rw-r--r--ext/standard/php_var.h67
-rw-r--r--ext/standard/quot_print.c138
-rw-r--r--ext/standard/quot_print.h26
-rw-r--r--ext/standard/rand.c358
-rw-r--r--ext/standard/reg.c670
-rw-r--r--ext/standard/reg.h60
-rw-r--r--ext/standard/scanf.c1250
-rw-r--r--ext/standard/scanf.h51
-rw-r--r--ext/standard/soundex.c122
-rw-r--r--ext/standard/string.c3371
-rw-r--r--ext/standard/strnatcmp.c173
-rw-r--r--ext/standard/syslog.c281
-rw-r--r--ext/standard/tests/file/001.phpt149
-rw-r--r--ext/standard/tests/general_functions/001.phpt55
-rw-r--r--ext/standard/tests/general_functions/002.phpt13
-rw-r--r--ext/standard/tests/general_functions/003.phpt54
-rw-r--r--ext/standard/tests/general_functions/004.data4
-rw-r--r--ext/standard/tests/general_functions/004.phpt17
-rw-r--r--ext/standard/tests/general_functions/005.phpt26
-rw-r--r--ext/standard/tests/math/001.phpt25
-rw-r--r--ext/standard/tests/reg/001.phpt9
-rw-r--r--ext/standard/tests/reg/002.phpt9
-rw-r--r--ext/standard/tests/reg/003.phpt10
-rw-r--r--ext/standard/tests/reg/004.phpt16
-rw-r--r--ext/standard/tests/reg/005.phpt20
-rw-r--r--ext/standard/tests/reg/006.phpt10
-rw-r--r--ext/standard/tests/reg/007.phpt12
-rw-r--r--ext/standard/tests/reg/008.phpt10
-rw-r--r--ext/standard/tests/reg/009.phpt19
-rw-r--r--ext/standard/tests/reg/010.phpt9
-rw-r--r--ext/standard/tests/reg/011.phpt9
-rw-r--r--ext/standard/tests/reg/012.phpt9
-rw-r--r--ext/standard/tests/reg/013.phpt9
-rw-r--r--ext/standard/tests/reg/014.phpt9
-rw-r--r--ext/standard/tests/reg/015.phpt8
-rw-r--r--ext/standard/tests/reg/016.phpt8
-rw-r--r--ext/standard/tests/time/001.phpt19
-rw-r--r--ext/standard/tests/time/002.phpt40
-rw-r--r--ext/standard/type.c112
-rw-r--r--ext/standard/type.h33
-rw-r--r--ext/standard/uniqid.c103
-rw-r--r--ext/standard/uniqid.h26
-rw-r--r--ext/standard/url.c470
-rw-r--r--ext/standard/url.h54
-rw-r--r--ext/standard/url_scanner.c385
-rw-r--r--ext/standard/url_scanner.h54
-rw-r--r--ext/standard/url_scanner_ex.c773
-rw-r--r--ext/standard/url_scanner_ex.h54
-rw-r--r--ext/standard/url_scanner_ex.re392
-rw-r--r--ext/standard/var.c676
-rw-r--r--ext/swf/CREDITS2
-rw-r--r--ext/swf/Makefile.in7
-rw-r--r--ext/swf/config.m434
-rw-r--r--ext/swf/php_swf.h123
-rw-r--r--ext/swf/swf.c1258
-rw-r--r--ext/sybase/CREDITS2
-rw-r--r--ext/sybase/Makefile.in7
-rw-r--r--ext/sybase/config.m428
-rw-r--r--ext/sybase/php_sybase_db.c1366
-rw-r--r--ext/sybase/php_sybase_db.h127
-rw-r--r--ext/sybase/setup.stub11
-rw-r--r--ext/sybase_ct/CREDITS2
-rw-r--r--ext/sybase_ct/Makefile.in5
-rw-r--r--ext/sybase_ct/config.m444
-rw-r--r--ext/sybase_ct/php_sybase_ct.c1681
-rw-r--r--ext/sybase_ct/php_sybase_ct.h122
-rw-r--r--ext/sybase_ct/setup.stub6
-rw-r--r--ext/sybase_ct/sybase_ct.dsp114
-rw-r--r--ext/sysvsem/CREDITS2
-rw-r--r--ext/sysvsem/Makefile.in6
-rw-r--r--ext/sysvsem/config.m427
-rw-r--r--ext/sysvsem/php_sysvsem.h56
-rw-r--r--ext/sysvsem/setup.stub5
-rw-r--r--ext/sysvsem/sysvsem.c438
-rw-r--r--ext/sysvshm/CREDITS2
-rw-r--r--ext/sysvshm/Makefile.in6
-rw-r--r--ext/sysvshm/config.m49
-rw-r--r--ext/sysvshm/php_sysvshm.h85
-rw-r--r--ext/sysvshm/setup.stub5
-rw-r--r--ext/sysvshm/sysvshm.c427
-rw-r--r--ext/vpopmail/CREDITS2
-rw-r--r--ext/vpopmail/EXPERIMENTAL5
-rw-r--r--ext/vpopmail/Makefile.in8
-rw-r--r--ext/vpopmail/README194
-rw-r--r--ext/vpopmail/config.m458
-rw-r--r--ext/vpopmail/php_vpopmail.c947
-rw-r--r--ext/vpopmail/php_vpopmail.h99
-rw-r--r--ext/wddx/CREDITS2
-rw-r--r--ext/wddx/Makefile.in5
-rw-r--r--ext/wddx/config.m414
-rw-r--r--ext/wddx/php_wddx.h46
-rw-r--r--ext/wddx/php_wddx_api.h66
-rw-r--r--ext/wddx/wddx.c1211
-rw-r--r--ext/xml/CREDITS2
-rw-r--r--ext/xml/Makefile.in11
-rw-r--r--ext/xml/config.m457
-rw-r--r--ext/xml/expat/Changes34
-rw-r--r--ext/xml/expat/Makefile.in7
-rw-r--r--ext/xml/expat/README57
-rw-r--r--ext/xml/expat/README.php11
-rw-r--r--ext/xml/expat/ascii.h86
-rw-r--r--ext/xml/expat/asciitab.h37
-rw-r--r--ext/xml/expat/expat.h712
-rw-r--r--ext/xml/expat/iasciitab.h38
-rw-r--r--ext/xml/expat/latin1tab.h37
-rw-r--r--ext/xml/expat/nametab.h150
-rw-r--r--ext/xml/expat/utf8tab.h38
-rw-r--r--ext/xml/expat/winconfig.h27
-rw-r--r--ext/xml/expat/xmlparse.c4629
-rw-r--r--ext/xml/expat/xmlrole.c1279
-rw-r--r--ext/xml/expat/xmlrole.h100
-rw-r--r--ext/xml/expat/xmltok.c1572
-rw-r--r--ext/xml/expat/xmltok.h299
-rw-r--r--ext/xml/expat/xmltok_impl.c1770
-rw-r--r--ext/xml/expat/xmltok_impl.h46
-rw-r--r--ext/xml/expat/xmltok_ns.c98
-rw-r--r--ext/xml/php_xml.h164
-rw-r--r--ext/xml/tests/001.phpt97
-rw-r--r--ext/xml/tests/002.phpt90
-rw-r--r--ext/xml/tests/003.phpt89
-rw-r--r--ext/xml/tests/004.phpt58
-rw-r--r--ext/xml/tests/006.phpt14
-rw-r--r--ext/xml/tests/inc.ent1
-rw-r--r--ext/xml/tests/skipif.inc9
-rw-r--r--ext/xml/tests/xmltest.xml20
-rw-r--r--ext/xml/xml.c1657
-rw-r--r--ext/xslt/EXPERIMENTAL5
-rw-r--r--ext/xslt/Makefile.in8
-rw-r--r--ext/xslt/README.XSLT-BACKENDS284
-rw-r--r--ext/xslt/config.m489
-rw-r--r--ext/xslt/php_sablot.h125
-rw-r--r--ext/xslt/php_xslt.h60
-rw-r--r--ext/xslt/sablot.c1549
-rw-r--r--ext/xslt/tests/001.phpt12
-rw-r--r--ext/xslt/xslt.c256
-rw-r--r--ext/xslt/xslt.dsp115
-rw-r--r--ext/yaz/CREDITS2
-rw-r--r--ext/yaz/Makefile.in7
-rw-r--r--ext/yaz/README5
-rw-r--r--ext/yaz/config.m429
-rw-r--r--ext/yaz/php_yaz.c2495
-rw-r--r--ext/yaz/php_yaz.h59
-rw-r--r--ext/yaz/setup.stub8
-rw-r--r--ext/yaz/yaz.dsp111
-rw-r--r--ext/yp/CREDITS2
-rw-r--r--ext/yp/Makefile.in6
-rw-r--r--ext/yp/config.m415
-rw-r--r--ext/yp/php_yp.h79
-rw-r--r--ext/yp/setup.stub6
-rw-r--r--ext/yp/yp.c412
-rw-r--r--ext/zip/CREDITS2
-rw-r--r--ext/zip/Makefile.in8
-rw-r--r--ext/zip/config.m439
-rw-r--r--ext/zip/php_zip.h66
-rw-r--r--ext/zip/tests/001.phpt23
-rw-r--r--ext/zip/zip.c338
-rw-r--r--ext/zlib/CREDITS2
-rw-r--r--ext/zlib/Makefile.in7
-rw-r--r--ext/zlib/config0.m453
-rw-r--r--ext/zlib/php_zlib.h90
-rw-r--r--ext/zlib/setup.stub7
-rw-r--r--ext/zlib/zlib.c1288
-rw-r--r--ext/zlib/zlib.dsp113
-rw-r--r--ext/zlib/zlib_fopen_wrapper.c104
-rw-r--r--ext/zlib/zlib_win32_howto.txt16
-rw-r--r--footer8
-rwxr-xr-xgenfiles22
-rw-r--r--header18
-rw-r--r--ltmain.sh4946
-rw-r--r--main/Makefile.in16
-rw-r--r--main/SAPI.c603
-rw-r--r--main/SAPI.h235
-rw-r--r--main/alloca.c499
-rw-r--r--main/build-defs.h.in88
-rw-r--r--main/config.w32.h336
-rw-r--r--main/fopen_wrappers.c587
-rw-r--r--main/fopen_wrappers.h91
-rw-r--r--main/internal_functions.c.in61
-rw-r--r--main/internal_functions_registry.h38
-rw-r--r--main/internal_functions_win32.c112
-rw-r--r--main/logos.h1059
-rw-r--r--main/main.c1362
-rw-r--r--main/mergesort.c356
-rw-r--r--main/network.c347
-rw-r--r--main/output.c638
-rw-r--r--main/php.h348
-rw-r--r--main/php3_compat.h102
-rw-r--r--main/php_compat.h96
-rw-r--r--main/php_content_types.c66
-rw-r--r--main/php_content_types.h10
-rw-r--r--main/php_globals.h143
-rw-r--r--main/php_ini.c380
-rw-r--r--main/php_ini.h74
-rw-r--r--main/php_logos.c98
-rw-r--r--main/php_logos.h10
-rw-r--r--main/php_main.h60
-rw-r--r--main/php_network.h56
-rw-r--r--main/php_open_temporary_file.c204
-rw-r--r--main/php_open_temporary_file.h24
-rw-r--r--main/php_output.h94
-rw-r--r--main/php_realpath.c283
-rw-r--r--main/php_reentrancy.h128
-rw-r--r--main/php_regex.h45
-rw-r--r--main/php_sprintf.c51
-rwxr-xr-xmain/php_streams.h109
-rw-r--r--main/php_syslog.h32
-rw-r--r--main/php_ticks.c81
-rw-r--r--main/php_ticks.h37
-rw-r--r--main/php_variables.c338
-rw-r--r--main/php_variables.h41
-rw-r--r--main/php_version.h3
-rw-r--r--main/reentrancy.c441
-rw-r--r--main/rfc1867.c484
-rw-r--r--main/rfc1867.h15
-rw-r--r--main/safe_mode.c174
-rw-r--r--main/safe_mode.h14
-rw-r--r--main/snprintf.c949
-rw-r--r--main/snprintf.h44
-rwxr-xr-xmain/streams.c360
-rw-r--r--main/strlcat.c86
-rw-r--r--main/strlcpy.c83
-rw-r--r--main/win95nt.h63
-rwxr-xr-xmakedist148
-rw-r--r--makerpm176
-rwxr-xr-xpear/CMD.php286
-rw-r--r--pear/CODING_STANDARDS241
-rw-r--r--pear/Cache.php355
-rw-r--r--pear/Cache.xml20
-rw-r--r--pear/Console/Getopt.php202
-rw-r--r--pear/DB.php671
-rw-r--r--pear/HTTP.php112
-rw-r--r--pear/ITX.xml21
-rw-r--r--pear/Log.php194
-rw-r--r--pear/Mail.php176
-rw-r--r--pear/Makefile.in191
-rw-r--r--pear/PEAR.php606
-rw-r--r--pear/PEAR/Common.php187
-rw-r--r--pear/PEAR/Installer.php535
-rw-r--r--pear/PEAR/Packager.php312
-rw-r--r--pear/PEAR/Uploader.php61
-rw-r--r--pear/README34
-rw-r--r--pear/TODO20
-rw-r--r--pear/catalog1
-rw-r--r--pear/install-pear.txt11
-rw-r--r--pear/package.dtd125
-rw-r--r--pear/pear.m487
-rw-r--r--pear/scripts/pear.in116
-rw-r--r--pear/scripts/pearize.in165
-rw-r--r--pear/scripts/php-config.in23
-rwxr-xr-xpear/scripts/phpextdist27
-rw-r--r--pear/scripts/phpize.in31
-rw-r--r--pear/tests/PEAR.r3
-rw-r--r--pear/tests/PEAR.t16
-rw-r--r--pear/tests/PEAR_Error.r20
-rw-r--r--pear/tests/PEAR_Error.t18
-rw-r--r--pear/tests/pear1.phpt58
-rw-r--r--pear/tests/pear_error.phpt128
-rw-r--r--pear/tests/pear_error2.phpt24
-rw-r--r--pear/tests/pear_error3.phpt40
-rw-r--r--pear/tests/php.ini2
-rw-r--r--php.ini-dist800
-rw-r--r--php.ini-optimized528
-rw-r--r--php.ini-recommended528
-rw-r--r--php4.gifbin2123 -> 0 bytes
-rw-r--r--php4.spec.in48
-rw-r--r--regex/COPYRIGHT20
-rw-r--r--regex/Makefile.in5
-rw-r--r--regex/README32
-rw-r--r--regex/WHATSNEW92
-rw-r--r--regex/cclass.h30
-rw-r--r--regex/cname.h102
-rw-r--r--regex/debug.c242
-rw-r--r--regex/debug.ih14
-rw-r--r--regex/engine.c1019
-rw-r--r--regex/engine.ih35
-rw-r--r--regex/main.c510
-rw-r--r--regex/main.ih19
-rw-r--r--regex/mkh76
-rw-r--r--regex/regcomp.c1608
-rw-r--r--regex/regcomp.ih53
-rw-r--r--regex/regerror.c126
-rw-r--r--regex/regerror.ih12
-rw-r--r--regex/regex.3502
-rw-r--r--regex/regex.7233
-rw-r--r--regex/regex.dsp106
-rw-r--r--regex/regex.dsw29
-rw-r--r--regex/regex.h83
-rw-r--r--regex/regex.mak304
-rw-r--r--regex/regex2.h140
-rw-r--r--regex/regex_extra.h23
-rw-r--r--regex/regexec.c138
-rw-r--r--regex/regfree.c37
-rw-r--r--regex/split.c316
-rw-r--r--regex/tests475
-rw-r--r--regex/utils.h25
-rwxr-xr-xrun-tests.php564
-rw-r--r--sapi/Makefile.in4
-rw-r--r--sapi/README17
-rw-r--r--sapi/aolserver/CREDITS2
-rw-r--r--sapi/aolserver/Makefile.in5
-rw-r--r--sapi/aolserver/README69
-rw-r--r--sapi/aolserver/aolserver.c639
-rw-r--r--sapi/aolserver/config.m432
-rw-r--r--sapi/aolserver/php.sym2
-rw-r--r--sapi/aolserver/php4aolserver.dsp135
-rw-r--r--sapi/apache/CREDITS3
-rw-r--r--sapi/apache/Makefile.in7
-rw-r--r--sapi/apache/apMakefile.libdir4
-rw-r--r--sapi/apache/apMakefile.tmpl77
-rw-r--r--sapi/apache/config.m4237
-rw-r--r--sapi/apache/libphp4.module.in7
-rw-r--r--sapi/apache/mod_php4.c916
-rw-r--r--sapi/apache/mod_php4.exp1
-rw-r--r--sapi/apache/mod_php4.h63
-rw-r--r--sapi/apache/php.sym1
-rw-r--r--sapi/apache/php4apache.dsp151
-rw-r--r--sapi/apache/php_apache.c474
-rw-r--r--sapi/apache/php_apache_http.h24
-rw-r--r--sapi/apache/sapi_apache.c109
-rw-r--r--sapi/apache2filter/CREDITS2
-rw-r--r--sapi/apache2filter/Makefile.in7
-rw-r--r--sapi/apache2filter/README63
-rw-r--r--sapi/apache2filter/apache_config.c156
-rw-r--r--sapi/apache2filter/config.m459
-rw-r--r--sapi/apache2filter/php.sym1
-rw-r--r--sapi/apache2filter/php_apache.h51
-rw-r--r--sapi/apache2filter/php_functions.c153
-rw-r--r--sapi/apache2filter/sapi_apache2.c454
-rw-r--r--sapi/caudium/CREDITS2
-rw-r--r--sapi/caudium/Makefile.in5
-rw-r--r--sapi/caudium/README16
-rw-r--r--sapi/caudium/TODO30
-rw-r--r--sapi/caudium/caudium.c842
-rw-r--r--sapi/caudium/config.m498
-rw-r--r--sapi/cgi/CREDITS2
-rw-r--r--sapi/cgi/Makefile.in5
-rw-r--r--sapi/cgi/cgi_main.c810
-rw-r--r--sapi/cgi/config.m498
-rw-r--r--sapi/cgi/getopt.c175
-rw-r--r--sapi/cgi/php.sym0
-rw-r--r--sapi/cgi/php_getopt.h7
-rw-r--r--sapi/fastcgi/CREDITS4
-rw-r--r--sapi/fastcgi/Makefile.in5
-rw-r--r--sapi/fastcgi/README.FastCGI17
-rw-r--r--sapi/fastcgi/config.m422
-rw-r--r--sapi/fastcgi/fastcgi.c431
-rw-r--r--sapi/fastcgi/php.sym0
-rw-r--r--sapi/fastcgi/php_fastcgi.h28
-rw-r--r--sapi/fhttpd/CREDITS2
-rw-r--r--sapi/fhttpd/fhttpd.c185
-rw-r--r--sapi/isapi/CREDITS2
-rw-r--r--sapi/isapi/Makefile.in5
-rw-r--r--sapi/isapi/config.m426
-rw-r--r--sapi/isapi/php.sym5
-rw-r--r--sapi/isapi/php4isapi.c864
-rw-r--r--sapi/isapi/php4isapi.def5
-rw-r--r--sapi/isapi/php4isapi.dsp165
-rw-r--r--sapi/isapi/stresstest/notes.txt56
-rw-r--r--sapi/isapi/stresstest/stresstest.cpp853
-rw-r--r--sapi/isapi/stresstest/stresstest.dsp99
-rw-r--r--sapi/nsapi/CREDITS2
-rw-r--r--sapi/nsapi/Makefile.in5
-rw-r--r--sapi/nsapi/config.m437
-rw-r--r--sapi/nsapi/nsapi-readme.txt65
-rw-r--r--sapi/nsapi/nsapi.c549
-rw-r--r--sapi/nsapi/php4nsapi.dsp135
-rw-r--r--sapi/phttpd/CREDITS2
-rw-r--r--sapi/phttpd/Makefile.in5
-rw-r--r--sapi/phttpd/README5
-rw-r--r--sapi/phttpd/config.m424
-rw-r--r--sapi/phttpd/php.sym4
-rw-r--r--sapi/phttpd/php_phttpd.h24
-rw-r--r--sapi/phttpd/phttpd.c322
-rw-r--r--sapi/pi3web/CREDITS2
-rw-r--r--sapi/pi3web/Makefile.in5
-rw-r--r--sapi/pi3web/README50
-rw-r--r--sapi/pi3web/config.m424
-rw-r--r--sapi/pi3web/php.sym0
-rw-r--r--sapi/pi3web/php4pi3web.dsp136
-rw-r--r--sapi/pi3web/pi3web_sapi.c451
-rw-r--r--sapi/pi3web/pi3web_sapi.h95
-rw-r--r--sapi/roxen/Makefile.in5
-rw-r--r--sapi/roxen/README18
-rw-r--r--sapi/roxen/TODO33
-rw-r--r--sapi/roxen/config.m458
-rw-r--r--sapi/roxen/roxen.c739
-rw-r--r--sapi/servlet/CREDITS2
-rw-r--r--sapi/servlet/Makefile.in30
-rw-r--r--sapi/servlet/README42
-rw-r--r--sapi/servlet/config.m448
-rw-r--r--sapi/servlet/cookies.php41
-rw-r--r--sapi/servlet/date.php28
-rw-r--r--sapi/servlet/formatter.java36
-rw-r--r--sapi/servlet/jinfo.php5
-rw-r--r--sapi/servlet/jver.php17
-rw-r--r--sapi/servlet/reqheaders.php24
-rw-r--r--sapi/servlet/reqinfo.php29
-rw-r--r--sapi/servlet/reqparams.php35
-rw-r--r--sapi/servlet/servlet.c423
-rw-r--r--sapi/servlet/servlet.dsp290
-rw-r--r--sapi/servlet/servlet.java188
-rw-r--r--sapi/servlet/sessions.php60
-rw-r--r--sapi/servlet/web.xml41
-rw-r--r--sapi/thttpd/CREDITS2
-rw-r--r--sapi/thttpd/Makefile.in5
-rw-r--r--sapi/thttpd/README59
-rw-r--r--sapi/thttpd/config.m423
-rw-r--r--sapi/thttpd/php.sym3
-rw-r--r--sapi/thttpd/php_thttpd.h35
-rw-r--r--sapi/thttpd/stub.c0
-rw-r--r--sapi/thttpd/thttpd.c366
-rw-r--r--sapi/thttpd/thttpd_patch137
-rw-r--r--sapi/tux/CREDITS2
-rw-r--r--sapi/tux/Makefile.in5
-rw-r--r--sapi/tux/README86
-rw-r--r--sapi/tux/config.m415
-rw-r--r--sapi/tux/php.sym2
-rw-r--r--sapi/tux/php_tux.c440
-rwxr-xr-xscripts/apache/apconf-conv.sh24
-rwxr-xr-xscripts/apache/aphtaccess-conv.sh24
-rw-r--r--scripts/apache/conffix.awk23
-rw-r--r--scripts/apache/htaccessfix.awk23
-rwxr-xr-xscripts/config-stubs8
-rwxr-xr-xscripts/conv_proto30
-rwxr-xr-xscripts/conv_z_macros44
-rwxr-xr-xscripts/credits24
-rwxr-xr-xsnapshot7
-rw-r--r--stamp-h.in1
-rw-r--r--strtok_r.c113
-rw-r--r--stub.c1
-rwxr-xr-xtests/README60
-rw-r--r--tests/basic/001.phpt8
-rw-r--r--tests/basic/002.phpt10
-rw-r--r--tests/basic/003.phpt12
-rw-r--r--tests/basic/004.phpt11
-rw-r--r--tests/basic/005.phpt11
-rw-r--r--tests/basic/006.phpt8
-rw-r--r--tests/basic/007.phpt8
-rw-r--r--tests/basic/008.phpt8
-rw-r--r--tests/basic/009.phpt8
-rw-r--r--tests/basic/010.phpt8
-rw-r--r--tests/basic/011.phpt17
-rw-r--r--tests/classes/class_example.phpt87
-rw-r--r--tests/classes/inheritance.phpt58
-rw-r--r--tests/dirname.phpt30
-rw-r--r--tests/foo5
-rw-r--r--tests/foo23
-rw-r--r--tests/foo343
-rw-r--r--tests/foo441
-rw-r--r--tests/func/001.phpt8
-rw-r--r--tests/func/002.phpt22
-rw-r--r--tests/func/003.phpt289
-rw-r--r--tests/func/004.phpt65
-rw-r--r--tests/func/005.phpt22
-rw-r--r--tests/lang/001.phpt8
-rw-r--r--tests/lang/002.phpt12
-rw-r--r--tests/lang/003.phpt19
-rw-r--r--tests/lang/004.phpt13
-rw-r--r--tests/lang/005.phpt15
-rw-r--r--tests/lang/006.phpt21
-rw-r--r--tests/lang/007.phpt25
-rw-r--r--tests/lang/008.phpt16
-rw-r--r--tests/lang/009.phpt11
-rw-r--r--tests/lang/010.phpt13
-rw-r--r--tests/lang/011.phpt25
-rw-r--r--tests/lang/012.phpt20
-rw-r--r--tests/lang/013.phpt12
-rw-r--r--tests/lang/014.phpt15
-rwxr-xr-xtests/lang/015.inc3
-rw-r--r--tests/lang/015.phpt10
-rwxr-xr-xtests/lang/016.inc5
-rw-r--r--tests/lang/016.phpt11
-rw-r--r--tests/lang/017.phpt18
-rw-r--r--tests/lang/018.phpt36
-rw-r--r--tests/lang/019.phpt38
-rw-r--r--tests/lang/020.phpt78
-rw-r--r--tests/lang/021.phpt44
-rw-r--r--tests/lang/022.phpt65
-rwxr-xr-xtests/lang/023-1.inc356
-rwxr-xr-xtests/lang/023-2.inc6
-rw-r--r--tests/lang/023.phpt256
-rw-r--r--tests/lang/024.phpt11625
-rw-r--r--tests/lang/025.phpt540
-rw-r--r--tests/lang/026.phpt8
-rw-r--r--tests/lang/027.phpt14
-rw-r--r--tests/lang/028.phpt1060
-rw-r--r--tests/lang/029.phpt30
-rw-r--r--tests/lang/030.phpt33
-rw-r--r--tests/odbc-display.php19
-rw-r--r--tests/odbc-t1.php38
-rw-r--r--tests/odbc-t2.php82
-rw-r--r--tests/odbc-t3.php95
-rw-r--r--tests/odbc-t4.php91
-rw-r--r--tests/odbc-t5.php137
-rw-r--r--tests/recurse21
-rw-r--r--tests/run.html11
-rw-r--r--tests/run.php17
-rw-r--r--tests/scan_cases28
-rw-r--r--tests/strings/001.phpt209
-rw-r--r--tests/strings/002.phpt74
-rw-r--r--tests/strings/003.phpt13
-rw-r--r--tests/test.php415
-rw-r--r--tests/test.pl34
-rw-r--r--tests/test_class_inheritance29
-rw-r--r--tests/testarray21
-rw-r--r--tests/testarray.pl5
-rw-r--r--tests/testarray25
-rw-r--r--tests/testarray2.pl3
-rw-r--r--tests/testclassfunc9
-rw-r--r--tests/testcom11
-rw-r--r--tests/testcpdf97
-rw-r--r--tests/testcpdfclock87
-rw-r--r--tests/testdom73
-rw-r--r--tests/testfe18
-rw-r--r--tests/testfunc33
-rw-r--r--tests/testfunc.pl20
-rw-r--r--tests/testfunc219
-rw-r--r--tests/testfunc2.pl22
-rw-r--r--tests/testfuncref10
-rw-r--r--tests/testhyperwave235
-rw-r--r--tests/testinclude5
-rw-r--r--tests/testobj29
-rw-r--r--tests/testpfpro.php39
-rw-r--r--tests/testscanf.php113
-rw-r--r--tests/testswf120
-rw-r--r--win32/README.txt115
-rw-r--r--win32/Win32_Package.txt19
-rw-r--r--win32/flock.c83
-rw-r--r--win32/flock.h11
-rw-r--r--win32/grp.h31
-rw-r--r--win32/install.txt148
-rw-r--r--win32/param.h16
-rw-r--r--win32/php4.dsp134
-rw-r--r--win32/php4.dsw89
-rw-r--r--win32/php4dll.dsp1683
-rw-r--r--win32/php4dllts.dsp2005
-rw-r--r--win32/php4ts.dsp167
-rw-r--r--win32/php4ts.dsw194
-rw-r--r--win32/php5ts.dsw194
-rw-r--r--win32/php_modules.dsw569
-rw-r--r--win32/php_registry.h7
-rw-r--r--win32/pwd.c74
-rw-r--r--win32/pwd.h57
-rw-r--r--win32/pws-php4cgi.reg6
-rw-r--r--win32/pws-php4isapi.reg5
-rw-r--r--win32/readdir.c140
-rw-r--r--win32/readdir.h44
-rw-r--r--win32/registry.c89
-rw-r--r--win32/sendmail.c545
-rw-r--r--win32/sendmail.h46
-rw-r--r--win32/signal.h16
-rw-r--r--win32/syslog.h73
-rw-r--r--win32/testsuite.dsp150
-rw-r--r--win32/time.c242
-rw-r--r--win32/time.h43
-rw-r--r--win32/unistd.h1
-rw-r--r--win32/wfile.c17
-rw-r--r--win32/wfile.h16
-rw-r--r--win32/winutil.c21
-rw-r--r--win32/winutil.h1
-rw-r--r--win32/wsyslog.c122
1636 files changed, 0 insertions, 397758 deletions
diff --git a/CODING_STANDARDS b/CODING_STANDARDS
deleted file mode 100644
index 2f5b70a6b4..0000000000
--- a/CODING_STANDARDS
+++ /dev/null
@@ -1,218 +0,0 @@
-PHP Coding Standards
-====================
-
-
-This file lists several standards that any programmer, adding or changing
-code in PHP, should follow. Since this file was added at a very late
-stage of the development of PHP v3.0, the code base does not (yet) fully
-follow it, but it's going in that general direction. Since we are now
-well into the version 4 releases, many sections have been recoded to use
-these rules.
-
-
-Code Implementation
--------------------
-
-[1] Functions that are given pointers to resources should not free them
-
-For instance, function int mail(char *to, char *from) should NOT free
-to and/or from.
-Exceptions:
-
- - The function's designated behavior is freeing that resource. E.g. efree()
- - The function is given a boolean argument, that controls whether or not
- the function may free its arguments (if true - the function must free its
- arguments, if false - it must not)
- - Low-level parser routines, that are tightly integrated with the token
- cache and the bison code for minimum memory copying overhead.
-
-[2] Functions that are tightly integrated with other functions within the
- same module, and rely on each other non-trivial behavior, should be
- documented as such and declared 'static'. They should be avoided if
- possible.
-
-[3] Use definitions and macros whenever possible, so that constants have
- meaningful names and can be easily manipulated. The only exceptions
- to this rule are 0 and 1, when used as false and true (respectively).
- Any other use of a numeric constant to specify different behavior
- or actions should be done through a #define.
-
-[4] When writing functions that deal with strings, be sure to remember
- that PHP holds the length property of each string, and that it
- shouldn't be calculated with strlen(). Write your functions in a such
- a way so that they'll take advantage of the length property, both
- for efficiency and in order for them to be binary-safe.
- Functions that change strings and obtain their new lengths while
- doing so, should return that new length, so it doesn't have to be
- recalculated with strlen() (e.g. php_addslashes())
-
-[5] Use php_error() to report any errors/warnings during code execution.
- Use descriptive error messages, and try to avoid using identical
- error strings for different stages of an error. For example,
- if in order to obtain a URL you have to parse the URL, connect,
- and retreive the text, assuming something can go wrong at each
- of these stages, don't report an error "Unable to get URL"
- on all of them, but instead, write something like "Unable
- to parse URL", "Unable to connect to URL server" and "Unable
- to fetch URL text", respectively.
-
-[6] NEVER USE strncat(). If you're absolutely sure you know what you're doing,
- check its man page again, and only then, consider using it, and even then,
- try avoiding it.
-
-
-Naming Conventions
-------------------
-
-[1] Function names for user-level functions should be enclosed with in
- the PHP_FUNCTION() macro. They should be in lowercase, with words
- underscore delimited, with care taken to minimize the letter count.
- Abbreviations should not be used when they greatly decrease the
- readability of the function name itself.
-
- Good:
- 'mcrypt_enc_self_test'
- 'mysql_list_fields'
-
- Ok:
- 'mcrypt_module_get_algo_supported_key_sizes'
- (could be 'mcrypt_mod_get_algo_sup_key_sizes'?)
- 'get_html_translation_table'
- (could be 'html_get_trans_table'?)
-
- Bad:
- 'hw_GetObjectByQueryCollObj'
- 'pg_setclientencoding'
- 'jf_n_s_i'
-
-
-[2] If they are part of a "parent set" of functions, that parent should
- be included in the user function name, and should be clearly related
- to the parent program or function family. This should be in the form
- of parent_*.
-
- A family of 'foo' functions, for example:
- Good:
- 'foo_select_bar'
- 'foo_insert_baz'
- 'foo_delete_baz'
-
- Bad:
- 'fooselect_bar'
- 'fooinsertbaz'
- 'delete_foo_baz'
-
-[3] Function names used by user functions should be prefixed
- with "_php_", and followed by a word or an underscore-delimited list of
- words, in lowercase letters, that describes the function. If applicable,
- they should be declared 'static'.
-
-[4] Variable names must be meaningful. One letter variable names must be
- avoided, except for places where the variable has no real meaning or
- a trivial meaning (e.g. for (i=0; i<100; i++) ...).
-
-[5] Variable names should be in lowercase; Use underscores to seperate
- between words.
-
-
-Syntax and indentation
-----------------------
-
-[1] Never use C++ style comments (i.e. // comment). Always use C-style
- comments instead. PHP is written in C, and is aimed at compiling
- under any ANSI-C compliant compiler. Even though many compilers
- accept C++-style comments in C code, you have to ensure that your
- code would compile with other compilers as well.
- The only exception to this rule is code that is Win32-specific,
- because the Win32 port is MS-Visual C++ specific, and this compiler
- is known to accept C++-style comments in C code.
-
-[2] Use K&R-style. Of course, we can't and don't want to
- force anybody to use a style he or she is not used to, but,
- at the very least, when you write code that goes into the core
- of PHP or one of its standard modules, please maintain the K&R
- style. This applies to just about everything, starting with
- indentation and comment styles and up to function decleration
- syntax.
-
-[3] Be generous with whitespace and braces. Always prefer:
-
- if (foo) {
- bar;
- }
-
- to:
-
- if(foo)bar;
-
- Keep one empty line between the variable decleration section and
- the statements in a block, as well as between logical statement
- groups in a block. Maintain at least one empty line between
- two functions, preferably two.
-
-[4] When indenting, use the tab character. A tab is expected to represent
- four spaces. It is important to maintain consistency in indenture so
- that definitions, comments, and control structures line up correctly.
-
-Documentation and Folding Hooks
--------------------------------
-
-In order to make sure that the online documentation stays in line with
-the code, each user-level function should have its user-level function
-prototype before it along with a brief one-line description of what the
-function does. It would look like this:
-
-/* {{{ proto int abs(int number)
- Return the absolute value of the number */
-PHP_FUNCTION(abs)
-{
- ...
-}
-/* }}} */
-
-The {{{ symbols are the default folding symbols for the folding mode in
-Emacs and vim (set fdm=marker). Folding is very useful when dealing with
-large files because you can scroll through the file quickly and just unfold
-the function you wish to work on. The }}} at the end of each function marks
-the end of the fold, and should be on a separate line.
-
-The "proto" keyword there is just a helper for the doc/genfuncsummary script
-which generates a full function summary. Having this keyword in front of the
-function prototypes allows us to put folds elsewhere in the code without
-messing up the function summary.
-
-Optional arguments are written like this:
-
-/* {{{ proto object imap_header(int stream_id, int msg_no [, int from_length [, int subject_length [, string default_host]]])
- Returns a header object with the defined parameters. */
-
-And yes, please keep the prototype on a single line, even if that line
-is massive.
-
-New and Experimental Functions
------------------------------------
-To reduce the problems normally associated with the first public
-implementation of a new set of functions, it has been suggested
-that the first implementation include a file labeled 'EXPERIMENTAL'
-in the function directory, and that the functions follow the
-standard prefixing conventions during their initial implementation.
-
-The file labelled 'EXPERIMENTAL' should include the following
-information:
- Any authoring infomration (known bugs, future directions of the module).
- Ongoing status notes which may not be appropriate for CVS comments.
-
-Aliases & Legacy Documentation
------------------------------------
-You may also have some deprecated aliases with close to duplicate
-names, for example, somedb_select_result and somedb_selectresult. For
-documentation puposes, these will only be documented by the most
-current name, with the aliases listed in the documentation for
-the parent function. For ease of reference, user-functions with
-completely different names, that alias to the same function (such as
-highlight_file and show_source), will be separately documented. The
-proto should still be included, describing which function is aliased.
-
-Backwards compatible functions and names should be maintained as long
-as the code can be reasonably be kept as part of the codebase. See
-/phpdoc/README for me information on documentation.
diff --git a/CREDITS b/CREDITS
deleted file mode 100644
index 345084885c..0000000000
--- a/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-For the list of people who've put work into PHP 4.0, please see
-http://www.php.net/credits.php
diff --git a/ChangeLog b/ChangeLog
deleted file mode 100644
index 60dfdf5fd2..0000000000
--- a/ChangeLog
+++ /dev/null
@@ -1,10554 +0,0 @@
-2001-05-23 Sascha Schumann <sascha@schumann.cx>
-
- * ext/session/session.c:
- Due to dynamic registration of storage handlers, OnUpdateSaveHandler
- might be called before that registration takes place and hence the
- INI update is dismissed. In that case, we defer the lookup to the
- first request init.
-
-2001-05-23 Jani Taskinen <sniper@iki.fi>
-
- * ext/xslt/.cvsignore: missing.
-
-2001-05-23 Sascha Schumann <sascha@schumann.cx>
-
- * sapi/apache/config.m4
- sapi/apache2filter/config.m4: Use EXTRA_LDFLAGS at this point.
-
- I've confirmed that one can build a working Apache DSO module now
- (AIX 4.2 with gcc 2.95.2 and Apache 1.3.12).
-
-2001-05-23 Sterling Hughes <sterling@designmultimedia.com>
-
- * ext/com/COM.c: Fix credits
-
-2001-05-23 Sascha Schumann <sascha@schumann.cx>
-
- * build/buildcheck.sh:
- automake 1.4-p1 was released. Remove the -p\d+ suffix as this caused
- an error message on FreeBSD.
-
- * build/buildcheck.sh: $libtool already contains the full path to libtool.
-
-2001-05-23 Andi Gutmans <andi@zend.com>
-
- * ext/session/mod_mm.c: - Nuke GINIT
-
-2001-05-23 Jon Parise <jon@csh.rit.edu>
-
- * NEWS: Merge from HEAD.
-
- * NEWS: This was merged into the 4.0.6 branch.
-
-2001-05-23 Andi Gutmans <andi@zend.com>
-
- * ext/standard/basic_functions.c
- ext/standard/output.c
- ext/standard/php_output.h: - Fix problem of output initialization
-
-2001-05-23 Martin Kraemer <Martin.Kraemer@fujitsu-siemens.com>
-
- * sapi/apache/mod_php4.c:
- Fix Basic auth (when under PHP control) for EBCDIC platforms
-
-2001-05-23 Thomas V.V.Cox <cox@idecnet.com>
-
- * pear/scripts/pear.in: -Changed $param[0] to $param{0} less ambiguous
- -Readd "-?" param that shows the usage msg
-
-2001-05-23 Andrei Zmievski <andrei@ispi.net>
-
- * NEWS: MFH
-
- * NEWS: This was merged into 4.0.6.
-
-2001-05-23 Stig Bakken <ssb@fast.no>
-
- * pear/DB/storage.php:
- * added DB_storage::delete() (as suggested by Wolfram Kriesing)
- * fixed some raiseError calls
-
- * pear/PEAR.php:
- * added missing doc for PEAR::raiseError skipmsg parameter
-
-2001-05-23 Andi Gutmans <andi@zend.com>
-
- * ext/sybase_ct/php_sybase_ct.c: - MFH
-
- * ext/sybase_ct/php_sybase_ct.c: - Commit fix by Steve Meyers
-
-2001-05-23 Jani Taskinen <sniper@iki.fi>
-
- * main/fopen_wrappers.c: MFH (oops)
-
- * main/fopen_wrappers.c: oops..
-
-2001-05-23 Sterling Hughes <sterling@designmultimedia.com>
-
- * ext/standard/basic_functions.c:
- Added the CONNECTION_ABORTED, CONNECTION_TIMEOUT and CONNECTION_NORMAL
- constants.
-
-2001-05-23 John Donagher <john@webmeta.com>
-
- * ext/standard/array.c: Add missing end-folding delimiter
-
-2001-05-23 Jani Taskinen <sniper@iki.fi>
-
- * main/fopen_wrappers.c: MFH
-
- * main/fopen_wrappers.c: fixed bug: #10960
-
-2001-05-22 Andy Sautins <asautins@veripost.net>
-
- * ext/oci8/oci8.c:
-
- - Add correct OCIObjectFree to free collections immediately ( OCI_FREECOLLECTION_FORCE )
- - Added schema optional parameter to OCINewCollection to allow accessing types in
- other schemas.
- - Added OCI_TYPECODE_TABLE to OCINewCollection to allow creation of collection of TYPES
- as well as VARRAYS
-
-2001-05-22 Shane Caraveo <shane@php.net>
-
- * sapi/cgi/cgi_main.c:
- The -c commandline option was not working at all, need to set the path
- override before calling on the module startup.
-
-2001-05-22 Jani Taskinen <sniper@iki.fi>
-
- * ext/ccvs/Makefile.in
- ext/ccvs/ccvs.c
- ext/ccvs/config.m4: Fixed bug: #10914
-
-2001-05-22 Andrei Zmievski <andrei@ispi.net>
-
- * NEWS: Fixes.
-
-2001-05-22 Andi Gutmans <andi@zend.com>
-
- * ext/standard/basic_functions.c
- ext/standard/basic_functions.h
- ext/standard/output.c
- ext/standard/php_output.h: - Start nuking not needed GINIT
-
-2001-05-22 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * php.ini-dist: Fixed bug #10892.
-
-2001-05-22 Andrei Zmievski <andrei@ispi.net>
-
- * ext/session/session.c: MFH
-
-2001-05-22 Frank M. Kromann <frank@frontbase.com>
-
- * ext/iisfunc/setup.c: Fixing prototypes to match function names
- TODO Rename functions to follow coding standards.
-
- * ext/odbc/php_odbc.c
- ext/fbsql/php_fbsql.c: Fixing prototypes to match function names
-
-2001-05-22 Andrei Zmievski <andrei@ispi.net>
-
- * ext/session/session.c:
- - Made $HTTP_SESSION_VARS['foo'] and $foo be references to the same value
- when register_globals is on.
-
-2001-05-22 Frank M. Kromann <frank@frontbase.com>
-
- * ext/fbsql/php_fbsql.c:
- Changing how persistant links are added to zend_lists
-
-2001-05-22 Thomas V.V.Cox <cox@idecnet.com>
-
- * pear/scripts/pear.in:
- remove "?" from Console_Getopt. Sorry Andrei it was there and
- I left there :)
-
- * pear/PEAR/Installer.php:
- - added error cheking and abort when no script install dir is set
- - minor typos
-
- * pear/scripts/pear.in: - Added the following params support:
- * -p set script install dir
- * -e set extension install dir
- * -d set documentation dest dir
- * -v set verbose level
- - Some error reporting clean up
- - Added the standar PHP copyright header and authors
-
-2001-05-22 Sascha Schumann <sascha@schumann.cx>
-
- * ext/ircg/ircg.c: MFH
-
- * ext/ircg/ircg.c: Fix HEX_VALUE
-
- Submitted by: Axel Sander
-
-2001-05-22 Jon Parise <jon@csh.rit.edu>
-
- * configure.in
- ext/standard/filestat.c:
- FreeBSD defines statfs(2) in <sys/mount.h>. Teach PHP to look for it there.
-
- * ext/standard/filestat.c
- configure.in:
- FreeBSD defines statfs(2) in <sys/mount.h>. Teach PHP to look for it there.
-
-2001-05-22 Jani Taskinen <sniper@iki.fi>
-
- * ext/imap/config.m4: this fixes a few apache can not start bugs.
-
- * ext/imap/config.m4: This fixes a few apache can not start bugs.
-
-2001-05-21 Derick Rethans <d.rethans@jdimedia.nl>
-
- * ext/pdf/pdf.c: - Nuke warning
-
- * ext/pdf/pdf.c: - No need to include "zend" in include line
-
-2001-05-21 James Moore <James@phpuk.org>
-
- * ext/cpdf/cpdf.c
- ext/pdf/pdf.c: Fix for #8539
-
-2001-05-21 Sterling Hughes <sterling@designmultimedia.com>
-
- * ext/curl/config.m4: MFH
-
-2001-05-21 Jani Taskinen <sniper@iki.fi>
-
- * ext/ldap/config.m4: MFH
-
- * ext/ldap/config.m4: Fixed bug: #10777
-
-2001-05-21 Sterling Hughes <sterling@designmultimedia.com>
-
- * ext/sockets/php_sockets.h: Fix compile warning.
-
-2001-05-21 Jani Taskinen <sniper@iki.fi>
-
- * ext/gd/config.m4
- ext/gd/gd.c: MFH
-
- * ext/gd/config.m4
- ext/gd/gd.c: fixed bug: #10593
-
-2001-05-21 James Moore <James@phpuk.org>
-
- * ext/gd/gd.c: Remove unused variable from imagesetstyle
-
-2001-05-21 Sterling Hughes <sterling@designmultimedia.com>
-
- * ext/sockets/sockets.c:
- one of these days I'll get this commit correct, just you watch!
-
-
- * ext/sockets/sockets.c: typo
-
-2001-05-21 Andi Gutmans <andi@zend.com>
-
- * main/php_logos.c
- main/php_logos.h:
- - MFH so that no one starts using the wrongly called function name,
-
- * main/php_logos.c
- main/php_logos.h: - Fix name of function.
-
-2001-05-21 Sterling Hughes <sterling@designmultimedia.com>
-
- * ext/sockets/sockets.c: Fix socket_read to work under Linux again.
-
- * ext/sockets/sockets.c:
- WS fix (php_read) and correct checking of the return value from inet_aton,
- which returns *non-zero* on success (fix by Till Gerken).
-
- * ext/sockets/sockets.c:
- Fixed bug where socket_connect() return the wrong value (report and fix by
- Till Gerken)
-
-2001-05-21 Jani Taskinen <sniper@iki.fi>
-
- * ext/iconv/config.m4: MFH
-
- * ext/iconv/config.m4: Fixed bug: #10742
-
-2001-05-21 Andrei Zmievski <andrei@ispi.net>
-
- * ext/standard/basic_functions.c
- ext/standard/basic_functions.h: Moving some functions into Zend.
-
-2001-05-21 Andi Gutmans <andi@zend.com>
-
- * ext/standard/basic_functions.c:
- - EG's are passed automatically to internal functions.
-
-2001-05-21 Sean Bright <elixer@erols.com>
-
- * ext/standard/basic_functions.c
- ext/standard/basic_functions.h:
- Added get_defined_constants() function. Returns an associative array of
- constants mapped to their values.
-
-2001-05-21 Sascha Schumann <sascha@schumann.cx>
-
- * ext/xml/Makefile.in: Remove extraneous tab
-
-2001-05-20 Sascha Schumann <sascha@schumann.cx>
-
- * acinclude.m4
- ext/session/config.m4
- main/php.h:
- Add support for systems where p{read|write} take a off64_t without
- being properly prototyped.
-
-2001-05-20 Jani Taskinen <sniper@iki.fi>
-
- * ext/domxml/config.m4
- ext/gd/config.m4
- ext/pdf/config.m4
- ext/zlib/zlib.m4: MFH
-
- * ext/gd/config.m4
- ext/pdf/config.m4
- ext/domxml/config.m4
- ext/zlib/config0.m4:
- A few modifications to make the ZLIB checks work better.
-
-2001-05-20 Sascha Schumann <sascha@schumann.cx>
-
- * ext/xml/expat/Makefile.in
- ext/xml/Makefile.in:
- Whoops, the expat directory needs the XML_BYTE_ORDER macro
-
- * ext/xml/Makefile.in
- ext/xml/config.m4: Don't add -DXML_BYTE_ORDER to global CPPFLAGS
-
- * NEWS: looks promising
-
- * build/fastgen.sh: Fix path to alternate mkdir
-
- * acinclude.m4: Fix irix-time_r test
-
- * acinclude.m4: remove fi
-
- * acinclude.m4
- main/php_reentrancy.h
- main/reentrancy.c: Support for IRIX-style asctime_r/ctime_r.
-
- * acinclude.m4: Catch 'mkdir -p' brokeness on IRIX
-
-2001-05-20 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * pear/Cache/URL.php: Oops.
-
-2001-05-20 Rasmus Lerdorf <rasmus@php.net>
-
- * ext/standard/file.c:
- MFH of patch that fixes copy() ignoring safe_mode open_basedir setting.
-
-2001-05-20 Wez Furlong <wez.php@thebrainroom.com>
-
- * ext/mailparse/mailparse.c:
- fixed a bug in mailparse_stream_encode which would default to a random encoding (usually base64)
-
-2001-05-20 Sascha Schumann <sascha@schumann.cx>
-
- * NEWS: refining
-
-2001-05-20 Wez Furlong <wez.php@thebrainroom.com>
-
- * ext/mailparse/tests/001.phpt
- ext/mailparse/tests/002.phpt
- ext/mailparse/rfc822_getaddrs.c
- ext/mailparse/try.php
- ext/mailparse/mailparse_rfc822.h
- ext/mailparse/php_mailparse.h
- ext/mailparse/rfc2045.c
- ext/mailparse/rfc2045.h
- ext/mailparse/rfc2045acchk.c
- ext/mailparse/rfc2045acprep.c
- ext/mailparse/rfc2045appendurl.c
- ext/mailparse/rfc2045cdecode.c
- ext/mailparse/rfc2045decode.c
- ext/mailparse/rfc2045find.c
- ext/mailparse/rfc822.c
- ext/mailparse/rfc822_getaddr.c
- ext/mailparse/CREDITS
- ext/mailparse/EXPERIMENTAL
- ext/mailparse/Makefile.in
- ext/mailparse/README
- ext/mailparse/config.m4
- ext/mailparse/libs.mk
- ext/mailparse/mailparse.c: Imported mailparse extension
-
-2001-05-20 Stig Bakken <ssb@fast.no>
-
- * pear/pear.m4: MFH
-
- * pear/pear.m4:
- Define HAVE_CONFIG_H when building standalone DSO extensions
-
-2001-05-20 Jani Taskinen <sniper@iki.fi>
-
- * ext/standard/info.c: MFH
-
- * ext/standard/info.c: This looks better.
-
-2001-05-20 Andrei Zmievski <andrei@ispi.net>
-
- * ext/pcre/php_pcre.c: Properly free callback_name only when necessary.
-
-2001-05-20 Derick Rethans <d.rethans@jdimedia.nl>
-
- * ext/standard/basic_functions.c
- ext/standard/formatted_print.c:
- - Fix for bug #9698/#10681 (patch by kettler@gmx.net)
- - Added the 'u' modifier to printf/sprintf which prints unsigned longs.
-
-
- * ext/standard/basic_functions.c
- ext/standard/formatted_print.c: - Reversed 'fix' for #9698
- - Fix for bug #9698/#10681 (patch by kettler@gmx.net)
- - Added the 'u' modifier to printf/sprintf which prints unsigned longs.
-
-
-2001-05-19 Rasmus Lerdorf <rasmus@php.net>
-
- * ext/standard/file.c: Fix bug #9526
-
-2001-05-19 Jani Taskinen <sniper@iki.fi>
-
- * configure.in
- ext/standard/basic_functions.c: MFH
-
- * configure.in
- ext/standard/basic_functions.c: Fixed bug #10964
-
-2001-05-19 Sascha Schumann <sascha@schumann.cx>
-
- * acinclude.m4:
- Store some build-specific environment variables in config.nice.
-
-2001-05-19 Sterling Hughes <sterling@designmultimedia.com>
-
- * ext/gd/gd.c: nuke last remnants of the old globals stuff
-
-
-2001-05-19 James Moore <James@phpuk.org>
-
- * NEWS: MFH
-
- * NEWS: Correct NEWS entry
-
-2001-05-19 Sascha Schumann <sascha@schumann.cx>
-
- * sapi/apache/config.m4:
- s/^I/ / and some re-indenting. Also align the APXS checking code
- with the standard scheme.
-
- * sapi/apache2filter/config.m4:
- Reindent, add link map for AIX, improve diagnostic message,
- carry over all -D* CPPFLAGS, and nuke REGEX recognition.
-
-2001-05-19 Andi Gutmans <andi@zend.com>
-
- * ext/bz2/bz2.c: - MFH
-
- * ext/bz2/bz2.c: - Remove \n from php_error()
-
- * ext/bz2/bz2.c:
- - Fix crash bug in bzopen() when specifying invalid filename
- Fixed crash bug in bzopen() when specifying an invalid file.
-
-2001-05-19 Andrei Zmievski <andrei@ispi.net>
-
- * NEWS: Format.
-
-2001-05-19 Sascha Schumann <sascha@schumann.cx>
-
- * ext/session/php_session.h: Use zend_hash_add_empty_element
-
- * sapi/cgi/config.m4
- sapi/cgi/cgi_main.c:
- Use write(2), if we can successfully write to stdout.
-
-2001-05-19 Derick Rethans <d.rethans@jdimedia.nl>
-
- * NEWS: - MFH
-
- * NEWS: - Adding an entry about mcrypt bugs
-
-2001-05-19 Sascha Schumann <sascha@schumann.cx>
-
- * ext/xml/expat/xmlparse.c: Looks like this was a bogus gcc warning.
-
- Submitted by: Sebastian Bergmann
-
- * ext/session/session.c:
- Improve reading from external data source for session id creation.
-
- Improve generating the string representation of the md5 session id.
-
- * ext/xml/expat/xmlparse.c
- ext/xml/expat/xmlrole.c
- ext/xml/expat/xmltok.c: Nuke some warnings.
-
- * NEWS: merge
-
- * NEWS: add entry
-
- * ext/standard/basic_functions.c
- ext/standard/basic_functions.h
- ext/standard/file.c: MFH
-
- munmap() file in RSHUTDOWN, if PHPWRITE fails.
-
- Files should be shared among processes.
-
-2001-05-18 Sascha Schumann <sascha@schumann.cx>
-
- * ext/standard/basic_functions.c
- ext/standard/basic_functions.h
- ext/standard/file.c: munmap() file in RSHUTDOWN, if PHPWRITE fails.
-
-2001-05-18 Derick Rethans <d.rethans@jdimedia.nl>
-
- * ext/mcrypt/mcrypt.c: - Fix for bug #10890 (MFH)
- - Fixed bugs in the mcrypt extension that caused crashes
-
- * ext/mcrypt/mcrypt.c: - Fix for bug #10890
- - Fixed bugs in the mcrypt extension that caused crashes
-
-2001-05-18 Sascha Schumann <sascha@schumann.cx>
-
- * sapi/apache/config.m4:
- First try at using Apache's export list when building a DSO.
-
-2001-05-18 Sterling Hughes <sterling@designmultimedia.com>
-
- * ext/gd/gd.c:
- Added the IMG_ARC_ROUNDED option for the ImageFilledArc() function, which
- specified that the drawn curve should be rounded.
-
- * ext/gd/gd.c: remove more php3 ts stuff
-
- * ext/gd/gd_ctx.c: should be using the function here.
-
- * ext/gd/gd.c
- ext/gd/gd_ctx.c
- ext/gd/php_gd.h: Remove the remnants of old global macro's
-
-2001-05-18 Sascha Schumann <sascha@schumann.cx>
-
- * ext/standard/file.c: Files should be shared among processes.
-
-2001-05-18 Hartmut Holzgraefe <hartmut@six.de>
-
- * ext/ctype/ctype.c: a small proto clarification
-
-2001-05-18 Andrei Zmievski <andrei@ispi.net>
-
- * ext/pcre/pcrelib/Makefile.in
- ext/pcre/config.m4:
- Move -DSUPPORT_UTF8 flag into the appropriate Makefile so as not to pollute
- the global namespace.
-
-2001-05-18 Thies C. Arntzen <thies@thieso.net>
-
- * build/rules_common.mk
- sapi/cgi/cgi_main.c: revert parts of last commit - stupid me!
-
- * NEWS
- build/rules_common.mk
- sapi/cgi/cgi_main.c:
- --enable-memory-usage-info id deprecated. use --enable-memory-limit instead!
-
-2001-05-18 Uwe Steinmann <Uwe.Steinmann@fernuni-hagen.de>
-
- * ext/hyperwave/hw.c:
- - completed list of error messages (thanks to Torben Wilson)
-
-2001-05-17 James Moore <James@phpuk.org>
-
- * sapi/cgi/getopt.c:
- Merge the more sensible way of doing this back in to HEAD
-
- * sapi/cgi/getopt.c:
- * sapi/cgi/getopt.c: MFH
-
-2001-05-17 Derick Rethans <d.rethans@jdimedia.nl>
-
- * ext/mcrypt/mcrypt.c: MFH (bug 8901)
-
-2001-05-17 James Moore <James@phpuk.org>
-
- * sapi/cgi/getopt.c:
- - Fixed getopt so it accepts arguments in the form -<option><value> not
- just -<option> <value> (jmoore)
-
-2001-05-17 Derick Rethans <d.rethans@jdimedia.nl>
-
- * ext/mcrypt/mcrypt.c: - Fix for bug #9801 (and maybe others)
-
-2001-05-17 Sterling Hughes <sterling@designmultimedia.com>
-
- * ext/xslt/sablot.c:
- Some fixes. Actually assign a value scheme_handlers before processing it.
- Add some checks for key type. Remove some debugging data.
-
-2001-05-17 Daniel Beulshausen <daniel@php4win.de>
-
- * NEWS: update news
-
- * ext/curl/curl.c
- ext/curl/php_curl.h:
- winsock is already initialized in an higher version by php
-
- * win32/php_modules.dsw: add notes & sockets ext
-
- * ext/sockets/CREDITS
- ext/sockets/php_sockets.h
- ext/sockets/php_sockets_win.c
- ext/sockets/php_sockets_win.h
- ext/sockets/sockets.c
- ext/sockets/sockets.dsp: update sockets to work with winsock as well
-
-2001-05-17 Martin Kraemer <Martin.Kraemer@fujitsu-siemens.com>
-
- * ext/dba/config.m4:
- Allow for DB3 to reside in /usr/local/include/db3/ and -ldb3
-
-2001-05-17 Zeev Suraski <zeev@zend.com>
-
- * sapi/apache/php_apache.c: Add missing info
-
-2001-05-17 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * main/win95nt.h: MS VisualStudio .NET 7.0 has M_PI_4 in math.h
-
-2001-05-17 Stig Bakken <ssb@fast.no>
-
- * pear/DB/storage.php (PEAR DB_storage::_makeWhere): fixed multiple key column bug, thanks
- to Wolfram Kriesing
-
-2001-05-17 Vlad Krupin <phpdevel@echospace.com>
-
- * ext/pspell/config.m4:
- ...and this fixes the typo I made long ago. It prevented people that have
- certain weird installations of pspell from compiling properly (couldn't
- find pspell header files). No-one noticed...
-
- * ext/pspell/config.m4: Fix for bug 10912.
- Also, if you explicily specify path in --with-pspell, the directories
- /usr, /usr/local will no longer be searched even if the library is not
- found at the specified location (this seems to make more sense)
-
-2001-05-16 Sterling Hughes <sterling@designmultimedia.com>
-
- * ext/curl/config.m4
- ext/curl/curl.c
- ext/curl/php_curl.h:
- Add a compile check for the cURL version and fix the compile in general.
-
-2001-05-16 James Moore <James@phpuk.org>
-
- * ext/gd/php_gd.h: - Sync prototype and definition of phpi_get_le_gd
-
-2001-05-16 Sterling Hughes <sterling@designmultimedia.com>
-
- * sapi/apache/mod_php4.c:
-
- * sapi/apache/mod_php4.c: MFH
-
- * sapi/apache/mod_php4.c: Remove redundancy
-
-
- * sapi/apache/mod_php4.c: fix windows build.
-
-
-2001-05-16 Jon Parise <jon@csh.rit.edu>
-
- * pear/Log/file.php:
- Close the logfile after each write to prevent blocking due to concurrency.
-
-2001-05-16 James Moore <James@phpuk.org>
-
- * win32/php_modules.dsw: - Add dbx extension to php_modules workspace
-
-2001-05-16 Zeev Suraski <zeev@zend.com>
-
- * sapi/apache/mod_php4.c: Merge memory usage into memory limit
-
-2001-05-16 Sascha Schumann <sascha@schumann.cx>
-
- * ext/gd/Makefile.in: MFH r1.9
-
- * ext/gd/Makefile.in: Fix for #10900.
-
- Submitted by: cech@debian.org
-
-2001-05-16 Daniel Beulshausen <daniel@php4win.de>
-
- * sapi/apache/mod_php4.c: MFH
-
- * sapi/apache/mod_php4.c: add missing apls_fetch
-
-2001-05-16 Jani Taskinen <sniper@iki.fi>
-
- * ext/standard/image.c: MFH
-
- * ext/standard/image.c: Fixed bugs: #10297, #10615, #10783, #10880
-
-2001-05-15 Jon Parise <jon@csh.rit.edu>
-
- * ext/standard/basic_functions.c
- ext/standard/filestat.c
- ext/standard/php_filestat.h:
- - Added disk_total_space() to return the total size of a filesystem.
- (Patch from Steven Bower)
-
- * ext/standard/basic_functions.c
- ext/standard/filestat.c
- ext/standard/php_filestat.h:
- - Renamed diskfreespace() to disk_free_space() to conform to established
- naming conventions. (jon)
-
-2001-05-15 Andrei Zmievski <andrei@ispi.net>
-
- * ext/pcre/php_pcre.c:
- Revert previous commit - callback_name does need to be checked because
- it is set conditional on is_callable_replace.
-
-2001-05-15 Andi Gutmans <andi@zend.com>
-
- * configure.in
- main/php_version.h: - Get ready for 4.0.6RC1
-
-2001-05-15 Daniel Beulshausen <daniel@php4win.de>
-
- * sapi/apache/php_apache.c: MFH
-
-2001-05-15 Jon Parise <jon@csh.rit.edu>
-
- * pear/Cache.php
- pear/Cache/Output.php
- pear/Cache/OutputCompression.php: (Merge from head branch)
- - Renaming $no_cache to $caching and inverting it's meaning
- - Adding accessors for private $caching flag: getCaching() and setCaching()
-
- * pear/Cache/Output.php
- pear/Cache/OutputCompression.php
- pear/Cache.php:
- - Renaming $no_cache to $caching and inverting it's meaning
- - Adding accessors for private $caching flag: getCaching() and setCaching()
-
-2001-05-15 Zeev Suraski <zeev@zend.com>
-
- * sapi/apache/mod_php4.c: MFH
-
- * sapi/apache/mod_php4.c:
- Move the initialization to a safer place (earlier, it could end up
- not being reset to 0 under certain circumstances)
-
-2001-05-15 Thomas V.V.Cox <cox@idecnet.com>
-
- * pear/PEAR/Installer.php:
- Put the verbose mode to work again. Some other style.
-
- * pear/PEAR/Installer.php: white spaces and indenting
-
-2001-05-15 Andrei Zmievski <andrei@ispi.net>
-
- * NEWS: Fix up a couple of entires.
-
-2001-05-15 Christian Stocker <chregu@nomad.ch>
-
- * pear/Makefile.in: 2 files from Cache/ were missing here, too.
-
- * pear/Makefile.in: 2 files from Cache/ were missing.
-
-2001-05-15 Gavin Sherry <swm@linuxworld.com.au>
-
- * ext/sysvshm/sysvshm.c: fixed shm_remove to expect the correct argument.
-
- * ext/sysvsem/php_sysvsem.h:
- Added function sem_remove
-
- * ext/sysvsem/sysvsem.c: Added sem_remove to remove semaphores from memory
-
-2001-05-15 Jani Taskinen <sniper@iki.fi>
-
- * ext/standard/url.c: MFB
-
- * ext/standard/url.c: Fix bug: #1249
-
- * ext/db/config.m4: MFH
-
- * ext/db/config.m4: Fix bug: #5418
-
-2001-05-14 Zeev Suraski <zeev@zend.com>
-
- * ext/com/VARIANT.c
- main/internal_functions_win32.c
- win32/php4dllts.dsp: Fix Win32 build (MFH)
-
-2001-05-14 Sterling Hughes <sterling@designmultimedia.com>
-
- * ext/curl/php_curl.h: leftovers.....
-
-2001-05-14 Frank M. Kromann <frank@frontbase.com>
-
- * ext/fbsql/Readme_w32.txt: Adding a small readme file for win32 users
-
- * ext/mssql/mssql_win32_howto.txt: updating the win32 readme
-
-2001-05-14 Sterling Hughes <sterling@designmultimedia.com>
-
- * ext/curl/curl.c: Register the binary transfer option
-
-2001-05-14 Andrei Zmievski <andrei@ispi.net>
-
- * ext/standard/basic_functions.c: Clean up call_user_func_*().
-
-2001-05-14 Sterling Hughes <sterling@designmultimedia.com>
-
- * ext/standard/basic_functions.c:
- Use zend_is_callable to test whether or not the given callback is valid
- before calling the function.
-
- * ext/standard/basic_functions.c:
- Use zend_is_callable() and fix sp of deprecated.
-
- * ext/standard/basic_functions.c:
- Couple of changes (and a little whitespace correction, sorry to mix :(
-
- 1) Depreciate the call_user_method*() variety of functions, their
- functionality can be easily duplicated by using the call_user_func*()
- functions (using the array(&$obj, "method") syntax).
-
- 2) Change some pval's to zval's.
-
- 3) Improve the error handling mechanism of call_user_func*() to report
- an the class name and the function name if an object or class name is
- given.
-
-2001-05-14 Derick Rethans <d.rethans@jdimedia.nl>
-
- * ext/standard/filestat.c:
- - Bumbed up the warning level to be in sync with fopen (which is E_WARNING
- too) (See bug #10856)
-
-2001-05-14 Vlad Krupin <phpdevel@echospace.com>
-
- * ext/imap/php_imap.c: Also, bogus types and encodings will not be returned any longer.
- Function imap_bodystruct() is also fixed in the same manner.
-
-2001-05-14 Andrei Zmievski <andrei@ispi.net>
-
- * ext/standard/basic_functions.c: Need to use ELS_FETCH() here.
-
- * NEWS: Reformat.
-
- * ext/standard/basic_functions.c:
- functions/methods that accepted parameters by reference. (Andrei)
-
- * Allow separation of arguments in call_user_* functions - this allows calling
- functions that force parameters by reference.
- * Use executor function table instead of compiler one.
-
- * ext/pcre/php_pcre.c:
- No need for check since callback_name is always filled in.
-
-2001-05-14 Thies C. Arntzen <thies@thieso.net>
-
- * ext/xml/xml.c: added expat version to phpinfo();
-
-2001-05-14 Daniel Beulshausen <daniel@php4win.de>
-
- * sapi/apache/php_apache.c: fix typo
-
-2001-05-14 Christian Stocker <chregu@nomad.ch>
-
- * pear/Cache/OutputCompression.php:
- do not compress if $this->no_cache is True (otherwise we get some "Headers
- already sent"-errors)
-
-2001-05-13 Harald Radi <h.radi@nme.at>
-
- * win32/php4dll.dsp
- win32/php4dllts.dsp: renamed *typedef_VARIANT.* to *VARIANT.*
-
- * main/internal_functions_win32.c:
- changed php_typedef_VARIANT.h to php_VARIANT.h
-
- * ext/com/VARIANT.c: renamed
-
-2001-05-13 Mika Tuupola <tuupola@appelsiini.net>
-
- * pear/Image/Remote.php:
- * Fixed a typo in example usage.
-
-2001-05-13 Harald Radi <h.radi@nme.at>
-
- * ext/com/VARIANT.c
- ext/com/com.h
- ext/com/conversion.c: modified because of the changes in com.c
-
- * ext/com/COM.c: also changed the return values of the internal functions from VARIANT
- to pval, so there's no need to convert the returned value after each function
- call and the real hashtable entry is returned and not only a copy of it.
-
-2001-05-13 Mika Tuupola <tuupola@appelsiini.net>
-
- * pear/Image/Remote.php:
- * Added error handling via PEAR_Error.
-
-2001-05-13 Harald Radi <h.radi@nme.at>
-
- * ext/dotnet/dotnet.cpp:
- added an additional parameter to dotnet_load to specify the codepage (phanto)
-
-2001-05-13 Wez Furlong <wez.php@thebrainroom.com>
-
- * ext/mbstring/mbfilter.c:
- Removed redundant (and incorrect) '0' from "begin" string for uudecode.
-
-2001-05-13 Zeev Suraski <zeev@zend.com>
-
- * sapi/apache/mod_php4.c
- sapi/apache/mod_php4.h
- sapi/apache/php_apache.c: MFH
-
- * sapi/apache/mod_php4.c
- sapi/apache/mod_php4.h
- sapi/apache/php_apache.c: Safer detection of recursive PHP invocations
-
- * win32/php4dllts.dsp: Fix broken XML build
-
-2001-05-13 Sascha Schumann <sascha@schumann.cx>
-
- * ext/session/mod_files.c
- ext/session/session.c: Nuke some warnings.
-
-2001-05-13 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * win32/php4dllts.dsp:
- Nuke HAVE_LIBEXPAT2. We define HAVE_LIBEXPAT in config.w32.h, and that does the trick.
-
-2001-05-12 Wez Furlong <wez.php@thebrainroom.com>
-
- * ext/mbstring/mbfilter.c:
- Took out a line that might cause problems if you try and uuencode; there is no
- uuencode support yet.
-
- * ext/mbstring/mbfilter.c
- ext/mbstring/mbfilter.h: Added uudecode support (MIME name "x-uuencode")
-
- * ext/bz2/bz2.c: modelines so code formatting is respected by vim.
-
- * ext/standard/file.h: prototype for php_file_le_stream()
-
- * ext/standard/file.c: expose streams to other extensions.
-
-2001-05-12 Andi Gutmans <andi@zend.com>
-
- * main/config.w32.h: - MFH
-
- * main/config.w32.h:
- - Fix bug. The INI system expects a string for default INI values.
- PR:
- Submitted by:
- Reviewed by:
- Obtained from:
-
-2001-05-12 Daniel Beulshausen <daniel@php4win.de>
-
- * win32/php4dllts.dsp
- ext/xml/expat/expat.dsw
- ext/xml/expat/expat.mak
- ext/xml/expat/winconfig.h: hopefully fix win32 build, untested
-
-2001-05-12 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * win32/php4dllts.dsp: Hopefully nuke the rest of the german commits.
-
- * win32/php4dllts.dsp: Remove german comments from MS VisualStudio.
-
- * win32/php4dllts.dsp: Make expat and ext/xml compile again on Win32.
-
-2001-05-12 Sascha Schumann <sascha@schumann.cx>
-
- * ext/satellite/corba.c
- ext/satellite/php_orbit.c
- build/rules_common.mk
- configure.in: First step towards full libtool 1.4 portability
-
- * build/build2.mk
- configure.in
- ltconfig: Remove ltconfig which is not used anymore by libtool 1.4
-
- * sapi/thttpd/config.m4
- sapi/fastcgi/config.m4
- sapi/roxen/config.m4
- sapi/apache/config.m4
- sapi/caudium/config.m4
- ext/zlib/config0.m4
- sapi/aolserver/config.m4
- ext/xml/config.m4
- ext/yp/config.m4
- ext/snmp/config.m4
- ext/standard/config.m4
- ext/saprfc/config.m4
- ext/session/config.m4
- ext/qtdom/config.m4
- ext/recode/config.m4
- ext/pcre/config.m4
- ext/pdf/config.m4
- ext/pgsql/config.m4
- ext/odbc/config.m4
- ext/oracle/config.m4
- ext/mysql/config.m4
- ext/oci8/config.m4
- ext/java/config.m4
- ext/ldap/config.m4
- ext/msql/config.m4
- ext/gettext/config.m4
- ext/informix/config.m4
- ext/fribidi/config.m4
- ext/gd/config.m4
- ext/cybercash/config.m4
- ext/db/config.m4
- ext/domxml/config.m4
- ext/fbsql/config.m4
- ext/ccvs/config.m4
- ext/cpdf/config.m4
- acinclude.m4
- configure.in: Nuke more quotes
-
- * acinclude.m4
- configure.in
- ext/dba/config.m4: Nuke some unneccessary quotes
-
- * main/php_compat.h: These functions have been changed to macros.
-
- * ext/wddx/php_wddx.h: Default to including expat.h
-
-2001-05-12 Anil Madhavapeddy <anil@recoil.org>
-
- * ltconfig: sync OpenBSD libtool 1.3.5 patches on the release branch
-
-2001-05-12 Sascha Schumann <sascha@schumann.cx>
-
- * NEWS: Moved to 4.0.6
-
- * NEWS: Put this already in 4.0.6
-
- * ext/session/mod_files.c: MFH fix for new-session-files-were-not-locked
-
- * ltconfig
- ltmain.sh: Revert libtool changes, so we are back to 1.3.5 now.
-
- * sapi/isapi/config.m4
- ext/zlib/zlib.m4
- sapi/caudium/config.m4
- ext/oci8/config.m4
- ext/odbc/config.m4
- ext/oracle/config.m4
- ext/saprfc/config.m4
- ext/ldap/config.m4
- ext/mbstring/config.m4
- ext/mcrypt/config.m4
- ext/ming/config.m4
- ext/mnogosearch/config.m4: MFH indentation patch
-
- * ext/dba/config.m4
- ext/zziplib/config.m4: Rename some custom macros from AC_* to PHP_*
-
- * sapi/caudium/config.m4
- sapi/isapi/config.m4
- ext/oracle/config.m4
- ext/saprfc/config.m4
- ext/zlib/config0.m4
- ext/oci8/config.m4
- ext/odbc/config.m4
- ext/ldap/config.m4
- ext/mbstring/config.m4
- ext/mcrypt/config.m4
- ext/ming/config.m4
- ext/mnogosearch/config.m4:
- Fix indentation of ./configure --help messages.
-
-2001-05-12 Andi Gutmans <andi@zend.com>
-
- * build/buildcheck.sh: - Revert libtool 1.4 check and allow 1.3.x.
- - I hope there is nothing else which needs changing!
-
-2001-05-12 Sascha Schumann <sascha@schumann.cx>
-
- * ext/session/mod_files.c:
- Replace ssize_t with long, as Win32 lacks proper support for that type.
-
-2001-05-12 Thies C. Arntzen <thies@thieso.net>
-
- * ext/xml/expat/expat.h: add missing file
-
-2001-05-12 Wez Furlong <wez.php@thebrainroom.com>
-
- * ext/pcre/php_pcre.c: Fixed leak.
-
-2001-05-12 Jani Taskinen <sniper@iki.fi>
-
- * ext/gd/config.m4: MFH
-
- * ext/gd/config.m4: Fixed bug: #10823
-
-2001-05-11 Andrei Zmievski <andrei@ispi.net>
-
- * ext/domxml/php_domxml.c: Open season on memory leaks, shoot all you can.
-
-2001-05-11 Sascha Schumann <sascha@schumann.cx>
-
- * scripts/config-stubs
- build/build.mk
- ext/zlib/config.m4
- ext/zlib/config0.m4
- ext/zlib/zlib.m4
- configure.in:
- Fix special treatment of zlib by introducing the Apache concept
- of config.m4 hierarchies.
-
-2001-05-11 Jason Greene <jason@inetgurus.net>
-
- * ext/standard/php_filestat.h
- ext/standard/file.c
- ext/standard/filestat.c:
- Rewrote stat() and fstat() to be memory efficient, due to a recent
- thread on php-dev.
-
- Note: I added a macro that might have use in other instances, but for now
- is included in php_filestat.h
-
-2001-05-11 Andrei Zmievski <andrei@ispi.net>
-
- * NEWS: MFH
-
- * NEWS: Compress several entries into one.
-
-2001-05-11 Sascha Schumann <sascha@schumann.cx>
-
- * NEWS: merge news
-
- * NEWS: update and some late additions
-
-2001-05-11 Thies C. Arntzen <thies@thieso.net>
-
- * sapi/apache/mod_php4.c:
- - Added --enable-memory-usage-info. This creates a new Apache 1.x logging
- directive "{mod_php_memory_usage}n" which will log the peak amount of
- memory used by the script.
-
- * NEWS: .
-
- * configure.in
- main/php_version.h: 4.0.6 is tagged, HEAD is now 4.0.7-dev
-
- * ext/xml/expat/xmltok/Makefile.in
- ext/xml/expat/xmltok/asciitab.h
- ext/xml/expat/xmltok/iasciitab.h
- ext/xml/expat/xmltok/latin1tab.h
- ext/xml/expat/xmltok/nametab.h
- ext/xml/expat/xmltok/utf8tab.h
- ext/xml/expat/xmltok/xmldef.h
- ext/xml/expat/xmltok/xmlrole.c
- ext/xml/expat/xmltok/xmlrole.h
- ext/xml/expat/xmltok/xmltok.c
- ext/xml/expat/xmltok/xmltok.dsp
- ext/xml/expat/xmltok/xmltok.h
- ext/xml/expat/xmltok/xmltok_impl.c
- ext/xml/expat/xmltok/xmltok_impl.h
- ext/xml/expat/xmltok/xmltok_ns.c
- ext/xml/expat/xmlparse/Makefile.in
- ext/xml/expat/xmlparse/expat_hashtable.h
- ext/xml/expat/xmlparse/hashtable.c
- ext/xml/expat/xmlparse/xmlparse.c
- ext/xml/expat/xmlparse/xmlparse.dsp
- ext/xml/expat/xmlparse/xmlparse.h
- ext/xml/config.m4
- ext/xml/expat/Changes
- ext/xml/expat/Makefile.in
- ext/xml/expat/README
- ext/xml/expat/README.php
- ext/xml/expat/ascii.h
- ext/xml/expat/asciitab.h
- ext/xml/expat/expat.html
- ext/xml/expat/iasciitab.h
- ext/xml/expat/latin1tab.h
- ext/xml/expat/nametab.h
- ext/xml/expat/utf8tab.h
- ext/xml/expat/xmlparse.c
- ext/xml/expat/xmlrole.c
- ext/xml/expat/xmlrole.h
- ext/xml/expat/xmltok.c
- ext/xml/expat/xmltok.h
- ext/xml/expat/xmltok_impl.c
- ext/xml/expat/xmltok_impl.h
- ext/xml/expat/xmltok_ns.c
- ext/xml/php_xml.h
- ext/xml/xml.c
- main/php_compat.h: bump bundled expat to 1.95.1
- win32 project _needs_ updating and i don't have windows
-
-2001-05-11 Sascha Schumann <sascha@schumann.cx>
-
- * ext/session/config.m4
- ext/session/mod_files.c: Save a couple of syscalls per session
-
- Fix apparent new-session-files-were-not-locked bug
-
- Replace %m with portable "%s", strerror(errno)
-
-2001-05-11 Andrei Zmievski <andrei@ispi.net>
-
- * ext/domxml/php_domxml.c:
- Start cleaning up domxml memory leaks. Still much stuff to do.
-
-2001-05-11 Derick Rethans <d.rethans@jdimedia.nl>
-
- * ext/standard/info.c: Tabs please...
-
-2001-05-11 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * ext/standard/info.c: Fix for bug #10815.
-
-2001-05-11 Jani Taskinen <sniper@iki.fi>
-
- * ext/imap/config.m4:
- Fixed problems which were caused by the previous patches.
-
-2001-05-11 Jason Greene <jason@inetgurus.net>
-
- * ext/standard/tests/file/001.phpt: Fix is_executable test.
-
- * ext/standard/file.c
- ext/standard/filestat.c:
- (Andrei's suggestion to still allow backwords compatibility.)
-
-2001-05-10 Jani Taskinen <sniper@iki.fi>
-
- * ext/gd/config.m4: default to /usr/local
-
-2001-05-10 Frank M. Kromann <frank@frontbase.com>
-
- * ext/fbsql/php_fbsql.c: Fixing some proto types
-
-2001-05-10 Andrei Zmievski <andrei@ispi.net>
-
- * ext/standard/array.c:
- Always free the callback_name when using zend_is_callable().
-
-2001-05-10 Zeev Suraski <zeev@zend.com>
-
- * ext/standard/credits.c: Fix buggy line split
-
- * sapi/cgi/cgi_main.c: Fixed bug 7822
-
-2001-05-10 Rui Hirokawa <louis@cityfujisawa.ne.jp>
-
- * ext/mbstring/mbfilter.c
- ext/mbstring/mbstring.c:
- fixed bug of mb_substitute_character() and mb_substr() in mbstring.
-
-2001-05-10 Jani Taskinen <sniper@iki.fi>
-
- * ext/java/.cvsignore: Missing .slo ignore.
-
- * ext/oracle/config.m4: Fixed bug: #10779
-
- * ext/imap/config.m4:
- Cleaning this a bit too. Now I'm also able to configure and compile
- with the test for imap-ssl.
-
-2001-05-10 Sterling Hughes <sterling@designmultimedia.com>
-
- * ext/com/COM.c: Fix naming issue
-
-
-2001-05-10 Jani Taskinen <sniper@iki.fi>
-
- * ext/domxml/config.m4: Cleaning up here too.
-
- * configure.in
- ext/zlib/config.m4
- ext/zlib/zlib.m4: Moved the zlib configure before other extensions.
-
- * ext/fdf/config.m4
- ext/mcrypt/config.m4
- ext/pdf/config.m4
- ext/gd/config.m4: Cleaned up this a bit..
-
-2001-05-09 Wez Furlong <wez.php@thebrainroom.com>
-
- * ext/mysql/php_mysql.c:
- Reverse my earlier patch for mysql_db_query() & emit an E_NOTICE of it's
- deprecated status.
-
-2001-05-09 Frank M. Kromann <frank@frontbase.com>
-
- * ext/fbsql/php_fbsql.c: Switching to zend_register_list_destructors_ex()
-
-2001-05-09 Andrei Zmievski <andrei@ispi.net>
-
- * ext/standard/basic_functions.c
- ext/standard/basic_functions.h:
- - Added is_callable() function that can be used to find out whether
- its argument is a valid callable construct.
-
-2001-05-09 Frank M. Kromann <frank@frontbase.com>
-
- * ext/mssql/php_mssql.c:
- Minor change to the way string lengths are calculated and space alocated.
-
-2001-05-09 Sascha Schumann <sascha@schumann.cx>
-
- * acinclude.m4:
- Document overwriting behaviour of PHP_ARG_WITH/ENABLE with regard
- to ext_shared.
-
-2001-05-09 Frank M. Kromann <frank@frontbase.com>
-
- * ext/mssql/php_mssql.c: Getting rid of memset.
-
-2001-05-09 Jani Taskinen <sniper@iki.fi>
-
- * ext/sablot/config.m4
- ext/xslt/config.m4:
- The PHP_EXTENSION() has to be before any other PHP_ARG_*()'s
-
-2001-05-09 Wenhui Zhang <zhang@empress.com>
-
- * ext/odbc/config.m4
- ext/odbc/php_odbc.h
- ext/odbc/setup.stub: Change for Empress PHP support
-
-2001-05-09 Sascha Schumann <sascha@schumann.cx>
-
- * configure.in: Also remove -L/usr/lib/? from LDFLAGS.
-
- * acinclude.m4
- configure.in: Remove -L/usr/lib/? from PHP_LDFLAGS.
-
- * ext/saprfc/config.m4: This probably was the cause for messages like
-
- autoconf: Undefined macros:
- ***BUG in Autoconf--please report*** AC_ADD_INCLUDE
- ***BUG in Autoconf--please report*** AC_ADD_LIBRARY_WITH_PATH
-
-2001-05-09 Rui Hirokawa <louis@cityfujisawa.ne.jp>
-
- * ext/mbstring/mbfilter.c
- ext/mbstring/mbfilter.h
- ext/mbstring/mbstring.c
- ext/mbstring/mbstring.h:
- remaked mb_gpc_handler as mb_parse_str() in mbstring.
-
-2001-05-09 Hartmut Holzgraefe <hartmut@six.de>
-
- * ext/saprfc/.cvsignore
- ext/saprfc/Makefile.in
- ext/saprfc/README
- ext/saprfc/config.m4
- ext/saprfc/php_saprfc.c
- ext/saprfc/php_saprfc.h
- ext/saprfc/saprfc.php: some basic functionality: o
- - pen/close rfc connections
- - get connection and server info
-
-2001-05-09 Sterling Hughes <sterling@designmultimedia.com>
-
- * ext/sockets/sockets.c:
- fix crash bug (unlikely, but this is the only place where the reported bug
- would make sense, and it can't hurt)...
-
-2001-05-09 Jani Taskinen <sniper@iki.fi>
-
- * ext/snmp/config.m4: Fixed a typo.
-
-2001-05-08 Frank M. Kromann <frank@frontbase.com>
-
- * ext/fbsql/php_fbsql.c: Use RETURN_ macros to define function returns.
- Fix fetch functions to return values from array data structure
-
-2001-05-08 Jani Taskinen <sniper@iki.fi>
-
- * ext/sablot/config.m4
- ext/xslt/config.m4: No need to show these if they are not used.
-
- * configure.in
- main/main.c: Fixed: http://www.php.net/bugs.php?id=10733&edit=1
-
-2001-05-08 Dan Kalowsky <dank@deadmime.org>
-
- * ext/odbc/php_odbc.c:
- this is a fix for bug 10250. it basically provides the unixODBC driver with
- access to the SQLDriver functions. patch originally submitted by
- dzoll@nyscul.org, and is going to be tested by some of the unixODBC people.
-
-2001-05-08 Frank M. Kromann <frank@frontbase.com>
-
- * ext/mssql/php_mssql.c:
- Fixing the use of compatibility mode. When the flag is off the system should return correct PHP types (default) when the flag is on strings will be returned for all data types.
-
- * ext/mssql/php_mssql.c:
- Fixing the use of compatibility_mode setting in php.ini.
- Nuking trailing spaces when returning a string.
-
-2001-05-08 Thomas V.V.Cox <cox@idecnet.com>
-
- * pear/Experimental/XML/Xml2obj.php:
- This is a complete rewrite of the class. Now the object tree returned
- by the class is very similiar to a DOM Doc. Also implemented some
- node methods.
-
-2001-05-08 Andrei Zmievski <andrei@ispi.net>
-
- * NEWS: Remove wrong line.
-
- * NEWS: Reformatting.
-
-2001-05-08 Zeev Suraski <zeev@zend.com>
-
- * NEWS: Update NEWS
-
-2001-05-08 Rui Hirokawa <louis@cityfujisawa.ne.jp>
-
- * ext/mbstring/mbfilter.c
- ext/mbstring/mbfilter.h
- ext/mbstring/mbstring.c: added mb_language to ext/mbstring.
-
-2001-05-08 Jani Taskinen <sniper@iki.fi>
-
- * ext/mysql/config.m4: Fix the build.
-
-2001-05-08 Dan Kalowsky <dank@deadmime.org>
-
- * TODO-4.1.txt: reminder to remove the --with-openlink configure option
- PR:
- Submitted by:
- Reviewed by:
- Obtained from:
-
-2001-05-08 Zeev Suraski <zeev@zend.com>
-
- * sapi/cgi/cgi_main.c: $argc was off by one in -f (fix bug #9289)
-
-2001-05-08 James Moore <James@phpuk.org>
-
- * ext/pdf/pdf.c:
- Give correct warnings if certain libaries/verisons are not avalible
-
-2001-05-07 Zeev Suraski <zeev@zend.com>
-
- * sapi/apache/mod_php4.c: whitespace
-
- * ext/standard/output.c:
- Avoid crashing if somehow, output is sent in a new thread tha had no requests
-
-2001-05-07 Marc Boeren <M.Boeren@guidance.nl>
-
- * ext/dbx/dbx.c:
- Passed db_handle to dbx_error_function instead of NULL (Mc)
-
-2001-05-07 Rui Hirokawa <louis@cityfujisawa.ne.jp>
-
- * ext/mbstring/mbfilter_ja.h
- ext/mbstring/mbfilter.c
- ext/mbstring/mbfilter.h
- ext/mbstring/mbfilter_ja.c: update address of licence term in mbstring.
-
-2001-05-07 Zeev Suraski <zeev@zend.com>
-
- * NEWS: Update NEWS
-
- * sapi/apache/mod_php4.c
- sapi/apache/php_apache.c:
- Allow virtual() of PHP files. We may have to improve the detection code a
- bit, but it worked well on everything I tried.
-
-2001-05-07 Wez Furlong <wez.php@thebrainroom.com>
-
- * ext/mysql/php_mysql.c:
- Enabled optional result_mode param in mysql_db_query() to make it behave
- as mysql_unbuffered_query (can be either MYSQL_USE_RESULT or
- MYSQL_STORE_RESULT)
-
-2001-05-07 Sascha Schumann <sascha@schumann.cx>
-
- * ext/wddx/config.m4:
- As the WDDX extension can now be built as shared extension
- without functional loss with regard to the session serializer, it
- is safe to default to disable. We enable XML automatically only,
- if the user is building WDDX as a static extension.
-
-2001-05-07 David Hedbor <david@hedbor.org>
-
- * sapi/caudium/caudium.c:
- Patch from Jan Legenhausen to add vars to the HTTP_SERVER_VARS array.
-
-2001-05-06 Stig Bakken <ssb@fast.no>
-
- * pear/CODING_STANDARDS: updated the .emacs example
-
- * configure.in:
- use $PHP_LAYOUT, not $libdir, to determine the extension install layout
-
- * configure.in: Changed the default php.ini path back to /usr/local/lib. Use
- "--with-layout=GNU" for now to get the new behaviour.
-
-2001-05-06 Egon Schmid <eschmid@s.netic.de>
-
- * ext/mbstring/mbstring.c: Fixed some protos.
-
-2001-05-06 Sterling Hughes <sterling@designmultimedia.com>
-
- * ext/curl/curl.c: fix crash bug
-
-2001-05-06 Rui Hirokawa <louis@cityfujisawa.ne.jp>
-
- * ext/mbstring/mbfilter.c
- ext/mbstring/mbstring.c:
- fixed divided by zero exception and lack of multidimentional array support in mbstring.
-
-2001-05-06 Sterling Hughes <sterling@designmultimedia.com>
-
- * ext/iconv/php_iconv.h: fix compile bug.
-
-2001-05-06 Jani Taskinen <sniper@iki.fi>
-
- * ext/imap/config.m4:
- Attempt to fix the build when a c-client lib with kerberos, pam and ssl
- is used.
-
-2001-05-06 James Moore <James@phpuk.org>
-
- * ext/standard/basic_functions.c: Fix win32 build
-
-2001-05-06 Derick Rethans <d.rethans@jdimedia.nl>
-
- * ext/standard/parsedate.y: - Nuke warning
-
-2001-05-06 Sascha Schumann <sascha@schumann.cx>
-
- * build/buildcheck.sh: Up prerequisites to libtool 1.4
-
- * config.sub
- ltconfig
- ltmain.sh
- config.guess: Upgrade to libtool 1.4.
-
-2001-05-06 Derick Rethans <d.rethans@jdimedia.nl>
-
- * ext/standard/parsedate.y
- ext/standard/tests/time/002.phpt:
- - Partial fix for bug #9050, support for "Jan 19 2000" date format
-
-2001-05-06 Anil Madhavapeddy <anil@recoil.org>
-
- * ltconfig: sync with OpenBSD libtool patches
-
-2001-05-06 Jani Taskinen <sniper@iki.fi>
-
- * ext/standard/basic_functions.c
- ext/standard/lcg.c
- ext/standard/php_lcg.h:
- Moved ts_alloca_id() into MINIT like Andi requested.
-
-2001-05-06 Chuck Hagenbuch <chuck@horde.org>
-
- * pear/Net/Socket.php: whitespace
-
-2001-05-06 Jani Taskinen <sniper@iki.fi>
-
- * ext/standard/basic_functions.c
- ext/standard/crypt.c
- ext/standard/lcg.c
- ext/standard/php_crypt.h
- ext/standard/php_lcg.h:
- Fix bug: #8834. Now there should be more random salts..
-
- * main/main.c:
- Fixed bug: #7227. Now the correct strings (if set) are shown.
-
- * ext/standard/info.c
- main/php_ini.c: Fix bug: #10323. Every value outputted is now escaped.
-
-2001-05-06 Zeev Suraski <zeev@zend.com>
-
- * NEWS: Update NEWS
-
-2001-05-06 Harald Radi <h.radi@nme.at>
-
- * NEWS: corrected COM news entry
-
-2001-05-06 Christian Stocker <chregu@nomad.ch>
-
- * pear/Cache/Container/dbx.php:
- MFH (added low/highwater cache size detection)
-
-2001-05-06 Sascha Schumann <sascha@schumann.cx>
-
- * ext/imap/php_imap.c: Fix broken build
-
-2001-05-06 Christian Stocker <chregu@nomad.ch>
-
- * pear/Cache/Container/dbx.php: added low/highwater cache size detection
-
-2001-05-06 Wez Furlong <wez.php@thebrainroom.com>
-
- * ext/standard/fsock.h: Fixed win32 build problem.
-
- * ext/standard/fsock.h: Fixed build problem for win32
-
-2001-05-06 Egon Schmid <eschmid@s.netic.de>
-
- * ext/pgsql/pgsql.c: Corrected one proto.
-
-2001-05-06 Jani Taskinen <sniper@iki.fi>
-
- * ext/imap/config.m4
- ext/imap/php_imap.c: Beutify phpinfo() output.
-
- * ext/imap/config.m4: Added a check that libc-client support SSL.
-
- * ext/imap/php_imap.c: Removed usused variables.
-
-2001-05-06 Rui Hirokawa <louis@cityfujisawa.ne.jp>
-
- * ext/mbstring/mbstring.c:
- fixed a compilation problem without --enable-mbstr-enc-trans.
-
-2001-05-06 Rasmus Lerdorf <rasmus@php.net>
-
- * ext/pgsql/pgsql.c
- ext/pgsql/php_pgsql.h
- NEWS: Add pg_last_notice() function
-
-2001-05-05 Wez Furlong <wez.php@thebrainroom.com>
-
- * main/php_network.h: Added missing sys/time.h include
-
- * main/php_network.h: Fixed Andi's build problem.
-
-2001-05-05 Andi Gutmans <andi@zend.com>
-
- * configure.in
- main/php_version.h: - RC1
-
-2001-05-05 Wez Furlong <wez.php@thebrainroom.com>
-
- * ext/standard/fsock.c
- ext/standard/fsock.h
- main/network.c
- main/php_network.h
- main/php_streams.h
- main/streams.c:
- Nuke buffering from php_streams, move connect_nonb() from fsock.c to network.c
- and rename to php_connect_nonb().
- Use php_connect_nonb() instead of connect() in php_hostconnect() -> timeouts
- should now work in php_hostconnect().
- sock streams abstraction now uses php_sockbuf as the "abstract" pointer.
-
-2001-05-05 Christian Stocker <chregu@nomad.ch>
-
- * pear/Cache/Container/dbx.php
- pear/Cache/Container/file.php: fixed some typos in the code.
-
- * pear/Cache/Container/phplib.php:
- low/highwater mark detection of cache size done.
-
-2001-05-05 Andi Gutmans <andi@zend.com>
-
- * NEWS: - Fix format to be consistent
-
-2001-05-05 Sascha Schumann <sascha@schumann.cx>
-
- * build/buildcheck.sh: Fix libtool check
-
- Submitted by: brisse@ping.dk
-
-2001-05-05 Wez Furlong <wez.php@thebrainroom.com>
-
- * ext/openssl/CREDITS: Added Sascha Kettler to credits
-
-2001-05-05 Sascha Schumann <sascha@schumann.cx>
-
- * ext/mysql/php_mysql.c: Fix broken ZTS build.
-
-2001-05-05 Thies C. Arntzen <thies@thieso.net>
-
- * TODO-4.1.txt: not to forget this one!
-
-2001-05-05 Zeev Suraski <zeev@zend.com>
-
- * ext/mysql/php_mysql.c
- ext/mysql/php_mysql.h:
- emalloc()'d strings must be freed before the request shutdown;
- Rule of the thumb: initialize in RINIT, clean in RSHUTDOWN
-
-2001-05-04 Wez Furlong <wez.php@thebrainroom.com>
-
- * ext/openssl/openssl.c
- ext/openssl/php_openssl.h:
- Merged and adapted a patch from Sascha Kettler <kettler@gmx.net> that provides
- some asymmetric RSA encrypt/decrypt functions.
-
- * EXTENSIONS:
- I'm now the primary maintainer for OpenSSL extension, as agreed with Stig
- Venaas.
-
- * TODO-4.1.txt:
- Making notes about which extensions need most work for streams.
-
-2001-05-04 Chuck Hagenbuch <chuck@horde.org>
-
- * ext/imap/php_imap.c:
- Add support for in_reply_to header, and fix erealloc usage ("Johan Ekenberg"
- <johan@ekenberg.se>).
-
-2001-05-04 Jason Greene <jason@inetgurus.net>
-
- * ext/mysql/php_mysql.c:
- Fixed bug in my previous patch, forgot to reset connect error globals
- on request startup.
-
-2001-05-04 Jani Taskinen <sniper@iki.fi>
-
- * ext/mysql/libmysql/mysql_version.h: Fix bugs: #10642, #10612
-
-2001-05-04 Andrei Zmievski <andrei@ispi.net>
-
- * ext/pcre/php_pcre.c:
- - Fixed a bug in preg_split() that would incorrectly limit the number of
- results when used along with PREG_SPLIT_NO_EMPTY flag. (Andrei)
- - Also made limit = -1 when limit = 0, to emulate Perl.
-
-2001-05-04 Thies C. Arntzen <thies@thieso.net>
-
- * ext/oci8/oci8.c
- ext/oci8/php_oci8.h: namespace-protect "open"
-
-2001-05-04 Harald Radi <h.radi@nme.at>
-
- * win32/php4dll.dsp: added ext/com/ files to the project
-
-2001-05-04 Thomas V.V.Cox <cox@idecnet.com>
-
- * pear/Experimental/XML/Xml2obj.php:
- More in-line docs and examples and some vars renamed
-
-2001-05-04 Rui Hirokawa <louis@cityfujisawa.ne.jp>
-
- * ext/mbstring/mbfilter.c
- ext/mbstring/mbstring.c: fixed a memory leak in ext/mbstring.
-
-2001-05-04 Ben Mansell <ben@zeus.com>
-
- * sapi/fastcgi/fastcgi.c:
- Removed a duplicate php_import_environment_variables() call
- from fastcgi sapi
-
-2001-05-04 Marc Boeren <M.Boeren@guidance.nl>
-
- * ext/dbx/CREDITS
- ext/dbx/dbx.dsp: Forgot the Visual Studio project, added now (Mc)
- Updated CREDITS (Mc)
-
- * ext/dbx/Makefile.in
- ext/dbx/dbx.c
- ext/dbx/dbx_mssql.c
- ext/dbx/dbx_mssql.h:
- Registered db-module constants for use in dbx_connect (Mc)
- Added support for Microsoft SQL Server (Mc)
-
- * ext/dbx/howto_extend_dbx.html:
- Added docs about creating dbx-support for other databases. (Mc)
-
-2001-05-04 Christian Stocker <chregu@nomad.ch>
-
- * pear/Cache/Container/db.php:
- added low/higwater garbage collection to the db-container. dbx should
- follow soon
-
-2001-05-04 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * ext/standard/image.c: Nuke unreferenced local variables.
-
-2001-05-04 Sterling Hughes <sterling@designmultimedia.com>
-
- * ext/curl/curl.c
- ext/curl/php_curl.h:
- Make it compile with the latest cURL cvs, heck it even works.
-
-2001-05-04 Rui Hirokawa <louis@cityfujisawa.ne.jp>
-
- * ext/iconv/iconv.c:
- added status parameter to output handler in ext/iconv.
-
-2001-05-04 Jason Greene <jason@inetgurus.net>
-
- * ext/mysql/php_mysql.c
- ext/mysql/php_mysql.h:
- This should work correctly without causing compatibility issues with previous
- scripts. Someone might want to double check this change, just in case.
-
-2001-05-03 Thomas V.V.Cox <cox@idecnet.com>
-
- * pear/Experimental/XML/Xml2obj.php:
- This class takes an xml file and maps it to an objects tree. It doesn't
- need DOM support, and the resultant tree is more easy (and limited) to handle.
- Note that it's experimental and waiting for comments.
-
-2001-05-03 Derick Rethans <d.rethans@jdimedia.nl>
-
- * ext/standard/image.c:
- - Applied a patch that enables getimagesize to return the size of .bmp and
- .psd files (Patch by Paul Jongsma <paulj@webtic.com>)
- - Added support to getimagesize to return dimensions of BMP and PSD
- files
-
-2001-05-03 Wez Furlong <wez.php@thebrainroom.com>
-
- * TODO-4.1.txt: Added streams stuff
-
-2001-05-03 Chuck Hagenbuch <chuck@horde.org>
-
- * ext/imap/php_imap.c:
- add crash guard (valid message number check) to imap_body().
-
- * ext/imap/php_imap.c:
- removing references to IMSP module, which will probably never be ported to
- php4 (lack of a publically available library implementing it).
-
- * ext/imap/php_imap.c:
- Fix for #8359. imap_fetchheader should never return the full message; the
- FT_PREFETCHTEXT flag is just a hint to c-client that you'll be asking for
- the message text next.
-
-2001-05-03 Sascha Schumann <sascha@schumann.cx>
-
- * ext/session/mod_mm.c
- ext/session/modules.c
- ext/session/php_session.h
- ext/session/session.c:
- add an interface for registering storage modules at run-time.
-
-2001-05-03 Harald Radi <h.radi@nme.at>
-
- * ext/com/COM.c: fixed leaky code
-
-2001-05-03 Sascha Schumann <sascha@schumann.cx>
-
- * sapi/thttpd/thttpd.c: Replace slow strlcpy with a quick memcpy.
-
-2001-05-03 Sergey Kartashoff <gluke@biosys.net>
-
- * ext/mnogosearch/php_mnogo.c:
- Some fixes in Udm_Cat_List and Udm_Cat_Path functions.
-
-2001-05-03 Jani Taskinen <sniper@iki.fi>
-
- * build/buildcheck.sh: Fix bug #10589
-
-2001-05-03 Rui Hirokawa <louis@cityfujisawa.ne.jp>
-
- * ext/iconv/.cvsignore
- ext/mbstring/.cvsignore: added .cvsignore.
-
- * ext/mbstring/mbstring.c:
- deleted some function aliases.
-
-2001-05-02 Hartmut Holzgraefe <hartmut@six.de>
-
- * ext/ext_skel
- ext/skeleton/CREDITS
- ext/skeleton/EXPERIMENTAL:
- added generation of CREDITS and EXPERIMENTAL to ext_skel
-
-2001-05-02 Andi Gutmans <andi@zend.com>
-
- * ext/odbc/php_odbc.c:
- - More strncpy() -> strlcpy() changes. Am I getting bored yet? :)
-
- * ext/imap/php_imap.c:
- - More strncpy() -> strlcpy() changes. mm_login() doesn't seem to be used
- though.
-
- * sapi/thttpd/thttpd.c: - Another strncpy() -> strlcpy() change
-
- * ext/exif/exif.c: - Change strncpy()'s to strlcpy()'s
-
- * ext/interbase/interbase.c: - Whitespace fix
-
- * ext/interbase/interbase.c: - Commit interbase fixes
-
- * ext/curl/curl.c:
- - Fix possible buffer overflow. Always better to use strlcpy() instead
- of strncpy()
-
-2001-05-02 Harald Radi <h.radi@nme.at>
-
- * ext/dotnet/dotnet.cpp: adapted because of the changes in the com module
-
-2001-05-02 Andi Gutmans <andi@zend.com>
-
- * NEWS: *** empty log message ***
-
-2001-05-02 Harald Radi <h.radi@nme.at>
-
- * ext/com/COM.c
- ext/com/com.h
- ext/com/conversion.c
- ext/com/php_COM.h:
- removed itypeinfo calls because they didn't work on every machine
-
-2001-05-02 Frank M. Kromann <frank@frontbase.com>
-
- * ext/fbsql/php_fbsql.c: Changing paramters on database_password
-
- * ext/fbsql/php_fbsql.c: Fixing segfault in database_password
-
-2001-05-02 Sterling Hughes <sterling@designmultimedia.com>
-
- * NEWS: .
-
-
- * NEWS: set the date 4.0.5 was released.
-
- add an entry about the cgi, $PHP_SELF change that I made.
-
-
-2001-05-02 Ulf Wendel <ulf.wendel@phpdoc.de>
-
- * pear/Cache/Container.php
- pear/Cache/Container/db.php
- pear/Cache/Container/dbx.php
- pear/Cache/Container/file.php
- pear/Cache/Container/phplib.php:
- - added a high- and lowwater mark for the file container
- ... need some help with the other containers
-
- - added default options
-
-2001-05-02 Andi Gutmans <andi@zend.com>
-
- * ext/sybase/config.m4
- ext/sybase/php_sybase_db.c:
- - Apply Vlad's sybase patch to work with two different kinds of builds of
- the sybase libraries
-
-2001-05-02 Chuck Hagenbuch <chuck@horde.org>
-
- * ext/imap/php_imap.c: fix whitespace pollution
-
- * ext/imap/php_imap.c:
- Fixes and improvements to imap_mail_compose (Johan Ekenberg
- <johan@ekenberg.se>)
-
- * ext/imap/php_imap.c:
- Add support for cram-md5 authentication in imap_open().
-
-2001-05-02 Ulf Wendel <ulf.wendel@phpdoc.de>
-
- * pear/Cache/OutputCompression.php
- pear/Experimental/Image/color_helper.php:
- - I did not get any comments on the Cache/OutputCompression API,
- so it's now final...
-
- - some whitespaces in color_helper.php
-
-2001-05-02 Ben Mansell <ben@zeus.com>
-
- * sapi/fastcgi/fastcgi.c:
- Patch from Stephen Landamore: speed up the environment merging by
- using memcpy instead of putenv.
-
-2001-05-02 Daniel Beulshausen <daniel@php4win.de>
-
- * win32/testsuite.dsp
- run-tests.php
- win32/php4ts.dsw: make run-tests work under win32 too
-
-2001-05-02 Rui Hirokawa <louis@cityfujisawa.ne.jp>
-
- * ext/mbstring/mbstring.c:
- clear http input encoding detection result in RSHUTDOWN.
-
-2001-05-02 Jani Taskinen <sniper@iki.fi>
-
- * main/rfc1867.c:
- Now the file uploads 'work' also on Lynx. This patch was submitted
- by Andreas Pistoor <andreas@erestor.f2s.com> and I have tested it a
- quite long time now and didn't notive any problems. Bug: #9930
-
-2001-05-02 John Donagher <john@webmeta.com>
-
- * ext/pfpro/pfpro.c: - Remove C-style comments
- - Remove some stale debugging code
-
-2001-05-02 Jani Taskinen <sniper@iki.fi>
-
- * ext/mysql/config.m4
- ext/mysql/php_mysql.c:
- Possible Fix for #10570, #10585, #10539 and maybe others.
-
-2001-05-01 Rui Hirokawa <louis@cityfujisawa.ne.jp>
-
- * ext/mbstring/mbstring.c
- ext/mbstring/mbstring.h:
- modified some function name in ext/mbstring based on naming convension and mbstr_http_input() implemented.
-
-2001-05-01 Jani Taskinen <sniper@iki.fi>
-
- * ext/odbc/config.m4
- main/build-defs.h.in: Fix bug #10563
-
-2001-05-01 Frank M. Kromann <frank@frontbase.com>
-
- * ext/fbsql/php_fbsql.c: Fixing some proto types and return values
-
-2001-05-01 Hartmut Holzgraefe <hartmut@six.de>
-
- * ext/saprfc/CREDITS
- ext/saprfc/EXPERIMENTAL
- ext/saprfc/Makefile.in
- ext/saprfc/README
- ext/saprfc/config.m4
- ext/saprfc/php_saprfc.c
- ext/saprfc/php_saprfc.h
- ext/saprfc/tests/001.phpt:
- the beginning of the SAP R/3 ABAP4 Remote Function Call extension
- configure works, it finds headers and lib
- compile and link against librfc works too
- but no functionality yet :(
-
- * ext/ext_skel: looks like i missed something
-
-2001-05-01 John Donagher <john@webmeta.com>
-
- * ext/pfpro/TODO: Add TODO
-
-2001-05-01 Andi Gutmans <andi@zend.com>
-
- * ext/mssql/php_mssql.c:
- - Optimizer the previous patch a bit by nuking memset()
-
-2001-05-01 Frank M. Kromann <frank@frontbase.com>
-
- * ext/mssql/php_mssql.c:
- Adding support for BINARY, VARBINARY and IMAGE column types.
- Thanks to Brad LaFountain.
-
-2001-05-01 Andrei Zmievski <andrei@ispi.net>
-
- * ext/wddx/php_wddx_api.h
- ext/wddx/wddx.c
- ext/session/php_session.h
- ext/session/session.c:
- Patch from Sascha that abstracts session serializers. WDDX extension
- now implements the encode/decode functions and registers them with
- the session module.
-
-2001-05-01 Andi Gutmans <andi@zend.com>
-
- * main/snprintf.c: - Remove C++ comment
-
- * main/snprintf.c: - Fix snprintf() to work with nan and inf properly
-
-2001-05-01 Hartmut Holzgraefe <hartmut@six.de>
-
- * ext/skeleton/php_skeleton.h
- ext/skeleton/skeleton.c:
- hartmfixed and extended the ini parameter and module globals stuff
-
- once again: someone test this please!
-
-2001-05-01 Rui Hirokawa <louis@cityfujisawa.ne.jp>
-
- * ext/mbstring/mbstring.c
- ext/mbstring/mbstring.h:
- modified some function name in mbstring based on php's naming convension.
-
-2001-05-01 Andi Gutmans <andi@zend.com>
-
- * sapi/cgi/cgi_main.c: - Remove unused variable
-
-2001-05-01 Derick Rethans <d.rethans@jdimedia.nl>
-
- * ext/mcrypt/mcrypt.c: - Fix for bug #10518 (Thanks to kettler@gmx.net)
-
-2001-05-01 Rui Hirokawa <louis@cityfujisawa.ne.jp>
-
- * ext/mbstring/mbstring.c
- ext/mbstring/mbstring.h:
- simplified some function's name in ext/mbstring.
-
-2001-05-01 John Donagher <john@webmeta.com>
-
- * ext/pfpro/config.m4
- ext/pfpro/pfpro.c
- ext/pfpro/php_pfpro.h: - Remove some stale code
- - Fix spelling mistakes
- - Add build-time version detection
- - Add support for v3 Verisign SDK
- pfpro extension now supports version 3 of the Verisign SDK (John Donagher)
-
-2001-05-01 Sterling Hughes <sterling@designmultimedia.com>
-
- * sapi/cgi/cgi_main.c:
- fix for bug 6491, http://www.php.net/bugs.php?id=6491, removes a bit of
- (what I think is) broken logic.
-
-
- * ext/sablot/config.m4
- ext/xslt/config.m4: Check for the existance of the iconv library
-
-
-2001-05-01 Rui Hirokawa <louis@cityfujisawa.ne.jp>
-
- * main/php_main.h
- ext/mbstring/CREDITS
- ext/mbstring/EXPERIMENTAL
- ext/mbstring/Makefile.in
- ext/mbstring/README_PHP3-i18n-ja
- ext/mbstring/config.m4
- ext/mbstring/mbfilter.c
- ext/mbstring/mbfilter.h
- ext/mbstring/mbfilter_ja.c
- ext/mbstring/mbfilter_ja.h
- ext/mbstring/mbstring.c
- ext/mbstring/mbstring.h: renamed jstring to mbstring.
-
-2001-04-30 Andi Gutmans <andi@zend.com>
-
- * sapi/cgi/cgi_main.c: - Fix for Bug id #10071
- PR:
- Submitted by:
- Reviewed by:
- Obtained from:
-
-2001-04-30 Hartmut Holzgraefe <hartmut@six.de>
-
- * ext/ext_skel: some more example code for modules using --with-something
- works for me (linux/bash) but please give it a test drive
-
-2001-04-30 Sterling Hughes <sterling@designmultimedia.com>
-
- * ext/curl/curl.c: remove last minute garbage that snuck in...
-
- * NEWS: As per Andi's suggestions.
-
- * NEWS:
- update the news file in accordance with my previous commit...
-
- * ext/curl/curl.c: Add some missing constants.
-
- * ext/curl/curl.c
- ext/curl/php_curl.h:
- Added REGISTER_CURL_CONSTANT() a wrapper around REGISTER_LONG_CONSTANT()
- Re-vamp the internal php_curl structure.
- Properly free allocated slist's and HttpPost structures
- many whitespace changes
- speed improvements (in the post handling and slist area's)
-
-
-2001-04-30 Daniel Beulshausen <daniel@php4win.de>
-
- * main/main.c
- main/php.h
- ext/pgsql/pgsql.c: make pgsql build under win32 again
-
-2001-04-30 Adam Dickmeiss <adam@indexdata.dk>
-
- * ext/yaz/php_yaz.c:
- Timeout setting for yaz_wait. Force call by reference for yaz_ccl_parse
- and yaz_scan_result.
-
-2001-04-30 Zeev Suraski <zeev@zend.com>
-
- * NEWS
- configure.in
- main/php_version.h: Go with 4.0.5
-
-2001-04-30 Rui Hirokawa <louis@cityfujisawa.ne.jp>
-
- * main/php_main.h:
- added japanse http input (POST/GET/Cookie) handler. It is nessceary to add input encoding conversion functionality for ext/jstring.
-
- * ext/jstring/jstring.h
- ext/jstring/mbfilter.c
- ext/jstring/mbfilter.h
- ext/jstring/mbfilter_ja.c
- ext/jstring/mbfilter_ja.h
- ext/jstring/CREDITS
- ext/jstring/EXPERIMENTAL
- ext/jstring/Makefile.in
- ext/jstring/README_PHP3-i18n-ja
- ext/jstring/config.m4
- ext/jstring/jstring.c: added japanese string function module.
-
-2001-04-30 Daniel Beulshausen <daniel@php4win.de>
-
- * ext/hyperwave/hw.c: *must* use HwSLS_FETCH()
-
-2001-04-30 Andi Gutmans <andi@zend.com>
-
- * sapi/cgi/cgi_main.c
- win32/registry.c
- main/SAPI.c
- main/fopen_wrappers.c
- main/main.c
- main/php_open_temporary_file.c
- main/rfc1867.c
- main/safe_mode.c
- sapi/caudium/caudium.c
- ext/standard/basic_functions.c
- ext/standard/browscap.c
- ext/standard/dir.c
- ext/standard/exec.c
- ext/standard/file.c
- ext/standard/filestat.c
- ext/standard/iptc.c
- ext/standard/link.c
- ext/swf/swf.c
- ext/openssl/openssl.c
- ext/posix/posix.c
- ext/session/mod_files.c
- ext/session/session.c
- ext/gettext/gettext.c
- ext/ming/ming.c
- ext/oci8/oci8.c
- ext/ftp/php_ftp.c
- ext/gd/gd.c
- ext/gd/gd_ctx.c
- ext/fdf/fdf.c
- ext/filepro/filepro.c
- ext/dba/dba_cdb.c
- ext/dba/dba_db2.c
- ext/dba/dba_db3.c
- ext/dba/dba_dbm.c
- ext/dbase/dbase.c
- ext/dbase/dbf_head.c
- ext/exif/exif.c
- ext/com/COM.c
- ext/db/db.c: - Change macros from V_ to VCWD_ because of AIX name clash
-
-2001-04-30 Daniel Beulshausen <daniel@php4win.de>
-
- * ext/gd/gd.dsp: make dsp supporting gd2
-
-2001-04-30 Sergey Kartashoff <gluke@biosys.net>
-
- * ext/mnogosearch/php_mnogo.h
- ext/mnogosearch/php_mnogo.c:
- Udm_Cat_List and Udm_Cat_Path functions has been added.
-
-2001-04-30 Daniel Beulshausen <daniel@php4win.de>
-
- * ext/fbsql/fbsql.dsp: look in Release_TS_inline for php4ts.lib as well
-
- * ext/dotnet/dotnet.cpp
- ext/dotnet/dotnet.dsp:
- make dotnet module build again & fix dsp ouput dir
-
- * ext/domxml/domxml.dsp: newer libxml libs are called libxml2.lib
-
-2001-04-30 Andi Gutmans <andi@zend.com>
-
- * ext/imap/php_imap.c:
- - Fix crash bugs when rfc822_qprint and rfc822_base64 return NULL
-
-2001-04-30 Sergey Kartashoff <gluke@biosys.net>
-
- * ext/mnogosearch/README:
-2001-04-30 Daniel Beulshausen <daniel@php4win.de>
-
- * ext/db/db.dsp: fix ouput directory
-
- * ext/curl/curl.c: fix win32 build
-
-2001-04-30 Sergey Kartashoff <gluke@biosys.net>
-
- * ext/mnogosearch/php_mnogo.c:
- Added UDM_FIELD_CATEGORY parameter to get current document
- category in the mnoGoSearch module
-
-2001-04-30 Andi Gutmans <andi@zend.com>
-
- * NEWS: - Interactive mode is back in 4.0.6
-
-2001-04-30 David Croft <david@infotrek.co.uk>
-
- * ext/standard/array.c
- ext/standard/basic_functions.c
- ext/standard/php_array.h: Added key_exists() to check if a given key or index exists in an array or object
-
-2001-04-29 Zeev Suraski <zeev@zend.com>
-
- * NEWS: layout
-
-2001-04-29 Andi Gutmans <andi@zend.com>
-
- * ext/standard/dir.c:
- - Remove leak from opendir() under Windows. Maybe readdir.c should be
- changed to use emalloc()
- PR:
- Submitted by:
- Reviewed by:
- Obtained from:
-
- * NEWS: - Some news
-
- * ext/standard/dir.c:
- - Fix bug Bug id #5987. It could be fixed by changing readdir.c but I
- - prefered not to touch that code but to treat windows a bit differently
- - in dir.c
- PR:
- Submitted by:
- Reviewed by:
- Obtained from:
-
-2001-04-29 Zeev Suraski <zeev@zend.com>
-
- * ext/pgsql/pgsql.c: Accept the fix suggestion from bug #9562
-
-2001-04-29 Derick Rethans <d.rethans@jdimedia.nl>
-
- * ext/standard/datetime.c: - 'Fix' for bug #10145
-
-2001-04-29 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * TODO-4.1.txt: Added not about 'thread-safing' all extensions for 4.1.
-
-2001-04-29 Sean Bright <elixer@erols.com>
-
- * ext/standard/string.c: Fix proto decription.
-
- * ext/standard/string.c: Really fix bug #10362.
-
-2001-04-29 Andi Gutmans <andi@zend.com>
-
- * main/main.c: - Update to work with latest Zend
- PR:
- Submitted by:
- Reviewed by:
- Obtained from:
-
-2001-04-29 Zeev Suraski <zeev@zend.com>
-
- * ext/mysql/php_mysql.c: whitespace fix
-
-2001-04-29 Jani Taskinen <sniper@iki.fi>
-
- * ext/fdf/config.m4: Fix bug #10545.
-
-2001-04-28 Sean Bright <elixer@erols.com>
-
- * ext/standard/string.c: Fix for bug #10362
-
-2001-04-28 Sterling Hughes <sterling@designmultimedia.com>
-
- * ext/curl/curl.c
- ext/curl/php_curl.h:
-
- * ext/curl/curl.c: fix bug #10541
-
-2001-04-28 James Moore <James@phpuk.org>
-
- * TODO-4.1.txt: Zend shallow copy needs to be fixed
-
-2001-04-28 Sascha Schumann <sascha@schumann.cx>
-
- * ext/ircg/ircg.c:
- also free the message, if the socket has already been marked as dead.
-
-2001-04-28 Daniel Beulshausen <daniel@php4win.de>
-
- * sapi/pi3web/php4pi3web.dsp
- win32/php4ts.dsw: add/fix pi3web dsp
-
-2001-04-28 Sascha Schumann <sascha@schumann.cx>
-
- * ext/ircg/ircg.c:
- free the message in msg_accum_send, if we recognize the connection
- as stale.
-
- * ext/ircg/ircg.c:
- ircg_mirc_color() does not use emalloc anymore to allocate strings,
- so ircg_html_encode() needs to copy the return value.
-
- * ext/ircg/ircg.c:
- Add some logic that deconnects a client, when it has been connected to
- the IRC server for longer than 20 seconds and if more than 50 messages
- have been queued up.
-
-2001-04-28 Sean Bright <elixer@erols.com>
-
- * ext/standard/exec.c:
- - Fix for bugs #9042, #8212, and #8962. Patch from <tunacat@yahoo.com>
- - Fixed proto for exec()
-
-2001-04-28 Sascha Schumann <sascha@schumann.cx>
-
- * ext/ircg/ircg.c: add some diagnostic output to phpinfo.
-
-2001-04-27 Daniel Beulshausen <daniel@php4win.de>
-
- * win32/install.txt: add notes about support directories
-
- * win32/install.txt: add instructions for Netscape/iPlanet servers
-
- * main/SAPI.c
- main/php.h
- main/win95nt.h
- NEWS: get rid of MS's _popen/_pclose
-
-2001-04-27 Derick Rethans <d.rethans@jdimedia.nl>
-
- * TODO-4.1.txt: - Added note about error messages
-
-2001-04-27 Sascha Schumann <sascha@schumann.cx>
-
- * main/reentrancy.c:
- Make old readdir_r code compatible with HPUX and Solaris.
-
-2001-04-27 Sterling Hughes <sterling@designmultimedia.com>
-
- * ext/xslt/README.XSLT-BACKENDS
- ext/xslt/php_xslt.h
- ext/xslt/sablot.c
- ext/xslt/xslt.c:
- Add the xslt_make_array and xslt_free_array api functions (C level).
- Change the naming to be a bit more standard for a few of the existing
- api functions.
-
- Make the sablotron backend compile with these changes.
-
-2001-04-26 Andi Gutmans <andi@zend.com>
-
- * tests/classes/class_example.phpt
- tests/classes/inheritance.phpt
- tests/lang/019.phpt
- tests/lang/022.phpt: - Convert cfunction -> function.
-
-2001-04-26 Hartmut Holzgraefe <hartmut@six.de>
-
- * ext/rtfm/rtfm.c: typo/thinko bug in mail address fixed
-
-2001-04-26 Sterling Hughes <sterling@designmultimedia.com>
-
- * ext/standard/fsock.c: MFH
-
-2001-04-26 Zeev Suraski <zeev@zend.com>
-
- * configure.in
- main/php_version.h: RC8
-
-2001-04-26 Sterling Hughes <sterling@designmultimedia.com>
-
- * ext/standard/fsock.c:
- fix for bug #8994, courtesy tom.anheyer@berlinonline.de
-
-
-2001-04-26 Stig Bakken <ssb@fast.no>
-
- * pear/XML/RPC/Server.php: typo :-) (thanks to Carlo Marcelo Arenas Belon)
-
-2001-04-26 Matt McClanahan <cardinal@dodds.net>
-
- * ext/mysql/php_mysql.c:
- Enforce the right number of params for mysql_fetch_*() functions, related to bug 9839.
-
-2001-04-26 Sterling Hughes <sterling@designmultimedia.com>
-
- * ext/xslt/README.XSLT-BACKENDS:
- Add a readme, this is a substitute to the e-mail I was going to send. it
- gives a basic overview of the new xslt extension and goes into the details
- of the api, etc.
-
-2001-04-26 Andi Gutmans <andi@zend.com>
-
- * ext/session/session.c:
- - use get_current_key_ex() in order to receive key length and not having
- - to use strlen() everywhere.
-
-2001-04-26 Sterling Hughes <sterling@designmultimedia.com>
-
- * ext/xslt/php_xslt.h
- ext/xslt/xslt.c: Add a free function to free the returned structure.
-
- * ext/xslt/php_xslt.h
- ext/xslt/xslt.c:
- Add the parse_xslt_arguments api function which parses sablotron type
- arguments into an easy to use structure.
-
-2001-04-26 Rasmus Lerdorf <rasmus@php.net>
-
- * NEWS: Take the blame for this one if it breaks something
-
-2001-04-26 Shane Caraveo <shane@php.net>
-
- * ext/session/session.c: compile was broken, new argument?
-
-2001-04-26 Sterling Hughes <sterling@designmultimedia.com>
-
- * ext/xslt/EXPERIMENTAL
- ext/xslt/Makefile.in
- ext/xslt/config.m4
- ext/xslt/php_sablot.h
- ext/xslt/php_xslt.h
- ext/xslt/sablot.c
- ext/xslt/tests/001.phpt
- ext/xslt/xslt.c:
- Add an experimental version of the new XSLT extension. This is by no means
- to be used on anything production, if you want to test it, beware, it may or
- may not work (feel free to complain to me if it doesn't work, or shower
- praise if it does work)...
-
- Mainly in PHP's CVS so that work on the other backends can take place.
- The api (function_entry) is what I'm thinking of for all backends. Every
- backend simply needs to define these functions, I'll send an e-mail describing
- all this in a bit....
-
-2001-04-25 Hartmut Holzgraefe <hartmut@six.de>
-
- * ext/rtfm/php_rtfm.h
- ext/rtfm/rtfm.c: added optional parameter functionname to rtfm()
-
-2001-04-25 Stig Bakken <ssb@fast.no>
-
- * main/main.c: * define PEAR_EXTENSION_DIR as well
-
-2001-04-25 Hartmut Holzgraefe <hartmut@six.de>
-
- * ext/skeleton/create_stubs: a backslash was missing (+ whitespace)
-
- * ext/rtfm/CREDITS: initial checkin
-
-2001-04-25 Derick Rethans <d.rethans@jdimedia.nl>
-
- * ext/rtfm/EXPERIMENTAL: - Marking this extension as EXPERIMENTAL
-
-2001-04-25 Rasmus Lerdorf <rasmus@php.net>
-
- * ext/standard/formatted_print.c: - Make the printf functions binary clean
- - Make the printf family of functions binary clean
-
-2001-04-25 Hartmut Holzgraefe <hartmut@six.de>
-
- * ext/rtfm/.cvsignore
- ext/rtfm/Makefile.in
- ext/rtfm/config.m4
- ext/rtfm/php_rtfm.h
- ext/rtfm/rtfm.c: guess what ... :)
-
- * ext/rtfm/tests/001.phpt: guess what ... :)
- cvs: ----------------------------------------------------------------------
-
-2001-04-25 Andrei Zmievski <andrei@ispi.net>
-
- * ext/wddx/php_wddx_api.h
- ext/wddx/wddx.c
- ext/standard/html.c
- ext/standard/html.h:
- * Made ENT_* defines availabe to other functions.
- * The key/variable names in WDDX are now html escaped to not break XML.
- - Fixed WDDX serialization to HTML-escape key/variable names so as not to
- break the XML packet.
-
-2001-04-25 Frank M. Kromann <frank@frontbase.com>
-
- * ext/fbsql/php_fbsql.c: Remove c++ comment
- Move errormessage when FBExec is not running. This error should not show if we connect through a port number.
-
- * pear/DB/fbsql.php:
- Fixing fetchInto to use the right constant and return ASSOC values.
-
- * ext/fbsql/php_fbsql.c: make fbsql_field_flags return a value
-
- * ext/fbsql/php_fbsql.h: removed unused code
-
-2001-04-25 Andy Sautins <asautins@veripost.net>
-
- * ext/oci8/oci8.c:
-
- Collections cleanup
- - Removed date specific methods. Dates work consistently with
- the rest of the oci8 code.
- - Removed unused variables from collection code.
- - RETURN_FALSE on all errors.
- - fix error prints to php_error.
-
- * ext/oci8/php_oci8.h:
-
- Cleanup collections - removed unused members from oci_collection structure
-
-2001-04-25 Sascha Schumann <sascha@schumann.cx>
-
- * ext/ircg/ircg.c: Fix format strings typo.
-
- * ext/ircg/ircg.c: display cache info
-
- * ext/ircg/ircg.c
- ext/ircg/ircg_scanner.c
- ext/ircg/ircg_scanner.re: Use the system malloc in the scanner
-
- * ext/ircg/ircg.c:
- Past profiling has shown that we waste too much time in the message
- scanner. In the context of a channel message which is supposedly
- addressed to a large number of users, we therefore cache the result
- of the operation and recycle it.
-
- * sapi/thttpd/thttpd.c:
- Fix optimization -- we did not send out custom Response Status Lines.
-
-2001-04-25 Andi Gutmans <andi@zend.com>
-
- * ext/standard/filestat.c: - Fix filetype() and lstat() too.
-
- * ext/standard/filestat.c: - Another fix
-
- * ext/standard/filestat.c:
- - Nuke warning. This signed/unsigned stuff gets really annoying sometimes.
-
- * ext/standard/filestat.c:
- - Fix problem with is_link(), there seem to be at least another couple of
- - bugs lurking around though.
- - Cleaned up code a bit and optimized it a bit too.
-
-2001-04-25 Thomas V.V.Cox <cox@idecnet.com>
-
- * pear/DB/ifx.php: every fetchmode != assoc defaults to ordered
-
- * pear/DB/STATUS: added "fetch absolute rows" extension status
-
-2001-04-24 Stig Bakken <ssb@fast.no>
-
- * TODO-4.1.txt: whoops, two less items for 4.1
-
-2001-04-24 Sterling Hughes <sterling@designmultimedia.com>
-
- * ext/curl/curl.c: Fixed a crash bug.
-
- Return the proper amount.
-
-2001-04-24 Chuck Hagenbuch <chuck@horde.org>
-
- * ext/imap/php_imap.c: MFH: fix crash bug in imap_sort (#9908).
-
-2001-04-24 Sascha Schumann <sascha@schumann.cx>
-
- * sapi/apache2filter/sapi_apache2.c:
- MFH: Accomodate Apache HTTPD 2.0 API change
-
- * sapi/apache2filter/sapi_apache2.c:
- Accomodate Apache HTTPD 2.0 API change
-
-2001-04-24 Thomas V.V.Cox <cox@idecnet.com>
-
- * pear/DB/ifx.php:
- don't return error on non-supported fetchmode (disturbs common::getAll)
-
- * pear/DB/common.php:
- -updated getXxx methods to use the DB_result interface, also some
- improvements in error checking and updated inline doc. From this moment
- fetchRow on DB_extentions is no longer needed.
-
-2001-04-24 Sascha Schumann <sascha@schumann.cx>
-
- * ext/ircg/php_ircg.h
- ext/ircg/ircg.c
- ext/ircg/ircg_scanner.c:
- Add support for suppressing the "loopback" of messages sent using ircg_msg.
-
- Add support for nickname escaping
-
- Using this technique it becomes possible to use nicknames like
- "John Doe" in the front-end. Scripts can use ircg_nickname_(un)escape.
- This should be applyable to channel names as well.
-
- A new flag character (2) is introduced which unescapes the respective
- argument.
-
- I.e. a format string could look like
-
- "%2f joins %c<script>parent.new_user('%12f','%1c')</script>"
-
- In the case of "G|27n|27R", this would be interpolated as:
-
- "G'n'R joins foobar<script>parent.new_user('G\'n\'R','foobar')</script>"
-
- I.e. %12f means "unescape the parameter and apply javascript escaping".
-
-2001-04-24 Ulf Wendel <ulf.wendel@phpdoc.de>
-
- * pear/Cache.php
- pear/Experimental/Cache/OutputCompression.php:
- Made Cache::save() a wrapper for Cache::extSave()
-
-2001-04-24 David Hedbor <david@hedbor.org>
-
- * sapi/caudium/caudium.c:
- Disable use of th_farm since it doesn't seem to work. Uses a Pike layer
- thread farm now instead.
-
-2001-04-23 Zeev Suraski <zeev@zend.com>
-
- * build/build2.mk: Remove unnecessary tab (was killing Tru64 make)
-
-2001-04-23 Chuck Hagenbuch <chuck@horde.org>
-
- * ext/imap/php_imap.c:
- Fix for bug 9908: check that the result of mail_sort is not 0 before trying
- to dereference the pointer. :)
-
- Also, free sort programs - this might have been a memory leak.
-
-2001-04-23 Colin Viebrock <colin@easydns.com>
-
- * pear/Crypt/CBC.php: use $this->raiseError instead ... thanks Stig
-
-2001-04-23 Ulf Wendel <ulf.wendel@phpdoc.de>
-
- * pear/Experimental/Image/color_helper.php
- pear/Experimental/Image/gbutton.php
- pear/Experimental/Image/gtext.php: whitespaces + some require_once
-
-2001-04-23 Colin Viebrock <colin@easydns.com>
-
- * pear/Crypt/CBC.php: use PEAR::raiseError now
-
-2001-04-23 Ulf Wendel <ulf.wendel@phpdoc.de>
-
- * pear/Experimental/Cache/OutputCompression.php:
- headers can be send even if there's already a setcookie() etc.
-
-2001-04-23 Frank M. Kromann <frank@frontbase.com>
-
- * main/config.w32.h
- main/php_ini.c: Fix build on WIn32
- Should the new directorys be static?
-
-2001-04-23 Thies C. Arntzen <thies@thieso.net>
-
- * ext/oci8/oci8.c: fixed ZTS buidl - still some WS pollution left
-
-2001-04-23 Jani Taskinen <sniper@iki.fi>
-
- * configure.in: Fixed bugs: #10194, #9177.
-
- * configure.in: MFH
-
-2001-04-23 Rasmus Lerdorf <rasmus@php.net>
-
- * configure.in: Uh, weird typo. Wonder when that crept in.
-
-2001-04-23 Jon Parise <jon@csh.rit.edu>
-
- * pear/Makefile.in: Updater.php -> Uploader.php
-
-2001-04-22 Sterling Hughes <sterling@designmultimedia.com>
-
- * ext/ccvs/ccvs.c: Fix bug #10447.
-
-2001-04-22 Christian Stocker <chregu@nomad.ch>
-
- * pear/Experimental/Cache/OutputCompression.php:
- - connection_timeout() seems not to exist anymore in php 4.0.5 (where did
- it go?
- - some typos fixed
-
-2001-04-22 Ulf Wendel <ulf.wendel@phpdoc.de>
-
- * pear/Experimental/Cache/OutputCompression.php:
- Added experimental class that deliveres compressed (gz) content to the client
-
- Although this code seems to be working Christian and I are not 100% satisfied
- with it. We're wondering if there's another API that requires less overriden
- methods, so we decided to put it into the Experimental directory requesting
- comments.
-
-2001-04-22 Sascha Schumann <sascha@schumann.cx>
-
- * ext/pcre/php_pcre.c: Fix freeing of a NULL pointer
-
-2001-04-22 Thomas V.V.Cox <cox@idecnet.com>
-
- * pear/DB/ifx.php
- pear/DB/msql.php:
- * msql.php
- - Added fetch row numbers
- - Fix fetchInto
- - Some other updates
-
- * ifx.php
- small clean up
-
-2001-04-22 Sascha Schumann <sascha@schumann.cx>
-
- * ext/ircg/config.m4
- ext/ircg/ircg.c
- ext/ircg/php_ircg.h:
- MFH allocation-related and thttpd-independence changes
-
- * sapi/thttpd/thttpd_patch: remove Only.* lines from patch
-
- * sapi/thttpd/thttpd.c
- sapi/thttpd/thttpd_patch:
- Merge thttpd-2.21-related changes into 4.0.5 branch
-
- * sapi/thttpd/thttpd.c:
- bytes in the conn structure was renamed to bytes_sent.
-
- * sapi/thttpd/thttpd_patch: Update patch to thttpd-2.21
-
-2001-04-22 Harald Radi <h.radi@nme.at>
-
- * win32/php4dllts.dsp: added ext/com/com.h to PHP_4_0_5 branch
-
- * php.ini-dist
- php.ini-optimized: merged [com] section from main branch
-
- * ext/com/COM.c
- ext/com/com.h
- ext/com/php_COM.h
- ext/com/typedef_VARIANT.c:
- merging changes from main branch to fix a memory leak
-
-2001-04-22 Stig Bakken <ssb@fast.no>
-
- * pear/PEAR/Common.php
- pear/PEAR/Uploader.php: * fixed PEAR_Common::infoFromDescriptionFile
-
- * configure.in:
- * don't override $libdir and $datadir if they are specified on the
- commandline
-
- * pear/DB/tests/db_error.phpt
- pear/DB/tests/db_error2.phpt
- pear/DB/tests/db_parsedsn.phpt
- pear/PEAR/Common.php
- pear/PEAR/Installer.php
- pear/PEAR/Uploader.php
- pear/XML/tests/002.phpt
- pear/XML/tests/003.phpt
- pear/XML/tests/005.phpt
- pear/tests/pear_error.phpt
- ext/standard/info.c
- main/build-defs.h.in
- main/main.c
- main/php_ini.c
- pear/.cvsignore
- pear/Makefile.in
- pear/PEAR.php
- pear/PEAR.php.in
- Makefile.in
- configure.in
- footer:
- * expanded the following constants and made them available in PHP:
- DEFAULT_INCLUDE_PATH
- PEAR_INSTALL_DIR
- PHP_EXTENSION_DIR
- PHP_BINDIR
- PHP_LIBDIR
- PHP_DATADIR
- PHP_SYSCONFDIR
- PHP_LOCALSTATEDIR
- PHP_CONFIG_FILE_PATH
- * no longer generating pear/PEAR.php
- * fixed some tests
- * some more installer work
-
-2001-04-21 Andi Gutmans <andi@zend.com>
-
- * main/php_ini.c: - Get rid of warning.
-
-2001-04-20 Andrei Zmievski <andrei@ispi.net>
-
- * NEWS: Let people know what the heck I was up to.
-
- * ext/wddx/config.m4
- ext/wddx/setup.stub: Enabling WDDX by default.
-
- * NEWS: That made it into 4.0.5.
-
- * NEWS: This actually made it in.
-
-2001-04-20 Jani Taskinen <sniper@iki.fi>
-
- * ext/standard/image.c: ws pollution removed.
-
-2001-04-20 Thomas V.V.Cox <cox@idecnet.com>
-
- * pear/DB/common.php:
- fix getRow free result
-
-2001-04-20 Stig Bakken <ssb@fast.no>
-
- * pear/PEAR/Packager.php: * update class doc-comment
-
- * pear/XML/RPC.php
- pear/XML/RPC/Server.php:
- * made XML_RPC "include-from-within-a-function" safe
-
- * pear/Makefile.in
- pear/XML/RPC.php
- pear/XML/RPC/Server.php:
- * fixed up the XML-RPC class so it's useful at least (based on usefulinc 1b8)
-
- * pear/DB/STATUS: * added Frank's fbsql backend to status list
-
-2001-04-20 Frank M. Kromann <frank@frontbase.com>
-
- * pear/DB/fbsql.php: Apply coding standard. Replace tab's with 4 spaces.
-
-2001-04-19 Thomas V.V.Cox <cox@idecnet.com>
-
- * pear/DB.php:
- fix small bug on error reporting (PEAR::raiseError params order)
-
-2001-04-19 Frank M. Kromann <frank@frontbase.com>
-
- * pear/DB/MAINTAINERS
- pear/DB/fbsql.php: Adding FrontBase support to pear/DB
-
-2001-04-19 Jason Greene <jason@inetgurus.net>
-
- * ext/oci8/oci8.c: Change all // to /* */, fixed small whitespace.
- Builds on Solaris now.
-
-2001-04-19 Stig Bakken <ssb@fast.no>
-
- * pear/DB.php
- pear/DB/common.php:
- * fixed DB_common::getXxx when using the parameter array (didn't work before)
-
-2001-04-19 Andi Gutmans <andi@zend.com>
-
- * ext/odbc/php_odbc.c:
- - Use memcpy() instead of strlcpy() which is faster.
-
-2001-04-19 Dan Kalowsky <dank@deadmime.org>
-
- * ext/odbc/php_odbc.c:
- appling patch for joey since he has no ODBC karma. this is for bug #10252
-
-2001-04-19 Sterling Hughes <sterling@designmultimedia.com>
-
- * ext/sablot/sablot.c: fix crash bug 10400.
-
-2001-04-19 Wez Furlong <wez.php@thebrainroom.com>
-
- * ext/gd/config.m4:
- Patch from Adam Dickmeiss to make configure detect libtff again.
-
-2001-04-19 Stig Bakken <ssb@fast.no>
-
- * pear/PEAR.php.in: * cotcha, Tomas
-
-2001-04-19 Ulf Wendel <ulf.wendel@phpdoc.de>
-
- * pear/Cache/Container/db.php
- pear/Cache/Container/dbx.php
- pear/Cache/Container/file.php
- pear/Cache/Container/phplib.php
- pear/Cache.php: - fixed the garbage collection
- Added some kind of LRU to delete all entries older than n seconds.
- This fixes the bug that cache entries with lifetime 0 (endless) never
- got removed although if they are no longer used. What's still missing
- is some space limit for cache data.
-
-2001-04-19 Andi Gutmans <andi@zend.com>
-
- * ext/odbc/php_odbc.c: - \r\n -> \n
-
- * ext/iconv/iconv.c: - WS
-
-2001-04-19 Stig Bakken <ssb@fast.no>
-
- * pear/tests/pear_error.phpt: * forgot to update this test too
-
- * pear/DB/tests/db_error.phpt: * forgot to update this test
-
- * pear/DB/common.php
- pear/DB/mysql.php
- pear/DB/oci8.php
- pear/DB/pgsql.php
- pear/DB/storage.php
- pear/DB/sybase.php
- pear/DB/tests/db_error.phpt
- pear/DB/tests/db_error2.phpt
- pear/DB/tests/db_parsedsn.phpt
- pear/tests/pear_error.phpt:
- * DB_common now inherits PEAR and its error handling stuff
- * DB_common::raiseError is now just a wrapper for PEAR::raiseError
- * fixed some cast warnings in prepare/execute
- * updated tests
-
- * pear/PEAR.php.in: * check that error callbacks exist
-
- * pear/DB.php: * added Colin's connect/factory error reporting fix
-
-2001-04-19 Dan Kalowsky <dank@deadmime.org>
-
- * ext/odbc/php_odbc.c:
- corrects bug #7488, patch supplied by submitter (torben@php.net).
- quick local tests show it to work.
-
-2001-04-18 Stig Bakken <ssb@fast.no>
-
- * pear/DB.php: * fix handling of broken DSNs like Colin suggested
-
-2001-04-18 Derick Rethans <d.rethans@jdimedia.nl>
-
- * ext/mcrypt/mcrypt.c: - MFH (bug #8839 again)
-
- * ext/mcrypt/mcrypt.c:
- - Fixed some more problems with keys being chopped off (fix for bug #8839)
-
-2001-04-18 Adam Dickmeiss <adam@indexdata.dk>
-
- * ext/yaz/php_yaz.c:
- Function yaz_record returns database for record if type is "database".
-
-2001-04-18 Marc Boeren <M.Boeren@guidance.nl>
-
- * ext/dbx/dbx_pgsql.c: Removed some old commented code (Mc)
-
- * ext/dbx/dbx.c
- ext/dbx/dbx.h:
- Added DBX_CMP_TEXT and DBX_CMP_NUMBER constants and support for them in
- the dbx_cmp_desc and dbx_cmp_asc functions. The old method of passing a
- string "number" is now no longer valid. (Mc)
-
-2001-04-18 Sascha Schumann <sascha@schumann.cx>
-
- * ext/ircg/ircg.c
- ext/ircg/php_ircg.h:
- Support notice which should be used to query bots etc.
-
-2001-04-18 Wez Furlong <wez.php@thebrainroom.com>
-
- * README.STREAMS: Information about php streams
-
-2001-04-18 Derick Rethans <d.rethans@jdimedia.nl>
-
- * ext/mcrypt/mcrypt.c: - MFH (Bug #8839)
-
-2001-04-17 Sascha Schumann <sascha@schumann.cx>
-
- * ext/ircg/ircg.c:
- Allocate memory for js escaped strings using the C library's malloc.
-
-2001-04-17 Alexander Feldman <alex@zend.com>
-
- * ext/standard/file.c:
- Merged the patch of the buffering patch as it fixes a pretty major bug.
-
-2001-04-17 Ulf Wendel <ulf.wendel@phpdoc.de>
-
- * pear/PHPDoc/parser/PhpdocParserCore.php:
- Patch requested by chuckc@sonic.net (Chuck Clayton) to keep linebreaks.
-
- * pear/PHPDoc/renderer/html/PhpdocHTMLDocumentRenderer.php:
- Applied a bugfix provided by Joerg.Wedekind@OnVista.de.
-
-2001-04-17 Frank M. Kromann <frank@frontbase.com>
-
- * ext/fbsql/php_fbsql.c
- ext/fbsql/php_fbsql.h: Adding fbsql_fetch_assoc() functon
-
-2001-04-17 Wez Furlong <wez.php@thebrainroom.com>
-
- * ext/standard/basic_functions.c
- ext/standard/file.c: Discovered warn_not_available and used it.
-
- * ext/standard/basic_functions.c
- ext/standard/file.c
- ext/standard/file.h
- ext/standard/fsock.c
- ext/standard/fsock.h
- ext/standard/info.c:
- Changes for streams. Added temporary fopenstream function to PHP so that
- the streams can be tested.
-
- * main/Makefile.in
- main/php.h
- main/php_streams.h
- main/streams.c: Added files for PHP streams
-
- * configure.in:
- Added --enable-php-streams option for experimental file abstraction
-
-2001-04-17 Stig Bakken <ssb@fast.no>
-
- * pear/PEAR/Installer.php
- pear/PEAR/Packager.php
- pear/scripts/pear.in:
- * PEAR_Installer un-broken again, it still doesn't update the
- package list though
- * better error handling in "pear" script
-
-2001-04-17 Dan Kalowsky <dank@deadmime.org>
-
- * ext/odbc/php_odbc.c:
- This change seems to fix bugs 7158, 7807, 8531, and 8636. After asking why this patch was applied no one seemed to respond with anything useful. If you find this change in error, sorry, I tested it on as many systems as I could.
-
-2001-04-17 Stig Bakken <ssb@fast.no>
-
- * pear/tests/pear_error.phpt
- pear/.cvsignore
- pear/DB.php
- pear/PEAR.php.in: * have DB.php use PEAR::raiseError in factory methods
-
- * pear/PEAR.php.in: * enable static use of PEAR::raiseError
-
- * pear/PEAR/Installer.php
- pear/PEAR/Packager.php
- pear/scripts/pear.in
- pear/PEAR.php.in:
- * implemented PEAR_Packager to make distribution packages. Currently only
- runs on platforms with GNU tar installed
- * the "pear" script now requires a command parameter (similar to cvs),
- for example "pear package Cache.xml"
- * broke PEAR_Installer :-)
-
-2001-04-17 Wez Furlong <wez.php@thebrainroom.com>
-
- * ext/gd/config.m4:
- Fixed lame attempt to prevent ttf linkage when using freetype2
-
-2001-04-16 Stig Bakken <ssb@fast.no>
-
- * build/rules.mk
- run-tests.php:
- * using CGI -C option, you no longer have to specify "full" path to tests
-
- * main/SAPI.h
- main/fopen_wrappers.c
- sapi/cgi/cgi_main.c:
- Added -C command-line option to avoid chdir to the script's directory
-
-2001-04-16 Thomas V.V.Cox <cox@idecnet.com>
-
- * pear/DB/mssql.php: - Remove extra checks in connect
- - move fetchrow to use fetchInto
- - fix fetchInto to return null on no more rows instead of an error
- - Add fetch arbitrary row numbers feature to fetchInto
- - spaces
-
-2001-04-16 Stig Bakken <ssb@fast.no>
-
- * pear/XML/Parser.php: * use raiseError
-
- * pear/DB.php
- pear/DB/tests/db_ismanip.phpt:
- * DB::isManip now handles create, drop, alter, grant, revoke.
-
- * pear/XML/Parser.php: * store source/target encoding in the object
-
- * pear/XML/Parser.php:
- * added a third parameter to constructor to let you specify target encoding
-
- * pear/DB/storage.php: * some cleanups and doc-comments
- * added support for multi-column primary keys
-
- * pear/DB/common.php: * added "debug" option
-
- * pear/PEAR.php.in
- pear/tests/pear_error.phpt:
- * make the error class used by raiseError configurable (_error_class property,
- overridden by first parameter to constructor)
-
- * pear/DB.php: * actually commit the stuff I said I had committed :-)
-
-2001-04-16 Frank M. Kromann <frank@frontbase.com>
-
- * ext/fbsql/php_fbsql.c: Fixing memory leek on CancelFetch.
-
-2001-04-16 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * TODO: Daniel fixed this for PHP 4.0.6.
-
-2001-04-16 Andrei Zmievski <andrei@ispi.net>
-
- * TODO-4.1.txt: More todo stuff.
-
-2001-04-16 James Moore <James@phpuk.org>
-
- * win32/install.txt:
- - Updating order slighly so the install is easier to follow.
-
-2001-04-16 Stig Bakken <ssb@fast.no>
-
- * pear/XML/Parser.php:
- * changed first parameter to constructor to "null" by default (instead
- of "UTF-8"), this will use the document-specified encoding
-
-2001-04-16 Andrei Zmievski <andrei@ispi.net>
-
- * ext/pcre/php_pcre.c:
- - Fixed a bug with /e modifier in preg_replace(), that would not correctly
- replace two-digit references if single digit references were present
- before them. This fixed bug #10218.
-
-2001-04-16 Sascha Schumann <sascha@schumann.cx>
-
- * ext/ircg/ircg.c: Add support for banlists
-
-2001-04-15 Stig Bakken <ssb@fast.no>
-
- * pear/catalog: * added sgml/xml catalog file
-
- * pear/package.dtd: * add a package type called empty (default)
-
-2001-04-15 Alexander Feldman <alex@zend.com>
-
- * ext/standard/file.c: Fixed typo.
-
- * ext/standard/file.c:
- We shoud not fseek in a pipe and this caused a problem with popen and
- fgets on the platforms where the buffer fix was applied (Solaris, FreeBSD).
- Now the fseek is done only when the handle is of type fopen.
-
-2001-04-14 Stig Bakken <ssb@fast.no>
-
- * pear/DB/mysql.php:
- * ini_restore called before any returns (thanks to Markus Fischer)
-
-2001-04-14 Sascha Schumann <sascha@schumann.cx>
-
- * ext/ircg/config.m4
- ext/ircg/ircg.c: Make it possible to build ircg without thttpd
-
-2001-04-14 Thomas V.V.Cox <cox@idecnet.com>
-
- * pear/DB/mysql.php:
- - myslRaiseError now fills the native error parm of DB_Error obj
- - style: replace " with '
-
-2001-04-14 Rui Hirokawa <louis@cityfujisawa.ne.jp>
-
- * ext/dbx/dbx_pgsql.c
- ext/pgsql/pgsql.c: deleted warning output in dbx/pgsql.
-
-2001-04-14 Thies C. Arntzen <thies@thieso.net>
-
- * TODO-4.1.txt: .
-
- * ext/oci8/config.m4
- ext/oci8/oci8.c
- ext/oci8/oci8.dsp: enable temporary LOBs when we detect oracle 8.1
- enabled by default in Win32 project!
-
- * ext/oci8/CREDITS
- ext/oci8/oci8.c:
- - Added temporary LOB support in OCI8 (Patch by David Benson)
-
- * ext/oci8/CREDITS:
- the collections stuff s worth mentioning in the credits!
-
-2001-04-14 Stig Bakken <ssb@fast.no>
-
- * pear/DB/mysql.php: typo
-
-2001-04-14 Wez Furlong <wez.php@thebrainroom.com>
-
- * NEWS: Added news about gd and openssl changes.
-
- * ext/gd/config.m4:
- When using freetype2, turn off libttf and turn on native gd ttf.
-
-2001-04-13 Derick Rethans <d.rethans@jdimedia.nl>
-
- * TODO-4.1.txt: - Added the note about function names
-
-2001-04-13 Stig Bakken <ssb@fast.no>
-
- * ChangeLog.1999.gz
- ChangeLog.2000.gz:
- * separated and compressed changelogs from 1999 and 2000
-
- * pear/tests/pear1.phpt
- pear/PEAR.php.in:
- * PEAR: look for destructor methods in parent classes if
- the current class does not have one
-
- * pear/DB/mysql.php:
- * better error message on failed connect, suggested by Thomas V.V.Cox
-
- * TODO-4.1.txt: here's a preliminary list of stuff for 4.1
-
-2001-04-13 Thies C. Arntzen <thies@thieso.net>
-
- * ext/standard/string.c: - Fixed crash in pathinfo()
-
- * ext/oci8/oci8.c
- ext/oci8/php_oci8.h: - OCI8 now supports binding of collections
- (Patch by Andy Sautins <asautins@veripost.net>)
-
-2001-04-13 Wez Furlong <wez.php@thebrainroom.com>
-
- * ext/gd/config.m4
- ext/gd/gd.c
- ext/gd/php_gd.h: Added GD 2.0.1 support.
-
-2001-04-12 Chuck Hagenbuch <chuck@horde.org>
-
- * pear/HTML/Select.php:
- move the selected logic back to the toHtml() method so that you can add
- selected values after adding the options.
-
- * pear/HTML/Select.php:
- simplify the toHtml() loop, use foreach() instead of for(), and move the
- logic around selected attributes to the addOption() method.
-
- * pear/HTML/Select.php: - run option labels through htmlentities()
- - update the API version
- - a few more style and xHTML compliance fixes.
-
- * pear/HTML/Common.php:
- xHTML compliance, and run attribute values through htmlentities().
-
- * pear/HTML/Select.php: A bit of style, and:
-
- - made HTML more compact/production quality - remove unnecesary comments and
- whitespace.
- - added a method for using a flat array (array('foo', 'bar')) as both the
- keys and values of the select.
- - include DB.php conditionally, so it's not loaded when not needed.
-
-2001-04-11 Thies C. Arntzen <thies@thieso.net>
-
- * ext/oci8/oci8.c: MFH - never initialize OCI in OCI_THREADED mode
-
- * ext/oci8/oci8.c:
- never initialize oci in OCI_THREADED mode. seems to break win32.
-
-2001-04-11 Marc Boeren <M.Boeren@guidance.nl>
-
- * ext/dbx/dbx.c
- ext/dbx/dbx_mysql.c
- ext/dbx/dbx_mysql.h
- ext/dbx/dbx_odbc.c
- ext/dbx/dbx_odbc.h
- ext/dbx/dbx_pgsql.c
- ext/dbx/dbx_pgsql.h
- ext/dbx/php_dbx.h:
- Added a database member to the dbx_link object. Since e.g. mysql reuses
- connections, two or more dbx_link objects may share the connection
- identifier. The database name is used in the dbx_query, where it calls
- mysql_db_query instead of mysql_query.
- This means the database name has to be passed around to all dbx_xxx_query
- functions, hence the update on all the files. (Mc)
-
-2001-04-10 Jason Greene <jason@inetgurus.net>
-
- * ext/sockets/sockets.c: MFH, I have tested this thoroughly.
-
-2001-04-10 Frank M. Kromann <frank@frontbase.com>
-
- * ext/fbsql/php_fbsql.c: Fixing database password to actually work
-
-2001-04-10 Jon Parise <jon@csh.rit.edu>
-
- * ext/imap/config.m4: Statements end with a period.
-
-2001-04-10 Kevin N Shallow <sourjan@yahoo.com>
-
- * ext/odbc/php_odbc.h
- ext/odbc/Makefile.in
- ext/odbc/config.m4
- ext/odbc/php_odbc.c:
- Fixed compatibility issues in the ODBC extension for the Velocis Database server. Specifically, config.m4 was changed to use the client libraries instead of the serer libraries, and to look for the libs in the $RDSHOME/lin directory ass opposed to the $RDSHOME/bin directory. Makefile.in was changed to use the php_odbc.c file as the source for Velocis support. Other misc changes include a few #defines for some undefined data types and some #ifdefs for unsupported functions.
-
-2001-04-10 Martin Jansen <mail@martin-jansen.de>
-
- * pear/DB/common.php: fixed typo in inline docs
-
-2001-04-10 Jason Greene <jason@inetgurus.net>
-
- * ext/sockets/sockets.c: Fix for PR #9729, 9664, 9656, 8667.
- All compilers on Solaris should build this extension correctly now.
- It turns out the SUN CC, by default, enables a define that enables the use of
- and gcc wouldn't.
-
- -Jason
-
-2001-04-10 Derick Rethans <d.rethans@jdimedia.nl>
-
- * ext/mcrypt/mcrypt.c: - Removed debug thing
-
- * ext/mcrypt/mcrypt.c: - Fix for bug #8839
- - MINFO updated to use smart_str's
-
-2001-04-09 Sean Bright <elixer@erols.com>
-
- * ext/standard/dir.c: Constand should be case sensitive.
-
-2001-04-09 Jon Parise <jon@csh.rit.edu>
-
- * ext/standard/dir.c: Fix whitespace (use tabs).
-
-2001-04-09 Sean Bright <elixer@erols.com>
-
- * ext/standard/dir.c:
- Stop SIGSEGV on Apache startup. Patch from <adam@indexdata.dk>
-
-2001-04-09 Jani Taskinen <sniper@iki.fi>
-
- * ext/oracle/config.m4: MFH
-
-2001-04-09 Sascha Schumann <sascha@schumann.cx>
-
- * sapi/cgi/config.m4
- pear/PEAR.php.in
- sapi/Makefile.in
- main/build-defs.h.in
- Makefile.in
- configure.in: Revert mega patch.
-
- This patch has at least the following deficiences:
-
- - the CGI is built using objects from another SAPI module.
- This usually results in unsatisfied symbol references.
- - the CGI makefile is not created properly
- - building CGI cannot be disabled
-
-2001-04-09 Jani Taskinen <sniper@iki.fi>
-
- * ext/oracle/config.m4: Fix bug #10212.
-
-2001-04-09 Rasmus Lerdorf <rasmus@php.net>
-
- * ext/standard/formatted_print.c
- tests/strings/002.phpt
- NEWS: printf argnum (parameter swapping) support from Morten Poulsen
-
-2001-04-09 Marc Boeren <M.Boeren@guidance.nl>
-
- * ext/dbx/dbx.c:
- Added optional 'comparison_type' parameter to compare functions, to force
- either text or number comparison. (Mc)
-
-2001-04-09 Uwe Steinmann <Uwe.Steinmann@fernuni-hagen.de>
-
- * ext/domxml/php_domxml.c
- ext/domxml/php_domxml.h:
- - added domxml_version() to retrieve version of libxml
-
-2001-04-09 Sascha Schumann <sascha@schumann.cx>
-
- * configure.in: Fix current CVS breakage
-
-2001-04-08 Stig Bakken <ssb@fast.no>
-
- * main/build-defs.h.in
- pear/PEAR.php.in
- sapi/Makefile.in
- sapi/cgi/config.m4
- Makefile.in
- configure.in: * CGI version is always installed!
- * replaced --disable-pear with --with-pear=DIR (or --without-pear),
- is backwards compatible
- * use --datadir, --libdir and --sysconfdir configure options to determine
- where PEAR files, shared extensions and php.ini goes
- * simplified the extension version directory name
-
- * ext/standard/dir.c:
- Add DIRECTORY_SEPARATOR constant ('/' on UNIX, '\' on Windows)
-
-2001-04-08 Holger Zimmermann <zimpel@t-online.de>
-
- * sapi/pi3web/php4pi3web.dsp:
- Contribute the MSVC project file. Someone could add this to the php4ts workspace.
-
- * sapi/pi3web/pi3web_sapi.c
- sapi/pi3web/pi3web_sapi.h: Reorganized the #define's in the header.
-
- * sapi/pi3web/pi3web_sapi.c:
- Updated copyright agreement regarding move of Pi3Web to sourceforge.
-
-2001-04-08 Stig Bakken <ssb@fast.no>
-
- * pear/XML/RPC.php: * globals fixes
-
- * pear/XML/Parser.php: * indentation and inline doc fixes
-
- * pear/HTML/Processor.php:
- * using GLOBALS to set global variable (in case the file is included
- from within a function)
-
-2001-04-08 Jon Parise <jon@csh.rit.edu>
-
- * ext/imap/php_imap.c: Use tabs instead of spaces.
-
-2001-04-07 Jani Taskinen <sniper@iki.fi>
-
- * ext/standard/file.c: ws pollution removed.
-
-2001-04-07 Jon Parise <jon@csh.rit.edu>
-
- * ext/yp/yp.c:
- Fix compilation (strict compilers require constant initializers).
-
-2001-04-07 André Langhorst <A.Langhorst@itbnet.de>
-
- * ext/standard/basic_functions.c: fix proto
-
-2001-04-07 Jani Taskinen <sniper@iki.fi>
-
- * ext/fdf/fdf.c: fixed protos
-
-2001-04-06 Jani Taskinen <sniper@iki.fi>
-
- * ext/fdf/fdf.c
- ext/fdf/php_fdf.h: Fixed some bugs.
-
- * ext/gd/gd.c
- ext/gd/php_gd.h: Killed some compile warnings.
-
-2001-04-06 Sean Bright <elixer@erols.com>
-
- * ext/skeleton/skeleton.c: Fixed possible overflow again.
-
-2001-04-06 Jon Parise <jon@csh.rit.edu>
-
- * php.ini-dist: Comment out the 'include_path' variable by default.
-
-
- * ext/skeleton/skeleton.c: Make this message more grammatically correct.
-
- * configure.in: Fix expansion of PEAR_INSTALLDIR.
-
-2001-04-06 Jani Taskinen <sniper@iki.fi>
-
- * main/main.c: Support also old arg_separator directive.
-
-2001-04-06 Sean Bright <elixer@erols.com>
-
- * ext/skeleton/skeleton.c: Fixed possible overflow.
-
-2001-04-06 Christian Stocker <chregu@nomad.ch>
-
- * pear/Experimental/XML/sql2xml.php:
- - Row and result Tag names are now configurable
- - some errorchecking
-
-2001-04-06 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * pear/Cache/URL.php: Initial checkin of URL Cache.
-
-2001-04-06 Jani Taskinen <sniper@iki.fi>
-
- * NEWS
- ext/standard/url_scanner.c
- ext/standard/url_scanner_ex.c
- ext/standard/url_scanner_ex.re
- main/main.c
- main/php_globals.h
- main/php_variables.c
- php.ini-dist
- php.ini-optimized: MFH
-
- * main/php_variables.c: fixed typo in CVS id
-
-2001-04-05 Jani Taskinen <sniper@iki.fi>
-
- * ext/standard/crypt.c: spaces to tabs
-
-2001-04-05 Andi Gutmans <andi@zend.com>
-
- * README.BCMATH: - Nuke README.BCMATH
-
- * README.BCMATH: Remove README.BCMATH
-
-2001-04-05 Daniel Beulshausen <daniel@php4win.de>
-
- * EXTENSIONS
- php.ini-dist
- php.ini-optimized: add printer ext to php.ini & maintain extensions file
-
- * ext/printer/php_printer.h
- ext/printer/printer.c
- ext/printer/printer.php: overhaul printer extension
-
-2001-04-05 Romolo Manfredini <romolo@bicnet.it>
-
- * ext/pgsql/pgsql.c: pg_close not closing right connection.
-
-2001-04-05 Sascha Schumann <sascha@schumann.cx>
-
- * sapi/apache/libphp4.module.in:
- Fix static Apache builds which were broken by the last commit.
-
-2001-04-05 Wez Furlong <wez.php@thebrainroom.com>
-
- * ext/openssl/openssl.c: Fix for Bug #10168 (is_dst undeclared)
-
-2001-04-05 Jani Taskinen <sniper@iki.fi>
-
- * ext/fdf/fdf.c: Fix bugs: #10157, #7549
-
-2001-04-04 Thomas V.V.Cox <cox@idecnet.com>
-
- * pear/DB/pgsql.php:
- as the row counter starts with 0, last row is before numrows
-
-2001-04-04 Thies C. Arntzen <thies@thieso.net>
-
- * ext/pgsql/pgsql.c
- ext/pgsql/php_pgsql.h: MFH - make postgresql compiel against 6.5.x
-
- * ext/pgsql/pgsql.c
- ext/pgsql/php_pgsql.h: make it compile with 6.5.x
- postgresql notices are now send to the standard error-log
-
-2001-04-04 Jani Taskinen <sniper@iki.fi>
-
- * main/php_version.h
- configure.in: This branch is 4.0.6-dev..
-
- * ext/standard/url_scanner.c
- ext/standard/url_scanner_ex.c
- ext/standard/url_scanner_ex.re
- main/main.c
- main/php_globals.h
- main/php_variables.c
- NEWS
- php.ini-dist
- php.ini-optimized: Added new configuration directives:
- arg_separator.input and arg_separator.output
-
-2001-04-04 Frank M. Kromann <frank@frontbase.com>
-
- * ext/fbsql/php_fbsql.c
- ext/fbsql/php_fbsql.h: Adding empty RSHUTDOWN function.
-
-2001-04-04 Jani Taskinen <sniper@iki.fi>
-
- * ext/crack/crack.c: Killed 2 compile warnings.
-
-2001-04-04 Christian Stocker <chregu@nomad.ch>
-
- * pear/Experimental/XML/sql2xml.php:
- - new function addArray() for adding Arrays to the xml
- - new function addSql() for providing sql-strings as input
- - constructor takes a dsn or a pear::db object as param (API-Change..)
- - a lot of inline-documentation (not finished...)
-
-2001-04-04 Jason Greene <jason@inetgurus.net>
-
- * build/buildcheck.sh:
- This is a temporary fix to the previous patch that breaks the build.
- This keeps the functionality of searching for glibtool or libtool,
- but have you checked the rest of the build process to see if this is
- compatible? Regardless, 'which' returns a value on some os's when nothing is
- found which breaks the previous patches test. Also the unary negation after
- an if is not compatible with true bourne.
-
- -Jason
-
-2001-04-04 Jani Taskinen <sniper@iki.fi>
-
- * main/php_variables.c: Cookies use ; as argument separator.
-
- * ext/sockets/config.m4:
- Cleaned up a bit. Removed some checks for header files that are
- already checked in configure.in
-
-2001-04-03 Wilfredo Sanchez <wsanchez@mit.edu>
-
- * sapi/apache/apMakefile.tmpl
- sapi/apache/libphp4.module.in
- sapi/thttpd/config.m4
- ext/msql/config.m4
- ext/odbc/config.m4
- ext/bcmath/libbcmath/src/Makefile.am
- ext/informix/config.m4: Separate CPPFLAGS from CFLAGS.
-
-2001-04-03 Daniel Beulshausen <daniel@php4win.de>
-
- * ext/exif/exif.c: use VCWD_STAT
-
- * ext/exif/exif.c: resolve realpath if in v-dir mode
-
-2001-04-03 Wilfredo Sanchez <wsanchez@mit.edu>
-
- * build/build.mk: Undo oopsie
-
- * sapi/pi3web/config.m4
- sapi/nsapi/config.m4
- sapi/phttpd/config.m4
- sapi/isapi/config.m4
- sapi/aolserver/config.m4
- sapi/apache/config.m4
- sapi/cgi/config.m4
- build/build.mk
- ext/java/config.m4
- pear/Makefile.in
- Makefile.in
- configure.in: Add INSTALL_ROOT variable to specify install location.
-
-2001-04-03 Sascha Schumann <sascha@schumann.cx>
-
- * ext/ircg/ircg.c:
- ircg_ignore_del returns true now, if the operation was successful.
-
- * ext/ircg/ircg.c
- ext/ircg/php_ircg.h: add ignore interface
-
-2001-04-03 Wilfredo Sanchez <wsanchez@mit.edu>
-
- * build/buildcheck.sh: Find libtool if it's called glibtool.
-
-2001-04-03 Frank M. Kromann <frank@frontbase.com>
-
- * ext/fbsql/php_fbsql.c: Fixing crash when listing databsaes
- Fixing rowcount to woirk when the result contains an array og data.
-
-2001-04-03 Jani Taskinen <sniper@iki.fi>
-
- * ext/standard/filestat.c:
- SCO (and maybe others) do not have this defined.
-
-2001-04-03 Jon Parise <jon@csh.rit.edu>
-
- * pear/DB/pgsql.php: Style and whitespace.
-
- * pear/DB/pgsql.php: Make the 'protocol' DSN element optional.
-
- * pear/PEAR.php.in: Cleaner (and probably safer) condition handling.
-
-2001-04-03 Thomas V.V.Cox <cox@idecnet.com>
-
- * pear/DB/odbc.php
- pear/DB/sybase.php:
- odbc.php
- - spaces & idents
- - new temporary fetchInto()
- - removed extra checks in connect()
- Note:
- in fetchRow this line looks very strange (isn't 3 params?):
- $cols = odbc_fetch_into($result, &$row);
-
- sybase.php
- - spaces & idents
- - removed extra checks in connect()
- - changed fetchInto to return null on no more rows and
- added support for fetching row numbers
-
-2001-04-02 Wez Furlong <wez.php@thebrainroom.com>
-
- * ext/openssl/openssl.c:
- changed the flags parameters to be a bitfield + constants (I don't know what
- I was thinking!). Added a couple of extra parameters so that the equivalent
- functionality of the openssl smime command can be pretty much used in full.
- Added some more error reporting.
-
-2001-04-02 Andi Gutmans <andi@zend.com>
-
- * configure.in
- main/php_version.h: - RC6
-
-2001-04-02 Anil Madhavapeddy <anil@recoil.org>
-
- * ext/zlib/zlib.c: MFH, rev 1.77
-
- * ext/standard/output.c: MFH, rev 1.53
-
- * ext/standard/output.c:
- Free the correct output buffer, to avoid a segfault on a HEAD request
- when using output buffering with a custom handler (patch by zeev@)
-
-2001-04-02 James Moore <James@phpuk.org>
-
- * ext/standard/mail.c: remove rogue ZEND_GET_MODULE()
-
-2001-04-02 Andrei Zmievski <andrei@ispi.net>
-
- * ext/standard/array.c: MFH
-
-2001-04-02 Nick Gorham <nick@easysoft.com>
-
- * ext/odbc/php_odbc.c
- NEWS:
- Added small change to php_odbc module, to check for failed SQLDisconnects
- and to close any outstanding transactions if the call fails, then disconnect
- again. This can cause chaos with SQL Server, this regards a SELECT as
- starting a transaction, and will leave it open if the result set is not all
- read.
-
-2001-04-02 Andrei Zmievski <andrei@ispi.net>
-
- * ext/standard/array.c: Use correct string length.
-
-2001-04-02 Jani Taskinen <sniper@iki.fi>
-
- * ext/aspell/config.m4: MFH
-
- * ext/aspell/config.m4: Fixed a typo. Bug: #10103
-
-2001-04-02 Marc Boeren <M.Boeren@guidance.nl>
-
- * ext/dbx/dbx.c
- ext/dbx/dbx_odbc.c
- ext/dbx/dbx_pgsql.c:
- Inserted a few extra initialisations, just in case. Had some problems in a
- different module, this solved it there, hance the added insurance. (Mc)
-
-2001-04-02 Wez Furlong <wez.php@thebrainroom.com>
-
- * ext/openssl/openssl.c:
- added some more error reporting and did a little tidying.
-
-2001-04-01 Wez Furlong <wez.php@thebrainroom.com>
-
- * ext/openssl/CREDITS
- ext/openssl/README
- ext/openssl/openssl.c
- ext/openssl/php_openssl.h:
- Added whole bunch of PKCS7 (S/MIME) functions and made the key/cert params
- a bit more friendly to use. See the README for more info.
-
-2001-04-01 Zeev Suraski <zeev@zend.com>
-
- * configure.in
- main/php_version.h: YARC
-
-2001-04-01 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * NEWS: Fixed some glitches in NEWS. (Yes, you may call me pedantic :-)
-
-2001-04-01 Jani Taskinen <sniper@iki.fi>
-
- * ext/gd/gd.c
- ext/gd/gd_ctx.c:
- According to GD documentation the macros should be used instead..
-
- * ext/informix/ifx.ec: Fixed bug #10095.
-
- * ext/gd/gd.c
- ext/gd/gd_ctx.c
- ext/gd/php_gd.h: Fixed bug #8137 and killed some compile warnings.
-
-2001-03-31 Zeev Suraski <zeev@zend.com>
-
- * ext/standard/output.c: MFH - header handling with output buffering
-
- * ext/standard/output.c: Fix headers handling with output buffering
-
-2001-03-31 Sascha Schumann <sascha@schumann.cx>
-
- * ext/ircg/ircg.c
- ext/ircg/php_ircg.h:
- Add ircg_html_encode() which is an interface to the standard
- HTML encoder for URLs and color attributes.
-
-2001-03-31 Christian Stocker <chregu@nomad.ch>
-
- * pear/Experimental/XML/fo2pdf.php: - converted tabs to spaces
- - more links in the docs about xsl:fo
-
-2001-03-30 Fredrik Öhrn <ohrn@chl.chalmers.se>
-
- * ext/cpdf/cpdf.c
- ext/cpdf/php_cpdf.h:
- Implemented cpdf_set_viewer_preferences (previously a stub).
- Added new functions: cpdf_set_font_directories and cpdf_set_font_map_file.
-
-2001-03-30 Anil Madhavapeddy <anil@recoil.org>
-
- * ext/zlib/zlib.c:
- Send the correct Vary headers, if we negotiate a gzip/deflate session
- via Accept-Encoding. This obeys a SHOULD directive in RFC2616
-
- PR: 10070
-
-2001-03-30 Zeev Suraski <zeev@zend.com>
-
- * ext/pgsql/pgsql.c: Fix pgsql_set_Default_link()
-
- * ext/pgsql/pgsql.c:
- Revert all PostgreSQL patches that were in the branch...
-
-2001-03-30 Sascha Schumann <sascha@schumann.cx>
-
- * build/genif.sh
- build/print_include.awk:
- Replace the incomprehensible newline escaping with @NEWLINE@
-
- Fixes the build on Darwin 1.2
-
-2001-03-30 Christian Stocker <chregu@nomad.ch>
-
- * pear/Experimental/XML/sql2xml.php: too much whitespaces after ?>
-
- * pear/Experimental/XML/fo2pdf.php:
- printPDF() din't print out the correct header, if no pdf was specified
-
- * pear/Experimental/XML/sql2xml.php: one api-change ulf forgot:
-
- getxml() -> getXML()
-
- * pear/Experimental/XML/sql2xml_ext.php:
- a lot of new customizable options.... too much to be listed here,
- documentation will follow.
-
- * pear/Experimental/XML/sql2xml.php:
- - new user_tableInfo option for user-contributed xml-structure
- - Error checking in doSql2Xml
- - xml_encode function for correctly parsing of &s.
-
-2001-03-30 Ulf Wendel <ulf.wendel@phpdoc.de>
-
- * pear/ITX.xml
- pear/IT[X].xml: - Renamed the file following Thies suggestion
-
- 100% beginners compatible politics of the PHP core guys: I was (again) allowed to make a mistake without beeing kicked - cool, thanks!
-
-2001-03-30 Emiliano Heyns <emile@iris-advies.com>
-
- * ext/midgard/preparser.c: Don't restat the connection, trust mod_midgard
-
-2001-03-30 Romolo Manfredini <romolo@bicnet.it>
-
- * ext/pgsql/pgsql.c:
- pg_close was not closing the connection, making impossible to reopen it. Pls insert in 4.0.5
-
-2001-03-30 Adam Daniel <adaniel2@cinci.rr.com>
-
- * pear/HTML/Common.php: added a few methods to manipulate attributes
-
- * pear/HTML/Table.php: minor change to toHtml
-
-2001-03-29 Ulf Wendel <ulf.wendel@phpdoc.de>
-
- * pear/package.dtd: - uuups, modified the package.dtd, undo
-
- * pear/IT[X].xml
- pear/package.dtd: - Added a package xml file for IT[X] templates
-
- * pear/HTML/IT.php
- pear/HTML/ITX.php
- pear/HTML/IT_Error.php: - Pearified the error handling
-
- * pear/Experimental/XML/fo2pdf.php
- pear/Experimental/XML/sql2xml.php
- pear/Experimental/XML/sql2xml_ext.php: - added basic phpdoc doc comments
- - lots of whitespaces
- - renamed functions from get_xy to the PEAR getXY
-
- Chregu, sorry for this commit in case it breaks your code, I don't like all of the coding guides myself but we should follow them, even if they break the code in our companies.
-
- * pear/Experimental/HTML/Menu_Browser.php:
- - Added an optional prefix for menu entries
-
-2001-03-29 Chuck Hagenbuch <chuck@horde.org>
-
- * pear/Mail/RFC822.php: indentation
-
- * pear/PEAR.php.in:
- Fix a couple of warnings when calling PEAR::raiseError() statically.
-
-2001-03-29 Ulf Wendel <ulf.wendel@phpdoc.de>
-
- * pear/Cache.xml: - package XML for the Cache
-
- I'm not sure how to use the package.dtd to document packages and if at all the Cache can be it's own package, but one has to start with it... Sterling, Stig can you give me a hint?
-
-2001-03-29 James Moore <James@phpuk.org>
-
- * run-tests.php: Output php version at end of tests.
-
-2001-03-29 Alexander Bokovoy <ab@avilink.net>
-
- * ext/midgard/config.m4
- ext/midgard/config.m4.session: - Typo fixed
- - config.m4.session updated to config.m4
-
-2001-03-29 Christian Stocker <chregu@nomad.ch>
-
- * pear/Experimental/XML/fo2pdf.php:
- MSIE needs a Content-Length: Header to display pdfs correctly. so here it
- is..
-
-2001-03-29 Wez Furlong <wez.php@thebrainroom.com>
-
- * ext/iconv/iconv.c:
- Fixed leak in php_iconv_string. Also returns FAILURE on failure,
- rather than -1
-
-2001-03-29 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * pear/Experimental/Image/color_helper.php: Added web-safe colors list.
-
-2001-03-29 Jani Taskinen <sniper@iki.fi>
-
- * ext/domxml/php_domxml.c: Fixed bug: #10040.
-
-2001-03-28 Thomas V.V.Cox <cox@idecnet.com>
-
- * pear/DB.php
- pear/DB/ifx.php
- pear/DB/mysql.php
- pear/DB/pgsql.php: pgsql.php
- * better handling of $rownum param in fetchInto()
- * changed property numrows[] to num_rows[]
-
- DB.php
- * $rowmun in fetch* now defaults to NULL
-
- mysql.php
- * added default $fetchmode to ordered
- * removed extra checks in connect()
- * fetchrow() now uses fetchInto()
- * added the "fetch absolute row numbers" feature to fetchInto()
- (not tested)
-
- ifx.php
- * better handling of $rownum param in fetchInto()
-
-2001-03-28 Zeev Suraski <zeev@zend.com>
-
- * main/php_version.h
- configure.in: Yes, RC4 is here too. RC3 had a broken ZTS build.
-
-2001-03-28 Jani Taskinen <sniper@iki.fi>
-
- * configure.in
- ext/ming/config.m4
- ext/ming/ming.c: MFH
-
-2001-03-28 Zeev Suraski <zeev@zend.com>
-
- * ext/standard/basic_functions.c: Fix ZTS build
-
-2001-03-28 Jani Taskinen <sniper@iki.fi>
-
- * configure.in: Make file() work again.
-
-2001-03-28 André Langhorst <A.Langhorst@itbnet.de>
-
- * ext/standard/output.c: fix typo
-
- * ext/standard/output.c: fix proto
-
-2001-03-28 Ulf Wendel <ulf.wendel@phpdoc.de>
-
- * pear/Cache.php: Added a simple usage example
-
- * pear/Experimental/Image/gtext.php: - fixed the vertical alignment bug
-
-2001-03-28 Zeev Suraski <zeev@zend.com>
-
- * main/php_version.h
- configure.in: RC3
-
-2001-03-28 Ulf Wendel <ulf.wendel@phpdoc.de>
-
- * pear/Experimental/Image/color_helper.php
- pear/HTML/Menu.php: - added the php licence
-
- * pear/Experimental/Image/gbutton.php:
- Very much the same like gtext but this one can be used to render
- graphical buttons.
-
- * pear/Experimental/HTML/Menu.php: Moved it to the stable code.
-
- * pear/HTML/Menu.php:
- Moved menu.php to the stable code. I didn't get any bug reports
- and it works for me...
-
- * pear/Cache/Container/file.php:
- - minor change regarding the recognition of relative file paths
-
- * pear/Cache/Graphics.php:
- - fixed several bugs with the usage of the parent class
- - gerror() by Cache_Error()
-
- * pear/Experimental/Image/gtext.php:
- Creates graphical text images using Cache/Graphics.
-
- Although it's unlikely that the API will changed use it with care some
- features seen to be broken :/.
-
- * pear/Experimental/Image/color_helper.php:
- Widget functions to deal with colors when creating images.
-
- I'm not sure where I should place this, lets wait for the next classes
- (gtext, gbutton) before we take care on the correct directory structure so
- we can see if it's worth it's own directory.
-
-2001-03-28 Romolo Manfredini <romolo@bicnet.it>
-
- * ext/standard/basic_functions.c:
- Safe mode check on target introduced in function move_uploaded_file.
-
- * ext/standard/file.c:
- Safe mode check for target introduced in function copy. Pls insert in 4_0_5
-
-2001-03-28 Adam Daniel <adaniel2@cinci.rr.com>
-
- * pear/HTML/Page.php: bug fix in toHtml
-
-2001-03-28 Thomas V.V.Cox <cox@idecnet.com>
-
- * pear/DB/ibase.php
- pear/DB/oci8.php: oci8.php
- * added not capable for fetchInto when $rownum !== null (feature not
- supported yet)
- * fix fetchInto to return null on no more data
- * Removed extra checks in connect()
-
- ibase.php
- * removed extra checks in connect() and return error on no connection
- * fetchInto now returns NULL on no more data (not tested)
- * added not capable for fetchInto when $rownum !== null (feature not
- supported yet)
- * changed tabs to spaces
- Please note that this extension seems to be very old.
-
-2001-03-27 Jani Taskinen <sniper@iki.fi>
-
- * sapi/pi3web/config.m4
- sapi/roxen/config.m4
- sapi/thttpd/config.m4
- sapi/isapi/config.m4
- sapi/nsapi/config.m4
- sapi/phttpd/config.m4
- sapi/apache/config.m4
- sapi/apache2filter/config.m4
- sapi/caudium/config.m4
- sapi/fastcgi/config.m4
- ext/vpopmail/config.m4
- ext/xml/config.m4
- ext/zlib/config.m4
- ext/zziplib/config.m4
- sapi/aolserver/config.m4
- ext/swf/config.m4
- ext/sybase/config.m4
- ext/sybase_ct/config.m4
- ext/sablot/config.m4
- ext/session/config.m4
- ext/snmp/config.m4
- ext/readline/config.m4
- ext/recode/config.m4
- ext/pgsql/config.m4
- ext/pspell/config.m4
- ext/qtdom/config.m4
- ext/pdf/config.m4
- ext/pfpro/config.m4
- ext/oracle/config.m4
- ext/ovrimos/config.m4
- ext/pcre/config.m4
- ext/mysql/config.m4
- ext/oci8/config.m4
- ext/odbc/config.m4
- ext/mnogosearch/config.m4
- ext/msql/config.m4
- ext/muscat/config.m4
- ext/midgard/config.m4
- ext/midgard/config.m4.session
- ext/ming/config.m4
- ext/mcal/config.m4
- ext/mcrypt/config.m4
- ext/mhash/config.m4
- ext/ircg/config.m4
- ext/java/config.m4
- ext/ldap/config.m4
- ext/informix/config.m4
- ext/ingres_ii/config.m4
- ext/interbase/config.m4
- ext/iconv/config.m4
- ext/imap/config.m4
- ext/gettext/config.m4
- ext/gmp/config.m4
- ext/icap/config.m4
- ext/fribidi/config.m4
- ext/gd/config.m4
- ext/domxml/config.m4
- ext/fbsql/config.m4
- ext/fdf/config.m4
- ext/cybercash/config.m4
- ext/cybermut/config.m4
- ext/dba/config.m4
- ext/cpdf/config.m4
- ext/crack/config.m4
- ext/curl/config.m4
- configure.in
- ext/aspell/config.m4
- ext/bz2/config.m4
- ext/ccvs/config.m4
- acinclude.m4:
- Renamed the AC_ prefixed macros defined in acinclude.m4 to PHP_* prefixes.
-
-2001-03-27 Derick Rethans <d.rethans@jdimedia.nl>
-
- * ext/standard/formatted_print.c: - MFH (Fix for bug 10002)
-
- * ext/standard/formatted_print.c: - 'Fix' for bug 10002
-
-2001-03-27 Ben Mansell <ben@zeus.com>
-
- * sapi/fastcgi/fastcgi.c:
- Changed header handling; before, we were somehow losing
- Content-Type: text/html
-
-2001-03-27 Dan Kalowsky <dank@deadmime.org>
-
- * ext/odbc/php_odbc.c:
- The last fix was missing a &, Marc Boeren either made the patch wrong, or I applied it improperly. Anyways, Sebastian Bergmann discovered it, and supposedly is fixed with this.
-
-2001-03-27 Ben Mansell <ben@zeus.com>
-
- * sapi/fastcgi/fastcgi.c:
- Changed header handling; before, we were somehow losing
- Content-Type: text/html
-
-2001-03-27 Thies C. Arntzen <thies@thieso.net>
-
- * ext/oracle/oracle.c: MFH
-
- * ext/oracle/oracle.c: fixed newly introduced crash in ora_bind
-
-2001-03-27 Christian Stocker <chregu@nomad.ch>
-
- * pear/Experimental/XML/fo2pdf.php: corrected Usage example
-
-2001-03-27 Dan Kalowsky <dank@deadmime.org>
-
- * ext/odbc/php_odbc.c:
- Fix for Bug #9272, as submitted by marc boeren (m.boeren@guidance.nl).
- Applied by me, due to apparently a lack of cvs access to ext/odbc for him.
-
-2001-03-27 Jani Taskinen <sniper@iki.fi>
-
- * main/php_variables.c: MFH
-
- * main/php_variables.c:
- Fix the arg_separator behaviour. Only & or ; is allowed as separators so no need to use the ini setting here.
-
-2001-03-27 Romolo Manfredini <romolo@bicnet.it>
-
- * ext/pgsql/pgsql.c:
- pg_close was closing connection twice, pls insert in 4_0_5
-
-2001-03-27 Christian Stocker <chregu@nomad.ch>
-
- * pear/Experimental/XML/fo2pdf.php:
- a class for rendering (xsl-)formatting objects files into a pdf.
-
-2001-03-27 Thomas V.V.Cox <cox@idecnet.com>
-
- * pear/DB/common.php
- pear/DB/ifx.php
- pear/DB/pgsql.php: ifx.php
- * Changed default fetchmode to ORDERED
- * Remove extra checks in connect and added $dns property
- * fetchRow() now uses fetchInto()
-
- common.php & pgsql.php
- style
-
-2001-03-26 Thomas V.V.Cox <cox@idecnet.com>
-
- * pear/DB/pgsql.php
- pear/DB.php: pgsql.php
- * connect() always use pg_connect string instead of the deprecated params
- mode
- * removed duplicated functions prepare() and execute() (now in common.php)
- * pgsqlRaiseError() always fills native error param on DB_error objs
- * added third param $rownum to fetchInto() so users can fetch also absolute
- row numbers
- * changed fetchRow() to use fetchInto() (can not erase, still used in get*()
- from common.php
-
- DB.php
- * added third param $rownum to fetchInto()/fetchRow() so users can fetch
- also absolute row numbers
- * changed fetchRow() to use fetchInto()
-
-2001-03-26 Jani Taskinen <sniper@iki.fi>
-
- * ext/domxml/php_domxml.c: Fixed a typo.
-
- * configure.in: Fixed the problem with libbind (again).
-
-2001-03-26 Andrei Zmievski <andrei@ispi.net>
-
- * NEWS: More news.
-
-2001-03-26 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * NEWS: Nitpicking.
-
-2001-03-26 Andrei Zmievski <andrei@ispi.net>
-
- * NEWS: Zend related news update.
-
-2001-03-26 Sterling Hughes <sterling@designmultimedia.com>
-
- * FUNCTION_LIST.txt:
- Remove FUNCTION_LIST.txt, the file is sadly out of date and not really used...
-
-2001-03-26 Jani Taskinen <sniper@iki.fi>
-
- * ext/ldap/config.m4: Support Solaris 8 ldap.
-
-2001-03-26 Marc Boeren <M.Boeren@guidance.nl>
-
- * ext/dbx/dbx.c:
- Removed #include php_config.h, since it was not necessary (Mc)
-
-2001-03-26 Romolo Manfredini <romolo@bicnet.it>
-
- * ext/pgsql/pgsql.c:
- pg_close was undefining default_conn even if a ref to it was still there.
-
-2001-03-25 Stig Bakken <ssb@fast.no>
-
- * pear/DB/ifx.php:
- * changed DB_ifx::errorCode to take a parameter, moved the error code
- map into the constructor
-
- * pear/DB/STATUS:
- wrapped to 80 columns, replaced a few "-" with "n" for ifx (some
- features are emulated through DB_common)
-
-2001-03-24 Jon Parise <jon@csh.rit.edu>
-
- * pear/Makefile.in: Install the Informix database implementation.
-
-2001-03-24 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * pear/Makefile.in: Added missing files.
-
- * php.ini-dist: Added php_dbx.dll.
-
-2001-03-24 Adam Daniel <adaniel2@cinci.rr.com>
-
- * pear/HTML/Common.php: removed extra whitespace
-
-2001-03-24 Christian Stocker <chregu@nomad.ch>
-
- * pear/Experimental/XML/sql2xml.php
- pear/Experimental/XML/sql2xml_ext.php:
- First Commit of the sql2xml classes.
-
- This class takes a PEAR::DB-Result Object (or more than one) and returns a
- xml-representation of it.
-
-2001-03-24 Thomas V.V.Cox <cox@idecnet.com>
-
- * pear/DB/STATUS
- pear/DB/ifx.php: Minor fixes
-
-2001-03-24 Romolo Manfredini <romolo@bicnet.it>
-
- * ext/pgsql/pgsql.c:
- Solved bugs #9746 and #9937, pg_close was closing twice the default conn.
-
-2001-03-24 Stig Bakken <ssb@fast.no>
-
- * pear/DB/STATUS
- pear/DB/common.php
- pear/DB/mysql.php
- pear/DB/tests/mysql/012.phpt
- pear/DB/tests/tableinfo.inc
- pear/DB.php: * added Christian Stocker's tableInfo() implementation
-
-2001-03-24 Adam Daniel <adaniel2@cinci.rr.com>
-
- * pear/HTML/Page.php:
- This class handles the details for creating a properly constructed HTML page.
- Page caching, stylesheets, client side script, and Meta tags can be
- managed using this class.
-
- * pear/HTML/Table.php:
- added comments to the html output including table nest level, added automatic taboffset for
- cell contents if a subclass of html_common
-
- * pear/HTML/Select.php:
- added comments to the HTML output, added loadQuery, added load
-
- * pear/HTML/Common.php: added setComment
-
-2001-03-24 Sascha Schumann <sascha@schumann.cx>
-
- * ext/standard/basic_functions.c: Fix ZTS build
-
-2001-03-23 Jon Parise <jon@csh.rit.edu>
-
- * pear/DB/MAINTAINERS
- pear/DB/ifx.php: Adding an Informix (ifx) database implementation.
-
- Submitted by: "Tomas V.V.Cox" <cox@idecnet.com>
-
-2001-03-23 Christian Stocker <chregu@nomad.ch>
-
- * pear/Cache/Output.php:
- GarbageCollection was moved into a PEAR-Deconstructor
- (from the HEAD Branch)
-
- * pear/Cache/Container/file.php:
- just the changes from the HEAD dev here. rather important
-
-2001-03-23 Marc Boeren <M.Boeren@guidance.nl>
-
- * ext/dbx/dbx.dsp
- ext/dbx/dbx_mysql.c
- ext/dbx/dbx_mysql.h
- ext/dbx/dbx_odbc.c
- ext/dbx/dbx_odbc.h
- ext/dbx/dbx_pgsql.c
- ext/dbx/dbx_pgsql.h
- ext/dbx/php_dbx.h
- ext/dbx/Makefile.in
- ext/dbx/dbx.c: Fixed compile errors for PostgreSQL support (Mc)
- Removed globals that Rui put in, and changed the dbx_get_row
- to include a row_number (which PostgreSQL expects) (Mc)
- Added source files to Makefile.in and dbx.dsp (Mc)
-
-2001-03-23 Andrei Zmievski <andrei@ispi.net>
-
- * NEWS: Wrap lines.
-
-2001-03-23 Rui Hirokawa <louis@cityfujisawa.ne.jp>
-
- * ext/dbx/dbx_pgsql.c
- ext/dbx/dbx_pgsql.h: changed license of PostgreSQL module in ext/dbx.
-
- * ext/dbx/dbx.c
- ext/dbx/dbx_pgsql.c
- ext/dbx/dbx_pgsql.h
- ext/dbx/php_dbx.h: added initial support for PostgreSQL to ext/dbx.
-
-2001-03-23 Marc Boeren <M.Boeren@guidance.nl>
-
- * ext/dbx/.cvsignore
- ext/dbx/LICENSE
- ext/dbx/dbx.c
- ext/dbx/dbx.dsp
- ext/dbx/dbx.h
- ext/dbx/dbx_mysql.c
- ext/dbx/dbx_mysql.h
- ext/dbx/dbx_odbc.c
- ext/dbx/dbx_odbc.h
- ext/dbx/php_dbx.h:
- Changed header for source files, now point to PHP license (Mc)
- Found another // comment and replaced with /**/ (Mc)
- Removed proprietary license (in favor of php license) (Mc)
- Added .cvsignore file, I hope it works correctly (Mc)
-
-2001-03-23 Romolo Manfredini <romolo@bicnet.it>
-
- * ext/standard/basic_functions.c
- ext/standard/file.c:
- Added target ownership check in function copy for safe_mode operations
-
-2001-03-23 Daniel Beulshausen <daniel@php4win.de>
-
- * NEWS: update news
-
-2001-03-23 Adam Daniel <adaniel2@cinci.rr.com>
-
- * pear/HTML/Select.php: forgot the license header
-
- * pear/HTML/Select.php:
- original commit. Basic html select loaded manually, from a DB result, or an array
-
-2001-03-23 Stephen van Egmond <svanegmond@home.com>
-
- * configure.in:
- Added configuration for detecting the BeOS thread implementation
- (which will be used once I get my patches into Zend to use bthreads).
-
- Also, a check for a library distributed with the new BeOS networking
- environment.
-
- * ext/standard/microtime.c:
- Simple patch to deal with lack of fields in the BeOS implementation of rusage.
-
-2001-03-23 Adam Daniel <adaniel2@cinci.rr.com>
-
- * pear/HTML/Table.php:
- moved the display method to HTML_Common and updated some comments
-
- * pear/HTML/Common.php:
- updated some comments, added display method, and added the toHtml abstract method
-
-2001-03-23 Stig Bakken <ssb@fast.no>
-
- * pear/DB/tests/pgsql/mktable.inc
- pear/DB/tests/ibase/mktable.inc
- pear/DB/tests/mysql/mktable.inc
- pear/DB/tests/oci8/002.phpt
- pear/DB/tests/oci8/007.phpt
- pear/DB/tests/oci8/009.phpt
- pear/DB/tests/oci8/010.phpt
- pear/DB/tests/oci8/connect.inc
- pear/DB/tests/oci8/mktable.inc
- pear/DB/tests/oci8/skipif.inc
- pear/DB/tests/odbc/mktable.inc
- pear/DB/STATUS
- pear/DB/common.php
- pear/DB/oci8.php
- pear/DB/tests/errors.inc
- pear/DB/tests/fetchrow.inc
- pear/DB/tests/numrows.inc
- pear/DB/tests/sequences.inc
- pear/DB.php
- pear/PEAR.php.in:
- * fixed Oracle tests, fixed some bugs in DB_oci8, all tests but
- errorNative() pass now (but that may be a bug in the test :-)
- * implemented numRows() emulation in DB_oci8 that is available
- in "optimize portability" mode only
-
-2001-03-23 Adam Daniel <adaniel2@cinci.rr.com>
-
- * pear/HTML/Common.php:
- removed the pass by reference on the second parameter of _updateAttrArray
-
-2001-03-23 Frank M. Kromann <frank@frontbase.com>
-
- * ext/fbsql/php_fbsql.c: Removing extra check for warnings.
-
-2001-03-22 Frank M. Kromann <frank@frontbase.com>
-
- * ext/fbsql/php_fbsql.c: Adding warning when query fails
-
-2001-03-22 Ben Mansell <ben@zeus.com>
-
- * sapi/cgi/cgi_main.c
- sapi/fastcgi/fastcgi.c:
- Fix a bug with POST requests. If the Content-Type header wasn't present,
- we were setting SG(request_info).content_type to NULL, instead of
- an empty string. This was stopping PHP from processing the data.
-
-2001-03-22 Ulf Wendel <ulf.wendel@phpdoc.de>
-
- * pear/Experimental/HTML/Menu_Browser.php: Finished it, works for me.
-
-2001-03-22 Martin Jansen <mail@martin-jansen.de>
-
- * pear/HTML/Common.php: - removed wrong copyright notice.
-
-2001-03-22 Marc Boeren <M.Boeren@guidance.nl>
-
- * ext/dbx/dbx.c
- ext/dbx/dbx_mysql.c
- ext/dbx/dbx_mysql.h
- ext/dbx/dbx_odbc.c
- ext/dbx/dbx_odbc.h
- ext/dbx/php_dbx.h: Changed C++ style comments to C-style comments (Marc)
-
-2001-03-22 Emiliano Heyns <emile@iris-advies.com>
-
- * ext/midgard/article.c
- ext/midgard/element.c
- ext/midgard/page.c
- ext/midgard/pageelement.c
- ext/midgard/topic.c: Added update duplicate checks
-
-2001-03-22 Ulf Wendel <ulf.wendel@phpdoc.de>
-
- * pear/Cache/Container/dbx.php: - added support for persistent connections
-
- * pear/Cache/Container/dbx.php: - connection data typo
- - whitespaces
-
-2001-03-22 Sean Bright <elixer@erols.com>
-
- * ext/standard/basic_functions.c: Fixed prototype.
-
-2001-03-22 Martin Jansen <mail@martin-jansen.de>
-
- * pear/HTML/Table.php: - Fixed bug reported by Bertrand Mansion.
-
-2001-03-22 Christian Stocker <chregu@nomad.ch>
-
- * pear/Cache/Container/dbx.php:
- a new container, which uses the new dbx extension of php as db-abstraction
-
-2001-03-22 Jani Taskinen <sniper@iki.fi>
-
- * ext/sockets/sockets.c: MFH
-
- * ext/sockets/sockets.c: Fix bugs: #9920, #9190
-
-2001-03-22 Marc Boeren <M.Boeren@guidance.nl>
-
- * ext/dbx/EXPERIMENTAL: no comment :)
-
- * ext/dbx/CREDITS
- ext/dbx/INSTALL
- ext/dbx/LICENSE
- ext/dbx/Makefile.in
- ext/dbx/config.m4
- ext/dbx/dbx.c
- ext/dbx/dbx.dsp
- ext/dbx/dbx.h
- ext/dbx/dbx_mysql.c
- ext/dbx/dbx_mysql.h
- ext/dbx/dbx_odbc.c
- ext/dbx/dbx_odbc.h
- ext/dbx/php_dbx.h:
- Added dbx module (database abstraction) to the repositorty (/ext/dbx).
- Compiles under Linux (--enable-dbx) and Windows.
- Supports MySQL and ODBC modules (more to be added later).
-
-2001-03-22 Uwe Steinmann <Uwe.Steinmann@fernuni-hagen.de>
-
- * ext/domxml/php_domxml.c: - fixed some bugs with xpath
-
-2001-03-22 Martin Jansen <mail@martin-jansen.de>
-
- * pear/HTML/Common.php
- pear/HTML/Table.php:
- - some cosmetic changes in pear/html/HTML_Common and pear/html/HTML_Table for better
- readability.
-
-2001-03-22 Chuck Hagenbuch <chuck@horde.org>
-
- * pear/DB/odbc.php:
- we have a default for dbsyntax; don't cause an error if it's not specified.
-
- * pear/DB/mssql.php: space
-
-2001-03-22 Adam Daniel <adaniel2@cinci.rr.com>
-
- * pear/HTML/Table.php: original commit. class to create html tables
-
- * pear/HTML/Common.php:
- orginal commit. class containing common html tools
-
-2001-03-21 Frank M. Kromann <frank@frontbase.com>
-
- * ext/fbsql/php_fbsql.c: setting right params to zend_get_parameters_ex
-
-2001-03-21 Rainer Schaaf <rjs@pdflib.com>
-
- * ext/pdf/pdf.c
- ext/pdf/php_pdf.h:
- Beta2 of PDFlib V4.0 will introduce on new function (PDF_place_pdi_page)
- and PDF_close_pdi_page will lose one parameter.
- These changes are done for the phpwrapper now.
- This has no impact on PDFlib V3.x.
-
-2001-03-21 Andi Gutmans <andi@zend.com>
-
- * ext/pfpro/pfpro.c
- ext/pfpro/php_pfpro.h: - Fix spelling error
-
-2001-03-21 Frank M. Kromann <frank@frontbase.com>
-
- * ext/fbsql/php_fbsql.c: changed arg types from pval* to zval**
-
-2001-03-21 Sterling Hughes <sterling@designmultimedia.com>
-
- * ext/bz2/EXPERIMENTAL: Remove experimental status from bz2 (as of 4.0.6)
-
- * EXTENSIONS: Remove experimental status from bz2
-
-2001-03-21 Andrei Zmievski <andrei@ispi.net>
-
- * NEWS: Fixing news.
-
-2001-03-21 André Langhorst <A.Langhorst@itbnet.de>
-
- * run-tests.php:
- I don't like to commit this over and over either, but this client definitely seems to dislike branches
-
- * run-tests.php: synchronizing with CVS
-
-2001-03-21 Ben Mansell <ben@zeus.com>
-
- * ext/standard/mail.c:
- UnixWare 7.1 does not have EX_TEMPFAIL or (as far as I can tell)
- a concept of a temporary failure response to pclose().
-
-2001-03-21 Emiliano Heyns <emile@iris-advies.com>
-
- * ext/midgard/article.c: Disallow duplicate article names under one parent
-
-2001-03-21 Sean Bright <elixer@erols.com>
-
- * ext/standard/basic_functions.c: Fix for bug #9698.
-
-2001-03-21 André Langhorst <A.Langhorst@itbnet.de>
-
- * run-tests.php:
- fighting against the cvs client, it does not want to let the win32 binary safe change go in...
-
- * run-tests.php: win32 fixes again
-
- * tests/strings/001.phpt
- tests/strings/002.phpt
- tests/strings/003.phpt
- tests/lang/018.phpt
- tests/lang/019.phpt
- tests/lang/020.phpt
- tests/lang/021.phpt
- tests/lang/022.phpt
- tests/lang/023.phpt
- tests/lang/024.phpt
- tests/lang/025.phpt
- tests/lang/028.phpt: more win32 fixes
-
-2001-03-21 Uwe Steinmann <Uwe.Steinmann@fernuni-hagen.de>
-
- * ext/hyperwave/hg_comm.c: - fulltext query are working now
-
-2001-03-21 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * run-tests.php: Disable maximum execution time for tests.
-
-2001-03-21 André Langhorst <A.Langhorst@itbnet.de>
-
- * run-tests.php: 1) fixed tests on *both* win32+linux
- 2) made tests more sophisticated (checking against compiled in modules)
- 3) minor changes
- 4) win32 improvements
-
-2001-03-21 Uwe Steinmann <Uwe.Steinmann@fernuni-hagen.de>
-
- * ext/domxml/php_domxml.c
- ext/domxml/php_domxml.h: - added EntityReference and Notation class
- - fixed handling of PI nodes
- - implemented more class functions
-
-2001-03-21 Jon Parise <jon@csh.rit.edu>
-
- * pear/DB.php: Style and whitespace, based mostly on a submission from
- "Tomas V.V.Cox" <cox@idecnet.com>.
-
-2001-03-20 Ulf Wendel <ulf.wendel@phpdoc.de>
-
- * pear/Experimental/HTML/Menu_Browser.php: Warning: alpha code!
-
- A simple filesystem scanner/browser that maps the filesystem structure into a menu hash so that you can build simple fusebox (?) like systems. Sebastian can you help me with the coding guides etc ?
-
-2001-03-20 Harald Radi <h.radi@nme.at>
-
- * php.ini-dist
- php.ini-optimized: added [com] section
-
- * ext/com/COM.c
- ext/com/com.h
- ext/com/php_COM.h
- ext/com/typedef_VARIANT.c: memory leak was reportet, i'm not sure that it is fixed by now, but it should be.
-
- * win32/php4dllts.dsp: added com.h
-
-2001-03-20 Zeev Suraski <zeev@zend.com>
-
- * configure.in
- main/php_version.h: 4.0.5RC2
-
-2001-03-20 Sterling Hughes <sterling@designmultimedia.com>
-
- * ext/curl/curl.c:
- remove some unneccessary casts, remove unneccessary error casts, standardize
- the coding format for some of the stuff.
-
-2001-03-20 Fredrik Öhrn <ohrn@chl.chalmers.se>
-
- * ext/standard/rand.c:
- Fix erronous out of bounds error message in rand(min,max)
-
-2001-03-20 Frank M. Kromann <frank@frontbase.com>
-
- * ext/fbsql/php_fbsql.c: Fixing crash when result conrains 0 rows
-
-2001-03-20 Andi Gutmans <andi@zend.com>
-
- * ext/midgard/config.m4:
- - MFH - This is required for PHP to build. If anything else needs merging
- for midgard that is related then please do it or rollback the latest
- midgard fixes.
-
-2001-03-20 Fredrik Öhrn <ohrn@chl.chalmers.se>
-
- * ext/yp/yp.c: really fix the build
-
-2001-03-20 Frank M. Kromann <frank@frontbase.com>
-
- * ext/fbsql/php_fbsql.c: Converting to c-style comments.
- Adding prototypes to all exported function
-
-2001-03-20 Thies C. Arntzen <thies@thieso.net>
-
- * ext/qtdom/config.m4: make qtdom compile on Mandrake-cooker
-
-2001-03-20 Andi Gutmans <andi@zend.com>
-
- * Makefile.in
- README.Zeus
- configure.in
- sapi/isapi/config.m4
- sapi/fastcgi/CREDITS
- sapi/fastcgi/Makefile.in
- sapi/fastcgi/README.FastCGI
- sapi/fastcgi/config.m4
- sapi/fastcgi/fastcgi.c
- sapi/fastcgi/php.sym
- sapi/fastcgi/php_fastcgi.h: - MFH
-
-2001-03-20 Daniel Beulshausen <daniel@php4win.de>
-
- * ext/pgsql/pgsql.dsp: fix dsp
-
-2001-03-20 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * ext/domxml/php_domxml.c: Nuke another warning.
-
-2001-03-20 Uwe Steinmann <Uwe.Steinmann@fernuni-hagen.de>
-
- * ext/domxml/php_domxml.c: - fixed lot of compiler warnings
-
-2001-03-20 Daniel Beulshausen <daniel@php4win.de>
-
- * win32/registry.c: fix registry per directory values
-
-2001-03-20 Uwe Steinmann <Uwe.Steinmann@fernuni-hagen.de>
-
- * NEWS: - news about domxml
-
- * tests/testdom: - test script for rewritten domxml module
-
- * ext/domxml/php_domxml.c
- ext/domxml/php_domxml.h: - complete rewrite of domxml module.
- It is now mostly conform to DOM Level 2 though some classes and
- methods are still missing
-
-2001-03-20 Sascha Schumann <sascha@schumann.cx>
-
- * ext/yp/yp.c: fix build
-
-2001-03-20 Jani Taskinen <sniper@iki.fi>
-
- * ext/standard/basic_functions.c
- ext/standard/dns.c
- ext/standard/dns.h: MFH
-
-2001-03-20 Sterling Hughes <sterling@designmultimedia.com>
-
- * ext/curl/curl.c: Remove some unnecessary error checking
-
-2001-03-20 Jani Taskinen <sniper@iki.fi>
-
- * main/SAPI.c
- configure.in
- ext/fdf/fdf.c: MFH
-
- * ext/xml/tests/004.phpt
- ext/xml/tests/006.phpt
- ext/xml/tests/skipif.php:
- Removed skipif.php + Fixed tests to use skipif.inc instead.
-
- * ext/cybermut/libs.mk: Removed unnessary file.
-
-2001-03-19 David Guerizec <david@guerizec.net>
-
- * ext/midgard/php_midgard.h.in: deleted unneeded file
-
- * ext/midgard/config.m4
- ext/midgard/php_midgard.h: Fixed the build (hope so).
-
-2001-03-19 Andrei Zmievski <andrei@ispi.net>
-
- * ext/standard/array.c
- ext/standard/basic_functions.c
- ext/standard/php_array.h:
- - Added array_map() function that applies a callback to the elements
- of given arrays and returns the result. It can also be used with a
- null callback to transpose arrays.
-
-2001-03-19 Sterling Hughes <sterling@designmultimedia.com>
-
- * ext/bz2/bz2.c: Whitespace fix...
-
-2001-03-19 Jani Taskinen <sniper@iki.fi>
-
- * ext/midgard/config.m4: Fix the build. Again.
-
-2001-03-19 Fredrik Öhrn <ohrn@chl.chalmers.se>
-
- * ext/yp/yp.c: Removed redundant initialization.
-
-2001-03-19 Alexander Bokovoy <ab@avilink.net>
-
- * ext/midgard/config.m4
- ext/midgard/config.m4.session: 4.0.4pl1 compability finally fixed
-
-2001-03-19 David Guerizec <david@guerizec.net>
-
- * ext/midgard/config.m4.session: fixed compilation with php-4.0.4
-
- * ext/midgard/config.m4: fixed a compatibility problem with 4.0.4
-
- * ext/midgard/php_midgard.h.in: fixed bad #endif syntax
-
-2001-03-19 Alexander Bokovoy <ab@avilink.net>
-
- * ext/midgard/php_midgard.h.in:
- Incompabilities in SCE build fixed for 4.0.5 and 4.0.4pl1
-
-2001-03-19 Ben Mansell <ben@zeus.com>
-
- * sapi/isapi/config.m4
- README.Zeus:
- Altered README.Zeus to give instructions on building FastCGI.
- Changed --with-zeus configure option into --with-isapi, since its more
- descriptive (and since there are now different ways to configure PHP+Zeus)
-
- * Makefile.in
- configure.in
- sapi/fastcgi/CREDITS
- sapi/fastcgi/Makefile.in
- sapi/fastcgi/README.FastCGI
- sapi/fastcgi/config.m4
- sapi/fastcgi/fastcgi.c
- sapi/fastcgi/php.sym
- sapi/fastcgi/php_fastcgi.h: New FastCGI server module. Based on the thttpd server module with
- large chunks of code ripped from the cgi module. Also modifies
- Makefile.in and configure.in in order to make it build properly.
-
-2001-03-19 Alexander Bokovoy <ab@avilink.net>
-
- * ext/midgard/config.m4
- ext/midgard/config.m4.session: Keep compability with 4.0.4pl1
-
-2001-03-19 Emiliano Heyns <emile@iris-advies.com>
-
- * ext/midgard/midgard.c: return userid from mgd_auth_midgard
-
-2001-03-19 Alexander Bokovoy <ab@avilink.net>
-
- * ext/midgard/.cvsignore
- ext/midgard/article.c
- ext/midgard/attachment.c
- ext/midgard/config.m4
- ext/midgard/config.m4.session
- ext/midgard/midgard.c
- ext/midgard/php_midgard.h
- ext/midgard/snippet.c: Bringing fixed code to stable branch
-
- * ext/midgard/config.m4
- ext/midgard/config.m4.session: Oops. Substitution code fixed
-
- * ext/midgard/config.m4
- ext/midgard/config.m4.session
- ext/midgard/php_midgard.h.in:
- Automatically generate correct #include for cases when module
- build using phpize or within main PHP4 tree
-
-2001-03-18 Fredrik Öhrn <ohrn@chl.chalmers.se>
-
- * ext/yp/CREDITS
- ext/yp/php_yp.h
- ext/yp/yp.c: Much needed cleanup and new functions added
-
- * ext/cpdf/php_cpdf.h:
- Solved compile failure due to clash between IMAP and ClibPDF headers.
-
- * ext/cpdf/php_cpdf.h:
- Solved compile failure due to clash bewteen IMAP and ClibPDF headers.
-
-2001-03-18 Alexander Bokovoy <ab@avilink.net>
-
- * ext/midgard/php_midgard.h: Update includes to the way CVS now works
-
-2001-03-18 Jani Taskinen <sniper@iki.fi>
-
- * ext/fdf/fdf.c: Prevent mem leak
-
- * main/SAPI.c: Fix possible crash if content-type is not set.
-
- * ext/fdf/fdf.c: Fix the fix. Plus killed some compile warnings.
-
-2001-03-18 Zeev Suraski <zeev@zend.com>
-
- * main/SAPI.c
- main/SAPI.h: MFH
-
- * ext/fdf/fdf.c: Fix reference to nuked function
-
- * main/SAPI.c
- main/SAPI.h:
- These functions are not necessary - that's what sapi_register_post_entry()
- and sapi_unregister_post_entry() are for...
-
- Also, please maintain K&R code layout, it's very messy to have different
- styles intermixed in the same codebase, and especially in the same files!
-
- * main/main.c
- main/php_ini.c
- main/php_ini.h: MFH
-
-2001-03-17 Zeev Suraski <zeev@zend.com>
-
- * main/main.c
- main/php_ini.c
- main/php_ini.h:
- Recode delayed loading in a much simpler way (switched back to php_ini.c 1.49)
-
-2001-03-17 Stephen van Egmond <svanegmond@home.com>
-
- * ext/standard/php_string.h:
- fixed a (C++) warning about implicit conversion from void*
-
-2001-03-17 Christian Stocker <chregu@nomad.ch>
-
- * pear/Cache/Container/file.php:
- GarbageCollection didn't work properly (wanted to delete files, relative
- paths don't work in deconstructors)
-
- * pear/Cache.php
- pear/Cache/Output.php:
- GarbageCollection was moved into a PEAR-Deconstructor
-
-2001-03-17 Derick Rethans <d.rethans@jdimedia.nl>
-
- * ext/mcrypt/mcrypt.c: - MFH (memleak fix)
-
-2001-03-17 Anil Madhavapeddy <anil@recoil.org>
-
- * ltconfig:
- Update libtool to support OpenBSD 2.8+ wrt shared libraries and
- library dependencies. Tested on i386/sparc.
-
-2001-03-17 Daniel Beulshausen <daniel@php4win.de>
-
- * win32/php4ts.dsw: fix dependencys
-
-2001-03-17 James Moore <James@phpuk.org>
-
- * ext/standard/credits.h
- ext/standard/info.h
- ext/standard/credits.c: MFH for website team credits.
-
-2001-03-17 Zeev Suraski <zeev@zend.com>
-
- * ext/standard/output.c: MFH
-
- * ext/standard/output.c: Fix the output buffering bug Andre found
-
-2001-03-16 Andrei Zmievski <andrei@ispi.net>
-
- * ext/standard/array.c
- ext/standard/basic_functions.c
- ext/standard/php_array.h:
- - Added array_filter(), which allows filtering of array elements via
- the specified callback.
-
- * ext/standard/array.c:
- All user callbacks should be to EG(function_table).
-
-2001-03-16 Frank M. Kromann <frank@frontbase.com>
-
- * ext/standard/array.c:
- Fixing build on Win32 by adding missing BLS_FETCH();
-
-2001-03-16 Andrei Zmievski <andrei@ispi.net>
-
- * ext/standard/array.c:
- - Fixed all relevant array functions to avoid moving the internal array
- pointer during operations.
-
-2001-03-16 Jani Taskinen <sniper@iki.fi>
-
- * ext/standard/basic_functions.c: This has got to be the last one..
-
-2001-03-16 Uwe Steinmann <Uwe.Steinmann@fernuni-hagen.de>
-
- * ext/hyperwave/hg_comm.c
- ext/hyperwave/hg_comm.h:
- - Inserting links without any delimiters is now possible
-
-2001-03-16 Jani Taskinen <sniper@iki.fi>
-
- * tests/.cvsignore: .php files should not be ignored. Typo?
-
-2001-03-16 Derick Rethans <d.rethans@jdimedia.nl>
-
- * ext/mcrypt/mcrypt.c: - Fixed mem leak
-
-2001-03-16 Emiliano Heyns <emile@iris-advies.com>
-
- * ext/midgard/article.c: String used as long.
-
-2001-03-16 Jani Taskinen <sniper@iki.fi>
-
- * ext/standard/dns.h: Missed this one.
-
-2001-03-16 Dan Kalowsky <dank@deadmime.org>
-
- * ext/imap/php_imap.c:
- This is to correct bug #9762, patch submitted by Bug reporter.
-
-2001-03-16 Jani Taskinen <sniper@iki.fi>
-
- * ext/imap/php_imap.c:
- Make compile again when ZTS is enabled and imap-2000 is used. Bug #9762
-
-2001-03-16 Sascha Schumann <sascha@schumann.cx>
-
- * ext/pdf/config.m4: Don't do anything, if the user wants no PDF.
-
-2001-03-16 Egon Schmid <eschmid@s.netic.de>
-
- * pear/Cache/Output.php: Ulf, you have a conflict.
-
-2001-03-16 Ulf Wendel <ulf.wendel@phpdoc.de>
-
- * pear/Cache/Output.php: Usage example changes should answer peoples FAQs.
-
-2001-03-16 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * pear/Cache/Output.php: Fix the example.
-
-2001-03-16 Jani Taskinen <sniper@iki.fi>
-
- * configure.in
- ext/standard/dns.c: This should fix problems in systems without libbind.
-
-2001-03-16 Frank M. Kromann <frank@frontbase.com>
-
- * ext/printer/CREDITS: Adding credits
-
-2001-03-16 Sterling Hughes <sterling@designmultimedia.com>
-
- * ext/bz2/bz2.c:
- Slightly modified fix from jeremy brand <jeremy@nirvani.net>. he
- correctly pointed out that allocating the buffer to a little more than
- need (exact formula is in the code) will save the need to keep retrying
- the compression.
-
-2001-03-16 Jani Taskinen <sniper@iki.fi>
-
- * ext/ming/config.m4:
- Added a check for the one function missing in <= 0.1.0 versions of ming lib.
-
-2001-03-16 Brian Bruns <camber@ais.org>
-
- * ext/sybase/php_sybase_db.c
- ext/sybase/php_sybase_db.h:
- sybase_affected_rows implementation submitted by John F. Dumas <jdumas@locutus.kingwoodcable.com>
-
-2001-03-16 Jani Taskinen <sniper@iki.fi>
-
- * ext/bz2/bz2.c: Make this extension compile again..
-
- * ext/ming/ming.c:
- Killed a compile warning + made ming extension compile with the older ming libs.
-
- * ext/ming/.cvsignore
- ext/ming/CREDITS: Missing files.
-
- * ext/ming/config.m4:
- Beutify + fix some errors in finding libs and header files.
-
-2001-03-15 Emiliano Heyns <emile@iris-advies.com>
-
- * ext/midgard/attachment.c: closing file after serving it.
-
-2001-03-15 Daniel Beulshausen <daniel@php4win.de>
-
- * ext/iconv/iconv.c: fix win32 build
-
-2001-03-15 Ulf Wendel <ulf.wendel@phpdoc.de>
-
- * pear/XML/Parser.php: - put the todo list into the inline docs
-
- * pear/XML/Render.php:
- - removed all methods that did the same like the (parent) methods in XML/Parse.php
- - added todo to the inline docs
-
- After this there's only one method left at all which tries to instantiate non existant classes. Can I move this code to the Experimental/ directory?
-
- * pear/XML/Parser.php: - made it work without warnings
- - handler methods are now configurable
- - added startHandler() and endHandler()
- "event" is the default handling mode and calls these methods. Implemented them
- as "abstract" methods.
-
- * pear/XML/Parser.php: Cleanup on parse (fclose()).
-
- * pear/XML/Parser.php:
- If the creation of the parser fails, the constructor "throws" an error by returning a XML_Parser_Error object. That means the user will get an object of the type XML_Parser_Error and the methods parse() and parseString() can't get called.
-
- * pear/XML/Parser.php: - lots of whitespace (tabs vs. spaces)
- - added basic inline docs
- - added error handling to the constructor
-
-2001-03-15 Emiliano Heyns <emile@iris-advies.com>
-
- * ext/midgard/midgard.c:
- Remove php_error for situations where Midgard is loaded but not configured
- (which is valid).
-
-2001-03-15 David Guerizec <david@guerizec.net>
-
- * ext/midgard/snippet.c: Snippet author is a string.
-
-2001-03-15 Sterling Hughes <sterling@designmultimedia.com>
-
- * ext/bz2/bz2.c: remove a little insanity.
-
- * ext/bz2/bz2.c
- ext/bz2/php_bz2.h:
- Bit of a cleanup, added some inline docs, decreased the amount of
- memory used.
-
-2001-03-15 Jon Parise <jon@csh.rit.edu>
-
- * ext/standard/credits.h: Whitespace (spaces to four-column tabs)
-
-2001-03-14 Ulf Wendel <ulf.wendel@phpdoc.de>
-
- * pear/Experimental/HTML/Menu.php: - code beatifiying
- - minor inline doc update
-
-2001-03-14 James Moore <James@phpuk.org>
-
- * ext/standard/credits.c
- ext/standard/credits.h
- ext/standard/info.h: Adding webteam to credits.
-
-2001-03-14 Jani Taskinen <sniper@iki.fi>
-
- * ext/fbsql/CREDITS: Forgot this one..
-
- * ext/fbsql/EXPERIMENTAL: Missing.
-
-2001-03-14 Sascha Schumann <sascha@schumann.cx>
-
- * ext/standard/browscap.c: Fix ZTS build
-
-2001-03-14 Emiliano Heyns <emile@iris-advies.com>
-
- * ext/midgard/article.c: Test parameter for existance before use.
-
-2001-03-14 Uwe Steinmann <Uwe.Steinmann@fernuni-hagen.de>
-
- * ext/hyperwave/hw.c: -fixed prototype and indention
-
-2001-03-13 Jani Taskinen <sniper@iki.fi>
-
- * ext/zziplib/zziplib.c:
- Make phpinfo() output prettier + kill some compile warnings.
-
-2001-03-13 Zeev Suraski <zeev@zend.com>
-
- * NEWS
- ext/standard/browscap.c:
- Make get_browser() read its information from $HTTP_SERVER_VARS[] if available
-
- * ext/mysql/php_mysql.c
- ext/mysql/php_mysql.h:
- Implement mysql_unbuffered_query() - uses mysql_use_result() instead of
- mysql_store_result()
-
-2001-03-13 Jani Taskinen <sniper@iki.fi>
-
- * ext/fbsql/config.m4: cleanup.
-
-2001-03-13 Jason Greene <jason@inetgurus.net>
-
- * ext/fbsql/config.m4:
- fix broken m4, you should have all checking code withing your withval test
-
- -Jason
-
-2001-03-13 Jani Taskinen <sniper@iki.fi>
-
- * ext/fbsql/config.m4: Extension was enabled by default..
-
-2001-03-13 Chuck Hagenbuch <chuck@horde.org>
-
- * ext/midgard/.cvsignore:
- cvs _knows_ to ignore the CVS directory; probably a bunch of these others,
- also...
-
-2001-03-13 Ulf Wendel <ulf.wendel@phpdoc.de>
-
- * pear/Experimental/HTML/Menu.php:
- API change: replaced getSitemap() with get("sitemap")
-
- * pear/Experimental/HTML/Menu.php: - fixed a rows bug
- - removed all \n
-
-2001-03-13 Zeev Suraski <zeev@zend.com>
-
- * ext/mysql/php_mysql.c: Centralize query code
-
- * ext/mysql/php_mysql.c: Use a container struct instead of MYSQL directly
-
-2001-03-13 Frank M. Kromann <frank@frontbase.com>
-
- * win32/php_modules.dsw: Adding FrontBase extension to modules
-
- * ext/fbsql/.cvsignore
- ext/fbsql/Makefile.in
- ext/fbsql/config.m4
- ext/fbsql/fbsql.dsp
- ext/fbsql/php_fbsql.c
- ext/fbsql/php_fbsql.h: Initial check-in of FrontBase extension
-
-2001-03-13 Stanislav Malyshev <stas@zend.com>
-
- * sapi/apache/mod_php4.c:
- Fix off-by-one on config values set from Apache config
-
-2001-03-13 Andrei Zmievski <andrei@ispi.net>
-
- * build/rules_pear.mk: Remove config.h instead of php_config.h
-
-2001-03-13 Colin Viebrock <colin@easydns.com>
-
- * pear/Net/Dig.php: add capability to define server in the constructor
-
-2001-03-13 Sascha Schumann <sascha@schumann.cx>
-
- * sapi/thttpd/thttpd.c: Replace memcpy and sprintf with smart_strs.
-
- * ext/session/session.c: buf is gone. Don't reference it.
-
-2001-03-13 Adam Dickmeiss <adam@indexdata.dk>
-
- * ext/yaz/php_yaz.c
- ext/yaz/php_yaz.h:
- Added yaz_database. Option bit ExtendedServices set for InitRequest.
-
-2001-03-13 Sascha Schumann <sascha@schumann.cx>
-
- * ext/session/session.c: Replace another sprintf
-
- * ext/session/mod_files.c
- ext/session/session.c:
- Nuke calls to sprintf, snprintf, strcat, strcpy and rely on
- memcpy and smart_strs.
-
-2001-03-13 Frank M. Kromann <frank@frontbase.com>
-
- * ext/pcre/php_pcre.c: Fixing compiler warning on win32
-
- * ext/mssql/php_mssql.c
- ext/mssql/php_mssql.h: Changed email
-
-2001-03-13 Zeev Suraski <zeev@zend.com>
-
- * NEWS: Update NEWS for the branch...
-
- * main/php_version.h
- configure.in: Rebranch
-
-2001-03-13 Daniel Beulshausen <daniel@php4win.de>
-
- * ext/printer/printer.c: nuke alot unnecessary globals fetches
-
-2001-03-13 David Guerizec <david@guerizec.net>
-
- * ext/midgard/preparser-scanner.l:
- fixed bug http://www.midgard-project.org/bugs/?id=135
-
-2001-03-13 Daniel Beulshausen <daniel@php4win.de>
-
- * main/reentrancy.c: fix bug in php_gmtime_r
-
-2001-03-13 David Guerizec <david@guerizec.net>
-
- * ext/midgard/preparser-scanner.l:
- Fixed a bug that prevented the preparser to expand any Midgard syntax formatter after a //-style comment anywhere in the page.
-
-2001-03-13 Andrei Zmievski <andrei@ispi.net>
-
- * ext/pcre/php_pcre.c
- ext/pcre/php_pcre.h:
- - IMPORTANT: removed /F modifier handling from preg_replace(). Instead
- one should use new preg_replace_callback() function.
-
-2001-03-13 Dave Hayden <dave@opaque.net>
-
- * ext/ming/ming.c
- ext/ming/php_ming.h:
- changed scalar args and returns to doubles, added Ming_setScale function,
- added SWFTEXTFIELD_HTML flag, fixed SWFTextField_setIndentation glitch
-
-2001-03-13 Ulf Wendel <ulf.wendel@phpdoc.de>
-
- * pear/Experimental/HTML/Menu.php: - added the PPHP licence text
- - final structure, seems to be bug free
- - usage example missing, I'm writing on a german language tutorial, will add the usage example as soon as the tutorial is finished
-
-2001-03-12 Ulf Wendel <ulf.wendel@phpdoc.de>
-
- * pear/Experimental/HTML/Menu.php:
- - extended "prevnext" mode to show the previous, up and next item (up is new)
-
-2001-03-12 Zeev Suraski <zeev@zend.com>
-
- * configure.in
- main/php_version.h: Start 4.0.5 release process...
-
-2001-03-12 Ulf Wendel <ulf.wendel@phpdoc.de>
-
- * pear/Experimental/HTML/Menu.php: - removed a typo
- - added the Isomenu feature "use which fits best" for the search of the selected item
-
- * pear/Experimental/HTML/Menu.php: - made 'tree' the default redering type
-
- * pear/Experimental/HTML/Menu.php:
- - made the URL check independend from $PHP_SELF
- - removed homepage specific code
-
-2001-03-12 Colin Viebrock <colin@easydns.com>
-
- * pear/Makefile.in: Forgot to add it here
-
- * pear/Net/Dig.php: A nice friendly OO interface to dig
-
-2001-03-12 Sean Bright <elixer@erols.com>
-
- * ext/mysql/php_mysql.c: Fixed prototype.
-
-2001-03-12 Alexander Feldman <alex@zend.com>
-
- * NEWS: Added NEWS.
-
- * ext/gd/gd.c: A small fix to make the function imageloadfont portable.
-
-2001-03-12 Stig Bakken <ssb@fast.no>
-
- * pear/DB/oci8.php: * added "@" in front of all OCI* function calls
-
-2001-03-12 David Guerizec <david@guerizec.net>
-
- * ext/midgard/article.c: added NULL-check
-
-2001-03-12 Stanislav Malyshev <stas@zend.com>
-
- * ext/standard/array.c: Prevent memory leak
-
-2001-03-12 Stig Bakken <ssb@fast.no>
-
- * pear/pear.m4:
- HEADS UP: renamed config header file in "phpize"d extensions to
- "config.h" rather than "php_config.h".
-
- * pear/DB/common.php: * bugfix (thanks to Alexey Borzov)
-
-2001-03-12 Stanislav Malyshev <stas@zend.com>
-
- * ext/standard/array.c: Use hash position with array_flip
-
-2001-03-12 Andrei Zmievski <andrei@ispi.net>
-
- * ext/standard/array.c: This will have to do until the docs come along.
-
- * ext/standard/array.c
- ext/standard/basic_functions.c
- ext/standard/php_array.h
- ext/pcre/php_pcre.c:
- - Added array_reduce(), which allows iterative reduction of an array
- to a single value via a callback function.
- - Added array_reduce(), which allows iterative reduction of an array
- to a single value via a callback function.
- - Fixed usage of zend_is_callable() in PCRE.
-
- * pear/Console/Getopt.php: Use proper class name.
-
-2001-03-12 Jani Taskinen <sniper@iki.fi>
-
- * ext/ldap/config.m4: Cleaning this a little bit.
-
- * ext/pdf/config.m4: ws fixes. Plus removed unnecessary AC_MSG_ calls.
-
- * ext/muscat/config.m4: ws fix.
-
-2001-03-11 David Guerizec <david@guerizec.net>
-
- * ext/midgard/config.m4
- ext/midgard/config.m4.session: fixed misplaced PHP_SUBST
-
- * ext/midgard/attachment.c
- ext/midgard/config.m4
- ext/midgard/config.m4.session:
- added PHP_SUBST(MIDGARD_SHARED_LIB) to dynamically link against libmidgard in config.m4
- removed debug info in attachments
-
-2001-03-11 Jon Parise <jon@csh.rit.edu>
-
- * pear/DB.php: Revised version of the parseDSN function.
-
- Submitted by: "Tomas V.V.Cox" <cox@idecnet.com>
-
-2001-03-11 David Guerizec <david@guerizec.net>
-
- * ext/midgard/attachment.c: added missing conversion.
-
- * ext/midgard/sitegroup.c: Added missing parameter.
-
-2001-03-11 Alexander Feldman <alex@zend.com>
-
- * NEWS
- ext/standard/config.m4
- ext/standard/file.c:
- Fixed a compatibility problem is some file functions (fgets, fputs, fread,
- fwrite). The ANSI standard says that if a file is opened in read/write
- mode, fseek() should be called before switching from reading to writing
- and vice versa.
-
-2001-03-11 Stig Bakken <ssb@fast.no>
-
- * pear/DB/tests/db_error.phpt
- pear/DB/tests/db_error2.phpt: * new line numbers
-
-2001-03-11 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * pear/Cache/Output.php: Updated example.
-
-2001-03-11 Jani Taskinen <sniper@iki.fi>
-
- * ext/sybase_ct/php_sybase_ct.c: Added missing alias. PR: #9550
-
- * ext/standard/basic_functions.c
- ext/standard/dns.c
- ext/standard/dns.h
- main/config.w32.h: HAVE_BINDLIB --> HAVE_LIBBIND
-
- * configure.in:
- Check for inet_aton only if libbind is not found (or inet_aton is not in
- libbind). Fixes bug: #8814
-
- * ext/curl/config.m4:
- If AC_CHECK_LIB fails, assume that --with-openssl is needed
-
-2001-03-10 Sascha Schumann <sascha@schumann.cx>
-
- * ext/ircg/ircg.c:
- Send pointless HTML, if nothing else happens to avoid timeouts.
-
- * ext/ircg/ircg.c:
- Increment the pointer and evaluate the next character after
- recognizing a modifier.
-
- * ext/ircg/ircg_scanner.c
- ext/ircg/ircg_scanner.re:
- Disable the speed-up role for now. Needs to be improved.
-
- * ext/ircg/ircg.c:
- Add 1 modifier which causes a JS-encoded string to be inserted
-
-2001-03-10 Emiliano Heyns <emile@iris-advies.com>
-
- * ext/midgard/attachment.c
- ext/midgard/element.c
- ext/midgard/event.c
- ext/midgard/eventmember.c
- ext/midgard/file.c
- ext/midgard/group.c
- ext/midgard/host.c
- ext/midgard/image.c
- ext/midgard/member.c
- ext/midgard/mgd_internal.h
- ext/midgard/midgard.c
- ext/midgard/page.c
- ext/midgard/pageelement.c
- ext/midgard/pagelink.c
- ext/midgard/php_midgard.h
- ext/midgard/preferences.c
- ext/midgard/snippet.c
- ext/midgard/snippetdir.c
- ext/midgard/style.c
- ext/midgard/topic.c: Fetch sitegroup field when listing objects
-
-2001-03-10 Jani Taskinen <sniper@iki.fi>
-
- * ext/mysql/config.m4:
- This should fix the problems with not including -lz.
-
-2001-03-10 Stig Bakken <ssb@fast.no>
-
- * pear/PEAR.php.in: * only register the destructor if it exists
-
-2001-03-10 Jon Parise <jon@csh.rit.edu>
-
- * pear/DB/pgsql.php:
- Make the #options, $tty, and $port parameters optional.
-
-2001-03-10 Rui Hirokawa <louis@cityfujisawa.ne.jp>
-
- * ext/pdf/pdf.c: just reversed a previous patch.
-
- * ext/pdf/pdf.c
- ext/iconv/iconv.c:
- initialized some strings in global variable structure.
-
-2001-03-09 Frank M. Kromann <frank@frontbase.com>
-
- * ext/odbc/php_odbc.c
- ext/odbc/php_odbc.h:
- Adding a new function odbc_next_result() allowing the query to return more than one result.
- This can be done with a stored procedure or by sending more than one select to the server.
-
- * ext/mssql/php_mssql.c
- ext/mssql/php_mssql.h:
- Adding a new function mssql_next_result() allowing the query to return more than one result.
- This can be done with a stored procedure or by sending more than one select to the server.
-
-2001-03-09 Andrei Zmievski <andrei@ispi.net>
-
- * ext/standard/basic_functions.c:
- - Fixed argument checking for call_user_func* functions and allowed
- specifying array($obj, 'method') syntax for call_user_func_array.
-
-2001-03-09 Sascha Schumann <sascha@schumann.cx>
-
- * ext/ircg/ircg.c:
- Add a format identifier for escaping %m, so that it can be safely used
- as a parameter for Javascript.
-
-2001-03-09 David Guerizec <david@guerizec.net>
-
- * ext/midgard/article.c: still a typo
-
- * ext/midgard/article.c: Fixed typo.
-
-2001-03-09 Ulf Wendel <ulf.wendel@phpdoc.de>
-
- * pear/Experimental/HTML/Menu.php
- pear/Experimental/README:
- Added a directory Experimental/ as no one said "no" on the PEAR list...
- - added a PHPlib menu2.inc rewrite
- - added a README for the directory with a policy for Experimental/
-
-2001-03-08 Sascha Schumann <sascha@schumann.cx>
-
- * ext/ircg/config.m4: s/--with-ircg/--with-ircg-config/
-
- * ext/ircg/config.m4: Refine complain message
-
-2001-03-08 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * pear/Cache/Error.php: This is 100% pure Ulf :-)
-
- * pear/Cache/Error.php: I think we need to load PEAR.php here.
-
-2001-03-08 Ulf Wendel <ulf.wendel@phpdoc.de>
-
- * pear/Cache.php
- pear/Cache/Container.php: Formatting and minor inline doc changes.
-
- * pear/Cache/Container/db.php
- pear/Cache/Container/file.php
- pear/Cache/Container/phplib.php
- pear/Cache.php
- pear/Cache/Container.php
- pear/Cache/Error.php: Added a basic Cache_Error class.
-
-2001-03-08 Sascha Schumann <sascha@schumann.cx>
-
- * ext/ircg/ircg_scanner.c
- ext/ircg/ircg_scanner.re: Fix underline handling
-
- * ext/ircg/ircg_scanner.c
- ext/ircg/ircg_scanner.re:
- Add handling for underline/bold control sequences
-
-2001-03-08 Stanislav Malyshev <stas@zend.com>
-
- * ext/recode/recode.c:
- Better use buffer_to_buffer, since zval is really buffer, not string (it can
- contain \0's and not end in \0).
-
-2001-03-08 Christian Stocker <chregu@nomad.ch>
-
- * pear/Cache/Container/db.php
- pear/Cache/Container/file.php
- pear/Cache/Container/phplib.php
- pear/Cache/Container.php
- pear/Cache/Output.php:
- Introduced getExpiresAbsolute($expire) function, which translates
- relative/human readable/unixtime expire-times in unixtime-format.
-
-2001-03-08 Zeev Suraski <zeev@zend.com>
-
- * win32/README.txt: *** empty log message ***
-
-2001-03-08 David Guerizec <david@guerizec.net>
-
- * ext/midgard/config.m4:
- Midgard experimental functions support was not displayed correctly in ./configure
-
- * ext/midgard/README.session: Forgot to talk about the session table
-
-2001-03-08 Zeev Suraski <zeev@zend.com>
-
- * win32/README.txt: Point people to the Windows mailing list...
-
-2001-03-08 David Guerizec <david@guerizec.net>
-
- * ext/midgard/README.session: Corrected the README.session
-
- * ext/midgard/README.session
- ext/midgard/config.m4.session
- ext/midgard/session.modules.c: More on session installation.
-
- * ext/midgard/article.c
- ext/midgard/mgd_session.h
- ext/midgard/session.c
- ext/midgard/session.sql: Session management (experimental code)
-
-2001-03-07 Sascha Schumann <sascha@schumann.cx>
-
- * ext/ircg/ircg.c
- ext/ircg/php_ircg.h: Add simplistic ircg_channel_mode() function
-
- * ext/ircg/ircg.c: D'oh. Check IRCG_API_VERSION after including if_irc.h.
-
- * ext/ircg/README.txt: Remove some dated information.
-
- * ext/ircg/ircg.c: Add default message for channel modes
-
- * ext/ircg/ircg.c: Move binary compat check to the module init function;
-
- Add initial support for channel modes.
-
- * ext/ircg/ircg.c:
- Safety check for now, this can later be used to add real binary
- compatibility by increasing the size of php_irconn_t appropiately.
-
- * ext/ircg/ircg.c:
- There are some subtle changes which are not recognized by the compiler,
- so bark, if someone tries to build against anything older than IRCG 2.0b1.
-
-2001-03-07 Daniel Beulshausen <daniel@php4win.de>
-
- * ext/zlib/zlib.c: add missing globals fetches
-
-2001-03-07 Frank M. Kromann <frank@frontbase.com>
-
- * main/main.c: Removing a compiler warning
-
-2001-03-07 Andrei Zmievski <andrei@ispi.net>
-
- * NEWS: That came from php-gtk.
-
-2001-03-07 Jani Taskinen <sniper@iki.fi>
-
- * sapi/cgi/cgi_main.c: Fixed the help for other options too.
-
-2001-03-07 Ben Mansell <ben@zeus.com>
-
- * sapi/isapi/php4isapi.c:
- Added support for Zeus SSL client certificate information.
- Added SERVER_SIGNATURE to the environment.
-
- Submitted by: daniel@zeus.com
-
-2001-03-07 Zeev Suraski <zeev@zend.com>
-
- * php.ini-dist
- php.ini-optimized
- NEWS: Update .ini's and NEWS
-
-2001-03-06 Zeev Suraski <zeev@zend.com>
-
- * ext/zlib/php_zlib.h
- ext/zlib/zlib.c: Implement internal output compression0:wq
-
- * ext/standard/output.c: Fix freeing of buffers
-
- * ext/standard/output.c: Fixes to internal output buffering
-
-2001-03-06 David Guerizec <david@guerizec.net>
-
- * ext/midgard/mgd_internal.h
- ext/midgard/midgard.c: added ability to break tree walking
-
-2001-03-06 Sascha Schumann <sascha@schumann.cx>
-
- * build/build2.mk
- configure.in:
- Replace AM_PROG_LEX with a separated call to AC_PROG_LEX and AC_DECL_YYTEXT.
- The latter is only called, if lex was found, so that PHP configures now
- on setups without (f)lex.
-
-2001-03-06 Zeev Suraski <zeev@zend.com>
-
- * ext/standard/output.c
- ext/standard/php_output.h: More internal output buffering fixes
-
- * ext/standard/output.c
- ext/standard/php_output.h: Fix internal output buffering
-
- * ext/standard/output.c
- ext/standard/php_output.h:
- Initial work on internal output handlers - should be much quicker
-
-2001-03-06 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * pear/Cache.php
- pear/Cache/Container.php
- pear/Cache/Container/db.php
- pear/Cache/Container/file.php
- pear/Cache/Container/phplib.php
- pear/Cache/Graphics.php
- pear/Cache/Output.php: Whitespace only.
-
-2001-03-06 Zeev Suraski <zeev@zend.com>
-
- * sapi/apache/mod_php4.c: Avoid using ret uninitialized
-
-2001-03-06 Ben Mansell <ben@zeus.com>
-
- * sapi/isapi/php4isapi.c:
- Thread hashtable was being initialized with a size of 1! Changed to 128 as
- a more sensible number.
-
-2001-03-06 Zeev Suraski <zeev@zend.com>
-
- * sapi/apache/mod_php4.c:
- Avoid writing to error_log in case of aborted connections.
-
-2001-03-06 Christian Stocker <chregu@nomad.ch>
-
- * pear/Cache/Container/file.php:
- deleteDir deletes now the created "group"-Directories as well.
- Hope it works on windows as well...
-
-2001-03-06 Stanislav Malyshev <stas@zend.com>
-
- * main/php_ini.c: Don't insert empty path if PHPRC is empty
-
-2001-03-06 Christian Stocker <chregu@nomad.ch>
-
- * pear/Cache/Container.php
- pear/Cache/Container/db.php
- pear/Cache/Container/phplib.php:
- replaced db->quoteString with addslashes
-
- adjusted encoding_mode = "slash" that it doesn't quote slashes, the
- save() function in phplib/db-container is now in charge for that.
-
-2001-03-06 Emiliano Heyns <emile@iris-advies.com>
-
- * ext/midgard/article.c
- ext/midgard/element.c
- ext/midgard/event.c
- ext/midgard/eventmember.c
- ext/midgard/file.c
- ext/midgard/group.c
- ext/midgard/host.c
- ext/midgard/page.c
- ext/midgard/pageelement.c
- ext/midgard/preferences.c
- ext/midgard/snippet.c
- ext/midgard/snippetdir.c
- ext/midgard/style.c
- ext/midgard/topic.c: Object integrity checks cleanup
-
- * ext/midgard/sitegroup.c: Bug #123
-
-2001-03-06 Sean Bright <elixer@erols.com>
-
- * ext/standard/file.c: Typo.
-
- * ext/standard/file.c:
- get_meta_tags now allows attributes that are not quoted as well as those
- that are. It follows the HTML 4.01 specification for attribute values
- outlined here -> http://www.w3.org/TR/html4/intro/sgmltut.html#h-3.2.2
-
-2001-03-05 Rainer Schaaf <rjs@pdflib.com>
-
- * ext/pdf/pdf.c: fixed bug in PDF_getbuffer (happend only on Windows)
- When using PDFlib V4.0 the pdf_set(grey/rgbcolor) functions are replaced
- by the PDFlib V4.0 function pdf_setcolor
-
-2001-03-05 Jani Taskinen <sniper@iki.fi>
-
- * sapi/cgi/cgi_main.c: Fix help text for -f
-
- * sapi/cgi/cgi_main.c:
- Can't output any error messages if there isn't any function initialized
- to do it..
-
-2001-03-05 Sean Bright <elixer@erols.com>
-
- * ext/standard/file.c:
- get_meta_tags now handles single quoted attributes as well as those that
- are double quoted.
-
-2001-03-04 Zeev Suraski <zeev@zend.com>
-
- * ext/standard/info.c:
- I don't know German, but I imagine that was the problem :)
-
-2001-03-04 Emiliano Heyns <emile@iris-advies.com>
-
- * ext/midgard/oop.c: Fetch sitegroup field if available
-
-2001-03-04 Zeev Suraski <zeev@zend.com>
-
- * ext/standard/info.c: Fix phpinfo() bug that crept in
-
- * ext/standard/output.c:
- Improve memory consumption on chunked output buffering
-
- * ext/zlib/php_zlib.h
- ext/zlib/zlib.c
- NEWS: Implemented chunked output buffering support - it's quite cool!
-
-2001-03-04 Martin Jansen <mail@martin-jansen.de>
-
- * pear/Cache.php: fixed typo
-
-2001-03-04 Frank M. Kromann <frank@frontbase.com>
-
- * ext/standard/info.c:
- Changed code layout to remove PHP warning when running php as a CGI.
-
-2001-03-04 Zeev Suraski <zeev@zend.com>
-
- * ext/standard/output.c
- ext/standard/php_output.h
- main/main.c: Fix non-thread safe mode
-
- * ext/standard/basic_functions.c
- ext/standard/basic_functions.h: this function will never return true...
-
- * ext/sablot/sablot.c
- ext/standard/output.c
- ext/standard/php_output.h:
- Improve chunked output buffering - the output handler now knows at which stage it is
-
- * sapi/cgi/cgi_main.c: whitespace fix
-
-2001-03-03 Chuck Hagenbuch <chuck@horde.org>
-
- * pear/Mail/RFC822.php: documentation/whitespace
-
- * pear/Mail/RFC822.php:
- Add a validate parameter that allows you to turn off validation of atoms.
- This lets you pass in an address list containing non-mime-encoded addresses,
- for example, and get back a correctly split-up list that you can then encode.
-
-2001-03-03 Sascha Schumann <sascha@schumann.cx>
-
- * ext/ircg/ircg_scanner.re
- ext/ircg/ircg.c:
- Finally fix the handler API to always pass smart_str's to the handlers.
-
- format_msg now takes smart_str's only as parameters.
-
- This easily saves a couple of million strlen's for one million
- messages.
-
-2001-03-03 Ulf Wendel <ulf.wendel@phpdoc.de>
-
- * pear/Cache.php: The main file with new features.
- - added support for cache dataset groups
- - added extSave() - see my next PEAR list posting
- - added getUserdata()
-
- * pear/Cache/Output.php: Made Output use the new features.
-
- * pear/Cache/Graphics.php: Renamed the class to follow PEAR's guides.
-
- * pear/Cache/Function.php:
- Changed the order of the inline module comment and the copyright stuff.
-
- Ok, I know this will lead to some discussion. But please let me change
- it so that PHPDoc works with it. Future version of PHPDoc will be able to
- handle the other order but this version... I'll redo my changed as well as
- soon as there is a new PHPDoc version.
-
- * pear/Cache/Container.php: PR:
- What does PR mean - Public Relations? Anyway: new cache structure/features
- - allowed to group cache datasets in a group
- - allowed to add userdata [CHAR(255)] to a dataset in the cache
-
- More explanations will follow on the PEAR list.
-
- Submitted by:
- Ulf Wendel <uw@php.net>
-
- Reviewed by:
- myself ;-)
- works on my development system and my homepage
-
- * pear/Cache/Container/shm.php: Updates for the new structure/featues
-
- * pear/Cache/Container/phplib.php:
- Changes for the new structure / features
-
- * pear/Cache/Container/file.php:
- Changes for the new cache structure / features.
- - added delDirectory() as a helper function for flush
- - new file format
-
- * pear/Cache/Container/db.php: Changes for the new cache structure
- - extended inline docs
- - extended calls to the still not existant call CacheError
- - several changed for the new cache structure
-
- WARNING: the code is untested, I don't have PEAR installed - Windows user.
-
-2001-03-03 Sascha Schumann <sascha@schumann.cx>
-
- * ext/ircg/ircg_scanner.c
- ext/ircg/ircg_scanner.re:
- 4-fold increase of ircg_mirc_color() with a single new rule.
-
- * ext/ircg/ircg.c: Improve the speed of format_msg() (5 fold increase).
-
- We are still spending too much time in ircg_mirc_color(). According
- to gprof on FreeBSD, it is something like 20% for encoding short
- plain text messages.
-
-2001-03-03 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * php.ini-dist:
- Jan says: 'Do not load php_gtk.dll through php.ini, only use dl(), otherwise it crashes (atleast on Win32).' Me thinks: 'There should be no crash, but a warning. Anyways, remove it from php.ini-dist, so others do not run into this... :-)
-
-2001-03-03 Ulf Wendel <ulf.wendel@phpdoc.de>
-
- * pear/Cache/Container/phplib.php:
- bugfix: idExists(), inline Doc changes: class doc
-
-2001-03-03 Sylvain PAGES <spages@free.fr>
-
- * ext/cybermut/cybermut.xml: - modified line 161 to be xml compliant
-
-2001-03-03 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * php.ini-dist: Whitespace only.
-
- * php.ini-dist:
- Whitespace Fixes. Added another Win32 extension DLL. Removed configuration for non-existent debugger.
-
- * php.ini-dist: Added some more Win32 extension DLLs.
-
- * pear/Benchmark/Iterate.php:
- Use call_user_func_array() in order to profile functions that take arguments.
-
- * pear/Benchmark/Timer.php: Whitespace only.
-
-2001-03-03 Sterling Hughes <sterling@designmultimedia.com>
-
- * ext/curl/curl.c: add a warn not available for curl_getinfo().
- remove unneccessary error checking.
-
-2001-03-02 Sascha Schumann <sascha@schumann.cx>
-
- * ext/ircg/ircg.c: Make use of the "zero-copy" write queue feature.
-
-2001-03-02 Andrei Zmievski <andrei@ispi.net>
-
- * ext/standard/basic_functions.c:
- - Forced call_user_method() and call_user_method_array() to take the
- object argument by reference.
- * Forced call_user_method() and call_user_method_array() to take the
- object argument by reference.
- * Also cleaned up the protos for those functions and brought
- call_user_method_array() into functional equivalence with
- call_user_method().
-
-2001-03-02 Martin Jansen <mail@martin-jansen.de>
-
- * pear/Benchmark/Iterate.php: - added check for existing bcmath extensions
- to Benchmark/Iterate.php
-
- - did some cosmetic changes to Benchmark/Iterate.php
-
-2001-03-02 Sascha Schumann <sascha@schumann.cx>
-
- * sapi/thttpd/thttpd.c: Combine all HTTP headers into a single writev
-
-2001-03-02 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * pear/Cache/Graphics.php
- pear/Cache/Output.php: Fixed small glitches.
-
-2001-03-02 Andi Gutmans <andi@zend.com>
-
- * sapi/nsapi/nsapi.c: - Commit NSAPI patches.
-
-2001-03-02 Ulf Wendel <ulf.wendel@phpdoc.de>
-
- * pear/Cache/Output.php:
- Sorry, removed my local settings. Will take some sleep before commiting again!
-
- * pear/Cache/Output.php:
- ... must forgot this commit - endGet(), $cache_id => $output_id
-
- - added endGet() which returns the output buffering content
- - changed $cache_id to $output_id seems to be a better name as the class
- is named Cache_Output
-
-2001-03-02 Christian Stocker <chregu@nomad.ch>
-
- * pear/Cache/Output.php:
- Wrong order of Parameters in $this->container->save();
- and $this->cache_id instead of $this->id on the same line
-
-2001-03-02 Zeev Suraski <zeev@zend.com>
-
- * ext/cybermut/.cvsignore
- ext/cybermut/Makefile.in
- ext/cybermut/config.m4
- ext/cybermut/cybermut.c
- ext/cybermut/cybermut.xml
- ext/cybermut/libs.mk
- ext/cybermut/php_cybermut.h
- ext/cybermut/tests/001.phpt:
- Add CyberMut extension from Sylvain PAGES <spages@free.fr>
-
-2001-03-02 Ulf Wendel <ulf.wendel@phpdoc.de>
-
- * pear/Cache/Container.php:
- - changed $max_age to an absolute timestamp value
-
- * pear/Cache/Container/db.php
- pear/Cache/Container/phplib.php:
- Added a warning on the usage of REPLACE INTO to the inline docs.
-
- * pear/Cache/Container/phplib.php:
- Fixed: MySQL data, expire, garbageCollection
-
- - forgot to mention for db.php and this file
- changed suggested SQL column type for content (data)
- from text to mediumtext
-
- * pear/Cache/Container/file.php: Fixed expire date bug.
-
- * pear/Cache/Container/db.php:
- Bugfixes: expire, encode()/decode(), MySQL data
-
- - the expire date should be saved as a timestamp with
- ($expire) ? $expire + time() : 0
-
- - always use encode(), decode() for data storage
-
- - the fieldname "data" is a reserved word in old MySQL versions,
- changed to "content"
-
-2001-03-02 Sergey Kartashoff <gluke@biosys.net>
-
- * ext/mnogosearch/README
- ext/mnogosearch/test.php:
- * ext/mnogosearch/php_mnogo.c
- ext/mnogosearch/test.php:
- UDM_ISPELL_TYPE_SERVER parameter in udm_load_ispell_data has been added
- to work with ispell server. This feature is available starting from
- mnoGoSearch 3.1.12 or later. Fixed Udm_Free_Ispell_Data(). Example updated.
-
-2001-03-02 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * pear/Cache/Output.php: Fixed typo.
-
- * pear/Cache.php: Whitespace only.
-
-2001-03-02 Thies C. Arntzen <thies@thieso.net>
-
- * ext/oci8/oci8.c: - Fixed binding of ROWIDs in OCI8.
-
-2001-03-02 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * pear/Cache/Function.php: Fixed example.
-
- * pear/Cache/Function.php: Added PHPDoc doccomments.
-
- * pear/Cache/Function.php: Make it work, hopefully.
-
- * pear/Cache/Function.php: Fixed typo.
-
- * pear/Cache/Function.php
- pear/Makefile.in: Added experimental version of Cache_Function module.
-
-2001-03-02 Jani Taskinen <sniper@iki.fi>
-
- * ext/standard/html.c: ws fix
-
-2001-03-01 Rainer Schaaf <rjs@pdflib.com>
-
- * ext/pdf/php_pdf.h
- ext/pdf/pdf.c: - integrated new functions vor PDFlib V4.0 (beta1)
- - all functions accepting strings now support binary strings, by calling
- the appropriate PDF*2() functions.
-
-2001-03-01 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * pear/Cache/Container/db.php: Added Chuck as author.
-
- * NEWS: Added note about PEAR/Cache.
-
- * pear/Cache/Graphics.php
- pear/Cache/Output.php: I have nothing to do with this code :-)
-
- * pear/Cache/Graphics.php
- pear/Cache/Output.php
- pear/Makefile.in: Added Graphics and Output Cache.
-
-2001-03-01 Chuck Hagenbuch <chuck@horde.org>
-
- * pear/Cache/Container/db.php: almost working version.
-
-2001-03-01 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * pear/Cache/Container/file.php
- pear/Cache/Container/phplib.php
- pear/Cache/Container/shm.php
- pear/Cache/Container.php: Added flushPreload() method.
-
-2001-03-01 Chuck Hagenbuch <chuck@horde.org>
-
- * pear/Makefile.in: missing a backslash
-
- * pear/Makefile.in: update the makefile for the new Cache classes.
-
- * pear/Cache/Cache.php
- pear/Cache/Container.php
- pear/Cache/Container/cache_container.php
- pear/Cache/Container/cache_container_file.php
- pear/Cache/Container/cache_container_phplib.php
- pear/Cache/Container/cache_container_shm.php
- pear/Cache/Container/file.php
- pear/Cache/Container/phplib.php
- pear/Cache/Container/shm.php
- pear/Cache.php:
- use standard naming/capitalization, and do a bit of error checking when
- instantiating the storage classfile.
-
-2001-03-01 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * pear/Cache/Container/cache_container_shm.php:
- Just hired Björn Schotte to foster the Shared Memory Cache Container implementation. He'll start working on it right away.
-
- * pear/Cache/Container/cache_container_phplib.php:
- Added Cache Container class for PHPLIB's database abstraction layer DB_Sql. I can't test this right now, but Ulf told me earlier today that it works fine.
-
- * pear/Cache/Cache.php
- pear/Cache/Container/cache_container.php
- pear/Cache/Container/cache_container_file.php
- pear/Cache/Function_Cache.php:
- Removed my old Function_Cache class implementation. Initial commit of the multi-purpose Cache System Ulf Wendel and I worked on the last couple of days. In this first phase I commit the Cache base class, the Cache Container Base class and the File-based Cache Container. During the next couple of hours I hope to finish the Cache Container classes for caching with PEAR/DB, PHPLIB/DB_Sql and Native MySQL Heap Table support. I also have working versions of classes extending Cache, namely Function_Cache, Graphics_Cache and Output_Cache. Bare with me, tomorrow at the latest PEAR/Cache will be a extensive and efficient means for general caching purposes, besides specialized caching for graphics.
-
-2001-03-01 Sergey Kartashoff <gluke@biosys.net>
-
- * ext/mnogosearch/php_mnogo.c
- ext/mnogosearch/test.php:
- UDM_PARAM_CROSS_WORDS mnoGoSearch extension session parameter has been
- added to use crosswords available since version 3.1.11 of mnogosearch.
- Example updated.
-
- * ext/mnogosearch/test.php
- NEWS:
- * ext/mnogosearch/php_mnogo.c
- ext/mnogosearch/php_mnogo.h
- ext/mnogosearch/test.php: Udm_Api_Version function has been added.
- Example updated.
-
- * ext/mnogosearch/php_mnogo.c
- ext/mnogosearch/php_mnogo.h
- ext/mnogosearch/test.php:
- Udm_Get_Doc_Count function from mnoGoSearch 3.1.11 has been added.
- mnoGoSearch library version printing in phpinfo() has been added.
- Example updated.
-
- * ext/mnogosearch/php_mnogo.c:
- Added UdmFreeEnv call to mnoGoSearch link list destructor to
- free memory allocated for environment.
-
-2001-03-01 Chuck Hagenbuch <chuck@horde.org>
-
- * ext/imap/config.m4
- ext/imap/php_imap.c:
- If php is compiled --with-imap-ssl, link in the SSL authenticator from
- c-client so that we can use php to make ssl imap connections.
-
-2001-02-28 David Guerizec <david@guerizec.net>
-
- * ext/midgard/attachment.c: function reference: attachments
-
-2001-02-28 Sascha Schumann <sascha@schumann.cx>
-
- * sapi/apache2filter/README
- sapi/apache2filter/sapi_apache2.c:
- httpd-2.0 cvs seems to be busted. I'm getting very strange backtraces
- and the header filter still seems to be broken. Will try later.
-
- * sapi/apache2filter/apache_config.c
- sapi/apache2filter/sapi_apache2.c:
- Now it actually loads, but it segfaults upon a request.
-
- * sapi/apache2filter/README
- sapi/apache2filter/apache_config.c
- sapi/apache2filter/config.m4
- sapi/apache2filter/php_apache.h
- sapi/apache2filter/sapi_apache2.c:
- Make the module compile again with the latest httpd-2.0 cvs.
-
-2001-02-28 Dan Kalowsky <dank@deadmime.org>
-
- * ext/imap/CREDITS: PR:
- Submitted by:
- Reviewed by:
- Obtained from:
-
-2001-02-28 David Guerizec <david@guerizec.net>
-
- * ext/midgard/midgard.c
- ext/midgard/oop.c
- ext/midgard/page.c
- ext/midgard/pageelement.c
- ext/midgard/pagelink.c
- ext/midgard/parameter.c
- ext/midgard/person.c
- ext/midgard/preferences.c
- ext/midgard/preparser.c
- ext/midgard/sitegroup.c
- ext/midgard/snippet.c
- ext/midgard/snippetdir.c
- ext/midgard/style.c
- ext/midgard/topic.c
- ext/midgard/article.c
- ext/midgard/attachment.c
- ext/midgard/calendar.c
- ext/midgard/element.c
- ext/midgard/event.c
- ext/midgard/eventmember.c
- ext/midgard/file.c
- ext/midgard/group.c
- ext/midgard/host.c
- ext/midgard/image.c
- ext/midgard/mail.c
- ext/midgard/member.c
- ext/midgard/mgd_article.h
- ext/midgard/mgd_attachment.h
- ext/midgard/mgd_calendar.h
- ext/midgard/mgd_element.h
- ext/midgard/mgd_event.h
- ext/midgard/mgd_eventmember.h
- ext/midgard/mgd_file.h
- ext/midgard/mgd_group.h
- ext/midgard/mgd_host.h
- ext/midgard/mgd_image.h
- ext/midgard/mgd_internal.h
- ext/midgard/mgd_mail.h
- ext/midgard/mgd_member.h
- ext/midgard/mgd_oop.h
- ext/midgard/mgd_page.h
- ext/midgard/mgd_pageelement.h
- ext/midgard/mgd_pagelink.h
- ext/midgard/mgd_person.h
- ext/midgard/mgd_preferences.h
- ext/midgard/mgd_preparser.h
- ext/midgard/mgd_sitegroup.h
- ext/midgard/mgd_snippet.h
- ext/midgard/mgd_snippetdir.h
- ext/midgard/mgd_style.h
- ext/midgard/mgd_topic.h: First step towards automatic documentation
-
-2001-02-27 Andi Gutmans <andi@zend.com>
-
- * ext/readline/readline.c
- ext/sablot/sablot.c
- ext/session/mod_user.c
- ext/standard/assert.c
- ext/xml/xml.c
- ext/oci8/oci8.c:
- - Pointed out by Andrei. zval_ptr_dtor() should be used instead of the
- zval_del_ref() function which should be nuked.
-
-2001-02-27 Ben Mansell <ben@zeus.com>
-
- * sapi/isapi/php4isapi.c:
- Added PHP_AUTH_USER, PHP_AUTH_PW and PHP_AUTH_TYPE environment variables
- for Zeus/ISAPI, so basic authenication works.
-
- Submitted by: daniel@zeus.com
-
-2001-02-27 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * TODO:
- PHP3_TLS_*() macros are no longer used in ext/dav/dav.c, ext/ldap/ldap.c.
-
-2001-02-27 Stanislav Malyshev <stas@zend.com>
-
- * TODO: ws fix
-
-2001-02-27 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * TODO:
- Daniel told me he is working on this one, and he is pretty close to finishing the job.
-
-2001-02-27 Stanislav Malyshev <stas@zend.com>
-
- * TODO: Add UNC in the "todo" list
-
-2001-02-27 Zeev Suraski <zeev@zend.com>
-
- * ext/standard/output.c
- ext/standard/php_output.h: Fix chunked output buffering support
-
-2001-02-26 Sascha Schumann <sascha@schumann.cx>
-
- * ext/ircg/ircg.c
- ext/ircg/php_ircg.h: Support for the new whois functionality in ircg
-
- * ext/ircg/config.m4:
- Improve the configure part of ircg a little bit; complain when ircg-config
- is not found. That lead to confusion in many cases.
-
- * ext/standard/basic_functions.c:
- Provide proper function aliases, if the sendmail functions
- don't exist.
-
- Submitted by: Nadir Amra <amra@us.ibm.com>
-
-2001-02-26 Andi Gutmans <andi@zend.com>
-
- * main/internal_functions.c.in
- main/internal_functions_win32.c
- main/php.h
- sapi/cgi/cgi_main.c
- ext/mcrypt/php_mcrypt.h
- ext/mhash/php_mhash.h
- ext/midgard/php_midgard.h
- ext/ovrimos/php_ovrimos.h
- ext/gettext/php_gettext.h
- ext/icap/php_icap.c
- ext/imap/php_imap.h
- ext/mcal/php_mcal.c
- configure.in:
- - Finally rename modules.h to zend_modules.h for consistency (first try
- was 2000-03-11).
- - Remove the first_arg_force_ref[]; and friends extern from php.h as they
- are included via zend_API.h
-
-2001-02-26 Dan Kalowsky <dank@deadmime.org>
-
- * ext/imap/php_imap.c:
- Removes two unnecessary REGISTER_MAIN_LONG_CONSTANT's.
-
-2001-02-26 Daniel Beulshausen <daniel@php4win.de>
-
- * main/php.h: nuke warnings
-
-2001-02-26 Andi Gutmans <andi@zend.com>
-
- * ext/standard/string.c: - Fix whitespace
-
-2001-02-26 Rui Hirokawa <louis@cityfujisawa.ne.jp>
-
- * ext/iconv/iconv.c: ob_iconv_handler changed to use for text data only.
-
-2001-02-26 Dan Kalowsky <dank@deadmime.org>
-
- * NEWS: PR:
- Submitted by:
- Reviewed by:
- Obtained from:
-
- * ext/imap/config.m4
- ext/imap/php_imap.c
- ext/imap/php_imap.h:
- Correctly checks for the proper header files, and excludes the QUOTA functions
- from non-imap2000 systems (unavailable for testing at this time).
- PR:
- Submitted by:
- Reviewed by: Sascha Schumann
- Obtained from:
-
-2001-02-26 James Moore <James@phpuk.org>
-
- * ext/standard/string.c:
- Fix for bug #9449 to stop infinate loop in wordwrap.
-
-2001-02-26 David Guerizec <david@guerizec.net>
-
- * ext/midgard/snippetdir.c: fixed bug #121
-
-2001-02-26 Andi Gutmans <andi@zend.com>
-
- * sapi/thttpd/thttpd.c
- scripts/conv_z_macros
- sapi/nsapi/nsapi.c
- sapi/phttpd/php_phttpd.h
- sapi/phttpd/phttpd.c
- sapi/pi3web/pi3web_sapi.c
- sapi/roxen/roxen.c
- sapi/servlet/formatter.java
- sapi/servlet/servlet.c
- sapi/servlet/servlet.java
- sapi/thttpd/php_thttpd.h
- sapi/caudium/caudium.c
- sapi/cgi/cgi_main.c
- sapi/fhttpd/fhttpd.c
- sapi/isapi/php4isapi.c
- sapi/apache/mod_php4.c
- sapi/apache/mod_php4.h
- sapi/apache/php_apache.c
- sapi/apache/sapi_apache.c
- sapi/apache2filter/apache_config.c
- sapi/apache2filter/php_apache.h
- sapi/apache2filter/php_functions.c
- sapi/apache2filter/sapi_apache2.c
- main/SAPI.h
- main/build-defs.h.in
- main/fopen_wrappers.c
- main/fopen_wrappers.h
- main/internal_functions.c.in
- main/internal_functions_registry.h
- main/internal_functions_win32.c
- main/main.c
- main/network.c
- main/php.h
- main/php_content_types.c
- main/php_globals.h
- main/php_ini.c
- main/php_ini.h
- main/php_logos.c
- main/php_main.h
- main/php_network.h
- main/php_open_temporary_file.c
- main/php_open_temporary_file.h
- main/php_reentrancy.h
- main/php_sprintf.c
- main/php_ticks.c
- main/php_ticks.h
- main/php_variables.c
- main/php_variables.h
- main/reentrancy.c
- main/rfc1867.c
- main/safe_mode.c
- main/snprintf.h
- sapi/aolserver/aolserver.c
- ext/yp/php_yp.h
- ext/yp/yp.c
- ext/zlib/php_zlib.h
- ext/zlib/zlib.c
- ext/zlib/zlib_fopen_wrapper.c
- ext/zziplib/php_zziplib.h
- ext/zziplib/zziplib.c
- main/SAPI.c
- ext/yaz/php_yaz.c
- ext/yaz/php_yaz.h
- ext/sysvshm/php_sysvshm.h
- ext/sysvshm/sysvshm.c
- ext/vpopmail/php_vpopmail.h
- ext/wddx/php_wddx_api.h
- ext/xml/php_xml.h
- ext/xml/xml.c
- ext/swf/swf.c
- ext/sybase/php_sybase_db.c
- ext/sybase/php_sybase_db.h
- ext/sybase_ct/php_sybase_ct.c
- ext/sybase_ct/php_sybase_ct.h
- ext/sysvsem/php_sysvsem.h
- ext/sysvsem/sysvsem.c
- ext/standard/iptc.c
- ext/standard/lcg.c
- ext/standard/levenshtein.c
- ext/standard/link.c
- ext/standard/mail.c
- ext/standard/math.c
- ext/standard/md5.c
- ext/standard/md5.h
- ext/standard/metaphone.c
- ext/standard/microtime.c
- ext/standard/microtime.h
- ext/standard/output.c
- ext/standard/pack.c
- ext/standard/pack.h
- ext/standard/pageinfo.c
- ext/standard/pageinfo.h
- ext/standard/php_array.h
- ext/standard/php_assert.h
- ext/standard/php_browscap.h
- ext/standard/php_crypt.h
- ext/standard/php_dir.h
- ext/standard/php_ext_syslog.h
- ext/standard/php_filestat.h
- ext/standard/php_fopen_wrapper.c
- ext/standard/php_fopen_wrappers.h
- ext/standard/php_image.h
- ext/standard/php_incomplete_class.h
- ext/standard/php_iptc.h
- ext/standard/php_lcg.h
- ext/standard/php_link.h
- ext/standard/php_mail.h
- ext/standard/php_math.h
- ext/standard/php_metaphone.h
- ext/standard/php_output.h
- ext/standard/php_parsedate.h
- ext/standard/php_rand.h
- ext/standard/php_smart_str.h
- ext/standard/php_smart_str_public.h
- ext/standard/php_standard.h
- ext/standard/php_string.h
- ext/standard/php_var.h
- ext/standard/quot_print.c
- ext/standard/quot_print.h
- ext/standard/rand.c
- ext/standard/reg.c
- ext/standard/reg.h
- ext/standard/scanf.c
- ext/standard/scanf.h
- ext/standard/soundex.c
- ext/standard/string.c
- ext/standard/syslog.c
- ext/standard/type.c
- ext/standard/type.h
- ext/standard/uniqid.c
- ext/standard/uniqid.h
- ext/standard/url.c
- ext/standard/url.h
- ext/standard/url_scanner.c
- ext/standard/url_scanner.h
- ext/standard/url_scanner_ex.c
- ext/standard/url_scanner_ex.h
- ext/standard/url_scanner_ex.re
- ext/standard/var.c
- ext/swf/php_swf.h
- ext/standard/crc32.c
- ext/standard/credits.c
- ext/standard/credits.h
- ext/standard/crypt.c
- ext/standard/cyr_convert.c
- ext/standard/cyr_convert.h
- ext/standard/datetime.c
- ext/standard/datetime.h
- ext/standard/dir.c
- ext/standard/dl.c
- ext/standard/dl.h
- ext/standard/dns.c
- ext/standard/dns.h
- ext/standard/exec.c
- ext/standard/exec.h
- ext/standard/file.c
- ext/standard/file.h
- ext/standard/filestat.c
- ext/standard/flock_compat.c
- ext/standard/flock_compat.h
- ext/standard/formatted_print.c
- ext/standard/fsock.c
- ext/standard/fsock.h
- ext/standard/ftp_fopen_wrapper.c
- ext/standard/head.c
- ext/standard/head.h
- ext/standard/html.c
- ext/standard/html.h
- ext/standard/http_fopen_wrapper.c
- ext/standard/image.c
- ext/standard/incomplete_class.c
- ext/standard/info.c
- ext/standard/info.h
- ext/shmop/php_shmop.h
- ext/shmop/shmop.c
- ext/snmp/php_snmp.h
- ext/snmp/snmp.c
- ext/sockets/php_sockets.h
- ext/sockets/sockets.c
- ext/standard/array.c
- ext/standard/assert.c
- ext/standard/base64.c
- ext/standard/base64.h
- ext/standard/basic_functions.c
- ext/standard/basic_functions.h
- ext/standard/browscap.c
- ext/sablot/php_sablot.h
- ext/sablot/sablot.c
- ext/satellite/Makefile.in
- ext/satellite/class.c
- ext/satellite/class.h
- ext/satellite/common.c
- ext/satellite/common.h
- ext/satellite/corba.c
- ext/satellite/corba.h
- ext/satellite/enum.c
- ext/satellite/enum.h
- ext/satellite/findtype.c
- ext/satellite/findtype.h
- ext/satellite/hashtable.c
- ext/satellite/hashtable.h
- ext/satellite/namedvalue_to_zval.c
- ext/satellite/namedvalue_to_zval.h
- ext/satellite/object.c
- ext/satellite/object.h
- ext/satellite/php_orbit.c
- ext/satellite/php_orbit.h
- ext/satellite/struct.c
- ext/satellite/struct.h
- ext/satellite/typecode.c
- ext/satellite/typecode.h
- ext/satellite/typemanager.c
- ext/satellite/typemanager.h
- ext/satellite/zval_to_namedvalue.c
- ext/satellite/zval_to_namedvalue.h
- ext/session/mod_files.c
- ext/session/mod_mm.c
- ext/session/mod_user.c
- ext/session/mod_user.h
- ext/session/session.c
- ext/readline/php_readline.h
- ext/readline/readline.c
- ext/recode/php_recode.h
- ext/printer/php_printer.h
- ext/printer/printer.c
- ext/pspell/php_pspell.h
- ext/pspell/pspell.c
- ext/qtdom/qtdom.c
- ext/qtdom/qtdom.h
- ext/pdf/php_pdf.h
- ext/pfpro/pfpro.c
- ext/pfpro/php_pfpro.h
- ext/pgsql/pgsql.c
- ext/pgsql/php_pgsql.h
- ext/ovrimos/ovrimos.c
- ext/pcre/php_pcre.c
- ext/pcre/php_pcre.h
- ext/pdf/pdf.c
- ext/openssl/openssl.c
- ext/openssl/php_openssl.h
- ext/oracle/oracle.c
- ext/oci8/php_oci8.h
- ext/odbc/php_odbc.c
- ext/odbc/php_odbc.h
- ext/odbc/php_velocis.h
- ext/odbc/velocis.c
- ext/notes/php_notes.h
- ext/oci8/oci8.c
- ext/mysql/php_mysql.c
- ext/mysql/php_mysql.h
- ext/notes/php_notes.c
- ext/msql/php_msql.c
- ext/msql/php_msql.h
- ext/mssql/php_mssql.c
- ext/mssql/php_mssql.h
- ext/mcrypt/mcrypt.c
- ext/mhash/mhash.c
- ext/ming/ming.c
- ext/ming/php_ming.h
- ext/java/reflect.java
- ext/ldap/ldap.c
- ext/ldap/php_ldap.h
- ext/mcal/php_mcal.c
- ext/interbase/interbase.c
- ext/interbase/php_interbase.h
- ext/ircg/ircg.c
- ext/ircg/ircg_scanner.c
- ext/ircg/ircg_scanner.re
- ext/ircg/php_ircg.h
- ext/java/java.c
- ext/ingres_ii/ii.c
- ext/ingres_ii/ii.h
- ext/ingres_ii/php_ii.h
- ext/iisfunc/iisfunc.cpp
- ext/iisfunc/iisfunc.h
- ext/iisfunc/setup.c
- ext/iisfunc/setup.h
- ext/imap/php_imap.c
- ext/informix/ifx.ec
- ext/hyperwave/hg_comm.c
- ext/hyperwave/hg_comm.h
- ext/hyperwave/hw.c
- ext/hyperwave/hw_error.h
- ext/hyperwave/php_hyperwave.h
- ext/iconv/iconv.c
- ext/iconv/php_iconv.h
- ext/gd/gd.c
- ext/gd/gdt1.c
- ext/gd/gdt1.h
- ext/gd/php_gd.h
- ext/gettext/gettext.c
- ext/gettext/php_gettext.h
- ext/gmp/gmp.c
- ext/gmp/php_gmp.h
- ext/filepro/filepro.c
- ext/filepro/php_filepro.h
- ext/fribidi/fribidi.c
- ext/fribidi/php_fribidi.h
- ext/domxml/php_domxml.h
- ext/dotnet/dotnet.cpp
- ext/exif/exif.c
- ext/exif/php_exif.h
- ext/fdf/fdf.c
- ext/fdf/php_fdf.h
- ext/db/db.c
- ext/db/php_db.h
- ext/dbase/dbase.c
- ext/dbase/php_dbase.h
- ext/domxml/php_domxml.c
- ext/curl/curl.c
- ext/curl/php_curl.h
- ext/com/COM.c
- ext/com/typedef_VARIANT.c
- ext/ctype/ctype.c
- ext/ctype/php_ctype.h
- ext/bz2/bz2.c
- ext/bz2/php_bz2.h
- ext/calendar/cal_unix.c
- ext/calendar/calendar.c
- ext/calendar/easter.c
- ext/ccvs/ccvs.c
- ext/ccvs/ccvs.h
- dynlib.m4
- ext/aspell/aspell.c
- ext/aspell/php_aspell.h
- ext/bcmath/bcmath.c
- ext/bcmath/php_bcmath.h
- run-tests.php: - Fix copyright notices with 2001
-
-2001-02-25 David Guerizec <david@guerizec.net>
-
- * ext/midgard/midgard.c:
- force user to pass $xparam by reference (from mgd_walk_xxx_tree() functions)
-
-2001-02-25 Sascha Schumann <sascha@schumann.cx>
-
- * ext/ircg/ircg.c: Provide improved means for mass joins
-
-2001-02-25 David Guerizec <david@guerizec.net>
-
- * ext/midgard/article.c
- ext/midgard/midgard.c
- ext/midgard/page.c
- ext/midgard/topic.c: optimized the mgd_is_in_xxx_tree() functions
-
-2001-02-25 Sascha Schumann <sascha@schumann.cx>
-
- * ext/ircg/ircg.c
- ext/ircg/php_ircg.h: Add function for kick and topic
-
-2001-02-25 Dan Kalowsky <dank@deadmime.org>
-
- * ext/imap/config.m4
- ext/imap/php_imap.c
- ext/imap/php_imap.h:
- Updating the IMAP client to include quota support via the imap c-client2000 libraries.
- Removes the SA_QUOTA and SA_QUOTA_ALL defines
- Cleans up the imap_status() function to remove notion of quotas in a status message.
-
- Changes the config.m4 to support the client.h include
- Changed the directory search order for the include files as well.
-
- (PHP imap_get_quota) Added
- (PHP imap_set_quota) Added
-
-
- PR:
- Submitted by:
- Reviewed by:
- Obtained from:
-
-2001-02-24 Sascha Schumann <sascha@schumann.cx>
-
- * ext/standard/datetime.c:
- Don't assume that tzname exists, if tm_zone does not exist.
-
- PR: #9380
-
- * main/network.c:
- Declare inet_aton properly, if the system lacks support for it.
-
- PR: #9382
-
-2001-02-24 David Guerizec <david@guerizec.net>
-
- * ext/midgard/mgd_internal.h
- ext/midgard/midgard.c
- ext/midgard/oop.c
- ext/midgard/php_midgard.h: fixed the error reporting.
- added custom log to the lib
-
-2001-02-24 Sascha Schumann <sascha@schumann.cx>
-
- * ext/standard/basic_functions.c
- ext/standard/php_ext_syslog.h
- ext/standard/syslog.c
- main/php_syslog.h: Actually compile on systems without syslog.
-
- PR: #9412
-
- * sapi/cgi/cgi_main.c:
- php_register_command_line_global_vars only needs file scope.
-
- * sapi/cgi/cgi_main.c
- sapi/servlet/servlet.c:
- Neither the CGI nor the Servlet SAPI module call syslog, so remove
- references to the syslog include files.
-
- * ext/ircg/ircg.c:
- Replace the sixth and seventh parameter of ircg_pconnect()
- with a connection-detail array. Currently, you can set
- realname, password, ident. Those information are used
- during the connection setup process.
-
-2001-02-24 David Guerizec <david@guerizec.net>
-
- * ext/midgard/page.c: fixed a possible memory leak
-
- * ext/midgard/article.c
- ext/midgard/calendar.c
- ext/midgard/event.c
- ext/midgard/person.c
- ext/midgard/topic.c: fixed some possible memory leaks.
-
-2001-02-24 Sascha Schumann <sascha@schumann.cx>
-
- * sapi/aolserver/README:
- Change the default to assumption that people don't use AOLserver 3.0 anymore.
-
- * ext/ircg/ircg.c: Add the ability to set a connection password
-
-2001-02-24 David Guerizec <david@guerizec.net>
-
- * ext/midgard/mgd_preparser.h: Fixed some potential and real segfaults.
-
- * ext/midgard/preparser-parser.y
- ext/midgard/preparser-scanner.l:
- passing include()'ed files thru the preparser.
-
-2001-02-23 David Guerizec <david@guerizec.net>
-
- * ext/midgard/config.m4
- ext/midgard/preparser.c:
- - workaround for the function mgd_eval() to return a value like the PHP eval().
- - changed --with-mgd-experimental to --enable-mgd-experimental
-
-2001-02-23 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * win32/php4dll.dsp
- win32/php4dllts.dsp: That should do the trick.
-
-2001-02-23 Sascha Schumann <sascha@schumann.cx>
-
- * main/main.c
- main/php.h
- sapi/cgi/cgi_main.c
- sapi/servlet/servlet.c
- ext/standard/dir.c
- ext/standard/file.c
- ext/standard/filestat.c
- ext/standard/image.c
- ext/zlib/zlib.c
- ext/zlib/zlib_fopen_wrapper.c
- main/Makefile.in
- ext/dbase/dbase.c
- ext/filepro/filepro.c
- ext/hyperwave/hw.c
- ext/db/db.c: Finish fopen-wrappers rename.
-
- * ext/fribidi/config.m4: Fix another instance of the == bug.
-
- * ext/midgard/config.m4:
- Note that the equality operator in the Bourne shell is a single =,
- unlike C/C++/PHP.
-
-2001-02-23 David Guerizec <david@guerizec.net>
-
- * ext/midgard/config.m4:
- Added --with-mgd-experimental option to compile experimental stuff (off by defeult)
-
-2001-02-23 Sergey Kartashoff <gluke@biosys.net>
-
- * ext/mnogosearch/test.php: mnogosearch example updated.
-
- * ext/mnogosearch/php_mnogo.c
- ext/mnogosearch/php_mnogo.h:
- Added ispell loading routines and date search limits in mnogosearch module.
-
-2001-02-23 David Guerizec <david@guerizec.net>
-
- * ext/midgard/oop.c: another typo.
-
- * ext/midgard/midgard.c: removed unneeded header inclusion.
-
- * ext/midgard/oop.c: typo fixed.
-
- * ext/midgard/midgard.c:
- Removed constants registration, added a conversion table $midgard->types[$objtype]
- try var_dump($midgard) for more details
-
-2001-02-23 André Langhorst <A.Langhorst@itbnet.de>
-
- * ext/standard/exec.c:
- fix stas' last commit, added additional ifdefs PHP_SIGCHILD to fix win32 build
-
-2001-02-23 David Guerizec <david@guerizec.net>
-
- * ext/midgard/preparser-scanner.l:
- misbehavior of the preparser that translated (eg) myeval() into mymgd_eval()
-
-2001-02-22 David Guerizec <david@guerizec.net>
-
- * ext/midgard/midgard.c: Registering Midgard constants.
-
-2001-02-22 Hartmut Holzgraefe <hartmut@six.de>
-
- * tests/strings/003.phpt: removed LC_* warnin
-
-2001-02-22 David Guerizec <david@guerizec.net>
-
- * ext/midgard/article.c
- ext/midgard/calendar.c
- ext/midgard/event.c
- ext/midgard/group.c
- ext/midgard/mgd_group.h
- ext/midgard/mgd_internal.h
- ext/midgard/midgard.c
- ext/midgard/page.c
- ext/midgard/person.c
- ext/midgard/topic.c: Added mgd_walk_group_tree() function
-
-2001-02-22 Chuck Hagenbuch <chuck@horde.org>
-
- * pear/Mail/SMTP.php
- pear/Mail/Sendmail.php
- pear/Mail/sendmail.php
- pear/Mail/smtp.php
- pear/Mail.php
- pear/Makefile.in:
- factory-generated classes have lowercase subclass names by our (newly
- revised) standards.
-
-2001-02-22 David Guerizec <david@guerizec.net>
-
- * ext/midgard/event.c
- ext/midgard/mgd_event.h
- ext/midgard/mgd_internal.h
- ext/midgard/midgard.c:
- Added custom sort on mgd_walk_xxx_tree() function.
-
-2001-02-22 Sergey Kartashoff <gluke@biosys.net>
-
- * ext/mnogosearch/README: README for mnoGoSearch module updated.
-
-2001-02-22 Andi Gutmans <andi@zend.com>
-
- * main/main.c: - Fix indentation and remove comment.
-
-2001-02-22 Sergey Kartashoff <gluke@biosys.net>
-
- * ext/mnogosearch/php_mnogo.c
- ext/mnogosearch/test.php:
- Added Ispell routines to work with Ispell data loaded into sql tables.
- Example updated.
-
-2001-02-22 Stanislav Malyshev <stas@zend.com>
-
- * ext/standard/string.c: Safer bin2hex
-
- * ext/standard/exec.c: Fix #8992, patch by yasushi_takahashi@tsuken.co.jp
-
-2001-02-22 Uwe Steinmann <Uwe.Steinmann@fernuni-hagen.de>
-
- * ext/hyperwave/hw.c:
- - took out the HwSLS_FETCH to make it compile again on Unix
- Is this really neccesary at this point?
-
-2001-02-22 Jon Parise <jon@csh.rit.edu>
-
- * ext/standard/crypt.c:
- The php_rand() and php_srand() functions added in the previous commit
- require the inclusion of php_rand.h.
-
-2001-02-22 James Moore <James@phpuk.org>
-
- * ext/standard/array.c
- ext/standard/crypt.c
- ext/standard/php_rand.h
- ext/standard/rand.c:
- Adding php_rand() and php_srand(seed) as a wrapper around random, lrand48 and rand.
-
-2001-02-21 Shane Caraveo <shane@php.net>
-
- * ext/mysql/php_mysql.c:
- Initalize some of the global vars. Crashed under ms debugger without having them initialized.
-
-2001-02-21 James Moore <James@phpuk.org>
-
- * win32/php4dllts.dsp:
- Adding crypt.c and php_crypt.h to win32 builds, they were missing..
-
-2001-02-21 Rainer Schaaf <rjs@pdflib.com>
-
- * ext/pdf/pdf.c:
- When using pdf_get_buffer() and doing a correct cleanup by calling pdf_delete()
- this always resulted in a coredump (after everything was finished, so only
- visible in the logfile).
- So it seems to be neccesary to copy the contents of the result of get_buffer,
- to avoid this coredump.
-
-2001-02-21 Emiliano Heyns <emile@iris-advies.com>
-
- * ext/midgard/Makefile.in
- ext/midgard/article.c
- ext/midgard/attachment.c
- ext/midgard/element.c
- ext/midgard/event.c
- ext/midgard/eventmember.c
- ext/midgard/file.c
- ext/midgard/group.c
- ext/midgard/host.c
- ext/midgard/image.c
- ext/midgard/member.c
- ext/midgard/mgd_oop.h
- ext/midgard/midgard.c
- ext/midgard/oop.c
- ext/midgard/page.c
- ext/midgard/pageelement.c
- ext/midgard/pagelink.c
- ext/midgard/person.c
- ext/midgard/preferences.c
- ext/midgard/sitegroup.c
- ext/midgard/snippet.c
- ext/midgard/snippetdir.c
- ext/midgard/style.c
- ext/midgard/topic.c: Centralized object fetching for get_object_by_guid
-
-2001-02-21 Shane Caraveo <shane@php.net>
-
- * main/main.c:
- zend_compile_file returns a NULL on error, check for that before
- calling destroy_op_array unless we like crashes :-)
-
-2001-02-21 Thies C. Arntzen <thies@thieso.net>
-
- * ext/imap/php_imap.c: fix possible leak.
-
-2001-02-21 Sascha Schumann <sascha@schumann.cx>
-
- * sapi/thttpd/thttpd.c:
- If we cannot send the header, we don't need to continue with the page.
-
- * ext/ircg/ircg.c:
- Allow users to set the ident string which we use to register with
- the IRC server.
-
-2001-02-21 Chuck Hagenbuch <chuck@horde.org>
-
- * pear/PHPDoc/renderer/html/PhpdocHTMLDocumentRenderer.php: fix typo
-
-2001-02-21 Stig Bakken <ssb@fast.no>
-
- * ext/odbc/config.m4: * dbmaker fix, shared support
-
-2001-02-21 Andrei Zmievski <andrei@ispi.net>
-
- * ext/standard/array.c: Fix memory leak.
-
-2001-02-21 Stanislav Malyshev <stas@zend.com>
-
- * main/php_ini.c: Add safety check
-
-2001-02-21 David Guerizec <david@guerizec.net>
-
- * ext/midgard/midgard.c: used dynamic alloc to avoid segfault ;)
-
-2001-02-21 Hartmut Holzgraefe <hartmut@six.de>
-
- * main/php_ini.h
- main/php_ini.c:
-2001-02-21 Sascha Schumann <sascha@schumann.cx>
-
- * sapi/cgi/php_getopt.h:
- There is no need to declare ap_php_(opterr|optopt) with external linkage
- as they are not used outside of getopt.c.
-
- PR: #9364
-
- * acinclude.m4:
- Instead of assuming that sendmail lives in /usr/lib, if we don't find it,
- we also check /usr/lib now.
-
- PR: #9362
-
- * ext/standard/file.c
- ext/standard/filestat.c:
- Correctly check for the existence of the st_rdev field.
-
- Note that this field is required to exist for SUSv3 conformance.
-
- Submitted by: amra@us.ibm.com
- PR: #9358
-
- * ext/pcre/config.m4: Preprocessor stuff should go into CPPFLAGS.
-
-2001-02-21 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * NEWS: Added note about PCRE update.
-
-2001-02-21 Jason Greene <jason@inetgurus.net>
-
- * NEWS: Corrected News entry.
-
-2001-02-21 Hartmut Holzgraefe <hartmut@six.de>
-
- * main/main.c
- main/php_ini.c:
- will now initialize dynamic extensions *after* static ones
-
-2001-02-21 Emiliano Heyns <emile@iris-advies.com>
-
- * ext/midgard/config.m4:
- Source files explicitly include midgard/something.h
-
-2001-02-21 David Guerizec <david@guerizec.net>
-
- * ext/midgard/midgard.c: more explicit variable names.
-
- * ext/midgard/article.c
- ext/midgard/mgd_article.h
- ext/midgard/mgd_internal.h
- ext/midgard/mgd_midgard.h
- ext/midgard/mgd_page.h
- ext/midgard/mgd_snippetdir.h
- ext/midgard/mgd_style.h
- ext/midgard/mgd_topic.h
- ext/midgard/midgard.c
- ext/midgard/page.c
- ext/midgard/snippetdir.c
- ext/midgard/style.c
- ext/midgard/topic.c: mgd_walk_xxx_tree() functions implemented.
-
-2001-02-20 Emiliano Heyns <emile@iris-advies.com>
-
- * ext/midgard/midgard.c:
- Argh, that's what init_globals does. Sorry, on auto-pilot fixing things
- in both midgard-php3 and midgard-php4
-
- * ext/midgard/midgard.c: Initialize globals to NULL at module init
-
-2001-02-20 Stig Bakken <ssb@fast.no>
-
- * pear/DB.php:
- * allow empty passwords in dsn (for example "mysql://user:@database")
-
-2001-02-20 Zeev Suraski <zeev@zend.com>
-
- * ext/com/COM.c: Fix Win32 build
-
-2001-02-20 Andrei Zmievski <andrei@ispi.net>
-
- * ext/pcre/config.m4: Enable UTF8 support (incomplete) by default.
-
- * ext/pcre/pcrelib/pcre.h: Include PHP compatibility header file.
-
- * ext/pcre/pcrelib/doc/Tech.Notes
- ext/pcre/pcrelib/doc/pcre.3
- ext/pcre/pcrelib/doc/pcre.html
- ext/pcre/pcrelib/doc/pcre.txt
- ext/pcre/pcrelib/doc/pcregrep.1
- ext/pcre/pcrelib/doc/pcregrep.html
- ext/pcre/pcrelib/doc/pcregrep.txt
- ext/pcre/pcrelib/doc/pcreposix.3
- ext/pcre/pcrelib/doc/pcreposix.html
- ext/pcre/pcrelib/doc/pcreposix.txt
- ext/pcre/pcrelib/doc/pcretest.txt
- ext/pcre/pcrelib/doc/perltest.txt
- ext/pcre/pcrelib/doc/pgrep.1
- ext/pcre/pcrelib/doc/pgrep.html
- ext/pcre/pcrelib/doc/pgrep.txt
- ext/pcre/pcrelib/testdata/testinput1
- ext/pcre/pcrelib/testdata/testinput2
- ext/pcre/pcrelib/testdata/testinput3
- ext/pcre/pcrelib/testdata/testinput4
- ext/pcre/pcrelib/testdata/testinput5
- ext/pcre/pcrelib/testdata/testinput6
- ext/pcre/pcrelib/testdata/testoutput1
- ext/pcre/pcrelib/testdata/testoutput2
- ext/pcre/pcrelib/testdata/testoutput3
- ext/pcre/pcrelib/testdata/testoutput4
- ext/pcre/pcrelib/testdata/testoutput5
- ext/pcre/pcrelib/testdata/testoutput6
- ext/pcre/pcrelib/pcre.h
- ext/pcre/pcrelib/pcregrep.c
- ext/pcre/pcrelib/pcreposix.c
- ext/pcre/pcrelib/pcreposix.h
- ext/pcre/pcrelib/pcretest.c
- ext/pcre/pcrelib/perltest
- ext/pcre/pcrelib/perltest8
- ext/pcre/pcrelib/pgrep.c
- ext/pcre/pcrelib/COPYING
- ext/pcre/pcrelib/ChangeLog
- ext/pcre/pcrelib/INSTALL
- ext/pcre/pcrelib/LICENCE
- ext/pcre/pcrelib/NEWS
- ext/pcre/pcrelib/README
- ext/pcre/pcrelib/RunTest
- ext/pcre/pcrelib/get.c
- ext/pcre/pcrelib/internal.h
- ext/pcre/pcrelib/pcre.c: Upgrade PCRE to version 3.4.
-
-2001-02-20 Daniel Beulshausen <daniel@php4win.de>
-
- * ext/standard/fsock.c
- ext/standard/fsock.h: proper prefix for lookup_hostname
-
- * win32/php_modules.dsw
- ext/hyperwave/hyperwave.dsp
- ext/hyperwave/php_hyperwave.h
- ext/hyperwave/hg_comm.c
- ext/hyperwave/hw.c: make hyperwave build under win32
-
- * ext/standard/fsock.h
- ext/standard/fsock.c: make socket functions available to the outside
-
- * ext/standard/image.c
- ext/gd/php_gd.h
- ext/gd/gd.c
- ext/gd/gd.dsp: make gd work again under win32
-
- * ext/ldap/ldap.dsp: add configuration which links again libsasl.lib
-
-2001-02-20 Jason Greene <jason@inetgurus.net>
-
- * ext/standard/array.c:
- Changed default behavior of array_search to match in_array
- (strict was default on, and is now default off)
-
-2001-02-20 David Eriksson <david@2good.com>
-
- * ext/satellite/typemanager.c:
- Patch for inherited interfaces by Daniel Stodden <stodden@in.tum.de>
-
-2001-02-20 Daniel Beulshausen <daniel@php4win.de>
-
- * ext/pgsql/pgsql.c: added missing ELS_FETCH()
-
- * ext/iconv/iconv.dsp: define HAVE_LIBICONV
-
-2001-02-20 David Eriksson <david@2good.com>
-
- * ext/satellite/object.c: Stop leaking ParameterType data
-
-2001-02-20 Daniel Beulshausen <daniel@php4win.de>
-
- * win32/php_modules.dsw
- ext/swf/swf.dsp: no swf under win32
-
-2001-02-20 David Eriksson <david@2good.com>
-
- * ext/satellite/config.m4: Corrected typo in config.m4
-
-2001-02-20 Daniel Beulshausen <daniel@php4win.de>
-
- * ext/zlib/zlib.dsp:
- changed zlibstat.lib -> zlib.lib, which is the correct name
-
-2001-02-20 Andrei Zmievski <andrei@ispi.net>
-
- * ext/standard/array.c
- ext/standard/basic_functions.c
- ext/standard/php_array.h: Rename to array_search().
-
-2001-02-20 Adam Dickmeiss <adam@indexdata.dk>
-
- * ext/yaz/php_yaz.c: Yet another bug fix regarding present.
-
-2001-02-20 Emiliano Heyns <emile@iris-advies.com>
-
- * ext/midgard/mgd_access.h
- ext/midgard/mgd_preparser.h
- ext/midgard/php_midgard.h
- ext/midgard/config.m4: Header file moved.
-
-2001-02-20 Sergey Kartashoff <gluke@biosys.net>
-
- * ext/mnogosearch/php_mnogo.c
- ext/mnogosearch/test.php:
- Phrase search support has been added to mnogosearch extenstion.
- Min_word_len and Max_word_len support has been added to mnogosearch
- extension. Example updated.
-
-2001-02-20 Emiliano Heyns <emile@iris-advies.com>
-
- * ext/midgard/mail.c
- ext/midgard/preparser-parser.y
- ext/midgard/preparser.c: header file moved
-
- * ext/midgard/.cvsignore: ignore *.la
-
- * ext/midgard/php_midgard.h
- ext/midgard/preparser.c: Header files moved
-
-2001-02-20 David Guerizec <david@guerizec.net>
-
- * ext/midgard/oop.c
- ext/midgard/sitegroup.c: a few fixes on function mis-behavior.
-
-2001-02-20 Jason Greene <jason@inetgurus.net>
-
- * ext/standard/array.c
- ext/standard/basic_functions.c
- ext/standard/php_array.h:
- Moved the core of in_array into the function php_search_array, which is called by
- in_array and search_array (new)
-
-
-2001-02-20 Zeev Suraski <zeev@zend.com>
-
- * win32/php4dllts.dsp: Restore COM.c
-
-2001-02-20 Chuck Hagenbuch <chuck@horde.org>
-
- * pear/Mail/RFC822.php: use -1 to specify no limit on number of matches.
-
-2001-02-19 Derick Rethans <d.rethans@jdimedia.nl>
-
- * ext/standard/rand.c:
- - Fix for bug 9277, two the same boundaries make sense in some cases
-
-2001-02-19 Adam Dickmeiss <adam@indexdata.dk>
-
- * ext/yaz/php_yaz.c:
- Bug fix: number of records in yaz_range wrongly set to zero.
-
-2001-02-19 David Guerizec <david@guerizec.net>
-
- * ext/midgard/attachment.c: Small typo fixed.
-
-2001-02-19 Sascha Schumann <sascha@schumann.cx>
-
- * ext/pgsql/config.m4
- ext/pgsql/pgsql.c
- ext/pgsql/php_pgsql.h: Simpler fix for the InvalidOid thing by Tom Lane.
-
- He assured me that InvalidOid has always expanded to (Oid) 0, so this
- should be safe.
-
-2001-02-19 David Guerizec <david@guerizec.net>
-
- * ext/midgard/article.c
- ext/midgard/page.c
- ext/midgard/topic.c: fixed bug #81, for more details, see:
- http://www.midgard-project.org/bugs/?id=81
-
-2001-02-19 Hartmut Holzgraefe <hartmut@six.de>
-
- * ext/zziplib/php_zziplib.h
- ext/zziplib/zziplib.c:
-2001-02-19 Stig Bakken <ssb@fast.no>
-
- * pear/DB/tests/pgsql/011.phpt
- pear/DB/tests/transactions.inc
- pear/DB/ibase.php
- pear/DB/msql.php
- pear/DB/mssql.php
- pear/DB/mysql.php
- pear/DB/oci8.php
- pear/DB/odbc.php
- pear/DB/pgsql.php
- pear/DB/sybase.php
- pear/DB/common.php: also added "dsn" property in all backends
-
-2001-02-19 Sascha Schumann <sascha@schumann.cx>
-
- * sapi/thttpd/thttpd.c:
- Include <sys/uio.h>. Apparently, the header cleanup in glibc 2.2.2
- caused that file to be included by accident.
-
- * ext/pgsql/config.m4
- ext/pgsql/php_pgsql.h: Fix incompatibility with PostgreSQL CVS.
-
- We now perform a check whether we need to include <postgres.h> to
- succesfully compile.
-
- PR: #9328
-
- * ext/pgsql/pgsql.c: Fix warning
-
- * ext/pgsql/config.m4: Allow passing relative paths to --with-pgsql
-
-2001-02-19 Stig Bakken <ssb@fast.no>
-
- * pear/DB/tests/oci8/.cvsignore: ignore "sqlnet.log" file
-
- * pear/DB/tests/pgsql/002.phpt
- pear/DB/tests/pgsql/README
- pear/DB/tests/pgsql/connect.inc
- pear/DB/tests/pgsql/mktable.inc
- pear/DB/tests/fetchmodes.inc
- pear/DB/tests/fetchrow.inc
- pear/DB/tests/ibase/.cvsignore
- pear/DB/tests/ibase/002.phpt
- pear/DB/tests/ibase/connect.inc
- pear/DB/tests/ibase/mktable.inc
- pear/DB/tests/ibase/skipif.inc
- pear/DB/tests/mysql/002.phpt
- pear/DB/tests/mysql/README
- pear/DB/tests/mysql/mktable.inc
- pear/DB/tests/odbc/002.phpt
- pear/DB/tests/odbc/mktable.inc:
- * added "fetchRow returns NULL at end of resultset" tests
-
- * pear/DB/tests/numrows.inc
- pear/DB/tests/oci8/001.phpt
- pear/DB/tests/oci8/002.phpt
- pear/DB/tests/oci8/003.phpt
- pear/DB/tests/oci8/004.phpt
- pear/DB/tests/oci8/005.phpt
- pear/DB/tests/oci8/006.phpt
- pear/DB/tests/oci8/007.phpt
- pear/DB/tests/oci8/008.phpt
- pear/DB/tests/oci8/009.phpt
- pear/DB/tests/oci8/010.phpt
- pear/DB/tests/oci8/connect.inc
- pear/DB/tests/oci8/mktable.inc
- pear/DB/tests/oci8/skipif.inc:
- * added oci8 tests (haven't run them myself yet)
-
- * pear/DB/tests/db_error.phpt
- pear/DB/tests/db_error2.phpt: updated some line numbers
-
- * pear/DB/odbc.php
- pear/DB/pgsql.php
- pear/DB/storage.php: odbc.php: load "odbc" extension on demand
- pgsql.php: unix domain socket support (set hostname to "unix")
- storage.php: inherit PEAR
-
-2001-02-18 Sascha Schumann <sascha@schumann.cx>
-
- * sapi/thttpd/thttpd.c:
- Save 50% of the syscalls when writing the HTTP header.
-
-2001-02-18 Thies C. Arntzen <thies@thieso.net>
-
- * ext/standard/fsock.c: [p]fsockopen: fixed possible leak
-
-2001-02-18 David Guerizec <david@guerizec.net>
-
- * ext/midgard/midgard.c: allow execution of 'normal' php scripts
-
-2001-02-18 Thies C. Arntzen <thies@thieso.net>
-
- * ext/standard/string.c: fixed buffer-overwrite
-
-2001-02-18 Sascha Schumann <sascha@schumann.cx>
-
- * ext/ircg/config.m4:
- ircg creates a convenient script now. of course, this is incompatible
- to older ircg versions. if someone else would have created ircg, I
- probably would hate him.
-
-2001-02-18 Thies C. Arntzen <thies@thieso.net>
-
- * ext/imap/php_imap.c: fixed a possible double-free
-
-2001-02-18 Jon Parise <jon@csh.rit.edu>
-
- * pear/CODING_STANDARDS:
- Go back to listing the copyright years explicitly (instead of using a
- range).
-
-2001-02-18 Ulf Wendel <ulf.wendel@phpdoc.de>
-
- * pear/PHPDoc/xmlwriter/PhpdocXMLWriter.php:
- Sorry, whitespace only changes to follow the PEAR Coding conventions. Replaced tabs with spaces.
-
-2001-02-18 Egon Schmid <eschmid@s.netic.de>
-
- * ext/interbase/interbase.c
- ext/mysql/php_mysql.c: Typos in protos.
-
-2001-02-18 Ulf Wendel <ulf.wendel@phpdoc.de>
-
- * pear/PHPDoc/xmlreader/PhpdocXMLReader.php
- pear/PHPDoc/xmlexporter/PhpdocXMLClassExporter.php
- pear/PHPDoc/xmlexporter/PhpdocXMLDocumentExporter.php
- pear/PHPDoc/xmlexporter/PhpdocXMLExporter.php
- pear/PHPDoc/xmlexporter/PhpdocXMLIndexExporter.php
- pear/PHPDoc/xmlexporter/PhpdocXMLModuleExporter.php
- pear/PHPDoc/xmlexporter/PhpdocXMLWarningExporter.php:
- Sorry, whitespace only changes to follow the PEAR Coding conventions. Replaced tabs with spaces.
-
-2001-02-18 Harald Radi <h.radi@nme.at>
-
- * ext/com/typedef_VARIANT.c:
- export global constants for codepage and variant type
- VT_* and CP_*
-
- * ext/com/conversion.c:
- added a few more variant types for zval <-> variant conversion
-
- * ext/com/COM.cpp:
- - Added new object VARIANT() to encapsulate values for use with
- the COM and DOTNET module. Therefore it is now possible to pass
- values by reference, convert php values to extended variant types (currency,
- date, idispatch, iunknown, ...) and define the codepage that should
- be used for unicode - conversion.
-
- * ext/com/CREDITS: added myself to CREDITS
-
-2001-02-18 Ulf Wendel <ulf.wendel@phpdoc.de>
-
- * pear/PHPDoc/warning/PhpdocWarning.php
- pear/PHPDoc/renderer/html/PhpdocHTMLClassRenderer.php
- pear/PHPDoc/renderer/html/PhpdocHTMLDocumentRenderer.php
- pear/PHPDoc/renderer/html/PhpdocHTMLIndexRenderer.php
- pear/PHPDoc/renderer/html/PhpdocHTMLModuleRenderer.php
- pear/PHPDoc/renderer/html/PhpdocHTMLRenderer.php
- pear/PHPDoc/renderer/html/PhpdocHTMLRendererManager.php
- pear/PHPDoc/renderer/html/PhpdocHTMLWarningRenderer.php
- pear/PHPDoc/renderer/PhpdocRendererObject.php:
- Sorry, whitespace only changes to follow the PEAR Coding conventions. Replaced tabs with spaces.
-
-2001-02-18 Stig Bakken <ssb@fast.no>
-
- * pear/DB/oci8.php: * use "hostspec" dsn parameter as SID if specified
-
- * pear/DB/common.php: * added "persistent" option
-
-2001-02-18 Ulf Wendel <ulf.wendel@phpdoc.de>
-
- * pear/PHPDoc/indexer/PhpdocIndexer.php
- pear/PHPDoc/filehandler/PhpdocFileHandler.php
- pear/PHPDoc/exceptions/PhpdocError.php
- pear/PHPDoc/core/Phpdoc.php
- pear/PHPDoc/core/PhpdocArgvHandler.php
- pear/PHPDoc/core/PhpdocObject.php
- pear/PHPDoc/core/PhpdocSetupHandler.php
- pear/PHPDoc/analyser/PhpdocAnalyser.php
- pear/PHPDoc/analyser/PhpdocClassAnalyser.php
- pear/PHPDoc/analyser/PhpdocModuleAnalyser.php
- pear/PHPDoc/accessor/PhpdocAccessor.php
- pear/PHPDoc/accessor/PhpdocClassAccessor.php
- pear/PHPDoc/accessor/PhpdocDocumentAccessor.php
- pear/PHPDoc/accessor/PhpdocIndexAccessor.php
- pear/PHPDoc/accessor/PhpdocModuleAccessor.php
- pear/PHPDoc/accessor/PhpdocWarningAccessor.php:
- Sorry, whitespace only changes to follow the PEAR Coding conventions. Replaced tabs with spaces.
-
- * pear/PHPDoc/parser/PhpdocParserRegExp.php
- pear/PHPDoc/parser/PhpdocParserTags.php
- pear/PHPDoc/parser/PhpdocUseParser.php
- pear/PHPDoc/parser/PhpdocVariableParser.php
- pear/PHPDoc/parser/PhpdocClassParser.php
- pear/PHPDoc/parser/PhpdocConstantParser.php
- pear/PHPDoc/parser/PhpdocFunctionParser.php
- pear/PHPDoc/parser/PhpdocModuleParser.php
- pear/PHPDoc/parser/PhpdocParser.php
- pear/PHPDoc/parser/PhpdocParserCore.php:
- Sorry, whitespace only changes to follow the PEAR Coding conventions. Replaces tabs with spaces.
-
-2001-02-18 Sascha Schumann <sascha@schumann.cx>
-
- * ext/ircg/ircg.c: Remove unnecessary assignment which caused a segfault
-
- * ext/ircg/ircg.c: Set from for MSG_FMT_SELF_PART
-
-2001-02-18 Thies C. Arntzen <thies@thieso.net>
-
- * ext/oci8/oci8.c:
- - Fixed crash in OCI8 when using unitialized LOBs. (Thies)
-
-2001-02-18 Sascha Schumann <sascha@schumann.cx>
-
- * ext/ircg/ircg.c: Add code for user-quit hook
-
- * ext/ircg/ircg.c:
- irc_write_buf_del() performs a final flush now, if the fd is not dead yet.
-
- afterwards we perform a shutdown() on the socket, so that thttpd
- notices that the socket is to be closed. Otherwise, we might do
- two close()s which is bad (as the fd might be reused in the meantime).
-
- * ext/ircg/ircg.c:
- Close an apparent race which caused HTTP connections to stay open,
- even though the IRC server refused to let us login.
-
-2001-02-18 David Croft <david@infotrek.co.uk>
-
- * header: add year 2001 to header
-
-2001-02-18 Emiliano Heyns <emile@iris-advies.com>
-
- * ext/midgard/.cvsignore:
- Simplifying .cvsignore (and losing some fat on the way)
-
-2001-02-18 Sascha Schumann <sascha@schumann.cx>
-
- * ext/ircg/ircg.c:
- Add a new format string identifier 'r' which inserts the raw message.
-
- Also port the ctcp copy function to the hash_ex API as per Andi's
- suggestion.
-
-2001-02-17 Emiliano Heyns <emile@iris-advies.com>
-
- * ext/midgard/eventmember.c
- ext/midgard/file.c
- ext/midgard/group.c
- ext/midgard/host.c
- ext/midgard/image.c
- ext/midgard/mail.c
- ext/midgard/member.c
- ext/midgard/mgd_access.h
- ext/midgard/mgd_article.h
- ext/midgard/mgd_attachment.h
- ext/midgard/mgd_calendar.h
- ext/midgard/mgd_element.h
- ext/midgard/mgd_errno.pl
- ext/midgard/mgd_event.h
- ext/midgard/mgd_eventmember.h
- ext/midgard/mgd_file.h
- ext/midgard/mgd_group.h
- ext/midgard/mgd_host.h
- ext/midgard/mgd_image.h
- ext/midgard/mgd_internal.h
- ext/midgard/mgd_mail.h
- ext/midgard/mgd_member.h
- ext/midgard/mgd_midgard.h
- ext/midgard/mgd_oop.h
- ext/midgard/mgd_page.h
- ext/midgard/mgd_pageelement.h
- ext/midgard/mgd_pagelink.h
- ext/midgard/mgd_person.h
- ext/midgard/mgd_preferences.h
- ext/midgard/mgd_preparser.h
- ext/midgard/mgd_sitegroup.h
- ext/midgard/mgd_snippet.h
- ext/midgard/mgd_snippetdir.h
- ext/midgard/mgd_style.h
- ext/midgard/mgd_topic.h
- ext/midgard/midgard.c
- ext/midgard/mkall
- ext/midgard/oop.c
- ext/midgard/page.c
- ext/midgard/pageelement.c
- ext/midgard/pagelink.c
- ext/midgard/parameter.c
- ext/midgard/person.c
- ext/midgard/php_midgard.h
- ext/midgard/preferences.c
- ext/midgard/preparser-parser.y
- ext/midgard/preparser-scanner.l
- ext/midgard/preparser.c
- ext/midgard/sitegroup.c
- ext/midgard/snippet.c
- ext/midgard/snippetdir.c
- ext/midgard/style.c
- ext/midgard/topic.c
- ext/midgard/.cvsignore
- ext/midgard/ChangeLog
- ext/midgard/INSTALL
- ext/midgard/Makefile.in
- ext/midgard/article.c
- ext/midgard/attachment.c
- ext/midgard/calendar.c
- ext/midgard/config.m4
- ext/midgard/element.c
- ext/midgard/event.c:
- Remove/Add appearantly doesn't cancel the remove... add separately.
-
- * ext/midgard/ChangeLog
- ext/midgard/INSTALL
- ext/midgard/LICENSE
- ext/midgard/Makefile.in
- ext/midgard/access.c
- ext/midgard/article.c
- ext/midgard/attachment.c
- ext/midgard/calendar.c
- ext/midgard/config.m4
- ext/midgard/element.c
- ext/midgard/event.c
- ext/midgard/eventmember.c
- ext/midgard/file.c
- ext/midgard/fudge
- ext/midgard/genentry.pl
- ext/midgard/group.c
- ext/midgard/host.c
- ext/midgard/image.c
- ext/midgard/mail.c
- ext/midgard/member.c
- ext/midgard/mgd_access.h
- ext/midgard/mgd_article.h
- ext/midgard/mgd_attachment.h
- ext/midgard/mgd_calendar.h
- ext/midgard/mgd_element.h
- ext/midgard/mgd_errno.c
- ext/midgard/mgd_errno.h
- ext/midgard/mgd_errno.pl
- ext/midgard/mgd_event.h
- ext/midgard/mgd_eventmember.h
- ext/midgard/mgd_file.h
- ext/midgard/mgd_group.h
- ext/midgard/mgd_host.h
- ext/midgard/mgd_image.h
- ext/midgard/mgd_internal.h
- ext/midgard/mgd_mail.h
- ext/midgard/mgd_member.h
- ext/midgard/mgd_midgard.h
- ext/midgard/mgd_oop.h
- ext/midgard/mgd_page.h
- ext/midgard/mgd_pageelement.h
- ext/midgard/mgd_pagelink.h
- ext/midgard/mgd_person.h
- ext/midgard/mgd_preferences.h
- ext/midgard/mgd_preparser.h
- ext/midgard/mgd_sitegroup.h
- ext/midgard/mgd_snippet.h
- ext/midgard/mgd_snippetdir.h
- ext/midgard/mgd_style.h
- ext/midgard/mgd_topic.h
- ext/midgard/midgard-root.php
- ext/midgard/midgard.c
- ext/midgard/mkall
- ext/midgard/oop.c
- ext/midgard/page.c
- ext/midgard/pageelement.c
- ext/midgard/pagelink.c
- ext/midgard/parameter.c
- ext/midgard/person.c
- ext/midgard/php4_porting.txt
- ext/midgard/php_midgard.h
- ext/midgard/preferences.c
- ext/midgard/preparser-parser.y
- ext/midgard/preparser-scanner.l
- ext/midgard/preparser.c
- ext/midgard/sitegroup.c
- ext/midgard/snippet.c
- ext/midgard/snippetdir.c
- ext/midgard/style.c
- ext/midgard/topic.c:
- Trimming, license change (said GPL, actually is LGPL) removed warnings during
- compilation, removed configure bug.
-
- * ext/midgard/.cvsignore: Added generated files
-
-2001-02-17 Sascha Schumann <sascha@schumann.cx>
-
- * ext/ircg/ircg.c:
- Also format CTCP correctly when sending it to the server.
-
- This is still quite ugly but works already quite well.
-
- * ext/ircg/ircg.c:
- Add initial CTCP handling and fix a possible segfault in ircg_msg()
-
-2001-02-17 Chuck Hagenbuch <chuck@horde.org>
-
- * pear/DB/mysql.php
- pear/DB/pgsql.php:
- consistently supress error messages from $connect_function
- in mysql and pgsql.
-
-2001-02-17 Thies C. Arntzen <thies@thieso.net>
-
- * ext/oci8/oci8.c: make oci work again.
-
-2001-02-17 Sascha Schumann <sascha@schumann.cx>
-
- * ext/ircg/ircg.c
- ext/ircg/php_ircg.h: Convert to the new hooks-based callback system.
-
- Also add a facility to change our own nick as well as tracking other
- nick changes.
-
-2001-02-17 Harald Radi <h.radi@nme.at>
-
- * ext/dotnet/dotnet.cpp
- ext/com/COM.cpp
- ext/com/conversion.c
- ext/com/conversion.h
- ext/com/typedef_VARIANT.c: multiple codepage support
- export global constants
-
-2001-02-16 Sascha Schumann <sascha@schumann.cx>
-
- * NEWS: Add some old and some recent news
-
- * ext/ircg/ircg_scanner.c
- ext/ircg/ircg_scanner.re:
- Reverse the priority of the entity matches vs. anything. If it sees
- a single entity, it should handle it immediately.
-
- * ext/ircg/ircg.c
- ext/ircg/ircg_scanner.c
- ext/ircg/ircg_scanner.re:
- Move the separate entity encoding into the scanner. Otherwise,
- we cannot properly differentiate between (apparent) HTML which was
- generated by the IRC user vs. the scanner.
-
-2001-02-16 David Guerizec <david@guerizec.net>
-
- * ext/midgard/logo/midgard-logo.gif:
- deleting logo to slim down the Midgard extension
-
- * ext/midgard/midgard-logo.h
- ext/midgard/midgard-team.h
- ext/midgard/midgard.c:
- deleting logo & picture to slim down the Midgard extension
-
-2001-02-16 Zeev Suraski <zeev@zend.com>
-
- * ext/notes/php_notes.h
- ext/notes/notes.dsp
- ext/notes/notes.dsw
- ext/notes/php_notes.c: import notes modules from Brad Atkins
-
-2001-02-16 Sascha Schumann <sascha@schumann.cx>
-
- * ext/ircg/Makefile.in
- ext/ircg/ircg.c
- ext/ircg/ircg_scanner.c
- ext/ircg/ircg_scanner.re:
- The new scanner adds HTML anchors automatically to a certain subset
- of RFC 2396 URIs. The scanner also handles mIRC color codes.
-
- * ext/standard/php_smart_str.h
- ext/standard/php_smart_str_public.h:
- Add all necessary includes for these header files.
-
-2001-02-16 Stig Bakken <ssb@fast.no>
-
- * pear/DB/mysql.php: * load mysql extension if needed
-
-2001-02-16 Chuck Hagenbuch <chuck@horde.org>
-
- * pear/DB/mysql.php
- pear/DB/oci8.php
- pear/DB/odbc.php
- pear/DB/pgsql.php
- pear/DB/sybase.php
- pear/DB.php
- pear/DB/ibase.php
- pear/DB/msql.php
- pear/DB/mssql.php:
- All DB modules should return NULL from fetchRow() now if there are no more
- results, and a DB_Error object only on an error.
-
- DB::isError() return false when passed null now.
-
-2001-02-16 Ben Mansell <ben@zeus.com>
-
- * sapi/isapi/php4isapi.c:
- Fixed non-threadsafe code: 'isapi_special_server_variables' was a static
- buffer, and not allocated per-connection. Bad bad bad!
-
-2001-02-16 Jani Taskinen <sniper@iki.fi>
-
- * ext/curl/curl.c:
- Fixed a typo in constant definitions and a possible crash in curl_setopt().
-
-2001-02-16 Egon Schmid <eschmid@s.netic.de>
-
- * ext/standard/file.c: Wrong return type.
-
-2001-02-15 Egon Schmid <eschmid@s.netic.de>
-
- * ext/standard/filestat.c: Small typo.
-
-2001-02-15 Sterling Hughes <sterling@designmultimedia.com>
-
- * ext/swf/php_swf.h
- ext/swf/swf.c
- ext/bz2/bz2.c
- ext/bz2/php_bz2.h
- ext/curl/curl.c
- ext/curl/php_curl.h
- ext/sablot/php_sablot.h
- ext/sablot/sablot.c: Change e-mail address
-
-
-2001-02-15 Thies C. Arntzen <thies@thieso.net>
-
- * ext/standard/file.c
- ext/standard/iptc.c
- ext/oci8/oci8.c
- ext/pdf/pdf.c
- ext/cpdf/cpdf.c
- ext/gd/gd.c
- ext/gd/gd_ctx.c
- ext/hyperwave/hw.c
- ext/interbase/interbase.c:
- i nuked all unneded calls to php_header() - i'm not too sure how we do
- handle HEAD Requests as they were only detected via php_header(). but calling
- php_header from a module makes output-buffering unusable.
-
- NOTICE: there is some EBSDIC stuff in gd.c - i think it's obsolete.
-
- * ext/standard/string.c: 0..255
-
- * ext/xml/xml.c:
- fixed SEGFAULT when using xml_set_object. Zend does not yes support
- cyclic references!
-
-2001-02-15 Sergey Kartashoff <gluke@biosys.net>
-
- * ext/mnogosearch/php_mnogo.c
- ext/mnogosearch/test.php:
- Added thow new mnoGoSearch agent session parameters:
- UDM_PARAM_WEIGHT_FACTOR and UDM_PARAM_WORD_MATCH.
-
-2001-02-15 Sascha Schumann <sascha@schumann.cx>
-
- * configure.in
- ext/standard/basic_functions.c
- ext/standard/dir.c
- ext/standard/php_dir.h:
- There might be more systems which do not support chroot, so we check
- for the existence of it.
-
- Additionally, if chroot is not supported, the warn_not_available function
- is invoked now.
-
-2001-02-15 Zeev Suraski <zeev@zend.com>
-
- * ext/pgsql/pgsql.c: Fix the PostgreSQL fix...
-
-2001-02-15 Derick Rethans <d.rethans@jdimedia.nl>
-
- * ext/standard/basic_functions.c
- ext/standard/dir.c
- ext/standard/php_dir.h: - chroot does not work on windows
-
-2001-02-14 Jani Taskinen <sniper@iki.fi>
-
- * ext/oci8/config.m4
- ext/oracle/config.m4:
- This should make detecting the version of Oracle libs a bit more accurate
- to avoid the 'missing libcore4' errors. (e.g. on AIX)
- Bug reports: #9027, #8905
-
-2001-02-14 Chuck Hagenbuch <chuck@horde.org>
-
- * pear/Mail/RFC822.php:
- current php4 cvs doesn't like having a limit of 0 specified in preg_split;
- it seems to take it as meaning no matches at all.
-
-2001-02-14 Jon Parise <jon@csh.rit.edu>
-
- * ext/mnogosearch/config.m4: Fix build.
-
-2001-02-14 Sergey Kartashoff <gluke@biosys.net>
-
- * ext/mnogosearch/config.m4:
- mnoGoSearch config.m4 freebsd compatibility fix.
-
- * ext/mnogosearch/config.m4
- ext/mnogosearch/php_mnogo.c:
- Added mnogosearch version checking into config.m4.
- Some proto fixes.
-
-2001-02-14 Thies C. Arntzen <thies@thieso.net>
-
- * ext/oci8/oci8.c:
- ocifreedesc() now spits a NOTICE when called the "wrong" way.
-
-2001-02-14 Derick Rethans <d.rethans@jdimedia.nl>
-
- * NEWS: - Added the notification of the chroot function addition
-
- * ext/standard/dir.c: - Added an extra chdir("/"); as sugested by Sascha
-
- * ext/standard/basic_functions.c
- ext/standard/dir.c
- ext/standard/php_dir.h:
- - Added the chroot function for changing root in a script.
-
-2001-02-14 Sascha Schumann <sascha@schumann.cx>
-
- * TODO:
- Add note about removing the requirement that you need to include the
- respective class definition before using a session variable of the type
- object.
-
- This has been the best suggestion so far and is very likely to be adopted
- in the near future.
-
- Submitted by: Hartmut Holzgraefe
-
-2001-02-14 Thies C. Arntzen <thies@thieso.net>
-
- * NEWS: *** empty log message ***
-
-2001-02-13 Colin Viebrock <colin@easydns.com>
-
- * pear/Crypt/CBC.php: initialize two variables
-
-2001-02-13 Thies C. Arntzen <thies@thieso.net>
-
- * ext/pgsql/pgsql.c: remove stupid PGSQL warning
-
-2001-02-13 Adam Dickmeiss <adam@indexdata.dk>
-
- * ext/yaz/php_yaz.c:
- Bug fix: Record retrieval (present) is termiated on error.
-
-2001-02-13 Thies C. Arntzen <thies@thieso.net>
-
- * ext/pgsql/pgsql.c
- ext/pgsql/php_pgsql.h:
- - PostgreSQL now does a rollback at the end of a request on every
- persistent connection. This is done by doing an "empty" transaction
- on the connection (This was advised by someone from the PostgreSQL
- core-team). If you leave transactions open on your page you will see a
- "NOTICE: BEGIN: already a transaction in progress" message in your
- apache error_log. This message is created by the PostgreSQL libs - we can
- do nothing about it.
-
- * ext/pgsql/pgsql.c:
- - fixes PostgeSQL pg_connect() bug. We would sometimes close the default
- link by acciedent. (Patch by: aja@nlgroup.ca)
-
-2001-02-13 Emiliano Heyns <emile@iris-advies.com>
-
- * ext/midgard/config.m4: Misplaced if spotted by Sascha
-
-2001-02-13 Thies C. Arntzen <thies@thieso.net>
-
- * main/internal_functions.c.in
- main/internal_functions_win32.c: remove unneded comments
-
-2001-02-13 Sascha Schumann <sascha@schumann.cx>
-
- * ext/midgard/config.m4: Outcomment everything contained in here.
-
- This file must not perform any checks, unless the user has enabled
- Midgard.
-
-2001-02-12 Adam Dickmeiss <adam@indexdata.dk>
-
- * ext/yaz/php_yaz.c
- ext/yaz/php_yaz.h:
- Implemented yaz_present, yaz_scan, yaz_scan_result, yaz_ccl_conf,
- yaz_ccl_parse and yaz_itemorder. Updated documentation.
-
-2001-02-12 David Guerizec <david@guerizec.net>
-
- * ext/midgard/test-db.tar.gz:
- This file is not needed anymore, check the midgard CVS for the up-to-date file:
- http://cvs.midgard-project.org/cvsweb.pl
- in /midgard/data
-
-2001-02-12 Rainer Schaaf <rjs@pdflib.com>
-
- * ext/pdf/config.m4
- ext/pdf/pdf.c
- ext/pdf/Makefile.in: added module support (for dl()) for PDFlib
- the PDF files now tell that they are generated by the PHP binding.
-
-2001-02-12 Emiliano Heyns <emile@iris-advies.com>
-
- * ext/midgard/.cvsignore
- ext/midgard/ChangeLog
- ext/midgard/INSTALL
- ext/midgard/Makefile.in
- ext/midgard/access.c
- ext/midgard/article.c
- ext/midgard/attachment.c
- ext/midgard/calendar.c
- ext/midgard/config.m4
- ext/midgard/element.c
- ext/midgard/event.c
- ext/midgard/eventmember.c
- ext/midgard/file.c
- ext/midgard/fudge
- ext/midgard/genentry.pl
- ext/midgard/group.c
- ext/midgard/host.c
- ext/midgard/image.c
- ext/midgard/logo/midgard-logo.gif
- ext/midgard/logo/mklogo.c
- ext/midgard/mail.c
- ext/midgard/member.c
- ext/midgard/mgd_access.h
- ext/midgard/mgd_article.h
- ext/midgard/mgd_attachment.h
- ext/midgard/mgd_calendar.h
- ext/midgard/mgd_element.h
- ext/midgard/mgd_errno.c
- ext/midgard/mgd_errno.h
- ext/midgard/mgd_errno.pl
- ext/midgard/mgd_event.h
- ext/midgard/mgd_eventmember.h
- ext/midgard/mgd_file.h
- ext/midgard/mgd_group.h
- ext/midgard/mgd_host.h
- ext/midgard/mgd_image.h
- ext/midgard/mgd_internal.h
- ext/midgard/mgd_mail.h
- ext/midgard/mgd_member.h
- ext/midgard/mgd_midgard.h
- ext/midgard/mgd_oop.h
- ext/midgard/mgd_page.h
- ext/midgard/mgd_pageelement.h
- ext/midgard/mgd_pagelink.h
- ext/midgard/mgd_person.h
- ext/midgard/mgd_preferences.h
- ext/midgard/mgd_preparser.h
- ext/midgard/mgd_sitegroup.h
- ext/midgard/mgd_snippet.h
- ext/midgard/mgd_snippetdir.h
- ext/midgard/mgd_style.h
- ext/midgard/mgd_topic.h
- ext/midgard/midgard-logo.h
- ext/midgard/midgard-root.php
- ext/midgard/midgard-team.h
- ext/midgard/midgard.c
- ext/midgard/mkall
- ext/midgard/oop.c
- ext/midgard/page.c
- ext/midgard/pageelement.c
- ext/midgard/pagelink.c
- ext/midgard/parameter.c
- ext/midgard/person.c
- ext/midgard/php4_porting.txt
- ext/midgard/php_midgard.h
- ext/midgard/preferences.c
- ext/midgard/preparser-parser.y
- ext/midgard/preparser-scanner.l
- ext/midgard/preparser.c
- ext/midgard/sitegroup.c
- ext/midgard/snippet.c
- ext/midgard/snippetdir.c
- ext/midgard/style.c
- ext/midgard/test-db.tar.gz
- ext/midgard/topic.c: Midgard 1.4.1 initial checkin
-
-2001-02-12 Andi Gutmans <andi@zend.com>
-
- * main/safe_mode.c: - Fix warning
- PR:
- Submitted by:
- Reviewed by:
- Obtained from:
-
-2001-02-12 Thies C. Arntzen <thies@thieso.net>
-
- * ext/oci8/oci8.c:
- - Improved OCI8 dead-session detection. (Patch by: George Schlossnagle)
-
- * ext/imap/php_imap.c: fixed possible leak in imap_search
-
-2001-02-12 Anders Johannsen <anders@ignition.dk>
-
- * pear/CMD.php:
- Fixed indentation problems related to use of TAB instead of spaces
-
-2001-02-11 Anders Johannsen <anders@ignition.dk>
-
- * pear/CMD.php: The Cmd:: class implements an abstraction for various ways
- of executing commands (directly using the backtick operator,
- as a background task after the script has terminated using
- register_shutdown_function() or as a detached process using nohup).
-
-2001-02-11 Sean Bright <elixer@erols.com>
-
- * NEWS: Added note about get_meta_tags bugfix
-
- * ext/standard/file.c
- ext/standard/file.h: Fix for bug #4556
-
-2001-02-09 Hartmut Holzgraefe <hartmut@six.de>
-
- * ext/gd/gd.c: make _php_image_convert configuration-aware
-
- * ext/gd/gd.c: libjpeg-not-installed protection
-
-2001-02-09 Rasmus Lerdorf <rasmus@php.net>
-
- * ext/standard/reg.c: Stray ]
-
- * ext/standard/datetime.c
- ext/standard/file.c:
- What the heck is CUT? Assume someone meant UTC here. And fix a
- warning.
-
-2001-02-09 Sergey Kartashoff <gluke@biosys.net>
-
- * ext/mnogosearch/php_mnogo.c
- ext/mnogosearch/test.php:
- Added UDM_PARAM_FIRST_DOC and UDM_PARAM_LAST_DOC mnoGoSearch extenstion
- result parameters. Example updated.
-
-2001-02-09 David Hedbor <david@hedbor.org>
-
- * sapi/caudium/caudium.c:
- Fixed PHP authentication and some other minor things.
-
-2001-02-08 Boian Bonev <boian@bonev.com>
-
- * ext/vpopmail/php_vpopmail.c:
- fixed SIGSEGV in vpopmail_auth_user when optional arg apop is not set
-
-2001-02-08 Chuck Hagenbuch <chuck@horde.org>
-
- * pear/Mail/Sendmail.php:
- die on backticks in an attempted from address, also.
-
- * pear/PHPDoc/renderer/html/PhpdocHTMLRenderer.php:
- fix a type - $templateRoot was meant, not $path.
-
- * pear/PHPDoc/index.php: the warning referred to here was fixed.
-
- * pear/HTML/IT.php:
- The free() method was throwing away too much information for template
- caching (re-using the same template) to work. So either these arrays need to
- be kept around (which is what this patch does), or everything using IT needs
- to not call free() if it wants template caching to work (seemed like more of
- a pain).
-
-2001-02-08 Andrei Zmievski <andrei@ispi.net>
-
- * TODO: *** empty log message ***
-
-2001-02-08 Sascha Schumann <sascha@schumann.cx>
-
- * sapi/apache2filter/apache_config.c: Make fprintf's optional
-
-2001-02-08 Uwe Steinmann <Uwe.Steinmann@fernuni-hagen.de>
-
- * ext/domxml/php_domxml.c
- ext/domxml/php_domxml.h: - add domxml_unlink_node(), not tested
-
-2001-02-08 Sergey Kartashoff <gluke@biosys.net>
-
- * ext/mnogosearch/php_mnogo.c
- ext/mnogosearch/test.php: Added UDM_PARAM_SEARCHTIME result parameter.
- Now at least mnoGoSearch-3.1.10 required to use this module.
- Added some parameters aliases. Example updated.
-
- * ext/mnogosearch/CREDITS
- ext/mnogosearch/php_mnogo.c:
-2001-02-08 Andrei Zmievski <andrei@ispi.net>
-
- * TODO
- ext/pcre/php_pcre.c: Move todo items.
-
-2001-02-08 Sascha Schumann <sascha@schumann.cx>
-
- * build/build2.mk: Suppress the other nasty warning
-
-2001-02-07 Chuck Hagenbuch <chuck@horde.org>
-
- * pear/Mail/Sendmail.php:
- remove double quotes which may not be stripped by sendmail (causing
- problems), and add checks for dangerous characters (in addition to the
- pre-existing escapeShellCmd()) in the $from variable.
-
- * pear/Mail.php
- pear/Mail/RFC822.php
- pear/Mail/SMTP.php
- pear/Mail/Sendmail.php
- pear/Mail/rfc822.php
- pear/Mail/sendmail.php
- pear/Mail/smtp.php
- pear/Makefile.in:
- may as well go by the capitalization we agreed on sooner rather than later.
-
-2001-02-07 Boian Bonev <boian@bonev.com>
-
- * ext/vpopmail/php_vpopmail.c:
-2001-02-07 Sascha Schumann <sascha@schumann.cx>
-
- * ext/domxml/config.m4:
- Improve use of $withval. This also cures the problem of adding -Lyes/lib
- to $LIBS.
-
-2001-02-07 Andrei Zmievski <andrei@ispi.net>
-
- * NEWS: Only one entry for mnoGoSearch is necessary.
-
-2001-02-07 Sergey Kartashoff <gluke@biosys.net>
-
- * ext/mnogosearch/.cvsignore: Added .cvsignore
-
-2001-02-06 Jim Jagielski <jim@jaguNET.com>
-
- * NEWS
- ext/standard/array.c
- ext/standard/crypt.c
- ext/standard/rand.c:
- For those lucky systems with both random() and *rand48(), the random()
- family is the prefered choice. So if both exist, we now choose that.
-
-2001-02-06 Sergey Kartashoff <gluke@biosys.net>
-
- * ext/mnogosearch/php_mnogo.c
- ext/mnogosearch/test.php:
- UDM_FIELD_ORDER and UDM_FIELD_CRC mnoGoSearch result fields has been added.
- Example updated.
-
- * ext/mnogosearch/php_mnogo.c
- ext/mnogosearch/test.php:
- UDM_PARAM_WORDINFO mnoGoSearch result parameter has been added.
- UDM_PARAM_RATING result field has neen added as alias for UDM_PARAM_SCORE.
- Example updated.
-
-2001-02-06 Andrei Zmievski <andrei@ispi.net>
-
- * ext/wddx/php_wddx_api.h: Preserve API compatibility.
-
- * ext/wddx/wddx.c: Don't use Z* macros for non-zvals.
-
- * ext/wddx/php_wddx_api.h
- ext/wddx/wddx.c
- NEWS: Cleaned up and optimized WDDX serialization - it's about twice
- as fast now.
-
-2001-02-06 Stephen van Egmond <svanegmond@home.com>
-
- * ext/standard/dns.c:
- Added tests for arpa/*.h and resolv.h which don't exist on the BeOS.
- The dns functions on BeOS come from socket.h
-
- * configure.in:
- Added tests for arpa/nameser.h and resolv.h, which don't exist on the BeOS.
-
-2001-02-06 Jim Jagielski <jim@jaguNET.com>
-
- * ext/standard/array.c:
- ext/standard/crypt.c:
- ext/standard/rand.c:
- Prefer the random() family over the *rand48() one
-
-2001-02-05 Zeev Suraski <zeev@zend.com>
-
- * ext/com/typedef_VARIANT.c
- ext/standard/basic_functions.c: Fix Windows build
-
-2001-02-05 Derick Rethans <d.rethans@jdimedia.nl>
-
- * ext/standard/mail.c
- ext/standard/php_mail.h:
- - Added a new parameter to mail() which appends aditional command line
- parameters to the mail program. This is usefull to set the From headers
- correctly with the -f parameter to sendmail p.e.
- - Added a new parameter to mail() which appends aditional command line
- parameters to the mail program.
-
-2001-02-05 Vlad Krupin <phpdevel@echospace.com>
-
- * ext/pspell/CREDITS: Added myself to CREDITS (vlad)
-
-2001-02-05 Harald Radi <h.radi@nme.at>
-
- * ext/com/conversion.c:
- fixes the problem that php.exe compiled on win2k platform won't run on any other
-
-2001-02-05 Vlad Krupin <phpdevel@echospace.com>
-
- * ext/pspell/pspell.c:
- now when pspell/pspell.h is included, it will recognize
- that it has to work in compatibility mode. (The previous fix
- had the right idea, but was too far down in the source)
-
-2001-02-05 Andrei Zmievski <andrei@ispi.net>
-
- * NEWS: *** empty log message ***
-
- * ext/standard/basic_functions.c:
- Allow calling static methods via call_user_method_* functions.
-
- * README.CVS-RULES: One more notice about using names with NEWS entries.
-
-2001-02-05 Sergey Kartashoff <gluke@biosys.net>
-
- * ext/mnogosearch/php_mnogo.c
- ext/mnogosearch/php_mnogo.h
- ext/mnogosearch/test.php:
- Added new Udm_Clear_Search_Limits mnogosearch extension function.
-
-2001-02-05 David Croft <david@infotrek.co.uk>
-
- * TODO: 2 things to do
-
-2001-02-05 Andrei Zmievski <andrei@ispi.net>
-
- * TODO: Whitespace.
-
-2001-02-05 Sergey Kartashoff <gluke@biosys.net>
-
- * ext/mnogosearch/config.m4: Fixed default search path.
-
- * ext/mnogosearch/README
- ext/mnogosearch/php_mnogo.c
- ext/mnogosearch/php_mnogo.h
- ext/mnogosearch/test.php:
- Added new Udm_Add_Search_Limit mnoGoSearch extension function.
- Some bugfixes and example update.
-
-2001-02-05 James Moore <James@phpuk.org>
-
- * ext/standard/credits.c: Adding Sebastian Bergmann to QA team list.
-
-2001-02-05 Sergey Kartashoff <gluke@biosys.net>
-
- * ext/mnogosearch/README
- ext/mnogosearch/php_mnogo.c
- ext/mnogosearch/php_mnogo.h:
- Fixed mnogosearch protos. Fixed mnogosearch functions return values.
- A bug with capital letters break search has been fixed.
-
-2001-02-04 James Moore <James@phpuk.org>
-
- * ext/standard/tests/time/.cvsignore
- ext/standard/tests/time/001.phpt: Adding microtime() tests
-
- * ext/standard/microtime.c:
- Always return a value even if HAVE_GETTIMEOFDAY is not set
-
- * win32/time.c:
- Fix for time.c under win32. Patch By: "Vanhanen, Reijo" <Reijo.Vanhanen@helsoft.fi>
-
-
-2001-02-04 Sterling Hughes <Sterling.Hughes@pentap.net>
-
- * TODO:
- * TODO: Add a bunch of stuff..
-
-2001-02-03 Andrei Zmievski <andrei@ispi.net>
-
- * NEWS
- ext/pcre/php_pcre.c: Adding delimiter capturing functionality.
-
- As far as NEWS, compilation fixed don't belong here.
-
-2001-02-03 Sean Bright <elixer@erols.com>
-
- * win32/readdir.c: Comments didn't reflect rewinddir()
-
-2001-02-02 Colin Viebrock <colin@easydns.com>
-
- * pear/Crypt/CBC.php: typo
-
-2001-02-02 Andrei Zmievski <andrei@ispi.net>
-
- * ext/sockets/sockets.c: Revert bogus patch and fix it properly.
-
-2001-02-02 Colin Viebrock <colin@easydns.com>
-
- * ext/sockets/sockets.c: Fix for http://bugs.php.net/bugs.php?id=9082
-
- I know switch() is expensive, so someone rewrite this "properly" if you
- want.
-
-2001-02-02 Chuck Hagenbuch <chuck@horde.org>
-
- * pear/Mail/smtp.php: fix silly cut-n-paste bug (#9081)
-
-2001-02-02 Rasmus Lerdorf <rasmus@php.net>
-
- * ext/pspell/pspell.c: pspell .12 fix
-
-2001-02-02 Harald Radi <h.radi@nme.at>
-
- * ext/dotnet/dotnet.cpp: correct phpinfo() output
-
-2001-02-02 Colin Viebrock <colin@easydns.com>
-
- * pear/DB.php: I think this should've been changed as well, right?
-
-2001-02-02 Egon Schmid <eschmid@s.netic.de>
-
- * ext/mnogosearch/php_mnogo.c: Fixed protos.
-
-2001-02-02 Harald Radi <h.radi@nme.at>
-
- * ext/iisfunc/.cvsignore
- ext/iisfunc/setup.c
- ext/dotnet/dotnet.cpp
- ext/com/typedef_VARIANT.c: correct phpinfo() output
-
-2001-02-02 Rasmus Lerdorf <rasmus@php.net>
-
- * ext/standard/string.c: Fix strip_tags to not strip a lone > character
-
-2001-02-02 Sergey Kartashoff <gluke@biosys.net>
-
- * ext/mnogosearch/README
- ext/mnogosearch/php_mnogo.c
- ext/mnogosearch/test.php:
- Added new UDM_PARAM_STOPTABLE and UDM_PARAM_STOPFILE parameters
- for Udm_Set_Agent_Params mnoGoSearch module. Now it can use stopwords
- stored either in database or in the plain text files. Added php warnings.
- Test example updated.
-
-2001-02-02 Chuck Hagenbuch <chuck@horde.org>
-
- * pear/DB.php:
- make sure to include subclasses before trying to instantiate them.
-
-2001-02-01 Colin Viebrock <colin@easydns.com>
-
- * pear/DB/common.php: fix here too
-
- * pear/PEAR.php.in: trigger_error() should be ($msg,$level), no?
-
-2001-02-01 Thies C. Arntzen <thies@thieso.net>
-
- * ext/zlib/zlib.c: ws-only
-
- * ext/zlib/zlib.c:
- - When using the ob_gzhandler() PHP now automagically also sets the
- Content-Lengh correctly which enables browsers to use the HTTP
- Keep-Alive feature.
-
-2001-02-01 Sascha Schumann <sascha@schumann.cx>
-
- * ext/zlib/zlib.c: Fix a huge memory leak in the ob_gzhandler.
-
-2001-02-01 Colin Viebrock <colin@easydns.com>
-
- * php.ini-dist:
- While we're fixing the ini files, change these to web-safe colours
- ... this always bugged me :)
-
-2001-02-01 Stanislav Malyshev <stas@zend.com>
-
- * ext/gd/gd_ctx.c
- ext/gd/php_gd.h
- ext/gd/gd.c:
- Allow usage of GD contexts and not tempfiles in output functions
-
-2001-02-01 Andrei Zmievski <andrei@ispi.net>
-
- * ext/pcre/php_pcre.c: No need for CLS_FETCH().
-
-2001-02-01 Sascha Schumann <sascha@schumann.cx>
-
- * ext/pcre/php_pcre.c: Fix broken ZTS build
-
-2001-02-01 Andrei Zmievski <andrei@ispi.net>
-
- * build/rules_pear.mk: Add cvsclean target for standalone extensions.
-
-2001-02-01 Sergey Kartashoff <gluke@biosys.net>
-
- * ext/mnogosearch/Makefile.in
- ext/mnogosearch/php_mnogo.c
- ext/mnogosearch/test.php:
- UDM_PARAM_CHARSET parameter in Udm_Set_Agent_Param() has been added to
- set local charset you are using. Example updated also.
-
-2001-02-01 Stanislav Malyshev <stas@zend.com>
-
- * ext/standard/file.c: Add utility function
-
-2001-02-01 Stig Bakken <ssb@fast.no>
-
- * ext/mysql/php_mysql.c: did someone poop in the code? :-)
-
-2001-02-01 Uwe Steinmann <Uwe.Steinmann@fernuni-hagen.de>
-
- * ext/pdf/pdf.c: ­ some modification from Rainer Schaaf
- * fixed prototype for pdf_new()
- * MINFO: included Revision of pdf.c, removed info about CJK + in-memory, this is
- standard with V3.x)
- * repaired PDF_open_CCITT
- * repaired PDF_setfont
- * eliminated many compiler warnings.
- * former resource "pdf document" is now called "pdf object"
-
-2001-02-01 Jon Parise <jon@csh.rit.edu>
-
- * php.ini-dist: Massive reformatting.
-
-2001-02-01 Andrei Zmievski <andrei@ispi.net>
-
- * NEWS
- ext/pcre/php_pcre.c
- ext/pcre/php_pcre.h:
- Modified /F handling to allow calling object methods.
-
-2001-01-31 Egon Schmid <eschmid@s.netic.de>
-
- * ext/mysql/php_mysql.c: Only two lines are allowed here.
-
-2001-01-31 Sean Bright <elixer@erols.com>
-
- * ext/mysql/php_mysql.c
- ext/mysql/php_mysql.h: Added the mysql_get_*_info() functions.
-
-2001-01-31 Andi Gutmans <andi@zend.com>
-
- * ext/standard/scanf.c
- ext/ingres_ii/ii.c
- ext/mysql/php_mysql.c
- ext/pgsql/pgsql.c:
- - Change unset() functions to null(). unset() is legacy
-
-2001-01-31 Chuck Hagenbuch <chuck@horde.org>
-
- * pear/HTTP.php:
- use $HTTP_SERVER_VARS, in case register_globals is Off, and use !empty()
- instead of just if () to avoid errors.
-
-2001-01-31 Daniel Beulshausen <daniel@php4win.de>
-
- * win32/php_modules.dsw: add iconv and ming
-
- * ext/ming/ming.dsp
- ext/ming/php_ming.h: nuke warning, and add dsp
-
- * ext/pdf/pdf.c: fix typo
-
- * ext/iconv/iconv.c
- ext/iconv/iconv.dsp: make iconv compile under win32 using libiconv
-
-2001-01-31 Sergey Kartashoff <gluke@biosys.net>
-
- * ext/mnogosearch/README
- ext/mnogosearch/config.m4
- ext/mnogosearch/php_mnogo.c
- ext/mnogosearch/php_mnogo.h
- ext/mnogosearch/setup.stub
- ext/mnogosearch/test.php: Added search cache and track query features.
-
-2001-01-31 James Moore <James@phpuk.org>
-
- * RELEASE_PROCESS:
- Adding readme for release process, this needs to live somewhere and here seems as good a place as any.
-
-2001-01-31 Harald Radi <h.radi@nme.at>
-
- * ext/com/conversion.c: added currency, date, IUnknown and NULL datatypes
-
-2001-01-31 Uwe Steinmann <Uwe.Steinmann@fernuni-hagen.de>
-
- * NEWS: - note about change of pdf api
-
-2001-01-31 Stig Bakken <ssb@fast.no>
-
- * pear/PEAR.php.in: whitespace
-
-2001-01-31 Sean Bright <elixer@erols.com>
-
- * ext/mysql/php_mysql.c: Fixed conditional.
-
- * ext/mysql/php_mysql.c:
- Fix for bug #8991. mysql_field_type() now returns "year" for columns of
- type YEAR.
-
-2001-01-30 Adam Dickmeiss <adam@indexdata.dk>
-
- * ext/yaz/README
- ext/yaz/php_yaz.c:
- Fixed problem with looping present requests for Isite targets.
-
-2001-01-30 Harald Radi <h.radi@nme.at>
-
- * win32/.cvsignore: fixing .cvsignore
-
- * ext/dotnet/.cvsignore: adding .cvsignore
-
-2001-01-30 Sergey Kartashoff <gluke@biosys.net>
-
- * ext/mnogosearch/config.m4
- ext/mnogosearch/php_mnogo.c
- ext/mnogosearch/php_mnogo.h
- ext/mnogosearch/setup.stub
- ext/mnogosearch/test.php
- ext/mnogosearch/README
- ext/mnogosearch/Makefile.in:
- mnoGoSearch extension module initial version has been added.
- This module currently at the alpha state, but it can be used already.
- PR:
- Submitted by:
- Reviewed by:
- Obtained from:
-
-2001-01-30 Stig Bakken <ssb@fast.no>
-
- * pear/DB.php
- pear/DB/tests/db_parsedsn.phpt:
- Allow url encoding in DB usernames and passwords (Stig, PEAR)
-
-2001-01-30 David Eriksson <david@2good.com>
-
- * ext/satellite/namedvalue_to_zval.c
- ext/satellite/typecode.c:
- Applied patch from Oleg Sharoiko <os@rsu.ru> to fix bug in satellite_any_to_zval_sequence
-
-2001-01-30 Harald Radi <h.radi@nme.at>
-
- * ext/com/conversion.c
- ext/com/typedef_VARIANT.c: pass another com object as parameter
-
-2001-01-30 Stig Bakken <ssb@fast.no>
-
- * pear/PEAR.php.in
- pear/tests/pear_error.phpt
- pear/tests/pear_error3.phpt:
- Added raiseError and setErrorHandling methods to PEAR class (Stig, PEAR)
-
-2001-01-29 Jani Taskinen <sniper@iki.fi>
-
- * ext/domxml/config.m4:
- Fixed bug #8946. In some systems the libxml.* is actually libxml2.*
-
- * ext/zziplib/.cvsignore: a little cleanup..
-
-2001-01-29 Harald Radi <h.radi@nme.at>
-
- * ext/dotnet/dotnet.cpp
- ext/com/COM.cpp
- ext/com/conversion.c
- ext/com/conversion.h
- ext/com/php_COM.h
- ext/com/php_typedef_VARIANT.h
- ext/com/typedef_VARIANT.c: use *_EXTERN_C() and PHP_WIN32
-
-2001-01-27 John Donagher <john@webmeta.com>
-
- * configure.in:
- PR:
- Submitted by:
- Reviewed by:
- Obtained from:
- Add configure warning message when compiling --with-pfpro
-
-2001-01-27 Egon Schmid <eschmid@s.netic.de>
-
- * ext/mssql/php_mssql.c: Fixed some protos.
-
- * ext/gd/gd.c: File formats in uppercase characters.
-
-2001-01-27 Sascha Schumann <sascha@schumann.cx>
-
- * ext/ming/config.m4:
- This config.m4 was obviously not tested at all before being committed.
-
- s/withval/PHP_MING/
-
-2001-01-27 James Moore <James@phpuk.org>
-
- * ext/ming/EXPERIMENTAL: Adding Ming experimental file
-
-2001-01-27 Dave Hayden <dave@opaque.net>
-
- * ext/ming/Makefile.in
- ext/ming/config.m4
- ext/ming/ming.c
- ext/ming/php_ming.h:
- First include of ming (SWF generation) library wrapper
-
- http://www.opaque.net/ming/
-
-2001-01-27 Boian Bonev <boian@bonev.com>
-
- * ext/vpopmail/php_vpopmail.c:
-2001-01-26 Egon Schmid <eschmid@s.netic.de>
-
- * ext/sybase_ct/php_sybase_ct.c: Mostly off by one.
-
- * ext/hyperwave/hw.c: Fixed another proto.
-
- * ext/muscat/muscat.c: Fixed some protos.
-
- * ext/satellite/php_orbit.c: Whitespace change for funclist.txt.
-
- * ext/openssl/openssl.c: Fixed some protos.
-
-2001-01-26 Chuck Hagenbuch <chuck@horde.org>
-
- * pear/DB/mysql.php
- pear/DB.php:
- have DB::isError return true if passed "null". Now you can more consistently
- use DB::isError(), since some of the db drivers return nulls from various
- functions (like fetchRow()), and others don't... We should probably make all
- of them just return errors. I did this for the mysql driver, as a start.
-
-2001-01-26 Egon Schmid <eschmid@s.netic.de>
-
- * ext/pdf/pdf.c
- ext/pdf/php_pdf.h: Fixed some protos.
-
-2001-01-26 Sascha Schumann <sascha@schumann.cx>
-
- * ext/ircg/README.txt: Whitespace change.
-
-2001-01-26 Uwe Steinmann <Uwe.Steinmann@fernuni-hagen.de>
-
- * ext/pdf/pdf.c
- ext/pdf/php_pdf.h:
- - This is major change of the php pdf api to be closer to the pdflib api
- done by Rainer Schaaf from pdflib GmbH.
- - Some more functions has been implemented as well.
- - backwards compatibility has been maintained a much as possible
-
- * ext/domxml/php_domxml.c
- ext/domxml/php_domxml.h:
- - changed naming of some functions (kept compatibility)
-
-2001-01-25 Daniel Beulshausen <daniel@php4win.de>
-
- * ext/msql/msql.dsp
- ext/msql/php_msql.c
- ext/msql/php_msql.h
- win32/php_modules.dsw: make msql build under win32
-
-2001-01-25 Hartmut Holzgraefe <hartmut@six.de>
-
- * ext/gd/gd.c:
- gd didn't work if no WBMP was available after rev 1.107 -> fixed
-
-2001-01-25 Stanislav Malyshev <stas@zend.com>
-
- * ext/gd/gd.c: Fix crash in stdout image output
-
-2001-01-24 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * ext/mysql/libmysql/libmysql.dsp
- ext/mysql/libmysql/my_winthread.c:
- Added my_winthread.c. Thanks to Thimble Smith.
-
-2001-01-24 Andrei Zmievski <andrei@ispi.net>
-
- * TODO: Already done.
-
-2001-01-24 Ben Mansell <ben@zeus.com>
-
- * README.Zeus: Added 'you must use gcc' comment to build instructions.
-
-2001-01-24 MySQL Team <mysql-all@mysql.com>
-
- * ext/mysql/libmysql/config-win.h
- ext/mysql/libmysql/update_sources:
- Don't #define HAVE_COMPRESS on windows.
-
-2001-01-24 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * pear/HTML/ITX.php: Forgot to include IT.php.
-
-2001-01-24 Stig Bakken <ssb@fast.no>
-
- * pear/HTML/Form.php: typo
-
-2001-01-24 Egon Schmid <eschmid@s.netic.de>
-
- * ext/gd/gd.c: Protos fixed.
-
-2001-01-24 Derick Rethans <d.rethans@jdimedia.nl>
-
- * ext/gd/gd.c
- ext/gd/php_gd.h:
- - Commited a patch that adds support for converting Images to WBMP format.
- (Thanx to Denis Gasparin <denis@editnet.it>)
- - Added support for converting images from JPG/PNG on the fly with the GD
- extension, which is usefull for creating dynamic WAP-sites
-
-2001-01-23 Boian Bonev <boian@bonev.com>
-
- * ext/vpopmail/CREDITS
- ext/vpopmail/README
- ext/vpopmail/config.m4
- ext/vpopmail/php_vpopmail.c
- ext/vpopmail/php_vpopmail.h:
- changed function names to be like vpopmail_add_user instead vpopmail_adduser
- added vpopmail_error to report error string (vpopmail_errno global var)
- put exec functions back in with _ex (vpopmail_add_domain_ex)
- rewritten README to help users keep secure
- fixed protos to state bool instead void return type
-
-2001-01-23 Colin Viebrock <colin@easydns.com>
-
- * pear/Crypt/CBC.php: wrong name
-
- * pear/Makefile.in: Forgot this too ...
-
- * pear/Makefile.in: Never added this ...
-
-2001-01-23 MySQL Team <mysql-all@mysql.com>
-
- * ext/mysql/libmysql/thr_alarm.h
- ext/mysql/libmysql/thr_mutex.c
- ext/mysql/libmysql/typelib.c
- ext/mysql/libmysql/update_sources
- ext/mysql/libmysql/violite.c
- ext/mysql/libmysql/violite.h
- NEWS
- ext/mysql/libmysql/acinclude.m4
- ext/mysql/libmysql/bmove.c
- ext/mysql/libmysql/charset.c
- ext/mysql/libmysql/config-win.h
- ext/mysql/libmysql/dbug.h
- ext/mysql/libmysql/default.c
- ext/mysql/libmysql/errors.c
- ext/mysql/libmysql/fix_copyright
- ext/mysql/libmysql/global.h
- ext/mysql/libmysql/libmysql.c
- ext/mysql/libmysql/m_string.h
- ext/mysql/libmysql/mf_dirname.c
- ext/mysql/libmysql/mf_format.c
- ext/mysql/libmysql/mf_pack.c
- ext/mysql/libmysql/mf_path.c
- ext/mysql/libmysql/my_alloc.c
- ext/mysql/libmysql/my_create.c
- ext/mysql/libmysql/my_fopen.c
- ext/mysql/libmysql/my_init.c
- ext/mysql/libmysql/my_open.c
- ext/mysql/libmysql/my_pthread.c
- ext/mysql/libmysql/my_pthread.h
- ext/mysql/libmysql/my_static.c
- ext/mysql/libmysql/my_static.h
- ext/mysql/libmysql/my_sys.h
- ext/mysql/libmysql/my_thr_init.c
- ext/mysql/libmysql/my_wincond.c
- ext/mysql/libmysql/my_write.c
- ext/mysql/libmysql/mysql.h
- ext/mysql/libmysql/mysql_com.h
- ext/mysql/libmysql/mysql_version.h
- ext/mysql/libmysql/mysqld_error.h
- ext/mysql/libmysql/mysys_err.h
- ext/mysql/libmysql/net.c
- ext/mysql/libmysql/raid.h
- ext/mysql/libmysql/safemalloc.c
- ext/mysql/libmysql/string.c:
- Upgrade ext/mysql/libmysql to version 3.23.32. One notable bug fix is
- that the client can now connect to a server which is using a default
- charset other than latin1.
-
-2001-01-23 Thies C. Arntzen <thies@thieso.net>
-
- * NEWS:
-2001-01-23 Jim Winstead <jimw@php.net>
-
- * ext/standard/credits.c: jouni was added as an author of the docs
-
-2001-01-22 Andrei Zmievski <andrei@ispi.net>
-
- * ext/pcre/php_pcre.c:
- If we can't call custom replacement function, don't change the subject
- string.
-
- * ext/standard/string.c:
- - Improved str_replace() to accept an array for any parameter - similar
- to preg_replace().
-
- * ext/pcre/php_pcre.c: Don't need to check for out-of-memory condition.
-
- * ext/pcre/php_pcre.c
- ext/pcre/php_pcre.h: Z-ify the source.
-
-2001-01-22 Daniel Beulshausen <daniel@php4win.de>
-
- * ext/mssql/mssql.dsp
- php.ini-dist
- php.ini-optimized:
- rename php_mssql70.dll to php_mssql.dll, as we have only one mssql extension
-
-2001-01-22 Andrei Zmievski <andrei@ispi.net>
-
- * ext/standard/array.c:
- - Fixed extract() to properly prefix numeric keys when EXTR_PREFIX_ALL is
- used.
- - Added EXTR_PREFIX_INVALID flag to extract() to automatically prefix
- string keys that do not constitute valid variable names.
-
-2001-01-22 Rasmus Lerdorf <rasmus@php.net>
-
- * sapi/apache/mod_php4.c: Kill warning
-
-2001-01-22 Zeev Suraski <zeev@zend.com>
-
- * sapi/apache/mod_php4.c:
- Sigh. Even less sleep than I thought :) Really fix it this time.
-
- * sapi/apache/mod_php4.c:
- Too much work, not enough sleep... Fix hash lookup
-
- * NEWS: Update and pastify NEWS
-
- * sapi/apache/mod_php4.c: Don't overwrite PATH_TRANSLATED if it exists
-
-2001-01-21 Rasmus Lerdorf <rasmus@php.net>
-
- * NEWS: This probably should have a NEWS entry
-
- * main/fopen-wrappers.c
- main/network.c
- main/php_open_temporary_file.c
- configure.in
- ext/mysql/libmysql/libmysql.c
- ext/standard/basic_functions.c
- ext/standard/dns.c
- ext/standard/file.c
- ext/standard/filestat.c
- ext/standard/fsock.c
- ext/standard/ftp_fopen_wrapper.c
- ext/standard/http_fopen_wrapper.c
- ext/standard/mail.c
- ext/standard/syslog.c: BeOS patch from svanegmond@bang.dhs.org modified somewhat by Rasmus
-
-2001-01-21 Jani Taskinen <sniper@iki.fi>
-
- * ext/bz2/config.m4: Remove double 'yes' output.
-
-2001-01-20 Sterling Hughes <Sterling.Hughes@pentap.net>
-
- * ext/sablot/sablot.c:
- Fix the scheme handler support and make it compile on win32 systems.
-
-2001-01-20 Chuck Hagenbuch <chuck@horde.org>
-
- * pear/HTTP/Compress.php: whitespace
-
-2001-01-20 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * pear/Cache/Function_Cache.php: Next time without the 'Oops!'.
-
- * pear/Cache/Function_Cache.php:
- Fixed two small glitches. Note: The Shared Memory version of Function_Cache does not work correctly at the moment, but I'm on it.
-
-2001-01-20 Sascha Schumann <sascha@schumann.cx>
-
- * ext/pgsql/pgsql.c: Revert last completely broken patch.
-
-2001-01-20 Chuck Hagenbuch <chuck@horde.org>
-
- * pear/Makefile.in: install the various HTML/* files
-
-2001-01-20 Jani Taskinen <sniper@iki.fi>
-
- * ext/bz2/config.m4: Check that libbz2.(a|so) is >= 0.95 (has BZ2_bzerror)
-
-2001-01-20 Rui Hirokawa <louis@cityfujisawa.ne.jp>
-
- * ext/iconv/EXPERIMENTAL: added: EXPERIMENTAL
-
-2001-01-19 Jason Greene <jason@inetgurus.net>
-
- * TODO: Desired functionality can be achieved with array_sum/array_count.
-
-2001-01-19 Chuck Hagenbuch <chuck@horde.org>
-
- * pear/Mail/rfc822.php:
- remove a change that broke things, and removing an unused function.
-
-2001-01-19 Richard Heyes <richard.heyes@heyes-computing.net>
-
- * pear/Mail/rfc822.php:
- If extended format is in use and there are no groups, all the addresses are
- now added to an empty group. Also changed the format of the output, an
- array was being used unnecessarily.
-
-2001-01-19 Jani Taskinen <sniper@iki.fi>
-
- * ext/standard/image.c:
- - Added URL support for getimagesize() function
-
-2001-01-19 Sam Liddicott <sam@ananova.com>
-
- * EXTENSIONS: Added muscat to EXTENSIONS as it should be there all along
- PR:
- Submitted by:
- Reviewed by:
- Obtained from:
-
-2001-01-19 Sascha Schumann <sascha@schumann.cx>
-
- * main/php.h: Bump PHP_API_VERSION
-
-2001-01-19 Derick Rethans <d.rethans@jdimedia.nl>
-
- * NEWS: - Added a notice about the wordwrap function fix
-
-2001-01-19 Sascha Schumann <sascha@schumann.cx>
-
- * main/rfc1867.c: Make the code match the comment.
-
- Prior to this change, the upload code tried to add mangled names to
- the global HTTP_POST_FILES array, resulting in all kind of weird behaviour.
-
- After this change, multi-dimensional form elements are treated correctly
- and consistently.
-
-2001-01-19 Jani Taskinen <sniper@iki.fi>
-
- * ext/sockets/EXPERIMENTAL
- ext/vpopmail/EXPERIMENTAL
- ext/qtdom/EXPERIMENTAL
- ext/sablot/EXPERIMENTAL
- ext/satellite/EXPERIMENTAL
- ext/ingres_ii/EXPERIMENTAL
- ext/openssl/EXPERIMENTAL
- EXTENSIONS
- ext/bz2/EXPERIMENTAL
- ext/crack/CREDITS
- ext/crack/EXPERIMENTAL
- ext/domxml/EXPERIMENTAL
- ext/dotnet/EXPERIMENTAL:
- Added some missing EXPERIMENTAL files plus some missing extensions
- into EXTENSIONS file.
-
-2001-01-19 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * pear/HTML/IT.php
- pear/HTML/ITX.php: Whitespace only.
-
-2001-01-19 Jani Taskinen <sniper@iki.fi>
-
- * ext/sablot/php_sablot.h
- ext/sablot/sablot.c:
- - Added xslt_set_scheme_handler() function (carmelo@akooe.com)
-
-2001-01-18 Derick Rethans <d.rethans@jdimedia.nl>
-
- * ext/pgsql/pgsql.c
- ext/pgsql/php_pgsql.h:
- - Added the pg_lolseek function, which allows for arbitrary seeking within
- a large object, and the pg_lotell call, which can be used to find the
- current file offset for a large object (Submitted by: Adam Haberlach
- <adam@newsnipple.com>).
- - Added the pg_lolseek and pg_lotell functions
-
- * ext/standard/string.c:
- - Fix for bug #8367 (wordwrap not cutting correctly)
-
-2001-01-18 Ulf Wendel <ulf.wendel@phpdoc.de>
-
- * pear/HTML/ITX.php:
- Current version from the PHPLib CVS. Converted Tabs to spaces.
-
- Error handling must be pearified.
-
-2001-01-18 Sterling Hughes <Sterling.Hughes@pentap.net>
-
- * ext/sockets/sockets.c: Fix the proto
-
-2001-01-18 Ulf Wendel <ulf.wendel@phpdoc.de>
-
- * pear/HTML/IT.php:
- Ok, now finally - special thanks to the Karmamaker Sascha -
- this is the current IT version from the PHPLib. Tabs replaced by spaces.
-
- Error handling has to be pearified and I'm not sure if PHPDoc works with
- this version.
-
-2001-01-18 Alex Akilov <akilov@us.ibm.com>
-
- * ext/java/config.m4:
- Support AIX/HP shared lib extensions and j2sdk1.3.0 (hotspot)
-
-2001-01-18 Sam Liddicott <sam@ananova.com>
-
- * ext/muscat/muscat.c: Some decent credits and such in the phpinfo page
-
-2001-01-18 Jani Taskinen <sniper@iki.fi>
-
- * ext/sablot/config.m4: Fixed a typo.
-
-2001-01-18 Andrei Zmievski <andrei@ispi.net>
-
- * ext/standard/datetime.c:
- - Fixed 'O' and 'r' flags of date() to have correct sign for timezone
- offset.
-
-2001-01-18 Sam Liddicott <sam@ananova.com>
-
- * ext/muscat/config
- ext/muscat/aegis.log:
- Aghh. Despite my efforts two files still slipped through
-
- * ext/muscat/LICENSE
- ext/muscat/LICENSE.about
- ext/muscat/Makefile.in
- ext/muscat/aegis.log
- ext/muscat/config
- ext/muscat/config.m4
- ext/muscat/muscat.c
- ext/muscat/muscat.php
- ext/muscat/muscat_handles.h
- ext/muscat/muscat_net.c
- ext/muscat/muscat_net.h
- ext/muscat/php_muscat.h:
- First checkin of muscat/empower module; been using it here for some time
- Developing using aegis and just checking in baseline from time to time
-
- See samjam@php.net for questions
-
-2001-01-18 Stanislav Malyshev <stas@zend.com>
-
- * ext/readline/README.libedit
- ext/readline/config.m4
- ext/readline/php_readline.h
- ext/readline/readline.c: Libedit readline replacement support
-
-2001-01-18 Sascha Schumann <sascha@schumann.cx>
-
- * ext/ircg/README.txt: Expand tabs
-
- * ext/ircg/README.txt: Add a pointer to the homepage at the beginning
-
-2001-01-17 Andrei Zmievski <andrei@ispi.net>
-
- * ext/standard/datetime.c:
- - Changed 'Z' flag to date() to always return timezone offset with
- negative sign if it's west of UTC.
-
-2001-01-17 Sean Bright <elixer@erols.com>
-
- * ext/standard/php_string.h
- ext/standard/basic_functions.c:
- Put these back where they belong. They weren't necessary unless ZTS and
- HAVE_LOCALECONV were both defined.
-
-2001-01-17 Sterling Hughes <Sterling.Hughes@pentap.net>
-
- * pear/HTML/Processor.php:
- Add the HTML_Processor class which provides common functions for processing HTML.
-
-
-2001-01-17 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * pear/PHPDoc/prepend.php
- pear/HTML/IT.php
- pear/HTML/ITX.php: Move IT[x] to HTML/.
-
-2001-01-17 Sterling Hughes <Sterling.Hughes@pentap.net>
-
- * ext/sablot/sablot.c:
- Fix (well it works) the error display with sablotron.
-
-2001-01-17 Stig Venaas <venaas@uninett.no>
-
- * ext/ldap/ldap.c:
- Making parallel search allow different filter for each link
-
-2001-01-17 Sascha Schumann <sascha@schumann.cx>
-
- * configure.in: Fix vpath builds on freebsd
-
-2001-01-17 Jani Taskinen <sniper@iki.fi>
-
- * ext/sablot/sablot.c: Make sablot compile again. Typo?
-
-2001-01-17 Rasmus Lerdorf <rasmus@php.net>
-
- * ext/exif/exif.c
- main/network.c: Kill a couple of warnings
-
-2001-01-17 Sean Bright <elixer@erols.com>
-
- * configure.in: Updated configure.in to look for strcoll()
-
- * ext/standard/basic_functions.c
- ext/standard/php_string.h
- ext/standard/string.c:
- Added string comparison function strcoll(). It uses the current locale to
- do the comparisons.
-
-2001-01-16 Jani Taskinen <sniper@iki.fi>
-
- * ext/gd/gd.c: Fixed bug #8733
-
-2001-01-16 Rasmus Lerdorf <rasmus@php.net>
-
- * ext/sockets/sockets.c: Kill some warnings
-
-2001-01-16 Mika Tuupola <tuupola@appelsiini.net>
-
- * pear/Image/Remote.php:
- Fixed the vim rules.
-
-2001-01-16 Sterling Hughes <Sterling.Hughes@pentap.net>
-
- * ext/sablot/php_sablot.h
- ext/sablot/sablot.c:
- Added the SABLOT_SET_ERROR() macro to set sablotron errors...
-
-2001-01-16 Ben Mansell <ben@zeus.com>
-
- * sapi/isapi/php4isapi.c
- README.Zeus: Added changes to environment variable manipulations, to support Zeus 3.3.8
- and increase compatibility between Zeus/IIS/Apache. Now, URLs like
- http://foo.org/file.php/a/b/c/d work correctly.
-
-2001-01-16 Sascha Schumann <sascha@schumann.cx>
-
- * ext/ircg/ircg.c:
- Use the write buffer subsystem to accumulate network writes and to
- increase the overall through-put.
-
-2001-01-16 Sean Grimes <metallic@noworlater.net>
-
- * pear/XML/Render.php:
- Added a method to call the HTML and PDF rendering modes(not implemented yet).
- Added the parse function which should allow for finer XML parsing.
- The XML file contents are now stored in a var available to the entire class.
- Added a wrapper around setInputFile() and setInput()
-
-2001-01-15 Zeev Suraski <zeev@zend.com>
-
- * sapi/isapi/stresstest/stresstest.dsp: Fix output dir
-
- * sapi/isapi/stresstest/stresstest.cpp:
- - Implement CompareStringWithFile()
- - Remove a stupid NULL assignment that slipped in the last commit
-
- * sapi/isapi/stresstest/notes.txt
- sapi/isapi/stresstest/stresstest.cpp:
- - Implement quick file comparing routine
- - Fix crash - wait on the threads themselves, not on Event objects.
- It takes time between the time a thread signals the event, and the
- time it actually terminates (shutdown code) - so FreeLibrary() and
- the main() termination could occur before all of the threads
- terminated...
-
-2001-01-15 Sascha Schumann <sascha@schumann.cx>
-
- * sapi/aolserver/aolserver.c: Try harder to push data through the wire.
-
- I just learned that the AOLserver module will be used for a 100k users
- webmail service. Wheee!
-
-2001-01-15 Egon Schmid <eschmid@s.netic.de>
-
- * ext/mhash/mhash.c: Some protos fixed.
-
-2001-01-15 Zeev Suraski <zeev@zend.com>
-
- * main/php_globals.h
- main/php_ini.c: - Remove the ini_extension_list global
- - Switch to delayed loading of Zend extensions
-
- * main/rfc1867.c: Use free_estring()
-
- * ext/standard/php_string.h: Nuke a couple of warnings
-
- * ext/odbc/php_odbc.c: Fix Win32 build
-
-2001-01-15 Sascha Schumann <sascha@schumann.cx>
-
- * main/php_globals.h
- main/php_ini.c:
- Defer loading of extensions until all configuration entries have been
- added to the configuration hash.
-
-2001-01-15 David Croft <david@infotrek.co.uk>
-
- * ext/vpopmail/php_vpopmail.c
- ext/vpopmail/php_vpopmail.h:
- restored vadddomain/vdeldomain to use library functions rather than invoking
- vpopmail executables
- implemented vaddaliasdomain natively
- global variable to store whether vpopmail was used and only vclose() if
- necessary
- return the functions to returning true/false for success/failure rather than
- some arbitrary vpopmail return value
- return the functions to not doing everything at once as you then lose
- fine-grain control over its operation
- change C++ comments to C
-
-2001-01-15 Shane Caraveo <shane@php.net>
-
- * sapi/isapi/stresstest/notes.txt
- sapi/isapi/stresstest/stresstest.cpp: test now produce valid OK or FAIL.
-
-2001-01-15 Stig Bakken <ssb@fast.no>
-
- * pear/DB/STATUS: * status update: odbc now supports errorNative
-
-2001-01-15 Shane Caraveo <shane@php.net>
-
- * sapi/isapi/stresstest/stresstest.cpp:
- dont do results if not using test files
-
-2001-01-15 Stig Bakken <ssb@fast.no>
-
- * pear/DB/odbc.php: * DB_odbc: added native error support
-
-2001-01-15 Shane Caraveo <shane@php.net>
-
- * sapi/isapi/stresstest/stresstest.cpp: clean up temp files
-
-2001-01-15 Stig Bakken <ssb@fast.no>
-
- * ext/odbc/php_odbc.c
- ext/odbc/php_odbc.h:
- - Added odbc_error() and odbc_errormsg() functions
-
- * pear/DB/tests/odbc/.cvsignore
- pear/DB/tests/odbc/001.phpt
- pear/DB/tests/odbc/002.phpt
- pear/DB/tests/odbc/003.phpt
- pear/DB/tests/odbc/004.phpt
- pear/DB/tests/odbc/006.phpt
- pear/DB/tests/odbc/007.phpt
- pear/DB/tests/odbc/010.phpt
- pear/DB/tests/odbc/connect.inc
- pear/DB/tests/odbc/dsn.inc
- pear/DB/tests/odbc/mktable.inc
- pear/DB/tests/odbc/skipif.inc: * defined a bunch of ODBC tests
-
-2001-01-15 Shane Caraveo <shane@php.net>
-
- * sapi/isapi/stresstest/stresstest.cpp: check files open
-
- * sapi/isapi/stresstest/stresstest.cpp: fix file reading, add results
-
- * sapi/isapi/stresstest/notes.txt
- sapi/isapi/stresstest/stresstest.cpp
- sapi/isapi/stresstest/stresstest.dsp:
- Multithreaded stress test program for isapi module now supports phpt files
- still stuff to do before it's realy done, but does run the tests, just need
- to get it to compare results right now.
-
-2001-01-14 David Croft <david@infotrek.co.uk>
-
- * ext/vpopmail/config.m4:
- vpopmail's bin dir is unnecessary as the library exports these functions
-
-2001-01-14 Boian Bonev <boian@bonev.com>
-
- * ext/vpopmail/README:
- * ext/vpopmail/php_vpopmail.c
- ext/vpopmail/php_vpopmail.h: merged my version with David Croft's
- removed unneccessary php.ini calls and defines
- removed module_init, shutdown, request_init declarations and references
- added request_shutdown to close mysql/other db connection
- (a must in apache module)
- added defines for external binaries from vpopmail
- changed functions to present more consistent api from user's point of view
- so that in one call more stuff is done
- added more comprehensive MINFO function helping users debug their case
- added static int vpopmail_exec(char *cmd) [will change to php_Exec soon]
-
- * ext/vpopmail/CREDITS: updated
-
-2001-01-14 Rasmus Lerdorf <rasmus@php.net>
-
- * ext/standard/exec.c: Name this php_Exec instead
-
-2001-01-14 Boian Bonev <boian@bonev.com>
-
- * ext/vpopmail/config.m4: rewritten the whole logic of the script
- added VPOPMAIL_BIN_DIR to point to ~vpopmail/bin directory
- added checks for ALL files needed by the extension
- style fixes to the output
-
-2001-01-14 Sean Bright <elixer@erols.com>
-
- * ext/standard/basic_functions.c
- ext/standard/php_string.h
- ext/standard/string.c
- main/config.w32.h
- configure.in:
-
- Added localeconv() function. Operates similarly to localeconv() defined in
- locale.h. Should work well under non-ZTS as well as ZTS.
-
-2001-01-14 Rasmus Lerdorf <rasmus@php.net>
-
- * ext/standard/exec.c: Export _Exec for extensions to use
-
-2001-01-14 Thies C. Arntzen <thies@thieso.net>
-
- * ext/standard/file.c: fixed readfile() fd-leak.
-
- guys, always remember that every function that *generates output* could cause a
- bailout if ignore_user_abort is set to false (and the user _aborts_ the
- connection). in this case a longjump will be performed and our function (in
- this case readfile) will have no chance to clean-up. having said that it's a
- good idea to register all opened files using REGISTER_RESOURCE - that way the
- engine will make sure they get closed on request end.
-
-2001-01-14 Zeev Suraski <zeev@zend.com>
-
- * ext/mysql/php_mysql.c:
- Don't fetch numeric indices in mysql_fetch_object()
-
-2001-01-14 David Croft <david@infotrek.co.uk>
-
- * ext/vpopmail/php_vpopmail.c:
- New extension for vpopmail - http://www.inter7.com/vpopmail (David Croft)
-
- * ext/vpopmail/.cvsignore
- ext/vpopmail/CREDITS
- ext/vpopmail/Makefile.in
- ext/vpopmail/config.m4
- ext/vpopmail/php_vpopmail.c
- ext/vpopmail/php_vpopmail.h: vpopmail extension
-
-2001-01-14 Rui Hirokawa <louis@cityfujisawa.ne.jp>
-
- * ext/iconv/iconv.c
- ext/iconv/php_iconv.h:
- added iconv_get_encoding and supported initialization from php.ini
-
-2001-01-14 David Croft <david@infotrek.co.uk>
-
- * ext/standard/datetime.c: reserve space for quoted characters
- fixes buffer overrun bug #8694
-
-2001-01-14 Stig Bakken <ssb@fast.no>
-
- * pear/DB/tests/ibase/.cvsignore
- pear/DB/tests/ibase/001.phpt
- pear/DB/tests/ibase/002.phpt
- pear/DB/tests/ibase/003.phpt
- pear/DB/tests/ibase/004.phpt
- pear/DB/tests/ibase/006.phpt
- pear/DB/tests/ibase/010.phpt
- pear/DB/tests/ibase/connect.inc
- pear/DB/tests/ibase/mktable.inc
- pear/DB/tests/ibase/skipif.inc:
- * defined some interbase tests, unable to run them yet
-
-2001-01-13 Zeev Suraski <zeev@zend.com>
-
- * ext/standard/basic_functions.c
- ext/standard/file.c
- ext/standard/file.h
- ext/standard/fsock.c
- ext/standard/fsock.h:
- Both thread-safe and thread-unsafe builds should be ok now
-
- * ext/sybase_ct/php_sybase_ct.c:
- Add sybase_get_last_message() from Jan Fedak <J.Fedak@sh.cvut.cz>
-
-2001-01-13 Derick Rethans <d.rethans@jdimedia.nl>
-
- * ext/standard/fsock.c: - Removed a stale var that broke the build
-
- * ext/standard/exec.c:
- - There was one ret left, changed it to FG(pclose_ret), this fixes the
- build
-
-2001-01-13 Colin Viebrock <colin@easydns.com>
-
- * ext/mcrypt/mcrypt.c:
- Support for perl-compatible blowfish encryption (in libmcrypt CVS and
- versions later than 2.4.8)
-
- * pear/Crypt/CBC.php: Credit
-
- * pear/Crypt/CBC.php: Cre
- PR:
- Submitted by:
- Reviewed by:
- Obtained from:
-
-2001-01-13 Zeev Suraski <zeev@zend.com>
-
- * ext/standard/exec.c
- ext/standard/file.c
- ext/standard/file.h
- ext/standard/fsock.c
- ext/standard/fsock.h: - Fix exec() bug
- - Merge fsock and file globals
-
- * main/main.c: cleanup time...
-
- * main/main.c: Remove some more useless code
-
- * main/main.c
- main/php_ini.c: Remove stale code
-
- * ext/standard/http_fopen_wrapper.c
- main/network.c: Fix Windows & thread-safe build
-
-2001-01-13 Stig Venaas <venaas@uninett.no>
-
- * configure.in
- main/network.c:
- Simplified code a bit, added detailed error reporting, and fixed a bug
- when getaddrinfo returned a non-IP family before IP families
-
-2001-01-13 Sascha Schumann <sascha@schumann.cx>
-
- * main/rfc1867.c:
- arr_index errorneusly included the trailing ']' character, so that
- variable names like Data_name[Image]] were passed to the register functions.
-
- * pear/Makefile.in: Fix make install in VPATH builds
-
-2001-01-13 Stig Venaas <venaas@uninett.no>
-
- * ext/ldap/ldap.c:
- Fixed memory leaks that could happen in some error situations. Also removed
- some unnecessary code in ldap_set_option()
-
- * ext/openssl/openssl.c:
- Realized that emalloc() never returns NULL, simplified code
-
-2001-01-12 Sean Grimes <metallic@noworlater.net>
-
- * pear/XML/Render.php:
- Adding Render.php, which helps render documents from XML files.
-
-2001-01-12 Stig Venaas <venaas@uninett.no>
-
- * ext/ldap/ldap.c:
- Added parallel search when given array of link identifiers
-
- * ext/standard/http_fopen_wrapper.c:
- Follows redirects again, and $http_response_header now contains all headers
- with an empty string as delimiter
-
-2001-01-12 Jani Taskinen <sniper@iki.fi>
-
- * ext/domxml/php_domxml.c: - Fixed a possible crash bug in xmltree().
-
-2001-01-12 Sascha Schumann <sascha@schumann.cx>
-
- * ext/ircg/ircg.c:
- We never want to appand to the result string, so set len to 0 initially.
-
- * ext/ircg/ircg.c: Encode HTML entities by default
-
- * ext/ircg/ircg.c:
- Add a hook for signaling "you're gone" to the client on channel part
-
-2001-01-12 Chuck Hagenbuch <chuck@horde.org>
-
- * pear/HTTP/Compress.php
- pear/Makefile.in:
- Add HTTP_Compress::, which provides an easy wrapper around producing
- gzip-compressed html. This should be ported to use the ob_gzhandler() output
- handler, but I haven't had a chance to look into that yet.
-
-2001-01-12 Sascha Schumann <sascha@schumann.cx>
-
- * ext/ircg/ircg.c:
- Add a format string which allows us to implement a transaction-like
- JS interface for large joins (many changes, one commit).
-
- * ext/ircg/ircg.c
- ext/ircg/php_ircg.h: Make the format-msg functions actually available.
-
- * ext/ircg/ircg.c:
- Make some strings static to avoid reallocating the buffers a thousand
- times per second.
-
- * ext/ircg/ircg.c:
- Try to be more memory friendly by avoiding storing redundant data.
-
-2001-01-12 Sterling Hughes <Sterling.Hughes@pentap.net>
-
- * ext/curl/curl.c
- ext/curl/php_curl.h: Make daniel's changes work in ZTS mode...
-
-2001-01-12 Daniel Beulshausen <daniel@php4win.de>
-
- * ext/curl/php_curl.h: take out emtpy struct
-
-2001-01-12 Mika Tuupola <tuupola@appelsiini.net>
-
- * pear/Makefile.in:
- PR:
- Submitted by:
- Reviewed by:
- Obtained from:
- Added Image_Remote class.
-
-2001-01-12 Rasmus Lerdorf <rasmus@php.net>
-
- * ext/mysql/php_mysql.c:
- Fix for bug 6073 from Sean R. Bright <elixer@erols.com>
-
-2001-01-11 Colin Viebrock <colin@easydns.com>
-
- * pear/Crypt/CBC.php: Class that emulates Perl's Crypt::CBC module
-
- PR:
- Submitted by:
- Reviewed by:
- Obtained from:
-
-2001-01-11 Chuck Hagenbuch <chuck@horde.org>
-
- * pear/PHPDoc/apidoc/keep/index2.html
- pear/PHPDoc/renderer/html/PhpdocHTMLIndexRenderer.php:
- rename this frame. for some reason, IE wasn't recognizing the target
- correctly, but it works with a shorter frame name. go figure.
-
- * pear/PHPDoc/xmlreader/PhpdocXMLReader.php:
- xml_parse_into_struct() forces the third and fourth arguments to be passed
- by reference; there's no need to specify it at call-time and cause a warning.
-
-2001-01-11 Andrei Zmievski <andrei@ispi.net>
-
- * pear/Console/Getopt.php
- pear/Makefile.in:
- - Added Console_Getopt class for parsing command-line args. (Andrei, PEAR)
-
-2001-01-11 Jani Taskinen <sniper@iki.fi>
-
- * ext/sablot/config.m4: Fix build.
-
-2001-01-11 Zeev Suraski <zeev@zend.com>
-
- * main/php_version.h
- NEWS
- configure.in: Prepare to roll pl1
- PR:
- Submitted by:
- Reviewed by:
- Obtained from:
-
-2001-01-11 Jani Taskinen <sniper@iki.fi>
-
- * ext/wddx/php_wddx.h: If external expat is used, header file is expat.h
-
-2001-01-11 Daniel Beulshausen <daniel@php4win.de>
-
- * ext/sablot/sablot.dsp: removed old expat libs
-
-2001-01-11 Sterling Hughes <Sterling.Hughes@pentap.net>
-
- * ext/zziplib/CREDITS
- ext/zziplib/EXPERIMENTAL
- ext/zziplib/README
- EXTENSIONS: Housekeeping...
-
- * ext/zziplib/php_zziplib.h
- ext/zziplib/zziplib.c:
- Add an experimental version of the ZZipLib extension which provides the
- ability to read zip files.
-
-2001-01-10 Sascha Schumann <sascha@schumann.cx>
-
- * ext/ircg/ircg.c: Improved handling for empty format strings
-
- Also kill a warning
-
- * ext/ircg/ircg.c:
- Fix a bug of the D'oh! class (RETVAL instead of RETURN), let the first
- irconn_id be 1 and allow empty strings as format strings.
-
- * ext/ircg/ircg.c:
- Check the return value irc_connect(). There are some cases where
- that function would fail and we were leaking memory.
-
-2001-01-10 Rui Hirokawa <louis@cityfujisawa.ne.jp>
-
- * main/php_compat.h: *** empty log message ***
-
- * ext/sablot/config.m4
- ext/xml/config.m4:
- disable directory search for libexpat and disable some macros for libxml-1.95.
-
-2001-01-10 Sascha Schumann <sascha@schumann.cx>
-
- * sapi/thttpd/thttpd.c:
- Especially on FreeBSD it seems to be common that send(2) does not
- do a decent job. We handle that better now.
-
- * ext/ircg/ircg.c:
- Remove unused channel element from the php_irconn structure.
-
- Remove unnecessary check when freeing custom format messages.
-
- Improve handling, if send(2) fails.
-
-2001-01-10 Thies C. Arntzen <thies@thieso.net>
-
- * ext/standard/exec.c:
- exec'd processes now get cleaned up even if the browser connections was
- aborted.
- fixes: #8143
-
-2001-01-10 David Croft <david@infotrek.co.uk>
-
- * ext/standard/datetime.c: fixed swatch internet time (bugs#8242,7106)
-
- * ext/standard/datetime.c:
- Allocate buffer in date() for the actual length of the timezone (bug#8292)
-
-2001-01-10 Stig Bakken <ssb@fast.no>
-
- * configure.in: * renamed PEAR scripts
- * set localstatedir
-
- * pear/scripts/.cvsignore: added .cvsignore file
-
- * pear/scripts/pear.in
- pear/scripts/php-config.in
- pear/scripts/phpextdist
- pear/scripts/phpize.in
- pear/Payment/Verisign.php
- pear/XML/Parser.php
- pear/Numbers/Roman.php
- pear/PEAR/Installer.php
- pear/Math/Fraction.php
- pear/Math/Util.php
- pear/Net/Curl.php
- pear/Net/SMTP.php
- pear/Net/Socket.php
- pear/File/Passwd.php
- pear/HTML/Form.php
- pear/Image/Remote.php
- pear/Mail/rfc822.php
- pear/Mail/sendmail.php
- pear/Mail/smtp.php
- pear/Date/Human.php
- pear/File/Find.php
- pear/Benchmark/Iterate.php
- pear/Benchmark/Timer.php
- pear/Cache/Function_Cache.php
- pear/Crypt/HCEMD5.php
- pear/DB/common.php
- pear/DB/ibase.php
- pear/DB/msql.php
- pear/DB/mssql.php
- pear/DB/mysql.php
- pear/DB/oci8.php
- pear/DB/odbc.php
- pear/DB/pgsql.php
- pear/DB/storage.php
- pear/DB/sybase.php
- pear/DB.php
- pear/HTTP.php
- pear/Mail.php
- pear/Makefile.in
- pear/PEAR.php.in
- pear/package.dtd
- pear/pear.in
- pear/php-config.in
- pear/phpextdist
- pear/phpize.in
- pear/run-tests.in: * updated copyrights (thanks Colin)
- * moved scripts to own directory (bug #7635)
-
-2001-01-09 Rui Hirokawa <louis@cityfujisawa.ne.jp>
-
- * ext/sablot/config.m4:
- added a option to dedine libexpat install directory (by Jani Taskinen)
-
-2001-01-09 Colin Viebrock <colin@easydns.com>
-
- * pear/README: I should learn how to spell
- PR:
- Submitted by:
- Reviewed by:
- Obtained from:
-
- * pear/README: Now the coding standards are defined elsewhere ...
- PR:
- Submitted by:
- Reviewed by:
- Obtained from:
-
- * pear/Schedule/At.php:
- Attempt to use PEAR error class ... someone please check this over
-
-2001-01-09 Zeev Suraski <zeev@zend.com>
-
- * ext/pdf/pdf.c
- NEWS: Merge Daniel's PDF fixes
- PR:
- Submitted by:
- Reviewed by:
- Obtained from:
-
-2001-01-09 Colin Viebrock <colin@easydns.com>
-
- * pear/Schedule/At.php: more docs, remove debugging line
-
-2001-01-09 Sterling Hughes <Sterling.Hughes@pentap.net>
-
- * ext/sablot/sablot.c:
- Move the definition of the xslt_set_encoding to the "proper" place in the file and
- fix the prototype.
-
-2001-01-09 Colin Viebrock <colin@easydns.com>
-
- * pear/Schedule/At.php:
- Schedule_AT class: interface to the Unix "at" command
-
- PR:
- Submitted by:
- Reviewed by:
- Obtained from:
-
-2001-01-09 Jon Parise <jon@csh.rit.edu>
-
- * pear/CODING_STANDARDS: Update the copyright year range to 1997-2001.
-
-2001-01-09 Sascha Schumann <sascha@schumann.cx>
-
- * ext/standard/url_scanner_ex.re
- ext/standard/output.c
- ext/standard/url_scanner_ex.c:
- Avoid possible memory leak in the URL scanner, if the connection is
- interrupted during writing the output.
-
-2001-01-09 Egon Schmid <eschmid@s.netic.de>
-
- * ext/iconv/iconv.c: Sorry, two lines are enough.
-
- * ext/iconv/iconv.c: Fixed protos.
-
-2001-01-09 Rui Hirokawa <louis@cityfujisawa.ne.jp>
-
- * ext/iconv/tests/001.phpt: added test code to iconv.
-
- * ext/iconv/Makefile.in
- ext/iconv/config.m4
- ext/iconv/iconv.c
- ext/iconv/php_iconv.h:
- move iconv related functions to separate iconv extension.
-
- * ext/standard/basic_functions.c
- ext/standard/basic_functions.h
- ext/standard/config.m4
- ext/standard/php_string.h
- ext/standard/string.c: added iconv extension.
-
-2001-01-09 Thies C. Arntzen <thies@thieso.net>
-
- * main/safe_mode.c:
- - Allow access to uploaded files in safe_mode. Beware that you can only
- read the file. If you copy it to new location the copy will not have the
- right UID and you script won't be able to access that copy.
-
-2001-01-09 Sascha Schumann <sascha@schumann.cx>
-
- * ext/ircg/README.txt: Update documentation/add status
-
-2001-01-09 Jani Taskinen <sniper@iki.fi>
-
- * ext/standard/basic_functions.c:
- If TZ environment variable is changed call tzset().
-
-2001-01-09 Sascha Schumann <sascha@schumann.cx>
-
- * sapi/thttpd/thttpd.c:
- Propagate the response code/HTTP status code back to thttpd for logging.
-
- * sapi/thttpd/thttpd.c: Account the number of sent bytes properly
-
- * ext/ircg/ircg.c:
- Handle the case that the IRC server kills our connection more gracefully
- (i.e. without segfaulting the whole server).
-
-2001-01-09 Hartmut Holzgraefe <hartmut@six.de>
-
- * pear/php-config.in: fix for Bug id #8606
-
-2001-01-09 Sascha Schumann <sascha@schumann.cx>
-
- * ext/standard/var.c:
- php_add_var_hash() uses sizeof(id) in the calls to zend_hash_*, implying
- that all bytes in the character array have been set (they are used
- to compute the hash value using hashpjw).
-
- The function assumes that sprintf's %p modifier would always prefix
- the output with "0x". On HPUX, this is not the case. Hence, not
- all bytes may be properly initialized before being read.
-
- This has been addressed by using only initialized bytes as the key.
-
- * ext/ircg/ircg.c:
- Use sapi_send_headers() and use the simpler zend_llist_apply*
- function for traversing the message buffer.
-
- * ext/ircg/ircg.c:
- Add an irc handler for (non-)fatal error messages and don't free
- our default strings which are static.
-
- * ext/ircg/ircg.c
- ext/ircg/php_ircg.h: Add ircg_is_conn_alive()
-
- * ext/ircg/ircg.c:
- Kill a warning, initialize some variables properly in mirc_colors(),
- and make the standard output XHTML compatible (to a certain degree).
-
-2001-01-08 Sascha Schumann <sascha@schumann.cx>
-
- * sapi/apache2filter/sapi_apache2.c
- sapi/apache2filter/php_functions.c: Make Apache 2.0 filter build again
-
- * ext/standard/string.c: WS fix
-
- * ext/standard/string.c: Fix ZTS build (broken by iconv-related changes).
-
-2001-01-08 Andrei Zmievski <andrei@ispi.net>
-
- * ext/standard/array.c:
- Changed extract() to check that prefixed name is a valid one.
- Optimized extract() a bit too.
-
-
-2001-01-08 Derick Rethans <d.rethans@jdimedia.nl>
-
- * ext/standard/crypt.c:
- - Fix for bug #8535 - floating point exception on FreeBSD while initializing
- crypt random numbers
-
-2001-01-08 Andrei Zmievski <andrei@ispi.net>
-
- * ext/standard/array.c:
- - Changed extract() to return the number of variables extracted.
-
-2001-01-08 Stanislav Malyshev <stas@zend.com>
-
- * ext/standard/browscap.c:
- Optimize it a bit - no need to dup empty string (which can be pretty common for .ini)
-
- * ext/standard/browscap.c:
- Duplicate property value, otherwise parser would free it and we're in bad shape.
-
- * ext/standard/browscap.c: Fix undefind filehandle type on INI parsing.
-
-2001-01-08 Egon Schmid <eschmid@s.netic.de>
-
- * ext/ldap/ldap.c: Corrected some protos.
-
-2001-01-08 Stig Venaas <venaas@uninett.no>
-
- * ext/ldap/ldap.c
- ext/ldap/php_ldap.h:
- Added ldap_rename(). Currently requires API with ldap_rename().
-
- * NEWS: *** empty log message ***
-
-2001-01-08 Stanislav Malyshev <stas@zend.com>
-
- * ext/standard/exec.c: Use platform's dir separator
-
-2001-01-08 Rasmus Lerdorf <rasmus@php.net>
-
- * NEWS: Test ACL commit
-
-2001-01-08 Stig Bakken <ssb@fast.no>
-
- * pear/PEAR/Installer.php: * display a notice when downloading
-
- * pear/DB/TESTERS
- pear/DB/odbc.php
- pear/PEAR/Installer.php
- pear/DB/STATUS
- pear/pear.in: * updated DB status
- * updated the "pear" script, it can install basic packages now
-
-2001-01-08 Rui Hirokawa <louis@cityfujisawa.ne.jp>
-
- * ext/standard/basic_functions.c
- ext/standard/php_string.h
- ext/standard/string.c:
- added iconv_set_encoding() to change the encoding setting.
-
- * ext/standard/basic_functions.c
- ext/standard/basic_functions.h
- ext/standard/php_string.h
- ext/standard/string.c:
- added a output handler function ob_iconv_handler which tranforms output encoding using iconv().
-
-2001-01-08 Shane Caraveo <shane@php.net>
-
- * sapi/isapi/stresstest/stresstest.cpp: ignore blank lines
-
- * sapi/isapi/stresstest/notes.txt
- sapi/isapi/stresstest/stresstest.cpp: add notes on this program
-
-2001-01-07 Shane Caraveo <shane@php.net>
-
- * sapi/isapi/stresstest/stresstest.cpp
- sapi/isapi/stresstest/stresstest.dsp:
- stresstest is based on cgiwrap. it can be used to debug php4isapi.dll without
- the use of an actual web server.
-
- * sapi/isapi/php4isapi.c: define flag to turn off exception handling
-
-2001-01-07 Stig Venaas <venaas@uninett.no>
-
- * ext/standard/credits_ext.h: Added OpenSSL
-
- * configure.in: Changed OpenSSL requirements from 0.9.6 to 0.9.5
-
- * ext/ldap/ldap.c:
- Minor changes to LDAP_OPT constants, and added support for controls to
- ldap_set_option.
-
-2001-01-07 Zeev Suraski <zeev@zend.com>
-
- * ext/standard/browscap.c: Fix possible startup crash
-
- * main/php_ini.h: Fix CGI build
-
- * main/main.c: Change get_ini_entry to get_configuration_directive
-
-2001-01-07 Derick Rethans <d.rethans@jdimedia.nl>
-
- * ext/standard/crypt.c:
- - Fix for bug 7035, regarding PHP_MAX_SALT_LENGTH for OpenBsd
-
-2001-01-07 Stig Venaas <venaas@uninett.no>
-
- * ext/ldap/ldap.c
- ext/ldap/php_ldap.h:
- Added LDAPv3 stuff. ldap_search() now treats LDAP_ADMINLIMIT_EXCEEDED like
- LDAP_SIZELIMIT_EXCEEDED and returns referral results.
- Added new functions ldap_parse_result(), ldap_first_reference(),
- ldap_next_reference() and ldap_parse_reference() that among other things
- make referrals and search references accessible.
-
-2001-01-07 Sascha Schumann <sascha@schumann.cx>
-
- * ext/imap/php_imap.c: Fix ZTS build which was broken by the last commit
-
-2001-01-07 Thies C. Arntzen <thies@thieso.net>
-
- * ext/oci8/oci8.c: Merged from rev 1.105
-
- * ext/oci8/oci8.c: fix small leak in ociexecute()
- fixes: #8573
- submitted by: tcarroll@chc-chimes.com
-
-2001-01-07 Stig Venaas <venaas@uninett.no>
-
- * acinclude.m4
- ext/openssl/openssl.c:
- Made OpenSSL extension work with 0.9.5 and changed version check to 0.9.5
-
-2001-01-07 Sascha Schumann <sascha@schumann.cx>
-
- * ext/session/session.c:
- Use MAKE_STD_ZVAL/FREE_ZVAL to handle zval memory allocation.
-
- * ext/session/tests/004.phpt
- ext/session/tests/005.phpt: Add a new test and refine the fourth test
-
- * ext/session/mod_user.c
- ext/session/session.c:
- Use zval_ptr_dtor instead of zval_dtor/FREE_ZVAL pair.
-
- Submitted by: Andi Gutmans
-
-2001-01-07 Jani Taskinen <sniper@iki.fi>
-
- * ext/gd/gdcache.h: Fixed bug: 8478
-
- * ext/imap/php_imap.c: imap_user and imap_password were freed too early.
- PR: 8424
-
-2001-01-07 Jon Parise <jon@csh.rit.edu>
-
- * pear/CODING_STANDARDS: Fix typo. This one was my fault, anyway.
-
-2001-01-07 Chuck Hagenbuch <chuck@horde.org>
-
- * pear/CODING_STANDARDS: list the correct modeline for vi.
-
-2001-01-06 Mika Tuupola <tuupola@appelsiini.net>
-
- * pear/Image/Remote.php:
- Initial commit.
-
-2001-01-06 Rui Hirokawa <louis@cityfujisawa.ne.jp>
-
- * ext/gd/config.m4: fixed option name mismatch.
-
- * ext/sablot/config.m4
- ext/sablot/php_sablot.h
- ext/sablot/sablot.c:
- linked with libexpat. it's necessary to use sablot-0.50. added xslt_set_encoding() function.
-
-2001-01-05 Frank M. Kromann <fmk@swwwing.com>
-
- * ext/odbc/php_odbc.c:
- Adding hack to allow odbc_tables to work on Access databases
-
-2001-01-05 Chuck Hagenbuch <chuck@horde.org>
-
- * pear/File/Passwd.php
- pear/Makefile.in:
- add File/Passwd.php to the install rules, and change the class name to
- File_Passwd to match our standard.
-
- * pear/Mail.php: revert Jon's patch, leaving only the correct one.
-
-2001-01-05 Rasmus Lerdorf <rasmus@php.net>
-
- * pear/File/Passwd.php:
- A quick little class I tossed together to manipulate passwd files with
- Will clean it up soonish...
-
-2001-01-05 Jon Parise <jon@csh.rit.edu>
-
- * pear/Mail.php:
- $from_arr is a two-dimensional array here. Treat it as such.
-
- Submitted by: Max Kalika <max@the-triumvirate.net>
-
-2001-01-05 Chuck Hagenbuch <chuck@horde.org>
-
- * pear/Mail.php:
- make sure we get back a flat array from parseAddressList().
-
-2001-01-05 Jon Parise <jon@csh.rit.edu>
-
- * configure.in:
- Fix the substitution of PEAR_INSTALLDIR. (@PEAR_INSTALLDIR@ in pear/PEAR.php.in)
-
-2001-01-05 Daniel Beulshausen <daniel@php4win.de>
-
- * ext/xml/xml.c: remove stupid ifdef's
-
- * win32/php4dll.dsp
- win32/php4dllts.dsp: finally remove -S option from bison
-
- * ext/standard/datetime.c:
- fixed date not allocating enough buffer, bug 7963
-
- * ext/xml/xml.c: include config.w32.h under win32
-
- * sapi/apache/php_apache.c: make threaded apache module build again
-
-2001-01-05 Andi Gutmans <andi@zend.com>
-
- * ext/domxml/php_domxml.c: - Get rid of C++ comments
-
-2001-01-05 Uwe Steinmann <Uwe.Steinmann@fernuni-hagen.de>
-
- * ext/domxml/php_domxml.c:
- - fixed potential segmfault in xmldoc() and xmldocfile()
-
-2001-01-05 Jani Taskinen <sniper@iki.fi>
-
- * configure.in:
- Added missing ieeefp.h. (This is needed e.g. by nsapi on some systems)
-
-2001-01-05 Rui Hirokawa <louis@cityfujisawa.ne.jp>
-
- * ext/xml/Makefile.in
- ext/xml/config.m4
- ext/xml/php_xml.h
- ext/xml/xml.c:
- added libxml-1.95 support and some new functions related to namespace support. changed config.m4 to support xml extension as shared module.
-
-2001-01-05 Chuck Hagenbuch <chuck@horde.org>
-
- * pear/CODING_STANDARDS:
- initial coding standards doc for all to argue over.
-
-2001-01-04 Sebastian Bergmann <sb@sebastian-bergmann.de>
-
- * pear/Benchmark/Iterate.php
- pear/Benchmark/Timer.php:
- Added some more documentation. Fixed whitespaces, at least I hope so.
-
- * pear/Benchmark/Iterate.php
- pear/Benchmark/Timer.php: Changed my email address.
-
-2001-01-04 Frank M. Kromann <fmk@swwwing.com>
-
- * ext/mssql/php_mssql.c:
- Fixing wrong return value when executing statements not returning a record set.
-
-2001-01-04 Sascha Schumann <sascha@schumann.cx>
-
- * ext/session/session.c: MFH session_unset() fix
-
- * tests/dirname.phpt: MFH with version 1.2
-
-2001-01-04 Chuck Hagenbuch <chuck@horde.org>
-
- * pear/Log.php:
- fix the Log::factory() method to assume that the Log stuff is in the
- include_path (like all of PEAR does).
-
-2001-01-04 Jan Borsodi <jb@ez.no>
-
- * ext/qtdom/CREDITS: Added credits.
-
- * ext/qtdom/qtdom_qt.cpp: Removed some stupid header text.
- Implemented functions for returning the error string and starting and stopping the message handler.
- Added comments for all functions.
-
- * ext/qtdom/qtdom_qt.h: Removed some stupid header text.
- Added a new struct for handling error logs and Qt Message Handler handles.
- Added functions for returning the error string and starting and stopping the message handler.
-
- * ext/qtdom/qtdom.c:
- New function qdom_error which returns the error text from the last qdom operation, or FALSE if none occured.
- Fixed the documentation for the qdom_tree function.
- Added init and shutdown code for some global variables.
- Added code for starting and stopping the Qt Message Handler in qdom_tree.
-
- * ext/qtdom/qtdom.h:
- New function qdom_error which returns the error text from the last qdom operation, or FALSE if none occured.
-
-2001-01-04 Jouni Ahto <jah@mork.net>
-
- * ext/informix/ifx.ec
- ext/informix/php_informix.h
- ext/interbase/interbase.c
- ext/interbase/php_interbase.h
- ext/pgsql/pgsql.c
- ext/pgsql/php_pgsql.h
- EXTENSIONS:
- Changing my email address...
-
-2001-01-03 Zeev Suraski <zeev@zend.com>
-
- * NEWS
- configure.in
- main/php_version.h: Prepare 4.0.4pl1-RC1
- PR:
- Submitted by:
- Reviewed by:
- Obtained from:
-
- * sapi/apache/mod_php4.c:
- Fix last couple of problematic execution paths that could corrupt the INI values
-
- * sapi/apache/mod_php4.c:
- Merge Apache module fixes - engine = off propogating to other vhosts
- and possible INI entries corruption
- PR:
- Submitted by:
- Reviewed by:
- Obtained from:
-
-2001-01-03 Chuck Hagenbuch <chuck@horde.org>
-
- * pear/Mail.php
- pear/Mail/rfc822.php:
- Mail.php: use the Mail_rfc822:: class to parse addresses. There is a small
- performance penalty, but it handles rfc822 groups, which
- imap_rfc822_parse_adrlist doesn't.
-
- rfc822.php: Style fixes, some small tweaks/optimizations, and work around a
- bit of object weirdness that caused the test for $this (to see if we were
- being called statically) to not be sufficient.
-
-2001-01-03 Jani Taskinen <sniper@iki.fi>
-
- * acinclude.m4:
- Added better checking for OpenSSL's libraries. Now configure stops
- if the libs aren't found.
-
-2001-01-03 Jon Parise <jon@csh.rit.edu>
-
- * ext/sockets/sockets.c:
- Make socket support compile under Solaris 8 with the Sun WorkShop compiler.
-
- PR: 8468
-
-2001-01-03 Jani Taskinen <sniper@iki.fi>
-
- * ext/pdf/pdf.c: I missed this function..
-
- * ext/curl/curl.c: Fix pr #8305.
-
- * ext/pdf/pdf.c
- ext/pdf/php_pdf.h: Trying to bring pdf extension a bit more up to date.
-
-2001-01-03 Daniel Beulshausen <daniel@php4win.de>
-
- * ext/pdf/pdf.c: fix filepath handling
-
-2001-01-03 Chuck Hagenbuch <chuck@horde.org>
-
- * pear/Makefile.in:
- add Numbers/Roman.php, Net/Curl.php, and XML/RPC.php to the install rules.
-
-2001-01-03 Dan Kalowsky <dank@deadmime.org>
-
- * ext/odbc/php_odbc.c
- ext/odbc/php_odbc.h:
- These changes are to reflect those in the 4.0.5 development branch. Mainly adding in compile capability for the OPENLINK system (changed a SQLINTEGER to an SDWORD to allow compile), and re-added in a #define for SOLID 3.0 systems... both are needed for proper functionality.
- PR:
- Submitted by:
- Reviewed by:
- Obtained from:
-
-2001-01-03 Zeev Suraski <zeev@zend.com>
-
- * main/SAPI.h
- sapi/apache/mod_php4.c:
- Fix Apache module and remove excess elements from the SAPI structure
-
-2001-01-03 Daniel Beulshausen <daniel@php4win.de>
-
- * ext/pdf/pdf.c: fix bug 8341 & 8394
-
-2001-01-03 Jani Taskinen <sniper@iki.fi>
-
- * sapi/apache/mod_php4.c: Fix compile.
-
-2001-01-03 Stanislav Malyshev <stas@zend.com>
-
- * main/rfc1867.c:
- Fix #8486 (name= without quotes in MIME Content-Disposition header)
- Ported fix by kk/sas from PHP 3
-
-2001-01-03 Chuck Hagenbuch <chuck@horde.org>
-
- * pear/Date/Human.php
- pear/Makefile.in:
- add allan@lodestone.co.za's Date_Human calculator class.
-
- * pear/Mail/rfc822.php
- pear/Makefile.in:
- here's an initial version of Richard Heyes' rfc822 email address parser.
-
- * pear/Benchmark/Timer.php:
- match coding standards, and be nice enough to work when bcmath isn't loaded.
-
- * pear/Crypt/HCEMD5.php:
- fix silly bug introduced by wrong order of arguments. this is slightly more
- elegant, anyway...
-
-2001-01-02 Zeev Suraski <zeev@zend.com>
-
- * ext/com/COM.c: Import COM patch from Harald Radi <h.radi@nme.at>
- The new code should allow for better international support.
-
- * sapi/servlet/servlet.c
- sapi/thttpd/thttpd.c
- sapi/phttpd/phttpd.c
- sapi/pi3web/pi3web_sapi.c
- sapi/roxen/roxen.c
- sapi/isapi/php4isapi.c
- sapi/nsapi/nsapi.c
- sapi/apache2filter/sapi_apache2.c
- sapi/caudium/caudium.c
- sapi/cgi/cgi_main.c
- main/php_ini.h
- sapi/aolserver/aolserver.c
- sapi/apache/mod_php4.c
- NEWS
- ext/standard/info.c
- main/SAPI.c
- main/SAPI.h
- main/main.c
- main/php_ini.c: Many patches. I hope I remember them all:
-
- - Make sapi_module available to external modules (PHPAPI)
- - Make the php.ini path reported in phpinfo() always point to
- real full path of the php.ini file
- - Optimized the ISAPI module not to read unnecessary server
- variables and read necessary variables at most once.
-
-2001-01-02 Stig Venaas <venaas@uninett.no>
-
- * acinclude.m4:
- I think the order is wrong, switched order of ssl and crypto libs
-
-2001-01-02 Jon Parise <jon@csh.rit.edu>
-
- * php.ini-dist
- php.ini-optimized: Make this comment readable.
-
-2001-01-02 Chuck Hagenbuch <chuck@horde.org>
-
- * ext/standard/url_scanner_ex.c
- ext/standard/url_scanner_ex.re:
- Make the generated <input> lower case and terminated with a /,
- to be xhtml-compliant.
-
-2001-01-02 Rasmus Lerdorf <rasmus@php.net>
-
- * ext/standard/datetime.c: Fix date('r') overflow
diff --git a/ChangeLog.1999.gz b/ChangeLog.1999.gz
deleted file mode 100644
index 9d92dda73f..0000000000
--- a/ChangeLog.1999.gz
+++ /dev/null
Binary files differ
diff --git a/ChangeLog.2000.gz b/ChangeLog.2000.gz
deleted file mode 100644
index 91cd3b2425..0000000000
--- a/ChangeLog.2000.gz
+++ /dev/null
Binary files differ
diff --git a/EXTENSIONS b/EXTENSIONS
deleted file mode 100644
index 1a88adc7de..0000000000
--- a/EXTENSIONS
+++ /dev/null
@@ -1,426 +0,0 @@
- List of PHP maintainers
- =======================
-
-Maintenance legend
-------------------
- Supported: Someone is actually paid to look after this.
- Maintained: Someone actually looks after it.
- Odd Fixes: It has a maintainer but they don't have time to do
- much other than throw the odd patch in. See below.
- Orphan: No current maintainer [but maybe you could take the
- role as you write your new code].
- Obsolete: Old code. Something tagged obsolete generally means
- it has been replaced by a better system and you
- should be using that.
- Unknown: Not known at this time.
-
-Status legend
--------------
- Working: Working under both Windows and Unix.
- Windows: Working only under Windows.
- Unix: Working only under Unix.
- Experimental: Under development or initial release.
- Not Working: Not working.
- Unknown: Status unknown.
-
-
-== Server APIs ==
-
--------------------------------------------------------------------------------
-EXTENSION: aolserver
-MAINTENANCE: Unknown
-STATUS: Unknown
--------------------------------------------------------------------------------
-EXTENSION: apache
-PRIMARY MAINTAINER: Rasmus Lerdorf <rasmus@php.net>
-MAINTENANCE: Maintained
-STATUS: Working
--------------------------------------------------------------------------------
-EXTENSION: cgi
-MAINTENANCE: Unknown
-STATUS: Working
--------------------------------------------------------------------------------
-EXTENSION: fhttpd
-MAINTENANCE: Unknown
-STATUS: Unknown
--------------------------------------------------------------------------------
-EXTENSION: isapi
-MAINTENANCE: Unknown
-STATUS: Working
--------------------------------------------------------------------------------
-EXTENSION: nsapi
-MAINTENANCE: Unknown
-STATUS: Unknown
--------------------------------------------------------------------------------
-EXTENSION: phttpd
-MAINTENANCE: Unknown
-STATUS: Unknown
--------------------------------------------------------------------------------
-EXTENSION: pi3web
-MAINTENANCE: Unknown
-STATUS: Unknown
--------------------------------------------------------------------------------
-EXTENSION: roxen
-MAINTENANCE: Unknown
-STATUS: Unknown
--------------------------------------------------------------------------------
-EXTENSION: servlet
-PRIMARY MAINTAINER: Sam Ruby <rubys@us.ibm.com>
-MAINTENANCE: Maintained
-STATUS: Working
--------------------------------------------------------------------------------
-EXTENSION: thttpd
-MAINTENANCE: Unknown
-STATUS: Unknown
--------------------------------------------------------------------------------
-
-
-== Database extensions ==
-
--------------------------------------------------------------------------------
-EXTENSION: dba
-PRIMARY MAINTAINER: Sascha Schumann <sascha@schumann.cx>
-MAINTENANCE: Maintained
-STATUS: Working
--------------------------------------------------------------------------------
-EXTENSION: dbase
-PRIMARY MAINTAINER: Jim Winstead <jimw@php.net>
-MAINTENANCE: Odd Fixes
-STATUS: Working
--------------------------------------------------------------------------------
-EXTENSION: filepro
-MAINTENANCE: Unknown
-STATUS: Unknown
--------------------------------------------------------------------------------
-EXTENSION: hyperwave
-PRIMARY MAINTAINER: Uwe Steinmann <steinm@php.net>
-MAINTENANCE: Maintained
-STATUS: Working
--------------------------------------------------------------------------------
-EXTENSION: informix
-PRIMARY MAINTAINER: Danny Heijl <Danny.Heijl@cevi.be>
-MAINTENANCE: Maintained
-STATUS: Working
--------------------------------------------------------------------------------
-EXTENSION: ingres_ii
-PRIMARY MAINTAINER: David Hénot <henot@php.net>
-MAINTENANCE: Maintained
-STATUS: Experimental
-SINCE: 4.0.2
--------------------------------------------------------------------------------
-EXTENSION: interbase
-PRIMARY MAINTAINER: Jouni Ahto <jouni.ahto@exdec.fi>
-MAINTENANCE: Odd Fixes
-STATUS: Working
--------------------------------------------------------------------------------
-EXTENSION: msql
-MAINTENANCE: Unknown
-STATUS: Working
--------------------------------------------------------------------------------
-EXTENSION: mssql
-PRIMARY MAINTAINER: Frank M. Kromann <fmk@swwwing.com>
-MAINTENANCE: Maintained
-STATUS: Working
-COMMENT: Tested on phpts and isapi versions
--------------------------------------------------------------------------------
-EXTENSION: mysql
-MAINTENANCE: Unknown
-STATUS: Working
--------------------------------------------------------------------------------
-EXTENSION: pgsql
-PRIMARY MAINTAINER: Jouni Ahto <jouni.ahto@exdec.fi>
-MAINTENANCE: Odd fixes
-STATUS: Working
--------------------------------------------------------------------------------
-EXTENSION: sybase
-MAINTENANCE: Unknown
-STATUS: Not Working
--------------------------------------------------------------------------------
-EXTENSION: sybase_ct
-MAINTENANCE: Unknown
-STATUS: Working
--------------------------------------------------------------------------------
-EXTENSION: oci8
-PRIMARY MAINTAINER: Thies C. Arntzen <thies@thieso.net>
-MAINTENANCE: Maintained
-STATUS: Working
--------------------------------------------------------------------------------
-EXTENSION: odbc
-PRIMARY MAINTAINER: Andreas Karajannis <Karajannis@gmd.de>
-MAINTENANCE: Maintained
-STATUS: Working
-COMMENT: Working except for persistent connections
--------------------------------------------------------------------------------
-EXTENSION: oracle
-PRIMARY MAINTAINER: Thies C. Arntzen <thies@thieso.net>
-MAINTENANCE: Maintained
-STATUS: Working
-COMMENT: Using the new OCI8 driver is encouraged where possible.
--------------------------------------------------------------------------------
-
-
-== Other extensions ==
-
--------------------------------------------------------------------------------
-EXTENSION: aspell
-MAINTENANCE: Unknown
-STATUS: Working
-COMMENT: For aspell .27 and greater, check out the pspell extension
--------------------------------------------------------------------------------
-EXTENSION: bcmath
-MAINTENANCE: Unknown
-STATUS: Unknown
--------------------------------------------------------------------------------
-EXTENSION: bz2
-PRIMARY MAINTAINER: Sterling Hughes <sterling@php.net>
-MAINTENANCE: Maintained
-STATUS: Working
-SINCE: 4.0.3
--------------------------------------------------------------------------------
-EXTENSION: calendar
-MAINTENANCE: Unknown
-STATUS: Unknown
--------------------------------------------------------------------------------
-EXTENSION: com
-MAINTENANCE: Unknown
-STATUS: Unknown
--------------------------------------------------------------------------------
-EXTENSION: cpdf
-PRIMARY MAINTAINER: Uwe Steinmann <steinm@php.net>
-MAINTENANCE: Maintained
-STATUS: Working
--------------------------------------------------------------------------------
-EXTENSION: crack
-MAINTENANCE: Unknown
-STATUS: Experimental
-SINCE: 4.0.5
--------------------------------------------------------------------------------
-EXTENSION: curl
-PRIMARY MAINTAINER: Sterling Hughes <sterling@php.net>
-MAINTENANCE: Maintained
-STATUS: Working
-SINCE: 4.0.2
--------------------------------------------------------------------------------
-EXTENSION: cybercash
-PRIMARY MAINTAINER: Evan Klinger <evan715@sirius.com>
-MAINTENANCE: Maintained
-STATUS: Unknown
--------------------------------------------------------------------------------
-EXTENSION: domxml
-PRIMARY MAINTAINER: Uwe Steinmann <steinm@php.net>
-MAINTENANCE: Maintained
-STATUS: Experimental
--------------------------------------------------------------------------------
-EXTENSION: dotnet
-PRIMARY MAINTAINER: Sam Ruby <rubys@us.ibm.com>
-MAINTENANCE: Maintained
-STATUS: Experimental
--------------------------------------------------------------------------------
-EXTENSION: exif
-MAINTENANCE: Unknown
-STATUS: Unknown
-SINCE: 4.0.1
--------------------------------------------------------------------------------
-EXTENSION: fdf
-PRIMARY MAINTAINER: Uwe Steinmann <steinm@php.net>
-MAINTENANCE: Maintained
-STATUS: Unknown
--------------------------------------------------------------------------------
-EXTENSION: ftp
-MAINTENANCE: Unknown
-STATUS: Unknown
--------------------------------------------------------------------------------
-EXTENSION: gd
-PRIMARY MAINTAINER: Rasmus Lerdorf <rasmus@php.net>
-MAINTENANCE: Maintained
-STATUS: Working
--------------------------------------------------------------------------------
-EXTENSION: gettext
-MAINTENANCE: Unknown
-STATUS: Working
--------------------------------------------------------------------------------
-EXTENSION: gmp
-MAINTENANCE: Unknown
-STATUS: Unknown
-SINCE: 4.0.4
--------------------------------------------------------------------------------
-EXTENSION: icap
-MAINTENANCE: Unknown
-STATUS: Obsolete
--------------------------------------------------------------------------------
-EXTENSION: imap
-PRIMARY MAINTAINER: Chuck Hagenbuch <chuck@horde.org>
-MAINTENANCE: Odd Fixes
-STATUS: Working
--------------------------------------------------------------------------------
-EXTENSION: java
-PRIMARY MAINTAINER: Sam Ruby <rubys@us.ibm.com>
-MAINTENANCE: Maintained
-STATUS: Working
--------------------------------------------------------------------------------
-EXTENSION: ldap
-PRIMARY MAINTAINER: Rasmus Lerdorf <rasmus@php.net>
-MAINTENANCE: Odd Fixes
-STATUS: Working
--------------------------------------------------------------------------------
-EXTENSION: mcal
-PRIMARY MAINTAINER: Chuck Hagenbuch <chuck@horde.org>
-MAINTENANCE: Odd Fixes
-STATUS: Working
--------------------------------------------------------------------------------
-EXTENSION: mcrypt
-PRIMARY MAINTAINER: Sascha Schumann <sascha@schumann.cx>
-MAINTENANCE: Maintained
-STATUS: Working
--------------------------------------------------------------------------------
-EXTENSION: mhash
-PRIMARY MAINTAINER: Sascha Schumann <sascha@schumann.cx>
-MAINTENANCE: Maintained
-STATUS: Working
--------------------------------------------------------------------------------
-EXTENSION: muscat
-PRIMARY MAINTAINER: Sam Liddicott <sam@ananova.com>
-MAINTENANCE: Maintained
-STATUS: Working
-SINCE: 4.0.5
-COMMENT: Not tested against windows, only core API completed, rest under development
--------------------------------------------------------------------------------
-EXTENSION: openssl
-PRIMARY MAINTAINER: Wez Furlong <wez@php.net>
-MAINTENANCE: Maintained
-STATUS: Experimental
-SINCE: 4.0.4
--------------------------------------------------------------------------------
-EXTENSION: pcre
-PRIMARY MAINTAINER: Andrei Zmievski <andrei@ispi.net>
-MAINTENANCE: Maintained
-STATUS: Working
--------------------------------------------------------------------------------
-EXTENSION: pdf
-PRIMARY MAINTAINER: Uwe Steinmann <steinm@php.net>
-MAINTENANCE: Maintained
-STATUS: Working
--------------------------------------------------------------------------------
-EXTENSION: pfpro
-PRIMARY MAINTAINER: David Croft <david@infotrek.co.uk>
-MAINTENANCE: Maintained
-STATUS: Working
-SINCE: 4.0.2
--------------------------------------------------------------------------------
-EXTENSION: posix
-PRIMARY MAINTAINER: Kristian Köhntopp <kris@koehntopp.de>
-MAINTENANCE: Maintained
-STATUS: Working
--------------------------------------------------------------------------------
-EXTENSION: printer
-PRIMARY MAINTAINER: Daniel Beulshausen <daniel@php4win.de>
-MAINTENANCE: Maintained
-STATUS: Working
-SINCE: 4.0.4
-COMMENT: Only for Win32
--------------------------------------------------------------------------------
-EXTENSION: pspell
-PRIMARY MAINTAINER: Vlad Krupin <phpdevel@echospace.com>
-MAINTENANCE: Unknown
-STATUS: Unknown
-SINCE: 4.0.2
--------------------------------------------------------------------------------
-EXTENSION: qtdom
-MAINTENANCE: Unknown
-STATUS: Experimental
-SINCE: 4.0.4
--------------------------------------------------------------------------------
-EXTENSION: readline
-MAINTENANCE: Unknown
-STATUS: Unknown
--------------------------------------------------------------------------------
-EXTENSION: recode
-PRIMARY MAINTAINER: Kristian Köhntopp <kris@koehntopp.de>
-MAINTENANCE: Maintained
-STATUS: Working
--------------------------------------------------------------------------------
-EXTENSION: sablot
-PRIMARY MAINTAINER: Sterling Hughes <sterling@php.net>
-MAINTENANCE: Maintained
-STATUS: Experimental
-SINCE: 4.0.3
--------------------------------------------------------------------------------
-EXTENSION: satellite
-PRIMARY MAINTAINER: David Eriksson <eriksson@php.net>
-MAINTENANCE: Odd Fixes
-STATUS: Experimental
-SINCE: 4.0.3
--------------------------------------------------------------------------------
-EXTENSION: session
-PRIMARY MAINTAINER: Sascha Schumann <sascha@schumann.cx>
-MAINTENANCE: Maintained
-STATUS: Working
--------------------------------------------------------------------------------
-EXTENSION: shmop
-PRIMARY MAINTAINER: Unknown
-MAINTENANCE: Unknown
-STATUS: Experimental
-SINCE: 4.0.3
--------------------------------------------------------------------------------
-EXTENSION: snmp
-PRIMARY MAINTAINER: Rasmus Lerdorf <rasmus@php.net>
-MAINTENANCE: Odd Fixes
-STATUS: Working
--------------------------------------------------------------------------------
-EXTENSION: sockets
-PRIMARY MAINTAINER: Chris Vandomelen <chrisv@b0rked.dhs.org>
-MAINTENANCE: Maintained
-STATUS: Experimental
-SINCE: 4.0.2
--------------------------------------------------------------------------------
-EXTENSION: swf
-PRIMARY MAINTAINER: Sterling Hughes <sterling@php.net>
-MAINTENANCE: Maintained
-STATUS: Depreciated (Use the ming swf extension instead)
-COMMENT: Only for Unix (won't change)
--------------------------------------------------------------------------------
-EXTENSION: sysvsem
-MAINTENANCE: Unknown
-STATUS: Unknown
--------------------------------------------------------------------------------
-EXTENSION: sysvshm
-MAINTENANCE: Unknown
-STATUS: Working
--------------------------------------------------------------------------------
-EXTENSION: vpopmail
-MAINTENANCE: Unknown
-STATUS: Experimental
-SINCE: 4.0.5
--------------------------------------------------------------------------------
-EXTENSION: wddx
-PRIMARY MAINTAINER: Andrei Zmievski <andrei@ispi.net>
-MAINTENANCE: Maintained
-STATUS: Working
--------------------------------------------------------------------------------
-EXTENSION: xml
-PRIMARY MAINTAINER: Thies C. Arntzen <thies@thieso.net>
-MAINTENANCE: Maintained
-STATUS: Working
--------------------------------------------------------------------------------
-EXTENSION: yaz
-PRIMARY MAINTAINER: Adam Dickmeiss <adam@indexdata.dk>
-MAINTENANCE: Maintained
-STATUS: Unknown
-SINCE: 4.0.1
--------------------------------------------------------------------------------
-EXTENSION: yp
-MAINTENANCE: Unknown
-STATUS: Unknown
--------------------------------------------------------------------------------
-EXTENSION: zlib
-PRIMARY MAINTAINER: Stefan Roehrich <sr@linux.de>
-MAINTENANCE: Maintained
-STATUS: Working
--------------------------------------------------------------------------------
-EXTENSION: zziplib
-PRIMARY MAINTAINER: Sterling Hughes <sterling@php.net>
-MAINTENANCE: Maintained
-STATUS: Experimental
-SINCE: 4.0.5
--------------------------------------------------------------------------------
-# iptc?
diff --git a/INSTALL b/INSTALL
deleted file mode 100644
index 17e2d7a743..0000000000
--- a/INSTALL
+++ /dev/null
@@ -1,406 +0,0 @@
-Installation Instructions for PHP 4.0
--------------------------------------
-
-For the impatient here is a quick set of steps that will build PHP as
-first a dynamic Apache module (DSO) for Apache 1.3.x with MySQL support
-and then a static module. A more verbose explanation follows.
-
-For installing PHP on other web servers, refer to one of the following
-files:
-
- sapi/aolserver/README
- sapi/pi3web/README
- sapi/servlet/README
- sapi/thttpd/README
- README.Zeus
-
-Note! Only install either the static module or the dynamic one. Do not
-install both.
-
-Note 2! If you are recompiling PHP to add new extensions or upgrading
-something like GD, remove the config.cache file before you re-run
-configure.
-
-Note 3! If you are on Linux and have installed shared libraries, make
-sure the location of these shared libraries are listed in your
-/etc/ld.so.conf file. For example, if you have:
-
- /usr/local/lib/mysql/libmysqlclient.so
-
-Make sure /etc/ld.so.conf contains:
-
- /usr/local/lib/mysql
-
-Then run ldconfig.
-
-If you want both PHP 3 and 4 modules in the same Apache server, check the
-bottom of this file for instructions.
-
-INSTALLATION WITH THE ZEUS WEB SERVER:
---Please see the 'README.Zeus' file included in this distribution
-
-
-QUICK INSTALL (DSO)
-
-For this to work your Apache httpd must have mod_so enabled.
-Check using httpd -l. You should see something like:
-
-Compiled-in modules:
- http_core.c
- mod_so.c
-
-Chances are you will see a lot more modules than these two. That's ok,
-as long as mod_so.c shows up you can proceed with the following steps:
-
-$ gunzip -c php-4.0.x.tar.gz | tar xf -
-$ cd php-4.0.x
-$ ./configure --with-mysql --with-apxs
-$ make
-$ make install
-
-If you get an error telling you that the apxs script could not be found,
-look for it on your system and if you find it, provide the full path to it
-as: --with-apxs=/path/to/apxs
-
-Next you must copy php.ini-dist to the appropriate place (normally
-/usr/local/lib/php.ini) and edit it as necessary to set PHP options.
-
-The only thing left to do is to edit your httpd.conf file and make sure the
-PHP 4 mime type is there and uncommented. You need a line that looks like
-this:
-
- AddType application/x-httpd-php .php
-
-Then restart your server (apachectl restart) and you should be able to
-serve up PHP files now. Make a test file called test.php and put some
-PHP tags in it. Like <?phpinfo()?>, for example.
-
-
-QUICK INSTALL (Static)
-
-$ gunzip -c apache_1.3.x.tar.gz | tar xf -
-$ cd apache_1.3.x
-$ ./configure
-$ cd ..
-
-$ gunzip -c php-4.0.x.tar.gz | tar xf -
-$ cd php-4.0.x
-$ ./configure --with-mysql --with-apache=../apache_1.3.x --enable-track-vars
-$ make
-$ make install
-
-$ cd ../apache_1.3.x
-$ ./configure --prefix=/www --activate-module=src/modules/php4/libphp4.a
- (The above line is correct! Yes, we know libphp4.a does not exist at this
- stage. It isn't supposed to. It will be created.)
-$ make
- (you should now have an httpd binary which you can copy to your Apache bin dir if
- is is your first install then you need to "make install" as well)
-$ cd ../php-4.0.x
-$ cp php.ini-dist /usr/local/lib/php.ini
-You can edit /usr/local/lib/php.ini file to set PHP options.
-Edit your httpd.conf or srm.conf file and add:
- AddType application/x-httpd-php .php
-
-
-VERBOSE INSTALL
-
-Chances are you are reading this because the quick install steps above
-did not work for you. If this is the case, congratulations, you are
-among the elite few that actually reads documentation. It really is
-not a difficult install and once you have done it once you will fly
-through it.
-
-Installing PHP can be done in four simple steps:
-
-1. Unpack your distribution file.
-
- You will have downloaded a file named something like php-4.0.x.tar.gz.
- Unzip this file with a command like: gunzip php-4.0.x.tar.gz
-
- Next you have to untar it with: tar -xvf php-4.0.x.tar
-
- This will create a php-4.0.x directory. cd into this new directory.
-
-2a. Configure PHP (Dynamic Module) - Skip to 2b if you wish to build
- a static module
-
- You now have to choose the options you would like. There are quite
- a few of them. To see a list, type: ./configure --help
-
- The only options that you are likely to want to use are the ones in
- the last section entitled, "--enable and --with options recognized:"
-
- A popular choice is to build the Apache module version. In order to
- build PHP as a dynamic module for Apache-1.3.x you have to first have
- Apache installed. Assuming Apache is already installed, make sure
- the shared object module is enabled. To check this, type: httpd -l
- You should see something like:
-
- Compiled-in modules:
- http_core.c
- mod_so.c
-
- You will most likely have a lot more modules than what is shown here.
- As long as mod_so.c shows up in the list, PHP should be happy.
-
- Now, type: ./configure --with-mysql --with-apxs
-
- If you get an error telling you that the apxs script could not be found,
- look for it on your system and if you find it, provide the full path to it
- as: --with-apxs=/path/to/apxs
-
- You might also want other flags on this configure line. --with-mysql
- is just an example.
-
- There are a few things that can go wrong during this configure step.
- The most common is that you have asked for an option and that the
- configure script can not find the files required to enable this
- option in PHP. Chances are you can provide the full path to the
- base directory under which the related files were installed. For
- example, if you have installed the GD library in /opt/gd which means
- that /opt/gd/include has your GD header files and /opt/gd/lib contains
- your GD library files, you would use --with-gd=/opt/gd
-
- Skip to step 3 for compilation and installation instructions.
-
-2b. Configure PHP (Static Module) - Skip if you performed 2a
-
- You now have to choose the options you would like. There are quite
- a few of them. To see a list, type: ./configure --help
-
- The only options that you are likely to want to use are the ones in
- the last section entitled, "--enable and --with options recognized:"
-
- A popular choice is to build the Apache module version. You need
- to know where the source code directory for your Apache server is
- located. Then use an option like: --with-apache=/usr/local/src/apache
- if that is your Apache source code directory. If you only specify
- --with-apache, then it will default to look for your Apache source
- in /usr/local/etc/httpd.
-
- NOTE: The directory you specify should be the top-level of the
- unpacked Apache (or Stronghold) distribution. The configure program
- will automatically look for httpd.h in different directories under that
- location depending on which version of Apache, including Stronghold,
- you are running.
-
- For MySQL support, since newer versions of MySQL installs its various
- components under /usr/local, this is the default. If you have
- changed the location you can specify it with: --with-mysql=/opt/local
- for example. Otherwise just use: --with-mysql
-
- *NOTE* If you are using Apache 1.3b6 or later, you should run the
- Apache Configure script at least once before compiling PHP. It
- doesn't matter how you have Apache configured at this point.
-
- Skip to step 3b at this point.
-
-3. Compile and install the files. Simply type: make install
-
-3a. Dynamic Module Installation
-
- Nothing else is needed here. Proceed to step 4a.
-
-3b. Static Module Installation
-
- For the Apache module version this will copy the appropriate files
- to the src/modules/php4 directory in your Apache distribution if
- you are using Apache 1.3.x. If you are still running Apache 1.2.x
- these files will be copied directly to the main src directory.
-
- For Apache 1.3b6 and later, you can use the new APACI configuration
- mechanism. To automatically build Apache with PHP support, use:
-
- cd apache_1.3.x
- ./configure --prefix=/<path>/apache \
- --activate-module=src/modules/php4/libphp4.a
- make
- make install
-
- If you do not wish to use this new configuration tool, the old
- install procedure (src/Configure) will work fine.
-
- If you are using the old Apache ./Configure script, you will have to
- edit the Apache src/Configuration file manually. If you do not have
- this file, copy Configuration.tmpl to Configuration.
-
- For Apache 1.3.x add:
-
- AddModule modules/php4/libphp4.a
-
- For Apache 1.3.x don't do anything else. Just add this line and then
- run "./Configure" followed by "make".
-
- For Apache 1.2.x add:
-
- Module php4_module mod_php4.o
-
- For Apache 1.2.x you will also have to look in the libphp4.module file,
- which was copied to the src directory. The EXTRA_LIBS line in the Apache
- Configuration file needs to be set to use the same libs as specified on
- the LIBS line in libphp4.module. You also need to make sure to add
- "-L." to the beginning of the EXTRA_LIBS line.
-
- So, as an example, your EXTRA_LIBS line might look like:
-
- EXTRA_LIBS=-L. -lphp4 -lgdbm -ldb -L/usr/local/mysql/lib -lmysqlclient
-
- NOTE: You should not enclose the EXTRA_LIBS line in double-quotes, as it
- is in the libphp4.module file.
-
- Also, look at the RULE_WANTHSREGEX setting in the libphp4.module file
- and set the WANTHSREGEX directive accordingly in your Configuration file.
- This last step applies to versions of Apache prior to 1.3b3.
-
- This is a bit of a hassle, but should serve as incentive to move to
- Apache 1.3.x where this step has been eliminated.
-
- Once you are satisfied with your Configuration settings, type: ./Configure
- If you get errors, chances are that you forgot a library or made a typo
- somewhere. Re-edit Configuration and try again. If it goes well,
- type: make
-
- Assuming it compiles without errors, proceed to step 4b.
-
-4a. Setting up the server. (Dynamic Module)
-
- The make install command in step 3 should have done most of your
- work for you. It actually edits your httpd.conf file and tries to
- enable the dynamic PHP module. To verify this, look for a line that
- looks like this:
-
- LoadModule php4_module libexec/libphp4.so
-
- The actual path before the libphp4.so part might differ slightly. This
- is likely fine. If you are paranoid you can examine the output from the
- make install step to see where the libphp4.so file was actually put and
- place the full path to this file on this LoadModule line.
-
- If somewhere in your httpd.conf file you have a ClearModuleList line
- then you also need this line:
-
- AddModule mod_php4.c
-
- And finally you need to tell Apache which file extension should trigger
- PHP. You do this by creating a special mime type and associating it
- with an extension. We suggest using:
-
- AddType application/x-httpd-php .php
-
- You are however free to use any extension you wish, including .html.
-
- Note! If a line has a # at the beginning, then it is commented out
- and you need to remove the # for that line to take effect.
-
- Finally you need to copy php.ini-dist to the appropriate place
- (normally /usr/local/lib/php.ini) and edit if necessary.
-
- Once you have made these changes you should be ready to restart your
- server and try it out. Type: apachectl restart
-
-4b. Setting up the server. (Static Module)
-
- You should now have a new httpd binary. Shut down your existing server,
- if you have one, and copy this new binary overtop of it. Perhaps make
- a backup of your previous one first. Then edit your conf/httpd.conf file
- and add the line:
-
- AddType application/x-httpd-php .php
-
- There is also an interesting feature which can be quite instructive and
- helpful while debugging. That is the option of having colour syntax
- highlighting. To enable this, add the following line:
-
- AddType application/x-httpd-php-source .phps
-
- Any file ending in .phps will now be displayed with full colour syntax
- highlighting instead of being executed.
-
- Note that on some older server setups, the AddType lines are in the
- conf/srm.conf file instead of conf/httpd.conf.
-
- Note! If a line has a # at the beginning, then it is commented out
- and you need to remove the # for that line to take effect.
-
- When you are finished making changes to your httpd.conf file, you need
- to copy php.ini-dist to the appropriate place (normally
- /usr/local/lib/php.ini) and edit if necessary. You can then
- start up your server.
-
-5. Testing it all worked
-
- Create a test file named test.php in your web tree somewhere and
- put some test PHP tags in it. <?phpinfo()?> is a good first test.
- This tag tells PHP to do a braindump and tells you all sorts of things
- about itself.
-
-
-WHY DISABLING -fPIC WORKS ON LINUX
-
- From: Martin v. Loewis <martin@loewis.home.cs.tu-berlin.de>
- To: glibc-linux@ricardo.ecn.wfu.edu
- Subject: Re: Shared library -shared vs. -fpic
-
- [In reply to Kaz Kylheku <kaz@ashi.footprints.net>]
-
- > PIC stands for Position-Independent Code.
-
- Correct.
-
- > Code isn't position-independent (or ``relocatable'') cannot be
- > loaded at an arbitrary address;
-
- Wrong.
-
- > it requires some references to be patched at load time.
-
- Correct.
-
- > Shared libraries need to be relocatable because it's not known
- > beforehand what address they will be loaded at
-
- Correct, depending on the meaning of "relocatable". PIC code typically
- does not contain relocations; that's why its position-independent.
-
- > Just because you don't specify -fPIC doesn't mean that the compiler
- > won't emit position-independent code; the option prevents it from
- > emitting position-dependent code in situations where it otherwise
- > would.
-
- Correct. However, a non-trivial shared library typically won't be
- position-independent unless explicitly compiled with
- -fPIC. Linux/glibc indeed does not require a shared library to be
- position-independent; instead, it will perform the relocations in the
- binary, even if they refer to code pages. As a result, those relocated
- pages won't be shared across processes, anymore.
-
- Regards,
- Martin
-
-USING PHP 3 AND PHP 4 AS CONCURRENT APACHE MODULES
-
- Recent operating systems provide the ability to perform versioning and
- scoping. This features make it possible to let PHP 3 and PHP 4 run as
- concurrent modules in one Apache server.
-
- This feature is known to work on the following platforms:
-
- - Linux with recent binutils (binutils 2.9.1.0.25 tested)
- - Solaris 2.5 or better
- - FreeBSD (3.2, 4.0 tested)
- - IRIX64 6.5
-
- To enable it, configure PHP 3 and PHP 4 to use APXS (--with-apxs) and the
- necessary link extensions (--enable-versioning). Otherwise, all standard
- installations instructions apply. For example:
-
- $ ./configure \
- --with-apxs=/apache/bin/apxs \
- --enable-versioning \
- --with-mysql \
- --enable-track-vars
-
- If this also works on your platform or if you know a way to do it, please
- report it to our bug database at http://bugs.php.net
-
diff --git a/LICENSE b/LICENSE
deleted file mode 100644
index 5f6658e4a8..0000000000
--- a/LICENSE
+++ /dev/null
@@ -1,75 +0,0 @@
---------------------------------------------------------------------
- The PHP License, version 2.02
-Copyright (c) 1999, 2000 The PHP Group. All rights reserved.
---------------------------------------------------------------------
-
-Redistribution and use in source and binary forms, with or without
-modification, is permitted provided that the following conditions
-are met:
-
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above
- copyright notice, this list of conditions and the following
- disclaimer in the documentation and/or other materials provided
- with the distribution.
-
- 3. The name "PHP" must not be used to endorse or promote products
- derived from this software without prior permission from the
- PHP Group. This does not apply to add-on libraries or tools
- that work in conjunction with PHP. In such a case the PHP
- name may be used to indicate that the product supports PHP.
-
- 4. The PHP Group may publish revised and/or new versions of the
- license from time to time. Each version will be given a
- distinguishing version number.
- Once covered code has been published under a particular version
- of the license, you may always continue to use it under the
- terms of that version. You may also choose to use such covered
- code under the terms of any subsequent version of the license
- published by the PHP Group. No one other than the PHP Group has
- the right to modify the terms applicable to covered code created
- under this License.
-
- 5. Redistributions of any form whatsoever must retain the following
- acknowledgment:
- "This product includes PHP, freely available from
- http://www.php.net/".
-
- 6. The software incorporates the Zend Engine, a product of Zend
- Technologies, Ltd. ("Zend"). The Zend Engine is licensed to the
- PHP Association (pursuant to a grant from Zend that can be
- found at http://www.php.net/license/ZendGrant/) for
- distribution to you under this license agreement, only as a
- part of PHP. In the event that you separate the Zend Engine
- (or any portion thereof) from the rest of the software, or
- modify the Zend Engine, or any portion thereof, your use of the
- separated or modified Zend Engine software shall not be governed
- by this license, and instead shall be governed by the license
- set forth at http://www.zend.com/license/ZendLicense/.
-
-
-
-THIS SOFTWARE IS PROVIDED BY THE PHP DEVELOPMENT TEAM ``AS IS'' AND
-ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
-THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
-PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PHP
-DEVELOPMENT TEAM OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
-INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
-STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
-OF THE POSSIBILITY OF SUCH DAMAGE.
-
---------------------------------------------------------------------
-
-This software consists of voluntary contributions made by many
-individuals on behalf of the PHP Group.
-
-The PHP Group can be contacted via Email at group@php.net.
-
-For more information on the PHP Group and the PHP project,
-please see <http://www.php.net>.
diff --git a/Makefile.in b/Makefile.in
deleted file mode 100644
index 0bb067c87d..0000000000
--- a/Makefile.in
+++ /dev/null
@@ -1,62 +0,0 @@
-
-ZEND_DIR = $(srcdir)/Zend
-SUBDIRS = Zend main ext sapi $(TSRM_DIR) $(REGEX_DIR) . $(PEAR_DIR)
-
-LTLIBRARY_NAME = libphp4.la
-LTLIBRARY_SOURCES = stub.c
-
-LTLIBRARY_DEPENDENCIES = \
- Zend/libZend.la \
- sapi/$(PHP_SAPI)/libsapi.la \
- main/libmain.la \
- $(REGEX_LIB) \
- $(EXT_LTLIBS) \
- $(TSRM_LIB)
-
-LTLIBRARY_LDFLAGS = -rpath $(phptempdir) $(EXTRA_LDFLAGS) $(LDFLAGS) $(PHP_RPATHS)
-LTLIBRARY_LIBADD = $(LTLIBRARY_DEPENDENCIES) $(EXTRA_LIBS)
-
-PROGRAM_NAME = php
-PROGRAM_SOURCES = stub.c
-PROGRAM_LDADD = libphp4.la $(EXT_PROGRAM_LDADD)
-PROGRAM_LDFLAGS = -export-dynamic
-PROGRAM_DEPENDENCIES = $(PROGRAM_LDADD)
-
-targets = $(LTLIBRARY_NAME) $(PHP_PROGRAM)
-
-install_targets = install-sapi install-modules
-
-include $(top_srcdir)/build/rules.mk
-include $(top_srcdir)/build/library.mk
-include $(top_srcdir)/build/program.mk
-
-install-sapi:
- @$(LIBTOOL) --silent --mode=install cp libphp4.la $(phptempdir)/libphp4.la >/dev/null 2>&1
- -@$(mkinstalldirs) $(INSTALL_ROOT)$(bindir)
- -@if test ! -r $(phptempdir)/libphp4.$(SHLIB_SUFFIX_NAME); then \
- for i in 0.0.0 0.0 0; do \
- if test -r $(phptempdir)/libphp4.$(SHLIB_SUFFIX_NAME).$$i; then \
- $(LN_S) $(phptempdir)/libphp4.$(SHLIB_SUFFIX_NAME).$$i $(phptempdir)/libphp4.$(SHLIB_SUFFIX_NAME); \
- break; \
- fi; \
- done; \
- fi
- $(INSTALL_IT)
-
-install-modules:
- @test -d modules && \
- $(mkinstalldirs) $(INSTALL_ROOT)$(moduledir) && \
- echo "installing shared modules into $(moduledir)" && \
- rm -f modules/*.la && \
- cp modules/* $(INSTALL_ROOT)$(moduledir) >/dev/null 2>&1 || true
-
-install-tester:
- -$(mkinstalldirs) $(datadir)
- $(INSTALL) -m 755 $(srcdir)/run-tests.php $(INSTALL_ROOT)$(datadir)
-
-install-pear: install-modules
- (cd pear && $(MAKE) install)
-
-install-su: install-pear install-tester
-
-.NOEXPORT:
diff --git a/NEWS b/NEWS
deleted file mode 100644
index 8c4c01e1bb..0000000000
--- a/NEWS
+++ /dev/null
@@ -1,1507 +0,0 @@
-PHP 4.0 NEWS
-|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
-?? ??? 200?, Version 4.0.7-dev
-- References between session-variables are now possible. (Thies)
-- Fixed a crash bug in the string-offsets implementation (Zeev, Zend Engine)
-- Improved the implementation of parent::method_name() for classes which use
- run-time inheritence (Zeev, Zend Engine)
-- added 'W' flag to date() function to return week number of year using
- ISO 8601 standard (Colin)
-- Allow the PostgreSQL driver to do internal row counting when iterating
- through result sets. (gvz@2scale.net)
-- Updated ext/mysql/libmysql to version 3.23.39; Portability fixes, minor
- bug fixes. (tim@mysql.com)
-- Added the CONNECTION_ABORTED, CONNECTION_TIMEOUT and CONNECTION_NORMAL
- constants. (Zak)
-- Added get_defined_constants() function to return an associative array of
- constants mapped to their values. (Sean)
-- New mailparse extension for parsing and manipulating MIME mail. (Wez)
-- Define HAVE_CONFIG_H when building standalone DSO extensions. (Stig)
-- Added the 'u' modifier to printf/sprintf which prints unsigned longs.
- (Derick)
-- Improved IRIX compatibility. (Sascha)
-- Fixed crash bug in bzopen() when specifying an invalid file. (Andi)
-- Fixed bugs in the mcrypt extension that caused crashes. (Derick)
-- Added the IMG_ARC_ROUNDED option for the ImageFilledArc() function, which
- specified that the drawn curve should be rounded. (Sterling)
-- Updated the sockets extension to use resources instead of longs for the
- socket descriptors. The socket functions have been renamed to conform with
- the PHP standard instead of their C counterparts. The sockets extension is
- now usable under Win32. (Daniel)
-- Added disk_total_space() to return the total size of a filesystem.
- (Patch from Steven Bower)
-- Renamed diskfreespace() to disk_free_space() to conform to established
- naming conventions. (Jon)
-- Fixed #2181. Now zero is returned instead of an unset value for
- 7-bit encoding and plain text body type. (Vlad)
-- Fixed a bug in call_user_*() functions that would not allow calling
- functions/methods that accepted parameters by reference. (Andrei)
-- Added com_release($obj) and com_addref($obj) functions and the related class
- members $obj->Release() and $obj->AddRef() to gain more control over the used
- COM components. (phanto)
-- Added an additional parameter to dotnet_load to specify the codepage (phanto)
-- Added peak memory logging. Use --enable-memory-limit to create a new Apache
- 1.x logging directive "{mod_php_memory_usage}n" which will log the peak
- amount of memory used by the script. (Thies)
-- Made fstat() and stat() provide identical output by returning a numerical and
- string indexed array. (Jason)
-- Fixed memory leak upon re-registering constants. (Sascha, Zend Engine)
-- Upgraded expat to version 1.95.1. (Thies)
-
-?? ??? 200?, Version 4.0.6
-- Fix memory fragmention problem which could lead to web server processes
- growing much more than they should. (Andi, Zend Engine)
-- Made $HTTP_SESSION_VARS['foo'] and $foo be references to the same value
- when register_globals is on. (Andrei)
-- Fix disk_free_space() and disk_total_space() under FreeBSD. (Jon)
-- Fixed readfile/passthru losing resources during connection abort (Sascha)
-- Fixed bug in the mcrypt extension that caused segfaults when using a key
- that is too large for the used algorithm, and a bug that caused
- mcrypt_generic() to segfault PHP (Derick)
-- Fixed getopt so that it accepts command line arguments in the form
- -<opt><arg> and -<opt> <arg>. (Jmoore)
-- Fixed race in writing session files. (Sascha)
-- Fixed a possible crash in the PHP CGI when no input file is
- specified. (Zeev)
-- Added is_callable() function that can be used to find out whether
- its argument is a valid callable construct. (Andrei)
-- Fixed a rare possible crash when generating extended information. (Dmitri
- Dmitrienko, Zend Engine)
-- Improved virtual() to support PHP-enabled URIs. (Zeev)
-- Fixed undefined behavior when using floating point keys in array()
- expressions. (Zeev, Zend Engine)
-- Fixed a possible crash in case of parse errors in include files or eval
- statements. (Zeev, Zend Engine)
-- Added --with-layout configure option. (Stig)
-- Improved interactive mode - supports function calls, and works in
- multithreaded builds. (Zeev, Zend Engine)
-- Fixed a crash bug in interactive mode. (Zeev, Zend Engine)
-- Add pg_last_notice() function. (Rasmus from suggestion by Dirk@rackspace.com)
-- Fixed a bug in preg_split() that would incorrectly limit the number of
- results when used along with PREG_SPLIT_NO_EMPTY flag. (Andrei)
-- Added connection error support to mysql_error() and mysql_errno(). (Jason)
-- Added support to getimagesize to return dimensions of BMP and PSD
- files. (Derick)
-- Added heuristic to kill stale IRC connections, message scanner caching, and
- nickname escaping to IRCG, suppress option to ircg_msg(), and statistics to
- IRCG phpinfo() output. (Sascha)
-- Added Japanese multibyte string functions support. (Rui)
-- Added Mac OS X "\r" line ending support. (Andi, Zend Engine)
-- Fixed a bug regarding the $PHP_SELF being incorrectly registered when
- force-cgi-redirect was not enabled. (Sterling)
-- pfpro extension now supports version 3 of the Verisign SDK. (John Donagher)
-- Udm_Cat_List and Udm_Cat_Path functions has been added.
-- Added key_exists() to check if a given key or index exists in an
- array or object. (David Croft)
-- Modify the cURL extension to compile only with the latest cURL release.
- Backwards compatibility with regards to the extension api has not been
- broken. (Sterling)
-- Added the ability to use user-defined callbacks with cURL. (Sterling)
-- Added the SSL_VERIFYPEER, CAINFO, MAXREDIRS, FILETIME, RANDOM_FILE, EGDSOCKET
- and CONNECTTIMEOUT options to curl_setopt(). (Sterling)
-- Added support for persistent connections with cURL. (Sterling)
-- Fixed a problem in cURL with file descriptors being allocated, but never
- closed. (Sterling)
-- Fixed interactive mode (-a). It works again with the same limitations it
- has always had. (Andi, Zend Engine)
-- Improved memory manager to use less memory and provide better memory overflow
- detection abilities in debug mode. (Andi, Zend Engine)
-- Fixed resource leaks when resources were being cast to numbers. (Zeev, Zend
- Engine)
-- Fixed foreach() to not crash when being sent an invalid argument. (Andi, Zend
- Engine)
-- Fixed a bug in opendir() under Windows when trying to open a non-exisiting
- directory. (Andi)
-- Fixed popen() and the exec family under Win32 (Unable to fork issue). (Daniel)
-- Make the printf family of functions binary clean. (Rasmus)
-- Fixed WDDX serialization to HTML-escape key/variable names so as not to
- break the XML packet. (Andrei)
-- Made WDDX extension enabled by default. (Andrei)
-- Added -C command-line option to avoid chdir to the script's directory. (Stig)
-- Fixed a bug with /e modifier in preg_replace(), that would not correctly
- replace two-digit references if single digit references were present
- before them. This fixed bug #10218. (Andrei)
-- Added temporary LOB support in OCI8. (Patch by David Benson)
-- Fixed crash in pathinfo()
-- OCI8 now supports binding of collections. (Patch by Andy Sautins
- <asautins@veripost.net>)
-- Added GD 2.0.1 support for truecolor and alpha channels, plus some other gd
- functions, both old and new - see docs for more info. (Wez)
-- Added S/MIME sign/verify encrypt/decrypt functions to openssl extension,
- along with some other certificate manipulation and interrogation functions.
- See docs for more info. (Wez)
-- printf argnum (parameter swapping) support. (Morten Poulsen, Rasmus)
-- Add DIRECTORY_SEPARATOR constant ('/' on UNIX, '\' on Windows). (Stig)
-- Added small change to php_odbc module, to check for failed SQLDisconnects
- and to close any outstanding transactions if the call fails, then disconnect
- again. (lurcher)
-- Modified get_parent_class() and get_class_methods() to accept a class name as
- well as a class instance. (Andrei, Zend Engine)
-- Added support for UNC style paths. (\\server\share\file,
- //server/share/file). (Daniel, TSRM)
-- Added dbx module (database abstraction) to the repository. (Marc)
-- Using ITypeInfo instead of IDispatch if possible. This makes DCOM calls
- and even COM calls much faster.
- All ini settings are now prefixed by 'com.'.
- Now you need not provide a path to the file containing the typelib, you can
- also provide the GUID of the TypeLib - entry or an IID for preloading
- type - information. (phanto)
-- Rewrite of domxml. It's now mostly DOM Level 2 conform. (Uwe)
-- Added array_map() function that applies a callback to the elements
- of given arrays and returns the result. It can also be used with a
- null callback to transpose arrays. (Andrei)
-- Added array_filter(), which allows filtering of array elements via
- the specified callback. (Andrei)
-- Fixed all relevant array functions to avoid moving the internal array
- pointer during operations. (Andrei)
-- Added mysql_unbuffered_query(), which is useful for very large result sets.
- (Zeev)
-
-30 Apr 2001, Version 4.0.5
-- Added new php.ini directive: arg_separator.input which is used to tell
- PHP which characters are considered as argument separators in URLs.
- Renamed php.ini directive: arg_separator -> arg_separator.output (Jani)
-- Added FastCGI SAPI module. (Ben Mansell)
-- Added array_reduce(), which allows iterative reduction of an array
- to a single value via a callback function. (Andrei)
-- The imageloadfont function of the gd extension should be not platform
- dependent after this fix. (alex@zend.com)
-- Fixed a compatibility problem in some file functions (fgets, fputs, fread,
- fwrite). The ANSI standard says that if a file is opened in read/write
- mode, fseek() should be called before switching from reading to writing
- and vice versa. (alex@zend.com)
-- Fixed argument checking for call_user_func* functions and allowed
- specifying array($obj, 'method') syntax for call_user_func_array. (Andrei)
-- Fixed parent::method() to also work with runtime bindings.
- (Zeev, Zend Engine)
-- Implemented high-performance zlib-based output compression - see
- zlib.output_compression INI directive. (Zeev)
-- Improved ob_gzhandler() to support chunked output buffering - it's
- recommended to use it with 4KB chunks. (Zeev)
-- Fixed chunked output buffering. (Zeev)
-- Forced call_user_method() and call_user_method_array() to take the
- object argument by reference. (Andrei)
-- Fixed binding of ROWIDs in OCI8. (Thies)
-- Added PEAR/Cache as a generic Caching System. (Sebastian, PEAR/Cache)
-- Added IMAP quota support (imap_set_quota, imap_get_quota), enabled/added via
- c-client2000. (kalowsky)
-- Upgraded PCRE to version 3.4. (Andrei)
-- Added array_search which works similar to in_array but returns
- the key instead of a boolean. (jason@php.net)
-- Fixed pgsql transaction support. (Stig, PEAR/DB)
-- Added new object VARIANT() to encapsulate values for use with
- the COM and DOTNET module. Therefore it is now possible to pass
- values by reference, convert php values to extended variant types (currency,
- date, idispatch, iunknown, ...) and define the codepage that should
- be used for unicode - conversion.
-- Improved overall speed of IRCG, added URL handling to message scanner.
- (Sascha)
-- Fixed some modules to allow using output-buffering. (Thies)
-- Added the chroot() function. (Derick)
-- PostgreSQL now does a rollback at the end of a request on every
- persistent connection. This is done by doing an "empty" transaction
- on the connection. This was advised by someone from the PostgreSQL
- core-team. (Thies)
-- Fixed PostgeSQL pg_connect() bug. We would sometimes close the default
- link by accident. (Patch by: aja@nlgroup.ca)
-- Improved OCI8 dead-session detection. (Patch by: George Schlossnagle)
-- Fixed get_meta_tags() multiline bug #4556. (Sean)
-- Prefer random() over *rand48(). (JimJag)
-- Sped up WDDX serialization 2x. (Andrei)
-- Added a new parameter to mail() which appends aditional command line
- parameters to the mail program. (Derick)
-- Added Udm_Clear_Search_Limits mnoGoSearch extension function. (gluke)
-- Fixed mnogosearch protos. Fixed mnogosearch functions return values.
- A bug with capital letters break search has been fixed. (gluke)
-- Static methods can now be called via call_user_method_* functions, e.g.
- call_user_method('method', 'class'), and also array('class', 'method')
- constructs (for array_walk(), for example). (Andrei, Zend Engine)
-- microtime() under Windows now returns accurate values. (James)
-- Added PREG_SPLIT_DELIM_CAPTURE flag to preg_split() that allows for Perl-like
- functionality of capturing parenthesized delimiter expression. (Andrei)
-- Fixed strip_tags() to not strip a lone > character. (Rasmus)
-- When using the ob_gzhandler() PHP now automagically also sets the
- Content-Lengh correctly which enables browsers to use the HTTP
- Keep-Alive feature. (Thies)
-- Improved handling of preg_replace() /F modifier so that it's possible to
- specify array($obj, 'method') construct as a replacement function. (Andrei)
-- Added mysql_get_client_info(), mysql_get_server_info(),
- mysql_get_proto_info(), and mysql_get_host_info() functions. (Sean)
-- Major change of the php pdf api. It could break some functions though
- backwards compatibility was tried to maintain. Adding some still
- missing functions as well. (Uwe)
-- Added mnoGoSearch extension - http://search.mnogo.ru. (Sergey K)
-- Allow URL encoding in DB usernames and passwords. (Stig, PEAR)
-- Added raiseError and setErrorHandling methods to PEAR class. (Stig, PEAR)
-- Added support for converting images from JPG/PNG on the fly with the GD
- extension, which is usefull for creating dynamic WAP-sites. (Derick)
-- Updated ext/mysql/libmysql to version 3.23.32; bug fixes. (tim@mysql.com)
-- Fixed possible crash in all (non-pcre) regex functions. (Thies)
-- Improved str_replace() to accept an array for any parameter - similar
- to preg_replace(). (Andrei)
-- Fixed extract() to properly prefix numeric keys when EXTR_PREFIX_ALL is
- used. (Andrei)
-- Added EXTR_PREFIX_INVALID flag to extract() to automatically prefix
- string keys that do not constitute valid variable names. (Andrei)
-- BeOS patch from svanegmond@bang.dhs.org, modified somewhat by Rasmus.
-- Fixed the Apache module to overwrite PATH_TRANSLATED with SCRIPT_FILENAME,
- only if PATH_TRANSLATED is not previously set. (Zeev)
-- Fixed crash bug in highlight_string(). (Rasmus)
-- Added URL support for getimagesize() function. (Jani)
-- Added xslt_set_scheme_handler() function. (carmelo@akooe.com)
-- Added the pg_lolseek and pg_lotell functions. (Derick)
-- Fixed wrong breaking with the wordwrap function. (Derick)
-- Fixed 'O' and 'r' flags of date() to have correct sign for timezone
- offset. (Andrei)
-- Changed 'Z' flag to date() to always return timezone offset with
- negative sign if it's west of UTC. (Andrei)
-- Added the HTML_Processor class which provides common functions for
- processing HTML. (Sterling)
-- Added localeconv() and strcoll() functions for localization. (Sean)
-- Added the xslt_set_base function. (Sterling)
-- Added support for Zeus 3.3.8.
-- Added odbc_error() and odbc_errormsg() functions. (Stig)
-- New extension for vpopmail - http://www.inter7.com/vpopmail,
- give it a try, but keep in mind that it is not ready for production
- environments. (David Croft, Boian Bonev)
-- Added sybase_get_last_message() to the Sybase CT module. (Jan Fedak)
-- Made ldap_list(), ldap_read() and ldap_search() do parallel search when
- first parameter is an array of link identifiers. (Stig Venaas)
-- Made fopen() of HTTP URL follow redirects, $http_response_header will
- contain all headers with empty string as delimiter. (Stig Venaas)
-- Added Console_Getopt class for parsing command-line args. (Andrei, PEAR)
-- Added an experimental version of the ZZipLib extension which provides the
- ability to read zip files. (Sterling)
-- Allow access to uploaded files in safe_mode. Beware that you can only
- read the file. If you copy it to new location the copy will not have the
- right UID and you script won't be able to access that copy. (Thies)
-- Changed extract() to check that prefixed name is a valid one. (Andrei)
-- Changed extract() to return the number of variables extracted. (Andrei)
-- Added ldap_rename() function. (Stig Venaas)
-- Made ldap_set_option() support controls. (Stig Venaas)
-- Changed ldap_search() and added functions ldap_parse_result(),
- ldap_first_reference(), ldap_next_reference() and ldap_parse_reference()
- to cope with LDAPv3 stuff like referrals and references. (Stig Venaas)
-- Fixed date('r') overflow.
-- Made the php.ini path reported in phpinfo() always point to the absolute
- path that was opened. (Zeev)
-- Made the INI mechanism thread safe. (Zeev, Zend Engine)
-- Changed setlocale() to use LC_* constants. (Jani)
-- ctype functions now follow the extension naming conventions. (Hartmut)
-- Added iconv() function (using libc or libiconv). (Stig)
-- Added ODBC_TYPE constant. (Stig)
-- Added the call_user_method_array function which allows you to call a method
- with an arbitrary number of parameters. (Sterling)
-- ext/odbc: IBM DB2 patch by Walter Franzini. <walter@sys-net.it>
-- Added extension for the cracklib library. (Alexander Feldman)
-
-19 Dec. 2000, Version 4.0.4
-- Allow assigning a newly created object by reference. This is needed only if
- your constructor makes other data structures reference the $this object (for
- example, $GLOBALS["foobar"] =& $this;)
- The new syntax is $obj =& new MyClass(); (Andi, Zend Engine)
-- Allow for three expression types to be sent to functions which are requesting
- the function argument to be passed by reference (only c. was previously
- supported):
- a. func(new myclass());
- b. func(func2()); where func2() returns a reference, i.e. is defined as
- function &func2(...)
- {
- ...
- }
- c. func($var); where func() is defined as function func(&$var) {...}
- You CAN'T count on any other expressions to be passable by reference.
- (Andi, Zend Engine)
-- Made ldap_get_entries() return an array even if there are no entries
- in search result. (Jani)
-- Fixed bad mod_perl interaction which caused segfaults when using LFS (Sascha)
-- const CONSTNAME now gets recognized. Before the patch only @const CONSTNAME
- description was recognized.
-- Added the is_null() function that will return true if a variable is of
- type null. (Sterling)
-- Fixed a bug which made readdir() unusable in some systems. (Jani)
-- Added the get_defined_functions() function which returns a list of all
- currently defined functions. (Sterling)
-- Added the get_defined_vars() function which returns an associative array
- of all variables defined in the current scope and their subsequent values.
- (Sterling)
-- Added the call_user_func_array() function which gives you the ability to
- call a user function by passing an array of parameters as the second
- argument. (Sterling)
-- Added the constant() function which returns the value of a constant given
- the constant's name. (Sterling)
-- Implemented support for Perl-style matching regexp delimiters in PCRE.
- You can use <{[( and )]}> to delimit your expressions now. (Andrei)
-- Introduced new 'F' modifier in PCRE that lets you specify a function
- name in the replacement argument to preg_replace() that will be called
- at run-time to provide the replacement string. It is passed an array of
- matched pattern and subpatterns. (Andrei)
-- Put an end to BUG#4615 (kalowsky & Eric Veldhuyzen)
-- Added the IRCG extension (Sascha)
-- Fixed realpath() in Virtual Directory mode (Daniel)
-- Integrated the Phil Nelson's bc math library routines into PHP, now that
- the license allows it (Phil Nelson <phil@cs.wwu.edu>)
-- Added the xslt_set_error_handler() function to the Sablotron extension.
- (Sterling)
-- Improved Sablotron's error handling system allowing you to catch all
- errors before they are outputted to the screen. (Sterling)
-- Added OpenSSL extension (Stig Venaas)
-- Fixed/created support for Solid 3.0 databases (kalowsky)
-- Fixed support for Solid 2.3 databases (kalowsky)
-- quoted_printable_decode() function is made RFC-2045 compliant. (Kir)
-- Modified preg_grep() to always return the results with keys from the original
- array. (Andrei)
-- Modified preg_replace() to accept Perl-style $n backreferences in addition
- to \\n ones. (Andrei)
-- Modified preg_replace() to ignore backreferences that refer to
- non-existing subpatterns. (Andrei)
-- Fixed column-title buffer-overflow in OCIFetchStatement(). (Thies)
-- Added 'output_handler' INI directive (Zeev)
-- Fixed some buglets in the output buffering mechanism (Zeev)
-- Added transparent gzip compression support (Jade Nicoletti, Zeev)
-- Major overhaul of domxml. Added basic XPath support as well (Uwe)
-- Added 'r' flag to date() which generates an RFC822 formatted date, e.g.
- "Thu, 9 Nov 2000 16:33:01 -0500" (Colin)
-- In CGI mode, $HTTP_SERVER_VARS now includes all of the environment variables
- as well (Zeev)
-- Allow user to use mysql_use_result in mysql queries (Stas)
-- Fixed a memory leak that would occur when restarting Apache often
- (mookid@sigent.ru)
-- Fixed a bug that prevented $argv and $argc from being defined in the command
- line version of PHP (Stas)
-- Fixed a bug that prevented a changed compile-time extension_dir from
- affecting modules that were loaded via php.ini (Zeev)
-- Fixed a bug in ftp_mkdir() when used on ftp server which doesn't return
- the full path (Jani)
-- Added ImageCreateFromString() which creates an image stream out of
- e.g. a MySQL blob. (Mathieu)
-- Fixed a crash bug in imagewbmp() (Jani)
-- Changed the sablot configuration file so that if you use any version of
- Sablotron below 0.44 you must use Sablotron's built-in Expat libraries.
- (Sterling)
-- Added basic authentication support to thttpd (Sascha)
-- Added support for the Caudium webserver (http://caudium.net/). It's based
- on the Roxen SAPI module. Many bugs have been identified and fixed. (David)
-- Fixed mysql_close(), pg_close(), msql_close() and sybase_close() - they
- weren't properly closing the SQL connections (Zeev)
-- Fixed crypt() to supply random seed if none is given (Andi)
-- Made print_r() support recursive data structures, e.g. $GLOBALS. (Zeev)
-- Fixed a bug that caused PHP not to properly flush its output buffer, if more
- than one output buffer was used. (Zeev)
-- Fixed a bug that could draw the shutdown sequence of the PHP Apache module
- into an endless loop, under certain circumstances. It could cause Apache
- processes under Solaris to get stuck, especially when using output
- buffering. (Zeev)
-- Added support for serializing references (Stas)
-- Fixed conflict with OpenLDAP and Oracle 8.1.x (Jani)
-- parse_ini_file() supports a new optional 2nd argument that instructs it
- to divide the directives to arrays according to the sections in which they
- reside (Zeev)
-- parse_ini_file() is now thread-safe, and supported under Windows (Zeev)
-- Unified aborted-connection semantics of all SAPI modules (Sascha)
-- URL-opened files now store the HTTP response header in $http_response_header
- (Zeev)
-- Fixed array_rand() to shuffle results when the number of requested
- elements is the same as the number of elements in the array. (Andrei)
-- Added replace parameter to header() (Sascha)
-- Fixed handling of single quotes in transparent session-id mode (Sascha)
-- Fixed "php://*" fopen handler (Sascha)
-- Made rename work in threadsafe enviroments (Daniel)
-- Made session_destroy() close files before unlinking (Daniel)
-- Added array_sum() function. (Andrei)
-- Fixed a bug in session.c. The php_session_save_current_state did not check
- if mod_data is NULL and such situation is possible if the user calls
- session_module_name with a parameter. (alex@zend.com)
-- Added IIS Admin extension. (Frank)
-- OCIBindByName() now does better parameter-checking. (Thies)
-- Made read() binary-safe in sockets.c (Chris Vandomelen)
-- Made array_intersect() and array_diff() not alter order (Stig Venaas)
-- Made ldap_connect() accept URL in host parameter when using OpenLDAP
- 2.x. To use SSL, use ldaps://host/ as URL. (Stig Venaas)
-- Made resource type names visible, e.g. var_dump() and
- get_resource_type() display "file" for file resources. (Andrei)
-- Added the curl_getinfo() function to find out information about a CURL
- transfer. This function requires cURL 7.4.0 or above. (Sterling)
-- Added the CURLOPT_KRB4, CURLOPT_INTERFACE, CURLOPT_QUOTE, CURLOPT_POSTQUOTE,
- CURLOPT_QUOTE and CURLOPT_HTTPPROXYTUNNELL options. (Sterling)
-- Renamed the shm_* functions to shmop_* (Derick)
-- Updated ext/mysql/libmysql to version 3.23 (tim@mysql.com)
-- Added ldap_get_option() and ldap_set_option() functions (Stig Venaas)
-- Fixed a crash in CGI mode, in case no file was provided
- (Daniel Beulshausen& Zeev)
-- Fixed possible crash bug in imap_fetchstructure() (Jani)
-- Fixed possible crash bug in imap_open() (Jani & Mark Musone)
-- Added url_rewriter.tags configuration directive (Sascha)
-- Added CORBA client extension, ready for use (eriksson@php.net)
-- Fixed memory leak in x-httpd-source mode (Jason Greene)
-- Changed ext/gd not to be enabled by default (Jani)
-- Make increment of empty string ("") behave like in PHP 3 and result in "1"
- (Andi, Zend Engine)
-- Added POST handler for Adobe FDF format (Hartmut)
-- Added transparent read and write .gz-files on glibc based systems
- using the 'zlib:' fopen wrapper (Hartmut)
-- Fixed a problem in the configuration parser (two null bytes were added
- to each ENCAPSULATED TC_STRING) (alex@zend.com)
-- Added HMAC support in the mhash module (nmav@altera.gr)
-- Added module for Ovrimos sql server (nmav@altera.gr)
-
-11 Oct 2000, Version 4.0.3
-- Fixed a possible crash in -a interactive mode (Zeev, Zend Engine)
-- Added mysql_escape_string() (Peter A. Savitch and & Brian Wang)
-- Fixed many possible crash bugs with improper use of the printf() family of
- functions (Andi)
-- Fixed a problem that allowed users to override admin_value's and admin_flag's
- (Zeev)
-- Fixed PostgreSQL module to work when the link handle is omitted (Zeev)
-- Fixed returning of empty LOB fields in OCI8. (Thies)
-- Added Calendar module to default Win32 build (Andi)
-- Added FTP module to default Win32 build (Andi)
-- Fixed crash in the POSIX getrlimit() function (alex@zend.com)
-- Fixed dirname() under certain conditions (Andi)
-- Added --with-imap-ssl to support SSL'ized imap library in RH7 and others
- (Rasmus)
-- Fixed possible crash bug in parse_url() (Andi)
-- Added support for trans sid under Win32 (Daniel)
-- Added IPv6 support in fopen (Stig Venaas)
-- Added the shmop extension. It allows more general ways of shared memory
- access. (thanks to Ilia Alshanestky <iliaa@home.com> and Slava Poliakov
- <slavapl@mailandnews.com> (Derick)
-- Added the ability for CURLOPT_POSTFIELDS to accept an associative array of
- HTTP POST variables and values. (Sterling)
-- Added the CURLOPT_HTTPHEADER option to curl_setopt(). (Sterling)
-- Added the curl_error() and curl_errno() functions. (Sterling)
-- Changed ext/db not to be enabled by default (Jani)
-- Fixed building Apache SAPI module on SCO UnixWare (Sascha)
-- Fixed writing empty session sets to shared memory (tcarroll@chc-chimes.com)
-- Added support for BSD/OS make (Sascha)
-- Added improved URL rewriter (Sascha)
-- Fixed readdir_r() use on Solaris (Sascha)
-- Improved HTTP headers for private-caching (jon@csh.rit.edu, Sascha)
-- Added new function session_cache_limiter (jon@csh.rit.edu, Sascha)
-- Added ftp_exec to the ftp functions (thanks to <jhennebicq@i-d.net>)
- (Derick)
-- PEAR: add last executed query as debug info in DB errors (Stig)
-- PEAR: allow multiple modes in PEAR_Error (Stig)
-- Made the Sybase CT module thread safe (Zeev)
-- Added second argument to array_reverse() that indicatese whether
- the original array keys should be preserved. (Andrei)
-- Clean up htmlspecialchars/htmlentities inconsistencies. (Rasmus)
-- PEAR: renamed DB_GETMODE_* to DB_FETCHMODE_*, added setFetchMode()
- in DB_common to set the default mode, added some MySQL tests (Stig)
-- Made eval() and several other runtime-evaluated code portions report the
- nature and location of errors more accurately (Stas)
-- Added an optional parameter to wordwrap that cuts a string if the length of a
- word is longer than the maximum allowed. (Derick)
-- Added functions pg_put_line and pg_end_copy (Dirk Elmendorf)
-- Added second parameter for parse_str to save result (John Bafford)
-- Fixed bug with curl places extra data in the output. (medvitz@medvitz.net)
-- Added the pathinfo() function. (Sterling)
-- Updated sybase_ct module and its sybase_query to use high performance API.
- (Joey)
-- Added a more configurable error reporting interface to DB. (Stig)
-- Added is_uploaded_file() and move_uploaded_file() (Zeev)
-- Added several directives to php.ini - post_max_size, file_uploads,
- display_startup_errors - see php.ini-dist for further information (Zeev)
-- Worked around a bug in the libc5 implementation of readdir() (Stas)
-- Fixed some potential OpenBSD and NetBSD crash bugs when opening files. (Andi)
-- Added EscapeShellArg() function (Rasmus)
-- Added a php.ini option session.use_trans_sid to enable/disable trans-sid.
- (Sterling)
-- Added the Sablotron extension for XSL parsing. (Sterling)
-- Fixed a bug in checkdate() which caused < 1 years to be valid (Jani)
-- Added support for an optional output handler function for output
- buffering. This enables transparent rendering of XML through XSL,
- transparent compression, etc. (Zeev)
-- Added support for user defined 'tick' callback functions. This helps
- emulate background processing. (Andrei)
-- Fixed problem with having $this as the XML parser object. (Andrei)
-- Internal opened_path variable now uses the Zend memory manager so that full
- paths of files won't leak on unclean shutdown (Andi)
-- Removed support of print $obj automatically calling the __string_value()
- method. Instead define yourself a method such as toString() and use
- print $obj->toString() (Andi, Zend Engine)
-
-29 Aug 2000, Version 4.0.2
-- Added PHP API for Zend's ticks. (Stig)
-- PHP 3 regression testing framework re-born (Stig)
-- Added php_uname() function (Stig)
-- Made a minor change to allow building with OpenLDAP 2.0 (Stig Venaas)
-- Fixed a bug in preg_replace() that would truncate subject string if the
- first argument was en empty array. (Andrei)
-- Added ob_get_length function (Stig)
-- Fixed a bug that did not respect limit parameter in preg_replace() when
- using /e modifier. (Andrei)
-- Added ability for each xml_set_*_handler() function to take the
- array($obj, 'method') syntax for the handler argument as well
- as the normal function name. (Andrei)
-- Updated array_walk() to be able to accept array($obj, 'method')
- syntax for the walk function. (Andrei)
-- Fixed segfault with fgets(), fgetcsv(), fgetss(), and fread() when
- called with negative length argument. (Torben)
-- Fixed by-reference parameters passing for xml_ functions and for scanf
- functions (Stas)
-- Added experimental Oracle LDAP SDK support. 8.1.6 or later needed. Configure
- with something like --with-ldap=/usr/local/oracle/product/8.1.6 (Stig Venaas)
-- Fixed memory leaks in eval(); A script that used eval() extensively, could
- end up consuming very large amounts of memory during execution (Zeev, Zend
- Engine)
-- Fixed memory_limit feature, which did not work properly in previous versions
- (Zeev, Zend Engine)
-- Fixed stdout support with the swf extension. (Sterling)
-- Fixed byte order for ip2long and long2ip (Stas)
-- Fixed dbase_add_record. (Sterling)
-- Added support for libmcrypt 2.4.4 (Derick)
-- Added strncasecmp function (Andi, Zend Engine)
-- Fixed FTP module to accept multiline server replies (Jani)
-- Fixed switch which only has a single default rule. (Andi, Zend Engine)
-- Fixed problem with nested foreach()'s. (Andi, Zend Engine)
-- The CCVS module is now stable and compiling. It compiles as a CGI and into
- Apache cleanly without warnings. (Brendan W. McAdams)
-- Fixed mSQL_close(). (nick@loman.net)
-- Made return() in a require()'d file work like return() in an include()'d
- file (Andi & Zeev, Zend Engine)
-- Changed require_once() to work using the same table as include_once()
- (Andi & Zeev, Zend Engine)
-- Fixed PostgreSQL module to work when the link handle is omitted (Zeev)
-- Fixed the Sybase modules to work properly with PHP 4.0 (Zeev)
-- Fixed CLOB handling in OCI8 driver when using variable-width
- character sets. (Thies)
-- Added 4th optional parameter to sybase_[p]connect to specify the charset
- for the connection (alf@alpha.ulatina.ac.cr)
-- Fixed support for current thttpd releases. (Sascha)
-- Added support for kerberized IMAP library using --with-kerberos
- (Rasmus, Sascha)
-- Virtualize realpath, chmod, chown and utime (Stas)
-- Support content-encoding headers in file upload MIME parts
- (Ragnar Kjørstad)
-- Fixed warning when shutting down OCINLogon() connections. (Thies)
-- Fixed \n in session variables bug on Win32 (Stas)
-- OCIError() would sometimes not report failed connections. (Thies)
-- Fixed HEAD request bug on an Apache ErrorDocument redirect and preserve
- the status code across the redirect as well. (Rasmus)
-- Added Olympus-specific tags to read_exif_data() (Rasmus)
-- Fixed bug in imap_fetchheader() where using FT_PREFETCHTEXT didn't return
- the body. Bug #4447. (Jani)
-- Fixed exec() returning "\0" when output is empty
-- Added XML_Parser class in PEAR (Stig)
-- Added "make test" target in pear/ and added some regression tests (Stig)
-- Fixed bug in strip_tags function as per bug #5857 (Rasmus)
-- Fixed reading of IPTC via GetImageInfo() for certain JPEG files. (Thies)
-- Improved the output-buffering functions to be re-entrant (Zeev)
-- Made ldap_add(), ldap_modify(), ldap_mod_add(), ldap_mod_replace()
- binary-safe. Original patch: Terrence Miao <terrence_miao@email.com> (Jani)
-- CGI aka. command line version has now an option '-l' for syntax check
- without execution (Hartmut)
-- Fixed bug in ldap_get_values_len() which makes it NULL-safe. (Jani)
-- Bug-report and fix submitted by Michel Alexeline <alexel@dr15.cnrs.fr>
-- Make ext_skel create a Makefile.in set up to handle shared extension
- support automatically (Rasmus)
-- Fixed php_realpath not to die on non-existing files (needed for touch())
- (Stas and china@thewrittenword.com)
-- Fixed get_browser() function (Stas)
-- Fixed symbol clash which caused a DSO problem on OpenBSD (Rob Black and
- anil@recoil.org)
-- Added new function: ldap_compare(). (Jani)
-- Fixed a bug in ldap_get_entries() and ldap_get_attributes(). (Jani)
-- Ported DB to new error reporting scheme in PEAR. (Stig)
-- Added sybase and ibase DB backends in PEAR. (Sterling)
-- New PEAR package Payment_Verisign for use with the Payflow Pro
- (pfpro) extension. (David Croft)
-- Added CURL support. (Sterling)
-- Catch users trying to set "compatibility" parameter in PDF, which is not
- supported from user-land. (Joey)
-- Fixed dbase_add_record. (Sterling)
-- Added new function wordwrap() to wordwrap long strings from Chris
- Russel <russel@yorku.ca> (David Croft)
-- Added four additional arguments: attrsonly, sizelimit, timelimit, deref which
- were missing in ldap_search(), ldap_list() and ldap_read() functions (Jani)
-- Fixed a bug in ldap_search/list/read() which prevented returning the partial
- results when 'Sizelimit exceeded' error occurred. (Jani Taskinen)
-- Fixed preg_replace() to automatically escape quotes in matched
- strings when using /e modifier. (Andrei)
-- Itanium patch (Steve Robb)
-- Set default include_path so PEAR files can be reached (Stig)
-- Added "pear" executable, requires CGI version installed (Stig)
-- Added extension ii for Ingres II native support. See README in ext/ingres_ii
- directory. (David H)
-- Added Win32 project for the Interbase module (Zeev)
-- Added ability to perform calls to the parent class without explicitly
- specifying its name, using parent::func_name(...) (Zeev, Zend Engine)
-- You can now call Ora_Error() without prameters to get the reason
- for a failed connection attempt. (Kirill Maximov)
-- New extension "pfpro" for interface with Verisign Payflow Pro (David Croft)
-- Added IMG_GIF, IMG_JPG, IMG_JPEG, IMG_PNG and IMG_WBMP constants for
- imagetypes() function (Rasmus)
-- Added ImageTypes() function which returns a bitfield with the supported
- image formats. 1=gif, 2=jpeg, 4=png and 8=wbmp (Rasmus)
-- Make it possible to specify an empty string as a thousands-seperator
- in number_format() (Rasmus)
-- Shared module support for LDAP extension (Troels Arvin)
-- Fixed a bug with imap_mail where apache would segfault if the rpath
- parameter was specified.
-- Use dashes and short day name in cookies since some browsers seem picky
- about this (Rasmus)
-- Added pspell module. (Vlad)
-- Added 3 additional arguments to the user-defined error handler - the file
- name and line number in which the error occured, and the context (local
- variables) of the code in which the error occured (Zeev, Zend Engine)
-- Improved the error handling code to handle an error in a user-defined error
- handling function (Zeev, Zend Engine)
-- Fixed leak when using string offsets in the array() construct.
- (Andi, Zend Engine)
-- Fixed corruption problem when changing deeply nested values in objects.
- (Andi & Zeev, Zend Engine)
-- Improved array_multisort() to be able to specify sort type as well sort
- order. Incidentally, it can be used to sort multi-dimensional arrays
- as well. (Andrei)
-- Fixed a possible data corruption in case of a huge amount of aborted requests
- (Zeev)
-- Apache module would sometimes close a wrong file-descriptor. (Sascha)
-- Fixed use of alternative storage handlers in the session module. (Sascha)
-- Updated str_pad() to be able to pad on left/right/both sides. (Andrei)
-- Fixed crash in gzopen(). (Thies)
-- Multiple character set support in gdttf.c (Rob Goodwin)
-- When using HTTP auth from PHP, fill in the %u custom log field so the
- authenticated used id will get logged in the Apache access_log (Rasmus)
-- Support for pdflib 3.01. (Uwe)
-- FDF Data is handled properly and can be accessed by reading
- HTTP_RAW_POST_DATA. (Uwe)
-- Added new 'O' format modifier that will output the GMT offset as "[+-]HHMM"
- (eg: Pacific time is -0700). This is useful for things such as Date: mail
- headers. (Mike W)
-- Fixed crash on OCI?Logon() failure. (Thies)
-- Make the special Header("http/...") response be case insensitive like 3.0
- (Rasmus)
-- Allow cybercash to compile as a DL module. (Sterling)
-- Fixed the dbase_create function. (Sterling)
-- Fixed a problem under some versions of Windows that could cause PHP to hang
- on startup if errors occured, e.g. in the php.ini file (Zeev)
-- Fixed opendir() again. It should actually work well continuously now (Zeev)
-- Added three additional arguments to be sent to a user-defined error handler -
- the filename and line number in which the error occured, and the context
- (the local variables) of the error (Zeev, Zend Engine)
-- Improved the error handling code to handle an error in a user-defined error
- handling function (Zeev, Zend Engine)
-- Added an optional parameter to preg_replace() that can be used to
- specify how many replacements to make. (Andrei)
-
-28 Jun 2000, Version 4.0.1
-- Fixed a possible crash in the LDAP modify code. (Eric Kilfoil)
-- Fixed a bug in opendir(), which prevented readdir() from working properly if
- the $dir argument wasn't explicitly specified (Zeev)
-- Made --enable-discard-path work again. (Andi)
-- Removed 8KB limit on line length of the file() function (Zeev)
-- Disabled dl() when PHP is being used as a module inside a multithreaded web
- server - it didn't work before, and caused weird results (Zeev)
-- Added the ImageColorClosestHWB(), ImageCopyMerge() and ImagePaletteCopy()
- functions. (Sterling)
-- Added ImageCreateFromWBMP() function. (Jouni)
-- Fixed problems with POST requests under the NSAPI module. (Roberto Biancardi)
-- Added spliti() function. (Thies)
-- Fixed serializer behaviour with regards to serializing objects whose class
- definition was not available in the deserializing context. (Sascha)
-- Improve memory cache performance and increase cache size. (Stas, Zend Engine)
-- Added a crc32 checksum function - used by the UdmSearch search engine
- and currently run through a system call. This will speed up the UdmSearch
- php frontend significantly. (Rasmus)
-- Modified in_array() to not touch array pointer. (Andrei)
-- Added restore_error_handler(). (Zeev, Zend Engine)
-- Fixed erroneous file names and line numbers in error situations under the
- multithreaded version of PHP - most noticeably Win32 (Zeev, Zend Engine)
-- Fixed problem with CGI crashing on certain servers especially Windows Apache
- & O'Reilly website (Andi)
-- Added Pi3Web SAPI module; run ./configure --with-pi3web to enable this.
- (Holger; zimpel@t-online.de)
-- Enhanced WDDX functions to call __sleep() and __wakeup() when working on
- objects. (Andrei)
-- Changed WDDX to serialize arrays as structs only if needed. (Thies)
-- Implemented max_execution_time under Win32 (Zeev)
-- Updated strtotime() to handle many more formats. It now has complete
- feature parity with GNU date command. (Andrei)
-- Added support for multiple arguments in unset(). (Faisal, Zend Engine)
-- Functions that expect a resource but are passed something else now return
- NULL instead of FALSE. (Thies, Zend Engine)
-- Fixed gmmktime(), on certain systems it incorrectly adjusted for the timezone
- offset and daylight savings time. (Andrei)
-- Moved VC++ Win32 project and workspace files to the win32 directory
- (Zeev)
-- Fixed checkdate() to not return true on non-numeric arguments (Rasmus)
-- Added --enable-c9x-inline option for compilers which support the new C9x
- standard. If you encounter undefined references to i_zend_is_true and
- other symbols, you should enable this. (Sascha, Zend Library)
-- Fixed a problem in ldap_add() and ldap_modify(), sometimes added trailing
- garbage to the values (Stig Venaas)
-- Fixed a problem with dbmopen() not handing 'c' correctly with dbm/db/ndbm
- databases. (JimJag)
-- Fixed a crash in number_format() when used with locales. (Andrei)
-- Fixed an initialization problem in the MS-SQL problem that could cause
- a crash in mssql_query() (Zeev)
-- Upgraded PCRE to version 3.2 and fixed a bug when anchored pattern
- matched an empty string. (Andrei)
-- Fixed a bug that prevented PHP from paying attention to the extension_dir
- directive with extensions that were loaded from the php.ini file (Zeev)
-- Changed set_error_handler() to return the name of the previously defined
- error handler, if any (Zeev, Zend Engine)
-- Declared <?php_track_vars?> officially dead. It didn't work in PHP 4.0.0
- either, but now it's gone for good (Zeev)
-- Make convert_cyr_string() binary safe and stop it from corrupting other
- PHP variables. (Andi)
-- Added functions array_unique, array_intersect and array_diff (Stig Venaas)
-- Fixed problem when using uninitialized values in comparisons with strings.
- They behave as empty strings again just like in PHP 3.
- (Andi & Zeev, Zend Engine)
-- Fixed 'Z' flag in date() to adjust for daylight savings time. (Andrei)
-- Fixed var_dump() not to modify the internal order of array elements (Zeev)
-- Fixed stripcslashes() to remove to strip \ in unknown escapes instead of
- leaving it. (Andrei)
-- Changed WDDX to always serialize arrays as structs. (Andrei)
-- Fixed include_once() to issue a warning in case the supplied file name is
- not found (Zeev, Zend Engine)
-- Fixed a bug in get_declared_classes() which could return the same class
- multiple times under certain circumstances (Zeev, Zend Engine)
-- Fixed a bug in rawurldecode() that would cause in rawurldecode() corrupting
- its argument (Zeev)
-- Parse errors (or other errors) in the php.ini files under Windows will no
- longer mess up the HTTP headers in CGI mode and are now displayed in a
- message box (Zeev)
-- Fixed a crash in OCIFetchStatement() when trying to read after all data
- has already been read. (Thies)
-- fopen_wrappers() are now extensible via modules (Hartmut Holzgraefe)
-- Make trim strip \0 to match php 3 (Rasmus)
-- Added function imagecreatefromxbm(). (Jouni)
-- Added function imagewbmp(). (Jouni, based on patch from Rune Nordbøe
- Skillingstad)
-- Added str_pad() for padding a string with an arbitrary string on left or
- right. (Andrei)
-- Made the short_tags, asp_tags and allow_call_time_pass_reference INI
- directives work on a per-directory basis as well, e.g. from .htaccess
- files. (Zeev)
-- Added fflush() function. (Eric Huss)
-- Fixed a problem with static variables, default function arguments and class
- member variables, that contained array values. (Andi & Zeev, Zend Engine)
-- Fixed virtual() when used with output buffering (Marc Pohl)
-- Clean up constants in flock() function and add optional 3rd arg which
- is set to true on EWOULDBLOCK (Rasmus)
-- Added functions pg_loimport(), pg_loexport(). (Jouni)
-- Added SWF support to getimagesize() function (Derick Rethans)
-- Added support for both indexed and non-indexed arrays of file uploads
- eg. name="file[]" type="file" (Rasmus)
-- Added create_function(), which gives the ability to create functions
- on-the-fly (Zeev, Zend Engine)
-- Added support for comparisons of arrays (with arrays) and objects (with
- objects); The equality operator (==) performs an unordered comparison,
- whereas the identity operator (===) performs an ordered comparison (Zeev,
- Zend Engine)
-- Allow all functions that receive user-defined function callbacks to accept
- an array that contains an object and a method name, in place of a function
- name, e.g. usort($array, array($obj, "ObjSort")) (Zeev, Zend Engine)
-- Added set_error_handler() to allow custom error handling functions,
- instead of the built-in error handling code (Zeev, Zend Engine)
-- Renamed user_error() to trigger_error(); user_error() remains
- defined for compatibility (Zeev, Zend Engine)
-- Fixed the global/static statements to require a trailing terminating
- semi-colon ';'. (Andi, Zend Engine)
-- Cleaned up PCRE extension and made it binary-safe. (Andrei)
-- Added third argument to in_array(). If it's true, then in_array()
- will use strict comparison instead of the default one. (Andrei)
-- Added pg_trace() and pg_untrace (Dominic J. Eidson & Zeev)
-- ignore_user_abort=Off is now default. (Thies)
-- Added array_merge_recursive() that will recursively merge values
- under the same keys. (Andrei)
-- fixed crash in OCIParse when parsing invalid SQL. (Thies)
-- Fixed a bug in mysql_connect() that made it ignore the socket argument, in
- case of non-persistent connects (Zeev)
-- Added disable_functions php.ini directive, to allow administrators to disable
- certain functions for security reasons (Zeev)
-- Fixed sessions on Win32. When setting the directory depth parameter in
- save_path you need to now delimit it with a ';' instead of ':', e.g
- "5;/tmp" instead of "5:/tmp" (Andi)
-- Changed the Apache handler's return status to 'Declined' when a requested
- PHP file could not be found. Returning 'Not Found' caused problems
- in the ErrorDocument handler stage in that $REDIRECT_REDIRECT_ERROR_NOTES
- was not getting set at all. Moving to 'Declined' should fix this and I
- can't see any other side effects. (Rasmus)
-- Fixed scanning decimal numbers in internationalized environments. They should
- always be in standard US format e.g. 23.3. (Andi, Zend Engine)
-- Added second argument to preg_quote() which allows quoting of
- one additional character, usually the regex delimiter. (Andrei)
-- Uncommitted outstanding OCI8 transactions are now rolled back
- before the connection is closed. (Thies)
-- ignore_user_abort() & friends should now work in CGI mode as well.
- (Patch by daniel.braun@ercom.fr)
-- Added extension YAZ (dickmeiss).
-- Fixed a crash bug triggered by certain cases of class redeclarations
- (Stas & Zeev, Zend Engine)
-- Fixed min()/max() segfault. (Andrei)
-- New module for reading EXIF header data from JPEG files. Most digital
- cameras will embed all sorts of information about a picture inside the
- jpeg images it generates. (Rasmus)
-- Fixed basename() bug where "file.ext///" would not return the same
- as "/path/file.ext///" (Rasmus)
-- Added the swf_ortho function. (Sterling)
-- Moved to virtual current working directory support. This highly improves the
- functionality and stability of multi-threaded versions of PHP (Andi, Sascha)
-
-22 May 2000, Version 4.0.0 Release
-- Allow the writing of flash files to stdout.
-- Fixed a crash bug in .phps syntax-highlighted files (Andi)
-- Improved round() to allow specification of rounding precision.
- (Andrei, Todd Kirby <kirbyt@yahoo.com>)
-- Added SORT_REGULAR, SORT_NUMERIC, SORT_STRING flags that can be used with
- non-user sort functions for precise sorting behavior. (Andrei)
-- Fixed two 64-bit issues (startup crash, gethostbyaddr). (Sascha)
-- NULL values are now preserved in the return value of mysql_fetch_array()
- and mysql_fetch_object(). (Andrei)
-- Ported InterBase module finally from PHP 3 to PHP 4. Full support for
- InterBase 6. (Jouni)
-- Added swf_definepoly for drawing polygons to the SWF functions. (Sterling)
-- Ported imagegammacorrect from PHP3 to PHP4. (Sterling)
-- Added array_rand() function. (Andrei)
-
-8 May 2000, Version 4.0 Release Candidate 2
-- NSAPI WIN32 Module compilable, untested (Shane)
-- Apache WIN32 Module compilable and lightly tested. (Shane)
-- Enabled assert() by default in php.ini-dist. (Andrei)
-- Put in safeguards in case dynamic code evaluation in assert() and
- preg_replace() with /e modifier fails. (Andrei)
-- Fixed infinite recursion when serializing $GLOBALS[] in WDDX. (Andrei)
-- Made WDDX serialization properly escape <, >, and &. Also speeded up
- the serialization in general. (Andrei)
-- Moved install-local to install-sapi for clarity. (Joey)
-- Improved extension build framework. Refer to README.SELF-CONTAINED-EXTENSIONS
- for an introduction. (Sascha)
-- ImagePolygon() is no longer limited by a maximum number of polygons.
- (Marc Pohl)
-- Added configure time checking for bcmath package. (Joey, Sascha)
-- Added get_declared_classes(). (Andrei, Zend Engine)
-- Added initial NSAPI module from Jayakumar Muthukumarasamy. (Rasmus)
-- Added the SWF module which allows you to create Macromedia Flash files via
- libswf. (Sterling)
-- Improved UNIX build system to support more vendor make tools (Sascha)
-- Updated natural comparison/sorting algorithm by Martin Pool
- <mbp@humbug.org.au>. (Andrei)
-- Fixed a crash in array_multisort() that happened when empty arrays
- were passed to it. (Andrei)
-- Added substr_count() from Peter Kovacs. (Andrei)
-- Added an optional third argument to fseek to indicate where to seek from.
- (Andrei)
-- OCIBindByName() will no longer complain about bindlength beeing zero. (Thies)
-- Converted the IMAP module to the high performance API (Zeev)
-- The fgetcsv() function now handles embedded end-of-line in a quoted field
- (Nick Talbott)
-- Added user_error(), to allow explicitly generate error messages from scripts
- (Zeev, Zend Engine)
-- Fixed a problem in long2ip() that occasionally returned incorrect IP address.
- (Evan, Andrei)
-- Fixed many memory leaks in the IMAP module (Stas, Andi, Zeev)
-- Fixed bug in number_format (Jon Forsberg)
-- Make error_prepend_string and error_append_string work (Rasmus)
-- array_walk() now automatically resets the array. (Andrei)
-- Added natural comparison/sorting routines strnatcmp(), strnatcasecmp(),
- natsort(), and natcasesort(). These are useful for comparing and sorting
- strings that contain numbers. Based on the code from Martin Pool
- <mbp@humbug.org.au>. See http://www.linuxcare.com.au/projects/natsort/
- for more info on natural sorting. (Andrei)
-- Zeus Webserver support (version 3.3.6+) for ISAPI (Ben Mansell)
-- Fixed several problems with the PATH_TRANSLATED and PHP_SELF under Apache
- (Paul Gregg & Zeev)
-- Ported ldap_get_values_len() function from PHP3 to PHP4. (Sterling)
-- Fixed a problem in include_once() with non constant arguments (Andi & Zeev,
- Zend Engine)
-- Added php.ini-optimized (Zeev)
-- Ported ldap_errno(), ldap_err2str() and ldap_error() from PHP3 to PHP4.
- (Sterling)
-- WDDX now defaults to ISO-8859-1. (Thies)
-- Fixed crash resulting from IMAP's error handling (Stas)
-- Added $HTTP_POST_FILES[filename][tmp_name] - it was previously impossible to
- retrieve the temporary name of an uploaded file using $HTTP_POST_FILES[]
- (Zeev)
-- Made the IMAP and LDAP modules compilable under Windows and thread-safe
- (Zeev)
-- Fixed a problem when dealing with large POST blocks in CGI mode (Zeev)
-- Added session_get_cookie_params() function. (Sterling)
-- Fixed return of stristr() to no longer always be lowercased. (Andrei)
-- Changed the Windows version of PHP so that a php.ini file is no
- longer mandatory (Zeev)
-- session_start() is now more verbose if headers cannot be send. (Thies)
-- Fixed a memory leak when using assign-op bitwise operators on strings (Zeev,
- Zend Engine)
-- Added support for reading properties that require arguments in the COM
- module - writing to them will only be supported in PHP 4.1 (Zeev)
-- Fixed a very old legacy memory leak in the COM module (Zeev)
-- Fixed problems with object-overloading support - noteably, COM and Java
- (Zeev, Zend Engine)
-- Fixed an overrun in WDDX. (Thies)
-- Fixed a crash bug with modules loaded through dl() not properly freeing their
- resources (Zeev, Zend Engine)
-- Added localtime() function. (Sterling)
-- Added the 'I' format option for the date function, this option will return
- true or false depending on whether or not daylight savings time is in effect.
-(Sterling)
-- Added gmstrftime() function. (Sterling)
-- snmp_walkoid is now an alias for snmp_realwalk. (Sterling)
-- Fixed a bug that could cause a crash when using 'global' inside large include
- files (Stas, Zend Engine)
-- Added --enable-libgcc switch to force linking against libgcc (Sascha)
-- Fixed dynamic loading where extension_dir had no trailing slash (Sascha)
-- Fixed dynamic loading on OpenBSD (Sascha)
-- Improved POSIX threads check. ZTS works now on at least Linux, Solaris,
- FreeBSD and OpenBSD (Sascha, TSRM)
-- Added !== operator support. (Torben, Zend Engine)
-
-27 March 2000, Version 4.0 Release Candidate 1
-- Added support for UCD-SNMP 4.1.x (Sascha)
-- Fixed a data corruption bug in mysql_result(), if used in table.fieldname
- mode (Zeev)
-- Fixed a crash problem in func_num_args(), func_get_arg() and func_get_args()
- when used as function arguments (Andi, Zend Engine)
-- Added get_class_methods(string classname) function. (Andrei)
-- Added 'I' switch to test whether or not DST is active. (Sterling)
-- Fixed a data corruption bug in mysql_result(), if used in table.fieldname
- mode (Zeev)
-- Modified the registry INI entry reader (Win32) to work with drive letters.
- For example, if you wish to wish to specify INI entries for C:\foo\bar, you
- should create HKLM\PHP\Per Directory Values\C\foo\bar in the registry, and add
- string values for each directive you want to override in this directory (Zeev)
-- Fixed extract() for EXTR_PREFIX_SAME and EXTR_SKIP cases. (Andrei)
-- stristr() no longer modifies it's arguments. (Thies)
-- Don't default to iso-8859-1 since this confuses some browsers. (Rasmus)
-- Make it possible to specify both a port and a socket
- in mysql_[p]connect. (Rasmus)
-- Added --disable-pic for disabling generating PIC for shared objects
- on platforms which support it (i.e. Linux) (Sascha)
-- serialize()/unserialize() now call __sleep() and __wakeup() when
- working on objects. (Thies)
-- renamed to_string() method to __string_value() for consistency.
- (Thies, Zend Engine)
-- Fixed a bug in the third argument to define()
-- Added is_numeric() that returns true if the argument is a number
- or a numeric string. (Andrei)
-- domxml now supports libxml 2.0 Beta and drops support for older versions,
- due to massive changes in libxml
-- fixed possible crash in unserialize() if serialized data was
- corrupted. (Thies)
-- Changed $HTTP_STATE_VARS to $HTTP_SESSION_VARS. Use only the latter
- version now! (Andrei)
-- Added GD-JPEG Support (Rasmus)
-- Prevent from loading dynamic PHP modules which were compiled with different
- debug and thread safety modes than PHP, which resulted in a crash (Andi)
-- connection_aborted() and friends work again (Thies)
-- Upgraded to libtool 1.3.4 (Sascha)
-- UNIX configure creates config.nice in the build directory now which allows
- easy reuse of configuration options (Sascha)
-- Added support for embedded MySQL client library. Unless you specify a path
- to --with-mysql, the bundled MySQL client library will be used (Sascha)
-- Added include_once() and require_once() functionality (Andi, Zend Engine)
-- Removed support for pdflib < 3.0 (Uwe)
-- Added auto-registration of everything in $HTTP_SESSION_VARS[] if
- register_globals is turned off. (Andrei)
-- Cleaned up extension namespace (Stig)
-- OCINLogon() sessions are now closed again. (Thies)
-- Added ip2long() and long2ip(),
- courtesy of Faisal Nasim <faisal@nasim.org> (Andrei)
-- Added ftruncate() and fstat(),
- courtesy of Faisal Nasim <faisal@nasim.org> (Andrei)
-- Added parse_ini_file(). Currently implemented in non thread safe version
- of PHP, and currently lacks section support (Zeev)
-- "none" is now equivalent with "" in Apache config directives (Stig)
-- OCINLogon no longer crashes. (Thies)
-- Fixed comparisons of (string) "nan" with (string) "nan". (Thies, Zend Engine)
-- Switched back to the old $HTTP_*_VARS[] behavior - $HTTP_GET_VARS["foo"]
- and $foo are no longer references to each other, but separate variables
- like they were prior to PHP 4.0 Beta 4 (Zeev)
-- Fixed Sybase-DB compilation (Zeev)
-- Fixed a (fairly common) situation where error_reporting values would not be
- properly restored after a call to error_reporting(), in between requests
- (Zeev)
-- The various $HTTP_*_VARS[] are now protected, and cannot be manipulated by
- user input (Zeev)
-- Added ini_set() as an alias to ini_alter() (Zeev)
-- The string None is now recognized as a keyword by the php.ini processor, and
- can be used to denote an empty string (Zeev)
-- Added get_class_vars(string class_name) and get_object_vars(object obj)
- functions. (Andrei, Zend Engine)
-- Added pdf_set_parameter(), pdf_skew(), pdf_show_boxed() (Uwe)
-- Fixed comparison of (string) "inf" with (string) "inf", which was erroneously
- returning false (Zeev)
-- Implemented default_charset and default_mimetype config directives (Stig)
-- Ported T1lib support from PHP3. (Jouni)
-- Fixed -DEAPI inheritance from APXS. (Sascha)
-- Fixed possible crash in module-shutdown. (Thies)
-- Fixed safe_mode_protected_env_vars INI directive (Zeev)
-- Fixed getrusage() (Sascha)
-- Fixed OCI8 crash when returning cursors from stored-procedures. (Thies)
-
-21 February 2000 Version 4.0 Beta 4 patch level 1
-- Fixed crash when magic_quotes were switched off. (Thies)
-- Support for pdflib 2.30 (Uwe)
-
-20 February 2000, Version 4.0 Beta 4
-- Introduced $HTTP_POST_FILES[], that contains information about files uploaded
- through HTTP upload (Zeev)
-- Made PHP work under Microsoft Personal Web Server, under both Windows NT
- workstation and Windows 95 (Zeev)
-- Made multipart/form-data content obey to the variables_order directive (Zeev)
-- Updated the browscap module to work with PHP 4.0 (Zeev)
-- Recover gracefully in ISAPI after the client prematurely presses STOP (Andi)
-- Fixed bug in unset() on array offsets which are referenced more than once
- (Andi, Zend Engine)
-- Improved ISAPI module - it should no longer be necessary to set PHP as
- an ISAPI filter, only as an ISAPI extension, unless you wish to perform
- authentication using PHP. This didn't yet get enough testing, but it
- should work (Zeev)
-- Fixed RFC1867 file upload under Windows (Zeev)
-- Initital support for pdflib 2.20 (Uwe)
-- Added PostgreSQL support for DB (Rui Hirokawa <louis@cityfujisawa.ne.jp>)
-- Re-introduced "none" for disabling auto_prepend/append_file (Stig)
-- Added DB/storage (Stig, PEAR)
-- Introduced DB warnings (Stig, PEAR)
-- Fixed overrun in strip_tags (Stas)
-- Fixed crash in strip_tags() and related functions. (Thies)
-- Workaround for bogus POST-Data from IE/Mac. (Thies)
- Patch by Alain Malek <alain@virtua.ch>
-- Finished the server abstraction layer; All of the PHP code is now shared
- across different servers (Apache, CGI, IIS, etc.), except for thin
- interface modules (Zeev)
-- Added NULL-support in gettype(). (Thies)
-- base64_decode() will decode POST data correct. (Thies)
- Patch submitted by: Turadg Aleahmad <turadg@wise.berkeley.edu>
-- Much more work on domxml. Build xml tree, create xml doc works (Uwe)
-- Made foreach() work on objects. (Thies, Zend Engine)
-- Added domxml extension based on libxml, still little functionality (Uwe)
-- Fixed memory corruption in fgetss(), strip_tags() and gzgetss() (Zeev)
-- Updated calendar dynamic library to work with PHP 4. (Evan)
-- Added strncmp() function, courtesy of Walter. (Andrei)
-- Made the output of var_dump() more informative. (Thies)
-- Fixed some OCIBindByName() problems. (Thies)
-- Protect the ISAPI module against exceptions. Stack overflows in scripts are
- now nicely detected and handled (Zeev)
-- Fixed possible buffer-overflow in base64_decode. (Thies)
-- Fixed possible buffer-overflow in setcookie(). (Thies)
-- Fixed signal() bug that could cause the Apache master process to
- die. (Thies)
-- Added session_set_cookie_params() function. (Andrei)
-- If header information is sent after output has already been sent, the warning
- message will now state the filename and line number at which the first output
- was made (Zeev)
-- Added the XML Expat library to the standard PHP source distribution thanks
- to its author James Clark (Andi & Zeev)
-- Added XML support to the default Win32 build (Andi & Zeev)
-- Added socket_get_status() function. Renamed:
- set_socket_timeout() -> socket_set_timeout()
- set_socket_blocking() -> socket_set_blocking(). (Andrei)
-- Added realpath() function. (Andrei)
-- mktime interprets years in the range 0-70 now as 2000-2070. You can
- continue to specify the complete year (i.e. 1920) (Sascha)
-- Added the ability to control the environment variables the user is allowed
- to change in Safe Mode, using INI directives (Zeev)
-- Fixed a crash bug in strtr() working on large input strings (Zeev)
-- Ora_GetColumn()/Ora_FetchInto() now return NULL for NULL-Columns. (Thies)
-- OCI8 now supports binding of NULL-values. Module cleanups. (Thies)
-- Added ability to set timeout on socket read operations through
- set_socket_timeout() function. (Andrei)
-- Added implicit_flush INI directive (Zeev)
-- Added implicit_flush() to control whether flush() should be called
- implicitly after any output (Zeev)
-- Fixed a crash in pfsockopen() (Zeev)
-- Fixed a possible crash in phpinfo() (Zeev)
-- Added register_argc_argv INI directive, to allow to selectively disable
- the declaration of the $argv and $argc variables for increased
- performance (Zeev)
-- Added $HTTP_ENV_VARS[] and $HTTP_SERVER_VARS[] support, which similarly
- to $HTTP_GET_VARS[], contain environment and server variables. Setting
- register_globals to Off will now also prevent registration of the
- environment and server variables into the global scope (Zeev)
-- Renamed gpc_globals INI directive to register_globals (Zeev)
-- Introduced variables_order that deprecates gpc_order, and allows control
- over the server and environment variables, in addition to GET/POST/Cookies
- (Zeev)
-- new function cpdf_set_document_limits() (Uwe)
-- Applied safe-mode patch to popen(). (Patch by Kristian Köhntopp)
-- str_repeat() now returns correct length. (Thies)
-- Don't assume libz and libpng are installed for the GD checks (Rasmus)
-- Implemented support for <boolean> and <null> types according
- to WDDX version 1.0 (Andrei)
-- Made var_dump()/serialize()/unserialize() NULL aware. (Thies)
-- Added new NULL constant (Zeev, Zend Engine)
-- Fixed -c support in the standalone CGI binary (Zeev)
-- Increased PHP's performance by 5-15% using a new memory cache (Andi & Zeev,
- Zend Engine)
-- Improved the php.ini reader to support constants and bitwise operators (Zeev)
-- Fixed strrev() to no longer modify arg1. (Thies)
-- Fixed buffer overruns in iptcembed(). (Thies)
-- Fixed a bug in ODBC error reporting (Zeev)
-- Added PHP_Logo_GUID() and Zend_Logo_GUID() functions, that return the GUIDs
- of the PHP and Zend logos used in phpinfo() (Zeev)
-- Added GNU Pth support (Sascha, TSRM library)
-- Removed select(), fd_set() and fd_isset() - will be reimplemented soon! (Thies)
-- Improved Win32 performance significantly by using different mutexes (Zeev,
- TSRM library)
-- Made quotemeta() and preg_quote() binary-safe. (Andrei)
-- Added UDP support in fsockopen(). (Evan)
-- Added --disable-pear option (Andrei)
-- Renamed libzend repository to Zend (Zeev)
-- Added support for thttpd (Sascha)
-- Added session.cache_limiter and cache_expire options (Sascha)
-- Restored the PHP_VERSION and PHP_OS constants (Zeev)
-- Added get_loaded_extensions(), extension_loaded(), and
- get_extension_funcs() functions. (Andrei)
-- Added date/time stamping to PHP error log file. (Andrei, Joey)
-- Added is_subclass_of() function (Andrei, Zend Engine)
-- Implemented count_chars(). (Thies)
-- Added class_exists() function (Andrei, Zend Engine)
-- Made strspn() and strcspn() binary-safe. (Andrei)
-- Added array_multisort() function. (Andrei)
-- Made pageinfo.c thread-safe (Sascha)
-- Made implode() binary-safe (Andrei)
-- Made strstr(), stristr(), and ucwords() binary-safe() (Andrei)
-- Made strtoupper(), strtolower(), substr_replace() binary-safe. (Andrei)
-- Fixed a crash in the Apache syntax highlighting mode (Zeev)
-- Report all ODBC error's not just the one on the top of the stack (lurcher)
-- OCI8 now returns NULL values in LONG columns correct. (Thies)
-- Added support for a C-like assert() function. (Thies)
-- Added CyberCash support. (Evan)
-- Made explode() binary-safe. (Thies)
-- Made strpos() binary-safe. (Thies)
-- Added XML_Set_Object() function, now you can use the XML-Parser from
- within an object. (Thies)
-- Session vars are now decoded into $HTTP_STATE_VARS[] array and the
- globals, depending on track_vars and gpc_globals settings (Andrei)
-- Added get_used_files() function - returns a hash mapping the use()'d files
- to their full path (Zeev)
-- PHP 4 scripts will now obey the max_execution_time setting and actually
- time out (Rasmus)
-- Added configure command to phpinfo() output (Stig)
-- Added optional socket path to the mysql_?connect() functions (Rasmus)
-- Made mysql and gd work as shared extensions again (Stig)
-- Make the global GET/POST/Cookie variables and their $HTTP_*_VARS[] counterparts
- be references to each other (Zeev)
-- Added support for the 'use' keyword - behaves like 'require', but will not
- use the same file more than once (Andi & Zeev, Zend Engine)
-- Added check to see if a persistent connection is still valid with the
- ODBC interface before reusing (nick@easysoft.com)
-- Added DBMaker support (patch by Pax Tsai <paxtsai@lion.syscom.com.tw>)
-- Renamed "PECL" to "PEAR" (PHP Extension and Add-on Repository) (Stig)
-- buildconf now uses build.mk (Stig)
-- Disable symlinks to urls (Rasmus)
-- Informix driver now reflects version of ESQL/C used (Danny)
-- Modified session_register() to take variable number of arguments (Andrei)
-- Fixed file descriptor leak in thread safe mode (Zeev, Zend Engine)
-- Added select(), fd_set() and fd_isset() (Evan)
-- cpdf support has been ported from php3, needs ClibPDF 2.x (Uwe)
-- Fixed a leak when using automatic output buffering (Zeev)
-- Introduced PECL - PHP Extension and Code Library
- (prounounced "pickle") (Stig)
-- Fixed inconsistencies in the implementation of here-docs (Andi & Zeev, Zend
- library)
-- Fixed a problem with constant class-member initializations (Andi & Zeev,
- Zend Engine)
-- Fixed float-compare in min(),max(),a[r]sort(),[r]sort() (Thies)
-- Implemented get_html_translation_table() function (Thies)
-- Implemented array_flip() function. Returns input-array with key, value
- flipped (Thies)
-- Added Berkeley DB3 support in DBA (Sascha)
-- Implemented 2-Arg version of strtr($str,$translation_array). This can be used
- to revert what htmlspecialchars() did (Thies)
-- Fixed mem-overwrite in XML_Parse_Into_Struct (Thies)
-- Added substr_replace() function (Andrei)
-
-November 16 1999, Version 4.0 Beta 3
-- ucfirst()/ucwords() no longer modify arg1 (Thies)
-- Fixed strtr() not to modify arg1 (Thies)
-- Added Win32 build files for Informix driver and make it
- compile with ZTS (danny)
-- Added tmpfile() function (Stig)
-- Upgraded regex library to alpha3.8 (Sascha)
-- Fixed selecting nested-tables in OCI8. (Thies)
-- RFC-854 fix for internal FTP-Code. Commands have to end in "\r\n" (Thies)
-- Fixed OpenLink ODBC support (Stig)
-- min(),max(),a[r]sort(),[r]sort(),k[r]sort() now work consistent with the
- language-core. (Thies)
-- tempnam() now uses mkstemp() if available (Stig)
-- serialize() and var_dump() now honor the precision as set in php.ini
- for doubles. (Thies)
-- Improved the Win32 COM module to support [out] parameters (Boris Wedl)
-- Fixed garbage returned at the end of certain Sybase-Columns (Thies)
- Patch submitted by: neal@wanlink.com
-- Added Microsoft SQL Server module for Win32 (Frank)
-- Added support for forcing a variable number of internal function arguments
- by reference. (Andi & Zeev, Zend Engine)
-- Implemented getprotoby{name,number} (Evan)
-- Added array_pad() function. (Andrei)
-- Added new getservby{name,port} functions. (Evan)
-- Added session.cookie_path and session.cookie_domain (Sascha)
-- Continue processing PHP_INI_SYSTEM knownDirectives after extension=
- (Sam Ruby)
-- Enable IBM DB2 support - Tested against DB2 6.1 UDB on Linux (Rasmus)
-- Added new str_repeat() function. (Andrei)
-- Output-Buffering system is now Thread-Safe. (Thies)
-- implemented OCI8 $lob->WriteToFile() function - very useful for streaming
- large amounts of LOB-Data without to need of a huge buffer. (Thies)
-- Added session.use_cookies option (Sascha)
-- Added getcwd() function. (Thies)
-- XML_Parse_Into_Struct no longer eats data. (Thies)
-- Fixed parse_url('-') crash. (Thies)
-- added === operator support. (Andi & Thies, Zend Engine)
-- unserialize() now gives a notice when passed invalid data. (Thies)
-- Fixed shuffle() so that it no longer breaks on Solaris. (Andrei)
-- Added is_resource(), is_bool() functions. (Thies)
-- Cleaned up File-Module (Thies)
-- Upgraded math-funtions to use new Zend function API (Thies)
-- Fixed zombie problem in shell_exec() and $a = `some_command`
- constructs. (Thies)
-- Thies introduced ZEND_FETCH_RESOURCE2 (Danny).
-- Added Informix driver to list of maintained extensions. (Danny).
-- Informix driver : Changed ifx.ec to use the new high-performance
- ZEND API. (Danny)
-- IXF_LIBDIR environment variable specifies alternate Informix library
- path for configure (Danny).
-- Fixed gmmktime() so that the following should always be true:
- gmmktime([args]) == mktime([args]) + date('Z', mktime([args])) (Jouni)
-- setlocale doesn't anymore screw up things if you forgot to change it back
- to the original settings. (Jouni)
-- Switched to new system where ChangeLog is automagically updated from commit
- messages. NEWS file is now the place for public announcements. (Andrei)
-- Fixed refcount problem in XML module. (Thies)
-- Fixed crash in HTTP_RAW_POST_DATA handling (Thies)
-- You can use resources as array-indices again (Thies, Zend Engine)
-- Fixed pg_fetch_array() with three arguments (Sascha)
- Patch submitted by: brian@soda.berkeley.edu
-- Upgraded a lot internal functions to use new Zend function API (Thies)
-- fdf support ported; not completely tested with latest version 4.0 for
- glibc (Uwe)
-- OCI8 connections are now kept open as long as they are referenced (Thies)
-- Cleaned up Directory-Module (Thies)
-- Small fix in Ora_Close (Thies)
-- Ported range() and shuffle() from PHP 3 to PHP 4 (Andrei)
-- Fixed header("HTTP/..."); behaviour (Sascha)
-- Improved UNIX build system. Now utilizes libtool (Sascha)
-- Upgrade some more internal functions to use new Zend function API. (Thies,
- Zend Engine)
-- Fixed backwards incompatibility with ereg() (Thies)
-- Updated Zend garbage collection with a much more thorough method.
- (Andi, Zend Engine)
-- Added the ability to use variable references in the array() construct.
- For example, array("foo" => &$foo). (Andi, Zend Engine)
-- Added array_reverse() function (Andrei)
-- Some more XML fixes/cleanups (Thies)
-- Updated preg_replace() so that if any argument passed in is an array
- it will make a copy of each entry before converting it to string so that
- the original is intact. If the subject is an array then it will preserve
- the keys in the output as well (Andrei)
-- Updated OCI8 to use the new high-performance Zend function API. (Thies)
-- Configure speedup (Stig)
-- Fixed LOB/Persistent-Connection related OCI8-Crash (Thies)
-- Generalized server-API build procedure on UNIX (Stig)
-- Added '--disable-rpath' option (Sascha)
-- Added AOLserver SAPI module (Sascha)
-- Fixed XML Callbacks. (Thies)
-- Updated ODBC to use the new high-performance Zend function API (kara)
-- Updated zlib to use the new high-performance Zend function API. (Stefan)
-- Updated preg_split() to allow returning only non-empty pieces (Andrei)
-- Updated PCRE to use the new high-performance Zend function API (Andrei)
-- Updated session, dba, mhash, mcrypt, sysvshm, sysvsem, gettext modules to use
- the new high-performance Zend function API (Sascha)
-- Extended var_dump to handle resource type somewhat (Andrei)
-- Updated WDDX to use the new high-performance Zend function API (Andrei)
-- Updated XML to use the new high-performance Zend function API. (Thies)
-- Updated Oracle to use the new high-performance Zend function API. (Thies)
-- Improved the performance of the MySQL module significantly by using the new
- high-performance Zend function API. (Zeev)
-- Added support for the Easysoft ODBC-ODCB Bridge (martin@easysoft.com)
-- Fixed bug in odbc_setoption, getParameter call incorrect (martin@easysoft.com)
-- Ora_Fetch_Into now resets the returned array in all cases (Thies)
-- Fixed NULL-Column problem in Oracle-Driver (Thies)
-- Added extra metadata functions to ODBC, SQLTables etc (nick@easysoft.com)
-- Fixed SEGV in mcal make_event_object() and
- typo in mcal_list_alarms() (Andrew Skalski)
-- Fixed Ora_PLogon (Thies)
-- Resourcified Oracle (Thies)
-- Implemented object serialization/deserialization in WDDX (Andrei)
-- Added krsort() function (Thies)
-- Added func_num_args(), func_get_arg() and func_get_args() for standard
- access to variable number of arguments functions (Zeev)
-- Added FTP support (Andrew Skalski)
-- Added optional allowable_tags arguments to strip_tags(), gzgetss() and
- fgetss() to allow you to specify a string of tags that are not to be
- stripped (Rasmus)
-- Upgraded var_dump() to take multiple arguments (Andrei)
-- Resourcified XML (Thies)
-- Fixed a memory leak in the Apache per-directory directives handler (Zeev)
-- Added array_count_values() function. (Thies)
-- snmp, pgsql, mysql and gd modules can be built as dynamically loaded
- modules (Greg)
-- OCI8 fix for fetching empty LOBs (Thies)
-- Added user-level callbacks for session module (Sascha)
-- Added support for unknown POST content types (Zeev)
-- Added "wddx" serialization handler for session module (Sascha)
- (automatically enabled, if you compile with --with-wddx)
-- Fixed unserializing objects (Thies)
-- PHP 4.0 now serializes Objects as 'O' (not understood by PHP 3.0), but
- unserializes PHP 3.0 serialized objects as expected. (Thies)
-- Made serialize/unserialize work on classes. If the class is known at
- unserialize() time, you'll get back a fully working object! (Thies)
-- Reworked preg_* functions according to the new PCRE API, which also made
- them behave much more like Perl ones (Andrei)
-- Made it possible to specify external location of PCRE library (Andrei)
-- Updated bundled PCRE library to version 2.08 (Andrei)
-- count()/is_array/is_object... speedups. (Thies)
-- OCI8 supports appending and positioning when saving LOBs (Thies)
-- Added metaphone support (Thies)
-- OCI8 doesn't use define callbacks any longer. (Thies)
-- OCI8 Driver now supports LOBs like PHP 3.0. (Thies)
-- var_dump now dumps the properties of an object (Thies)
-- Rewrote the GET/POST/Cookie data reader to support multi-dimensional
- arrays! (Zeev)
-- Renamed allow_builtin_links to expose_php (defaults to On). This directive
- tells PHP whether it may expose its existence to the outside world, e.g.
- by adding itself to the Web server header (Zeev)
-- Added support for transparent session id propagation (Sascha)
-- Made WDDX serialize object properties properly (Andrei)
-- Fixed WDDX mem leak when undefined variable is passed in
- for serialization (Andrei)
-- Added session_unset() function (Andrei)
-- Fixed double session globals shutdown crash (Andrei)
-- Fixed crash related to ignore_user_abort ini entry (Andrei)
-- Added support for external entropy sources for session id creation
- (on Unices /dev/random and /dev/urandom) (Sascha)
-- Added gpc_globals variable directive to php.ini. By default it is On, but
- if it is set to Off, GET, POST and Cookie variables will not be inserted
- to the global scope. Mostly makes sense when coupled with track_vars (Zeev)
-- Added versioning support for shared library (Sascha)
- This allows concurrent use of PHP 3.0 and PHP 4.0 as Apache modules. See
- the end of the INSTALL file for more information.
-- Added second parameter to array_keys which specifies search value
- for which the key should be returned (Andrei)
-- Resourcified Informix driver (Danny)
-- New resource handling for odbc, renamed to php_odbc.[ch]
-- Make set_time_limit() work on Unix (Rasmus)
-- Added connection handling support (Rasmus)
-- Improved the Sybase-CT module to make use of resources (Zeev)
-- Improved the mSQL module to make use of resources (Zeev)
-- Changed mysql_query() and mysql_db_query() to return false in case of saving
- the result set data fails (Zeev)
-- Improved the resource mechanism - resources were not getting freed as soon
- as they could (Zeev)
-- Added shared memory module for session data storage (Sascha)
-- Fixed session.auto_start (Sascha)
-- Fixed several problems with output buffering and HEAD requests (Zeev)
-- Fixed HTTP Status code issue with ISAPI module (Zeev)
-- Fixed a problem that prevented $GLOBALS from working properly (Zeev, Zend
- library)
-- Ported newest GetImageSize (Thies)
-- Added session compile support in Win32 (Andi)
-- Added -d switch to the CGI binary that allows overriding php.ini values
- from the command line (Zeev)
-- Fixed a crash that would occur if wddx_deserialize did not receive
- a valid packet (Andrei)
-- Fixed a bugglet when redefining a class at run-time (Andi, Zend Engine)
-- Fixed sem_get() on AIX (Sascha)
-- Fixed fopen() to work with URL's in Win32 (Andi & Zeev)
-- Fixed include_path for Win32 (Andi, Zend Engine)
-- Fixed bug in ISAPI header sending function (Charles)
-- Fixed memory leak when using undefined values (Andi & Zeev, Zend Engine)
-- Added output_buffering directive to php.ini, to enable output buffering
- for all PHP scripts - default is off (Zeev).
-- Fixed some more class inheritance issues (Zeev, Zend Engine)
-- Fixed Apache build wrt to shared modules on FreeBSD/Linux (Sascha)
-- Added session.extern_referer_chk which checks whether session ids were
- referred to by an external site and eliminates them (Sascha)
-- Improved session id generation (Sascha)
-- Improved speed of uniqid() by using the combined LCG and removing
- the extra usleep() (Sascha)
-- Introduced general combined linear congruential generator (Sascha)
-- Made ldap_close back into an alias for ldap_unbind (Andrei)
-- OciFetchInto now resets the returned array in all cases (Thies)
-- Fixed mysql_errno() to work with recent versions of MySQL (Zeev)
-- Fixed a problem with define() and boolean values (Zeev)
-- Fixed inclusion of gd/freetype functions (Sascha)
-- Fixed persistency of MHASH_* constants (Sascha)
-- Oracle is now ZTS-Safe (Thies)
-- Fixed flushing of cached information to disk in DBA's DB2 module (Sascha)
-- OCI8 is now ZTS-Safe (Thies)
-- Fixed is_writeable/is_writable problem; they are both defined now (Andrei)
-- Imported PHP 3.0 diskfreespace() function (Thies)
-- Fixed thread-safety issues in the MySQL module (Zeev)
-- Fixed thread-safe support for dynamic modules (Zeev)
-- Fixed Sybase CT build process (Zeev)
-
-August 9 1999, Version 4.0 Beta 2
-- Fixed a problem when sending HTTP/1.x header lines using header() (Zeev)
-- Win32 builds now include the ODBC module built-in (Zeev)
-- Fixed SYSV-SHM interface (Thies).
-- Updated hyperwave module, made it thread safe
-- Updated pdflib module, version 0.6 of pdflib no longer supported
-- Updated fdf module
-- Built-in phpinfo() links are now turned off by default. They can be turned
- on using the allow_builtin_links INI directive (Zeev)
-- Changed phpinfo() to list modules that have no info function (Zeev)
-- Modified array_walk() function so that the userland callback is passed
- a key and possible user data in addition to the value (Andrei)
-- Fixed ldap_search(), ldap_read() and ldap_list() (Zeev)
-- Fixed Apache information in phpinfo() (sam@breakfree.com)
-- Improved register_shutdown_function() - you may now supply arguments that
- will be passed to the shutdown function (Zeev)
-- Improved call_user_func() and call_user_method() - they now support passing
- arguments by reference (Zeev)
-- Fixed usort() and uksort() (Zeev)
-- Fixed md5() in the Apache module (Thies)
-- Introduced build process for dynamic modules (Stig)
-- Improved ISAPI module to supprt large server variables (Zeev)
-- Imported PHP 3.0 fixes for problem with PHP as a dynamic module and Redhat
- libc2.1 in zlib module (Stefan)
-- Fixed sybase_fetch_object() (Zeev)
-- Made the IMAP module work with PHP 4.0 (Zeev)
-- Fixed a problem with include()/require() of URLs (Sascha, Zeev)
-- Fixed a bug in implode() that caused it to corrupt its arguments (Zeev)
-- Added get_class($obj), get_parent_class($obj) and method_exists($obj,"name")
- (Andi & Zeev)
-- Fixed various inheritance problems (Andi & Zeev, Zend Engine)
-- Children now inherit their parent's constructor, if they do not supply a
- constructor of their own.
-- Fixed runtime inheritance of classes (parent methods/properties were
- overriding their children) (Zeev, Zend Engine)
-- Fixed backwards incompatibility with the "new" operator (Andi, Zend Engine)
-- Fixed bugs in uksort() and ksort() sort ordering (Andrei)
-- Fixed a memory leak when using assignment-op operators with lvalue of type
- string (Zeev, Zend Engine)
-- Fixed a problem in inheritance from classes that are defined in include()d
- files (Zeev, Zend Engine)
-- Fixed a problem with the PHP error handler that could result in a crash
- on certain operating systems (Zeev)
-- Apache php_flag values only recognized 'On' (case sensitive) - changed
- to case insensitive (Zeev)
-- Fixed a memory leak with switch statement containing return statements
- (Andi & Zeev, Zend Engine)
-- Fixed a crash problem in switch statements that had a string offset
- as a conditional (Andi & Zeev, Zend Engine)
-- Imported PHP 3.0 fixes for rand() and mt_rand() (Rasmus)
-- Added function entries for strip_tags() and similar_text() (Andrei)
-- Fixed a bug in WDDX that would cause a crash if a number was passed in
- instead of a variable name (Andrei)
-- Ported strtotime() function from PHP 3.0 (Andrei)
-- Merged in gdttf stuff from PHP 3.0 (Sascha)
-- buildconf now checks your installation (Stig)
-- XML module now built dynamically with --with-xml=shared (Stig)
-- Added a check for freetype.h - fixed build on RedHat 6.0 (Zeev)
-- Fixed array_walk() to work in PHP 4.0 (Andrei)
-- Ported all remaining date() format options from PHP 3.0 (Andrei)
-- $php_errormsg now works (Andrei)
-- Added locale support for Perl Compatible Regexp functions (Andrei)
-- Informix module ported (Danny)
-- Removed --with-shared-apache (Sascha)
-- Added patch for reverse lookup table in base64_decode (Sascha)
- Submitted by bfranklin@dct.com
-- Merged in PHP 3.0 version of str_replace (Sascha)
-- Added DBA module (Sascha)
-- Added session id detection within REQUEST_URI (Sascha)
-- Merged in HP-UX/ANSI compatibility switch from PHP 3.0 (Sascha)
-- Fixed rpath handling for utilitites built during Apache build (Sascha)
-- Added missing E_ error level constants (Zeev, Zend Engine)
-- Fixed a bug in sending multiple HTTP Cookies under Apache (Zeev)
-- Fixed implicit connect on the MySQL, mSQL, PostgreSQL and Sybase
- modules (Zeev)
-- Gave PHP 4.0's SNMP extension all the functionality of PHP 3.0.12 (SteveL)
-
-July 19 1999, Version 4.0 Beta 1
-- First public beta of PHP 4.0
diff --git a/README.CVS-RULES b/README.CVS-RULES
deleted file mode 100644
index c766837a87..0000000000
--- a/README.CVS-RULES
+++ /dev/null
@@ -1,105 +0,0 @@
-This is the first file you should be reading after you get your CVS account.
-We'll assume you're basically familiar with CVS, but feel free to post
-your questions on the mailing list.
-
-PHP is developed through the efforts of a large number of people.
-Collaboration is a Good Thing(tm), and CVS lets us do this. Thus, following
-some basic rules with regards to CVS usage will:
-
- a. Make everybody happier, especially those responsible for maintaining
- the CVS itself.
- b. Keep the changes consistently well documented and easily trackable.
- c. Prevent some of those 'Oops' moments.
- d. Increase the general level of good will on planet Earth.
-
-
-Having said that, here are the organizational rules:
-
- 1. Respect other people working on the project.
-
- 2. Discuss any significant changes on the list before committing.
-
- 3. Look at EXTENSIONS file to see who is the primary maintainer of
- the code you want to contribute to.
-
- 4. If you "strongly disagree" about something another person did, don't
- start fighting publicly - take it up in private email.
-
- 5. If you don't know how to do something, ask first!
-
- 6. Test your changes before committing them. We mean it. Really.
-
-
-The next few rules are more of a technical nature.
-
- 1. DO NOT TOUCH ChangeLog! It is automagically updated from the commit
- messages every day. Woe be to those who attempt to mess with it.
-
- 2. All news updates intended for public viewing, such as new features,
- bug fixes, improvements, etc., should go into the NEWS file. Also see
- the note below about automatically updating NEWS in your commit message.
-
- 3. Do not commit multiple file and dump all messages in one commit. If you
- modified several unrelated files, commit each group separately and
- provide a nice commit message for each one. See example below.
-
- 4. Do write your commit message in such a way that it makes sense even
- without the corresponding diff. One should be able to look at it, and
- immediately know what was modified. Definitely include the function name
- in the message as shown below.
-
- 5. In your commit messages, keep each line shorter than 80 characters. And
- try to align your lines vertically, if they wrap. It looks bad otherwise.
-
- 6. If you modified a function that is callable from PHP, prepend PHP to
- the function name as shown below.
-
-
-The format of the commit messages is pretty simple.
-
-If a line begins with #, it is taken to be a comment and will not appear
-in the ChangeLog. If the line begins with @, it will be redirected to the
-NEWS file. Everything else goes into the ChangeLog.
-
-It is important to note that if your comment or news logline spans multiple
-lines, you have to put # or @ at the beginning of _every_ such line. Every
-entry in NEWS has to have a name after it, so if you did it with someone's
-help, put both your names there. Your name WILL NOT be automatically put
-at the end of the NEWS entry - so, please provide it yourself.
-
-Example. Say you modified two files, datetime.c and string.c. In datetime.c
-you added a new format option for date() function, and in string.c you fixed
-a memory leak in php_trim(). Don't commit both of these at once. Commit them
-separately and try to make sure your commit messages look something like the
-following.
-
-For datetime.c:
-
-(PHP date) Added new 'K' format modifier for printing out number of
- days until New Year's Eve.
-@- Added new 'K' format modifier that will output the number of days
-@ until New Year's Eve. (Bob)
-
-For string.c:
-(php_trim) Fixed a memory leak resulting from improper use of zval_dtor().
-# Man, that thing was leaking all over the place!
-@- Memory leak in trim() function has finally been fixed. (Bob)
-
-The lines above marked with @ will go into NEWS file automagically, and the
-# lines will be omitted from the ChangeLog. Alternatively, you might want
-to modify NEWS file directly and not use the @ lines.
-
-If you don't see your messages in ChangeLog and NEWS right away, don't worry!
-These files are updated once a day, so your stuff will not show up until
-somewhat later. Don't go adding stuff to NEWS by hand if you already put @
-lines in the commit message.
-
-You can use LXR (http://lxr.php.net/) and Bonsai (http://bonsai.php.net/)
-to look at PHP CVS repository in various ways.
-
-To receive daily updates to ChangeLog and NEWS, send an empty message to
-php-cvs-daily-subscribe@lists.php.net.
-
-Happy hacking,
-
-PHP Team
diff --git a/README.EXT_SKEL b/README.EXT_SKEL
deleted file mode 100644
index a887a85e5f..0000000000
--- a/README.EXT_SKEL
+++ /dev/null
@@ -1,185 +0,0 @@
-
-WHAT IT IS
-
- It's a tool for automatically creating the basic framework for a PHP module
- and writing C code handling arguments passed to your functions from a simple
- configuration file. See an example at the end of this file.
-
-HOW TO USE IT
-
- Very simple. First, cd do directory ext/ in PHP 4 sources. If you just need
- the basic framework and will be writing all the code in your functions
- yourself, you can now do
-
- ./ext_skel --extname=module_name
-
- and everything you need is placed in directory module_name. In fact, if you
- don't need to test the existence of any external header files, libraries or
- functions in them, the module is already almost ready to be compiled in PHP.
- Just remove 3 comments in your_module_name/config.m4, cd back up to PHP
- sources top directory, and do
-
- ./buildconf; ./configure --enable-module_name; make
-
- But if you already have planned the overall scheme of your module, what
- functions it will contain, their return types and the arguments they take
- (a very good idea) and don't want to bother yourself with creating function
- definitions and handling arguments passed yourself, it's time to create a
- function definitions file, which you will give as an argument to ext_skel
- with option
-
- --proto=filename.
-
-FORMAT OF FUNCTION DEFINITIONS FILE
-
- All the definitions must be on one line. In it's simplest form, it's just
- the function name, ie.
-
- my_function
-
- but then you'll be left with an almost empty function body without any
- argument handling.
-
- Arguments are given in parenthesis after the function name, and are of
- the form 'argument_type argument_name'. Arguments are separated from each
- other with a comma and optional space. Argument_type can be one of int,
- bool, double, float, string, array, object or mixed.
-
- An optional argument is separated from the previous by an optional space,
- then '[' and of course comma and optional space, like all the other
- arguments. You should close a row of optional arguments with same amount of
- ']'s as there where '['s. Currently, it does not harm if you forget to do it
- or there is a wrong amount of ']'s, but this may change in the future.
-
- An additional short description may be added after the parameters.
- If present it will be filled into the 'proto' header comments in the stubs
- code and the <refpurpose> tag in the XML documentation.
-
- An example:
-
- my_function(int arg1, int arg2 [, int arg3 [, int arg4]]) this is my 1st
-
- Arguments arg3 and arg4 are optional.
-
- If possible, the function definition should also contain it's return type
- in front of the definition. It's not actually used for any C code generating
- purposes but PHP in-source documentation instead, and as such, very useful.
- It can be any of int, double, string, bool, array, object, resource, mixed
- or void.
-
- The file must contain nothing else but function definitions, no comments or
- empty lines.
-
-OTHER OPTIONS
-
- --no-help
-
- By default, ext_skel creates both comments in the source code and a test
- function to help first time module writers to get started and testing
- configuring and compiling their module. This option turns off all such things
- which may just annoy experienced PHP module coders. Especially useful with
-
- --stubs=file
-
- which will leave out also all module specific stuff and write just function
- stubs with function value declarations and passed argument handling, and
- function entries and definitions at the end of the file, for copying and
- pasting into an already existing module.
-
- --assign-params
- --string-lens
-
- By default, function proto 'void foo(string bar)' creates the following:
- ...
- zval **bar;
- ... (zend_get_parameters_ex() called in the middle...)
- convert_to_string_ex(bar);
-
- Specifying both of these options changes the generated code to:
- ...
- zval **bar_arg;
- int bar_len;
- char *bar = NULL;
- ... (zend_get_parameters_ex() called in the middle...)
- convert_to_string_ex(bar_arg);
- bar = Z_STRVAL_PP(bar_arg);
- bar_len = Z_STRLEN_PP(bar_arg);
-
- You shouldn't have to ask what happens if you leave --string-lens out. If you
- have to, it's questionable whether you should be reading this document.
-
- --with-xml[=file]
-
- Creates the basics for phpdoc .xml file.
-
- --full-xml
-
- Not implemented yet. When or if there will ever be created a framework for
- self-contained extensions to use phpdoc system for their documentation, this
- option enables it on the created xml file.
-
-CURRENT LIMITATIONS, BUGS AND OTHER ODDITIES
-
- Only arguments of types int, bool, double, float, string and array are
- handled. For other types you must write the code yourself. And for type
- mixed, it wouldn't even be possible to write anything, because only you
- know what to expect.
-
- It can't handle correctly, and probably never will, variable list of
- of arguments. (void foo(int bar [, ...])
-
- Don't trust too much the generated code. It tries to be useful in most of
- the situations you might encounter, but automatic code generating will never
- beat a programmer who knows the real situation at hand. ext_skel is generally
- best suited for quickly generating a wrapper for c-library functions you
- might want to have available in PHP too.
-
- This program doesn't have a --help option. It has --no-help instead.
-
-EXAMPLE
-
- The following _one_ line
-
- bool my_drawtext(resource image, string text, resource font, int x, int y [, int color])
-
- will create this function definition for you (note that there are a few
- question marks to be replaced by you, and you must of course add your own
- value definitions too):
-
-/* {{{ proto bool my_drawtext(resource image, string text, resource font, int x, int y[, int color])
- */
-PHP_FUNCTION(my_drawtext)
-{
- zval **image, **text, **font, **x, **y, **color;
- int argc;
- int image_id = -1;
- int font_id = -1;
- ???LS_FETCH();
-
- argc = ZEND_NUM_ARGS();
- if (argc < 5 || argc > 6 || zend_get_parameters_ex(argc, &image, &text, &font, &x, &y, &color) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(???, ???, image, image_id, "???", ???G());
- ZEND_FETCH_RESOURCE(???, ???, font, font_id, "???", ???G());
-
- switch (argc) {
- case 6:
- convert_to_long_ex(color);
- /* Fall-through. */
- case 5:
- convert_to_long_ex(y);
- convert_to_long_ex(x);
- /* font: fetching resources already handled. */
- convert_to_string_ex(text);
- /* image: fetching resources already handled. */
- break;
- default:
- WRONG_PARAM_COUNT;
- }
-
- php_error(E_WARNING, "my_drawtext: not yet implemented");
-}
-/* }}} */
-
diff --git a/README.QNX b/README.QNX
deleted file mode 100644
index d70d2e5d8b..0000000000
--- a/README.QNX
+++ /dev/null
@@ -1,57 +0,0 @@
-QNX4 Installation Notes
------------------------
-
-NOTE: General installation instructions are in the INSTALL file
-
-
-1. To compile and test PHP3 you have to grab, compile and install:
- - GNU dbm library or another db library;
- - GNU bison (1.25 or later; 1.25 tested);
- - GNU flex (any version supporting -o and -P options; 2.5.4 tested);
- - GNU diffutils (any version supporting -w option; 2.7 tested);
-
-2. To use CVS version you may need also:
- - GNU CVS (1.9 tested);
- - GNU autoconf (2.12 tested);
- - GNU m4 (1.3 or later preferable; 1.4 tested);
-
-3. To run configure define -lunix in command line:
- LDFLAGS=-lunix ./configure
-
-4. To use Sybase SQL Anywhere define ODBC_QNX and CUSTOM_ODBC_LIBS in
- command line and run configure with --with-custom-odbc:
- CFLAGS=-DODBC_QNX LDFLAGS=-lunix CUSTOM_ODBC_LIBS="-ldblib -lodbc" ./configure --with-custom-odbc=/usr/lib/sqlany50
- If you have SQL Anywhere version 5.5.00, then you have to add
- CFLAGS=-DSQLANY_BUG
- to workaround its SQLFreeEnv() bug. Other versions has not been tested,
- so try without this flag first.
-
-5. To build the Apache module, you may have to hardcode an include path for
- alloc.h in your Apache base directory:
- - APACHE_DIRECTORY/src/httpd.h:
- change #include "alloc.h"
- to #include "APACHE_DIRECTORY/src/alloc.h"
- Unless you want to use system regex library, you have to hardcode also
- a path to regex.h:
- - APACHE_DIRECTORY/src/conf.h:
- change #include <regex.h>
- to #include "APACHE_DIRECTORY/src/regex/regex.h"
- I don't know so far why this required for QNX, may be it is Watcom
- compiler problem.
-
- If you building Apache module with SQL Anywhere support, you'll get
- symbol conflict with BOOL. It is defined in Apache (httpd.h) and in
- SQL Anywhere (odbc.h). This has nothing to do with PHP, so you have to
- fix it yourself someway.
-
-6. With above precautions, it should compile as is and pass regression
- tests completely:
- make
- make check
- make install
-
- Don't bother me unless you really sure you made that all but it
- still doesn't work.
-
-June 28, 1998
-Igor Kovalenko -- owl@infomarket.ru
diff --git a/README.SELF-CONTAINED-EXTENSIONS b/README.SELF-CONTAINED-EXTENSIONS
deleted file mode 100644
index 1f2e9da770..0000000000
--- a/README.SELF-CONTAINED-EXTENSIONS
+++ /dev/null
@@ -1,174 +0,0 @@
-$Id$
-=============================================================================
-
-HOW TO CREATE A SELF-CONTAINED PHP EXTENSION
-
- A self-contained extension can be distributed independently of
- the PHP source. To create such an extension, three things are
- required:
-
- - Makefile template (Makefile.in)
- - Configuration file (config.m4)
- - Source code for your module
-
- We will describe now how to create these and how to put things
- together.
-
-PREPARING YOUR SYSTEM
-
- While the result will run on any system, a developer's setup needs these
- tools:
-
- GNU autoconf
- GNU automake
- GNU libtool
- GNU m4
-
- All of these are available from
-
- ftp://ftp.gnu.org/pub/gnu/
-
-CONVERTING AN EXISTING EXTENSION
-
- Just to show you how easy it is to create a self-contained
- extension, we will convert an embedded extension into a
- self-contained one. Install PHP and execute the following
- commands.
-
- $ mkdir /tmp/newext
- $ cd /tmp/newext
-
- You now have an empty directory. We will copy the files from
- the mysql extension:
-
- $ cp -rp php-4.0.X/ext/mysql/* .
-
- It is time to finish the module. Run:
-
- $ phpize
-
- You can now ship the contents of the directory - the extension
- can live completely on its own.
-
- The user instructions boil down to
-
- $ ./configure \
- [--with-php-config=/path/to/php-config] \
- [--with-mysql=MYSQL-DIR]
- $ make install
-
- The MySQL module will either use the embedded MySQL client
- library or the MySQL installation in MYSQL-DIR.
-
-
-DEFINING THE NEW EXTENSION
-
- Our demo extension is called "foobar".
-
- It consists of two source files "foo.c" and "bar.c"
- (and any arbitrary amount of header files, but that is not
- important here).
-
- The demo extension does not reference any external
- libraries (that is important, because the user does not
- need to specify anything).
-
-
-CREATING THE MAKEFILE TEMPLATE
-
- The Makefile Template (Makefile.in) contains three lines:
-
-------------------------------------------------------------------------------
-LTLIBRARY_SHARED_NAME = foobar.la
-LTLIBRARY_SOURCES = foo.c bar.c
-
-include $(top_srcdir)/build/dynlib.mk
-------------------------------------------------------------------------------
-
- LTLIBRARY_SHARED_NAME specifies the name of the extension.
- It must be of the form `ext-name.la'.
-
- LTLIBRARY_SOURCES specifies the names of the sources files. You can
- name an arbitrary number of source files here.
-
- The final include directive includes the build rules (you usually
- don't need to care about what happens there). rules.mk and other
- files are installed by phpize which we will cover later.
-
-
-CREATING THE M4 CONFIGURATION FILE
-
- The m4 configuration can perform additional checks. For a
- self-contained extension, you do not need more than a few
- macro calls.
-
-------------------------------------------------------------------------------
-PHP_ARG_ENABLE(foobar,whether to enable foobar,
-[ --enable-foobar Enable foobar])
-
-if test "$PHP_FOOBAR" != "no"; then
- PHP_EXTENSION(foobar, $ext_shared)
-fi
-------------------------------------------------------------------------------
-
- PHP_ARG_ENABLE will automatically set the correct variables, so
- that the extension will be enabled by PHP_EXTENSION in shared mode.
-
- Please use always PHP_ARG_ENABLE or PHP_ARG_WITH. Even if you do not
- plan to distribute your module with PHP, these facilities allow you
- to integrate your module easily into the main PHP module framework.
-
-CREATING SOURCE FILES
-
- ext_skel can be of great help when creating the common code for all modules
- in PHP for you and also writing basic function definitions and C code for
- handling arguments passed to your functions. See README.EXT_SKEL for further
- information.
-
- As for the rest, you are currently alone here. There are a lot of existing
- modules, use a simple module as a starting point and add your own code.
-
-
-CREATING THE SELF-CONTAINED EXTENSION
-
- Put Makefile.in, config.m4 and the source files into one directory.
- Then run phpize (this is installed during make install by PHP 4.0).
- For example, if you configured PHP with --prefix=/php, you would run
-
- $ /php/bin/phpize
-
- This will automatically copy the necessary build files and create
- configure from your config.m4.
-
- And that's it. You now have a self-contained extension.
-
-INSTALLING A SELF-CONTAINED EXTENSION
-
- An extension can be installed by running:
-
- $ ./configure \
- [--with-php-config=/path/to/php-config]
- $ make install
-
-ADDING SHARED MODULE SUPPORT TO A MODULE
-
- In order to be useful, a self-contained extension must be loadable
- as a shared module. I will explain now how you can add shared module
- support to an existing module called foo.
-
- 1. In config.m4, use PHP_ARG_WITH/PHP_ARG_ENABLE. Then you will
- automatically be able to use --with-foo=shared or
- --enable-foo=shared.
-
- 2. In config.m4, use PHP_EXTENSION(foo, $ext_shared) to enable
- building the extension.
-
- 3. Add the following line to Makefile.in:
-
- LTLIBRARY_SHARED_NAME = foo.la
-
- 4. Add the following lines to your C source file:
-
- #ifdef COMPILE_DL_FOO
- ZEND_GET_MODULE(foo)
- #endif
diff --git a/README.STREAMS b/README.STREAMS
deleted file mode 100644
index 2ae89b7a51..0000000000
--- a/README.STREAMS
+++ /dev/null
@@ -1,243 +0,0 @@
-An Overview of the PHP Streams abstraction
-==========================================
-$Id$
-
-Please send comments to: Wez Furlong <wez@thebrainroom.com>
-
-Note: this doc is preliminary and is intended to give the reader an idea of
-how streams work and should be used.
-
-Why Streams?
-============
-You may have noticed a shed-load of issock parameters flying around the PHP
-code; we don't want them - they are ugly and cumbersome and force you to
-special case sockets and files everytime you need to work with a "user-level"
-PHP file pointer.
-Streams take care of that and present the PHP extension coder with an ANSI
-stdio-alike API that looks much nicer and can be extended to support non file
-based data sources.
-
-Using Streams
-=============
-Streams use a php_stream* parameter just as ANSI stdio (fread etc.) use a
-FILE* parameter.
-
-The main functions are:
-
-PHPAPI size_t php_stream_read(php_stream * stream, char * buf, size_t count);
-PHPAPI size_t php_stream_write(php_stream * stream, const char * buf, size_t
- count);
-PHPAPI int php_stream_eof(php_stream * stream);
-PHPAPI int php_stream_getc(php_stream * stream);
-PHPAPI char *php_stream_gets(php_stream * stream, char *buf, size_t maxlen);
-PHPAPI int php_stream_close(php_stream * stream);
-PHPAPI int php_stream_flush(php_stream * stream);
-PHPAPI int php_stream_seek(php_stream * stream, off_t offset, int whence);
-PHPAPI off_t php_stream_tell(php_stream * stream);
-
-These (should) behave in the same way as the ANSI stdio functions with similar
-names: fread, fwrite, feof, fgetc, fgets, fclose, fflush, fseek, ftell.
-
-Opening Streams
-===============
-Ultimately, I aim to implement an fopen_wrapper-like call to do this with
-minimum fuss.
-Currently, mostly for testing purposes, you can use php_stream_fopen to open a
-stream on a regular file.
-
-PHPAPI php_stream * php_stream_fopen(const char * filename, const char *
- mode);
-
-This call behaves just like fopen(), except it returns a stream instead of a
-FILE *
-
-Casting Streams
-===============
-What if your extension needs to access the FILE* of a user level file pointer?
-You need to "cast" the stream into a FILE*, and this is how you do it:
-
-FILE * fp;
-php_stream * stream; /* already opened */
-
-if (php_stream_cast(stream, PHP_STREAM_AS_STDIO, &fp, 1) == FAILURE) {
- RETURN_FALSE;
-}
-
-The prototype is:
-
-PHPAPI int php_stream_cast(php_stream * stream, int castas, void ** ret, int
- show_err);
-
-The show_err parameter, if non-zero, will cause the function to display an
-appropriate error message of type E_WARNING if the cast fails.
-
-castas can be one of the following values:
-PHP_STREAM_AS_STDIO - a stdio FILE*
-PHP_STREAM_AS_FD - a generic file descriptor
-PHP_STREAM_AS_SOCKETD - a socket descriptor
-
-If you ask a socket stream for a FILE*, the abstraction will use fdopen to
-create it for you. Be warned that doing so may cause buffered data to be lost
-if you mix ANSI stdio calls on the FILE* with php stream calls on the stream.
-
-If your system has the fopencookie function, php streams can synthesize a
-FILE* on top of any stream, which is useful for SSL sockets, memory based
-streams, data base streams etc. etc.
-NOTE: There might be situations where this is not desireable, and we need to
-provide a flag to inform the casting routine of this.
-
-You can use:
-
-PHPAPI int php_stream_can_cast(php_stream * stream, int castas)
-
-to find out if a stream can be cast, without actually performing the cast, so
-to check if a stream is a socket you might use:
-
-if (php_stream_can_cast(stream, PHP_STREAM_AS_SOCKETD) == SUCCESS) {
- /* it's a socket */
-}
-
-
-Stream Internals
-================
-
-There are two main structures associated with a stream - the php_stream
-itself, which holds some state information (and possibly a buffer) and a
-php_stream_ops structure, which holds the "virtual method table" for the
-underlying implementation.
-
-The php_streams ops struct consists of pointers to methods that implement
-read, write, close, flush, seek, gets and cast operations. Of these, an
-implementation need only implement write, read, close and flush. The gets
-method is intended to be used for non-buffered streams if there is an
-underlying method that can efficiently behave as fgets. The ops struct also
-contains a label for the implementation that will be used when printing error
-messages - the stdio implementation has a label of "STDIO" for example.
-
-The idea is that a stream implementation defines a php_stream_ops struct, and
-associates it with a php_stream using php_stream_alloc.
-
-As an example, the php_stream_fopen() function looks like this:
-
-PHPAPI php_stream * php_stream_fopen(const char * filename, const char * mode)
-{
- FILE * fp = fopen(filename, mode);
- php_stream * ret;
-
- if (fp) {
- ret = php_stream_alloc(&php_stream_stdio_ops, fp, 0, 0, mode);
- if (ret)
- return ret;
-
- fclose(fp);
- }
- return NULL;
-}
-
-php_stream_stdio_ops is a php_stream_ops structure that can be used to handle
-FILE* based streams.
-
-A socket based stream would use code similar to that above to create a stream
-to be passed back to fopen_wrapper (or it's yet to be implemented successor).
-
-The prototype for php_stream_alloc is this:
-
-PHPAPI php_stream * php_stream_alloc(php_stream_ops * ops, void * abstract,
- size_t bufsize, int persistent, const char * mode)
-
-ops is a pointer to the implementation,
-abstract holds implementation specific data that is relevant to this instance
-of the stream,
-bufsize is the size of the buffer to use - if 0, then buffering at the stream
-level will be disabled (recommended for underlying sources that implement
-their own buffering - such a FILE*),
-persistent controls how the memory is to be allocated - persistently so that
-it lasts across requests, or non-persistently so that it is freed at the end
-of a request (it uses pemalloc),
-mode is the stdio-like mode of operation - php streams places no real meaning
-in the mode parameter, except that it checks for a 'w' in the string when
-attempting to write (this may change).
-
-The mode parameter is passed on to fdopen/fopencookie when the stream is cast
-into a FILE*, so it should be compatible with the mode parameter of fopen().
-
-Writing your own stream implementation
-======================================
-
-First, you need to figure out what data you need to associate with the
-php_stream. For example, you might need a pointer to some memory for memory
-based streams, or if you were making a stream to read data from an RDBMS like
-mysql, you might want to store the connection and rowset handles.
-
-The stream has a field called abstract that you can use to hold this data.
-If you need to store more than a single field of data, define a structure to
-hold it, allocate it (use pemalloc with the persistent flag set
-appropriately), and use the abstract pointer to refer to it.
-
-For structured state you might have this:
-
-struct my_state {
- MYSQL conn;
- MYSQL_RES * result;
-};
-
-struct my_state * state = pemalloc(sizeof(struct my_state), persistent);
-
-/* initialize the connection, and run a query, using the fields in state to
- * hold the results */
-
-state->result = mysql_use_result(&state->conn);
-
-/* now allocate the stream itself */
-stream = php_stream_alloc(&my_ops, state, 0, persistent, "r");
-
-/* now stream->abstract == state */
-
-Once you have that part figured out, you can write your implementation and
-define the your own php_stream_ops struct (we called it my_ops in the above
-example).
-
-For example, for reading from this wierd mysql stream:
-
-static size_t php_mysqlop_read(php_stream * stream, char * buf, size_t count)
-{
- struct my_state * state = (struct my_state*)stream->abstract;
-
- if (buf == NULL && count == 0) {
- /* in this special case, php_streams is asking if we have reached the
- * end of file */
- if (... at end of file ...)
- return EOF;
- else
- return 0;
- }
-
- /* pull out some data from the stream and put it in buf */
- ... mysql_fetch_row(state->result) ...
- /* we could do something strange, like format the data as XML here,
- and place that in the buf, but that brings in some complexities,
- such as coping with a buffer size too small to hold the data,
- so I won't even go in to how to do that here */
-}
-
-Implement the other operations - remember that write, read, close and flush
-are all mandatory. The rest are optional. Declare your stream ops struct:
-
-php_stream_ops my_ops = {
- php_mysqlop_write, php_mysqlop_read, php_mysqlop_close,
- php_mysqlop_flush, NULL, NULL, NULL,
- "Strange mySQL example"
-}
-
-Thats it!
-
-Take a look at the STDIO implementation in streams.c for more information
-about how these operations work.
-The main thing to remember is that in your close operation you need to release
-and free the resources you allocated for the abstract field. In the case of
-the example above, you need to use mysql_free_result on the rowset, close the
-connection and then use pefree to dispose of the struct you allocated.
-You may read the stream->persistent field to determine if your struct was
-allocated in persistent mode or not.
-
-vim:tw=78
diff --git a/README.Zeus b/README.Zeus
deleted file mode 100644
index 0a2803c842..0000000000
--- a/README.Zeus
+++ /dev/null
@@ -1,126 +0,0 @@
-Using PHP4 with the Zeus Web Server
------------------------------------
-
-Zeus fully supports running PHP in combination with our
-webserver. There are three different interfaces that can be used to
-enable PHP:
-
-* CGI
-* ISAPI
-* FastCGI
-
-Of the three, we recommend using FastCGI, which has been tested and
-benchmarked as providing the best performance and reliability.
-
-Full details of how to install PHP are available from our
-website, at:
-
-http://support.zeus.com/products/php.html
-
-If you have any problems, please check the support site for more
-up-to-date information and advice.
-
-
-Quick guide to installing FastCGI with Zeus
--------------------------------------------
-
-Step 1 - obtain and install FastCGI development kit.
-
-Grab the package from:
-http://www.fastcgi.com/dist/devkit_2.2.0.tar.gz
-
-Extract the package and follow the instructions:
- ./configure
- make
- make export
-(run the last as root)
-
-This will install to /usr/local/lib/libfcgi.a
- and /usr/local/include/*fcgi*
-
-
-
-Step 2 - Compile PHP as FastCGI.
-
-Compile as follows:
- ./configure --with-fastcgi
- make
-
-Note that PHP has many options to the configure script -
-e.g. --with-mysql. You will probably want to select your usual options
-before compiling; the above is just a bare minimum, for illustration.
-
-After compilation finishes, you will be left with an executable
-program called 'php'. Copy this into your document root, under a
-dedicated FastCGI directory (e.g. $DOCROOT/fcgi-bin/php)
-
-
-Step 3 - configure Zeus
-
-Four stages:
- - enable FastCGI
- - configure FastCGI
- - setup alias for FastCGI
- - setup alias for PHP
-
-1) Using the admin server, go to the 'module configuration' page for
-your virtual server, and ensure that 'fastcgi' is enabled (select the
-tickbox to the left).
-
-2) While we can run FastCGI's locally, there are known problems with
-some OS's (specifically, the communication between web server and
-FastCGI happens over a unix domain socket, and some OS's have trouble
-sustaining high connection rates over these sockets). So instead, we
-are going to set up the PHP FastCGI to run 'remotely' over localhost
-(this uses TCP sockets, which do not suffer this problem). Go to the
-'fastcgi configuration' page, and under 'add remote fastcgi':
- Add Remote FastCGI
- Docroot path /fcgi-bin/php
- Remote machine localhost:8002
-The first entry is where you saved PHP, above.
-The second entry is localhost:<any unused port>
-We will start the FastCGI listening on this port shortly.
-Click 'update' to commit these changes.
-
-3) Go to the path mapping module and add an alias for FastCGI:
- Add Alias
- Docroot path /fcgi-bin
- Filesystem directory /path/to/docroot/fcgi-bin
- Alias type fastcgi
-Click 'update' to commit these changes
-
-4) Also on the path mapping module, add a handler for PHP:
- Add handler
- File extension php
- Handler /fcgi-bin/php
-Click 'update' to commit these changes
-
-Finally restart your virtual server for these changes to take effect.
-
-
-Step 4 - start PHP as a FastCGI runner
-
-When you start PHP, it will pre-fork a given number of child processes
-to handle incoming PHP requests. Each process will handle a given
-number of requests before exiting (and being replaced by a newly
-forked process). You can control these two parameters by setting the
-following environment variables BEFORE starting the FastCGI runner:
-
-PHP_FCGI_CHILDREN - the number of child processes to pre-fork. If not
-set, defaults to 8.
-
-PHP_FCGI_MAX_REQUESTS - the number of requests each PHP child process
-handles before exiting. If not set, defaults to 500.
-
-To start the FastCGI runner, execute '$ZEUSHOME/web/bin/fcgirunner
-8002 $DOCROOT/fcgi-bin/php'. Substitute the appropriate values for
-$ZEUSHOME and $DOCROOT; also substitute for 8002 the port you chose,
-above.
-
-To stop the runner (e.g. to experiment with the above environment
-variables) you will need to manually stop and running PHP
-processes. (Use 'ps' and 'kill'). As it is PHP which is forking lots
-of children and not the runner, Zeus unfortunately cannot keep track
-of what processes are running, sorry. A typical command line may look
-like 'ps -efl | grep $DOCROOT/fcgi-bin/php | grep -v grep | awk
-'{print $4}' | xargs kill'
diff --git a/RELEASE_PROCESS b/RELEASE_PROCESS
deleted file mode 100644
index 4e4d7f1936..0000000000
--- a/RELEASE_PROCESS
+++ /dev/null
@@ -1,186 +0,0 @@
- Advisory on the PHP Release Cycle
-
-
-Copyright & Liciencing
-
- This Document is (c) Copyright 2000,2001 by The PHP Group
-
- This Document is distributed under the terms of the GNU General
- Public License as published by the Free Software Foundation;
- either version 2 of the License, or (at your option) any later
- version.
-
-
-Table of Contents
-
- 1. Introduction
- 2. Dealing with bugs
- 2.1 As a QA Team Member
- 2.2 As a Developer
- 3. Releaseing another RC
- 4. CVS During the Release Process
- 4.1 Useful CVS Commands
- 5 The Final Release
- 6 Summary
-
-
-1. Introduction
-
- This cycle should take place over roughly 10 days. When it is
- decided it is time for an Release to occur Andi/Zeev (Or
- Whoever) will tarball RC1, Tag & Branch CVS (see section 4)
- and then announce the RC on PHP-QA and PHP-DEV. At this
- point the build tracker and QA Bug System come into play.
- If you successfully build PHP then report it in the build
- tracker, If you then run and complete all the tests you
- should report this too in the build tracker when
- these features become avalible.
-
-2. Dealing with Bugs
-
-2.1 As a QA Team member
-
- If you find a bug in an RC that you think is a showstopper
- then, even if it is a known bug, you should report it in the
- QA Bug system. This marks the bug for discussion at least,
- and preferably fixing before the actual release. This system
- is separate from the main bugs system so that important bugs
- dont get lost in the midst if lots of feature/change request
- in the approach to a release. It is imperitive where
- appropraite that as a QA'er a test script, Configure options
- and PHP.ini files are provided to enable the developer to
- reproduce the bug, this is an important part of our job. If
- you have a serious bug then you should also create a test
- script to be added to the tests dir of the php source so
- that at the end of the process to enable us to make sure bug
- does not return. It is not difficult to create these test
- scripts and a readme on it can be found in
- php4/tests/README.
-
-
-2.2 As a Developer
-
- What should happen is that when a bug is reported it
- is send to php-dev and php-qa as with other bugs. We should
- have far stricter assignment system in this bug cycle rather
- than just leaving them. Once again bugs should be able to be
- marked as To Be Fixed Before release or moved to other bug
- system. (This is currently the Release Masters responsibility)
-
- Then before the actual release the qa bugs system can be
- checked and if there are outstanding To Be Fixed Before
- release bugs the Developers can see this easyly rather than
- show stoppers being dismissed and not worried about.
-
- When a bug is fixed the QAer who reported the bug is emailed
- and asked to test again and see if the bug is fixed.
-
-3 Releasing another RC
-
- If it is felt necessary that a 2nd RC is needed then it
- should be packaged as before and announced to both lists
- again. The testing process then starts again, the RC2 is
- added to the build tracker and QA'ers are asked to build and
- retest the scripts as appropriate, espectially if you
- reported a bug, you should test thourghly for your
- bug and make sure it no longer occurs. This will normally
- add anouther 3 days to the cycle, giving QA'ers time to
- build test and report back, then for developers to
- fix any problems.
-
-4 CVS during the release process
-
- At the point where the first RC is create a branch is
- formed. This branch is not altered form that point onward
- other than major bug fixes. Minor non important bug
- fixes should not be applied to this branch but to the main
- tree instead. Any major bug fixes should be applied to both
- trees. The developer should test and check the RC tree then
- also test and check the MAIN tree. This is their
- responsibility to make sure (as far as possible) that the
- bug fix works on both trees.
-
-4.1 Useful CVS Commands
-
- To create a Branch <Should only be done by person tarballing
- the RC (The Release Master)>:
-
- $ cvs tag -b php_4_0_<Version>RC<NUMBER>
- IE:
- $ cvs tag -b php_4_0_1RC1
-
- This should be executed in the PHP directory of an up to
- date checkout. Remember to also tag the Zend and TSRM repositories.
-
- You can retrieve a branch in one of two ways: by checking it
- out fresh from the repository, or by switching an existing
- working copy over to the branch, I would suggest you
- checkout a new copy.
-
- To check out a new copy:
- $ cvs checkout -r php_4_0_<Version>RC<NUMBER> php4
- IE:
- $ cvs checkout -r php_4_0_1RC1 php4
-
-
- To switch a working copy (Not recomended due to possible
- commiting to wrong branch)
- $ cvs update -r php_4_0_<Version>RC<NUMBER> php4
- IE:
- $ cvs update -r php_4_0_1RC1 php4
-
- This should be done in the PHP4 directory itself.
-
- To revert back to normal branch you should use the
- following:
- $ cvs update -A
-
- To Commit to the branch you follow exactly the same
- procedure as normal
- $ cvs commit file.c
-
- MAKE SURE YOU DO NOT COMMIT TO THE WRONG BRANCH.
-
-5 The Final Release
-
- When it is time to make the final release the following
- proceedure should be followed. The person who is tarballing
- the final release should check the QA bugs system and make
- sure there are no showstoppers left unfixed. If there are
- then bug the person the bug is assigned to until they fix
- it. If there are no more qa bugs then they should tag the
- branch as php_4_0_<Version> and tarball as usual. An email
- should be sent to PHP-GEN, PHP_DEV and PHP-QA about the new
- release and it should be added to php.net. The windows
- binaries and servelets should be built as soon as possible
- and added too, as should the windows installer.
-
-6 Summary
-
- Here is a summary of what a release cycle might look like:
-
- Thurs: RC is agreed on and packaged, an email is sent to
- PHP_QA and PHP-DEV, the CVS is Branched and the
- Release Cycle Begins.
-
- Mon: After a weekends testing most show stoppers should
- have been found (Hopefully) and the developers get to
- work on fixing them.
-
- Thurs: A second RC is released if needed with the new bug
- fixes in and the QAers test again.
-
- Sun: A review is made of all outstanding bugs and any show
- stoppers should be fixed. if there are no show
- stoppers then the final release is packaged and
- released on the monday morning on php.net
-
- Mon: Release is made.
-
-
-James
---
-James Moore
-PHP QA Team
-jmoore@php.net
-
diff --git a/TODO b/TODO
deleted file mode 100644
index 9abac573b4..0000000000
--- a/TODO
+++ /dev/null
@@ -1,142 +0,0 @@
-Things to do or at least think about doing in the future. Name in
-parenthesis means that person has taken on this project.
-
-Zend
-----
- * allow foreach ($array as $k => &$val) syntax. right now we cannot
- traverse an array without copying each element.
- * allow foreach ($array as $k => list($a, $b)) syntax for multi
- dimensional arrays.
- * look at replacing c-lib call tolower().
- * make hash API functions work with HASH_OF() to save time.
- * native large number support (probably with GNU GMP)
- * Const'ify APIs. Right now, many functions leave parameters untouched,
- but don't declare those as const. This makes interaction with other
- interfaces difficult which pass const parameters to us.
- * add try..catch/throw exception handling
-
-global
-------
- * when used in standalone (skell-script like) mode don't urldecode
- arguments passed to php. right now it's not possible to say
- /usr/local/bin/php somescript.php dog+cat.txt
- as "dog+cat.txt" will arrive in php as "dog cat.txt".
- * make everything on the language-level independent of your locale setings.
- * always build the standalone executable as well as the chosen SAPI
- target.
- * make sure all source files have the "right" copyright.
- * the following modules still use PHP3_TLS_*() macros (and thereby don't
- work in ZTS mode): ext/db/db.c, ext/gd/gd.c
- * make sure that all ZTS globals get destructed. Most ts_allocate_id()
- calls should have a dtor entry.
- * activate all extensions by default that don't rely on external
- dependices. (eg ftp)
- * --enable-all in configure. (--enable-shared=max ...)
- * make configure print out a summary when it's done (like XEmacs)
- * replace standard functions which work on static data with
- reentrancy-safe functions (DONE?).
- * on some platforms unimplemented function will just do nothing (e.g. symlink)
- they should print a warning or not even be defined!
- * implement javadoc based function docs template system.
- * use thread-safe resolver functions (either require BIND 8 or adns).
- * provide optional IPv6 support.
- * make SAPI conform to CGI/1.1. Currently, all SAPI modules
- define REMOTE_ADDR etc. themselves and reach only various level
- of compliance.
- * find a better way to implement script timeouts. SIGVTALRM is used
- by some POSIX threads implementations (i.e. OpenBSD) and is not
- available in ZTS mode.
- * add aliases to functions to conform to new naming conventions, e.g.
- str_to_upper().
- * see what functions might need to be changed to use HashPosition, so
- that the internal array pointer is not affected.
-
-documentation
--------------
- * add remarks in the documentation which functions are not implemented on win32.
- * add remarks in the documentation which functions are not binary-safe.
- * improve documentation for the sablotron extension
- * update curl documentation
- * write documentation for the bzip2 extension
- * write documentation for the zziplib extension
-
-ext/curl
---------
- * Use the cURL write handler to save data for use when returning data or outputting
- data.
- * Have a warning scheme for when people use unsupported features.
-
-ext/dav
---------
- * rewrite.
-
-ext/oci8
---------
- * all OCIFetch*() functions should return 0 for no more data and false on error.
- * have a flag that trims trailing spaces from CHAR fields on retrieval.
- * make allow_call_time_pass_reference=Off working.
- * for additional todo information, see oci8.c, in ext/oci8
-
-ext/pcre
---------
- * Allow user to set PCRE_NOTEMPTY, PCRE_ANCHORED at execution time, maybe
- * add option to preg_grep() to return entries that _don't_ match
-
-ext/sablot
-----------
- * Re-write the error handling and reporting interface
- * Cleanup the underlying code a bit
- * Add proper support for the message handlers
-
-ext/session
------------
- * maybe implement finer-grained session variables that could be
- locked individually.
- * write a network-transparent storage back-end with fallover
- facilities
- * provide a callback facility which is executed upon encountering
- an unknown classname during deserialization
-
-ext/sockets
------------
- * Make the extension work on windows (Daniel Beulshausen)
- * Make the extension work with Solaris and the Sun GCC
-
-ext/standard
-------------
- * add a version number to data serialized via serialize().
- * array_add(). (Andrei)
- * possibly modify parsing of GPC data to automatically create arrays if
- variable name is seen more than once.
- * implement regex-cache for url-functions.
- * stri_replace(). (Andrei)
- * move socket related functions to fsock.c.
- * NOT binary safe:
- strtok()
- basename()
- dirname()
- strrpos()
- strrchr()
- strip_tags()
- * rewrite win32 SMTP code to be useable for *ix to, maybe as a (default)
- module of its own (Hartmut)
-
-ext/zziplib
-------------
- * more fully support the zziplib api
-
-ext/wddx
---------
- * See if we can support the remaining datatypes:
- dateTime
- binary
- recordset
-
- http://www.wddx.org/WDDX_SDK_10a/7__References/WDDX_DTD.htm
- (Andrei)
-
- * implement wddx_packet_as_javascript(). (Andrei)
-
-other cool stuff
-----------------
- * PVM extension
diff --git a/TODO-4.2.txt b/TODO-4.2.txt
deleted file mode 100644
index f128d918e8..0000000000
--- a/TODO-4.2.txt
+++ /dev/null
@@ -1,32 +0,0 @@
-* Remove --with-openlink configure option (--with-iodbc replaces it).
-
-* Always build CGI (--disable-cgi option to disable).
-
-* Move most extensions and PEAR packages out of the PHP CVS tree,
- include them again during release packaging.
-
-* Renaming functions, so that they all are conform to one standard form.
-
-* Allow foreach($array as $key => &$value).
-
-* Allow foreach($array as list($var1, $var2)).
-
-* Clean up "$instance = &new object" syntax (default to the =& behaviour?).
-
-* Allow to set a default value for call-by-reference-parameters. eg:
- function hallo (&$pallo = NULL) {}
-
-* Change PHP error messages, so that they point to pages or sections in the
- PHP Manual.
-
-* Fix Zend shallow copy issues with objects and arrays.
-
-* Make all extensions thread-safe.
-
-* Finish PHP streams abstraction, nuke all that issock stuff, implement SSL
- socket support. (wez)
- - ext/ftp/ -> all FILEs to streams
- - ext/bz2/ -> convert to stream impl.
-
-* Using arg_separator.input to implode args in the CGI sapi extension
- and arg_separator.input to explode in php_build_argv().
diff --git a/TSRM/LICENSE b/TSRM/LICENSE
deleted file mode 100644
index 8d208476e4..0000000000
--- a/TSRM/LICENSE
+++ /dev/null
@@ -1,26 +0,0 @@
-Copyright (c) 1999, 2000, Andi Gutmans, Sascha Schumann, Zeev Suraski.
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
-- Redistributions of source code must retain the above copyright notice,
-this list of conditions and the following disclaimer.
-
-- Neither name of the copyright holders nor the names of their contributors
-may be used to endorse or promote products derived from this software
-without specific prior written permission.
-
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS
-IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
-THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR
-CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/TSRM/Makefile.am b/TSRM/Makefile.am
deleted file mode 100644
index 91e585b65c..0000000000
--- a/TSRM/Makefile.am
+++ /dev/null
@@ -1,6 +0,0 @@
-## process this file with automake to produce Makefile.am
-AUTOMAKE_OPTIONS=foreign
-noinst_LTLIBRARIES=libtsrm.la
-libtsrm_la_SOURCES = TSRM.c tsrm_strtok_r.c tsrm_virtual_cwd.c
-
-depend:
diff --git a/TSRM/TODO b/TSRM/TODO
deleted file mode 100644
index 82b4fedfde..0000000000
--- a/TSRM/TODO
+++ /dev/null
@@ -1,2 +0,0 @@
-- Improve the lock in ts_resource_ex() in order to cover less code.
- This can probably be done by more careful hash table access
diff --git a/TSRM/TSRM.c b/TSRM/TSRM.c
deleted file mode 100644
index d96165001d..0000000000
--- a/TSRM/TSRM.c
+++ /dev/null
@@ -1,570 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Thread Safe Resource Manager |
- +----------------------------------------------------------------------+
- | Copyright (c) 1999, 2000, Andi Gutmans, Sascha Schumann, Zeev Suraski|
- | This source file is subject to the TSRM license, that is bundled |
- | with this package in the file LICENSE |
- +----------------------------------------------------------------------+
- | Authors: Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-#include "TSRM.h"
-
-#ifdef ZTS
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#if HAVE_STDARG_H
-#include <stdarg.h>
-#endif
-
-typedef struct _tsrm_tls_entry tsrm_tls_entry;
-
-struct _tsrm_tls_entry {
- void **storage;
- int count;
- THREAD_T thread_id;
- tsrm_tls_entry *next;
-};
-
-
-typedef struct {
- size_t size;
- ts_allocate_ctor ctor;
- ts_allocate_dtor dtor;
-} tsrm_resource_type;
-
-
-#define TSRM_SHUFFLE_RSRC_ID(rsrc_id) ((rsrc_id)+1)
-#define TSRM_UNSHUFFLE_RSRC_ID(rsrc_id) ((rsrc_id)-1)
-
-/* The memory manager table */
-static tsrm_tls_entry **tsrm_tls_table=NULL;
-static int tsrm_tls_table_size;
-static ts_rsrc_id id_count;
-
-/* The resource sizes table */
-static tsrm_resource_type *resource_types_table=NULL;
-static int resource_types_table_size;
-
-
-static MUTEX_T tsmm_mutex; /* thread-safe memory manager mutex */
-
-/* New thread handlers */
-static void (*tsrm_new_thread_begin_handler)();
-static void (*tsrm_new_thread_end_handler)();
-
-/* Debug support */
-int tsrm_error(int level, const char *format, ...);
-
-/* Read a resource from a thread's resource storage */
-void *ts_resource_read( tsrm_tls_entry *thread_resources, ts_rsrc_id id );
-static int tsrm_error_level;
-static FILE *tsrm_error_file;
-#if TSRM_DEBUG
-#define TSRM_ERROR tsrm_error
-#define TSRM_SAFE_ARRAY_OFFSET(array, offset, range) (((offset)>=0 && (offset)<(range)) ? array[offset] : NULL)
-#else
-#define TSRM_ERROR
-#define TSRM_SAFE_ARRAY_OFFSET(array, offset, range) array[offset]
-#endif
-
-#if defined(PTHREADS)
-/* Thread local storage */
-static pthread_key_t tls_key;
-#elif defined(TSRM_ST)
-static int tls_key;
-#endif
-
-
-/* Startup TSRM (call once for the entire process) */
-TSRM_API int tsrm_startup(int expected_threads, int expected_resources, int debug_level, char *debug_filename)
-{
-#if defined(GNUPTH)
- pth_init();
-#elif defined(PTHREADS)
- pthread_key_create( &tls_key, 0 );
-#elif defined(TSRM_ST)
- st_init();
- st_key_create(&tls_key, 0);
-#endif
-
- tsrm_error_file = stderr;
- tsrm_error_set(debug_level, debug_filename);
- tsrm_tls_table_size = expected_threads;
-
- tsrm_tls_table = (tsrm_tls_entry **) calloc(tsrm_tls_table_size, sizeof(tsrm_tls_entry *));
- if (!tsrm_tls_table) {
- TSRM_ERROR(TSRM_ERROR_LEVEL_ERROR, "Unable to allocate TLS table");
- return 0;
- }
- id_count=0;
-
- resource_types_table_size = expected_resources;
- resource_types_table = (tsrm_resource_type *) calloc(resource_types_table_size, sizeof(tsrm_resource_type));
- if (!resource_types_table) {
- TSRM_ERROR(TSRM_ERROR_LEVEL_ERROR, "Unable to allocate resource types table");
- free(tsrm_tls_table);
- tsrm_tls_table = NULL;
- return 0;
- }
-
- tsmm_mutex = tsrm_mutex_alloc();
-
- tsrm_new_thread_begin_handler = tsrm_new_thread_end_handler = NULL;
-
- TSRM_ERROR(TSRM_ERROR_LEVEL_CORE, "Started up TSRM, %d expected threads, %d expected resources", expected_threads, expected_resources);
- return 1;
-}
-
-
-/* Shutdown TSRM (call once for the entire process) */
-TSRM_API void tsrm_shutdown(void)
-{
- int i;
-
- if (tsrm_tls_table) {
- for (i=0; i<tsrm_tls_table_size; i++) {
- tsrm_tls_entry *p = tsrm_tls_table[i], *next_p;
-
- while (p) {
- int j;
-
- next_p = p->next;
- for (j=0; j<id_count; j++) {
- free(p->storage[j]);
- }
- free(p->storage);
- free(p);
- p = next_p;
- }
- }
- free(tsrm_tls_table);
- tsrm_tls_table = NULL;
- }
- if (resource_types_table) {
- free(resource_types_table);
- resource_types_table=NULL;
- }
- tsrm_mutex_free(tsmm_mutex);
- tsmm_mutex = NULL;
- TSRM_ERROR(TSRM_ERROR_LEVEL_CORE, "Shutdown TSRM");
- if (tsrm_error_file!=stderr) {
- fclose(tsrm_error_file);
- }
-#if defined(GNUPTH)
- pth_kill();
-#elif defined(PTHREADS)
- pthread_key_delete( tls_key );
-#endif
-}
-
-
-/* allocates a new thread-safe-resource id */
-TSRM_API ts_rsrc_id ts_allocate_id(size_t size, ts_allocate_ctor ctor, ts_allocate_dtor dtor)
-{
- ts_rsrc_id new_id;
- int i;
-
- TSRM_ERROR(TSRM_ERROR_LEVEL_CORE, "Obtaining a new resource id, %d bytes", size);
-
- tsrm_mutex_lock(tsmm_mutex);
-
- /* obtain a resource id */
- new_id = id_count++;
- TSRM_ERROR(TSRM_ERROR_LEVEL_CORE, "Obtained resource id %d", TSRM_SHUFFLE_RSRC_ID(new_id));
-
- /* store the new resource type in the resource sizes table */
- if (resource_types_table_size < id_count) {
- resource_types_table = (tsrm_resource_type *) realloc(resource_types_table, sizeof(tsrm_resource_type)*id_count);
- if (!resource_types_table) {
- tsrm_mutex_unlock(tsmm_mutex);
- TSRM_ERROR(TSRM_ERROR_LEVEL_ERROR, "Unable to allocate storage for resource");
- return 0;
- }
- resource_types_table_size = id_count;
- }
- resource_types_table[new_id].size = size;
- resource_types_table[new_id].ctor = ctor;
- resource_types_table[new_id].dtor = dtor;
-
- /* enlarge the arrays for the already active threads */
- for (i=0; i<tsrm_tls_table_size; i++) {
- tsrm_tls_entry *p = tsrm_tls_table[i];
-
- while (p) {
- if (p->count < id_count) {
- int j;
-
- p->storage = (void *) realloc(p->storage, sizeof(void *)*id_count);
- for (j=p->count; j<id_count; j++) {
- p->storage[j] = (void *) malloc(resource_types_table[j].size);
- if (resource_types_table[j].ctor) {
- resource_types_table[j].ctor(p->storage[j]);
- }
- }
- p->count = id_count;
- }
- p = p->next;
- }
- }
- tsrm_mutex_unlock(tsmm_mutex);
-
- TSRM_ERROR(TSRM_ERROR_LEVEL_CORE, "Successfully allocated new resource id %d", TSRM_SHUFFLE_RSRC_ID(new_id));
- return TSRM_SHUFFLE_RSRC_ID(new_id);
-}
-
-
-static void allocate_new_resource(tsrm_tls_entry **thread_resources_ptr, THREAD_T thread_id)
-{
- int i;
-
- TSRM_ERROR(TSRM_ERROR_LEVEL_CORE, "Creating data structures for thread %x", thread_id);
- (*thread_resources_ptr) = (tsrm_tls_entry *) malloc(sizeof(tsrm_tls_entry));
- (*thread_resources_ptr)->storage = (void **) malloc(sizeof(void *)*id_count);
- (*thread_resources_ptr)->count = id_count;
- (*thread_resources_ptr)->thread_id = thread_id;
- (*thread_resources_ptr)->next = NULL;
-
-#if defined(PTHREADS)
- /* Set thread local storage to this new thread resources structure */
- pthread_setspecific( tls_key, (void *)*thread_resources_ptr );
-#elif defined(TSRM_ST)
- st_thread_setspecific(tls_key, (void *) *thread_resources_ptr);
-#endif
-
- if (tsrm_new_thread_begin_handler) {
- tsrm_new_thread_begin_handler(thread_id);
- }
- for (i=0; i<id_count; i++) {
- (*thread_resources_ptr)->storage[i] = (void *) malloc(resource_types_table[i].size);
- if (resource_types_table[i].ctor) {
- resource_types_table[i].ctor((*thread_resources_ptr)->storage[i]);
- }
- }
-
- tsrm_mutex_unlock(tsmm_mutex);
-
- if (tsrm_new_thread_end_handler) {
- tsrm_new_thread_end_handler(thread_id);
- }
-}
-
-
-/* fetches the requested resource for the current thread */
-TSRM_API void *ts_resource_ex(ts_rsrc_id id, THREAD_T *th_id)
-{
- THREAD_T thread_id;
- int hash_value;
- tsrm_tls_entry *thread_resources;
-
- if (!th_id) {
-#if defined(PTHREADS)
- /* Fast path for looking up the resources for the current
- * thread. Its used by just about every call to
- * ts_resource_ex(). This avoids the need for a mutex lock
- * and our hashtable lookup.
- */
- thread_resources = pthread_getspecific( tls_key );
-#elif defined(TSRM_ST)
- thread_resources = st_thread_getspecific(tls_key);
-#else
- thread_resources = NULL;
-#endif
- if (thread_resources) {
- TSRM_ERROR(TSRM_ERROR_LEVEL_INFO, "Fetching resource id %d for current thread %d", id, (long) thread_resources->thread_id );
- return ts_resource_read( thread_resources, id );
- }
- thread_id = tsrm_thread_id();
- } else {
- thread_id = *th_id;
- }
-
- TSRM_ERROR(TSRM_ERROR_LEVEL_INFO, "Fetching resource id %d for thread %ld", id, (long) thread_id);
- tsrm_mutex_lock(tsmm_mutex);
-
- hash_value = THREAD_HASH_OF(thread_id, tsrm_tls_table_size);
- thread_resources = tsrm_tls_table[hash_value];
-
- if (!thread_resources) {
- allocate_new_resource(&tsrm_tls_table[hash_value], thread_id);
- return ts_resource_ex(id, &thread_id);
- } else {
- do {
- if (thread_resources->thread_id == thread_id) {
- break;
- }
- if (thread_resources->next) {
- thread_resources = thread_resources->next;
- } else {
- allocate_new_resource(&thread_resources->next, thread_id);
- return ts_resource_ex(id, &thread_id);
- /*
- * thread_resources = thread_resources->next;
- * break;
- */
- }
- } while (thread_resources);
- }
- tsrm_mutex_unlock(tsmm_mutex);
- return ts_resource_read( thread_resources, id );
-}
-
-
-/* Read a specific resource from the thread's resources.
- * This is called outside of a mutex, so have to be aware about external
- * changes to the structure as we read it.
- */
-void *ts_resource_read( tsrm_tls_entry *thread_resources, ts_rsrc_id id )
-{
- void *resource;
-
- resource = TSRM_SAFE_ARRAY_OFFSET(thread_resources->storage, TSRM_UNSHUFFLE_RSRC_ID(id), thread_resources->count);
- if (resource) {
- TSRM_ERROR(TSRM_ERROR_LEVEL_INFO, "Successfully fetched resource id %d for thread id %ld - %x", id, (long) thread_resources->thread_id, (long) resource);
- } else {
- TSRM_ERROR(TSRM_ERROR_LEVEL_ERROR, "Resource id %d is out of range (%d..%d)", id, TSRM_SHUFFLE_RSRC_ID(0), TSRM_SHUFFLE_RSRC_ID(thread_resources->count-1));
- abort();
- }
- return resource;
-}
-
-
-/* frees all resources allocated for the current thread */
-void ts_free_thread(void)
-{
- tsrm_tls_entry *thread_resources;
- int i;
- THREAD_T thread_id = tsrm_thread_id();
- int hash_value;
- tsrm_tls_entry *last=NULL;
-
- tsrm_mutex_lock(tsmm_mutex);
- hash_value = THREAD_HASH_OF(thread_id, tsrm_tls_table_size);
- thread_resources = tsrm_tls_table[hash_value];
-
- while (thread_resources) {
- if (thread_resources->thread_id == thread_id) {
- for (i=0; i<thread_resources->count; i++) {
- if (resource_types_table[i].dtor) {
- resource_types_table[i].dtor(thread_resources->storage[i]);
- }
- }
- for (i=0; i<thread_resources->count; i++) {
- free(thread_resources->storage[i]);
- }
- free(thread_resources->storage);
- if (last) {
- last->next = thread_resources->next;
- } else {
- tsrm_tls_table[hash_value] = thread_resources->next;
- }
-#if defined(PTHREADS)
- pthread_setspecific(tls_key, 0);
-#endif
- free(thread_resources);
- break;
- }
- if (thread_resources->next) {
- last = thread_resources;
- }
- thread_resources = thread_resources->next;
- }
- tsrm_mutex_unlock(tsmm_mutex);
-}
-
-
-/* deallocates all occurrences of a given id */
-void ts_free_id(ts_rsrc_id id)
-{
-}
-
-
-
-
-/*
- * Utility Functions
- */
-
-/* Obtain the current thread id */
-TSRM_API THREAD_T tsrm_thread_id(void)
-{
-#ifdef TSRM_WIN32
- return GetCurrentThreadId();
-#elif defined(GNUPTH)
- return pth_self();
-#elif defined(PTHREADS)
- return pthread_self();
-#elif defined(NSAPI)
- return systhread_current();
-#elif defined(PI3WEB)
- return PIThread_getCurrent();
-#elif defined(TSRM_ST)
- return st_thread_self();
-#endif
-}
-
-
-/* Allocate a mutex */
-TSRM_API MUTEX_T tsrm_mutex_alloc(void)
-{
- MUTEX_T mutexp;
-
-#ifdef TSRM_WIN32
- mutexp = malloc(sizeof(CRITICAL_SECTION));
- InitializeCriticalSection(mutexp);
-#elif defined(GNUPTH)
- mutexp = (MUTEX_T) malloc(sizeof(*mutexp));
- pth_mutex_init(mutexp);
-#elif defined(PTHREADS)
- mutexp = (pthread_mutex_t *)malloc(sizeof(pthread_mutex_t));
- pthread_mutex_init(mutexp,NULL);
-#elif defined(NSAPI)
- mutexp = crit_init();
-#elif defined(PI3WEB)
- mutexp = PIPlatform_allocLocalMutex();
-#elif defined(TSRM_ST)
- mutexp = st_mutex_new();
-#endif
-#ifdef THR_DEBUG
- printf("Mutex created thread: %d\n",mythreadid());
-#endif
- return( mutexp );
-}
-
-
-/* Free a mutex */
-TSRM_API void tsrm_mutex_free(MUTEX_T mutexp)
-{
- if (mutexp) {
-#ifdef TSRM_WIN32
- DeleteCriticalSection(mutexp);
-#elif defined(GNUPTH)
- free(mutexp);
-#elif defined(PTHREADS)
- pthread_mutex_destroy(mutexp);
- free(mutexp);
-#elif defined(NSAPI)
- crit_terminate(mutexp);
-#elif defined(PI3WEB)
- PISync_delete(mutexp);
-#elif defined(TSRM_ST)
- st_mutex_destroy(mutexp);
-#endif
- }
-#ifdef THR_DEBUG
- printf("Mutex freed thread: %d\n",mythreadid());
-#endif
-}
-
-
-/* Lock a mutex */
-TSRM_API int tsrm_mutex_lock(MUTEX_T mutexp)
-{
- TSRM_ERROR(TSRM_ERROR_LEVEL_INFO, "Mutex locked thread: %ld", tsrm_thread_id());
-#ifdef TSRM_WIN32
- EnterCriticalSection(mutexp);
- return 1;
-#elif defined(GNUPTH)
- return pth_mutex_acquire(mutexp, 0, NULL);
-#elif defined(PTHREADS)
- return pthread_mutex_lock(mutexp);
-#elif defined(NSAPI)
- return crit_enter(mutexp);
-#elif defined(PI3WEB)
- return PISync_lock(mutexp);
-#elif defined(TSRM_ST)
- return st_mutex_lock(mutexp);
-#endif
-}
-
-
-/* Unlock a mutex */
-TSRM_API int tsrm_mutex_unlock(MUTEX_T mutexp)
-{
- TSRM_ERROR(TSRM_ERROR_LEVEL_INFO, "Mutex unlocked thread: %ld", tsrm_thread_id());
-#ifdef TSRM_WIN32
- LeaveCriticalSection(mutexp);
- return 1;
-#elif defined(GNUPTH)
- return pth_mutex_release(mutexp);
-#elif defined(PTHREADS)
- return pthread_mutex_unlock(mutexp);
-#elif defined(NSAPI)
- return crit_exit(mutexp);
-#elif defined(PI3WEB)
- return PISync_unlock(mutexp);
-#elif defined(TSRM_ST)
- return st_mutex_unlock(mutexp);
-#endif
-}
-
-
-TSRM_API void *tsrm_set_new_thread_begin_handler(void (*new_thread_begin_handler)(THREAD_T thread_id))
-{
- void *retval = (void *) tsrm_new_thread_begin_handler;
-
- tsrm_new_thread_begin_handler = new_thread_begin_handler;
- return retval;
-}
-
-
-TSRM_API void *tsrm_set_new_thread_end_handler(void (*new_thread_end_handler)(THREAD_T thread_id))
-{
- void *retval = (void *) tsrm_new_thread_end_handler;
-
- tsrm_new_thread_end_handler = new_thread_end_handler;
- return retval;
-}
-
-
-
-/*
- * Debug support
- */
-
-#if TSRM_DEBUG
-int tsrm_error(int level, const char *format, ...)
-{
- if (level<=tsrm_error_level) {
- va_list args;
- int size;
-
- fprintf(tsrm_error_file, "TSRM: ");
- va_start(args, format);
- size = vfprintf(tsrm_error_file, format, args);
- va_end(args);
- fprintf(tsrm_error_file, "\n");
- fflush(tsrm_error_file);
- return size;
- } else {
- return 0;
- }
-}
-#endif
-
-
-void tsrm_error_set(int level, char *debug_filename)
-{
- tsrm_error_level = level;
-
-#if TSRM_DEBUG
- if (tsrm_error_file!=stderr) { /* close files opened earlier */
- fclose(tsrm_error_file);
- }
-
- if (debug_filename) {
- tsrm_error_file = fopen(debug_filename, "w");
- if (!tsrm_error_file) {
- tsrm_error_file = stderr;
- }
- } else {
- tsrm_error_file = stderr;
- }
-#endif
-}
-
-#endif /* ZTS */
diff --git a/TSRM/TSRM.dsp b/TSRM/TSRM.dsp
deleted file mode 100644
index 1a5693f5a2..0000000000
--- a/TSRM/TSRM.dsp
+++ /dev/null
@@ -1,186 +0,0 @@
-# Microsoft Developer Studio Project File - Name="TSRM" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Static Library" 0x0104
-
-CFG=TSRM - Win32 Debug_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "TSRM.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "TSRM.mak" CFG="TSRM - Win32 Debug_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "TSRM - Win32 Debug_TS" (based on "Win32 (x86) Static Library")
-!MESSAGE "TSRM - Win32 Release_TS" (based on "Win32 (x86) Static Library")
-!MESSAGE "TSRM - Win32 Release_TS_inline" (based on "Win32 (x86) Static Library")
-!MESSAGE "TSRM - Win32 Release_TSDbg" (based on "Win32 (x86) Static Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "TSRM - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "TSRM___Win32_Debug_TS"
-# PROP BASE Intermediate_Dir "TSRM___Win32_Debug_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /I "C:\Projects\TSRM" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "." /D "_DEBUG" /D "ZTS" /D "_LIB" /D "TSRM_EXPORTS" /D "WIN32" /D "_MBCS" /D TSRM_DEBUG=1 /YX /FD /GZ /c
-# ADD BASE RSC /l 0x40d /d "_DEBUG"
-# ADD RSC /l 0x40d /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LIB32=link.exe -lib
-# ADD BASE LIB32 /nologo
-# ADD LIB32 /nologo
-
-!ELSEIF "$(CFG)" == "TSRM - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "TSRM___Win32_Release_TS"
-# PROP BASE Intermediate_Dir "TSRM___Win32_Release_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /D "NDEBUG" /D "ZTS" /D "_LIB" /D "TSRM_EXPORTS" /D "WIN32" /D "_MBCS" /D TSRM_DEBUG=0 /YX /FD /c
-# ADD BASE RSC /l 0x40d /d "NDEBUG"
-# ADD RSC /l 0x40d /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LIB32=link.exe -lib
-# ADD BASE LIB32 /nologo
-# ADD LIB32 /nologo
-
-!ELSEIF "$(CFG)" == "TSRM - Win32 Release_TS_inline"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "TSRM___Win32_Release_TS_inline"
-# PROP BASE Intermediate_Dir "TSRM___Win32_Release_TS_inline"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS_inline"
-# PROP Intermediate_Dir "Release_TS_inline"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "." /D "NDEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /D "TSRM_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /D "NDEBUG" /D "ZTS" /D "_LIB" /D "TSRM_EXPORTS" /D "WIN32" /D "_MBCS" /D TSRM_DEBUG=0 /YX /FD /c
-# ADD BASE RSC /l 0x40d /d "NDEBUG"
-# ADD RSC /l 0x40d /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LIB32=link.exe -lib
-# ADD BASE LIB32 /nologo
-# ADD LIB32 /nologo
-
-!ELSEIF "$(CFG)" == "TSRM - Win32 Release_TSDbg"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "TSRM___Win32_Release_TSDbg"
-# PROP BASE Intermediate_Dir "TSRM___Win32_Release_TSDbg"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TSDbg"
-# PROP Intermediate_Dir "Release_TSDbg"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "." /D "NDEBUG" /D "ZTS" /D "_LIB" /D "TSRM_EXPORTS" /D "WIN32" /D "_MBCS" /D TSRM_DEBUG=0 /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /Zi /Od /I "." /D "NDEBUG" /D "ZTS" /D "_LIB" /D "TSRM_EXPORTS" /D "WIN32" /D "_MBCS" /D TSRM_DEBUG=0 /YX /FD /c
-# ADD BASE RSC /l 0x40d /d "NDEBUG"
-# ADD RSC /l 0x40d /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LIB32=link.exe -lib
-# ADD BASE LIB32 /nologo
-# ADD LIB32 /nologo
-
-!ENDIF
-
-# Begin Target
-
-# Name "TSRM - Win32 Debug_TS"
-# Name "TSRM - Win32 Release_TS"
-# Name "TSRM - Win32 Release_TS_inline"
-# Name "TSRM - Win32 Release_TSDbg"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\TSRM.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\tsrm_strtok_r.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\tsrm_virtual_cwd.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\tsrm_win32.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\readdir.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\TSRM.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\tsrm_config.w32.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\tsrm_config_common.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\tsrm_strtok_r.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\tsrm_virtual_cwd.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\tsrm_win32.h
-# End Source File
-# End Group
-# End Target
-# End Project
diff --git a/TSRM/TSRM.h b/TSRM/TSRM.h
deleted file mode 100644
index 00a61157ee..0000000000
--- a/TSRM/TSRM.h
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Thread Safe Resource Manager |
- +----------------------------------------------------------------------+
- | Copyright (c) 1999, 2000, Andi Gutmans, Sascha Schumann, Zeev Suraski|
- | This source file is subject to the TSRM license, that is bundled |
- | with this package in the file LICENSE |
- +----------------------------------------------------------------------+
- | Authors: Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-#ifndef TSRM_H
-#define TSRM_H
-
-#ifdef HAVE_CONFIG_H
-# include "tsrm_config.h"
-#endif
-
-/* Only compile multi-threading functions if we're in ZTS mode */
-#ifdef ZTS
-
-#ifdef WIN32
-# define TSRM_WIN32
-#endif
-
-#ifdef TSRM_WIN32
-# include <windows.h>
-#elif defined(GNUPTH)
-# include <pth.h>
-#elif defined(PTHREADS)
-# include <pthread.h>
-#elif defined(TSRM_ST)
-# include <st.h>
-#endif
-
-typedef int ts_rsrc_id;
-
-#ifdef TSRM_WIN32
-# ifdef TSRM_EXPORTS
-# define TSRM_API __declspec(dllexport)
-# else
-# define TSRM_API __declspec(dllimport)
-# endif
-#else
-# define TSRM_API
-#endif
-
-
-/* Define THREAD_T and MUTEX_T */
-#ifdef TSRM_WIN32
-# define THREAD_T DWORD
-# define MUTEX_T CRITICAL_SECTION *
-#elif defined(GNUPTH)
-# define THREAD_T pth_t
-# define MUTEX_T pth_mutex_t *
-#elif defined(PTHREADS)
-# define THREAD_T pthread_t
-# define MUTEX_T pthread_mutex_t *
-#elif defined(NSAPI)
-# define THREAD_T SYS_THREAD
-# define MUTEX_T CRITICAL
-#elif defined(PI3WEB)
-# define THREAD_T PIThread *
-# define MUTEX_T PISync *
-#elif defined(TSRM_ST)
-# define THREAD_T st_thread_t
-# define MUTEX_T st_mutex_t
-#endif
-
-typedef void (*ts_allocate_ctor)(void *);
-typedef void (*ts_allocate_dtor)(void *);
-
-#define THREAD_HASH_OF(thr,ts) (unsigned long)thr%(unsigned long)ts
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* startup/shutdown */
-TSRM_API int tsrm_startup(int expected_threads, int expected_resources, int debug_level, char *debug_filename);
-TSRM_API void tsrm_shutdown(void);
-
-/* allocates a new thread-safe-resource id */
-TSRM_API ts_rsrc_id ts_allocate_id(size_t size, ts_allocate_ctor ctor, ts_allocate_dtor dtor);
-
-/* fetches the requested resource for the current thread */
-TSRM_API void *ts_resource_ex(ts_rsrc_id id, THREAD_T *th_id);
-#define ts_resource(id) ts_resource_ex(id, NULL)
-
-/* frees all resources allocated for the current thread */
-TSRM_API void ts_free_thread(void);
-
-/* deallocates all occurrences of a given id */
-TSRM_API void ts_free_id(ts_rsrc_id id);
-
-
-/* Debug support */
-#define TSRM_ERROR_LEVEL_ERROR 1
-#define TSRM_ERROR_LEVEL_CORE 2
-#define TSRM_ERROR_LEVEL_INFO 3
-TSRM_API int tsrm_error(int level, const char *format, ...);
-TSRM_API void tsrm_error_set(int level, char *debug_filename);
-
-/* utility functions */
-TSRM_API THREAD_T tsrm_thread_id(void);
-TSRM_API MUTEX_T tsrm_mutex_alloc(void);
-TSRM_API void tsrm_mutex_free(MUTEX_T mutexp);
-TSRM_API int tsrm_mutex_lock(MUTEX_T mutexp);
-TSRM_API int tsrm_mutex_unlock(MUTEX_T mutexp);
-
-TSRM_API void *tsrm_set_new_thread_begin_handler(void (*new_thread_begin_handler)(THREAD_T thread_id));
-TSRM_API void *tsrm_set_new_thread_end_handler(void (*new_thread_end_handler)(THREAD_T thread_id));
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* ZTS */
-
-#endif /* TSRM_H */
diff --git a/TSRM/acconfig.h b/TSRM/acconfig.h
deleted file mode 100644
index 2b94cf35e7..0000000000
--- a/TSRM/acconfig.h
+++ /dev/null
@@ -1 +0,0 @@
-#undef PTHREADS
diff --git a/TSRM/acinclude.m4 b/TSRM/acinclude.m4
deleted file mode 100644
index 1953172aef..0000000000
--- a/TSRM/acinclude.m4
+++ /dev/null
@@ -1,5 +0,0 @@
-
-AC_DEFUN(AM_SET_LIBTOOL_VARIABLE,[
- LIBTOOL='$(SHELL) $(top_builddir)/libtool $1'
-])
-
diff --git a/TSRM/build.mk b/TSRM/build.mk
deleted file mode 100644
index aac1a8b982..0000000000
--- a/TSRM/build.mk
+++ /dev/null
@@ -1,43 +0,0 @@
-# Makefile to generate build tools
-#
-# Standard usage:
-# make -f build.mk
-#
-# Written by Sascha Schumann
-#
-# $Id$
-
-
-LT_TARGETS = ltmain.sh ltconfig
-
-config_h_in = tsrm_config.h.in
-
-makefile_am_files = Makefile.am
-makefile_in_files = $(makefile_am_files:.am=.in)
-makefile_files = $(makefile_am_files:e.am=e)
-
-targets = $(makefile_in_files) $(LT_TARGETS) configure $(config_h_in)
-
-all: $(targets)
-
-clean:
- rm -f $(targets)
-
-$(LT_TARGETS):
- rm -f $(LT_TARGETS)
- libtoolize --automake $(AMFLAGS) -f
-
-$(makefile_in_files): $(makefile_am_files)
- automake -a -i $(AMFLAGS) $(makefile_files)
-
-aclocal.m4: configure.in acinclude.m4
- aclocal
-
-$(config_h_in): configure.in acconfig.h
-# explicitly remove target since autoheader does not seem to work
-# correctly otherwise (timestamps are not updated)
- @rm -f $@
- autoheader
-
-configure: aclocal.m4 configure.in
- autoconf
diff --git a/TSRM/buildconf b/TSRM/buildconf
deleted file mode 100755
index fe8dee6f76..0000000000
--- a/TSRM/buildconf
+++ /dev/null
@@ -1,33 +0,0 @@
-#!/bin/sh
-
-case "$1" in
---copy)
- automake_flags=--copy
- shift
-;;
-esac
-
-libtoolize --force --automake $automake_flags
-
-mv aclocal.m4 aclocal.m4.old 2>/dev/null
-aclocal
-if cmp aclocal.m4.old aclocal.m4 > /dev/null 2>&1; then
- echo "buildconf: keeping ${1}aclocal.m4"
- mv aclocal.m4.old aclocal.m4
-else
- echo "buildconf: created or modified ${1}aclocal.m4"
-fi
-
-autoheader
-
-automake --add-missing --include-deps $automake_flags
-
-mv configure configure.old 2>/dev/null
-autoconf
-if cmp configure.old configure > /dev/null 2>&1; then
- echo "buildconf: keeping ${1}configure"
- mv configure.old configure
-else
- echo "buildconf: created or modified ${1}configure"
-fi
-
diff --git a/TSRM/configure.in b/TSRM/configure.in
deleted file mode 100644
index 3034268db8..0000000000
--- a/TSRM/configure.in
+++ /dev/null
@@ -1,33 +0,0 @@
-dnl $Id$
-dnl
-dnl Minimalistic configure.in for TSRM.
-dnl
-
-AC_INIT(TSRM.c)
-AM_INIT_AUTOMAKE(TSRM, 1.0, nodefine)
-AM_CONFIG_HEADER(tsrm_config.h)
-
-sinclude(tsrm.m4)
-
-TSRM_BASIC_CHECKS
-TSRM_THREADS_CHECKS
-
-AM_PROG_LIBTOOL
-if test "$enable_debug" != "yes"; then
- AM_SET_LIBTOOL_VARIABLE([--silent])
-fi
-
-dnl TSRM_PTHREAD
-
-AC_CHECK_HEADERS(
-utime.h \
-dirent.h \
-stdarg.h \
-alloca.h \
-unistd.h \
-limits.h
-)
-
-AC_DEFINE(ZTS,1,[ ])
-
-AC_OUTPUT(Makefile)
diff --git a/TSRM/readdir.h b/TSRM/readdir.h
deleted file mode 100644
index b0f1ad9e6f..0000000000
--- a/TSRM/readdir.h
+++ /dev/null
@@ -1,44 +0,0 @@
-#ifndef READDIR_H
-#define READDIR_H
-
-
-/*
- * Structures and types used to implement opendir/readdir/closedir
- * on Windows 95/NT.
- */
-
-#include <io.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/types.h>
-
-
-/* struct dirent - same as Unix */
-
-struct dirent {
- long d_ino; /* inode (always 1 in WIN32) */
- off_t d_off; /* offset to this dirent */
- unsigned short d_reclen; /* length of d_name */
- char d_name[_MAX_FNAME + 1]; /* filename (null terminated) */
-};
-
-
-/* typedef DIR - not the same as Unix */
-typedef struct {
- long handle; /* _findfirst/_findnext handle */
- short offset; /* offset into directory */
- short finished; /* 1 if there are not more files */
- struct _finddata_t fileinfo; /* from _findfirst/_findnext */
- char *dir; /* the dir we are reading */
- struct dirent dent; /* the dirent to return */
-} DIR;
-
-/* Function prototypes */
-DIR *opendir(const char *);
-struct dirent *readdir(DIR *);
-int readdir_r(DIR *, struct dirent *, struct dirent **);
-int closedir(DIR *);
-void rewinddir(DIR *);
-
-
-#endif /* READDIR_H */
diff --git a/TSRM/threads.m4 b/TSRM/threads.m4
deleted file mode 100644
index 812b38e1ea..0000000000
--- a/TSRM/threads.m4
+++ /dev/null
@@ -1,157 +0,0 @@
-dnl Copyright (c) 1999, 2000 Sascha Schumann. All rights reserved.
-dnl
-dnl Redistribution and use in source and binary forms, with or without
-dnl modification, are permitted provided that the following conditions
-dnl are met:
-dnl
-dnl 1. Redistributions of source code must retain the above copyright
-dnl notice, this list of conditions and the following disclaimer.
-dnl
-dnl 2. Redistributions in binary form must reproduce the above copyright
-dnl notice, this list of conditions and the following disclaimer in
-dnl the documentation and/or other materials provided with the
-dnl distribution.
-dnl
-dnl THIS SOFTWARE IS PROVIDED BY SASCHA SCHUMANN ``AS IS'' AND ANY
-dnl EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-dnl IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-dnl PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SASCHA SCHUMANN OR
-dnl HIS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-dnl SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-dnl NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-dnl LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-dnl HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
-dnl STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-dnl ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
-dnl OF THE POSSIBILITY OF SUCH DAMAGE.
-
-dnl
-dnl PTHREADS_FLAGS
-dnl
-dnl Set some magic defines to achieve POSIX threads conformance
-dnl
-AC_DEFUN(PTHREADS_FLAGS,[
- if test -z "$host_alias"; then
- AC_MSG_ERROR(host_alias is not set. Make sure to run config.guess)
- fi
- case "$host_alias" in
- *solaris*)
- PTHREAD_FLAGS="-D_POSIX_PTHREAD_SEMANTICS -D_REENTRANT";;
- *freebsd*)
- PTHREAD_FLAGS="-D_REENTRANT -D_THREAD_SAFE";;
- *linux*)
- PTHREAD_FLAGS="-D_REENTRANT";;
- *aix*)
- PTHREAD_FLAGS="-D_THREAD_SAFE";;
- *irix*)
- PTHREAD_FLAGS="-D_POSIX_THREAD_SAFE_FUNCTIONS";;
- *hpux*)
- PTHREAD_FLAGS="-D_REENTRANT";;
- *sco*)
- PTHREAD_FLAGS="-D_REENTRANT";;
-dnl Solves sigwait() problem, creates problems with u_long etc.
-dnl PTHREAD_FLAGS="-D_REENTRANT -D_XOPEN_SOURCE=500 -D_POSIX_C_SOURCE=199506 -D_XOPEN_SOURCE_EXTENDED=1";;
- esac
-
- if test -n "$PTHREAD_FLAGS"; then
- CPPFLAGS="$CPPFLAGS $PTHREAD_FLAGS"
- fi
-])dnl
-dnl
-dnl PTHREADS_CHECK_COMPILE
-dnl
-dnl Check whether the current setup can use POSIX threads calls
-dnl
-AC_DEFUN(PTHREADS_CHECK_COMPILE, [
-AC_TRY_RUN( [
-#include <pthread.h>
-#include <stddef.h>
-
-void *thread_routine(void *data) {
- return data;
-}
-
-int main() {
- pthread_t thd;
- pthread_mutexattr_t mattr;
- int data = 1;
- pthread_mutexattr_init(&mattr);
- return pthread_create(&thd, NULL, thread_routine, &data);
-} ], [
- pthreads_working="yes"
- ], [
- pthreads_working="no"
- ], pthreads_working="no" ) ] )dnl
-dnl
-dnl PTHREADS_CHECK()
-dnl
-dnl Try to find a way to enable POSIX threads
-dnl
-dnl Magic flags
-dnl -kthread gcc (FreeBSD)
-dnl -Kthread UDK cc (UnixWare)
-dnl -mt WorkShop cc (Solaris)
-dnl -mthreads gcc (AIX)
-dnl -pthread gcc (Linux, FreeBSD, NetBSD, OpenBSD)
-dnl -pthreads gcc (Solaris)
-dnl -qthreaded AIX cc V5
-dnl -threads gcc (HP-UX)
-dnl
-AC_DEFUN(PTHREADS_CHECK,[
-
-save_CFLAGS="$CFLAGS"
-save_LIBS="$LIBS"
-PTHREADS_ASSIGN_VARS
-PTHREADS_CHECK_COMPILE
-LIBS="$save_LIBS"
-CFLAGS="$save_CFLAGS"
-
-AC_CACHE_CHECK(for pthreads_cflags,ac_cv_pthreads_cflags,[
-ac_cv_pthreads_cflags=""
-if test "$pthreads_working" != "yes"; then
- for flag in -kthread -pthread -pthreads -mthreads -Kthread -threads -mt -qthreaded; do
- ac_save="$CFLAGS"
- CFLAGS="$CFLAGS $flag"
- PTHREADS_CHECK_COMPILE
- CFLAGS="$ac_save"
- if test "$pthreads_working" = "yes"; then
- ac_cv_pthreads_cflags="$flag"
- break
- fi
- done
-fi
-])
-
-AC_CACHE_CHECK(for pthreads_lib, ac_cv_pthreads_lib,[
-ac_cv_pthreads_lib=""
-if test "$pthreads_working" != "yes"; then
- for lib in pthread pthreads c_r; do
- ac_save="$LIBS"
- LIBS="$LIBS -l$lib"
- PTHREADS_CHECK_COMPILE
- LIBS="$ac_save"
- if test "$pthreads_working" = "yes"; then
- ac_cv_pthreads_lib="$lib"
- break
- fi
- done
-fi
-])
-
-if test "$pthreads_working" = "yes"; then
- threads_result="POSIX Threads found"
-else
- threads_result="POSIX Threads not found"
-fi
-])dnl
-dnl
-dnl
-AC_DEFUN(PTHREADS_ASSIGN_VARS,[
-if test -n "$ac_cv_pthreads_lib"; then
- LIBS="$LIBS -l$ac_cv_pthreads_lib"
-fi
-
-if test -n "$ac_cv_pthreads_cflags"; then
- CFLAGS="$CFLAGS $ac_cv_pthreads_cflags"
-fi
-])dnl
diff --git a/TSRM/tsrm.m4 b/TSRM/tsrm.m4
deleted file mode 100644
index 16a0baf37b..0000000000
--- a/TSRM/tsrm.m4
+++ /dev/null
@@ -1,124 +0,0 @@
-
-dnl TSRM_CHECK_GCC_ARG(ARG, ACTION-IF-FOUND, ACTION-IF-NOT_FOUND)
-AC_DEFUN(TSRM_CHECK_GCC_ARG,[
- gcc_arg_name=[ac_cv_gcc_arg]translit($1,A-Z-,a-z_)
- AC_CACHE_CHECK([whether $CC supports $1], [ac_cv_gcc_arg]translit($1,A-Z-,a-z_), [
- echo 'void somefunc() { };' > conftest.c
- cmd='$CC $1 -c conftest.c'
- if eval $cmd 2>&1 | egrep -e $1 >/dev/null ; then
- ac_result=no
- else
- ac_result=yes
- fi
- eval $gcc_arg_name=$ac_result
- rm -f conftest.*
- ])
- if eval test "\$$gcc_arg_name" = "yes"; then
- $2
- else
- :
- $3
- fi
-])
-
-AC_DEFUN(TSRM_BASIC_CHECKS,[
-
-AC_REQUIRE([AC_PROG_CC])dnl
-dnl AC_REQUIRE([AM_PROG_CC_STDC])dnl
-AC_REQUIRE([AC_PROG_CC_C_O])dnl
-AC_REQUIRE([AC_PROG_RANLIB])dnl
-
-AC_CHECK_HEADERS(stdarg.h)
-
-])
-
-
-AC_DEFUN(TSRM_CHECK_PTH,[
-
-AC_MSG_CHECKING(for GNU Pth)
-PTH_PREFIX="`$1 --prefix`"
-if test -z "$PTH_PREFIX"; then
- AC_MSG_RESULT(Please check your Pth installation)
-fi
-
-CPPFLAGS="$CPPFLAGS `$1 --cflags`"
-LDFLAGS="$LDFLAGS `$1 --ldflags`"
-LIBS="$LIBS `$1 --libs`"
-
-AC_DEFINE(GNUPTH, 1, [Whether you use GNU Pth])
-AC_MSG_RESULT(yes - installed in $PTH_PREFIX)
-
-])
-
-AC_DEFUN(TSRM_CHECK_ST,[
- if test -r "$1/include/st.h"; then
- CPPFLAGS="$CPPFLAGS -I$1/include"
- LDFLAGS="$LDFLAGS -L$1/lib"
- elif test -r "$1/st.h"; then
- CPPFLAGS="$CPPFLAGS -I$1"
- LDFLAGS="$LDFLAGS -L$1"
- fi
- AC_CHECK_HEADERS(st.h,[ ],[
- AC_MSG_ERROR([Sorry[,] I was unable to locate the State Threads header file. Please specify the prefix using --with-tsrm-st=/prefix])
- ])
- LIBS="$LIBS -lst"
- AC_MSG_CHECKING(for SGI's State Threads)
- AC_MSG_RESULT(yes)
- AC_DEFINE(TSRM_ST, 1, [ ])
-])
-
-sinclude(threads.m4)
-sinclude(TSRM/threads.m4)
-
-AC_DEFUN(TSRM_CHECK_PTHREADS,[
-
-PTHREADS_CHECK
-
-if test "$pthreads_working" != "yes"; then
- AC_MSG_ERROR(Your system seems to lack POSIX threads.)
-fi
-
-AC_DEFINE(PTHREADS, 1, Whether to use Pthreads)
-
-AC_MSG_CHECKING(for POSIX threads)
-AC_MSG_RESULT(yes)
-])
-
-
-AC_DEFUN(TSRM_THREADS_CHECKS,[
-
-dnl For the thread implementations, we always use --with-*
-dnl to maintain consistency
-
-AC_ARG_WITH(tsrm-pth,
-[ --with-tsrm-pth[=pth-config] Use GNU Pth.],[
- TSRM_PTH=$withval
-],[
- TSRM_PTH=no
-])
-
-AC_ARG_WITH(tsrm-st,
-[ --with-tsrm-st],[
- TSRM_ST=$withval
-],[
- TSRM_ST=no
-])
-
-AC_ARG_WITH(tsrm-pthreads,
-[ --with-tsrm-pthreads Use POSIX threads (default)],[
- TSRM_PTHREADS=$withval
-],[
- TSRM_PTHREADS=yes
-])
-
-test "$TSRM_PTH" = "yes" && TSRM_PTH=pth-config
-
-if test "$TSRM_PTH" != "no"; then
- TSRM_CHECK_PTH($TSRM_PTH)
-elif test "$TSRM_ST" != "no"; then
- TSRM_CHECK_ST($TSRM_ST)
-elif test "$TSRM_PTHREADS" != "no"; then
- TSRM_CHECK_PTHREADS
-fi
-
-])
diff --git a/TSRM/tsrm_config.w32.h b/TSRM/tsrm_config.w32.h
deleted file mode 100644
index 405d8c7c8f..0000000000
--- a/TSRM/tsrm_config.w32.h
+++ /dev/null
@@ -1,15 +0,0 @@
-#ifndef TSRM_CONFIG_W32_H
-#define TSRM_CONFIG_W32_H
-
-#define HAVE_UTIME 1
-#define HAVE_ALLOCA 1
-
-#undef inline
-#ifdef ZEND_WIN32_FORCE_INLINE
-# define inline __forceinline
-#else
-# define inline
-#endif
-
-
-#endif
diff --git a/TSRM/tsrm_config_common.h b/TSRM/tsrm_config_common.h
deleted file mode 100644
index 8b80f80121..0000000000
--- a/TSRM/tsrm_config_common.h
+++ /dev/null
@@ -1,47 +0,0 @@
-#ifndef TSRM_CONFIG_COMMON_H
-#define TSRM_CONFIG_COMMON_H
-
-#if WINNT|WIN32
-# define TSRM_WIN32
-#endif
-
-#ifndef TSRM_WIN32
-# include "tsrm_config.h"
-# include <sys/param.h>
-#else
-# include "tsrm_config.w32.h"
-#endif
-
-#ifdef TSRM_WIN32
-#include <malloc.h>
-#endif
-
-#if HAVE_ALLOCA_H
-#include <alloca.h>
-#endif
-
-#if HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-
-#if HAVE_LIMITS_H
-#include <limits.h>
-#endif
-
-#ifndef MAXPATHLEN
-# ifdef PATH_MAX
-# define MAXPATHLEN PATH_MAX
-# else
-# define MAXPATHLEN 256
-# endif
-#endif
-
-#if (HAVE_ALLOCA || (defined (__GNUC__) && __GNUC__ >= 2))
-# define tsrm_do_alloca(p) alloca(p)
-# define tsrm_free_alloca(p)
-#else
-# define tsrm_do_alloca(p) malloc(p)
-# define tsrm_free_alloca(p) free(p)
-#endif
-
-#endif /* TSRM_CONFIG_COMMON_H */
diff --git a/TSRM/tsrm_strtok_r.c b/TSRM/tsrm_strtok_r.c
deleted file mode 100644
index e9ad26a7ac..0000000000
--- a/TSRM/tsrm_strtok_r.c
+++ /dev/null
@@ -1,63 +0,0 @@
-#include <stdio.h>
-
-#include "tsrm_config_common.h"
-#include "tsrm_strtok_r.h"
-
-static inline int in_character_class(char ch, const char *delim)
-{
- while (*delim) {
- if (*delim == ch) {
- return 1;
- }
- delim++;
- }
- return 0;
-}
-
-char *tsrm_strtok_r(char *s, const char *delim, char **last)
-{
- char *token;
-
- if (s == NULL) {
- s = *last;
- }
-
- while (*s && in_character_class(*s, delim)) {
- s++;
- }
- if (!*s) {
- return NULL;
- }
-
- token = s;
-
- while (*s && !in_character_class(*s, delim)) {
- s++;
- }
- if (!*s) {
- *last = s;
- } else {
- *s = '\0';
- *last = s + 1;
- }
- return token;
-}
-
-#if 0
-
-main()
-{
- char foo[] = "/foo/bar//\\barbara";
- char *last;
- char *token;
-
- token = tsrm_strtok_r(foo, "/\\", &last);
- while (token) {
- printf ("Token = '%s'\n", token);
- token = tsrm_strtok_r(NULL, "/\\", &last);
- }
-
- return 0;
-}
-
-#endif
diff --git a/TSRM/tsrm_strtok_r.h b/TSRM/tsrm_strtok_r.h
deleted file mode 100644
index 8c9e8198e7..0000000000
--- a/TSRM/tsrm_strtok_r.h
+++ /dev/null
@@ -1,6 +0,0 @@
-#ifndef TSRM_STRTOK_R
-#define TSRM_STRTOK_R
-
-char *tsrm_strtok_r(char *s, const char *delim, char **last);
-
-#endif
diff --git a/TSRM/tsrm_virtual_cwd.c b/TSRM/tsrm_virtual_cwd.c
deleted file mode 100644
index 3e8789f8af..0000000000
--- a/TSRM/tsrm_virtual_cwd.c
+++ /dev/null
@@ -1,795 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997, 1998, 1999, 2000 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Sascha Schumann <sascha@schumann.cx> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <string.h>
-#include <stdio.h>
-#include <limits.h>
-#include <errno.h>
-#include <stdlib.h>
-#include <fcntl.h>
-
-#include "tsrm_virtual_cwd.h"
-#include "tsrm_strtok_r.h"
-
-#ifdef TSRM_WIN32
-#include <io.h>
-#include "tsrm_win32.h"
-#endif
-
-#define VIRTUAL_CWD_DEBUG 0
-
-#ifdef ZTS
-#include "TSRM.h"
-#endif
-
-/* Only need mutex for popen() in Windows because it doesn't chdir() on UNIX */
-#if defined(TSRM_WIN32) && defined(ZTS)
-MUTEX_T cwd_mutex;
-#endif
-
-#ifdef ZTS
-static ts_rsrc_id cwd_globals_id;
-#else
-static virtual_cwd_globals cwd_globals;
-#endif
-
-cwd_state main_cwd_state; /* True global */
-
-#ifndef TSRM_WIN32
-#include <unistd.h>
-#else
-#include <direct.h>
-#endif
-
-#ifndef S_ISDIR
-#define S_ISDIR(mode) ((mode) & _S_IFDIR)
-#endif
-
-#ifndef S_ISREG
-#define S_ISREG(mode) ((mode) & _S_IFREG)
-#endif
-
-#ifdef TSRM_WIN32
-#define tsrm_strtok_r(a,b,c) strtok((a),(b))
-#define TOKENIZER_STRING "/\\"
-
-static int php_check_dots(const char *element, int n)
-{
- while (n-- > 0) if (element[n] != '.') break;
-
- return (n != -1);
-}
-
-#define IS_DIRECTORY_UP(element, len) \
- (len >= 2 && !php_check_dots(element, len))
-
-#define IS_DIRECTORY_CURRENT(element, len) \
- (len == 1 && ptr[0] == '.')
-
-
-#else
-#define TOKENIZER_STRING "/"
-#endif
-
-
-/* default macros */
-
-#ifndef IS_DIRECTORY_UP
-#define IS_DIRECTORY_UP(element, len) \
- (len == 2 && memcmp(element, "..", 2) == 0)
-#endif
-
-#ifndef IS_DIRECTORY_CURRENT
-#define IS_DIRECTORY_CURRENT(element, len) \
- (len == 1 && ptr[0] == '.')
-#endif
-
-/* define this to check semantics */
-#define IS_DIR_OK(s) (1)
-
-#ifndef IS_DIR_OK
-#define IS_DIR_OK(state) (php_is_dir_ok(state) == 0)
-#endif
-
-
-#define CWD_STATE_COPY(d, s) \
- (d)->cwd_length = (s)->cwd_length; \
- (d)->cwd = (char *) malloc((s)->cwd_length+1); \
- memcpy((d)->cwd, (s)->cwd, (s)->cwd_length+1);
-
-#define CWD_STATE_FREE(s) \
- free((s)->cwd);
-
-static int php_is_dir_ok(const cwd_state *state)
-{
- struct stat buf;
-
- if (stat(state->cwd, &buf) == 0 && S_ISDIR(buf.st_mode))
- return (0);
-
- return (1);
-}
-
-static int php_is_file_ok(const cwd_state *state)
-{
- struct stat buf;
-
- if (stat(state->cwd, &buf) == 0 && S_ISREG(buf.st_mode))
- return (0);
-
- return (1);
-}
-
-static void cwd_globals_ctor(virtual_cwd_globals *cwd_globals)
-{
- CWD_STATE_COPY(&cwd_globals->cwd, &main_cwd_state);
-}
-
-static void cwd_globals_dtor(virtual_cwd_globals *cwd_globals)
-{
- CWD_STATE_FREE(&cwd_globals->cwd);
-}
-
-static char *tsrm_strndup(const char *s, size_t length)
-{
- char *p;
-
- p = (char *) malloc(length+1);
- if (!p) {
- return (char *)NULL;
- }
- if (length) {
- memcpy(p,s,length);
- }
- p[length]=0;
- return p;
-}
-
-CWD_API void virtual_cwd_startup(void)
-{
- char cwd[MAXPATHLEN];
- char *result;
-
- result = getcwd(cwd, sizeof(cwd));
- if (!result) {
- cwd[0] = '\0';
- }
- main_cwd_state.cwd = strdup(cwd);
- main_cwd_state.cwd_length = strlen(cwd);
-
-#ifdef ZTS
- cwd_globals_id = ts_allocate_id(sizeof(virtual_cwd_globals), (ts_allocate_ctor) cwd_globals_ctor, (ts_allocate_dtor) cwd_globals_dtor);
-#else
- cwd_globals_ctor(&cwd_globals);
-#endif
-
-#if defined(TSRM_WIN32) && defined(ZTS)
- cwd_mutex = tsrm_mutex_alloc();
-#endif
-}
-
-CWD_API void virtual_cwd_shutdown(void)
-{
-#ifndef ZTS
- cwd_globals_dtor(&cwd_globals);
-#endif
-#if defined(TSRM_WIN32) && defined(ZTS)
- tsrm_mutex_free(cwd_mutex);
-#endif
-
- free(main_cwd_state.cwd); /* Don't use CWD_STATE_FREE because the non global states will probably use emalloc()/efree() */
-}
-
-CWD_API char *virtual_getcwd_ex(size_t *length)
-{
- cwd_state *state;
- CWDLS_FETCH();
-
- state = &CWDG(cwd);
-
- if (state->cwd_length == 0) {
- char *retval;
-
- *length = 1;
- retval = (char *) malloc(2);
- retval[0] = DEFAULT_SLASH;
- retval[1] = '\0';
- return retval;
- }
-
-#ifdef TSRM_WIN32
- /* If we have something like C: */
- if (state->cwd_length == 2 && state->cwd[state->cwd_length-1] == ':') {
- char *retval;
-
- *length = state->cwd_length+1;
- retval = (char *) malloc(*length+1);
- memcpy(retval, state->cwd, *length);
- retval[*length-1] = DEFAULT_SLASH;
- retval[*length] = '\0';
- return retval;
- }
-#endif
- *length = state->cwd_length;
- return strdup(state->cwd);
-}
-
-
-/* Same semantics as UNIX getcwd() */
-CWD_API char *virtual_getcwd(char *buf, size_t size)
-{
- size_t length;
- char *cwd;
-
- cwd = virtual_getcwd_ex(&length);
-
- if (buf == NULL) {
- return cwd;
- }
- if (length > size-1) {
- free(cwd);
- errno = ERANGE; /* Is this OK? */
- return NULL;
- }
- memcpy(buf, cwd, length+1);
- free(cwd);
- return buf;
-}
-
-/* Resolve path relatively to state and put the real path into state */
-/* returns 0 for ok, 1 for error */
-CWD_API int virtual_file_ex(cwd_state *state, const char *path, verify_path_func verify_path)
-{
- int path_length = strlen(path);
- char *ptr, *path_copy;
- char *tok = NULL;
- int ptr_length;
- cwd_state *old_state;
- int ret = 0;
- int copy_amount = -1;
- char *free_path;
- unsigned char is_absolute = 0;
-#ifndef TSRM_WIN32
- char resolved_path[MAXPATHLEN];
-#endif
-
- if (path_length == 0)
- return (0);
-
-#if !defined(TSRM_WIN32) && !defined(__BEOS__)
- if (IS_ABSOLUTE_PATH(path, path_length)) {
- if (realpath(path, resolved_path)) {
- path = resolved_path;
- path_length = strlen(path);
- }
- } else { /* Concat current directory with relative path and then run realpath() on it */
- char *tmp;
- char *ptr;
-
- ptr = tmp = (char *) malloc(state->cwd_length+path_length+sizeof("/"));
- if (!tmp) {
- return 1;
- }
- memcpy(ptr, state->cwd, state->cwd_length);
- ptr += state->cwd_length;
- *ptr++ = DEFAULT_SLASH;
- memcpy(ptr, path, path_length);
- ptr += path_length;
- *ptr = '\0';
- if (realpath(tmp, resolved_path)) {
- path = resolved_path;
- path_length = strlen(path);
- }
- free(tmp);
- }
-#endif
- free_path = path_copy = tsrm_strndup(path, path_length);
-
- old_state = (cwd_state *) malloc(sizeof(cwd_state));
- CWD_STATE_COPY(old_state, state);
-#if VIRTUAL_CWD_DEBUG
- fprintf(stderr,"cwd = %s path = %s\n", state->cwd, path);
-#endif
- if (IS_ABSOLUTE_PATH(path_copy, path_length)) {
- copy_amount = COPY_WHEN_ABSOLUTE;
- is_absolute = 1;
-#ifdef TSRM_WIN32
- } else if (IS_UNC_PATH(path_copy, path_length)) {
- copy_amount = 1;
- is_absolute = 1;
- } else if (IS_SLASH(path_copy[0])) {
- copy_amount = 2;
-#endif
- }
-
- if (copy_amount != -1) {
- state->cwd = (char *) realloc(state->cwd, copy_amount + 1);
- if (copy_amount) {
- if (is_absolute) {
- memcpy(state->cwd, path_copy, copy_amount);
- path_copy += copy_amount;
- } else {
- memcpy(state->cwd, old_state->cwd, copy_amount);
- }
- }
- state->cwd[copy_amount] = '\0';
- state->cwd_length = copy_amount;
- }
-
-
- ptr = tsrm_strtok_r(path_copy, TOKENIZER_STRING, &tok);
- while (ptr) {
- ptr_length = strlen(ptr);
-
- if (IS_DIRECTORY_UP(ptr, ptr_length)) {
- char save;
-
- save = DEFAULT_SLASH;
-
-#define PREVIOUS state->cwd[state->cwd_length - 1]
-
- while (IS_ABSOLUTE_PATH(state->cwd, state->cwd_length) &&
- !IS_SLASH(PREVIOUS)) {
- save = PREVIOUS;
- PREVIOUS = '\0';
- state->cwd_length--;
- }
-
- if (!IS_ABSOLUTE_PATH(state->cwd, state->cwd_length)) {
- state->cwd[state->cwd_length++] = save;
- state->cwd[state->cwd_length] = '\0';
- } else {
- PREVIOUS = '\0';
- state->cwd_length--;
- }
- } else if (!IS_DIRECTORY_CURRENT(ptr, ptr_length)) {
- state->cwd = (char *) realloc(state->cwd, state->cwd_length+ptr_length+1+1);
-#ifdef TSRM_WIN32
- /* Windows 9x will consider C:\\Foo as a network path. Avoid it. */
- if (state->cwd[state->cwd_length-1]!=DEFAULT_SLASH) {
- state->cwd[state->cwd_length++] = DEFAULT_SLASH;
- }
-#else
- state->cwd[state->cwd_length++] = DEFAULT_SLASH;
-#endif
- memcpy(&state->cwd[state->cwd_length], ptr, ptr_length+1);
- state->cwd_length += ptr_length;
- }
- ptr = tsrm_strtok_r(NULL, TOKENIZER_STRING, &tok);
- }
-
- if (state->cwd_length == COPY_WHEN_ABSOLUTE) {
- state->cwd = (char *) realloc(state->cwd, state->cwd_length+1+1);
- state->cwd[state->cwd_length] = DEFAULT_SLASH;
- state->cwd[state->cwd_length+1] = '\0';
- state->cwd_length++;
- }
-
- if (verify_path && verify_path(state)) {
- CWD_STATE_FREE(state);
-
- *state = *old_state;
-
- ret = 1;
- } else {
- CWD_STATE_FREE(old_state);
- ret = 0;
- }
-
- free(old_state);
-
- free(free_path);
-#if VIRTUAL_CWD_DEBUG
- fprintf (stderr, "virtual_file_ex() = %s\n",state->cwd);
-#endif
- return (ret);
-}
-
-CWD_API int virtual_chdir(const char *path)
-{
- CWDLS_FETCH();
-
- return virtual_file_ex(&CWDG(cwd), path, php_is_dir_ok)?-1:0;
-}
-
-CWD_API int virtual_chdir_file(const char *path, int (*p_chdir)(const char *path))
-{
- int length = strlen(path);
- char *temp;
- int retval;
-
- if (length == 0) {
- return 1; /* Can't cd to empty string */
- }
- while(--length >= 0 && !IS_SLASH(path[length])) {
- }
-
- if (length == -1) {
- /* No directory only file name */
- errno = ENOENT;
- return -1;
- }
-
- if (length == COPY_WHEN_ABSOLUTE && IS_ABSOLUTE_PATH(path, length+1)) { /* Also use trailing slash if this is absolute */
- length++;
- }
- temp = (char *) tsrm_do_alloca(length+1);
- memcpy(temp, path, length);
- temp[length] = 0;
-#if VIRTUAL_CWD_DEBUG
- fprintf (stderr, "Changing directory to %s\n", temp);
-#endif
- retval = p_chdir(temp);
- tsrm_free_alloca(temp);
- return retval;
-}
-
-CWD_API char *virtual_realpath(const char *path, char *real_path)
-{
- cwd_state new_state;
- int retval;
- CWDLS_FETCH();
-
- CWD_STATE_COPY(&new_state, &CWDG(cwd));
- retval = virtual_file_ex(&new_state, path, NULL);
-
- if (!retval) {
- int len = new_state.cwd_length>MAXPATHLEN-1?MAXPATHLEN-1:new_state.cwd_length;
- memcpy(real_path, new_state.cwd, len);
- real_path[len] = '\0';
- return real_path;
- }
-
- return NULL;
-}
-
-CWD_API int virtual_filepath_ex(const char *path, char **filepath, verify_path_func verify_path)
-{
- cwd_state new_state;
- int retval;
- CWDLS_FETCH();
-
- CWD_STATE_COPY(&new_state, &CWDG(cwd));
- retval = virtual_file_ex(&new_state, path, verify_path);
-
- *filepath = new_state.cwd;
-
- return retval;
-
-}
-
-CWD_API int virtual_filepath(const char *path, char **filepath)
-{
- return virtual_filepath_ex(path, filepath, php_is_file_ok);
-}
-
-CWD_API FILE *virtual_fopen(const char *path, const char *mode)
-{
- cwd_state new_state;
- FILE *f;
- CWDLS_FETCH();
-
- if (path[0] == '\0') { /* Fail to open empty path */
- return NULL;
- }
-
- CWD_STATE_COPY(&new_state, &CWDG(cwd));
- virtual_file_ex(&new_state, path, NULL);
-
- f = fopen(new_state.cwd, mode);
-
- CWD_STATE_FREE(&new_state);
- return f;
-}
-
-#if HAVE_UTIME
-CWD_API int virtual_utime(const char *filename, struct utimbuf *buf)
-{
- cwd_state new_state;
- int ret;
- CWDLS_FETCH();
-
- CWD_STATE_COPY(&new_state, &CWDG(cwd));
- virtual_file_ex(&new_state, filename, NULL);
-
- ret = utime(new_state.cwd, buf);
-
- CWD_STATE_FREE(&new_state);
- return ret;
-}
-#endif
-
-CWD_API int virtual_chmod(const char *filename, mode_t mode)
-{
- cwd_state new_state;
- int ret;
- CWDLS_FETCH();
-
- CWD_STATE_COPY(&new_state, &CWDG(cwd));
- virtual_file_ex(&new_state, filename, NULL);
-
- ret = chmod(new_state.cwd, mode);
-
- CWD_STATE_FREE(&new_state);
- return ret;
-}
-
-#ifndef TSRM_WIN32
-CWD_API int virtual_chown(const char *filename, uid_t owner, gid_t group)
-{
- cwd_state new_state;
- int ret;
- CWDLS_FETCH();
-
- CWD_STATE_COPY(&new_state, &CWDG(cwd));
- virtual_file_ex(&new_state, filename, NULL);
-
- ret = chown(new_state.cwd, owner, group);
-
- CWD_STATE_FREE(&new_state);
- return ret;
-}
-#endif
-
-CWD_API int virtual_open(const char *path, int flags, ...)
-{
- cwd_state new_state;
- int f;
- CWDLS_FETCH();
-
- CWD_STATE_COPY(&new_state, &CWDG(cwd));
- virtual_file_ex(&new_state, path, NULL);
-
- if (flags & O_CREAT) {
- mode_t mode;
- va_list arg;
-
- va_start(arg, flags);
- mode = va_arg(arg, mode_t);
- va_end(arg);
-
- f = open(new_state.cwd, flags, mode);
- } else {
- f = open(new_state.cwd, flags);
- }
- CWD_STATE_FREE(&new_state);
- return f;
-}
-
-CWD_API int virtual_creat(const char *path, mode_t mode)
-{
- cwd_state new_state;
- int f;
- CWDLS_FETCH();
-
- CWD_STATE_COPY(&new_state, &CWDG(cwd));
- virtual_file_ex(&new_state, path, NULL);
-
- f = creat(new_state.cwd, mode);
-
- CWD_STATE_FREE(&new_state);
- return f;
-}
-
-CWD_API int virtual_rename(char *oldname, char *newname)
-{
- cwd_state old_state;
- cwd_state new_state;
- int retval;
- CWDLS_FETCH();
-
- CWD_STATE_COPY(&old_state, &CWDG(cwd));
- virtual_file_ex(&old_state, oldname, NULL);
- oldname = old_state.cwd;
-
- CWD_STATE_COPY(&new_state, &CWDG(cwd));
- virtual_file_ex(&new_state, newname, NULL);
- newname = new_state.cwd;
-
- retval = rename(oldname, newname);
-
- CWD_STATE_FREE(&old_state);
- CWD_STATE_FREE(&new_state);
-
- return retval;
-}
-
-CWD_API int virtual_stat(const char *path, struct stat *buf)
-{
- cwd_state new_state;
- int retval;
- CWDLS_FETCH();
-
- CWD_STATE_COPY(&new_state, &CWDG(cwd));
- virtual_file_ex(&new_state, path, NULL);
-
- retval = stat(new_state.cwd, buf);
-
- CWD_STATE_FREE(&new_state);
- return retval;
-}
-
-#ifndef TSRM_WIN32
-
-CWD_API int virtual_lstat(const char *path, struct stat *buf)
-{
- cwd_state new_state;
- int retval;
- CWDLS_FETCH();
-
- CWD_STATE_COPY(&new_state, &CWDG(cwd));
- virtual_file_ex(&new_state, path, NULL);
-
- retval = lstat(new_state.cwd, buf);
-
- CWD_STATE_FREE(&new_state);
- return retval;
-}
-
-#endif
-
-CWD_API int virtual_unlink(const char *path)
-{
- cwd_state new_state;
- int retval;
- CWDLS_FETCH();
-
- CWD_STATE_COPY(&new_state, &CWDG(cwd));
- virtual_file_ex(&new_state, path, NULL);
-
- retval = unlink(new_state.cwd);
-
- CWD_STATE_FREE(&new_state);
- return retval;
-}
-
-CWD_API int virtual_mkdir(const char *pathname, mode_t mode)
-{
- cwd_state new_state;
- int retval;
- CWDLS_FETCH();
-
- CWD_STATE_COPY(&new_state, &CWDG(cwd));
- virtual_file_ex(&new_state, pathname, NULL);
-
-#ifdef TSRM_WIN32
- retval = mkdir(new_state.cwd);
-#else
- retval = mkdir(new_state.cwd, mode);
-#endif
- CWD_STATE_FREE(&new_state);
- return retval;
-}
-
-CWD_API int virtual_rmdir(const char *pathname)
-{
- cwd_state new_state;
- int retval;
- CWDLS_FETCH();
-
- CWD_STATE_COPY(&new_state, &CWDG(cwd));
- virtual_file_ex(&new_state, pathname, NULL);
-
- retval = rmdir(new_state.cwd);
-
- CWD_STATE_FREE(&new_state);
- return retval;
-}
-
-#ifdef TSRM_WIN32
-DIR *opendir(const char *name);
-#endif
-
-CWD_API DIR *virtual_opendir(const char *pathname)
-{
- cwd_state new_state;
- DIR *retval;
- CWDLS_FETCH();
-
- CWD_STATE_COPY(&new_state, &CWDG(cwd));
- virtual_file_ex(&new_state, pathname, NULL);
-
- retval = opendir(new_state.cwd);
-
- CWD_STATE_FREE(&new_state);
- return retval;
-}
-
-#ifndef TSRM_WIN32
-
-CWD_API FILE *virtual_popen(const char *command, const char *type)
-{
- int command_length;
- char *command_line;
- char *ptr;
- FILE *retval;
- CWDLS_FETCH();
-
- command_length = strlen(command);
-
- ptr = command_line = (char *) malloc(command_length + sizeof("cd ; ") + CWDG(cwd).cwd_length+1);
- if (!command_line) {
- return NULL;
- }
- memcpy(ptr, "cd ", sizeof("cd ")-1);
- ptr += sizeof("cd ")-1;
-
- if (CWDG(cwd).cwd_length == 0) {
- *ptr++ = DEFAULT_SLASH;
- } else {
- memcpy(ptr, CWDG(cwd).cwd, CWDG(cwd).cwd_length);
- ptr += CWDG(cwd).cwd_length;
- }
-
- *ptr++ = ' ';
- *ptr++ = ';';
- *ptr++ = ' ';
-
- memcpy(ptr, command, command_length+1);
- retval = popen(command_line, type);
-
- free(command_line);
- return retval;
-}
-
-#else
-
-/* On Windows the trick of prepending "cd cwd; " doesn't work so we need to perform
- a real chdir() and mutex it
- */
-CWD_API FILE *virtual_popen(const char *command, const char *type)
-{
- char prev_cwd[MAXPATHLEN];
- char *getcwd_result;
- FILE *retval;
- CWDLS_FETCH();
-
- getcwd_result = getcwd(prev_cwd, MAXPATHLEN);
- if (!getcwd_result) {
- return NULL;
- }
-
-#ifdef ZTS
- tsrm_mutex_lock(cwd_mutex);
-#endif
-
- chdir(CWDG(cwd).cwd);
- retval = popen(command, type);
- chdir(prev_cwd);
-
-#ifdef ZTS
- tsrm_mutex_unlock(cwd_mutex);
-#endif
-
- return retval;
-}
-
-#endif
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/TSRM/tsrm_virtual_cwd.h b/TSRM/tsrm_virtual_cwd.h
deleted file mode 100644
index 82dcc5765e..0000000000
--- a/TSRM/tsrm_virtual_cwd.h
+++ /dev/null
@@ -1,214 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997, 1998, 1999, 2000 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Sascha Schumann <sascha@schumann.cx> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef VIRTUAL_CWD_H
-#define VIRTUAL_CWD_H
-
-#include "tsrm_config_common.h"
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <ctype.h>
-
-#ifdef HAVE_UTIME_H
-#include <utime.h>
-#endif
-
-#ifdef HAVE_STDARG_H
-#include <stdarg.h>
-#endif
-
-#ifndef TSRM_WIN32
-#include <unistd.h>
-#endif
-
-#ifdef TSRM_WIN32
-#include "readdir.h"
-#include <sys/utime.h>
-/* mode_t isn't defined on Windows */
-typedef unsigned short mode_t;
-
-#define DEFAULT_SLASH '\\'
-#define IS_SLASH(c) ((c) == '/' || (c) == '\\')
-#define COPY_WHEN_ABSOLUTE 2
-#define IS_ABSOLUTE_PATH(path, len) \
- (len >= 2 && isalpha(path[0]) && path[1] == ':')
-#define IS_UNC_PATH(path, len) \
- (len >= 2 && IS_SLASH(path[0]) && IS_SLASH(path[1]))
-
-#else
-#ifdef HAVE_DIRENT_H
-#include <dirent.h>
-#endif
-
-#define DEFAULT_SLASH '/'
-#define IS_SLASH(c) ((c) == '/')
-
-#endif
-
-
-#ifndef COPY_WHEN_ABSOLUTE
-#define COPY_WHEN_ABSOLUTE 0
-#endif
-
-#ifndef IS_ABSOLUTE_PATH
-#define IS_ABSOLUTE_PATH(path, len) \
- (IS_SLASH(path[0]))
-#endif
-
-#ifdef TSRM_EXPORTS
-#define CWD_EXPORTS
-#endif
-
-#ifdef TSRM_WIN32
-# ifdef CWD_EXPORTS
-# define CWD_API __declspec(dllexport)
-# else
-# define CWD_API __declspec(dllimport)
-# endif
-#else
-#define CWD_API
-#endif
-
-typedef struct _cwd_state {
- char *cwd;
- int cwd_length;
-} cwd_state;
-
-typedef int (*verify_path_func)(const cwd_state *);
-
-CWD_API void virtual_cwd_startup(void);
-CWD_API void virtual_cwd_shutdown(void);
-CWD_API char *virtual_getcwd_ex(size_t *length);
-CWD_API char *virtual_getcwd(char *buf, size_t size);
-CWD_API int virtual_chdir(const char *path);
-CWD_API int virtual_chdir_file(const char *path, int (*p_chdir)(const char *path));
-CWD_API int virtual_filepath(const char *path, char **filepath);
-CWD_API int virtual_filepath_ex(const char *path, char **filepath, verify_path_func verify_path);
-CWD_API char *virtual_realpath(const char *path, char *real_path);
-CWD_API FILE *virtual_fopen(const char *path, const char *mode);
-CWD_API int virtual_open(const char *path, int flags, ...);
-CWD_API int virtual_creat(const char *path, mode_t mode);
-CWD_API int virtual_rename(char *oldname, char *newname);
-CWD_API int virtual_stat(const char *path, struct stat *buf);
-#ifndef TSRM_WIN32
-CWD_API int virtual_lstat(const char *path, struct stat *buf);
-#endif
-CWD_API int virtual_unlink(const char *path);
-CWD_API int virtual_mkdir(const char *pathname, mode_t mode);
-CWD_API int virtual_rmdir(const char *pathname);
-CWD_API DIR *virtual_opendir(const char *pathname);
-CWD_API FILE *virtual_popen(const char *command, const char *type);
-#if HAVE_UTIME
-CWD_API int virtual_utime(const char *filename, struct utimbuf *buf);
-#endif
-CWD_API int virtual_chmod(const char *filename, mode_t mode);
-#ifndef TSRM_WIN32
-CWD_API int virtual_chown(const char *filename, uid_t owner, gid_t group);
-#endif
-
-CWD_API int virtual_file_ex(cwd_state *state, const char *path, verify_path_func verify_path);
-
-typedef struct _virtual_cwd_globals {
- cwd_state cwd;
-} virtual_cwd_globals;
-
-#ifdef ZTS
-# define CWDLS_D virtual_cwd_globals *cwd_globals
-# define CWDLS_DC , CWDLS_D
-# define CWDLS_C cwd_globals
-# define CWDLS_CC , CWDLS_C
-# define CWDG(v) (cwd_globals->v)
-# define CWDLS_FETCH() virtual_cwd_globals *cwd_globals = ts_resource(cwd_globals_id)
-#else
-# define CWDLS_D void
-# define CWDLS_DC
-# define CWDLS_C
-# define CWDLS_CC
-# define CWDG(v) (cwd_globals.v)
-# define CWDLS_FETCH()
-#endif
-
-/* The actual macros to be used in programs using TSRM
- * If the program defines VIRTUAL_DIR it will use the
- * virtual_* functions
- */
-
-#ifdef VIRTUAL_DIR
-
-#define VCWD_GETCWD(buff, size) virtual_getcwd(buff,size)
-#define VCWD_FOPEN(path, mode) virtual_fopen(path, mode)
-/* The VCWD_OPEN macro will need to be used as VCWD_OPEN((path, flags, ...)) */
-#define VCWD_OPEN(open_args) virtual_open open_args
-#define VCWD_CREAT(path, mode) virtual_creat(path, mode)
-#define VCWD_CHDIR(path) virtual_chdir(path)
-#define VCWD_CHDIR_FILE(path) virtual_chdir_file(path, virtual_chdir)
-#define VCWD_GETWD(buf)
-#define VCWD_REALPATH(path,real_path) virtual_realpath(path,real_path)
-#define VCWD_RENAME(oldname,newname) virtual_rename(oldname,newname)
-#define VCWD_STAT(path, buff) virtual_stat(path, buff)
-#ifdef TSRM_WIN32
-#define VCWD_LSTAT(path, buff) virtual_stat(path, buff)
-#else
-#define VCWD_LSTAT(path, buff) virtual_lstat(path, buff)
-#endif
-#define VCWD_UNLINK(path) virtual_unlink(path)
-#define VCWD_MKDIR(pathname, mode) virtual_mkdir(pathname, mode)
-#define VCWD_RMDIR(pathname) virtual_rmdir(pathname)
-#define VCWD_OPENDIR(pathname) virtual_opendir(pathname)
-#define VCWD_POPEN(command, type) virtual_popen(command, type)
-#if HAVE_UTIME
-#define VCWD_UTIME(path,time) virtual_utime(path,time)
-#endif
-#define VCWD_CHMOD(path,mode) virtual_chmod(path,mode)
-#ifndef TSRM_WIN32
-#define VCWD_CHOWN(path,owner,group) virtual_chown(path,owner,group)
-#endif
-
-#else
-
-#define VCWD_GETCWD(buff, size) getcwd(buff,size)
-#define VCWD_FOPEN(path, mode) fopen(path, mode)
-#define VCWD_OPEN(open_args) open open_args
-#define VCWD_CREAT(path, mode) creat(path, mode)
-#define VCWD_RENAME(oldname,newname) rename(oldname,newname)
-#define VCWD_CHDIR(path) chdir(path)
-#define VCWD_CHDIR_FILE(path) virtual_chdir_file(path, chdir)
-#define VCWD_GETWD(buf) getwd(buf)
-#define VCWD_STAT(path, buff) stat(path, buff)
-#define VCWD_LSTAT(path, buff) lstat(path, buff)
-#define VCWD_UNLINK(path) unlink(path)
-#define VCWD_MKDIR(pathname, mode) mkdir(pathname, mode)
-#define VCWD_RMDIR(pathname) rmdir(pathname)
-#define VCWD_OPENDIR(pathname) opendir(pathname)
-#define VCWD_POPEN(command, type) popen(command, type)
-#define VCWD_REALPATH(path,real_path) realpath(path,real_path)
-#if HAVE_UTIME
-#define VCWD_UTIME(path,time) utime(path,time)
-#endif
-#define VCWD_CHMOD(path,mode) chmod(path,mode)
-#ifndef TSRM_WIN32
-#define VCWD_CHOWN(path,owner,group) chown(path,owner,group)
-#endif
-
-#endif
-
-#endif /* VIRTUAL_CWD_H */
diff --git a/TSRM/tsrm_win32.c b/TSRM/tsrm_win32.c
deleted file mode 100644
index 1613ebea40..0000000000
--- a/TSRM/tsrm_win32.c
+++ /dev/null
@@ -1,181 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997, 1998, 1999, 2000 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Daniel Beulshausen <daniel@php4win.de> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <fcntl.h>
-#include <io.h>
-#include <process.h>
-
-#include "TSRM.h"
-
-#ifdef TSRM_WIN32
-#include <windows.h>
-#include "tsrm_win32.h"
-
-#ifdef ZTS
-static ts_rsrc_id win32_globals_id;
-#else
-static tsrm_win32_globals win32_globals;
-#endif
-
-static void tsrm_win32_ctor(tsrm_win32_globals *globals)
-{
- globals->process = NULL;
- globals->process_size = 0;
-}
-
-static void tsrm_win32_dtor(tsrm_win32_globals *globals)
-{
- if (globals->process != NULL) {
- free(globals->process);
- }
-}
-
-TSRM_API void tsrm_win32_startup(void)
-{
-#ifdef ZTS
- win32_globals_id = ts_allocate_id(sizeof(tsrm_win32_globals), (ts_allocate_ctor)tsrm_win32_ctor, (ts_allocate_ctor)tsrm_win32_dtor);
-#else
- tsrm_win32_ctor(&win32_globals);
-#endif
-}
-
-TSRM_API void tsrm_win32_shutdown(void)
-{
-#ifndef ZTS
- tsrm_win32_dtor(&win32_globals);
-#endif
-}
-
-static ProcessPair* process_get(FILE *stream)
-{
- ProcessPair* ptr;
- ProcessPair* newptr;
- TWLS_FETCH();
-
- for (ptr = TWG(process); ptr < (TWG(process) + TWG(process_size)); ptr++) {
- if (stream != NULL && ptr->stream == stream) {
- break;
- } else if (stream == NULL && !ptr->inuse) {
- break;
- }
- }
-
- if (ptr < (TWG(process) + TWG(process_size))) {
- return ptr;
- }
-
- newptr = (ProcessPair*)realloc((void*)TWG(process), (TWG(process_size)+1)*sizeof(ProcessPair));
- if (newptr == NULL) {
- return NULL;
- }
-
- TWG(process) = newptr;
- ptr = newptr + TWG(process_size);
- TWG(process_size)++;
- return ptr;
-}
-
-TSRM_API FILE* popen(const char *command, const char *type)
-{
- FILE *stream = NULL;
- int fno, str_len = strlen(type), read, mode;
- STARTUPINFO startup;
- PROCESS_INFORMATION process;
- SECURITY_ATTRIBUTES security;
- HANDLE in, out;
- ProcessPair *proc;
-
- security.nLength = sizeof(SECURITY_ATTRIBUTES);
- security.bInheritHandle = TRUE;
- security.lpSecurityDescriptor = NULL;
-
- if (!str_len || !CreatePipe(&in, &out, &security, 2048L)) {
- return NULL;
- }
-
- memset(&startup, 0, sizeof(STARTUPINFO));
- memset(&process, 0, sizeof(PROCESS_INFORMATION));
-
- startup.cb = sizeof(STARTUPINFO);
- startup.dwFlags = STARTF_USESTDHANDLES;
- startup.hStdError = GetStdHandle(STD_ERROR_HANDLE);
-
- read = (type[0] == 'r') ? TRUE : FALSE;
- mode = ((str_len == 2) && (type[1] == 'b')) ? O_BINARY : O_TEXT;
-
-
- if (read) {
- startup.hStdInput = GetStdHandle(STD_INPUT_HANDLE);
- startup.hStdOutput = out;
- } else {
- startup.hStdInput = in;
- startup.hStdOutput = GetStdHandle(STD_OUTPUT_HANDLE);
- }
-
-
- if (!CreateProcess(NULL, (LPTSTR)command, &security, &security, security.bInheritHandle, NORMAL_PRIORITY_CLASS, NULL, NULL, &startup, &process)) {
- return NULL;
- }
-
- CloseHandle(process.hThread);
- proc = process_get(NULL);
-
- if (read) {
- fno = _open_osfhandle((long)in, _O_RDONLY | mode);
- CloseHandle(out);
- } else {
- fno = _open_osfhandle((long)out, _O_WRONLY | mode);
- CloseHandle(in);
- }
-
- stream = _fdopen(fno, type);
- proc->prochnd = process.hProcess;
- proc->stream = stream;
- proc->inuse = 1;
- return stream;
-}
-
-TSRM_API int pclose(FILE* stream)
-{
- DWORD termstat = 0;
- ProcessPair* process;
-
- if ((process = process_get(stream)) == NULL) {
- return 0;
- }
-
- fflush(process->stream);
- fclose(process->stream);
-
- GetExitCodeProcess(process->prochnd, &termstat);
- if (termstat == STILL_ACTIVE) {
- TerminateProcess(process->prochnd, termstat);
- }
-
- process->stream = NULL;
- process->inuse = 0;
- CloseHandle(process->prochnd);
-
- return termstat;
-}
-
-#endif \ No newline at end of file
diff --git a/TSRM/tsrm_win32.h b/TSRM/tsrm_win32.h
deleted file mode 100644
index 08eceb644f..0000000000
--- a/TSRM/tsrm_win32.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997, 1998, 1999, 2000 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Daniel Beulshausen <daniel@php4win.de> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef TSRM_WIN32_H
-#define TSRM_WIN32_H
-
-#include "TSRM.h"
-
-#ifdef TSRM_WIN32
-#include <windows.h>
-typedef struct {
- FILE *stream;
- HANDLE prochnd;
- int inuse;
-} ProcessPair;
-
-typedef struct {
- ProcessPair *process;
- int process_size;
-} tsrm_win32_globals;
-
-#ifdef ZTS
-# define TWG(v) (win32_globals->v)
-# define TWLS_FETCH() tsrm_win32_globals *win32_globals = ts_resource(win32_globals_id)
-#else
-# define TWG(v) (win32_globals.v)
-# define TWLS_FETCH()
-#endif
-#endif
-
-TSRM_API void tsrm_win32_startup(void);
-TSRM_API void tsrm_win32_shutdown(void);
-TSRM_API FILE* popen(const char *command, const char *type);
-TSRM_API int pclose(FILE* stream);
-
-#endif \ No newline at end of file
diff --git a/acconfig.h.in b/acconfig.h.in
deleted file mode 100644
index f87979c2fd..0000000000
--- a/acconfig.h.in
+++ /dev/null
@@ -1 +0,0 @@
-/* Leave this file alone */
diff --git a/acinclude.m4 b/acinclude.m4
deleted file mode 100644
index d56f3f10d3..0000000000
--- a/acinclude.m4
+++ /dev/null
@@ -1,1116 +0,0 @@
-dnl $Id$
-dnl
-dnl This file contains local autoconf functions.
-
-sinclude(dynlib.m4)
-
-dnl
-dnl PHP_TARGET_RDYNAMIC
-dnl
-dnl Checks whether -rdynamic is supported by the compiler. This
-dnl is necessary for some targets to populate the global symbol
-dnl table. Otherwise, dynamic modules would not be able to resolve
-dnl PHP-related symbols.
-dnl
-dnl If successful, adds -rdynamic to PHP_LDFLAGS.
-dnl
-AC_DEFUN(PHP_TARGET_RDYNAMIC,[
- if test -n "$GCC"; then
- dnl we should use a PHP-specific macro here
- TSRM_CHECK_GCC_ARG(-rdynamic, gcc_rdynamic=yes)
- if test "$gcc_rdynamic" = "yes"; then
- PHP_LDFLAGS="$PHP_LDFLAGS -rdynamic"
- fi
- fi
-])
-
-AC_DEFUN(PHP_REMOVE_USR_LIB,[
- unset ac_new_flags
- for i in [$]$1; do
- case [$]i in
- -L/usr/lib|-L/usr/lib/) ;;
- *) ac_new_flags="[$]ac_new_flags [$]i" ;;
- esac
- done
- $1=[$]ac_new_flags
-])
-
-AC_DEFUN(PHP_SETUP_OPENSSL,[
- if test "$PHP_OPENSSL" = "no"; then
- PHP_OPENSSL="/usr/local/ssl /usr/local /usr /usr/local/openssl"
- fi
-
- for i in $PHP_OPENSSL; do
- if test -r $i/include/openssl/evp.h; then
- OPENSSL_DIR=$i
- OPENSSL_INC=$i/include
- fi
- done
-
- if test -z "$OPENSSL_DIR"; then
- AC_MSG_ERROR(Cannot find OpenSSL's <evp.h>)
- fi
-
- old_CPPFLAGS=$CPPFLAGS
- CPPFLAGS=-I$OPENSSL_INC
- AC_MSG_CHECKING(for OpenSSL version)
- AC_EGREP_CPP(yes,[
- #include <openssl/opensslv.h>
- #if OPENSSL_VERSION_NUMBER >= 0x0090500fL
- yes
- #endif
- ],[
- AC_MSG_RESULT(>= 0.9.5)
- ],[
- AC_MSG_ERROR(OpenSSL version 0.9.5 or greater required.)
- ])
- CPPFLAGS=$old_CPPFLAGS
-
- PHP_ADD_LIBPATH($OPENSSL_DIR/lib)
-
- AC_CHECK_LIB(crypto, CRYPTO_free, [
- PHP_ADD_LIBRARY(crypto)
- ],[
- AC_MSG_ERROR(libcrypto not found!)
- ])
-
- AC_CHECK_LIB(ssl, SSL_CTX_set_ssl_version, [
- PHP_ADD_LIBRARY(ssl)
- ],[
- AC_MSG_ERROR(libssl not found!)
- ])
- PHP_ADD_INCLUDE($OPENSSL_INC)
-])
-
-dnl PHP_EVAL_LIBLINE(LINE, SHARED-LIBADD)
-dnl
-dnl Use this macro, if you need to add libraries and or library search
-dnl paths to the PHP build system which are only given in compiler
-dnl notation.
-dnl
-AC_DEFUN(PHP_EVAL_LIBLINE,[
- for ac_i in $1; do
- case $ac_i in
- -l*)
- ac_ii=`echo $ac_i|cut -c 3-`
- PHP_ADD_LIBRARY($ac_ii,,$2)
- ;;
- -L*)
- ac_ii=`echo $ac_i|cut -c 3-`
- PHP_ADD_LIBPATH($ac_ii,$2)
- ;;
- esac
- done
-])
-
-dnl PHP_EVAL_INCLINE(LINE)
-dnl
-dnl Use this macro, if you need to add header search paths to the PHP
-dnl build system which are only given in compiler notation.
-dnl
-AC_DEFUN(PHP_EVAL_INCLINE,[
- for ac_i in $1; do
- case $ac_i in
- -I*)
- ac_ii=`echo $ac_i|cut -c 3-`
- PHP_ADD_INCLUDE($ac_ii)
- ;;
- esac
- done
-])
-
-AC_DEFUN(PHP_READDIR_R_TYPE,[
- dnl HAVE_READDIR_R is also defined by libmysql
- AC_CHECK_FUNC(readdir_r,ac_cv_func_readdir_r=yes,ac_cv_func_readdir=no)
- if test "$ac_cv_func_readdir_r" = "yes"; then
- AC_CACHE_CHECK(for type of readdir_r, ac_cv_what_readdir_r,[
- AC_TRY_RUN([
-#define _REENTRANT
-#include <sys/types.h>
-#include <dirent.h>
-
-#ifndef PATH_MAX
-#define PATH_MAX 1024
-#endif
-
-main() {
- DIR *dir;
- char entry[sizeof(struct dirent)+PATH_MAX];
- struct dirent *pentry = (struct dirent *) &entry;
-
- dir = opendir("/");
- if (!dir)
- exit(1);
- if (readdir_r(dir, (struct dirent *) entry, &pentry) == 0)
- exit(0);
- exit(1);
-}
- ],[
- ac_cv_what_readdir_r=POSIX
- ],[
- AC_TRY_CPP([
-#define _REENTRANT
-#include <sys/types.h>
-#include <dirent.h>
-int readdir_r(DIR *, struct dirent *);
- ],[
- ac_cv_what_readdir_r=old-style
- ],[
- ac_cv_what_readdir_r=none
- ])
- ],[
- ac_cv_what_readdir_r=none
- ])
- ])
- case $ac_cv_what_readdir_r in
- POSIX)
- AC_DEFINE(HAVE_POSIX_READDIR_R,1,[whether you have POSIX readdir_r]);;
- old-style)
- AC_DEFINE(HAVE_OLD_READDIR_R,1,[whether you have old-style readdir_r]);;
- esac
- fi
-])
-
-AC_DEFUN(PHP_SHLIB_SUFFIX_NAME,[
- PHP_SUBST(SHLIB_SUFFIX_NAME)
- SHLIB_SUFFIX_NAME=so
- case $host_alias in
- *hpux*)
- SHLIB_SUFFIX_NAME=sl
- ;;
- esac
-])
-
-AC_DEFUN(PHP_DEBUG_MACRO,[
- DEBUG_LOG=$1
- cat >$1 <<X
-CONFIGURE: $CONFIGURE_COMMAND
-CC: $CC
-CFLAGS: $CFLAGS
-CPPFLAGS: $CPPFLAGS
-CXX: $CXX
-CXXFLAGS: $CXXFLAGS
-INCLUDES: $INCLUDES
-LDFLAGS: $LDFLAGS
-LIBS: $LIBS
-DLIBS: $DLIBS
-SAPI: $PHP_SAPI
-PHP_RPATHS: $PHP_RPATHS
-uname -a: `uname -a`
-
-X
- cat >conftest.$ac_ext <<X
-main()
-{
- exit(0);
-}
-X
- (eval echo \"$ac_link\"; eval $ac_link && ./conftest) >>$1 2>&1
- rm -fr conftest*
-])
-
-AC_DEFUN(PHP_MISSING_PREAD_DECL,[
- AC_CACHE_CHECK(whether pread works without custom declaration,ac_cv_pread,[
- AC_TRY_COMPILE([#include <unistd.h>],[size_t (*func)() = pread],[
- ac_cv_pread=yes
- ],[
- echo test > conftest_in
- AC_TRY_RUN([
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
- main() { char buf[3]; return !(pread(open("conftest_in", O_RDONLY), buf, 2, 0) == 2); }
- ],[
- ac_cv_pread=yes
- ],[
- echo test > conftest_in
- AC_TRY_RUN([
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <unistd.h>
- ssize_t pread(int, void *, size_t, off64_t);
- main() { char buf[3]; return !(pread(open("conftest_in", O_RDONLY), buf, 2, 0) == 2); }
- ],[
- ac_cv_pread=64
- ],[
- ac_cv_pread=no
- ])
- ])
- ])
- ])
- case $ac_cv_pread in
- no) ac_cv_func_pread=no;;
- 64) AC_DEFINE(PHP_PREAD_64, 1, [whether pread64 is default]);;
- esac
-])
-
-AC_DEFUN(PHP_MISSING_PWRITE_DECL,[
- AC_CACHE_CHECK(whether pwrite works without custom declaration,ac_cv_pwrite,[
- AC_TRY_COMPILE([#include <unistd.h>],[size_t (*func)() = pwrite],[
- ac_cv_pwrite=yes
- ],[
- AC_TRY_RUN([
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
- main() { return !(pwrite(open("conftest_out", O_WRONLY|O_CREAT, 0600), "Ok", 2, 0) == 2); }
- ],[
- ac_cv_pwrite=yes
- ],[
- AC_TRY_RUN([
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <unistd.h>
- ssize_t pwrite(int, void *, size_t, off64_t);
- main() { return !(pwrite(open("conftest_out", O_WRONLY|O_CREAT, 0600), "Ok", 2, 0) == 2); }
- ],[
- ac_cv_pwrite=64
- ],[
- ac_cv_pwrite=no
- ])
- ])
- ])
- ])
- case $ac_cv_pwrite in
- no) ac_cv_func_pwrite=no;;
- 64) AC_DEFINE(PHP_PWRITE_64, 1, [whether pwrite64 is default]);;
- esac
-])
-
-AC_DEFUN(PHP_MISSING_TIME_R_DECL,[
- AC_MSG_CHECKING(for missing declarations of reentrant functions)
- AC_TRY_COMPILE([#include <time.h>],[struct tm *(*func)() = localtime_r],[
- :
- ],[
- AC_DEFINE(MISSING_LOCALTIME_R_DECL,1,[Whether localtime_r is declared])
- ])
- AC_TRY_COMPILE([#include <time.h>],[struct tm *(*func)() = gmtime_r],[
- :
- ],[
- AC_DEFINE(MISSING_GMTIME_R_DECL,1,[Whether gmtime_r is declared])
- ])
- AC_TRY_COMPILE([#include <time.h>],[char *(*func)() = asctime_r],[
- :
- ],[
- AC_DEFINE(MISSING_ASCTIME_R_DECL,1,[Whether asctime_r is declared])
- ])
- AC_TRY_COMPILE([#include <time.h>],[char *(*func)() = ctime_r],[
- :
- ],[
- AC_DEFINE(MISSING_CTIME_R_DECL,1,[Whether ctime_r is declared])
- ])
- AC_TRY_COMPILE([#include <string.h>],[char *(*func)() = strtok_r],[
- :
- ],[
- AC_DEFINE(MISSING_STRTOK_R_DECL,1,[Whether strtok_r is declared])
- ])
- AC_MSG_RESULT(done)
-])
-
-dnl
-dnl PHP_LIBGCC_LIBPATH(gcc)
-dnl Stores the location of libgcc in libgcc_libpath
-dnl
-AC_DEFUN(PHP_LIBGCC_LIBPATH,[
- changequote({,})
- libgcc_libpath=`$1 --print-libgcc-file-name|sed 's%/*[^/][^/]*$%%'`
- changequote([,])
-])
-
-AC_DEFUN(PHP_ARG_ANALYZE,[
-case [$]$1 in
-shared,*)
- ext_output="yes, shared"
- ext_shared=yes
- $1=`echo "[$]$1"|sed 's/^shared,//'`
- ;;
-shared)
- ext_output="yes, shared"
- ext_shared=yes
- $1=yes
- ;;
-no)
- ext_output=no
- ext_shared=no
- ;;
-*)
- ext_output=yes
- ext_shared=no
- ;;
-esac
-
-if test "$php_always_shared" = "yes"; then
- ext_output="yes, shared"
- ext_shared=yes
- test "[$]$1" = "no" && $1=yes
-fi
-
-AC_MSG_RESULT($ext_output)
-])
-
-dnl
-dnl PHP_ARG_WITH(arg-name, check message, help text[, default-val])
-dnl Sets PHP_ARG_NAME either to the user value or to the default value.
-dnl default-val defaults to no. This will also set the variable ext_shared,
-dnl and will overwrite any previous variable of that name.
-dnl
-AC_DEFUN(PHP_ARG_WITH,[
-PHP_REAL_ARG_WITH([$1],[$2],[$3],[$4],PHP_[]translit($1,a-z0-9-,A-Z0-9_))
-])
-
-AC_DEFUN(PHP_REAL_ARG_WITH,[
-AC_MSG_CHECKING($2)
-AC_ARG_WITH($1,[$3],$5=[$]withval,$5=ifelse($4,,no,$4))
-PHP_ARG_ANALYZE($5)
-])
-
-dnl
-dnl PHP_ARG_ENABLE(arg-name, check message, help text[, default-val])
-dnl Sets PHP_ARG_NAME either to the user value or to the default value.
-dnl default-val defaults to no. This will also set the variable ext_shared,
-dnl and will overwrite any previous variable of that name.
-dnl
-AC_DEFUN(PHP_ARG_ENABLE,[
-PHP_REAL_ARG_ENABLE([$1],[$2],[$3],[$4],PHP_[]translit($1,a-z-,A-Z_))
-])
-
-AC_DEFUN(PHP_REAL_ARG_ENABLE,[
-AC_MSG_CHECKING($2)
-AC_ARG_ENABLE($1,[$3],$5=[$]enableval,$5=ifelse($4,,no,$4))
-PHP_ARG_ANALYZE($5)
-])
-
-AC_DEFUN(PHP_MODULE_PTR,[
- EXTRA_MODULE_PTRS="$EXTRA_MODULE_PTRS $1,"
-])
-
-AC_DEFUN(PHP_CONFIG_NICE,[
- rm -f $1
- cat >$1<<EOF
-#! /bin/sh
-#
-# Created by configure
-
-EOF
-
- for var in CFLAGS CXXFLAGS CPPFLAGS LDFLAGS LIBS CC CXX; do
- eval val=\$$var
- if test -n "$val"; then
- echo "$var='$val' \\" >> $1
- fi
- done
-
- for arg in [$]0 "[$]@"; do
- echo "'[$]arg' \\" >> $1
- done
- echo '"[$]@"' >> $1
- chmod +x $1
-])
-
-AC_DEFUN(PHP_TIME_R_TYPE,[
-AC_CACHE_CHECK(for type of reentrant time-related functions, ac_cv_time_r_type,[
-AC_TRY_RUN([
-#include <time.h>
-
-main() {
-char buf[27];
-struct tm t;
-time_t old = 0;
-int r, s;
-
-s = gmtime_r(&old, &t);
-r = (int) asctime_r(&t, buf, 26);
-if (r == s && s == 0) return (0);
-return (1);
-}
-],[
- ac_cv_time_r_type=hpux
-],[
- AC_TRY_RUN([
-#include <time.h>
-main() {
- struct tm t, *s;
- time_t old = 0;
- char buf[27], *p;
-
- s = gmtime_r(&old, &t);
- p = asctime_r(&t, buf, 26);
- if (p == buf && s == &t) return (0);
- return (1);
-}
- ],[
- ac_cv_time_r_type=irix
- ],[
- ac_cv_time_r_type=POSIX
- ])
-],[
- ac_cv_time_r_type=POSIX
-])
-])
- case $ac_cv_time_r_type in
- hpux) AC_DEFINE(PHP_HPUX_TIME_R,1,[Whether you have HP-UX 10.x]) ;;
- irix) AC_DEFINE(PHP_IRIX_TIME_R,1,[Whether you have IRIX-style functions]) ;;
- esac
-])
-
-AC_DEFUN(PHP_SUBST,[
- PHP_VAR_SUBST="$PHP_VAR_SUBST $1"
-])
-
-AC_DEFUN(PHP_SUBST_OLD,[
- PHP_SUBST($1)
- AC_SUBST($1)
-])
-
-AC_DEFUN(PHP_FAST_OUTPUT,[
- PHP_FAST_OUTPUT_FILES="$PHP_FAST_OUTPUT_FILES $1"
-])
-
-AC_DEFUN(PHP_MKDIR_P_CHECK,[
- AC_CACHE_CHECK(for working mkdir -p, ac_cv_mkdir_p,[
- test -d conftestdir && rm -rf conftestdir
- mkdir -p conftestdir/somedir >/dev/null 2>&1
-dnl `mkdir -p' must be quiet about creating existing directories
- mkdir -p conftestdir/somedir >/dev/null 2>&1
- if test "$?" = "0" && test -d conftestdir/somedir; then
- ac_cv_mkdir_p=yes
- else
- ac_cv_mkdir_p=no
- fi
- rm -rf conftestdir
- ])
-])
-
-AC_DEFUN(PHP_GEN_CONFIG_VARS,[
- PHP_MKDIR_P_CHECK
- echo creating config_vars.mk
- > config_vars.mk
- for i in $PHP_VAR_SUBST; do
- eval echo "$i = \$$i" >> config_vars.mk
- done
-])
-
-AC_DEFUN(PHP_GEN_MAKEFILES,[
- $SHELL $srcdir/build/fastgen.sh $srcdir $ac_cv_mkdir_p $BSD_MAKEFILE $1
-])
-
-AC_DEFUN(PHP_TM_GMTOFF,[
-AC_CACHE_CHECK([for tm_gmtoff in struct tm], ac_cv_struct_tm_gmtoff,
-[AC_TRY_COMPILE([#include <sys/types.h>
-#include <$ac_cv_struct_tm>], [struct tm tm; tm.tm_gmtoff;],
- ac_cv_struct_tm_gmtoff=yes, ac_cv_struct_tm_gmtoff=no)])
-
-if test "$ac_cv_struct_tm_gmtoff" = yes; then
- AC_DEFINE(HAVE_TM_GMTOFF,1,[whether you have tm_gmtoff in struct tm])
-fi
-])
-
-dnl PHP_CONFIGURE_PART(MESSAGE)
-dnl Idea borrowed from mm
-AC_DEFUN(PHP_CONFIGURE_PART,[
- AC_MSG_RESULT()
- AC_MSG_RESULT(${T_MD}$1${T_ME})
-])
-
-AC_DEFUN(PHP_PROG_SENDMAIL,[
-AC_PATH_PROG(PROG_SENDMAIL, sendmail,[], $PATH:/usr/bin:/usr/sbin:/usr/etc:/etc:/usr/ucblib:/usr/lib)
-if test -n "$PROG_SENDMAIL"; then
- AC_DEFINE(HAVE_SENDMAIL,1,[whether you have sendmail])
-fi
-])
-
-AC_DEFUN(PHP_RUNPATH_SWITCH,[
-dnl check for -R, etc. switch
-AC_MSG_CHECKING(if compiler supports -R)
-AC_CACHE_VAL(php_cv_cc_dashr,[
- SAVE_LIBS=$LIBS
- LIBS="-R /usr/lib $LIBS"
- AC_TRY_LINK([], [], php_cv_cc_dashr=yes, php_cv_cc_dashr=no)
- LIBS=$SAVE_LIBS])
-AC_MSG_RESULT($php_cv_cc_dashr)
-if test $php_cv_cc_dashr = "yes"; then
- ld_runpath_switch=-R
-else
- AC_MSG_CHECKING([if compiler supports -Wl,-rpath,])
- AC_CACHE_VAL(php_cv_cc_rpath,[
- SAVE_LIBS=$LIBS
- LIBS="-Wl,-rpath,/usr/lib $LIBS"
- AC_TRY_LINK([], [], php_cv_cc_rpath=yes, php_cv_cc_rpath=no)
- LIBS=$SAVE_LIBS])
- AC_MSG_RESULT($php_cv_cc_rpath)
- if test $php_cv_cc_rpath = "yes"; then
- ld_runpath_switch=-Wl,-rpath,
- else
- dnl something innocuous
- ld_runpath_switch=-L
- fi
-fi
-])
-
-AC_DEFUN(PHP_STRUCT_FLOCK,[
-AC_CACHE_CHECK(for struct flock,ac_cv_struct_flock,
- AC_TRY_COMPILE([
-#include <unistd.h>
-#include <fcntl.h>
- ],
- [struct flock x;],
- [
- ac_cv_struct_flock=yes
- ],[
- ac_cv_struct_flock=no
- ])
-)
-if test "$ac_cv_struct_flock" = "yes" ; then
- AC_DEFINE(HAVE_STRUCT_FLOCK, 1,[whether you have struct flock])
-fi
-])
-
-AC_DEFUN(PHP_SOCKLEN_T,[
-AC_CACHE_CHECK(for socklen_t,ac_cv_socklen_t,
- AC_TRY_COMPILE([
-#include <sys/types.h>
-#include <sys/socket.h>
-],[
-socklen_t x;
-],[
- ac_cv_socklen_t=yes
-],[
- ac_cv_socklen_t=no
-]))
-if test "$ac_cv_socklen_t" = "yes"; then
- AC_DEFINE(HAVE_SOCKLEN_T, 1, [Whether you have socklen_t])
-fi
-])
-
-dnl
-dnl PHP_SET_SYM_FILE(path)
-dnl
-dnl set the path of the file which contains the symbol export list
-dnl
-AC_DEFUN(PHP_SET_SYM_FILE,
-[
- PHP_SYM_FILE=$1
-])
-
-dnl
-dnl PHP_BUILD_THREAD_SAFE
-dnl
-AC_DEFUN(PHP_BUILD_THREAD_SAFE,[
- enable_experimental_zts=yes
- if test "$pthreads_working" != "yes"; then
- AC_MSG_ERROR(ZTS currently requires working POSIX threads. We were unable to verify that your system supports Pthreads.)
- fi
-])
-
-AC_DEFUN(PHP_REQUIRE_CXX,[
- if test -z "$php_cxx_done"; then
- AC_PROG_CXX
- AC_PROG_CXXCPP
- php_cxx_done=yes
- fi
-])
-
-dnl
-dnl PHP_BUILD_SHARED
-dnl
-AC_DEFUN(PHP_BUILD_SHARED,[
- php_build_target=shared
-])
-
-dnl
-dnl PHP_BUILD_STATIC
-dnl
-AC_DEFUN(PHP_BUILD_STATIC,[
- php_build_target=static
-])
-
-dnl
-dnl PHP_BUILD_PROGRAM
-dnl
-AC_DEFUN(PHP_BUILD_PROGRAM,[
- php_build_target=program
-])
-
-dnl
-dnl AC_PHP_ONCE(namespace, variable, code)
-dnl
-dnl execute code, if variable is not set in namespace
-dnl
-AC_DEFUN(AC_PHP_ONCE,[
- changequote({,})
- unique=`echo $2|sed 's/[^a-zA-Z0-9]/_/g'`
- changequote([,])
- cmd="echo $ac_n \"\$$1$unique$ac_c\""
- if test -n "$unique" && test "`eval $cmd`" = "" ; then
- eval "$1$unique=set"
- $3
- fi
-])
-
-dnl
-dnl PHP_EXPAND_PATH(path, variable)
-dnl
-dnl expands path to an absolute path and assigns it to variable
-dnl
-AC_DEFUN(PHP_EXPAND_PATH,[
- if test -z "$1" || echo "$1" | grep '^/' >/dev/null ; then
- $2=$1
- else
- changequote({,})
- ep_dir="`echo $1|sed 's%/*[^/][^/]*/*$%%'`"
- changequote([,])
- ep_realdir="`(cd \"$ep_dir\" && pwd)`"
- $2="$ep_realdir/`basename \"$1\"`"
- fi
-])
-
-dnl
-dnl PHP_ADD_LIBPATH(path[, shared-libadd])
-dnl
-dnl add a library to linkpath/runpath
-dnl
-AC_DEFUN(PHP_ADD_LIBPATH,[
- if test "$1" != "/usr/lib"; then
- PHP_EXPAND_PATH($1, ai_p)
- if test "$ext_shared" = "yes" && test -n "$2"; then
- $2="-R$1 -L$1 [$]$2"
- else
- AC_PHP_ONCE(LIBPATH, $ai_p, [
- test -n "$ld_runpath_switch" && LDFLAGS="$LDFLAGS $ld_runpath_switch$ai_p"
- LDFLAGS="$LDFLAGS -L$ai_p"
- PHP_RPATHS="$PHP_RPATHS $ai_p"
- ])
- fi
- fi
-])
-
-dnl
-dnl PHP_BUILD_RPATH()
-dnl
-dnl builds RPATH from PHP_RPATHS
-dnl
-AC_DEFUN(PHP_BUILD_RPATH,[
- if test "$PHP_RPATH" = "yes" && test -n "$PHP_RPATHS"; then
- OLD_RPATHS="$PHP_RPATHS"
- unset PHP_RPATHS
- for i in $OLD_RPATHS; do
- PHP_LDFLAGS="$PHP_LDFLAGS -L$i"
- PHP_RPATHS="$PHP_RPATHS -R $i"
- NATIVE_RPATHS="$NATIVE_RPATHS $ld_runpath_switch$i"
- done
- fi
-])
-
-dnl
-dnl PHP_ADD_INCLUDE(path [,before])
-dnl
-dnl add an include path.
-dnl if before is 1, add in the beginning of INCLUDES.
-dnl
-AC_DEFUN(PHP_ADD_INCLUDE,[
- if test "$1" != "/usr/include"; then
- PHP_EXPAND_PATH($1, ai_p)
- AC_PHP_ONCE(INCLUDEPATH, $ai_p, [
- if test "$2"; then
- INCLUDES="-I$ai_p $INCLUDES"
- else
- INCLUDES="$INCLUDES -I$ai_p"
- fi
- ])
- fi
-])
-
-AC_DEFUN(PHP_X_ADD_LIBRARY,[
- ifelse($2,,$3="-l$1 [$]$3", $3="[$]$3 -l$1")
-])
-
-dnl
-dnl PHP_ADD_LIBRARY(library[, append[, shared-libadd]])
-dnl
-dnl add a library to the link line
-dnl
-AC_DEFUN(PHP_ADD_LIBRARY,[
- case $1 in
- c|c_r|pthread*) ;;
- *)
-ifelse($3,,[
- PHP_X_ADD_LIBRARY($1,$2,LIBS)
-],[
- if test "$ext_shared" = "yes"; then
- PHP_X_ADD_LIBRARY($1,$2,$3)
- else
- PHP_ADD_LIBRARY($1,$2)
- fi
-])
- ;;
- esac
-])
-
-dnl
-dnl PHP_ADD_LIBRARY_DEFER(library[, append])
-dnl
-dnl add a library to the link line (deferred)
-AC_DEFUN(PHP_ADD_LIBRARY_DEFER,[
- ifelse($#, 1, DLIBS="-l$1 $DLIBS", DLIBS="$DLIBS -l$1")
-])
-
-dnl
-dnl PHP_ADD_LIBRARY_WITH_PATH(library, path[, shared-libadd])
-dnl
-dnl add a library to the link line and path to linkpath/runpath.
-dnl if shared-libadd is not empty and $ext_shared is yes,
-dnl shared-libadd will be assigned the library information
-dnl
-AC_DEFUN(PHP_ADD_LIBRARY_WITH_PATH,[
-ifelse($3,,[
- if test -n "$2"; then
- PHP_ADD_LIBPATH($2)
- fi
- PHP_ADD_LIBRARY($1)
-],[
- if test "$ext_shared" = "yes"; then
- $3="-l$1 [$]$3"
- if test -n "$2"; then
- PHP_ADD_LIBPATH($2,$3)
- fi
- else
- PHP_ADD_LIBRARY_WITH_PATH($1,$2)
- fi
-])
-])
-
-dnl
-dnl PHP_ADD_LIBRARY_DEFER_WITH_PATH(library, path)
-dnl
-dnl add a library to the link line (deferred)
-dnl and path to linkpath/runpath (not deferred)
-dnl
-AC_DEFUN(PHP_ADD_LIBRARY_DEFER_WITH_PATH,[
- PHP_ADD_LIBPATH($2)
- PHP_ADD_LIBRARY_DEFER($1)
-])
-
-dnl
-dnl Set libtool variable
-dnl
-AC_DEFUN(AM_SET_LIBTOOL_VARIABLE,[
- LIBTOOL='$(SHELL) $(top_builddir)/libtool $1'
-])
-
-dnl
-dnl Check for cc option
-dnl
-AC_DEFUN(PHP_CHECK_CC_OPTION,[
- echo "main(){return 0;}" > conftest.$ac_ext
- opt=$1
- changequote({,})
- var=`echo $opt|sed 's/[^a-zA-Z0-9]/_/g'`
- changequote([,])
- AC_MSG_CHECKING([if compiler supports -$1 really])
- ac_php_compile="${CC-cc} -$opt -o conftest $CFLAGS $CPPFLAGS conftest.$ac_ext 2>&1"
- if eval $ac_php_compile 2>&1 | egrep "$opt" > /dev/null 2>&1 ; then
- eval php_cc_$var=no
- AC_MSG_RESULT(no)
- else
- if eval ./conftest 2>/dev/null ; then
- eval php_cc_$var=yes
- AC_MSG_RESULT(yes)
- else
- eval php_cc_$var=no
- AC_MSG_RESULT(no)
- fi
- fi
-])
-
-AC_DEFUN(PHP_REGEX,[
-
-if test "$REGEX_TYPE" = "php"; then
- REGEX_LIB=regex/libregex.la
- REGEX_DIR=regex
- AC_DEFINE(HSREGEX,1,[ ])
- AC_DEFINE(REGEX,1,[ ])
- PHP_FAST_OUTPUT(regex/Makefile)
-elif test "$REGEX_TYPE" = "system"; then
- AC_DEFINE(REGEX,0,[ ])
-fi
-
-AC_MSG_CHECKING(which regex library to use)
-AC_MSG_RESULT($REGEX_TYPE)
-
-PHP_SUBST(REGEX_DIR)
-PHP_SUBST(REGEX_LIB)
-PHP_SUBST(HSREGEX)
-])
-
-dnl
-dnl See if we have broken header files like SunOS has.
-dnl
-AC_DEFUN(PHP_MISSING_FCLOSE_DECL,[
- AC_MSG_CHECKING([for fclose declaration])
- AC_TRY_COMPILE([#include <stdio.h>],[int (*func)() = fclose],[
- AC_DEFINE(MISSING_FCLOSE_DECL,0,[ ])
- AC_MSG_RESULT(ok)
- ],[
- AC_DEFINE(MISSING_FCLOSE_DECL,1,[ ])
- AC_MSG_RESULT(missing)
- ])
-])
-
-dnl
-dnl Check for broken sprintf()
-dnl
-AC_DEFUN(PHP_AC_BROKEN_SPRINTF,[
- AC_CACHE_CHECK(whether sprintf is broken, ac_cv_broken_sprintf,[
- AC_TRY_RUN([main() {char buf[20];exit(sprintf(buf,"testing 123")!=11); }],[
- ac_cv_broken_sprintf=no
- ],[
- ac_cv_broken_sprintf=yes
- ],[
- ac_cv_broken_sprintf=no
- ])
- ])
- if test "$ac_cv_broken_sprintf" = "yes"; then
- AC_DEFINE(PHP_BROKEN_SPRINTF, 1, [ ])
- else
- AC_DEFINE(PHP_BROKEN_SPRINTF, 0, [ ])
- fi
-])
-
-dnl
-dnl PHP_EXTENSION(extname [, shared])
-dnl
-dnl Includes an extension in the build.
-dnl
-dnl "extname" is the name of the ext/ subdir where the extension resides
-dnl "shared" can be set to "shared" or "yes" to build the extension as
-dnl a dynamically loadable library.
-dnl
-AC_DEFUN(PHP_EXTENSION,[
- EXT_SUBDIRS="$EXT_SUBDIRS $1"
-
- if test -d "$abs_srcdir/ext/$1"; then
-dnl ---------------------------------------------- Internal Module
- ext_builddir=ext/$1
- ext_srcdir=$abs_srcdir/ext/$1
- else
-dnl ---------------------------------------------- External Module
- ext_builddir=.
- ext_srcdir=$abs_srcdir
- fi
-
- if test "$2" != "shared" && test "$2" != "yes"; then
-dnl ---------------------------------------------- Static module
- LIB_BUILD($ext_builddir)
- EXT_LTLIBS="$EXT_LTLIBS $ext_builddir/lib$1.la"
- EXT_STATIC="$EXT_STATIC $1"
- else
-dnl ---------------------------------------------- Shared module
- LIB_BUILD($ext_builddir,yes)
- AC_DEFINE_UNQUOTED([COMPILE_DL_]translit($1,a-z-,A-Z_), 1, Whether to build $1 as dynamic module)
- fi
-
- PHP_FAST_OUTPUT($ext_builddir/Makefile)
-])
-
-PHP_SUBST(EXT_SUBDIRS)
-PHP_SUBST(EXT_STATIC)
-PHP_SUBST(EXT_SHARED)
-PHP_SUBST(EXT_LIBS)
-PHP_SUBST(EXT_LTLIBS)
-
-dnl
-dnl Solaris requires main code to be position independent in order
-dnl to let shared objects find symbols. Weird. Ugly.
-dnl
-dnl Must be run after all --with-NN options that let the user
-dnl choose dynamic extensions, and after the gcc test.
-dnl
-AC_DEFUN(PHP_SOLARIS_PIC_WEIRDNESS,[
- AC_MSG_CHECKING(whether -fPIC is required)
- if test -n "$EXT_SHARED"; then
- os=`uname -sr 2>/dev/null`
- case $os in
- "SunOS 5.6"|"SunOS 5.7")
- case $CC in
- gcc*|egcs*) CFLAGS="$CFLAGS -fPIC";;
- *) CFLAGS="$CFLAGS -fpic";;
- esac
- AC_MSG_RESULT(yes);;
- *)
- AC_MSG_RESULT(no);;
- esac
- else
- AC_MSG_RESULT(no)
- fi
-])
-
-dnl
-dnl Checks whether $withval is "shared" or starts with "shared,XXX"
-dnl and sets $shared to "yes" or "no", and removes "shared,?" stuff
-dnl from $withval.
-dnl
-AC_DEFUN(PHP_WITH_SHARED,[
- case $withval in
- shared)
- shared=yes
- withval=yes
- ;;
- shared,*)
- shared=yes
- withval=`echo $withval | sed -e 's/^shared,//'`
- ;;
- *)
- shared=no
- ;;
- esac
- if test -n "$php_always_shared"; then
- shared=yes
- fi
-])
-
-dnl The problem is that the default compilation flags in Solaris 2.6 won't
-dnl let programs access large files; you need to tell the compiler that
-dnl you actually want your programs to work on large files. For more
-dnl details about this brain damage please see:
-dnl http://www.sas.com/standards/large.file/x_open.20Mar96.html
-
-dnl Written by Paul Eggert <eggert@twinsun.com>.
-
-AC_DEFUN(PHP_SYS_LFS,
-[dnl
- # If available, prefer support for large files unless the user specified
- # one of the CPPFLAGS, LDFLAGS, or LIBS variables.
- AC_MSG_CHECKING(whether large file support needs explicit enabling)
- ac_getconfs=''
- ac_result=yes
- ac_set=''
- ac_shellvars='CPPFLAGS LDFLAGS LIBS'
- for ac_shellvar in $ac_shellvars; do
- case $ac_shellvar in
- CPPFLAGS) ac_lfsvar=LFS_CFLAGS ;;
- *) ac_lfsvar=LFS_$ac_shellvar ;;
- esac
- eval test '"${'$ac_shellvar'+set}"' = set && ac_set=$ac_shellvar
- (getconf $ac_lfsvar) >/dev/null 2>&1 || { ac_result=no; break; }
- ac_getconf=`getconf $ac_lfsvar`
- ac_getconfs=$ac_getconfs$ac_getconf
- eval ac_test_$ac_shellvar=\$ac_getconf
- done
- case "$ac_result$ac_getconfs" in
- yes) ac_result=no ;;
- esac
- case "$ac_result$ac_set" in
- yes?*) ac_result="yes, but $ac_set is already set, so use its settings"
- esac
- AC_MSG_RESULT($ac_result)
- case $ac_result in
- yes)
- for ac_shellvar in $ac_shellvars; do
- eval $ac_shellvar=\$ac_test_$ac_shellvar
- done ;;
- esac
-])
-
-AC_DEFUN(PHP_SOCKADDR_SA_LEN,[
- AC_CACHE_CHECK([for field sa_len in struct sockaddr],ac_cv_sockaddr_sa_len,[
- AC_TRY_COMPILE([#include <sys/types.h>
-#include <sys/socket.h>],
- [struct sockaddr s; s.sa_len;],
- [ac_cv_sockaddr_sa_len=yes
- AC_DEFINE(HAVE_SOCKADDR_SA_LEN,1,[ ])],
- [ac_cv_sockaddr_sa_len=no])
- ])
-])
-
-
-dnl ## PHP_OUTPUT(file)
-dnl ## adds "file" to the list of files generated by AC_OUTPUT
-dnl ## This macro can be used several times.
-AC_DEFUN(PHP_OUTPUT,[
- PHP_OUTPUT_FILES="$PHP_OUTPUT_FILES $1"
-])
-
-AC_DEFUN(PHP_DECLARED_TIMEZONE,[
- AC_CACHE_CHECK(for declared timezone, ac_cv_declared_timezone,[
- AC_TRY_COMPILE([
-#include <sys/types.h>
-#include <time.h>
-#ifdef HAVE_SYS_TIME_H
-#include <sys/time.h>
-#endif
-],[
- time_t foo = (time_t) timezone;
-],[
- ac_cv_declared_timezone=yes
-],[
- ac_cv_declared_timezone=no
-])])
- if test "$ac_cv_declared_timezone" = "yes"; then
- AC_DEFINE(HAVE_DECLARED_TIMEZONE, 1, [Whether system headers declare timezone])
- fi
-])
-
-AC_DEFUN(PHP_EBCDIC,[
- AC_CACHE_CHECK([whether system uses EBCDIC],ac_cv_ebcdic,[
- AC_TRY_RUN( [
-int main(void) {
- return (unsigned char)'A' != (unsigned char)0xC1;
-}
-],[
- ac_cv_ebcdic=yes
-],[
- ac_cv_ebcdic=no
-],[
- ac_cv_ebcdic=no
-])])
- if test "$ac_cv_ebcdic" = "yes"; then
- AC_DEFINE(CHARSET_EBCDIC,1, [Define if system uses EBCDIC])
- fi
-])
-
-AC_DEFUN(AC_ADD_LIBPATH, [indir([PHP_ADD_LIBPATH])])
-AC_DEFUN(AC_ADD_LIBRARY, [indir([PHP_ADD_LIBRARY])])
-AC_DEFUN(AC_ADD_LIBRARY_WITH_PATH, [indir([PHP_ADD_LIBRARY_WITH_PATH])])
-AC_DEFUN(AC_ADD_INCLUDE, [indir([PHP_ADD_INCLUDE])])
-
-AC_DEFUN(PHP_FOPENCOOKIE,[
- AC_CHECK_FUNC(fopencookie, [ have_glibc_fopencookie=yes ])
-
- if test "$have_glibc_fopencookie" = "yes" ; then
- dnl this comes in two flavors:
- dnl newer glibcs (since 2.1.2 ? )
- dnl have a type called cookie_io_functions_t
- AC_TRY_COMPILE([ #define _GNU_SOURCE
- #include <stdio.h>
- ],
- [ cookie_io_functions_t cookie; ],
- [ have_cookie_io_functions_t=yes ],
- [ ] )
-
- if test "$have_cookie_io_functions_t" = "yes" ; then
- cookie_io_functions_t=cookie_io_functions_t
- have_fopen_cookie=yes
- else
- dnl older glibc versions (up to 2.1.2 ?)
- dnl call it _IO_cookie_io_functions_t
- AC_TRY_COMPILE([ #define _GNU_SOURCE
- #include <stdio.h>
- ],
- [ _IO_cookie_io_functions_t cookie; ],
- [ have_IO_cookie_io_functions_t=yes ],
- [] )
- if test "$have_cookie_io_functions_t" = "yes" ; then
- cookie_io_functions_t=_IO_cookie_io_functions_t
- have_fopen_cookie=yes
- fi
- fi
-
- if test "$have_fopen_cookie" = "yes" ; then
- AC_DEFINE(HAVE_FOPENCOOKIE, 1, [ ])
- AC_DEFINE_UNQUOTED(COOKIE_IO_FUNCTIONS_T, $cookie_io_functions_t, [ ])
- fi
-
- fi
-])
diff --git a/apidoc-zend.txt b/apidoc-zend.txt
deleted file mode 100644
index 6cd4999dca..0000000000
--- a/apidoc-zend.txt
+++ /dev/null
@@ -1,276 +0,0 @@
-Following is a merge of two letters I sent to php4beta@lists.php.net,
-describing the changes in API between PHP 3.0 and PHP 4.0 (Zend).
-This file is by no means thorough documentation of the PHP API,
-and is intended for developers who are familiar with the PHP 3.0 API,
-and want to port their code to PHP 4.0, or take advantage of its new
-features. For highlights about the PHP 3.0 API, consult apidoc.txt.
-
-Zeev
-
---------------------------------------------------------------------------
-
-I'm going to try to list the important changes in API and programming
-techniques that are involved in developing modules for PHP4/Zend, as
-opposed to PHP3. Listing the whole PHP4 API is way beyond my scope here,
-it's mostly a 'diff' from the apidoc.txt, which you're all pretty familiar
-with.
-An important note that I neglected to mention yesterday - the php4 tree is
-based on the php 3.0.5 tree, plus all 3.0.6 patches hand-patched into it.
-Notably, it does NOT include any 3.0.7 patches. All of those have to be
-reapplied, with extreme care - modules should be safe to patch (mostly),
-but anything that touches the core or main.c will almost definitely require
-changes in order to work properly.
-
-[1] Symbol Tables
-
-One of the major changes in Zend involves changing the way symbols tables
-work. Zend enforces reference counting on all values and resources. This
-required changes in the semantics of the hash tables that implement symbol
-tables. Instead of storing pval in the hashes, we now store pval *. All
-of the API functions in Zend were changed in a way that this change is
-completely transparent. However, if you've used 'low level' hash functions
-to access or update elements in symbol tables, your code will require
-changes. Following are two simple examples, one demonstrates the
-difference between PHP3 and Zend when reading a symbol's value, and the
-other demonstrates the difference when writing a value.
-
-php3_read()
-{
- pval *foo;
-
- _php3_hash_find(ht, "foo", sizeof("foo"), &foo);
- /* foo->type is the type and foo->value is the value */
-}
-
-
-php4_read()
-{
- pval **foo;
-
- _php3_hash_find(ht, "foo", sizeof("foo"), &foo);
- /* (*foo)->type is the type and (*foo)->value is the value */
-}
-
----
-
-php3_write()
-{
- pval newval;
-
- newval.type = ...;
- newval.value = ...;
- _php3_hash_update(ht, "bar", sizeof("bar"), &newval, sizeof(pval), NULL);
-}
-
-php4_write()
-{
- pval *newval = ALLOC_ZVAL();
-
- newval->refcount=1;
- newval->is_ref=0;
- newval->type = ...;
- newval->value = ...;
- _php3_hash_update(ht, "bar", sizeof("bar"), &newval, sizeof(pval *), NULL);
-}
-
-
-[2] Resources
-
-One of the 'cute' things about the reference counting support is that it
-completely eliminates the problem of resource leaking. A simple loop that
-included '$result = mysql_query(...)' in PHP leaked unless the user
-remembered to run mysql_free($result) at the end of the loop body, and
-nobody really did. In order to take advantage of the automatic resource
-deallocation upon destruction, there's virtually one small change you need
-to conduct. Change the result type of a resource that you want to destroy
-itself as soon as its no longer referenced (just about any resource I can
-think of) as IS_RESOURCE, instead of as IS_LONG. The rest is magic.
-
-A special treatment is required for SQL modules that follow MySQL's
-approach for having the link handle as an optional argument. Modules that
-follow the MySQL module model, store the last opened link in a global
-variable, that they use in case the user neglects to explicitly specify a
-link handle. Due to the way referenec counting works, this global
-reference is just like any other reference, and must increase that SQL link
-resource's reference count (otherwise, it will be closed prematurely).
-Simply, when you set the default link to a certain link, increase that
-link's reference count by calling zend_list_addref().
-As always, the MySQL module is the one used to demonstrate 'new
-technology'. You can look around it and look for IS_RESOURCE, as well as
-zend_list_addref(), to see a clear example of how the new API should be used.
-
-
-[3] Thread safety issues
-
-I'm not going to say that Zend was designed with thread safety in mind, but
-from some point, we've decided upon several guidelines that would make the
-move to thread safety much, much easier. Generally, we've followed the PHP
-3.1 approach of moving global variables to a structure, and encapsulating
-all global variable references within macros. There are three main
-differences:
-1. We grouped related globals in a single structure, instead of grouping
-all globals in one structure.
-2. We've used much, much shorter macro names to increase the readability
-of the source code.
-3. Regardless of whether we're compiling in thread safe mode or not, all
-global variables are *always* stored in a structure. For example, you
-would never have a global variable 'foo', instead, it'll be a property of a
-global structure, for example, compiler_globals.foo. That makes
-development much, much easier, since your code will simply not compile
-unless you remember to put the necessary macro around foo.
-
-To write code that'll be thread safe in the future (when we release our
-thread safe memory manager and work on integrating it), you can take a look
-at zend_globals.h. Essentially, two sets of macros are defined, one for
-thread safe mode, and one for thread unsafe mode. All global references
-are encapsulated within ???G(varname), where ??? is the appropriate prefix
-for your structure (for example, so far we have CG(), EG() and AG(), which
-stand for the compiler, executor and memory allocator, respectively).
-When compiling with thread safety enabled, each function that makes use of
-a ???G() macro, must obtain the pointer to its copy of the structure. It
-can do so in one of two forms:
-1. It can receive it as an argument.
-2. It can fetch it.
-
-Obviously, the first method is preferable since it's much quicker.
-However, it's not always possible to send the structure all the way to a
-particular function, or it may simply bloat the code too much in some
-cases. Functions that receive the globals as an argument, should look like
-this:
-
-rettype functioname(???LS_D) <-- a function with no arguments
-rettype functioname(type arg1, ..., type argn ???LS_DC) <-- a funciton with
-arguments
-
-Calls to such functions should look like this:
-functionname(???LS_C) <-- a function with no arguments
-functionname(arg1, ..., argn ???LS_CC) <-- a function with arguments
-
-LS stands for 'Local Storage', _C stands for Call and _CC stands for Call
-Comma, _D stands for Declaration and _DC stands for Declaration Comma.
-Note that there's NO comma between the last argument and ???LS_DC or ???LS_CC.
-
-In general, every module that makes use of globals should use this approach
-if it plans to be thread safe.
-
-
-[4] Generalized INI support
-
-The code comes to solve several issues:
-
-a. The ugly long block of code in main.c that reads values from the
-cfg_hash into php3_ini.
-b. Get rid of php3_ini. The performance penalty of copying it around all
-the time in the Apache module probably wasn't too high, but
-psychologically, it annoyed me :)
-c. Get rid of the ugly code in mod_php4.c, that also reads values from
-Apache directives and puts them into the php3_ini structure.
-d. Generalize all the code so that you only have to add an entry in one
-single place and get it automatically supported in php3.ini, Apache, Win32
-registry, runtime function ini_get() and ini_alter() and any future method
-we might have.
-e. Allow users to easily override *ANY* php3.ini value, except for ones
-they're not supposed to, of course.
-
-I'm happy to say that I think I pretty much reached all goals. php_ini.c
-implements a mechanism that lets you add your INI entry in a single place,
-with a default value in case there's no php3.ini value. What you get by
-using this mechanism:
-
-1. Automatic initialization from php3.ini if available, or from the
-default value if not.
-2. Automatic support in ini_alter(). That means a user can change the
-value for this INI entry at runtime, without you having to add in a single
-line of code, and definitely no additional function (for example, in PHP3,
-we had to add in special dedicated functions, like
-set_magic_quotes_runtime() or the likes - no need for that anymore).
-3. Automatic support in Apache .conf files.
-4. No need for a global php3_ini-like variable that'll store all that
-info. You can directly access each INI entry by name, in runtime. 'Sure,
-that's not revolutionary, it's just slow' is probably what some of you
-think - which is true, but, you can also register a callback function that
-is called each time your INI entry is changed, if you wish to store it in a
-cached location for intensive use.
-5. Ability to access the current active value for a given INI entry, and
-the 'master' value.
-
-Of course, (2) and (3) are only applicable in some cases. Some entries
-shouldn't be overriden by users in runtime or through Apache .conf files -
-you can, of course, mark them as such.
-
-
-So, enough hype, how does it work.
-
-Essentially:
-
-static PHP_INI_MH(OnChangeBar); /* declare a message handler for a change
-in "bar" */
-
-PHP_INI_BEGIN()
- PHP_INI_ENTRY("foo", "1", PHP_INI_ALL, NULL, NULL)
- PHP_INI_ENTRY("bar", "bah", PHP_INI_SYSTEM, OnChangeBar, NULL)
-PHP_INI_END()
-
-static PHP_INI_MH(OnChangeBar)
-{
- a_global_var_for_bar = new_value;
- return SUCCESS;
-}
-
-int whatever_minit(INIT_FUNC_ARGS)
-{
- ...
- REGISTER_INI_ENTRIES();
- ...
-}
-
-
-int whatever_mshutdown(SHUTDOWN_FUNC_ARGS)
-{
- ...
- UNREGISTER_INI_ENTRIES();
- ...
-}
-
-
-and that's it. Here's what it does. As you can probably guess, this code
-registers two INI entries - "foo" and "bar". They're given defaults "1"
-and "bah" respectively - note that all defaults are always given as
-strings. That doesn't reduce your ability to use integer values, simply
-specify them as strings. "foo" is marked so that it can be changed by
-anyone at any time (PHP_INI_ALL), whereas "bar" is marked so it can be
-changed only at startup in the php3.ini only, presumably, by the system
-administrator (PHP_INI_SYSTEM).
-When "foo" changes, no function is called. Access to it is done using the
-macros INI_INT("foo"), INI_FLT("foo") or INI_STR("foo"), which return a
-long, double or char * respectively (strings that are returned aren't
-duplicated - if they're manipulated, you must duplicate them first). You
-can also access the original value (the 'master' value, in case one of them
-was overriden by a user) using another pair of macros:
-INI_ORIG_INT("foo"), INI_ORIG_FLT("foo") and INI_ORIG_STR("foo").
-
-When "bar" changes, a special message handler is called, OnBarChange().
-Always declare those message handlers using PHP_INI_MH(), as they might
-change in the future. Message handlers are called as soon as an ini entry
-initializes or changes, and allow you to cache a certain INI value in a
-quick C structure. In this example, whenever "bar" changes, the new value
-is stored in a_global_var_for_bar, which is a global char * pointer,
-quickly accessible from other functions. Things get a bit more complicated
-when you want to implement a thread-safe module, but it's doable as well.
-Message handlers may return SUCCESS to acknowledge the new value, or
-FAILURE to reject it. That enables you to reject invalid values for some
-INI entries if you want. Finally, you can have a pointer passed to your
-message handler - that's the fifth argument to PHP_INI_ENTRY(). It is
-passed as mh_arg to the message handler.
-
-Remember that for certain values, there's really no reason to mess with a
-callback function. A perfect example for this are the syntax highlight
-colors, which no longer have a dedicated global C slot that stores them,
-but instead, are fetched from the php_ini hash on demand.
-
-"As always", for a perfect working example of this mechanism, consult
-functions/mysql.c. This module uses the new INI entry mechanism, and was
-also converted to be thread safe in general, and in its php_ini support in
-particular. Converting your modules to look like this for thread safety
-isn't a bad idea (not necessarily now, but in the long run).
-
diff --git a/apidoc.txt b/apidoc.txt
deleted file mode 100644
index 34eac2896c..0000000000
--- a/apidoc.txt
+++ /dev/null
@@ -1,492 +0,0 @@
-PHP Version 3.0 API Documentation
-
-Table of Contents
------------------
- 1. Function Prototype
- 2. Function Arguments
- 3. Variable number of function arguments
- 4. Using the function arguments
- 5. Memory management in functions
- 6. Setting variables in the symbol table
- 7. Returning values from functions
- 8. Returning 'complex' values from functions (arrays or objects)
- 9. Using the resource list
-10. Using the persistent resource table
-11. Adding runtime configuration directives
------------------
-
-1. Function Prototype
-
- All functions look like this:
-
- PHP_FUNCTION(foo) {
-
- }
-
- Even if your function doesn't take any arguments, this is how it is
- called.
-
------------------
-
-2. Function Arguments
-
- Arguments are always of type pval. This type contains a union which
- has the actual type of the argument. So, if your function takes two
- arguments, you would do something like the following at the top of your
- function:
-
- pval *arg1, *arg2;
- if (ARG_COUNT(ht) != 2 || getParameters(ht,2,&arg1,&arg2)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- NOTE: Arguments can be passed either by value or by reference. In both
- cases you will need to pass &(pval *) to getParameters. If you want to
- check if the n'th parameter was sent to you by reference or not, you can
- use the function, ParameterPassedByReference(ht,n). It will return either
- 1 or 0.
-
- When you change any of the passed parameters, whether they are sent by
- reference or by value, you can either start over with the parameter by
- calling pval_destructor on it, or if it's an ARRAY you want to add to,
- you can use functions similar to the ones in internal_functions.h which
- manipulate return_value as an ARRAY.
-
- Also if you change a parameter to IS_STRING make sure you first assign
- the new estrdup'ed string and the string length, and only later change the
- type to IS_STRING. If you change the string of a parameter which already
- IS_STRING or IS_ARRAY you should run pval_destructor on it first.
-
------------------
-
-3. Variable number of function arguments
-
- A function can take a variable number of arguments. If your function can
- take either 2 or 3 arguments, use the following:
-
- pval *arg1, *arg2, *arg3;
- int arg_count = ARG_COUNT(ht);
-
- if (arg_count<2 || arg_count>3 ||
- getParameters(ht,arg_count,&arg1,&arg2,&arg3)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
-------------------
-
-4. Using the function arguments
-
- The type of each argument is stored in the pval type field:
-
-
- This type can be any of the following:
-
- IS_STRING String
- IS_DOUBLE Double-precision floating point
- IS_LONG Long
- IS_ARRAY Array
-
- IS_EMPTY ??
- IS_USER_FUNCTION ??
- IS_INTERNAL_FUNCTION ?? (if some of these cannot be passed to a
- function - delete)
- IS_CLASS ??
- IS_OBJECT ??
-
- If you get an argument of one type and would like to use it as another,
- or if you just want to force the argument to be of a certain type, you
- can use one of the following conversion functions:
-
- convert_to_long(arg1);
- convert_to_double(arg1);
- convert_to_string(arg1);
- convert_to_boolean_long(arg1); If the string is "" or "0" it
- becomes 0, 1 otherwise
- convert_string_to_number(arg1); Converts string to either LONG or
- DOUBLE depending on string
-
- These function all do in-place conversion. They do not return anything.
-
- The actual argument is stored in a union.
-
- For type IS_STRING, use arg1->value.str.val
- IS_LONG arg1->value.lval
- IS_DOUBLE arg1->value.dval
-
--------------------
-
-5. Memory management in functions
-
- Any memory needed by a function should be allocated with either emalloc()
- or estrdup(). These are memory handling abstraction functions that look
- and smell like the normal malloc() and strdup() functions. Memory should
- be freed with efree().
-
- There are two kinds of memory in this program. Memory which is returned
- to the parser in a variable and memory which you need for temporary
- storage in your internal function. When you assign a string to a
- variable which is returned to the parser you need to make sure you first
- allocate the memory with either emalloc or estrdup. This memory
- should NEVER be freed by you, unless you later, in the same function
- overwrite your original assignment (this kind of programming practice is
- not good though).
-
- For any temporary/permanent memory you need in your functions/library you
- should use the three emalloc(), estrdup(), and efree() functions. They
- behave EXACTLY like their counterpart functions. Anything you emalloc()
- or estrdup() you have to efree() at some point or another, unless it's
- supposed to stick around until the end of the program, otherwise there
- will be a memory leak. The meaning of "the functions behave exactly like
- their counterparts" is if you efree() something which was not
- emalloc()'ed nor estrdup()'ed you might get a segmentation fault. So
- please take care and free all of your wasted memory. One of the biggest
- improvements in PHP 3.0 will hopefully be the memory management.
-
- If you compile with "-DDEBUG", PHP3 will print out a list of all
- memory that was allocated using emalloc() and estrdup() but never
- freed with efree() when it is done running the specified script.
-
--------------------
-
-6. Setting variables in the symbol table
-
- A number of macros are available which make it easier to set a variable
- in the symbol table:
-
- SET_VAR_STRING(name,value) **
- SET_VAR_DOUBLE(name,value)
- SET_VAR_LONG(name,value)
-
- ** Be careful here. The value part must be malloc'ed manually because
- the memory management code will try to free this pointer later. Do
- not pass statically allocated memory into a SET_VAR_STRING
-
- Symbol tables in PHP 3.0 are implemented as hash tables. At any given time,
- &symbol_table is a pointer to the 'main' symbol table, and active_symbol_table
- points to the currently active symbol table (these may be identical like in
- startup, or different, if you're inside a function).
-
- The following examples use 'active_symbol_table'. You should replace it with
- &symbol_table if you specifically want to work with the 'main' symbol table.
- Also, the same funcions may be applied to arrays, as explained below.
-
- * To check whether a variable named $foo already exists in a symbol table:
- if (hash_exists(active_symbol_table,"foo",sizeof("foo"))) { exists... }
- else { doesn't exist }
-
- * If you also need to get the type of the variable, you can use:
- hash_find(active_symbol_table,"foo",sizeof("foo"),&pvalue);
- check(pvalue.type);
-
- Arrays in PHP 3.0 are implemented using the same hashtables as symbol tables.
- This means the two above functions can also be used to check variables
- inside arrays.
-
- If you want to define a new array in a symbol table, you should do this:
-
- 1. Possibly check it exists and abort, using hash_exists()
- or hash_find().
- 2. Code:
-
- pval arr;
-
- if (array_init(&arr) == FAILURE) { failed... };
- hash_update(active_symbol_table,"foo",sizeof("foo"),&arr,sizeof(pval),NULL);
-
- This code declares a new array, named $foo, in the active symbol table.
- This array is empty.
-
- Here's how to add new entries to it:
-
- pval entry;
-
- entry.type = IS_LONG;
- entry.value.lval = 5;
-
- hash_update(arr.value.ht,"bar",sizeof("bar"),&entry,sizeof(pval),NULL); /* defines $foo["bar"] = 5 */
- hash_index_update(arr.value.ht,7,&entry,sizeof(pval),NULL); /* defines $foo[7] = 5 */
- hash_next_index_insert(arr.value.ht,&entry,sizeof(pval),NULL); /* defines the next free place in $foo[],
- * $foo[8], to be 5 (works like php2)
- */
-
- If you'd like to modify a value that you inserted to a hash, you must first retreive it from the hash. To
- prevent that overhead, you can supply a pval ** to the hash add function, and it'll be updated with the
- pval * address of the inserted element inside the hash. If that value is NULL (like in all of the
- above examples) - that parameter is ignored.
-
- hash_next_index_insert() works more or less using the same logic
- "$foo[] = bar;" works in PHP 2.0.
-
- If you are building an array to return from a function, you can initialize
- the array just like above by doing:
-
- if (array_init(return_value) == FAILURE) { failed...; }
-
- and then adding values with the helper functions:
-
- add_next_index_long(return_value,long_value);
- add_next_index_double(return_value,double_value);
- add_next_index_string(return_value,estrdup(string_value));
-
- Of course, if the adding isn't done right after the array
- initialization, you'd probably have to look for the array first:
-
- pval *arr;
-
- if (hash_find(active_symbol_table,"foo",sizeof("foo"),(void **)&arr)==FAILURE) { can't find... }
- else { use arr->value.ht... }
-
- Note that hash_find receives a pointer to a pval pointer, and
- not a pval pointer.
-
- Just about any hash function returns SUCCESS or FAILURE (except for
- hash_exists() that returns a boolean truth value).
-
--------------------
-
-7. Returning 'simple' values from functions (integers, floats or strings)
-
- A number of macros are available to make it easier to return things from
- functions:
-
- These set the return value and return from the function:
-
- RETURN_FALSE
- RETURN_TRUE
- RETURN_LONG(l)
- RETURN_STRING(s,dup) If dup is true, duplicates the string
- RETURN_STRINGL(s,l,dup) Return string (s) specifying length (l).
- RETURN_DOUBLE(d)
-
- These only set the return value:
-
- RETVAL_FALSE
- RETVAL_TRUE
- RETVAL_LONG(l)
- RETVAL_STRING(s,dup) If dup is true, duplicates the string
- RETVAL_STRINGL(s,l,dup) Return string (s) specifying length (l).
- RETVAL_DOUBLE(d)
-
- The string macros above will all estrdup() the passed 's' argument,
- so you can safely free the argument after calling the macro, or
- alternatively use statically allocated memory.
-
- If your function returns boolean success/error responses, always use
- RETURN_TRUE and RETURN_FALSE respectively.
-
--------------------
-
-8. Returning 'complex' values from functions (arrays or objects)
-
- Your function can also return a complex data type such as an object
- or an array.
-
- Returning an object:
-
- 1. Call object_init(return_value).
- 2. Fill it up with values:
-
- add_property_long(return_value,property_name,l) Add a property named 'property_name', of type long, equals to 'l'
- add_property_double(return_value,property_name,d) Same, only a double
- add_property_string(return_value,property_name,str) Same, only a string
- add_property_stringl(return_value,property_name,str,l) Add a property named 'property_name', of type string, string is 'str' with length 'l'
-
- 3. Possibly, register functions for this object. In order to
- obtain values from the object, the function would have to fetch
- "this" from the active_symbol_table. Its type should be IS_OBJECT,
- and it's basically a regular hash table (i.e., you can use regular
- hash functions on .value.ht). The actual registration of the
- function can be done using:
-
- add_method(return_value,function_name,function_ptr)
-
-
- Returning an array:
-
- 1. Call array_init(return_value).
- 2. Fill it up with values:
-
- add_assoc_long(return_value,key,l) add associative entry with key 'key' and long value 'l'
- add_assoc_double(return_value,key,d)
- add_assoc_string(return_value,key,str)
- add_assoc_stringl(return_value,key,str,length) specify the string length
-
- add_index_long(return_value,index,l) add entry in index 'index' with long value 'l'
- add_index_double(return_value,index,d)
- add_index_string(return_value,index,str)
- add_index_stringl(return_value,index,str,length) specify the string length
-
- add_next_index_long(return_value,l) add an array entry in the next free offset with long value 'l'
- add_next_index_double(return_value,d)
- add_next_index_string(return_value,str)
- add_next_index_stringl(return_value,str,length) specify the string length
-
--------------------
-
-9. Using the resource list
-
- PHP 3.0 has a standard way of dealing with various types of resources,
- that replaces all of the local linked lists in PHP 2.0.
-
- Available functions:
-
- php3_list_insert(ptr, type) returns the 'id' of the newly inserted resource
- php3_list_delete(id) delete the resource with the specified id
- php3_list_find(id,*type) returns the pointer of the resource with the specified id, updates 'type' to the resource's type
-
- Typically, these functions are used for SQL drivers but they can be
- used for anything else, and are used, for instance, for maintaining
- file descriptors.
-
- Typical list code would look like this:
-
- Adding a new resource:
-
- RESOURCE *resource;
-
- ...allocate memory for resource and acquire resource...
- /* add a new resource to the list */
- return_value->value.lval = php3_list_insert((void *) resource, LE_RESOURCE_TYPE);
- return_value->type = IS_LONG;
-
- Using an existing resource:
-
- pval *resource_id;
- RESOURCE *resource;
- int type;
-
- convert_to_long(resource_id);
- resource = php3_list_find(resource_id->value.lval, &type);
- if (type != LE_RESOURCE_TYPE) {
- php3_error(E_WARNING,"resource index %d has the wrong type",resource_id->value.lval);
- RETURN_FALSE;
- }
- ...use resource...
-
- Deleting an existing resource:
-
- pval *resource_id;
- RESOURCE *resource;
- int type;
-
- convert_to_long(resource_id);
- php3_list_delete(resource_id->value.lval);
-
-
- The resource types should be registered in php3_list.h, in enum
- list_entry_type. In addition, one should add shutdown code for any
- new resource type defined, in list.c's list_entry_destructor() (even if
- you don't have anything to do on shutdown, you must add an empty case).
-
--------------------
-
-10. Using the persistent resource table
-
- PHP 3.0 has a standard way of storing persistent resources (i.e.,
- resources that are kept in between hits). The first module to use
- this feature was the MySQL module, and mSQL followed it, so one can
- get the general impression of how a persistent resource should be
- used by reading mysql.c. The functions you should look at are:
- php3_mysql_do_connect()
- php3_mysql_connect()
- php3_mysql_pconnect()
-
- The general idea of persistence modules is this:
- 1. Code all of your module to work with the regular resource list
- mentioned in section (9).
- 2. Code extra connect functions that check if the resource already
- exists in the persistent resource list. If it does, register it
- as in the regular resource list as a pointer to the persistent
- resource list (because of 1., the rest of the code
- should work immediately). If it doesn't, then create it, add it
- to the persistent resource list AND add a pointer to it from the
- regular resource list, so all of the code would work since it's
- in the regular resource list, but on the next connect, the
- resource would be found in the persistent resource list and be
- used without having to recreate it.
- You should register these resources with a different type (e.g.
- LE_MYSQL_LINK for non-persistent link and LE_MYSQL_PLINK for
- a persistent link).
-
- If you read mysql.c, you'll notice that except for the more complex
- connect function, nothing in the rest of the module has to be changed.
-
- The very same interface exists for the regular resource list and the
- persistent resource list, only 'list' is replaced with 'plist':
-
- php3_plist_insert(ptr, type) returns the 'id' of the newly inserted resource
- php3_plist_delete(id) delete the resource with the specified id
- php3_plist_find(id,*type) returns the pointer of the resource with the specified id, updates 'type' to the resource's type
-
- However, it's more than likely that these functions would prove
- to be useless for you when trying to implement a persistent module.
- Typically, one would want to use the fact that the persistent resource
- list is really a hash table. For instance, in the MySQL/mSQL modules,
- when there's a pconnect() call (persistent connect), the function
- builds a string out of the host/user/passwd that were passed to the
- function, and hashes the SQL link with this string as a key. The next
- time someone calls a pconnect() with the same host/user/passwd, the
- same key would be generated, and the function would find the SQL link
- in the persistent list.
-
- Until further documented, you should look at mysql.c or msql.c to
- see how one should use the plist's hash table abilities.
-
- One important thing to note: resources going into the persistent
- resource list must *NOT* be allocated with PHP's memory manager, i.e.,
- they should NOT be created with emalloc(), estrdup(), etc. Rather,
- one should use the regular malloc(), strdup(), etc. The reason for
- this is simple - at the end of the request (end of the hit), every
- memory chunk that was allocated using PHP's memory manager is deleted.
- Since the persistent list isn't supposed to be erased at the end
- of a request, one mustn't use PHP's memory manager for allocating
- resources that go to it.
-
- Shutting down persistent resources:
-
- When you register resource that's going to be in the persistent list,
- you should add destructors to it both in the non-persistent list
- and in the persistent list.
- The destructor in the non-persistent list destructor shouldn't do anything.
- The one in the persistent list destructor should properly free any
- resources obtained by that type (e.g. memory, SQL links, etc). Just like
- with the non-persistent resources, you *MUST* add destructors for every
- resource, even it requires no destructotion and the destructor would
- be empty.
- Remember, since emalloc() and friends aren't to be used in conjunction
- with the persistent list, you mustn't use efree() here either.
-
--------------------
-
-11. Adding runtime configuration directives
-
-Many of the features of PHP3 can be configured at runtime. These
-configuration directives can appear in either the designated php3.ini
-file, or in the case of the Apache module version in the Apache .conf
-files. The advantage of having them in the Apache .conf files is that
-they can be configured on a per-directory basis. This means that one
-directory may have a certain safemodeexecdir for example, while another
-directory may have another. This configuration granularity is especially
-handy when a server supports multiple virtual hosts.
-
-The steps required to add a new directive:
-
- 1. Add directive to php3_ini_structure struct in mod_php4.h.
-
- 2. In main.c, edit the php3_module_startup function and add the
- appropriate cfg_get_string() or cfg_get_long() call.
-
- 3. Add the directive, restrictions and a comment to the php3_commands
- structure in mod_php4.c. Note the restrictions part. RSRC_CONF are
- directives that can only be present in the actual Apache .conf files.
- Any OR_OPTIONS directives can be present anywhere, include normal
- .htaccess files.
-
- 4. In either php3take1handler() or php3flaghandler() add the appropriate
- entry for your directive.
-
- 5. In the configuration section of the _php3_info() function in
- functions/info.c you need to add your new directive.
-
- 6. And last, you of course have to use your new directive somewhere.
- It will be addressable as php3_ini.directive
diff --git a/build/bsd_makefile b/build/bsd_makefile
deleted file mode 100755
index 472b561822..0000000000
--- a/build/bsd_makefile
+++ /dev/null
@@ -1,34 +0,0 @@
-#! /bin/sh
-# +----------------------------------------------------------------------+
-# | PHP version 4.0 |
-# +----------------------------------------------------------------------+
-# | Copyright (c) 1997, 1998, 1999, 2000 The PHP Group |
-# +----------------------------------------------------------------------+
-# | This source file is subject to version 2.02 of the PHP license, |
-# | that is bundled with this package in the file LICENSE, and is |
-# | available at through the world-wide-web at |
-# | http://www.php.net/license/2_02.txt. |
-# | If you did not receive a copy of the PHP license and are unable to |
-# | obtain it through the world-wide-web, please send a note to |
-# | license@php.net so we can mail you a copy immediately. |
-# +----------------------------------------------------------------------+
-# | Authors: Sascha Schumann <sascha@schumann.cx> |
-# +----------------------------------------------------------------------+
-#
-# $Id$
-#
-
-# cwd must be top_srcdir
-test -f build/bsd_makefile || exit 2
-
-test -f bsd_converted && exit 0
-
-tmpfile=`mktemp /tmp/bsd_makefile.XXXXXX 2>/dev/null` || tmpfile="tmp.$$"
-for i in build/*.mk; do
- sed 's/^include \(.*\)/.include "\1"/' $i >$tmpfile \
- && cp $tmpfile $i
-done
-rm -f $tmpfile
-
-touch bsd_converted
-exit 0
diff --git a/build/build.mk b/build/build.mk
deleted file mode 100644
index c23483b962..0000000000
--- a/build/build.mk
+++ /dev/null
@@ -1,71 +0,0 @@
-# +----------------------------------------------------------------------+
-# | PHP version 4.0 |
-# +----------------------------------------------------------------------+
-# | Copyright (c) 1997, 1998, 1999, 2000 The PHP Group |
-# +----------------------------------------------------------------------+
-# | This source file is subject to version 2.02 of the PHP license, |
-# | that is bundled with this package in the file LICENSE, and is |
-# | available at through the world-wide-web at |
-# | http://www.php.net/license/2_02.txt. |
-# | If you did not receive a copy of the PHP license and are unable to |
-# | obtain it through the world-wide-web, please send a note to |
-# | license@php.net so we can mail you a copy immediately. |
-# +----------------------------------------------------------------------+
-# | Authors: Sascha Schumann <sascha@schumann.cx> |
-# +----------------------------------------------------------------------+
-#
-# $Id$
-#
-#
-# Makefile to generate build tools
-#
-
-SUBDIRS = Zend TSRM
-
-STAMP = buildmk.stamp
-
-ALWAYS = generated_lists
-
-all: $(STAMP) $(ALWAYS)
- @$(MAKE) AMFLAGS=$(AMFLAGS) -s -f build/build2.mk
-
-generated_lists:
- @echo makefile_am_files = Zend/Makefile.am \
- TSRM/Makefile.am > $@
- @echo config_h_files = Zend/acconfig.h TSRM/acconfig.h >> $@
- @echo config_m4_files = Zend/Zend.m4 TSRM/tsrm.m4 \
- Zend/acinclude.m4 ext/*/config*.m4 sapi/*/config.m4 >> $@
-
-$(STAMP): build/buildcheck.sh
- @build/buildcheck.sh && touch $(STAMP)
-
-snapshot:
- distname='$(DISTNAME)'; \
- if test -z "$$distname"; then \
- distname='php4-snapshot'; \
- fi; \
- myname=`basename \`pwd\`` ; \
- cd .. && cp -rp $$myname $$distname; \
- cd $$distname; \
- rm -f $(SUBDIRS) 2>/dev/null || true; \
- for i in $(SUBDIRS); do \
- test -d $$i || (test -d ../$$i && cp -rp ../$$i $$i); \
- done; \
- find . -type l -exec rm {} \; ; \
- $(MAKE) AMFLAGS=--copy -f build/build.mk; \
- cd ..; \
- tar cf $$distname.tar $$distname; \
- rm -rf $$distname $$distname.tar.*; \
- bzip2 -9 $$distname.tar; \
- md5sum $$distname.tar.bz2; \
- sync; sleep 2; \
- md5sum $$distname.tar.bz2; \
- bzip2 -t $$distname.tar.bz2
-
-cvsclean:
- @for i in `find . -name .cvsignore`; do \
- (cd `dirname $$i` 2>/dev/null && rm -rf `cat .cvsignore` *.o *.a || true); \
- done
- @rm -f $(SUBDIRS) 2>/dev/null || true
-
-.PHONY: $(ALWAYS) snapshot cvsclean
diff --git a/build/build2.mk b/build/build2.mk
deleted file mode 100644
index 528f1de351..0000000000
--- a/build/build2.mk
+++ /dev/null
@@ -1,77 +0,0 @@
-# +----------------------------------------------------------------------+
-# | PHP version 4.0 |
-# +----------------------------------------------------------------------+
-# | Copyright (c) 1997, 1998, 1999, 2000 The PHP Group |
-# +----------------------------------------------------------------------+
-# | This source file is subject to version 2.02 of the PHP license, |
-# | that is bundled with this package in the file LICENSE, and is |
-# | available at through the world-wide-web at |
-# | http://www.php.net/license/2_02.txt. |
-# | If you did not receive a copy of the PHP license and are unable to |
-# | obtain it through the world-wide-web, please send a note to |
-# | license@php.net so we can mail you a copy immediately. |
-# +----------------------------------------------------------------------+
-# | Authors: Sascha Schumann <sascha@schumann.cx> |
-# +----------------------------------------------------------------------+
-#
-# $Id$
-#
-
-include generated_lists
-
-TOUCH_FILES = mkinstalldirs install-sh missing
-
-LT_TARGETS = ltmain.sh config.guess config.sub
-
-makefile_in_files = $(makefile_am_files:.am=.in)
-makefile_files = $(makefile_am_files:e.am=e)
-
-config_h_in = main/php_config.h.in
-
-acconfig_h_SOURCES = acconfig.h.in $(config_h_files)
-
-targets = $(TOUCH_FILES) $(makefile_in_files) configure $(config_h_in)
-
-
-all: Zend/Makefile.am TSRM/Makefile.am $(targets)
-
-Zend/Makefile.am:
- test -d Zend || (test -d ../Zend && ln -s ../Zend Zend)
-
-TSRM/Makefile.am:
- test -d TSRM || (test -d ../TSRM && ln -s ../TSRM TSRM)
-
-acconfig.h: $(acconfig_h_SOURCES)
- @echo rebuilding $@
- cat $(acconfig_h_SOURCES) > $@
-
-$(makefile_in_files): $(makefile_am_files) aclocal.m4 configure.in $(config_m4_files)
- @echo rebuilding Makefile templates
- @for i in $(LT_TARGETS); do \
- if test -f "$$i"; then \
- mv $$i $$i.bak; \
- cp $$i.bak $$i; \
- fi; \
- done
- @test -f want_dependencies || flag=-i; \
- automake -a $$flag $(AMFLAGS) $(makefile_files) 2>&1 | $(SUPPRESS_WARNINGS)
- @for i in $(LT_TARGETS); do mv $$i.bak $$i; done
-
-aclocal.m4: configure.in acinclude.m4 dynlib.m4
- aclocal 2>&1 | $(SUPPRESS_WARNINGS)
-
-SUPPRESS_WARNINGS = (egrep -v '(warning: AC_TRY_RUN called without default to allow cross compiling|AC_PROG_CXXCPP was called before AC_PROG_CXX|.*AM_PROG_LEX.*|defined in acinclude.m4 but never used)'||true)
-
-$(config_h_in): configure acconfig.h
-# explicitly remove target since autoheader does not seem to work
-# correctly otherwise (timestamps are not updated)
- @echo rebuilding $@
- @rm -f $@
- @autoheader 2>&1 | $(SUPPRESS_WARNINGS)
-
-$(TOUCH_FILES):
- touch $(TOUCH_FILES)
-
-configure: aclocal.m4 configure.in $(config_m4_files)
- @echo rebuilding $@
- @autoconf 2>&1 | $(SUPPRESS_WARNINGS)
diff --git a/build/buildcheck.sh b/build/buildcheck.sh
deleted file mode 100755
index 63145deaa1..0000000000
--- a/build/buildcheck.sh
+++ /dev/null
@@ -1,92 +0,0 @@
-#! /bin/sh
-# +----------------------------------------------------------------------+
-# | PHP version 4.0 |
-# +----------------------------------------------------------------------+
-# | Copyright (c) 1997, 1998, 1999, 2000 The PHP Group |
-# +----------------------------------------------------------------------+
-# | This source file is subject to version 2.02 of the PHP license, |
-# | that is bundled with this package in the file LICENSE, and is |
-# | available at through the world-wide-web at |
-# | http://www.php.net/license/2_02.txt. |
-# | If you did not receive a copy of the PHP license and are unable to |
-# | obtain it through the world-wide-web, please send a note to |
-# | license@php.net so we can mail you a copy immediately. |
-# +----------------------------------------------------------------------+
-# | Authors: Stig Bakken <ssb@fast.no> |
-# | Sascha Schumann <sascha@schumann.cx> |
-# +----------------------------------------------------------------------+
-#
-# $Id: buildcheck.sh,v 1.12 2001-06-20 18:21:03 david Exp $
-#
-
-echo "buildconf: checking installation..."
-
-# autoconf 2.13 or newer
-ac_version=`autoconf --version 2>/dev/null|head -1|sed -e 's/^[^0-9]*//' -e 's/[a-z]* *$//'`
-if test -z "$ac_version"; then
-echo "buildconf: autoconf not found."
-echo " You need autoconf version 2.13 or newer installed"
-echo " to build PHP from CVS."
-exit 1
-fi
-IFS=.; set $ac_version; IFS=' '
-if test "$1" = "2" -a "$2" -lt "13" || test "$1" -lt "2"; then
-echo "buildconf: autoconf version $ac_version found."
-echo " You need autoconf version 2.13 or newer installed"
-echo " to build PHP from CVS."
-exit 1
-else
-echo "buildconf: autoconf version $ac_version (ok)"
-fi
-
-# automake 1.4 or newer
-am_version=`automake --version 2>/dev/null|head -1|sed -e 's/^[^0-9]*//' -e 's/[a-z]* *$//'`
-am_version_clean=`echo $am_version|sed -e 's/-p[0-9]*$//'`
-if test "$am_version" = ""; then
-echo "buildconf: automake not found."
-echo " You need automake version 1.4 or newer installed"
-echo " to build PHP from CVS."
-exit 1
-fi
-IFS=.; set $am_version_clean; IFS=' '
-if test "$1" = "1" -a "$2" -lt "4" || test "$1" -lt "1"; then
-echo "buildconf: automake version $am_version found."
-echo " You need automake version 1.4 or newer installed"
-echo " to build PHP from CVS."
-exit 1
-else
-echo "buildconf: automake version $am_version (ok)"
-fi
-
-# libtool 1.4 or newer
-libtool=`which libtool`
-if test ! -f "$libtool"; then libtool=`which glibtool`; fi
-lt_pversion=`$libtool --version 2>/dev/null|sed -e 's/^[^0-9]*//' -e 's/[- ].*//'`
-if test "$lt_pversion" = ""; then
-echo "buildconf: libtool not found."
-echo " You need libtool version 1.4 or newer installed"
-echo " to build PHP from CVS."
-exit 1
-fi
-lt_version=`echo $lt_pversion|sed -e 's/\([a-z]*\)$/.\1/'`
-IFS=.; set $lt_version; IFS=' '
-
-if test "$1" -gt "1" || test "$2" -ge "4";
-then
-echo "buildconf: libtool version $lt_pversion (ok)"
-else
-echo "buildconf: libtool version $lt_pversion found."
-echo " You need libtool version 1.4 or newer installed"
-echo " to build PHP from CVS."
-exit 1
-fi
-
-am_prefix=`which automake | sed -e 's#/[^/]*/[^/]*$##'`
-lt_prefix=`echo $libtool | sed -e 's#/[^/]*/[^/]*$##'`
-if test "$am_prefix" != "$lt_prefix"; then
- echo "WARNING: automake and libtool are installed in different"
- echo " directories. This may cause aclocal to fail."
- echo " continuing anyway"
-fi
-
-exit 0
diff --git a/build/dynlib.mk b/build/dynlib.mk
deleted file mode 100644
index 8df92ac6cf..0000000000
--- a/build/dynlib.mk
+++ /dev/null
@@ -1,24 +0,0 @@
-# +----------------------------------------------------------------------+
-# | PHP version 4.0 |
-# +----------------------------------------------------------------------+
-# | Copyright (c) 1997, 1998, 1999, 2000 The PHP Group |
-# +----------------------------------------------------------------------+
-# | This source file is subject to version 2.02 of the PHP license, |
-# | that is bundled with this package in the file LICENSE, and is |
-# | available at through the world-wide-web at |
-# | http://www.php.net/license/2_02.txt. |
-# | If you did not receive a copy of the PHP license and are unable to |
-# | obtain it through the world-wide-web, please send a note to |
-# | license@php.net so we can mail you a copy immediately. |
-# +----------------------------------------------------------------------+
-# | Authors: Sascha Schumann <sascha@schumann.cx> |
-# +----------------------------------------------------------------------+
-#
-# $Id$
-#
-
-all: all-recursive
-
-include $(builddir)/libs.mk
-
-include $(top_srcdir)/build/rules.mk
diff --git a/build/fastgen.sh b/build/fastgen.sh
deleted file mode 100755
index b9742a9dfe..0000000000
--- a/build/fastgen.sh
+++ /dev/null
@@ -1,76 +0,0 @@
-#! /bin/sh
-#
-# +----------------------------------------------------------------------+
-# | PHP version 4.0 |
-# +----------------------------------------------------------------------+
-# | Copyright (c) 1997, 1998, 1999, 2000 The PHP Group |
-# +----------------------------------------------------------------------+
-# | This source file is subject to version 2.02 of the PHP license, |
-# | that is bundled with this package in the file LICENSE, and is |
-# | available at through the world-wide-web at |
-# | http://www.php.net/license/2_02.txt. |
-# | If you did not receive a copy of the PHP license and are unable to |
-# | obtain it through the world-wide-web, please send a note to |
-# | license@php.net so we can mail you a copy immediately. |
-# +----------------------------------------------------------------------+
-# | Authors: Sascha Schumann <sascha@schumann.cx> |
-# +----------------------------------------------------------------------+
-#
-# $Id: fastgen.sh,v 1.10 2001-05-20 22:04:23 sas Exp $
-#
-
-srcdir=$1
-shift
-
-mkdir_p=$1
-shift
-
-bsd_makefile=$1
-shift
-
-top_srcdir=`(cd $srcdir; pwd)`
-top_builddir=`pwd`
-
-if test "$mkdir_p" = "yes"; then
- mkdir_p="mkdir -p"
-else
- mkdir_p="$top_srcdir/build/shtool mkdir -p"
-fi
-
-if test "$bsd_makefile" = "yes"; then
- (cd $top_srcdir; ./build/bsd_makefile)
-
- for makefile in $@; do
- echo "creating $makefile"
- dir=`echo $makefile|sed 's%/*[^/][^/]*$%%'`
- $mkdir_p "$dir/"
-
- cat - $top_srcdir/$makefile.in <<EOF |sed 's/^include \(.*\)/.include "\1"/' >$makefile
-top_srcdir = $top_srcdir
-top_builddir = $top_builddir
-srcdir = $top_srcdir/$dir
-builddir = $top_builddir/$dir
-VPATH = $top_srcdir/$dir
-EOF
-
- test -z "$dir" && dir=.
- touch $dir/.deps
- done
-else
- for makefile in $@; do
- echo "creating $makefile"
- dir=`echo $makefile|sed 's%/*[^/][^/]*$%%'`
- $mkdir_p "$dir/"
-
- cat - $top_srcdir/$makefile.in <<EOF >$makefile
-top_srcdir = $top_srcdir
-top_builddir = $top_builddir
-srcdir = $top_srcdir/$dir
-builddir = $top_builddir/$dir
-VPATH = $top_srcdir/$dir
-EOF
-
- test -z "$dir" && dir=.
- touch $dir/.deps
- done
-fi
diff --git a/build/genif.sh b/build/genif.sh
deleted file mode 100644
index 947ec2ffaa..0000000000
--- a/build/genif.sh
+++ /dev/null
@@ -1,41 +0,0 @@
-#! /bin/sh
-
-# $Id: genif.sh,v 1.2 2001-03-30 14:02:20 sas Exp $
-# replacement for genif.pl
-
-infile="$1"
-shift
-srcdir="$1"
-shift
-extra_module_ptrs="$1"
-shift
-awk="$1"
-shift
-
-if test "$infile" = "" -o "$srcdir" = ""; then
- echo "please supply infile and srcdir"
- exit 1
-fi
-
-module_ptrs="$extra_module_ptrs"
-header_list=""
-olddir=`pwd`
-cd $srcdir
-
-for ext in ${1+"$@"} ; do
- module_ptrs=" phpext_${ext}_ptr,@NEWLINE@$module_ptrs"
- header_list="$header_list ext/$ext/*.h"
-done
-
-includes=`$awk -f ./build/print_include.awk $header_list`
-
-cd $olddir
-
-cat $infile | \
- sed \
- -e "s'@EXT_INCLUDE_CODE@'$includes'" \
- -e "s'@EXT_MODULE_PTRS@'$module_ptrs'" \
- -e 's/@NEWLINE@/\
-/g'
-
-
diff --git a/build/library.mk b/build/library.mk
deleted file mode 100644
index 8cb86760e4..0000000000
--- a/build/library.mk
+++ /dev/null
@@ -1,23 +0,0 @@
-# +----------------------------------------------------------------------+
-# | PHP version 4.0 |
-# +----------------------------------------------------------------------+
-# | Copyright (c) 1997, 1998, 1999, 2000 The PHP Group |
-# +----------------------------------------------------------------------+
-# | This source file is subject to version 2.02 of the PHP license, |
-# | that is bundled with this package in the file LICENSE, and is |
-# | available at through the world-wide-web at |
-# | http://www.php.net/license/2_02.txt. |
-# | If you did not receive a copy of the PHP license and are unable to |
-# | obtain it through the world-wide-web, please send a note to |
-# | license@php.net so we can mail you a copy immediately. |
-# +----------------------------------------------------------------------+
-# | Authors: Sascha Schumann <sascha@schumann.cx> |
-# +----------------------------------------------------------------------+
-#
-# $Id$
-#
-
-LTLIBRARY_OBJECTS = $(LTLIBRARY_SOURCES:.c=.lo) $(LTLIBRARY_OBJECTS_X)
-
-$(LTLIBRARY_NAME): $(LTLIBRARY_OBJECTS) $(LTLIBRARY_DEPENDENCIES)
- $(LINK) $(LTLIBRARY_LDFLAGS) $(LTLIBRARY_OBJECTS) $(LTLIBRARY_LIBADD)
diff --git a/build/ltlib.mk b/build/ltlib.mk
deleted file mode 100644
index ca68d5d15e..0000000000
--- a/build/ltlib.mk
+++ /dev/null
@@ -1,24 +0,0 @@
-# +----------------------------------------------------------------------+
-# | PHP version 4.0 |
-# +----------------------------------------------------------------------+
-# | Copyright (c) 1997, 1998, 1999, 2000 The PHP Group |
-# +----------------------------------------------------------------------+
-# | This source file is subject to version 2.02 of the PHP license, |
-# | that is bundled with this package in the file LICENSE, and is |
-# | available at through the world-wide-web at |
-# | http://www.php.net/license/2_02.txt. |
-# | If you did not receive a copy of the PHP license and are unable to |
-# | obtain it through the world-wide-web, please send a note to |
-# | license@php.net so we can mail you a copy immediately. |
-# +----------------------------------------------------------------------+
-# | Authors: Sascha Schumann <sascha@schumann.cx> |
-# +----------------------------------------------------------------------+
-#
-# $Id$
-#
-
-targets = $(LTLIBRARY_NAME)
-
-include $(top_srcdir)/build/rules.mk
-include $(top_srcdir)/build/library.mk
-
diff --git a/build/mkdep.awk b/build/mkdep.awk
deleted file mode 100644
index 9eb5e6f611..0000000000
--- a/build/mkdep.awk
+++ /dev/null
@@ -1,75 +0,0 @@
-# +----------------------------------------------------------------------+
-# | PHP version 4.0 |
-# +----------------------------------------------------------------------+
-# | Copyright (c) 2000 The PHP Group |
-# +----------------------------------------------------------------------+
-# | This source file is subject to version 2.02 of the PHP license, |
-# | that is bundled with this package in the file LICENSE, and is |
-# | available at through the world-wide-web at |
-# | http://www.php.net/license/2_02.txt. |
-# | If you did not receive a copy of the PHP license and are unable to |
-# | obtain it through the world-wide-web, please send a note to |
-# | license@php.net so we can mail you a copy immediately. |
-# +----------------------------------------------------------------------+
-# | Authors: Sascha Schumann <sascha@schumann.cx> |
-# +----------------------------------------------------------------------+
-#
-# $Id$
-#
-# Usage:
-#
-# echo top_srcdir top_builddir srcdir CPP [CPP-ARGS] filenames | \
-# awk -f mkdep.awk > dependencies
-
-
-{
- top_srcdir=$1
- top_builddir=$2
- srcdir=$3
- cmd=$4
-
- for (i = 5; i <= NF; i++) {
- if (match($i, "^-[A-Z]") == 0)
- break;
- cmd=cmd " " $i
- }
-
- dif=i-1
-
- for (; i <= NF; i++)
- filenames[i-dif]=$i
-
- no_files=NF-dif
-
- for(i = 1; i <= no_files; i++) {
- if (system("test -r " filenames[i]) != 0)
- continue
-
- target=filenames[i]
- sub(srcdir "/", "", target)
- target2=target
- sub("\.(c|cpp)$", ".lo", target);
- sub("\.(c|cpp)$", ".slo", target2);
-
- for (e in used)
- delete used[e]
-
- cmdx=cmd " " filenames[i]
- done=0
- while ((cmdx | getline) > 0) {
- if (match($0, "^# [0-9]* \".*\.h\"") != 0) {
- if (sub(top_srcdir, "$(top_srcdir)", $3) == 0)
- sub(top_builddir, "$(top_builddir)", $3)
- if (substr($3,2,1) != "/" && used[$3] != 1) {
- if (done == 0)
- printf(target " " target2 ":")
- done=1
- printf(" \\\n\t" substr($3,2,length($3)-2))
- used[$3] = 1;
- }
- }
- }
- if (done == 1)
- print "\n"
- }
-}
diff --git a/build/print_include.awk b/build/print_include.awk
deleted file mode 100644
index a4919fae87..0000000000
--- a/build/print_include.awk
+++ /dev/null
@@ -1,6 +0,0 @@
-/phpext_/ {
- if (old_filename != FILENAME) {
- printf "#include \"" FILENAME "\"@NEWLINE@"
- old_filename = FILENAME
- }
-}
diff --git a/build/program.mk b/build/program.mk
deleted file mode 100644
index f79feecb19..0000000000
--- a/build/program.mk
+++ /dev/null
@@ -1,23 +0,0 @@
-# +----------------------------------------------------------------------+
-# | PHP version 4.0 |
-# +----------------------------------------------------------------------+
-# | Copyright (c) 1997, 1998, 1999, 2000 The PHP Group |
-# +----------------------------------------------------------------------+
-# | This source file is subject to version 2.02 of the PHP license, |
-# | that is bundled with this package in the file LICENSE, and is |
-# | available at through the world-wide-web at |
-# | http://www.php.net/license/2_02.txt. |
-# | If you did not receive a copy of the PHP license and are unable to |
-# | obtain it through the world-wide-web, please send a note to |
-# | license@php.net so we can mail you a copy immediately. |
-# +----------------------------------------------------------------------+
-# | Authors: Sascha Schumann <sascha@schumann.cx> |
-# +----------------------------------------------------------------------+
-#
-# $Id$
-#
-
-PROGRAM_OBJECTS = $(PROGRAM_SOURCES:.c=.lo)
-
-$(PROGRAM_NAME): $(PROGRAM_DEPENDENCIES) $(PROGRAM_OBJECTS)
- $(LINK) $(PROGRAM_LDFLAGS) $(PROGRAM_OBJECTS) $(PROGRAM_LDADD)
diff --git a/build/rules.mk b/build/rules.mk
deleted file mode 100644
index 63fab34b21..0000000000
--- a/build/rules.mk
+++ /dev/null
@@ -1,68 +0,0 @@
-# +----------------------------------------------------------------------+
-# | PHP version 4.0 |
-# +----------------------------------------------------------------------+
-# | Copyright (c) 1997, 1998, 1999, 2000 The PHP Group |
-# +----------------------------------------------------------------------+
-# | This source file is subject to version 2.02 of the PHP license, |
-# | that is bundled with this package in the file LICENSE, and is |
-# | available at through the world-wide-web at |
-# | http://www.php.net/license/2_02.txt. |
-# | If you did not receive a copy of the PHP license and are unable to |
-# | obtain it through the world-wide-web, please send a note to |
-# | license@php.net so we can mail you a copy immediately. |
-# +----------------------------------------------------------------------+
-# | Authors: Sascha Schumann <sascha@schumann.cx> |
-# +----------------------------------------------------------------------+
-#
-# $Id$
-#
-
-include $(top_srcdir)/build/rules_common.mk
-
-all: all-recursive
-install: install-recursive
-
-distclean-recursive depend-recursive clean-recursive all-recursive install-recursive:
- @otarget=`echo $@|sed s/-recursive//`; \
- list='$(SUBDIRS)'; for i in $$list; do \
- target="$$otarget"; \
- echo "Making $$target in $$i"; \
- if test "$$i" = "."; then \
- ok=yes; \
- target="$$target-p"; \
- fi; \
- (cd $$i && $(MAKE) $$target) || exit 1; \
- done; \
- if test "$$otarget" = "all" && test -z '$(targets)'; then ok=yes; fi; \
- if test "$$ok" != "yes"; then $(MAKE) "$$otarget-p" || exit 1; fi
-
-all-p: $(targets)
-install-p: $(targets) $(install_targets)
-distclean-p depend-p clean-p:
-
-depend: depend-recursive
- @echo $(top_srcdir) $(top_builddir) $(srcdir) $(CPP) $(INCLUDES) $(EXTRA_INCLUDES) $(DEFS) $(CPPFLAGS) $(srcdir)/*.c *.c | $(AWK) -f $(top_srcdir)/build/mkdep.awk > $(builddir)/.deps || true
-
-clean: clean-recursive clean-x
-
-clean-x:
- rm -f $(targets) *.lo *.slo *.la *.o $(CLEANFILES)
- rm -rf .libs
-
-distclean: distclean-recursive clean-x
- rm -f config.cache config.log config.status config_vars.mk libtool \
- php_config.h stamp-h Makefile build-defs.h php4.spec libphp4.module
-
-test: $(top_builddir)/php
- @if test "$(TESTS)" = ""; then \
- TOP_BUILDDIR=$(top_builddir) TOP_SRCDIR=$(top_srcdir) $(top_builddir)/php -C -q $(top_srcdir)/run-tests.php $(srcdir); \
- else \
- TOP_BUILDDIR=$(top_builddir) TOP_SRCDIR=$(top_srcdir) $(top_builddir)/php -C -q $(top_srcdir)/run-tests.php $(TESTS); \
- fi
-
-include $(builddir)/.deps
-
-.PHONY: all-recursive clean-recursive install-recursive \
-$(install_targets) install all clean depend depend-recursive shared \
-distclean-recursive distclean clean-x all-p install-p distclean-p \
-depend-p clean-p
diff --git a/build/rules_common.mk b/build/rules_common.mk
deleted file mode 100644
index bab3a16343..0000000000
--- a/build/rules_common.mk
+++ /dev/null
@@ -1,76 +0,0 @@
-# +----------------------------------------------------------------------+
-# | PHP version 4.0 |
-# +----------------------------------------------------------------------+
-# | Copyright (c) 1997, 1998, 1999, 2000 The PHP Group |
-# +----------------------------------------------------------------------+
-# | This source file is subject to version 2.02 of the PHP license, |
-# | that is bundled with this package in the file LICENSE, and is |
-# | available at through the world-wide-web at |
-# | http://www.php.net/license/2_02.txt. |
-# | If you did not receive a copy of the PHP license and are unable to |
-# | obtain it through the world-wide-web, please send a note to |
-# | license@php.net so we can mail you a copy immediately. |
-# +----------------------------------------------------------------------+
-# | Authors: Sascha Schumann <sascha@schumann.cx> |
-# +----------------------------------------------------------------------+
-#
-# $Id$
-#
-
-include $(top_builddir)/config_vars.mk
-
-COMMON_FLAGS = $(DEFS) $(INCLUDES) $(EXTRA_INCLUDES) $(CPPFLAGS)
-COMPILE = $(CC) $(COMMON_FLAGS) $(CFLAGS) $(EXTRA_CFLAGS)
-CXX_COMPILE = $(CXX) $(COMMON_FLAGS) $(CXXFLAGS) $(EXTRA_CXXFLAGS)
-
-SHARED_COMPILE = $(SHARED_LIBTOOL) --mode=compile $(CC) $(COMMON_FLAGS) $(CFLAGS_CLEAN) -prefer-pic $(EXTRA_CFLAGS) -c $< && touch $@
-CXX_SHARED_COMPILE = $(SHARED_LIBTOOL) --mode=compile $(CXX) $(COMMON_FLAGS) $(CXXFLAGS_CLEAN) -prefer-pic $(EXTRA_CXXFLAGS) -c $< && touch $@
-
-LINK = $(LIBTOOL) --mode=link $(COMPILE) $(LDFLAGS) -o $@
-
-mkinstalldirs = $(top_srcdir)/build/shtool mkdir -p
-INSTALL = $(top_srcdir)/build/shtool install -c
-INSTALL_DATA = $(INSTALL) -m 644
-
-DEFS = -I. -I$(srcdir) -I$(top_builddir)/main -I$(top_srcdir)
-
-moduledir = $(EXTENSION_DIR)
-
-CXX_SUFFIX = .cpp
-
-.SUFFIXES:
-.SUFFIXES: .slo .c $(CXX_SUFFIX) .lo .o .s .y .l
-
-.c.o:
- $(COMPILE) -c $<
-
-$(CXX_SUFFIX).o:
- $(CXX_COMPILE) -c $<
-
-.s.o:
- $(COMPILE) -c $<
-
-.c.lo:
- $(PHP_COMPILE)
-
-$(CXX_SUFFIX).lo:
- $(CXX_PHP_COMPILE)
-
-.s.lo:
- $(PHP_COMPILE)
-
-.c.slo:
- $(SHARED_COMPILE)
-
-$(CXX_SUFFIX).slo:
- $(CXX_SHARED_COMPILE)
-
-.y.c:
- $(YACC) $(YFLAGS) $< && mv y.tab.c $*.c
- if test -f y.tab.h; then \
- if cmp -s y.tab.h $*.h; then rm -f y.tab.h; else mv y.tab.h $*.h; fi; \
- else :; fi
-
-.l.c:
- $(LEX) $(LFLAGS) $< && mv $(LEX_OUTPUT_ROOT).c $@
-
diff --git a/build/rules_pear.mk b/build/rules_pear.mk
deleted file mode 100644
index befc3cf5cb..0000000000
--- a/build/rules_pear.mk
+++ /dev/null
@@ -1,76 +0,0 @@
-# +----------------------------------------------------------------------+
-# | PHP version 4.0 |
-# +----------------------------------------------------------------------+
-# | Copyright (c) 1997, 1998, 1999, 2000 The PHP Group |
-# +----------------------------------------------------------------------+
-# | This source file is subject to version 2.02 of the PHP license, |
-# | that is bundled with this package in the file LICENSE, and is |
-# | available at through the world-wide-web at |
-# | http://www.php.net/license/2_02.txt. |
-# | If you did not receive a copy of the PHP license and are unable to |
-# | obtain it through the world-wide-web, please send a note to |
-# | license@php.net so we can mail you a copy immediately. |
-# +----------------------------------------------------------------------+
-# | Authors: Sascha Schumann <sascha@schumann.cx> |
-# +----------------------------------------------------------------------+
-#
-# $Id$
-#
-
-include $(top_srcdir)/build/rules_common.mk
-
-install_targets = install-modules
-
-all: all-recursive
-install: install-recursive
-
-distclean-recursive depend-recursive clean-recursive all-recursive install-recursive:
- @otarget=`echo $@|sed s/-recursive//`; \
- list='$(SUBDIRS)'; for i in $$list; do \
- target="$$otarget"; \
- echo "Making $$target in $$i"; \
- if test "$$i" = "."; then \
- ok=yes; \
- target="$$target-p"; \
- fi; \
- (cd $$i && $(MAKE) $$target) || exit 1; \
- done; \
- if test "$$otarget" = "all" && test -z '$(targets)'; then ok=yes; fi; \
- if test "$$ok" != "yes"; then $(MAKE) "$$otarget-p" || exit 1; fi
-
-all-p: $(targets)
-install-p: $(targets) $(install_targets)
-distclean-p depend-p clean-p:
-
-depend: depend-recursive
- @echo $(top_srcdir) $(top_builddir) $(srcdir) $(CPP) $(INCLUDES) $(EXTRA_INCLUDES) $(DEFS) $(CPPFLAGS) $(srcdir)/*.c *.c | $(AWK) -f $(top_srcdir)/build/mkdep.awk > $(builddir)/.deps || true
-
-clean: clean-recursive clean-x
-
-clean-x:
- rm -f $(targets) *.lo *.slo *.la *.o $(CLEANFILES)
- rm -rf .libs
-
-distclean: distclean-recursive clean-x
- rm -f config.cache config.log config.status config_vars.mk libtool \
- config.h stamp-h Makefile build-defs.h php4.spec libphp4.module
-
-cvsclean:
- @for i in `find . -name .cvsignore`; do \
- (cd `dirname $$i` 2>/dev/null && rm -rf `cat .cvsignore` *.o *.a || true); \
- done
- @rm -f $(SUBDIRS) 2>/dev/null || true
-
-install-modules:
- @test -d modules && \
- $(mkinstalldirs) $(moduledir) && \
- echo "installing shared modules into $(moduledir)" && \
- rm -f modules/*.la && \
- cp modules/* $(moduledir) || true
-
-include $(builddir)/.deps
-
-.PHONY: all-recursive clean-recursive install-recursive \
-$(install_targets) install all clean depend depend-recursive shared \
-distclean-recursive distclean clean-x all-p install-p distclean-p \
-depend-p clean-p
diff --git a/build/shtool b/build/shtool
deleted file mode 100755
index 4c1a7396fd..0000000000
--- a/build/shtool
+++ /dev/null
@@ -1,716 +0,0 @@
-#!/bin/sh
-##
-## GNU shtool -- The GNU Portable Shell Tool
-## Copyright (c) 1994-2000 Ralf S. Engelschall <rse@engelschall.com>
-##
-## See http://www.gnu.org/software/shtool/ for more information.
-## See ftp://ftp.gnu.org/gnu/shtool/ for latest version.
-##
-## Version 1.4.9 (16-Apr-2000)
-## Ingredients: 3/17 available modules
-##
-
-##
-## This program is free software; you can redistribute it and/or modify
-## it under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 2 of the License, or
-## (at your option) any later version.
-##
-## This program is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with this program; if not, write to the Free Software
-## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-## USA, or contact Ralf S. Engelschall <rse@engelschall.com>.
-##
-## Notice: Given that you include this file verbatim into your own
-## source tree, you are justified in saying that it remains separate
-## from your package, and that this way you are simply just using GNU
-## shtool. So, in this situation, there is no requirement that your
-## package itself is licensed under the GNU General Public License in
-## order to take advantage of GNU shtool.
-##
-
-##
-## Usage: shtool [<options>] [<cmd-name> [<cmd-options>] [<cmd-args>]]
-##
-## Available commands:
-## echo Print string with optional construct expansion
-## install Install a program, script or datafile
-## mkdir Make one or more directories
-##
-## Not available commands (because module was not built-in):
-## mdate Pretty-print modification time of a file or dir
-## table Pretty-print a field-separated list as a table
-## prop Display progress with a running propeller
-## move Move files with simultaneous substitution
-## mkln Make link with calculation of relative paths
-## mkshadow Make a shadow tree through symbolic links
-## fixperm Fix file permissions inside a source tree
-## tarball Roll distribution tarballs
-## guessos Simple operating system guesser
-## arx Extended archive command
-## slo Separate linker options by library class
-## scpp Sharing C Pre-Processor
-## version Generate and maintain a version information file
-## path Deal with program paths
-##
-
-if [ $# -eq 0 ]; then
- echo "$0:Error: invalid command line" 1>&2
- echo "$0:Hint: run \`$0 -h' for usage" 1>&2
- exit 1
-fi
-if [ ".$1" = ".-h" -o ".$1" = ".--help" ]; then
- echo "This is GNU shtool, version 1.4.9 (16-Apr-2000)"
- echo "Copyright (c) 1994-2000 Ralf S. Engelschall <rse@engelschall.com>"
- echo "Report bugs to <bug-shtool@gnu.org>"
- echo ''
- echo "Usage: shtool [<options>] [<cmd-name> [<cmd-options>] [<cmd-args>]]"
- echo ''
- echo 'Available global <options>:'
- echo ' -v, --version display shtool version information'
- echo ' -h, --help display shtool usage help page (this one)'
- echo ' -d, --debug display shell trace information'
- echo ''
- echo 'Available <cmd-name> [<cmd-options>] [<cmd-args>]:'
- echo ' echo [-n] [-e] [<str> ...]'
- echo ' install [-v] [-t] [-c] [-C] [-s] [-m<mode>] [-o<owner>] [-g<group>]'
- echo ' [-e<ext>] <file> <path>'
- echo ' mkdir [-t] [-f] [-p] [-m<mode>] <dir> [<dir> ...]'
- echo ''
- echo 'Not available <cmd-name> (because module was not built-in):'
- echo ' mdate [-n] [-z] [-s] [-d] [-f<str>] [-o<spec>] <path>'
- echo ' table [-F<sep>] [-w<width>] [-c<cols>] [-s<strip>] <str><sep><str>...'
- echo ' prop [-p<str>]'
- echo ' move [-v] [-t] [-e] [-p] <src-file> <dst-file>'
- echo ' mkln [-t] [-f] [-s] <src-path> [<src-path> ...] <dst-path>'
- echo ' mkshadow [-v] [-t] [-a] <src-dir> <dst-dir>'
- echo ' fixperm [-v] [-t] <path> [<path> ...]'
- echo ' tarball [-t] [-v] [-o <tarball>] [-c <prog>] [-d <dir>] [-u'
- echo ' <user>] [-g <group>] [-e <pattern>] <path> [<path> ...]'
- echo ' guessos '
- echo ' arx [-t] [-C<cmd>] <op> <archive> [<file> ...]'
- echo ' slo [-p<str>] -- -L<dir> -l<lib> [-L<dir> -l<lib> ...]'
- echo ' scpp [-v] [-p] [-f<filter>] [-o<ofile>] [-t<tfile>] [-M<mark>]'
- echo ' [-D<dname>] [-C<cname>] <file> [<file> ...]'
- echo ' version [-l<lang>] [-n<name>] [-p<prefix>] [-s<version>] [-i<knob>]'
- echo ' [-d<type>] <file>'
- echo ' path [-s] [-r] [-d] [-b] [-m] [-p<path>] <str> [<str> ...]'
- echo ''
- exit 0
-fi
-if [ ".$1" = ".-v" -o ".$1" = ."--version" ]; then
- echo "GNU shtool 1.4.9 (16-Apr-2000)"
- exit 0
-fi
-if [ ".$1" = ".-d" -o ".$1" = ."--debug" ]; then
- shift
- set -x
-fi
-name=`echo "$0" | sed -e 's;.*/\([^/]*\)$;\1;' -e 's;-sh$;;' -e 's;\.sh$;;'`
-case "$name" in
- echo|install|mkdir )
- # implicit tool command selection
- tool="$name"
- ;;
- * )
- # explicit tool command selection
- tool="$1"
- shift
- ;;
-esac
-arg_spec=""
-opt_spec=""
-gen_tmpfile=no
-
-##
-## DISPATCH INTO SCRIPT PROLOG
-##
-
-case $tool in
- echo )
- str_tool="echo"
- str_usage="[-n] [-e] [<str> ...]"
- arg_spec="0+"
- opt_spec="n.e."
- opt_n=no
- opt_e=no
- ;;
- install )
- str_tool="install"
- str_usage="[-v] [-t] [-c] [-C] [-s] [-m<mode>] [-o<owner>] [-g<group>] [-e<ext>] <file> <path>"
- arg_spec="2="
- opt_spec="v.t.c.C.s.m:o:g:e:"
- opt_v=no
- opt_t=no
- opt_c=no
- opt_C=no
- opt_s=no
- opt_m=""
- opt_o=""
- opt_g=""
- opt_e=""
- ;;
- mkdir )
- str_tool="mkdir"
- str_usage="[-t] [-f] [-p] [-m<mode>] <dir> [<dir> ...]"
- arg_spec="1+"
- opt_spec="t.f.p.m:"
- opt_t=no
- opt_f=no
- opt_p=no
- opt_m=""
- ;;
- -* )
- echo "$0:Error: unknown option \`$tool'" 2>&1
- echo "$0:Hint: run \`$0 -h' for usage" 2>&1
- exit 1
- ;;
- * )
- echo "$0:Error: unknown command \`$tool'" 2>&1
- echo "$0:Hint: run \`$0 -h' for usage" 2>&1
- exit 1
- ;;
-esac
-
-##
-## COMMON UTILITY CODE
-##
-
-# determine name of tool
-if [ ".$tool" != . ]; then
- # used inside shtool script
- toolcmd="$0 $tool"
- toolcmdhelp="shtool $tool"
- msgprefix="shtool:$tool"
-else
- # used as standalone script
- toolcmd="$0"
- toolcmdhelp="sh $0"
- msgprefix="$str_tool"
-fi
-
-# parse argument specification string
-eval `echo $arg_spec |\
- sed -e 's/^\([0-9]*\)\([+=]\)/arg_NUMS=\1; arg_MODE=\2/'`
-
-# parse option specification string
-eval `echo h.$opt_spec |\
- sed -e 's/\([a-zA-Z0-9]\)\([.:+]\)/opt_MODE_\1=\2;/g'`
-
-# interate over argument line
-opt_PREV=''
-while [ $# -gt 0 ]; do
- # special option stops processing
- if [ ".$1" = ".--" ]; then
- shift
- break
- fi
-
- # determine option and argument
- opt_ARG_OK=no
- if [ ".$opt_PREV" != . ]; then
- # merge previous seen option with argument
- opt_OPT="$opt_PREV"
- opt_ARG="$1"
- opt_ARG_OK=yes
- opt_PREV=''
- else
- # split argument into option and argument
- case "$1" in
- -[a-zA-Z0-9]*)
- eval `echo "x$1" |\
- sed -e 's/^x-\([a-zA-Z0-9]\)/opt_OPT="\1";/' \
- -e 's/";\(.*\)$/"; opt_ARG="\1"/'`
- ;;
- -[a-zA-Z0-9])
- opt_OPT=`echo "x$1" | cut -c3-`
- opt_ARG=''
- ;;
- *)
- break
- ;;
- esac
- fi
-
- # eat up option
- shift
-
- # determine whether option needs an argument
- eval "opt_MODE=\$opt_MODE_${opt_OPT}"
- if [ ".$opt_ARG" = . -a ".$opt_ARG_OK" != .yes ]; then
- if [ ".$opt_MODE" = ".:" -o ".$opt_MODE" = ".+" ]; then
- opt_PREV="$opt_OPT"
- continue
- fi
- fi
-
- # process option
- case $opt_MODE in
- '.' )
- # boolean option
- eval "opt_${opt_OPT}=yes"
- ;;
- ':' )
- # option with argument (multiple occurances override)
- eval "opt_${opt_OPT}=\"\$opt_ARG\""
- ;;
- '+' )
- # option with argument (multiple occurances append)
- eval "opt_${opt_OPT}=\"\$opt_${opt_OPT} \$opt_ARG\""
- ;;
- * )
- echo "$msgprefix:Error: unknown option: \`-$opt_OPT'" 1>&2
- echo "$msgprefix:Hint: run \`$toolcmdhelp -h' or \`man shtool' for details" 1>&2
- exit 1
- ;;
- esac
-done
-if [ ".$opt_PREV" != . ]; then
- echo "$msgprefix:Error: missing argument to option \`-$opt_PREV'" 1>&2
- echo "$msgprefix:Hint: run \`$toolcmdhelp -h' or \`man shtool' for details" 1>&2
- exit 1
-fi
-
-# process help option
-if [ ".$opt_h" = .yes ]; then
- echo "Usage: $toolcmdhelp $str_usage"
- exit 0
-fi
-
-# complain about incorrect number of arguments
-case $arg_MODE in
- '=' )
- if [ $# -ne $arg_NUMS ]; then
- echo "$msgprefix:Error: invalid number of arguments (exactly $arg_NUMS expected)" 1>&2
- echo "$msgprefix:Hint: run \`$toolcmd -h' or \`man shtool' for details" 1>&2
- exit 1
- fi
- ;;
- '+' )
- if [ $# -lt $arg_NUMS ]; then
- echo "$msgprefix:Error: invalid number of arguments (at least $arg_NUMS expected)" 1>&2
- echo "$msgprefix:Hint: run \`$toolcmd -h' or \`man shtool' for details" 1>&2
- exit 1
- fi
- ;;
-esac
-
-# establish a temporary file on request
-if [ ".$gen_tmpfile" = .yes ]; then
- if [ ".$TMPDIR" != . ]; then
- tmpdir="$TMPDIR"
- elif [ ".$TEMPDIR" != . ]; then
- tmpdir="$TEMPDIR"
- else
- tmpdir="/tmp"
- fi
- tmpfile="$tmpdir/.shtool.$$"
- rm -f $tmpfile >/dev/null 2>&1
- touch $tmpfile
-fi
-
-##
-## DISPATCH INTO SCRIPT BODY
-##
-
-case $tool in
-
-echo )
- ##
- ## echo -- Print string with optional construct expansion
- ## Copyright (c) 1998-2000 Ralf S. Engelschall <rse@engelschall.com>
- ## Originally written for WML as buildinfo
- ##
-
- text="$*"
-
- # check for broken escape sequence expansion
- seo=''
- bytes=`echo '\1' | wc -c | awk '{ printf("%s", $1); }'`
- if [ ".$bytes" != .3 ]; then
- bytes=`echo -E '\1' | wc -c | awk '{ printf("%s", $1); }'`
- if [ ".$bytes" = .3 ]; then
- seo='-E'
- fi
- fi
-
- # check for existing -n option (to suppress newline)
- minusn=''
- bytes=`echo -n 123 2>/dev/null | wc -c | awk '{ printf("%s", $1); }'`
- if [ ".$bytes" = .3 ]; then
- minusn='-n'
- fi
-
- # determine terminal bold sequence
- term_bold=''
- term_norm=''
- if [ ".$opt_e" = .yes -a ".`echo $text | egrep '%[Bb]'`" != . ]; then
- case $TERM in
- # for the most important terminal types we directly know the sequences
- xterm|xterm*|vt220|vt220*)
- term_bold=`awk 'BEGIN { printf("%c%c%c%c", 27, 91, 49, 109); }' </dev/null 2>/dev/null`
- term_norm=`awk 'BEGIN { printf("%c%c%c", 27, 91, 109); }' </dev/null 2>/dev/null`
- ;;
- vt100|vt100*)
- term_bold=`awk 'BEGIN { printf("%c%c%c%c%c%c", 27, 91, 49, 109, 0, 0); }' </dev/null 2>/dev/null`
- term_norm=`awk 'BEGIN { printf("%c%c%c%c%c", 27, 91, 109, 0, 0); }' </dev/null 2>/dev/null`
- ;;
- # for all others, we try to use a possibly existing `tput' or `tcout' utility
- * )
- paths=`echo $PATH | sed -e 's/:/ /g'`
- for tool in tput tcout; do
- for dir in $paths; do
- if [ -r "$dir/$tool" ]; then
- for seq in bold md smso; do # 'smso' is last
- bold="`$dir/$tool $seq 2>/dev/null`"
- if [ ".$bold" != . ]; then
- term_bold="$bold"
- break
- fi
- done
- if [ ".$term_bold" != . ]; then
- for seq in sgr0 me rmso reset; do # 'reset' is last
- norm="`$dir/$tool $seq 2>/dev/null`"
- if [ ".$norm" != . ]; then
- term_norm="$norm"
- break
- fi
- done
- fi
- break
- fi
- done
- if [ ".$term_bold" != . -a ".$term_norm" != . ]; then
- break;
- fi
- done
- ;;
- esac
- if [ ".$term_bold" = . -o ".$term_norm" = . ]; then
- echo "$msgprefix:Warning: unable to determine terminal sequence for bold mode" 1>&2
- fi
- fi
-
- # determine user name
- username=''
- if [ ".$opt_e" = .yes -a ".`echo $text | egrep '%[uU]'`" != . ]; then
- username="$LOGNAME"
- if [ ".$username" = . ]; then
- username="$USER"
- if [ ".$username" = . ]; then
- username="`(whoami) 2>/dev/null |\
- awk '{ printf("%s", $1); }'`"
- if [ ".$username" = . ]; then
- username="`(who am i) 2>/dev/null |\
- awk '{ printf("%s", $1); }'`"
- if [ ".$username" = . ]; then
- username='unknown'
- fi
- fi
- fi
- fi
- fi
-
- # determine user id
- userid=''
- if [ ".$opt_e" = .yes -a ".`echo $text | egrep '%U'`" != . ]; then
- userid="`(id -u) 2>/dev/null`"
- if [ ".$userid" = . ]; then
- str="`(id) 2>/dev/null`"
- if [ ".`echo $str | grep '^uid[ ]*=[ ]*[0-9]*('`" != . ]; then
- userid=`echo $str | sed -e 's/^uid[ ]*=[ ]*//' -e 's/(.*//'`
- fi
- if [ ".$userid" = . ]; then
- userid=`egrep "^${username}:" /etc/passwd 2>/dev/null | \
- sed -e 's/[^:]*:[^:]*://' -e 's/:.*$//'`
- if [ ".$userid" = . ]; then
- userid=`(ypcat passwd) 2>/dev/null |
- egrep "^${username}:" | \
- sed -e 's/[^:]*:[^:]*://' -e 's/:.*$//'`
- if [ ".$userid" = . ]; then
- userid='?'
- fi
- fi
- fi
- fi
- fi
-
- # determine host name
- hostname=''
- if [ ".$opt_e" = .yes -a ".`echo $text | egrep '%h'`" != . ]; then
- hostname="`(uname -n) 2>/dev/null |\
- awk '{ printf("%s", $1); }'`"
- if [ ".$hostname" = . ]; then
- hostname="`(hostname) 2>/dev/null |\
- awk '{ printf("%s", $1); }'`"
- if [ ".$hostname" = . ]; then
- hostname='unknown'
- fi
- fi
- case $hostname in
- *.* )
- domainname=".`echo $hostname | cut -d. -f2-`"
- hostname="`echo $hostname | cut -d. -f1`"
- ;;
- esac
- fi
-
- # determine domain name
- domainname=''
- if [ ".$opt_e" = .yes -a ".`echo $text | egrep '%d'`" != . ]; then
- if [ ".$domainname" = . ]; then
- if [ -f /etc/resolv.conf ]; then
- domainname="`egrep '^[ ]*domain' /etc/resolv.conf | head -1 |\
- sed -e 's/.*domain//' \
- -e 's/^[ ]*//' -e 's/^ *//' -e 's/^ *//' \
- -e 's/^\.//' -e 's/^/./' |\
- awk '{ printf("%s", $1); }'`"
- if [ ".$domainname" = . ]; then
- domainname="`egrep '^[ ]*search' /etc/resolv.conf | head -1 |\
- sed -e 's/.*search//' \
- -e 's/^[ ]*//' -e 's/^ *//' -e 's/^ *//' \
- -e 's/ .*//' -e 's/ .*//' \
- -e 's/^\.//' -e 's/^/./' |\
- awk '{ printf("%s", $1); }'`"
- fi
- fi
- fi
- fi
-
- # determine current time
- time_day=''
- time_month=''
- time_year=''
- time_monthname=''
- if [ ".$opt_e" = .yes -a ".`echo $text | egrep '%[DMYm]'`" != . ]; then
- time_day=`date '+%d'`
- time_month=`date '+%m'`
- time_year=`date '+%Y' 2>/dev/null`
- if [ ".$time_year" = . ]; then
- time_year=`date '+%y'`
- case $time_year in
- [5-9][0-9]) time_year="19$time_year" ;;
- [0-4][0-9]) time_year="20$time_year" ;;
- esac
- fi
- case $time_month in
- 1|01) time_monthname='Jan' ;;
- 2|02) time_monthname='Feb' ;;
- 3|03) time_monthname='Mar' ;;
- 4|04) time_monthname='Apr' ;;
- 5|05) time_monthname='May' ;;
- 6|06) time_monthname='Jun' ;;
- 7|07) time_monthname='Jul' ;;
- 8|08) time_monthname='Aug' ;;
- 9|09) time_monthname='Sep' ;;
- 10) time_monthname='Oct' ;;
- 11) time_monthname='Nov' ;;
- 12) time_monthname='Dec' ;;
- esac
- fi
-
- # expand special ``%x'' constructs
- if [ ".$opt_e" = .yes ]; then
- text=`echo $seo "$text" |\
- sed -e "s/%B/${term_bold}/g" \
- -e "s/%b/${term_norm}/g" \
- -e "s/%u/${username}/g" \
- -e "s/%U/${userid}/g" \
- -e "s/%h/${hostname}/g" \
- -e "s/%d/${domainname}/g" \
- -e "s/%D/${time_day}/g" \
- -e "s/%M/${time_month}/g" \
- -e "s/%Y/${time_year}/g" \
- -e "s/%m/${time_monthname}/g" 2>/dev/null`
- fi
-
- # create output
- if [ .$opt_n = .no ]; then
- echo $seo "$text"
- else
- # the harder part: echo -n is best, because
- # awk may complain about some \xx sequences.
- if [ ".$minusn" != . ]; then
- echo $seo $minusn "$text"
- else
- echo dummy | awk '{ printf("%s", TEXT); }' TEXT="$text"
- fi
- fi
- ;;
-
-install )
- ##
- ## install -- Install a program, script or datafile
- ## Copyright (c) 1997-2000 Ralf S. Engelschall <rse@engelschall.com>
- ## Originally written for shtool
- ##
-
- src="$1"
- dst="$2"
-
- # If destination is a directory, append the input filename
- if [ -d $dst ]; then
- dst=`echo "$dst" | sed -e 's:/$::'`
- dstfile=`echo "$src" | sed -e 's;.*/\([^/]*\)$;\1;'`
- dst="$dst/$dstfile"
- fi
-
- # Add a possible extension to src and dst
- if [ ".$opt_e" != . ]; then
- src="$src$opt_e"
- dst="$dst$opt_e"
- fi
-
- # Check for correct arguments
- if [ ".$src" = ".$dst" ]; then
- echo "$msgprefix:Error: source and destination are the same" 1>&2
- exit 1
- fi
-
- # Make a temp file name in the destination directory
- dstdir=`echo $dst | sed -e 's;[^/]*$;;' -e 's;\(.\)/$;\1;' -e 's;^$;.;'`
- dsttmp="$dstdir/#INST@$$#"
-
- # Verbosity
- if [ ".$opt_v" = .yes ]; then
- echo "$src -> $dst" 1>&2
- fi
-
- # Copy or move the file name to the temp name
- # (because we might be not allowed to change the source)
- if [ ".$opt_C" = .yes ]; then
- opt_c=yes
- fi
- if [ ".$opt_c" = .yes ]; then
- if [ ".$opt_t" = .yes ]; then
- echo "cp $src $dsttmp" 1>&2
- fi
- cp $src $dsttmp || exit $?
- else
- if [ ".$opt_t" = .yes ]; then
- echo "mv $src $dsttmp" 1>&2
- fi
- mv $src $dsttmp || exit $?
- fi
-
- # Adjust the target file
- # (we do chmod last to preserve setuid bits)
- if [ ".$opt_s" = .yes ]; then
- if [ ".$opt_t" = .yes ]; then
- echo "strip $dsttmp" 1>&2
- fi
- strip $dsttmp || exit $?
- fi
- if [ ".$opt_o" != . ]; then
- if [ ".$opt_t" = .yes ]; then
- echo "chown $opt_o $dsttmp" 1>&2
- fi
- chown $opt_o $dsttmp || exit $?
- fi
- if [ ".$opt_g" != . ]; then
- if [ ".$opt_t" = .yes ]; then
- echo "chgrp $opt_g $dsttmp" 1>&2
- fi
- chgrp $opt_g $dsttmp || exit $?
- fi
- if [ ".$opt_m" != . ]; then
- if [ ".$opt_t" = .yes ]; then
- echo "chmod $opt_m $dsttmp" 1>&2
- fi
- chmod $opt_m $dsttmp || exit $?
- fi
-
- # Determine whether to do a quick install
- # (has to be done _after_ the strip was already done)
- quick=no
- if [ ".$opt_C" = .yes ]; then
- if [ -r $dst ]; then
- if cmp -s $src $dst; then
- quick=yes
- fi
- fi
- fi
-
- # Finally install the file to the real destination
- if [ $quick = yes ]; then
- if [ ".$opt_t" = .yes ]; then
- echo "rm -f $dsttmp" 1>&2
- fi
- rm -f $dsttmp
- else
- if [ ".$opt_t" = .yes ]; then
- echo "rm -f $dst && mv $dsttmp $dst" 1>&2
- fi
- rm -f $dst && mv $dsttmp $dst
- fi
- ;;
-
-mkdir )
- ##
- ## mkdir -- Make one or more directories
- ## Copyright (c) 1996-2000 Ralf S. Engelschall <rse@engelschall.com>
- ## Originally written for public domain by Noah Friedman <friedman@prep.ai.mit.edu>
- ## Cleaned up and enhanced for shtool
- ##
-
- errstatus=0
- for p in ${1+"$@"}; do
- # if the directory already exists...
- if [ -d "$p" ]; then
- if [ ".$opt_f" = .no ] && [ ".$opt_p" = .no ]; then
- echo "$msgprefix:Error: directory already exists: $p" 1>&2
- errstatus=1
- break
- else
- continue
- fi
- fi
- # if the directory has to be created...
- if [ ".$opt_p" = .no ]; then
- if [ ".$opt_t" = .yes ]; then
- echo "mkdir $p" 1>&2
- fi
- mkdir $p || errstatus=$?
- else
- # the smart situation
- set fnord `echo ":$p" |\
- sed -e 's/^:\//%/' \
- -e 's/^://' \
- -e 's/\// /g' \
- -e 's/^%/\//'`
- shift
- pathcomp=''
- for d in ${1+"$@"}; do
- pathcomp="$pathcomp$d"
- case "$pathcomp" in
- -* ) pathcomp="./$pathcomp" ;;
- esac
- if [ ! -d "$pathcomp" ]; then
- if [ ".$opt_t" = .yes ]; then
- echo "mkdir $pathcomp" 1>&2
- fi
- mkdir $pathcomp || errstatus=$?
- if [ ".$opt_m" != . ]; then
- if [ ".$opt_t" = .yes ]; then
- echo "chmod $opt_m $pathcomp" 1>&2
- fi
- chmod $opt_m $pathcomp || errstatus=$?
- fi
- fi
- pathcomp="$pathcomp/"
- done
- fi
- done
- exit $errstatus
- ;;
-
-esac
-
-exit 0
-
-##EOF##
diff --git a/build/sysv_makefile b/build/sysv_makefile
deleted file mode 100755
index fedacb10ef..0000000000
--- a/build/sysv_makefile
+++ /dev/null
@@ -1,34 +0,0 @@
-#! /bin/sh
-# +----------------------------------------------------------------------+
-# | PHP version 4.0 |
-# +----------------------------------------------------------------------+
-# | Copyright (c) 1997, 1998, 1999, 2000 The PHP Group |
-# +----------------------------------------------------------------------+
-# | This source file is subject to version 2.02 of the PHP license, |
-# | that is bundled with this package in the file LICENSE, and is |
-# | available at through the world-wide-web at |
-# | http://www.php.net/license/2_02.txt. |
-# | If you did not receive a copy of the PHP license and are unable to |
-# | obtain it through the world-wide-web, please send a note to |
-# | license@php.net so we can mail you a copy immediately. |
-# +----------------------------------------------------------------------+
-# | Authors: Sascha Schumann <sascha@schumann.cx> |
-# +----------------------------------------------------------------------+
-#
-# $Id$
-#
-
-# cwd must be top_srcdir
-test -f build/sysv_makefile || exit 2
-
-test -f bsd_converted || exit 1
-
-tmpfile=`mktemp /tmp/sysv_makefile.XXXXXX` || tmpfile="tmp.$$"
-for i in build/*.mk; do
- sed 's/^\.include "\(.*\)"/include \1/' $i >$tmpfile \
- && cp $tmpfile $i
-done
-rm -f $tmpfile
-
-rm bsd_converted
-exit 0
diff --git a/buildconf b/buildconf
deleted file mode 100755
index c3530e8614..0000000000
--- a/buildconf
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/bin/sh
-# $Id$
-
-supplied_flag=$1
-
-if test "$supplied_flag" = "--copy"; then
- automake_flags=--copy
-fi
-
-## build.mk does not check aclocal exit status yet
-##
-#mv aclocal.m4 aclocal.m4.old 2>/dev/null
-#aclocal
-#if test "$?" != "0" -a "$am_prefix" != "$lt_prefix"; then
-# echo "buildconf: ERROR: aclocal failed, probably because automake and"
-# echo " libtool are installed with different prefixes;"
-# echo " automake is installed in $am_prefix, but libtool in $lt_prefix."
-# echo " Please re-install automake and/or libtool with a common prefix"
-# echo " and try again."
-# exit 1
-#fi
-
-if test "$supplied_flag" = "--local"; then
- subdirs='SUBDIRS='
-else
- subdirs=''
-fi
-
-rm -f generated_lists
-
-case "`uname`" in
-*BSD/OS*)
- ./build/bsd_makefile;;
-esac
-
-${MAKE:-make} -s -f build/build.mk AMFLAGS="$automake_flags"
diff --git a/config.guess b/config.guess
deleted file mode 100644
index ba66165161..0000000000
--- a/config.guess
+++ /dev/null
@@ -1,1371 +0,0 @@
-#! /bin/sh
-# Attempt to guess a canonical system name.
-# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
-# Free Software Foundation, Inc.
-
-timestamp='2001-04-20'
-
-# This file is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-# As a special exception to the GNU General Public License, if you
-# distribute this file as part of a program that contains a
-# configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that program.
-
-# Written by Per Bothner <bothner@cygnus.com>.
-# Please send patches to <config-patches@gnu.org>.
-#
-# This script attempts to guess a canonical system name similar to
-# config.sub. If it succeeds, it prints the system name on stdout, and
-# exits with 0. Otherwise, it exits with 1.
-#
-# The plan is that this can be called by configure scripts if you
-# don't specify an explicit build system type.
-
-me=`echo "$0" | sed -e 's,.*/,,'`
-
-usage="\
-Usage: $0 [OPTION]
-
-Output the configuration name of the system \`$me' is run on.
-
-Operation modes:
- -h, --help print this help, then exit
- -t, --time-stamp print date of last modification, then exit
- -v, --version print version number, then exit
-
-Report bugs and patches to <config-patches@gnu.org>."
-
-version="\
-GNU config.guess ($timestamp)
-
-Originally written by Per Bothner.
-Copyright (C) 1992, 93, 94, 95, 96, 97, 98, 99, 2000
-Free Software Foundation, Inc.
-
-This is free software; see the source for copying conditions. There is NO
-warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
-
-help="
-Try \`$me --help' for more information."
-
-# Parse command line
-while test $# -gt 0 ; do
- case $1 in
- --time-stamp | --time* | -t )
- echo "$timestamp" ; exit 0 ;;
- --version | -v )
- echo "$version" ; exit 0 ;;
- --help | --h* | -h )
- echo "$usage"; exit 0 ;;
- -- ) # Stop option processing
- shift; break ;;
- - ) # Use stdin as input.
- break ;;
- -* )
- echo "$me: invalid option $1$help" >&2
- exit 1 ;;
- * )
- break ;;
- esac
-done
-
-if test $# != 0; then
- echo "$me: too many arguments$help" >&2
- exit 1
-fi
-
-
-dummy=dummy-$$
-trap 'rm -f $dummy.c $dummy.o $dummy.rel $dummy; exit 1' 1 2 15
-
-# CC_FOR_BUILD -- compiler used by this script.
-# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
-# use `HOST_CC' if defined, but it is deprecated.
-
-case $CC_FOR_BUILD,$HOST_CC,$CC in
- ,,) echo "int dummy(){}" > $dummy.c
- for c in cc gcc c89 ; do
- ($c $dummy.c -c -o $dummy.o) >/dev/null 2>&1
- if test $? = 0 ; then
- CC_FOR_BUILD="$c"; break
- fi
- done
- rm -f $dummy.c $dummy.o $dummy.rel
- if test x"$CC_FOR_BUILD" = x ; then
- CC_FOR_BUILD=no_compiler_found
- fi
- ;;
- ,,*) CC_FOR_BUILD=$CC ;;
- ,*,*) CC_FOR_BUILD=$HOST_CC ;;
-esac
-
-# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
-# (ghazi@noc.rutgers.edu 8/24/94.)
-if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
- PATH=$PATH:/.attbin ; export PATH
-fi
-
-UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
-UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
-UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
-UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
-
-# Note: order is significant - the case branches are not exclusive.
-
-case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
- *:NetBSD:*:*)
- # Netbsd (nbsd) targets should (where applicable) match one or
- # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
- # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently
- # switched to ELF, *-*-netbsd* would select the old
- # object file format. This provides both forward
- # compatibility and a consistent mechanism for selecting the
- # object file format.
- # Determine the machine/vendor (is the vendor relevant).
- case "${UNAME_MACHINE}" in
- amiga) machine=m68k-unknown ;;
- arm32) machine=arm-unknown ;;
- atari*) machine=m68k-atari ;;
- sun3*) machine=m68k-sun ;;
- mac68k) machine=m68k-apple ;;
- macppc) machine=powerpc-apple ;;
- hp3[0-9][05]) machine=m68k-hp ;;
- ibmrt|romp-ibm) machine=romp-ibm ;;
- *) machine=${UNAME_MACHINE}-unknown ;;
- esac
- # The Operating System including object format, if it has switched
- # to ELF recently, or will in the future.
- case "${UNAME_MACHINE}" in
- i386|sparc|amiga|arm*|hp300|mvme68k|vax|atari|luna68k|mac68k|news68k|next68k|pc532|sun3*|x68k)
- if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
- | grep __ELF__ >/dev/null
- then
- # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
- # Return netbsd for either. FIX?
- os=netbsd
- else
- os=netbsdelf
- fi
- ;;
- *)
- os=netbsd
- ;;
- esac
- # The OS release
- release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
- # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
- # contains redundant information, the shorter form:
- # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
- echo "${machine}-${os}${release}"
- exit 0 ;;
- alpha:OSF1:*:*)
- if test $UNAME_RELEASE = "V4.0"; then
- UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
- fi
- # A Vn.n version is a released version.
- # A Tn.n version is a released field test version.
- # A Xn.n version is an unreleased experimental baselevel.
- # 1.2 uses "1.2" for uname -r.
- cat <<EOF >$dummy.s
- .data
-\$Lformat:
- .byte 37,100,45,37,120,10,0 # "%d-%x\n"
-
- .text
- .globl main
- .align 4
- .ent main
-main:
- .frame \$30,16,\$26,0
- ldgp \$29,0(\$27)
- .prologue 1
- .long 0x47e03d80 # implver \$0
- lda \$2,-1
- .long 0x47e20c21 # amask \$2,\$1
- lda \$16,\$Lformat
- mov \$0,\$17
- not \$1,\$18
- jsr \$26,printf
- ldgp \$29,0(\$26)
- mov 0,\$16
- jsr \$26,exit
- .end main
-EOF
- $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null
- if test "$?" = 0 ; then
- case `./$dummy` in
- 0-0)
- UNAME_MACHINE="alpha"
- ;;
- 1-0)
- UNAME_MACHINE="alphaev5"
- ;;
- 1-1)
- UNAME_MACHINE="alphaev56"
- ;;
- 1-101)
- UNAME_MACHINE="alphapca56"
- ;;
- 2-303)
- UNAME_MACHINE="alphaev6"
- ;;
- 2-307)
- UNAME_MACHINE="alphaev67"
- ;;
- esac
- fi
- rm -f $dummy.s $dummy
- echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
- exit 0 ;;
- Alpha\ *:Windows_NT*:*)
- # How do we know it's Interix rather than the generic POSIX subsystem?
- # Should we change UNAME_MACHINE based on the output of uname instead
- # of the specific Alpha model?
- echo alpha-pc-interix
- exit 0 ;;
- 21064:Windows_NT:50:3)
- echo alpha-dec-winnt3.5
- exit 0 ;;
- Amiga*:UNIX_System_V:4.0:*)
- echo m68k-unknown-sysv4
- exit 0;;
- amiga:OpenBSD:*:*)
- echo m68k-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- *:[Aa]miga[Oo][Ss]:*:*)
- echo ${UNAME_MACHINE}-unknown-amigaos
- exit 0 ;;
- arc64:OpenBSD:*:*)
- echo mips64el-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- arc:OpenBSD:*:*)
- echo mipsel-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- hkmips:OpenBSD:*:*)
- echo mips-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- pmax:OpenBSD:*:*)
- echo mipsel-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- sgi:OpenBSD:*:*)
- echo mips-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- wgrisc:OpenBSD:*:*)
- echo mipsel-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- *:OS/390:*:*)
- echo i370-ibm-openedition
- exit 0 ;;
- arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
- echo arm-acorn-riscix${UNAME_RELEASE}
- exit 0;;
- SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
- echo hppa1.1-hitachi-hiuxmpp
- exit 0;;
- Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
- # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
- if test "`(/bin/universe) 2>/dev/null`" = att ; then
- echo pyramid-pyramid-sysv3
- else
- echo pyramid-pyramid-bsd
- fi
- exit 0 ;;
- NILE*:*:*:dcosx)
- echo pyramid-pyramid-svr4
- exit 0 ;;
- sun4H:SunOS:5.*:*)
- echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
- exit 0 ;;
- sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
- echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
- exit 0 ;;
- i86pc:SunOS:5.*:*)
- echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
- exit 0 ;;
- sun4*:SunOS:6*:*)
- # According to config.sub, this is the proper way to canonicalize
- # SunOS6. Hard to guess exactly what SunOS6 will be like, but
- # it's likely to be more like Solaris than SunOS4.
- echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
- exit 0 ;;
- sun4*:SunOS:*:*)
- case "`/usr/bin/arch -k`" in
- Series*|S4*)
- UNAME_RELEASE=`uname -v`
- ;;
- esac
- # Japanese Language versions have a version number like `4.1.3-JL'.
- echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
- exit 0 ;;
- sun3*:SunOS:*:*)
- echo m68k-sun-sunos${UNAME_RELEASE}
- exit 0 ;;
- sun*:*:4.2BSD:*)
- UNAME_RELEASE=`(head -1 /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
- test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
- case "`/bin/arch`" in
- sun3)
- echo m68k-sun-sunos${UNAME_RELEASE}
- ;;
- sun4)
- echo sparc-sun-sunos${UNAME_RELEASE}
- ;;
- esac
- exit 0 ;;
- aushp:SunOS:*:*)
- echo sparc-auspex-sunos${UNAME_RELEASE}
- exit 0 ;;
- atari*:OpenBSD:*:*)
- echo m68k-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- # The situation for MiNT is a little confusing. The machine name
- # can be virtually everything (everything which is not
- # "atarist" or "atariste" at least should have a processor
- # > m68000). The system name ranges from "MiNT" over "FreeMiNT"
- # to the lowercase version "mint" (or "freemint"). Finally
- # the system name "TOS" denotes a system which is actually not
- # MiNT. But MiNT is downward compatible to TOS, so this should
- # be no problem.
- atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
- echo m68k-atari-mint${UNAME_RELEASE}
- exit 0 ;;
- atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
- echo m68k-atari-mint${UNAME_RELEASE}
- exit 0 ;;
- *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
- echo m68k-atari-mint${UNAME_RELEASE}
- exit 0 ;;
- milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
- echo m68k-milan-mint${UNAME_RELEASE}
- exit 0 ;;
- hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
- echo m68k-hades-mint${UNAME_RELEASE}
- exit 0 ;;
- *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
- echo m68k-unknown-mint${UNAME_RELEASE}
- exit 0 ;;
- sun3*:OpenBSD:*:*)
- echo m68k-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- mac68k:OpenBSD:*:*)
- echo m68k-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- mvme68k:OpenBSD:*:*)
- echo m68k-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- mvme88k:OpenBSD:*:*)
- echo m88k-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- powerpc:machten:*:*)
- echo powerpc-apple-machten${UNAME_RELEASE}
- exit 0 ;;
- RISC*:Mach:*:*)
- echo mips-dec-mach_bsd4.3
- exit 0 ;;
- RISC*:ULTRIX:*:*)
- echo mips-dec-ultrix${UNAME_RELEASE}
- exit 0 ;;
- VAX*:ULTRIX*:*:*)
- echo vax-dec-ultrix${UNAME_RELEASE}
- exit 0 ;;
- 2020:CLIX:*:* | 2430:CLIX:*:*)
- echo clipper-intergraph-clix${UNAME_RELEASE}
- exit 0 ;;
- mips:*:*:UMIPS | mips:*:*:RISCos)
- sed 's/^ //' << EOF >$dummy.c
-#ifdef __cplusplus
-#include <stdio.h> /* for printf() prototype */
- int main (int argc, char *argv[]) {
-#else
- int main (argc, argv) int argc; char *argv[]; {
-#endif
- #if defined (host_mips) && defined (MIPSEB)
- #if defined (SYSTYPE_SYSV)
- printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
- #endif
- #if defined (SYSTYPE_SVR4)
- printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
- #endif
- #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
- printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
- #endif
- #endif
- exit (-1);
- }
-EOF
- $CC_FOR_BUILD $dummy.c -o $dummy \
- && ./$dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
- && rm -f $dummy.c $dummy && exit 0
- rm -f $dummy.c $dummy
- echo mips-mips-riscos${UNAME_RELEASE}
- exit 0 ;;
- Motorola:PowerMAX_OS:*:*)
- echo powerpc-motorola-powermax
- exit 0 ;;
- Night_Hawk:Power_UNIX:*:*)
- echo powerpc-harris-powerunix
- exit 0 ;;
- m88k:CX/UX:7*:*)
- echo m88k-harris-cxux7
- exit 0 ;;
- m88k:*:4*:R4*)
- echo m88k-motorola-sysv4
- exit 0 ;;
- m88k:*:3*:R3*)
- echo m88k-motorola-sysv3
- exit 0 ;;
- AViiON:dgux:*:*)
- # DG/UX returns AViiON for all architectures
- UNAME_PROCESSOR=`/usr/bin/uname -p`
- if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
- then
- if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
- [ ${TARGET_BINARY_INTERFACE}x = x ]
- then
- echo m88k-dg-dgux${UNAME_RELEASE}
- else
- echo m88k-dg-dguxbcs${UNAME_RELEASE}
- fi
- else
- echo i586-dg-dgux${UNAME_RELEASE}
- fi
- exit 0 ;;
- M88*:DolphinOS:*:*) # DolphinOS (SVR3)
- echo m88k-dolphin-sysv3
- exit 0 ;;
- M88*:*:R3*:*)
- # Delta 88k system running SVR3
- echo m88k-motorola-sysv3
- exit 0 ;;
- XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
- echo m88k-tektronix-sysv3
- exit 0 ;;
- Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
- echo m68k-tektronix-bsd
- exit 0 ;;
- *:IRIX*:*:*)
- echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
- exit 0 ;;
- ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
- echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id
- exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX '
- i*86:AIX:*:*)
- echo i386-ibm-aix
- exit 0 ;;
- ia64:AIX:*:*)
- if [ -x /usr/bin/oslevel ] ; then
- IBM_REV=`/usr/bin/oslevel`
- else
- IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
- fi
- echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
- exit 0 ;;
- *:AIX:2:3)
- if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
- sed 's/^ //' << EOF >$dummy.c
- #include <sys/systemcfg.h>
-
- main()
- {
- if (!__power_pc())
- exit(1);
- puts("powerpc-ibm-aix3.2.5");
- exit(0);
- }
-EOF
- $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0
- rm -f $dummy.c $dummy
- echo rs6000-ibm-aix3.2.5
- elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
- echo rs6000-ibm-aix3.2.4
- else
- echo rs6000-ibm-aix3.2
- fi
- exit 0 ;;
- *:AIX:*:[45])
- IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | head -1 | awk '{ print $1 }'`
- if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
- IBM_ARCH=rs6000
- else
- IBM_ARCH=powerpc
- fi
- if [ -x /usr/bin/oslevel ] ; then
- IBM_REV=`/usr/bin/oslevel`
- else
- IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
- fi
- echo ${IBM_ARCH}-ibm-aix${IBM_REV}
- exit 0 ;;
- *:AIX:*:*)
- echo rs6000-ibm-aix
- exit 0 ;;
- ibmrt:4.4BSD:*|romp-ibm:BSD:*)
- echo romp-ibm-bsd4.4
- exit 0 ;;
- ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and
- echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to
- exit 0 ;; # report: romp-ibm BSD 4.3
- *:BOSX:*:*)
- echo rs6000-bull-bosx
- exit 0 ;;
- DPX/2?00:B.O.S.:*:*)
- echo m68k-bull-sysv3
- exit 0 ;;
- 9000/[34]??:4.3bsd:1.*:*)
- echo m68k-hp-bsd
- exit 0 ;;
- hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
- echo m68k-hp-bsd4.4
- exit 0 ;;
- 9000/[34678]??:HP-UX:*:*)
- HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
- case "${UNAME_MACHINE}" in
- 9000/31? ) HP_ARCH=m68000 ;;
- 9000/[34]?? ) HP_ARCH=m68k ;;
- 9000/[678][0-9][0-9])
- case "${HPUX_REV}" in
- 11.[0-9][0-9])
- if [ -x /usr/bin/getconf ]; then
- sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
- sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
- case "${sc_cpu_version}" in
- 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
- 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
- 532) # CPU_PA_RISC2_0
- case "${sc_kernel_bits}" in
- 32) HP_ARCH="hppa2.0n" ;;
- 64) HP_ARCH="hppa2.0w" ;;
- esac ;;
- esac
- fi ;;
- esac
- if [ "${HP_ARCH}" = "" ]; then
- sed 's/^ //' << EOF >$dummy.c
-
- #define _HPUX_SOURCE
- #include <stdlib.h>
- #include <unistd.h>
-
- int main ()
- {
- #if defined(_SC_KERNEL_BITS)
- long bits = sysconf(_SC_KERNEL_BITS);
- #endif
- long cpu = sysconf (_SC_CPU_VERSION);
-
- switch (cpu)
- {
- case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
- case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
- case CPU_PA_RISC2_0:
- #if defined(_SC_KERNEL_BITS)
- switch (bits)
- {
- case 64: puts ("hppa2.0w"); break;
- case 32: puts ("hppa2.0n"); break;
- default: puts ("hppa2.0"); break;
- } break;
- #else /* !defined(_SC_KERNEL_BITS) */
- puts ("hppa2.0"); break;
- #endif
- default: puts ("hppa1.0"); break;
- }
- exit (0);
- }
-EOF
- (CCOPTS= $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null ) && HP_ARCH=`./$dummy`
- if test -z "$HP_ARCH"; then HP_ARCH=hppa; fi
- rm -f $dummy.c $dummy
- fi ;;
- esac
- echo ${HP_ARCH}-hp-hpux${HPUX_REV}
- exit 0 ;;
- ia64:HP-UX:*:*)
- HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
- echo ia64-hp-hpux${HPUX_REV}
- exit 0 ;;
- 3050*:HI-UX:*:*)
- sed 's/^ //' << EOF >$dummy.c
- #include <unistd.h>
- int
- main ()
- {
- long cpu = sysconf (_SC_CPU_VERSION);
- /* The order matters, because CPU_IS_HP_MC68K erroneously returns
- true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct
- results, however. */
- if (CPU_IS_PA_RISC (cpu))
- {
- switch (cpu)
- {
- case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
- case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
- case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
- default: puts ("hppa-hitachi-hiuxwe2"); break;
- }
- }
- else if (CPU_IS_HP_MC68K (cpu))
- puts ("m68k-hitachi-hiuxwe2");
- else puts ("unknown-hitachi-hiuxwe2");
- exit (0);
- }
-EOF
- $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0
- rm -f $dummy.c $dummy
- echo unknown-hitachi-hiuxwe2
- exit 0 ;;
- 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
- echo hppa1.1-hp-bsd
- exit 0 ;;
- 9000/8??:4.3bsd:*:*)
- echo hppa1.0-hp-bsd
- exit 0 ;;
- *9??*:MPE/iX:*:*)
- echo hppa1.0-hp-mpeix
- exit 0 ;;
- hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
- echo hppa1.1-hp-osf
- exit 0 ;;
- hp8??:OSF1:*:*)
- echo hppa1.0-hp-osf
- exit 0 ;;
- i*86:OSF1:*:*)
- if [ -x /usr/sbin/sysversion ] ; then
- echo ${UNAME_MACHINE}-unknown-osf1mk
- else
- echo ${UNAME_MACHINE}-unknown-osf1
- fi
- exit 0 ;;
- parisc*:Lites*:*:*)
- echo hppa1.1-hp-lites
- exit 0 ;;
- hppa*:OpenBSD:*:*)
- echo hppa-unknown-openbsd
- exit 0 ;;
- C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
- echo c1-convex-bsd
- exit 0 ;;
- C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
- if getsysinfo -f scalar_acc
- then echo c32-convex-bsd
- else echo c2-convex-bsd
- fi
- exit 0 ;;
- C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
- echo c34-convex-bsd
- exit 0 ;;
- C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
- echo c38-convex-bsd
- exit 0 ;;
- C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
- echo c4-convex-bsd
- exit 0 ;;
- CRAY*X-MP:*:*:*)
- echo xmp-cray-unicos
- exit 0 ;;
- CRAY*Y-MP:*:*:*)
- echo ymp-cray-unicos${UNAME_RELEASE}
- exit 0 ;;
- CRAY*[A-Z]90:*:*:*)
- echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
- | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
- -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/
- exit 0 ;;
- CRAY*TS:*:*:*)
- echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
- exit 0 ;;
- CRAY*T3D:*:*:*)
- echo alpha-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
- exit 0 ;;
- CRAY*T3E:*:*:*)
- echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
- exit 0 ;;
- CRAY*SV1:*:*:*)
- echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
- exit 0 ;;
- CRAY-2:*:*:*)
- echo cray2-cray-unicos
- exit 0 ;;
- F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
- FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
- FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
- FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
- echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
- exit 0 ;;
- hp300:OpenBSD:*:*)
- echo m68k-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
- echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
- exit 0 ;;
- sparc*:BSD/OS:*:*)
- echo sparc-unknown-bsdi${UNAME_RELEASE}
- exit 0 ;;
- *:BSD/OS:*:*)
- echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
- exit 0 ;;
- *:FreeBSD:*:*)
- echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
- exit 0 ;;
- *:OpenBSD:*:*)
- echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
- exit 0 ;;
- i*:CYGWIN*:*)
- echo ${UNAME_MACHINE}-pc-cygwin
- exit 0 ;;
- i*:MINGW*:*)
- echo ${UNAME_MACHINE}-pc-mingw32
- exit 0 ;;
- i*:PW*:*)
- echo ${UNAME_MACHINE}-pc-pw32
- exit 0 ;;
- i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
- # How do we know it's Interix rather than the generic POSIX subsystem?
- # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
- # UNAME_MACHINE based on the output of uname instead of i386?
- echo i386-pc-interix
- exit 0 ;;
- i*:UWIN*:*)
- echo ${UNAME_MACHINE}-pc-uwin
- exit 0 ;;
- p*:CYGWIN*:*)
- echo powerpcle-unknown-cygwin
- exit 0 ;;
- prep*:SunOS:5.*:*)
- echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
- exit 0 ;;
- *:GNU:*:*)
- echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
- exit 0 ;;
- i*86:Minix:*:*)
- echo ${UNAME_MACHINE}-pc-minix
- exit 0 ;;
- arm*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
- exit 0 ;;
- ia64:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux
- exit 0 ;;
- m68*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
- exit 0 ;;
- mips:Linux:*:*)
- cat >$dummy.c <<EOF
-#ifdef __cplusplus
-#include <stdio.h> /* for printf() prototype */
-int main (int argc, char *argv[]) {
-#else
-int main (argc, argv) int argc; char *argv[]; {
-#endif
-#ifdef __MIPSEB__
- printf ("%s-unknown-linux-gnu\n", argv[1]);
-#endif
-#ifdef __MIPSEL__
- printf ("%sel-unknown-linux-gnu\n", argv[1]);
-#endif
- return 0;
-}
-EOF
- $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm -f $dummy.c $dummy && exit 0
- rm -f $dummy.c $dummy
- ;;
- ppc:Linux:*:*)
- # Determine Lib Version
- cat >$dummy.c <<EOF
-#include <features.h>
-#if defined(__GLIBC__)
-extern char __libc_version[];
-extern char __libc_release[];
-#endif
-main(argc, argv)
- int argc;
- char *argv[];
-{
-#if defined(__GLIBC__)
- printf("%s %s\n", __libc_version, __libc_release);
-#else
- printf("unknown\n");
-#endif
- return 0;
-}
-EOF
- LIBC=""
- $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null
- if test "$?" = 0 ; then
- ./$dummy | grep 1\.99 > /dev/null
- if test "$?" = 0 ; then LIBC="libc1" ; fi
- fi
- rm -f $dummy.c $dummy
- echo powerpc-unknown-linux-gnu${LIBC}
- exit 0 ;;
- alpha:Linux:*:*)
- cat <<EOF >$dummy.s
- .data
- \$Lformat:
- .byte 37,100,45,37,120,10,0 # "%d-%x\n"
- .text
- .globl main
- .align 4
- .ent main
- main:
- .frame \$30,16,\$26,0
- ldgp \$29,0(\$27)
- .prologue 1
- .long 0x47e03d80 # implver \$0
- lda \$2,-1
- .long 0x47e20c21 # amask \$2,\$1
- lda \$16,\$Lformat
- mov \$0,\$17
- not \$1,\$18
- jsr \$26,printf
- ldgp \$29,0(\$26)
- mov 0,\$16
- jsr \$26,exit
- .end main
-EOF
- LIBC=""
- $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null
- if test "$?" = 0 ; then
- case `./$dummy` in
- 0-0) UNAME_MACHINE="alpha" ;;
- 1-0) UNAME_MACHINE="alphaev5" ;;
- 1-1) UNAME_MACHINE="alphaev56" ;;
- 1-101) UNAME_MACHINE="alphapca56" ;;
- 2-303) UNAME_MACHINE="alphaev6" ;;
- 2-307) UNAME_MACHINE="alphaev67" ;;
- esac
- objdump --private-headers $dummy | \
- grep ld.so.1 > /dev/null
- if test "$?" = 0 ; then
- LIBC="libc1"
- fi
- fi
- rm -f $dummy.s $dummy
- echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
- exit 0 ;;
- parisc:Linux:*:* | hppa:Linux:*:*)
- # Look for CPU level
- case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
- PA7*) echo hppa1.1-unknown-linux-gnu ;;
- PA8*) echo hppa2.0-unknown-linux-gnu ;;
- *) echo hppa-unknown-linux-gnu ;;
- esac
- exit 0 ;;
- parisc64:Linux:*:* | hppa64:Linux:*:*)
- echo hppa64-unknown-linux-gnu
- exit 0 ;;
- s390:Linux:*:* | s390x:Linux:*:*)
- echo ${UNAME_MACHINE}-ibm-linux
- exit 0 ;;
- sh*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
- exit 0 ;;
- sparc:Linux:*:* | sparc64:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
- exit 0 ;;
- x86_64:Linux:*:*)
- echo x86_64-unknown-linux-gnu
- exit 0 ;;
- i*86:Linux:*:*)
- # The BFD linker knows what the default object file format is, so
- # first see if it will tell us. cd to the root directory to prevent
- # problems with other programs or directories called `ld' in the path.
- ld_supported_emulations=`cd /; ld --help 2>&1 \
- | sed -ne '/supported emulations:/!d
- s/[ ][ ]*/ /g
- s/.*supported emulations: *//
- s/ .*//
- p'`
- case "$ld_supported_emulations" in
- i*86linux)
- echo "${UNAME_MACHINE}-pc-linux-gnuaout"
- exit 0
- ;;
- elf_i*86)
- TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
- ;;
- i*86coff)
- echo "${UNAME_MACHINE}-pc-linux-gnucoff"
- exit 0
- ;;
- esac
- # Either a pre-BFD a.out linker (linux-gnuoldld)
- # or one that does not give us useful --help.
- # GCC wants to distinguish between linux-gnuoldld and linux-gnuaout.
- # If ld does not provide *any* "supported emulations:"
- # that means it is gnuoldld.
- test -z "$ld_supported_emulations" && echo "${UNAME_MACHINE}-pc-linux-gnuoldld" && exit 0
- case "${UNAME_MACHINE}" in
- i*86)
- VENDOR=pc;
- ;;
- *)
- VENDOR=unknown;
- ;;
- esac
- # Determine whether the default compiler is a.out or elf
- cat >$dummy.c <<EOF
-#include <features.h>
-#ifdef __cplusplus
-#include <stdio.h> /* for printf() prototype */
- int main (int argc, char *argv[]) {
-#else
- int main (argc, argv) int argc; char *argv[]; {
-#endif
-#ifdef __ELF__
-# ifdef __GLIBC__
-# if __GLIBC__ >= 2
- printf ("%s-${VENDOR}-linux-gnu\n", argv[1]);
-# else
- printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]);
-# endif
-# else
- printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]);
-# endif
-#else
- printf ("%s-${VENDOR}-linux-gnuaout\n", argv[1]);
-#endif
- return 0;
-}
-EOF
- $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm -f $dummy.c $dummy && exit 0
- rm -f $dummy.c $dummy
- test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0
- ;;
-# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. earlier versions
-# are messed up and put the nodename in both sysname and nodename.
- i*86:DYNIX/ptx:4*:*)
- echo i386-sequent-sysv4
- exit 0 ;;
- i*86:UNIX_SV:4.2MP:2.*)
- # Unixware is an offshoot of SVR4, but it has its own version
- # number series starting with 2...
- # I am not positive that other SVR4 systems won't match this,
- # I just have to hope. -- rms.
- # Use sysv4.2uw... so that sysv4* matches it.
- echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
- exit 0 ;;
- i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
- UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
- if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
- echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
- else
- echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
- fi
- exit 0 ;;
- i*86:*:5:7*)
- # Fixed at (any) Pentium or better
- UNAME_MACHINE=i586
- if [ ${UNAME_SYSTEM} = "UnixWare" ] ; then
- echo ${UNAME_MACHINE}-sco-sysv${UNAME_RELEASE}uw${UNAME_VERSION}
- else
- echo ${UNAME_MACHINE}-pc-sysv${UNAME_RELEASE}
- fi
- exit 0 ;;
- i*86:*:3.2:*)
- if test -f /usr/options/cb.name; then
- UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
- echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
- elif /bin/uname -X 2>/dev/null >/dev/null ; then
- UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')`
- (/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486
- (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \
- && UNAME_MACHINE=i586
- (/bin/uname -X|egrep '^Machine.*Pent ?II' >/dev/null) \
- && UNAME_MACHINE=i686
- (/bin/uname -X|egrep '^Machine.*Pentium Pro' >/dev/null) \
- && UNAME_MACHINE=i686
- echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
- else
- echo ${UNAME_MACHINE}-pc-sysv32
- fi
- exit 0 ;;
- i*86:*DOS:*:*)
- echo ${UNAME_MACHINE}-pc-msdosdjgpp
- exit 0 ;;
- pc:*:*:*)
- # Left here for compatibility:
- # uname -m prints for DJGPP always 'pc', but it prints nothing about
- # the processor, so we play safe by assuming i386.
- echo i386-pc-msdosdjgpp
- exit 0 ;;
- Intel:Mach:3*:*)
- echo i386-pc-mach3
- exit 0 ;;
- paragon:*:*:*)
- echo i860-intel-osf1
- exit 0 ;;
- i860:*:4.*:*) # i860-SVR4
- if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
- echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
- else # Add other i860-SVR4 vendors below as they are discovered.
- echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4
- fi
- exit 0 ;;
- mini*:CTIX:SYS*5:*)
- # "miniframe"
- echo m68010-convergent-sysv
- exit 0 ;;
- M68*:*:R3V[567]*:*)
- test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
- 3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 4850:*:4.0:3.0)
- OS_REL=''
- test -r /etc/.relid \
- && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
- /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
- && echo i486-ncr-sysv4.3${OS_REL} && exit 0
- /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
- && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;;
- 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
- /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
- && echo i486-ncr-sysv4 && exit 0 ;;
- m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
- echo m68k-unknown-lynxos${UNAME_RELEASE}
- exit 0 ;;
- mc68030:UNIX_System_V:4.*:*)
- echo m68k-atari-sysv4
- exit 0 ;;
- i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
- echo i386-unknown-lynxos${UNAME_RELEASE}
- exit 0 ;;
- TSUNAMI:LynxOS:2.*:*)
- echo sparc-unknown-lynxos${UNAME_RELEASE}
- exit 0 ;;
- rs6000:LynxOS:2.*:*)
- echo rs6000-unknown-lynxos${UNAME_RELEASE}
- exit 0 ;;
- PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
- echo powerpc-unknown-lynxos${UNAME_RELEASE}
- exit 0 ;;
- SM[BE]S:UNIX_SV:*:*)
- echo mips-dde-sysv${UNAME_RELEASE}
- exit 0 ;;
- RM*:ReliantUNIX-*:*:*)
- echo mips-sni-sysv4
- exit 0 ;;
- RM*:SINIX-*:*:*)
- echo mips-sni-sysv4
- exit 0 ;;
- *:SINIX-*:*:*)
- if uname -p 2>/dev/null >/dev/null ; then
- UNAME_MACHINE=`(uname -p) 2>/dev/null`
- echo ${UNAME_MACHINE}-sni-sysv4
- else
- echo ns32k-sni-sysv
- fi
- exit 0 ;;
- PENTIUM:CPunix:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
- # says <Richard.M.Bartel@ccMail.Census.GOV>
- echo i586-unisys-sysv4
- exit 0 ;;
- *:UNIX_System_V:4*:FTX*)
- # From Gerald Hewes <hewes@openmarket.com>.
- # How about differentiating between stratus architectures? -djm
- echo hppa1.1-stratus-sysv4
- exit 0 ;;
- *:*:*:FTX*)
- # From seanf@swdc.stratus.com.
- echo i860-stratus-sysv4
- exit 0 ;;
- mc68*:A/UX:*:*)
- echo m68k-apple-aux${UNAME_RELEASE}
- exit 0 ;;
- news*:NEWS-OS:6*:*)
- echo mips-sony-newsos6
- exit 0 ;;
- R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
- if [ -d /usr/nec ]; then
- echo mips-nec-sysv${UNAME_RELEASE}
- else
- echo mips-unknown-sysv${UNAME_RELEASE}
- fi
- exit 0 ;;
- BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only.
- echo powerpc-be-beos
- exit 0 ;;
- BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only.
- echo powerpc-apple-beos
- exit 0 ;;
- BePC:BeOS:*:*) # BeOS running on Intel PC compatible.
- echo i586-pc-beos
- exit 0 ;;
- SX-4:SUPER-UX:*:*)
- echo sx4-nec-superux${UNAME_RELEASE}
- exit 0 ;;
- SX-5:SUPER-UX:*:*)
- echo sx5-nec-superux${UNAME_RELEASE}
- exit 0 ;;
- Power*:Rhapsody:*:*)
- echo powerpc-apple-rhapsody${UNAME_RELEASE}
- exit 0 ;;
- *:Rhapsody:*:*)
- echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
- exit 0 ;;
- *:Darwin:*:*)
- echo `uname -p`-apple-darwin${UNAME_RELEASE}
- exit 0 ;;
- *:procnto*:*:* | *:QNX:[0123456789]*:*)
- if test "${UNAME_MACHINE}" = "x86pc"; then
- UNAME_MACHINE=pc
- fi
- echo `uname -p`-${UNAME_MACHINE}-nto-qnx
- exit 0 ;;
- *:QNX:*:4*)
- echo i386-pc-qnx
- exit 0 ;;
- NSR-[KW]:NONSTOP_KERNEL:*:*)
- echo nsr-tandem-nsk${UNAME_RELEASE}
- exit 0 ;;
- *:NonStop-UX:*:*)
- echo mips-compaq-nonstopux
- exit 0 ;;
- BS2000:POSIX*:*:*)
- echo bs2000-siemens-sysv
- exit 0 ;;
- DS/*:UNIX_System_V:*:*)
- echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
- exit 0 ;;
- *:Plan9:*:*)
- # "uname -m" is not consistent, so use $cputype instead. 386
- # is converted to i386 for consistency with other x86
- # operating systems.
- if test "$cputype" = "386"; then
- UNAME_MACHINE=i386
- else
- UNAME_MACHINE="$cputype"
- fi
- echo ${UNAME_MACHINE}-unknown-plan9
- exit 0 ;;
- i*86:OS/2:*:*)
- # If we were able to find `uname', then EMX Unix compatibility
- # is probably installed.
- echo ${UNAME_MACHINE}-pc-os2-emx
- exit 0 ;;
- *:TOPS-10:*:*)
- echo pdp10-unknown-tops10
- exit 0 ;;
- *:TENEX:*:*)
- echo pdp10-unknown-tenex
- exit 0 ;;
- KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
- echo pdp10-dec-tops20
- exit 0 ;;
- XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
- echo pdp10-xkl-tops20
- exit 0 ;;
- *:TOPS-20:*:*)
- echo pdp10-unknown-tops20
- exit 0 ;;
- *:ITS:*:*)
- echo pdp10-unknown-its
- exit 0 ;;
-esac
-
-#echo '(No uname command or uname output not recognized.)' 1>&2
-#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
-
-cat >$dummy.c <<EOF
-#ifdef _SEQUENT_
-# include <sys/types.h>
-# include <sys/utsname.h>
-#endif
-main ()
-{
-#if defined (sony)
-#if defined (MIPSEB)
- /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed,
- I don't know.... */
- printf ("mips-sony-bsd\n"); exit (0);
-#else
-#include <sys/param.h>
- printf ("m68k-sony-newsos%s\n",
-#ifdef NEWSOS4
- "4"
-#else
- ""
-#endif
- ); exit (0);
-#endif
-#endif
-
-#if defined (__arm) && defined (__acorn) && defined (__unix)
- printf ("arm-acorn-riscix"); exit (0);
-#endif
-
-#if defined (hp300) && !defined (hpux)
- printf ("m68k-hp-bsd\n"); exit (0);
-#endif
-
-#if defined (NeXT)
-#if !defined (__ARCHITECTURE__)
-#define __ARCHITECTURE__ "m68k"
-#endif
- int version;
- version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
- if (version < 4)
- printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
- else
- printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
- exit (0);
-#endif
-
-#if defined (MULTIMAX) || defined (n16)
-#if defined (UMAXV)
- printf ("ns32k-encore-sysv\n"); exit (0);
-#else
-#if defined (CMU)
- printf ("ns32k-encore-mach\n"); exit (0);
-#else
- printf ("ns32k-encore-bsd\n"); exit (0);
-#endif
-#endif
-#endif
-
-#if defined (__386BSD__)
- printf ("i386-pc-bsd\n"); exit (0);
-#endif
-
-#if defined (sequent)
-#if defined (i386)
- printf ("i386-sequent-dynix\n"); exit (0);
-#endif
-#if defined (ns32000)
- printf ("ns32k-sequent-dynix\n"); exit (0);
-#endif
-#endif
-
-#if defined (_SEQUENT_)
- struct utsname un;
-
- uname(&un);
-
- if (strncmp(un.version, "V2", 2) == 0) {
- printf ("i386-sequent-ptx2\n"); exit (0);
- }
- if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
- printf ("i386-sequent-ptx1\n"); exit (0);
- }
- printf ("i386-sequent-ptx\n"); exit (0);
-
-#endif
-
-#if defined (vax)
-# if !defined (ultrix)
-# include <sys/param.h>
-# if defined (BSD)
-# if BSD == 43
- printf ("vax-dec-bsd4.3\n"); exit (0);
-# else
-# if BSD == 199006
- printf ("vax-dec-bsd4.3reno\n"); exit (0);
-# else
- printf ("vax-dec-bsd\n"); exit (0);
-# endif
-# endif
-# else
- printf ("vax-dec-bsd\n"); exit (0);
-# endif
-# else
- printf ("vax-dec-ultrix\n"); exit (0);
-# endif
-#endif
-
-#if defined (alliant) && defined (i860)
- printf ("i860-alliant-bsd\n"); exit (0);
-#endif
-
- exit (1);
-}
-EOF
-
-$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy && rm -f $dummy.c $dummy && exit 0
-rm -f $dummy.c $dummy
-
-# Apollos put the system type in the environment.
-
-test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; }
-
-# Convex versions that predate uname can use getsysinfo(1)
-
-if [ -x /usr/convex/getsysinfo ]
-then
- case `getsysinfo -f cpu_type` in
- c1*)
- echo c1-convex-bsd
- exit 0 ;;
- c2*)
- if getsysinfo -f scalar_acc
- then echo c32-convex-bsd
- else echo c2-convex-bsd
- fi
- exit 0 ;;
- c34*)
- echo c34-convex-bsd
- exit 0 ;;
- c38*)
- echo c38-convex-bsd
- exit 0 ;;
- c4*)
- echo c4-convex-bsd
- exit 0 ;;
- esac
-fi
-
-cat >&2 <<EOF
-$0: unable to guess system type
-
-This script, last modified $timestamp, has failed to recognize
-the operating system you are using. It is advised that you
-download the most up to date version of the config scripts from
-
- ftp://ftp.gnu.org/pub/gnu/config/
-
-If the version you run ($0) is already up to date, please
-send the following data and any information you think might be
-pertinent to <config-patches@gnu.org> in order to provide the needed
-information to handle your system.
-
-config.guess timestamp = $timestamp
-
-uname -m = `(uname -m) 2>/dev/null || echo unknown`
-uname -r = `(uname -r) 2>/dev/null || echo unknown`
-uname -s = `(uname -s) 2>/dev/null || echo unknown`
-uname -v = `(uname -v) 2>/dev/null || echo unknown`
-
-/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
-/bin/uname -X = `(/bin/uname -X) 2>/dev/null`
-
-hostinfo = `(hostinfo) 2>/dev/null`
-/bin/universe = `(/bin/universe) 2>/dev/null`
-/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null`
-/bin/arch = `(/bin/arch) 2>/dev/null`
-/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null`
-/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
-
-UNAME_MACHINE = ${UNAME_MACHINE}
-UNAME_RELEASE = ${UNAME_RELEASE}
-UNAME_SYSTEM = ${UNAME_SYSTEM}
-UNAME_VERSION = ${UNAME_VERSION}
-EOF
-
-exit 1
-
-# Local variables:
-# eval: (add-hook 'write-file-hooks 'time-stamp)
-# time-stamp-start: "timestamp='"
-# time-stamp-format: "%:y-%02m-%02d"
-# time-stamp-end: "'"
-# End:
diff --git a/config.sub b/config.sub
deleted file mode 100644
index a06a480ada..0000000000
--- a/config.sub
+++ /dev/null
@@ -1,1362 +0,0 @@
-#! /bin/sh
-# Configuration validation subroutine script.
-# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
-# Free Software Foundation, Inc.
-
-timestamp='2001-04-20'
-
-# This file is (in principle) common to ALL GNU software.
-# The presence of a machine in this file suggests that SOME GNU software
-# can handle that machine. It does not imply ALL GNU software can.
-#
-# This file is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330,
-# Boston, MA 02111-1307, USA.
-
-# As a special exception to the GNU General Public License, if you
-# distribute this file as part of a program that contains a
-# configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that program.
-
-# Please send patches to <config-patches@gnu.org>.
-#
-# Configuration subroutine to validate and canonicalize a configuration type.
-# Supply the specified configuration type as an argument.
-# If it is invalid, we print an error message on stderr and exit with code 1.
-# Otherwise, we print the canonical config type on stdout and succeed.
-
-# This file is supposed to be the same for all GNU packages
-# and recognize all the CPU types, system types and aliases
-# that are meaningful with *any* GNU software.
-# Each package is responsible for reporting which valid configurations
-# it does not support. The user should be able to distinguish
-# a failure to support a valid configuration from a meaningless
-# configuration.
-
-# The goal of this file is to map all the various variations of a given
-# machine specification into a single specification in the form:
-# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
-# or in some cases, the newer four-part form:
-# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
-# It is wrong to echo any other type of specification.
-
-me=`echo "$0" | sed -e 's,.*/,,'`
-
-usage="\
-Usage: $0 [OPTION] CPU-MFR-OPSYS
- $0 [OPTION] ALIAS
-
-Canonicalize a configuration name.
-
-Operation modes:
- -h, --help print this help, then exit
- -t, --time-stamp print date of last modification, then exit
- -v, --version print version number, then exit
-
-Report bugs and patches to <config-patches@gnu.org>."
-
-version="\
-GNU config.sub ($timestamp)
-
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
-Free Software Foundation, Inc.
-
-This is free software; see the source for copying conditions. There is NO
-warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
-
-help="
-Try \`$me --help' for more information."
-
-# Parse command line
-while test $# -gt 0 ; do
- case $1 in
- --time-stamp | --time* | -t )
- echo "$timestamp" ; exit 0 ;;
- --version | -v )
- echo "$version" ; exit 0 ;;
- --help | --h* | -h )
- echo "$usage"; exit 0 ;;
- -- ) # Stop option processing
- shift; break ;;
- - ) # Use stdin as input.
- break ;;
- -* )
- echo "$me: invalid option $1$help"
- exit 1 ;;
-
- *local*)
- # First pass through any local machine types.
- echo $1
- exit 0;;
-
- * )
- break ;;
- esac
-done
-
-case $# in
- 0) echo "$me: missing argument$help" >&2
- exit 1;;
- 1) ;;
- *) echo "$me: too many arguments$help" >&2
- exit 1;;
-esac
-
-# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
-# Here we must recognize all the valid KERNEL-OS combinations.
-maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
-case $maybe_os in
- nto-qnx* | linux-gnu* | storm-chaos* | os2-emx*)
- os=-$maybe_os
- basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
- ;;
- *)
- basic_machine=`echo $1 | sed 's/-[^-]*$//'`
- if [ $basic_machine != $1 ]
- then os=`echo $1 | sed 's/.*-/-/'`
- else os=; fi
- ;;
-esac
-
-### Let's recognize common machines as not being operating systems so
-### that things like config.sub decstation-3100 work. We also
-### recognize some manufacturers as not being operating systems, so we
-### can provide default operating systems below.
-case $os in
- -sun*os*)
- # Prevent following clause from handling this invalid input.
- ;;
- -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
- -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
- -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
- -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
- -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
- -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
- -apple | -axis)
- os=
- basic_machine=$1
- ;;
- -sim | -cisco | -oki | -wec | -winbond)
- os=
- basic_machine=$1
- ;;
- -scout)
- ;;
- -wrs)
- os=-vxworks
- basic_machine=$1
- ;;
- -hiux*)
- os=-hiuxwe2
- ;;
- -sco5)
- os=-sco3.2v5
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -sco4)
- os=-sco3.2v4
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -sco3.2.[4-9]*)
- os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -sco3.2v[4-9]*)
- # Don't forget version if it is 3.2v4 or newer.
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -sco*)
- os=-sco3.2v2
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -udk*)
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -isc)
- os=-isc2.2
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -clix*)
- basic_machine=clipper-intergraph
- ;;
- -isc*)
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -lynx*)
- os=-lynxos
- ;;
- -ptx*)
- basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
- ;;
- -windowsnt*)
- os=`echo $os | sed -e 's/windowsnt/winnt/'`
- ;;
- -psos*)
- os=-psos
- ;;
- -mint | -mint[0-9]*)
- basic_machine=m68k-atari
- os=-mint
- ;;
-esac
-
-# Decode aliases for certain CPU-COMPANY combinations.
-case $basic_machine in
- # Recognize the basic CPU types without company name.
- # Some are omitted here because they have special meanings below.
- tahoe | i860 | ia64 | m32r | m68k | m68000 | m88k | ns32k | arc \
- | arm | arme[lb] | arm[bl]e | armv[2345] | armv[345][lb] | strongarm | xscale \
- | pyramid | mn10200 | mn10300 | tron | a29k \
- | 580 | i960 | h8300 \
- | x86 | ppcbe | mipsbe | mipsle | shbe | shle \
- | hppa | hppa1.0 | hppa1.1 | hppa2.0 | hppa2.0w | hppa2.0n \
- | hppa64 \
- | alpha | alphaev[4-8] | alphaev56 | alphapca5[67] \
- | alphaev6[78] \
- | we32k | ns16k | clipper | i370 | sh | sh[34] \
- | powerpc | powerpcle \
- | 1750a | dsp16xx | pdp10 | pdp11 \
- | mips16 | mips64 | mipsel | mips64el \
- | mips64orion | mips64orionel | mipstx39 | mipstx39el \
- | mips64vr4300 | mips64vr4300el | mips64vr4100 | mips64vr4100el \
- | mips64vr5000 | miprs64vr5000el | mcore | s390 | s390x \
- | sparc | sparclet | sparclite | sparc64 | sparcv9 | sparcv9b \
- | v850 | c4x \
- | thumb | d10v | d30v | fr30 | avr | openrisc | tic80 \
- | pj | pjl | h8500)
- basic_machine=$basic_machine-unknown
- ;;
- m6811 | m68hc11 | m6812 | m68hc12)
- # Motorola 68HC11/12.
- basic_machine=$basic_machine-unknown
- os=-none
- ;;
- m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | z8k | v70 | w65)
- ;;
-
- # We use `pc' rather than `unknown'
- # because (1) that's what they normally are, and
- # (2) the word "unknown" tends to confuse beginning users.
- i*86 | x86_64)
- basic_machine=$basic_machine-pc
- ;;
- # Object if more than one company name word.
- *-*-*)
- echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
- exit 1
- ;;
- # Recognize the basic CPU types with company name.
- # FIXME: clean up the formatting here.
- vax-* | tahoe-* | i*86-* | i860-* | ia64-* | m32r-* | m68k-* | m68000-* \
- | m88k-* | sparc-* | ns32k-* | fx80-* | arc-* | c[123]* \
- | arm-* | armbe-* | armle-* | armv*-* | strongarm-* | xscale-* \
- | mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* \
- | power-* | none-* | 580-* | cray2-* | h8300-* | h8500-* | i960-* \
- | xmp-* | ymp-* \
- | x86-* | ppcbe-* | mipsbe-* | mipsle-* | shbe-* | shle-* \
- | hppa-* | hppa1.0-* | hppa1.1-* | hppa2.0-* | hppa2.0w-* \
- | hppa2.0n-* | hppa64-* \
- | alpha-* | alphaev[4-8]-* | alphaev56-* | alphapca5[67]-* \
- | alphaev6[78]-* \
- | we32k-* | cydra-* | ns16k-* | pn-* | np1-* | xps100-* \
- | clipper-* | orion-* \
- | sparclite-* | pdp10-* | pdp11-* | sh-* | powerpc-* | powerpcle-* \
- | sparc64-* | sparcv9-* | sparcv9b-* | sparc86x-* \
- | mips16-* | mips64-* | mipsel-* \
- | mips64el-* | mips64orion-* | mips64orionel-* \
- | mips64vr4100-* | mips64vr4100el-* | mips64vr4300-* | mips64vr4300el-* \
- | mipstx39-* | mipstx39el-* | mcore-* \
- | f30[01]-* | f700-* | s390-* | s390x-* | sv1-* | t3e-* \
- | [cjt]90-* \
- | m88110-* | m680[01234]0-* | m683?2-* | m68360-* | z8k-* | d10v-* \
- | thumb-* | v850-* | d30v-* | tic30-* | tic80-* | c30-* | fr30-* \
- | bs2000-* | tic54x-* | c54x-* | x86_64-* | pj-* | pjl-*)
- ;;
- # Recognize the various machine names and aliases which stand
- # for a CPU type and a company and sometimes even an OS.
- 386bsd)
- basic_machine=i386-unknown
- os=-bsd
- ;;
- 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
- basic_machine=m68000-att
- ;;
- 3b*)
- basic_machine=we32k-att
- ;;
- a29khif)
- basic_machine=a29k-amd
- os=-udi
- ;;
- adobe68k)
- basic_machine=m68010-adobe
- os=-scout
- ;;
- alliant | fx80)
- basic_machine=fx80-alliant
- ;;
- altos | altos3068)
- basic_machine=m68k-altos
- ;;
- am29k)
- basic_machine=a29k-none
- os=-bsd
- ;;
- amdahl)
- basic_machine=580-amdahl
- os=-sysv
- ;;
- amiga | amiga-*)
- basic_machine=m68k-unknown
- ;;
- amigaos | amigados)
- basic_machine=m68k-unknown
- os=-amigaos
- ;;
- amigaunix | amix)
- basic_machine=m68k-unknown
- os=-sysv4
- ;;
- apollo68)
- basic_machine=m68k-apollo
- os=-sysv
- ;;
- apollo68bsd)
- basic_machine=m68k-apollo
- os=-bsd
- ;;
- aux)
- basic_machine=m68k-apple
- os=-aux
- ;;
- balance)
- basic_machine=ns32k-sequent
- os=-dynix
- ;;
- convex-c1)
- basic_machine=c1-convex
- os=-bsd
- ;;
- convex-c2)
- basic_machine=c2-convex
- os=-bsd
- ;;
- convex-c32)
- basic_machine=c32-convex
- os=-bsd
- ;;
- convex-c34)
- basic_machine=c34-convex
- os=-bsd
- ;;
- convex-c38)
- basic_machine=c38-convex
- os=-bsd
- ;;
- cray | ymp)
- basic_machine=ymp-cray
- os=-unicos
- ;;
- cray2)
- basic_machine=cray2-cray
- os=-unicos
- ;;
- [cjt]90)
- basic_machine=${basic_machine}-cray
- os=-unicos
- ;;
- crds | unos)
- basic_machine=m68k-crds
- ;;
- cris | cris-* | etrax*)
- basic_machine=cris-axis
- ;;
- da30 | da30-*)
- basic_machine=m68k-da30
- ;;
- decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
- basic_machine=mips-dec
- ;;
- delta | 3300 | motorola-3300 | motorola-delta \
- | 3300-motorola | delta-motorola)
- basic_machine=m68k-motorola
- ;;
- delta88)
- basic_machine=m88k-motorola
- os=-sysv3
- ;;
- dpx20 | dpx20-*)
- basic_machine=rs6000-bull
- os=-bosx
- ;;
- dpx2* | dpx2*-bull)
- basic_machine=m68k-bull
- os=-sysv3
- ;;
- ebmon29k)
- basic_machine=a29k-amd
- os=-ebmon
- ;;
- elxsi)
- basic_machine=elxsi-elxsi
- os=-bsd
- ;;
- encore | umax | mmax)
- basic_machine=ns32k-encore
- ;;
- es1800 | OSE68k | ose68k | ose | OSE)
- basic_machine=m68k-ericsson
- os=-ose
- ;;
- fx2800)
- basic_machine=i860-alliant
- ;;
- genix)
- basic_machine=ns32k-ns
- ;;
- gmicro)
- basic_machine=tron-gmicro
- os=-sysv
- ;;
- go32)
- basic_machine=i386-pc
- os=-go32
- ;;
- h3050r* | hiux*)
- basic_machine=hppa1.1-hitachi
- os=-hiuxwe2
- ;;
- h8300hms)
- basic_machine=h8300-hitachi
- os=-hms
- ;;
- h8300xray)
- basic_machine=h8300-hitachi
- os=-xray
- ;;
- h8500hms)
- basic_machine=h8500-hitachi
- os=-hms
- ;;
- harris)
- basic_machine=m88k-harris
- os=-sysv3
- ;;
- hp300-*)
- basic_machine=m68k-hp
- ;;
- hp300bsd)
- basic_machine=m68k-hp
- os=-bsd
- ;;
- hp300hpux)
- basic_machine=m68k-hp
- os=-hpux
- ;;
- hp3k9[0-9][0-9] | hp9[0-9][0-9])
- basic_machine=hppa1.0-hp
- ;;
- hp9k2[0-9][0-9] | hp9k31[0-9])
- basic_machine=m68000-hp
- ;;
- hp9k3[2-9][0-9])
- basic_machine=m68k-hp
- ;;
- hp9k6[0-9][0-9] | hp6[0-9][0-9])
- basic_machine=hppa1.0-hp
- ;;
- hp9k7[0-79][0-9] | hp7[0-79][0-9])
- basic_machine=hppa1.1-hp
- ;;
- hp9k78[0-9] | hp78[0-9])
- # FIXME: really hppa2.0-hp
- basic_machine=hppa1.1-hp
- ;;
- hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
- # FIXME: really hppa2.0-hp
- basic_machine=hppa1.1-hp
- ;;
- hp9k8[0-9][13679] | hp8[0-9][13679])
- basic_machine=hppa1.1-hp
- ;;
- hp9k8[0-9][0-9] | hp8[0-9][0-9])
- basic_machine=hppa1.0-hp
- ;;
- hppa-next)
- os=-nextstep3
- ;;
- hppaosf)
- basic_machine=hppa1.1-hp
- os=-osf
- ;;
- hppro)
- basic_machine=hppa1.1-hp
- os=-proelf
- ;;
- i370-ibm* | ibm*)
- basic_machine=i370-ibm
- ;;
-# I'm not sure what "Sysv32" means. Should this be sysv3.2?
- i*86v32)
- basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
- os=-sysv32
- ;;
- i*86v4*)
- basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
- os=-sysv4
- ;;
- i*86v)
- basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
- os=-sysv
- ;;
- i*86sol2)
- basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
- os=-solaris2
- ;;
- i386mach)
- basic_machine=i386-mach
- os=-mach
- ;;
- i386-vsta | vsta)
- basic_machine=i386-unknown
- os=-vsta
- ;;
- iris | iris4d)
- basic_machine=mips-sgi
- case $os in
- -irix*)
- ;;
- *)
- os=-irix4
- ;;
- esac
- ;;
- isi68 | isi)
- basic_machine=m68k-isi
- os=-sysv
- ;;
- m88k-omron*)
- basic_machine=m88k-omron
- ;;
- magnum | m3230)
- basic_machine=mips-mips
- os=-sysv
- ;;
- merlin)
- basic_machine=ns32k-utek
- os=-sysv
- ;;
- mingw32)
- basic_machine=i386-pc
- os=-mingw32
- ;;
- miniframe)
- basic_machine=m68000-convergent
- ;;
- *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*)
- basic_machine=m68k-atari
- os=-mint
- ;;
- mipsel*-linux*)
- basic_machine=mipsel-unknown
- os=-linux-gnu
- ;;
- mips*-linux*)
- basic_machine=mips-unknown
- os=-linux-gnu
- ;;
- mips3*-*)
- basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
- ;;
- mips3*)
- basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
- ;;
- mmix*)
- basic_machine=mmix-knuth
- os=-mmixware
- ;;
- monitor)
- basic_machine=m68k-rom68k
- os=-coff
- ;;
- msdos)
- basic_machine=i386-pc
- os=-msdos
- ;;
- mvs)
- basic_machine=i370-ibm
- os=-mvs
- ;;
- ncr3000)
- basic_machine=i486-ncr
- os=-sysv4
- ;;
- netbsd386)
- basic_machine=i386-unknown
- os=-netbsd
- ;;
- netwinder)
- basic_machine=armv4l-rebel
- os=-linux
- ;;
- news | news700 | news800 | news900)
- basic_machine=m68k-sony
- os=-newsos
- ;;
- news1000)
- basic_machine=m68030-sony
- os=-newsos
- ;;
- news-3600 | risc-news)
- basic_machine=mips-sony
- os=-newsos
- ;;
- necv70)
- basic_machine=v70-nec
- os=-sysv
- ;;
- next | m*-next )
- basic_machine=m68k-next
- case $os in
- -nextstep* )
- ;;
- -ns2*)
- os=-nextstep2
- ;;
- *)
- os=-nextstep3
- ;;
- esac
- ;;
- nh3000)
- basic_machine=m68k-harris
- os=-cxux
- ;;
- nh[45]000)
- basic_machine=m88k-harris
- os=-cxux
- ;;
- nindy960)
- basic_machine=i960-intel
- os=-nindy
- ;;
- mon960)
- basic_machine=i960-intel
- os=-mon960
- ;;
- nonstopux)
- basic_machine=mips-compaq
- os=-nonstopux
- ;;
- np1)
- basic_machine=np1-gould
- ;;
- nsr-tandem)
- basic_machine=nsr-tandem
- ;;
- op50n-* | op60c-*)
- basic_machine=hppa1.1-oki
- os=-proelf
- ;;
- OSE68000 | ose68000)
- basic_machine=m68000-ericsson
- os=-ose
- ;;
- os68k)
- basic_machine=m68k-none
- os=-os68k
- ;;
- pa-hitachi)
- basic_machine=hppa1.1-hitachi
- os=-hiuxwe2
- ;;
- paragon)
- basic_machine=i860-intel
- os=-osf
- ;;
- pbd)
- basic_machine=sparc-tti
- ;;
- pbb)
- basic_machine=m68k-tti
- ;;
- pc532 | pc532-*)
- basic_machine=ns32k-pc532
- ;;
- pentium | p5 | k5 | k6 | nexgen)
- basic_machine=i586-pc
- ;;
- pentiumpro | p6 | 6x86 | athlon)
- basic_machine=i686-pc
- ;;
- pentiumii | pentium2)
- basic_machine=i686-pc
- ;;
- pentium-* | p5-* | k5-* | k6-* | nexgen-*)
- basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- pentiumpro-* | p6-* | 6x86-* | athlon-*)
- basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- pentiumii-* | pentium2-*)
- basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- pn)
- basic_machine=pn-gould
- ;;
- power) basic_machine=power-ibm
- ;;
- ppc) basic_machine=powerpc-unknown
- ;;
- ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- ppcle | powerpclittle | ppc-le | powerpc-little)
- basic_machine=powerpcle-unknown
- ;;
- ppcle-* | powerpclittle-*)
- basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- ps2)
- basic_machine=i386-ibm
- ;;
- pw32)
- basic_machine=i586-unknown
- os=-pw32
- ;;
- rom68k)
- basic_machine=m68k-rom68k
- os=-coff
- ;;
- rm[46]00)
- basic_machine=mips-siemens
- ;;
- rtpc | rtpc-*)
- basic_machine=romp-ibm
- ;;
- sa29200)
- basic_machine=a29k-amd
- os=-udi
- ;;
- sequent)
- basic_machine=i386-sequent
- ;;
- sh)
- basic_machine=sh-hitachi
- os=-hms
- ;;
- sparclite-wrs)
- basic_machine=sparclite-wrs
- os=-vxworks
- ;;
- sps7)
- basic_machine=m68k-bull
- os=-sysv2
- ;;
- spur)
- basic_machine=spur-unknown
- ;;
- st2000)
- basic_machine=m68k-tandem
- ;;
- stratus)
- basic_machine=i860-stratus
- os=-sysv4
- ;;
- sun2)
- basic_machine=m68000-sun
- ;;
- sun2os3)
- basic_machine=m68000-sun
- os=-sunos3
- ;;
- sun2os4)
- basic_machine=m68000-sun
- os=-sunos4
- ;;
- sun3os3)
- basic_machine=m68k-sun
- os=-sunos3
- ;;
- sun3os4)
- basic_machine=m68k-sun
- os=-sunos4
- ;;
- sun4os3)
- basic_machine=sparc-sun
- os=-sunos3
- ;;
- sun4os4)
- basic_machine=sparc-sun
- os=-sunos4
- ;;
- sun4sol2)
- basic_machine=sparc-sun
- os=-solaris2
- ;;
- sun3 | sun3-*)
- basic_machine=m68k-sun
- ;;
- sun4)
- basic_machine=sparc-sun
- ;;
- sun386 | sun386i | roadrunner)
- basic_machine=i386-sun
- ;;
- sv1)
- basic_machine=sv1-cray
- os=-unicos
- ;;
- symmetry)
- basic_machine=i386-sequent
- os=-dynix
- ;;
- t3e)
- basic_machine=t3e-cray
- os=-unicos
- ;;
- tic54x | c54x*)
- basic_machine=tic54x-unknown
- os=-coff
- ;;
- tx39)
- basic_machine=mipstx39-unknown
- ;;
- tx39el)
- basic_machine=mipstx39el-unknown
- ;;
- tower | tower-32)
- basic_machine=m68k-ncr
- ;;
- udi29k)
- basic_machine=a29k-amd
- os=-udi
- ;;
- ultra3)
- basic_machine=a29k-nyu
- os=-sym1
- ;;
- v810 | necv810)
- basic_machine=v810-nec
- os=-none
- ;;
- vaxv)
- basic_machine=vax-dec
- os=-sysv
- ;;
- vms)
- basic_machine=vax-dec
- os=-vms
- ;;
- vpp*|vx|vx-*)
- basic_machine=f301-fujitsu
- ;;
- vxworks960)
- basic_machine=i960-wrs
- os=-vxworks
- ;;
- vxworks68)
- basic_machine=m68k-wrs
- os=-vxworks
- ;;
- vxworks29k)
- basic_machine=a29k-wrs
- os=-vxworks
- ;;
- w65*)
- basic_machine=w65-wdc
- os=-none
- ;;
- w89k-*)
- basic_machine=hppa1.1-winbond
- os=-proelf
- ;;
- xmp)
- basic_machine=xmp-cray
- os=-unicos
- ;;
- xps | xps100)
- basic_machine=xps100-honeywell
- ;;
- z8k-*-coff)
- basic_machine=z8k-unknown
- os=-sim
- ;;
- none)
- basic_machine=none-none
- os=-none
- ;;
-
-# Here we handle the default manufacturer of certain CPU types. It is in
-# some cases the only manufacturer, in others, it is the most popular.
- w89k)
- basic_machine=hppa1.1-winbond
- ;;
- op50n)
- basic_machine=hppa1.1-oki
- ;;
- op60c)
- basic_machine=hppa1.1-oki
- ;;
- mips)
- if [ x$os = x-linux-gnu ]; then
- basic_machine=mips-unknown
- else
- basic_machine=mips-mips
- fi
- ;;
- romp)
- basic_machine=romp-ibm
- ;;
- rs6000)
- basic_machine=rs6000-ibm
- ;;
- vax)
- basic_machine=vax-dec
- ;;
- pdp10)
- # there are many clones, so DEC is not a safe bet
- basic_machine=pdp10-unknown
- ;;
- pdp11)
- basic_machine=pdp11-dec
- ;;
- we32k)
- basic_machine=we32k-att
- ;;
- sh3 | sh4)
- basic_machine=sh-unknown
- ;;
- sparc | sparcv9 | sparcv9b)
- basic_machine=sparc-sun
- ;;
- cydra)
- basic_machine=cydra-cydrome
- ;;
- orion)
- basic_machine=orion-highlevel
- ;;
- orion105)
- basic_machine=clipper-highlevel
- ;;
- mac | mpw | mac-mpw)
- basic_machine=m68k-apple
- ;;
- pmac | pmac-mpw)
- basic_machine=powerpc-apple
- ;;
- c4x*)
- basic_machine=c4x-none
- os=-coff
- ;;
- *-unknown)
- # Make sure to match an already-canonicalized machine name.
- ;;
- *)
- echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
- exit 1
- ;;
-esac
-
-# Here we canonicalize certain aliases for manufacturers.
-case $basic_machine in
- *-digital*)
- basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
- ;;
- *-commodore*)
- basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
- ;;
- *)
- ;;
-esac
-
-# Decode manufacturer-specific aliases for certain operating systems.
-
-if [ x"$os" != x"" ]
-then
-case $os in
- # First match some system type aliases
- # that might get confused with valid system types.
- # -solaris* is a basic system type, with this one exception.
- -solaris1 | -solaris1.*)
- os=`echo $os | sed -e 's|solaris1|sunos4|'`
- ;;
- -solaris)
- os=-solaris2
- ;;
- -svr4*)
- os=-sysv4
- ;;
- -unixware*)
- os=-sysv4.2uw
- ;;
- -gnu/linux*)
- os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
- ;;
- # First accept the basic system types.
- # The portable systems comes first.
- # Each alternative MUST END IN A *, to match a version number.
- # -sysv* is not here because it comes later, after sysvr4.
- -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
- | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
- | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
- | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
- | -aos* \
- | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
- | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
- | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \
- | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
- | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
- | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
- | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
- | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \
- | -interix* | -uwin* | -rhapsody* | -darwin* | -opened* \
- | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
- | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* | -os2*)
- # Remember, each alternative MUST END IN *, to match a version number.
- ;;
- -qnx*)
- case $basic_machine in
- x86-* | i*86-*)
- ;;
- *)
- os=-nto$os
- ;;
- esac
- ;;
- -nto*)
- os=-nto-qnx
- ;;
- -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
- | -windows* | -osx | -abug | -netware* | -os9* | -beos* \
- | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
- ;;
- -mac*)
- os=`echo $os | sed -e 's|mac|macos|'`
- ;;
- -linux*)
- os=`echo $os | sed -e 's|linux|linux-gnu|'`
- ;;
- -sunos5*)
- os=`echo $os | sed -e 's|sunos5|solaris2|'`
- ;;
- -sunos6*)
- os=`echo $os | sed -e 's|sunos6|solaris3|'`
- ;;
- -opened*)
- os=-openedition
- ;;
- -wince*)
- os=-wince
- ;;
- -osfrose*)
- os=-osfrose
- ;;
- -osf*)
- os=-osf
- ;;
- -utek*)
- os=-bsd
- ;;
- -dynix*)
- os=-bsd
- ;;
- -acis*)
- os=-aos
- ;;
- -386bsd)
- os=-bsd
- ;;
- -ctix* | -uts*)
- os=-sysv
- ;;
- -ns2 )
- os=-nextstep2
- ;;
- -nsk*)
- os=-nsk
- ;;
- # Preserve the version number of sinix5.
- -sinix5.*)
- os=`echo $os | sed -e 's|sinix|sysv|'`
- ;;
- -sinix*)
- os=-sysv4
- ;;
- -triton*)
- os=-sysv3
- ;;
- -oss*)
- os=-sysv3
- ;;
- -svr4)
- os=-sysv4
- ;;
- -svr3)
- os=-sysv3
- ;;
- -sysvr4)
- os=-sysv4
- ;;
- # This must come after -sysvr4.
- -sysv*)
- ;;
- -ose*)
- os=-ose
- ;;
- -es1800*)
- os=-ose
- ;;
- -xenix)
- os=-xenix
- ;;
- -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
- os=-mint
- ;;
- -none)
- ;;
- *)
- # Get rid of the `-' at the beginning of $os.
- os=`echo $os | sed 's/[^-]*-//'`
- echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
- exit 1
- ;;
-esac
-else
-
-# Here we handle the default operating systems that come with various machines.
-# The value should be what the vendor currently ships out the door with their
-# machine or put another way, the most popular os provided with the machine.
-
-# Note that if you're going to try to match "-MANUFACTURER" here (say,
-# "-sun"), then you have to tell the case statement up towards the top
-# that MANUFACTURER isn't an operating system. Otherwise, code above
-# will signal an error saying that MANUFACTURER isn't an operating
-# system, and we'll never get to this point.
-
-case $basic_machine in
- *-acorn)
- os=-riscix1.2
- ;;
- arm*-rebel)
- os=-linux
- ;;
- arm*-semi)
- os=-aout
- ;;
- pdp10-*)
- os=-tops20
- ;;
- pdp11-*)
- os=-none
- ;;
- *-dec | vax-*)
- os=-ultrix4.2
- ;;
- m68*-apollo)
- os=-domain
- ;;
- i386-sun)
- os=-sunos4.0.2
- ;;
- m68000-sun)
- os=-sunos3
- # This also exists in the configure program, but was not the
- # default.
- # os=-sunos4
- ;;
- m68*-cisco)
- os=-aout
- ;;
- mips*-cisco)
- os=-elf
- ;;
- mips*-*)
- os=-elf
- ;;
- *-tti) # must be before sparc entry or we get the wrong os.
- os=-sysv3
- ;;
- sparc-* | *-sun)
- os=-sunos4.1.1
- ;;
- *-be)
- os=-beos
- ;;
- *-ibm)
- os=-aix
- ;;
- *-wec)
- os=-proelf
- ;;
- *-winbond)
- os=-proelf
- ;;
- *-oki)
- os=-proelf
- ;;
- *-hp)
- os=-hpux
- ;;
- *-hitachi)
- os=-hiux
- ;;
- i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
- os=-sysv
- ;;
- *-cbm)
- os=-amigaos
- ;;
- *-dg)
- os=-dgux
- ;;
- *-dolphin)
- os=-sysv3
- ;;
- m68k-ccur)
- os=-rtu
- ;;
- m88k-omron*)
- os=-luna
- ;;
- *-next )
- os=-nextstep
- ;;
- *-sequent)
- os=-ptx
- ;;
- *-crds)
- os=-unos
- ;;
- *-ns)
- os=-genix
- ;;
- i370-*)
- os=-mvs
- ;;
- *-next)
- os=-nextstep3
- ;;
- *-gould)
- os=-sysv
- ;;
- *-highlevel)
- os=-bsd
- ;;
- *-encore)
- os=-bsd
- ;;
- *-sgi)
- os=-irix
- ;;
- *-siemens)
- os=-sysv4
- ;;
- *-masscomp)
- os=-rtu
- ;;
- f30[01]-fujitsu | f700-fujitsu)
- os=-uxpv
- ;;
- *-rom68k)
- os=-coff
- ;;
- *-*bug)
- os=-coff
- ;;
- *-apple)
- os=-macos
- ;;
- *-atari*)
- os=-mint
- ;;
- *)
- os=-none
- ;;
-esac
-fi
-
-# Here we handle the case where we know the os, and the CPU type, but not the
-# manufacturer. We pick the logical manufacturer.
-vendor=unknown
-case $basic_machine in
- *-unknown)
- case $os in
- -riscix*)
- vendor=acorn
- ;;
- -sunos*)
- vendor=sun
- ;;
- -aix*)
- vendor=ibm
- ;;
- -beos*)
- vendor=be
- ;;
- -hpux*)
- vendor=hp
- ;;
- -mpeix*)
- vendor=hp
- ;;
- -hiux*)
- vendor=hitachi
- ;;
- -unos*)
- vendor=crds
- ;;
- -dgux*)
- vendor=dg
- ;;
- -luna*)
- vendor=omron
- ;;
- -genix*)
- vendor=ns
- ;;
- -mvs* | -opened*)
- vendor=ibm
- ;;
- -ptx*)
- vendor=sequent
- ;;
- -vxsim* | -vxworks*)
- vendor=wrs
- ;;
- -aux*)
- vendor=apple
- ;;
- -hms*)
- vendor=hitachi
- ;;
- -mpw* | -macos*)
- vendor=apple
- ;;
- -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
- vendor=atari
- ;;
- esac
- basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
- ;;
-esac
-
-echo $basic_machine$os
-exit 0
-
-# Local variables:
-# eval: (add-hook 'write-file-hooks 'time-stamp)
-# time-stamp-start: "timestamp='"
-# time-stamp-format: "%:y-%02m-%02d"
-# time-stamp-end: "'"
-# End:
diff --git a/configure.in b/configure.in
deleted file mode 100644
index 5f853f727a..0000000000
--- a/configure.in
+++ /dev/null
@@ -1,1040 +0,0 @@
-dnl ## $Id$ -*- sh -*-
-dnl ## Process this file with autoconf to produce a configure script.
-
-divert(1)
-
-AC_INIT(README.CVS-RULES)
-
-PHP_FAST_OUTPUT(sapi/Makefile ext/Makefile Makefile pear/Makefile main/Makefile)
-
-if test "$with_shared_apache" != "no" && test -n "$with_shared_apache" ; then
- AC_MSG_ERROR(--with-shared-apache is not supported. Please refer to the documentation for using APXS)
-fi
-
-if test -n "$with_apache" && test -n "$with_apxs"; then
- AC_MSG_ERROR(--with-apache and --with-apxs cannot be used together)
-fi
-
-cwd=`pwd`
-
-PHP_CONFIG_NICE(config.nice)
-
-for arg in $0 "$@"; do
- CONFIGURE_COMMAND="$CONFIGURE_COMMAND '$arg'"
-done
-
-php_shtool=$srcdir/build/shtool
-T_MD=`$php_shtool echo -n -e %B`
-T_ME=`$php_shtool echo -n -e %b`
-
-dnl Because ``make install'' is often performed by the superuser,
-dnl we create the libs subdirectory as the user who configures PHP.
-dnl Otherwise, the current user will not be able to delete libs
-dnl or the contents of libs.
-
-$php_shtool mkdir -p libs
-rm -f libs/*
-
-dnl ## Diversion 2 is the initial checking of OS features, programs,
-dnl ## libraries and so on.
-
-dnl ## In diversion 3 we check for compile-time options to the PHP
-dnl ## core and how to deal with different system dependencies. This
-dnl ## includes what regex library is used and whether debugging or short
-dnl ## tags are enabled, and the default behaviour of php.ini options.
-dnl ## This is also where an SAPI interface is selected (choosing between
-dnl ## Apache module, CGI etc.)
-
-dnl ## In diversion 4 we check which extensions should be compiled.
-dnl ## All of these are normally in the extension directories.
-
-dnl ## Diversion 5 is the last one. Here we generate files and clean up.
-
-dnl ## This is where the version number is changed from now on!
-AM_INIT_AUTOMAKE(php, 4.0.7-dev, nodefine)
-
-PHP_VERSION=$VERSION
-echo "/* automatically generated by configure */" > php_version.h.new
-echo "/* edit configure.in to change version number */" >> php_version.h.new
-echo "#define PHP_VERSION \"$PHP_VERSION\"" >> php_version.h.new
-cmp php_version.h.new php_version.h >/dev/null 2>&1
-if test $? -ne 0 ; then
- rm -f php_version.h && mv php_version.h.new php_version.h && \
- echo 'Updated php_version.h'
-else
- rm -f php_version.h.new
-fi
-
-AM_CONFIG_HEADER(main/php_config.h)
-AM_MAINTAINER_MODE
-AC_CANONICAL_HOST
-
-dnl We want this one before the checks, so the checks can modify CFLAGS.
-test -z "$CFLAGS" && auto_cflags=1
-
-dnl Checks for programs.
-AC_PROG_AWK
-AC_PROG_YACC
-if test "$YACC" != "bison -y"; then
- AC_MSG_WARN(You will need bison if you want to regenerate the PHP parsers.)
-else
- AC_MSG_CHECKING(bison version)
- oldIFS=$IFS; IFS=.
- set `bison -V | sed -e 's/^GNU Bison version //'`
- IFS=$oldIFS
- if test "$1" = "1" -a "$2" -lt "25"; then
- AC_MSG_WARN(Bison 1.25 or newer needed to regenerate parsers (found $1.$2).)
- fi
- AC_MSG_RESULT($1.$2 (ok))
-fi
-
-AC_PROG_CC
-AC_AIX
-
-BSD_MAKEFILE=no
-
-case $host_alias in
-*solaris*)
- CPPFLAGS="$CPPFLAGS -D_POSIX_PTHREAD_SEMANTICS"
- if test "${enable_libgcc+set}" != "set" && test "$GCC" = "yes"; then
- enable_libgcc=yes
- fi
- ;;
-*dgux*)
- CPPFLAGS="$CPPFLAGS -D_BSD_TIMEOFDAY_FLAVOR";;
-*darwin*|*rhapsody*)
- CPPFLAGS="$CPPFLAGS -traditional-cpp";;
-*bsdi*)
- BSD_MAKEFILE=yes;;
-*beos*)
- beos_threads=1
- LIBS="$LIBS -lbe -lroot";;
-esac
-
-AM_PROG_CC_STDC
-
-AC_PROG_RANLIB
-AC_PROG_CC_C_O
-AC_PROG_LN_S
-
-AC_PROG_LEX
-if test -n "$LEX"; then
- AC_DECL_YYTEXT
-fi
-
-dnl ## Make flex scanners use const if they can, even if __STDC__ is not
-dnl ## true, for compilers like Sun's that only set __STDC__ true in
-dnl ## "limit-to-ANSI-standard" mode, not in "ANSI-compatible" mode
-AC_C_CONST
-if test "$ac_cv_c_const" = "yes" ; then
- LEX_CFLAGS="-DYY_USE_CONST"
-fi
-
-abs_srcdir=`(cd $srcdir; pwd)`
-abs_builddir=`pwd`
-
-sinclude(Zend/acinclude.m4)
-sinclude(Zend/Zend.m4)
-sinclude(TSRM/tsrm.m4)
-
-divert(2)
-
-PTHREADS_CHECK
-
-PHP_SHLIB_SUFFIX_NAME
-
-PHP_SAPI=cgi
-PHP_BUILD_PROGRAM
-dnl paths to the targets are relative to the build directory
-SAPI_PROGRAM=php
-SAPI_SHARED=libs/libphp4.$SHLIB_SUFFIX_NAME
-SAPI_STATIC=libs/libphp4.a
-SAPI_LIBTOOL=libphp4.la
-
-PHP_CONFIGURE_PART(Configuring SAPI modules)
-
-esyscmd(./scripts/config-stubs sapi)
-
-AC_MSG_CHECKING(for chosen SAPI module)
-AC_MSG_RESULT($PHP_SAPI)
-
-if test "$enable_experimental_zts" = "yes"; then
- PTHREADS_ASSIGN_VARS
- PTHREADS_FLAGS
-fi
-
-divert(3)
-
-PHP_CONFIGURE_PART(Running system checks)
-
-PHP_MISSING_TIME_R_DECL
-
-dnl check for -R, etc. switch
-AC_MSG_CHECKING(whether compiler supports -R)
-AC_CACHE_VAL(php_cv_cc_dashr,[
- SAVE_LIBS=$LIBS
- LIBS="-R /usr/lib $LIBS"
- AC_TRY_LINK([], [], php_cv_cc_dashr=yes, php_cv_cc_dashr=no)
- LIBS=$SAVE_LIBS])
-AC_MSG_RESULT($php_cv_cc_dashr)
-if test $php_cv_cc_dashr = "yes"; then
- ld_runpath_switch=-R
-else
- AC_MSG_CHECKING([whether compiler supports -Wl,-rpath,])
- AC_CACHE_VAL(php_cv_cc_rpath,[
- SAVE_LIBS=$LIBS
- LIBS="-Wl,-rpath,/usr/lib $LIBS"
- AC_TRY_LINK([], [], php_cv_cc_rpath=yes, php_cv_cc_rpath=no)
- LIBS=$SAVE_LIBS])
- AC_MSG_RESULT($php_cv_cc_rpath)
- if test $php_cv_cc_rpath = "yes"; then
- ld_runpath_switch=-Wl,-rpath,
- else
- dnl something innocuous
- ld_runpath_switch=-L
- fi
-fi
-
-PHP_PROG_SENDMAIL
-
-dnl Check whether the system uses EBCDIC (not ASCII) as its native codeset
-PHP_EBCDIC
-
-dnl
-dnl Check for /usr/pkg/{lib,include} which is where NetBSD puts binary
-dnl and source packages. This should be harmless on other OSs.
-dnl
-if test -d /usr/pkg/include -a -d /usr/pkg/lib ; then
- CPPFLAGS="$CPPFLAGS -I/usr/pkg/include"
- LDFLAGS="$LDFLAGS -L/usr/pkg/lib"
-fi
-
-INCLUDES="$INCLUDES -I\$(top_builddir)/Zend"
-
-
-AC_CHECK_LIB(socket, socket, [
- PHP_ADD_LIBRARY(socket)
- AC_DEFINE(HAVE_LIBSOCKET,1,[ ]) ], [
- AC_CHECK_LIB(socket, htonl, [
- PHP_ADD_LIBRARY(socket)
- ])])
-
-dnl Some systems (OpenServer 5) dislike -lsocket -lnsl, so we try
-dnl to avoid -lnsl checks, if we already have the functions which
-dnl are usually in libnsl
-
-unset ac_cv_func_yp_get_default_domain
-AC_CHECK_FUNC(yp_get_default_domain,
- [php_no_nsl_checks=yes],[ ])
-unset ac_cv_func_yp_get_default_domain
-
-if test "$php_no_nsl_checks" != "yes"; then
-
-AC_CHECK_LIB(nsl, gethostname, [
- PHP_ADD_LIBRARY(nsl)
- AC_DEFINE(HAVE_LIBNSL,1,[ ]) ],[
- AC_CHECK_LIB(nsl, gethostbyaddr, [
- PHP_ADD_LIBRARY(nsl)
- AC_DEFINE(HAVE_LIBNSL,1,[ ]) ], [])
-])
-
-fi
-
-AC_CHECK_LIB(dl, dlopen,[PHP_ADD_LIBRARY(dl)])
-
-dnl The sin may be in a library which need not be specifed
-dnl as well as res_search resides in libsocket
-AC_CHECK_LIB(m, sin)
-
-dnl Only include libbind if inet_aton is not found in
-dnl libresolv.
-AC_CHECK_LIB(resolv, inet_aton, [], [
- AC_CHECK_LIB(bind, inet_aton, [], [
- AC_CHECK_LIB(bind, __inet_aton)
- ])
-])
-
-dnl The res_search may be in libsocket as well, and if it is
-dnl make sure to check for dn_skipname in libresolv, or if res_search
-dnl is in neither of these libs, still check for dn_skipname in libresolv
-AC_CHECK_LIB(socket, res_search, [
- AC_CHECK_LIB(resolv, dn_skipname)
- AC_CHECK_LIB(resolv, __dn_skipname)
- LIBS="$LIBS -lsocket"
- AC_DEFINE(HAVE_LIBSOCKET,1,[ ]) ], [
- AC_CHECK_LIB(resolv, res_search, [
- LIBS="$LIBS -lresolv"
- AC_DEFINE(HAVE_LIBRESOLV,1,[ ])
- ], [
- AC_CHECK_LIB(resolv, dn_skipname)
- AC_CHECK_LIB(resolv, __dn_skipname)
- ])
-])
-
-dnl Checks for header files.
-AC_HEADER_STDC
-
-dnl In QNX opendir resides in libc but dirent.h is still required
-if test "`uname -s 2>/dev/null`" != "QNX"; then
- AC_HEADER_DIRENT
-else
- AC_CHECK_HEADERS(dirent.h)
-fi
-PHP_MISSING_FCLOSE_DECL
-dnl QNX requires unix.h to allow functions in libunix to work properly
-AC_CHECK_HEADERS(
-alloca.h \
-arpa/inet.h \
-arpa/nameser.h \
-crypt.h \
-fcntl.h \
-grp.h \
-ieeefp.h \
-limits.h \
-locale.h \
-netinet/in.h \
-pwd.h \
-resolv.h \
-signal.h \
-stdarg.h \
-stdlib.h \
-string.h \
-syslog.h \
-sysexits.h \
-sys/file.h \
-sys/mman.h \
-sys/mount.h \
-sys/resource.h \
-sys/select.h \
-sys/socket.h \
-sys/statfs.h \
-sys/statvfs.h \
-sys/sysexits.h \
-sys/time.h \
-sys/types.h \
-sys/varargs.h \
-sys/wait.h \
-unistd.h \
-unix.h \
-utime.h \
-)
-
-dnl Checks for typedefs, structures, and compiler characteristics.
-AC_STRUCT_TM
-AC_STRUCT_TIMEZONE
-
-PHP_TM_GMTOFF
-PHP_STRUCT_FLOCK
-PHP_SOCKLEN_T
-
-AC_CHECK_SIZEOF(long, 8)
-AC_CHECK_SIZEOF(int, 4)
-
-test -d /usr/ucblib && PHP_ADD_LIBPATH(/usr/ucblib)
-
-dnl Check for members of the stat structure
-AC_STRUCT_ST_BLKSIZE
-dnl AC_STRUCT_ST_BLOCKS will screw QNX because fileblocks.o does not exists
-dnl The WARNING_LEVEL required because cc in QNX hates -w option without an argument
-if test "`uname -s 2>/dev/null`" != "QNX"; then
- AC_STRUCT_ST_BLOCKS
-else
- AC_MSG_WARN(warnings level for cc set to 0)
- WARNING_LEVEL=0
-fi
-AC_STRUCT_ST_RDEV
-
-dnl Checks for types
-AC_TYPE_SIZE_T
-AC_TYPE_UID_T
-
-dnl Check for IPv6 support
-AC_CACHE_CHECK([for IPv6 support], ac_cv_ipv6_support,
-[AC_TRY_COMPILE([ #include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>], [struct sockaddr_in6 s; int i=AF_INET6; s],
- ac_cv_ipv6_support=yes, ac_cv_ipv6_support=no)])
-if test "$ac_cv_ipv6_support" = yes; then
- AC_DEFINE(HAVE_IPV6,1,[Whether you have IPv6 support])
-fi
-
-dnl Checks for library functions.
-AC_FUNC_VPRINTF
-AC_CHECK_FUNCS(
-asctime_r \
-chroot \
-ctime_r \
-cuserid \
-flock \
-gai_strerror \
-gcvt \
-getlogin \
-gethostbyaddr \
-getprotobyname \
-getprotobynumber \
-getservbyname \
-getservbyport \
-getrusage \
-gettimeofday \
-gmtime_r \
-inet_aton \
-isascii \
-link \
-localtime_r \
-lockf \
-lrand48 \
-memcpy \
-memmove \
-mkstemp \
-mmap \
-putenv \
-random \
-rand_r \
-regcomp \
-res_search \
-setitimer \
-setlocale \
-localeconv \
-setsockopt \
-setvbuf \
-shutdown \
-sin \
-snprintf \
-srand48 \
-srandom \
-statfs \
-statvfs \
-std_syslog \
-strcasecmp \
-strcoll \
-strdup \
-strerror \
-strftime \
-strstr \
-strtok_r \
-symlink \
-tempnam \
-tzset \
-unsetenv \
-usleep \
-utime \
-vsnprintf \
-)
-
-dnl Check for getaddrinfo, should be a better way, but...
-AC_CACHE_CHECK([for getaddrinfo], ac_cv_func_getaddrinfo,
-[AC_TRY_COMPILE([#include <netdb.h>],
- [struct addrinfo *g,h;g=&h;getaddrinfo("","",g,&g);],
- ac_cv_func_getaddrinfo=yes, ac_cv_func_getaddrinfo=no)])
-if test "$ac_cv_func_getaddrinfo" = yes; then
- AC_DEFINE(HAVE_GETADDRINFO,1,[Define if you have the getaddrinfo function])
-fi
-
-AC_REPLACE_FUNCS(strlcat strlcpy getopt)
-AC_FUNC_UTIME_NULL
-AC_FUNC_ALLOCA
-PHP_AC_BROKEN_SPRINTF
-PHP_DECLARED_TIMEZONE
-PHP_TIME_R_TYPE
-PHP_READDIR_R_TYPE
-
-dnl AIX keeps in_addr_t in /usr/include/netinet/in.h
-dnl AC_MSG_CHECKING(for in_addr_t)
-AC_CACHE_VAL(ac_cv_type_$1,
-[AC_EGREP_CPP(dnl
-changequote(<<,>>)dnl
-<<in_addr_t[^a-zA-Z_0-9]>>dnl
-changequote([,]), [#include <sys/types.h>
-#if STDC_HEADERS
-#include <stdlib.h>
-#include <stddef.h>
-#endif
-#ifdef HAVE_NETINET_IN_H
-#include <netinet/in.h>
-#endif], ac_cv_type_in_addr_t=yes, ac_cv_type_in_addr_t=no)])dnl
-
-dnl AC_MSG_RESULT($ac_cv_type_in_addr_t)
-if test $ac_cv_type_in_addr_t = no; then
- AC_DEFINE(in_addr_t, u_int, [ ])
-fi
-
-divert(4)
-
-PHP_ARG_ENABLE(debug, whether to include debugging symbols,
-[ --enable-debug Compile with debugging symbols.], no)
-
-if test "$PHP_DEBUG" = "yes"; then
- PHP_DEBUG=1
- ZEND_DEBUG=yes
-else
- PHP_DEBUG=0
- ZEND_DEBUG=no
-fi
-
-PHP_ARG_WITH(layout,[layout of installed files],
-[ --with-layout=TYPE Sets how installed files will be laid out. Type is
- one of "PHP" (default) or "GNU"], PHP)
-
-PHP_ARG_WITH(config-file-path,[path to configuration file],
-[ --with-config-file-path=PATH
- Sets the path in which to look for php.ini,
- defaults to PREFIX/lib], DEFAULT)
-
-if test "$PHP_CONFIG_FILE_PATH" = "DEFAULT"; then
- case $PHP_LAYOUT in
- GNU)
- PHP_CONFIG_FILE_PATH=$sysconfdir
- oldstyleextdir=no;;
- *)
- PHP_CONFIG_FILE_PATH=$libdir
- oldstyleextdir=yes;;
- esac
-fi
-
-# compatibility
-if test "x$with_pear" = "x" -a "x$enable_pear" = "xno"; then
- with_pear=no
-fi
-
-PHP_ARG_WITH(pear, [whether to install PEAR, and where],
-[ --with-pear=DIR Install PEAR in DIR (default PREFIX/lib/php)
- --without-pear Do not install PEAR], DEFAULT)
-
-if test "$PHP_PEAR" != "no"; then
- PEAR_DIR=pear
-fi
-
-if test "$PHP_PEAR" = "DEFAULT"; then
- case $PHP_LAYOUT in
- GNU) PEAR_INSTALLDIR=$datadir/pear;;
- *) PEAR_INSTALLDIR=$libdir/php;;
- esac
-fi
-
-test -n "$DEBUG_CFLAGS" && CFLAGS="$CFLAGS $DEBUG_CFLAGS"
-
-PHP_ARG_ENABLE(safe-mode, whether to enable safe mode by default,
-[ --enable-safe-mode Enable safe mode by default.])
-
-if test "$PHP_SAFE_MODE" = "yes"; then
- AC_DEFINE(PHP_SAFE_MODE,1,[ ])
-else
- AC_DEFINE(PHP_SAFE_MODE,0,[ ])
-fi
-
-AC_MSG_CHECKING(for safe mode exec dir)
-AC_ARG_WITH(exec-dir,
-[ --with-exec-dir[=DIR] Only allow executables in DIR when in safe mode
- defaults to /usr/local/php/bin],
-[
- if test "$withval" != "no"; then
- if test "$withval" = "yes"; then
- AC_DEFINE(PHP_SAFE_MODE_EXEC_DIR,"/usr/local/php/bin", [ ])
- AC_MSG_RESULT(/usr/local/php/bin)
- else
- AC_DEFINE_UNQUOTED(PHP_SAFE_MODE_EXEC_DIR,"$withval", [ ])
- AC_MSG_RESULT($withval)
- fi
- else
- AC_DEFINE(PHP_SAFE_MODE_EXEC_DIR,"/usr/local/php/bin", [ ])
- AC_MSG_RESULT(/usr/local/php/bin)
- fi
-],[
- AC_DEFINE(PHP_SAFE_MODE_EXEC_DIR,"/usr/local/php/bin", [ ])
- AC_MSG_RESULT(/usr/local/php/bin)
-])
-
-PHP_ARG_WITH(openssl,for OpenSSL support,
-[ --with-openssl[=DIR] Include OpenSSL support (requires OpenSSL >= 0.9.5) ])
-if test "$PHP_OPENSSL" = "yes"; then
- PHP_OPENSSL="/usr/local/ssl /usr/local /usr /usr/local/openssl"
-fi
-
-if test "$PHP_OPENSSL" != "no"; then
- PHP_SETUP_OPENSSL
-fi
-
-PHP_ARG_ENABLE(sigchild,whether to enable PHP's own SIGCHLD handler,
-[ --enable-sigchild Enable PHP's own SIGCHLD handler.],no)
-
-if test "$PHP_SIGCHILD" = "yes"; then
- AC_DEFINE(PHP_SIGCHILD, 1, [ ])
-else
- AC_DEFINE(PHP_SIGCHILD, 0, [ ])
-fi
-
-PHP_ARG_ENABLE(magic-quotes,whether to enable magic quotes by default,
-[ --enable-magic-quotes Enable magic quotes by default.])
-
-if test "$PHP_MAGIC_QUOTES" = "yes"; then
- AC_DEFINE(MAGIC_QUOTES, 1, [ ])
-else
- AC_DEFINE(MAGIC_QUOTES, 0, [ ])
-fi
-
-PHP_ARG_ENABLE(rpath, whether to enable runpaths,
-[ --disable-rpath Disable passing additional runtime library
- search paths], yes)
-
-PHP_ARG_ENABLE(libgcc, whether to explicitly link against libgcc,
-[ --enable-libgcc Enable explicitly linking against libgcc])
-
-if test "$PHP_LIBGCC" = "yes"; then
- PHP_LIBGCC_LIBPATH(gcc)
- if test -z "$libgcc_libpath"; then
- AC_MSG_ERROR(Cannot locate libgcc. Make sure that gcc is in your path)
- fi
- PHP_ADD_LIBPATH($libgcc_libpath)
- PHP_ADD_LIBRARY(gcc, yes)
-fi
-
-PHP_ARG_ENABLE(short-tags,whether to enable short tags by default,
-[ --disable-short-tags Disable the short-form <? start tag by default.],yes)
-
-if test "$PHP_SHORT_TAGS" = "yes"; then
- AC_DEFINE(DEFAULT_SHORT_OPEN_TAG,"1",[ ])
-else
- AC_DEFINE(DEFAULT_SHORT_OPEN_TAG,"0",[ ])
-fi
-
-
-PHP_ARG_ENABLE(dmalloc,whether to enable dmalloc,
-[ --enable-dmalloc Enable dmalloc])
-
-if test "$PHP_DMALLOC" = "yes"; then
- AC_DEFINE(HAVE_DMALLOC,1,[Whether you have dmalloc])
- PHP_ADD_LIBRARY(dmalloc)
- CPPFLAGS="$CPPFLAGS -DDMALLOC_FUNC_CHECK"
-fi
-
-# temporary until streams are better integrated
-PHP_ARG_ENABLE(php-streams,whether to enable php streams,
-[ --enable-php-streams Include experimental php streams.
- Do not use unless you are testing the code!])
-
-if test "$PHP_PHP_STREAMS" = "yes"; then
- AC_DEFINE(HAVE_PHP_STREAM, 1, [Whether to use php streams])
-fi
-
-AC_CHECK_LIB(crypt, crypt, [
- PHP_ADD_LIBRARY(crypt)
- AC_DEFINE(HAVE_LIBCRYPT,1,[ ])
- AC_DEFINE(HAVE_CRYPT,1,[ ])
-], [])
-
-divert(5)
-
-PHP_CONFIGURE_PART(Configuring extensions)
-
-# reading config stubs
-esyscmd(./scripts/config-stubs ext)
-
-PHP_FAST_OUTPUT(sapi/$PHP_SAPI/Makefile)
-
-AC_MSG_CHECKING(whether to enable versioning)
-AC_ARG_ENABLE(versioning,
-[ --enable-versioning Export only required symbols.
- See INSTALL for more information],[
- PHP_VERSIONING=$enableval
-],[
- PHP_VERSIONING=no
-])
-AC_MSG_RESULT($PHP_VERSIONING)
-
-if test "$PHP_VERSIONING" = "yes"; then
- test -z "$PHP_SYM_FILE" && PHP_SYM_FILE="$abs_srcdir/sapi/$PHP_SAPI/php.sym"
- if test -f "$PHP_SYM_FILE"; then
- EXTRA_LDFLAGS="-export-symbols $PHP_SYM_FILE"
- fi
-fi
-
-divert(6)
-
-enable_shared=yes
-enable_static=yes
-unset with_pic
-
-case $php_build_target in
-program|static)
- standard_libtool_flag='-prefer-non-pic -static'
- if test "$lib_build_shared" != "yes"; then
- enable_shared=no
- fi
- PHP_COMPILE='$(CC) $(COMMON_FLAGS) $(CFLAGS_CLEAN) $(EXTRA_CFLAGS) -c $< && touch $@'
- CXX_PHP_COMPILE='$(CXX) $(COMMON_FLAGS) $(CXXFLAGS_CLEAN) $(EXTRA_CXXFLAGS) -c $< && touch $@'
-;;
-shared)
- enable_static=no
- standard_libtool_flag=-prefer-pic
- EXTRA_LDFLAGS="$EXTRA_LDFLAGS -avoid-version"
-;;
-esac
-
-if test "$PHP_SAPI" = "cgi"; then
- PHP_PROGRAM=php
-fi
-
-if test "$PHP_SAPI" = "fastcgi"; then
- PHP_PROGRAM=php
-fi
-
-
-PHP_REGEX
-
-PHP_CONFIGURE_PART(Configuring Zend)
-LIBZEND_BASIC_CHECKS
-LIBZEND_OTHER_CHECKS
-
-TSRM_LIB='TSRM/libtsrm.la'
-TSRM_DIR=TSRM
-INCLUDES="$INCLUDES -I\$(top_builddir)/TSRM"
-
-if test "$ZEND_EXPERIMENTAL_ZTS" = "yes"; then
- AC_DEFINE(ZTS,1,[ ])
- PHP_THREAD_SAFETY=yes
-else
- PHP_THREAD_SAFETY=no
-fi
-
-if test "$abs_srcdir" != "$abs_builddir"; then
- INCLUDES="$INCLUDES -I\$(top_srcdir)/main -I\$(top_srcdir)/Zend"
- INCLUDES="$INCLUDES -I\$(top_srcdir)/TSRM"
-fi
-
-EXTRA_LIBS="$EXTRA_LIBS $DLIBS $LIBS"
-unset LIBS LDFLAGS
-
-PHP_CONFIGURE_PART(Configuring TSRM)
-TSRM_BASIC_CHECKS
-if test "$PHP_THREAD_SAFETY" = "yes"; then
- TSRM_THREADS_CHECKS
-fi
-EXTRA_LDFLAGS="$EXTRA_LDFLAGS $LDFLAGS"
-EXTRA_LIBS="$EXTRA_LIBS $LIBS"
-unset LIBS LDFLAGS
-
-test "$prefix" = "NONE" && prefix=/usr/local
-test "$exec_prefix" = "NONE" && exec_prefix='${prefix}'
-
-case $libdir in
- '${exec_prefix}/lib')
- libdir=$libdir/php
- ;;
-esac
-case $datadir in
- '${prefix}/share')
- datadir=$datadir/php
- ;;
- *) ;;
-esac
-
-phplibdir=`pwd`/modules
-$php_shtool mkdir -p $phplibdir
-phptempdir=`pwd`/libs
-
-old_exec_prefix=$exec_prefix
-old_libdir=$libdir
-old_datadir=$datadir
-exec_prefix=`eval echo $exec_prefix`
-libdir=`eval echo $libdir`
-datadir=`eval echo $datadir`
-
-dnl Build extension directory path
-
-ZEND_MODULE_API_NO=`egrep '#define ZEND_MODULE_API_NO ' $srcdir/Zend/zend_modules.h|sed 's/#define ZEND_MODULE_API_NO //'`
-
-if test -z "$EXTENSION_DIR"; then
- extbasedir=$ZEND_MODULE_API_NO
- if test "$oldstyleextdir" = "yes"; then
- if test "$PHP_DEBUG" = "1"; then
- part1=debug
- else
- part1=no-debug
- fi
- if test "$enable_experimental_zts" = "yes"; then
- part2=zts
- else
- part2=non-zts
- fi
- extbasedir=$part1-$part2-$extbasedir
- EXTENSION_DIR=$libdir/extensions/$extbasedir
- else
- if test "$enable_experimental_zts" = "yes"; then
- extbasedir=$extbasedir-zts
- fi
-
- if test "$PHP_DEBUG" = "1"; then
- extbasedir=$extbasedir-debug
- fi
- EXTENSION_DIR=$libdir/$extbasedir
- fi
-fi
-
-dnl Expand all directory names for use in macros/constants
-EXPANDED_PEAR_INSTALLDIR=`eval echo $PEAR_INSTALLDIR`
-EXPANDED_EXTENSION_DIR=`eval echo $EXTENSION_DIR`
-EXPANDED_LOCALSTATEDIR=`eval echo $localstatedir`
-EXPANDED_BINDIR=`eval echo $bindir`
-EXPANDED_LIBDIR=$libdir
-EXPANDED_SYSCONFDIR=`eval echo $sysconfdir`
-EXPANDED_DATADIR=$datadir
-EXPANDED_PHP_CONFIG_FILE_PATH=`eval echo "$PHP_CONFIG_FILE_PATH"`
-INCLUDE_PATH=.:$EXPANDED_PEAR_INSTALLDIR
-
-exec_prefix=$old_exec_prefix
-libdir=$old_libdir
-datadir=$old_datadir
-
-AC_SUBST(INCLUDE_PATH)
-AC_SUBST(EXPANDED_PEAR_INSTALLDIR)
-AC_SUBST(EXPANDED_EXTENSION_DIR)
-AC_SUBST(EXPANDED_BINDIR)
-AC_SUBST(EXPANDED_LIBDIR)
-AC_SUBST(EXPANDED_DATADIR)
-AC_SUBST(EXPANDED_SYSCONFDIR)
-AC_SUBST(EXPANDED_LOCALSTATEDIR)
-AC_SUBST(EXPANDED_PHP_CONFIG_FILE_PATH)
-
-PHP_BUILD_RPATH
-
-PHP_REMOVE_USR_LIB(PHP_LDFLAGS)
-PHP_REMOVE_USR_LIB(LDFLAGS)
-
-EXTRA_LDFLAGS="$EXTRA_LDFLAGS $PHP_LDFLAGS"
-
-PHP_BUILD_DATE=`date '+%Y-%m-%d'`
-AC_DEFINE_UNQUOTED(PHP_BUILD_DATE,"$PHP_BUILD_DATE",[PHP build date])
-PHP_UNAME=`uname -a`
-AC_DEFINE_UNQUOTED(PHP_UNAME,"$PHP_UNAME",[uname -a output])
-PHP_OS=`uname`
-AC_DEFINE_UNQUOTED(PHP_OS,"$PHP_OS",[uname output])
-
-
-PHP_SUBST_OLD(abs_builddir)
-PHP_SUBST_OLD(abs_srcdir)
-PHP_SUBST(bindir)
-PHP_SUBST(exec_prefix)
-PHP_SUBST(includedir)
-PHP_SUBST(libdir)
-PHP_SUBST(phplibdir)
-PHP_SUBST(phptempdir)
-PHP_SUBST(prefix)
-PHP_SUBST(localstatedir)
-PHP_SUBST(datadir)
-PHP_SUBST(sysconfdir)
-
-PHP_SUBST(AWK)
-PHP_SUBST(CC)
-PHP_SUBST(CFLAGS)
-PHP_SUBST(CFLAGS_CLEAN)
-PHP_SUBST_OLD(CONFIGURE_COMMAND)
-PHP_SUBST(CPP)
-PHP_SUBST(CPPFLAGS)
-PHP_SUBST(CXX)
-PHP_SUBST(CXXFLAGS)
-PHP_SUBST(CXXFLAGS_CLEAN)
-PHP_SUBST(CXX_PHP_COMPILE)
-PHP_SUBST_OLD(DEBUG_CFLAGS)
-PHP_SUBST(DEFS)
-PHP_SUBST_OLD(EXTENSION_DIR)
-PHP_SUBST(EXTRA_LDFLAGS)
-PHP_SUBST_OLD(EXTRA_LIBS)
-PHP_SUBST(INCLUDES)
-PHP_SUBST_OLD(INCLUDE_PATH)
-PHP_SUBST_OLD(INSTALL_IT)
-PHP_SUBST(LEX)
-PHP_SUBST(LEX_OUTPUT_ROOT)
-PHP_SUBST(LFLAGS)
-PHP_SUBST(LIBTOOL)
-PHP_SUBST(LN_S)
-PHP_SUBST_OLD(NATIVE_RPATHS)
-PHP_SUBST(PEAR_DIR)
-PHP_SUBST_OLD(PEAR_INSTALLDIR)
-PHP_SUBST(PHP_BUILD_DATE)
-PHP_SUBST(PHP_COMPILE)
-PHP_SUBST_OLD(PHP_LDFLAGS)
-PHP_SUBST_OLD(PHP_LIBS)
-PHP_SUBST(PHP_PROGRAM)
-PHP_SUBST(PHP_RPATHS)
-PHP_SUBST(PHP_SAPI)
-PHP_SUBST(PHP_VERSION)
-PHP_SUBST(PROG_SENDMAIL)
-PHP_SUBST(SHELL)
-PHP_SUBST(SHARED_LIBTOOL)
-PHP_SUBST(TSRM_DIR)
-PHP_SUBST(TSRM_LIB)
-PHP_SUBST(WARNING_LEVEL)
-PHP_SUBST_OLD(YACC)
-
-PHP_CONFIGURE_PART(Configuring libtool)
-
-old_CC=$CC
-
-if test "$PHP_THREAD_SAFETY" = "yes" && test -n "$ac_cv_pthreads_cflags"; then
- CXXFLAGS="$CXXFLAGS $ac_cv_pthreads_cflags"
- INLINE_CFLAGS="$INLINE_CFLAGS $ac_cv_pthreads_cflags"
- cat >meta_ccld<<EOF
-#! /bin/sh
-exec $CC $ac_cv_pthreads_cflags \$@
-EOF
- CC="$abs_builddir/meta_ccld"
- chmod +x meta_ccld
-fi
-
-dnl This will go away, if we have a facility to run per-extension code
-dnl after the thread_safety decision was done
-if test "$PHP_THREAD_SAFETY" = "yes" && test "$PHP_MYSQL" = "yes"; then
- CPPFLAGS="$CPPFLAGS -DTHREAD=1"
-fi
-
-AM_PROG_LIBTOOL
-if test "$enable_debug" != "yes"; then
- AM_SET_LIBTOOL_VARIABLE([--silent])
-fi
-
-
-test -z "$PHP_COMPILE" && PHP_COMPILE='$(LIBTOOL) --mode=compile $(COMPILE) -c $<'
-test -z "$CXX_PHP_COMPILE" && CXX_PHP_COMPILE='$(LIBTOOL) --mode=compile $(CXX_COMPILE) -c $<'
-SHARED_LIBTOOL='$(LIBTOOL)'
-
-CC=$old_CC
-
-PHP_CONFIGURE_PART(Generating files)
-
-CXXFLAGS_CLEAN=$CXXFLAGS
-CFLAGS_CLEAN=$CFLAGS
-CFLAGS="$CFLAGS $standard_libtool_flag"
-INLINE_CFLAGS="$INLINE_CFLAGS $standard_libtool_flag"
-CXXFLAGS="$CXXFLAGS $standard_libtool_flag"
-
-PHP_GEN_CONFIG_VARS
-
-$php_shtool mkdir -p pear/scripts
-ALL_OUTPUT_FILES="php4.spec Zend/Makefile main/build-defs.h \
-pear/scripts/pear pear/scripts/phpize pear/scripts/php-config \
-pear/scripts/pearize TSRM/Makefile $PHP_OUTPUT_FILES"
-
-AC_OUTPUT($ALL_OUTPUT_FILES, [], [
-
-if test "\$CONFIG_FILES" = "$ALL_OUTPUT_FILES"; then
- REDO_ALL=yes
-fi
-
-if test -n "\$REDO_ALL"; then
- PHP_GEN_MAKEFILES($PHP_FAST_OUTPUT_FILES)
-fi
-
-if test ! -f $srcdir/ext/bcmath/number.c; then
- echo "creating number.c"
- echo "/* Dummy File */" > $srcdir/ext/bcmath/number.c
- echo "creating number.h"
- echo "/* Dummy File */" > $srcdir/ext/bcmath/number.h
-fi
-
-################################################################
-# Create configuration headers
-#
-
-if test -d TSRM; then
- echo '#include "../main/php_config.h"' > TSRM/tsrm_config.h
-fi
-
-cat >Zend/zend_config.h <<FEO
-#include "../main/php_config.h"
-#if defined(APACHE) && defined(PHP_API_VERSION)
-#undef HAVE_DLFCN_H
-#endif
-FEO
-
-# run this only when generating all the files?
-if test -n "\$REDO_ALL"; then
- # Hacking while airborne considered harmful.
- #
- echo "creating main/internal_functions.c"
- extensions="$EXT_STATIC"
-dnl mv -f main/internal_functions.c main/internal_functions.c.old 2>/dev/null
- sh $srcdir/build/genif.sh $srcdir/main/internal_functions.c.in $srcdir "$EXTRA_MODULE_PTRS" $AWK \$extensions > main/internal_functions.c
-dnl if cmp main/internal_functions.c.old main/internal_functions.c > /dev/null 2>&1; then
-dnl echo "main/internal_functions.c is unchanged"
-dnl mv main/internal_functions.c.old main/internal_functions.c
-dnl else
-dnl rm -f main/internal_functions.c.old
-dnl fi
-
- if test -n "$PHP_APXS_BROKEN"; then
- echo "+--------------------------------------------------------------------+"
- echo "| WARNING: Your $APXS script is most likely broken."
- echo "| |"
- echo "| Please go read http://www.php.net/FAQ.php#6.11 and make the |"
- echo "| changes described there and try again. |"
- fi
-
- # Warn about CGI version with no extra security options.
- if test "$PHP_SAPI" = "cgi"; then
- if test "$REDIRECT" = "0"; then
- if test "$DISCARD_PATH" = "0"; then
- echo "+--------------------------------------------------------------------+"
- echo "| *** WARNING *** |"
- echo "| |"
- echo "| You will be compiling the CGI version of PHP without any |"
- echo "| redirection checking. By putting this cgi binary somewhere in |"
- echo "| your web space, users may be able to circumvent existing .htaccess |"
- echo "| security by loading files directly through the parser. See |"
- echo "| http://www.php.net/manual/security.php for more details. |"
- fi
- fi
- fi
-
-
- if test -n "$DEBUG_LOG"; then
- rm -f config.cache
-cat <<X
-+--------------------------------------------------------------------+
-| *** ATTENTION *** |
-| |
-| Something is likely to be messed up here, because the configure |
-| script was not able to detect a simple feature on your platform. |
-| This is often caused by incorrect configuration parameters. Please |
-| see the file debug.log for error messages. |
-| |
-| If you are unable to fix this, send the file debug.log to the |
-| php-install@lists.php.net mailing list and include appropiate |
-| information about your setup. |
-X
- fi
-
- if test "$MYSQL_MODULE_TYPE" = "builtin" ; then
-cat <<X
-+--------------------------------------------------------------------+
-| *** WARNING *** |
-| |
-| You chose to compile PHP with the built-in MySQL support. If you |
-| are compiling a server module, and intend to use other server |
-| modules that also use MySQL (e.g, mod_auth_mysql, PHP 3.0, |
-| mod_perl) you must NOT rely on PHP's built-in MySQL support, and |
-| instead build it with your local MySQL support files, by adding |
-| --with-mysql=/path/to/mysql to your configure line. |
-X
- fi
-
- echo "+--------------------------------------------------------------------+"
- echo "| License: |"
- echo "| This software is subject to the PHP License, available in this |"
- echo "| distribution in the file LICENSE. By continuing this installation |"
- echo "| process, you are bound by the terms of this license agreement. |"
- echo "| If you do not agree with the terms of this license, you must abort |"
- echo "| the installation process at this point. |"
- echo "+--------------------------------------------------------------------+"
-
-cat<<X
-
-Thank you for using PHP.
-
-X
-
-fi
-])
-
-dnl ## Local Variables:
-dnl ## tab-width: 4
-dnl ## End:
diff --git a/cvsclean b/cvsclean
deleted file mode 100755
index e98ec49b76..0000000000
--- a/cvsclean
+++ /dev/null
@@ -1,3 +0,0 @@
-#! /bin/sh
-
-${MAKE:-make} -f build/build.mk cvsclean
diff --git a/dynlib.m4 b/dynlib.m4
deleted file mode 100644
index 35f80bf3ab..0000000000
--- a/dynlib.m4
+++ /dev/null
@@ -1,88 +0,0 @@
-# +----------------------------------------------------------------------+
-# | PHP version 4.0 |
-# +----------------------------------------------------------------------+
-# | Copyright (c) 1997-2001 The PHP Group |
-# +----------------------------------------------------------------------+
-# | This source file is subject to version 2.02 of the PHP license, |
-# | that is bundled with this package in the file LICENSE, and is |
-# | available at through the world-wide-web at |
-# | http://www.php.net/license/2_02.txt. |
-# | If you did not receive a copy of the PHP license and are unable to |
-# | obtain it through the world-wide-web, please send a note to |
-# | license@php.net so we can mail you a copy immediately. |
-# +----------------------------------------------------------------------+
-# | Authors: Sascha Schumann <sascha@schumann.cx> |
-# +----------------------------------------------------------------------+
-#
-# $Id$
-#
-
-
-
-AC_DEFUN(LIB_SHARED_CONVENIENCE,[
- lib_target="\$(LTLIBRARY_NAME)"
- cat >>$1<<EOF
-\$(LTLIBRARY_NAME): \$(LTLIBRARY_SHARED_OBJECTS) \$(LTLIBRARY_DEPENDENCIES)
- \$(SHARED_LIBTOOL) --mode=link \$(COMPILE) \$(LDFLAGS) -o \[$]@ \$(LTLIBRARY_LDFLAGS) \$(LTLIBRARY_OBJECTS) \$(LTLIBRARY_SHARED_LIBADD)
-
-EOF
-])
-
-AC_DEFUN(LIB_SHARED_MODULE,[
- lib_target="\$(LTLIBRARY_SHARED_NAME)"
- cat >>$1<<EOF
-\$(LTLIBRARY_SHARED_NAME): \$(LTLIBRARY_SHARED_OBJECTS) \$(LTLIBRARY_DEPENDENCIES)
- \$(SHARED_LIBTOOL) --mode=link \$(COMPILE) \$(LDFLAGS) -o \[$]@ -avoid-version -module -rpath \$(phplibdir) \$(LTLIBRARY_LDFLAGS) \$(LTLIBRARY_OBJECTS) \$(LTLIBRARY_SHARED_LIBADD)
- \$(SHARED_LIBTOOL) --mode=install cp \[$]@ \$(phplibdir)
-
-EOF
-])
-
-AC_DEFUN(LIB_STATIC_CONVENIENCE,[
- lib_target="\$(LTLIBRARY_NAME)"
- cat >>$1<<EOF
-\$(LTLIBRARY_NAME): \$(LTLIBRARY_OBJECTS) \$(LTLIBRARY_DEPENDENCIES)
- \$(LINK) \$(LTLIBRARY_LDFLAGS) \$(LTLIBRARY_OBJECTS) \$(LTLIBRARY_LIBADD)
-
-EOF
-])
-
-dnl LIB_BUILD(path, shared, convenience)
-dnl sets up path to build a shared/static convenience/module
-AC_DEFUN(LIB_BUILD,[
- lib_makefile="$1/libs.mk"
- lib_target=""
-
- $php_shtool mkdir -p $1
- if test "$BSD_MAKEFILE" = "yes"; then
- lib_include_conf=".include \"\$(top_builddir)/config_vars.mk\""
- else
- lib_include_conf="include \$(top_builddir)/config_vars.mk"
- fi
- cat >$lib_makefile<<EOF
-$lib_include_conf
-LTLIBRARY_OBJECTS = \$(LTLIBRARY_SOURCES:.c=.lo) \$(LTLIBRARY_OBJECTS_X)
-LTLIBRARY_SHARED_OBJECTS = \$(LTLIBRARY_OBJECTS:.lo=.slo)
-EOF
-
- if test "$2" = "shared" || test "$2" = "yes"; then
- lib_build_shared=yes
- if test -n "$3"; then
-dnl ---------------------------------------- Shared Convenience
- LIB_SHARED_CONVENIENCE($lib_makefile)
- else
-dnl ---------------------------------------- Shared Module
- LIB_SHARED_MODULE($lib_makefile)
- fi
- else
-dnl ---------------------------------------- Static Convenience = Static Module
- LIB_STATIC_CONVENIENCE($lib_makefile)
- fi
-
-dnl ---------------------------------------- Generate build targets
- if test -n "$lib_target"; then
- cat >>$lib_makefile<<EOF
-targets = $lib_target
-EOF
- fi
-])
diff --git a/ext/Makefile.in b/ext/Makefile.in
deleted file mode 100644
index 77ff9c04b5..0000000000
--- a/ext/Makefile.in
+++ /dev/null
@@ -1,4 +0,0 @@
-
-SUBDIRS = $(EXT_SUBDIRS)
-
-include $(top_srcdir)/build/rules.mk
diff --git a/ext/aspell/CREDITS b/ext/aspell/CREDITS
deleted file mode 100644
index 38addc2b8d..0000000000
--- a/ext/aspell/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-aspell
-Rasmus Lerdorf
diff --git a/ext/aspell/Makefile.in b/ext/aspell/Makefile.in
deleted file mode 100644
index c80a02c617..0000000000
--- a/ext/aspell/Makefile.in
+++ /dev/null
@@ -1,5 +0,0 @@
-
-LTLIBRARY_NAME = libaspell.la
-LTLIBRARY_SOURCES = aspell.c
-
-include $(top_srcdir)/build/dynlib.mk
diff --git a/ext/aspell/aspell.c b/ext/aspell/aspell.c
deleted file mode 100644
index e7f1be9a31..0000000000
--- a/ext/aspell/aspell.c
+++ /dev/null
@@ -1,226 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-
-#ifdef COMPILE_DL_ASPELL
-#include "phpdl.h"
-#endif
-#include <stdlib.h>
-#include <ctype.h>
-#include <stdio.h>
-
-#if HAVE_ASPELL
-
-#include "php_aspell.h"
-#include <aspell-c.h>
-#include "ext/standard/info.h"
-
-/* {{{ aspell_functions[]
- */
-function_entry aspell_functions[] = {
- PHP_FE(aspell_new, NULL)
- PHP_FE(aspell_check, NULL)
- PHP_FE(aspell_check_raw, NULL)
- PHP_FE(aspell_suggest, NULL)
- {NULL, NULL, NULL}
-};
-/* }}} */
-
-static int le_aspell;
-
-zend_module_entry aspell_module_entry = {
- "aspell", aspell_functions, PHP_MINIT(aspell), NULL, NULL, NULL, PHP_MINFO(aspell), STANDARD_MODULE_PROPERTIES
-};
-
-#ifdef COMPILE_DL_ASPELL
-ZEND_GET_MODULE(aspell)
-#endif
-
-/* {{{ php_aspell_close
- */
-static void php_aspell_close(zend_rsrc_list_entry *rsrc)
-{
- aspell *sc = (aspell *)rsrc->ptr;
- aspell_free(sc);
-}
-/* }}} */
-
-/* {{{ PHP_MINIT_FUNCTION
- */
-PHP_MINIT_FUNCTION(aspell)
-{
- le_aspell = zend_register_list_destructors_ex(php_aspell_close, NULL, "aspell", module_number);
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ proto int aspell_new(string master [, string personal])
- Load a dictionary */
-PHP_FUNCTION(aspell_new)
-{
- pval **master,**personal;
- int argc;
- aspell *sc;
- int ind;
-
- argc = ZEND_NUM_ARGS();
- if (argc < 1 || argc > 2 || zend_get_parameters_ex(argc,&master,&personal) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(master);
- if(argc==2)
- {
- convert_to_string_ex(personal) ;
- sc=aspell_new((*master)->value.str.val,(*personal)->value.str.val);
- }
- else
- sc=aspell_new((*master)->value.str.val,"");
-
- ind = zend_list_insert(sc, le_aspell);
- RETURN_LONG(ind);
-}
-/* }}} */
-
-/* {{{ proto array aspell_suggest(aspell int, string word)
- Return array of Suggestions */
-PHP_FUNCTION(aspell_suggest)
-{
- pval **scin, **word;
- int argc;
- aspell *sc;
- int ind,type;
- aspellSuggestions *sug;
- size_t i;
-
-
- argc = ZEND_NUM_ARGS();
- if (argc != 2 || zend_get_parameters_ex(argc, &scin,&word) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(scin);
- convert_to_string_ex(word);
- sc = (aspell *)zend_list_find((*scin)->value.lval, &type);
- if(!sc)
- {
- php_error(E_WARNING, "%d is not an ASPELL result index",(*scin)->value.lval);
- RETURN_FALSE;
- }
-
- if (array_init(return_value) == FAILURE) {
- RETURN_FALSE;
- }
-
- sug = aspell_suggest(sc, (*word)->value.str.val);
- for (i = 0; i != sug->size; ++i) {
- add_next_index_string(return_value,(char *)sug->data[i],1);
- }
- aspell_free_suggestions(sug);
-}
-/* }}} */
-
-/* {{{ proto int aspell_check(aspell int, string word)
- Return if word is valid */
-PHP_FUNCTION(aspell_check)
-{
- int type;
- pval **scin,**word;
- aspell *sc;
-
- int argc;
- argc = ZEND_NUM_ARGS();
- if (argc != 2 || zend_get_parameters_ex(argc, &scin,&word) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(scin);
- convert_to_string_ex(word);
- sc= (aspell *) zend_list_find((*scin)->value.lval, &type);
- if(!sc)
- {
- php_error(E_WARNING, "%d is not an ASPELL result index",(*scin)->value.lval);
- RETURN_FALSE;
- }
- if (aspell_check(sc, (*word)->value.str.val))
- {
- RETURN_TRUE;
- }
- else
- {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto int aspell_check_raw(aspell int, string word)
- Return if word is valid, ignoring case or trying to trim it in any way */
-PHP_FUNCTION(aspell_check_raw)
-{
- pval **scin,**word;
- int type;
- int argc;
- aspell *sc;
-
- argc = ZEND_NUM_ARGS();
- if (argc != 2 || zend_get_parameters_ex(argc, &scin,&word) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(scin);
- convert_to_string_ex(word);
- sc = (aspell *)zend_list_find((*scin)->value.lval, &type);
- if(!sc)
- {
- php_error(E_WARNING, "%d is not an ASPELL result index",(*scin)->value.lval);
- RETURN_FALSE;
- }
- if (aspell_check_raw(sc, (*word)->value.str.val))
- {
- RETURN_TRUE;
- }
- else
- {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ PHP_MINFO_FUNCTION
- */
-PHP_MINFO_FUNCTION(aspell)
-{
- php_info_print_table_start();
- php_info_print_table_row(2, "ASpell Support", "enabled");
- php_info_print_table_end();
-}
-/* }}} */
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/aspell/config.m4 b/ext/aspell/config.m4
deleted file mode 100644
index 9955de570f..0000000000
--- a/ext/aspell/config.m4
+++ /dev/null
@@ -1,28 +0,0 @@
-dnl $Id$
-
-AC_MSG_CHECKING(for ASPELL support)
-AC_ARG_WITH(aspell,
-[ --with-aspell[=DIR] Include ASPELL support.],
-[
- if test "$withval" != "no"; then
- if test "$withval" = "yes"; then
- ASPELL_DIR=/usr/local
- else
- ASPELL_DIR=$withval
- fi
-
- PHP_ADD_INCLUDE($ASPELL_DIR/include)
- PHP_ADD_LIBRARY_WITH_PATH(aspell, $ASPELL_DIR/lib)
-
- if test ! -f "$ASPELL_DIR/include/aspell-c.h"; then
- AC_MSG_ERROR(Could not find aspell-c.h in $ASPELL_DIR/include - please copy it manually from the aspell sources to $ASPELL_DIR/include)
- fi
- AC_DEFINE(HAVE_ASPELL,1,[Whether you have aspell])
- AC_MSG_RESULT(yes)
- PHP_EXTENSION(aspell)
- else
- AC_MSG_RESULT(no)
- fi
-],[
- AC_MSG_RESULT(no)
-])
diff --git a/ext/aspell/php_aspell.h b/ext/aspell/php_aspell.h
deleted file mode 100644
index 09541eb832..0000000000
--- a/ext/aspell/php_aspell.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef PHP_ASPELL_H
-#define PHP_ASPELL_H
-#if HAVE_ASPELL
-extern zend_module_entry aspell_module_entry;
-#define aspell_module_ptr &aspell_module_entry
-
-extern PHP_MINIT_FUNCTION(aspell);
-extern PHP_MINFO_FUNCTION(aspell);
-
-PHP_FUNCTION(aspell_new);
-PHP_FUNCTION(aspell_check);
-PHP_FUNCTION(aspell_check_raw);
-PHP_FUNCTION(aspell_suggest);
-
-#else
-#define aspell_module_ptr NULL
-#endif
-
-#define phpext_aspell_ptr aspell_module_ptr
-
-#endif /* PHP_ASPELL_H */
diff --git a/ext/bcmath/CREDITS b/ext/bcmath/CREDITS
deleted file mode 100644
index 7b4083ea13..0000000000
--- a/ext/bcmath/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-BC Math
-Andi Gutmans
diff --git a/ext/bcmath/Makefile.in b/ext/bcmath/Makefile.in
deleted file mode 100644
index e57936fd81..0000000000
--- a/ext/bcmath/Makefile.in
+++ /dev/null
@@ -1,11 +0,0 @@
-
-LTLIBRARY_NAME = libbcmath.la
-LTLIBRARY_SOURCES = bcmath.c number.c
-LTLIBRARY_SHARED_NAME = bcmath.la
-LTLIBRARY_DEPENDENCIES = libbcmath/libbcmath.la
-LTLIBRARY_LIBADD = $(LTLIBRARY_DEPENDENCIES)
-LTLIBRARY_SHARED_LIBADD = $(LTLIBRARY_LIBADD)
-
-SUBDIRS = libbcmath
-
-include $(top_srcdir)/build/dynlib.mk
diff --git a/ext/bcmath/bcmath.c b/ext/bcmath/bcmath.c
deleted file mode 100644
index 5771477c0f..0000000000
--- a/ext/bcmath/bcmath.c
+++ /dev/null
@@ -1,504 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-
-#if WITH_BCMATH
-
-#include "ext/standard/info.h"
-#include "php_bcmath.h"
-#include "ext/bcmath/libbcmath/src/bcmath.h"
-
-function_entry bcmath_functions[] = {
- PHP_FE(bcadd, NULL)
- PHP_FE(bcsub, NULL)
- PHP_FE(bcmul, NULL)
- PHP_FE(bcdiv, NULL)
- PHP_FE(bcmod, NULL)
- PHP_FE(bcpow, NULL)
- PHP_FE(bcsqrt, NULL)
- PHP_FE(bcscale, NULL)
- PHP_FE(bccomp, NULL)
- {NULL, NULL, NULL}
-};
-
-zend_module_entry bcmath_module_entry = {
- "bcmath",
- bcmath_functions,
- PHP_MINIT(bcmath),
- PHP_MSHUTDOWN(bcmath),
- PHP_RINIT(bcmath),
- NULL,
- PHP_MINFO(bcmath),
- STANDARD_MODULE_PROPERTIES
-};
-
-#ifdef COMPILE_DL_BCMATH
-ZEND_GET_MODULE(bcmath)
-#endif
-
-#ifndef THREAD_SAFE
-static long bc_precision;
-#endif
-
-/* Storage used for special numbers. */
-bc_num _zero_;
-bc_num _one_;
-bc_num _two_;
-
-
-/* Make a copy of a number! Just increments the reference count! */
-bc_num copy_num (bc_num num)
-{
- num->n_refs++;
- return num;
-}
-
-
-/* Initialize a number NUM by making it a copy of zero. */
-void init_num (bc_num *num)
-{
- *num = copy_num (_zero_);
-}
-
-
-PHP_MINIT_FUNCTION(bcmath)
-{
- extern bc_num _zero_;
- extern bc_num _one_;
- extern bc_num _two_;
-
- _zero_ = bc_new_num (1,0);
- _one_ = bc_new_num (1,0);
- _one_->n_value[0] = 1;
- _two_ = bc_new_num (1,0);
- _two_->n_value[0] = 2;
- persist_alloc(_zero_);
- persist_alloc(_one_);
- persist_alloc(_two_);
- persist_alloc(_zero_->n_ptr);
- persist_alloc(_one_->n_ptr);
- persist_alloc(_two_->n_ptr);
-
- return SUCCESS;
-}
-
-
-
-PHP_MSHUTDOWN_FUNCTION(bcmath)
-{
- bc_free_num(&_zero_);
- bc_free_num(&_one_);
- bc_free_num(&_two_);
- return SUCCESS;
-}
-
-
-PHP_RINIT_FUNCTION(bcmath)
-{
- if (cfg_get_long("bcmath.scale",&bc_precision)==FAILURE) {
- bc_precision=0;
- }
- return SUCCESS;
-}
-
-
-PHP_MINFO_FUNCTION(bcmath)
-{
- php_info_print_table_start();
- php_info_print_table_row(2, "BCMath support", "enabled");
- php_info_print_table_end();
-}
-
-/* {{{ proto string bcadd(string left_operand, string right_operand [, int scale])
- Returns the sum of two arbitrary precision numbers */
-PHP_FUNCTION(bcadd)
-{
- pval **left, **right,**scale_param;
- bc_num first, second, result;
- int scale=bc_precision;
-
- switch (ZEND_NUM_ARGS()) {
- case 2:
- if (zend_get_parameters_ex(2, &left,&right) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- break;
- case 3:
- if (zend_get_parameters_ex(3, &left,&right, &scale_param) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(scale_param);
- scale = (int) (*scale_param)->value.lval;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- convert_to_string_ex(left);
- convert_to_string_ex(right);
- bc_init_num(&first);
- bc_init_num(&second);
- bc_init_num(&result);
- bc_str2num(&first,(*left)->value.str.val,scale);
- bc_str2num(&second,(*right)->value.str.val,scale);
- bc_add (first,second,&result, scale);
- return_value->value.str.val = bc_num2str(result);
- return_value->value.str.len = strlen(return_value->value.str.val);
- return_value->type = IS_STRING;
- bc_free_num(&first);
- bc_free_num(&second);
- bc_free_num(&result);
- return;
-}
-/* }}} */
-
-/* {{{ proto string bcsub(string left_operand, string right_operand [, int scale])
- Returns the difference between two arbitrary precision numbers */
-PHP_FUNCTION(bcsub)
-{
- pval **left, **right,**scale_param;
- bc_num first, second, result;
- int scale=bc_precision;
-
- switch (ZEND_NUM_ARGS()) {
- case 2:
- if (zend_get_parameters_ex(2, &left,&right) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- break;
- case 3:
- if (zend_get_parameters_ex(3, &left,&right, &scale_param) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(scale_param);
- scale = (int) (*scale_param)->value.lval;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- convert_to_string_ex(left);
- convert_to_string_ex(right);
- bc_init_num(&first);
- bc_init_num(&second);
- bc_init_num(&result);
- bc_str2num(&first,(*left)->value.str.val,scale);
- bc_str2num(&second,(*right)->value.str.val,scale);
- bc_sub (first,second,&result, scale);
- return_value->value.str.val = bc_num2str(result);
- return_value->value.str.len = strlen(return_value->value.str.val);
- return_value->type = IS_STRING;
- bc_free_num(&first);
- bc_free_num(&second);
- bc_free_num(&result);
- return;
-}
-/* }}} */
-
-/* {{{ proto string bcmul(string left_operand, string right_operand [, int scale])
- Returns the multiplication of two arbitrary precision numbers */
-PHP_FUNCTION(bcmul)
-{
- pval **left, **right,**scale_param;
- bc_num first, second, result;
- int scale=bc_precision;
-
- switch (ZEND_NUM_ARGS()) {
- case 2:
- if (zend_get_parameters_ex(2, &left,&right) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- break;
- case 3:
- if (zend_get_parameters_ex(3, &left,&right, &scale_param) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(scale_param);
- scale = (int) (*scale_param)->value.lval;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- convert_to_string_ex(left);
- convert_to_string_ex(right);
- bc_init_num(&first);
- bc_init_num(&second);
- bc_init_num(&result);
- bc_str2num(&first,(*left)->value.str.val,scale);
- bc_str2num(&second,(*right)->value.str.val,scale);
- bc_multiply (first,second,&result, scale);
- return_value->value.str.val = bc_num2str(result);
- return_value->value.str.len = strlen(return_value->value.str.val);
- return_value->type = IS_STRING;
- bc_free_num(&first);
- bc_free_num(&second);
- bc_free_num(&result);
- return;
-}
-/* }}} */
-
-/* {{{ proto string bcdiv(string left_operand, string right_operand [, int scale])
- Returns the quotient of two arbitrary precision numbers (division) */
-PHP_FUNCTION(bcdiv)
-{
- pval **left, **right,**scale_param;
- bc_num first, second, result;
- int scale=bc_precision;
-
- switch (ZEND_NUM_ARGS()) {
- case 2:
- if (zend_get_parameters_ex(2, &left,&right) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- break;
- case 3:
- if (zend_get_parameters_ex(3, &left,&right, &scale_param) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(scale_param);
- scale = (int) (*scale_param)->value.lval;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- convert_to_string_ex(left);
- convert_to_string_ex(right);
- bc_init_num(&first);
- bc_init_num(&second);
- bc_init_num(&result);
- bc_str2num(&first,(*left)->value.str.val,scale);
- bc_str2num(&second,(*right)->value.str.val,scale);
- switch (bc_divide (first,second,&result, scale)) {
- case 0: /* OK */
- return_value->value.str.val = bc_num2str(result);
- return_value->value.str.len = strlen(return_value->value.str.val);
- return_value->type = IS_STRING;
- break;
- case -1: /* division by zero */
- php_error(E_WARNING,"Division by zero");
- break;
- }
- bc_free_num(&first);
- bc_free_num(&second);
- bc_free_num(&result);
- return;
-}
-/* }}} */
-
-/* {{{ proto string bcmod(string left_operand, string right_operand)
- Returns the modulus of the two arbitrary precision operands */
-PHP_FUNCTION(bcmod)
-{
- pval **left, **right;
- bc_num first, second, result;
-
- switch (ZEND_NUM_ARGS()) {
- case 2:
- if (zend_get_parameters_ex(2, &left,&right) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- convert_to_string_ex(left);
- convert_to_string_ex(right);
- bc_init_num(&first);
- bc_init_num(&second);
- bc_init_num(&result);
- bc_str2num(&first,(*left)->value.str.val,0);
- bc_str2num(&second,(*right)->value.str.val,0);
- switch (bc_modulo(first,second,&result, 0)) {
- case 0:
- return_value->value.str.val = bc_num2str(result);
- return_value->value.str.len = strlen(return_value->value.str.val);
- return_value->type = IS_STRING;
- break;
- case -1:
- php_error(E_WARNING,"Division by zero");
- break;
- }
- bc_free_num(&first);
- bc_free_num(&second);
- bc_free_num(&result);
- return;
-}
-/* }}} */
-
-/* {{{ proto string bcpow(string x, string y [, int scale])
- Returns the value of an arbitrary precision number raised to the power of another */
-PHP_FUNCTION(bcpow)
-{
- pval **left, **right,**scale_param;
- bc_num first, second, result;
- int scale=bc_precision;
-
- switch (ZEND_NUM_ARGS()) {
- case 2:
- if (zend_get_parameters_ex(2, &left,&right) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- break;
- case 3:
- if (zend_get_parameters_ex(3, &left,&right, &scale_param) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(scale_param);
- scale = (int) (*scale_param)->value.lval;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- convert_to_string_ex(left);
- convert_to_string_ex(right);
- bc_init_num(&first);
- bc_init_num(&second);
- bc_init_num(&result);
- bc_str2num(&first,(*left)->value.str.val,scale);
- bc_str2num(&second,(*right)->value.str.val,scale);
- bc_raise (first,second,&result, scale);
- return_value->value.str.val = bc_num2str(result);
- return_value->value.str.len = strlen(return_value->value.str.val);
- return_value->type = IS_STRING;
- bc_free_num(&first);
- bc_free_num(&second);
- bc_free_num(&result);
- return;
-}
-/* }}} */
-
-/* {{{ proto string bcsqrt(string operand [, int scale])
- Returns the square root of an arbitray precision number */
-PHP_FUNCTION(bcsqrt)
-{
- pval **left,**scale_param;
- bc_num result;
- int scale=bc_precision;
-
- switch (ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &left)== FAILURE) {
- WRONG_PARAM_COUNT;
- }
- break;
- case 2:
- if (zend_get_parameters_ex(2, &left,&scale_param) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(scale_param);
- scale = (int) (*scale_param)->value.lval;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- convert_to_string_ex(left);
- bc_init_num(&result);
- bc_str2num(&result,(*left)->value.str.val,scale);
- if (bc_sqrt (&result, scale) != 0) {
- return_value->value.str.val = bc_num2str(result);
- return_value->value.str.len = strlen(return_value->value.str.val);
- return_value->type = IS_STRING;
- } else {
- php_error(E_WARNING,"Square root of negative number");
- }
- bc_free_num(&result);
- return;
-}
-/* }}} */
-
-/* {{{ proto string bccomp(string left_operand, string right_operand [, int scale])
- Compares two arbitrary precision numbers */
-PHP_FUNCTION(bccomp)
-{
- pval **left, **right, **scale_param;
- bc_num first, second;
- int scale=bc_precision;
-
- switch (ZEND_NUM_ARGS()) {
- case 2:
- if (zend_get_parameters_ex(2, &left,&right) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- break;
- case 3:
- if (zend_get_parameters_ex(3, &left,&right, &scale_param) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(scale_param);
- scale = (int) (*scale_param)->value.lval;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- convert_to_string_ex(left);
- convert_to_string_ex(right);
- bc_init_num(&first);
- bc_init_num(&second);
-
- bc_str2num(&first,(*left)->value.str.val,scale);
- bc_str2num(&second,(*right)->value.str.val,scale);
- return_value->value.lval = bc_compare(first,second);
- return_value->type = IS_LONG;
-
- bc_free_num(&first);
- bc_free_num(&second);
- return;
-}
-/* }}} */
-
-/* {{{ proto string bcscale(int scale)
- Sets default scale parameter for all bc math functions */
-PHP_FUNCTION(bcscale)
-{
- pval **new_scale;
-
- if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1,&new_scale)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(new_scale);
- bc_precision = (*new_scale)->value.lval;
- RETURN_TRUE;
-}
-/* }}} */
-
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/bcmath/config.m4 b/ext/bcmath/config.m4
deleted file mode 100644
index ed5677416d..0000000000
--- a/ext/bcmath/config.m4
+++ /dev/null
@@ -1,16 +0,0 @@
-dnl $Id$
-
-PHP_ARG_ENABLE(bcmath, for bc style precision math functions,
-[ --enable-bcmath Enable bc style precision math functions.])
-
-if test "$PHP_BCMATH" != "no"; then
- AC_DEFINE(WITH_BCMATH, 1, [Whether you have bcmath])
- PHP_EXTENSION(bcmath, $ext_shared)
- PHP_FAST_OUTPUT($ext_builddir/libbcmath/Makefile $ext_builddir/libbcmath/src/Makefile)
- LIB_BUILD($ext_builddir/libbcmath,$ext_shared,yes)
- LIB_BUILD($ext_builddir/libbcmath/src,$ext_shared,yes)
-fi
-
-dnl ## Local Variables:
-dnl ## tab-width: 4
-dnl ## End:
diff --git a/ext/bcmath/libbcmath/AUTHORS b/ext/bcmath/libbcmath/AUTHORS
deleted file mode 100644
index 982db9dc40..0000000000
--- a/ext/bcmath/libbcmath/AUTHORS
+++ /dev/null
@@ -1,3 +0,0 @@
-Phil Nelson <philnelson@acm.org> wrote bcmath library.
-
-
diff --git a/ext/bcmath/libbcmath/COPYING.LIB b/ext/bcmath/libbcmath/COPYING.LIB
deleted file mode 100644
index c4792dd27a..0000000000
--- a/ext/bcmath/libbcmath/COPYING.LIB
+++ /dev/null
@@ -1,515 +0,0 @@
-
- GNU LESSER GENERAL PUBLIC LICENSE
- Version 2.1, February 1999
-
- Copyright (C) 1991, 1999 Free Software Foundation, Inc.
- 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-[This is the first released version of the Lesser GPL. It also counts
- as the successor of the GNU Library Public License, version 2, hence
- the version number 2.1.]
-
- Preamble
-
- The licenses for most software are designed to take away your
-freedom to share and change it. By contrast, the GNU General Public
-Licenses are intended to guarantee your freedom to share and change
-free software--to make sure the software is free for all its users.
-
- This license, the Lesser General Public License, applies to some
-specially designated software packages--typically libraries--of the
-Free Software Foundation and other authors who decide to use it. You
-can use it too, but we suggest you first think carefully about whether
-this license or the ordinary General Public License is the better
-strategy to use in any particular case, based on the explanations
-below.
-
- When we speak of free software, we are referring to freedom of use,
-not price. Our General Public Licenses are designed to make sure that
-you have the freedom to distribute copies of free software (and charge
-for this service if you wish); that you receive source code or can get
-it if you want it; that you can change the software and use pieces of
-it in new free programs; and that you are informed that you can do
-these things.
-
- To protect your rights, we need to make restrictions that forbid
-distributors to deny you these rights or to ask you to surrender these
-rights. These restrictions translate to certain responsibilities for
-you if you distribute copies of the library or if you modify it.
-
- For example, if you distribute copies of the library, whether gratis
-or for a fee, you must give the recipients all the rights that we gave
-you. You must make sure that they, too, receive or can get the source
-code. If you link other code with the library, you must provide
-complete object files to the recipients, so that they can relink them
-with the library after making changes to the library and recompiling
-it. And you must show them these terms so they know their rights.
-
- We protect your rights with a two-step method: (1) we copyright the
-library, and (2) we offer you this license, which gives you legal
-permission to copy, distribute and/or modify the library.
-
- To protect each distributor, we want to make it very clear that
-there is no warranty for the free library. Also, if the library is
-modified by someone else and passed on, the recipients should know
-that what they have is not the original version, so that the original
-author's reputation will not be affected by problems that might be
-introduced by others.
-^L
- Finally, software patents pose a constant threat to the existence of
-any free program. We wish to make sure that a company cannot
-effectively restrict the users of a free program by obtaining a
-restrictive license from a patent holder. Therefore, we insist that
-any patent license obtained for a version of the library must be
-consistent with the full freedom of use specified in this license.
-
- Most GNU software, including some libraries, is covered by the
-ordinary GNU General Public License. This license, the GNU Lesser
-General Public License, applies to certain designated libraries, and
-is quite different from the ordinary General Public License. We use
-this license for certain libraries in order to permit linking those
-libraries into non-free programs.
-
- When a program is linked with a library, whether statically or using
-a shared library, the combination of the two is legally speaking a
-combined work, a derivative of the original library. The ordinary
-General Public License therefore permits such linking only if the
-entire combination fits its criteria of freedom. The Lesser General
-Public License permits more lax criteria for linking other code with
-the library.
-
- We call this license the "Lesser" General Public License because it
-does Less to protect the user's freedom than the ordinary General
-Public License. It also provides other free software developers Less
-of an advantage over competing non-free programs. These disadvantages
-are the reason we use the ordinary General Public License for many
-libraries. However, the Lesser license provides advantages in certain
-special circumstances.
-
- For example, on rare occasions, there may be a special need to
-encourage the widest possible use of a certain library, so that it
-becomes
-a de-facto standard. To achieve this, non-free programs must be
-allowed to use the library. A more frequent case is that a free
-library does the same job as widely used non-free libraries. In this
-case, there is little to gain by limiting the free library to free
-software only, so we use the Lesser General Public License.
-
- In other cases, permission to use a particular library in non-free
-programs enables a greater number of people to use a large body of
-free software. For example, permission to use the GNU C Library in
-non-free programs enables many more people to use the whole GNU
-operating system, as well as its variant, the GNU/Linux operating
-system.
-
- Although the Lesser General Public License is Less protective of the
-users' freedom, it does ensure that the user of a program that is
-linked with the Library has the freedom and the wherewithal to run
-that program using a modified version of the Library.
-
- The precise terms and conditions for copying, distribution and
-modification follow. Pay close attention to the difference between a
-"work based on the library" and a "work that uses the library". The
-former contains code derived from the library, whereas the latter must
-be combined with the library in order to run.
-^L
- GNU LESSER GENERAL PUBLIC LICENSE
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
- 0. This License Agreement applies to any software library or other
-program which contains a notice placed by the copyright holder or
-other authorized party saying it may be distributed under the terms of
-this Lesser General Public License (also called "this License").
-Each licensee is addressed as "you".
-
- A "library" means a collection of software functions and/or data
-prepared so as to be conveniently linked with application programs
-(which use some of those functions and data) to form executables.
-
- The "Library", below, refers to any such software library or work
-which has been distributed under these terms. A "work based on the
-Library" means either the Library or any derivative work under
-copyright law: that is to say, a work containing the Library or a
-portion of it, either verbatim or with modifications and/or translated
-straightforwardly into another language. (Hereinafter, translation is
-included without limitation in the term "modification".)
-
- "Source code" for a work means the preferred form of the work for
-making modifications to it. For a library, complete source code means
-all the source code for all modules it contains, plus any associated
-interface definition files, plus the scripts used to control
-compilation
-and installation of the library.
-
- Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope. The act of
-running a program using the Library is not restricted, and output from
-such a program is covered only if its contents constitute a work based
-on the Library (independent of the use of the Library in a tool for
-writing it). Whether that is true depends on what the Library does
-and what the program that uses the Library does.
-
- 1. You may copy and distribute verbatim copies of the Library's
-complete source code as you receive it, in any medium, provided that
-you conspicuously and appropriately publish on each copy an
-appropriate copyright notice and disclaimer of warranty; keep intact
-all the notices that refer to this License and to the absence of any
-warranty; and distribute a copy of this License along with the
-Library.
-
- You may charge a fee for the physical act of transferring a copy,
-and you may at your option offer warranty protection in exchange for a
-fee.
-
- 2. You may modify your copy or copies of the Library or any portion
-of it, thus forming a work based on the Library, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
- a) The modified work must itself be a software library.
-
- b) You must cause the files modified to carry prominent notices
- stating that you changed the files and the date of any change.
-
- c) You must cause the whole of the work to be licensed at no
- charge to all third parties under the terms of this License.
-
- d) If a facility in the modified Library refers to a function or a
- table of data to be supplied by an application program that uses
- the facility, other than as an argument passed when the facility
- is invoked, then you must make a good faith effort to ensure that,
- in the event an application does not supply such function or
- table, the facility still operates, and performs whatever part of
- its purpose remains meaningful.
-
- (For example, a function in a library to compute square roots has
- a purpose that is entirely well-defined independent of the
- application. Therefore, Subsection 2d requires that any
- application-supplied function or table used by this function must
- be optional: if the application does not supply it, the square
- root function must still compute square roots.)
-
-These requirements apply to the modified work as a whole. If
-identifiable sections of that work are not derived from the Library,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works. But when you
-distribute the same sections as part of a whole which is a work based
-on the Library, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote
-it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Library.
-
-In addition, mere aggregation of another work not based on the Library
-with the Library (or with a work based on the Library) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
- 3. You may opt to apply the terms of the ordinary GNU General Public
-License instead of this License to a given copy of the Library. To do
-this, you must alter all the notices that refer to this License, so
-that they refer to the ordinary GNU General Public License, version 2,
-instead of to this License. (If a newer version than version 2 of the
-ordinary GNU General Public License has appeared, then you can specify
-that version instead if you wish.) Do not make any other change in
-these notices.
-^L
- Once this change is made in a given copy, it is irreversible for
-that copy, so the ordinary GNU General Public License applies to all
-subsequent copies and derivative works made from that copy.
-
- This option is useful when you wish to copy part of the code of
-the Library into a program that is not a library.
-
- 4. You may copy and distribute the Library (or a portion or
-derivative of it, under Section 2) in object code or executable form
-under the terms of Sections 1 and 2 above provided that you accompany
-it with the complete corresponding machine-readable source code, which
-must be distributed under the terms of Sections 1 and 2 above on a
-medium customarily used for software interchange.
-
- If distribution of object code is made by offering access to copy
-from a designated place, then offering equivalent access to copy the
-source code from the same place satisfies the requirement to
-distribute the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
- 5. A program that contains no derivative of any portion of the
-Library, but is designed to work with the Library by being compiled or
-linked with it, is called a "work that uses the Library". Such a
-work, in isolation, is not a derivative work of the Library, and
-therefore falls outside the scope of this License.
-
- However, linking a "work that uses the Library" with the Library
-creates an executable that is a derivative of the Library (because it
-contains portions of the Library), rather than a "work that uses the
-library". The executable is therefore covered by this License.
-Section 6 states terms for distribution of such executables.
-
- When a "work that uses the Library" uses material from a header file
-that is part of the Library, the object code for the work may be a
-derivative work of the Library even though the source code is not.
-Whether this is true is especially significant if the work can be
-linked without the Library, or if the work is itself a library. The
-threshold for this to be true is not precisely defined by law.
-
- If such an object file uses only numerical parameters, data
-structure layouts and accessors, and small macros and small inline
-functions (ten lines or less in length), then the use of the object
-file is unrestricted, regardless of whether it is legally a derivative
-work. (Executables containing this object code plus portions of the
-Library will still fall under Section 6.)
-
- Otherwise, if the work is a derivative of the Library, you may
-distribute the object code for the work under the terms of Section 6.
-Any executables containing that work also fall under Section 6,
-whether or not they are linked directly with the Library itself.
-^L
- 6. As an exception to the Sections above, you may also combine or
-link a "work that uses the Library" with the Library to produce a
-work containing portions of the Library, and distribute that work
-under terms of your choice, provided that the terms permit
-modification of the work for the customer's own use and reverse
-engineering for debugging such modifications.
-
- You must give prominent notice with each copy of the work that the
-Library is used in it and that the Library and its use are covered by
-this License. You must supply a copy of this License. If the work
-during execution displays copyright notices, you must include the
-copyright notice for the Library among them, as well as a reference
-directing the user to the copy of this License. Also, you must do one
-of these things:
-
- a) Accompany the work with the complete corresponding
- machine-readable source code for the Library including whatever
- changes were used in the work (which must be distributed under
- Sections 1 and 2 above); and, if the work is an executable linked
- with the Library, with the complete machine-readable "work that
- uses the Library", as object code and/or source code, so that the
- user can modify the Library and then relink to produce a modified
- executable containing the modified Library. (It is understood
- that the user who changes the contents of definitions files in the
- Library will not necessarily be able to recompile the application
- to use the modified definitions.)
-
- b) Use a suitable shared library mechanism for linking with the
- Library. A suitable mechanism is one that (1) uses at run time a
- copy of the library already present on the user's computer system,
- rather than copying library functions into the executable, and (2)
- will operate properly with a modified version of the library, if
- the user installs one, as long as the modified version is
- interface-compatible with the version that the work was made with.
-
- c) Accompany the work with a written offer, valid for at
- least three years, to give the same user the materials
- specified in Subsection 6a, above, for a charge no more
- than the cost of performing this distribution.
-
- d) If distribution of the work is made by offering access to copy
- from a designated place, offer equivalent access to copy the above
- specified materials from the same place.
-
- e) Verify that the user has already received a copy of these
- materials or that you have already sent this user a copy.
-
- For an executable, the required form of the "work that uses the
-Library" must include any data and utility programs needed for
-reproducing the executable from it. However, as a special exception,
-the materials to be distributed need not include anything that is
-normally distributed (in either source or binary form) with the major
-components (compiler, kernel, and so on) of the operating system on
-which the executable runs, unless that component itself accompanies
-the executable.
-
- It may happen that this requirement contradicts the license
-restrictions of other proprietary libraries that do not normally
-accompany the operating system. Such a contradiction means you cannot
-use both them and the Library together in an executable that you
-distribute.
-^L
- 7. You may place library facilities that are a work based on the
-Library side-by-side in a single library together with other library
-facilities not covered by this License, and distribute such a combined
-library, provided that the separate distribution of the work based on
-the Library and of the other library facilities is otherwise
-permitted, and provided that you do these two things:
-
- a) Accompany the combined library with a copy of the same work
- based on the Library, uncombined with any other library
- facilities. This must be distributed under the terms of the
- Sections above.
-
- b) Give prominent notice with the combined library of the fact
- that part of it is a work based on the Library, and explaining
- where to find the accompanying uncombined form of the same work.
-
- 8. You may not copy, modify, sublicense, link with, or distribute
-the Library except as expressly provided under this License. Any
-attempt otherwise to copy, modify, sublicense, link with, or
-distribute the Library is void, and will automatically terminate your
-rights under this License. However, parties who have received copies,
-or rights, from you under this License will not have their licenses
-terminated so long as such parties remain in full compliance.
-
- 9. You are not required to accept this License, since you have not
-signed it. However, nothing else grants you permission to modify or
-distribute the Library or its derivative works. These actions are
-prohibited by law if you do not accept this License. Therefore, by
-modifying or distributing the Library (or any work based on the
-Library), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Library or works based on it.
-
- 10. Each time you redistribute the Library (or any work based on the
-Library), the recipient automatically receives a license from the
-original licensor to copy, distribute, link with or modify the Library
-subject to these terms and conditions. You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties with
-this License.
-^L
- 11. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Library at all. For example, if a patent
-license would not permit royalty-free redistribution of the Library by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Library.
-
-If any portion of this section is held invalid or unenforceable under
-any particular circumstance, the balance of the section is intended to
-apply, and the section as a whole is intended to apply in other
-circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system which is
-implemented by public license practices. Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
- 12. If the distribution and/or use of the Library is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Library under this License
-may add an explicit geographical distribution limitation excluding those
-countries, so that distribution is permitted only in or among
-countries not thus excluded. In such case, this License incorporates
-the limitation as if written in the body of this License.
-
- 13. The Free Software Foundation may publish revised and/or new
-versions of the Lesser General Public License from time to time.
-Such new versions will be similar in spirit to the present version,
-but may differ in detail to address new problems or concerns.
-
-Each version is given a distinguishing version number. If the Library
-specifies a version number of this License which applies to it and
-"any later version", you have the option of following the terms and
-conditions either of that version or of any later version published by
-the Free Software Foundation. If the Library does not specify a
-license version number, you may choose any version ever published by
-the Free Software Foundation.
-^L
- 14. If you wish to incorporate parts of the Library into other free
-programs whose distribution conditions are incompatible with these,
-write to the author to ask for permission. For software which is
-copyrighted by the Free Software Foundation, write to the Free
-Software Foundation; we sometimes make exceptions for this. Our
-decision will be guided by the two goals of preserving the free status
-of all derivatives of our free software and of promoting the sharing
-and reuse of software generally.
-
- NO WARRANTY
-
- 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
-WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
-EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
-OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
-KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
-LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
-THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
- 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
-WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
-AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
-FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
-CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
-LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
-RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
-FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
-SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
-DAMAGES.
-
- END OF TERMS AND CONDITIONS
-^L
- How to Apply These Terms to Your New Libraries
-
- If you develop a new library, and you want it to be of the greatest
-possible use to the public, we recommend making it free software that
-everyone can redistribute and change. You can do so by permitting
-redistribution under these terms (or, alternatively, under the terms
-of the ordinary General Public License).
-
- To apply these terms, attach the following notices to the library.
-It is safest to attach them to the start of each source file to most
-effectively convey the exclusion of warranty; and each file should
-have at least the "copyright" line and a pointer to where the full
-notice is found.
-
-
- <one line to give the library's name and a brief idea of what it
-does.>
- Copyright (C) <year> <name of author>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-Also add information on how to contact you by electronic and paper
-mail.
-
-You should also get your employer (if you work as a programmer) or
-your
-school, if any, to sign a "copyright disclaimer" for the library, if
-necessary. Here is a sample; alter the names:
-
- Yoyodyne, Inc., hereby disclaims all copyright interest in the
- library `Frob' (a library for tweaking knobs) written by James
-Random Hacker.
-
- <signature of Ty Coon>, 1 April 1990
- Ty Coon, President of Vice
-
-That's all there is to it!
-
-
diff --git a/ext/bcmath/libbcmath/ChangeLog b/ext/bcmath/libbcmath/ChangeLog
deleted file mode 100644
index b8d459a2bb..0000000000
--- a/ext/bcmath/libbcmath/ChangeLog
+++ /dev/null
@@ -1,10 +0,0 @@
-Wed Jun 7 09:39:02 2000 Phil Nelson <phil@cs.wwu.edu>
-
- * configure.in and many others: version number now at 0.2.
- Many other changes/additions for getting a distribution
- to work.
-
-2000-05-21 Phil Nelson <phil@cs.wwu.edu>
-
- * Initial setup of bcmath library., calling it version 0.1.
-
diff --git a/ext/bcmath/libbcmath/FAQ b/ext/bcmath/libbcmath/FAQ
deleted file mode 100644
index 6499b1cffb..0000000000
--- a/ext/bcmath/libbcmath/FAQ
+++ /dev/null
@@ -1,21 +0,0 @@
-BCMATH FAQ:
-
-1) Why BCMATH?
-
-The math routines of GNU bc become more generally useful in a
-library form. By separating the BCMATH library from GNU bc,
-GNU bc can be under the GPL and BCMATH can be under the LGPL.
-
-2) Why BCMATH when GMP exists?
-
-GMP has "integers" (no digits after a decimal), "rational numbers"
-(stored as 2 integers) and "floats". None of these will correctly
-represent a POSIX BC number. Floats are the closest, but will not
-behave correctly for many computations. For example, BC numbers have
-a "scale" that represent the number of digits to represent after the
-decimal point. The multiplying two of these numbers requires one to
-calculate an exact number of digits after the decimal point regardless
-of the number of digits in the integer part. GMP floats have a
-"fixed, but arbitrary" mantissa and so multiplying two floats will end
-up dropping digits BC must calculate.
-
diff --git a/ext/bcmath/libbcmath/INSTALL b/ext/bcmath/libbcmath/INSTALL
deleted file mode 100644
index 8893a07827..0000000000
--- a/ext/bcmath/libbcmath/INSTALL
+++ /dev/null
@@ -1,9 +0,0 @@
-Currently, only libbcmath.a is built. To build and install it, do
-
- configure
- make
- make install
-
-Typical configure parameters are available. (e.g. PREFIX)
-
-Bugs and comments to philnelson@acm.org.
diff --git a/ext/bcmath/libbcmath/Makefile.am b/ext/bcmath/libbcmath/Makefile.am
deleted file mode 100644
index e5be8201b3..0000000000
--- a/ext/bcmath/libbcmath/Makefile.am
+++ /dev/null
@@ -1,12 +0,0 @@
-## Process this file with automake to produce Makefile.in
-
-SUBDIRS= src doc
-
-MAINTAINERCLEANFILES = aclocal.m4 config.h.in configure Makefile.in \
- stamp-h.in *~
-
-dist-hook:
- cp $(srcdir)/doc/bcmath.1 $(distdir)/doc
- cp $(srcdir)/src/private.h $(distdir)/src
- cp $(srcdir)/FAQ $(distdir)
-
diff --git a/ext/bcmath/libbcmath/Makefile.in b/ext/bcmath/libbcmath/Makefile.in
deleted file mode 100644
index 0743bd7150..0000000000
--- a/ext/bcmath/libbcmath/Makefile.in
+++ /dev/null
@@ -1,9 +0,0 @@
-
-LTLIBRARY_NAME = libbcmath.la
-LTLIBRARY_DEPENDENCIES = src/libbcmath.la
-LTLIBRARY_LIBADD = $(LTLIBRARY_DEPENDENCIES)
-LTLIBRARY_SHARED_LIBADD = $(LTLIBRARY_LIBADD)
-
-SUBDIRS = src
-
-include $(top_srcdir)/build/dynlib.mk
diff --git a/ext/bcmath/libbcmath/NEWS b/ext/bcmath/libbcmath/NEWS
deleted file mode 100644
index 431d7b315d..0000000000
--- a/ext/bcmath/libbcmath/NEWS
+++ /dev/null
@@ -1,3 +0,0 @@
-NEWS for bcmath library:
-
- May 2000: The library is created.
diff --git a/ext/bcmath/libbcmath/README b/ext/bcmath/libbcmath/README
deleted file mode 100644
index cae5e5dc43..0000000000
--- a/ext/bcmath/libbcmath/README
+++ /dev/null
@@ -1,9 +0,0 @@
-This is bcmath, a library of arbitrary precision math routines.
-These routines, in a different form, are the routines that to
-the arbitrary precision calculations for GNU bc and GNU dc.
-
-This library is provided to make these routines useful in a
-larger context with less restrictions on the use of them.
-
-These routines do not duplicate functionality of the GNU gmp
-library. gmp is similar, but the actual computation is different.
diff --git a/ext/bcmath/libbcmath/acconfig.h b/ext/bcmath/libbcmath/acconfig.h
deleted file mode 100644
index 4d301dcacf..0000000000
--- a/ext/bcmath/libbcmath/acconfig.h
+++ /dev/null
@@ -1,9 +0,0 @@
-/* PACKAGE name */
-#undef PACKAGE
-
-/* Package VERSION number */
-#undef VERSION
-
-/* Define to `size_t' if <sys/types.h> and <stddef.h> don't define. */
-#undef ptrdiff_t
-
diff --git a/ext/bcmath/libbcmath/aclocal.m4 b/ext/bcmath/libbcmath/aclocal.m4
deleted file mode 100644
index f23ba2904e..0000000000
--- a/ext/bcmath/libbcmath/aclocal.m4
+++ /dev/null
@@ -1,127 +0,0 @@
-dnl aclocal.m4 generated automatically by aclocal 1.4
-
-dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
-dnl This file is free software; the Free Software Foundation
-dnl gives unlimited permission to copy and/or distribute it,
-dnl with or without modifications, as long as this notice is preserved.
-
-dnl This program is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
-dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
-dnl PARTICULAR PURPOSE.
-
-# Do all the work for Automake. This macro actually does too much --
-# some checks are only needed if your package does certain things.
-# But this isn't really a big deal.
-
-# serial 1
-
-dnl Usage:
-dnl AM_INIT_AUTOMAKE(package,version, [no-define])
-
-AC_DEFUN(AM_INIT_AUTOMAKE,
-[AC_REQUIRE([AC_PROG_INSTALL])
-PACKAGE=[$1]
-AC_SUBST(PACKAGE)
-VERSION=[$2]
-AC_SUBST(VERSION)
-dnl test to see if srcdir already configured
-if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
- AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
-fi
-ifelse([$3],,
-AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
-AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package]))
-AC_REQUIRE([AM_SANITY_CHECK])
-AC_REQUIRE([AC_ARG_PROGRAM])
-dnl FIXME This is truly gross.
-missing_dir=`cd $ac_aux_dir && pwd`
-AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
-AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
-AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
-AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
-AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
-AC_REQUIRE([AC_PROG_MAKE_SET])])
-
-#
-# Check to make sure that the build environment is sane.
-#
-
-AC_DEFUN(AM_SANITY_CHECK,
-[AC_MSG_CHECKING([whether build environment is sane])
-# Just in case
-sleep 1
-echo timestamp > conftestfile
-# Do `set' in a subshell so we don't clobber the current shell's
-# arguments. Must try -L first in case configure is actually a
-# symlink; some systems play weird games with the mod time of symlinks
-# (eg FreeBSD returns the mod time of the symlink's containing
-# directory).
-if (
- set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
- if test "[$]*" = "X"; then
- # -L didn't work.
- set X `ls -t $srcdir/configure conftestfile`
- fi
- if test "[$]*" != "X $srcdir/configure conftestfile" \
- && test "[$]*" != "X conftestfile $srcdir/configure"; then
-
- # If neither matched, then we have a broken ls. This can happen
- # if, for instance, CONFIG_SHELL is bash and it inherits a
- # broken ls alias from the environment. This has actually
- # happened. Such a system could not be considered "sane".
- AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
-alias in your environment])
- fi
-
- test "[$]2" = conftestfile
- )
-then
- # Ok.
- :
-else
- AC_MSG_ERROR([newly created file is older than distributed files!
-Check your system clock])
-fi
-rm -f conftest*
-AC_MSG_RESULT(yes)])
-
-dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
-dnl The program must properly implement --version.
-AC_DEFUN(AM_MISSING_PROG,
-[AC_MSG_CHECKING(for working $2)
-# Run test in a subshell; some versions of sh will print an error if
-# an executable is not found, even if stderr is redirected.
-# Redirect stdin to placate older versions of autoconf. Sigh.
-if ($2 --version) < /dev/null > /dev/null 2>&1; then
- $1=$2
- AC_MSG_RESULT(found)
-else
- $1="$3/missing $2"
- AC_MSG_RESULT(missing)
-fi
-AC_SUBST($1)])
-
-# Like AC_CONFIG_HEADER, but automatically create stamp file.
-
-AC_DEFUN(AM_CONFIG_HEADER,
-[AC_PREREQ([2.12])
-AC_CONFIG_HEADER([$1])
-dnl When config.status generates a header, we must update the stamp-h file.
-dnl This file resides in the same directory as the config header
-dnl that is generated. We must strip everything past the first ":",
-dnl and everything past the last "/".
-AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl
-ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>,
-<<test -z "<<$>>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>,
-<<am_indx=1
-for am_file in <<$1>>; do
- case " <<$>>CONFIG_HEADERS " in
- *" <<$>>am_file "*<<)>>
- echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx
- ;;
- esac
- am_indx=`expr "<<$>>am_indx" + 1`
-done<<>>dnl>>)
-changequote([,]))])
-
diff --git a/ext/bcmath/libbcmath/config.h.in b/ext/bcmath/libbcmath/config.h.in
deleted file mode 100644
index 21cfb9255f..0000000000
--- a/ext/bcmath/libbcmath/config.h.in
+++ /dev/null
@@ -1,41 +0,0 @@
-/* config.h.in. Generated automatically from configure.in by autoheader. */
-
-/* Define to empty if the keyword does not work. */
-#undef const
-
-/* Define to `unsigned' if <sys/types.h> doesn't define. */
-#undef size_t
-
-/* Define if you have the ANSI C header files. */
-#undef STDC_HEADERS
-
-/* Define to `size_t' if <sys/types.h> and <stddef.h> don't define. */
-#undef ptrdiff_t
-
-/* Define if you have the <lib.h> header file. */
-#undef HAVE_LIB_H
-
-/* Define if you have the <limits.h> header file. */
-#undef HAVE_LIMITS_H
-
-/* Define if you have the <stdarg.h> header file. */
-#undef HAVE_STDARG_H
-
-/* Define if you have the <stddef.h> header file. */
-#undef HAVE_STDDEF_H
-
-/* Define if you have the <stdlib.h> header file. */
-#undef HAVE_STDLIB_H
-
-/* Define if you have the <string.h> header file. */
-#undef HAVE_STRING_H
-
-/* Define if you have the <unistd.h> header file. */
-#undef HAVE_UNISTD_H
-
-/* Name of package */
-#undef PACKAGE
-
-/* Version number of package */
-#undef VERSION
-
diff --git a/ext/bcmath/libbcmath/configure b/ext/bcmath/libbcmath/configure
deleted file mode 100644
index 026fd039c7..0000000000
--- a/ext/bcmath/libbcmath/configure
+++ /dev/null
@@ -1,1859 +0,0 @@
-#! /bin/sh
-
-# Guess values for system-dependent variables and create Makefiles.
-# Generated automatically using autoconf version 2.13
-# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
-#
-# This configure script is free software; the Free Software Foundation
-# gives unlimited permission to copy, distribute and modify it.
-
-# Defaults:
-ac_help=
-ac_default_prefix=/usr/local
-# Any additions from configure.in:
-
-# Initialize some variables set by options.
-# The variables have the same names as the options, with
-# dashes changed to underlines.
-build=NONE
-cache_file=./config.cache
-exec_prefix=NONE
-host=NONE
-no_create=
-nonopt=NONE
-no_recursion=
-prefix=NONE
-program_prefix=NONE
-program_suffix=NONE
-program_transform_name=s,x,x,
-silent=
-site=
-srcdir=
-target=NONE
-verbose=
-x_includes=NONE
-x_libraries=NONE
-bindir='${exec_prefix}/bin'
-sbindir='${exec_prefix}/sbin'
-libexecdir='${exec_prefix}/libexec'
-datadir='${prefix}/share'
-sysconfdir='${prefix}/etc'
-sharedstatedir='${prefix}/com'
-localstatedir='${prefix}/var'
-libdir='${exec_prefix}/lib'
-includedir='${prefix}/include'
-oldincludedir='/usr/include'
-infodir='${prefix}/info'
-mandir='${prefix}/man'
-
-# Initialize some other variables.
-subdirs=
-MFLAGS= MAKEFLAGS=
-SHELL=${CONFIG_SHELL-/bin/sh}
-# Maximum number of lines to put in a shell here document.
-ac_max_here_lines=12
-
-ac_prev=
-for ac_option
-do
-
- # If the previous option needs an argument, assign it.
- if test -n "$ac_prev"; then
- eval "$ac_prev=\$ac_option"
- ac_prev=
- continue
- fi
-
- case "$ac_option" in
- -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
- *) ac_optarg= ;;
- esac
-
- # Accept the important Cygnus configure options, so we can diagnose typos.
-
- case "$ac_option" in
-
- -bindir | --bindir | --bindi | --bind | --bin | --bi)
- ac_prev=bindir ;;
- -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
- bindir="$ac_optarg" ;;
-
- -build | --build | --buil | --bui | --bu)
- ac_prev=build ;;
- -build=* | --build=* | --buil=* | --bui=* | --bu=*)
- build="$ac_optarg" ;;
-
- -cache-file | --cache-file | --cache-fil | --cache-fi \
- | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
- ac_prev=cache_file ;;
- -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
- | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
- cache_file="$ac_optarg" ;;
-
- -datadir | --datadir | --datadi | --datad | --data | --dat | --da)
- ac_prev=datadir ;;
- -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
- | --da=*)
- datadir="$ac_optarg" ;;
-
- -disable-* | --disable-*)
- ac_feature=`echo $ac_option|sed -e 's/-*disable-//'`
- # Reject names that are not valid shell variable names.
- if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then
- { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
- fi
- ac_feature=`echo $ac_feature| sed 's/-/_/g'`
- eval "enable_${ac_feature}=no" ;;
-
- -enable-* | --enable-*)
- ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'`
- # Reject names that are not valid shell variable names.
- if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then
- { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
- fi
- ac_feature=`echo $ac_feature| sed 's/-/_/g'`
- case "$ac_option" in
- *=*) ;;
- *) ac_optarg=yes ;;
- esac
- eval "enable_${ac_feature}='$ac_optarg'" ;;
-
- -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
- | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
- | --exec | --exe | --ex)
- ac_prev=exec_prefix ;;
- -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
- | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
- | --exec=* | --exe=* | --ex=*)
- exec_prefix="$ac_optarg" ;;
-
- -gas | --gas | --ga | --g)
- # Obsolete; use --with-gas.
- with_gas=yes ;;
-
- -help | --help | --hel | --he)
- # Omit some internal or obsolete options to make the list less imposing.
- # This message is too long to be a string in the A/UX 3.1 sh.
- cat << EOF
-Usage: configure [options] [host]
-Options: [defaults in brackets after descriptions]
-Configuration:
- --cache-file=FILE cache test results in FILE
- --help print this message
- --no-create do not create output files
- --quiet, --silent do not print \`checking...' messages
- --version print the version of autoconf that created configure
-Directory and file names:
- --prefix=PREFIX install architecture-independent files in PREFIX
- [$ac_default_prefix]
- --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
- [same as prefix]
- --bindir=DIR user executables in DIR [EPREFIX/bin]
- --sbindir=DIR system admin executables in DIR [EPREFIX/sbin]
- --libexecdir=DIR program executables in DIR [EPREFIX/libexec]
- --datadir=DIR read-only architecture-independent data in DIR
- [PREFIX/share]
- --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc]
- --sharedstatedir=DIR modifiable architecture-independent data in DIR
- [PREFIX/com]
- --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var]
- --libdir=DIR object code libraries in DIR [EPREFIX/lib]
- --includedir=DIR C header files in DIR [PREFIX/include]
- --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include]
- --infodir=DIR info documentation in DIR [PREFIX/info]
- --mandir=DIR man documentation in DIR [PREFIX/man]
- --srcdir=DIR find the sources in DIR [configure dir or ..]
- --program-prefix=PREFIX prepend PREFIX to installed program names
- --program-suffix=SUFFIX append SUFFIX to installed program names
- --program-transform-name=PROGRAM
- run sed PROGRAM on installed program names
-EOF
- cat << EOF
-Host type:
- --build=BUILD configure for building on BUILD [BUILD=HOST]
- --host=HOST configure for HOST [guessed]
- --target=TARGET configure for TARGET [TARGET=HOST]
-Features and packages:
- --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
- --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
- --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
- --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
- --x-includes=DIR X include files are in DIR
- --x-libraries=DIR X library files are in DIR
-EOF
- if test -n "$ac_help"; then
- echo "--enable and --with options recognized:$ac_help"
- fi
- exit 0 ;;
-
- -host | --host | --hos | --ho)
- ac_prev=host ;;
- -host=* | --host=* | --hos=* | --ho=*)
- host="$ac_optarg" ;;
-
- -includedir | --includedir | --includedi | --included | --include \
- | --includ | --inclu | --incl | --inc)
- ac_prev=includedir ;;
- -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
- | --includ=* | --inclu=* | --incl=* | --inc=*)
- includedir="$ac_optarg" ;;
-
- -infodir | --infodir | --infodi | --infod | --info | --inf)
- ac_prev=infodir ;;
- -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
- infodir="$ac_optarg" ;;
-
- -libdir | --libdir | --libdi | --libd)
- ac_prev=libdir ;;
- -libdir=* | --libdir=* | --libdi=* | --libd=*)
- libdir="$ac_optarg" ;;
-
- -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
- | --libexe | --libex | --libe)
- ac_prev=libexecdir ;;
- -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
- | --libexe=* | --libex=* | --libe=*)
- libexecdir="$ac_optarg" ;;
-
- -localstatedir | --localstatedir | --localstatedi | --localstated \
- | --localstate | --localstat | --localsta | --localst \
- | --locals | --local | --loca | --loc | --lo)
- ac_prev=localstatedir ;;
- -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
- | --localstate=* | --localstat=* | --localsta=* | --localst=* \
- | --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
- localstatedir="$ac_optarg" ;;
-
- -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
- ac_prev=mandir ;;
- -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
- mandir="$ac_optarg" ;;
-
- -nfp | --nfp | --nf)
- # Obsolete; use --without-fp.
- with_fp=no ;;
-
- -no-create | --no-create | --no-creat | --no-crea | --no-cre \
- | --no-cr | --no-c)
- no_create=yes ;;
-
- -no-recursion | --no-recursion | --no-recursio | --no-recursi \
- | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
- no_recursion=yes ;;
-
- -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
- | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
- | --oldin | --oldi | --old | --ol | --o)
- ac_prev=oldincludedir ;;
- -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
- | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
- | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
- oldincludedir="$ac_optarg" ;;
-
- -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
- ac_prev=prefix ;;
- -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
- prefix="$ac_optarg" ;;
-
- -program-prefix | --program-prefix | --program-prefi | --program-pref \
- | --program-pre | --program-pr | --program-p)
- ac_prev=program_prefix ;;
- -program-prefix=* | --program-prefix=* | --program-prefi=* \
- | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
- program_prefix="$ac_optarg" ;;
-
- -program-suffix | --program-suffix | --program-suffi | --program-suff \
- | --program-suf | --program-su | --program-s)
- ac_prev=program_suffix ;;
- -program-suffix=* | --program-suffix=* | --program-suffi=* \
- | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
- program_suffix="$ac_optarg" ;;
-
- -program-transform-name | --program-transform-name \
- | --program-transform-nam | --program-transform-na \
- | --program-transform-n | --program-transform- \
- | --program-transform | --program-transfor \
- | --program-transfo | --program-transf \
- | --program-trans | --program-tran \
- | --progr-tra | --program-tr | --program-t)
- ac_prev=program_transform_name ;;
- -program-transform-name=* | --program-transform-name=* \
- | --program-transform-nam=* | --program-transform-na=* \
- | --program-transform-n=* | --program-transform-=* \
- | --program-transform=* | --program-transfor=* \
- | --program-transfo=* | --program-transf=* \
- | --program-trans=* | --program-tran=* \
- | --progr-tra=* | --program-tr=* | --program-t=*)
- program_transform_name="$ac_optarg" ;;
-
- -q | -quiet | --quiet | --quie | --qui | --qu | --q \
- | -silent | --silent | --silen | --sile | --sil)
- silent=yes ;;
-
- -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
- ac_prev=sbindir ;;
- -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
- | --sbi=* | --sb=*)
- sbindir="$ac_optarg" ;;
-
- -sharedstatedir | --sharedstatedir | --sharedstatedi \
- | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
- | --sharedst | --shareds | --shared | --share | --shar \
- | --sha | --sh)
- ac_prev=sharedstatedir ;;
- -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
- | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
- | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
- | --sha=* | --sh=*)
- sharedstatedir="$ac_optarg" ;;
-
- -site | --site | --sit)
- ac_prev=site ;;
- -site=* | --site=* | --sit=*)
- site="$ac_optarg" ;;
-
- -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
- ac_prev=srcdir ;;
- -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
- srcdir="$ac_optarg" ;;
-
- -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
- | --syscon | --sysco | --sysc | --sys | --sy)
- ac_prev=sysconfdir ;;
- -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
- | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
- sysconfdir="$ac_optarg" ;;
-
- -target | --target | --targe | --targ | --tar | --ta | --t)
- ac_prev=target ;;
- -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
- target="$ac_optarg" ;;
-
- -v | -verbose | --verbose | --verbos | --verbo | --verb)
- verbose=yes ;;
-
- -version | --version | --versio | --versi | --vers)
- echo "configure generated by autoconf version 2.13"
- exit 0 ;;
-
- -with-* | --with-*)
- ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'`
- # Reject names that are not valid shell variable names.
- if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then
- { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
- fi
- ac_package=`echo $ac_package| sed 's/-/_/g'`
- case "$ac_option" in
- *=*) ;;
- *) ac_optarg=yes ;;
- esac
- eval "with_${ac_package}='$ac_optarg'" ;;
-
- -without-* | --without-*)
- ac_package=`echo $ac_option|sed -e 's/-*without-//'`
- # Reject names that are not valid shell variable names.
- if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then
- { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
- fi
- ac_package=`echo $ac_package| sed 's/-/_/g'`
- eval "with_${ac_package}=no" ;;
-
- --x)
- # Obsolete; use --with-x.
- with_x=yes ;;
-
- -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
- | --x-incl | --x-inc | --x-in | --x-i)
- ac_prev=x_includes ;;
- -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
- | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
- x_includes="$ac_optarg" ;;
-
- -x-libraries | --x-libraries | --x-librarie | --x-librari \
- | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
- ac_prev=x_libraries ;;
- -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
- | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
- x_libraries="$ac_optarg" ;;
-
- -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; }
- ;;
-
- *)
- if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then
- echo "configure: warning: $ac_option: invalid host type" 1>&2
- fi
- if test "x$nonopt" != xNONE; then
- { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; }
- fi
- nonopt="$ac_option"
- ;;
-
- esac
-done
-
-if test -n "$ac_prev"; then
- { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; }
-fi
-
-trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
-
-# File descriptor usage:
-# 0 standard input
-# 1 file creation
-# 2 errors and warnings
-# 3 some systems may open it to /dev/tty
-# 4 used on the Kubota Titan
-# 6 checking for... messages and results
-# 5 compiler messages saved in config.log
-if test "$silent" = yes; then
- exec 6>/dev/null
-else
- exec 6>&1
-fi
-exec 5>./config.log
-
-echo "\
-This file contains any messages produced by compilers while
-running configure, to aid debugging if configure makes a mistake.
-" 1>&5
-
-# Strip out --no-create and --no-recursion so they do not pile up.
-# Also quote any args containing shell metacharacters.
-ac_configure_args=
-for ac_arg
-do
- case "$ac_arg" in
- -no-create | --no-create | --no-creat | --no-crea | --no-cre \
- | --no-cr | --no-c) ;;
- -no-recursion | --no-recursion | --no-recursio | --no-recursi \
- | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;;
- *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*)
- ac_configure_args="$ac_configure_args '$ac_arg'" ;;
- *) ac_configure_args="$ac_configure_args $ac_arg" ;;
- esac
-done
-
-# NLS nuisances.
-# Only set these to C if already set. These must not be set unconditionally
-# because not all systems understand e.g. LANG=C (notably SCO).
-# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'!
-# Non-C LC_CTYPE values break the ctype check.
-if test "${LANG+set}" = set; then LANG=C; export LANG; fi
-if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi
-if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi
-if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi
-
-# confdefs.h avoids OS command line length limits that DEFS can exceed.
-rm -rf conftest* confdefs.h
-# AIX cpp loses on an empty file, so make sure it contains at least a newline.
-echo > confdefs.h
-
-# A filename unique to this package, relative to the directory that
-# configure is in, which we can look for to find out if srcdir is correct.
-ac_unique_file=doc/bcmath.1
-
-# Find the source files, if location was not specified.
-if test -z "$srcdir"; then
- ac_srcdir_defaulted=yes
- # Try the directory containing this script, then its parent.
- ac_prog=$0
- ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'`
- test "x$ac_confdir" = "x$ac_prog" && ac_confdir=.
- srcdir=$ac_confdir
- if test ! -r $srcdir/$ac_unique_file; then
- srcdir=..
- fi
-else
- ac_srcdir_defaulted=no
-fi
-if test ! -r $srcdir/$ac_unique_file; then
- if test "$ac_srcdir_defaulted" = yes; then
- { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; }
- else
- { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; }
- fi
-fi
-srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'`
-
-# Prefer explicitly selected file to automatically selected ones.
-if test -z "$CONFIG_SITE"; then
- if test "x$prefix" != xNONE; then
- CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
- else
- CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
- fi
-fi
-for ac_site_file in $CONFIG_SITE; do
- if test -r "$ac_site_file"; then
- echo "loading site script $ac_site_file"
- . "$ac_site_file"
- fi
-done
-
-if test -r "$cache_file"; then
- echo "loading cache $cache_file"
- . $cache_file
-else
- echo "creating cache $cache_file"
- > $cache_file
-fi
-
-ac_ext=c
-# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
-ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
-cross_compiling=$ac_cv_prog_cc_cross
-
-ac_exeext=
-ac_objext=o
-if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
- # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
- if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
- ac_n= ac_c='
-' ac_t=' '
- else
- ac_n=-n ac_c= ac_t=
- fi
-else
- ac_n= ac_c='\c' ac_t=
-fi
-
-
-ac_aux_dir=
-for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
- if test -f $ac_dir/install-sh; then
- ac_aux_dir=$ac_dir
- ac_install_sh="$ac_aux_dir/install-sh -c"
- break
- elif test -f $ac_dir/install.sh; then
- ac_aux_dir=$ac_dir
- ac_install_sh="$ac_aux_dir/install.sh -c"
- break
- fi
-done
-if test -z "$ac_aux_dir"; then
- { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; }
-fi
-ac_config_guess=$ac_aux_dir/config.guess
-ac_config_sub=$ac_aux_dir/config.sub
-ac_configure=$ac_aux_dir/configure # This should be Cygnus configure.
-
-# Find a good install program. We prefer a C program (faster),
-# so one script is as good as another. But avoid the broken or
-# incompatible versions:
-# SysV /etc/install, /usr/sbin/install
-# SunOS /usr/etc/install
-# IRIX /sbin/install
-# AIX /bin/install
-# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
-# AFS /usr/afsws/bin/install, which mishandles nonexistent args
-# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
-# ./install, which can be erroneously created by make from ./install.sh.
-echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
-echo "configure:556: checking for a BSD compatible install" >&5
-if test -z "$INSTALL"; then
-if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":"
- for ac_dir in $PATH; do
- # Account for people who put trailing slashes in PATH elements.
- case "$ac_dir/" in
- /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;;
- *)
- # OSF1 and SCO ODT 3.0 have their own names for install.
- # Don't use installbsd from OSF since it installs stuff as root
- # by default.
- for ac_prog in ginstall scoinst install; do
- if test -f $ac_dir/$ac_prog; then
- if test $ac_prog = install &&
- grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
- # AIX install. It has an incompatible calling convention.
- :
- else
- ac_cv_path_install="$ac_dir/$ac_prog -c"
- break 2
- fi
- fi
- done
- ;;
- esac
- done
- IFS="$ac_save_IFS"
-
-fi
- if test "${ac_cv_path_install+set}" = set; then
- INSTALL="$ac_cv_path_install"
- else
- # As a last resort, use the slow shell script. We don't cache a
- # path for INSTALL within a source directory, because that will
- # break other packages using the cache if that directory is
- # removed, or if the path is relative.
- INSTALL="$ac_install_sh"
- fi
-fi
-echo "$ac_t""$INSTALL" 1>&6
-
-# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
-# It thinks the first close brace ends the variable substitution.
-test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
-
-test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
-
-test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
-
-echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6
-echo "configure:609: checking whether build environment is sane" >&5
-# Just in case
-sleep 1
-echo timestamp > conftestfile
-# Do `set' in a subshell so we don't clobber the current shell's
-# arguments. Must try -L first in case configure is actually a
-# symlink; some systems play weird games with the mod time of symlinks
-# (eg FreeBSD returns the mod time of the symlink's containing
-# directory).
-if (
- set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
- if test "$*" = "X"; then
- # -L didn't work.
- set X `ls -t $srcdir/configure conftestfile`
- fi
- if test "$*" != "X $srcdir/configure conftestfile" \
- && test "$*" != "X conftestfile $srcdir/configure"; then
-
- # If neither matched, then we have a broken ls. This can happen
- # if, for instance, CONFIG_SHELL is bash and it inherits a
- # broken ls alias from the environment. This has actually
- # happened. Such a system could not be considered "sane".
- { echo "configure: error: ls -t appears to fail. Make sure there is not a broken
-alias in your environment" 1>&2; exit 1; }
- fi
-
- test "$2" = conftestfile
- )
-then
- # Ok.
- :
-else
- { echo "configure: error: newly created file is older than distributed files!
-Check your system clock" 1>&2; exit 1; }
-fi
-rm -f conftest*
-echo "$ac_t""yes" 1>&6
-if test "$program_transform_name" = s,x,x,; then
- program_transform_name=
-else
- # Double any \ or $. echo might interpret backslashes.
- cat <<\EOF_SED > conftestsed
-s,\\,\\\\,g; s,\$,$$,g
-EOF_SED
- program_transform_name="`echo $program_transform_name|sed -f conftestsed`"
- rm -f conftestsed
-fi
-test "$program_prefix" != NONE &&
- program_transform_name="s,^,${program_prefix},; $program_transform_name"
-# Use a double $ so make ignores it.
-test "$program_suffix" != NONE &&
- program_transform_name="s,\$\$,${program_suffix},; $program_transform_name"
-
-# sed with no file args requires a program.
-test "$program_transform_name" = "" && program_transform_name="s,x,x,"
-
-echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
-echo "configure:666: checking whether ${MAKE-make} sets \${MAKE}" >&5
-set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftestmake <<\EOF
-all:
- @echo 'ac_maketemp="${MAKE}"'
-EOF
-# GNU make sometimes prints "make[1]: Entering...", which would confuse us.
-eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=`
-if test -n "$ac_maketemp"; then
- eval ac_cv_prog_make_${ac_make}_set=yes
-else
- eval ac_cv_prog_make_${ac_make}_set=no
-fi
-rm -f conftestmake
-fi
-if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- SET_MAKE=
-else
- echo "$ac_t""no" 1>&6
- SET_MAKE="MAKE=${MAKE-make}"
-fi
-
-
-PACKAGE="bcmath"
-
-VERSION="0.2"
-
-if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
- { echo "configure: error: source directory already configured; run "make distclean" there first" 1>&2; exit 1; }
-fi
-cat >> confdefs.h <<EOF
-#define PACKAGE "$PACKAGE"
-EOF
-
-cat >> confdefs.h <<EOF
-#define VERSION "$VERSION"
-EOF
-
-
-
-missing_dir=`cd $ac_aux_dir && pwd`
-echo $ac_n "checking for working aclocal""... $ac_c" 1>&6
-echo "configure:712: checking for working aclocal" >&5
-# Run test in a subshell; some versions of sh will print an error if
-# an executable is not found, even if stderr is redirected.
-# Redirect stdin to placate older versions of autoconf. Sigh.
-if (aclocal --version) < /dev/null > /dev/null 2>&1; then
- ACLOCAL=aclocal
- echo "$ac_t""found" 1>&6
-else
- ACLOCAL="$missing_dir/missing aclocal"
- echo "$ac_t""missing" 1>&6
-fi
-
-echo $ac_n "checking for working autoconf""... $ac_c" 1>&6
-echo "configure:725: checking for working autoconf" >&5
-# Run test in a subshell; some versions of sh will print an error if
-# an executable is not found, even if stderr is redirected.
-# Redirect stdin to placate older versions of autoconf. Sigh.
-if (autoconf --version) < /dev/null > /dev/null 2>&1; then
- AUTOCONF=autoconf
- echo "$ac_t""found" 1>&6
-else
- AUTOCONF="$missing_dir/missing autoconf"
- echo "$ac_t""missing" 1>&6
-fi
-
-echo $ac_n "checking for working automake""... $ac_c" 1>&6
-echo "configure:738: checking for working automake" >&5
-# Run test in a subshell; some versions of sh will print an error if
-# an executable is not found, even if stderr is redirected.
-# Redirect stdin to placate older versions of autoconf. Sigh.
-if (automake --version) < /dev/null > /dev/null 2>&1; then
- AUTOMAKE=automake
- echo "$ac_t""found" 1>&6
-else
- AUTOMAKE="$missing_dir/missing automake"
- echo "$ac_t""missing" 1>&6
-fi
-
-echo $ac_n "checking for working autoheader""... $ac_c" 1>&6
-echo "configure:751: checking for working autoheader" >&5
-# Run test in a subshell; some versions of sh will print an error if
-# an executable is not found, even if stderr is redirected.
-# Redirect stdin to placate older versions of autoconf. Sigh.
-if (autoheader --version) < /dev/null > /dev/null 2>&1; then
- AUTOHEADER=autoheader
- echo "$ac_t""found" 1>&6
-else
- AUTOHEADER="$missing_dir/missing autoheader"
- echo "$ac_t""missing" 1>&6
-fi
-
-echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6
-echo "configure:764: checking for working makeinfo" >&5
-# Run test in a subshell; some versions of sh will print an error if
-# an executable is not found, even if stderr is redirected.
-# Redirect stdin to placate older versions of autoconf. Sigh.
-if (makeinfo --version) < /dev/null > /dev/null 2>&1; then
- MAKEINFO=makeinfo
- echo "$ac_t""found" 1>&6
-else
- MAKEINFO="$missing_dir/missing makeinfo"
- echo "$ac_t""missing" 1>&6
-fi
-
-
-
-
-
-
-# Extract the first word of "gcc", so it can be a program name with args.
-set dummy gcc; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:784: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -n "$CC"; then
- ac_cv_prog_CC="$CC" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_CC="gcc"
- break
- fi
- done
- IFS="$ac_save_ifs"
-fi
-fi
-CC="$ac_cv_prog_CC"
-if test -n "$CC"; then
- echo "$ac_t""$CC" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
-if test -z "$CC"; then
- # Extract the first word of "cc", so it can be a program name with args.
-set dummy cc; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:814: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -n "$CC"; then
- ac_cv_prog_CC="$CC" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_prog_rejected=no
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then
- ac_prog_rejected=yes
- continue
- fi
- ac_cv_prog_CC="cc"
- break
- fi
- done
- IFS="$ac_save_ifs"
-if test $ac_prog_rejected = yes; then
- # We found a bogon in the path, so make sure we never use it.
- set dummy $ac_cv_prog_CC
- shift
- if test $# -gt 0; then
- # We chose a different compiler from the bogus one.
- # However, it has the same basename, so the bogon will be chosen
- # first if we set CC to just the basename; use the full file name.
- shift
- set dummy "$ac_dir/$ac_word" "$@"
- shift
- ac_cv_prog_CC="$@"
- fi
-fi
-fi
-fi
-CC="$ac_cv_prog_CC"
-if test -n "$CC"; then
- echo "$ac_t""$CC" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
- if test -z "$CC"; then
- case "`uname -s`" in
- *win32* | *WIN32*)
- # Extract the first word of "cl", so it can be a program name with args.
-set dummy cl; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:865: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -n "$CC"; then
- ac_cv_prog_CC="$CC" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_CC="cl"
- break
- fi
- done
- IFS="$ac_save_ifs"
-fi
-fi
-CC="$ac_cv_prog_CC"
-if test -n "$CC"; then
- echo "$ac_t""$CC" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
- ;;
- esac
- fi
- test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; }
-fi
-
-echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:897: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
-
-ac_ext=c
-# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
-ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
-cross_compiling=$ac_cv_prog_cc_cross
-
-cat > conftest.$ac_ext << EOF
-
-#line 908 "configure"
-#include "confdefs.h"
-
-main(){return(0);}
-EOF
-if { (eval echo configure:913: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- ac_cv_prog_cc_works=yes
- # If we can't run a trivial program, we are probably using a cross compiler.
- if (./conftest; exit) 2>/dev/null; then
- ac_cv_prog_cc_cross=no
- else
- ac_cv_prog_cc_cross=yes
- fi
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- ac_cv_prog_cc_works=no
-fi
-rm -fr conftest*
-ac_ext=c
-# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
-ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
-cross_compiling=$ac_cv_prog_cc_cross
-
-echo "$ac_t""$ac_cv_prog_cc_works" 1>&6
-if test $ac_cv_prog_cc_works = no; then
- { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
-fi
-echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
-echo "configure:939: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
-echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
-cross_compiling=$ac_cv_prog_cc_cross
-
-echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
-echo "configure:944: checking whether we are using GNU C" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.c <<EOF
-#ifdef __GNUC__
- yes;
-#endif
-EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:953: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
- ac_cv_prog_gcc=yes
-else
- ac_cv_prog_gcc=no
-fi
-fi
-
-echo "$ac_t""$ac_cv_prog_gcc" 1>&6
-
-if test $ac_cv_prog_gcc = yes; then
- GCC=yes
-else
- GCC=
-fi
-
-ac_test_CFLAGS="${CFLAGS+set}"
-ac_save_CFLAGS="$CFLAGS"
-CFLAGS=
-echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:972: checking whether ${CC-cc} accepts -g" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- echo 'void f(){}' > conftest.c
-if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then
- ac_cv_prog_cc_g=yes
-else
- ac_cv_prog_cc_g=no
-fi
-rm -f conftest*
-
-fi
-
-echo "$ac_t""$ac_cv_prog_cc_g" 1>&6
-if test "$ac_test_CFLAGS" = set; then
- CFLAGS="$ac_save_CFLAGS"
-elif test $ac_cv_prog_cc_g = yes; then
- if test "$GCC" = yes; then
- CFLAGS="-g -O2"
- else
- CFLAGS="-g"
- fi
-else
- if test "$GCC" = yes; then
- CFLAGS="-O2"
- else
- CFLAGS=
- fi
-fi
-
-
-# Find a good install program. We prefer a C program (faster),
-# so one script is as good as another. But avoid the broken or
-# incompatible versions:
-# SysV /etc/install, /usr/sbin/install
-# SunOS /usr/etc/install
-# IRIX /sbin/install
-# AIX /bin/install
-# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
-# AFS /usr/afsws/bin/install, which mishandles nonexistent args
-# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
-# ./install, which can be erroneously created by make from ./install.sh.
-echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
-echo "configure:1016: checking for a BSD compatible install" >&5
-if test -z "$INSTALL"; then
-if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":"
- for ac_dir in $PATH; do
- # Account for people who put trailing slashes in PATH elements.
- case "$ac_dir/" in
- /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;;
- *)
- # OSF1 and SCO ODT 3.0 have their own names for install.
- # Don't use installbsd from OSF since it installs stuff as root
- # by default.
- for ac_prog in ginstall scoinst install; do
- if test -f $ac_dir/$ac_prog; then
- if test $ac_prog = install &&
- grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
- # AIX install. It has an incompatible calling convention.
- :
- else
- ac_cv_path_install="$ac_dir/$ac_prog -c"
- break 2
- fi
- fi
- done
- ;;
- esac
- done
- IFS="$ac_save_IFS"
-
-fi
- if test "${ac_cv_path_install+set}" = set; then
- INSTALL="$ac_cv_path_install"
- else
- # As a last resort, use the slow shell script. We don't cache a
- # path for INSTALL within a source directory, because that will
- # break other packages using the cache if that directory is
- # removed, or if the path is relative.
- INSTALL="$ac_install_sh"
- fi
-fi
-echo "$ac_t""$INSTALL" 1>&6
-
-# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
-# It thinks the first close brace ends the variable substitution.
-test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
-
-test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
-
-test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
-
-# Extract the first word of "ranlib", so it can be a program name with args.
-set dummy ranlib; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1071: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -n "$RANLIB"; then
- ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_RANLIB="ranlib"
- break
- fi
- done
- IFS="$ac_save_ifs"
- test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":"
-fi
-fi
-RANLIB="$ac_cv_prog_RANLIB"
-if test -n "$RANLIB"; then
- echo "$ac_t""$RANLIB" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
-echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
-echo "configure:1099: checking whether ${MAKE-make} sets \${MAKE}" >&5
-set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftestmake <<\EOF
-all:
- @echo 'ac_maketemp="${MAKE}"'
-EOF
-# GNU make sometimes prints "make[1]: Entering...", which would confuse us.
-eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=`
-if test -n "$ac_maketemp"; then
- eval ac_cv_prog_make_${ac_make}_set=yes
-else
- eval ac_cv_prog_make_${ac_make}_set=no
-fi
-rm -f conftestmake
-fi
-if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- SET_MAKE=
-else
- echo "$ac_t""no" 1>&6
- SET_MAKE="MAKE=${MAKE-make}"
-fi
-
-
-echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:1127: checking how to run the C preprocessor" >&5
-# On Suns, sometimes $CPP names a directory.
-if test -n "$CPP" && test -d "$CPP"; then
- CPP=
-fi
-if test -z "$CPP"; then
-if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- # This must be in double quotes, not single quotes, because CPP may get
- # substituted into the Makefile and "${CC-cc}" will confuse make.
- CPP="${CC-cc} -E"
- # On the NeXT, cc -E runs the code through the compiler's parser,
- # not just through cpp.
- cat > conftest.$ac_ext <<EOF
-#line 1142 "configure"
-#include "confdefs.h"
-#include <assert.h>
-Syntax Error
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1148: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
- :
-else
- echo "$ac_err" >&5
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- CPP="${CC-cc} -E -traditional-cpp"
- cat > conftest.$ac_ext <<EOF
-#line 1159 "configure"
-#include "confdefs.h"
-#include <assert.h>
-Syntax Error
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1165: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
- :
-else
- echo "$ac_err" >&5
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- CPP="${CC-cc} -nologo -E"
- cat > conftest.$ac_ext <<EOF
-#line 1176 "configure"
-#include "confdefs.h"
-#include <assert.h>
-Syntax Error
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1182: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
- :
-else
- echo "$ac_err" >&5
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- CPP=/lib/cpp
-fi
-rm -f conftest*
-fi
-rm -f conftest*
-fi
-rm -f conftest*
- ac_cv_prog_CPP="$CPP"
-fi
- CPP="$ac_cv_prog_CPP"
-else
- ac_cv_prog_CPP="$CPP"
-fi
-echo "$ac_t""$CPP" 1>&6
-
-for ac_hdr in stdarg.h stddef.h stdlib.h string.h limits.h unistd.h lib.h
-do
-ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
-echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:1210: checking for $ac_hdr" >&5
-if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 1215 "configure"
-#include "confdefs.h"
-#include <$ac_hdr>
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1220: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
- rm -rf conftest*
- eval "ac_cv_header_$ac_safe=yes"
-else
- echo "$ac_err" >&5
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_header_$ac_safe=no"
-fi
-rm -f conftest*
-fi
-if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
- cat >> confdefs.h <<EOF
-#define $ac_tr_hdr 1
-EOF
-
-else
- echo "$ac_t""no" 1>&6
-fi
-done
-
-echo $ac_n "checking for working const""... $ac_c" 1>&6
-echo "configure:1247: checking for working const" >&5
-if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 1252 "configure"
-#include "confdefs.h"
-
-int main() {
-
-/* Ultrix mips cc rejects this. */
-typedef int charset[2]; const charset x;
-/* SunOS 4.1.1 cc rejects this. */
-char const *const *ccp;
-char **p;
-/* NEC SVR4.0.2 mips cc rejects this. */
-struct point {int x, y;};
-static struct point const zero = {0,0};
-/* AIX XL C 1.02.0.0 rejects this.
- It does not let you subtract one const X* pointer from another in an arm
- of an if-expression whose if-part is not a constant expression */
-const char *g = "string";
-ccp = &g + (g ? g-g : 0);
-/* HPUX 7.0 cc rejects these. */
-++ccp;
-p = (char**) ccp;
-ccp = (char const *const *) p;
-{ /* SCO 3.2v4 cc rejects this. */
- char *t;
- char const *s = 0 ? (char *) 0 : (char const *) 0;
-
- *t++ = 0;
-}
-{ /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */
- int x[] = {25, 17};
- const int *foo = &x[0];
- ++foo;
-}
-{ /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */
- typedef const int *iptr;
- iptr p = 0;
- ++p;
-}
-{ /* AIX XL C 1.02.0.0 rejects this saying
- "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
- struct s { int j; const int *ap[3]; };
- struct s *b; b->j = 5;
-}
-{ /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
- const int foo = 10;
-}
-
-; return 0; }
-EOF
-if { (eval echo configure:1301: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
- ac_cv_c_const=yes
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- ac_cv_c_const=no
-fi
-rm -f conftest*
-fi
-
-echo "$ac_t""$ac_cv_c_const" 1>&6
-if test $ac_cv_c_const = no; then
- cat >> confdefs.h <<\EOF
-#define const
-EOF
-
-fi
-
-echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
-echo "configure:1322: checking for ANSI C header files" >&5
-if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 1327 "configure"
-#include "confdefs.h"
-#include <stdlib.h>
-#include <stdarg.h>
-#include <string.h>
-#include <float.h>
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1335: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
- rm -rf conftest*
- ac_cv_header_stdc=yes
-else
- echo "$ac_err" >&5
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- ac_cv_header_stdc=no
-fi
-rm -f conftest*
-
-if test $ac_cv_header_stdc = yes; then
- # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
-cat > conftest.$ac_ext <<EOF
-#line 1352 "configure"
-#include "confdefs.h"
-#include <string.h>
-EOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- egrep "memchr" >/dev/null 2>&1; then
- :
-else
- rm -rf conftest*
- ac_cv_header_stdc=no
-fi
-rm -f conftest*
-
-fi
-
-if test $ac_cv_header_stdc = yes; then
- # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
-cat > conftest.$ac_ext <<EOF
-#line 1370 "configure"
-#include "confdefs.h"
-#include <stdlib.h>
-EOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- egrep "free" >/dev/null 2>&1; then
- :
-else
- rm -rf conftest*
- ac_cv_header_stdc=no
-fi
-rm -f conftest*
-
-fi
-
-if test $ac_cv_header_stdc = yes; then
- # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
-if test "$cross_compiling" = yes; then
- :
-else
- cat > conftest.$ac_ext <<EOF
-#line 1391 "configure"
-#include "confdefs.h"
-#include <ctype.h>
-#define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
-#define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
-#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
-int main () { int i; for (i = 0; i < 256; i++)
-if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
-exit (0); }
-
-EOF
-if { (eval echo configure:1402: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
-then
- :
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -fr conftest*
- ac_cv_header_stdc=no
-fi
-rm -fr conftest*
-fi
-
-fi
-fi
-
-echo "$ac_t""$ac_cv_header_stdc" 1>&6
-if test $ac_cv_header_stdc = yes; then
- cat >> confdefs.h <<\EOF
-#define STDC_HEADERS 1
-EOF
-
-fi
-
-echo $ac_n "checking for size_t""... $ac_c" 1>&6
-echo "configure:1426: checking for size_t" >&5
-if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 1431 "configure"
-#include "confdefs.h"
-#include <sys/types.h>
-#if STDC_HEADERS
-#include <stdlib.h>
-#include <stddef.h>
-#endif
-EOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- egrep "(^|[^a-zA-Z_0-9])size_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
- rm -rf conftest*
- ac_cv_type_size_t=yes
-else
- rm -rf conftest*
- ac_cv_type_size_t=no
-fi
-rm -f conftest*
-
-fi
-echo "$ac_t""$ac_cv_type_size_t" 1>&6
-if test $ac_cv_type_size_t = no; then
- cat >> confdefs.h <<\EOF
-#define size_t unsigned
-EOF
-
-fi
-
-echo $ac_n "checking for ptrdiff_t""... $ac_c" 1>&6
-echo "configure:1459: checking for ptrdiff_t" >&5
-if eval "test \"`echo '$''{'ac_cv_type_ptrdiff_t'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 1464 "configure"
-#include "confdefs.h"
-#include <sys/types.h>
-#if STDC_HEADERS
-#include <stdlib.h>
-#include <stddef.h>
-#endif
-EOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- egrep "(^|[^a-zA-Z_0-9])ptrdiff_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
- rm -rf conftest*
- ac_cv_type_ptrdiff_t=yes
-else
- rm -rf conftest*
- ac_cv_type_ptrdiff_t=no
-fi
-rm -f conftest*
-
-fi
-echo "$ac_t""$ac_cv_type_ptrdiff_t" 1>&6
-if test $ac_cv_type_ptrdiff_t = no; then
- cat >> confdefs.h <<\EOF
-#define ptrdiff_t size_t
-EOF
-
-fi
-
-
-trap '' 1 2 15
-cat > confcache <<\EOF
-# This file is a shell script that caches the results of configure
-# tests run on this system so they can be shared between configure
-# scripts and configure runs. It is not useful on other systems.
-# If it contains results you don't want to keep, you may remove or edit it.
-#
-# By default, configure uses ./config.cache as the cache file,
-# creating it if it does not exist already. You can give configure
-# the --cache-file=FILE option to use a different cache file; that is
-# what configure does when it calls configure scripts in
-# subdirectories, so they share the cache.
-# Giving --cache-file=/dev/null disables caching, for debugging configure.
-# config.status only pays attention to the cache file if you give it the
-# --recheck option to rerun configure.
-#
-EOF
-# The following way of writing the cache mishandles newlines in values,
-# but we know of no workaround that is simple, portable, and efficient.
-# So, don't put newlines in cache variables' values.
-# Ultrix sh set writes to stderr and can't be redirected directly,
-# and sets the high bit in the cache file unless we assign to the vars.
-(set) 2>&1 |
- case `(ac_space=' '; set | grep ac_space) 2>&1` in
- *ac_space=\ *)
- # `set' does not quote correctly, so add quotes (double-quote substitution
- # turns \\\\ into \\, and sed turns \\ into \).
- sed -n \
- -e "s/'/'\\\\''/g" \
- -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p"
- ;;
- *)
- # `set' quotes correctly as required by POSIX, so do not add quotes.
- sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p'
- ;;
- esac >> confcache
-if cmp -s $cache_file confcache; then
- :
-else
- if test -w $cache_file; then
- echo "updating cache $cache_file"
- cat confcache > $cache_file
- else
- echo "not updating unwritable cache $cache_file"
- fi
-fi
-rm -f confcache
-
-trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
-
-test "x$prefix" = xNONE && prefix=$ac_default_prefix
-# Let make expand exec_prefix.
-test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
-
-# Any assignment to VPATH causes Sun make to only execute
-# the first set of double-colon rules, so remove it if not needed.
-# If there is a colon in the path, we need to keep it.
-if test "x$srcdir" = x.; then
- ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d'
-fi
-
-trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15
-
-DEFS=-DHAVE_CONFIG_H
-
-# Without the "./", some shells look in PATH for config.status.
-: ${CONFIG_STATUS=./config.status}
-
-echo creating $CONFIG_STATUS
-rm -f $CONFIG_STATUS
-cat > $CONFIG_STATUS <<EOF
-#! /bin/sh
-# Generated automatically by configure.
-# Run this file to recreate the current configuration.
-# This directory was configured as follows,
-# on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
-#
-# $0 $ac_configure_args
-#
-# Compiler output produced by configure, useful for debugging
-# configure, is in ./config.log if it exists.
-
-ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]"
-for ac_option
-do
- case "\$ac_option" in
- -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
- echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion"
- exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;;
- -version | --version | --versio | --versi | --vers | --ver | --ve | --v)
- echo "$CONFIG_STATUS generated by autoconf version 2.13"
- exit 0 ;;
- -help | --help | --hel | --he | --h)
- echo "\$ac_cs_usage"; exit 0 ;;
- *) echo "\$ac_cs_usage"; exit 1 ;;
- esac
-done
-
-ac_given_srcdir=$srcdir
-ac_given_INSTALL="$INSTALL"
-
-trap 'rm -fr `echo "Makefile src/Makefile doc/Makefile config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
-EOF
-cat >> $CONFIG_STATUS <<EOF
-
-# Protect against being on the right side of a sed subst in config.status.
-sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g;
- s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF
-$ac_vpsub
-$extrasub
-s%@SHELL@%$SHELL%g
-s%@CFLAGS@%$CFLAGS%g
-s%@CPPFLAGS@%$CPPFLAGS%g
-s%@CXXFLAGS@%$CXXFLAGS%g
-s%@FFLAGS@%$FFLAGS%g
-s%@DEFS@%$DEFS%g
-s%@LDFLAGS@%$LDFLAGS%g
-s%@LIBS@%$LIBS%g
-s%@exec_prefix@%$exec_prefix%g
-s%@prefix@%$prefix%g
-s%@program_transform_name@%$program_transform_name%g
-s%@bindir@%$bindir%g
-s%@sbindir@%$sbindir%g
-s%@libexecdir@%$libexecdir%g
-s%@datadir@%$datadir%g
-s%@sysconfdir@%$sysconfdir%g
-s%@sharedstatedir@%$sharedstatedir%g
-s%@localstatedir@%$localstatedir%g
-s%@libdir@%$libdir%g
-s%@includedir@%$includedir%g
-s%@oldincludedir@%$oldincludedir%g
-s%@infodir@%$infodir%g
-s%@mandir@%$mandir%g
-s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
-s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g
-s%@INSTALL_DATA@%$INSTALL_DATA%g
-s%@PACKAGE@%$PACKAGE%g
-s%@VERSION@%$VERSION%g
-s%@ACLOCAL@%$ACLOCAL%g
-s%@AUTOCONF@%$AUTOCONF%g
-s%@AUTOMAKE@%$AUTOMAKE%g
-s%@AUTOHEADER@%$AUTOHEADER%g
-s%@MAKEINFO@%$MAKEINFO%g
-s%@SET_MAKE@%$SET_MAKE%g
-s%@CC@%$CC%g
-s%@RANLIB@%$RANLIB%g
-s%@CPP@%$CPP%g
-
-CEOF
-EOF
-
-cat >> $CONFIG_STATUS <<\EOF
-
-# Split the substitutions into bite-sized pieces for seds with
-# small command number limits, like on Digital OSF/1 and HP-UX.
-ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script.
-ac_file=1 # Number of current file.
-ac_beg=1 # First line for current file.
-ac_end=$ac_max_sed_cmds # Line after last line for current file.
-ac_more_lines=:
-ac_sed_cmds=""
-while $ac_more_lines; do
- if test $ac_beg -gt 1; then
- sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file
- else
- sed "${ac_end}q" conftest.subs > conftest.s$ac_file
- fi
- if test ! -s conftest.s$ac_file; then
- ac_more_lines=false
- rm -f conftest.s$ac_file
- else
- if test -z "$ac_sed_cmds"; then
- ac_sed_cmds="sed -f conftest.s$ac_file"
- else
- ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file"
- fi
- ac_file=`expr $ac_file + 1`
- ac_beg=$ac_end
- ac_end=`expr $ac_end + $ac_max_sed_cmds`
- fi
-done
-if test -z "$ac_sed_cmds"; then
- ac_sed_cmds=cat
-fi
-EOF
-
-cat >> $CONFIG_STATUS <<EOF
-
-CONFIG_FILES=\${CONFIG_FILES-"Makefile src/Makefile doc/Makefile"}
-EOF
-cat >> $CONFIG_STATUS <<\EOF
-for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
- # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
- case "$ac_file" in
- *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'`
- ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
- *) ac_file_in="${ac_file}.in" ;;
- esac
-
- # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories.
-
- # Remove last slash and all that follows it. Not all systems have dirname.
- ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
- if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
- # The file is in a subdirectory.
- test ! -d "$ac_dir" && mkdir "$ac_dir"
- ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`"
- # A "../" for each directory in $ac_dir_suffix.
- ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'`
- else
- ac_dir_suffix= ac_dots=
- fi
-
- case "$ac_given_srcdir" in
- .) srcdir=.
- if test -z "$ac_dots"; then top_srcdir=.
- else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;;
- /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;;
- *) # Relative path.
- srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix"
- top_srcdir="$ac_dots$ac_given_srcdir" ;;
- esac
-
- case "$ac_given_INSTALL" in
- [/$]*) INSTALL="$ac_given_INSTALL" ;;
- *) INSTALL="$ac_dots$ac_given_INSTALL" ;;
- esac
-
- echo creating "$ac_file"
- rm -f "$ac_file"
- configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure."
- case "$ac_file" in
- *Makefile*) ac_comsub="1i\\
-# $configure_input" ;;
- *) ac_comsub= ;;
- esac
-
- ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"`
- sed -e "$ac_comsub
-s%@configure_input@%$configure_input%g
-s%@srcdir@%$srcdir%g
-s%@top_srcdir@%$top_srcdir%g
-s%@INSTALL@%$INSTALL%g
-" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file
-fi; done
-rm -f conftest.s*
-
-# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where
-# NAME is the cpp macro being defined and VALUE is the value it is being given.
-#
-# ac_d sets the value in "#define NAME VALUE" lines.
-ac_dA='s%^\([ ]*\)#\([ ]*define[ ][ ]*\)'
-ac_dB='\([ ][ ]*\)[^ ]*%\1#\2'
-ac_dC='\3'
-ac_dD='%g'
-# ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE".
-ac_uA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)'
-ac_uB='\([ ]\)%\1#\2define\3'
-ac_uC=' '
-ac_uD='\4%g'
-# ac_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE".
-ac_eA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)'
-ac_eB='$%\1#\2define\3'
-ac_eC=' '
-ac_eD='%g'
-
-if test "${CONFIG_HEADERS+set}" != set; then
-EOF
-cat >> $CONFIG_STATUS <<EOF
- CONFIG_HEADERS="config.h"
-EOF
-cat >> $CONFIG_STATUS <<\EOF
-fi
-for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then
- # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
- case "$ac_file" in
- *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'`
- ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
- *) ac_file_in="${ac_file}.in" ;;
- esac
-
- echo creating $ac_file
-
- rm -f conftest.frag conftest.in conftest.out
- ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"`
- cat $ac_file_inputs > conftest.in
-
-EOF
-
-# Transform confdefs.h into a sed script conftest.vals that substitutes
-# the proper values into config.h.in to produce config.h. And first:
-# Protect against being on the right side of a sed subst in config.status.
-# Protect against being in an unquoted here document in config.status.
-rm -f conftest.vals
-cat > conftest.hdr <<\EOF
-s/[\\&%]/\\&/g
-s%[\\$`]%\\&%g
-s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD}%gp
-s%ac_d%ac_u%gp
-s%ac_u%ac_e%gp
-EOF
-sed -n -f conftest.hdr confdefs.h > conftest.vals
-rm -f conftest.hdr
-
-# This sed command replaces #undef with comments. This is necessary, for
-# example, in the case of _POSIX_SOURCE, which is predefined and required
-# on some systems where configure will not decide to define it.
-cat >> conftest.vals <<\EOF
-s%^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*%/* & */%
-EOF
-
-# Break up conftest.vals because some shells have a limit on
-# the size of here documents, and old seds have small limits too.
-
-rm -f conftest.tail
-while :
-do
- ac_lines=`grep -c . conftest.vals`
- # grep -c gives empty output for an empty file on some AIX systems.
- if test -z "$ac_lines" || test "$ac_lines" -eq 0; then break; fi
- # Write a limited-size here document to conftest.frag.
- echo ' cat > conftest.frag <<CEOF' >> $CONFIG_STATUS
- sed ${ac_max_here_lines}q conftest.vals >> $CONFIG_STATUS
- echo 'CEOF
- sed -f conftest.frag conftest.in > conftest.out
- rm -f conftest.in
- mv conftest.out conftest.in
-' >> $CONFIG_STATUS
- sed 1,${ac_max_here_lines}d conftest.vals > conftest.tail
- rm -f conftest.vals
- mv conftest.tail conftest.vals
-done
-rm -f conftest.vals
-
-cat >> $CONFIG_STATUS <<\EOF
- rm -f conftest.frag conftest.h
- echo "/* $ac_file. Generated automatically by configure. */" > conftest.h
- cat conftest.in >> conftest.h
- rm -f conftest.in
- if cmp -s $ac_file conftest.h 2>/dev/null; then
- echo "$ac_file is unchanged"
- rm -f conftest.h
- else
- # Remove last slash and all that follows it. Not all systems have dirname.
- ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
- if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
- # The file is in a subdirectory.
- test ! -d "$ac_dir" && mkdir "$ac_dir"
- fi
- rm -f $ac_file
- mv conftest.h $ac_file
- fi
-fi; done
-
-EOF
-cat >> $CONFIG_STATUS <<EOF
-
-
-EOF
-cat >> $CONFIG_STATUS <<\EOF
-test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h
-
-exit 0
-EOF
-chmod +x $CONFIG_STATUS
-rm -fr confdefs* $ac_clean_files
-test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1
-
-
diff --git a/ext/bcmath/libbcmath/configure.in b/ext/bcmath/libbcmath/configure.in
deleted file mode 100644
index 3da89e949f..0000000000
--- a/ext/bcmath/libbcmath/configure.in
+++ /dev/null
@@ -1,18 +0,0 @@
-dnl Process this file with autoconf to produce a configure script.
-AC_INIT(doc/bcmath.1)
-AM_INIT_AUTOMAKE("bcmath", "0.2")
-AM_CONFIG_HEADER(config.h)
-
-AC_PROG_CC
-
-AC_PROG_INSTALL
-AC_PROG_RANLIB
-AC_PROG_MAKE_SET
-
-AC_CHECK_HEADERS(stdarg.h stddef.h stdlib.h string.h limits.h unistd.h lib.h)
-AC_C_CONST
-AC_TYPE_SIZE_T
-AC_CHECK_TYPE(ptrdiff_t, size_t)
-
-AC_OUTPUT(Makefile src/Makefile doc/Makefile)
-
diff --git a/ext/bcmath/libbcmath/doc/Makefile.am b/ext/bcmath/libbcmath/doc/Makefile.am
deleted file mode 100644
index 3f43f904be..0000000000
--- a/ext/bcmath/libbcmath/doc/Makefile.am
+++ /dev/null
@@ -1,3 +0,0 @@
-# Documentation makefile
-
-MAINTAINERCLEANFILES= Makefile.in
diff --git a/ext/bcmath/libbcmath/doc/Makefile.in b/ext/bcmath/libbcmath/doc/Makefile.in
deleted file mode 100644
index fb974f1b4c..0000000000
--- a/ext/bcmath/libbcmath/doc/Makefile.in
+++ /dev/null
@@ -1,171 +0,0 @@
-# Makefile.in generated automatically by automake 1.4 from Makefile.am
-
-# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
-# This Makefile.in is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
-# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
-# PARTICULAR PURPOSE.
-
-# Documentation makefile
-
-
-SHELL = @SHELL@
-
-srcdir = @srcdir@
-top_srcdir = @top_srcdir@
-VPATH = @srcdir@
-prefix = @prefix@
-exec_prefix = @exec_prefix@
-
-bindir = @bindir@
-sbindir = @sbindir@
-libexecdir = @libexecdir@
-datadir = @datadir@
-sysconfdir = @sysconfdir@
-sharedstatedir = @sharedstatedir@
-localstatedir = @localstatedir@
-libdir = @libdir@
-infodir = @infodir@
-mandir = @mandir@
-includedir = @includedir@
-oldincludedir = /usr/include
-
-DESTDIR =
-
-pkgdatadir = $(datadir)/@PACKAGE@
-pkglibdir = $(libdir)/@PACKAGE@
-pkgincludedir = $(includedir)/@PACKAGE@
-
-top_builddir = ..
-
-ACLOCAL = @ACLOCAL@
-AUTOCONF = @AUTOCONF@
-AUTOMAKE = @AUTOMAKE@
-AUTOHEADER = @AUTOHEADER@
-
-INSTALL = @INSTALL@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
-INSTALL_DATA = @INSTALL_DATA@
-INSTALL_SCRIPT = @INSTALL_SCRIPT@
-transform = @program_transform_name@
-
-NORMAL_INSTALL = :
-PRE_INSTALL = :
-POST_INSTALL = :
-NORMAL_UNINSTALL = :
-PRE_UNINSTALL = :
-POST_UNINSTALL = :
-CC = @CC@
-MAKEINFO = @MAKEINFO@
-PACKAGE = @PACKAGE@
-RANLIB = @RANLIB@
-VERSION = @VERSION@
-
-MAINTAINERCLEANFILES = Makefile.in
-mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
-CONFIG_HEADER = ../config.h
-CONFIG_CLEAN_FILES =
-DIST_COMMON = Makefile.am Makefile.in
-
-
-DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
-
-TAR = tar
-GZIP_ENV = --best
-all: all-redirect
-.SUFFIXES:
-$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
- cd $(top_srcdir) && $(AUTOMAKE) --foreign --include-deps doc/Makefile
-
-Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
- cd $(top_builddir) \
- && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
-
-tags: TAGS
-TAGS:
-
-
-distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
-
-subdir = doc
-
-distdir: $(DISTFILES)
- @for file in $(DISTFILES); do \
- d=$(srcdir); \
- if test -d $$d/$$file; then \
- cp -pr $$/$$file $(distdir)/$$file; \
- else \
- test -f $(distdir)/$$file \
- || ln $$d/$$file $(distdir)/$$file 2> /dev/null \
- || cp -p $$d/$$file $(distdir)/$$file || :; \
- fi; \
- done
-info-am:
-info: info-am
-dvi-am:
-dvi: dvi-am
-check-am: all-am
-check: check-am
-installcheck-am:
-installcheck: installcheck-am
-install-exec-am:
-install-exec: install-exec-am
-
-install-data-am:
-install-data: install-data-am
-
-install-am: all-am
- @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
-install: install-am
-uninstall-am:
-uninstall: uninstall-am
-all-am: Makefile
-all-redirect: all-am
-install-strip:
- $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
-installdirs:
-
-
-mostlyclean-generic:
-
-clean-generic:
-
-distclean-generic:
- -rm -f Makefile $(CONFIG_CLEAN_FILES)
- -rm -f config.cache config.log stamp-h stamp-h[0-9]*
-
-maintainer-clean-generic:
- -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
-mostlyclean-am: mostlyclean-generic
-
-mostlyclean: mostlyclean-am
-
-clean-am: clean-generic mostlyclean-am
-
-clean: clean-am
-
-distclean-am: distclean-generic clean-am
-
-distclean: distclean-am
-
-maintainer-clean-am: maintainer-clean-generic distclean-am
- @echo "This command is intended for maintainers to use;"
- @echo "it deletes files that may require special tools to rebuild."
-
-maintainer-clean: maintainer-clean-am
-
-.PHONY: tags distdir info-am info dvi-am dvi check check-am \
-installcheck-am installcheck install-exec-am install-exec \
-install-data-am install-data install-am install uninstall-am uninstall \
-all-redirect all-am all installdirs mostlyclean-generic \
-distclean-generic clean-generic maintainer-clean-generic clean \
-mostlyclean distclean maintainer-clean
-
-
-# Tell versions [3.59,3.63) of GNU make to not export all variables.
-# Otherwise a system limit (for SysV at least) may be exceeded.
-.NOEXPORT:
diff --git a/ext/bcmath/libbcmath/doc/bcmath.1 b/ext/bcmath/libbcmath/doc/bcmath.1
deleted file mode 100644
index 669b73ac58..0000000000
--- a/ext/bcmath/libbcmath/doc/bcmath.1
+++ /dev/null
@@ -1 +0,0 @@
-./" bcmath library documentation
diff --git a/ext/bcmath/libbcmath/install-sh b/ext/bcmath/libbcmath/install-sh
deleted file mode 100644
index ab74c882e9..0000000000
--- a/ext/bcmath/libbcmath/install-sh
+++ /dev/null
@@ -1,238 +0,0 @@
-#!/bin/sh
-#
-# install - install a program, script, or datafile
-# This comes from X11R5.
-#
-# Calling this script install-sh is preferred over install.sh, to prevent
-# `make' implicit rules from creating a file called install from it
-# when there is no Makefile.
-#
-# This script is compatible with the BSD install script, but was written
-# from scratch.
-#
-
-
-# set DOITPROG to echo to test this script
-
-# Don't use :- since 4.3BSD and earlier shells don't like it.
-doit="${DOITPROG-}"
-
-
-# put in absolute paths if you don't have them in your path; or use env. vars.
-
-mvprog="${MVPROG-mv}"
-cpprog="${CPPROG-cp}"
-chmodprog="${CHMODPROG-chmod}"
-chownprog="${CHOWNPROG-chown}"
-chgrpprog="${CHGRPPROG-chgrp}"
-stripprog="${STRIPPROG-strip}"
-rmprog="${RMPROG-rm}"
-mkdirprog="${MKDIRPROG-mkdir}"
-
-tranformbasename=""
-transform_arg=""
-instcmd="$mvprog"
-chmodcmd="$chmodprog 0755"
-chowncmd=""
-chgrpcmd=""
-stripcmd=""
-rmcmd="$rmprog -f"
-mvcmd="$mvprog"
-src=""
-dst=""
-dir_arg=""
-
-while [ x"$1" != x ]; do
- case $1 in
- -c) instcmd="$cpprog"
- shift
- continue;;
-
- -d) dir_arg=true
- shift
- continue;;
-
- -m) chmodcmd="$chmodprog $2"
- shift
- shift
- continue;;
-
- -o) chowncmd="$chownprog $2"
- shift
- shift
- continue;;
-
- -g) chgrpcmd="$chgrpprog $2"
- shift
- shift
- continue;;
-
- -s) stripcmd="$stripprog"
- shift
- continue;;
-
- -t=*) transformarg=`echo $1 | sed 's/-t=//'`
- shift
- continue;;
-
- -b=*) transformbasename=`echo $1 | sed 's/-b=//'`
- shift
- continue;;
-
- *) if [ x"$src" = x ]
- then
- src=$1
- else
- # this colon is to work around a 386BSD /bin/sh bug
- :
- dst=$1
- fi
- shift
- continue;;
- esac
-done
-
-if [ x"$src" = x ]
-then
- echo "install: no input file specified"
- exit 1
-else
- true
-fi
-
-if [ x"$dir_arg" != x ]; then
- dst=$src
- src=""
-
- if [ -d $dst ]; then
- instcmd=:
- else
- instcmd=mkdir
- fi
-else
-
-# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
-# might cause directories to be created, which would be especially bad
-# if $src (and thus $dsttmp) contains '*'.
-
- if [ -f $src -o -d $src ]
- then
- true
- else
- echo "install: $src does not exist"
- exit 1
- fi
-
- if [ x"$dst" = x ]
- then
- echo "install: no destination specified"
- exit 1
- else
- true
- fi
-
-# If destination is a directory, append the input filename; if your system
-# does not like double slashes in filenames, you may need to add some logic
-
- if [ -d $dst ]
- then
- dst="$dst"/`basename $src`
- else
- true
- fi
-fi
-
-## this sed command emulates the dirname command
-dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
-
-# Make sure that the destination directory exists.
-# this part is taken from Noah Friedman's mkinstalldirs script
-
-# Skip lots of stat calls in the usual case.
-if [ ! -d "$dstdir" ]; then
-defaultIFS='
-'
-IFS="${IFS-${defaultIFS}}"
-
-oIFS="${IFS}"
-# Some sh's can't handle IFS=/ for some reason.
-IFS='%'
-set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
-IFS="${oIFS}"
-
-pathcomp=''
-
-while [ $# -ne 0 ] ; do
- pathcomp="${pathcomp}${1}"
- shift
-
- if [ ! -d "${pathcomp}" ] ;
- then
- $mkdirprog "${pathcomp}"
- else
- true
- fi
-
- pathcomp="${pathcomp}/"
-done
-fi
-
-if [ x"$dir_arg" != x ]
-then
- $doit $instcmd $dst &&
-
- if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
- if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
- if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
- if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
-else
-
-# If we're going to rename the final executable, determine the name now.
-
- if [ x"$transformarg" = x ]
- then
- dstfile=`basename $dst`
- else
- dstfile=`basename $dst $transformbasename |
- sed $transformarg`$transformbasename
- fi
-
-# don't allow the sed command to completely eliminate the filename
-
- if [ x"$dstfile" = x ]
- then
- dstfile=`basename $dst`
- else
- true
- fi
-
-# Make a temp file name in the proper directory.
-
- dsttmp=$dstdir/#inst.$$#
-
-# Move or copy the file name to the temp name
-
- $doit $instcmd $src $dsttmp &&
-
- trap "rm -f ${dsttmp}" 0 &&
-
-# and set any options; do chmod last to preserve setuid bits
-
-# If any of these fail, we abort the whole thing. If we want to
-# ignore errors from any of these, just make sure not to ignore
-# errors from the above "$doit $instcmd $src $dsttmp" command.
-
- if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
- if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
- if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
- if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
-
-# Now rename the file to the real destination.
-
- $doit $rmcmd -f $dstdir/$dstfile &&
- $doit $mvcmd $dsttmp $dstdir/$dstfile
-
-fi &&
-
-
-exit 0
diff --git a/ext/bcmath/libbcmath/missing b/ext/bcmath/libbcmath/missing
deleted file mode 100644
index e4b838ca92..0000000000
--- a/ext/bcmath/libbcmath/missing
+++ /dev/null
@@ -1,134 +0,0 @@
-#! /bin/sh
-# Common stub for a few missing GNU programs while installing.
-# Copyright (C) 1996, 1997 Free Software Foundation, Inc.
-# Franc,ois Pinard <pinard@iro.umontreal.ca>, 1996.
-
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-# 02111-1307, USA.
-
-if test $# -eq 0; then
- echo 1>&2 "Try \`$0 --help' for more information"
- exit 1
-fi
-
-case "$1" in
-
- -h|--h|--he|--hel|--help)
- echo "\
-$0 [OPTION]... PROGRAM [ARGUMENT]...
-
-Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
-error status if there is no known handling for PROGRAM.
-
-Options:
- -h, --help display this help and exit
- -v, --version output version information and exit
-
-Supported PROGRAM values:
- aclocal touch file \`aclocal.m4'
- autoconf touch file \`configure'
- autoheader touch file \`config.h.in'
- automake touch all \`Makefile.in' files
- bison touch file \`y.tab.c'
- makeinfo touch the output file
- yacc touch file \`y.tab.c'"
- ;;
-
- -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
- echo "missing - GNU libit 0.0"
- ;;
-
- -*)
- echo 1>&2 "$0: Unknown \`$1' option"
- echo 1>&2 "Try \`$0 --help' for more information"
- exit 1
- ;;
-
- aclocal)
- echo 1>&2 "\
-WARNING: \`$1' is missing on your system. It should be needed only if
- you modified \`acinclude.m4' or \`configure.in'. You might want
- to install the \`Automake' and \`Perl' packages. Grab them from
- any GNU archive site."
- touch aclocal.m4
- ;;
-
- autoconf)
- echo 1>&2 "\
-WARNING: \`$1' is missing on your system. It should be needed only if
- you modified \`configure.in'. You might want to install the
- \`Autoconf' and \`GNU m4' packages. Grab them from any GNU
- archive site."
- touch configure
- ;;
-
- autoheader)
- echo 1>&2 "\
-WARNING: \`$1' is missing on your system. It should be needed only if
- you modified \`acconfig.h' or \`configure.in'. You might want
- to install the \`Autoconf' and \`GNU m4' packages. Grab them
- from any GNU archive site."
- touch config.h.in
- ;;
-
- automake)
- echo 1>&2 "\
-WARNING: \`$1' is missing on your system. It should be needed only if
- you modified \`Makefile.am', \`acinclude.m4' or \`configure.in'.
- You might want to install the \`Automake' and \`Perl' packages.
- Grab them from any GNU archive site."
- find . -type f -name Makefile.am -print \
- | sed 's/^\(.*\).am$/touch \1.in/' \
- | sh
- ;;
-
- bison|yacc)
- echo 1>&2 "\
-WARNING: \`$1' is missing on your system. It should be needed only if
- your modified any \`.y' file. For being effective, your
- modifications might require the \`Bison' package. Grab it from
- any GNU archive site."
- touch y.tab.c
- ;;
-
- makeinfo)
- echo 1>&2 "\
-WARNING: \`$1' is missing on your system. It should be needed only if
- you modified a \`.texi' or \`.texinfo' file, or any other file
- indirectly affecting the aspect of the manual. The spurious
- call might also be the consequence of using a buggy \`make' (AIX,
- DU, IRIX). You might want to install the \`Texinfo' package or
- the \`GNU make' package. Grab either from any GNU archive site."
- file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
- if test -z "$file"; then
- file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
- file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file`
- fi
- touch $file
- ;;
-
- *)
- echo 1>&2 "\
-WARNING: \`$1' is needed, and you do not seem to have it handy on your
- system. You might have modified some files without having the
- proper tools for further handling them. Check the \`README' file,
- it often tells you about the needed prerequirements for installing
- this package. You may also peek at any GNU archive site, in case
- some other package would contain this missing \`$1' program."
- exit 1
- ;;
-esac
-
-exit 0
diff --git a/ext/bcmath/libbcmath/mkinstalldirs b/ext/bcmath/libbcmath/mkinstalldirs
deleted file mode 100644
index cc8783edce..0000000000
--- a/ext/bcmath/libbcmath/mkinstalldirs
+++ /dev/null
@@ -1,36 +0,0 @@
-#! /bin/sh
-# mkinstalldirs --- make directory hierarchy
-# Author: Noah Friedman <friedman@prep.ai.mit.edu>
-# Created: 1993-05-16
-# Last modified: 1994-03-25
-# Public domain
-
-errstatus=0
-
-for file in ${1+"$@"} ; do
- set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
- shift
-
- pathcomp=
- for d in ${1+"$@"} ; do
- pathcomp="$pathcomp$d"
- case "$pathcomp" in
- -* ) pathcomp=./$pathcomp ;;
- esac
-
- if test ! -d "$pathcomp"; then
- echo "mkdir $pathcomp" 1>&2
- mkdir "$pathcomp" > /dev/null 2>&1 || lasterr=$?
- fi
-
- if test ! -d "$pathcomp"; then
- errstatus=$lasterr
- fi
-
- pathcomp="$pathcomp/"
- done
-done
-
-exit $errstatus
-
-# mkinstalldirs ends here
diff --git a/ext/bcmath/libbcmath/src/Makefile.am b/ext/bcmath/libbcmath/src/Makefile.am
deleted file mode 100644
index fab37d785e..0000000000
--- a/ext/bcmath/libbcmath/src/Makefile.am
+++ /dev/null
@@ -1,22 +0,0 @@
-# Makefile for bcmath library
-
-lib_LIBRARIES = libbcmath.a
-
-include_HEADERS = bcmath.h
-
-libbcmath_a_SOURCES= add.c compare.c debug.c div.c divmod.c doaddsub.c \
- init.c int2num.c nearzero.c neg.c num2long.c num2str.c output.c \
- raise.c raisemod.c recmul.c rmzero.c sqrt.c str2num.c sub.c zero.c \
- outofmem.c rt.c
-
-INCLUDES = -I$(srcdir) -I..
-
-CFLAGS = @CFLAGS@
-CPPFLAGS = $(INCLUDES) -Wall
-
-MAINTAINERCLEANFILES= Makefile.in $(libbcmath_a_SOURCES) private.h bcmath.h
-
-all: $(bin_LIBRARIES)
-
-clean:
- rm -f $(OBJS) $(LIB) *~
diff --git a/ext/bcmath/libbcmath/src/Makefile.in b/ext/bcmath/libbcmath/src/Makefile.in
deleted file mode 100644
index f4a235f94a..0000000000
--- a/ext/bcmath/libbcmath/src/Makefile.in
+++ /dev/null
@@ -1,7 +0,0 @@
-LTLIBRARY_NAME = libbcmath.la
-LTLIBRARY_SOURCES = add.c div.c init.c neg.c outofmem.c raisemod.c rt.c sub.c \
- compare.c divmod.c int2num.c num2long.c output.c recmul.c \
- sqrt.c zero.c debug.c doaddsub.c nearzero.c num2str.c raise.c \
- rmzero.c str2num.c
-
-include $(top_srcdir)/build/dynlib.mk
diff --git a/ext/bcmath/libbcmath/src/add.c b/ext/bcmath/libbcmath/src/add.c
deleted file mode 100644
index 3b09af22b2..0000000000
--- a/ext/bcmath/libbcmath/src/add.c
+++ /dev/null
@@ -1,88 +0,0 @@
-/* add.c: bcmath library file. */
-/*
- Copyright (C) 1991, 1992, 1993, 1994, 1997 Free Software Foundation, Inc.
- Copyright (C) 2000 Philip A. Nelson
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details. (COPYING.LIB)
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to:
-
- The Free Software Foundation, Inc.
- 59 Temple Place, Suite 330
- Boston, MA 02111-1307 USA.
-
- You may contact the author by:
- e-mail: philnelson@acm.org
- us-mail: Philip A. Nelson
- Computer Science Department, 9062
- Western Washington University
- Bellingham, WA 98226-9062
-
-*************************************************************************/
-
-#include <config.h>
-#include <stdio.h>
-#include <assert.h>
-#include <stdlib.h>
-#include <ctype.h>
-#include <stdarg.h>
-#include "bcmath.h"
-#include "private.h"
-
-
-/* Here is the full add routine that takes care of negative numbers.
- N1 is added to N2 and the result placed into RESULT. SCALE_MIN
- is the minimum scale for the result. */
-
-void
-bc_add (n1, n2, result, scale_min)
- bc_num n1, n2, *result;
- int scale_min;
-{
- bc_num sum = NULL;
- int cmp_res;
- int res_scale;
-
- if (n1->n_sign == n2->n_sign)
- {
- sum = _bc_do_add (n1, n2, scale_min);
- sum->n_sign = n1->n_sign;
- }
- else
- {
- /* subtraction must be done. */
- cmp_res = _bc_do_compare (n1, n2, FALSE, FALSE); /* Compare magnitudes. */
- switch (cmp_res)
- {
- case -1:
- /* n1 is less than n2, subtract n1 from n2. */
- sum = _bc_do_sub (n2, n1, scale_min);
- sum->n_sign = n2->n_sign;
- break;
- case 0:
- /* They are equal! return zero with the correct scale! */
- res_scale = MAX (scale_min, MAX(n1->n_scale, n2->n_scale));
- sum = bc_new_num (1, res_scale);
- memset (sum->n_value, 0, res_scale+1);
- break;
- case 1:
- /* n2 is less than n1, subtract n2 from n1. */
- sum = _bc_do_sub (n1, n2, scale_min);
- sum->n_sign = n1->n_sign;
- }
- }
-
- /* Clean up and return. */
- bc_free_num (result);
- *result = sum;
-}
-
diff --git a/ext/bcmath/libbcmath/src/bcmath.h b/ext/bcmath/libbcmath/src/bcmath.h
deleted file mode 100644
index b7c338c4aa..0000000000
--- a/ext/bcmath/libbcmath/src/bcmath.h
+++ /dev/null
@@ -1,158 +0,0 @@
-/* bcmath.h: bcmath library header. */
-/*
- Copyright (C) 1991, 1992, 1993, 1994, 1997 Free Software Foundation, Inc.
- Copyright (C) 2000 Philip A. Nelson
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details. (COPYING.LIB)
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to:
-
- The Free Software Foundation, Inc.
- 59 Temple Place, Suite 330
- Boston, MA 02111-1307 USA.
-
- You may contact the author by:
- e-mail: philnelson@acm.org
- us-mail: Philip A. Nelson
- Computer Science Department, 9062
- Western Washington University
- Bellingham, WA 98226-9062
-
-*************************************************************************/
-
-#ifndef _BCMATH_H_
-#define _BCMATH_H_
-
-typedef enum {PLUS, MINUS} sign;
-
-typedef struct bc_struct *bc_num;
-
-typedef struct bc_struct
- {
- sign n_sign;
- int n_len; /* The number of digits before the decimal point. */
- int n_scale; /* The number of digits after the decimal point. */
- int n_refs; /* The number of pointers to this number. */
- bc_num n_next; /* Linked list for available list. */
- char *n_ptr; /* The pointer to the actual storage.
- If NULL, n_value points to the inside of
- another number (bc_multiply...) and should
- not be "freed." */
- char *n_value; /* The number. Not zero char terminated.
- May not point to the same place as n_ptr as
- in the case of leading zeros generated. */
- } bc_struct;
-
-
-/* The base used in storing the numbers in n_value above.
- Currently this MUST be 10. */
-
-#define BASE 10
-
-/* Some useful macros and constants. */
-
-#define CH_VAL(c) (c - '0')
-#define BCD_CHAR(d) (d + '0')
-
-#ifdef MIN
-#undef MIN
-#undef MAX
-#endif
-#define MAX(a,b) ((a)>(b)?(a):(b))
-#define MIN(a,b) ((a)>(b)?(b):(a))
-#define ODD(a) ((a)&1)
-
-#ifndef TRUE
-#define TRUE 1
-#define FALSE 0
-#endif
-
-#ifndef LONG_MAX
-#define LONG_MAX 0x7ffffff
-#endif
-
-
-/* Global numbers. */
-extern bc_num _zero_;
-extern bc_num _one_;
-extern bc_num _two_;
-
-
-/* Function Prototypes */
-
-/* Define the _PROTOTYPE macro if it is needed. */
-
-#ifndef _PROTOTYPE
-#ifdef __STDC__
-#define _PROTOTYPE(func, args) func args
-#else
-#define _PROTOTYPE(func, args) func()
-#endif
-#endif
-
-_PROTOTYPE(void bc_init_numbers, (void));
-
-_PROTOTYPE(bc_num bc_new_num, (int length, int scale));
-
-_PROTOTYPE(void bc_free_num, (bc_num *num));
-
-_PROTOTYPE(bc_num bc_copy_num, (bc_num num));
-
-_PROTOTYPE(void bc_init_num, (bc_num *num));
-
-_PROTOTYPE(void bc_str2num, (bc_num *num, char *str, int scale));
-
-_PROTOTYPE(char *bc_num2str, (bc_num num));
-
-_PROTOTYPE(void bc_int2num, (bc_num *num, int val));
-
-_PROTOTYPE(long bc_num2long, (bc_num num));
-
-_PROTOTYPE(int bc_compare, (bc_num n1, bc_num n2));
-
-_PROTOTYPE(char bc_is_zero, (bc_num num));
-
-_PROTOTYPE(char bc_is_near_zero, (bc_num num, int scale));
-
-_PROTOTYPE(char bc_is_neg, (bc_num num));
-
-_PROTOTYPE(void bc_add, (bc_num n1, bc_num n2, bc_num *result, int scale_min));
-
-_PROTOTYPE(void bc_sub, (bc_num n1, bc_num n2, bc_num *result, int scale_min));
-
-_PROTOTYPE(void bc_multiply, (bc_num n1, bc_num n2, bc_num *prod, int scale));
-
-_PROTOTYPE(int bc_divide, (bc_num n1, bc_num n2, bc_num *quot, int scale));
-
-_PROTOTYPE(int bc_modulo, (bc_num num1, bc_num num2, bc_num *result,
- int scale));
-
-_PROTOTYPE(int bc_divmod, (bc_num num1, bc_num num2, bc_num *quot,
- bc_num *rem, int scale));
-
-_PROTOTYPE(int bc_raisemod, (bc_num base, bc_num expo, bc_num mod,
- bc_num *result, int scale));
-
-_PROTOTYPE(void bc_raise, (bc_num num1, bc_num num2, bc_num *result,
- int scale));
-
-_PROTOTYPE(int bc_sqrt, (bc_num *num, int scale));
-
-_PROTOTYPE(void bc_out_num, (bc_num num, int o_base, void (* out_char)(int),
- int leading_zero));
-
-/* Prototypes needed for external utility routines. */
-
-_PROTOTYPE(void bc_rt_warn, (char *mesg ,...));
-_PROTOTYPE(void bc_rt_error, (char *mesg ,...));
-_PROTOTYPE(void bc_out_of_memory, (void));
-#endif
diff --git a/ext/bcmath/libbcmath/src/compare.c b/ext/bcmath/libbcmath/src/compare.c
deleted file mode 100644
index 2f094a6917..0000000000
--- a/ext/bcmath/libbcmath/src/compare.c
+++ /dev/null
@@ -1,161 +0,0 @@
-/* compare.c: bcmath library file. */
-/*
- Copyright (C) 1991, 1992, 1993, 1994, 1997 Free Software Foundation, Inc.
- Copyright (C) 2000 Philip A. Nelson
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details. (COPYING.LIB)
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to:
-
- The Free Software Foundation, Inc.
- 59 Temple Place, Suite 330
- Boston, MA 02111-1307 USA.
-
- You may contact the author by:
- e-mail: philnelson@acm.org
- us-mail: Philip A. Nelson
- Computer Science Department, 9062
- Western Washington University
- Bellingham, WA 98226-9062
-
-*************************************************************************/
-
-#include <config.h>
-#include <stdio.h>
-#include <assert.h>
-#include <stdlib.h>
-#include <ctype.h>
-#include <stdarg.h>
-#include "bcmath.h"
-#include "private.h"
-
-
-/* Compare two bc numbers. Return value is 0 if equal, -1 if N1 is less
- than N2 and +1 if N1 is greater than N2. If USE_SIGN is false, just
- compare the magnitudes. */
-
- int
-_bc_do_compare (n1, n2, use_sign, ignore_last)
- bc_num n1, n2;
- int use_sign;
- int ignore_last;
-{
- char *n1ptr, *n2ptr;
- int count;
-
- /* First, compare signs. */
- if (use_sign && n1->n_sign != n2->n_sign)
- {
- if (n1->n_sign == PLUS)
- return (1); /* Positive N1 > Negative N2 */
- else
- return (-1); /* Negative N1 < Positive N1 */
- }
-
- /* Now compare the magnitude. */
- if (n1->n_len != n2->n_len)
- {
- if (n1->n_len > n2->n_len)
- {
- /* Magnitude of n1 > n2. */
- if (!use_sign || n1->n_sign == PLUS)
- return (1);
- else
- return (-1);
- }
- else
- {
- /* Magnitude of n1 < n2. */
- if (!use_sign || n1->n_sign == PLUS)
- return (-1);
- else
- return (1);
- }
- }
-
- /* If we get here, they have the same number of integer digits.
- check the integer part and the equal length part of the fraction. */
- count = n1->n_len + MIN (n1->n_scale, n2->n_scale);
- n1ptr = n1->n_value;
- n2ptr = n2->n_value;
-
- while ((count > 0) && (*n1ptr == *n2ptr))
- {
- n1ptr++;
- n2ptr++;
- count--;
- }
- if (ignore_last && count == 1 && n1->n_scale == n2->n_scale)
- return (0);
- if (count != 0)
- {
- if (*n1ptr > *n2ptr)
- {
- /* Magnitude of n1 > n2. */
- if (!use_sign || n1->n_sign == PLUS)
- return (1);
- else
- return (-1);
- }
- else
- {
- /* Magnitude of n1 < n2. */
- if (!use_sign || n1->n_sign == PLUS)
- return (-1);
- else
- return (1);
- }
- }
-
- /* They are equal up to the last part of the equal part of the fraction. */
- if (n1->n_scale != n2->n_scale)
- {
- if (n1->n_scale > n2->n_scale)
- {
- for (count = n1->n_scale-n2->n_scale; count>0; count--)
- if (*n1ptr++ != 0)
- {
- /* Magnitude of n1 > n2. */
- if (!use_sign || n1->n_sign == PLUS)
- return (1);
- else
- return (-1);
- }
- }
- else
- {
- for (count = n2->n_scale-n1->n_scale; count>0; count--)
- if (*n2ptr++ != 0)
- {
- /* Magnitude of n1 < n2. */
- if (!use_sign || n1->n_sign == PLUS)
- return (-1);
- else
- return (1);
- }
- }
- }
-
- /* They must be equal! */
- return (0);
-}
-
-
-/* This is the "user callable" routine to compare numbers N1 and N2. */
-
-int
-bc_compare (n1, n2)
- bc_num n1, n2;
-{
- return _bc_do_compare (n1, n2, TRUE, FALSE);
-}
-
diff --git a/ext/bcmath/libbcmath/src/config.h b/ext/bcmath/libbcmath/src/config.h
deleted file mode 100644
index 42c42a8948..0000000000
--- a/ext/bcmath/libbcmath/src/config.h
+++ /dev/null
@@ -1,9 +0,0 @@
-#if PHP_WIN32
-#include "../../../../main/config.w32.h"
-#else
-#include "php_config.h"
-#endif
-
-#include <string.h>
-#include "zend.h"
-#include "zend_alloc.h"
diff --git a/ext/bcmath/libbcmath/src/debug.c b/ext/bcmath/libbcmath/src/debug.c
deleted file mode 100644
index ac1ee4ada7..0000000000
--- a/ext/bcmath/libbcmath/src/debug.c
+++ /dev/null
@@ -1,70 +0,0 @@
-/* debug.c: bcmath library file. */
-/*
- Copyright (C) 1991, 1992, 1993, 1994, 1997 Free Software Foundation, Inc.
- Copyright (C) 2000 Philip A. Nelson
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details. (COPYING.LIB)
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to:
-
- The Free Software Foundation, Inc.
- 59 Temple Place, Suite 330
- Boston, MA 02111-1307 USA.
-
- You may contact the author by:
- e-mail: philnelson@acm.org
- us-mail: Philip A. Nelson
- Computer Science Department, 9062
- Western Washington University
- Bellingham, WA 98226-9062
-
-*************************************************************************/
-
-#include <config.h>
-#include <stdio.h>
-#include <assert.h>
-#include <stdlib.h>
-#include <ctype.h>
-#include <stdarg.h>
-#include "bcmath.h"
-#include "private.h"
-
-/* pn prints the number NUM in base 10. */
-
-static void
-out_char (int c)
-{
- putchar(c);
-}
-
-
-void
-pn (num)
- bc_num num;
-{
- bc_out_num (num, 10, out_char, 0);
- out_char ('\n');
-}
-
-
-/* pv prints a character array as if it was a string of bcd digits. */
-void
-pv (name, num, len)
- char *name;
- unsigned char *num;
- int len;
-{
- int i;
- printf ("%s=", name);
- for (i=0; i<len; i++) printf ("%c",BCD_CHAR(num[i]));
- printf ("\n");
-}
diff --git a/ext/bcmath/libbcmath/src/div.c b/ext/bcmath/libbcmath/src/div.c
deleted file mode 100644
index 62f24dd494..0000000000
--- a/ext/bcmath/libbcmath/src/div.c
+++ /dev/null
@@ -1,276 +0,0 @@
-/* div.c: bcmath library file. */
-/*
- Copyright (C) 1991, 1992, 1993, 1994, 1997 Free Software Foundation, Inc.
- Copyright (C) 2000 Philip A. Nelson
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details. (COPYING.LIB)
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to:
-
- The Free Software Foundation, Inc.
- 59 Temple Place, Suite 330
- Boston, MA 02111-1307 USA.
-
- You may contact the author by:
- e-mail: philnelson@acm.org
- us-mail: Philip A. Nelson
- Computer Science Department, 9062
- Western Washington University
- Bellingham, WA 98226-9062
-
-*************************************************************************/
-
-#include <config.h>
-#include <stdio.h>
-#include <assert.h>
-#include <stdlib.h>
-#include <ctype.h>
-#include <stdarg.h>
-#include "bcmath.h"
-#include "private.h"
-
-
-/* Some utility routines for the divide: First a one digit multiply.
- NUM (with SIZE digits) is multiplied by DIGIT and the result is
- placed into RESULT. It is written so that NUM and RESULT can be
- the same pointers. */
-
-static void
-_one_mult (num, size, digit, result)
- unsigned char *num;
- int size, digit;
- unsigned char *result;
-{
- int carry, value;
- unsigned char *nptr, *rptr;
-
- if (digit == 0)
- memset (result, 0, size);
- else
- {
- if (digit == 1)
- memcpy (result, num, size);
- else
- {
- /* Initialize */
- nptr = (unsigned char *) (num+size-1);
- rptr = (unsigned char *) (result+size-1);
- carry = 0;
-
- while (size-- > 0)
- {
- value = *nptr-- * digit + carry;
- *rptr-- = value % BASE;
- carry = value / BASE;
- }
-
- if (carry != 0) *rptr = carry;
- }
- }
-}
-
-
-/* The full division routine. This computes N1 / N2. It returns
- 0 if the division is ok and the result is in QUOT. The number of
- digits after the decimal point is SCALE. It returns -1 if division
- by zero is tried. The algorithm is found in Knuth Vol 2. p237. */
-
-int
-bc_divide (n1, n2, quot, scale)
- bc_num n1, n2, *quot;
- int scale;
-{
- bc_num qval;
- unsigned char *num1, *num2;
- unsigned char *ptr1, *ptr2, *n2ptr, *qptr;
- int scale1, val;
- unsigned int len1, len2, scale2, qdigits, extra, count;
- unsigned int qdig, qguess, borrow, carry;
- unsigned char *mval;
- char zero;
- unsigned int norm;
-
- /* Test for divide by zero. */
- if (bc_is_zero (n2)) return -1;
-
- /* Test for divide by 1. If it is we must truncate. */
- if (n2->n_scale == 0)
- {
- if (n2->n_len == 1 && *n2->n_value == 1)
- {
- qval = bc_new_num (n1->n_len, scale);
- qval->n_sign = (n1->n_sign == n2->n_sign ? PLUS : MINUS);
- memset (&qval->n_value[n1->n_len],0,scale);
- memcpy (qval->n_value, n1->n_value,
- n1->n_len + MIN(n1->n_scale,scale));
- bc_free_num (quot);
- *quot = qval;
- }
- }
-
- /* Set up the divide. Move the decimal point on n1 by n2's scale.
- Remember, zeros on the end of num2 are wasted effort for dividing. */
- scale2 = n2->n_scale;
- n2ptr = (unsigned char *) n2->n_value+n2->n_len+scale2-1;
- while ((scale2 > 0) && (*n2ptr-- == 0)) scale2--;
-
- len1 = n1->n_len + scale2;
- scale1 = n1->n_scale - scale2;
- if (scale1 < scale)
- extra = scale - scale1;
- else
- extra = 0;
- num1 = (unsigned char *) emalloc (n1->n_len+n1->n_scale+extra+2);
- if (num1 == NULL) bc_out_of_memory();
- memset (num1, 0, n1->n_len+n1->n_scale+extra+2);
- memcpy (num1+1, n1->n_value, n1->n_len+n1->n_scale);
-
- len2 = n2->n_len + scale2;
- num2 = (unsigned char *) emalloc (len2+1);
- if (num2 == NULL) bc_out_of_memory();
- memcpy (num2, n2->n_value, len2);
- *(num2+len2) = 0;
- n2ptr = num2;
- while (*n2ptr == 0)
- {
- n2ptr++;
- len2--;
- }
-
- /* Calculate the number of quotient digits. */
- if (len2 > len1+scale)
- {
- qdigits = scale+1;
- zero = TRUE;
- }
- else
- {
- zero = FALSE;
- if (len2>len1)
- qdigits = scale+1; /* One for the zero integer part. */
- else
- qdigits = len1-len2+scale+1;
- }
-
- /* Allocate and zero the storage for the quotient. */
- qval = bc_new_num (qdigits-scale,scale);
- memset (qval->n_value, 0, qdigits);
-
- /* Allocate storage for the temporary storage mval. */
- mval = (unsigned char *) emalloc (len2+1);
- if (mval == NULL) bc_out_of_memory ();
-
- /* Now for the full divide algorithm. */
- if (!zero)
- {
- /* Normalize */
- norm = 10 / ((int)*n2ptr + 1);
- if (norm != 1)
- {
- _one_mult (num1, len1+scale1+extra+1, norm, num1);
- _one_mult (n2ptr, len2, norm, n2ptr);
- }
-
- /* Initialize divide loop. */
- qdig = 0;
- if (len2 > len1)
- qptr = (unsigned char *) qval->n_value+len2-len1;
- else
- qptr = (unsigned char *) qval->n_value;
-
- /* Loop */
- while (qdig <= len1+scale-len2)
- {
- /* Calculate the quotient digit guess. */
- if (*n2ptr == num1[qdig])
- qguess = 9;
- else
- qguess = (num1[qdig]*10 + num1[qdig+1]) / *n2ptr;
-
- /* Test qguess. */
- if (n2ptr[1]*qguess >
- (num1[qdig]*10 + num1[qdig+1] - *n2ptr*qguess)*10
- + num1[qdig+2])
- {
- qguess--;
- /* And again. */
- if (n2ptr[1]*qguess >
- (num1[qdig]*10 + num1[qdig+1] - *n2ptr*qguess)*10
- + num1[qdig+2])
- qguess--;
- }
-
- /* Multiply and subtract. */
- borrow = 0;
- if (qguess != 0)
- {
- *mval = 0;
- _one_mult (n2ptr, len2, qguess, mval+1);
- ptr1 = (unsigned char *) num1+qdig+len2;
- ptr2 = (unsigned char *) mval+len2;
- for (count = 0; count < len2+1; count++)
- {
- val = (int) *ptr1 - (int) *ptr2-- - borrow;
- if (val < 0)
- {
- val += 10;
- borrow = 1;
- }
- else
- borrow = 0;
- *ptr1-- = val;
- }
- }
-
- /* Test for negative result. */
- if (borrow == 1)
- {
- qguess--;
- ptr1 = (unsigned char *) num1+qdig+len2;
- ptr2 = (unsigned char *) n2ptr+len2-1;
- carry = 0;
- for (count = 0; count < len2; count++)
- {
- val = (int) *ptr1 + (int) *ptr2-- + carry;
- if (val > 9)
- {
- val -= 10;
- carry = 1;
- }
- else
- carry = 0;
- *ptr1-- = val;
- }
- if (carry == 1) *ptr1 = (*ptr1 + 1) % 10;
- }
-
- /* We now know the quotient digit. */
- *qptr++ = qguess;
- qdig++;
- }
- }
-
- /* Clean up and return the number. */
- qval->n_sign = ( n1->n_sign == n2->n_sign ? PLUS : MINUS );
- if (bc_is_zero (qval)) qval->n_sign = PLUS;
- _bc_rm_leading_zeros (qval);
- bc_free_num (quot);
- *quot = qval;
-
- /* Clean up temporary storage. */
- efree (mval);
- efree (num1);
- efree (num2);
-
- return 0; /* Everything is OK. */
-}
-
diff --git a/ext/bcmath/libbcmath/src/divmod.c b/ext/bcmath/libbcmath/src/divmod.c
deleted file mode 100644
index e62817d00b..0000000000
--- a/ext/bcmath/libbcmath/src/divmod.c
+++ /dev/null
@@ -1,91 +0,0 @@
-/* divmod.c: bcmath library file. */
-/*
- Copyright (C) 1991, 1992, 1993, 1994, 1997 Free Software Foundation, Inc.
- Copyright (C) 2000 Philip A. Nelson
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details. (COPYING.LIB)
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to:
-
- The Free Software Foundation, Inc.
- 59 Temple Place, Suite 330
- Boston, MA 02111-1307 USA.
-
- You may contact the author by:
- e-mail: philnelson@acm.org
- us-mail: Philip A. Nelson
- Computer Science Department, 9062
- Western Washington University
- Bellingham, WA 98226-9062
-
-*************************************************************************/
-
-#include <config.h>
-#include <stdio.h>
-#include <assert.h>
-#include <stdlib.h>
-#include <ctype.h>
-#include <stdarg.h>
-#include "bcmath.h"
-#include "private.h"
-
-
-/* Division *and* modulo for numbers. This computes both NUM1 / NUM2 and
- NUM1 % NUM2 and puts the results in QUOT and REM, except that if QUOT
- is NULL then that store will be omitted.
- */
-
-int
-bc_divmod (num1, num2, quot, rem, scale)
- bc_num num1, num2, *quot, *rem;
- int scale;
-{
- bc_num quotient = NULL;
- bc_num temp;
- int rscale;
-
- /* Check for correct numbers. */
- if (bc_is_zero (num2)) return -1;
-
- /* Calculate final scale. */
- rscale = MAX (num1->n_scale, num2->n_scale+scale);
- bc_init_num(&temp);
-
- /* Calculate it. */
- bc_divide (num1, num2, &temp, scale);
- if (quot)
- quotient = bc_copy_num (temp);
- bc_multiply (temp, num2, &temp, rscale);
- bc_sub (num1, temp, rem, rscale);
- bc_free_num (&temp);
-
- if (quot)
- {
- bc_free_num (quot);
- *quot = quotient;
- }
-
- return 0; /* Everything is OK. */
-}
-
-
-/* Modulo for numbers. This computes NUM1 % NUM2 and puts the
- result in RESULT. */
-
-int
-bc_modulo (num1, num2, result, scale)
- bc_num num1, num2, *result;
- int scale;
-{
- return bc_divmod (num1, num2, NULL, result, scale);
-}
-
diff --git a/ext/bcmath/libbcmath/src/doaddsub.c b/ext/bcmath/libbcmath/src/doaddsub.c
deleted file mode 100644
index 5458fc5dfc..0000000000
--- a/ext/bcmath/libbcmath/src/doaddsub.c
+++ /dev/null
@@ -1,232 +0,0 @@
-/* doaddsub.c: bcmath library file. */
-/*
- Copyright (C) 1991, 1992, 1993, 1994, 1997 Free Software Foundation, Inc.
- Copyright (C) 2000 Philip A. Nelson
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details. (COPYING.LIB)
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to:
-
- The Free Software Foundation, Inc.
- 59 Temple Place, Suite 330
- Boston, MA 02111-1307 USA.
-
- You may contact the author by:
- e-mail: philnelson@acm.org
- us-mail: Philip A. Nelson
- Computer Science Department, 9062
- Western Washington University
- Bellingham, WA 98226-9062
-
-*************************************************************************/
-
-#include <config.h>
-#include <stdio.h>
-#include <assert.h>
-#include <stdlib.h>
-#include <ctype.h>
-#include <stdarg.h>
-#include "bcmath.h"
-#include "private.h"
-
-
-/* Perform addition: N1 is added to N2 and the value is
- returned. The signs of N1 and N2 are ignored.
- SCALE_MIN is to set the minimum scale of the result. */
-
- bc_num
-_bc_do_add (n1, n2, scale_min)
- bc_num n1, n2;
- int scale_min;
-{
- bc_num sum;
- int sum_scale, sum_digits;
- char *n1ptr, *n2ptr, *sumptr;
- int carry, n1bytes, n2bytes;
- int count;
-
- /* Prepare sum. */
- sum_scale = MAX (n1->n_scale, n2->n_scale);
- sum_digits = MAX (n1->n_len, n2->n_len) + 1;
- sum = bc_new_num (sum_digits, MAX(sum_scale, scale_min));
-
- /* Zero extra digits made by scale_min. */
- if (scale_min > sum_scale)
- {
- sumptr = (char *) (sum->n_value + sum_scale + sum_digits);
- for (count = scale_min - sum_scale; count > 0; count--)
- *sumptr++ = 0;
- }
-
- /* Start with the fraction part. Initialize the pointers. */
- n1bytes = n1->n_scale;
- n2bytes = n2->n_scale;
- n1ptr = (char *) (n1->n_value + n1->n_len + n1bytes - 1);
- n2ptr = (char *) (n2->n_value + n2->n_len + n2bytes - 1);
- sumptr = (char *) (sum->n_value + sum_scale + sum_digits - 1);
-
- /* Add the fraction part. First copy the longer fraction.*/
- if (n1bytes != n2bytes)
- {
- if (n1bytes > n2bytes)
- while (n1bytes>n2bytes)
- { *sumptr-- = *n1ptr--; n1bytes--;}
- else
- while (n2bytes>n1bytes)
- { *sumptr-- = *n2ptr--; n2bytes--;}
- }
-
- /* Now add the remaining fraction part and equal size integer parts. */
- n1bytes += n1->n_len;
- n2bytes += n2->n_len;
- carry = 0;
- while ((n1bytes > 0) && (n2bytes > 0))
- {
- *sumptr = *n1ptr-- + *n2ptr-- + carry;
- if (*sumptr > (BASE-1))
- {
- carry = 1;
- *sumptr -= BASE;
- }
- else
- carry = 0;
- sumptr--;
- n1bytes--;
- n2bytes--;
- }
-
- /* Now add carry the longer integer part. */
- if (n1bytes == 0)
- { n1bytes = n2bytes; n1ptr = n2ptr; }
- while (n1bytes-- > 0)
- {
- *sumptr = *n1ptr-- + carry;
- if (*sumptr > (BASE-1))
- {
- carry = 1;
- *sumptr -= BASE;
- }
- else
- carry = 0;
- sumptr--;
- }
-
- /* Set final carry. */
- if (carry == 1)
- *sumptr += 1;
-
- /* Adjust sum and return. */
- _bc_rm_leading_zeros (sum);
- return sum;
-}
-
-
-/* Perform subtraction: N2 is subtracted from N1 and the value is
- returned. The signs of N1 and N2 are ignored. Also, N1 is
- assumed to be larger than N2. SCALE_MIN is the minimum scale
- of the result. */
-
- bc_num
-_bc_do_sub (n1, n2, scale_min)
- bc_num n1, n2;
- int scale_min;
-{
- bc_num diff;
- int diff_scale, diff_len;
- int min_scale, min_len;
- char *n1ptr, *n2ptr, *diffptr;
- int borrow, count, val;
-
- /* Allocate temporary storage. */
- diff_len = MAX (n1->n_len, n2->n_len);
- diff_scale = MAX (n1->n_scale, n2->n_scale);
- min_len = MIN (n1->n_len, n2->n_len);
- min_scale = MIN (n1->n_scale, n2->n_scale);
- diff = bc_new_num (diff_len, MAX(diff_scale, scale_min));
-
- /* Zero extra digits made by scale_min. */
- if (scale_min > diff_scale)
- {
- diffptr = (char *) (diff->n_value + diff_len + diff_scale);
- for (count = scale_min - diff_scale; count > 0; count--)
- *diffptr++ = 0;
- }
-
- /* Initialize the subtract. */
- n1ptr = (char *) (n1->n_value + n1->n_len + n1->n_scale -1);
- n2ptr = (char *) (n2->n_value + n2->n_len + n2->n_scale -1);
- diffptr = (char *) (diff->n_value + diff_len + diff_scale -1);
-
- /* Subtract the numbers. */
- borrow = 0;
-
- /* Take care of the longer scaled number. */
- if (n1->n_scale != min_scale)
- {
- /* n1 has the longer scale */
- for (count = n1->n_scale - min_scale; count > 0; count--)
- *diffptr-- = *n1ptr--;
- }
- else
- {
- /* n2 has the longer scale */
- for (count = n2->n_scale - min_scale; count > 0; count--)
- {
- val = - *n2ptr-- - borrow;
- if (val < 0)
- {
- val += BASE;
- borrow = 1;
- }
- else
- borrow = 0;
- *diffptr-- = val;
- }
- }
-
- /* Now do the equal length scale and integer parts. */
-
- for (count = 0; count < min_len + min_scale; count++)
- {
- val = *n1ptr-- - *n2ptr-- - borrow;
- if (val < 0)
- {
- val += BASE;
- borrow = 1;
- }
- else
- borrow = 0;
- *diffptr-- = val;
- }
-
- /* If n1 has more digits then n2, we now do that subtract. */
- if (diff_len != min_len)
- {
- for (count = diff_len - min_len; count > 0; count--)
- {
- val = *n1ptr-- - borrow;
- if (val < 0)
- {
- val += BASE;
- borrow = 1;
- }
- else
- borrow = 0;
- *diffptr-- = val;
- }
- }
-
- /* Clean up and return. */
- _bc_rm_leading_zeros (diff);
- return diff;
-}
-
diff --git a/ext/bcmath/libbcmath/src/init.c b/ext/bcmath/libbcmath/src/init.c
deleted file mode 100644
index 4ff00b1102..0000000000
--- a/ext/bcmath/libbcmath/src/init.c
+++ /dev/null
@@ -1,135 +0,0 @@
-/* init.c: bcmath library file. */
-/*
- Copyright (C) 1991, 1992, 1993, 1994, 1997 Free Software Foundation, Inc.
- Copyright (C) 2000 Philip A. Nelson
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details. (COPYING.LIB)
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to:
-
- The Free Software Foundation, Inc.
- 59 Temple Place, Suite 330
- Boston, MA 02111-1307 USA.
-
- You may contact the author by:
- e-mail: philnelson@acm.org
- us-mail: Philip A. Nelson
- Computer Science Department, 9062
- Western Washington University
- Bellingham, WA 98226-9062
-
-*************************************************************************/
-
-#include <config.h>
-#include <stdio.h>
-#include <assert.h>
-#include <stdlib.h>
-#include <ctype.h>
-#include <stdarg.h>
-#include "bcmath.h"
-#include "private.h"
-
-/* Storage used for special numbers. */
-bc_num _zero_;
-bc_num _one_;
-bc_num _two_;
-
- bc_num _bc_Free_list = NULL;
-
-/* new_num allocates a number and sets fields to known values. */
-
-bc_num
-bc_new_num (length, scale)
- int length, scale;
-{
- bc_num temp;
-
- /* PHP Change: malloc() -> emalloc(), removed free_list code */
- temp = (bc_num) emalloc (sizeof(bc_struct)+length+scale);
-#if 0
- if (_bc_Free_list != NULL) {
- temp = _bc_Free_list;
- _bc_Free_list = temp->n_next;
- } else {
- temp = (bc_num) emalloc (sizeof(bc_struct));
- if (temp == NULL) bc_out_of_memory ();
- }
-#endif
- temp->n_sign = PLUS;
- temp->n_len = length;
- temp->n_scale = scale;
- temp->n_refs = 1;
- /* PHP Change: malloc() -> emalloc() */
- temp->n_ptr = (char *) emalloc (length+scale);
- if (temp->n_ptr == NULL) bc_out_of_memory();
- temp->n_value = temp->n_ptr;
- memset (temp->n_ptr, 0, length+scale);
- return temp;
-}
-
-
-/* "Frees" a bc_num NUM. Actually decreases reference count and only
- frees the storage if reference count is zero. */
-
-void
-bc_free_num (num)
- bc_num *num;
-{
- if (*num == NULL) return;
- (*num)->n_refs--;
- if ((*num)->n_refs == 0) {
- if ((*num)->n_ptr)
- /* PHP Change: free() -> efree(), removed free_list code */
- efree ((*num)->n_ptr);
- efree(*num);
-#if 0
- (*num)->n_next = _bc_Free_list;
- _bc_Free_list = *num;
-#endif
- }
- *num = NULL;
-}
-
-
-/* Intitialize the number package! */
-
-void
-bc_init_numbers ()
-{
- _zero_ = bc_new_num (1,0);
- _one_ = bc_new_num (1,0);
- _one_->n_value[0] = 1;
- _two_ = bc_new_num (1,0);
- _two_->n_value[0] = 2;
-}
-
-
-/* Make a copy of a number! Just increments the reference count! */
-
-bc_num
-bc_copy_num (num)
- bc_num num;
-{
- num->n_refs++;
- return num;
-}
-
-
-/* Initialize a number NUM by making it a copy of zero. */
-
-void
-bc_init_num (num)
- bc_num *num;
-{
- *num = bc_copy_num (_zero_);
-}
-
diff --git a/ext/bcmath/libbcmath/src/int2num.c b/ext/bcmath/libbcmath/src/int2num.c
deleted file mode 100644
index 34419c138f..0000000000
--- a/ext/bcmath/libbcmath/src/int2num.c
+++ /dev/null
@@ -1,84 +0,0 @@
-/* int2num.c: bcmath library file. */
-/*
- Copyright (C) 1991, 1992, 1993, 1994, 1997 Free Software Foundation, Inc.
- Copyright (C) 2000 Philip A. Nelson
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details. (COPYING.LIB)
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to:
-
- The Free Software Foundation, Inc.
- 59 Temple Place, Suite 330
- Boston, MA 02111-1307 USA.
-
- You may contact the author by:
- e-mail: philnelson@acm.org
- us-mail: Philip A. Nelson
- Computer Science Department, 9062
- Western Washington University
- Bellingham, WA 98226-9062
-
-*************************************************************************/
-
-#include <config.h>
-#include <stdio.h>
-#include <assert.h>
-#include <stdlib.h>
-#include <ctype.h>
-#include <stdarg.h>
-#include "bcmath.h"
-#include "private.h"
-
-
-/* Convert an integer VAL to a bc number NUM. */
-
-void
-bc_int2num (num, val)
- bc_num *num;
- int val;
-{
- char buffer[30];
- char *bptr, *vptr;
- int ix = 1;
- char neg = 0;
-
- /* Sign. */
- if (val < 0)
- {
- neg = 1;
- val = -val;
- }
-
- /* Get things going. */
- bptr = buffer;
- *bptr++ = val % BASE;
- val = val / BASE;
-
- /* Extract remaining digits. */
- while (val != 0)
- {
- *bptr++ = val % BASE;
- val = val / BASE;
- ix++; /* Count the digits. */
- }
-
- /* Make the number. */
- bc_free_num (num);
- *num = bc_new_num (ix, 0);
- if (neg) (*num)->n_sign = MINUS;
-
- /* Assign the digits. */
- vptr = (*num)->n_value;
- while (ix-- > 0)
- *vptr++ = *--bptr;
-}
-
diff --git a/ext/bcmath/libbcmath/src/nearzero.c b/ext/bcmath/libbcmath/src/nearzero.c
deleted file mode 100644
index ae16b65d8a..0000000000
--- a/ext/bcmath/libbcmath/src/nearzero.c
+++ /dev/null
@@ -1,69 +0,0 @@
-/* nearzero.c: bcmath library file. */
-/*
- Copyright (C) 1991, 1992, 1993, 1994, 1997 Free Software Foundation, Inc.
- Copyright (C) 2000 Philip A. Nelson
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details. (COPYING.LIB)
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to:
-
- The Free Software Foundation, Inc.
- 59 Temple Place, Suite 330
- Boston, MA 02111-1307 USA.
-
- You may contact the author by:
- e-mail: philnelson@acm.org
- us-mail: Philip A. Nelson
- Computer Science Department, 9062
- Western Washington University
- Bellingham, WA 98226-9062
-
-*************************************************************************/
-
-#include <config.h>
-#include <stdio.h>
-#include <assert.h>
-#include <stdlib.h>
-#include <ctype.h>
-#include <stdarg.h>
-#include "bcmath.h"
-#include "private.h"
-
-/* In some places we need to check if the number NUM is almost zero.
- Specifically, all but the last digit is 0 and the last digit is 1.
- Last digit is defined by scale. */
-
-char
-bc_is_near_zero (num, scale)
- bc_num num;
- int scale;
-{
- int count;
- char *nptr;
-
- /* Error checking */
- if (scale > num->n_scale)
- scale = num->n_scale;
-
- /* Initialize */
- count = num->n_len + scale;
- nptr = num->n_value;
-
- /* The check */
- while ((count > 0) && (*nptr++ == 0)) count--;
-
- if (count != 0 && (count != 1 || *--nptr != 1))
- return FALSE;
- else
- return TRUE;
-}
-
diff --git a/ext/bcmath/libbcmath/src/neg.c b/ext/bcmath/libbcmath/src/neg.c
deleted file mode 100644
index c864d77f1d..0000000000
--- a/ext/bcmath/libbcmath/src/neg.c
+++ /dev/null
@@ -1,49 +0,0 @@
-/* neg.c: bcmath library file. */
-/*
- Copyright (C) 1991, 1992, 1993, 1994, 1997 Free Software Foundation, Inc.
- Copyright (C) 2000 Philip A. Nelson
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details. (COPYING.LIB)
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to:
-
- The Free Software Foundation, Inc.
- 59 Temple Place, Suite 330
- Boston, MA 02111-1307 USA.
-
- You may contact the author by:
- e-mail: philnelson@acm.org
- us-mail: Philip A. Nelson
- Computer Science Department, 9062
- Western Washington University
- Bellingham, WA 98226-9062
-
-*************************************************************************/
-
-#include <config.h>
-#include <stdio.h>
-#include <assert.h>
-#include <stdlib.h>
-#include <ctype.h>
-#include <stdarg.h>
-#include "bcmath.h"
-#include "private.h"
-
-/* In some places we need to check if the number is negative. */
-
-char
-bc_is_neg (num)
- bc_num num;
-{
- return num->n_sign == MINUS;
-}
-
diff --git a/ext/bcmath/libbcmath/src/num2long.c b/ext/bcmath/libbcmath/src/num2long.c
deleted file mode 100644
index 0a6e0836ad..0000000000
--- a/ext/bcmath/libbcmath/src/num2long.c
+++ /dev/null
@@ -1,70 +0,0 @@
-/* num2long.c: bcmath library file. */
-/*
- Copyright (C) 1991, 1992, 1993, 1994, 1997 Free Software Foundation, Inc.
- Copyright (C) 2000 Philip A. Nelson
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details. (COPYING.LIB)
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to:
-
- The Free Software Foundation, Inc.
- 59 Temple Place, Suite 330
- Boston, MA 02111-1307 USA.
-
- You may contact the author by:
- e-mail: philnelson@acm.org
- us-mail: Philip A. Nelson
- Computer Science Department, 9062
- Western Washington University
- Bellingham, WA 98226-9062
-
-*************************************************************************/
-
-#include <config.h>
-#include <stdio.h>
-#include <assert.h>
-#include <stdlib.h>
-#include <ctype.h>
-#include <stdarg.h>
-#include "bcmath.h"
-#include "private.h"
-
-/* Convert a number NUM to a long. The function returns only the integer
- part of the number. For numbers that are too large to represent as
- a long, this function returns a zero. This can be detected by checking
- the NUM for zero after having a zero returned. */
-
-long
-bc_num2long (num)
- bc_num num;
-{
- long val;
- char *nptr;
- int index;
-
- /* Extract the int value, ignore the fraction. */
- val = 0;
- nptr = num->n_value;
- for (index=num->n_len; (index>0) && (val<=(LONG_MAX/BASE)); index--)
- val = val*BASE + *nptr++;
-
- /* Check for overflow. If overflow, return zero. */
- if (index>0) val = 0;
- if (val < 0) val = 0;
-
- /* Return the value. */
- if (num->n_sign == PLUS)
- return (val);
- else
- return (-val);
-}
-
diff --git a/ext/bcmath/libbcmath/src/num2str.c b/ext/bcmath/libbcmath/src/num2str.c
deleted file mode 100644
index c47ec9bbad..0000000000
--- a/ext/bcmath/libbcmath/src/num2str.c
+++ /dev/null
@@ -1,79 +0,0 @@
-/* num2str.c: bcmath library file. */
-/*
- Copyright (C) 1991, 1992, 1993, 1994, 1997 Free Software Foundation, Inc.
- Copyright (C) 2000 Philip A. Nelson
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details. (COPYING.LIB)
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to:
-
- The Free Software Foundation, Inc.
- 59 Temple Place, Suite 330
- Boston, MA 02111-1307 USA.
-
- You may contact the author by:
- e-mail: philnelson@acm.org
- us-mail: Philip A. Nelson
- Computer Science Department, 9062
- Western Washington University
- Bellingham, WA 98226-9062
-
-*************************************************************************/
-
-#include <config.h>
-#include <stdio.h>
-#include <assert.h>
-#include <stdlib.h>
-#include <ctype.h>
-#include <stdarg.h>
-#include "bcmath.h"
-#include "private.h"
-
-/* Convert a numbers to a string. Base 10 only.*/
-
-char
-*bc_num2str (num)
- bc_num num;
-{
- char *str, *sptr;
- char *nptr;
- int index, signch;
-
- /* Allocate the string memory. */
- signch = ( num->n_sign == PLUS ? 0 : 1 ); /* Number of sign chars. */
- if (num->n_scale > 0)
- str = (char *) emalloc (num->n_len + num->n_scale + 2 + signch);
- else
- str = (char *) emalloc (num->n_len + 1 + signch);
- if (str == NULL) bc_out_of_memory();
-
- /* The negative sign if needed. */
- sptr = str;
- if (signch) *sptr++ = '-';
-
- /* Load the whole number. */
- nptr = num->n_value;
- for (index=num->n_len; index>0; index--)
- *sptr++ = BCD_CHAR(*nptr++);
-
- /* Now the fraction. */
- if (num->n_scale > 0)
- {
- *sptr++ = '.';
- for (index=0; index<num->n_scale; index++)
- *sptr++ = BCD_CHAR(*nptr++);
- }
-
- /* Terminate the string and return it! */
- *sptr = '\0';
- return (str);
-}
diff --git a/ext/bcmath/libbcmath/src/outofmem.c b/ext/bcmath/libbcmath/src/outofmem.c
deleted file mode 100644
index 799a32d2ae..0000000000
--- a/ext/bcmath/libbcmath/src/outofmem.c
+++ /dev/null
@@ -1,46 +0,0 @@
-/* outofmem.c: bcmath library file. */
-/*
- Copyright (C) 1991, 1992, 1993, 1994, 1997 Free Software Foundation, Inc.
- Copyright (C) 2000 Philip A. Nelson
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details. (COPYING.LIB)
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to:
-
- The Free Software Foundation, Inc.
- 59 Temple Place, Suite 330
- Boston, MA 02111-1307 USA.
-
- You may contact the author by:
- e-mail: philnelson@acm.org
- us-mail: Philip A. Nelson
- Computer Science Department, 9062
- Western Washington University
- Bellingham, WA 98226-9062
-
-*************************************************************************/
-
-#include <config.h>
-#include <stdio.h>
-#include <assert.h>
-#include <stdlib.h>
-#include <ctype.h>
-#include <stdarg.h>
-#include "bcmath.h"
-#include "private.h"
-
-
-void bc_out_of_memory (void)
-{
- (void) fprintf (stderr, "bcmath: out of memory!\n");
- exit (1);
-}
diff --git a/ext/bcmath/libbcmath/src/output.c b/ext/bcmath/libbcmath/src/output.c
deleted file mode 100644
index e41479d2d3..0000000000
--- a/ext/bcmath/libbcmath/src/output.c
+++ /dev/null
@@ -1,212 +0,0 @@
-/* output.c: bcmath library file. */
-/*
- Copyright (C) 1991, 1992, 1993, 1994, 1997 Free Software Foundation, Inc.
- Copyright (C) 2000 Philip A. Nelson
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details. (COPYING.LIB)
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to:
-
- The Free Software Foundation, Inc.
- 59 Temple Place, Suite 330
- Boston, MA 02111-1307 USA.
-
- You may contact the author by:
- e-mail: philnelson@acm.org
- us-mail: Philip A. Nelson
- Computer Science Department, 9062
- Western Washington University
- Bellingham, WA 98226-9062
-
-*************************************************************************/
-
-#include <config.h>
-#include <stdio.h>
-#include <assert.h>
-#include <stdlib.h>
-#include <ctype.h>
-#include <stdarg.h>
-#include "bcmath.h"
-#include "private.h"
-
-
-/* The following routines provide output for bcd numbers package
- using the rules of POSIX bc for output. */
-
-/* This structure is used for saving digits in the conversion process. */
-typedef struct stk_rec {
- long digit;
- struct stk_rec *next;
-} stk_rec;
-
-/* The reference string for digits. */
-static char ref_str[] = "0123456789ABCDEF";
-
-
-/* A special output routine for "multi-character digits." Exactly
- SIZE characters must be output for the value VAL. If SPACE is
- non-zero, we must output one space before the number. OUT_CHAR
- is the actual routine for writing the characters. */
-
-void
-bc_out_long (val, size, space, out_char)
- long val;
- int size, space;
-#ifdef __STDC__
- void (*out_char)(int);
-#else
- void (*out_char)();
-#endif
-{
- char digits[40];
- int len, ix;
-
- if (space) (*out_char) (' ');
- sprintf (digits, "%ld", val);
- len = strlen (digits);
- while (size > len)
- {
- (*out_char) ('0');
- size--;
- }
- for (ix=0; ix < len; ix++)
- (*out_char) (digits[ix]);
-}
-
-/* Output of a bcd number. NUM is written in base O_BASE using OUT_CHAR
- as the routine to do the actual output of the characters. */
-
-void
-bc_out_num (num, o_base, out_char, leading_zero)
- bc_num num;
- int o_base;
-#ifdef __STDC__
- void (*out_char)(int);
-#else
- void (*out_char)();
-#endif
- int leading_zero;
-{
- char *nptr;
- int index, fdigit, pre_space;
- stk_rec *digits, *temp;
- bc_num int_part, frac_part, base, cur_dig, t_num, max_o_digit;
-
- /* The negative sign if needed. */
- if (num->n_sign == MINUS) (*out_char) ('-');
-
- /* Output the number. */
- if (bc_is_zero (num))
- (*out_char) ('0');
- else
- if (o_base == 10)
- {
- /* The number is in base 10, do it the fast way. */
- nptr = num->n_value;
- if (num->n_len > 1 || *nptr != 0)
- for (index=num->n_len; index>0; index--)
- (*out_char) (BCD_CHAR(*nptr++));
- else
- nptr++;
-
- if (leading_zero && bc_is_zero (num))
- (*out_char) ('0');
-
- /* Now the fraction. */
- if (num->n_scale > 0)
- {
- (*out_char) ('.');
- for (index=0; index<num->n_scale; index++)
- (*out_char) (BCD_CHAR(*nptr++));
- }
- }
- else
- {
- /* special case ... */
- if (leading_zero && bc_is_zero (num))
- (*out_char) ('0');
-
- /* The number is some other base. */
- digits = NULL;
- bc_init_num (&int_part);
- bc_divide (num, _one_, &int_part, 0);
- bc_init_num (&frac_part);
- bc_init_num (&cur_dig);
- bc_init_num (&base);
- bc_sub (num, int_part, &frac_part, 0);
- /* Make the INT_PART and FRAC_PART positive. */
- int_part->n_sign = PLUS;
- frac_part->n_sign = PLUS;
- bc_int2num (&base, o_base);
- bc_init_num (&max_o_digit);
- bc_int2num (&max_o_digit, o_base-1);
-
-
- /* Get the digits of the integer part and push them on a stack. */
- while (!bc_is_zero (int_part))
- {
- bc_modulo (int_part, base, &cur_dig, 0);
- /* PHP Change: malloc() -> emalloc() */
- temp = (stk_rec *) emalloc (sizeof(stk_rec));
- if (temp == NULL) bc_out_of_memory();
- temp->digit = bc_num2long (cur_dig);
- temp->next = digits;
- digits = temp;
- bc_divide (int_part, base, &int_part, 0);
- }
-
- /* Print the digits on the stack. */
- if (digits != NULL)
- {
- /* Output the digits. */
- while (digits != NULL)
- {
- temp = digits;
- digits = digits->next;
- if (o_base <= 16)
- (*out_char) (ref_str[ (int) temp->digit]);
- else
- bc_out_long (temp->digit, max_o_digit->n_len, 1, out_char);
- efree (temp);
- }
- }
-
- /* Get and print the digits of the fraction part. */
- if (num->n_scale > 0)
- {
- (*out_char) ('.');
- pre_space = 0;
- t_num = bc_copy_num (_one_);
- while (t_num->n_len <= num->n_scale) {
- bc_multiply (frac_part, base, &frac_part, num->n_scale);
- fdigit = bc_num2long (frac_part);
- bc_int2num (&int_part, fdigit);
- bc_sub (frac_part, int_part, &frac_part, 0);
- if (o_base <= 16)
- (*out_char) (ref_str[fdigit]);
- else {
- bc_out_long (fdigit, max_o_digit->n_len, pre_space, out_char);
- pre_space = 1;
- }
- bc_multiply (t_num, base, &t_num, 0);
- }
- bc_free_num (&t_num);
- }
-
- /* Clean up. */
- bc_free_num (&int_part);
- bc_free_num (&frac_part);
- bc_free_num (&base);
- bc_free_num (&cur_dig);
- bc_free_num (&max_o_digit);
- }
-}
diff --git a/ext/bcmath/libbcmath/src/private.h b/ext/bcmath/libbcmath/src/private.h
deleted file mode 100644
index eaf4f444b2..0000000000
--- a/ext/bcmath/libbcmath/src/private.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/* private.h: bcmath library header. */
-/*
- Copyright (C) 1991, 1992, 1993, 1994, 1997 Free Software Foundation, Inc.
- Copyright (C) 2000 Philip A. Nelson
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details. (COPYING.LIB)
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to:
-
- The Free Software Foundation, Inc.
- 59 Temple Place, Suite 330
- Boston, MA 02111-1307 USA.
-
- You may contact the author by:
- e-mail: philnelson@acm.org
- us-mail: Philip A. Nelson
- Computer Science Department, 9062
- Western Washington University
- Bellingham, WA 98226-9062
-
-*************************************************************************/
-
-/* "Private" routines to bcmath. */
-
-/* variables */
-bc_num _bc_Free_list;
-
-/* routines */
-int _bc_do_compare (bc_num n1, bc_num n2, int use_sign, int ignore_last);
-bc_num _bc_do_add (bc_num n1, bc_num n2, int scale_min);
-bc_num _bc_do_sub (bc_num n1, bc_num n2, int scale_min);
-void _bc_rm_leading_zeros (bc_num num);
diff --git a/ext/bcmath/libbcmath/src/raise.c b/ext/bcmath/libbcmath/src/raise.c
deleted file mode 100644
index 5f2f03c208..0000000000
--- a/ext/bcmath/libbcmath/src/raise.c
+++ /dev/null
@@ -1,126 +0,0 @@
-/* raise.c: bcmath library file. */
-/*
- Copyright (C) 1991, 1992, 1993, 1994, 1997 Free Software Foundation, Inc.
- Copyright (C) 2000 Philip A. Nelson
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details. (COPYING.LIB)
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to:
-
- The Free Software Foundation, Inc.
- 59 Temple Place, Suite 330
- Boston, MA 02111-1307 USA.
-
- You may contact the author by:
- e-mail: philnelson@acm.org
- us-mail: Philip A. Nelson
- Computer Science Department, 9062
- Western Washington University
- Bellingham, WA 98226-9062
-
-*************************************************************************/
-
-#include <config.h>
-#include <stdio.h>
-#include <assert.h>
-#include <stdlib.h>
-#include <ctype.h>
-#include <stdarg.h>
-#include "bcmath.h"
-#include "private.h"
-
-
-/* Raise NUM1 to the NUM2 power. The result is placed in RESULT.
- Maximum exponent is LONG_MAX. If a NUM2 is not an integer,
- only the integer part is used. */
-
-void
-bc_raise (num1, num2, result, scale)
- bc_num num1, num2, *result;
- int scale;
-{
- bc_num temp, power;
- long exponent;
- int rscale;
- int pwrscale;
- int calcscale;
- char neg;
-
- /* Check the exponent for scale digits and convert to a long. */
- if (num2->n_scale != 0)
- bc_rt_warn ("non-zero scale in exponent");
- exponent = bc_num2long (num2);
- if (exponent == 0 && (num2->n_len > 1 || num2->n_value[0] != 0))
- bc_rt_error ("exponent too large in raise");
-
- /* Special case if exponent is a zero. */
- if (exponent == 0)
- {
- bc_free_num (result);
- *result = bc_copy_num (_one_);
- return;
- }
-
- /* Other initializations. */
- if (exponent < 0)
- {
- neg = TRUE;
- exponent = -exponent;
- rscale = scale;
- }
- else
- {
- neg = FALSE;
- rscale = MIN (num1->n_scale*exponent, MAX(scale, num1->n_scale));
- }
-
- /* Set initial value of temp. */
- power = bc_copy_num (num1);
- pwrscale = num1->n_scale;
- while ((exponent & 1) == 0)
- {
- pwrscale = 2*pwrscale;
- bc_multiply (power, power, &power, pwrscale);
- exponent = exponent >> 1;
- }
- temp = bc_copy_num (power);
- calcscale = pwrscale;
- exponent = exponent >> 1;
-
- /* Do the calculation. */
- while (exponent > 0)
- {
- pwrscale = 2*pwrscale;
- bc_multiply (power, power, &power, pwrscale);
- if ((exponent & 1) == 1) {
- calcscale = pwrscale + calcscale;
- bc_multiply (temp, power, &temp, calcscale);
- }
- exponent = exponent >> 1;
- }
-
- /* Assign the value. */
- if (neg)
- {
- bc_divide (_one_, temp, result, rscale);
- bc_free_num (&temp);
- }
- else
- {
- bc_free_num (result);
- *result = temp;
- if ((*result)->n_scale > rscale)
- (*result)->n_scale = rscale;
- }
- bc_free_num (&power);
-}
-
diff --git a/ext/bcmath/libbcmath/src/raisemod.c b/ext/bcmath/libbcmath/src/raisemod.c
deleted file mode 100644
index cc9dd35a57..0000000000
--- a/ext/bcmath/libbcmath/src/raisemod.c
+++ /dev/null
@@ -1,99 +0,0 @@
-/* raisemod.c: bcmath library file. */
-/*
- Copyright (C) 1991, 1992, 1993, 1994, 1997 Free Software Foundation, Inc.
- Copyright (C) 2000 Philip A. Nelson
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details. (COPYING.LIB)
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to:
-
- The Free Software Foundation, Inc.
- 59 Temple Place, Suite 330
- Boston, MA 02111-1307 USA.
-
- You may contact the author by:
- e-mail: philnelson@acm.org
- us-mail: Philip A. Nelson
- Computer Science Department, 9062
- Western Washington University
- Bellingham, WA 98226-9062
-
-*************************************************************************/
-
-#include <config.h>
-#include <stdio.h>
-#include <assert.h>
-#include <stdlib.h>
-#include <ctype.h>
-#include <stdarg.h>
-#include "bcmath.h"
-#include "private.h"
-
-/* Raise BASE to the EXPO power, reduced modulo MOD. The result is
- placed in RESULT. If a EXPO is not an integer,
- only the integer part is used. */
-
-int
-bc_raisemod (base, expo, mod, result, scale)
- bc_num base, expo, mod, *result;
- int scale;
-{
- bc_num power, exponent, parity, temp;
- int rscale;
-
- /* Check for correct numbers. */
- if (bc_is_zero(mod)) return -1;
- if (bc_is_neg(expo)) return -1;
-
- /* Set initial values. */
- power = bc_copy_num (base);
- exponent = bc_copy_num (expo);
- temp = bc_copy_num (_one_);
- bc_init_num(&parity);
-
- /* Check the base for scale digits. */
- if (base->n_scale != 0)
- bc_rt_warn ("non-zero scale in base");
-
- /* Check the exponent for scale digits. */
- if (exponent->n_scale != 0)
- {
- bc_rt_warn ("non-zero scale in exponent");
- bc_divide (exponent, _one_, &exponent, 0); /*truncate */
- }
-
- /* Check the modulus for scale digits. */
- if (mod->n_scale != 0)
- bc_rt_warn ("non-zero scale in modulus");
-
- /* Do the calculation. */
- rscale = MAX(scale, base->n_scale);
- while ( !bc_is_zero(exponent) )
- {
- (void) bc_divmod (exponent, _two_, &exponent, &parity, 0);
- if ( !bc_is_zero(parity) )
- {
- bc_multiply (temp, power, &temp, rscale);
- (void) bc_modulo (temp, mod, &temp, scale);
- }
-
- bc_multiply (power, power, &power, rscale);
- (void) bc_modulo (power, mod, &power, scale);
- }
-
- /* Assign the value. */
- bc_free_num (&power);
- bc_free_num (&exponent);
- bc_free_num (result);
- *result = temp;
- return 0; /* Everything is OK. */
-}
diff --git a/ext/bcmath/libbcmath/src/recmul.c b/ext/bcmath/libbcmath/src/recmul.c
deleted file mode 100644
index 73f67af574..0000000000
--- a/ext/bcmath/libbcmath/src/recmul.c
+++ /dev/null
@@ -1,304 +0,0 @@
-/* recmul.c: bcmath library file. */
-/*
- Copyright (C) 1991, 1992, 1993, 1994, 1997 Free Software Foundation, Inc.
- Copyright (C) 2000 Philip A. Nelson
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details. (COPYING.LIB)
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to:
-
- The Free Software Foundation, Inc.
- 59 Temple Place, Suite 330
- Boston, MA 02111-1307 USA.
-
- You may contact the author by:
- e-mail: philnelson@acm.org
- us-mail: Philip A. Nelson
- Computer Science Department, 9062
- Western Washington University
- Bellingham, WA 98226-9062
-
-*************************************************************************/
-
-#include <config.h>
-#include <stdio.h>
-#include <assert.h>
-#include <stdlib.h>
-#include <ctype.h>
-#include <stdarg.h>
-#include "bcmath.h"
-#include "private.h"
-
-/* Recursive vs non-recursive multiply crossover ranges. */
-#if defined(MULDIGITS)
-#include "muldigits.h"
-#else
-#define MUL_BASE_DIGITS 80
-#endif
-
-int mul_base_digits = MUL_BASE_DIGITS;
-#define MUL_SMALL_DIGITS mul_base_digits/4
-
-/* Multiply utility routines */
-
-static bc_num
-new_sub_num (length, scale, value)
- int length, scale;
- char *value;
-{
- bc_num temp;
-
- if (_bc_Free_list != NULL) {
- temp = _bc_Free_list;
- _bc_Free_list = temp->n_next;
- } else {
- temp = (bc_num) emalloc (sizeof(bc_struct));
- if (temp == NULL) bc_out_of_memory ();
- }
- temp->n_sign = PLUS;
- temp->n_len = length;
- temp->n_scale = scale;
- temp->n_refs = 1;
- temp->n_ptr = NULL;
- temp->n_value = value;
- return temp;
-}
-
-static void
-_bc_simp_mul (bc_num n1, int n1len, bc_num n2, int n2len, bc_num *prod,
- int full_scale)
-{
- char *n1ptr, *n2ptr, *pvptr;
- char *n1end, *n2end; /* To the end of n1 and n2. */
- int indx, sum, prodlen;
-
- prodlen = n1len+n2len+1;
-
- *prod = bc_new_num (prodlen, 0);
-
- n1end = (char *) (n1->n_value + n1len - 1);
- n2end = (char *) (n2->n_value + n2len - 1);
- pvptr = (char *) ((*prod)->n_value + prodlen - 1);
- sum = 0;
-
- /* Here is the loop... */
- for (indx = 0; indx < prodlen-1; indx++)
- {
- n1ptr = (char *) (n1end - MAX(0, indx-n2len+1));
- n2ptr = (char *) (n2end - MIN(indx, n2len-1));
- while ((n1ptr >= n1->n_value) && (n2ptr <= n2end))
- sum += *n1ptr-- * *n2ptr++;
- *pvptr-- = sum % BASE;
- sum = sum / BASE;
- }
- *pvptr = sum;
-}
-
-
-/* A special adder/subtractor for the recursive divide and conquer
- multiply algorithm. Note: if sub is called, accum must
- be larger that what is being subtracted. Also, accum and val
- must have n_scale = 0. (e.g. they must look like integers. *) */
-static void
-_bc_shift_addsub (bc_num accum, bc_num val, int shift, int sub)
-{
- signed char *accp, *valp;
- int count, carry;
-
- count = val->n_len;
- if (val->n_value[0] == 0)
- count--;
- assert (accum->n_len+accum->n_scale >= shift+count);
-
- /* Set up pointers and others */
- accp = (signed char *)(accum->n_value +
- accum->n_len + accum->n_scale - shift - 1);
- valp = (signed char *)(val->n_value + val->n_len - 1);
- carry = 0;
-
- if (sub) {
- /* Subtraction, carry is really borrow. */
- while (count--) {
- *accp -= *valp-- + carry;
- if (*accp < 0) {
- carry = 1;
- *accp-- += BASE;
- } else {
- carry = 0;
- accp--;
- }
- }
- while (carry) {
- *accp -= carry;
- if (*accp < 0)
- *accp-- += BASE;
- else
- carry = 0;
- }
- } else {
- /* Addition */
- while (count--) {
- *accp += *valp-- + carry;
- if (*accp > (BASE-1)) {
- carry = 1;
- *accp-- -= BASE;
- } else {
- carry = 0;
- accp--;
- }
- }
- while (carry) {
- *accp += carry;
- if (*accp > (BASE-1))
- *accp-- -= BASE;
- else
- carry = 0;
- }
- }
-}
-
-/* Recursive divide and conquer multiply algorithm.
- Based on
- Let u = u0 + u1*(b^n)
- Let v = v0 + v1*(b^n)
- Then uv = (B^2n+B^n)*u1*v1 + B^n*(u1-u0)*(v0-v1) + (B^n+1)*u0*v0
-
- B is the base of storage, number of digits in u1,u0 close to equal.
-*/
-static void
-_bc_rec_mul (bc_num u, int ulen, bc_num v, int vlen, bc_num *prod,
- int full_scale)
-{
- bc_num u0, u1, v0, v1;
- int u0len, v0len;
- bc_num m1, m2, m3, d1, d2;
- int n, prodlen, m1zero;
- int d1len, d2len;
-
- /* Base case? */
- if ((ulen+vlen) < mul_base_digits
- || ulen < MUL_SMALL_DIGITS
- || vlen < MUL_SMALL_DIGITS ) {
- _bc_simp_mul (u, ulen, v, vlen, prod, full_scale);
- return;
- }
-
- /* Calculate n -- the u and v split point in digits. */
- n = (MAX(ulen, vlen)+1) / 2;
-
- /* Split u and v. */
- if (ulen < n) {
- u1 = bc_copy_num (_zero_);
- u0 = new_sub_num (ulen,0, u->n_value);
- } else {
- u1 = new_sub_num (ulen-n, 0, u->n_value);
- u0 = new_sub_num (n, 0, u->n_value+ulen-n);
- }
- if (vlen < n) {
- v1 = bc_copy_num (_zero_);
- v0 = new_sub_num (vlen,0, v->n_value);
- } else {
- v1 = new_sub_num (vlen-n, 0, v->n_value);
- v0 = new_sub_num (n, 0, v->n_value+vlen-n);
- }
- _bc_rm_leading_zeros (u1);
- _bc_rm_leading_zeros (u0);
- u0len = u0->n_len;
- _bc_rm_leading_zeros (v1);
- _bc_rm_leading_zeros (v0);
- v0len = v0->n_len;
-
- m1zero = bc_is_zero(u1) || bc_is_zero(v1);
-
- /* Calculate sub results ... */
-
- bc_init_num(&d1);
- bc_init_num(&d2);
- bc_sub (u1, u0, &d1, 0);
- d1len = d1->n_len;
- bc_sub (v0, v1, &d2, 0);
- d2len = d2->n_len;
-
-
- /* Do recursive multiplies and shifted adds. */
- if (m1zero)
- m1 = bc_copy_num (_zero_);
- else
- _bc_rec_mul (u1, u1->n_len, v1, v1->n_len, &m1, 0);
-
- if (bc_is_zero(d1) || bc_is_zero(d2))
- m2 = bc_copy_num (_zero_);
- else
- _bc_rec_mul (d1, d1len, d2, d2len, &m2, 0);
-
- if (bc_is_zero(u0) || bc_is_zero(v0))
- m3 = bc_copy_num (_zero_);
- else
- _bc_rec_mul (u0, u0->n_len, v0, v0->n_len, &m3, 0);
-
- /* Initialize product */
- prodlen = ulen+vlen+1;
- *prod = bc_new_num(prodlen, 0);
-
- if (!m1zero) {
- _bc_shift_addsub (*prod, m1, 2*n, 0);
- _bc_shift_addsub (*prod, m1, n, 0);
- }
- _bc_shift_addsub (*prod, m3, n, 0);
- _bc_shift_addsub (*prod, m3, 0, 0);
- _bc_shift_addsub (*prod, m2, n, d1->n_sign != d2->n_sign);
-
- /* Now clean up! */
- bc_free_num (&u1);
- bc_free_num (&u0);
- bc_free_num (&v1);
- bc_free_num (&m1);
- bc_free_num (&v0);
- bc_free_num (&m2);
- bc_free_num (&m3);
- bc_free_num (&d1);
- bc_free_num (&d2);
-}
-
-/* The multiply routine. N2 times N1 is put int PROD with the scale of
- the result being MIN(N2 scale+N1 scale, MAX (SCALE, N2 scale, N1 scale)).
- */
-
-void
-bc_multiply (n1, n2, prod, scale)
- bc_num n1, n2, *prod;
- int scale;
-{
- bc_num pval;
- int len1, len2;
- int full_scale, prod_scale;
-
- /* Initialize things. */
- len1 = n1->n_len + n1->n_scale;
- len2 = n2->n_len + n2->n_scale;
- full_scale = n1->n_scale + n2->n_scale;
- prod_scale = MIN(full_scale,MAX(scale,MAX(n1->n_scale,n2->n_scale)));
-
- /* Do the multiply */
- _bc_rec_mul (n1, len1, n2, len2, &pval, full_scale);
-
- /* Assign to prod and clean up the number. */
- pval->n_sign = ( n1->n_sign == n2->n_sign ? PLUS : MINUS );
- pval->n_value = pval->n_ptr;
- pval->n_len = len2 + len1 + 1 - full_scale;
- pval->n_scale = prod_scale;
- _bc_rm_leading_zeros (pval);
- if (bc_is_zero (pval))
- pval->n_sign = PLUS;
- bc_free_num (prod);
- *prod = pval;
-}
diff --git a/ext/bcmath/libbcmath/src/rmzero.c b/ext/bcmath/libbcmath/src/rmzero.c
deleted file mode 100644
index 63f7a0cb79..0000000000
--- a/ext/bcmath/libbcmath/src/rmzero.c
+++ /dev/null
@@ -1,55 +0,0 @@
-/* rmzero.c: bcmath library file. */
-/*
- Copyright (C) 1991, 1992, 1993, 1994, 1997 Free Software Foundation, Inc.
- Copyright (C) 2000 Philip A. Nelson
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details. (COPYING.LIB)
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to:
-
- The Free Software Foundation, Inc.
- 59 Temple Place, Suite 330
- Boston, MA 02111-1307 USA.
-
- You may contact the author by:
- e-mail: philnelson@acm.org
- us-mail: Philip A. Nelson
- Computer Science Department, 9062
- Western Washington University
- Bellingham, WA 98226-9062
-
-*************************************************************************/
-
-#include <config.h>
-#include <stdio.h>
-#include <assert.h>
-#include <stdlib.h>
-#include <ctype.h>
-#include <stdarg.h>
-#include "bcmath.h"
-#include "private.h"
-
-/* For many things, we may have leading zeros in a number NUM.
- _bc_rm_leading_zeros just moves the data "value" pointer to the
- correct place and adjusts the length. */
-
- void
-_bc_rm_leading_zeros (num)
- bc_num num;
-{
- /* We can move n_value to point to the first non zero digit! */
- while (*num->n_value == 0 && num->n_len > 1) {
- num->n_value++;
- num->n_len--;
- }
-}
-
diff --git a/ext/bcmath/libbcmath/src/rt.c b/ext/bcmath/libbcmath/src/rt.c
deleted file mode 100644
index 2479104fe4..0000000000
--- a/ext/bcmath/libbcmath/src/rt.c
+++ /dev/null
@@ -1,65 +0,0 @@
-/* rt.c: bcmath library file. */
-/*
- Copyright (C) 1991, 1992, 1993, 1994, 1997 Free Software Foundation, Inc.
- Copyright (C) 2000 Philip A. Nelson
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details. (COPYING.LIB)
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to:
-
- The Free Software Foundation, Inc.
- 59 Temple Place, Suite 330
- Boston, MA 02111-1307 USA.
-
- You may contact the author by:
- e-mail: philnelson@acm.org
- us-mail: Philip A. Nelson
- Computer Science Department, 9062
- Western Washington University
- Bellingham, WA 98226-9062
-
-*************************************************************************/
-
-#include <config.h>
-#include <stdio.h>
-#include <assert.h>
-#include <stdlib.h>
-#include <ctype.h>
-#include <stdarg.h>
-#include "bcmath.h"
-#include "private.h"
-
-
-void bc_rt_warn (char *mesg ,...)
-{
- va_list args;
- char error_mesg [255];
-
- va_start (args, mesg);
- vsprintf (error_mesg, mesg, args);
- va_end (args);
-
- fprintf (stderr, "bc math warning: %s\n", error_mesg);
-}
-
-
-void bc_rt_error (char *mesg ,...)
-{
- va_list args;
- char error_mesg [255];
-
- va_start (args, mesg);
- vsprintf (error_mesg, mesg, args);
- va_end (args);
-
- fprintf (stderr, "bc math error: %s\n", error_mesg);
-}
diff --git a/ext/bcmath/libbcmath/src/sqrt.c b/ext/bcmath/libbcmath/src/sqrt.c
deleted file mode 100644
index 34b95b8898..0000000000
--- a/ext/bcmath/libbcmath/src/sqrt.c
+++ /dev/null
@@ -1,131 +0,0 @@
-/* sqrt.c: bcmath library file. */
-/*
- Copyright (C) 1991, 1992, 1993, 1994, 1997 Free Software Foundation, Inc.
- Copyright (C) 2000 Philip A. Nelson
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details. (COPYING.LIB)
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to:
-
- The Free Software Foundation, Inc.
- 59 Temple Place, Suite 330
- Boston, MA 02111-1307 USA.
-
- You may contact the author by:
- e-mail: philnelson@acm.org
- us-mail: Philip A. Nelson
- Computer Science Department, 9062
- Western Washington University
- Bellingham, WA 98226-9062
-
-*************************************************************************/
-
-#include <config.h>
-#include <stdio.h>
-#include <assert.h>
-#include <stdlib.h>
-#include <ctype.h>
-#include <stdarg.h>
-#include "bcmath.h"
-#include "private.h"
-
-/* Take the square root NUM and return it in NUM with SCALE digits
- after the decimal place. */
-
-int
-bc_sqrt (num, scale)
- bc_num *num;
- int scale;
-{
- int rscale, cmp_res, done;
- int cscale;
- bc_num guess, guess1, point5, diff;
-
- /* Initial checks. */
- cmp_res = bc_compare (*num, _zero_);
- if (cmp_res < 0)
- return 0; /* error */
- else
- {
- if (cmp_res == 0)
- {
- bc_free_num (num);
- *num = bc_copy_num (_zero_);
- return 1;
- }
- }
- cmp_res = bc_compare (*num, _one_);
- if (cmp_res == 0)
- {
- bc_free_num (num);
- *num = bc_copy_num (_one_);
- return 1;
- }
-
- /* Initialize the variables. */
- rscale = MAX (scale, (*num)->n_scale);
- bc_init_num(&guess);
- bc_init_num(&guess1);
- bc_init_num(&diff);
- point5 = bc_new_num (1,1);
- point5->n_value[1] = 5;
-
-
- /* Calculate the initial guess. */
- if (cmp_res < 0)
- {
- /* The number is between 0 and 1. Guess should start at 1. */
- guess = bc_copy_num (_one_);
- cscale = (*num)->n_scale;
- }
- else
- {
- /* The number is greater than 1. Guess should start at 10^(exp/2). */
- bc_int2num (&guess,10);
-
- bc_int2num (&guess1,(*num)->n_len);
- bc_multiply (guess1, point5, &guess1, 0);
- guess1->n_scale = 0;
- bc_raise (guess, guess1, &guess, 0);
- bc_free_num (&guess1);
- cscale = 3;
- }
-
- /* Find the square root using Newton's algorithm. */
- done = FALSE;
- while (!done)
- {
- bc_free_num (&guess1);
- guess1 = bc_copy_num (guess);
- bc_divide (*num, guess, &guess, cscale);
- bc_add (guess, guess1, &guess, 0);
- bc_multiply (guess, point5, &guess, cscale);
- bc_sub (guess, guess1, &diff, cscale+1);
- if (bc_is_near_zero (diff, cscale))
- {
- if (cscale < rscale+1)
- cscale = MIN (cscale*3, rscale+1);
- else
- done = TRUE;
- }
- }
-
- /* Assign the number and clean up. */
- bc_free_num (num);
- bc_divide (guess,_one_,num,rscale);
- bc_free_num (&guess);
- bc_free_num (&guess1);
- bc_free_num (&point5);
- bc_free_num (&diff);
- return 1;
-}
-
diff --git a/ext/bcmath/libbcmath/src/str2num.c b/ext/bcmath/libbcmath/src/str2num.c
deleted file mode 100644
index 210a7d89ea..0000000000
--- a/ext/bcmath/libbcmath/src/str2num.c
+++ /dev/null
@@ -1,112 +0,0 @@
-/* str2num.c: bcmath library file. */
-/*
- Copyright (C) 1991, 1992, 1993, 1994, 1997 Free Software Foundation, Inc.
- Copyright (C) 2000 Philip A. Nelson
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details. (COPYING.LIB)
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to:
-
- The Free Software Foundation, Inc.
- 59 Temple Place, Suite 330
- Boston, MA 02111-1307 USA.
-
- You may contact the author by:
- e-mail: philnelson@acm.org
- us-mail: Philip A. Nelson
- Computer Science Department, 9062
- Western Washington University
- Bellingham, WA 98226-9062
-
-*************************************************************************/
-
-#include <config.h>
-#include <stdio.h>
-#include <assert.h>
-#include <stdlib.h>
-#include <ctype.h>
-#include <stdarg.h>
-#include "bcmath.h"
-#include "private.h"
-
-/* Convert strings to bc numbers. Base 10 only.*/
-
-void
-bc_str2num (num, str, scale)
- bc_num *num;
- char *str;
- int scale;
-{
- int digits, strscale;
- char *ptr, *nptr;
- char zero_int;
-
- /* Prepare num. */
- bc_free_num (num);
-
- /* Check for valid number and count digits. */
- ptr = str;
- digits = 0;
- strscale = 0;
- zero_int = FALSE;
- if ( (*ptr == '+') || (*ptr == '-')) ptr++; /* Sign */
- while (*ptr == '0') ptr++; /* Skip leading zeros. */
- while (isdigit((int)*ptr)) ptr++, digits++; /* digits */
- if (*ptr == '.') ptr++; /* decimal point */
- while (isdigit((int)*ptr)) ptr++, strscale++; /* digits */
- if ((*ptr != '\0') || (digits+strscale == 0))
- {
- *num = bc_copy_num (_zero_);
- return;
- }
-
- /* Adjust numbers and allocate storage and initialize fields. */
- strscale = MIN(strscale, scale);
- if (digits == 0)
- {
- zero_int = TRUE;
- digits = 1;
- }
- *num = bc_new_num (digits, strscale);
-
- /* Build the whole number. */
- ptr = str;
- if (*ptr == '-')
- {
- (*num)->n_sign = MINUS;
- ptr++;
- }
- else
- {
- (*num)->n_sign = PLUS;
- if (*ptr == '+') ptr++;
- }
- while (*ptr == '0') ptr++; /* Skip leading zeros. */
- nptr = (*num)->n_value;
- if (zero_int)
- {
- *nptr++ = 0;
- digits = 0;
- }
- for (;digits > 0; digits--)
- *nptr++ = CH_VAL(*ptr++);
-
-
- /* Build the fractional part. */
- if (strscale > 0)
- {
- ptr++; /* skip the decimal point! */
- for (;strscale > 0; strscale--)
- *nptr++ = CH_VAL(*ptr++);
- }
-}
-
diff --git a/ext/bcmath/libbcmath/src/sub.c b/ext/bcmath/libbcmath/src/sub.c
deleted file mode 100644
index 2dd8eb5ecc..0000000000
--- a/ext/bcmath/libbcmath/src/sub.c
+++ /dev/null
@@ -1,90 +0,0 @@
-/* sub.c: bcmath library file. */
-/*
- Copyright (C) 1991, 1992, 1993, 1994, 1997 Free Software Foundation, Inc.
- Copyright (C) 2000 Philip A. Nelson
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details. (COPYING.LIB)
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to:
-
- The Free Software Foundation, Inc.
- 59 Temple Place, Suite 330
- Boston, MA 02111-1307 USA.
-
- You may contact the author by:
- e-mail: philnelson@acm.org
- us-mail: Philip A. Nelson
- Computer Science Department, 9062
- Western Washington University
- Bellingham, WA 98226-9062
-
-*************************************************************************/
-
-#include <config.h>
-#include <stdio.h>
-#include <assert.h>
-#include <stdlib.h>
-#include <ctype.h>
-#include <stdarg.h>
-#include "bcmath.h"
-#include "private.h"
-
-
-/* Here is the full subtract routine that takes care of negative numbers.
- N2 is subtracted from N1 and the result placed in RESULT. SCALE_MIN
- is the minimum scale for the result. */
-
-void
-bc_sub (n1, n2, result, scale_min)
- bc_num n1, n2, *result;
- int scale_min;
-{
- bc_num diff = NULL;
- int cmp_res;
- int res_scale;
-
- if (n1->n_sign != n2->n_sign)
- {
- diff = _bc_do_add (n1, n2, scale_min);
- diff->n_sign = n1->n_sign;
- }
- else
- {
- /* subtraction must be done. */
- /* Compare magnitudes. */
- cmp_res = _bc_do_compare (n1, n2, FALSE, FALSE);
- switch (cmp_res)
- {
- case -1:
- /* n1 is less than n2, subtract n1 from n2. */
- diff = _bc_do_sub (n2, n1, scale_min);
- diff->n_sign = (n2->n_sign == PLUS ? MINUS : PLUS);
- break;
- case 0:
- /* They are equal! return zero! */
- res_scale = MAX (scale_min, MAX(n1->n_scale, n2->n_scale));
- diff = bc_new_num (1, res_scale);
- memset (diff->n_value, 0, res_scale+1);
- break;
- case 1:
- /* n2 is less than n1, subtract n2 from n1. */
- diff = _bc_do_sub (n1, n2, scale_min);
- diff->n_sign = n1->n_sign;
- break;
- }
- }
-
- /* Clean up and return. */
- bc_free_num (result);
- *result = diff;
-}
-
diff --git a/ext/bcmath/libbcmath/src/zero.c b/ext/bcmath/libbcmath/src/zero.c
deleted file mode 100644
index dce77ba4aa..0000000000
--- a/ext/bcmath/libbcmath/src/zero.c
+++ /dev/null
@@ -1,65 +0,0 @@
-/* zero.c: bcmath library file. */
-/*
- Copyright (C) 1991, 1992, 1993, 1994, 1997 Free Software Foundation, Inc.
- Copyright (C) 2000 Philip A. Nelson
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details. (COPYING.LIB)
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to:
-
- The Free Software Foundation, Inc.
- 59 Temple Place, Suite 330
- Boston, MA 02111-1307 USA.
-
- You may contact the author by:
- e-mail: philnelson@acm.org
- us-mail: Philip A. Nelson
- Computer Science Department, 9062
- Western Washington University
- Bellingham, WA 98226-9062
-
-*************************************************************************/
-
-#include <config.h>
-#include <stdio.h>
-#include <assert.h>
-#include <stdlib.h>
-#include <ctype.h>
-#include <stdarg.h>
-#include "bcmath.h"
-#include "private.h"
-
-/* In some places we need to check if the number NUM is zero. */
-
-char
-bc_is_zero (num)
- bc_num num;
-{
- int count;
- char *nptr;
-
- /* Quick check. */
- if (num == _zero_) return TRUE;
-
- /* Initialize */
- count = num->n_len + num->n_scale;
- nptr = num->n_value;
-
- /* The check */
- while ((count > 0) && (*nptr++ == 0)) count--;
-
- if (count != 0)
- return FALSE;
- else
- return TRUE;
-}
-
diff --git a/ext/bcmath/php_bcmath.h b/ext/bcmath/php_bcmath.h
deleted file mode 100644
index d48de91d8e..0000000000
--- a/ext/bcmath/php_bcmath.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef PHP_BCMATH_H
-#define PHP_BCMATH_H
-
-#if WITH_BCMATH
-
-extern zend_module_entry bcmath_module_entry;
-#define phpext_bcmath_ptr &bcmath_module_entry
-
-PHP_MINIT_FUNCTION(bcmath);
-PHP_MSHUTDOWN_FUNCTION(bcmath);
-PHP_RINIT_FUNCTION(bcmath);
-PHP_MINFO_FUNCTION(bcmath);
-
-PHP_FUNCTION(bcadd);
-PHP_FUNCTION(bcsub);
-PHP_FUNCTION(bcmul);
-PHP_FUNCTION(bcdiv);
-PHP_FUNCTION(bcmod);
-PHP_FUNCTION(bcpow);
-PHP_FUNCTION(bcsqrt);
-PHP_FUNCTION(bccomp);
-PHP_FUNCTION(bcscale);
-
-#else
-
-#define phpext_bcmath_ptr NULL
-
-#endif
-
-#endif /* PHP_BCMATH_H */
diff --git a/ext/bcmath/setup.stub b/ext/bcmath/setup.stub
deleted file mode 100644
index c1cf263ef5..0000000000
--- a/ext/bcmath/setup.stub
+++ /dev/null
@@ -1,6 +0,0 @@
-# $Source$
-# $Id$
-
-define_option enable-bcmath 'Enable bc style precision math functions' yesno \
- yes \
-' Enables bc style arbitrary precision math functions.'
diff --git a/ext/calendar/CREDITS b/ext/calendar/CREDITS
deleted file mode 100644
index e69de29bb2..0000000000
--- a/ext/calendar/CREDITS
+++ /dev/null
diff --git a/ext/calendar/Makefile.in b/ext/calendar/Makefile.in
deleted file mode 100644
index d3452efb26..0000000000
--- a/ext/calendar/Makefile.in
+++ /dev/null
@@ -1,6 +0,0 @@
-
-LTLIBRARY_NAME = libcalendar.la
-LTLIBRARY_SOURCES = calendar.c dow.c french.c gregor.c jewish.c julian.c easter.c cal_unix.c
-LTLIBRARY_SHARED_NAME = calendar.la
-
-include $(top_srcdir)/build/dynlib.mk
diff --git a/ext/calendar/cal_unix.c b/ext/calendar/cal_unix.c
deleted file mode 100644
index 80853eac3d..0000000000
--- a/ext/calendar/cal_unix.c
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Shane Caraveo <shane@caraveo.com> |
- | Colin Viebrock <cmv@easydns.com> |
- | Hartmut Holzgraefe <hartmut@six.de> |
- +----------------------------------------------------------------------+
- */
-/* $Id: */
-
-#include "php.h"
-#include "php_calendar.h"
-#include "sdncal.h"
-#include <time.h>
-
-/* {{{ proto int unixtojd([int timestamp])
- Convert UNIX timestamp to Julian Day */
-PHP_FUNCTION(unixtojd)
-{
- pval *timestamp;
- long jdate;
- time_t t;
- struct tm *ta, tmbuf;
- int myargc=ZEND_NUM_ARGS();
-
- if ((myargc > 1) || (zend_get_parameters(ht,myargc, &timestamp) != SUCCESS)) {
- WRONG_PARAM_COUNT;
- }
-
- if(myargc==1) {
- convert_to_long(timestamp);
- t = timestamp->value.lval;
- } else {
- t = time(NULL);
- }
-
- if(t < 0) {
- RETURN_FALSE;
- }
-
- ta = php_localtime_r(&t, &tmbuf);
- jdate = GregorianToSdn(ta->tm_year+1900, ta->tm_mon+1,ta->tm_mday);
-
- RETURN_LONG(jdate);
-}
-/* }}} */
-
-/* {{{ proto int jdtounix(int jday)
- Convert Julian Day to UNIX timestamp */
-PHP_FUNCTION(jdtounix)
-{
- pval *jday;
- long uday;
-
- if ((ZEND_NUM_ARGS()!= 1) || (zend_get_parameters(ht,1, &jday) != SUCCESS)) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(jday);
-
- uday = jday->value.lval - 2440588 /* J.D. of 1.1.1970 */;
-
- if(uday<0) RETURN_FALSE; /* before beginning of unix epoch */
- if(uday>24755) RETURN_FALSE; /* behind end of unix epoch */
-
- RETURN_LONG(uday*24*3600);
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/calendar/calendar.c b/ext/calendar/calendar.c
deleted file mode 100644
index 2ac1dc1997..0000000000
--- a/ext/calendar/calendar.c
+++ /dev/null
@@ -1,348 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Shane Caraveo <shane@caraveo.com> |
- | Colin Viebrock <cmv@easydns.com> |
- | Hartmut Holzgraefe <hartmut@six.de> |
- +----------------------------------------------------------------------+
- */
-/* $Id: */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "ext/standard/info.h"
-#include "php_calendar.h"
-#include "sdncal.h"
-
-function_entry calendar_functions[] = {
- PHP_FE(jdtogregorian, NULL)
- PHP_FE(gregoriantojd, NULL)
- PHP_FE(jdtojulian, NULL)
- PHP_FE(juliantojd, NULL)
- PHP_FE(jdtojewish, NULL)
- PHP_FE(jewishtojd, NULL)
- PHP_FE(jdtofrench, NULL)
- PHP_FE(frenchtojd, NULL)
- PHP_FE(jddayofweek, NULL)
- PHP_FE(jdmonthname, NULL)
- PHP_FE(easter_date, NULL)
- PHP_FE(easter_days, NULL)
- PHP_FE(unixtojd, NULL)
- PHP_FE(jdtounix, NULL)
- {NULL, NULL, NULL}
-};
-
-
-zend_module_entry calendar_module_entry = {
- "Calendar",
- calendar_functions,
- NULL, /*PHP_MINIT(calendar),*/
- NULL,
- NULL,
- NULL,
- PHP_MINFO(calendar),
- STANDARD_MODULE_PROPERTIES,
-};
-
-#ifdef COMPILE_DL_CALENDAR
-ZEND_GET_MODULE(calendar)
-#endif
-
-PHP_MINIT_FUNCTION(calendar)
-{
- /*
- REGISTER_INT_CONSTANT("CAL_EASTER_TO_xxx",0, CONST_CS | CONST_PERSISTENT);
- */
- return SUCCESS;
-}
-
-PHP_MINFO_FUNCTION(calendar)
-{
- php_info_print_table_start();
- php_info_print_table_row(2, "Calendar support", "enabled");
- php_info_print_table_end();
-}
-
-
-/* {{{ proto string jdtogregorian(int juliandaycount)
- Convert a julian day count to a gregorian calendar date */
-PHP_FUNCTION(jdtogregorian)
-{
- pval **julday;
- int year, month, day;
- char date[10];
-
- if (zend_get_parameters_ex(1, &julday) != SUCCESS) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(julday);
- SdnToGregorian((*julday)->value.lval, &year, &month, &day);
- sprintf(date, "%i/%i/%i", month, day, year);
-
- RETURN_STRING(date,1);
-}
-/* }}} */
-
-/* {{{ proto int gregoriantojd(int month, int day, int year)
- Convert a gregorian calendar date to julian day count */
- PHP_FUNCTION(gregoriantojd)
-{
- pval **year, **month, **day;
- int jdate;
-
- if (zend_get_parameters_ex(3, &month, &day, &year) != SUCCESS) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(month);
- convert_to_long_ex(day);
- convert_to_long_ex(year);
-
- jdate = GregorianToSdn((*year)->value.lval, (*month)->value.lval,(*day)->value.lval);
-
- RETURN_LONG(jdate);
-}
-/* }}} */
-
-/* {{{ proto string jdtojulian(int juliandaycount)
- Convert a julian day count to a julian calendar date */
- PHP_FUNCTION(jdtojulian)
-{
- pval **julday;
- int year, month, day;
- char date[10];
-
- if (zend_get_parameters_ex(1, &julday) != SUCCESS) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(julday);
- SdnToJulian((*julday)->value.lval, &year, &month, &day);
- sprintf(date, "%i/%i/%i", month, day, year);
-
- RETURN_STRING(date,1);
-}
-/* }}} */
-
-
-/* {{{ proto int juliantojd(int month, int day, int year)
- Convert a julian calendar date to julian day count */
- PHP_FUNCTION(juliantojd)
-{
- pval **year, **month, **day;
- int jdate;
-
- if (zend_get_parameters_ex(3, &month, &day, &year) != SUCCESS) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(month);
- convert_to_long_ex(day);
- convert_to_long_ex(year);
-
- jdate = JulianToSdn((*year)->value.lval,(*month)->value.lval, (*day)->value.lval);
-
- RETURN_LONG(jdate);
-}
-/* }}} */
-
-
-/* {{{ proto string jdtojewish(int juliandaycount)
- Convert a julian day count to a jewish calendar date */
- PHP_FUNCTION(jdtojewish)
-{
- pval **julday;
- int year, month, day;
- char date[10];
-
- if (zend_get_parameters_ex(1, &julday) != SUCCESS) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(julday);
-
- SdnToJewish((*julday)->value.lval, &year, &month, &day);
- sprintf(date, "%i/%i/%i", month, day, year);
-
- RETURN_STRING(date,1);
-}
-/* }}} */
-
-
-/* {{{ proto int jewishtojd(int month, int day, int year)
- Convert a jewish calendar date to a julian day count */
- PHP_FUNCTION(jewishtojd)
-{
- pval **year, **month, **day;
- int jdate;
-
- if (zend_get_parameters_ex(3, &month, &day, &year) != SUCCESS) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(month);
- convert_to_long_ex(day);
- convert_to_long_ex(year);
-
- jdate = JewishToSdn((*year)->value.lval,(*month)->value.lval, (*day)->value.lval);
-
- RETURN_LONG(jdate);
-}
-/* }}} */
-
-
-/* {{{ proto string jdtofrench(int juliandaycount)
- Convert a julian day count to a french republic calendar date */
- PHP_FUNCTION(jdtofrench)
-{
- pval **julday;
- int year, month, day;
- char date[10];
-
- if (zend_get_parameters_ex(1, &julday) != SUCCESS) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(julday);
-
- SdnToFrench((*julday)->value.lval, &year, &month, &day);
- sprintf(date, "%i/%i/%i", month, day, year);
-
- RETURN_STRING(date,1);
-}
-/* }}} */
-
-
-/* {{{ proto int frenchtojd(int month, int day, int year)
- Convert a french republic calendar date to julian day count */
- PHP_FUNCTION(frenchtojd)
-{
- pval **year, **month, **day;
- int jdate;
-
- if (zend_get_parameters_ex(3, &month, &day, &year) != SUCCESS) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(month);
- convert_to_long_ex(day);
- convert_to_long_ex(year);
-
- jdate = FrenchToSdn((*year)->value.lval,(*month)->value.lval,(*day)->value.lval);
-
- RETURN_LONG(jdate);
-}
-/* }}} */
-
-/* {{{ proto mixed jddayofweek(int juliandaycount [, int mode])
- Returns name or number of day of week from julian day count */
- PHP_FUNCTION(jddayofweek)
-{
- pval *julday, *mode;
- int day;
- char *daynamel, *daynames;
- int myargc=ZEND_NUM_ARGS(),mymode=0;
-
- if ((myargc < 1) || (myargc > 2) || (zend_get_parameters(ht,myargc, &julday, &mode) != SUCCESS)) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(julday);
- if(myargc==2) {
- convert_to_long(mode);
- mymode = mode->value.lval;
- }
-
- day = DayOfWeek(julday->value.lval);
- daynamel = DayNameLong[day];
- daynames = DayNameShort[day];
-
- switch (mymode) {
- case 0L:
- RETURN_LONG(day);
- break;
- case 1L:
- RETURN_STRING(daynamel,1);
- break;
- case 2L:
- RETURN_STRING(daynames,1);
- break;
- default:
- RETURN_LONG(day);
- break;
- }
-}
-/* }}} */
-
-/* {{{ proto string jdmonthname(int juliandaycount, int mode)
- Returns name of month for julian day count */
- PHP_FUNCTION(jdmonthname)
-{
- pval **julday, **mode;
- char *monthname = NULL;
- int month, day, year;
-
- if (zend_get_parameters_ex(2, &julday, &mode) != SUCCESS) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(julday);
- convert_to_long_ex(mode);
-
- switch((*mode)->value.lval) {
- case 0L: /* gregorian or julian month */
- SdnToGregorian((*julday)->value.lval,&year, &month, &day);
- monthname = MonthNameShort[month];
- break;
- case 1L: /* gregorian or julian month */
- SdnToGregorian((*julday)->value.lval,&year, &month, &day);
- monthname = MonthNameLong[month];
- break;
- case 2L: /* gregorian or julian month */
- SdnToJulian((*julday)->value.lval, &year,&month, &day);
- monthname = MonthNameShort[month];
- break;
- case 3L: /* gregorian or julian month */
- SdnToJulian((*julday)->value.lval, &year,&month, &day);
- monthname = MonthNameLong[month];
- break;
- case 4L: /* jewish month */
- SdnToJewish((*julday)->value.lval, &year,&month, &day);
- monthname = JewishMonthName[month];
- break;
- case 5L: /* french month */
- SdnToFrench((*julday)->value.lval, &year,&month, &day);
- monthname = FrenchMonthName[month];
- break;
- default: /* default gregorian */
- /* FIXME - need to set monthname to something here ?? */
- break;
- }
-
- RETURN_STRING(monthname,1);
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/calendar/config.m4 b/ext/calendar/config.m4
deleted file mode 100644
index 3fdec44e3a..0000000000
--- a/ext/calendar/config.m4
+++ /dev/null
@@ -1,9 +0,0 @@
-dnl $Id$
-
-PHP_ARG_ENABLE(calendar,whether to enable calendar conversion support,
-[ --enable-calendar Enable support for calendar conversion])
-
-if test "$PHP_CALENDAR" = "yes"; then
- AC_DEFINE(HAVE_CALENDAR,1,[ ])
- PHP_EXTENSION(calendar, $ext_shared)
-fi
diff --git a/ext/calendar/dow.c b/ext/calendar/dow.c
deleted file mode 100644
index 5336ea63e3..0000000000
--- a/ext/calendar/dow.c
+++ /dev/null
@@ -1,76 +0,0 @@
-
-/* $selId: dow.c,v 2.0 1995/10/24 01:13:06 lees Exp $
- * Copyright 1993-1995, Scott E. Lee, all rights reserved.
- * Permission granted to use, copy, modify, distribute and sell so long as
- * the above copyright and this permission statement are retained in all
- * copies. THERE IS NO WARRANTY - USE AT YOUR OWN RISK.
- */
-
-/**************************************************************************
- *
- * These are the externally visible components of this file:
- *
- * int
- * DayOfWeek(
- * long int sdn);
- *
- * Convert a SDN to a day-of-week number (0 to 6). Where 0 stands for
- * Sunday, 1 for Monday, etc. and 6 stands for Saturday.
- *
- * char *DayNameShort[7];
- *
- * Convert a day-of-week number (0 to 6), as returned from DayOfWeek(), to
- * the abbreviated (three character) name of the day.
- *
- * char *DayNameLong[7];
- *
- * Convert a day-of-week number (0 to 6), as returned from DayOfWeek(), to
- * the name of the day.
- *
- **************************************************************************/
-
-#include "sdncal.h"
-
-int DayOfWeek(
- long int sdn)
-{
- int dow;
-
- dow = (sdn + 1) % 7;
- if (dow >= 0) {
- return (dow);
- } else {
- return (dow + 7);
- }
-}
-
-char *DayNameShort[7] =
-{
- "Sun",
- "Mon",
- "Tue",
- "Wed",
- "Thu",
- "Fri",
- "Sat"
-};
-
-char *DayNameLong[7] =
-{
- "Sunday",
- "Monday",
- "Tuesday",
- "Wednesday",
- "Thursday",
- "Friday",
- "Saturday"
-};
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/calendar/easter.c b/ext/calendar/easter.c
deleted file mode 100644
index 70c9dbffc9..0000000000
--- a/ext/calendar/easter.c
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Shane Caraveo <shane@caraveo.com> |
- | Colin Viebrock <cmv@easydns.com> |
- | Hartmut Holzgraefe <hartmut@six.de> |
- +----------------------------------------------------------------------+
- */
-/* $Id: */
-
-#include "php.h"
-#include "php_calendar.h"
-#include "sdncal.h"
-#include <time.h>
-
-static void _cal_easter(INTERNAL_FUNCTION_PARAMETERS, int gm)
-{
-
- /* based on code by Simon Kershaw, <webmaster@ely.anglican.org> */
-
- pval *year_arg;
- struct tm *ta, te;
- time_t the_time;
- long year, golden, solar, lunar, pfm, dom, tmp, easter;
-
- switch(ZEND_NUM_ARGS()) {
- case 0:
- the_time = time(NULL);
- ta = localtime(&the_time);
- year = ta->tm_year + 1900;
- break;
- case 1:
- if (getParameters(ht, 1, &year_arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long(year_arg);
- year = year_arg->value.lval;
- break;
- default:
- WRONG_PARAM_COUNT;
- }
-
- if (gm && (year<1970 || year>2037)) { /* out of range for timestamps */
- php3_error(E_WARNING, "easter_date() is only valid for years between 1970 and 2037 inclusive");
- RETURN_FALSE;
- }
-
- golden = (year % 19) + 1; /* the Golden number */
-
- if ( year <= 1752 ) { /* JULIAN CALENDAR */
- dom = (year + (year/4) + 5) % 7; /* the "Dominical number" - finding a Sunday */
- if (dom < 0) {
- dom += 7;
- }
-
- pfm = (3 - (11*golden) - 7) % 30; /* uncorrected date of the Paschal full moon */
- if (pfm < 0) {
- pfm += 30;
- }
- } else { /* GREGORIAN CALENDAR */
- dom = (year + (year/4) - (year/100) + (year/400)) % 7; /* the "Domincal number" */
- if (dom < 0) {
- dom += 7;
- }
-
- solar = (year-1600)/100 - (year-1600)/400; /* the solar and lunar corrections */
- lunar = (((year-1400) / 100) * 8) / 25;
-
- pfm = (3 - (11*golden) + solar - lunar) % 30; /* uncorrected date of the Paschal full moon */
- if (pfm < 0) {
- pfm += 30;
- }
- }
-
- if ((pfm == 29) || (pfm == 28 && golden > 11)) { /* corrected date of the Paschal full moon */
- pfm--; /* - days after 21st March */
- }
-
- tmp = (4-pfm-dom) % 7;
- if (tmp < 0) {
- tmp += 7;
- }
-
- easter = pfm + tmp + 1; /* Easter as the number of days after 21st March */
-
- if (gm) { /* return a timestamp */
- te.tm_isdst = -1;
- te.tm_year = year-1900;
- te.tm_sec = 0;
- te.tm_min = 0;
- te.tm_hour = 0;
-
- if (easter < 11) {
- te.tm_mon = 2; /* March */
- te.tm_mday = easter+21;
- } else {
- te.tm_mon = 3; /* April */
- te.tm_mday = easter-10;
- }
-
- return_value->value.lval = mktime(&te);
- } else { /* return the days after March 21 */
- return_value->value.lval = easter;
- }
-
- return_value->type = IS_LONG;
-
-}
-
-/* {{{ proto int easter_date([int year])
- Return the timestamp of midnight on Easter of a given year (defaults to current year) */
-PHP_FUNCTION(easter_date)
-{
- _cal_easter(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
-}
-/* }}} */
-
-/* {{{ proto int easter_days([int year])
- Return the number of days after March 21 that Easter falls on for a given year (defaults to current year) */
-PHP_FUNCTION(easter_days)
-{
- _cal_easter(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/calendar/french.c b/ext/calendar/french.c
deleted file mode 100644
index ebb497d90e..0000000000
--- a/ext/calendar/french.c
+++ /dev/null
@@ -1,160 +0,0 @@
-/* $selId: french.c,v 2.0 1995/10/24 01:13:06 lees Exp $
- * Copyright 1993-1995, Scott E. Lee, all rights reserved.
- * Permission granted to use, copy, modify, distribute and sell so long as
- * the above copyright and this permission statement are retained in all
- * copies. THERE IS NO WARRANTY - USE AT YOUR OWN RISK.
- */
-
-/**************************************************************************
- *
- * These are the externally visible components of this file:
- *
- * void
- * SdnToFrench(
- * long int sdn,
- * int *pYear,
- * int *pMonth,
- * int *pDay);
- *
- * Convert a SDN to a French republican calendar date. If the input SDN is
- * before the first day of year 1 or after the last day of year 14, the
- * three output values will all be set to zero, otherwise *pYear will be in
- * the range 1 to 14 inclusive; *pMonth will be in the range 1 to 13
- * inclusive; *pDay will be in the range 1 to 30 inclusive. If *pMonth is
- * 13, the SDN represents one of the holidays at the end of the year and
- * *pDay will be in the range 1 to 6 inclusive.
- *
- * long int
- * FrenchToSdn(
- * int year,
- * int month,
- * int day);
- *
- * Convert a French republican calendar date to a SDN. Zero is returned
- * when the input date is detected as invalid or out of the supported
- * range. The return value will be > 0 for all valid, supported dates, but
- * there are some invalid dates that will return a positive value. To
- * verify that a date is valid, convert it to SDN and then back and compare
- * with the original.
- *
- * char *FrenchMonthName[14];
- *
- * Convert a French republican month number (1 to 13) to the name of the
- * French republican month (null terminated). An index of 13 (for the
- * "extra" days at the end of the year) will return the string "Extra". An
- * index of zero will return a zero length string.
- *
- * VALID RANGE
- *
- * These routines only convert dates in years 1 through 14 (Gregorian
- * dates 22 September 1792 through 22 September 1806). This more than
- * covers the period when the calendar was in use.
- *
- * I would support a wider range of dates, but I have not been able to
- * find an authoritative definition of when leap years were to have
- * occurred. There are suggestions that it was to skip a leap year ever
- * 100 years like the Gregorian calendar.
- *
- * CALENDAR OVERVIEW
- *
- * The French republican calendar was adopted in October 1793 during
- * the French Revolution and was abandoned in January 1806. The intent
- * was to create a new calendar system that was based on scientific
- * principals, not religious traditions.
- *
- * The year is divided into 12 months of 30 days each. The remaining 5
- * to 6 days in the year are grouped at the end and are holidays. Each
- * month is divided into three decades (instead of weeks) of 10 days
- * each.
- *
- * The epoch (first day of the first year) is 22 September 1792 in the
- * Gregorian calendar. Leap years are every fourth year (year 3, 7,
- * 11, etc.)
- *
- * TESTING
- *
- * This algorithm has been tested from the year 1 to 14. The source
- * code of the verification program is included in this package.
- *
- * REFERENCES
- *
- * I have found no detailed, authoritative reference on this calendar.
- * The algorithms are based on a preponderance of less authoritative
- * sources.
- *
- **************************************************************************/
-
-#include "sdncal.h"
-
-#define SDN_OFFSET 2375474
-#define DAYS_PER_4_YEARS 1461
-#define DAYS_PER_MONTH 30
-#define FIRST_VALID 2375840
-#define LAST_VALID 2380952
-
-void SdnToFrench(
- long int sdn,
- int *pYear,
- int *pMonth,
- int *pDay)
-{
- long int temp;
- int dayOfYear;
-
- if (sdn < FIRST_VALID || sdn > LAST_VALID) {
- *pYear = 0;
- *pMonth = 0;
- *pDay = 0;
- return;
- }
- temp = (sdn - SDN_OFFSET) * 4 - 1;
- *pYear = temp / DAYS_PER_4_YEARS;
- dayOfYear = (temp % DAYS_PER_4_YEARS) / 4;
- *pMonth = dayOfYear / DAYS_PER_MONTH + 1;
- *pDay = dayOfYear % DAYS_PER_MONTH + 1;
-}
-
-long int FrenchToSdn(
- int year,
- int month,
- int day)
-{
- /* check for invalid dates */
- if (year < 1 || year > 14 ||
- month < 1 || month > 13 ||
- day < 1 || day > 30) {
- return (0);
- }
- return ((year * DAYS_PER_4_YEARS) / 4
- + (month - 1) * DAYS_PER_MONTH
- + day
- + SDN_OFFSET);
-}
-
-char *FrenchMonthName[14] =
-{
- "",
- "Vendemiaire",
- "Brumaire",
- "Frimaire",
- "Nivose",
- "Pluviose",
- "Ventose",
- "Germinal",
- "Floreal",
- "Prairial",
- "Messidor",
- "Thermidor",
- "Fructidor",
- "Extra"
-};
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/calendar/gregor.c b/ext/calendar/gregor.c
deleted file mode 100644
index ef0a01ea66..0000000000
--- a/ext/calendar/gregor.c
+++ /dev/null
@@ -1,265 +0,0 @@
-/* $selId: gregor.c,v 2.0 1995/10/24 01:13:06 lees Exp $
- * Copyright 1993-1995, Scott E. Lee, all rights reserved.
- * Permission granted to use, copy, modify, distribute and sell so long as
- * the above copyright and this permission statement are retained in all
- * copies. THERE IS NO WARRANTY - USE AT YOUR OWN RISK.
- */
-
-/**************************************************************************
- *
- * These are the externally visible components of this file:
- *
- * void
- * SdnToGregorian(
- * long int sdn,
- * int *pYear,
- * int *pMonth,
- * int *pDay);
- *
- * Convert a SDN to a Gregorian calendar date. If the input SDN is less
- * than 1, the three output values will all be set to zero, otherwise
- * *pYear will be >= -4714 and != 0; *pMonth will be in the range 1 to 12
- * inclusive; *pDay will be in the range 1 to 31 inclusive.
- *
- * long int
- * GregorianToSdn(
- * int inputYear,
- * int inputMonth,
- * int inputDay);
- *
- * Convert a Gregorian calendar date to a SDN. Zero is returned when the
- * input date is detected as invalid or out of the supported range. The
- * return value will be > 0 for all valid, supported dates, but there are
- * some invalid dates that will return a positive value. To verify that a
- * date is valid, convert it to SDN and then back and compare with the
- * original.
- *
- * char *MonthNameShort[13];
- *
- * Convert a Gregorian month number (1 to 12) to the abbreviated (three
- * character) name of the Gregorian month (null terminated). An index of
- * zero will return a zero length string.
- *
- * char *MonthNameLong[13];
- *
- * Convert a Gregorian month number (1 to 12) to the name of the Gregorian
- * month (null terminated). An index of zero will return a zero length
- * string.
- *
- * VALID RANGE
- *
- * 4714 B.C. to at least 10000 A.D.
- *
- * Although this software can handle dates all the way back to 4714
- * B.C., such use may not be meaningful. The Gregorian calendar was
- * not instituted until October 15, 1582 (or October 5, 1582 in the
- * Julian calendar). Some countries did not accept it until much
- * later. For example, Britain converted in 1752, The USSR in 1918 and
- * Greece in 1923. Most European countries used the Julian calendar
- * prior to the Gregorian.
- *
- * CALENDAR OVERVIEW
- *
- * The Gregorian calendar is a modified version of the Julian calendar.
- * The only difference being the specification of leap years. The
- * Julian calendar specifies that every year that is a multiple of 4
- * will be a leap year. This leads to a year that is 365.25 days long,
- * but the current accepted value for the tropical year is 365.242199
- * days.
- *
- * To correct this error in the length of the year and to bring the
- * vernal equinox back to March 21, Pope Gregory XIII issued a papal
- * bull declaring that Thursday October 4, 1582 would be followed by
- * Friday October 15, 1582 and that centennial years would only be a
- * leap year if they were a multiple of 400. This shortened the year
- * by 3 days per 400 years, giving a year of 365.2425 days.
- *
- * Another recently proposed change in the leap year rule is to make
- * years that are multiples of 4000 not a leap year, but this has never
- * been officially accepted and this rule is not implemented in these
- * algorithms.
- *
- * ALGORITHMS
- *
- * The calculations are based on three different cycles: a 400 year
- * cycle of leap years, a 4 year cycle of leap years and a 5 month
- * cycle of month lengths.
- *
- * The 5 month cycle is used to account for the varying lengths of
- * months. You will notice that the lengths alternate between 30
- * and 31 days, except for three anomalies: both July and August
- * have 31 days, both December and January have 31, and February
- * is less than 30. Starting with March, the lengths are in a
- * cycle of 5 months (31, 30, 31, 30, 31):
- *
- * Mar 31 days \
- * Apr 30 days |
- * May 31 days > First cycle
- * Jun 30 days |
- * Jul 31 days /
- *
- * Aug 31 days \
- * Sep 30 days |
- * Oct 31 days > Second cycle
- * Nov 30 days |
- * Dec 31 days /
- *
- * Jan 31 days \
- * Feb 28/9 days |
- * > Third cycle (incomplete)
- *
- * For this reason the calculations (internally) assume that the
- * year starts with March 1.
- *
- * TESTING
- *
- * This algorithm has been tested from the year 4714 B.C. to 10000
- * A.D. The source code of the verification program is included in
- * this package.
- *
- * REFERENCES
- *
- * Conversions Between Calendar Date and Julian Day Number by Robert J.
- * Tantzen, Communications of the Association for Computing Machinery
- * August 1963. (Also published in Collected Algorithms from CACM,
- * algorithm number 199).
- *
- **************************************************************************/
-
-#include "sdncal.h"
-
-#define SDN_OFFSET 32045
-#define DAYS_PER_5_MONTHS 153
-#define DAYS_PER_4_YEARS 1461
-#define DAYS_PER_400_YEARS 146097
-
-void SdnToGregorian(
- long int sdn,
- int *pYear,
- int *pMonth,
- int *pDay)
-{
- int century;
- int year;
- int month;
- int day;
- long int temp;
- int dayOfYear;
-
- if (sdn <= 0) {
- *pYear = 0;
- *pMonth = 0;
- *pDay = 0;
- return;
- }
- temp = (sdn + SDN_OFFSET) * 4 - 1;
-
- /* Calculate the century (year/100). */
- century = temp / DAYS_PER_400_YEARS;
-
- /* Calculate the year and day of year (1 <= dayOfYear <= 366). */
- temp = ((temp % DAYS_PER_400_YEARS) / 4) * 4 + 3;
- year = (century * 100) + (temp / DAYS_PER_4_YEARS);
- dayOfYear = (temp % DAYS_PER_4_YEARS) / 4 + 1;
-
- /* Calculate the month and day of month. */
- temp = dayOfYear * 5 - 3;
- month = temp / DAYS_PER_5_MONTHS;
- day = (temp % DAYS_PER_5_MONTHS) / 5 + 1;
-
- /* Convert to the normal beginning of the year. */
- if (month < 10) {
- month += 3;
- } else {
- year += 1;
- month -= 9;
- }
-
- /* Adjust to the B.C./A.D. type numbering. */
- year -= 4800;
- if (year <= 0)
- year--;
-
- *pYear = year;
- *pMonth = month;
- *pDay = day;
-}
-
-long int GregorianToSdn(
- int inputYear,
- int inputMonth,
- int inputDay)
-{
- int year;
- int month;
-
- /* check for invalid dates */
- if (inputYear == 0 || inputYear < -4714 ||
- inputMonth <= 0 || inputMonth > 12 ||
- inputDay <= 0 || inputDay > 31) {
- return (0);
- }
- /* check for dates before SDN 1 (Nov 25, 4714 B.C.) */
- if (inputYear == -4714) {
- if (inputMonth < 11) {
- return (0);
- }
- if (inputMonth == 11 && inputDay < 25) {
- return (0);
- }
- }
- /* Make year always a positive number. */
- if (inputYear < 0) {
- year = inputYear + 4801;
- } else {
- year = inputYear + 4800;
- }
-
- /* Adjust the start of the year. */
- if (inputMonth > 2) {
- month = inputMonth - 3;
- } else {
- month = inputMonth + 9;
- year--;
- }
-
- return (((year / 100) * DAYS_PER_400_YEARS) / 4
- + ((year % 100) * DAYS_PER_4_YEARS) / 4
- + (month * DAYS_PER_5_MONTHS + 2) / 5
- + inputDay
- - SDN_OFFSET);
-}
-
-char *MonthNameShort[13] =
-{
- "",
- "Jan",
- "Feb",
- "Mar",
- "Apr",
- "May",
- "Jun",
- "Jul",
- "Aug",
- "Sep",
- "Oct",
- "Nov",
- "Dec"
-};
-
-char *MonthNameLong[13] =
-{
- "",
- "January",
- "February",
- "March",
- "April",
- "May",
- "June",
- "July",
- "August",
- "September",
- "October",
- "November",
- "December"
-};
diff --git a/ext/calendar/jewish.c b/ext/calendar/jewish.c
deleted file mode 100644
index 2b3f93e601..0000000000
--- a/ext/calendar/jewish.c
+++ /dev/null
@@ -1,741 +0,0 @@
-/* $selId: jewish.c,v 2.0 1995/10/24 01:13:06 lees Exp $
- * Copyright 1993-1995, Scott E. Lee, all rights reserved.
- * Permission granted to use, copy, modify, distribute and sell so long as
- * the above copyright and this permission statement are retained in all
- * copies. THERE IS NO WARRANTY - USE AT YOUR OWN RISK.
- */
-
-/**************************************************************************
- *
- * These are the externally visible components of this file:
- *
- * void
- * SdnToJewish(
- * long int sdn,
- * int *pYear,
- * int *pMonth,
- * int *pDay);
- *
- * Convert a SDN to a Jewish calendar date. If the input SDN is before the
- * first day of year 1, the three output values will all be set to zero,
- * otherwise *pYear will be > 0; *pMonth will be in the range 1 to 13
- * inclusive; *pDay will be in the range 1 to 30 inclusive. Note that Adar
- * II is assigned the month number 7 and Elul is always 13.
- *
- * long int
- * JewishToSdn(
- * int year,
- * int month,
- * int day);
- *
- * Convert a Jewish calendar date to a SDN. Zero is returned when the
- * input date is detected as invalid or out of the supported range. The
- * return value will be > 0 for all valid, supported dates, but there are
- * some invalid dates that will return a positive value. To verify that a
- * date is valid, convert it to SDN and then back and compare with the
- * original.
- *
- * char *JewishMonthName[14];
- *
- * Convert a Jewish month number (1 to 13) to the name of the Jewish month
- * (null terminated). An index of zero will return a zero length string.
- *
- * VALID RANGE
- *
- * Although this software can handle dates all the way back to the year
- * 1 (3761 B.C.), such use may not be meaningful.
- *
- * The Jewish calendar has been in use for several thousand years, but
- * in the early days there was no formula to determine the start of a
- * month. A new month was started when the new moon was first
- * observed.
- *
- * It is not clear when the current rule based calendar replaced the
- * observation based calendar. According to the book "Jewish Calendar
- * Mystery Dispelled" by George Zinberg, the patriarch Hillel II
- * published these rules in 358 A.D. But, according to The
- * Encyclopedia Judaica, Hillel II may have only published the 19 year
- * rule for determining the occurrence of leap years.
- *
- * I have yet to find a specific date when the current set of rules
- * were known to be in use.
- *
- * CALENDAR OVERVIEW
- *
- * The Jewish calendar is based on lunar as well as solar cycles. A
- * month always starts on or near a new moon and has either 29 or 30
- * days (a lunar cycle is about 29 1/2 days). Twelve of these
- * alternating 29-30 day months gives a year of 354 days, which is
- * about 11 1/4 days short of a solar year.
- *
- * Since a month is defined to be a lunar cycle (new moon to new moon),
- * this 11 1/4 day difference cannot be overcome by adding days to a
- * month as with the Gregorian calendar, so an entire month is
- * periodically added to the year, making some years 13 months long.
- *
- * For astronomical as well as ceremonial reasons, the start of a new
- * year may be delayed until a day or two after the new moon causing
- * years to vary in length. Leap years can be from 383 to 385 days and
- * common years can be from 353 to 355 days. These are the months of
- * the year and their possible lengths:
- *
- * COMMON YEAR LEAP YEAR
- * 1 Tishri 30 30 30 30 30 30
- * 2 Heshvan 29 29 30 29 29 30 (variable)
- * 3 Kislev 29 30 30 29 30 30 (variable)
- * 4 Tevet 29 29 29 29 29 29
- * 5 Shevat 30 30 30 30 30 30
- * 6 Adar I 29 29 29 30 30 30 (variable)
- * 7 Adar II -- -- -- 29 29 29 (optional)
- * 8 Nisan 30 30 30 30 30 30
- * 9 Iyyar 29 29 29 29 29 29
- * 10 Sivan 30 30 30 30 30 30
- * 11 Tammuz 29 29 29 29 29 29
- * 12 Av 30 30 30 30 30 30
- * 13 Elul 29 29 29 29 29 29
- * --- --- --- --- --- ---
- * 353 354 355 383 384 385
- *
- * Note that the month names and other words that appear in this file
- * have multiple possible spellings in the Roman character set. I have
- * chosen to use the spellings found in the Encyclopedia Judaica.
- *
- * Adar II, the month added for leap years, is sometimes referred to as
- * the 13th month, but I have chosen to assign it the number 7 to keep
- * the months in chronological order. This may not be consistent with
- * other numbering schemes.
- *
- * Leap years occur in a fixed pattern of 19 years called the metonic
- * cycle. The 3rd, 6th, 8th, 11th, 14th, 17th and 19th years of this
- * cycle are leap years. The first metonic cycle starts with Jewish
- * year 1, or 3761/60 B.C. This is believed to be the year of
- * creation.
- *
- * To construct the calendar for a year, you must first find the length
- * of the year by determining the first day of the year (Tishri 1, or
- * Rosh Ha-Shanah) and the first day of the following year. This
- * selects one of the six possible month length configurations listed
- * above.
- *
- * Finding the first day of the year is the most difficult part.
- * Finding the date and time of the new moon (or molad) is the first
- * step. For this purpose, the lunar cycle is assumed to be 29 days 12
- * hours and 793 halakim. A halakim is 1/1080th of an hour or 3 1/3
- * seconds. (This assumed value is only about 1/2 second less than the
- * value used by modern astronomers -- not bad for a number that was
- * determined so long ago.) The first molad of year 1 occurred on
- * Sunday at 11:20:11 P.M. This would actually be Monday, because the
- * Jewish day is considered to begin at sunset.
- *
- * Since sunset varies, the day is assumed to begin at 6:00 P.M. for
- * calendar calculation purposes. So, the first molad was 5 hours 793
- * halakim after the start of Tishri 1, 0001 (which was Monday
- * September 7, 4761 B.C. by the Gregorian calendar). All subsequent
- * molads can be calculated from this starting point by adding the
- * length of a lunar cycle.
- *
- * Once the molad that starts a year is determined the actual start of
- * the year (Tishri 1) can be determined. Tishri 1 will be the day of
- * the molad unless it is delayed by one of the following four rules
- * (called dehiyyot). Each rule can delay the start of the year by one
- * day, and since rule #1 can combine with one of the other rules, it
- * can be delayed as much as two days.
- *
- * 1. Tishri 1 must never be Sunday, Wednesday or Friday. (This
- * is largely to prevent certain holidays from occurring on the
- * day before or after the Sabbath.)
- *
- * 2. If the molad occurs on or after noon, Tishri 1 must be
- * delayed.
- *
- * 3. If it is a common (not leap) year and the molad occurs on
- * Tuesday at or after 3:11:20 A.M., Tishri 1 must be delayed.
- *
- * 4. If it is the year following a leap year and the molad occurs
- * on Monday at or after 9:32:43 and 1/3 sec, Tishri 1 must be
- * delayed.
- *
- * GLOSSARY
- *
- * dehiyyot The set of 4 rules that determine when the new year
- * starts relative to the molad.
- *
- * halakim 1/1080th of an hour or 3 1/3 seconds.
- *
- * lunar cycle The period of time between mean conjunctions of the
- * sun and moon (new moon to new moon). This is
- * assumed to be 29 days 12 hours and 793 halakim for
- * calendar purposes.
- *
- * metonic cycle A 19 year cycle which determines which years are
- * leap years and which are common years. The 3rd,
- * 6th, 8th, 11th, 14th, 17th and 19th years of this
- * cycle are leap years.
- *
- * molad The date and time of the mean conjunction of the
- * sun and moon (new moon). This is the approximate
- * beginning of a month.
- *
- * Rosh Ha-Shanah The first day of the Jewish year (Tishri 1).
- *
- * Tishri The first month of the Jewish year.
- *
- * ALGORITHMS
- *
- * SERIAL DAY NUMBER TO JEWISH DATE
- *
- * The simplest approach would be to use the rules stated above to find
- * the molad of Tishri before and after the given day number. Then use
- * the molads to find Tishri 1 of the current and following years.
- * From this the length of the year can be determined and thus the
- * length of each month. But this method is used as a last resort.
- *
- * The first 59 days of the year are the same regardless of the length
- * of the year. As a result, only the day number of the start of the
- * year is required.
- *
- * Similarly, the last 6 months do not change from year to year. And
- * since it can be determined whether the year is a leap year by simple
- * division, the lengths of Adar I and II can be easily calculated. In
- * fact, all dates after the 3rd month are consistent from year to year
- * (once it is known whether it is a leap year).
- *
- * This means that if the given day number falls in the 3rd month or on
- * the 30th day of the 2nd month the length of the year must be found,
- * but in no other case.
- *
- * So, the approach used is to take the given day number and round it
- * to the closest molad of Tishri (first new moon of the year). The
- * rounding is not really to the *closest* molad, but is such that if
- * the day number is before the middle of the 3rd month the molad at
- * the start of the year is found, otherwise the molad at the end of
- * the year is found.
- *
- * Only if the day number is actually found to be in the ambiguous
- * period of 29 to 31 days is the other molad calculated.
- *
- * JEWISH DATE TO SERIAL DAY NUMBER
- *
- * The year number is used to find which 19 year metonic cycle contains
- * the date and which year within the cycle (this is a division and
- * modulus). This also determines whether it is a leap year.
- *
- * If the month is 1 or 2, the calculation is simple addition to the
- * first of the year.
- *
- * If the month is 8 (Nisan) or greater, the calculation is simple
- * subtraction from beginning of the following year.
- *
- * If the month is 4 to 7, it is considered whether it is a leap year
- * and then simple subtraction from the beginning of the following year
- * is used.
- *
- * Only if it is the 3rd month is both the start and end of the year
- * required.
- *
- * TESTING
- *
- * This algorithm has been tested in two ways. First, 510 dates from a
- * table in "Jewish Calendar Mystery Dispelled" were calculated and
- * compared to the table. Second, the calculation algorithm described
- * in "Jewish Calendar Mystery Dispelled" was coded and used to verify
- * all dates from the year 1 (3761 B.C.) to the year 13760 (10000
- * A.D.).
- *
- * The source code of the verification program is included in this
- * package.
- *
- * REFERENCES
- *
- * The Encyclopedia Judaica, the entry for "Calendar"
- *
- * The Jewish Encyclopedia
- *
- * Jewish Calendar Mystery Dispelled by George Zinberg, Vantage Press,
- * 1963
- *
- * The Comprehensive Hebrew Calendar by Arthur Spier, Behrman House
- *
- * The Book of Calendars [note that this work contains many typos]
- *
- **************************************************************************/
-
-#include "sdncal.h"
-
-#define HALAKIM_PER_HOUR 1080
-#define HALAKIM_PER_DAY 25920
-#define HALAKIM_PER_LUNAR_CYCLE ((29 * HALAKIM_PER_DAY) + 13753)
-#define HALAKIM_PER_METONIC_CYCLE (HALAKIM_PER_LUNAR_CYCLE * (12 * 19 + 7))
-
-#define SDN_OFFSET 347997
-#define NEW_MOON_OF_CREATION 31524
-
-#define SUNDAY 0
-#define MONDAY 1
-#define TUESDAY 2
-#define WEDNESDAY 3
-#define THURSDAY 4
-#define FRIDAY 5
-#define SATURDAY 6
-
-#define NOON (18 * HALAKIM_PER_HOUR)
-#define AM3_11_20 ((9 * HALAKIM_PER_HOUR) + 204)
-#define AM9_32_43 ((15 * HALAKIM_PER_HOUR) + 589)
-
-static int monthsPerYear[19] =
-{
-12, 12, 13, 12, 12, 13, 12, 13, 12, 12, 13, 12, 12, 13, 12, 12, 13, 12, 13
-};
-
-static int yearOffset[19] =
-{
- 0, 12, 24, 37, 49, 61, 74, 86, 99, 111, 123,
- 136, 148, 160, 173, 185, 197, 210, 222
-};
-
-char *JewishMonthName[14] =
-{
- "",
- "Tishri",
- "Heshvan",
- "Kislev",
- "Tevet",
- "Shevat",
- "AdarI",
- "AdarII",
- "Nisan",
- "Iyyar",
- "Sivan",
- "Tammuz",
- "Av",
- "Elul"
-};
-
-/************************************************************************
- * Given the year within the 19 year metonic cycle and the time of a molad
- * (new moon) which starts that year, this routine will calculate what day
- * will be the actual start of the year (Tishri 1 or Rosh Ha-Shanah). This
- * first day of the year will be the day of the molad unless one of 4 rules
- * (called dehiyyot) delays it. These 4 rules can delay the start of the
- * year by as much as 2 days.
- */
-static long int Tishri1(
- int metonicYear,
- long int moladDay,
- long int moladHalakim)
-{
- long int tishri1;
- int dow;
- int leapYear;
- int lastWasLeapYear;
-
- tishri1 = moladDay;
- dow = tishri1 % 7;
- leapYear = metonicYear == 2 || metonicYear == 5 || metonicYear == 7
- || metonicYear == 10 || metonicYear == 13 || metonicYear == 16
- || metonicYear == 18;
- lastWasLeapYear = metonicYear == 3 || metonicYear == 6
- || metonicYear == 8 || metonicYear == 11 || metonicYear == 14
- || metonicYear == 17 || metonicYear == 0;
-
- /* Apply rules 2, 3 and 4. */
- if ((moladHalakim >= NOON) ||
- ((!leapYear) && dow == TUESDAY && moladHalakim >= AM3_11_20) ||
- (lastWasLeapYear && dow == MONDAY && moladHalakim >= AM9_32_43)) {
- tishri1++;
- dow++;
- if (dow == 7) {
- dow = 0;
- }
- }
- /* Apply rule 1 after the others because it can cause an additional
- * delay of one day. */
- if (dow == WEDNESDAY || dow == FRIDAY || dow == SUNDAY) {
- tishri1++;
- }
- return (tishri1);
-}
-
-/************************************************************************
- * Given a metonic cycle number, calculate the date and time of the molad
- * (new moon) that starts that cycle. Since the length of a metonic cycle
- * is a constant, this is a simple calculation, except that it requires an
- * intermediate value which is bigger that 32 bits. Because this
- * intermediate value only needs 36 to 37 bits and the other numbers are
- * constants, the process has been reduced to just a few steps.
- */
-static void MoladOfMetonicCycle(
- int metonicCycle,
- long int *pMoladDay,
- long int *pMoladHalakim)
-{
- register unsigned long int r1, r2, d1, d2;
-
- /* Start with the time of the first molad after creation. */
- r1 = NEW_MOON_OF_CREATION;
-
- /* Calculate metonicCycle * HALAKIM_PER_METONIC_CYCLE. The upper 32
- * bits of the result will be in r2 and the lower 16 bits will be
- * in r1. */
- r1 += metonicCycle * (HALAKIM_PER_METONIC_CYCLE & 0xFFFF);
- r2 = r1 >> 16;
- r2 += metonicCycle * ((HALAKIM_PER_METONIC_CYCLE >> 16) & 0xFFFF);
-
- /* Calculate r2r1 / HALAKIM_PER_DAY. The remainder will be in r1, the
- * upper 16 bits of the quotient will be in d2 and the lower 16 bits
- * will be in d1. */
- d2 = r2 / HALAKIM_PER_DAY;
- r2 -= d2 * HALAKIM_PER_DAY;
- r1 = (r2 << 16) | (r1 & 0xFFFF);
- d1 = r1 / HALAKIM_PER_DAY;
- r1 -= d1 * HALAKIM_PER_DAY;
-
- *pMoladDay = (d2 << 16) | d1;
- *pMoladHalakim = r1;
-}
-
-/************************************************************************
- * Given a day number, find the molad of Tishri (the new moon at the start
- * of a year) which is closest to that day number. It's not really the
- * *closest* molad that we want here. If the input day is in the first two
- * months, we want the molad at the start of the year. If the input day is
- * in the fourth to last months, we want the molad at the end of the year.
- * If the input day is in the third month, it doesn't matter which molad is
- * returned, because both will be required. This type of "rounding" allows
- * us to avoid calculating the length of the year in most cases.
- */
-static void FindTishriMolad(
- long int inputDay,
- int *pMetonicCycle,
- int *pMetonicYear,
- long int *pMoladDay,
- long int *pMoladHalakim)
-{
- long int moladDay;
- long int moladHalakim;
- int metonicCycle;
- int metonicYear;
-
- /* Estimate the metonic cycle number. Note that this may be an under
- * estimate because there are 6939.6896 days in a metonic cycle not
- * 6940, but it will never be an over estimate. The loop below will
- * correct for any error in this estimate. */
- metonicCycle = (inputDay + 310) / 6940;
-
- /* Calculate the time of the starting molad for this metonic cycle. */
- MoladOfMetonicCycle(metonicCycle, &moladDay, &moladHalakim);
-
- /* If the above was an under estimate, increment the cycle number until
- * the correct one is found. For modern dates this loop is about 98.6%
- * likely to not execute, even once, because the above estimate is
- * really quite close. */
- while (moladDay < inputDay - 6940 + 310) {
- metonicCycle++;
- moladHalakim += HALAKIM_PER_METONIC_CYCLE;
- moladDay += moladHalakim / HALAKIM_PER_DAY;
- moladHalakim = moladHalakim % HALAKIM_PER_DAY;
- }
-
- /* Find the molad of Tishri closest to this date. */
- for (metonicYear = 0; metonicYear < 18; metonicYear++) {
- if (moladDay > inputDay - 74) {
- break;
- }
- moladHalakim += HALAKIM_PER_LUNAR_CYCLE * monthsPerYear[metonicYear];
- moladDay += moladHalakim / HALAKIM_PER_DAY;
- moladHalakim = moladHalakim % HALAKIM_PER_DAY;
- }
-
- *pMetonicCycle = metonicCycle;
- *pMetonicYear = metonicYear;
- *pMoladDay = moladDay;
- *pMoladHalakim = moladHalakim;
-}
-
-/************************************************************************
- * Given a year, find the number of the first day of that year and the date
- * and time of the starting molad.
- */
-static void FindStartOfYear(
- int year,
- int *pMetonicCycle,
- int *pMetonicYear,
- long int *pMoladDay,
- long int *pMoladHalakim,
- int *pTishri1)
-{
- *pMetonicCycle = (year - 1) / 19;
- *pMetonicYear = (year - 1) % 19;
- MoladOfMetonicCycle(*pMetonicCycle, pMoladDay, pMoladHalakim);
-
- *pMoladHalakim += HALAKIM_PER_LUNAR_CYCLE * yearOffset[*pMetonicYear];
- *pMoladDay += *pMoladHalakim / HALAKIM_PER_DAY;
- *pMoladHalakim = *pMoladHalakim % HALAKIM_PER_DAY;
-
- *pTishri1 = Tishri1(*pMetonicYear, *pMoladDay, *pMoladHalakim);
-}
-
-/************************************************************************
- * Given a serial day number (SDN), find the corresponding year, month and
- * day in the Jewish calendar. The three output values will always be
- * modified. If the input SDN is before the first day of year 1, they will
- * all be set to zero, otherwise *pYear will be > 0; *pMonth will be in the
- * range 1 to 13 inclusive; *pDay will be in the range 1 to 30 inclusive.
- */
-void SdnToJewish(
- long int sdn,
- int *pYear,
- int *pMonth,
- int *pDay)
-{
- long int inputDay;
- long int day;
- long int halakim;
- int metonicCycle;
- int metonicYear;
- int tishri1;
- int tishri1After;
- int yearLength;
-
- if (sdn <= SDN_OFFSET) {
- *pYear = 0;
- *pMonth = 0;
- *pDay = 0;
- return;
- }
- inputDay = sdn - SDN_OFFSET;
-
- FindTishriMolad(inputDay, &metonicCycle, &metonicYear, &day, &halakim);
- tishri1 = Tishri1(metonicYear, day, halakim);
-
- if (inputDay >= tishri1) {
- /* It found Tishri 1 at the start of the year. */
- *pYear = metonicCycle * 19 + metonicYear + 1;
- if (inputDay < tishri1 + 59) {
- if (inputDay < tishri1 + 30) {
- *pMonth = 1;
- *pDay = inputDay - tishri1 + 1;
- } else {
- *pMonth = 2;
- *pDay = inputDay - tishri1 - 29;
- }
- return;
- }
- /* We need the length of the year to figure this out, so find
- * Tishri 1 of the next year. */
- halakim += HALAKIM_PER_LUNAR_CYCLE * monthsPerYear[metonicYear];
- day += halakim / HALAKIM_PER_DAY;
- halakim = halakim % HALAKIM_PER_DAY;
- tishri1After = Tishri1((metonicYear + 1) % 19, day, halakim);
- } else {
- /* It found Tishri 1 at the end of the year. */
- *pYear = metonicCycle * 19 + metonicYear;
- if (inputDay >= tishri1 - 177) {
- /* It is one of the last 6 months of the year. */
- if (inputDay > tishri1 - 30) {
- *pMonth = 13;
- *pDay = inputDay - tishri1 + 30;
- } else if (inputDay > tishri1 - 60) {
- *pMonth = 12;
- *pDay = inputDay - tishri1 + 60;
- } else if (inputDay > tishri1 - 89) {
- *pMonth = 11;
- *pDay = inputDay - tishri1 + 89;
- } else if (inputDay > tishri1 - 119) {
- *pMonth = 10;
- *pDay = inputDay - tishri1 + 119;
- } else if (inputDay > tishri1 - 148) {
- *pMonth = 9;
- *pDay = inputDay - tishri1 + 148;
- } else {
- *pMonth = 8;
- *pDay = inputDay - tishri1 + 178;
- }
- return;
- } else {
- if (monthsPerYear[(*pYear - 1) % 19] == 13) {
- *pMonth = 7;
- *pDay = inputDay - tishri1 + 207;
- if (*pDay > 0)
- return;
- (*pMonth)--;
- (*pDay) += 30;
- if (*pDay > 0)
- return;
- (*pMonth)--;
- (*pDay) += 30;
- } else {
- *pMonth = 6;
- *pDay = inputDay - tishri1 + 207;
- if (*pDay > 0)
- return;
- (*pMonth)--;
- (*pDay) += 30;
- }
- if (*pDay > 0)
- return;
- (*pMonth)--;
- (*pDay) += 29;
- if (*pDay > 0)
- return;
-
- /* We need the length of the year to figure this out, so find
- * Tishri 1 of this year. */
- tishri1After = tishri1;
- FindTishriMolad(day - 365,
- &metonicCycle, &metonicYear, &day, &halakim);
- tishri1 = Tishri1(metonicYear, day, halakim);
- }
- }
-
- yearLength = tishri1After - tishri1;
- day = inputDay - tishri1 - 29;
- if (yearLength == 355 || yearLength == 385) {
- /* Heshvan has 30 days */
- if (day <= 30) {
- *pMonth = 2;
- *pDay = day;
- return;
- }
- day -= 30;
- } else {
- /* Heshvan has 29 days */
- if (day <= 29) {
- *pMonth = 2;
- *pDay = day;
- return;
- }
- day -= 29;
- }
-
- /* It has to be Kislev. */
- *pMonth = 3;
- *pDay = day;
-}
-
-/************************************************************************
- * Given a year, month and day in the Jewish calendar, find the
- * corresponding serial day number (SDN). Zero is returned when the input
- * date is detected as invalid. The return value will be > 0 for all valid
- * dates, but there are some invalid dates that will return a positive
- * value. To verify that a date is valid, convert it to SDN and then back
- * and compare with the original.
- */
-long int JewishToSdn(
- int year,
- int month,
- int day)
-{
- long int sdn;
- int metonicCycle;
- int metonicYear;
- int tishri1;
- int tishri1After;
- long int moladDay;
- long int moladHalakim;
- int yearLength;
- int lengthOfAdarIAndII;
-
- if (year <= 0 || day <= 0 || day > 30) {
- return (0);
- }
- switch (month) {
- case 1:
- case 2:
- /* It is Tishri or Heshvan - don't need the year length. */
- FindStartOfYear(year, &metonicCycle, &metonicYear,
- &moladDay, &moladHalakim, &tishri1);
- if (month == 1) {
- sdn = tishri1 + day - 1;
- } else {
- sdn = tishri1 + day + 29;
- }
- break;
-
- case 3:
- /* It is Kislev - must find the year length. */
-
- /* Find the start of the year. */
- FindStartOfYear(year, &metonicCycle, &metonicYear,
- &moladDay, &moladHalakim, &tishri1);
-
- /* Find the end of the year. */
- moladHalakim += HALAKIM_PER_LUNAR_CYCLE * monthsPerYear[metonicYear];
- moladDay += moladHalakim / HALAKIM_PER_DAY;
- moladHalakim = moladHalakim % HALAKIM_PER_DAY;
- tishri1After = Tishri1((metonicYear + 1) % 19, moladDay, moladHalakim);
-
- yearLength = tishri1After - tishri1;
-
- if (yearLength == 355 || yearLength == 385) {
- sdn = tishri1 + day + 59;
- } else {
- sdn = tishri1 + day + 58;
- }
- break;
-
- case 4:
- case 5:
- case 6:
- /* It is Tevet, Shevat or Adar I - don't need the year length. */
-
- FindStartOfYear(year + 1, &metonicCycle, &metonicYear,
- &moladDay, &moladHalakim, &tishri1After);
-
- if (monthsPerYear[(year - 1) % 19] == 12) {
- lengthOfAdarIAndII = 29;
- } else {
- lengthOfAdarIAndII = 59;
- }
-
- if (month == 4) {
- sdn = tishri1After + day - lengthOfAdarIAndII - 237;
- } else if (month == 5) {
- sdn = tishri1After + day - lengthOfAdarIAndII - 208;
- } else {
- sdn = tishri1After + day - lengthOfAdarIAndII - 178;
- }
- break;
-
- default:
- /* It is Adar II or later - don't need the year length. */
- FindStartOfYear(year + 1, &metonicCycle, &metonicYear,
- &moladDay, &moladHalakim, &tishri1After);
-
- switch (month) {
- case 7:
- sdn = tishri1After + day - 207;
- break;
- case 8:
- sdn = tishri1After + day - 178;
- break;
- case 9:
- sdn = tishri1After + day - 148;
- break;
- case 10:
- sdn = tishri1After + day - 119;
- break;
- case 11:
- sdn = tishri1After + day - 89;
- break;
- case 12:
- sdn = tishri1After + day - 60;
- break;
- case 13:
- sdn = tishri1After + day - 30;
- break;
- default:
- return (0);
- }
- }
- return (sdn + SDN_OFFSET);
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/calendar/julian.c b/ext/calendar/julian.c
deleted file mode 100644
index cf78646165..0000000000
--- a/ext/calendar/julian.c
+++ /dev/null
@@ -1,249 +0,0 @@
-/* $selId: julian.c,v 2.0 1995/10/24 01:13:06 lees Exp $
- * Copyright 1993-1995, Scott E. Lee, all rights reserved.
- * Permission granted to use, copy, modify, distribute and sell so long as
- * the above copyright and this permission statement are retained in all
- * copies. THERE IS NO WARRANTY - USE AT YOUR OWN RISK.
- */
-
-/**************************************************************************
- *
- * These are the externally visible components of this file:
- *
- * void
- * SdnToJulian(
- * long int sdn,
- * int *pYear,
- * int *pMonth,
- * int *pDay);
- *
- * Convert a SDN to a Julian calendar date. If the input SDN is less than
- * 1, the three output values will all be set to zero, otherwise *pYear
- * will be >= -4713 and != 0; *pMonth will be in the range 1 to 12
- * inclusive; *pDay will be in the range 1 to 31 inclusive.
- *
- * long int
- * JulianToSdn(
- * int inputYear,
- * int inputMonth,
- * int inputDay);
- *
- * Convert a Julian calendar date to a SDN. Zero is returned when the
- * input date is detected as invalid or out of the supported range. The
- * return value will be > 0 for all valid, supported dates, but there are
- * some invalid dates that will return a positive value. To verify that a
- * date is valid, convert it to SDN and then back and compare with the
- * original.
- *
- * VALID RANGE
- *
- * 4713 B.C. to at least 10000 A.D.
- *
- * Although this software can handle dates all the way back to 4713
- * B.C., such use may not be meaningful. The calendar was created in
- * 46 B.C., but the details did not stabilize until at least 8 A.D.,
- * and perhaps as late at the 4th century. Also, the beginning of a
- * year varied from one culture to another - not all accepted January
- * as the first month.
- *
- * CALENDAR OVERVIEW
- *
- * Julias Ceasar created the calendar in 46 B.C. as a modified form of
- * the old Roman republican calendar which was based on lunar cycles.
- * The new Julian calendar set fixed lengths for the months, abandoning
- * the lunar cycle. It also specified that there would be exactly 12
- * months per year and 365.25 days per year with every 4th year being a
- * leap year.
- *
- * Note that the current accepted value for the tropical year is
- * 365.242199 days, not 365.25. This lead to an 11 day shift in the
- * calendar with respect to the seasons by the 16th century when the
- * Gregorian calendar was created to replace the Julian calendar.
- *
- * The difference between the Julian and today's Gregorian calendar is
- * that the Gregorian does not make centennial years leap years unless
- * they are a multiple of 400, which leads to a year of 365.2425 days.
- * In other words, in the Gregorian calendar, 1700, 1800 and 1900 are
- * not leap years, but 2000 is. All centennial years are leap years in
- * the Julian calendar.
- *
- * The details are unknown, but the lengths of the months were adjusted
- * until they finally stablized in 8 A.D. with their current lengths:
- *
- * January 31
- * February 28/29
- * March 31
- * April 30
- * May 31
- * June 30
- * Quintilis/July 31
- * Sextilis/August 31
- * September 30
- * October 31
- * November 30
- * December 31
- *
- * In the early days of the calendar, the days of the month were not
- * numbered as we do today. The numbers ran backwards (decreasing) and
- * were counted from the Ides (15th of the month - which in the old
- * Roman republican lunar calendar would have been the full moon) or
- * from the Nonae (9th day before the Ides) or from the beginning of
- * the next month.
- *
- * In the early years, the beginning of the year varied, sometimes
- * based on the ascension of rulers. It was not always the first of
- * January.
- *
- * Also, today's epoch, 1 A.D. or the birth of Jesus Christ, did not
- * come into use until several centuries later when Christianity became
- * a dominant religion.
- *
- * ALGORITHMS
- *
- * The calculations are based on two different cycles: a 4 year cycle
- * of leap years and a 5 month cycle of month lengths.
- *
- * The 5 month cycle is used to account for the varying lengths of
- * months. You will notice that the lengths alternate between 30 and
- * 31 days, except for three anomalies: both July and August have 31
- * days, both December and January have 31, and February is less than
- * 30. Starting with March, the lengths are in a cycle of 5 months
- * (31, 30, 31, 30, 31):
- *
- * Mar 31 days \
- * Apr 30 days |
- * May 31 days > First cycle
- * Jun 30 days |
- * Jul 31 days /
- *
- * Aug 31 days \
- * Sep 30 days |
- * Oct 31 days > Second cycle
- * Nov 30 days |
- * Dec 31 days /
- *
- * Jan 31 days \
- * Feb 28/9 days |
- * > Third cycle (incomplete)
- *
- * For this reason the calculations (internally) assume that the year
- * starts with March 1.
- *
- * TESTING
- *
- * This algorithm has been tested from the year 4713 B.C. to 10000 A.D.
- * The source code of the verification program is included in this
- * package.
- *
- * REFERENCES
- *
- * Conversions Between Calendar Date and Julian Day Number by Robert J.
- * Tantzen, Communications of the Association for Computing Machinery
- * August 1963. (Also published in Collected Algorithms from CACM,
- * algorithm number 199). [Note: the published algorithm is for the
- * Gregorian calendar, but was adjusted to use the Julian calendar's
- * simpler leap year rule.]
- *
- **************************************************************************/
-
-#include "sdncal.h"
-
-#define SDN_OFFSET 32083
-#define DAYS_PER_5_MONTHS 153
-#define DAYS_PER_4_YEARS 1461
-
-void SdnToJulian(
- long int sdn,
- int *pYear,
- int *pMonth,
- int *pDay)
-{
- int year;
- int month;
- int day;
- long int temp;
- int dayOfYear;
-
- if (sdn <= 0) {
- *pYear = 0;
- *pMonth = 0;
- *pDay = 0;
- return;
- }
- temp = (sdn + SDN_OFFSET) * 4 - 1;
-
- /* Calculate the year and day of year (1 <= dayOfYear <= 366). */
- year = temp / DAYS_PER_4_YEARS;
- dayOfYear = (temp % DAYS_PER_4_YEARS) / 4 + 1;
-
- /* Calculate the month and day of month. */
- temp = dayOfYear * 5 - 3;
- month = temp / DAYS_PER_5_MONTHS;
- day = (temp % DAYS_PER_5_MONTHS) / 5 + 1;
-
- /* Convert to the normal beginning of the year. */
- if (month < 10) {
- month += 3;
- } else {
- year += 1;
- month -= 9;
- }
-
- /* Adjust to the B.C./A.D. type numbering. */
- year -= 4800;
- if (year <= 0)
- year--;
-
- *pYear = year;
- *pMonth = month;
- *pDay = day;
-}
-
-long int JulianToSdn(
- int inputYear,
- int inputMonth,
- int inputDay)
-{
- int year;
- int month;
-
- /* check for invalid dates */
- if (inputYear == 0 || inputYear < -4713 ||
- inputMonth <= 0 || inputMonth > 12 ||
- inputDay <= 0 || inputDay > 31) {
- return (0);
- }
- /* check for dates before SDN 1 (Jan 2, 4713 B.C.) */
- if (inputYear == -4713) {
- if (inputMonth == 1 && inputDay == 1) {
- return (0);
- }
- }
- /* Make year always a positive number. */
- if (inputYear < 0) {
- year = inputYear + 4801;
- } else {
- year = inputYear + 4800;
- }
-
- /* Adjust the start of the year. */
- if (inputMonth > 2) {
- month = inputMonth - 3;
- } else {
- month = inputMonth + 9;
- year--;
- }
-
- return ((year * DAYS_PER_4_YEARS) / 4
- + (month * DAYS_PER_5_MONTHS + 2) / 5
- + inputDay
- - SDN_OFFSET);
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/calendar/php_calendar.h b/ext/calendar/php_calendar.h
deleted file mode 100644
index d56d3af19a..0000000000
--- a/ext/calendar/php_calendar.h
+++ /dev/null
@@ -1,32 +0,0 @@
-#ifndef PHP_CALENDAR_H
-#define PHP_CALENDAR_H
-
-extern zend_module_entry calendar_module_entry;
-#define calendar_module_ptr &calendar_module_entry
-
-/* Functions */
-
-PHP_MINIT_FUNCTION(calendar);
-PHP_RINIT_FUNCTION(calendar);
-PHP_RSHUTDOWN_FUNCTION(calendar);
-PHP_MINFO_FUNCTION(calendar);
-
-PHP_FUNCTION(jdtogregorian);
-PHP_FUNCTION(gregoriantojd);
-PHP_FUNCTION(jdtojulian);
-PHP_FUNCTION(juliantojd);
-PHP_FUNCTION(jdtojewish);
-PHP_FUNCTION(jewishtojd);
-PHP_FUNCTION(jdtofrench);
-PHP_FUNCTION(frenchtojd);
-PHP_FUNCTION(jddayofweek);
-PHP_FUNCTION(jdmonthname);
-PHP_FUNCTION(easter_days);
-PHP_FUNCTION(easter_date);
-PHP_FUNCTION(unixtojd);
-PHP_FUNCTION(jdtounix);
-
-
-#define phpext_calendar_ptr calendar_module_ptr
-
-#endif
diff --git a/ext/calendar/sdncal.h b/ext/calendar/sdncal.h
deleted file mode 100644
index 6621d13682..0000000000
--- a/ext/calendar/sdncal.h
+++ /dev/null
@@ -1,96 +0,0 @@
-#ifndef SDNCAL_H
-#define SDNCAL_H
-/*
- * This code has been modified for use with PHP
- * by Shane Caraveo shane@caraveo.com
- * see below for more details
- *
- */
-
-/* $selId: sdncal.h,v 2.0 1995/10/24 01:13:06 lees Exp $
- * Copyright 1993-1995, Scott E. Lee, all rights reserved.
- * Permission granted to use, copy, modify, distribute and sell so long as
- * the above copyright and this permission statement are retained in all
- * copies. THERE IS NO WARRANTY - USE AT YOUR OWN RISK.
- */
-
-/**************************************************************************
- *
- * This package defines a set of routines that convert calendar dates to
- * and from a serial day number (SDN). The SDN is a serial numbering of
- * days where SDN 1 is November 25, 4714 BC in the Gregorian calendar and
- * SDN 2447893 is January 1, 1990. This system of day numbering is
- * sometimes referred to as Julian days, but to avoid confusion with the
- * Julian calendar, it is referred to as serial day numbers here. The term
- * Julian days is also used to mean the number of days since the beginning
- * of the current year.
- *
- * The SDN can be used as an intermediate step in converting from one
- * calendar system to another (such as Gregorian to Jewish). It can also
- * be used for date computations such as easily comparing two dates,
- * determining the day of the week, finding the date of yesterday or
- * calculating the number of days between two dates.
- *
- * When using this software on 16 bit systems, be careful to store SDNs in
- * a long int, because it will not fit in the 16 bits that some systems
- * allocate to an int.
- *
- * For each calendar, there are two routines provided. One converts dates
- * in that calendar to SDN and the other converts SDN to calendar dates.
- * The routines are named SdnTo<CALENDAR>() and <CALENDAR>ToSdn(), where
- * <CALENDAR> is the name of the calendar system.
- *
- * SDN values less than one are not supported. If a conversion routine
- * returns an SDN of zero, this means that the date given is either invalid
- * or is outside the supported range for that calendar.
- *
- * At least some validity checks are performed on input dates. For
- * example, a negative month number will result in the return of zero for
- * the SDN. A returned SDN greater than one does not necessarily mean that
- * the input date was valid. To determine if the date is valid, convert it
- * to SDN, and if the SDN is greater than zero, convert it back to a date
- * and compare to the original. For example:
- *
- * int y1, m1, d1;
- * int y2, m2, d2;
- * long int sdn;
- * ...
- * sdn = GregorianToSdn(y1, m1, d1);
- * if (sdn > 0) {
- * SdnToGregorian(sdn, &y2, &m2, &d2);
- * if (y1 == y2 && m1 == m2 && d1 == d2) {
- * ... date is valid ...
- * }
- * }
- *
- **************************************************************************/
-
-/* Gregorian calendar conversions. */
-void SdnToGregorian(long int sdn, int *pYear, int *pMonth, int *pDay);
-long int GregorianToSdn(int year, int month, int day);
-extern char *MonthNameShort[13];
-extern char *MonthNameLong[13];
-
-/* Julian calendar conversions. */
-void SdnToJulian(long int sdn, int *pYear, int *pMonth, int *pDay);
-long int JulianToSdn(int year, int month, int day);
-
-/* Jewish calendar conversions. */
-void SdnToJewish(long int sdn, int *pYear, int *pMonth, int *pDay);
-long int JewishToSdn(int year, int month, int day);
-extern char *JewishMonthName[14];
-
-/* French republic calendar conversions. */
-void SdnToFrench(long int sdn, int *pYear, int *pMonth, int *pDay);
-long int FrenchToSdn(int inputYear, int inputMonth, int inputDay);
-extern char *FrenchMonthName[14];
-
-/* Islamic calendar conversions. */
-/* Not implemented yet. */
-
-/* Day of week conversion. 0=Sunday, 6=Saturday */
-int DayOfWeek(long int sdn);
-extern char *DayNameShort[7];
-extern char *DayNameLong[7];
-
-#endif /* SDNCAL_H */
diff --git a/ext/ccvs/CREDITS b/ext/ccvs/CREDITS
deleted file mode 100644
index cc90a4653f..0000000000
--- a/ext/ccvs/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-ccvs
-Brendan W. McAdams, Doug DeJulio
diff --git a/ext/ccvs/Makefile.in b/ext/ccvs/Makefile.in
deleted file mode 100644
index 133e50c9c6..0000000000
--- a/ext/ccvs/Makefile.in
+++ /dev/null
@@ -1,8 +0,0 @@
-# $Id$
-
-LTLIBRARY_NAME = libccvs.la
-LTLIBRARY_SOURCES = ccvs.c
-LTLIBRARY_SHARED_NAME = ccvs.la
-LTLIBRARY_SHARED_LIBADD = $(CCVS_SHARED_LIBADD)
-
-include $(top_srcdir)/build/dynlib.mk
diff --git a/ext/ccvs/TODO b/ext/ccvs/TODO
deleted file mode 100644
index ffcd7af4b2..0000000000
--- a/ext/ccvs/TODO
+++ /dev/null
@@ -1,7 +0,0 @@
-CCVS Module ToDo List
-08/14/2000
-Brendan W. McAdams <bmcadams@php.net>
--------------------------------------
-- Return value of the final stats of an authorization should already be split out into a php aware associative
- array, instead of having to do this at the PHP level. Right now we are splitting stuff out using text_value;
- I'm evaluating the merits of having a seperate function for the 'finishing' of a sale....
diff --git a/ext/ccvs/ccvs.c b/ext/ccvs/ccvs.c
deleted file mode 100644
index c69bee5837..0000000000
--- a/ext/ccvs/ccvs.c
+++ /dev/null
@@ -1,605 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Brendan W. McAdams <bmcadams@php.net> |
- | Doug DeJulio <ddj@redhat.com> |
- +----------------------------------------------------------------------+
- */
-/*
-* cvvs.c $Revision$ - PHP4 Interface to the RedHat CCVS API
-* -------
-* Interfaces RedHat's CCVS [Credit Card Verification System] <http://www.redhat.com/products/ccvs/>
-* This code is ported from an original php3 interface written by RedHat's Doug DeJulio <ddj@redhat.com>
-* The code was subsequently ported to the Zend API by Brendan W. McAdams <bmcadams@php.net>
-* -------
-*/
-
-/*
-* Code started on 2000.07.24@09.04.EST by Brendan W. McAdams <bmcadams@php.net>
-* $Revision$
-*/
-
-static char const cvsid[] = "$Id$";
-
-#include <php.h>
-#include <stdlib.h>
-#include <string.h>
-#include <ccvs.h>
-
-
- /*
- * Create the Zend Internal hash construct to track this modules functions
- *
- * In case anyone is wondering why we use ccvs_<action> instead of cv_<action>,
- * it's because we are directly importing functions of the actual CCVS, which uses functions that are
- * cv_<action>, and we had problems implementing ZEND_NAMED_FE calls (bug in NAMED_FE? investigate
- * later). We don't want our PHP calls to conflict with the C calls in the CCVS API.
- *
- * BWM - 2000.07.27@16.41.EST - Added FALIAS Calls. While I'm of the opinion that naming the
- * functions in PHP ccvs_<action> is much more readable and clear to anyone reading the code than
- * cv_<action>, It strikes me that many people coming from php3 -> php4 will need backwards
- * compatibility. It was kind of careless to simply change the function calls (There were reasons other
- * than readability behind this; the ZEND_NAMED_FE macro was misbehaving) and not provide for
- * backwards compatibility - this *IS* an API and should scale with compatibility.
- *
- */
-
- function_entry ccvs_functions[] = {
- PHP_FE(ccvs_init,NULL)
- PHP_FALIAS(cv_init,ccvs_init,NULL)
- PHP_FE(ccvs_done,NULL)
- PHP_FALIAS(cv_done,ccvs_done,NULL)
- PHP_FE(ccvs_new,NULL)
- PHP_FALIAS(cv_new,ccvs_new,NULL)
- PHP_FE(ccvs_add,NULL)
- PHP_FALIAS(cv_add,ccvs_add,NULL)
- PHP_FE(ccvs_delete,NULL)
- PHP_FALIAS(cv_delete,ccvs_delete,NULL)
- PHP_FE(ccvs_auth,NULL)
- PHP_FALIAS(cv_auth,ccvs_auth,NULL)
- PHP_FE(ccvs_return,NULL)
- PHP_FALIAS(cv_return,ccvs_return,NULL)
- PHP_FE(ccvs_reverse,NULL)
- PHP_FALIAS(cv_reverse,ccvs_reverse,NULL)
- PHP_FE(ccvs_sale,NULL)
- PHP_FALIAS(cv_sale,ccvs_sale,NULL)
- PHP_FE(ccvs_void,NULL)
- PHP_FALIAS(cv_void,ccvs_void,NULL)
- PHP_FE(ccvs_status,NULL)
- PHP_FALIAS(cv_status,ccvs_status,NULL)
- PHP_FE(ccvs_count,NULL)
- PHP_FALIAS(cv_count,ccvs_count,NULL)
- PHP_FE(ccvs_lookup,NULL)
- PHP_FALIAS(cv_lookup,ccvs_lookup,NULL)
- PHP_FE(ccvs_report,NULL)
- PHP_FALIAS(cv_report,ccvs_report,NULL)
- PHP_FE(ccvs_command,NULL)
- PHP_FALIAS(cv_command,ccvs_command,NULL)
- PHP_FE(ccvs_textvalue,NULL)
- PHP_FALIAS(cv_textvalue,ccvs_textvalue,NULL)
- {NULL,NULL,NULL}
- };
-
-/* End function declarations */
-
-/* Zend Engine Exports - module information */
-
- /* Declare our module to the Zend engine */
- zend_module_entry ccvs_module_entry = {
- "CCVS",
- ccvs_functions,
- NULL,NULL,NULL,NULL,
- PHP_MINFO(ccvs),
- STANDARD_MODULE_PROPERTIES
- };
-
-#ifdef COMPILE_DL_LDAP
-ZEND_GET_MODULE(ldap)
-#endif
-
-/* Full Functions (The actual CCVS functions and any internal php hooked functions such as MINFO) */
-
-/* {{{ proto string ccvs_init(string name)
- ??? */
-PHP_FUNCTION(ccvs_init) /* cv_init() */
-{
- zval **name;
- void *vsess;
- char *p;
-
- if ((ZEND_NUM_ARGS() != 1) || (zend_get_parameters_ex(1, &name) != SUCCESS))
- /* accept only SUCCESS in case something weird gets returned instead of 'FAILURE' on fail */
- {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(name);
-
- vsess = cv_init((*name)->value.str.val);
-
- /*
- * -- In the case that we don't run error checking on the return value... --
- * On 32 bit systems a failure of the cv_init call returns 0,0,0,0 ; on 64 bit systems its 0,0,0,0,0,0,0,0
- * This unconsistent error (not to mention a string of comma seperated zeros in and of itself) is hard to
- * Trap for in PHP (or any language). However, we can also grab cv_init to return CV_SESS_BAD on
- * failure at the C API level, and return a set, fixed error code to the user which the user then knows to
- * trap for... e.g. a NULL Value which PHP can then trap by:
- * if (!($string = cv_init($config)) { or some such...
- */
-
- if (vsess == CV_SESS_BAD) /* if the cv_init() call failed... */
- {
-
- p = ""; /* set p, the value we will return, to NULL */
-
- }
- else /* we got a valid session returned, which means it worked */
- {
-
- p = hks_ptr_ptrtostring(vsess); /* Convert the (void*) into a string representation. */
-
- }
-
- RETVAL_STRING(p, 1);
-
- free(p);
- return;
-}
-/* }}} */
-
-/* {{{ proto string ccvs_done(string sess)
- ??? */
-PHP_FUNCTION(ccvs_done) /* cv_done() */
-{
- zval **sess;
- void *vsess;
-
- if ((ZEND_NUM_ARGS() != 1) || (zend_get_parameters_ex(1, &sess) != SUCCESS)) /* accept only SUCCESS in case something weird gets returned instead of 'FAILURE' on fail */
- {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(sess);
-
- /* Convert from the string representation back to a (void*) */
- vsess = hks_ptr_stringtoptr((*sess)->value.str.val);
- cv_done(vsess);
-
- RETURN_STRING("OK", 1);
-}
-/* }}} */
-
-/* {{{ proto string ccvs_new(string session, string invoice)
- ??? */
-PHP_FUNCTION(ccvs_new) /* cv_new() */
-{
- zval **psess;
- zval **pinvoice;
- void *sess;
- char *invoice;
- int r;
-
- if ((ZEND_NUM_ARGS() != 2) || (zend_get_parameters_ex(2, &psess, &pinvoice) != SUCCESS)) /* accept only SUCCESS in case something weird gets returned instead of 'FAILURE' on fail */
- {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(psess);
- if (!Z_STRVAL_PP(psess)) {
- php_error(E_WARNING, "Invalid session to ccvs_new()");
- RETURN_FALSE;
- }
-
- sess = hks_ptr_stringtoptr((*psess)->value.str.val);
-
- convert_to_string_ex(pinvoice);
- invoice = (*pinvoice)->value.str.val;
-
- r = cv_new(sess, invoice);
-
- RETURN_STRING(cv_ret2str(r), 1);
-}
-/* }}} */
-
-/* {{{ proto string ccvs_add(string session, string invoice, string argtype, string argval)
- ??? */
-PHP_FUNCTION(ccvs_add) /* cv_add() */
-{
- zval **psess;
- zval **pinvoice;
- zval **pargtype;
- zval **pargval;
- void *sess;
- char *invoice;
- int argtype;
- char *argval;
- register int r;
-
- if ((ZEND_NUM_ARGS() != 4) || (zend_get_parameters_ex(4, &psess, &pinvoice, &pargtype, &pargval) != SUCCESS)) /* accept only SUCCESS in case something weird gets returned instead of 'FAILURE' on fail */
- {
- WRONG_PARAM_COUNT;
- }
-
- /* Get meaningful arguments. */
- convert_to_string_ex(psess);
- convert_to_string_ex(pinvoice);
- convert_to_string_ex(pargtype);
- convert_to_string_ex(pargval);
- sess = hks_ptr_stringtoptr((*psess)->value.str.val);
- invoice = (*pinvoice)->value.str.val;
- argtype = cv_str2arg((*pargtype)->value.str.val);
- argval = (*pargval)->value.str.val;
-
- r = cv_add(sess, invoice, argtype, argval);
-
- RETURN_STRING(cv_ret2str(r), 1);
-}
-/* }}} */
-
-/*
-* cv_create can't be implemented because of vararg limits in PHP3's C API.
-* (COMMENT BY DDJ [from original code])
-*
-* BWM: I looked into this, checking in on what cv_create was; it is a deprecated function left in for
-* backwards compatibility according
-* to the CCVS C API ref. I didn't try to implement it for that reason. If anyone needs it, they can add it in
-* themselves I'm sure.
-*/
-
-/* {{{ proto string ccvs_delete(string session, string invoice)
- ??? */
-PHP_FUNCTION(ccvs_delete) /* cv_delete() */
-{
- zval **psess;
- zval **pinvoice;
- void *sess;
- char *invoice;
- register int r;
-
- if ((ZEND_NUM_ARGS() != 2) || (zend_get_parameters_ex(2, &psess, &pinvoice) != SUCCESS)) /* accept only SUCCESS in case something weird gets returned instead of 'FAILURE' on fail */
- {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(psess);
- convert_to_string_ex(pinvoice);
- invoice = (*pinvoice)->value.str.val;
- sess = hks_ptr_stringtoptr((*psess)->value.str.val);
-
- r = cv_delete(sess, invoice);
-
- RETURN_STRING(cv_ret2str(r), 1);
-}
-/* }}} */
-
-/* {{{ proto string ccvs_auth(string session, string invoice)
- ??? */
-PHP_FUNCTION(ccvs_auth) /* cv_auth() */
-{
- zval **psess;
- zval **pinvoice;
- void *sess;
- char *invoice;
- register int r;
-
- if ((ZEND_NUM_ARGS() != 2) || (zend_get_parameters_ex(2, &psess, &pinvoice) != SUCCESS)) /* accept only SUCCESS in case something weird gets returned instead of 'FAILURE' on fail */
- {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(psess);
- convert_to_string_ex(pinvoice);
- invoice = (*pinvoice)->value.str.val;
- sess = hks_ptr_stringtoptr((*psess)->value.str.val);
-
- r = cv_auth(sess, invoice);
-
- RETURN_STRING(cv_ret2str(r), 1);
-}
-/* }}} */
-
-/* {{{ proto string ccvs_return(string session, string invoice)
- ??? */
-PHP_FUNCTION(ccvs_return) /* cv_return() */
-{
- zval **psess;
- zval **pinvoice;
- void *sess;
- char *invoice;
- register int r;
-
- if ((ZEND_NUM_ARGS() != 2) || (zend_get_parameters_ex(2, &psess, &pinvoice) != SUCCESS)) /* accept only SUCCESS in case something weird gets returned instead of 'FAILURE' on fail */
- {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(psess);
- convert_to_string_ex(pinvoice);
- invoice = (*pinvoice)->value.str.val;
- sess = hks_ptr_stringtoptr((*psess)->value.str.val);
-
- r = cv_return(sess, invoice);
-
- RETURN_STRING(cv_ret2str(r), 1);
-}
-/* }}} */
-
-/* {{{ proto string ccvs_reverse(string session, string invoice)
- ??? */
-PHP_FUNCTION(ccvs_reverse) /* cv_reverse() */
-{
- zval **psess;
- zval **pinvoice;
- void *sess;
- char *invoice;
- register int r;
-
- if ((ZEND_NUM_ARGS() != 2) || (zend_get_parameters_ex(2, &psess, &pinvoice) != SUCCESS)) /* accept only SUCCESS in case something weird gets returned instead of 'FAILURE' on fail */
- {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(psess);
- convert_to_string_ex(pinvoice);
- invoice = (*pinvoice)->value.str.val;
- sess = hks_ptr_stringtoptr((*psess)->value.str.val);
-
- r = cv_reverse(sess, invoice);
-
- RETURN_STRING(cv_ret2str(r), 1);
-}
-/* }}} */
-
-/* {{{ proto string ccvs_sale(string session, string invoice)
- ??? */
-PHP_FUNCTION(ccvs_sale) /* cv_sale() */
-{
- zval **psess;
- zval **pinvoice;
- void *sess;
- char *invoice;
- register int r;
-
- if ((ZEND_NUM_ARGS() != 2) || (zend_get_parameters_ex(2, &psess, &pinvoice) != SUCCESS)) /* accept only SUCCESS in case something weird gets returned instead of 'FAILURE' on fail */
- {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(psess);
- convert_to_string_ex(pinvoice);
- invoice = (*pinvoice)->value.str.val;
- sess = hks_ptr_stringtoptr((*psess)->value.str.val);
-
- r = cv_sale(sess, invoice);
-
- RETURN_STRING(cv_ret2str(r), 1);
-}
-/* }}} */
-
-/* {{{ proto string ccvs_void(string session, string invoice)
- ??? */
-PHP_FUNCTION(ccvs_void) /* cv_void() */
-{
- zval **psess;
- zval **pinvoice;
- void *sess;
- char *invoice;
- register int r;
-
- if ((ZEND_NUM_ARGS() != 2) || (zend_get_parameters_ex(2, &psess, &pinvoice) != SUCCESS)) /* accept only SUCCESS in case something weird gets returned instead of 'FAILURE' on fail */
- {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(psess);
- convert_to_string_ex(pinvoice);
- invoice = (*pinvoice)->value.str.val;
- sess = hks_ptr_stringtoptr((*psess)->value.str.val);
-
- r = cv_void(sess, invoice);
-
- RETURN_STRING(cv_ret2str(r), 1);
-}
-/* }}} */
-
-/* {{{ proto string ccvs_status(string session, string invoice)
- ??? */
-PHP_FUNCTION(ccvs_status) /* cv_status() */
-{
- zval **psess;
- zval **pinvoice;
- void *sess;
- char *invoice;
- register int r;
-
- if ((ZEND_NUM_ARGS() != 2) || (zend_get_parameters_ex(2, &psess, &pinvoice) != SUCCESS)) /* accept only SUCCESS in case something weird gets returned instead of 'FAILURE' on fail */
- {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(psess);
- convert_to_string_ex(pinvoice);
- invoice = (*pinvoice)->value.str.val;
- sess = hks_ptr_stringtoptr((*psess)->value.str.val);
-
- r = cv_status(sess, invoice);
-
- RETURN_STRING(cv_stat2str(r), 1);
-}
-/* }}} */
-
-/* {{{ proto int ccvs_count(string session, string type)
- ??? */
-PHP_FUNCTION(ccvs_count) /* cv_count() */
-{
- zval **psess;
- zval **ptype;
- void *sess;
- int type;
- register int r;
-
- if ((ZEND_NUM_ARGS() != 2) || (zend_get_parameters_ex(2, &psess, &ptype) != SUCCESS)) /* accept only SUCCESS in case something weird gets returned instead of 'FAILURE' on fail */
- {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(psess);
- convert_to_string_ex(ptype);
- type = cv_str2stat((*ptype)->value.str.val);
- sess = hks_ptr_stringtoptr((*psess)->value.str.val);
-
- r = cv_count(sess, type);
-
- RETURN_LONG(r);
-}
-/* }}} */
-
-/* {{{ proto string ccvs_lookup(string session, string invoice, int inum)
- ??? */
-PHP_FUNCTION(ccvs_lookup) /* cv_lookup() */
-{
- zval **psess;
- zval **ptype;
- zval **pinum;
- void *sess;
- int type;
- long inum;
- register int r;
-
- if ((ZEND_NUM_ARGS() != 3) || (zend_get_parameters_ex(3, &psess, &ptype, &pinum) != SUCCESS)) /* accept only SUCCESS in case something weird gets returned instead of 'FAILURE' on fail */
- {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(psess);
- sess = hks_ptr_stringtoptr((*psess)->value.str.val);
- convert_to_string_ex(ptype);
- type = cv_str2stat((*ptype)->value.str.val);
- convert_to_long_ex(pinum);
- inum = (*pinum)->value.lval;
-
- r = cv_lookup(sess, type, inum);
-
- RETURN_STRING(cv_textvalue(sess), 1);
-}
-/* }}} */
-
-/* {{{ proto string ccvs_report(string session, string type)
- ??? */
-PHP_FUNCTION(ccvs_report) /* cv_report() */
-{
- zval **psess;
- zval **ptype;
- void *sess;
- int type;
- long inum;
- register int r;
-
- if ((ZEND_NUM_ARGS() != 2) || (zend_get_parameters_ex(2, &psess, &ptype) != SUCCESS)) /* accept only SUCCESS in case something weird gets returned instead of 'FAILURE' on fail */
- {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(psess);
- sess = hks_ptr_stringtoptr((*psess)->value.str.val);
- convert_to_string_ex(ptype);
- type = cv_str2rep((*ptype)->value.str.val);
-
- r = cv_report(sess, type);
-
- RETURN_STRING(cv_stat2str(r), 1);
-}
-/* }}} */
-
-/* {{{ proto string ccvs_command(string session, string type, string argval)
- ??? */
-PHP_FUNCTION(ccvs_command) /* cv_command() */
-{
- zval **psess;
- zval **ptype;
- zval **pargval;
- void *sess;
- int type;
- register int r;
- char *argval;
-
- if ((ZEND_NUM_ARGS() != 3) || (zend_get_parameters_ex(3, &psess, &ptype, &pargval) != SUCCESS)) /* accept only SUCCESS in case something weird gets returned instead of 'FAILURE' on fail */
- {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(psess);
- sess = hks_ptr_stringtoptr((*psess)->value.str.val);
- convert_to_string_ex(ptype);
- type = cv_str2cmd((*ptype)->value.str.val);
- convert_to_string_ex(pargval);
- argval = (*pargval)->value.str.val;
-
- r = cv_command(sess, type, argval);
-
- RETURN_STRING(cv_stat2str(r), 1);
-}
-/* }}} */
-
-/* {{{ proto string ccvs_textvalue(string session)
- ??? */
-PHP_FUNCTION(ccvs_textvalue) /* cv_textvalue() */
-{
- zval **psess;
- void *sess;
-
- if ((ZEND_NUM_ARGS() != 1) || (zend_get_parameters_ex(1, &psess) != SUCCESS)) /* accept only SUCCESS in case something weird gets returned instead of 'FAILURE' on fail */
- {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(psess);
- sess = hks_ptr_stringtoptr((*psess)->value.str.val);
-
- RETURN_STRING(cv_textvalue(sess), 1);
-}
-/* }}} */
-
-/*
-* Our Info Function which reports info on this module out to PHP's phpinfo() function
-* Brendan W. McAdams <bmcadams@php.net> on 2000.07.26@16:22.EST
-*/
-
-PHP_MINFO_FUNCTION(ccvs)
-{
- php_info_print_table_start();
- php_info_print_table_header(2, "RedHat CCVS support", "enabled");
- php_info_print_table_row(2,"CCVS Support by","Brendan W. McAdams &lt;bmcadams@php.net&gt;<br>&amp; Doug DeJulio &lt;ddj@redhat.com&gt;");
- php_info_print_table_row(2,"Release ID",cvsid);
- php_info_print_table_row(2,"This Release Certified For CCVS Versions","3.0 and greater");
- php_info_print_table_end();
-
- /* DISPLAY_INI_ENTRIES(); */
-
- /*
- * In the future, we will probably have entries in php.ini for runtime config, in which case we will
- * Uncomment the DISPLAY_INI_ENTRIES call...
- */
-
-}
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/ccvs/ccvs.h b/ext/ccvs/ccvs.h
deleted file mode 100644
index 1958b5869b..0000000000
--- a/ext/ccvs/ccvs.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Brendan W. McAdams <bmcadams@php.net> |
- | Doug DeJulio <ddj@redhat.com> |
- +----------------------------------------------------------------------+
-*/
-
- #include <cv_api.h>
-
- extern zend_module_entry ccvs_module_entry;
-
- #define ccvs_module_ptr &ccvs_module_entry
- #define phpext_ccvs_ptr ccvs_module_ptr
-
- /* Declare functions not in cv_api.h but in libccvs.a. */
- char *hks_ptr_ptrtostring(void *vptr);
- void *hks_ptr_stringtoptr(char *str);
-
- /* Declare the Functions this Module Makes Available to Zend */
-
-
- /* Pre-declarations of functions */
- PHP_FUNCTION(ccvs_init);
- PHP_FUNCTION(ccvs_done);
- PHP_FUNCTION(ccvs_new);
- PHP_FUNCTION(ccvs_add);
- PHP_FUNCTION(ccvs_delete);
- PHP_FUNCTION(ccvs_auth);
- PHP_FUNCTION(ccvs_return);
- PHP_FUNCTION(ccvs_reverse);
- PHP_FUNCTION(ccvs_sale);
- PHP_FUNCTION(ccvs_void);
- PHP_FUNCTION(ccvs_status);
- PHP_FUNCTION(ccvs_count);
- PHP_FUNCTION(ccvs_lookup);
- PHP_FUNCTION(ccvs_report);
- PHP_FUNCTION(ccvs_command);
- PHP_FUNCTION(ccvs_textvalue);
- PHP_MINFO_FUNCTION(ccvs);
-
- /* Declare the information we need to dynamically link this module later */
- #if COMPILE_DL
- DLEXPORT zend_module_entry *get_module(void) { return &ccvs_module_entry; }
- #endif
-
- /* End exports */
-
diff --git a/ext/ccvs/config.m4 b/ext/ccvs/config.m4
deleted file mode 100644
index 480cea070d..0000000000
--- a/ext/ccvs/config.m4
+++ /dev/null
@@ -1,26 +0,0 @@
-dnl $Id$
-dnl config.m4 for PHP4 CCVS Extension
-
-PHP_ARG_WITH(ccvs, for CCVS support,
-[ --with-ccvs[=DIR] Include CCVS support])
-
-if test "$PHP_CCVS" != "no"; then
- if test -r $PHP_CCVS/include/cv_api.h; then
- CCVS_DIR=$PHP_CCVS
- else
- for i in /usr /usr/local /usr/local/ccvs ; do
- if test -r $i/include/cv_api.h; then
- CCVS_DIR=$i
- fi
- done
- fi
-
- if test -z "$CCVS_DIR"; then
- AC_MSG_ERROR(not found. Please check your CCVS installation; cv_api.h should be in <ccvs_dir>/include/)
- fi
-
- PHP_ADD_INCLUDE($CCVS_DIR/include)
- PHP_ADD_LIBRARY_WITH_PATH(ccvs, $CCVS_DIR/lib, CCVS_SHARED_LIBADD)
- PHP_EXTENSION(ccvs, $ext_shared)
- PHP_SUBST(CCVS_SHARED_LIBADD)
-fi
diff --git a/ext/com/COM.c b/ext/com/COM.c
deleted file mode 100644
index ce9201e144..0000000000
--- a/ext/com/COM.c
+++ /dev/null
@@ -1,1743 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Zeev Suraski <zeev@zend.com> |
- | Harald Radi <h.radi@nme.at> |
- +----------------------------------------------------------------------+
- */
-
-/*
- * This module implements support for COM components that support the IDispatch
- * interface. Both local (COM) and remote (DCOM) components can be accessed.
- *
- * Type libraries can be loaded (in order for PHP to recognize automation constants)
- * by specifying a typelib_file in the PHP .ini file. That file should contain
- * paths to type libraries, one in every line. By default, constants are registered
- * as case-sensitive. If you want them to be defined as case-insensitive, add
- * #case_insensitive or #cis at the end of the type library path.
- *
- * This is also the first module to demonstrate Zend's OO syntax overloading
- * capabilities. CORBA coders are invited to write a CORBA module as well!
- *
- * Zeev
- */
-
-/*
- * 28.12.2000
- * unicode conversion fixed by Harald Radi <h.radi@nme.at>
- *
- * now all these strange '?'s should be disapeared
- */
-
-/*
- * 28.1.2001
- * VARIANT datatype and pass_by_reference support
- */
-
-/*
- * 03.6.2001
- * Enhanced Typelib support to include a search by name
- */
-
-#ifdef PHP_WIN32
-
-#define _WIN32_DCOM
-
-#include <iostream.h>
-#include <math.h>
-
-#include "php.h"
-#include "php_ini.h"
-#include "com.h"
-
-#include "conversion.h"
-
-zend_class_entry com_class_entry;
-
-PHP_FUNCTION(com_load);
-PHP_FUNCTION(com_invoke);
-PHP_FUNCTION(com_addref);
-PHP_FUNCTION(com_release);
-PHP_FUNCTION(com_propget);
-PHP_FUNCTION(com_propput);
-PHP_FUNCTION(com_load_typelib);
-PHP_FUNCTION(com_isenum);
-
-PHPAPI int php_COM_get_le_idispatch();
-static ITypeLib *php_COM_find_typelib(char *search_string, int mode);
-static int php_COM_load_typelib(ITypeLib *TypeLib, int mode);
-
-static int le_idispatch;
-static int codepage;
-
-function_entry COM_functions[] = {
- PHP_FE(com_load, NULL)
- PHP_FE(com_invoke, NULL)
- PHP_FE(com_addref, NULL)
- PHP_FE(com_release, NULL)
- PHP_FE(com_propget, NULL)
- PHP_FE(com_propput, NULL)
- PHP_FE(com_load_typelib, NULL)
- PHP_FE(com_isenum, NULL)
-
- PHP_FALIAS(com_get, com_propget, NULL)
- PHP_FALIAS(com_propset, com_propput, NULL)
- PHP_FALIAS(com_set, com_propput, NULL)
-
-
- {
- NULL, NULL, NULL
- }
-};
-
-static PHP_MINFO_FUNCTION(COM)
-{
- DISPLAY_INI_ENTRIES();
-}
-
-PHPAPI HRESULT php_COM_invoke(comval *obj, DISPID dispIdMember, WORD wFlags, DISPPARAMS FAR* pDispParams, VARIANT FAR* pVarResult)
-{
- HRESULT hr;
- int failed = FALSE;
-
- if(C_ISREFD(obj))
- {
- if(C_HASTLIB(obj))
- {
- hr = C_TYPEINFO_VT(obj)->Invoke(C_TYPEINFO(obj), C_DISPATCH(obj), dispIdMember, wFlags, pDispParams, pVarResult, NULL, NULL);
- if(FAILED(hr))
- {
- hr = C_DISPATCH_VT(obj)->Invoke(C_DISPATCH(obj), dispIdMember, &IID_NULL, LOCALE_SYSTEM_DEFAULT, wFlags, pDispParams, pVarResult, NULL, NULL);
- if(SUCCEEDED(hr))
- {
- /*
- * ITypLib doesn't work
- * Release ITypeLib and fall back to IDispatch
- */
-
- C_TYPEINFO_VT(obj)->Release(C_TYPEINFO(obj));
- C_HASTLIB(obj) = FALSE;
- }
- }
- }
- else
- {
- hr = C_DISPATCH_VT(obj)->Invoke(C_DISPATCH(obj), dispIdMember, &IID_NULL, LOCALE_SYSTEM_DEFAULT, wFlags, pDispParams, pVarResult, NULL, NULL);
- }
-
- return hr;
- }
- else
- {
- return DISP_E_UNKNOWNINTERFACE;
- }
-}
-
-PHPAPI HRESULT php_COM_get_ids_of_names(comval *obj, OLECHAR FAR* FAR* rgszNames, DISPID FAR* rgDispId)
-{
- HRESULT hr;
-
- if(C_ISREFD(obj))
- {
- if(C_HASTLIB(obj))
- {
- hr = C_TYPEINFO_VT(obj)->GetIDsOfNames(C_TYPEINFO(obj), rgszNames, 1, rgDispId);
-
- if(FAILED(hr))
- {
- hr = C_DISPATCH_VT(obj)->GetIDsOfNames(C_DISPATCH(obj), &IID_NULL, rgszNames, 1, LOCALE_SYSTEM_DEFAULT, rgDispId);
-
- if(SUCCEEDED(hr))
- {
- /*
- * ITypLib doesn't work
- * Release ITypeLib and fall back to IDispatch
- */
-
- C_TYPEINFO_VT(obj)->Release(C_TYPEINFO(obj));
- C_HASTLIB(obj) = FALSE;
- }
- }
- }
- else
- {
- hr = C_DISPATCH_VT(obj)->GetIDsOfNames(C_DISPATCH(obj), &IID_NULL, rgszNames, 1, LOCALE_SYSTEM_DEFAULT, rgDispId);
- }
-
- return hr;
- }
- else
- {
- return DISP_E_UNKNOWNINTERFACE;
- }
-}
-
-PHPAPI HRESULT php_COM_release(comval *obj)
-{
- if(obj->refcount > 1)
- {
- C_RELEASE(obj);
- }
- else if(obj->refcount == 1)
- {
- if(C_HASTLIB(obj))
- {
- C_TYPEINFO_VT(obj)->Release(C_TYPEINFO(obj));
- }
- if(C_HASENUM(obj))
- {
- C_ENUMVARIANT_VT(obj)->Release(C_ENUMVARIANT(obj));
- }
- C_DISPATCH_VT(obj)->Release(C_DISPATCH(obj));
- C_RELEASE(obj);
- }
-
- return obj->refcount;
-}
-
-PHPAPI HRESULT php_COM_addref(comval *obj)
-{
- if(C_ISREFD(obj))
- {
- C_ADDREF(obj);
- }
-
- return obj->refcount;
-}
-
-PHPAPI HRESULT php_COM_set(comval *obj, IDispatch FAR* pDisp, int cleanup)
-{
- HRESULT hr = 1;
- DISPPARAMS dispparams;
- VARIANT var_result;
-
- C_DISPATCH(obj) = pDisp;
- obj->refcount = 1;
- C_HASTLIB(obj) = SUCCEEDED(C_DISPATCH_VT(obj)->GetTypeInfo(C_DISPATCH(obj), 0, LANG_NEUTRAL, &C_TYPEINFO(obj)));
-
- dispparams.rgvarg = NULL;
- dispparams.rgdispidNamedArgs = NULL;
- dispparams.cArgs = 0;
- dispparams.cNamedArgs = 0;
-
- if(C_HASENUM(obj) = SUCCEEDED(C_DISPATCH_VT(obj)->Invoke(C_DISPATCH(obj), DISPID_NEWENUM, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
- DISPATCH_METHOD|DISPATCH_PROPERTYGET, &dispparams, &var_result, NULL, NULL)))
- {
- if (V_VT(&var_result) == VT_UNKNOWN)
- {
- C_HASENUM(obj) = SUCCEEDED(V_UNKNOWN(&var_result)->lpVtbl->QueryInterface(V_UNKNOWN(&var_result), &IID_IEnumVARIANT,
- (void**)&C_ENUMVARIANT(obj)));
- }
- else if (V_VT(&var_result) == VT_DISPATCH)
- {
- C_HASENUM(obj) = SUCCEEDED(V_DISPATCH(&var_result)->lpVtbl->QueryInterface(V_DISPATCH(&var_result), &IID_IEnumVARIANT,
- (void**)&C_ENUMVARIANT(obj)));
- }
-
- }
-
- if(!cleanup)
- {
- hr = C_DISPATCH_VT(obj)->AddRef(C_DISPATCH(obj));
- }
-
- return hr;
-}
-
-PHPAPI HRESULT php_COM_clone(comval *obj, comval *clone, int cleanup)
-{
- HRESULT hr;
-
- C_HASTLIB(obj) = C_HASTLIB(clone);
- C_HASENUM(obj) = C_HASENUM(obj);
- C_DISPATCH(obj) = C_DISPATCH(clone);
- C_TYPEINFO(obj) = C_TYPEINFO(clone);
-
- if(cleanup || !C_ISREFD(obj))
- {
- obj->refcount = clone->refcount;
- C_ISREFD(clone) = FALSE;
- }
- else
- {
- if(C_HASTLIB(obj))
- {
- C_TYPEINFO_VT(obj)->AddRef(C_TYPEINFO(obj));
- }
- if(C_HASENUM(obj))
- {
- C_ENUMVARIANT_VT(obj)->AddRef(C_ENUMVARIANT(obj));
- }
- hr = C_DISPATCH_VT(obj)->AddRef(C_DISPATCH(obj));
- obj->refcount = 1;
- }
-
- return hr;
-}
-
-PHPAPI char *php_COM_error_message(HRESULT hr)
-{
- void *pMsgBuf;
-
- if(!FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, NULL,
- hr, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR) &pMsgBuf, 0, NULL))
- {
- char error_string[] = "No description available";
-
- pMsgBuf = LocalAlloc(LMEM_FIXED, sizeof(error_string));
- memcpy(pMsgBuf, error_string, sizeof(error_string));
- }
-
- return pMsgBuf;
-}
-
-static char *php_string_from_clsid(const CLSID *clsid)
-{
- LPOLESTR ole_clsid;
- char *clsid_str;
-
- StringFromCLSID(clsid, &ole_clsid);
- clsid_str = php_OLECHAR_to_char(ole_clsid, NULL, 0, codepage);
- LocalFree(ole_clsid);
-
- return clsid_str;
-}
-
-static void php_idispatch_destructor(zend_rsrc_list_entry *rsrc)
-{
- comval *obj = (comval *)rsrc->ptr;
- while(C_ISREFD(obj))
- {
- php_COM_release(obj);
- }
- efree(obj);
-}
-
-static PHP_INI_MH(OnTypelibFileChange)
-{
- FILE *typelib_file;
- char *typelib_name_buffer;
- char *strtok_buf = NULL;
-#if SUPPORT_INTERACTIVE
- int interactive;
- ELS_FETCH();
-
- interactive = EG(interactive);
-#endif
-
-
- if(!new_value || (typelib_file=VCWD_FOPEN(new_value, "r"))==NULL)
- {
- return FAILURE;
- }
-
-#if SUPPORT_INTERACTIVE
- if(interactive)
- {
- printf("Loading type libraries...");
- fflush(stdout);
- }
-#endif
-
- typelib_name_buffer = (char *) emalloc(sizeof(char)*1024);
-
- while(fgets(typelib_name_buffer, 1024, typelib_file))
- {
- ITypeLib *pTL;
- char *typelib_name;
- char *modifier, *ptr;
- int mode = CONST_PERSISTENT|CONST_CS;
-
- if(typelib_name_buffer[0]==';')
- {
- continue;
- }
- typelib_name = php_strtok_r(typelib_name_buffer, "\r\n", &strtok_buf); /* get rid of newlines */
- if(typelib_name == NULL)
- {
- continue;
- }
- typelib_name = php_strtok_r(typelib_name, "#", &strtok_buf);
- modifier = php_strtok_r(NULL, "#", &strtok_buf);
- if(modifier != NULL)
- {
- if(!strcmp(modifier, "cis") || !strcmp(modifier, "case_insensitive"))
- {
- mode &= ~CONST_CS;
- }
- }
-
- /* Remove leading/training white spaces on search_string */
- while(isspace(*typelib_name)) /* Ends on '\0' in worst case */
- {
- typelib_name ++;
- }
- ptr = typelib_name + strlen(typelib_name) - 1;
- while((ptr != typelib_name) && isspace(*ptr))
- {
- *ptr = '\0';
- ptr--;
- }
-
-
-#if SUPPORT_INTERACTIVE
- if(interactive)
- {
- printf("\rLoading %-60s\r", typelib_name);
- }
-#endif
- if((pTL = php_COM_find_typelib(typelib_name, mode)) != NULL)
- {
- php_COM_load_typelib(pTL, mode);
- pTL->lpVtbl->Release(pTL);
- }
- }
-
- efree(typelib_name_buffer);
- fclose(typelib_file);
-
-#if SUPPORT_INTERACTIVE
- if(interactive)
- {
- printf("\r%70s\r", "");
- }
-#endif
-
- return SUCCESS;
-}
-
-
-PHP_INI_BEGIN()
-PHP_INI_ENTRY_EX("com.allow_dcom", "0", PHP_INI_SYSTEM, NULL, php_ini_boolean_displayer_cb)
-PHP_INI_ENTRY_EX("com.autoregister_typelib", "0", PHP_INI_SYSTEM, NULL, php_ini_boolean_displayer_cb)
-PHP_INI_ENTRY_EX("com.autoregister_casesensitive", "1", PHP_INI_SYSTEM, NULL, php_ini_boolean_displayer_cb)
-PHP_INI_ENTRY("com.typelib_file", "", PHP_INI_SYSTEM, OnTypelibFileChange)
-PHP_INI_END()
-
-
-/* {{{ proto int com_load(string module_name [, string remote_host [, int codepage[, string typelib]]])
- Loads a COM module */
-PHP_FUNCTION(com_load)
-{
- pval *module_name, *code_page, *typelib = NULL, *server_name = NULL;
- CLSID clsid;
- HRESULT hr;
- OLECHAR *ProgID;
- comval *obj;
- char *error_message;
- char *clsid_str;
- int mode = CONST_PERSISTENT;
- ITypeLib *pTL;
-
-
- codepage = CP_ACP;
-
- switch(ZEND_NUM_ARGS())
- {
- case 1:
- getParameters(ht, 1, &module_name);
- break;
-
- case 2:
- getParameters(ht, 2, &module_name, &server_name);
- break;
-
- case 3:
- getParameters(ht, 3, &module_name, &server_name, &code_page);
-
- convert_to_long_ex(&code_page);
- codepage = code_page->value.lval;
- break;
-
- case 4:
- getParameters(ht, 4, &module_name, &server_name, &code_page, &typelib);
-
- convert_to_string_ex(&typelib);
- convert_to_long_ex(&code_page);
- codepage = Z_LVAL_P(code_page);
-
- break;
-
- default:
- WRONG_PARAM_COUNT;
- }
-
- if(server_name != NULL)
- {
- if(Z_TYPE_P(server_name) == IS_NULL)
- {
- server_name = NULL;
- }
- else
- {
- if(!INI_INT("com.allow_dcom"))
- {
- php_error(E_WARNING, "DCOM is disabled");
- RETURN_FALSE;
- }
- else
- {
- convert_to_string_ex(&server_name);
- }
- }
- }
-
- convert_to_string_ex(&module_name);
- ProgID = php_char_to_OLECHAR(Z_STRVAL_P(module_name), Z_STRLEN_P(module_name), codepage);
- obj = (comval *) emalloc(sizeof(comval));
-
- /* obtain CLSID */
- if(FAILED(CLSIDFromProgID(ProgID, &clsid)))
- {
- /* Perhaps this is a Moniker? */
- IBindCtx *pBindCtx;
- IMoniker *pMoniker;
- ULONG ulEaten;
-
- /* TODO: if(server_name) */
-
- if(!server_name)
- {
- if(SUCCEEDED(hr = CreateBindCtx(0, &pBindCtx)))
- {
- if(SUCCEEDED(hr = MkParseDisplayName(pBindCtx, ProgID, &ulEaten, &pMoniker)))
- {
- hr = pMoniker->lpVtbl->BindToObject(pMoniker, pBindCtx, NULL, &IID_IDispatch, (LPVOID *) &C_DISPATCH(obj));
- pMoniker->lpVtbl->Release(pMoniker);
- }
- pBindCtx->lpVtbl->Release(pBindCtx);
- }
- }
- else
- {
- hr = MK_E_SYNTAX;
- }
-
- efree(ProgID);
-
- if(FAILED(hr))
- {
- efree(obj);
- error_message = php_COM_error_message(hr);
- php_error(E_WARNING,"Invalid ProgID or Moniker: %s\n", error_message);
- LocalFree(error_message);
- RETURN_FALSE;
- }
- }
- else
- {
- efree(ProgID);
- /* obtain IDispatch */
- if(!server_name)
- {
- hr = CoCreateInstance(&clsid, NULL, CLSCTX_SERVER, &IID_IDispatch, (LPVOID *) &C_DISPATCH(obj));
- }
- else
- {
- COSERVERINFO server_info;
- MULTI_QI pResults;
-
- server_info.dwReserved1=0;
- server_info.dwReserved2=0;
- server_info.pwszName = php_char_to_OLECHAR(Z_STRVAL_P(server_name), Z_STRLEN_P(server_name), codepage);
- server_info.pAuthInfo=NULL;
-
- pResults.pIID = &IID_IDispatch;
- pResults.pItf = NULL;
- pResults.hr = S_OK;
- hr=CoCreateInstanceEx(&clsid, NULL, CLSCTX_SERVER, &server_info, 1, &pResults);
- if(SUCCEEDED(hr))
- {
- hr = pResults.hr;
- C_DISPATCH(obj) = (IDispatch *) pResults.pItf;
- }
- efree(server_info.pwszName);
- }
-
- if(FAILED(hr))
- {
- error_message = php_COM_error_message(hr);
- clsid_str = php_string_from_clsid(&clsid);
- php_error(E_WARNING,"Unable to obtain IDispatch interface for CLSID %s: %s",clsid_str,error_message);
- LocalFree(error_message);
- efree(clsid_str);
- efree(obj);
- RETURN_FALSE;
- }
- }
-
- php_COM_set(obj, C_DISPATCH(obj), TRUE);
-
- if(INI_INT("com.autoregister_casesensitive"))
- {
- mode |= CONST_CS;
- }
-
- if(C_HASTLIB(obj))
- {
- if(INI_INT("com.autoregister_typelib"))
- {
- unsigned int idx;
-
- if(C_TYPEINFO_VT(obj)->GetContainingTypeLib(C_TYPEINFO(obj), &pTL, &idx) == S_OK)
- {
- php_COM_load_typelib(pTL, mode);
- pTL->lpVtbl->Release(pTL);
- }
- }
- }
- else
- {
- if(typelib != NULL)
- {
- ITypeLib *pTL;
-
- if((pTL = php_COM_find_typelib(Z_STRVAL_P(typelib), mode)) != NULL)
- {
- C_HASTLIB(obj) = SUCCEEDED(pTL->lpVtbl->GetTypeInfo(pTL, 0, &C_TYPEINFO(obj)));
- /* idx 0 should deliver the ITypeInfo for the IDispatch Interface */
- if(INI_INT("com.autoregister_typelib"))
- {
- php_COM_load_typelib(pTL, mode);
- }
- pTL->lpVtbl->Release(pTL);
- }
- }
- }
-
- RETURN_LONG(zend_list_insert(obj, le_idispatch));
-}
-/* }}} */
-
-
-int do_COM_invoke(comval *obj, pval *function_name, VARIANT *var_result, pval **arguments, int arg_count)
-{
- DISPID dispid;
- HRESULT hr;
- OLECHAR *funcname;
- char *error_message;
- VARIANT *variant_args;
- int current_arg, current_variant;
- DISPPARAMS dispparams;
- SAFEARRAY *pSA;
-
- if(C_HASENUM(obj) && strstr(Z_STRVAL_P(function_name), "next"))
- {
- // Grab one argument off the stack, allocate enough
- // VARIANTs
- // Get the IEnumVariant interface and call ->Next();
- SAFEARRAYBOUND rgsabound[1];
- unsigned long count;
-
- switch(arg_count)
- {
- case 0:
- count = 1;
- break;
-
- case 1:
- convert_to_long_ex(&arguments[0]);
- count = Z_LVAL_P(arguments[0]);
- break;
-
- default:
- /* TODO: complain about wrong arg count */
- php_error(E_WARNING,"Wrong argument count to IEnumVariant::Next()\n");
-
- return FAILURE;
- }
-
- rgsabound[0].lLbound = 0;
- rgsabound[0].cElements = count;
-
- if((pSA = SafeArrayCreate(VT_VARIANT, 1, rgsabound)) == NULL)
- {
- VariantInit(var_result);
- return FAILURE;
- }
- else
- {
- V_ARRAY(var_result) = pSA;
- V_VT(var_result) = VT_VARIANT|VT_ARRAY;
- }
-
- if(FAILED(hr = C_ENUMVARIANT_VT(obj)->Next(C_ENUMVARIANT(obj), count, pSA->pvData, &count)))
- {
- char *error_message = php_COM_error_message(hr);
- php_error(E_WARNING,"IEnumVariant::Next() failed: %s\n", error_message);
- efree(error_message);
- SafeArrayDestroy(pSA);
- VariantInit(var_result);
- return FAILURE;
- }
-
- if(count != rgsabound[0].cElements)
- {
- rgsabound[0].cElements = count;
- if(FAILED(SafeArrayRedim(pSA, rgsabound)))
- {
- char *error_message = php_COM_error_message(hr);
- php_error(E_WARNING,"IEnumVariant::Next() failed: %s\n", error_message);
- efree(error_message);
- SafeArrayDestroy(pSA);
- VariantInit(var_result);
- return FAILURE;
- }
- }
-
- return SUCCESS;
- }
- else if(C_HASENUM(obj) && strstr(Z_STRVAL_P(function_name), "reset"))
- {
- if(FAILED(hr = C_ENUMVARIANT_VT(obj)->Reset(C_ENUMVARIANT(obj))))
- {
- char *error_message = php_COM_error_message(hr);
- php_error(E_WARNING,"IEnumVariant::Next() failed: %s\n", error_message);
- efree(error_message);
- return FAILURE;
- }
- return SUCCESS;
- }
- else if(C_HASENUM(obj) && strstr(Z_STRVAL_P(function_name), "skip"))
- {
- unsigned long count;
-
- switch(arg_count)
- {
- case 0:
- count = 1;
- break;
-
- case 1:
- convert_to_long_ex(&arguments[0]);
- count = Z_LVAL_P(arguments[0]);
- break;
-
- default:
- php_error(E_WARNING,"Wrong argument count to IEnumVariant::Skip()\n");
- return FAILURE;
- }
- if(FAILED(hr = C_ENUMVARIANT_VT(obj)->Skip(C_ENUMVARIANT(obj), count)))
- {
- char *error_message = php_COM_error_message(hr);
- php_error(E_WARNING,"IEnumVariant::Next() failed: %s\n", error_message);
- efree(error_message);
- return FAILURE;
- }
- return SUCCESS;
-
- }
- else
- {
- funcname = php_char_to_OLECHAR(Z_STRVAL_P(function_name), Z_STRLEN_P(function_name), codepage);
-
- hr = php_COM_get_ids_of_names(obj, &funcname, &dispid);
-
- if(FAILED(hr))
- {
- error_message = php_COM_error_message(hr);
- php_error(E_WARNING,"Unable to lookup %s: %s\n", Z_STRVAL_P(function_name), error_message);
- LocalFree(error_message);
- efree(funcname);
- return FAILURE;
- }
-
- variant_args = (VARIANT*) emalloc(sizeof(VARIANT)*arg_count);
-
- for(current_arg=0; current_arg<arg_count; current_arg++)
- {
- current_variant = arg_count - current_arg - 1;
- php_pval_to_variant(arguments[current_arg], &variant_args[current_variant], codepage);
- }
-
- dispparams.rgvarg = variant_args;
- dispparams.rgdispidNamedArgs = NULL;
- dispparams.cArgs = arg_count;
- dispparams.cNamedArgs = 0;
-
- hr = php_COM_invoke(obj, dispid, DISPATCH_METHOD|DISPATCH_PROPERTYGET, &dispparams, var_result);
-
- if(FAILED(hr))
- {
- error_message = php_COM_error_message(hr);
- php_error(E_WARNING,"Invoke() failed: %s\n", error_message);
- LocalFree(error_message);
- efree(funcname);
- efree(variant_args);
- return FAILURE;
- }
-
- efree(variant_args);
- efree(funcname);
- }
- return SUCCESS;
-}
-
-
-/* {{{ proto mixed com_invoke(int module, string handler_name [, mixed arg [, ...]])
- Invokes a COM module */
-PHP_FUNCTION(com_invoke)
-{
- pval **arguments;
- pval *object, *function_name;
- comval *obj;
- int type;
- int arg_count = ZEND_NUM_ARGS();
- VARIANT var_result;
-
- if(arg_count<2)
- {
- WRONG_PARAM_COUNT;
- }
- arguments = (pval **) emalloc(sizeof(pval *)*arg_count);
- if(getParametersArray(ht, arg_count, arguments)==FAILURE)
- {
- RETURN_FALSE;
- }
-
- object = arguments[0];
- function_name = arguments[1];
-
- /* obtain IDispatch interface */
- convert_to_long(object);
- obj = (comval *)zend_list_find(Z_LVAL_P(object), &type);
- if(!obj || (type!=le_idispatch))
- {
- php_error(E_WARNING,"%d is not a COM object handler", Z_STRVAL_P(function_name));
- RETURN_FALSE;
- }
-
- /* obtain property/method handler */
- convert_to_string_ex(&function_name);
-
- if(do_COM_invoke(obj, function_name, &var_result, arguments+2, arg_count-2)==FAILURE)
- {
- RETURN_FALSE;
- }
- efree(arguments);
-
- php_variant_to_pval(&var_result, return_value, 0, codepage);
-}
-/* }}} */
-
-/* {{{ proto mixed com_invoke(int module)
- Releases a COM object */
-PHP_FUNCTION(com_release)
-{
- pval *object;
- comval *obj;
- int type;
- int arg_count = ZEND_NUM_ARGS();
-
- if(arg_count != 1)
- {
- WRONG_PARAM_COUNT;
- }
-
- if(getParameters(ht, 1, &object)==FAILURE)
- {
- RETURN_FALSE;
- }
-
- /* obtain IDispatch interface */
- convert_to_long_ex(&object);
- obj = (comval *)zend_list_find(Z_LVAL_P(object), &type);
- if(!obj || (type != le_idispatch))
- {
- php_error(E_WARNING,"%d is not a COM object handler");
- RETURN_FALSE;
- }
-
- RETURN_LONG(php_COM_release(obj))
-}
-/* }}} */
-
-/* {{{ proto mixed com_addref(int module)
- Increases the reference counter on a COM object */
-PHP_FUNCTION(com_addref)
-{
- pval *object;
- comval *obj;
- int type;
- int arg_count = ZEND_NUM_ARGS();
-
- if(arg_count != 1)
- {
- WRONG_PARAM_COUNT;
- }
-
- if(getParameters(ht, 1, &object)==FAILURE)
- {
- RETURN_FALSE;
- }
-
- /* obtain IDispatch interface */
- convert_to_long_ex(&object);
- obj = (comval *)zend_list_find(Z_LVAL_P(object), &type);
- if(!obj || (type != le_idispatch))
- {
- php_error(E_WARNING,"%d is not a COM object handler");
- RETURN_FALSE;
- }
-
- RETURN_LONG(php_COM_addref(obj));
-}
-/* }}} */
-
-static int do_COM_offget(VARIANT *result, comval *array, pval *property, int cleanup)
-{
- pval function_name;
- int retval;
-
- ZVAL_STRINGL(&function_name, "Item", 4, 0);
- retval = do_COM_invoke(array, &function_name, result, &property, 1);
- if(cleanup)
- {
- php_COM_release(array);
- efree(array);
- }
-
- return retval;
-}
-
-static int do_COM_propget(VARIANT *var_result, comval *obj, pval *arg_property, int cleanup)
-{
- DISPID dispid;
- HRESULT hr;
- OLECHAR *propname;
- char *error_message;
- DISPPARAMS dispparams;
-
-
- /* obtain property handler */
- propname = php_char_to_OLECHAR(Z_STRVAL_P(arg_property), Z_STRLEN_P(arg_property), codepage);
-
- hr = php_COM_get_ids_of_names(obj, &propname, &dispid);
-
- if(FAILED(hr))
- {
- error_message = php_COM_error_message(hr);
- php_error(E_WARNING,"Unable to lookup %s: %s\n", Z_STRVAL_P(arg_property), error_message);
- LocalFree(error_message);
- efree(propname);
- if(cleanup)
- {
- php_COM_release(obj);
- }
- return FAILURE;
- }
-
- dispparams.cArgs = 0;
- dispparams.cNamedArgs = 0;
-
- hr = php_COM_invoke(obj, dispid, DISPATCH_PROPERTYGET, &dispparams, var_result);
-
- if(FAILED(hr))
- {
- error_message = php_COM_error_message(hr);
- php_error(E_WARNING,"PropGet() failed: %s\n", error_message);
- LocalFree(error_message);
- efree(propname);
- if(cleanup)
- {
- php_COM_release(obj);
- }
- return FAILURE;
- }
-
- efree(propname);
- if(cleanup)
- {
- php_COM_release(obj);
- }
- return SUCCESS;
-}
-
-
-static void do_COM_propput(pval *return_value, comval *obj, pval *arg_property, pval *value)
-{
- DISPID dispid;
- HRESULT hr;
- OLECHAR *propname;
- char *error_message;
- VARIANT *var_result;
- DISPPARAMS dispparams;
- VARIANT new_value;
- DISPID mydispid = DISPID_PROPERTYPUT;
-
-
- var_result = emalloc(sizeof(VARIANT));
-
- /* obtain property handler */
- propname = php_char_to_OLECHAR(Z_STRVAL_P(arg_property), Z_STRLEN_P(arg_property), codepage);
-
- hr = php_COM_get_ids_of_names(obj, &propname, &dispid);
-
- if(FAILED(hr))
- {
- error_message = php_COM_error_message(hr);
- php_error(E_WARNING,"Unable to lookup %s: %s\n", Z_STRVAL_P(arg_property), error_message);
- LocalFree(error_message);
- efree(propname);
- RETURN_FALSE;
- }
-
- php_pval_to_variant(value, &new_value, codepage);
- dispparams.rgvarg = &new_value;
- dispparams.rgdispidNamedArgs = &mydispid;
- dispparams.cArgs = 1;
- dispparams.cNamedArgs = 1;
-
- hr = php_COM_invoke(obj, dispid, DISPATCH_PROPERTYPUT, &dispparams, NULL);
-
- if(FAILED(hr))
- {
- error_message = php_COM_error_message(hr);
- php_error(E_WARNING,"PropPut() failed: %s\n", error_message);
- LocalFree(error_message);
- efree(propname);
- RETURN_FALSE;
- }
-
- dispparams.cArgs = 0;
- dispparams.cNamedArgs = 0;
-
- hr = php_COM_invoke(obj, dispid, DISPATCH_PROPERTYGET, &dispparams, var_result);
-
- if(SUCCEEDED(hr))
- {
- php_variant_to_pval(var_result, return_value, 0, codepage);
- }
- else
- {
- *return_value = *value;
- zval_copy_ctor(return_value);
- }
-
- efree(var_result);
- efree(propname);
-}
-
-
-/* {{{ proto mixed com_propget(int module, string property_name)
- Gets properties from a COM module */
-PHP_FUNCTION(com_propget)
-{
- pval *arg_idispatch, *arg_property;
- int type;
- comval *obj;
- VARIANT var_result;
-
- if(ZEND_NUM_ARGS()!=2 || getParameters(ht, 2, &arg_idispatch, &arg_property)==FAILURE)
- {
- WRONG_PARAM_COUNT;
- }
-
- /* obtain IDispatch interface */
- convert_to_long(arg_idispatch);
- obj = (comval *)zend_list_find(Z_LVAL_P(arg_idispatch), &type);
- if(!obj || (type != le_idispatch))
- {
- php_error(E_WARNING,"%d is not a COM object handler", Z_LVAL_P(arg_idispatch));
- }
- convert_to_string_ex(&arg_property);
-
- if(do_COM_propget(&var_result, obj, arg_property, 0)==FAILURE)
- {
- RETURN_FALSE;
- }
- php_variant_to_pval(&var_result, return_value, 0, codepage);
-}
-/* }}} */
-
-
-/* {{{ proto bool com_propput(int module, string property_name, mixed value)
- Puts the properties for a module */
-PHP_FUNCTION(com_propput)
-{
- pval *arg_idispatch, *arg_property, *arg_value;
- int type;
- comval *obj;
-
- if(ZEND_NUM_ARGS()!=3 || getParameters(ht, 3, &arg_idispatch, &arg_property, &arg_value)==FAILURE)
- {
- WRONG_PARAM_COUNT;
- }
-
- /* obtain comval interface */
- convert_to_long(arg_idispatch);
- /* obtain comval interface */
- obj = (comval *)zend_list_find(Z_LVAL_P(arg_idispatch), &type);
- if(!obj || (type != le_idispatch))
- {
- php_error(E_WARNING,"%d is not a COM object handler", Z_LVAL_P(arg_idispatch));
- }
- convert_to_string_ex(&arg_property);
-
- do_COM_propput(return_value, obj, arg_property, arg_value);
-}
-/* }}} */
-
-/* {{{ proto bool com_load_typelib(string typelib_name[, int case_insensitiv]) */
-PHP_FUNCTION(com_load_typelib)
-{
- pval *arg_typelib, *arg_cis;
- ITypeLib *pTL;
- int mode;
-
- switch(ZEND_NUM_ARGS())
- {
- case 1:
- getParameters(ht, 1, &arg_typelib);
- mode = CONST_PERSISTENT|CONST_CS;
- break;
- case 2:
- getParameters(ht, 2, &arg_typelib, &arg_cis);
- convert_to_boolean_ex(&arg_cis);
- if(arg_cis->value.lval)
- {
- mode &= ~CONST_CS;
- }
- default:
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(&arg_typelib);
- pTL = php_COM_find_typelib(Z_STRVAL_P(arg_typelib), mode);
- if(php_COM_load_typelib(pTL, mode) == SUCCESS)
- {
- pTL->lpVtbl->Release(pTL);
- RETURN_TRUE;
- }
- else
- {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-PHPAPI pval php_COM_get_property_handler(zend_property_reference *property_reference)
-{
- zend_overloaded_element *overloaded_property;
- zend_llist_element *element;
- pval return_value;
- pval **idispatch_handle;
- pval *object = property_reference->object;
- int type;
- comval *obj, *obj_prop;
- VARIANT *var_result;
-
- INIT_ZVAL(return_value);
- ZVAL_NULL(&return_value);
-
- /* fetch the IDispatch interface */
- zend_hash_index_find(object->value.obj.properties, 0, (void **) &idispatch_handle);
- obj = (comval *) zend_list_find(Z_LVAL_P(*idispatch_handle), &type);
- if(!obj || (type != le_idispatch))
- {
- return return_value;
- }
-
- obj_prop = (comval *) emalloc(sizeof(comval));
- var_result = (VARIANT *) emalloc(sizeof(VARIANT));
-
- for(element=property_reference->elements_list->head; element; element=element->next)
- {
- overloaded_property = (zend_overloaded_element *) element->data;
- VariantInit(var_result);
- switch(overloaded_property->type)
- {
- case OE_IS_ARRAY:
- if(do_COM_offget(var_result, obj, &overloaded_property->element, FALSE) == FAILURE)
- {
- efree(var_result);
- efree(obj_prop);
- return return_value;
- }
- break;
-
- case OE_IS_OBJECT:
- if(do_COM_propget(var_result, obj, &overloaded_property->element, FALSE) == FAILURE)
- {
- efree(var_result);
- efree(obj_prop);
- return return_value;
- }
- break;
-
- case OE_IS_METHOD:
- {
- if(obj == obj_prop)
- {
- pval *handle;
-
- return_value.type = IS_OBJECT;
- return_value.value.obj.ce = &com_class_entry;
- ALLOC_HASHTABLE(return_value.value.obj.properties);
- zend_hash_init(return_value.value.obj.properties, 0, NULL, ZVAL_PTR_DTOR, 0);
-
- ALLOC_ZVAL(handle);
- INIT_PZVAL(handle);
- ZVAL_LONG(handle, zend_list_insert(obj, php_COM_get_le_idispatch()));
-
- pval_copy_constructor(handle);
- zend_hash_index_update(return_value.value.obj.properties, 0, &handle, sizeof(pval *), NULL);
- }
- else
- {
- efree(obj_prop);
- return_value = *object;
- ZVAL_ADDREF(&return_value);
- }
-
- efree(var_result);
-
- return return_value;
- }
- break;
- }
-
- if(V_VT(var_result) == VT_DISPATCH)
- {
- pval *handle;
-
- if(V_DISPATCH(var_result) == NULL)
- {
- efree(var_result);
- efree(obj_prop);
- return return_value;
- }
-
- obj = obj_prop;
-
- php_COM_set(obj_prop, V_DISPATCH(var_result), TRUE);
-
- return_value.type = IS_OBJECT;
- return_value.value.obj.ce = &com_class_entry;
- ALLOC_HASHTABLE(return_value.value.obj.properties);
- zend_hash_init(return_value.value.obj.properties, 0, NULL, ZVAL_PTR_DTOR, 0);
-
- ALLOC_ZVAL(handle);
- INIT_PZVAL(handle);
- ZVAL_LONG(handle, zend_list_insert(obj, php_COM_get_le_idispatch()));
-
- pval_copy_constructor(handle);
- zend_hash_index_update(return_value.value.obj.properties, 0, &handle, sizeof(pval *), NULL);
- }
- else
- {
- efree(obj_prop);
- obj_prop = NULL;
- php_variant_to_pval(var_result, &return_value, FALSE, codepage);
- }
-
- pval_destructor(&overloaded_property->element);
- }
- efree(var_result);
-
- return return_value;
-}
-
-PHPAPI int php_COM_set_property_handler(zend_property_reference *property_reference, pval *value)
-{
- pval result;
- zend_overloaded_element *overloaded_property;
- zend_llist_element *element;
- pval **idispatch_handle;
- pval *object = property_reference->object;
- comval *obj;
- int type;
- VARIANT var_result;
-
-
- /* fetch the IDispatch interface */
- zend_hash_index_find(object->value.obj.properties, 0, (void **) &idispatch_handle);
- obj = (comval *)zend_list_find(Z_LVAL_P(*idispatch_handle), &type);
- if(!obj || (type != le_idispatch))
- {
- return FAILURE;
- }
- var_result.vt = VT_DISPATCH;
- var_result.pdispVal = C_DISPATCH(obj);
-
- for(element=property_reference->elements_list->head; element && element!=property_reference->elements_list->tail; element=element->next)
- {
- overloaded_property = (zend_overloaded_element *) element->data;
- switch(overloaded_property->type)
- {
- case OE_IS_ARRAY:
- break;
- case OE_IS_OBJECT:
- if(V_VT(&var_result) != VT_DISPATCH)
- {
- return FAILURE;
- }
- else
- {
- do_COM_propget(&var_result, obj, &overloaded_property->element, element!=property_reference->elements_list->head);
- }
- break;
- case OE_IS_METHOD:
- /* this shouldn't happen */
- return FAILURE;
- }
-
- pval_destructor(&overloaded_property->element);
- }
-
- if(V_VT(&var_result) != VT_DISPATCH)
- {
- return FAILURE;
- }
- obj = (comval *) emalloc(sizeof(comval));
- C_HASTLIB(obj) = FALSE;
- C_DISPATCH(obj) = V_DISPATCH(&var_result);
-
- overloaded_property = (zend_overloaded_element *) element->data;
- do_COM_propput(&result, obj, &overloaded_property->element, value);
- pval_destructor(&overloaded_property->element);
- efree(obj);
-
- return SUCCESS;
-}
-
-PHPAPI void php_COM_call_function_handler(INTERNAL_FUNCTION_PARAMETERS, zend_property_reference *property_reference)
-{
- pval property, **handle;
- pval *object = property_reference->object;
- zend_overloaded_element *function_name = (zend_overloaded_element *) property_reference->elements_list->tail->data;
- comval *obj;
- int type;
-
- if(zend_llist_count(property_reference->elements_list)==1
- && !strcmp(function_name->element.value.str.val, "com"))
- { /* constructor */
- pval *object_handle;
-
- PHP_FN(com_load)(INTERNAL_FUNCTION_PARAM_PASSTHRU);
- if(!zend_is_true(return_value))
- {
- var_reset(object);
- return;
- }
- ALLOC_ZVAL(object_handle);
- *object_handle = *return_value;
- pval_copy_constructor(object_handle);
- INIT_PZVAL(object_handle);
- zend_hash_index_update(object->value.obj.properties, 0, &object_handle, sizeof(pval *), NULL);
- pval_destructor(&function_name->element);
-
- return;
- }
-
- property = php_COM_get_property_handler(property_reference);
- if(property.type == IS_NULL)
- {
- if(property.refcount == 1)
- {
- pval_destructor(&property);
- }
- pval_destructor(&function_name->element);
- return;
- }
- zend_hash_index_find(property.value.obj.properties, 0, (void **) &handle);
- obj = (comval *)zend_list_find((*handle)->value.lval,&type);
-
- if(!obj || (type!=le_idispatch))
- {
- pval_destructor(&property);
- pval_destructor(&function_name->element);
- return;
- }
-
- if(zend_llist_count(property_reference->elements_list)==1
- && !strcmp(Z_STRVAL_P(&function_name->element), "release"))
- {
- RETVAL_LONG(php_COM_release(obj));
- }
- else if(zend_llist_count(property_reference->elements_list)==1
- && !strcmp(Z_STRVAL_P(&function_name->element), "addref"))
- {
- RETVAL_LONG(php_COM_addref(obj));
- }
- else
- {
- pval **arguments;
- VARIANT *var_result;
- int arg_count = ZEND_NUM_ARGS();
-
- var_result = (VARIANT *) emalloc(sizeof(VARIANT));
-
- VariantInit(var_result);
-
- arguments = (pval **) emalloc(sizeof(pval *)*arg_count);
- getParametersArray(ht, arg_count, arguments);
-
- if(do_COM_invoke(obj , &function_name->element, var_result, arguments, arg_count)==FAILURE)
- {
- RETVAL_FALSE;
- }
- else
- {
- php_variant_to_pval(var_result, return_value, 0, codepage);
- }
-
- efree(arguments);
- efree(var_result);
- }
-
- if(property.refcount == 1)
- {
- pval_destructor(&property);
- }
- pval_destructor(&function_name->element);
-}
-
-static ITypeLib *php_COM_find_typelib(char *search_string, int mode)
-{
- ITypeLib *TypeLib = NULL;
- char *strtok_buf, *major, *minor;
- CLSID clsid;
- OLECHAR *p;
-
- /* Type Libraries:
- * The string we have is either:
- * a) a file name
- * b) a CLSID, major, minor e.g. "{00000200-0000-0010-8000-00AA006D2EA4},2,0"
- * c) a Type Library name e.g. "Microsoft OLE DB ActiveX Data Objects 1.0 Library"
- * Searching for the name will be more expensive that the
- * other two, so we will do that when both other attempts
- * fail.
- */
-
- search_string = php_strtok_r(search_string, ",", &strtok_buf);
- major = php_strtok_r(NULL, ",", &strtok_buf);
- minor = php_strtok_r(NULL, ",", &strtok_buf);
-
- p = php_char_to_OLECHAR(search_string, strlen(search_string), codepage);
- /* Is the string a GUID ? */
-
- if(!FAILED(CLSIDFromString(p, &clsid)))
- {
- HRESULT hr;
- WORD major_i = 1;
- WORD minor_i = 0;
-
- /* We have a valid GUID, check to see if a major/minor */
- /* version was specified otherwise assume 1,0 */
- if((major != NULL) && (minor != NULL))
- {
- major_i = (WORD) atoi(major);
- minor_i = (WORD) atoi(minor);
- }
-
- /* The GUID will either be a typelibrary or a CLSID */
- hr = LoadRegTypeLib((REFGUID) &clsid, major_i, minor_i, LANG_NEUTRAL, &TypeLib);
-
- /* If the LoadRegTypeLib fails, let's try to instantiate */
- /* the class itself and then QI for the TypeInfo and */
- /* retrieve the type info from that interface */
- if(FAILED(hr) && (!major || !minor))
- {
- IDispatch *Dispatch;
- ITypeInfo *TypeInfo;
- int idx;
-
- if(FAILED(CoCreateInstance(&clsid, NULL, CLSCTX_SERVER, &IID_IDispatch, (LPVOID *) &Dispatch)))
- {
- efree(p);
- return NULL;
- }
- if(FAILED(Dispatch->lpVtbl->GetTypeInfo(Dispatch, 0, LANG_NEUTRAL, &TypeInfo)))
- {
- Dispatch->lpVtbl->Release(Dispatch);
- efree(p);
- return NULL;
- }
- Dispatch->lpVtbl->Release(Dispatch);
- if(FAILED(TypeInfo->lpVtbl->GetContainingTypeLib(TypeInfo, &TypeLib, &idx)))
- {
- TypeInfo->lpVtbl->Release(TypeInfo);
- efree(p);
- return NULL;
- }
- TypeInfo->lpVtbl->Release(TypeInfo);
- }
- }
- else
- {
- if(FAILED(LoadTypeLib(p, &TypeLib)))
- {
- /* Walk HKCR/TypeLib looking for the string */
- /* If that succeeds, call ourself recursively */
- /* using the CLSID found, else give up and bail */
- HKEY hkey, hsubkey;
- DWORD SubKeys, MaxSubKeyLength;
- char *keyname;
- register unsigned int ii, jj;
- DWORD VersionCount;
- char version[20]; /* All the version keys are 1.0, 4.6, ... */
- char *libname;
- DWORD libnamelen;
-
- /* No Need for Unicode version any more */
- efree(p);
-
- /* Starting at HKEY_CLASSES_ROOT/TypeLib */
- /* Walk all subkeys (Typelib GUIDs) looking */
- /* at each version for a string match to the */
- /* supplied argument */
-
- if(ERROR_SUCCESS != RegOpenKey(HKEY_CLASSES_ROOT, "TypeLib",&hkey))
- {
- /* This is pretty bad - better bail */
- return NULL;
- }
- if(ERROR_SUCCESS != RegQueryInfoKey(hkey, NULL, NULL, NULL, &SubKeys, &MaxSubKeyLength, NULL, NULL, NULL, NULL, NULL, NULL))
- {
- RegCloseKey(hkey);
- return NULL;
- }
- MaxSubKeyLength++; /* \0 is not counted */
- keyname = emalloc(MaxSubKeyLength);
- libname = emalloc(strlen(search_string)+1);
- for(ii=0;ii<SubKeys;ii++)
- {
- if(ERROR_SUCCESS != RegEnumKey(hkey, ii, keyname, MaxSubKeyLength))
- {
- /* Failed - who cares */
- continue;
- }
- if(ERROR_SUCCESS != RegOpenKey(hkey, keyname, &hsubkey))
- {
- /* Failed - who cares */
- continue;
- }
- if(ERROR_SUCCESS != RegQueryInfoKey(hsubkey, NULL, NULL, NULL, &VersionCount, NULL, NULL, NULL, NULL, NULL, NULL, NULL))
- {
- /* Failed - who cares */
- RegCloseKey(hsubkey);
- continue;
- }
- for(jj=0;jj<VersionCount;jj++)
- {
- if(ERROR_SUCCESS != RegEnumKey(hsubkey, jj, version, sizeof(version)))
- {
- /* Failed - who cares */
- continue;
- }
- /* OK we just need to retrieve the default */
- /* value for this key and see if it matches */
- libnamelen = strlen(search_string)+1;
- if(ERROR_SUCCESS == RegQueryValue(hsubkey, version, libname, &libnamelen))
- {
- if((mode & CONST_CS) ? (strcmp(libname, search_string) == 0) : (stricmp(libname, search_string) == 0))
- {
- char *str;
- int major, minor;
-
- /* Found it */
- RegCloseKey(hkey);
- RegCloseKey(hsubkey);
-
- efree(libname);
- /* We can either open up the "win32" key and find the DLL name */
- /* Or just parse the version string and pass that in */
- /* The version string seems like a more portable solution */
- /* Given that there is a COM on Unix */
- if(2 != sscanf(version, "%d.%d", &major, &minor))
- {
- major = 1;
- minor = 0;
- }
- str = emalloc(strlen(keyname)+strlen(version)+20); /* 18 == safety, 2 == extra comma and \0 */
- sprintf(str, "%s,%d,%d", keyname, major, minor);
- efree(keyname);
- TypeLib = php_COM_find_typelib(str, mode);
- efree(str);
- /* This is probbaly much harder to read and follow */
- /* But it is MUCH more effiecient than trying to */
- /* test for errors and leave through a single "return" */
- return TypeLib;
- }
- }
- else
- {
- /* Failed - perhaps too small abuffer */
- /* But if too small, then the name does not match */
- }
- }
- RegCloseKey(hsubkey);
- }
- efree(keyname);
- efree(libname);
- return NULL;
- }
- }
- efree(p);
- return TypeLib;
-}
-
-static int php_COM_load_typelib(ITypeLib *TypeLib, int mode)
-{
- ITypeComp *TypeComp;
- int i;
- int interfaces;
- ELS_FETCH();
-
- if(NULL == TypeLib)
- {
- return FAILURE;
- }
-
- interfaces = TypeLib->lpVtbl->GetTypeInfoCount(TypeLib);
-
- TypeLib->lpVtbl->GetTypeComp(TypeLib, &TypeComp);
- for(i=0; i<interfaces; i++)
- {
- TYPEKIND pTKind;
-
- TypeLib->lpVtbl->GetTypeInfoType(TypeLib, i, &pTKind);
- if(pTKind==TKIND_ENUM)
- {
- ITypeInfo *TypeInfo;
- VARDESC *pVarDesc;
- UINT NameCount;
- int j;
-#if 0
- BSTR bstr_EnumId;
- char *EnumId;
-
- TypeLib->lpVtbl->GetDocumentation(TypeLib, i, &bstr_EnumId, NULL, NULL, NULL);
- EnumId = php_OLECHAR_to_char(bstr_EnumId, NULL, 0, codepage);
- printf("Enumeration %d - %s:\n", i, EnumId);
- efree(EnumId);
-#endif
-
- TypeLib->lpVtbl->GetTypeInfo(TypeLib, i, &TypeInfo);
-
- j=0;
- while(TypeInfo->lpVtbl->GetVarDesc(TypeInfo, j, &pVarDesc)==S_OK)
- {
- BSTR bstr_ids;
- char *ids;
- zend_constant c;
- zval exists, results;
-
- TypeInfo->lpVtbl->GetNames(TypeInfo, pVarDesc->memid, &bstr_ids, 1, &NameCount);
- if(NameCount!=1)
- {
- j++;
- continue;
- }
- ids = php_OLECHAR_to_char(bstr_ids, NULL, 1, codepage);
- SysFreeString(bstr_ids);
- c.name_len = strlen(ids)+1;
- c.name = ids;
- if (zend_get_constant(c.name, c.name_len-1, &exists))
- {
- /* Oops, it already exists. No problem if it is defined as the same value */
- /* Check to see if they are the same */
- if (!compare_function(&results, &c.value, &exists))
- {
- php_error(E_WARNING,"Type library value %s is already defined and has a different value", c.name);
- }
- free(ids);
- j++;
- continue;
- }
-
- php_variant_to_pval(pVarDesc->lpvarValue, &c.value, FALSE, codepage);
- c.flags = mode;
-
- /* Before registering the contsnt, let's see if we can find it */
- {
- zend_register_constant(&c ELS_CC);
- }
- j++;
- }
- TypeInfo->lpVtbl->Release(TypeInfo);
- }
- }
-
- return SUCCESS;
-}
-
-/* {{{ proto bool com_isenum(com_module obj)
- Grabs an IEnumVariant */
-PHP_FUNCTION(com_isenum)
-{
- pval *object;
- pval **idispatch_handle;
- comval *obj;
- int type;
-
- if(ZEND_NUM_ARGS() != 1)
- {
- WRONG_PARAM_COUNT;
- }
-
- getParameters(ht, 1, &object);
-
- /* obtain IDispatch interface */
- zend_hash_index_find(object->value.obj.properties, 0, (void **) &idispatch_handle);
- obj = (comval *) zend_list_find((*idispatch_handle)->value.lval, &type);
- if(!obj || (type!=le_idispatch))
- {
- php_error(E_WARNING,"%s is not a COM object handler", "");
- RETURN_FALSE;
- }
-
- RETURN_BOOL(C_HASENUM(obj));
-}
-/* }}} */
-
-void php_register_COM_class()
-{
- INIT_OVERLOADED_CLASS_ENTRY(com_class_entry, "COM", NULL,
- php_COM_call_function_handler,
- php_COM_get_property_handler,
- php_COM_set_property_handler);
-
- zend_register_internal_class(&com_class_entry);
-}
-
-PHP_MINIT_FUNCTION(COM)
-{
- CoInitialize(NULL);
- le_idispatch = zend_register_list_destructors_ex(php_idispatch_destructor, NULL, "COM", module_number);
- php_register_COM_class();
- REGISTER_INI_ENTRIES();
- return SUCCESS;
-}
-
-PHP_MSHUTDOWN_FUNCTION(COM)
-{
- CoUninitialize();
- UNREGISTER_INI_ENTRIES();
- return SUCCESS;
-}
-
-// exports for external object creation
-
-zend_module_entry COM_module_entry = {
- "com", COM_functions, PHP_MINIT(COM), PHP_MSHUTDOWN(COM), NULL, NULL, PHP_MINFO(COM), STANDARD_MODULE_PROPERTIES
-};
-
-PHPAPI int php_COM_get_le_idispatch()
-{
- return le_idispatch;
-}
-
-#endif
diff --git a/ext/com/CREDITS b/ext/com/CREDITS
deleted file mode 100644
index 27bb7a0b21..0000000000
--- a/ext/com/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-Win32 COM
-Zeev Suraski, Harald Radi, Alan Brown \ No newline at end of file
diff --git a/ext/com/VARIANT.c b/ext/com/VARIANT.c
deleted file mode 100644
index 0b64388c7f..0000000000
--- a/ext/com/VARIANT.c
+++ /dev/null
@@ -1,432 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Harald Radi <h.radi@nme.at> |
- +----------------------------------------------------------------------+
- */
-
-
-/*
- * This module maps the VARIANT datastructure into PHP so that it can be used to
- * pass values to COM and DOTNET Objects by reference and not only by value.
- *
- * harald
- */
-
-#ifdef PHP_WIN32
-
-#include "php.h"
-#include "php_ini.h"
-#include "php_VARIANT.h"
-#include "conversion.h"
-#include "ext/standard/info.h"
-
-#include <unknwn.h>
-
-void php_VARIANT_call_function_handler(INTERNAL_FUNCTION_PARAMETERS, zend_property_reference *property_reference);
-pval php_VARIANT_get_property_handler(zend_property_reference *property_reference);
-static int do_VARIANT_propset(VARIANT *var_arg, pval *arg_property, pval *value);
-void php_register_VARIANT_class();
-static void php_variant_destructor(zend_rsrc_list_entry *rsrc);
-void php_register_VARIANT_class();
-
-static int le_variant;
-static int codepage;
-
-static zend_class_entry VARIANT_class_entry;
-
-function_entry VARIANT_functions[] = {
- {NULL, NULL, NULL}
-};
-
-static PHP_MINFO_FUNCTION(VARIANT)
-{
- php_info_print_table_start();
- php_info_print_table_row(2, "VARIANT support", "enabled");
- php_info_print_table_end();
-}
-
-zend_module_entry VARIANT_module_entry = {
- "variant", VARIANT_functions, PHP_MINIT(VARIANT), PHP_MSHUTDOWN(VARIANT), NULL, NULL, PHP_MINFO(VARIANT), STANDARD_MODULE_PROPERTIES
-};
-
-PHP_MINIT_FUNCTION(VARIANT)
-{
- le_variant = zend_register_list_destructors_ex(php_variant_destructor, NULL, "VARIANT", module_number);
-
- /* variant datatypes */
- REGISTER_LONG_CONSTANT("VT_NULL", VT_NULL, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("VT_EMPTY", VT_EMPTY, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("VT_UI1", VT_UI1, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("VT_I2", VT_I2, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("VT_I4", VT_I4, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("VT_R4", VT_R4, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("VT_R8", VT_R8, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("VT_BOOL", VT_BOOL, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("VT_ERROR", VT_ERROR, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("VT_CY", VT_CY, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("VT_DATE", VT_CY, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("VT_BSTR", VT_BSTR, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("VT_DECIMAL", VT_DECIMAL, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("VT_UNKNOWN", VT_UNKNOWN, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("VT_DISPATCH", VT_DISPATCH, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("VT_VARIANT", VT_VARIANT, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("VT_I1", VT_I1, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("VT_UI2", VT_UI2, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("VT_UI4", VT_UI4, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("VT_INT", VT_INT, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("VT_UINT", VT_UINT, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("VT_ARRAY", VT_ARRAY, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("VT_BYREF", VT_BYREF, CONST_CS | CONST_PERSISTENT);
-
- /* codepages */
- REGISTER_LONG_CONSTANT("CP_ACP", CP_ACP, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("CP_MACCP", CP_MACCP, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("CP_OEMCP", CP_OEMCP, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("CP_SYMBOL", CP_SYMBOL, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("CP_THREAD_ACP", CP_THREAD_ACP, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("CP_UTF7", CP_UTF7, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("CP_UTF8", CP_UTF8, CONST_CS | CONST_PERSISTENT);
-
- php_register_VARIANT_class();
- return SUCCESS;
-}
-
-PHP_MSHUTDOWN_FUNCTION(VARIANT)
-{
- return SUCCESS;
-}
-
-void php_VARIANT_call_function_handler(INTERNAL_FUNCTION_PARAMETERS, zend_property_reference *property_reference)
-{
- pval *object = property_reference->object;
- zend_overloaded_element *function_name = (zend_overloaded_element *) property_reference->elements_list->tail->data;
- VARIANT *pVar;
-
- if((zend_llist_count(property_reference->elements_list)==1) && !strcmp(function_name->element.value.str.val, "variant"))
- {
- /* constructor */
- pval *object_handle, *data, *type, *code_page;
-
- pVar = emalloc(sizeof(VARIANT));
- VariantInit(pVar);
-
- switch(ZEND_NUM_ARGS())
- {
- case 0:
- /* nothing to do */
- break;
- case 1:
- getParameters(ht, 1, &data);
- php_pval_to_variant(data, pVar, codepage);
- codepage = CP_ACP;
- break;
- case 2:
- getParameters(ht, 2, &data, &type);
- php_pval_to_variant_ex(data, pVar, type, codepage);
- codepage = CP_ACP;
- break;
- case 3:
- getParameters(ht, 3, &data, &type, &code_page);
- php_pval_to_variant_ex(data, pVar, type, codepage);
- convert_to_long(code_page);
- codepage = code_page->value.lval;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- return_value->type = IS_LONG;
- return_value->value.lval = zend_list_insert(pVar, le_variant);
-
- if(!zend_is_true(return_value))
- {
- var_reset(object);
- return;
- }
-
- ALLOC_ZVAL(object_handle);
- *object_handle = *return_value;
- pval_copy_constructor(object_handle);
- INIT_PZVAL(object_handle);
- zend_hash_index_update(object->value.obj.properties, 0, &object_handle, sizeof(pval *), NULL);
- pval_destructor(&function_name->element);
- }
-}
-
-
-pval php_VARIANT_get_property_handler(zend_property_reference *property_reference)
-{
- zend_overloaded_element *overloaded_property;
- int type;
-
- pval result, **var_handle, *object = property_reference->object;
- VARIANT *var_arg;
-
- /* fetch the VARIANT structure */
- zend_hash_index_find(object->value.obj.properties, 0, (void **) &var_handle);
- var_arg = zend_list_find((*var_handle)->value.lval, &type);
-
- if(!var_arg || (type != le_variant))
- {
- var_reset(&result);
- }
- else
- {
- overloaded_property = (zend_overloaded_element *) property_reference->elements_list->head->data;
- switch(overloaded_property->type)
- {
- case OE_IS_ARRAY:
- var_reset(&result);
- break;
-
- case OE_IS_OBJECT:
- if(!strcmp(overloaded_property->element.value.str.val, "value"))
- {
- php_variant_to_pval(var_arg, &result, 0, codepage);
- }
- else if(!strcmp(overloaded_property->element.value.str.val, "type"))
- {
- result.value.lval = var_arg->vt;
- result.type = IS_LONG;
- }
- else
- {
- var_reset(&result);
- php_error(E_WARNING, "Unknown member.");
- }
- break;
- case OE_IS_METHOD:
- var_reset(&result);
- php_error(E_WARNING, "Unknown method.");
- break;
-
- pval_destructor(&overloaded_property->element);
- }
- }
-
- return result;
-}
-
-int php_VARIANT_set_property_handler(zend_property_reference *property_reference, pval *value)
-{
- zend_overloaded_element *overloaded_property;
- int type;
-
- pval **var_handle, *object = property_reference->object;
- VARIANT *var_arg;
-
- /* fetch the VARIANT structure */
- zend_hash_index_find(object->value.obj.properties, 0, (void **) &var_handle);
- var_arg = zend_list_find((*var_handle)->value.lval, &type);
-
- if(!var_arg || (type != le_variant))
- return FAILURE;
-
- overloaded_property = (zend_overloaded_element *) property_reference->elements_list->head->data;
- do_VARIANT_propset(var_arg, &overloaded_property->element, value);
- pval_destructor(&overloaded_property->element);
- return SUCCESS;
-}
-
-static int do_VARIANT_propset(VARIANT *var_arg, pval *arg_property, pval *value)
-{
- pval type;
-
- type.type = IS_STRING;
-
- if(!strcmp(arg_property->value.str.val, "bVal"))
- {
- type.value.lval = VT_UI1;
- }
- else if(!strcmp(arg_property->value.str.val, "iVal"))
- {
- type.value.lval = VT_I2;
- }
- else if(!strcmp(arg_property->value.str.val, "lVal"))
- {
- type.value.lval = VT_I4;
- }
- else if(!strcmp(arg_property->value.str.val, "fltVal"))
- {
- type.value.lval = VT_R4;
- }
- else if(!strcmp(arg_property->value.str.val, "dblVal"))
- {
- type.value.lval = VT_R8;
- }
- else if(!strcmp(arg_property->value.str.val, "boolVal"))
- {
- type.value.lval = VT_BOOL;
- }
- else if(!strcmp(arg_property->value.str.val, "scode"))
- {
- type.value.lval = VT_ERROR;
- }
- else if(!strcmp(arg_property->value.str.val, "cyVal"))
- {
- type.value.lval = VT_CY;
- }
- else if(!strcmp(arg_property->value.str.val, "date"))
- {
- type.value.lval = VT_DATE;
- }
- else if(!strcmp(arg_property->value.str.val, "bstrVal"))
- {
- type.value.lval = VT_BSTR;
- }
- else if(!strcmp(arg_property->value.str.val, "pdecVal"))
- {
- type.value.lval = VT_DECIMAL|VT_BYREF;
- }
- else if(!strcmp(arg_property->value.str.val, "punkVal"))
- {
- type.value.lval = VT_UNKNOWN;
- }
- else if(!strcmp(arg_property->value.str.val, "pdispVal"))
- {
- type.value.lval = VT_DISPATCH;
- }
- else if(!strcmp(arg_property->value.str.val, "parray"))
- {
- type.value.lval = VT_ARRAY;
- }
- else if(!strcmp(arg_property->value.str.val, "pbVal"))
- {
- type.value.lval = VT_UI1|VT_BYREF;
- }
- else if(!strcmp(arg_property->value.str.val, "piVal"))
- {
- type.value.lval = VT_I2|VT_BYREF;
- }
- else if(!strcmp(arg_property->value.str.val, "plVal"))
- {
- type.value.lval = VT_I4|VT_BYREF;
- }
- else if(!strcmp(arg_property->value.str.val, "pfltVal"))
- {
- type.value.lval = VT_R4|VT_BYREF;
- }
- else if(!strcmp(arg_property->value.str.val, "pdblVal"))
- {
- type.value.lval = VT_R8|VT_BYREF;
- }
- else if(!strcmp(arg_property->value.str.val, "pboolVal"))
- {
- type.value.lval = VT_BOOL|VT_BYREF;
- }
- else if(!strcmp(arg_property->value.str.val, "pscode"))
- {
- type.value.lval = VT_ERROR|VT_BYREF;
- }
- else if(!strcmp(arg_property->value.str.val, "pcyVal"))
- {
- type.value.lval = VT_CY|VT_BYREF;
- }
- else if(!strcmp(arg_property->value.str.val, "pdate"))
- {
- type.value.lval = VT_DATE|VT_BYREF;
- }
- else if(!strcmp(arg_property->value.str.val, "pbstrVal"))
- {
- type.value.lval = VT_BSTR|VT_BYREF;
- }
- else if(!strcmp(arg_property->value.str.val, "ppunkVal"))
- {
- type.value.lval = VT_UNKNOWN|VT_BYREF;
- }
- else if(!strcmp(arg_property->value.str.val, "ppdispVal"))
- {
- type.value.lval = VT_DISPATCH|VT_BYREF;
- }
- else if(!strcmp(arg_property->value.str.val, "pparray"))
- {
- type.value.lval = VT_ARRAY|VT_BYREF;
- }
- else if(!strcmp(arg_property->value.str.val, "pvarVal"))
- {
- type.value.lval = VT_VARIANT|VT_BYREF;
- }
- else if(!strcmp(arg_property->value.str.val, "byref"))
- {
- type.value.lval = VT_BYREF;
- }
- else if(!strcmp(arg_property->value.str.val, "cVal"))
- {
- type.value.lval = VT_I1;
- }
- else if(!strcmp(arg_property->value.str.val, "uiVal"))
- {
- type.value.lval = VT_UI2;
- }
- else if(!strcmp(arg_property->value.str.val, "ulVal"))
- {
- type.value.lval = VT_UI4;
- }
- else if(!strcmp(arg_property->value.str.val, "intVal"))
- {
- type.value.lval = VT_INT;
- }
- else if(!strcmp(arg_property->value.str.val, "uintVal"))
- {
- type.value.lval = VT_UINT|VT_BYREF;
- }
- else if(!strcmp(arg_property->value.str.val, "pcVal"))
- {
- type.value.lval = VT_I1|VT_BYREF;
- }
- else if(!strcmp(arg_property->value.str.val, "puiVal"))
- {
- type.value.lval = VT_UI2|VT_BYREF;
- }
- else if(!strcmp(arg_property->value.str.val, "pulVal"))
- {
- type.value.lval = VT_UI4|VT_BYREF;
- }
- else if(!strcmp(arg_property->value.str.val, "pintVal"))
- {
- type.value.lval = VT_INT|VT_BYREF;
- }
- else if(!strcmp(arg_property->value.str.val, "puintVal"))
- {
- type.value.lval = VT_UINT|VT_BYREF;
- }
- else
- {
- php_error(E_WARNING, "Unknown member.");
- return FAILURE;
- }
-
- php_pval_to_variant_ex(value, var_arg, &type, codepage);
-
- return SUCCESS;
-}
-
-static void php_variant_destructor(zend_rsrc_list_entry *rsrc)
-{
- efree(rsrc);
-}
-
-void php_register_VARIANT_class()
-{
- INIT_OVERLOADED_CLASS_ENTRY(VARIANT_class_entry, "VARIANT", NULL,
- php_VARIANT_call_function_handler,
- php_VARIANT_get_property_handler,
- php_VARIANT_set_property_handler);
-
- zend_register_internal_class(&VARIANT_class_entry);
-}
-
-#endif /* PHP_WIN32 */
diff --git a/ext/com/com.h b/ext/com/com.h
deleted file mode 100644
index 0679cd162b..0000000000
--- a/ext/com/com.h
+++ /dev/null
@@ -1,43 +0,0 @@
-#ifndef COM_H
-#define COM_H
-
-#if PHP_WIN32
-
-#include "oleauto.h"
-
-typedef struct comval_ {
- BOOL typelib;
- BOOL enumeration;
- int refcount;
- struct {
- IDispatch *dispatch;
- ITypeInfo *typeinfo;
- IEnumVARIANT *enumvariant;
- } i;
-} comval;
-
-PHPAPI HRESULT php_COM_invoke(comval *obj, DISPID dispIdMember, WORD wFlags, DISPPARAMS FAR* pDispParams, VARIANT FAR* pVarResult);
-PHPAPI HRESULT php_COM_get_ids_of_names(comval *obj, OLECHAR FAR* FAR* rgszNames, DISPID FAR* rgDispId);
-PHPAPI HRESULT php_COM_release(comval *obj);
-PHPAPI HRESULT php_COM_addref(comval *obj);
-PHPAPI HRESULT php_COM_set(comval *obj, IDispatch FAR* pDisp, int cleanup);
-PHPAPI HRESULT php_COM_clone(comval *obj, comval *clone, int cleanup);
-
-#define C_HASTLIB(x) ((x)->typelib)
-#define C_HASENUM(x) ((x)->enumeration)
-#define C_ISREFD(x) ((x)->refcount)
-
-#define C_DISPATCH(x) ((x)->i.dispatch)
-#define C_TYPEINFO(x) ((x)->i.typeinfo)
-#define C_ENUMVARIANT(x) ((x)->i.enumvariant)
-
-#define C_DISPATCH_VT(x) (C_DISPATCH(x)->lpVtbl)
-#define C_TYPEINFO_VT(x) (C_TYPEINFO(x)->lpVtbl)
-#define C_ENUMVARIANT_VT(x) (C_ENUMVARIANT(x)->lpVtbl)
-
-#define C_ADDREF(x) (++((x)->refcount))
-#define C_RELEASE(x) (--((x)->refcount))
-
-#endif /* PHP_WIN32 */
-
-#endif /* COM_H */
diff --git a/ext/com/conversion.c b/ext/com/conversion.c
deleted file mode 100644
index d6eb0d286e..0000000000
--- a/ext/com/conversion.c
+++ /dev/null
@@ -1,889 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Harald Radi <h.radi@nme.at> |
- | Alan Brown <abrown@pobox.com> |
- | Paul Shortis <pshortis@dataworx.com.au> |
- +----------------------------------------------------------------------+
- */
-
-/*
- * 03.6.2001
- * Added SafeArray ==> Hash support
- */
-
-/*
- * Paul Shortis June 7, 2001 <pshortis@dataworx.com.au> - Added code to support SafeArray passing
- * to COM objects. Support includes passing arrays of variants as well
- * as typed arrays.
- */
-
-#ifdef PHP_WIN32
-
-#include "php.h"
-#include "php_COM.h"
-#include "unknwn.h"
-
-// prototypes
-
-PHPAPI void php_pval_to_variant(pval *pval_arg, VARIANT *var_arg, int codepage);
-PHPAPI void php_pval_to_variant_ex(pval *pval_arg, VARIANT *var_arg, pval *pval_type, int codepage);
-PHPAPI int php_variant_to_pval(VARIANT *var_arg, pval *pval_arg, int persistent, int codepage);
-PHPAPI OLECHAR *php_char_to_OLECHAR(char *C_str, uint strlen, int codepage);
-PHPAPI char *php_OLECHAR_to_char(OLECHAR *unicode_str, uint *out_length, int persistent, int codepage);
-
-// implementations
-
-PHPAPI void php_pval_to_variant(pval *pval_arg, VARIANT *var_arg, int codepage)
-{
- OLECHAR *unicode_str;
-
- VariantInit(var_arg);
-
- switch(Z_TYPE_P(pval_arg))
- {
- case IS_NULL:
- V_VT(var_arg) = VT_NULL;
- break;
-
- case IS_BOOL:
- V_VT(var_arg) = VT_BOOL;
- V_BOOL(var_arg) = (short) Z_LVAL_P(pval_arg);
- break;
-
- case IS_OBJECT:
- if(!strcmp(pval_arg->value.obj.ce->name, "VARIANT"))
- {
- int type;
- pval **var_handle;
-
- /* fetch the VARIANT structure */
- zend_hash_index_find(pval_arg->value.obj.properties, 0, (void **) &var_handle);
-
- V_VT(var_arg) = VT_VARIANT|VT_BYREF;
- V_VARIANTREF(var_arg) = (VARIANT FAR*) zend_list_find(Z_LVAL_P(*var_handle), &type);
- }
- else if(!strcmp(pval_arg->value.obj.ce->name, "COM"))
- {
- pval **idispatch_handle;
- comval *obj;
- int type;
-
- /* fetch the IDispatch interface */
- zend_hash_index_find(pval_arg->value.obj.properties, 0, (void **) &idispatch_handle);
- obj = (comval *)zend_list_find(Z_LVAL_P(*idispatch_handle), &type);
- if(!obj || (type != php_COM_get_le_idispatch()) || !C_ISREFD(obj))
- {
- VariantInit(var_arg);
- }
- else
- {
- V_VT(var_arg) = VT_DISPATCH;
- V_DISPATCH(var_arg) = C_DISPATCH(obj);
- }
- }
- else
- {
- VariantInit(var_arg);
- }
- break;
-
- case IS_ARRAY:
- {
- /* For now we'll just handle single dimension arrays, we'll use the data type of the first element for the
- output data type */
- HashTable *ht = Z_ARRVAL(*pval_arg);
- int numberOfElements = zend_hash_num_elements(ht);
- SAFEARRAY *safeArray;
- SAFEARRAYBOUND bounds[1];
- VARIANT *v;
- zval **entry; /* An entry in the input array */
-
- VariantInit(var_arg);
-
- if(pval_arg->is_ref)
- {
- V_VT(var_arg) = VT_VARIANT|VT_BYREF; /* Create a VARIANT to reference */
- V_VARIANTREF(var_arg) = emalloc(sizeof(VARIANT));
- var_arg = V_VARIANTREF(var_arg); /* & put the array in that VARIANT */
- }
-
- bounds[0].lLbound = 0;
- bounds[0].cElements = numberOfElements;
- V_VT(var_arg) = VT_EMPTY; /* until array is created */
- safeArray = SafeArrayCreate(VT_VARIANT, 1, bounds);
-
- if(NULL == safeArray)
- {
- php_error( E_WARNING,"Unable to convert php array to VARIANT array - %s", numberOfElements ? "" : "(Empty input array)");
- var_reset(pval_arg);
- }
- else
- {
- V_ARRAY(var_arg) = safeArray;
- V_VT(var_arg) = VT_ARRAY|VT_VARIANT; /* Now have a valid safe array allocated */
- if(SUCCEEDED(SafeArrayLock( safeArray)))
- {
- ulong i;
-
- zend_hash_internal_pointer_reset(ht);
- for( i = 0; i < (ulong)numberOfElements; ++i)
- {
- if((zend_hash_get_current_data(ht, (void **)&entry) == SUCCESS) && (entry != NULL)) /* Get a pointer to the php array element */
- {
- /* Add another value to the safe array */
- if(SUCCEEDED(SafeArrayPtrOfIndex( safeArray, &i, &v)))/* Pointer to output element entry retrieved successfully */
- {
- php_pval_to_variant(*entry, v, codepage); /* Do the required conversion */
- }
- else
- {
- php_error( E_WARNING,"phpArrayToSafeArray() - Unable to retrieve pointer to output element number (%d)", i);
- }
- }
- zend_hash_move_forward(ht);
- }
- SafeArrayUnlock( safeArray);
- }
- else
- {
- php_error( E_WARNING,"phpArrayToSafeArray() - Unable to lock safeArray");
- }
- }
- }
- break;
-
- case IS_RESOURCE:
- case IS_CONSTANT:
- case IS_CONSTANT_ARRAY:
- VariantInit(var_arg);
- break;
-
- case IS_LONG:
- V_VT(var_arg) = VT_I4; /* assuming 32-bit platform */
- V_I4(var_arg) = Z_LVAL_P(pval_arg);
- break;
-
- case IS_DOUBLE:
- V_VT(var_arg) = VT_R8; /* assuming 64-bit double precision */
- V_R8(var_arg) = Z_DVAL_P(pval_arg);
- break;
-
- case IS_STRING:
- V_VT(var_arg) = VT_BSTR;
- unicode_str = php_char_to_OLECHAR(Z_STRVAL_P(pval_arg), Z_STRLEN_P(pval_arg), codepage);
- V_BSTR(var_arg) = SysAllocString(unicode_str);
- efree(unicode_str);
- }
-}
-
-PHPAPI void php_pval_to_variant_ex(pval *pval_arg, VARIANT *var_arg, pval *pval_type, int codepage)
-{
- OLECHAR *unicode_str;
-
- V_VT(var_arg) = (short)Z_LVAL_P(pval_type);
-
- switch(V_VT(var_arg))
- {
- case VT_UI1:
- convert_to_long_ex(&pval_arg);
- V_UI1(var_arg) = (unsigned char)Z_LVAL_P(pval_arg);
- break;
-
- case VT_I2:
- convert_to_long_ex(&pval_arg);
- V_I2(var_arg) = (short)Z_LVAL_P(pval_arg);
- break;
-
- case VT_I4:
- convert_to_long_ex(&pval_arg);
- V_I4(var_arg) = Z_LVAL_P(pval_arg);
- break;
-
- case VT_R4:
- convert_to_double_ex(&pval_arg);
- V_R4(var_arg) = (float)Z_DVAL_P(pval_arg);
- break;
-
- case VT_R8:
- convert_to_double_ex(&pval_arg);
- V_R8(var_arg) = Z_DVAL_P(pval_arg);
- break;
-
- case VT_BOOL:
- convert_to_boolean_ex(&pval_arg);
- V_BOOL(var_arg) = (short)Z_LVAL_P(pval_arg);
- break;
-
- case VT_ERROR:
- convert_to_long_ex(&pval_arg);
- V_ERROR(var_arg) = Z_LVAL_P(pval_arg);
- break;
-
- case VT_CY:
- convert_to_double_ex(&pval_arg);
- VarCyFromR8(Z_DVAL_P(pval_arg), &V_CY(var_arg));
- break;
-
- case VT_DATE:
- {
- SYSTEMTIME wintime;
- struct tm *phptime;
-
- phptime = gmtime(&(pval_arg->value.lval));
-
- wintime.wYear = phptime->tm_year + 1900;
- wintime.wMonth = phptime->tm_mon + 1;
- wintime.wDay = phptime->tm_mday;
- wintime.wHour = phptime->tm_hour;
- wintime.wMinute = phptime->tm_min;
- wintime.wSecond = phptime->tm_sec;
-
- SystemTimeToVariantTime(&wintime, &V_DATE(var_arg));
- }
-
- case VT_BSTR:
- convert_to_string_ex(&pval_arg);
- unicode_str = php_char_to_OLECHAR(Z_STRVAL_P(pval_arg), Z_STRLEN_P(pval_arg), codepage);
- V_BSTR(var_arg) = SysAllocString(unicode_str);
- efree(unicode_str);
- break;
-
- case VT_DECIMAL:
- convert_to_string_ex(&pval_arg);
- unicode_str = php_char_to_OLECHAR(Z_STRVAL_P(pval_arg), Z_STRLEN_P(pval_arg), codepage);
- VarDecFromStr(unicode_str, LOCALE_SYSTEM_DEFAULT, 0, &V_DECIMAL(var_arg));
- break;
-
- case VT_DECIMAL|VT_BYREF:
- convert_to_string_ex(&pval_arg);
- unicode_str = php_char_to_OLECHAR(Z_STRVAL_P(pval_arg), Z_STRLEN_P(pval_arg), codepage);
- VarDecFromStr(unicode_str, LOCALE_SYSTEM_DEFAULT, 0, V_DECIMALREF(var_arg));
- break;
-
- case VT_UNKNOWN:
- php_pval_to_variant(pval_arg, var_arg, codepage);
- if(V_VT(var_arg) != VT_DISPATCH)
- {
- VariantInit(var_arg);
- }
- else
- {
- V_VT(var_arg) = VT_UNKNOWN;
- V_UNKNOWN(var_arg) = (IUnknown *) V_DISPATCH(var_arg);
- }
- break;
-
- case VT_DISPATCH:
- php_pval_to_variant(pval_arg, var_arg, codepage);
- if(V_VT(var_arg) != VT_DISPATCH)
- {
- VariantInit(var_arg);
- }
- break;
-
- case VT_UI1|VT_BYREF:
- convert_to_long(pval_arg);
- V_UI1REF(var_arg) = (unsigned char FAR*) &Z_LVAL_P(pval_arg);
- break;
-
- case VT_I2|VT_BYREF:
- convert_to_long(pval_arg);
- V_I2REF(var_arg) = (short FAR*) &Z_LVAL_P(pval_arg);
- break;
-
- case VT_I4|VT_BYREF:
- convert_to_long(pval_arg);
- V_I4REF(var_arg) = (long FAR*) &Z_LVAL_P(pval_arg);
- break;
-
- case VT_R4|VT_BYREF:
- convert_to_double(pval_arg);
- V_R4REF(var_arg) = (float FAR*) &Z_LVAL_P(pval_arg);
- break;
-
- case VT_R8|VT_BYREF:
- convert_to_double(pval_arg);
- V_R8REF(var_arg) = (double FAR*) &Z_LVAL_P(pval_arg);
- break;
-
- case VT_BOOL|VT_BYREF:
- convert_to_boolean(pval_arg);
- V_BOOLREF(var_arg) = (short FAR*) &Z_LVAL_P(pval_arg);
- break;
-
- case VT_ERROR|VT_BYREF:
- convert_to_long(pval_arg);
- V_ERRORREF(var_arg) = (long FAR*) &Z_LVAL_P(pval_arg);
- break;
-
- case VT_CY|VT_BYREF:
- convert_to_double_ex(&pval_arg);
- VarCyFromR8(pval_arg->value.dval, var_arg->pcyVal);
- break;
-
- case VT_DATE|VT_BYREF:
- {
- SYSTEMTIME wintime;
- struct tm *phptime;
-
- phptime = gmtime(&(pval_arg->value.lval));
-
- wintime.wYear = phptime->tm_year + 1900;
- wintime.wMonth = phptime->tm_mon + 1;
- wintime.wDay = phptime->tm_mday;
- wintime.wHour = phptime->tm_hour;
- wintime.wMinute = phptime->tm_min;
- wintime.wSecond = phptime->tm_sec;
-
- SystemTimeToVariantTime(&wintime, var_arg->pdate);
- }
-
- case VT_BSTR|VT_BYREF:
- convert_to_string(pval_arg);
- V_BSTRREF(var_arg) = (BSTR FAR*) emalloc(sizeof(BSTR FAR*));
- unicode_str = php_char_to_OLECHAR(Z_STRVAL_P(pval_arg), Z_STRLEN_P(pval_arg), codepage);
- *V_BSTRREF(var_arg) = SysAllocString(unicode_str);
- efree(unicode_str);
- break;
-
- case VT_UNKNOWN|VT_BYREF:
- php_pval_to_variant(pval_arg, var_arg, codepage);
- if(V_VT(var_arg) != VT_DISPATCH)
- {
- VariantInit(var_arg);
- }
- else
- {
- V_VT(var_arg) = VT_UNKNOWN|VT_BYREF;
- *V_UNKNOWNREF(var_arg) = (IUnknown *) *V_DISPATCHREF(var_arg);
- }
- break;
-
- case VT_DISPATCH|VT_BYREF:
- php_pval_to_variant(pval_arg, var_arg, codepage);
- if(V_VT(var_arg) != VT_DISPATCH)
- {
- VariantInit(var_arg);
- }
- else
- {
- V_VT(var_arg) |= VT_BYREF;
- }
- break;
-
- case VT_VARIANT|VT_BYREF:
- php_pval_to_variant(pval_arg, var_arg, codepage);
- if(V_VT(var_arg) != (VT_VARIANT|VT_BYREF)) /* TODO: i don't believe that this works */
- {
- VariantInit(var_arg);
- }
- break;
-
- case VT_I1:
- convert_to_long_ex(&pval_arg);
- V_I1(var_arg) = (char)Z_LVAL_P(pval_arg);
- break;
-
- case VT_UI2:
- convert_to_long_ex(&pval_arg);
- V_UI2(var_arg) = (unsigned short)Z_LVAL_P(pval_arg);
- break;
-
- case VT_UI4:
- convert_to_long_ex(&pval_arg);
- V_UI4(var_arg) = (unsigned long)Z_LVAL_P(pval_arg);
- break;
-
- case VT_INT:
- convert_to_long_ex(&pval_arg);
- V_INT(var_arg) = (int)Z_LVAL_P(pval_arg);
- break;
-
- case VT_UINT:
- convert_to_long_ex(&pval_arg);
- V_UINT(var_arg) = (unsigned int)Z_LVAL_P(pval_arg);
- break;
-
- case VT_I1|VT_BYREF:
- convert_to_long(pval_arg);
- V_I1REF(var_arg) = (char FAR*) &Z_LVAL_P(pval_arg);
- break;
-
- case VT_UI2|VT_BYREF:
- convert_to_long(pval_arg);
- V_UI2REF(var_arg) = (unsigned short FAR*) &Z_LVAL_P(pval_arg);
- break;
-
- case VT_UI4|VT_BYREF:
- convert_to_long(pval_arg);
- V_UI4REF(var_arg) = (unsigned long FAR*) &Z_LVAL_P(pval_arg);
- break;
-
- case VT_INT|VT_BYREF:
- convert_to_long(pval_arg);
- V_INTREF(var_arg) = (int FAR*) &Z_LVAL_P(pval_arg);
- break;
-
- case VT_UINT|VT_BYREF:
- convert_to_long(pval_arg);
- V_UINTREF(var_arg) = (unsigned int FAR*) &Z_LVAL_P(pval_arg);
- break;
-
- default:
- php_error(E_WARNING, "Type not supportet or not yet implemented.");
- }
-}
-
-PHPAPI int php_variant_to_pval(VARIANT *var_arg, pval *pval_arg, int persistent, int codepage)
-{
- /* Changed the function to return a value for recursive error testing */
- /* Existing calls will be unaffected by the change - so it */
- /* seemed like the smallest impact on unfamiliar code */
- int ret = SUCCESS;
-
- INIT_PZVAL(pval_arg);
-
- /* Add SafeArray support */
- if (V_ISARRAY(var_arg))
- {
- SAFEARRAY *array = V_ARRAY(var_arg);
- LONG indices[1];
- LONG lbound=0, ubound;
- VARTYPE vartype;
- register int ii;
- UINT Dims;
- VARIANT vv;
- pval *element;
- HRESULT hr;
-
- /* TODO: Add support for multi-dimensional SafeArrays */
- /* For now just validate that the SafeArray has one dimension */
- if (1 != (Dims = SafeArrayGetDim(array)))
- {
- php_error(E_WARNING,"Unsupported: multi-dimensional (%d) SafeArrays", Dims);
- var_reset(pval_arg);
- return FAILURE;
- }
- SafeArrayLock( array);
-
- /* This call has failed for everything I have tried */
- /* But best leave it to be on the safe side */
- if (FAILED(SafeArrayGetVartype(array, &vartype)))
- {
- /* Fall back to what we do know */
- /* Mask off the array bit and assume */
- /* what is left is the type of the array */
- /* elements */
- vartype = V_VT(var_arg) & ~VT_ARRAY;
- }
- SafeArrayGetUBound(array, 1, &ubound);
- SafeArrayGetLBound(array, 1, &lbound);
-
- /* Since COM returned an array we set up the php */
- /* return value to be an array */
- array_init(pval_arg);
-
- /* Walk the safe array */
- for (ii=lbound;ii<=ubound;ii++)
- {
- indices[0] = ii;
- VariantInit(&vv); /* Docs say this just set the vt field, but you never know */
- /* Set up a variant to pass to a recursive call */
- /* So that we do not need to have two copies */
- /* of the code */
- if (VT_VARIANT == vartype)
- {
- hr = SafeArrayGetElement(array, indices, (VOID *) &(vv));
- }
- else
- {
- V_VT(&vv) = vartype;
- hr = SafeArrayGetElement(array, indices, (VOID *) &(vv.lVal));
- }
- if (FAILED(hr))
- {
- /* Failure to retieve an element probably means the array is sparse */
- /* So leave the php array sparse too */
- continue;
- }
- /* Create an element to be added to the array */
- ALLOC_ZVAL(element);
- /* Call ourself again to handle the base type conversion */
- /* If SafeArrayGetElement proclaims to allocate */
- /* memory for a BSTR, so the recursive call frees */
- /* the string correctly */
- if (FAILURE == php_variant_to_pval(&vv, element, persistent, codepage))
- {
- /* Error occurred setting up array element */
- /* Error was displayed by the recursive call */
- FREE_ZVAL(element);
- /* TODO: Do we stop here, or go on and */
- /* try to make sense of the rest of the array */
- /* Going on leads to multiple errors displayed */
- /* for the same conversion. For large arrays that */
- /* could be very annoying */
- /* And if we don't go on - what to do about */
- /* the parts of the array that are OK? */
- /* break; */
- }
- else
- {
- /* Just insert the element into our return array */
- add_index_zval(pval_arg, ii, element);
- }
- }
- SafeArrayUnlock(array);
- /* Clean up the SafeArray since that is our responsibility */
- SafeArrayDestroyData(array);
- SafeArrayDestroyDescriptor(array);
- }
- else switch(var_arg->vt & ~VT_BYREF)
- {
- case VT_EMPTY:
- var_uninit(pval_arg);
- break;
-
- case VT_UI1:
- if(V_ISBYREF(var_arg))
- {
- ZVAL_LONG(pval_arg, (long)*V_UI4REF(var_arg));
- }
- else
- {
- ZVAL_LONG(pval_arg, (long)V_UI4(var_arg));
- }
- break;
-
- case VT_I2:
- if(V_ISBYREF(var_arg))
- {
- ZVAL_LONG(pval_arg, (long )*V_I2REF(var_arg));
- }
- else
- {
- ZVAL_LONG(pval_arg, (long)V_I2(var_arg));
- }
- break;
-
- case VT_I4:
- if(V_ISBYREF(var_arg))
- {
- ZVAL_LONG(pval_arg, *V_I4REF(var_arg));
- }
- else
- {
- ZVAL_LONG(pval_arg, V_I4(var_arg));
- }
- break;
-
- case VT_R4:
- if(V_ISBYREF(var_arg))
- {
- ZVAL_DOUBLE(pval_arg, (double)*V_R4REF(var_arg));
- }
- else
- {
- ZVAL_DOUBLE(pval_arg, (double)V_R4(var_arg));
- }
- break;
-
- case VT_R8:
- if(V_ISBYREF(var_arg))
- {
- ZVAL_DOUBLE(pval_arg, *V_R8REF(var_arg));
- }
- else
- {
- ZVAL_DOUBLE(pval_arg, V_R8(var_arg));
- }
- break;
-
- /* 96bit uint */
- case VT_DECIMAL:
- {
- OLECHAR *unicode_str;
- switch(VarBstrFromDec(&V_DECIMAL(var_arg), LOCALE_SYSTEM_DEFAULT, 0, &unicode_str))
- {
- case S_OK:
- Z_STRVAL_P(pval_arg) = php_OLECHAR_to_char(unicode_str, &Z_STRLEN_P(pval_arg), persistent, codepage);
- Z_TYPE_P(pval_arg) = IS_STRING;
- break;
-
- default:
- ZVAL_NULL(pval_arg);
- ret = FAILURE;
- php_error(E_WARNING, "Error converting DECIMAL value to PHP string");
- break;
- }
- }
- break;
-
- /* Currency */
- case VT_CY:
- if(V_ISBYREF(var_arg))
- {
- VarR8FromCy(*V_CYREF(var_arg), &Z_DVAL_P(pval_arg));
- }
- else
- {
- VarR8FromCy(V_CY(var_arg), &Z_DVAL_P(pval_arg));
- }
- Z_TYPE_P(pval_arg) = IS_DOUBLE;
- break;
-
- case VT_BOOL:
- if(V_ISBYREF(var_arg))
- {
- ZVAL_BOOL(pval_arg, *V_BOOLREF(var_arg));
- }
- else
- {
- ZVAL_BOOL(pval_arg, V_BOOL(var_arg));
- }
- break;
-
- case VT_NULL:
- case VT_VOID:
- ZVAL_NULL(pval_arg);
- break;
-
- case VT_VARIANT:
- php_variant_to_pval(V_VARIANTREF(var_arg), pval_arg, persistent, codepage);
- break;
-
- case VT_BSTR:
- if(V_ISBYREF(var_arg))
- {
- Z_STRVAL_P(pval_arg) = php_OLECHAR_to_char(*V_BSTRREF(var_arg), &Z_STRLEN_P(pval_arg), persistent, codepage);
- SysFreeString(*V_BSTRREF(var_arg));
- efree(V_BSTRREF(var_arg));
- }
- else
- {
- Z_STRVAL_P(pval_arg) = php_OLECHAR_to_char(V_BSTR(var_arg), &Z_STRLEN_P(pval_arg), persistent, codepage);
- SysFreeString(V_BSTR(var_arg));
- }
-
- Z_TYPE_P(pval_arg) = IS_STRING;
- break;
-
- case VT_DATE:
- {
- SYSTEMTIME wintime;
- struct tm phptime;
-
- if(V_ISBYREF(var_arg))
- {
- VariantTimeToSystemTime(*V_DATEREF(var_arg), &wintime);
- }
- else
- {
- VariantTimeToSystemTime(V_DATE(var_arg), &wintime);
- }
-
- phptime.tm_year = wintime.wYear - 1900;
- phptime.tm_mon = wintime.wMonth - 1;
- phptime.tm_mday = wintime.wDay;
- phptime.tm_hour = wintime.wHour;
- phptime.tm_min = wintime.wMinute;
- phptime.tm_sec = wintime.wSecond;
- phptime.tm_isdst = -1;
-
- tzset();
- ZVAL_LONG(pval_arg, mktime(&phptime));
- }
- break;
-
- case VT_UNKNOWN:
- if(V_UNKNOWN(var_arg) == NULL)
- {
- V_DISPATCH(var_arg) = NULL;
- }
- else
- {
- HRESULT hr;
-
- hr = V_UNKNOWN(var_arg)->lpVtbl->QueryInterface(var_arg->punkVal, &IID_IDispatch, &V_DISPATCH(var_arg));
-
- if(FAILED(hr))
- {
- char *error_message;
-
- error_message = php_COM_error_message(hr);
- php_error(E_WARNING,"Unable to obtain IDispatch interface: %s", error_message);
- LocalFree(error_message);
-
- V_DISPATCH(var_arg) = NULL;
- }
- }
- /* break missing intentionaly */
- case VT_DISPATCH:
- {
- pval *handle;
- comval *obj;
-
- if(V_DISPATCH(var_arg) == NULL)
- {
- ret = FAILURE;
- ZVAL_NULL(pval_arg);
- }
- else
- {
- obj = emalloc(sizeof(comval));
- php_COM_set(obj, V_DISPATCH(var_arg), TRUE);
-
- Z_TYPE_P(pval_arg) = IS_OBJECT;
- pval_arg->value.obj.ce = &com_class_entry;
- ALLOC_HASHTABLE(pval_arg->value.obj.properties);
- zend_hash_init(pval_arg->value.obj.properties, 0, NULL, ZVAL_PTR_DTOR, 0);
-
- ALLOC_ZVAL(handle);
- INIT_PZVAL(handle);
- ZVAL_LONG(handle, zend_list_insert(obj, php_COM_get_le_idispatch()));
-
- pval_copy_constructor(handle);
- zend_hash_index_update(pval_arg->value.obj.properties, 0, &handle, sizeof(pval *), NULL);
- }
- }
- break;
-
- case VT_I1:
- if(V_ISBYREF(var_arg))
- {
- ZVAL_LONG(pval_arg, (long)*V_I1REF(var_arg));
- }
- else
- {
- ZVAL_LONG(pval_arg, (long)V_I1(var_arg));
- }
- break;
-
- case VT_UI2:
- if(V_ISBYREF(var_arg))
- {
- ZVAL_LONG(pval_arg, (long)*V_UI2REF(var_arg));
- }
- else
- {
- ZVAL_LONG(pval_arg, (long)V_UI2(var_arg));
- }
- break;
-
- case VT_UI4:
- if(V_ISBYREF(var_arg))
- {
- ZVAL_LONG(pval_arg, (long)*V_UI4REF(var_arg));
- }
- else
- {
- ZVAL_LONG(pval_arg, (long)V_UI4(var_arg));
- }
- break;
-
- case VT_INT:
- if(V_ISBYREF(var_arg))
- {
- ZVAL_LONG(pval_arg, (long)*V_INTREF(var_arg));
- }
- else
- {
- ZVAL_LONG(pval_arg, (long)V_INT(var_arg));
- }
- break;
-
- case VT_UINT:
- if(V_ISBYREF(var_arg))
- {
- ZVAL_LONG(pval_arg, (long)*V_UINTREF(var_arg));
- }
- else
- {
- ZVAL_LONG(pval_arg, (long)V_UINT(var_arg));
- }
- break;
-
- default:
- php_error(E_WARNING,"Unsupported variant type: %d (0x%X)", V_VT(var_arg), V_VT(var_arg));
- ZVAL_NULL(pval_arg);
- ret = FAILURE;
- break;
- }
- return ret;
-}
-
-PHPAPI OLECHAR *php_char_to_OLECHAR(char *C_str, uint strlen, int codepage)
-{
- OLECHAR *unicode_str;
-
- //request needed buffersize
- uint reqSize = MultiByteToWideChar(codepage, MB_PRECOMPOSED | MB_ERR_INVALID_CHARS, C_str, -1, NULL, 0);
-
- if(reqSize)
- {
- unicode_str = (OLECHAR *) emalloc(sizeof(OLECHAR) * reqSize);
-
- //convert string
- MultiByteToWideChar(codepage, MB_PRECOMPOSED | MB_ERR_INVALID_CHARS, C_str, -1, unicode_str, reqSize);
- }
- else
- {
- unicode_str = (OLECHAR *) emalloc(sizeof(OLECHAR));
- *unicode_str = 0;
-
- switch(GetLastError())
- {
- case ERROR_NO_UNICODE_TRANSLATION:
- php_error(E_WARNING,"No unicode translation available for the specified string");
- break;
- default:
- php_error(E_WARNING,"Error in php_char_to_OLECHAR()");
- }
- }
-
- return unicode_str;
-}
-
-PHPAPI char *php_OLECHAR_to_char(OLECHAR *unicode_str, uint *out_length, int persistent, int codepage)
-{
- char *C_str;
- uint length = 0;
-
- //request needed buffersize
- uint reqSize = WideCharToMultiByte(codepage, WC_COMPOSITECHECK, unicode_str, -1, NULL, 0, NULL, NULL);
-
- if(reqSize)
- {
- C_str = (char *) pemalloc(sizeof(char) * reqSize, persistent);
-
- //convert string
- length = WideCharToMultiByte(codepage, WC_COMPOSITECHECK, unicode_str, -1, C_str, reqSize, NULL, NULL) - 1;
- }
- else
- {
- C_str = (char *) pemalloc(sizeof(char), persistent);
- *C_str = 0;
-
- php_error(E_WARNING,"Error in php_OLECHAR_to_char()");
- }
-
- if(out_length)
- {
- *out_length = length;
- }
-
- return C_str;
-}
-
-#endif /* PHP_WIN32 */
diff --git a/ext/com/conversion.h b/ext/com/conversion.h
deleted file mode 100644
index 53d19a21de..0000000000
--- a/ext/com/conversion.h
+++ /dev/null
@@ -1,14 +0,0 @@
-#ifndef CONVERSION_H
-#define CONVERSION_H
-
-BEGIN_EXTERN_C()
-
-extern void php_pval_to_variant(pval *pval_arg, VARIANT *var_arg, int codepage);
-extern void php_pval_to_variant_ex(pval *pval_arg, VARIANT *var_arg, pval *pval_type, int codepage);
-extern int php_variant_to_pval(VARIANT *var_arg, pval *pval_arg, int persistent, int codepage);
-extern OLECHAR *php_char_to_OLECHAR(char *C_str, uint strlen, int codepage);
-extern char *php_OLECHAR_to_char(OLECHAR *unicode_str, uint *out_length, int persistent, int codepage);
-
-END_EXTERN_C()
-
-#endif \ No newline at end of file
diff --git a/ext/com/php_COM.h b/ext/com/php_COM.h
deleted file mode 100644
index 5a3d1a01bb..0000000000
--- a/ext/com/php_COM.h
+++ /dev/null
@@ -1,33 +0,0 @@
-#ifndef PHP_COM_H
-#define PHP_COM_H
-
-#if PHP_WIN32
-
-BEGIN_EXTERN_C()
-
-#include "com.h"
-
-extern PHP_MINIT_FUNCTION(COM);
-extern PHP_MSHUTDOWN_FUNCTION(COM);
-
-extern int php_COM_get_le_idispatch();
-
-extern zend_module_entry COM_module_entry;
-extern zend_class_entry com_class_entry;
-
-extern pval php_COM_get_property_handler(zend_property_reference *property_reference);
-extern int php_COM_set_property_handler(zend_property_reference *property_reference, pval *value);
-extern char *php_COM_error_message(HRESULT hr);
-extern void php_COM_call_function_handler(INTERNAL_FUNCTION_PARAMETERS, zend_property_reference *property_reference);
-
-END_EXTERN_C()
-
-#define COM_module_ptr &COM_module_entry
-
-#else
-
-#define COM_module_ptr NULL
-
-#endif /* PHP_WIN32 */
-
-#endif /* PHP_COM_H */
diff --git a/ext/com/php_VARIANT.h b/ext/com/php_VARIANT.h
deleted file mode 100644
index 0382b88a64..0000000000
--- a/ext/com/php_VARIANT.h
+++ /dev/null
@@ -1,21 +0,0 @@
-#ifndef PHP_TYPEDEF_VARIANT_H
-#define PHP_TYPEDEF_VARIANT_H
-
-#if PHP_WIN32
-
-extern PHP_MINIT_FUNCTION(VARIANT);
-extern PHP_MSHUTDOWN_FUNCTION(VARIANT);
-
-extern zend_module_entry VARIANT_module_entry;
-
-#define VARIANT_module_ptr &VARIANT_module_entry
-
-#else
-
-#define VARIANT_module_ptr NULL
-
-#endif /* PHP_WIN32 */
-
-#define phpext_VARIANT_ptr VARIANT_module_ptr
-
-#endif /* PHP_TYPEDEF_VARIANT_H */
diff --git a/ext/cpdf/CREDITS b/ext/cpdf/CREDITS
deleted file mode 100644
index 94cc1de43c..0000000000
--- a/ext/cpdf/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-cpdf
-Uwe Steinmann
diff --git a/ext/cpdf/Makefile.in b/ext/cpdf/Makefile.in
deleted file mode 100644
index 7a74ccdba5..0000000000
--- a/ext/cpdf/Makefile.in
+++ /dev/null
@@ -1,5 +0,0 @@
-
-LTLIBRARY_NAME = libcpdf.la
-LTLIBRARY_SOURCES = cpdf.c
-
-include $(top_srcdir)/build/dynlib.mk
diff --git a/ext/cpdf/config.m4 b/ext/cpdf/config.m4
deleted file mode 100644
index 724092403d..0000000000
--- a/ext/cpdf/config.m4
+++ /dev/null
@@ -1,72 +0,0 @@
-dnl $Id$
-
-AC_MSG_CHECKING(whether to include cpdflib support)
-AC_ARG_WITH(cpdflib,
-[ --with-cpdflib[=DIR] Include cpdflib support (requires cpdflib >= 2).
- DIR is the cpdfllib install directory,
- defaults to /usr.],
-[
- case $withval in
- no)
- AC_MSG_RESULT(no) ;;
- yes)
- AC_MSG_RESULT(yes)
- PHP_EXTENSION(cpdf)
- AC_CHECK_LIB(cpdf, cpdf_open, [AC_DEFINE(HAVE_CPDFLIB,1,[Whether you have cpdflib])],
- [AC_MSG_ERROR(Cpdf module requires cpdflib >= 2.)])
- PHP_ADD_LIBRARY(cpdf)
- PHP_ADD_LIBRARY(tiff)
- PHP_ADD_LIBRARY(jpeg)
- ;;
- *)
- test -f $withval/include/cpdflib.h && CPDFLIB_INCLUDE=$withval/include
- if test -n "$CPDFLIB_INCLUDE" ; then
- AC_MSG_RESULT(yes)
- PHP_EXTENSION(cpdf)
- old_LIBS=$LIBS
- old_withval=$withval
-
- AC_MSG_CHECKING([for libjpeg (needed by cpdflib 2.x)])
- AC_ARG_WITH(jpeg-dir,
- [ --with-jpeg-dir[=DIR] jpeg dir for cpdflib 2.x],[
- AC_MSG_RESULT(yes)
- if test -z $withval; then
- withval=/usr/local
- fi
- LIBS="$LIBS -L$withval/lib"
- AC_CHECK_LIB(jpeg,jpeg_read_header, ,[AC_MSG_RESULT(no)],)
- PHP_ADD_LIBRARY_WITH_PATH(jpeg, $withval/lib)
- ],[
- AC_MSG_RESULT(no)
- AC_MSG_WARN(If configure fails try --with-jpeg-dir=<DIR>)
- ])
-
- AC_MSG_CHECKING([for libtiff (needed by cpdflib 2.x)])
- AC_ARG_WITH(tiff-dir,
- [ --with-tiff-dir[=DIR] tiff dir for cpdflib 2.x],[
- AC_MSG_RESULT(yes)
- if test -z $withval; then
- withval=/usr/local
- fi
- LIBS="$LIBS -L$withval/lib"
- AC_CHECK_LIB(tiff,TIFFOpen, ,[AC_MSG_RESULT(no)],)
- PHP_ADD_LIBRARY_WITH_PATH(tiff, $withval/lib)
- ],[
- AC_MSG_RESULT(no)
- AC_MSG_WARN(If configure fails try --with-tiff-dir=<DIR>)
- ])
- withval=$old_withval
-
- LIBS="$LIBS -L$withval/lib"
- AC_CHECK_LIB(cpdf, cpdf_open, [AC_DEFINE(HAVE_CPDFLIB,1,[Whether you have cpdflib])],
- [AC_MSG_ERROR(Cpdflib module requires cpdflib >= 2.)])
- LIBS=$old_LIBS
- PHP_ADD_LIBRARY_WITH_PATH(cpdf, $withval/lib)
- PHP_ADD_INCLUDE($CPDFLIB_INCLUDE)
- else
- AC_MSG_RESULT(no)
- fi ;;
- esac
-],[
- AC_MSG_RESULT(no)
-])
diff --git a/ext/cpdf/cpdf.c b/ext/cpdf/cpdf.c
deleted file mode 100644
index 9fa91bf4f3..0000000000
--- a/ext/cpdf/cpdf.c
+++ /dev/null
@@ -1,2715 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Uwe Steinmann <Uwe.Steinmann@fernuni-hagen.de> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-/* cpdflib.h -- C language API definitions for ClibPDF library
- * Copyright (C) 1998 FastIO Systems, All Rights Reserved.
-*/
-
-/* Note that there is no code from the cpdflib package in this file */
-
-#if !PHP_31 && defined(THREAD_SAFE)
-#undef THREAD_SAFE
-#endif
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "php_globals.h"
-#include "zend/zend_list.h"
-#include "ext/standard/php_standard.h"
-#include "ext/standard/head.h"
-#include <math.h>
-#if HAVE_LIBGD13
-#include <gd.h>
-#endif
-
-#ifdef HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-#ifdef PHP_WIN32
-# include <io.h>
-# include <fcntl.h>
-#endif
-
-#if HAVE_CPDFLIB
-#include "php_cpdf.h"
-#include "ext/standard/info.h"
-
-#ifdef THREAD_SAFE
-DWORD CPDFlibTls;
-static int numthreads=0;
-
-typedef struct cpdflib_global_struct{
- int le_cpdf;
- int le_outline;
-#if HAVE_LIBGD13
- int le_gd;
-#endif
-} cpdflib_global_struct;
-
-# define CPDF_GLOBAL(a) cpdflib_globals->a
-# define CPDF_TLS_VARS cpdflib_global_struct *cpdflib_globals=TlsGetValue(CPDFlibTls)
-
-#else
-# define CPDF_GLOBAL(a) a
-# define CPDF_TLS_VARS
-static int le_cpdf;
-static int le_outline;
-#if HAVE_LIBGD13
-static int le_gd;
-#endif
-#endif
-
-function_entry cpdf_functions[] = {
- PHP_FE(cpdf_global_set_document_limits, NULL)
- PHP_FE(cpdf_set_creator, NULL)
- PHP_FE(cpdf_set_title, NULL)
- PHP_FE(cpdf_set_subject, NULL)
- PHP_FE(cpdf_set_keywords, NULL)
- PHP_FE(cpdf_open, NULL)
- PHP_FE(cpdf_close, NULL)
- PHP_FE(cpdf_set_viewer_preferences, NULL)
- PHP_FE(cpdf_page_init, NULL)
- PHP_FE(cpdf_finalize_page, NULL)
- PHP_FE(cpdf_set_current_page, NULL)
- PHP_FE(cpdf_begin_text, NULL)
- PHP_FE(cpdf_end_text, NULL)
- PHP_FE(cpdf_show, NULL)
- PHP_FE(cpdf_show_xy, NULL)
- PHP_FE(cpdf_text, NULL)
- PHP_FE(cpdf_continue_text, NULL)
- PHP_FE(cpdf_set_font, NULL)
- PHP_FE(cpdf_set_font_directories, NULL)
- PHP_FE(cpdf_set_font_map_file, NULL)
- PHP_FE(cpdf_set_leading, NULL)
- PHP_FE(cpdf_set_text_rendering, NULL)
- PHP_FE(cpdf_set_horiz_scaling, NULL)
- PHP_FE(cpdf_set_text_rise, NULL)
- PHP_FE(cpdf_set_text_matrix, NULL)
- PHP_FE(cpdf_set_text_pos, NULL)
- PHP_FE(cpdf_rotate_text, NULL)
- PHP_FE(cpdf_set_char_spacing, NULL)
- PHP_FE(cpdf_set_word_spacing, NULL)
- PHP_FE(cpdf_stringwidth, NULL)
- PHP_FE(cpdf_save, NULL)
- PHP_FE(cpdf_restore, NULL)
- PHP_FE(cpdf_translate, NULL)
- PHP_FE(cpdf_scale, NULL)
- PHP_FE(cpdf_rotate, NULL)
- PHP_FE(cpdf_setflat, NULL)
- PHP_FE(cpdf_setlinejoin, NULL)
- PHP_FE(cpdf_setlinecap, NULL)
- PHP_FE(cpdf_setmiterlimit, NULL)
- PHP_FE(cpdf_setlinewidth, NULL)
- PHP_FE(cpdf_setdash, NULL)
- PHP_FE(cpdf_moveto, NULL)
- PHP_FE(cpdf_rmoveto, NULL)
- PHP_FE(cpdf_lineto, NULL)
- PHP_FE(cpdf_rlineto, NULL)
- PHP_FE(cpdf_curveto, NULL)
- PHP_FE(cpdf_circle, NULL)
- PHP_FE(cpdf_arc, NULL)
- PHP_FE(cpdf_rect, NULL)
- PHP_FE(cpdf_newpath, NULL)
- PHP_FE(cpdf_closepath, NULL)
- PHP_FE(cpdf_stroke, NULL)
- PHP_FE(cpdf_closepath_stroke, NULL)
- PHP_FE(cpdf_fill, NULL)
- PHP_FE(cpdf_fill_stroke, NULL)
- PHP_FE(cpdf_closepath_fill_stroke, NULL)
- PHP_FE(cpdf_clip, NULL)
- PHP_FE(cpdf_setgray_fill, NULL)
- PHP_FE(cpdf_setgray_stroke, NULL)
- PHP_FE(cpdf_setgray, NULL)
- PHP_FE(cpdf_setrgbcolor_fill, NULL)
- PHP_FE(cpdf_setrgbcolor_stroke, NULL)
- PHP_FE(cpdf_setrgbcolor, NULL)
- PHP_FE(cpdf_set_page_animation, NULL)
- PHP_FE(cpdf_finalize, NULL)
- PHP_FE(cpdf_output_buffer, NULL)
- PHP_FE(cpdf_save_to_file, NULL)
- PHP_FE(cpdf_import_jpeg, NULL)
-#if HAVE_LIBGD13
- PHP_FE(cpdf_place_inline_image, NULL)
-#endif
- PHP_FE(cpdf_add_annotation, NULL)
- PHP_FE(cpdf_add_outline, NULL)
- PHP_FE(cpdf_set_action_url, NULL)
- {NULL, NULL, NULL}
-};
-
-zend_module_entry cpdf_module_entry = {
- "cpdf", cpdf_functions, PHP_MINIT(cpdf), PHP_MSHUTDOWN(cpdf), PHP_RINIT(cpdf), NULL, PHP_MINFO(cpdf), STANDARD_MODULE_PROPERTIES
-};
-
-#ifdef COMPILE_DL_CPDF
-ZEND_GET_MODULE(cpdf)
-#endif
-
-static void _free_outline(zend_rsrc_list_entry *rsrc)
-{
-}
-
-static void _free_doc(zend_rsrc_list_entry *rsrc)
-{
- CPDFdoc *pdf = (CPDFdoc *)rsrc->ptr;
- cpdf_close(pdf);
-}
-
-PHP_MINIT_FUNCTION(cpdf)
-{
- CPDF_GLOBAL(le_outline) = zend_register_list_destructors_ex(_free_outline, NULL, "cpdf outline", module_number);
- CPDF_GLOBAL(le_cpdf) = zend_register_list_destructors_ex(_free_doc, NULL, "cpdf", module_number);
-
- REGISTER_LONG_CONSTANT("CPDF_PM_NONE", PM_NONE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("CPDF_PM_OUTLINES", PM_OUTLINES, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("CPDF_PM_THUMBS", PM_THUMBS, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("CPDF_PM_FULLSCREEN", PM_FULLSCREEN, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("CPDF_PL_SINGLE", PL_SINGLE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("CPDF_PL_1COLUMN", PL_1COLUMN, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("CPDF_PL_2LCOLUMN", PL_2LCOLUMN, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("CPDF_PL_2RCOLUMN", PL_2RCOLUMN, CONST_CS | CONST_PERSISTENT);
-
-
- return SUCCESS;
-}
-
-PHP_RINIT_FUNCTION(cpdf)
-{
-/* CPDF_GLOBAL(le_outline) = NULL; */
- return SUCCESS;
-}
-
-PHP_MINFO_FUNCTION(cpdf) {
- /* need to use a PHPAPI function here because it is external module in windows */
- /* (don't knwo if that still applies (cmv) */
- php_info_print_table_start();
- php_info_print_table_row(2, "CPDF Support", "enabled");
- php_info_print_table_row(2, "Version", cpdf_version() );
- php_info_print_table_end();
-}
-
-PHP_MSHUTDOWN_FUNCTION(cpdf){
- return SUCCESS;
-}
-
-/* {{{ proto void cpdf_global_set_document_limits(int maxPages, int maxFonts, int maxImages, int maxAnnots, int maxObjects)
- Sets document settings for all documents */
-PHP_FUNCTION(cpdf_global_set_document_limits) {
- pval *argv[5];
- int argc;
- CPDF_TLS_VARS;
-
- argc = ZEND_NUM_ARGS();
- if(argc != 5)
- WRONG_PARAM_COUNT;
- if (getParametersArray(ht, argc, argv) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_long(argv[0]);
- convert_to_long(argv[1]);
- convert_to_long(argv[2]);
- convert_to_long(argv[3]);
- convert_to_long(argv[4]);
-
- cpdf_setGlobalDocumentLimits(argv[0]->value.lval, argv[1]->value.lval, argv[2]->value.lval, argv[3]->value.lval, argv[4]->value.lval);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool cpdf_set_creator(int pdfdoc, string creator)
- Sets the creator field */
-PHP_FUNCTION(cpdf_set_creator) {
- pval *arg1, *arg2;
- int id, type;
- CPDFdoc *pdf;
- CPDF_TLS_VARS;
-
-
- if (ZEND_NUM_ARGS() != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(arg1);
- convert_to_string(arg2);
- id=arg1->value.lval;
- pdf = zend_list_find(id,&type);
- if (!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
- php_error(E_WARNING,"Unable to find identifier %d (type=%d)",id, type);
- RETURN_FALSE;
- }
-
- cpdf_setCreator(pdf, arg2->value.str.val);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool cpdf_set_title(int pdfptr, string title)
- Fills the title field of the info structure */
-PHP_FUNCTION(cpdf_set_title) {
- pval *arg1, *arg2;
- int id, type;
- CPDFdoc *pdf;
- CPDF_TLS_VARS;
-
-
- if (ZEND_NUM_ARGS() != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(arg1);
- convert_to_string(arg2);
- id=arg1->value.lval;
- pdf = zend_list_find(id,&type);
- if (!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
- php_error(E_WARNING,"Unable to find identifier %d (type=%d)",id, type);
- RETURN_FALSE;
- }
-
- cpdf_setTitle(pdf, arg2->value.str.val);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool cpdf_set_subject(int pdfptr, string subject)
- Fills the subject field of the info structure */
-PHP_FUNCTION(cpdf_set_subject) {
- pval *arg1, *arg2;
- int id, type;
- CPDFdoc *pdf;
- CPDF_TLS_VARS;
-
-
- if (ZEND_NUM_ARGS() != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(arg1);
- convert_to_string(arg2);
- id=arg1->value.lval;
- pdf = zend_list_find(id,&type);
- if (!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
- php_error(E_WARNING,"Unable to find identifier %d (type=%d)",id, type);
- RETURN_FALSE;
- }
-
- cpdf_setSubject(pdf, arg2->value.str.val);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool cpdf_set_keywords(int pdfptr, string keywords)
- Fills the keywords field of the info structure */
-PHP_FUNCTION(cpdf_set_keywords) {
- pval *arg1, *arg2;
- int id, type;
- CPDFdoc *pdf;
- CPDF_TLS_VARS;
-
-
- if (ZEND_NUM_ARGS() != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(arg1);
- convert_to_string(arg2);
- id=arg1->value.lval;
- pdf = zend_list_find(id,&type);
- if (!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
- php_error(E_WARNING,"Unable to find identifier %d (type=%d)",id, type);
- RETURN_FALSE;
- }
-
- cpdf_setKeywords(pdf, arg2->value.str.val);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void cpdf_set_viewer_preferences(int pdfdoc, array preferences)
- How to show the document in the viewer */
-PHP_FUNCTION(cpdf_set_viewer_preferences) {
- zval *arg1, *arg2;
- zval **zvalue;
-
- int id, type;
-
- CPDFdoc *pdf;
- CPDFviewerPrefs vP = { 0, 0, 0, 0, 0, 0, 0, 0 };
- CPDF_TLS_VARS;
-
- if(ZEND_NUM_ARGS() != 2)
- WRONG_PARAM_COUNT;
-
- if (getParameters(ht, 2, &arg1, &arg2) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_long(arg1);
- convert_to_array(arg2);
-
- id = Z_LVAL_P (arg1);
-
- pdf = zend_list_find(id,&type);
- if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
- php_error(E_WARNING,"Unable to find identifier %d",id);
- RETURN_FALSE;
- }
-
- if (zend_hash_find (arg2->value.ht, "pagemode", sizeof ("pagemode"), (void **) &zvalue) == SUCCESS)
- {
- convert_to_long_ex (zvalue);
- vP.pageMode = Z_LVAL_PP (zvalue);
- }
- if (zend_hash_find (arg2->value.ht, "hidetoolbar", sizeof ("hidetoolbar"), (void **) &zvalue) == SUCCESS)
- {
- convert_to_long_ex (zvalue);
- vP.hideToolbar = Z_LVAL_PP (zvalue);
- }
- if (zend_hash_find (arg2->value.ht, "hidemenubar", sizeof ("hidemenubar"), (void **) &zvalue) == SUCCESS)
- {
- convert_to_long_ex (zvalue);
- vP.hideMenubar = Z_LVAL_PP (zvalue);
- }
- if (zend_hash_find (arg2->value.ht, "hidewindowui", sizeof ("hidewindowui"), (void **) &zvalue) == SUCCESS)
- {
- convert_to_long_ex (zvalue);
- vP.hideWindowUI = Z_LVAL_PP (zvalue);
- }
- if (zend_hash_find (arg2->value.ht, "fitwindow", sizeof ("fitwindow"), (void **) &zvalue) == SUCCESS)
- {
- convert_to_long_ex (zvalue);
- vP.fitWindow = Z_LVAL_PP (zvalue);
- }
- if (zend_hash_find (arg2->value.ht, "centerwindow", sizeof ("centerwindow"), (void **) &zvalue) == SUCCESS)
- {
- convert_to_long_ex (zvalue);
- vP.centerWindow = Z_LVAL_PP (zvalue);
- }
- if (zend_hash_find (arg2->value.ht, "pagelayout", sizeof ("pagelayout"), (void **) &zvalue) == SUCCESS)
- {
- convert_to_long_ex (zvalue);
- vP.pageLayout = Z_LVAL_PP (zvalue);
- }
- if (zend_hash_find (arg2->value.ht, "nonfspagemode", sizeof ("nonfspagemode"), (void **) &zvalue) == SUCCESS)
- {
- convert_to_long_ex (zvalue);
- vP.nonFSPageMode = Z_LVAL_PP (zvalue);
- }
-
- cpdf_setViewerPreferences(pdf, &vP);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int cpdf_open(int compression [, string filename [, array doc_limits]])
- Opens a new pdf document */
-PHP_FUNCTION(cpdf_open) {
- pval *arg1, *arg2, *arg3;
- int id, argc;
- CPDFdoc *cpdf;
- CPDF_TLS_VARS;
-
- argc = ZEND_NUM_ARGS();
- switch(argc) {
- case 1:
- if (getParameters(ht, 1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- break;
- case 2:
- if (getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- break;
- case 3:
- if (getParameters(ht, 3, &arg1, &arg2, &arg3) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(arg1);
-
- cpdf = cpdf_open(0, NULL);
- if(!cpdf)
- RETURN_FALSE;
- if(arg1->value.lval == 1)
- cpdf_enableCompression(cpdf, YES);
- else
- cpdf_enableCompression(cpdf, NO);
-
- if(argc > 1) {
- convert_to_string(arg2);
-#if APACHE
- if(strcmp(arg2->value.str.val, "-") == 0)
- php_error(E_WARNING,"Writing to stdout as described in the ClibPDF manual is not possible if php is used as an Apache module. Write to a memory stream and use cpdf_output_buffer() instead.");
-#endif
- cpdf_setOutputFilename(cpdf, arg2->value.str.val);
- }
- cpdf_init(cpdf);
-
- id = zend_list_insert(cpdf, CPDF_GLOBAL(le_cpdf));
- RETURN_LONG(id);
-}
-/* }}} */
-
-/* {{{ proto void cpdf_close(int pdfdoc)
- Closes the pdf document */
-PHP_FUNCTION(cpdf_close) {
- pval *arg1;
- int id, type;
- CPDFdoc *pdf;
- CPDF_TLS_VARS;
-
- if (ZEND_NUM_ARGS() != 1 || getParameters(ht, 1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(arg1);
- id=arg1->value.lval;
- pdf = zend_list_find(id,&type);
- if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
- php_error(E_WARNING,"Unable to find identifier %d",id);
- RETURN_FALSE;
- }
- zend_list_delete(id);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-#define BUFFERLEN 40
-/* {{{ proto void cpdf_page_init(int pdfdoc, int pagenr, int orientation, int height, int width [, double unit])
- Starts page */
-PHP_FUNCTION(cpdf_page_init) {
- pval *argv[6];
- int id, type, pagenr, orientation;
- int height, width, argc;
- char buffer[BUFFERLEN];
- CPDFdoc *pdf;
- CPDF_TLS_VARS;
-
- argc = ZEND_NUM_ARGS();
- if(argc < 5 || argc > 6)
- WRONG_PARAM_COUNT;
- if (getParametersArray(ht, argc, argv) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_long(argv[0]);
- convert_to_long(argv[1]);
- convert_to_long(argv[2]);
- convert_to_long(argv[3]);
- convert_to_long(argv[4]);
- id=argv[0]->value.lval;
- pagenr=argv[1]->value.lval;
- orientation=argv[2]->value.lval;
- height = argv[3]->value.lval;
- width = argv[4]->value.lval;
- pdf = zend_list_find(id,&type);
- if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
- php_error(E_WARNING,"Unable to find identifier %d",id);
- RETURN_FALSE;
- }
-
- if(argc > 5) {
- convert_to_double(argv[5]);
- if(argv[5]->value.dval > 0.0)
- cpdf_setDefaultDomainUnit(pdf, argv[5]->value.dval);
- }
- snprintf(buffer, BUFFERLEN, "0 0 %d %d", width, height);
- cpdf_pageInit(pdf, pagenr, orientation, buffer, buffer);
-
- RETURN_TRUE;
-}
-/* }}} */
-#undef BUFFERLEN
-
-/* {{{ proto void cpdf_finalize_page(int pdfdoc, int pagenr)
- Ends the page to save memory */
-PHP_FUNCTION(cpdf_finalize_page) {
- pval *arg1, *arg2;
- int id, type, pagenr;
- CPDFdoc *pdf;
- CPDF_TLS_VARS;
-
- if (ZEND_NUM_ARGS() != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(arg1);
- convert_to_long(arg2);
- id=arg1->value.lval;
- pagenr=arg2->value.lval;
- pdf = zend_list_find(id,&type);
- if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
- php_error(E_WARNING,"Unable to find identifier %d",id);
- RETURN_FALSE;
- }
-
- cpdf_finalizePage(pdf, pagenr);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void cpdf_set_current_page(int pdfdoc, int pagenr)
- Sets page for output */
-PHP_FUNCTION(cpdf_set_current_page) {
- pval *arg1, *arg2;
- int id, type, pagenr;
- CPDFdoc *pdf;
- CPDF_TLS_VARS;
-
- if (ZEND_NUM_ARGS() != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(arg1);
- convert_to_long(arg2);
- id=arg1->value.lval;
- pagenr=arg2->value.lval;
- pdf = zend_list_find(id,&type);
- if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
- php_error(E_WARNING,"Unable to find identifier %d",id);
- RETURN_FALSE;
- }
-
- cpdf_setCurrentPage(pdf, pagenr);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void cpdf_begin_text(int pdfdoc)
- Starts text section */
-PHP_FUNCTION(cpdf_begin_text) {
- pval *arg1;
- int id, type;
- CPDFdoc *pdf;
- CPDF_TLS_VARS;
-
- if (ZEND_NUM_ARGS() != 1 || getParameters(ht, 1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(arg1);
- id=arg1->value.lval;
- pdf = zend_list_find(id,&type);
- if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
- php_error(E_WARNING,"Unable to find identifier %d",id);
- RETURN_FALSE;
- }
-
- cpdf_beginText(pdf, 0);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void cpdf_end_text(int pdfdoc)
- Ends text section */
-PHP_FUNCTION(cpdf_end_text) {
- pval *arg1;
- int id, type;
- CPDFdoc *pdf;
- CPDF_TLS_VARS;
-
- if (ZEND_NUM_ARGS() != 1 || getParameters(ht, 1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(arg1);
- id=arg1->value.lval;
- pdf = zend_list_find(id,&type);
- if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
- php_error(E_WARNING,"Unable to find identifier %d",id);
- RETURN_FALSE;
- }
-
- cpdf_endText(pdf);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void cpdf_show(int pdfdoc, string text)
- Output text at current position */
-PHP_FUNCTION(cpdf_show) {
- pval *arg1, *arg2;
- int id, type;
- CPDFdoc *pdf;
- CPDF_TLS_VARS;
-
- if (ZEND_NUM_ARGS() != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(arg1);
- convert_to_string(arg2);
- id=arg1->value.lval;
- pdf = zend_list_find(id,&type);
- if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
- php_error(E_WARNING,"Unable to find identifier %d",id);
- RETURN_FALSE;
- }
-
- cpdf_textShow(pdf, arg2->value.str.val);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void cpdf_show_xy(int pdfdoc, string text, double x-koor, double y-koor [, int mode])
- Output text at position */
-PHP_FUNCTION(cpdf_show_xy) {
- pval *argv[5];
- int id, type, argc, mode=0;
- CPDFdoc *pdf;
- CPDF_TLS_VARS;
-
- argc = ZEND_NUM_ARGS();
- if((argc < 4) || (argc > 5))
- WRONG_PARAM_COUNT;
- if (getParametersArray(ht, argc, argv) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_long(argv[0]);
- convert_to_string(argv[1]);
- convert_to_double(argv[2]);
- convert_to_double(argv[3]);
- id=argv[0]->value.lval;
- pdf = zend_list_find(id,&type);
- if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
- php_error(E_WARNING,"Unable to find identifier %d",id);
- RETURN_FALSE;
- }
-
- if(argc == 5) {
- convert_to_long(argv[4]);
- mode = argv[4]->value.lval;
- }
- if(mode == 1)
- cpdf_rawText(pdf, (float) argv[2]->value.dval, (float) argv[3]->value.dval, 0.0, argv[1]->value.str.val);
- else
- cpdf_text(pdf, (float) argv[2]->value.dval, (float) argv[3]->value.dval, 0.0, argv[1]->value.str.val);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void cpdf_continue_text(int pdfdoc, string text)
- Output text in next line */
-PHP_FUNCTION(cpdf_continue_text) {
- pval *arg1, *arg2;
- int id, type;
- CPDFdoc *pdf;
- CPDF_TLS_VARS;
-
- if (ZEND_NUM_ARGS() != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(arg1);
- convert_to_string(arg2);
- id=arg1->value.lval;
- pdf = zend_list_find(id,&type);
- if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
- php_error(E_WARNING,"Unable to find identifier %d",id);
- RETURN_FALSE;
- }
-
- cpdf_textCRLFshow(pdf, arg2->value.str.val);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void cpdf_text(int pdfdoc, string text [, double x-koor, double y-koor [, int mode [, double orientation [, int alignmode]]]])
- Output text */
-PHP_FUNCTION(cpdf_text) {
- pval *argv[7];
- int id, type, argc, mode=0;
- CPDFdoc *pdf;
- CPDF_TLS_VARS;
-
- argc = ZEND_NUM_ARGS();
- if((argc < 2) || (argc == 3) || (argc > 7) || getParametersArray(ht, argc, argv) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_long(argv[0]);
- convert_to_string(argv[1]);
- id=argv[0]->value.lval;
- pdf = zend_list_find(id,&type);
- if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
- php_error(E_WARNING,"Unable to find identifier %d",id);
- RETURN_FALSE;
- }
-
- if(argc > 4) {
- convert_to_long(argv[4]);
- mode = argv[2]->value.lval;
- }
- switch(argc) {
- case 2:
- cpdf_textShow(pdf, argv[1]->value.str.val);
- break;
- case 4:
- convert_to_double(argv[2]);
- convert_to_double(argv[3]);
- cpdf_text(pdf, (float) argv[2]->value.dval,
- (float) argv[3]->value.dval,
- 0.0,
- argv[1]->value.str.val);
- break;
- case 5:
- convert_to_double(argv[2]);
- convert_to_double(argv[3]);
- if(mode == 1)
- cpdf_rawText(pdf, (float) argv[2]->value.dval,
- (float) argv[3]->value.dval,
- 0.0,
- argv[1]->value.str.val);
- else
- cpdf_text(pdf, (float) argv[2]->value.dval,
- (float) argv[3]->value.dval,
- 0.0,
- argv[1]->value.str.val);
- break;
- case 6:
- convert_to_double(argv[2]);
- convert_to_double(argv[3]);
- convert_to_double(argv[5]);
- if(mode == 1)
- cpdf_rawText(pdf, (float) argv[2]->value.dval,
- (float) argv[3]->value.dval,
- (float) argv[5]->value.dval,
- argv[1]->value.str.val);
- else
- cpdf_text(pdf, (float) argv[2]->value.dval,
- (float) argv[3]->value.dval,
- (float) argv[5]->value.dval,
- argv[1]->value.str.val);
- break;
- case 7:
- convert_to_double(argv[2]);
- convert_to_double(argv[3]);
- convert_to_double(argv[5]);
- convert_to_long(argv[6]);
- if(mode == 1)
- cpdf_rawTextAligned(pdf, (float) argv[2]->value.dval,
- (float) argv[3]->value.dval,
- (float) argv[5]->value.dval,
- argv[6]->value.lval,
- argv[1]->value.str.val);
- else
- cpdf_textAligned(pdf, (float) argv[2]->value.dval,
- (float) argv[3]->value.dval,
- (float) argv[5]->value.dval,
- argv[6]->value.lval,
- argv[1]->value.str.val);
- break;
- }
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void cpdf_set_font(int pdfdoc, string font, double size, string encoding)
- Select the current font face, size and encoding */
-PHP_FUNCTION(cpdf_set_font) {
- pval *arg1, *arg2, *arg3, *arg4;
- int id, type;
- CPDFdoc *pdf;
- CPDF_TLS_VARS;
-
- if (ZEND_NUM_ARGS() != 4 || getParameters(ht, 4, &arg1, &arg2, &arg3, &arg4) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(arg1);
- convert_to_string(arg2);
- convert_to_double(arg3);
- convert_to_string(arg4);
- id=arg1->value.lval;
- pdf = zend_list_find(id,&type);
- if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
- php_error(E_WARNING,"Unable to find identifier %d",id);
- RETURN_FALSE;
- }
-
-/* if(arg4->value.lval > 6) {
- php_error(E_WARNING,"Font encoding set to 5");
- arg4->value.lval = 5;
- }
-*/
- cpdf_setFont(pdf, arg2->value.str.val, arg4->value.str.val, (float) arg3->value.dval);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void cpdf_set_font_directories(int pdfdoc, string pfmdir, string pfbdir)
- Set directories to search when using external fonts. */
-PHP_FUNCTION(cpdf_set_font_directories) {
- pval *arg1, *arg2, *arg3;
- int id, type;
- CPDFdoc *pdf;
- CPDF_TLS_VARS;
-
- if (ZEND_NUM_ARGS() != 3 || getParameters(ht, 3, &arg1, &arg2, &arg3) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(arg1);
- convert_to_string(arg2);
- convert_to_string(arg3);
- id=arg1->value.lval;
- pdf = zend_list_find(id,&type);
- if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
- php_error(E_WARNING,"Unable to find identifier %d",id);
- RETURN_FALSE;
- }
-
- cpdf_setFontDirectories(pdf, arg2->value.str.val, arg3->value.str.val);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void cpdf_set_font_map_file(int pdfdoc, string filename)
- Set fontname to filename translation map when using external fonts. */
-PHP_FUNCTION(cpdf_set_font_map_file) {
- pval *arg1, *arg2;
- int id, type;
- CPDFdoc *pdf;
- CPDF_TLS_VARS;
-
- if (ZEND_NUM_ARGS() != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(arg1);
- convert_to_string(arg2);
- id=arg1->value.lval;
- pdf = zend_list_find(id,&type);
- if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
- php_error(E_WARNING,"Unable to find identifier %d",id);
- RETURN_FALSE;
- }
-
- cpdf_setFontMapFile(pdf, arg2->value.str.val);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void cpdf_set_leading(int pdfdoc, double distance)
- Sets distance between text lines */
-PHP_FUNCTION(cpdf_set_leading) {
- pval *arg1, *arg2;
- int id, type;
- CPDFdoc *pdf;
- CPDF_TLS_VARS;
-
- if (ZEND_NUM_ARGS() != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(arg1);
- convert_to_double(arg2);
- id=arg1->value.lval;
- pdf = zend_list_find(id,&type);
- if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
- php_error(E_WARNING,"Unable to find identifier %d",id);
- RETURN_FALSE;
- }
-
- cpdf_setTextLeading(pdf, (float) arg2->value.dval);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void cpdf_set_text_rendering(int pdfdoc, int rendermode)
- Determines how text is rendered */
-PHP_FUNCTION(cpdf_set_text_rendering) {
- pval *arg1, *arg2;
- int id, type;
- CPDFdoc *pdf;
- CPDF_TLS_VARS;
-
- if (ZEND_NUM_ARGS() != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(arg1);
- convert_to_long(arg2);
- id=arg1->value.lval;
- pdf = zend_list_find(id,&type);
- if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
- php_error(E_WARNING,"Unable to find identifier %d",id);
- RETURN_FALSE;
- }
-
- cpdf_setTextRenderingMode(pdf, arg2->value.lval);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void cpdf_set_horiz_scaling(int pdfdoc, double scale)
- Sets horizontal scaling of text */
-PHP_FUNCTION(cpdf_set_horiz_scaling) {
- pval *arg1, *arg2;
- int id, type;
- CPDFdoc *pdf;
- CPDF_TLS_VARS;
-
- if (ZEND_NUM_ARGS() != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(arg1);
- convert_to_double(arg2);
- id=arg1->value.lval;
- pdf = zend_list_find(id,&type);
- if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
- php_error(E_WARNING,"Unable to find identifier %d",id);
- RETURN_FALSE;
- }
-
- cpdf_setHorizontalScaling(pdf, (float) arg2->value.dval * 100.0);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void cpdf_set_text_rise(int pdfdoc, double value)
- Sets the text rise */
-PHP_FUNCTION(cpdf_set_text_rise) {
- pval *arg1, *arg2;
- int id, type;
- CPDFdoc *pdf;
- CPDF_TLS_VARS;
-
- if (ZEND_NUM_ARGS() != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(arg1);
- convert_to_double(arg2);
- id=arg1->value.lval;
- pdf = zend_list_find(id,&type);
- if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
- php_error(E_WARNING,"Unable to find identifier %d",id);
- RETURN_FALSE;
- }
-
- cpdf_setTextRise(pdf, (float) arg2->value.dval);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void cpdf_set_text_matrix(int pdfdoc, arry matrix)
- Sets the text matrix */
-PHP_FUNCTION(cpdf_set_text_matrix) {
- pval *arg1, *arg2, *data;
- int id, type, i;
- HashTable *matrix;
- CPDFdoc *pdf;
- float *pdfmatrixptr;
- float pdfmatrix[6];
- CPDF_TLS_VARS;
-
- if (ZEND_NUM_ARGS() != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(arg1);
- convert_to_array(arg2);
- id=arg1->value.lval;
- matrix=arg2->value.ht;
- pdf = zend_list_find(id,&type);
- if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
- php_error(E_WARNING,"Unable to find identifier %d",id);
- RETURN_FALSE;
- }
-
- if(zend_hash_num_elements(matrix) != 6) {
- php_error(E_WARNING,"Text matrix must have 6 elements");
- RETURN_FALSE;
- }
-
- pdfmatrixptr = pdfmatrix;
- zend_hash_internal_pointer_reset(matrix);
- for(i=0; i<zend_hash_num_elements(matrix); i++) {
- zend_hash_get_current_data(matrix, (void *) &data);
- switch(data->type) {
- case IS_DOUBLE:
- *pdfmatrixptr++ = (float) data->value.dval;
- break;
- default:
- *pdfmatrixptr++ = 0.0;
- break;
- }
- zend_hash_move_forward(matrix);
- }
-
- cpdf_setTextMatrix(pdf, pdfmatrix[0], pdfmatrix[1],
- pdfmatrix[2], pdfmatrix[3],
- pdfmatrix[4], pdfmatrix[5]);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void cpdf_set_text_pos(int pdfdoc, double x, double y [, int mode])
- Set the position of text for the next cpdf_show call */
-PHP_FUNCTION(cpdf_set_text_pos) {
- pval *argv[4];
- int id, type, argc, mode=0;
- CPDFdoc *pdf;
- CPDF_TLS_VARS;
-
- argc = ZEND_NUM_ARGS();
- if((argc < 3) || (argc > 4))
- WRONG_PARAM_COUNT;
- if (getParametersArray(ht, argc, argv) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_long(argv[0]);
- convert_to_double(argv[1]);
- convert_to_double(argv[2]);
- id=argv[0]->value.lval;
- pdf = zend_list_find(id,&type);
- if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
- php_error(E_WARNING,"Unable to find identifier %d",id);
- RETURN_FALSE;
- }
-
- if(argc > 3) {
- convert_to_long(argv[3]);
- mode = argv[3]->value.lval;
- }
- if(mode == 1)
- cpdf_rawSetTextPosition(pdf, (float) argv[1]->value.dval, (float) argv[2]->value.dval);
- else
- cpdf_setTextPosition(pdf, (float) argv[1]->value.dval, (float) argv[2]->value.dval);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void cpdf_rotate_text(int pdfdoc, double angle)
- Sets character spacing */
-PHP_FUNCTION(cpdf_rotate_text) {
- pval *arg1, *arg2;
- int id, type;
- CPDFdoc *pdf;
- CPDF_TLS_VARS;
-
- if (ZEND_NUM_ARGS() != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(arg1);
- convert_to_double(arg2);
- id=arg1->value.lval;
- pdf = zend_list_find(id,&type);
- if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
- php_error(E_WARNING,"Unable to find identifier %d",id);
- RETURN_FALSE;
- }
-
- cpdf_rotateText(pdf, (float) arg2->value.dval);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void cpdf_set_char_spacing(int pdfdoc, double space)
- Sets character spacing */
-PHP_FUNCTION(cpdf_set_char_spacing) {
- pval *arg1, *arg2;
- int id, type;
- CPDFdoc *pdf;
- CPDF_TLS_VARS;
-
- if (ZEND_NUM_ARGS() != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(arg1);
- convert_to_double(arg2);
- id=arg1->value.lval;
- pdf = zend_list_find(id,&type);
- if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
- php_error(E_WARNING,"Unable to find identifier %d",id);
- RETURN_FALSE;
- }
-
- cpdf_setCharacterSpacing(pdf, (float) arg2->value.dval);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void cpdf_set_word_spacing(int pdfdoc, double space)
- Sets spacing between words */
-PHP_FUNCTION(cpdf_set_word_spacing) {
- pval *arg1, *arg2;
- int id, type;
- CPDFdoc *pdf;
- CPDF_TLS_VARS;
-
- if (ZEND_NUM_ARGS() != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(arg1);
- convert_to_double(arg2);
- id=arg1->value.lval;
- pdf = zend_list_find(id,&type);
- if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
- php_error(E_WARNING,"Unable to find identifier %d",id);
- RETURN_FALSE;
- }
-
- cpdf_setWordSpacing(pdf, (float) arg2->value.dval);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto double cpdf_stringwidth(int pdfdoc, string text)
- Returns width of text in current font */
-PHP_FUNCTION(cpdf_stringwidth) {
- pval *arg1, *arg2;
- int id, type;
- double width;
- CPDFdoc *pdf;
- CPDF_TLS_VARS;
-
- if (ZEND_NUM_ARGS() != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(arg1);
- convert_to_string(arg2);
- id=arg1->value.lval;
- pdf = zend_list_find(id,&type);
- if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
- php_error(E_WARNING,"Unable to find identifier %d",id);
- RETURN_FALSE;
- }
-
- width = (double) cpdf_stringWidth(pdf, arg2->value.str.val);
-
- RETURN_DOUBLE((double)width);
-}
-/* }}} */
-
-/* {{{ proto void cpdf_save(int pdfdoc)
- Saves current enviroment */
-PHP_FUNCTION(cpdf_save) {
- pval *arg1;
- int id, type;
- CPDFdoc *pdf;
- CPDF_TLS_VARS;
-
- if (ZEND_NUM_ARGS() != 1 || getParameters(ht, 1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(arg1);
- id=arg1->value.lval;
- pdf = zend_list_find(id,&type);
- if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
- php_error(E_WARNING,"Unable to find identifier %d",id);
- RETURN_FALSE;
- }
-
- cpdf_gsave(pdf);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void cpdf_restore(int pdfdoc)
- Restores formerly saved enviroment */
-PHP_FUNCTION(cpdf_restore) {
- pval *arg1;
- int id, type;
- CPDFdoc *pdf;
- CPDF_TLS_VARS;
-
- if (ZEND_NUM_ARGS() != 1 || getParameters(ht, 1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(arg1);
- id=arg1->value.lval;
- pdf = zend_list_find(id,&type);
- if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
- php_error(E_WARNING,"Unable to find identifier %d",id);
- RETURN_FALSE;
- }
-
- cpdf_grestore(pdf);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void cpdf_translate(int pdfdoc, double x, double y)
- Sets origin of coordinate system */
-PHP_FUNCTION(cpdf_translate) {
- pval *arg1, *arg2, *arg3;
- int id, type;
- CPDFdoc *pdf;
- CPDF_TLS_VARS;
-
- if (ZEND_NUM_ARGS() != 3 || getParameters(ht, 3, &arg1, &arg2, &arg3) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(arg1);
- convert_to_double(arg2);
- convert_to_double(arg3);
- id=arg1->value.lval;
- pdf = zend_list_find(id,&type);
- if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
- php_error(E_WARNING,"Unable to find identifier %d",id);
- RETURN_FALSE;
- }
-
- cpdf_rawTranslate(pdf, (float) arg2->value.dval, (float) arg3->value.dval);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void cpdf_scale(int pdfdoc, double x-scale, double y-scale)
- Sets scaling */
-PHP_FUNCTION(cpdf_scale) {
- pval *arg1, *arg2, *arg3;
- int id, type;
- CPDFdoc *pdf;
- CPDF_TLS_VARS;
-
- if (ZEND_NUM_ARGS() != 3 || getParameters(ht, 3, &arg1, &arg2, &arg3) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(arg1);
- convert_to_double(arg2);
- convert_to_double(arg3);
- id=arg1->value.lval;
- pdf = zend_list_find(id,&type);
- if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
- php_error(E_WARNING,"Unable to find identifier %d",id);
- RETURN_FALSE;
- }
-
- cpdf_scale(pdf, (float) arg2->value.dval, (float) arg3->value.dval);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void cpdf_rotate(int pdfdoc, double angle)
- Sets rotation */
-PHP_FUNCTION(cpdf_rotate) {
- pval *arg1, *arg2;
- int id, type;
- CPDFdoc *pdf;
- CPDF_TLS_VARS;
-
- if (ZEND_NUM_ARGS() != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(arg1);
- convert_to_double(arg2);
- id=arg1->value.lval;
- pdf = zend_list_find(id,&type);
- if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
- php_error(E_WARNING,"Unable to find identifier %d",id);
- RETURN_FALSE;
- }
-
- cpdf_rotate(pdf, (float) arg2->value.dval);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void cpdf_setflat(int pdfdoc, double value)
- Sets flatness */
-PHP_FUNCTION(cpdf_setflat) {
- pval *arg1, *arg2;
- int id, type;
- CPDFdoc *pdf;
- CPDF_TLS_VARS;
-
- if (ZEND_NUM_ARGS() != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(arg1);
- convert_to_double(arg2);
- id=arg1->value.lval;
- pdf = zend_list_find(id,&type);
- if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
- php_error(E_WARNING,"Unable to find identifier %d",id);
- RETURN_FALSE;
- }
-
- if((arg2->value.lval > 100) && (arg2->value.lval < 0)) {
- php_error(E_WARNING,"Parameter of pdf_setflat() has to between 0 and 100");
- RETURN_FALSE;
- }
-
- cpdf_setflat(pdf, (int) arg2->value.dval);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void cpdf_setlinejoin(int pdfdoc, int value)
- Sets linejoin parameter */
-PHP_FUNCTION(cpdf_setlinejoin) {
- pval *arg1, *arg2;
- int id, type;
- CPDFdoc *pdf;
- CPDF_TLS_VARS;
-
- if (ZEND_NUM_ARGS() != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(arg1);
- convert_to_long(arg2);
- id=arg1->value.lval;
- pdf = zend_list_find(id,&type);
- if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
- php_error(E_WARNING,"Unable to find identifier %d",id);
- RETURN_FALSE;
- }
-
- if((arg2->value.lval > 2) && (arg2->value.lval < 0)) {
- php_error(E_WARNING,"Parameter of pdf_setlinejoin() has to between 0 and 2");
- RETURN_FALSE;
- }
-
- cpdf_setlinejoin(pdf, arg2->value.lval);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void cpdf_setlinecap(int pdfdoc, int value)
- Sets linecap parameter */
-PHP_FUNCTION(cpdf_setlinecap) {
- pval *arg1, *arg2;
- int id, type;
- CPDFdoc *pdf;
- CPDF_TLS_VARS;
-
- if (ZEND_NUM_ARGS() != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(arg1);
- convert_to_long(arg2);
- id=arg1->value.lval;
- pdf = zend_list_find(id,&type);
- if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
- php_error(E_WARNING,"Unable to find identifier %d",id);
- RETURN_FALSE;
- }
-
- if((arg2->value.lval > 2) && (arg2->value.lval < 0)) {
- php_error(E_WARNING,"Parameter of pdf_setlinecap() has to be > 0 and =< 2");
- RETURN_FALSE;
- }
-
- cpdf_setlinecap(pdf, arg2->value.lval);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void cpdf_setmiterlimit(int pdfdoc, double value)
- Sets miter limit */
-PHP_FUNCTION(cpdf_setmiterlimit) {
- pval *arg1, *arg2;
- int id, type;
- CPDFdoc *pdf;
- CPDF_TLS_VARS;
-
- if (ZEND_NUM_ARGS() != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(arg1);
- convert_to_double(arg2);
- id=arg1->value.lval;
- pdf = zend_list_find(id,&type);
- if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
- php_error(E_WARNING,"Unable to find identifier %d",id);
- RETURN_FALSE;
- }
-
- if(arg2->value.dval < 1) {
- php_error(E_WARNING,"Parameter of pdf_setmiterlimit() has to be >= 1");
- RETURN_FALSE;
- }
-
- cpdf_setmiterlimit(pdf, (float) arg2->value.dval);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void cpdf_setlinewidth(int pdfdoc, double width)
- Sets line width */
-PHP_FUNCTION(cpdf_setlinewidth) {
- pval *arg1, *arg2;
- int id, type;
- CPDFdoc *pdf;
- CPDF_TLS_VARS;
-
- if (ZEND_NUM_ARGS() != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(arg1);
- convert_to_double(arg2);
- id=arg1->value.lval;
- pdf = zend_list_find(id,&type);
- if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
- php_error(E_WARNING,"Unable to find identifier %d",id);
- RETURN_FALSE;
- }
-
- cpdf_setlinewidth(pdf, (float) arg2->value.dval);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-#define BUFFERLEN 20
-/* {{{ proto void cpdf_setdash(int pdfdoc, long white, long black)
- Sets dash pattern */
-PHP_FUNCTION(cpdf_setdash) {
- pval *arg1, *arg2, *arg3;
- int id, type;
- char buffer[BUFFERLEN];
- CPDFdoc *pdf;
- CPDF_TLS_VARS;
-
- if (ZEND_NUM_ARGS() != 3 || getParameters(ht, 3, &arg1, &arg2, &arg3) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(arg1);
- convert_to_long(arg2);
- convert_to_long(arg3);
- id=arg1->value.lval;
- pdf = zend_list_find(id,&type);
- if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
- php_error(E_WARNING,"Unable to find identifier %d",id);
- RETURN_FALSE;
- }
-
- snprintf(buffer, BUFFERLEN, "[%d %d] 0", (int) arg2->value.lval, (int) arg3->value.lval);
- cpdf_setdash(pdf, buffer);
-
- RETURN_TRUE;
-}
-/* }}} */
-#undef BUFFERLEN
-
-/* {{{ proto void cpdf_moveto(int pdfdoc, double x, double y [, int mode])
- Sets current point */
-PHP_FUNCTION(cpdf_moveto) {
- pval *argv[4];
- int id, type, argc, mode=0;
- CPDFdoc *pdf;
- CPDF_TLS_VARS;
-
- argc = ZEND_NUM_ARGS();
- if((argc < 3) || (argc > 4))
- WRONG_PARAM_COUNT;
- if (getParametersArray(ht, argc, argv) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_long(argv[0]);
- convert_to_double(argv[1]);
- convert_to_double(argv[2]);
- id=argv[0]->value.lval;
- pdf = zend_list_find(id,&type);
- if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
- php_error(E_WARNING,"Unable to find identifier %d",id);
- RETURN_FALSE;
- }
-
- if(argc > 3) {
- convert_to_long(argv[3]);
- mode = argv[3]->value.lval;
- }
- if(mode == 1)
- cpdf_rawMoveto(pdf, (float) argv[1]->value.dval, (float) argv[2]->value.dval);
- else
- cpdf_moveto(pdf, (float) argv[1]->value.dval, (float) argv[2]->value.dval);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void cpdf_rmoveto(int pdfdoc, double x, double y [, int mode])
- Sets current point */
-PHP_FUNCTION(cpdf_rmoveto) {
- pval *argv[4];
- int id, type, argc, mode=0;
- CPDFdoc *pdf;
- CPDF_TLS_VARS;
-
- argc = ZEND_NUM_ARGS();
- if((argc < 3) || (argc > 4))
- WRONG_PARAM_COUNT;
- if (getParametersArray(ht, argc, argv) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_long(argv[0]);
- convert_to_double(argv[1]);
- convert_to_double(argv[2]);
- id=argv[0]->value.lval;
- pdf = zend_list_find(id,&type);
- if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
- php_error(E_WARNING,"Unable to find identifier %d",id);
- RETURN_FALSE;
- }
-
- if(argc > 3) {
- convert_to_long(argv[3]);
- mode = argv[3]->value.lval;
- }
- if(mode == 1)
- cpdf_rawRmoveto(pdf, (float) argv[1]->value.dval, (float) argv[2]->value.dval);
- else
- cpdf_rmoveto(pdf, (float) argv[1]->value.dval, (float) argv[2]->value.dval);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void cpdf_curveto(int pdfdoc, double x1, double y1, double x2, double y2, double x3, double y3 [, int mode])
- Draws a curve */
-PHP_FUNCTION(cpdf_curveto) {
- pval *argv[8];
- int id, type, argc, mode=0;
- CPDFdoc *pdf;
- CPDF_TLS_VARS;
-
- argc = ZEND_NUM_ARGS();
- if((argc < 7) || (argc > 8))
- WRONG_PARAM_COUNT;
- if (getParametersArray(ht, argc, argv) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_long(argv[0]);
- convert_to_double(argv[1]);
- convert_to_double(argv[2]);
- convert_to_double(argv[3]);
- convert_to_double(argv[4]);
- convert_to_double(argv[5]);
- convert_to_double(argv[6]);
- id=argv[0]->value.lval;
- pdf = zend_list_find(id,&type);
- if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
- php_error(E_WARNING,"Unable to find identifier %d",id);
- RETURN_FALSE;
- }
-
- if(argc > 7) {
- convert_to_long(argv[7]);
- mode = argv[7]->value.lval;
- }
- if(mode == 1)
- cpdf_rawCurveto(pdf, (float) argv[1]->value.dval,
- (float) argv[2]->value.dval,
- (float) argv[3]->value.dval,
- (float) argv[4]->value.dval,
- (float) argv[5]->value.dval,
- (float) argv[6]->value.dval);
- else
- cpdf_curveto(pdf, (float) argv[1]->value.dval,
- (float) argv[2]->value.dval,
- (float) argv[3]->value.dval,
- (float) argv[4]->value.dval,
- (float) argv[5]->value.dval,
- (float) argv[6]->value.dval);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void cpdf_lineto(int pdfdoc, double x, double y [, int mode])
- Draws a line */
-PHP_FUNCTION(cpdf_lineto) {
- pval *argv[4];
- int id, type, argc, mode=0;
- CPDFdoc *pdf;
- CPDF_TLS_VARS;
-
- argc = ZEND_NUM_ARGS();
- if((argc < 3) || (argc > 4))
- WRONG_PARAM_COUNT;
- if (getParametersArray(ht, argc, argv) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_long(argv[0]);
- convert_to_double(argv[1]);
- convert_to_double(argv[2]);
- id=argv[0]->value.lval;
- pdf = zend_list_find(id,&type);
- if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
- php_error(E_WARNING,"Unable to find identifier %d",id);
- RETURN_FALSE;
- }
-
- if(argc > 3) {
- convert_to_long(argv[3]);
- mode = argv[3]->value.lval;
- }
- if(mode == 1)
- cpdf_rawLineto(pdf, (float) argv[1]->value.dval, (float) argv[2]->value.dval);
- else
- cpdf_lineto(pdf, (float) argv[1]->value.dval, (float) argv[2]->value.dval);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void cpdf_rlineto(int pdfdoc, double x, double y [, int mode])
- Draws a line relative to current point */
-PHP_FUNCTION(cpdf_rlineto) {
- pval *argv[4];
- int id, type, argc, mode=0;
- CPDFdoc *pdf;
- CPDF_TLS_VARS;
-
- argc = ZEND_NUM_ARGS();
- if((argc < 3) || (argc > 4))
- WRONG_PARAM_COUNT;
- if (getParametersArray(ht, argc, argv) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_long(argv[0]);
- convert_to_double(argv[1]);
- convert_to_double(argv[2]);
- id=argv[0]->value.lval;
- pdf = zend_list_find(id,&type);
- if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
- php_error(E_WARNING,"Unable to find identifier %d",id);
- RETURN_FALSE;
- }
-
- if(argc > 3) {
- convert_to_long(argv[3]);
- mode = argv[3]->value.lval;
- }
- if(mode == 1)
- cpdf_rawRlineto(pdf, (float) argv[1]->value.dval, (float) argv[2]->value.dval);
- else
- cpdf_rlineto(pdf, (float) argv[1]->value.dval, (float) argv[2]->value.dval);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void cpdf_circle(int pdfdoc, double x, double y, double radius [, int mode])
- Draws a circle */
-PHP_FUNCTION(cpdf_circle) {
- pval *argv[5];
- int id, type, argc, mode=0;
- CPDFdoc *pdf;
- CPDF_TLS_VARS;
-
- argc = ZEND_NUM_ARGS();
- if((argc < 4) || (argc > 5))
- WRONG_PARAM_COUNT;
- if (getParametersArray(ht, argc, argv) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_long(argv[0]);
- convert_to_double(argv[1]);
- convert_to_double(argv[2]);
- convert_to_double(argv[3]);
- id=argv[0]->value.lval;
- pdf = zend_list_find(id,&type);
- if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
- php_error(E_WARNING,"Unable to find identifier %d",id);
- RETURN_FALSE;
- }
-
- if(argc > 4) {
- convert_to_long(argv[4]);
- mode = argv[4]->value.lval;
- }
- if(mode == 1)
- cpdf_rawCircle(pdf, (float) argv[1]->value.dval, (float) argv[2]->value.dval, (float) argv[3]->value.dval);
- else
- cpdf_circle(pdf, (float) argv[1]->value.dval, (float) argv[2]->value.dval, (float) argv[3]->value.dval);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void cpdf_arc(int pdfdoc, double x, double y, double radius, double start, double end [, int mode])
- Draws an arc */
-PHP_FUNCTION(cpdf_arc) {
- pval *argv[7];
- int id, type, argc, mode=0;
- CPDFdoc *pdf;
- CPDF_TLS_VARS;
-
- argc = ZEND_NUM_ARGS();
- if((argc < 6) || (argc > 7))
- WRONG_PARAM_COUNT;
- if (getParametersArray(ht, argc, argv) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_long(argv[0]);
- convert_to_double(argv[1]);
- convert_to_double(argv[2]);
- convert_to_double(argv[3]);
- convert_to_double(argv[4]);
- convert_to_double(argv[5]);
- id=argv[0]->value.lval;
- pdf = zend_list_find(id,&type);
- if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
- php_error(E_WARNING,"Unable to find identifier %d",id);
- RETURN_FALSE;
- }
-
- if(argc > 6) {
- convert_to_long(argv[6]);
- mode = argv[6]->value.lval;
- }
- if(mode == 1)
- cpdf_rawArc(pdf, (float) argv[1]->value.dval, (float) argv[2]->value.dval, (float) argv[3]->value.dval, (float) argv[4]->value.dval, (float) argv[5]->value.dval, 1);
- else
- cpdf_arc(pdf, (float) argv[1]->value.dval, (float) argv[2]->value.dval, (float) argv[3]->value.dval, (float) argv[4]->value.dval, (float) argv[5]->value.dval, 1);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void cpdf_rect(int pdfdoc, double x, double y, double width, double height [, int mode])
- Draws a rectangle */
-PHP_FUNCTION(cpdf_rect) {
- pval *argv[6];
- int id, type, argc, mode=0;
- CPDFdoc *pdf;
- CPDF_TLS_VARS;
-
- argc = ZEND_NUM_ARGS();
- if((argc < 5) || (argc > 6))
- WRONG_PARAM_COUNT;
- if (getParametersArray(ht, argc, argv) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_long(argv[0]);
- convert_to_double(argv[1]);
- convert_to_double(argv[2]);
- convert_to_double(argv[3]);
- convert_to_double(argv[4]);
- id=argv[0]->value.lval;
- pdf = zend_list_find(id,&type);
- if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
- php_error(E_WARNING,"Unable to find identifier %d",id);
- RETURN_FALSE;
- }
-
- if(argc > 5) {
- convert_to_long(argv[5]);
- mode = argv[5]->value.lval;
- }
- if(mode == 1)
- cpdf_rawRect(pdf, (float) argv[1]->value.dval,
- (float) argv[2]->value.dval,
- (float) argv[3]->value.dval,
- (float) argv[4]->value.dval);
- else
- cpdf_rect(pdf, (float) argv[1]->value.dval,
- (float) argv[2]->value.dval,
- (float) argv[3]->value.dval,
- (float) argv[4]->value.dval);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void cpdf_newpath(int pdfdoc)
- Starts new path */
-PHP_FUNCTION(cpdf_newpath) {
- pval *arg1;
- int id, type;
- CPDFdoc *pdf;
- CPDF_TLS_VARS;
-
- if (ZEND_NUM_ARGS() != 1 || getParameters(ht, 1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(arg1);
- id=arg1->value.lval;
- pdf = zend_list_find(id,&type);
- if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
- php_error(E_WARNING,"Unable to find identifier %d",id);
- RETURN_FALSE;
- }
-
- cpdf_newpath(pdf);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void cpdf_closepath(int pdfdoc)
- Close path */
-PHP_FUNCTION(cpdf_closepath) {
- pval *arg1;
- int id, type;
- CPDFdoc *pdf;
- CPDF_TLS_VARS;
-
- if (ZEND_NUM_ARGS() != 1 || getParameters(ht, 1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(arg1);
- id=arg1->value.lval;
- pdf = zend_list_find(id,&type);
- if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
- php_error(E_WARNING,"Unable to find identifier %d",id);
- RETURN_FALSE;
- }
-
- cpdf_closepath(pdf);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void cpdf_closepath_stroke(int pdfdoc)
- Close path and draw line along path */
-PHP_FUNCTION(cpdf_closepath_stroke) {
- pval *arg1;
- int id, type;
- CPDFdoc *pdf;
- CPDF_TLS_VARS;
-
- if (ZEND_NUM_ARGS() != 1 || getParameters(ht, 1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(arg1);
- id=arg1->value.lval;
- pdf = zend_list_find(id,&type);
- if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
- php_error(E_WARNING,"Unable to find identifier %d",id);
- RETURN_FALSE;
- }
-
- cpdf_closepath(pdf);
- cpdf_stroke(pdf);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void cpdf_stroke(int pdfdoc)
- Draw line along path path */
-PHP_FUNCTION(cpdf_stroke) {
- pval *arg1;
- int id, type;
- CPDFdoc *pdf;
- CPDF_TLS_VARS;
-
- if (ZEND_NUM_ARGS() != 1 || getParameters(ht, 1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(arg1);
- id=arg1->value.lval;
- pdf = zend_list_find(id,&type);
- if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
- php_error(E_WARNING,"Unable to find identifier %d",id);
- RETURN_FALSE;
- }
-
- cpdf_stroke(pdf);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void cpdf_fill(int pdfdoc)
- Fill current path */
-PHP_FUNCTION(cpdf_fill) {
- pval *arg1;
- int id, type;
- CPDFdoc *pdf;
- CPDF_TLS_VARS;
-
- if (ZEND_NUM_ARGS() != 1 || getParameters(ht, 1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(arg1);
- id=arg1->value.lval;
- pdf = zend_list_find(id,&type);
- if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
- php_error(E_WARNING,"Unable to find identifier %d",id);
- RETURN_FALSE;
- }
-
- cpdf_fill(pdf);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void cpdf_fill_stroke(int pdfdoc)
- Fill and stroke current path */
-PHP_FUNCTION(cpdf_fill_stroke) {
- pval *arg1;
- int id, type;
- CPDFdoc *pdf;
- CPDF_TLS_VARS;
-
- if (ZEND_NUM_ARGS() != 1 || getParameters(ht, 1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(arg1);
- id=arg1->value.lval;
- pdf = zend_list_find(id,&type);
- if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
- php_error(E_WARNING,"Unable to find identifier %d",id);
- RETURN_FALSE;
- }
-
- cpdf_fill(pdf);
- cpdf_stroke(pdf);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void cpdf_closepath_fill_stroke(int pdfdoc)
- Close, fill and stroke current path */
-PHP_FUNCTION(cpdf_closepath_fill_stroke) {
- pval *arg1;
- int id, type;
- CPDFdoc *pdf;
- CPDF_TLS_VARS;
-
- if (ZEND_NUM_ARGS() != 1 || getParameters(ht, 1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(arg1);
- id=arg1->value.lval;
- pdf = zend_list_find(id,&type);
- if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
- php_error(E_WARNING,"Unable to find identifier %d",id);
- RETURN_FALSE;
- }
-
- cpdf_closepath(pdf);
- cpdf_fill(pdf);
- cpdf_stroke(pdf);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void cpdf_clip(int pdfdoc)
- Clips to current path */
-PHP_FUNCTION(cpdf_clip) {
- pval *arg1;
- int id, type;
- CPDFdoc *pdf;
- CPDF_TLS_VARS;
-
- if (ZEND_NUM_ARGS() != 1 || getParameters(ht, 1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(arg1);
- id=arg1->value.lval;
- pdf = zend_list_find(id,&type);
- if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
- php_error(E_WARNING,"Unable to find identifier %d",id);
- RETURN_FALSE;
- }
-
- cpdf_clip(pdf);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void cpdf_setgray_fill(int pdfdoc, double value)
- Sets filling color to gray value */
-PHP_FUNCTION(cpdf_setgray_fill) {
- pval *arg1, *arg2;
- int id, type;
- CPDFdoc *pdf;
- CPDF_TLS_VARS;
-
- if (ZEND_NUM_ARGS() != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(arg1);
- convert_to_double(arg2);
- id=arg1->value.lval;
- pdf = zend_list_find(id,&type);
- if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
- php_error(E_WARNING,"Unable to find identifier %d",id);
- RETURN_FALSE;
- }
-
- cpdf_setgrayFill(pdf, (float) arg2->value.dval);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void cpdf_setgray_stroke(int pdfdoc, double value)
- Sets drawing color to gray value */
-PHP_FUNCTION(cpdf_setgray_stroke) {
- pval *arg1, *arg2;
- int id, type;
- CPDFdoc *pdf;
- CPDF_TLS_VARS;
-
- if (ZEND_NUM_ARGS() != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(arg1);
- convert_to_double(arg2);
- id=arg1->value.lval;
- pdf = zend_list_find(id,&type);
- if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
- php_error(E_WARNING,"Unable to find identifier %d",id);
- RETURN_FALSE;
- }
-
- cpdf_setgrayStroke(pdf, (float) arg2->value.dval);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void cpdf_setgray(int pdfdoc, double value)
- Sets drawing and filling color to gray value */
-PHP_FUNCTION(cpdf_setgray) {
- pval *arg1, *arg2;
- int id, type;
- CPDFdoc *pdf;
- CPDF_TLS_VARS;
-
- if (ZEND_NUM_ARGS() != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(arg1);
- convert_to_double(arg2);
- id=arg1->value.lval;
- pdf = zend_list_find(id,&type);
- if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
- php_error(E_WARNING,"Unable to find identifier %d",id);
- RETURN_FALSE;
- }
-
- cpdf_setgray(pdf, (float) arg2->value.dval);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void cpdf_setrgbcolor_fill(int pdfdoc, double red, double green, double blue)
- Sets filling color to rgb color value */
-PHP_FUNCTION(cpdf_setrgbcolor_fill) {
- pval *arg1, *arg2, *arg3, *arg4;
- int id, type;
- CPDFdoc *pdf;
- CPDF_TLS_VARS;
-
- if (ZEND_NUM_ARGS() != 4 || getParameters(ht, 4, &arg1, &arg2, &arg3, &arg4) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(arg1);
- convert_to_double(arg2);
- convert_to_double(arg3);
- convert_to_double(arg4);
- id=arg1->value.lval;
- pdf = zend_list_find(id,&type);
- if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
- php_error(E_WARNING,"Unable to find identifier %d",id);
- RETURN_FALSE;
- }
-
- cpdf_setrgbcolorFill(pdf, (float) arg2->value.dval, (float) arg3->value.dval, (float) arg4->value.dval);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void cpdf_setrgbcolor_stroke(int pdfdoc, double red, double green, double blue)
- Sets drawing color to rgb color value */
-PHP_FUNCTION(cpdf_setrgbcolor_stroke) {
- pval *arg1, *arg2, *arg3, *arg4;
- int id, type;
- CPDFdoc *pdf;
- CPDF_TLS_VARS;
-
- if (ZEND_NUM_ARGS() != 4 || getParameters(ht, 4, &arg1, &arg2, &arg3, &arg4) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(arg1);
- convert_to_double(arg2);
- convert_to_double(arg3);
- convert_to_double(arg4);
- id=arg1->value.lval;
- pdf = zend_list_find(id,&type);
- if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
- php_error(E_WARNING,"Unable to find identifier %d",id);
- RETURN_FALSE;
- }
-
- cpdf_setrgbcolorStroke(pdf, (float) arg2->value.dval, (float) arg3->value.dval, (float) arg4->value.dval);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void cpdf_setrgbcolor(int pdfdoc, double red, double green, double blue)
- Sets drawing and filling color to rgb color value */
-PHP_FUNCTION(cpdf_setrgbcolor) {
- pval *arg1, *arg2, *arg3, *arg4;
- int id, type;
- CPDFdoc *pdf;
- CPDF_TLS_VARS;
-
- if (ZEND_NUM_ARGS() != 4 || getParameters(ht, 4, &arg1, &arg2, &arg3, &arg4) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(arg1);
- convert_to_double(arg2);
- convert_to_double(arg3);
- convert_to_double(arg4);
- id=arg1->value.lval;
- pdf = zend_list_find(id,&type);
- if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
- php_error(E_WARNING,"Unable to find identifier %d",id);
- RETURN_FALSE;
- }
-
- cpdf_setrgbcolor(pdf, (float) arg2->value.dval, (float) arg3->value.dval, (float) arg4->value.dval);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void cpdf_set_page_animation(int pdfdoc, int transition, double duration, double direction, int orientation, int inout)
- Sets transition between pages */
-PHP_FUNCTION(cpdf_set_page_animation) {
- pval *arg1, *arg2, *arg3, *arg4, *arg5, *arg6;
- int id, type;
- CPDFdoc *pdf;
- CPDF_TLS_VARS;
-
- if (ZEND_NUM_ARGS() != 6 || getParameters(ht, 6, &arg1, &arg2, &arg3, &arg4, &arg5, &arg6) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(arg1);
- convert_to_long(arg2);
- convert_to_double(arg3);
- convert_to_double(arg4);
- convert_to_long(arg5);
- convert_to_long(arg6);
- id=arg1->value.lval;
- pdf = zend_list_find(id,&type);
- if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
- php_error(E_WARNING,"Unable to find identifier %d",id);
- RETURN_FALSE;
- }
-
- cpdf_setPageTransition(pdf, arg2->value.lval, arg3->value.dval, arg4->value.dval,
- arg5->value.lval, arg6->value.lval);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto array cpdf_finalize(int pdfdoc)
- Creates pdf doc in memory */
-PHP_FUNCTION(cpdf_finalize) {
- pval *arg1;
- int id, type;
- CPDFdoc *pdf;
- CPDF_TLS_VARS;
-
- if (ZEND_NUM_ARGS() != 1 || getParameters(ht, 1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(arg1);
- id=arg1->value.lval;
- pdf = zend_list_find(id,&type);
- if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
- php_error(E_WARNING,"Unable to find identifier %d",id);
- RETURN_FALSE;
- }
-
- cpdf_finalizeAll(pdf);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto array cpdf_output_buffer(int pdfdoc)
- Returns the internal memory stream as string */
-PHP_FUNCTION(cpdf_output_buffer) {
- pval *arg1;
- int id, type, lenght;
- CPDFdoc *pdf;
- char *buffer;
- CPDF_TLS_VARS;
-
- if (ZEND_NUM_ARGS() != 1 || getParameters(ht, 1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(arg1);
- id=arg1->value.lval;
- pdf = zend_list_find(id,&type);
- if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
- php_error(E_WARNING,"Unable to find identifier %d",id);
- RETURN_FALSE;
- }
-
- buffer = cpdf_getBufferForPDF(pdf, &lenght);
-
- php_write(buffer, lenght);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto array cpdf_save_to_file(int pdfdoc, string filename)
- Saves the internal memory stream to a file */
-PHP_FUNCTION(cpdf_save_to_file) {
- pval *arg1, *arg2;
- int id, type;
- CPDFdoc *pdf;
- CPDF_TLS_VARS;
-
- if (ZEND_NUM_ARGS() != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(arg1);
- convert_to_string(arg2);
- id=arg1->value.lval;
- pdf = zend_list_find(id,&type);
- if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
- php_error(E_WARNING,"Unable to find identifier %d",id);
- RETURN_FALSE;
- }
-
-#if APACHE
- if(strcmp(arg2->value.str.val, "-") == 0)
- php_error(E_WARNING,"Writing to stdout as described in the ClibPDF manual is not possible if php is used as an Apache module. Use cpdf_output_buffer() instead.");
-#endif
-
- cpdf_savePDFmemoryStreamToFile(pdf, arg2->value.str.val);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void cpdf_import_jpeg(int pdfdoc, string filename, double x, double y, double angle, double width, double height, double x-scale, double y-scale, int gsave [, int mode])
- Includes jpeg image */
-PHP_FUNCTION(cpdf_import_jpeg) {
- pval *argv[11];
- int id, type, argc, mode=0;
- float width, height, xscale, yscale;
- CPDFdoc *pdf;
- CPDF_TLS_VARS;
-
- argc = ZEND_NUM_ARGS();
- if((argc < 10) || (argc > 11))
- WRONG_PARAM_COUNT;
- if (getParametersArray(ht, argc, argv) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_long(argv[0]);
- convert_to_string(argv[1]);
- convert_to_double(argv[2]);
- convert_to_double(argv[3]);
- convert_to_double(argv[4]);
- convert_to_double(argv[5]);
- width = (float) argv[5]->value.dval;
- convert_to_double(argv[6]);
- height = (float) argv[6]->value.dval;
- convert_to_double(argv[7]);
- xscale = (float) argv[7]->value.dval;
- convert_to_double(argv[8]);
- yscale = (float) argv[8]->value.dval;
- convert_to_long(argv[9]);
- id=argv[0]->value.lval;
- pdf = zend_list_find(id,&type);
- if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
- php_error(E_WARNING,"Unable to find identifier %d",id);
- RETURN_FALSE;
- }
-
- if(argc > 10) {
- convert_to_long(argv[10]);
- mode = argv[10]->value.lval;
- }
- if(mode == 1)
- cpdf_rawImportImage(pdf, argv[1]->value.str.val,
- JPEG_IMG,
- (float) argv[2]->value.dval,
- (float) argv[3]->value.dval,
- (float) argv[4]->value.dval,
- &width,
- &height,
- &xscale,
- &yscale,
- argv[9]->value.lval);
- else
- cpdf_rawImportImage(pdf, argv[1]->value.str.val,
- JPEG_IMG,
- (float) argv[2]->value.dval,
- (float) argv[3]->value.dval,
- (float) argv[4]->value.dval,
- &width,
- &height,
- &xscale,
- &yscale,
- argv[9]->value.lval);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-#if HAVE_LIBGD13
-/* {{{ proto void cpdf_place_inline_image(int pdfdoc, int gdimage, double x, double y, double angle, fload width, float height, int gsave [, int mode])
- Includes image */
-PHP_FUNCTION(cpdf_place_inline_image) {
- pval *argv[11];
- int id, gid, type, argc, mode=0;
- int count, i, j, color;
- CPDFdoc *pdf;
- unsigned char *buffer, *ptr;
- gdImagePtr im;
- CPDF_TLS_VARS;
-
- argc = ZEND_NUM_ARGS();
- if((argc < 8) || (argc > 9))
- WRONG_PARAM_COUNT;
- if (getParametersArray(ht, argc, argv) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_long(argv[0]);
- convert_to_long(argv[1]);
- convert_to_double(argv[2]);
- convert_to_double(argv[3]);
- convert_to_double(argv[4]);
- convert_to_double(argv[5]);
- convert_to_double(argv[6]);
- convert_to_long(argv[7]);
- id=argv[0]->value.lval;
- pdf = zend_list_find(id,&type);
- if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
- php_error(E_WARNING,"Unable to find identifier %d",id);
- RETURN_FALSE;
- }
-
- gid=argv[1]->value.lval;
- im = zend_list_find(gid, &type);
-
- ZEND_GET_RESOURCE_TYPE_ID(CPDF_GLOBAL(le_gd),"gd");
- if(!CPDF_GLOBAL(le_gd))
- {
- php_error(E_ERROR, "Unable to find handle for GD image stream. Please check the GD extension is loaded.");
- }
-
- if (!im || type != CPDF_GLOBAL(le_gd)) {
- php_error(E_WARNING, "cpdf: Unable to find image pointer");
- RETURN_FALSE;
- }
-
- if(argc > 8) {
- convert_to_long(argv[8]);
- mode = argv[8]->value.lval;
- }
-
- count = 3 * im->sx * im->sy;
- if(NULL == (buffer = (unsigned char *) emalloc(count)))
- RETURN_FALSE;
-
- ptr = buffer;
- for(i=0; i<im->sy; i++) {
- for(j=0; j<im->sx; j++) {
- color = im->pixels[i][j];
- *ptr++ = im->red[color];
- *ptr++ = im->green[color];
- *ptr++ = im->blue[color];
- }
- }
-
- if(mode == 1)
- cpdf_placeInLineImage(pdf, buffer, count,
- (float) argv[2]->value.dval,
- (float) argv[3]->value.dval,
- (float) argv[4]->value.dval,
- (float) argv[5]->value.dval,
- (float) argv[6]->value.dval,
- im->sx,
- im->sy,
- 8, 2, argv[7]->value.lval);
- else
- cpdf_rawPlaceInLineImage(pdf, buffer, count,
- (float) argv[2]->value.dval,
- (float) argv[3]->value.dval,
- (float) argv[4]->value.dval,
- (float) argv[5]->value.dval,
- (float) argv[6]->value.dval,
- im->sx,
- im->sy,
- 8, 2, argv[7]->value.lval);
-
- efree(buffer);
- RETURN_TRUE;
-}
-/* }}} */
-#endif
-
-/* {{{ proto void cpdf_add_annotation(int pdfdoc, double xll, double yll, double xur, double xur, string title, string text [, int mode])
- Sets annotation */
-PHP_FUNCTION(cpdf_add_annotation) {
- pval *argv[11];
- int id, type, argc, mode=0;
- CPDFdoc *pdf;
- CPDFannotAttrib attrib;
- CPDF_TLS_VARS;
-
- argc = ZEND_NUM_ARGS();
- if((argc < 7) || (argc > 8))
- WRONG_PARAM_COUNT;
- if (getParametersArray(ht, argc, argv) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_long(argv[0]);
- convert_to_double(argv[1]);
- convert_to_double(argv[2]);
- convert_to_double(argv[3]);
- convert_to_double(argv[4]);
- convert_to_string(argv[5]);
- convert_to_string(argv[6]);
- id=argv[0]->value.lval;
- pdf = zend_list_find(id,&type);
- if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
- php_error(E_WARNING,"Unable to find identifier %d",id);
- RETURN_FALSE;
- }
-
- attrib.flags = AF_NOZOOM | AF_NOROTATE | AF_READONLY;
- attrib.border_array = "[0 0 1 [4 2]]";
- attrib.BS = NULL;
- attrib.r = 0.00;
- attrib.g = 1.00;
- attrib.b = 1.00;
- if(argc > 7) {
- convert_to_long(argv[7]);
- mode = argv[7]->value.lval;
- }
- if(mode == 1)
- cpdf_rawSetAnnotation(pdf, (float) argv[1]->value.dval,
- (float) argv[2]->value.dval,
- (float) argv[3]->value.dval,
- (float) argv[4]->value.dval,
- argv[5]->value.str.val,
- argv[6]->value.str.val,
- &attrib);
- else
- cpdf_setAnnotation(pdf, (float) argv[1]->value.dval,
- (float) argv[2]->value.dval,
- (float) argv[3]->value.dval,
- (float) argv[4]->value.dval,
- argv[5]->value.str.val,
- argv[6]->value.str.val,
- &attrib);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void cpdf_set_action_url(int pdfdoc, double xll, double yll, double xur, double xur, string url [, int mode])
- Sets Hyperlink */
-PHP_FUNCTION(cpdf_set_action_url) {
- pval *argv[11];
- int id, type, argc, mode=0;
- CPDFdoc *pdf;
- CPDFannotAttrib attrib;
- CPDF_TLS_VARS;
-
- argc = ZEND_NUM_ARGS();
- if((argc < 6) || (argc > 7))
- WRONG_PARAM_COUNT;
- if (getParametersArray(ht, argc, argv) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_long(argv[0]);
- convert_to_double(argv[1]);
- convert_to_double(argv[2]);
- convert_to_double(argv[3]);
- convert_to_double(argv[4]);
- convert_to_string(argv[5]);
- id=argv[0]->value.lval;
- pdf = zend_list_find(id,&type);
- if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
- php_error(E_WARNING,"Unable to find identifier %d",id);
- RETURN_FALSE;
- }
-
- attrib.flags = AF_NOZOOM | AF_NOROTATE | AF_READONLY;
- attrib.border_array = "[0 0 1 [4 0]]";
- attrib.BS = NULL;
- attrib.r = 0.00;
- attrib.g = 0.00;
- attrib.b = 1.00;
- if(argc > 6) {
- convert_to_long(argv[6]);
- mode = argv[6]->value.lval;
- }
- if(mode == 1)
- cpdf_rawSetActionURL(pdf, (float) argv[1]->value.dval,
- (float) argv[2]->value.dval,
- (float) argv[3]->value.dval,
- (float) argv[4]->value.dval,
- argv[5]->value.str.val,
- &attrib);
- else
- cpdf_setActionURL(pdf, (float) argv[1]->value.dval,
- (float) argv[2]->value.dval,
- (float) argv[3]->value.dval,
- (float) argv[4]->value.dval,
- argv[5]->value.str.val,
- &attrib);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int cpdf_add_outline(int pdfdoc, int lastoutline, int sublevel, int open, int pagenr, string title)
- Add outline */
-PHP_FUNCTION(cpdf_add_outline) {
- pval *argv[11];
- int id, oid, type, argc;
- CPDFdoc *pdf;
- CPDFoutlineEntry *lastoutline;
- CPDF_TLS_VARS;
-
- argc = ZEND_NUM_ARGS();
- if(argc != 6)
- WRONG_PARAM_COUNT;
- if (getParametersArray(ht, argc, argv) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_long(argv[0]);
- convert_to_long(argv[1]);
- convert_to_long(argv[2]);
- convert_to_long(argv[3]);
- convert_to_long(argv[4]);
- convert_to_string(argv[5]);
- id=argv[0]->value.lval;
- pdf = zend_list_find(id,&type);
- if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
- php_error(E_WARNING,"Unable to find identifier %d",id);
- RETURN_FALSE;
- }
-
- oid=argv[1]->value.lval;
- lastoutline = zend_list_find(oid,&type);
- if(!lastoutline || type!=CPDF_GLOBAL(le_outline)) {
- lastoutline = NULL;
-/* php_error(E_WARNING,"Unable to find last outline entry %d",id);
- RETURN_FALSE; */
- }
-
- lastoutline = cpdf_addOutlineEntry(pdf, lastoutline,
- argv[2]->value.lval,
- argv[3]->value.lval,
- argv[4]->value.lval,
- argv[5]->value.str.val,
- 1, 0.0, 0.0, 0.0, 0.0);
-
- id = zend_list_insert(lastoutline,CPDF_GLOBAL(le_outline));
- RETURN_LONG(id);
-}
-/* }}} */
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/cpdf/cpdf.dsp b/ext/cpdf/cpdf.dsp
deleted file mode 100644
index 671482e134..0000000000
--- a/ext/cpdf/cpdf.dsp
+++ /dev/null
@@ -1,111 +0,0 @@
-# Microsoft Developer Studio Project File - Name="cpdf" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=cpdf - Win32 Release_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "cpdf.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "cpdf.mak" CFG="cpdf - Win32 Release_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "cpdf - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "cpdf - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "cpdf - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\..\Zend" /I "..\..\..\TSRM" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_CPDF" /D ZTS=1 /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\..\bindlib_w32" /D ZEND_DEBUG=0 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CPDF_EXPORTS" /D "COMPILE_DL_CPDF" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_CPDFLIB=1 /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x406 /d "NDEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib cpdfi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib /nologo /dll /machine:I386
-# ADD LINK32 php4ts.lib cpdf.lib user32.lib winspool.lib kernel32.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_cpdf.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
-# SUBTRACT LINK32 /pdb:none
-
-!ELSEIF "$(CFG)" == "cpdf - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_CPDF" /D ZTS=1 /D MSSQL70=1 /YX /FD /c
-# ADD CPP /nologo /MDd /W3 /GX /ZI /Od /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\..\bindlib_w32" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CPDF_EXPORTS" /D "COMPILE_DL_CPDF" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_CPDFLIB=1 /FR /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x406 /d "NDEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib cpdfi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib /nologo /dll /machine:I386
-# ADD LINK32 cpdf.lib php4ts_debug.lib user32.lib winspool.lib kernel32.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /incremental:yes /debug /machine:I386 /out:"..\..\Debug_TS/php_cpdf.dll" /libpath:"..\..\Debug_TS"
-# SUBTRACT LINK32 /pdb:none
-
-!ENDIF
-
-# Begin Target
-
-# Name "cpdf - Win32 Release_TS"
-# Name "cpdf - Win32 Debug_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\cpdf.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_cpdf.h
-# End Source File
-# End Group
-# End Target
-# End Project
diff --git a/ext/cpdf/php_cpdf.h b/ext/cpdf/php_cpdf.h
deleted file mode 100644
index d9457b9675..0000000000
--- a/ext/cpdf/php_cpdf.h
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Uwe Steinmann |
- +----------------------------------------------------------------------+
- */
-/* $Id$ */
-
-#ifndef PHP_CPDF_H
-#define PHP_CPDF_H
-
-#if HAVE_CPDFLIB
-
-/* The macro T is defined in the IMAP headers and clashes with a function
- declaration here. Get rid of it. */
-
-#ifdef T
-#undef T
-#endif
-
-#include <cpdflib.h>
-
-extern zend_module_entry cpdf_module_entry;
-#define cpdf_module_ptr &cpdf_module_entry
-
-extern PHP_MINFO_FUNCTION(cpdf);
-extern PHP_MINIT_FUNCTION(cpdf);
-extern PHP_RINIT_FUNCTION(cpdf);
-extern PHP_MSHUTDOWN_FUNCTION(cpdf);
-PHP_FUNCTION(cpdf_global_set_document_limits);
-PHP_FUNCTION(cpdf_set_creator);
-PHP_FUNCTION(cpdf_set_title);
-PHP_FUNCTION(cpdf_set_subject);
-PHP_FUNCTION(cpdf_set_keywords);
-PHP_FUNCTION(cpdf_set_viewer_preferences);
-PHP_FUNCTION(cpdf_open);
-PHP_FUNCTION(cpdf_close);
-PHP_FUNCTION(cpdf_page_init);
-PHP_FUNCTION(cpdf_finalize_page);
-PHP_FUNCTION(cpdf_set_current_page);
-PHP_FUNCTION(cpdf_begin_text);
-PHP_FUNCTION(cpdf_end_text);
-PHP_FUNCTION(cpdf_show);
-PHP_FUNCTION(cpdf_show_xy);
-PHP_FUNCTION(cpdf_continue_text);
-PHP_FUNCTION(cpdf_text);
-PHP_FUNCTION(cpdf_set_font);
-PHP_FUNCTION(cpdf_set_font_directories);
-PHP_FUNCTION(cpdf_set_font_map_file);
-PHP_FUNCTION(cpdf_set_leading);
-PHP_FUNCTION(cpdf_set_text_rendering);
-PHP_FUNCTION(cpdf_set_horiz_scaling);
-PHP_FUNCTION(cpdf_set_text_rise);
-PHP_FUNCTION(cpdf_set_text_matrix);
-PHP_FUNCTION(cpdf_set_text_pos);
-PHP_FUNCTION(cpdf_rotate_text);
-PHP_FUNCTION(cpdf_set_char_spacing);
-PHP_FUNCTION(cpdf_set_word_spacing);
-PHP_FUNCTION(cpdf_continue_text);
-PHP_FUNCTION(cpdf_stringwidth);
-PHP_FUNCTION(cpdf_save);
-PHP_FUNCTION(cpdf_restore);
-PHP_FUNCTION(cpdf_translate);
-PHP_FUNCTION(cpdf_scale);
-PHP_FUNCTION(cpdf_rotate);
-PHP_FUNCTION(cpdf_setflat);
-PHP_FUNCTION(cpdf_setlinejoin);
-PHP_FUNCTION(cpdf_setlinecap);
-PHP_FUNCTION(cpdf_setmiterlimit);
-PHP_FUNCTION(cpdf_setlinewidth);
-PHP_FUNCTION(cpdf_setdash);
-PHP_FUNCTION(cpdf_moveto);
-PHP_FUNCTION(cpdf_rmoveto);
-PHP_FUNCTION(cpdf_curveto);
-PHP_FUNCTION(cpdf_lineto);
-PHP_FUNCTION(cpdf_rlineto);
-PHP_FUNCTION(cpdf_circle);
-PHP_FUNCTION(cpdf_arc);
-PHP_FUNCTION(cpdf_rect);
-PHP_FUNCTION(cpdf_newpath);
-PHP_FUNCTION(cpdf_closepath);
-PHP_FUNCTION(cpdf_closepath_stroke);
-PHP_FUNCTION(cpdf_stroke);
-PHP_FUNCTION(cpdf_fill);
-PHP_FUNCTION(cpdf_fill_stroke);
-PHP_FUNCTION(cpdf_closepath_fill_stroke);
-PHP_FUNCTION(cpdf_endpath);
-PHP_FUNCTION(cpdf_clip);
-PHP_FUNCTION(cpdf_setgray_fill);
-PHP_FUNCTION(cpdf_setgray_stroke);
-PHP_FUNCTION(cpdf_setgray);
-PHP_FUNCTION(cpdf_setrgbcolor_fill);
-PHP_FUNCTION(cpdf_setrgbcolor_stroke);
-PHP_FUNCTION(cpdf_setrgbcolor);
-PHP_FUNCTION(cpdf_add_outline);
-PHP_FUNCTION(cpdf_set_page_animation);
-PHP_FUNCTION(cpdf_finalize);
-PHP_FUNCTION(cpdf_output_buffer);
-PHP_FUNCTION(cpdf_save_to_file);
-PHP_FUNCTION(cpdf_add_annotation);
-PHP_FUNCTION(cpdf_import_jpeg);
-#if HAVE_LIBGD13
-PHP_FUNCTION(cpdf_place_inline_image);
-#endif
-PHP_FUNCTION(cpdf_set_action_url);
-#else
-#define cpdf_module_ptr NULL
-#endif
-#define phpext_cpdf_ptr cpdf_module_ptr
-#endif /* _PHP_PDF_H */
diff --git a/ext/crack/CREDITS b/ext/crack/CREDITS
deleted file mode 100644
index ab451cac09..0000000000
--- a/ext/crack/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-crack
-Alexander Feldman
diff --git a/ext/crack/EXPERIMENTAL b/ext/crack/EXPERIMENTAL
deleted file mode 100644
index 6443e99646..0000000000
--- a/ext/crack/EXPERIMENTAL
+++ /dev/null
@@ -1,5 +0,0 @@
-this extension is experimental,
-its functions may change their names
-or move to extension all together
-so do not rely to much on them
-you have been warned!
diff --git a/ext/crack/Makefile.in b/ext/crack/Makefile.in
deleted file mode 100644
index db85e885ec..0000000000
--- a/ext/crack/Makefile.in
+++ /dev/null
@@ -1,8 +0,0 @@
-# $Id$
-
-LTLIBRARY_NAME = libcrack.la
-LTLIBRARY_SOURCES = crack.c
-LTLIBRARY_SHARED_NAME = crack.la
-LTLIBRARY_SHARED_LIBADD = $(CRACK_SHARED_LIBADD)
-
-include $(top_srcdir)/build/dynlib.mk
diff --git a/ext/crack/config.m4 b/ext/crack/config.m4
deleted file mode 100644
index a53e077eca..0000000000
--- a/ext/crack/config.m4
+++ /dev/null
@@ -1,31 +0,0 @@
-dnl $Id$
-
-PHP_ARG_WITH(crack, whether to include crack support,
-[ --with-crack[=DIR] Include crack support.])
-
-if test "$PHP_CRACK" != "no"; then
- for i in /usr/local/lib /usr/lib $PHP_CRACK $PHP_CRACK/cracklib; do
- if test -f $i/libcrack.a; then
- CRACK_LIBDIR=$i
- fi
- done
- for i in /usr/local/include /usr/include $PHP_CRACK $PHP_CRACK/cracklib; do
- if test -f $i/packer.h; then
- CRACK_INCLUDEDIR=$i
- fi
- done
-
- if test -z "$CRACK_LIBDIR"; then
- AC_MSG_ERROR(Cannot find the cracklib library file)
- fi
- if test -z "$CRACK_INCLUDEDIR"; then
- AC_MSG_ERROR(Cannot find a cracklib header file)
- fi
-
- PHP_ADD_INCLUDE($CRACK_INCLUDEDIR)
- PHP_ADD_LIBRARY_WITH_PATH(crack, $CRACK_LIBDIR)
-
- PHP_EXTENSION(crack, $ext_shared)
-
- AC_DEFINE(HAVE_CRACK, 1, [ ])
-fi
diff --git a/ext/crack/crack.c b/ext/crack/crack.c
deleted file mode 100644
index 131d5d57ac..0000000000
--- a/ext/crack/crack.c
+++ /dev/null
@@ -1,282 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: |
- +----------------------------------------------------------------------+
- */
-/* $Id$ */
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "php_ini.h"
-#include "ext/standard/info.h"
-#include "php_crack.h"
-
-#if HAVE_CRACK
-
-#include <packer.h>
-
-ZEND_DECLARE_MODULE_GLOBALS(crack)
-
-/* True global resources - no need for thread safety here */
-static int le_crack;
-
-function_entry crack_functions[] = {
- ZEND_FE(crack_opendict, NULL)
- ZEND_FE(crack_closedict, NULL)
- ZEND_FE(crack_check, NULL)
- ZEND_FE(crack_getlastmessage, NULL)
- {NULL, NULL, NULL}
-};
-
-zend_module_entry crack_module_entry = {
- "crack",
- crack_functions,
- ZEND_MINIT(crack),
- ZEND_MSHUTDOWN(crack),
- ZEND_RINIT(crack),
- ZEND_RSHUTDOWN(crack),
- PHP_MINFO(crack),
- STANDARD_MODULE_PROPERTIES
-};
-
-#ifdef COMPILE_DL_CRACK
-ZEND_GET_MODULE(crack)
-#endif
-
-PHP_INI_BEGIN()
- STD_PHP_INI_ENTRY("crack.default_dictionary", NULL, PHP_INI_SYSTEM, OnUpdateString, default_dictionary, zend_crack_globals, crack_globals)
-PHP_INI_END()
-
-long _crack_open_dict(char *dictpath)
-{
- PWDICT *pwdict;
- long resource;
-
- CRACKLS_FETCH();
-
- if (CRACKG(current_id) != -1) {
- zend_error(E_WARNING, "Can not use more than one open dictionary with this implementation of libcrack");
- return -1;
- }
- if (NULL == (pwdict = PWOpen(dictpath, "r"))) {
- zend_error(E_WARNING, "Unable to open a crack dictionary");
- return -1;
- }
-
- resource = zend_list_insert(pwdict, le_crack);
-
-/* if (CRACKG(current_id) != -1) {
- zend_list_delete(CRACKG(current_id));
- }
-*/
- CRACKG(current_id) = resource;
-
- return resource;
-}
-
-void _close_crack_dict(PWDICT *pwdict)
-{
- PWClose(pwdict);
-}
-
-ZEND_MINIT_FUNCTION(crack)
-{
- REGISTER_INI_ENTRIES();
-
- le_crack = register_list_destructors(_close_crack_dict, NULL);
-
- return SUCCESS;
-}
-
-ZEND_MSHUTDOWN_FUNCTION(crack)
-{
- UNREGISTER_INI_ENTRIES();
-
- return SUCCESS;
-}
-
-ZEND_RINIT_FUNCTION(crack)
-{
- CRACKLS_FETCH();
-
- CRACKG(last_message) = NULL;
- CRACKG(current_id) = -1;
-
- return SUCCESS;
-}
-
-ZEND_RSHUTDOWN_FUNCTION(crack)
-{
- CRACKLS_FETCH();
-
- if (NULL != CRACKG(last_message)) {
- efree(CRACKG(last_message));
- }
-
- return SUCCESS;
-}
-
-PHP_MINFO_FUNCTION(crack)
-{
- php_info_print_table_start();
- php_info_print_table_header(2, "crack support", "enabled");
- php_info_print_table_end();
-
- DISPLAY_INI_ENTRIES();
-}
-
-/* {{{ proto string crack_opendict(string dictionary)
- Opens a new cracklib dictionary */
-ZEND_FUNCTION(crack_opendict)
-{
- zval **dictpath;
- long resource;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &dictpath) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(dictpath);
-
- if (-1 == (resource = _crack_open_dict(Z_STRVAL_PP(dictpath)))) {
- RETURN_FALSE;
- }
-
- RETURN_RESOURCE(resource);
-}
-/* }}} */
-
-/* {{{ proto string crack_closedict([int link_identifier])
- Closes an open cracklib dictionary. */
-ZEND_FUNCTION(crack_closedict)
-{
- PWDICT *pwdict;
- zval **dictionary;
- long id;
-
- CRACKLS_FETCH();
-
- switch (ZEND_NUM_ARGS()) {
- case 0:
- id = CRACKG(current_id);
- break;
- case 1:
- if (zend_get_parameters_ex(1, &dictionary) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- id = (*dictionary)->value.lval;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- ZEND_FETCH_RESOURCE(pwdict, PWDICT *, dictionary, id, "cracklib dictionary", le_crack);
- if (CRACKG(current_id) == id) {
- CRACKG(current_id) = -1;
- }
- zend_list_delete(id);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto string crack_check([int dictionary,] string password)
- Performs an obscure check with the given password */
-ZEND_FUNCTION(crack_check)
-{
- zval **dictionary = NULL, **password;
- char pwtrunced[STRINGSIZE];
- char *message;
- PWDICT *pwdict;
- long id;
-
- CRACKLS_FETCH();
-
- switch (ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &password) == FAILURE) {
- RETURN_FALSE;
- }
- if (NULL != CRACKG(default_dictionary) && CRACKG(current_id) == -1) {
- _crack_open_dict(CRACKG(default_dictionary));
- }
- id = CRACKG(current_id);
- break;
- case 2:
- if (zend_get_parameters_ex(2, &dictionary, &password) == FAILURE) {
- RETURN_FALSE;
- }
- id = -1;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- ZEND_FETCH_RESOURCE(pwdict, PWDICT *, dictionary, id, "cracklib dictionary", le_crack);
- convert_to_string_ex(password);
-
- /* Prevent buffer overflow attacks. */
- strlcpy(pwtrunced, Z_STRVAL_PP(password), sizeof(pwtrunced));
-
- message = (char *)FascistLook(pwdict, pwtrunced);
-
- if (NULL != CRACKG(last_message)) {
- efree(CRACKG(last_message));
- }
-
- if (NULL == message) {
- CRACKG(last_message) = estrdup("strong password");
- RETURN_TRUE;
- }
-
- CRACKG(last_message) = estrdup(message);
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto string crack_getlastmessage()
- Returns the message from the last obscure check. */
-ZEND_FUNCTION(crack_getlastmessage)
-{
- CRACKLS_FETCH();
-
- if (ZEND_NUM_ARGS() != 0) {
- WRONG_PARAM_COUNT;
- }
-
- if (NULL == CRACKG(last_message)) {
- zend_error(E_WARNING, "No obscure checks in this session");
- RETURN_FALSE;
- }
-
- RETURN_STRING(CRACKG(last_message), 1);
-}
-/* }}} */
-
-#endif /* HAVE_CRACK */
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/crack/php_crack.h b/ext/crack/php_crack.h
deleted file mode 100644
index 17ad313481..0000000000
--- a/ext/crack/php_crack.h
+++ /dev/null
@@ -1,54 +0,0 @@
-#ifndef ZEND_CRACK_H
-#define ZEND_CRACK_H
-
-#if HAVE_CRACK
-
-extern zend_module_entry crack_module_entry;
-#define phpext_crack_ptr &crack_module_entry
-
-#ifdef ZEND_WIN32
-#define ZEND_CRACK_API __declspec(dllexport)
-#else
-#define ZEND_CRACK_API
-#endif
-
-ZEND_MINIT_FUNCTION(crack);
-ZEND_MSHUTDOWN_FUNCTION(crack);
-ZEND_RINIT_FUNCTION(crack);
-ZEND_RSHUTDOWN_FUNCTION(crack);
-PHP_MINFO_FUNCTION(crack);
-
-ZEND_FUNCTION(crack_opendict);
-ZEND_FUNCTION(crack_closedict);
-ZEND_FUNCTION(crack_check);
-ZEND_FUNCTION(crack_getlastmessage);
-
-ZEND_BEGIN_MODULE_GLOBALS(crack)
- char *default_dictionary;
- char *last_message;
- long current_id;
-ZEND_END_MODULE_GLOBALS(crack)
-
-#ifdef ZTS
-#define CRACKG(v) (crack_globals->v)
-#define CRACKLS_FETCH() zend_crack_globals *crack_globals = ts_resource(crack_globals_id)
-#else
-#define CRACKG(v) (crack_globals.v)
-#define CRACKLS_FETCH()
-#endif
-
-#else
-
-#define phpext_crack_ptr NULL
-
-#endif
-
-#endif /* ZEND_CRACK_H */
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/crack/tests/001.phpt b/ext/crack/tests/001.phpt
deleted file mode 100644
index dc18ef5559..0000000000
--- a/ext/crack/tests/001.phpt
+++ /dev/null
@@ -1,23 +0,0 @@
---TEST--
-Check for crack presence
---SKIPIF--
-<?php if (!extension_loaded("crack")) print "skip"; ?>
---POST--
---GET--
---FILE--
-<?php
-echo "crack extension is available";
-/*
- you can add regression tests for your extension here
-
- the output of your test code has to be equal to the
- text in the --EXPECT-- section below for the tests
- to pass, differences between the output and the
- expected text are interpreted as failure
-
- see php4/tests/README for further information on
- writing regression tests
-*/
-?>
---EXPECT--
-crack extension is available \ No newline at end of file
diff --git a/ext/ctype/CREDITS b/ext/ctype/CREDITS
deleted file mode 100644
index 22de902709..0000000000
--- a/ext/ctype/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-ctype
-Hartmut Holzgraefe
diff --git a/ext/ctype/EXPERIMENTAL b/ext/ctype/EXPERIMENTAL
deleted file mode 100644
index 6443e99646..0000000000
--- a/ext/ctype/EXPERIMENTAL
+++ /dev/null
@@ -1,5 +0,0 @@
-this extension is experimental,
-its functions may change their names
-or move to extension all together
-so do not rely to much on them
-you have been warned!
diff --git a/ext/ctype/Makefile.in b/ext/ctype/Makefile.in
deleted file mode 100644
index 940398455b..0000000000
--- a/ext/ctype/Makefile.in
+++ /dev/null
@@ -1,8 +0,0 @@
-# $Id$
-
-LTLIBRARY_NAME = libctype.la
-LTLIBRARY_SOURCES = ctype.c
-LTLIBRARY_SHARED_NAME = ctype.la
-LTLIBRARY_SHARED_LIBADD = $(CTYPE_SHARED_LIBADD)
-
-include $(top_srcdir)/build/dynlib.mk
diff --git a/ext/ctype/README b/ext/ctype/README
deleted file mode 100644
index 1e78a3d933..0000000000
--- a/ext/ctype/README
+++ /dev/null
@@ -1,5 +0,0 @@
-this is an experimental extension that provides the
-ctype family of function available in C
-i'm not sure about whether they should go into ext/standard
-or stay as an extension of their own and about using
-a ctype_ prefix or sticking with the C names ...
diff --git a/ext/ctype/config.m4 b/ext/ctype/config.m4
deleted file mode 100644
index 774047b9b9..0000000000
--- a/ext/ctype/config.m4
+++ /dev/null
@@ -1,27 +0,0 @@
-dnl $Id$
-dnl config.m4 for extension ctype
-dnl don't forget to call PHP_EXTENSION(ctype)
-
-dnl Comments in this file start with the string 'dnl'.
-dnl Remove where necessary. This file will not work
-dnl without editing.
-
-dnl If your extension references something external, use with:
-
-dnl PHP_ARG_WITH(ctype, for ctype support,
-dnl Make sure that the comment is aligned:
-dnl [ --with-ctype Include ctype support])
-
-dnl Otherwise use enable:
-
-PHP_ARG_ENABLE(ctype, whether to enable ctype support,
-[ --enable-ctype Enable ctype support])
-
-if test "$PHP_CTYPE" != "no"; then
- dnl If you will not be testing anything external, like existence of
- dnl headers, libraries or functions in them, just uncomment the
- dnl following line and you are ready to go.
- AC_DEFINE(HAVE_CTYPE, 1, [ ])
- dnl Write more examples of tests here...
- PHP_EXTENSION(ctype, $ext_shared)
-fi
diff --git a/ext/ctype/ctype.c b/ext/ctype/ctype.c
deleted file mode 100644
index 17bb8764b4..0000000000
--- a/ext/ctype/ctype.c
+++ /dev/null
@@ -1,330 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Hartmut Holzgraefe <hartmut@six.de> |
- +----------------------------------------------------------------------+
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "php_ini.h"
-#include "php_ctype.h"
-#include "SAPI.h"
-#include "ext/standard/info.h"
-
-#include <ctype.h>
-
-/* You should tweak config.m4 so this symbol (or some else suitable)
- gets defined.
-*/
-#if HAVE_CTYPE
-
-/* If you declare any globals in php_ctype.h uncomment this:
-ZEND_DECLARE_MODULE_GLOBALS(ctype)
-*/
-
-/* True global resources - no need for thread safety here */
-static int le_ctype;
-
-/* {{{ ctype_functions[]
- * Every user visible function must have an entry in ctype_functions[].
- */
-function_entry ctype_functions[] = {
- PHP_FE(ctype_alnum, NULL)
- PHP_FE(ctype_alpha, NULL)
- PHP_FE(ctype_cntrl, NULL)
- PHP_FE(ctype_digit, NULL)
- PHP_FE(ctype_lower, NULL)
- PHP_FE(ctype_graph, NULL)
- PHP_FE(ctype_print, NULL)
- PHP_FE(ctype_punct, NULL)
- PHP_FE(ctype_space, NULL)
- PHP_FE(ctype_upper, NULL)
- PHP_FE(ctype_xdigit, NULL)
- {NULL, NULL, NULL} /* Must be the last line in ctype_functions[] */
-};
-/* }}} */
-
-/* {{{ ctype_mpodule_entry
- */
-zend_module_entry ctype_module_entry = {
- "ctype",
- ctype_functions,
- NULL,
- NULL,
- NULL,
- NULL,
- PHP_MINFO(ctype),
- STANDARD_MODULE_PROPERTIES
-};
-/* }}} */
-
-#ifdef COMPILE_DL_CTYPE
-ZEND_GET_MODULE(ctype)
-#endif
-
-#ifndef PHP_EXPERIMENTAL
-#define PHP_EXPERIMENTAL(x,y)
-#endif
-
-/* {{{ PHP_MINFO_FUNCTION
- */
-PHP_MINFO_FUNCTION(ctype)
-{
- ELS_FETCH();
- SLS_FETCH();
-
- php_info_print_table_start();
- php_info_print_table_row(2, "ctype functions", "enabled (experimental)");
- php_info_print_table_end();
-}
-/* }}} */
-
-/* {{{ ctype
- */
-static int ctype(int (*iswhat)(int),zval **c)
-{
- switch ((*c)->type) {
- case IS_LONG:
- return iswhat((*c)->value.lval);
- case IS_STRING:
- {
- char *p;
- int n,len;
- convert_to_string_ex(c);
- p=(*c)->value.str.val;
- len = (*c)->value.str.len;
- for(n=0;n<len;n++) {
- if(!iswhat(*p++)) return 0;
- }
- return 1;
- }
- default:
- break;
- }
- return 0;
-}
-/* }}} */
-
-/* {{{ proto bool isalnum(mixed c)
- Check for alphanumeric character(s) */
-PHP_FUNCTION(ctype_alnum)
-{
- PHP_EXPERIMENTAL("4.0.4dev",NULL)
- zval **c;
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &c) == FAILURE){
- WRONG_PARAM_COUNT;
- }
-
- if(ctype(isalnum,c)) {
- RETURN_TRUE;
- }
-
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto bool isalpha(mixed c)
- Check for alphabetic character(s) */
-PHP_FUNCTION(ctype_alpha)
-{
- PHP_EXPERIMENTAL("4.0.4dev",NULL)
- zval **c;
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &c) == FAILURE){
- WRONG_PARAM_COUNT;
- }
-
- if(ctype(isalpha,c)) {
- RETURN_TRUE;
- }
-
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto bool iscntrl(mixed c)
- Check for control character(s) */
-PHP_FUNCTION(ctype_cntrl)
-{
- PHP_EXPERIMENTAL("4.0.4dev",NULL)
- zval **c;
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &c) == FAILURE){
- WRONG_PARAM_COUNT;
- }
-
- if(ctype(iscntrl,c)) {
- RETURN_TRUE;
- }
-
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto bool isdigit(mixed c)
- Check for numeric character(s) */
-PHP_FUNCTION(ctype_digit)
-{
- PHP_EXPERIMENTAL("4.0.4dev",NULL)
- zval **c;
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &c) == FAILURE){
- WRONG_PARAM_COUNT;
- }
-
- if(ctype(isdigit,c)) {
- RETURN_TRUE;
- }
-
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto bool islower(mixed c)
- Check for lowercase character(s) */
-PHP_FUNCTION(ctype_lower)
-{
- PHP_EXPERIMENTAL("4.0.4dev",NULL)
- zval **c;
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &c) == FAILURE){
- WRONG_PARAM_COUNT;
- }
-
- if(ctype(islower,c)) {
- RETURN_TRUE;
- }
-
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto bool isgraph(mixed c)
- Check for any printable character(s) except space */
-PHP_FUNCTION(ctype_graph)
-{
- PHP_EXPERIMENTAL("4.0.4dev",NULL)
- zval **c;
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &c) == FAILURE){
- WRONG_PARAM_COUNT;
- }
-
- if(ctype(isgraph,c)) {
- RETURN_TRUE;
- }
-
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto bool isprint(mixed c)
- Check for printable character(s) */
-PHP_FUNCTION(ctype_print)
-{
- PHP_EXPERIMENTAL("4.0.4dev",NULL)
- zval **c;
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &c) == FAILURE){
- WRONG_PARAM_COUNT;
- }
-
- if(ctype(isprint,c)) {
- RETURN_TRUE;
- }
-
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto bool ispunct(mixed c)
- Check for any printable character which is not whitespace or an alphanumeric character */
-PHP_FUNCTION(ctype_punct)
-{
- PHP_EXPERIMENTAL("4.0.4dev",NULL)
- zval **c;
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &c) == FAILURE){
- WRONG_PARAM_COUNT;
- }
-
- if(ctype(ispunct,c)) {
- RETURN_TRUE;
- }
-
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto bool isspace(mixed c)
- Check for whitespace character(s)*/
-PHP_FUNCTION(ctype_space)
-{
- PHP_EXPERIMENTAL("4.0.4dev",NULL)
- zval **c;
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &c) == FAILURE){
- WRONG_PARAM_COUNT;
- }
-
- if(ctype(isspace,c)) {
- RETURN_TRUE;
- }
-
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto bool isupper(mixed c)
- Check for uppercase character(s) */
-PHP_FUNCTION(ctype_upper)
-{
- PHP_EXPERIMENTAL("4.0.4dev",NULL)
- zval **c;
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &c) == FAILURE){
- WRONG_PARAM_COUNT;
- }
-
- if(ctype(isupper,c)) {
- RETURN_TRUE;
- }
-
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto bool isxdigit(mixed c)
- Check for character(s) representing a hexadecimal digit */
-PHP_FUNCTION(ctype_xdigit)
-{
- PHP_EXPERIMENTAL("4.0.4dev",NULL)
- zval **c;
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &c) == FAILURE){
- WRONG_PARAM_COUNT;
- }
-
- if(ctype(isxdigit,c)) {
- RETURN_TRUE;
- }
-
- RETURN_FALSE;
-}
-/* }}} */
-
-#endif /* HAVE_CTYPE */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/ctype/ctype.dsp b/ext/ctype/ctype.dsp
deleted file mode 100644
index 8cb2837fed..0000000000
--- a/ext/ctype/ctype.dsp
+++ /dev/null
@@ -1,107 +0,0 @@
-# Microsoft Developer Studio Project File - Name="ctype" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=ctype - Win32 Debug_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "ctype.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "ctype.mak" CFG="ctype - Win32 Debug_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "ctype - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "ctype - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "ctype - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CTYPE_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\main" /D "WIN32" /D "PHP_EXPORTS" /D "COMPILE_DL_CTYPE" /D ZTS=1 /D HAVE_CTYPE=1 /D ZEND_DEBUG=0 /D "NDEBUG" /D "_WINDOWS" /D "ZEND_WIN32" /D "PHP_WIN32" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x407 /d "NDEBUG"
-# ADD RSC /l 0x407 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 php4ts.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_ctype.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
-
-!ELSEIF "$(CFG)" == "ctype - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CTYPE_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\main" /D ZEND_DEBUG=1 /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "PHP_EXPORTS" /D "COMPILE_DL_CTYPE" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_CTYPE=1 /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x407 /d "_DEBUG"
-# ADD RSC /l 0x407 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 php4ts_debug.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"..\..\Debug_TS/php_ctype.dll" /pdbtype:sept /libpath:"..\..\Debug_TS"
-
-!ENDIF
-
-# Begin Target
-
-# Name "ctype - Win32 Release_TS"
-# Name "ctype - Win32 Debug_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\ctype.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_ctype.h
-# End Source File
-# End Group
-# End Target
-# End Project
diff --git a/ext/ctype/ctype.xml b/ext/ctype/ctype.xml
deleted file mode 100644
index 5837b9b5d0..0000000000
--- a/ext/ctype/ctype.xml
+++ /dev/null
@@ -1,245 +0,0 @@
- <reference id="ref.ctype">
- <title>Character type functions</title>
- <titleabbrev>ctype</titleabbrev>
-
- <partintro>
- <para>
- These functions check whether a character or string
- falls into a certain character class according to the i
- current locale.
- </para>
- <para>
- When called with an integer argument theese functions
- behave exactly like their C counterparts.
- </para>
- <para>
- When called with a string argument they will check
- every character in the string and will only return
- true if every character in the string matches the
- requested criteria.
- </para>
- <para>
- Passing anything else but a string or integer will
- return false immediately.
- </para>
- </partintro>
-
-
- <refentry id="function.isalnum">
- <refnamediv>
- <refname>isalnum</refname>
- <refpurpose>Check for alphanumeric character(s)</refpurpose>
- </refnamediv>
- <refsect1>
- <title>Description</title>
- <funcsynopsis>
- <funcprototype>
- <funcdef>bool <function>isalnum</function></funcdef>
- <paramdef>string <parameter>c</parameter></paramdef>
- </funcprototype>
- </funcsynopsis>
- <para>
- See also <function>setlocale</function>.
- </para>
- </refsect1>
- </refentry>
-
- <refentry id="function.isalpha">
- <refnamediv>
- <refname>isalpha</refname>
- <refpurpose></refpurpose>
- </refnamediv>
- <refsect1>
- <title>Description</title>
- <funcsynopsis>
- <funcprototype>
- <funcdef>bool <function>isalpha</function></funcdef>
- <paramdef>string <parameter>c</parameter></paramdef>
- </funcprototype>
- </funcsynopsis>
- <para>
- </para>
- </refsect1>
- </refentry>
-
- <refentry id="function.iscntrl">
- <refnamediv>
- <refname>iscntrl</refname>
- <refpurpose></refpurpose>
- </refnamediv>
- <refsect1>
- <title>Description</title>
- <funcsynopsis>
- <funcprototype>
- <funcdef>bool <function>iscntrl</function></funcdef>
- <paramdef>string <parameter>c</parameter></paramdef>
- </funcprototype>
- </funcsynopsis>
- <para>
- </para>
- </refsect1>
- </refentry>
-
- <refentry id="function.isdigit">
- <refnamediv>
- <refname>isdigit</refname>
- <refpurpose></refpurpose>
- </refnamediv>
- <refsect1>
- <title>Description</title>
- <funcsynopsis>
- <funcprototype>
- <funcdef>bool <function>isdigit</function></funcdef>
- <paramdef>string <parameter>c</parameter></paramdef>
- </funcprototype>
- </funcsynopsis>
- <para>
- </para>
- </refsect1>
- </refentry>
-
- <refentry id="function.islower">
- <refnamediv>
- <refname>islower</refname>
- <refpurpose></refpurpose>
- </refnamediv>
- <refsect1>
- <title>Description</title>
- <funcsynopsis>
- <funcprototype>
- <funcdef>bool <function>islower</function></funcdef>
- <paramdef>string <parameter>c</parameter></paramdef>
- </funcprototype>
- </funcsynopsis>
- <para>
- </para>
- </refsect1>
- </refentry>
-
- <refentry id="function.isgraph">
- <refnamediv>
- <refname>isgraph</refname>
- <refpurpose></refpurpose>
- </refnamediv>
- <refsect1>
- <title>Description</title>
- <funcsynopsis>
- <funcprototype>
- <funcdef>bool <function>isgraph</function></funcdef>
- <paramdef>string <parameter>c</parameter></paramdef>
- </funcprototype>
- </funcsynopsis>
- <para>
- </para>
- </refsect1>
- </refentry>
-
- <refentry id="function.isprint">
- <refnamediv>
- <refname>isprint</refname>
- <refpurpose></refpurpose>
- </refnamediv>
- <refsect1>
- <title>Description</title>
- <funcsynopsis>
- <funcprototype>
- <funcdef>bool <function>isprint</function></funcdef>
- <paramdef>string <parameter>c</parameter></paramdef>
- </funcprototype>
- </funcsynopsis>
- <para>
- </para>
- </refsect1>
- </refentry>
-
- <refentry id="function.ispunct">
- <refnamediv>
- <refname>ispunct</refname>
- <refpurpose></refpurpose>
- </refnamediv>
- <refsect1>
- <title>Description</title>
- <funcsynopsis>
- <funcprototype>
- <funcdef>bool <function>ispunct</function></funcdef>
- <paramdef>string <parameter>c</parameter></paramdef>
- </funcprototype>
- </funcsynopsis>
- <para>
- </para>
- </refsect1>
- </refentry>
-
- <refentry id="function.isspace">
- <refnamediv>
- <refname>isspace</refname>
- <refpurpose></refpurpose>
- </refnamediv>
- <refsect1>
- <title>Description</title>
- <funcsynopsis>
- <funcprototype>
- <funcdef>bool <function>isspace</function></funcdef>
- <paramdef>string <parameter>c</parameter></paramdef>
- </funcprototype>
- </funcsynopsis>
- <para>
- </para>
- </refsect1>
- </refentry>
-
- <refentry id="function.isupper">
- <refnamediv>
- <refname>isupper</refname>
- <refpurpose></refpurpose>
- </refnamediv>
- <refsect1>
- <title>Description</title>
- <funcsynopsis>
- <funcprototype>
- <funcdef>bool <function>isupper</function></funcdef>
- <paramdef>string <parameter>c</parameter></paramdef>
- </funcprototype>
- </funcsynopsis>
- <para>
- </para>
- </refsect1>
- </refentry>
-
- <refentry id="function.isxdigit">
- <refnamediv>
- <refname>isxdigit</refname>
- <refpurpose></refpurpose>
- </refnamediv>
- <refsect1>
- <title>Description</title>
- <funcsynopsis>
- <funcprototype>
- <funcdef>bool <function>isxdigit</function></funcdef>
- <paramdef>string <parameter>c</parameter></paramdef>
- </funcprototype>
- </funcsynopsis>
- <para>
- </para>
- </refsect1>
- </refentry>
-
- </reference>
-
-<!-- Keep this comment at the end of the file
-Local variables:
-mode: sgml
-sgml-omittag:t
-sgml-shorttag:t
-sgml-minimize-attributes:nil
-sgml-always-quote-attributes:t
-sgml-indent-step:1
-sgml-indent-data:t
-sgml-parent-document:nil
-sgml-default-dtd-file:"../../manual.ced"
-sgml-exposed-tags:nil
-sgml-local-catalogs:nil
-sgml-local-ecat-files:nil
-End:
--->
-
diff --git a/ext/ctype/php_ctype.h b/ext/ctype/php_ctype.h
deleted file mode 100644
index 8b4ff6f4fd..0000000000
--- a/ext/ctype/php_ctype.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: |
- | |
- +----------------------------------------------------------------------+
- */
-
-#ifndef PHP_CTYPE_H
-#define PHP_CTYPE_H
-
-/* You should tweak config.m4 so this symbol (or some else suitable)
- gets defined.
-*/
-#if HAVE_CTYPE
-
-extern zend_module_entry ctype_module_entry;
-#define phpext_ctype_ptr &ctype_module_entry
-
-#ifdef PHP_WIN32
-#define PHP_CTYPE_API __declspec(dllexport)
-#else
-#define PHP_CTYPE_API
-#endif
-
-PHP_MINIT_FUNCTION(ctype);
-PHP_MSHUTDOWN_FUNCTION(ctype);
-PHP_RINIT_FUNCTION(ctype);
-PHP_RSHUTDOWN_FUNCTION(ctype);
-PHP_MINFO_FUNCTION(ctype);
-
-PHP_FUNCTION(ctype_alnum);
-PHP_FUNCTION(ctype_alpha);
-PHP_FUNCTION(ctype_cntrl);
-PHP_FUNCTION(ctype_digit);
-PHP_FUNCTION(ctype_lower);
-PHP_FUNCTION(ctype_graph);
-PHP_FUNCTION(ctype_print);
-PHP_FUNCTION(ctype_punct);
-PHP_FUNCTION(ctype_space);
-PHP_FUNCTION(ctype_upper);
-PHP_FUNCTION(ctype_xdigit);
-
-/*
- Declare any global variables you may need between the BEGIN
- and END macros here:
-
-ZEND_BEGIN_MODULE_GLOBALS(ctype)
- int global_variable;
-ZEND_END_MODULE_GLOBALS(ctype)
-*/
-
-/* In every function that needs to use variables in php_ctype_globals,
- do call CTYPELS_FETCH(); after declaring other variables used by
- that function, and always refer to them as CTYPEG(variable).
- You are encouraged to rename these macros something shorter, see
- examples in any other php module directory.
-*/
-
-#ifdef ZTS
-#define CTYPEG(v) (ctype_globals->v)
-#define CTYPELS_FETCH() php_ctype_globals *ctype_globals = ts_resource(ctype_globals_id)
-#else
-#define CTYPEG(v) (ctype_globals.v)
-#define CTYPELS_FETCH()
-#endif
-
-#else
-
-#define phpext_ctype_ptr NULL
-
-#endif
-
-#endif /* PHP_CTYPE_H */
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/ctype/tests/001.phpt b/ext/ctype/tests/001.phpt
deleted file mode 100644
index e30e483dfe..0000000000
--- a/ext/ctype/tests/001.phpt
+++ /dev/null
@@ -1,41 +0,0 @@
---TEST--
-ctype on integers
---SKIPIF--
-<?php if (!extension_loaded("ctype")) print "skip"; ?>
---POST--
---GET--
---FILE--
-<?php
- setlocale("LC_ALL","C");
-
- function ctype_test_001($function) {
- $n=0;
- for($a=0;$a<256;$a++) {
- if($function($a)) $n++;
- }
- echo "$function $n\n";
- }
-ctype_test_001("ctype_lower");
-ctype_test_001("ctype_upper");
-ctype_test_001("ctype_alpha");
-ctype_test_001("ctype_digit");
-ctype_test_001("ctype_alnum");
-ctype_test_001("ctype_cntrl");
-ctype_test_001("ctype_graph");
-ctype_test_001("ctype_print");
-ctype_test_001("ctype_punct");
-ctype_test_001("ctype_space");
-ctype_test_001("ctype_xdigit");
-?>
---EXPECT--
-ctype_lower 26
-ctype_upper 26
-ctype_alpha 52
-ctype_digit 10
-ctype_alnum 62
-ctype_cntrl 33
-ctype_graph 94
-ctype_print 95
-ctype_punct 32
-ctype_space 6
-ctype_xdigit 22
diff --git a/ext/ctype/tests/002.phpt b/ext/ctype/tests/002.phpt
deleted file mode 100644
index 7e9dac25de..0000000000
--- a/ext/ctype/tests/002.phpt
+++ /dev/null
@@ -1,43 +0,0 @@
---TEST--
-ctype on strings
---SKIPIF--
-<?php if (!extension_loaded("ctype")) print "skip"; ?>
---POST--
---GET--
---FILE--
-<?php
- setlocale("LC_ALL","C");
-
- function ctype_test_002($function) {
- $n=0; $m=0;
- for($a=0;$a<256;$a++) {
- $c = chr($a);
- if($function("$c$c$c")) $n++;
- if($function("1-$c$c$c-x")) $m++;
- }
- echo "$function $n $m\n";
- }
-ctype_test_002("ctype_lower");
-ctype_test_002("ctype_upper");
-ctype_test_002("ctype_alpha");
-ctype_test_002("ctype_digit");
-ctype_test_002("ctype_alnum");
-ctype_test_002("ctype_cntrl");
-ctype_test_002("ctype_graph");
-ctype_test_002("ctype_print");
-ctype_test_002("ctype_punct");
-ctype_test_002("ctype_space");
-ctype_test_002("ctype_xdigit");
-?>
---EXPECT--
-ctype_lower 26 0
-ctype_upper 26 0
-ctype_alpha 52 0
-ctype_digit 10 0
-ctype_alnum 62 0
-ctype_cntrl 33 0
-ctype_graph 94 94
-ctype_print 95 95
-ctype_punct 32 0
-ctype_space 6 0
-ctype_xdigit 22 0
diff --git a/ext/curl/CREDITS b/ext/curl/CREDITS
deleted file mode 100644
index 1e9f272a39..0000000000
--- a/ext/curl/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-CURL
-Sterling Hughes
diff --git a/ext/curl/Makefile.in b/ext/curl/Makefile.in
deleted file mode 100644
index 1e32fad8a2..0000000000
--- a/ext/curl/Makefile.in
+++ /dev/null
@@ -1,7 +0,0 @@
-
-LTLIBRARY_NAME = libcurl.la
-LTLIBRARY_SOURCES = curl.c
-LTLIBRARY_SHARED_NAME = curl.la
-LTLIBRARY_SHARED_LIBADD = $(CURL_SHARED_LIBADD)
-
-include $(top_srcdir)/build/dynlib.mk
diff --git a/ext/curl/config.m4 b/ext/curl/config.m4
deleted file mode 100644
index abf345f74d..0000000000
--- a/ext/curl/config.m4
+++ /dev/null
@@ -1,55 +0,0 @@
-dnl $Id$
-dnl config.m4 for extension CURL
-
-PHP_ARG_WITH(curl, for CURL support,
-[ --with-curl[=DIR] Include CURL support])
-
-if test "$PHP_CURL" != "no"; then
- if test -r $PHP_CURL/include/curl/easy.h; then
- CURL_DIR=$PHP_CURL
- else
- AC_MSG_CHECKING(for CURL in default path)
- for i in /usr/local /usr; do
- if test -r $i/include/curl/easy.h; then
- CURL_DIR=$i
- AC_MSG_RESULT(found in $i)
- fi
- done
- fi
-
- if test -z "$CURL_DIR"; then
- AC_MSG_RESULT(not found)
- AC_MSG_ERROR(Please reinstall the libcurl distribution -
- easy.h should be in <curl-dir>/include/curl/)
- fi
-
- CURL_CONFIG="curl-config"
- AC_MSG_CHECKING(for cURL greater than 7.7.3)
-
- if ${CURL_DIR}/bin/curl-config --libs print > /dev/null 2>&1; then
- CURL_CONFIG=${CURL_DIR}/bin/curl-config
- fi
-
- curl_version_full=`$CURL_CONFIG --version`
- curl_version=`echo ${curl_version_full} | sed -e 's/libcurl //' | awk 'BEGIN { FS = "."; } { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
- if test "$curl_version" -ge 7007003; then
- AC_MSG_RESULT($curl_version_full)
- CURL_LIBS=`$CURL_CONFIG --libs`
- else
- AC_MSG_ERROR(cURL version 7.7.3 or later is required to compile php with cURL support)
- fi
-
- PHP_ADD_INCLUDE($CURL_DIR/include)
- PHP_EVAL_LIBLINE($CURL_LIBS, CURL_SHARED_LIBADD)
- PHP_ADD_LIBRARY_WITH_PATH(curl, $CURL_DIR/lib, CURL_SHARED_LIBADD)
-
- AC_CHECK_LIB(curl,curl_easy_perform,
- [
- AC_DEFINE(HAVE_CURL,1,[ ])
- ],[
- AC_MSG_ERROR(There is something wrong. Please check config.log for more information.)
- ])
-
- PHP_EXTENSION(curl, $ext_shared)
- PHP_SUBST(CURL_SHARED_LIBADD)
-fi
diff --git a/ext/curl/curl.c b/ext/curl/curl.c
deleted file mode 100644
index 9dabac6c83..0000000000
--- a/ext/curl/curl.c
+++ /dev/null
@@ -1,985 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Sterling Hughes <sterling@php.net> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-
-#if HAVE_CURL
-
-#include <stdio.h>
-#include <string.h>
-
-#ifdef PHP_WIN32
-#include <winsock.h>
-#include <sys/types.h>
-#endif
-
-#include <curl/curl.h>
-#include <curl/easy.h>
-
-#include "ext/standard/info.h"
-#include "ext/standard/file.h"
-#include "php_curl.h"
-
-static int le_curl;
-#define le_curl_name "cURL handle"
-
-static void _php_curl_close(zend_rsrc_list_entry *rsrc);
-
-#define SAVE_CURL_ERROR(__handle, __err) (__handle)->err.no = (int) __err;
-
-/* {{{ curl_functions[]
- */
-function_entry curl_functions[] = {
- PHP_FE(curl_init, NULL)
- PHP_FE(curl_version, NULL)
- PHP_FE(curl_setopt, NULL)
- PHP_FE(curl_exec, NULL)
- PHP_FE(curl_getinfo, NULL)
- PHP_FE(curl_error, NULL)
- PHP_FE(curl_errno, NULL)
- PHP_FE(curl_close, NULL)
- {NULL, NULL, NULL}
-};
-/* }}} */
-
-/* {{{ curl_module_entry
- */
-zend_module_entry curl_module_entry = {
- "curl",
- curl_functions,
- PHP_MINIT(curl),
- NULL,
- NULL,
- NULL,
- PHP_MINFO(curl),
- STANDARD_MODULE_PROPERTIES
-};
-/* }}} */
-
-#ifdef COMPILE_DL_CURL
-ZEND_GET_MODULE (curl)
-#endif
-
-/* {{{ PHP_MINFO_FUNCTION
- */
-PHP_MINFO_FUNCTION(curl)
-{
- php_info_print_table_start();
- php_info_print_table_row(2, "CURL support", "enabled");
- php_info_print_table_row(2, "CURL Information", curl_version());
- php_info_print_table_end();
-}
-/* }}} */
-
-#define REGISTER_CURL_CONSTANT(name, value) REGISTER_LONG_CONSTANT(name, value, CONST_CS | CONST_PERSISTENT)
-
-/* {{{ PHP_MINIT_FUNCTION
- */
-PHP_MINIT_FUNCTION(curl)
-{
- le_curl = zend_register_list_destructors_ex(_php_curl_close, NULL, "curl", module_number);
-
- /* Constants for curl_setopt() */
- REGISTER_CURL_CONSTANT("CURLOPT_PORT", CURLOPT_PORT);
- REGISTER_CURL_CONSTANT("CURLOPT_FILE", CURLOPT_FILE);
- REGISTER_CURL_CONSTANT("CURLOPT_INFILE", CURLOPT_INFILE);
- REGISTER_CURL_CONSTANT("CURLOPT_INFILESIZE", CURLOPT_INFILESIZE);
- REGISTER_CURL_CONSTANT("CURLOPT_URL", CURLOPT_URL);
- REGISTER_CURL_CONSTANT("CURLOPT_PROXY", CURLOPT_PROXY);
- REGISTER_CURL_CONSTANT("CURLOPT_VERBOSE", CURLOPT_VERBOSE);
- REGISTER_CURL_CONSTANT("CURLOPT_HEADER", CURLOPT_HEADER);
- REGISTER_CURL_CONSTANT("CURLOPT_HTTPHEADER", CURLOPT_HTTPHEADER);
- REGISTER_CURL_CONSTANT("CURLOPT_NOPROGRESS", CURLOPT_NOPROGRESS);
- REGISTER_CURL_CONSTANT("CURLOPT_NOBODY", CURLOPT_NOBODY);
- REGISTER_CURL_CONSTANT("CURLOPT_FAILONERROR", CURLOPT_FAILONERROR);
- REGISTER_CURL_CONSTANT("CURLOPT_UPLOAD", CURLOPT_UPLOAD);
- REGISTER_CURL_CONSTANT("CURLOPT_POST", CURLOPT_POST);
- REGISTER_CURL_CONSTANT("CURLOPT_FTPLISTONLY", CURLOPT_FTPLISTONLY);
- REGISTER_CURL_CONSTANT("CURLOPT_FTPAPPEND", CURLOPT_FTPAPPEND);
- REGISTER_CURL_CONSTANT("CURLOPT_NETRC", CURLOPT_NETRC);
- REGISTER_CURL_CONSTANT("CURLOPT_FOLLOWLOCATION", CURLOPT_FOLLOWLOCATION);
- REGISTER_CURL_CONSTANT("CURLOPT_FTPASCII", CURLOPT_FTPASCII);
- REGISTER_CURL_CONSTANT("CURLOPT_PUT", CURLOPT_PUT);
- REGISTER_CURL_CONSTANT("CURLOPT_MUTE", CURLOPT_MUTE);
- REGISTER_CURL_CONSTANT("CURLOPT_USERPWD", CURLOPT_USERPWD);
- REGISTER_CURL_CONSTANT("CURLOPT_PROXYUSERPWD", CURLOPT_PROXYUSERPWD);
- REGISTER_CURL_CONSTANT("CURLOPT_RANGE", CURLOPT_RANGE);
- REGISTER_CURL_CONSTANT("CURLOPT_TIMEOUT", CURLOPT_TIMEOUT);
- REGISTER_CURL_CONSTANT("CURLOPT_POSTFIELDS", CURLOPT_POSTFIELDS);
- REGISTER_CURL_CONSTANT("CURLOPT_REFERER", CURLOPT_REFERER);
- REGISTER_CURL_CONSTANT("CURLOPT_USERAGENT", CURLOPT_USERAGENT);
- REGISTER_CURL_CONSTANT("CURLOPT_FTPPORT", CURLOPT_FTPPORT);
- REGISTER_CURL_CONSTANT("CURLOPT_LOW_SPEED_LIMIT", CURLOPT_LOW_SPEED_LIMIT);
- REGISTER_CURL_CONSTANT("CURLOPT_LOW_SPEED_TIME", CURLOPT_LOW_SPEED_TIME);
- REGISTER_CURL_CONSTANT("CURLOPT_RESUME_FROM", CURLOPT_RESUME_FROM);
- REGISTER_CURL_CONSTANT("CURLOPT_COOKIE", CURLOPT_COOKIE);
- REGISTER_CURL_CONSTANT("CURLOPT_SSLCERT", CURLOPT_SSLCERT);
- REGISTER_CURL_CONSTANT("CURLOPT_SSLCERTPASSWD", CURLOPT_SSLCERTPASSWD);
- REGISTER_CURL_CONSTANT("CURLOPT_WRITEHEADER", CURLOPT_WRITEHEADER);
- REGISTER_CURL_CONSTANT("CURLOPT_COOKIEFILE", CURLOPT_COOKIEFILE);
- REGISTER_CURL_CONSTANT("CURLOPT_SSLVERSION", CURLOPT_SSLVERSION);
- REGISTER_CURL_CONSTANT("CURLOPT_TIMECONDITION", CURLOPT_TIMECONDITION);
- REGISTER_CURL_CONSTANT("CURLOPT_TIMEVALUE", CURLOPT_TIMEVALUE);
- REGISTER_CURL_CONSTANT("CURLOPT_CUSTOMREQUEST", CURLOPT_CUSTOMREQUEST);
- REGISTER_CURL_CONSTANT("CURLOPT_STDERR", CURLOPT_STDERR);
- REGISTER_CURL_CONSTANT("CURLOPT_TRANSFERTEXT", CURLOPT_TRANSFERTEXT);
- REGISTER_CURL_CONSTANT("CURLOPT_RETURNTRANSFER", CURLOPT_RETURNTRANSFER);
- REGISTER_CURL_CONSTANT("CURLOPT_QUOTE", CURLOPT_QUOTE);
- REGISTER_CURL_CONSTANT("CURLOPT_POSTQUOTE", CURLOPT_POSTQUOTE);
- REGISTER_CURL_CONSTANT("CURLOPT_INTERFACE", CURLOPT_INTERFACE);
- REGISTER_CURL_CONSTANT("CURLOPT_KRB4LEVEL", CURLOPT_KRB4LEVEL);
- REGISTER_CURL_CONSTANT("CURLOPT_HTTPPROXYTUNNEL", CURLOPT_HTTPPROXYTUNNEL);
- REGISTER_CURL_CONSTANT("CURLOPT_FILETIME", CURLOPT_FILETIME);
- REGISTER_CURL_CONSTANT("CURLOPT_WRITEFUNCTION", CURLOPT_WRITEFUNCTION);
- REGISTER_CURL_CONSTANT("CURLOPT_READFUNCTION", CURLOPT_READFUNCTION);
- REGISTER_CURL_CONSTANT("CURLOPT_PASSWDFUNCTION", CURLOPT_PASSWDFUNCTION);
- REGISTER_CURL_CONSTANT("CURLOPT_HEADERFUNCTION", CURLOPT_HEADERFUNCTION);
- REGISTER_CURL_CONSTANT("CURLOPT_MAXREDIRS", CURLOPT_MAXREDIRS);
- REGISTER_CURL_CONSTANT("CURLOPT_MAXCONNECTS", CURLOPT_MAXCONNECTS);
- REGISTER_CURL_CONSTANT("CURLOPT_CLOSEPOLICY", CURLOPT_CLOSEPOLICY);
- REGISTER_CURL_CONSTANT("CURLOPT_FRESH_CONNECT", CURLOPT_FRESH_CONNECT);
- REGISTER_CURL_CONSTANT("CURLOPT_FORBID_REUSE", CURLOPT_FORBID_REUSE);
- REGISTER_CURL_CONSTANT("CURLOPT_RANDOM_FILE", CURLOPT_RANDOM_FILE);
- REGISTER_CURL_CONSTANT("CURLOPT_EGDSOCKET", CURLOPT_EGDSOCKET);
- REGISTER_CURL_CONSTANT("CURLOPT_CONNECTTIMEOUT", CURLOPT_CONNECTTIMEOUT);
- REGISTER_CURL_CONSTANT("CURLOPT_SSL_VERIFYPEER", CURLOPT_SSL_VERIFYPEER);
- REGISTER_CURL_CONSTANT("CURLOPT_CAINFO", CURLOPT_CAINFO);
- REGISTER_CURL_CONSTANT("CURLOPT_BINARYTRANSER", CURLOPT_BINARYTRANSFER);
-
- /* Constants effecting the way CURLOPT_CLOSEPOLICY works */
- REGISTER_CURL_CONSTANT("CURLCLOSEPOLICY_LEAST_RECENTLY_USED", CURLCLOSEPOLICY_LEAST_RECENTLY_USED);
- REGISTER_CURL_CONSTANT("CURLCLOSEPOLICY_OLDEST", CURLCLOSEPOLICY_OLDEST);
-
- /* Info constants */
- REGISTER_CURL_CONSTANT("CURLINFO_EFFECTIVE_URL", CURLINFO_EFFECTIVE_URL);
- REGISTER_CURL_CONSTANT("CURLINFO_HTTP_CODE", CURLINFO_HTTP_CODE);
- REGISTER_CURL_CONSTANT("CURLINFO_HEADER_SIZE", CURLINFO_HEADER_SIZE);
- REGISTER_CURL_CONSTANT("CURLINFO_REQUEST_SIZE", CURLINFO_REQUEST_SIZE);
- REGISTER_CURL_CONSTANT("CURLINFO_TOTAL_TIME", CURLINFO_TOTAL_TIME);
- REGISTER_CURL_CONSTANT("CURLINFO_NAMELOOKUP_TIME", CURLINFO_NAMELOOKUP_TIME);
- REGISTER_CURL_CONSTANT("CURLINFO_CONNECT_TIME", CURLINFO_CONNECT_TIME);
- REGISTER_CURL_CONSTANT("CURLINFO_PRETRANSFER_TIME", CURLINFO_PRETRANSFER_TIME);
- REGISTER_CURL_CONSTANT("CURLINFO_SIZE_UPLOAD", CURLINFO_SIZE_UPLOAD);
- REGISTER_CURL_CONSTANT("CURLINFO_SIZE_DOWNLOAD", CURLINFO_SIZE_DOWNLOAD);
- REGISTER_CURL_CONSTANT("CURLINFO_SPEED_DOWNLOAD", CURLINFO_SPEED_DOWNLOAD);
- REGISTER_CURL_CONSTANT("CURLINFO_SPEED_UPLOAD", CURLINFO_SPEED_UPLOAD);
- REGISTER_CURL_CONSTANT("CURLINFO_FILETIME", CURLINFO_FILETIME);
-
- /* Error Constants */
- REGISTER_CURL_CONSTANT("CURLE_OK", CURLE_OK);
- REGISTER_CURL_CONSTANT("CURLE_UNSUPPORTED_PROTOCOL", CURLE_UNSUPPORTED_PROTOCOL);
- REGISTER_CURL_CONSTANT("CURLE_FAILED_INIT", CURLE_FAILED_INIT);
- REGISTER_CURL_CONSTANT("CURLE_URL_MALFORMAT", CURLE_URL_MALFORMAT);
- REGISTER_CURL_CONSTANT("CURLE_URL_MALFORMAT_USER", CURLE_URL_MALFORMAT_USER);
- REGISTER_CURL_CONSTANT("CURLE_COULDNT_RESOLVE_PROXY", CURLE_COULDNT_RESOLVE_PROXY);
- REGISTER_CURL_CONSTANT("CURLE_COULDNT_RESOLVE_HOST", CURLE_COULDNT_RESOLVE_HOST);
- REGISTER_CURL_CONSTANT("CURLE_COULDNT_CONNECT", CURLE_COULDNT_CONNECT);
- REGISTER_CURL_CONSTANT("CURLE_FTP_WEIRD_SERVER_REPLY", CURLE_FTP_WEIRD_SERVER_REPLY);
- REGISTER_CURL_CONSTANT("CURLE_FTP_ACCESS_DENIED", CURLE_FTP_ACCESS_DENIED);
- REGISTER_CURL_CONSTANT("CURLE_FTP_USER_PASSWORD_INCORRECT", CURLE_FTP_USER_PASSWORD_INCORRECT);
- REGISTER_CURL_CONSTANT("CURLE_FTP_WEIRD_PASS_REPLY", CURLE_FTP_WEIRD_PASS_REPLY);
- REGISTER_CURL_CONSTANT("CURLE_FTP_WEIRD_USER_REPLY", CURLE_FTP_WEIRD_USER_REPLY);
- REGISTER_CURL_CONSTANT("CURLE_FTP_WEIRD_PASV_REPLY", CURLE_FTP_WEIRD_PASV_REPLY);
- REGISTER_CURL_CONSTANT("CURLE_FTP_WEIRD_227_FORMAT", CURLE_FTP_WEIRD_227_FORMAT);
- REGISTER_CURL_CONSTANT("CURLE_FTP_CANT_GET_HOST", CURLE_FTP_CANT_GET_HOST);
- REGISTER_CURL_CONSTANT("CURLE_FTP_CANT_RECONNECT", CURLE_FTP_CANT_RECONNECT);
- REGISTER_CURL_CONSTANT("CURLE_FTP_COULDNT_SET_BINARY", CURLE_FTP_COULDNT_SET_BINARY);
- REGISTER_CURL_CONSTANT("CURLE_PARTIAL_FILE", CURLE_PARTIAL_FILE);
- REGISTER_CURL_CONSTANT("CURLE_FTP_COULDNT_RETR_FILE", CURLE_FTP_COULDNT_RETR_FILE);
- REGISTER_CURL_CONSTANT("CURLE_FTP_WRITE_ERROR", CURLE_FTP_WRITE_ERROR);
- REGISTER_CURL_CONSTANT("CURLE_FTP_QUOTE_ERROR", CURLE_FTP_QUOTE_ERROR);
- REGISTER_CURL_CONSTANT("CURLE_HTTP_NOT_FOUND", CURLE_HTTP_NOT_FOUND);
- REGISTER_CURL_CONSTANT("CURLE_WRITE_ERROR", CURLE_WRITE_ERROR);
- REGISTER_CURL_CONSTANT("CURLE_MALFORMAT_USER", CURLE_MALFORMAT_USER);
- REGISTER_CURL_CONSTANT("CURLE_FTP_COULDNT_STOR_FILE", CURLE_FTP_COULDNT_STOR_FILE);
- REGISTER_CURL_CONSTANT("CURLE_READ_ERROR", CURLE_READ_ERROR);
- REGISTER_CURL_CONSTANT("CURLE_OUT_OF_MEMORY", CURLE_OUT_OF_MEMORY);
- REGISTER_CURL_CONSTANT("CURLE_OPERATION_TIMEOUTED", CURLE_OPERATION_TIMEOUTED);
- REGISTER_CURL_CONSTANT("CURLE_FTP_COULDNT_SET_ASCII", CURLE_FTP_COULDNT_SET_ASCII);
- REGISTER_CURL_CONSTANT("CURLE_FTP_PORT_FAILED", CURLE_FTP_PORT_FAILED);
- REGISTER_CURL_CONSTANT("CURLE_FTP_COULDNT_USE_REST", CURLE_FTP_COULDNT_USE_REST);
- REGISTER_CURL_CONSTANT("CURLE_FTP_COULDNT_GET_SIZE", CURLE_FTP_COULDNT_GET_SIZE);
- REGISTER_CURL_CONSTANT("CURLE_HTTP_RANGE_ERROR", CURLE_HTTP_RANGE_ERROR);
- REGISTER_CURL_CONSTANT("CURLE_HTTP_POST_ERROR", CURLE_HTTP_POST_ERROR);
- REGISTER_CURL_CONSTANT("CURLE_SSL_CONNECT_ERROR", CURLE_SSL_CONNECT_ERROR);
- REGISTER_CURL_CONSTANT("CURLE_FTP_BAD_DOWNLOAD_RESUME", CURLE_FTP_BAD_DOWNLOAD_RESUME);
- REGISTER_CURL_CONSTANT("CURLE_FILE_COULDNT_READ_FILE", CURLE_FILE_COULDNT_READ_FILE);
- REGISTER_CURL_CONSTANT("CURLE_LDAP_CANNOT_BIND", CURLE_LDAP_CANNOT_BIND);
- REGISTER_CURL_CONSTANT("CURLE_LDAP_SEARCH_FAILED", CURLE_LDAP_SEARCH_FAILED);
- REGISTER_CURL_CONSTANT("CURLE_LIBRARY_NOT_FOUND", CURLE_LIBRARY_NOT_FOUND);
- REGISTER_CURL_CONSTANT("CURLE_FUNCTION_NOT_FOUND", CURLE_FUNCTION_NOT_FOUND);
- REGISTER_CURL_CONSTANT("CURLE_ABORTED_BY_CALLBACK", CURLE_ABORTED_BY_CALLBACK);
- REGISTER_CURL_CONSTANT("CURLE_BAD_FUNCTION_ARGUMENT", CURLE_BAD_FUNCTION_ARGUMENT);
- REGISTER_CURL_CONSTANT("CURLE_BAD_CALLING_ORDER", CURLE_BAD_CALLING_ORDER);
- REGISTER_CURL_CONSTANT("CURLE_HTTP_PORT_FAILED", CURLE_HTTP_PORT_FAILED);
- REGISTER_CURL_CONSTANT("CURLE_BAD_PASSWORD_ENTERED", CURLE_BAD_PASSWORD_ENTERED);
- REGISTER_CURL_CONSTANT("CURLE_TOO_MANY_REDIRECTS", CURLE_TOO_MANY_REDIRECTS);
- REGISTER_CURL_CONSTANT("CURLE_UNKOWN_TELNET_OPTION", CURLE_UNKNOWN_TELNET_OPTION);
- REGISTER_CURL_CONSTANT("CURLE_TELNET_OPTION_SYNTAX", CURLE_TELNET_OPTION_SYNTAX);
- REGISTER_CURL_CONSTANT("CURLE_ALREADY_COMPLETE", CURLE_ALREADY_COMPLETE);
-
- return SUCCESS;
-}
-/* }}} */
-
-#define PHP_CURL_STDOUT 0
-#define PHP_CURL_FILE 1
-#define PHP_CURL_USER 2
-#define PHP_CURL_DIRECT 3
-#define PHP_CURL_RETURN 4
-#define PHP_CURL_ASCII 5
-#define PHP_CURL_BINARY 6
-
-/* {{{ curl_write
- */
-static size_t curl_write(char *data, size_t size, size_t nmemb, void *ctx)
-{
- php_curl *ch = (php_curl *) ctx;
- php_curl_write *t = ch->handlers->write;
- size_t length = size * nmemb;
- ELS_FETCH();
-
- switch (t->method) {
- case PHP_CURL_STDOUT:
- PUTS(data);
- break;
- case PHP_CURL_FILE:
- return fwrite(data, size, nmemb, t->fp);
- case PHP_CURL_RETURN:
- smart_str_appendl(&t->buf, data, (int) length);
- break;
- case PHP_CURL_USER: {
- zval *argv[2];
- zval *retval;
- int error;
- ELS_FETCH();
-
- MAKE_STD_ZVAL(argv[0]);
- MAKE_STD_ZVAL(argv[1]);
- MAKE_STD_ZVAL(retval);
-
- ZVAL_RESOURCE(argv[0], ch->id);
- zend_list_addref(ch->id);
- ZVAL_STRINGL(argv[1], data, (int) length, 1);
-
- error = call_user_function(EG(function_table),
- NULL,
- t->func,
- retval, 2, argv);
- if (error == FAILURE) {
- php_error(E_WARNING, "Cannot call the CURLOPT_WRITEFUNCTION");
- return -1;
- }
-
- length = Z_LVAL_P(retval);
-
- zval_ptr_dtor(&argv[0]);
- zval_ptr_dtor(&argv[1]);
- zval_ptr_dtor(&retval);
-
- break;
- }
- }
-
- return length;
-}
-/* }}} */
-
-/* {{{ curl_read
- */
-static size_t curl_read(char *data, size_t size, size_t nmemb, void *ctx)
-{
- php_curl *ch = (php_curl *) ctx;
- php_curl_read *t = ch->handlers->read;
- int length = -1;
- ELS_FETCH();
-
- switch (t->method) {
- case PHP_CURL_DIRECT:
- length = fread(data, size, nmemb, t->fp);
- case PHP_CURL_USER: {
- zval *argv[3];
- zval *retval;
- int length;
- int error;
-
- MAKE_STD_ZVAL(argv[0]);
- MAKE_STD_ZVAL(argv[1]);
- MAKE_STD_ZVAL(argv[2]);
- MAKE_STD_ZVAL(retval);
-
- ZVAL_RESOURCE(argv[0], ch->id);
- zend_list_addref(ch->id);
- ZVAL_RESOURCE(argv[1], t->fd);
- zend_list_addref(t->fd);
- ZVAL_LONG(argv[2], size * nmemb);
-
- error = call_user_function(EG(function_table),
- NULL,
- t->func,
- retval, 3, argv);
- if (error == FAILURE) {
- php_error(E_WARNING, "Cannot call the CURLOPT_READFUNCTION");
- break;
- }
-
- memcpy(data, Z_STRVAL_P(retval), Z_STRLEN_P(retval));
- length = Z_STRLEN_P(retval);
-
- zval_ptr_dtor(&argv[0]);
- zval_ptr_dtor(&argv[1]);
- zval_ptr_dtor(&argv[2]);
- zval_ptr_dtor(&retval);
-
- break;
- }
- }
-
- return length;
-}
-/* }}} */
-
-/* {{{ _php_curl_write_header
- */
-static size_t _php_curl_write_header(char *data, size_t size, size_t nmemb, void *ctx)
-{
- php_curl *ch = (php_curl *) ctx;
- zval *func = ch->handlers->write_header;
- zval *argv[2];
- zval *retval;
- int error;
- int length;
- ELS_FETCH();
-
- MAKE_STD_ZVAL(argv[0]);
- MAKE_STD_ZVAL(argv[1]);
- MAKE_STD_ZVAL(retval);
-
- ZVAL_RESOURCE(argv[0], ch->id);
- zend_list_addref(ch->id);
- ZVAL_STRINGL(argv[0], data, size * nmemb, 1);
-
- error = call_user_function(EG(function_table),
- NULL,
- func,
- retval, 2, argv);
- if (error == FAILURE) {
- php_error(E_WARNING, "Couldn't call the CURLOPT_HEADERFUNCTION");
- return -1;
- }
-
- length = Z_LVAL_P(retval);
-
- zval_ptr_dtor(&argv[0]);
- zval_ptr_dtor(&argv[1]);
- zval_ptr_dtor(&retval);
-
- return length;
-}
-/* }}} */
-
-/* {{{ _php_curl_passwd
- */
-static size_t _php_curl_passwd(void *ctx, char *prompt, char *buf, int buflen)
-{
- php_curl *ch = (php_curl *) ctx;
- zval *func = ch->handlers->passwd;
- zval *argv[3];
- zval *retval;
- int error;
- ELS_FETCH();
-
- MAKE_STD_ZVAL(argv[0]);
- MAKE_STD_ZVAL(argv[1]);
- MAKE_STD_ZVAL(argv[2]);
-
- ZVAL_RESOURCE(argv[0], ch->id);
- zend_list_addref(ch->id);
- ZVAL_STRING(argv[1], prompt, 1);
- ZVAL_LONG(argv[2], buflen);
-
- error = call_user_function(EG(function_table),
- NULL,
- func,
- retval, 2, argv);
- if (error == FAILURE) {
- php_error(E_WARNING, "Couldn't call the CURLOPT_PASSWDFUNCTION");
- return -1;
- }
-
- if (Z_STRLEN_P(retval) > buflen) {
- php_error(E_WARNING, "Returned password is too long for libcurl to handle");
- return -1;
- }
-
- strlcpy(buf, Z_STRVAL_P(retval), buflen);
-
- zval_ptr_dtor(&argv[0]);
- zval_ptr_dtor(&argv[1]);
- zval_ptr_dtor(&argv[2]);
- zval_ptr_dtor(&retval);
-
- return 0;
-}
-/* }}} */
-
-/* {{{ curl_free_string
- */
-static void curl_free_string(void **string)
-{
- efree(*string);
-}
-/* }}} */
-
-/* {{{ curl_free_post
- */
-static void curl_free_post(void **post)
-{
- curl_formfree((struct HttpPost *) *post);
-}
-/* }}} */
-
-/* {{{ curl_free_slist
- */
-static void curl_free_slist(void **slist)
-{
- curl_slist_free_all((struct curl_slist *) *slist);
-}
-/* }}} */
-
-/* {{{ proto string curl_version(void)
- Return the CURL version string. */
-PHP_FUNCTION(curl_version)
-{
- RETURN_STRING(curl_version(), 1);
-}
-/* }}} */
-
-/* {{{ alloc_curl_handle
- */
-static void alloc_curl_handle(php_curl **ch)
-{
- *ch = emalloc(sizeof(php_curl));
- (*ch)->handlers = ecalloc(1, sizeof(php_curl_handlers));
- (*ch)->handlers->write = ecalloc(1, sizeof(php_curl_write));
- (*ch)->handlers->read = ecalloc(1, sizeof(php_curl_read));
-
- zend_llist_init(&(*ch)->to_free.str, sizeof(char *),
- (void(*)(void *)) curl_free_string, 0);
- zend_llist_init(&(*ch)->to_free.slist, sizeof(struct curl_slist),
- (void(*)(void *)) curl_free_slist, 0);
- zend_llist_init(&(*ch)->to_free.post, sizeof(struct HttpPost),
- (void(*)(void *)) curl_free_post, 0);
-}
-/* }}} */
-
-/* {{{ proto int curl_init([string url])
- Initialize a CURL session */
-PHP_FUNCTION(curl_init)
-{
- zval **url;
- php_curl *ch;
- int argc = ZEND_NUM_ARGS();
-
- if (argc < 0 || argc > 1 ||
- zend_get_parameters_ex(argc, &url) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- alloc_curl_handle(&ch);
-
- ch->cp = curl_easy_init();
- if (! ch->cp) {
- php_error(E_WARNING, "Cannot initialize a new cURL handle");
- RETURN_FALSE;
- }
-
- ch->handlers->write->method = PHP_CURL_STDOUT;
- ch->handlers->write->type = PHP_CURL_ASCII;
- ch->handlers->read->method = PHP_CURL_DIRECT;
-
- curl_easy_setopt(ch->cp, CURLOPT_NOPROGRESS, 1);
- curl_easy_setopt(ch->cp, CURLOPT_VERBOSE, 0);
- curl_easy_setopt(ch->cp, CURLOPT_ERRORBUFFER, ch->err.str);
- curl_easy_setopt(ch->cp, CURLOPT_WRITEFUNCTION, curl_write);
- curl_easy_setopt(ch->cp, CURLOPT_FILE, (void *) ch);
- curl_easy_setopt(ch->cp, CURLOPT_READFUNCTION, curl_read);
- curl_easy_setopt(ch->cp, CURLOPT_INFILE, (void *) ch);
- if (argc > 0) {
- char *urlcopy;
- convert_to_string_ex(url);
-
- urlcopy = estrndup(Z_STRVAL_PP(url), Z_STRLEN_PP(url));
- curl_easy_setopt(ch->cp, CURLOPT_URL, urlcopy);
- zend_llist_add_element(&ch->to_free.str, &urlcopy);
- }
-
- ZEND_REGISTER_RESOURCE(return_value, ch, le_curl);
- ch->id = Z_LVAL_P(return_value);
-}
-/* }}} */
-
-/* {{{ proto bool curl_setopt(int ch, string option, mixed value)
- Set an option for a CURL transfer */
-PHP_FUNCTION(curl_setopt)
-{
- zval **zid,
- **zoption,
- **zvalue;
- php_curl *ch;
- CURLcode error;
- int option;
-
- if (ZEND_NUM_ARGS() != 3 ||
- zend_get_parameters_ex(3, &zid, &zoption, &zvalue) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- ZEND_FETCH_RESOURCE(ch, php_curl *, zid, -1, le_curl_name, le_curl);
- convert_to_long_ex(zoption);
-
- option = Z_LVAL_PP(zoption);
- switch (option) {
- case CURLOPT_INFILESIZE:
- case CURLOPT_VERBOSE:
- case CURLOPT_HEADER:
- case CURLOPT_NOPROGRESS:
- case CURLOPT_NOBODY:
- case CURLOPT_FAILONERROR:
- case CURLOPT_UPLOAD:
- case CURLOPT_POST:
- case CURLOPT_FTPLISTONLY:
- case CURLOPT_FTPAPPEND:
- case CURLOPT_NETRC:
- case CURLOPT_FOLLOWLOCATION:
- case CURLOPT_PUT:
- case CURLOPT_MUTE:
- case CURLOPT_TIMEOUT:
- case CURLOPT_LOW_SPEED_LIMIT:
- case CURLOPT_SSLVERSION:
- case CURLOPT_LOW_SPEED_TIME:
- case CURLOPT_RESUME_FROM:
- case CURLOPT_TIMEVALUE:
- case CURLOPT_TIMECONDITION:
- case CURLOPT_TRANSFERTEXT:
- case CURLOPT_HTTPPROXYTUNNEL:
- case CURLOPT_FILETIME:
- case CURLOPT_MAXREDIRS:
- case CURLOPT_MAXCONNECTS:
- case CURLOPT_CLOSEPOLICY:
- case CURLOPT_FRESH_CONNECT:
- case CURLOPT_FORBID_REUSE:
- case CURLOPT_CONNECTTIMEOUT:
- case CURLOPT_SSL_VERIFYPEER:
- convert_to_long_ex(zvalue);
- error = curl_easy_setopt(ch->cp, option, Z_LVAL_PP(zvalue));
- break;
- case CURLOPT_URL:
- case CURLOPT_PROXY:
- case CURLOPT_USERPWD:
- case CURLOPT_PROXYUSERPWD:
- case CURLOPT_RANGE:
- case CURLOPT_CUSTOMREQUEST:
- case CURLOPT_USERAGENT:
- case CURLOPT_FTPPORT:
- case CURLOPT_COOKIE:
- case CURLOPT_SSLCERT:
- case CURLOPT_SSLCERTPASSWD:
- case CURLOPT_COOKIEFILE:
- case CURLOPT_REFERER:
- case CURLOPT_INTERFACE:
- case CURLOPT_KRB4LEVEL:
- case CURLOPT_RANDOM_FILE:
- case CURLOPT_EGDSOCKET:
- case CURLOPT_CAINFO: {
- char *copystr = NULL;
-
- convert_to_string_ex(zvalue);
- copystr = estrndup(Z_STRVAL_PP(zvalue), Z_STRLEN_PP(zvalue));
-
- error = curl_easy_setopt(ch->cp, option, copystr);
- zend_llist_add_element(&ch->to_free.str, &copystr);
-
- break;
- }
- case CURLOPT_FILE:
- case CURLOPT_INFILE:
- case CURLOPT_WRITEHEADER:
- case CURLOPT_STDERR: {
- FILE *fp;
- ZEND_FETCH_RESOURCE(fp, FILE *, zvalue, -1, "File-Handle", php_file_le_fopen());
-
- if (option == CURLOPT_FILE) {
- ch->handlers->write->fp = fp;
- ch->handlers->write->method = PHP_CURL_FILE;
- }
- else if (option == CURLOPT_INFILE) {
- zend_list_addref(Z_LVAL_PP(zvalue));
- ch->handlers->read->fp = fp;
- ch->handlers->read->fd = Z_LVAL_PP(zvalue);
- }
- else {
- error = curl_easy_setopt(ch->cp, option, fp);
- }
-
- break;
- }
- case CURLOPT_RETURNTRANSFER:
- convert_to_long_ex(zvalue);
-
- if (Z_LVAL_PP(zvalue)) {
- ch->handlers->write->method = PHP_CURL_RETURN;
- }
- break;
- case CURLOPT_BINARYTRANSFER:
- convert_to_long_ex(zvalue);
-
- ch->handlers->write->type = PHP_CURL_BINARY;
- case CURLOPT_WRITEFUNCTION:
- zval_add_ref(zvalue);
- ch->handlers->write->func = *zvalue;
- ch->handlers->write->method = PHP_CURL_USER;
- break;
- case CURLOPT_READFUNCTION:
- zval_add_ref(zvalue);
- ch->handlers->read->func = *zvalue;
- ch->handlers->read->method = PHP_CURL_USER;
- break;
- case CURLOPT_HEADERFUNCTION:
- zval_add_ref(zvalue);
- ch->handlers->write_header = *zvalue;
- error = curl_easy_setopt(ch->cp, CURLOPT_HEADERFUNCTION, _php_curl_write_header);
- error = curl_easy_setopt(ch->cp, CURLOPT_WRITEHEADER, (void *) ch);
- break;
- case CURLOPT_PASSWDFUNCTION:
- zval_add_ref(zvalue);
- ch->handlers->passwd = *zvalue;
- error = curl_easy_setopt(ch->cp, CURLOPT_PASSWDFUNCTION, _php_curl_passwd);
- error = curl_easy_setopt(ch->cp, CURLOPT_PASSWDDATA, (void *) ch);
- break;
- case CURLOPT_POSTFIELDS:
- if (Z_TYPE_PP(zvalue) == IS_ARRAY || Z_TYPE_PP(zvalue) == IS_OBJECT) {
- zval **current;
- HashTable *postfields;
- struct HttpPost *first = NULL;
- struct HttpPost *last = NULL;
-
- postfields = HASH_OF(*zvalue);
- if (! postfields) {
- php_error(E_WARNING, "Couldn't get HashTable in CURLOPT_POSTFIELDS");
- RETURN_FALSE;
- }
-
- for (zend_hash_internal_pointer_reset(postfields);
- zend_hash_get_current_data(postfields, (void **) &current) == SUCCESS;
- zend_hash_move_forward(postfields)) {
- char *string_key = NULL;
- char *postval = NULL;
- ulong num_key;
-
- SEPARATE_ZVAL(current);
- convert_to_string_ex(current);
-
- zend_hash_get_current_key(postfields, &string_key, &num_key, 0);
-
- postval = emalloc(strlen(string_key) + Z_STRLEN_PP(current) + 1);
- sprintf(postval, "%s=%s", string_key, Z_STRVAL_PP(current));
-
- error = curl_formparse(postval, &first, &last);
- }
-
- if (error != CURLE_OK) {
- SAVE_CURL_ERROR(ch, error);
- RETURN_FALSE;
- }
-
- zend_llist_add_element(&ch->to_free.post, &first);
- error = curl_easy_setopt(ch->cp, CURLOPT_HTTPPOST, first);
- }
- else {
- char *post = NULL;
-
- convert_to_string_ex(zvalue);
- post = estrndup(Z_STRVAL_PP(zvalue), Z_STRLEN_PP(zvalue));
- zend_llist_add_element(&ch->to_free.str, &post);
-
- error = curl_easy_setopt(ch->cp, CURLOPT_POSTFIELDS, post);
- error = curl_easy_setopt(ch->cp, CURLOPT_POSTFIELDSIZE, Z_STRLEN_PP(zvalue));
- }
-
- break;
- case CURLOPT_HTTPHEADER:
- case CURLOPT_QUOTE:
- case CURLOPT_POSTQUOTE: {
- zval **current;
- HashTable *hash;
- struct curl_slist *slist = NULL;
-
- hash = HASH_OF(*zvalue);
- if (! hash) {
- php_error(E_WARNING,
- "You must pass either an object or an array with the CURLOPT_HTTPHEADER, CURLOPT_QUOTE and CURLOPT_POSTQUOTE arguments");
- RETURN_FALSE;
- }
-
- for (zend_hash_internal_pointer_reset(hash);
- zend_hash_get_current_data(hash, (void **) &current) == SUCCESS;
- zend_hash_move_forward(hash)) {
- char *indiv = NULL;
-
- SEPARATE_ZVAL(current);
- convert_to_string_ex(current);
-
- indiv = estrndup(Z_STRVAL_PP(current), Z_STRLEN_PP(current) + 1);
- indiv[Z_STRLEN_PP(current)] = '\0';
- slist = curl_slist_append(slist, indiv);
- if (! slist) {
- efree(indiv);
- php_error(E_WARNING, "Couldn't build curl_slist from curl_setopt()");
- RETURN_FALSE;
- }
- zend_llist_add_element(&ch->to_free.str, &indiv);
- }
- zend_llist_add_element(&ch->to_free.slist, &slist);
-
- error = curl_easy_setopt(ch->cp, option, slist);
-
- break;
- }
- }
-
- if (error != CURLE_OK) {
- SAVE_CURL_ERROR(ch, error);
- RETURN_FALSE;
- } else {
- RETURN_TRUE;
- }
-}
-/* }}} */
-
-/* {{{ proto bool curl_exec(int ch)
- Perform a CURL session */
-PHP_FUNCTION(curl_exec)
-{
- zval **zid;
- php_curl *ch;
- CURLcode error;
-
- if (ZEND_NUM_ARGS() != 1 ||
- zend_get_parameters_ex(1, &zid) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- ZEND_FETCH_RESOURCE(ch, php_curl *, zid, -1, le_curl_name, le_curl);
-
- error = curl_easy_perform(ch->cp);
- if (error != CURLE_OK) {
- SAVE_CURL_ERROR(ch, error);
- RETURN_FALSE;
- }
-
- if (ch->handlers->write->method == PHP_CURL_RETURN) {
- if (ch->handlers->write->type != PHP_CURL_BINARY)
- smart_str_0(&ch->handlers->write->buf);
- RETURN_STRINGL(ch->handlers->write->buf.c, ch->handlers->write->buf.len, 1);
- smart_str_free(&ch->handlers->write->buf);
- }
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto string curl_getinfo(int ch, int opt)
- Get information regarding a specific transfer */
-PHP_FUNCTION(curl_getinfo)
-{
- zval **zid,
- **zoption;
- php_curl *ch;
- int option,
- argc = ZEND_NUM_ARGS();
-
- if (argc < 1 || argc > 2 ||
- zend_get_parameters_ex(argc, &zid, &zoption) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- ZEND_FETCH_RESOURCE(ch, php_curl *, zid, -1, le_curl_name, le_curl);
-
- if (argc < 2) {
- char *url;
- long l_code;
- double d_code;
-
- array_init(return_value);
-
- curl_easy_getinfo(ch->cp, CURLINFO_EFFECTIVE_URL, &url);
- add_assoc_string(return_value, "url", url, 1);
- curl_easy_getinfo(ch->cp, CURLINFO_HTTP_CODE, &l_code);
- add_assoc_long(return_value, "http_code", l_code);
- curl_easy_getinfo(ch->cp, CURLINFO_HEADER_SIZE, &l_code);
- add_assoc_long(return_value, "header_size", l_code);
- curl_easy_getinfo(ch->cp, CURLINFO_REQUEST_SIZE, &l_code);
- add_assoc_long(return_value, "request_size", l_code);
- curl_easy_getinfo(ch->cp, CURLINFO_FILETIME, &l_code);
- add_assoc_long(return_value, "filetime", l_code);
- curl_easy_getinfo(ch->cp, CURLINFO_TOTAL_TIME, &d_code);
- add_assoc_double(return_value, "total_time", d_code);
- curl_easy_getinfo(ch->cp, CURLINFO_NAMELOOKUP_TIME, &d_code);
- add_assoc_double(return_value, "namelookup_time", d_code);
- curl_easy_getinfo(ch->cp, CURLINFO_CONNECT_TIME, &d_code);
- add_assoc_double(return_value, "connect_time", d_code);
- curl_easy_getinfo(ch->cp, CURLINFO_PRETRANSFER_TIME, &d_code);
- add_assoc_double(return_value, "pretransfer_time", d_code);
- curl_easy_getinfo(ch->cp, CURLINFO_SIZE_UPLOAD, &d_code);
- add_assoc_double(return_value, "size_upload", d_code);
- curl_easy_getinfo(ch->cp, CURLINFO_SIZE_DOWNLOAD, &d_code);
- add_assoc_double(return_value, "size_download", d_code);
- curl_easy_getinfo(ch->cp, CURLINFO_SPEED_DOWNLOAD, &d_code);
- add_assoc_double(return_value, "speed_download", d_code);
- curl_easy_getinfo(ch->cp, CURLINFO_SPEED_UPLOAD, &d_code);
- add_assoc_double(return_value, "speed_upload", d_code);
- } else {
- option = Z_LVAL_PP(zoption);
- switch (option) {
- case CURLINFO_EFFECTIVE_URL: {
- char *url;
-
- curl_easy_getinfo(ch->cp, option, &url);
- RETURN_STRING(url, 1);
-
- break;
- }
- case CURLINFO_HTTP_CODE:
- case CURLINFO_HEADER_SIZE:
- case CURLINFO_REQUEST_SIZE:
- case CURLINFO_FILETIME: {
- long code;
-
- curl_easy_getinfo(ch->cp, option, &code);
- RETURN_LONG(code);
-
- break;
- }
- case CURLINFO_TOTAL_TIME:
- case CURLINFO_NAMELOOKUP_TIME:
- case CURLINFO_CONNECT_TIME:
- case CURLINFO_PRETRANSFER_TIME:
- case CURLINFO_SIZE_UPLOAD:
- case CURLINFO_SIZE_DOWNLOAD:
- case CURLINFO_SPEED_DOWNLOAD:
- case CURLINFO_SPEED_UPLOAD: {
- double code;
-
- curl_easy_getinfo(ch->cp, option, &code);
- RETURN_DOUBLE(code);
-
- break;
- }
- }
- }
-}
-/* }}} */
-
-/* {{{ proto string curl_error(int ch)
- Return a string contain the last error for the current session */
-PHP_FUNCTION(curl_error)
-{
- zval **zid;
- php_curl *ch;
-
- if (ZEND_NUM_ARGS() != 1 ||
- zend_get_parameters_ex(1, &zid) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- ZEND_FETCH_RESOURCE(ch, php_curl *, zid, -1, le_curl_name, le_curl);
-
- RETURN_STRING(ch->err.str, 1);
-}
-/* }}} */
-
-/* {{{ proto int curl_errno(int ch)
- Return an integer containing the last error number */
-PHP_FUNCTION(curl_errno)
-{
- zval **zid;
- php_curl *ch;
-
- if (ZEND_NUM_ARGS() != 1 ||
- zend_get_parameters_ex(1, &zid) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- ZEND_FETCH_RESOURCE(ch, php_curl *, zid, -1, le_curl_name, le_curl);
-
- RETURN_LONG(ch->err.no);
-}
-/* }}} */
-
-/* {{{ proto void curl_close(int ch)
- Close a CURL session */
-PHP_FUNCTION(curl_close)
-{
- zval **zid;
- php_curl *ch;
-
- if (ZEND_NUM_ARGS() != 1 ||
- zend_get_parameters_ex(1, &zid) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- ZEND_FETCH_RESOURCE(ch, php_curl *, zid, -1, le_curl_name, le_curl);
-
- zend_list_delete(Z_LVAL_PP(zid));
-}
-/* }}} */
-
-/* {{{ _php_curl_close()
- List destructor for curl handles */
-static void _php_curl_close(zend_rsrc_list_entry *rsrc)
-{
- php_curl *ch = (php_curl *) rsrc->ptr;
-
- curl_easy_cleanup(ch->cp);
- zend_llist_clean(&ch->to_free.str);
- zend_llist_clean(&ch->to_free.slist);
- zend_llist_clean(&ch->to_free.post);
-
- if (ch->handlers->write->func) zval_ptr_dtor(&ch->handlers->write->func);
- if (ch->handlers->read->func) zval_ptr_dtor(&ch->handlers->read->func);
- if (ch->handlers->write_header) zval_ptr_dtor(&ch->handlers->write_header);
- if (ch->handlers->passwd) zval_ptr_dtor(&ch->handlers->passwd);
-
- efree(ch->handlers->write);
- efree(ch->handlers->read);
- efree(ch->handlers);
- efree(ch);
-}
-/* }}} */
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/curl/curl.dsp b/ext/curl/curl.dsp
deleted file mode 100644
index f073c64ab8..0000000000
--- a/ext/curl/curl.dsp
+++ /dev/null
@@ -1,177 +0,0 @@
-# Microsoft Developer Studio Project File - Name="curl" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=curl - Win32 Release_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "curl.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "curl.mak" CFG="curl - Win32 Release_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "curl - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "curl - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "curl - Win32 Debug_TS_SSL" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "curl - Win32 Release_TS_SSL" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "curl - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\..\TSRM" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_CURL" /D ZTS=1 /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /I "..\..\main" /D "WIN32" /D "CURL_EXPORTS" /D "COMPILE_DL_CURL" /D ZTS=1 /D HAVE_CURL=1 /D ZEND_DEBUG=0 /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZEND_WIN32" /D "PHP_WIN32" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x406 /d "NDEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib /nologo /dll /machine:I386
-# ADD LINK32 php4ts.lib libcurl.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_curl.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
-# SUBTRACT LINK32 /pdb:none
-
-!ELSEIF "$(CFG)" == "curl - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_CURL" /D ZTS=1 /YX /FD /c
-# ADD CPP /nologo /MDd /W3 /GX /ZI /Od /I "..\.." /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /I "..\..\main" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CURL_EXPORTS" /D "COMPILE_DL_CURL" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_CURL=1 /FR /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x406 /d "NDEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib /nologo /dll /machine:I386
-# ADD LINK32 php4ts_debug.lib libcurl.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib wsock32.lib /nologo /dll /incremental:yes /debug /machine:I386 /out:"..\..\Debug_TS/php_curl.dll" /libpath:"..\..\Debug_TS"
-# SUBTRACT LINK32 /pdb:none
-
-!ELSEIF "$(CFG)" == "curl - Win32 Debug_TS_SSL"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "curl___Win32_Debug_TS_SSL"
-# PROP BASE Intermediate_Dir "curl___Win32_Debug_TS_SSL"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Debug_TS_SSL"
-# PROP Intermediate_Dir "Debug_TS_SSL"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MDd /W3 /GX /ZI /Od /I "..\.." /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /I "..\..\main" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CURL_EXPORTS" /D "COMPILE_DL_CURL" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_CURL=1 /FR /YX /FD /c
-# ADD CPP /nologo /MDd /W3 /GX /ZI /Od /I "..\.." /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /I "..\..\main" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CURL_EXPORTS" /D "COMPILE_DL_CURL" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_CURL=1 /FR /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x406 /d "NDEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 php4ts_debug.lib libcurl.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /incremental:yes /debug /machine:I386 /nodefaultlib:"msvcrtd.lib" /out:"..\..\Debug_TS/php_curl.dll" /libpath:"..\..\Debug_TS"
-# SUBTRACT BASE LINK32 /pdb:none
-# ADD LINK32 php4ts_debug.lib libcurl.lib ssleay32.lib libeay32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib /nologo /dll /incremental:yes /debug /machine:I386 /out:"..\..\Debug_TS/php_curl.dll" /libpath:"..\..\Debug_TS"
-# SUBTRACT LINK32 /pdb:none /nodefaultlib
-
-!ELSEIF "$(CFG)" == "curl - Win32 Release_TS_SSL"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "curl___Win32_Release_TS_SSL"
-# PROP BASE Intermediate_Dir "curl___Win32_Release_TS_SSL"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS_SSL"
-# PROP Intermediate_Dir "Release_TS_SSL"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /I "..\..\main" /D "WIN32" /D "CURL_EXPORTS" /D "COMPILE_DL_CURL" /D ZTS=1 /D HAVE_CURL=1 /D ZEND_DEBUG=0 /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZEND_WIN32" /D "PHP_WIN32" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /I "..\..\main" /D "WIN32" /D "CURL_EXPORTS" /D "COMPILE_DL_CURL" /D ZTS=1 /D HAVE_CURL=1 /D ZEND_DEBUG=0 /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZEND_WIN32" /D "PHP_WIN32" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x406 /d "NDEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 php4ts.lib libcurl.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /nodefaultlib:"msvcrt.lib" /out:"..\..\Release_TS/php_curl.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
-# SUBTRACT BASE LINK32 /pdb:none
-# ADD LINK32 php4ts.lib libcurl.lib ssleay32.lib libeay32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_curl.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
-# SUBTRACT LINK32 /pdb:none
-
-!ENDIF
-
-# Begin Target
-
-# Name "curl - Win32 Release_TS"
-# Name "curl - Win32 Debug_TS"
-# Name "curl - Win32 Debug_TS_SSL"
-# Name "curl - Win32 Release_TS_SSL"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\curl.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_curl.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/ext/curl/php_curl.h b/ext/curl/php_curl.h
deleted file mode 100644
index b530b92373..0000000000
--- a/ext/curl/php_curl.h
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Sterling Hughes <sterling@php.net> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef _PHP_CURL_H
-#define _PHP_CURL_H
-
-#include "php.h"
-#include "ext/standard/php_smart_str.h"
-
-#ifdef COMPILE_DL_CURL
-#undef HAVE_CURL
-#define HAVE_CURL 1
-#endif
-
-#if HAVE_CURL
-
-#include <curl/curl.h>
-
-
-extern zend_module_entry curl_module_entry;
-#define curl_module_ptr &curl_module_entry
-
-#define CURLOPT_RETURNTRANSFER 19913
-#define CURLOPT_BINARYTRANSFER 19914
-
-PHP_MINIT_FUNCTION(curl);
-PHP_MINFO_FUNCTION(curl);
-PHP_FUNCTION(curl_version);
-PHP_FUNCTION(curl_init);
-PHP_FUNCTION(curl_setopt);
-PHP_FUNCTION(curl_exec);
-PHP_FUNCTION(curl_getinfo);
-PHP_FUNCTION(curl_error);
-PHP_FUNCTION(curl_errno);
-PHP_FUNCTION(curl_close);
-
-typedef struct {
- zval *func;
- FILE *fp;
- smart_str buf;
- int method;
- int type;
-} php_curl_write;
-
-typedef struct {
- zval *func;
- FILE *fp;
- long fd;
- int method;
-} php_curl_read;
-
-typedef struct {
- php_curl_write *write;
- php_curl_read *read;
- zval *write_header;
- zval *passwd;
-} php_curl_handlers;
-
-struct _php_curl_error {
- char str[CURL_ERROR_SIZE + 1];
- int no;
-};
-
-struct _php_curl_free {
- zend_llist str;
- zend_llist post;
- zend_llist slist;
-};
-
-typedef struct {
- CURL *cp;
- php_curl_handlers *handlers;
- struct _php_curl_error err;
- struct _php_curl_free to_free;
- long id;
-} php_curl;
-
-
-#else
-#define curl_module_ptr NULL
-#endif /* HAVE_CURL */
-#define phpext_curl_ptr curl_module_ptr
-#endif /* _PHP_CURL_H */
diff --git a/ext/cybercash/CREDITS b/ext/cybercash/CREDITS
deleted file mode 100644
index d9f4491a66..0000000000
--- a/ext/cybercash/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-CyberCash
-Evan Klinger
diff --git a/ext/cybercash/Makefile.in b/ext/cybercash/Makefile.in
deleted file mode 100644
index 99ab73a904..0000000000
--- a/ext/cybercash/Makefile.in
+++ /dev/null
@@ -1,5 +0,0 @@
-
-LTLIBRARY_NAME = libcybercash.la
-LTLIBRARY_SOURCES = cybercash.c
-
-include $(top_srcdir)/build/dynlib.mk
diff --git a/ext/cybercash/config.m4 b/ext/cybercash/config.m4
deleted file mode 100644
index 09751671cd..0000000000
--- a/ext/cybercash/config.m4
+++ /dev/null
@@ -1,28 +0,0 @@
-dnl config.m4 for extension CyberCash
-dnl don't forget to call PHP_EXTENSION(cybercash)
-
-AC_MSG_CHECKING(for CyberCash support)
-AC_ARG_WITH(cybercash,
-[ --with-cybercash[=DIR] Include CyberCash support. DIR is the CyberCash MCK
- install directory.],
-[
- if test "$withval" != "no"; then
- test -f $withval/mckcrypt.h && MCK_DIR=$withval
- test -f $withval/c-api/mckcrypt.h && MCK_DIR=$withval/c-api
- if test -n "$MCK_DIR"; then
- AC_MSG_RESULT(yes)
- PHP_EXTENSION(cybercash)
- old_LIBS=$LIBS
- LIBS="$LIBS -L$MCK_DIR/lib"
- AC_CHECK_LIB(mckcrypto,base64_encode,[AC_DEFINE(HAVE_MCK,1,[ ])],
- [AC_MSG_ERROR(Please reinstall the CyberCash MCK - cannot find mckcrypto lib)])
- LIBS=$old_LIBS
- PHP_ADD_LIBRARY_WITH_PATH(mckcrypto, $MCK_DIR/lib)
- PHP_ADD_INCLUDE($MCK_DIR)
- else
- AC_MSG_RESULT(no)
- fi
-fi
-],[
- AC_MSG_RESULT(no)
-])
diff --git a/ext/cybercash/cybercash.c b/ext/cybercash/cybercash.c
deleted file mode 100644
index 8ec8392f93..0000000000
--- a/ext/cybercash/cybercash.c
+++ /dev/null
@@ -1,228 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Evan Klinger <evan715@sirius.com> |
- | Timothy Whitfield <timothy@ametro.net> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "ext/standard/info.h"
-#include "cybercash.h"
-
-#if HAVE_MCK
-#include "mckcrypt.h"
-#include "base64.h"
-
-/* {{{ cybercash_functions[]
- */
-function_entry cybercash_functions[] = {
- PHP_FE(cybercash_encr, NULL)
- PHP_FE(cybercash_decr, NULL)
- PHP_FE(cybercash_base64_encode, NULL)
- PHP_FE(cybercash_base64_decode, NULL)
- {NULL, NULL, NULL}
-};
-/* }}} */
-
-/* {{{ cybercash_module_entry
- */
-zend_module_entry cybercash_module_entry = {
- "cybercash",
- cybercash_functions,
- NULL,
- NULL,
- NULL,
- NULL,
- PHP_MINFO(cybercash),
- STANDARD_MODULE_PROPERTIES,
-};
-/* }}} */
-
-#ifdef COMPILE_DL_CYBERCASH
-ZEND_GET_MODULE(cybercash)
-#endif
-
-/* {{{ PHP_MINFO_FUNCTION
- */
-PHP_MINFO_FUNCTION(cybercash)
-{
- php_info_print_table_start();
- php_info_print_table_row(2, "Cybercash Support", "enabled");
- php_info_print_table_end();
-}
-/* }}} */
-
-/* {{{ proto cybercash_encr(string wmk, string sk, string data)
- Cybercash encrypt */
-PHP_FUNCTION(cybercash_encr)
-{
- zval **wmk, **sk, **inbuff;
- unsigned char *outbuff, *macbuff;
- unsigned int outAlloc, outLth;
- long errcode;
-
- if (ZEND_NUM_ARGS() != 3 ||
- zend_get_parameters_ex(3, &wmk, &sk, &inbuff) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(wmk);
- convert_to_string_ex(sk);
- convert_to_string_ex(inbuff);
-
- outAlloc = Z_STRLEN_PP(inbuff) + 10;
-
- outbuff = (unsigned char *)emalloc(sizeof(unsigned char) * outAlloc);
- macbuff = (unsigned char *)emalloc(sizeof(unsigned char) * 20);
-
- errcode = mck_encr(Z_STRVAL_PP(wmk),
- Z_STRVAL_PP(sk),
- Z_STRLEN_PP(inbuff) + 1,
- Z_STRVAL_PP(inbuff),
- outAlloc,
- outbuff,
- &outLth,
- macbuff);
-
- if (array_init(return_value) == FAILURE) {
- php_error(E_WARNING, "Return value from cybercash_encr could not be initialized");
- RETURN_FALSE;
- }
-
- add_assoc_long(return_value, "errcode", errcode);
-
- if (!errcode) {
- add_assoc_stringl(return_value, "outbuff", outbuff, outLth, 0);
- add_assoc_long(return_value,"outLth",outLth);
- add_assoc_stringl(return_value,"macbuff",macbuff,20,0);
- } else {
- efree(outbuff);
- efree(macbuff);
- }
-}
-/* }}} */
-
-/* {{{ proto array cybercash_decr(string wmp, string sk, string data)
- Cybercash decrypt */
-PHP_FUNCTION(cybercash_decr)
-{
- zval **wmk,**sk,**inbuff;
- unsigned char *outbuff, *macbuff;
- unsigned int outAlloc, outLth;
- long errcode;
-
-
- if (ZEND_NUM_ARGS() != 3 ||
- zend_get_parameters_ex(3, &wmk, &sk, &inbuff) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(wmk);
- convert_to_string_ex(sk);
- convert_to_string_ex(inbuff);
-
- outAlloc = Z_STRLEN_PP(inbuff);
-
- outbuff = (unsigned char *)emalloc(sizeof(unsigned char) * outAlloc);
- macbuff = (unsigned char *)emalloc(sizeof(unsigned char) * 20);
-
- errcode = mck_decr(Z_STRVAL_PP(wmk),
- Z_STRVAL_PP(sk),
- Z_STRLEN_PP(inbuff),
- Z_STRVAL_PP(inbuff),
- outAlloc,
- outbuff,
- &outLth,
- macbuff);
-
- if (array_init(return_value) == FAILURE) {
- php_error(E_WARNING, "Could not initialize Return value from cybercash_decr");
- RETURN_FALSE;
- }
-
- add_assoc_long(return_value, "errcode", errcode);
-
- if (!errcode) {
- add_assoc_stringl(return_value, "outbuff", outbuff, outLth, 0);
- add_assoc_long(return_value, "outLth", outLth);
- add_assoc_stringl(return_value, "macbuff", macbuff, 20, 0);
- } else {
- efree(outbuff);
- efree(macbuff);
- }
-}
-/* }}} */
-
-/* {{{ proto string cybercash_base64_encode(string data)
- base64 encode data for cybercash */
-PHP_FUNCTION(cybercash_base64_encode)
-{
- zval **inbuff;
- char *outbuff;
- long ret_length;
-
- if (ZEND_NUM_ARGS() != 1 ||
- zend_get_parameters_ex(1, &inbuff) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(inbuff);
-
- outbuff = (char *)emalloc(base64_enc_size((unsigned int)Z_STRLEN_PP(inbuff)));
-
- ret_length = base64_encode(outbuff,
- Z_STRVAL_PP(inbuff),
- Z_STRLEN_PP(inbuff));
-
- RETURN_STRINGL(outbuff, ret_length, 0);
-}
-/* }}} */
-
-/* {{{ proto string cybercash_base64_decode(string data)
- base64 decode data for cybercash */
-PHP_FUNCTION(cybercash_base64_decode)
-{
- zval **inbuff;
- char *outbuff;
- long ret_length;
-
- if (ZEND_NUM_ARGS() != 1 ||
- zend_get_parameters_ex(1, &inbuff) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(inbuff);
-
- outbuff = (char *)emalloc(base64_dec_size((unsigned int)Z_STRLEN_PP(inbuff)));
-
- ret_length = base64_decode(outbuff, Z_STRVAL_PP(inbuff), Z_STRLEN_PP(inbuff));
-
- RETURN_STRINGL(outbuff, ret_length, 0);
-}
-/* }}} */
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/cybercash/cybercash.dsp b/ext/cybercash/cybercash.dsp
deleted file mode 100644
index 83c47e1913..0000000000
--- a/ext/cybercash/cybercash.dsp
+++ /dev/null
@@ -1,110 +0,0 @@
-# Microsoft Developer Studio Project File - Name="cybercash" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=cybercash - Win32 Release_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "cybercash.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "cybercash.mak" CFG="cybercash - Win32 Release_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "cybercash - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "cybercash - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "cybercash - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\..\Zend" /I "..\..\..\TSRM" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_CYBERCASH" /D ZTS=1 /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\TSRM" /D ZEND_DEBUG=0 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CYBERCASH_EXPORTS" /D "COMPILE_DL_CYBERCASH" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_MCK=1 /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x406 /d "NDEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib cybercashi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib /nologo /dll /machine:I386
-# ADD LINK32 php4ts.lib user32.lib winspool.lib mckcrypto.lib kernel32.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /nodefaultlib:"libcmt.lib" /out:"..\..\Release_TS/php_cybercash.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
-# SUBTRACT LINK32 /pdb:none
-
-!ELSEIF "$(CFG)" == "cybercash - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_CYBERCASH" /D ZTS=1 /YX /FD /c
-# ADD CPP /nologo /MDd /W3 /GX /ZI /Od /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\TSRM" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CYBERCASH_EXPORTS" /D "COMPILE_DL_CYBERCASH" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_MCK=1 /FR /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x406 /d "NDEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib cybercashi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts_debug.lib /nologo /dll /machine:I386
-# ADD LINK32 php4ts_debug.lib user32.lib winspool.lib mckcrypto.lib kernel32.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /incremental:yes /debug /machine:I386 /nodefaultlib:"libcmt.lib" /out:"..\..\Debug_TS/php_cybercash.dll" /libpath:"..\..\Debug_TS"
-
-!ENDIF
-
-# Begin Target
-
-# Name "cybercash - Win32 Release_TS"
-# Name "cybercash - Win32 Debug_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\cybercash.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\cybercash.h
-# End Source File
-# End Group
-# End Target
-# End Project
diff --git a/ext/cybercash/cybercash.h b/ext/cybercash/cybercash.h
deleted file mode 100644
index 29aff249e4..0000000000
--- a/ext/cybercash/cybercash.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Evan Klinger <evan715@sirius.com> |
- +----------------------------------------------------------------------+
- */
-
-#ifndef CYBERCASH_H
-#define CYBERCASH_H
-
-
-#if HAVE_MCK
-
-extern zend_module_entry cybercash_module_entry;
-#define cybercash_module_ptr &cybercash_module_entry
-
-PHP_MINFO_FUNCTION(cybercash);
-PHP_FUNCTION(cybercash_encr);
-PHP_FUNCTION(cybercash_decr);
-PHP_FUNCTION(cybercash_base64_encode);
-PHP_FUNCTION(cybercash_base64_decode);
-
-#else
-#define cybercash_module_ptr NULL
-#endif
-
-#define phpext_cybercash_ptr cybercash_module_ptr
-
-#endif
diff --git a/ext/cybercash/cyberlib.php b/ext/cybercash/cyberlib.php
deleted file mode 100644
index 0b26236392..0000000000
--- a/ext/cybercash/cyberlib.php
+++ /dev/null
@@ -1,215 +0,0 @@
-<?php
-
-/*********************************************************************
- * Cyberlib - (C) American Metrocomm Internet Services *
- * by Timothy Whitfield <timothy@ametro.net> *
- * *
- * PHP Cybercash API - This requires that CyberCash support be *
- * compiled. *
- * *
- * *
- * This is an attempt to duplicate the cybercash API for PHP *
- * users. *
- *********************************************************************
- * This does not require merchant_conf for reasons that any file *
- * can be accessed by the web server can be accessed by any cgi. *
- *********************************************************************
- */
-
- function SendCC2_1Server($merchant,$merchant_key,
- $url,$operation,$CCNVList)
- {
- /* We need to make the url. */
- $url=$url."cr21api.cgi/".$operation;
-
- return SendCCServer($merchant,$merchant_key,$url,$CCNVList);
- }
-
- function SendCCServer($merchant,$merchant_key,$url,$CCNVList)
- {
- /* Break the url into parts. */
- $url=parse_url($url);
-
- /* Turn the name value pairs into a url encoded message. */
- $pairs="";
- $done=0;
- $more=list($key,$val)=each($CCNVList);
- while(!$done)
- {
- $pairs.=chop($key)."=".urlencode(chop($val));
-
- $more=list($key,$val)=each($CCNVList);
- if($more)
- {
- $pairs.="&";
- }
- else
- {
- $done=1;
- }
- }
-
- $encrypted_pairs=CCEncrypt($merchant_key,$pairs);
- $pairs_length=strlen($encrypted_pairs);
-
- $message=sprintf("POST %s/%s HTTP/1.0\r\n",$url["path"],$merchant);
- $message.=sprintf("User-Agent: CCMCK-%s\r\n","3.2.0.5");
- $message.="Content-type: application/x-www-form-urlencoded\r\n";
- $message.=sprintf("Content-length: %d\r\n",$pairs_length);
- $message.="\r\n";
- $message.=$encrypted_pairs."\r\n";
-
-$response=CCSocketSend($merchant_key,$url["host"],isset($url["port"])?$url["port"]:"",$message);
- return $response;
- }
-
- function CCEncrypt($merchant_key,$pairs)
- {
- $session_key=sprintf("%s #%ld",date("D M j H:i:s Y"),getmypid());
- $enc_msg=cybercash_encr($merchant_key,$session_key,$pairs);
- $pairs=cybercash_base64_encode($enc_msg["outbuff"]);
- $mac=cybercash_base64_encode($enc_msg["macbuff"]);
-
- /* This adds the information needed to decrypt. */
- $encrypted_pairs="message=".urlencode($pairs)."&";
- $encrypted_pairs.="session-key=".urlencode($session_key)."&";
- $encrypted_pairs.="mac=".urlencode($mac);
-
-
- return $encrypted_pairs;
- }
-
- function CCSocketSend($merchant_key,$host,$port,$message)
- {
-
- if(!$port)
- {
- $port="80";
- }
-
- /*This opens the port. */
- $fd=fsockopen($host,$port);
-
- /* Minor error checking. */
- if(!$fd)
- {
- $vars["MStatus"]="failure-hard";
- $vars["MErrMsg"]="Error contacting credit processor.";
-
- return $vars;
- }
-
- /*This sends the message. */
- fputs($fd,$message);
-
- /* We read the header in and parse at the same time. */
-
- /* Retrieve header. */
- $i=0;
- $response="";
- while(!feof($fd) && $response != "\n")
- {
- $response="";
- $more="";
- while(!feof($fd) && $more != "\n")
- {
- $more=fgetc($fd);
- if($more != "\n" || $response=="")
- {
- if($more != "\r")
- {
- $response.=$more;
- }
- }
- }
- $header[$i++]=$response;
- }
-
- /* We will now get the message. */
- $message="";
- while(!feof($fd))
- {
- $message.=fgets($fd,50);
- }
-
- /* It should be ok to close the socket now. */
- fclose($fd);
-
- /* This set of variables is encoded/encrypted. */
- $vars=CCGetVars($message);
- $vars["message"]=cybercash_base64_decode($vars["message"]);
- $vars["mac"]=cybercash_base64_decode($vars["mac"]);
-
- /* Check for errors with the request/decryption. */
- /* message is base64 and encrypted. */
- $dec_msg=cybercash_decr($merchant_key,$vars["session-key"],
- $vars["message"]);
-
- if($dec_msg["errcode"])
- {
- $vars["MStatus"]="failure-hard";
- $vars["MErrMsg"]="Response non-decodable.";
- return $vars;
- }
-
- if($dec_msg["macbuff"] != $vars["mac"])
- {
- $vars["MStatus"]="failure-hard";
- $vars["MErrMsg"]="Signitures do not match.";
- return $vars;
- }
-
- /* We will have to parse again to get more info. */
- $vars=CCGetVars($dec_msg["outbuff"]);
-
- return $vars;
- }
-
- function CCGetVars($message)
- {
- /* Retrieve variables.
- This function retrieves variables in var/value key pairs.
- So that $myvar["var"]==value
- */
-
- /* Need to find these variables too. */
- $cx=0;
- $response="";
- $more="";
- $message.="\n";
- $msg_len=strlen($message);
-
- while($cx<=$msg_len)
- {
- $more="";
- $varname="";
- $varval="";
- while($cx<=$msg_len && $more != "&" && $more != "\n")
- {
- $more=substr($message,$cx,1);
- $cx++;
- if($more != "&" && $more != "=" && $more != "\n")
- {
- $response=$response.$more;
- }
- if($more=="=")
- {
- $varname=$response;
- $response="";
- }
- if($more=="&" || $more=="\n")
- {
- $varval=$response;
- $response="";
- }
- }
-
- if($varname != "")
- {
- $cybervar[$varname]=urldecode($varval);
- }
- }
-
- return $cybervar;
- }
-?>
diff --git a/ext/cybercash/test.php b/ext/cybercash/test.php
deleted file mode 100644
index 2e5f3955ee..0000000000
--- a/ext/cybercash/test.php
+++ /dev/null
@@ -1,26 +0,0 @@
-<?php
- require "cyberlib.php";
-
- $merchant=""; /* Your merchant ID goes here. */
- $merchant_key=""; /* Your merchant key goes here. */
- $payment_url="http://cr.cybercash.com/cgi-bin/";
- $auth_type="mauthonly";
-
- $response=SendCC2_1Server($merchant,$merchant_key,$payment_url,
- $auth_type,array("Order-ID" => "2342322",
- "Amount" => "usd 11.50",
- "Card-Number" => "4111111111111111",
- "Card-Address" => "1600 Pennsylvania Avenue",
- "Card-City" => "Washington",
- "Card-State" => "DC",
- "Card-Zip" => "20500",
- "Card-Country" => "USA",
- "Card-Exp" => "12/99",
- "Card-Name" => "Bill Clinton"));
-
- while(list($key,$val)=each($response))
- {
- echo $key."=".$val."<br>";
- }
-
-?>
diff --git a/ext/cybermut/Makefile.in b/ext/cybermut/Makefile.in
deleted file mode 100644
index 6344d0f4d1..0000000000
--- a/ext/cybermut/Makefile.in
+++ /dev/null
@@ -1,8 +0,0 @@
-# $Id$
-
-LTLIBRARY_NAME = libcybermut.la
-LTLIBRARY_SOURCES = cybermut.c
-LTLIBRARY_SHARED_NAME = cybermut.la
-LTLIBRARY_SHARED_LIBADD = $(CYBERMUT_SHARED_LIBADD)
-
-include $(top_srcdir)/build/dynlib.mk
diff --git a/ext/cybermut/config.m4 b/ext/cybermut/config.m4
deleted file mode 100644
index cf93da9e9f..0000000000
--- a/ext/cybermut/config.m4
+++ /dev/null
@@ -1,49 +0,0 @@
-dnl $Id$
-dnl config.m4 for extension cybermut
-
-
-PHP_ARG_WITH(cybermut, for cybermut support,
-[ --with-cybermut[=DIR] Include CyberMut (french Credit Mutuel telepaiement)])
-
-
-if test "$PHP_CYBERMUT" != "no"; then
- for i in /usr/local /usr $PHP_CYBERMUT; do
- if test -r $i/cm-mac.h; then
- CYBERMUT_INC_DIR=$i
- elif test -r $i/include/cm-mac.h; then
- CYBERMUT_INC_DIR=$i/include
- fi
-
- if test -r $i/libcm-mac.a; then
- CYBERMUT_LIB_DIR=$i
- elif test -r $i/lib/libcm-mac.a; then
- CYBERMUT_LIB_DIR=$i/lib
- fi
- done
-
- if test -z "$CYBERMUT_INC_DIR"; then
- AC_MSG_ERROR(Could not find cm-mac.h Please make sure you have the
- CyberMut SDK installed. Use
- ./configure --with-cybermut=<cybermut-dir> if necessary)
- fi
-
- if test -z "$CYBERMUT_LIB_DIR"; then
- AC_MSG_ERROR(Could not find libcm-mac.a Please make sure you have the
- CyberMut SDK installed. Use
- ./configure --with-cybermut=<cybermut-dir> if necessary)
- fi
- AC_MSG_RESULT(found in $CYBERMUT_LIB_DIR)
-
- AC_MSG_RESULT(linking libcm-mac.a with libcybermut.a)
- ln -sf $CYBERMUT_LIB_DIR/libcm-mac.a $CYBERMUT_LIB_DIR/libcybermut.a
-
- PHP_ADD_INCLUDE($CYBERMUT_INC_DIR)
-
- PHP_SUBST(CYBERMUT_SHARED_LIBADD)
- PHP_ADD_LIBRARY_WITH_PATH(cybermut, $CYBERMUT_LIB_DIR, CYBERMUT_SHARED_LIBADD)
-
- AC_DEFINE(HAVE_CYBERMUT, 1, [ ])
-
-
- PHP_EXTENSION(cybermut, $ext_shared)
-fi
diff --git a/ext/cybermut/cybermut.c b/ext/cybermut/cybermut.c
deleted file mode 100644
index f05ef9420f..0000000000
--- a/ext/cybermut/cybermut.c
+++ /dev/null
@@ -1,183 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997, 1998, 1999, 2000 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Sylvain PAGES <spages@free.fr> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "php_ini.h"
-#include "php_cybermut.h"
-
-#include "cm-mac.h"
-
-/* If you declare any globals in php_cybermut.h uncomment this:
-ZEND_DECLARE_MODULE_GLOBALS(cybermut)
-*/
-
-/* True global resources - no need for thread safety here */
-static int le_cybermut;
-
-/* {{{ cybermut_functions[]
- */
-function_entry cybermut_functions[] = {
- PHP_FE(cybermut_creerformulairecm, NULL)
- PHP_FE(cybermut_testmac, NULL)
- PHP_FE(cybermut_creerreponsecm, NULL)
- {NULL, NULL, NULL} /* Must be the last line in cybermut_functions[] */
-};
-/* }}} */
-
-/* {{{ cybermut_module_entry
- */
-zend_module_entry cybermut_module_entry = {
- "cybermut",
- cybermut_functions,
- PHP_MINIT(cybermut),
- PHP_MSHUTDOWN(cybermut),
- NULL,
- NULL,
- PHP_MINFO(cybermut),
- STANDARD_MODULE_PROPERTIES
-};
-/* }}} */
-
-#ifdef COMPILE_DL_CYBERMUT
-ZEND_GET_MODULE(cybermut)
-#endif
-
-PHP_MINIT_FUNCTION(cybermut)
-{
- return SUCCESS;
-}
-
-PHP_MSHUTDOWN_FUNCTION(cybermut)
-{
- return SUCCESS;
-}
-
-/* {{{ PHP_MINFO_FUNCTION
- */
-PHP_MINFO_FUNCTION(cybermut)
-{
- php_info_print_table_start();
- php_info_print_table_header(2, "cybermut support", "enabled");
- php_info_print_table_end();
-}
-/* }}} */
-
-/* {{{ proto string cybermut_creerformulairecm(string url_CM, string version, string TPE, string montant, string ref_commande, string texte_libre, string url_retour, string url_retour_ok, string url_retour_err, string langue, string code_societe, string texte_bouton)
- Return a string containing source HTML of the form of request for payment.
- This result corresponds to the last parameter "formulaire" of the original function
- which was removed */
-PHP_FUNCTION(cybermut_creerformulairecm)
-{
- zval **url_CM, **version, **TPE, **montant, **ref_commande, **texte_libre, **url_retour, **url_retour_ok, **url_retour_err, **langue, **code_societe, **texte_bouton;
-
- char formulaire [10000];
-
- if (ZEND_NUM_ARGS() != 12 || zend_get_parameters_ex(12, &url_CM, &version, &TPE, &montant, &ref_commande, &texte_libre, &url_retour, &url_retour_ok, &url_retour_err, &langue, &code_societe, &texte_bouton) == FAILURE){
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(url_CM);
- convert_to_string_ex(version);
- convert_to_string_ex(TPE);
- convert_to_string_ex(montant);
- convert_to_string_ex(ref_commande);
- convert_to_string_ex(texte_libre);
- convert_to_string_ex(url_retour);
- convert_to_string_ex(url_retour_ok);
- convert_to_string_ex(url_retour_err);
- convert_to_string_ex(langue);
- convert_to_string_ex(code_societe);
- convert_to_string_ex(texte_bouton);
-
- CreerFormulaireCM ( Z_STRVAL_PP(url_CM), Z_STRVAL_PP(version), Z_STRVAL_PP(TPE), Z_STRVAL_PP(montant), Z_STRVAL_PP(ref_commande), Z_STRVAL_PP(texte_libre), Z_STRVAL_PP(url_retour), Z_STRVAL_PP(url_retour_ok), Z_STRVAL_PP(url_retour_err), Z_STRVAL_PP(langue), Z_STRVAL_PP(code_societe), Z_STRVAL_PP(texte_bouton), formulaire);
-
-
- RETURN_STRING(formulaire, 1);
-
-}
-/* }}} */
-
-/* {{{ proto bool cybermut_testmac(string code_MAC, string version, string TPE, string cdate, string montant, string ref_commande, string texte_libre, string code_retour)
- Return a boolean attesting that the authentification proceeded well
- true : the received message is authenticated
- false: if not */
-PHP_FUNCTION(cybermut_testmac)
-{
- zval **code_MAC, **version, **TPE, **cdate, **montant, **ref_commande, **texte_libre, **code_retour;
- int cdr_test;
-
- if (ZEND_NUM_ARGS() != 8 || zend_get_parameters_ex(8, &code_MAC, &version, &TPE, &cdate, &montant, &ref_commande, &texte_libre, &code_retour) == FAILURE){
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(code_MAC);
- convert_to_string_ex(version);
- convert_to_string_ex(TPE);
- convert_to_string_ex(cdate);
- convert_to_string_ex(montant);
- convert_to_string_ex(ref_commande);
- convert_to_string_ex(texte_libre);
- convert_to_string_ex(code_retour);
-
- cdr_test = TestMAC ( Z_STRVAL_PP(code_MAC), Z_STRVAL_PP(version), Z_STRVAL_PP(TPE), Z_STRVAL_PP(cdate), Z_STRVAL_PP(montant), Z_STRVAL_PP(ref_commande), Z_STRVAL_PP(texte_libre), Z_STRVAL_PP(code_retour));
-
- if (cdr_test == 1) {
- RETURN_TRUE;
- } else {
- RETURN_FALSE;
- }
-
-}
-/* }}} */
-
-/* {{{ proto string cybermut_creerreponsecm(string phrase)
- Return a string containing the message of acknowledgement of delivery
- (headers and body of the message).
- This result corresponds to the last parameter "reponse" of the original function
- which was removed. */
-PHP_FUNCTION(cybermut_creerreponsecm)
-{
- zval **phrase;
- char buf[5000];
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &phrase) == FAILURE){
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(phrase);
-
- CreerReponseCM( Z_STRVAL_PP(phrase), buf);
-
- RETURN_STRING (buf,1);
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/cybermut/cybermut.xml b/ext/cybermut/cybermut.xml
deleted file mode 100644
index fabc94b5b2..0000000000
--- a/ext/cybermut/cybermut.xml
+++ /dev/null
@@ -1,214 +0,0 @@
- <reference id="ref.cybermut">
- <title>Credit Mutuel CyberMUT functions</title>
- <titleabbrev>CyberMUT</titleabbrev>
- <partintro>
- <simpara>
- This extension allows you to process credit cards transactions using Credit
- Mutuel CyberMUT system (<ulink url="http://www.creditmutuel.fr/centre_commercial/vendez_sur_internet.html">http://www.creditmutuel.fr/centre_commercial/vendez_sur_internet.html</ulink>).
- </simpara>
- <simpara>
- CynerMUT is a popular Web Payment Service in France, provided by the
- Credit Mutuel bank. If you are foreign in France, these functions will not
- be useful for you.
- </simpara>
- <simpara>
- These functions are only available if PHP has been compiled with the
- <option role="configure">--with-cybermut[=DIR]</option> option, where DIR is
- the location of libcm-mac.a and cm-mac.h. You will require the
- appropriate SDK for your platform, which may be sent to you after your
- CyberMUT's subscription (contact them via Web, or go to the nearest
- Credit Mutuel).
- </simpara>
- <simpara>
- The use of these functions is almost identical to the original functions,
- except for the parameters of return for CreerFormulaireCM and CreerReponseCM,
- which are returned directly by functions PHP, whereas they had passed in
- reference in the original functions.
- </simpara>
- <simpara>
- These functions have been added in PHP 4.0.4. ???
- </simpara>
-
- <note><para>
- These functions only provide a link to CyberMUT SDK. Be sure to read the
- CynerMUT Developers Guide for full details of the required parameters.
- </para></note>
- </partintro>
-
- <refentry id="function.cybermut_creerformulairecm">
- <refnamediv>
- <refname>cybermut_creerformulairecm</refname>
- <refpurpose>Generate HTML form of request for payment</refpurpose>
- </refnamediv>
- <refsect1>
- <title>Description</title>
- <funcsynopsis>
- <funcprototype>
- <funcdef>string <function>pfpro_init</function></funcdef>
- <paramdef>string <parameter>url_CM</parameter></paramdef>
- <paramdef>string <parameter>version</parameter></paramdef>
- <paramdef>string <parameter>TPE</parameter></paramdef>
- <paramdef>string <parameter>montant</parameter></paramdef>
- <paramdef>string <parameter>ref_commande</parameter></paramdef>
- <paramdef>string <parameter>texte_libre</parameter></paramdef>
- <paramdef>string <parameter>url_retour</parameter></paramdef>
- <paramdef>string <parameter>url_retour_ok</parameter></paramdef>
- <paramdef>string <parameter>url_retour_err</parameter></paramdef>
- <paramdef>string <parameter>langue</parameter></paramdef>
- <paramdef>string <parameter>code_societe</parameter></paramdef>
- <paramdef>string <parameter>texte_bouton</parameter></paramdef>
- </funcprototype>
- </funcsynopsis>
- <para>
- <function>cynermut_creerformulairecm</function> is used to generate the
- HTML form of request for payment.
- </para>
- <para>
- See also <function>cybermut_testmac</function>
- <function>cybermut_creerreponsecm</function>.
- </para>
- <example>
- <title>First step of payment (equiv cgi1.c)</title>
- <programlisting role="php">
-&lt;?php
-// Directory where are located the keys
-putenv("CMKEYDIR=/var/creditmut/cles");
-
-// Version number
-$VERSION="1.2";
-
- $retour = creditmut_creerformulairecm(
- "https://www.creditmutuel.fr/test/telepaiement/paiement.cgi",
- $VERSION,
- "1234567890",
- "300FRF",
- $REFERENCE,
- $TEXTE_LIBRE,
- $URL_RETOUR,
- $URL_RETOUR_OK,
- $URL_RETOUR_ERR,
- "francais",
- "company",
- "Paiement par carte bancaire");
-
-echo $retour;
-?>
- </programlisting>
- </example>
- </refsect1>
- </refentry>
-
- <refentry id="function.cybermut_testmac">
- <refnamediv>
- <refname>cybermut_testmac</refname>
- <refpurpose>Make sure that there no was data diddling contained
- in the received message of confirmation </refpurpose>
- </refnamediv>
- <refsect1>
- <title>Description</title>
- <funcsynopsis>
- <funcprototype>
- <funcdef>bool <function>cybermut_testmac</function></funcdef>
- <paramdef>string <parameter>code_MAC</parameter></paramdef>
- <paramdef>string <parameter>version</parameter></paramdef>
- <paramdef>string <parameter>TPE</parameter></paramdef>
- <paramdef>string <parameter>cdate</parameter></paramdef>
- <paramdef>string <parameter>montant</parameter></paramdef>
- <paramdef>string <parameter>ref_commande</parameter></paramdef>
- <paramdef>string <parameter>texte_libre</parameter></paramdef>
- <paramdef>string <parameter>code-retour</parameter></paramdef>
- </funcprototype>
- </funcsynopsis>
- <para>
- <function>cybermut_testmac</function> is used to make sure that there was
- not data diddling contained in the received message of confirmation.
- Pay attention to parameters code-retour and texte-libre, which cannot be
- evaluated as is, because auf the dash. You must retrieve them by using:
- <programlisting role="php">
-$code_retour=$HTTP_GET_VARS["code-retour"];
-$texte_libre=$HTTP_GET_VARS["texte-libre"];
- </programlisting>
- </para>
- <para>
- See also <function>cybermut_creerformulairecm</function>
- <function>cybermut_creerreponsecm</function>.
- </para>
- <example>
- <title>Last step of payment (equiv cgi2.c)</title>
- <programlisting role="php">
-&lt;?php_track_vars?>
-&lt;?php
-// Directory where are located the keys
-putenv("CMKEYDIR=/var/creditmut/cles");
-
-// Version number
-$VERSION="1.2";
-
-$texte_libre = $HTTP_GET_VARS["texte-libre"];
-$code_retour = $HTTP_GET_VARS["code-retour"];
-
-$mac_ok = creditmut_testmac($MAC,$VERSION,$TPE,$date,$montant,$reference,$texte_libre,$code_retour);
-
-if ($mac_ok) {
-
- //
- // insert data processing here
- //
- //
-
- $result=creditmut_creerreponsecm("OK");
- } else {
- $result=creditmut_creerreponsecm("Document Falsifie");}
-
-?>
- </programlisting>
- </example>
- </refsect1>
- </refentry>
-
- <refentry id="function.cybermut_creerreponsecm">
- <refnamediv>
- <refname>cybermut_creerreponsecm</refname>
- <refpurpose>Generate the acknowledgement of delivery of the confirmation
- of payment</refpurpose>
- </refnamediv>
- <refsect1>
- <title>Description</title>
- <funcsynopsis>
- <funcprototype>
- <funcdef>string <function>cybermut_creerreponsecm</function></funcdef>
- <paramdef>string <parameter>phrase</parameter></paramdef>
- </funcprototype>
- </funcsynopsis>
- <para>
- Returns: string containing the message of aknowledgement of delivery.
- </para>
- <para>
- The parameter is "OK" if the message of confirmation of the payment
- were correctly auhentified by <function>cybermut_testmac</function>.
- Any other chain is regarded as an error message.
- </para>
- <para>
- See also <function>cybermut_creerformulairecm</function>
- <function>cybermut_testmac</function>.
- </para>
- </refsect1>
- </refentry>
- </reference>
-
-<!-- Keep this comment at the end of the file
-Local variables:
-mode: sgml
-sgml-omittag:t
-sgml-shorttag:t
-sgml-minimize-attributes:nil
-sgml-always-quote-attributes:t
-sgml-indent-step:1
-sgml-indent-data:t
-sgml-parent-document:nil
-sgml-default-dtd-file:"../../manual.ced"
-sgml-exposed-tags:nil
-sgml-local-catalogs:nil
-sgml-local-ecat-files:nil
-End:
--->
diff --git a/ext/cybermut/php_cybermut.h b/ext/cybermut/php_cybermut.h
deleted file mode 100644
index a4c0755b2c..0000000000
--- a/ext/cybermut/php_cybermut.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997, 1998, 1999, 2000 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Sylvain PAGES <spages@free.fr> |
- | |
- +----------------------------------------------------------------------+
- */
-
-#ifndef PHP_CYBERMUT_H
-#define PHP_CYBERMUT_H
-
-extern zend_module_entry cybermut_module_entry;
-#define phpext_cybermut_ptr &cybermut_module_entry
-
-#ifdef PHP_WIN32
-#define PHP_CYBERMUT_API __declspec(dllexport)
-#else
-#define PHP_CYBERMUT_API
-#endif
-
-PHP_MINIT_FUNCTION(cybermut);
-PHP_MSHUTDOWN_FUNCTION(cybermut);
-PHP_RINIT_FUNCTION(cybermut);
-PHP_RSHUTDOWN_FUNCTION(cybermut);
-PHP_MINFO_FUNCTION(cybermut);
-
-PHP_FUNCTION(confirm_cybermut_compiled); /* For testing, remove later. */
-PHP_FUNCTION(cybermut_creerformulairecm);
-PHP_FUNCTION(cybermut_testmac);
-PHP_FUNCTION(cybermut_creerreponsecm);
-
-/*
- Declare any global variables you may need between the BEGIN
- and END macros here:
-
-ZEND_BEGIN_MODULE_GLOBALS(cybermut)
- int global_variable;
-ZEND_END_MODULE_GLOBALS(cybermut)
-*/
-
-/* In every function that needs to use variables in php_cybermut_globals,
- do call CYBERMUTLS_FETCH(); after declaring other variables used by
- that function, and always refer to them as CYBERMUTG(variable).
- You are encouraged to rename these macros something shorter, see
- examples in any other php module directory.
-*/
-
-#ifdef ZTS
-#define CYBERMUTG(v) (cybermut_globals->v)
-#define CYBERMUTLS_FETCH() php_cybermut_globals *cybermut_globals = ts_resource(cybermut_globals_id)
-#else
-#define CYBERMUTG(v) (cybermut_globals.v)
-#define CYBERMUTLS_FETCH()
-#endif
-
-#endif /* PHP_CYBERMUT_H */
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/cybermut/tests/001.phpt b/ext/cybermut/tests/001.phpt
deleted file mode 100644
index 9fb02fd784..0000000000
--- a/ext/cybermut/tests/001.phpt
+++ /dev/null
@@ -1,23 +0,0 @@
---TEST--
-Check for cybermut presence
---SKIPIF--
-<?php if (!extension_loaded("cybermut")) print "skip"; ?>
---POST--
---GET--
---FILE--
-<?php
-echo "cybermut extension is available";
-/*
- you can add regression tests for your extension here
-
- the output of your test code has to be equal to the
- text in the --EXPECT-- section below for the tests
- to pass, differences between the output and the
- expected text are interpreted as failure
-
- see php4/tests/README for further information on
- writing regression tests
-*/
-?>
---EXPECT--
-cybermut extension is available \ No newline at end of file
diff --git a/ext/db/CREDITS b/ext/db/CREDITS
deleted file mode 100644
index 9efbe3fe52..0000000000
--- a/ext/db/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-DBM
-Rasmus Lerdorf, Jim Winstead
diff --git a/ext/db/Makefile.in b/ext/db/Makefile.in
deleted file mode 100644
index f4531bed58..0000000000
--- a/ext/db/Makefile.in
+++ /dev/null
@@ -1,5 +0,0 @@
-
-LTLIBRARY_NAME = libdb.la
-LTLIBRARY_SOURCES = db.c
-
-include $(top_srcdir)/build/dynlib.mk
diff --git a/ext/db/config.m4 b/ext/db/config.m4
deleted file mode 100644
index a1dae8cb41..0000000000
--- a/ext/db/config.m4
+++ /dev/null
@@ -1,59 +0,0 @@
-dnl $Id$
-dnl config.m4 for extension db
-dnl don't forget to call PHP_EXTENSION(db)
-
-
-# Checks for libraries.
-# Prefer gdbm, Berkeley DB and ndbm/dbm, in that order
-AC_DEFUN(AC_PREFERRED_DB_LIB,[
- AC_CHECK_LIB(gdbm, gdbm_open,[AC_DEFINE(GDBM,1, [Whether you have GDBM]) DBM_TYPE=gdbm; DBM_LIB=-lgdbm],
- [AC_CHECK_LIB(c, dbm_open,[AC_DEFINE(NDBM,1,[ ]) DBM_TYPE=ndbm; DBM_LIB=],
- [AC_CHECK_LIB(dbm, dbm_open,[AC_DEFINE(NDBM,1,[ ]) DBM_TYPE=ndbm; DBM_LIB=-ldbm],
- [AC_CHECK_LIB(db, dbm_open,[AC_DEFINE(NDBM,1, [Whether you have NDBM]) DBM_TYPE=ndbm; DBM_LIB=-ldb],
- [DBM_TYPE=""])
- ])
- ])
- ])
- AC_MSG_CHECKING([preferred dbm library])
- if test "a$DBM_TYPE" = a; then
- AC_MSG_RESULT(none found)
- AC_MSG_WARN(No dbm library found - using built-in flatfile support)
- else
- AC_MSG_RESULT($DBM_TYPE chosen)
- fi
- PHP_SUBST(DBM_LIB)
- PHP_SUBST(DBM_TYPE)
-])
-
-
-PHP_ARG_WITH(db, whether to include old xDBM support,
-[ --with-db Include old xDBM support (deprecated)])
-
-if test "$PHP_DB" != "no"; then
-
- AC_PREFERRED_DB_LIB
-
- if test "$DBM_LIB" = "-lgdbm"; then
- AC_CHECK_HEADER(gdbm.h, [ GDBM_INCLUDE="" ], [
- AC_MSG_RESULT("Try /usr/local/include/gdbm.h");
- AC_CHECK_HEADER(/usr/local/include/gdbm.h, [ GDBM_INCLUDE=-I/usr/local/include ],[
- AC_MSG_RESULT("Try /opt/local/include/gdbm.h");
- AC_CHECK_HEADER(/opt/local/include/gdbm.h, [ GDBM_INCLUDE=-I/opt/local/include ],[
- dnl if in /usr/pkg/include, do not add anything. See above.
- AC_MSG_RESULT("Try /usr/pkg/include/gdbm.h");
- AC_CHECK_HEADER(/usr/pkg/include/gdbm.h, [ GDBM_INCLUDE="" ],[
- AC_MSG_RESULT("Giving up - You need to install gdbm.h somewhere");
- exit
- ])
- ])
- ])
- ])
- fi
-
- if test -n "$DBM_LIB"; then
- INCLUDES="$INCLUDES $GDBM_INCLUDE"
- EXTRA_LIBS="$EXTRA_LIBS $DBM_LIB"
- fi
-
- PHP_EXTENSION(db)
-fi
diff --git a/ext/db/db.c b/ext/db/db.c
deleted file mode 100644
index 17d6f0d1c6..0000000000
--- a/ext/db/db.c
+++ /dev/null
@@ -1,1247 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
- | Jim Winstead <jimw@php.net> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-#define IS_EXT_MODULE
-
-#if 1
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "php_globals.h"
-#include "safe_mode.h"
-#include "fopen_wrappers.h"
-#include "ext/standard/flock_compat.h"
-#include "ext/standard/info.h"
-
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#if HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-
-#ifdef PHP_31
-#include "os/nt/flock.h"
-#else
-#ifdef PHP_WIN32
-#include "win32/flock.h"
-#else
-#include <sys/file.h>
-#endif
-#endif
-
-#if HAVE_FCNTL_H
-#include <fcntl.h>
-#endif
-
-#if GDBM
-#include <gdbm.h>
-
-#define DBM_TYPE GDBM_FILE
-#define DBM_MODE_TYPE int
-#define DBM_WRITE_MODE GDBM_WRITER
-#define DBM_CREATE_MODE GDBM_WRCREAT
-#define DBM_NEW_MODE GDBM_NEWDB
-#define DBM_DEFAULT_MODE GDBM_READER
-#define DBM_OPEN(filename, mode) gdbm_open(filename, 512, mode, 0666, 0)
-#define DBM_CLOSE(dbf) gdbm_close(dbf)
-#define DBM_STORE(dbf, key, value, mode) gdbm_store(dbf, key, value, mode)
-#define DBM_FETCH(dbf, key) gdbm_fetch(dbf, key)
-#define DBM_EXISTS(dbf, key) gdbm_exists(dbf, key)
-#define DBM_DELETE(dbf, key) gdbm_delete(dbf, key)
-#define DBM_FIRSTKEY(dbf) gdbm_firstkey(dbf)
-#define DBM_NEXTKEY(dbf, key) gdbm_nextkey(dbf, key)
-
-#define DBM_INSERT GDBM_INSERT
-#define DBM_REPLACE GDBM_REPLACE
-#endif
-
-#if NDBM && !GDBM
-#if BSD2
-#define DB_DBM_HSEARCH 1
-#include <db.h>
-#else
-#ifdef HAVE_DB1_NDBM_H
-#include <db1/ndbm.h>
-#else
-#include <ndbm.h>
-#endif
-#endif
-
-#define DBM_TYPE DBM *
-#define DBM_MODE_TYPE int
-#define DBM_WRITE_MODE O_RDWR
-#define DBM_CREATE_MODE O_RDWR | O_CREAT
-#define DBM_NEW_MODE O_RDWR | O_CREAT | O_TRUNC
-#define DBM_DEFAULT_MODE O_RDONLY
-#define DBM_OPEN(filename, mode) dbm_open(filename, mode, 0666)
-#define DBM_CLOSE(dbf) dbm_close(dbf)
-#define DBM_STORE(dbf, key, value, mode) dbm_store(dbf, key, value, mode)
-#define DBM_FETCH(dbf, key) dbm_fetch(dbf, key)
-#define DBM_EXISTS(dbf, key) php_dbm_key_exists(dbf, key)
-#define DBM_DELETE(dbf, key) dbm_delete(dbf, key)
-#define DBM_FIRSTKEY(dbf) dbm_firstkey(dbf)
-#define DBM_NEXTKEY(dbf, key) dbm_nextkey(dbf)
-
-/* {{{ php_dbm_key_exists
- */
-static int php_dbm_key_exists(DBM *dbf, datum key_datum) {
- datum value_datum;
- int ret;
-
- value_datum = dbm_fetch(dbf, key_datum);
- if (value_datum.dptr)
- ret = 1;
- else
- ret = 0;
- return ret;
-}
-/* }}} */
-#endif
-
-#if !NDBM && !GDBM
-#define DBM_TYPE FILE *
-
-#define DBM_MODE_TYPE char *
-#define DBM_WRITE_MODE "r+b"
-#define DBM_CREATE_MODE "a+b"
-#define DBM_NEW_MODE "w+b"
-#define DBM_DEFAULT_MODE "r"
-#define DBM_OPEN(filename, mode) VCWD_FOPEN(filename, mode)
-#define DBM_CLOSE(dbf) fclose(dbf)
-#define DBM_STORE(dbf, key, value, mode) flatfile_store(dbf, key, value, mode)
-#define DBM_FETCH(dbf, key) flatfile_fetch(dbf, key)
-#define DBM_EXISTS(dbf, key) flatfile_findkey(dbf, key)
-#define DBM_DELETE(dbf, key) flatfile_delete(dbf, key)
-#define DBM_FIRSTKEY(dbf) flatfile_firstkey(dbf)
-#define DBM_NEXTKEY(dbf, key) flatfile_nextkey(dbf)
-
-#define DBM_INSERT 0
-#define DBM_REPLACE 1
-
-typedef struct {
- char *dptr;
- int dsize;
-} datum;
-
-int flatfile_store(FILE *dbf, datum key, datum value, int mode);
-datum flatfile_fetch(FILE *dbf, datum key);
-int flatfile_findkey(FILE *dbf, datum key);
-int flatfile_delete(FILE *dbf, datum key);
-datum flatfile_firstkey(FILE *dbf);
-datum flatfile_nextkey(FILE *dbf);
-
-#endif
-
-#include "php_db.h"
-#include "ext/standard/php_string.h"
-
-static int le_db;
-
-#if THREAD_SAFE
-DWORD DbmTls;
-static int numthreads=0;
-#endif
-
-/*needed for blocking calls in windows*/
-void *dbm_mutex;
-
-/* {{{ php_find_dbm
- */
-dbm_info *php_find_dbm(pval *id)
-{
- list_entry *le;
- dbm_info *info;
- int numitems, i;
- int info_type;
- ELS_FETCH();
-
- if (Z_TYPE_P(id) == IS_STRING) {
- numitems = zend_hash_num_elements(&EG(regular_list));
- for (i=1; i<=numitems; i++) {
- if (zend_hash_index_find(&EG(regular_list), i, (void **) &le)==FAILURE) {
- continue;
- }
- if (Z_TYPE_P(le) == le_db) {
- info = (dbm_info *)(le->ptr);
- if (!strcmp(info->filename, Z_STRVAL_P(id))) {
- return (dbm_info *)(le->ptr);
- }
- }
- }
- }
-
- /* didn't find it as a database filename, try as a number */
- convert_to_long(id);
- info = zend_list_find(Z_LVAL_P(id), &info_type);
- if (info_type != le_db)
- return NULL;
- return info;
-}
-/* }}} */
-
-/* {{{ php_get_info_db
- */
-static char *php_get_info_db(void)
-{
- static char temp1[128];
- static char temp[256];
-
- temp1[0]='\0';
- temp[0]='\0';
-
-#ifdef DB_VERSION_STRING /* using sleepycat dbm */
- strcat(temp,DB_VERSION_STRING);
-#endif
-
-#if GDBM
- sprintf(temp1,"%s",gdbm_version);
- strcat(temp,temp1);
-#endif
-
-#if NDBM && !GDBM
- strcat(temp,"ndbm support enabled");
-#endif
-
-#if !GDBM && !NDBM
- strcat(temp,"flat file support enabled");
-#endif
-
-#if NFS_HACK
- strcat(temp,"NFS hack in effect");
-#endif
-
- if (!*temp)
- strcat(temp,"No database support");
-
- return temp;
-}
-/* }}} */
-
-/* {{{ PHP_MINFO_FUNCTION
- */
-PHP_MINFO_FUNCTION(db)
-{
- /* this isn't pretty ... should break out the info a bit more (cmv) */
- php_info_print_box_start(0);
- php_printf(php_get_info_db());
- php_info_print_box_end();
-}
-/* }}} */
-
-/* {{{ proto string dblist(void)
- Describes the dbm-compatible library being used */
-PHP_FUNCTION(dblist)
-{
- char *str = php_get_info_db();
- RETURN_STRING(str,1);
-}
-/* }}} */
-
-/* {{{ proto int dbmopen(string filename, string mode)
- Opens a dbm database */
-PHP_FUNCTION(dbmopen) {
- pval *filename, *mode;
- dbm_info *info=NULL;
- int ret;
-
- if (ZEND_NUM_ARGS()!=2 || zend_get_parameters(ht,2,&filename,&mode)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string(filename);
- convert_to_string(mode);
-
- info = php_dbm_open(Z_STRVAL_P(filename), Z_STRVAL_P(mode));
- if (info) {
- ret = zend_list_insert(info, le_db);
- RETURN_LONG(ret);
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ php_dbm_open
- */
-dbm_info *php_dbm_open(char *filename, char *mode) {
- dbm_info *info;
- int ret, lock=0;
- char *lockfn = NULL;
- int lockfd = 0;
-
-#if NFS_HACK
- int last_try = 0;
- struct stat sb;
- int retries = 0;
-#endif
-
- DBM_TYPE dbf=NULL;
- DBM_MODE_TYPE imode;
- PLS_FETCH();
-
- if (filename == NULL) {
- php_error(E_WARNING, "NULL filename passed to php_dbm_open()");
- return NULL;
- }
-
- if (PG(safe_mode) && (!php_checkuid(filename, NULL, CHECKUID_CHECK_FILE_AND_DIR))) {
- return NULL;
- }
-
- if (php_check_open_basedir(filename)) {
- return NULL;
- }
-
- switch (*mode) {
- case 'w':
- imode = DBM_WRITE_MODE;
- lock = 1;
- break;
- case 'c':
- imode = DBM_CREATE_MODE;
- lock = 1;
- break;
- case 'n':
- imode = DBM_NEW_MODE;
- lock = 1;
- break;
- default:
- imode = DBM_DEFAULT_MODE;
- lock = 0;
- break;
- }
-
- if (lock) {
- lockfn = emalloc(strlen(filename) + 5);
- strcpy(lockfn, filename);
- strcat(lockfn, ".lck");
-
-#if NFS_HACK
- while((last_try = VCWD_STAT(lockfn,&sb))==0) {
- retries++;
- php_sleep(1);
- if (retries>30) break;
- }
- if (last_try!=0) {
- lockfd = open(lockfn,O_RDWR|O_CREAT,0644);
- close(lockfd);
- } else {
- php_error(E_WARNING, "File appears to be locked [%s]\n",lockfn);
- return -1;
- }
-#else /* NFS_HACK */
-
- lockfd = VCWD_OPEN((lockfn,O_RDWR|O_CREAT,0644));
-
- if (lockfd) {
- flock(lockfd,LOCK_EX);
- close(lockfd);
- } else {
- php_error(E_WARNING, "Unable to establish lock: %s",filename);
- }
-#endif /* else NFS_HACK */
-
- }
-
- dbf = DBM_OPEN(filename, imode);
-
-#if !NDBM && !GDBM
- if (dbf) {
- setvbuf(dbf, NULL, _IONBF, 0);
- }
-#endif
-
- if (dbf) {
- info = (dbm_info *)emalloc(sizeof(dbm_info));
- if (!info) {
- php_error(E_ERROR, "problem allocating memory!");
- return NULL;
- }
-
- info->filename = estrdup(filename);
- info->lockfn = lockfn;
- info->lockfd = lockfd;
- info->dbf = dbf;
-
- return info;
- } else {
-#if GDBM
- php_error(E_WARNING, "dbmopen_gdbm(%s): %d [%s], %d [%s]",filename,gdbm_errno,gdbm_strerror(gdbm_errno),errno,strerror(errno));
- if (gdbm_errno)
- ret = gdbm_errno;
- else if (errno)
- ret = errno;
- else
- ret = -1;
-#else
-#if NDBM
-#if PHP_DEBUG
- php_error(E_WARNING, "dbmopen_ndbm(%s): errno = %d [%s]\n",filename,errno,strerror(errno));
-#endif
- if (errno) ret=errno;
- else ret = -1;
-#else
-#if PHP_DEBUG
- php_error(E_WARNING, "dbmopen_flatfile(%s): errno = %d [%s]\n",filename,errno,strerror(errno));
-#endif
- if (errno) ret=errno;
- else ret = -1;
-#endif
-#endif
-
-#if NFS_HACK
- if (lockfn) {
- VCWD_UNLINK(lockfn);
- }
-#endif
- if (lockfn) efree(lockfn);
- }
-
- return NULL;
-}
-/* }}} */
-
-/* {{{ proto bool dbmclose(int dbm_identifier)
- Closes a dbm database */
-PHP_FUNCTION(dbmclose) {
- pval *id;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters(ht,1,&id)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long(id);
-
- if (zend_list_delete(Z_LVAL_P(id)) == SUCCESS) {
- RETURN_TRUE;
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ php_dbm_close
- */
-int php_dbm_close(zend_rsrc_list_entry *rsrc) {
- int ret = 0;
- dbm_info *info = (dbm_info *)rsrc->ptr;
- DBM_TYPE dbf;
- int lockfd;
-
- dbf = info->dbf;
-
-#if NFS_HACK
- VCWD_UNLINK(info->lockfn);
-#else
- if (info->lockfn) {
- lockfd = VCWD_OPEN((info->lockfn,O_RDWR,0644));
- flock(lockfd,LOCK_UN);
- close(lockfd);
- }
-#endif
-
- if (dbf)
- DBM_CLOSE(dbf);
-
- /* free the memory used by the dbm_info struct */
- if (info->filename) efree(info->filename);
- if (info->lockfn) efree(info->lockfn);
- efree(info);
-
- return(ret);
-}
-/* }}} */
-
-/*
- * ret = -1 means that database was opened for read-only
- * ret = 0 success
- * ret = 1 key already exists - nothing done
- */
-/* {{{ proto int dbminsert(int dbm_identifier, string key, string value)
- Inserts a value for a key in a dbm database */
-PHP_FUNCTION(dbminsert)
-{
- pval *id, *key, *value;
- dbm_info *info;
- int ret;
-
- if (ZEND_NUM_ARGS()!=3||zend_get_parameters(ht,3,&id,&key,&value) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string(key);
- convert_to_string(value);
-
- info = php_find_dbm(id);
- if (!info) {
- php_error(E_WARNING, "not a valid database identifier %d", Z_LVAL_P(id));
- RETURN_FALSE;
- }
-
- ret = php_dbm_insert(info, Z_STRVAL_P(key), Z_STRVAL_P(value));
- RETURN_LONG(ret);
-}
-/* }}} */
-
-
-/* {{{ php_dbm_insert
- */
-int php_dbm_insert(dbm_info *info, char *key, char *value) {
- datum key_datum, value_datum;
- int ret;
- DBM_TYPE dbf;
-
- php_stripslashes(key,NULL);
- php_stripslashes(value,NULL);
-
- value_datum.dptr = estrdup(value);
- value_datum.dsize = strlen(value);
-
- key_datum.dptr = estrdup(key);
- key_datum.dsize = strlen(key);
-#if GDBM_FIX
- key_datum.dsize++;
-#endif
-
- dbf = info->dbf;
- if (!dbf) {
- php_error(E_WARNING, "Unable to locate dbm file");
- return 1;
- }
-
- ret = DBM_STORE(dbf, key_datum, value_datum, DBM_INSERT);
-
- /* free the memory */
- efree(key_datum.dptr); efree(value_datum.dptr);
-
- return(ret);
-}
-/* }}} */
-
-/* {{{ proto int dbmreplace(int dbm_identifier, string key, string value)
- Replaces the value for a key in a dbm database */
-PHP_FUNCTION(dbmreplace)
-{
- pval *id, *key, *value;
- dbm_info *info;
- int ret;
-
- if (ZEND_NUM_ARGS()!=3||zend_get_parameters(ht,3,&id,&key,&value) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string(key);
- convert_to_string(value);
-
- info = php_find_dbm(id);
- if (!info) {
- php_error(E_WARNING, "not a valid database identifier %d", Z_LVAL_P(id));
- RETURN_FALSE;
- }
-
- ret = php_dbm_replace(info, Z_STRVAL_P(key), Z_STRVAL_P(value));
- RETURN_LONG(ret);
-}
-/* }}} */
-
-/* {{{ php_dbm_replace
- */
-int php_dbm_replace(dbm_info *info, char *key, char *value) {
- DBM_TYPE dbf;
- int ret;
- datum key_datum, value_datum;
- PLS_FETCH();
-
- if (PG(magic_quotes_runtime)) {
- php_stripslashes(key,NULL);
- php_stripslashes(value,NULL);
- }
-
- value_datum.dptr = estrdup(value);
- value_datum.dsize = strlen(value);
-
- key_datum.dptr = estrdup(key);
- key_datum.dsize = strlen(key);
-#if GDBM_FIX
- key_datum.dsize++;
-#endif
-
- dbf = info->dbf;
- if (!dbf) {
- php_error(E_WARNING, "Unable to locate dbm file");
- return 1;
- }
-
- ret = DBM_STORE(dbf, key_datum, value_datum, DBM_REPLACE);
-
- /* free the memory */
- efree(key_datum.dptr); efree(value_datum.dptr);
-
- return(ret);
-}
-/* }}} */
-
-/* {{{ proto string dbmfetch(int dbm_identifier, string key)
- Fetches a value for a key from a dbm database */
-PHP_FUNCTION(dbmfetch)
-{
- pval *id, *key;
- dbm_info *info;
- char *ret;
-
- if (ZEND_NUM_ARGS()!=2||zend_get_parameters(ht,2,&id,&key)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string(key);
-
- info = php_find_dbm(id);
- if (!info) {
- php_error(E_WARNING, "not a valid database identifier %d", Z_LVAL_P(id));
- RETURN_FALSE;
- }
-
- ret = php_dbm_fetch(info, Z_STRVAL_P(key));
- if (ret) {
- RETVAL_STRING(ret, 0);
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ php_dbm_fetch
- */
-char *php_dbm_fetch(dbm_info *info, char *key) {
- datum key_datum, value_datum;
- char *ret;
- DBM_TYPE dbf;
- PLS_FETCH();
-
- key_datum.dptr = key;
- key_datum.dsize = strlen(key);
-#if GDBM_FIX
- key_datum.dsize++;
-#endif
- value_datum.dptr = NULL;
- value_datum.dsize = 0;
-
- dbf = info->dbf;
- if (!dbf) {
- php_error(E_WARNING, "Unable to locate dbm file");
- return(NULL);
- }
-
- value_datum = DBM_FETCH(dbf, key_datum);
-
- if (value_datum.dptr) {
- ret = (char *)emalloc(sizeof(char) * value_datum.dsize + 1);
- strncpy(ret, value_datum.dptr, value_datum.dsize);
- ret[value_datum.dsize] = '\0';
-
-#if GDBM
-/* all but NDBM use malloc to allocate the content blocks, so we need to free it */
- free(value_datum.dptr);
-#else
-# if !NDBM
- efree(value_datum.dptr);
-# endif
-#endif
- }
- else
- ret = NULL;
-
- if (ret && PG(magic_quotes_runtime)) {
- ret = php_addslashes(ret, value_datum.dsize, NULL, 1);
- }
- return(ret);
-}
-/* }}} */
-
-/* {{{ proto int dbmexists(int dbm_identifier, string key)
- Tells if a value exists for a key in a dbm database */
-PHP_FUNCTION(dbmexists)
-{
- pval *id, *key;
- dbm_info *info;
- int ret;
-
- if (ZEND_NUM_ARGS()!=2||zend_get_parameters(ht,2,&id,&key)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string(key);
-
- info = php_find_dbm(id);
- if (!info) {
- php_error(E_WARNING, "not a valid database identifier %d", Z_LVAL_P(id));
- RETURN_FALSE;
- }
-
- ret = php_dbm_exists(info, Z_STRVAL_P(key));
- RETURN_LONG(ret);
-}
-/* }}} */
-
-/* {{{ php_dbm_exists
- */
-int php_dbm_exists(dbm_info *info, char *key) {
- datum key_datum;
- int ret;
- DBM_TYPE dbf;
-
- key_datum.dptr = key;
- key_datum.dsize = strlen(key);
-#if GDBM_FIX
- key_datum.dsize++;
-#endif
-
- dbf = info->dbf;
- if (!dbf) {
- php_error(E_WARNING, "Unable to locate dbm file");
- return(0);
- }
-
- ret = DBM_EXISTS(dbf, key_datum);
-
- return(ret);
-}
-/* }}} */
-
-/* {{{ proto int dbmdelete(int dbm_identifier, string key)
- Deletes the value for a key from a dbm database */
-PHP_FUNCTION(dbmdelete)
-{
- pval *id, *key;
- dbm_info *info;
- int ret;
-
- if (ZEND_NUM_ARGS()!=2||zend_get_parameters(ht,2,&id,&key)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string(key);
-
- info = php_find_dbm(id);
- if (!info) {
- php_error(E_WARNING, "not a valid database identifier %d", Z_LVAL_P(id));
- RETURN_FALSE;
- }
-
- ret = php_dbm_delete(info, Z_STRVAL_P(key));
- RETURN_LONG(ret);
-}
-/* }}} */
-
-/* {{{ php_dbm_delete
- */
-int php_dbm_delete(dbm_info *info, char *key) {
- datum key_datum;
- int ret;
- DBM_TYPE dbf;
-
- key_datum.dptr = key;
- key_datum.dsize = strlen(key);
-#if GDBM_FIX
- key_datum.dsize++;
-#endif
-
- dbf = info->dbf;
- if (!dbf) {
- php_error(E_WARNING, "Unable to locate dbm file");
- return(0);
- }
-
- ret = DBM_DELETE(dbf, key_datum);
- return(ret);
-}
-/* }}} */
-
-/* {{{ proto string dbmfirstkey(int dbm_identifier)
- Retrieves the first key from a dbm database */
-PHP_FUNCTION(dbmfirstkey)
-{
- pval *id;
- dbm_info *info;
- char *ret;
-
- if (ZEND_NUM_ARGS()!=1||zend_get_parameters(ht,1,&id)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- info = php_find_dbm(id);
- if (!info) {
- php_error(E_WARNING, "not a valid database identifier %d", Z_LVAL_P(id));
- RETURN_FALSE;
- }
-
- ret = php_dbm_first_key(info);
- if (!ret) {
- RETURN_FALSE;
- } else {
- RETVAL_STRING(ret, 0);
- }
-}
-/* }}} */
-
-/* {{{ php_dbm_first_key
- */
-char *php_dbm_first_key(dbm_info *info) {
- datum ret_datum;
- char *ret;
- DBM_TYPE dbf;
-
- dbf = info->dbf;
- if (!dbf) {
- php_error(E_WARNING, "Unable to locate dbm file");
- return(NULL);
- }
-
- /* explicitly zero-out ret_datum */
- ret_datum.dptr = NULL;
- ret_datum.dsize = 0;
-
- ret_datum = DBM_FIRSTKEY(dbf);
-
- if (!ret_datum.dptr)
- return NULL;
-
- ret = (char *)emalloc((ret_datum.dsize + 1) * sizeof(char));
- strncpy(ret, ret_datum.dptr, ret_datum.dsize);
- ret[ret_datum.dsize] = '\0';
-
-#if !NDBM & !GDBM
- efree(ret_datum.dptr);
-#endif
-
- return (ret);
-}
-/* }}} */
-
-/* {{{ proto string dbmnextkey(int dbm_identifier, string key)
- Retrieves the next key from a dbm database */
-PHP_FUNCTION(dbmnextkey)
-{
- pval *id, *key;
- dbm_info *info;
- char *ret;
-
- if (ZEND_NUM_ARGS()!=2||zend_get_parameters(ht,2,&id,&key)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string(key);
-
- info = php_find_dbm(id);
- if (!info) {
- php_error(E_WARNING, "not a valid database identifier %d", Z_LVAL_P(id));
- RETURN_FALSE;
- }
-
- ret = php_dbm_nextkey(info, Z_STRVAL_P(key));
- if (!ret) {
- RETURN_FALSE;
- } else {
- RETVAL_STRING(ret, 0);
- }
-}
-/* }}} */
-
-/* {{{ php_dbm_nextkey
- */
-char *php_dbm_nextkey(dbm_info *info, char *key) {
- datum key_datum, ret_datum;
- char *ret;
- DBM_TYPE dbf;
- PLS_FETCH();
-
- key_datum.dptr = key;
- key_datum.dsize = strlen(key);
-#if GDBM_FIX
- key_datum.dsize++;
-#endif
-
- dbf = info->dbf;
- if (!dbf) {
- php_error(E_WARNING, "Unable to locate dbm file");
- return(NULL);
- }
-
- /* explicitly zero-out ret_datum */
- ret_datum.dptr = NULL;
- ret_datum.dsize = 0;
-
- ret_datum = DBM_NEXTKEY(dbf, key_datum);
-
- if (ret_datum.dptr) {
- ret = (char *)emalloc(sizeof(char) * ret_datum.dsize + 1);
- strncpy(ret, ret_datum.dptr, ret_datum.dsize);
- ret[ret_datum.dsize] = '\0';
-#if GDBM
-/* GDBM uses malloc to allocate the value_datum block, so we need to free it */
- free(ret_datum.dptr);
-#else
-# if !NDBM
- efree(ret_datum.dptr);
-# endif
-#endif
- }
- else ret=NULL;
-
- if (ret && PG(magic_quotes_runtime)) {
- ret = php_addslashes(ret, ret_datum.dsize, NULL, 1);
- }
- return(ret);
-}
-/* }}} */
-
-#if !GDBM && !NDBM
-static long CurrentFlatFilePos = 0L;
-/* {{{ flatfile_store
- */
-int flatfile_store(FILE *dbf, datum key_datum, datum value_datum, int mode) {
- int ret;
-
- if (mode == DBM_INSERT) {
- if (flatfile_findkey(dbf, key_datum)) {
- return 1;
- }
- fseek(dbf,0L,SEEK_END);
- fprintf(dbf,"%d\n",key_datum.dsize);
- fflush(dbf);
- ret = write(fileno(dbf),key_datum.dptr,key_datum.dsize);
- fprintf(dbf,"%d\n",value_datum.dsize);
- fflush(dbf);
- ret = write(fileno(dbf),value_datum.dptr,value_datum.dsize);
- } else { /* DBM_REPLACE */
- flatfile_delete(dbf,key_datum);
- fprintf(dbf,"%d\n",key_datum.dsize);
- fflush(dbf);
- ret = write(fileno(dbf),key_datum.dptr,key_datum.dsize);
- fprintf(dbf,"%d\n",value_datum.dsize);
- ret = write(fileno(dbf),value_datum.dptr,value_datum.dsize);
- }
-
- if (ret>0)
- ret=0;
- return ret;
-}
-/* }}} */
-
-/* {{{ flatfile_fetch
- */
-datum flatfile_fetch(FILE *dbf, datum key_datum) {
- datum value_datum = {NULL, 0};
- int num=0, buf_size=1024;
- char *buf;
-
- if (flatfile_findkey(dbf,key_datum)) {
- buf = emalloc((buf_size+1) * sizeof(char));
- if (fgets(buf, 15, dbf)) {
- num = atoi(buf);
- if (num > buf_size) {
- buf_size+=num;
- buf = emalloc((buf_size+1)*sizeof(char));
- }
- read(fileno(dbf),buf,num);
- value_datum.dptr = buf;
- value_datum.dsize = num;
- }
- }
- return value_datum;
-}
-/* }}} */
-
-/* {{{ flatfile_delete
- */
-int flatfile_delete(FILE *dbf, datum key_datum) {
- char *key = key_datum.dptr;
- int size = key_datum.dsize;
-
- char *buf;
- int num, buf_size = 1024;
- long pos;
-
- rewind(dbf);
-
- buf = emalloc((buf_size + 1)*sizeof(char));
- while(!feof(dbf)) {
- /* read in the length of the key name */
- if (!fgets(buf, 15, dbf))
- break;
- num = atoi(buf);
- if (num > buf_size) {
- buf_size += num;
- if (buf) efree(buf);
- buf = emalloc((buf_size+1)*sizeof(char));
- }
- pos = ftell(dbf);
-
- /* read in the key name */
- num = fread(buf, sizeof(char), num, dbf);
- if (num<0) break;
- *(buf+num) = '\0';
-
- if (size == num && !memcmp(buf, key, size)) {
- fseek(dbf, pos, SEEK_SET);
- fputc(0, dbf);
- fflush(dbf);
- fseek(dbf, 0L, SEEK_END);
- if (buf) efree(buf);
- return SUCCESS;
- }
-
- /* read in the length of the value */
- if (!fgets(buf,15,dbf))
- break;
- num = atoi(buf);
- if (num > buf_size) {
- buf_size+=num;
- if (buf) efree(buf);
- buf = emalloc((buf_size+1)*sizeof(char));
- }
- /* read in the value */
- num = fread(buf, sizeof(char), num, dbf);
- if (num<0)
- break;
- }
- if (buf) efree(buf);
- return FAILURE;
-}
-/* }}} */
-
-/* {{{ flatfile_findkey
- */
-int flatfile_findkey(FILE *dbf, datum key_datum) {
- char *buf = NULL;
- int num;
- int buf_size=1024;
- int ret=0;
- void *key = key_datum.dptr;
- int size = key_datum.dsize;
-
- rewind(dbf);
- buf = emalloc((buf_size+1)*sizeof(char));
- while (!feof(dbf)) {
- if (!fgets(buf,15,dbf)) break;
- num = atoi(buf);
- if (num > buf_size) {
- if (buf) efree(buf);
- buf_size+=num;
- buf = emalloc((buf_size+1)*sizeof(char));
- }
- num = fread(buf, sizeof(char), num, dbf);
- if (num<0) break;
- *(buf+num) = '\0';
- if (size == num) {
- if (!memcmp(buf,key,size)) {
- ret = 1;
- break;
- }
- }
- if (!fgets(buf,15,dbf))
- break;
- num = atoi(buf);
- if (num > buf_size) {
- if (buf) efree(buf);
- buf_size+=num;
- buf = emalloc((buf_size+1)*sizeof(char));
- }
- num = fread(buf, sizeof(char), num, dbf);
- if (num<0) break;
- *(buf+num) = '\0';
- }
- if (buf) efree(buf);
- return(ret);
-}
-/* }}} */
-
-/* {{{ flatfile_firstkey
- */
-datum flatfile_firstkey(FILE *dbf) {
- datum buf;
- int num;
- int buf_size=1024;
-
- rewind(dbf);
- buf.dptr = emalloc((buf_size+1)*sizeof(char));
- while(!feof(dbf)) {
- if (!fgets(buf.dptr,15,dbf)) break;
- num = atoi(buf.dptr);
- if (num > buf_size) {
- buf_size+=num;
- if (buf.dptr) efree(buf.dptr);
- buf.dptr = emalloc((buf_size+1)*sizeof(char));
- }
- num=read(fileno(dbf),buf.dptr,num);
- if (num<0) break;
- buf.dsize = num;
- if (*(buf.dptr)!=0) {
- CurrentFlatFilePos = ftell(dbf);
- return(buf);
- }
- if (!fgets(buf.dptr,15,dbf)) break;
- num = atoi(buf.dptr);
- if (num > buf_size) {
- buf_size+=num;
- if (buf.dptr) efree(buf.dptr);
- buf.dptr = emalloc((buf_size+1)*sizeof(char));
- }
- num=read(fileno(dbf),buf.dptr,num);
- if (num<0) break;
- }
- if (buf.dptr) efree(buf.dptr);
- buf.dptr = NULL;
- return(buf);
-}
-/* }}} */
-
-/* {{{ latfile_nextkey
- */
-datum flatfile_nextkey(FILE *dbf) {
- datum buf;
- int num;
- int buf_size=1024;
-
- fseek(dbf,CurrentFlatFilePos,SEEK_SET);
- buf.dptr = emalloc((buf_size+1)*sizeof(char));
- while(!feof(dbf)) {
- if (!fgets(buf.dptr,15,dbf)) break;
- num = atoi(buf.dptr);
- if (num > buf_size) {
- buf_size+=num;
- if (buf.dptr) efree(buf.dptr);
- buf.dptr = emalloc((buf_size+1)*sizeof(char));
- }
- num=read(fileno(dbf),buf.dptr,num);
- if (num<0) break;
- if (!fgets(buf.dptr,15,dbf)) break;
- num = atoi(buf.dptr);
- if (num > buf_size) {
- buf_size+=num;
- if (buf.dptr) efree(buf.dptr);
- buf.dptr = emalloc((buf_size+1)*sizeof(char));
- }
- num=read(fileno(dbf),buf.dptr,num);
- if (num<0) break;
- buf.dsize = num;
- if (*(buf.dptr)!=0) {
- CurrentFlatFilePos = ftell(dbf);
- return(buf);
- }
- }
- if (buf.dptr) efree(buf.dptr);
- buf.dptr = NULL;
- return(buf);
-}
-/* }}} */
-#endif
-
-/* {{{ PHP_MINIT_FUNCTION
- */
-PHP_MINIT_FUNCTION(db)
-{
-#if defined(THREAD_SAFE)
- dbm_global_struct *dbm_globals;
- PHP_MUTEX_ALLOC(dbm_mutex);
- PHP_MUTEX_LOCK(dbm_mutex);
- numthreads++;
- if (numthreads==1){
- if (!PHP3_TLS_PROC_STARTUP(DbmTls)){
- PHP_MUTEX_UNLOCK(dbm_mutex);
- PHP_MUTEX_FREE(dbm_mutex);
- return FAILURE;
- }
- }
- PHP_MUTEX_UNLOCK(dbm_mutex);
- if(!PHP3_TLS_THREAD_INIT(DbmTls,dbm_globals,dbm_global_struct)){
- PHP_MUTEX_FREE(dbm_mutex);
- return FAILURE;
- }
-#endif
-
- le_db = zend_register_list_destructors_ex(php_dbm_close, NULL, "dbm", module_number);
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_MSHUTDOWN_FUNCTION
- */
-static PHP_MSHUTDOWN_FUNCTION(db)
-{
-#ifdef THREAD_SAFE
- PHP3_TLS_THREAD_FREE(dbm_globals);
- PHP_MUTEX_LOCK(dbm_mutex);
- numthreads--;
- if (numthreads<1) {
- PHP3_TLS_PROC_SHUTDOWN(DbmTls);
- PHP_MUTEX_UNLOCK(dbm_mutex);
- PHP_MUTEX_FREE(dbm_mutex);
- return SUCCESS;
- }
- PHP_MUTEX_UNLOCK(dbm_mutex);
-#endif
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_RINIT_FUNCTION
- */
-PHP_RINIT_FUNCTION(db)
-{
-#if !GDBM && !NDBM
- CurrentFlatFilePos = 0L;
-#endif
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ dbm_functions[]
- */
-function_entry dbm_functions[] = {
- PHP_FE(dblist, NULL)
- PHP_FE(dbmopen, NULL)
- PHP_FE(dbmclose, NULL)
- PHP_FE(dbminsert, NULL)
- PHP_FE(dbmfetch, NULL)
- PHP_FE(dbmreplace, NULL)
- PHP_FE(dbmexists, NULL)
- PHP_FE(dbmdelete, NULL)
- PHP_FE(dbmfirstkey, NULL)
- PHP_FE(dbmnextkey, NULL)
- {NULL,NULL,NULL}
-};
-/* }}} */
-
-zend_module_entry dbm_module_entry = {
- "db", dbm_functions, PHP_MINIT(db), PHP_MSHUTDOWN(db), PHP_RINIT(db), NULL, PHP_MINFO(db), STANDARD_MODULE_PROPERTIES
-};
-
-#ifdef COMPILE_DL_DB
-ZEND_GET_MODULE(dbm)
-#endif
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/db/db.dsp b/ext/db/db.dsp
deleted file mode 100644
index 1b275057ba..0000000000
--- a/ext/db/db.dsp
+++ /dev/null
@@ -1,122 +0,0 @@
-# Microsoft Developer Studio Project File - Name="db" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=db - Win32 Release_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "db.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "db.mak" CFG="db - Win32 Release_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "db - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "db - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "db - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\..\Zend" /I "..\..\..\TSRM" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_DB" /D ZTS=1 /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\main" /D "WIN32" /D "DB_EXPORTS" /D "COMPILE_DL_DB" /D ZTS=1 /D ZEND_DEBUG=0 /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZEND_WIN32" /D "PHP_WIN32" /D "HAVE_INET_ATON" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x406 /d "NDEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib /nologo /dll /machine:I386
-# ADD LINK32 php4ts.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_db.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
-# SUBTRACT LINK32 /pdb:none
-
-!ELSEIF "$(CFG)" == "db - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_DB" /D ZTS=1 /YX /FD /c
-# ADD CPP /nologo /MDd /W3 /GX /ZI /Od /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\main" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "DB_EXPORTS" /D "COMPILE_DL_DB" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D "HAVE_INET_ATON" /FR /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x406 /d "NDEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts_debug.lib /nologo /dll /machine:I386
-# ADD LINK32 libdb31s.lib php4ts_debug.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /incremental:yes /debug /machine:I386 /out:"..\..\Debug_TS/php_db.dll" /libpath:"..\..\Debug_TS"
-
-!ENDIF
-
-# Begin Target
-
-# Name "db - Win32 Release_TS"
-# Name "db - Win32 Debug_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\db.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\standard\flock_compat.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=..\standard\flock_compat.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\php_db.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/ext/db/php_db.h b/ext/db/php_db.h
deleted file mode 100644
index e635033e65..0000000000
--- a/ext/db/php_db.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
- | Jim Winstead <jimw@php.net> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-
-#ifndef PHP_DB_H
-#define PHP_DB_H
-
-
-#ifndef DLEXPORT
-#define DLEXPORT
-#endif
-
-
-extern zend_module_entry dbm_module_entry;
-#define phpext_db_ptr &dbm_module_entry
-
-
-
-typedef struct dbm_info {
- char *filename;
- char *lockfn;
- int lockfd;
- void *dbf;
-} dbm_info;
-
-/*
- we're not going to bother with flatfile on win32
- because the dbm module will be external, and we
- do not want flatfile compiled staticly
-*/
-#if defined(PHP_WIN32) && !defined(COMPILE_DL_DB)
-#undef phpext_db_ptr
-#define phpext_db_ptr NULL
-#endif
-
-dbm_info *php_find_dbm(pval *id);
-int php_dbm_close(zend_rsrc_list_entry *rsrc);
-dbm_info *php_dbm_open(char *filename, char *mode);
-int php_dbm_insert(dbm_info *info, char *key, char *value);
-char *php_dbm_fetch(dbm_info *info, char *key);
-int php_dbm_replace(dbm_info *info, char *key, char *value);
-int php_dbm_exists(dbm_info *info, char *key);
-int php_dbm_delete(dbm_info *info, char *key);
-char *php_dbm_first_key(dbm_info *info);
-char *php_dbm_nextkey(dbm_info *info, char *key);
-
-/* db file functions */
-PHP_MINIT_FUNCTION(db);
-PHP_RINIT_FUNCTION(db);
-PHP_MINFO_FUNCTION(db);
-
-PHP_FUNCTION(dblist);
-PHP_FUNCTION(dbmopen);
-PHP_FUNCTION(dbmclose);
-PHP_FUNCTION(dbminsert);
-PHP_FUNCTION(dbmfetch);
-PHP_FUNCTION(dbmreplace);
-PHP_FUNCTION(dbmexists);
-PHP_FUNCTION(dbmdelete);
-PHP_FUNCTION(dbmfirstkey);
-PHP_FUNCTION(dbmnextkey);
-
-#endif /* PHP_DB_H */
diff --git a/ext/db/tests/001.phpt b/ext/db/tests/001.phpt
deleted file mode 100644
index ea95d3d70a..0000000000
--- a/ext/db/tests/001.phpt
+++ /dev/null
@@ -1,13 +0,0 @@
---TEST--
-DBM File Creation Test
---SKIPIF--
-<?php if (!extension_loaded("db")) print "skip"; ?>
---POST--
---GET--
---FILE--
-<?php
- dbmopen("./test.dbm","n");
- dbmclose("./test.dbm");
-?>
---EXPECT--
-
diff --git a/ext/db/tests/002.phpt b/ext/db/tests/002.phpt
deleted file mode 100644
index d0bc710f08..0000000000
--- a/ext/db/tests/002.phpt
+++ /dev/null
@@ -1,16 +0,0 @@
---TEST--
-DBM Insert/Fetch Test
---SKIPIF--
-<?php if (!extension_loaded("db")) print "skip"; ?>
---POST--
---GET--
---FILE--
-<?php
- dbmopen("./test.dbm","n");
- dbminsert("./test.dbm","key1","This is a test insert");
- $a = dbmfetch("./test.dbm","key1");
- dbmclose("./test.dbm");
- echo $a
-?>
---EXPECT--
-This is a test insert
diff --git a/ext/db/tests/003.phpt b/ext/db/tests/003.phpt
deleted file mode 100644
index 319325c398..0000000000
--- a/ext/db/tests/003.phpt
+++ /dev/null
@@ -1,17 +0,0 @@
---TEST--
-DBM Insert/Replace/Fetch Test
---SKIPIF--
-<?php if (!extension_loaded("db")) print "skip"; ?>
---POST--
---GET--
---FILE--
-<?php
- dbmopen("./test.dbm","n");
- dbminsert("./test.dbm","key1","This is a test insert");
- dbmreplace("./test.dbm","key1","This is the replacement text");
- $a = dbmfetch("./test.dbm","key1");
- dbmclose("./test.dbm");
- echo $a
-?>
---EXPECT--
-This is the replacement text
diff --git a/ext/db/tests/004.phpt b/ext/db/tests/004.phpt
deleted file mode 100644
index 1becfcfdcd..0000000000
--- a/ext/db/tests/004.phpt
+++ /dev/null
@@ -1,21 +0,0 @@
---TEST--
-DBM Multiple Insert/Fetch Test
---SKIPIF--
-<?php if (!extension_loaded("db")) print "skip"; ?>
---POST--
---GET--
---FILE--
-<?php
- dbmopen("./test.dbm","n");
- dbminsert("./test.dbm","key1","Content String 1");
- dbminsert("./test.dbm","key2","Content String 2");
- dbminsert("./test.dbm","key3","Third Content String");
- dbminsert("./test.dbm","key4","Another Content String");
- dbminsert("./test.dbm","key5","The last content string");
- $a = dbmfetch("./test.dbm","key4");
- $b = dbmfetch("./test.dbm","key2");
- dbmclose("./test.dbm");
- echo "$a $b";
-?>
---EXPECT--
-Another Content String Content String 2
diff --git a/ext/db/tests/005.phpt b/ext/db/tests/005.phpt
deleted file mode 100644
index de33201883..0000000000
--- a/ext/db/tests/005.phpt
+++ /dev/null
@@ -1,25 +0,0 @@
---TEST--
-DBM FirstKey/NextKey Loop Test With 5 Items
---SKIPIF--
-<?php if (!extension_loaded("db")) print "skip"; ?>
---POST--
---GET--
---FILE--
-<?php
- dbmopen("./test.dbm","n");
- dbminsert("./test.dbm","key1","Content String 1");
- dbminsert("./test.dbm","key2","Content String 2");
- dbminsert("./test.dbm","key3","Third Content String");
- dbminsert("./test.dbm","key4","Another Content String");
- dbminsert("./test.dbm","key5","The last content string");
- $a = dbmfirstkey("./test.dbm");
- $i=0;
- while($a) {
- $a = dbmnextkey("./test.dbm",$a);
- $i++;
- }
- dbmclose("./test.dbm");
- echo $i
-?>
---EXPECT--
-5
diff --git a/ext/db/tests/006.phpt b/ext/db/tests/006.phpt
deleted file mode 100644
index 3428ce3948..0000000000
--- a/ext/db/tests/006.phpt
+++ /dev/null
@@ -1,27 +0,0 @@
---TEST--
-DBM FirstKey/NextKey with 2 deletes
---SKIPIF--
-<?php if (!extension_loaded("db")) print "skip"; ?>
---POST--
---GET--
---FILE--
-<?php
- dbmopen("./test.dbm","n");
- dbminsert("./test.dbm","key1","Content String 1");
- dbminsert("./test.dbm","key2","Content String 2");
- dbminsert("./test.dbm","key3","Third Content String");
- dbminsert("./test.dbm","key4","Another Content String");
- dbminsert("./test.dbm","key5","The last content string");
- dbmdelete("./test.dbm","key3");
- dbmdelete("./test.dbm","key1");
- $a = dbmfirstkey("./test.dbm");
- $i=0;
- while($a) {
- $a = dbmnextkey("./test.dbm",$a);
- $i++;
- }
- dbmclose("./test.dbm");
- echo $i
-?>
---EXPECT--
-3
diff --git a/ext/dba/CREDITS b/ext/dba/CREDITS
deleted file mode 100644
index 2f06307693..0000000000
--- a/ext/dba/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-DBA
-Sascha Schumann
diff --git a/ext/dba/Makefile.in b/ext/dba/Makefile.in
deleted file mode 100644
index b26ec1b92b..0000000000
--- a/ext/dba/Makefile.in
+++ /dev/null
@@ -1,8 +0,0 @@
-
-LTLIBRARY_NAME = libdba.la
-LTLIBRARY_SOURCES = dba.c dba_cdb.c dba_db2.c dba_dbm.c dba_gdbm.c \
- dba_ndbm.c dba_db3.c
-LTLIBRARY_SHARED_NAME = dba.la
-LTLIBRARY_SHARED_LIBADD = $(DBA_SHARED_LIBADD)
-
-include $(top_srcdir)/build/dynlib.mk
diff --git a/ext/dba/config.m4 b/ext/dba/config.m4
deleted file mode 100644
index 3e220cc5b8..0000000000
--- a/ext/dba/config.m4
+++ /dev/null
@@ -1,235 +0,0 @@
-dnl $Id$
-dnl config.m4 for extension dba
-dnl don't forget to call PHP_EXTENSION(dba)
-
-AC_DEFUN(PHP_TEMP_LDFLAGS,[
- old_LDFLAGS=$LDFLAGS
- LDFLAGS="$1 $LDFLAGS"
- $2
- LDFLAGS=$old_LDFLAGS
-])
-
-
-dnl Assign INCLUDE/LFLAGS from PREFIX
-AC_DEFUN(PHP_DBA_STD_ASSIGN,[
- if test -n "$THIS_PREFIX" && test "$THIS_PREFIX" != "/usr"; then
- THIS_INCLUDE=$THIS_PREFIX/include
- THIS_LFLAGS=$THIS_PREFIX/lib
- fi
-])
-
-dnl Standard check
-AC_DEFUN(PHP_DBA_STD_CHECK,[
- THIS_RESULT="yes"
- if test "$THIS_PREFIX" != "/usr" -a "$THIS_INCLUDE" = ""; then
- AC_MSG_ERROR(cannot find necessary header file(s))
- fi
- if test "$THIS_LIBS" = "" ; then
- AC_MSG_ERROR(cannot find necessary library)
- fi
-])
-
-dnl Attach THIS_x to DBA_x
-AC_DEFUN(PHP_DBA_STD_ATTACH,[
- PHP_ADD_INCLUDE($THIS_INCLUDE)
- PHP_ADD_LIBRARY_WITH_PATH($THIS_LIBS, $THIS_LFLAGS, DBA_SHARED_LIBADD)
- unset THIS_INCLUDE THIS_LIBS THIS_LFLAGS THIS_PREFIX
-])
-
-dnl Print the result message
-AC_DEFUN(AC_DBA_STD_RESULT,[
- if test "$THIS_RESULT" = "yes"; then
- HAVE_DBA=1
- AC_MSG_RESULT(yes)
- else
- AC_MSG_RESULT(no)
- fi
- unset THIS_RESULT
-])
-
-PHP_ARG_ENABLE(dba,whether to enable DBA,
-[ --enable-dba=shared Build DBA as a shared module])
-
-AC_ARG_WITH(gdbm,
-[ --with-gdbm[=DIR] Include GDBM support],[
- if test "$withval" != "no"; then
- for i in /usr/local /usr $withval; do
- if test -f "$i/include/gdbm.h"; then
- THIS_PREFIX="$i"
- fi
- done
-
- unset ac_cv_lib_gdbm_gdbm_open
- PHP_TEMP_LDFLAGS(-L$THIS_PREFIX/lib,[
- AC_CHECK_LIB(gdbm, gdbm_open, [AC_DEFINE(DBA_GDBM, 1, [ ]) THIS_LIBS=gdbm])
- ])
-
- PHP_DBA_STD_ASSIGN
- PHP_DBA_STD_CHECK
- PHP_DBA_STD_ATTACH
- fi
-])
-AC_MSG_CHECKING(for GDBM support)
-AC_DBA_STD_RESULT
-
-AC_ARG_WITH(ndbm,
-[ --with-ndbm[=DIR] Include NDBM support],[
- if test "$withval" != "no"; then
- for i in /usr/local /usr $withval; do
- if test -f "$i/include/db1/ndbm.h" ; then
- THIS_PREFIX=$i
- NDBM_EXTRA=db1/ndbm.h
- elif test -f "$i/include/ndbm.h" ; then
- THIS_PREFIX=$i
- NDBM_EXTRA=ndbm.h
- fi
- done
-
- if test "$NDBM_EXTRA" != ""; then
- AC_DEFINE_UNQUOTED(NDBM_INCLUDE_FILE, "$NDBM_EXTRA", [ ])
- fi
-
- for LIB in db1 ndbm c; do
- PHP_TEMP_LDFLAGS(-L$THIS_PREFIX/lib,[
- AC_CHECK_LIB($LIB, dbm_open, [AC_DEFINE(DBA_NDBM,1, [ ]) THIS_LIBS=$LIB])
- ])
- done
-
- PHP_DBA_STD_ASSIGN
- PHP_DBA_STD_CHECK
- PHP_DBA_STD_ATTACH
- fi
-])
-AC_MSG_CHECKING(for NDBM support)
-AC_DBA_STD_RESULT
-
-AC_ARG_WITH(db2,
-[ --with-db2[=DIR] Include Berkeley DB2 support],[
- if test "$withval" != "no"; then
- for i in /usr/local /usr /usr/BerkeleyDB $withval; do
- if test -f "$i/db2/db.h"; then
- THIS_PREFIX=$i
- DB2_EXTRA=db2
- elif test -f "$i/include/db2/db.h"; then
- THIS_PREFIX=$i
- DB2_EXTRA=db2/db.h
- elif test -f "$i/include/db/db2.h"; then
- THIS_PREFIX=$i
- DB2_EXTRA=db/db2.h
- elif test -f "$i/include/db2.h"; then
- THIS_PREFIX=$i
- DB2_EXTRA=db2.h
- elif test -f "$i/include/db.h" ; then
- THIS_PREFIX=$i
- DB2_EXTRA=db.h
- fi
- done
-
- if test "$DB2_EXTRA" = "db2" ; then
- DBA_INCLUDE="$DBA_INCLUDE -I$THIS_PREFIX/db2"
- DB2_EXTRA=db.h
- fi
-
- if test -n "$DB2_EXTRA"; then
- AC_DEFINE_UNQUOTED(DB2_INCLUDE_FILE, "$DB2_EXTRA", [ ])
- fi
-
- for LIB in db db2 c; do
- PHP_TEMP_LDFLAGS(-L$THIS_PREFIX/lib,[
- AC_CHECK_LIB($LIB, db_appinit, [AC_DEFINE(DBA_DB2,1,[ ]) THIS_LIBS=$LIB])
- ])
- done
-
- PHP_DBA_STD_ASSIGN
- PHP_DBA_STD_CHECK
- PHP_DBA_STD_ATTACH
- fi
-])
-AC_MSG_CHECKING(for Berkeley DB2 support)
-AC_DBA_STD_RESULT
-
-AC_ARG_WITH(db3,
-[ --with-db3[=DIR] Include Berkeley DB3 support],[
- if test "$withval" != "no"; then
- for i in /usr/local /usr /usr/local/BerkeleyDB.3.0 $withval; do
- if test -f "$i/include/db.h" ; then
- THIS_PREFIX=$i
- DB3_EXTRA=db.h
- fi
- done
-
- if test -n "$DB3_EXTRA"; then
- AC_DEFINE_UNQUOTED(DB3_INCLUDE_FILE, "$DB3_EXTRA", [ ])
- fi
-
- for LIB in db db-3 db3; do
- PHP_TEMP_LDFLAGS(-L$THIS_PREFIX/lib,[
- AC_CHECK_LIB($LIB, db_create, [AC_DEFINE(DBA_DB3,1,[ ]) THIS_LIBS=$LIB])
- ])
- done
-
- PHP_DBA_STD_ASSIGN
- PHP_DBA_STD_CHECK
- PHP_DBA_STD_ATTACH
- fi
-])
-AC_MSG_CHECKING(for Berkeley DB3 support)
-AC_DBA_STD_RESULT
-
-AC_ARG_WITH(dbm,
-[ --with-dbm[=DIR] Include DBM support],[
- if test "$withval" != "no"; then
- for i in /usr/local /usr $withval; do
- if test -f "$i/include/dbm.h" ; then
- THIS_PREFIX=$i
- fi
- done
-
- for LIB in db1 dbm c; do
- PHP_TEMP_LDFLAGS(-L$THIS_PREFIX/lib,[
- AC_CHECK_LIB($LIB, dbminit, [AC_DEFINE(DBA_DBM,1,[ ]) THIS_LIBS=$LIB])
- ])
- done
-
- PHP_DBA_STD_ASSIGN
- PHP_DBA_STD_CHECK
- PHP_DBA_STD_ATTACH
- fi
-])
-AC_MSG_CHECKING(for DBM support)
-AC_DBA_STD_RESULT
-
-AC_ARG_WITH(cdb,
-[ --with-cdb[=DIR] Include CDB support],[
- if test "$withval" != "no"; then
- for i in /usr/local /usr $withval; do
- if test -f "$i/include/cdb.h" ; then
- THIS_PREFIX=$i
- fi
- done
-
- for LIB in cdb c; do
- PHP_TEMP_LDFLAGS(-L$THIS_PREFIX/lib,[
- AC_CHECK_LIB($LIB, cdb_bread, [AC_DEFINE(DBA_CDB,1,[ ]) THIS_LIBS=$LIB])
- ])
- done
-
- PHP_DBA_STD_ASSIGN
- PHP_DBA_STD_CHECK
- PHP_DBA_STD_ATTACH
- fi
-])
-AC_MSG_CHECKING(for CDB support)
-AC_DBA_STD_RESULT
-
-AC_MSG_CHECKING(whether to enable DBA interface)
-if test "$HAVE_DBA" = "1"; then
- AC_MSG_RESULT(yes)
- AC_DEFINE(HAVE_DBA, 1, [ ])
- PHP_EXTENSION(dba,$ext_shared)
- PHP_SUBST(DBA_SHARED_LIBADD)
-else
- AC_MSG_RESULT(no)
- AC_DEFINE(HAVE_DBA, 0, [ ])
-fi
-
diff --git a/ext/dba/dba.c b/ext/dba/dba.c
deleted file mode 100644
index e64adaaaf1..0000000000
--- a/ext/dba/dba.c
+++ /dev/null
@@ -1,518 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Sascha Schumann <sascha@schumann.cx> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-
-#if HAVE_DBA
-
-#include "php_dba.h"
-#include "ext/standard/info.h"
-
-#include "php_gdbm.h"
-#include "php_ndbm.h"
-#include "php_dbm.h"
-#include "php_cdb.h"
-#include "php_db2.h"
-#include "php_db3.h"
-
-/* {{{ dba_functions[]
- */
-function_entry dba_functions[] = {
- PHP_FE(dba_open, NULL)
- PHP_FE(dba_popen, NULL)
- PHP_FE(dba_close, NULL)
- PHP_FE(dba_delete, NULL)
- PHP_FE(dba_exists, NULL)
- PHP_FE(dba_fetch, NULL)
- PHP_FE(dba_insert, NULL)
- PHP_FE(dba_replace, NULL)
- PHP_FE(dba_firstkey, NULL)
- PHP_FE(dba_nextkey, NULL)
- PHP_FE(dba_optimize, NULL)
- PHP_FE(dba_sync, NULL)
- {NULL,NULL,NULL}
-};
-/* }}} */
-
-static PHP_MINIT_FUNCTION(dba);
-static PHP_MSHUTDOWN_FUNCTION(dba);
-static PHP_MINFO_FUNCTION(dba);
-
-zend_module_entry dba_module_entry = {
- "dba", dba_functions,
- PHP_MINIT(dba),
- PHP_MSHUTDOWN(dba),
- NULL, NULL,
- PHP_MINFO(dba),
- STANDARD_MODULE_PROPERTIES
-};
-
-#ifdef COMPILE_DL_DBA
-ZEND_GET_MODULE(dba)
-#endif
-
-typedef struct dba_handler {
- char *name;
- int (*open)(dba_info *);
- void (*close)(dba_info *);
- char* (*fetch)(dba_info *, char *, int, int *);
- int (*update)(dba_info *, char *, int, char *, int, int);
- int (*exists)(dba_info *, char *, int);
- int (*delete)(dba_info *, char *, int);
- char* (*firstkey)(dba_info *, int *);
- char* (*nextkey)(dba_info *, int *);
- int (*optimize)(dba_info *);
- int (*sync)(dba_info *);
-} dba_handler;
-
-/* {{{ macromania */
-
-#define DBA_ID_PARS \
- pval **id; \
- dba_info *info = NULL; \
- int type, ac = ZEND_NUM_ARGS()
-
-/* these are used to get the standard arguments */
-
-#define DBA_GET1 \
- if(ac != 1 || zend_get_parameters_ex(ac, &id) != SUCCESS) { \
- WRONG_PARAM_COUNT; \
- }
-
-#define DBA_GET2 \
- pval **key; \
- if(ac != 2 || zend_get_parameters_ex(ac, &key, &id) != SUCCESS) { \
- WRONG_PARAM_COUNT; \
- } \
- convert_to_string_ex(key)
-
-#define DBA_IF_NOT_CORRECT_TYPE(link_id) \
- info = zend_list_find(link_id, &type); \
- if(!info || (type != GLOBAL(le_db) && type != GLOBAL(le_pdb)))
-
-#define DBA_ID_GET \
- convert_to_long_ex(id); \
- DBA_IF_NOT_CORRECT_TYPE(Z_LVAL_PP(id)) { \
- php_error(E_WARNING, "Unable to find DBA identifier %d", \
- Z_LVAL_PP(id)); \
- RETURN_FALSE; \
- }
-
-#define DBA_ID_GET1 DBA_ID_PARS; DBA_GET1; DBA_ID_GET
-#define DBA_ID_GET2 DBA_ID_PARS; DBA_GET2; DBA_ID_GET
-
-/* a DBA handler must have specific routines */
-
-#define DBA_HND(x) \
-{\
- #x, dba_open_##x, dba_close_##x, dba_fetch_##x, dba_update_##x, \
- dba_exists_##x, dba_delete_##x, dba_firstkey_##x, dba_nextkey_##x, \
- dba_optimize_##x, dba_sync_##x \
-},
-
-/* check whether the user has write access */
-#define DBA_WRITE_CHECK \
- if(info->mode != DBA_WRITER && info->mode != DBA_TRUNC && info->mode != DBA_CREAT) { \
- php_error(E_WARNING, "you cannot perform a modification to a database without proper access"); \
- RETURN_FALSE; \
- }
-
-#define GLOBAL(a) a
-
-/* }}} */
-
-/* {{{ globals */
-
-static dba_handler handler[] = {
-#if DBA_GDBM
- DBA_HND(gdbm)
-#endif
-#if DBA_DBM
- DBA_HND(dbm)
-#endif
-#if DBA_NDBM
- DBA_HND(ndbm)
-#endif
-#if DBA_CDB
- DBA_HND(cdb)
-#endif
-#if DBA_DB2
- DBA_HND(db2)
-#endif
-#if DBA_DB3
- DBA_HND(db3)
-#endif
- { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL }
-};
-
-static int le_db;
-static int le_pdb;
-static HashTable ht_keys;
-/* }}} */
-
-/* {{{ dba_close
- */
-static void dba_close(dba_info *info)
-{
- if(info->hnd) info->hnd->close(info);
- if(info->path) free(info->path);
- free(info);
-}
-/* }}} */
-
-/* {{{ dba_close_rsrc
- */
-static void dba_close_rsrc(zend_rsrc_list_entry *rsrc)
-{
- dba_info *info = (dba_info *)rsrc->ptr;
- dba_close(info);
-}
-/* }}} */
-
-/* {{{ PHP_MINIT_FUNCTION
- */
-static PHP_MINIT_FUNCTION(dba)
-{
- zend_hash_init(&ht_keys, 0, NULL, NULL, 1);
- GLOBAL(le_db) = zend_register_list_destructors_ex(dba_close_rsrc, NULL, "dba", module_number);
- GLOBAL(le_pdb) = zend_register_list_destructors_ex(NULL, dba_close_rsrc, "dba persistent", module_number);
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_MSHUTDOWN_FUNCTION
- */
-static PHP_MSHUTDOWN_FUNCTION(dba)
-{
- zend_hash_destroy(&ht_keys);
- return SUCCESS;
-}
-/* }}} */
-
-#include "ext/standard/php_smart_str.h"
-
-/* {{{ PHP_MINFO_FUNCTION
- */
-static PHP_MINFO_FUNCTION(dba)
-{
- dba_handler *hptr;
- smart_str handlers = {0};
-
- for(hptr = handler; hptr->name; hptr++) {
- smart_str_appends(&handlers, hptr->name);
- smart_str_appendc(&handlers, ' ');
- }
-
- php_info_print_table_start();
- php_info_print_table_row(2, "DBA support", "enabled");
- if (handlers.c) {
- smart_str_0(&handlers);
- php_info_print_table_row(2, "Supported handlers", handlers.c);
- smart_str_free(&handlers);
- } else {
- php_info_print_table_row(2, "Supported handlers", "none");
- }
- php_info_print_table_end();
-}
-/* }}} */
-
-/* {{{ php_dba_update
- */
-static void php_dba_update(INTERNAL_FUNCTION_PARAMETERS, int mode)
-{
- DBA_ID_PARS;
- pval **val, **key;
-
- if(ac != 3 || zend_get_parameters_ex(ac, &key, &val, &id) != SUCCESS) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(key);
- convert_to_string_ex(val);
- DBA_ID_GET;
-
- DBA_WRITE_CHECK;
-
- if(info->hnd->update(info, VALLEN(key), VALLEN(val), mode) == SUCCESS)
- RETURN_TRUE;
- RETURN_FALSE;
-}
-/* }}} */
-
-#define FREENOW if(args) efree(args); if(key) efree(key)
-
-/* {{{ php_dba_open
- */
-static void php_dba_open(INTERNAL_FUNCTION_PARAMETERS, int persistent)
-{
- pval ***args = (pval ***) NULL;
- int ac = ZEND_NUM_ARGS();
- dba_mode_t modenr;
- dba_info *info;
- dba_handler *hptr;
- char *key = NULL;
- int keylen = 0;
- int listid;
- int i;
-
- if(ac < 3) {
- WRONG_PARAM_COUNT;
- }
-
- /* we pass additional args to the respective handler */
- args = emalloc(ac * sizeof(pval *));
- if(zend_get_parameters_array_ex(ac, args) != SUCCESS) {
- FREENOW;
- WRONG_PARAM_COUNT;
- }
-
- /* we only take string arguments */
- for(i = 0; i < ac; i++) {
- convert_to_string_ex(args[i]);
- keylen += Z_STRLEN_PP(args[i]);
- }
-
- if(persistent) {
- /* calculate hash */
- key = emalloc(keylen);
- keylen = 0;
-
- for(i = 0; i < ac; i++) {
- memcpy(key+keylen,Z_STRVAL_PP(args[i]),Z_STRLEN_PP(args[i]));
- keylen += Z_STRLEN_PP(args[i]);
- }
-
- if(zend_hash_find(&ht_keys, key, keylen, (void **) &info) == SUCCESS) {
- FREENOW;
- RETURN_LONG(zend_list_insert(info, GLOBAL(le_pdb)));
- }
- }
-
- for(hptr = handler; hptr->name &&
- strcasecmp(hptr->name, (*args[2])->value.str.val); hptr++);
-
- if(!hptr->name) {
- php_error(E_WARNING, "no such handler: %s", (*args[2])->value.str.val);
- FREENOW;
- RETURN_FALSE;
- }
-
- switch((*args[1])->value.str.val[0]) {
- case 'c':
- modenr = DBA_CREAT;
- break;
- case 'w':
- modenr = DBA_WRITER;
- break;
- case 'r':
- modenr = DBA_READER;
- break;
- case 'n':
- modenr = DBA_TRUNC;
- break;
- default:
- php_error(E_WARNING,"illegal DBA mode: %s",(*args[1])->value.str.val);
- FREENOW;
- RETURN_FALSE;
- }
-
- info = malloc(sizeof(*info));
- memset(info, 0, sizeof(info));
- info->path = strdup((*args[0])->value.str.val);
- info->mode = modenr;
- info->argc = ac - 3;
- info->argv = args + 3;
- info->hnd = NULL;
-
- if(hptr->open(info) != SUCCESS) {
- dba_close(info);
- php_error(E_WARNING, "driver initialization failed");
- FREENOW;
- RETURN_FALSE;
- }
- info->hnd = hptr;
- info->argc = 0;
- info->argv = NULL;
-
- listid = zend_list_insert(info, persistent?GLOBAL(le_pdb):GLOBAL(le_db));
- if(persistent) {
- zend_hash_update(&ht_keys, key, keylen, info, sizeof(*info), NULL);
- }
-
- FREENOW;
- RETURN_LONG(listid);
-}
-/* }}} */
-#undef FREENOW
-
-/* {{{ proto int dba_popen(string path, string mode, string handlername [, string ...])
- Opens path using the specified handler in mode persistently */
-PHP_FUNCTION(dba_popen)
-{
- php_dba_open(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
-}
-/* }}} */
-
-/* {{{ proto int dba_open(string path, string mode, string handlername [, string ...])
- Opens path using the specified handler in mode*/
-PHP_FUNCTION(dba_open)
-{
- php_dba_open(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-/* }}} */
-
-/* {{{ proto void dba_close(int handle)
- Closes database */
-PHP_FUNCTION(dba_close)
-{
- DBA_ID_GET1;
-
- zend_list_delete(Z_LVAL_PP(id));
-}
-/* }}} */
-
-/* {{{ proto bool dba_exists(string key, int handle)
- Checks, if the specified key exists */
-PHP_FUNCTION(dba_exists)
-{
- DBA_ID_GET2;
-
- if(info->hnd->exists(info, VALLEN(key)) == SUCCESS) {
- RETURN_TRUE;
- }
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto string dba_fetch(string key, int handle)
- Fetches the data associated with key */
-PHP_FUNCTION(dba_fetch)
-{
- char *val;
- int len = 0;
- DBA_ID_GET2;
-
- if((val = info->hnd->fetch(info, VALLEN(key), &len)) != NULL) {
- RETURN_STRINGL(val, len, 0);
- }
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto string dba_firstkey(int handle)
- Resets the internal key pointer and returns the first key */
-PHP_FUNCTION(dba_firstkey)
-{
- char *fkey;
- int len;
- DBA_ID_GET1;
-
- fkey = info->hnd->firstkey(info, &len);
- if(fkey)
- RETURN_STRINGL(fkey, len, 0);
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto string dba_nextkey(int handle)
- Returns the next key */
-PHP_FUNCTION(dba_nextkey)
-{
- char *nkey;
- int len;
- DBA_ID_GET1;
-
- nkey = info->hnd->nextkey(info, &len);
- if(nkey)
- RETURN_STRINGL(nkey, len, 0);
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto bool dba_delete(string key, int handle)
- Deletes the entry associated with key */
-PHP_FUNCTION(dba_delete)
-{
- DBA_ID_GET2;
-
- DBA_WRITE_CHECK;
-
- if(info->hnd->delete(info, VALLEN(key)) == SUCCESS)
- RETURN_TRUE;
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto bool dba_insert(string key, string value, int handle)
- Inserts value as key, returns false, if key exists already */
-PHP_FUNCTION(dba_insert)
-{
- php_dba_update(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
-}
-/* }}} */
-
-/* {{{ proto bool dba_replace(string key, string value, int handle)
- Inserts value as key, replaces key, if key exists already */
-PHP_FUNCTION(dba_replace)
-{
- php_dba_update(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-/* }}} */
-
-/* {{{ proto bool dba_optimize(int handle)
- Optimizes (e.g. clean up, vacuum) database */
-PHP_FUNCTION(dba_optimize)
-{
- DBA_ID_GET1;
-
- DBA_WRITE_CHECK;
- if(info->hnd->optimize(info) == SUCCESS) {
- RETURN_TRUE;
- }
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto bool dba_sync(int handle)
- Synchronizes database */
-PHP_FUNCTION(dba_sync)
-{
- DBA_ID_GET1;
-
- if(info->hnd->sync(info) == SUCCESS) {
- RETURN_TRUE;
- }
- RETURN_FALSE;
-}
-/* }}} */
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/dba/dba.dsp b/ext/dba/dba.dsp
deleted file mode 100644
index bcea596d59..0000000000
--- a/ext/dba/dba.dsp
+++ /dev/null
@@ -1,157 +0,0 @@
-# Microsoft Developer Studio Project File - Name="dba" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=dba - Win32 Debug_TS Berkeley DB3
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "dba.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "dba.mak" CFG="dba - Win32 Debug_TS Berkeley DB3"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "dba - Win32 Release_TS Berkeley DB3" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "dba - Win32 Debug_TS Berkeley DB3" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "dba - Win32 Release_TS Berkeley DB3"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\main" /D ZEND_DEBUG=0 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "PHP_EXPORTS" /D "COMPILE_DL_DBA" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_DBA=1 /D DBA_DB3=1 /D DB3_INCLUDE_FILE="db.h" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\main" /D ZEND_DEBUG=0 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "PHP_EXPORTS" /D "COMPILE_DL_DBA" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_DBA=1 /D DBA_DB3=1 /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x407 /d "NDEBUG"
-# ADD RSC /l 0x407 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 php4ts.lib libdb31s.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_dba.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
-# ADD LINK32 php4ts.lib libdb31s.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_dba.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
-
-!ELSEIF "$(CFG)" == "dba - Win32 Debug_TS Berkeley DB3"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\main" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "PHP_EXPORTS" /D "COMPILE_DL_DBA" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_DBA=1 /D "DBA_DB3" /D DB3_INCLUDE_FILE="db.h" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\main" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "PHP_EXPORTS" /D "COMPILE_DL_DBA" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_DBA=1 /D "DBA_DB3" /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x407 /d "_DEBUG"
-# ADD RSC /l 0x407 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 php4ts_debug.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"..\..\Debug_TS/php_dba.dll" /pdbtype:sept /libpath:"..\..\Debug_TS"
-# ADD LINK32 php4ts_debug.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"..\..\Debug_TS/php_dba.dll" /pdbtype:sept /libpath:"..\..\Debug_TS"
-
-!ENDIF
-
-# Begin Target
-
-# Name "dba - Win32 Release_TS Berkeley DB3"
-# Name "dba - Win32 Debug_TS Berkeley DB3"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\dba.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\dba_cdb.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\dba_db2.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\dba_db3.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\dba_dbm.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\dba_gdbm.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\dba_ndbm.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_cdb.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\php_db2.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\php_db3.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\php_dba.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\php_dbm.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\php_gdbm.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\php_ndbm.h
-# End Source File
-# End Group
-# End Target
-# End Project
diff --git a/ext/dba/dba_cdb.c b/ext/dba/dba_cdb.c
deleted file mode 100644
index 2419a8f563..0000000000
--- a/ext/dba/dba_cdb.c
+++ /dev/null
@@ -1,218 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Sascha Schumann <sascha@schumann.cx> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#include "php.h"
-
-#if DBA_CDB
-#include "php_cdb.h"
-
-#include <sys/types.h>
-#include <unistd.h>
-#include <fcntl.h>
-
-#include <cdb.h>
-#include <cdbmake.h>
-
-#define CDB_INFO \
- dba_cdb *cdb = (dba_cdb *) info->dbf
-
-typedef struct {
- int fd;
- uint32 eod; /* size of constant database */
- uint32 pos; /* current position for traversing */
-} dba_cdb;
-
-DBA_OPEN_FUNC(cdb)
-{
- int gmode = 0;
- dba_cdb *cdb;
- dba_info *pinfo = (dba_info *) info;
-
- switch(info->mode) {
- case DBA_READER:
- gmode = O_RDONLY; break;
- /* currently not supported: */
-#if 0
- case DBA_WRITER:
- gmode = O_RDWR; break;
-#endif
- default:
- return FAILURE;
- }
-
- cdb = malloc(sizeof *cdb);
- memset(cdb, 0, sizeof *cdb);
-
- cdb->fd = VCWD_OPEN((info->path, gmode));
- if(cdb->fd < 0) {
- free(cdb);
- return FAILURE;
- }
-
- pinfo->dbf = cdb;
- return SUCCESS;
-}
-
-DBA_CLOSE_FUNC(cdb)
-{
- CDB_INFO;
-
- close(cdb->fd);
- free(cdb);
-}
-
-DBA_FETCH_FUNC(cdb)
-{
- CDB_INFO;
- int len;
- char *new = NULL;
-
- if(cdb_seek(cdb->fd, key, keylen, &len) == 1) {
- new = emalloc(len);
- read(cdb->fd, new, len);
- if(newlen) *newlen = len;
- }
-
- return new;
-}
-
-DBA_UPDATE_FUNC(cdb)
-{
- /* if anyone figures out cdbmake.c, let me know */
- return FAILURE;
-}
-
-DBA_EXISTS_FUNC(cdb)
-{
- CDB_INFO;
- int len;
-
- if(cdb_seek(cdb->fd, key, keylen, &len) == 1)
- return SUCCESS;
- return FAILURE;
-}
-
-DBA_DELETE_FUNC(cdb)
-{
- return FAILURE;
-}
-
-
-#define CREAD(n) if(read(cdb->fd, buf, n) < n) return NULL
-#define CSEEK(n) \
- if(n >= cdb->eod) return NULL; \
- if(lseek(cdb->fd, (off_t)n, SEEK_SET) != (off_t) n) return NULL
-
-DBA_FIRSTKEY_FUNC(cdb)
-{
- CDB_INFO;
- uint32 len;
- char buf[8];
- char *key;
-
- cdb->eod = -1;
- CSEEK(0);
- CREAD(4);
- cdb->eod = cdb_unpack(buf);
-
- CSEEK(2048);
- CREAD(8);
- len = cdb_unpack(buf);
-
- key = emalloc(len + 1);
- if(read(cdb->fd, key, len) < len) {
- efree(key);
- key = NULL;
- } else
- key[len] = '\0';
- /* header + klenlen + dlenlen + klen + dlen */
- cdb->pos = 2048 + 4 + 4 + len + cdb_unpack(buf + 4);
-
- return key;
-}
-
-DBA_NEXTKEY_FUNC(cdb)
-{
- CDB_INFO;
- uint32 len;
- char buf[8];
- char *nkey;
-
- CSEEK(cdb->pos);
- CREAD(8);
- len = cdb_unpack(buf);
-
- nkey = emalloc(len + 1);
- if(read(cdb->fd, nkey, len) < len) {
- efree(nkey);
- return NULL;
- }
- nkey[len] = '\0';
- if(newlen) *newlen = len;
-
- cdb->pos += 8 + len + cdb_unpack(buf + 4);
-
- return nkey;
-#if 0
- /* this code cdb_seeks and is thus slower than directly seeking
- in the file */
- CDB_INFO;
- char *nkey = NULL;
- uint32 len;
- char buf[8];
-
- if(cdb_seek(cdb->fd, key, keylen, &len) == 1) {
- if(lseek(cdb->fd, (off_t) len, SEEK_CUR) >= (off_t) cdb->eod)
- return NULL;
- CREAD(8);
- len = cdb_unpack(buf);
-
- nkey = emalloc(len + 1);
- if(read(cdb->fd, nkey, len) < len) {
- efree(nkey);
- nkey = NULL;
- } else
- nkey[len] = '\0';
- }
- return nkey;
-#endif
-}
-
-DBA_OPTIMIZE_FUNC(cdb)
-{
- return SUCCESS;
-}
-
-DBA_SYNC_FUNC(cdb)
-{
- /* this is read-only */
- return SUCCESS;
-}
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/dba/dba_db2.c b/ext/dba/dba_db2.c
deleted file mode 100644
index 3e25fcde52..0000000000
--- a/ext/dba/dba_db2.c
+++ /dev/null
@@ -1,199 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Sascha Schumann <sascha@schumann.cx> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#include "php.h"
-
-#if DBA_DB2
-#include "php_db2.h"
-#include <sys/stat.h>
-
-#include <string.h>
-#ifdef DB2_INCLUDE_FILE
-#include DB2_INCLUDE_FILE
-#endif
-
-#define DB2_DATA dba_db2_data *dba = info->dbf
-#define DB2_GKEY \
- DBT gkey; \
- memset(&gkey, 0, sizeof(gkey)); \
- gkey.data = (char *) key; gkey.size = keylen
-
-typedef struct {
- DB *dbp;
- DBC *cursor;
-} dba_db2_data;
-
-DBA_OPEN_FUNC(db2)
-{
- DB *dbp;
- DBTYPE type;
- int gmode = 0;
- int filemode = 0644;
- struct stat check_stat;
-
- type = info->mode == DBA_READER ? DB_UNKNOWN :
- info->mode == DBA_TRUNC ? DB_BTREE :
- VCWD_STAT(info->path, &check_stat) ? DB_BTREE : DB_UNKNOWN;
-
- gmode = info->mode == DBA_READER ? DB_RDONLY :
- info->mode == DBA_CREAT ? DB_CREATE :
- info->mode == DBA_WRITER ? 0 :
- info->mode == DBA_TRUNC ? DB_CREATE | DB_TRUNCATE : -1;
-
- if(gmode == -1)
- return FAILURE;
-
- if(info->argc > 0) {
- convert_to_long_ex(info->argv[0]);
- filemode = (*info->argv[0])->value.lval;
- }
-
- if(!db_open(info->path, type, gmode, filemode, NULL, NULL, &dbp)) {
- info->dbf = malloc(sizeof(dba_db2_data));
- memset(info->dbf, 0, sizeof(dba_db2_data));
- ((dba_db2_data *) info->dbf)->dbp = dbp;
- return SUCCESS;
- }
- return FAILURE;
-}
-
-DBA_CLOSE_FUNC(db2)
-{
- DB2_DATA;
-
- if(dba->cursor) dba->cursor->c_close(dba->cursor);
- dba->dbp->close(dba->dbp, 0);
- free(dba);
-}
-
-DBA_FETCH_FUNC(db2)
-{
- DBT gval;
- char *new = NULL;
- DB2_DATA;
- DB2_GKEY;
-
- memset(&gval, 0, sizeof(gval));
- if(!dba->dbp->get(dba->dbp, NULL, &gkey, &gval, 0)) {
- if(newlen) *newlen = gval.size;
- new = estrndup(gval.data, gval.size);
- }
- return new;
-}
-
-DBA_UPDATE_FUNC(db2)
-{
- DBT gval;
- DB2_DATA;
- DB2_GKEY;
-
- memset(&gval, 0, sizeof(gval));
- gval.data = (char *) val;
- gval.size = vallen;
-
- if(!dba->dbp->put(dba->dbp, NULL, &gkey, &gval,
- mode == 1 ? DB_NOOVERWRITE : 0)) {
- return SUCCESS;
- }
- return FAILURE;
-}
-
-DBA_EXISTS_FUNC(db2)
-{
- DBT gval;
- DB2_DATA;
- DB2_GKEY;
-
- memset(&gval, 0, sizeof(gval));
- if(!dba->dbp->get(dba->dbp, NULL, &gkey, &gval, 0)) {
- return SUCCESS;
- }
- return FAILURE;
-}
-
-DBA_DELETE_FUNC(db2)
-{
- DB2_DATA;
- DB2_GKEY;
-
- return dba->dbp->del(dba->dbp, NULL, &gkey, 0) ? FAILURE : SUCCESS;
-}
-
-DBA_FIRSTKEY_FUNC(db2)
-{
- DB2_DATA;
-
- if(dba->cursor) {
- dba->cursor->c_close(dba->cursor);
- }
-
- dba->cursor = NULL;
-#if (DB_VERSION_MAJOR > 2) || (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR > 6) || (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 6 && DB_VERSION_PATCH >= 4)
- if(dba->dbp->cursor(dba->dbp, NULL, &dba->cursor, 0)) {
-#else
- if(dba->dbp->cursor(dba->dbp, NULL, &dba->cursor)) {
-#endif
- return NULL;
- }
-
- /* we should introduce something like PARAM_PASSTHRU... */
- return dba_nextkey_db2(info, newlen);
-}
-
-DBA_NEXTKEY_FUNC(db2)
-{
- DB2_DATA;
- DBT gkey, gval;
- char *nkey = NULL;
-
- memset(&gkey, 0, sizeof(gkey));
- memset(&gval, 0, sizeof(gval));
-
- if(!dba->cursor->c_get(dba->cursor, &gkey, &gval, DB_NEXT)) {
- if(gkey.data) {
- nkey = estrndup(gkey.data, gkey.size);
- if(newlen) *newlen = gkey.size;
- }
- }
- return nkey;
-}
-
-DBA_OPTIMIZE_FUNC(db2)
-{
- return SUCCESS;
-}
-
-DBA_SYNC_FUNC(db2)
-{
- DB2_DATA;
-
- return dba->dbp->sync(dba->dbp, 0) ? FAILURE : SUCCESS;
-}
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/dba/dba_db3.c b/ext/dba/dba_db3.c
deleted file mode 100644
index a885cf26c6..0000000000
--- a/ext/dba/dba_db3.c
+++ /dev/null
@@ -1,206 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Sascha Schumann <sascha@schumann.cx> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#include "php.h"
-
-#if DBA_DB3
-#include "php_db3.h"
-#include <sys/stat.h>
-
-#include <string.h>
-#ifdef DB3_INCLUDE_FILE
-#include DB3_INCLUDE_FILE
-#else
-#include <db.h>
-#endif
-
-#define DB3_DATA dba_db3_data *dba = info->dbf
-#define DB3_GKEY \
- DBT gkey; \
- memset(&gkey, 0, sizeof(gkey)); \
- gkey.data = (char *) key; gkey.size = keylen
-
-typedef struct {
- DB *dbp;
- DBC *cursor;
-} dba_db3_data;
-
-DBA_OPEN_FUNC(db3)
-{
- DB *dbp = NULL;
- DBTYPE type;
- int gmode = 0;
- int filemode = 0644;
- struct stat check_stat;
-
- type = info->mode == DBA_READER ? DB_UNKNOWN :
- info->mode == DBA_TRUNC ? DB_BTREE :
- VCWD_STAT(info->path, &check_stat) ? DB_BTREE : DB_UNKNOWN;
-
- gmode = info->mode == DBA_READER ? DB_RDONLY :
- info->mode == DBA_CREAT ? DB_CREATE :
- info->mode == DBA_WRITER ? 0 :
- info->mode == DBA_TRUNC ? DB_CREATE | DB_TRUNCATE : -1;
-
- if (gmode == -1)
- return FAILURE;
-
- if (info->argc > 0) {
- convert_to_long_ex(info->argv[0]);
- filemode = (*info->argv[0])->value.lval;
- }
-
- if (db_create(&dbp, NULL, 0) == 0 &&
- dbp->open(dbp, info->path, NULL, type, gmode, filemode) == 0) {
- dba_db3_data *data;
-
- data = malloc(sizeof(*data));
- data->dbp = dbp;
- data->cursor = NULL;
- info->dbf = data;
-
- return SUCCESS;
- } else if (dbp != NULL) {
- dbp->close(dbp, 0);
- }
-
- return FAILURE;
-}
-
-DBA_CLOSE_FUNC(db3)
-{
- DB3_DATA;
-
- if (dba->cursor) dba->cursor->c_close(dba->cursor);
- dba->dbp->close(dba->dbp, 0);
- free(dba);
-}
-
-DBA_FETCH_FUNC(db3)
-{
- DBT gval;
- char *new = NULL;
- DB3_DATA;
- DB3_GKEY;
-
- memset(&gval, 0, sizeof(gval));
- if (!dba->dbp->get(dba->dbp, NULL, &gkey, &gval, 0)) {
- if (newlen) *newlen = gval.size;
- new = estrndup(gval.data, gval.size);
- }
- return new;
-}
-
-DBA_UPDATE_FUNC(db3)
-{
- DBT gval;
- DB3_DATA;
- DB3_GKEY;
-
- memset(&gval, 0, sizeof(gval));
- gval.data = (char *) val;
- gval.size = vallen;
-
- if (!dba->dbp->put(dba->dbp, NULL, &gkey, &gval,
- mode == 1 ? DB_NOOVERWRITE : 0)) {
- return SUCCESS;
- }
- return FAILURE;
-}
-
-DBA_EXISTS_FUNC(db3)
-{
- DBT gval;
- DB3_DATA;
- DB3_GKEY;
-
- memset(&gval, 0, sizeof(gval));
- if (!dba->dbp->get(dba->dbp, NULL, &gkey, &gval, 0)) {
- return SUCCESS;
- }
- return FAILURE;
-}
-
-DBA_DELETE_FUNC(db3)
-{
- DB3_DATA;
- DB3_GKEY;
-
- return dba->dbp->del(dba->dbp, NULL, &gkey, 0) ? FAILURE : SUCCESS;
-}
-
-DBA_FIRSTKEY_FUNC(db3)
-{
- DB3_DATA;
-
- if (dba->cursor) {
- dba->cursor->c_close(dba->cursor);
- }
-
- dba->cursor = NULL;
- if (dba->dbp->cursor(dba->dbp, NULL, &dba->cursor, 0) != 0) {
- return NULL;
- }
-
- /* we should introduce something like PARAM_PASSTHRU... */
- return dba_nextkey_db3(info, newlen);
-}
-
-DBA_NEXTKEY_FUNC(db3)
-{
- DB3_DATA;
- DBT gkey, gval;
- char *nkey = NULL;
-
- memset(&gkey, 0, sizeof(gkey));
- memset(&gval, 0, sizeof(gval));
-
- if (dba->cursor->c_get(dba->cursor, &gkey, &gval, DB_NEXT) == 0) {
- if (gkey.data) {
- nkey = estrndup(gkey.data, gkey.size);
- if (newlen) *newlen = gkey.size;
- }
- }
-
- return nkey;
-}
-
-DBA_OPTIMIZE_FUNC(db3)
-{
- return SUCCESS;
-}
-
-DBA_SYNC_FUNC(db3)
-{
- DB3_DATA;
-
- return dba->dbp->sync(dba->dbp, 0) ? FAILURE : SUCCESS;
-}
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/dba/dba_dbm.c b/ext/dba/dba_dbm.c
deleted file mode 100644
index cf087b37e3..0000000000
--- a/ext/dba/dba_dbm.c
+++ /dev/null
@@ -1,184 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Sascha Schumann <sascha@schumann.cx> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#include "php.h"
-
-#if DBA_DBM
-#include "php_dbm.h"
-
-#include <dbm.h>
-
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-
-#define DBM_DATA dba_dbm_data *dba = info->dbf
-#define DBM_GKEY datum gkey; gkey.dptr = (char *) key; gkey.dsize = keylen
-
-#define TRUNC_IT(extension, mode) \
- snprintf(buf, MAXPATHLEN, "%s" extension, info->path); \
- buf[MAXPATHLEN-1] = '\0'; \
- if((fd = VCWD_OPEN((buf, O_CREAT | mode | O_WRONLY, filemode))) == -1) \
- return FAILURE; \
- close(fd);
-
-
-typedef struct {
- datum nextkey;
-} dba_dbm_data;
-
-DBA_OPEN_FUNC(dbm)
-{
- int fd;
- int filemode = 0644;
-
- if(info->argc > 0) {
- convert_to_long_ex(info->argv[0]);
- filemode = (*info->argv[0])->value.lval;
- }
-
- if(info->mode == DBA_TRUNC) {
- char buf[MAXPATHLEN];
-
- /* dbm/ndbm original */
- TRUNC_IT(".pag", O_TRUNC);
- TRUNC_IT(".dir", O_TRUNC);
- }
-
- if(info->mode == DBA_CREAT) {
- char buf[MAXPATHLEN];
-
- TRUNC_IT(".pag", 0);
- TRUNC_IT(".dir", 0);
- }
-
- if(dbminit((char *) info->path) == -1) {
- return FAILURE;
- }
-
- info->dbf = calloc(sizeof(dba_dbm_data), 1);
- return SUCCESS;
-}
-
-DBA_CLOSE_FUNC(dbm)
-{
- free(info->dbf);
- dbmclose();
-}
-
-DBA_FETCH_FUNC(dbm)
-{
- datum gval;
- char *new = NULL;
-
- DBM_GKEY;
- gval = fetch(gkey);
- if(gval.dptr) {
- if(newlen) *newlen = gval.dsize;
- new = estrndup(gval.dptr, gval.dsize);
- }
- return new;
-}
-
-DBA_UPDATE_FUNC(dbm)
-{
- datum gval;
-
- DBM_GKEY;
- gval.dptr = (char *) val;
- gval.dsize = vallen;
-
- return (store(gkey, gval) == -1 ? FAILURE : SUCCESS);
-}
-
-DBA_EXISTS_FUNC(dbm)
-{
- datum gval;
- DBM_GKEY;
-
- gval = fetch(gkey);
- if(gval.dptr) {
- return SUCCESS;
- }
- return FAILURE;
-}
-
-DBA_DELETE_FUNC(dbm)
-{
- DBM_GKEY;
- return(delete(gkey) == -1 ? FAILURE : SUCCESS);
-}
-
-DBA_FIRSTKEY_FUNC(dbm)
-{
- DBM_DATA;
- datum gkey;
- char *key = NULL;
-
- gkey = firstkey();
- if(gkey.dptr) {
- if(newlen) *newlen = gkey.dsize;
- key = estrndup(gkey.dptr, gkey.dsize);
- dba->nextkey = gkey;
- } else
- dba->nextkey.dptr = NULL;
- return key;
-}
-
-DBA_NEXTKEY_FUNC(dbm)
-{
- DBM_DATA;
- datum gkey;
- char *nkey = NULL;
-
- if(!dba->nextkey.dptr) return NULL;
-
- gkey = nextkey(dba->nextkey);
- if(gkey.dptr) {
- if(newlen) *newlen = gkey.dsize;
- nkey = estrndup(gkey.dptr, gkey.dsize);
- dba->nextkey = gkey;
- } else
- dba->nextkey.dptr = NULL;
- return nkey;
-}
-
-DBA_OPTIMIZE_FUNC(dbm)
-{
- /* dummy */
- return SUCCESS;
-}
-
-DBA_SYNC_FUNC(dbm)
-{
- return SUCCESS;
-}
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/dba/dba_gdbm.c b/ext/dba/dba_gdbm.c
deleted file mode 100644
index 5f7dd4ede8..0000000000
--- a/ext/dba/dba_gdbm.c
+++ /dev/null
@@ -1,187 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Sascha Schumann <sascha@schumann.cx> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#include "php.h"
-
-#if DBA_GDBM
-#include "php_gdbm.h"
-
-#include <gdbm.h>
-
-#define GDBM_DATA dba_gdbm_data *dba = info->dbf
-#define GDBM_GKEY datum gkey; gkey.dptr = (char *) key; gkey.dsize = keylen
-
-typedef struct {
- GDBM_FILE dbf;
- datum nextkey;
-} dba_gdbm_data;
-
-DBA_OPEN_FUNC(gdbm)
-{
- GDBM_FILE dbf;
- int gmode = 0;
- int filemode = 0644;
-
- gmode = info->mode == DBA_READER ? GDBM_READER :
- info->mode == DBA_WRITER ? GDBM_WRITER :
- info->mode == DBA_CREAT ? GDBM_WRCREAT :
- info->mode == DBA_TRUNC ? GDBM_NEWDB : -1;
-
- if(gmode == -1)
- return FAILURE;
-
- if(info->argc > 0) {
- convert_to_long_ex(info->argv[0]);
- filemode = (*info->argv[0])->value.lval;
- }
-
- dbf = gdbm_open(info->path, 0, gmode, filemode, NULL);
-
- if(dbf) {
- info->dbf = malloc(sizeof(dba_gdbm_data));
- memset(info->dbf, 0, sizeof(dba_gdbm_data));
- ((dba_gdbm_data *) info->dbf)->dbf = dbf;
- return SUCCESS;
- }
- return FAILURE;
-}
-
-DBA_CLOSE_FUNC(gdbm)
-{
- GDBM_DATA;
-
- if(dba->nextkey.dptr) free(dba->nextkey.dptr);
- gdbm_close(dba->dbf);
- free(dba);
-}
-
-DBA_FETCH_FUNC(gdbm)
-{
- GDBM_DATA;
- datum gval;
- char *new = NULL;
-
- GDBM_GKEY;
- gval = gdbm_fetch(dba->dbf, gkey);
- if(gval.dptr) {
- if(newlen) *newlen = gval.dsize;
- new = estrndup(gval.dptr, gval.dsize);
- free(gval.dptr);
- }
- return new;
-}
-
-DBA_UPDATE_FUNC(gdbm)
-{
- datum gval;
- GDBM_DATA;
-
- GDBM_GKEY;
- gval.dptr = (char *) val;
- gval.dsize = vallen;
-
- if(gdbm_store(dba->dbf, gkey, gval,
- mode == 1 ? GDBM_INSERT : GDBM_REPLACE) == 0)
- return SUCCESS;
- printf("XXX %s\n", gdbm_strerror(gdbm_errno));
- return FAILURE;
-}
-
-DBA_EXISTS_FUNC(gdbm)
-{
- GDBM_DATA;
- GDBM_GKEY;
-
- return gdbm_exists(dba->dbf, gkey) ? SUCCESS : FAILURE;
-}
-
-DBA_DELETE_FUNC(gdbm)
-{
- GDBM_DATA;
- GDBM_GKEY;
-
- return gdbm_delete(dba->dbf, gkey) == -1 ? FAILURE : SUCCESS;
-}
-
-DBA_FIRSTKEY_FUNC(gdbm)
-{
- GDBM_DATA;
- datum gkey;
- char *key = NULL;
-
- if(dba->nextkey.dptr) {
- free(dba->nextkey.dptr);
- }
-
- gkey = gdbm_firstkey(dba->dbf);
- if(gkey.dptr) {
- key = estrndup(gkey.dptr, gkey.dsize);
- if(newlen) *newlen = gkey.dsize;
- dba->nextkey = gkey;
- } else {
- dba->nextkey.dptr = NULL;
- }
- return key;
-}
-
-DBA_NEXTKEY_FUNC(gdbm)
-{
- GDBM_DATA;
- char *nkey = NULL;
- datum gkey;
-
- if(!dba->nextkey.dptr) return NULL;
-
- gkey = gdbm_nextkey(dba->dbf, dba->nextkey);
- free(dba->nextkey.dptr);
- if(gkey.dptr) {
- nkey = estrndup(gkey.dptr, gkey.dsize);
- if(newlen) *newlen = gkey.dsize;
- dba->nextkey = gkey;
- } else {
- dba->nextkey.dptr = NULL;
- }
- return nkey;
-}
-
-DBA_OPTIMIZE_FUNC(gdbm)
-{
- GDBM_DATA;
- gdbm_reorganize(dba->dbf);
- return SUCCESS;
-}
-
-DBA_SYNC_FUNC(gdbm)
-{
- GDBM_DATA;
-
- gdbm_sync(dba->dbf);
- return SUCCESS;
-}
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/dba/dba_ndbm.c b/ext/dba/dba_ndbm.c
deleted file mode 100644
index 0eb1fa8391..0000000000
--- a/ext/dba/dba_ndbm.c
+++ /dev/null
@@ -1,164 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Sascha Schumann <sascha@schumann.cx> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#include "php.h"
-
-#if DBA_NDBM
-#include "php_ndbm.h"
-
-#include <fcntl.h>
-#ifdef NDBM_INCLUDE_FILE
-#include NDBM_INCLUDE_FILE
-#endif
-
-#define NDBM_GKEY datum gkey; gkey.dptr = (char *) key; gkey.dsize = keylen
-
-DBA_OPEN_FUNC(ndbm)
-{
- DBM *dbf;
- int gmode = 0;
- int filemode = 0644;
- dba_info *pinfo = (dba_info *) info;
-
- switch(info->mode) {
- case DBA_READER:
- gmode = O_RDONLY;
- break;
- case DBA_WRITER:
- gmode = O_RDWR;
- break;
- case DBA_CREAT:
- gmode = O_RDWR | O_CREAT;
- break;
- case DBA_TRUNC:
- gmode = O_RDWR | O_CREAT | O_TRUNC;
- break;
- default:
- return FAILURE;
- }
-
- if(info->argc > 0) {
- convert_to_long_ex(info->argv[0]);
- filemode = (*info->argv[0])->value.lval;
- }
-
- dbf = dbm_open(info->path, gmode, filemode);
-
- if(dbf) {
- pinfo->dbf = dbf;
- return SUCCESS;
- }
- return FAILURE;
-}
-
-DBA_CLOSE_FUNC(ndbm)
-{
- dbm_close(info->dbf);
-}
-
-DBA_FETCH_FUNC(ndbm)
-{
- datum gval;
- char *new = NULL;
-
- NDBM_GKEY;
- gval = dbm_fetch(info->dbf, gkey);
- if(gval.dptr) {
- if(newlen) *newlen = gval.dsize;
- new = estrndup(gval.dptr, gval.dsize);
- }
- return new;
-}
-
-DBA_UPDATE_FUNC(ndbm)
-{
- datum gval;
-
- NDBM_GKEY;
- gval.dptr = (char *) val;
- gval.dsize = vallen;
-
- if(!dbm_store(info->dbf, gkey, gval, mode == 1 ? DBM_INSERT : DBM_REPLACE))
- return SUCCESS;
- return FAILURE;
-}
-
-DBA_EXISTS_FUNC(ndbm)
-{
- datum gval;
- NDBM_GKEY;
- gval = dbm_fetch(info->dbf, gkey);
- if(gval.dptr) {
- return SUCCESS;
- }
- return FAILURE;
-}
-
-DBA_DELETE_FUNC(ndbm)
-{
- NDBM_GKEY;
- return(dbm_delete(info->dbf, gkey) == -1 ? FAILURE : SUCCESS);
-}
-
-DBA_FIRSTKEY_FUNC(ndbm)
-{
- datum gkey;
- char *key = NULL;
-
- gkey = dbm_firstkey(info->dbf);
- if(gkey.dptr) {
- if(newlen) *newlen = gkey.dsize;
- key = estrndup(gkey.dptr, gkey.dsize);
- }
- return key;
-}
-
-DBA_NEXTKEY_FUNC(ndbm)
-{
- datum gkey;
- char *nkey = NULL;
-
- gkey = dbm_nextkey(info->dbf);
- if(gkey.dptr) {
- if(newlen) *newlen = gkey.dsize;
- nkey = estrndup(gkey.dptr, gkey.dsize);
- }
- return nkey;
-}
-
-DBA_OPTIMIZE_FUNC(ndbm)
-{
- return SUCCESS;
-}
-
-DBA_SYNC_FUNC(ndbm)
-{
- return SUCCESS;
-}
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/dba/php_cdb.h b/ext/dba/php_cdb.h
deleted file mode 100644
index a046f0796b..0000000000
--- a/ext/dba/php_cdb.h
+++ /dev/null
@@ -1,12 +0,0 @@
-#ifndef PHP_CDB_H
-#define PHP_CDB_H
-
-#if DBA_CDB
-
-#include "php_dba.h"
-
-DBA_FUNCS(cdb);
-
-#endif
-
-#endif
diff --git a/ext/dba/php_db2.h b/ext/dba/php_db2.h
deleted file mode 100644
index 2a95223a85..0000000000
--- a/ext/dba/php_db2.h
+++ /dev/null
@@ -1,12 +0,0 @@
-#ifndef PHP_DB2_H
-#define PHP_DB2_H
-
-#if DBA_DB2
-
-#include "php_dba.h"
-
-DBA_FUNCS(db2);
-
-#endif
-
-#endif
diff --git a/ext/dba/php_db3.h b/ext/dba/php_db3.h
deleted file mode 100644
index 58bb0b62a0..0000000000
--- a/ext/dba/php_db3.h
+++ /dev/null
@@ -1,12 +0,0 @@
-#ifndef PHP_DB3_H
-#define PHP_DB3_H
-
-#if DBA_DB3
-
-#include "php_dba.h"
-
-DBA_FUNCS(db3);
-
-#endif
-
-#endif
diff --git a/ext/dba/php_dba.h b/ext/dba/php_dba.h
deleted file mode 100644
index 01ac87d7ee..0000000000
--- a/ext/dba/php_dba.h
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Sascha Schumann <sascha@schumann.cx> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifndef PHP_DBA_H
-#define PHP_DBA_H
-
-#if HAVE_DBA
-
-typedef enum {
- DBA_READER = 1,
- DBA_WRITER,
- DBA_TRUNC,
- DBA_CREAT
-} dba_mode_t;
-
-typedef struct dba_info {
- /* public */
- void *dbf; /* ptr to private data or whatever */
- char *path;
- dba_mode_t mode;
- /* arg[cv] are only available when the dba_open handler is called! */
- int argc;
- pval ***argv;
- /* private */
- struct dba_handler *hnd;
-} dba_info;
-
-extern zend_module_entry dba_module_entry;
-#define dba_module_ptr &dba_module_entry
-
-/* common prototypes which must be supplied by modules */
-
-#define DBA_OPEN_FUNC(x) \
- int dba_open_##x(dba_info *info)
-#define DBA_CLOSE_FUNC(x) \
- void dba_close_##x(dba_info *info)
-#define DBA_FETCH_FUNC(x) \
- char *dba_fetch_##x(dba_info *info, char *key, int keylen, int *newlen)
-#define DBA_UPDATE_FUNC(x) \
- int dba_update_##x(dba_info *info, char *key, int keylen, char *val, int vallen, int mode)
-#define DBA_EXISTS_FUNC(x) \
- int dba_exists_##x(dba_info *info, char *key, int keylen)
-#define DBA_DELETE_FUNC(x) \
- int dba_delete_##x(dba_info *info, char *key, int keylen)
-#define DBA_FIRSTKEY_FUNC(x) \
- char *dba_firstkey_##x(dba_info *info, int *newlen)
-#define DBA_NEXTKEY_FUNC(x) \
- char *dba_nextkey_##x(dba_info *info, int *newlen)
-#define DBA_OPTIMIZE_FUNC(x) \
- int dba_optimize_##x(dba_info *info)
-#define DBA_SYNC_FUNC(x) \
- int dba_sync_##x(dba_info *info)
-
-#define DBA_FUNCS(x) \
- DBA_OPEN_FUNC(x); \
- DBA_CLOSE_FUNC(x); \
- DBA_FETCH_FUNC(x); \
- DBA_UPDATE_FUNC(x); \
- DBA_DELETE_FUNC(x); \
- DBA_EXISTS_FUNC(x); \
- DBA_FIRSTKEY_FUNC(x); \
- DBA_NEXTKEY_FUNC(x); \
- DBA_OPTIMIZE_FUNC(x); \
- DBA_SYNC_FUNC(x)
-
-#define VALLEN(p) Z_STRVAL_PP(p), Z_STRLEN_PP(p)
-
-PHP_FUNCTION(dba_open);
-PHP_FUNCTION(dba_popen);
-PHP_FUNCTION(dba_close);
-PHP_FUNCTION(dba_firstkey);
-PHP_FUNCTION(dba_nextkey);
-PHP_FUNCTION(dba_replace);
-PHP_FUNCTION(dba_insert);
-PHP_FUNCTION(dba_delete);
-PHP_FUNCTION(dba_exists);
-PHP_FUNCTION(dba_fetch);
-PHP_FUNCTION(dba_optimize);
-PHP_FUNCTION(dba_sync);
-
-#else
-#define dba_module_ptr NULL
-#endif
-
-#define phpext_dba_ptr dba_module_ptr
-
-#endif
diff --git a/ext/dba/php_dbm.h b/ext/dba/php_dbm.h
deleted file mode 100644
index 4c963d18ed..0000000000
--- a/ext/dba/php_dbm.h
+++ /dev/null
@@ -1,12 +0,0 @@
-#ifndef PHP_DBM_H
-#define PHP_DBM_H
-
-#if DBA_DBM
-
-#include "php_dba.h"
-
-DBA_FUNCS(dbm);
-
-#endif
-
-#endif
diff --git a/ext/dba/php_gdbm.h b/ext/dba/php_gdbm.h
deleted file mode 100644
index 3068404cfe..0000000000
--- a/ext/dba/php_gdbm.h
+++ /dev/null
@@ -1,12 +0,0 @@
-#ifndef PHP_GDBM_H
-#define PHP_GDBM_H
-
-#if DBA_GDBM
-
-#include "php_dba.h"
-
-DBA_FUNCS(gdbm);
-
-#endif
-
-#endif
diff --git a/ext/dba/php_ndbm.h b/ext/dba/php_ndbm.h
deleted file mode 100644
index b1ebf15af3..0000000000
--- a/ext/dba/php_ndbm.h
+++ /dev/null
@@ -1,12 +0,0 @@
-#ifndef PHP_NDBM_H
-#define PHP_NDBM_H
-
-#if DBA_NDBM
-
-#include "php_dba.h"
-
-DBA_FUNCS(ndbm);
-
-#endif
-
-#endif
diff --git a/ext/dba/setup.stub b/ext/dba/setup.stub
deleted file mode 100644
index 0df17de7d1..0000000000
--- a/ext/dba/setup.stub
+++ /dev/null
@@ -1,6 +0,0 @@
-# $Source$
-# $Id$
-
-define_option with-dba 'dba support?' yesnodir no \
-' Whether to build the dba extension.'
-
diff --git a/ext/dbase/CREDITS b/ext/dbase/CREDITS
deleted file mode 100644
index ea6adcaf41..0000000000
--- a/ext/dbase/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-dBase
-Jim Winstead
diff --git a/ext/dbase/Makefile.in b/ext/dbase/Makefile.in
deleted file mode 100644
index 780cf37fda..0000000000
--- a/ext/dbase/Makefile.in
+++ /dev/null
@@ -1,6 +0,0 @@
-
-LTLIBRARY_NAME = libdbase.la
-LTLIBRARY_SOURCES = dbf_head.c dbf_rec.c dbf_misc.c dbf_ndx.c dbase.c
-LTLIBRARY_SHARED_NAME = dbase.la
-
-include $(top_srcdir)/build/dynlib.mk
diff --git a/ext/dbase/config.m4 b/ext/dbase/config.m4
deleted file mode 100644
index 7a33750b90..0000000000
--- a/ext/dbase/config.m4
+++ /dev/null
@@ -1,11 +0,0 @@
-dnl $Id$
-
-AC_ARG_WITH(dbase,[],[enable_dbase=$withval])
-
-PHP_ARG_ENABLE(dbase,whether to enable the bundled dbase library,
-[ --enable-dbase Enable the bundled dbase library])
-
-if test "$PHP_DBASE" = "yes"; then
- AC_DEFINE(DBASE,1,[ ])
- PHP_EXTENSION(dbase, $ext_shared)
-fi
diff --git a/ext/dbase/dbase.c b/ext/dbase/dbase.c
deleted file mode 100644
index 68833bd4a2..0000000000
--- a/ext/dbase/dbase.c
+++ /dev/null
@@ -1,784 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Jim Winstead (jimw@php.net) |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "safe_mode.h"
-#include "fopen_wrappers.h"
-#include "php_globals.h"
-
-#include <stdlib.h>
-
-#ifdef HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-
-#if DBASE
-#include "php_dbase.h"
-#include "dbf.h"
-#if defined(THREAD_SAFE)
-DWORD DbaseTls;
-static int numthreads=0;
-void *dbase_mutex;
-
-typedef struct dbase_global_struct{
- int le_dbhead;
-}dbase_global_struct;
-
-#define DBase_GLOBAL(a) dbase_globals->a
-
-#define DBase_TLS_VARS \
- dbase_global_struct *dbase_globals; \
- dbase_globals=TlsGetValue(DbaseTls);
-
-#else
-static int le_dbhead;
-#define DBase_GLOBAL(a) a
-#define DBase_TLS_VARS
-#endif
-
-#include <fcntl.h>
-#include <errno.h>
-
-
-static void _close_dbase(zend_rsrc_list_entry *rsrc)
-{
- dbhead_t *dbhead = (dbhead_t *)rsrc->ptr;
- close(dbhead->db_fd);
- free_dbf_head(dbhead);
-}
-
-
-PHP_MINIT_FUNCTION(dbase)
-{
-#if defined(THREAD_SAFE)
- dbase_global_struct *dbase_globals;
-#ifdef COMPILE_DL_DBASE
- CREATE_MUTEX(dbase_mutex,"DBase_TLS");
- SET_MUTEX(dbase_mutex);
- numthreads++;
- if (numthreads==1){
- if ((DbaseTls=TlsAlloc())==0xFFFFFFFF){
- FREE_MUTEX(dbase_mutex);
- return 0;
- }}
- FREE_MUTEX(dbase_mutex);
-#endif
- dbase_globals = (dbase_global_struct *) LocalAlloc(LPTR, sizeof(dbase_global_struct));
- TlsSetValue(DbaseTls, (void *) dbase_globals);
-#endif
- DBase_GLOBAL(le_dbhead) =
- zend_register_list_destructors_ex(_close_dbase, NULL, "dbase", module_number);
- return SUCCESS;
-}
-
-static PHP_MSHUTDOWN_FUNCTION(dbase)
-{
-#if defined(THREAD_SAFE)
- dbase_global_struct *dbase_globals;
- dbase_globals = TlsGetValue(DbaseTls);
- if (dbase_globals != 0)
- LocalFree((HLOCAL) dbase_globals);
-#ifdef COMPILE_DL_DBASE
- SET_MUTEX(dbase_mutex);
- numthreads--;
- if (!numthreads){
- if (!TlsFree(DbaseTls)){
- FREE_MUTEX(dbase_mutex);
- return 0;
- }}
- FREE_MUTEX(dbase_mutex);
-#endif
-#endif
- return SUCCESS;
-}
-
-/* {{{ proto int dbase_open(string name, int mode)
- Opens a dBase-format database file */
-PHP_FUNCTION(dbase_open) {
- pval *dbf_name, *options;
- dbhead_t *dbh;
- int handle;
- PLS_FETCH();
- DBase_TLS_VARS;
-
- if (ZEND_NUM_ARGS() != 2 || getParameters(ht,2,&dbf_name,&options)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string(dbf_name);
- convert_to_long(options);
-
- if (PG(safe_mode) && (!php_checkuid(dbf_name->value.str.val, NULL, CHECKUID_CHECK_FILE_AND_DIR))) {
- RETURN_FALSE;
- }
-
- if (php_check_open_basedir(dbf_name->value.str.val)) {
- RETURN_FALSE;
- }
-
- dbh = dbf_open(dbf_name->value.str.val, options->value.lval);
- if (dbh == NULL) {
- php_error(E_WARNING, "unable to open database %s", dbf_name->value.str.val);
- RETURN_FALSE;
- }
-
- handle = zend_list_insert(dbh, DBase_GLOBAL(le_dbhead));
- RETURN_LONG(handle);
-}
-/* }}} */
-
-/* {{{ proto bool dbase_close(int identifier)
- Closes an open dBase-format database file */
-PHP_FUNCTION(dbase_close) {
- pval *dbh_id;
- dbhead_t *dbh;
- int dbh_type;
- DBase_TLS_VARS;
-
- if (ZEND_NUM_ARGS() != 1 || getParameters(ht,1,&dbh_id)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long(dbh_id);
- dbh = zend_list_find(dbh_id->value.lval, &dbh_type);
- if (!dbh || dbh_type != DBase_GLOBAL(le_dbhead)) {
- php_error(E_WARNING, "Unable to find database for identifier %d", dbh_id->value.lval);
- RETURN_FALSE;
- }
-
- zend_list_delete(dbh_id->value.lval);
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int dbase_numrecords(int identifier)
- Returns the number of records in the database */
-PHP_FUNCTION(dbase_numrecords) {
- pval *dbh_id;
- dbhead_t *dbh;
- int dbh_type;
- DBase_TLS_VARS;
-
- if (ZEND_NUM_ARGS() != 1 || getParameters(ht,1,&dbh_id)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long(dbh_id);
- dbh = zend_list_find(dbh_id->value.lval, &dbh_type);
- if (!dbh || dbh_type != DBase_GLOBAL(le_dbhead)) {
- php_error(E_WARNING, "Unable to find database for identifier %d", dbh_id->value.lval);
- RETURN_FALSE;
- }
-
- RETURN_LONG(dbh->db_records);
-}
-/* }}} */
-
-/* {{{ proto int dbase_numfields(int identifier)
- Returns the number of fields (columns) in the database */
-PHP_FUNCTION(dbase_numfields) {
- pval *dbh_id;
- dbhead_t *dbh;
- int dbh_type;
- DBase_TLS_VARS;
-
- if (ZEND_NUM_ARGS() != 1 || getParameters(ht,1,&dbh_id)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long(dbh_id);
- dbh = zend_list_find(dbh_id->value.lval, &dbh_type);
- if (!dbh || dbh_type != DBase_GLOBAL(le_dbhead)) {
- php_error(E_WARNING, "Unable to find database for identifier %d", dbh_id->value.lval);
- RETURN_FALSE;
- }
-
- RETURN_LONG(dbh->db_nfields);
-}
-/* }}} */
-
-/* {{{ proto bool dbase_pack(int identifier)
- Packs the database (deletes records marked for deletion) */
-PHP_FUNCTION(dbase_pack) {
- pval *dbh_id;
- dbhead_t *dbh;
- int dbh_type;
- DBase_TLS_VARS;
-
- if (ZEND_NUM_ARGS() != 1 || getParameters(ht,1,&dbh_id)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long(dbh_id);
- dbh = zend_list_find(dbh_id->value.lval, &dbh_type);
- if (!dbh || dbh_type != DBase_GLOBAL(le_dbhead)) {
- php_error(E_WARNING, "Unable to find database for identifier %d", dbh_id->value.lval);
- RETURN_FALSE;
- }
-
- pack_dbf(dbh);
- put_dbf_info(dbh);
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool dbase_add_record(int identifier, array data)
- Adds a record to the database */
-PHP_FUNCTION(dbase_add_record) {
- pval *dbh_id, *fields, **field;
- dbhead_t *dbh;
- int dbh_type;
-
- int num_fields;
- dbfield_t *dbf, *cur_f;
- char *cp, *t_cp;
- int i;
- DBase_TLS_VARS;
-
- if (ZEND_NUM_ARGS() != 2 || getParameters(ht,2,&dbh_id,&fields)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long(dbh_id);
- if (fields->type != IS_ARRAY) {
- php_error(E_WARNING, "Expected array as second parameter");
- RETURN_FALSE;
- }
-
- dbh = zend_list_find(dbh_id->value.lval, &dbh_type);
- if (!dbh || dbh_type != DBase_GLOBAL(le_dbhead)) {
- php_error(E_WARNING, "Unable to find database for identifier %d", dbh_id->value.lval);
- RETURN_FALSE;
- }
-
- num_fields = zend_hash_num_elements(fields->value.ht);
-
- if (num_fields != dbh->db_nfields) {
- php_error(E_WARNING, "Wrong number of fields specified");
- RETURN_FALSE;
- }
-
- cp = t_cp = (char *)emalloc(dbh->db_rlen + 1);
- if (!cp) {
- php_error(E_WARNING, "unable to allocate memory");
- RETURN_FALSE;
- }
- *t_cp++ = VALID_RECORD;
-
- dbf = dbh->db_fields;
- for (i = 0, cur_f = dbf; cur_f < &dbf[num_fields]; i++, cur_f++) {
- zval tmp;
- if (zend_hash_index_find(fields->value.ht, i, (void **)&field) == FAILURE) {
- php_error(E_WARNING, "unexpected error");
- efree(cp);
- RETURN_FALSE;
- }
-
- tmp = **field;
- zval_copy_ctor(&tmp);
- convert_to_string(&tmp);
- sprintf(t_cp, cur_f->db_format, tmp.value.str.val);
- zval_dtor(&tmp);
- t_cp += cur_f->db_flen;
- }
-
- dbh->db_records++;
- if (put_dbf_record(dbh, dbh->db_records, cp) < 0) {
- php_error(E_WARNING, "unable to put record at %ld", dbh->db_records);
- efree(cp);
- RETURN_FALSE;
- }
-
- put_dbf_info(dbh);
- efree(cp);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool dbase_replace_record(int identifier, array data, int recnum)
- Replaces a record to the database */
-PHP_FUNCTION(dbase_replace_record)
-{
- pval *dbh_id, *fields, *field, *recnum;
- dbhead_t *dbh;
- int dbh_type;
-
- int num_fields;
- dbfield_t *dbf, *cur_f;
- char *cp, *t_cp;
- int i;
- DBase_TLS_VARS;
-
- if (ZEND_NUM_ARGS() != 3 || getParameters(ht,3,&dbh_id,&fields,&recnum)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long(dbh_id);
- convert_to_long(recnum);
- if (fields->type != IS_ARRAY) {
- php_error(E_WARNING, "Expected array as second parameter");
- RETURN_FALSE;
- }
-
- dbh = zend_list_find(dbh_id->value.lval, &dbh_type);
- if (!dbh || dbh_type != DBase_GLOBAL(le_dbhead)) {
- php_error(E_WARNING, "Unable to find database for identifier %d", dbh_id->value.lval);
- RETURN_FALSE;
- }
-
- num_fields = zend_hash_num_elements(fields->value.ht);
-
- if (num_fields != dbh->db_nfields) {
- php_error(E_WARNING, "Wrong number of fields specified");
- RETURN_FALSE;
- }
-
- cp = t_cp = (char *)emalloc(dbh->db_rlen + 1);
- if (!cp) {
- php_error(E_WARNING, "unable to allocate memory");
- RETURN_FALSE;
- }
- *t_cp++ = VALID_RECORD;
-
- dbf = dbh->db_fields;
- for (i = 0, cur_f = dbf; cur_f < &dbf[num_fields]; i++, cur_f++) {
- if (zend_hash_index_find(fields->value.ht, i, (void **)&field) == FAILURE) {
- php_error(E_WARNING, "unexpected error");
- efree(cp);
- RETURN_FALSE;
- }
- convert_to_string(field);
- sprintf(t_cp, cur_f->db_format, field->value.str.val);
- t_cp += cur_f->db_flen;
- }
-
- if (put_dbf_record(dbh, recnum->value.lval, cp) < 0) {
- php_error(E_WARNING, "unable to put record at %ld", dbh->db_records);
- efree(cp);
- RETURN_FALSE;
- }
-
- put_dbf_info(dbh);
- efree(cp);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool dbase_delete_record(int identifier, int record)
- Marks a record to be deleted */
-PHP_FUNCTION(dbase_delete_record) {
- pval *dbh_id, *record;
- dbhead_t *dbh;
- int dbh_type;
- DBase_TLS_VARS;
-
- if (ZEND_NUM_ARGS() != 2 || getParameters(ht,2,&dbh_id,&record)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long(dbh_id);
- convert_to_long(record);
-
- dbh = zend_list_find(dbh_id->value.lval, &dbh_type);
- if (!dbh || dbh_type != DBase_GLOBAL(le_dbhead)) {
- php_error(E_WARNING, "Unable to find database for identifier %d", dbh_id->value.lval);
- RETURN_FALSE;
- }
-
- if (del_dbf_record(dbh, record->value.lval) < 0) {
- if (record->value.lval > dbh->db_records) {
- php_error(E_WARNING, "record %d out of bounds", record->value.lval);
- } else {
- php_error(E_WARNING, "unable to delete record %d", record->value.lval);
- }
- RETURN_FALSE;
- }
-
- put_dbf_info(dbh);
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto array dbase_get_record(int identifier, int record)
- Returns an array representing a record from the database */
-PHP_FUNCTION(dbase_get_record) {
- pval *dbh_id, *record;
- dbhead_t *dbh;
- int dbh_type;
- dbfield_t *dbf, *cur_f;
- char *data, *fnp, *str_value;
- size_t cursize = 0;
- DBase_TLS_VARS;
-
- if (ZEND_NUM_ARGS() != 2 || getParameters(ht,2,&dbh_id,&record)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long(dbh_id);
- convert_to_long(record);
-
- dbh = zend_list_find(dbh_id->value.lval, &dbh_type);
- if (!dbh || dbh_type != DBase_GLOBAL(le_dbhead)) {
- php_error(E_WARNING, "Unable to find database for identifier %d", dbh_id->value.lval);
- RETURN_FALSE;
- }
-
- if ((data = get_dbf_record(dbh, record->value.lval)) == NULL) {
- php_error(E_WARNING, "Tried to read bad record %d", record->value.lval);
- RETURN_FALSE;
- }
-
- dbf = dbh->db_fields;
-
- if (array_init(return_value) == FAILURE) {
- RETURN_FALSE;
- }
-
- fnp = NULL;
- for (cur_f = dbf; cur_f < &dbf[dbh->db_nfields]; cur_f++) {
- /* get the value */
- str_value = (char *)emalloc(cur_f->db_flen + 1);
-
- if(cursize <= cur_f->db_flen) {
- cursize = cur_f->db_flen + 1;
- fnp = erealloc(fnp, cursize);
- }
- snprintf(str_value, cursize, cur_f->db_format, get_field_val(data, cur_f, fnp));
-
- /* now convert it to the right php internal type */
- switch (cur_f->db_type) {
- case 'C':
- case 'D':
- add_next_index_string(return_value,str_value,1);
- break;
- case 'N': /* FALLS THROUGH */
- case 'L': /* FALLS THROUGH */
- if (cur_f->db_fdc == 0) {
- add_next_index_long(return_value, strtol(str_value, NULL, 10));
- } else {
- add_next_index_double(return_value, atof(str_value));
- }
- break;
- case 'M':
- /* this is a memo field. don't know how to deal with
- this yet */
- break;
- default:
- /* should deal with this in some way */
- break;
- }
- efree(str_value);
- }
- efree(fnp);
-
- /* mark whether this record was deleted */
- if (data[0] == '*') {
- add_assoc_long(return_value,"deleted",1);
- }
- else {
- add_assoc_long(return_value,"deleted",0);
- }
-
- free(data);
-}
-/* }}} */
-
-/* From Martin Kuba <makub@aida.inet.cz> */
-/* {{{ proto array dbase_get_record_with_names(int identifier, int record)
- Returns an associative array representing a record from the database */
-PHP_FUNCTION(dbase_get_record_with_names) {
- pval *dbh_id, *record;
- dbhead_t *dbh;
- int dbh_type;
- dbfield_t *dbf, *cur_f;
- char *data, *fnp, *str_value;
- DBase_TLS_VARS;
-
- if (ZEND_NUM_ARGS() != 2 || getParameters(ht,2,&dbh_id,&record)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long(dbh_id);
- convert_to_long(record);
-
- dbh = zend_list_find(dbh_id->value.lval, &dbh_type);
- if (!dbh || dbh_type != DBase_GLOBAL(le_dbhead)) {
- php_error(E_WARNING, "Unable to find database for identifier %d", dbh_id->value.lval);
- RETURN_FALSE;
- }
-
- if ((data = get_dbf_record(dbh, record->value.lval)) == NULL) {
- php_error(E_WARNING, "Tried to read bad record %d", record->value.lval);
- RETURN_FALSE;
- }
-
- dbf = dbh->db_fields;
-
- if (array_init(return_value) == FAILURE) {
- RETURN_FALSE;
- }
-
- fnp = (char *)emalloc(dbh->db_rlen);
- for (cur_f = dbf; cur_f < &dbf[dbh->db_nfields]; cur_f++) {
- /* get the value */
- str_value = (char *)emalloc(cur_f->db_flen + 1);
- sprintf(str_value, cur_f->db_format, get_field_val(data, cur_f, fnp));
-
- /* now convert it to the right php internal type */
- switch (cur_f->db_type) {
- case 'C':
- case 'D':
- add_assoc_string(return_value,cur_f->db_fname,str_value,1);
- break;
- case 'N': /* FALLS THROUGH */
- case 'L': /* FALLS THROUGH */
- if (cur_f->db_fdc == 0) {
- add_assoc_long(return_value,cur_f->db_fname,strtol(str_value, NULL, 10));
- } else {
- add_assoc_double(return_value,cur_f->db_fname,atof(str_value));
- }
- break;
- case 'M':
- /* this is a memo field. don't know how to deal with this yet */
- break;
- default:
- /* should deal with this in some way */
- break;
- }
- efree(str_value);
- }
- efree(fnp);
-
- /* mark whether this record was deleted */
- if (data[0] == '*') {
- add_assoc_long(return_value,"deleted",1);
- } else {
- add_assoc_long(return_value,"deleted",0);
- }
-
- free(data);
-}
-/* }}} */
-
-/* {{{ proto bool dbase_create(string filename, array fields)
- Creates a new dBase-format database file */
-PHP_FUNCTION(dbase_create) {
- pval *filename, *fields, **field, **value;
- int fd;
- dbhead_t *dbh;
-
- int num_fields;
- dbfield_t *dbf, *cur_f;
- int i, rlen, handle;
- PLS_FETCH();
- DBase_TLS_VARS;
-
- if (ZEND_NUM_ARGS() != 2 || getParameters(ht,2,&filename,&fields)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string(filename);
-
- if (fields->type != IS_ARRAY) {
- php_error(E_WARNING, "Expected array as second parameter");
- RETURN_FALSE;
- }
-
- if (PG(safe_mode) && (!php_checkuid(Z_STRVAL_P(filename), NULL, CHECKUID_CHECK_FILE_AND_DIR))) {
- RETURN_FALSE;
- }
-
- if (php_check_open_basedir(Z_STRVAL_P(filename))) {
- RETURN_FALSE;
- }
-
- if ((fd = VCWD_OPEN((Z_STRVAL_P(filename), O_BINARY|O_RDWR|O_CREAT, 0644))) < 0) {
- php_error(E_WARNING, "Unable to create database (%d): %s", errno, strerror(errno));
- RETURN_FALSE;
- }
-
- num_fields = zend_hash_num_elements(fields->value.ht);
-
- /* have to use regular malloc() because this gets free()d by
- code in the dbase library */
- dbh = (dbhead_t *)malloc(sizeof(dbhead_t));
- dbf = (dbfield_t *)malloc(sizeof(dbfield_t) * num_fields);
- if (!dbh || !dbf) {
- php_error(E_WARNING, "Unable to allocate memory for header info");
- RETURN_FALSE;
- }
-
- /* initialize the header structure */
- dbh->db_fields = dbf;
- dbh->db_fd = fd;
- dbh->db_dbt = DBH_TYPE_NORMAL;
- strcpy(dbh->db_date, "19930818");
- dbh->db_records = 0;
- dbh->db_nfields = num_fields;
- dbh->db_hlen = sizeof(struct dbf_dhead) + 2 + num_fields * sizeof(struct dbf_dfield);
-
- rlen = 1;
- /**
- * Patch by greg@darkphoton.com
- **/
- /* make sure that the db_format entries for all fields are set to NULL to ensure we
- don't seg fault if there's an error and we need to call free_dbf_head() before all
- fields have been defined. */
- for (i = 0, cur_f = dbf; i < num_fields; i++, cur_f++) {
- cur_f->db_format = NULL;
- }
- /**
- * end patch
- */
-
-
- for (i = 0, cur_f = dbf; i < num_fields; i++, cur_f++) {
- /* look up the first field */
- if (zend_hash_index_find(fields->value.ht, i, (void **)&field) == FAILURE) {
- php_error(E_WARNING, "unable to find field %d", i);
- free_dbf_head(dbh);
- RETURN_FALSE;
- }
-
- if (Z_TYPE_PP (field) != IS_ARRAY) {
- php_error(E_WARNING, "second parameter must be array of arrays");
- free_dbf_head(dbh);
- RETURN_FALSE;
- }
-
- /* field name */
- if (zend_hash_index_find(Z_ARRVAL_PP(field), 0, (void **)&value) == FAILURE) {
- php_error(E_WARNING, "expected field name as first element of list in field %d", i);
- free_dbf_head(dbh);
- RETURN_FALSE;
- }
- convert_to_string_ex(value);
- if ((*value)->value.str.len > 10 || (*value)->value.str.len == 0) {
- php_error(E_WARNING, "invalid field name '%s' (must be non-empty and less than or equal to 10 characters)", (*value)->value.str.val);
- free_dbf_head(dbh);
- RETURN_FALSE;
- }
- copy_crimp(cur_f->db_fname, (*value)->value.str.val, (*value)->value.str.len);
-
- /* field type */
- if (zend_hash_index_find(Z_ARRVAL_PP (field), 1,(void **)&value) == FAILURE) {
- php_error(E_WARNING, "expected field type as sececond element of list in field %d", i);
- RETURN_FALSE;
- }
- convert_to_string_ex(value);
- cur_f->db_type = toupper(*(*value)->value.str.val);
-
- cur_f->db_fdc = 0;
-
- /* verify the field length */
- switch (cur_f->db_type) {
- case 'L':
- cur_f->db_flen = 1;
- break;
- case 'M':
- cur_f->db_flen = 9;
- dbh->db_dbt = DBH_TYPE_MEMO;
- /* should create the memo file here, probably */
- break;
- case 'D':
- cur_f->db_flen = 8;
- break;
- case 'N':
- case 'C':
- /* field length */
- if (zend_hash_index_find(Z_ARRVAL_PP (field), 2,(void **)&value) == FAILURE) {
- php_error(E_WARNING, "expected field length as third element of list in field %d", i);
- free_dbf_head(dbh);
- RETURN_FALSE;
- }
- convert_to_long_ex(value);
- cur_f->db_flen = (*value)->value.lval;
-
- if (cur_f->db_type == 'N') {
- if (zend_hash_index_find(Z_ARRVAL_PP (field), 3, (void **)&value) == FAILURE) {
- php_error(E_WARNING, "expected field precision as fourth element of list in field %d", i);
- free_dbf_head(dbh);
- RETURN_FALSE;
- }
- convert_to_long_ex(value);
- cur_f->db_fdc = (*value)->value.lval;
- }
- break;
- default:
- php_error(E_WARNING, "unknown field type '%c'", cur_f->db_type);
- }
- cur_f->db_foffset = rlen;
- rlen += cur_f->db_flen;
-
- cur_f->db_format = get_dbf_f_fmt(cur_f);
- }
-
- dbh->db_rlen = rlen;
- put_dbf_info(dbh);
-
- handle = zend_list_insert(dbh, DBase_GLOBAL(le_dbhead));
- RETURN_LONG(handle);
-}
-/* }}} */
-
-/* {{{ dbase_functions[]
- */
-function_entry dbase_functions[] = {
- PHP_FE(dbase_open, NULL)
- PHP_FE(dbase_create, NULL)
- PHP_FE(dbase_close, NULL)
- PHP_FE(dbase_numrecords, NULL)
- PHP_FE(dbase_numfields, NULL)
- PHP_FE(dbase_add_record, NULL)
- PHP_FE(dbase_replace_record, NULL)
- PHP_FE(dbase_get_record, NULL)
- PHP_FE(dbase_get_record_with_names, NULL)
- PHP_FE(dbase_delete_record, NULL)
- PHP_FE(dbase_pack, NULL)
- {NULL, NULL, NULL}
-};
-/* }}} */
-
-zend_module_entry dbase_module_entry = {
- "dbase", dbase_functions, PHP_MINIT(dbase), PHP_MSHUTDOWN(dbase), NULL, NULL, NULL, STANDARD_MODULE_PROPERTIES
-};
-
-
-#ifdef COMPILE_DL_DBASE
-ZEND_GET_MODULE(dbase)
-
-#if (WIN32|WINNT) && defined(THREAD_SAFE)
-
-/*NOTE: You should have an odbc.def file where you
-export DllMain*/
-BOOL WINAPI DllMain(HANDLE hModule,
- DWORD ul_reason_for_call,
- LPVOID lpReserved)
-{
- return 1;
-}
-#endif
-#endif
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/dbase/dbase.dsp b/ext/dbase/dbase.dsp
deleted file mode 100644
index 14a3c77626..0000000000
--- a/ext/dbase/dbase.dsp
+++ /dev/null
@@ -1,151 +0,0 @@
-# Microsoft Developer Studio Project File - Name="dbase" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=dbase - Win32 Release_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "dbase.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "dbase.mak" CFG="dbase - Win32 Release_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "dbase - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "dbase - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "dbase - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\..\TSRM" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_DBASE" /D ZTS=1 /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /I "..\..\main" /D "WIN32" /D "DBASE_EXPORTS" /D "COMPILE_DL_DBASE" /D ZTS=1 /D HAVE_DBASE=1 /D ZEND_DEBUG=0 /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZEND_WIN32" /D "PHP_WIN32" /D DBASE=1 /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x406 /d "NDEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib /nologo /dll /machine:I386
-# ADD LINK32 php4ts.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_dbase.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
-# SUBTRACT LINK32 /pdb:none
-
-!ELSEIF "$(CFG)" == "dbase - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_DBASE" /D ZTS=1 /YX /FD /c
-# ADD CPP /nologo /MDd /W3 /GX /ZI /Od /I "..\.." /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /I "..\..\main" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "DBASE_EXPORTS" /D "COMPILE_DL_DBASE" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D DBASE=1 /FR /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x406 /d "NDEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib /nologo /dll /machine:I386
-# ADD LINK32 php4ts_debug.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /incremental:yes /debug /machine:I386 /nodefaultlib:"msvcrtd.lib" /out:"..\..\Debug_TS/php_dbase.dll" /libpath:"..\..\Debug_TS"
-# SUBTRACT LINK32 /pdb:none
-
-!ENDIF
-
-# Begin Target
-
-# Name "dbase - Win32 Release_TS"
-# Name "dbase - Win32 Debug_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\dbase.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\dbf_head.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\dbf_misc.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\dbf_ndx.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\dbf_rec.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\dbf.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\dbf_head.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\dbf_misc.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\dbf_ndx.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\dbf_rec.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\php_dbase.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/ext/dbase/dbf.h b/ext/dbase/dbf.h
deleted file mode 100644
index c7ee8fde71..0000000000
--- a/ext/dbase/dbf.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Copyright (c) 1991, 1992, 1993 Brad Eacker,
- * (Music, Intuition, Software, and Computers)
- * All Rights Reserved
- */
-
-/*
- * dbf header structure on disk (pc dbase III)
- *
- * Basic info taken from:
- * "File Formats for Popular PC Software"
- * Jeff Walden
- * (c) 1986 John Wiley & Sons, Inc.
- */
-
-#ifndef DBF_H_
-#define DBF_H_
-
-#include <stdlib.h>
-#include <string.h>
-#ifdef WIN32
-#include <io.h>
-#else
-#include <unistd.h>
-#endif
-
-/* So we can use O_BINARY on non-Win32 systems. */
-#if !defined(O_BINARY) && !defined(WIN32)
-#define O_BINARY (0)
-#endif
-
-struct dbf_dhead {
- char dbh_dbt; /* memo (dbt) file present */
- char dbh_date[3]; /* last update YY, MM, DD */
- char dbh_records[4]; /* number of records LE */
- char dbh_hlen[2]; /* header length LE */
- char dbh_rlen[2]; /* record length LE */
- char dbh_res[20]; /* padding */
-};
-#define DBH_DATE_YEAR 0 /* byte offset for year in dbh_date */
-#define DBH_DATE_MONTH 1
-#define DBH_DATE_DAY 2
-
-/*
- * field description on disk
- */
-
-#define DBF_NAMELEN 11
-
-struct dbf_dfield {
- char dbf_name[DBF_NAMELEN]; /* name of field */
- char dbf_type; /* type of field */
- char dbf_fda[4]; /* something for dbase III */
- char dbf_flen[2]; /* field length [and decimal if N] */
- char dbf_res[14]; /* padding */
-};
-
-struct db_field {
- char db_fname[DBF_NAMELEN+1]; /* 0 terminated */
- char db_type; /* type of field */
- int db_flen; /* length of field */
- int db_fdc; /* number of decimals in field */
-
- char *db_format; /* format for printing %s etc */
- int db_foffset; /* offset within record */
-};
-typedef struct db_field dbfield_t;
-
-struct db_head {
- int db_fd;
- unsigned char db_dbt; /* dbt present */
- char db_date[9]; /* date of last update in db format */
- long db_records; /* number of records */
- int db_hlen; /* header length */
- int db_rlen; /* record length */
-
- int db_nfields; /* number of fields */
- dbfield_t *db_fields; /* field info */
- char *db_name; /* name of dbf file */
- int db_cur_rec; /* current record */
-};
-typedef struct db_head dbhead_t;
-
-#define DBH_TYPE_NORMAL 0x03
-#define DBH_TYPE_MEMO 0x83
-
-#define VALID_RECORD ' '
-#define DELETED_RECORD '*'
-
-#include "dbf_head.h"
-#include "dbf_misc.h"
-#include "dbf_rec.h"
-
-#endif /* DBF_H_ */
diff --git a/ext/dbase/dbf_head.c b/ext/dbase/dbf_head.c
deleted file mode 100644
index 4530337879..0000000000
--- a/ext/dbase/dbf_head.c
+++ /dev/null
@@ -1,271 +0,0 @@
-/*
- * Copyright (c) 1991, 1992, 1993 Brad Eacker,
- * (Music, Intuition, Software, and Computers)
- * All Rights Reserved
- */
-
-#include <stdio.h>
-#include <fcntl.h>
-
-#include "dbf.h"
-#include "php.h"
-
-void free_dbf_head(dbhead_t *dbh);
-int get_dbf_field(dbhead_t *dbh, dbfield_t *dbf);
-
-/*
- * get the header info from the file
- * basic header info & field descriptions
- */
-dbhead_t *get_dbf_head(int fd)
-{
- dbhead_t *dbh;
- struct dbf_dhead dbhead;
- dbfield_t *dbf, *cur_f;
- int ret, nfields, offset;
-
- if ((dbh = (dbhead_t *)malloc(sizeof(dbhead_t))) == NULL)
- return NULL;
- if (lseek(fd, 0, 0) < 0)
- return NULL;
- if ((ret = read(fd, &dbhead, sizeof(dbhead))) < 0)
- return NULL;
-
- /* build in core info */
- dbh->db_fd = fd;
- dbh->db_dbt = dbhead.dbh_dbt;
- dbh->db_records = get_long(dbhead.dbh_records);
- dbh->db_hlen = get_short(dbhead.dbh_hlen);
- dbh->db_rlen = get_short(dbhead.dbh_rlen);
-
- db_set_date(dbh->db_date, dbhead.dbh_date[DBH_DATE_YEAR] + 1900,
- dbhead.dbh_date[DBH_DATE_MONTH],
- dbhead.dbh_date[DBH_DATE_DAY]);
-
- dbh->db_nfields = nfields = (dbh->db_hlen - sizeof(struct dbf_dhead)) /
- sizeof(struct dbf_dfield);
-
- /* get all the field info */
- dbf = (dbfield_t *)malloc(sizeof(dbfield_t) * nfields);
-
- offset = 1;
- for (cur_f = dbf; cur_f < &dbf[nfields] ; cur_f++) {
- if (get_dbf_field(dbh, cur_f) < 0) {
- free_dbf_head(dbh);
- return NULL;
- }
- cur_f->db_foffset = offset;
- offset += cur_f->db_flen;
- }
- dbh->db_fields = dbf;
-
- return dbh;
-}
-
-/*
- * free up the header info built above
- */
-void free_dbf_head(dbhead_t *dbh)
-{
- dbfield_t *dbf, *cur_f;
- int nfields;
-
- dbf = dbh->db_fields;
- nfields = dbh->db_nfields;
- for (cur_f = dbf; cur_f < &dbf[nfields]; cur_f++) {
- if (cur_f->db_format) {
- free(cur_f->db_format);
- }
- }
-
- free(dbf);
- free(dbh);
-}
-
-/*
- * put out the header info
- */
-int put_dbf_head(dbhead_t *dbh)
-{
- int fd = dbh->db_fd;
- struct dbf_dhead dbhead;
- int ret;
-
- memset (&dbhead, 0, sizeof(dbhead));
-
- /* build on disk info */
- dbhead.dbh_dbt = dbh->db_dbt;
- put_long(dbhead.dbh_records, dbh->db_records);
- put_short(dbhead.dbh_hlen, dbh->db_hlen);
- put_short(dbhead.dbh_rlen, dbh->db_rlen);
-
- /* put the date spec'd into the on disk header */
- dbhead.dbh_date[DBH_DATE_YEAR] =(char)(db_date_year(dbh->db_date) -
- 1900);
- dbhead.dbh_date[DBH_DATE_MONTH]=(char)(db_date_month(dbh->db_date));
- dbhead.dbh_date[DBH_DATE_DAY] =(char)(db_date_day(dbh->db_date));
-
- if (lseek(fd, 0, 0) < 0)
- return -1;
- if ((ret = write(fd, &dbhead, sizeof(dbhead))) < 0)
- return -1;
- return ret;
-}
-
-/*
- * get a field off the disk from the current file offset
- */
-int get_dbf_field(dbhead_t *dbh, dbfield_t *dbf)
-{
- struct dbf_dfield dbfield;
- int ret;
-
- if ((ret = read(dbh->db_fd, &dbfield, sizeof(dbfield))) < 0) {
- return ret;
- }
-
- /* build the field name */
- copy_crimp(dbf->db_fname, dbfield.dbf_name, DBF_NAMELEN);
-
- dbf->db_type = dbfield.dbf_type;
- switch (dbf->db_type) {
- case 'N':
- dbf->db_flen = dbfield.dbf_flen[0];
- dbf->db_fdc = dbfield.dbf_flen[1];
- break;
- default:
- dbf->db_flen = get_short(dbfield.dbf_flen);
- }
-
- if ((dbf->db_format = get_dbf_f_fmt(dbf)) == NULL) {
- return 1;
- }
-
- return 0;
-}
-
-/*
- * put a field out on the disk at the current file offset
- */
-int put_dbf_field(dbhead_t *dbh, dbfield_t *dbf)
-{
- struct dbf_dfield dbfield;
- char *scp, *dcp;
- int ret;
-
- memset (&dbfield, 0, sizeof(dbfield));
-
- /* build the on disk field info */
- scp = dbf->db_fname; dcp = dbfield.dbf_name;
-
- strncpy(dbfield.dbf_name, dbf->db_fname, DBF_NAMELEN);
-
- dbfield.dbf_type = dbf->db_type;
- switch (dbf->db_type) {
- case 'N':
- dbfield.dbf_flen[0] = dbf->db_flen;
- dbfield.dbf_flen[1] = dbf->db_fdc;
- break;
- default:
- put_short(dbfield.dbf_flen, dbf->db_flen);
- }
-
- /* now write it out to disk */
- if ((ret = write(dbh->db_fd, &dbfield, sizeof(dbfield))) < 0) {
- return ret;
- }
- return 1;
-}
-
-/*
- * put out all the info at the top of the file...
- */
-static char end_stuff[2] = {0x0d, 0};
-
-void put_dbf_info(dbhead_t *dbh)
-{
- dbfield_t *dbf;
- char *cp;
- int fcnt;
-
- if ((cp = db_cur_date(NULL))) {
- strncpy(dbh->db_date, cp, 8);
- free(cp);
- }
- put_dbf_head(dbh);
- dbf = dbh->db_fields;
- for (fcnt = dbh->db_nfields; fcnt > 0; fcnt--, dbf++)
- put_dbf_field(dbh, dbf);
- write(dbh->db_fd, end_stuff, 1);
-}
-
-char *get_dbf_f_fmt(dbfield_t *dbf)
-{
- char format[100];
-
- /* build the field format for printf */
- switch (dbf->db_type) {
- case 'C':
- sprintf(format, "%%-%ds", dbf->db_flen);
- break;
- case 'N':
- case 'L':
- case 'D':
- sprintf(format, "%%%ds", dbf->db_flen);
- break;
- case 'M':
- strcpy(format, "%s");
- break;
- }
- return (char *)strdup(format);
-}
-
-dbhead_t *dbf_open(char *dp, int o_flags)
-{
- int fd;
- char *cp;
- dbhead_t *dbh;
-
- cp = dp;
- if ((fd = VCWD_OPEN((cp, o_flags|O_BINARY))) < 0) {
- cp = (char *)malloc(256);
- strcpy(cp, dp); strcat(cp, ".dbf");
- if ((fd = VCWD_OPEN((cp, o_flags))) < 0) {
- perror("open");
- return NULL;
- }
- }
-
- if ((dbh = get_dbf_head(fd)) == 0) {
- fprintf(stderr, "Unable to get header\n");
- return NULL;
- }
- dbh->db_name = cp;
- dbh->db_cur_rec = 0;
-
- return dbh;
-}
-
-void dbf_head_info(dbhead_t *dbh)
-{
- int nfields;
- dbfield_t *dbf, *cur_f;
-
- nfields = dbh->db_nfields;
- printf("# fields: %d, record len: %d, total records %ld\n",
- nfields, dbh->db_rlen, dbh->db_records);
- dbf = dbh->db_fields;
- for (cur_f = dbf; cur_f < &dbf[nfields] ; cur_f++) {
- printf("# %s, %c, %d, %d\n", cur_f->db_fname,
- cur_f->db_type, cur_f->db_flen, cur_f->db_fdc);
- }
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/dbase/dbf_head.h b/ext/dbase/dbf_head.h
deleted file mode 100644
index 1643151dd1..0000000000
--- a/ext/dbase/dbf_head.h
+++ /dev/null
@@ -1,9 +0,0 @@
-extern dbhead_t *get_dbf_head(int fd);
-void free_dbf_head(dbhead_t *dbh);
-extern int put_dbf_head(dbhead_t *dbh);
-extern int get_dbf_field(dbhead_t *dbh, dbfield_t *dbf);
-extern int put_dbf_field(dbhead_t *dbh, dbfield_t *dbf);
-void put_dbf_info(dbhead_t *dbh);
-extern char *get_dbf_f_fmt(dbfield_t *dbf);
-extern dbhead_t *dbf_open(char *dp, int o_flags);
-void dbf_head_info(dbhead_t *dbh);
diff --git a/ext/dbase/dbf_misc.c b/ext/dbase/dbf_misc.c
deleted file mode 100644
index 3d8fd04f4a..0000000000
--- a/ext/dbase/dbf_misc.c
+++ /dev/null
@@ -1,179 +0,0 @@
-/*
- * Copyright (c) 1991, 1992, 1993 Brad Eacker,
- * (Music, Intuition, Software, and Computers)
- * All Rights Reserved
- */
-#include <stdlib.h>
-#include <stdio.h>
-#include <sys/types.h>
-
-#include "dbf_misc.h"
-
-#include "php_reentrancy.h"
-
-/*
- * routine to change little endian long to host long
- */
-long get_long(char *cp)
-{
- int ret;
- unsigned char *source = (unsigned char *)cp;
-
- ret = *source++;
- ret += ((*source++)<<8);
- ret += ((*source++)<<16);
- ret += ((*source++)<<24);
-
- return ret;
-}
-
-void put_long(char *cp, long lval)
-{
- *cp++ = lval & 0xff;
- *cp++ = (lval >> 8) & 0xff;
- *cp++ = (lval >> 16) & 0xff;
- *cp++ = (lval >> 24) & 0xff;
-}
-
-/*
- * routine to change little endian short to host short
- */
-int get_short(char *cp)
-{
- int ret;
- unsigned char *source = (unsigned char *)cp;
-
- ret = *source++;
- ret += ((*source++)<<8);
-
- return ret;
-}
-
-void put_short(char *cp, int sval)
-{
- *cp++ = sval & 0xff;
- *cp++ = (sval >> 8) & 0xff;
-}
-
-double get_double(char *cp)
-{
- double ret;
- unsigned char *dp = (unsigned char *)&ret;
-
- dp[7] = *cp++;
- dp[6] = *cp++;
- dp[5] = *cp++;
- dp[4] = *cp++;
- dp[3] = *cp++;
- dp[2] = *cp++;
- dp[1] = *cp++;
- dp[0] = *cp++;
-
- return ret;
-}
-
-void put_double(char *cp, double fval)
-{
- unsigned char *dp = (unsigned char *)&fval;
-
- cp[7] = *dp++;
- cp[6] = *dp++;
- cp[5] = *dp++;
- cp[4] = *dp++;
- cp[3] = *dp++;
- cp[2] = *dp++;
- cp[1] = *dp++;
- cp[0] = *dp++;
-}
-
-void copy_fill(char *dp, char *sp, int len)
-{
- while (*sp && len > 0) {
- *dp++ = *sp++;
- len--;
- }
- while (len-- > 0)
- *dp++ = ' ';
-}
-
-void copy_crimp(char *dp, char *sp, int len)
-{
- while (len-- > 0) {
- *dp++ = *sp++;
- }
- *dp = 0;
- for (dp-- ; *dp == ' '; dp--) {
- *dp = 0;
- }
-
-}
-
-void db_set_date(char *cp, int year, int month, int day)
-{
- if (month > 12)
- month = 0;
- if (day > 31)
- day = 0;
- sprintf(cp, "%d", year);
- cp[4] = month / 10 + '0';
- cp[5] = month % 10 + '0';
- cp[6] = day / 10 + '0';
- cp[7] = day % 10 + '0';
- cp[8] = 0;
-}
-
-int db_date_year(char *cp)
-{
- int year, i;
-
- for (year = 0, i = 0; i < 4; i++)
- year = year * 10 + (cp[i] - '0');
- return year;
-}
-
-int db_date_month(char *cp)
-{
- int month, i;
-
- for (month = 0, i = 4; i < 6; i++)
- month = month * 10 + (cp[i] - '0');
- return month;
-}
-
-int db_date_day(char *cp)
-{
- int day, i;
-
- for (day = 0, i = 6; i < 8; i++)
- day = day * 10 + (cp[i] - '0');
- return day;
-}
-
-#include <time.h>
-
-char *db_cur_date(char *cp)
-{
- struct tm *ctm, tmbuf;
- time_t c_time;
-
- c_time = time((time_t *)NULL);
- ctm = php_localtime_r(&c_time, &tmbuf);
- if (cp == NULL)
- cp = (char *)malloc(9);
-
- if (ctm == NULL || cp == NULL)
- return NULL;
-
- db_set_date(cp, ctm->tm_year + 1900, ctm->tm_mon + 1, ctm->tm_mday);
-
- return cp;
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/dbase/dbf_misc.h b/ext/dbase/dbf_misc.h
deleted file mode 100644
index 37fe8b0ea9..0000000000
--- a/ext/dbase/dbf_misc.h
+++ /dev/null
@@ -1,13 +0,0 @@
-void put_long(char *cp, long lval);
-extern long get_long(char *cp);
-extern int get_short(char *cp);
-void put_short(char *cp, int sval);
-void put_double(char *cp, double fval);
-extern double get_double(char *cp);
-void copy_fill(char *dp, char *sp, int len);
-void copy_crimp(char *dp, char *sp, int len);
-void db_set_date(char *cp, int year, int month, int day);
-extern int db_date_year(char *cp);
-extern int db_date_month(char *cp);
-extern int db_date_day(char *cp);
-extern char *db_cur_date(char *cp);
diff --git a/ext/dbase/dbf_ndx.c b/ext/dbase/dbf_ndx.c
deleted file mode 100644
index 9e68c6dd98..0000000000
--- a/ext/dbase/dbf_ndx.c
+++ /dev/null
@@ -1,191 +0,0 @@
-/*
- * Copyright (c) 1991, 1992, 1993 Brad Eacker,
- * (Music, Intuition, Software, and Computers)
- * All Rights Reserved
- */
-
-#include <stdio.h>
-#include <fcntl.h>
-
-#include "dbf.h"
-#include "dbf_ndx.h"
-
-/*
- * get the ndx header for this file
- */
-ndx_header_t *ndx_get_header(int fd)
-{
- dndx_header_t *dp;
- ndx_header_t *np;
-
- if ((dp = (dndx_header_t *)malloc(NDX_PAGE_SZ)) == NULL)
- return NULL;
- if ((np = (ndx_header_t *)malloc(sizeof(ndx_header_t))) == NULL) {
- free(dp);
- return NULL;
- }
- if ((lseek(fd, 0, 0) < 0) || (read(fd, dp, NDX_PAGE_SZ) < 0)) {
- free(dp); free(np);
- return NULL;
- }
- np->ndx_hpage = dp;
- np->ndx_fd = fd;
- np->ndx_start_pg = get_long(dp->dndx_st_pg);
- np->ndx_total_pgs = get_long(dp->dndx_tot_pg);
- np->ndx_key_len = get_short(dp->dndx_key_len);
- np->ndx_keys_ppg = get_short(dp->dndx_keys_ppg);
- np->ndx_key_type = get_short(dp->dndx_key_type);
- np->ndx_key_size = get_long(dp->dndx_size_key);
- np->ndx_key_name = dp->dndx_key_name;
- np->ndx_unique = dp->dndx_unique;
-
- np->ndx_fp = NULL;
-
- return np;
-}
-
-static ndx_page_t *ndx_get_page(ndx_header_t *hp, int pageno)
-{
- ndx_page_t *fp;
- dndx_page_t *dp;
- ndx_record_t *rp;
-
-#if PHP_DEBUG
- printf("getting page %d", pageno);
-#endif
- if ((fp = (ndx_page_t *)malloc(sizeof(ndx_page_t))) == NULL)
- return NULL;
- if ((dp = (dndx_page_t *)malloc(NDX_PAGE_SZ)) == NULL) {
- free(fp);
- return NULL;
- }
- if ((rp = (ndx_record_t *)malloc(sizeof(ndx_record_t) * hp->ndx_keys_ppg)) == NULL) {
- free(dp); free(fp);
- return NULL;
- }
- fp->ndxp_page_data = dp;
- if ((lseek(hp->ndx_fd, pageno * NDX_PAGE_SZ, 0) < 0) ||
- (read(hp->ndx_fd, dp, NDX_PAGE_SZ) < 0)) {
- free(fp); free(dp);
- return NULL;
- }
- fp->ndxp_parent = NULL;
- fp->ndxp_page_no = pageno;
- fp->ndxp_num_keys = get_long(dp->dndxp_num_keys);
- memset(rp, 0, sizeof(ndx_record_t) * hp->ndx_keys_ppg);
- fp->ndxp_records = rp;
- fp->ndxp_header_p = hp;
-#if PHP_DEBUG
- printf(", n_keys %ld\n", fp->ndxp_num_keys);
-#endif
- return fp;
-}
-
-/*
- * get the first entry for this ndx
- */
-static ndx_page_t *ndx_get_first_pg(ndx_header_t *hp)
-{
- ndx_page_t *fp;
-
- if (hp->ndx_fp)
- return hp->ndx_fp;
- if ((fp = ndx_get_page(hp, hp->ndx_start_pg))) {
- hp->ndx_fp = fp;
- }
- return fp;
-}
-
-static ndx_record_t *ndx_get_record(ndx_page_t *fp, int rec_no)
-{
- ndx_record_t *rp;
- ndx_header_t *hp = fp->ndxp_header_p;
- struct dndx_record *drp;
-
-#if PHP_DEBUG
- printf("page %ld, rec %d: ", fp->ndxp_page_no, rec_no);
-#endif
- if (rec_no >= fp->ndxp_num_keys)
- return NULL;
- rp = &(fp->ndxp_records[rec_no]);
- if (!rp->ndxr_page) {
- rp->ndxr_page = fp;
- drp = (dndx_record_t *)((char *)&fp->ndxp_page_data->dndx_rp
- + rec_no * hp->ndx_key_size);
- rp->ndxr_left = get_long(drp->dndx_left_pg);
- rp->ndxr_rec = get_long(drp->dndx_dbf_rec);
- rp->ndxr_key_data = &drp->dndx_key_data;
- rp->ndxr_p_nrec = rec_no;
- }
-#if PHP_DEBUG
- printf("left %ld, dbf_rec %ld, data '%s'\n", rp->ndxr_left,
- rp->ndxr_rec, rp->ndxr_key_data);
-#endif
- return rp;
-}
-
-static ndx_record_t *ndx_scan_down(ndx_header_t *hp, ndx_page_t *fp, int recno)
-{
- ndx_page_t *np;
- ndx_record_t *rp;
-
- while ((rp = ndx_get_record(fp, recno)) && (rp->ndxr_rec == 0)) {
- np = ndx_get_page(hp, rp->ndxr_left);
- np->ndxp_parent = fp;
- np->ndxp_par_rno = recno;
- fp = np;
- recno = 0;
- }
- return rp;
-}
-
-static ndx_record_t *ndx_scan_up(ndx_header_t *hp, ndx_page_t *fp, int recno)
-{
- ndx_record_t *rp;
-
- if (fp == NULL)
- rp = NULL;
- else if (recno < fp->ndxp_num_keys) {
- rp = ndx_scan_down(hp, fp, recno);
- } else {
- rp = ndx_scan_up(hp, fp->ndxp_parent, fp->ndxp_par_rno + 1);
- }
- return rp;
-}
-
-ndx_record_t *ndx_get_first_rec(ndx_header_t *hp)
-{
- ndx_page_t *fp;
- ndx_record_t *rp = NULL;
-
- if ((fp = ndx_get_first_pg(hp))) {
- fp->ndxp_last_key = 0;
- rp = ndx_scan_down(hp, fp, 0);
- }
- hp->ndx_cur_rec = rp;
- return rp;
-}
-
-ndx_record_t *ndx_get_next_rec(ndx_header_t *hp, ndx_record_t *rp)
-{
- ndx_page_t *fp;
- int rec_no;
-
- fp = rp->ndxr_page;
- rec_no = rp->ndxr_p_nrec + 1;
- if (rec_no < fp->ndxp_num_keys) {
- rp = ndx_scan_down(hp, fp, rec_no);
- } else {
- rp = ndx_scan_up(hp, fp->ndxp_parent, fp->ndxp_par_rno + 1);
- }
- return rp;
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/dbase/dbf_ndx.h b/ext/dbase/dbf_ndx.h
deleted file mode 100644
index 4bc3d29641..0000000000
--- a/ext/dbase/dbf_ndx.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Copyright (c) 1993 Brad Eacker,
- * (Music, Intuition, Software, and Computers)
- * All Rights Reserved
- */
-
-/*
- * dbf .ndx header structure on disk and in memory
- *
- * Basic info taken from:
- * "Clipper Programming Guide, 3rd Edition, Version 5.01"
- * by Rick Spence
- */
-
-#ifndef DBF_NDX_H_
-#define DBF_NDX_H_
-
-#include "dbf.h"
-
-#define NDX_PAGE_SZ 512
-
-/* on disk ndx header */
-struct dndx_header {
- char dndx_st_pg[4]; /* starting page number */
- char dndx_tot_pg[4]; /* total number of pages */
- char dndx_filler1[4]; /* space */
- char dndx_key_len[2]; /* key length */
- char dndx_keys_ppg[2]; /* number of keys per page */
- char dndx_key_type[2]; /* key type */
- char dndx_size_key[4]; /* size of the key record */
- char dndx_filler2; /* space */
- char dndx_unique; /* whether or not done with unique */
- char dndx_key_name[488]; /* string defining the key */
-};
-typedef struct dndx_header dndx_header_t;
-
-/* in memory ndx header */
-struct ndx_header {
- long ndx_start_pg;
- long ndx_total_pgs;
- unsigned short ndx_key_len;
- unsigned short ndx_keys_ppg;
- unsigned short ndx_key_type;
- char ndx_unique;
- long ndx_key_size;
- char *ndx_key_name;
- int ndx_fd;
- struct ndx_page *ndx_fp;
- dndx_header_t *ndx_hpage;
- struct ndx_record *ndx_cur_rec;
-};
-typedef struct ndx_header ndx_header_t;
-
-/* these are the possible values in the key type field */
-#define NDX_CHAR_TYPE 00
-#define NDX_NUM_TYPE 01
-
-/* on disk key record */
-struct dndx_record {
- char dndx_left_pg[4]; /* number of left page */
- char dndx_dbf_rec[4]; /* dbf record number */
- char dndx_key_data; /* key data */
-};
-typedef struct dndx_record dndx_record_t;
-
-struct ndx_record {
- long ndxr_left;
- long ndxr_rec;
- char *ndxr_key_data;
- struct ndx_page *ndxr_page; /* page pointer to where we are from*/
- int ndxr_p_nrec; /* number of the record within page */
-};
-typedef struct ndx_record ndx_record_t;
-
-struct dndx_page {
- char dndxp_num_keys[4]; /* number of keys on this page */
- struct dndx_record dndx_rp;
-};
-typedef struct dndx_page dndx_page_t;
-
-struct ndx_page {
- long ndxp_page_no;
- long ndxp_num_keys;
- dndx_page_t *ndxp_page_data;
- ndx_header_t *ndxp_header_p;
- long ndxp_last_key;
- struct ndx_page *ndxp_parent; /* parent page */
- int ndxp_par_rno; /* record number within parent */
- struct ndx_record *ndxp_records;
-};
-typedef struct ndx_page ndx_page_t;
-
-extern ndx_header_t *ndx_get_header(int);
-
-extern ndx_record_t *ndx_get_first_rec(ndx_header_t *);
-extern ndx_record_t *ndx_get_next_rec(ndx_header_t *, ndx_record_t *);
-
-#endif /* DBF_NDX_H_ */
diff --git a/ext/dbase/dbf_rec.c b/ext/dbase/dbf_rec.c
deleted file mode 100644
index da8b8bdad7..0000000000
--- a/ext/dbase/dbf_rec.c
+++ /dev/null
@@ -1,191 +0,0 @@
-/*
- * Copyright (c) 1993 Brad Eacker,
- * (Music, Intuition, Software, and Computers)
- * All Rights Reserved
- */
-
-#include <stdio.h>
-#include <fcntl.h>
-
-#include "dbf.h"
-
-int get_piece(dbhead_t *dbh, long offset, char *cp, int len);
-int put_piece(dbhead_t *dbh, long offset, char *cp, int len);
-
-/*
- * get a record off the database
- */
-char *get_dbf_record(dbhead_t *dbh, long rec_num)
-{
- long offset;
- char *cp;
-
- if (rec_num > dbh->db_records) {
- return NULL;
- }
- if ((cp = (char *)malloc(dbh->db_rlen)) == NULL) {
- return NULL;
- }
-
- /* go to the correct spot on the file */
- offset = dbh->db_hlen + (rec_num - 1) * dbh->db_rlen;
- if (get_piece(dbh, offset, cp, dbh->db_rlen) != dbh->db_rlen) {
- free(cp);
- cp = NULL;
- }
- if (cp)
- dbh->db_cur_rec = rec_num;
- return cp;
-}
-
-int
-get_piece(dbhead_t *dbh, long offset, char *cp, int len)
-{
- /* go to the correct spot on the file */
- if ( lseek(dbh->db_fd, offset, 0) < 0 ) {
- return -1;
- }
-
- /* read the record into the allocated space */
- return read(dbh->db_fd, cp, len);
-}
-
-/*
- * put a record to the database
- */
-long put_dbf_record(dbhead_t *dbh, long rec_num, char *cp)
-{
- long offset;
-
- if (rec_num == 0) {
- rec_num = dbh->db_records;
- }
- if (rec_num > dbh->db_records) {
- return 0L;
- }
- /* go to the correct spot on the file */
- offset = dbh->db_hlen + (rec_num - 1) * dbh->db_rlen;
- if (put_piece(dbh, offset, cp, dbh->db_rlen) != dbh->db_rlen) {
- rec_num = -1;
- }
- return rec_num;
-}
-
-int put_piece(dbhead_t *dbh, long offset, char *cp, int len)
-{
- /* go to the correct spot on the file */
- if ( lseek(dbh->db_fd, offset, 0) < 0 ) {
- return -1;
- }
-
- /* write the record into the file */
- return write(dbh->db_fd, cp, len);
-}
-
-int del_dbf_record(dbhead_t *dbh, long rec_num)
-{
- int ret = 0;
- char *cp;
-
- if (rec_num > dbh->db_records)
- return -1;
- if ((cp = get_dbf_record(dbh, rec_num))) {
- *cp = DELETED_RECORD;
- ret = put_dbf_record(dbh, rec_num, cp);
- free(cp);
- }
- return ret;
-}
-
-void pack_dbf(dbhead_t *dbh)
-{
- long out_off, in_off;
- int rec_cnt, new_cnt;
- char *cp;
-
- if ((cp = (char *)malloc(dbh->db_rlen)) == NULL) {
- return;
- }
- in_off = out_off = dbh->db_hlen;
-
- new_cnt = 0;
- rec_cnt = dbh->db_records;
- while (rec_cnt > 0) {
- if (get_piece(dbh, in_off, cp, dbh->db_rlen) < 0)
- break;
-
- if (*cp != DELETED_RECORD) {
- /* write the record into the file */
- if (put_piece(dbh, out_off, cp, dbh->db_rlen) < 0)
- break;
- out_off += dbh->db_rlen;
- new_cnt++;
- }
- in_off += dbh->db_rlen;
- rec_cnt--;
- }
- free(cp);
- if (rec_cnt == 0)
- dbh->db_records = new_cnt;
-}
-
-/* routine to get a field from a record */
-char *get_field_val(char *rp, dbfield_t *fldp, char *cp)
-{
- int flen = fldp->db_flen;
-
- if ( !cp )
- cp = (char *)malloc(flen + 1);
- if ( cp ) {
- strncpy(cp, &rp[fldp->db_foffset], flen);
- cp[flen] = 0;
- }
- return cp;
-}
-
-void put_field_val(char *rp, dbfield_t *fldp, char *cp)
-{
- strncpy(&rp[fldp->db_foffset], cp, fldp->db_flen);
-}
-
-/*
- * output a record
- */
-void out_rec(dbhead_t *dbh, dbfield_t *dbf, char *cp)
-{
- dbfield_t *cur_f;
- int nfields = dbh->db_nfields;
- char *fnp = (char *)malloc(dbh->db_rlen);
-
- printf("%c", *cp);
- for (cur_f = dbf; cur_f < &dbf[nfields] ; cur_f++) {
- printf(" ");
- printf(cur_f->db_format, get_field_val(cp, cur_f, fnp));
- }
- printf("\n");
- free(fnp);
-}
-
-/* check for record validity */
-int is_valid_rec(char *cp)
-{
- if (cp && (*cp == VALID_RECORD))
- return 1;
- else
- return 0;
-}
-
-/* get the next record */
-char *dbf_get_next(dbhead_t *dbh)
-{
- return get_dbf_record(dbh, dbh->db_cur_rec + 1);
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/dbase/dbf_rec.h b/ext/dbase/dbf_rec.h
deleted file mode 100644
index 6407c702f6..0000000000
--- a/ext/dbase/dbf_rec.h
+++ /dev/null
@@ -1,10 +0,0 @@
-extern char *get_dbf_record(dbhead_t *dbh, long rec_num);
-extern long put_dbf_record(dbhead_t *dbh, long rec_num, char *cp);
-extern int put_piece(dbhead_t *dbh, long offset, char *cp, int len);
-extern int del_dbf_record(dbhead_t *dbh, long rec_num);
-void pack_dbf(dbhead_t *dbh);
-extern char *get_field_val(char *rp, dbfield_t *fldp, char *cp);
-void put_field_val(char *rp, dbfield_t *fldp, char *cp);
-void out_rec(dbhead_t *dbh, dbfield_t *dbf, char *cp);
-extern int is_valid_rec(char *cp);
-extern char *dbf_get_next(dbhead_t *dbh);
diff --git a/ext/dbase/php_dbase.h b/ext/dbase/php_dbase.h
deleted file mode 100644
index c01511db77..0000000000
--- a/ext/dbase/php_dbase.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Jim Winstead (jimw@php.net) |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef PHP_DBASE_H
-#define PHP_DBASE_H
-#if DBASE
-extern zend_module_entry dbase_module_entry;
-#define dbase_module_ptr &dbase_module_entry
-
-extern PHP_MINIT_FUNCTION(dbase);
-PHP_FUNCTION(dbase_open);
-PHP_FUNCTION(dbase_create);
-PHP_FUNCTION(dbase_close);
-PHP_FUNCTION(dbase_numrecords);
-PHP_FUNCTION(dbase_numfields);
-PHP_FUNCTION(dbase_add_record);
-PHP_FUNCTION(dbase_get_record);
-PHP_FUNCTION(dbase_delete_record);
-PHP_FUNCTION(dbase_pack);
-PHP_FUNCTION(dbase_get_record_with_names);
-#else
-#define dbase_module_ptr NULL
-#endif
-
-#define phpext_dbase_ptr dbase_module_ptr
-
-#endif /* PHP_DBASE_H */
diff --git a/ext/dbase/setup.stub b/ext/dbase/setup.stub
deleted file mode 100644
index 427ecf069d..0000000000
--- a/ext/dbase/setup.stub
+++ /dev/null
@@ -1,4 +0,0 @@
-# $Id$ -*- sh -*-
-
-define_option with-dbase 'dBase support? ' yesno no \
-' Whether to use the bundled dbase library.'
diff --git a/ext/dbx/CREDITS b/ext/dbx/CREDITS
deleted file mode 100644
index 976079e8f7..0000000000
--- a/ext/dbx/CREDITS
+++ /dev/null
@@ -1,7 +0,0 @@
-dbx (database abstraction)
-
-core routines: Marc Boeren (Guidance Rotterdam bv)
-mysql support: Marc Boeren
-odbc support: Marc Boeren
-pgsql support: Rui Hirokawa
-mssql support: Marc Boeren
diff --git a/ext/dbx/EXPERIMENTAL b/ext/dbx/EXPERIMENTAL
deleted file mode 100644
index 6443e99646..0000000000
--- a/ext/dbx/EXPERIMENTAL
+++ /dev/null
@@ -1,5 +0,0 @@
-this extension is experimental,
-its functions may change their names
-or move to extension all together
-so do not rely to much on them
-you have been warned!
diff --git a/ext/dbx/INSTALL b/ext/dbx/INSTALL
deleted file mode 100644
index d98e33a42d..0000000000
--- a/ext/dbx/INSTALL
+++ /dev/null
@@ -1,25 +0,0 @@
-
-If you downloaded this separately, you can place the dbx folder
-in the php-source-folders under the ext/ folder. Be sure to
-use buildconf to rebuild the configure script.
-
-Linux:
-
-Compile php with the --enable-dbx switch
-
-Windows:
-
-This should set all includepaths to the right
-relative folders. Open the .dsp and compile. You could also
-add this project to the php_modules project.
-It generates a php_dbx.dll in your extensions folder, and you
-must enable it in your php.ini file.
-
-
-When you run phpinfo(), dbx-support should be visible in the
-resulting table.
-
-Good luck and enjoy!
-
-Marc Boeren
-march 16th, 2001
diff --git a/ext/dbx/Makefile.in b/ext/dbx/Makefile.in
deleted file mode 100644
index ad86ae96c7..0000000000
--- a/ext/dbx/Makefile.in
+++ /dev/null
@@ -1,6 +0,0 @@
-
-LTLIBRARY_NAME = libdbx.la
-LTLIBRARY_SOURCES = dbx.c dbx_mysql.c dbx_odbc.c dbx_pgsql.c dbx_mssql.c
-LTLIBRARY_SHARED_NAME = dbx.la
-
-include $(top_srcdir)/build/dynlib.mk
diff --git a/ext/dbx/config.m4 b/ext/dbx/config.m4
deleted file mode 100644
index 5cf4885c7d..0000000000
--- a/ext/dbx/config.m4
+++ /dev/null
@@ -1,7 +0,0 @@
-
-PHP_ARG_ENABLE(dbx,whether to enable dbx support,
-[ --enable-dbx Enable dbx])
-
-if test "$PHP_DBX" != "no"; then
- PHP_EXTENSION(dbx, $ext_shared)
-fi
diff --git a/ext/dbx/dbx.c b/ext/dbx/dbx.c
deleted file mode 100644
index 055d7350e0..0000000000
--- a/ext/dbx/dbx.c
+++ /dev/null
@@ -1,770 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | dbx module version 1.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 2001 Guidance Rotterdam BV |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author : Marc Boeren <marc@guidance.nl> |
- +----------------------------------------------------------------------+
-*/
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "php_ini.h"
-#include "php_dbx.h"
-#include "ext/standard/info.h"
-
-/* defines for supported databases */
-#define DBX_UNKNOWN 0
-#define DBX_MYSQL 1
-#define DBX_ODBC 2
-#define DBX_PGSQL 3
-#define DBX_MSSQL 4
-/* includes for supported databases */
-#include "dbx.h"
-#include "dbx_mysql.h"
-#include "dbx_odbc.h"
-#include "dbx_pgsql.h"
-#include "dbx_mssql.h"
-
-/* support routines */
-int module_exists(char * module_name) {
- zend_module_entry * zme;
- int r;
- r = zend_hash_find(&module_registry, module_name, strlen(module_name)+1, (void **) &zme);
- return r==0?1:0;
- }
-
-int module_identifier_exists(long module_identifier) {
- switch (module_identifier) {
- case DBX_MYSQL: return module_exists("mysql");
- case DBX_ODBC: return module_exists("odbc");
- case DBX_PGSQL: return module_exists("pgsql");
- case DBX_MSSQL: return module_exists("mssql");
- }
- return 0;
- }
-
-int get_module_identifier(char * module_name) {
- if (!strcmp("mysql", module_name)) return DBX_MYSQL;
- if (!strcmp("odbc", module_name)) return DBX_ODBC;
- if (!strcmp("pgsql", module_name)) return DBX_PGSQL;
- if (!strcmp("mssql", module_name)) return DBX_MSSQL;
- return DBX_UNKNOWN;
- }
-
-int split_dbx_handle_object(zval ** dbx_object, zval *** pdbx_handle, zval *** pdbx_module, zval *** pdbx_database) {
- convert_to_object_ex(dbx_object);
- if (zend_hash_find((*dbx_object)->value.obj.properties, "handle", 7, (void **) pdbx_handle)==FAILURE
- || zend_hash_find((*dbx_object)->value.obj.properties, "module", 7, (void **) pdbx_module)==FAILURE
- || zend_hash_find((*dbx_object)->value.obj.properties, "database", 9, (void **) pdbx_database)==FAILURE) {
- return 0;
- }
- return 1;
- }
-
-/* from dbx.h, to be used in support-files (dbx_mysql.c etc...) */
-void dbx_call_any_function(INTERNAL_FUNCTION_PARAMETERS, char * function_name, zval ** returnvalue, int number_of_arguments, zval *** params) {
- zval * zval_function_name;
- MAKE_STD_ZVAL(zval_function_name);
- ZVAL_STRING(zval_function_name, function_name, 1);
- if (call_user_function_ex(EG(function_table), NULL, zval_function_name, returnvalue, number_of_arguments, params, 0, NULL) == FAILURE) {
- zend_error(E_ERROR, "function '%s' not found", zval_function_name->value.str.val);
- }
- zval_dtor(zval_function_name); /* to free stringvalue memory */
- FREE_ZVAL(zval_function_name);
- }
-
-/* switch_dbx functions declarations
- * each must be supported in the dbx_module files as dbx_module_function,
- * e.g. switch_dbx_connect expects a dbx_mysql_connect in de dbx_mysql files
- * all params except the dbx_module param are passed on
- * each must return the expected zval * 's in the rv parameter, which are passed on unmodified
- * do NOT use the return_value parameter from INTERNAL_FUNCTION_PARAMETERS
- * you can additionally return 0 or 1 for failure or success which will also be returned by the switches
- */
-int switch_dbx_connect(zval ** rv, zval ** host, zval ** db, zval ** username, zval ** password, INTERNAL_FUNCTION_PARAMETERS, zval ** dbx_module);
- /* returns connection handle as resource on success or 0 as long on failure */
-int switch_dbx_pconnect(zval ** rv, zval ** host, zval ** db, zval ** username, zval ** password, INTERNAL_FUNCTION_PARAMETERS, zval ** dbx_module);
- /* returns persistent connection handle as resource on success or 0 as long on failure */
-int switch_dbx_close(zval ** rv, zval ** dbx_handle, INTERNAL_FUNCTION_PARAMETERS, zval ** dbx_module);
- /* returns 1 as long on success or 0 as long on failure */
-int switch_dbx_query(zval ** rv, zval ** dbx_handle, zval ** db_name, zval ** sql_statement, INTERNAL_FUNCTION_PARAMETERS, zval ** dbx_module);
- /* returns 1 as long or result identifier as resource on success or 0 as long on failure */
-int switch_dbx_getcolumncount(zval ** rv, zval ** result_handle, INTERNAL_FUNCTION_PARAMETERS, zval ** dbx_module);
- /* returns column-count as long on success or 0 as long on failure */
-int switch_dbx_getcolumnname(zval ** rv, zval ** result_handle, long column_index, INTERNAL_FUNCTION_PARAMETERS, zval ** dbx_module);
- /* returns column-name as string on success or 0 as long on failure */
-int switch_dbx_getcolumntype(zval ** rv, zval ** result_handle, long column_index, INTERNAL_FUNCTION_PARAMETERS, zval ** dbx_module);
- /* returns column-type as string on success or 0 as long on failure */
-int switch_dbx_getrow(zval ** rv, zval ** result_handle, long row_number, INTERNAL_FUNCTION_PARAMETERS, zval ** dbx_module);
- /* returns array[0..columncount-1] as strings on success or 0 as long on failure */
-int switch_dbx_error(zval ** rv, zval ** dbx_handle, INTERNAL_FUNCTION_PARAMETERS, zval ** dbx_module);
- /* returns string */
-
-/* Every user visible function must have an entry in dbx_functions[].
-*/
-function_entry dbx_functions[] = {
- ZEND_FE(dbx_connect, NULL)
- ZEND_FE(dbx_close, NULL)
- ZEND_FE(dbx_query, NULL)
- ZEND_FE(dbx_error, NULL)
-
- ZEND_FE(dbx_sort, NULL)
- ZEND_FE(dbx_compare, NULL)
-
- {NULL, NULL, NULL} /* Must be the last line in dbx_functions[] */
- };
-
-zend_module_entry dbx_module_entry = {
- "dbx",
- dbx_functions,
- ZEND_MINIT(dbx),
- ZEND_MSHUTDOWN(dbx),
- NULL, /*ZEND_RINIT(dbx), /* Replace with NULL if there's nothing to do at request start */
- NULL, /*ZEND_RSHUTDOWN(dbx), /* Replace with NULL if there's nothing to do at request end */
- ZEND_MINFO(dbx),
- STANDARD_MODULE_PROPERTIES
- };
-
-#ifdef COMPILE_DL_DBX
-ZEND_GET_MODULE(dbx)
-#endif
-
-ZEND_MINIT_FUNCTION(dbx)
-{
- REGISTER_LONG_CONSTANT("DBX_MYSQL", DBX_MYSQL, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("DBX_ODBC", DBX_ODBC, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("DBX_PGSQL", DBX_PGSQL, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("DBX_MSSQL", DBX_MSSQL, CONST_CS | CONST_PERSISTENT);
-
- REGISTER_LONG_CONSTANT("DBX_PERSISTENT", DBX_PERSISTENT, CONST_CS | CONST_PERSISTENT);
-
- REGISTER_LONG_CONSTANT("DBX_RESULT_INFO", DBX_RESULT_INFO, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("DBX_RESULT_INDEX", DBX_RESULT_INDEX, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("DBX_RESULT_ASSOC", DBX_RESULT_ASSOC, CONST_CS | CONST_PERSISTENT);
-
- REGISTER_LONG_CONSTANT("DBX_CMP_NATIVE", DBX_CMP_NATIVE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("DBX_CMP_TEXT", DBX_CMP_TEXT, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("DBX_CMP_NUMBER", DBX_CMP_NUMBER, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("DBX_CMP_ASC", DBX_CMP_ASC, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("DBX_CMP_DESC", DBX_CMP_DESC, CONST_CS | CONST_PERSISTENT);
-
- return SUCCESS;
- }
-
-ZEND_MSHUTDOWN_FUNCTION(dbx)
-{
- return SUCCESS;
-}
-
-/* Remove if there's nothing to do at request start */
-/*ZEND_RINIT_FUNCTION(dbx)
-{ return SUCCESS;
-}*/
-
-/* Remove if there's nothing to do at request end */
-/*ZEND_RSHUTDOWN_FUNCTION(dbx)
-{ return SUCCESS;
-}*/
-
-ZEND_MINFO_FUNCTION(dbx)
-{
- php_info_print_table_start();
- php_info_print_table_row(2, "dbx support", "enabled");
- php_info_print_table_row(2, "dbx version", "1.0.0");
- php_info_print_table_row(2, "supported databases", "MySQL<br />ODBC<br />PostgreSQL<br />Microsoft SQL Server");
- php_info_print_table_end();
-}
-
-/*
-
- actual implementation of the dbx functions
-
-*/
-
-/* {{{ proto dbx_link_object dbx_connect(string module_name, string host, string db, string username, string password [, bool persistent])
- returns a dbx_link_object on success
- returns 0 on failure
-*/
-ZEND_FUNCTION(dbx_connect)
-{
- int number_of_arguments=5;
- zval ** arguments[6];
-
- int result;
- long module_identifier;
- zval * dbx_module;
- zval * db_name;
- zval * rv_dbx_handle;
- int persistent=0;
-
- if ( !(ZEND_NUM_ARGS()==number_of_arguments+1 || ZEND_NUM_ARGS()==number_of_arguments) || zend_get_parameters_array_ex(ZEND_NUM_ARGS(), arguments) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- if (ZEND_NUM_ARGS()==number_of_arguments+1) {
- convert_to_long_ex(arguments[5]);
- if ((*arguments[5])->value.lval!=0) persistent=1;
- }
-
- if ((*arguments[0])->type == IS_LONG) {
- if (!module_identifier_exists((*arguments[0])->value.lval)) {
- zend_error(E_WARNING, "dbx: module '%ld' not loaded or not supported.\n", (*arguments[0])->value.lval);
- return;
- }
- module_identifier = (*arguments[0])->value.lval;
- }
- else {
- convert_to_string_ex(arguments[0]);
- if (!module_exists((*arguments[0])->value.str.val)) {
- zend_error(E_WARNING, "dbx: module '%s' not loaded.\n", (*arguments[0])->value.str.val);
- return;
- }
- module_identifier=get_module_identifier((*arguments[0])->value.str.val);
- if (!module_identifier) {
- zend_error(E_WARNING, "dbx: unsupported module '%s'.\n", (*arguments[0])->value.str.val);
- return;
- }
- }
-
- MAKE_STD_ZVAL(dbx_module);
- ZVAL_LONG(dbx_module, module_identifier);
- MAKE_STD_ZVAL(rv_dbx_handle);
- ZVAL_LONG(rv_dbx_handle, 0);
- convert_to_string_ex(arguments[1]);
- convert_to_string_ex(arguments[2]);
- convert_to_string_ex(arguments[3]);
- convert_to_string_ex(arguments[4]);
- MAKE_STD_ZVAL(db_name);
- ZVAL_STRING(db_name, (*arguments[2])->value.str.val, 1);
- if (persistent) {
- result = switch_dbx_pconnect(&rv_dbx_handle, arguments[1], arguments[2], arguments[3], arguments[4], INTERNAL_FUNCTION_PARAM_PASSTHRU, &dbx_module);
- }
- else {
- result = switch_dbx_connect(&rv_dbx_handle, arguments[1], arguments[2], arguments[3], arguments[4], INTERNAL_FUNCTION_PARAM_PASSTHRU, &dbx_module);
- }
- if (!result) {
- FREE_ZVAL(dbx_module);
- zval_dtor(db_name); /* to free stringvalue memory */
- FREE_ZVAL(db_name);
- FREE_ZVAL(rv_dbx_handle);
- RETURN_LONG(0);
- }
-
- if (object_init(return_value) != SUCCESS) {
- zend_error(E_ERROR, "dbx: unable to create resulting object...");
- FREE_ZVAL(dbx_module);
- zval_dtor(db_name); /* to free stringvalue memory */
- FREE_ZVAL(db_name);
- FREE_ZVAL(rv_dbx_handle);
- RETURN_LONG(0);
- }
-
- zend_hash_update(return_value->value.obj.properties, "handle", 7, (void *)&(rv_dbx_handle), sizeof(zval *), NULL);
- zend_hash_update(return_value->value.obj.properties, "module", 7, (void *)&(dbx_module), sizeof(zval *), NULL);
- zend_hash_update(return_value->value.obj.properties, "database", 9, (void *)&(db_name), sizeof(zval *), NULL);
-}
-/* }}} */
-
-/* {{{ proto bool dbx_close(dbx_link_object dbx_link)
- Returns success or failure
-*/
-ZEND_FUNCTION(dbx_close)
-{
- int number_of_arguments=1;
- zval ** arguments[1];
-
- int result;
- zval ** dbx_handle;
- zval ** dbx_module;
- zval ** dbx_database;
- zval * rv_success;
-
- if (ZEND_NUM_ARGS() !=number_of_arguments || zend_get_parameters_array_ex(number_of_arguments, arguments) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- if (!split_dbx_handle_object(arguments[0], &dbx_handle, &dbx_module, &dbx_database)) {
- zend_error(E_WARNING, "dbx_close: not a valid dbx_handle-object...");
- RETURN_LONG(0);
- }
-
- MAKE_STD_ZVAL(rv_success);
- ZVAL_LONG(rv_success, 0);
-
- result = switch_dbx_close(&rv_success, dbx_handle, INTERNAL_FUNCTION_PARAM_PASSTHRU, dbx_module);
-
- result = (result && rv_success->value.lval)?1:0;
-
- FREE_ZVAL(rv_success);
-
- RETURN_LONG(result?1:0);
-}
-/* }}} */
-
-/* {{{ proto dbx_result_object dbx_query(dbx_link_object dbx_link, string sql_statement [, long flags])
- returns a dbx_link_object on success
- returns 0 on failure
-*/
-ZEND_FUNCTION(dbx_query)
-{
- int min_number_of_arguments=2;
- int number_of_arguments=3;
- zval ** arguments[3];
-
- int result;
- zval ** dbx_handle;
- zval ** dbx_module;
- zval ** dbx_database;
- zval * rv_result_handle;
- zval * rv_column_count;
- long col_index;
- long row_count;
- zval * info;
- long info_flags;
- zval * data;
- zval ** row_ptr;
- zval ** inforow_ptr;
-
- if (ZEND_NUM_ARGS()<min_number_of_arguments || ZEND_NUM_ARGS()>number_of_arguments || zend_get_parameters_array_ex(ZEND_NUM_ARGS(), arguments) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- if (!split_dbx_handle_object(arguments[0], &dbx_handle, &dbx_module, &dbx_database)) {
- zend_error(E_WARNING, "dbx_query: not a valid dbx_handle-object...");
- RETURN_LONG(0);
- }
- /* default values */
- info_flags = DBX_RESULT_INFO | DBX_RESULT_INDEX | DBX_RESULT_ASSOC;
- /* parameter overrides */
- if (ZEND_NUM_ARGS()>2) {
- convert_to_long_ex(arguments[2]);
- info_flags = (*arguments[2])->value.lval;
- /* fieldnames are needed for association! */
- if (info_flags & DBX_RESULT_ASSOC) {
- info_flags |= DBX_RESULT_INFO;
- }
- }
- MAKE_STD_ZVAL(rv_result_handle);
- ZVAL_LONG(rv_result_handle, 0);
- convert_to_string_ex(arguments[1]);
- result = switch_dbx_query(&rv_result_handle, dbx_handle, dbx_database, arguments[1], INTERNAL_FUNCTION_PARAM_PASSTHRU, dbx_module);
- /* boolean return value means either failure for any query or success for queries that don't return anything */
- if (!result || (rv_result_handle && rv_result_handle->type==IS_BOOL)) {
- result = (result && rv_result_handle->value.lval)?1:0;
- FREE_ZVAL(rv_result_handle);
- RETURN_LONG(result?1:0);
- }
- /* if you get here, the query succeeded and returned results, so we'll return them
- * rv_result_handle holds a resource
- */
- /* init return_value as object (of rows) */
- if (object_init(return_value) != SUCCESS) {
- zend_error(E_ERROR, "dbx_query: unable to create resulting object...");
- FREE_ZVAL(rv_result_handle);
- RETURN_LONG(0);
- }
- /* add result_handle property to return_value */
- zend_hash_update(return_value->value.obj.properties, "handle", 7, (void *)&(rv_result_handle), sizeof(zval *), NULL);
- /* init info property as array and add to return_value as a property */
- if (info_flags & DBX_RESULT_INFO) {
- MAKE_STD_ZVAL(info);
- if (array_init(info) != SUCCESS) {
- zend_error(E_ERROR, "dbx_query: unable to create info-array for results...");
- FREE_ZVAL(info);
- RETURN_LONG(0);
- }
- zend_hash_update(return_value->value.obj.properties, "info", 5, (void *)&(info), sizeof(zval *), NULL);
- }
- /* init data property as array and add to return_value as a property */
- MAKE_STD_ZVAL(data);
- if (array_init(data) != SUCCESS) {
- zend_error(E_ERROR, "dbx_query: unable to create data-array for results...");
- FREE_ZVAL(data);
- RETURN_LONG(0);
- }
- zend_hash_update(return_value->value.obj.properties, "data", 5, (void *)&(data), sizeof(zval *), NULL);
- /* get columncount and add to returnvalue as property */
- MAKE_STD_ZVAL(rv_column_count);
- ZVAL_LONG(rv_column_count, 0);
- result = switch_dbx_getcolumncount(&rv_column_count, &rv_result_handle, INTERNAL_FUNCTION_PARAM_PASSTHRU, dbx_module);
- if (!result) {
- zend_error(E_ERROR, "dbx_query: get column_count failed...");
- FREE_ZVAL(rv_column_count);
- RETURN_LONG(0);
- }
- zend_hash_update(return_value->value.obj.properties, "cols", 5, (void *)&(rv_column_count), sizeof(zval *), NULL);
- /* fill the info array with columnnames and types (indexed and assoc) */
- if (info_flags & DBX_RESULT_INFO) {
- zval * info_row_name;
- zval * info_row_type;
- MAKE_STD_ZVAL(info_row_name);
- MAKE_STD_ZVAL(info_row_type);
- if (array_init(info_row_name) != SUCCESS) {
- zend_error(E_ERROR, "dbx_query: unable to create info_row_name-array for results...");
- FREE_ZVAL(info_row_name);
- FREE_ZVAL(info_row_type);
- RETURN_LONG(0);
- }
- if (array_init(info_row_type) != SUCCESS) {
- zend_error(E_ERROR, "dbx_query: unable to create info_row_type-array for results...");
- FREE_ZVAL(info_row_name);
- FREE_ZVAL(info_row_type);
- RETURN_LONG(0);
- }
- for (col_index=0; col_index<rv_column_count->value.lval; ++col_index) {
- zval * rv_column_name;
- zval * rv_column_type;
- /* get name */
- MAKE_STD_ZVAL(rv_column_name);
- ZVAL_LONG(rv_column_name, 0);
- result = switch_dbx_getcolumnname(&rv_column_name, &rv_result_handle, col_index, INTERNAL_FUNCTION_PARAM_PASSTHRU, dbx_module);
- if (result) {
- zend_hash_index_update(info_row_name->value.ht, col_index, (void *)&(rv_column_name), sizeof(zval *), NULL);
- }
- else {
- FREE_ZVAL(rv_column_name);
- }
- /* get type */
- MAKE_STD_ZVAL(rv_column_type);
- ZVAL_LONG(rv_column_type, 0);
- result = switch_dbx_getcolumntype(&rv_column_type, &rv_result_handle, col_index, INTERNAL_FUNCTION_PARAM_PASSTHRU, dbx_module);
- if (result) {
- zend_hash_index_update(info_row_type->value.ht, col_index, (void *)&(rv_column_type), sizeof(zval *), NULL);
- }
- else {
- FREE_ZVAL(rv_column_type);
- }
- }
- zend_hash_update(info->value.ht, "name", 5, (void *) &info_row_name, sizeof(zval *), (void **) &inforow_ptr);
- zend_hash_update(info->value.ht, "type", 5, (void *) &info_row_type, sizeof(zval *), NULL);
- }
- /* fill each row array with fieldvalues (indexed (and assoc)) */
- row_count=0;
- result=1;
- while (result) {
- zval * rv_row;
- MAKE_STD_ZVAL(rv_row);
- ZVAL_LONG(rv_row, 0);
- result = switch_dbx_getrow(&rv_row, &rv_result_handle, row_count, INTERNAL_FUNCTION_PARAM_PASSTHRU, dbx_module);
- if (result) {
- zend_hash_index_update(data->value.ht, row_count, (void *)&(rv_row), sizeof(zval *), (void **) &row_ptr);
- /* associate results with fieldnames */
- if (info_flags & DBX_RESULT_ASSOC) {
- zval **columnname_ptr, **actual_ptr, **reference_ptr;
- zval * dummy;
- ALLOC_ZVAL(dummy);
- INIT_ZVAL(*dummy);
- for (col_index=0; col_index<rv_column_count->value.lval; ++col_index) {
- zend_hash_index_find((*inforow_ptr)->value.ht, col_index, (void **) &columnname_ptr);
- zend_hash_index_find((*row_ptr)->value.ht, col_index, (void **) &actual_ptr);
- zend_hash_update((*row_ptr)->value.ht, (*columnname_ptr)->value.str.val, (*columnname_ptr)->value.str.len + 1, &dummy, sizeof(zval *), (void **) &reference_ptr);
- zend_assign_to_variable_reference(NULL, reference_ptr, actual_ptr, NULL ELS_CC);
- }
- }
- ++row_count;
- }
- else {
- FREE_ZVAL(rv_row);
- }
- }
- /* add row_count property */
- add_property_long(return_value, "rows", row_count);
-}
-/* }}} */
-
-/* {{{ proto void dbx_error(dbx_link_object dbx_link)
- Returns success or failure
-*/
-ZEND_FUNCTION(dbx_error)
-{
- int number_of_arguments=1;
- zval ** arguments[1];
-
- int result;
- zval ** dbx_handle;
- zval ** dbx_module;
- zval ** dbx_database;
- zval * rv_errormsg;
-
- if (ZEND_NUM_ARGS() !=number_of_arguments || zend_get_parameters_array_ex(number_of_arguments, arguments) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- if (!split_dbx_handle_object(arguments[0], &dbx_handle, &dbx_module, &dbx_database)) {
- zend_error(E_WARNING, "dbx_error: not a valid dbx_handle-object...");
- RETURN_LONG(0);
- }
-
- MAKE_STD_ZVAL(rv_errormsg);
- ZVAL_LONG(rv_errormsg, 0);
- result = switch_dbx_error(&rv_errormsg, dbx_handle, INTERNAL_FUNCTION_PARAM_PASSTHRU, dbx_module);
- if (!result) {
- FREE_ZVAL(rv_errormsg);
- RETURN_STRING("", 1);
- }
- MOVE_RETURNED_TO_RV(&return_value, rv_errormsg);
-}
-/* }}} */
-
-/*
- * dbx functions that are database independent... like sorting result_objects!
- */
-
-/* {{{ proto long dbx_compare(array row_x, array row_y, string columnname [, flags])
- returns row_y[columnname] - row_x[columnname], converted to -1, 0 or 1
-*/
-ZEND_FUNCTION(dbx_compare)
-{
- int min_number_of_arguments=3;
- int max_number_of_arguments=4;
- int number_of_arguments=-1;
- long comparison_direction=DBX_CMP_ASC;
- long comparison_type=DBX_CMP_NATIVE;
- double dtemp;
- long ltemp;
- zval ** arguments[4];
- zval ** zv_a;
- zval ** zv_b;
- int result=0;
- number_of_arguments=ZEND_NUM_ARGS();
- if (number_of_arguments<min_number_of_arguments || number_of_arguments>max_number_of_arguments || zend_get_parameters_array_ex(number_of_arguments, arguments) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if ((*arguments[0])->type != IS_ARRAY
- || (*arguments[1])->type != IS_ARRAY) {
- zend_error(E_WARNING, "Wrong argument type for compare");
- RETURN_LONG(0);
- }
- convert_to_string_ex(arguments[2]); /* field name */
- comparison_type = DBX_CMP_NATIVE;
- comparison_direction = DBX_CMP_ASC;
- if (number_of_arguments>3) {
- convert_to_long_ex(arguments[3]); /* comparison type and direction*/
- /* direction */
- if ((*arguments[3])->value.lval & DBX_CMP_DESC) {
- comparison_direction=DBX_CMP_DESC;
- }
- if ((*arguments[3])->value.lval & DBX_CMP_ASC) {
- comparison_direction=DBX_CMP_ASC;
- }
- /* type */
- if ((*arguments[3])->value.lval & DBX_CMP_NUMBER) {
- comparison_type=DBX_CMP_NUMBER;
- }
- if ((*arguments[3])->value.lval & DBX_CMP_TEXT) {
- comparison_type=DBX_CMP_TEXT;
- }
- if ((*arguments[3])->value.lval & DBX_CMP_NATIVE) {
- comparison_type=DBX_CMP_NATIVE;
- }
- }
-
- if (zend_hash_find((*arguments[0])->value.ht, (*arguments[2])->value.str.val, (*arguments[2])->value.str.len+1, (void **) &zv_a)==FAILURE
- || zend_hash_find((*arguments[1])->value.ht, (*arguments[2])->value.str.val, (*arguments[2])->value.str.len+1, (void **) &zv_b)==FAILURE) {
- zend_error(E_WARNING, "Field '%s' not available in result-object", (*arguments[2])->value.str.val);
- RETURN_LONG(0);
- }
-
- switch (comparison_type) {
- case DBX_CMP_TEXT:
- convert_to_string_ex(zv_a);
- convert_to_string_ex(zv_b);
- break;
- case DBX_CMP_NUMBER:
- convert_to_double_ex(zv_a);
- convert_to_double_ex(zv_b);
- break;
- }
- switch ((*zv_a)->type) {
- case IS_NULL:
- result=0;
- break;
- case IS_BOOL:
- case IS_LONG:
- case IS_CONSTANT:
- ltemp = (*zv_a)->value.lval - (*zv_b)->value.lval;
- result = (ltemp==0?0: (ltemp>0?1:-1));
- break;
- case IS_DOUBLE:
- dtemp = ((*zv_a)->value.dval - (*zv_b)->value.dval);
- result = (dtemp==0?0: (dtemp>0?1:-1));
- break;
- case IS_STRING:
- ltemp = strcmp((*zv_a)->value.str.val, (*zv_b)->value.str.val);
- result = (ltemp==0?0: (ltemp>0?1:-1));
- break;
- default: result=0;
- }
-
- if (comparison_direction==DBX_CMP_DESC) RETURN_LONG(-result);
- RETURN_LONG(result);
-}
-
-
-/* {{{ proto long dbx_sort(dbx_result_object dbx_result, string compare_function_name)
- returns 0 on failure, 1 on success
-*/
-ZEND_FUNCTION(dbx_sort)
-{
- int number_of_arguments=2;
- zval ** arguments[2];
- zval ** zval_data;
- zval * returned_zval;
- int result=0;
- if (ZEND_NUM_ARGS() !=number_of_arguments || zend_get_parameters_array_ex(number_of_arguments, arguments) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if ((*arguments[0])->type != IS_OBJECT
- || (*arguments[1])->type != IS_STRING) {
- zend_error(E_WARNING, "Wrong argument type for sort");
- RETURN_LONG(0);
- }
-
- if (zend_hash_find((*arguments[0])->value.obj.properties, "data", 5, (void **) &zval_data)==FAILURE
- || (*zval_data)->type != IS_ARRAY) {
- zend_error(E_WARNING, "Wrong argument type for sort");
- RETURN_LONG(0);
- }
-
- arguments[0] = zval_data;
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "usort", &returned_zval, number_of_arguments, arguments);
- zval_dtor(returned_zval);
- FREE_ZVAL(returned_zval);
-
- RETURN_LONG(1);
-}
-
-/***********************************/
-
-/*
- * switch_dbx functions
- */
-int switch_dbx_connect(zval ** rv, zval ** host, zval ** db, zval ** username, zval ** password, INTERNAL_FUNCTION_PARAMETERS, zval ** dbx_module) {
- /* returns connection handle as resource on success or 0 as long on failure */
- switch ((*dbx_module)->value.lval) {
- case DBX_MYSQL: return dbx_mysql_connect(rv, host, db, username, password, INTERNAL_FUNCTION_PARAM_PASSTHRU);
- case DBX_ODBC: return dbx_odbc_connect(rv, host, db, username, password, INTERNAL_FUNCTION_PARAM_PASSTHRU);
- case DBX_PGSQL: return dbx_pgsql_connect(rv, host, db, username, password, INTERNAL_FUNCTION_PARAM_PASSTHRU);
- case DBX_MSSQL: return dbx_mssql_connect(rv, host, db, username, password, INTERNAL_FUNCTION_PARAM_PASSTHRU);
- }
- zend_error(E_WARNING, "dbx_connect: not supported in this module");
- return 0;
- }
-
-int switch_dbx_pconnect(zval ** rv, zval ** host, zval ** db, zval ** username, zval ** password, INTERNAL_FUNCTION_PARAMETERS, zval ** dbx_module) {
- /* returns persistent connection handle as resource on success or 0 as long on failure */
- switch ((*dbx_module)->value.lval) {
- case DBX_MYSQL: return dbx_mysql_pconnect(rv, host, db, username, password, INTERNAL_FUNCTION_PARAM_PASSTHRU);
- case DBX_ODBC: return dbx_odbc_pconnect(rv, host, db, username, password, INTERNAL_FUNCTION_PARAM_PASSTHRU);
- case DBX_PGSQL: return dbx_pgsql_pconnect(rv, host, db, username, password, INTERNAL_FUNCTION_PARAM_PASSTHRU);
- case DBX_MSSQL: return dbx_mssql_pconnect(rv, host, db, username, password, INTERNAL_FUNCTION_PARAM_PASSTHRU);
- }
- zend_error(E_WARNING, "dbx_pconnect: not supported in this module");
- return 0;
- }
-
-int switch_dbx_close(zval ** rv, zval ** dbx_handle, INTERNAL_FUNCTION_PARAMETERS, zval ** dbx_module) {
- /* returns 1 as long on success or 0 as long on failure */
- switch ((*dbx_module)->value.lval) {
- case DBX_MYSQL: return dbx_mysql_close(rv, dbx_handle, INTERNAL_FUNCTION_PARAM_PASSTHRU);
- case DBX_ODBC: return dbx_odbc_close(rv, dbx_handle, INTERNAL_FUNCTION_PARAM_PASSTHRU);
- case DBX_PGSQL: return dbx_pgsql_close(rv, dbx_handle, INTERNAL_FUNCTION_PARAM_PASSTHRU);
- case DBX_MSSQL: return dbx_mssql_close(rv, dbx_handle, INTERNAL_FUNCTION_PARAM_PASSTHRU);
- }
- zend_error(E_WARNING, "dbx_close: not supported in this module");
- return 0;
- }
-
-int switch_dbx_query(zval ** rv, zval ** dbx_handle, zval ** db_name, zval ** sql_statement, INTERNAL_FUNCTION_PARAMETERS, zval ** dbx_module) {
- /* returns 1 as long or result identifier as resource on success or 0 as long on failure */
- switch ((*dbx_module)->value.lval) {
- case DBX_MYSQL: return dbx_mysql_query(rv, dbx_handle, db_name, sql_statement, INTERNAL_FUNCTION_PARAM_PASSTHRU);
- case DBX_ODBC: return dbx_odbc_query(rv, dbx_handle, db_name, sql_statement, INTERNAL_FUNCTION_PARAM_PASSTHRU);
- case DBX_PGSQL: return dbx_pgsql_query(rv, dbx_handle, db_name, sql_statement, INTERNAL_FUNCTION_PARAM_PASSTHRU);
- case DBX_MSSQL: return dbx_mssql_query(rv, dbx_handle, db_name, sql_statement, INTERNAL_FUNCTION_PARAM_PASSTHRU);
- }
- zend_error(E_WARNING, "dbx_query: not supported in this module");
- return 0;
- }
-
-int switch_dbx_getcolumncount(zval ** rv, zval ** result_handle, INTERNAL_FUNCTION_PARAMETERS, zval ** dbx_module) {
- /* returns column-count as long on success or 0 as long on failure */
- switch ((*dbx_module)->value.lval) {
- case DBX_MYSQL: return dbx_mysql_getcolumncount(rv, result_handle, INTERNAL_FUNCTION_PARAM_PASSTHRU);
- case DBX_ODBC: return dbx_odbc_getcolumncount(rv, result_handle, INTERNAL_FUNCTION_PARAM_PASSTHRU);
- case DBX_PGSQL: return dbx_pgsql_getcolumncount(rv, result_handle, INTERNAL_FUNCTION_PARAM_PASSTHRU);
- case DBX_MSSQL: return dbx_mssql_getcolumncount(rv, result_handle, INTERNAL_FUNCTION_PARAM_PASSTHRU);
- }
- zend_error(E_WARNING, "dbx_getcolumncount: not supported in this module");
- return 0;
- }
-
-int switch_dbx_getcolumnname(zval ** rv, zval ** result_handle, long column_index, INTERNAL_FUNCTION_PARAMETERS, zval ** dbx_module) {
- /* returns column-name as string on success or 0 as long on failure */
- switch ((*dbx_module)->value.lval) {
- case DBX_MYSQL: return dbx_mysql_getcolumnname(rv, result_handle, column_index, INTERNAL_FUNCTION_PARAM_PASSTHRU);
- case DBX_ODBC: return dbx_odbc_getcolumnname(rv, result_handle, column_index, INTERNAL_FUNCTION_PARAM_PASSTHRU);
- case DBX_PGSQL: return dbx_pgsql_getcolumnname(rv, result_handle, column_index, INTERNAL_FUNCTION_PARAM_PASSTHRU);
- case DBX_MSSQL: return dbx_mssql_getcolumnname(rv, result_handle, column_index, INTERNAL_FUNCTION_PARAM_PASSTHRU);
- }
- zend_error(E_WARNING, "dbx_getcolumnname: not supported in this module");
- return 0;
- }
-
-int switch_dbx_getcolumntype(zval ** rv, zval ** result_handle, long column_index, INTERNAL_FUNCTION_PARAMETERS, zval ** dbx_module) {
- /* returns column-type as string on success or 0 as long on failure */
- switch ((*dbx_module)->value.lval) {
- case DBX_MYSQL: return dbx_mysql_getcolumntype(rv, result_handle, column_index, INTERNAL_FUNCTION_PARAM_PASSTHRU);
- case DBX_ODBC: return dbx_odbc_getcolumntype(rv, result_handle, column_index, INTERNAL_FUNCTION_PARAM_PASSTHRU);
- case DBX_PGSQL: return dbx_pgsql_getcolumntype(rv, result_handle, column_index, INTERNAL_FUNCTION_PARAM_PASSTHRU);
- case DBX_MSSQL: return dbx_mssql_getcolumntype(rv, result_handle, column_index, INTERNAL_FUNCTION_PARAM_PASSTHRU);
- }
- zend_error(E_WARNING, "dbx_getcolumntype: not supported in this module");
- return 0;
- }
-
-int switch_dbx_getrow(zval ** rv, zval ** result_handle, long row_number, INTERNAL_FUNCTION_PARAMETERS, zval ** dbx_module) {
- /* returns array[0..columncount-1] as strings on success or 0 as long on failure */
- switch ((*dbx_module)->value.lval) {
- case DBX_MYSQL: return dbx_mysql_getrow(rv, result_handle, row_number, INTERNAL_FUNCTION_PARAM_PASSTHRU);
- case DBX_ODBC: return dbx_odbc_getrow(rv, result_handle, row_number, INTERNAL_FUNCTION_PARAM_PASSTHRU);
- case DBX_PGSQL: return dbx_pgsql_getrow(rv, result_handle, row_number, INTERNAL_FUNCTION_PARAM_PASSTHRU);
- case DBX_MSSQL: return dbx_mssql_getrow(rv, result_handle, row_number, INTERNAL_FUNCTION_PARAM_PASSTHRU);
- }
- zend_error(E_WARNING, "dbx_getrow: not supported in this module");
- return 0;
- }
-
-int switch_dbx_error(zval ** rv, zval ** dbx_handle, INTERNAL_FUNCTION_PARAMETERS, zval ** dbx_module) {
- /* returns string */
- switch ((*dbx_module)->value.lval) {
- case DBX_MYSQL: return dbx_mysql_error(rv, dbx_handle, INTERNAL_FUNCTION_PARAM_PASSTHRU);
- case DBX_ODBC: return dbx_odbc_error(rv, dbx_handle, INTERNAL_FUNCTION_PARAM_PASSTHRU);
- case DBX_PGSQL: return dbx_pgsql_error(rv, dbx_handle, INTERNAL_FUNCTION_PARAM_PASSTHRU);
- case DBX_MSSQL: return dbx_mssql_error(rv, dbx_handle, INTERNAL_FUNCTION_PARAM_PASSTHRU);
- }
- zend_error(E_WARNING, "dbx_error: not supported in this module");
- return 0;
- }
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/dbx/dbx.dsp b/ext/dbx/dbx.dsp
deleted file mode 100644
index dcbeef26ca..0000000000
--- a/ext/dbx/dbx.dsp
+++ /dev/null
@@ -1,149 +0,0 @@
-# Microsoft Developer Studio Project File - Name="dbx" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=dbx - Win32 Release_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "dbx.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "dbx.mak" CFG="dbx - Win32 Release_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "dbx - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "dbx - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "dbx - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\..\TSRM" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_dbx" /D ZTS=1 /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D "WIN32" /D "DBX_EXPORTS" /D "COMPILE_DL_DBX" /D ZTS=1 /D HAVE_LIBINTL=1 /D ZEND_DEBUG=0 /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZEND_WIN32" /D "PHP_WIN32" /FR /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x406 /d "NDEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_dbx.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
-# ADD LINK32 php4ts.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_dbx.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
-
-!ELSEIF "$(CFG)" == "dbx - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MSSQL_EXPORTS" /D "COMPILE_DL_dbx" /D ZTS=1 /YX /FD /c
-# ADD CPP /nologo /MDd /W3 /GX /ZI /Od /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "DBX_EXPORTS" /D "COMPILE_DL_DBX" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_LIBINTL=1 /FR /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x406 /d "NDEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib /nologo /dll /machine:I386 /out:"../../Debug_TS/php_dbx.dll" /libpath:"..\..\Debug_TS"
-# ADD LINK32 php4ts_debug.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /incremental:yes /debug /machine:I386 /out:"../../Debug_TS/php_dbx.dll" /libpath:"..\..\Debug_TS"
-
-!ENDIF
-
-# Begin Target
-
-# Name "dbx - Win32 Release_TS"
-# Name "dbx - Win32 Debug_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\dbx.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\dbx_mssql.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\dbx_mysql.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\dbx_odbc.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\dbx_pgsql.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\dbx.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\dbx_mssql.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\dbx_mysql.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\dbx_odbc.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\dbx_pgsql.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\php_dbx.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/ext/dbx/dbx.h b/ext/dbx/dbx.h
deleted file mode 100644
index 927d366286..0000000000
--- a/ext/dbx/dbx.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | dbx module version 1.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 2001 Guidance Rotterdam BV |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author : Marc Boeren <marc@guidance.nl> |
- +----------------------------------------------------------------------+
-*/
-
-#ifndef ZEND_DBX_H
-#define ZEND_DBX_H
-
-#ifndef INIT_FUNC_ARGS
-#include "zend_modules.h"
-#endif
-
-#include "php.h"
-
-#define DBX_PERSISTENT (1<<0)
-
-#define DBX_RESULT_INFO (1<<0)
-#define DBX_RESULT_INDEX (1<<1)
-#define DBX_RESULT_ASSOC (1<<2)
-
-#define DBX_CMP_NATIVE (1<<0)
-#define DBX_CMP_TEXT (1<<1)
-#define DBX_CMP_NUMBER (1<<2)
-#define DBX_CMP_ASC (1<<3)
-#define DBX_CMP_DESC (1<<4)
-
-#define MOVE_RETURNED_TO_RV(rv, returned_zval) { **rv = *returned_zval; zval_copy_ctor(*rv); zval_ptr_dtor(&returned_zval); }
-
-void dbx_call_any_function(INTERNAL_FUNCTION_PARAMETERS, char * function_name, zval ** returnvalue, int number_of_arguments, zval *** params);
-
-#endif /* ZEND_DBX_H */
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/dbx/dbx_mssql.c b/ext/dbx/dbx_mssql.c
deleted file mode 100644
index 2d754086e6..0000000000
--- a/ext/dbx/dbx_mssql.c
+++ /dev/null
@@ -1,248 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | dbx module version 1.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 2001 Guidance Rotterdam BV |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author : Marc Boeren <marc@guidance.nl> |
- +----------------------------------------------------------------------+
-*/
-
-#include "dbx.h"
-#include "dbx_mssql.h"
-
-#define MSSQL_ASSOC 1<<0
-#define MSSQL_NUM 1<<1
-
-int dbx_mssql_connect(zval ** rv, zval ** host, zval ** db, zval ** username, zval ** password, INTERNAL_FUNCTION_PARAMETERS) {
- /* returns connection handle as resource on success or 0 as long on failure */
- int number_of_arguments=3;
- zval ** arguments[3];
- zval * returned_zval=NULL;
- zval * select_db_zval=NULL;
-
- arguments[0]=host;
- arguments[1]=username;
- arguments[2]=password;
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "mssql_connect", &returned_zval, number_of_arguments, arguments);
- if (!returned_zval || returned_zval->type!=IS_RESOURCE) {
- if (returned_zval) zval_ptr_dtor(&returned_zval);
- return 0;
- }
-
- number_of_arguments=2;
- arguments[0]=db;
- arguments[1]=&returned_zval;
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "mssql_select_db", &select_db_zval, number_of_arguments, arguments);
- if (!select_db_zval || (select_db_zval->type==IS_BOOL && select_db_zval->value.lval==0) ) {
- if (select_db_zval) zval_ptr_dtor(&select_db_zval);
- /* also close connection */
- number_of_arguments=1;
- arguments[0]=&returned_zval;
- zend_list_addref(returned_zval->value.lval);
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "mssql_close", &select_db_zval, number_of_arguments, arguments);
- if (select_db_zval) zval_ptr_dtor(&select_db_zval);
- zval_ptr_dtor(&returned_zval);
- return 0;
- }
- zval_ptr_dtor(&select_db_zval);
-
- MOVE_RETURNED_TO_RV(rv, returned_zval);
-
- return 1;
- }
-
-int dbx_mssql_pconnect(zval ** rv, zval ** host, zval ** db, zval ** username, zval ** password, INTERNAL_FUNCTION_PARAMETERS) {
- /* returns persistent connection handle as resource on success or 0 as long on failure */
- int number_of_arguments=3;
- zval ** arguments[3];
- zval * returned_zval=NULL;
- zval * select_db_zval=NULL;
-
- arguments[0]=host;
- arguments[1]=username;
- arguments[2]=password;
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "mssql_pconnect", &returned_zval, number_of_arguments, arguments);
- if (!returned_zval || returned_zval->type!=IS_RESOURCE) {
- if (returned_zval) zval_ptr_dtor(&returned_zval);
- return 0;
- }
-
- number_of_arguments=2;
- arguments[0]=db;
- arguments[1]=&returned_zval;
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "mssql_select_db", &select_db_zval, number_of_arguments, arguments);
- if (!select_db_zval || (select_db_zval->type==IS_BOOL && select_db_zval->value.lval==0) ) {
- if (select_db_zval) zval_ptr_dtor(&select_db_zval);
- /* also close connection */
- number_of_arguments=1;
- arguments[0]=&returned_zval;
- zend_list_addref(returned_zval->value.lval);
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "mssql_close", &select_db_zval, number_of_arguments, arguments);
- if (select_db_zval) zval_ptr_dtor(&select_db_zval);
- zval_ptr_dtor(&returned_zval);
- return 0;
- }
- zval_ptr_dtor(&select_db_zval);
-
- MOVE_RETURNED_TO_RV(rv, returned_zval);
-
- return 1;
- }
-
-int dbx_mssql_close(zval ** rv, zval ** dbx_handle, INTERNAL_FUNCTION_PARAMETERS) {
- /* returns 1 as long on success or 0 as long on failure */
- int number_of_arguments=1;
- zval ** arguments[1];
- zval * returned_zval=NULL;
-
- arguments[0]=dbx_handle;
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "mssql_close", &returned_zval, number_of_arguments, arguments);
- if (!returned_zval || returned_zval->type!=IS_BOOL) {
- if (returned_zval) zval_ptr_dtor(&returned_zval);
- return 0;
- }
- MOVE_RETURNED_TO_RV(rv, returned_zval);
- return 1;
- }
-
-int dbx_mssql_query(zval ** rv, zval ** dbx_handle, zval ** db_name, zval ** sql_statement, INTERNAL_FUNCTION_PARAMETERS) {
- /* returns 1 as long or a result identifier as resource on success or 0 as long on failure */
- int number_of_arguments=2;
- zval ** arguments[2];
- zval * returned_zval=NULL;
- zval * select_db_zval=NULL;
-
- number_of_arguments=2;
- arguments[0]=db_name;
- arguments[1]=dbx_handle;
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "mssql_select_db", &select_db_zval, number_of_arguments, arguments);
- zval_ptr_dtor(&select_db_zval);
-
- number_of_arguments=2;
- arguments[0]=sql_statement;
- arguments[1]=dbx_handle;
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "mssql_query", &returned_zval, number_of_arguments, arguments);
- /* mssql_query returns a bool for success or failure, or a result_identifier for select statements */
- if (!returned_zval || (returned_zval->type!=IS_BOOL && returned_zval->type!=IS_RESOURCE)) {
- if (returned_zval) zval_ptr_dtor(&returned_zval);
- return 0;
- }
- MOVE_RETURNED_TO_RV(rv, returned_zval);
- return 1;
- }
-
-int dbx_mssql_getcolumncount(zval ** rv, zval ** result_handle, INTERNAL_FUNCTION_PARAMETERS) {
- /* returns column-count as long on success or 0 as long on failure */
- int number_of_arguments=1;
- zval ** arguments[1];
- zval * returned_zval=NULL;
-
- arguments[0]=result_handle;
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "mssql_num_fields", &returned_zval, number_of_arguments, arguments);
- if (!returned_zval || returned_zval->type!=IS_LONG) {
- if (returned_zval) zval_ptr_dtor(&returned_zval);
- return 0;
- }
- MOVE_RETURNED_TO_RV(rv, returned_zval);
- return 1;
- }
-
-int dbx_mssql_getcolumnname(zval ** rv, zval ** result_handle, long column_index, INTERNAL_FUNCTION_PARAMETERS) {
- /* returns column-name as string on success or 0 as long on failure */
- int number_of_arguments=2;
- zval ** arguments[2];
- zval * zval_column_index;
- zval * returned_zval=NULL;
-
- MAKE_STD_ZVAL(zval_column_index);
- ZVAL_LONG(zval_column_index, column_index);
- arguments[0]=result_handle;
- arguments[1]=&zval_column_index;
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "mssql_field_name", &returned_zval, number_of_arguments, arguments);
- /* mssql_field_name returns a string */
- if (!returned_zval || returned_zval->type!=IS_STRING) {
- if (returned_zval) zval_ptr_dtor(&returned_zval);
- FREE_ZVAL(zval_column_index);
- return 0;
- }
- FREE_ZVAL(zval_column_index);
- MOVE_RETURNED_TO_RV(rv, returned_zval);
- return 1;
- }
-
-int dbx_mssql_getcolumntype(zval ** rv, zval ** result_handle, long column_index, INTERNAL_FUNCTION_PARAMETERS) {
- /* returns column-type as string on success or 0 as long on failure */
- int number_of_arguments=2;
- zval ** arguments[2];
- zval * zval_column_index;
- zval * returned_zval=NULL;
-
- MAKE_STD_ZVAL(zval_column_index);
- ZVAL_LONG(zval_column_index, column_index);
- arguments[0]=result_handle;
- arguments[1]=&zval_column_index;
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "mssql_field_type", &returned_zval, number_of_arguments, arguments);
- /* mssql_field_name returns a string */
- if (!returned_zval || returned_zval->type!=IS_STRING) {
- if (returned_zval) zval_ptr_dtor(&returned_zval);
- FREE_ZVAL(zval_column_index);
- return 0;
- }
- FREE_ZVAL(zval_column_index);
-
- MOVE_RETURNED_TO_RV(rv, returned_zval);
- return 1;
- }
-
-int dbx_mssql_getrow(zval ** rv, zval ** result_handle, long row_number, INTERNAL_FUNCTION_PARAMETERS) {
- /* returns array[0..columncount-1] as strings on success or 0 as long on failure */
- int number_of_arguments=1;
- zval ** arguments[1];
- zval * returned_zval=NULL;
-
- arguments[0]=result_handle;
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "mssql_fetch_row", &returned_zval, number_of_arguments, arguments);
- if (!returned_zval || returned_zval->type!=IS_ARRAY) {
- if (returned_zval) zval_ptr_dtor(&returned_zval);
- return 0;
- }
- MOVE_RETURNED_TO_RV(rv, returned_zval);
- return 1;
- }
-
-int dbx_mssql_error(zval ** rv, zval ** dbx_handle, INTERNAL_FUNCTION_PARAMETERS) {
- /* returns string */
- int number_of_arguments=1;
- zval ** arguments[1];
- zval * returned_zval=NULL;
-
- arguments[0]=dbx_handle;
- if (!dbx_handle) number_of_arguments=0;
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "mssql_get_last_message", &returned_zval, number_of_arguments, arguments);
- if (!returned_zval || returned_zval->type!=IS_STRING) {
- if (returned_zval) zval_ptr_dtor(&returned_zval);
- return 0;
- }
- MOVE_RETURNED_TO_RV(rv, returned_zval);
- return 1;
- }
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/dbx/dbx_mssql.h b/ext/dbx/dbx_mssql.h
deleted file mode 100644
index 4854eb9020..0000000000
--- a/ext/dbx/dbx_mssql.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | dbx module version 1.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 2001 Guidance Rotterdam BV |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author : Marc Boeren <marc@guidance.nl> |
- +----------------------------------------------------------------------+
-*/
-
-#ifndef ZEND_DBX_MSSQL_H
-#define ZEND_DBX_MSSQL_H
-
-#ifndef INIT_FUNC_ARGS
-#include "zend_modules.h"
-#endif
-
-#include "php.h"
-
-int dbx_mssql_connect(zval ** rv, zval ** host, zval ** db, zval ** username, zval ** password, INTERNAL_FUNCTION_PARAMETERS);
- /* returns connection handle as resource on success or 0 as long on failure */
-int dbx_mssql_pconnect(zval ** rv, zval ** host, zval ** db, zval ** username, zval ** password, INTERNAL_FUNCTION_PARAMETERS);
- /* returns persistent connection handle as resource on success or 0 as long on failure */
-int dbx_mssql_close(zval ** rv, zval ** dbx_handle, INTERNAL_FUNCTION_PARAMETERS);
- /* returns 1 as long on success or 0 as long on failure */
-int dbx_mssql_query(zval ** rv, zval ** dbx_handle, zval ** db_name, zval ** sql_statement, INTERNAL_FUNCTION_PARAMETERS);
- /* returns 1 as long or a result identifier as resource on success or 0 as long on failure */
-int dbx_mssql_getcolumncount(zval ** rv, zval ** result_handle, INTERNAL_FUNCTION_PARAMETERS);
- /* returns column-count as long on success or 0 as long on failure */
-int dbx_mssql_getcolumnname(zval ** rv, zval ** result_handle, long column_index, INTERNAL_FUNCTION_PARAMETERS);
- /* returns column-name as string on success or 0 as long on failure */
-int dbx_mssql_getcolumntype(zval ** rv, zval ** result_handle, long column_index, INTERNAL_FUNCTION_PARAMETERS);
- /* returns column-type as string on success or 0 as long on failure */
-int dbx_mssql_getrow(zval ** rv, zval ** result_handle, long row_number, INTERNAL_FUNCTION_PARAMETERS);
- /* returns array[0..columncount-1] as strings on success or 0 as long on failure */
-int dbx_mssql_error(zval ** rv, zval ** dbx_handle, INTERNAL_FUNCTION_PARAMETERS);
- /* returns string */
-
-#endif /* ZEND_DBX_MSSQL_H */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/dbx/dbx_mysql.c b/ext/dbx/dbx_mysql.c
deleted file mode 100644
index 2102d3a734..0000000000
--- a/ext/dbx/dbx_mysql.c
+++ /dev/null
@@ -1,247 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | dbx module version 1.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 2001 Guidance Rotterdam BV |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author : Marc Boeren <marc@guidance.nl> |
- +----------------------------------------------------------------------+
-*/
-
-#include "dbx.h"
-#include "dbx_mysql.h"
-
-#define MYSQL_ASSOC 1<<0
-#define MYSQL_NUM 1<<1
-
-int dbx_mysql_connect(zval ** rv, zval ** host, zval ** db, zval ** username, zval ** password, INTERNAL_FUNCTION_PARAMETERS) {
- /* returns connection handle as resource on success or 0 as long on failure */
- int number_of_arguments=3;
- zval ** arguments[3];
- zval * returned_zval=NULL;
- zval * select_db_zval=NULL;
-
- arguments[0]=host;
- arguments[1]=username;
- arguments[2]=password;
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "mysql_connect", &returned_zval, number_of_arguments, arguments);
- if (!returned_zval || returned_zval->type!=IS_RESOURCE) {
- if (returned_zval) zval_ptr_dtor(&returned_zval);
- return 0;
- }
-
- number_of_arguments=2;
- arguments[0]=db;
- arguments[1]=&returned_zval;
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "mysql_select_db", &select_db_zval, number_of_arguments, arguments);
- if (!select_db_zval || (select_db_zval->type==IS_BOOL && select_db_zval->value.lval==0) ) {
- if (select_db_zval) zval_ptr_dtor(&select_db_zval);
- /* also close connection */
- number_of_arguments=1;
- arguments[0]=&returned_zval;
- zend_list_addref(returned_zval->value.lval);
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "mysql_close", &select_db_zval, number_of_arguments, arguments);
- if (select_db_zval) zval_ptr_dtor(&select_db_zval);
- zval_ptr_dtor(&returned_zval);
- return 0;
- }
- zval_ptr_dtor(&select_db_zval);
-
- MOVE_RETURNED_TO_RV(rv, returned_zval);
-
- return 1;
- }
-
-int dbx_mysql_pconnect(zval ** rv, zval ** host, zval ** db, zval ** username, zval ** password, INTERNAL_FUNCTION_PARAMETERS) {
- /* returns persistent connection handle as resource on success or 0 as long on failure */
- int number_of_arguments=3;
- zval ** arguments[3];
- zval * returned_zval=NULL;
- zval * select_db_zval=NULL;
-
- arguments[0]=host;
- arguments[1]=username;
- arguments[2]=password;
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "mysql_pconnect", &returned_zval, number_of_arguments, arguments);
- if (!returned_zval || returned_zval->type!=IS_RESOURCE) {
- if (returned_zval) zval_ptr_dtor(&returned_zval);
- return 0;
- }
-
- number_of_arguments=2;
- arguments[0]=db;
- arguments[1]=&returned_zval;
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "mysql_select_db", &select_db_zval, number_of_arguments, arguments);
- if (!select_db_zval || (select_db_zval->type==IS_BOOL && select_db_zval->value.lval==0) ) {
- if (select_db_zval) zval_ptr_dtor(&select_db_zval);
- /* also close connection */
- number_of_arguments=1;
- arguments[0]=&returned_zval;
- zend_list_addref(returned_zval->value.lval);
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "mysql_close", &select_db_zval, number_of_arguments, arguments);
- if (select_db_zval) zval_ptr_dtor(&select_db_zval);
- zval_ptr_dtor(&returned_zval);
- return 0;
- }
- zval_ptr_dtor(&select_db_zval);
-
- MOVE_RETURNED_TO_RV(rv, returned_zval);
-
- return 1;
- }
-
-int dbx_mysql_close(zval ** rv, zval ** dbx_handle, INTERNAL_FUNCTION_PARAMETERS) {
- /* returns 1 as long on success or 0 as long on failure */
- int number_of_arguments=1;
- zval ** arguments[1];
- zval * returned_zval=NULL;
-
- arguments[0]=dbx_handle;
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "mysql_close", &returned_zval, number_of_arguments, arguments);
- if (!returned_zval || returned_zval->type!=IS_BOOL) {
- if (returned_zval) zval_ptr_dtor(&returned_zval);
- return 0;
- }
- MOVE_RETURNED_TO_RV(rv, returned_zval);
- return 1;
- }
-
-int dbx_mysql_query(zval ** rv, zval ** dbx_handle, zval ** db_name, zval ** sql_statement, INTERNAL_FUNCTION_PARAMETERS) {
- /* returns 1 as long or a result identifier as resource on success or 0 as long on failure */
- int number_of_arguments=3;
- zval ** arguments[3];
- zval * returned_zval=NULL;
-
- arguments[0]=db_name;
- arguments[1]=sql_statement;
- arguments[2]=dbx_handle;
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "mysql_db_query", &returned_zval, number_of_arguments, arguments);
- /* mysql_query returns a bool for success or failure, or a result_identifier for select statements */
- if (!returned_zval || (returned_zval->type!=IS_BOOL && returned_zval->type!=IS_RESOURCE)) {
- if (returned_zval) zval_ptr_dtor(&returned_zval);
- return 0;
- }
- MOVE_RETURNED_TO_RV(rv, returned_zval);
- return 1;
- }
-
-int dbx_mysql_getcolumncount(zval ** rv, zval ** result_handle, INTERNAL_FUNCTION_PARAMETERS) {
- /* returns column-count as long on success or 0 as long on failure */
- int number_of_arguments=1;
- zval ** arguments[1];
- zval * returned_zval=NULL;
-
- arguments[0]=result_handle;
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "mysql_num_fields", &returned_zval, number_of_arguments, arguments);
- if (!returned_zval || returned_zval->type!=IS_LONG) {
- if (returned_zval) zval_ptr_dtor(&returned_zval);
- return 0;
- }
- MOVE_RETURNED_TO_RV(rv, returned_zval);
- return 1;
- }
-
-int dbx_mysql_getcolumnname(zval ** rv, zval ** result_handle, long column_index, INTERNAL_FUNCTION_PARAMETERS) {
- /* returns column-name as string on success or 0 as long on failure */
- int number_of_arguments=2;
- zval ** arguments[2];
- zval * zval_column_index;
- zval * returned_zval=NULL;
-
- MAKE_STD_ZVAL(zval_column_index);
- ZVAL_LONG(zval_column_index, column_index);
- arguments[0]=result_handle;
- arguments[1]=&zval_column_index;
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "mysql_field_name", &returned_zval, number_of_arguments, arguments);
- /* mysql_field_name returns a string */
- if (!returned_zval || returned_zval->type!=IS_STRING) {
- if (returned_zval) zval_ptr_dtor(&returned_zval);
- FREE_ZVAL(zval_column_index);
- return 0;
- }
- FREE_ZVAL(zval_column_index);
- MOVE_RETURNED_TO_RV(rv, returned_zval);
- return 1;
- }
-
-int dbx_mysql_getcolumntype(zval ** rv, zval ** result_handle, long column_index, INTERNAL_FUNCTION_PARAMETERS) {
- /* returns column-type as string on success or 0 as long on failure */
- int number_of_arguments=2;
- zval ** arguments[2];
- zval * zval_column_index;
- zval * returned_zval=NULL;
-
- MAKE_STD_ZVAL(zval_column_index);
- ZVAL_LONG(zval_column_index, column_index);
- arguments[0]=result_handle;
- arguments[1]=&zval_column_index;
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "mysql_field_type", &returned_zval, number_of_arguments, arguments);
- /* mysql_field_name returns a string */
- if (!returned_zval || returned_zval->type!=IS_STRING) {
- if (returned_zval) zval_ptr_dtor(&returned_zval);
- FREE_ZVAL(zval_column_index);
- return 0;
- }
- FREE_ZVAL(zval_column_index);
-
- MOVE_RETURNED_TO_RV(rv, returned_zval);
- return 1;
- }
-
-int dbx_mysql_getrow(zval ** rv, zval ** result_handle, long row_number, INTERNAL_FUNCTION_PARAMETERS) {
- /* returns array[0..columncount-1] as strings on success or 0 as long on failure */
- int number_of_arguments=2;
- zval ** arguments[2];
- zval * zval_resulttype=NULL;
- zval * returned_zval=NULL;
-
- MAKE_STD_ZVAL(zval_resulttype);
- ZVAL_LONG(zval_resulttype, MYSQL_NUM);
- arguments[0]=result_handle;
- arguments[1]=&zval_resulttype;
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "mysql_fetch_array", &returned_zval, number_of_arguments, arguments);
- if (!returned_zval || returned_zval->type!=IS_ARRAY) {
- if (returned_zval) zval_ptr_dtor(&returned_zval);
- FREE_ZVAL(zval_resulttype);
- return 0;
- }
- FREE_ZVAL(zval_resulttype);
- MOVE_RETURNED_TO_RV(rv, returned_zval);
- return 1;
- }
-
-int dbx_mysql_error(zval ** rv, zval ** dbx_handle, INTERNAL_FUNCTION_PARAMETERS) {
- /* returns string */
- int number_of_arguments=1;
- zval ** arguments[1];
- zval * returned_zval=NULL;
-
- arguments[0]=dbx_handle;
- if (!dbx_handle) number_of_arguments=0;
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "mysql_error", &returned_zval, number_of_arguments, arguments);
- if (!returned_zval || returned_zval->type!=IS_STRING) {
- if (returned_zval) zval_ptr_dtor(&returned_zval);
- return 0;
- }
- MOVE_RETURNED_TO_RV(rv, returned_zval);
- return 1;
- }
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/dbx/dbx_mysql.h b/ext/dbx/dbx_mysql.h
deleted file mode 100644
index c9bc0b5d39..0000000000
--- a/ext/dbx/dbx_mysql.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | dbx module version 1.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 2001 Guidance Rotterdam BV |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author : Marc Boeren <marc@guidance.nl> |
- +----------------------------------------------------------------------+
-*/
-
-#ifndef ZEND_DBX_MYSQL_H
-#define ZEND_DBX_MYSQL_H
-
-#ifndef INIT_FUNC_ARGS
-#include "zend_modules.h"
-#endif
-
-#include "php.h"
-
-int dbx_mysql_connect(zval ** rv, zval ** host, zval ** db, zval ** username, zval ** password, INTERNAL_FUNCTION_PARAMETERS);
- /* returns connection handle as resource on success or 0 as long on failure */
-int dbx_mysql_pconnect(zval ** rv, zval ** host, zval ** db, zval ** username, zval ** password, INTERNAL_FUNCTION_PARAMETERS);
- /* returns persistent connection handle as resource on success or 0 as long on failure */
-int dbx_mysql_close(zval ** rv, zval ** dbx_handle, INTERNAL_FUNCTION_PARAMETERS);
- /* returns 1 as long on success or 0 as long on failure */
-int dbx_mysql_query(zval ** rv, zval ** dbx_handle, zval ** db_name, zval ** sql_statement, INTERNAL_FUNCTION_PARAMETERS);
- /* returns 1 as long or a result identifier as resource on success or 0 as long on failure */
-int dbx_mysql_getcolumncount(zval ** rv, zval ** result_handle, INTERNAL_FUNCTION_PARAMETERS);
- /* returns column-count as long on success or 0 as long on failure */
-int dbx_mysql_getcolumnname(zval ** rv, zval ** result_handle, long column_index, INTERNAL_FUNCTION_PARAMETERS);
- /* returns column-name as string on success or 0 as long on failure */
-int dbx_mysql_getcolumntype(zval ** rv, zval ** result_handle, long column_index, INTERNAL_FUNCTION_PARAMETERS);
- /* returns column-type as string on success or 0 as long on failure */
-int dbx_mysql_getrow(zval ** rv, zval ** result_handle, long row_number, INTERNAL_FUNCTION_PARAMETERS);
- /* returns array[0..columncount-1] as strings on success or 0 as long on failure */
-int dbx_mysql_error(zval ** rv, zval ** dbx_handle, INTERNAL_FUNCTION_PARAMETERS);
- /* returns string */
-
-#endif /* ZEND_DBX_MYSQL_H */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/dbx/dbx_odbc.c b/ext/dbx/dbx_odbc.c
deleted file mode 100644
index 13da2da653..0000000000
--- a/ext/dbx/dbx_odbc.c
+++ /dev/null
@@ -1,259 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | dbx module version 1.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 2001 Guidance Rotterdam BV |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author : Marc Boeren <marc@guidance.nl> |
- +----------------------------------------------------------------------+
-*/
-
-#include "dbx.h"
-#include "dbx_odbc.h"
-
-#define ODBC_ASSOC 1
-#define ODBC_NUM 2
-
-int dbx_odbc_connect(zval ** rv, zval ** host, zval ** db, zval ** username, zval ** password, INTERNAL_FUNCTION_PARAMETERS) {
- /* returns connection handle as resource on success or 0 as long on failure */
- int number_of_arguments=3;
- zval ** arguments[3];
- zval * returned_zval=NULL;
-
- arguments[0]=db;
- arguments[1]=username;
- arguments[2]=password;
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "odbc_connect", &returned_zval, number_of_arguments, arguments);
- if (!returned_zval || returned_zval->type!=IS_RESOURCE) {
- if (returned_zval) zval_ptr_dtor(&returned_zval);
- return 0;
- }
- MOVE_RETURNED_TO_RV(rv, returned_zval);
- return 1;
- }
-
-int dbx_odbc_pconnect(zval ** rv, zval ** host, zval ** db, zval ** username, zval ** password, INTERNAL_FUNCTION_PARAMETERS) {
- /* returns connection handle as resource on success or 0 as long on failure */
- int number_of_arguments=3;
- zval ** arguments[3];
- zval * returned_zval=NULL;
-
- arguments[0]=db;
- arguments[1]=username;
- arguments[2]=password;
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "odbc_pconnect", &returned_zval, number_of_arguments, arguments);
- if (!returned_zval || returned_zval->type!=IS_RESOURCE) {
- if (returned_zval) zval_ptr_dtor(&returned_zval);
- return 0;
- }
- MOVE_RETURNED_TO_RV(rv, returned_zval);
- return 1;
- }
-
-int dbx_odbc_close(zval ** rv, zval ** dbx_handle, INTERNAL_FUNCTION_PARAMETERS) {
- /* returns 1 as long on success or 0 as long on failure */
- int number_of_arguments=1;
- zval ** arguments[1];
- zval * returned_zval=NULL;
- int exit_status=EG(exit_status);
-
- int actual_resource_type;
- void *resource;
- resource = zend_list_find((*dbx_handle)->value.lval, &actual_resource_type);
- if (!resource) {
- return 0;
- }
-
- arguments[0]=dbx_handle;
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "odbc_close", &returned_zval, number_of_arguments, arguments);
-
- if (!returned_zval || returned_zval->type!=IS_NULL) {
- if (returned_zval) zval_ptr_dtor(&returned_zval);
- return 0;
- }
- convert_to_long_ex(&returned_zval);
- returned_zval->value.lval=1;
- MOVE_RETURNED_TO_RV(rv, returned_zval);
- return 1;
- }
-
-int dbx_odbc_query(zval ** rv, zval ** dbx_handle, zval ** db_name, zval ** sql_statement, INTERNAL_FUNCTION_PARAMETERS) {
- /* returns 1 as long or a result identifier as resource on success or 0 as long on failure */
- int number_of_arguments=2;
- zval ** arguments[2];
- zval * queryresult_zval=NULL;
- zval * num_fields_zval=NULL;
-
- /* db_name is not used in this function */
- arguments[0]=dbx_handle;
- arguments[1]=sql_statement;
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "odbc_exec", &queryresult_zval, number_of_arguments, arguments);
- /* odbc_query returns a bool for failure, or a result_identifier for success */
- if (!queryresult_zval || queryresult_zval->type!=IS_RESOURCE) {
- if (queryresult_zval) zval_ptr_dtor(&queryresult_zval);
- return 0;
- }
- MAKE_STD_ZVAL(num_fields_zval);
- ZVAL_LONG(num_fields_zval, 0);
- if (!dbx_odbc_getcolumncount(&num_fields_zval, &queryresult_zval, INTERNAL_FUNCTION_PARAM_PASSTHRU)) {
- FREE_ZVAL(num_fields_zval);
- if (queryresult_zval) zval_ptr_dtor(&queryresult_zval);
- return 0;
- }
- if (num_fields_zval->value.lval==0) {
- (*rv)->type=IS_BOOL;
- (*rv)->value.lval=1; /* success, but no data */
- FREE_ZVAL(num_fields_zval);
- if (queryresult_zval) zval_ptr_dtor(&queryresult_zval);
- return 1;
- }
- FREE_ZVAL(num_fields_zval);
- MOVE_RETURNED_TO_RV(rv, queryresult_zval);
- return 1;
- }
-
-int dbx_odbc_getcolumncount(zval ** rv, zval ** result_handle, INTERNAL_FUNCTION_PARAMETERS) {
- /* returns column-count as long on success or 0 as long on failure */
- int number_of_arguments=1;
- zval ** arguments[1];
- zval * returned_zval=NULL;
-
- arguments[0]=result_handle;
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "odbc_num_fields", &returned_zval, number_of_arguments, arguments);
- if (!returned_zval || returned_zval->type!=IS_LONG || returned_zval->value.lval<0) {
- if (returned_zval) zval_ptr_dtor(&returned_zval);
- return 0;
- }
- MOVE_RETURNED_TO_RV(rv, returned_zval);
- return 1;
- }
-
-int dbx_odbc_getcolumnname(zval ** rv, zval ** result_handle, long column_index, INTERNAL_FUNCTION_PARAMETERS) {
- /* returns column-name as string on success or 0 as long on failure */
- int number_of_arguments=2;
- zval ** arguments[2];
- zval * zval_column_index;
- zval * returned_zval=NULL;
-
- MAKE_STD_ZVAL(zval_column_index);
- ZVAL_LONG(zval_column_index, column_index+1);
- arguments[0]=result_handle;
- arguments[1]=&zval_column_index;
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "odbc_field_name", &returned_zval, number_of_arguments, arguments);
- /* odbc_field_name returns a string */
- if (!returned_zval || returned_zval->type!=IS_STRING) {
- if (returned_zval) zval_ptr_dtor(&returned_zval);
- FREE_ZVAL(zval_column_index);
- return 0;
- }
- FREE_ZVAL(zval_column_index);
- MOVE_RETURNED_TO_RV(rv, returned_zval);
- return 1;
- }
-
-int dbx_odbc_getcolumntype(zval ** rv, zval ** result_handle, long column_index, INTERNAL_FUNCTION_PARAMETERS) {
- /* returns column-type as string on success or 0 as long on failure */
- int number_of_arguments=2;
- zval ** arguments[2];
- zval * zval_column_index;
- zval * returned_zval=NULL;
-
- MAKE_STD_ZVAL(zval_column_index);
- ZVAL_LONG(zval_column_index, column_index+1);
- arguments[0]=result_handle;
- arguments[1]=&zval_column_index;
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "odbc_field_type", &returned_zval, number_of_arguments, arguments);
- /* odbc_field_name returns a string */
- if (!returned_zval || returned_zval->type!=IS_STRING) {
- if (returned_zval) zval_ptr_dtor(&returned_zval);
- FREE_ZVAL(zval_column_index);
- return 0;
- }
- FREE_ZVAL(zval_column_index);
-
- MOVE_RETURNED_TO_RV(rv, returned_zval);
- return 1;
- }
-
-int dbx_odbc_getrow(zval ** rv, zval ** result_handle, long row_number, INTERNAL_FUNCTION_PARAMETERS) {
- /* returns array[0..columncount-1] as strings on success or 0 as long on failure */
- int number_of_arguments;
- zval ** arguments[2];
- zval * num_fields_zval=NULL;
- zval * fetch_row_result_zval=NULL;
- zval * field_result_zval=NULL;
- zval * field_index_zval;
- zval * returned_zval=NULL;
- long field_index;
- long field_count=-1;
-
- /* get # fields */
- MAKE_STD_ZVAL(num_fields_zval);
- ZVAL_LONG(num_fields_zval, 0);
- if (!dbx_odbc_getcolumncount(&num_fields_zval, result_handle, INTERNAL_FUNCTION_PARAM_PASSTHRU)) {
- return 0;
- }
- field_count=num_fields_zval->value.lval;
- FREE_ZVAL(num_fields_zval);
- /* fetch row */
- number_of_arguments=1;
- arguments[0]=result_handle;
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "odbc_fetch_row", &fetch_row_result_zval, number_of_arguments, arguments);
- if (!fetch_row_result_zval || fetch_row_result_zval->type!=IS_BOOL) {
- if (fetch_row_result_zval) zval_ptr_dtor(&fetch_row_result_zval);
- return 0;
- }
- if (fetch_row_result_zval->value.lval==0) {
- (*rv)->type=IS_LONG;
- (*rv)->value.lval=0; /* ok, no more rows */
- zval_ptr_dtor(&fetch_row_result_zval);
- return 0;
- }
- zval_ptr_dtor(&fetch_row_result_zval);
- /* fill array with field results... */
- MAKE_STD_ZVAL(returned_zval);
- if (array_init(returned_zval) != SUCCESS) {
- zend_error(E_ERROR, "dbx_odbc_getrow: unable to create result-array...");
- FREE_ZVAL(returned_zval);
- return 0;
- }
- MAKE_STD_ZVAL(field_index_zval);
- ZVAL_LONG(field_index_zval, 0);
- number_of_arguments=2;
- for (field_index=0; field_index<field_count; ++field_index) {
- ZVAL_LONG(field_index_zval, field_index+1);
- arguments[0]=result_handle;
- arguments[1]=&field_index_zval;
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "odbc_result", &field_result_zval, number_of_arguments, arguments);
- zend_hash_index_update(returned_zval->value.ht, field_index, (void *)&(field_result_zval), sizeof(zval *), NULL);
- }
- FREE_ZVAL(field_index_zval);
-
- MOVE_RETURNED_TO_RV(rv, returned_zval);
- return 1;
- }
-
-int dbx_odbc_error(zval ** rv, zval ** dbx_handle, INTERNAL_FUNCTION_PARAMETERS) {
- /* returns empty string, no equivalent in odbc module (yet???) */
- ZVAL_EMPTY_STRING((*rv));
- return 1;
- }
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/dbx/dbx_odbc.h b/ext/dbx/dbx_odbc.h
deleted file mode 100644
index 38625ca1e7..0000000000
--- a/ext/dbx/dbx_odbc.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | dbx module version 1.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 2001 Guidance Rotterdam BV |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author : Marc Boeren <marc@guidance.nl> |
- +----------------------------------------------------------------------+
-*/
-
-#ifndef ZEND_DBX_ODBC_H
-#define ZEND_DBX_ODBC_H
-
-#ifndef INIT_FUNC_ARGS
-#include "zend_modules.h"
-#endif
-
-#include "php.h"
-
-int dbx_odbc_connect(zval ** rv, zval ** host, zval ** db, zval ** username, zval ** password, INTERNAL_FUNCTION_PARAMETERS);
- /* returns connection handle as resource on success or 0 as long on failure */
-int dbx_odbc_pconnect(zval ** rv, zval ** host, zval ** db, zval ** username, zval ** password, INTERNAL_FUNCTION_PARAMETERS);
- /* returns persisten connection handle as resource on success or 0 as long on failure */
-int dbx_odbc_close(zval ** rv, zval ** dbx_handle, INTERNAL_FUNCTION_PARAMETERS);
- /* returns 1 as long on success or 0 as long on failure */
-int dbx_odbc_query(zval ** rv, zval ** dbx_handle, zval ** db_name, zval ** sql_statement, INTERNAL_FUNCTION_PARAMETERS);
- /* returns 1 as long or a result identifier as resource on success or 0 as long on failure */
-int dbx_odbc_getcolumncount(zval ** rv, zval ** result_handle, INTERNAL_FUNCTION_PARAMETERS);
- /* returns column-count as long on success or 0 as long on failure */
-int dbx_odbc_getcolumnname(zval ** rv, zval ** result_handle, long column_index, INTERNAL_FUNCTION_PARAMETERS);
- /* returns column-name as string on success or 0 as long on failure */
-int dbx_odbc_getcolumntype(zval ** rv, zval ** result_handle, long column_index, INTERNAL_FUNCTION_PARAMETERS);
- /* returns column-type as string on success or 0 as long on failure */
-int dbx_odbc_getrow(zval ** rv, zval ** result_handle, long row_number, INTERNAL_FUNCTION_PARAMETERS);
- /* returns array[0..columncount-1] as strings on success or 0 as long on failure */
-int dbx_odbc_error(zval ** rv, zval ** dbx_handle, INTERNAL_FUNCTION_PARAMETERS);
- /* returns string */
-
-#endif /* ZEND_DBX_ODBC_H */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/dbx/dbx_pgsql.c b/ext/dbx/dbx_pgsql.c
deleted file mode 100644
index e945bc06b6..0000000000
--- a/ext/dbx/dbx_pgsql.c
+++ /dev/null
@@ -1,271 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author : Rui Hirokawa <hirokawa@php.net> |
- +----------------------------------------------------------------------+
- */
-
-#include "dbx.h"
-#include "php_dbx.h"
-#include "dbx_pgsql.h"
-#include <string.h>
-
-#define PGSQL_ASSOC 1<<0
-#define PGSQL_NUM 1<<1
-
-int dbx_pgsql_connect(zval ** rv, zval ** host, zval ** db, zval ** username, zval ** password, INTERNAL_FUNCTION_PARAMETERS) {
- /* returns connection handle as resource on success or 0 as long on failure */
- int nargs=5;
- char *port="5432", *connstring=NULL;
- zval **args[5], *rarg = NULL;
- zval *conn_zval = NULL;
- zval *returned_zval=NULL;
-
- MAKE_STD_ZVAL(conn_zval);
- ZVAL_LONG(conn_zval, 0);
-
- if (Z_STRLEN_PP(username)>0 && Z_STRLEN_PP(password)>0){
- int len;
-
- len = Z_STRLEN_PP(host)+Z_STRLEN_PP(db)+strlen(port);
- len += Z_STRLEN_PP(username)+Z_STRLEN_PP(password)+35;
- connstring = (char *)emalloc(len+1);
- sprintf(connstring, "host=%s port=%s dbname=%s user=%s password=%s",
- Z_STRVAL_PP(host),port, Z_STRVAL_PP(db),
- Z_STRVAL_PP(username), Z_STRVAL_PP(password));
- ZVAL_STRING(conn_zval, connstring, 1);
- args[0] = &conn_zval;
- nargs = 1;
- } else {
- int k;
-
- args[0] = host;
- for (k=1;k<4;k++){
- MAKE_STD_ZVAL(rarg);
- ZVAL_EMPTY_STRING(rarg);
- args[k] = &rarg;
- }
- args[4] = db;
- }
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "pg_connect", &returned_zval, nargs, args);
-
- if (!returned_zval || returned_zval->type!=IS_RESOURCE) {
- if (returned_zval) zval_ptr_dtor(&returned_zval);
- return 0;
- }
- MOVE_RETURNED_TO_RV(rv, returned_zval);
-
- return 1;
-}
-
-int dbx_pgsql_pconnect(zval ** rv, zval ** host, zval ** db, zval ** username, zval ** password, INTERNAL_FUNCTION_PARAMETERS) {
- /* returns persistent connection handle as resource on success or 0 as long on failure */
- int nargs=5;
- char *port="5432", *connstring=NULL;
- zval **args[5], *rarg = NULL;
- zval *conn_zval = NULL;
- zval *returned_zval=NULL;
-
- MAKE_STD_ZVAL(conn_zval);
- ZVAL_LONG(conn_zval, 0);
-
- if (Z_STRLEN_PP(username)>0 && Z_STRLEN_PP(password)>0){
- int len;
-
- len = Z_STRLEN_PP(host)+Z_STRLEN_PP(db)+strlen(port);
- len += Z_STRLEN_PP(username)+Z_STRLEN_PP(password)+35;
- connstring = (char *)emalloc(len+1);
- sprintf(connstring, "host=%s port=%s dbname=%s user=%s password=%s",
- Z_STRVAL_PP(host),port, Z_STRVAL_PP(db),
- Z_STRVAL_PP(username), Z_STRVAL_PP(password));
- ZVAL_STRING(conn_zval, connstring, 1);
- args[0] = &conn_zval;
- nargs = 1;
- } else {
- int k;
-
- args[0] = host;
- for (k=1;k<4;k++){
- MAKE_STD_ZVAL(rarg);
- ZVAL_EMPTY_STRING(rarg);
- args[k] = &rarg;
- }
- args[4] = db;
- }
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "pg_pconnect", &returned_zval, nargs, args);
-
- if (!returned_zval || returned_zval->type!=IS_RESOURCE) {
- if (returned_zval) zval_ptr_dtor(&returned_zval);
- return 0;
- }
- MOVE_RETURNED_TO_RV(rv, returned_zval);
-
- return 1;
-}
-
-int dbx_pgsql_close(zval ** rv, zval ** dbx_handle, INTERNAL_FUNCTION_PARAMETERS) {
- /* returns 1 as long on success or 0 as long on failure */
- int number_of_arguments=1;
- zval ** arguments[1];
- zval * returned_zval=NULL;
-
- arguments[0]=dbx_handle;
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "pg_close", &returned_zval, number_of_arguments, arguments);
- if (!returned_zval || returned_zval->type!=IS_BOOL) {
- if (returned_zval) zval_ptr_dtor(&returned_zval);
- return 0;
- }
- MOVE_RETURNED_TO_RV(rv, returned_zval);
- return 1;
-}
-
-int dbx_pgsql_query(zval ** rv, zval ** dbx_handle, zval ** db_name, zval ** sql_statement, INTERNAL_FUNCTION_PARAMETERS) {
- /* returns 1 as long or a result identifier as resource on success
- or 0 as long on failure */
- int nargs=2;
- zval **args[2];
- zval *returned_zval=NULL, *num_rows_zval=NULL;
-
- /* db_name is not used in this function */
- args[0]=dbx_handle;
- args[1]=sql_statement;
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "pg_exec", &returned_zval, nargs, args);
- /* pg_query returns a bool for success or failure,
- or a result_identifier for select statements */
- if (!returned_zval || (returned_zval->type!=IS_BOOL && returned_zval->type!=IS_RESOURCE)) {
- if (returned_zval) zval_ptr_dtor(&returned_zval);
- return 0;
- }
- MOVE_RETURNED_TO_RV(rv, returned_zval);
-
- return 1;
-}
-
-int dbx_pgsql_getcolumncount(zval ** rv, zval ** result_handle, INTERNAL_FUNCTION_PARAMETERS) {
- /* returns column-count as long on success or 0 as long on failure */
- int number_of_arguments=1;
- zval ** arguments[1];
- zval * returned_zval=NULL;
-
- arguments[0]=result_handle;
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "pg_numfields", &returned_zval, number_of_arguments, arguments);
- if (!returned_zval || returned_zval->type!=IS_LONG) {
- if (returned_zval) zval_ptr_dtor(&returned_zval);
- return 0;
- }
- MOVE_RETURNED_TO_RV(rv, returned_zval);
- return 1;
- }
-
-int dbx_pgsql_getcolumnname(zval ** rv, zval ** result_handle, long column_index, INTERNAL_FUNCTION_PARAMETERS) {
- /* returns column-name as string on success or 0 as long on failure */
- int number_of_arguments=2;
- zval ** arguments[2];
- zval * zval_column_index;
- zval * returned_zval=NULL;
-
- MAKE_STD_ZVAL(zval_column_index);
- ZVAL_LONG(zval_column_index, column_index);
- arguments[0]=result_handle;
- arguments[1]=&zval_column_index;
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "pg_fieldname", &returned_zval, number_of_arguments, arguments);
- /* pg_fieldname returns a string */
- if (!returned_zval || returned_zval->type!=IS_STRING) {
- if (returned_zval) zval_ptr_dtor(&returned_zval);
- FREE_ZVAL(zval_column_index);
- return 0;
- }
- FREE_ZVAL(zval_column_index);
- MOVE_RETURNED_TO_RV(rv, returned_zval);
- return 1;
- }
-
-int dbx_pgsql_getcolumntype(zval ** rv, zval ** result_handle, long column_index, INTERNAL_FUNCTION_PARAMETERS) {
- /* returns column-type as string on success or 0 as long on failure */
- int number_of_arguments=2;
- zval ** arguments[2];
- zval * zval_column_index;
- zval * returned_zval=NULL;
-
- MAKE_STD_ZVAL(zval_column_index);
- ZVAL_LONG(zval_column_index, column_index);
- arguments[0]=result_handle;
- arguments[1]=&zval_column_index;
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "pg_fieldtype", &returned_zval, number_of_arguments, arguments);
- /* pg_fieldtype returns a string */
- if (!returned_zval || returned_zval->type!=IS_STRING) {
- if (returned_zval) zval_ptr_dtor(&returned_zval);
- FREE_ZVAL(zval_column_index);
- return 0;
- }
- FREE_ZVAL(zval_column_index);
-
- MOVE_RETURNED_TO_RV(rv, returned_zval);
- return 1;
-}
-
-int dbx_pgsql_getrow(zval ** rv, zval ** result_handle, long row_number, INTERNAL_FUNCTION_PARAMETERS) {
- /* returns array[0..columncount-1] as strings on success or 0 as long on failure */
- int number_of_arguments=2;
- int save_error_reporting=0;
- zval ** arguments[2];
- zval * zval_row=NULL;
- zval * returned_zval=NULL;
-
- MAKE_STD_ZVAL(zval_row);
- ZVAL_LONG(zval_row, row_number);
- arguments[0]=result_handle;
- arguments[1]=&zval_row;
-
- if (EG(error_reporting) & E_WARNING){
- save_error_reporting = EG(error_reporting);
- EG(error_reporting) &= ~E_WARNING;
- }
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "pg_fetch_array", &returned_zval, number_of_arguments, arguments);
- if (save_error_reporting) {
- EG(error_reporting) = save_error_reporting;
- }
- if (!returned_zval || returned_zval->type!=IS_ARRAY) {
- if (returned_zval) zval_ptr_dtor(&returned_zval);
- FREE_ZVAL(zval_row);
- return 0;
- }
- FREE_ZVAL(zval_row);
- MOVE_RETURNED_TO_RV(rv, returned_zval);
- return 1;
-}
-
-int dbx_pgsql_error(zval ** rv, zval ** dbx_handle, INTERNAL_FUNCTION_PARAMETERS) {
- /* returns string */
- int number_of_arguments=1;
- zval ** arguments[1];
- zval * returned_zval=NULL;
-
- arguments[0]=dbx_handle;
- if (!dbx_handle) number_of_arguments=0;
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, "pg_errormessage", &returned_zval, number_of_arguments, arguments);
- if (!returned_zval || returned_zval->type!=IS_STRING) {
- if (returned_zval) zval_ptr_dtor(&returned_zval);
- return 0;
- }
- MOVE_RETURNED_TO_RV(rv, returned_zval);
- return 1;
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/dbx/dbx_pgsql.h b/ext/dbx/dbx_pgsql.h
deleted file mode 100644
index 795ac752c3..0000000000
--- a/ext/dbx/dbx_pgsql.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author : Rui Hirokawa <hirokawa@php.net> |
- +----------------------------------------------------------------------+
- */
-
-#ifndef ZEND_DBX_PGSQL_H
-#define ZEND_DBX_PGSQL_H
-
-#ifndef INIT_FUNC_ARGS
-#include "zend_modules.h"
-#endif
-
-#include "php.h"
-
-int dbx_pgsql_connect(zval ** rv, zval ** host, zval ** db, zval ** username, zval ** password, INTERNAL_FUNCTION_PARAMETERS);
- /* returns connection handle as resource on success or 0 as long on failure */
-int dbx_pgsql_pconnect(zval ** rv, zval ** host, zval ** db, zval ** username, zval ** password, INTERNAL_FUNCTION_PARAMETERS);
- /* returns persistent connection handle as resource on success or 0 as long on failure */
-int dbx_pgsql_close(zval ** rv, zval ** dbx_handle, INTERNAL_FUNCTION_PARAMETERS);
- /* returns 1 as long on success or 0 as long on failure */
-int dbx_pgsql_query(zval ** rv, zval ** dbx_handle, zval ** db_name, zval ** sql_statement, INTERNAL_FUNCTION_PARAMETERS);
- /* returns 1 as long or a result identifier as resource on success or 0 as long on failure */
-int dbx_pgsql_getcolumncount(zval ** rv, zval ** result_handle, INTERNAL_FUNCTION_PARAMETERS);
- /* returns column-count as long on success or 0 as long on failure */
-int dbx_pgsql_getcolumnname(zval ** rv, zval ** result_handle, long column_index, INTERNAL_FUNCTION_PARAMETERS);
- /* returns column-name as string on success or 0 as long on failure */
-int dbx_pgsql_getcolumntype(zval ** rv, zval ** result_handle, long column_index, INTERNAL_FUNCTION_PARAMETERS);
- /* returns column-type as string on success or 0 as long on failure */
-int dbx_pgsql_getrow(zval ** rv, zval ** result_handle, long row_number, INTERNAL_FUNCTION_PARAMETERS);
- /* returns array[0..columncount-1] as strings on success or 0 as long on failure */
-int dbx_pgsql_error(zval ** rv, zval ** dbx_handle, INTERNAL_FUNCTION_PARAMETERS);
- /* returns string */
-
-#endif /* ZEND_DBX_PGSQL_H */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/dbx/howto_extend_dbx.html b/ext/dbx/howto_extend_dbx.html
deleted file mode 100644
index 8cbd0f69fc..0000000000
--- a/ext/dbx/howto_extend_dbx.html
+++ /dev/null
@@ -1,316 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN">
-<html>
-<head>
-<title>HOWTO extend dbx</title>
-
-</head>
-
-<body marginwidth="0" marginheight="0">
-<style type="text/css">
-<!--
-
-body, p, td, input, select, a, h1, h2, h3, h4, h5, h6, marquee, blink
- { font-family: Verdana,sans-serif; font-size: 10pt; color: #000000; }
-h1 { font-size: 16pt; font-weight: bold; }
-h2 { font-size: 14pt; font-weight: bold; }
-h3 { font-size: 12pt; font-weight: bold; }
-h4 { font-size: 10pt; font-weight: bold; }
-h5 { font-size: 8pt;}
-h6 { font-size: 6pt;}
-
-body { background-color: #F0F0F0; }
-a { color: #000088; }
-
-.title { font-size: 14pt; font-weight: bold; }
-.fn-title { font-size: 12pt; font-weight: bold; }
-.fn-phpversion { font-size: 10pt; font-weight: normal; }
-.fn-def { margin-top: 8px; margin-bottom: 8px; background-color: #99BBDD; }
-.fn-defname { font-weight: bold; }
-.fn-name { font-size: 12pt; font-weight: bold; }
-.fn-param { font-weight: bold; }
-.example { margin-top: 12px; font-weight: bold; }
-.text { margin: 8px; }
-.code { margin: 16px; font-family: Courier; background-color: #CCCCCC; }
-.bold { font-weight: bold; }
-
-.indent { margin-left: 16px; }
-.newpage { border-top: 2px solid #000088; margin-bottom: 8px; }
-.tab { margin-left: 16px; }
-
-
--->
-</style>
-
-
-
-
-
-<a name="top"></a>
-<div class="title">
-How-to code support for another database<br>
-</div>
-<div class="text">
-Every supported database module must be loaded by PHP before it can be used. Every supported database module must be added to the dbx-module before it can be used. Currently there is support for MySQL, PostgreSQL, Microsoft SQL Server and ODBC, but it is not difficult to add support for more databases.<br>
-<br>
-The dbx module is found in de PHP ext/dbx folder. The support-code is found in the same folder <br>
-<br>
-To add support for module 'blabla' the following steps must be taken: <br>
-1. the dbx.c source file must be extended to recognize module 'blabla' and switch to the 'blabla' functions.<br>
-2. the files dbx_blabla.h and dbx_blabla.c must be created and edited to produce the required response.<br>
-3. add the files from step 2 to the project.<br>
-4. compile.<br>
-5. enjoy.<br>
-<br>
-You may need a bit of help for step 1 and 2. If you need help for step 3 or 4, you shouldn't try to attempt this probably :-). If you need help with step 5 you're in big trouble ;o)<br>
-Help for step 1 and 2 is given below, bold text in code indicate the important bits.<br>
-</div>
-<p>
-<a href="index.html">home</a><br>
-<div class="newpage"></div>
-
-<div class="fn-title"><a name="step1"></a>
-1. the dbx.c source file must be extended<br>
-</div>
-<div class="text">
-Define a module identifier and assign it a unique number. Include your header file here as well.<br>
-<pre class="code">
-// defines for supported databases
-#define DBX_UNKNOWN 0
-#define DBX_MYSQL 1
-#define DBX_ODBC 2
-<span class="bold">#define DBX_BLABLA 3</span>
-// includes for supported databases
-#include "dbx.h"
-#include "dbx_mysql.h"
-#include "dbx_odbc.h"
-<span class="bold">#include "dbx_blabla.h"</span>
-</pre>
-Add code to the module_identifier_exists function so DBX_BLABLA will be recognized:<br>
-<pre class="code">
-int module_identifier_exists(long module_identifier) {
- switch (module_identifier) {
- case DBX_MYSQL: return module_exists("mysql");
- case DBX_ODBC: return module_exists("odbc");
- <span class="bold">case DBX_BLABLA: return module_exists("blabla");</span>
- }
- return 0;
- }
-</pre>
-Add code to the get_module_identifier function so your extension will be recognized:<br>
-<pre class="code">
-int get_module_identifier(char * module_name) {
- if (!strcmp("mysql", module_name)) return DBX_MYSQL;
- if (!strcmp("odbc", module_name)) return DBX_ODBC;
- <span class="bold">if (!strcmp("blabla", module_name)) return DBX_BLABLA;</span>
- return DBX_UNKNOWN;
- }
-</pre>
-Add code for exposing the DBX_BLABLA constant to the world:<br>
-<pre class="code">
-ZEND_MINIT_FUNCTION(dbx)
-{
-/*/ REGISTER_INI_ENTRIES(); /*/
-
- REGISTER_LONG_CONSTANT("DBX_MYSQL", DBX_MYSQL, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("DBX_ODBC", DBX_ODBC, CONST_CS | CONST_PERSISTENT);
- <span class="bold">REGISTER_LONG_CONSTANT("DBX_BLABLA", DBX_BLABLA CONST_CS | CONST_PERSISTENT);</span>
-
- [...]
-
- return SUCCESS;
- }
-</pre>
-Add code for inclusion in the phpinfo() function (optional, but recommended):<br>
-<pre class="code">
-ZEND_MINFO_FUNCTION(dbx)
-{
- php_info_print_table_start();
- php_info_print_table_row(2, "dbx support", "enabled");
- php_info_print_table_row(2, "dbx support for MySQL", "enabled");
- php_info_print_table_row(2, "dbx support for ODBC", "enabled");
- <span class="bold">php_info_print_table_row(2, "dbx support for BlaBla", "enabled");</span>
- php_info_print_table_end();
- DISPLAY_INI_ENTRIES();
-}
-</pre>
-Finally, for the implementation of all switch_dbx_XXXXX functions, copy a 'case'-line for every function that you support (should be all functions!). Here is an example for only the switch_dbx_connect function:<br>
-<pre class="code">
-int switch_dbx_connect(zval ** rv, zval ** host, zval ** db, zval ** username, zval ** password, INTERNAL_FUNCTION_PARAMETERS, zval ** dbx_module) {
- // returns connection handle as resource on success or 0 as long on failure
- switch ((*dbx_module)-&gt;value.lval) {
- case DBX_MYSQL: return dbx_mysql_connect(rv, host, db, username, password, INTERNAL_FUNCTION_PARAM_PASSTHRU);
- case DBX_ODBC: return dbx_odbc_connect(rv, host, db, username, password, INTERNAL_FUNCTION_PARAM_PASSTHRU);
- <span class="bold">case DBX_BLABLA: return dbx_blabla_connect(rv, host, db, username, password, INTERNAL_FUNCTION_PARAM_PASSTHRU);</span>
- }
- zend_error(E_WARNING, "dbx_connect: not supported in this module");
- return 0;
- }
-</pre>
-This should be done for all switch_dbx_XXXXX functions. They are listed below:<br>
-<pre class="code">
-int <a href="#connect">switch_dbx_connect(...)</a>;
-int <a href="#pconnect">switch_dbx_pconnect(...)</a>;
-int <a href="#close">switch_dbx_close(...)</a>;
-int <a href="#query">switch_dbx_query(...)</a>;
-int <a href="#getcolumncount">switch_dbx_getcolumncount(...)</a>;
-int <a href="#getcolumnname">switch_dbx_getcolumnname(...)</a>;
-int <a href="#getcolumntype">switch_dbx_getcolumntype(...)</a>;
-int <a href="#getrow">switch_dbx_getrow(...)</a>;
-int <a href="#error">switch_dbx_error(...)</a>;
-</pre>
-This concludes the changes for the dbx.c file. All that is needed now is to actually code the dbx_blabla_connect and other functions, which we will see in the following step.<br>
-</div>
-<p>
-<a href="#top">top</a><br>
-<div class="newpage"></div>
-
-<div class="fn-title"><a name="step1"></a>
-2. the files dbx_blabla.h and dbx_blabla.c<br>
-</div>
-<div class="text">
-The dbx_blabla.h and dbx_blabla.c file are created in the folder /ext/dbx.<br>
-The easiest method is to just copy dbx_mysql.h en dbx_mysql.c, open both files, and do a search and replace ('blabla' for 'mysql' and 'BLABLA' for 'MYSQL'). Yes, case-sensitive.<br>
-For the .h file, that's all. <br>
-For the .c file, the fun has just started :-)<br>
-In the .c is the actual realization of the database abstraction, where a call to a standard function is translated into one or more database-specific calls. For mysql, a dbx_connect translates to a mysql_connect followed by a mysql_select_db. Refer to the dbx_mysql.c and dbx_odbc.c files regularly for examples!<br>
-In dbx.h one macro and one function are defined to make the calling of external module functions and returning of the results easier: dbx_call_any_function and MOVE_RETURNED_TO_RV.<br>
-<p>
- The details of what each of the functions do, what parameters they get, and what parameters they should return are discussed below. But first, the dbx_mysql_connect function is presented and explained, so you get an idea of how things work.<br>
-<pre class="code">
-int dbx_mysql_connect(zval ** rv, zval ** host, zval ** db, zval ** username, zval ** password, INTERNAL_FUNCTION_PARAMETERS) {
- // returns connection handle as resource on success or 0 as long on
- // failure
- int number_of_arguments;
- zval ** arguments[3];
- zval * returned_zval=NULL;
- zval * select_db_zval=NULL;
-
- number_of_arguments=3;
- arguments[0]=host;
- arguments[1]=username;
- arguments[2]=password;
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, <span class="bold">"mysql_connect"</span>, &returned_zval, number_of_arguments, arguments);
- if (!returned_zval || returned_zval-&gt;type!=IS_RESOURCE) {
- if (returned_zval) zval_ptr_dtor(&returned_zval);
- return 0;
- }
- MOVE_RETURNED_TO_RV(rv, returned_zval);
-
- number_of_arguments=2;
- arguments[0]=db;
- arguments[1]=rv;
- dbx_call_any_function(INTERNAL_FUNCTION_PARAM_PASSTHRU, <span class="bold">"mysql_select_db"</span>, &select_db_zval, number_of_arguments, arguments);
- zval_ptr_dtor(&select_db_zval);
-
- return 1;
- }
-</pre>
-First of all, all functions return 0 on failure and 1 on success. These values are used in the dbx-routines, they are never actually given back to the PHP-script writer that calls the dbx_connect function.<br>
-The actual value that is of interest to the caller is returned in the <span class="bold">rv</span> parameter. In this case it is a connection handle (or link identifier, in mysql-speak), that is also returned if the database selection doesn't succeed. <br>
-The parameters that are of interest to the function are located between the <span class="bold">rv</span> and <span class="bold">INTERNAL_FUNCTION_PARAMETERS</span> parameters, in this case it is a <span class="bold">host</span> name, a <span class="bold">db</span> name, a <span class="bold">username</span> and a <span class="bold">password</span>. These are the values that the user specifies if he calls dbx_connect(); These parameters are used in the calls to the mysql-database functions. The user actually also specifies a module-name, that decides which connect-function should be called. Here, he specified 'mysql'.<br>
-To actually call a mysql module function, you can use <span class="bold">dbx_call_any_function</span> where you specify the function name (it is used twice in dbx_mysql_connect, see <span class="bold">'mysql_connect'</span> and <span class="bold">'mysql_select_db'</span>, they are printed bold in the code). The value that is returned from the function will be stored in the next argument, a zval * (e.g. <span class="bold">returned_zval</span>) parameter that you must declare locally. To actually return such a parameter, use the <span class="bold">MOVE_RETURNED_TO_RV(rv, returned_zval)</span> macro, which copies the values to <span class="bold">rv</span> and frees anything that may be left in <span class="bold">returned_zval</span>. Parameters that must be passed to the mysql-function are stored in the <span class="bold">arguments</span> array, which must be large enough to hold all parameters to the function-call that requires the most parameters (in this case, mysql_connect expects 3 parameters, mysql_select_db expects two parameters, so the <span class="bold">arguments</span> array is defined 'zval ** arguments[<span class="bold">3</span>]'). The <span class="bold">number_of_arguments</span> parameter is set to the actual number of arguments that the function-call requires. As you can see it is initialized to 3, for the first call to mysql_connect. Then it is set to 2, for the call to mysql_select_db. If you call a function that retrieves a value, and you don't return it with MOVE_RETURNED_TO_RV, then you must free the value using <span class="bold">zval_ptr_dtor</span>, as can be seen right after the call to mysql_select_db. This can also be seen directly after the call to mysql_connect, if somehow this function failed or didn't return a resource (on a successful connect mysql_connect returns a resource) the returned value is freed as well (and 0 is returned because the connection failed).<br>
-<p>
-OK, now the description of all functions that you should implement, and what is expected of them...<br>
-<a name="connect"></a><pre class="code">
-int <span class="fn-name">dbx_blabla_connect</span>(zval ** rv, zval ** <span class="fn-param">host</span>, zval ** <span class="fn-param">db</span>, zval ** <span class="fn-param">username</span>, zval ** <span class="fn-param">password</span>, INTERNAL_FUNCTION_PARAMETERS);
-// int: returns 0 on connect-failure and 1 on success
-// rv: connection handle as resource on success or nothing on failure
-</pre>
-dbx_blabla_connect creates a connection to a database on a specified host, using username and password for authentication. This may be done by connecting to a server and selecting a database (as mysql does), or connecting to a specific database directly (as in ODBC). <br>
-What must be returned (in <span class="bold">rv</span>) is the link identifier that is returned from the blabla_connect function, in it's native form so the end-user can use $db-&gt;handle to call other blabla_* functions that expect this parameter.<br>
-What must be returned from the function is a 1 on success and a 0 on failure. Remember that a failed database selection can still return a 1 because the connection succeeded!<br>
-The host (string) is the name of the machine the server is run on, but it may be empty if a database name is enough to establish a connection.<br>
-The db (string) is the name of the database to select, or, for e.g. ODBC, the identifier that is needed to actually select the database.<br>
-The username (string) and password (string) are used for authentication.<br>
-<a name="pconnect"></a><pre class="code">
-int <span class="fn-name">dbx_blabla_pconnect</span>(zval ** rv, zval ** <span class="fn-param">host</span>, zval ** <span class="fn-param">db</span>, zval ** <span class="fn-param">username</span>, zval ** <span class="fn-param">password</span>, INTERNAL_FUNCTION_PARAMETERS);
-// int: returns 0 on pconnect-failure and 1 on success
-// rv: persistent connection handle as resource on success or nothing
-// on failure
-</pre>
-dbx_blabla_pconnect is identical to dbx_blabla_connect except that it will create a persistent connection.<br>
-<a name="close"></a><pre class="code">
-int <span class="fn-name">dbx_blabla_close</span>(zval ** rv, zval ** <span class="fn-param">dbx_handle</span>, INTERNAL_FUNCTION_PARAMETERS);
-// int: returns 0 on close-failure and 1 on success
-// rv: 1 as bool on success or nothing on failure
-</pre>
-dbx_blabla_close closes an open connection, whether it was created persistently or not.<br>
-What must be returned (in <span class="bold">rv</span>) is a boolean true that indicates when the connection was closed successfully. If it wasn't, no value is returned in <span class="bold">rv</span>.<br>
-What must be returned from the function is a 1 on success and a 0 on failure. Note that an unsuccessful close is still a succeeded function call.<br>
-The dbx_handle is the same value that you returned from dbx_blabla_connect or dbx_blabla_pconnect.<br>
-<a name="query"></a><pre class="code">
-int <span class="fn-name">dbx_blabla_query</span>(zval ** rv, zval ** <span class="fn-param">dbx_handle</span>, zval ** <span class="fn-param">sql_statement</span>, INTERNAL_FUNCTION_PARAMETERS);
-// int: returns 0 on query-failure and 1 on success
-// rv: 1 as bool or a result identifier as resource on success
-// or nothing on failure
-</pre>
-dbx_blabla_query executes an SQL statement over the connection.<br>
-What must be returned (in <span class="bold">rv</span>) is a nothing on failure, on success it must return either a boolean 1 for queries that don't return data (like INSERT INTO) or a native result-handle for queries that do return data (SELECT). The native result handle ($q-&gt;handle) can be used by the end-user to call other blabla_* functions that expect this parameter.<br>
-What must be returned from the function is a 1 on success and a 0 on failure. Note that a failed query execution can still return a 1 because the query function succeeded!<br>
-The dbx_handle is the same value that you returned from dbx_blabla_connect or dbx_blabla_pconnect.<br>
-The sql_statement (string) can have any value.<br>
-<a name="getcolumncount"></a><pre class="code">
-int <span class="fn-name">dbx_blabla_getcolumncount</span>(zval ** rv, zval ** <span class="fn-param">result_handle</span>, INTERNAL_FUNCTION_PARAMETERS);
-// int: returns 0 on query-failure and 1 on success
-// returns column-count as long on success or nothing on failure
-</pre>
-dbx_blabla_getcolumncount gets the number of fields that the query-result contains.<br>
-What must be returned (in <span class="bold">rv</span>) is the number of fields as long from the query result specified by the result_handle.<br>
-What must be returned from the function is a 1 on success and a 0 on failure. <br>
-The result_handle is the same value that you returned from dbx_query.<br>
-<a name="getcolumnname"></a><pre class="code">
-int <span class="fn-name">dbx_blabla_getcolumnname</span>(zval ** rv, zval ** <span class="fn-param">result_handle</span>, long <span class="fn-param">column_index</span>, INTERNAL_FUNCTION_PARAMETERS);
-// int: returns 0 on failure and 1 on success
-// returns column-name as string on success or nothing on failure
-</pre>
-dbx_blabla_getcolumnname gets the fieldname of the specified column.<br>
-What must be returned (in <span class="bold">rv</span>) is the fieldname as string of the given column.<br>
-What must be returned from the function is a 1 on success and a 0 on failure. <br>
-The result_handle is the same value that you returned from dbx_query.<br>
-The column_index is a long that ranges from 0 to the value you returned from dbx_blabla_getcolumncount minus 1 [0..columncount-1].<br>
-<a name="getcolumntype"></a><pre class="code">
-int <span class="fn-name">dbx_blabla_getcolumntype</span>(zval ** rv, zval ** <span class="fn-param">result_handle</span>, long <span class="fn-param">column_index</span>, INTERNAL_FUNCTION_PARAMETERS);
-// int: returns 0 on failure and 1 on success
-// returns column-type as string on success or nothing on failure
-</pre>
-dbx_blabla_getcolumnname gets the field type of the specified column.<br>
-What must be returned (in <span class="bold">rv</span>) is the field type as string of the given column.<br>
-What must be returned from the function is a 1 on success and a 0 on failure. <br>
-The result_handle is the same value that you returned from dbx_query.<br>
-The column_index is a long that ranges from 0 to the value you returned from dbx_blabla_getcolumncount minus 1 [0..columncount-1].<br>
-<a name="getrow"></a><pre class="code">
-int <span class="fn-name">dbx_blabla_getrow</span>(zval ** rv, zval ** <span class="fn-param">result_handle</span>, long <span class="fn-param">row_number</span>, INTERNAL_FUNCTION_PARAMETERS);
-// int: returns 0 on failure and 1 on success
-// returns array[0..columncount-1] as strings on success or 0 as long
-// on failure
-</pre>
-dbx_blabla_getrow gets the next row from the query-results.<br>
-In some cases (PostgreSQL) the rownumber is needed to actually fetch the row. This will be provided (it will be indexed starting at 0) by the dbx_query function. In other cases it is not needed and thus not used.<br>
-What must be returned (in <span class="bold">rv</span>) is an indexed array[0..columncount-1] of strings, containing the data from the row (for mysql this is easy since it already performs this way, for ODBC the array has to be constructed inside this function from a loop that fetches the data for each column).<br>
-What must be returned from the function is a 1 on success and a 0 on failure (function failed or there are no more rows available). <br>
-The result_handle is the same value that you returned from dbx_query.<br>
-<a name="error"></a><pre class="code">
-int <span class="fn-name">dbx_blabla_error</span>(zval ** rv, zval ** <span class="fn-param">dbx_handle</span>, INTERNAL_FUNCTION_PARAMETERS);
-// int: returns 0 on failure and 1 on success
-// returns error message as string
-</pre>
-dbx_blabla_error gets the error message from the last database call.<br>
-What must be returned (in <span class="bold">rv</span>) is the error message as a string.<br>
-What must be returned from the function is a 1 on success and a 0 on failure. <br>
-The dbx_handle is the same value that you returned from dbx_blabla_connect or dbx_blabla_pconnect.<br>
-</div>
-<p>
-<a href="#top">top</a><br>
-<div class="newpage"></div>
-<p>
-<div class="text">
-For specifics or the finer details you can always refer to dbx_mysql.c and dbx_odbc.c to see everything in action. <br>
-More Zend API documentation can be found at <a href="http://www.zend.com/apidoc">http://www.zend.com/apidoc</a>.<br>
-This document can be found at <a href="http://www.guidance.nl/php/dbx">http://www.guidance.nl/php/dbx</a>.<br>
-</div>
-<p>
-<a href="#top">top</a><br>
-<div class="newpage"></div>
-
-</body>
-</html>
diff --git a/ext/dbx/php_dbx.h b/ext/dbx/php_dbx.h
deleted file mode 100644
index 08d753d648..0000000000
--- a/ext/dbx/php_dbx.h
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | dbx module version 1.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 2001 Guidance Rotterdam BV |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author : Marc Boeren <marc@guidance.nl> |
- +----------------------------------------------------------------------+
-*/
-
-#ifndef ZEND_PHP_DBX_H
-#define ZEND_PHP_DBX_H
-
-#ifndef INIT_FUNC_ARGS
-#include "zend_modules.h"
-#endif
-
-extern zend_module_entry dbx_module_entry;
-#define phpext_dbx_ptr &dbx_module_entry
-
-#ifdef ZEND_WIN32
-#define ZEND_DBX_API __declspec(dllexport)
-#else
-#define ZEND_DBX_API
-#endif
-
-ZEND_MINIT_FUNCTION(dbx);
-ZEND_MSHUTDOWN_FUNCTION(dbx);
-/* ZEND_RINIT_FUNCTION(dbx); */
-/* ZEND_RSHUTDOWN_FUNCTION(dbx); */
-
-ZEND_MINFO_FUNCTION(dbx);
-
-ZEND_FUNCTION(dbx_connect);
-ZEND_FUNCTION(dbx_close);
-ZEND_FUNCTION(dbx_query);
-ZEND_FUNCTION(dbx_error);
-
-ZEND_FUNCTION(dbx_sort);
-ZEND_FUNCTION(dbx_compare);
-
-/*
- Declare any global variables you may need between the BEGIN
- and END macros here:
-*/
-
-/*
-ZEND_BEGIN_MODULE_GLOBALS(dbx)
-ZEND_END_MODULE_GLOBALS(dbx)
-*/
-
-/* In every function that needs to use variables in php_dbx_globals,
- do call dbxLS_FETCH(); after declaring other variables used by
- that function, and always refer to them as dbxG(variable).
- You are encouraged to rename these macros something shorter, see
- examples in any other php module directory.
-*/
-
-#ifdef ZTS
-#define DBXLS_D zend_dbx_globals *dbx_globals
-#define DBXLS_DC , DBXLS_D
-#define DBXLS_C dbx_globals
-#define DBXLS_CC , DBXLS_C
-#define DBXG(v) (dbx_globals->v)
-#define DBXLS_FETCH() zend_dbx_globals *dbx_globals = ts_resource(dbx_globals_id)
-#else
-#define DBXLS_D
-#define DBXLS_DC
-#define DBXLS_C
-#define DBXLS_CC
-#define DBXG(v) (dbx_globals.v)
-#define DBXLS_FETCH()
-#endif
-
-#endif /* ZEND_PHP_DBX_H */
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/dbx/tests/001.phpt b/ext/dbx/tests/001.phpt
deleted file mode 100644
index 2281426230..0000000000
--- a/ext/dbx/tests/001.phpt
+++ /dev/null
@@ -1,12 +0,0 @@
---TEST--
-Check for dbx presence
---SKIPIF--
-<?php if (!extension_loaded("dbx")) print("skip"); ?>
---POST--
---GET--
---FILE--
-<?php
-print("dbx extension is available");
-?>
---EXPECT--
-dbx extension is available \ No newline at end of file
diff --git a/ext/dbx/tests/002.phpt b/ext/dbx/tests/002.phpt
deleted file mode 100644
index 7c95358e4c..0000000000
--- a/ext/dbx/tests/002.phpt
+++ /dev/null
@@ -1,25 +0,0 @@
---TEST--
-DBX_CONSTANTS
---SKIPIF--
-<?php if (!extension_loaded("dbx")) print("skip"); ?>
---POST--
---GET--
---FILE--
-<?php
-if (DBX_MYSQL=="DBX_MYSQL") print('!DBX_MYSQL');
-if (DBX_ODBC=="DBX_ODBC") print('!DBX_ODBC');
-if (DBX_PGSQL=="DBX_PGSQL") print('!DBX_PGSQL');
-if (DBX_MSSQL=="DBX_MSSQL") print('!DBX_MSSQL');
-if (DBX_PERSISTENT=="DBX_PERSISTENT") print('!DBX_PERSISTENT');
-if (DBX_RESULT_INFO=="DBX_RESULT_INFO") print('!DBX_RESULT_INFO');
-if (DBX_RESULT_INDEX=="DBX_RESULT_INDEX") print('!DBX_RESULT_INDEX');
-if (DBX_RESULT_ASSOC=="DBX_RESULT_ASSOC") print('!DBX_RESULT_ASSOC');
-if (DBX_CMP_NATIVE=="DBX_CMP_NATIVE") print('!DBX_CMP_NATIVE');
-if (DBX_CMP_TEXT=="DBX_CMP_TEXT") print('!DBX_CMP_TEXT');
-if (DBX_CMP_NUMBER=="DBX_CMP_NUMBER") print('!DBX_CMP_NUMBER');
-if (DBX_CMP_ASC=="DBX_CMP_ASC") print('!DBX_CMP_ASC');
-if (DBX_CMP_DESC=="DBX_CMP_DESC") print('!DBX_CMP_DESC');
-print('ok');
-?>
---EXPECT--
-ok \ No newline at end of file
diff --git a/ext/dbx/tests/003.phpt b/ext/dbx/tests/003.phpt
deleted file mode 100644
index 03eec20ddf..0000000000
--- a/ext/dbx/tests/003.phpt
+++ /dev/null
@@ -1,107 +0,0 @@
---TEST--
-dbx_connect
---SKIPIF--
-<?php if (!extension_loaded("dbx")) print("skip"); ?>
---POST--
---GET--
---FILE--
-<?php
-include_once("ext/dbx/tests/dbx_test.p");
-$nonexisting_database="nonexisting_database";
-$nonexisting_username="nonexisting_username";
-$nonexisting_password="nonexisting_password";
-$dlo = dbx_connect($module_name, $host, $database, $username, $password);
-if ($dlo!=0) {
- print('connect using string ok'."\n");
- dbx_close($dlo);
- }
-$dlo = dbx_connect($module, $host, $database, $username, $password);
-if ($dlo!=0) {
- print('connect using constant ok'."\n");
- dbx_close($dlo);
- }
-$dlo = @dbx_connect($module, $host, $nonexisting_database, $username, $password);
-if ($dlo==0) {
- print('connect to non-existing database failed, so it\'s ok'."\n");
- }
-else {
- print_r($dlo);
- dbx_close($dlo);
- }
-$dlo = @dbx_connect($module, $host, $database, $nonexisting_username, $nonexisting_password);
-if ($dlo==0) {
- print('connect with false username/password combi failed, so it\'s ok'."\n");
- }
-else {
- print_r($dlo);
- dbx_close($dlo);
- }
-$dlo = dbx_connect($module_name, $host, $database, $username, $password, DBX_PERSISTENT);
-if ($dlo!=0) {
- print('persistent connect using string ok'."\n");
- dbx_close($dlo);
- }
-$dlo = dbx_connect($module, $host, $database, $username, $password, DBX_PERSISTENT);
-if ($dlo!=0) {
- print('persistent connect using constant ok'."\n");
- dbx_close($dlo);
- }
-$dlo = @dbx_connect($module, $host, $nonexisting_database, $username, $password, DBX_PERSISTENT);
-if ($dlo==0) {
- print('persistent connect to non-existing database failed, so it\'s ok'."\n");
- }
-else {
- print_r($dlo);
- dbx_close($dlo);
- }
-$dlo = @dbx_connect($module, $host, $database, $nonexisting_username, $nonexisting_password, DBX_PERSISTENT);
-if ($dlo==0) {
- print('persistent connect with false username/password combi failed, so it\'s ok'."\n");
- }
-else {
- print_r($dlo);
- dbx_close($dlo);
- }
-$dlo = @dbx_connect($module, $host, $database, $username, $password, DBX_PERSISTENT, "12many");
-if ($dlo==0) {
- print('too many parameters: connect failure works ok'."\n");
- }
-else {
- print_r($dlo);
- dbx_close($dlo);
- }
-$dlo = @dbx_connect($module, $host, $database, $username);
-if ($dlo==0) {
- print('too few parameters: connect failure works ok'."\n");
- }
-else {
- print_r($dlo);
- dbx_close($dlo);
- }
-$dlo1 = dbx_connect($module, $host, $database, $username, $password);
-$dlo2 = dbx_connect($module, $host, $database, $username, $password);
-if ($dlo1!=0 && $dlo2!=0) {
- print('multiple connects ok'."\n");
- dbx_close($dlo1);
- dbx_close($dlo2);
- }
-$dlo1 = dbx_connect($module, $host, $database, $username, $password);
-$dlo2 = @dbx_connect($module, $host, $nonexisting_database, $username, $password);
-if ($dlo1!=0 && $dlo2==0) {
- print('multiple connects (2nd fails on database-name) ok'."\n");
- dbx_close($dlo1);
- }
-?>
---EXPECT--
-connect using string ok
-connect using constant ok
-connect to non-existing database failed, so it's ok
-connect with false username/password combi failed, so it's ok
-persistent connect using string ok
-persistent connect using constant ok
-persistent connect to non-existing database failed, so it's ok
-persistent connect with false username/password combi failed, so it's ok
-too many parameters: connect failure works ok
-too few parameters: connect failure works ok
-multiple connects ok
-multiple connects (2nd fails on database-name) ok \ No newline at end of file
diff --git a/ext/dbx/tests/004.phpt b/ext/dbx/tests/004.phpt
deleted file mode 100644
index 80baa53374..0000000000
--- a/ext/dbx/tests/004.phpt
+++ /dev/null
@@ -1,30 +0,0 @@
---TEST--
-dbx_close
---SKIPIF--
-<?php if (!extension_loaded("dbx")) print("skip"); ?>
---POST--
---GET--
---FILE--
-<?php
-include_once("ext/dbx/tests/dbx_test.p");
-$dlo = dbx_connect($module, $host, $database, $username, $password);
-if ($dlo!=0) {
- if (dbx_close($dlo)) {
- print('close works ok'."\n");
- }
- }
-if (!@dbx_close($dlo)) {
- print('close failure works ok'."\n");
- }
-if (!@dbx_close($dlo, "12many")) {
- print('too many parameters: close failure works ok'."\n");
- }
-if (!@dbx_close()) {
- print('too few parameters: close failure works ok'."\n");
- }
-?>
---EXPECT--
-close works ok
-close failure works ok
-too many parameters: close failure works ok
-too few parameters: close failure works ok \ No newline at end of file
diff --git a/ext/dbx/tests/005.phpt b/ext/dbx/tests/005.phpt
deleted file mode 100644
index 7185fdd0a8..0000000000
--- a/ext/dbx/tests/005.phpt
+++ /dev/null
@@ -1,87 +0,0 @@
---TEST--
-dbx_query
---SKIPIF--
-<?php if (!extension_loaded("dbx")) print("skip"); ?>
---POST--
---GET--
---FILE--
-<?php
-include_once("ext/dbx/tests/dbx_test.p");
-$sql_statement = "select * from tbl order by id";
-$invalid_sql_statement = "invalid select * from tbl";
-$sql_select_statement = "select * from tbl where id=999999 and parentid=999999";
-$sql_insert_statement = "insert into tbl (id, parentid, description) values (999999, 999999, 'temporary_record')";
-$sql_update_statement = "update tbl set field2 = 'bla''bla\"bla' where id=999999 and parentid=999999";
-$sql_delete_statement = "delete from tbl where id=999999 and parentid=999999";
-$dlo = dbx_connect($module, $host, $database, $username, $password);
-if (!$dlo) {
- print('this won\'t work'."\n");
- }
-else {
- // select query
- if ($dro=dbx_query($dlo, $sql_statement)) {
- for ($i=0; $i<$dro->rows; ++$i) {
- print($dro->data[$i]['id'].".".$dro->data[$i]['description'].".".$dro->data[$i]['field1'].".".strlen($dro->data[$i]['field2'])."\n");
- }
- }
- // insert query
- if (dbx_query($dlo, $sql_insert_statement)) {
- print('insert-query: dbx_query works ok'."\n");
- if ($dro=dbx_query($dlo, $sql_select_statement)) {
- for ($i=0; $i<$dro->rows; ++$i) {
- print($dro->data[$i]['id'].".".$dro->data[$i]['description'].".".strlen($dro->data[$i]['field2'])."\n");
- }
- }
- }
- // update query
- if (dbx_query($dlo, $sql_update_statement)) {
- print('update-query: dbx_query works ok'."\n");
- if ($dro=dbx_query($dlo, $sql_select_statement)) {
- for ($i=0; $i<$dro->rows; ++$i) {
- print($dro->data[$i]['id'].".".$dro->data[$i]['description'].".".strlen($dro->data[$i]['field2'])."\n");
- }
- }
- }
- // delete query
- if (dbx_query($dlo, $sql_delete_statement)) {
- print('delete-query: dbx_query works ok'."\n");
- if ($dro=dbx_query($dlo, $sql_select_statement)) {
- for ($i=0; $i<$dro->rows; ++$i) {
- print($dro->data[$i]['id'].".".$dro->data[$i]['description'].".".strlen($dro->data[$i]['field2'])."\n");
- }
- }
- }
-
- // generate errors
- if (!@dbx_query(0, $sql_statement)) {
- print('wrong dbx_link_object: query failure works ok'."\n");
- }
- if (!@dbx_query($dlo, $invalid_sql_statement)) {
- print('wrong sql-statement: query failure works ok'."\n");
- }
- if (!@dbx_query($dlo, $sql_statement, DBX_RESULT_INDEX, "12many")) {
- print('too many parameters: query failure works ok'."\n");
- }
- if (!@dbx_query($dlo)) {
- print('too few parameters: query failure works ok'."\n");
- }
- dbx_close($dlo);
- }
-?>
---EXPECT--
-1.root.empty fields.0
-10.abc.field2 contains single quote.3
-20.cba.field2 contains double quote.3
-30.bac.field2 contains >4k text.4591
-40.100.field2 contains >64k text.70051
-50.20.empty fields.0
-60.20.empty fields.0
-insert-query: dbx_query works ok
-999999.temporary_record.0
-update-query: dbx_query works ok
-999999.temporary_record.11
-delete-query: dbx_query works ok
-wrong dbx_link_object: query failure works ok
-wrong sql-statement: query failure works ok
-too many parameters: query failure works ok
-too few parameters: query failure works ok \ No newline at end of file
diff --git a/ext/dbx/tests/006.phpt b/ext/dbx/tests/006.phpt
deleted file mode 100644
index cfe1e48b97..0000000000
--- a/ext/dbx/tests/006.phpt
+++ /dev/null
@@ -1,55 +0,0 @@
---TEST--
-dbx_error
---SKIPIF--
-<?php if (!extension_loaded("dbx")) print("skip"); ?>
---POST--
---GET--
---FILE--
-<?php
-include_once("ext/dbx/tests/dbx_test.p");
-if ($module==DBX_ODBC) {
- // ODBC module doesn't have an error-message-function (yet?)
- print('query generated an error: dbx_error works ok'."\n");
- print('query is valid: dbx_error works ok'."\n");
- print('wrong dbx_link_object: dbx_error failure works ok'."\n");
- print('too many parameters: dbx_error failure works ok'."\n");
- print('too few parameters: dbx_error failure works ok'."\n");
- }
-else {
-
-$sql_statement = "select * from tbl";
-$invalid_sql_statement = "invalid select * from tbl";
-$dlo = dbx_connect($module, $host, $database, $username, $password);
-if (!$dlo) {
- print('this won\'t work'."\n");
- }
-else {
- @dbx_query($dlo, "select nonexistingfield from tbl");
- if (($module==DBX_MSSQL && dbx_error($dlo)!="Changed database context to '".$database."'.")
- || strlen(dbx_error($dlo))) {
- print('query generated an error: dbx_error works ok'."\n");
- }
- dbx_query($dlo, "select description from tbl");
- if (!strlen(dbx_error($dlo)) || ($module==DBX_MSSQL && dbx_error($dlo)=="Changed database context to '".$database."'.")) {
- print('query is valid: dbx_error works ok'."\n");
- }
- if (!@dbx_error(0)) {
- print('wrong dbx_link_object: dbx_error failure works ok'."\n");
- }
- if (!@dbx_error($dlo, "12many")) {
- print('too many parameters: dbx_error failure works ok'."\n");
- }
- if (!@dbx_error()) {
- print('too few parameters: dbx_error failure works ok'."\n");
- }
- dbx_close($dlo);
- }
-
- }
-?>
---EXPECT--
-query generated an error: dbx_error works ok
-query is valid: dbx_error works ok
-wrong dbx_link_object: dbx_error failure works ok
-too many parameters: dbx_error failure works ok
-too few parameters: dbx_error failure works ok \ No newline at end of file
diff --git a/ext/dbx/tests/007.phpt b/ext/dbx/tests/007.phpt
deleted file mode 100644
index bfc8baa505..0000000000
--- a/ext/dbx/tests/007.phpt
+++ /dev/null
@@ -1,74 +0,0 @@
---TEST--
-dbx_sort
---SKIPIF--
-<?php if (!extension_loaded("dbx")) print("skip"); ?>
---POST--
---GET--
---FILE--
-<?php
-include_once("ext/dbx/tests/dbx_test.p");
-$sql_statement = "select id, description from tbl where parentid=1 order by id";
-$compare_function = "cmp";
-$invalid_compare_function = "invalid_cmp";
-$nonexisting_compare_function = "nonexisting_cmp";
-$dlo = dbx_connect($module, $host, $database, $username, $password);
-function invalid_cmp() {
- return "blabla";
- }
-function cmp($a, $b) {
- $rv = dbx_compare($a, $b, "description");
- if (!$rv) $rv = dbx_compare($a, $b, "id");
- return $rv;
- }
-if (!$dlo) {
- print('this won\'t work'."\n");
- }
-else {
- $dro = dbx_query($dlo, $sql_statement);
- if (!$dro) {
- print('this won\'t work'."\n");
- }
- for ($i=0; $i<$dro->rows; ++$i) {
- print($dro->data[$i]['id'].".".$dro->data[$i]['description']."\n");
- }
- if (dbx_sort($dro, $compare_function)) {
- for ($i=0; $i<$dro->rows; ++$i) {
- print($dro->data[$i]['id'].".".$dro->data[$i]['description']."\n");
- }
- }
- if (!@dbx_sort(0, $compare_function)) {
- print('wrong dbx_result_object: dbx_sort failure works ok'."\n");
- }
- if (dbx_sort($dro, $nonexisting_compare_function)) {
- print('nonexisting compare function: dbx_sort will NOT complain'."\n");
- }
- if (dbx_sort($dro, $invalid_compare_function)) {
- print('invalid compare function: dbx_sort will NOT complain'."\n");
- }
- if (!@dbx_sort($dro, $compare_function, "12many")) {
- print('too many parameters: dbx_sort failure works ok'."\n");
- }
- if (!@dbx_sort($dro)) {
- print('too few parameters: dbx_sort failure works ok'."\n");
- }
- dbx_close($dlo);
- }
-?>
---EXPECT--
-10.abc
-20.cba
-30.bac
-40.100
-50.20
-60.20
-40.100
-50.20
-60.20
-10.abc
-30.bac
-20.cba
-wrong dbx_result_object: dbx_sort failure works ok
-nonexisting compare function: dbx_sort will NOT complain
-invalid compare function: dbx_sort will NOT complain
-too many parameters: dbx_sort failure works ok
-too few parameters: dbx_sort failure works ok \ No newline at end of file
diff --git a/ext/dbx/tests/008.phpt b/ext/dbx/tests/008.phpt
deleted file mode 100644
index ac3f76fe94..0000000000
--- a/ext/dbx/tests/008.phpt
+++ /dev/null
@@ -1,146 +0,0 @@
---TEST--
-dbx_compare
---SKIPIF--
-<?php if (!extension_loaded("dbx")) print("skip"); ?>
---POST--
---GET--
---FILE--
-<?php
-include_once("ext/dbx/tests/dbx_test.p");
-$sql_statement = "select id, description from tbl where parentid=1 order by id";
-$compare_function_1 = "cmp_description_id";
-$compare_function_2 = "cmp_description_desc_id";
-$compare_function_3 = "cmp_description_id_desc";
-$compare_function_4 = "cmp_description_desc_id_desc";
-$compare_function_5 = "cmp_description_txt_id";
-$compare_function_6 = "cmp_description_number_id";
-$dlo = dbx_connect($module, $host, $database, $username, $password);
-function cmp_description_id($a, $b) {
- $rv = dbx_compare($a, $b, "description");
- if (!$rv) $rv = dbx_compare($a, $b, "id");
- return $rv;
- }
-function cmp_description_desc_id($a, $b) {
- $rv = dbx_compare($a, $b, "description", DBX_CMP_DESC);
- if (!$rv) $rv = dbx_compare($a, $b, "id");
- return $rv;
- }
-function cmp_description_id_desc($a, $b) {
- $rv = dbx_compare($a, $b, "description");
- if (!$rv) $rv = dbx_compare($a, $b, "id", DBX_CMP_DESC);
- return $rv;
- }
-function cmp_description_desc_id_desc($a, $b) {
- $rv = dbx_compare($a, $b, "description", DBX_CMP_DESC);
- if (!$rv) $rv = dbx_compare($a, $b, "id", DBX_CMP_DESC);
- return $rv;
- }
-function cmp_description_txt_id($a, $b) {
- $rv = dbx_compare($a, $b, "description", DBX_CMP_TEXT);
- if (!$rv) $rv = dbx_compare($a, $b, "id");
- return $rv;
- }
-function cmp_description_number_id($a, $b) {
- $rv = dbx_compare($a, $b, "description", DBX_CMP_NUMBER);
- if (!$rv) $rv = dbx_compare($a, $b, "id");
- return $rv;
- }
-if (!$dlo) {
- print('this won\'t work'."\n");
- }
-else {
- $dro = dbx_query($dlo, $sql_statement);
- if (!$dro) {
- print('this won\'t work'."\n");
- }
- for ($i=0; $i<$dro->rows; ++$i) {
- print($dro->data[$i]['id'].".".$dro->data[$i]['description']."\n");
- }
- if (dbx_sort($dro, $compare_function_1)) {
- for ($i=0; $i<$dro->rows; ++$i) {
- print($dro->data[$i]['id'].".".$dro->data[$i]['description']."\n");
- }
- }
- if (dbx_sort($dro, $compare_function_2)) {
- for ($i=0; $i<$dro->rows; ++$i) {
- print($dro->data[$i]['id'].".".$dro->data[$i]['description']."\n");
- }
- }
- if (dbx_sort($dro, $compare_function_3)) {
- for ($i=0; $i<$dro->rows; ++$i) {
- print($dro->data[$i]['id'].".".$dro->data[$i]['description']."\n");
- }
- }
- if (dbx_sort($dro, $compare_function_4)) {
- for ($i=0; $i<$dro->rows; ++$i) {
- print($dro->data[$i]['id'].".".$dro->data[$i]['description']."\n");
- }
- }
- if (dbx_sort($dro, $compare_function_5)) {
- for ($i=0; $i<$dro->rows; ++$i) {
- print($dro->data[$i]['id'].".".$dro->data[$i]['description']."\n");
- }
- }
- if (dbx_sort($dro, $compare_function_6)) {
- for ($i=0; $i<$dro->rows; ++$i) {
- print($dro->data[$i]['id'].".".$dro->data[$i]['description']."\n");
- }
- }
- if (!@dbx_compare($a, $b, "fieldname")) {
- print('wrong parameters: dbx_compare failure works ok'."\n");
- }
- if (!@dbx_compare($a, $b, "fieldname", DBX_CMP_NATIVE, "12many")) {
- print('too many parameters: dbx_compare failure works ok'."\n");
- }
- if (!@dbx_compare($a, $b)) {
- print('too few parameters: dbx_compare failure works ok'."\n");
- }
- dbx_close($dlo);
- }
-?>
---EXPECT--
-10.abc
-20.cba
-30.bac
-40.100
-50.20
-60.20
-40.100
-50.20
-60.20
-10.abc
-30.bac
-20.cba
-20.cba
-30.bac
-10.abc
-50.20
-60.20
-40.100
-40.100
-60.20
-50.20
-10.abc
-30.bac
-20.cba
-20.cba
-30.bac
-10.abc
-60.20
-50.20
-40.100
-40.100
-50.20
-60.20
-10.abc
-30.bac
-20.cba
-10.0
-20.0
-30.0
-50.20
-60.20
-40.100
-wrong parameters: dbx_compare failure works ok
-too many parameters: dbx_compare failure works ok
-too few parameters: dbx_compare failure works ok \ No newline at end of file
diff --git a/ext/dbx/tests/dbx_test.p b/ext/dbx/tests/dbx_test.p
deleted file mode 100644
index 7b704c9b8f..0000000000
--- a/ext/dbx/tests/dbx_test.p
+++ /dev/null
@@ -1,38 +0,0 @@
-<?php
-$connection = DBX_MYSQL;
-switch ($connection) {
- case DBX_MYSQL:
- $module=DBX_MYSQL;
- $host="";
- $database="dbx_test";
- $username="dbx_testuser";
- $password="dbx_testpassword";
- $module_name="mysql";
- break;
- case DBX_MSSQL:
- $module=DBX_MSSQL;
- $host="HOLLY";
- $database="dbx_test";
- $username="";
- $password="";
- $module_name="mssql";
- break;
- case DBX_ODBC:
- $module=DBX_ODBC;
- $host="localhost";
- $database="dbx_test_mysql"; // "dbx_test_access";
- $username="dbx_testuser";
- $password="dbx_testpassword";
- $module_name="odbc";
- break;
- case DBX_PGSQL:
- $module=DBX_PGSQL;
- $host="";
- $database="dbx_test";
- $username="dbx_testuser";
- $password="dbx_testpassword";
- $module_name="pgsql";
- break;
- }
-
-?> \ No newline at end of file
diff --git a/ext/dbx/tests/dbx_test.pgsql.script b/ext/dbx/tests/dbx_test.pgsql.script
deleted file mode 100644
index 316349df92..0000000000
--- a/ext/dbx/tests/dbx_test.pgsql.script
+++ /dev/null
@@ -1,37 +0,0 @@
-create database dbx_test;
-\cdbx_test
-
-create table tbl (
- id int NOT NULL default 0,
- parentid int NOT NULL default 0,
- description varchar(255) NULL,
- field1 text NULL,
- field2 text NULL,
- field3 text NULL,
- field4 text NULL,
- field5 text NULL,
- creation_date int8 NULL,
- PRIMARY KEY (id)
-);
-
-create index parentid on tbl (parentid);
-create index description on tbl (description);
-create index creation_date on tbl (creation_date);
-
-insert into tbl (id, parentid, description, field1, field2, field3, field4, field5, creation_date) values
- (1, 0, 'root', 'empty fields', '', '', '', '', 20010605110724 );
-insert into tbl (id, parentid, description, field1, field2, field3, field4, field5, creation_date) values
- (10, 1, 'abc', 'field2 contains single quote', 'x''x', '', '', '', 20010605110724);
-insert into tbl (id, parentid, description, field1, field2, field3, field4, field5, creation_date) values
- (20, 1, 'cba', 'field2 contains double quote', 'x"x', '', '', '', 20010605110724);
-insert into tbl (id, parentid, description, field1, field2, field3, field4, field5, creation_date) values
- (30, 1, 'bac', 'field2 contains >4k text', 'asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu 8uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5kuiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl', '', '', '', 20010605110724);
-insert into tbl (id, parentid, description, field1, field2, field3, field4, field5, creation_date) values
- (40, 1, '100', 'field2 contains >64k text', 'asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu 8uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5kuiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu 8uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5kuiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu 8uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5kuiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu 8uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5kuiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu 8uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5kuiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu 8uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5kuiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu 8uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5kuiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu 8uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5kuiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu 8uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5kuiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu 8uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5kuiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu 8uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5kuiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu 8uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5kuiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu 8uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5kuiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu 8uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5kuiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu 8uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5kuiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu 8uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5kuiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl', '', '', '', 20010605110724);
-insert into tbl (id, parentid, description, field1, field2, field3, field4, field5, creation_date) values
- (50, 1, '20', 'empty fields', '', '', '', '', 20010605110724);
-insert into tbl (id, parentid, description, field1, field2, field3, field4, field5, creation_date) values
- (60, 1, '20', 'empty fields', '', '', '', '', 20010605110724);
-
-create user dbx_testuser with password 'dbx_testpassword';
-grant SELECT,INSERT,UPDATE,DELETE on tbl to dbx_testuser;
diff --git a/ext/dbx/tests/dbx_test.script b/ext/dbx/tests/dbx_test.script
deleted file mode 100644
index 1bad104fba..0000000000
--- a/ext/dbx/tests/dbx_test.script
+++ /dev/null
@@ -1,38 +0,0 @@
-
-create database if not exists dbx_test;
-use dbx_test;
-
-grant SELECT,INSERT,UPDATE,DELETE on dbx_test.* to dbx_testuser@localhost identified by 'dbx_testpassword';
-
-# info tables
-
-drop table if exists tbl;
-create table tbl (
- id int(10) NOT NULL default 0,
- parentid int(10) NOT NULL default 0,
- description varchar(255) NULL,
- field1 mediumtext NULL,
- field2 mediumtext NULL,
- field3 mediumtext NULL,
- field4 mediumtext NULL,
- field5 mediumtext NULL,
- creation_date timestamp NULL,
- PRIMARY KEY (id),
- KEY parentid (parentid),
- KEY description (description),
- KEY creation_date (creation_date)
- );
-
-insert into tbl (id, parentid, description, field1, field2, field3, field4, field5, creation_date) values
- (1, 0, 'root', 'empty fields', '', '', '', '', 20010605110724),
- (10, 1, 'abc', 'field2 contains single quote', 'x''x', '', '', '', 20010605110724),
- (20, 1, 'cba', 'field2 contains double quote', 'x"x', '', '', '', 20010605110724),
- (30, 1, 'bac', 'field2 contains >4k text',
- 'asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu 8uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5kuiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl',
- '', '', '', 20010605110724),
- (40, 1, '100', 'field2 contains >64k text',
- 'asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu 8uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5kuiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu 8uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5kuiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu 8uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5kuiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu 8uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5kuiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu 8uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5kuiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu 8uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5kuiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu 8uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5kuiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu 8uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5kuiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu 8uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5kuiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu 8uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5kuiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu 8uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5kuiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu 8uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5kuiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu 8uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5kuiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu 8uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5kuiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu 8uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5kuiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl mnv m,xztsie5i4wj5k34ntmnial4jl234k kjtk34j5hfu 8uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5kuiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl uiod5w4 vkjlkarj ql32j5k4j3kj vkjkf jaktjk43j5k asjdhjsaeqw WJK213128Y2`Y12H WJHREJH4HWQEJHJHJSHFDWA4NBNs fjsdhr3wrbsndfbndsfbndsrbjwehrjkeh rfjdhfjdshfgnbgs aljdshgjfdsa jsdhfjdhgjs sdhfjsd kjejshrjewhrjewhrj hrj hjrhjfh jdhfjhsfjhgjjdrhehrj4whe jrhjhrjwe jhwr jhr jhejcrhwejrh 3kjwq4324ri f,mcvmn3qn m,wnrmwnf mn mndrweihr nfmgnrjkrakrfah fja kjfkdsjkrj43wkjrk34rf kncvnmn jew5 r4rjkwej4k23j kjrkewj lk34j 4kjkljklaje kj4kj5k43jklakrjklej4kj k4j5k4wjksckk4jkl43j5k 4j5kfcsc ksd rk43wj 5kjk ejrkjkwjrk32j4 kjkj4kj4rkje kjewk jk45j432k5j wkjrk23j4k k324j598dfkl',
- '', '', '', 20010605110724),
- (50, 1, '20', 'empty fields', '', '', '', '', 20010605110724),
- (60, 1, '20', 'empty fields', '', '', '', '', 20010605110724)
- ; \ No newline at end of file
diff --git a/ext/domxml/CREDITS b/ext/domxml/CREDITS
deleted file mode 100644
index 368d09d4a5..0000000000
--- a/ext/domxml/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-domxml
-Uwe Steinmann
diff --git a/ext/domxml/EXPERIMENTAL b/ext/domxml/EXPERIMENTAL
deleted file mode 100644
index 6443e99646..0000000000
--- a/ext/domxml/EXPERIMENTAL
+++ /dev/null
@@ -1,5 +0,0 @@
-this extension is experimental,
-its functions may change their names
-or move to extension all together
-so do not rely to much on them
-you have been warned!
diff --git a/ext/domxml/Makefile.in b/ext/domxml/Makefile.in
deleted file mode 100644
index 3b4b4c44a2..0000000000
--- a/ext/domxml/Makefile.in
+++ /dev/null
@@ -1,8 +0,0 @@
-# $Id$
-
-LTLIBRARY_NAME = libdomxml.la
-LTLIBRARY_SOURCES = php_domxml.c
-LTLIBRARY_SHARED_NAME = domxml.la
-LTLIBRARY_SHARED_LIBADD = $(DOMXML_SHARED_LIBADD)
-
-include $(top_srcdir)/build/dynlib.mk
diff --git a/ext/domxml/config.m4 b/ext/domxml/config.m4
deleted file mode 100644
index ad94373c9c..0000000000
--- a/ext/domxml/config.m4
+++ /dev/null
@@ -1,66 +0,0 @@
-dnl $Id$
-dnl config.m4 for extension domxml
-
-AC_DEFUN(PHP_DOM_CHECK_VERSION,[
- old_CPPFLAGS=$CPPFLAGS
- CPPFLAGS=-I$DOMXML_DIR/include
- AC_MSG_CHECKING(for libxml version)
- AC_EGREP_CPP(yes,[
- #include <libxml/xmlversion.h>
- #if LIBXML_VERSION >= 20207
- yes
- #endif
- ],[
- AC_MSG_RESULT(>= 2.2.7)
- ],[
- AC_MSG_ERROR(libxml version 2.2.7 or greater required.)
- ])
- CPPFLAGS=$old_CPPFLAGS
-])
-
-PHP_ARG_WITH(dom, for DOM support,
-[ --with-dom[=DIR] Include DOM support (requires libxml >= 2.2.7).
- DIR is the libxml install directory,
- defaults to /usr.])
-
-if test "$PHP_DOM" != "no"; then
-
- if test -r $PHP_DOM/include/libxml/tree.h; then
- DOMXML_DIR=$PHP_DOM
- else
- AC_MSG_CHECKING(for DOM in default path)
- for i in /usr/local /usr; do
- if test -r $i/include/libxml/tree.h; then
- DOMXML_DIR=$i
- AC_MSG_RESULT(found in $i)
- fi
- done
- fi
-
- if test -z "$DOMXML_DIR"; then
- AC_MSG_RESULT(not found)
- AC_MSG_ERROR(Please reinstall the libxml >= 2.2.7 distribution)
- fi
-
- PHP_DOM_CHECK_VERSION
-
- PHP_ADD_INCLUDE($DOMXML_DIR/include)
-
- if test -f $DOMXML_DIR/lib/libxml2.a -o -f $DOMXML_DIR/lib/libxml2.s? ; then
- DOM_LIBNAME=xml2
- else
- DOM_LIBNAME=xml
- fi
-
- PHP_SUBST(DOMXML_SHARED_LIBADD)
- PHP_ADD_LIBRARY_WITH_PATH($DOM_LIBNAME, $DOMXML_DIR/lib, DOMXML_SHARED_LIBADD)
-
- if test "$PHP_ZLIB_DIR" = "no"; then
- AC_MSG_ERROR(DOMXML requires ZLIB. Use --with-zlib-dir=<DIR>)
- fi
-
- PHP_ADD_LIBRARY_WITH_PATH(z, $PHP_ZLIB_DIR/lib, DOMXML_SHARED_LIBADD)
-
- AC_DEFINE(HAVE_DOMXML,1,[ ])
- PHP_EXTENSION(domxml, $ext_shared)
-fi
diff --git a/ext/domxml/domxml.dsp b/ext/domxml/domxml.dsp
deleted file mode 100644
index 40768294e9..0000000000
--- a/ext/domxml/domxml.dsp
+++ /dev/null
@@ -1,114 +0,0 @@
-# Microsoft Developer Studio Project File - Name="domxml" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=domxml - Win32 Release_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "domxml.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "domxml.mak" CFG="domxml - Win32 Release_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "domxml - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "domxml - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "domxml - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\..\Zend" /I "..\..\..\TSRM" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_DOMXML" /D ZTS=1 /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\main" /D "WIN32" /D "DOMXML_EXPORTS" /D "COMPILE_DL_DOMXML" /D ZTS=1 /D HAVE_DOMXML=1 /D ZEND_DEBUG=0 /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZEND_WIN32" /D "PHP_WIN32" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x406 /d "NDEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib /nologo /dll /machine:I386
-# ADD LINK32 libxml2.lib wsock32.lib php4ts.lib resolv.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_domxml.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
-# SUBTRACT LINK32 /pdb:none
-
-!ELSEIF "$(CFG)" == "domxml - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "mssql-70" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_DOMXML" /D ZTS=1 /YX /FD /c
-# ADD CPP /nologo /MDd /W3 /GX /ZI /Od /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\main" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "DOMXML_EXPORTS" /D "COMPILE_DL_DOMXML" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_DOMXML=1 /FR /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x406 /d "NDEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib /nologo /dll /machine:I386
-# ADD LINK32 libxml2.lib php4ts_debug.lib resolv.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /incremental:yes /debug /machine:I386 /out:"..\..\Debug_TS/php_domxml.dll" /libpath:"..\..\Debug_TS"
-
-!ENDIF
-
-# Begin Target
-
-# Name "domxml - Win32 Release_TS"
-# Name "domxml - Win32 Debug_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\php_domxml.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_domxml.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/ext/domxml/php_domxml.c b/ext/domxml/php_domxml.c
deleted file mode 100644
index 51d0caebaa..0000000000
--- a/ext/domxml/php_domxml.c
+++ /dev/null
@@ -1,2583 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Uwe Steinmann <steinm@php.net> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "php_domxml.h"
-
-#if HAVE_DOMXML
-#include "ext/standard/info.h"
-#define PHP_XPATH 1
-#define PHP_XPTR 2
-
-static int le_domxmldocp;
-static int le_domxmldoctypep;
-static int le_domxmldtdp;
-static int le_domxmlnodep;
-static int le_domxmlelementp;
-static int le_domxmlattrp;
-static int le_domxmlcdatap;
-static int le_domxmltextp;
-static int le_domxmlpip;
-static int le_domxmlcommentp;
-static int le_domxmlnotationp;
-/*static int le_domxmlentityp;*/
-static int le_domxmlentityrefp;
-/*static int le_domxmlnsp;*/
-
-#if defined(LIBXML_XPATH_ENABLED)
-static int le_xpathctxp;
-static int le_xpathobjectp;
-#endif
-
-zend_class_entry *domxmldoc_class_entry;
-zend_class_entry *domxmldoctype_class_entry;
-zend_class_entry *domxmlelement_class_entry;
-zend_class_entry *domxmldtd_class_entry;
-zend_class_entry *domxmlnode_class_entry;
-zend_class_entry *domxmlattr_class_entry;
-zend_class_entry *domxmlcdata_class_entry;
-zend_class_entry *domxmltext_class_entry;
-zend_class_entry *domxmlpi_class_entry;
-zend_class_entry *domxmlcomment_class_entry;
-zend_class_entry *domxmlnotation_class_entry;
-zend_class_entry *domxmlentity_class_entry;
-zend_class_entry *domxmlentityref_class_entry;
-zend_class_entry *domxmlns_class_entry;
-#if defined(LIBXML_XPATH_ENABLED)
-zend_class_entry *xpathctx_class_entry;
-zend_class_entry *xpathobject_class_entry;
-#endif
-
-
-static int node_attributes(zval **attributes, xmlNode *nodep);
-static int node_children(zval **children, xmlNode *nodep);
-
-static zend_function_entry domxml_functions[] = {
- PHP_FE(domxml_version, NULL)
- PHP_FE(xmldoc, NULL)
- PHP_FE(xmldocfile, NULL)
- PHP_FE(xmltree, NULL)
- PHP_FALIAS(domxml_root, domxml_doc_document_element, NULL)
- PHP_FE(domxml_add_root, NULL)
- PHP_FE(domxml_dumpmem, NULL)
- PHP_FE(domxml_node_attributes, NULL)
- PHP_FALIAS(domxml_attributes, domxml_node_attributes, NULL)
- PHP_FE(domxml_elem_get_attribute, NULL)
- PHP_FALIAS(domxml_get_attribute, domxml_elem_get_attribute, NULL)
- PHP_FALIAS(domxml_getattr, domxml_elem_get_attribute, NULL)
- PHP_FE(domxml_elem_set_attribute, NULL)
- PHP_FALIAS(domxml_set_attribute, domxml_elem_set_attribute, NULL)
- PHP_FALIAS(domxml_setattr, domxml_elem_set_attribute, NULL)
- PHP_FE(domxml_node_children, NULL)
- PHP_FALIAS(domxml_children, domxml_node_children, NULL)
- PHP_FE(domxml_node_new_child, NULL)
- PHP_FALIAS(domxml_new_child, domxml_node_new_child, NULL)
- PHP_FE(domxml_node, NULL)
- PHP_FE(domxml_node_unlink_node, NULL)
- PHP_FALIAS(domxml_unlink_node, domxml_node_unlink_node, NULL)
- PHP_FE(domxml_node_set_content, NULL)
- PHP_FALIAS(set_content, domxml_node_set_content, NULL)
- PHP_FE(domxml_new_xmldoc, NULL)
- PHP_FALIAS(new_xmldoc, domxml_new_xmldoc, NULL)
-#if defined(LIBXML_XPATH_ENABLED)
-/* PHP_FE(xpath_new_context, NULL)
- PHP_FE(xpath_eval, NULL)
- PHP_FE(xpath_eval_expression, NULL) */
-#endif
-#if defined(LIBXML_XPTR_ENABLED)
-/* PHP_FE(xptr_new_context, NULL)
- PHP_FE(xptr_eval, NULL) */
-#endif
- {NULL, NULL, NULL}
-};
-
-
-static function_entry php_domxmldoc_class_functions[] = {
-/* PHP_FALIAS(domdocument, xmldoc, NULL) */
- {"domdocument", PHP_FN(xmldoc), NULL},
- PHP_FALIAS(doctype, domxml_doc_doctype, NULL)
- PHP_FALIAS(implementation, domxml_doc_implementation, NULL)
- PHP_FALIAS(root, domxml_doc_document_element, NULL) /* not DOM */
- PHP_FALIAS(document_element, domxml_doc_document_element, NULL)
- PHP_FALIAS(documentelement, domxml_doc_document_element, NULL)
- PHP_FALIAS(createelement, domxml_doc_create_element, NULL)
- PHP_FALIAS(create_element, domxml_doc_create_element, NULL)
- PHP_FALIAS(createtextnode, domxml_doc_create_text_node, NULL)
- PHP_FALIAS(create_text_node, domxml_doc_create_text_node, NULL)
- PHP_FALIAS(createcomment, domxml_doc_create_comment, NULL)
- PHP_FALIAS(create_comment, domxml_doc_create_comment, NULL)
- PHP_FALIAS(createattribute, domxml_doc_create_attribute, NULL)
- PHP_FALIAS(create_attribute, domxml_doc_create_attribute, NULL)
- PHP_FALIAS(createprocessinginstruction, domxml_doc_create_processing_instruction, NULL)
- PHP_FALIAS(create_processing_instruction, domxml_doc_create_processing_instruction, NULL)
- PHP_FALIAS(children, domxml_node_children, NULL)
- PHP_FALIAS(add_root, domxml_add_root, NULL)
- PHP_FALIAS(importednode, domxml_doc_imported_node, NULL)
- PHP_FALIAS(imported_node, domxml_doc_imported_node, NULL)
- PHP_FALIAS(dtd, domxml_intdtd, NULL)
- PHP_FALIAS(dumpmem, domxml_dumpmem, NULL)
-/* PHP_FALIAS(createcdatasection, domxml_create_cdata_section, NULL)
- PHP_FALIAS(create_cdata_section, domxml_create_cdata_section, NULL)
-*/
-#if defined(LIBXML_XPATH_ENABLED)
- PHP_FALIAS(xpath_init, xpath_init, NULL)
- PHP_FALIAS(xpath_new_context, xpath_new_context, NULL)
- PHP_FALIAS(xptr_new_context, xptr_new_context, NULL)
-#endif
- {NULL, NULL, NULL}
-};
-
-static function_entry php_domxmldoctype_class_functions[] = {
- PHP_FALIAS(name, domxml_doctype_name, NULL)
-/* PHP_FALIAS(entities, domxml_doctype_entities, NULL)
- PHP_FALIAS(notations, domxml_doctype_notations, NULL)
- PHP_FALIAS(systemid, domxml_doctype_system_id, NULL)
- PHP_FALIAS(system_id, domxml_doctype_system_id, NULL)
- PHP_FALIAS(publicid, domxml_doctype_public_id, NULL)
- PHP_FALIAS(public_id, domxml_doctype_public_id, NULL)
- PHP_FALIAS(internalsubset, domxml_doctype_internal_subset, NULL)
- PHP_FALIAS(internal_subset, domxml_doctype_internal_subset, NULL)
-*/ {NULL, NULL, NULL}
-};
-
-static zend_function_entry php_domxmldtd_class_functions[] = {
- {NULL, NULL, NULL}
-};
-
-static zend_function_entry php_domxmlnode_class_functions[] = {
- PHP_FALIAS(domnode, domxml_node, NULL)
- PHP_FALIAS(firstchild, domxml_node_first_child, NULL)
- PHP_FALIAS(first_child, domxml_node_first_child, NULL)
- PHP_FALIAS(lastchild, domxml_node_last_child, NULL)
- PHP_FALIAS(last_child, domxml_node_last_child, NULL)
- PHP_FALIAS(add_child, domxml_node_add_child, NULL)
- PHP_FALIAS(children, domxml_node_children, NULL)
- PHP_FALIAS(childnodes, domxml_node_children, NULL)
- PHP_FALIAS(child_nodes, domxml_node_children, NULL)
- PHP_FALIAS(previoussibling, domxml_node_previous_sibling, NULL)
- PHP_FALIAS(previous_sibling, domxml_node_previous_sibling, NULL)
- PHP_FALIAS(nextsibling, domxml_node_next_sibling, NULL)
- PHP_FALIAS(next_sibling, domxml_node_next_sibling, NULL)
- PHP_FALIAS(has_child_nodes, domxml_node_has_child_nodes, NULL)
- PHP_FALIAS(haschildnodes, domxml_node_has_child_nodes, NULL)
- PHP_FALIAS(prefix, domxml_node_prefix, NULL)
- PHP_FALIAS(parent, domxml_node_parent, NULL)
- PHP_FALIAS(parentnode, domxml_node_parent, NULL)
- PHP_FALIAS(parent_node, domxml_node_parent, NULL)
- PHP_FALIAS(insert_before, domxml_node_insert_before, NULL)
- PHP_FALIAS(insertbefore, domxml_node_insert_before, NULL)
- PHP_FALIAS(append_child, domxml_node_append_child, NULL)
- PHP_FALIAS(appendchild, domxml_node_append_child, NULL)
- PHP_FALIAS(ownerdocument, domxml_node_owner_document, NULL)
- PHP_FALIAS(owner_document, domxml_node_owner_document, NULL)
- PHP_FALIAS(new_child, domxml_node_new_child, NULL)
- PHP_FALIAS(attributes, domxml_node_attributes, NULL)
- PHP_FALIAS(node, domxml_node, NULL)
- PHP_FALIAS(unlink, domxml_node_unlink_node, NULL)
- PHP_FALIAS(set_content, domxml_node_set_content, NULL)
- PHP_FALIAS(text_concat, domxml_node_text_concat, NULL)
- PHP_FALIAS(set_name, domxml_node_set_name, NULL)
- PHP_FALIAS(node_name, domxml_node_name, NULL)
- PHP_FALIAS(nodename, domxml_node_name, NULL)
- PHP_FALIAS(node_value, domxml_node_value, NULL)
- PHP_FALIAS(nodevalue, domxml_node_value, NULL)
- {NULL, NULL, NULL}
-};
-
-static zend_function_entry php_domxmlelement_class_functions[] = {
- PHP_FALIAS(domelement, domxml_element, NULL)
- PHP_FALIAS(tagname, domxml_elem_tagname, NULL)
- PHP_FALIAS(getattribute, domxml_elem_get_attribute, NULL)
- PHP_FALIAS(get_attribute, domxml_elem_get_attribute, NULL)
- PHP_FALIAS(setattribute, domxml_elem_set_attribute, NULL)
- PHP_FALIAS(set_attribute, domxml_elem_set_attribute, NULL)
- PHP_FALIAS(removeattribute, domxml_elem_remove_attribute, NULL)
- PHP_FALIAS(remove_attribute, domxml_elem_remove_attribute, NULL)
- PHP_FALIAS(getattributenode, domxml_elem_get_attribute_node, NULL)
- PHP_FALIAS(get_attributenode, domxml_elem_get_attribute_node, NULL)
- PHP_FALIAS(setattributenode, domxml_elem_set_attribute_node, NULL)
- PHP_FALIAS(set_attributenode, domxml_elem_set_attribute_node, NULL)
- PHP_FALIAS(getelementbytagname, domxml_elem_get_element_by_tagname, NULL)
- PHP_FALIAS(get_element_by_tagname, domxml_elem_get_element_by_tagname, NULL)
- {NULL, NULL, NULL}
-};
-
-static zend_function_entry php_domxmlcdata_class_functions[] = {
- PHP_FALIAS(length, domxml_cdata_length, NULL)
- {NULL, NULL, NULL}
-};
-
-static zend_function_entry php_domxmltext_class_functions[] = {
- {NULL, NULL, NULL}
-};
-
-static zend_function_entry php_domxmlcomment_class_functions[] = {
- {NULL, NULL, NULL}
-};
-
-static zend_function_entry php_domxmlnotation_class_functions[] = {
- PHP_FALIAS(publicid, domxml_notation_public_id, NULL)
- PHP_FALIAS(public_id, domxml_notation_public_id, NULL)
- PHP_FALIAS(systemid, domxml_notation_system_id, NULL)
- PHP_FALIAS(system_id, domxml_notation_system_id, NULL)
- {NULL, NULL, NULL}
-};
-
-static zend_function_entry php_domxmlentityref_class_functions[] = {
- {NULL, NULL, NULL}
-};
-
-static zend_function_entry php_domxmlentity_class_functions[] = {
-/* PHP_FALIAS(publicid, domxml_entity_public_id, NULL)
- PHP_FALIAS(public_id, domxml_entity_public_id, NULL)
- PHP_FALIAS(systemid, domxml_entity_system_id, NULL)
- PHP_FALIAS(system_id, domxml_entity_system_id, NULL)
- PHP_FALIAS(notationname, domxml_entity_notation_name, NULL)
- PHP_FALIAS(notation_name, domxml_entity_notation_name, NULL)
-*/ {NULL, NULL, NULL}
-};
-
-static zend_function_entry php_domxmlpi_class_functions[] = {
- PHP_FALIAS(target, domxml_pi_target, NULL)
- PHP_FALIAS(data, domxml_pi_data, NULL)
- {NULL, NULL, NULL}
-};
-
-#if defined(LIBXML_XPATH_ENABLED)
-static zend_function_entry php_xpathctx_class_functions[] = {
- PHP_FALIAS(xpath_eval, xpath_eval, NULL)
- PHP_FALIAS(xpath_eval_expression, xpath_eval_expression, NULL)
- {NULL, NULL, NULL}
-};
-
-static zend_function_entry php_xpathobject_class_functions[] = {
- {NULL, NULL, NULL}
-};
-#endif
-
-static zend_function_entry php_domxmlattr_class_functions[] = {
- PHP_FALIAS(name, domxml_attr_name, NULL)
- PHP_FALIAS(value, domxml_attr_value, NULL)
- PHP_FALIAS(specified, domxml_attr_specified, NULL)
-/* PHP_FALIAS(ownerelement, domxml_attr_owner_element, NULL)
- PHP_FALIAS(owner_element, domxml_attr_owner_element, NULL)
-*/ {NULL, NULL, NULL}
-};
-
-static zend_function_entry php_domxmlns_class_functions[] = {
- {NULL, NULL, NULL}
-};
-
-zend_module_entry domxml_module_entry = {
- "domxml", domxml_functions, PHP_MINIT(domxml), NULL, PHP_RINIT(domxml), NULL, PHP_MINFO(domxml), STANDARD_MODULE_PROPERTIES
-};
-
-#ifdef COMPILE_DL_DOMXML
-ZEND_GET_MODULE(domxml)
-#endif
-
-static void dom_object_set_data(void *obj, zval *wrapper) {
- /*
- char tmp[20];
- sprintf(tmp, "%08X", obj);
- fprintf(stderr, "Adding %s to hash\n", tmp);
- */
- ((xmlNodePtr) obj)->_private = wrapper;
-}
-
-static zval *dom_object_get_data(void *obj) {
- /* char tmp[20];
- sprintf(tmp, "%08X", obj);
- fprintf(stderr, "Trying getting %s from object ...", tmp);
- if(((xmlNodePtr) obj)->_private)
- fprintf(stderr," found\n");
- else
- fprintf(stderr," not found\n"); */
- return((zval *) (((xmlNodePtr) obj)->_private));
-}
-
-static inline void node_wrapper_dtor(xmlNodePtr node)
-{
- zval *wrapper;
-
- if (!node || node->type == XML_DTD_NODE)
- return;
-
- wrapper = dom_object_get_data(node);
- if (wrapper)
- zval_ptr_dtor(&wrapper);
-}
-
-static inline void attr_list_wrapper_dtor(xmlAttrPtr attr)
-{
- while (attr != NULL) {
- node_wrapper_dtor((xmlNodePtr) attr);
- attr = attr->next;
- }
-}
-
-static inline void node_list_wrapper_dtor(xmlNodePtr node)
-{
- while (node != NULL) {
- node_list_wrapper_dtor(node->children);
- attr_list_wrapper_dtor(node->properties);
- node_wrapper_dtor(node);
- node = node->next;
- }
-}
-
-static void php_free_xml_doc(zend_rsrc_list_entry *rsrc)
-{
- xmlDoc *doc = (xmlDoc *)rsrc->ptr;
-
- if (doc) {
- node_list_wrapper_dtor(doc->children);
-
- node_wrapper_dtor((xmlNodePtr) doc);
- xmlFreeDoc(doc);
- }
-}
-
-static void php_free_xml_node(zend_rsrc_list_entry *rsrc) {
- xmlNodePtr node = (xmlNodePtr) rsrc->ptr;
-
- if (node) {
- zval *wrapper = dom_object_get_data(node);
- if (wrapper)
- zval_ptr_dtor(&wrapper);
- }
-}
-
-#if defined(LIBXML_XPATH_ENABLED)
-static void php_free_xpath_context(zend_rsrc_list_entry *rsrc)
-{
- xmlXPathContextPtr ctx = (xmlXPathContextPtr)rsrc->ptr;
- if(ctx)
- xmlXPathFreeContext(ctx);
-}
-
-static void php_free_xpath_object(zend_rsrc_list_entry *rsrc)
-{
- xmlXPathObjectPtr obj = (xmlXPathObjectPtr)rsrc->ptr;
- if(obj)
- xmlXPathFreeObject(obj);
-}
-#endif
-
-void *php_xpath_get_object(zval *wrapper, int rsrc_type1, int rsrc_type2)
-{
- void *obj;
- zval **handle;
- int type;
-
- if (Z_TYPE_P(wrapper) != IS_OBJECT) {
- php_error(E_ERROR, "Wrapper is not an object");
- }
- if (zend_hash_index_find(Z_OBJPROP_P(wrapper), 0, (void **)&handle) == FAILURE) {
- php_error(E_ERROR, "Underlying object missing");
- }
- obj = zend_list_find(Z_LVAL_PP(handle), &type);
- if (!obj || ((type != rsrc_type1) && (type != rsrc_type2))) {
- php_error(E_ERROR, "Underlying object missing or of invalid type");
- }
-
- return obj;
-}
-
-static void xpath_object_set_data(void *obj, zval *wrapper) {
-/* char tmp[20];
- sprintf(tmp, "%08X", obj);
- fprintf(stderr, "Adding %s to hash\n", tmp); */
- ((xmlXPathObjectPtr) obj)->user = wrapper;
-}
-
-static zval *xpath_object_get_data(void *obj) {
-/* char tmp[20];
- sprintf(tmp, "%08X", obj);
- fprintf(stderr, "Trying getting %s from hash ...", tmp);
- if(((xmlXPathObjectPtr) obj)->user)
- fprintf(stderr," found\n");
- else
- fprintf(stderr," not found\n"); */
- return((zval *) (((xmlXPathObjectPtr) obj)->user));
-}
-
-static void php_xpath_set_object(zval *wrapper, void *obj, int rsrc_type) {
- zval *handle, *addr;
-
- MAKE_STD_ZVAL(handle);
- Z_TYPE_P(handle) = IS_LONG;
- Z_LVAL_P(handle) = zend_list_insert(obj, rsrc_type);
- MAKE_STD_ZVAL(addr);
- Z_TYPE_P(addr) = IS_LONG;
- Z_LVAL_P(addr) = (int) obj;
- zend_hash_index_update(Z_OBJPROP_P(wrapper), 0, &handle, sizeof(zval *), NULL);
- zend_hash_index_update(Z_OBJPROP_P(wrapper), 1, &addr, sizeof(zval *), NULL);
- zval_add_ref(&wrapper);
- xpath_object_set_data(obj, wrapper);
-}
-
-static zval *php_xpathobject_new(xmlXPathObjectPtr obj, int *found) {
- zval *wrapper;
- int rsrc_type;
-
- *found = 0;
- if (!obj) {
- MAKE_STD_ZVAL(wrapper);
- ZVAL_NULL(wrapper);
- return wrapper;
- }
-
- if ((wrapper = (zval *)xpath_object_get_data((void *)obj))) {
- zval_add_ref(&wrapper);
- *found = 1;
- return wrapper;
- }
-
- MAKE_STD_ZVAL(wrapper);
-/* fprintf(stderr, "Adding new XPath Object\n"); */
- object_init_ex(wrapper, xpathobject_class_entry);
- rsrc_type = le_xpathobjectp;
- php_xpath_set_object(wrapper, (void *) obj, rsrc_type);
-
- return(wrapper);
-}
-
-void *php_xpath_get_context(zval *wrapper, int rsrc_type1, int rsrc_type2)
-{
- void *obj;
- zval **handle;
- int type;
-
- if (Z_TYPE_P(wrapper) != IS_OBJECT) {
- php_error(E_ERROR, "Wrapper is not an object");
- }
- if (zend_hash_index_find(Z_OBJPROP_P(wrapper), 0, (void **)&handle) == FAILURE) {
- php_error(E_ERROR, "Underlying object missing");
- }
- obj = zend_list_find(Z_LVAL_PP(handle), &type);
- if (!obj || ((type != rsrc_type1) && (type != rsrc_type2))) {
- php_error(E_ERROR, "Underlying object missing or of invalid type");
- }
-
- return obj;
-}
-
-static void xpath_context_set_data(void *obj, zval *wrapper) {
-/* char tmp[20];
- sprintf(tmp, "%08X", obj);
- fprintf(stderr, "Adding %s to hash\n", tmp); */
- ((xmlXPathContextPtr) obj)->user = (void *) wrapper;
-}
-
-static zval *xpath_context_get_data(void *obj) {
-/* char tmp[20];
- sprintf(tmp, "%08X", obj);
- fprintf(stderr, "Trying getting %s from hash ...", tmp);
- if(((xmlXPathContextPtr) obj)->user)
- fprintf(stderr," found\n");
- else
- fprintf(stderr," not found\n"); */
- return((zval *) (((xmlXPathContextPtr) obj)->user));
-}
-
-static void php_xpath_set_context(zval *wrapper, void *obj, int rsrc_type) {
- zval *handle, *addr;
-
- MAKE_STD_ZVAL(handle);
- Z_TYPE_P(handle) = IS_LONG;
- Z_LVAL_P(handle) = zend_list_insert(obj, rsrc_type);
- MAKE_STD_ZVAL(addr);
- Z_TYPE_P(addr) = IS_LONG;
- Z_LVAL_P(addr) = (int) obj;
- zend_hash_index_update(Z_OBJPROP_P(wrapper), 0, &handle, sizeof(zval *), NULL);
- zend_hash_index_update(Z_OBJPROP_P(wrapper), 1, &addr, sizeof(zval *), NULL);
- zval_add_ref(&wrapper);
- xpath_context_set_data(obj, wrapper);
-}
-
-static zval *php_xpathcontext_new(xmlXPathContextPtr obj, int *found) {
- zval *wrapper;
- int rsrc_type;
-
- *found = 0;
- if (!obj) {
- MAKE_STD_ZVAL(wrapper);
- ZVAL_NULL(wrapper);
- return wrapper;
- }
-
- if ((wrapper = (zval *)xpath_context_get_data((void *)obj))) {
- zval_add_ref(&wrapper);
- *found = 1;
- return wrapper;
- }
-
- MAKE_STD_ZVAL(wrapper);
-/* fprintf(stderr, "Adding new XPath Context\n"); */
- object_init_ex(wrapper, xpathctx_class_entry);
- rsrc_type = le_xpathctxp;
- php_xpath_set_context(wrapper, (void *) obj, rsrc_type);
-
- return(wrapper);
-}
-
-void *php_dom_get_object(zval *wrapper, int rsrc_type1, int rsrc_type2)
-{
- void *obj;
- zval **handle;
- int type;
-
- if (Z_TYPE_P(wrapper) != IS_OBJECT) {
- php_error(E_ERROR, "Wrapper is not an object");
- }
- if (zend_hash_index_find(Z_OBJPROP_P(wrapper), 0, (void **)&handle) == FAILURE) {
- php_error(E_ERROR, "Underlying object missing");
- }
- obj = zend_list_find(Z_LVAL_PP(handle), &type);
-/* The following test should be replaced with search in all parents */
- if (!obj) { /* || ((type != rsrc_type1) && (type != rsrc_type2))) { */
- php_error(E_ERROR, "Underlying object missing or of invalid type");
- }
-
- return obj;
-}
-
-static void php_dom_set_object(zval *wrapper, void *obj, int rsrc_type) {
- zval *handle, *addr;
-
- MAKE_STD_ZVAL(handle);
- Z_TYPE_P(handle) = IS_LONG;
- Z_LVAL_P(handle) = zend_list_insert(obj, rsrc_type);
- MAKE_STD_ZVAL(addr);
- Z_TYPE_P(addr) = IS_LONG;
- Z_LVAL_P(addr) = (int) obj;
- zend_hash_index_update(Z_OBJPROP_P(wrapper), 0, &handle, sizeof(zval *), NULL);
- zend_hash_index_update(Z_OBJPROP_P(wrapper), 1, &addr, sizeof(zval *), NULL);
- zval_add_ref(&wrapper);
- dom_object_set_data(obj, wrapper);
-}
-
-static zval *php_domobject_new(xmlNodePtr obj, int *found) {
- zval *wrapper;
- char *content;
- int rsrc_type;
-
- *found = 0;
- if (!obj) {
- MAKE_STD_ZVAL(wrapper);
- ZVAL_NULL(wrapper);
- return wrapper;
- }
-
- if ((wrapper = (zval *)dom_object_get_data((void *)obj))) {
- zval_add_ref(&wrapper);
- *found = 1;
- return wrapper;
- }
-
- MAKE_STD_ZVAL(wrapper);
-/* fprintf(stderr, "Adding new Node of type: %d\n", obj->type); */
- switch(obj->type) {
- case XML_ELEMENT_NODE: {
- xmlNodePtr nodep = obj;
- object_init_ex(wrapper, domxmlelement_class_entry);
- rsrc_type = le_domxmlelementp;
- add_property_long(wrapper, "type", nodep->type);
- add_property_stringl(wrapper, "tagname", (char *) nodep->name, strlen(nodep->name), 1);
- break;
- }
- case XML_TEXT_NODE: {
- xmlNodePtr nodep = obj;
- object_init_ex(wrapper, domxmltext_class_entry);
- rsrc_type = le_domxmltextp;
- content = xmlNodeGetContent(nodep);
- if(content)
- add_property_stringl(wrapper, "content", (char *) content, strlen(content), 1);
- break;
- }
- case XML_COMMENT_NODE: {
- xmlNodePtr nodep = obj;
- object_init_ex(wrapper, domxmlcomment_class_entry);
- rsrc_type = le_domxmlcommentp;
- content = xmlNodeGetContent(nodep);
- if(content)
- add_property_stringl(wrapper, "content", (char *) content, strlen(content), 1);
- break;
- }
- case XML_PI_NODE: {
- xmlNodePtr nodep = obj;
- object_init_ex(wrapper, domxmlpi_class_entry);
- rsrc_type = le_domxmlpip;
- content = xmlNodeGetContent(nodep);
- add_property_stringl(wrapper, "target", (char *) nodep->name, strlen(nodep->name), 1);
- if(content)
- add_property_stringl(wrapper, "data", (char *) content, strlen(content), 1);
- break;
- }
- case XML_ENTITY_REF_NODE: {
- xmlNodePtr nodep = obj;
- object_init_ex(wrapper, domxmlentityref_class_entry);
- rsrc_type = le_domxmlentityrefp;
- content = xmlNodeGetContent(nodep);
- add_property_stringl(wrapper, "name", (char *) nodep->name, strlen(nodep->name), 1);
- if(content)
- add_property_stringl(wrapper, "content", (char *) content, strlen(content), 1);
- break;
- }
- case XML_ENTITY_DECL:
- case XML_ELEMENT_DECL: {
- xmlNodePtr nodep = obj;
- object_init_ex(wrapper, domxmlnode_class_entry);
- rsrc_type = le_domxmlnodep;
- add_property_long(wrapper, "type", nodep->type);
- add_property_stringl(wrapper, "name", (char *) nodep->name, strlen(nodep->name), 1);
- if(obj->type == XML_ENTITY_REF_NODE) {
- content = xmlNodeGetContent(nodep);
- if(content)
- add_property_stringl(wrapper, "content", (char *) content, strlen(content), 1);
- }
- break;
- }
- case XML_ATTRIBUTE_NODE: {
- xmlAttrPtr attrp = (xmlAttrPtr) obj;
- object_init_ex(wrapper, domxmlattr_class_entry);
- rsrc_type = le_domxmlattrp;
- add_property_stringl(wrapper, "name", (char *) attrp->name, strlen(attrp->name), 1);
- content = xmlNodeGetContent((xmlNodePtr) attrp);
- if(content)
- add_property_stringl(wrapper, "value", (char *) content, strlen(content), 1);
- break;
- }
- case XML_DOCUMENT_NODE: {
- xmlDocPtr docp = (xmlDocPtr) obj;
- object_init_ex(wrapper, domxmldoc_class_entry);
- rsrc_type = le_domxmldocp;
- if(docp->name)
- add_property_stringl(wrapper, "name", (char *) docp->name, strlen(docp->name), 1);
- else
- add_property_stringl(wrapper, "name", "", 0, 1);
- if(docp->URL)
- add_property_stringl(wrapper, "url", (char *) docp->URL, strlen(docp->URL), 1);
- else
- add_property_stringl(wrapper, "url", "", 0, 1);
- add_property_stringl(wrapper, "version", (char *) docp->version, strlen(docp->version), 1);
- if(docp->encoding)
- add_property_stringl(wrapper, "encoding", (char *) docp->encoding, strlen(docp->encoding), 1);
- add_property_long(wrapper, "standalone", docp->standalone);
- add_property_long(wrapper, "type", docp->type);
- add_property_long(wrapper, "compression", docp->compression);
- add_property_long(wrapper, "charset", docp->charset);
- break;
- }
- case XML_DTD_NODE: {
- xmlDtdPtr dtd = (xmlDtdPtr) obj;
- object_init_ex(wrapper, domxmldtd_class_entry);
- rsrc_type = le_domxmldtdp;
- if(dtd->ExternalID)
- add_property_string(wrapper, "publicId", (char *) dtd->ExternalID, 1);
- if(dtd->SystemID)
- add_property_string(wrapper, "systemId", (char *) dtd->SystemID, 1);
- if(dtd->name)
- add_property_string(wrapper, "name", (char *) dtd->name, 1);
- break;
- }
- default:
- fprintf(stderr, "Unsupported Node type: %d\n", obj->type);
- return NULL;
- }
- php_dom_set_object(wrapper, (void *) obj, rsrc_type);
-
- return(wrapper);
-}
-
-PHP_RINIT_FUNCTION(domxml)
-{
- return SUCCESS;
-}
-
-PHP_MINIT_FUNCTION(domxml)
-{
- zend_class_entry ce;
- le_domxmldocp = zend_register_list_destructors_ex(php_free_xml_doc, NULL, "domdocument", module_number);
- /* Freeing the document contains freeing the complete tree.
- Therefore nodes, attributes etc. may not be freed seperately.
- */
- le_domxmlnodep = zend_register_list_destructors_ex(php_free_xml_node, NULL, "domnode", module_number);
- le_domxmlattrp = zend_register_list_destructors_ex(php_free_xml_node, NULL, "domattribute", module_number);
- le_domxmlelementp = zend_register_list_destructors_ex(php_free_xml_node, NULL, "domelement", module_number);
-#if defined(LIBXML_XPATH_ENABLED)
- le_xpathctxp = zend_register_list_destructors_ex(php_free_xpath_context, NULL, "xpathcontext", module_number);
- le_xpathobjectp = zend_register_list_destructors_ex(php_free_xpath_object, NULL, "xpathobject", module_number);
-#endif
-
-/* le_domxmlnsp = register_list_destructors(NULL, NULL); */
-
- INIT_OVERLOADED_CLASS_ENTRY(ce, "DomNode", php_domxmlnode_class_functions, NULL, NULL, NULL);
- domxmlnode_class_entry = zend_register_internal_class_ex(&ce, NULL, NULL);
-
- INIT_OVERLOADED_CLASS_ENTRY(ce, "DomDocument", php_domxmldoc_class_functions, NULL, NULL, NULL);
- domxmldoc_class_entry = zend_register_internal_class_ex(&ce, domxmlnode_class_entry, NULL);
-
- INIT_OVERLOADED_CLASS_ENTRY(ce, "DomDocumentType", php_domxmldoctype_class_functions, NULL, NULL, NULL);
- domxmldoctype_class_entry = zend_register_internal_class_ex(&ce, domxmlnode_class_entry, NULL);
-
- INIT_OVERLOADED_CLASS_ENTRY(ce, "Dtd", php_domxmldtd_class_functions, NULL, NULL, NULL);
- domxmldtd_class_entry = zend_register_internal_class_ex(&ce, domxmlnode_class_entry, NULL);
-
- INIT_OVERLOADED_CLASS_ENTRY(ce, "DomElement", php_domxmlelement_class_functions, NULL, NULL, NULL);
- domxmlelement_class_entry = zend_register_internal_class_ex(&ce, domxmlnode_class_entry, NULL);
-
- INIT_OVERLOADED_CLASS_ENTRY(ce, "DomAttribute", php_domxmlattr_class_functions, NULL, NULL, NULL);
- domxmlattr_class_entry = zend_register_internal_class_ex(&ce, domxmlnode_class_entry, NULL);
-
- INIT_OVERLOADED_CLASS_ENTRY(ce, "DomCData", php_domxmlcdata_class_functions, NULL, NULL, NULL);
- domxmlcdata_class_entry = zend_register_internal_class_ex(&ce, domxmlnode_class_entry, NULL);
-
- INIT_OVERLOADED_CLASS_ENTRY(ce, "DomText", php_domxmltext_class_functions, NULL, NULL, NULL);
- domxmltext_class_entry = zend_register_internal_class_ex(&ce, domxmlcdata_class_entry, NULL);
-
- INIT_OVERLOADED_CLASS_ENTRY(ce, "DomComment", php_domxmlcomment_class_functions, NULL, NULL, NULL);
- domxmlcomment_class_entry = zend_register_internal_class_ex(&ce, domxmlcdata_class_entry, NULL);
-
- INIT_OVERLOADED_CLASS_ENTRY(ce, "DomProcessingInstruction", php_domxmlpi_class_functions, NULL, NULL, NULL);
- domxmlpi_class_entry = zend_register_internal_class_ex(&ce, domxmlnode_class_entry, NULL);
-
- INIT_OVERLOADED_CLASS_ENTRY(ce, "DomNotation", php_domxmlnotation_class_functions, NULL, NULL, NULL);
- domxmlnotation_class_entry = zend_register_internal_class_ex(&ce, domxmlnode_class_entry, NULL);
-
- INIT_OVERLOADED_CLASS_ENTRY(ce, "DomEntity", php_domxmlentity_class_functions, NULL, NULL, NULL);
- domxmlentity_class_entry = zend_register_internal_class_ex(&ce, domxmlnode_class_entry, NULL);
-
- INIT_OVERLOADED_CLASS_ENTRY(ce, "DomEntityReference", php_domxmlentityref_class_functions, NULL, NULL, NULL);
- domxmlentityref_class_entry = zend_register_internal_class_ex(&ce, domxmlnode_class_entry, NULL);
-
- INIT_OVERLOADED_CLASS_ENTRY(ce, "DomNamespace", php_domxmlns_class_functions, NULL, NULL, NULL);
- domxmlns_class_entry = zend_register_internal_class_ex(&ce, NULL, NULL);
-
-#if defined(LIBXML_XPATH_ENABLED)
- INIT_OVERLOADED_CLASS_ENTRY(ce, "XPathContext", php_xpathctx_class_functions, NULL, NULL, NULL);
- xpathctx_class_entry = zend_register_internal_class_ex(&ce, NULL, NULL);
-
- INIT_OVERLOADED_CLASS_ENTRY(ce, "XPathObject", php_xpathobject_class_functions, NULL, NULL, NULL);
- xpathobject_class_entry = zend_register_internal_class_ex(&ce, NULL, NULL);
-#endif
-
- REGISTER_LONG_CONSTANT("XML_ELEMENT_NODE", XML_ELEMENT_NODE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XML_ATTRIBUTE_NODE", XML_ATTRIBUTE_NODE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XML_TEXT_NODE", XML_TEXT_NODE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XML_CDATA_SECTION_NODE", XML_CDATA_SECTION_NODE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XML_ENTITY_REF_NODE", XML_ENTITY_REF_NODE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XML_ENTITY_NODE", XML_ENTITY_NODE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XML_PI_NODE", XML_PI_NODE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XML_COMMENT_NODE", XML_COMMENT_NODE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XML_DOCUMENT_NODE", XML_DOCUMENT_NODE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XML_DOCUMENT_TYPE_NODE", XML_DOCUMENT_TYPE_NODE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XML_DOCUMENT_FRAG_NODE", XML_DOCUMENT_FRAG_NODE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XML_NOTATION_NODE", XML_NOTATION_NODE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XML_HTML_DOCUMENT_NODE", XML_HTML_DOCUMENT_NODE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XML_DTD_NODE", XML_DTD_NODE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XML_ELEMENT_DECL_NODE", XML_ELEMENT_DECL, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XML_ATTRIBUTE_DECL_NODE", XML_ATTRIBUTE_DECL, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XML_ENTITY_DECL_NODE", XML_ENTITY_DECL, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XML_NAMESPACE_DECL_NODE", XML_NAMESPACE_DECL, CONST_CS | CONST_PERSISTENT);
-#ifdef XML_GLOBAL_NAMESPACE
- REGISTER_LONG_CONSTANT("XML_GLOBAL_NAMESPACE", XML_GLOBAL_NAMESPACE, CONST_CS | CONST_PERSISTENT);
-#endif
- REGISTER_LONG_CONSTANT("XML_LOCAL_NAMESPACE", XML_LOCAL_NAMESPACE, CONST_CS | CONST_PERSISTENT);
-
- REGISTER_LONG_CONSTANT("XML_ATTRIBUTE_CDATA", XML_ATTRIBUTE_CDATA, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XML_ATTRIBUTE_ID", XML_ATTRIBUTE_ID, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XML_ATTRIBUTE_IDREF", XML_ATTRIBUTE_IDREF, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XML_ATTRIBUTE_IDREFS", XML_ATTRIBUTE_IDREFS, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XML_ATTRIBUTE_ENTITY", XML_ATTRIBUTE_ENTITIES, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XML_ATTRIBUTE_NMTOKEN", XML_ATTRIBUTE_NMTOKEN, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XML_ATTRIBUTE_NMTOKENS", XML_ATTRIBUTE_NMTOKENS, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XML_ATTRIBUTE_ENUMERATION", XML_ATTRIBUTE_ENUMERATION, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XML_ATTRIBUTE_NOTATION", XML_ATTRIBUTE_NOTATION, CONST_CS | CONST_PERSISTENT);
-
-#if defined(LIBXML_XPATH_ENABLED)
- REGISTER_LONG_CONSTANT("XPATH_UNDEFINED", XPATH_UNDEFINED, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XPATH_NODESET", XPATH_NODESET, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XPATH_BOOLEAN", XPATH_BOOLEAN, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XPATH_NUMBER", XPATH_NUMBER, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XPATH_STRING", XPATH_STRING, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XPATH_POINT", XPATH_POINT, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XPATH_RANGE", XPATH_RANGE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XPATH_LOCATIONSET", XPATH_LOCATIONSET, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XPATH_USERS", XPATH_USERS, CONST_CS | CONST_PERSISTENT);
-#endif
-
- return SUCCESS;
-}
-
-/* {{{ proto int domxml_test(int id)
- Unity function for testing */
-PHP_FUNCTION(domxml_test)
-{
- zval *id;
-
- if ((ZEND_NUM_ARGS() != 1) || getParameters(ht, 1, &id) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_long(id);
- RETURN_LONG(id->value.lval);
-}
-/* }}} */
-
-/* }}} */
-
-PHP_MINFO_FUNCTION(domxml)
-{
- /* don't know why that line was commented out in the previous version, so i left it (cmv) */
- php_info_print_table_start();
- php_info_print_table_row(2, "DOM/XML", "enabled");
- php_info_print_table_row(2, "libxml Version", LIBXML_DOTTED_VERSION );
-#if defined(LIBXML_XPATH_ENABLED)
- php_info_print_table_row(2, "XPath Support", "enabled");
-#endif
-#if defined(LIBXML_XPTR_ENABLED)
- php_info_print_table_row(2, "XPointer Support", "enabled");
-#endif
- php_info_print_table_end();
-}
-
-/* {{{ Methods of Class DomAttribute */
-
-/* {{{ proto array domxml_attr_name()
- Returns list of attribute names */
-PHP_FUNCTION(domxml_attr_name)
-{
- zval *id;
- xmlAttrPtr attrp;
-
- id = getThis();
- attrp = php_dom_get_object(id, le_domxmlattrp, 0);
-
- RETURN_STRING((char *) (attrp->name), 1);
-}
-/* }}} */
-
-/* {{{ proto array domxml_attr_value()
- Returns list of attribute names */
-PHP_FUNCTION(domxml_attr_value)
-{
- zval *id;
- xmlAttrPtr attrp;
-
- id = getThis();
- attrp = php_dom_get_object(id, le_domxmlattrp, 0);
-
- RETURN_STRING((char *) xmlNodeGetContent((xmlNodePtr) attrp), 1);
-}
-/* }}} */
-
-/* {{{ proto array domxml_attr_specified()
- Returns list of attribute names */
-PHP_FUNCTION(domxml_attr_specified)
-{
- zval *id;
- xmlAttrPtr attrp;
-
- id = getThis();
- attrp = php_dom_get_object(id, le_domxmlattrp, 0);
-
- RETURN_TRUE;
-}
-/* }}} */
-/* End of Methods DomAttr }}} */
-
-/* {{{ Methods of Class DomProcessingInstruction */
-
-/* {{{ proto array domxml_pi_target()
- Returns target of pi */
-PHP_FUNCTION(domxml_pi_target)
-{
- zval *id;
- xmlNodePtr nodep;
-
- id = getThis();
- nodep = php_dom_get_object(id, le_domxmlpip, 0);
-
- RETURN_STRING((char *)nodep->name, 1);
-}
-/* }}} */
-
-/* {{{ proto array domxml_pi_data()
- Returns data of pi */
-PHP_FUNCTION(domxml_pi_data)
-{
- zval *id;
- xmlNodePtr nodep;
-
- id = getThis();
- nodep = php_dom_get_object(id, le_domxmlpip, 0);
-
- RETURN_STRING(xmlNodeGetContent(nodep), 1);
-}
-/* }}} */
-/* End of Methods of DomProcessingInstruction }}} */
-
-/* {{{ Methods of Class DomCData */
-
-/* {{{ proto array domxml_cdata_length()
- Returns list of attribute names */
-PHP_FUNCTION(domxml_cdata_length)
-{
- zval *id;
- xmlNodePtr nodep;
-
- id = getThis();
- nodep = php_dom_get_object(id, le_domxmlcdatap, 0);
-
- RETURN_LONG(1);
-}
-/* }}} */
-/* End of Methods DomCDdata }}} */
-
-/* {{{ Methods of Class DomNode */
-
-/* {{{ proto object domxml_node(string name)
- Creates node */
-PHP_FUNCTION(domxml_node)
-{
- zval *arg, *rv;
- xmlNode *node;
- int ret;
-
- if (ZEND_NUM_ARGS() != 1 || getParameters(ht, 1, &arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string(arg);
-
- node = xmlNewNode(NULL, arg->value.str.val);
- if (!node) {
- RETURN_FALSE;
- }
- rv = php_domobject_new(node, &ret);
- if (!rv) {
- RETURN_FALSE;
- }
- SEPARATE_ZVAL(&rv);
- *return_value = *rv;
- FREE_ZVAL(rv);
-}
-/* }}} */
-
-/* {{{ proto object domxml_node_name()
- Returns name of node */
-PHP_FUNCTION(domxml_node_name)
-{
- zval *id;
- xmlNode *n;
- const char *str = NULL;
-
- id = getThis();
- n = php_dom_get_object(id, le_domxmlnodep, 0);
-
- switch (n->type)
- {
- case XML_ELEMENT_NODE:
- str = n->name;
- break;
- case XML_TEXT_NODE:
- str = "#text";
- break;
- case XML_CDATA_SECTION_NODE:
- str = "#cdata-section";
- break;
- case XML_ENTITY_REF_NODE:
- str = n->name;
- break;
- case XML_ENTITY_NODE:
- str = NULL;
- break;
- case XML_PI_NODE:
- str = n->name;
- break;
- case XML_COMMENT_NODE:
- str = "#comment";
- break;
- case XML_DOCUMENT_FRAG_NODE:
- str = "#document-fragment";
- break;
- default:
- str = NULL;
- break;
- }
- RETURN_STRING((char *) str, 1);
-}
-/* }}} */
-
-/* {{{ proto object domxml_node_value()
- Returns name of value */
-PHP_FUNCTION(domxml_node_value)
-{
- zval *id;
- xmlNode *n;
- char *str = NULL;
-
- id = getThis();
- n = php_dom_get_object(id, le_domxmlnodep, 0);
-
- if (!n) {
- RETURN_FALSE;
- }
- switch (n->type)
- {
- case XML_TEXT_NODE:
- case XML_COMMENT_NODE:
- case XML_CDATA_SECTION_NODE:
- case XML_PI_NODE:
- str = n->content;
- break;
- default:
- str = NULL;
- break;
- }
- RETURN_STRING(str, 1);
-}
-/* }}} */
-
-PHP_FUNCTION(domxml_node_type)
-{
- zval *id;
- xmlNode *n;
-
- id = getThis();
- n = php_dom_get_object(id, le_domxmlnodep, 0);
-
- if (!n) {
- RETURN_FALSE;
- }
- RETURN_LONG(n->type);
-}
-/* }}} */
-
-/* {{{ proto object domxml_node_first_child()
- Returns first child from list of children */
-PHP_FUNCTION(domxml_node_first_child)
-{
- zval *id, *rv;
- xmlNode *nodep, *first;
- int ret;
-
- id = getThis();
- nodep = php_dom_get_object(id, le_domxmlnodep, 0);
-
- first = nodep->children;
- if (!first) {
- RETURN_FALSE;
- }
-
- rv = php_domobject_new(first, &ret);
- SEPARATE_ZVAL(&rv);
- *return_value = *rv;
- FREE_ZVAL(rv);
-}
-/* }}} */
-
-/* {{{ proto object domxml_node_last_child()
- Returns last child from list of children */
-PHP_FUNCTION(domxml_node_last_child)
-{
- zval *id, *rv;
- xmlNode *nodep, *last;
- int ret;
-
- id = getThis();
- nodep = php_dom_get_object(id, le_domxmlnodep, 0);
-
- last = nodep->last;
- if (!last) {
- RETURN_FALSE;
- }
-
- rv = php_domobject_new(last, &ret);
- SEPARATE_ZVAL(&rv);
- *return_value = *rv;
- FREE_ZVAL(rv);
-}
-/* }}} */
-
-/* {{{ proto object domxml_node_next_sibling()
- Returns next child from list of children */
-PHP_FUNCTION(domxml_node_next_sibling)
-{
- zval *id, *rv;
- xmlNode *nodep, *first;
- int ret;
-
- id = getThis();
- if(NULL == (nodep = php_dom_get_object(id, le_domxmlnodep, 0)))
- RETURN_FALSE;
-
- first = nodep->next;
- if (!first) {
- RETURN_FALSE;
- }
-
- rv = php_domobject_new(first, &ret);
- SEPARATE_ZVAL(&rv);
- *return_value = *rv;
- FREE_ZVAL(rv);
-}
-/* }}} */
-
-/* {{{ proto object domxml_node_previous_sibling()
- Returns previous child from list of children */
-PHP_FUNCTION(domxml_node_previous_sibling)
-{
- zval *id, *rv;
- xmlNode *nodep, *first;
- int ret;
-
- id = getThis();
- if(NULL == (nodep = php_dom_get_object(id, le_domxmlnodep, 0)))
- RETURN_FALSE;
-
- first = nodep->prev;
- if (!first) {
- RETURN_FALSE;
- }
-
- rv = php_domobject_new(first, &ret);
- SEPARATE_ZVAL(&rv);
- *return_value = *rv;
- FREE_ZVAL(rv);
-}
-/* }}} */
-
-/* {{{ proto object domxml_node_owner_document()
- Returns document this node belongs to */
-PHP_FUNCTION(domxml_node_owner_document)
-{
- zval *id, *rv;
- xmlNode *nodep;
- xmlDocPtr docp;
- int ret;
-
- id = getThis();
- if(NULL == (nodep = php_dom_get_object(id, le_domxmlnodep, 0)))
- RETURN_FALSE;
-
- docp = nodep->doc;
- if (!docp) {
- RETURN_FALSE;
- }
-
- rv = php_domobject_new((xmlNodePtr) docp, &ret);
- SEPARATE_ZVAL(&rv);
- *return_value = *rv;
- FREE_ZVAL(rv);
-}
-/* }}} */
-
-/* {{{ proto object domxml_node_has_child_nodes()
- Returns true if node has children */
-PHP_FUNCTION(domxml_node_has_child_nodes)
-{
- zval *id;
- xmlNode *nodep;
-
- id = getThis();
- if(NULL == (nodep = php_dom_get_object(id, le_domxmlnodep, 0)))
- RETURN_FALSE;
-
- if (nodep->children) {
- RETURN_TRUE;
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto object domxml_node_has_attributes()
- Returns true if node has attributes */
-PHP_FUNCTION(domxml_node_has_attributes)
-{
- zval *id;
- xmlNode *nodep;
-
- id = getThis();
- if(NULL == (nodep = php_dom_get_object(id, le_domxmlnodep, 0)))
- RETURN_FALSE;
-
- if(nodep->type != XML_ELEMENT_NODE)
- RETURN_FALSE;
-
- if (nodep->properties) {
- RETURN_TRUE;
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto object domxml_node_prefix()
- Returns namespace prefix of node */
-PHP_FUNCTION(domxml_node_prefix)
-{
- zval *id;
- xmlNode *nodep;
- xmlNsPtr ns;
-
- id = getThis();
- if(NULL == (nodep = php_dom_get_object(id, le_domxmlnodep, 0)))
- RETURN_FALSE;
-
- ns = nodep->ns;
- if (!ns) {
- RETURN_EMPTY_STRING();
- }
-
- if(ns->prefix) {
- RETURN_STRING((char *) (ns->prefix), 1);
- } else {
- RETURN_EMPTY_STRING();
- }
-}
-/* }}} */
-
-/* {{{ proto object domxml_node_parent()
- Returns parent of node */
-PHP_FUNCTION(domxml_node_parent)
-{
- zval *id, *rv;
- xmlNode *nodep, *last;
- int ret;
-
- id = getThis();
- nodep = php_dom_get_object(id, le_domxmlnodep, 0);
-
- last = nodep->parent;
- if (!last) {
- RETURN_FALSE;
- }
- rv = php_domobject_new(last, &ret);
- SEPARATE_ZVAL(&rv);
- *return_value = *rv;
- FREE_ZVAL(rv);
-}
-/* }}} */
-
-/* {{{ proto array domxml_node_children()
- Returns list of children nodes */
-PHP_FUNCTION(domxml_node_children)
-{
- zval *id;
- xmlNode *nodep, *last;
- int ret;
-
- id = getThis();
- nodep = php_dom_get_object(id, le_domxmlnodep, le_domxmldocp);
-
- /* Even if the nodep is a XML_DOCUMENT_NODE the type is at the
- same position.
- */
- if(nodep->type == XML_DOCUMENT_NODE)
- last = ((xmlDoc *) nodep)->children;
- else
- last = nodep->children;
- if (!last) {
- RETURN_FALSE;
- }
-
- if (array_init(return_value) == FAILURE) {
- RETURN_FALSE;
- }
-
- while(last) {
- zval *child;
- child = php_domobject_new(last, &ret);
- add_next_index_zval(return_value, child);
- last = last->next;
- }
-}
-/* }}} */
-
-/* {{{ proto object domxml_node_unlink_node()
- Deletes node */
-PHP_FUNCTION(domxml_node_unlink_node)
-{
- zval *id;
- xmlNode *nodep;
-
- id = getThis();
- nodep = php_dom_get_object(id, le_domxmlnodep, 0);
-
- xmlUnlinkNode(nodep);
- xmlFreeNode(nodep);
- zval_dtor(id); /* This is not enough because the children won't be deleted */
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto object domxml_node_add_child(int domnode)
- Adds existing node to parent node */
-PHP_FUNCTION(domxml_node_add_child)
-{
- zval *id, *rv, *node;
- xmlNodePtr child, nodep;
- int ret;
-
- if (ZEND_NUM_ARGS() != 1 || getParameters(ht, 1, &node) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- id = getThis();
- nodep = php_dom_get_object(id, le_domxmlnodep, 0);
- child = php_dom_get_object(node, le_domxmlnodep, 0);
-
- if (!child || !nodep) {
- RETURN_FALSE;
- }
-
- child = xmlAddChild(nodep, child);
- rv = php_domobject_new(child, &ret);
- SEPARATE_ZVAL(&rv);
- *return_value = *rv;
- FREE_ZVAL(rv);
-}
-/* }}} */
-
-/* {{{ proto object domxml_node_append_child(int domnode)
- Adds node to list of children */
-PHP_FUNCTION(domxml_node_append_child)
-{
- zval *id, *rv, *node;
- xmlNodePtr child, nodep;
- int ret;
-
- if (ZEND_NUM_ARGS() != 1 || getParameters(ht, 1, &node) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- id = getThis();
- nodep = php_dom_get_object(id, le_domxmlnodep, 0);
- child = php_dom_get_object(node, le_domxmlnodep, 0);
-
- if (!child || !nodep) {
- RETURN_FALSE;
- }
-
- child = xmlAddSibling(nodep, child);
- rv = php_domobject_new(child, &ret);
- SEPARATE_ZVAL(&rv);
- *return_value = *rv;
- FREE_ZVAL(rv);
-}
-/* }}} */
-
-/* {{{ proto object domxml_node_insert_before(int newnode, int refnode)
- Adds node in list of nodes before given node */
-PHP_FUNCTION(domxml_node_insert_before)
-{
- zval *id, *rv, *node, *ref;
- xmlNodePtr child, nodep, refp;
- int ret;
-
- if (ZEND_NUM_ARGS() != 2 || getParameters(ht, 2, &node, &ref) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- id = getThis();
- nodep = php_dom_get_object(id, le_domxmlnodep, 0);
- child = php_dom_get_object(node, le_domxmlnodep, 0);
- refp = php_dom_get_object(ref, le_domxmlnodep, 0);
-
- if (!child || !nodep || !refp) {
- RETURN_FALSE;
- }
-
- child = xmlAddPrevSibling(refp, child);
- rv = php_domobject_new(child, &ret);
- SEPARATE_ZVAL(&rv);
- *return_value = *rv;
- FREE_ZVAL(rv);
-}
-/* }}} */
-
-/* {{{ proto bool domxml_node_set_name(string name)
- Sets name of a node */
-PHP_FUNCTION(domxml_node_set_name)
-{
- zval *id, *name;
- xmlNode *nodep;
-
- if ((ZEND_NUM_ARGS() != 1) || getParameters(ht, 1, &name) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- id = getThis();
- nodep = php_dom_get_object(id, le_domxmlnodep, 0);
- convert_to_string(name);
-
- if(name->value.str.len)
- xmlNodeSetName(nodep, name->value.str.val);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto array domxml_node_attributes()
- Returns list of attributes of node */
-PHP_FUNCTION(domxml_node_attributes)
-{
- zval *id, *attrs;
- xmlNode *nodep;
-#ifdef oldstyle_for_libxml_1_8_7
- xmlAttr *attr;
-#endif
-
- id = getThis();
- nodep = php_dom_get_object(id, le_domxmlnodep, 0);
-
- if(node_attributes(&attrs, nodep) < 0)
- RETURN_FALSE;
-
- *return_value = *attrs;
- FREE_ZVAL(attrs);
-
-#ifdef oldstyle_for_libxml_1_8_7
- attr = nodep->properties;
- if (!attr) {
- RETURN_FALSE;
- }
-
- if (array_init(return_value) == FAILURE) {
- RETURN_FALSE;
- }
-
- while(attr) {
- add_assoc_string(return_value, (char *) attr->name, xmlNodeGetContent(attr), 1);
- attr = attr->next;
- }
-#endif
-}
-/* }}} */
-
-/* {{{ proto object domxml_new_child(string name, string content)
- Adds child node to parent node */
-PHP_FUNCTION(domxml_node_new_child)
-{
- zval *id, *name, *content, *rv;
- xmlNodePtr child, nodep;
- int ret;
-
- if (ZEND_NUM_ARGS() != 2 || getParameters(ht, 2, &name, &content) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- id = getThis();
- nodep = php_dom_get_object(id, le_domxmlnodep, 0);
-
- convert_to_string(name);
- convert_to_string(content);
-
- if(content->value.str.len)
- child = xmlNewChild(nodep, NULL, name->value.str.val, content->value.str.val);
- else
- child = xmlNewChild(nodep, NULL, name->value.str.val, NULL);
- if (!child) {
- RETURN_FALSE;
- }
- rv = php_domobject_new(child, &ret);
- SEPARATE_ZVAL(&rv);
- *return_value = *rv;
- FREE_ZVAL(rv);
-}
-/* }}} */
-
-/* {{{ proto bool domxml_node_set_content(string content)
- Set content of a node */
-PHP_FUNCTION(domxml_node_set_content)
-{
- zval *id, *content;
- xmlNode *nodep;
-
- if ((ZEND_NUM_ARGS() != 1) || getParameters(ht, 1, &content) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- id = getThis();
- nodep = php_dom_get_object(id, le_domxmlnodep, 0);
- convert_to_string(content);
-
- if(content->value.str.len)
- xmlNodeSetContent(nodep, content->value.str.val);
-
- /* FIXME: Actually the property 'content' of the node has to be updated
- as well. Since 'content' should disappear sooner or later and being
- replaces by a function 'content()' I skip this for now
- */
- RETURN_TRUE;
-}
-
-/* End of Methods DomNode }}} */
-
-/* {{{ Methods of Class DomNotation */
-
-/* {{{ proto string domxml_notation_public_id()
- Returns public id of notation node */
-PHP_FUNCTION(domxml_notation_public_id)
-{
- zval *id;
- xmlNotationPtr nodep;
-
- id = getThis();
- nodep = (xmlNotationPtr) php_dom_get_object(id, le_domxmlnotationp, 0);
-
- RETURN_STRING((char *) (nodep->PublicID), 1);
-}
-/* }}} */
-
-/* {{{ proto string domxml_notation_system_id()
- Returns system id of notation node */
-PHP_FUNCTION(domxml_notation_system_id)
-{
- zval *id;
- xmlNotationPtr nodep;
-
- id = getThis();
- nodep = (xmlNotationPtr) php_dom_get_object(id, le_domxmlnotationp, 0);
-
- RETURN_STRING((char *) (nodep->SystemID), 1);
-}
-/* }}} */
-
-/* End of Methods DomNotation }}} */
-
-/* {{{ Methods of Class DomElement */
-
-/* {{{ proto object domxml_element(string name)
- Constructor of DomElement */
-PHP_FUNCTION(domxml_element)
-{
- zval *arg, *rv;
- xmlNode *node;
- int ret;
-
- if (ZEND_NUM_ARGS() != 1 || getParameters(ht, 1, &arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string(arg);
-
- node = xmlNewNode(NULL, arg->value.str.val);
- if (!node) {
- RETURN_FALSE;
- }
- rv = php_domobject_new(node, &ret);
- SEPARATE_ZVAL(&rv);
- *return_value = *rv;
- FREE_ZVAL(rv);
-}
-/* }}} */
-
-/* {{{ proto string domxml_elem_tagname()
- Returns tag name of element node */
-PHP_FUNCTION(domxml_elem_tagname)
-{
- zval *id;
- xmlNode *nodep;
-
- id = getThis();
- nodep = php_dom_get_object(id, le_domxmlelementp, 0);
-
- RETURN_STRING((char *) (nodep->name), 1);
-}
-/* }}} */
-
-/* {{{ proto string domxml_elem_get_attribute(string attrname)
- Returns value of given attribute */
-PHP_FUNCTION(domxml_elem_get_attribute)
-{
- zval *id, *arg1;
- xmlNode *nodep;
- char *value;
-
- if ((ZEND_NUM_ARGS() == 1) && getParameters(ht, 1, &arg1) == SUCCESS) {
- id = getThis();
- nodep = php_dom_get_object(id, le_domxmlelementp, 0);
- } else {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string(arg1);
-
- value = xmlGetProp(nodep, arg1->value.str.val);
- if (!value) {
- RETURN_EMPTY_STRING();
- } else {
- RETURN_STRING(value, 1);
- }
-}
-/* }}} */
-
-/* {{{ proto bool domxml_elem_set_attribute(string attrname, string value)
- Sets value of given attribute */
-PHP_FUNCTION(domxml_elem_set_attribute)
-{
- zval *id, *rv, *arg1, *arg2;
- xmlNode *nodep;
- xmlAttr *attr;
- int ret;
-
- if ((ZEND_NUM_ARGS() == 2) && getParameters(ht, 2, &arg1, &arg2) == SUCCESS) {
- id = getThis();
- nodep = php_dom_get_object(id, le_domxmlelementp, 0);
- } else {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string(arg1);
- convert_to_string(arg2);
-
- attr = xmlSetProp(nodep, arg1->value.str.val, arg2->value.str.val);
- if (!attr) {
- php_error(E_WARNING, "No such attribute '%s'", arg1->value.str.val);
- RETURN_FALSE;
- }
- rv = php_domobject_new((xmlNodePtr) attr, &ret);
- SEPARATE_ZVAL(&rv);
- *return_value = *rv;
- FREE_ZVAL(rv);
-}
-/* }}} */
-
-/* {{{ proto string domxml_elem_remove_attribute(string attrname)
- Remove given attribute */
-PHP_FUNCTION(domxml_elem_remove_attribute)
-{
- zval *id, *arg1;
- xmlNode *nodep;
-
- if ((ZEND_NUM_ARGS() == 1) && getParameters(ht, 1, &arg1) == SUCCESS) {
- id = getThis();
- nodep = php_dom_get_object(id, le_domxmlelementp, 0);
- } else {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string(arg1);
-
- /* FIXME: not implemented */
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto string domxml_elem_get_attribute_node(string attrname)
- Returns value of given attribute */
-PHP_FUNCTION(domxml_elem_get_attribute_node)
-{
- zval *id, *arg1;
- xmlNode *nodep;
-
- if ((ZEND_NUM_ARGS() == 1) && getParameters(ht, 1, &arg1) == SUCCESS) {
- id = getThis();
- nodep = php_dom_get_object(id, le_domxmlelementp, 0);
- } else {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string(arg1);
-
- /* FIXME: not implemented */
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool domxml_elem_set_attribute_node(int attr)
- Sets value of given attribute */
-PHP_FUNCTION(domxml_elem_set_attribute_node)
-{
- zval *id, *arg1;
- xmlNode *nodep;
- xmlAttr *attrp;
-
- if ((ZEND_NUM_ARGS() == 1) && getParameters(ht, 1, &arg1) == SUCCESS) {
- id = getThis();
- nodep = php_dom_get_object(id, le_domxmlelementp, 0);
- attrp = php_dom_get_object(arg1, le_domxmlattrp, 0);
- } else {
- WRONG_PARAM_COUNT;
- }
-
- /* FIXME: not implemented */
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto string domxml_elem_get_element_by_tagname(string tagname)
- Returns element for given attribute */
-PHP_FUNCTION(domxml_elem_get_element_by_tagname)
-{
- zval *id, *arg1;
- xmlNode *nodep;
-
- if ((ZEND_NUM_ARGS() == 1) && getParameters(ht, 1, &arg1) == SUCCESS) {
- id = getThis();
- nodep = php_dom_get_object(id, le_domxmlelementp, 0);
- } else {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string(arg1);
-
- /* FIXME: not implemented */
-
-}
-/* }}} */
-/* End of Methods DomElement }}} */
-
-/* {{{ Methods of Class DomDocumentType */
-
-/* {{{ proto array domxml_doctype_name()
- Return name of DocumentType */
-PHP_FUNCTION(domxml_doctype_name)
-{
- zval *id;
- xmlNodePtr attrp;
-
- id = getThis();
- attrp = php_dom_get_object(id, le_domxmldoctypep, 0);
-
- RETURN_STRING((char *) (attrp->name), 1);
-}
-/* }}} */
-
-/* End of Methods DomElementType }}} */
-
-/* {{{ Methods of Class DomDocument */
-
-/* {{{ proto object domxml_doc_doctype()
- Returns DomDocumentType */
-PHP_FUNCTION(domxml_doc_doctype)
-{
- zval *id, *rv;
- xmlDtdPtr dtd;
- xmlDocPtr docp;
- int ret;
-
- id = getThis();
- if(NULL == (docp = php_dom_get_object(id, le_domxmldocp, 0))) {
- RETURN_FALSE;
- }
-
- dtd = xmlGetIntSubset(docp);
- rv = php_domobject_new((xmlNodePtr) dtd, &ret);
- SEPARATE_ZVAL(&rv);
- *return_value = *rv;
- FREE_ZVAL(rv);
-}
-/* }}} */
-
-/* {{{ proto object domxml_doc_implementation()
- Returns DomeDOMImplementation */
-PHP_FUNCTION(domxml_doc_implementation)
-{
- zval *id;
- xmlDocPtr docp;
-
- id = getThis();
- if(NULL == (docp = php_dom_get_object(id, le_domxmldocp, 0))) {
- RETURN_FALSE;
- }
-
-/* rv = php_domobject_new(node, &ret);
- SEPARATE_ZVAL(&rv);
- *return_value = *rv;
-*/
-}
-/* }}} */
-
-/* {{{ proto array domxml_doc_document_element()
- Returns root node of document */
-PHP_FUNCTION(domxml_doc_document_element)
-{
- zval *id;
- xmlDoc *docp;
- xmlNode *node;
- int ret;
-
- id = getThis();
- docp = php_dom_get_object(id, le_domxmldocp, 0);
-
- node = docp->children;
- if (!node) {
- RETURN_FALSE;
- }
-
- while(node) {
- if(node->type == XML_ELEMENT_NODE) {
- zval *rv;
- rv = php_domobject_new(node, &ret);
- SEPARATE_ZVAL(&rv);
- *return_value = *rv;
- FREE_ZVAL(rv);
- return;
- }
- node = node->next;
- }
-}
-/* }}} */
-
-/* {{{ proto object domxml_doc_create_element(string name)
- Creates new element node */
-PHP_FUNCTION(domxml_doc_create_element)
-{
- zval *arg, *id, *rv;
- xmlNode *node;
- xmlDocPtr docp;
- int ret;
-
- id = getThis();
- if(NULL == (docp = php_dom_get_object(id, le_domxmldocp, 0))) {
- RETURN_FALSE;
- }
-
- if (ZEND_NUM_ARGS() != 1 || getParameters(ht, 1, &arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string(arg);
-
- node = xmlNewNode(NULL, arg->value.str.val);
- if (!node) {
- RETURN_FALSE;
- }
- node->doc = docp;
-
- rv = php_domobject_new(node, &ret);
- SEPARATE_ZVAL(&rv);
- *return_value = *rv;
- FREE_ZVAL(rv);
-}
-/* }}} */
-
-/* {{{ proto object domxml_doc_create_text_node(string name)
- Creates new text node */
-PHP_FUNCTION(domxml_doc_create_text_node)
-{
- zval *arg, *id, *rv;
- xmlNode *node;
- xmlDocPtr docp;
- int ret;
-
- id = getThis();
- if(NULL == (docp = php_dom_get_object(id, le_domxmldocp, 0))) {
- RETURN_FALSE;
- }
-
- if (ZEND_NUM_ARGS() != 1 || getParameters(ht, 1, &arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string(arg);
-
- node = xmlNewText(arg->value.str.val);
- if (!node) {
- RETURN_FALSE;
- }
- node->doc = docp;
-
- rv = php_domobject_new(node, &ret);
- SEPARATE_ZVAL(&rv);
- *return_value = *rv;
- FREE_ZVAL(rv);
-}
-/* }}} */
-
-/* {{{ proto object domxml_doc_create_comment(string name)
- Creates new comment node */
-PHP_FUNCTION(domxml_doc_create_comment)
-{
- zval *arg, *id, *rv;
- xmlNode *node;
- xmlDocPtr docp;
- int ret;
-
- id = getThis();
- if(NULL == (docp = php_dom_get_object(id, le_domxmldocp, 0))) {
- RETURN_FALSE;
- }
-
- if (ZEND_NUM_ARGS() != 1 || getParameters(ht, 1, &arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string(arg);
-
- node = xmlNewComment(arg->value.str.val);
- if (!node) {
- RETURN_FALSE;
- }
- node->doc = docp;
-
- rv = php_domobject_new(node, &ret);
- SEPARATE_ZVAL(&rv);
- *return_value = *rv;
- FREE_ZVAL(rv);
-}
-/* }}} */
-
-/* {{{ proto object domxml_doc_create_attribute(string name)
- Creates new attribute node */
-PHP_FUNCTION(domxml_doc_create_attribute)
-{
- zval *arg1, *arg2, *id, *rv;
- xmlAttrPtr node;
- xmlDocPtr docp;
- int ret;
-
- id = getThis();
- if(NULL == (docp = php_dom_get_object(id, le_domxmldocp, 0))) {
- RETURN_FALSE;
- }
-
- if (ZEND_NUM_ARGS() != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string(arg1);
- convert_to_string(arg2);
-
- node = xmlNewProp(NULL, Z_STRVAL_P(arg1), Z_STRVAL_P(arg2));
- if (!node) {
- RETURN_FALSE;
- }
- node->doc = docp;
-
- rv = php_domobject_new((xmlNodePtr) node, &ret);
- SEPARATE_ZVAL(&rv);
- *return_value = *rv;
- FREE_ZVAL(rv);
-}
-/* }}} */
-
-/* {{{ proto object domxml_doc_create_processing_instruction(string name)
- Creates new processing_instruction node */
-PHP_FUNCTION(domxml_doc_create_processing_instruction)
-{
- zval *arg1, *arg2, *id, *rv;
- xmlNode *node;
- xmlDocPtr docp;
- int ret;
-
- id = getThis();
- if(NULL == (docp = php_dom_get_object(id, le_domxmldocp, 0))) {
- RETURN_FALSE;
- }
-
- if (ZEND_NUM_ARGS() != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string(arg1);
- convert_to_string(arg2);
-
- node = xmlNewPI(Z_STRVAL_P(arg1), Z_STRVAL_P(arg2));
- if (!node) {
- RETURN_FALSE;
- }
- node->doc = docp;
-
- rv = php_domobject_new(node, &ret);
- SEPARATE_ZVAL(&rv);
- *return_value = *rv;
- FREE_ZVAL(rv);
-}
-/* }}} */
-
-/* {{{ proto object domxml_doc_imported_node(int node, bool recursive)
- Creates new element node */
-PHP_FUNCTION(domxml_doc_imported_node)
-{
- zval *arg1, *arg2, *id, *rv;
- xmlNodePtr node, srcnode;
- xmlDocPtr docp;
- int ret;
-
- id = getThis();
- if(NULL == (docp = php_dom_get_object(id, le_domxmldocp, 0))) {
- RETURN_FALSE;
- }
-
- if (ZEND_NUM_ARGS() != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- srcnode = php_dom_get_object(arg1, le_domxmlnodep, 0);
- if(!srcnode)
- RETURN_FALSE;
-
- convert_to_long(arg2);
-
- node = xmlCopyNode(srcnode, arg2->value.lval);
- if (!node) {
- RETURN_FALSE;
- }
- node->doc = docp; /* Not enough because other nodes in the tree are not set */
-
- rv = php_domobject_new(node, &ret);
- SEPARATE_ZVAL(&rv);
- *return_value = *rv;
- FREE_ZVAL(rv);
-}
-/* }}} */
-
-/* {{{ proto object domxml_dtd([int doc_handle])
- Returns DTD of document */
-PHP_FUNCTION(domxml_intdtd)
-{
- zval *id, *rv;
- xmlDoc *docp;
- xmlDtd *dtd;
- int ret;
-
- id = getThis();
- docp = php_dom_get_object(id, le_domxmldocp, 0);
-
- dtd = xmlGetIntSubset(docp);
- if (!dtd) {
- RETURN_FALSE;
- }
- rv = php_domobject_new((xmlNodePtr) dtd, &ret);
- SEPARATE_ZVAL(&rv);
- *return_value = *rv;
- FREE_ZVAL(rv);
-}
-/* }}} */
-
-/* {{{ proto string domxml_dumpmem([int doc_handle])
- Dumps document into string */
-PHP_FUNCTION(domxml_dumpmem)
-{
- zval *id;
- xmlDoc *docp;
- xmlChar *mem;
- int size;
-
- id = getThis();
- if(NULL == (docp = php_dom_get_object(id, le_domxmldocp, 0))) {
- RETURN_FALSE;
- }
-
- xmlDocDumpMemory(docp, &mem, &size);
- if (!size) {
- RETURN_FALSE;
- }
- RETURN_STRINGL(mem, size, 1);
-}
-/* }}} */
-
-/* {{{ proto object xmldoc(string xmldoc)
- Creates DOM object of XML document */
-PHP_FUNCTION(xmldoc)
-{
- zval **argv[2], *rv;
- int argc = ZEND_NUM_ARGS();
- xmlDoc *docp;
- int ret;
-
- if(argc > 2)
- WRONG_PARAM_COUNT;
- if(zend_get_parameters_array_ex(argc, argv) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_string_ex(argv[0]);
- if(argc == 2) {
- convert_to_boolean_ex(argv[1]);
- if(Z_BVAL_PP(argv[1])) {
- docp = xmlParseFile(Z_STRVAL_PP(argv[0]));
- } else {
- docp = xmlParseDoc((*argv[0])->value.str.val);
- }
- } else {
- docp = xmlParseDoc((*argv[0])->value.str.val);
- }
- if (!docp)
- RETURN_FALSE;
- rv = php_domobject_new((xmlNodePtr) docp, &ret);
- SEPARATE_ZVAL(&rv);
- *return_value = *rv;
- FREE_ZVAL(rv);
-}
-/* }}} */
-
-/* {{{ proto object xmldocfile(string filename)
- Creates DOM object of XML document in file*/
-PHP_FUNCTION(xmldocfile)
-{
- zval *arg;
- xmlDoc *docp;
- int ret;
-
- if (ZEND_NUM_ARGS() != 1 || getParameters(ht, 1, &arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string(arg);
-
- docp = xmlParseFile(arg->value.str.val);
- if (!docp) {
- RETURN_FALSE;
- }
- ret = zend_list_insert(docp, le_domxmldocp);
-
- /* construct an object with some methods */
- object_init_ex(return_value, domxmldoc_class_entry);
- add_property_resource(return_value, "doc", ret);
- if(docp->name)
- add_property_stringl(return_value, "name", (char *) docp->name, strlen(docp->name), 1);
- if(docp->URL)
- add_property_stringl(return_value, "url", (char *) docp->URL, strlen(docp->URL), 1);
- add_property_stringl(return_value, "version", (char *) docp->version, strlen(docp->version), 1);
- if(docp->encoding)
- add_property_stringl(return_value, "encoding", (char *) docp->encoding, strlen(docp->encoding), 1);
- add_property_long(return_value, "standalone", docp->standalone);
- add_property_long(return_value, "type", docp->type);
- add_property_long(return_value, "compression", docp->compression);
- add_property_long(return_value, "charset", docp->charset);
- zend_list_addref(ret);
-}
-/* }}} */
-
-/* {{{ proto bool domxml_node_text_concat(string content)
- Add string tocontent of a node */
-PHP_FUNCTION(domxml_node_text_concat)
-{
- zval *id, *content;
- xmlNode *nodep;
-
- if ((ZEND_NUM_ARGS() != 1) || getParameters(ht, 1, &content) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- id = getThis();
- nodep = php_dom_get_object(id, le_domxmlnodep, 0);
- convert_to_string(content);
-
- if(content->value.str.len)
- xmlTextConcat(nodep, content->value.str.val, content->value.str.len);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto object domxml_add_root(string name)
- Adds root node to document */
-PHP_FUNCTION(domxml_add_root)
-{
- zval *id, *name, *rv;
- xmlDoc *docp;
- xmlNode *nodep;
- int ret;
-
- if (ZEND_NUM_ARGS() != 1 || getParameters(ht, 1, &name)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- id = getThis();
- docp = php_dom_get_object(id, le_domxmldocp, 0);
- convert_to_string(name);
-
- nodep = xmlNewDocNode(docp, NULL, name->value.str.val, NULL);
- if (!nodep) {
- RETURN_FALSE;
- }
-
- xmlDocSetRootElement(docp, nodep);
- rv = php_domobject_new(nodep, &ret);
- SEPARATE_ZVAL(&rv);
- *return_value = *rv;
- FREE_ZVAL(rv);
-}
-/* }}} */
-
-/* {{{ proto object domxml_new_xmldoc(string version)
- Creates new xmldoc */
-PHP_FUNCTION(domxml_new_xmldoc)
-{
- zval *arg, *rv;
- xmlDoc *docp;
- int ret;
-
- if (ZEND_NUM_ARGS() != 1 || getParameters(ht, 1, &arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string(arg);
-
- docp = xmlNewDoc(arg->value.str.val);
- if (!docp) {
- RETURN_FALSE;
- }
- rv = php_domobject_new((xmlNodePtr) docp, &ret);
- if (!rv) {
- RETURN_FALSE;
- }
- SEPARATE_ZVAL(&rv);
- *return_value = *rv;
- FREE_ZVAL(rv);
-}
-/* }}} */
-
-#ifdef newcode
-/* {{{ proto int node_namespace([int node])
- Returns list of namespaces */
-static int node_namespace(zval **attributes, xmlNode *nodep)
-{
- xmlNs *ns;
-
- /* Get the children of the current node */
- ns = nodep->ns;
- if (!ns) {
- return -1;
- }
-
- /* create an php array for the children */
- MAKE_STD_ZVAL(*attributes);
- if (array_init(*attributes) == FAILURE) {
- return -1;
- }
-
- while(ns) {
- zval *pattr;
- int ret;
-
- pattr = php_domobject_new((xmlNodePtr) ns, &ret);
- SEPARATE_ZVAL(&pattr);
-/* if(!ret) { */
- if(ns->href)
- add_property_stringl(pattr, "href", (char *) ns->href, strlen(ns->href), 1);
- if(ns->prefix)
- add_property_stringl(pattr, "prefix", (char *) ns->prefix, strlen(ns->prefix), 1);
- add_property_long(pattr, "type", ns->type);
-/* } */
- zend_hash_next_index_insert((*attributes)->value.ht, &pattr, sizeof(zval *), NULL);
- ns = ns->next;
- }
- return 0;
-}
-#endif
-
-/* {{{ proto int node_attributes(zval **attributes, int node)
- Returns list of children nodes */
-static int node_attributes(zval **attributes, xmlNode *nodep)
-{
- xmlAttr *attr;
- int count = 0;
-
- /* Get the children of the current node */
- if(nodep->type != XML_ELEMENT_NODE)
- return -1;
- attr = nodep->properties;
- if (!attr)
- return -1;
-
- /* create an php array for the children */
- MAKE_STD_ZVAL(*attributes);
- array_init(*attributes);
-
- while(attr) {
- zval *pattr;
- int ret;
-
- pattr = php_domobject_new((xmlNodePtr) attr, &ret);
-/* if(0 <= (n = node_children(&children, attr->children))) {
- zend_hash_update(pattr->value.obj.properties, "children", sizeof("children"), (void *) &children, sizeof(zval *), NULL);
- }
-*/ add_property_string(pattr, "name", (char *) (attr->name), 1);
- add_property_string(pattr, "value", xmlNodeGetContent((xmlNodePtr) attr), 1);
- zend_hash_next_index_insert((*attributes)->value.ht, &pattr, sizeof(zval *), NULL);
- attr = attr->next;
- count++;
- }
- return count;
-}
-
-/* {{{ proto int node_children([int node])
- Returns list of children nodes */
-static int node_children(zval **children, xmlNode *nodep)
-{
- zval *mchildren, *attributes;
- /* zval *namespace; */
- xmlNode *last;
- int count = 0;
-
- /* Get the children of the current node */
- last = nodep;
- if (!last) {
- return -1;
- }
-
- /* create an php array for the children */
- MAKE_STD_ZVAL(*children);
- array_init(*children);
-
- while(last) {
- zval *child;
- int ret;
-
- child = php_domobject_new(last, &ret);
- zend_hash_next_index_insert((*children)->value.ht, &child, sizeof(zval *), NULL);
-
- /* Get the namespace of the current node and add it as a property */
-/* if(!node_namespace(&namespace, last))
- zend_hash_update(child->value.obj.properties, "namespace", sizeof("namespace"), (void *) &namespace, sizeof(zval *), NULL);
-*/
-
- /* Get the attributes of the current node and add it as a property */
- if(node_attributes(&attributes, last) >= 0)
- zend_hash_update(child->value.obj.properties, "attributes", sizeof("attributes"), (void *) &attributes, sizeof(zval *), NULL);
-
- /* Get recursively the children of the current node and add it as a property */
- if(node_children(&mchildren, last->children) >= 0)
- zend_hash_update(child->value.obj.properties, "children", sizeof("children"), (void *) &mchildren, sizeof(zval *), NULL);
- count++;
- last = last->next;
- }
- return count;
-}
-/* }}} */
-
-/* {{{ proto object xmltree(string xmltree)
- Create a tree of PHP objects from an XML document */
-PHP_FUNCTION(xmltree)
-{
- zval *arg, *children, *rv;
- xmlDoc *docp;
- xmlNode *root;
- int ret;
-
- if (ZEND_NUM_ARGS() != 1 || getParameters(ht, 1, &arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string(arg);
-
- /* Create a new xml document */
- docp = xmlParseDoc(arg->value.str.val);
- if (!docp) {
- RETURN_FALSE;
- }
-
- /* get the root and add as a property to the document */
- root = docp->children;
- if (!root) {
- xmlFreeDoc(docp);
- RETURN_FALSE;
- }
-
- rv = php_domobject_new((xmlNodePtr) docp, &ret);
- if (!rv) {
- RETURN_FALSE;
- }
- SEPARATE_ZVAL(&rv);
- *return_value = *rv;
- FREE_ZVAL(rv);
-
- /* The root itself maybe an array. Though you may not have two Elements
- as root, you may have a comment, pi and and element as root.
- Thanks to Paul DuBois for pointing me at this.
- */
- if (node_children(&children, root) >= 0) {
- zend_hash_update(return_value->value.obj.properties, "children",
- sizeof("children"), (void *) &children, sizeof(zval *), NULL);
- }
-/* xmlFreeDoc(docp); */
-}
-/* }}} */
-
-#if defined(LIBXML_XPATH_ENABLED)
-/* {{{ proto bool xpath_init(void)
- Initializing XPath environment */
-PHP_FUNCTION(xpath_init)
-{
- xmlXPathInit();
- RETURN_TRUE;
-}
-/* }}} */
-
-static void php_xpathptr_new_context(INTERNAL_FUNCTION_PARAMETERS, int mode)
-{
- zval *id, *rv;
- xmlXPathContextPtr ctx;
- xmlDocPtr docp;
- int ret;
-
- id = getThis();
- docp = php_dom_get_object(id, le_domxmldocp, 0);
-
-#if defined(LIBXML_XPTR_ENABLED)
- if(mode == PHP_XPTR)
- ctx = xmlXPtrNewContext(docp, NULL, NULL);
- else
-#endif
- ctx = xmlXPathNewContext(docp);
- if (!ctx) {
- RETURN_FALSE;
- }
- rv = php_xpathcontext_new(ctx, &ret);
- SEPARATE_ZVAL(&rv);
- *return_value = *rv;
- FREE_ZVAL(rv);
-}
-/* }}} */
-
-/* {{{ proto string xpath_new_context([int doc_handle])
- Create new XPath context */
-PHP_FUNCTION(xpath_new_context) {
- php_xpathptr_new_context(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_XPATH);
-}
-/* }}} */
-
-/* {{{ proto string xptr_new_context([int doc_handle])
- Create new XPath context */
-PHP_FUNCTION(xptr_new_context) {
- php_xpathptr_new_context(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_XPTR);
-}
-/* }}} */
-
-static void php_xpathptr_eval(INTERNAL_FUNCTION_PARAMETERS, int mode, int expr)
-{
- zval *id, *str, *rv;
- xmlXPathContextPtr ctxp;
- xmlXPathObjectPtr xpathobjp;
- int ret;
-
- if (ZEND_NUM_ARGS() != 1 || getParameters(ht, 1, &str) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- id = getThis();
- ctxp = php_xpath_get_context(id, le_xpathctxp, 0);
- convert_to_string(str);
-
-#if defined(LIBXML_XPTR_ENABLED)
- if(mode == PHP_XPTR) {
- xpathobjp = xmlXPtrEval(BAD_CAST str->value.str.val, ctxp);
- } else{
-#endif
- if(expr)
- xpathobjp = xmlXPathEvalExpression(str->value.str.val, ctxp);
- else
- xpathobjp = xmlXPathEval(str->value.str.val, ctxp);
-#if defined(LIBXML_XPTR_ENABLED)
- }
-#endif
-
- if (!xpathobjp) {
- RETURN_FALSE;
- }
-
- rv = php_xpathobject_new(xpathobjp, &ret);
- SEPARATE_ZVAL(&rv);
-
- add_property_long(rv, "type", xpathobjp->type);
- switch(xpathobjp->type) {
- case XPATH_UNDEFINED:
- break;
- case XPATH_NODESET: {
- int i;
- zval *arr;
- xmlNodeSetPtr nodesetp;
-
- MAKE_STD_ZVAL(arr);
- if (array_init(arr) == FAILURE) {
- zval_dtor(rv);
- RETURN_FALSE;
- }
- if(NULL == (nodesetp = xpathobjp->nodesetval)) {
- zval_dtor(rv);
- RETURN_FALSE;
- }
-
- for(i = 0;i < nodesetp->nodeNr;i++) {
- xmlNodePtr node = nodesetp->nodeTab[i];
- zval *child;
- int retnode;
-
- /* construct a node object */
- child = php_domobject_new(node, &retnode);
- zend_hash_next_index_insert(arr->value.ht, &child, sizeof(zval *), NULL);
- }
- zend_hash_update(rv->value.obj.properties, "nodeset", sizeof("nodeset"), (void *) &arr, sizeof(zval *), NULL);
- break;
- }
- case XPATH_BOOLEAN:
- add_property_bool(rv, "value", xpathobjp->boolval);
- break;
- case XPATH_NUMBER:
- add_property_double(rv, "value", xpathobjp->floatval);
- break;
- case XPATH_STRING:
- add_property_string(rv, "value", xpathobjp->stringval, 1);
- break;
- case XPATH_POINT:
- break;
- case XPATH_RANGE:
- break;
- case XPATH_LOCATIONSET:
- break;
- case XPATH_USERS:
- break;
- case XPATH_XSLT_TREE:
- break;
- }
- *return_value = *rv;
-}
-/* }}} */
-
-/* {{{ proto int xpath_eval([int xpathctx_handle,] string str)
- Evaluate the XPath Location Path in the given string */
-PHP_FUNCTION(xpath_eval) {
- php_xpathptr_eval(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_XPATH, 0);
-}
-/* }}} */
-
-/* {{{ proto int xpath_eval_expression([int xpathctx_handle,] string str)
- Evaluate the XPath Location Path in the given string */
-PHP_FUNCTION(xpath_eval_expression) {
- php_xpathptr_eval(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_XPATH, 1);
-}
-/* }}} */
-#endif /* defined(LIBXML_XPATH_ENABLED) */
-
-#if defined(LIBXML_XPTR_ENABLED)
-/* {{{ proto int xptr_eval([int xpathctx_handle,] string str)
- Evaluate the XPtr Location Path in the given string */
-PHP_FUNCTION(xptr_eval) {
- php_xpathptr_eval(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_XPTR, 0);
-}
-/* }}} */
-#endif /* LIBXML_XPTR_ENABLED */
-
-/* {{{ proto string domxml_version()
- Dumps document into string */
-PHP_FUNCTION(domxml_version)
-{
-
- RETURN_STRING(LIBXML_DOTTED_VERSION, 1);
-}
-/* }}} */
-
-#endif /* HAVE_DOMXML */
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/domxml/php_domxml.h b/ext/domxml/php_domxml.h
deleted file mode 100644
index d318230919..0000000000
--- a/ext/domxml/php_domxml.h
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Uwe Steinmann (Uwe.Steinmann@fernuni-hagen.de |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef PHP_DOMXML_H
-#define PHP_DOMXML_H
-
-#if HAVE_DOMXML
-#include <libxml/parser.h>
-#if defined(LIBXML_XPATH_ENABLED)
-#include <libxml/xpath.h>
-#endif
-#if defined(LIBXML_XPTR_ENABLED)
-#include <libxml/xpointer.h>
-#endif
-
-extern zend_module_entry domxml_module_entry;
-#define domxml_module_ptr &domxml_module_entry
-
-/* directory functions */
-extern PHP_MINIT_FUNCTION(domxml);
-extern PHP_RINIT_FUNCTION(domxml);
-extern PHP_MINFO_FUNCTION(domxml);
-PHP_FUNCTION(domxml_version);
-PHP_FUNCTION(xmldoc);
-PHP_FUNCTION(xmldocfile);
-PHP_FUNCTION(xmltree);
-PHP_FUNCTION(domxml_new_xmldoc);
-
-/* Class Document methods */
-PHP_FUNCTION(domxml_doc_doctype);
-PHP_FUNCTION(domxml_doc_implementation);
-PHP_FUNCTION(domxml_doc_document_element);
-PHP_FUNCTION(domxml_doc_create_element);
-PHP_FUNCTION(domxml_doc_create_text_node);
-PHP_FUNCTION(domxml_doc_create_comment);
-PHP_FUNCTION(domxml_doc_create_processing_instruction);
-PHP_FUNCTION(domxml_doc_create_attribute);
-PHP_FUNCTION(domxml_doc_imported_node);
-PHP_FUNCTION(domxml_add_root);
-PHP_FUNCTION(domxml_intdtd);
-PHP_FUNCTION(domxml_dumpmem);
-
-/* Class DocumentType methods */
-PHP_FUNCTION(domxml_doctype_name);
-PHP_FUNCTION(domxml_doctype_entities);
-PHP_FUNCTION(domxml_doctype_notations);
-PHP_FUNCTION(domxml_doctype_public_id);
-PHP_FUNCTION(domxml_doctype_system_id);
-PHP_FUNCTION(domxml_doctype_internal_subset);
-
-/* Class Notation methods */
-PHP_FUNCTION(domxml_notation_public_id);
-PHP_FUNCTION(domxml_notation_system_id);
-
-/* Class Node methods */
-PHP_FUNCTION(domxml_node_attributes);
-PHP_FUNCTION(domxml_node_children);
-PHP_FUNCTION(domxml_node_first_child);
-PHP_FUNCTION(domxml_node_last_child);
-PHP_FUNCTION(domxml_node_next_sibling);
-PHP_FUNCTION(domxml_node_previous_sibling);
-PHP_FUNCTION(domxml_node_owner_document);
-PHP_FUNCTION(domxml_node_insert_before);
-PHP_FUNCTION(domxml_node_append_child);
-PHP_FUNCTION(domxml_node_add_child);
-PHP_FUNCTION(domxml_node_has_attributes);
-PHP_FUNCTION(domxml_node_has_child_nodes);
-PHP_FUNCTION(domxml_node_parent);
-PHP_FUNCTION(domxml_node_prefix);
-PHP_FUNCTION(domxml_node);
-PHP_FUNCTION(domxml_node_unlink_node);
-PHP_FUNCTION(domxml_node_new_child);
-PHP_FUNCTION(domxml_node_set_content);
-PHP_FUNCTION(domxml_node_text_concat);
-PHP_FUNCTION(domxml_node_set_name);
-PHP_FUNCTION(domxml_node_name);
-PHP_FUNCTION(domxml_node_value);
-
-/* Class Attribute methods */
-PHP_FUNCTION(domxml_attr_name);
-PHP_FUNCTION(domxml_attr_value);
-PHP_FUNCTION(domxml_attr_specified);
-
-/* Class Element methods */
-PHP_FUNCTION(domxml_element);
-PHP_FUNCTION(domxml_elem_tagname);
-PHP_FUNCTION(domxml_elem_get_attribute);
-PHP_FUNCTION(domxml_elem_set_attribute);
-PHP_FUNCTION(domxml_elem_remove_attribute);
-PHP_FUNCTION(domxml_elem_get_attribute_node);
-PHP_FUNCTION(domxml_elem_set_attribute_node);
-PHP_FUNCTION(domxml_elem_get_element_by_tagname);
-
-/* Class CData methods */
-PHP_FUNCTION(domxml_cdata_length);
-
-/* Class Notation methods */
-PHP_FUNCTION(domxml_notation_public_id);
-PHP_FUNCTION(domxml_notation_system_id);
-
-/* Class Entity methods */
-PHP_FUNCTION(domxml_entity_public_id);
-PHP_FUNCTION(domxml_entity_system_id);
-PHP_FUNCTION(domxml_entity_notation_name);
-
-/* Class ProcessingInstructions */
-PHP_FUNCTION(domxml_pi_target);
-PHP_FUNCTION(domxml_pi_data);
-
-/* Class XPathContext methods */
-#if defined(LIBXML_XPATH_ENABLED)
-PHP_FUNCTION(xpath_init);
-PHP_FUNCTION(xpath_new_context);
-PHP_FUNCTION(xpath_eval);
-PHP_FUNCTION(xpath_eval_expression);
-#endif
-#if defined(LIBXML_XPTR_ENABLED)
-PHP_FUNCTION(xptr_new_context);
-PHP_FUNCTION(xptr_eval);
-#endif
-
-PHP_FUNCTION(domxml_test);
-#else
-#define domxml_module_ptr NULL
-#endif /* HAVE_DOMXML */
-#define phpext_domxml_ptr domxml_module_ptr
-
-#endif /* _PHP_DIR_H */
diff --git a/ext/dotnet/CREDITS b/ext/dotnet/CREDITS
deleted file mode 100644
index 154522c6f8..0000000000
--- a/ext/dotnet/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-dotnet
-Sam Ruby
diff --git a/ext/dotnet/EXPERIMENTAL b/ext/dotnet/EXPERIMENTAL
deleted file mode 100644
index 6443e99646..0000000000
--- a/ext/dotnet/EXPERIMENTAL
+++ /dev/null
@@ -1,5 +0,0 @@
-this extension is experimental,
-its functions may change their names
-or move to extension all together
-so do not rely to much on them
-you have been warned!
diff --git a/ext/dotnet/README b/ext/dotnet/README
deleted file mode 100644
index 8cad7bab8f..0000000000
--- a/ext/dotnet/README
+++ /dev/null
@@ -1,32 +0,0 @@
-Warning
-=======
-
-This support is EXPERIMENTAL. In fact, it integrates code that
-Microsoft labels as pre-beta. Use at your own risk.
-
-Build instructions
-==================
-
-Download and install the .NET Framework SDK Technology Preview from
-http://msdn.microsoft.com/net/#sdk. Once installed, copy Mscoree.h
-(typically found in C:\Program Files\NGWSSDK\Include to ext\dotnet).
-Do not simply add the NGWSSDK\Include directory to the include path
-as this will cause compilation failures.
-
-Download and unzip the source to the dm.net COM Moniker from
-http://staff.develop.com/jasonw/clr/readme.htm. Copy mscorlib.h
-to ext\dotnet. There is no need to register the clrmonsrv.dll as
-it is not used.
-
-At this point, the dotnet project can be built like any other
-project, from either VisualStudio 6's GUI or from the command line.
-Example command line invocation:
-
- msdev dotnet.dsp /MAKE "dotnet - Win32 Debug_TS"
-
-Execution instructions:
-=======================
-
-Add "extension=php_dotnet.dll" into php.ini.
-
-Sample program can be found at dotnet.php
diff --git a/ext/dotnet/dotnet.cpp b/ext/dotnet/dotnet.cpp
deleted file mode 100644
index f99b6935ad..0000000000
--- a/ext/dotnet/dotnet.cpp
+++ /dev/null
@@ -1,237 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Sam Ruby <rubys@us.ibm.com> |
- | Harald Radi <h.radi@nme.at> |
- +----------------------------------------------------------------------+
- */
-
-/*
- * This module implements support for Microsoft .Net components.
- */
-
-/*
- * 28.1.2001
- * use external unicode conversion functions
- *
- * harald radi <h.radi@nme.at>
- */
-
-#ifdef PHP_WIN32
-
-#include <iostream.h>
-#include <math.h>
-#include <comdef.h>
-
-extern "C" { /* this should be included in the includes itself !! */
-
-#include "php.h"
-#include "ext/standard/info.h"
-
-}
-
-#include "../com/conversion.h"
-#include "../com/php_COM.h"
-#include "Mscoree.h"
-#include "mscorlib.h"
-
-using namespace mscorlib;
-
-static ICorRuntimeHost *pHost;
-static mscorlib::_AppDomain *pDomain;
-
-static zend_class_entry dotnet_class_entry;
-static int codepage;
-
-HRESULT dotnet_init() {
- HRESULT hr;
-
- hr = CoCreateInstance(CLSID_CorRuntimeHost, NULL, CLSCTX_ALL,
- IID_ICorRuntimeHost, (void **)&pHost);
- if (FAILED(hr)) return hr;
-
- hr = pHost->Start();
- if (FAILED(hr)) return hr;
-
- IUnknown *uDomain;
- hr = pHost->GetDefaultDomain(&uDomain);
- if (FAILED(hr)) return hr;
-
- hr = uDomain->QueryInterface(__uuidof(_AppDomain), (void**) &pDomain);
- if (FAILED(hr)) return -1;
-
- uDomain->Release();
-
- return ERROR_SUCCESS;
-}
-
-HRESULT dotnet_create(OLECHAR *assembly, OLECHAR *datatype, i_dispatch *object) {
- HRESULT hr;
-
- _ObjectHandle *pHandle;
- hr = pDomain->CreateInstance(_bstr_t(assembly), _bstr_t(datatype), &pHandle);
- if (FAILED(hr)) return hr;
- if (!pHandle) return hr;
-
- _variant_t unwrapped;
- hr = pHandle->Unwrap(&unwrapped);
- pHandle->Release();
- if (FAILED(hr)) return hr;
-
- php_COM_set(object, unwrapped.pdispVal, TRUE);
- return ERROR_SUCCESS;
-}
-
-void dotnet_term() {
- if (pHost) pHost->Stop();
- if (pHost) pHost->Release();
- if (pDomain) pDomain->Release();
-
- pHost = 0;
- pDomain = 0;
-}
-
-/* {{{ proto int dotnet_load(string assembly_name [, string datatype_name, int codepage])
- Loads a DOTNET module */
-PHP_FUNCTION(dotnet_load)
-{
- HRESULT hr;
- pval *assembly_name, *datatype_name, *code_page;
- OLECHAR *assembly, *datatype;
- i_dispatch *obj;
-
- switch(ZEND_NUM_ARGS())
- {
- case 2:
- getParameters(ht, 2, &assembly_name, &datatype_name);
- codepage = CP_ACP;
- break;
- case 3:
- getParameters(ht, 3, &assembly_name, &datatype_name, &code_page);
-
- convert_to_long(code_page);
- codepage = code_page->value.lval;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- convert_to_string(assembly_name);
- assembly = php_char_to_OLECHAR(assembly_name->value.str.val, assembly_name->value.str.len, codepage);
-
- convert_to_string(datatype_name);
- datatype = php_char_to_OLECHAR(datatype_name->value.str.val, datatype_name->value.str.len, codepage);
-
- obj = (i_dispatch *) emalloc(sizeof(i_dispatch));
-
- /* obtain IDispatch */
- hr=dotnet_create(assembly, datatype, obj);
- efree(assembly);
- efree(datatype);
- if (FAILED(hr)) {
- char *error_message;
- error_message = php_COM_error_message(hr);
- php_error(E_WARNING,"Error obtaining .Net class for %s in assembly %s: %s",datatype_name->value.str.val,assembly_name->value.str.val,error_message);
- LocalFree(error_message);
- efree(obj);
- RETURN_FALSE;
- }
- if (!obj->i.dispatch) {
- php_error(E_WARNING,"Unable to locate %s in assembly %s",datatype_name->value.str.val,assembly_name->value.str.val);
- efree(obj);
- RETURN_FALSE;
- }
-
- RETURN_LONG(zend_list_insert(obj, php_COM_get_le_idispatch()));
-}
-/* }}} */
-
-
-void php_DOTNET_call_function_handler(INTERNAL_FUNCTION_PARAMETERS, zend_property_reference *property_reference)
-{
- pval *object = property_reference->object;
- zend_overloaded_element *function_name = (zend_overloaded_element *) property_reference->elements_list->tail->data;
-
- if (zend_llist_count(property_reference->elements_list)==1
- && !strcmp(function_name->element.value.str.val, "dotnet")) { /* constructor */
- pval *object_handle;
-
- PHP_FN(dotnet_load)(INTERNAL_FUNCTION_PARAM_PASSTHRU);
- if (!zend_is_true(return_value)) {
- var_reset(object);
- return;
- }
- ALLOC_ZVAL(object_handle);
- *object_handle = *return_value;
- pval_copy_constructor(object_handle);
- INIT_PZVAL(object_handle);
- zend_hash_index_update(object->value.obj.properties, 0, &object_handle, sizeof(pval *), NULL);
- pval_destructor(&function_name->element);
- } else {
- php_COM_call_function_handler(INTERNAL_FUNCTION_PARAM_PASSTHRU, property_reference);
- }
-}
-
-void php_register_DOTNET_class()
-{
- INIT_OVERLOADED_CLASS_ENTRY(dotnet_class_entry, "DOTNET", NULL,
- php_DOTNET_call_function_handler,
- php_COM_get_property_handler,
- php_COM_set_property_handler);
-
- zend_register_internal_class(&dotnet_class_entry);
-}
-
-function_entry DOTNET_functions[] = {
- {NULL, NULL, NULL}
-};
-
-static PHP_MINFO_FUNCTION(DOTNET)
-{
- php_info_print_table_start();
- php_info_print_table_row(2, ".NET support", "enabled");
- php_info_print_table_end();
-}
-
-PHP_MINIT_FUNCTION(DOTNET)
-{
-
- HRESULT hr;
- CoInitialize(0);
- hr = dotnet_init();
- if (FAILED(hr)) return hr;
-
- php_register_DOTNET_class();
- return SUCCESS;
-}
-
-
-PHP_MSHUTDOWN_FUNCTION(DOTNET)
-{
- dotnet_term();
- CoUninitialize();
- return SUCCESS;
-}
-
-
-zend_module_entry dotnet_module_entry = {
- "dotnet", DOTNET_functions, PHP_MINIT(DOTNET), PHP_MSHUTDOWN(DOTNET), NULL, NULL, PHP_MINFO(DOTNET), STANDARD_MODULE_PROPERTIES
-};
-
-BEGIN_EXTERN_C()
-ZEND_GET_MODULE(dotnet)
-END_EXTERN_C()
-
-#endif
diff --git a/ext/dotnet/dotnet.dsp b/ext/dotnet/dotnet.dsp
deleted file mode 100644
index a0b151f68a..0000000000
--- a/ext/dotnet/dotnet.dsp
+++ /dev/null
@@ -1,171 +0,0 @@
-# Microsoft Developer Studio Project File - Name="dotnet" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=dotnet - Win32 Debug_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "dotnet.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "dotnet.mak" CFG="dotnet - Win32 Debug_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "dotnet - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "dotnet - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "dotnet - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "dotnet - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "dotnet - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "..\..\Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "PHP_WIN32" /D "ZEND_WIN32" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D "NDEBUG" /D ZEND_DEBUG=0 /D "PHP_WIN32" /D "ZEND_WIN32" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_JAVA" /D HAVE_JAVA=1 /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "NDEBUG"
-# ADD RSC /l 0x40d /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\Release/php_dotnet.dll" /libpath:"$(JAVA_HOME)\lib" /libpath:"..\..\Release"
-
-!ELSEIF "$(CFG)" == "dotnet - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "..\..\Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "PHP_WIN32" /D "ZEND_WIN32" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D "_DEBUG" /D ZEND_DEBUG=1 /D "PHP_WIN32" /D "ZEND_WIN32" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_JAVA" /D HAVE_JAVA=1 /FR /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "_DEBUG"
-# ADD RSC /l 0x40d /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"..\..\Debug/php_dotnet.dll" /pdbtype:sept /libpath:"$(JAVA_HOME)\lib" /libpath:"..\..\Debug"
-
-!ELSEIF "$(CFG)" == "dotnet - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "..\..\Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\..\Zend" /I "$(JAVA_HOME)\include\win32" /I "$(JAVA_HOME)\include" /I "..\..\..\bindlib_w32" /D "_DEBUG" /D "PHP_WIN32" /D "ZEND_WIN32" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_JAVA" /FR /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\..\\" /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D "_DEBUG" /D ZEND_DEBUG=1 /D "ZTS" /D "PHP_WIN32" /D "ZEND_WIN32" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /FR /YX /FD /D /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "_DEBUG"
-# ADD RSC /l 0x40d /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts_debug.lib /nologo /dll /debug /machine:I386 /out:"..\..\Debug_TS/php_dotnet.dll" /pdbtype:sept /libpath:"..\..\Debug_TS"
-
-!ELSEIF "$(CFG)" == "dotnet - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "..\..\Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\..\Zend" /I "$(JAVA_HOME)\include\win32" /I "$(JAVA_HOME)\include" /I "..\..\..\bindlib_w32" /D "NDEBUG" /D "PHP_WIN32" /D "ZEND_WIN32" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_JAVA" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\\" /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D "NDEBUG" /D ZEND_DEBUG=0 /D "ZTS" /D "PHP_WIN32" /D "ZEND_WIN32" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "NDEBUG"
-# ADD RSC /l 0x40d /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_dotnet.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
-
-!ENDIF
-
-# Begin Target
-
-# Name "dotnet - Win32 Release"
-# Name "dotnet - Win32 Debug"
-# Name "dotnet - Win32 Debug_TS"
-# Name "dotnet - Win32 Release_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\dotnet.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\..\..\win32\winutil.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_dotnet.h
-# End Source File
-# End Group
-# Begin Source File
-
-SOURCE=.\README
-# End Source File
-# End Target
-# End Project
diff --git a/ext/dotnet/dotnet.php b/ext/dotnet/dotnet.php
deleted file mode 100644
index 3b0b67c02f..0000000000
--- a/ext/dotnet/dotnet.php
+++ /dev/null
@@ -1,8 +0,0 @@
-<?
- $stack = new DOTNET("mscorlib","System.Collections.Stack");
-
- $stack->Push(".Net");
- $stack->Push("Hello ");
-
- echo $stack->Pop() . $stack->Pop();
-?>
diff --git a/ext/dotnet/php_dotnet.h b/ext/dotnet/php_dotnet.h
deleted file mode 100644
index 570f4bdc7f..0000000000
--- a/ext/dotnet/php_dotnet.h
+++ /dev/null
@@ -1,21 +0,0 @@
-#ifndef PHP_DOTNET_H
-#define PHP_DOTNET_H
-
-#if WIN32|WINNT
-
-extern PHP_MINIT_FUNCTION(DOTNET);
-extern PHP_MSHUTDOWN_FUNCTION(DOTNET);
-PHP_FUNCTION(DOTNET_load);
-
-extern zend_module_entry DOTNET_module_entry;
-#define DOTNET_module_ptr &DOTNET_module_entry
-
-#else
-
-#define DOTNET_module_ptr NULL
-
-#endif /* Win32|WINNT */
-
-#define phpext_DOTNET_ptr DOTNET_module_ptr
-
-#endif /* PHP_DOTNET_H */
diff --git a/ext/ereg/ereg.c b/ext/ereg/ereg.c
deleted file mode 100644
index bcd0111b8a..0000000000
--- a/ext/ereg/ereg.c
+++ /dev/null
@@ -1,670 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
- | Jim Winstead <jimw@php.net> |
- | Jaakko Hyvätti <jaakko@hyvatti.iki.fi> |
- +----------------------------------------------------------------------+
- */
-/* $Id$ */
-
-#include <stdio.h>
-#include "php.h"
-#include "php_string.h"
-#include "reg.h"
-#include "ext/standard/info.h"
-
-#if 0
-zend_module_entry regexp_module_entry = {
- "Regular Expressions",
- reg_functions,
- PHP_MINIT(regex), PHP_MSHUTDOWN(regex),
- NULL, NULL, PHP_MINFO(regex),
- STANDARD_MODULE_PROPERTIES
-};
-#endif
-
-#ifdef ZTS
-int reg_globals_id;
-#else
-static php_reg_globals reg_globals;
-#endif
-
-typedef struct {
- regex_t preg;
- int cflags;
-} reg_cache;
-
-/* {{{ _php_regcomp
- */
-static int _php_regcomp(regex_t *preg, const char *pattern, int cflags)
-{
- int r = 0;
- int patlen = strlen(pattern);
- reg_cache *rc = NULL;
- REGLS_FETCH();
-
- if(zend_hash_find(&REG(ht_rc), (char *) pattern, patlen+1, (void **) &rc) == FAILURE ||
- rc->cflags != cflags) {
- r = regcomp(preg, pattern, cflags);
- if(!r) {
- reg_cache rcp;
-
- rcp.cflags = cflags;
- memcpy(&rcp.preg, preg, sizeof(*preg));
- zend_hash_update(&REG(ht_rc), (char *) pattern, patlen+1,
- (void *) &rcp, sizeof(rcp), NULL);
- }
- } else {
- memcpy(preg, &rc->preg, sizeof(*preg));
- }
-
- return r;
-}
-/* }}} */
-
-static void _free_reg_cache(reg_cache *rc)
-{
- regfree(&rc->preg);
-}
-
-#undef regfree
-#define regfree(a);
-#undef regcomp
-#define regcomp(a,b,c) _php_regcomp(a,b,c)
-
-static void php_reg_init_globals(php_reg_globals *reg_globals)
-{
- zend_hash_init(&reg_globals->ht_rc, 0, NULL, (void (*)(void *)) _free_reg_cache, 1);
-}
-
-PHP_MINIT_FUNCTION(regex)
-{
-#ifdef ZTS
- reg_globals_id = ts_allocate_id(sizeof(php_reg_globals), (ts_allocate_ctor) php_reg_init_globals, NULL);
-#else
- php_reg_init_globals(&reg_globals);
-#endif
-
- return SUCCESS;
-}
-
-PHP_MSHUTDOWN_FUNCTION(regex)
-{
- REGLS_FETCH();
-
- zend_hash_destroy(&REG(ht_rc));
- return SUCCESS;
-}
-
-PHP_MINFO_FUNCTION(regex)
-{
-#if HSREGEX
- php_info_print_table_row(2, "Regex Library", "Bundled library enabled");
-#else
- php_info_print_table_row(2, "Regex Library", "System library enabled");
-#endif
-}
-
-
-/* This is the maximum number of (..) constructs we'll generate from a
- call to ereg() or eregi() with the optional third argument. */
-#define NS 10
-
-/* {{{ php_reg_eprint
- * php_reg_eprint - convert error number to name
- */
-static void php_reg_eprint(int err, regex_t *re) {
- char *buf = NULL, *message = NULL;
- size_t len;
- size_t buf_len;
-
-#ifdef REG_ITOA
- /* get the length of the message */
- buf_len = regerror(REG_ITOA | err, re, NULL, 0);
- if (buf_len) {
- buf = (char *)emalloc(buf_len * sizeof(char));
- if (!buf) return; /* fail silently */
- /* finally, get the error message */
- regerror(REG_ITOA | err, re, buf, buf_len);
- }
-#else
- buf_len = 0;
-#endif
- len = regerror(err, re, NULL, 0);
- if (len) {
- message = (char *)emalloc((buf_len + len + 2) * sizeof(char));
- if (!message) {
- return; /* fail silently */
- }
- if (buf_len) {
- snprintf(message, buf_len, "%s: ", buf);
- buf_len += 1; /* so pointer math below works */
- }
- /* drop the message into place */
- regerror(err, re, message + buf_len, len);
-
- php_error(E_WARNING, "%s", message);
- }
-
- STR_FREE(buf);
- STR_FREE(message);
-}
-/* }}} */
-
-/* {{{ php_ereg
- */
-static void php_ereg(INTERNAL_FUNCTION_PARAMETERS, int icase)
-{
- pval **regex, /* Regular expression */
- **findin, /* String to apply expression to */
- **array = NULL; /* Optional register array */
- regex_t re;
- regmatch_t subs[NS];
- int err, i, match_len, string_len;
- int copts = 0;
- off_t start, end;
- char *buf = NULL;
- char *string = NULL;
-
- if (icase)
- copts |= REG_ICASE;
-
- switch(ZEND_NUM_ARGS()) {
- case 2:
- if (zend_get_parameters_ex(2, &regex, &findin) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- /* don't bother doing substring matching if we're not going
- to make use of the information */
- copts |= REG_NOSUB;
- break;
- case 3:
- if (zend_get_parameters_ex(3, &regex, &findin, &array) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- if (!ParameterPassedByReference(ht, 3)) {
- php_error(E_WARNING, "Array to be filled with values must be passed by reference.");
- RETURN_FALSE;
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- }
-
-
- /* compile the regular expression from the supplied regex */
- if ((*regex)->type == IS_STRING) {
- err = regcomp(&re, (*regex)->value.str.val, REG_EXTENDED | copts);
- } else {
- /* we convert numbers to integers and treat them as a string */
- if ((*regex)->type == IS_DOUBLE)
- convert_to_long_ex(regex); /* get rid of decimal places */
- convert_to_string_ex(regex);
- /* don't bother doing an extended regex with just a number */
- err = regcomp(&re, (*regex)->value.str.val, copts);
- }
-
- if (err) {
- php_reg_eprint(err, &re);
- RETURN_FALSE;
- }
-
- /* make a copy of the string we're looking in */
- convert_to_string_ex(findin);
- string = estrndup((*findin)->value.str.val, (*findin)->value.str.len);
-
- /* actually execute the regular expression */
- err = regexec(&re, string, (size_t) NS, subs, 0);
- if (err && err != REG_NOMATCH) {
- php_reg_eprint(err, &re);
- regfree(&re);
- RETURN_FALSE;
- }
- match_len = 1;
-
- if (array && err != REG_NOMATCH) {
- match_len = (int) (subs[0].rm_eo - subs[0].rm_so);
- string_len = strlen(string) + 1;
-
- buf = emalloc(string_len);
- if (!buf) {
- php_error(E_WARNING, "Unable to allocate memory in php_ereg");
- RETURN_FALSE;
- }
-
- pval_destructor(*array); /* start with clean array */
- array_init(*array);
-
- for (i = 0; i < NS; i++) {
- start = subs[i].rm_so;
- end = subs[i].rm_eo;
- if (start != -1 && end > 0 && start < string_len && end < string_len && start < end) {
- add_index_stringl(*array, i, string+start, end-start, 1);
- } else {
- add_index_bool(*array, i, 0);
- }
- }
- efree(buf);
- }
-
- efree(string);
- if (err == REG_NOMATCH) {
- RETVAL_FALSE;
- } else {
- if (match_len == 0)
- match_len = 1;
- RETVAL_LONG(match_len);
- }
- regfree(&re);
-}
-/* }}} */
-
-/* {{{ proto int ereg(string pattern, string string [, array registers])
- Regular expression match */
-PHP_FUNCTION(ereg)
-{
- php_ereg(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-/* }}} */
-
-/* {{{ proto int eregi(string pattern, string string [, array registers])
- Case-insensitive regular expression match */
-PHP_FUNCTION(eregi)
-{
- php_ereg(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
-}
-/* }}} */
-
-/* {{{ php_reg_replace
- * this is the meat and potatoes of regex replacement! */
-char *php_reg_replace(const char *pattern, const char *replace, const char *string, int icase, int extended)
-{
- regex_t re;
- regmatch_t subs[NS];
-
- char *buf, /* buf is where we build the replaced string */
- *nbuf, /* nbuf is used when we grow the buffer */
- *walkbuf; /* used to walk buf when replacing backrefs */
- const char *walk; /* used to walk replacement string for backrefs */
- int buf_len;
- int pos, tmp, string_len, new_l;
- int err, copts = 0;
-
- string_len = strlen(string);
-
- if (icase)
- copts = REG_ICASE;
- if (extended)
- copts |= REG_EXTENDED;
- err = regcomp(&re, pattern, copts);
- if (err) {
- php_reg_eprint(err, &re);
- return ((char *) -1);
- }
-
- /* start with a buffer that is twice the size of the stringo
- we're doing replacements in */
- buf_len = 2 * string_len + 1;
- buf = emalloc(buf_len * sizeof(char));
- if (!buf) {
- php_error(E_WARNING, "Unable to allocate memory in php_reg_replace");
- regfree(&re);
- return ((char *) -1);
- }
-
- err = pos = 0;
- buf[0] = '\0';
-
- while (!err) {
- err = regexec(&re, &string[pos], (size_t) NS, subs, (pos ? REG_NOTBOL : 0));
-
- if (err && err != REG_NOMATCH) {
- php_reg_eprint(err, &re);
- regfree(&re);
- return ((char *) -1);
- }
- if (!err) {
- /* backref replacement is done in two passes:
- 1) find out how long the string will be, and allocate buf
- 2) copy the part before match, replacement and backrefs to buf
-
- Jaakko Hyvätti <Jaakko.Hyvatti@iki.fi>
- */
-
- new_l = strlen(buf) + subs[0].rm_so; /* part before the match */
- walk = replace;
- while (*walk)
- if ('\\' == *walk
- && '0' <= walk[1] && '9' >= walk[1]
- && subs[walk[1] - '0'].rm_so > -1
- && subs[walk[1] - '0'].rm_eo > -1) {
- new_l += subs[walk[1] - '0'].rm_eo
- - subs[walk[1] - '0'].rm_so;
- walk += 2;
- } else {
- new_l++;
- walk++;
- }
-
- if (new_l + 1 > buf_len) {
- buf_len = 1 + buf_len + 2 * new_l;
- nbuf = emalloc(buf_len);
- strcpy(nbuf, buf);
- efree(buf);
- buf = nbuf;
- }
- tmp = strlen(buf);
- /* copy the part of the string before the match */
- strncat(buf, &string[pos], subs[0].rm_so);
-
- /* copy replacement and backrefs */
- walkbuf = &buf[tmp + subs[0].rm_so];
- walk = replace;
- while (*walk)
- if ('\\' == *walk
- && '0' <= walk[1] && '9' >= walk[1]
- && subs[walk[1] - '0'].rm_so > -1
- && subs[walk[1] - '0'].rm_eo > -1) {
- tmp = subs[walk[1] - '0'].rm_eo
- - subs[walk[1] - '0'].rm_so;
- memcpy (walkbuf,
- &string[pos + subs[walk[1] - '0'].rm_so],
- tmp);
- walkbuf += tmp;
- walk += 2;
- } else
- *walkbuf++ = *walk++;
- *walkbuf = '\0';
-
- /* and get ready to keep looking for replacements */
- if (subs[0].rm_so == subs[0].rm_eo) {
- if (subs[0].rm_so + pos >= string_len)
- break;
- new_l = strlen (buf) + 1;
- if (new_l + 1 > buf_len) {
- buf_len = 1 + buf_len + 2 * new_l;
- nbuf = emalloc(buf_len * sizeof(char));
- strcpy(nbuf, buf);
- efree(buf);
- buf = nbuf;
- }
- pos += subs[0].rm_eo + 1;
- buf [new_l-1] = string [pos-1];
- buf [new_l] = '\0';
- } else {
- pos += subs[0].rm_eo;
- }
- } else { /* REG_NOMATCH */
- new_l = strlen(buf) + strlen(&string[pos]);
- if (new_l + 1 > buf_len) {
- buf_len = new_l + 1; /* now we know exactly how long it is */
- nbuf = emalloc(buf_len * sizeof(char));
- strcpy(nbuf, buf);
- efree(buf);
- buf = nbuf;
- }
- /* stick that last bit of string on our output */
- strcat(buf, &string[pos]);
- }
- }
-
- /* don't want to leak memory .. */
- regfree(&re);
-
- /* whew. */
- return (buf);
-}
-/* }}} */
-
-/* {{{ php_ereg_replace
- */
-static void php_ereg_replace(INTERNAL_FUNCTION_PARAMETERS, int icase)
-{
- pval **arg_pattern,
- **arg_replace,
- **arg_string;
- char *pattern;
- char *string;
- char *replace;
- char *ret;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &arg_pattern, &arg_replace, &arg_string) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if ((*arg_pattern)->type == IS_STRING) {
- if ((*arg_pattern)->value.str.val && (*arg_pattern)->value.str.len)
- pattern = estrndup((*arg_pattern)->value.str.val,(*arg_pattern)->value.str.len);
- else
- pattern = empty_string;
- } else {
- convert_to_long_ex(arg_pattern);
- pattern = emalloc(2);
- pattern[0] = (char) (*arg_pattern)->value.lval;
- pattern[1] = '\0';
- }
-
- if ((*arg_replace)->type == IS_STRING) {
- if ((*arg_replace)->value.str.val && (*arg_replace)->value.str.len)
- replace = estrndup((*arg_replace)->value.str.val, (*arg_replace)->value.str.len);
- else
- replace = empty_string;
- } else {
- convert_to_long_ex(arg_replace);
- replace = emalloc(2);
- replace[0] = (char) (*arg_replace)->value.lval;
- replace[1] = '\0';
- }
-
- convert_to_string_ex(arg_string);
- if ((*arg_string)->value.str.val && (*arg_string)->value.str.len)
- string = estrndup((*arg_string)->value.str.val, (*arg_string)->value.str.len);
- else
- string = empty_string;
-
- /* do the actual work */
- ret = php_reg_replace(pattern, replace, string, icase, 1);
- if (ret == (char *) -1) {
- RETVAL_FALSE;
- } else {
- RETVAL_STRING(ret,1);
- STR_FREE(ret);
- }
- STR_FREE(string);
- STR_FREE(replace);
- STR_FREE(pattern);
-}
-/* }}} */
-
-/* {{{ proto string ereg_replace(string pattern, string replacement, string string)
- Replace regular expression */
-PHP_FUNCTION(ereg_replace)
-{
- php_ereg_replace(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-/* }}} */
-
-/* {{{ proto string eregi_replace(string pattern, string replacement, string string)
- Case insensitive replace regular expression */
-PHP_FUNCTION(eregi_replace)
-{
- php_ereg_replace(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
-}
-/* }}} */
-
-/* {{{ php_split
- */
-static void php_split(INTERNAL_FUNCTION_PARAMETERS, int icase)
-{
- pval **spliton, **str, **arg_count = NULL;
- regex_t re;
- regmatch_t subs[1];
- char *strp, *endp;
- int err, size, count, copts = 0;
-
- if (icase)
- copts = REG_ICASE;
-
- switch (ZEND_NUM_ARGS()) {
- case 2:
- if (zend_get_parameters_ex(2, &spliton, &str) == FAILURE)
- WRONG_PARAM_COUNT;
- count = -1;
- break;
- case 3:
- if (zend_get_parameters_ex(3, &spliton, &str, &arg_count) == FAILURE)
- WRONG_PARAM_COUNT;
- convert_to_long_ex(arg_count);
- count = (*arg_count)->value.lval;
- break;
- default:
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(spliton);
- convert_to_string_ex(str);
-
- strp = (*str)->value.str.val;
- endp = (*str)->value.str.val + strlen((*str)->value.str.val);
-
- err = regcomp(&re, (*spliton)->value.str.val, REG_EXTENDED | copts);
- if (err) {
- php_error(E_WARNING, "unexpected regex error (%d)", err);
- RETURN_FALSE;
- }
-
- if (array_init(return_value) == FAILURE) {
- regfree(&re);
- RETURN_FALSE;
- }
-
- /* churn through str, generating array entries as we go */
- while ((count == -1 || count > 1) && !(err = regexec(&re, strp, 1, subs, 0))) {
- if (subs[0].rm_so == 0 && subs[0].rm_eo) {
- /* match is at start of string, return empty string */
- add_next_index_stringl(return_value, empty_string, 0, 1);
- /* skip ahead the length of the regex match */
- strp+=subs[0].rm_eo;
- } else if (subs[0].rm_so==0 && subs[0].rm_eo==0) {
- /* No more matches */
- regfree(&re);
- php_error(E_WARNING, "bad regular expression for split()");
- zend_hash_destroy(return_value->value.ht);
- efree(return_value->value.ht);
- RETURN_FALSE;
- } else {
- /* On a real match */
-
- /* make a copy of the substring */
- size = subs[0].rm_so;
-
- /* add it to the array */
- add_next_index_stringl(return_value, strp, size, 1);
-
- /* point at our new starting point */
- strp = strp + subs[0].rm_eo;
- }
-
- /* if we're only looking for a certain number of points,
- stop looking once we hit it */
- if (count != -1) {
- count--;
- }
- }
-
- /* see if we encountered an error */
- if (err && err != REG_NOMATCH) {
- php_error(E_WARNING, "unexpected regex error (%d)", err);
- regfree(&re);
- zend_hash_destroy(return_value->value.ht);
- efree(return_value->value.ht);
- RETURN_FALSE;
- }
-
- /* otherwise we just have one last element to add to the array */
- size = endp - strp;
-
- add_next_index_stringl(return_value, strp, size, 1);
-
- regfree(&re);
-}
-/* }}} */
-
-/* ("root", "passwd", "uid", "gid", "other:stuff:like:/bin/sh")
- = split(":", $passwd_file, 5); */
-/* {{{ proto array split(string pattern, string string [, int limit])
- Split string into array by regular expression */
-
-PHP_FUNCTION(split)
-{
- php_split(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-
-/* }}} */
-
-/* {{{ proto array spliti(string pattern, string string [, int limit])
- Split string into array by regular expression case-insensitive */
-
-PHP_FUNCTION(spliti)
-{
- php_split(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
-}
-
-/* }}} */
-
-/* {{{ proto string sql_regcase(string string)
- Make regular expression for case insensitive match */
-PHPAPI PHP_FUNCTION(sql_regcase)
-{
- pval **string;
- char *tmp;
- unsigned char c;
- register int i, j;
-
- if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &string)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(string);
-
- tmp = (char *) emalloc((*string)->value.str.len*4+1);
-
- for (i=j=0; i<(*string)->value.str.len; i++) {
- c = (unsigned char) (*string)->value.str.val[i];
- if(isalpha(c)) {
- tmp[j++] = '[';
- tmp[j++] = toupper(c);
- tmp[j++] = tolower(c);
- tmp[j++] = ']';
- } else {
- tmp[j++] = c;
- }
- }
- tmp[j]=0;
-
- tmp = erealloc(tmp, j + 1);
-
- RETVAL_STRINGL(tmp, j, 0);
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/ereg/php_ereg.h b/ext/ereg/php_ereg.h
deleted file mode 100644
index cb34b15e7c..0000000000
--- a/ext/ereg/php_ereg.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
- +----------------------------------------------------------------------+
-*/
-
-
-/* $Id$ */
-
-#ifndef REG_H
-#define REG_H
-
-char *php_reg_replace(const char *pattern, const char *replace, const char *string, int icase, int extended);
-
-PHP_FUNCTION(ereg);
-PHP_FUNCTION(eregi);
-PHP_FUNCTION(eregi_replace);
-PHP_FUNCTION(ereg_replace);
-PHP_FUNCTION(split);
-PHP_FUNCTION(spliti);
-PHPAPI PHP_FUNCTION(sql_regcase);
-
-typedef struct {
- HashTable ht_rc;
-} php_reg_globals;
-
-PHP_MINIT_FUNCTION(regex);
-PHP_MSHUTDOWN_FUNCTION(regex);
-PHP_MINFO_FUNCTION(regex);
-
-
-#ifdef ZTS
-#define REGLS_D php_reg_globals *reg_globals
-#define REGLS_DC , REGLS_D
-#define REGLS_C reg_globals
-#define REGLS_CC , REGLS_C
-#define REG(v) (reg_globals->v)
-#define REGLS_FETCH() php_reg_globals *reg_globals = ts_resource(reg_globals_id)
-#else
-#define REGLS_D
-#define REGLS_DC
-#define REGLS_C
-#define REGLS_CC
-#define REG(v) (reg_globals.v)
-#define REGLS_FETCH()
-#endif
-
-#endif /* REG_H */
diff --git a/ext/ereg/php_regex.h b/ext/ereg/php_regex.h
deleted file mode 100644
index c1d1e0c232..0000000000
--- a/ext/ereg/php_regex.h
+++ /dev/null
@@ -1,45 +0,0 @@
-#ifndef PHP_REGEX_H
-#define PHP_REGEX_H
-
-/*
- * REGEX means:
- * 0.. system regex
- * 1.. bundled regex
- */
-
-#if REGEX
-/* get aliases */
-#include "regex/regex_extra.h"
-#include "regex/regex.h"
-
-/* get rid of aliases */
-#define PHP_NO_ALIASES
-#include "regex/regex_extra.h"
-#undef PHP_NO_ALIASES
-
-#undef _PCREPOSIX_H
-#define _PCREPOSIX_H 1
-
-#ifndef _REGEX_H
-#define _REGEX_H 1 /* this should stop Apache from loading the system version of regex.h */
-#endif
-#ifndef _REGEX_H_
-#define _REGEX_H_ 1
-#endif
-#ifndef _RX_H
-#define _RX_H 1 /* Try defining these for Linux to */
-#endif
-#ifndef __REGEXP_LIBRARY_H__
-#define __REGEXP_LIBRARY_H__ 1 /* avoid Apache including regex.h */
-#endif
-#ifndef _H_REGEX
-#define _H_REGEX 1 /* This one is for AIX */
-#endif
-#elif REGEX == 0
-#include <regex.h>
-#ifndef _REGEX_H_
-#define _REGEX_H_ 1
-#endif
-#endif
-
-#endif /* PHP_REGEX_H */
diff --git a/ext/ereg/regex/COPYRIGHT b/ext/ereg/regex/COPYRIGHT
deleted file mode 100644
index d43362fbfc..0000000000
--- a/ext/ereg/regex/COPYRIGHT
+++ /dev/null
@@ -1,20 +0,0 @@
-Copyright 1992, 1993, 1994 Henry Spencer. All rights reserved.
-This software is not subject to any license of the American Telephone
-and Telegraph Company or of the Regents of the University of California.
-
-Permission is granted to anyone to use this software for any purpose on
-any computer system, and to alter it and redistribute it, subject
-to the following restrictions:
-
-1. The author is not responsible for the consequences of use of this
- software, no matter how awful, even if they arise from flaws in it.
-
-2. The origin of this software must not be misrepresented, either by
- explicit claim or by omission. Since few users ever read sources,
- credits must appear in the documentation.
-
-3. Altered versions must be plainly marked as such, and must not be
- misrepresented as being the original software. Since few users
- ever read sources, credits must appear in the documentation.
-
-4. This notice may not be removed or altered.
diff --git a/ext/ereg/regex/Makefile.in b/ext/ereg/regex/Makefile.in
deleted file mode 100644
index 27b0331b9b..0000000000
--- a/ext/ereg/regex/Makefile.in
+++ /dev/null
@@ -1,5 +0,0 @@
-
-LTLIBRARY_NAME = libregex.la
-LTLIBRARY_SOURCES = regcomp.c regexec.c regerror.c regfree.c
-
-include $(top_srcdir)/build/ltlib.mk
diff --git a/ext/ereg/regex/README b/ext/ereg/regex/README
deleted file mode 100644
index cea9b67b66..0000000000
--- a/ext/ereg/regex/README
+++ /dev/null
@@ -1,32 +0,0 @@
-alpha3.4 release.
-Thu Mar 17 23:17:18 EST 1994
-henry@zoo.toronto.edu
-
-See WHATSNEW for change listing.
-
-installation notes:
---------
-Read the comments at the beginning of Makefile before running.
-
-Utils.h contains some things that just might have to be modified on
-some systems, as well as a nested include (ugh) of <assert.h>.
-
-The "fake" directory contains quick-and-dirty fakes for some header
-files and routines that old systems may not have. Note also that
--DUSEBCOPY will make utils.h substitute bcopy() for memmove().
-
-After that, "make r" will build regcomp.o, regexec.o, regfree.o,
-and regerror.o (the actual routines), bundle them together into a test
-program, and run regression tests on them. No output is good output.
-
-"make lib" builds just the .o files for the actual routines (when
-you're happy with testing and have adjusted CFLAGS for production),
-and puts them together into libregex.a. You can pick up either the
-library or *.o ("make lib" makes sure there are no other .o files left
-around to confuse things).
-
-Main.c, debug.c, split.c are used for regression testing but are not part
-of the RE routines themselves.
-
-Regex.h goes in /usr/include. All other .h files are internal only.
---------
diff --git a/ext/ereg/regex/WHATSNEW b/ext/ereg/regex/WHATSNEW
deleted file mode 100644
index 6e82e1dae0..0000000000
--- a/ext/ereg/regex/WHATSNEW
+++ /dev/null
@@ -1,92 +0,0 @@
-New in alpha3.4: The complex bug alluded to below has been fixed (in a
-slightly kludgey temporary way that may hurt efficiency a bit; this is
-another "get it out the door for 4.4" release). The tests at the end of
-the tests file have accordingly been uncommented. The primary sign of
-the bug was that something like a?b matching ab matched b rather than ab.
-(The bug was essentially specific to this exact situation, else it would
-have shown up earlier.)
-
-New in alpha3.3: The definition of word boundaries has been altered
-slightly, to more closely match the usual programming notion that "_"
-is an alphabetic. Stuff used for pre-ANSI systems is now in a subdir,
-and the makefile no longer alludes to it in mysterious ways. The
-makefile has generally been cleaned up some. Fixes have been made
-(again!) so that the regression test will run without -DREDEBUG, at
-the cost of weaker checking. A workaround for a bug in some folks'
-<assert.h> has been added. And some more things have been added to
-tests, including a couple right at the end which are commented out
-because the code currently flunks them (complex bug; fix coming).
-Plus the usual minor cleanup.
-
-New in alpha3.2: Assorted bits of cleanup and portability improvement
-(the development base is now a BSDI system using GCC instead of an ancient
-Sun system, and the newer compiler exposed some glitches). Fix for a
-serious bug that affected REs using many [] (including REG_ICASE REs
-because of the way they are implemented), *sometimes*, depending on
-memory-allocation patterns. The header-file prototypes no longer name
-the parameters, avoiding possible name conflicts. The possibility that
-some clot has defined CHAR_MIN as (say) `-128' instead of `(-128)' is
-now handled gracefully. "uchar" is no longer used as an internal type
-name (too many people have the same idea). Still the same old lousy
-performance, alas.
-
-New in alpha3.1: Basically nothing, this release is just a bookkeeping
-convenience. Stay tuned.
-
-New in alpha3.0: Performance is no better, alas, but some fixes have been
-made and some functionality has been added. (This is basically the "get
-it out the door in time for 4.4" release.) One bug fix: regfree() didn't
-free the main internal structure (how embarrassing). It is now possible
-to put NULs in either the RE or the target string, using (resp.) a new
-REG_PEND flag and the old REG_STARTEND flag. The REG_NOSPEC flag to
-regcomp() makes all characters ordinary, so you can match a literal
-string easily (this will become more useful when performance improves!).
-There are now primitives to match beginnings and ends of words, although
-the syntax is disgusting and so is the implementation. The REG_ATOI
-debugging interface has changed a bit. And there has been considerable
-internal cleanup of various kinds.
-
-New in alpha2.3: Split change list out of README, and moved flags notes
-into Makefile. Macro-ized the name of regex(7) in regex(3), since it has
-to change for 4.4BSD. Cleanup work in engine.c, and some new regression
-tests to catch tricky cases thereof.
-
-New in alpha2.2: Out-of-date manpages updated. Regerror() acquires two
-small extensions -- REG_ITOA and REG_ATOI -- which avoid debugging kludges
-in my own test program and might be useful to others for similar purposes.
-The regression test will now compile (and run) without REDEBUG. The
-BRE \$ bug is fixed. Most uses of "uchar" are gone; it's all chars now.
-Char/uchar parameters are now written int/unsigned, to avoid possible
-portability problems with unpromoted parameters. Some unsigned casts have
-been introduced to minimize portability problems with shifting into sign
-bits.
-
-New in alpha2.1: Lots of little stuff, cleanup and fixes. The one big
-thing is that regex.h is now generated, using mkh, rather than being
-supplied in the distribution; due to circularities in dependencies,
-you have to build regex.h explicitly by "make h". The two known bugs
-have been fixed (and the regression test now checks for them), as has a
-problem with assertions not being suppressed in the absence of REDEBUG.
-No performance work yet.
-
-New in alpha2: Backslash-anything is an ordinary character, not an
-error (except, of course, for the handful of backslashed metacharacters
-in BREs), which should reduce script breakage. The regression test
-checks *where* null strings are supposed to match, and has generally
-been tightened up somewhat. Small bug fixes in parameter passing (not
-harmful, but technically errors) and some other areas. Debugging
-invoked by defining REDEBUG rather than not defining NDEBUG.
-
-New in alpha+3: full prototyping for internal routines, using a little
-helper program, mkh, which extracts prototypes given in stylized comments.
-More minor cleanup. Buglet fix: it's CHAR_BIT, not CHAR_BITS. Simple
-pre-screening of input when a literal string is known to be part of the
-RE; this does wonders for performance.
-
-New in alpha+2: minor bits of cleanup. Notably, the number "32" for the
-word width isn't hardwired into regexec.c any more, the public header
-file prototypes the functions if __STDC__ is defined, and some small typos
-in the manpages have been fixed.
-
-New in alpha+1: improvements to the manual pages, and an important
-extension, the REG_STARTEND option to regexec().
diff --git a/ext/ereg/regex/cclass.h b/ext/ereg/regex/cclass.h
deleted file mode 100644
index 6227f810b7..0000000000
--- a/ext/ereg/regex/cclass.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/* character-class table */
-static struct cclass {
- char *name;
- char *chars;
- char *multis;
-} cclasses[] = {
- {"alnum", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", ""},
- {"alpha", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",
- ""},
- {"blank", " \t", ""},
- {"cntrl", "\007\b\t\n\v\f\r\1\2\3\4\5\6\16\17\20\21\22\23\24\
-\25\26\27\30\31\32\33\34\35\36\37\177", ""},
- {"digit", "0123456789", ""},
- {"graph", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\
-0123456789!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~",
- ""},
- {"lower", "abcdefghijklmnopqrstuvwxyz",
- ""},
- {"print", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\
-0123456789!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~ ",
- ""},
- {"punct", "!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~",
- ""},
- {"space", "\t\n\v\f\r ", ""},
- {"upper", "ABCDEFGHIJKLMNOPQRSTUVWXYZ",
- ""},
- {"xdigit", "0123456789ABCDEFabcdef",
- ""},
- {NULL, 0, ""}
-};
diff --git a/ext/ereg/regex/cname.h b/ext/ereg/regex/cname.h
deleted file mode 100644
index 670b273882..0000000000
--- a/ext/ereg/regex/cname.h
+++ /dev/null
@@ -1,102 +0,0 @@
-/* character-name table */
-static struct cname {
- char *name;
- char code;
-} cnames[] = {
- {"NUL", '\0'},
- {"SOH", '\001'},
- {"STX", '\002'},
- {"ETX", '\003'},
- {"EOT", '\004'},
- {"ENQ", '\005'},
- {"ACK", '\006'},
- {"BEL", '\007'},
- {"alert", '\007'},
- {"BS", '\010'},
- {"backspace", '\b'},
- {"HT", '\011'},
- {"tab", '\t'},
- {"LF", '\012'},
- {"newline", '\n'},
- {"VT", '\013'},
- {"vertical-tab", '\v'},
- {"FF", '\014'},
- {"form-feed", '\f'},
- {"CR", '\015'},
- {"carriage-return", '\r'},
- {"SO", '\016'},
- {"SI", '\017'},
- {"DLE", '\020'},
- {"DC1", '\021'},
- {"DC2", '\022'},
- {"DC3", '\023'},
- {"DC4", '\024'},
- {"NAK", '\025'},
- {"SYN", '\026'},
- {"ETB", '\027'},
- {"CAN", '\030'},
- {"EM", '\031'},
- {"SUB", '\032'},
- {"ESC", '\033'},
- {"IS4", '\034'},
- {"FS", '\034'},
- {"IS3", '\035'},
- {"GS", '\035'},
- {"IS2", '\036'},
- {"RS", '\036'},
- {"IS1", '\037'},
- {"US", '\037'},
- {"space", ' '},
- {"exclamation-mark", '!'},
- {"quotation-mark", '"'},
- {"number-sign", '#'},
- {"dollar-sign", '$'},
- {"percent-sign", '%'},
- {"ampersand", '&'},
- {"apostrophe", '\''},
- {"left-parenthesis", '('},
- {"right-parenthesis", ')'},
- {"asterisk", '*'},
- {"plus-sign", '+'},
- {"comma", ','},
- {"hyphen", '-'},
- {"hyphen-minus", '-'},
- {"period", '.'},
- {"full-stop", '.'},
- {"slash", '/'},
- {"solidus", '/'},
- {"zero", '0'},
- {"one", '1'},
- {"two", '2'},
- {"three", '3'},
- {"four", '4'},
- {"five", '5'},
- {"six", '6'},
- {"seven", '7'},
- {"eight", '8'},
- {"nine", '9'},
- {"colon", ':'},
- {"semicolon", ';'},
- {"less-than-sign", '<'},
- {"equals-sign", '='},
- {"greater-than-sign", '>'},
- {"question-mark", '?'},
- {"commercial-at", '@'},
- {"left-square-bracket", '['},
- {"backslash", '\\'},
- {"reverse-solidus", '\\'},
- {"right-square-bracket", ']'},
- {"circumflex", '^'},
- {"circumflex-accent", '^'},
- {"underscore", '_'},
- {"low-line", '_'},
- {"grave-accent", '`'},
- {"left-brace", '{'},
- {"left-curly-bracket", '{'},
- {"vertical-line", '|'},
- {"right-brace", '}'},
- {"right-curly-bracket", '}'},
- {"tilde", '~'},
- {"DEL", '\177'},
- {NULL, 0},
-};
diff --git a/ext/ereg/regex/debug.c b/ext/ereg/regex/debug.c
deleted file mode 100644
index c0feaeb169..0000000000
--- a/ext/ereg/regex/debug.c
+++ /dev/null
@@ -1,242 +0,0 @@
-#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
-#include <limits.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <regex.h>
-
-#include "utils.h"
-#include "regex2.h"
-#include "debug.ih"
-
-/*
- - regprint - print a regexp for debugging
- == void regprint(regex_t *r, FILE *d);
- */
-void
-regprint(r, d)
-regex_t *r;
-FILE *d;
-{
- register struct re_guts *g = r->re_g;
- register int i;
- register int c;
- register int last;
- int nincat[NC];
-
- fprintf(d, "%ld states, %d categories", (long)g->nstates,
- g->ncategories);
- fprintf(d, ", first %ld last %ld", (long)g->firststate,
- (long)g->laststate);
- if (g->iflags&USEBOL)
- fprintf(d, ", USEBOL");
- if (g->iflags&USEEOL)
- fprintf(d, ", USEEOL");
- if (g->iflags&BAD)
- fprintf(d, ", BAD");
- if (g->nsub > 0)
- fprintf(d, ", nsub=%ld", (long)g->nsub);
- if (g->must != NULL)
- fprintf(d, ", must(%ld) `%*s'", (long)g->mlen, (int)g->mlen,
- g->must);
- if (g->backrefs)
- fprintf(d, ", backrefs");
- if (g->nplus > 0)
- fprintf(d, ", nplus %ld", (long)g->nplus);
- fprintf(d, "\n");
- s_print(g, d);
- for (i = 0; i < g->ncategories; i++) {
- nincat[i] = 0;
- for (c = CHAR_MIN; c <= CHAR_MAX; c++)
- if (g->categories[c] == i)
- nincat[i]++;
- }
- fprintf(d, "cc0#%d", nincat[0]);
- for (i = 1; i < g->ncategories; i++)
- if (nincat[i] == 1) {
- for (c = CHAR_MIN; c <= CHAR_MAX; c++)
- if (g->categories[c] == i)
- break;
- fprintf(d, ", %d=%s", i, regchar(c));
- }
- fprintf(d, "\n");
- for (i = 1; i < g->ncategories; i++)
- if (nincat[i] != 1) {
- fprintf(d, "cc%d\t", i);
- last = -1;
- for (c = CHAR_MIN; c <= CHAR_MAX+1; c++) /* +1 does flush */
- if (c <= CHAR_MAX && g->categories[c] == i) {
- if (last < 0) {
- fprintf(d, "%s", regchar(c));
- last = c;
- }
- } else {
- if (last >= 0) {
- if (last != c-1)
- fprintf(d, "-%s",
- regchar(c-1));
- last = -1;
- }
- }
- fprintf(d, "\n");
- }
-}
-
-/*
- - s_print - print the strip for debugging
- == static void s_print(register struct re_guts *g, FILE *d);
- */
-static void
-s_print(g, d)
-register struct re_guts *g;
-FILE *d;
-{
- register sop *s;
- register cset *cs;
- register int i;
- register int done = 0;
- register sop opnd;
- register int col = 0;
- register int last;
- register sopno offset = 2;
-# define GAP() { if (offset % 5 == 0) { \
- if (col > 40) { \
- fprintf(d, "\n\t"); \
- col = 0; \
- } else { \
- fprintf(d, " "); \
- col++; \
- } \
- } else \
- col++; \
- offset++; \
- }
-
- if (OP(g->strip[0]) != OEND)
- fprintf(d, "missing initial OEND!\n");
- for (s = &g->strip[1]; !done; s++) {
- opnd = OPND(*s);
- switch (OP(*s)) {
- case OEND:
- fprintf(d, "\n");
- done = 1;
- break;
- case OCHAR:
- if (strchr("\\|()^$.[+*?{}!<> ", (char)opnd) != NULL)
- fprintf(d, "\\%c", (char)opnd);
- else
- fprintf(d, "%s", regchar((char)opnd));
- break;
- case OBOL:
- fprintf(d, "^");
- break;
- case OEOL:
- fprintf(d, "$");
- break;
- case OBOW:
- fprintf(d, "\\{");
- break;
- case OEOW:
- fprintf(d, "\\}");
- break;
- case OANY:
- fprintf(d, ".");
- break;
- case OANYOF:
- fprintf(d, "[(%ld)", (long)opnd);
- cs = &g->sets[opnd];
- last = -1;
- for (i = 0; i < g->csetsize+1; i++) /* +1 flushes */
- if (CHIN(cs, i) && i < g->csetsize) {
- if (last < 0) {
- fprintf(d, "%s", regchar(i));
- last = i;
- }
- } else {
- if (last >= 0) {
- if (last != i-1)
- fprintf(d, "-%s",
- regchar(i-1));
- last = -1;
- }
- }
- fprintf(d, "]");
- break;
- case OBACK_:
- fprintf(d, "(\\<%ld>", (long)opnd);
- break;
- case O_BACK:
- fprintf(d, "<%ld>\\)", (long)opnd);
- break;
- case OPLUS_:
- fprintf(d, "(+");
- if (OP(*(s+opnd)) != O_PLUS)
- fprintf(d, "<%ld>", (long)opnd);
- break;
- case O_PLUS:
- if (OP(*(s-opnd)) != OPLUS_)
- fprintf(d, "<%ld>", (long)opnd);
- fprintf(d, "+)");
- break;
- case OQUEST_:
- fprintf(d, "(?");
- if (OP(*(s+opnd)) != O_QUEST)
- fprintf(d, "<%ld>", (long)opnd);
- break;
- case O_QUEST:
- if (OP(*(s-opnd)) != OQUEST_)
- fprintf(d, "<%ld>", (long)opnd);
- fprintf(d, "?)");
- break;
- case OLPAREN:
- fprintf(d, "((<%ld>", (long)opnd);
- break;
- case ORPAREN:
- fprintf(d, "<%ld>))", (long)opnd);
- break;
- case OCH_:
- fprintf(d, "<");
- if (OP(*(s+opnd)) != OOR2)
- fprintf(d, "<%ld>", (long)opnd);
- break;
- case OOR1:
- if (OP(*(s-opnd)) != OOR1 && OP(*(s-opnd)) != OCH_)
- fprintf(d, "<%ld>", (long)opnd);
- fprintf(d, "|");
- break;
- case OOR2:
- fprintf(d, "|");
- if (OP(*(s+opnd)) != OOR2 && OP(*(s+opnd)) != O_CH)
- fprintf(d, "<%ld>", (long)opnd);
- break;
- case O_CH:
- if (OP(*(s-opnd)) != OOR1)
- fprintf(d, "<%ld>", (long)opnd);
- fprintf(d, ">");
- break;
- default:
- fprintf(d, "!%ld(%ld)!", OP(*s), opnd);
- break;
- }
- if (!done)
- GAP();
- }
-}
-
-/*
- - regchar - make a character printable
- == static char *regchar(int ch);
- */
-static char * /* -> representation */
-regchar(ch)
-int ch;
-{
- static char buf[10];
-
- if (isprint(ch) || ch == ' ')
- sprintf(buf, "%c", ch);
- else
- sprintf(buf, "\\%o", ch);
- return(buf);
-}
diff --git a/ext/ereg/regex/debug.ih b/ext/ereg/regex/debug.ih
deleted file mode 100644
index 5f40ff7917..0000000000
--- a/ext/ereg/regex/debug.ih
+++ /dev/null
@@ -1,14 +0,0 @@
-/* ========= begin header generated by ./mkh ========= */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* === debug.c === */
-void regprint(regex_t *r, FILE *d);
-static void s_print(register struct re_guts *g, FILE *d);
-static char *regchar(int ch);
-
-#ifdef __cplusplus
-}
-#endif
-/* ========= end header generated by ./mkh ========= */
diff --git a/ext/ereg/regex/engine.c b/ext/ereg/regex/engine.c
deleted file mode 100644
index 0b88dcf1ed..0000000000
--- a/ext/ereg/regex/engine.c
+++ /dev/null
@@ -1,1019 +0,0 @@
-/*
- * The matching engine and friends. This file is #included by regexec.c
- * after suitable #defines of a variety of macros used herein, so that
- * different state representations can be used without duplicating masses
- * of code.
- */
-
-#ifdef SNAMES
-#define matcher smatcher
-#define fast sfast
-#define slow sslow
-#define dissect sdissect
-#define backref sbackref
-#define step sstep
-#define print sprint
-#define at sat
-#define match smat
-#endif
-#ifdef LNAMES
-#define matcher lmatcher
-#define fast lfast
-#define slow lslow
-#define dissect ldissect
-#define backref lbackref
-#define step lstep
-#define print lprint
-#define at lat
-#define match lmat
-#endif
-
-/* another structure passed up and down to avoid zillions of parameters */
-struct match {
- struct re_guts *g;
- int eflags;
- regmatch_t *pmatch; /* [nsub+1] (0 element unused) */
- char *offp; /* offsets work from here */
- char *beginp; /* start of string -- virtual NUL precedes */
- char *endp; /* end of string -- virtual NUL here */
- char *coldp; /* can be no match starting before here */
- char **lastpos; /* [nplus+1] */
- STATEVARS;
- states st; /* current states */
- states fresh; /* states for a fresh start */
- states tmp; /* temporary */
- states empty; /* empty set of states */
-};
-
-#include "engine.ih"
-
-#ifdef REDEBUG
-#define SP(t, s, c) print(m, t, s, c, stdout)
-#define AT(t, p1, p2, s1, s2) at(m, t, p1, p2, s1, s2)
-#define NOTE(str) { if (m->eflags&REG_TRACE) printf("=%s\n", (str)); }
-#else
-#define SP(t, s, c) /* nothing */
-#define AT(t, p1, p2, s1, s2) /* nothing */
-#define NOTE(s) /* nothing */
-#endif
-
-/*
- - matcher - the actual matching engine
- == static int matcher(register struct re_guts *g, char *string, \
- == size_t nmatch, regmatch_t pmatch[], int eflags);
- */
-static int /* 0 success, REG_NOMATCH failure */
-matcher(g, string, nmatch, pmatch, eflags)
-register struct re_guts *g;
-char *string;
-size_t nmatch;
-regmatch_t pmatch[];
-int eflags;
-{
- register char *endp;
- register size_t i;
- struct match mv;
- register struct match *m = &mv;
- register char *dp;
- const register sopno gf = g->firststate+1; /* +1 for OEND */
- const register sopno gl = g->laststate;
- char *start;
- char *stop;
-
- /* simplify the situation where possible */
- if (g->cflags&REG_NOSUB)
- nmatch = 0;
- if (eflags&REG_STARTEND) {
- start = string + pmatch[0].rm_so;
- stop = string + pmatch[0].rm_eo;
- } else {
- start = string;
- stop = start + strlen(start);
- }
- if (stop < start)
- return(REG_INVARG);
-
- /* prescreening; this does wonders for this rather slow code */
- if (g->must != NULL) {
- for (dp = start; dp < stop; dp++)
- if (*dp == g->must[0] && stop - dp >= g->mlen &&
- memcmp(dp, g->must, (size_t)g->mlen) == 0)
- break;
- if (dp == stop) /* we didn't find g->must */
- return(REG_NOMATCH);
- }
-
- /* match struct setup */
- m->g = g;
- m->eflags = eflags;
- m->pmatch = NULL;
- m->lastpos = NULL;
- m->offp = string;
- m->beginp = start;
- m->endp = stop;
- STATESETUP(m, 4);
- SETUP(m->st);
- SETUP(m->fresh);
- SETUP(m->tmp);
- SETUP(m->empty);
- CLEAR(m->empty);
-
- /* this loop does only one repetition except for backrefs */
- for (;;) {
- endp = fast(m, start, stop, gf, gl);
- if (endp == NULL) { /* a miss */
- STATETEARDOWN(m);
- return(REG_NOMATCH);
- }
- if (nmatch == 0 && !g->backrefs)
- break; /* no further info needed */
-
- /* where? */
- assert(m->coldp != NULL);
- for (;;) {
- NOTE("finding start");
- endp = slow(m, m->coldp, stop, gf, gl);
- if (endp != NULL)
- break;
- assert(m->coldp < m->endp);
- m->coldp++;
- }
- if (nmatch == 1 && !g->backrefs)
- break; /* no further info needed */
-
- /* oh my, he wants the subexpressions... */
- if (m->pmatch == NULL)
- m->pmatch = (regmatch_t *)malloc((m->g->nsub + 1) *
- sizeof(regmatch_t));
- if (m->pmatch == NULL) {
- STATETEARDOWN(m);
- return(REG_ESPACE);
- }
- for (i = 1; i <= m->g->nsub; i++)
- m->pmatch[i].rm_so = m->pmatch[i].rm_eo = -1;
- if (!g->backrefs && !(m->eflags&REG_BACKR)) {
- NOTE("dissecting");
- dp = dissect(m, m->coldp, endp, gf, gl);
- } else {
- if (g->nplus > 0 && m->lastpos == NULL)
- m->lastpos = (char **)malloc((g->nplus+1) *
- sizeof(char *));
- if (g->nplus > 0 && m->lastpos == NULL) {
- free(m->pmatch);
- STATETEARDOWN(m);
- return(REG_ESPACE);
- }
- NOTE("backref dissect");
- dp = backref(m, m->coldp, endp, gf, gl, (sopno)0);
- }
- if (dp != NULL)
- break;
-
- /* uh-oh... we couldn't find a subexpression-level match */
- assert(g->backrefs); /* must be back references doing it */
- assert(g->nplus == 0 || m->lastpos != NULL);
- for (;;) {
- if (dp != NULL || endp <= m->coldp)
- break; /* defeat */
- NOTE("backoff");
- endp = slow(m, m->coldp, endp-1, gf, gl);
- if (endp == NULL)
- break; /* defeat */
- /* try it on a shorter possibility */
-#ifndef NDEBUG
- for (i = 1; i <= m->g->nsub; i++) {
- assert(m->pmatch[i].rm_so == -1);
- assert(m->pmatch[i].rm_eo == -1);
- }
-#endif
- NOTE("backoff dissect");
- dp = backref(m, m->coldp, endp, gf, gl, (sopno)0);
- }
- assert(dp == NULL || dp == endp);
- if (dp != NULL) /* found a shorter one */
- break;
-
- /* despite initial appearances, there is no match here */
- NOTE("false alarm");
- start = m->coldp + 1; /* recycle starting later */
- assert(start <= stop);
- }
-
- /* fill in the details if requested */
- if (nmatch > 0) {
- pmatch[0].rm_so = m->coldp - m->offp;
- pmatch[0].rm_eo = endp - m->offp;
- }
- if (nmatch > 1) {
- assert(m->pmatch != NULL);
- for (i = 1; i < nmatch; i++)
- if (i <= m->g->nsub)
- pmatch[i] = m->pmatch[i];
- else {
- pmatch[i].rm_so = -1;
- pmatch[i].rm_eo = -1;
- }
- }
-
- if (m->pmatch != NULL)
- free((char *)m->pmatch);
- if (m->lastpos != NULL)
- free((char *)m->lastpos);
- STATETEARDOWN(m);
- return(0);
-}
-
-/*
- - dissect - figure out what matched what, no back references
- == static char *dissect(register struct match *m, char *start, \
- == char *stop, sopno startst, sopno stopst);
- */
-static char * /* == stop (success) always */
-dissect(m, start, stop, startst, stopst)
-register struct match *m;
-char *start;
-char *stop;
-sopno startst;
-sopno stopst;
-{
- register int i;
- register sopno ss; /* start sop of current subRE */
- register sopno es; /* end sop of current subRE */
- register char *sp; /* start of string matched by it */
- register char *stp; /* string matched by it cannot pass here */
- register char *rest; /* start of rest of string */
- register char *tail; /* string unmatched by rest of RE */
- register sopno ssub; /* start sop of subsubRE */
- register sopno esub; /* end sop of subsubRE */
- register char *ssp; /* start of string matched by subsubRE */
- register char *sep; /* end of string matched by subsubRE */
- register char *oldssp; /* previous ssp */
- register char *dp;
-
- AT("diss", start, stop, startst, stopst);
- sp = start;
- for (ss = startst; ss < stopst; ss = es) {
- /* identify end of subRE */
- es = ss;
- switch (OP(m->g->strip[es])) {
- case OPLUS_:
- case OQUEST_:
- es += OPND(m->g->strip[es]);
- break;
- case OCH_:
- while (OP(m->g->strip[es]) != O_CH)
- es += OPND(m->g->strip[es]);
- break;
- }
- es++;
-
- /* figure out what it matched */
- switch (OP(m->g->strip[ss])) {
- case OEND:
- assert(nope);
- break;
- case OCHAR:
- sp++;
- break;
- case OBOL:
- case OEOL:
- case OBOW:
- case OEOW:
- break;
- case OANY:
- case OANYOF:
- sp++;
- break;
- case OBACK_:
- case O_BACK:
- assert(nope);
- break;
- /* cases where length of match is hard to find */
- case OQUEST_:
- stp = stop;
- for (;;) {
- /* how long could this one be? */
- rest = slow(m, sp, stp, ss, es);
- assert(rest != NULL); /* it did match */
- /* could the rest match the rest? */
- tail = slow(m, rest, stop, es, stopst);
- if (tail == stop)
- break; /* yes! */
- /* no -- try a shorter match for this one */
- stp = rest - 1;
- assert(stp >= sp); /* it did work */
- }
- ssub = ss + 1;
- esub = es - 1;
- /* did innards match? */
- if (slow(m, sp, rest, ssub, esub) != NULL) {
- dp = dissect(m, sp, rest, ssub, esub);
- assert(dp == rest);
- } else /* no */
- assert(sp == rest);
- sp = rest;
- break;
- case OPLUS_:
- stp = stop;
- for (;;) {
- /* how long could this one be? */
- rest = slow(m, sp, stp, ss, es);
- assert(rest != NULL); /* it did match */
- /* could the rest match the rest? */
- tail = slow(m, rest, stop, es, stopst);
- if (tail == stop)
- break; /* yes! */
- /* no -- try a shorter match for this one */
- stp = rest - 1;
- assert(stp >= sp); /* it did work */
- }
- ssub = ss + 1;
- esub = es - 1;
- ssp = sp;
- oldssp = ssp;
- for (;;) { /* find last match of innards */
- sep = slow(m, ssp, rest, ssub, esub);
- if (sep == NULL || sep == ssp)
- break; /* failed or matched null */
- oldssp = ssp; /* on to next try */
- ssp = sep;
- }
- if (sep == NULL) {
- /* last successful match */
- sep = ssp;
- ssp = oldssp;
- }
- assert(sep == rest); /* must exhaust substring */
- assert(slow(m, ssp, sep, ssub, esub) == rest);
- dp = dissect(m, ssp, sep, ssub, esub);
- assert(dp == sep);
- sp = rest;
- break;
- case OCH_:
- stp = stop;
- for (;;) {
- /* how long could this one be? */
- rest = slow(m, sp, stp, ss, es);
- assert(rest != NULL); /* it did match */
- /* could the rest match the rest? */
- tail = slow(m, rest, stop, es, stopst);
- if (tail == stop)
- break; /* yes! */
- /* no -- try a shorter match for this one */
- stp = rest - 1;
- assert(stp >= sp); /* it did work */
- }
- ssub = ss + 1;
- esub = ss + OPND(m->g->strip[ss]) - 1;
- assert(OP(m->g->strip[esub]) == OOR1);
- for (;;) { /* find first matching branch */
- if (slow(m, sp, rest, ssub, esub) == rest)
- break; /* it matched all of it */
- /* that one missed, try next one */
- assert(OP(m->g->strip[esub]) == OOR1);
- esub++;
- assert(OP(m->g->strip[esub]) == OOR2);
- ssub = esub + 1;
- esub += OPND(m->g->strip[esub]);
- if (OP(m->g->strip[esub]) == OOR2)
- esub--;
- else
- assert(OP(m->g->strip[esub]) == O_CH);
- }
- dp = dissect(m, sp, rest, ssub, esub);
- assert(dp == rest);
- sp = rest;
- break;
- case O_PLUS:
- case O_QUEST:
- case OOR1:
- case OOR2:
- case O_CH:
- assert(nope);
- break;
- case OLPAREN:
- i = OPND(m->g->strip[ss]);
- assert(0 < i && i <= m->g->nsub);
- m->pmatch[i].rm_so = sp - m->offp;
- break;
- case ORPAREN:
- i = OPND(m->g->strip[ss]);
- assert(0 < i && i <= m->g->nsub);
- m->pmatch[i].rm_eo = sp - m->offp;
- break;
- default: /* uh oh */
- assert(nope);
- break;
- }
- }
-
- assert(sp == stop);
- return(sp);
-}
-
-/*
- - backref - figure out what matched what, figuring in back references
- == static char *backref(register struct match *m, char *start, \
- == char *stop, sopno startst, sopno stopst, sopno lev);
- */
-static char * /* == stop (success) or NULL (failure) */
-backref(m, start, stop, startst, stopst, lev)
-register struct match *m;
-char *start;
-char *stop;
-sopno startst;
-sopno stopst;
-sopno lev; /* PLUS nesting level */
-{
- register int i;
- register sopno ss; /* start sop of current subRE */
- register char *sp; /* start of string matched by it */
- register sopno ssub; /* start sop of subsubRE */
- register sopno esub; /* end sop of subsubRE */
- register char *ssp; /* start of string matched by subsubRE */
- register char *dp;
- register size_t len;
- register int hard;
- register sop s;
- register regoff_t offsave;
- register cset *cs;
-
- AT("back", start, stop, startst, stopst);
- sp = start;
-
- /* get as far as we can with easy stuff */
- hard = 0;
- for (ss = startst; !hard && ss < stopst; ss++)
- switch (OP(s = m->g->strip[ss])) {
- case OCHAR:
- if (sp == stop || *sp++ != (char)OPND(s))
- return(NULL);
- break;
- case OANY:
- if (sp == stop)
- return(NULL);
- sp++;
- break;
- case OANYOF:
- cs = &m->g->sets[OPND(s)];
- if (sp == stop || !CHIN(cs, *sp++))
- return(NULL);
- break;
- case OBOL:
- if ( (sp == m->beginp && !(m->eflags&REG_NOTBOL)) ||
- (sp < m->endp && *(sp-1) == '\n' &&
- (m->g->cflags&REG_NEWLINE)) )
- { /* yes */ }
- else
- return(NULL);
- break;
- case OEOL:
- if ( (sp == m->endp && !(m->eflags&REG_NOTEOL)) ||
- (sp < m->endp && *sp == '\n' &&
- (m->g->cflags&REG_NEWLINE)) )
- { /* yes */ }
- else
- return(NULL);
- break;
- case OBOW:
- if (( (sp == m->beginp && !(m->eflags&REG_NOTBOL)) ||
- (sp < m->endp && *(sp-1) == '\n' &&
- (m->g->cflags&REG_NEWLINE)) ||
- (sp > m->beginp &&
- !ISWORD(*(sp-1))) ) &&
- (sp < m->endp && ISWORD(*sp)) )
- { /* yes */ }
- else
- return(NULL);
- break;
- case OEOW:
- if (( (sp == m->endp && !(m->eflags&REG_NOTEOL)) ||
- (sp < m->endp && *sp == '\n' &&
- (m->g->cflags&REG_NEWLINE)) ||
- (sp < m->endp && !ISWORD(*sp)) ) &&
- (sp > m->beginp && ISWORD(*(sp-1))) )
- { /* yes */ }
- else
- return(NULL);
- break;
- case O_QUEST:
- break;
- case OOR1: /* matches null but needs to skip */
- ss++;
- s = m->g->strip[ss];
- do {
- assert(OP(s) == OOR2);
- ss += OPND(s);
- } while (OP(s = m->g->strip[ss]) != O_CH);
- /* note that the ss++ gets us past the O_CH */
- break;
- default: /* have to make a choice */
- hard = 1;
- break;
- }
- if (!hard) { /* that was it! */
- if (sp != stop)
- return(NULL);
- return(sp);
- }
- ss--; /* adjust for the for's final increment */
-
- /* the hard stuff */
- AT("hard", sp, stop, ss, stopst);
- s = m->g->strip[ss];
- switch (OP(s)) {
- case OBACK_: /* the vilest depths */
- i = OPND(s);
- assert(0 < i && i <= m->g->nsub);
- if (m->pmatch[i].rm_eo == -1)
- return(NULL);
- assert(m->pmatch[i].rm_so != -1);
- len = m->pmatch[i].rm_eo - m->pmatch[i].rm_so;
- assert(stop - m->beginp >= len);
- if (sp > stop - len)
- return(NULL); /* not enough left to match */
- ssp = m->offp + m->pmatch[i].rm_so;
- if (memcmp(sp, ssp, len) != 0)
- return(NULL);
- while (m->g->strip[ss] != SOP(O_BACK, i))
- ss++;
- return(backref(m, sp+len, stop, ss+1, stopst, lev));
- break;
- case OQUEST_: /* to null or not */
- dp = backref(m, sp, stop, ss+1, stopst, lev);
- if (dp != NULL)
- return(dp); /* not */
- return(backref(m, sp, stop, ss+OPND(s)+1, stopst, lev));
- break;
- case OPLUS_:
- assert(m->lastpos != NULL);
- assert(lev+1 <= m->g->nplus);
- m->lastpos[lev+1] = sp;
- return(backref(m, sp, stop, ss+1, stopst, lev+1));
- break;
- case O_PLUS:
- if (sp == m->lastpos[lev]) /* last pass matched null */
- return(backref(m, sp, stop, ss+1, stopst, lev-1));
- /* try another pass */
- m->lastpos[lev] = sp;
- dp = backref(m, sp, stop, ss-OPND(s)+1, stopst, lev);
- if (dp == NULL)
- return(backref(m, sp, stop, ss+1, stopst, lev-1));
- else
- return(dp);
- break;
- case OCH_: /* find the right one, if any */
- ssub = ss + 1;
- esub = ss + OPND(s) - 1;
- assert(OP(m->g->strip[esub]) == OOR1);
- for (;;) { /* find first matching branch */
- dp = backref(m, sp, stop, ssub, esub, lev);
- if (dp != NULL)
- return(dp);
- /* that one missed, try next one */
- if (OP(m->g->strip[esub]) == O_CH)
- return(NULL); /* there is none */
- esub++;
- assert(OP(m->g->strip[esub]) == OOR2);
- ssub = esub + 1;
- esub += OPND(m->g->strip[esub]);
- if (OP(m->g->strip[esub]) == OOR2)
- esub--;
- else
- assert(OP(m->g->strip[esub]) == O_CH);
- }
- break;
- case OLPAREN: /* must undo assignment if rest fails */
- i = OPND(s);
- assert(0 < i && i <= m->g->nsub);
- offsave = m->pmatch[i].rm_so;
- m->pmatch[i].rm_so = sp - m->offp;
- dp = backref(m, sp, stop, ss+1, stopst, lev);
- if (dp != NULL)
- return(dp);
- m->pmatch[i].rm_so = offsave;
- return(NULL);
- break;
- case ORPAREN: /* must undo assignment if rest fails */
- i = OPND(s);
- assert(0 < i && i <= m->g->nsub);
- offsave = m->pmatch[i].rm_eo;
- m->pmatch[i].rm_eo = sp - m->offp;
- dp = backref(m, sp, stop, ss+1, stopst, lev);
- if (dp != NULL)
- return(dp);
- m->pmatch[i].rm_eo = offsave;
- return(NULL);
- break;
- default: /* uh oh */
- assert(nope);
- break;
- }
-
- /* "can't happen" */
- assert(nope);
- /* NOTREACHED */
- return((char *)NULL); /* dummy */
-}
-
-/*
- - fast - step through the string at top speed
- == static char *fast(register struct match *m, char *start, \
- == char *stop, sopno startst, sopno stopst);
- */
-static char * /* where tentative match ended, or NULL */
-fast(m, start, stop, startst, stopst)
-register struct match *m;
-char *start;
-char *stop;
-sopno startst;
-sopno stopst;
-{
- register states st = m->st;
- register states fresh = m->fresh;
- register states tmp = m->tmp;
- register char *p = start;
- register int c = (start == m->beginp) ? OUT : *(start-1);
- register int lastc; /* previous c */
- register int flagch;
- register int i;
- register char *coldp; /* last p after which no match was underway */
-
- CLEAR(st);
- SET1(st, startst);
- st = step(m->g, startst, stopst, st, NOTHING, st);
- ASSIGN(fresh, st);
- SP("start", st, *p);
- coldp = NULL;
- for (;;) {
- /* next character */
- lastc = c;
- c = (p == m->endp) ? OUT : *p;
- if (EQ(st, fresh))
- coldp = p;
-
- /* is there an EOL and/or BOL between lastc and c? */
- flagch = '\0';
- i = 0;
- if ( (lastc == '\n' && m->g->cflags&REG_NEWLINE) ||
- (lastc == OUT && !(m->eflags&REG_NOTBOL)) ) {
- flagch = BOL;
- i = m->g->nbol;
- }
- if ( (c == '\n' && m->g->cflags&REG_NEWLINE) ||
- (c == OUT && !(m->eflags&REG_NOTEOL)) ) {
- flagch = (flagch == BOL) ? BOLEOL : EOL;
- i += m->g->neol;
- }
- if (i != 0) {
- for (; i > 0; i--)
- st = step(m->g, startst, stopst, st, flagch, st);
- SP("boleol", st, c);
- }
-
- /* how about a word boundary? */
- if ( (flagch == BOL || (lastc != OUT && !ISWORD(lastc))) &&
- (c != OUT && ISWORD(c)) ) {
- flagch = BOW;
- }
- if ( (lastc != OUT && ISWORD(lastc)) &&
- (flagch == EOL || (c != OUT && !ISWORD(c))) ) {
- flagch = EOW;
- }
- if (flagch == BOW || flagch == EOW) {
- st = step(m->g, startst, stopst, st, flagch, st);
- SP("boweow", st, c);
- }
-
- /* are we done? */
- if (ISSET(st, stopst) || p == stop)
- break; /* NOTE BREAK OUT */
-
- /* no, we must deal with this character */
- ASSIGN(tmp, st);
- ASSIGN(st, fresh);
- assert(c != OUT);
- st = step(m->g, startst, stopst, tmp, c, st);
- SP("aft", st, c);
- assert(EQ(step(m->g, startst, stopst, st, NOTHING, st), st));
- p++;
- }
-
- assert(coldp != NULL);
- m->coldp = coldp;
- if (ISSET(st, stopst))
- return(p+1);
- else
- return(NULL);
-}
-
-/*
- - slow - step through the string more deliberately
- == static char *slow(register struct match *m, char *start, \
- == char *stop, sopno startst, sopno stopst);
- */
-static char * /* where it ended */
-slow(m, start, stop, startst, stopst)
-register struct match *m;
-char *start;
-char *stop;
-sopno startst;
-sopno stopst;
-{
- register states st = m->st;
- register states empty = m->empty;
- register states tmp = m->tmp;
- register char *p = start;
- register int c = (start == m->beginp) ? OUT : *(start-1);
- register int lastc; /* previous c */
- register int flagch;
- register int i;
- register char *matchp; /* last p at which a match ended */
-
- AT("slow", start, stop, startst, stopst);
- CLEAR(st);
- SET1(st, startst);
- SP("sstart", st, *p);
- st = step(m->g, startst, stopst, st, NOTHING, st);
- matchp = NULL;
- for (;;) {
- /* next character */
- lastc = c;
- c = (p == m->endp) ? OUT : *p;
-
- /* is there an EOL and/or BOL between lastc and c? */
- flagch = '\0';
- i = 0;
- if ( (lastc == '\n' && m->g->cflags&REG_NEWLINE) ||
- (lastc == OUT && !(m->eflags&REG_NOTBOL)) ) {
- flagch = BOL;
- i = m->g->nbol;
- }
- if ( (c == '\n' && m->g->cflags&REG_NEWLINE) ||
- (c == OUT && !(m->eflags&REG_NOTEOL)) ) {
- flagch = (flagch == BOL) ? BOLEOL : EOL;
- i += m->g->neol;
- }
- if (i != 0) {
- for (; i > 0; i--)
- st = step(m->g, startst, stopst, st, flagch, st);
- SP("sboleol", st, c);
- }
-
- /* how about a word boundary? */
- if ( (flagch == BOL || (lastc != OUT && !ISWORD(lastc))) &&
- (c != OUT && ISWORD(c)) ) {
- flagch = BOW;
- }
- if ( (lastc != OUT && ISWORD(lastc)) &&
- (flagch == EOL || (c != OUT && !ISWORD(c))) ) {
- flagch = EOW;
- }
- if (flagch == BOW || flagch == EOW) {
- st = step(m->g, startst, stopst, st, flagch, st);
- SP("sboweow", st, c);
- }
-
- /* are we done? */
- if (ISSET(st, stopst))
- matchp = p;
- if (EQ(st, empty) || p == stop)
- break; /* NOTE BREAK OUT */
-
- /* no, we must deal with this character */
- ASSIGN(tmp, st);
- ASSIGN(st, empty);
- assert(c != OUT);
- st = step(m->g, startst, stopst, tmp, c, st);
- SP("saft", st, c);
- assert(EQ(step(m->g, startst, stopst, st, NOTHING, st), st));
- p++;
- }
-
- return(matchp);
-}
-
-
-/*
- - step - map set of states reachable before char to set reachable after
- == static states step(register struct re_guts *g, sopno start, sopno stop, \
- == register states bef, int ch, register states aft);
- == #define BOL (OUT+1)
- == #define EOL (BOL+1)
- == #define BOLEOL (BOL+2)
- == #define NOTHING (BOL+3)
- == #define BOW (BOL+4)
- == #define EOW (BOL+5)
- == #define CODEMAX (BOL+5) // highest code used
- == #define NONCHAR(c) ((c) > CHAR_MAX)
- == #define NNONCHAR (CODEMAX-CHAR_MAX)
- */
-static states
-step(g, start, stop, bef, ch, aft)
-register struct re_guts *g;
-sopno start; /* start state within strip */
-sopno stop; /* state after stop state within strip */
-register states bef; /* states reachable before */
-int ch; /* character or NONCHAR code */
-register states aft; /* states already known reachable after */
-{
- register cset *cs;
- register sop s;
- register sopno pc;
- register onestate here; /* note, macros know this name */
- register sopno look;
- register long i;
-
- for (pc = start, INIT(here, pc); pc != stop; pc++, INC(here)) {
- s = g->strip[pc];
- switch (OP(s)) {
- case OEND:
- assert(pc == stop-1);
- break;
- case OCHAR:
- /* only characters can match */
- assert(!NONCHAR(ch) || ch != (char)OPND(s));
- if (ch == (char)OPND(s))
- FWD(aft, bef, 1);
- break;
- case OBOL:
- if (ch == BOL || ch == BOLEOL)
- FWD(aft, bef, 1);
- break;
- case OEOL:
- if (ch == EOL || ch == BOLEOL)
- FWD(aft, bef, 1);
- break;
- case OBOW:
- if (ch == BOW)
- FWD(aft, bef, 1);
- break;
- case OEOW:
- if (ch == EOW)
- FWD(aft, bef, 1);
- break;
- case OANY:
- if (!NONCHAR(ch))
- FWD(aft, bef, 1);
- break;
- case OANYOF:
- cs = &g->sets[OPND(s)];
- if (!NONCHAR(ch) && CHIN(cs, ch))
- FWD(aft, bef, 1);
- break;
- case OBACK_: /* ignored here */
- case O_BACK:
- FWD(aft, aft, 1);
- break;
- case OPLUS_: /* forward, this is just an empty */
- FWD(aft, aft, 1);
- break;
- case O_PLUS: /* both forward and back */
- FWD(aft, aft, 1);
- i = ISSETBACK(aft, OPND(s));
- BACK(aft, aft, OPND(s));
- if (!i && ISSETBACK(aft, OPND(s))) {
- /* oho, must reconsider loop body */
- pc -= OPND(s) + 1;
- INIT(here, pc);
- }
- break;
- case OQUEST_: /* two branches, both forward */
- FWD(aft, aft, 1);
- FWD(aft, aft, OPND(s));
- break;
- case O_QUEST: /* just an empty */
- FWD(aft, aft, 1);
- break;
- case OLPAREN: /* not significant here */
- case ORPAREN:
- FWD(aft, aft, 1);
- break;
- case OCH_: /* mark the first two branches */
- FWD(aft, aft, 1);
- assert(OP(g->strip[pc+OPND(s)]) == OOR2);
- FWD(aft, aft, OPND(s));
- break;
- case OOR1: /* done a branch, find the O_CH */
- if (ISSTATEIN(aft, here)) {
- for (look = 1;
- OP(s = g->strip[pc+look]) != O_CH;
- look += OPND(s))
- assert(OP(s) == OOR2);
- FWD(aft, aft, look);
- }
- break;
- case OOR2: /* propagate OCH_'s marking */
- FWD(aft, aft, 1);
- if (OP(g->strip[pc+OPND(s)]) != O_CH) {
- assert(OP(g->strip[pc+OPND(s)]) == OOR2);
- FWD(aft, aft, OPND(s));
- }
- break;
- case O_CH: /* just empty */
- FWD(aft, aft, 1);
- break;
- default: /* ooooops... */
- assert(nope);
- break;
- }
- }
-
- return(aft);
-}
-
-#ifdef REDEBUG
-/*
- - print - print a set of states
- == #ifdef REDEBUG
- == static void print(struct match *m, char *caption, states st, \
- == int ch, FILE *d);
- == #endif
- */
-static void
-print(m, caption, st, ch, d)
-struct match *m;
-char *caption;
-states st;
-int ch;
-FILE *d;
-{
- register struct re_guts *g = m->g;
- register int i;
- register int first = 1;
-
- if (!(m->eflags&REG_TRACE))
- return;
-
- fprintf(d, "%s", caption);
- if (ch != '\0')
- fprintf(d, " %s", pchar(ch));
- for (i = 0; i < g->nstates; i++)
- if (ISSET(st, i)) {
- fprintf(d, "%s%d", (first) ? "\t" : ", ", i);
- first = 0;
- }
- fprintf(d, "\n");
-}
-
-/*
- - at - print current situation
- == #ifdef REDEBUG
- == static void at(struct match *m, char *title, char *start, char *stop, \
- == sopno startst, sopno stopst);
- == #endif
- */
-static void
-at(m, title, start, stop, startst, stopst)
-struct match *m;
-char *title;
-char *start;
-char *stop;
-sopno startst;
-sopno stopst;
-{
- if (!(m->eflags&REG_TRACE))
- return;
-
- printf("%s %s-", title, pchar(*start));
- printf("%s ", pchar(*stop));
- printf("%ld-%ld\n", (long)startst, (long)stopst);
-}
-
-#ifndef PCHARDONE
-#define PCHARDONE /* never again */
-/*
- - pchar - make a character printable
- == #ifdef REDEBUG
- == static char *pchar(int ch);
- == #endif
- *
- * Is this identical to regchar() over in debug.c? Well, yes. But a
- * duplicate here avoids having a debugging-capable regexec.o tied to
- * a matching debug.o, and this is convenient. It all disappears in
- * the non-debug compilation anyway, so it doesn't matter much.
- */
-static char * /* -> representation */
-pchar(ch)
-int ch;
-{
- static char pbuf[10];
-
- if (isprint(ch) || ch == ' ')
- sprintf(pbuf, "%c", ch);
- else
- sprintf(pbuf, "\\%o", ch);
- return(pbuf);
-}
-#endif
-#endif
-
-#undef matcher
-#undef fast
-#undef slow
-#undef dissect
-#undef backref
-#undef step
-#undef print
-#undef at
-#undef match
diff --git a/ext/ereg/regex/engine.ih b/ext/ereg/regex/engine.ih
deleted file mode 100644
index cc98334e75..0000000000
--- a/ext/ereg/regex/engine.ih
+++ /dev/null
@@ -1,35 +0,0 @@
-/* ========= begin header generated by ./mkh ========= */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* === engine.c === */
-static int matcher(register struct re_guts *g, char *string, size_t nmatch, regmatch_t pmatch[], int eflags);
-static char *dissect(register struct match *m, char *start, char *stop, sopno startst, sopno stopst);
-static char *backref(register struct match *m, char *start, char *stop, sopno startst, sopno stopst, sopno lev);
-static char *fast(register struct match *m, char *start, char *stop, sopno startst, sopno stopst);
-static char *slow(register struct match *m, char *start, char *stop, sopno startst, sopno stopst);
-static states step(register struct re_guts *g, sopno start, sopno stop, register states bef, int ch, register states aft);
-#define BOL (OUT+1)
-#define EOL (BOL+1)
-#define BOLEOL (BOL+2)
-#define NOTHING (BOL+3)
-#define BOW (BOL+4)
-#define EOW (BOL+5)
-#define CODEMAX (BOL+5) /* highest code used */
-#define NONCHAR(c) ((c) > CHAR_MAX)
-#define NNONCHAR (CODEMAX-CHAR_MAX)
-#ifdef REDEBUG
-static void print(struct match *m, char *caption, states st, int ch, FILE *d);
-#endif
-#ifdef REDEBUG
-static void at(struct match *m, char *title, char *start, char *stop, sopno startst, sopno stopst);
-#endif
-#ifdef REDEBUG
-static char *pchar(int ch);
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-/* ========= end header generated by ./mkh ========= */
diff --git a/ext/ereg/regex/main.c b/ext/ereg/regex/main.c
deleted file mode 100644
index 657338a2c1..0000000000
--- a/ext/ereg/regex/main.c
+++ /dev/null
@@ -1,510 +0,0 @@
-#include <stdio.h>
-#include <string.h>
-#include <sys/types.h>
-#include <regex.h>
-#include <assert.h>
-#include <stdlib.h>
-
-#include "main.ih"
-
-char *progname;
-int debug = 0;
-int line = 0;
-int status = 0;
-
-int copts = REG_EXTENDED;
-int eopts = 0;
-regoff_t startoff = 0;
-regoff_t endoff = 0;
-
-
-extern int split();
-extern void regprint();
-
-/*
- - main - do the simple case, hand off to regress() for regression
- */
-int main(argc, argv)
-int argc;
-char *argv[];
-{
- regex_t re;
-# define NS 10
- regmatch_t subs[NS];
- char erbuf[100];
- int err;
- size_t len;
- int c;
- int errflg = 0;
- register int i;
- extern int optind;
- extern char *optarg;
-
- progname = argv[0];
-
- while ((c = getopt(argc, argv, "c:e:S:E:x")) != EOF)
- switch (c) {
- case 'c': /* compile options */
- copts = options('c', optarg);
- break;
- case 'e': /* execute options */
- eopts = options('e', optarg);
- break;
- case 'S': /* start offset */
- startoff = (regoff_t)atoi(optarg);
- break;
- case 'E': /* end offset */
- endoff = (regoff_t)atoi(optarg);
- break;
- case 'x': /* Debugging. */
- debug++;
- break;
- case '?':
- default:
- errflg++;
- break;
- }
- if (errflg) {
- fprintf(stderr, "usage: %s ", progname);
- fprintf(stderr, "[-c copt][-C][-d] [re]\n");
- exit(2);
- }
-
- if (optind >= argc) {
- regress(stdin);
- exit(status);
- }
-
- err = regcomp(&re, argv[optind++], copts);
- if (err) {
- len = regerror(err, &re, erbuf, sizeof(erbuf));
- fprintf(stderr, "error %s, %d/%d `%s'\n",
- eprint(err), len, sizeof(erbuf), erbuf);
- exit(status);
- }
- regprint(&re, stdout);
-
- if (optind >= argc) {
- regfree(&re);
- exit(status);
- }
-
- if (eopts&REG_STARTEND) {
- subs[0].rm_so = startoff;
- subs[0].rm_eo = strlen(argv[optind]) - endoff;
- }
- err = regexec(&re, argv[optind], (size_t)NS, subs, eopts);
- if (err) {
- len = regerror(err, &re, erbuf, sizeof(erbuf));
- fprintf(stderr, "error %s, %d/%d `%s'\n",
- eprint(err), len, sizeof(erbuf), erbuf);
- exit(status);
- }
- if (!(copts&REG_NOSUB)) {
- len = (int)(subs[0].rm_eo - subs[0].rm_so);
- if (subs[0].rm_so != -1) {
- if (len != 0)
- printf("match `%.*s'\n", (int)len,
- argv[optind] + subs[0].rm_so);
- else
- printf("match `'@%.1s\n",
- argv[optind] + subs[0].rm_so);
- }
- for (i = 1; i < NS; i++)
- if (subs[i].rm_so != -1)
- printf("(%d) `%.*s'\n", i,
- (int)(subs[i].rm_eo - subs[i].rm_so),
- argv[optind] + subs[i].rm_so);
- }
- exit(status);
-}
-
-/*
- - regress - main loop of regression test
- == void regress(FILE *in);
- */
-void
-regress(in)
-FILE *in;
-{
- char inbuf[1000];
-# define MAXF 10
- char *f[MAXF];
- int nf;
- int i;
- char erbuf[100];
- size_t ne;
- char *badpat = "invalid regular expression";
-# define SHORT 10
- char *bpname = "REG_BADPAT";
- regex_t re;
-
- while (fgets(inbuf, sizeof(inbuf), in) != NULL) {
- line++;
- if (inbuf[0] == '#' || inbuf[0] == '\n')
- continue; /* NOTE CONTINUE */
- inbuf[strlen(inbuf)-1] = '\0'; /* get rid of stupid \n */
- if (debug)
- fprintf(stdout, "%d:\n", line);
- nf = split(inbuf, f, MAXF, "\t\t");
- if (nf < 3) {
- fprintf(stderr, "bad input, line %d\n", line);
- exit(1);
- }
- for (i = 0; i < nf; i++)
- if (strcmp(f[i], "\"\"") == 0)
- f[i] = "";
- if (nf <= 3)
- f[3] = NULL;
- if (nf <= 4)
- f[4] = NULL;
- try(f[0], f[1], f[2], f[3], f[4], options('c', f[1]));
- if (opt('&', f[1])) /* try with either type of RE */
- try(f[0], f[1], f[2], f[3], f[4],
- options('c', f[1]) &~ REG_EXTENDED);
- }
-
- ne = regerror(REG_BADPAT, (regex_t *)NULL, erbuf, sizeof(erbuf));
- if (strcmp(erbuf, badpat) != 0 || ne != strlen(badpat)+1) {
- fprintf(stderr, "end: regerror() test gave `%s' not `%s'\n",
- erbuf, badpat);
- status = 1;
- }
- ne = regerror(REG_BADPAT, (regex_t *)NULL, erbuf, (size_t)SHORT);
- if (strncmp(erbuf, badpat, SHORT-1) != 0 || erbuf[SHORT-1] != '\0' ||
- ne != strlen(badpat)+1) {
- fprintf(stderr, "end: regerror() short test gave `%s' not `%.*s'\n",
- erbuf, SHORT-1, badpat);
- status = 1;
- }
- ne = regerror(REG_ITOA|REG_BADPAT, (regex_t *)NULL, erbuf, sizeof(erbuf));
- if (strcmp(erbuf, bpname) != 0 || ne != strlen(bpname)+1) {
- fprintf(stderr, "end: regerror() ITOA test gave `%s' not `%s'\n",
- erbuf, bpname);
- status = 1;
- }
- re.re_endp = bpname;
- ne = regerror(REG_ATOI, &re, erbuf, sizeof(erbuf));
- if (atoi(erbuf) != (int)REG_BADPAT) {
- fprintf(stderr, "end: regerror() ATOI test gave `%s' not `%ld'\n",
- erbuf, (long)REG_BADPAT);
- status = 1;
- } else if (ne != strlen(erbuf)+1) {
- fprintf(stderr, "end: regerror() ATOI test len(`%s') = %ld\n",
- erbuf, (long)REG_BADPAT);
- status = 1;
- }
-}
-
-/*
- - try - try it, and report on problems
- == void try(char *f0, char *f1, char *f2, char *f3, char *f4, int opts);
- */
-void
-try(f0, f1, f2, f3, f4, opts)
-char *f0;
-char *f1;
-char *f2;
-char *f3;
-char *f4;
-int opts; /* may not match f1 */
-{
- regex_t re;
-# define NSUBS 10
- regmatch_t subs[NSUBS];
-# define NSHOULD 15
- char *should[NSHOULD];
- int nshould;
- char erbuf[100];
- int err;
- int len;
- char *type = (opts & REG_EXTENDED) ? "ERE" : "BRE";
- register int i;
- char *grump;
- char f0copy[1000];
- char f2copy[1000];
-
- strcpy(f0copy, f0);
- re.re_endp = (opts&REG_PEND) ? f0copy + strlen(f0copy) : NULL;
- fixstr(f0copy);
- err = regcomp(&re, f0copy, opts);
- if (err != 0 && (!opt('C', f1) || err != efind(f2))) {
- /* unexpected error or wrong error */
- len = regerror(err, &re, erbuf, sizeof(erbuf));
- fprintf(stderr, "%d: %s error %s, %d/%d `%s'\n",
- line, type, eprint(err), len,
- sizeof(erbuf), erbuf);
- status = 1;
- } else if (err == 0 && opt('C', f1)) {
- /* unexpected success */
- fprintf(stderr, "%d: %s should have given REG_%s\n",
- line, type, f2);
- status = 1;
- err = 1; /* so we won't try regexec */
- }
-
- if (err != 0) {
- regfree(&re);
- return;
- }
-
- strcpy(f2copy, f2);
- fixstr(f2copy);
-
- if (options('e', f1)&REG_STARTEND) {
- if (strchr(f2, '(') == NULL || strchr(f2, ')') == NULL)
- fprintf(stderr, "%d: bad STARTEND syntax\n", line);
- subs[0].rm_so = strchr(f2, '(') - f2 + 1;
- subs[0].rm_eo = strchr(f2, ')') - f2;
- }
- err = regexec(&re, f2copy, NSUBS, subs, options('e', f1));
-
- if (err != 0 && (f3 != NULL || err != REG_NOMATCH)) {
- /* unexpected error or wrong error */
- len = regerror(err, &re, erbuf, sizeof(erbuf));
- fprintf(stderr, "%d: %s exec error %s, %d/%d `%s'\n",
- line, type, eprint(err), len,
- sizeof(erbuf), erbuf);
- status = 1;
- } else if (err != 0) {
- /* nothing more to check */
- } else if (f3 == NULL) {
- /* unexpected success */
- fprintf(stderr, "%d: %s exec should have failed\n",
- line, type);
- status = 1;
- err = 1; /* just on principle */
- } else if (opts&REG_NOSUB) {
- /* nothing more to check */
- } else if ((grump = check(f2, subs[0], f3)) != NULL) {
- fprintf(stderr, "%d: %s %s\n", line, type, grump);
- status = 1;
- err = 1;
- }
-
- if (err != 0 || f4 == NULL) {
- regfree(&re);
- return;
- }
-
- for (i = 1; i < NSHOULD; i++)
- should[i] = NULL;
- nshould = split(f4, should+1, NSHOULD-1, ",");
- if (nshould == 0) {
- nshould = 1;
- should[1] = "";
- }
- for (i = 1; i < NSUBS; i++) {
- grump = check(f2, subs[i], should[i]);
- if (grump != NULL) {
- fprintf(stderr, "%d: %s $%d %s\n", line,
- type, i, grump);
- status = 1;
- err = 1;
- }
- }
-
- regfree(&re);
-}
-
-/*
- - options - pick options out of a regression-test string
- == int options(int type, char *s);
- */
-int
-options(type, s)
-int type; /* 'c' compile, 'e' exec */
-char *s;
-{
- register char *p;
- register int o = (type == 'c') ? copts : eopts;
- register char *legal = (type == 'c') ? "bisnmp" : "^$#tl";
-
- for (p = s; *p != '\0'; p++)
- if (strchr(legal, *p) != NULL)
- switch (*p) {
- case 'b':
- o &= ~REG_EXTENDED;
- break;
- case 'i':
- o |= REG_ICASE;
- break;
- case 's':
- o |= REG_NOSUB;
- break;
- case 'n':
- o |= REG_NEWLINE;
- break;
- case 'm':
- o &= ~REG_EXTENDED;
- o |= REG_NOSPEC;
- break;
- case 'p':
- o |= REG_PEND;
- break;
- case '^':
- o |= REG_NOTBOL;
- break;
- case '$':
- o |= REG_NOTEOL;
- break;
- case '#':
- o |= REG_STARTEND;
- break;
- case 't': /* trace */
- o |= REG_TRACE;
- break;
- case 'l': /* force long representation */
- o |= REG_LARGE;
- break;
- case 'r': /* force backref use */
- o |= REG_BACKR;
- break;
- }
- return(o);
-}
-
-/*
- - opt - is a particular option in a regression string?
- == int opt(int c, char *s);
- */
-int /* predicate */
-opt(c, s)
-int c;
-char *s;
-{
- return(strchr(s, c) != NULL);
-}
-
-/*
- - fixstr - transform magic characters in strings
- == void fixstr(register char *p);
- */
-void
-fixstr(p)
-register char *p;
-{
- if (p == NULL)
- return;
-
- for (; *p != '\0'; p++)
- if (*p == 'N')
- *p = '\n';
- else if (*p == 'T')
- *p = '\t';
- else if (*p == 'S')
- *p = ' ';
- else if (*p == 'Z')
- *p = '\0';
-}
-
-/*
- - check - check a substring match
- == char *check(char *str, regmatch_t sub, char *should);
- */
-char * /* NULL or complaint */
-check(str, sub, should)
-char *str;
-regmatch_t sub;
-char *should;
-{
- register int len;
- register int shlen;
- register char *p;
- static char grump[500];
- register char *at = NULL;
-
- if (should != NULL && strcmp(should, "-") == 0)
- should = NULL;
- if (should != NULL && should[0] == '@') {
- at = should + 1;
- should = "";
- }
-
- /* check rm_so and rm_eo for consistency */
- if (sub.rm_so > sub.rm_eo || (sub.rm_so == -1 && sub.rm_eo != -1) ||
- (sub.rm_so != -1 && sub.rm_eo == -1) ||
- (sub.rm_so != -1 && sub.rm_so < 0) ||
- (sub.rm_eo != -1 && sub.rm_eo < 0) ) {
- sprintf(grump, "start %ld end %ld", (long)sub.rm_so,
- (long)sub.rm_eo);
- return(grump);
- }
-
- /* check for no match */
- if (sub.rm_so == -1 && should == NULL)
- return(NULL);
- if (sub.rm_so == -1)
- return("did not match");
-
- /* check for in range */
- if (sub.rm_eo > strlen(str)) {
- sprintf(grump, "start %ld end %ld, past end of string",
- (long)sub.rm_so, (long)sub.rm_eo);
- return(grump);
- }
-
- len = (int)(sub.rm_eo - sub.rm_so);
- shlen = (int)strlen(should);
- p = str + sub.rm_so;
-
- /* check for not supposed to match */
- if (should == NULL) {
- sprintf(grump, "matched `%.*s'", len, p);
- return(grump);
- }
-
- /* check for wrong match */
- if (len != shlen || strncmp(p, should, (size_t)shlen) != 0) {
- sprintf(grump, "matched `%.*s' instead", len, p);
- return(grump);
- }
- if (shlen > 0)
- return(NULL);
-
- /* check null match in right place */
- if (at == NULL)
- return(NULL);
- shlen = strlen(at);
- if (shlen == 0)
- shlen = 1; /* force check for end-of-string */
- if (strncmp(p, at, shlen) != 0) {
- sprintf(grump, "matched null at `%.20s'", p);
- return(grump);
- }
- return(NULL);
-}
-
-/*
- - eprint - convert error number to name
- == static char *eprint(int err);
- */
-static char *
-eprint(err)
-int err;
-{
- static char epbuf[100];
- size_t len;
-
- len = regerror(REG_ITOA|err, (regex_t *)NULL, epbuf, sizeof(epbuf));
- assert(len <= sizeof(epbuf));
- return(epbuf);
-}
-
-/*
- - efind - convert error name to number
- == static int efind(char *name);
- */
-static int
-efind(name)
-char *name;
-{
- static char efbuf[100];
- regex_t re;
-
- sprintf(efbuf, "REG_%s", name);
- assert(strlen(efbuf) < sizeof(efbuf));
- re.re_endp = efbuf;
- (void) regerror(REG_ATOI, &re, efbuf, sizeof(efbuf));
- return(atoi(efbuf));
-}
diff --git a/ext/ereg/regex/main.ih b/ext/ereg/regex/main.ih
deleted file mode 100644
index 5a0118ac44..0000000000
--- a/ext/ereg/regex/main.ih
+++ /dev/null
@@ -1,19 +0,0 @@
-/* ========= begin header generated by ./mkh ========= */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* === main.c === */
-void regress(FILE *in);
-void try(char *f0, char *f1, char *f2, char *f3, char *f4, int opts);
-int options(int type, char *s);
-int opt(int c, char *s);
-void fixstr(register char *p);
-char *check(char *str, regmatch_t sub, char *should);
-static char *eprint(int err);
-static int efind(char *name);
-
-#ifdef __cplusplus
-}
-#endif
-/* ========= end header generated by ./mkh ========= */
diff --git a/ext/ereg/regex/mkh b/ext/ereg/regex/mkh
deleted file mode 100644
index 252b246c7b..0000000000
--- a/ext/ereg/regex/mkh
+++ /dev/null
@@ -1,76 +0,0 @@
-#! /bin/sh
-# mkh - pull headers out of C source
-PATH=/bin:/usr/bin ; export PATH
-
-# egrep pattern to pick out marked lines
-egrep='^ =([ ]|$)'
-
-# Sed program to process marked lines into lines for the header file.
-# The markers have already been removed. Two things are done here: removal
-# of backslashed newlines, and some fudging of comments. The first is done
-# because -o needs to have prototypes on one line to strip them down.
-# Getting comments into the output is tricky; we turn C++-style // comments
-# into /* */ comments, after altering any existing */'s to avoid trouble.
-peel=' /\\$/N
- /\\\n[ ]*/s///g
- /\/\//s;\*/;* /;g
- /\/\//s;//\(.*\);/*\1 */;'
-
-for a
-do
- case "$a" in
- -o) # old (pre-function-prototype) compiler
- # add code to comment out argument lists
- peel="$peel
- "'/^\([^#\/][^\/]*[a-zA-Z0-9_)]\)(\(.*\))/s;;\1(/*\2*/);'
- shift
- ;;
- -b) # funny Berkeley __P macro
- peel="$peel
- "'/^\([^#\/][^\/]*[a-zA-Z0-9_)]\)(\(.*\))/s;;\1 __P((\2));'
- shift
- ;;
- -s) # compiler doesn't like `static foo();'
- # add code to get rid of the `static'
- peel="$peel
- "'/^static[ ][^\/]*[a-zA-Z0-9_)](.*)/s;static.;;'
- shift
- ;;
- -p) # private declarations
- egrep='^ ==([ ]|$)'
- shift
- ;;
- -i) # wrap in #ifndef, argument is name
- ifndef="$2"
- shift ; shift
- ;;
- *) break
- ;;
- esac
-done
-
-if test " $ifndef" != " "
-then
- echo "#ifndef $ifndef"
- echo "#define $ifndef /* never again */"
-fi
-echo "/* ========= begin header generated by $0 ========= */"
-echo '#ifdef __cplusplus'
-echo 'extern "C" {'
-echo '#endif'
-for f
-do
- echo
- echo "/* === $f === */"
- egrep "$egrep" $f | sed 's/^ ==*[ ]//;s/^ ==*$//' | sed "$peel"
- echo
-done
-echo '#ifdef __cplusplus'
-echo '}'
-echo '#endif'
-echo "/* ========= end header generated by $0 ========= */"
-if test " $ifndef" != " "
-then
- echo "#endif"
-fi
-exit 0
diff --git a/ext/ereg/regex/regcomp.c b/ext/ereg/regex/regcomp.c
deleted file mode 100644
index 0b939461bd..0000000000
--- a/ext/ereg/regex/regcomp.c
+++ /dev/null
@@ -1,1608 +0,0 @@
-#include <sys/types.h>
-#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
-#include <limits.h>
-#include <stdlib.h>
-
-#define POSIX_MISTAKE
-
-#include "utils.h"
-#include "regex.h"
-#include "regex2.h"
-
-#include "cclass.h"
-#include "cname.h"
-
-/*
- * parse structure, passed up and down to avoid global variables and
- * other clumsinesses
- */
-struct parse {
- char *next; /* next character in RE */
- char *end; /* end of string (-> NUL normally) */
- int error; /* has an error been seen? */
- sop *strip; /* malloced strip */
- sopno ssize; /* malloced strip size (allocated) */
- sopno slen; /* malloced strip length (used) */
- int ncsalloc; /* number of csets allocated */
- struct re_guts *g;
-# define NPAREN 10 /* we need to remember () 1-9 for back refs */
- sopno pbegin[NPAREN]; /* -> ( ([0] unused) */
- sopno pend[NPAREN]; /* -> ) ([0] unused) */
-};
-
-#include "regcomp.ih"
-
-static char nuls[10]; /* place to point scanner in event of error */
-
-/*
- * macros for use with parse structure
- * BEWARE: these know that the parse structure is named `p' !!!
- */
-#define PEEK() (*p->next)
-#define PEEK2() (*(p->next+1))
-#define MORE() (p->next < p->end)
-#define MORE2() (p->next+1 < p->end)
-#define SEE(c) (MORE() && PEEK() == (c))
-#define SEETWO(a, b) (MORE() && MORE2() && PEEK() == (a) && PEEK2() == (b))
-#define EAT(c) ((SEE(c)) ? (NEXT(), 1) : 0)
-#define EATTWO(a, b) ((SEETWO(a, b)) ? (NEXT2(), 1) : 0)
-#define NEXT() (p->next++)
-#define NEXT2() (p->next += 2)
-#define NEXTn(n) (p->next += (n))
-#define GETNEXT() (*p->next++)
-#define SETERROR(e) seterr(p, (e))
-#define REQUIRE(co, e) (void) ((co) || SETERROR(e))
-#define MUSTSEE(c, e) (REQUIRE(MORE() && PEEK() == (c), e))
-#define MUSTEAT(c, e) (REQUIRE(MORE() && GETNEXT() == (c), e))
-#define MUSTNOTSEE(c, e) (REQUIRE(!MORE() || PEEK() != (c), e))
-#define EMIT(op, sopnd) doemit(p, (sop)(op), (size_t)(sopnd))
-#define INSERT(op, pos) doinsert(p, (sop)(op), HERE()-(pos)+1, pos)
-#define AHEAD(pos) dofwd(p, pos, HERE()-(pos))
-#define ASTERN(sop, pos) EMIT(sop, HERE()-pos)
-#define HERE() (p->slen)
-#define THERE() (p->slen - 1)
-#define THERETHERE() (p->slen - 2)
-#define DROP(n) (p->slen -= (n))
-
-#ifndef NDEBUG
-static int never = 0; /* for use in asserts; shuts lint up */
-#else
-#define never 0 /* some <assert.h>s have bugs too */
-#endif
-
-/*
- - regcomp - interface for parser and compilation
- = API_EXPORT(int) regcomp(regex_t *, const char *, int);
- = #define REG_BASIC 0000
- = #define REG_EXTENDED 0001
- = #define REG_ICASE 0002
- = #define REG_NOSUB 0004
- = #define REG_NEWLINE 0010
- = #define REG_NOSPEC 0020
- = #define REG_PEND 0040
- = #define REG_DUMP 0200
- */
-API_EXPORT(int) /* 0 success, otherwise REG_something */
-regcomp(preg, pattern, cflags)
-regex_t *preg;
-const char *pattern;
-int cflags;
-{
- struct parse pa;
- register struct re_guts *g;
- register struct parse *p = &pa;
- register int i;
- register size_t len;
-#ifdef REDEBUG
-# define GOODFLAGS(f) (f)
-#else
-# define GOODFLAGS(f) ((f)&~REG_DUMP)
-#endif
-
- cflags = GOODFLAGS(cflags);
- if ((cflags&REG_EXTENDED) && (cflags&REG_NOSPEC))
- return(REG_INVARG);
-
- if (cflags&REG_PEND) {
- if (preg->re_endp < pattern)
- return(REG_INVARG);
- len = preg->re_endp - pattern;
- } else
- len = strlen((char *)pattern);
-
- /* do the mallocs early so failure handling is easy */
- g = (struct re_guts *)malloc(sizeof(struct re_guts) +
- (NC-1)*sizeof(cat_t));
- if (g == NULL)
- return(REG_ESPACE);
- p->ssize = len/(size_t)2*(size_t)3 + (size_t)1; /* ugh */
- p->strip = (sop *)malloc(p->ssize * sizeof(sop));
- p->slen = 0;
- if (p->strip == NULL) {
- free((char *)g);
- return(REG_ESPACE);
- }
-
- /* set things up */
- p->g = g;
- p->next = (char *)pattern; /* convenience; we do not modify it */
- p->end = p->next + len;
- p->error = 0;
- p->ncsalloc = 0;
- for (i = 0; i < NPAREN; i++) {
- p->pbegin[i] = 0;
- p->pend[i] = 0;
- }
- g->csetsize = NC;
- g->sets = NULL;
- g->setbits = NULL;
- g->ncsets = 0;
- g->cflags = cflags;
- g->iflags = 0;
- g->nbol = 0;
- g->neol = 0;
- g->must = NULL;
- g->mlen = 0;
- g->nsub = 0;
- g->ncategories = 1; /* category 0 is "everything else" */
- g->categories = &g->catspace[-(CHAR_MIN)];
- (void) memset((char *)g->catspace, 0, NC*sizeof(cat_t));
- g->backrefs = 0;
-
- /* do it */
- EMIT(OEND, 0);
- g->firststate = THERE();
- if (cflags&REG_EXTENDED)
- p_ere(p, OUT);
- else if (cflags&REG_NOSPEC)
- p_str(p);
- else
- p_bre(p, OUT, OUT);
- EMIT(OEND, 0);
- g->laststate = THERE();
-
- /* tidy up loose ends and fill things in */
- categorize(p, g);
- stripsnug(p, g);
- findmust(p, g);
- g->nplus = pluscount(p, g);
- g->magic = MAGIC2;
- preg->re_nsub = g->nsub;
- preg->re_g = g;
- preg->re_magic = MAGIC1;
-#ifndef REDEBUG
- /* not debugging, so can't rely on the assert() in regexec() */
- if (g->iflags&BAD)
- SETERROR(REG_ASSERT);
-#endif
-
- /* win or lose, we're done */
- if (p->error != 0) /* lose */
- regfree(preg);
- return(p->error);
-}
-
-/*
- - p_ere - ERE parser top level, concatenation and alternation
- == static void p_ere(register struct parse *p, int stop);
- */
-static void
-p_ere(p, stop)
-register struct parse *p;
-int stop; /* character this ERE should end at */
-{
- register char c;
- register sopno prevback = 0;
- register sopno prevfwd = 0;
- register sopno conc;
- register int first = 1; /* is this the first alternative? */
-
- for (;;) {
- /* do a bunch of concatenated expressions */
- conc = HERE();
- while (MORE() && (c = PEEK()) != '|' && c != stop)
- p_ere_exp(p);
- (void) REQUIRE(HERE() != conc, REG_EMPTY); /* require nonempty */
-
- if (!EAT('|'))
- break; /* NOTE BREAK OUT */
-
- if (first) {
- INSERT(OCH_, conc); /* offset is wrong */
- prevfwd = conc;
- prevback = conc;
- first = 0;
- }
- ASTERN(OOR1, prevback);
- prevback = THERE();
- AHEAD(prevfwd); /* fix previous offset */
- prevfwd = HERE();
- EMIT(OOR2, 0); /* offset is very wrong */
- }
-
- if (!first) { /* tail-end fixups */
- AHEAD(prevfwd);
- ASTERN(O_CH, prevback);
- }
-
- assert(!MORE() || SEE(stop));
-}
-
-/*
- - p_ere_exp - parse one subERE, an atom possibly followed by a repetition op
- == static void p_ere_exp(register struct parse *p);
- */
-static void
-p_ere_exp(p)
-register struct parse *p;
-{
- register char c;
- register sopno pos;
- register int count;
- register int count2;
- register sopno subno;
- int wascaret = 0;
-
- assert(MORE()); /* caller should have ensured this */
- c = GETNEXT();
-
- pos = HERE();
- switch (c) {
- case '(':
- REQUIRE(MORE(), REG_EPAREN);
- p->g->nsub++;
- subno = p->g->nsub;
- if (subno < NPAREN)
- p->pbegin[subno] = HERE();
- EMIT(OLPAREN, subno);
- if (!SEE(')'))
- p_ere(p, ')');
- if (subno < NPAREN) {
- p->pend[subno] = HERE();
- assert(p->pend[subno] != 0);
- }
- EMIT(ORPAREN, subno);
- MUSTEAT(')', REG_EPAREN);
- break;
-#ifndef POSIX_MISTAKE
- case ')': /* happens only if no current unmatched ( */
- /*
- * You may ask, why the ifndef? Because I didn't notice
- * this until slightly too late for 1003.2, and none of the
- * other 1003.2 regular-expression reviewers noticed it at
- * all. So an unmatched ) is legal POSIX, at least until
- * we can get it fixed.
- */
- SETERROR(REG_EPAREN);
- break;
-#endif
- case '^':
- EMIT(OBOL, 0);
- p->g->iflags |= USEBOL;
- p->g->nbol++;
- wascaret = 1;
- break;
- case '$':
- EMIT(OEOL, 0);
- p->g->iflags |= USEEOL;
- p->g->neol++;
- break;
- case '|':
- SETERROR(REG_EMPTY);
- break;
- case '*':
- case '+':
- case '?':
- SETERROR(REG_BADRPT);
- break;
- case '.':
- if (p->g->cflags&REG_NEWLINE)
- nonnewline(p);
- else
- EMIT(OANY, 0);
- break;
- case '[':
- p_bracket(p);
- break;
- case '\\':
- REQUIRE(MORE(), REG_EESCAPE);
- c = GETNEXT();
- ordinary(p, c);
- break;
- case '{': /* okay as ordinary except if digit follows */
- REQUIRE(!MORE() || !isdigit(PEEK()), REG_BADRPT);
- /* FALLTHROUGH */
- default:
- ordinary(p, c);
- break;
- }
-
- if (!MORE())
- return;
- c = PEEK();
- /* we call { a repetition if followed by a digit */
- if (!( c == '*' || c == '+' || c == '?' ||
- (c == '{' && MORE2() && isdigit(PEEK2())) ))
- return; /* no repetition, we're done */
- NEXT();
-
- REQUIRE(!wascaret, REG_BADRPT);
- switch (c) {
- case '*': /* implemented as +? */
- /* this case does not require the (y|) trick, noKLUDGE */
- INSERT(OPLUS_, pos);
- ASTERN(O_PLUS, pos);
- INSERT(OQUEST_, pos);
- ASTERN(O_QUEST, pos);
- break;
- case '+':
- INSERT(OPLUS_, pos);
- ASTERN(O_PLUS, pos);
- break;
- case '?':
- /* KLUDGE: emit y? as (y|) until subtle bug gets fixed */
- INSERT(OCH_, pos); /* offset slightly wrong */
- ASTERN(OOR1, pos); /* this one's right */
- AHEAD(pos); /* fix the OCH_ */
- EMIT(OOR2, 0); /* offset very wrong... */
- AHEAD(THERE()); /* ...so fix it */
- ASTERN(O_CH, THERETHERE());
- break;
- case '{':
- count = p_count(p);
- if (EAT(',')) {
- if (isdigit(PEEK())) {
- count2 = p_count(p);
- REQUIRE(count <= count2, REG_BADBR);
- } else /* single number with comma */
- count2 = INFINITY;
- } else /* just a single number */
- count2 = count;
- repeat(p, pos, count, count2);
- if (!EAT('}')) { /* error heuristics */
- while (MORE() && PEEK() != '}')
- NEXT();
- REQUIRE(MORE(), REG_EBRACE);
- SETERROR(REG_BADBR);
- }
- break;
- }
-
- if (!MORE())
- return;
- c = PEEK();
- if (!( c == '*' || c == '+' || c == '?' ||
- (c == '{' && MORE2() && isdigit(PEEK2())) ) )
- return;
- SETERROR(REG_BADRPT);
-}
-
-/*
- - p_str - string (no metacharacters) "parser"
- == static void p_str(register struct parse *p);
- */
-static void
-p_str(p)
-register struct parse *p;
-{
- REQUIRE(MORE(), REG_EMPTY);
- while (MORE())
- ordinary(p, GETNEXT());
-}
-
-/*
- - p_bre - BRE parser top level, anchoring and concatenation
- == static void p_bre(register struct parse *p, register int end1, \
- == register int end2);
- * Giving end1 as OUT essentially eliminates the end1/end2 check.
- *
- * This implementation is a bit of a kludge, in that a trailing $ is first
- * taken as an ordinary character and then revised to be an anchor. The
- * only undesirable side effect is that '$' gets included as a character
- * category in such cases. This is fairly harmless; not worth fixing.
- * The amount of lookahead needed to avoid this kludge is excessive.
- */
-static void
-p_bre(p, end1, end2)
-register struct parse *p;
-register int end1; /* first terminating character */
-register int end2; /* second terminating character */
-{
- register sopno start = HERE();
- register int first = 1; /* first subexpression? */
- register int wasdollar = 0;
-
- if (EAT('^')) {
- EMIT(OBOL, 0);
- p->g->iflags |= USEBOL;
- p->g->nbol++;
- }
- while (MORE() && !SEETWO(end1, end2)) {
- wasdollar = p_simp_re(p, first);
- first = 0;
- }
- if (wasdollar) { /* oops, that was a trailing anchor */
- DROP(1);
- EMIT(OEOL, 0);
- p->g->iflags |= USEEOL;
- p->g->neol++;
- }
-
- REQUIRE(HERE() != start, REG_EMPTY); /* require nonempty */
-}
-
-/*
- - p_simp_re - parse a simple RE, an atom possibly followed by a repetition
- == static int p_simp_re(register struct parse *p, int starordinary);
- */
-static int /* was the simple RE an unbackslashed $? */
-p_simp_re(p, starordinary)
-register struct parse *p;
-int starordinary; /* is a leading * an ordinary character? */
-{
- register int c;
- register int count;
- register int count2;
- register sopno pos;
- register int i;
- register sopno subno;
-# define BACKSL (1<<CHAR_BIT)
-
- pos = HERE(); /* repetion op, if any, covers from here */
-
- assert(MORE()); /* caller should have ensured this */
- c = GETNEXT();
- if (c == '\\') {
- REQUIRE(MORE(), REG_EESCAPE);
- c = BACKSL | (unsigned char)GETNEXT();
- }
- switch (c) {
- case '.':
- if (p->g->cflags&REG_NEWLINE)
- nonnewline(p);
- else
- EMIT(OANY, 0);
- break;
- case '[':
- p_bracket(p);
- break;
- case BACKSL|'{':
- SETERROR(REG_BADRPT);
- break;
- case BACKSL|'(':
- p->g->nsub++;
- subno = p->g->nsub;
- if (subno < NPAREN)
- p->pbegin[subno] = HERE();
- EMIT(OLPAREN, subno);
- /* the MORE here is an error heuristic */
- if (MORE() && !SEETWO('\\', ')'))
- p_bre(p, '\\', ')');
- if (subno < NPAREN) {
- p->pend[subno] = HERE();
- assert(p->pend[subno] != 0);
- }
- EMIT(ORPAREN, subno);
- REQUIRE(EATTWO('\\', ')'), REG_EPAREN);
- break;
- case BACKSL|')': /* should not get here -- must be user */
- case BACKSL|'}':
- SETERROR(REG_EPAREN);
- break;
- case BACKSL|'1':
- case BACKSL|'2':
- case BACKSL|'3':
- case BACKSL|'4':
- case BACKSL|'5':
- case BACKSL|'6':
- case BACKSL|'7':
- case BACKSL|'8':
- case BACKSL|'9':
- i = (c&~BACKSL) - '0';
- assert(i < NPAREN);
- if (p->pend[i] != 0) {
- assert(i <= p->g->nsub);
- EMIT(OBACK_, i);
- assert(p->pbegin[i] != 0);
- assert(OP(p->strip[p->pbegin[i]]) == OLPAREN);
- assert(OP(p->strip[p->pend[i]]) == ORPAREN);
- (void) dupl(p, p->pbegin[i]+1, p->pend[i]);
- EMIT(O_BACK, i);
- } else
- SETERROR(REG_ESUBREG);
- p->g->backrefs = 1;
- break;
- case '*':
- REQUIRE(starordinary, REG_BADRPT);
- /* FALLTHROUGH */
- default:
- ordinary(p, (char)c); /* takes off BACKSL, if any */
- break;
- }
-
- if (EAT('*')) { /* implemented as +? */
- /* this case does not require the (y|) trick, noKLUDGE */
- INSERT(OPLUS_, pos);
- ASTERN(O_PLUS, pos);
- INSERT(OQUEST_, pos);
- ASTERN(O_QUEST, pos);
- } else if (EATTWO('\\', '{')) {
- count = p_count(p);
- if (EAT(',')) {
- if (MORE() && isdigit(PEEK())) {
- count2 = p_count(p);
- REQUIRE(count <= count2, REG_BADBR);
- } else /* single number with comma */
- count2 = INFINITY;
- } else /* just a single number */
- count2 = count;
- repeat(p, pos, count, count2);
- if (!EATTWO('\\', '}')) { /* error heuristics */
- while (MORE() && !SEETWO('\\', '}'))
- NEXT();
- REQUIRE(MORE(), REG_EBRACE);
- SETERROR(REG_BADBR);
- }
- } else if (c == (unsigned char)'$') /* $ (but not \$) ends it */
- return(1);
-
- return(0);
-}
-
-/*
- - p_count - parse a repetition count
- == static int p_count(register struct parse *p);
- */
-static int /* the value */
-p_count(p)
-register struct parse *p;
-{
- register int count = 0;
- register int ndigits = 0;
-
- while (MORE() && isdigit(PEEK()) && count <= DUPMAX) {
- count = count*10 + (GETNEXT() - '0');
- ndigits++;
- }
-
- REQUIRE(ndigits > 0 && count <= DUPMAX, REG_BADBR);
- return(count);
-}
-
-/*
- - p_bracket - parse a bracketed character list
- == static void p_bracket(register struct parse *p);
- *
- * Note a significant property of this code: if the allocset() did SETERROR,
- * no set operations are done.
- */
-static void
-p_bracket(p)
-register struct parse *p;
-{
- register cset *cs = allocset(p);
- register int invert = 0;
-
- /* Dept of Truly Sickening Special-Case Kludges */
- if (p->next + 5 < p->end && strncmp(p->next, "[:<:]]", 6) == 0) {
- EMIT(OBOW, 0);
- NEXTn(6);
- return;
- }
- if (p->next + 5 < p->end && strncmp(p->next, "[:>:]]", 6) == 0) {
- EMIT(OEOW, 0);
- NEXTn(6);
- return;
- }
-
- if (EAT('^'))
- invert++; /* make note to invert set at end */
- if (EAT(']'))
- CHadd(cs, ']');
- else if (EAT('-'))
- CHadd(cs, '-');
- while (MORE() && PEEK() != ']' && !SEETWO('-', ']'))
- p_b_term(p, cs);
- if (EAT('-'))
- CHadd(cs, '-');
- MUSTEAT(']', REG_EBRACK);
-
- if (p->error != 0) /* don't mess things up further */
- return;
-
- if (p->g->cflags&REG_ICASE) {
- register int i;
- register int ci;
-
- for (i = p->g->csetsize - 1; i >= 0; i--)
- if (CHIN(cs, i) && isalpha(i)) {
- ci = othercase(i);
- if (ci != i)
- CHadd(cs, ci);
- }
- if (cs->multis != NULL)
- mccase(p, cs);
- }
- if (invert) {
- register int i;
-
- for (i = p->g->csetsize - 1; i >= 0; i--)
- if (CHIN(cs, i))
- CHsub(cs, i);
- else
- CHadd(cs, i);
- if (p->g->cflags&REG_NEWLINE)
- CHsub(cs, '\n');
- if (cs->multis != NULL)
- mcinvert(p, cs);
- }
-
- assert(cs->multis == NULL); /* xxx */
-
- if (nch(p, cs) == 1) { /* optimize singleton sets */
- ordinary(p, firstch(p, cs));
- freeset(p, cs);
- } else
- EMIT(OANYOF, freezeset(p, cs));
-}
-
-/*
- - p_b_term - parse one term of a bracketed character list
- == static void p_b_term(register struct parse *p, register cset *cs);
- */
-static void
-p_b_term(p, cs)
-register struct parse *p;
-register cset *cs;
-{
- register char c;
- register char start, finish;
- register int i;
-
- /* classify what we've got */
- switch ((MORE()) ? PEEK() : '\0') {
- case '[':
- c = (MORE2()) ? PEEK2() : '\0';
- break;
- case '-':
- SETERROR(REG_ERANGE);
- return; /* NOTE RETURN */
- break;
- default:
- c = '\0';
- break;
- }
-
- switch (c) {
- case ':': /* character class */
- NEXT2();
- REQUIRE(MORE(), REG_EBRACK);
- c = PEEK();
- REQUIRE(c != '-' && c != ']', REG_ECTYPE);
- p_b_cclass(p, cs);
- REQUIRE(MORE(), REG_EBRACK);
- REQUIRE(EATTWO(':', ']'), REG_ECTYPE);
- break;
- case '=': /* equivalence class */
- NEXT2();
- REQUIRE(MORE(), REG_EBRACK);
- c = PEEK();
- REQUIRE(c != '-' && c != ']', REG_ECOLLATE);
- p_b_eclass(p, cs);
- REQUIRE(MORE(), REG_EBRACK);
- REQUIRE(EATTWO('=', ']'), REG_ECOLLATE);
- break;
- default: /* symbol, ordinary character, or range */
-/* xxx revision needed for multichar stuff */
- start = p_b_symbol(p);
- if (SEE('-') && MORE2() && PEEK2() != ']') {
- /* range */
- NEXT();
- if (EAT('-'))
- finish = '-';
- else
- finish = p_b_symbol(p);
- } else
- finish = start;
-/* xxx what about signed chars here... */
- REQUIRE(start <= finish, REG_ERANGE);
- for (i = start; i <= finish; i++)
- CHadd(cs, i);
- break;
- }
-}
-
-/*
- - p_b_cclass - parse a character-class name and deal with it
- == static void p_b_cclass(register struct parse *p, register cset *cs);
- */
-static void
-p_b_cclass(p, cs)
-register struct parse *p;
-register cset *cs;
-{
- register char *sp = p->next;
- register struct cclass *cp;
- register size_t len;
- register char *u;
- register char c;
-
- while (MORE() && isalpha(PEEK()))
- NEXT();
- len = p->next - sp;
- for (cp = cclasses; cp->name != NULL; cp++)
- if (strncmp(cp->name, sp, len) == 0 && cp->name[len] == '\0')
- break;
- if (cp->name == NULL) {
- /* oops, didn't find it */
- SETERROR(REG_ECTYPE);
- return;
- }
-
- u = cp->chars;
- while ((c = *u++) != '\0')
- CHadd(cs, c);
- for (u = cp->multis; *u != '\0'; u += strlen(u) + 1)
- MCadd(p, cs, u);
-}
-
-/*
- - p_b_eclass - parse an equivalence-class name and deal with it
- == static void p_b_eclass(register struct parse *p, register cset *cs);
- *
- * This implementation is incomplete. xxx
- */
-static void
-p_b_eclass(p, cs)
-register struct parse *p;
-register cset *cs;
-{
- register char c;
-
- c = p_b_coll_elem(p, '=');
- CHadd(cs, c);
-}
-
-/*
- - p_b_symbol - parse a character or [..]ed multicharacter collating symbol
- == static char p_b_symbol(register struct parse *p);
- */
-static char /* value of symbol */
-p_b_symbol(p)
-register struct parse *p;
-{
- register char value;
-
- REQUIRE(MORE(), REG_EBRACK);
- if (!EATTWO('[', '.'))
- return(GETNEXT());
-
- /* collating symbol */
- value = p_b_coll_elem(p, '.');
- REQUIRE(EATTWO('.', ']'), REG_ECOLLATE);
- return(value);
-}
-
-/*
- - p_b_coll_elem - parse a collating-element name and look it up
- == static char p_b_coll_elem(register struct parse *p, int endc);
- */
-static char /* value of collating element */
-p_b_coll_elem(p, endc)
-register struct parse *p;
-int endc; /* name ended by endc,']' */
-{
- register char *sp = p->next;
- register struct cname *cp;
- register int len;
-
- while (MORE() && !SEETWO(endc, ']'))
- NEXT();
- if (!MORE()) {
- SETERROR(REG_EBRACK);
- return(0);
- }
- len = p->next - sp;
- for (cp = cnames; cp->name != NULL; cp++)
- if (strncmp(cp->name, sp, len) == 0 && cp->name[len] == '\0')
- return(cp->code); /* known name */
- if (len == 1)
- return(*sp); /* single character */
- SETERROR(REG_ECOLLATE); /* neither */
- return(0);
-}
-
-/*
- - othercase - return the case counterpart of an alphabetic
- == static char othercase(int ch);
- */
-static char /* if no counterpart, return ch */
-othercase(ch)
-int ch;
-{
- assert(isalpha(ch));
- if (isupper(ch))
- return(tolower(ch));
- else if (islower(ch))
- return(toupper(ch));
- else /* peculiar, but could happen */
- return(ch);
-}
-
-/*
- - bothcases - emit a dualcase version of a two-case character
- == static void bothcases(register struct parse *p, int ch);
- *
- * Boy, is this implementation ever a kludge...
- */
-static void
-bothcases(p, ch)
-register struct parse *p;
-int ch;
-{
- register char *oldnext = p->next;
- register char *oldend = p->end;
- char bracket[3];
-
- assert(othercase(ch) != ch); /* p_bracket() would recurse */
- p->next = bracket;
- p->end = bracket+2;
- bracket[0] = ch;
- bracket[1] = ']';
- bracket[2] = '\0';
- p_bracket(p);
- assert(p->next == bracket+2);
- p->next = oldnext;
- p->end = oldend;
-}
-
-/*
- - ordinary - emit an ordinary character
- == static void ordinary(register struct parse *p, register int ch);
- */
-static void
-ordinary(p, ch)
-register struct parse *p;
-register int ch;
-{
- register cat_t *cap = p->g->categories;
-
- if ((p->g->cflags&REG_ICASE) && isalpha(ch) && othercase(ch) != ch)
- bothcases(p, ch);
- else {
- EMIT(OCHAR, (unsigned char)ch);
- if (cap[ch] == 0)
- cap[ch] = p->g->ncategories++;
- }
-}
-
-/*
- - nonnewline - emit REG_NEWLINE version of OANY
- == static void nonnewline(register struct parse *p);
- *
- * Boy, is this implementation ever a kludge...
- */
-static void
-nonnewline(p)
-register struct parse *p;
-{
- register char *oldnext = p->next;
- register char *oldend = p->end;
- char bracket[4];
-
- p->next = bracket;
- p->end = bracket+3;
- bracket[0] = '^';
- bracket[1] = '\n';
- bracket[2] = ']';
- bracket[3] = '\0';
- p_bracket(p);
- assert(p->next == bracket+3);
- p->next = oldnext;
- p->end = oldend;
-}
-
-/*
- - repeat - generate code for a bounded repetition, recursively if needed
- == static void repeat(register struct parse *p, sopno start, int from, int to);
- */
-static void
-repeat(p, start, from, to)
-register struct parse *p;
-sopno start; /* operand from here to end of strip */
-int from; /* repeated from this number */
-int to; /* to this number of times (maybe INFINITY) */
-{
- register sopno finish = HERE();
-# define N 2
-# define INF 3
-# define REP(f, t) ((f)*8 + (t))
-# define MAP(n) (((n) <= 1) ? (n) : ((n) == INFINITY) ? INF : N)
- register sopno copy;
-
- if (p->error != 0) /* head off possible runaway recursion */
- return;
-
- assert(from <= to);
-
- switch (REP(MAP(from), MAP(to))) {
- case REP(0, 0): /* must be user doing this */
- DROP(finish-start); /* drop the operand */
- break;
- case REP(0, 1): /* as x{1,1}? */
- case REP(0, N): /* as x{1,n}? */
- case REP(0, INF): /* as x{1,}? */
- /* KLUDGE: emit y? as (y|) until subtle bug gets fixed */
- INSERT(OCH_, start); /* offset is wrong... */
- repeat(p, start+1, 1, to);
- ASTERN(OOR1, start);
- AHEAD(start); /* ... fix it */
- EMIT(OOR2, 0);
- AHEAD(THERE());
- ASTERN(O_CH, THERETHERE());
- break;
- case REP(1, 1): /* trivial case */
- /* done */
- break;
- case REP(1, N): /* as x?x{1,n-1} */
- /* KLUDGE: emit y? as (y|) until subtle bug gets fixed */
- INSERT(OCH_, start);
- ASTERN(OOR1, start);
- AHEAD(start);
- EMIT(OOR2, 0); /* offset very wrong... */
- AHEAD(THERE()); /* ...so fix it */
- ASTERN(O_CH, THERETHERE());
- copy = dupl(p, start+1, finish+1);
- assert(copy == finish+4);
- repeat(p, copy, 1, to-1);
- break;
- case REP(1, INF): /* as x+ */
- INSERT(OPLUS_, start);
- ASTERN(O_PLUS, start);
- break;
- case REP(N, N): /* as xx{m-1,n-1} */
- copy = dupl(p, start, finish);
- repeat(p, copy, from-1, to-1);
- break;
- case REP(N, INF): /* as xx{n-1,INF} */
- copy = dupl(p, start, finish);
- repeat(p, copy, from-1, to);
- break;
- default: /* "can't happen" */
- SETERROR(REG_ASSERT); /* just in case */
- break;
- }
-}
-
-/*
- - seterr - set an error condition
- == static int seterr(register struct parse *p, int e);
- */
-static int /* useless but makes type checking happy */
-seterr(p, e)
-register struct parse *p;
-int e;
-{
- if (p->error == 0) /* keep earliest error condition */
- p->error = e;
- p->next = nuls; /* try to bring things to a halt */
- p->end = nuls;
- return(0); /* make the return value well-defined */
-}
-
-/*
- - allocset - allocate a set of characters for []
- == static cset *allocset(register struct parse *p);
- */
-static cset *
-allocset(p)
-register struct parse *p;
-{
- register int no = p->g->ncsets++;
- register size_t nc;
- register size_t nbytes;
- register cset *cs;
- register size_t css = (size_t)p->g->csetsize;
- register int i;
-
- if (no >= p->ncsalloc) { /* need another column of space */
- p->ncsalloc += CHAR_BIT;
- nc = p->ncsalloc;
- assert(nc % CHAR_BIT == 0);
- nbytes = nc / CHAR_BIT * css;
- if (p->g->sets == NULL)
- p->g->sets = (cset *)malloc(nc * sizeof(cset));
- else
- p->g->sets = (cset *)realloc((char *)p->g->sets,
- nc * sizeof(cset));
- if (p->g->setbits == NULL)
- p->g->setbits = (uch *)malloc(nbytes);
- else {
- p->g->setbits = (uch *)realloc((char *)p->g->setbits,
- nbytes);
- /* xxx this isn't right if setbits is now NULL */
- for (i = 0; i < no; i++)
- p->g->sets[i].ptr = p->g->setbits + css*(i/CHAR_BIT);
- }
- if (p->g->sets != NULL && p->g->setbits != NULL)
- (void) memset((char *)p->g->setbits + (nbytes - css),
- 0, css);
- else {
- no = 0;
- SETERROR(REG_ESPACE);
- /* caller's responsibility not to do set ops */
- }
- }
-
- assert(p->g->sets != NULL); /* xxx */
- cs = &p->g->sets[no];
- cs->ptr = p->g->setbits + css*((no)/CHAR_BIT);
- cs->mask = 1 << ((no) % CHAR_BIT);
- cs->hash = 0;
- cs->smultis = 0;
- cs->multis = NULL;
-
- return(cs);
-}
-
-/*
- - freeset - free a now-unused set
- == static void freeset(register struct parse *p, register cset *cs);
- */
-static void
-freeset(p, cs)
-register struct parse *p;
-register cset *cs;
-{
- register size_t i;
- register cset *top = &p->g->sets[p->g->ncsets];
- register size_t css = (size_t)p->g->csetsize;
-
- for (i = 0; i < css; i++)
- CHsub(cs, i);
- if (cs == top-1) /* recover only the easy case */
- p->g->ncsets--;
-}
-
-/*
- - freezeset - final processing on a set of characters
- == static int freezeset(register struct parse *p, register cset *cs);
- *
- * The main task here is merging identical sets. This is usually a waste
- * of time (although the hash code minimizes the overhead), but can win
- * big if REG_ICASE is being used. REG_ICASE, by the way, is why the hash
- * is done using addition rather than xor -- all ASCII [aA] sets xor to
- * the same value!
- */
-static int /* set number */
-freezeset(p, cs)
-register struct parse *p;
-register cset *cs;
-{
- register uch h = cs->hash;
- register size_t i;
- register cset *top = &p->g->sets[p->g->ncsets];
- register cset *cs2;
- register size_t css = (size_t)p->g->csetsize;
-
- /* look for an earlier one which is the same */
- for (cs2 = &p->g->sets[0]; cs2 < top; cs2++)
- if (cs2->hash == h && cs2 != cs) {
- /* maybe */
- for (i = 0; i < css; i++)
- if (!!CHIN(cs2, i) != !!CHIN(cs, i))
- break; /* no */
- if (i == css)
- break; /* yes */
- }
-
- if (cs2 < top) { /* found one */
- freeset(p, cs);
- cs = cs2;
- }
-
- return((int)(cs - p->g->sets));
-}
-
-/*
- - firstch - return first character in a set (which must have at least one)
- == static int firstch(register struct parse *p, register cset *cs);
- */
-static int /* character; there is no "none" value */
-firstch(p, cs)
-register struct parse *p;
-register cset *cs;
-{
- register size_t i;
- register size_t css = (size_t)p->g->csetsize;
-
- for (i = 0; i < css; i++)
- if (CHIN(cs, i))
- return((char)i);
- assert(never);
- return(0); /* arbitrary */
-}
-
-/*
- - nch - number of characters in a set
- == static int nch(register struct parse *p, register cset *cs);
- */
-static int
-nch(p, cs)
-register struct parse *p;
-register cset *cs;
-{
- register size_t i;
- register size_t css = (size_t)p->g->csetsize;
- register int n = 0;
-
- for (i = 0; i < css; i++)
- if (CHIN(cs, i))
- n++;
- return(n);
-}
-
-/*
- - mcadd - add a collating element to a cset
- == static void mcadd(register struct parse *p, register cset *cs, \
- == register char *cp);
- */
-static void
-mcadd(p, cs, cp)
-register struct parse *p;
-register cset *cs;
-register char *cp;
-{
- register size_t oldend = cs->smultis;
-
- cs->smultis += strlen(cp) + 1;
- if (cs->multis == NULL)
- cs->multis = malloc(cs->smultis);
- else
- cs->multis = realloc(cs->multis, cs->smultis);
- if (cs->multis == NULL) {
- SETERROR(REG_ESPACE);
- return;
- }
-
- (void) strcpy(cs->multis + oldend - 1, cp);
- cs->multis[cs->smultis - 1] = '\0';
-}
-
-#if 0
-/*
- - mcsub - subtract a collating element from a cset
- == static void mcsub(register cset *cs, register char *cp);
- */
-static void
-mcsub(cs, cp)
-register cset *cs;
-register char *cp;
-{
- register char *fp = mcfind(cs, cp);
- register size_t len = strlen(fp);
-
- assert(fp != NULL);
- (void) memmove(fp, fp + len + 1,
- cs->smultis - (fp + len + 1 - cs->multis));
- cs->smultis -= len;
-
- if (cs->smultis == 0) {
- free(cs->multis);
- cs->multis = NULL;
- return;
- }
-
- cs->multis = realloc(cs->multis, cs->smultis);
- assert(cs->multis != NULL);
-}
-
-/*
- - mcin - is a collating element in a cset?
- == static int mcin(register cset *cs, register char *cp);
- */
-static int
-mcin(cs, cp)
-register cset *cs;
-register char *cp;
-{
- return(mcfind(cs, cp) != NULL);
-}
-
-
-/*
- - mcfind - find a collating element in a cset
- == static char *mcfind(register cset *cs, register char *cp);
- */
-static char *
-mcfind(cs, cp)
-register cset *cs;
-register char *cp;
-{
- register char *p;
-
- if (cs->multis == NULL)
- return(NULL);
- for (p = cs->multis; *p != '\0'; p += strlen(p) + 1)
- if (strcmp(cp, p) == 0)
- return(p);
- return(NULL);
-}
-#endif
-
-/*
- - mcinvert - invert the list of collating elements in a cset
- == static void mcinvert(register struct parse *p, register cset *cs);
- *
- * This would have to know the set of possibilities. Implementation
- * is deferred.
- */
-static void
-mcinvert(p, cs)
-register struct parse *p;
-register cset *cs;
-{
- assert(cs->multis == NULL); /* xxx */
-}
-
-/*
- - mccase - add case counterparts of the list of collating elements in a cset
- == static void mccase(register struct parse *p, register cset *cs);
- *
- * This would have to know the set of possibilities. Implementation
- * is deferred.
- */
-static void
-mccase(p, cs)
-register struct parse *p;
-register cset *cs;
-{
- assert(cs->multis == NULL); /* xxx */
-}
-
-/*
- - isinsets - is this character in any sets?
- == static int isinsets(register struct re_guts *g, int c);
- */
-static int /* predicate */
-isinsets(g, c)
-register struct re_guts *g;
-int c;
-{
- register uch *col;
- register int i;
- register int ncols = (g->ncsets+(CHAR_BIT-1)) / CHAR_BIT;
- register unsigned uc = (unsigned char)c;
-
- for (i = 0, col = g->setbits; i < ncols; i++, col += g->csetsize)
- if (col[uc] != 0)
- return(1);
- return(0);
-}
-
-/*
- - samesets - are these two characters in exactly the same sets?
- == static int samesets(register struct re_guts *g, int c1, int c2);
- */
-static int /* predicate */
-samesets(g, c1, c2)
-register struct re_guts *g;
-int c1;
-int c2;
-{
- register uch *col;
- register int i;
- register int ncols = (g->ncsets+(CHAR_BIT-1)) / CHAR_BIT;
- register unsigned uc1 = (unsigned char)c1;
- register unsigned uc2 = (unsigned char)c2;
-
- for (i = 0, col = g->setbits; i < ncols; i++, col += g->csetsize)
- if (col[uc1] != col[uc2])
- return(0);
- return(1);
-}
-
-/*
- - categorize - sort out character categories
- == static void categorize(struct parse *p, register struct re_guts *g);
- */
-static void
-categorize(p, g)
-struct parse *p;
-register struct re_guts *g;
-{
- register cat_t *cats = g->categories;
- register int c;
- register int c2;
- register cat_t cat;
-
- /* avoid making error situations worse */
- if (p->error != 0)
- return;
-
- for (c = CHAR_MIN; c <= CHAR_MAX; c++)
- if (cats[c] == 0 && isinsets(g, c)) {
- cat = g->ncategories++;
- cats[c] = cat;
- for (c2 = c+1; c2 <= CHAR_MAX; c2++)
- if (cats[c2] == 0 && samesets(g, c, c2))
- cats[c2] = cat;
- }
-}
-
-/*
- - dupl - emit a duplicate of a bunch of sops
- == static sopno dupl(register struct parse *p, sopno start, sopno finish);
- */
-static sopno /* start of duplicate */
-dupl(p, start, finish)
-register struct parse *p;
-sopno start; /* from here */
-sopno finish; /* to this less one */
-{
- register sopno ret = HERE();
- register sopno len = finish - start;
-
- assert(finish >= start);
- if (len == 0)
- return(ret);
- enlarge(p, p->ssize + len); /* this many unexpected additions */
- assert(p->ssize >= p->slen + len);
- (void) memcpy((char *)(p->strip + p->slen),
- (char *)(p->strip + start), (size_t)len*sizeof(sop));
- p->slen += len;
- return(ret);
-}
-
-/*
- - doemit - emit a strip operator
- == static void doemit(register struct parse *p, sop op, size_t opnd);
- *
- * It might seem better to implement this as a macro with a function as
- * hard-case backup, but it's just too big and messy unless there are
- * some changes to the data structures. Maybe later.
- */
-static void
-doemit(p, op, opnd)
-register struct parse *p;
-sop op;
-size_t opnd;
-{
- /* avoid making error situations worse */
- if (p->error != 0)
- return;
-
- /* deal with oversize operands ("can't happen", more or less) */
- assert(opnd < 1<<OPSHIFT);
-
- /* deal with undersized strip */
- if (p->slen >= p->ssize)
- enlarge(p, (p->ssize+1) / 2 * 3); /* +50% */
- assert(p->slen < p->ssize);
-
- /* finally, it's all reduced to the easy case */
- p->strip[p->slen++] = SOP(op, opnd);
-}
-
-/*
- - doinsert - insert a sop into the strip
- == static void doinsert(register struct parse *p, sop op, size_t opnd, sopno pos);
- */
-static void
-doinsert(p, op, opnd, pos)
-register struct parse *p;
-sop op;
-size_t opnd;
-sopno pos;
-{
- register sopno sn;
- register sop s;
- register int i;
-
- /* avoid making error situations worse */
- if (p->error != 0)
- return;
-
- sn = HERE();
- EMIT(op, opnd); /* do checks, ensure space */
- assert(HERE() == sn+1);
- s = p->strip[sn];
-
- /* adjust paren pointers */
- assert(pos > 0);
- for (i = 1; i < NPAREN; i++) {
- if (p->pbegin[i] >= pos) {
- p->pbegin[i]++;
- }
- if (p->pend[i] >= pos) {
- p->pend[i]++;
- }
- }
-
- memmove((char *)&p->strip[pos+1], (char *)&p->strip[pos],
- (HERE()-pos-1)*sizeof(sop));
- p->strip[pos] = s;
-}
-
-/*
- - dofwd - complete a forward reference
- == static void dofwd(register struct parse *p, sopno pos, sop value);
- */
-static void
-dofwd(p, pos, value)
-register struct parse *p;
-register sopno pos;
-sop value;
-{
- /* avoid making error situations worse */
- if (p->error != 0)
- return;
-
- assert(value < 1<<OPSHIFT);
- p->strip[pos] = OP(p->strip[pos]) | value;
-}
-
-/*
- - enlarge - enlarge the strip
- == static void enlarge(register struct parse *p, sopno size);
- */
-static void
-enlarge(p, size)
-register struct parse *p;
-register sopno size;
-{
- register sop *sp;
-
- if (p->ssize >= size)
- return;
-
- sp = (sop *)realloc(p->strip, size*sizeof(sop));
- if (sp == NULL) {
- SETERROR(REG_ESPACE);
- return;
- }
- p->strip = sp;
- p->ssize = size;
-}
-
-/*
- - stripsnug - compact the strip
- == static void stripsnug(register struct parse *p, register struct re_guts *g);
- */
-static void
-stripsnug(p, g)
-register struct parse *p;
-register struct re_guts *g;
-{
- g->nstates = p->slen;
- g->strip = (sop *)realloc((char *)p->strip, p->slen * sizeof(sop));
- if (g->strip == NULL) {
- SETERROR(REG_ESPACE);
- g->strip = p->strip;
- }
-}
-
-/*
- - findmust - fill in must and mlen with longest mandatory literal string
- == static void findmust(register struct parse *p, register struct re_guts *g);
- *
- * This algorithm could do fancy things like analyzing the operands of |
- * for common subsequences. Someday. This code is simple and finds most
- * of the interesting cases.
- *
- * Note that must and mlen got initialized during setup.
- */
-static void
-findmust(p, g)
-struct parse *p;
-register struct re_guts *g;
-{
- register sop *scan;
- sop *start = NULL;
- register sop *newstart = NULL;
- register sopno newlen;
- register sop s;
- register char *cp;
- register sopno i;
-
- /* avoid making error situations worse */
- if (p->error != 0)
- return;
-
- /* find the longest OCHAR sequence in strip */
- newlen = 0;
- scan = g->strip + 1;
- do {
- s = *scan++;
- switch (OP(s)) {
- case OCHAR: /* sequence member */
- if (newlen == 0) /* new sequence */
- newstart = scan - 1;
- newlen++;
- break;
- case OPLUS_: /* things that don't break one */
- case OLPAREN:
- case ORPAREN:
- break;
- case OQUEST_: /* things that must be skipped */
- case OCH_:
- scan--;
- do {
- scan += OPND(s);
- s = *scan;
- /* assert() interferes w debug printouts */
- if (OP(s) != O_QUEST && OP(s) != O_CH &&
- OP(s) != OOR2) {
- g->iflags |= BAD;
- return;
- }
- } while (OP(s) != O_QUEST && OP(s) != O_CH);
- /* fallthrough */
- default: /* things that break a sequence */
- if (newlen > g->mlen) { /* ends one */
- start = newstart;
- g->mlen = newlen;
- }
- newlen = 0;
- break;
- }
- } while (OP(s) != OEND);
-
- if (g->mlen == 0) /* there isn't one */
- return;
-
- /* turn it into a character string */
- g->must = malloc((size_t)g->mlen + 1);
- if (g->must == NULL) { /* argh; just forget it */
- g->mlen = 0;
- return;
- }
- cp = g->must;
- scan = start;
- for (i = g->mlen; i > 0; i--) {
- while (OP(s = *scan++) != OCHAR)
- continue;
- assert(cp < g->must + g->mlen);
- *cp++ = (char)OPND(s);
- }
- assert(cp == g->must + g->mlen);
- *cp++ = '\0'; /* just on general principles */
-}
-
-/*
- - pluscount - count + nesting
- == static sopno pluscount(register struct parse *p, register struct re_guts *g);
- */
-static sopno /* nesting depth */
-pluscount(p, g)
-struct parse *p;
-register struct re_guts *g;
-{
- register sop *scan;
- register sop s;
- register sopno plusnest = 0;
- register sopno maxnest = 0;
-
- if (p->error != 0)
- return(0); /* there may not be an OEND */
-
- scan = g->strip + 1;
- do {
- s = *scan++;
- switch (OP(s)) {
- case OPLUS_:
- plusnest++;
- break;
- case O_PLUS:
- if (plusnest > maxnest)
- maxnest = plusnest;
- plusnest--;
- break;
- }
- } while (OP(s) != OEND);
- if (plusnest != 0)
- g->iflags |= BAD;
- return(maxnest);
-}
diff --git a/ext/ereg/regex/regcomp.ih b/ext/ereg/regex/regcomp.ih
deleted file mode 100644
index 6efafebf60..0000000000
--- a/ext/ereg/regex/regcomp.ih
+++ /dev/null
@@ -1,53 +0,0 @@
-/* ========= begin header generated by ./mkh ========= */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* === regcomp.c === */
-static void p_ere(register struct parse *p, int stop);
-static void p_ere_exp(register struct parse *p);
-static void p_str(register struct parse *p);
-static void p_bre(register struct parse *p, register int end1, register int end2);
-static int p_simp_re(register struct parse *p, int starordinary);
-static int p_count(register struct parse *p);
-static void p_bracket(register struct parse *p);
-static void p_b_term(register struct parse *p, register cset *cs);
-static void p_b_cclass(register struct parse *p, register cset *cs);
-static void p_b_eclass(register struct parse *p, register cset *cs);
-static char p_b_symbol(register struct parse *p);
-static char p_b_coll_elem(register struct parse *p, int endc);
-static char othercase(int ch);
-static void bothcases(register struct parse *p, int ch);
-static void ordinary(register struct parse *p, register int ch);
-static void nonnewline(register struct parse *p);
-static void repeat(register struct parse *p, sopno start, int from, int to);
-static int seterr(register struct parse *p, int e);
-static cset *allocset(register struct parse *p);
-static void freeset(register struct parse *p, register cset *cs);
-static int freezeset(register struct parse *p, register cset *cs);
-static int firstch(register struct parse *p, register cset *cs);
-static int nch(register struct parse *p, register cset *cs);
-static void mcadd(register struct parse *p, register cset *cs, register char *cp);
-#if 0
-static void mcsub(register cset *cs, register char *cp);
-static int mcin(register cset *cs, register char *cp);
-static char *mcfind(register cset *cs, register char *cp);
-#endif
-static void mcinvert(register struct parse *p, register cset *cs);
-static void mccase(register struct parse *p, register cset *cs);
-static int isinsets(register struct re_guts *g, int c);
-static int samesets(register struct re_guts *g, int c1, int c2);
-static void categorize(struct parse *p, register struct re_guts *g);
-static sopno dupl(register struct parse *p, sopno start, sopno finish);
-static void doemit(register struct parse *p, sop op, size_t opnd);
-static void doinsert(register struct parse *p, sop op, size_t opnd, sopno pos);
-static void dofwd(register struct parse *p, sopno pos, sop value);
-static void enlarge(register struct parse *p, sopno size);
-static void stripsnug(register struct parse *p, register struct re_guts *g);
-static void findmust(register struct parse *p, register struct re_guts *g);
-static sopno pluscount(register struct parse *p, register struct re_guts *g);
-
-#ifdef __cplusplus
-}
-#endif
-/* ========= end header generated by ./mkh ========= */
diff --git a/ext/ereg/regex/regerror.c b/ext/ereg/regex/regerror.c
deleted file mode 100644
index bf71e3a814..0000000000
--- a/ext/ereg/regex/regerror.c
+++ /dev/null
@@ -1,126 +0,0 @@
-#include <sys/types.h>
-#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
-#include <limits.h>
-#include <stdlib.h>
-#include <regex.h>
-
-#include "utils.h"
-#include "regerror.ih"
-
-/*
- = #define REG_OKAY 0
- = #define REG_NOMATCH 1
- = #define REG_BADPAT 2
- = #define REG_ECOLLATE 3
- = #define REG_ECTYPE 4
- = #define REG_EESCAPE 5
- = #define REG_ESUBREG 6
- = #define REG_EBRACK 7
- = #define REG_EPAREN 8
- = #define REG_EBRACE 9
- = #define REG_BADBR 10
- = #define REG_ERANGE 11
- = #define REG_ESPACE 12
- = #define REG_BADRPT 13
- = #define REG_EMPTY 14
- = #define REG_ASSERT 15
- = #define REG_INVARG 16
- = #define REG_ATOI 255 // convert name to number (!)
- = #define REG_ITOA 0400 // convert number to name (!)
- */
-static struct rerr {
- int code;
- char *name;
- char *explain;
-} rerrs[] = {
- {REG_OKAY, "REG_OKAY", "no errors detected"},
- {REG_NOMATCH, "REG_NOMATCH", "regexec() failed to match"},
- {REG_BADPAT, "REG_BADPAT", "invalid regular expression"},
- {REG_ECOLLATE, "REG_ECOLLATE", "invalid collating element"},
- {REG_ECTYPE, "REG_ECTYPE", "invalid character class"},
- {REG_EESCAPE, "REG_EESCAPE", "trailing backslash (\\)"},
- {REG_ESUBREG, "REG_ESUBREG", "invalid backreference number"},
- {REG_EBRACK, "REG_EBRACK", "brackets ([ ]) not balanced"},
- {REG_EPAREN, "REG_EPAREN", "parentheses not balanced"},
- {REG_EBRACE, "REG_EBRACE", "braces not balanced"},
- {REG_BADBR, "REG_BADBR", "invalid repetition count(s)"},
- {REG_ERANGE, "REG_ERANGE", "invalid character range"},
- {REG_ESPACE, "REG_ESPACE", "out of memory"},
- {REG_BADRPT, "REG_BADRPT", "repetition-operator operand invalid"},
- {REG_EMPTY, "REG_EMPTY", "empty (sub)expression"},
- {REG_ASSERT, "REG_ASSERT", "\"can't happen\" -- you found a bug"},
- {REG_INVARG, "REG_INVARG", "invalid argument to regex routine"},
- {-1, "", "*** unknown regexp error code ***"},
-};
-
-/*
- - regerror - the interface to error numbers
- = API_EXPORT(size_t) regerror(int, const regex_t *, char *, size_t);
- */
-/* ARGSUSED */
-API_EXPORT(size_t)
-regerror(errcode, preg, errbuf, errbuf_size)
-int errcode;
-const regex_t *preg;
-char *errbuf;
-size_t errbuf_size;
-{
- register struct rerr *r;
- register size_t len;
- register int target = errcode &~ REG_ITOA;
- register char *s;
- char convbuf[50];
-
- if (errcode == REG_ATOI)
- s = regatoi(preg, convbuf);
- else {
- for (r = rerrs; r->code >= 0; r++)
- if (r->code == target)
- break;
-
- if (errcode&REG_ITOA) {
- if (r->code >= 0)
- (void) strcpy(convbuf, r->name);
- else
- sprintf(convbuf, "REG_0x%x", target);
- assert(strlen(convbuf) < sizeof(convbuf));
- s = convbuf;
- } else
- s = r->explain;
- }
-
- len = strlen(s) + 1;
- if (errbuf_size > 0) {
- if (errbuf_size > len)
- (void) strcpy(errbuf, s);
- else {
- (void) strncpy(errbuf, s, errbuf_size-1);
- errbuf[errbuf_size-1] = '\0';
- }
- }
-
- return(len);
-}
-
-/*
- - regatoi - internal routine to implement REG_ATOI
- == static char *regatoi(const regex_t *preg, char *localbuf);
- */
-static char *
-regatoi(preg, localbuf)
-const regex_t *preg;
-char *localbuf;
-{
- register struct rerr *r;
-
- for (r = rerrs; r->code >= 0; r++)
- if (strcmp(r->name, preg->re_endp) == 0)
- break;
- if (r->code < 0)
- return("0");
-
- sprintf(localbuf, "%d", r->code);
- return(localbuf);
-}
diff --git a/ext/ereg/regex/regerror.ih b/ext/ereg/regex/regerror.ih
deleted file mode 100644
index 2cb668c24f..0000000000
--- a/ext/ereg/regex/regerror.ih
+++ /dev/null
@@ -1,12 +0,0 @@
-/* ========= begin header generated by ./mkh ========= */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* === regerror.c === */
-static char *regatoi(const regex_t *preg, char *localbuf);
-
-#ifdef __cplusplus
-}
-#endif
-/* ========= end header generated by ./mkh ========= */
diff --git a/ext/ereg/regex/regex.3 b/ext/ereg/regex/regex.3
deleted file mode 100644
index 100c8a7f71..0000000000
--- a/ext/ereg/regex/regex.3
+++ /dev/null
@@ -1,502 +0,0 @@
-.TH REGEX 3 "17 May 1993"
-.BY "Henry Spencer"
-.de ZR
-.\" one other place knows this name: the SEE ALSO section
-.IR regex (7) \\$1
-..
-.SH NAME
-regcomp, regexec, regerror, regfree \- regular-expression library
-.SH SYNOPSIS
-.ft B
-.\".na
-#include <sys/types.h>
-.br
-#include <regex.h>
-.HP 10
-int regcomp(regex_t\ *preg, const\ char\ *pattern, int\ cflags);
-.HP
-int\ regexec(const\ regex_t\ *preg, const\ char\ *string,
-size_t\ nmatch, regmatch_t\ pmatch[], int\ eflags);
-.HP
-size_t\ regerror(int\ errcode, const\ regex_t\ *preg,
-char\ *errbuf, size_t\ errbuf_size);
-.HP
-void\ regfree(regex_t\ *preg);
-.\".ad
-.ft
-.SH DESCRIPTION
-These routines implement POSIX 1003.2 regular expressions (``RE''s);
-see
-.ZR .
-.I Regcomp
-compiles an RE written as a string into an internal form,
-.I regexec
-matches that internal form against a string and reports results,
-.I regerror
-transforms error codes from either into human-readable messages,
-and
-.I regfree
-frees any dynamically-allocated storage used by the internal form
-of an RE.
-.PP
-The header
-.I <regex.h>
-declares two structure types,
-.I regex_t
-and
-.IR regmatch_t ,
-the former for compiled internal forms and the latter for match reporting.
-It also declares the four functions,
-a type
-.IR regoff_t ,
-and a number of constants with names starting with ``REG_''.
-.PP
-.I Regcomp
-compiles the regular expression contained in the
-.I pattern
-string,
-subject to the flags in
-.IR cflags ,
-and places the results in the
-.I regex_t
-structure pointed to by
-.IR preg .
-.I Cflags
-is the bitwise OR of zero or more of the following flags:
-.IP REG_EXTENDED \w'REG_EXTENDED'u+2n
-Compile modern (``extended'') REs,
-rather than the obsolete (``basic'') REs that
-are the default.
-.IP REG_BASIC
-This is a synonym for 0,
-provided as a counterpart to REG_EXTENDED to improve readability.
-.IP REG_NOSPEC
-Compile with recognition of all special characters turned off.
-All characters are thus considered ordinary,
-so the ``RE'' is a literal string.
-This is an extension,
-compatible with but not specified by POSIX 1003.2,
-and should be used with
-caution in software intended to be portable to other systems.
-REG_EXTENDED and REG_NOSPEC may not be used
-in the same call to
-.IR regcomp .
-.IP REG_ICASE
-Compile for matching that ignores upper/lower case distinctions.
-See
-.ZR .
-.IP REG_NOSUB
-Compile for matching that need only report success or failure,
-not what was matched.
-.IP REG_NEWLINE
-Compile for newline-sensitive matching.
-By default, newline is a completely ordinary character with no special
-meaning in either REs or strings.
-With this flag,
-`[^' bracket expressions and `.' never match newline,
-a `^' anchor matches the null string after any newline in the string
-in addition to its normal function,
-and the `$' anchor matches the null string before any newline in the
-string in addition to its normal function.
-.IP REG_PEND
-The regular expression ends,
-not at the first NUL,
-but just before the character pointed to by the
-.I re_endp
-member of the structure pointed to by
-.IR preg .
-The
-.I re_endp
-member is of type
-.IR const\ char\ * .
-This flag permits inclusion of NULs in the RE;
-they are considered ordinary characters.
-This is an extension,
-compatible with but not specified by POSIX 1003.2,
-and should be used with
-caution in software intended to be portable to other systems.
-.PP
-When successful,
-.I regcomp
-returns 0 and fills in the structure pointed to by
-.IR preg .
-One member of that structure
-(other than
-.IR re_endp )
-is publicized:
-.IR re_nsub ,
-of type
-.IR size_t ,
-contains the number of parenthesized subexpressions within the RE
-(except that the value of this member is undefined if the
-REG_NOSUB flag was used).
-If
-.I regcomp
-fails, it returns a non-zero error code;
-see DIAGNOSTICS.
-.PP
-.I Regexec
-matches the compiled RE pointed to by
-.I preg
-against the
-.IR string ,
-subject to the flags in
-.IR eflags ,
-and reports results using
-.IR nmatch ,
-.IR pmatch ,
-and the returned value.
-The RE must have been compiled by a previous invocation of
-.IR regcomp .
-The compiled form is not altered during execution of
-.IR regexec ,
-so a single compiled RE can be used simultaneously by multiple threads.
-.PP
-By default,
-the NUL-terminated string pointed to by
-.I string
-is considered to be the text of an entire line, minus any terminating
-newline.
-The
-.I eflags
-argument is the bitwise OR of zero or more of the following flags:
-.IP REG_NOTBOL \w'REG_STARTEND'u+2n
-The first character of
-the string
-is not the beginning of a line, so the `^' anchor should not match before it.
-This does not affect the behavior of newlines under REG_NEWLINE.
-.IP REG_NOTEOL
-The NUL terminating
-the string
-does not end a line, so the `$' anchor should not match before it.
-This does not affect the behavior of newlines under REG_NEWLINE.
-.IP REG_STARTEND
-The string is considered to start at
-\fIstring\fR\ + \fIpmatch\fR[0].\fIrm_so\fR
-and to have a terminating NUL located at
-\fIstring\fR\ + \fIpmatch\fR[0].\fIrm_eo\fR
-(there need not actually be a NUL at that location),
-regardless of the value of
-.IR nmatch .
-See below for the definition of
-.IR pmatch
-and
-.IR nmatch .
-This is an extension,
-compatible with but not specified by POSIX 1003.2,
-and should be used with
-caution in software intended to be portable to other systems.
-Note that a non-zero \fIrm_so\fR does not imply REG_NOTBOL;
-REG_STARTEND affects only the location of the string,
-not how it is matched.
-.PP
-See
-.ZR
-for a discussion of what is matched in situations where an RE or a
-portion thereof could match any of several substrings of
-.IR string .
-.PP
-Normally,
-.I regexec
-returns 0 for success and the non-zero code REG_NOMATCH for failure.
-Other non-zero error codes may be returned in exceptional situations;
-see DIAGNOSTICS.
-.PP
-If REG_NOSUB was specified in the compilation of the RE,
-or if
-.I nmatch
-is 0,
-.I regexec
-ignores the
-.I pmatch
-argument (but see below for the case where REG_STARTEND is specified).
-Otherwise,
-.I pmatch
-points to an array of
-.I nmatch
-structures of type
-.IR regmatch_t .
-Such a structure has at least the members
-.I rm_so
-and
-.IR rm_eo ,
-both of type
-.I regoff_t
-(a signed arithmetic type at least as large as an
-.I off_t
-and a
-.IR ssize_t ),
-containing respectively the offset of the first character of a substring
-and the offset of the first character after the end of the substring.
-Offsets are measured from the beginning of the
-.I string
-argument given to
-.IR regexec .
-An empty substring is denoted by equal offsets,
-both indicating the character following the empty substring.
-.PP
-The 0th member of the
-.I pmatch
-array is filled in to indicate what substring of
-.I string
-was matched by the entire RE.
-Remaining members report what substring was matched by parenthesized
-subexpressions within the RE;
-member
-.I i
-reports subexpression
-.IR i ,
-with subexpressions counted (starting at 1) by the order of their opening
-parentheses in the RE, left to right.
-Unused entries in the array\(emcorresponding either to subexpressions that
-did not participate in the match at all, or to subexpressions that do not
-exist in the RE (that is, \fIi\fR\ > \fIpreg\fR\->\fIre_nsub\fR)\(emhave both
-.I rm_so
-and
-.I rm_eo
-set to \-1.
-If a subexpression participated in the match several times,
-the reported substring is the last one it matched.
-(Note, as an example in particular, that when the RE `(b*)+' matches `bbb',
-the parenthesized subexpression matches each of the three `b's and then
-an infinite number of empty strings following the last `b',
-so the reported substring is one of the empties.)
-.PP
-If REG_STARTEND is specified,
-.I pmatch
-must point to at least one
-.I regmatch_t
-(even if
-.I nmatch
-is 0 or REG_NOSUB was specified),
-to hold the input offsets for REG_STARTEND.
-Use for output is still entirely controlled by
-.IR nmatch ;
-if
-.I nmatch
-is 0 or REG_NOSUB was specified,
-the value of
-.IR pmatch [0]
-will not be changed by a successful
-.IR regexec .
-.PP
-.I Regerror
-maps a non-zero
-.I errcode
-from either
-.I regcomp
-or
-.I regexec
-to a human-readable, printable message.
-If
-.I preg
-is non-NULL,
-the error code should have arisen from use of
-the
-.I regex_t
-pointed to by
-.IR preg ,
-and if the error code came from
-.IR regcomp ,
-it should have been the result from the most recent
-.I regcomp
-using that
-.IR regex_t .
-.RI ( Regerror
-may be able to supply a more detailed message using information
-from the
-.IR regex_t .)
-.I Regerror
-places the NUL-terminated message into the buffer pointed to by
-.IR errbuf ,
-limiting the length (including the NUL) to at most
-.I errbuf_size
-bytes.
-If the whole message won't fit,
-as much of it as will fit before the terminating NUL is supplied.
-In any case,
-the returned value is the size of buffer needed to hold the whole
-message (including terminating NUL).
-If
-.I errbuf_size
-is 0,
-.I errbuf
-is ignored but the return value is still correct.
-.PP
-If the
-.I errcode
-given to
-.I regerror
-is first ORed with REG_ITOA,
-the ``message'' that results is the printable name of the error code,
-e.g. ``REG_NOMATCH'',
-rather than an explanation thereof.
-If
-.I errcode
-is REG_ATOI,
-then
-.I preg
-shall be non-NULL and the
-.I re_endp
-member of the structure it points to
-must point to the printable name of an error code;
-in this case, the result in
-.I errbuf
-is the decimal digits of
-the numeric value of the error code
-(0 if the name is not recognized).
-REG_ITOA and REG_ATOI are intended primarily as debugging facilities;
-they are extensions,
-compatible with but not specified by POSIX 1003.2,
-and should be used with
-caution in software intended to be portable to other systems.
-Be warned also that they are considered experimental and changes are possible.
-.PP
-.I Regfree
-frees any dynamically-allocated storage associated with the compiled RE
-pointed to by
-.IR preg .
-The remaining
-.I regex_t
-is no longer a valid compiled RE
-and the effect of supplying it to
-.I regexec
-or
-.I regerror
-is undefined.
-.PP
-None of these functions references global variables except for tables
-of constants;
-all are safe for use from multiple threads if the arguments are safe.
-.SH IMPLEMENTATION CHOICES
-There are a number of decisions that 1003.2 leaves up to the implementor,
-either by explicitly saying ``undefined'' or by virtue of them being
-forbidden by the RE grammar.
-This implementation treats them as follows.
-.PP
-See
-.ZR
-for a discussion of the definition of case-independent matching.
-.PP
-There is no particular limit on the length of REs,
-except insofar as memory is limited.
-Memory usage is approximately linear in RE size, and largely insensitive
-to RE complexity, except for bounded repetitions.
-See BUGS for one short RE using them
-that will run almost any system out of memory.
-.PP
-A backslashed character other than one specifically given a magic meaning
-by 1003.2 (such magic meanings occur only in obsolete [``basic''] REs)
-is taken as an ordinary character.
-.PP
-Any unmatched [ is a REG_EBRACK error.
-.PP
-Equivalence classes cannot begin or end bracket-expression ranges.
-The endpoint of one range cannot begin another.
-.PP
-RE_DUP_MAX, the limit on repetition counts in bounded repetitions, is 255.
-.PP
-A repetition operator (?, *, +, or bounds) cannot follow another
-repetition operator.
-A repetition operator cannot begin an expression or subexpression
-or follow `^' or `|'.
-.PP
-`|' cannot appear first or last in a (sub)expression or after another `|',
-i.e. an operand of `|' cannot be an empty subexpression.
-An empty parenthesized subexpression, `()', is legal and matches an
-empty (sub)string.
-An empty string is not a legal RE.
-.PP
-A `{' followed by a digit is considered the beginning of bounds for a
-bounded repetition, which must then follow the syntax for bounds.
-A `{' \fInot\fR followed by a digit is considered an ordinary character.
-.PP
-`^' and `$' beginning and ending subexpressions in obsolete (``basic'')
-REs are anchors, not ordinary characters.
-.SH SEE ALSO
-grep(1), regex(7)
-.PP
-POSIX 1003.2, sections 2.8 (Regular Expression Notation)
-and
-B.5 (C Binding for Regular Expression Matching).
-.SH DIAGNOSTICS
-Non-zero error codes from
-.I regcomp
-and
-.I regexec
-include the following:
-.PP
-.nf
-.ta \w'REG_ECOLLATE'u+3n
-REG_NOMATCH regexec() failed to match
-REG_BADPAT invalid regular expression
-REG_ECOLLATE invalid collating element
-REG_ECTYPE invalid character class
-REG_EESCAPE \e applied to unescapable character
-REG_ESUBREG invalid backreference number
-REG_EBRACK brackets [ ] not balanced
-REG_EPAREN parentheses ( ) not balanced
-REG_EBRACE braces { } not balanced
-REG_BADBR invalid repetition count(s) in { }
-REG_ERANGE invalid character range in [ ]
-REG_ESPACE ran out of memory
-REG_BADRPT ?, *, or + operand invalid
-REG_EMPTY empty (sub)expression
-REG_ASSERT ``can't happen''\(emyou found a bug
-REG_INVARG invalid argument, e.g. negative-length string
-.fi
-.SH HISTORY
-Written by Henry Spencer at University of Toronto,
-henry@zoo.toronto.edu.
-.SH BUGS
-This is an alpha release with known defects.
-Please report problems.
-.PP
-There is one known functionality bug.
-The implementation of internationalization is incomplete:
-the locale is always assumed to be the default one of 1003.2,
-and only the collating elements etc. of that locale are available.
-.PP
-The back-reference code is subtle and doubts linger about its correctness
-in complex cases.
-.PP
-.I Regexec
-performance is poor.
-This will improve with later releases.
-.I Nmatch
-exceeding 0 is expensive;
-.I nmatch
-exceeding 1 is worse.
-.I Regexec
-is largely insensitive to RE complexity \fIexcept\fR that back
-references are massively expensive.
-RE length does matter; in particular, there is a strong speed bonus
-for keeping RE length under about 30 characters,
-with most special characters counting roughly double.
-.PP
-.I Regcomp
-implements bounded repetitions by macro expansion,
-which is costly in time and space if counts are large
-or bounded repetitions are nested.
-An RE like, say,
-`((((a{1,100}){1,100}){1,100}){1,100}){1,100}'
-will (eventually) run almost any existing machine out of swap space.
-.PP
-There are suspected problems with response to obscure error conditions.
-Notably,
-certain kinds of internal overflow,
-produced only by truly enormous REs or by multiply nested bounded repetitions,
-are probably not handled well.
-.PP
-Due to a mistake in 1003.2, things like `a)b' are legal REs because `)' is
-a special character only in the presence of a previous unmatched `('.
-This can't be fixed until the spec is fixed.
-.PP
-The standard's definition of back references is vague.
-For example, does
-`a\e(\e(b\e)*\e2\e)*d' match `abbbd'?
-Until the standard is clarified,
-behavior in such cases should not be relied on.
-.PP
-The implementation of word-boundary matching is a bit of a kludge,
-and bugs may lurk in combinations of word-boundary matching and anchoring.
diff --git a/ext/ereg/regex/regex.7 b/ext/ereg/regex/regex.7
deleted file mode 100644
index d89012bda1..0000000000
--- a/ext/ereg/regex/regex.7
+++ /dev/null
@@ -1,233 +0,0 @@
-.TH REGEX 7 "7 Feb 1994"
-.BY "Henry Spencer"
-.SH NAME
-regex \- POSIX 1003.2 regular expressions
-.SH DESCRIPTION
-Regular expressions (``RE''s),
-as defined in POSIX 1003.2, come in two forms:
-modern REs (roughly those of
-.IR egrep ;
-1003.2 calls these ``extended'' REs)
-and obsolete REs (roughly those of
-.IR ed ;
-1003.2 ``basic'' REs).
-Obsolete REs mostly exist for backward compatibility in some old programs;
-they will be discussed at the end.
-1003.2 leaves some aspects of RE syntax and semantics open;
-`\(dg' marks decisions on these aspects that
-may not be fully portable to other 1003.2 implementations.
-.PP
-A (modern) RE is one\(dg or more non-empty\(dg \fIbranches\fR,
-separated by `|'.
-It matches anything that matches one of the branches.
-.PP
-A branch is one\(dg or more \fIpieces\fR, concatenated.
-It matches a match for the first, followed by a match for the second, etc.
-.PP
-A piece is an \fIatom\fR possibly followed
-by a single\(dg `*', `+', `?', or \fIbound\fR.
-An atom followed by `*' matches a sequence of 0 or more matches of the atom.
-An atom followed by `+' matches a sequence of 1 or more matches of the atom.
-An atom followed by `?' matches a sequence of 0 or 1 matches of the atom.
-.PP
-A \fIbound\fR is `{' followed by an unsigned decimal integer,
-possibly followed by `,'
-possibly followed by another unsigned decimal integer,
-always followed by `}'.
-The integers must lie between 0 and RE_DUP_MAX (255\(dg) inclusive,
-and if there are two of them, the first may not exceed the second.
-An atom followed by a bound containing one integer \fIi\fR
-and no comma matches
-a sequence of exactly \fIi\fR matches of the atom.
-An atom followed by a bound
-containing one integer \fIi\fR and a comma matches
-a sequence of \fIi\fR or more matches of the atom.
-An atom followed by a bound
-containing two integers \fIi\fR and \fIj\fR matches
-a sequence of \fIi\fR through \fIj\fR (inclusive) matches of the atom.
-.PP
-An atom is a regular expression enclosed in `()' (matching a match for the
-regular expression),
-an empty set of `()' (matching the null string)\(dg,
-a \fIbracket expression\fR (see below), `.'
-(matching any single character), `^' (matching the null string at the
-beginning of a line), `$' (matching the null string at the
-end of a line), a `\e' followed by one of the characters
-`^.[$()|*+?{\e'
-(matching that character taken as an ordinary character),
-a `\e' followed by any other character\(dg
-(matching that character taken as an ordinary character,
-as if the `\e' had not been present\(dg),
-or a single character with no other significance (matching that character).
-A `{' followed by a character other than a digit is an ordinary
-character, not the beginning of a bound\(dg.
-It is illegal to end an RE with `\e'.
-.PP
-A \fIbracket expression\fR is a list of characters enclosed in `[]'.
-It normally matches any single character from the list (but see below).
-If the list begins with `^',
-it matches any single character
-(but see below) \fInot\fR from the rest of the list.
-If two characters in the list are separated by `\-', this is shorthand
-for the full \fIrange\fR of characters between those two (inclusive) in the
-collating sequence,
-e.g. `[0-9]' in ASCII matches any decimal digit.
-It is illegal\(dg for two ranges to share an
-endpoint, e.g. `a-c-e'.
-Ranges are very collating-sequence-dependent,
-and portable programs should avoid relying on them.
-.PP
-To include a literal `]' in the list, make it the first character
-(following a possible `^').
-To include a literal `\-', make it the first or last character,
-or the second endpoint of a range.
-To use a literal `\-' as the first endpoint of a range,
-enclose it in `[.' and `.]' to make it a collating element (see below).
-With the exception of these and some combinations using `[' (see next
-paragraphs), all other special characters, including `\e', lose their
-special significance within a bracket expression.
-.PP
-Within a bracket expression, a collating element (a character,
-a multi-character sequence that collates as if it were a single character,
-or a collating-sequence name for either)
-enclosed in `[.' and `.]' stands for the
-sequence of characters of that collating element.
-The sequence is a single element of the bracket expression's list.
-A bracket expression containing a multi-character collating element
-can thus match more than one character,
-e.g. if the collating sequence includes a `ch' collating element,
-then the RE `[[.ch.]]*c' matches the first five characters
-of `chchcc'.
-.PP
-Within a bracket expression, a collating element enclosed in `[=' and
-`=]' is an equivalence class, standing for the sequences of characters
-of all collating elements equivalent to that one, including itself.
-(If there are no other equivalent collating elements,
-the treatment is as if the enclosing delimiters were `[.' and `.]'.)
-For example, if o and \o'o^' are the members of an equivalence class,
-then `[[=o=]]', `[[=\o'o^'=]]', and `[o\o'o^']' are all synonymous.
-An equivalence class may not\(dg be an endpoint
-of a range.
-.PP
-Within a bracket expression, the name of a \fIcharacter class\fR enclosed
-in `[:' and `:]' stands for the list of all characters belonging to that
-class.
-Standard character class names are:
-.PP
-.RS
-.nf
-.ta 3c 6c 9c
-alnum digit punct
-alpha graph space
-blank lower upper
-cntrl print xdigit
-.fi
-.RE
-.PP
-These stand for the character classes defined in
-.IR ctype (3).
-A locale may provide others.
-A character class may not be used as an endpoint of a range.
-.PP
-There are two special cases\(dg of bracket expressions:
-the bracket expressions `[[:<:]]' and `[[:>:]]' match the null string at
-the beginning and end of a word respectively.
-A word is defined as a sequence of
-word characters
-which is neither preceded nor followed by
-word characters.
-A word character is an
-.I alnum
-character (as defined by
-.IR ctype (3))
-or an underscore.
-This is an extension,
-compatible with but not specified by POSIX 1003.2,
-and should be used with
-caution in software intended to be portable to other systems.
-.PP
-In the event that an RE could match more than one substring of a given
-string,
-the RE matches the one starting earliest in the string.
-If the RE could match more than one substring starting at that point,
-it matches the longest.
-Subexpressions also match the longest possible substrings, subject to
-the constraint that the whole match be as long as possible,
-with subexpressions starting earlier in the RE taking priority over
-ones starting later.
-Note that higher-level subexpressions thus take priority over
-their lower-level component subexpressions.
-.PP
-Match lengths are measured in characters, not collating elements.
-A null string is considered longer than no match at all.
-For example,
-`bb*' matches the three middle characters of `abbbc',
-`(wee|week)(knights|nights)' matches all ten characters of `weeknights',
-when `(.*).*' is matched against `abc' the parenthesized subexpression
-matches all three characters, and
-when `(a*)*' is matched against `bc' both the whole RE and the parenthesized
-subexpression match the null string.
-.PP
-If case-independent matching is specified,
-the effect is much as if all case distinctions had vanished from the
-alphabet.
-When an alphabetic that exists in multiple cases appears as an
-ordinary character outside a bracket expression, it is effectively
-transformed into a bracket expression containing both cases,
-e.g. `x' becomes `[xX]'.
-When it appears inside a bracket expression, all case counterparts
-of it are added to the bracket expression, so that (e.g.) `[x]'
-becomes `[xX]' and `[^x]' becomes `[^xX]'.
-.PP
-No particular limit is imposed on the length of REs\(dg.
-Programs intended to be portable should not employ REs longer
-than 256 bytes,
-as an implementation can refuse to accept such REs and remain
-POSIX-compliant.
-.PP
-Obsolete (``basic'') regular expressions differ in several respects.
-`|', `+', and `?' are ordinary characters and there is no equivalent
-for their functionality.
-The delimiters for bounds are `\e{' and `\e}',
-with `{' and `}' by themselves ordinary characters.
-The parentheses for nested subexpressions are `\e(' and `\e)',
-with `(' and `)' by themselves ordinary characters.
-`^' is an ordinary character except at the beginning of the
-RE or\(dg the beginning of a parenthesized subexpression,
-`$' is an ordinary character except at the end of the
-RE or\(dg the end of a parenthesized subexpression,
-and `*' is an ordinary character if it appears at the beginning of the
-RE or the beginning of a parenthesized subexpression
-(after a possible leading `^').
-Finally, there is one new type of atom, a \fIback reference\fR:
-`\e' followed by a non-zero decimal digit \fId\fR
-matches the same sequence of characters
-matched by the \fId\fRth parenthesized subexpression
-(numbering subexpressions by the positions of their opening parentheses,
-left to right),
-so that (e.g.) `\e([bc]\e)\e1' matches `bb' or `cc' but not `bc'.
-.SH SEE ALSO
-regex(3)
-.PP
-POSIX 1003.2, section 2.8 (Regular Expression Notation).
-.SH BUGS
-Having two kinds of REs is a botch.
-.PP
-The current 1003.2 spec says that `)' is an ordinary character in
-the absence of an unmatched `(';
-this was an unintentional result of a wording error,
-and change is likely.
-Avoid relying on it.
-.PP
-Back references are a dreadful botch,
-posing major problems for efficient implementations.
-They are also somewhat vaguely defined
-(does
-`a\e(\e(b\e)*\e2\e)*d' match `abbbd'?).
-Avoid using them.
-.PP
-1003.2's specification of case-independent matching is vague.
-The ``one case implies all cases'' definition given above
-is current consensus among implementors as to the right interpretation.
-.PP
-The syntax for word boundaries is incredibly ugly.
diff --git a/ext/ereg/regex/regex.dsp b/ext/ereg/regex/regex.dsp
deleted file mode 100644
index e8f1ad4299..0000000000
--- a/ext/ereg/regex/regex.dsp
+++ /dev/null
@@ -1,106 +0,0 @@
-# Microsoft Developer Studio Project File - Name="regex" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 5.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=regex - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "regex.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "regex.mak" CFG="regex - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "regex - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "regex - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "regex - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
-# ADD CPP /nologo /MT /W3 /GX /O2 /I "." /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386
-
-!ELSEIF "$(CFG)" == "regex - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
-# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "." /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept
-
-!ENDIF
-
-# Begin Target
-
-# Name "regex - Win32 Release"
-# Name "regex - Win32 Debug"
-# Begin Source File
-
-SOURCE=.\regcomp.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\regerror.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\regexec.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\regfree.c
-# End Source File
-# End Target
-# End Project
diff --git a/ext/ereg/regex/regex.dsw b/ext/ereg/regex/regex.dsw
deleted file mode 100644
index 7b7df8126c..0000000000
--- a/ext/ereg/regex/regex.dsw
+++ /dev/null
@@ -1,29 +0,0 @@
-Microsoft Developer Studio Workspace File, Format Version 5.00
-# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
-
-###############################################################################
-
-Project: "regex"=.\regex.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Global:
-
-Package=<5>
-{{{
-}}}
-
-Package=<3>
-{{{
-}}}
-
-###############################################################################
-
diff --git a/ext/ereg/regex/regex.h b/ext/ereg/regex/regex.h
deleted file mode 100644
index b39c5e178c..0000000000
--- a/ext/ereg/regex/regex.h
+++ /dev/null
@@ -1,83 +0,0 @@
-#ifndef _HSREGEX_H_
-#define _HSREGEX_H_
-#ifndef _HSREGEX_H
-#define _HSREGEX_H /* never again */
-/* ========= begin header generated by ././mkh ========= */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* === regex2.h === */
-#ifdef WIN32
-#define API_EXPORT(type) __declspec(dllexport) type __stdcall
-#else
-#define API_EXPORT(type) type
-#endif
-
-typedef off_t regoff_t;
-typedef struct {
- int re_magic;
- size_t re_nsub; /* number of parenthesized subexpressions */
- const char *re_endp; /* end pointer for REG_PEND */
- struct re_guts *re_g; /* none of your business :-) */
-} regex_t;
-typedef struct {
- regoff_t rm_so; /* start of match */
- regoff_t rm_eo; /* end of match */
-} regmatch_t;
-
-
-/* === regcomp.c === */
-API_EXPORT(int) regcomp(regex_t *, const char *, int);
-#define REG_BASIC 0000
-#define REG_EXTENDED 0001
-#define REG_ICASE 0002
-#define REG_NOSUB 0004
-#define REG_NEWLINE 0010
-#define REG_NOSPEC 0020
-#define REG_PEND 0040
-#define REG_DUMP 0200
-
-
-/* === regerror.c === */
-#define REG_OKAY 0
-#define REG_NOMATCH 1
-#define REG_BADPAT 2
-#define REG_ECOLLATE 3
-#define REG_ECTYPE 4
-#define REG_EESCAPE 5
-#define REG_ESUBREG 6
-#define REG_EBRACK 7
-#define REG_EPAREN 8
-#define REG_EBRACE 9
-#define REG_BADBR 10
-#define REG_ERANGE 11
-#define REG_ESPACE 12
-#define REG_BADRPT 13
-#define REG_EMPTY 14
-#define REG_ASSERT 15
-#define REG_INVARG 16
-#define REG_ATOI 255 /* convert name to number (!) */
-#define REG_ITOA 0400 /* convert number to name (!) */
-API_EXPORT(size_t) regerror(int, const regex_t *, char *, size_t);
-
-
-/* === regexec.c === */
-API_EXPORT(int) regexec(const regex_t *, const char *, size_t, regmatch_t [], int);
-#define REG_NOTBOL 00001
-#define REG_NOTEOL 00002
-#define REG_STARTEND 00004
-#define REG_TRACE 00400 /* tracing of execution */
-#define REG_LARGE 01000 /* force large representation */
-#define REG_BACKR 02000 /* force use of backref code */
-
-
-/* === regfree.c === */
-API_EXPORT(void) regfree(regex_t *);
-
-#ifdef __cplusplus
-}
-#endif
-/* ========= end header generated by ././mkh ========= */
-#endif
-#endif
diff --git a/ext/ereg/regex/regex.mak b/ext/ereg/regex/regex.mak
deleted file mode 100644
index b87ded340b..0000000000
--- a/ext/ereg/regex/regex.mak
+++ /dev/null
@@ -1,304 +0,0 @@
-# Microsoft Developer Studio Generated NMAKE File, Based on regex.dsp
-!IF "$(CFG)" == ""
-CFG=regex - Win32 Release
-!MESSAGE No configuration specified. Defaulting to regex - Win32 Release.
-!ENDIF
-
-!IF "$(CFG)" != "regex - Win32 Release" && "$(CFG)" != "regex - Win32 Debug"
-!MESSAGE Invalid configuration "$(CFG)" specified.
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "regex.mak" CFG="regex - Win32 Release"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "regex - Win32 Release" (based on "Win32 (x86) Static Library")
-!MESSAGE "regex - Win32 Debug" (based on "Win32 (x86) Static Library")
-!MESSAGE
-!ERROR An invalid configuration is specified.
-!ENDIF
-
-!IF "$(OS)" == "Windows_NT"
-NULL=
-!ELSE
-NULL=nul
-!ENDIF
-
-CPP=cl.exe
-
-!IF "$(CFG)" == "regex - Win32 Release"
-
-OUTDIR=.\Release
-INTDIR=.\Release
-# Begin Custom Macros
-OutDir=.\.\Release
-# End Custom Macros
-
-!IF "$(RECURSE)" == "0"
-
-ALL : "$(OUTDIR)\regex.lib"
-
-!ELSE
-
-ALL : "$(OUTDIR)\regex.lib"
-
-!ENDIF
-
-CLEAN :
- -@erase "$(INTDIR)\regcomp.obj"
- -@erase "$(INTDIR)\regerror.obj"
- -@erase "$(INTDIR)\regexec.obj"
- -@erase "$(INTDIR)\regfree.obj"
- -@erase "$(INTDIR)\vc50.idb"
- -@erase "$(OUTDIR)\regex.lib"
-
-"$(OUTDIR)" :
- if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
-
-CPP_PROJ=/nologo /MD /W3 /GX /O2 /I "." /D "WIN32" /D "NDEBUG" /D "_WINDOWS"\
- /Fp"$(INTDIR)\regex.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
-CPP_OBJS=.\Release/
-CPP_SBRS=.
-BSC32=bscmake.exe
-BSC32_FLAGS=/nologo /o"$(OUTDIR)\regex.bsc"
-BSC32_SBRS= \
-
-LIB32=link.exe -lib
-LIB32_FLAGS=/nologo /out:"$(OUTDIR)\regex.lib"
-LIB32_OBJS= \
- "$(INTDIR)\regcomp.obj" \
- "$(INTDIR)\regerror.obj" \
- "$(INTDIR)\regexec.obj" \
- "$(INTDIR)\regfree.obj"
-
-"$(OUTDIR)\regex.lib" : "$(OUTDIR)" $(DEF_FILE) $(LIB32_OBJS)
- $(LIB32) @<<
- $(LIB32_FLAGS) $(DEF_FLAGS) $(LIB32_OBJS)
-<<
-
-!ELSEIF "$(CFG)" == "regex - Win32 Debug"
-
-OUTDIR=.\Debug
-INTDIR=.\Debug
-# Begin Custom Macros
-OutDir=.\.\Debug
-# End Custom Macros
-
-!IF "$(RECURSE)" == "0"
-
-ALL : "$(OUTDIR)\regex.lib" "$(OUTDIR)\regex.bsc"
-
-!ELSE
-
-ALL : "$(OUTDIR)\regex.lib" "$(OUTDIR)\regex.bsc"
-
-!ENDIF
-
-CLEAN :
- -@erase "$(INTDIR)\regcomp.obj"
- -@erase "$(INTDIR)\regcomp.sbr"
- -@erase "$(INTDIR)\regerror.obj"
- -@erase "$(INTDIR)\regerror.sbr"
- -@erase "$(INTDIR)\regexec.obj"
- -@erase "$(INTDIR)\regexec.sbr"
- -@erase "$(INTDIR)\regfree.obj"
- -@erase "$(INTDIR)\regfree.sbr"
- -@erase "$(INTDIR)\vc50.idb"
- -@erase "$(OUTDIR)\regex.bsc"
- -@erase "$(OUTDIR)\regex.lib"
-
-"$(OUTDIR)" :
- if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
-
-CPP_PROJ=/nologo /MDd /W3 /GX /Z7 /Od /I "." /D "WIN32" /D "_DEBUG" /D\
- "_WINDOWS" /FR"$(INTDIR)\\" /Fp"$(INTDIR)\regex.pch" /YX /Fo"$(INTDIR)\\"\
- /Fd"$(INTDIR)\\" /FD /c
-CPP_OBJS=.\Debug/
-CPP_SBRS=.\Debug/
-BSC32=bscmake.exe
-BSC32_FLAGS=/nologo /o"$(OUTDIR)\regex.bsc"
-BSC32_SBRS= \
- "$(INTDIR)\regcomp.sbr" \
- "$(INTDIR)\regerror.sbr" \
- "$(INTDIR)\regexec.sbr" \
- "$(INTDIR)\regfree.sbr"
-
-"$(OUTDIR)\regex.bsc" : "$(OUTDIR)" $(BSC32_SBRS)
- $(BSC32) @<<
- $(BSC32_FLAGS) $(BSC32_SBRS)
-<<
-
-LIB32=link.exe -lib
-LIB32_FLAGS=/nologo /out:"$(OUTDIR)\regex.lib"
-LIB32_OBJS= \
- "$(INTDIR)\regcomp.obj" \
- "$(INTDIR)\regerror.obj" \
- "$(INTDIR)\regexec.obj" \
- "$(INTDIR)\regfree.obj"
-
-"$(OUTDIR)\regex.lib" : "$(OUTDIR)" $(DEF_FILE) $(LIB32_OBJS)
- $(LIB32) @<<
- $(LIB32_FLAGS) $(DEF_FLAGS) $(LIB32_OBJS)
-<<
-
-!ENDIF
-
-.c{$(CPP_OBJS)}.obj::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cpp{$(CPP_OBJS)}.obj::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cxx{$(CPP_OBJS)}.obj::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.c{$(CPP_SBRS)}.sbr::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cpp{$(CPP_SBRS)}.sbr::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cxx{$(CPP_SBRS)}.sbr::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-
-!IF "$(CFG)" == "regex - Win32 Release" || "$(CFG)" == "regex - Win32 Debug"
-SOURCE=.\regcomp.c
-
-!IF "$(CFG)" == "regex - Win32 Release"
-
-DEP_CPP_REGCO=\
- ".\cclass.h"\
- ".\cname.h"\
- ".\regcomp.ih"\
- ".\regex.h"\
- ".\regex2.h"\
- ".\utils.h"\
-
-
-"$(INTDIR)\regcomp.obj" : $(SOURCE) $(DEP_CPP_REGCO) "$(INTDIR)"
-
-
-!ELSEIF "$(CFG)" == "regex - Win32 Debug"
-
-DEP_CPP_REGCO=\
- ".\cclass.h"\
- ".\cname.h"\
- ".\regcomp.ih"\
- ".\regex.h"\
- ".\regex2.h"\
- ".\utils.h"\
- {$(INCLUDE)}"sys\types.h"\
-
-
-"$(INTDIR)\regcomp.obj" "$(INTDIR)\regcomp.sbr" : $(SOURCE) $(DEP_CPP_REGCO)\
- "$(INTDIR)"
-
-
-!ENDIF
-
-SOURCE=.\regerror.c
-
-!IF "$(CFG)" == "regex - Win32 Release"
-
-DEP_CPP_REGER=\
- ".\regerror.ih"\
- ".\regex.h"\
- ".\utils.h"\
-
-
-"$(INTDIR)\regerror.obj" : $(SOURCE) $(DEP_CPP_REGER) "$(INTDIR)"
-
-
-!ELSEIF "$(CFG)" == "regex - Win32 Debug"
-
-DEP_CPP_REGER=\
- ".\regerror.ih"\
- ".\regex.h"\
- ".\utils.h"\
- {$(INCLUDE)}"sys\types.h"\
-
-
-"$(INTDIR)\regerror.obj" "$(INTDIR)\regerror.sbr" : $(SOURCE) $(DEP_CPP_REGER)\
- "$(INTDIR)"
-
-
-!ENDIF
-
-SOURCE=.\regexec.c
-
-!IF "$(CFG)" == "regex - Win32 Release"
-
-DEP_CPP_REGEX=\
- ".\engine.c"\
- ".\engine.ih"\
- ".\regex.h"\
- ".\regex2.h"\
- ".\utils.h"\
-
-
-"$(INTDIR)\regexec.obj" : $(SOURCE) $(DEP_CPP_REGEX) "$(INTDIR)"
-
-
-!ELSEIF "$(CFG)" == "regex - Win32 Debug"
-
-DEP_CPP_REGEX=\
- ".\engine.c"\
- ".\engine.ih"\
- ".\regex.h"\
- ".\regex2.h"\
- ".\utils.h"\
- {$(INCLUDE)}"sys\types.h"\
-
-
-"$(INTDIR)\regexec.obj" "$(INTDIR)\regexec.sbr" : $(SOURCE) $(DEP_CPP_REGEX)\
- "$(INTDIR)"
-
-
-!ENDIF
-
-SOURCE=.\regfree.c
-
-!IF "$(CFG)" == "regex - Win32 Release"
-
-DEP_CPP_REGFR=\
- ".\regex.h"\
- ".\regex2.h"\
- ".\utils.h"\
-
-
-"$(INTDIR)\regfree.obj" : $(SOURCE) $(DEP_CPP_REGFR) "$(INTDIR)"
-
-
-!ELSEIF "$(CFG)" == "regex - Win32 Debug"
-
-DEP_CPP_REGFR=\
- ".\regex.h"\
- ".\regex2.h"\
- ".\utils.h"\
- {$(INCLUDE)}"sys\types.h"\
-
-
-"$(INTDIR)\regfree.obj" "$(INTDIR)\regfree.sbr" : $(SOURCE) $(DEP_CPP_REGFR)\
- "$(INTDIR)"
-
-
-!ENDIF
-
-SOURCE=.\engine.c
-
-!ENDIF
-
diff --git a/ext/ereg/regex/regex2.h b/ext/ereg/regex/regex2.h
deleted file mode 100644
index 7cd39a59ae..0000000000
--- a/ext/ereg/regex/regex2.h
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * First, the stuff that ends up in the outside-world include file
- = #ifdef WIN32
- = #define API_EXPORT(type) __declspec(dllexport) type __stdcall
- = #else
- = #define API_EXPORT(type) type
- = #endif
- =
- = typedef off_t regoff_t;
- = typedef struct {
- = int re_magic;
- = size_t re_nsub; // number of parenthesized subexpressions
- = const char *re_endp; // end pointer for REG_PEND
- = struct re_guts *re_g; // none of your business :-)
- = } regex_t;
- = typedef struct {
- = regoff_t rm_so; // start of match
- = regoff_t rm_eo; // end of match
- = } regmatch_t;
- */
-/*
- * internals of regex_t
- */
-#define MAGIC1 ((('r'^0200)<<8) | 'e')
-
-/*
- * The internal representation is a *strip*, a sequence of
- * operators ending with an endmarker. (Some terminology etc. is a
- * historical relic of earlier versions which used multiple strips.)
- * Certain oddities in the representation are there to permit running
- * the machinery backwards; in particular, any deviation from sequential
- * flow must be marked at both its source and its destination. Some
- * fine points:
- *
- * - OPLUS_ and O_PLUS are *inside* the loop they create.
- * - OQUEST_ and O_QUEST are *outside* the bypass they create.
- * - OCH_ and O_CH are *outside* the multi-way branch they create, while
- * OOR1 and OOR2 are respectively the end and the beginning of one of
- * the branches. Note that there is an implicit OOR2 following OCH_
- * and an implicit OOR1 preceding O_CH.
- *
- * In state representations, an operator's bit is on to signify a state
- * immediately *preceding* "execution" of that operator.
- */
-typedef long sop; /* strip operator */
-typedef long sopno;
-#define OPRMASK 0x7c000000
-#define OPDMASK 0x03ffffff
-#define OPSHIFT (26)
-#define OP(n) ((n)&OPRMASK)
-#define OPND(n) ((n)&OPDMASK)
-#define SOP(op, opnd) ((op)|(opnd))
-/* operators meaning operand */
-/* (back, fwd are offsets) */
-#define OEND (1<<OPSHIFT) /* endmarker - */
-#define OCHAR (2<<OPSHIFT) /* character unsigned char */
-#define OBOL (3<<OPSHIFT) /* left anchor - */
-#define OEOL (4<<OPSHIFT) /* right anchor - */
-#define OANY (5<<OPSHIFT) /* . - */
-#define OANYOF (6<<OPSHIFT) /* [...] set number */
-#define OBACK_ (7<<OPSHIFT) /* begin \d paren number */
-#define O_BACK (8<<OPSHIFT) /* end \d paren number */
-#define OPLUS_ (9<<OPSHIFT) /* + prefix fwd to suffix */
-#define O_PLUS (10<<OPSHIFT) /* + suffix back to prefix */
-#define OQUEST_ (11<<OPSHIFT) /* ? prefix fwd to suffix */
-#define O_QUEST (12<<OPSHIFT) /* ? suffix back to prefix */
-#define OLPAREN (13<<OPSHIFT) /* ( fwd to ) */
-#define ORPAREN (14<<OPSHIFT) /* ) back to ( */
-#define OCH_ (15<<OPSHIFT) /* begin choice fwd to OOR2 */
-#define OOR1 (16<<OPSHIFT) /* | pt. 1 back to OOR1 or OCH_ */
-#define OOR2 (17<<OPSHIFT) /* | pt. 2 fwd to OOR2 or O_CH */
-#define O_CH (18<<OPSHIFT) /* end choice back to OOR1 */
-#define OBOW (19<<OPSHIFT) /* begin word - */
-#define OEOW (20<<OPSHIFT) /* end word - */
-
-/*
- * Structure for [] character-set representation. Character sets are
- * done as bit vectors, grouped 8 to a byte vector for compactness.
- * The individual set therefore has both a pointer to the byte vector
- * and a mask to pick out the relevant bit of each byte. A hash code
- * simplifies testing whether two sets could be identical.
- *
- * This will get trickier for multicharacter collating elements. As
- * preliminary hooks for dealing with such things, we also carry along
- * a string of multi-character elements, and decide the size of the
- * vectors at run time.
- */
-typedef struct {
- uch *ptr; /* -> uch [csetsize] */
- uch mask; /* bit within array */
- uch hash; /* hash code */
- size_t smultis;
- char *multis; /* -> char[smulti] ab\0cd\0ef\0\0 */
-} cset;
-/* note that CHadd and CHsub are unsafe, and CHIN doesn't yield 0/1 */
-#define CHadd(cs, c) ((cs)->ptr[(uch)(c)] |= (cs)->mask, (cs)->hash += (c))
-#define CHsub(cs, c) ((cs)->ptr[(uch)(c)] &= ~(cs)->mask, (cs)->hash -= (c))
-#define CHIN(cs, c) ((cs)->ptr[(uch)(c)] & (cs)->mask)
-#define MCadd(p, cs, cp) mcadd(p, cs, cp) /* regcomp() internal fns */
-#define MCsub(p, cs, cp) mcsub(p, cs, cp)
-#define MCin(p, cs, cp) mcin(p, cs, cp)
-
-/* stuff for character categories */
-typedef unsigned char cat_t;
-
-/*
- * main compiled-expression structure
- */
-struct re_guts {
- int magic;
-# define MAGIC2 ((('R'^0200)<<8)|'E')
- sop *strip; /* malloced area for strip */
- int csetsize; /* number of bits in a cset vector */
- int ncsets; /* number of csets in use */
- cset *sets; /* -> cset [ncsets] */
- uch *setbits; /* -> uch[csetsize][ncsets/CHAR_BIT] */
- int cflags; /* copy of regcomp() cflags argument */
- sopno nstates; /* = number of sops */
- sopno firststate; /* the initial OEND (normally 0) */
- sopno laststate; /* the final OEND */
- int iflags; /* internal flags */
-# define USEBOL 01 /* used ^ */
-# define USEEOL 02 /* used $ */
-# define BAD 04 /* something wrong */
- int nbol; /* number of ^ used */
- int neol; /* number of $ used */
- int ncategories; /* how many character categories */
- cat_t *categories; /* ->catspace[-CHAR_MIN] */
- char *must; /* match must contain this string */
- int mlen; /* length of must */
- size_t nsub; /* copy of re_nsub */
- int backrefs; /* does it use back references? */
- sopno nplus; /* how deep does it nest +s? */
- /* catspace must be last */
- cat_t catspace[1]; /* actually [NC] */
-};
-
-/* misc utilities */
-#define OUT (CHAR_MAX+1) /* a non-character value */
-#define ISWORD(c) (isalnum(c) || (c) == '_')
diff --git a/ext/ereg/regex/regex_extra.h b/ext/ereg/regex/regex_extra.h
deleted file mode 100644
index 3db9e4ad1a..0000000000
--- a/ext/ereg/regex/regex_extra.h
+++ /dev/null
@@ -1,23 +0,0 @@
-/* do not frame this - we must be able to include this file multiple times */
-
-#undef regexec
-#undef regerror
-#undef regfree
-#undef regcomp
-
-#if (defined(REGEX) && REGEX == 1) || (!defined(REGEX))
-
-#if !(WIN32|WINNT)
-
-#ifndef PHP_NO_ALIASES
-
-#define regexec php_regexec
-#define regerror php_regerror
-#define regfree php_regfree
-#define regcomp php_regcomp
-
-#endif
-
-#endif
-
-#endif
diff --git a/ext/ereg/regex/regexec.c b/ext/ereg/regex/regexec.c
deleted file mode 100644
index 7888d02368..0000000000
--- a/ext/ereg/regex/regexec.c
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * the outer shell of regexec()
- *
- * This file includes engine.c *twice*, after muchos fiddling with the
- * macros that code uses. This lets the same code operate on two different
- * representations for state sets.
- */
-#include <sys/types.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <limits.h>
-#include <ctype.h>
-#include <regex.h>
-
-#include "utils.h"
-#include "regex2.h"
-
-static int nope = 0; /* for use in asserts; shuts lint up */
-
-/* macros for manipulating states, small version */
-#define states unsigned
-#define states1 unsigned /* for later use in regexec() decision */
-#define CLEAR(v) ((v) = 0)
-#define SET0(v, n) ((v) &= ~((unsigned)1 << (n)))
-#define SET1(v, n) ((v) |= (unsigned)1 << (n))
-#define ISSET(v, n) ((v) & ((unsigned)1 << (n)))
-#define ASSIGN(d, s) ((d) = (s))
-#define EQ(a, b) ((a) == (b))
-#define STATEVARS int dummy /* dummy version */
-#define STATESETUP(m, n) /* nothing */
-#define STATETEARDOWN(m) /* nothing */
-#define SETUP(v) ((v) = 0)
-#define onestate unsigned
-#define INIT(o, n) ((o) = (unsigned)1 << (n))
-#define INC(o) ((o) <<= 1)
-#define ISSTATEIN(v, o) ((v) & (o))
-/* some abbreviations; note that some of these know variable names! */
-/* do "if I'm here, I can also be there" etc without branches */
-#define FWD(dst, src, n) ((dst) |= ((unsigned)(src)&(here)) << (n))
-#define BACK(dst, src, n) ((dst) |= ((unsigned)(src)&(here)) >> (n))
-#define ISSETBACK(v, n) ((v) & ((unsigned)here >> (n)))
-/* function names */
-#define SNAMES /* engine.c looks after details */
-
-#include "engine.c"
-
-/* now undo things */
-#undef states
-#undef CLEAR
-#undef SET0
-#undef SET1
-#undef ISSET
-#undef ASSIGN
-#undef EQ
-#undef STATEVARS
-#undef STATESETUP
-#undef STATETEARDOWN
-#undef SETUP
-#undef onestate
-#undef INIT
-#undef INC
-#undef ISSTATEIN
-#undef FWD
-#undef BACK
-#undef ISSETBACK
-#undef SNAMES
-
-/* macros for manipulating states, large version */
-#define states char *
-#define CLEAR(v) memset(v, 0, m->g->nstates)
-#define SET0(v, n) ((v)[n] = 0)
-#define SET1(v, n) ((v)[n] = 1)
-#define ISSET(v, n) ((v)[n])
-#define ASSIGN(d, s) memcpy(d, s, m->g->nstates)
-#define EQ(a, b) (memcmp(a, b, m->g->nstates) == 0)
-#define STATEVARS int vn; char *space
-#define STATESETUP(m, nv) { (m)->space = malloc((nv)*(m)->g->nstates); \
- if ((m)->space == NULL) return(REG_ESPACE); \
- (m)->vn = 0; }
-#define STATETEARDOWN(m) { free((m)->space); }
-#define SETUP(v) ((v) = &m->space[m->vn++ * m->g->nstates])
-#define onestate int
-#define INIT(o, n) ((o) = (n))
-#define INC(o) ((o)++)
-#define ISSTATEIN(v, o) ((v)[o])
-/* some abbreviations; note that some of these know variable names! */
-/* do "if I'm here, I can also be there" etc without branches */
-#define FWD(dst, src, n) ((dst)[here+(n)] |= (src)[here])
-#define BACK(dst, src, n) ((dst)[here-(n)] |= (src)[here])
-#define ISSETBACK(v, n) ((v)[here - (n)])
-/* function names */
-#define LNAMES /* flag */
-
-#include "engine.c"
-
-/*
- - regexec - interface for matching
- = API_EXPORT(int) regexec(const regex_t *, const char *, size_t, \
- = regmatch_t [], int);
- = #define REG_NOTBOL 00001
- = #define REG_NOTEOL 00002
- = #define REG_STARTEND 00004
- = #define REG_TRACE 00400 // tracing of execution
- = #define REG_LARGE 01000 // force large representation
- = #define REG_BACKR 02000 // force use of backref code
- *
- * We put this here so we can exploit knowledge of the state representation
- * when choosing which matcher to call. Also, by this point the matchers
- * have been prototyped.
- */
-API_EXPORT(int) /* 0 success, REG_NOMATCH failure */
-regexec(preg, string, nmatch, pmatch, eflags)
-const regex_t *preg;
-const char *string;
-size_t nmatch;
-regmatch_t pmatch[];
-int eflags;
-{
- register struct re_guts *g = preg->re_g;
-#ifdef REDEBUG
-# define GOODFLAGS(f) (f)
-#else
-# define GOODFLAGS(f) ((f)&(REG_NOTBOL|REG_NOTEOL|REG_STARTEND))
-#endif
-
- if (preg->re_magic != MAGIC1 || g->magic != MAGIC2)
- return(REG_BADPAT);
- assert(!(g->iflags&BAD));
- if (g->iflags&BAD) /* backstop for no-debug case */
- return(REG_BADPAT);
- eflags = GOODFLAGS(eflags);
-
- if (g->nstates <= CHAR_BIT*sizeof(states1) && !(eflags&REG_LARGE))
- return(smatcher(g, (char *)string, nmatch, pmatch, eflags));
- else
- return(lmatcher(g, (char *)string, nmatch, pmatch, eflags));
-}
diff --git a/ext/ereg/regex/regfree.c b/ext/ereg/regex/regfree.c
deleted file mode 100644
index 9fd618a13b..0000000000
--- a/ext/ereg/regex/regfree.c
+++ /dev/null
@@ -1,37 +0,0 @@
-#include <sys/types.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <regex.h>
-
-#include "utils.h"
-#include "regex2.h"
-
-/*
- - regfree - free everything
- = API_EXPORT(void) regfree(regex_t *);
- */
-API_EXPORT(void)
-regfree(preg)
-regex_t *preg;
-{
- register struct re_guts *g;
-
- if (preg->re_magic != MAGIC1) /* oops */
- return; /* nice to complain, but hard */
-
- g = preg->re_g;
- if (g == NULL || g->magic != MAGIC2) /* oops again */
- return;
- preg->re_magic = 0; /* mark it invalid */
- g->magic = 0; /* mark it invalid */
-
- if (g->strip != NULL)
- free((char *)g->strip);
- if (g->sets != NULL)
- free((char *)g->sets);
- if (g->setbits != NULL)
- free((char *)g->setbits);
- if (g->must != NULL)
- free(g->must);
- free((char *)g);
-}
diff --git a/ext/ereg/regex/split.c b/ext/ereg/regex/split.c
deleted file mode 100644
index 188bdb775b..0000000000
--- a/ext/ereg/regex/split.c
+++ /dev/null
@@ -1,316 +0,0 @@
-#include <stdio.h>
-#include <string.h>
-
-/*
- - split - divide a string into fields, like awk split()
- = int split(char *string, char *fields[], int nfields, char *sep);
- */
-int /* number of fields, including overflow */
-split(string, fields, nfields, sep)
-char *string;
-char *fields[]; /* list is not NULL-terminated */
-int nfields; /* number of entries available in fields[] */
-char *sep; /* "" white, "c" single char, "ab" [ab]+ */
-{
- register char *p = string;
- register char c; /* latest character */
- register char sepc = sep[0];
- register char sepc2;
- register int fn;
- register char **fp = fields;
- register char *sepp;
- register int trimtrail;
-
- /* white space */
- if (sepc == '\0') {
- while ((c = *p++) == ' ' || c == '\t')
- continue;
- p--;
- trimtrail = 1;
- sep = " \t"; /* note, code below knows this is 2 long */
- sepc = ' ';
- } else
- trimtrail = 0;
- sepc2 = sep[1]; /* now we can safely pick this up */
-
- /* catch empties */
- if (*p == '\0')
- return(0);
-
- /* single separator */
- if (sepc2 == '\0') {
- fn = nfields;
- for (;;) {
- *fp++ = p;
- fn--;
- if (fn == 0)
- break;
- while ((c = *p++) != sepc)
- if (c == '\0')
- return(nfields - fn);
- *(p-1) = '\0';
- }
- /* we have overflowed the fields vector -- just count them */
- fn = nfields;
- for (;;) {
- while ((c = *p++) != sepc)
- if (c == '\0')
- return(fn);
- fn++;
- }
- /* not reached */
- }
-
- /* two separators */
- if (sep[2] == '\0') {
- fn = nfields;
- for (;;) {
- *fp++ = p;
- fn--;
- while ((c = *p++) != sepc && c != sepc2)
- if (c == '\0') {
- if (trimtrail && **(fp-1) == '\0')
- fn++;
- return(nfields - fn);
- }
- if (fn == 0)
- break;
- *(p-1) = '\0';
- while ((c = *p++) == sepc || c == sepc2)
- continue;
- p--;
- }
- /* we have overflowed the fields vector -- just count them */
- fn = nfields;
- while (c != '\0') {
- while ((c = *p++) == sepc || c == sepc2)
- continue;
- p--;
- fn++;
- while ((c = *p++) != '\0' && c != sepc && c != sepc2)
- continue;
- }
- /* might have to trim trailing white space */
- if (trimtrail) {
- p--;
- while ((c = *--p) == sepc || c == sepc2)
- continue;
- p++;
- if (*p != '\0') {
- if (fn == nfields+1)
- *p = '\0';
- fn--;
- }
- }
- return(fn);
- }
-
- /* n separators */
- fn = 0;
- for (;;) {
- if (fn < nfields)
- *fp++ = p;
- fn++;
- for (;;) {
- c = *p++;
- if (c == '\0')
- return(fn);
- sepp = sep;
- while ((sepc = *sepp++) != '\0' && sepc != c)
- continue;
- if (sepc != '\0') /* it was a separator */
- break;
- }
- if (fn < nfields)
- *(p-1) = '\0';
- for (;;) {
- c = *p++;
- sepp = sep;
- while ((sepc = *sepp++) != '\0' && sepc != c)
- continue;
- if (sepc == '\0') /* it wasn't a separator */
- break;
- }
- p--;
- }
-
- /* not reached */
-}
-
-#ifdef TEST_SPLIT
-
-
-/*
- * test program
- * pgm runs regression
- * pgm sep splits stdin lines by sep
- * pgm str sep splits str by sep
- * pgm str sep n splits str by sep n times
- */
-int
-main(argc, argv)
-int argc;
-char *argv[];
-{
- char buf[512];
- register int n;
-# define MNF 10
- char *fields[MNF];
-
- if (argc > 4)
- for (n = atoi(argv[3]); n > 0; n--) {
- (void) strcpy(buf, argv[1]);
- }
- else if (argc > 3)
- for (n = atoi(argv[3]); n > 0; n--) {
- (void) strcpy(buf, argv[1]);
- (void) split(buf, fields, MNF, argv[2]);
- }
- else if (argc > 2)
- dosplit(argv[1], argv[2]);
- else if (argc > 1)
- while (fgets(buf, sizeof(buf), stdin) != NULL) {
- buf[strlen(buf)-1] = '\0'; /* stomp newline */
- dosplit(buf, argv[1]);
- }
- else
- regress();
-
- exit(0);
-}
-
-dosplit(string, seps)
-char *string;
-char *seps;
-{
-# define NF 5
- char *fields[NF];
- register int nf;
-
- nf = split(string, fields, NF, seps);
- print(nf, NF, fields);
-}
-
-print(nf, nfp, fields)
-int nf;
-int nfp;
-char *fields[];
-{
- register int fn;
- register int bound;
-
- bound = (nf > nfp) ? nfp : nf;
- printf("%d:\t", nf);
- for (fn = 0; fn < bound; fn++)
- printf("\"%s\"%s", fields[fn], (fn+1 < nf) ? ", " : "\n");
-}
-
-#define RNF 5 /* some table entries know this */
-struct {
- char *str;
- char *seps;
- int nf;
- char *fi[RNF];
-} tests[] = {
- "", " ", 0, { "" },
- " ", " ", 2, { "", "" },
- "x", " ", 1, { "x" },
- "xy", " ", 1, { "xy" },
- "x y", " ", 2, { "x", "y" },
- "abc def g ", " ", 5, { "abc", "def", "", "g", "" },
- " a bcd", " ", 4, { "", "", "a", "bcd" },
- "a b c d e f", " ", 6, { "a", "b", "c", "d", "e f" },
- " a b c d ", " ", 6, { "", "a", "b", "c", "d " },
-
- "", " _", 0, { "" },
- " ", " _", 2, { "", "" },
- "x", " _", 1, { "x" },
- "x y", " _", 2, { "x", "y" },
- "ab _ cd", " _", 2, { "ab", "cd" },
- " a_b c ", " _", 5, { "", "a", "b", "c", "" },
- "a b c_d e f", " _", 6, { "a", "b", "c", "d", "e f" },
- " a b c d ", " _", 6, { "", "a", "b", "c", "d " },
-
- "", " _~", 0, { "" },
- " ", " _~", 2, { "", "" },
- "x", " _~", 1, { "x" },
- "x y", " _~", 2, { "x", "y" },
- "ab _~ cd", " _~", 2, { "ab", "cd" },
- " a_b c~", " _~", 5, { "", "a", "b", "c", "" },
- "a b_c d~e f", " _~", 6, { "a", "b", "c", "d", "e f" },
- "~a b c d ", " _~", 6, { "", "a", "b", "c", "d " },
-
- "", " _~-", 0, { "" },
- " ", " _~-", 2, { "", "" },
- "x", " _~-", 1, { "x" },
- "x y", " _~-", 2, { "x", "y" },
- "ab _~- cd", " _~-", 2, { "ab", "cd" },
- " a_b c~", " _~-", 5, { "", "a", "b", "c", "" },
- "a b_c-d~e f", " _~-", 6, { "a", "b", "c", "d", "e f" },
- "~a-b c d ", " _~-", 6, { "", "a", "b", "c", "d " },
-
- "", " ", 0, { "" },
- " ", " ", 2, { "", "" },
- "x", " ", 1, { "x" },
- "xy", " ", 1, { "xy" },
- "x y", " ", 2, { "x", "y" },
- "abc def g ", " ", 4, { "abc", "def", "g", "" },
- " a bcd", " ", 3, { "", "a", "bcd" },
- "a b c d e f", " ", 6, { "a", "b", "c", "d", "e f" },
- " a b c d ", " ", 6, { "", "a", "b", "c", "d " },
-
- "", "", 0, { "" },
- " ", "", 0, { "" },
- "x", "", 1, { "x" },
- "xy", "", 1, { "xy" },
- "x y", "", 2, { "x", "y" },
- "abc def g ", "", 3, { "abc", "def", "g" },
- "\t a bcd", "", 2, { "a", "bcd" },
- " a \tb\t c ", "", 3, { "a", "b", "c" },
- "a b c d e ", "", 5, { "a", "b", "c", "d", "e" },
- "a b\tc d e f", "", 6, { "a", "b", "c", "d", "e f" },
- " a b c d e f ", "", 6, { "a", "b", "c", "d", "e f " },
-
- NULL, NULL, 0, { NULL },
-};
-
-regress()
-{
- char buf[512];
- register int n;
- char *fields[RNF+1];
- register int nf;
- register int i;
- register int printit;
- register char *f;
-
- for (n = 0; tests[n].str != NULL; n++) {
- (void) strcpy(buf, tests[n].str);
- fields[RNF] = NULL;
- nf = split(buf, fields, RNF, tests[n].seps);
- printit = 0;
- if (nf != tests[n].nf) {
- printf("split `%s' by `%s' gave %d fields, not %d\n",
- tests[n].str, tests[n].seps, nf, tests[n].nf);
- printit = 1;
- } else if (fields[RNF] != NULL) {
- printf("split() went beyond array end\n");
- printit = 1;
- } else {
- for (i = 0; i < nf && i < RNF; i++) {
- f = fields[i];
- if (f == NULL)
- f = "(NULL)";
- if (strcmp(f, tests[n].fi[i]) != 0) {
- printf("split `%s' by `%s', field %d is `%s', not `%s'\n",
- tests[n].str, tests[n].seps,
- i, fields[i], tests[n].fi[i]);
- printit = 1;
- }
- }
- }
- if (printit)
- print(nf, RNF, fields);
- }
-}
-#endif
diff --git a/ext/ereg/regex/tests b/ext/ereg/regex/tests
deleted file mode 100644
index c05846177f..0000000000
--- a/ext/ereg/regex/tests
+++ /dev/null
@@ -1,475 +0,0 @@
-# regular expression test set
-# Lines are at least three fields, separated by one or more tabs. "" stands
-# for an empty field. First field is an RE. Second field is flags. If
-# C flag given, regcomp() is expected to fail, and the third field is the
-# error name (minus the leading REG_).
-#
-# Otherwise it is expected to succeed, and the third field is the string to
-# try matching it against. If there is no fourth field, the match is
-# expected to fail. If there is a fourth field, it is the substring that
-# the RE is expected to match. If there is a fifth field, it is a comma-
-# separated list of what the subexpressions should match, with - indicating
-# no match for that one. In both the fourth and fifth fields, a (sub)field
-# starting with @ indicates that the (sub)expression is expected to match
-# a null string followed by the stuff after the @; this provides a way to
-# test where null strings match. The character `N' in REs and strings
-# is newline, `S' is space, `T' is tab, `Z' is NUL.
-#
-# The full list of flags:
-# - placeholder, does nothing
-# b RE is a BRE, not an ERE
-# & try it as both an ERE and a BRE
-# C regcomp() error expected, third field is error name
-# i REG_ICASE
-# m ("mundane") REG_NOSPEC
-# s REG_NOSUB (not really testable)
-# n REG_NEWLINE
-# ^ REG_NOTBOL
-# $ REG_NOTEOL
-# # REG_STARTEND (see below)
-# p REG_PEND
-#
-# For REG_STARTEND, the start/end offsets are those of the substring
-# enclosed in ().
-
-# basics
-a & a a
-abc & abc abc
-abc|de - abc abc
-a|b|c - abc a
-
-# parentheses and perversions thereof
-a(b)c - abc abc
-a\(b\)c b abc abc
-a( C EPAREN
-a( b a( a(
-a\( - a( a(
-a\( bC EPAREN
-a\(b bC EPAREN
-a(b C EPAREN
-a(b b a(b a(b
-# gag me with a right parenthesis -- 1003.2 goofed here (my fault, partly)
-a) - a) a)
-) - ) )
-# end gagging (in a just world, those *should* give EPAREN)
-a) b a) a)
-a\) bC EPAREN
-\) bC EPAREN
-a()b - ab ab
-a\(\)b b ab ab
-
-# anchoring and REG_NEWLINE
-^abc$ & abc abc
-a^b - a^b
-a^b b a^b a^b
-a$b - a$b
-a$b b a$b a$b
-^ & abc @abc
-$ & abc @
-^$ & "" @
-$^ - "" @
-\($\)\(^\) b "" @
-# stop retching, those are legitimate (although disgusting)
-^^ - "" @
-$$ - "" @
-b$ & abNc
-b$ &n abNc b
-^b$ & aNbNc
-^b$ &n aNbNc b
-^$ &n aNNb @Nb
-^$ n abc
-^$ n abcN @
-$^ n aNNb @Nb
-\($\)\(^\) bn aNNb @Nb
-^^ n^ aNNb @Nb
-$$ n aNNb @NN
-^a ^ a
-a$ $ a
-^a ^n aNb
-^b ^n aNb b
-a$ $n bNa
-b$ $n bNa b
-a*(^b$)c* - b b
-a*\(^b$\)c* b b b
-
-# certain syntax errors and non-errors
-| C EMPTY
-| b | |
-* C BADRPT
-* b * *
-+ C BADRPT
-? C BADRPT
-"" &C EMPTY
-() - abc @abc
-\(\) b abc @abc
-a||b C EMPTY
-|ab C EMPTY
-ab| C EMPTY
-(|a)b C EMPTY
-(a|)b C EMPTY
-(*a) C BADRPT
-(+a) C BADRPT
-(?a) C BADRPT
-({1}a) C BADRPT
-\(\{1\}a\) bC BADRPT
-(a|*b) C BADRPT
-(a|+b) C BADRPT
-(a|?b) C BADRPT
-(a|{1}b) C BADRPT
-^* C BADRPT
-^* b * *
-^+ C BADRPT
-^? C BADRPT
-^{1} C BADRPT
-^\{1\} bC BADRPT
-
-# metacharacters, backslashes
-a.c & abc abc
-a[bc]d & abd abd
-a\*c & a*c a*c
-a\\b & a\b a\b
-a\\\*b & a\*b a\*b
-a\bc & abc abc
-a\ &C EESCAPE
-a\\bc & a\bc a\bc
-\{ bC BADRPT
-a\[b & a[b a[b
-a[b &C EBRACK
-# trailing $ is a peculiar special case for the BRE code
-a$ & a a
-a$ & a$
-a\$ & a
-a\$ & a$ a$
-a\\$ & a
-a\\$ & a$
-a\\$ & a\$
-a\\$ & a\ a\
-
-# back references, ugh
-a\(b\)\2c bC ESUBREG
-a\(b\1\)c bC ESUBREG
-a\(b*\)c\1d b abbcbbd abbcbbd bb
-a\(b*\)c\1d b abbcbd
-a\(b*\)c\1d b abbcbbbd
-^\(.\)\1 b abc
-a\([bc]\)\1d b abcdabbd abbd b
-a\(\([bc]\)\2\)*d b abbccd abbccd
-a\(\([bc]\)\2\)*d b abbcbd
-# actually, this next one probably ought to fail, but the spec is unclear
-a\(\(b\)*\2\)*d b abbbd abbbd
-# here is a case that no NFA implementation does right
-\(ab*\)[ab]*\1 b ababaaa ababaaa a
-# check out normal matching in the presence of back refs
-\(a\)\1bcd b aabcd aabcd
-\(a\)\1bc*d b aabcd aabcd
-\(a\)\1bc*d b aabd aabd
-\(a\)\1bc*d b aabcccd aabcccd
-\(a\)\1bc*[ce]d b aabcccd aabcccd
-^\(a\)\1b\(c\)*cd$ b aabcccd aabcccd
-
-# ordinary repetitions
-ab*c & abc abc
-ab+c - abc abc
-ab?c - abc abc
-a\(*\)b b a*b a*b
-a\(**\)b b ab ab
-a\(***\)b bC BADRPT
-*a b *a *a
-**a b a a
-***a bC BADRPT
-
-# the dreaded bounded repetitions
-{ & { {
-{abc & {abc {abc
-{1 C BADRPT
-{1} C BADRPT
-a{b & a{b a{b
-a{1}b - ab ab
-a\{1\}b b ab ab
-a{1,}b - ab ab
-a\{1,\}b b ab ab
-a{1,2}b - aab aab
-a\{1,2\}b b aab aab
-a{1 C EBRACE
-a\{1 bC EBRACE
-a{1a C EBRACE
-a\{1a bC EBRACE
-a{1a} C BADBR
-a\{1a\} bC BADBR
-a{,2} - a{,2} a{,2}
-a\{,2\} bC BADBR
-a{,} - a{,} a{,}
-a\{,\} bC BADBR
-a{1,x} C BADBR
-a\{1,x\} bC BADBR
-a{1,x C EBRACE
-a\{1,x bC EBRACE
-a{300} C BADBR
-a\{300\} bC BADBR
-a{1,0} C BADBR
-a\{1,0\} bC BADBR
-ab{0,0}c - abcac ac
-ab\{0,0\}c b abcac ac
-ab{0,1}c - abcac abc
-ab\{0,1\}c b abcac abc
-ab{0,3}c - abbcac abbc
-ab\{0,3\}c b abbcac abbc
-ab{1,1}c - acabc abc
-ab\{1,1\}c b acabc abc
-ab{1,3}c - acabc abc
-ab\{1,3\}c b acabc abc
-ab{2,2}c - abcabbc abbc
-ab\{2,2\}c b abcabbc abbc
-ab{2,4}c - abcabbc abbc
-ab\{2,4\}c b abcabbc abbc
-((a{1,10}){1,10}){1,10} - a a a,a
-
-# multiple repetitions
-a** &C BADRPT
-a++ C BADRPT
-a?? C BADRPT
-a*+ C BADRPT
-a*? C BADRPT
-a+* C BADRPT
-a+? C BADRPT
-a?* C BADRPT
-a?+ C BADRPT
-a{1}{1} C BADRPT
-a*{1} C BADRPT
-a+{1} C BADRPT
-a?{1} C BADRPT
-a{1}* C BADRPT
-a{1}+ C BADRPT
-a{1}? C BADRPT
-a*{b} - a{b} a{b}
-a\{1\}\{1\} bC BADRPT
-a*\{1\} bC BADRPT
-a\{1\}* bC BADRPT
-
-# brackets, and numerous perversions thereof
-a[b]c & abc abc
-a[ab]c & abc abc
-a[^ab]c & adc adc
-a[]b]c & a]c a]c
-a[[b]c & a[c a[c
-a[-b]c & a-c a-c
-a[^]b]c & adc adc
-a[^-b]c & adc adc
-a[b-]c & a-c a-c
-a[b &C EBRACK
-a[] &C EBRACK
-a[1-3]c & a2c a2c
-a[3-1]c &C ERANGE
-a[1-3-5]c &C ERANGE
-a[[.-.]--]c & a-c a-c
-a[1- &C ERANGE
-a[[. &C EBRACK
-a[[.x &C EBRACK
-a[[.x. &C EBRACK
-a[[.x.] &C EBRACK
-a[[.x.]] & ax ax
-a[[.x,.]] &C ECOLLATE
-a[[.one.]]b & a1b a1b
-a[[.notdef.]]b &C ECOLLATE
-a[[.].]]b & a]b a]b
-a[[:alpha:]]c & abc abc
-a[[:notdef:]]c &C ECTYPE
-a[[: &C EBRACK
-a[[:alpha &C EBRACK
-a[[:alpha:] &C EBRACK
-a[[:alpha,:] &C ECTYPE
-a[[:]:]]b &C ECTYPE
-a[[:-:]]b &C ECTYPE
-a[[:alph:]] &C ECTYPE
-a[[:alphabet:]] &C ECTYPE
-[[:alnum:]]+ - -%@a0X- a0X
-[[:alpha:]]+ - -%@aX0- aX
-[[:blank:]]+ - aSSTb SST
-[[:cntrl:]]+ - aNTb NT
-[[:digit:]]+ - a019b 019
-[[:graph:]]+ - Sa%bS a%b
-[[:lower:]]+ - AabC ab
-[[:print:]]+ - NaSbN aSb
-[[:punct:]]+ - S%-&T %-&
-[[:space:]]+ - aSNTb SNT
-[[:upper:]]+ - aBCd BC
-[[:xdigit:]]+ - p0f3Cq 0f3C
-a[[=b=]]c & abc abc
-a[[= &C EBRACK
-a[[=b &C EBRACK
-a[[=b= &C EBRACK
-a[[=b=] &C EBRACK
-a[[=b,=]] &C ECOLLATE
-a[[=one=]]b & a1b a1b
-
-# complexities
-a(((b)))c - abc abc
-a(b|(c))d - abd abd
-a(b*|c)d - abbd abbd
-# just gotta have one DFA-buster, of course
-a[ab]{20} - aaaaabaaaabaaaabaaaab aaaaabaaaabaaaabaaaab
-# and an inline expansion in case somebody gets tricky
-a[ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab] - aaaaabaaaabaaaabaaaab aaaaabaaaabaaaabaaaab
-# and in case somebody just slips in an NFA...
-a[ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab](wee|week)(knights|night) - aaaaabaaaabaaaabaaaabweeknights aaaaabaaaabaaaabaaaabweeknights
-# fish for anomalies as the number of states passes 32
-12345678901234567890123456789 - a12345678901234567890123456789b 12345678901234567890123456789
-123456789012345678901234567890 - a123456789012345678901234567890b 123456789012345678901234567890
-1234567890123456789012345678901 - a1234567890123456789012345678901b 1234567890123456789012345678901
-12345678901234567890123456789012 - a12345678901234567890123456789012b 12345678901234567890123456789012
-123456789012345678901234567890123 - a123456789012345678901234567890123b 123456789012345678901234567890123
-# and one really big one, beyond any plausible word width
-1234567890123456789012345678901234567890123456789012345678901234567890 - a1234567890123456789012345678901234567890123456789012345678901234567890b 1234567890123456789012345678901234567890123456789012345678901234567890
-# fish for problems as brackets go past 8
-[ab][cd][ef][gh][ij][kl][mn] - xacegikmoq acegikm
-[ab][cd][ef][gh][ij][kl][mn][op] - xacegikmoq acegikmo
-[ab][cd][ef][gh][ij][kl][mn][op][qr] - xacegikmoqy acegikmoq
-[ab][cd][ef][gh][ij][kl][mn][op][q] - xacegikmoqy acegikmoq
-
-# subtleties of matching
-abc & xabcy abc
-a\(b\)?c\1d b acd
-aBc i Abc Abc
-a[Bc]*d i abBCcd abBCcd
-0[[:upper:]]1 &i 0a1 0a1
-0[[:lower:]]1 &i 0A1 0A1
-a[^b]c &i abc
-a[^b]c &i aBc
-a[^b]c &i adc adc
-[a]b[c] - abc abc
-[a]b[a] - aba aba
-[abc]b[abc] - abc abc
-[abc]b[abd] - abd abd
-a(b?c)+d - accd accd
-(wee|week)(knights|night) - weeknights weeknights
-(we|wee|week|frob)(knights|night|day) - weeknights weeknights
-a[bc]d - xyzaaabcaababdacd abd
-a[ab]c - aaabc abc
-abc s abc abc
-a* & b @b
-
-# Let's have some fun -- try to match a C comment.
-# first the obvious, which looks okay at first glance...
-/\*.*\*/ - /*x*/ /*x*/
-# but...
-/\*.*\*/ - /*x*/y/*z*/ /*x*/y/*z*/
-# okay, we must not match */ inside; try to do that...
-/\*([^*]|\*[^/])*\*/ - /*x*/ /*x*/
-/\*([^*]|\*[^/])*\*/ - /*x*/y/*z*/ /*x*/
-# but...
-/\*([^*]|\*[^/])*\*/ - /*x**/y/*z*/ /*x**/y/*z*/
-# and a still fancier version, which does it right (I think)...
-/\*([^*]|\*+[^*/])*\*+/ - /*x*/ /*x*/
-/\*([^*]|\*+[^*/])*\*+/ - /*x*/y/*z*/ /*x*/
-/\*([^*]|\*+[^*/])*\*+/ - /*x**/y/*z*/ /*x**/
-/\*([^*]|\*+[^*/])*\*+/ - /*x****/y/*z*/ /*x****/
-/\*([^*]|\*+[^*/])*\*+/ - /*x**x*/y/*z*/ /*x**x*/
-/\*([^*]|\*+[^*/])*\*+/ - /*x***x/y/*z*/ /*x***x/y/*z*/
-
-# subexpressions
-a(b)(c)d - abcd abcd b,c
-a(((b)))c - abc abc b,b,b
-a(b|(c))d - abd abd b,-
-a(b*|c|e)d - abbd abbd bb
-a(b*|c|e)d - acd acd c
-a(b*|c|e)d - ad ad @d
-a(b?)c - abc abc b
-a(b?)c - ac ac @c
-a(b+)c - abc abc b
-a(b+)c - abbbc abbbc bbb
-a(b*)c - ac ac @c
-(a|ab)(bc([de]+)f|cde) - abcdef abcdef a,bcdef,de
-# the regression tester only asks for 9 subexpressions
-a(b)(c)(d)(e)(f)(g)(h)(i)(j)k - abcdefghijk abcdefghijk b,c,d,e,f,g,h,i,j
-a(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)l - abcdefghijkl abcdefghijkl b,c,d,e,f,g,h,i,j,k
-a([bc]?)c - abc abc b
-a([bc]?)c - ac ac @c
-a([bc]+)c - abc abc b
-a([bc]+)c - abcc abcc bc
-a([bc]+)bc - abcbc abcbc bc
-a(bb+|b)b - abb abb b
-a(bbb+|bb+|b)b - abb abb b
-a(bbb+|bb+|b)b - abbb abbb bb
-a(bbb+|bb+|b)bb - abbb abbb b
-(.*).* - abcdef abcdef abcdef
-(a*)* - bc @b @b
-
-# do we get the right subexpression when it is used more than once?
-a(b|c)*d - ad ad -
-a(b|c)*d - abcd abcd c
-a(b|c)+d - abd abd b
-a(b|c)+d - abcd abcd c
-a(b|c?)+d - ad ad @d
-a(b|c?)+d - abcd abcd @d
-a(b|c){0,0}d - ad ad -
-a(b|c){0,1}d - ad ad -
-a(b|c){0,1}d - abd abd b
-a(b|c){0,2}d - ad ad -
-a(b|c){0,2}d - abcd abcd c
-a(b|c){0,}d - ad ad -
-a(b|c){0,}d - abcd abcd c
-a(b|c){1,1}d - abd abd b
-a(b|c){1,1}d - acd acd c
-a(b|c){1,2}d - abd abd b
-a(b|c){1,2}d - abcd abcd c
-a(b|c){1,}d - abd abd b
-a(b|c){1,}d - abcd abcd c
-a(b|c){2,2}d - acbd acbd b
-a(b|c){2,2}d - abcd abcd c
-a(b|c){2,4}d - abcd abcd c
-a(b|c){2,4}d - abcbd abcbd b
-a(b|c){2,4}d - abcbcd abcbcd c
-a(b|c){2,}d - abcd abcd c
-a(b|c){2,}d - abcbd abcbd b
-a(b+|((c)*))+d - abd abd @d,@d,-
-a(b+|((c)*))+d - abcd abcd @d,@d,-
-
-# check out the STARTEND option
-[abc] &# a(b)c b
-[abc] &# a(d)c
-[abc] &# a(bc)d b
-[abc] &# a(dc)d c
-. &# a()c
-b.*c &# b(bc)c bc
-b.* &# b(bc)c bc
-.*c &# b(bc)c bc
-
-# plain strings, with the NOSPEC flag
-abc m abc abc
-abc m xabcy abc
-abc m xyz
-a*b m aba*b a*b
-a*b m ab
-"" mC EMPTY
-
-# cases involving NULs
-aZb & a a
-aZb &p a
-aZb &p# (aZb) aZb
-aZ*b &p# (ab) ab
-a.b &# (aZb) aZb
-a.* &# (aZb)c aZb
-
-# word boundaries (ick)
-[[:<:]]a & a a
-[[:<:]]a & ba
-[[:<:]]a & -a a
-a[[:>:]] & a a
-a[[:>:]] & ab
-a[[:>:]] & a- a
-[[:<:]]a.c[[:>:]] & axcd-dayc-dazce-abc abc
-[[:<:]]a.c[[:>:]] & axcd-dayc-dazce-abc-q abc
-[[:<:]]a.c[[:>:]] & axc-dayc-dazce-abc axc
-[[:<:]]b.c[[:>:]] & a_bxc-byc_d-bzc-q bzc
-[[:<:]].x..[[:>:]] & y_xa_-_xb_y-_xc_-axdc _xc_
-[[:<:]]a_b[[:>:]] & x_a_b
-
-# past problems, and suspected problems
-(A[1])|(A[2])|(A[3])|(A[4])|(A[5])|(A[6])|(A[7])|(A[8])|(A[9])|(A[A]) - A1 A1
-abcdefghijklmnop i abcdefghijklmnop abcdefghijklmnop
-abcdefghijklmnopqrstuv i abcdefghijklmnopqrstuv abcdefghijklmnopqrstuv
-(ALAK)|(ALT[AB])|(CC[123]1)|(CM[123]1)|(GAMC)|(LC[23][EO ])|(SEM[1234])|(SL[ES][12])|(SLWW)|(SLF )|(SLDT)|(VWH[12])|(WH[34][EW])|(WP1[ESN]) - CC11 CC11
-CC[13]1|a{21}[23][EO][123][Es][12]a{15}aa[34][EW]aaaaaaa[X]a - CC11 CC11
-Char \([a-z0-9_]*\)\[.* b Char xyz[k Char xyz[k xyz
-a?b - ab ab
--\{0,1\}[0-9]*$ b -5 -5
diff --git a/ext/ereg/regex/utils.h b/ext/ereg/regex/utils.h
deleted file mode 100644
index cd4a96025f..0000000000
--- a/ext/ereg/regex/utils.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/* utility definitions */
-
-#include "regex_extra.h"
-
-#ifdef _POSIX2_RE_DUP_MAX
-#define DUPMAX _POSIX2_RE_DUP_MAX
-#else
-#define DUPMAX 255
-#endif
-#define INFINITY (DUPMAX + 1)
-#define NC (CHAR_MAX - CHAR_MIN + 1)
-typedef unsigned char uch;
-
-/* switch off assertions (if not already off) if no REDEBUG */
-#ifndef REDEBUG
-#ifndef NDEBUG
-#define NDEBUG /* no assertions please */
-#endif
-#endif
-#include <assert.h>
-
-/* for old systems with bcopy() but no memmove() */
-#ifdef USEBCOPY
-#define memmove(d, s, c) bcopy(s, d, c)
-#endif
diff --git a/ext/ereg/tests/001.phpt b/ext/ereg/tests/001.phpt
deleted file mode 100644
index f63c252518..0000000000
--- a/ext/ereg/tests/001.phpt
+++ /dev/null
@@ -1,9 +0,0 @@
---TEST--
-RegReplace test 1
---POST--
---GET--
---FILE--
-<?php $a="abc123";
- echo ereg_replace("123","def",$a)?>
---EXPECT--
-abcdef
diff --git a/ext/ereg/tests/002.phpt b/ext/ereg/tests/002.phpt
deleted file mode 100644
index a9b7aaa00a..0000000000
--- a/ext/ereg/tests/002.phpt
+++ /dev/null
@@ -1,9 +0,0 @@
---TEST--
-RegReplace test 2
---POST--
---GET--
---FILE--
-<?php $a="abc123";
- echo ereg_replace("123","",$a)?>
---EXPECT--
-abc
diff --git a/ext/ereg/tests/003.phpt b/ext/ereg/tests/003.phpt
deleted file mode 100644
index edd9c05969..0000000000
--- a/ext/ereg/tests/003.phpt
+++ /dev/null
@@ -1,10 +0,0 @@
---TEST--
-ereg_replace single-quote test
---POST--
---GET--
---FILE--
-<?php $a="\\'test";
- echo ereg_replace("\\\\'","'",$a)
-?>
---EXPECT--
-'test
diff --git a/ext/ereg/tests/004.phpt b/ext/ereg/tests/004.phpt
deleted file mode 100644
index 1f60ff4900..0000000000
--- a/ext/ereg/tests/004.phpt
+++ /dev/null
@@ -1,16 +0,0 @@
---TEST--
-simple ereg test
---POST--
---GET--
---FILE--
-<?php $a="This is a nice and simple string";
- if (ereg(".*nice and simple.*",$a)) {
- echo "ok\n";
- }
- if (!ereg(".*doesn't exist.*",$a)) {
- echo "ok\n";
- }
-?>
---EXPECT--
-ok
-ok
diff --git a/ext/ereg/tests/005.phpt b/ext/ereg/tests/005.phpt
deleted file mode 100644
index 78c0a0912a..0000000000
--- a/ext/ereg/tests/005.phpt
+++ /dev/null
@@ -1,20 +0,0 @@
---TEST--
-Test Regular expression register support in ereg
---POST--
---GET--
---FILE--
-<?php $a="This is a nice and simple string";
- echo ereg(".*(is).*(is).*",$a,$registers);
- echo "\n";
- echo $registers[0];
- echo "\n";
- echo $registers[1];
- echo "\n";
- echo $registers[2];
- echo "\n";
-?>
---EXPECT--
-32
-This is a nice and simple string
-is
-is
diff --git a/ext/ereg/tests/006.phpt b/ext/ereg/tests/006.phpt
deleted file mode 100644
index 50b6dbfd3a..0000000000
--- a/ext/ereg/tests/006.phpt
+++ /dev/null
@@ -1,10 +0,0 @@
---TEST--
-Test ereg_replace of start-of-line
---POST--
---GET--
---FILE--
-<?php $a="This is a nice and simple string";
- echo ereg_replace("^This","That",$a);
-?>
---EXPECT--
-That is a nice and simple string
diff --git a/ext/ereg/tests/007.phpt b/ext/ereg/tests/007.phpt
deleted file mode 100644
index b2646f842f..0000000000
--- a/ext/ereg/tests/007.phpt
+++ /dev/null
@@ -1,12 +0,0 @@
---TEST--
-Test empty result buffer in reg_replace
---POST--
---GET--
---FILE--
-<?php
- $a="abcd";
- $b=ereg_replace("abcd","",$a);
- echo "strlen(\$b)=".strlen($b);
-?>
---EXPECT--
-strlen($b)=0
diff --git a/ext/ereg/tests/008.phpt b/ext/ereg/tests/008.phpt
deleted file mode 100644
index db61d1ca07..0000000000
--- a/ext/ereg/tests/008.phpt
+++ /dev/null
@@ -1,10 +0,0 @@
---TEST--
-Test back-references in regular expressions
---POST--
---GET--
---FILE--
-<?php
- echo ereg_replace("([a-z]*)([-=+|]*)([0-9]+)","\\3 \\1 \\2\n","abc+-|=123");
-?>
---EXPECT--
-123 abc +-|=
diff --git a/ext/ereg/tests/009.phpt b/ext/ereg/tests/009.phpt
deleted file mode 100644
index 4996ef4c97..0000000000
--- a/ext/ereg/tests/009.phpt
+++ /dev/null
@@ -1,19 +0,0 @@
---TEST--
-Test split()
---POST--
---GET--
---FILE--
-<?php
- $a=split("[[:space:]]","this is a
-test");
- echo count($a) . "\n";
- for ($i = 0; $i < count($a); $i++) {
- echo $a[$i] . "\n";
- }
-?>
---EXPECT--
-4
-this
-is
-a
-test
diff --git a/ext/ereg/tests/010.phpt b/ext/ereg/tests/010.phpt
deleted file mode 100644
index 30d28fd02f..0000000000
--- a/ext/ereg/tests/010.phpt
+++ /dev/null
@@ -1,9 +0,0 @@
---TEST--
-Long back references
---POST--
---GET--
---FILE--
-<?php $a="abc122222222223";
- echo ereg_replace("1(2*)3","\\1def\\1",$a)?>
---EXPECT--
-abc2222222222def2222222222
diff --git a/ext/ereg/tests/011.phpt b/ext/ereg/tests/011.phpt
deleted file mode 100644
index 4eda774f58..0000000000
--- a/ext/ereg/tests/011.phpt
+++ /dev/null
@@ -1,9 +0,0 @@
---TEST--
-\0 back reference
---POST--
---GET--
---FILE--
-<?php $a="abc123";
- echo ereg_replace("123","def\\0ghi",$a)?>
---EXPECT--
-abcdef123ghi
diff --git a/ext/ereg/tests/012.phpt b/ext/ereg/tests/012.phpt
deleted file mode 100644
index d5342c7436..0000000000
--- a/ext/ereg/tests/012.phpt
+++ /dev/null
@@ -1,9 +0,0 @@
---TEST--
-nonexisting back reference
---POST--
---GET--
---FILE--
-<?php $a="abc123";
- echo ereg_replace("123",'def\1ghi',$a)?>
---EXPECT--
-abcdef\1ghi
diff --git a/ext/ereg/tests/013.phpt b/ext/ereg/tests/013.phpt
deleted file mode 100644
index ec3329fa7c..0000000000
--- a/ext/ereg/tests/013.phpt
+++ /dev/null
@@ -1,9 +0,0 @@
---TEST--
-escapes in replace string
---POST--
---GET--
---FILE--
-<?php $a="abc123";
- echo ereg_replace("123","def\\g\\\\hi\\",$a)?>
---EXPECT--
-abcdef\g\\hi\
diff --git a/ext/ereg/tests/014.phpt b/ext/ereg/tests/014.phpt
deleted file mode 100644
index ec4d19ed0e..0000000000
--- a/ext/ereg/tests/014.phpt
+++ /dev/null
@@ -1,9 +0,0 @@
---TEST--
-backreferences not replaced recursively
---POST--
---GET--
---FILE--
-<?php $a="a\\2bxc";
- echo ereg_replace("a(.*)b(.*)c","\\1",$a)?>
---EXPECT--
-\2
diff --git a/ext/ereg/tests/015.phpt b/ext/ereg/tests/015.phpt
deleted file mode 100644
index 961a60fa76..0000000000
--- a/ext/ereg/tests/015.phpt
+++ /dev/null
@@ -1,8 +0,0 @@
---TEST--
-replace empty matches
---POST--
---GET--
---FILE--
-<?php echo ereg_replace("^","z","abc123")?>
---EXPECT--
-zabc123
diff --git a/ext/ereg/tests/016.phpt b/ext/ereg/tests/016.phpt
deleted file mode 100644
index a24816f182..0000000000
--- a/ext/ereg/tests/016.phpt
+++ /dev/null
@@ -1,8 +0,0 @@
---TEST--
-test backslash handling in regular expressions
---POST--
---GET--
---FILE--
-<?php echo ereg_replace('\?',"abc","?123?")?>
---EXPECT--
-abc123abc
diff --git a/ext/exif/CREDITS b/ext/exif/CREDITS
deleted file mode 100644
index b7f532f769..0000000000
--- a/ext/exif/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-EXIF
-Rasmus Lerdorf
diff --git a/ext/exif/Makefile.in b/ext/exif/Makefile.in
deleted file mode 100644
index cfac66a574..0000000000
--- a/ext/exif/Makefile.in
+++ /dev/null
@@ -1,7 +0,0 @@
-# $Id$
-
-LTLIBRARY_NAME = libexif.la
-LTLIBRARY_SOURCES = exif.c
-LTLIBRARY_SHARED_NAME = exif.la
-
-include $(top_srcdir)/build/dynlib.mk
diff --git a/ext/exif/config.m4 b/ext/exif/config.m4
deleted file mode 100644
index 53dabb6bd8..0000000000
--- a/ext/exif/config.m4
+++ /dev/null
@@ -1,11 +0,0 @@
-dnl $Id$
-dnl config.m4 for extension exif
-
-PHP_ARG_ENABLE(exif, whether to enable exif support,
-dnl Make sure that the comment is aligned:
-[ --enable-exif Enable exif support])
-
-if test "$PHP_EXIF" != "no"; then
- AC_DEFINE(HAVE_EXIF, 1, [Whether you want exif support])
- PHP_EXTENSION(exif, $ext_shared)
-fi
diff --git a/ext/exif/exif.c b/ext/exif/exif.c
deleted file mode 100644
index e27081c33c..0000000000
--- a/ext/exif/exif.c
+++ /dev/null
@@ -1,1232 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Rasmus Lerdorf <rasmus@php.net> |
- +----------------------------------------------------------------------+
- */
-/* Much of the code in this module was borrowed from the public domain
- jhead.c package with the author's consent. The main changes have been
- to eliminate all the global variables to make it thread safe and to wrap
- it in the PHP 4 API.
-
- The original header from the jhead.c file was:
-
- --------------------------------------------------------------------------
- Program to pull the information out of various types of EFIF digital
- camera files and show it in a reasonably consistent way
-
- Version 0.9
-
- Compiles with MSVC on Windows, or with GCC on Linux
-
- Compileing under linux: Must include math library.
- Use: cc -lm -O3 -o jhead jhead.c
-
- Matthias Wandel, Dec 1999 - April 2000
- --------------------------------------------------------------------------
- */
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-
-#if HAVE_EXIF
-
-#include "php_exif.h"
-#include <math.h>
-#include "php_ini.h"
-#include "ext/standard/php_string.h"
-#include "ext/standard/info.h"
-
-typedef unsigned char uchar;
-
-#ifndef TRUE
- #define TRUE 1
- #define FALSE 0
-#endif
-
-
-/* {{{ structs
- This structure stores Exif header image elements in a simple manner
- Used to store camera data as extracted from the various ways that it can be
- stored in a nexif header
-*/
-typedef struct {
- char FileName [120];
- time_t FileDateTime;
- unsigned FileSize;
- char CameraMake [32];
- char CameraModel [64];
- char DateTime [20];
- int Height, Width;
- int IsColor;
- int FlashUsed;
- float FocalLength;
- float ExposureTime;
- float ApertureFNumber;
- float Distance;
- float CCDWidth;
- char Comments[200];
- double FocalplaneXRes;
- double FocalplaneUnits;
- int ExifImageWidth;
- int MotorolaOrder;
- int Orientation;
- char GPSinfo[48];
- int ISOspeed;
- char ExifVersion[16];
- char Copyright[32];
- char Software[32];
- char *Thumbnail;
- int ThumbnailSize;
- int ThumbnailOffset;
- /* Olympus vars */
- int SpecialMode;
- int JpegQual;
- int Macro;
- int DigiZoom;
- char SoftwareRelease[16];
- char PictInfo[64];
- char CameraId[64];
- /* End Olympus vars */
-} ImageInfoType;
-
-/* This structure is used to store a section of a Jpeg file. */
-typedef struct {
- uchar *Data;
- int Type;
- unsigned Size;
-} Section_t;
-/* }}} */
-
-#define EXIT_FAILURE 1
-#define EXIT_SUCCESS 0
-
-/* {{{ exif_functions[]
- */
-function_entry exif_functions[] = {
- PHP_FE(read_exif_data, NULL)
- {NULL, NULL, NULL}
-};
-/* }}} */
-
-PHP_MINFO_FUNCTION(exif);
-
-/* {{{ exif_module_entry
- */
-zend_module_entry exif_module_entry = {
- "exif",
- exif_functions,
- NULL, NULL,
- NULL, NULL,
- PHP_MINFO(exif),
- STANDARD_MODULE_PROPERTIES
-};
-/* }}} */
-
-#ifdef COMPILE_DL_EXIF
-ZEND_GET_MODULE(exif)
-#endif
-
-/* {{{ PHP_MINFO_FUNCTION
- */
-PHP_MINFO_FUNCTION(exif) {
- php_info_print_table_start();
- php_info_print_table_row(2, "EXIF Support", "enabled" );
- php_info_print_table_end();
-}
-/* }}} */
-
-/* {{{ Markers
- JPEG markers consist of one or more 0xFF bytes, followed by a marker
- code byte (which is not an FF). Here are the marker codes of interest
- in this program. (See jdmarker.c for a more complete list.)
-*/
-
-#define M_SOF0 0xC0 /* Start Of Frame N */
-#define M_SOF1 0xC1 /* N indicates which compression process */
-#define M_SOF2 0xC2 /* Only SOF0-SOF2 are now in common use */
-#define M_SOF3 0xC3
-#define M_SOF5 0xC5 /* NB: codes C4 and CC are NOT SOF markers */
-#define M_SOF6 0xC6
-#define M_SOF7 0xC7
-#define M_SOF9 0xC9
-#define M_SOF10 0xCA
-#define M_SOF11 0xCB
-#define M_SOF13 0xCD
-#define M_SOF14 0xCE
-#define M_SOF15 0xCF
-#define M_SOI 0xD8 /* Start Of Image (beginning of datastream) */
-#define M_EOI 0xD9 /* End Of Image (end of datastream) */
-#define M_SOS 0xDA /* Start Of Scan (begins compressed data) */
-#define M_EXIF 0xE1
-#define M_COM 0xFE /* COMment */
-
-
-#define PSEUDO_IMAGE_MARKER 0x123; /* Extra value. */
-
-/* }}} */
-
-/* {{{ Get16m
- Get 16 bits motorola order (always) for jpeg header stuff.
-*/
-static int Get16m(void *Short)
-{
- return (((uchar *)Short)[0] << 8) | ((uchar *)Short)[1];
-}
-/* }}} */
-
-/* {{{ process_COM
- Process a COM marker.
- We want to print out the marker contents as legible text;
- we must guard against random junk and varying newline representations.
-*/
-static void process_COM (ImageInfoType *ImageInfo, uchar *Data, int length)
-{
- int ch;
- char Comment[250];
- int nch;
- int a;
-
- nch = 0;
-
- if (length > 200) length = 200; /* Truncate if it won't fit in our structure. */
-
- for (a=2;a<length;a++) {
- ch = Data[a];
-
- if (ch == '\r' && Data[a+1] == '\n') continue; /* Remove cr followed by lf. */
-
- if (isprint(ch) || ch == '\n' || ch == '\t') {
- Comment[nch++] = (char)ch;
- } else {
- Comment[nch++] = '?';
- }
- }
-
- Comment[nch] = '\0'; /* Null terminate */
-
- /*
- if (ShowTags) {
- printf("COM marker comment: %s\n",Comment);
- }
- */
-
- strcpy(ImageInfo->Comments,Comment);
-}
-/* }}} */
-
-/* {{{ process_SOFn
- * Process a SOFn marker. This is useful for the image dimensions */
-static void process_SOFn (ImageInfoType *ImageInfo, uchar *Data, int marker)
-{
- int data_precision, num_components;
- const char *process;
-
- data_precision = Data[2];
- ImageInfo->Height = Get16m(Data+3);
- ImageInfo->Width = Get16m(Data+5);
- num_components = Data[7];
-
- if (num_components == 3) {
- ImageInfo->IsColor = 1;
- } else {
- ImageInfo->IsColor = 0;
- }
-
- switch (marker) {
- case M_SOF0: process = "Baseline"; break;
- case M_SOF1: process = "Extended sequential"; break;
- case M_SOF2: process = "Progressive"; break;
- case M_SOF3: process = "Lossless"; break;
- case M_SOF5: process = "Differential sequential"; break;
- case M_SOF6: process = "Differential progressive"; break;
- case M_SOF7: process = "Differential lossless"; break;
- case M_SOF9: process = "Extended sequential, arithmetic coding"; break;
- case M_SOF10: process = "Progressive, arithmetic coding"; break;
- case M_SOF11: process = "Lossless, arithmetic coding"; break;
- case M_SOF13: process = "Differential sequential, arithmetic coding"; break;
- case M_SOF14: process = "Differential progressive, arithmetic coding"; break;
- case M_SOF15: process = "Differential lossless, arithmetic coding"; break;
- default: process = "Unknown"; break;
- }
-}
-/* }}} */
-
-/* {{{ format description defines
- Describes format descriptor
-*/
-static int ExifBytesPerFormat[] = {0,1,1,2,4,8,1,1,2,4,8,4,8};
-#define NUM_FORMATS 12
-
-#define FMT_BYTE 1
-#define FMT_STRING 2
-#define FMT_USHORT 3
-#define FMT_ULONG 4
-#define FMT_URATIONAL 5
-#define FMT_SBYTE 6
-#define FMT_UNDEFINED 7
-#define FMT_SSHORT 8
-#define FMT_SLONG 9
-#define FMT_SRATIONAL 10
-#define FMT_SINGLE 11
-#define FMT_DOUBLE 12
-
-/*
- Describes tag values
-*/
-
-#define TAG_EXIF_OFFSET 0x8769
-#define TAG_INTEROP_OFFSET 0xa005
-
-#define TAG_COMPRESSION 0x0103
-
-#define TAG_MAKE 0x010F
-#define TAG_MODEL 0x0110
-#define TAG_ORIENTATION 0x0112
-
-#define TAG_SOFTWARE 0x0131
-
-/* Olympus specific tags */
-#define TAG_SPECIALMODE 0x0200
-#define TAG_JPEGQUAL 0x0201
-#define TAG_MACRO 0x0202
-#define TAG_DIGIZOOM 0x0204
-#define TAG_SOFTWARERELEASE 0x0207
-#define TAG_PICTINFO 0x0208
-#define TAG_CAMERAID 0x0209
-/* end Olympus specific tags */
-
-#define TAG_COPYRIGHT 0x8298
-
-#define TAG_EXPOSURETIME 0x829A
-#define TAG_FNUMBER 0x829D
-
-#define TAG_GPSINFO 0x8825
-#define TAG_ISOSPEED 0x8827
-#define TAG_EXIFVERSION 0x9000
-
-#define TAG_SHUTTERSPEED 0x9201
-#define TAG_APERTURE 0x9202
-#define TAG_MAXAPERTURE 0x9205
-#define TAG_FOCALLENGTH 0x920A
-
-#define TAG_DATETIME_ORIGINAL 0x9003
-#define TAG_USERCOMMENT 0x9286
-
-#define TAG_SUBJECT_DISTANCE 0x9206
-#define TAG_LIGHT_SOURCE 0x9208
-#define TAG_FLASH 0x9209
-
-#define TAG_FOCALPLANEXRES 0xa20E
-#define TAG_FOCALPLANEUNITS 0xa210
-#define TAG_IMAGEWIDTH 0xA002
-/* }}} */
-
-/* {{{ TabTable[]
- */
-static const struct {
- unsigned short Tag;
- char *Desc;
-} TagTable[] = {
- { 0x100, "ImageWidth"},
- { 0x101, "ImageLength"},
- { 0x102, "BitsPerSample"},
- { 0x103, "Compression"},
- { 0x106, "PhotometricInterpretation"},
- { 0x10A, "FillOrder"},
- { 0x10D, "DocumentName"},
- { 0x10E, "ImageDescription"},
- { 0x10F, "Make"},
- { 0x110, "Model"},
- { 0x111, "StripOffsets"},
- { 0x112, "Orientation"},
- { 0x115, "SamplesPerPixel"},
- { 0x116, "RowsPerStrip"},
- { 0x117, "StripByteCounts"},
- { 0x11A, "XResolution"},
- { 0x11B, "YResolution"},
- { 0x11C, "PlanarConfiguration"},
- { 0x128, "ResolutionUnit"},
- { 0x12D, "TransferFunction"},
- { 0x131, "Software"},
- { 0x132, "DateTime"},
- { 0x13B, "Artist"},
- { 0x13E, "WhitePoint"},
- { 0x13F, "PrimaryChromaticities"},
- { 0x156, "TransferRange"},
- { 0x200, "JPEGProc"},
- { 0x201, "JPEGInterchangeFormat"},
- { 0x202, "JPEGInterchangeFormatLength"},
- { 0x211, "YCbCrCoefficients"},
- { 0x212, "YCbCrSubSampling"},
- { 0x213, "YCbCrPositioning"},
- { 0x214, "ReferenceBlackWhite"},
- { 0x1000, "RelatedImageFileFormat"},
- { 0x828D, "CFARepeatPatternDim"},
- { 0x828E, "CFAPattern"},
- { 0x828F, "BatteryLevel"},
- { 0x8298, "Copyright"},
- { 0x829A, "ExposureTime"},
- { 0x829D, "FNumber"},
- { 0x83BB, "IPTC/NAA"},
- { 0x8769, "ExifOffset"},
- { 0x8773, "InterColorProfile"},
- { 0x8822, "ExposureProgram"},
- { 0x8824, "SpectralSensitivity"},
- { 0x8825, "GPSInfo"},
- { 0x8827, "ISOSpeedRatings"},
- { 0x8828, "OECF"},
- { 0x9000, "ExifVersion"},
- { 0x9003, "DateTimeOriginal"},
- { 0x9004, "DateTimeDigitized"},
- { 0x9101, "ComponentsConfiguration"},
- { 0x9102, "CompressedBitsPerPixel"},
- { 0x9201, "ShutterSpeedValue"},
- { 0x9202, "ApertureValue"},
- { 0x9203, "BrightnessValue"},
- { 0x9204, "ExposureBiasValue"},
- { 0x9205, "MaxApertureValue"},
- { 0x9206, "SubjectDistance"},
- { 0x9207, "MeteringMode"},
- { 0x9208, "LightSource"},
- { 0x9209, "Flash"},
- { 0x920A, "FocalLength"},
- { 0x927C, "MakerNote"},
- { 0x9286, "UserComment"},
- { 0x9290, "SubSecTime"},
- { 0x9291, "SubSecTimeOriginal"},
- { 0x9292, "SubSecTimeDigitized"},
- { 0xA000, "FlashPixVersion"},
- { 0xA001, "ColorSpace"},
- { 0xA002, "ExifImageWidth"},
- { 0xA003, "ExifImageLength"},
- { 0xA005, "InteroperabilityOffset"},
- { 0xA20B, "FlashEnergy"}, /* 0x920B in TIFF/EP */
- { 0xA20C, "SpatialFrequencyResponse"}, /* 0x920C - - */
- { 0xA20E, "FocalPlaneXResolution"}, /* 0x920E - - */
- { 0xA20F, "FocalPlaneYResolution"}, /* 0x920F - - */
- { 0xA210, "FocalPlaneResolutionUnit"}, /* 0x9210 - - */
- { 0xA214, "SubjectLocation"}, /* 0x9214 - - */
- { 0xA215, "ExposureIndex"}, /* 0x9215 - - */
- { 0xA217, "SensingMethod"}, /* 0x9217 - - */
- { 0xA300, "FileSource"},
- { 0xA301, "SceneType"},
- { 0, NULL}
-} ;
-/* }}} */
-
-/* {{{ Get16u
- * Convert a 16 bit unsigned value from file's native byte order */
-static int Get16u(void *Short, int MotorolaOrder)
-{
- if (MotorolaOrder) {
- return (((uchar *)Short)[0] << 8) | ((uchar *)Short)[1];
- } else {
- return (((uchar *)Short)[1] << 8) | ((uchar *)Short)[0];
- }
-}
-/* }}} */
-
-/* {{{ Get32s
- * Convert a 32 bit signed value from file's native byte order */
-static int Get32s(void *Long, int MotorolaOrder)
-{
- if (MotorolaOrder) {
- return ((( char *)Long)[0] << 24) | (((uchar *)Long)[1] << 16)
- | (((uchar *)Long)[2] << 8 ) | (((uchar *)Long)[3] << 0 );
- } else {
- return ((( char *)Long)[3] << 24) | (((uchar *)Long)[2] << 16)
- | (((uchar *)Long)[1] << 8 ) | (((uchar *)Long)[0] << 0 );
- }
-}
-/* }}} */
-
-/* {{{ Get32u
- * Convert a 32 bit unsigned value from file's native byte order */
-static unsigned Get32u(void *Long, int MotorolaOrder)
-{
- return (unsigned)Get32s(Long, MotorolaOrder) & 0xffffffff;
-}
-/* }}} */
-
-/* {{{ ConvertAnyFormat
- * Evaluate number, be it int, rational, or float from directory. */
-static double ConvertAnyFormat(void *ValuePtr, int Format, int MotorolaOrder)
-{
- double Value;
- Value = 0;
-
- switch(Format) {
- case FMT_SBYTE: Value = *(signed char *)ValuePtr; break;
- case FMT_BYTE: Value = *(uchar *)ValuePtr; break;
-
- case FMT_USHORT: Value = Get16u(ValuePtr,MotorolaOrder); break;
- case FMT_ULONG: Value = Get32u(ValuePtr,MotorolaOrder); break;
-
- case FMT_URATIONAL:
- case FMT_SRATIONAL:
- {
- int Num,Den;
- Num = Get32s(ValuePtr,MotorolaOrder);
- Den = Get32s(4+(char *)ValuePtr,MotorolaOrder);
- if (Den == 0) {
- Value = 0;
- } else {
- Value = (double)Num/Den;
- }
- break;
- }
-
- case FMT_SSHORT: Value = (signed short)Get16u(ValuePtr,MotorolaOrder); break;
- case FMT_SLONG: Value = Get32s(ValuePtr,MotorolaOrder); break;
-
- /* Not sure if this is correct (never seen float used in Exif format) */
- case FMT_SINGLE: Value = (double)*(float *)ValuePtr; break;
- case FMT_DOUBLE: Value = *(double *)ValuePtr; break;
- }
- return Value;
-}
-/* }}} */
-
-/* {{{ ExtractThumbnail
- * Grab the thumbnail - by Matt Bonneau */
-static void ExtractThumbnail(ImageInfoType *ImageInfo, char *OffsetBase, unsigned ExifLength) {
- /* according to exif2.1, the thumbnail is not supposed to be greater than 64K */
- if (ImageInfo->ThumbnailSize > 65536) {
- php_error(E_ERROR,"Illegal thumbnail size");
- }
-
- ImageInfo->Thumbnail = emalloc(ImageInfo->ThumbnailSize);
- if (!ImageInfo->Thumbnail) {
- php_error(E_ERROR,"Could not allocate memory for thumbnail");
- } else {
- /* Check to make sure we are not going to go past the ExifLength */
- if (ImageInfo->ThumbnailOffset + ImageInfo->ThumbnailSize > ExifLength) {
- php_error(E_ERROR,"Thumbnail goes beyond exif header boundary");
- } else {
- memcpy(ImageInfo->Thumbnail, OffsetBase + ImageInfo->ThumbnailOffset, ImageInfo->ThumbnailSize);
- }
- }
-}
-/* }}} */
-
-/* {{{ ProcessExifDir
- * Process one of the nested EXIF directories. */
-static void ProcessExifDir(ImageInfoType *ImageInfo, char *DirStart, char *OffsetBase, unsigned ExifLength, char *LastExifRefd)
-{
- int de;
- int a;
- int NumDirEntries;
- int NextDirOffset;
-
-
- NumDirEntries = Get16u(DirStart, ImageInfo->MotorolaOrder);
-
- if ((DirStart+2+NumDirEntries*12) > (OffsetBase+ExifLength)) {
- php_error(E_ERROR,"Illegally sized directory");
- }
-
-
- /*
- if (ShowTags) {
- printf("Directory with %d entries\n",NumDirEntries);
- }
- */
-
- for (de=0;de<NumDirEntries;de++) {
- int Tag, Format, Components;
- char *ValuePtr;
- int ByteCount;
- char *DirEntry;
- DirEntry = DirStart+2+12*de;
-
- Tag = Get16u(DirEntry, ImageInfo->MotorolaOrder);
- Format = Get16u(DirEntry+2, ImageInfo->MotorolaOrder);
- Components = Get32u(DirEntry+4, ImageInfo->MotorolaOrder);
-
- if ((Format-1) >= NUM_FORMATS) {
- /* (-1) catches illegal zero case as unsigned underflows to positive large. */
- php_error(E_ERROR,"Illegal format code in EXIF dir");
- }
-
- ByteCount = Components * ExifBytesPerFormat[Format];
-
- if (ByteCount > 4) {
- unsigned OffsetVal;
- OffsetVal = Get32u(DirEntry+8, ImageInfo->MotorolaOrder);
- /* If its bigger than 4 bytes, the dir entry contains an offset. */
- if (OffsetVal+ByteCount > ExifLength) {
- /* Bogus pointer offset and / or bytecount value */
-/* printf("Offset %d bytes %d ExifLen %d\n",OffsetVal, ByteCount, ExifLength); */
-
- php_error(E_ERROR,"Illegal pointer offset value in EXIF");
- }
- ValuePtr = OffsetBase+OffsetVal;
- } else {
- /* 4 bytes or less and value is in the dir entry itself */
- ValuePtr = DirEntry+8;
- }
-
- if (LastExifRefd < ValuePtr+ByteCount) {
- /*
- Keep track of last byte in the exif header that was actually referenced.
- That way, we know where the discardable thumbnail data begins.
- */
- LastExifRefd = ValuePtr+ByteCount;
- }
-
- /* Extract useful components of tag */
- switch(Tag) {
-
- case TAG_MAKE:
- strlcpy(ImageInfo->CameraMake, ValuePtr, sizeof(ImageInfo->CameraMake));
- break;
-
- case TAG_MODEL:
- strlcpy(ImageInfo->CameraModel, ValuePtr, sizeof(ImageInfo->CameraModel));
- break;
-
- case TAG_GPSINFO:
- strlcpy(ImageInfo->GPSinfo, ValuePtr, sizeof(ImageInfo->GPSinfo));
- break;
-
- case TAG_EXIFVERSION:
- strlcpy(ImageInfo->ExifVersion, ValuePtr, sizeof(ImageInfo->ExifVersion));
- break;
-
- case TAG_COPYRIGHT:
- strlcpy(ImageInfo->Copyright, ValuePtr, sizeof(ImageInfo->Copyright));
- break;
-
- case TAG_SOFTWARE:
- strlcpy(ImageInfo->Software, ValuePtr, sizeof(ImageInfo->Software));
- break;
-
- case TAG_ORIENTATION:
- ImageInfo->Orientation = (int)ConvertAnyFormat(ValuePtr, Format,ImageInfo->MotorolaOrder);
- break;
-
- case TAG_ISOSPEED:
- ImageInfo->ISOspeed = (int)ConvertAnyFormat(ValuePtr, Format,ImageInfo->MotorolaOrder);
- break;
-
- case TAG_DATETIME_ORIGINAL:
- strlcpy(ImageInfo->DateTime, ValuePtr, sizeof(ImageInfo->DateTime));
- break;
-
- case TAG_USERCOMMENT:
- /* Olympus has this padded with trailing spaces. Remove these first. */
- for (a=ByteCount;;) {
- a--;
- if ((ValuePtr)[a] == ' ') {
- (ValuePtr)[a] = '\0';
- } else {
- break;
- }
- if (a == 0) break;
- }
-
- /* Copy the comment */
- if (memcmp(ValuePtr, "ASCII",5) == 0) {
- for (a=5;a<10;a++) {
- int c;
- c = (ValuePtr)[a];
- if (c != '\0' && c != ' ') {
- strlcpy(ImageInfo->Comments, a+ValuePtr, sizeof(ImageInfo->Comments));
- break;
- }
- }
-
- } else {
- strlcpy(ImageInfo->Comments, ValuePtr, sizeof(ImageInfo->Comments));
- }
- break;
-
- case TAG_FNUMBER:
- /* Simplest way of expressing aperture, so I trust it the most.
- (overwrite previously computd value if there is one) */
- ImageInfo->ApertureFNumber = (float)ConvertAnyFormat(ValuePtr, Format,ImageInfo->MotorolaOrder);
- break;
-
- case TAG_APERTURE:
- case TAG_MAXAPERTURE:
- /* More relevant info always comes earlier, so only use this field if we don't
- have appropriate aperture information yet. */
- if (ImageInfo->ApertureFNumber == 0) {
- ImageInfo->ApertureFNumber
- = (float)exp(ConvertAnyFormat(ValuePtr, Format, ImageInfo->MotorolaOrder)*log(2)*0.5);
- }
- break;
-
- case TAG_FOCALLENGTH:
- /* Nice digital cameras actually save the focal length as a function
- of how farthey are zoomed in. */
- ImageInfo->FocalLength = (float)ConvertAnyFormat(ValuePtr, Format,ImageInfo->MotorolaOrder);
- break;
-
- case TAG_SUBJECT_DISTANCE:
- /* Inidcates the distacne the autofocus camera is focused to.
- Tends to be less accurate as distance increases. */
- ImageInfo->Distance = (float)ConvertAnyFormat(ValuePtr, Format,ImageInfo->MotorolaOrder);
- break;
-
- case TAG_EXPOSURETIME:
- /* Simplest way of expressing exposure time, so I trust it most.
- (overwrite previously computd value if there is one) */
- ImageInfo->ExposureTime = (float)ConvertAnyFormat(ValuePtr, Format,ImageInfo->MotorolaOrder);
- break;
-
- case TAG_SHUTTERSPEED:
- /* More complicated way of expressing exposure time, so only use
- this value if we don't already have it from somewhere else. */
- if (ImageInfo->ExposureTime == 0) {
- ImageInfo->ExposureTime
- = (float)(1/exp(ConvertAnyFormat(ValuePtr, Format, ImageInfo->MotorolaOrder)*log(2)));
- }
- break;
-
- case TAG_FLASH:
- if (ConvertAnyFormat(ValuePtr, Format, ImageInfo->MotorolaOrder)) {
- ImageInfo->FlashUsed = 1;
- }
- break;
-
- case TAG_IMAGEWIDTH:
- ImageInfo->ExifImageWidth = (int)ConvertAnyFormat(ValuePtr, Format,ImageInfo->MotorolaOrder);
- break;
-
- case TAG_FOCALPLANEXRES:
- ImageInfo->FocalplaneXRes = ConvertAnyFormat(ValuePtr, Format,ImageInfo->MotorolaOrder);
- break;
-
- case TAG_FOCALPLANEUNITS:
- switch((int)ConvertAnyFormat(ValuePtr, Format,ImageInfo->MotorolaOrder)) {
- case 1: ImageInfo->FocalplaneUnits = 25.4; break; /* inch */
- case 2:
- /* According to the information I was using, 2 measn meters.
- But looking at the Cannon powershot's files, inches is the only
- sensible value. */
- ImageInfo->FocalplaneUnits = 25.4;
- break;
-
- case 3: ImageInfo->FocalplaneUnits = 10; break; /* centimeter */
- case 4: ImageInfo->FocalplaneUnits = 1; break; /* milimeter */
- case 5: ImageInfo->FocalplaneUnits = .001; break; /* micrometer */
- }
- break;
-
- case TAG_LIGHT_SOURCE:
- /* Rarely set or useful. */
- break;
-
- case TAG_SPECIALMODE:
- ImageInfo->SpecialMode = (int)ConvertAnyFormat(ValuePtr, Format,ImageInfo->SpecialMode);
- break;
-
- case TAG_JPEGQUAL: /* I think that this is a pointer to the thumbnail - let's see */
- ImageInfo->ThumbnailOffset = (int)ConvertAnyFormat(ValuePtr, Format, ImageInfo->ThumbnailOffset);
-
- /* see if we know the size */
- if (ImageInfo->ThumbnailSize) {
- ExtractThumbnail(ImageInfo, OffsetBase, ExifLength);
- }
- /*ImageInfo->JpegQual = (int)ConvertAnyFormat(ValuePtr, Format,ImageInfo->JpegQual);*/
- break;
-
- case TAG_MACRO: /* I think this is the size of the Thumbnail */
- ImageInfo->ThumbnailSize = (int)ConvertAnyFormat(ValuePtr, Format, ImageInfo->ThumbnailSize);
-
- /* see if we have the offset */
- if (ImageInfo->ThumbnailOffset) {
- ExtractThumbnail(ImageInfo, OffsetBase, ExifLength);
- }
- /*ImageInfo->Macro = (int)ConvertAnyFormat(ValuePtr, Format,ImageInfo->Macro);*/
- break;
-
- case TAG_DIGIZOOM:
- ImageInfo->DigiZoom = (int)ConvertAnyFormat(ValuePtr, Format,ImageInfo->DigiZoom);
- break;
-
- case TAG_SOFTWARERELEASE:
- strlcpy(ImageInfo->SoftwareRelease, ValuePtr, sizeof(ImageInfo->SoftwareRelease));
- break;
-
- case TAG_PICTINFO:
- strlcpy(ImageInfo->PictInfo, ValuePtr, sizeof(ImageInfo->PictInfo));
- break;
-
- case TAG_CAMERAID:
- strlcpy(ImageInfo->CameraId, ValuePtr, sizeof(ImageInfo->CameraId));
- break;
- }
-
- if (Tag == TAG_EXIF_OFFSET || Tag == TAG_INTEROP_OFFSET) {
- char *SubdirStart;
- SubdirStart = OffsetBase + Get32u(ValuePtr, ImageInfo->MotorolaOrder);
- if (SubdirStart < OffsetBase || SubdirStart > OffsetBase+ExifLength) {
- php_error(E_ERROR,"Illegal subdirectory link");
- }
- ProcessExifDir(ImageInfo, SubdirStart, OffsetBase, ExifLength, LastExifRefd);
- continue;
- }
- }
- /*
- * Hack to make it process IDF1 I hope
- * There are 2 IDFs, the second one holds the keys (0x0201 and 0x0202) to the thumbnail
- */
- NextDirOffset = Get32u(DirStart+2+12*de, ImageInfo->MotorolaOrder);
- if (NextDirOffset) {
- if (OffsetBase + NextDirOffset < OffsetBase || OffsetBase + NextDirOffset > OffsetBase+ExifLength) {
- php_error(E_ERROR,"Illegal directory offset");
- }
- ProcessExifDir(ImageInfo, OffsetBase + NextDirOffset, OffsetBase, ExifLength, LastExifRefd);
- }
-}
-/* }}} */
-
-/* {{{ process_EXIF
- Process an EXIF marker
- Describes all the drivel that most digital cameras include...
-*/
-static void process_EXIF (ImageInfoType *ImageInfo, char *CharBuf, unsigned int length, char *LastExifRefd)
-{
- ImageInfo->FlashUsed = 0; /* If it s from a digicam, and it used flash, it says so. */
- LastExifRefd = CharBuf;
-
- ImageInfo->FocalplaneXRes = 0;
- ImageInfo->FocalplaneUnits = 0;
- ImageInfo->ExifImageWidth = 0;
-
- /* set the thumbnail stuff to nothing so we can test to see if they get set up */
- ImageInfo->Thumbnail = NULL;
- ImageInfo->ThumbnailSize = 0;
-
- { /* Check the EXIF header component */
- static const uchar ExifHeader[] = {0x45, 0x78, 0x69, 0x66, 0x00, 0x00};
- if (memcmp(CharBuf+2, ExifHeader,6)) {
- php_error(E_ERROR,"Incorrect Exif header");
- }
- }
-
- if (memcmp(CharBuf+8,"II",2) == 0) {
-/* if (ShowTags) printf("Exif section in Intel order\n"); */
- ImageInfo->MotorolaOrder = 0;
- } else {
- if (memcmp(CharBuf+8,"MM",2) == 0) {
-/* if (ShowTags) printf("Exif section in Motorola order\n"); */
- ImageInfo->MotorolaOrder = 1;
- } else {
- php_error(E_ERROR,"Invalid Exif alignment marker.");
- }
- }
-
- /* Check the next two values for correctness. */
- if (Get16u(CharBuf+10,ImageInfo->MotorolaOrder) != 0x2a
- || Get32u(CharBuf+12,ImageInfo->MotorolaOrder) != 0x08) {
- php_error(E_ERROR,"Invalid Exif start (1)");
- }
-
- /* First directory starts 16 bytes in. Offsets start at 8 bytes in. */
- ProcessExifDir(ImageInfo, CharBuf+16, CharBuf+8, length-6, LastExifRefd);
-
- /* MB: This is where I will make my attempt to get the tumbnail */
-
-
- /* Compute the CCD width, in milimeters. */
- if (ImageInfo->FocalplaneXRes != 0) {
- ImageInfo->CCDWidth = (float)(ImageInfo->ExifImageWidth * ImageInfo->FocalplaneUnits / ImageInfo->FocalplaneXRes);
- }
-}
-/* }}} */
-
-/* {{{ scan_JPEG_header
- * Parse the marker stream until SOS or EOI is seen; */
-static int scan_JPEG_header (ImageInfoType *ImageInfo, FILE *infile, Section_t *Sections, int *SectionsRead, int ReadAll, char *LastExifRefd)
-{
- int a;
- int HaveCom = FALSE;
-
- a = fgetc(infile);
- if (a != 0xff || fgetc(infile) != M_SOI) {
- return FALSE;
- }
-
- for(*SectionsRead=0;*SectionsRead < 19;) {
- int itemlen;
- int marker = 0;
- int ll,lh, got;
- uchar *Data;
-
- for (a=0;a<7;a++) {
- marker = fgetc(infile);
- if (marker != 0xff) break;
- }
- if (marker == 0xff) {
- /* 0xff is legal padding, but if we get that many, something's wrong. */
- php_error(E_ERROR,"too many padding bytes!");
- }
-
- Sections[*SectionsRead].Type = marker;
-
- /* Read the length of the section. */
- lh = fgetc(infile);
- ll = fgetc(infile);
-
- itemlen = (lh << 8) | ll;
-
- if (itemlen < 2) {
- php_error(E_ERROR,"invalid marker");
- }
-
- Sections[*SectionsRead].Size = itemlen;
-
- Data = (uchar *)emalloc(itemlen+1); /* Add 1 to allow sticking a 0 at the end. */
- Sections[*SectionsRead].Data = Data;
-
- /* Store first two pre-read bytes. */
- Data[0] = (uchar)lh;
- Data[1] = (uchar)ll;
-
- got = fread(Data+2, 1, itemlen-2, infile); /* Read the whole section. */
- if (got != itemlen-2) {
- php_error(E_ERROR,"reading from file");
- }
- *SectionsRead += 1;
-
- /*printf("Marker '%x' size %d\n",marker, itemlen);*/
- switch(marker) {
- case M_SOS: /* stop before hitting compressed data */
- /* If reading entire image is requested, read the rest of the data. */
- if (ReadAll) {
- int cp, ep, size;
- /* Determine how much file is left. */
- cp = ftell(infile);
- fseek(infile, 0, SEEK_END);
- ep = ftell(infile);
- fseek(infile, cp, SEEK_SET);
-
- size = ep-cp;
- Data = (uchar *)malloc(size);
- if (Data == NULL) {
- php_error(E_ERROR,"could not allocate data for entire image");
- }
-
- got = fread(Data, 1, size, infile);
- if (got != size) {
- php_error(E_ERROR,"could not read the rest of the image");
- }
-
- Sections[*SectionsRead].Data = Data;
- Sections[*SectionsRead].Size = size;
- Sections[*SectionsRead].Type = PSEUDO_IMAGE_MARKER;
- (*SectionsRead)++;
- /*
- *HaveAll = 1;
- */
- }
- return TRUE;
-
- case M_EOI: /* in case it's a tables-only JPEG stream */
- php_error(E_ERROR,"No image in jpeg!");
- return FALSE;
-
- case M_COM: /* Comment section */
- if (HaveCom) {
- (*SectionsRead) -= 1;
- efree(Sections[*SectionsRead].Data);
- } else {
- process_COM(ImageInfo, Data, itemlen);
- HaveCom = TRUE;
- }
- break;
-
- case M_EXIF:
- if (*SectionsRead <= 2) {
- /* Seen files from some 'U-lead' software with Vivitar scanner
- that uses marker 31 later in the file (no clue what for!) */
- process_EXIF(ImageInfo, (char *)Data, itemlen, LastExifRefd);
- }
- break;
-
-
- case M_SOF0:
- case M_SOF1:
- case M_SOF2:
- case M_SOF3:
- case M_SOF5:
- case M_SOF6:
- case M_SOF7:
- case M_SOF9:
- case M_SOF10:
- case M_SOF11:
- case M_SOF13:
- case M_SOF14:
- case M_SOF15:
- process_SOFn(ImageInfo, Data, marker);
- break;
- default:
- /* skip any other marker silently. */
- break;
- }
- }
- return TRUE;
-}
-/* }}} */
-
-/* {{{ DiscardData
- Discard read data.
-*/
-void DiscardData(Section_t *Sections, int *SectionsRead)
-{
- int a;
- for (a=0;a<*SectionsRead-1;a++) {
- efree(Sections[a].Data);
- }
- *SectionsRead = 0;
-}
-/* }}} */
-
-/* {{{ ReadJpegFile
- Read image data.
-*/
-int ReadJpegFile(ImageInfoType *ImageInfo, Section_t *Sections,
- int *SectionsRead, char *FileName,
- int ReadAll, char *LastExifRefd)
-{
- FILE *infile;
- int ret;
- char *tmp;
-
- infile = VCWD_FOPEN(FileName, "rb"); /* Unix ignores 'b', windows needs it. */
-
- if (infile == NULL) {
- php_error(E_ERROR, "Unable to open '%s'", FileName);
- return FALSE;
- }
-/* CurrentFile = FileName; */
-
- /* Start with an empty image information structure. */
- memset(ImageInfo, 0, sizeof(*ImageInfo));
- memset(Sections, 0, sizeof(*Sections));
-
- tmp = php_basename(FileName,strlen(FileName));
- strlcpy(ImageInfo->FileName, tmp, sizeof(ImageInfo->FileName));
- efree(tmp);
- ImageInfo->FocalLength = 0;
- ImageInfo->ExposureTime = 0;
- ImageInfo->ApertureFNumber = 0;
- ImageInfo->Distance = 0;
- ImageInfo->CCDWidth = 0;
- ImageInfo->FlashUsed = -1;
- ImageInfo->SpecialMode = -1;
- ImageInfo->JpegQual = -1;
- ImageInfo->Macro = -1;
- ImageInfo->DigiZoom = -1;
-
- {
- /* Store file date/time. */
- struct stat st;
- if (VCWD_STAT(FileName, &st) >= 0) {
- ImageInfo->FileDateTime = st.st_mtime;
- ImageInfo->FileSize = st.st_size;
- } else {
- php_error(E_ERROR,"Can't get file statitics");
- }
- }
-
- /* Scan the JPEG headers. */
- ret = scan_JPEG_header(ImageInfo, infile, Sections, SectionsRead, ReadAll, LastExifRefd);
- if (!ret) {
- php_error(E_ERROR,"Invalid Jpeg file: '%s'\n",FileName);
- }
-
- fclose(infile);
-
- return ret;
-}
-/* }}} */
-
-/* {{{ php_read_jpeg_exif
- */
-int php_read_jpeg_exif(ImageInfoType *ImageInfo, char *FileName, int ReadAll)
-{
- Section_t Sections[20];
- int SectionsRead;
- char *LastExifRefd=NULL;
- int ret;
- /* int i; */
-
- ImageInfo->MotorolaOrder = 0;
-
- ret = ReadJpegFile(ImageInfo, Sections, &SectionsRead, FileName, ReadAll, LastExifRefd);
- /*
- * Thought this might pick out the embedded thumbnail, but it doesn't work. -RL
- for (i=0;i<SectionsRead-1;i++) {
- if (Sections[i].Type == M_EXIF) {
- thumbsize = Sections[i].Size;
- if(thumbsize>0) {
- ImageInfo->Thumbnail = emalloc(thumbsize+5);
- ImageInfo->ThumbnailSize = thumbsize;
- ImageInfo->Thumbnail[0] = 0xff;
- ImageInfo->Thumbnail[1] = 0xd8;
- ImageInfo->Thumbnail[2] = 0xff;
- memcpy(ImageInfo->Thumbnail+4, Sections[i].Data, thumbsize+4);
- }
- }
- }
- */
- if (ret != FALSE) {
- DiscardData(Sections, &SectionsRead);
- }
- return(ret);
-}
-/* }}} */
-
-/* {{{ proto string read_exif_data(string filename)
- Reads the EXIF header data from a JPEG file */
-PHP_FUNCTION(read_exif_data) {
- pval **p_name;
- int ac = ZEND_NUM_ARGS(), ret;
- ImageInfoType ImageInfo;
- char tmp[64];
-
- /*ImageInfo.Thumbnail = NULL;
- ImageInfo.ThumbnailSize = 0;
- */
-
- if (ac != 1 || zend_get_parameters_ex(ac, &p_name) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_string_ex(p_name);
-
- ret = php_read_jpeg_exif(&ImageInfo, Z_STRVAL_PP(p_name),1);
-
- if (array_init(return_value) == FAILURE) {
- RETURN_FALSE;
- }
- add_assoc_string(return_value,"FileName",ImageInfo.FileName,1);
- add_assoc_long(return_value,"FileDateTime",ImageInfo.FileDateTime);
- add_assoc_long(return_value,"FileSize",ImageInfo.FileSize);
- if (ImageInfo.CameraMake[0]) {
- add_assoc_string(return_value,"CameraMake",ImageInfo.CameraMake,1);
- }
- if (ImageInfo.CameraModel[0]) {
- add_assoc_string(return_value,"CameraModel",ImageInfo.CameraModel,1);
- }
- if (ImageInfo.DateTime[0]) {
- add_assoc_string(return_value,"DateTime",ImageInfo.DateTime,1);
- }
- add_assoc_long(return_value,"Height",ImageInfo.Height);
- add_assoc_long(return_value,"Width",ImageInfo.Width);
- add_assoc_long(return_value,"IsColor",ImageInfo.IsColor);
- if(ImageInfo.FlashUsed >= 0) {
- add_assoc_long(return_value,"FlashUsed",ImageInfo.FlashUsed);
- }
- if (ImageInfo.FocalLength) {
- sprintf(tmp,"%4.1fmm",ImageInfo.FocalLength);
- add_assoc_string(return_value,"FocalLength",tmp,1);
- if(ImageInfo.CCDWidth) {
- sprintf(tmp,"%dmm",(int)(ImageInfo.FocalLength/ImageInfo.CCDWidth*35+0.5));
- add_assoc_string(return_value,"35mmFocalLength",tmp,1);
- }
- add_assoc_double(return_value,"RawFocalLength",ImageInfo.FocalLength);
- }
- if(ImageInfo.ExposureTime) {
- if(ImageInfo.ExposureTime <= 0.5) {
- sprintf(tmp,"%6.3f s (1/%d)",ImageInfo.ExposureTime,(int)(0.5 + 1/ImageInfo.ExposureTime));
- } else {
- sprintf(tmp,"%6.3f s",ImageInfo.ExposureTime);
- }
- add_assoc_string(return_value,"ExposureTime",tmp,1);
- add_assoc_double(return_value,"RawExposureTime",ImageInfo.ExposureTime);
- }
- if(ImageInfo.ApertureFNumber) {
- sprintf(tmp,"f/%4.1f",ImageInfo.ApertureFNumber);
- add_assoc_string(return_value,"ApertureFNumber",tmp,1);
- add_assoc_double(return_value,"RawApertureFNumber",ImageInfo.ApertureFNumber);
- }
- if(ImageInfo.Distance) {
- if(ImageInfo.Distance<0) {
- add_assoc_string(return_value,"FocusDistance","Infinite",1);
- } else {
- sprintf(tmp,"%5.2fm",ImageInfo.Distance);
- add_assoc_string(return_value,"FocusDistance",tmp,1);
- }
- add_assoc_double(return_value,"RawFocusDistance",ImageInfo.Distance);
- }
- if(ImageInfo.CCDWidth) {
- add_assoc_double(return_value,"CCDWidth",ImageInfo.CCDWidth);
- }
- if(ImageInfo.Orientation) {
- add_assoc_long(return_value,"Orientation",ImageInfo.Orientation);
- }
- if (ImageInfo.GPSinfo[0]) {
- add_assoc_string(return_value,"GPSinfo",ImageInfo.GPSinfo,1);
- }
- if(ImageInfo.ISOspeed) {
- add_assoc_long(return_value,"ISOspeed",ImageInfo.ISOspeed);
- }
- if (ImageInfo.ExifVersion[0]) {
- add_assoc_string(return_value,"ExifVersion",ImageInfo.ExifVersion,1);
- }
- if (ImageInfo.Copyright[0]) {
- add_assoc_string(return_value,"Copyright",ImageInfo.Copyright,1);
- }
- if (ImageInfo.Software[0]) {
- add_assoc_string(return_value,"Software",ImageInfo.Software,1);
- }
- if(ImageInfo.Comments[0]) {
- add_assoc_string(return_value,"Comments",ImageInfo.Comments,1);
- }
- if(ImageInfo.ThumbnailSize) {
- add_assoc_stringl(return_value,"Thumbnail",ImageInfo.Thumbnail,ImageInfo.ThumbnailSize,1);
- add_assoc_long(return_value,"ThumbnailSize",ImageInfo.ThumbnailSize);
- efree(ImageInfo.Thumbnail);
- }
- if(ImageInfo.SpecialMode >= 0) {
- add_assoc_long(return_value,"SpecialMode",ImageInfo.SpecialMode);
- }
- if(ImageInfo.JpegQual >= 0) {
- add_assoc_long(return_value,"JpegQual",ImageInfo.JpegQual);
- }
- if(ImageInfo.Macro >= 0) {
- add_assoc_long(return_value,"Macro",ImageInfo.Macro);
- }
- if(ImageInfo.DigiZoom >= 0) {
- add_assoc_long(return_value,"DigiZoom",ImageInfo.DigiZoom);
- }
- if (ImageInfo.SoftwareRelease[0]) {
- add_assoc_string(return_value,"SoftwareRelease",ImageInfo.SoftwareRelease,1);
- }
- if (ImageInfo.PictInfo[0]) {
- add_assoc_string(return_value,"PictInfo",ImageInfo.PictInfo,1);
- }
- if (ImageInfo.CameraId[0]) {
- add_assoc_string(return_value,"CameraId",ImageInfo.CameraId,1);
- }
-}
-/* }}} */
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/exif/exif.dsp b/ext/exif/exif.dsp
deleted file mode 100644
index a75a69f139..0000000000
--- a/ext/exif/exif.dsp
+++ /dev/null
@@ -1,113 +0,0 @@
-# Microsoft Developer Studio Project File - Name="exif" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=exif - Win32 Release_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "exif.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "exif.mak" CFG="exif - Win32 Release_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "exif - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "exif - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "exif - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\..\TSRM" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_EXIF" /D ZTS=1 /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D ZEND_DEBUG=0 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "EXIF_EXPORTS" /D "COMPILE_DL_EXIF" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_EXIF=1 /FR /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x406 /d "NDEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib /nologo /dll /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_exif.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
-
-!ELSEIF "$(CFG)" == "exif - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_EXIF" /D ZTS=1 /YX /FD /c
-# ADD CPP /nologo /MDd /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "EXIF_EXPORTS" /D "COMPILE_DL_EXIF" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_EXIF=1 /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x406 /d "NDEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib /nologo /dll /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts_debug.lib /nologo /dll /machine:I386 /out:"..\..\Debug_TS/php_exif.dll" /libpath:"..\..\Debug_TS"
-
-!ENDIF
-
-# Begin Target
-
-# Name "exif - Win32 Release_TS"
-# Name "exif - Win32 Debug_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\exif.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_exif.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/ext/exif/php_exif.h b/ext/exif/php_exif.h
deleted file mode 100644
index 6f6b7f1ac2..0000000000
--- a/ext/exif/php_exif.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Rasmus Lerdorf <rasmus@php.net> |
- +----------------------------------------------------------------------+
- */
-
-#if HAVE_EXIF
-extern zend_module_entry exif_module_entry;
-#define phpext_exif_ptr &exif_module_entry
-
-PHP_FUNCTION(read_exif_data);
-#endif
diff --git a/ext/ext_skel b/ext/ext_skel
deleted file mode 100755
index c3a78bf2de..0000000000
--- a/ext/ext_skel
+++ /dev/null
@@ -1,297 +0,0 @@
-#!/bin/sh
-
-givup() {
- echo $*
- exit 1
-}
-
-usage() {
-echo "$0 --extname=module [--proto=file] [--stubs=file] [--xml[=file]]"
-echo " [--full-xml] [--no-help] [--assign-params [--string-lens]]"
-echo ""
-echo " --extname=module module is the name of your extension"
-echo " --proto=file file contains prototypes of functions to create"
-echo " --stubs=file generate only function stubs in file"
-echo " --xml generate xml documentation to be added to phpdoc-cvs"
-echo " --full-xml generate xml documentation for a self-contained extension"
-echo " (not yet implemented)"
-echo " --no-help don't try to be nice and create comments in the code"
-echo " and helper functions to test if the module compiled"
-echo " --assign-params"
-echo " --string-lens"
-exit 1
-}
-
-if test $# = 0; then
- usage
-fi
-
-while test $# -gt 0; do
- case "$1" in
- -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
- *) optarg= ;;
- esac
-
- case $1 in
- --extname=?*)
- extname=$optarg
- EXTNAME=`echo $extname | tr [a-z] [A-Z]`
- ;;
- --proto=?*)
- proto=$optarg
- ;;
- --stubs=*)
- stubs=yes
- stubfile=$optarg
- ;;
- --xml)
- xml="yes"
- ;;
- --xml=?*)
- xml=$optarg
- ;;
- --full-xml)
- full_xml="yes"
- ;;
- --no-help)
- no_help="yes"
- ;;
- --assign-params)
- assign_params="yes"
- ;;
- --string-lens)
- string_lens="yes"
- ;;
- *)
- usage
- ;;
- esac
- shift
-done
-
-if test -z "$assign_params" && test -n "$string_lens"; then
- usage
-fi
-
-if test -d "$extname" ; then
- givup "Directory $extname already exists."
-fi
-
-test -f ext_skel || givup "ext_skel must be in the current directory"
-test -d skeleton || givup "subdirectory skeleton does not exist or is not directory"
-
-if echo '\c' | grep -s c >/dev/null 2>&1
-then
- ECHO_N="echo -n"
- ECHO_C=""
-else
- ECHO_N="echo"
- ECHO_C='\c'
-fi
-
-if test -z "$stubs"; then
- echo "Creating directory $extname"
- stubfile=$extname"/function_stubs"
- mkdir $extname || givup "Cannot create directory $extname"
-fi
-
-if test -n "$proto"; then
- cat $proto | awk -v extname=$extname -v stubs=$stubs -v stubfile=$stubfile -v xml=$xml -v full_xml=$full_xml -v i_know_what_to_do_shut_up_i_dont_need_your_help_mode=$no_help -v assign_params=$assign_params -v string_lens=$string_lens -f ./skeleton/create_stubs
-fi
-
-if test -z "$stubs"; then
- cd $extname
- chmod 755 .
-
-$ECHO_N "Creating basic files:$ECHO_C"
-
-$ECHO_N " config.m4$ECHO_C"
-cat >config.m4 <<eof
-dnl \$Id\$
-dnl config.m4 for extension $extname
-
-dnl Comments in this file start with the string 'dnl'.
-dnl Remove where necessary. This file will not work
-dnl without editing.
-
-dnl If your extension references something external, use with:
-
-dnl PHP_ARG_WITH($extname, for $extname support,
-dnl Make sure that the comment is aligned:
-dnl [ --with-$extname Include $extname support])
-
-dnl Otherwise use enable:
-
-dnl PHP_ARG_ENABLE($extname, whether to enable $extname support,
-dnl Make sure that the comment is aligned:
-dnl [ --enable-$extname Enable $extname support])
-
-if test "\$PHP_$EXTNAME" != "no"; then
- dnl Write more examples of tests here...
-
- dnl # --with-$extname -> check with-path
- dnl SEARCH_PATH="/usr/local /usr" # you might want to change this
- dnl SEARCH_FOR="/include/$extname.h" # you most likely want to change this
- dnl if test -r \$PHP_$EXTNAME/$SEARCH_FOR; then # path given as parameter
- dnl ${EXTNAME}_DIR=\$PHP_$EXTNAME
- dnl else # search default path list
- dnl AC_MSG_CHECKING(for $extname files in default path)
- dnl for i in \$SEARCH_PATH ; do
- dnl if test -r \$i/\$SEARCH_FOR; then
- dnl ${EXTNAME}_DIR=\$i
- dnl AC_MSG_RESULT(found in \$i)
- dnl fi
- dnl done
- dnl fi
- dnl
- dnl if test -z "\$${EXTNAME}_DIR"; then
- dnl AC_MSG_RESULT(not found)
- dnl AC_MSG_ERROR(Please reinstall the $extname distribution)
- dnl fi
-
- dnl # --with-$extname -> add include path
- dnl PHP_ADD_INCLUDE(\$${EXTNAME}_DIR/include)
-
- dnl # --with-$extname -> chech for lib and symbol presence
- dnl LIBNAME=$extname # you may wnat to change this
- dnl LIBSYMBOL=$extname # you most likely want to change this
- dnl old_LIBS=\$LIBS
- dnl LIBS="\$LIBS -L\$${EXTNAME}_DIR/lib -lm -ldl"
- dnl AC_CHECK_LIB(\$LIBNAME, \$LIBSYMBOL, [AC_DEFINE(HAVE_${EXTNAME}LIB,1,[ ])],
- dnl [AC_MSG_ERROR(wrong $extname lib version or lib not found)])
- dnl LIBS=\$old_LIBS
- dnl
- dnl PHP_SUBST(${EXTNAME}_SHARED_LIBADD)
- dnl PHP_ADD_LIBRARY_WITH_PATH(\$LIBNAME, \$${EXTNAME}_DIR/lib, SAPRFC_SHARED_LIBADD)
-
- PHP_EXTENSION($extname, \$ext_shared)
-fi
-eof
-
-$ECHO_N " Makefile.in$ECHO_C"
-cat >Makefile.in <<eof
-# \$Id\$
-
-LTLIBRARY_NAME = lib$extname.la
-LTLIBRARY_SOURCES = $extname.c
-LTLIBRARY_SHARED_NAME = $extname.la
-LTLIBRARY_SHARED_LIBADD = \$(${EXTNAME}_SHARED_LIBADD)
-
-include \$(top_srcdir)/build/dynlib.mk
-eof
-
-
-$ECHO_N " .cvsignore$ECHO_C"
-cat >.cvsignore <<eof
-.deps
-Makefile
-*.lo
-*.la
-.libs
-libs.mk
-eof
-
-$ECHO_N " $extname.c$ECHO_C"
-echo "s/extname/$extname/g" > sedscript
-echo "s/EXTNAME/$EXTNAME/g" >> sedscript
-echo '/__function_entries_here__/r function_entries' >> sedscript
-echo '/__function_stubs_here__/r function_stubs' >> sedscript
-echo '/__header_here__/r ../../header' >> sedscript
-echo '/__footer_here__/r ../../footer' >> sedscript
-echo '/__function_entries_here__/D' >> sedscript
-echo '/__function_stubs_here__/D' >> sedscript
-echo '/__header_here__/D' >> sedscript
-echo '/__footer_here__/D' >> sedscript
-if [ ! -z "$no_help" ]; then
- echo "/confirm_$extname_compiled/D" >> sedscript
- echo '/Remove the following/,/^\*\//D' >> sedscript
- echo 's/[[:space:]]\/\*.\+\*\///' >> sedscript
- echo 's/^\/\*.*\*\/$//' >> sedscript
- echo '/^[[:space:]]*\/\*/,/^[[:space:]]*\*\//D' >> sedscript
-fi
-
-sed -f sedscript <../skeleton/skeleton.c > $extname.c
-
-
-$ECHO_N " php_$extname.h$ECHO_C"
-echo "s/extname/$extname/g" > sedscript
-echo "s/EXTNAME/$EXTNAME/g" >> sedscript
-echo '/__function_declarations_here__/r function_declarations' >> sedscript
-echo '/__header_here__/r ../../header' >> sedscript
-echo '/__footer_here__/r ../../footer' >> sedscript
-echo '/__function_declarations_here__/D' >> sedscript
-echo '/__header_here__/D' >> sedscript
-echo '/__footer_here__/D' >> sedscript
-if [ ! -z "$no_help" ]; then
- echo "/confirm_$extname_compiled/D" >> sedscript
- echo 's/[[:space:]]\/\*.\+\*\///' >> sedscript
- echo 's/^\/\*.*\*\/$//' >> sedscript
- echo '/^[[:space:]]*\/\*/,/^[[:space:]]*\*\//D' >> sedscript
-fi
-sed -f sedscript <../skeleton/php_skeleton.h > php_$extname.h
-
-$ECHO_N " CREDITS$ECHO_C"
-echo "s/extname/$extname/g" > sedscript
-sed -f sedscript <../skeleton/CREDITS > CREDITS
-
-$ECHO_N " EXPERIMENTAL$ECHO_C"
-echo "s/extname/$extname/g" > sedscript
-sed -f sedscript <../skeleton/EXPERIMENTAL > EXPERIMENTAL
-
-$ECHO_N " tests/001.phpt$ECHO_C"
-mkdir tests || givup "Cannot create tests directory"
-chmod 755 tests
-sed -f sedscript <../skeleton/tests/001.phpt > tests/001.phpt
-
-if test -z "$stubs" && test -z "$no_help"; then
- $ECHO_N " $extname.php$ECHO_C"
- sed \
- -e "s/extname/$extname/g" \
- <../skeleton/skeleton.php \
- > $extname.php
-fi
-
-rm sedscript
-
-if test -n "$proto"; then
- if test -z "$stubs"; then
- rm function_entries
- rm function_declarations
- rm function_stubs
- fi
- if test -f function_warning; then
- rm function_warning
- warning="
-NOTE! Because some arguments to functions were resources, the code generated
-cannot yet be compiled without editing. Please consider this to be step 4.5
-in the instructions above.
-"
- fi
-fi
-
-find . -type f | xargs chmod 644
-find . -type d | xargs chmod 755
-fi
-
-echo " [done]."
-
-if test -z "$no_help" && test -z "$stubs"; then
- cat <<eof
-
-To use your new extension, you will have to execute the following steps:
-
-1. $ cd ..
-2. $ vi ext/$extname/config.m4
-3. $ ./buildconf
-4. $ ./configure --[with|enable]-$extname
-5. $ make
-6. $ ./php -f ext/$extname/$extname.php
-7. $ vi ext/$extname/$extname.c
-8. $ make
-
-Repeat steps 3-6 until you are satisfied with ext/$extname/config.m4 and
-step 6 confirms that your module is compiled into PHP. Then, start writing
-code and repeat the last two steps as often as necessary.
-$warning
-eof
-fi
diff --git a/ext/fbsql/CREDITS b/ext/fbsql/CREDITS
deleted file mode 100644
index 3500fdc89e..0000000000
--- a/ext/fbsql/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-FBSQL
-Frank M. Kromann
diff --git a/ext/fbsql/EXPERIMENTAL b/ext/fbsql/EXPERIMENTAL
deleted file mode 100644
index 6443e99646..0000000000
--- a/ext/fbsql/EXPERIMENTAL
+++ /dev/null
@@ -1,5 +0,0 @@
-this extension is experimental,
-its functions may change their names
-or move to extension all together
-so do not rely to much on them
-you have been warned!
diff --git a/ext/fbsql/Makefile.in b/ext/fbsql/Makefile.in
deleted file mode 100644
index 66bec05fac..0000000000
--- a/ext/fbsql/Makefile.in
+++ /dev/null
@@ -1,10 +0,0 @@
-
-LTLIBRARY_NAME = libfbsql.la
-LTLIBRARY_SOURCES = php_fbsql.c
-LTLIBRARY_LIBADD = $(FBSQL_LIBADD)
-LTLIBRARY_SHARED_NAME = fbsql.la
-LTLIBRARY_SHARED_LIBADD = $(FBSQL_SHARED_LIBADD)
-
-SUBDIRS = $(FBSQL_SUBDIRS)
-
-include $(top_srcdir)/build/dynlib.mk
diff --git a/ext/fbsql/Readme_w32.txt b/ext/fbsql/Readme_w32.txt
deleted file mode 100644
index af8bfdc1e9..0000000000
--- a/ext/fbsql/Readme_w32.txt
+++ /dev/null
@@ -1,22 +0,0 @@
-Rules for building FBSQL
-------------------------
-
-The fbsql project contains 2 configurations.
-
-To build this extension you must first download and
-install FrontBase. The default instalation path would
-be c:\usr\FrontBase. If you install it in another location
-you need to change the include path in the project before
-compiling.
-
-Start Visual Studio, load php_modules.dsw, select the fbsql projects,
-configuration and build it.
-
-Finaly copy php_fbsql.dll to your extension directory and enable it
-by adding the following line tp php.ini
-
-extension=php_fbsql.dll
-
-or by calling dl() in each script
-
-dl("php_fbsql.dll"); \ No newline at end of file
diff --git a/ext/fbsql/config.m4 b/ext/fbsql/config.m4
deleted file mode 100644
index a683dbc001..0000000000
--- a/ext/fbsql/config.m4
+++ /dev/null
@@ -1,41 +0,0 @@
-dnl $Id$
-
-PHP_ARG_WITH(fbsql, for FrontBase SQL92 (fbsql) support,
-[ --with-fbsql[=DIR] Include FrontBase support. DIR is the FrontBase base
- directory.])
-
-if test "$PHP_FBSQL" != "no"; then
-
- AC_DEFINE(HAVE_FBSQL, 1, [Whether you have FrontBase])
- PHP_EXTENSION(fbsql,$ext_shared)
-
- FBSQL_INSTALLATION_DIR=""
- if test "$PHP_FBSQL" = "yes"; then
-
- for i in /Local/Library /usr /usr/local /opt /Library; do
- if test -f $i/FrontBase/include/FBCAccess/FBCAccess.h; then
- FBSQL_INSTALLATION_DIR=$i/FrontBase
- break
- fi
- done
-
- if test -z "$FBSQL_INSTALLATION_DIR"; then
- AC_MSG_ERROR(Cannot find FrontBase in well know installation directories)
- fi
-
- elif test "$PHP_FBSQL" != "no"; then
-
- if test -f $PHP_FBSQL/include/FBCAccess/FBCAccess.h; then
- FBSQL_INSTALLATION_DIR=$PHP_FBSQL
- else
- AC_MSG_ERROR(Directory $PHP_FBSQL is not a FrontBase installation directory)
- fi
- fi
-
- if test -z "$FBSQL_INSTALLATION_DIR/lib/libFBCAccess.a"; then
- AC_MSG_ERROR(Could not find $FBSQL_INSTALLATION_DIR/lib/libFBCAccess.a)
- fi
-
- PHP_ADD_LIBRARY_WITH_PATH(FBCAccess, $FBSQL_INSTALLATION_DIR/lib, $FBSQL_INSTALLATION_DIR/lib)
- PHP_ADD_INCLUDE($FBSQL_INSTALLATION_DIR/include)
-fi
diff --git a/ext/fbsql/fbsql.dsp b/ext/fbsql/fbsql.dsp
deleted file mode 100644
index d59b67f584..0000000000
--- a/ext/fbsql/fbsql.dsp
+++ /dev/null
@@ -1,171 +0,0 @@
-# Microsoft Developer Studio Project File - Name="fbsql" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=fbsql - Win32 Debug_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "fbsql.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "fbsql.mak" CFG="fbsql - Win32 Debug_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "fbsql - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "fbsql - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "fbsql - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "fbsql - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "fbsql - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "FBSQL_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D "NDEBUG" /D "FBSQL_EXPORTS" /D "COMPILE_DL_FBSQL_FBSQL" /D HAVE_FBSQL=1 /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZEND_WIN32" /D "PHP_WIN32" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "NDEBUG"
-# ADD RSC /l 0x40d /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4nts.lib /nologo /dll /machine:I386 /out:"Release/php_fbsql.dll" /libpath:"..\..\Release"
-
-!ELSEIF "$(CFG)" == "fbsql - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "FBSQL_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D "_DEBUG" /D ZEND_DEBUG=1 /D "FBSQL_EXPORTS" /D "COMPILE_DL_FBSQL_FBSQL" /D HAVE_FBSQL=1 /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZEND_WIN32" /D "PHP_WIN32" /FR /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "_DEBUG"
-# ADD RSC /l 0x40d /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4nts_debug.lib /nologo /dll /debug /machine:I386 /out:"Debug/php_fbsql.dll" /pdbtype:sept /libpath:"..\..\Debug"
-
-!ELSEIF "$(CFG)" == "fbsql - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\..\Zend" /I "..\..\..\bindlib_w32" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "FBSQL_EXPORTS" /D "COMPILE_DL_FBSQL" /D HAVE_FBSQL=1 /FR /YX /FD /GZ /c
-# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /I "\usr\FrontBase\Include" /D "_DEBUG" /D ZEND_DEBUG=1 /D "ZTS" /D "FBSQL_EXPORTS" /D "COMPILE_DL_FBSQL" /D HAVE_FBSQL=1 /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZEND_WIN32" /D "PHP_WIN32" /FR /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "_DEBUG"
-# ADD RSC /l 0x40d /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib php4ts_debug.lib FBCAccess.lib /nologo /dll /debug /machine:I386 /nodefaultlib:"LIBC" /out:"..\..\Debug_TS/php_fbsql.dll" /pdbtype:sept /libpath:"..\..\Debug_TS" /libpath:"\usr\FrontBase\lib"
-
-!ELSEIF "$(CFG)" == "fbsql - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\..\Zend" /I "..\..\..\bindlib_w32" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "FBSQL_EXPORTS" /D "COMPILE_DL_FBSQL" /D HAVE_FBSQL=1 /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /I "\usr\FrontBase\Include" /D "NDEBUG" /D "ZTS" /D ZEND_DEBUG=0 /D "FBSQL_EXPORTS" /D "COMPILE_DL_FBSQL" /D HAVE_FBSQL=1 /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZEND_WIN32" /D "PHP_WIN32" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "NDEBUG"
-# ADD RSC /l 0x40d /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib FBCAccess.lib wsock32.lib /nologo /dll /machine:I386 /nodefaultlib:"LIBC" /out:"..\..\Release_TS/php_fbsql.dll" /libpath:"..\..\Release_TS" /libpath:"\usr\FrontBase\lib" /libpath:"..\..\Release_TS_inline"
-
-!ENDIF
-
-# Begin Target
-
-# Name "fbsql - Win32 Release"
-# Name "fbsql - Win32 Debug"
-# Name "fbsql - Win32 Debug_TS"
-# Name "fbsql - Win32 Release_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\php_fbsql.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_fbsql.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# Begin Source File
-
-SOURCE=.\Readme_w32.txt
-# End Source File
-# End Target
-# End Project
diff --git a/ext/fbsql/php_fbsql.c b/ext/fbsql/php_fbsql.c
deleted file mode 100644
index 5ab59cbc90..0000000000
--- a/ext/fbsql/php_fbsql.c
+++ /dev/null
@@ -1,3032 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http:/*www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Frank M. Kromann frank@frontbase.com> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-/* TODO:
- *
- * ? Safe mode implementation
- */
-
-/* SB's list:
- - BLOBs
- - API for a more natural FB connect semantic
- - Connect & set session
- - Autoreconnect when disconnected
- - Comments and cleanup
- - Documentation
-
- - Format database error messages as HTML.
-
- BUGS
- - Select db with no arguments
- - Query with everything defaulted
-*/
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "php_globals.h"
-#include "php_globals.h"
-#include "ext/standard/info.h"
-#include "ext/standard/php_string.h"
-
-#if WIN32|WINNT
-#include <winsock.h>
-#else
-#include <php_config.h>
-#include <build-defs.h>
-
-#if HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-#include <netdb.h>
-#include <netinet/in.h>
-#endif
-
-#include "php_ini.h"
-
-#define HAVE_FBSQL 1
-
-#if HAVE_FBSQL
-#include "php_fbsql.h"
-#include <signal.h>
-
-static int le_result, le_link, le_plink;
-
-struct PHPFBResult;
-typedef struct PHPFBResult PHPFBResult;
-
-struct PHPFBLink;
-typedef struct PHPFBLink PHPFBLink;
-
-/* The PHPFBLink structure represents a fbsql link. The lion is used for
- a connection to a machine, it may be persistant and is reference counted.
- The reason for refcounting is mostly to avoid to think, it work independent of
- any wierd and unforseen allocation deallocation order.
-
- The PHPFBDatabse structure implements to actual connection to a FrontBase server
- ot may be persistant is the link it is connected to is persistant, and refcounted
- for the same reasons as above.
-
- The PHPFBResult structure implements a result from the FrontBase server, and does all
- required buffereing from of results.
-
- In the PHP code the 3 above a data structures are referenced by means of integers in the
- range from 1 to som configurable maximum. You can put a limit to the number of links, databases
- and results. The integer identifications is implemented by insertion in the list, which is passed
- as an argument to all the functions, please note the list is polymorph.
-
- Database objects and link objects are all reused, base on the host name user name, host name database name
- user name. So connecting twice to the same database as the same user will return the same database id.
- We use the same coding for that as fbsql does, explioiting the underlying implementation of the lists.
-
- Persistant objects are put in the persistent list as well, but only by name, if you connect to a persistant object
- and it is not in the list it is simply added and get a new index, and refcounted. Tricky, tricky ...
-*/
-
-/* Some functions which should be exported from FBCAccess */
-
-void* fbaObjectAtIndex();
-void fbcInitialize();
-void fbaRelease();
-unsigned int fbaCount();
-
-
-
-struct PHPFBResult
-{
- PHPFBLink* link; /* The link for the result, may be NULL if no link */
- char* fetchHandle; /* The fetch handle, the id used by the server. */
- FBCMetaData* metaData; /* The metadata describing the result */
- FBCMetaData* ResultmetaData; /* The metadata describing the result */
- FBCRowHandler* rowHandler; /* The row handler, the Frontbase structure used for accessing rows in the result */
- unsigned int batchSize; /* The number of row to fetch when expanding the number of rows in the row handler */
- int rowCount; /* The number of rows in the results set. The number of row is not in */
- /* general known when the select is done, one typically needs to fetch all the row
- to figure out how many row you got. When the rowCount is unknown the value is
- 0x7ffffffff */
- int columnCount; /* Number of columns in the row set. */
- int rowIndex; /* The current row index. */
- int columnIndex; /* The current column index */
- void** row; /* The last row accessed */
- FBArray* array; /* The link may return a result set, the database list, we implement that by the */
- /* FBArray, just a list of strings. */
- FBCPList* list; /* The same special kind result just for property list from extract, schema info. */
- unsigned int selectResults; /* number of results in select */
- unsigned int currentResult; /* current result number */
-};
-
-struct PHPFBLink
-{
- int persistant; /* persistant ? */
- char* hostName; /* Host name */
- char* userName; /* User name */
- char* userPassword; /* User password */
- char* databasePassword; /* Database password */
- char* databaseName; /* The name of the database */
- FBCExecHandler* execHandler; /* The exechandler, can be used for database operations */
- FBCDatabaseConnection* connection; /* The connection to the database */
- unsigned int affectedRows; /* Number of rows affected by the last SQL statement */
- long autoCommit; /* Enable or disable autoCommit */
- unsigned int errorNo; /* The latest error on the connection, 0 is ok. */
- char* errorText; /* The error text */
- unsigned int insert_id; /* The row index of the latest row inserted into the database */
-};
-
-#define FBSQL_ASSOC 1<<0
-#define FBSQL_NUM 1<<1
-#define FBSQL_BOTH (FBSQL_ASSOC|FBSQL_NUM)
-
-/* {{{ fbsql_functions[]
- */
-function_entry fbsql_functions[] = {
- PHP_FE(fbsql_connect, NULL)
- PHP_FE(fbsql_pconnect, NULL)
- PHP_FE(fbsql_close, NULL)
- PHP_FE(fbsql_select_db, NULL)
- PHP_FE(fbsql_create_db, NULL)
- PHP_FE(fbsql_drop_db, NULL)
- PHP_FE(fbsql_start_db, NULL)
- PHP_FE(fbsql_stop_db, NULL)
- PHP_FE(fbsql_db_status, NULL)
- PHP_FE(fbsql_query, NULL)
- PHP_FE(fbsql_db_query, NULL)
- PHP_FE(fbsql_list_dbs, NULL)
- PHP_FE(fbsql_list_tables, NULL)
- PHP_FE(fbsql_list_fields, NULL)
- PHP_FE(fbsql_error, NULL)
- PHP_FE(fbsql_errno, NULL)
- PHP_FE(fbsql_affected_rows, NULL)
- PHP_FE(fbsql_insert_id, NULL)
- PHP_FE(fbsql_result, NULL)
- PHP_FE(fbsql_next_result, NULL)
- PHP_FE(fbsql_num_rows, NULL)
- PHP_FE(fbsql_num_fields, NULL)
- PHP_FE(fbsql_fetch_row, NULL)
- PHP_FE(fbsql_fetch_array, NULL)
- PHP_FE(fbsql_fetch_assoc, NULL)
- PHP_FE(fbsql_fetch_object, NULL)
- PHP_FE(fbsql_data_seek, NULL)
- PHP_FE(fbsql_fetch_lengths, NULL)
- PHP_FE(fbsql_fetch_field, NULL)
- PHP_FE(fbsql_field_seek, NULL)
- PHP_FE(fbsql_free_result, NULL)
- PHP_FE(fbsql_field_name, NULL)
- PHP_FE(fbsql_field_table, NULL)
- PHP_FE(fbsql_field_len, NULL)
- PHP_FE(fbsql_field_type, NULL)
- PHP_FE(fbsql_field_flags, NULL)
-
-/* Fontbase additions: */
- PHP_FE(fbsql_autocommit, NULL)
- PHP_FE(fbsql_commit, NULL)
- PHP_FE(fbsql_rollback, NULL)
-
- PHP_FE(fbsql_hostname, NULL)
- PHP_FE(fbsql_database, NULL)
- PHP_FE(fbsql_database_password, NULL)
- PHP_FE(fbsql_username, NULL)
- PHP_FE(fbsql_password, NULL)
- PHP_FE(fbsql_warnings, NULL)
-
-/* Aliases: */
- PHP_FALIAS(fbsql, fbsql_db_query, NULL)
-
- {NULL, NULL, NULL}
-};
-/* }}} */
-
-zend_module_entry fbsql_module_entry = {
- "fbsql",
- fbsql_functions,
- PHP_MINIT(fbsql),
- PHP_MSHUTDOWN(fbsql),
- PHP_RINIT(fbsql),
- PHP_RSHUTDOWN(fbsql),
- PHP_MINFO(fbsql),
- STANDARD_MODULE_PROPERTIES
-};
-
-ZEND_DECLARE_MODULE_GLOBALS(fbsql)
-
-#ifdef COMPILE_DL_FBSQL
-ZEND_GET_MODULE(fbsql)
-#endif
-
-#define CHECK_LINK(link) { if (link==-1) { php_error(E_WARNING,"FrontBase: A link to the server could not be established"); RETURN_FALSE; } }
-
-static void phpfbReleaseResult (zend_rsrc_list_entry *rsrc);
-static void phpfbReleaseLink (zend_rsrc_list_entry *rsrc);
-static void phpfbReleasePLink (zend_rsrc_list_entry *rsrc);
-
-static void phpfbReleaseResult(zend_rsrc_list_entry *rsrc)
-{
- PHPFBResult* result = (PHPFBResult *)rsrc->ptr;
- FBSQLLS_FETCH();
- if (result)
- {
- if (result->fetchHandle) {
- FBCMetaData *md = fbcdcCancelFetch(result->link->connection,result->fetchHandle);
- fbcmdRelease(md);
- }
- if (result->rowHandler) fbcrhRelease(result->rowHandler);
- if (result->ResultmetaData) fbcmdRelease(result->ResultmetaData);
- if (result->list) fbcplRelease(result->list);
- if (result->array) fbaRelease(result->array);
- efree(result);
- }
-}
-
-
-static void phpfbReleaseLink (zend_rsrc_list_entry *rsrc)
-{
- PHPFBLink* link = (PHPFBLink *)rsrc->ptr;
- FBSQLLS_FETCH();
- if (link)
- {
- if (link->hostName) free(link->hostName);
- if (link->userName) free(link->userName);
- if (link->userPassword) free(link->userPassword);
- if (link->databasePassword) free(link->databasePassword);
- if (link->databaseName) free(link->databaseName);
- if (link->errorText) free(link->errorText);
- if (link->connection) {
- fbcdcClose(link->connection);
- fbcdcRelease(link->connection);
- }
- if (link->execHandler) fbcehRelease(link->execHandler);
- efree(link);
- FB_SQL_G(linkCount)--;
- }
-}
-
-static void phpfbReleasePLink (zend_rsrc_list_entry *rsrc)
-{
- PHPFBLink* link = (PHPFBLink *)rsrc->ptr;
- FBSQLLS_FETCH();
- if (link)
- {
- if (link->hostName) free(link->hostName);
- if (link->userName) free(link->userName);
- if (link->userPassword) free(link->userPassword);
- if (link->databasePassword) free(link->databasePassword);
- if (link->databaseName) free(link->databaseName);
- if (link->errorText) free(link->errorText);
- if (link->connection) {
- fbcdcClose(link->connection);
- fbcdcRelease(link->connection);
- }
- if (link->execHandler) fbcehRelease(link->execHandler);
- free(link);
- FB_SQL_G(linkCount)--;
- FB_SQL_G(persistantCount)--;
- }
-}
-
-static void php_fbsql_set_default_link(int id)
-{
- FBSQLLS_FETCH();
-
- if (FB_SQL_G(linkIndex)!=-1) {
- zend_list_delete(FB_SQL_G(linkIndex));
- }
- FB_SQL_G(linkIndex) = id;
- zend_list_addref(id);
-}
-
-static int php_fbsql_get_default_link(INTERNAL_FUNCTION_PARAMETERS FBSQLLS_DC)
-{
- if (FB_SQL_G(linkIndex)==-1) { /* no link opened yet, implicitly open one */
- ht = 0;
- php_fbsql_do_connect(INTERNAL_FUNCTION_PARAM_PASSTHRU,0);
- }
- return FB_SQL_G(linkIndex);
-}
-
-
-static void phpfbQuery(INTERNAL_FUNCTION_PARAMETERS, char* sql, PHPFBLink* link);
-
-/* {{{ PHP_INI
- */
-PHP_INI_BEGIN()
- STD_PHP_INI_BOOLEAN ("fbsql.allow_persistant", "1", PHP_INI_SYSTEM, OnUpdateInt, allowPersistent, zend_fbsql_globals, fbsql_globals)
- STD_PHP_INI_BOOLEAN ("fbsql.generate_warnings", "0", PHP_INI_SYSTEM, OnUpdateInt, generateWarnings, zend_fbsql_globals, fbsql_globals)
- STD_PHP_INI_BOOLEAN ("fbsql.autocommit", "1", PHP_INI_SYSTEM, OnUpdateInt, autoCommit, zend_fbsql_globals, fbsql_globals)
- STD_PHP_INI_ENTRY_EX ("fbsql.max_persistent", "-1", PHP_INI_SYSTEM, OnUpdateInt, maxPersistant, zend_fbsql_globals, fbsql_globals, display_link_numbers)
- STD_PHP_INI_ENTRY_EX ("fbsql.max_links", "128", PHP_INI_SYSTEM, OnUpdateInt, maxLinks, zend_fbsql_globals, fbsql_globals, display_link_numbers)
- STD_PHP_INI_ENTRY_EX ("fbsql.max_connections", "128", PHP_INI_SYSTEM, OnUpdateInt, maxConnections, zend_fbsql_globals, fbsql_globals, display_link_numbers)
- STD_PHP_INI_ENTRY_EX ("fbsql.max_results", "128", PHP_INI_SYSTEM, OnUpdateInt, maxResults, zend_fbsql_globals, fbsql_globals, display_link_numbers)
- STD_PHP_INI_ENTRY_EX ("fbsql.mbatchSize", "1000", PHP_INI_SYSTEM, OnUpdateInt, batchSize, zend_fbsql_globals, fbsql_globals, display_link_numbers)
- STD_PHP_INI_ENTRY ("fbsql.default_host", NULL, PHP_INI_SYSTEM, OnUpdateString, hostName, zend_fbsql_globals, fbsql_globals)
- STD_PHP_INI_ENTRY ("fbsql.default_user", "_SYSTEM", PHP_INI_SYSTEM, OnUpdateString, userName, zend_fbsql_globals, fbsql_globals)
- STD_PHP_INI_ENTRY ("fbsql.default_password", "", PHP_INI_SYSTEM, OnUpdateString, userPassword, zend_fbsql_globals, fbsql_globals)
- STD_PHP_INI_ENTRY ("fbsql.default_database", "", PHP_INI_SYSTEM, OnUpdateString, databaseName, zend_fbsql_globals, fbsql_globals)
- STD_PHP_INI_ENTRY ("fbsql.default_database_password", "", PHP_INI_SYSTEM, OnUpdateString, databasePassword, zend_fbsql_globals, fbsql_globals)
-PHP_INI_END()
-/* }}} */
-
-static void php_fbsql_init_globals(zend_fbsql_globals *fbsql_globals)
-{
- fbsql_globals->persistantCount = 0;
-
- if (fbsql_globals->hostName==NULL)
- {
- char name[256];
- gethostname(name,sizeof(name));
- name[sizeof(name)-1] = 0;
- fbsql_globals->hostName = estrdup(name);
- }
-
- fbsql_globals->persistantCount = 0;
- fbsql_globals->linkCount = 0;
-}
-
-PHP_MINIT_FUNCTION(fbsql)
-{
- ZEND_INIT_MODULE_GLOBALS(fbsql, php_fbsql_init_globals, NULL);
-
- REGISTER_INI_ENTRIES();
-
- fbcInitialize();
-
- le_result = zend_register_list_destructors_ex(phpfbReleaseResult, NULL, "fbsql result", module_number);
- le_link = zend_register_list_destructors_ex(phpfbReleaseLink, NULL, "fbsql link", module_number);
- le_plink = zend_register_list_destructors_ex(NULL, phpfbReleasePLink, "fbsql plink", module_number);
- fbsql_module_entry.type = type;
-
- REGISTER_LONG_CONSTANT("FBSQL_ASSOC", FBSQL_ASSOC, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FBSQL_NUM", FBSQL_NUM, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FBSQL_BOTH", FBSQL_BOTH, CONST_CS | CONST_PERSISTENT);
- return SUCCESS;
-}
-
-PHP_MSHUTDOWN_FUNCTION(fbsql)
-{
- UNREGISTER_INI_ENTRIES();
- return SUCCESS;
-}
-
-PHP_RINIT_FUNCTION(fbsql)
-{
- FBSQLLS_FETCH();
-
- FB_SQL_G(linkIndex) = -1;
- FB_SQL_G(linkCount) = FB_SQL_G(persistantCount);
- return SUCCESS;
-}
-
-PHP_RSHUTDOWN_FUNCTION(fbsql)
-{
- return SUCCESS;
-}
-
-PHP_MINFO_FUNCTION(fbsql)
-{
- char buf[32];
- FBSQLLS_FETCH();
- php_info_print_table_start();
- php_info_print_table_header(2, "FrontBase support", "enabled");
-
- php_info_print_table_row(2, "Client API version", "2.24");
-
- if (FB_SQL_G(allowPersistent))
- {
- sprintf(buf, "%ld", FB_SQL_G(persistantCount));
- php_info_print_table_row(2, "Active Persistant Links", buf);
- }
-
- sprintf(buf, "%ld", FB_SQL_G(linkCount));
- php_info_print_table_row(2, "Active Links", buf);
-
-/*
- sprintf(buf, "%ld", FB_SQL_G(resultCount));
- php_info_print_table_row(2, "Active Links", buf);
-*/
-
- php_info_print_table_end();
-
- DISPLAY_INI_ENTRIES();
-}
-
-/* {{{ php_fbsql_do_connect
- */
-static void php_fbsql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistant)
-{
- PHPFBLink* phpLink;
- list_entry *lep;
- char name[1024];
- char *hostName = NULL, *userName = NULL, *userPassword = NULL;
- int argc = ZEND_NUM_ARGS(), create_new = 0;
- zval **argv[3];
- FBSQLLS_FETCH();
-
-
- if ((argc < 0) || (argc > 3)) WRONG_PARAM_COUNT;
- if (zend_get_parameters_ex(argc,&argv[0],&argv[1],&argv[2])==FAILURE) RETURN_FALSE;
- if (argc >= 1)
- {
- convert_to_string_ex(argv[0]);
- hostName = (*argv[0])->value.str.val;
- }
- if (argc >= 2)
- {
- convert_to_string_ex(argv[1]);
- userName = (*argv[1])->value.str.val;
- }
- if (argc == 3)
- {
- convert_to_string_ex(argv[2]);
- userPassword = (*argv[2])->value.str.val;
- }
-
- if (hostName == NULL) hostName = FB_SQL_G(hostName);
- if (userName == NULL) userName = FB_SQL_G(userName);
- if (userPassword == NULL) userPassword = FB_SQL_G(userPassword);
-
- sprintf(name,"fbsql_%s_%s_%s", hostName, userName, userPassword);
-
- if (!FB_SQL_G(allowPersistent)) {
- persistant=0;
- }
- if (persistant) {
- if (zend_hash_find(&EG(persistent_list), name, strlen(name) + 1, (void **)&lep) == SUCCESS)
- {
- phpLink = (PHPFBLink*)lep->ptr;
- }
- else {
- list_entry le;
-
- if ((FB_SQL_G(maxLinks) != -1 && FB_SQL_G(linkCount) == FB_SQL_G(maxLinks)))
- {
- php_error(E_WARNING,"FrontBase link limit %d exceeded ", FB_SQL_G(maxLinks));
- RETURN_FALSE;
- }
-
- if ((FB_SQL_G(maxPersistant) != -1 && FB_SQL_G(persistantCount) == FB_SQL_G(maxPersistant)))
- {
- php_error(E_WARNING,"FrontBase persistant link limit %d exceeded ", FB_SQL_G(maxPersistant));
- RETURN_FALSE;
- }
-
- phpLink = malloc(sizeof(PHPFBLink));
- phpLink->persistant = persistant;
- phpLink->hostName = strdup(hostName);
- phpLink->userName = strdup(userName);
- phpLink->userPassword = strdup(userPassword);
- phpLink->databasePassword = strdup(FB_SQL_G(databasePassword));
- phpLink->databaseName = NULL;
- phpLink->execHandler = fbcehHandlerForHost(hostName,128);
- phpLink->affectedRows = 0;
- phpLink->autoCommit = FB_SQL_G(autoCommit);
- phpLink->errorNo = 0;
- phpLink->errorText = NULL;
- phpLink->connection = NULL;
-
-
- le.ptr = phpLink;
- le.type = le_plink;
- if (zend_hash_update(&EG(persistent_list), name, strlen(name) + 1, &le, sizeof(le), NULL)==FAILURE)
- {
- free(phpLink->hostName);
- free(phpLink->userName);
- free(phpLink->userPassword);
- free(phpLink->databasePassword);
- free(phpLink);
- RETURN_FALSE;
- }
- FB_SQL_G(linkCount)++;
- FB_SQL_G(persistantCount)++;
- }
- ZEND_REGISTER_RESOURCE(return_value, phpLink, le_plink);
- }
- else
- {
- list_entry le;
-
- if ((FB_SQL_G(maxLinks) != -1 && FB_SQL_G(linkCount) == FB_SQL_G(maxLinks)))
- {
- php_error(E_WARNING,"FrontBase link limit %d exceeded ", FB_SQL_G(maxLinks));
- RETURN_FALSE;
- }
-
- if (zend_hash_find(&EG(regular_list), name, strlen(name) + 1, (void **)&lep) == SUCCESS)
- {
- int type, link;
- void *ptr;
-
- link = (int) lep->ptr;
- ptr = zend_list_find(link,&type); /* check if the link is still there */
- if (ptr && (type==le_link || type==le_plink)) {
- zend_list_addref(link);
- return_value->value.lval = link;
- php_fbsql_set_default_link(link);
- return_value->type = IS_RESOURCE;
- return;
- } else {
- zend_hash_del(&EG(regular_list), name, strlen(name) + 1);
- }
- phpLink = (PHPFBLink*)lep->ptr;
- }
-
- phpLink = emalloc(sizeof(PHPFBLink));
- phpLink->persistant = persistant;
- phpLink->hostName = strdup(hostName);
- phpLink->userName = strdup(userName);
- phpLink->userPassword = strdup(userPassword);
- phpLink->databasePassword = strdup(FB_SQL_G(databasePassword));
- phpLink->databaseName = NULL;
- phpLink->execHandler = fbcehHandlerForHost(hostName,128);
- phpLink->affectedRows = 0;
- phpLink->autoCommit = FB_SQL_G(autoCommit);
- phpLink->errorNo = 0;
- phpLink->errorText = NULL;
- phpLink->connection = NULL;
-
- ZEND_REGISTER_RESOURCE(return_value, phpLink, le_link);
-
- le.ptr = (void *)return_value->value.lval;
- le.type = le_index_ptr;
- if (zend_hash_update(&EG(regular_list), name, strlen(name) + 1, &le, sizeof(le), NULL)==FAILURE)
- {
- free(phpLink->hostName);
- free(phpLink->userName);
- free(phpLink->userPassword);
- free(phpLink->databasePassword);
- efree(phpLink);
- RETURN_FALSE;
- }
- FB_SQL_G(linkCount)++;
- }
- php_fbsql_set_default_link(return_value->value.lval);
-}
-/* }}} */
-
-int phpfbFetchRow(PHPFBResult* result, int row)
-{
- if (result->rowHandler == NULL)
- {
- void *rawData = fbcdcFetch(result->link->connection, result->batchSize, result->fetchHandle);
- if (rawData == NULL)
- result->rowCount = 0;
- else
- result->rowHandler = fbcrhInitWith(rawData, result->metaData);
- }
- for (;;)
- {
- void *rawData;
- if (row >= result->rowCount) return 0;
- if (fbcrhRowCount(result->rowHandler) > (unsigned int)row) return 1;
- rawData = fbcdcFetch(result->link->connection, result->batchSize, result->fetchHandle);
- if (!fbcrhAddBatch(result->rowHandler,rawData)) result->rowCount = fbcrhRowCount(result->rowHandler);
- }
- return 0;
-}
-
-
-/* {{{ proto resource fbsql_connect([string hostname [, string username [, string password]]]);
- */
-PHP_FUNCTION(fbsql_connect)
-{
- php_fbsql_do_connect(INTERNAL_FUNCTION_PARAM_PASSTHRU,0);
-}
-/* }}} */
-
-/* {{{ proto resource fbsql_pconnect([string hostname [, string username [, string password]]]);
- */
-PHP_FUNCTION(fbsql_pconnect)
-{
- php_fbsql_do_connect(INTERNAL_FUNCTION_PARAM_PASSTHRU,1);
-}
-/* }}} */
-
-/* {{{ proto int fbsql_close([resource link_identifier])
- */
-PHP_FUNCTION(fbsql_close)
-{
- PHPFBLink* phpLink = NULL;
- zval **fbsql_link_index = NULL;
- int id;
- FBSQLLS_FETCH();
-
- switch (ZEND_NUM_ARGS()) {
- case 0:
- id = php_fbsql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU FBSQLLS_CC);
- CHECK_LINK(id);
- break;
- case 1:
- if (zend_get_parameters_ex(1, &fbsql_link_index)==FAILURE) {
- RETURN_FALSE;
- }
- id = -1;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- ZEND_FETCH_RESOURCE2(phpLink, PHPFBLink *, fbsql_link_index, id, "FrontBase-Link", le_link, le_plink);
-
- if (id==-1) { /* explicit resource number */
- zend_list_delete(Z_RESVAL_PP(fbsql_link_index));
- }
-
- if (id!=-1
- || (fbsql_link_index && Z_RESVAL_PP(fbsql_link_index)==FB_SQL_G(linkIndex))) {
- zend_list_delete(FB_SQL_G(linkIndex));
- FB_SQL_G(linkIndex) = -1;
- }
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ php_fbsql_select_db
- */
-static int php_fbsql_select_db(char *databaseName, PHPFBLink *link)
-{
- unsigned port;
- FBCDatabaseConnection* c;
- FBCMetaData* md;
- FBSQLLS_FETCH();
-
- if (!link->databaseName || strcmp(link->databaseName, databaseName))
- {
- port = atoi(databaseName);
- if (port>0 && port<65535)
- c = fbcdcConnectToDatabaseUsingPort(link->hostName, port, link->databasePassword);
- else
- c = fbcdcConnectToDatabase(databaseName, link->hostName, link->databasePassword);
- if (c == NULL)
- {
- php_error(E_WARNING, fbcdcClassErrorMessage());
- return 0;
- }
- md = fbcdcCreateSession(c,"PHP",link->userName, link->userPassword, link->userName);
- if (fbcmdErrorsFound(md))
- {
- FBCErrorMetaData* emd = fbcdcErrorMetaData(c,md);
- char* emg = fbcemdAllErrorMessages(emd);
- if (emg)
- php_error(E_WARNING, emg);
- else
- php_error(E_WARNING,"No message");
- free(emg);
- fbcemdRelease(emd);
- fbcmdRelease(md);
- fbcdcClose(c);
- fbcdcRelease(c);
- return 0;
- }
- fbcmdRelease(md);
-
- if (c)
- {
- if (link->autoCommit)
- md = fbcdcExecuteDirectSQL(c,"SET COMMIT TRUE;");
- else
- md = fbcdcExecuteDirectSQL(c,"SET COMMIT FALSE;");
- fbcmdRelease(md);
- }
- fbcdcSetOutputCharacterSet(c,FBC_ISO8859_1);
- fbcdcSetInputCharacterSet(c,FBC_ISO8859_1);
-
- if (link->connection)
- {
- fbcdcClose(link->connection);
- fbcdcRelease(link->connection);
- }
- link->connection = c;
- if (link->databaseName) free(link->databaseName);
- link->databaseName = strdup(databaseName);
- }
- return 1;
-}
-/* }}} */
-
-/* {{{ phpfbestrdup
- */
-void phpfbestrdup(const char * s, int* length, char** value)
-{
- int l = s?strlen(s):0;
- if (value)
- {
- char* r = emalloc(l+1);
- if (s)
- strcpy(r,s);
- else
- r[0] = 0;
- *value = r;
- }
- *length = l;
-}
-/* }}} */
-
-/* {{{ proto bool fbsql_autocommit(resource link_identifier [, bool OnOff])
- Turn on auto-commit */
-PHP_FUNCTION(fbsql_autocommit)
-{
- PHPFBLink* phpLink = NULL;
- FBCMetaData* md;
- zval **fbsql_link_index = NULL, **onoff = NULL;
- zend_bool OnOff;
- FBSQLLS_FETCH();
-
- switch (ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &fbsql_link_index)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- case 2:
- if (zend_get_parameters_ex(2, &fbsql_link_index, &onoff)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- ZEND_FETCH_RESOURCE2(phpLink, PHPFBLink *, fbsql_link_index, -1, "FrontBase-Link", le_link, le_plink);
-
- if (onoff)
- {
- convert_to_boolean_ex(onoff);
- OnOff = Z_BVAL_PP(onoff);
- phpLink->autoCommit = OnOff;
- if (OnOff)
- md = fbcdcExecuteDirectSQL(phpLink->connection, "SET COMMIT TRUE;");
- else
- md = fbcdcExecuteDirectSQL(phpLink->connection, "SET COMMIT FALSE;");
- fbcmdRelease(md);
- }
- RETURN_BOOL(phpLink->autoCommit);
-}
-/* }}} */
-
-/* {{{ proto int fbsql_commit([resource link_identifier])
- */
-PHP_FUNCTION(fbsql_commit)
-{
- PHPFBLink* phpLink = NULL;
- FBCMetaData* md;
- zval **fbsql_link_index = NULL;
- int id;
- FBSQLLS_FETCH();
-
- switch (ZEND_NUM_ARGS()) {
- case 0:
- id = php_fbsql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU FBSQLLS_CC);
- CHECK_LINK(id);
- break;
- case 1:
- if (zend_get_parameters_ex(1, &fbsql_link_index)==FAILURE) {
- RETURN_FALSE;
- }
- id = -1;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- ZEND_FETCH_RESOURCE2(phpLink, PHPFBLink *, fbsql_link_index, id, "FrontBase-Link", le_link, le_plink);
-
- md = fbcdcCommit(phpLink->connection);
-
- if (md) {
- fbcmdRelease(md);
- RETURN_TRUE;
- }
- else
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto int fbsql_rollback([resource link_identifier])
- */
-PHP_FUNCTION(fbsql_rollback)
-{
- PHPFBLink* phpLink = NULL;
- FBCMetaData* md;
- zval **fbsql_link_index = NULL;
- int id;
- FBSQLLS_FETCH();
-
- switch (ZEND_NUM_ARGS()) {
- case 0:
- id = php_fbsql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU FBSQLLS_CC);
- CHECK_LINK(id);
- break;
- case 1:
- if (zend_get_parameters_ex(1, &fbsql_link_index)==FAILURE) {
- RETURN_FALSE;
- }
- id = -1;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- ZEND_FETCH_RESOURCE2(phpLink, PHPFBLink *, fbsql_link_index, id, "FrontBase-Link", le_link, le_plink);
-
- md = fbcdcRollback(phpLink->connection);
-
- if (md) {
- fbcmdRelease(md);
- RETURN_TRUE;
- }
- else
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto string fbsql_hostname(resource link_identifier [, string host_name])
- */
-PHP_FUNCTION(fbsql_hostname)
-{
- PHPFBLink* phpLink = NULL;
- zval **fbsql_link_index = NULL, **host_name = NULL;
- FBSQLLS_FETCH();
-
- switch (ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &fbsql_link_index)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- case 2:
- if (zend_get_parameters_ex(2, &fbsql_link_index, &host_name)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- ZEND_FETCH_RESOURCE2(phpLink, PHPFBLink *, fbsql_link_index, -1, "FrontBase-Link", le_link, le_plink);
-
- if (host_name)
- {
- convert_to_string_ex(host_name);
- if (phpLink->hostName) free(phpLink->hostName);
- phpLink->hostName = strdup(Z_STRVAL_PP(host_name));
- }
- RETURN_STRING(phpLink->hostName, 1);
-}
-/* }}} */
-
-/* {{{ proto string fbsql_database(resource link_identifier [, string database])
- */
-PHP_FUNCTION(fbsql_database)
-{
- PHPFBLink* phpLink = NULL;
- zval **fbsql_link_index = NULL, **dbname = NULL;
- FBSQLLS_FETCH();
-
- switch (ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &fbsql_link_index)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- case 2:
- if (zend_get_parameters_ex(2, &fbsql_link_index, &dbname)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- ZEND_FETCH_RESOURCE2(phpLink, PHPFBLink *, fbsql_link_index, -1, "FrontBase-Link", le_link, le_plink);
-
- if (dbname)
- {
- convert_to_string_ex(dbname);
- if (phpLink->databaseName) free(phpLink->databaseName);
- phpLink->databaseName = strdup(Z_STRVAL_PP(dbname));
- }
- RETURN_STRING(phpLink->databaseName, 1);
-}
-/* }}} */
-
-/* {{{ proto string fbsql_database_password(resource link_identifier [, string database_password])
- */
-PHP_FUNCTION(fbsql_database_password)
-{
- PHPFBLink* phpLink = NULL;
- zval **fbsql_link_index = NULL, **db_password = NULL;
- FBSQLLS_FETCH();
-
- switch (ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &fbsql_link_index)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- case 2:
- if (zend_get_parameters_ex(2, &fbsql_link_index, &db_password)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- ZEND_FETCH_RESOURCE2(phpLink, PHPFBLink *, fbsql_link_index, -1, "FrontBase-Link", le_link, le_plink);
-
- if (db_password)
- {
- convert_to_string_ex(db_password);
- if (phpLink->databasePassword) free(phpLink->databasePassword);
- phpLink->databasePassword = strdup(Z_STRVAL_PP(db_password));
- }
- RETURN_STRING(phpLink->databasePassword, 1);
-}
-/* }}} */
-
-/* {{{ proto string fbsql_username(resource link_identifier [, string username])
- */
-PHP_FUNCTION(fbsql_username)
-{
- PHPFBLink* phpLink = NULL;
- zval **fbsql_link_index = NULL, **username = NULL;
- FBSQLLS_FETCH();
-
- switch (ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &fbsql_link_index)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- case 2:
- if (zend_get_parameters_ex(2, &fbsql_link_index, &username)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- ZEND_FETCH_RESOURCE2(phpLink, PHPFBLink *, fbsql_link_index, -1, "FrontBase-Link", le_link, le_plink);
-
- if (username)
- {
- convert_to_string_ex(username);
- if (phpLink->userName) free(phpLink->userName);
- phpLink->userName = strdup(Z_STRVAL_PP(username));
- }
- RETURN_STRING(phpLink->userName, 1);
-}
-/* }}} */
-
-/* {{{ proto string fbsql_password(resource link_identifier [, string password])
- */
-PHP_FUNCTION(fbsql_password)
-{
- PHPFBLink* phpLink = NULL;
- zval **fbsql_link_index = NULL, **password = NULL;
- FBSQLLS_FETCH();
-
- switch (ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &fbsql_link_index)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- case 2:
- if (zend_get_parameters_ex(2, &fbsql_link_index, &password)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- ZEND_FETCH_RESOURCE2(phpLink, PHPFBLink *, fbsql_link_index, -1, "FrontBase-Link", le_link, le_plink);
-
- if (password)
- {
- convert_to_string_ex(password);
- if (phpLink->userPassword) free(phpLink->userPassword);
- phpLink->userPassword = strdup(Z_STRVAL_PP(password));
- }
- RETURN_STRING(phpLink->userPassword, 1);
-}
-/* }}} */
-
-/* {{{ proto bool fbsql_select_db([string database_name [, resource link_identifier]])
- */
-PHP_FUNCTION(fbsql_select_db)
-{
- PHPFBLink* phpLink = NULL;
- zval **fbsql_link_index = NULL, **dbname;
- int id;
- char* name = NULL;
- FBSQLLS_FETCH();
-
- switch (ZEND_NUM_ARGS()) {
- case 0:
- name = FB_SQL_G(databaseName);
- id = php_fbsql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU FBSQLLS_CC);
- CHECK_LINK(id);
- break;
- case 1:
- id = php_fbsql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU FBSQLLS_CC);
- CHECK_LINK(id);
- if (zend_get_parameters_ex(1, &dbname)==FAILURE) {
- RETURN_FALSE;
- }
- convert_to_string_ex(dbname);
- name = (*dbname)->value.str.val;
- break;
- case 2:
- if (zend_get_parameters_ex(2, &dbname, &fbsql_link_index)==FAILURE) {
- RETURN_FALSE;
- }
- convert_to_string_ex(dbname);
- name = (*dbname)->value.str.val;
- id = -1;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- ZEND_FETCH_RESOURCE2(phpLink, PHPFBLink *, fbsql_link_index, id, "FrontBase-Link", le_link, le_plink);
-
- if (phpLink->execHandler == NULL)
- {
- int port = atoi(name);
- if (port == 0 || port > 64535) {
- php_error(E_WARNING,"Cannot connect to FBExec for database '%s'",name);
- php_error(E_WARNING,fbcehClassErrorMessage());
- RETURN_FALSE;
- }
- }
-
- if (!php_fbsql_select_db(name, phpLink)) RETURN_FALSE;
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int fbsql_change_user(string user, string password [, string database [, resource link_identifier]]);
- */
-PHP_FUNCTION(fbsql_change_user)
-{
- PHPFBLink* phpLink = NULL;
- zval **fbsql_link_index = NULL, **user, **password, **database;
- int id;
- char *name = NULL, *userName, *userPassword;
- char buffer[1024];
- FBSQLLS_FETCH();
-
- switch (ZEND_NUM_ARGS()) {
- case 2:
- name = FB_SQL_G(databaseName);
- id = php_fbsql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU FBSQLLS_CC);
- CHECK_LINK(id);
- if (zend_get_parameters_ex(2, &user, &password)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- case 3:
- id = php_fbsql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU FBSQLLS_CC);
- CHECK_LINK(id);
- if (zend_get_parameters_ex(3, &user, &password, &database)==FAILURE) {
- RETURN_FALSE;
- }
- convert_to_string_ex(database);
- name = (*database)->value.str.val;
- break;
- case 4:
- if (zend_get_parameters_ex(4, &user, &password, &database, &fbsql_link_index)==FAILURE) {
- RETURN_FALSE;
- }
- convert_to_string_ex(database);
- name = (*database)->value.str.val;
- id = -1;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- ZEND_FETCH_RESOURCE2(phpLink, PHPFBLink *, fbsql_link_index, id, "FrontBase-Link", le_link, le_plink);
-
- convert_to_string_ex(user);
- userName = (*user)->value.str.val;
-
- convert_to_string_ex(password);
- userPassword = (*password)->value.str.val;
-
- sprintf(buffer,"SET AUTHORIZATION %s;",userName);
-
- phpfbQuery(INTERNAL_FUNCTION_PARAM_PASSTHRU, buffer, phpLink);
- if (return_value->value.lval)
- {
- free(phpLink->userName);
- phpLink->userName = strdup(userName);
- }
-}
-/* }}} */
-
-/* {{{ proto bool fbsql_create_db(string database_name [, resource link_identifier])
- */
-PHP_FUNCTION(fbsql_create_db)
-{
- PHPFBLink* phpLink = NULL;
- zval **fbsql_link_index = NULL, **database_name;
- int id;
- int i, status;
- char *databaseName;
- FBSQLLS_FETCH();
-
- switch (ZEND_NUM_ARGS()) {
- case 1:
- id = php_fbsql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU FBSQLLS_CC);
- CHECK_LINK(id);
- if (zend_get_parameters_ex(1, &database_name)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- case 2:
- if (zend_get_parameters_ex(2, &database_name, &fbsql_link_index)==FAILURE) {
- RETURN_FALSE;
- }
- id = -1;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- ZEND_FETCH_RESOURCE2(phpLink, PHPFBLink *, fbsql_link_index, id, "FrontBase-Link", le_link, le_plink);
-
- convert_to_string_ex(database_name);
- databaseName = (*database_name)->value.str.val;
-
- status = fbcehStatusForDatabaseNamed(phpLink->execHandler, databaseName);
- if (status != FBUnknownStatus)
- {
- char* txt = "Unknown status";
- if (status == FBStopped ) txt = "stopped";
- else if (status == FBStarting) txt = "starting";
- else if (status == FBRunning ) txt = "running";
- else if (status == FBStopping) txt = "stopping";
- else if (status == FBNoExec ) txt = "no exec";
- php_error(E_WARNING, "Could not create %s@%s, database is %s",databaseName, phpLink->hostName,txt);
- RETURN_FALSE;
- }
- if (!fbcehCreateDatabaseNamedWithOptions(phpLink->execHandler, databaseName, ""))
- {
- char* error = fbechErrorMessage(phpLink->execHandler);
- php_error(E_WARNING, "Could not create %s@%s. %s.",databaseName,phpLink->hostName,error);
- RETURN_FALSE;
- }
- for (i=0; i < 20; i++)
- {
-#ifdef PHP_WIN32
- Sleep(1000);
-#else
- sleep(1);
-#endif
- status = fbcehStatusForDatabaseNamed(phpLink->execHandler,databaseName);
- if (status == FBRunning) break;
- }
- if (status != FBRunning)
- {
- php_error(E_WARNING, "Database %s@%s created -- status unknown",databaseName, phpLink->hostName);
- RETURN_FALSE;
- }
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int fbsql_drop_db(string database_name [, resource link_identifier])
- */
-PHP_FUNCTION(fbsql_drop_db)
-{
- PHPFBLink* phpLink = NULL;
- zval **fbsql_link_index = NULL, **database_name;
- int id;
- int i, status;
- char *databaseName;
- FBSQLLS_FETCH();
-
- switch (ZEND_NUM_ARGS()) {
- case 1:
- id = php_fbsql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU FBSQLLS_CC);
- CHECK_LINK(id);
- if (zend_get_parameters_ex(1, &database_name)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- case 2:
- if (zend_get_parameters_ex(2, &database_name, &fbsql_link_index)==FAILURE) {
- RETURN_FALSE;
- }
- id = -1;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- ZEND_FETCH_RESOURCE2(phpLink, PHPFBLink *, fbsql_link_index, id, "FrontBase-Link", le_link, le_plink);
-
- convert_to_string_ex(database_name);
- databaseName = (*database_name)->value.str.val;
-
- status = fbcehStatusForDatabaseNamed(phpLink->execHandler,databaseName);
- if (status != FBStopped)
- {
- char* txt = "Unknown status";
- if (status == FBStopped ) txt = "stopped";
- else if (status == FBUnknownStatus) txt = "nonexisting";
- else if (status == FBStarting ) txt = "starting";
- else if (status == FBRunning ) txt = "running";
- else if (status == FBStopping ) txt = "stopping";
- else if (status == FBNoExec ) txt = "no exec";
- php_error(E_WARNING, "Could not drop %s@%s, database is %s.",databaseName,phpLink->hostName,txt);
- RETURN_FALSE;
- }
-
- if (! fbcehDeleteDatabaseNamed (phpLink->execHandler, databaseName))
- {
- char* error = fbechErrorMessage(phpLink->execHandler);
- php_error(E_WARNING, "Could not drop %s@%s. %s.",databaseName,phpLink->hostName,error);
- RETURN_FALSE;
- }
- for (i=0; i < 20; i++)
- {
-#ifdef PHP_WIN32
- Sleep(1000);
-#else
- sleep(1);
-#endif
- status = fbcehStatusForDatabaseNamed(phpLink->execHandler,databaseName);
- if (status == FBUnknownStatus) break;
- }
- if (status != FBUnknownStatus)
- {
- php_error(E_WARNING, "Database %s@%s dropped -- status unknown",databaseName,phpLink->hostName);
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto int fbsql_start_db(string database_name [, resource link_identifier])
- */
-PHP_FUNCTION(fbsql_start_db)
-{
- PHPFBLink* phpLink = NULL;
- zval **fbsql_link_index = NULL, **database_name;
- int id;
- int i, status;
- char *databaseName;
- FBSQLLS_FETCH();
-
- switch (ZEND_NUM_ARGS()) {
- case 1:
- id = php_fbsql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU FBSQLLS_CC);
- CHECK_LINK(id);
- if (zend_get_parameters_ex(1, &database_name)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- case 2:
- if (zend_get_parameters_ex(2, &database_name, &fbsql_link_index)==FAILURE) {
- RETURN_FALSE;
- }
- id = -1;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- ZEND_FETCH_RESOURCE2(phpLink, PHPFBLink *, fbsql_link_index, id, "FrontBase-Link", le_link, le_plink);
-
- convert_to_string_ex(database_name);
- databaseName = (*database_name)->value.str.val;
-
- status = fbcehStatusForDatabaseNamed(phpLink->execHandler,databaseName);
- if ((status != FBStopped) && (status != FBRunning) && (status != FBStarting))
- {
- char* txt = "Unknown status";
- if (status == FBStopped ) txt = "stopped";
- else if (status == FBStarting) txt = "starting";
- else if (status == FBRunning ) txt = "running";
- else if (status == FBStopping) txt = "stopping";
- else if (status == FBNoExec ) txt = "no exec";
- php_error(E_WARNING, "Could not start %s@%s, as database is %s.",databaseName,phpLink->hostName,txt);
- RETURN_FALSE;
- }
-
- if (status == FBStopped)
- {
- if (!fbcehStartDatabaseNamed (phpLink->execHandler, databaseName))
- {
- char* error = fbechErrorMessage(phpLink->execHandler);
- php_error(E_WARNING, "Could not start %s@%s. %s.",databaseName,phpLink->hostName,error);
- RETURN_FALSE;
- }
- }
-
- for (i=0; i < 20; i++)
- {
-#ifdef PHP_WIN32
- Sleep(1000);
-#else
- sleep(1);
-#endif
- status = fbcehStatusForDatabaseNamed(phpLink->execHandler,databaseName);
- if (status == FBRunning) break;
- }
- if (status != FBRunning)
- {
- php_error(E_WARNING, "Database %s@%s started -- status unknown",databaseName,phpLink->hostName);
- RETURN_FALSE;
- }
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int fbsql_stop_db(string database_name [, resource link_identifier])
- */
-PHP_FUNCTION(fbsql_stop_db)
-{
- PHPFBLink* phpLink = NULL;
- zval **fbsql_link_index = NULL, **database_name;
- int id;
- int i, status;
- char *databaseName;
- FBSQLLS_FETCH();
-
- switch (ZEND_NUM_ARGS()) {
- case 1:
- id = php_fbsql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU FBSQLLS_CC);
- CHECK_LINK(id);
- if (zend_get_parameters_ex(1, &database_name)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- case 2:
- if (zend_get_parameters_ex(2, &database_name, &fbsql_link_index)==FAILURE) {
- RETURN_FALSE;
- }
- id = -1;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- ZEND_FETCH_RESOURCE2(phpLink, PHPFBLink *, fbsql_link_index, id, "FrontBase-Link", le_link, le_plink);
-
- convert_to_string_ex(database_name);
- databaseName = (*database_name)->value.str.val;
-
- if (!php_fbsql_select_db(databaseName, phpLink)) RETURN_FALSE;
-
-/* printf("Stop db %x\n",phpDatabase->connection); */
- if (!fbcdcStopDatabase(phpLink->connection))
- {
- php_error(E_WARNING, "Cannot stop database %s@%s",databaseName,phpLink->hostName);
- RETURN_FALSE;
- }
-
- for (i=0; i < 20; i++)
- {
- status = fbcehStatusForDatabaseNamed(phpLink->execHandler,databaseName);
- if (status == FBStopped) break;
-#ifdef PHP_WIN32
- Sleep(1000);
-#else
- sleep(1);
-#endif
- }
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int fbsql_db_status(string database_name [, resource link_identifier])
- Get the status (Stoped, Starting, Started, Stopping) for a given database*/
-PHP_FUNCTION(fbsql_db_status)
-{
- PHPFBLink* phpLink = NULL;
- zval **fbsql_link_index = NULL, **database_name;
- int id;
- char *databaseName;
- FBSQLLS_FETCH();
-
- switch (ZEND_NUM_ARGS()) {
- case 1:
- id = php_fbsql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU FBSQLLS_CC);
- CHECK_LINK(id);
- if (zend_get_parameters_ex(1, &database_name)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- case 2:
- if (zend_get_parameters_ex(2, &database_name, &fbsql_link_index)==FAILURE) {
- RETURN_FALSE;
- }
- id = -1;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- ZEND_FETCH_RESOURCE2(phpLink, PHPFBLink *, fbsql_link_index, id, "FrontBase-Link", le_link, le_plink);
-
- convert_to_string_ex(database_name);
- databaseName = (*database_name)->value.str.val;
-
- if (phpLink->execHandler) {
- RETURN_LONG(fbcehStatusForDatabaseNamed(phpLink->execHandler, databaseName));
- }
- else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ mdOk
- */
-int mdOk(PHPFBLink* link, FBCMetaData* md)
-{
- FBCDatabaseConnection* c = link->connection;
- int result = 1;
- FBSQLLS_FETCH();
-
- link->errorNo = 0;
- if (link->errorText)
- {
- free(link->errorText);
- link->errorText = NULL;
- }
- if (md == NULL)
- {
- link->errorNo = 1;
- link->errorText = strdup("Connection to database server was lost");
- if (FB_SQL_G(generateWarnings)) php_error(E_WARNING, link->errorText);
- result = 0;
- }
- else if (fbcmdErrorsFound(md))
- {
- FBCErrorMetaData* emd = fbcdcErrorMetaData(c,md);
- char* emg = fbcemdAllErrorMessages(emd);
- if (FB_SQL_G(generateWarnings))
- {
- if (emg)
- php_error(E_WARNING, emg);
- else
- php_error(E_WARNING,"No message");
- }
- link->errorText = estrdup(emg);
- link->errorNo = 1;
- free(emg);
- fbcemdRelease(emd);
- result = 0;
- }
- return result;
-}
-/* }}} */
-
-static void phpfbQuery(INTERNAL_FUNCTION_PARAMETERS, char* sql, PHPFBLink* link)
-{
- PHPFBResult* result = NULL;
- FBCMetaData* md, *meta;
- char* tp;
- char* fh;
- unsigned int sR = 1, cR = 0;
- FBSQLLS_FETCH();
-
- meta = fbcdcExecuteDirectSQL(link->connection, sql);
-
- if (!mdOk(link, meta))
- {
- return_value->value.lval = 0;
- return_value->type = IS_LONG;
- fbcmdRelease(meta);
- }
- else {
- if (fbcmdHasMetaDataArray(meta)) {
- sR = fbcmdMetaDataArrayCount(meta);
- md = (FBCMetaData*)fbcmdMetaDataAtIndex(meta, cR);
- }
- else
- md = meta;
-
- tp = fbcmdStatementType(md);
-
- if ((tp[0] == 'C') || (tp[0] == 'R'))
- {
- return_value->value.lval = 1;
- return_value->type = IS_LONG;
- if (sR == 1 && md) fbcmdRelease(md);
- }
- else if (tp[0] == 'I' || tp[0] == 'U')
- {
- if (tp[0] == 'I') link->insert_id = fbcmdRowIndex(md);
- return_value->value.lval = 1;
- return_value->type = IS_LONG;
- if (sR == 1 && md) fbcmdRelease(md);
- }
- else if ((fh = fbcmdFetchHandle(md)) || (tp[0] == 'E'))
- {
- result = emalloc(sizeof(PHPFBResult));
- result->link = link;
- result->fetchHandle = fh;
- result->ResultmetaData = meta;
- result->metaData = md;
- result->rowHandler = NULL;
- result->batchSize = FB_SQL_G(batchSize);
- result->rowCount = 0x7fffffff;
- result->columnCount = 0;
- result->rowIndex = 0;
- result->columnIndex = 0;
- result->row = NULL;
- result->array = NULL;
- result->list = NULL;
- result->selectResults = sR;
- result->currentResult = cR;
-
- if (tp[0] != 'E')
- {
- result->rowCount = 0x7fffffff;
- result->columnCount = fbcmdColumnCount(md);
- result->fetchHandle = fh;
- result->batchSize = FB_SQL_G(batchSize);
- }
- else
- {
- char* r = fbcmdMessage(result->metaData);
- if ((result->list = fbcplParse(r)))
- {
- result->rowCount = fbcplCount(result->list);
- result->columnCount = 7;
- }
- }
- ZEND_REGISTER_RESOURCE(return_value, result, le_result);
- }
- if (link) link->affectedRows = fbcmdRowCount(md);
- }
-}
-
-/* {{{ proto resource fbsql_query(string query [, resource link_identifier])
- */
-PHP_FUNCTION(fbsql_query)
-{
- PHPFBLink* phpLink = NULL;
- zval **fbsql_link_index = NULL, **query;
- int id;
- FBSQLLS_FETCH();
-
- switch (ZEND_NUM_ARGS()) {
- case 1:
- id = php_fbsql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU FBSQLLS_CC);
- CHECK_LINK(id);
- if (zend_get_parameters_ex(1, &query)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- case 2:
- if (zend_get_parameters_ex(2, &query, &fbsql_link_index)==FAILURE) {
- RETURN_FALSE;
- }
- id = -1;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- ZEND_FETCH_RESOURCE2(phpLink, PHPFBLink *, fbsql_link_index, id, "FrontBase-Link", le_link, le_plink);
-
- convert_to_string_ex(query);
-
- phpfbQuery(INTERNAL_FUNCTION_PARAM_PASSTHRU, (*query)->value.str.val, phpLink);
-}
-/* }}} */
-
-/* {{{ proto resource fbsql_db_query(string database_name, string query [, resource link_identifier])
- */
-PHP_FUNCTION(fbsql_db_query)
-{
- PHPFBLink* phpLink = NULL;
- zval **fbsql_link_index = NULL, **dbname, **query;
- int id;
- FBSQLLS_FETCH();
-
- switch (ZEND_NUM_ARGS()) {
- case 2:
- id = php_fbsql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU FBSQLLS_CC);
- CHECK_LINK(id);
- if (zend_get_parameters_ex(2, &dbname, &query)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- case 3:
- if (zend_get_parameters_ex(3, &dbname, &query, &fbsql_link_index)==FAILURE) {
- RETURN_FALSE;
- }
- id = -1;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- ZEND_FETCH_RESOURCE2(phpLink, PHPFBLink *, fbsql_link_index, id, "FrontBase-Link", le_link, le_plink);
-
- convert_to_string_ex(query);
- convert_to_string_ex(dbname);
-
- if (php_fbsql_select_db((*dbname)->value.str.val, phpLink))
- {
- phpfbQuery(INTERNAL_FUNCTION_PARAM_PASSTHRU, (*query)->value.str.val, phpLink);
- }
- else
- {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto int fbsql_list_dbs([resource link_identifier])
- */
-PHP_FUNCTION(fbsql_list_dbs)
-{
- PHPFBResult* phpResult;
- PHPFBLink* phpLink = NULL;
- zval **fbsql_link_index = NULL;
- int id;
- FBSQLLS_FETCH();
-
- switch (ZEND_NUM_ARGS()) {
- case 0:
- id = php_fbsql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU FBSQLLS_CC);
- CHECK_LINK(id);
- break;
- case 1:
- if (zend_get_parameters_ex(1, &fbsql_link_index)==FAILURE) {
- RETURN_FALSE;
- }
- id = -1;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- ZEND_FETCH_RESOURCE2(phpLink, PHPFBLink *, fbsql_link_index, id, "FrontBase-Link", le_link, le_plink);
-
- phpResult = emalloc(sizeof(PHPFBResult));
- phpResult->link = phpLink;
- phpResult->fetchHandle = NULL;
- phpResult->rowHandler = NULL;
- phpResult->ResultmetaData = NULL;
- phpResult->metaData = NULL;
- phpResult->batchSize = FB_SQL_G(batchSize);
- phpResult->columnCount = 1;
- phpResult->rowIndex = 0;
- phpResult->columnIndex = 0;
- phpResult->row = NULL;
- phpResult->array = fbcehAvailableDatabases(phpLink->execHandler);
- phpResult->rowCount = fbaCount(phpResult->array);
- phpResult->list = NULL;
-
- ZEND_REGISTER_RESOURCE(return_value, phpResult, le_result);
-}
-/* }}} */
-
-/* {{{ proto int fbsql_list_tables(string database, int [link_identifier]);
- */
-PHP_FUNCTION(fbsql_list_tables)
-{
- char* sql = "select t0.\"table_name\"from information_schema.tables t0, information_schema.SCHEMATA t1 where t0.schema_pk = t1.schema_pk and t1.\"schema_name\" = current_schema;";
- PHPFBLink* phpLink = NULL;
- zval **fbsql_link_index = NULL, **database_name;
- int id;
- char *databaseName;
- FBSQLLS_FETCH();
-
- switch (ZEND_NUM_ARGS()) {
- case 1:
- id = php_fbsql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU FBSQLLS_CC);
- CHECK_LINK(id);
- if (zend_get_parameters_ex(1, &database_name)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- case 2:
- if (zend_get_parameters_ex(2, &database_name, &fbsql_link_index)==FAILURE) {
- RETURN_FALSE;
- }
- id = -1;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- ZEND_FETCH_RESOURCE2(phpLink, PHPFBLink *, fbsql_link_index, id, "FrontBase-Link", le_link, le_plink);
-
- convert_to_string_ex(database_name);
- databaseName = (*database_name)->value.str.val;
-
- if (databaseName == NULL)
- {
- php_fbsql_select_db(FB_SQL_G(databaseName), phpLink);
- }
- else
- {
- php_fbsql_select_db(databaseName, phpLink);
- }
-
- phpfbQuery(INTERNAL_FUNCTION_PARAM_PASSTHRU, sql, phpLink);
-}
-/* }}} */
-
-/* {{{ proto int fbsql_list_fields(string database_name, string table_name [, resource link_identifier])
- */
-PHP_FUNCTION(fbsql_list_fields)
-{
- PHPFBLink* phpLink = NULL;
- zval **fbsql_link_index = NULL, **database_name, **table_name;
- int id;
- char *databaseName, *tableName;
- char sql[1024];
- FBSQLLS_FETCH();
-
- switch (ZEND_NUM_ARGS()) {
- case 2:
- id = php_fbsql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU FBSQLLS_CC);
- CHECK_LINK(id);
- if (zend_get_parameters_ex(2, &database_name, &table_name)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- case 3:
- if (zend_get_parameters_ex(3, &database_name, &table_name, &fbsql_link_index)==FAILURE) {
- RETURN_FALSE;
- }
- id = -1;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- ZEND_FETCH_RESOURCE2(phpLink, PHPFBLink *, fbsql_link_index, id, "FrontBase-Link", le_link, le_plink);
-
- convert_to_string_ex(database_name);
- databaseName = (*database_name)->value.str.val;
- convert_to_string_ex(table_name);
- tableName = (*table_name)->value.str.val;
-
- if (!php_fbsql_select_db(databaseName, phpLink)) RETURN_FALSE;
-
- sprintf(sql,"EXTRACT TABLE %s;",tableName);
-
- phpfbQuery(INTERNAL_FUNCTION_PARAM_PASSTHRU, sql, phpLink);
-}
-/* }}} */
-
-/* {{{ proto string fbsql_error([resource link_identifier])
- */
-PHP_FUNCTION(fbsql_error)
-{
- PHPFBLink* phpLink = NULL;
- zval **fbsql_link_index = NULL;
- int id;
- FBSQLLS_FETCH();
-
- switch (ZEND_NUM_ARGS()) {
- case 0:
- id = php_fbsql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU FBSQLLS_CC);
- CHECK_LINK(id);
- break;
- case 1:
- if (zend_get_parameters_ex(1, &fbsql_link_index)==FAILURE) {
- RETURN_FALSE;
- }
- id = -1;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- ZEND_FETCH_RESOURCE2(phpLink, PHPFBLink *, fbsql_link_index, id, "FrontBase-Link", le_link, le_plink);
-
- if (phpLink->errorText == NULL) {
- RETURN_FALSE;
- }
- else {
- RETURN_STRING(phpLink->errorText, 1);
- }
-}
-/* }}} */
-
-/* {{{ proto int fbsql_errno([resource link_identifier])
- */
-PHP_FUNCTION(fbsql_errno)
-{
- PHPFBLink* phpLink = NULL;
- zval **fbsql_link_index = NULL;
- int id;
- FBSQLLS_FETCH();
-
- switch (ZEND_NUM_ARGS()) {
- case 0:
- id = php_fbsql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU FBSQLLS_CC);
- CHECK_LINK(id);
- break;
- case 1:
- if (zend_get_parameters_ex(1, &fbsql_link_index)==FAILURE) {
- RETURN_FALSE;
- }
- id = -1;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- ZEND_FETCH_RESOURCE2(phpLink, PHPFBLink *, fbsql_link_index, id, "FrontBase-Link", le_link, le_plink);
-
- RETURN_LONG(phpLink->errorNo);
-}
-/* }}} */
-
-/* {{{ proto bool fbsql_warnings([int flag]);
- */
-PHP_FUNCTION(fbsql_warnings)
-{
- int argc = ARG_COUNT(ht);
- zval **argv[1];
- FBSQLLS_FETCH();
-
- if ((argc < 0) || (argc > 1)) WRONG_PARAM_COUNT;
- if (zend_get_parameters_ex(argc,&argv[0])==FAILURE) RETURN_FALSE;
- if (argc >= 1)
- {
- convert_to_long_ex(argv[0]);
- FB_SQL_G(generateWarnings) = (*argv[0])->value.lval != 0;
- }
- RETURN_BOOL(FB_SQL_G(generateWarnings));
-}
-/* }}} */
-
-/* {{{ proto int fbsql_affected_rows([resource link_identifier])
- */
-PHP_FUNCTION(fbsql_affected_rows)
-{
- PHPFBLink* phpLink = NULL;
- zval **fbsql_link_index = NULL;
- int id;
- FBSQLLS_FETCH();
-
- switch (ZEND_NUM_ARGS()) {
- case 0:
- id = php_fbsql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU FBSQLLS_CC);
- CHECK_LINK(id);
- break;
- case 1:
- if (zend_get_parameters_ex(1, &fbsql_link_index)==FAILURE) {
- RETURN_FALSE;
- }
- id = -1;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- ZEND_FETCH_RESOURCE2(phpLink, PHPFBLink *, fbsql_link_index, id, "FrontBase-Link", le_link, le_plink);
-
- RETURN_LONG(phpLink->affectedRows);
-}
-/* }}} */
-
-/* {{{ proto int fbsql_insert_id([resource link_identifier])
- */
-PHP_FUNCTION(fbsql_insert_id)
-{
- PHPFBLink* phpLink = NULL;
- zval **fbsql_link_index = NULL;
- int id;
- FBSQLLS_FETCH();
-
- switch (ZEND_NUM_ARGS()) {
- case 0:
- id = php_fbsql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU FBSQLLS_CC);
- CHECK_LINK(id);
- break;
- case 1:
- if (zend_get_parameters_ex(1, &fbsql_link_index)==FAILURE) {
- RETURN_FALSE;
- }
- id = -1;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- ZEND_FETCH_RESOURCE2(phpLink, PHPFBLink *, fbsql_link_index, id, "FrontBase-Link", le_link, le_plink);
-
- RETURN_LONG(phpLink->insert_id);
-}
-/* }}} */
-
-/* {{{ phpSizeOfInt
- */
-int phpSizeOfInt (int i)
-{
- int s = 1;
- if (i < 0)
- {
- s++;
- i = -i;
- }
- while ((i = i / 10)) s++;
- return s;
-}
-/* }}} */
-
-/* {{{ phpfbColumnAsString
- */
-void phpfbColumnAsString (PHPFBResult* result, int column, void* data ,int* length, char** value)
-{
- FBCMetaData* md = result->metaData;
- const FBCDatatypeMetaData* dtmd = fbcmdDatatypeMetaDataAtIndex(md, column);
- unsigned dtc = fbcdmdDatatypeCode(dtmd);
- switch (dtc)
- {
- case FB_Boolean:
- {
- unsigned char v = *((unsigned char*)(data));
- if (v == 255)
- phpfbestrdup("Unknown",length,value);
- else if (v == 0)
- phpfbestrdup("False",length,value);
- else
- phpfbestrdup("True",length,value);
- }
- break;
-
- case FB_PrimaryKey:
- case FB_Integer:
- {
- int v = *((int*)data);
- char b[128];
- sprintf(b,"%d",v);
- phpfbestrdup(b,length,value);
- }
- break;
-
- case FB_SmallInteger:
- {
- short v = *((short*)data);
- char b[128];
- sprintf(b,"%d",v);
- phpfbestrdup(b,length,value);
- }
- break;
-
- case FB_Float:
- case FB_Real:
- case FB_Double:
- case FB_Numeric:
- case FB_Decimal:
- {
- double v = *((double*)data);
- char b[128];
- sprintf(b,"%f",v);
- phpfbestrdup(b,length,value);
- }
- break;
-
- case FB_Character:
- case FB_VCharacter:
- {
- char* v = (char*)data;
- phpfbestrdup(v,length,value);
- }
- break;
-
- case FB_Bit:
- case FB_VBit:
- {
- const FBCColumnMetaData* clmd = fbcmdColumnMetaDataAtIndex(md,column);
- struct bitValue
- {
- unsigned int nBytes;
- unsigned char* bytes;
- };
- struct bitValue* ptr = data;
- unsigned nBits = ptr->nBytes * 8;
-
- if (dtc == FB_Bit) nBits = fbcdmdLength(fbccmdDatatype(clmd));
- if (nBits %8 == 0)
- {
- unsigned i;
- unsigned int l = nBits / 8;
- *length = l*2+3+1;
- if (value)
- {
- char* r = emalloc(l*2+3+1);
- r[0] = 'X';
- r[1] = '\'';
- for (i = 0; i < nBits / 8; i++)
- {
- char c[4];
- sprintf(c,"%02x",ptr->bytes[i]);
- r[i*2+2] = c[0];
- r[i*2+3] = c[1];
- }
- r[i*2+2] = '\'';
- r[i*2+3] = 0;
- *value = r;
- }
- }
- else
- {
- unsigned i;
- unsigned int l = nBits;
- *length = l*2+3+1;
- if (value)
- {
- char* r = emalloc(l*2+3+1);
- r[0] = 'B';
- r[1] = '\'';
- for (i = 0; i < nBits; i++)
- {
- int bit = 0;
- if (i/8 < ptr->nBytes) bit = ptr->bytes[i/8] & (1<<(7-(i%8)));
- r[i*2+2] = bit?'1':'0';
- }
- r[i*2+2] = '\'';
- r[i*2+3] = 0;
- *value = r;
- }
- }
- }
- break;
-
- case FB_Date:
- case FB_Time:
- case FB_TimeTZ:
- case FB_Timestamp:
- case FB_TimestampTZ:
- {
- char* v = (char*)data;
- phpfbestrdup(v,length,value);
- }
- break;
-
- case FB_YearMonth:
- {
- char b[128];
- int v = *((unsigned int*)data);
- sprintf(b,"%d",v);
- phpfbestrdup(b,length,value);
- }
- break;
-
- case FB_DayTime:
- {
- char b[128];
- double seconds = *((double*)data);
- sprintf(b,"%f",seconds);
- phpfbestrdup(b,length,value);
- }
- break;
-
- case FB_CLOB:
- case FB_BLOB:
-/* {
- unsigned char* bytes = (unsigned char*)data;
- if (*bytes == '\1')
- { /* Direct
- unsigned int l = *((unsigned int*)(bytes+1));
- unsigned char* ptr = *((unsigned char**)(bytes+5));
- unsigned int i;
- mf(file,"%4d:",l);
- for (i=0; i < l; i++)
- {
- if (i)
- {
- if ((i % 32) == 0)
- mf(file,"\n %*d:",lw+4,i);
- else if ((i % 4) == 0)
- mf(file," ");
- }
- mf(file,"%02x",*ptr++);
- }
- }
- else
- {
- mf(file,"%s",bytes+1);
- }
- }
- break;
-*/
- default:
- php_error(E_WARNING,"Unimplemented type");
- break;
- }
-}
-/* }}} */
-
-/* {{{ phpfbSqlResult
- */
-void phpfbSqlResult (INTERNAL_FUNCTION_PARAMETERS, PHPFBResult* result, int rowIndex, int columnIndex)
-{
- void** row;
- if (result->list)
- {
- FBCPList* columns = (FBCPList*)fbcplValueForKey(result->list,"COLUMNS");
- FBCPList* column = (FBCPList*)fbcplValueAtIndex(columns,result->rowIndex);
- if (columnIndex == 0)
- { /* Name */
- FBCPList* name = (FBCPList*)fbcplValueForKey(column,"NAME");
- RETURN_STRING((char *)fbcplString((FBCPList*)name), 1);
- }
- else if (columnIndex == 2)
- { /* Length */
- FBCPList* name = (FBCPList*)fbcplValueForKey(column,"WIDTH");
- RETURN_STRING((char *)fbcplString((FBCPList*)name), 1);
- }
- else if (columnIndex == 1)
- { /* Type */
- FBCPList* name = (FBCPList*)fbcplValueForKey(column,"DATATYPE");
- RETURN_STRING((char *)fbcplString((FBCPList*)name), 1);
- }
- else if (columnIndex == 3)
- { /* Flags */
- RETURN_STRING("", 1);
- }
- else
- {
- RETURN_STRING("", 1);
- }
- }
- else if (result->array)
- { /* Special case for get dbs */
- RETURN_STRING(fbaObjectAtIndex(result->array,rowIndex), 1);
- }
- else if (!phpfbFetchRow(result,rowIndex))
- {
- php_error(E_WARNING,"No such row %d in result set %d",rowIndex,rowIndex);
- RETURN_FALSE;
- }
- else if (columnIndex >= result->columnCount)
- {
- php_error(E_WARNING,"No such column %d in result set %d",columnIndex,rowIndex);
- RETURN_FALSE;
- }
- else
- {
- row = fbcrhRowAtIndex(result->rowHandler,rowIndex);
- if (row == NULL)
- {
- RETURN_FALSE;
- }
- else if (row[columnIndex])
- {
- phpfbColumnAsString(result,columnIndex,row[columnIndex],&return_value->value.str.len,&return_value->value.str.val);
- return_value->type = IS_STRING;
- }
- else
- {
- RETURN_NULL();
- }
- }
-}
-/* }}} */
-
-/* {{{ proto mixed fbsql_result(int result [, int row [, mixed field]])
- */
-PHP_FUNCTION(fbsql_result)
-{
- PHPFBResult* result = NULL;
- zval **fbsql_result_index = NULL, **row = NULL, **field = NULL;
- int rowIndex;
- int columnIndex;
- FBSQLLS_FETCH();
-
- switch (ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &fbsql_result_index)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- case 2:
- if (zend_get_parameters_ex(2, &fbsql_result_index, &row)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- case 3:
- if (zend_get_parameters_ex(3, &fbsql_result_index, &row, &field)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- ZEND_FETCH_RESOURCE(result, PHPFBResult *, fbsql_result_index, -1, "FrontBase-Result", le_result);
-
- rowIndex = result->rowIndex;
- if (row)
- {
- convert_to_long_ex(row);
- rowIndex = Z_LVAL_PP(row);
- }
-
- columnIndex = result->columnIndex;
- if (field)
- {
- if (((*field)->type == IS_STRING) && (result->metaData))
- {
- for (columnIndex =0; columnIndex < result->columnCount; columnIndex ++)
- {
- const FBCColumnMetaData* cmd = fbcmdColumnMetaDataAtIndex(result->metaData, columnIndex);
- const char* lbl = fbccmdLabelName(cmd);
- if (strcmp((char*)lbl, (*field)->value.str.val) == 0) break;
- }
- if (columnIndex == result->columnCount) RETURN_FALSE;
- }
- else
- {
- convert_to_long_ex(field);
- columnIndex = (*field)->value.lval;
- if (columnIndex < 0)
- {
- php_error(E_WARNING,"Illegal column index - %d",columnIndex);
- RETURN_FALSE;
- }
- }
- }
-
- phpfbSqlResult(INTERNAL_FUNCTION_PARAM_PASSTHRU,result,rowIndex,columnIndex);
-
- result->columnIndex++;
- if (result->columnIndex == result->columnCount)
- {
- result->rowIndex++;
- result->columnIndex = 0;
- }
-}
-/* }}} */
-
-/* {{{ proto int fbsql_next_result(int result)
- */
-PHP_FUNCTION(fbsql_next_result)
-{
- PHPFBResult* result = NULL;
- zval **fbsql_result_index = NULL;
- FBSQLLS_FETCH();
-
- switch (ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &fbsql_result_index)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- ZEND_FETCH_RESOURCE(result, PHPFBResult *, fbsql_result_index, -1, "FrontBase-Result", le_result);
-
- result->currentResult++;
- if (result->currentResult < result->selectResults) {
- if (result->fetchHandle) {
- FBCMetaData *md = fbcdcCancelFetch(result->link->connection, result->fetchHandle);
- fbcmdRelease(md);
- }
- if (result->rowHandler) fbcrhRelease(result->rowHandler);
- result->metaData = (FBCMetaData*)fbcmdMetaDataAtIndex(result->ResultmetaData, result->currentResult);
- result->fetchHandle = fbcmdFetchHandle(result->metaData);
- result->rowHandler = NULL;
- result->batchSize = FB_SQL_G(batchSize);
- result->rowCount = 0x7fffffff;
- result->columnCount = fbcmdColumnCount(result->metaData);;
- result->rowIndex = 0;
- result->columnIndex = 0;
- result->row = NULL;
- result->array = NULL;
- result->list = NULL;
- if (result->link)
- result->link->affectedRows = fbcmdRowCount(result->metaData);
-
- RETURN_TRUE;
- }
- else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto int fbsql_num_rows(int result)
- */
-PHP_FUNCTION(fbsql_num_rows)
-{
- PHPFBResult* result = NULL;
- zval **fbsql_result_index = NULL;
- int rowCount;
- FBSQLLS_FETCH();
-
- switch (ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &fbsql_result_index)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- ZEND_FETCH_RESOURCE(result, PHPFBResult *, fbsql_result_index, -1, "FrontBase-Result", le_result);
-
- if (result->array)
- rowCount = result->rowCount;
- else {
- rowCount = fbcmdRowCount(result->metaData);
- if (rowCount == -1)
- {
- phpfbFetchRow(result,0x7fffffff);
- rowCount = result->rowCount;
- }
- }
- RETURN_LONG(rowCount);
-}
-/* }}} */
-
-/* {{{ proto int fbsql_num_fields(int result)
- */
-PHP_FUNCTION(fbsql_num_fields)
-{
- PHPFBResult* result = NULL;
- zval **fbsql_result_index = NULL;
- FBSQLLS_FETCH();
-
- switch (ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &fbsql_result_index)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- ZEND_FETCH_RESOURCE(result, PHPFBResult *, fbsql_result_index, -1, "FrontBase-Result", le_result);
-
- RETURN_LONG(result->columnCount);
-}
-/* }}} */
-
-/* {{{ proto array fbsql_fetch_row(int result)
- */
-PHP_FUNCTION(fbsql_fetch_row)
-{
- php_fbsql_fetch_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU, FBSQL_NUM);
-}
-/* }}} */
-
-/* {{{ proto object fbsql_fetch_assoc(int result)
- */
-PHP_FUNCTION(fbsql_fetch_assoc)
-{
- php_fbsql_fetch_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU, FBSQL_ASSOC);
-}
-/* }}} */
-
-/* {{{ proto object fbsql_fetch_object(int result [, int result_type])
- */
-PHP_FUNCTION(fbsql_fetch_object)
-{
- php_fbsql_fetch_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU, FBSQL_ASSOC);
- if (return_value->type==IS_ARRAY)
- {
- return_value->type=IS_OBJECT;
- return_value->value.obj.properties = return_value->value.ht;
- return_value->value.obj.ce = &zend_standard_class_def;
- }
-}
-/* }}} */
-
-/* {{{ proto array fbsql_fetch_array(int result [, int result_type])
- Fetch a result row as an array (associative, numeric or both)*/
-PHP_FUNCTION(fbsql_fetch_array)
-{
- php_fbsql_fetch_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU, FBSQL_BOTH);
-}
-/* }}} */
-
-/* {{{ php_fbsql_fetch_hash
- */
-static void php_fbsql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, int result_type)
-{
-
- PHPFBResult* result = NULL;
- zval **fbsql_result_index = NULL, **zresult_type = NULL;
- int rowIndex;
- int i;
- void **row;
- FBSQLLS_FETCH();
-
- switch (ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &fbsql_result_index)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- case 2:
- if (zend_get_parameters_ex(2, &fbsql_result_index, &zresult_type)==FAILURE) {
- RETURN_FALSE;
- }
- convert_to_long_ex(zresult_type);
- result_type = Z_LVAL_PP(zresult_type);
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- ZEND_FETCH_RESOURCE(result, PHPFBResult *, fbsql_result_index, -1, "FrontBase-Result", le_result);
-
- rowIndex = result->rowIndex;
- if (((result_type & FBSQL_NUM) != FBSQL_NUM) && ((result_type & FBSQL_ASSOC) != FBSQL_ASSOC))
- {
- php_error(E_WARNING,"Illegal result type use FBSQL_NUM, FBSQL_ASSOC, or FBSQL_BOTH.");
- RETURN_FALSE;
- }
- if (array_init(return_value)==FAILURE)
- {
- RETURN_FALSE;
- }
- if (result->fetchHandle == NULL)
- {
- if (result->array == NULL)
- {
- RETURN_FALSE;
- }
- if (result->rowIndex >= result->rowCount)
- {
- RETURN_FALSE;
- }
- if (result_type & FBSQL_NUM)
- {
- add_index_string(return_value,0,estrdup(fbaObjectAtIndex(result->array,result->rowIndex)),0);
- }
- if (result_type & FBSQL_ASSOC)
- {
- add_assoc_string(return_value, "Database", estrdup(fbaObjectAtIndex(result->array,result->rowIndex)), 0);
- }
- }
- else {
- if (result->rowCount == 0) {
- RETURN_FALSE;
- }
- if (result->rowCount == 0x7fffffff)
- {
- if (!phpfbFetchRow(result,result->rowIndex)) {
- RETURN_FALSE;
- }
- }
- row = fbcrhRowAtIndex(result->rowHandler,rowIndex);
- if (row == NULL)
- {
- RETURN_FALSE;
- }
- for (i=0; i < result->columnCount; i++)
- {
- if (row[i])
- {
- char* value;
- unsigned int length;
- unsigned int c = 0;
- phpfbColumnAsString(result,i,row[i],&length,&value);
- if (result_type & FBSQL_NUM)
- {
- add_index_stringl(return_value,i,value,length,c);
- c = 1;
- }
- if (result_type & FBSQL_ASSOC)
- {
- char* key = (char*)fbccmdLabelName(fbcmdColumnMetaDataAtIndex(result->metaData, i));
- add_assoc_stringl(return_value,key, value, length, c);
- }
- }
- else
- {
- if (result_type & FBSQL_NUM)
- {
- add_index_unset(return_value,i);
- }
- if (result_type & FBSQL_ASSOC)
- {
- char* key = (char*)fbccmdLabelName(fbcmdColumnMetaDataAtIndex(result->metaData, i));
- add_assoc_unset(return_value,key);
- }
- }
- }
- }
- result->rowIndex = result->rowIndex+1;
- result->columnIndex = 0;
-}
-/* }}} */
-
-/* {{{ proto int fbsql_data_seek(int result, int row_number)
- */
-PHP_FUNCTION(fbsql_data_seek)
-{
- PHPFBResult* result = NULL;
- zval **fbsql_result_index = NULL, **row_number = NULL;
- int rowIndex;
- FBSQLLS_FETCH();
-
- switch (ZEND_NUM_ARGS()) {
- case 2:
- if (zend_get_parameters_ex(2, &fbsql_result_index, &row_number)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- ZEND_FETCH_RESOURCE(result, PHPFBResult *, fbsql_result_index, -1, "FrontBase-Result", le_result);
-
- convert_to_long_ex(row_number);
- rowIndex = Z_LVAL_PP(row_number);
-
- if (rowIndex < 0)
- {
- php_error(E_WARNING,"Illegal row_index (%i)", rowIndex);
- RETURN_FALSE;
- }
-
- if (result->rowCount == 0x7fffffff) phpfbFetchRow(result,rowIndex);
- if (rowIndex > result->rowCount) RETURN_FALSE;
- result->rowIndex = rowIndex;
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto array fbsql_fetch_lengths(int result)
- */
-PHP_FUNCTION(fbsql_fetch_lengths)
-{
- PHPFBResult* result = NULL;
- zval **fbsql_result_index = NULL;
- int i;
- FBSQLLS_FETCH();
-
- switch (ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &fbsql_result_index)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- ZEND_FETCH_RESOURCE(result, PHPFBResult *, fbsql_result_index, -1, "FrontBase-Result", le_result);
-
- if (result->row == NULL) RETURN_FALSE;
- if (array_init(return_value)==FAILURE) RETURN_FALSE;
- for (i=0; i < result->columnCount; i++)
- {
- unsigned length = 0;
- if (result->row[i]) phpfbColumnAsString(result,i, result->row[i],&length,NULL);
- add_index_long(return_value, i, length);
- }
-}
-/* }}} */
-
-/* {{{ proto object fbsql_fetch_field(int result [, int field_index])
- */
-PHP_FUNCTION(fbsql_fetch_field)
-{
- PHPFBResult* result = NULL;
- zval **fbsql_result_index = NULL, **field_index = NULL;
- int column = -1;
- FBSQLLS_FETCH();
-
- switch (ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &fbsql_result_index)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- case 2:
- if (zend_get_parameters_ex(2, &fbsql_result_index, &field_index)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- ZEND_FETCH_RESOURCE(result, PHPFBResult *, fbsql_result_index, -1, "FrontBase-Result", le_result);
-
- column = result->columnIndex;
- if (field_index)
- {
- convert_to_long_ex(field_index);
- column = Z_LVAL_PP(field_index);
- if (column < 0 || column >= result->columnCount)
- {
- php_error(E_WARNING,"%d no such column in result",column);
- RETURN_FALSE;
- }
- }
- if (object_init(return_value)==FAILURE)
- {
- RETURN_FALSE;
- }
- add_property_string(return_value, "name", (char*)fbccmdLabelName(fbcmdColumnMetaDataAtIndex(result->metaData, column)),1);
- add_property_string(return_value, "table", (char*)fbccmdTableName(fbcmdColumnMetaDataAtIndex(result->metaData,column)),1);
- add_property_long(return_value, "max_length", fbcdmdLength(fbccmdDatatype(fbcmdColumnMetaDataAtIndex(result->metaData,column))));
- add_property_string(return_value, "type", (char*)fbcdmdDatatypeString(fbcmdDatatypeMetaDataAtIndex(result->metaData, column)),1);
- add_property_long(return_value, "not_null", !fbccmdIsNullable(fbcmdColumnMetaDataAtIndex(result->metaData, column)));
-/* Remember to add the rest */
-/* add_property_long(return_value, "primary_key",IS_PRI_KEY(fbsql_field->flags)?1:0); */
-/* add_property_long(return_value, "multiple_key",(fbsql_field->flags&MULTIPLE_KEY_FLAG?1:0)); */
-/* add_property_long(return_value, "unique_key",(fbsql_field->flags&UNIQUE_KEY_FLAG?1:0)); */
-/* add_property_long(return_value, "numeric",IS_NUM(fbsql_field->type)?1:0); */
-/* add_property_long(return_value, "blob",IS_BLOB(fbsql_field->flags)?1:0); */
-/* add_property_long(return_value, "unsigned",(fbsql_field->flags&UNSIGNED_FLAG?1:0)); */
-/* add_property_long(return_value, "zerofill",(fbsql_field->flags&ZEROFILL_FLAG?1:0)); */
-}
-/* }}} */
-
-/* {{{ proto bool fbsql_field_seek(int result [, int field_index])
- */
-PHP_FUNCTION(fbsql_field_seek)
-{
- PHPFBResult* result = NULL;
- zval **fbsql_result_index = NULL, **field_index = NULL;
- int column = -1;
- FBSQLLS_FETCH();
-
- switch (ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &fbsql_result_index)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- case 2:
- if (zend_get_parameters_ex(2, &fbsql_result_index, &field_index)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- ZEND_FETCH_RESOURCE(result, PHPFBResult *, fbsql_result_index, -1, "FrontBase-Result", le_result);
-
- column = result->columnIndex;
- if (field_index)
- {
- convert_to_long_ex(field_index);
- column = Z_LVAL_PP(field_index);
- if (column < 0 || column >= result->columnCount)
- {
- php_error(E_WARNING,"%d no such column in result",column);
- RETURN_FALSE;
- }
- }
-
- result->columnIndex = column;
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto string fbsql_field_name(int result [, int field_index])
- */
-PHP_FUNCTION(fbsql_field_name)
-{
- PHPFBResult* result = NULL;
- zval **fbsql_result_index = NULL, **field_index = NULL;
- int column = -1;
- FBSQLLS_FETCH();
-
- switch (ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &fbsql_result_index)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- case 2:
- if (zend_get_parameters_ex(2, &fbsql_result_index, &field_index)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- ZEND_FETCH_RESOURCE(result, PHPFBResult *, fbsql_result_index, -1, "FrontBase-Result", le_result);
-
- column = result->columnIndex;
- if (field_index)
- {
- convert_to_long_ex(field_index);
- column = Z_LVAL_PP(field_index);
- if (column < 0 || column >= result->columnCount)
- {
- php_error(E_WARNING,"%d no such column in result",column);
- RETURN_FALSE;
- }
- }
- if (result->list)
- {
- phpfbSqlResult(INTERNAL_FUNCTION_PARAM_PASSTHRU,result,result->rowIndex,0);
- }
- else if (result->metaData)
- {
- RETURN_STRING((char *)fbccmdLabelName(fbcmdColumnMetaDataAtIndex(result->metaData, column)), 1);
- result->columnIndex = column;
- }
-}
-/* }}} */
-
-/* {{{ proto string fbsql_field_table(int result [, int field_index])
- */
-PHP_FUNCTION(fbsql_field_table)
-{
- PHPFBResult* result = NULL;
- zval **fbsql_result_index = NULL, **field_index = NULL;
- int column = -1;
- FBSQLLS_FETCH();
-
- switch (ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &fbsql_result_index)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- case 2:
- if (zend_get_parameters_ex(2, &fbsql_result_index, &field_index)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- ZEND_FETCH_RESOURCE(result, PHPFBResult *, fbsql_result_index, -1, "FrontBase-Result", le_result);
-
- column = result->columnIndex;
- if (field_index)
- {
- convert_to_long_ex(field_index);
- column = Z_LVAL_PP(field_index);
- if (column < 0 || column >= result->columnCount)
- {
- php_error(E_WARNING,"%d no such column in result",column);
- RETURN_FALSE;
- }
- }
- RETURN_STRING((char *)fbccmdTableName(fbcmdColumnMetaDataAtIndex(result->metaData,column)), 1);
-}
-/* }}} */
-
-/* {{{ proto string fbsql_field_len(int result [, int field_index])
- */
-PHP_FUNCTION(fbsql_field_len)
-{
- PHPFBResult* result = NULL;
- zval **fbsql_result_index = NULL, **field_index = NULL;
- int column = -1;
- FBSQLLS_FETCH();
-
- switch (ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &fbsql_result_index)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- case 2:
- if (zend_get_parameters_ex(2, &fbsql_result_index, &field_index)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- ZEND_FETCH_RESOURCE(result, PHPFBResult *, fbsql_result_index, -1, "FrontBase-Result", le_result);
-
- column = result->columnIndex;
- if (field_index)
- {
- convert_to_long_ex(field_index);
- column = Z_LVAL_PP(field_index);
- if (column < 0 || column >= result->columnCount)
- {
- php_error(E_WARNING,"%d no such column in result",column);
- RETURN_FALSE;
- }
- }
- if (result->list)
- {
- phpfbSqlResult(INTERNAL_FUNCTION_PARAM_PASSTHRU,result,result->rowIndex,2);
- }
- else if (result->metaData)
- {
- RETURN_LONG(fbcdmdLength(fbccmdDatatype(fbcmdColumnMetaDataAtIndex(result->metaData,column))));
- }
- else
- {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto string fbsql_field_type(int result [, int field_index])
- */
-PHP_FUNCTION(fbsql_field_type)
-{
- PHPFBResult* result = NULL;
- zval **fbsql_result_index = NULL, **field_index = NULL;
- int column = -1;
- FBSQLLS_FETCH();
-
- switch (ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &fbsql_result_index)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- case 2:
- if (zend_get_parameters_ex(2, &fbsql_result_index, &field_index)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- ZEND_FETCH_RESOURCE(result, PHPFBResult *, fbsql_result_index, -1, "FrontBase-Result", le_result);
-
- column = result->columnIndex;
- if (field_index)
- {
- convert_to_long_ex(field_index);
- column = Z_LVAL_PP(field_index);
- if (column < 0 || column >= result->columnCount)
- {
- php_error(E_WARNING,"%d no such column in result",column);
- RETURN_FALSE;
- }
- }
- if (result->list)
- {
- phpfbSqlResult(INTERNAL_FUNCTION_PARAM_PASSTHRU,result,result->rowIndex,1);
- }
- else if (result->metaData)
- {
- RETURN_STRING((char *)fbcdmdDatatypeString (fbcmdDatatypeMetaDataAtIndex(result->metaData, column)), 1);
- }
- else
- {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto string fbsql_field_flags(int result [, int field_index])
- */
-PHP_FUNCTION(fbsql_field_flags)
-{
- PHPFBResult* result = NULL;
- zval **fbsql_result_index = NULL, **field_index = NULL;
- int column = -1;
- char buf[512];
- int len;
- FBSQLLS_FETCH();
-
- switch (ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &fbsql_result_index)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- case 2:
- if (zend_get_parameters_ex(2, &fbsql_result_index, &field_index)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- ZEND_FETCH_RESOURCE(result, PHPFBResult *, fbsql_result_index, -1, "FrontBase-Result", le_result);
-
- column = result->columnIndex;
- if (field_index)
- {
- convert_to_long_ex(field_index);
- column = Z_LVAL_PP(field_index);
- if (column < 0 || column >= result->columnCount)
- {
- php_error(E_WARNING,"%d no such column in result",column);
- RETURN_FALSE;
- }
- }
- strcpy(buf, "");
- if (!fbccmdIsNullable(fbcmdColumnMetaDataAtIndex(result->metaData, column))) {
- strcat(buf, "not_null ");
- }
-#if 0
- if (IS_PRI_KEY(fbsql_field->flags)) {
- strcat(buf, "primary_key ");
- }
- if (fbsql_field->flags&UNIQUE_KEY_FLAG) {
- strcat(buf, "unique_key ");
- }
- if (fbsql_field->flags&MULTIPLE_KEY_FLAG) {
- strcat(buf, "multiple_key ");
- }
- if (IS_BLOB(fbsql_field->flags)) {
- strcat(buf, "blob ");
- }
- if (fbsql_field->flags&UNSIGNED_FLAG) {
- strcat(buf, "unsigned ");
- }
- if (fbsql_field->flags&ZEROFILL_FLAG) {
- strcat(buf, "zerofill ");
- }
- if (fbsql_field->flags&BINARY_FLAG) {
- strcat(buf, "binary ");
- }
- if (fbsql_field->flags&ENUM_FLAG) {
- strcat(buf, "enum ");
- }
- if (fbsql_field->flags&AUTO_INCREMENT_FLAG) {
- strcat(buf, "auto_increment ");
- }
- if (fbsql_field->flags&TIMESTAMP_FLAG) {
- strcat(buf, "timestamp ");
- }
-#endif
- len = strlen(buf);
- /* remove trailing space, if present */
- if (len && buf[len-1] == ' ') {
- buf[len-1] = 0;
- len--;
- }
- RETURN_STRING(buf, 1);
-}
-/* }}} */
-
-/* {{{ proto bool fbsql_free_result(int result)
- */
-PHP_FUNCTION(fbsql_free_result)
-{
- PHPFBResult* result = NULL;
- zval **fbsql_result_index = NULL;
- FBSQLLS_FETCH();
-
- switch (ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &fbsql_result_index)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- ZEND_FETCH_RESOURCE(result, PHPFBResult *, fbsql_result_index, -1, "FrontBase-Result", le_result);
-
- zend_list_delete((*fbsql_result_index)->value.lval);
- RETURN_TRUE;
-}
-/* }}} */
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/fbsql/php_fbsql.h b/ext/fbsql/php_fbsql.h
deleted file mode 100644
index 55480a3946..0000000000
--- a/ext/fbsql/php_fbsql.h
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Frank M. Kromann frank@frontbase.com> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#define HAVE_FBSQL 1
-
-#ifndef _PHP_FBSQL_H
-#define _PHP_FBSQL_H
-
-#if COMPILE_DL_FBSQL
-#undef HAVE_FBSQL
-#define HAVE_FBSQL 1
-#endif
-#if HAVE_FBSQL
-
-extern zend_module_entry fbsql_module_entry;
-#define fbsql_module_ptr &fbsql_module_entry
-
-#include <FBCAccess/FBCAccess.h>
-
-extern PHP_MINIT_FUNCTION(fbsql);
-extern PHP_MSHUTDOWN_FUNCTION(fbsql);
-extern PHP_RINIT_FUNCTION(fbsql);
-extern PHP_RSHUTDOWN_FUNCTION(fbsql);
-PHP_MINFO_FUNCTION(fbsql);
-PHP_FUNCTION(fbsql_connect);
-PHP_FUNCTION(fbsql_pconnect);
-PHP_FUNCTION(fbsql_close);
-PHP_FUNCTION(fbsql_select_db);
-PHP_FUNCTION(fbsql_change_user);
-PHP_FUNCTION(fbsql_create_db);
-PHP_FUNCTION(fbsql_drop_db);
-PHP_FUNCTION(fbsql_start_db);
-PHP_FUNCTION(fbsql_stop_db);
-PHP_FUNCTION(fbsql_db_status);
-PHP_FUNCTION(fbsql_query);
-PHP_FUNCTION(fbsql_db_query);
-PHP_FUNCTION(fbsql_list_dbs);
-PHP_FUNCTION(fbsql_list_tables);
-PHP_FUNCTION(fbsql_list_fields);
-PHP_FUNCTION(fbsql_error);
-PHP_FUNCTION(fbsql_errno);
-PHP_FUNCTION(fbsql_affected_rows);
-PHP_FUNCTION(fbsql_insert_id);
-PHP_FUNCTION(fbsql_result);
-PHP_FUNCTION(fbsql_next_result);
-PHP_FUNCTION(fbsql_num_rows);
-PHP_FUNCTION(fbsql_num_fields);
-PHP_FUNCTION(fbsql_fetch_row);
-PHP_FUNCTION(fbsql_fetch_array);
-PHP_FUNCTION(fbsql_fetch_assoc);
-PHP_FUNCTION(fbsql_fetch_object);
-PHP_FUNCTION(fbsql_data_seek);
-PHP_FUNCTION(fbsql_fetch_lengths);
-PHP_FUNCTION(fbsql_fetch_field);
-PHP_FUNCTION(fbsql_field_seek);
-PHP_FUNCTION(fbsql_free_result);
-PHP_FUNCTION(fbsql_field_name);
-PHP_FUNCTION(fbsql_field_table);
-PHP_FUNCTION(fbsql_field_len);
-PHP_FUNCTION(fbsql_field_type);
-PHP_FUNCTION(fbsql_field_flags);
-PHP_FUNCTION(fbsql_autocommit);
-PHP_FUNCTION(fbsql_commit);
-PHP_FUNCTION(fbsql_rollback);
-PHP_FUNCTION(fbsql_hostname);
-PHP_FUNCTION(fbsql_database);
-PHP_FUNCTION(fbsql_database_password);
-PHP_FUNCTION(fbsql_username);
-PHP_FUNCTION(fbsql_password);
-PHP_FUNCTION(fbsql_warnings);
-
-static void php_fbsql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, int result_type);
-static void php_fbsql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistant);
-
-ZEND_BEGIN_MODULE_GLOBALS(fbsql)
- long allowPersistent;
- long generateWarnings;
- long autoCommit;
- long maxPersistant;
- long maxLinks;
- long maxConnections;
- long maxResults;
- long batchSize;
- char *hostName;
- char *databaseName;
- char *databasePassword;
- char *userName;
- char *userPassword;
- long persistantCount;
- long linkCount;
- long linkIndex;
-
-ZEND_END_MODULE_GLOBALS(fbsql)
-
-#ifdef ZTS
-# define FBSQLLS_D zend_fbsql_globals *fbsql_globals
-# define FBSQLLS_DC , FBSQLLS_D
-# define FBSQLLS_C fbsql_globals
-# define FBSQLLS_CC , FBSQLLS_C
-# define FB_SQL_G(v) (fbsql_globals->v)
-# define FBSQLLS_FETCH() zend_fbsql_globals *fbsql_globals = ts_resource(fbsql_globals_id)
-#else
-# define FBSQLLS_D
-# define FBSQLLS_DC
-# define FBSQLLS_C
-# define FBSQLLS_CC
-# define FB_SQL_G(v) (fbsql_globals.v)
-# define FBSQLLS_FETCH()
-#endif
-
-
-
-//#ifndef ZTS // No need for external definitions
-//extern fbsql_module* phpfbModule;
-//#endif
-
-#else // HAVE_FBSQL
-
-#define fbsql_module_ptr NULL
-#error not ok
-#endif // HAVE_FBSQL
-
-#define phpext_fbsql_ptr fbsql_module_ptr
-
-#endif /* _PHP_FBSQL_H */
diff --git a/ext/fdf/CREDITS b/ext/fdf/CREDITS
deleted file mode 100644
index 57c33cc4b3..0000000000
--- a/ext/fdf/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-FDF
-Uwe Steinmann
diff --git a/ext/fdf/Makefile.in b/ext/fdf/Makefile.in
deleted file mode 100644
index 1f48291e1a..0000000000
--- a/ext/fdf/Makefile.in
+++ /dev/null
@@ -1,6 +0,0 @@
-
-LTLIBRARY_NAME = libfdf.la
-LTLIBRARY_SOURCES = fdf.c
-LTLIBRARY_SHARED_NAME = fdf.la
-
-include $(top_srcdir)/build/dynlib.mk
diff --git a/ext/fdf/config.m4 b/ext/fdf/config.m4
deleted file mode 100644
index 2f2cf1e076..0000000000
--- a/ext/fdf/config.m4
+++ /dev/null
@@ -1,41 +0,0 @@
-dnl $Id$
-
-PHP_ARG_WITH(fdftk, for fdftk support,
-[ --with-fdftk[=DIR] Include fdftk support])
-
-if test "$PHP_FDFTK" != "no"; then
- if test -r $PHP_FDFTK/include/FdfTk.h -o -r $PHP_FDFTK/fdftk.h; then
- FDFTK_DIR=$PHP_FDFTK
- else
- AC_MSG_CHECKING(for fdftk in default path)
- for i in /usr/local /usr; do
- if test -r $i/include/FdfTk.h -o -r $i/include/fdftk.h; then
- FDFTK_DIR=$i
- AC_MSG_RESULT(found in $i)
- fi
- done
- fi
-
- if test -z "$FDFTK_DIR"; then
- AC_MSG_RESULT(not found)
- AC_MSG_ERROR(Please reinstall the fdftk distribution)
- fi
-
- PHP_ADD_INCLUDE($FDFTK_DIR/include)
-
- FDFLIBRARY=""
- for i in fdftk FdfTk; do
- AC_CHECK_LIB($i, FDFOpen, [FDFLIBRARY=$i], [], [-L$FDFTK_DIR/lib -lm])
- done
-
- if test $FDFLIBRARY = ""; then
- AC_MSG_ERROR(fdftk module requires fdftk 2.0)
- fi
-
- AC_DEFINE(HAVE_FDFLIB,1,[ ])
- PHP_ADD_LIBRARY_WITH_PATH($FDFLIBRARY, $FDFTK_DIR/lib, FDFTK_SHARED_LIBADD)
-
- PHP_SUBST(FDFTK_SHARED_LIBADD)
- PHP_EXTENSION(fdf, $ext_shared)
-fi
-
diff --git a/ext/fdf/fdf.c b/ext/fdf/fdf.c
deleted file mode 100644
index 78a08c3c91..0000000000
--- a/ext/fdf/fdf.c
+++ /dev/null
@@ -1,769 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Uwe Steinmann <Uwe.Steinmann@fernuni-hagen.de> |
- | Hartmut Holzgraefe <hartmut@six.de> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-/* FdfTk lib 2.0 is a Complete C/C++ FDF Toolkit available from
- http://beta1.adobe.com/ada/acrosdk/forms.html. */
-
-/* Note that there is no code from the FdfTk lib in this file */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-
-#if HAVE_FDFLIB
-
-#include "SAPI.h"
-#include "ext/standard/info.h"
-#include "php_open_temporary_file.h"
-#include "php_variables.h"
-#include "php_fdf.h"
-
-static int le_fdf;
-
-SAPI_POST_HANDLER_FUNC(fdf_post_handler);
-
-/* {{{ fdf_functions[]
- */
-function_entry fdf_functions[] = {
- PHP_FE(fdf_open, NULL)
- PHP_FE(fdf_create, NULL)
- PHP_FE(fdf_close, NULL)
- PHP_FE(fdf_save, NULL)
- PHP_FE(fdf_get_value, NULL)
- PHP_FE(fdf_set_value, NULL)
- PHP_FE(fdf_next_field_name, NULL)
- PHP_FE(fdf_set_ap, NULL)
- PHP_FE(fdf_set_status, NULL)
- PHP_FE(fdf_get_status, NULL)
- PHP_FE(fdf_set_file, NULL)
- PHP_FE(fdf_get_file, NULL)
- PHP_FE(fdf_add_template, NULL)
- PHP_FE(fdf_set_flags, NULL)
- PHP_FE(fdf_set_opt, NULL)
- PHP_FE(fdf_set_submit_form_action, NULL)
- PHP_FE(fdf_set_javascript_action, NULL)
- {NULL, NULL, NULL}
-};
-/* }}} */
-
-zend_module_entry fdf_module_entry = {
- "fdf",
- fdf_functions,
- PHP_MINIT(fdf),
- PHP_MSHUTDOWN(fdf),
- NULL,
- NULL,
- PHP_MINFO(fdf),
- STANDARD_MODULE_PROPERTIES
-};
-
-#ifdef COMPILE_DL_FDF
-ZEND_GET_MODULE(fdf)
-#endif
-
-
-static void phpi_FDFClose(zend_rsrc_list_entry *rsrc)
-{
- FDFDoc fdf = (FDFDoc)rsrc->ptr;
- (void) FDFClose(fdf);
-}
-
-
-#define FDF_POST_CONTENT_TYPE "application/vnd.fdf"
-
-static sapi_post_entry php_fdf_post_entry = {
- FDF_POST_CONTENT_TYPE,
- sizeof(FDF_POST_CONTENT_TYPE)-1,
- sapi_read_standard_form_data,
- fdf_post_handler
-};
-
-/* {{{ PHP_MINIT_FUNCTION
- */
-PHP_MINIT_FUNCTION(fdf)
-{
- FDFErc err;
-
- le_fdf = zend_register_list_destructors_ex(phpi_FDFClose, NULL, "fdf", module_number);
-
- /* add handler for Acrobat FDF form post requests */
- sapi_register_post_entry(&php_fdf_post_entry);
-
-
- /* Constants used by fdf_set_opt() */
- REGISTER_LONG_CONSTANT("FDFValue", FDFValue, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FDFStatus", FDFStatus, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FDFFile", FDFFile, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FDFID", FDFID, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FDFFf", FDFFf, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FDFSetFf", FDFSetFf, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FDFClearFf", FDFClearFf, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FDFFlags", FDFFlags, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FDFSetF", FDFSetF, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FDFClrF", FDFClrF, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FDFAP", FDFAP, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FDFAS", FDFAS, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FDFAction", FDFAction, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FDFAA", FDFAA, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FDFAPRef", FDFAPRef, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FDFIF", FDFIF, CONST_CS | CONST_PERSISTENT);
-
- /* Constants used by fdf_set_javascript_action() */
- REGISTER_LONG_CONSTANT("FDFEnter", FDFEnter, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FDFExit", FDFExit, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FDFDown", FDFDown, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FDFUp", FDFUp, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FDFFormat", FDFFormat, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FDFValidate", FDFValidate, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FDFKeystroke", FDFKeystroke, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FDFCalculate", FDFCalculate, CONST_CS | CONST_PERSISTENT);
-
-#ifdef PHP_WIN32
- return SUCCESS;
-#endif
- if((err = FDFInitialize()) == FDFErcOK) return SUCCESS;
- return FAILURE;
-}
-/* }}} */
-
-/* {{{ PHP_MINFO_FUNCTION
- */
-PHP_MINFO_FUNCTION(fdf)
-{
- /* need to use a PHPAPI function here because it is external module in windows */
- php_info_print_table_start();
- php_info_print_table_row(2, "FDF Support", "enabled");
- php_info_print_table_row(2, "FdfTk Version", FDFGetVersion() );
- php_info_print_table_end();
-}
-/* }}} */
-
-/* {{{ PHP_MSHUTDOWN_FUNCTION
- */
-PHP_MSHUTDOWN_FUNCTION(fdf)
-{
- FDFErc err;
-
- /* remove handler for Acrobat FDF form post requests */
- sapi_unregister_post_entry(&php_fdf_post_entry);
-
-#ifdef PHP_WIN32
- return SUCCESS;
-#endif
- if((err = FDFFinalize()) == FDFErcOK) return SUCCESS;
- return FAILURE;
-}
-/* }}} */
-
-/* {{{ proto int fdf_open(string filename)
- Opens a new FDF document */
-PHP_FUNCTION(fdf_open)
-{
- zval **file;
- FDFDoc fdf;
- FDFErc err;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &file) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(file);
-
- err = FDFOpen(Z_STRVAL_PP(file), 0, &fdf);
-
- if(err != FDFErcOK || !fdf) {
- php_error(E_WARNING, "Could not open fdf document: %s", Z_STRVAL_PP(file));
- RETURN_FALSE;
- }
-
- ZEND_REGISTER_RESOURCE(return_value, fdf, le_fdf);
-}
-/* }}} */
-
-/* {{{ proto int fdf_create(void)
- Creates a new FDF document */
-PHP_FUNCTION(fdf_create)
-{
- FDFDoc fdf;
- FDFErc err;
-
- err = FDFCreate(&fdf);
-
- if(err != FDFErcOK || !fdf) {
- php_error(E_WARNING, "Error creating new fdf document!");
- RETURN_FALSE;
- }
-
- ZEND_REGISTER_RESOURCE(return_value, fdf, le_fdf);
-}
-/* }}} */
-
-/* {{{ proto bool fdf_close(int fdfdoc)
- Closes the FDF document */
-PHP_FUNCTION(fdf_close)
-{
- zval **fdfp;
- FDFDoc fdf;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &fdfp) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(fdf, FDFDoc *, fdfp, -1, "fdf", le_fdf);
- zend_list_delete(Z_RESVAL_PP(fdfp));
-}
-/* }}} */
-
-/* {{{ proto string fdf_get_value(int fdfdoc, string fieldname)
- Gets the value of a field as string */
-PHP_FUNCTION(fdf_get_value)
-{
- zval **fdfp, **fieldname;
- ASInt32 nr, size = 256;
- char *buffer;
- FDFDoc fdf;
- FDFErc err;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &fdfp, &fieldname) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(fdf, FDFDoc *, fdfp, -1, "fdf", le_fdf);
-
- convert_to_string_ex(fieldname);
-
- buffer = emalloc(size);
- err = FDFGetValue(fdf, Z_STRVAL_PP(fieldname), buffer, size-1, &nr);
- if(err == FDFErcBufTooShort && nr > 0 ) {
- buffer = erealloc(buffer,nr+1);
- err = FDFGetValue(fdf, Z_STRVAL_PP(fieldname), buffer, nr, &nr);
- }
-
- if(err != FDFErcOK) {
- php_error(E_WARNING, "Error getting value of %s", Z_STRVAL_PP(fieldname));
- efree(buffer);
- RETURN_FALSE;
- }
-
- RETVAL_STRING(buffer, 1);
- efree(buffer);
-}
-/* }}} */
-
-/* {{{ proto bool fdf_set_value(int fdfdoc, string fieldname, string value, int isname)
- Sets the value of a field */
-PHP_FUNCTION(fdf_set_value)
-{
- zval **fdfp, **fieldname, **value, **isname;
- FDFDoc fdf;
- FDFErc err;
-
- if (ZEND_NUM_ARGS() != 4 || zend_get_parameters_ex(4, &fdfp, &fieldname, &value, &isname) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(fdf, FDFDoc *, fdfp, -1, "fdf", le_fdf);
-
- convert_to_string_ex(fieldname);
- convert_to_string_ex(value);
- convert_to_long_ex(isname);
-
- err = FDFSetValue(fdf, Z_STRVAL_PP(fieldname), Z_STRVAL_PP(value), (ASBool) Z_LVAL_PP(isname));
- if(err != FDFErcOK) {
- php_error(E_WARNING, "Error setting field: %s to value: %s", Z_STRVAL_PP(fieldname), Z_STRVAL_PP(value));
- RETURN_FALSE;
- }
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto string fdf_next_field_name(int fdfdoc [, string fieldname])
- Gets the name of the next field name or the first field name */
-PHP_FUNCTION(fdf_next_field_name)
-{
- zval **fdfp, **field;
- int argc=ZEND_NUM_ARGS();
- ASInt32 length=256, nr;
- char *buffer=NULL, *fieldname=NULL;
- FDFDoc fdf;
- FDFErc err;
-
- if (argc > 2 || argc < 1 || zend_get_parameters_ex(argc, &fdfp, &field) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(fdf, FDFDoc *, fdfp, -1, "fdf", le_fdf);
-
- if(argc == 2) {
- convert_to_string_ex(field);
- fieldname = Z_STRVAL_PP(field);
- }
-
- buffer = emalloc(length);
- err = FDFNextFieldName(fdf, fieldname, buffer, length-1, &nr);
-
- if(err == FDFErcBufTooShort && nr > 0 ) {
- buffer = erealloc(buffer,nr+1);
- err = FDFNextFieldName(fdf, fieldname, buffer, length-1,&nr);
- }
-
- if(err != FDFErcOK) {
- efree(buffer);
- php_error(E_WARNING,"Error getting next fieldname!");
- RETURN_FALSE;
- }
-
- RETVAL_STRING(buffer, 1);
- efree(buffer);
-}
-/* }}} */
-
-/* {{{ proto bool fdf_set_ap(int fdfdoc, string fieldname, int face, string filename, int pagenr)
- Sets the appearence of a field */
-PHP_FUNCTION(fdf_set_ap)
-{
- zval **fdfp, **fieldname, **face, **filename, **pagenr;
- FDFDoc fdf;
- FDFErc err;
- FDFAppFace facenr;
-
- if (ZEND_NUM_ARGS() != 5 || zend_get_parameters_ex(5, &fdfp, &fieldname, &face, &filename, &pagenr) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(fdf, FDFDoc *, fdfp, -1, "fdf", le_fdf);
-
- convert_to_string_ex(fieldname);
- convert_to_long_ex(face);
- convert_to_string_ex(filename);
- convert_to_long_ex(pagenr);
-
- switch(Z_LVAL_PP(face)) {
- case 1:
- facenr = FDFNormalAP;
- break;
- case 2:
- facenr = FDFRolloverAP;
- break;
- case 3:
- facenr = FDFDownAP;
- break;
- default:
- facenr = FDFNormalAP;
- }
-
- err = FDFSetAP(fdf, Z_STRVAL_PP(fieldname), facenr, NULL, Z_STRVAL_PP(filename), (ASInt32) Z_LVAL_PP(pagenr));
-
- /* This should be made more intelligent, ie. use switch() with the
- possible errors this function can return. Or create global error handler function.
- */
- if(err != FDFErcOK) {
- php_error(E_WARNING,"Error setting appearence of field: %s", Z_STRVAL_PP(fieldname));
- RETURN_FALSE;
- }
-
- RETURN_TRUE;
-
-}
-/* }}} */
-
-/* {{{ proto bool fdf_set_status(int fdfdoc, string status)
- Sets the value of /Status key */
-PHP_FUNCTION(fdf_set_status)
-{
- zval **fdfp, **status;
- FDFDoc fdf;
- FDFErc err;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &fdfp, &status) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(fdf, FDFDoc *, fdfp, -1, "fdf", le_fdf);
-
- convert_to_string_ex(status);
-
- err = FDFSetStatus(fdf, Z_STRVAL_PP(status));
- if(err != FDFErcOK) {
- php_error(E_WARNING,"Error setting fdf document status key to: %s", Z_STRVAL_PP(status));
- RETURN_FALSE;
- }
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto string fdf_get_status(int fdfdoc)
- Gets the value of /Status key */
-PHP_FUNCTION(fdf_get_status)
-{
- zval **fdfp;
- ASInt32 nr, size = 256;
- char *buf;
- FDFDoc fdf;
- FDFErc err;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &fdfp) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(fdf, FDFDoc *, fdfp, -1, "fdf", le_fdf);
-
- buf = emalloc(size);
- err = FDFGetStatus(fdf, buf, size-1, &nr);
-
- if(err == FDFErcBufTooShort && nr > 0 ) {
- buf = erealloc(buf,nr+1);
- err = FDFGetStatus(fdf, buf, size-1, &nr);
- }
-
- if(err != FDFErcOK) {
- php_error(E_WARNING,"Error getting fdf document status key!");
- efree(buf);
- RETURN_FALSE;
- }
-
- RETVAL_STRING(buf, 1);
- efree(buf);
-}
-/* }}} */
-
-/* {{{ proto bool fdf_set_file(int fdfdoc, string filename)
- Sets the value of /F key */
-PHP_FUNCTION(fdf_set_file)
-{
- zval **fdfp, **filename;
- FDFDoc fdf;
- FDFErc err;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &fdfp, &filename) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(fdf, FDFDoc *, fdfp, -1, "fdf", le_fdf);
-
- convert_to_string_ex(filename);
-
- err = FDFSetFile(fdf, Z_STRVAL_PP(filename));
- if(err != FDFErcOK) {
- php_error(E_WARNING,"Error setting filename key to: %s", Z_STRVAL_PP(filename));
- RETURN_FALSE;
- }
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto string fdf_get_file(int fdfdoc)
- Gets the value of /F key */
-PHP_FUNCTION(fdf_get_file)
-{
- zval **fdfp;
- ASInt32 nr, size = 256;
- char *buf;
- FDFDoc fdf;
- FDFErc err;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &fdfp) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(fdf, FDFDoc *, fdfp, -1, "fdf", le_fdf);
-
- buf = emalloc(size);
- err = FDFGetFile(fdf, buf, size-1, &nr);
-
- if(err == FDFErcBufTooShort && nr > 0 ) {
- buf = erealloc(buf,nr+1);
- err = FDFGetFile(fdf, buf, size-1, &nr);
- }
-
- if(err != FDFErcOK) {
- php_error(E_WARNING,"Error getting fdf document filename key!");
- efree(buf);
- RETURN_FALSE;
- }
-
- RETVAL_STRING(buf, 1);
- efree(buf);
-}
-/* }}} */
-
-/* {{{ proto bool fdf_save(int fdfdoc, string filename)
- Writes out the FDF file */
-PHP_FUNCTION(fdf_save)
-{
- zval **fdfp, **filename;
- FDFDoc fdf;
- FDFErc err;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &fdfp, &filename) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(fdf, FDFDoc *, fdfp, -1, "fdf", le_fdf);
-
- convert_to_string_ex(filename);
- err = FDFSave(fdf, Z_STRVAL_PP(filename));
- if(err != FDFErcOK) {
- php_error(E_WARNING,"Error saving fdf document into filename: %s", Z_STRVAL_PP(filename));
- RETURN_FALSE;
- }
-
- RETURN_TRUE;
-
-}
-/* }}} */
-
-/* {{{ proto bool fdf_add_template(int fdfdoc, int newpage, string filename, string template, int rename)
- Adds a template into the FDF document */
-PHP_FUNCTION(fdf_add_template)
-{
- zval **fdfp, **newpage, **filename, **template, **rename;
- FDFDoc fdf;
- FDFErc err;
- pdfFileSpecRec filespec;
-
- if (ZEND_NUM_ARGS() != 5 || zend_get_parameters_ex(5, &fdfp, &newpage, &filename, &template, &rename) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(fdf, FDFDoc *, fdfp, -1, "fdf", le_fdf);
-
- convert_to_long_ex(newpage);
- convert_to_string_ex(filename);
- convert_to_string_ex(template);
- convert_to_long_ex(rename);
-
- filespec.FS = NULL;
- filespec.F = Z_STRVAL_PP(filename);
- filespec.Mac = NULL;
- filespec.DOS = NULL;
- filespec.Unix = NULL;
- filespec.ID[0] = NULL;
- filespec.ID[1] = NULL;
- filespec.bVolatile = false;
-
- err = FDFAddTemplate(fdf, Z_LVAL_PP(newpage), &filespec, Z_STRVAL_PP(template), Z_LVAL_PP(rename));
- if(err != FDFErcOK) {
- php_error(E_WARNING,"Error adding template: %s into fdf document", Z_STRVAL_PP(template));
- RETURN_FALSE;
- }
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool fdf_set_flags(int fdfdoc, string fieldname, int whichflags, int newflags)
- Sets flags for a field in the FDF document */
-PHP_FUNCTION(fdf_set_flags)
-{
- zval **fdfp, **fieldname, **flags, **newflags;
- FDFDoc fdf;
- FDFErc err;
-
- if (ZEND_NUM_ARGS() != 4 || zend_get_parameters_ex(4, &fdfp, &fieldname, &flags, &newflags) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(fdf, FDFDoc *, fdfp, -1, "fdf", le_fdf);
-
- convert_to_string_ex(fieldname);
- convert_to_long_ex(flags);
- convert_to_long_ex(newflags);
-
- err=FDFSetFlags(fdf,Z_STRVAL_PP(fieldname), Z_LVAL_PP(flags), Z_LVAL_PP(newflags));
- if(err != FDFErcOK) {
- php_error(E_WARNING,"Error setting flags for field: %s", Z_STRVAL_PP(fieldname));
- RETURN_FALSE;
- }
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool fdf_set_opt(int fdfdoc, string fieldname, int element, string value, string name)
- Sets a value in the opt array for a field */
-PHP_FUNCTION(fdf_set_opt)
-{
- zval **fdfp, **fieldname, **element, **value, **name;
- FDFDoc fdf;
- FDFErc err;
-
- if (ZEND_NUM_ARGS() != 5 || zend_get_parameters_ex(5, &fdfp, &fieldname, &element, &value, &name) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(fdf, FDFDoc *, fdfp, -1, "fdf", le_fdf);
-
- convert_to_string_ex(fieldname);
- convert_to_long_ex(element);
- convert_to_string_ex(value);
- convert_to_string_ex(name);
-
- err = FDFSetOpt(fdf,Z_STRVAL_PP(fieldname), Z_LVAL_PP(element), Z_STRVAL_PP(value), Z_STRVAL_PP(name));
- if(err != FDFErcOK) {
- php_error(E_WARNING,"Error setting FDF option for field: %s", Z_STRVAL_PP(fieldname));
- RETURN_FALSE;
- }
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool fdf_set_submit_form_action(int fdfdoc, string fieldname, int whichtrigger, string url, int flags)
- Sets the submit form action for a field */
-PHP_FUNCTION(fdf_set_submit_form_action)
-{
- zval **fdfp, **fieldname, **trigger, **url, **flags;
- FDFDoc fdf;
- FDFErc err;
-
- if (ZEND_NUM_ARGS() != 5 || zend_get_parameters_ex(5, &fdfp, &fieldname, &trigger, &url, &flags) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(fdf, FDFDoc *, fdfp, -1, "fdf", le_fdf);
-
- convert_to_string_ex(fieldname);
- convert_to_long_ex(trigger);
- convert_to_string_ex(url);
- convert_to_long_ex(flags);
-
- err = FDFSetSubmitFormAction(fdf, Z_STRVAL_PP(fieldname), Z_LVAL_PP(trigger), Z_STRVAL_PP(url), Z_LVAL_PP(flags));
- if(err != FDFErcOK) {
- php_error(E_WARNING,"Error setting FDF submit action for field: %s", Z_STRVAL_PP(fieldname));
- RETURN_FALSE;
- }
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool fdf_set_javascript_action(int fdfdoc, string fieldname, int whichtrigger, string script)
- Sets the javascript action for a field */
-PHP_FUNCTION(fdf_set_javascript_action)
-{
- zval **fdfp, **fieldname, **trigger, **script;
- FDFDoc fdf;
- FDFErc err;
-
- if (ZEND_NUM_ARGS() != 4 || zend_get_parameters_ex(4, &fdfp, &fieldname, &trigger, &script) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(fdf, FDFDoc *, fdfp, -1, "fdf", le_fdf);
-
- convert_to_string_ex(fieldname);
- convert_to_long_ex(trigger);
- convert_to_string_ex(script);
-
- err = FDFSetJavaScriptAction(fdf, Z_STRVAL_PP(fieldname), Z_LVAL_PP(trigger), Z_STRVAL_PP(script));
- if(err != FDFErcOK) {
- php_error(E_WARNING,"Error setting FDF javascript action for field: %s", Z_STRVAL_PP(fieldname));
- RETURN_FALSE;
- }
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ SAPI_POST_HANDLER_FUNC
- * SAPI post handler for FDF forms */
-SAPI_POST_HANDLER_FUNC(fdf_post_handler)
-{
- FILE *fp;
- FDFDoc theFDF;
- char *name=NULL,*value=NULL,*p, *data;
- int name_len=0,value_len=0;
- char *lastfieldname =NULL;
- char *filename = NULL;
- FDFErc err;
- ASInt32 nBytes;
- zval *array_ptr = (zval *) arg;
- ELS_FETCH();
- PLS_FETCH();
-
- fp=php_open_temporary_file(NULL,"fdfdata.",&filename);
- if(!fp) {
- if(filename) efree(filename);
- return;
- }
- fwrite(SG(request_info).post_data,SG(request_info).post_data_length,1,fp);
- fclose(fp);
-
- /* Set HTTP_FDF_DATA variable */
- data = estrndup(SG(request_info).post_data,SG(request_info).post_data_length);
- SET_VAR_STRINGL("HTTP_FDF_DATA", data, SG(request_info).post_data_length);
-
- err = FDFOpen(filename,0,&theFDF);
-
- if(err==FDFErcOK){
- name = emalloc(name_len=256);
- value= emalloc(value_len=256);
- while (1) {
- err = FDFNextFieldName(theFDF,lastfieldname,name,name_len-1,&nBytes);
- if(err == FDFErcBufTooShort && nBytes >0 ) {
- name = erealloc(name,name_len=(nBytes+1));
- err = FDFNextFieldName(theFDF,lastfieldname,name,name_len-1,&nBytes);
- }
-
- if(err != FDFErcOK || nBytes == 0) break;
-
- if(lastfieldname) efree(lastfieldname);
- lastfieldname = estrdup(name);
-
- err = FDFGetValue(theFDF,name,NULL,0,&nBytes);
- if(err != FDFErcOK && err != FDFErcNoValue ) break;
-
- if(value_len<nBytes+1) value = erealloc(value,value_len=(nBytes+1));
-
- if(nBytes>0) {
- err = FDFGetValue(theFDF,name,value,value_len-1,&nBytes);
- if(err == FDFErcOK && nBytes != 0) {
- for(p=value;*p;p++) if(*p=='\r') *p='\n';
- if(lastfieldname) efree(lastfieldname);
- lastfieldname = estrdup(name);
- php_register_variable(name, value, array_ptr ELS_CC PLS_CC);
- }
- }
- }
-
- FDFClose(theFDF);
- VCWD_UNLINK((const char *)filename);
- efree(filename);
-
- if(name) efree(name);
- if(value) efree(value);
- if(lastfieldname) efree(lastfieldname);
- }
-}
-/* }}} */
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/fdf/fdf.dsp b/ext/fdf/fdf.dsp
deleted file mode 100644
index b570d1195a..0000000000
--- a/ext/fdf/fdf.dsp
+++ /dev/null
@@ -1,114 +0,0 @@
-# Microsoft Developer Studio Project File - Name="fdf" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=fdf - Win32 Release_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "fdf.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "fdf.mak" CFG="fdf - Win32 Release_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "fdf - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "fdf - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "fdf - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\..\TSRM" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_FDF" /D ZTS=1 /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /I "..\..\main" /D ZEND_DEBUG=0 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_FDF" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_FDFLIB=1 /D "SAPI_EXPORTS" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x406 /d "NDEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib /nologo /dll /machine:I386
-# ADD LINK32 php4ts.lib fdftk.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_fdf.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
-# SUBTRACT LINK32 /pdb:none
-
-!ELSEIF "$(CFG)" == "fdf - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /I "mssql-70" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_FDF" /D ZTS=1 /YX /FD /c
-# ADD CPP /nologo /MDd /W3 /GX /ZI /Od /I "..\.." /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /I "..\..\main" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_FDF" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_FDFLIB=1 /D "SAPI_EXPORTS" /FR /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x406 /d "NDEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts_debug.lib /nologo /dll /machine:I386
-# ADD LINK32 php4ts_debug.lib fdftk.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /incremental:yes /debug /machine:I386 /out:"..\..\Debug_TS/php_fdf.dll" /libpath:"..\..\Debug_TS"
-
-!ENDIF
-
-# Begin Target
-
-# Name "fdf - Win32 Release_TS"
-# Name "fdf - Win32 Debug_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\fdf.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_fdf.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/ext/fdf/php_fdf.h b/ext/fdf/php_fdf.h
deleted file mode 100644
index e475fbe5a4..0000000000
--- a/ext/fdf/php_fdf.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Uwe Steinmann |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef PHP_FDF_H
-#define PHP_FDF_H
-
-#if HAVE_FDFLIB
-#ifdef PHP_WIN32
-#else
-#define UNIX_DEV
-#endif
-
-#include <FdfTk.h>
-
-extern zend_module_entry fdf_module_entry;
-#define fdf_module_ptr &fdf_module_entry
-
-PHP_MINIT_FUNCTION(fdf);
-PHP_MSHUTDOWN_FUNCTION(fdf);
-PHP_MINFO_FUNCTION(fdf);
-
-PHP_FUNCTION(fdf_open);
-PHP_FUNCTION(fdf_close);
-PHP_FUNCTION(fdf_create);
-PHP_FUNCTION(fdf_save);
-PHP_FUNCTION(fdf_get_value);
-PHP_FUNCTION(fdf_set_value);
-PHP_FUNCTION(fdf_next_field_name);
-PHP_FUNCTION(fdf_set_ap);
-PHP_FUNCTION(fdf_get_status);
-PHP_FUNCTION(fdf_set_status);
-PHP_FUNCTION(fdf_set_file);
-PHP_FUNCTION(fdf_get_file);
-PHP_FUNCTION(fdf_add_template);
-PHP_FUNCTION(fdf_set_flags);
-PHP_FUNCTION(fdf_set_opt);
-PHP_FUNCTION(fdf_set_submit_form_action);
-PHP_FUNCTION(fdf_set_javascript_action);
-
-#else
-#define fdf_module_ptr NULL
-#endif
-#define phpext_fdf_ptr fdf_module_ptr
-#endif /* PHP_FDF_H */
diff --git a/ext/fdf/setup.stub b/ext/fdf/setup.stub
deleted file mode 100644
index 9637713bde..0000000000
--- a/ext/fdf/setup.stub
+++ /dev/null
@@ -1,7 +0,0 @@
-# $Source$
-# $Id$
-
-define_option with-fdftk 'Acrobat Forms (Ftf Toolkit 2.0) support? ' yesnodir \
- 'no /usr/local ftktk install' \
-' Whether to use the Ftf Toolkit support to write/read .fdf-files.\n
- Tested for version 2.0!'
diff --git a/ext/filepro/CREDITS b/ext/filepro/CREDITS
deleted file mode 100644
index c272432c04..0000000000
--- a/ext/filepro/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-FilePro
-Chad Robinson
diff --git a/ext/filepro/Makefile.in b/ext/filepro/Makefile.in
deleted file mode 100644
index 8fe3a41a93..0000000000
--- a/ext/filepro/Makefile.in
+++ /dev/null
@@ -1,6 +0,0 @@
-
-LTLIBRARY_NAME = libfilepro.la
-LTLIBRARY_SOURCES = filepro.c
-LTLIBRARY_SHARED_NAME = filepro.la
-
-include $(top_srcdir)/build/dynlib.mk
diff --git a/ext/filepro/config.m4 b/ext/filepro/config.m4
deleted file mode 100644
index 314fbd1aaf..0000000000
--- a/ext/filepro/config.m4
+++ /dev/null
@@ -1,11 +0,0 @@
-dnl $Id$
-
-AC_ARG_WITH(filepro,[],[enable_filepro=$withval])
-
-PHP_ARG_ENABLE(filepro,whether to enable the bundled filePro support,
-[ --enable-filepro Enable the bundled read-only filePro support])
-
-if test "$PHP_FILEPRO" = "yes"; then
- AC_DEFINE(HAVE_FILEPRO, 1, [ ])
- PHP_EXTENSION(filepro, $ext_shared)
-fi
diff --git a/ext/filepro/filepro.c b/ext/filepro/filepro.c
deleted file mode 100644
index df66a449a5..0000000000
--- a/ext/filepro/filepro.c
+++ /dev/null
@@ -1,577 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Chad Robinson <chadr@brttech.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-/*
- filePro 4.x support developed by Chad Robinson, chadr@brttech.com
- Contact Chad Robinson at BRT Technical Services Corp. for details.
- filePro is a registered trademark by Fiserv, Inc. This file contains
- no code or information that is not freely available from the filePro
- web site at http://www.fileproplus.com/
-*/
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "safe_mode.h"
-#include "fopen_wrappers.h"
-#include <string.h>
-#ifdef PHP_WIN32
-#include <windows.h>
-#else
-#include <sys/param.h>
-#endif
-#include <errno.h>
-#include "php_globals.h"
-
-#include "php_filepro.h"
-#if HAVE_FILEPRO
-
-typedef struct fp_field {
- char *name;
- char *format;
- int width;
- struct fp_field *next;
-} FP_FIELD;
-
-#ifdef THREAD_SAFE
-DWORD FPTls;
-static int numthreads=0;
-
-typedef struct fp_global_struct{
- char *fp_database;
- signed int fp_fcount;
- signed int fp_keysize;
- FP_FIELD *fp_fieldlist;
-}fp_global_struct;
-
-#define FP_GLOBAL(a) fp_globals->a
-
-#define FP_TLS_VARS \
- fp_global_struct *fp_globals; \
- fp_globals=TlsGetValue(FPTls);
-
-#else
-#define FP_GLOBAL(a) a
-#define FP_TLS_VARS
-static char *fp_database = NULL; /* Database directory */
-static signed int fp_fcount = -1; /* Column count */
-static signed int fp_keysize = -1; /* Size of key records */
-static FP_FIELD *fp_fieldlist = NULL; /* List of fields */
-#endif
-
-/* {{{ PHP_MINIT_FUNCTION
- */
-PHP_MINIT_FUNCTION(filepro)
-{
-#ifdef THREAD_SAFE
- fp_global_struct *fp_globals;
-#ifdef COMPILE_DL_FILEPRO
- CREATE_MUTEX(fp_mutex,"FP_TLS");
- SET_MUTEX(fp_mutex);
- numthreads++;
- if (numthreads==1){
- if ((FPTls=TlsAlloc())==0xFFFFFFFF){
- FREE_MUTEX(fp_mutex);
- return 0;
- }}
- FREE_MUTEX(fp_mutex);
-#endif
- fp_globals = (fp_global_struct *) LocalAlloc(LPTR, sizeof(fp_global_struct));
- TlsSetValue(FPTls, (void *) fp_globals);
-#endif
- FP_GLOBAL(fp_database)=NULL;
- FP_GLOBAL(fp_fcount)=-1;
- FP_GLOBAL(fp_keysize)=-1;
- FP_GLOBAL(fp_fieldlist)=NULL;
-
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_MSHUTDOWN_FUNCTION
- */
-PHP_MSHUTDOWN_FUNCTION(filepro)
-{
-#ifdef THREAD_SAFE
- fp_global_struct *fp_globals;
- fp_globals = TlsGetValue(FPTls);
- if (fp_globals != 0)
- LocalFree((HLOCAL) fp_globals);
-#ifdef COMPILE_DL_FILEPRO
- SET_MUTEX(fp_mutex);
- numthreads--;
- if (!numthreads){
- if (!TlsFree(FPTls)){
- FREE_MUTEX(fp_mutex);
- return 0;
- }}
- FREE_MUTEX(fp_mutex);
-#endif
-#endif
- return SUCCESS;
-}
-/* }}} */
-
-function_entry filepro_functions[] = {
- PHP_FE(filepro, NULL)
- PHP_FE(filepro_rowcount, NULL)
- PHP_FE(filepro_fieldname, NULL)
- PHP_FE(filepro_fieldtype, NULL)
- PHP_FE(filepro_fieldwidth, NULL)
- PHP_FE(filepro_fieldcount, NULL)
- PHP_FE(filepro_retrieve, NULL)
- {NULL, NULL, NULL}
-};
-
-zend_module_entry filepro_module_entry = {
- "filepro", filepro_functions, PHP_MINIT(filepro), PHP_MSHUTDOWN(filepro), NULL, NULL, NULL, STANDARD_MODULE_PROPERTIES
-};
-
-
-#ifdef COMPILE_DL_FILEPRO
-ZEND_GET_MODULE(filepro)
-#if (WIN32|WINNT) && defined(THREAD_SAFE)
-
-/*NOTE: You should have an odbc.def file where you
-export DllMain*/
-BOOL WINAPI DllMain(HANDLE hModule,
- DWORD ul_reason_for_call,
- LPVOID lpReserved)
-{
- switch( ul_reason_for_call ) {
- case DLL_PROCESS_ATTACH:
- if ((FPTls=TlsAlloc())==0xFFFFFFFF){
- return 0;
- }
- break;
- case DLL_THREAD_ATTACH:
- break;
- case DLL_THREAD_DETACH:
- break;
- case DLL_PROCESS_DETACH:
- if (!TlsFree(FPTls)){
- return 0;
- }
- break;
- }
- return 1;
-}
-#endif
-#endif
-
-/*
- * LONG filePro(STRING directory)
- *
- * Read and verify the map file. We store the field count and field info
- * internally, which means we become unstable if you modify the table while
- * a user is using it! We cannot lock anything since Web connections don't
- * provide the ability to later unlock what we locked. Be smart, be safe.
- */
-/* {{{ proto bool filepro(string directory)
- Read and verify the map file */
-PHP_FUNCTION(filepro)
-{
- pval *dir;
- FILE *fp;
- char workbuf[256]; /* FIX - should really be the max filename length */
- char readbuf[256];
- char *strtok_buf = NULL;
- int i;
- FP_FIELD *new_field, *tmp;
- PLS_FETCH();
- FP_TLS_VARS;
-
- if (ZEND_NUM_ARGS() != 1 || getParameters(ht, 1, &dir) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string(dir);
-
- /* FIX - we should really check and free these if they are used! */
- FP_GLOBAL(fp_database) = NULL;
- FP_GLOBAL(fp_fieldlist) = NULL;
- FP_GLOBAL(fp_fcount) = -1;
- FP_GLOBAL(fp_keysize) = -1;
-
- sprintf(workbuf, "%s/map", dir->value.str.val);
-
- if (PG(safe_mode) && (!php_checkuid(workbuf, NULL, CHECKUID_CHECK_FILE_AND_DIR))) {
- RETURN_FALSE;
- }
-
- if (php_check_open_basedir(workbuf)) {
- RETURN_FALSE;
- }
-
- if (!(fp = VCWD_FOPEN(workbuf, "r"))) {
- php_error(E_WARNING, "filePro: cannot open map: [%d] %s",
- errno, strerror(errno));
- RETURN_FALSE;
- }
- if (!fgets(readbuf, 250, fp)) {
- fclose(fp);
- php_error(E_WARNING, "filePro: cannot read map: [%d] %s",
- errno, strerror(errno));
- RETURN_FALSE;
- }
-
- /* Get the field count, assume the file is readable! */
- if (strcmp(php_strtok_r(readbuf, ":", &strtok_buf), "map")) {
- php_error(E_WARNING, "filePro: map file corrupt or encrypted");
- RETURN_FALSE;
- }
- FP_GLOBAL(fp_keysize) = atoi(php_strtok_r(NULL, ":", &strtok_buf));
- php_strtok_r(NULL, ":", &strtok_buf);
- FP_GLOBAL(fp_fcount) = atoi(php_strtok_r(NULL, ":", &strtok_buf));
-
- /* Read in the fields themselves */
- for (i = 0; i < FP_GLOBAL(fp_fcount); i++) {
- if (!fgets(readbuf, 250, fp)) {
- fclose(fp);
- php_error(E_WARNING, "filePro: cannot read map: [%d] %s",
- errno, strerror(errno));
- RETURN_FALSE;
- }
- new_field = emalloc(sizeof(FP_FIELD));
- new_field->next = NULL;
- new_field->name = estrdup(php_strtok_r(readbuf, ":", &strtok_buf));
- new_field->width = atoi(php_strtok_r(NULL, ":", &strtok_buf));
- new_field->format = estrdup(php_strtok_r(NULL, ":", &strtok_buf));
-
- /* Store in forward-order to save time later */
- if (!FP_GLOBAL(fp_fieldlist)) {
- FP_GLOBAL(fp_fieldlist) = new_field;
- } else {
- for (tmp = FP_GLOBAL(fp_fieldlist); tmp; tmp = tmp->next) {
- if (!tmp->next) {
- tmp->next = new_field;
- tmp = new_field;
- }
- }
- }
- }
- fclose(fp);
-
- FP_GLOBAL(fp_database) = estrndup(dir->value.str.val,dir->value.str.len);
-
- RETVAL_TRUE;
-}
-/* }}} */
-
-
-/*
- * LONG filePro_rowcount(void)
- *
- * Count the used rows in the database. filePro just marks deleted records
- * as deleted; they are not removed. Since no counts are maintained we need
- * to go in and count records ourselves. <sigh>
- *
- * Errors return false, success returns the row count.
- */
-/* {{{ proto int filepro_rowcount(void)
- Find out how many rows are in a filePro database */
-PHP_FUNCTION(filepro_rowcount)
-{
- FILE *fp;
- char workbuf[MAXPATHLEN];
- char readbuf[256];
- int recsize = 0, records = 0;
- PLS_FETCH();
- FP_TLS_VARS;
-
- if (ZEND_NUM_ARGS() != 0) {
- WRONG_PARAM_COUNT;
- }
-
- if (!FP_GLOBAL(fp_database)) {
- php_error(E_WARNING,
- "filePro: must set database directory first!\n");
- RETURN_FALSE;
- }
-
- recsize = FP_GLOBAL(fp_keysize) + 19; /* 20 bytes system info -1 to save time later */
-
- /* Now read the records in, moving forward recsize-1 bytes each time */
- sprintf(workbuf, "%s/key", FP_GLOBAL(fp_database));
-
- if (PG(safe_mode) && (!php_checkuid(workbuf, NULL, CHECKUID_CHECK_FILE_AND_DIR))) {
- RETURN_FALSE;
- }
-
- if (php_check_open_basedir(workbuf)) {
- RETURN_FALSE;
- }
-
- if (!(fp = VCWD_FOPEN(workbuf, "r"))) {
- php_error(E_WARNING, "filePro: cannot open key: [%d] %s",
- errno, strerror(errno));
- RETURN_FALSE;
- }
- while (!feof(fp)) {
- if (fread(readbuf, 1, 1, fp) == 1) {
- if (readbuf[0])
- records++;
- fseek(fp, recsize, SEEK_CUR);
- }
- }
- fclose(fp);
-
- RETVAL_LONG(records);
-}
-/* }}} */
-
-
-/*
- * STRING filePro_fieldname(LONG field_number)
- *
- * Errors return false, success returns the name of the field.
- */
-/* {{{ proto string filepro_fieldname(int fieldnumber)
- Gets the name of a field */
-PHP_FUNCTION(filepro_fieldname)
-{
- pval *fno;
- FP_FIELD *lp;
- int i;
- FP_TLS_VARS;
-
- if (ZEND_NUM_ARGS() != 1 || getParameters(ht, 1, &fno) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(fno);
-
- if (!FP_GLOBAL(fp_database)) {
- php_error(E_WARNING,
- "filePro: must set database directory first!\n");
- RETURN_FALSE;
- }
-
- for (i = 0, lp = FP_GLOBAL(fp_fieldlist); lp; lp = lp->next, i++) {
- if (i == fno->value.lval) {
- RETURN_STRING(lp->name,1);
- }
- }
-
- php_error(E_WARNING,
- "filePro: unable to locate field number %d.\n",
- fno->value.lval);
-
- RETVAL_FALSE;
-}
-/* }}} */
-
-
-/*
- * STRING filePro_fieldtype(LONG field_number)
- *
- * Errors return false, success returns the type (edit) of the field
- */
-/* {{{ proto string filepro_fieldtype(int field_number)
- Gets the type of a field */
-PHP_FUNCTION(filepro_fieldtype)
-{
- pval *fno;
- FP_FIELD *lp;
- int i;
- FP_TLS_VARS;
-
- if (ZEND_NUM_ARGS() != 1 || getParameters(ht, 1, &fno) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(fno);
-
- if (!FP_GLOBAL(fp_database)) {
- php_error(E_WARNING,
- "filePro: must set database directory first!\n");
- RETURN_FALSE;
- }
-
- for (i = 0, lp = FP_GLOBAL(fp_fieldlist); lp; lp = lp->next, i++) {
- if (i == fno->value.lval) {
- RETURN_STRING(lp->format,1);
- }
- }
- php_error(E_WARNING,
- "filePro: unable to locate field number %d.\n",
- fno->value.lval);
- RETVAL_FALSE;
-}
-/* }}} */
-
-
-/*
- * STRING filePro_fieldwidth(int field_number)
- *
- * Errors return false, success returns the character width of the field.
- */
-/* {{{ proto int filepro_fieldwidth(int field_number)
- Gets the width of a field */
-PHP_FUNCTION(filepro_fieldwidth)
-{
- pval *fno;
- FP_FIELD *lp;
- int i;
- FP_TLS_VARS;
-
- if (ZEND_NUM_ARGS() != 1 || getParameters(ht, 1, &fno) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(fno);
-
- if (!FP_GLOBAL(fp_database)) {
- php_error(E_WARNING,
- "filePro: must set database directory first!\n");
- RETURN_FALSE;
- }
-
- for (i = 0, lp = FP_GLOBAL(fp_fieldlist); lp; lp = lp->next, i++) {
- if (i == fno->value.lval) {
- RETURN_LONG(lp->width);
- }
- }
- php_error(E_WARNING,
- "filePro: unable to locate field number %d.\n",
- fno->value.lval);
- RETVAL_FALSE;
-}
-/* }}} */
-
-
-/*
- * LONG filePro_fieldcount(void)
- *
- * Errors return false, success returns the field count.
- */
-/* {{{ proto int filepro_fieldcount(void)
- Find out how many fields are in a filePro database */
-PHP_FUNCTION(filepro_fieldcount)
-{
- FP_TLS_VARS;
-
- if (ZEND_NUM_ARGS() != 0) {
- WRONG_PARAM_COUNT;
- }
-
- if (!FP_GLOBAL(fp_database)) {
- php_error(E_WARNING,
- "filePro: must set database directory first!\n");
- RETURN_FALSE;
- }
-
- /* Read in the first line from the map file */
- RETVAL_LONG(FP_GLOBAL(fp_fcount));
-}
-/* }}} */
-
-
-/*
- * STRING filePro_retrieve(int row_number, int field_number)
- *
- * Errors return false, success returns the datum.
- */
-/* {{{ proto string filepro_retrieve(int row_number, int field_number)
- Retrieves data from a filePro database */
-PHP_FUNCTION(filepro_retrieve)
-{
- pval *rno, *fno;
- FP_FIELD *lp;
- FILE *fp;
- char workbuf[MAXPATHLEN];
- char readbuf[1024]; /* FIX - Work out better buffering! */
- int i, fnum, rnum;
- long offset;
- PLS_FETCH();
- FP_TLS_VARS;
-
- if (ZEND_NUM_ARGS() != 2 || getParameters(ht, 2, &rno, &fno) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if (!FP_GLOBAL(fp_database)) {
- php_error(E_WARNING,
- "filePro: must set database directory first!\n");
- RETURN_FALSE;
- }
-
- convert_to_long(rno);
- convert_to_long(fno);
-
- fnum = fno->value.lval;
- rnum = rno->value.lval;
-
- if (rnum < 0 || fnum < 0 || fnum >= FP_GLOBAL(fp_fcount)) {
- php_error(E_WARNING, "filepro: parameters out of range");
- RETURN_FALSE;
- }
-
- offset = (rnum + 1) * (FP_GLOBAL(fp_keysize) + 20) + 20; /* Record location */
- for (i = 0, lp = FP_GLOBAL(fp_fieldlist); lp && i < fnum; lp = lp->next, i++) {
- offset += lp->width;
- }
- if (!lp) {
- php_error(E_WARNING, "filePro: cannot locate field");
- RETURN_FALSE;
- }
-
- /* Now read the record in */
- sprintf(workbuf, "%s/key", FP_GLOBAL(fp_database));
-
- if (PG(safe_mode) && (!php_checkuid(workbuf, NULL, CHECKUID_CHECK_FILE_AND_DIR))) {
- RETURN_FALSE;
- }
-
- if (php_check_open_basedir(workbuf)) {
- RETURN_FALSE;
- }
-
- if (!(fp = VCWD_FOPEN(workbuf, "r"))) {
- php_error(E_WARNING, "filePro: cannot open key: [%d] %s",
- errno, strerror(errno));
- fclose(fp);
- RETURN_FALSE;
- }
- fseek(fp, offset, SEEK_SET);
- if (fread(readbuf, lp->width, 1, fp) != 1) {
- php_error(E_WARNING, "filePro: cannot read data: [%d] %s",
- errno, strerror(errno));
- fclose(fp);
- RETURN_FALSE;
- }
- readbuf[lp->width] = '\0';
- fclose(fp);
- RETURN_STRING(readbuf,1);
-}
-/* }}} */
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/filepro/filepro.dsp b/ext/filepro/filepro.dsp
deleted file mode 100644
index 441b14e592..0000000000
--- a/ext/filepro/filepro.dsp
+++ /dev/null
@@ -1,109 +0,0 @@
-# Microsoft Developer Studio Project File - Name="filepro" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=filepro - Win32 Release_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "filepro.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "filepro.mak" CFG="filepro - Win32 Release_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "filepro - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "filepro - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "filepro - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\..\TSRM" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_FILEPRO" /D ZTS=1 /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D ZEND_DEBUG=0 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "FILEPRO_EXPORTS" /D "COMPILE_DL_FILEPRO" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_FILEPRO=1 /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x406 /d "NDEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib /nologo /dll /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_filepro.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
-
-!ELSEIF "$(CFG)" == "filepro - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_FILEPRO" /D ZTS=1 /YX /FD /c
-# ADD CPP /nologo /MDd /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "FILEPRO_EXPORTS" /D "COMPILE_DL_FILEPRO" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_FILEPRO=1 /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x406 /d "NDEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib /nologo /dll /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts_debug.lib /nologo /dll /machine:I386 /out:"..\..\Debug_TS/php_filepro.dll" /libpath:"..\..\Debug_TS"
-
-!ENDIF
-
-# Begin Target
-
-# Name "filepro - Win32 Release_TS"
-# Name "filepro - Win32 Debug_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\filepro.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_filepro.h
-# End Source File
-# End Group
-# End Target
-# End Project
diff --git a/ext/filepro/php_filepro.h b/ext/filepro/php_filepro.h
deleted file mode 100644
index 8c5b8f4973..0000000000
--- a/ext/filepro/php_filepro.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Chad Robinson <chadr@brttech.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-/*
- filePro 4.x support developed by Chad Robinson, chadr@brttech.com
- Contact Chad Robinson at BRT Technical Services Corp. for details.
- filePro is a registered trademark by Fiserv, Inc. This file contains
- no code or information that is not freely available from the filePro
- web site at http://www.fileproplus.com/
-*/
-
-#ifndef PHP_FILEPRO_H
-#define PHP_FILEPRO_H
-#if HAVE_FILEPRO
-extern zend_module_entry filepro_module_entry;
-#define phpext_filepro_ptr &filepro_module_entry
-
-PHP_FUNCTION(filepro);
-PHP_FUNCTION(filepro_rowcount);
-PHP_FUNCTION(filepro_fieldname);
-PHP_FUNCTION(filepro_fieldtype);
-PHP_FUNCTION(filepro_fieldwidth);
-PHP_FUNCTION(filepro_fieldcount);
-PHP_FUNCTION(filepro_retrieve);
-
-extern PHP_MINIT_FUNCTION(filepro);
-extern PHP_MSHUTDOWN_FUNCTION(filepro);
-#else
-#define phpext_filepro_ptr NULL
-#endif
-#endif /* PHP_FILEPRO_H */
diff --git a/ext/filepro/setup.stub b/ext/filepro/setup.stub
deleted file mode 100644
index 7107744f02..0000000000
--- a/ext/filepro/setup.stub
+++ /dev/null
@@ -1,5 +0,0 @@
-# $Source$
-# $Id$
-
-define_option with-filepro 'filePro support? ' yesno no \
-' Whether to use the bundled filePro library. Read-access only.'
diff --git a/ext/fribidi/CREDITS b/ext/fribidi/CREDITS
deleted file mode 100644
index e69de29bb2..0000000000
--- a/ext/fribidi/CREDITS
+++ /dev/null
diff --git a/ext/fribidi/Makefile.in b/ext/fribidi/Makefile.in
deleted file mode 100644
index d7dd435353..0000000000
--- a/ext/fribidi/Makefile.in
+++ /dev/null
@@ -1,9 +0,0 @@
-# $Id$
-
-LTLIBRARY_NAME = libfribidi.la
-LTLIBRARY_SOURCES = fribidi.c
-LTLIBRARY_SHARED_NAME = fribidi.la
-LTLIBRARY_SHARED_LIBADD = $(FRIBIDI_SHARED_LIBADD)
-
-include $(top_srcdir)/build/dynlib.mk
-EXTRA_INCLUDES = $(FRIBIDI_INCLUDE)
diff --git a/ext/fribidi/README b/ext/fribidi/README
deleted file mode 100644
index 29e82eb96b..0000000000
--- a/ext/fribidi/README
+++ /dev/null
@@ -1,53 +0,0 @@
-Purpose
-=======
-
-This extension is basically a wrapper for the FriBidi implementation
-of the Unicode Bidi algorithm. The need for such an algorithm rises
-from the bidirectional language usage done by applications.
-Arabic/Hebrew embedded within English is such a case.
-
-Usage
-=====
-
- The only function used is fribidi_log2vis (logical to visual).
- Input: 1) The Logical string.
- 2) Base direction of application - 'L' or 'R'.
- 3) The char code being used, which can be one of the following
- constants:
- a) FRIBIDI_CHARSET_UTF8
- b) FRIBIDI_CHARSET_8859_6
- c) FRIBIDI_CHARSET_8859_8
- d) FRIBIDI_CHARSET_CP1255
- e) FRIBIDI_CHARSET_CP1256
- f) FRIBIDI_CHARSET_ISIRI_3342
-
-Note: Currently, FriBidi supports the above Character Codes alone.
-
- Output: A Visual string.
-
-
-Compiling
-===========
-1) Static - ./configure --with-fribidi=base-directory-of-FriBidi-installation-path
- (defaults to /usr/local).
-
-2) dl - same, just add shared, to get .... --with-fribidi=shared,base....
-
-Prerequisites
-=============
-1) FriBidi must be installed. Latest version can be obtained thru
- http://imagic.weizmann.ac.il/~dov/freesw/FriBidi.
-
-2) glib header files: glib.h and glibconfig.h.
-
-Note
-=====
-
-The function fribidi_log2vis computes three more arrays which are currently not passed back as output.
-These arrays are:
- 1) mapping from the logical to the visual sting.
- 2) mapping from the visual to the logical string.
- 3) embedding level of characters as figured out by the FriBidi algorithm.
-
-The extension needs further implementation to support this.
-p.s. - If you don't understand this, you probably don't need it.
diff --git a/ext/fribidi/config.m4 b/ext/fribidi/config.m4
deleted file mode 100644
index 2a37d75b18..0000000000
--- a/ext/fribidi/config.m4
+++ /dev/null
@@ -1,74 +0,0 @@
-dnl $Id$
-dnl config.m4 for extension fribidi
-dnl don't forget to call PHP_EXTENSION(fribidi)
-
-
-
-PHP_ARG_WITH(fribidi, whether to add fribidi support,
-[ --with-fribidi[=DIR] Include fribidi support (requires FriBidi >=0.1.12).
- DIR is the fribidi installation directory -
- default /usr/local/])
-
-
-
-if test "$PHP_FRIBIDI" != "no"; then
-
-dnl if module was requested with default path of fribidi installation then
-dnl $PHP_FRIBIDI will be "yes"
-
- if test "$PHP_FRIBIDI" = "yes"; then
- PHP_FRIBIDI=/usr/local
- fi
-
-
-
- dnl check for fribidi header files
-
- AC_MSG_CHECKING([for header files in "$PHP_FRIBIDI/include/fribidi"])
- if test -f $PHP_FRIBIDI/include/fribidi/fribidi.h && test -f $PHP_FRIBIDI/include/fribidi/fribidi_types.h && test -f $PHP_FRIBIDI/include/fribidi/fribidi_char_sets.h; then
- FRIBIDI_INCDIR=$PHP_FRIBIDI/include/fribidi/
- AC_MSG_RESULT([found all])
- else
- AC_MSG_RESULT([missing])
- fi
-
-
-
- dnl check for fribidi shared library
-
- AC_MSG_CHECKING([for libfribidi.so file in "$PHP_FRIBIDI/lib/"])
- if test -f "$PHP_FRIBIDI/lib/libfribidi.so" ; then
- FRIBIDI_LIBDIR=$PHP_FRIBIDI/lib/
- AC_MSG_RESULT([found])
- else
- AC_MSG_RESULT([missing])
- fi
-
- dnl check for glib header files
-
- AC_MSG_CHECKING([for glibconfig.h in "usr/lib/glib/include/"])
- if test -f /usr/lib/glib/include/glibconfig.h ; then
- AC_MSG_RESULT([found])
- GLIB_INCDIR=/usr/lib/glib/include/
- else
- AC_MSG_RESULT([missing])
- fi
-
-
- AC_MSG_CHECKING([sanity to build extension])
- if test -n "$FRIBIDI_INCDIR" && test -n "$FRIBIDI_LIBDIR" && test -n "$GLIB_INCDIR"; then
-
- AC_MSG_RESULT([yes])
-
-
- PHP_ADD_INCLUDE("$FRIBIDI_INCDIR")
- PHP_ADD_INCLUDE("$GLIB_INCDIR")
- PHP_ADD_LIBRARY_WITH_PATH(fribidi,"$FRIBIDI_LIBDIR", FRIBIDI_SHARED_LIBADD)
- PHP_SUBST(FRIBIDI_SHARED_LIBADD)
-
- AC_DEFINE(HAVE_FRIBIDI, 1, [ ])
- PHP_EXTENSION(fribidi, $ext_shared)
- else
- AC_MSG_RESULT([no])
- fi
-fi
diff --git a/ext/fribidi/fribidi.c b/ext/fribidi/fribidi.c
deleted file mode 100755
index 1fe9fe115c..0000000000
--- a/ext/fribidi/fribidi.c
+++ /dev/null
@@ -1,255 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "php_ini.h"
-#include "php_fribidi.h"
-#include "fribidi.h"
-
-/* You should tweak config.m4 so this symbol (or some else suitable)
- gets defined.
-*/
-#if HAVE_FRIBIDI
-
-/* If you declare any globals in php_fribidi.h uncomment this:
-ZEND_DECLARE_MODULE_GLOBALS(fribidi)
-*/
-
-/* True global resources - no need for thread safety here */
-/* static int le_fribidi; */
-
-/* Every user visible function must have an entry in fribidi_functions[].
-*/
-function_entry fribidi_functions[] = {
- PHP_FE(fribidi_log2vis, NULL)
- {NULL, NULL, NULL} /* Must be the last line in fribidi_functions[] */
-};
-
-zend_module_entry fribidi_module_entry = {
- "fribidi",
- fribidi_functions,
- PHP_MINIT(fribidi),
- PHP_MSHUTDOWN(fribidi),
- NULL,
- NULL,
- PHP_MINFO(fribidi),
- STANDARD_MODULE_PROPERTIES
-};
-
-#ifdef COMPILE_DL_FRIBIDI
-ZEND_GET_MODULE(fribidi)
-#endif
-
-/* {{{ PHP_MINIT_FUNCTION
- */
-PHP_MINIT_FUNCTION(fribidi)
-{
- REGISTER_LONG_CONSTANT("FRIBIDI_CHARSET_UTF8",FRIBIDI_CHARSET_UTF8, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FRIBIDI_CHARSET_8859_6",FRIBIDI_CHARSET_8859_6, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FRIBIDI_CHARSET_8859_8",FRIBIDI_CHARSET_8859_8, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FRIBIDI_CHARSET_CP1255",FRIBIDI_CHARSET_CP1255, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FRIBIDI_CHARSET_CP1256",FRIBIDI_CHARSET_CP1256, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FRIBIDI_CHARSET_ISIRI_3342",FRIBIDI_CHARSET_ISIRI_3342, CONST_CS | CONST_PERSISTENT);
-
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_MSHUTDOWN_FUNCTION
- */
-PHP_MSHUTDOWN_FUNCTION(fribidi)
-{
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_MINFO_FUNCTION
- */
-PHP_MINFO_FUNCTION(fribidi)
-{
- php_info_print_table_start();
- php_info_print_table_header(2, "fribidi support", "enabled");
- php_info_print_table_end();
-}
-/* }}} */
-
-/*--------------------------------------------------------------*/
-/* Name: fribidi_log2vis */
-/* Purpose: convert a logical string to a visual one */
-/* Input: 1) The logical string. */
-/* 2) Base direction - */
-/* Possible values: */
-/* a) "L" - base language is left to right. */
-/* b) "R" - base language is right to left. */
-/* c) empty - base language is determined */
-/* automatically by the FriBiDi algorithm */
-/* 3) Character code being used - */
-/* Possible values (i.e., char sets supported) */
-/* FRIBIDI_CHARSET_UTF8 */
-/* FRIBIDI_CHARSET_8859_6 */
-/* FRIBIDI_CHARSET_8859_8 */
-/* FRIBIDI_CHARSET_CP1255 */
-/* FRIBIDI_CHARSET_CP1256 */
-/* FRIBIDI_CHARSET_ISIRI_3342 */
-/* */
-/* Output: on success: The visual string. */
-/* on failure: */
-/*--------------------------------------------------------------*/
-
-/* {{{ proto string fribidi_log2vis(string str, string direction, int charset)
- Convert a logical string to a visual one */
-PHP_FUNCTION(fribidi_log2vis)
-{
- zval **parameter1,**parameter2, **parameter3;
-
-
- FriBidiChar *u_logical_str,*u_visual_str; /* unicode strings .... */
- char *inString;
- guchar *outString;
- int len,alloc_len,utf8_len;
-
-
- FriBidiCharType base_dir;
-
- guint16 *position_L_to_V_list;
- guint16 *position_V_to_L_list;
- guint8 *embedding_level_list;
-
- /* get parameters from input */
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &parameter1, &parameter2, &parameter3) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- /* convert input to expected type.... */
-
- convert_to_string_ex(parameter1);
- convert_to_string_ex(parameter2);
- convert_to_long_ex(parameter3);
-
- /* allocate space and prepare all local variables */
-
-
- len = Z_STRLEN_PP(parameter1);
-
- inString = estrndup(Z_STRVAL_PP(parameter1), len);
-
- alloc_len = len+1;
-
- u_logical_str = (FriBidiChar*) emalloc(sizeof(FriBidiChar)*alloc_len);
- u_visual_str = (FriBidiChar*) emalloc(sizeof(FriBidiChar)*alloc_len);
-
- position_L_to_V_list = (guint16*) emalloc(sizeof(guint16)*alloc_len);
- position_V_to_L_list = (guint16*) emalloc(sizeof(guint16)*alloc_len);
- embedding_level_list = (guint8*) emalloc(sizeof(guint8)*alloc_len);
-
- outString = (guchar*)emalloc(sizeof(guchar)*alloc_len);
-
- if(inString[len-1] == '\n') {
- inString[len-1] = '\0';
- }
-
- switch(Z_LVAL_PP(parameter3)) {
- case FRIBIDI_CHARSET_UTF8:
- utf8_len=fribidi_utf8_to_unicode(inString,u_logical_str);
- break;
- case FRIBIDI_CHARSET_8859_6:
- fribidi_iso8859_6_to_unicode(inString,u_logical_str);
- break;
- case FRIBIDI_CHARSET_8859_8:
- fribidi_iso8859_8_to_unicode(inString,u_logical_str);
- break;
- case FRIBIDI_CHARSET_CP1255:
- fribidi_cp1255_to_unicode(inString,u_logical_str);
- break;
- case FRIBIDI_CHARSET_CP1256:
- fribidi_cp1256_to_unicode(inString,u_logical_str);
- break;
- case FRIBIDI_CHARSET_ISIRI_3342:
- fribidi_isiri_3342_to_unicode(inString,u_logical_str);
- break;
- default:
- zend_error(E_ERROR,"unknown character set %d<BR>",Z_LVAL_PP(parameter3));
- }
-
-
- /* visualize the logical.... */
-
- if ((Z_STRVAL_PP(parameter2))[0] == 'R') {
- base_dir = FRIBIDI_TYPE_RTL;
- } else if (Z_STRVAL_PP(parameter2)[0] == 'L')
- base_dir = FRIBIDI_TYPE_LTR;
- else
- base_dir = FRIBIDI_TYPE_N;
-
- fribidi_log2vis(u_logical_str,len,&base_dir,u_visual_str,position_L_to_V_list,position_V_to_L_list,embedding_level_list);
-
- /* convert back to original char set */
-
- switch(Z_LVAL_PP(parameter3)) {
- case FRIBIDI_CHARSET_UTF8:
- fribidi_unicode_to_utf8(u_visual_str,utf8_len , outString);
- break;
- case FRIBIDI_CHARSET_8859_6:
- fribidi_unicode_to_iso8859_6(u_visual_str,len , outString);
- break;
- case FRIBIDI_CHARSET_8859_8:
- fribidi_unicode_to_iso8859_8(u_visual_str,len , outString);
- break;
- case FRIBIDI_CHARSET_CP1255:
- fribidi_unicode_to_cp1255(u_visual_str,len , outString);
- break;
- case FRIBIDI_CHARSET_CP1256:
- fribidi_unicode_to_cp1256(u_visual_str,len , outString);
- break;
- case FRIBIDI_CHARSET_ISIRI_3342:
- fribidi_unicode_to_isiri_3342(u_visual_str,len , outString);
- break;
- default:
- zend_error(E_ERROR,"unknown character set %d<BR>",Z_LVAL_PP(parameter3));
- }
-
-
- efree(u_logical_str);
- efree(u_visual_str);
-
- efree(position_L_to_V_list);
- efree(position_V_to_L_list);
- efree(embedding_level_list);
-
- RETURN_STRING(outString,1);
-}
-/* }}} */
-
-
-#endif /* HAVE_FRIBIDI */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/fribidi/fribidi.php b/ext/fribidi/fribidi.php
deleted file mode 100644
index 6a603d604e..0000000000
--- a/ext/fribidi/fribidi.php
+++ /dev/null
@@ -1,10 +0,0 @@
-<?
-$module = 'fribidi';
-$function = 'confirm_' . $module . '_compiled';
-if (extension_loaded($module)) {
- $str = $function($module);
-} else {
- $str = "Module $module is not compiled into PHP";
-}
-echo "$str\n";
-?>
diff --git a/ext/fribidi/php_fribidi.h b/ext/fribidi/php_fribidi.h
deleted file mode 100644
index 81f25f1a77..0000000000
--- a/ext/fribidi/php_fribidi.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: |
- | |
- +----------------------------------------------------------------------+
- */
-
-#ifndef PHP_FRIBIDI_H
-#define PHP_FRIBIDI_H
-
-#if HAVE_FRIBIDI
-
-#include "fribidi.h"
-#include "../standard/info.h"
-
-extern zend_module_entry fribidi_module_entry;
-#define phpext_fribidi_ptr &fribidi_module_entry
-
-
-typedef struct _php_fribidi_rsrc{
- guint16 *position_L_to_V_list;
- guint16 *position_V_to_L_list;
- guint8 *embedding_level_list;
- guchar *out_string;
-} php_fribidi_rsrc;
-
-
-#ifdef PHP_WIN32
-#define PHP_FRIBIDI_API __declspec(dllexport)
-#else
-#define PHP_FRIBIDI_API
-#endif
-
-PHP_MINIT_FUNCTION(fribidi);
-PHP_MSHUTDOWN_FUNCTION(fribidi);
-PHP_RINIT_FUNCTION(fribidi);
-PHP_RSHUTDOWN_FUNCTION(fribidi);
-PHP_MINFO_FUNCTION(fribidi);
-
-ZEND_FUNCTION(fribidi_log2vis);
-/*void php_fribidi_free_rsrc(php_fribidi_rsrc* p_rsrc);*/
-/*
- Declare any global variables you may need between the BEGIN
- and END macros here:
-
-ZEND_BEGIN_MODULE_GLOBALS(fribidi)
- int global_variable;
-ZEND_END_MODULE_GLOBALS(fribidi)
-*/
-
-/* In every function that needs to use variables in php_fribidi_globals,
- do call FRIBIDILS_FETCH(); after declaring other variables used by
- that function, and always refer to them as FRIBIDIG(variable).
- You are encouraged to rename these macros something shorter, see
- examples in any other php module directory.
-*/
-
-#ifdef ZTS
-#define FRIBIDIG(v) (fribidi_globals->v)
-#define FRIBIDILS_FETCH() php_fribidi_globals *fribidi_globals = ts_resource(fribidi_globals_id)
-#else
-#define FRIBIDIG(v) (fribidi_globals.v)
-#define FRIBIDILS_FETCH()
-#endif
-
-#else
-
-#define phpext_fribidi_ptr NULL
-
-#endif
-
-#endif /* PHP_FRIBIDI_H */
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/ftp/CREDITS b/ext/ftp/CREDITS
deleted file mode 100644
index fdaf681c21..0000000000
--- a/ext/ftp/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-FTP
-Andrew Skalski
diff --git a/ext/ftp/Makefile.in b/ext/ftp/Makefile.in
deleted file mode 100644
index 169973b7e1..0000000000
--- a/ext/ftp/Makefile.in
+++ /dev/null
@@ -1,6 +0,0 @@
-
-LTLIBRARY_NAME = libftp.la
-LTLIBRARY_SOURCES = php_ftp.c ftp.c
-LTLIBRARY_SHARED_NAME = ftp.la
-
-include $(top_srcdir)/build/dynlib.mk
diff --git a/ext/ftp/config.m4 b/ext/ftp/config.m4
deleted file mode 100644
index 5060ea5a85..0000000000
--- a/ext/ftp/config.m4
+++ /dev/null
@@ -1,11 +0,0 @@
-dnl $Id$
-dnl config.m4 for extension ftp
-dnl don't forget to call PHP_EXTENSION(ftp)
-
-PHP_ARG_ENABLE(ftp,whether to enable FTP support,
-[ --enable-ftp Enable FTP support])
-
-if test "$PHP_FTP" = "yes"; then
- AC_DEFINE(HAVE_FTP,1,[Whether you want FTP support])
- PHP_EXTENSION(ftp, $ext_shared)
-fi
diff --git a/ext/ftp/ftp.c b/ext/ftp/ftp.c
deleted file mode 100644
index 602a5507f4..0000000000
--- a/ext/ftp/ftp.c
+++ /dev/null
@@ -1,1292 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andrew Skalski <askalski@chek.com> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#include "php.h"
-
-#if HAVE_FTP
-
-#include <stdio.h>
-#include <ctype.h>
-#include <stdlib.h>
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#include <fcntl.h>
-#include <string.h>
-#include <time.h>
-#ifdef PHP_WIN32
-#include <winsock.h>
-#else
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <netdb.h>
-#endif
-#include <errno.h>
-
-#if HAVE_SYS_TIME_H
-#include <sys/time.h>
-#endif
-
-#include "ftp.h"
-
-/* define closesocket macro for portability */
-#ifndef PHP_WIN32
-#undef closesocket
-#define closesocket close
-#endif
-
-/* sends an ftp command, returns true on success, false on error.
- * it sends the string "cmd args\r\n" if args is non-null, or
- * "cmd\r\n" if args is null
- */
-static int ftp_putcmd( ftpbuf_t *ftp,
- const char *cmd,
- const char *args);
-
-/* wrapper around send/recv to handle timeouts */
-static int my_send(int s, void *buf, size_t len);
-static int my_recv(int s, void *buf, size_t len);
-static int my_connect(int s, const struct sockaddr *addr,
- int addrlen);
-static int my_accept(int s, struct sockaddr *addr, int *addrlen);
-
-/* reads a line the socket , returns true on success, false on error */
-static int ftp_readline(ftpbuf_t *ftp);
-
-/* reads an ftp response, returns true on success, false on error */
-static int ftp_getresp(ftpbuf_t *ftp);
-
-/* sets the ftp transfer type */
-static int ftp_type(ftpbuf_t *ftp, ftptype_t type);
-
-/* opens up a data stream */
-static databuf_t* ftp_getdata(ftpbuf_t *ftp);
-
-/* accepts the data connection, returns updated data buffer */
-static databuf_t* data_accept(databuf_t *data);
-
-/* closes the data connection, returns NULL */
-static databuf_t* data_close(databuf_t *data);
-
-/* generic file lister */
-static char** ftp_genlist(ftpbuf_t *ftp,
- const char *cmd, const char *path);
-
-/* IP and port conversion box */
-union ipbox {
- unsigned long l[2];
- unsigned short s[4];
- unsigned char c[8];
-};
-
-/* {{{ ftp_open
- */
-ftpbuf_t*
-ftp_open(const char *host, short port)
-{
- int fd = -1;
- ftpbuf_t *ftp;
- struct sockaddr_in addr;
- struct hostent *he;
- int size;
-
-
- /* set up the address */
- if ((he = gethostbyname(host)) == NULL) {
-#if 0
- herror("gethostbyname");
-#endif
- return NULL;
- }
-
- memset(&addr, 0, sizeof(addr));
- memcpy(&addr.sin_addr, he->h_addr, he->h_length);
- addr.sin_family = AF_INET;
- addr.sin_port = port ? port : htons(21);
-
-
- /* alloc the ftp structure */
- ftp = calloc(1, sizeof(*ftp));
- if (ftp == NULL) {
- perror("calloc");
- return NULL;
- }
-
- /* connect */
- if ((fd = socket(PF_INET, SOCK_STREAM, 0)) == -1) {
- perror("socket");
- goto bail;
- }
-
- if (my_connect(fd, (struct sockaddr*) &addr, sizeof(addr)) == -1) {
- perror("connect");
- goto bail;
- }
-
- size = sizeof(addr);
- if (getsockname(fd, (struct sockaddr*) &addr, &size) == -1) {
- perror("getsockname");
- goto bail;
- }
-
- ftp->localaddr = addr.sin_addr;
- ftp->fd = fd;
-
- if (!ftp_getresp(ftp) || ftp->resp != 220) {
- goto bail;
- }
-
- return ftp;
-
-bail:
- if (fd != -1)
- closesocket(fd);
- free(ftp);
- return NULL;
-}
-/* }}} */
-
-/* {{{ ftp_close
- */
-ftpbuf_t*
-ftp_close(ftpbuf_t *ftp)
-{
- if (ftp == NULL)
- return NULL;
- if (ftp->fd != -1)
- closesocket(ftp->fd);
- ftp_gc(ftp);
- free(ftp);
- return NULL;
-}
-/* }}} */
-
-/* {{{ ftp_gc
- */
-void
-ftp_gc(ftpbuf_t *ftp)
-{
- if (ftp == NULL)
- return;
-
- free(ftp->pwd);
- ftp->pwd = NULL;
- free(ftp->syst);
- ftp->syst = NULL;
-}
-/* }}} */
-
-/* {{{ ftp_quit
- */
-int
-ftp_quit(ftpbuf_t *ftp)
-{
- if (ftp == NULL)
- return 0;
-
- if (!ftp_putcmd(ftp, "QUIT", NULL))
- return 0;
- if (!ftp_getresp(ftp) || ftp->resp != 221)
- return 0;
-
- free(ftp->pwd);
- ftp->pwd = NULL;
-
- return 1;
-}
-/* }}} */
-
-/* {{{ ftp_login
- */
-int
-ftp_login(ftpbuf_t *ftp, const char *user, const char *pass)
-{
- if (ftp == NULL)
- return 0;
-
- if (!ftp_putcmd(ftp, "USER", user))
- return 0;
- if (!ftp_getresp(ftp))
- return 0;
- if (ftp->resp == 230)
- return 1;
- if (ftp->resp != 331)
- return 0;
- if (!ftp_putcmd(ftp, "PASS", pass))
- return 0;
- if (!ftp_getresp(ftp))
- return 0;
- return (ftp->resp == 230);
-}
-/* }}} */
-
-/* {{{ ftp_reinit
- */
-int
-ftp_reinit(ftpbuf_t *ftp)
-{
- if (ftp == NULL)
- return 0;
-
- ftp_gc(ftp);
-
- if (!ftp_putcmd(ftp, "REIN", NULL))
- return 0;
- if (!ftp_getresp(ftp) || ftp->resp != 220)
- return 0;
-
- return 1;
-}
-/* }}} */
-
-/* {{{ ftp_syst
- */
-const char*
-ftp_syst(ftpbuf_t *ftp)
-{
- char *syst, *end;
-
- if (ftp == NULL)
- return NULL;
-
- /* default to cached value */
- if (ftp->syst)
- return ftp->syst;
-
- if (!ftp_putcmd(ftp, "SYST", NULL))
- return NULL;
- if (!ftp_getresp(ftp) || ftp->resp != 215)
- return NULL;
-
- syst = ftp->inbuf;
- if ((end = strchr(syst, ' ')))
- *end = 0;
- ftp->syst = strdup(syst);
- if (end)
- *end = ' ';
-
- return ftp->syst;
-}
-/* }}} */
-
-/* {{{ ftp_pwd
- */
-const char*
-ftp_pwd(ftpbuf_t *ftp)
-{
- char *pwd, *end;
-
- if (ftp == NULL)
- return NULL;
-
- /* default to cached value */
- if (ftp->pwd)
- return ftp->pwd;
-
- if (!ftp_putcmd(ftp, "PWD", NULL))
- return NULL;
- if (!ftp_getresp(ftp) || ftp->resp != 257)
- return NULL;
-
- /* copy out the pwd from response */
- if ((pwd = strchr(ftp->inbuf, '"')) == NULL)
- return NULL;
- end = strrchr(++pwd, '"');
- *end = 0;
- ftp->pwd = strdup(pwd);
- *end = '"';
-
- return ftp->pwd;
-}
-/* }}} */
-
-/* {{{ ftp_exec
- */
-int
-ftp_exec(ftpbuf_t *ftp, const char *cmd)
-{
- if (ftp == NULL)
- return 0;
- if (!ftp_putcmd(ftp, "SITE EXEC", cmd))
- return 0;
- if (!ftp_getresp(ftp) || ftp->resp != 200)
- return 0;
-
- return 1;
-}
-/* }}} */
-
-/* {{{ ftp_chdir
- */
-int
-ftp_chdir(ftpbuf_t *ftp, const char *dir)
-{
- if (ftp == NULL)
- return 0;
-
- free(ftp->pwd);
- ftp->pwd = NULL;
-
- if (!ftp_putcmd(ftp, "CWD", dir))
- return 0;
- if (!ftp_getresp(ftp) || ftp->resp != 250)
- return 0;
-
- return 1;
-}
-/* }}} */
-
-/* {{{ ftp_cdup
- */
-int
-ftp_cdup(ftpbuf_t *ftp)
-{
- if (ftp == NULL)
- return 0;
-
- free(ftp->pwd);
- ftp->pwd = NULL;
-
- if (!ftp_putcmd(ftp, "CDUP", NULL))
- return 0;
- if (!ftp_getresp(ftp) || ftp->resp != 250)
- return 0;
-
- return 1;
-}
-/* }}} */
-
-/* {{{ ftp_mkdir
- */
-char*
-ftp_mkdir(ftpbuf_t *ftp, const char *dir)
-{
- char *mkd, *end;
-
- if (ftp == NULL)
- return NULL;
-
- if (!ftp_putcmd(ftp, "MKD", dir))
- return NULL;
- if (!ftp_getresp(ftp) || ftp->resp != 257)
- return NULL;
-
- /* copy out the dir from response */
- if ((mkd = strchr(ftp->inbuf, '"')) == NULL) {
- mkd = strdup(dir);
- return mkd;
- }
-
- end = strrchr(++mkd, '"');
- *end = 0;
- mkd = strdup(mkd);
- *end = '"';
-
- return mkd;
-}
-/* }}} */
-
-/* {{{ ftp_rmdir
- */
-int
-ftp_rmdir(ftpbuf_t *ftp, const char *dir)
-{
- if (ftp == NULL)
- return 0;
-
- if (!ftp_putcmd(ftp, "RMD", dir))
- return 0;
- if (!ftp_getresp(ftp) || ftp->resp != 250)
- return 0;
-
- return 1;
-}
-/* }}} */
-
-/* {{{ ftp_nlist
- */
-char**
-ftp_nlist(ftpbuf_t *ftp, const char *path)
-{
- return ftp_genlist(ftp, "NLST", path);
-}
-/* }}} */
-
-/* {{{ ftp_list
- */
-char**
-ftp_list(ftpbuf_t *ftp, const char *path)
-{
- return ftp_genlist(ftp, "LIST", path);
-}
-/* }}} */
-
-/* {{{ ftp_type
- */
-int
-ftp_type(ftpbuf_t *ftp, ftptype_t type)
-{
- char typechar[2] = "?";
-
- if (ftp == NULL)
- return 0;
-
- if (type == ftp->type)
- return 1;
-
- if (type == FTPTYPE_ASCII)
- typechar[0] = 'A';
- else if (type == FTPTYPE_IMAGE)
- typechar[0] = 'I';
- else
- return 0;
-
- if (!ftp_putcmd(ftp, "TYPE", typechar))
- return 0;
- if (!ftp_getresp(ftp) || ftp->resp != 200)
- return 0;
-
- ftp->type = type;
-
- return 1;
-}
-/* }}} */
-
-/* {{{ ftp_pasv
- */
-int
-ftp_pasv(ftpbuf_t *ftp, int pasv)
-{
- char *ptr;
- union ipbox ipbox;
- unsigned long b[6];
- int n;
-
- if (ftp == NULL)
- return 0;
-
- if (pasv && ftp->pasv == 2)
- return 1;
-
- ftp->pasv = 0;
- if (!pasv)
- return 1;
-
- if (!ftp_putcmd(ftp, "PASV", NULL))
- return 0;
- if (!ftp_getresp(ftp) || ftp->resp != 227)
- return 0;
-
- /* parse out the IP and port */
- for (ptr = ftp->inbuf; *ptr && !isdigit(*ptr); ptr++);
- n = sscanf(ptr, "%lu,%lu,%lu,%lu,%lu,%lu",
- &b[0], &b[1], &b[2], &b[3], &b[4], &b[5]);
- if (n != 6)
- return 0;
-
- for (n=0; n<6; n++)
- ipbox.c[n] = (unsigned char) b[n];
-
- memset(&ftp->pasvaddr, 0, sizeof(ftp->pasvaddr));
- ftp->pasvaddr.sin_family = AF_INET;
- ftp->pasvaddr.sin_addr.s_addr = ipbox.l[0];
- ftp->pasvaddr.sin_port = ipbox.s[2];
-
- ftp->pasv = 2;
-
- return 1;
-}
-/* }}} */
-
-/* {{{ ftp_get
- */
-int
-ftp_get(ftpbuf_t *ftp, FILE *outfp, const char *path, ftptype_t type)
-{
- databuf_t *data = NULL;
- char *ptr;
- int lastch;
- int rcvd;
-
- if (ftp == NULL)
- return 0;
-
- if (!ftp_type(ftp, type))
- goto bail;
-
- if ((data = ftp_getdata(ftp)) == NULL)
- goto bail;
-
- if (!ftp_putcmd(ftp, "RETR", path))
- goto bail;
- if (!ftp_getresp(ftp) || (ftp->resp != 150 && ftp->resp != 125))
- goto bail;
-
- if ((data = data_accept(data)) == NULL)
- goto bail;
-
- lastch = 0;
- while ((rcvd = my_recv(data->fd, data->buf, FTP_BUFSIZE))) {
- if (rcvd == -1)
- goto bail;
-
- if (type == FTPTYPE_ASCII) {
- for (ptr = data->buf; rcvd; rcvd--, ptr++) {
- if (lastch == '\r' && *ptr != '\n')
- putc('\r', outfp);
- if (*ptr != '\r')
- putc(*ptr, outfp);
- lastch = *ptr;
- }
- }
- else {
- fwrite(data->buf, rcvd, 1, outfp);
- }
- }
-
- if (type == FTPTYPE_ASCII && lastch == '\r')
- putc('\r', outfp);
-
- data = data_close(data);
-
- if (ferror(outfp))
- goto bail;
-
- if (!ftp_getresp(ftp) || (ftp->resp != 226 && ftp->resp != 250))
- goto bail;
-
- return 1;
-bail:
- data_close(data);
- return 0;
-}
-/* }}} */
-
-/* {{{ ftp_put
- */
-int
-ftp_put(ftpbuf_t *ftp, const char *path, FILE *infp, ftptype_t type)
-{
- databuf_t *data = NULL;
- int size;
- char *ptr;
- int ch;
-
- if (ftp == NULL)
- return 0;
-
- if (!ftp_type(ftp, type))
- goto bail;
-
- if ((data = ftp_getdata(ftp)) == NULL)
- goto bail;
-
- if (!ftp_putcmd(ftp, "STOR", path))
- goto bail;
- if (!ftp_getresp(ftp) || (ftp->resp != 150 && ftp->resp != 125))
- goto bail;
-
- if ((data = data_accept(data)) == NULL)
- goto bail;
-
- size = 0;
- ptr = data->buf;
- while ((ch = getc(infp)) != EOF) {
- /* flush if necessary */
- if (FTP_BUFSIZE - size < 2) {
- if (my_send(data->fd, data->buf, size) != size)
- goto bail;
- ptr = data->buf;
- size = 0;
- }
-
- if (ch == '\n' && type == FTPTYPE_ASCII) {
- *ptr++ = '\r';
- size++;
- }
-
- *ptr++ = ch;
- size++;
- }
-
- if (size && my_send(data->fd, data->buf, size) != size)
- goto bail;
-
- if (ferror(infp))
- goto bail;
-
- data = data_close(data);
-
- if (!ftp_getresp(ftp) || (ftp->resp != 226 && ftp->resp != 250))
- goto bail;
-
- return 1;
-bail:
- data_close(data);
- return 0;
-}
-/* }}} */
-
-/* {{{ ftp_size
- */
-int
-ftp_size(ftpbuf_t *ftp, const char *path)
-{
- if (ftp == NULL)
- return -1;
-
- if (!ftp_putcmd(ftp, "SIZE", path))
- return -1;
- if (!ftp_getresp(ftp) || ftp->resp != 213)
- return -1;
-
- return atoi(ftp->inbuf);
-}
-/* }}} */
-
-/* {{{ ftp_mdtm
- */
-time_t
-ftp_mdtm(ftpbuf_t *ftp, const char *path)
-{
- time_t stamp;
- struct tm *gmt, tmbuf;
- struct tm tm;
- char *ptr;
- int n;
-
- if (ftp == NULL)
- return -1;
-
- if (!ftp_putcmd(ftp, "MDTM", path))
- return -1;
- if (!ftp_getresp(ftp) || ftp->resp != 213)
- return -1;
-
- /* parse out the timestamp */
- for (ptr = ftp->inbuf; *ptr && !isdigit(*ptr); ptr++);
- n = sscanf(ptr, "%4u%2u%2u%2u%2u%2u",
- &tm.tm_year, &tm.tm_mon, &tm.tm_mday,
- &tm.tm_hour, &tm.tm_min, &tm.tm_sec);
- if (n != 6)
- return -1;
- tm.tm_year -= 1900;
- tm.tm_mon--;
- tm.tm_isdst = -1;
-
- /* figure out the GMT offset */
- stamp = time(NULL);
- gmt = php_gmtime_r(&stamp, &tmbuf);
- gmt->tm_isdst = -1;
-
- /* apply the GMT offset */
- tm.tm_sec += stamp - mktime(gmt);
- tm.tm_isdst = gmt->tm_isdst;
-
- stamp = mktime(&tm);
-
- return stamp;
-}
-/* }}} */
-
-/* {{{ ftp_delete
- */
-int
-ftp_delete(ftpbuf_t *ftp, const char *path)
-{
- if (ftp == NULL)
- return 0;
-
- if (!ftp_putcmd(ftp, "DELE", path))
- return 0;
- if (!ftp_getresp(ftp) || ftp->resp != 250)
- return 0;
-
- return 1;
-}
-/* }}} */
-
-/* {{{ ftp_rename
- */
-int
-ftp_rename(ftpbuf_t *ftp, const char *src, const char *dest)
-{
- if (ftp == NULL)
- return 0;
-
- if (!ftp_putcmd(ftp, "RNFR", src))
- return 0;
- if (!ftp_getresp(ftp) || ftp->resp != 350)
- return 0;
-
- if (!ftp_putcmd(ftp, "RNTO", dest))
- return 0;
- if (!ftp_getresp(ftp) || ftp->resp != 250)
- return 0;
-
- return 1;
-}
-/* }}} */
-
-/* {{{ ftp_site
- */
-int
-ftp_site(ftpbuf_t *ftp, const char *cmd)
-{
- if (ftp == NULL)
- return 0;
-
- if (!ftp_putcmd(ftp, "SITE", cmd))
- return 0;
- if (!ftp_getresp(ftp) || ftp->resp < 200 || ftp->resp >= 300)
- return 0;
-
- return 1;
-}
-/* }}} */
-
-/* static functions */
-
-/* {{{ ftp_putcmd
- */
-int
-ftp_putcmd(ftpbuf_t *ftp, const char *cmd, const char *args)
-{
- int size;
- char *data;
-
- /* build the output buffer */
- if (args && args[0]) {
- /* "cmd args\r\n\0" */
- if (strlen(cmd) + strlen(args) + 4 > FTP_BUFSIZE)
- return 0;
- size = sprintf(ftp->outbuf, "%s %s\r\n", cmd, args);
- }
- else {
- /* "cmd\r\n\0" */
- if (strlen(cmd) + 3 > FTP_BUFSIZE)
- return 0;
- size = sprintf(ftp->outbuf, "%s\r\n", cmd);
- }
-
- data = ftp->outbuf;
- if (my_send(ftp->fd, data, size) != size)
- return 0;
-
- return 1;
-}
-/* }}} */
-
-/* {{{ ftp_readline
- */
-int
-ftp_readline(ftpbuf_t *ftp)
-{
- int size, rcvd;
- char *data, *eol;
-
- /* shift the extra to the front */
- size = FTP_BUFSIZE;
- rcvd = 0;
- if (ftp->extra) {
- memmove(ftp->inbuf, ftp->extra, ftp->extralen);
- rcvd = ftp->extralen;
- }
-
- data = ftp->inbuf;
-
- do {
- size -= rcvd;
- for (eol = data; rcvd; rcvd--, eol++) {
- if (*eol == '\r') {
- *eol = 0;
- ftp->extra = eol + 1;
- if (rcvd > 1 && *(eol + 1) == '\n') {
- ftp->extra++;
- rcvd--;
- }
- if ((ftp->extralen = --rcvd) == 0)
- ftp->extra = NULL;
- return 1;
- }
- else if (*eol == '\n') {
- *eol = 0;
- ftp->extra = eol + 1;
- if ((ftp->extralen = --rcvd) == 0)
- ftp->extra = NULL;
- return 1;
- }
- }
-
- data = eol;
- if ((rcvd = my_recv(ftp->fd, data, size)) < 1)
- return 0;
- } while (size);
-
- return 0;
-}
-/* }}} */
-
-/* {{{ ftp_getresp
- */
-int
-ftp_getresp(ftpbuf_t *ftp)
-{
- char *buf;
-
- if (ftp == NULL) return 0;
- buf = ftp->inbuf;
- ftp->resp = 0;
-
- while (1) {
-
- if (!ftp_readline(ftp)) {
- return 0;
- }
-
- /* Break out when the end-tag is found */
- if (isdigit(ftp->inbuf[0]) &&
- isdigit(ftp->inbuf[1]) &&
- isdigit(ftp->inbuf[2]) &&
- ftp->inbuf[3] == ' ') {
- break;
- }
- }
-
- /* translate the tag */
- if (!isdigit(ftp->inbuf[0]) ||
- !isdigit(ftp->inbuf[1]) ||
- !isdigit(ftp->inbuf[2]))
- {
- return 0;
- }
-
- ftp->resp = 100 * (ftp->inbuf[0] - '0') +
- 10 * (ftp->inbuf[1] - '0') +
- (ftp->inbuf[2] - '0');
-
- memmove(ftp->inbuf, ftp->inbuf + 4, FTP_BUFSIZE - 4);
-
- return 1;
-}
-/* }}} */
-
-/* {{{ my_send
- */
-int
-my_send(int s, void *buf, size_t len)
-{
- fd_set write_set;
- struct timeval tv;
- int n, size, sent;
-
- size = len;
- while (size) {
- tv.tv_sec = FTP_TIMEOUT;
- tv.tv_usec = 0;
-
- FD_ZERO(&write_set);
- FD_SET(s, &write_set);
- n = select(s + 1, NULL, &write_set, NULL, &tv);
- if (n < 1) {
-#ifndef PHP_WIN32
- if (n == 0)
- errno = ETIMEDOUT;
-#endif
- return -1;
- }
-
- sent = send(s, buf, size, 0);
- if (sent == -1)
- return -1;
-
- buf = (char*) buf + sent;
- size -= sent;
- }
-
- return len;
-}
-/* }}} */
-
-/* {{{ my_recv
- */
-int
-my_recv(int s, void *buf, size_t len)
-{
- fd_set read_set;
- struct timeval tv;
- int n;
-
- tv.tv_sec = FTP_TIMEOUT;
- tv.tv_usec = 0;
-
- FD_ZERO(&read_set);
- FD_SET(s, &read_set);
- n = select(s + 1, &read_set, NULL, NULL, &tv);
- if (n < 1) {
-#ifndef PHP_WIN32
- if (n == 0)
- errno = ETIMEDOUT;
-#endif
- return -1;
- }
-
- return recv(s, buf, len, 0);
-}
-/* }}} */
-
-/* {{{ my_connect
- */
-int
-my_connect(int s, const struct sockaddr *addr, int addrlen)
-#ifndef PHP_WIN32
-{
- fd_set conn_set;
- int flags;
- int n;
- int error = 0;
- struct timeval tv;
-
- flags = fcntl(s, F_GETFL, 0);
- fcntl(s, F_SETFL, flags | O_NONBLOCK);
-
- n = connect(s, addr, addrlen);
- if (n == -1 && errno != EINPROGRESS)
- return -1;
-
- if (n) {
- FD_ZERO(&conn_set);
- FD_SET(s, &conn_set);
-
- tv.tv_sec = FTP_TIMEOUT;
- tv.tv_usec = 0;
-
- n = select(s + 1, &conn_set, &conn_set, NULL, &tv);
- if (n < 1) {
- if (n == 0)
- errno = ETIMEDOUT;
- return -1;
- }
-
- if (FD_ISSET(s, &conn_set)) {
- n = sizeof(error);
- n = getsockopt(s, SOL_SOCKET, SO_ERROR, &error, &n);
- if (n == -1 || error) {
- if (error)
- errno = error;
- return -1;
- }
- }
- }
-
- fcntl(s, F_SETFL, flags);
-
- return 0;
-}
-#else
-{
- return connect(s, addr, addrlen);
-}
-#endif
-/* }}} */
-
-/* {{{ my_accept
- */
-int
-my_accept(int s, struct sockaddr *addr, int *addrlen)
-{
- fd_set accept_set;
- struct timeval tv;
- int n;
-
- tv.tv_sec = FTP_TIMEOUT;
- tv.tv_usec = 0;
- FD_ZERO(&accept_set);
- FD_SET(s, &accept_set);
-
- n = select(s + 1, &accept_set, NULL, NULL, &tv);
- if (n < 1) {
-#ifndef PHP_WIN32
- if (n == 0)
- errno = ETIMEDOUT;
-#endif
- return -1;
- }
-
- return accept(s, addr, addrlen);
-}
-/* }}} */
-
-/* {{{ ftp_getdata
- */
-databuf_t*
-ftp_getdata(ftpbuf_t *ftp)
-{
- int fd = -1;
- databuf_t *data;
- struct sockaddr_in addr;
- int size;
- union ipbox ipbox;
- char arg[sizeof("255,255,255,255,255,255")];
-
-
- /* ask for a passive connection if we need one */
- if (ftp->pasv && !ftp_pasv(ftp, 1))
- return NULL;
-
- /* alloc the data structure */
- data = calloc(1, sizeof(*data));
- if (data == NULL) {
- perror("calloc");
- return NULL;
- }
- data->listener = -1;
- data->fd = -1;
- data->type = ftp->type;
-
- /* bind/listen */
- if ((fd = socket(PF_INET, SOCK_STREAM, 0)) == -1) {
- perror("socket");
- goto bail;
- }
-
- /* passive connection handler */
- if (ftp->pasv) {
- /* clear the ready status */
- ftp->pasv = 1;
-
- /* connect */
- if (my_connect(fd, (struct sockaddr*) &ftp->pasvaddr,
- sizeof(ftp->pasvaddr)) == -1)
- {
- perror("connect");
- closesocket(fd);
- free(data);
- return NULL;
- }
-
- data->fd = fd;
-
- return data;
- }
-
-
- /* active (normal) connection */
-
- /* bind to a local address */
- memset(&addr, 0, sizeof(addr));
- addr.sin_family = AF_INET;
- addr.sin_addr.s_addr = INADDR_ANY;
- addr.sin_port = 0;
-
- if (bind(fd, (struct sockaddr*) &addr, sizeof(addr)) == -1) {
- perror("bind");
- goto bail;
- }
-
- size = sizeof(addr);
- if (getsockname(fd, (struct sockaddr*) &addr, &size) == -1) {
- perror("getsockname");
- goto bail;
- }
-
- if (listen(fd, 5) == -1) {
- perror("listen");
- goto bail;
- }
-
- data->listener = fd;
-
- /* send the PORT */
- ipbox.l[0] = ftp->localaddr.s_addr;
- ipbox.s[2] = addr.sin_port;
- sprintf(arg, "%u,%u,%u,%u,%u,%u",
- ipbox.c[0], ipbox.c[1], ipbox.c[2], ipbox.c[3],
- ipbox.c[4], ipbox.c[5]);
-
- if (!ftp_putcmd(ftp, "PORT", arg))
- goto bail;
- if (!ftp_getresp(ftp) || ftp->resp != 200)
- goto bail;
-
- return data;
-
-bail:
- if (fd != -1)
- closesocket(fd);
- free(data);
- return NULL;
-}
-/* }}} */
-
-/* {{{ data_accept
- */
-databuf_t*
-data_accept(databuf_t *data)
-{
- struct sockaddr_in addr;
- int size;
-
- if (data->fd != -1)
- return data;
-
- size = sizeof(addr);
- data->fd = my_accept(data->listener, (struct sockaddr*) &addr, &size);
- closesocket(data->listener);
- data->listener = -1;
-
- if (data->fd == -1) {
- free(data);
- return NULL;
- }
-
- return data;
-}
-/* }}} */
-
-/* {{{ data_close
- */
-databuf_t*
-data_close(databuf_t *data)
-{
- if (data == NULL)
- return NULL;
- if (data->listener != -1)
- closesocket(data->listener);
- if (data->fd != -1)
- closesocket(data->fd);
- free(data);
- return NULL;
-}
-/* }}} */
-
-/* {{{ ftp_genlist
- */
-char**
-ftp_genlist(ftpbuf_t *ftp, const char *cmd, const char *path)
-{
- FILE *tmpfp = NULL;
- databuf_t *data = NULL;
- char *ptr;
- int ch, lastch;
- int size, rcvd;
- int lines;
- char **ret = NULL;
- char **entry;
- char *text;
-
-
- if ((tmpfp = tmpfile()) == NULL)
- return NULL;
-
- if (!ftp_type(ftp, FTPTYPE_ASCII))
- goto bail;
-
- if ((data = ftp_getdata(ftp)) == NULL)
- goto bail;
-
- if (!ftp_putcmd(ftp, cmd, path))
- goto bail;
- if (!ftp_getresp(ftp) || (ftp->resp != 150 && ftp->resp != 125))
- goto bail;
-
- /* pull data buffer into tmpfile */
- if ((data = data_accept(data)) == NULL)
- goto bail;
-
- size = 0;
- lines = 0;
- lastch = 0;
- while ((rcvd = my_recv(data->fd, data->buf, FTP_BUFSIZE))) {
- if (rcvd == -1)
- goto bail;
-
- fwrite(data->buf, rcvd, 1, tmpfp);
-
- size += rcvd;
- for (ptr = data->buf; rcvd; rcvd--, ptr++) {
- if (*ptr == '\n' && lastch == '\r')
- lines++;
- else
- size++;
- lastch = *ptr;
- }
- }
-
- data = data_close(data);
-
- if (ferror(tmpfp))
- goto bail;
-
-
-
- rewind(tmpfp);
-
- ret = malloc((lines + 1) * sizeof(char**) + size * sizeof(char*));
- if (ret == NULL) {
- perror("malloc");
- goto bail;
- }
-
- entry = ret;
- text = (char*) (ret + lines + 1);
- *entry = text;
- lastch = 0;
- while ((ch = getc(tmpfp)) != EOF) {
- if (ch == '\n' && lastch == '\r') {
- *(text - 1) = 0;
- *++entry = text;
- }
- else {
- *text++ = ch;
- }
- lastch = ch;
- }
- *entry = NULL;
-
- if (ferror(tmpfp))
- goto bail;
-
- fclose(tmpfp);
-
- if (!ftp_getresp(ftp) || (ftp->resp != 226 && ftp->resp != 250)) {
- free(ret);
- return NULL;
- }
-
- return ret;
-bail:
- data_close(data);
- fclose(tmpfp);
- free(ret);
- return NULL;
-}
-/* }}} */
-
-#endif /* HAVE_FTP */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/ftp/ftp.h b/ext/ftp/ftp.h
deleted file mode 100644
index b2c7709812..0000000000
--- a/ext/ftp/ftp.h
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: |
- | Andrew Skalski <askalski@chek.com> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifndef FTP_H
-#define FTP_H
-
-#include <stdio.h>
-#ifdef HAVE_NETINET_IN_H
-#include <netinet/in.h>
-#endif
-
-/* XXX these should be configurable at runtime XXX */
-#define FTP_BUFSIZE 4096
-#define FTP_TIMEOUT 90
-
-typedef enum ftptype {
- FTPTYPE_ASCII,
- FTPTYPE_IMAGE
-} ftptype_t;
-
-typedef struct ftpbuf
-{
- int fd; /* control connection */
- struct in_addr localaddr; /* local inet address */
- int resp; /* last response code */
- char inbuf[FTP_BUFSIZE]; /* last response text */
- char *extra; /* extra characters */
- int extralen; /* number of extra chars */
- char outbuf[FTP_BUFSIZE]; /* command output buffer */
- char *pwd; /* cached pwd */
- char *syst; /* cached system type */
- ftptype_t type; /* current transfer type */
- int pasv; /* 0=off; 1=pasv; 2=ready */
- struct sockaddr_in pasvaddr; /* passive mode address */
-} ftpbuf_t;
-
-typedef struct databuf
-{
- int listener; /* listener socket */
- int fd; /* data connection */
- ftptype_t type; /* transfer type */
- char buf[FTP_BUFSIZE]; /* data buffer */
-} databuf_t;
-
-
-/* open a FTP connection, returns ftpbuf (NULL on error)
- * port is the ftp port in network byte order, or 0 for the default
- */
-ftpbuf_t* ftp_open(const char *host, short port);
-
-/* quits from the ftp session (it still needs to be closed)
- * return true on success, false on error
- */
-int ftp_quit(ftpbuf_t *ftp);
-
-/* frees up any cached data held in the ftp buffer */
-void ftp_gc(ftpbuf_t *ftp);
-
-/* close the FTP connection and return NULL */
-ftpbuf_t* ftp_close(ftpbuf_t *ftp);
-
-/* logs into the FTP server, returns true on success, false on error */
-int ftp_login(ftpbuf_t *ftp, const char *user, const char *pass);
-
-/* reinitializes the connection, returns true on success, false on error */
-int ftp_reinit(ftpbuf_t *ftp);
-
-/* returns the remote system type (NULL on error) */
-const char* ftp_syst(ftpbuf_t *ftp);
-
-/* returns the present working directory (NULL on error) */
-const char* ftp_pwd(ftpbuf_t *ftp);
-
-/* exec a command [special features], return true on success, false on error */
-int ftp_exec(ftpbuf_t *ftp, const char *cmd);
-
-/* changes directories, return true on success, false on error */
-int ftp_chdir(ftpbuf_t *ftp, const char *dir);
-
-/* changes to parent directory, return true on success, false on error */
-int ftp_cdup(ftpbuf_t *ftp);
-
-/* creates a directory, return the directory name on success, NULL on error.
- * the return value must be freed
- */
-char* ftp_mkdir(ftpbuf_t *ftp, const char *dir);
-
-/* removes a directory, return true on success, false on error */
-int ftp_rmdir(ftpbuf_t *ftp, const char *dir);
-
-/* returns a NULL-terminated array of filenames in the given path
- * or NULL on error. the return array must be freed (but don't
- * free the array elements)
- */
-char** ftp_nlist(ftpbuf_t *ftp, const char *path);
-
-/* returns a NULL-terminated array of lines returned by the ftp
- * LIST command for the given path or NULL on error. the return
- * array must be freed (but don't
- * free the array elements)
- */
-char** ftp_list(ftpbuf_t *ftp, const char *path);
-
-/* switches passive mode on or off
- * returns true on success, false on error
- */
-int ftp_pasv(ftpbuf_t *ftp, int pasv);
-
-/* retrieves a file and saves its contents to outfp
- * returns true on success, false on error
- */
-int ftp_get(ftpbuf_t *ftp, FILE *outfp, const char *path,
- ftptype_t type);
-
-/* stores the data from infp as a file on the remote server
- * returns true on success, false on error
- */
-int ftp_put(ftpbuf_t *ftp, const char *path, FILE *infp,
- ftptype_t type);
-
-/* returns the size of the given file, or -1 on error */
-int ftp_size(ftpbuf_t *ftp, const char *path);
-
-/* returns the last modified time of the given file, or -1 on error */
-time_t ftp_mdtm(ftpbuf_t *ftp, const char *path);
-
-/* renames a file on the server */
-int ftp_rename(ftpbuf_t *ftp, const char *src, const char *dest);
-
-/* deletes the file from the server */
-int ftp_delete(ftpbuf_t *ftp, const char *path);
-
-/* sends a SITE command to the server */
-int ftp_site(ftpbuf_t *ftp, const char *cmd);
-
-#endif
diff --git a/ext/ftp/php_ftp.c b/ext/ftp/php_ftp.c
deleted file mode 100644
index 130bee1776..0000000000
--- a/ext/ftp/php_ftp.c
+++ /dev/null
@@ -1,853 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andrew Skalski <askalski@chek.com> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-
-#if HAVE_FTP
-
-#include "ext/standard/info.h"
-#include "ext/standard/file.h"
-
-#include "php_ftp.h"
-#include "ftp.h"
-
-static int le_ftpbuf;
-
-
-function_entry php_ftp_functions[] = {
- PHP_FE(ftp_connect, NULL)
- PHP_FE(ftp_login, NULL)
- PHP_FE(ftp_pwd, NULL)
- PHP_FE(ftp_cdup, NULL)
- PHP_FE(ftp_chdir, NULL)
- PHP_FE(ftp_exec, NULL)
- PHP_FE(ftp_mkdir, NULL)
- PHP_FE(ftp_rmdir, NULL)
- PHP_FE(ftp_nlist, NULL)
- PHP_FE(ftp_rawlist, NULL)
- PHP_FE(ftp_systype, NULL)
- PHP_FE(ftp_pasv, NULL)
- PHP_FE(ftp_get, NULL)
- PHP_FE(ftp_fget, NULL)
- PHP_FE(ftp_put, NULL)
- PHP_FE(ftp_fput, NULL)
- PHP_FE(ftp_size, NULL)
- PHP_FE(ftp_mdtm, NULL)
- PHP_FE(ftp_rename, NULL)
- PHP_FE(ftp_delete, NULL)
- PHP_FE(ftp_site, NULL)
- PHP_FE(ftp_quit, NULL)
- {NULL, NULL, NULL}
-};
-
-zend_module_entry php_ftp_module_entry = {
- "ftp",
- php_ftp_functions,
- PHP_MINIT(ftp),
- NULL,
- NULL,
- NULL,
- PHP_MINFO(ftp),
- STANDARD_MODULE_PROPERTIES
-};
-
-#ifdef COMPILE_DL_FTP
-ZEND_GET_MODULE(php_ftp)
-#endif
-
-static void ftp_destructor_ftpbuf(zend_rsrc_list_entry *rsrc)
-{
- ftpbuf_t *ftp = (ftpbuf_t *)rsrc->ptr;
- ftp_close(ftp);
-}
-
-PHP_MINIT_FUNCTION(ftp)
-{
- le_ftpbuf = zend_register_list_destructors_ex(ftp_destructor_ftpbuf, NULL, "ftp", module_number);
- REGISTER_MAIN_LONG_CONSTANT("FTP_ASCII", FTPTYPE_ASCII,
- CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_LONG_CONSTANT("FTP_BINARY", FTPTYPE_IMAGE,
- CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_LONG_CONSTANT("FTP_IMAGE", FTPTYPE_IMAGE,
- CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_LONG_CONSTANT("FTP_TEXT", FTPTYPE_ASCII,
- CONST_PERSISTENT | CONST_CS);
- return SUCCESS;
-}
-
-PHP_MINFO_FUNCTION(ftp)
-{
- php_info_print_table_start();
- php_info_print_table_row(2, "FTP support", "enabled");
- php_info_print_table_end();
-}
-
-
-#define FTPBUF(ftp, pval) { \
- int id, type; \
- convert_to_long(pval); \
- id = Z_LVAL_P(pval); \
- (ftp) = zend_list_find(id, &type); \
- if (!(ftp) || type != le_ftpbuf) { \
- php_error(E_WARNING, "Unable to find ftpbuf %d", id); \
- RETURN_FALSE; \
- } \
- }
-
-#define XTYPE(xtype, pval) { \
- convert_to_long(pval); \
- if ( Z_LVAL_P(pval) != FTPTYPE_ASCII && \
- Z_LVAL_P(pval) != FTPTYPE_IMAGE) \
- { \
- php_error(E_WARNING, "arg4 must be FTP_ASCII or FTP_IMAGE"); \
- RETURN_FALSE; \
- } \
- (xtype) = Z_LVAL_P(pval); \
- }
-
-#define FILEP(fp, pval) { \
- ZEND_FETCH_RESOURCE(fp, FILE *, &pval, -1, "File-Handle", php_file_le_fopen()); \
- }
-
-/* {{{ proto int ftp_connect(string host [, int port])
- Opens a FTP stream */
-PHP_FUNCTION(ftp_connect)
-{
- pval *arg1, *arg2;
- ftpbuf_t *ftp;
- short port = 0;
-
- /* arg1 - hostname
- * arg2 - [port]
- */
- switch (ZEND_NUM_ARGS()) {
- case 1:
- if (getParameters(ht, 1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- break;
- case 2:
- if (getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long(arg2);
- port = (short) Z_LVAL_P(arg2);
- break;
- default:
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string(arg1);
-
- /* connect */
- ftp = ftp_open(Z_STRVAL_P(arg1), htons(port));
- if (ftp == NULL)
- RETURN_FALSE;
-
- RETURN_LONG(zend_list_insert(ftp, le_ftpbuf));
-}
-/* }}} */
-
-/* {{{ proto int ftp_login(int stream, string username, string password)
- Logs into the FTP server */
-PHP_FUNCTION(ftp_login)
-{
- pval *arg1, *arg2, *arg3;
- ftpbuf_t *ftp;
-
- /* arg1 - ftp
- * arg2 - username
- * arg3 - password
- */
- if ( ZEND_NUM_ARGS() != 3 ||
- getParameters(ht, 3, &arg1, &arg2, &arg3) == FAILURE)
- {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string(arg2);
- convert_to_string(arg3);
-
- FTPBUF(ftp, arg1);
-
- /* log in */
- if (!ftp_login(ftp, Z_STRVAL_P(arg2), Z_STRVAL_P(arg3))) {
- php_error(E_WARNING, "ftp_login: %s", ftp->inbuf);
- RETURN_FALSE;
- }
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto string ftp_pwd(int stream)
- Returns the present working directory */
-PHP_FUNCTION(ftp_pwd)
-{
- pval *arg1;
- ftpbuf_t *ftp;
- const char *pwd;
-
- /* arg1 - ftp
- */
- if (ZEND_NUM_ARGS() != 1 || getParameters(ht, 1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- FTPBUF(ftp, arg1);
-
- pwd = ftp_pwd(ftp);
- if (pwd == NULL) {
- php_error(E_WARNING, "ftp_pwd: %s", ftp->inbuf);
- RETURN_FALSE;
- }
-
- RETURN_STRING((char*) pwd, 1);
-}
-/* }}} */
-
-/* {{{ proto int ftp_cdup(int stream)
- Changes to the parent directory */
-PHP_FUNCTION(ftp_cdup)
-{
- pval *arg1;
- ftpbuf_t *ftp;
-
- /* arg1 - ftp
- */
- if (ZEND_NUM_ARGS() != 1 || getParameters(ht, 1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- FTPBUF(ftp, arg1);
-
- if (!ftp_cdup(ftp)) {
- php_error(E_WARNING, "ftp_cdup: %s", ftp->inbuf);
- RETURN_FALSE;
- }
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int ftp_chdir(int stream, string directory)
- Changes directories */
-PHP_FUNCTION(ftp_chdir)
-{
- pval *arg1, *arg2;
- ftpbuf_t *ftp;
-
- /* arg1 - ftp
- * arg2 - directory
- */
- if ( ZEND_NUM_ARGS() != 2 ||
- getParameters(ht, 2, &arg1, &arg2) == FAILURE)
- {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string(arg2);
-
- FTPBUF(ftp, arg1);
-
- /* change directories */
- if (!ftp_chdir(ftp, Z_STRVAL_P(arg2))) {
- php_error(E_WARNING, "ftp_chdir: %s", ftp->inbuf);
- RETURN_FALSE;
- }
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int ftp_exec(int stream, string command)
- Changes directories */
-PHP_FUNCTION(ftp_exec)
-{
- pval *arg1, *arg2;
- ftpbuf_t *ftp;
-
- /* arg1 - ftp
- * arg2 - command
- */
- if (ARG_COUNT(ht) != 2 ||
- getParameters(ht, 2, &arg1, &arg2) == FAILURE)
- {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string(arg2);
-
- FTPBUF(ftp, arg1);
-
- /* change directories */
- if (!ftp_exec(ftp, Z_STRVAL_P(arg2))) {
- php_error(E_WARNING, "ftp_exec: %s", ftp->inbuf);
- RETURN_FALSE;
- }
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto string ftp_mkdir(int stream, string directory)
- Creates a directory */
-PHP_FUNCTION(ftp_mkdir)
-{
- pval *arg1, *arg2;
- ftpbuf_t *ftp;
- char *ret, *tmp;
-
- /* arg1 - ftp
- * arg2 - directory
- */
- if ( ZEND_NUM_ARGS() != 2 ||
- getParameters(ht, 2, &arg1, &arg2) == FAILURE)
- {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string(arg2);
-
- FTPBUF(ftp, arg1);
-
- /* change directories */
- tmp = ftp_mkdir(ftp, Z_STRVAL_P(arg2));
- if (tmp == NULL) {
- php_error(E_WARNING, "ftp_mkdir: %s", ftp->inbuf);
- RETURN_FALSE;
- }
-
- if ((ret = estrdup(tmp)) == NULL) {
- free(tmp);
- php_error(E_WARNING, "estrdup failed");
- RETURN_FALSE;
- }
-
- RETURN_STRING(ret, 0);
-}
-/* }}} */
-
-/* {{{ proto int ftp_rmdir(int stream, string directory)
- Removes a directory */
-PHP_FUNCTION(ftp_rmdir)
-{
- pval *arg1, *arg2;
- ftpbuf_t *ftp;
-
- /* arg1 - ftp
- * arg2 - directory
- */
- if ( ZEND_NUM_ARGS() != 2 ||
- getParameters(ht, 2, &arg1, &arg2) == FAILURE)
- {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string(arg2);
-
- FTPBUF(ftp, arg1);
-
- /* change directories */
- if (!ftp_rmdir(ftp, Z_STRVAL_P(arg2))) {
- php_error(E_WARNING, "ftp_rmdir: %s", ftp->inbuf);
- RETURN_FALSE;
- }
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto array ftp_nlist(int stream, string directory)
- Returns an array of filenames in the given directory */
-PHP_FUNCTION(ftp_nlist)
-{
- pval *arg1, *arg2;
- ftpbuf_t *ftp;
- char **nlist, **ptr;
-
- /* arg1 - ftp
- * arg2 - directory
- */
- if ( ZEND_NUM_ARGS() != 2 ||
- getParameters(ht, 2, &arg1, &arg2) == FAILURE)
- {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string(arg2);
-
- FTPBUF(ftp, arg1);
-
- /* get list of files */
- nlist = ftp_nlist(ftp, Z_STRVAL_P(arg2));
- if (nlist == NULL) {
- RETURN_FALSE;
- }
-
- array_init(return_value);
- for (ptr = nlist; *ptr; ptr++)
- add_next_index_string(return_value, *ptr, 1);
- free(nlist);
-}
-/* }}} */
-
-/* {{{ proto array ftp_rawlist(int stream, string directory)
- Returns a detailed listing of a directory as an array of output lines */
-PHP_FUNCTION(ftp_rawlist)
-{
- pval *arg1, *arg2;
- ftpbuf_t *ftp;
- char **llist, **ptr;
-
- /* arg1 - ftp
- * arg2 - directory
- */
- if ( ZEND_NUM_ARGS() != 2 ||
- getParameters(ht, 2, &arg1, &arg2) == FAILURE)
- {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string(arg2);
-
- FTPBUF(ftp, arg1);
-
- /* get directory listing */
- llist = ftp_list(ftp, Z_STRVAL_P(arg2));
- if (llist == NULL) {
- RETURN_FALSE;
- }
-
- array_init(return_value);
- for (ptr = llist; *ptr; ptr++)
- add_next_index_string(return_value, *ptr, 1);
- free(llist);
-}
-/* }}} */
-
-/* {{{ proto string ftp_systype(int stream)
- Returns the system type identifier */
-PHP_FUNCTION(ftp_systype)
-{
- pval *arg1;
- ftpbuf_t *ftp;
- const char *syst;
-
-
- /* arg1 - ftp
- * arg2 - directory
- */
- if (ZEND_NUM_ARGS() != 1 || getParameters(ht, 1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- FTPBUF(ftp, arg1);
-
- syst = ftp_syst(ftp);
- if (syst == NULL) {
- php_error(E_WARNING, "ftp_syst: %s", ftp->inbuf);
- RETURN_FALSE;
- }
-
- RETURN_STRING((char*) syst, 1);
-}
-/* }}} */
-
-/* {{{ proto int ftp_fget(int stream, int fp, string remote_file, int mode)
- Retrieves a file from the FTP server and writes it to an open file */
-PHP_FUNCTION(ftp_fget)
-{
- pval *arg1, *arg2, *arg3, *arg4;
- ftpbuf_t *ftp;
- ftptype_t xtype;
- FILE *fp;
-
- /* arg1 - ftp
- * arg2 - fp
- * arg3 - remote file
- * arg4 - transfer mode
- */
- if ( ZEND_NUM_ARGS() != 4 ||
- getParameters(ht, 4, &arg1, &arg2, &arg3, &arg4) == FAILURE)
- {
- WRONG_PARAM_COUNT;
- }
-
- FTPBUF(ftp, arg1);
- FILEP(fp, arg2);
- convert_to_string(arg3);
- XTYPE(xtype, arg4);
-
- if (!ftp_get(ftp, fp, Z_STRVAL_P(arg3), xtype) || ferror(fp)) {
- php_error(E_WARNING, "ftp_get: %s", ftp->inbuf);
- RETURN_FALSE;
- }
-
- if (ferror(fp)) {
- php_error(E_WARNING, "error writing %s", Z_STRVAL_P(arg2));
- RETURN_FALSE;
- }
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int ftp_pasv(int stream, int pasv)
- Turns passive mode on or off */
-PHP_FUNCTION(ftp_pasv)
-{
- pval *arg1, *arg2;
- ftpbuf_t *ftp;
-
- /* arg1 - ftp
- * arg2 - pasv
- */
- if ( ZEND_NUM_ARGS() != 2 ||
- getParameters(ht, 2, &arg1, &arg2) == FAILURE)
- {
- WRONG_PARAM_COUNT;
- }
-
- FTPBUF(ftp, arg1);
- convert_to_long(arg2);
-
- if (!ftp_pasv(ftp, (Z_LVAL_P(arg2)) ? 1 : 0))
- RETURN_FALSE;
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int ftp_get(int stream, string local_file, string remote_file, int mode)
- Retrieves a file from the FTP server and writes it to a local file */
-PHP_FUNCTION(ftp_get)
-{
- pval *arg1, *arg2, *arg3, *arg4;
- ftpbuf_t *ftp;
- ftptype_t xtype;
- FILE *outfp, *tmpfp;
- int ch;
-
-
- /* arg1 - ftp
- * arg2 - destination (local) file
- * arg3 - source (remote) file
- * arg4 - transfer mode
- */
- if ( ZEND_NUM_ARGS() != 4 ||
- getParameters(ht, 4, &arg1, &arg2, &arg3, &arg4) == FAILURE)
- {
- WRONG_PARAM_COUNT;
- }
-
- FTPBUF(ftp, arg1);
- convert_to_string(arg2);
- convert_to_string(arg3);
- XTYPE(xtype, arg4);
-
- /* get to temporary file, so if there is an error, no existing
- * file gets clobbered
- */
- if ((tmpfp = tmpfile()) == NULL) {
- php_error(E_WARNING, "error opening tmpfile");
- RETURN_FALSE;
- }
-
- if ( !ftp_get(ftp, tmpfp, Z_STRVAL_P(arg3), xtype) ||
- ferror(tmpfp))
- {
- fclose(tmpfp);
- php_error(E_WARNING, "ftp_get: %s", ftp->inbuf);
- RETURN_FALSE;
- }
-
-#ifdef PHP_WIN32
- if ((outfp = VCWD_FOPEN(Z_STRVAL_P(arg2), "wb")) == NULL) {
-#else
- if ((outfp = VCWD_FOPEN(Z_STRVAL_P(arg2), "w")) == NULL) {
-#endif
- fclose(tmpfp);
- php_error(E_WARNING, "error opening %s", Z_STRVAL_P(arg2));
- RETURN_FALSE;
- }
-
- rewind(tmpfp);
- while ((ch = getc(tmpfp)) != EOF)
- putc(ch, outfp);
-
- if (ferror(tmpfp) || ferror(outfp)) {
- fclose(tmpfp);
- fclose(outfp);
- php_error(E_WARNING, "error writing %s", Z_STRVAL_P(arg2));
- RETURN_FALSE;
- }
-
- fclose(tmpfp);
- fclose(outfp);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int ftp_fput(int stream, string local_file, string remote_file, int mode)
- Stores a file from an open file to the FTP server */
-PHP_FUNCTION(ftp_fput)
-{
- pval *arg1, *arg2, *arg3, *arg4;
- ftpbuf_t *ftp;
- ftptype_t xtype;
- FILE *fp;
-
- /* arg1 - ftp
- * arg2 - remote file
- * arg3 - fp
- * arg4 - transfer mode
- */
- if ( ZEND_NUM_ARGS() != 4 ||
- getParameters(ht, 4, &arg1, &arg2, &arg3, &arg4) == FAILURE)
- {
- WRONG_PARAM_COUNT;
- }
-
- FTPBUF(ftp, arg1);
- convert_to_string(arg2);
- FILEP(fp, arg3);
- XTYPE(xtype, arg4);
-
- if (!ftp_put(ftp, Z_STRVAL_P(arg2), fp, xtype)) {
- php_error(E_WARNING, "ftp_put: %s", ftp->inbuf);
- RETURN_FALSE;
- }
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int ftp_put(int stream, string remote_file, string local_file, int mode)
- Stores a file on the FTP server */
-PHP_FUNCTION(ftp_put)
-{
- pval *arg1, *arg2, *arg3, *arg4;
- ftpbuf_t *ftp;
- ftptype_t xtype;
- FILE *infp;
-
-
- /* arg1 - ftp
- * arg2 - destination (remote) file
- * arg3 - source (local) file
- * arg4 - transfer mode
- */
- if ( ZEND_NUM_ARGS() != 4 ||
- getParameters(ht, 4, &arg1, &arg2, &arg3, &arg4) == FAILURE)
- {
- WRONG_PARAM_COUNT;
- }
-
- FTPBUF(ftp, arg1);
- convert_to_string(arg2);
- convert_to_string(arg3);
- XTYPE(xtype, arg4);
-
-#ifdef PHP_WIN32
- if ((infp = VCWD_FOPEN(Z_STRVAL_P(arg3), "rb")) == NULL) {
-#else
- if ((infp = VCWD_FOPEN(Z_STRVAL_P(arg3), "r")) == NULL) {
-#endif
- php_error(E_WARNING, "error opening %s", Z_STRVAL_P(arg3));
- RETURN_FALSE;
- }
- if ( !ftp_put(ftp, Z_STRVAL_P(arg2), infp, xtype) ||
- ferror(infp))
- {
- fclose(infp);
- php_error(E_WARNING, "ftp_put: %s", ftp->inbuf);
- RETURN_FALSE;
- }
- fclose(infp);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int ftp_size(int stream, string path)
- Returns the size of the file, or -1 on error */
-PHP_FUNCTION(ftp_size)
-{
- pval *arg1, *arg2;
- ftpbuf_t *ftp;
-
- /* arg1 - ftp
- * arg2 - path
- */
- if ( ZEND_NUM_ARGS() != 2 ||
- getParameters(ht, 2, &arg1, &arg2) == FAILURE)
- {
- WRONG_PARAM_COUNT;
- }
-
- FTPBUF(ftp, arg1);
- convert_to_string(arg2);
-
- /* get file size */
- RETURN_LONG(ftp_size(ftp, Z_STRVAL_P(arg2)));
-}
-/* }}} */
-
-/* {{{ proto int ftp_mdtm(int stream, string path)
- Returns the last modification time of the file, or -1 on error */
-PHP_FUNCTION(ftp_mdtm)
-{
- pval *arg1, *arg2;
- ftpbuf_t *ftp;
-
- /* arg1 - ftp
- * arg2 - path
- */
- if ( ZEND_NUM_ARGS() != 2 ||
- getParameters(ht, 2, &arg1, &arg2) == FAILURE)
- {
- WRONG_PARAM_COUNT;
- }
-
- FTPBUF(ftp, arg1);
- convert_to_string(arg2);
-
- /* get file mod time */
- RETURN_LONG(ftp_mdtm(ftp, Z_STRVAL_P(arg2)));
-}
-/* }}} */
-
-/* {{{ proto int ftp_rename(int stream, string src, string dest)
- Renames the given file to a new path */
-PHP_FUNCTION(ftp_rename)
-{
- pval *arg1, *arg2, *arg3;
- ftpbuf_t *ftp;
-
- /* arg1 - ftp
- * arg2 - src
- * arg3 - dest
- */
- if ( ZEND_NUM_ARGS() != 3 ||
- getParameters(ht, 3, &arg1, &arg2, &arg3) == FAILURE)
- {
- WRONG_PARAM_COUNT;
- }
-
- FTPBUF(ftp, arg1);
- convert_to_string(arg2);
- convert_to_string(arg3);
-
- /* rename the file */
- if (!ftp_rename(ftp, Z_STRVAL_P(arg2), Z_STRVAL_P(arg3))) {
- php_error(E_WARNING, "ftp_rename: %s", ftp->inbuf);
- RETURN_FALSE;
- }
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int ftp_delete(int stream, string path)
- Deletes a file */
-PHP_FUNCTION(ftp_delete)
-{
- pval *arg1, *arg2;
- ftpbuf_t *ftp;
-
- /* arg1 - ftp
- * arg2 - path
- */
- if ( ZEND_NUM_ARGS() != 2 ||
- getParameters(ht, 2, &arg1, &arg2) == FAILURE)
- {
- WRONG_PARAM_COUNT;
- }
-
- FTPBUF(ftp, arg1);
- convert_to_string(arg2);
-
- /* delete the file */
- if (!ftp_delete(ftp, Z_STRVAL_P(arg2))) {
- php_error(E_WARNING, "ftp_delete: %s", ftp->inbuf);
- RETURN_FALSE;
- }
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int ftp_site(int stream, string cmd)
- Sends a SITE command to the server */
-PHP_FUNCTION(ftp_site)
-{
- pval *arg1, *arg2;
- ftpbuf_t *ftp;
-
- /* arg1 - ftp
- * arg2 - cmd
- */
- if ( ZEND_NUM_ARGS() != 2 ||
- getParameters(ht, 2, &arg1, &arg2) == FAILURE)
- {
- WRONG_PARAM_COUNT;
- }
-
- FTPBUF(ftp, arg1);
- convert_to_string(arg2);
-
- /* send the site command */
- if (!ftp_site(ftp, Z_STRVAL_P(arg2))) {
- php_error(E_WARNING, "ftp_site: %s", ftp->inbuf);
- RETURN_FALSE;
- }
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int ftp_quit(int stream)
- Closes the FTP stream */
-PHP_FUNCTION(ftp_quit)
-{
- pval *arg1;
- int id, type;
-
- /* arg1 - ftp
- */
- if (ZEND_NUM_ARGS() != 1 || getParameters(ht, 1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- id = Z_LVAL_P(arg1);
- if (zend_list_find(id, &type) && type == le_ftpbuf)
- zend_list_delete(id);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-#endif /* HAVE_FTP */
diff --git a/ext/ftp/php_ftp.h b/ext/ftp/php_ftp.h
deleted file mode 100644
index a43efac4ac..0000000000
--- a/ext/ftp/php_ftp.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: |
- | Andrew Skalski <askalski@chek.com> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifndef _INCLUDED_FTP_H
-#define _INCLUDED_FTP_H
-
-#if HAVE_FTP
-
-extern zend_module_entry php_ftp_module_entry;
-#define php_ftp_module_ptr &php_ftp_module_entry
-
-PHP_MINIT_FUNCTION(ftp);
-PHP_MINFO_FUNCTION(ftp);
-
-PHP_FUNCTION(ftp_connect);
-PHP_FUNCTION(ftp_login);
-PHP_FUNCTION(ftp_pwd);
-PHP_FUNCTION(ftp_cdup);
-PHP_FUNCTION(ftp_chdir);
-PHP_FUNCTION(ftp_exec);
-PHP_FUNCTION(ftp_mkdir);
-PHP_FUNCTION(ftp_rmdir);
-PHP_FUNCTION(ftp_nlist);
-PHP_FUNCTION(ftp_rawlist);
-PHP_FUNCTION(ftp_systype);
-PHP_FUNCTION(ftp_pasv);
-PHP_FUNCTION(ftp_get);
-PHP_FUNCTION(ftp_fget);
-PHP_FUNCTION(ftp_put);
-PHP_FUNCTION(ftp_fput);
-PHP_FUNCTION(ftp_size);
-PHP_FUNCTION(ftp_mdtm);
-PHP_FUNCTION(ftp_rename);
-PHP_FUNCTION(ftp_delete);
-PHP_FUNCTION(ftp_site);
-PHP_FUNCTION(ftp_quit);
-
-#define phpext_ftp_ptr php_ftp_module_ptr
-
-#else
-#define php_ftp_module_ptr NULL
-#endif /* HAVE_FTP */
-
-#endif
diff --git a/ext/gd/CREDITS b/ext/gd/CREDITS
deleted file mode 100644
index 8cdeef9338..0000000000
--- a/ext/gd/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-GD imaging
-Rasmus Lerdorf, Stig Bakken, Jim Winstead, Jouni Ahto
diff --git a/ext/gd/Makefile.in b/ext/gd/Makefile.in
deleted file mode 100644
index c1b73be7fb..0000000000
--- a/ext/gd/Makefile.in
+++ /dev/null
@@ -1,7 +0,0 @@
-
-LTLIBRARY_NAME = libgd.la
-LTLIBRARY_SOURCES = gd.c gdcache.c gdttf.c gdt1.c
-LTLIBRARY_SHARED_NAME = gd.la
-LTLIBRARY_SHARED_LIBADD = $(GD_SHARED_LIBADD)
-
-include $(top_srcdir)/build/dynlib.mk
diff --git a/ext/gd/config.m4 b/ext/gd/config.m4
deleted file mode 100644
index 43a3597942..0000000000
--- a/ext/gd/config.m4
+++ /dev/null
@@ -1,250 +0,0 @@
-dnl
-dnl $Id$
-dnl
-
-AC_DEFUN(PHP_GD_JPEG,[
- PHP_ARG_WITH(jpeg-dir, for the location of libjpeg,
- [ --with-jpeg-dir=DIR GD: Set the path to libjpeg install prefix.])
-
- if test "$PHP_JPEG_DIR" != "no"; then
-
- if test "$PHP_JPEG_DIR" = "yes"; then
- PHP_JPEG_DIR=/usr/local
- fi
-
- AC_CHECK_LIB(jpeg,jpeg_read_header,
- [
- PHP_ADD_LIBRARY_WITH_PATH(jpeg, $PHP_JPEG_DIR/lib, GD_SHARED_LIBADD)
- ],[
- AC_MSG_ERROR(libjpeg not found!)
- ],[
- -L$PHP_JPEG_DIR/lib
- ])
- else
- AC_MSG_RESULT(not set. If configure fails try --with-jpeg-dir=<DIR>)
- fi
-])
-
-AC_DEFUN(PHP_GD_PNG,[
- PHP_ARG_WITH(png-dir, for the location of libpng,
- [ --with-png-dir=DIR GD: Set the path to libpng install prefix.])
-
- if test "$PHP_PNG_DIR" != "no"; then
-
- if test "$PHP_PNG_DIR" = "yes"; then
- PHP_PNG_DIR=/usr/local
- fi
-
- if test "$PHP_ZLIB_DIR" = "no"; then
- AC_MSG_ERROR(PNG support requires ZLIB. Use --with-zlib-dir=<DIR>)
- fi
-
- AC_CHECK_LIB(png,png_info_init,
- [
- PHP_ADD_LIBRARY_WITH_PATH(z, $PHP_ZLIB_DIR/lib, GD_SHARED_LIBADD)
- PHP_ADD_LIBRARY_WITH_PATH(png, $PHP_PNG_DIR/lib, GD_SHARED_LIBADD)
- ],[
- AC_MSG_ERROR(libpng not found!)
- ],[
- -L$PHP_ZLIB_DIR/lib -lz -L$PHP_PNG_DIR/lib
- ])
- else
- AC_MSG_RESULT(If configure fails try --with-png-dir=<DIR> and --with-zlib-dir=<DIR>)
- fi
-])
-
-AC_DEFUN(PHP_GD_XPM,[
- PHP_ARG_WITH(xpm-dir, for the location of libXpm,
- [ --with-xpm-dir=DIR GD: Set the path to libXpm install prefix.])
-
- if test "$PHP_XPM_DIR" != "no"; then
- if test "$PHP_XPM_DIR" = "yes"; then
- PHP_XPM_DIR=/usr/local
- fi
-
- AC_CHECK_LIB(Xpm,XpmFreeXpmImage,
- [
- PHP_ADD_LIBRARY_WITH_PATH(Xpm, $PHP_XPM_DIR/lib, GD_SHARED_LIBADD)
- PHP_ADD_LIBRARY_WITH_PATH(X11, $PHP_XPM_DIR/lib, GD_SHARED_LIBADD)
- ],[
- AC_MSG_ERROR(libXpm.(a|so) or libX11.(a|so) not found!)
- ],[
- -L$PHP_XPM_DIR/lib -lX11
- ])
- else
- AC_MSG_RESULT(If configure fails try --with-xpm-dir=<DIR>)
- fi
-])
-
-AC_DEFUN(PHP_GD_FREETYPE1,[
- PHP_ARG_WITH(ttf,whether to include include FreeType 1.x support,
- [ --with-ttf[=DIR] GD: Include FreeType 1.x support])
-
- if test "$PHP_TTF" != "no"; then
- if test "$PHP_FREETYPE_DIR" = "no" -o "$PHP_FREETYPE_DIR" = ""; then
- if test -n "$PHP_TTF" ; then
- for i in /usr /usr/local "$PHP_TTF" ; do
- if test -f "$i/include/freetype.h" ; then
- TTF_DIR=$i
- unset TTF_INC_DIR
- fi
- if test -f "$i/include/freetype/freetype.h"; then
- TTF_DIR=$i
- TTF_INC_DIR=$i/include/freetype
- fi
- done
- fi
- if test -n "$TTF_DIR" ; then
- AC_DEFINE(HAVE_LIBTTF,1,[ ])
- PHP_ADD_LIBRARY_WITH_PATH(ttf, $TTF_DIR/lib, GD_SHARED_LIBADD)
- fi
- if test -z "$TTF_INC_DIR"; then
- TTF_INC_DIR=$TTF_DIR/include
- fi
- PHP_ADD_INCLUDE($TTF_INC_DIR)
- else
- AC_MSG_RESULT(no - FreeType 2.x is to be used instead)
- fi
- fi
-])
-
-AC_DEFUN(PHP_GD_FREETYPE2,[
- PHP_ARG_WITH(freetype-dir, for freetype(2),
- [ --with-freetype-dir=DIR GD: Set the path to freetype2 install prefix.])
-
- if test "$PHP_FREETYPE_DIR" != "no"; then
- for i in /usr /usr/local "$PHP_FREETYPE_DIR" ; do
- if test -f "$i/include/freetype2/freetype/freetype.h"; then
- FREETYPE2_DIR=$i
- FREETYPE2_INC_DIR=$i/include/freetype2/freetype
- fi
- done
-
- if test -n "$FREETYPE2_DIR" ; then
- PHP_ADD_LIBRARY_WITH_PATH(freetype, $FREETYPE2_DIR/lib, GD_SHARED_LIBADD)
- PHP_ADD_INCLUDE($FREETYPE2_INC_DIR)
- AC_DEFINE(USE_GD_IMGSTRTTF, 1, [ ])
- AC_DEFINE(HAVE_LIBFREETYPE,1,[ ])
- else
- AC_MSG_ERROR(freetype2 not found!)
- fi
- else
- AC_MSG_RESULT(If configure fails try --with-freetype-dir=<DIR>)
- fi
-])
-
-AC_DEFUN(PHP_GD_T1LIB,[
- PHP_ARG_WITH(t1lib, whether to include T1lib support,
- [ --with-t1lib[=DIR] GD: Include T1lib support.])
-
- if test "$PHP_T1LIB" != "no"; then
- for i in /usr /usr/local $PHP_T1LIB; do
- if test -f "$i/include/t1lib.h"; then
- T1_DIR=$i
- fi
- done
-
- if test -n "$T1_DIR"; then
- AC_CHECK_LIB(t1, T1_GetExtend,
- [
- AC_DEFINE(HAVE_LIBT1,1,[ ])
- PHP_ADD_INCLUDE("$T1_DIR/include")
- PHP_ADD_LIBRARY_WITH_PATH(t1, "$T1_DIR/lib", GD_SHARED_LIBADD)
- ],[
- AC_MSG_ERROR(Problem with libt1.(a|so). Please check config.log for more information.)
- ],[
- -L$T1_DIR/lib
- ])
- else
- AC_MSG_ERROR(Your t1lib distribution is not installed correctly. Please reinstall it.)
- fi
- fi
-])
-
-AC_DEFUN(PHP_GD_TTSTR,[
- PHP_ARG_ENABLE(gd-native-tt, whether to enable truetype string function in gd,
- [ --enable-gd-native-ttf GD: Enable TrueType string function in gd])
-
- if test "$PHP_GD_NATIVE_TT" = "yes"; then
- AC_DEFINE(USE_GD_IMGSTRTTF, 1, [ ])
- fi
-])
-
-AC_DEFUN(PHP_GD_CHECK_VERSION,[
- AC_CHECK_LIB(gd, gdImageString16, [AC_DEFINE(HAVE_LIBGD13, 1, [ ])])
- AC_CHECK_LIB(gd, gdImagePaletteCopy, [AC_DEFINE(HAVE_LIBGD15, 1, [ ])])
- AC_CHECK_LIB(gd, gdImageCreateFromPng, [AC_DEFINE(HAVE_GD_PNG, 1, [ ])])
- AC_CHECK_LIB(gd, gdImageCreateFromGif, [AC_DEFINE(HAVE_GD_GIF, 1, [ ])])
- AC_CHECK_LIB(gd, gdImageWBMP, [AC_DEFINE(HAVE_GD_WBMP, 1, [ ])])
- AC_CHECK_LIB(gd, gdImageCreateFromJpeg, [AC_DEFINE(HAVE_GD_JPG, 1, [ ])])
- AC_CHECK_LIB(gd, gdImageCreateFromXpm, [AC_DEFINE(HAVE_GD_XPM, 1, [ ])])
- AC_CHECK_LIB(gd, gdImageCreateFromGd2, [AC_DEFINE(HAVE_GD_GD2, 1, [ ])])
- AC_CHECK_LIB(gd, gdImageCreateTrueColor, [AC_DEFINE(HAVE_LIBGD20, 1, [ ])])
- AC_CHECK_LIB(gd, gdImageSetTile, [AC_DEFINE(HAVE_GD_IMAGESETTILE, 1, [ ])])
- AC_CHECK_LIB(gd, gdImageSetBrush, [AC_DEFINE(HAVE_GD_IMAGESETBRUSH, 1, [ ])])
- AC_CHECK_LIB(gd, gdImageStringFTEx, [AC_DEFINE(HAVE_GD_STRINGFTEX, 1, [ ])])
- AC_CHECK_LIB(gd, gdImageColorClosestHWB, [AC_DEFINE(HAVE_COLORCLOSESTHWB, 1, [ ])])
- AC_CHECK_LIB(gd, gdImageColorResolve, [AC_DEFINE(HAVE_GDIMAGECOLORRESOLVE, 1, [ ])])
- AC_CHECK_LIB(gd, gdImageGifCtx, [AC_DEFINE(HAVE_GD_GIF_CTX, 1, [ ])])
-])
-
-
-PHP_ARG_WITH(gd, whether to include GD support,
-[ --with-gd[=DIR] Include GD support (DIR is GD's install dir).
- Set DIR to "shared" to build as a dl, or
- "shared,DIR" to build as a dl and still specify DIR.])
-
-if test "$PHP_GD" != "no"; then
-
- PHP_EXTENSION(gd, $ext_shared)
- PHP_SUBST(GD_SHARED_LIBADD)
-
-dnl Various checks for GD features
- PHP_GD_TTSTR
- PHP_GD_JPEG
- PHP_GD_PNG
- PHP_GD_XPM
- PHP_GD_FREETYPE2
- PHP_GD_FREETYPE1
- PHP_GD_T1LIB
-
- case $PHP_GD in
- yes)
- PHP_ADD_LIBRARY(gd,, GD_SHARED_LIBADD)
- PHP_GD_CHECK_VERSION
- AC_DEFINE(HAVE_LIBGD,1,[ ])
- ;;
- *)
-dnl A whole whack of possible places where these might be
- for i in include/gd1.3 include/gd include gd1.3 gd ""; do
- test -f $PHP_GD/$i/gd.h && GD_INCLUDE=$PHP_GD/$i
- done
-
- for i in lib/gd1.3 lib/gd lib gd1.3 gd ""; do
- test -f $PHP_GD/$i/libgd.s? -o -f $PHP_GD/$i/libgd.a && GD_LIB=$PHP_GD/$i
- done
-
- if test -n "$GD_INCLUDE" && test -n "$GD_LIB" ; then
- PHP_ADD_LIBRARY_WITH_PATH(gd, $GD_LIB, GD_SHARED_LIBADD)
- AC_DEFINE(HAVE_LIBGD,1,[ ])
- PHP_GD_CHECK_VERSION
- else
- AC_MSG_ERROR([Unable to find libgd.(a|so) anywhere under $withval])
- fi
- ;;
- esac
-
-dnl NetBSD package structure
- if test -f /usr/pkg/include/gd/gd.h -a -z "$GD_INCLUDE" ; then
- GD_INCLUDE=/usr/pkg/include/gd
- fi
-
-dnl SuSE 6.x package structure
- if test -f /usr/include/gd/gd.h -a -z "$GD_INCLUDE" ; then
- GD_INCLUDE=/usr/include/gd
- fi
-
- PHP_EXPAND_PATH($GD_INCLUDE, GD_INCLUDE)
- PHP_ADD_INCLUDE($GD_INCLUDE)
-
-fi
diff --git a/ext/gd/gd.c b/ext/gd/gd.c
deleted file mode 100644
index 9eb90c16a9..0000000000
--- a/ext/gd/gd.c
+++ /dev/null
@@ -1,3498 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
- | Stig Bakken <ssb@guardian.no> |
- | Jim Winstead <jimw@php.net> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-/* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center,
- Cold Spring Harbor Labs. */
-
-/* Note that there is no code from the gd package in this file */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "ext/standard/head.h"
-#include <math.h>
-#include "SAPI.h"
-#include "php_gd.h"
-#include "ext/standard/info.h"
-
-#if HAVE_SYS_WAIT_H
-# include <sys/wait.h>
-#endif
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-#ifdef PHP_WIN32
-# include <io.h>
-# include <fcntl.h>
-#endif
-
-#if HAVE_LIBGD
-
-static int le_gd, le_gd_font;
-#if HAVE_LIBT1
-static int le_ps_font, le_ps_enc;
-#endif
-
-
-#include <gd.h>
-#include <gdfontt.h> /* 1 Tiny font */
-#include <gdfonts.h> /* 2 Small font */
-#include <gdfontmb.h> /* 3 Medium bold font */
-#include <gdfontl.h> /* 4 Large font */
-#include <gdfontg.h> /* 5 Giant font */
-#ifdef ENABLE_GD_TTF
-# include "gdttf.h"
-#endif
-
-#ifndef M_PI
-#define M_PI 3.14159265358979323846
-#endif
-
-#ifdef ENABLE_GD_TTF
-static void php_imagettftext_common(INTERNAL_FUNCTION_PARAMETERS, int);
-#endif
-
-#if HAVE_LIBGD15
-/* it's >= 1.5, i.e. has IOCtx */
-#define USE_GD_IOCTX 1
-#else
-#undef USE_GD_IOCTX
-#endif
-
-#ifdef USE_GD_IOCTX
-#include "gd_ctx.c"
-#else
-#define gdImageCreateFromGdCtx NULL
-#define gdImageCreateFromGd2Ctx NULL
-#define gdImageCreateFromGd2partCtx NULL
-#define gdImageCreateFromGifCtx NULL
-#define gdImageCreateFromJpegCtx NULL
-#define gdImageCreateFromPngCtx NULL
-#define gdImageCreateFromWBMPCtx NULL
-typedef FILE gdIOCtx;
-#define CTX_PUTC(c,fp) fputc(c, fp)
-#endif
-
-static gdImagePtr _php_image_create_from_string ( zval **Data, char *tn, gdImagePtr (*ioctx_func_p)() );
-static void _php_image_create_from(INTERNAL_FUNCTION_PARAMETERS, int image_type, char *tn, gdImagePtr (*func_p)(), gdImagePtr (*ioctx_func_p)());
-static void _php_image_output(INTERNAL_FUNCTION_PARAMETERS, int image_type, char *tn, void (*func_p)());
-static int _php_image_type ( char data[8] );
-static void _php_image_convert(INTERNAL_FUNCTION_PARAMETERS, int image_type);
-static void _php_image_bw_convert(gdImagePtr im_org, gdIOCtx *out, int threshold);
-
-/* {{{ gd_functions[]
- */
-function_entry gd_functions[] = {
- PHP_FE(imagearc, NULL)
- PHP_FE(imagechar, NULL)
- PHP_FE(imagecharup, NULL)
- PHP_FE(imagecolorallocate, NULL)
- PHP_FE(imagepalettecopy, NULL)
- PHP_FE(imagecolorat, NULL)
- PHP_FE(imagecolorclosest, NULL)
- PHP_FE(imagecolorclosesthwb, NULL)
- PHP_FE(imagecolordeallocate, NULL)
- PHP_FE(imagecolorresolve, NULL)
- PHP_FE(imagecolorexact, NULL)
- PHP_FE(imagecolorset, NULL)
- PHP_FE(imagecolortransparent, NULL)
- PHP_FE(imagecolorstotal, NULL)
- PHP_FE(imagecolorsforindex, NULL)
- PHP_FE(imagecopy, NULL)
- PHP_FE(imagecopymerge, NULL)
- PHP_FE(imagecopyresized, NULL)
- PHP_FE(imagecreate, NULL)
-
- PHP_FE(imagecreatetruecolor, NULL)
- PHP_FE(imagetruecolortopalette, NULL)
- PHP_FE(imagesetthickness, NULL)
- PHP_FE(imageellipse, NULL)
- PHP_FE(imagefilledellipse, NULL)
- PHP_FE(imagefilledarc, NULL)
- PHP_FE(imagealphablending, NULL)
- PHP_FE(imagecolorresolvealpha, NULL)
- PHP_FE(imagecolorclosestalpha, NULL)
- PHP_FE(imagecolorexactalpha, NULL)
- PHP_FE(imagecopyresampled, NULL)
- PHP_FE(imagesettile, NULL)
-
- PHP_FE(imagesetbrush, NULL)
- PHP_FE(imagesetstyle, NULL)
- PHP_FE(imagecopymergegray, NULL)
-
- PHP_FE(imagecreatefromstring, NULL)
- PHP_FE(imagecreatefrompng, NULL)
- PHP_FE(imagecreatefromgif, NULL)
- PHP_FE(imagecreatefromjpeg, NULL)
- PHP_FE(imagecreatefromwbmp, NULL)
- PHP_FE(imagecreatefromxbm, NULL)
- PHP_FE(imagecreatefromxpm, NULL)
- PHP_FE(imagecreatefromgd, NULL)
- PHP_FE(imagecreatefromgd2, NULL)
- PHP_FE(imagecreatefromgd2part, NULL)
-
- PHP_FE(imagepng, NULL)
- PHP_FE(imagegif, NULL)
- PHP_FE(imagejpeg, NULL)
- PHP_FE(imagewbmp, NULL)
- PHP_FE(imagegd, NULL)
- PHP_FE(imagegd2, NULL)
-
- PHP_FE(imagedestroy, NULL)
- PHP_FE(imagegammacorrect, NULL)
- PHP_FE(imagefill, NULL)
- PHP_FE(imagefilledpolygon, NULL)
- PHP_FE(imagefilledrectangle, NULL)
- PHP_FE(imagefilltoborder, NULL)
- PHP_FE(imagefontwidth, NULL)
- PHP_FE(imagefontheight, NULL)
- PHP_FE(imageinterlace, NULL)
- PHP_FE(imageline, NULL)
- PHP_FE(imageloadfont, NULL)
- PHP_FE(imagepolygon, NULL)
- PHP_FE(imagerectangle, NULL)
- PHP_FE(imagesetpixel, NULL)
- PHP_FE(imagestring, NULL)
- PHP_FE(imagestringup, NULL)
- PHP_FE(imagesx, NULL)
- PHP_FE(imagesy, NULL)
- PHP_FE(imagedashedline, NULL)
- PHP_FE(imagettfbbox, NULL)
- PHP_FE(imagettftext, NULL)
- PHP_FE(imagepsloadfont, NULL)
- /*
- PHP_FE(imagepscopyfont, NULL)
- */
- PHP_FE(imagepsfreefont, NULL)
- PHP_FE(imagepsencodefont, NULL)
- PHP_FE(imagepsextendfont, NULL)
- PHP_FE(imagepsslantfont, NULL)
- PHP_FE(imagepstext, NULL)
- PHP_FE(imagepsbbox, NULL)
- PHP_FE(imagetypes, NULL)
-
- PHP_FE(jpeg2wbmp, NULL)
- PHP_FE(png2wbmp, NULL)
- PHP_FE(image2wbmp, NULL)
-
- {NULL, NULL, NULL}
-};
-/* }}} */
-
-zend_module_entry gd_module_entry = {
- "gd", gd_functions, PHP_MINIT(gd), NULL, NULL, NULL, PHP_MINFO(gd), STANDARD_MODULE_PROPERTIES
-};
-
-#ifdef COMPILE_DL_GD
-ZEND_GET_MODULE(gd)
-#endif
-
-/* {{{ php_free_gd_image
- */
-static void php_free_gd_image(zend_rsrc_list_entry *rsrc)
-{
- gdImageDestroy((gdImagePtr)rsrc->ptr);
-}
-/* }}} */
-
-/* {{{ php_free_gd_font
- */
-static void php_free_gd_font(zend_rsrc_list_entry *rsrc)
-{
- gdFontPtr fp = (gdFontPtr)rsrc->ptr;
- if (fp->data) {
- efree(fp->data);
- }
- efree(fp);
-}
-/* }}} */
-
-/* {{{ PHP_MINIT_FUNCTION
- */
-PHP_MINIT_FUNCTION(gd)
-{
- le_gd = zend_register_list_destructors_ex(php_free_gd_image, NULL, "gd", module_number);
- le_gd_font = zend_register_list_destructors_ex(php_free_gd_font, NULL, "gd font", module_number);
-#if HAVE_LIBT1
- T1_SetBitmapPad(8);
- T1_InitLib(NO_LOGFILE|IGNORE_CONFIGFILE|IGNORE_FONTDATABASE);
- T1_SetLogLevel(T1LOG_DEBUG);
- le_ps_font = zend_register_list_destructors_ex(php_free_ps_font, NULL, "gd PS font", module_number);
- le_ps_enc = zend_register_list_destructors_ex(php_free_ps_enc, NULL, "gd PS encoding", module_number);
-#endif
- REGISTER_LONG_CONSTANT("IMG_GIF", 1, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("IMG_JPG", 2, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("IMG_JPEG", 2, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("IMG_PNG", 4, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("IMG_WBMP", 8, CONST_CS | CONST_PERSISTENT);
-#ifdef gdTiled
- /* special colours for gd */
- REGISTER_LONG_CONSTANT("IMG_COLOR_TILED", gdTiled, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("IMG_COLOR_STYLED", gdStyled, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("IMG_COLOR_BRUSHED", gdBrushed, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("IMG_COLOR_STYLEDBRUSHED", gdStyledBrushed, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("IMG_COLOR_TRANSPARENT", gdTransparent, CONST_CS | CONST_PERSISTENT);
-#endif
-#if HAVE_LIBGD20
- /* for imagefilledarc */
- REGISTER_LONG_CONSTANT("IMG_ARC_ROUNDED", gdArc, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("IMG_ARC_PIE", gdPie, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("IMG_ARC_CHORD", gdChord, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("IMG_ARC_NOFILL", gdNoFill, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("IMG_ARC_EDGED", gdEdged, CONST_CS | CONST_PERSISTENT);
-#endif
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_MINFO_FUNCTION
- */
-PHP_MINFO_FUNCTION(gd)
-{
- php_info_print_table_start();
- php_info_print_table_row(2, "GD Support", "enabled");
-
- /* need to use a PHPAPI function here because it is external module in windows */
-
-#if HAVE_LIBGD20
- php_info_print_table_row(2, "GD Version", "2.0 or higher");
-#elif HAVE_GDIMAGECOLORRESOLVE
- php_info_print_table_row(2, "GD Version", "1.6.2 or higher");
-#elif HAVE_LIBGD13
- php_info_print_table_row(2, "GD Version", "between 1.3 and 1.6.1");
-#else
- php_info_print_table_row(2, "GD Version", "1.2");
-#endif
-
-#ifdef ENABLE_GD_TTF
- php_info_print_table_row(2, "FreeType Support", "enabled");
-#if HAVE_LIBFREETYPE
- php_info_print_table_row(2, "FreeType Linkage", "with freetype");
-#elif HAVE_LIBTTF
- php_info_print_table_row(2, "FreeType Linkage", "with TTF library");
-#else
- php_info_print_table_row(2, "FreeType Linkage", "with unknown library");
-#endif
-#endif
-
-#ifdef HAVE_LIBT1
- php_info_print_table_row(2, "T1Lib Support", "enabled");
-#endif
-
-/* this next part is stupid ... if I knew better, I'd put them all on one row (cmv) */
-
-#ifdef HAVE_GD_GIF
- php_info_print_table_row(2, "GIF Support", "enabled");
-#endif
-#ifdef HAVE_GD_JPG
- php_info_print_table_row(2, "JPG Support", "enabled");
-#endif
-#ifdef HAVE_GD_PNG
- php_info_print_table_row(2, "PNG Support", "enabled");
-#endif
-#ifdef HAVE_GD_WBMP
- php_info_print_table_row(2, "WBMP Support", "enabled");
-#endif
-#ifdef HAVE_GD_XBM
- php_info_print_table_row(2, "XBM Support", "enabled");
-#endif
- php_info_print_table_end();
-}
-/* }}} */
-
-/* Need this for cpdf. See also comment in file.c php3i_get_le_fp() */
-PHP_GD_API int phpi_get_le_gd(void)
-{
- return le_gd;
-}
-
-#ifndef HAVE_GDIMAGECOLORRESOLVE
-
-/* {{{ gdImageColorResolve
- */
-/********************************************************************/
-/* gdImageColorResolve is a replacement for the old fragment: */
-/* */
-/* if ((color=gdImageColorExact(im,R,G,B)) < 0) */
-/* if ((color=gdImageColorAllocate(im,R,G,B)) < 0) */
-/* color=gdImageColorClosest(im,R,G,B); */
-/* */
-/* in a single function */
-
-int
-gdImageColorResolve(gdImagePtr im, int r, int g, int b)
-{
- int c;
- int ct = -1;
- int op = -1;
- long rd, gd, bd, dist;
- long mindist = 3*255*255; /* init to max poss dist */
-
- for (c = 0; c < im->colorsTotal; c++) {
- if (im->open[c]) {
- op = c; /* Save open slot */
- continue; /* Color not in use */
- }
- rd = (long)(im->red [c] - r);
- gd = (long)(im->green[c] - g);
- bd = (long)(im->blue [c] - b);
- dist = rd * rd + gd * gd + bd * bd;
- if (dist < mindist) {
- if (dist == 0) {
- return c; /* Return exact match color */
- }
- mindist = dist;
- ct = c;
- }
- }
- /* no exact match. We now know closest, but first try to allocate exact */
- if (op == -1) {
- op = im->colorsTotal;
- if (op == gdMaxColors) { /* No room for more colors */
- return ct; /* Return closest available color */
- }
- im->colorsTotal++;
- }
- im->red [op] = r;
- im->green[op] = g;
- im->blue [op] = b;
- im->open [op] = 0;
- return op; /* Return newly allocated color */
-}
-/* }}} */
-
-#endif
-
-#define FLIPWORD(a) (((a & 0xff000000) >> 24) | ((a & 0x00ff0000) >> 8) | ((a & 0x0000ff00) << 8) | ((a & 0x000000ff) << 24))
-
-/* {{{ proto int imageloadfont(string filename)
- Load a new font */
-PHP_FUNCTION(imageloadfont)
-{
- zval **file;
- int hdr_size = sizeof(gdFont) - sizeof(char *);
- int ind, body_size, n=0, b, i, body_size_check;
- gdFontPtr font;
- FILE *fp;
- int issock=0, socketd=0;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &file) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(file);
-
-#ifdef PHP_WIN32
- fp = VCWD_FOPEN(Z_STRVAL_PP(file), "rb");
-#else
- fp = php_fopen_wrapper(Z_STRVAL_PP(file), "r", IGNORE_PATH|IGNORE_URL_WIN, &issock, &socketd, NULL);
-#endif
- if (fp == NULL) {
- php_error(E_WARNING, "ImageFontLoad: unable to open file");
- RETURN_FALSE;
- }
-
- /* Only supports a architecture-dependent binary dump format
- * at the moment.
- * The file format is like this on machines with 32-byte integers:
- *
- * byte 0-3: (int) number of characters in the font
- * byte 4-7: (int) value of first character in the font (often 32, space)
- * byte 8-11: (int) pixel width of each character
- * byte 12-15: (int) pixel height of each character
- * bytes 16-: (char) array with character data, one byte per pixel
- * in each character, for a total of
- * (nchars*width*height) bytes.
- */
- font = (gdFontPtr)emalloc(sizeof(gdFont));
- b = 0;
- while (b < hdr_size && (n = fread(&font[b], 1, hdr_size - b, fp)))
- b += n;
- if (!n) {
- fclose(fp);
- efree(font);
- if (feof(fp)) {
- php_error(E_WARNING, "ImageFontLoad: end of file while reading header");
- } else {
- php_error(E_WARNING, "ImageFontLoad: error while reading header");
- }
- RETURN_FALSE;
- }
- i = ftell(fp);
- fseek(fp, 0, SEEK_END);
- body_size_check = ftell(fp) - hdr_size;
- fseek(fp, i, SEEK_SET);
- body_size = font->w * font->h * font->nchars;
- if (body_size != body_size_check) {
- font->w = FLIPWORD(font->w);
- font->h = FLIPWORD(font->h);
- font->nchars = FLIPWORD(font->nchars);
- body_size = font->w * font->h * font->nchars;
- }
- if (body_size != body_size_check) {
- php_error(E_WARNING, "ImageFontLoad: error reading font");
- efree(font);
- RETURN_FALSE;
- }
-
- font->data = emalloc(body_size);
- b = 0;
- while (b < body_size && (n = fread(&font->data[b], 1, body_size - b, fp)))
- b += n;
- if (!n) {
- fclose(fp);
- efree(font->data);
- efree(font);
- if (feof(fp)) {
- php_error(E_WARNING, "ImageFontLoad: end of file while reading body");
- } else {
- php_error(E_WARNING, "ImageFontLoad: error while reading body");
- }
- RETURN_FALSE;
- }
- fclose(fp);
-
- /* Adding 5 to the font index so we will never have font indices
- * that overlap with the old fonts (with indices 1-5). The first
- * list index given out is always 1.
- */
- ind = 5 + zend_list_insert(font, le_gd_font);
-
- RETURN_LONG(ind);
-}
-/* }}} */
-
-/* {{{ proto void imagesetstyle(resource im, array styles)
- Set the line drawing styles for use with imageline and IMG_COLOR_STYLED. */
-PHP_FUNCTION(imagesetstyle)
-{
- zval **IM, **styles;
- gdImagePtr im;
- int * stylearr;
- int index;
- HashPosition pos;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &IM, &styles) == FAILURE)
- {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
- convert_to_array_ex(styles);
-
- /* copy the style values in the stylearr */
- stylearr = emalloc(sizeof(int) * zend_hash_num_elements(HASH_OF(*styles)));
-
- zend_hash_internal_pointer_reset_ex(HASH_OF(*styles), &pos);
-
- for (index=0;; zend_hash_move_forward_ex(HASH_OF(*styles), &pos)) {
- zval ** item;
-
- if (zend_hash_get_current_data_ex(HASH_OF(*styles), (void**)&item, &pos) == FAILURE)
- break;
-
- convert_to_long_ex(item);
-
- stylearr[index++] = Z_LVAL_PP(item);
- }
- gdImageSetStyle(im, stylearr, index);
-
- efree(stylearr);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int imagecreatetruecolor(int x_size, int y_size)
- Create a new true color image */
-PHP_FUNCTION(imagecreatetruecolor)
-{
-#if HAVE_LIBGD20
- zval **x_size, **y_size;
- gdImagePtr im;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &x_size, &y_size) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(x_size);
- convert_to_long_ex(y_size);
-
- im = gdImageCreateTrueColor(Z_LVAL_PP(x_size), Z_LVAL_PP(y_size));
-
- ZEND_REGISTER_RESOURCE(return_value, im, le_gd);
-#else
- zend_error(E_ERROR, "%s(): requires GD 2.0 or later", get_active_function_name());
-#endif
-}
-/* }}} */
-
-/* {{{ void ImageTrueColorToPalette(resource im, bool ditherFlag, int colorsWanted)
- Convert a true colour image to a palette based image with a number of colours, optionally using dithering. */
-PHP_FUNCTION(imagetruecolortopalette)
-{
-#if HAVE_LIBGD20
- zval **IM, **dither, **ncolors;
- gdImagePtr im;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &IM, &dither, &ncolors) == FAILURE)
- {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
- convert_to_boolean_ex(dither);
- convert_to_long_ex(ncolors);
-
- gdImageTrueColorToPalette(im, Z_LVAL_PP(dither), Z_LVAL_PP(ncolors));
-
- RETURN_TRUE;
-#else
- zend_error(E_ERROR, "%s(): requires GD 2.0 or later", get_active_function_name());
-#endif
-
-}
-/* }}} */
-
-/* {{{ proto void imagesetthickness(resource im, int thickness)
- Set line thickness for drawing lines, ellipses, rectangles, polygons etc. */
-PHP_FUNCTION(imagesetthickness)
-{
-#if HAVE_LIBGD20
- zval **IM, **thick;
- gdImagePtr im;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &IM, &thick) == FAILURE)
- {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
- convert_to_long_ex(thick);
-
- gdImageSetThickness(im, Z_LVAL_PP(thick));
-
- RETURN_TRUE;
-#else
- zend_error(E_ERROR, "%s(): requires GD 2.0 or later", get_active_function_name());
-#endif
-
-}
-/* }}} */
-
-/* {{{ proto void imageellipse(resource im, int cx, int cy, int w, int h, int color)
- Draw an ellipse */
-PHP_FUNCTION(imageellipse)
-{
-#if 0 && HAVE_LIBGD20 /* this function is missing from GD 2.0.1 */
- zval **IM, **cx, **cy, **w, **h, **color;
- gdImagePtr im;
-
- if (ZEND_NUM_ARGS() != 6 || zend_get_parameters_ex(6, &IM, &cx, &cy, &w, &h, &color) == FAILURE)
- {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
-
- convert_to_long_ex(cx);
- convert_to_long_ex(cy);
- convert_to_long_ex(w);
- convert_to_long_ex(h);
- convert_to_long_ex(color);
-
- gdImageEllipse(im, Z_LVAL_PP(cx), Z_LVAL_PP(cy), Z_LVAL_PP(w), Z_LVAL_PP(h), Z_LVAL_PP(color));
-
- RETURN_TRUE;
-#else
- zend_error(E_ERROR, "%s(): requires GD 2.0 or later", get_active_function_name());
-#endif
-}
-/* }}} */
-
-/* {{{ proto void imagefilledellipse(resource im, int cx, int cy, int w, int h, int color)
- Draw an ellipse */
-PHP_FUNCTION(imagefilledellipse)
-{
-#if HAVE_LIBGD20
- zval **IM, **cx, **cy, **w, **h, **color;
- gdImagePtr im;
-
- if (ZEND_NUM_ARGS() != 6 || zend_get_parameters_ex(6, &IM, &cx, &cy, &w, &h, &color) == FAILURE)
- {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
-
- convert_to_long_ex(cx);
- convert_to_long_ex(cy);
- convert_to_long_ex(w);
- convert_to_long_ex(h);
- convert_to_long_ex(color);
-
- gdImageFilledEllipse(im, Z_LVAL_PP(cx), Z_LVAL_PP(cy), Z_LVAL_PP(w), Z_LVAL_PP(h), Z_LVAL_PP(color));
-
- RETURN_TRUE;
-#else
- zend_error(E_ERROR, "%s(): requires GD 2.0 or later", get_active_function_name());
-#endif
-}
-/* }}} */
-
-/* {{{ proto int imagefilledarc(int im, int cx, int cy, int w, int h, int s, int e, int col, int style)
- Draw a filled partial ellipse */
-PHP_FUNCTION(imagefilledarc)
-{
-#if HAVE_LIBGD20
- zval **IM, **cx, **cy, **w, **h, **ST, **E, **col, **style;
- gdImagePtr im;
- int e,st;
-
- if (ZEND_NUM_ARGS() != 9 || zend_get_parameters_ex(9, &IM, &cx, &cy, &w, &h, &ST, &E, &col, &style) == FAILURE)
- {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
-
- convert_to_long_ex(cx);
- convert_to_long_ex(cy);
- convert_to_long_ex(w);
- convert_to_long_ex(h);
- convert_to_long_ex(ST);
- convert_to_long_ex(E);
- convert_to_long_ex(col);
- convert_to_long_ex(style);
-
- e = Z_LVAL_PP(E);
- st = Z_LVAL_PP(ST);
-
- if (e < 0) e %= 360;
- if (st < 0) st %= 360;
-
- gdImageFilledArc(im,Z_LVAL_PP(cx),Z_LVAL_PP(cy),Z_LVAL_PP(w),Z_LVAL_PP(h),st,e,Z_LVAL_PP(col), Z_LVAL_PP(style));
- RETURN_TRUE;
-#else
- zend_error(E_ERROR, "%s(): requires GD 2.0 or later", get_active_function_name());
-#endif
-}
-/* }}} */
-
-/* {{{ proto void imagealphablending(resource im, bool on)
- Turn alpha blending mode on or off for the given image */
-PHP_FUNCTION(imagealphablending)
-{
-#if HAVE_LIBGD20
- zval **IM, **blend;
- gdImagePtr im;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &IM, &blend) == FAILURE)
- {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
- convert_to_boolean_ex(blend);
-
- gdImageAlphaBlending(im, Z_LVAL_PP(blend));
-
- RETURN_TRUE;
-#else
- zend_error(E_ERROR, "%s(): requires GD 2.0 or later", get_active_function_name());
-#endif
-}
-/* }}} */
-
-/* {{{ proto int imagecolorresolvealpha(resource im, int red, int green, int blue, int alpha)
- Resolve/Allocate a colour with an alpha level. Works for true colour and palette based images */
-PHP_FUNCTION(imagecolorresolvealpha)
-{
-#if HAVE_LIBGD20
- zval **IM, ** red, **green, **blue, **alpha;
- gdImagePtr im;
-
- if (ZEND_NUM_ARGS() != 5 || zend_get_parameters_ex(5, &IM, &red, &green, &blue, &alpha) == FAILURE)
- {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
-
- convert_to_long_ex(red);
- convert_to_long_ex(green);
- convert_to_long_ex(blue);
- convert_to_long_ex(alpha);
-
- RETURN_LONG(gdImageColorResolveAlpha(im, Z_LVAL_PP(red), Z_LVAL_PP(green), Z_LVAL_PP(blue), Z_LVAL_PP(alpha)));
-#else
- zend_error(E_ERROR, "%s(): requires GD 2.0 or later", get_active_function_name());
-#endif
-
-}
-/* }}} */
-
-/* {{{ proto int imagecolorclosestalpha(resource im, int red, int green, int blue, int alpha)
- Find the closest matching colour with alpha transparency */
-PHP_FUNCTION(imagecolorclosestalpha)
-{
-#if HAVE_LIBGD20
- zval **IM, ** red, **green, **blue, **alpha;
- gdImagePtr im;
-
- if (ZEND_NUM_ARGS() != 5 || zend_get_parameters_ex(5, &IM, &red, &green, &blue, &alpha) == FAILURE)
- {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
-
- convert_to_long_ex(red);
- convert_to_long_ex(green);
- convert_to_long_ex(blue);
- convert_to_long_ex(alpha);
-
- RETURN_LONG(gdImageColorClosestAlpha(im, Z_LVAL_PP(red), Z_LVAL_PP(green), Z_LVAL_PP(blue), Z_LVAL_PP(alpha)));
-#else
- zend_error(E_ERROR, "%s(): requires GD 2.0 or later", get_active_function_name());
-#endif
-}
-/* }}} */
-
-/* {{{ proto int imagecolorexactalpha(resource im, int red, int green, int blue, int alpha)
- Find exact match for colour with transparency */
-PHP_FUNCTION(imagecolorexactalpha)
-{
-#if HAVE_LIBGD20
- zval **IM, **red, **green, **blue, **alpha;
- gdImagePtr im;
-
- if (ZEND_NUM_ARGS() != 5 || zend_get_parameters_ex(5, &IM, &red, &green, &blue, &alpha) == FAILURE)
- {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
-
- convert_to_long_ex(red);
- convert_to_long_ex(green);
- convert_to_long_ex(blue);
- convert_to_long_ex(alpha);
-
- RETURN_LONG(gdImageColorExactAlpha(im, Z_LVAL_PP(red), Z_LVAL_PP(green), Z_LVAL_PP(blue), Z_LVAL_PP(alpha)));
-#else
- zend_error(E_ERROR, "%s(): requires GD 2.0 or later", get_active_function_name());
-#endif
-}
-/* }}} */
-
-/* {{{ proto int imagecopyresampled(int dst_im, int src_im, int dst_x, int dst_y, int src_x, int src_y, int dst_w, int dst_h, int src_w, int src_h)
- Copy and resize part of an image using resampling to help ensure clarity */
-PHP_FUNCTION(imagecopyresampled)
-{
-#if HAVE_LIBGD20
- zval **SIM, **DIM, **SX, **SY, **SW, **SH, **DX, **DY, **DW, **DH;
- gdImagePtr im_dst, im_src;
- int srcH, srcW, dstH, dstW, srcY, srcX, dstY, dstX;
-
- if (ZEND_NUM_ARGS() != 10 ||
- zend_get_parameters_ex(10, &DIM, &SIM, &DX, &DY, &SX, &SY, &DW, &DH, &SW, &SH) == FAILURE)
- {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(im_dst, gdImagePtr, DIM, -1, "Image", le_gd);
- ZEND_FETCH_RESOURCE(im_src, gdImagePtr, SIM, -1, "Image", le_gd);
-
- convert_to_long_ex(SX);
- convert_to_long_ex(SY);
- convert_to_long_ex(SW);
- convert_to_long_ex(SH);
- convert_to_long_ex(DX);
- convert_to_long_ex(DY);
- convert_to_long_ex(DW);
- convert_to_long_ex(DH);
-
- srcX = Z_LVAL_PP(SX);
- srcY = Z_LVAL_PP(SY);
- srcH = Z_LVAL_PP(SH);
- srcW = Z_LVAL_PP(SW);
- dstX = Z_LVAL_PP(DX);
- dstY = Z_LVAL_PP(DY);
- dstH = Z_LVAL_PP(DH);
- dstW = Z_LVAL_PP(DW);
-
- gdImageCopyResampled(im_dst, im_src, dstX, dstY, srcX, srcY, dstW, dstH, srcW, srcH);
- RETURN_TRUE;
-#else
- zend_error(E_ERROR, "%s(): requires GD 2.0 or later", get_active_function_name());
-#endif
-}
-/* }}} */
-
-/* {{{ proto int imagesettile(resource image, resource tile)
- Set the tile image to $tile when filling $image with the "IMG_COLOR_TILED" color */
-PHP_FUNCTION(imagesettile)
-{
-#if HAVE_GD_IMAGESETTILE
- zval **IM, **TILE;
- gdImagePtr im, tile;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &IM, &TILE) == FAILURE)
- {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
- ZEND_FETCH_RESOURCE(tile, gdImagePtr, TILE, -1, "Image", le_gd);
-
- gdImageSetTile(im,tile);
-
- RETURN_TRUE;
-#else
- zend_error(E_ERROR, "%s(): requires a more recent version of GD", get_active_function_name());
-#endif
-}
-/* }}} */
-
-/* {{{ proto int imagesetbrush(resource image, resource brush)
- Set the brush image to $brush when filling $image with the "IMG_COLOR_BRUSHED" color */
-PHP_FUNCTION(imagesetbrush)
-{
-#if HAVE_GD_IMAGESETBRUSH
- zval **IM, **TILE;
- gdImagePtr im, tile;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &IM, &TILE) == FAILURE)
- {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
- ZEND_FETCH_RESOURCE(tile, gdImagePtr, TILE, -1, "Image", le_gd);
-
- gdImageSetBrush(im,tile);
-
- RETURN_TRUE;
-#else
- zend_error(E_ERROR, "%s(): requires a more recent version of GD", get_active_function_name());
-#endif
-}
-/* }}} */
-
-/* {{{ proto int imagecreate(int x_size, int y_size)
- Create a new image */
-PHP_FUNCTION(imagecreate)
-{
- zval **x_size, **y_size;
- gdImagePtr im;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &x_size, &y_size) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(x_size);
- convert_to_long_ex(y_size);
-
- im = gdImageCreate(Z_LVAL_PP(x_size), Z_LVAL_PP(y_size));
-
- ZEND_REGISTER_RESOURCE(return_value, im, le_gd);
-}
-/* }}} */
-
-/* {{{ proto int imagetypes(void)
- Return the types of images supported in a bitfield - 1=GIF, 2=JPEG, 4=PNG, 8=WBMP, 16=XPM */
-PHP_FUNCTION(imagetypes)
-{
- int ret=0;
-#ifdef HAVE_GD_GIF
- ret = 1;
-#endif
-#ifdef HAVE_GD_JPG
- ret |= 2;
-#endif
-#ifdef HAVE_GD_PNG
- ret |= 4;
-#endif
-#ifdef HAVE_GD_WBMP
- ret |= 8;
-#endif
-#ifdef HAVE_GD_XPM
- ret |= 16;
-#endif
- RETURN_LONG(ret);
-}
-/* }}} */
-
-/* {{{ _php_image_type
- */
-static int _php_image_type (char data[8])
-{
-#ifdef HAVE_LIBGD15
- /* Based on ext/standard/images.c */
-
- if (data == NULL)
- return -1;
-
- if (!memcmp(data, php_sig_jpg, 3))
- return PHP_GDIMG_TYPE_JPG;
- else if (!memcmp(data, php_sig_png, 3)) {
- if (!memcmp(data, php_sig_png, 8))
- return PHP_GDIMG_TYPE_PNG;
- }
- else if (!memcmp(data, php_sig_gif, 3))
- return PHP_GDIMG_TYPE_GIF;
-#ifdef HAVE_GD_WMBP
- else {
- gdIOCtx *io_ctx;
- io_ctx = gdNewDynamicCtx (8, data);
- if (io_ctx) {
- if (getmbi(gdGetC, io_ctx) == 0 && skipheader(gdGetC, io_ctx) == 0 ) {
- io_ctx->free(io_ctx);
- return PHP_GDIMG_TYPE_WBM;
- } else
- io_ctx->free(io_ctx);
- }
- }
-#endif
- return -1;
-#endif
-}
-/* }}} */
-
-/* {{{ _php_image_create_from_string
- */
-gdImagePtr _php_image_create_from_string (zval **data, char *tn, gdImagePtr (*ioctx_func_p)())
-{
-#ifdef HAVE_LIBGD15
- gdImagePtr im;
- gdIOCtx *io_ctx;
-
- io_ctx = gdNewDynamicCtx (Z_STRLEN_PP(data),Z_STRVAL_PP(data));
-
- if(!io_ctx) {
- return NULL;
- }
-
- im = (*ioctx_func_p)(io_ctx);
- if (!im) {
- php_error(E_WARNING, "%s: Passed data is not in '%s' format", get_active_function_name(), tn);
- return NULL;
- }
-
- return im;
-#else
- return NULL;
-#endif
-}
-/* }}} */
-
-/* {{{ proto int imagecreatefromstring(string image)
- Create a new image from the image stream in the string */
-PHP_FUNCTION (imagecreatefromstring)
-{
-#ifdef HAVE_LIBGD15
- zval **data;
- gdImagePtr im;
- int imtype;
- char sig[8];
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &data) == FAILURE)
- {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(data);
- memcpy(sig, Z_STRVAL_PP(data), 8);
-
- imtype = _php_image_type (sig);
-
- switch (imtype) {
- case PHP_GDIMG_TYPE_JPG:
-#ifdef HAVE_GD_JPG
- im = _php_image_create_from_string (data, "JPEG", gdImageCreateFromJpegCtx);
-#else
- php_error(E_WARNING, "No JPEG support in this PHP build");
- RETURN_FALSE;
-#endif
- break;
-
- case PHP_GDIMG_TYPE_PNG:
-#ifdef HAVE_GD_PNG
- im = _php_image_create_from_string (data, "PNG", gdImageCreateFromPngCtx);
-#else
- php_error(E_WARNING, "No PNG support in this PHP build");
- RETURN_FALSE;
-#endif
- break;
-
- case PHP_GDIMG_TYPE_GIF:
-#ifdef HAVE_GD_GIF
- im = _php_image_create_from_string (data, "GIF", gdImageCreateFromGifCtx);
-#else
- php_error(E_WARNING, "No GIF support in this PHP build");
- RETURN_FALSE;
-#endif
- break;
-
- case PHP_GDIMG_TYPE_WBM:
-#ifdef HAVE_GD_WBMP
- im = _php_image_create_from_string (data, "WBMP",gdImageCreateFromWBMPCtx );
-#else
- php_error(E_WARNING, "No WBMP support in this PHP build");
- RETURN_FALSE;
-#endif
- break;
-
- default:
- php_error(E_WARNING, "Data is not in a recognized format.");
- RETURN_FALSE;
-
- }
- if (!im) {
- php_error(E_WARNING, "Couldn't create GD Image Stream out of Data");
- RETURN_FALSE;
- }
-
- ZEND_REGISTER_RESOURCE(return_value, im, le_gd);
-#else
- php_error(E_ERROR, "ImageCreateFromString: Only available with GD 1.5+");
-#endif
-}
-/* }}} */
-
-size_t php_fread_all(char **buf, int socket, FILE *fp, int issock);
-
-/* {{{ _php_image_create_from
- */
-static void _php_image_create_from(INTERNAL_FUNCTION_PARAMETERS, int image_type, char *tn, gdImagePtr (*func_p)(), gdImagePtr (*ioctx_func_p)())
-{
- zval **file, **srcx, **srcy, **width, **height;
- gdImagePtr im;
- char *fn=NULL;
- FILE *fp;
- int issock=0, socketd=0;
- int argc=ZEND_NUM_ARGS();
-
- if ((image_type == PHP_GDIMG_TYPE_GD2PART && argc != 4) ||
- argc != 1 || zend_get_parameters_ex(argc, &file, &srcx, &srcy, &width, &height) == FAILURE)
- {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(file);
-
- if (argc == 4 && image_type == PHP_GDIMG_TYPE_GD2PART) {
- multi_convert_to_long_ex(4, srcx, srcy, width, height);
- }
-
- fn = Z_STRVAL_PP(file);
-
-#ifdef PHP_WIN32
- fp = VCWD_FOPEN(fn, "rb");
-#else
- fp = php_fopen_wrapper(fn, "r", IGNORE_PATH|IGNORE_URL_WIN, &issock, &socketd, NULL);
-#endif
- if (!fp && !socketd) {
- php_strip_url_passwd(fn);
- php_error(E_WARNING, "%s: Unable to open '%s' for reading", get_active_function_name(), fn);
- RETURN_FALSE;
- }
-
-#ifndef USE_GD_IOCTX
- ioctx_func_p = NULL; /* don't allow sockets without IOCtx */
-#endif
-
- if(issock && !ioctx_func_p) {
- php_error(E_WARNING, "%s: Sockets are not supported for image type '%s'",get_active_function_name(),tn);
- RETURN_FALSE;
- }
-
- if(issock && socketd) {
-#ifdef USE_GD_IOCTX
- gdIOCtx* io_ctx;
- size_t buff_size;
- char *buff,*buff_em;
-
- buff_size = php_fread_all(&buff_em, socketd, fp, issock);
-
- if(!buff_size) {
- php_error(E_WARNING,"%s: Cannot read image data",get_active_function_name());
- RETURN_FALSE;
- }
-
- buff = malloc(buff_size); /* Should be malloc! GD uses free */
- memcpy(buff, buff_em, buff_size);
- efree(buff_em);
-
- io_ctx = gdNewDynamicCtx(buff_size,buff);
- if(!io_ctx) {
- php_error(E_WARNING,"%s: Cannot allocate GD IO context",get_active_function_name());
- RETURN_FALSE;
- }
- if (image_type == PHP_GDIMG_TYPE_GD2PART) {
- im = (*ioctx_func_p)(io_ctx, Z_LVAL_PP(srcx), Z_LVAL_PP(srcy), Z_LVAL_PP(width), Z_LVAL_PP(height));
- } else {
- im = (*ioctx_func_p)(io_ctx);
- }
- io_ctx->free(io_ctx);
-#endif
- } else {
- if (image_type == PHP_GDIMG_TYPE_GD2PART) {
- im = (*func_p)(fp, Z_LVAL_PP(srcx), Z_LVAL_PP(srcy), Z_LVAL_PP(width), Z_LVAL_PP(height));
- } else {
- im = (*func_p)(fp);
- }
-
- fflush(fp);
- fclose(fp);
- }
-
- if (!im) {
- php_error(E_WARNING,"%s: '%s' is not a valid %s file", get_active_function_name(), fn, tn);
- RETURN_FALSE;
- }
-
- ZEND_REGISTER_RESOURCE(return_value, im, le_gd);
-}
-/* }}} */
-
-/* {{{ proto int imagecreatefromgif(string filename)
- Create a new image from GIF file or URL */
-PHP_FUNCTION(imagecreatefromgif)
-{
-#ifdef HAVE_GD_GIF
- _php_image_create_from(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GDIMG_TYPE_GIF, "GIF", gdImageCreateFromGif,gdImageCreateFromGifCtx);
-#else /* HAVE_GD_GIF */
- php_error(E_WARNING, "ImageCreateFromGif: No GIF support in this PHP build");
- RETURN_FALSE;
-#endif /* HAVE_GD_GIF */
-}
-/* }}} */
-
-/* {{{ proto int imagecreatefromjpeg(string filename)
- Create a new image from JPEG file or URL */
-PHP_FUNCTION(imagecreatefromjpeg)
-{
-#ifdef HAVE_GD_JPG
- _php_image_create_from(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GDIMG_TYPE_JPG, "JPEG", gdImageCreateFromJpeg,gdImageCreateFromJpegCtx);
-#else /* HAVE_GD_JPG */
- php_error(E_WARNING, "ImageCreateFromJpeg: No JPEG support in this PHP build");
- RETURN_FALSE;
-#endif /* HAVE_GD_JPG */
-}
-/* }}} */
-
-/* {{{ proto int imagecreatefrompng(string filename)
- Create a new image from PNG file or URL */
-PHP_FUNCTION(imagecreatefrompng)
-{
-#ifdef HAVE_GD_PNG
- _php_image_create_from(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GDIMG_TYPE_PNG, "PNG", gdImageCreateFromPng,gdImageCreateFromPngCtx);
-#else /* HAVE_GD_PNG */
- php_error(E_WARNING, "ImageCreateFromPng: No PNG support in this PHP build");
- RETURN_FALSE;
-#endif /* HAVE_GD_PNG */
-}
-/* }}} */
-
-/* {{{ proto int imagecreatefromxbm(string filename)
- Create a new image from XBM file or URL */
-PHP_FUNCTION(imagecreatefromxbm)
-{
-#ifdef HAVE_GD_XBM
- _php_image_create_from(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GDIMG_TYPE_XBM, "XBM", gdImageCreateFromXbm,NULL);
-#else /* HAVE_GD_XBM */
- php_error(E_WARNING, "ImageCreateFromXbm: No XBM support in this PHP build");
- RETURN_FALSE;
-#endif /* HAVE_GD_XBM */
-}
-/* }}} */
-
-/* {{{ todo int imagecreatefromxpm(string filename)
- Create a new image from XPM file or URL */
-PHP_FUNCTION(imagecreatefromxpm)
-{
- /*
-#ifdef HAVE_GD_XPM
- _php_image_create_from(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GDIMG_TYPE_XPM, "XPM", gdImageCreateFromXpm,NULL);
-#else
- */
- php_error(E_WARNING, "ImageCreateFromXpm: No XPM support in this PHP build");
- RETURN_FALSE;
- /*
-#endif
- */
-}
-/* }}} */
-
-/* {{{ proto int imagecreatefromwbmp(string filename)
- Create a new image from WBMP file or URL */
-PHP_FUNCTION(imagecreatefromwbmp)
-{
-#ifdef HAVE_GD_WBMP
- _php_image_create_from(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GDIMG_TYPE_WBM, "WBMP", gdImageCreateFromWBMP,gdImageCreateFromWBMPCtx);
-#else /* HAVE_GD_WBMP */
- php_error(E_WARNING, "ImageCreateFromWBMP: No WBMP support in this PHP build");
- RETURN_FALSE;
-#endif /* HAVE_GD_WBMP */
-}
-/* }}} */
-
-/* {{{ proto int imagecreatefromgd(string filename)
- Create a new image from GD file or URL */
-PHP_FUNCTION(imagecreatefromgd)
-{
- _php_image_create_from(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GDIMG_TYPE_GD, "GD", gdImageCreateFromGd,gdImageCreateFromGdCtx);
-}
-/* }}} */
-
-/* {{{ proto int imagecreatefromgd2(string filename)
- Create a new image from GD2 file or URL */
-PHP_FUNCTION(imagecreatefromgd2)
-{
-#ifdef HAVE_GD_GD2
- _php_image_create_from(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GDIMG_TYPE_GD2, "GD2", gdImageCreateFromGd2,gdImageCreateFromGd2Ctx);
-#else /* HAVE_GD_GD2 */
- php_error(E_WARNING, "ImageCreateFromGd2: No GD2 support in this PHP build");
- RETURN_FALSE;
-#endif /* HAVE_GD_GD2 */
-}
-/* }}} */
-
-/* {{{ proto int imagecreatefromgd2part(string filename, int srcX, int srcY, int width, int height)
- Create a new image from a given part of GD2 file or URL */
-PHP_FUNCTION(imagecreatefromgd2part)
-{
-#ifdef HAVE_GD_GD2
- _php_image_create_from(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GDIMG_TYPE_GD2PART, "GD2", gdImageCreateFromGd2Part,gdImageCreateFromGd2PartCtx);
-#else /* HAVE_GD_GD2 */
- php_error(E_WARNING, "ImageCreateFromGd2Part: No GD2 support in this PHP build");
- RETURN_FALSE;
-#endif /* HAVE_GD_GD2 */
-}
-/* }}} */
-
-/* {{{ _php_image_output
- */
-static void _php_image_output(INTERNAL_FUNCTION_PARAMETERS, int image_type, char *tn, void (*func_p)())
-{
- zval **imgind, **file, **quality;
- gdImagePtr im;
- char *fn = NULL;
- FILE *fp;
- int argc = ZEND_NUM_ARGS();
- int q = -1, i;
-
- /* The quality parameter for Wbmp stands for the threshold when called from image2wbmp() */
- /* When called from imagewbmp() the quality parameter stands for the foreground color. Default: black. */
-
- if (argc < 1 || argc > 3 || zend_get_parameters_ex(argc, &imgind, &file, &quality) == FAILURE)
- {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(im, gdImagePtr, imgind, -1, "Image", le_gd);
-
- if (argc > 1) {
- convert_to_string_ex(file);
- fn = Z_STRVAL_PP(file);
- if (argc == 3) {
- convert_to_long_ex(quality);
- q = Z_LVAL_PP(quality);
- }
- }
-
- if ((argc == 2) || (argc == 3 && Z_STRLEN_PP(file))) {
- if (!fn || fn == empty_string || php_check_open_basedir(fn)) {
- php_error(E_WARNING, "%s: invalid filename '%s'", get_active_function_name(), fn);
- RETURN_FALSE;
- }
-
- fp = VCWD_FOPEN(fn, "wb");
- if (!fp) {
- php_error(E_WARNING, "%s: unable to open '%s' for writing", get_active_function_name(), fn);
- RETURN_FALSE;
- }
-
- switch(image_type) {
- case PHP_GDIMG_CONVERT_WBM:
- if(q<0||q>255) {
- php_error(E_WARNING, "%s: invalid threshold value '%d'. It must be between 0 and 255",get_active_function_name(), q);
- }
- case PHP_GDIMG_TYPE_JPG:
- (*func_p)(im, fp, q);
- break;
- case PHP_GDIMG_TYPE_WBM:
- for(i=0; i < gdImageColorsTotal(im); i++) {
- if(gdImageRed(im, i) == 0) break;
- }
- (*func_p)(im, i, fp);
- break;
- default:
- (*func_p)(im, fp);
- break;
- }
- fflush(fp);
- fclose(fp);
- } else {
- int b;
- FILE *tmp;
- char buf[4096];
-
- tmp = tmpfile();
- if (tmp == NULL) {
- php_error(E_WARNING, "%s: unable to open temporary file", get_active_function_name());
- RETURN_FALSE;
- }
-
- switch(image_type) {
- case PHP_GDIMG_CONVERT_WBM:
- if(q<0||q>255) {
- php_error(E_WARNING, "%s: invalid threshold value '%d'. It must be between 0 and 255",get_active_function_name(), q);
- }
- case PHP_GDIMG_TYPE_JPG:
- (*func_p)(im, tmp, q);
- break;
- case PHP_GDIMG_TYPE_WBM:
- for(i=0; i < gdImageColorsTotal(im); i++) {
- if(gdImageRed(im, i) == 0) break;
- }
- (*func_p)(im, q, tmp);
- break;
- default:
- (*func_p)(im, tmp);
- break;
- }
-
- fseek(tmp, 0, SEEK_SET);
-
-#if APACHE && defined(CHARSET_EBCDIC)
- /* XXX this is unlikely to work any more thies@thieso.net */
-
- SLS_FETCH();
- /* This is a binary file already: avoid EBCDIC->ASCII conversion */
- ap_bsetflag(php3_rqst->connection->client, B_EBCDIC2ASCII, 0);
-#endif
- while ((b = fread(buf, 1, sizeof(buf), tmp)) > 0) {
- php_write(buf, b);
- }
-
- fclose(tmp);
- /* the temporary file is automatically deleted */
- }
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int imagegif(int im [, string filename])
- Output GIF image to browser or file */
-PHP_FUNCTION(imagegif)
-{
-#ifdef HAVE_GD_GIF
-#ifdef HAVE_GD_GIF_CTX
- _php_image_output_ctx(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GDIMG_TYPE_GIF, "GIF", gdImageGifCtx);
-#else
- _php_image_output(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GDIMG_TYPE_GIF, "GIF", gdImageGif);
-#endif
-#else /* HAVE_GD_GIF */
- php_error(E_WARNING, "ImageGif: No GIF support in this PHP build");
- RETURN_FALSE;
-#endif /* HAVE_GD_GIF */
-}
-/* }}} */
-
-/* {{{ proto int imagepng(int im [, string filename])
- Output PNG image to browser or file */
-PHP_FUNCTION(imagepng)
-{
-#ifdef HAVE_GD_PNG
-#ifdef USE_GD_IOCTX
- _php_image_output_ctx(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GDIMG_TYPE_PNG, "PNG", gdImagePngCtx);
-#else
- _php_image_output(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GDIMG_TYPE_PNG, "PNG", gdImagePng);
-#endif
-#else /* HAVE_GD_PNG */
- php_error(E_WARNING, "ImagePng: No PNG support in this PHP build");
- RETURN_FALSE;
-#endif /* HAVE_GD_PNG */
-}
-/* }}} */
-
-/* {{{ proto int imagejpeg(int im [, string filename [, int quality]])
- Output JPEG image to browser or file */
-PHP_FUNCTION(imagejpeg)
-{
-#ifdef HAVE_GD_JPG
-#ifdef USE_GD_IOCTX
- _php_image_output_ctx(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GDIMG_TYPE_JPG, "JPEG", gdImageJpegCtx);
-#else
- _php_image_output(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GDIMG_TYPE_JPG, "JPEG", gdImageJpeg);
-#endif
-#else /* HAVE_GD_JPG */
- php_error(E_WARNING, "ImageJpeg: No JPG support in this PHP build");
- RETURN_FALSE;
-#endif /* HAVE_GD_JPG */
-}
-/* }}} */
-
-/* {{{ proto int imagewbmp(int im [, string filename, [, int foreground]])
- Output WBMP image to browser or file */
-PHP_FUNCTION(imagewbmp)
-{
-#ifdef HAVE_GD_WBMP
-#ifdef USE_GD_IOCTX
- _php_image_output_ctx(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GDIMG_TYPE_WBM, "WBMP", gdImageWBMPCtx);
-#else
- _php_image_output(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GDIMG_TYPE_WBM, "WBMP", gdImageWBMP);
-#endif
-#else /* HAVE_GD_WBMP */
- php_error(E_WARNING, "ImageWBMP: No WBMP support in this PHP build");
- RETURN_FALSE;
-#endif /* HAVE_GD_WBMP */
-}
-/* }}} */
-
-/* {{{ proto int imagegd(int im [, string filename])
- Output GD image to browser or file */
-PHP_FUNCTION(imagegd)
-{
- _php_image_output(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GDIMG_TYPE_GD, "GD", gdImageGd);
-}
-/* }}} */
-
-/* {{{ proto int imagegd2(int im [, string filename])
- Output GD2 image to browser or file */
-PHP_FUNCTION(imagegd2)
-{
-#ifdef HAVE_GD_GD2
- _php_image_output(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GDIMG_TYPE_GD2, "GD2", gdImageGd2);
-#else /* HAVE_GD_GD2 */
- php_error(E_WARNING, "ImageGd2: No GD2 support in this PHP build");
- RETURN_FALSE;
-#endif /* HAVE_GD_GD2 */
-}
-/* }}} */
-
-/* {{{ proto int imagedestroy(int im)
- Destroy an image */
-PHP_FUNCTION(imagedestroy)
-{
- zval **IM;
- gdImagePtr im;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &IM) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
-
- zend_list_delete(Z_LVAL_PP(IM));
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int imagecolorallocate(int im, int red, int green, int blue)
- Allocate a color for an image */
-PHP_FUNCTION(imagecolorallocate)
-{
- zval **IM, **red, **green, **blue;
- gdImagePtr im;
-
- if (ZEND_NUM_ARGS() != 4 || zend_get_parameters_ex(4, &IM, &red, &green, &blue) == FAILURE)
- {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
-
- convert_to_long_ex(red);
- convert_to_long_ex(green);
- convert_to_long_ex(blue);
-
- RETURN_LONG(gdImageColorAllocate(im, Z_LVAL_PP(red), Z_LVAL_PP(green), Z_LVAL_PP(blue)));
-}
-/* }}} */
-
-/* {{{ proto int imagepalettecopy(int dst, int src)
- Copy the palette from the src image onto the dst image */
-PHP_FUNCTION(imagepalettecopy)
-{
-#if HAVE_LIBGD15
- zval **dstim, **srcim;
- gdImagePtr dst, src;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &dstim, &srcim) == FAILURE)
- {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(dst, gdImagePtr, dstim, -1, "Image", le_gd);
- ZEND_FETCH_RESOURCE(src, gdImagePtr, srcim, -1, "Image", le_gd);
-
- gdImagePaletteCopy(dst, src);
-#else
- php_error(E_WARNING, "Sorry ImagePaletteCopy was introduced in GD version 1.5");
- RETURN_FALSE;
-#endif
-}
-/* }}} */
-
-/* {{{ proto int imagecolorat(int im, int x, int y)
- Get the index of the color of a pixel */
-PHP_FUNCTION(imagecolorat)
-{
- zval **IM, **x, **y;
- gdImagePtr im;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &IM, &x, &y) == FAILURE)
- {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
-
- convert_to_long_ex(x);
- convert_to_long_ex(y);
-
- if (gdImageBoundsSafe(im, Z_LVAL_PP(x), Z_LVAL_PP(y))) {
-#if HAVE_LIBGD13
- RETURN_LONG(im->pixels[Z_LVAL_PP(y)][Z_LVAL_PP(x)]);
-#else
- RETURN_LONG(im->pixels[Z_LVAL_PP(x)][Z_LVAL_PP(y)]);
-#endif
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto int imagecolorclosest(int im, int red, int green, int blue)
- Get the index of the closest color to the specified color */
-PHP_FUNCTION(imagecolorclosest)
-{
- zval **IM, **red, **green, **blue;
- gdImagePtr im;
-
- if (ZEND_NUM_ARGS() != 4 || zend_get_parameters_ex(4, &IM, &red, &green, &blue) == FAILURE)
- {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
-
- convert_to_long_ex(red);
- convert_to_long_ex(green);
- convert_to_long_ex(blue);
-
- RETURN_LONG(gdImageColorClosest(im, Z_LVAL_PP(red), Z_LVAL_PP(green), Z_LVAL_PP(blue)));
-}
-/* }}} */
-
-/* {{{ proto int imagecolorclosesthwb(int im, int red, int green, int blue)
- Get the index of the color which has the hue, white and blackness nearest to the given color */
-PHP_FUNCTION(imagecolorclosesthwb)
-{
-#if HAVE_COLORCLOSESTHWB
- zval **IM, **red, **green, **blue;
- gdImagePtr im;
-
- if (ZEND_NUM_ARGS() != 4 || zend_get_parameters_ex(4, &IM, &red, &green, &blue) == FAILURE)
- {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
-
- convert_to_long_ex(red);
- convert_to_long_ex(green);
- convert_to_long_ex(blue);
-
- RETURN_LONG(gdImageColorClosestHWB(im, Z_LVAL_PP(red), Z_LVAL_PP(green), Z_LVAL_PP(blue)));
-#else
- php_error(E_WARNING, "ImageColorClosestHWB functionality was added in GD 1.8");
- RETURN_FALSE;
-#endif
-}
-/* }}} */
-
-/* {{{ proto int imagecolordeallocate(int im, int index)
- De-allocate a color for an image */
-PHP_FUNCTION(imagecolordeallocate)
-{
- zval **IM, **index;
- int col;
- gdImagePtr im;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &IM, &index) == FAILURE)
- {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
-
- convert_to_long_ex(index);
- col = Z_LVAL_PP(index);
-
- if (col >= 0 && col < gdImageColorsTotal(im)) {
- gdImageColorDeallocate(im, col);
- RETURN_TRUE;
- } else {
- php_error(E_WARNING, "Color index out of range");
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto int imagecolorresolve(int im, int red, int green, int blue)
- Get the index of the specified color or its closest possible alternative */
-PHP_FUNCTION(imagecolorresolve)
-{
- zval **IM, **red, **green, **blue;
- gdImagePtr im;
-
- if (ZEND_NUM_ARGS() != 4 || zend_get_parameters_ex(4, &IM, &red, &green, &blue) == FAILURE)
- {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
-
- convert_to_long_ex(red);
- convert_to_long_ex(green);
- convert_to_long_ex(blue);
-
- RETURN_LONG(gdImageColorResolve(im, Z_LVAL_PP(red), Z_LVAL_PP(green), Z_LVAL_PP(blue)));
-}
-/* }}} */
-
-/* {{{ proto int imagecolorexact(int im, int red, int green, int blue)
- Get the index of the specified color */
-PHP_FUNCTION(imagecolorexact)
-{
- zval **IM, **red, **green, **blue;
- gdImagePtr im;
-
- if (ZEND_NUM_ARGS() != 4 || zend_get_parameters_ex(4, &IM, &red, &green, &blue) == FAILURE)
- {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
-
- convert_to_long_ex(red);
- convert_to_long_ex(green);
- convert_to_long_ex(blue);
-
- RETURN_LONG(gdImageColorExact(im, Z_LVAL_PP(red), Z_LVAL_PP(green), Z_LVAL_PP(blue)));
-}
-/* }}} */
-
-/* {{{ proto int imagecolorset(int im, int col, int red, int green, int blue)
- Set the color for the specified palette index */
-PHP_FUNCTION(imagecolorset)
-{
- zval **IM, **color, **red, **green, **blue;
- int col;
- gdImagePtr im;
-
- if (ZEND_NUM_ARGS() != 5 || zend_get_parameters_ex(5, &IM, &color, &red, &green, &blue) == FAILURE)
- {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
-
- convert_to_long_ex(color);
- convert_to_long_ex(red);
- convert_to_long_ex(green);
- convert_to_long_ex(blue);
-
- col = Z_LVAL_PP(color);
-
- if (col >= 0 && col < gdImageColorsTotal(im)) {
- im->red[col] = Z_LVAL_PP(red);
- im->green[col] = Z_LVAL_PP(green);
- im->blue[col] = Z_LVAL_PP(blue);
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto array imagecolorsforindex(int im, int col)
- Get the colors for an index */
-PHP_FUNCTION(imagecolorsforindex)
-{
- zval **IM, **index;
- int col;
- gdImagePtr im;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &IM, &index) == FAILURE)
- {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
-
- convert_to_long_ex(index);
- col = Z_LVAL_PP(index);
-
- if (col >= 0 && col < gdImageColorsTotal(im)) {
- if (array_init(return_value) == FAILURE) {
- RETURN_FALSE;
- }
- add_assoc_long(return_value,"red", im->red[col]);
- add_assoc_long(return_value,"green",im->green[col]);
- add_assoc_long(return_value,"blue", im->blue[col]);
- } else {
- php_error(E_WARNING, "Color index out of range");
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto int imagegammacorrect(int im, double inputgamma, double outputgamma)
- Apply a gamma correction to a GD image */
-PHP_FUNCTION(imagegammacorrect)
-{
- zval **IM, **inputgamma, **outputgamma;
- gdImagePtr im;
- int i;
- double input, output;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &IM, &inputgamma, &outputgamma) == FAILURE)
- {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_double_ex(inputgamma);
- convert_to_double_ex(outputgamma);
-
- input = Z_DVAL_PP(inputgamma);
- output = Z_DVAL_PP(outputgamma);
-
- ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
-
- for (i = 0; i < gdImageColorsTotal(im); i++) {
- im->red[i] = (int)((pow((pow((im->red[i] / 255.0), input)), 1.0 / output) * 255)+.5);
- im->green[i] = (int)((pow((pow((im->green[i] / 255.0), input)), 1.0 / output) * 255)+.5);
- im->blue[i] = (int)((pow((pow((im->blue[i] / 255.0), input)), 1.0 / output) * 255)+.5);
- }
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int imagesetpixel(int im, int x, int y, int col)
- Set a single pixel */
-PHP_FUNCTION(imagesetpixel)
-{
- zval **IM, **x, **y, **col;
- gdImagePtr im;
-
- if (ZEND_NUM_ARGS() != 4 || zend_get_parameters_ex(4, &IM, &x, &y, &col) == FAILURE)
- {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
-
- convert_to_long_ex(x);
- convert_to_long_ex(y);
- convert_to_long_ex(col);
-
- gdImageSetPixel(im,Z_LVAL_PP(x),Z_LVAL_PP(y),Z_LVAL_PP(col));
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int imageline(int im, int x1, int y1, int x2, int y2, int col)
- Draw a line */
-PHP_FUNCTION(imageline)
-{
- zval **IM, **x1, **y1, **x2, **y2, **col;
- gdImagePtr im;
-
- if (ZEND_NUM_ARGS() != 6 || zend_get_parameters_ex(6, &IM, &x1, &y1, &x2, &y2, &col) == FAILURE)
- {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
-
- convert_to_long_ex(x1);
- convert_to_long_ex(y1);
- convert_to_long_ex(x2);
- convert_to_long_ex(y2);
- convert_to_long_ex(col);
-
- gdImageLine(im,Z_LVAL_PP(x1),Z_LVAL_PP(y1),Z_LVAL_PP(x2),Z_LVAL_PP(y2),Z_LVAL_PP(col));
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int imagedashedline(int im, int x1, int y1, int x2, int y2, int col)
- Draw a dashed line */
-PHP_FUNCTION(imagedashedline)
-{
- zval **IM, **x1, **y1, **x2, **y2, **col;
- gdImagePtr im;
-
- if (ZEND_NUM_ARGS() != 6 || zend_get_parameters_ex(6, &IM, &x1, &y1, &x2, &y2, &col) == FAILURE)
- {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
-
- convert_to_long_ex(x1);
- convert_to_long_ex(y1);
- convert_to_long_ex(x2);
- convert_to_long_ex(y2);
- convert_to_long_ex(col);
-
- gdImageDashedLine(im,Z_LVAL_PP(x1),Z_LVAL_PP(y1),Z_LVAL_PP(x2),Z_LVAL_PP(y2),Z_LVAL_PP(col));
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int imagerectangle(int im, int x1, int y1, int x2, int y2, int col)
- Draw a rectangle */
-PHP_FUNCTION(imagerectangle)
-{
- zval **IM, **x1, **y1, **x2, **y2, **col;
- gdImagePtr im;
-
- if (ZEND_NUM_ARGS() != 6 || zend_get_parameters_ex(6, &IM, &x1, &y1, &x2, &y2, &col) == FAILURE)
- {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
-
- convert_to_long_ex(x1);
- convert_to_long_ex(y1);
- convert_to_long_ex(x2);
- convert_to_long_ex(y2);
- convert_to_long_ex(col);
-
- gdImageRectangle(im,Z_LVAL_PP(x1),Z_LVAL_PP(y1),Z_LVAL_PP(x2),Z_LVAL_PP(y2),Z_LVAL_PP(col));
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int imagefilledrectangle(int im, int x1, int y1, int x2, int y2, int col)
- Draw a filled rectangle */
-PHP_FUNCTION(imagefilledrectangle)
-{
- zval **IM, **x1, **y1, **x2, **y2, **col;
- gdImagePtr im;
-
- if (ZEND_NUM_ARGS() != 6 || zend_get_parameters_ex(6, &IM, &x1, &y1, &x2, &y2, &col) == FAILURE)
- {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
-
- convert_to_long_ex(x1);
- convert_to_long_ex(y1);
- convert_to_long_ex(x2);
- convert_to_long_ex(y2);
- convert_to_long_ex(col);
-
- gdImageFilledRectangle(im,Z_LVAL_PP(x1),Z_LVAL_PP(y1),Z_LVAL_PP(x2),Z_LVAL_PP(y2),Z_LVAL_PP(col));
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int imagearc(int im, int cx, int cy, int w, int h, int s, int e, int col)
- Draw a partial ellipse */
-PHP_FUNCTION(imagearc)
-{
- zval **IM, **cx, **cy, **w, **h, **ST, **E, **col;
- gdImagePtr im;
- int e,st;
-
- if (ZEND_NUM_ARGS() != 8 || zend_get_parameters_ex(8, &IM, &cx, &cy, &w, &h, &ST, &E, &col) == FAILURE)
- {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
-
- convert_to_long_ex(cx);
- convert_to_long_ex(cy);
- convert_to_long_ex(w);
- convert_to_long_ex(h);
- convert_to_long_ex(ST);
- convert_to_long_ex(E);
- convert_to_long_ex(col);
-
- e = Z_LVAL_PP(E);
- st = Z_LVAL_PP(ST);
-
- if (e < 0) e %= 360;
- if (st < 0) st %= 360;
-
- gdImageArc(im,Z_LVAL_PP(cx),Z_LVAL_PP(cy),Z_LVAL_PP(w),Z_LVAL_PP(h),st,e,Z_LVAL_PP(col));
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int imagefilltoborder(int im, int x, int y, int border, int col)
- Flood fill to specific color */
-PHP_FUNCTION(imagefilltoborder)
-{
- zval **IM, **x, **y, **border, **col;
- gdImagePtr im;
-
- if (ZEND_NUM_ARGS() != 5 || zend_get_parameters_ex(5, &IM, &x, &y, &border, &col) == FAILURE)
- {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
-
- convert_to_long_ex(x);
- convert_to_long_ex(y);
- convert_to_long_ex(border);
- convert_to_long_ex(col);
-
- gdImageFillToBorder(im,Z_LVAL_PP(x),Z_LVAL_PP(y),Z_LVAL_PP(border),Z_LVAL_PP(col));
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int imagefill(int im, int x, int y, int col)
- Flood fill */
-PHP_FUNCTION(imagefill)
-{
- zval **IM, **x, **y, **col;
- gdImagePtr im;
-
- if (ZEND_NUM_ARGS() != 4 || zend_get_parameters_ex(4, &IM, &x, &y, &col) == FAILURE)
- {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
-
- convert_to_long_ex(x);
- convert_to_long_ex(y);
- convert_to_long_ex(col);
-
- gdImageFill(im,Z_LVAL_PP(x),Z_LVAL_PP(y),Z_LVAL_PP(col));
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int imagecolorstotal(int im)
- Find out the number of colors in an image's palette */
-PHP_FUNCTION(imagecolorstotal)
-{
- zval **IM;
- gdImagePtr im;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &IM) == FAILURE)
- {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
-
- RETURN_LONG(gdImageColorsTotal(im));
-}
-/* }}} */
-
-/* {{{ proto int imagecolortransparent(int im [, int col])
- Define a color as transparent */
-PHP_FUNCTION(imagecolortransparent)
-{
- zval **IM, **COL;
- gdImagePtr im;
-
- switch(ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &IM) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- break;
- case 2:
- if (zend_get_parameters_ex(2, &IM, &COL) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(COL);
- break;
- default:
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
-
- if (ZEND_NUM_ARGS() > 1) {
- gdImageColorTransparent(im, Z_LVAL_PP(COL));
- }
-
- RETURN_LONG(gdImageGetTransparent(im));
-}
-/* }}} */
-
-/* {{{ proto int imageinterlace(int im [, int interlace])
- Enable or disable interlace */
-PHP_FUNCTION(imageinterlace)
-{
- zval **IM, **INT;
- gdImagePtr im;
-
- switch(ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &IM) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- break;
- case 2:
- if (zend_get_parameters_ex(2, &IM, &INT) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(INT);
- break;
- default:
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
-
- if (ZEND_NUM_ARGS() > 1) {
- gdImageInterlace(im,Z_LVAL_PP(INT));
- }
-
- RETURN_LONG(gdImageGetInterlaced(im));
-}
-/* }}} */
-
-/* {{{ php_imagepolygon
- arg = 0 normal polygon
- arg = 1 filled polygon */
-/* im, points, num_points, col */
-static void php_imagepolygon(INTERNAL_FUNCTION_PARAMETERS, int filled)
-{
- zval **IM, **POINTS, **NPOINTS, **COL;
- pval **var = NULL;
- gdImagePtr im;
- gdPointPtr points;
- int npoints, col, nelem, i;
-
- if (ZEND_NUM_ARGS() != 4 || zend_get_parameters_ex(4, &IM, &POINTS, &NPOINTS, &COL) == FAILURE)
- {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
-
- convert_to_long_ex(NPOINTS);
- convert_to_long_ex(COL);
-
- npoints = Z_LVAL_PP(NPOINTS);
- col = Z_LVAL_PP(COL);
-
- if ((*POINTS)->type != IS_ARRAY) {
- php_error(E_WARNING, "2nd argument to imagepolygon not an array");
- RETURN_FALSE;
- }
-
- nelem = zend_hash_num_elements((*POINTS)->value.ht);
- if (nelem < 6) {
- php_error(E_WARNING, "you must have at least 3 points in your array");
- RETURN_FALSE;
- }
-
- if (nelem < npoints * 2) {
- php_error(E_WARNING, "trying to use %d points in array with only %d points", npoints, nelem/2);
- RETURN_FALSE;
- }
-
- points = (gdPointPtr) emalloc(npoints * sizeof(gdPoint));
-
- for (i = 0; i < npoints; i++) {
- if (zend_hash_index_find((*POINTS)->value.ht, (i * 2), (void **) &var) == SUCCESS) {
- SEPARATE_ZVAL((var));
- convert_to_long(*var);
- points[i].x = Z_LVAL_PP(var);
- }
- if (zend_hash_index_find((*POINTS)->value.ht, (i * 2) + 1, (void **) &var) == SUCCESS) {
- SEPARATE_ZVAL(var);
- convert_to_long(*var);
- points[i].y = Z_LVAL_PP(var);
- }
- }
-
- if (filled) {
- gdImageFilledPolygon(im, points, npoints, col);
- } else {
- gdImagePolygon(im, points, npoints, col);
- }
-
- efree(points);
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int imagepolygon(int im, array point, int num_points, int col)
- Draw a polygon */
-PHP_FUNCTION(imagepolygon)
-{
- php_imagepolygon(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-/* }}} */
-
-/* {{{ proto int imagefilledpolygon(int im, array point, int num_points, int col)
- Draw a filled polygon */
-PHP_FUNCTION(imagefilledpolygon)
-{
- php_imagepolygon(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
-}
-/* }}} */
-
-/* {{{ php_find_gd_font
- */
-static gdFontPtr php_find_gd_font(int size)
-{
- gdFontPtr font;
- int ind_type;
-
- switch (size) {
- case 1:
- font = gdFontTiny;
- break;
- case 2:
- font = gdFontSmall;
- break;
- case 3:
- font = gdFontMediumBold;
- break;
- case 4:
- font = gdFontLarge;
- break;
- case 5:
- font = gdFontGiant;
- break;
- default:
- font = zend_list_find(size - 5, &ind_type);
- if (!font || ind_type != le_gd_font) {
- if (size < 1) {
- font = gdFontTiny;
- } else {
- font = gdFontGiant;
- }
- }
- break;
- }
-
- return font;
-}
-/* }}} */
-
-/* {{{ php_imagefontsize
- * arg = 0 ImageFontWidth
- * arg = 1 ImageFontHeight
- */
-static void php_imagefontsize(INTERNAL_FUNCTION_PARAMETERS, int arg)
-{
- zval **SIZE;
- gdFontPtr font;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &SIZE) == FAILURE)
- {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(SIZE);
-
- font = php_find_gd_font(Z_LVAL_PP(SIZE));
- RETURN_LONG(arg ? font->h : font->w);
-}
-/* }}} */
-
-/* {{{ proto int imagefontwidth(int font)
- Get font width */
-PHP_FUNCTION(imagefontwidth)
-{
- php_imagefontsize(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-/* }}} */
-
-/* {{{ proto int imagefontheight(int font)
- Get font height */
-PHP_FUNCTION(imagefontheight)
-{
- php_imagefontsize(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
-}
-/* }}} */
-
-/* {{{ php_gdimagecharup
- * workaround for a bug in gd 1.2 */
-void php_gdimagecharup(gdImagePtr im, gdFontPtr f, int x, int y, int c, int color)
-{
- int cx, cy, px, py, fline;
- cx = 0;
- cy = 0;
- if ((c < f->offset) || (c >= (f->offset + f->nchars))) {
- return;
- }
- fline = (c - f->offset) * f->h * f->w;
- for (py = y; (py > (y - f->w)); py--) {
- for (px = x; (px < (x + f->h)); px++) {
- if (f->data[fline + cy * f->w + cx]) {
- gdImageSetPixel(im, px, py, color);
- }
- cy++;
- }
- cy = 0;
- cx++;
- }
-}
-/* }}} */
-
-/* {{{ php_imagechar
- * arg = 0 ImageChar
- * arg = 1 ImageCharUp
- * arg = 2 ImageString
- * arg = 3 ImageStringUp
- */
-static void php_imagechar(INTERNAL_FUNCTION_PARAMETERS, int mode)
-{
- zval **IM, **SIZE, **X, **Y, **C, **COL;
- gdImagePtr im;
- int ch = 0, col, x, y, size, i, l = 0;
- unsigned char *str = NULL;
- gdFontPtr font;
-
- if (ZEND_NUM_ARGS() != 6 || zend_get_parameters_ex(6, &IM, &SIZE, &X, &Y, &C, &COL) == FAILURE)
- {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
-
- convert_to_long_ex(SIZE);
- convert_to_long_ex(X);
- convert_to_long_ex(Y);
- convert_to_string_ex(C);
- convert_to_long_ex(COL);
-
- col = Z_LVAL_PP(COL);
-
- if (mode < 2) {
- ch = (int)((unsigned char)*(Z_STRVAL_PP(C)));
- } else {
- str = (unsigned char *) estrndup(Z_STRVAL_PP(C), Z_STRLEN_PP(C));
- l = strlen(str);
- }
-
- y = Z_LVAL_PP(Y);
- x = Z_LVAL_PP(X);
- size = Z_LVAL_PP(SIZE);
-
- font = php_find_gd_font(size);
-
- switch(mode) {
- case 0:
- gdImageChar(im, font, x, y, ch, col);
- break;
- case 1:
- php_gdimagecharup(im, font, x, y, ch, col);
- break;
- case 2:
- for (i = 0; (i < l); i++) {
- gdImageChar(im, font, x, y, (int)((unsigned char)str[i]),
- col);
- x += font->w;
- }
- break;
- case 3: {
- for (i = 0; (i < l); i++) {
- /* php_gdimagecharup(im, font, x, y, (int)str[i], col); */
- gdImageCharUp(im, font, x, y, (int)str[i], col);
- y -= font->w;
- }
- break;
- }
- }
- if (str) {
- efree(str);
- }
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int imagechar(int im, int font, int x, int y, string c, int col)
- Draw a character */
-PHP_FUNCTION(imagechar)
-{
- php_imagechar(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-/* }}} */
-
-/* {{{ proto int imagecharup(int im, int font, int x, int y, string c, int col)
- Draw a character rotated 90 degrees counter-clockwise */
-PHP_FUNCTION(imagecharup)
-{
- php_imagechar(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
-}
-/* }}} */
-
-/* {{{ proto int imagestring(int im, int font, int x, int y, string str, int col)
- Draw a string horizontally */
-PHP_FUNCTION(imagestring)
-{
- php_imagechar(INTERNAL_FUNCTION_PARAM_PASSTHRU, 2);
-}
-/* }}} */
-
-/* {{{ proto int imagestringup(int im, int font, int x, int y, string str, int col)
- Draw a string vertically - rotated 90 degrees counter-clockwise */
-PHP_FUNCTION(imagestringup)
-{
- php_imagechar(INTERNAL_FUNCTION_PARAM_PASSTHRU, 3);
-}
-/* }}} */
-
-/* {{{ proto int imagecopy(int dst_im, int src_im, int dst_x, int dst_y, int src_x, int src_y, int src_w, int src_h)
- Copy part of an image */
-PHP_FUNCTION(imagecopy)
-{
- zval **SIM, **DIM, **SX, **SY, **SW, **SH, **DX, **DY;
- gdImagePtr im_dst, im_src;
- int srcH, srcW, srcY, srcX, dstY, dstX;
-
- if (ZEND_NUM_ARGS() != 8 ||
- zend_get_parameters_ex(8, &DIM, &SIM, &DX, &DY, &SX, &SY, &SW, &SH) == FAILURE)
- {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(im_src, gdImagePtr, SIM, -1, "Image", le_gd);
- ZEND_FETCH_RESOURCE(im_dst, gdImagePtr, DIM, -1, "Image", le_gd);
-
- convert_to_long_ex(SX);
- convert_to_long_ex(SY);
- convert_to_long_ex(SW);
- convert_to_long_ex(SH);
- convert_to_long_ex(DX);
- convert_to_long_ex(DY);
-
- srcX = Z_LVAL_PP(SX);
- srcY = Z_LVAL_PP(SY);
- srcH = Z_LVAL_PP(SH);
- srcW = Z_LVAL_PP(SW);
- dstX = Z_LVAL_PP(DX);
- dstY = Z_LVAL_PP(DY);
-
- gdImageCopy(im_dst, im_src, dstX, dstY, srcX, srcY, srcW, srcH);
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int imagecopymerge(int src_im, int dst_im, int dst_x, int dst_y, int src_x, int src_y, int src_w, int src_h, int pct)
- Merge one part of an image with another */
-PHP_FUNCTION(imagecopymerge)
-{
-#if HAVE_LIBGD15
- zval **SIM, **DIM, **SX, **SY, **SW, **SH, **DX, **DY, **PCT;
- gdImagePtr im_dst, im_src;
- int srcH, srcW, srcY, srcX, dstY, dstX, pct;
-
- if (ZEND_NUM_ARGS() != 9 ||
- zend_get_parameters_ex(9, &DIM, &SIM, &DX, &DY, &SX, &SY, &SW, &SH, &PCT) == FAILURE)
- {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(im_src, gdImagePtr, SIM, -1, "Image", le_gd);
- ZEND_FETCH_RESOURCE(im_dst, gdImagePtr, DIM, -1, "Image", le_gd);
-
- convert_to_long_ex(SX);
- convert_to_long_ex(SY);
- convert_to_long_ex(SW);
- convert_to_long_ex(SH);
- convert_to_long_ex(DX);
- convert_to_long_ex(DY);
- convert_to_long_ex(PCT);
-
- srcX = Z_LVAL_PP(SX);
- srcY = Z_LVAL_PP(SY);
- srcH = Z_LVAL_PP(SH);
- srcW = Z_LVAL_PP(SW);
- dstX = Z_LVAL_PP(DX);
- dstY = Z_LVAL_PP(DY);
- pct = Z_LVAL_PP(PCT);
-
- gdImageCopyMerge(im_dst, im_src, dstX, dstY, srcX, srcY, srcW, srcH, pct);
- RETURN_TRUE;
-#else
- php_error(E_WARNING, "ImageCopyMerge was introduced in GD version 1.5");
- RETURN_FALSE;
-#endif
-}
-/* }}} */
-
-/* {{{ proto int imagecopymergegray(int src_im, int dst_im, int dst_x, int dst_y, int src_x, int src_y, int src_w, int src_h, int pct)
- Merge one part of an image with another */
-PHP_FUNCTION(imagecopymergegray)
-{
-#if HAVE_LIBGD15
- zval **SIM, **DIM, **SX, **SY, **SW, **SH, **DX, **DY, **PCT;
- gdImagePtr im_dst, im_src;
- int srcH, srcW, srcY, srcX, dstY, dstX, pct;
-
- if (ZEND_NUM_ARGS() != 9 ||
- zend_get_parameters_ex(9, &DIM, &SIM, &DX, &DY, &SX, &SY, &SW, &SH, &PCT) == FAILURE)
- {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(im_src, gdImagePtr, SIM, -1, "Image", le_gd);
- ZEND_FETCH_RESOURCE(im_dst, gdImagePtr, DIM, -1, "Image", le_gd);
-
- convert_to_long_ex(SX);
- convert_to_long_ex(SY);
- convert_to_long_ex(SW);
- convert_to_long_ex(SH);
- convert_to_long_ex(DX);
- convert_to_long_ex(DY);
- convert_to_long_ex(PCT);
-
- srcX = Z_LVAL_PP(SX);
- srcY = Z_LVAL_PP(SY);
- srcH = Z_LVAL_PP(SH);
- srcW = Z_LVAL_PP(SW);
- dstX = Z_LVAL_PP(DX);
- dstY = Z_LVAL_PP(DY);
- pct = Z_LVAL_PP(PCT);
-
- gdImageCopyMergeGray(im_dst, im_src, dstX, dstY, srcX, srcY, srcW, srcH, pct);
- RETURN_TRUE;
-#else
- php_error(E_WARNING, "%s(): was introduced in GD version 1.5", get_active_function_name());
- RETURN_FALSE;
-#endif
-}
-/* }}} */
-
-/* {{{ proto int imagecopyresized(int dst_im, int src_im, int dst_x, int dst_y, int src_x, int src_y, int dst_w, int dst_h, int src_w, int src_h)
- Copy and resize part of an image */
-PHP_FUNCTION(imagecopyresized)
-{
- zval **SIM, **DIM, **SX, **SY, **SW, **SH, **DX, **DY, **DW, **DH;
- gdImagePtr im_dst, im_src;
- int srcH, srcW, dstH, dstW, srcY, srcX, dstY, dstX;
-
- if (ZEND_NUM_ARGS() != 10 ||
- zend_get_parameters_ex(10, &DIM, &SIM, &DX, &DY, &SX, &SY, &DW, &DH, &SW, &SH) == FAILURE)
- {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(im_dst, gdImagePtr, DIM, -1, "Image", le_gd);
- ZEND_FETCH_RESOURCE(im_src, gdImagePtr, SIM, -1, "Image", le_gd);
-
- convert_to_long_ex(SX);
- convert_to_long_ex(SY);
- convert_to_long_ex(SW);
- convert_to_long_ex(SH);
- convert_to_long_ex(DX);
- convert_to_long_ex(DY);
- convert_to_long_ex(DW);
- convert_to_long_ex(DH);
-
- srcX = Z_LVAL_PP(SX);
- srcY = Z_LVAL_PP(SY);
- srcH = Z_LVAL_PP(SH);
- srcW = Z_LVAL_PP(SW);
- dstX = Z_LVAL_PP(DX);
- dstY = Z_LVAL_PP(DY);
- dstH = Z_LVAL_PP(DH);
- dstW = Z_LVAL_PP(DW);
-
- gdImageCopyResized(im_dst, im_src, dstX, dstY, srcX, srcY, dstW, dstH, srcW, srcH);
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int imagesx(int im)
- Get image width */
-PHP_FUNCTION(imagesx)
-{
- zval **IM;
- gdImagePtr im;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &IM) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
-
- RETURN_LONG(gdImageSX(im));
-}
-/* }}} */
-
-/* {{{ proto int imagesy(int im)
- Get image height */
-PHP_FUNCTION(imagesy)
-{
- zval **IM;
- gdImagePtr im;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &IM) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
-
- RETURN_LONG(gdImageSY(im));
-}
-/* }}} */
-
-#ifdef ENABLE_GD_TTF
-#define TTFTEXT_DRAW 0
-#define TTFTEXT_BBOX 1
-#endif
-
-/* {{{ proto array imagettfbbox(int size, int angle, string font_file, string text)
- Give the bounding box of a text using TrueType fonts */
-PHP_FUNCTION(imagettfbbox)
-{
-#ifdef ENABLE_GD_TTF
- php_imagettftext_common(INTERNAL_FUNCTION_PARAM_PASSTHRU, TTFTEXT_BBOX);
-#else
- php_error(E_WARNING, "ImageTtfBBox: No TTF support in this PHP build");
- RETURN_FALSE;
-#endif
-}
-/* }}} */
-
-/* {{{ proto array imagettftext(int im, int size, int angle, int x, int y, int col, string font_file, string text)
- Write text to the image using a TrueType font */
-PHP_FUNCTION(imagettftext)
-{
-#ifdef ENABLE_GD_TTF
- php_imagettftext_common(INTERNAL_FUNCTION_PARAM_PASSTHRU, TTFTEXT_DRAW);
-#else
- php_error(E_WARNING, "ImageTtfText: No TTF support in this PHP build");
- RETURN_FALSE;
-#endif
-}
-/* }}} */
-
-#ifdef ENABLE_GD_TTF
-/* {{{ php_imagettftext_common
- */
-static
-void php_imagettftext_common(INTERNAL_FUNCTION_PARAMETERS, int mode)
-{
- zval **IM, **PTSIZE, **ANGLE, **X, **Y, **C, **FONTNAME, **COL;
- gdImagePtr im=NULL;
- int col, x, y, l=0, i, brect[8];
- double ptsize, angle;
- unsigned char *str = NULL, *fontname = NULL;
- char *error;
-
- if (mode == TTFTEXT_BBOX) {
- if (ZEND_NUM_ARGS() != 4 || zend_get_parameters_ex(4, &PTSIZE, &ANGLE, &FONTNAME, &C) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- } else {
- if (ZEND_NUM_ARGS() != 8 || zend_get_parameters_ex(8, &IM, &PTSIZE, &ANGLE, &X, &Y, &COL, &FONTNAME, &C) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
- }
-
- convert_to_double_ex(PTSIZE);
- convert_to_double_ex(ANGLE);
- convert_to_string_ex(FONTNAME);
- convert_to_string_ex(C);
-
- if (mode == TTFTEXT_BBOX) {
- im = NULL;
- col = x = y = -1;
- } else {
- convert_to_long_ex(X);
- convert_to_long_ex(Y);
- convert_to_long_ex(COL);
- col = Z_LVAL_PP(COL);
- y = Z_LVAL_PP(Y);
- x = Z_LVAL_PP(X);
- }
-
- ptsize = Z_DVAL_PP(PTSIZE);
- angle = Z_DVAL_PP(ANGLE) * (M_PI/180); /* convert to radians */
-
- str = (unsigned char *) Z_STRVAL_PP(C);
- l = strlen(str);
- fontname = (unsigned char *) Z_STRVAL_PP(FONTNAME);
-
-#ifdef USE_GD_IMGSTRTTF
-# if HAVE_LIBGD20 & HAVE_LIBFREETYPE
- error = gdImageStringFT(im, brect, col, fontname, ptsize, angle, x, y, str);
-# else
- error = gdImageStringTTF(im, brect, col, fontname, ptsize, angle, x, y, str);
-# endif
-#else
- error = gdttf(im, brect, col, fontname, ptsize, angle, x, y, str);
-#endif
-
- if (error) {
- php_error(E_WARNING, "%s", error);
- RETURN_FALSE;
- }
-
- if (array_init(return_value) == FAILURE) {
- RETURN_FALSE;
- }
-
- /* return array with the text's bounding box */
- for (i = 0; i < 8; i++) {
- add_next_index_long(return_value, brect[i]);
- }
-}
-/* }}} */
-#endif /* ENABLE_GD_TTF */
-
-#if HAVE_LIBT1
-
-/* {{{ php_free_ps_font
- */
-void php_free_ps_font(zend_rsrc_list_entry *rsrc)
-{
- int *font = (int *)rsrc->ptr;
- T1_DeleteFont(*font);
- efree(font);
-}
-/* }}} */
-
-/* {{{ php_free_ps_enc
- */
-void php_free_ps_enc(zend_rsrc_list_entry *rsrc)
-{
- char **enc = (char **)rsrc->ptr;
- T1_DeleteEncoding(enc);
-}
-/* }}} */
-
-#endif
-
-/* {{{ proto int imagepsloadfont(string pathname)
- Load a new font from specified file */
-PHP_FUNCTION(imagepsloadfont)
-{
-#if HAVE_LIBT1
- zval **file;
- int f_ind, *font;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &file) == FAILURE)
- {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(file);
-
- f_ind = T1_AddFont(Z_STRVAL_PP(file));
-
- if (f_ind < 0) {
- switch (f_ind) {
- case -1:
- php_error(E_WARNING, "Couldn't find the font file");
- RETURN_FALSE;
- break;
- case -2:
- case -3:
- php_error(E_WARNING, "Memory allocation fault in t1lib");
- RETURN_FALSE;
- break;
- default:
- php_error(E_WARNING, "An unknown error occurred in t1lib");
- RETURN_FALSE;
- break;
- }
- }
-
- if (T1_LoadFont(f_ind)) {
- php_error(E_WARNING, "Couldn't load the font");
- RETURN_FALSE;
- }
-
- font = (int *) emalloc(sizeof(int));
- *font = f_ind;
- ZEND_REGISTER_RESOURCE(return_value, font, le_ps_font);
-#else
- php_error(E_WARNING, "ImagePsLoadFont: No T1lib support in this PHP build");
- RETURN_FALSE;
-#endif
-}
-/* }}} */
-
-/* {{{ The function in t1lib which this function uses seem to be buggy...
-proto int imagepscopyfont(int font_index)
-Make a copy of a font for purposes like extending or reenconding */
-/*
-PHP_FUNCTION(imagepscopyfont)
-{
-#if HAVE_LIBT1
- zval **fnt;
- int l_ind, type;
- gd_ps_font *nf_ind, *of_ind;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &fnt) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(fnt);
-
- of_ind = zend_list_find(Z_LVAL_PP(fnt), &type);
-
- if (type != le_ps_font) {
- php_error(E_WARNING, "%d is not a Type 1 font index", Z_LVAL_PP(fnt));
- RETURN_FALSE;
- }
-
- nf_ind = emalloc(sizeof(gd_ps_font));
- nf_ind->font_id = T1_CopyFont(of_ind->font_id);
-
- if (nf_ind->font_id < 0) {
- l_ind = nf_ind->font_id;
- efree(nf_ind);
- switch (l_ind) {
- case -1:
- php_error(E_WARNING, "FontID %d is not loaded in memory", l_ind);
- RETURN_FALSE;
- break;
- case -2:
- php_error(E_WARNING, "Tried to copy a logical font");
- RETURN_FALSE;
- break;
- case -3:
- php_error(E_WARNING, "Memory allocation fault in t1lib");
- RETURN_FALSE;
- break;
- default:
- php_error(E_WARNING, "An unknown error occurred in t1lib");
- RETURN_FALSE;
- break;
- }
- }
-
- nf_ind->extend = 1;
- l_ind = zend_list_insert(nf_ind, le_ps_font);
- RETURN_LONG(l_ind);
-#else
- php_error(E_WARNING, "ImagePsCopyFont: No T1lib support in this PHP build");
- RETURN_FALSE;
-#endif
-}
-*/
-/* }}} */
-
-/* {{{ proto bool imagepsfreefont(int font_index)
- Free memory used by a font */
-PHP_FUNCTION(imagepsfreefont)
-{
-#if HAVE_LIBT1
- zval **fnt;
- int *f_ind;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &fnt) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(f_ind, int *, fnt, -1, "Type 1 font", le_ps_font);
-
- zend_list_delete(Z_LVAL_PP(fnt));
- RETURN_TRUE;
-#else
- php_error(E_WARNING, "ImagePsFreeFont: No T1lib support in this PHP build");
- RETURN_FALSE;
-#endif
-}
-/* }}} */
-
-/* {{{ proto bool imagepsencodefont(int font_index, string filename)
- To change a fonts character encoding vector */
-PHP_FUNCTION(imagepsencodefont)
-{
-#if HAVE_LIBT1
- zval **fnt, **enc;
- char **enc_vector;
- int *f_ind;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &fnt, &enc) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(enc);
-
- ZEND_FETCH_RESOURCE(f_ind, int *, fnt, -1, "Type 1 font", le_ps_font);
-
- if ((enc_vector = T1_LoadEncoding(Z_STRVAL_PP(enc))) == NULL) {
- php_error(E_WARNING, "Couldn't load encoding vector from %s", Z_STRVAL_PP(enc));
- RETURN_FALSE;
- }
-
- T1_DeleteAllSizes(*f_ind);
- if (T1_ReencodeFont(*f_ind, enc_vector)) {
- T1_DeleteEncoding(enc_vector);
- php_error(E_WARNING, "Couldn't reencode font");
- RETURN_FALSE;
- }
- zend_list_insert(enc_vector, le_ps_enc);
- RETURN_TRUE;
-#else
- php_error(E_WARNING, "ImagePsEncodeFont: No T1lib support in this PHP build");
- RETURN_FALSE;
-#endif
-}
-/* }}} */
-
-/* {{{ proto bool imagepsextendfont(int font_index, double extend)
- Extend or or condense (if extend < 1) a font */
-PHP_FUNCTION(imagepsextendfont)
-{
-#if HAVE_LIBT1
- zval **fnt, **ext;
- int *f_ind;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &fnt, &ext) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_double_ex(ext);
-
- ZEND_FETCH_RESOURCE(f_ind, int *, fnt, -1, "Type 1 font", le_ps_font);
-
- if (T1_ExtendFont(*f_ind, Z_DVAL_PP(ext)) != 0) RETURN_FALSE;
-
- RETURN_TRUE;
-#else
- php_error(E_WARNING, "ImagePsExtendFont: No T1lib support in this PHP build");
- RETURN_FALSE;
-#endif
-}
-/* }}} */
-
-/* {{{ proto bool imagepsslantfont(int font_index, double slant)
- Slant a font */
-PHP_FUNCTION(imagepsslantfont)
-{
-#if HAVE_LIBT1
- zval **fnt, **slt;
- int *f_ind;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &fnt, &slt) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_double_ex(slt);
-
- ZEND_FETCH_RESOURCE(f_ind, int *, fnt, -1, "Type 1 font", le_ps_font);
-
- if (T1_SlantFont(*f_ind, Z_DVAL_PP(slt)) != 0) RETURN_FALSE;
- RETURN_TRUE;
-#else
- php_error(E_WARNING, "ImagePsSlantFont: No T1lib support in this PHP build");
- RETURN_FALSE;
-#endif
-}
-/* }}} */
-
-/* {{{ proto array imagepstext(int image, string text, int font, int size, int xcoord, int ycoord [, int space, int tightness, double angle, int antialias])
- Rasterize a string over an image */
-PHP_FUNCTION(imagepstext)
-{
-#if HAVE_LIBT1
- zval **img, **str, **fnt, **sz, **fg, **bg, **sp, **px, **py, **aas, **wd, **ang;
- int i, j, x, y;
- int space;
- int *f_ind;
- int h_lines, v_lines, c_ind;
- int rd, gr, bl, fg_rd, fg_gr, fg_bl, bg_rd, bg_gr, bg_bl,_fg,_bg;
- int aa[16], aa_steps;
- int width, amount_kern, add_width;
- double angle, extend;
- unsigned long aa_greys[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16};
- gdImagePtr bg_img;
- GLYPH *str_img;
- T1_OUTLINE *char_path, *str_path;
- T1_TMATRIX *transform = NULL;
- char *_str;
-
- switch(ZEND_NUM_ARGS()) {
- case 8:
- if (zend_get_parameters_ex(8, &img, &str, &fnt, &sz, &fg, &bg, &px, &py) == FAILURE) {
- RETURN_FALSE;
- }
- space = 0;
- aa_steps = 4;
- width = 0;
- angle = 0;
- break;
- case 12:
- if (zend_get_parameters_ex(12, &img, &str, &fnt, &sz, &fg, &bg, &px, &py, &sp, &wd, &ang, &aas) == FAILURE) {
- RETURN_FALSE;
- }
- convert_to_long_ex(sp);
- convert_to_long_ex(aas);
- convert_to_long_ex(wd);
- convert_to_double_ex(ang);
- space = Z_LVAL_PP(sp);
- aa_steps = Z_LVAL_PP(aas);
- width = Z_LVAL_PP(wd);
- angle = Z_DVAL_PP(ang);
- break;
- default:
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(bg_img, gdImagePtr, img, -1, "Image", le_gd);
- ZEND_FETCH_RESOURCE(f_ind, int *, fnt, -1, "Type 1 font", le_ps_font);
-
- x = Z_LVAL_PP(px);
- y = Z_LVAL_PP(py);
- _fg = Z_LVAL_PP(fg);
- _bg = Z_LVAL_PP(bg);
-
- fg_rd = gdImageRed (bg_img, _fg);
- fg_gr = gdImageGreen(bg_img, _fg);
- fg_bl = gdImageBlue (bg_img, _fg);
-
- bg_rd = gdImageRed (bg_img, _bg);
- bg_gr = gdImageGreen(bg_img, _bg);
- bg_bl = gdImageBlue (bg_img, _bg);
-
- for (i = 0; i < aa_steps; i++) {
- rd = bg_rd+(double)(fg_rd-bg_rd)/aa_steps*(i+1);
- gr = bg_gr+(double)(fg_gr-bg_gr)/aa_steps*(i+1);
- bl = bg_bl+(double)(fg_bl-bg_bl)/aa_steps*(i+1);
- aa[i] = gdImageColorResolve(bg_img, rd, gr, bl);
- }
-
- T1_AASetBitsPerPixel(8);
-
- switch (aa_steps) {
- case 4:
- T1_AASetGrayValues(0, 1, 2, 3, 4);
- T1_AASetLevel(T1_AA_LOW);
- break;
- case 16:
- T1_AAHSetGrayValues(aa_greys);
- T1_AASetLevel(T1_AA_HIGH);
- break;
- default:
- php_error(E_WARNING, "Invalid value %d as number of steps for antialiasing", aa_steps);
- RETURN_FALSE;
- }
-
- if (angle) {
- transform = T1_RotateMatrix(NULL, angle);
- }
-
- _str = Z_STRVAL_PP(str);
-
- if (width) {
- extend = T1_GetExtend(*f_ind);
- str_path = T1_GetCharOutline(*f_ind, _str[0], Z_LVAL_PP(sz), transform);
-
- for (i = 1; i < Z_STRLEN_PP(str); i++) {
- amount_kern = (int) T1_GetKerning(*f_ind, _str[i-1], _str[i]);
- amount_kern += _str[i-1] == ' ' ? space : 0;
- add_width = (int) (amount_kern+width)/extend;
-
- char_path = T1_GetMoveOutline(*f_ind, add_width, 0, 0, Z_LVAL_PP(sz), transform);
- str_path = T1_ConcatOutlines(str_path, char_path);
-
- char_path = T1_GetCharOutline(*f_ind, _str[i], Z_LVAL_PP(sz), transform);
- str_path = T1_ConcatOutlines(str_path, char_path);
- }
- str_img = T1_AAFillOutline(str_path, 0);
- } else {
- str_img = T1_AASetString(*f_ind, _str, Z_STRLEN_PP(str), space, T1_KERNING, Z_LVAL_PP(sz), transform);
- }
-
- if (T1_errno) {
- php_error(E_WARNING, "libt1 returned error %d", T1_errno);
- RETURN_FALSE;
- }
-
- h_lines = str_img->metrics.ascent - str_img->metrics.descent;
- v_lines = str_img->metrics.rightSideBearing - str_img->metrics.leftSideBearing;
-
- for (i = 0; i < v_lines; i++) {
- for (j = 0; j < h_lines; j++) {
- switch (str_img->bits[j*v_lines+i]) {
- case 0:
- break;
- default:
- c_ind = aa[str_img->bits[j*v_lines+i]-1];
- gdImageSetPixel(bg_img, x+str_img->metrics.leftSideBearing+i, y-str_img->metrics.ascent+j, c_ind);
- }
- }
- }
-
- if (array_init(return_value) == FAILURE) {
- php_error(E_WARNING, "Couldn't initialize array for returning bounding box");
- RETURN_FALSE;
- }
-
- add_next_index_long(return_value, str_img->metrics.leftSideBearing);
- add_next_index_long(return_value, str_img->metrics.descent);
- add_next_index_long(return_value, str_img->metrics.rightSideBearing);
- add_next_index_long(return_value, str_img->metrics.ascent);
-
-#else
- php_error(E_WARNING, "ImagePsText: No T1lib support in this PHP build");
- RETURN_FALSE;
-#endif
-}
-/* }}} */
-
-/* {{{ proto array imagepsbbox(string text, int font, int size [, int space, int tightness, int angle])
- Return the bounding box needed by a string if rasterized */
-PHP_FUNCTION(imagepsbbox)
-{
-#if HAVE_LIBT1
- zval **str, **fnt, **sz, **sp, **wd, **ang;
- int i, space, add_width, char_width, amount_kern;
- int cur_x, cur_y, dx, dy;
- int x1, y1, x2, y2, x3, y3, x4, y4;
- int *f_ind;
- int per_char = 0;
- double angle, sin_a = 0, cos_a = 0;
- BBox char_bbox, str_bbox = {0, 0, 0, 0};
-
- switch(ZEND_NUM_ARGS()) {
- case 3:
- if (zend_get_parameters_ex(3, &str, &fnt, &sz) == FAILURE) {
- RETURN_FALSE;
- }
- space = 0;
- break;
- case 6:
- if (zend_get_parameters_ex(6, &str, &fnt, &sz, &sp, &wd, &ang) == FAILURE) {
- RETURN_FALSE;
- }
- convert_to_long_ex(sp);
- convert_to_long_ex(wd);
- convert_to_double_ex(ang);
- space = Z_LVAL_PP(sp);
- add_width = Z_LVAL_PP(wd);
- angle = Z_DVAL_PP(ang) * M_PI / 180;
- sin_a = sin(angle);
- cos_a = cos(angle);
- per_char = add_width || angle ? 1 : 0;
- break;
- default:
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(f_ind, int *, fnt, -1, "Type 1 font", le_ps_font);
-
- convert_to_string_ex(str);
- convert_to_long_ex(sz);
-
-#define max(a, b) (a > b ? a : b)
-#define min(a, b) (a < b ? a : b)
-#define new_x(a, b) (int) ((a) * cos_a - (b) * sin_a)
-#define new_y(a, b) (int) ((a) * sin_a + (b) * cos_a)
-
- if (per_char) {
- space += T1_GetCharWidth(*f_ind, ' ');
- cur_x = cur_y = 0;
-
- for (i = 0; i < (*str)->value.str.len; i++) {
- if ((*str)->value.str.val[i] == ' ') {
- char_bbox.llx = char_bbox.lly = char_bbox.ury = 0;
- char_bbox.urx = char_width = space;
- } else {
- char_bbox = T1_GetCharBBox(*f_ind, (*str)->value.str.val[i]);
- char_width = T1_GetCharWidth(*f_ind, (*str)->value.str.val[i]);
- }
- amount_kern = i ? T1_GetKerning(*f_ind, (*str)->value.str.val[i-1], (*str)->value.str.val[i]) : 0;
-
- /* Transfer character bounding box to right place */
- x1 = new_x(char_bbox.llx, char_bbox.lly) + cur_x;
- y1 = new_y(char_bbox.llx, char_bbox.lly) + cur_y;
- x2 = new_x(char_bbox.llx, char_bbox.ury) + cur_x;
- y2 = new_y(char_bbox.llx, char_bbox.ury) + cur_y;
- x3 = new_x(char_bbox.urx, char_bbox.ury) + cur_x;
- y3 = new_y(char_bbox.urx, char_bbox.ury) + cur_y;
- x4 = new_x(char_bbox.urx, char_bbox.lly) + cur_x;
- y4 = new_y(char_bbox.urx, char_bbox.lly) + cur_y;
-
- /* Find min & max values and compare them with current bounding box */
- str_bbox.llx = min(str_bbox.llx, min(x1, min(x2, min(x3, x4))));
- str_bbox.lly = min(str_bbox.lly, min(y1, min(y2, min(y3, y4))));
- str_bbox.urx = max(str_bbox.urx, max(x1, max(x2, max(x3, x4))));
- str_bbox.ury = max(str_bbox.ury, max(y1, max(y2, max(y3, y4))));
-
- /* Move to the next base point */
- dx = new_x(char_width + add_width + amount_kern, 0);
- dy = new_y(char_width + add_width + amount_kern, 0);
- cur_x += dx;
- cur_y += dy;
- /*
- printf("%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\n", x1, y1, x2, y2, x3, y3, x4, y4, char_bbox.llx, char_bbox.lly, char_bbox.urx, char_bbox.ury, char_width, amount_kern, cur_x, cur_y, dx, dy);
- */
- }
-
- } else {
- str_bbox = T1_GetStringBBox(*f_ind, (*str)->value.str.val, (*str)->value.str.len, space, T1_KERNING);
- }
- if (T1_errno) RETURN_FALSE;
-
- if (array_init(return_value) == FAILURE) {
- RETURN_FALSE;
- }
- /*
- printf("%d %d %d %d\n", str_bbox.llx, str_bbox.lly, str_bbox.urx, str_bbox.ury);
- */
- add_next_index_long(return_value, (int) ceil(((double) str_bbox.llx)*(*sz)->value.lval/1000));
- add_next_index_long(return_value, (int) ceil(((double) str_bbox.lly)*(*sz)->value.lval/1000));
- add_next_index_long(return_value, (int) ceil(((double) str_bbox.urx)*(*sz)->value.lval/1000));
- add_next_index_long(return_value, (int) ceil(((double) str_bbox.ury)*(*sz)->value.lval/1000));
-#else
- php_error(E_WARNING, "ImagePsBBox: No T1lib support in this PHP build");
- RETURN_FALSE;
-#endif
-}
-/* }}} */
-
-/* {{{ proto int image2wbmp(int im [, string filename [, int threshold]])
- Output WBMP image to browser or file */
-PHP_FUNCTION(image2wbmp)
-{
-#ifdef HAVE_GD_WBMP
- _php_image_output (INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GDIMG_CONVERT_WBM, "WBMP", _php_image_bw_convert);
-#else /* HAVE_GD_WBMP */
- php_error(E_WARNING, "Image2Wbmp: No WBMP support in this PHP build");
- RETURN_FALSE;
-#endif /* HAVE_GD_WBMP */
-}
-/* }}} */
-
-/* {{{ proto void jpeg2wbmp (string f_org, string f_dest, int d_height, int d_width)
- Convert JPEG image to WBMP image */
-PHP_FUNCTION(jpeg2wbmp)
-{
-#ifdef HAVE_GD_JPG
-#ifdef HAVE_GD_WBMP
- _php_image_convert (INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GDIMG_TYPE_JPG);
-#else /* HAVE_GD_WBMP */
- php_error(E_WARNING, "jpeg2wbmp: No WBMP support in this PHP build");
- RETURN_FALSE;
-#endif /* HAVE_GD_WBMP */
-#else /* HAVE_GD_JPG */
- php_error(E_WARNING, "jpeg2wbmp: No JPG support in this PHP build");
- RETURN_FALSE;
-#endif /* HAVE_GD_JPG */
-}
-/* }}} */
-
-/* {{{ proto void png2wbmp (string f_org, string f_dest, int d_height, int d_width)
- Convert PNG image to WBMP image */
-PHP_FUNCTION(png2wbmp)
-{
-#ifdef HAVE_GD_PNG
-#ifdef HAVE_GD_WBMP
- _php_image_convert (INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GDIMG_TYPE_PNG);
-#else /* HAVE_GD_WBMP */
- php_error(E_WARNING, "png2wbmp: No WBMP support in this PHP build");
- RETURN_FALSE;
-#endif /* HAVE_GD_WBMP */
-#else /* HAVE_GD_PNG */
- php_error(E_WARNING, "png2wbmp: No PNG support in this PHP build");
- RETURN_FALSE;
-#endif /* HAVE_GD_PNG */
-}
-/* }}} */
-
-#ifdef HAVE_GD_WBMP
-/* {{{ _php_image_bw_convert
- * It converts a gd Image to bw using a threshold value */
-static void _php_image_bw_convert( gdImagePtr im_org, gdIOCtx *out, int threshold)
-{
- gdImagePtr im_dest;
- int white, black;
- int color, color_org, median;
- int dest_height = gdImageSY (im_org);
- int dest_width = gdImageSX (im_org);
- int x,y;
-
- im_dest = gdImageCreate (dest_width, dest_height);
- if (im_dest == NULL) {
- php_error (E_WARNING, "%s: unable to allocate temporary buffer", get_active_function_name());
- return;
- }
- white = gdImageColorAllocate (im_dest, 255, 255, 255);
- if( white == -1) {
- php_error (E_WARNING, "%s: unable to allocate the colors for the destination buffer", get_active_function_name());
- return;
- }
-
- black = gdImageColorAllocate (im_dest, 0, 0, 0);
- if (black == -1) {
- php_error (E_WARNING, "%s: unable to allocate the colors for the destination buffer", get_active_function_name());
- return;
- }
-
- for (y = 0; y < dest_height; y++) {
- for (x = 0; x < dest_width; x++) {
- color_org = gdImageGetPixel (im_org, x, y);
- median = (im_org->red[color_org] + im_org->green[color_org] + im_org->blue[color_org]) / 3;
- if (median < threshold) {
- color = black;
- }
- else {
- color = white;
- }
- gdImageSetPixel (im_dest, x, y, color);
- }
- }
-#ifdef USE_GD_IOCTX
- gdImageWBMPCtx (im_dest, black, out);
-#else
- gdImageWBMP (im_dest, black, out);
-#endif
-
-}
-/* }}} */
-
-/* {{{ _php_image_convert
- * _php_image_convert converts jpeg/png images to wbmp and resizes them as needed */
-static void _php_image_convert(INTERNAL_FUNCTION_PARAMETERS, int image_type )
-{
- zval **f_org, **f_dest, **height, **width, **threshold;
- gdImagePtr im_org, im_dest, im_tmp;
- char *fn_org = NULL;
- char *fn_dest = NULL;
- FILE *org,*dest;
- int argc;
- int dest_height = -1;
- int dest_width = -1;
- int org_height, org_width;
- int white, black;
- int color, color_org, median;
- int int_threshold;
- int x, y;
- float x_ratio, y_ratio;
-
- argc = ZEND_NUM_ARGS();
- if (argc < 1 || argc > 5 || zend_get_parameters_ex(argc, &f_org, &f_dest, &height, &width, &threshold) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if (argc == 5) {
- convert_to_string_ex (f_org);
- convert_to_string_ex (f_dest);
- fn_org = Z_STRVAL_PP(f_org);
- fn_dest = Z_STRVAL_PP(f_dest);
- convert_to_long_ex(height);
- dest_height = Z_LVAL_PP(height);
- convert_to_long_ex(width);
- dest_width = Z_LVAL_PP(width);
- convert_to_long_ex(threshold);
- int_threshold = Z_LVAL_PP(threshold);
-
- /* Check threshold value */
- if( int_threshold < 0 || int_threshold > 8 ) {
- php_error (E_WARNING, "Invalid threshold value '%d' in %s",int_threshold, get_active_function_name());
- RETURN_FALSE;
- }
-
- /* Check origin file */
- if (!fn_org || fn_org == empty_string || php_check_open_basedir(fn_org)) {
- php_error (E_WARNING, "%s: invalid origin filename '%s'", get_active_function_name(), fn_org);
- RETURN_FALSE;
- }
-
- /* Check destination file */
- if (!fn_dest || fn_dest == empty_string || php_check_open_basedir(fn_dest)) {
- php_error (E_WARNING, "%s: invalid destination filename '%s'", get_active_function_name(), fn_dest);
- RETURN_FALSE;
- }
-
- /* Open origin file */
- org = VCWD_FOPEN(fn_org, "rb");
- if (!org) {
- php_error (E_WARNING, "%s: unable to open '%s' for reading", get_active_function_name(), fn_org);
- RETURN_FALSE;
- }
-
- /* Open destination file */
- dest = VCWD_FOPEN(fn_dest, "wb");
- if (!dest) {
- php_error (E_WARNING, "%s: unable to open '%s' for writing", get_active_function_name(), fn_dest);
- RETURN_FALSE;
- }
-
- switch (image_type) {
-#ifdef HAVE_GD_GIF
- case PHP_GDIMG_TYPE_GIF:
- im_org = gdImageCreateFromGif (org);
- if (im_org == NULL) {
- php_error (E_WARNING, "%s: unable to open '%s' Not a valid GIF file", get_active_function_name(), fn_dest);
- RETURN_FALSE;
- }
- break;
-#endif /* HAVE_GD_GIF */
-
-#ifdef HAVE_GD_JPG
- case PHP_GDIMG_TYPE_JPG:
- im_org = gdImageCreateFromJpeg (org);
- if (im_org == NULL) {
- php_error (E_WARNING, "%s: unable to open '%s' Not a valid JPEG file", get_active_function_name(), fn_dest);
- RETURN_FALSE;
- }
- break;
-#endif /* HAVE_GD_JPG */
-
-
-#ifdef HAVE_GD_PNG
- case PHP_GDIMG_TYPE_PNG:
- im_org = gdImageCreateFromPng(org);
- if (im_org == NULL) {
- php_error (E_WARNING, "%s: unable to open '%s' Not a valid PNG file", get_active_function_name(), fn_dest);
- RETURN_FALSE;
- }
- break;
-#endif /* HAVE_GD_PNG */
-
- default:
- php_error(E_WARNING, "%s: Format not supported", get_active_function_name());
- break;
- }
-
- org_width = gdImageSX (im_org);
- org_height = gdImageSY (im_org);
-
- x_ratio = (float) org_width / (float) dest_width;
- y_ratio = (float) org_height / (float) dest_height;
-
- if (x_ratio > 1 && y_ratio > 1) {
- if (y_ratio > x_ratio) {
- x_ratio = y_ratio;
- }
- else {
- y_ratio = x_ratio;
- }
- dest_width = org_width / x_ratio;
- dest_height = org_height / y_ratio;
- }
- else {
- x_ratio = (float) dest_width / (float) org_width;
- y_ratio = (float) dest_height / (float) org_height;
-
- if (y_ratio < x_ratio) {
- x_ratio = y_ratio;
- }
- else {
- y_ratio = x_ratio;
- }
- dest_width = org_width * x_ratio;
- dest_height = org_height * y_ratio;
- }
-
- im_tmp = gdImageCreate (dest_width, dest_height);
- if (im_tmp == NULL ) {
- php_error(E_WARNING, "%s: unable to allocate temporary buffer", get_active_function_name());
- RETURN_FALSE;
- }
-
- gdImageCopyResized (im_tmp, im_org, 0, 0, 0, 0, dest_width, dest_height, org_width, org_height);
-
- gdImageDestroy(im_org);
-
- fclose(org);
-
- im_dest = gdImageCreate(dest_width, dest_height);
- if (im_dest == NULL) {
- php_error(E_WARNING, "%s: unable to allocate destination buffer", get_active_function_name());
- RETURN_FALSE;
- }
- white = gdImageColorAllocate(im_dest, 255, 255, 255);
- if (white == -1) {
- php_error(E_WARNING, "%s: unable to allocate the colors for the destination buffer", get_active_function_name());
- RETURN_FALSE;
- }
-
- black = gdImageColorAllocate(im_dest, 0, 0, 0);
- if (black == -1) {
- php_error(E_WARNING, "%s: unable to allocate the colors for the destination buffer", get_active_function_name());
- RETURN_FALSE;
- }
-
- int_threshold = int_threshold * 32;
-
- for (y = 0; y < dest_height; y++) {
- for(x = 0; x < dest_width; x++) {
- color_org = gdImageGetPixel (im_tmp, x, y);
- median = (im_tmp->red[color_org] + im_tmp->green[color_org] + im_tmp->blue[color_org]) / 3;
- if (median < int_threshold) {
- color = black;
- }
- else {
- color = white;
- }
- gdImageSetPixel (im_dest, x, y, color);
- }
- }
-
- gdImageDestroy (im_tmp );
-
- gdImageWBMP (im_dest, black , dest);
-
- fflush(dest);
- fclose(dest);
-
- gdImageDestroy( im_dest );
-
- RETURN_TRUE;
- }
- WRONG_PARAM_COUNT;
-}
-/* }}} */
-#endif /* HAVE_GD_WBMP */
-
-#endif /* HAVE_LIBGD */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/gd/gd.dsp b/ext/gd/gd.dsp
deleted file mode 100644
index 1a3369222a..0000000000
--- a/ext/gd/gd.dsp
+++ /dev/null
@@ -1,203 +0,0 @@
-# Microsoft Developer Studio Project File - Name="gd" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=gd - Win32 Release_TS GD2
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "gd.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "gd.mak" CFG="gd - Win32 Release_TS GD2"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "gd - Win32 Release_TS GD2" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "gd - Win32 Release_TS GD1" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "gd - Win32 Debug_TS GD2" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "gd - Win32 Debug_TS GD1" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "gd - Win32 Release_TS GD2"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "gd___Win32_Release_TS_GD2"
-# PROP BASE Intermediate_Dir "gd___Win32_Release_TS_GD2"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D ZEND_DEBUG=0 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "COMPILE_DL_GD" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_GDIMAGECOLORRESOLVE=1 /D HAVE_LIBTTF=1 /D "HAVE_GD_PNG" /D "HAVE_GD_JPG" /D "HAVE_GD_WBMP" /D HAVE_LIBGD13=1 /D HAVE_LIBGD=1 /D HAVE_LIBGD15=1 /FR /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D ZEND_DEBUG=0 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "COMPILE_DL_GD" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_GDIMAGECOLORRESOLVE=1 /D "HAVE_GD_PNG" /D "HAVE_GD_JPG" /D "HAVE_GD_WBMP" /D HAVE_LIBGD=1 /D HAVE_LIBGD13=1 /D HAVE_LIBGD15=1 /D HAVE_LIBGD20=1 /D "USE_GD_IOCTX" /D HAVE_LIBFREETYPE=1 /D "USE_GD_IMGSTRTTF" /FR /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x406 /d "NDEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 php4ts.lib freetype.lib gd.lib libjpeg.lib libtiff.lib libpng.lib zlib.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_gd.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
-# SUBTRACT BASE LINK32 /pdb:none
-# ADD LINK32 php4ts.lib freetype2.lib gd.lib libjpeg.lib libtiff.lib libpng.lib zlib.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_gd.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
-# SUBTRACT LINK32 /pdb:none
-
-!ELSEIF "$(CFG)" == "gd - Win32 Release_TS GD1"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "gd___Win32_Release_TS_GD1"
-# PROP BASE Intermediate_Dir "gd___Win32_Release_TS_GD1"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D ZEND_DEBUG=0 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "COMPILE_DL_GD" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_GDIMAGECOLORRESOLVE=1 /D HAVE_LIBTTF=1 /D "HAVE_GD_PNG" /D "HAVE_GD_JPG" /D "HAVE_GD_WBMP" /D HAVE_LIBGD13=1 /D HAVE_LIBGD=1 /D HAVE_LIBGD15=1 /FR /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D ZEND_DEBUG=0 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "COMPILE_DL_GD" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_GDIMAGECOLORRESOLVE=1 /D HAVE_LIBTTF=1 /D "HAVE_GD_PNG" /D "HAVE_GD_JPG" /D "HAVE_GD_WBMP" /D HAVE_LIBGD13=1 /D HAVE_LIBGD=1 /D HAVE_LIBGD15=1 /FR /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x406 /d "NDEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 php4ts.lib freetype.lib gd.lib libjpeg.lib libtiff.lib libpng.lib zlib.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_gd.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
-# SUBTRACT BASE LINK32 /pdb:none
-# ADD LINK32 php4ts.lib freetype.lib gd.lib libjpeg.lib libtiff.lib libpng.lib zlib.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_gd.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
-# SUBTRACT LINK32 /pdb:none
-
-!ELSEIF "$(CFG)" == "gd - Win32 Debug_TS GD2"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "gd___Win32_Debug_TS_GD2"
-# PROP BASE Intermediate_Dir "gd___Win32_Debug_TS_GD2"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MDd /W3 /GX /ZI /Od /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "COMPILE_DL_GD" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_GDIMAGECOLORRESOLVE=1 /D HAVE_LIBTTF=1 /D "HAVE_GD_PNG" /D "HAVE_GD_JPG" /D "HAVE_GD_WBMP" /D HAVE_LIBGD13=1 /D HAVE_LIBGD=1 /D HAVE_LIBGD15=1 /FR /YX /FD /c
-# ADD CPP /nologo /MDd /W3 /GX /ZI /Od /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "COMPILE_DL_GD" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_GDIMAGECOLORRESOLVE=1 /D "HAVE_GD_PNG" /D "HAVE_GD_JPG" /D "HAVE_GD_WBMP" /D HAVE_LIBGD=1 /D HAVE_LIBGD13=1 /D "HAVE_LIBGD15" /D HAVE_LIBGD20=1 /D "USE_GD_IOCTX" /D HAVE_LIBFREETYPE=1 /D "USE_GD_IMGSTRTTF" /FR /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x406 /d "NDEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 php4ts_debug.lib gd.lib libjpeg.lib freetype.lib libtiff.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /incremental:yes /debug /machine:I386 /out:"..\..\Debug_TS/php_gd.dll" /libpath:"..\..\Debug_TS"
-# SUBTRACT BASE LINK32 /pdb:none
-# ADD LINK32 php4ts_debug.lib gd.lib libjpeg.lib freetype2.lib libtiff.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /incremental:yes /debug /machine:I386 /out:"..\..\Debug_TS/php_gd.dll" /libpath:"..\..\Debug_TS"
-# SUBTRACT LINK32 /pdb:none
-
-!ELSEIF "$(CFG)" == "gd - Win32 Debug_TS GD1"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "gd___Win32_Debug_TS_GD1"
-# PROP BASE Intermediate_Dir "gd___Win32_Debug_TS_GD1"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MDd /W3 /GX /ZI /Od /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "COMPILE_DL_GD" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_GDIMAGECOLORRESOLVE=1 /D HAVE_LIBTTF=1 /D "HAVE_GD_PNG" /D "HAVE_GD_JPG" /D "HAVE_GD_WBMP" /D HAVE_LIBGD13=1 /D HAVE_LIBGD=1 /D HAVE_LIBGD15=1 /FR /YX /FD /c
-# ADD CPP /nologo /MDd /W3 /GX /ZI /Od /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "COMPILE_DL_GD" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_GDIMAGECOLORRESOLVE=1 /D HAVE_LIBTTF=1 /D "HAVE_GD_PNG" /D "HAVE_GD_JPG" /D "HAVE_GD_WBMP" /D HAVE_LIBGD13=1 /D HAVE_LIBGD=1 /D HAVE_LIBGD15=1 /FR /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x406 /d "NDEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 php4ts_debug.lib gd.lib libjpeg.lib freetype.lib libtiff.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /incremental:yes /debug /machine:I386 /out:"..\..\Debug_TS/php_gd.dll" /libpath:"..\..\Debug_TS"
-# SUBTRACT BASE LINK32 /pdb:none
-# ADD LINK32 php4ts_debug.lib gd.lib libjpeg.lib freetype.lib libtiff.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /incremental:yes /debug /machine:I386 /out:"..\..\Debug_TS/php_gd.dll" /libpath:"..\..\Debug_TS"
-# SUBTRACT LINK32 /pdb:none
-
-!ENDIF
-
-# Begin Target
-
-# Name "gd - Win32 Release_TS GD2"
-# Name "gd - Win32 Release_TS GD1"
-# Name "gd - Win32 Debug_TS GD2"
-# Name "gd - Win32 Debug_TS GD1"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\gd.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\gdcache.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\gdt1.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\gdttf.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\gdcache.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\gdt1.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\gdttf.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\php_gd.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/ext/gd/gd_ctx.c b/ext/gd/gd_ctx.c
deleted file mode 100644
index c7a321cda8..0000000000
--- a/ext/gd/gd_ctx.c
+++ /dev/null
@@ -1,105 +0,0 @@
-#include "php_gd.h"
-
-
-#define CTX_PUTC(c,ctx) ctx->putC(ctx, c)
-
-static void _php_image_output_putc(struct gdIOCtx *ctx, int c)
-{
- php_write(&c, 1);
-}
-
-static int _php_image_output_putbuf(struct gdIOCtx *ctx, const void* buf, int l)
-{
- return php_write((void *)buf, l);
-}
-
-static void _php_image_output_ctxfree(struct gdIOCtx *ctx)
-{
- if(ctx) {
- efree(ctx);
- }
-}
-
-static void _php_image_output_ctx(INTERNAL_FUNCTION_PARAMETERS, int image_type, char *tn, void (*func_p)())
-{
- zval **imgind, **file, **quality;
- gdImagePtr im;
- char *fn = NULL;
- FILE *fp = NULL;
- int argc = ZEND_NUM_ARGS();
- int q = -1, i;
- gdIOCtx *ctx;
-
- /* The quality parameter for Wbmp stands for the threshold when called from image2wbmp() */
-
- if (argc < 1 || argc > 3 || zend_get_parameters_ex(argc, &imgind, &file, &quality) == FAILURE)
- {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(im, gdImagePtr, imgind, -1, "Image", phpi_get_le_gd());
-
- if (argc > 1) {
- convert_to_string_ex(file);
- fn = Z_STRVAL_PP(file);
- if (argc == 3) {
- convert_to_long_ex(quality);
- q = Z_LVAL_PP(quality);
- }
- }
-
- if ((argc == 2) || (argc == 3 && Z_STRLEN_PP(file))) {
- if (!fn || fn == empty_string || php_check_open_basedir(fn)) {
- php_error(E_WARNING, "%s: invalid filename '%s'", get_active_function_name(), fn);
- RETURN_FALSE;
- }
-
- fp = VCWD_FOPEN(fn, "wb");
- if (!fp) {
- php_error(E_WARNING, "%s: unable to open '%s' for writing", get_active_function_name(), fn);
- RETURN_FALSE;
- }
-
- ctx = gdNewFileCtx(fp);
- } else {
- ctx = emalloc(sizeof(gdIOCtx));
- ctx->putC = _php_image_output_putc;
- ctx->putBuf = _php_image_output_putbuf;
- ctx->free = _php_image_output_ctxfree;
-
-#if APACHE && defined(CHARSET_EBCDIC)
- /* XXX this is unlikely to work any more thies@thieso.net */
- SLS_FETCH();
- /* This is a binary file already: avoid EBCDIC->ASCII conversion */
- ap_bsetflag(php3_rqst->connection->client, B_EBCDIC2ASCII, 0);
-#endif
- }
-
- switch(image_type) {
- case PHP_GDIMG_CONVERT_WBM:
- if(q<0||q>255) {
- php_error(E_WARNING, "%s: invalid threshold value '%d'. It must be between 0 and 255",get_active_function_name(), q);
- }
- case PHP_GDIMG_TYPE_JPG:
- (*func_p)(im, ctx, q);
- break;
- case PHP_GDIMG_TYPE_WBM:
- for(i=0; i < gdImageColorsTotal(im); i++) {
- if(gdImageRed(im, i) == 0) break;
- }
- (*func_p)(im, i, ctx);
- break;
- default:
- (*func_p)(im, ctx);
- break;
- }
-
- ctx->free(ctx);
-
- if(fp) {
- fflush(fp);
- fclose(fp);
- }
-
- RETURN_TRUE;
-}
diff --git a/ext/gd/gdcache.c b/ext/gd/gdcache.c
deleted file mode 100644
index b89f5610ac..0000000000
--- a/ext/gd/gdcache.c
+++ /dev/null
@@ -1,201 +0,0 @@
-/*
- * $Id$
- *
- * Caches of pointers to user structs in which the least-recently-used
- * element is replaced in the event of a cache miss after the cache has
- * reached a given size.
- *
- * John Ellson (ellson@lucent.com) Oct 31, 1997
- *
- * Test this with:
- * gcc -o gdcache -g -Wall -DTEST gdcache.c
- *
- * The cache is implemented by a singly-linked list of elements
- * each containing a pointer to a user struct that is being managed by
- * the cache.
- *
- * The head structure has a pointer to the most-recently-used
- * element, and elements are moved to this position in the list each
- * time they are used. The head also contains pointers to three
- * user defined functions:
- * - a function to test if a cached userdata matches some keydata
- * - a function to provide a new userdata struct to the cache
- * if there has been a cache miss.
- * - a function to release a userdata struct when it is
- * no longer being managed by the cache
- *
- * In the event of a cache miss the cache is allowed to grow up to
- * a specified maximum size. After the maximum size is reached then
- * the least-recently-used element is discarded to make room for the
- * new. The most-recently-returned value is always left at the
- * beginning of the list after retrieval.
- *
- * In the current implementation the cache is traversed by a linear
- * search from most-recent to least-recent. This linear search
- * probably limits the usefulness of this implementation to cache
- * sizes of a few tens of elements.
- */
-
-/* This just seems unessacary */
-#if (WIN32|WINNT)
-#define ENABLE_GD_TTF
-#else
-#include "php_config.h"
-#endif
-#if HAVE_LIBTTF|HAVE_LIBFREETYPE
-
-#include "gdcache.h"
-
-/*********************************************************/
-/* implementation */
-/*********************************************************/
-
-
-/* create a new cache */
-gdCache_head_t *
-gdCacheCreate(
- int size,
- gdCacheTestFn_t gdCacheTest,
- gdCacheFetchFn_t gdCacheFetch,
- gdCacheReleaseFn_t gdCacheRelease )
-{
- gdCache_head_t *head;
-
- head = (gdCache_head_t *)malloc(sizeof(gdCache_head_t));
- head->mru = NULL;
- head->size = size;
- head->gdCacheTest = gdCacheTest;
- head->gdCacheFetch = gdCacheFetch;
- head->gdCacheRelease = gdCacheRelease;
- return head;
-}
-
-void
-gdCacheDelete( gdCache_head_t *head )
-{
- gdCache_element_t *elem, *prev;
-
- elem = head->mru;
- while(elem) {
- (*(head->gdCacheRelease))(elem->userdata);
- prev = elem;
- elem = elem->next;
- free((char *)prev);
- }
- free((char *)head);
-}
-
-void *
-gdCacheGet( gdCache_head_t *head, void *keydata )
-{
- int i=0;
- gdCache_element_t *elem, *prev = NULL, *prevprev = NULL;
- void *userdata;
-
- elem = head->mru;
- while(elem) {
- if ((*(head->gdCacheTest))(elem->userdata, keydata)) {
- if (i) { /* if not already most-recently-used */
- /* relink to top of list */
- prev->next = elem->next;
- elem->next = head->mru;
- head->mru = elem;
- }
- return elem->userdata;
- }
- prevprev = prev;
- prev = elem;
- elem = elem->next;
- i++;
- }
- userdata = (*(head->gdCacheFetch))(&(head->error), keydata);
- if (! userdata) {
- /* if there was an error in the fetch then don't cache */
- return NULL;
- }
- if (i < head->size) { /* cache still growing - add new elem */
- elem = (gdCache_element_t *)malloc(sizeof(gdCache_element_t));
- }
- else { /* cache full - replace least-recently-used */
- /* preveprev becomes new end of list */
- prevprev->next = NULL;
- elem = prev;
- (*(head->gdCacheRelease))(elem->userdata);
- }
- /* relink to top of list */
- elem->next = head->mru;
- head->mru = elem;
- elem->userdata = userdata;
- return userdata;
-}
-
-
-
-/*********************************************************/
-/* test stub */
-/*********************************************************/
-
-
-#ifdef GDCACHE_TEST
-
-#include <stdio.h>
-
-typedef struct {
- int key;
- int value;
-} key_value_t;
-
-static int
-cacheTest( void *map, void *key )
-{
- return (((key_value_t *)map)->key == *(int *)key);
-}
-
-static void *
-cacheFetch( char **error, void *key )
-{
- key_value_t *map;
-
- map = (key_value_t *)malloc(sizeof(key_value_t));
- map->key = *(int *)key;
- map->value = 3;
-
- *error = NULL;
- return (void *)map;
-}
-
-static void
-cacheRelease( void *map)
-{
- free( (char *)map );
-}
-
-int
-main(char *argv[], int argc)
-{
- gdCache_head_t *cacheTable;
- int elem, key;
-
- cacheTable = gdCacheCreate(3, cacheTest, cacheFetch, cacheRelease);
-
- key = 20;
- elem = *(int *)gdCacheGet(cacheTable, &key);
- key = 30;
- elem = *(int *)gdCacheGet(cacheTable, &key);
- key = 40;
- elem = *(int *)gdCacheGet(cacheTable, &key);
- key = 50;
- elem = *(int *)gdCacheGet(cacheTable, &key);
- key = 30;
- elem = *(int *)gdCacheGet(cacheTable, &key);
- key = 30;
- elem = *(int *)gdCacheGet(cacheTable, &key);
-
- gdCacheDelete(cacheTable);
-
- return 0;
-}
-
-#endif
-
-#endif /* ENABLE_GD_TTF */
diff --git a/ext/gd/gdcache.h b/ext/gd/gdcache.h
deleted file mode 100644
index 06bf0ee6ce..0000000000
--- a/ext/gd/gdcache.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * $Id$
- *
- * Caches of pointers to user structs in which the least-recently-used
- * element is replaced in the event of a cache miss after the cache has
- * reached a given size.
- *
- * John Ellson (ellson@lucent.com) Oct 31, 1997
- *
- * Test this with:
- * gcc -o gdcache -g -Wall -DTEST gdcache.c
- *
- * The cache is implemented by a singly-linked list of elements
- * each containing a pointer to a user struct that is being managed by
- * the cache.
- *
- * The head structure has a pointer to the most-recently-used
- * element, and elements are moved to this position in the list each
- * time they are used. The head also contains pointers to three
- * user defined functions:
- * - a function to test if a cached userdata matches some keydata
- * - a function to provide a new userdata struct to the cache
- * if there has been a cache miss.
- * - a function to release a userdata struct when it is
- * no longer being managed by the cache
- *
- * In the event of a cache miss the cache is allowed to grow up to
- * a specified maximum size. After the maximum size is reached then
- * the least-recently-used element is discarded to make room for the
- * new. The most-recently-returned value is always left at the
- * beginning of the list after retrieval.
- *
- * In the current implementation the cache is traversed by a linear
- * search from most-recent to least-recent. This linear search
- * probably limits the usefulness of this implementation to cache
- * sizes of a few tens of elements.
- */
-
-/*********************************************************/
-/* header */
-/*********************************************************/
-
-#if (!defined _OSD_POSIX) && HAVE_MALLOC_H
-#include <malloc.h>
-#else
-#include <stdlib.h> /* BS2000/OSD defines malloc() & friends in stdlib.h */
-#endif
-#ifndef NULL
-#define NULL (void *)0
-#endif
-
-/* user defined function templates */
-typedef int (*gdCacheTestFn_t)(void *userdata, void *keydata);
-typedef void *(*gdCacheFetchFn_t)(char **error, void *keydata);
-typedef void (*gdCacheReleaseFn_t)(void *userdata);
-
-/* element structure */
-typedef struct gdCache_element_s gdCache_element_t;
-struct gdCache_element_s {
- gdCache_element_t *next;
- void *userdata;
-};
-
-/* head structure */
-typedef struct gdCache_head_s gdCache_head_t;
-struct gdCache_head_s {
- gdCache_element_t *mru;
- int size;
- char *error;
- gdCacheTestFn_t gdCacheTest;
- gdCacheFetchFn_t gdCacheFetch;
- gdCacheReleaseFn_t gdCacheRelease;
-};
-
-/* function templates */
-gdCache_head_t *
-gdCacheCreate(
- int size,
- gdCacheTestFn_t gdCacheTest,
- gdCacheFetchFn_t gdCacheFetch,
- gdCacheReleaseFn_t gdCacheRelease );
-
-void
-gdCacheDelete( gdCache_head_t *head );
-
-void *
-gdCacheGet( gdCache_head_t *head, void *keydata );
diff --git a/ext/gd/gdt1.c b/ext/gd/gdt1.c
deleted file mode 100644
index 7f1c514324..0000000000
--- a/ext/gd/gdt1.c
+++ /dev/null
@@ -1,549 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Jouni Ahto <jah@mork.net> |
- | |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#if 0 /* Moved currently back to gd.c */
-
-#include "php.h"
-#include "php_gd.h"
-
-#if HAVE_LIBT1
-
-void php_free_ps_font(int font_id)
-{
- T1_DeleteFont(font_id);
-}
-
-void php_free_ps_enc(char **enc)
-{
- T1_DeleteEncoding(enc);
-}
-
-/* {{{ proto int imagepsloadfont(string pathname)
- Load a new font from specified file */
-PHP_FUNCTION(imagepsloadfont)
-{
- zval **file;
- int f_ind, l_ind;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &file) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(file);
-
- f_ind = T1_AddFont((*file)->value.str.val);
-
- if (f_ind < 0) {
- switch (f_ind) {
- case -1:
- php_error(E_WARNING, "Couldn't find the font file");
- RETURN_FALSE;
- break;
- case -2:
- case -3:
- php_error(E_WARNING, "Memory allocation fault in t1lib");
- RETURN_FALSE;
- break;
- default:
- php_error(E_WARNING, "An unknown error occurred in t1lib");
- RETURN_FALSE;
- break;
- }
- }
-
- T1_LoadFont(f_ind);
- /*
- l_ind = zend_list_insert(f_ind, T1_GLOBAL(le_ps_font));
- RETURN_LONG(l_ind);
- */
- zend_list_addref(f_ind);
- RETURN_LONG(f_ind);
-}
-/* }}} */
-
-/* {{{ The function in t1lib which this function uses seem to be buggy...
-proto int imagepscopyfont(int font_index)
-Make a copy of a font for purposes like extending or reenconding */
-/*
-PHP_FUNCTION(imagepscopyfont)
-{
- pval *fnt;
- int l_ind, type;
- gd_ps_font *nf_ind, *of_ind;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters(ht, 1, &fnt) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(fnt);
-
- of_ind = zend_list_find(fnt->value.lval, &type);
-
- if (type != GD_GLOBAL(le_ps_font)) {
- php_error(E_WARNING, "%d is not a Type 1 font index", fnt->value.lval);
- RETURN_FALSE;
- }
-
- nf_ind = emalloc(sizeof(gd_ps_font));
- nf_ind->font_id = T1_CopyFont(of_ind->font_id);
-
- if (nf_ind->font_id < 0) {
- l_ind = nf_ind->font_id;
- efree(nf_ind);
- switch (l_ind) {
- case -1:
- php_error(E_WARNING, "FontID %d is not loaded in memory", l_ind);
- RETURN_FALSE;
- break;
- case -2:
- php_error(E_WARNING, "Tried to copy a logical font");
- RETURN_FALSE;
- break;
- case -3:
- php_error(E_WARNING, "Memory allocation fault in t1lib");
- RETURN_FALSE;
- break;
- default:
- php_error(E_WARNING, "An unknown error occurred in t1lib");
- RETURN_FALSE;
- break;
- }
- }
-
- nf_ind->extend = 1;
- l_ind = zend_list_insert(nf_ind, GD_GLOBAL(le_ps_font));
- RETURN_LONG(l_ind);
-}
-*/
-/* }}} */
-
-/* {{{ proto bool imagepsfreefont(int font_index)
- Free memory used by a font */
-PHP_FUNCTION(imagepsfreefont)
-{
- zval **fnt;
- int type;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &fnt) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(fnt);
-
- zend_list_find((*fnt)->value.lval, &type);
-
- if (type != T1_GLOBAL(le_ps_font)) {
- php_error(E_WARNING, "%d is not a Type 1 font index", (*fnt)->value.lval);
- RETURN_FALSE;
- }
-
- zend_list_delete((*fnt)->value.lval);
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool imagepsencodefont(int font_index, string filename)
- To change a fonts character encoding vector */
-PHP_FUNCTION(imagepsencodefont)
-{
- zval **fnt, **enc;
- char **enc_vector;
- int type;
- int f_ind;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &fnt, &enc) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(fnt);
- convert_to_string_ex(enc);
-
- f_ind = zend_list_find((*fnt)->value.lval, &type);
-
- if (type != T1_GLOBAL(le_ps_font)) {
- php_error(E_WARNING, "%d is not a Type 1 font index", (*fnt)->value.lval);
- RETURN_FALSE;
- }
-
- if ((enc_vector = T1_LoadEncoding((*enc)->value.str.val)) == NULL) {
- php_error(E_WARNING, "Couldn't load encoding vector from %s", (*enc)->value.str.val);
- RETURN_FALSE;
- }
-
- T1_DeleteAllSizes(f_ind);
- if (T1_ReencodeFont(f_ind, enc_vector)) {
- T1_DeleteEncoding(enc_vector);
- php_error(E_WARNING, "Couldn't reencode font");
- RETURN_FALSE;
- }
- zend_list_insert(enc_vector, T1_GLOBAL(le_ps_enc));
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool imagepsextendfont(int font_index, double extend)
- Extend or or condense (if extend < 1) a font */
-PHP_FUNCTION(imagepsextendfont)
-{
- zval **fnt, **ext;
- int type;
- int f_ind;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &fnt, &ext) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(fnt);
- convert_to_double_ex(ext);
-
- f_ind = zend_list_find((*fnt)->value.lval, &type);
-
- if (type != T1_GLOBAL(le_ps_font)) {
- php_error(E_WARNING, "%d is not a Type 1 font index", (*fnt)->value.lval);
- RETURN_FALSE;
- }
-
- if (T1_ExtendFont(f_ind, (*ext)->value.dval) != 0) RETURN_FALSE;
- /*
- f_ind->extend = ext->value.dval;
- */
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool imagepsslantfont(int font_index, double slant)
- Slant a font */
-PHP_FUNCTION(imagepsslantfont)
-{
- zval **fnt, **slt;
- int type;
- int f_ind;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &fnt, &slt) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(fnt);
- convert_to_double_ex(slt);
-
- f_ind = zend_list_find((*fnt)->value.lval, &type);
-
- if (type != T1_GLOBAL(le_ps_font)) {
- php_error(E_WARNING, "%d is not a Type 1 font index", (*fnt)->value.lval);
- RETURN_FALSE;
- }
-
- if (T1_SlantFont(f_ind, (*slt)->value.dval) != 0) RETURN_FALSE;
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto array imagepstext(int image, string text, int font, int size, int xcoord, int ycoord [, int space, int tightness, double angle, int antialias])
- Rasterize a string over an image */
-PHP_FUNCTION(imagepstext)
-{
- zval **img, **str, **fnt, **sz, **fg, **bg, **sp, **px, **py, **aas, **wd, **ang;
- int i, j, x, y;
- int space, type;
- int f_ind;
- int h_lines, v_lines, c_ind;
- int rd, gr, bl, fg_rd, fg_gr, fg_bl, bg_rd, bg_gr, bg_bl;
- int aa[16], aa_steps;
- int width, amount_kern, add_width;
- double angle;
- unsigned long aa_greys[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16};
- gdImagePtr bg_img;
- GLYPH *str_img;
- T1_OUTLINE *char_path, *str_path;
- T1_TMATRIX *transform = NULL;
-
- switch(ZEND_NUM_ARGS()) {
- case 8:
- if (zend_get_parameters_ex(8, &img, &str, &fnt, &sz, &fg, &bg, &px, &py) == FAILURE) {
- RETURN_FALSE;
- }
- convert_to_string_ex(str);
- convert_to_long_ex(fnt);
- convert_to_long_ex(sz);
- convert_to_long_ex(fg);
- convert_to_long_ex(bg);
- convert_to_long_ex(px);
- convert_to_long_ex(py);
- x = (*px)->value.lval;
- y = (*py)->value.lval;
- space = 0;
- aa_steps = 4;
- width = 0;
- angle = 0;
- break;
- case 12:
- if (zend_get_parameters_ex(12, &img, &str, &fnt, &sz, &fg, &bg, &px, &py, &sp, &wd, &ang, &aas) == FAILURE) {
- RETURN_FALSE;
- }
- convert_to_string_ex(str);
- convert_to_long_ex(fnt);
- convert_to_long_ex(sz);
- convert_to_long_ex(sp);
- convert_to_long_ex(fg);
- convert_to_long_ex(bg);
- convert_to_long_ex(px);
- convert_to_long_ex(py);
- x = (*px)->value.lval;
- y = (*py)->value.lval;
- convert_to_long_ex(sp);
- space = (*sp)->value.lval;
- convert_to_long_ex(aas);
- aa_steps = (*aas)->value.lval;
- convert_to_long_ex(wd);
- width = (*wd)->value.lval;
- convert_to_double_ex(ang);
- angle = (*ang)->value.dval;
- break;
- default:
- WRONG_PARAM_COUNT;
- }
-
- bg_img = zend_list_find((*img)->value.lval, &type);
-
- if (!bg_img || type != GD_GLOBAL(le_gd)) {
- php_error(E_WARNING, "Unable to find image pointer");
- RETURN_FALSE;
- }
-
- f_ind = zend_list_find(fnt->value.lval, &type);
-
- if (!f_ind || type != GD_GLOBAL(le_ps_font)) {
- php_error(E_WARNING, "%d is not a Type 1 font index", fnt->value.lval);
- RETURN_FALSE;
- }
-
- fg_rd = gdImageRed(bg_img, fg->value.lval);
- fg_gr = gdImageGreen(bg_img, fg->value.lval);
- fg_bl = gdImageBlue(bg_img, fg->value.lval);
- bg_rd = gdImageRed(bg_img, bg->value.lval);
- bg_gr = gdImageGreen(bg_img, bg->value.lval);
- bg_bl = gdImageBlue(bg_img, bg->value.lval);
-
- for (i = 0; i < aa_steps; i++) {
- rd = bg_rd+(double)(fg_rd-bg_rd)/aa_steps*(i+1);
- gr = bg_gr+(double)(fg_gr-bg_gr)/aa_steps*(i+1);
- bl = bg_bl+(double)(fg_bl-bg_bl)/aa_steps*(i+1);
- aa[i] = gdImageColorResolve(bg_img, rd, gr, bl);
- }
-
- T1_AASetBitsPerPixel(8);
-
- switch (aa_steps) {
- case 4:
- T1_AASetGrayValues(0, 1, 2, 3, 4);
- T1_AASetLevel(T1_AA_LOW);
- break;
- case 16:
- T1_AAHSetGrayValues(aa_greys);
- T1_AASetLevel(T1_AA_HIGH);
- break;
- default:
- php_error(E_WARNING, "Invalid value %d as number of steps for antialiasing", aa_steps);
- RETURN_FALSE;
- }
-
- if (angle) {
- transform = T1_RotateMatrix(NULL, angle);
- }
-
- if (width) {
-#ifdef HAVE_LIBT1_OUTLINE
- str_path = T1_GetCharOutline(f_ind->font_id, str->value.str.val[0], sz->value.lval, transform);
-
- for (i = 1; i < str->value.str.len; i++) {
- amount_kern = (int) T1_GetKerning(f_ind->font_id, str->value.str.val[i-1], str->value.str.val[i]);
- amount_kern += str->value.str.val[i-1] == ' ' ? space : 0;
- add_width = (int) (amount_kern+width)/f_ind->extend;
-
- char_path = T1_GetMoveOutline(f_ind->font_id, add_width, 0, 0, sz->value.lval, transform);
- str_path = T1_ConcatOutlines(str_path, char_path);
-
- char_path = T1_GetCharOutline(f_ind->font_id, str->value.str.val[i], sz->value.lval, transform);
- str_path = T1_ConcatOutlines(str_path, char_path);
- }
- str_img = T1_AAFillOutline(str_path, 0);
-#else
- php_error(E_WARNING, "Setting space between characters in function ImagePSText is supported only with t1lib version 0.9 or above");
- RETURN_FALSE;
-#endif
- } else {
- str_img = T1_AASetString(f_ind->font_id, str->value.str.val, str->value.str.len,
- space, T1_KERNING, sz->value.lval, transform);
- }
-
- if (T1_errno) RETURN_FALSE;
-
- h_lines = str_img->metrics.ascent - str_img->metrics.descent;
- v_lines = str_img->metrics.rightSideBearing - str_img->metrics.leftSideBearing;
-
- for (i = 0; i < v_lines; i++) {
- for (j = 0; j < h_lines; j++) {
- switch (str_img->bits[j*v_lines+i]) {
- case 0:
- break;
- default:
- c_ind = aa[str_img->bits[j*v_lines+i]-1];
- gdImageSetPixel(bg_img, x+str_img->metrics.leftSideBearing+i, y-str_img->metrics.ascent+j, c_ind);
- }
- }
- }
-
- if (array_init(return_value) == FAILURE) {
- RETURN_FALSE;
- }
-
- add_next_index_long(return_value, str_img->metrics.leftSideBearing);
- add_next_index_long(return_value, str_img->metrics.descent);
- add_next_index_long(return_value, str_img->metrics.rightSideBearing);
- add_next_index_long(return_value, str_img->metrics.ascent);
-
-}
-/* }}} */
-
-/* {{{ proto array imagepsbbox(string text, int font, int size [, int space, int tightness, int angle])
- Return the bounding box needed by a string if rasterized */
-PHP_FUNCTION(imagepsbbox)
-{
- pval *str, *fnt, *sz, *sp, *wd, *ang;
- int i, space, add_width, char_width, amount_kern, type;
- int cur_x, cur_y, dx, dy;
- int x1, y1, x2, y2, x3, y3, x4, y4;
- gd_ps_font *f_ind;
- int per_char = 0;
- double angle, sin_a, cos_a;
- BBox char_bbox, str_bbox = {0, 0, 0, 0};
-
- switch(ZEND_NUM_ARGS()) {
- case 3:
- if (zend_get_parameters(ht, 3, &str, &fnt, &sz) == FAILURE) {
- RETURN_FALSE;
- }
- convert_to_string(str);
- convert_to_long(fnt);
- convert_to_long(sz);
- space = 0;
- break;
- case 6:
- if (zend_get_parameters(ht, 6, &str, &fnt, &sz, &sp, &wd, &ang) == FAILURE) {
- RETURN_FALSE;
- }
- convert_to_string(str);
- convert_to_long(fnt);
- convert_to_long(sz);
- convert_to_long(sp);
- space = sp->value.lval;
- convert_to_long(wd);
- add_width = wd->value.lval;
- convert_to_double(ang);
- angle = ang->value.dval * M_PI / 180;
- sin_a = sin(angle);
- cos_a = cos(angle);
- per_char = add_width || angle ? 1 : 0;
- break;
- default:
- WRONG_PARAM_COUNT;
- }
-
- f_ind = zend_list_find(fnt->value.lval, &type);
-
- if (type != GD_GLOBAL(le_ps_font)) {
- php_error(E_WARNING, "%d is not a Type 1 font index", fnt->value.lval);
- RETURN_FALSE;
- }
-
-#define max(a, b) (a > b ? a : b)
-#define min(a, b) (a < b ? a : b)
-#define new_x(a, b) (int) ((a) * cos_a - (b) * sin_a)
-#define new_y(a, b) (int) ((a) * sin_a + (b) * cos_a)
-
- if (per_char) {
- space += T1_GetCharWidth(f_ind->font_id, ' ');
- cur_x = cur_y = 0;
-
- for (i = 0; i < str->value.str.len; i++) {
- if (str->value.str.val[i] == ' ') {
- char_bbox.llx = char_bbox.lly = char_bbox.ury = 0;
- char_bbox.urx = char_width = space;
- } else {
- char_bbox = T1_GetCharBBox(f_ind->font_id, str->value.str.val[i]);
- char_width = T1_GetCharWidth(f_ind->font_id, str->value.str.val[i]);
- }
- amount_kern = i ? T1_GetKerning(f_ind->font_id, str->value.str.val[i-1], str->value.str.val[i]) : 0;
-
- /* Transfer character bounding box to right place */
- x1 = new_x(char_bbox.llx, char_bbox.lly) + cur_x;
- y1 = new_y(char_bbox.llx, char_bbox.lly) + cur_y;
- x2 = new_x(char_bbox.llx, char_bbox.ury) + cur_x;
- y2 = new_y(char_bbox.llx, char_bbox.ury) + cur_y;
- x3 = new_x(char_bbox.urx, char_bbox.ury) + cur_x;
- y3 = new_y(char_bbox.urx, char_bbox.ury) + cur_y;
- x4 = new_x(char_bbox.urx, char_bbox.lly) + cur_x;
- y4 = new_y(char_bbox.urx, char_bbox.lly) + cur_y;
-
- /* Find min & max values and compare them with current bounding box */
- str_bbox.llx = min(str_bbox.llx, min(x1, min(x2, min(x3, x4))));
- str_bbox.lly = min(str_bbox.lly, min(y1, min(y2, min(y3, y4))));
- str_bbox.urx = max(str_bbox.urx, max(x1, max(x2, max(x3, x4))));
- str_bbox.ury = max(str_bbox.ury, max(y1, max(y2, max(y3, y4))));
-
- /* Move to the next base point */
- dx = new_x(char_width + add_width + amount_kern, 0);
- dy = new_y(char_width + add_width + amount_kern, 0);
- cur_x += dx;
- cur_y += dy;
- /*
- printf("%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\n", x1, y1, x2, y2, x3, y3, x4, y4, char_bbox.llx, char_bbox.lly, char_bbox.urx, char_bbox.ury, char_width, amount_kern, cur_x, cur_y, dx, dy);
- */
- }
-
- } else {
- str_bbox = T1_GetStringBBox(f_ind->font_id, str->value.str.val, str->value.str.len, space, T1_KERNING);
- }
- if (T1_errno) RETURN_FALSE;
-
- if (array_init(return_value) == FAILURE) {
- RETURN_FALSE;
- }
- /*
- printf("%d %d %d %d\n", str_bbox.llx, str_bbox.lly, str_bbox.urx, str_bbox.ury);
- */
- add_next_index_long(return_value, (int) ceil(((double) str_bbox.llx)*sz->value.lval/1000));
- add_next_index_long(return_value, (int) ceil(((double) str_bbox.lly)*sz->value.lval/1000));
- add_next_index_long(return_value, (int) ceil(((double) str_bbox.urx)*sz->value.lval/1000));
- add_next_index_long(return_value, (int) ceil(((double) str_bbox.ury)*sz->value.lval/1000));
-}
-/* }}} */
-
-#endif /* HAVE_LIBT1 */
-
-#endif /* 0 */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/gd/gdt1.h b/ext/gd/gdt1.h
deleted file mode 100644
index cecb7eac4d..0000000000
--- a/ext/gd/gdt1.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Jouni Ahto <jah@mork.net> |
- | |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#if HAVE_LIBT1
-
-#include <t1lib.h>
-
-extern void php_free_ps_font(zend_rsrc_list_entry *rsrc);
-extern void php_free_ps_enc(zend_rsrc_list_entry *rsrc);
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/gd/gdttf.c b/ext/gd/gdttf.c
deleted file mode 100644
index 0be895fb7b..0000000000
--- a/ext/gd/gdttf.c
+++ /dev/null
@@ -1,867 +0,0 @@
-/* gd interface to freetype library */
-/* */
-/* John Ellson ellson@lucent.com */
-
-/* $Id$ */
-
-#include "php.h"
-
-#if PHP_WIN32
-#include "config.w32.h"
-#else
-#include "php_config.h"
-#endif
-#if HAVE_LIBTTF && !defined(USE_GD_IMGSTRTTF)
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-#include <gd.h>
-#include "gdttf.h"
-#include "gdcache.h"
-#include <freetype.h>
-
-#ifndef HAVE_GDIMAGECOLORRESOLVE
-extern int gdImageColorResolve(gdImagePtr, int, int, int);
-#endif
-
-/* number of fonts cached before least recently used is replaced */
-#define FONTCACHESIZE 6
-
-/* number of character glyphs cached per font before
- least-recently-used is replaced */
-#define GLYPHCACHESIZE 120
-
-/* number of bitmaps cached per glyph before
- least-recently-used is replaced */
-#define BITMAPCACHESIZE 8
-
-/* number of antialias color lookups cached */
-#define TWEENCOLORCACHESIZE 32
-
-/* ptsize below which anti-aliasing is ineffective */
-#define MINANTIALIASPTSIZE 0
-
-/* display resolution - (Not really. This has to be 72 or hinting is wrong) */
-#define RESOLUTION 72
-
-/* Number of colors used for anti-aliasing */
-#undef NUMCOLORS
-#define NUMCOLORS 4
-
-/* Line separation as a factor of font height.
- No space between if LINESPACE = 1.00
- Line separation will be rounded up to next pixel row*/
-#define LINESPACE 1.05
-
-#ifndef TRUE
-#define FALSE 0
-#define TRUE !FALSE
-#endif
-
-#ifndef MAX
-#define MAX(a,b) ((a)>(b)?(a):(b))
-#endif
-#ifndef MIN
-#define MIN(a,b) ((a)<(b)?(a):(b))
-#endif
-
-typedef struct {
- char *fontname; /* key */
- double ptsize; /* key */
- double angle; /* key */
- double sin_a, cos_a;
- TT_Engine *engine;
- TT_Face face;
- TT_Face_Properties properties;
- TT_Instance instance;
- TT_CharMap char_map_Unicode;
- TT_CharMap char_map_Big5;
- TT_CharMap char_map_Roman;
- int have_char_map_Unicode;
- int have_char_map_Big5;
- int have_char_map_Roman;
- TT_Matrix matrix;
- TT_Instance_Metrics imetrics;
- gdCache_head_t *glyphCache;
-} font_t;
-
-typedef struct {
- char *fontname; /* key */
- double ptsize; /* key */
- double angle; /* key */
- TT_Engine *engine;
-} fontkey_t;
-
-typedef struct {
- int character; /* key */
- int hinting; /* key */
- TT_Glyph glyph;
- TT_Glyph_Metrics metrics;
- TT_Outline outline;
- TT_Pos oldx, oldy;
- TT_Raster_Map Bit;
- int gray_render;
- int xmin, xmax, ymin, ymax;
- gdCache_head_t *bitmapCache;
-} glyph_t;
-
-typedef struct {
- int character; /* key */
- int hinting; /* key */
- int gray_render;
- font_t *font;
-} glyphkey_t;
-
-typedef struct {
- int xoffset; /* key */
- int yoffset; /* key */
- char *bitmap;
-} bitmap_t;
-
-typedef struct {
- int xoffset; /* key */
- int yoffset; /* key */
- glyph_t *glyph;
-} bitmapkey_t;
-
-typedef struct {
- unsigned char pixel; /* key */
- unsigned char bgcolor; /* key */
- int fgcolor; /* key */ /* -ve means no antialias */
- gdImagePtr im; /* key */
- unsigned char tweencolor;
-} tweencolor_t;
-
-typedef struct {
- unsigned char pixel; /* key */
- unsigned char bgcolor; /* key */
- int fgcolor; /* key */ /* -ve means no antialias */
- gdImagePtr im; /* key */
-} tweencolorkey_t;
-
-/* forward declarations so that glyphCache can be initialized by font code */
-static int glyphTest ( void *element, void *key );
-static void *glyphFetch ( char **error, void *key );
-static void glyphRelease( void *element );
-
-/* forward declarations so that bitmapCache can be initialized by glyph code */
-static int bitmapTest ( void *element, void *key );
-static void *bitmapFetch ( char **error, void *key );
-static void bitmapRelease( void *element );
-
-/* local prototype */
-char *gdttfchar(gdImage *im, int fg, font_t *font, int x, int y, TT_F26Dot6 x1, TT_F26Dot6 y1, TT_F26Dot6 *advance, TT_BBox **bbox, char **next);
-
-
-
-/********************************************************************
- * gdTcl_UtfToUniChar is borrowed from ...
- */
-/*
- * tclUtf.c --
- *
- * Routines for manipulating UTF-8 strings.
- *
- * Copyright (c) 1997-1998 Sun Microsystems, Inc.
- *
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
- *
- * SCCS: @(#) tclUtf.c 1.25 98/01/28 18:02:43
- */
-
-/*
- *---------------------------------------------------------------------------
- *
- * gdTcl_UtfToUniChar --
- *
- * Extract the Tcl_UniChar represented by the UTF-8 string. Bad
- * UTF-8 sequences are converted to valid Tcl_UniChars and processing
- * continues. Equivalent to Plan 9 chartorune().
- *
- * The caller must ensure that the source buffer is long enough that
- * this routine does not run off the end and dereference non-existent
- * memory looking for trail bytes. If the source buffer is known to
- * be '\0' terminated, this cannot happen. Otherwise, the caller
- * should call Tcl_UtfCharComplete() before calling this routine to
- * ensure that enough bytes remain in the string.
- *
- * Results:
- * *chPtr is filled with the Tcl_UniChar, and the return value is the
- * number of bytes from the UTF-8 string that were consumed.
- *
- * Side effects:
- * None.
- *
- *---------------------------------------------------------------------------
- */
-
-#ifndef CHARSET_EBCDIC
-#define ASC(ch) (ch)
-#else /*CHARSET_EBCDIC*/
-#define ASC(ch) os_toascii[(unsigned char) (ch)]
-#endif /*CHARSET_EBCDIC*/
-
-#define Tcl_UniChar int
-#define TCL_UTF_MAX 3
-static int
-gdTcl_UtfToUniChar(char *str, Tcl_UniChar *chPtr)
-/* str is the UTF8 next character pointer */
-/* chPtr is the int for the result */
-{
- int byte;
-
- /* HTML4.0 entities in decimal form, e.g. &#197; */
- byte = *((unsigned char *) str);
- if (byte == '&') {
- int i, n=0;
-
- byte = *((unsigned char *) (str+1));
- if (byte == '#') {
- for (i = 2; i < 8; i++) {
- byte = *((unsigned char *) (str+i));
- if (byte >= '0' && byte <= '9') {
- n = (n * 10) + (byte - '0');
- }
- else
- break;
- }
- if (byte == ';') {
- *chPtr = (Tcl_UniChar) n;
- return ++i;
- }
- }
- }
-
- /*
- * Unroll 1 to 3 byte UTF-8 sequences, use loop to handle longer ones.
- */
-
- byte = ASC(*((unsigned char *) str));
- if (byte < 0xC0) {
- /*
- * Handles properly formed UTF-8 characters between 0x01 and 0x7F.
- * Also treats \0 and naked trail bytes 0x80 to 0xBF as valid
- * characters representing themselves.
- */
-
- *chPtr = (Tcl_UniChar) byte;
- return 1;
- } else if (byte < 0xE0) {
- if ((ASC(str[1]) & 0xC0) == 0x80) {
- /*
- * Two-byte-character lead-byte followed by a trail-byte.
- */
-
- *chPtr = (Tcl_UniChar) (((byte & 0x1F) << 6) | (ASC(str[1]) & 0x3F));
- return 2;
- }
- /*
- * A two-byte-character lead-byte not followed by trail-byte
- * represents itself.
- */
-
- *chPtr = (Tcl_UniChar) byte;
- return 1;
- } else if (byte < 0xF0) {
- if (((ASC(str[1]) & 0xC0) == 0x80) && ((ASC(str[2]) & 0xC0) == 0x80)) {
- /*
- * Three-byte-character lead byte followed by two trail bytes.
- */
-
- *chPtr = (Tcl_UniChar) (((byte & 0x0F) << 12)
- | ((ASC(str[1]) & 0x3F) << 6) | (ASC(str[2]) & 0x3F));
- return 3;
- }
- /*
- * A three-byte-character lead-byte not followed by two trail-bytes
- * represents itself.
- */
-
- *chPtr = (Tcl_UniChar) byte;
- return 1;
- }
-#if TCL_UTF_MAX > 3
- else {
- int ch, total, trail;
-
- total = totalBytes[byte];
- trail = total - 1;
- if (trail > 0) {
- ch = byte & (0x3F >> trail);
- do {
- str++;
- if ((ASC(*str) & 0xC0) != 0x80) {
- *chPtr = byte;
- return 1;
- }
- ch <<= 6;
- ch |= (ASC(*str) & 0x3F);
- trail--;
- } while (trail > 0);
- *chPtr = ch;
- return total;
- }
- }
-#endif
-
- *chPtr = (Tcl_UniChar) byte;
- return 1;
-}
-
-/********************************************************************/
-/* font cache functions */
-
-static int
-fontTest ( void *element, void *key )
-{
- font_t *a=(font_t *)element;
- fontkey_t *b=(fontkey_t *)key;
-
- return ( strcmp(a->fontname, b->fontname) == 0
- && a->ptsize == b->ptsize
- && a->angle == b->angle);
-}
-
-static void *
-fontFetch ( char **error, void *key )
-{
- TT_Error err;
- font_t *a;
- fontkey_t *b=(fontkey_t *)key;
- int i, n, map_found;
- short platform, encoding;
-
- a = (font_t *)malloc(sizeof(font_t));
-#ifdef VIRTUAL_DIR
- /* a->fontname will be freed in fontRelease() later on */
- if (virtual_filepath(b->fontname, &a->fontname)) {
- *error = "Could not find/open font";
- return NULL;
- }
-#else
- a->fontname = (char *)malloc(strlen(b->fontname) + 1);
- strcpy(a->fontname,b->fontname);
-#endif
- a->ptsize = b->ptsize;
- a->angle = b->angle;
- a->sin_a = sin(a->angle);
- a->cos_a = cos(a->angle);
- a->engine = b->engine;
- if ((err = TT_Open_Face(*b->engine, a->fontname, &a->face))) {
- if (err == TT_Err_Could_Not_Open_File) {
- *error = "Could not find/open font";
- }
- else {
- *error = "Could not read font";
- }
- return NULL;
- }
- /* get face properties and allocate preload arrays */
- TT_Get_Face_Properties(a->face, &a->properties);
-
- /* create instance */
- if (TT_New_Instance(a->face, &a->instance)) {
- *error = "Could not create face instance";
- return NULL;
- }
-
- if (TT_Set_Instance_Resolutions(a->instance, RESOLUTION, RESOLUTION)) {
- *error = "Could not set device resolutions";
- return NULL;
-map_found = 0;
-a->have_char_map_Unicode = 0;
-a->have_char_map_Big5 = 0;
-a->have_char_map_Roman = 0;
- }
-
- if (TT_Set_Instance_CharSize(a->instance, (TT_F26Dot6)(a->ptsize*64))) {
- *error = "Could not set character size";
- return NULL;
- }
-
- TT_Get_Instance_Metrics(a->instance, &a->imetrics);
-
- /* First, look for a Unicode charmap */
- n = TT_Get_CharMap_Count(a->face);
-
- for (i = 0; i < n; i++) {
- TT_Get_CharMap_ID(a->face, i, &platform, &encoding);
- if ((platform == 3 && encoding == 1) /* Windows Unicode */
- || (platform == 2 && encoding == 1)
- || (platform == 0)) { /* ?? Unicode */
- TT_Get_CharMap(a->face, i, &a->char_map_Unicode);
- a->have_char_map_Unicode = 1;
- map_found++;
- } else if (platform == 3 && encoding == 4) { /* Windows Big5 */
- TT_Get_CharMap(a->face, i, &a->char_map_Big5);
- a->have_char_map_Big5 = 1;
- map_found++;
- } else if (platform == 1 && encoding == 0) { /* Apple Roman */
- TT_Get_CharMap(a->face, i, &a->char_map_Roman);
- a->have_char_map_Roman = 1;
- map_found++;
- }
- }
-
- if (! map_found) {
- *error = "Unable to find a CharMap that I can handle";
- return NULL;
- }
-
- a->matrix.xx = (TT_Fixed) (a->cos_a * (1<<16));
- a->matrix.yx = (TT_Fixed) (a->sin_a * (1<<16));
- a->matrix.xy = - a->matrix.yx;
- a->matrix.yy = a->matrix.xx;
-
- a->glyphCache = gdCacheCreate( GLYPHCACHESIZE,
- glyphTest, glyphFetch, glyphRelease);
-
- return (void *)a;
-}
-
-static void
-fontRelease( void *element )
-{
- font_t *a=(font_t *)element;
-
- gdCacheDelete(a->glyphCache);
- TT_Done_Instance(a->instance);
- TT_Close_Face(a->face);
- free(a->fontname);
- free( (char *)element );
-}
-
-/********************************************************************/
-/* glyph cache functions */
-
-static int
-glyphTest ( void *element, void *key )
-{
- glyph_t *a=(glyph_t *)element;
- glyphkey_t *b=(glyphkey_t *)key;
-
- return (a->character == b->character
- && a->hinting == b->hinting
- && a->gray_render == b->gray_render);
-}
-
-static void *
-glyphFetch ( char **error, void *key )
-{
- glyph_t *a;
- glyphkey_t *b=(glyphkey_t *)key;
- short glyph_code;
- int flags, err;
- int crect[8], xmin, xmax, ymin, ymax;
- double cos_a, sin_a;
-
- a = (glyph_t *)malloc(sizeof(glyph_t));
- a->character = b->character;
- a->hinting = b->hinting;
- a->gray_render = b->gray_render;
- a->oldx = a->oldy = 0;
-
- /* create glyph container */
- if ((TT_New_Glyph(b->font->face, &a->glyph))) {
- *error = "Could not create glyph container";
- return NULL;
- }
-
- flags = TTLOAD_SCALE_GLYPH;
- if (a->hinting && b->font->angle == 0.0) {
- flags |= TTLOAD_HINT_GLYPH;
- }
- if (b->font->have_char_map_Unicode) {
- glyph_code = TT_Char_Index(b->font->char_map_Unicode, a->character);
- } else if (a->character < 161 && b->font->have_char_map_Roman) {
- glyph_code = TT_Char_Index(b->font->char_map_Roman, a->character);
- } else if ( b->font->have_char_map_Big5) {
- glyph_code = TT_Char_Index(b->font->char_map_Big5, a->character);
- }
- if ((err=TT_Load_Glyph(b->font->instance, a->glyph, glyph_code, flags))) {
- *error = "TT_Load_Glyph problem";
- return NULL;
- }
-
- TT_Get_Glyph_Metrics(a->glyph, &a->metrics);
- if (b->font->angle != 0.0) {
- TT_Get_Glyph_Outline(a->glyph, &a->outline);
- TT_Transform_Outline(&a->outline, &b->font->matrix);
- }
-
- /* calculate bitmap size */
- xmin = a->metrics.bbox.xMin -64;
- ymin = a->metrics.bbox.yMin -64;
- xmax = a->metrics.bbox.xMax +64;
- ymax = a->metrics.bbox.yMax +64;
-
- cos_a = b->font->cos_a;
- sin_a = b->font->sin_a;
- crect[0] = (int)(xmin * cos_a - ymin * sin_a);
- crect[1] = (int)(xmin * sin_a + ymin * cos_a);
- crect[2] = (int)(xmax * cos_a - ymin * sin_a);
- crect[3] = (int)(xmax * sin_a + ymin * cos_a);
- crect[4] = (int)(xmax * cos_a - ymax * sin_a);
- crect[5] = (int)(xmax * sin_a + ymax * cos_a);
- crect[6] = (int)(xmin * cos_a - ymax * sin_a);
- crect[7] = (int)(xmin * sin_a + ymax * cos_a);
- a->xmin = MIN(MIN(crect[0],crect[2]),MIN(crect[4],crect[6]));
- a->xmax = MAX(MAX(crect[0],crect[2]),MAX(crect[4],crect[6]));
- a->ymin = MIN(MIN(crect[1],crect[3]),MIN(crect[5],crect[7]));
- a->ymax = MAX(MAX(crect[1],crect[3]),MAX(crect[5],crect[7]));
-
- /* allocate bitmap large enough for character */
- a->Bit.rows = (a->ymax - a->ymin + 32 + 64) / 64;
- a->Bit.width = (a->xmax - a->xmin + 32 + 64) / 64;
- a->Bit.flow = TT_Flow_Up;
- if (a->gray_render) {
- a->Bit.cols = a->Bit.width; /* 1 byte per pixel */
- }
- else {
- a->Bit.cols = (a->Bit.width + 7) / 8; /* 1 bit per pixel */
- }
- a->Bit.cols = (a->Bit.cols + 3) & ~3; /* pad to 32 bits */
- a->Bit.size = a->Bit.rows * a->Bit.cols; /* # of bytes in buffer */
- a->Bit.bitmap = NULL;
-
- a->bitmapCache = gdCacheCreate( BITMAPCACHESIZE,
- bitmapTest, bitmapFetch, bitmapRelease);
-
- return (void *)a;
-}
-
-static void
-glyphRelease( void *element )
-{
- glyph_t *a=(glyph_t *)element;
-
- gdCacheDelete(a->bitmapCache);
- TT_Done_Glyph( a->glyph );
- free( (char *)element );
-}
-
-/********************************************************************/
-/* bitmap cache functions */
-
-static int
-bitmapTest ( void *element, void *key )
-{
- bitmap_t *a=(bitmap_t *)element;
- bitmapkey_t *b=(bitmapkey_t *)key;
-
- if (a->xoffset == b->xoffset && a->yoffset == b->yoffset) {
- b->glyph->Bit.bitmap = a->bitmap;
- return TRUE;
- }
- return FALSE;
-}
-
-static void *
-bitmapFetch ( char **error, void *key )
-{
- bitmap_t *a;
- bitmapkey_t *b=(bitmapkey_t *)key;
-
- a = (bitmap_t *)malloc(sizeof(bitmap_t));
- a->xoffset = b->xoffset;
- a->yoffset = b->yoffset;
-
- b->glyph->Bit.bitmap = a->bitmap = (char *)malloc(b->glyph->Bit.size);
- memset(a->bitmap, 0, b->glyph->Bit.size);
- /* render glyph */
- if (b->glyph->gray_render) {
- TT_Get_Glyph_Pixmap(b->glyph->glyph, &b->glyph->Bit,
- a->xoffset, a->yoffset);
- }
- else {
- TT_Get_Glyph_Bitmap(b->glyph->glyph, &b->glyph->Bit,
- a->xoffset, a->yoffset);
- }
- return (void *)a;
-}
-
-static void
-bitmapRelease( void *element )
-{
- bitmap_t *a=(bitmap_t *)element;
-
- free( a->bitmap );
- free( (char *)element );
-}
-
-/********************************************************************/
-/* tweencolor cache functions */
-
-static int
-tweenColorTest (void *element, void *key)
-{
- tweencolor_t *a=(tweencolor_t *)element;
- tweencolorkey_t *b=(tweencolorkey_t *)key;
-
- return (a->pixel == b->pixel
- && a->bgcolor == b->bgcolor
- && a->fgcolor == b->fgcolor
- && a->im == b->im);
-}
-
-static void *
-tweenColorFetch (char **error, void *key)
-{
- tweencolor_t *a;
- tweencolorkey_t *b=(tweencolorkey_t *)key;
- int pixel, npixel, bg, fg;
- gdImagePtr im;
-
- a = (tweencolor_t *)malloc(sizeof(tweencolor_t));
- pixel = a->pixel = b->pixel;
- bg = a->bgcolor = b->bgcolor;
- fg = a->fgcolor = b->fgcolor;
- im = b->im;
-
- /* if fg is specified by a negative color idx, then don't antialias */
- if (fg <0) {
- a->tweencolor = -fg;
- } else {
- npixel = NUMCOLORS - pixel;
- a->tweencolor = gdImageColorResolve(im,
- (pixel * im->red [fg] + npixel * im->red [bg]) / NUMCOLORS,
- (pixel * im->green[fg] + npixel * im->green[bg]) / NUMCOLORS,
- (pixel * im->blue [fg] + npixel * im->blue [bg]) / NUMCOLORS);
- }
- *error = NULL;
- return (void *)a;
-}
-
-static void
-tweenColorRelease(void *element)
-{
- free((char *)element);
-}
-
-/********************************************************************/
-/* gdttfchar - render one character onto a gd image */
-
-static int OneTime=0;
-static gdCache_head_t *tweenColorCache;
-
-char *
-gdttfchar(gdImage *im, int fg, font_t *font,
- int x, int y, /* string start pos in pixels */
- TT_F26Dot6 x1, TT_F26Dot6 y1, /* char start offset (*64) from x,y */
- TT_F26Dot6 *advance,
- TT_BBox **bbox,
- char **next)
-{
- int pc, ch, len;
- int row, col;
- int x2, y2; /* char start pos in pixels */
- int x3, y3; /* current pixel pos */
- unsigned char *pixel;
-
- glyph_t *glyph;
- glyphkey_t glyphkey;
- bitmapkey_t bitmapkey;
- tweencolor_t *tweencolor;
- tweencolorkey_t tweencolorkey;
-
- /****** set up tweenColorCache on first call ************/
- if (! OneTime) {
- tweenColorCache = gdCacheCreate(TWEENCOLORCACHESIZE,
- tweenColorTest, tweenColorFetch, tweenColorRelease);
- OneTime++;
- }
- /**************/
-
- if (font->have_char_map_Unicode) { /* use UTF-8 mapping from ASCII */
- len = gdTcl_UtfToUniChar(*next, &ch);
- *next += len;
- } else {
- /*
- * Big 5 mapping:
- * use "JIS-8 half-width katakana" coding from 8-bit characters. Ref:
- * ftp://ftp.ora.com/pub/examples/nutshell/ujip/doc/japan.inf-032092.sjs
- */
- ch = (**next) & 255; /* don't extend sign */
- (*next)++;
- if (ch >= 161 /* first code of JIS-8 pair */
- && **next) { /* don't advance past '\0' */
- ch = (ch * 256) + **next;
- (*next)++;
- }
- }
-
- glyphkey.character = ch;
- glyphkey.hinting = 1;
- /* if fg is specified by a negative color idx, then don't antialias */
- glyphkey.gray_render = ((font->ptsize < MINANTIALIASPTSIZE) || (fg <0))?FALSE:TRUE;
- glyphkey.font = font;
- glyph = (glyph_t *)gdCacheGet(font->glyphCache, &glyphkey);
- if (! glyph)
- return font->glyphCache->error;
-
- *bbox = &glyph->metrics.bbox;
- *advance = glyph->metrics.advance;
-
- /* if null *im, or invalid color, then assume user just wants brect */
- if (!im || fg > 255 || fg < -255)
- return (char *)NULL;
-
- /* render (via cache) a bitmap for the current fractional offset */
- bitmapkey.xoffset = ((x1+32) & 63) - 32 - ((glyph->xmin+32) & -64);
- bitmapkey.yoffset = ((y1+32) & 63) - 32 - ((glyph->ymin+32) & -64);
- bitmapkey.glyph = glyph;
- gdCacheGet(glyph->bitmapCache, &bitmapkey);
-
- /* copy to gif, mapping colors */
- x2 = x + (((glyph->xmin+32) & -64) + ((x1+32) & -64)) / 64;
- y2 = y - (((glyph->ymin+32) & -64) + ((y1+32) & -64)) / 64;
- tweencolorkey.fgcolor = fg;
- tweencolorkey.im = im;
- for (row = 0; row < glyph->Bit.rows; row++) {
- if (glyph->gray_render)
- pc = row * glyph->Bit.cols;
- else
- pc = row * glyph->Bit.cols * 8;
- y3 = y2 - row;
- if (y3 >= im->sy || y3 < 0) continue;
- for (col = 0; col < glyph->Bit.width; col++, pc++) {
- if (glyph->gray_render) {
- tweencolorkey.pixel =
- *((unsigned char *)(glyph->Bit.bitmap) + pc);
- } else {
- tweencolorkey.pixel =
- (((*((unsigned char *)(glyph->Bit.bitmap) + pc/8))
- <<(pc%8))&128)?4:0;
- }
- /* if not background */
- if (tweencolorkey.pixel > 0) {
- x3 = x2 + col;
- if (x3 >= im->sx || x3 < 0) continue;
-#if HAVE_LIBGD13
- pixel = &im->pixels[y3][x3];
-#else
- pixel = &im->pixels[x3][y3];
-#endif
- tweencolorkey.bgcolor = *pixel;
- tweencolor = (tweencolor_t *)gdCacheGet(
- tweenColorCache, &tweencolorkey);
- *pixel = tweencolor->tweencolor;
- }
- }
- }
- return (char *)NULL;
-}
-
-/********************************************************************/
-/* gdttf - render a utf8 string onto a gd image */
-
-char *
-gdttf(gdImage *im, int *brect, int fg, char *fontname,
- double ptsize, double angle, int x, int y, char *str)
-{
- TT_F26Dot6 ur_x=0, ur_y=0, ll_x=0, ll_y=0;
- TT_F26Dot6 advance_x, advance_y, advance, x1, y1;
- TT_BBox *bbox;
- double sin_a, cos_a;
- int i=0, ch;
- font_t *font;
- fontkey_t fontkey;
- char *error, *next;
-
- /****** initialize font engine on first call ************/
- static gdCache_head_t *fontCache;
- static TT_Engine engine;
-
- if (! fontCache) {
- if (TT_Init_FreeType(&engine)) {
- return "Failure to initialize font engine";
- }
- fontCache = gdCacheCreate( FONTCACHESIZE,
- fontTest, fontFetch, fontRelease);
- }
- /**************/
-
- /* get the font (via font cache) */
- fontkey.fontname = fontname;
- fontkey.ptsize = ptsize;
- fontkey.angle = angle;
- fontkey.engine = &engine;
- font = (font_t *)gdCacheGet(fontCache, &fontkey);
- if (! font) {
- return fontCache->error;
- }
- sin_a = font->sin_a;
- cos_a = font->cos_a;
- advance_x = advance_y = 0;
-
- next=str;
- while (*next) {
- ch = *next;
-
- /* carriage returns */
- if (ch == '\r') {
- advance_x = 0;
- next++;
- continue;
- }
- /* newlines */
- if (ch == '\n') {
- advance_y -= (TT_F26Dot6)(font->imetrics.y_ppem * LINESPACE * 64);
- advance_y = (advance_y-32) & -64; /* round to next pixel row */
- next++;
- continue;
- }
-
- x1 = (TT_F26Dot6)(advance_x * cos_a - advance_y * sin_a);
- y1 = (TT_F26Dot6)(advance_x * sin_a + advance_y * cos_a);
-
- if ((error=gdttfchar(im, fg, font, x, y, x1, y1, &advance, &bbox, &next)))
- return error;
-
- if (! i++) { /* if first character, init BB corner values */
- ll_x = bbox->xMin;
- ll_y = bbox->yMin;
- ur_x = bbox->xMax;
- ur_y = bbox->yMax;
- }
- else {
- if (! advance_x) ll_x = MIN(bbox->xMin, ll_x);
- ll_y = MIN(advance_y + bbox->yMin, ll_y);
- ur_x = MAX(advance_x + bbox->xMax, ur_x);
- if (! advance_y) ur_y = MAX(bbox->yMax, ur_y);
- }
- advance_x += advance;
- }
-
- /* rotate bounding rectangle */
- brect[0] = (int)(ll_x * cos_a - ll_y * sin_a);
- brect[1] = (int)(ll_x * sin_a + ll_y * cos_a);
- brect[2] = (int)(ur_x * cos_a - ll_y * sin_a);
- brect[3] = (int)(ur_x * sin_a + ll_y * cos_a);
- brect[4] = (int)(ur_x * cos_a - ur_y * sin_a);
- brect[5] = (int)(ur_x * sin_a + ur_y * cos_a);
- brect[6] = (int)(ll_x * cos_a - ur_y * sin_a);
- brect[7] = (int)(ll_x * sin_a + ur_y * cos_a);
-
- /* scale, round and offset brect */
- i = 0;
- while (i<8) {
- brect[i] = x + (brect[i] + 32) / 64;
- i++;
- brect[i] = y - (brect[i] + 32) / 64;
- i++;
- }
-
- return (char *)NULL;
-}
-
-#endif /* HAVE_LIBTTF */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/gd/gdttf.h b/ext/gd/gdttf.h
deleted file mode 100644
index 4f32129702..0000000000
--- a/ext/gd/gdttf.h
+++ /dev/null
@@ -1,16 +0,0 @@
-/* $Id$ */
-
-#ifdef _OSD_POSIX
-#ifndef APACHE
-#error On this EBCDIC platform, PHP is only supported as an Apache module.
-#else /*APACHE*/
-#ifndef CHARSET_EBCDIC
-#define CHARSET_EBCDIC /* this machine uses EBCDIC, not ASCII! */
-#endif
-#include "ebcdic.h"
-#endif /*APACHE*/
-#endif /*_OSD_POSIX*/
-
-char * gdttf(gdImage *im, int *brect, int fg, char *fontname,
- double ptsize, double angle, int x, int y, char *str);
-
diff --git a/ext/gd/php_gd.h b/ext/gd/php_gd.h
deleted file mode 100644
index ef67782ec1..0000000000
--- a/ext/gd/php_gd.h
+++ /dev/null
@@ -1,179 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
- | Stig Bakken <ssb@guardian.no> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef PHP_GD_H
-#define PHP_GD_H
-
-#define HAVE_GDIMAGECREATEFROMPNG 1
-
-#if HAVE_LIBTTF|HAVE_LIBFREETYPE
-#define ENABLE_GD_TTF
-#endif
-
-#if HAVE_LIBGD
-
-#include <gd.h>
-
-#if HAVE_LIBT1
-#include "gdt1.h"
-#endif
-
-#define PHP_GDIMG_TYPE_GIF 1
-#define PHP_GDIMG_TYPE_PNG 2
-#define PHP_GDIMG_TYPE_JPG 3
-#define PHP_GDIMG_TYPE_WBM 4
-#define PHP_GDIMG_TYPE_XBM 5
-#define PHP_GDIMG_TYPE_XPM 6
-#define PHP_GDIMG_CONVERT_WBM 7
-#define PHP_GDIMG_TYPE_GD 8
-#define PHP_GDIMG_TYPE_GD2 9
-#define PHP_GDIMG_TYPE_GD2PART 10
-
-#ifdef PHP_WIN32
-#define PHP_GD_API __declspec(dllexport)
-#else
-#define PHP_GD_API
-#endif
-
-PHPAPI extern const char php_sig_gif[3];
-PHPAPI extern const char php_sig_jpg[3];
-PHPAPI extern const char php_sig_png[3];
-
-extern zend_module_entry gd_module_entry;
-#define phpext_gd_ptr &gd_module_entry
-
-/* gd.c functions */
-PHP_MINFO_FUNCTION(gd);
-extern PHP_MINIT_FUNCTION(gd);
-extern PHP_MSHUTDOWN_FUNCTION(gd);
-
-#ifndef HAVE_GDIMAGECOLORRESOLVE
-static int gdImageColorResolve(gdImagePtr, int, int, int);
-#endif
-PHP_FUNCTION(imagearc);
-PHP_FUNCTION(imagechar);
-PHP_FUNCTION(imagecharup);
-PHP_FUNCTION(imagecolorallocate);
-PHP_FUNCTION(imagepalettecopy);
-PHP_FUNCTION(imagecolorat);
-PHP_FUNCTION(imagecolorclosest);
-PHP_FUNCTION(imagecolorclosesthwb);
-PHP_FUNCTION(imagecolordeallocate);
-PHP_FUNCTION(imagecolorresolve);
-PHP_FUNCTION(imagecolorexact);
-PHP_FUNCTION(imagecolorset);
-PHP_FUNCTION(imagecolorstotal);
-PHP_FUNCTION(imagecolorsforindex);
-PHP_FUNCTION(imagecolortransparent);
-PHP_FUNCTION(imagecopy);
-PHP_FUNCTION(imagecopymerge);
-PHP_FUNCTION(imagecopyresized);
-PHP_FUNCTION(imagetypes);
-PHP_FUNCTION(imagecreate);
-
-PHP_FUNCTION(imagecreatetruecolor);
-PHP_FUNCTION(imagetruecolortopalette);
-PHP_FUNCTION(imagesetthickness);
-PHP_FUNCTION(imageellipse);
-PHP_FUNCTION(imagefilledellipse);
-PHP_FUNCTION(imagefilledarc);
-PHP_FUNCTION(imagealphablending);
-PHP_FUNCTION(imagecolorresolvealpha);
-PHP_FUNCTION(imagecolorclosestalpha);
-PHP_FUNCTION(imagecolorexactalpha);
-PHP_FUNCTION(imagecopyresampled);
-PHP_FUNCTION(imagesetthickness);
-PHP_FUNCTION(imagesettile);
-PHP_FUNCTION(imagecopymergegray);
-PHP_FUNCTION(imagesetbrush);
-PHP_FUNCTION(imagesettile);
-PHP_FUNCTION(imagesetstyle);
-
-PHP_FUNCTION(imagecreatefromstring);
-PHP_FUNCTION(imagecreatefromgif);
-PHP_FUNCTION(imagecreatefromjpeg);
-PHP_FUNCTION(imagecreatefromxbm);
-PHP_FUNCTION(imagecreatefromxpm);
-PHP_FUNCTION(imagecreatefrompng);
-PHP_FUNCTION(imagecreatefromwbmp);
-PHP_FUNCTION(imagecreatefromgd);
-PHP_FUNCTION(imagecreatefromgd2);
-PHP_FUNCTION(imagecreatefromgd2part);
-
-PHP_FUNCTION(imagegammacorrect);
-PHP_FUNCTION(imagedestroy);
-PHP_FUNCTION(imagefill);
-PHP_FUNCTION(imagefilledpolygon);
-PHP_FUNCTION(imagefilledrectangle);
-PHP_FUNCTION(imagefilltoborder);
-PHP_FUNCTION(imagefontwidth);
-PHP_FUNCTION(imagefontheight);
-
-PHP_FUNCTION(imagegif );
-PHP_FUNCTION(imagejpeg );
-PHP_FUNCTION(imagepng);
-PHP_FUNCTION(imagewbmp);
-PHP_FUNCTION(imagegd);
-PHP_FUNCTION(imagegd2);
-
-PHP_FUNCTION(imageinterlace);
-PHP_FUNCTION(imageline);
-PHP_FUNCTION(imageloadfont);
-PHP_FUNCTION(imagepolygon);
-PHP_FUNCTION(imagerectangle);
-PHP_FUNCTION(imagesetpixel);
-PHP_FUNCTION(imagestring);
-PHP_FUNCTION(imagestringup);
-PHP_FUNCTION(imagesx);
-PHP_FUNCTION(imagesy);
-static void php_gdimagecharup(gdImagePtr, gdFontPtr, int, int, int, int);
-PHP_FUNCTION(imagedashedline);
-PHP_FUNCTION(imagettfbbox);
-PHP_FUNCTION(imagettftext);
-PHP_FUNCTION(imagepsloadfont);
-/*
-PHP_FUNCTION(imagepscopyfont);
-*/
-PHP_FUNCTION(imagepsfreefont);
-PHP_FUNCTION(imagepsencodefont);
-PHP_FUNCTION(imagepsextendfont);
-PHP_FUNCTION(imagepsslantfont);
-PHP_FUNCTION(imagepstext);
-PHP_FUNCTION(imagepsbbox);
-
-PHP_FUNCTION(jpeg2wbmp);
-PHP_FUNCTION(png2wbmp);
-PHP_FUNCTION(image2wbmp);
-
-PHP_GD_API int phpi_get_le_gd(void);
-
-/* This is missing from gd.h */
-#if HAVE_COLORCLOSESTHWB
-int gdImageColorClosestHWB(gdImagePtr im, int r, int g, int b);
-#endif
-
-#else
-
-#define phpext_gd_ptr NULL
-
-#endif
-
-#endif /* PHP_GD_H */
diff --git a/ext/gd/setup.stub b/ext/gd/setup.stub
deleted file mode 100644
index 64668ae0fb..0000000000
--- a/ext/gd/setup.stub
+++ /dev/null
@@ -1,6 +0,0 @@
-define_option with-gd 'GD support?' yesnodir \
- "yes /usr GD install" \
-' Whether to include GD support. If PHP can find the GD libraries\n
- on your system, it will be included automatically. You should enter\n
- something here if you do not want to include GD support or if you\n
- have installed GD in some unusual directory.'
diff --git a/ext/gettext/CREDITS b/ext/gettext/CREDITS
deleted file mode 100644
index acaebd7fae..0000000000
--- a/ext/gettext/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-GetText
-Alex Plotnick
diff --git a/ext/gettext/Makefile.in b/ext/gettext/Makefile.in
deleted file mode 100644
index 522c367c4d..0000000000
--- a/ext/gettext/Makefile.in
+++ /dev/null
@@ -1,7 +0,0 @@
-
-LTLIBRARY_NAME = libgettext.la
-LTLIBRARY_SOURCES = gettext.c
-LTLIBRARY_SHARED_NAME = gettext.la
-LTLIBRARY_SHARED_LIBADD = $(GETTEXT_SHARED_LIBADD)
-
-include $(top_srcdir)/build/dynlib.mk
diff --git a/ext/gettext/config.m4 b/ext/gettext/config.m4
deleted file mode 100644
index c48b696c12..0000000000
--- a/ext/gettext/config.m4
+++ /dev/null
@@ -1,41 +0,0 @@
-dnl $Id$
-dnl config.m4 for extension gettext
-dnl don't forget to call PHP_EXTENSION(gettext)
-
-PHP_ARG_WITH(gettext,whether to include GNU gettext support,
-[ --with-gettext[=DIR] Include GNU gettext support. DIR is the gettext
- install directory, defaults to /usr/local])
-
-if test "$PHP_GETTEXT" != "no"; then
- for i in /usr /usr/local $PHP_GETTEXT; do
- if test -r $i/include/libintl.h; then
- GETTEXT_DIR=$i
- fi
- done
-
- if test -z "$GETTEXT_DIR"; then
- AC_MSG_ERROR(Cannot locate header file libintl.h)
- fi
-
- GETTEXT_LIBDIR=$GETTEXT_DIR/lib
- GETTEXT_INCDIR=$GETTEXT_DIR/include
-
- O_LDFLAGS=$LDFLAGS
- LDFLAGS="$LDFLAGS -L$GETTEXT_LIBDIR"
- AC_CHECK_LIB(intl, bindtextdomain, GETTEXT_LIBS=intl,[
- AC_CHECK_LIB(c, bindtextdomain, GETTEXT_LIBS= ,[
- AC_MSG_ERROR(Unable to find required gettext library)
- ])
- ])
- LDFLAGS=$O_LDFLAGS
-
- AC_DEFINE(HAVE_LIBINTL,1,[ ])
- PHP_EXTENSION(gettext, $ext_shared)
- PHP_SUBST(GETTEXT_SHARED_LIBADD)
-
- if test -n "$GETTEXT_LIBS"; then
- PHP_ADD_LIBRARY_WITH_PATH($GETTEXT_LIBS, $GETTEXT_LIBDIR, GETTEXT_SHARED_LIBADD)
- fi
-
- PHP_ADD_INCLUDE($GETTEXT_INCDIR)
-fi
diff --git a/ext/gettext/gettext.c b/ext/gettext/gettext.c
deleted file mode 100644
index f5127b4bae..0000000000
--- a/ext/gettext/gettext.c
+++ /dev/null
@@ -1,181 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Alex Plotnick <alex@wgate.com> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#include <stdio.h>
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "php_gettext.h"
-
-#if HAVE_LIBINTL
-
-#include <libintl.h>
-#include "ext/standard/info.h"
-
-/* {{{ php_gettext_functions[]
- */
-function_entry php_gettext_functions[] = {
- PHP_FE(textdomain, NULL)
- PHP_FE(gettext, NULL)
- PHP_FALIAS(_, gettext, NULL)
- PHP_FE(dgettext, NULL)
- PHP_FE(dcgettext, NULL)
- PHP_FE(bindtextdomain, NULL)
- {NULL, NULL, NULL}
-};
-/* }}} */
-
-zend_module_entry php_gettext_module_entry = {
- "gettext", php_gettext_functions, NULL, NULL, NULL, NULL, PHP_MINFO(gettext), STANDARD_MODULE_PROPERTIES
-};
-
-#ifdef COMPILE_DL_GETTEXT
-ZEND_GET_MODULE(php_gettext)
-#endif
-
-PHP_MINFO_FUNCTION(gettext)
-{
- php_info_print_table_start();
- php_info_print_table_row(2, "GetText Support", "enabled");
- php_info_print_table_end();
-}
-
-/* {{{ proto string textdomain(string domain)
- Set the textdomain to "domain". Returns the current domain */
-PHP_FUNCTION(textdomain)
-{
- pval **domain;
- char *domain_name, *retval;
- char *val;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &domain) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(domain);
-
- val = (*domain)->value.str.val;
- if (strcmp(val, "") && strcmp(val, "0")) {
- domain_name = val;
- } else {
- domain_name = NULL;
- }
-
- retval = textdomain(domain_name);
-
- RETURN_STRING(retval, 1);
-}
-/* }}} */
-
-/* {{{ proto string gettext(string msgid)
- Return the translation of msgid for the current domain, or msgid unaltered if a translation does not exist */
-PHP_FUNCTION(gettext)
-{
- pval **msgid;
- char *msgstr;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &msgid) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(msgid);
-
- msgstr = gettext((*msgid)->value.str.val);
-
- RETURN_STRING(msgstr, 1);
-}
-/* }}} */
-
-/* {{{ proto string dgettext(string domain_name, string msgid)
- Return the translation of msgid for domain_name, or msgid unaltered if a translation does not exist */
-PHP_FUNCTION(dgettext)
-{
- pval **domain_name, **msgid;
- char *msgstr;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &domain_name, &msgid) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(domain_name);
- convert_to_string_ex(msgid);
-
- msgstr = dgettext((*domain_name)->value.str.val, (*msgid)->value.str.val);
-
- RETURN_STRING(msgstr, 1);
-}
-/* }}} */
-
-/* {{{ proto string dcgettext(string domain_name, string msgid, long category)
- Return the translation of msgid for domain_name and category, or msgid unaltered if a translation does not exist */
-PHP_FUNCTION(dcgettext)
-{
- pval **domain_name, **msgid, **category;
- char *msgstr;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &domain_name, &msgid, &category) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(domain_name);
- convert_to_string_ex(msgid);
- convert_to_long_ex(category);
-
- msgstr = dcgettext( (*domain_name)->value.str.val,
- (*msgid)->value.str.val,
- (*category)->value.lval);
-
- RETURN_STRING(msgstr, 1);
-}
-/* }}} */
-
-/* {{{ proto string bindtextdomain(string domain_name, string dir)
- Bind to the text domain domain_name, looking for translations in dir. Returns the current domain */
-PHP_FUNCTION(bindtextdomain)
-{
- pval **domain_name, **dir;
- char *retval, dir_name[MAXPATHLEN];
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &domain_name, &dir) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(domain_name);
- convert_to_string_ex(dir);
-
- if (strcmp((*dir)->value.str.val, "") && strcmp((*dir)->value.str.val, "0")) {
- VCWD_REALPATH((*dir)->value.str.val, dir_name);
- } else {
- VCWD_GETCWD(dir_name, MAXPATHLEN);
- }
-
- retval = bindtextdomain((*domain_name)->value.str.val, dir_name);
-
- RETURN_STRING(retval, 1);
-}
-/* }}} */
-
-#endif /* HAVE_LIBINTL */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/gettext/gettext.dsp b/ext/gettext/gettext.dsp
deleted file mode 100644
index 8150a17d84..0000000000
--- a/ext/gettext/gettext.dsp
+++ /dev/null
@@ -1,113 +0,0 @@
-# Microsoft Developer Studio Project File - Name="gettext" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=gettext - Win32 Release_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "gettext.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "gettext.mak" CFG="gettext - Win32 Release_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "gettext - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "gettext - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "gettext - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\..\TSRM" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_GETTEXT" /D ZTS=1 /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D "WIN32" /D "GETTEXT_EXPORTS" /D "COMPILE_DL_GETTEXT" /D ZTS=1 /D HAVE_LIBINTL=1 /D ZEND_DEBUG=0 /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZEND_WIN32" /D "PHP_WIN32" /FR /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x406 /d "NDEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_gettext.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
-# ADD LINK32 php4ts.lib gnu_gettext.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_gettext.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
-
-!ELSEIF "$(CFG)" == "gettext - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MSSQL_EXPORTS" /D "COMPILE_DL_GETTEXT" /D ZTS=1 /YX /FD /c
-# ADD CPP /nologo /MDd /W3 /GX /ZI /Od /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "GETTEXT_EXPORTS" /D "COMPILE_DL_GETTEXT" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_LIBINTL=1 /FR /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x406 /d "NDEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib /nologo /dll /machine:I386 /out:"../../Debug_TS/php_gettext.dll" /libpath:"..\..\Debug_TS"
-# ADD LINK32 php4ts_debug.lib gnu_gettext.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /incremental:yes /debug /machine:I386 /out:"../../Debug_TS/php_gettext.dll" /libpath:"..\..\Debug_TS"
-
-!ENDIF
-
-# Begin Target
-
-# Name "gettext - Win32 Release_TS"
-# Name "gettext - Win32 Debug_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\gettext.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_gettext.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/ext/gettext/php_gettext.h b/ext/gettext/php_gettext.h
deleted file mode 100644
index c7323831dd..0000000000
--- a/ext/gettext/php_gettext.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Alex Plotnick <alex@wgate.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef PHP_GETTEXT_H
-#define PHP_GETTEXT_H
-
-#if HAVE_LIBINTL
-#ifndef INIT_FUNC_ARGS
-#include "zend_modules.h"
-#endif
-
-extern zend_module_entry php_gettext_module_entry;
-#define gettext_module_ptr &php_gettext_module_entry
-
-PHP_MINFO_FUNCTION(gettext);
-
-PHP_FUNCTION(textdomain);
-PHP_FUNCTION(gettext);
-PHP_FUNCTION(dgettext);
-PHP_FUNCTION(dcgettext);
-PHP_FUNCTION(bindtextdomain);
-
-#else
-#define gettext_module_ptr NULL
-#endif /* HAVE_LIBINTL */
-
-#define phpext_gettext_ptr gettext_module_ptr
-
-#endif /* PHP_GETTEXT_H */
diff --git a/ext/gettext/setup.stub b/ext/gettext/setup.stub
deleted file mode 100644
index cc9fdd43c8..0000000000
--- a/ext/gettext/setup.stub
+++ /dev/null
@@ -1,6 +0,0 @@
-# $Id$
-
-define_option with-gettext 'gettext support?' yesnodir \
- "yes /usr/local" \
-' Whether to include gettext support.'
-
diff --git a/ext/gmp/Makefile.in b/ext/gmp/Makefile.in
deleted file mode 100644
index 5a63346585..0000000000
--- a/ext/gmp/Makefile.in
+++ /dev/null
@@ -1,9 +0,0 @@
-# $Id$
-
-LTLIBRARY_NAME = libgmp.la
-LTLIBRARY_SOURCES = gmp.c
-LTLIBRARY_SHARED_NAME = gmp.la
-LTLIBRARY_LIBADD = $(GMP_LIBADD)
-LTLIBRARY_SHARED_LIBADD = $(GMP_SHARED_LIBADD)
-
-include $(top_srcdir)/build/dynlib.mk
diff --git a/ext/gmp/README b/ext/gmp/README
deleted file mode 100644
index e142e2e031..0000000000
--- a/ext/gmp/README
+++ /dev/null
@@ -1,5 +0,0 @@
-Arbitrary length number support with GNU MP library.
-Please see the PGP manual for more documentation.
-See also GNU MP home page at http://www.swox.com/gmp/.
-GNU MP library is available under the tems of GNU LGPL
-license. Please see http://www.swox.com/gmp/lgpl.html
diff --git a/ext/gmp/TODO b/ext/gmp/TODO
deleted file mode 100644
index 81098a9cc1..0000000000
--- a/ext/gmp/TODO
+++ /dev/null
@@ -1,22 +0,0 @@
-mpz_mul_2exp
-mpz_[ft]div_[qr]_2exp
-
-V 3:
-mpz_nextprime
-mpz_addmul
-mpz_root
-mpz_perfect_power_p
-mpz_lcm
-mpz_si_kronecker
-mpz_kronecker_si
-mpz_remove
-mpz_bin_ui
-mpz_fib_ui
-mpz_cmpabs
-mpz_xor
-mpz_tstbit
-mpz_urandom[bm]
-mpz_fits_slong_p
-mpz_mul_si
-mpz_odd_p
-mpz_even_p
diff --git a/ext/gmp/config.m4 b/ext/gmp/config.m4
deleted file mode 100644
index 0a0848f397..0000000000
--- a/ext/gmp/config.m4
+++ /dev/null
@@ -1,27 +0,0 @@
-dnl $Id$
-dnl config.m4 for extension gmp
-
-dnl If your extension references something external, use with:
-
-PHP_ARG_WITH(gmp, for gmp support,
-dnl Make sure that the comment is aligned:
-[ --with-gmp Include gmp support])
-
-if test "$PHP_GMP" != "no"; then
-
- for i in /usr/local /usr $PHP_GMP; do
- if test -f $i/include/gmp.h; then
- GMP_DIR=$i
- fi
- done
-
- if test -z "$GMP_DIR"; then
- AC_MSG_ERROR(Unable to locate gmp.h)
- fi
- PHP_ADD_INCLUDE($GMP_DIR/include)
-
-
- PHP_EXTENSION(gmp, $ext_shared)
- AC_DEFINE(HAVE_GMP, 1, [ ])
- PHP_ADD_LIBRARY_WITH_PATH(gmp, $GMP_DIR/lib)
-fi
diff --git a/ext/gmp/gmp.c b/ext/gmp/gmp.c
deleted file mode 100644
index aaed49bad1..0000000000
--- a/ext/gmp/gmp.c
+++ /dev/null
@@ -1,1220 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Stanislav Malyshev <stas@php.net> |
- +----------------------------------------------------------------------+
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "php_ini.h"
-#include "php_gmp.h"
-#include "ext/standard/info.h"
-
-#if HAVE_GMP
-
-#include <gmp.h>
-/* If you declare any globals in php_gmp.h uncomment this:
-ZEND_DECLARE_MODULE_GLOBALS(gmp)
-*/
-
-/* True global resources - no need for thread safety here */
-static int le_gmp;
-
-static unsigned char first_of_two_force_ref[] = { 2, BYREF_FORCE, BYREF_NONE };
-
-/* {{{ gmp_functions[]
- */
-function_entry gmp_functions[] = {
- ZEND_FE(gmp_init, NULL)
- ZEND_FE(gmp_intval, NULL)
- ZEND_FE(gmp_strval, NULL)
- ZEND_FE(gmp_add, NULL)
- ZEND_FE(gmp_sub, NULL)
- ZEND_FE(gmp_mul, NULL)
- ZEND_FE(gmp_div_qr, NULL)
- ZEND_FE(gmp_div_q, NULL)
- ZEND_FE(gmp_div_r, NULL)
- ZEND_FALIAS(gmp_div, gmp_div_q, NULL)
- ZEND_FE(gmp_mod, NULL)
- ZEND_FE(gmp_divexact, NULL)
- ZEND_FE(gmp_neg, NULL)
- ZEND_FE(gmp_abs, NULL)
- ZEND_FE(gmp_fact, NULL)
- ZEND_FE(gmp_sqrt, NULL)
- ZEND_FE(gmp_sqrtrem, NULL)
- ZEND_FE(gmp_pow, NULL)
- ZEND_FE(gmp_powm, NULL)
- ZEND_FE(gmp_perfect_square, NULL)
- ZEND_FE(gmp_prob_prime, NULL)
- ZEND_FE(gmp_gcd, NULL)
- ZEND_FE(gmp_gcdext, NULL)
- ZEND_FE(gmp_invert, NULL)
- ZEND_FE(gmp_jacobi, NULL)
- ZEND_FE(gmp_legendre, NULL)
- ZEND_FE(gmp_cmp, NULL)
- ZEND_FE(gmp_sign, NULL)
- ZEND_FE(gmp_random, NULL)
- ZEND_FE(gmp_and, NULL)
- ZEND_FE(gmp_or, NULL)
- ZEND_FE(gmp_com, NULL)
- ZEND_FE(gmp_xor, NULL)
- ZEND_FE(gmp_setbit, first_of_two_force_ref)
- ZEND_FE(gmp_clrbit, first_of_two_force_ref)
- ZEND_FE(gmp_scan0, NULL)
- ZEND_FE(gmp_scan1, NULL)
- ZEND_FE(gmp_popcount, NULL)
- ZEND_FE(gmp_hamdist, NULL)
- {NULL, NULL, NULL} /* Must be the last line in gmp_functions[] */
-};
-/* }}} */
-
-/* {{{ gmp_module_entry
- */
-zend_module_entry gmp_module_entry = {
- "gmp",
- gmp_functions,
- ZEND_MINIT(gmp),
- ZEND_MSHUTDOWN(gmp),
- NULL, /* Replace with NULL if there's nothing to do at request start */
- NULL, /* Replace with NULL if there's nothing to do at request end */
- ZEND_MINFO(gmp),
- STANDARD_MODULE_PROPERTIES
-};
-/* }}} */
-
-#ifdef COMPILE_DL_GMP
-ZEND_GET_MODULE(gmp)
-#endif
-
-static void _php_gmpnum_free(zend_rsrc_list_entry *rsrc);
-
-#define GMP_RESOURCE_NAME "GMP integer"
-
-#define GMP_ROUND_ZERO 0
-#define GMP_ROUND_PLUSINF 1
-#define GMP_ROUND_MINUSINF 2
-
-/* {{{ gmp_emalloc
- */
-static void *gmp_emalloc(size_t size)
-{
- return emalloc(size);
-}
-/* }}} */
-
-/* {{{ gmp_erealloc
- */
-static void *gmp_erealloc(void *ptr, size_t old_size, size_t new_size)
-{
- return erealloc(ptr, new_size);
-}
-/* }}} */
-
-/* {{{ gmp_efree
- */
-static void gmp_efree(void *ptr, size_t size)
-{
- efree(ptr);
-}
-/* }}} */
-
-/* {{{ ZEND_MINIT_FUNCTION
- */
-ZEND_MINIT_FUNCTION(gmp)
-{
-/* Remove comments if you have entries in php.ini
- REGISTER_INI_ENTRIES();
-*/
- le_gmp = zend_register_list_destructors_ex(_php_gmpnum_free, NULL,
- GMP_RESOURCE_NAME,
- module_number);
- REGISTER_LONG_CONSTANT("GMP_ROUND_ZERO", GMP_ROUND_ZERO, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("GMP_ROUND_PLUSINF", GMP_ROUND_PLUSINF, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("GMP_ROUND_MINUSINF", GMP_ROUND_MINUSINF, CONST_CS | CONST_PERSISTENT);
-
- mp_set_memory_functions(gmp_emalloc, gmp_erealloc, gmp_efree);
-
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ ZEND_MSHUTDOWN_FUNCTION
- */
-ZEND_MSHUTDOWN_FUNCTION(gmp)
-{
-/* Remove comments if you have entries in php.ini
- UNREGISTER_INI_ENTRIES();
-*/
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ ZEND_MINFO_FUNCTION
- */
-ZEND_MINFO_FUNCTION(gmp)
-{
- php_info_print_table_start();
- php_info_print_table_header(2, "gmp support", "enabled");
- php_info_print_table_end();
-
- /* Remove comments if you have entries in php.ini
- DISPLAY_INI_ENTRIES();
- */
-}
-/* }}} */
-
-/* Fetch zval to be GMP number.
- Initially, zval can be also number or string */
-#define FETCH_GMP_ZVAL(gmpnumber, zval) \
-if(Z_TYPE_PP(zval) == IS_RESOURCE) { \
- ZEND_FETCH_RESOURCE(gmpnumber, mpz_t *, zval, -1, GMP_RESOURCE_NAME, le_gmp);\
-} else {\
- if(convert_to_gmp(&gmpnumber,zval) == FAILURE) {\
- RETURN_FALSE;\
- }\
- ZEND_REGISTER_RESOURCE(NULL, gmpnumber, le_gmp);\
-}
-
-/* create a new initialized GMP number */
-#define INIT_GMP_NUM(gmpnumber) { gmpnumber=emalloc(sizeof(mpz_t)); mpz_init(*gmpnumber); }
-#define FREE_GMP_NUM(gmpnumber) { mpz_clear(*gmpnumber); efree(gmpnumber); }
-
-/* {{{ convert_to_gmp
- * Convert zval to be gmp number */
-static int convert_to_gmp(mpz_t * *gmpnumber, zval **val)
-{
- int ret = 0;
-
- *gmpnumber = emalloc(sizeof(mpz_t));
- switch(Z_TYPE_PP(val)) {
- case IS_LONG:
- case IS_BOOL:
- case IS_CONSTANT:
- {
- convert_to_long_ex(val);
- mpz_init_set_si(**gmpnumber, Z_LVAL_PP(val));
- }
- break;
- case IS_STRING:
- {
- char *numstr = Z_STRVAL_PP(val);
- if(numstr[0] == '0' && (numstr[1] == 'x' || numstr[1] == 'X')) {
- ret = mpz_init_set_str(**gmpnumber, numstr+2, 16);
- } else {
- ret = mpz_init_set_str(**gmpnumber, numstr, 10);
- }
- }
- break;
- default:
- zend_error(E_WARNING,"Unable to convert variable to GMP - wrong type");
- efree(*gmpnumber);
- return FAILURE;
- }
-
- return ret?FAILURE:SUCCESS;
-}
-/* }}} */
-
-/* {{{ typedefs
- */
-typedef void (*gmp_unary_op_t)(mpz_ptr, mpz_srcptr);
-typedef int (*gmp_unary_opl_t)(mpz_srcptr);
-
-typedef void (*gmp_unary_ui_op_t)(mpz_ptr, unsigned long);
-
-typedef void (*gmp_binary_op_t)(mpz_ptr, mpz_srcptr, mpz_srcptr);
-typedef int (*gmp_binary_opl_t)(mpz_srcptr, mpz_srcptr);
-
-typedef unsigned long (*gmp_binary_ui_op_t)(mpz_ptr, mpz_srcptr, unsigned long);
-typedef void (*gmp_binary_op2_t)(mpz_ptr, mpz_ptr, mpz_srcptr, mpz_srcptr);
-typedef unsigned long (*gmp_binary_ui_op2_t)(mpz_ptr, mpz_ptr, mpz_srcptr, unsigned long);
-/* }}} */
-
-#define gmp_zval_binary_ui_op(r,a,b,o,u) gmp_zval_binary_ui_op_ex(r,a,b,o,u,0)
-#define gmp_zval_binary_ui_op2(r,a,b,o,u) gmp_zval_binary_ui_op2_ex(r,a,b,o,u,0)
-
-#define gmp_binary_ui_op(op,uop) _gmp_binary_ui_op(INTERNAL_FUNCTION_PARAM_PASSTHRU, op, uop)
-#define gmp_binary_op(op) _gmp_binary_ui_op(INTERNAL_FUNCTION_PARAM_PASSTHRU, op, NULL)
-#define gmp_binary_opl(op) _gmp_binary_opl(INTERNAL_FUNCTION_PARAM_PASSTHRU, op)
-
-/* Unary operations */
-#define gmp_unary_op(op) _gmp_unary_op(INTERNAL_FUNCTION_PARAM_PASSTHRU, op)
-#define gmp_unary_opl(op) _gmp_unary_opl(INTERNAL_FUNCTION_PARAM_PASSTHRU, op)
-#define gmp_unary_ui_op(op) _gmp_unary_ui_op(INTERNAL_FUNCTION_PARAM_PASSTHRU, op)
-
-/* {{{ gmp_zval_binary_ui_op_ex
- Execute GMP binary operation.
- May return GMP resource or long if operation allows this
-*/
-static inline void gmp_zval_binary_ui_op_ex(zval *return_value, zval **a_arg, zval **b_arg, gmp_binary_op_t gmp_op, gmp_binary_ui_op_t gmp_ui_op, int allow_ui_return) {
- mpz_t *gmpnum_a, *gmpnum_b, *gmpnum_result;
- unsigned long long_result;
- int use_ui=0;
-
- FETCH_GMP_ZVAL(gmpnum_a, a_arg);
- if(gmp_ui_op && Z_TYPE_PP(b_arg) == IS_LONG && Z_LVAL_PP(b_arg) >= 0) {
- use_ui=1;
- } else {
- FETCH_GMP_ZVAL(gmpnum_b, b_arg);
- }
-
- INIT_GMP_NUM(gmpnum_result);
- if(use_ui && gmp_ui_op) {
- if(allow_ui_return) {
- long_result = gmp_ui_op(*gmpnum_result, *gmpnum_a, (unsigned long)Z_LVAL_PP(b_arg));
- } else {
- gmp_ui_op(*gmpnum_result, *gmpnum_a, (unsigned long)Z_LVAL_PP(b_arg));
- }
- } else {
- gmp_op(*gmpnum_result, *gmpnum_a, *gmpnum_b);
- }
-
- if(use_ui && allow_ui_return) {
- FREE_GMP_NUM(gmpnum_result);
- RETURN_LONG((long)long_result);
- } else {
- ZEND_REGISTER_RESOURCE(return_value, gmpnum_result, le_gmp);
- }
-}
-/* }}} */
-
-/* {{{ gmp_zval_binary_ui_op2_ex
- Execute GMP binary operation which returns 2 values.
- May return GMP resources or longs if operation allows this.
-*/
-static inline void gmp_zval_binary_ui_op2_ex(zval *return_value, zval **a_arg, zval **b_arg, gmp_binary_op2_t gmp_op, gmp_binary_ui_op2_t gmp_ui_op, int allow_ui_return) {
- mpz_t *gmpnum_a, *gmpnum_b, *gmpnum_result1, *gmpnum_result2;
- zval r;
- int use_ui=0;
- unsigned long long_result;
-
- FETCH_GMP_ZVAL(gmpnum_a, a_arg);
- if(gmp_ui_op && Z_TYPE_PP(b_arg) == IS_LONG && Z_LVAL_PP(b_arg) >= 0) {
- /* use _ui function */
- use_ui=1;
- } else {
- FETCH_GMP_ZVAL(gmpnum_b, b_arg);
- }
-
- INIT_GMP_NUM(gmpnum_result1);
- INIT_GMP_NUM(gmpnum_result2);
-
- if(use_ui && gmp_ui_op) {
- if(allow_ui_return) {
- long_result = gmp_ui_op(*gmpnum_result1, *gmpnum_result2, *gmpnum_a, (unsigned long)Z_LVAL_PP(b_arg));
- } else {
- gmp_ui_op(*gmpnum_result1, *gmpnum_result2, *gmpnum_a, (unsigned long)Z_LVAL_PP(b_arg));
- }
- } else {
- gmp_op(*gmpnum_result1, *gmpnum_result2, *gmpnum_a, *gmpnum_b);
- }
-
- array_init(return_value);
- ZEND_REGISTER_RESOURCE(&r, gmpnum_result1, le_gmp);
- add_index_resource(return_value, 0, Z_LVAL(r));
- if(use_ui && allow_ui_return) {
- mpz_clear(*gmpnum_result2);
- add_index_long(return_value, 1, long_result);
- } else {
- ZEND_REGISTER_RESOURCE(&r, gmpnum_result2, le_gmp);
- add_index_resource(return_value, 1, Z_LVAL(r));
- }
-}
-/* }}} */
-
-/* {{{ _gmp_binary_ui_op
- */
-static inline void _gmp_binary_ui_op(INTERNAL_FUNCTION_PARAMETERS, gmp_binary_op_t gmp_op, gmp_binary_ui_op_t gmp_ui_op) {
- zval **a_arg, **b_arg;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &a_arg, &b_arg) == FAILURE){
- WRONG_PARAM_COUNT;
- }
-
- gmp_zval_binary_ui_op(return_value,a_arg,b_arg,gmp_op,gmp_ui_op);
-}
-/* }}} */
-
-/* Unary operations */
-
-/* {{{ gmp_zval_unary_op
- */
-static inline void gmp_zval_unary_op(zval *return_value, zval **a_arg, gmp_unary_op_t gmp_op) {
- mpz_t *gmpnum_a, *gmpnum_result;
-
- FETCH_GMP_ZVAL(gmpnum_a, a_arg);
-
- INIT_GMP_NUM(gmpnum_result);
- gmp_op(*gmpnum_result, *gmpnum_a);
-
- ZEND_REGISTER_RESOURCE(return_value, gmpnum_result, le_gmp);
-}
-/* }}} */
-
-/* {{{ gmp_zval_unary_ui_op
- */
-static inline void gmp_zval_unary_ui_op(zval *return_value, zval **a_arg, gmp_unary_ui_op_t gmp_op) {
- mpz_t *gmpnum_result;
-
- convert_to_long_ex(a_arg);
-
- INIT_GMP_NUM(gmpnum_result);
- gmp_op(*gmpnum_result, Z_LVAL_PP(a_arg));
-
- ZEND_REGISTER_RESOURCE(return_value, gmpnum_result, le_gmp);
-}
-/* }}} */
-
-/* {{{ _gmp_unary_ui_op
- Execute GMP unary operation.
-*/
-static inline void _gmp_unary_ui_op(INTERNAL_FUNCTION_PARAMETERS, gmp_unary_ui_op_t gmp_op) {
- zval **a_arg;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &a_arg) == FAILURE){
- WRONG_PARAM_COUNT;
- }
-
- gmp_zval_unary_ui_op(return_value,a_arg,gmp_op);
-}
-/* }}} */
-
-/* {{{ _gmp_unary_op
- */
-static inline void _gmp_unary_op(INTERNAL_FUNCTION_PARAMETERS, gmp_unary_op_t gmp_op) {
- zval **a_arg;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &a_arg) == FAILURE){
- WRONG_PARAM_COUNT;
- }
-
- gmp_zval_unary_op(return_value,a_arg,gmp_op);
-}
-/* }}} */
-
-/* {{{ _gmp_unary_opl
- */
-static inline void _gmp_unary_opl(INTERNAL_FUNCTION_PARAMETERS, gmp_unary_opl_t gmp_op) {
- zval **a_arg;
- mpz_t *gmpnum_a;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &a_arg) == FAILURE){
- WRONG_PARAM_COUNT;
- }
-
- FETCH_GMP_ZVAL(gmpnum_a, a_arg);
-
- RETURN_LONG(gmp_op(*gmpnum_a));
-}
-/* }}} */
-
-/* {{{ _gmp_binary_opl
- */
-static inline void _gmp_binary_opl(INTERNAL_FUNCTION_PARAMETERS, gmp_binary_opl_t gmp_op) {
- zval **a_arg, **b_arg;
- mpz_t *gmpnum_a, *gmpnum_b;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &a_arg, &b_arg) == FAILURE){
- WRONG_PARAM_COUNT;
- }
-
- FETCH_GMP_ZVAL(gmpnum_a, a_arg);
- FETCH_GMP_ZVAL(gmpnum_b, a_arg);
-
- RETURN_LONG(gmp_op(*gmpnum_a, *gmpnum_b));
-}
-/* }}} */
-
-/* Remove the following function when you have succesfully modified config.m4
- so that your module can be compiled into PHP, it exists only for testing
- purposes. */
-
-/* {{{ proto resource gmp_init(mixed number)
- Initializes GMP number */
-ZEND_FUNCTION(gmp_init)
-{
- zval **number_arg;
- mpz_t * gmpnumber;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &number_arg) == FAILURE){
- WRONG_PARAM_COUNT;
- }
-
- if(convert_to_gmp(&gmpnumber,number_arg) == FAILURE) {
- RETURN_FALSE;
- }
-
- /* Write your own code here to handle argument number. */
- ZEND_REGISTER_RESOURCE(return_value, gmpnumber, le_gmp);
-}
-/* }}} */
-
-/* {{{ proto int gmp_intval(resource gmpnumber)
- Gets signed long value of GMP number */
-ZEND_FUNCTION(gmp_intval)
-{
- zval **gmpnumber_arg;
- mpz_t * gmpnum;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &gmpnumber_arg) == FAILURE){
- WRONG_PARAM_COUNT;
- }
-
- if(Z_TYPE_PP(gmpnumber_arg) == IS_RESOURCE) {
- ZEND_FETCH_RESOURCE(gmpnum, mpz_t *, gmpnumber_arg, -1, GMP_RESOURCE_NAME, le_gmp);
- RETVAL_LONG(mpz_get_si(*gmpnum));
- } else {
- convert_to_long_ex(gmpnumber_arg);
- RETVAL_LONG(Z_LVAL_PP(gmpnumber_arg));
- }
-}
-/* }}} */
-
-/* {{{ proto string gmp_strval(resource gmpnumber [, int base])
- Gets string representation of GMP number */
-ZEND_FUNCTION(gmp_strval)
-{
- zval **gmpnumber_arg, **base_arg;
- int base, num_len, argc;
- mpz_t * gmpnum;
- char *out_string;
-
- argc = ZEND_NUM_ARGS();
- if (argc < 1 || argc > 2 || zend_get_parameters_ex(argc, &gmpnumber_arg, &base_arg) == FAILURE){
- WRONG_PARAM_COUNT;
- }
-
- FETCH_GMP_ZVAL(gmpnum, gmpnumber_arg);
-
- switch (argc) {
- case 2:
- convert_to_long_ex(base_arg);
- base = Z_LVAL_PP(base_arg);
- break;
- case 1:
- base = 10;
- break;
- }
-
- if(base < 2 || base > 36) {
- zend_error(E_WARNING, "Bad base for conversion: %d", base);
- RETURN_FALSE;
- }
-
- num_len = mpz_sizeinbase(*gmpnum, base);
- out_string = emalloc(num_len+2);
- if(mpz_sgn(*gmpnum) < 0) {
- num_len++;
- }
- mpz_get_str(out_string, base, *gmpnum);
-
- RETVAL_STRINGL(out_string, num_len, 0);
-}
-/* }}} */
-
-/* {{{ proto resource gmp_add(resource a, resource b)
- Add a and b */
-ZEND_FUNCTION(gmp_add)
-{
- gmp_binary_ui_op(mpz_add, (gmp_binary_ui_op_t)mpz_add_ui);
-}
-/* }}} */
-
-/* {{{ proto resource gmp_sub(resource a, resource b)
- Subtract b from a */
-ZEND_FUNCTION(gmp_sub)
-{
- gmp_binary_ui_op(mpz_sub, (gmp_binary_ui_op_t)mpz_sub_ui);
-}
-/* }}} */
-
-/* {{{ proto resource gmp_mul(resource a, resource b)
- Multiply a and b */
-ZEND_FUNCTION(gmp_mul)
-{
- gmp_binary_ui_op(mpz_mul, (gmp_binary_ui_op_t)mpz_mul_ui);
-}
-/* }}} */
-
-/* {{{ proto array gmp_div_qr(resource a, resource b [, int round])
- Divide a by b, returns quotient and reminder */
-ZEND_FUNCTION(gmp_div_qr)
-{
- zval **a_arg, **b_arg, **round_arg;
- int round, argc;
-
- argc = ZEND_NUM_ARGS();
- if (argc < 2 || argc > 3 || zend_get_parameters_ex(argc, &a_arg, &b_arg, &round_arg) == FAILURE){
- WRONG_PARAM_COUNT;
- }
-
- switch (argc) {
- case 3:
- convert_to_long_ex(round_arg);
- round = Z_LVAL_PP(round_arg);
- break;
- case 2:
- round = GMP_ROUND_ZERO;
- break;
- }
-
- switch(round) {
- case GMP_ROUND_ZERO:
- gmp_zval_binary_ui_op2(return_value, a_arg, b_arg, mpz_tdiv_qr, (gmp_binary_ui_op2_t)mpz_tdiv_qr_ui);
- break;
- case GMP_ROUND_PLUSINF:
- gmp_zval_binary_ui_op2(return_value, a_arg, b_arg, mpz_cdiv_qr, (gmp_binary_ui_op2_t)mpz_cdiv_qr_ui);
- break;
- case GMP_ROUND_MINUSINF:
- gmp_zval_binary_ui_op2(return_value, a_arg, b_arg, mpz_fdiv_qr, (gmp_binary_ui_op2_t)mpz_fdiv_qr_ui);
- break;
- }
-
-}
-/* }}} */
-
-/* {{{ proto resource gmp_div_r(resource a, resource b [, int round])
- Divide a by b, returns reminder only */
-ZEND_FUNCTION(gmp_div_r)
-{
- zval **a_arg, **b_arg, **round_arg;
- int round, argc;
-
- argc = ZEND_NUM_ARGS();
- if (argc < 2 || argc > 3 || zend_get_parameters_ex(argc, &a_arg, &b_arg, &round_arg) == FAILURE){
- WRONG_PARAM_COUNT;
- }
-
- switch (argc) {
- case 3:
- convert_to_long_ex(round_arg);
- round = Z_LVAL_PP(round_arg);
- break;
- case 2:
- round = GMP_ROUND_ZERO;
- break;
- }
-
- switch(round) {
- case GMP_ROUND_ZERO:
- gmp_zval_binary_ui_op_ex(return_value, a_arg, b_arg, mpz_tdiv_r, (gmp_binary_ui_op_t)mpz_tdiv_r_ui,1);
- break;
- case GMP_ROUND_PLUSINF:
- gmp_zval_binary_ui_op_ex(return_value, a_arg, b_arg, mpz_cdiv_r, (gmp_binary_ui_op_t)mpz_cdiv_r_ui,1);
- break;
- case GMP_ROUND_MINUSINF:
- gmp_zval_binary_ui_op_ex(return_value, a_arg, b_arg, mpz_fdiv_r, (gmp_binary_ui_op_t)mpz_fdiv_r_ui,1);
- break;
- }
-}
-/* }}} */
-
-/* {{{ proto resource gmp_div_q(resource a, resource b [, int round])
- Divide a by b, returns quotient only */
-ZEND_FUNCTION(gmp_div_q)
-{
- zval **a_arg, **b_arg, **round_arg;
- int round, argc;
-
- argc = ZEND_NUM_ARGS();
- if (argc < 2 || argc > 3 || zend_get_parameters_ex(argc, &a_arg, &b_arg, &round_arg) == FAILURE){
- WRONG_PARAM_COUNT;
- }
-
- switch (argc) {
- case 3:
- convert_to_long_ex(round_arg);
- round = Z_LVAL_PP(round_arg);
- break;
- case 2:
- round = GMP_ROUND_ZERO;
- break;
- }
-
- switch(round) {
- case GMP_ROUND_ZERO:
- gmp_zval_binary_ui_op(return_value, a_arg, b_arg, mpz_tdiv_q, (gmp_binary_ui_op_t)mpz_tdiv_q_ui);
- break;
- case GMP_ROUND_PLUSINF:
- gmp_zval_binary_ui_op(return_value, a_arg, b_arg, mpz_cdiv_q, (gmp_binary_ui_op_t)mpz_cdiv_q_ui);
- break;
- case GMP_ROUND_MINUSINF:
- gmp_zval_binary_ui_op(return_value, a_arg, b_arg, mpz_fdiv_q, (gmp_binary_ui_op_t)mpz_fdiv_q_ui);
- break;
- }
-
-}
-/* }}} */
-
-/* {{{ proto resource gmp_mod(resource a, resource b)
- Computes a modulo b */
-ZEND_FUNCTION(gmp_mod)
-{
- zval **a_arg, **b_arg;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &a_arg, &b_arg) == FAILURE){
- WRONG_PARAM_COUNT;
- }
-
- gmp_zval_binary_ui_op_ex(return_value,a_arg,b_arg,mpz_mod,(gmp_binary_ui_op_t)mpz_mod_ui,1);
-}
-/* }}} */
-
-/* {{{ proto resource gmp_divexact(resource a, resource b)
- Divide a by b using exact division algorithm */
-ZEND_FUNCTION(gmp_divexact)
-{
- gmp_binary_op(mpz_divexact);
-}
-/* }}} */
-
-/* {{{ proto resource gmp_neg(resource a)
- Negates a number */
-ZEND_FUNCTION(gmp_neg)
-{
- gmp_unary_op(mpz_neg);
-}
-/* }}} */
-
-/* {{{ proto resource gmp_abs(resource a)
- Calculates absolute value */
-ZEND_FUNCTION(gmp_abs)
-{
- gmp_unary_op(mpz_abs);
-}
-/* }}} */
-
-/* {{{ proto resource gmp_fact(int a)
- Calculates factorial function */
-ZEND_FUNCTION(gmp_fact)
-{
- gmp_unary_ui_op(mpz_fac_ui);
-}
-/* }}} */
-
-/* {{{ proto resource gmp_pow(resource base, int exp)
- Raise base to power exp */
-ZEND_FUNCTION(gmp_pow)
-{
- zval **base_arg, **exp_arg;
- mpz_t *gmpnum_result, *gmpnum_base;
- int use_ui=0;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &base_arg, &exp_arg) == FAILURE){
- WRONG_PARAM_COUNT;
- }
-
- if(Z_TYPE_PP(base_arg) == IS_LONG && Z_LVAL_PP(base_arg) >= 0) {
- use_ui=1;
- } else {
- FETCH_GMP_ZVAL(gmpnum_base, base_arg);
- }
-
- convert_to_long_ex(exp_arg);
-
- if(Z_LVAL_PP(exp_arg) < 0) {
- zend_error(E_WARNING,"Negative exponent not supported");
- RETURN_FALSE;
- }
-
- INIT_GMP_NUM(gmpnum_result);
- if(use_ui) {
- mpz_ui_pow_ui(*gmpnum_result, Z_LVAL_PP(base_arg), Z_LVAL_PP(exp_arg));
- } else {
- mpz_pow_ui(*gmpnum_result, *gmpnum_base, Z_LVAL_PP(exp_arg));
- }
-
- ZEND_REGISTER_RESOURCE(return_value, gmpnum_result, le_gmp);
-}
-/* }}} */
-
-/* {{{ proto resource gmp_powm(resource base, resource exp, resource mod)
- Raise base to power exp and take result modulo mod */
-ZEND_FUNCTION(gmp_powm)
-{
- zval **base_arg, **exp_arg, **mod_arg;
- mpz_t *gmpnum_base, *gmpnum_exp, *gmpnum_mod, *gmpnum_result;
- int use_ui=0;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &base_arg, &exp_arg, &mod_arg) == FAILURE){
- WRONG_PARAM_COUNT;
- }
-
- FETCH_GMP_ZVAL(gmpnum_base, base_arg);
- if(Z_TYPE_PP(exp_arg) == IS_LONG && Z_LVAL_PP(exp_arg) >= 0) {
- use_ui=1;
- } else {
- FETCH_GMP_ZVAL(gmpnum_exp, exp_arg);
- }
- FETCH_GMP_ZVAL(gmpnum_mod, mod_arg);
-
- INIT_GMP_NUM(gmpnum_result);
- if(use_ui) {
- mpz_powm_ui(*gmpnum_result, *gmpnum_base, (unsigned long)Z_LVAL_PP(exp_arg), *gmpnum_mod);
- } else {
- mpz_powm(*gmpnum_result, *gmpnum_base, *gmpnum_exp, *gmpnum_mod);
- }
-
- ZEND_REGISTER_RESOURCE(return_value, gmpnum_result, le_gmp);
-
-}
-/* }}} */
-
-/* {{{ proto resource gmp_sqrt(resource a)
- Takes integer part of square root of a */
-ZEND_FUNCTION(gmp_sqrt)
-{
- gmp_unary_op(mpz_sqrt);
-}
-/* }}} */
-
-/* {{{ proto array gmp_sqrtrem(resource a)
- Takes integer part of square root of a */
-ZEND_FUNCTION(gmp_sqrtrem)
-{
- zval **a_arg;
- mpz_t *gmpnum_a, *gmpnum_result1, *gmpnum_result2;
- zval r;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &a_arg) == FAILURE){
- WRONG_PARAM_COUNT;
- }
-
- FETCH_GMP_ZVAL(gmpnum_a, a_arg);
-
- INIT_GMP_NUM(gmpnum_result1);
- INIT_GMP_NUM(gmpnum_result2);
-
- mpz_sqrtrem(*gmpnum_result1, *gmpnum_result2, *gmpnum_a);
-
- array_init(return_value);
- ZEND_REGISTER_RESOURCE(&r, gmpnum_result1, le_gmp);
- add_index_resource(return_value, 0, Z_LVAL(r));
- ZEND_REGISTER_RESOURCE(&r, gmpnum_result2, le_gmp);
- add_index_resource(return_value, 1, Z_LVAL(r));
-}
-/* }}} */
-
-/* {{{ proto bool gmp_perfect_square(resource a)
- Checks if a is an exact square */
-ZEND_FUNCTION(gmp_perfect_square)
-{
- zval **a_arg;
- mpz_t *gmpnum_a;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &a_arg) == FAILURE){
- WRONG_PARAM_COUNT;
- }
-
- FETCH_GMP_ZVAL(gmpnum_a, a_arg);
-
- RETURN_BOOL((mpz_perfect_square_p(*gmpnum_a)!=0));
-}
-/* }}} */
-
-/* {{{ proto int gmp_prob_prime(resource a[, int reps])
- Checks if a is "probably prime" */
-ZEND_FUNCTION(gmp_prob_prime)
-{
- zval **gmpnumber_arg, **reps_arg;
- mpz_t *gmpnum_a;
- int argc, reps;
-
- argc = ZEND_NUM_ARGS();
- if (argc < 1 || argc > 2 || zend_get_parameters_ex(argc, &gmpnumber_arg, &reps_arg) == FAILURE){
- WRONG_PARAM_COUNT;
- }
-
- FETCH_GMP_ZVAL(gmpnum_a, gmpnumber_arg);
-
- switch (argc) {
- case 2:
- convert_to_long_ex(reps_arg);
- reps = Z_LVAL_PP(reps_arg);
- break;
- case 1:
- reps = 10;
- break;
- }
-
- RETURN_LONG(mpz_probab_prime_p(*gmpnum_a, reps));
-}
-/* }}} */
-
-/* {{{ proto resource gmp_gcd(resource a, resource b)
- Computes greatest common denominator (gcd) of a and b */
-ZEND_FUNCTION(gmp_gcd)
-{
- zval **a_arg, **b_arg;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &a_arg, &b_arg) == FAILURE){
- WRONG_PARAM_COUNT;
- }
-
- gmp_zval_binary_ui_op_ex(return_value,a_arg,b_arg,mpz_gcd,(gmp_binary_ui_op_t)mpz_gcd_ui,1);
-}
-/* }}} */
-
-/* {{{ proto array gmp_gcdext(resource a, resource b)
- Computes G, S, and T, such that AS + BT = G = `gcd' (A, B) */
-ZEND_FUNCTION(gmp_gcdext)
-{
- zval **a_arg, **b_arg;
- mpz_t *gmpnum_a, *gmpnum_b, *gmpnum_t, *gmpnum_s, *gmpnum_g;
- zval r;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &a_arg, &b_arg) == FAILURE){
- WRONG_PARAM_COUNT;
- }
-
- FETCH_GMP_ZVAL(gmpnum_a, a_arg);
- FETCH_GMP_ZVAL(gmpnum_b, a_arg);
-
- INIT_GMP_NUM(gmpnum_g);
- INIT_GMP_NUM(gmpnum_s);
- INIT_GMP_NUM(gmpnum_t);
-
- mpz_gcdext(*gmpnum_g, *gmpnum_s, *gmpnum_t, *gmpnum_a, *gmpnum_b);
-
- array_init(return_value);
-
- ZEND_REGISTER_RESOURCE(&r, gmpnum_g, le_gmp);
- add_assoc_resource(return_value, "g", Z_LVAL(r));
- ZEND_REGISTER_RESOURCE(&r, gmpnum_s, le_gmp);
- add_assoc_resource(return_value, "s", Z_LVAL(r));
- ZEND_REGISTER_RESOURCE(&r, gmpnum_t, le_gmp);
- add_assoc_resource(return_value, "t", Z_LVAL(r));
-}
-/* }}} */
-
-/* {{{ proto resource gmp_invert(resource a, resource b)
- Computes the inverse of a modulo b */
-ZEND_FUNCTION(gmp_invert)
-{
- zval **a_arg, **b_arg;
- mpz_t *gmpnum_a, *gmpnum_b, *gmpnum_result;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &a_arg, &b_arg) == FAILURE){
- WRONG_PARAM_COUNT;
- }
-
- FETCH_GMP_ZVAL(gmpnum_a, a_arg);
- FETCH_GMP_ZVAL(gmpnum_b, a_arg);
-
- INIT_GMP_NUM(gmpnum_result);
- if(mpz_invert(*gmpnum_result,*gmpnum_a, *gmpnum_b)) {
- ZEND_REGISTER_RESOURCE(return_value, gmpnum_result, le_gmp);
- } else {
- FREE_GMP_NUM(gmpnum_result);
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto int gmp_jacobi(resource a, resource b)
- Computes Jacobi symbol */
-ZEND_FUNCTION(gmp_jacobi)
-{
- gmp_binary_opl(mpz_jacobi);
-}
-/* }}} */
-
-/* {{{ proto int gmp_legendre(resource a, resource b)
- Computes Legendre symbol */
-ZEND_FUNCTION(gmp_legendre)
-{
- gmp_binary_opl(mpz_legendre);
-}
-/* }}} */
-
-/* {{{ proto int gmp_cmp(resource a, resource b)
- Compares two numbers */
-ZEND_FUNCTION(gmp_cmp)
-{
- zval **a_arg, **b_arg;
- mpz_t *gmpnum_a, *gmpnum_b;
- int use_si=0, res;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &a_arg, &b_arg) == FAILURE){
- WRONG_PARAM_COUNT;
- }
-
- FETCH_GMP_ZVAL(gmpnum_a, a_arg);
-
- if(Z_TYPE_PP(b_arg) == IS_LONG) {
- use_si=1;
- } else {
- FETCH_GMP_ZVAL(gmpnum_b, b_arg);
- }
-
- if(use_si) {
- res = mpz_cmp_si(*gmpnum_a, Z_LVAL_PP(b_arg));
- } else {
- res = mpz_cmp(*gmpnum_a, *gmpnum_b);
- }
-
- RETURN_LONG(res);
-}
-/* }}} */
-
-/* {{{ proto int gmp_sign(resource a)
- Gets the sign of the number */
-ZEND_FUNCTION(gmp_sign)
-{
- zval **a_arg;
- mpz_t *gmpnum_a;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &a_arg) == FAILURE){
- WRONG_PARAM_COUNT;
- }
-
- FETCH_GMP_ZVAL(gmpnum_a, a_arg);
-
- RETURN_LONG(mpz_sgn(*gmpnum_a));
-}
-/* }}} */
-
-/* {{{ proto resource gmp_random([int limiter])
- Gets random number */
-ZEND_FUNCTION(gmp_random)
-{
- zval **limiter_arg;
- int limiter, argc;
- mpz_t *gmpnum_result;
-
- argc = ZEND_NUM_ARGS();
-
- if (argc < 0 || argc > 1 || zend_get_parameters_ex(1, &limiter_arg) == FAILURE){
- WRONG_PARAM_COUNT;
- }
-
- if(argc) {
- convert_to_long_ex(limiter_arg);
- limiter = Z_LVAL_PP(limiter_arg);
- } else {
- limiter = 20;
- }
-
- INIT_GMP_NUM(gmpnum_result);
- mpz_random(*gmpnum_result, limiter);
-
- ZEND_REGISTER_RESOURCE(return_value, gmpnum_result, le_gmp);
-}
-/* }}} */
-
-/* {{{ proto resource gmp_and(resource a, resource b)
- Calculates logical AND of a and b */
-ZEND_FUNCTION(gmp_and)
-{
- gmp_binary_op(mpz_and);
-}
-/* }}} */
-
-/* {{{ proto resource gmp_or(resource a, resource b)
- Calculates logical OR of a and b */
-ZEND_FUNCTION(gmp_or)
-{
- gmp_binary_op(mpz_ior);
-}
-/* }}} */
-
-/* {{{ proto resource gmp_com(resource a)
- Calculates one's complement of a */
-ZEND_FUNCTION(gmp_com)
-{
- gmp_unary_op(mpz_com);
-}
-/* }}} */
-
-/* {{{ proto resource gmp_xor(resource a, resource b)
- Calculates logical exclusive OR of a and b */
-ZEND_FUNCTION(gmp_xor)
-{
- /* use formula: a^b = (a|b)&^(a&b) */
- zval **a_arg, **b_arg;
- mpz_t *gmpnum_a, *gmpnum_b, *gmpnum_result, *gmpnum_t;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &a_arg, &b_arg) == FAILURE){
- WRONG_PARAM_COUNT;
- }
-
- FETCH_GMP_ZVAL(gmpnum_a, a_arg);
- FETCH_GMP_ZVAL(gmpnum_b, b_arg);
-
- INIT_GMP_NUM(gmpnum_result);
- INIT_GMP_NUM(gmpnum_t);
-
- mpz_and(*gmpnum_t, *gmpnum_a, *gmpnum_b);
- mpz_com(*gmpnum_t, *gmpnum_t);
-
- mpz_ior(*gmpnum_result, *gmpnum_a, *gmpnum_b);
- mpz_and(*gmpnum_result, *gmpnum_result, *gmpnum_t);
-
- FREE_GMP_NUM(gmpnum_t);
-
- ZEND_REGISTER_RESOURCE(return_value, gmpnum_result, le_gmp);
-}
-/* }}} */
-
-/* {{{ proto void gmp_setbit(resource &a, int index[, bool set_clear])
- Sets or clear bit in a */
-ZEND_FUNCTION(gmp_setbit)
-{
- zval **a_arg, **ind_arg, **sc_arg;
- int argc, index, set;
- mpz_t *gmpnum_a;
-
- argc = ZEND_NUM_ARGS();
- if (argc < 2 || argc > 3 || zend_get_parameters_ex(argc, &a_arg, &ind_arg, &sc_arg) == FAILURE){
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(gmpnum_a, mpz_t *, a_arg, -1, GMP_RESOURCE_NAME, le_gmp);
-
- convert_to_long_ex(ind_arg);
- index = Z_LVAL_PP(ind_arg);
-
- switch (argc) {
- case 3:
- convert_to_long_ex(sc_arg);
- set = Z_LVAL_PP(sc_arg);
- break;
- case 2:
- set = 1;
- break;
- }
-
- if(set) {
- mpz_setbit(*gmpnum_a, index);
- } else {
- mpz_clrbit(*gmpnum_a, index);
- }
-}
-/* }}} */
-
-/* {{{ proto void gmp_clrbit(resource &a, int index)
- Clears bit in a */
-ZEND_FUNCTION(gmp_clrbit)
-{
- zval **a_arg, **ind_arg;
- int index;
- mpz_t *gmpnum_a;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &a_arg, &ind_arg) == FAILURE){
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(gmpnum_a, mpz_t *, a_arg, -1, GMP_RESOURCE_NAME, le_gmp);
-
- convert_to_long_ex(ind_arg);
- index = Z_LVAL_PP(ind_arg);
-
- mpz_clrbit(*gmpnum_a, index);
-}
-/* }}} */
-
-/* {{{ proto int gmp_popcount(resource a)
- Calculates the population count of a */
-ZEND_FUNCTION(gmp_popcount)
-{
- zval **a_arg;
- mpz_t *gmpnum_a;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &a_arg) == FAILURE){
- WRONG_PARAM_COUNT;
- }
-
- FETCH_GMP_ZVAL(gmpnum_a, a_arg);
-
- RETURN_LONG(mpz_popcount(*gmpnum_a));
-}
-/* }}} */
-
-/* {{{ proto int gmp_hamdist(resource a, resource b)
- Calculates hamming distance between a and b */
-ZEND_FUNCTION(gmp_hamdist)
-{
- zval **a_arg, **b_arg;
- mpz_t *gmpnum_a, *gmpnum_b;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(1, &a_arg, &b_arg) == FAILURE){
- WRONG_PARAM_COUNT;
- }
-
- FETCH_GMP_ZVAL(gmpnum_a, a_arg);
- FETCH_GMP_ZVAL(gmpnum_b, b_arg);
-
- RETURN_LONG(mpz_hamdist(*gmpnum_a, *gmpnum_b));
-}
-/* }}} */
-
-/* {{{ proto int gmp_scan0(resource a, int start)
- Finds first zero bit */
-ZEND_FUNCTION(gmp_scan0)
-{
- zval **a_arg, **start_arg;
- mpz_t *gmpnum_a;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &a_arg, &start_arg) == FAILURE){
- WRONG_PARAM_COUNT;
- }
-
- FETCH_GMP_ZVAL(gmpnum_a, a_arg);
- convert_to_long_ex(start_arg);
-
- RETURN_LONG(mpz_scan0(*gmpnum_a, Z_LVAL_PP(start_arg)));
-}
-/* }}} */
-
-/* {{{ proto int gmp_scan1(resource a, int start)
- Finds first non-zero bit */
-ZEND_FUNCTION(gmp_scan1)
-{
- zval **a_arg, **start_arg;
- mpz_t *gmpnum_a;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &a_arg, &start_arg) == FAILURE){
- WRONG_PARAM_COUNT;
- }
-
- FETCH_GMP_ZVAL(gmpnum_a, a_arg);
- convert_to_long_ex(start_arg);
-
- RETURN_LONG(mpz_scan1(*gmpnum_a, Z_LVAL_PP(start_arg)));
-}
-/* }}} */
-
-/* {{{ _php_gmpnum_free
- */
-static void _php_gmpnum_free(zend_rsrc_list_entry *rsrc)
-{
- mpz_t *gmpnum = (mpz_t *)rsrc->ptr;
- FREE_GMP_NUM(gmpnum);
-}
-/* }}} */
-
-#endif /* HAVE_GMP */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/gmp/php_gmp.h b/ext/gmp/php_gmp.h
deleted file mode 100644
index 8124dbf768..0000000000
--- a/ext/gmp/php_gmp.h
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Stanislav Malyshev <stas@php.net> |
- +----------------------------------------------------------------------+
- */
-
-#ifndef PHP_GMP_H
-#define PHP_GMP_H
-
-/* You should tweak config.m4 so this symbol (or some else suitable)
- gets defined.
-*/
-#if HAVE_GMP
-
-extern zend_module_entry gmp_module_entry;
-#define phpext_gmp_ptr &gmp_module_entry
-
-#ifdef ZEND_WIN32
-#define GMP_API __declspec(dllexport)
-#else
-#define GMP_API
-#endif
-
-ZEND_MINIT_FUNCTION(gmp);
-ZEND_MSHUTDOWN_FUNCTION(gmp);
-ZEND_MINFO_FUNCTION(gmp);
-
-ZEND_FUNCTION(gmp_init);
-ZEND_FUNCTION(gmp_intval);
-ZEND_FUNCTION(gmp_strval);
-ZEND_FUNCTION(gmp_add);
-ZEND_FUNCTION(gmp_sub);
-ZEND_FUNCTION(gmp_mul);
-ZEND_FUNCTION(gmp_div_qr);
-ZEND_FUNCTION(gmp_div_q);
-ZEND_FUNCTION(gmp_div_r);
-ZEND_FUNCTION(gmp_mod);
-ZEND_FUNCTION(gmp_divexact);
-ZEND_FUNCTION(gmp_neg);
-ZEND_FUNCTION(gmp_abs);
-ZEND_FUNCTION(gmp_fact);
-ZEND_FUNCTION(gmp_sqrt);
-ZEND_FUNCTION(gmp_pow);
-ZEND_FUNCTION(gmp_powm);
-ZEND_FUNCTION(gmp_sqrtrem);
-ZEND_FUNCTION(gmp_perfect_square);
-ZEND_FUNCTION(gmp_prob_prime);
-ZEND_FUNCTION(gmp_gcd);
-ZEND_FUNCTION(gmp_gcdext);
-ZEND_FUNCTION(gmp_invert);
-ZEND_FUNCTION(gmp_jacobi);
-ZEND_FUNCTION(gmp_legendre);
-ZEND_FUNCTION(gmp_cmp);
-ZEND_FUNCTION(gmp_sign);
-ZEND_FUNCTION(gmp_and);
-ZEND_FUNCTION(gmp_or);
-ZEND_FUNCTION(gmp_com);
-ZEND_FUNCTION(gmp_xor);
-ZEND_FUNCTION(gmp_random);
-ZEND_FUNCTION(gmp_setbit);
-ZEND_FUNCTION(gmp_clrbit);
-ZEND_FUNCTION(gmp_scan0);
-ZEND_FUNCTION(gmp_scan1);
-ZEND_FUNCTION(gmp_popcount);
-ZEND_FUNCTION(gmp_hamdist);
-
-/*
- Declare any global variables you may need between the BEGIN
- and END macros here:
-
-ZEND_BEGIN_MODULE_GLOBALS(gmp)
- int global_variable;
-ZEND_END_MODULE_GLOBALS(gmp)
-*/
-
-/* In every function that needs to use variables in php_gmp_globals,
- do call GMPLS_FETCH(); after declaring other variables used by
- that function, and always refer to them as GMPG(variable).
- You are encouraged to rename these macros something shorter, see
- examples in any other php module directory.
-*/
-
-#ifdef ZTS
-#define GMPG(v) (gmp_globals->v)
-#define GMPLS_FETCH() php_gmp_globals *gmp_globals = ts_resource(gmp_globals_id)
-#else
-#define GMPG(v) (gmp_globals.v)
-#define GMPLS_FETCH()
-#endif
-
-#else
-
-#define phpext_gmp_ptr NULL
-
-#endif
-
-#endif /* PHP_GMP_H */
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/gmp/tests/001.phpt b/ext/gmp/tests/001.phpt
deleted file mode 100644
index a2f520d527..0000000000
--- a/ext/gmp/tests/001.phpt
+++ /dev/null
@@ -1,23 +0,0 @@
---TEST--
-Check for gmp presence
---SKIPIF--
-<?php if (!extension_loaded("gmp")) print "skip"; ?>
---POST--
---GET--
---FILE--
-<?php
-echo "gmp extension is available";
-/*
- you can add regression tests for your extension here
-
- the output of your test code has to be equal to the
- text in the --EXPECT-- section below for the tests
- to pass, differences between the output and the
- expected text are interpreted as failure
-
- see php4/tests/README for further information on
- writing regression tests
-*/
-?>
---EXPECT--
-gmp extension is available \ No newline at end of file
diff --git a/ext/gmp/tests/002.phpt b/ext/gmp/tests/002.phpt
deleted file mode 100644
index 2f32450474..0000000000
--- a/ext/gmp/tests/002.phpt
+++ /dev/null
@@ -1,19 +0,0 @@
---TEST--
-GMP functionality test - factorial
---SKIPIF--
-<?php if (!extension_loaded("gmp")) print "skip"; ?>
---POST--
---GET--
---FILE--
-<?
-function fact($x) {
- if($x <= 1)
- return 1;
- else
- return gmp_mul($x,fact($x-1));
-}
-
-print gmp_strval(fact(1000))."\n";
-?>
---EXPECT--
-402387260077093773543702433923003985719374864210714632543799910429938512398629020592044208486969404800479988610197196058631666872994808558901323829669944590997424504087073759918823627727188732519779505950995276120874975462497043601418278094646496291056393887437886487337119181045825783647849977012476632889835955735432513185323958463075557409114262417474349347553428646576611667797396668820291207379143853719588249808126867838374559731746136085379534524221586593201928090878297308431392844403281231558611036976801357304216168747609675871348312025478589320767169132448426236131412508780208000261683151027341827977704784635868170164365024153691398281264810213092761244896359928705114964975419909342221566832572080821333186116811553615836546984046708975602900950537616475847728421889679646244945160765353408198901385442487984959953319101723355556602139450399736280750137837615307127761926849034352625200015888535147331611702103968175921510907788019393178114194545257223865541461062892187960223838971476088506276862967146674697562911234082439208160153780889893964518263243671616762179168909779911903754031274622289988005195444414282012187361745992642956581746628302955570299024324153181617210465832036786906117260158783520751516284225540265170483304226143974286933061690897968482590125458327168226458066526769958652682272807075781391858178889652208164348344825993266043367660176999612831860788386150279465955131156552036093988180612138558600301435694527224206344631797460594682573103790084024432438465657245014402821885252470935190620929023136493273497565513958720559654228749774011413346962715422845862377387538230483865688976461927383814900140767310446640259899490222221765904339901886018566526485061799702356193897017860040811889729918311021171229845901641921068884387121855646124960798722908519296819372388642614839657382291123125024186649353143970137428531926649875337218940694281434118520158014123344828015051399694290153483077644569099073152433278288269864602789864321139083506217095002597389863554277196742822248757586765752344220207573630569498825087968928162753848863396909959826280956121450994871701244516461260379029309120889086942028510640182154399457156805941872748998094254742173582401063677404595741785160829230135358081840096996372524230560855903700624271243416909004153690105933983835777939410970027753472000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
diff --git a/ext/hyperwave/CREDITS b/ext/hyperwave/CREDITS
deleted file mode 100644
index b01b16907f..0000000000
--- a/ext/hyperwave/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-HyperWave
-Uwe Steinmann
diff --git a/ext/hyperwave/Makefile.in b/ext/hyperwave/Makefile.in
deleted file mode 100644
index b66d82cfda..0000000000
--- a/ext/hyperwave/Makefile.in
+++ /dev/null
@@ -1,5 +0,0 @@
-
-LTLIBRARY_NAME = libhyperwave.la
-LTLIBRARY_SOURCES = hw.c hg_comm.c
-
-include $(top_srcdir)/build/dynlib.mk
diff --git a/ext/hyperwave/config.m4 b/ext/hyperwave/config.m4
deleted file mode 100644
index 2044a162f2..0000000000
--- a/ext/hyperwave/config.m4
+++ /dev/null
@@ -1,18 +0,0 @@
-dnl $Id$
-
-AC_MSG_CHECKING(for Hyperwave support)
-AC_ARG_WITH(hyperwave,
-[ --with-hyperwave Include Hyperwave support],
-[
- if test "$withval" != "no"; then
- AC_DEFINE(HYPERWAVE,1,[ ])
- AC_MSG_RESULT(yes)
- PHP_EXTENSION(hyperwave)
- else
- AC_DEFINE(HYPERWAVE,0,[ ])
- AC_MSG_RESULT(no)
- fi
-],[
- AC_DEFINE(HYPERWAVE,0,[ ])
- AC_MSG_RESULT(no)
-])
diff --git a/ext/hyperwave/debug.h b/ext/hyperwave/debug.h
deleted file mode 100644
index b596cbf522..0000000000
--- a/ext/hyperwave/debug.h
+++ /dev/null
@@ -1,197 +0,0 @@
-/****************************************************************************
-*
-* Copyright (C) 1991 Kendall Bennett.
-* All rights reserved.
-*
-* Filename: $RCSfile$
-* Version: $Revision$
-*
-* Language: ANSI C
-* Environment: any
-*
-* Description: General header file for portable code.
-*
-* $Id$
-*
-* Revision History:
-* -----------------
-*
-* $Log$
-* Revision 1.1 1999/04/21 23:37:47 ssb
-* moved db
-*
-* Revision 1.1.1.1 1999/04/07 21:03:29 zeev
-* PHP 4.0
-*
-* Revision 1.1.1.1 1999/03/17 04:29:10 andi
-* PHP4
-*
-* Revision 1.1.1.1 1998/12/21 07:56:22 andi
-* Trying to start the zend CVS tree
-*
-* Revision 1.1 1998/08/12 09:29:16 steinm
-* First version of Hyperwave module.
-*
-* Revision 1.6 92/03/15 12:51:48 kjb
-* Added MK_FP macro and ushort typedef.
-*
-* Revision 1.5 91/10/28 03:17:33 kjb
-* Ported to the Iris.
-*
-* Revision 1.4 91/09/26 15:29:02 kjb
-* Added stuff for the SGI Iris 4D.
-*
-* Revision 1.3 91/09/26 10:07:04 kjb
-* Added general typedef stuff.
-*
-* Revision 1.2 91/09/03 18:19:14 ROOT_DOS
-* Added a few defines that are supplied by <dir.h> for UNIX compatibility.
-*
-* Revision 1.1 91/08/16 13:19:06 ROOT_DOS
-* Initial revision
-*
-****************************************************************************/
-
-#ifndef DEBUG_H
-#define DEBUG_H
-
-#ifdef DEBUG
-# define D(x) x
-#else
-# define D(x)
-#endif
-
-#define PRIVATE static
-#define PUBLIC
-
-#ifdef __MSDOS__ /* Compiling for MSDOS */
-# define MS(x) x
-# define UX(x)
-# define IR(x)
-# define _8086 /* We know we have an 8086 type processor */
-#if defined(__COMPACT__) || defined(__LARGE__) || defined(__HUGE__)
-# define LDATA
-# define NULL 0L
-#else
-# define NULL 0
-#endif
-#else __MSDOS__
-#ifdef __IRIS4D__ /* Compiling for the SGI Iris 4D */
-# define MS(x)
-# define UX(x) x /* The Iris is a UNIX machine */
-# define IR(x) x
-# define O_BINARY 0 /* no binary input mode in UNIX open() */
-# define MAXFILE 255 /* These are defined in <dir.h>, but */
-# define MAXDIR 255 /* on UNIX machines, we just define */
-# define MAXPATH 255 /* them all to be the same size */
-# define far /* Near and far do not exist under */
-# define near /* UNIX or the Iris. */
-# define NULL ((void *)0)
-#else __IRIS4D__ /* Assume UNIX compilation */
-# define MS(x)
-# define UX(x) x
-# define IR(x)
-# define O_BINARY 0 /* no binary input mode in UNIX open() */
-# define MAXFILE 255 /* These are defined in <dir.h>, but */
-# define MAXDIR 255 /* on UNIX machines, we just define */
-# define MAXPATH 255 /* them all to be the same size */
-# define far /* Near and far do not exist under */
-# define near /* UNIX or the Iris. */
-# ifndef NULL
-# define NULL ((void *)0)
-# endif
-#endif __IRIS4D__
-#endif __MSDOS__
-
-/****************************************************************************
-*
-* SEG(p) Evaluates to the segment portion of an 8086 address.
-* OFF(p) Evaluates to the offset portion of an 8086 address.
-* FP(s,o) Creates a far pointer given a segment offset pair.
-* PHYS(p) Evaluates to a long holding a physical address
-*
-****************************************************************************/
-
-#ifdef _8086
-# define SEG(p) ( ((unsigned *)&(void far *)(p))[1] )
-# define OFF(p) ( (unsigned)(p) )
-# define FP(s,o) ( (void far *)( ((unsigned long)s << 16) + \
- (unsigned long)o ))
-# define PHYS(p) ( (unsigned long)OFF(p) + \
- ((unsigned long)SEG(p) << 4))
-#else
-# define PHYS(p) (p)
-#endif _8086
-
-/****************************************************************************
-*
-* NUMELE(array) Evaluates to the array size in elements
-* LASTELE(array) Evaluates to a pointer to the last element
-* INBOUNDS(array,p) Evaluates to true if p points into the array
-* RANGE(a,b,c) Evaluates to true if a <= b <= c
-* max(a,b) Evaluates to a or b, whichever is larger
-* min(a,b) Evaluates to a or b, whichever is smaller
-* ABS(a) Evaluates to the absolute value of a
-* NBITS(type) Returns the number of bits in a variable of the
-* indicated type
-* MAXINT Evaluates to the value of the largest signed integer
-*
-****************************************************************************/
-
-#define NUMELE(a) (sizeof(a)/sizeof(*(a)))
-#define LASTELE(a) ((a) + (NUMELE(a)-1))
-#ifdef LDATA
-#define TOOHIGH(a,p) ((long)PHYS(p) - (long)PHYS(a) > (long)(NUMELE(a)-1))
-#define TOOLOW(a,p) ((long)PHYS(p) - (long)PHYS(a) < 0)
-#else
-#define TOOHIGH(a,p) ((long)(p) - (long)(a) > (long)(NUMELE(a)-1))
-#define TOOLOW(a,p) ((long)(p) - (long)(a) < 0)
-#endif
-#define INBOUNDS(a,p) ( ! (TOOHIGH(a,p) || TOOLOW(a,p)) )
-
-#define _IS(t,x) (((t)1 << (x)) != 0) /* Evaluates true if the width of */
- /* variable of type t is < x. */
- /* The != 0 assures that the */
- /* answer is 1 or 0 */
-
-#define NBITS(t) (4 * (1 + _IS(t,4) + _IS(t,8) + _IS(t,12) + _IS(t,16) \
- + _IS(t,20) + _IS(t,24) + _IS(t,28) + _IS(t,32)))
-
-#define MAXINT (((unsigned)~0) >> 1)
-
-#ifndef MAX
-# define MAX(a,b) ( ((a) > (b)) ? (a) : (b))
-#endif
-#ifndef MIN
-# define MIN(a,b) ( ((a) < (b)) ? (a) : (b))
-#endif
-#ifndef ABS
-# define ABS(a) ((a) >= 0 ? (a) : -(a))
-#endif
-
-#define RANGE(a,b,c) ( (a) <= (b) && (b) <= (c) )
-
-/* General typedefs */
-
-#ifndef __GENDEFS
-#define __GENDEFS
-typedef void *ptr;
-typedef void near *nearptr;
-typedef void far *farptr;
-/*typedef unsigned char uchar;
-typedef unsigned short ushort;
-typedef unsigned int uint;
-typedef unsigned long ulong;*/
-typedef int bool;
-#endif __GENDEFS
-
-/* Boolean truth values */
-
-#define false 0
-#define true 1
-#define FALSE 0
-#define TRUE 1
-#define NO 0
-#define YES 1
-
-#endif /* DEBUG_H */
diff --git a/ext/hyperwave/hg_comm.c b/ext/hyperwave/hg_comm.c
deleted file mode 100644
index aca2956253..0000000000
--- a/ext/hyperwave/hg_comm.c
+++ /dev/null
@@ -1,5845 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Uwe Steinmann |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-/* #define HW_DEBUG */
-
-#include <stdlib.h>
-#include "php.h"
-#include "php_globals.h"
-#include "SAPI.h"
-
-#if HYPERWAVE
-
-#include <stdio.h>
-#include <string.h>
-#include <sys/types.h>
-#ifdef PHP_WIN32
-# include <winsock.h>
-# define EWOULDBLOCK WSAEWOULDBLOCK
-# define ETIMEDOUT WSAETIMEDOUT
-# define bcopy memcpy
-# define bzero(a,b) memset(a,0,b)
-#else
-# include <sys/socket.h>
-# include <netinet/in.h>
-# include <netdb.h>
-# include <unistd.h>
-# include <sys/param.h>
-#endif
-#include <fcntl.h>
-#include <errno.h>
-#include "hg_comm.h"
-#include "ext/standard/head.h"
-
-/* Defining hw_optimize does optimize the send_objectbyidquery() function.
- Instead of getting the complete return message including the objectrecords
- with recv_hg_msg(), only the header of the return message is fetched.
- The object records itself are fetched as they are needed straight from
- the socket. This method requires less memory and is twice as fast because
- reading from the net seems to be a bottleneck which has less impact if
- the processing of the data is done in parallel.
-*/
-#define hw_optimize
-
-/* Define hw_less_server_stress does reduce the stress on the hw server, by
- using send_objectbyidquery() instead of send_getobject() multiple times.
- send_objectbyidquery() gets a bunch of object records with one message.
- This also reduced the number of lines in the servers log files.
- Unfortunately this is not faster unless hw_optimize is defined, because
- getting object records with multiple send_getobject() is already optimized.
- First all request messages for each object are send and the the answers
- are read. This gives the server the possibility to answer request already
- while more request are comming in.
-*/
-#define hw_less_server_stress
-
-static int set_nonblocking(int fd);
-/* static int set_blocking(int fd); */
-
-static int hg_read_exact(int sockfd, char *buf, int size);
-/* static int hg_read(int sockfd, char *buf, int size); */
-static int hg_write(int sockfd, char *buf, int size);
-
-static int send_hg_msg(int sockfd, hg_msg *msg, int length);
-static void build_msg_header(hg_msg *msg, int length, int version_msgid, int msg_type);
-static char *build_msg_int(char *buf, int val);
-static char *build_msg_str(char *buf, char *str);
-static int swap(int val);
-
-
-int version = HW_VERSION;
-/* F_DISTRIBUTED has the effect that all object ids are
- virtual. This means whenever an object is requested a
- new id is generated for this session. Wavemaster and
- Harmony set this flag. How do I know? tcpdump tells
- a lot if the output is investigated. The bit is also
- need to allow access on other server through the local
- server. The hw_mapid() function won't work unless you
- set F_DISTRIBUTED */
-/* int version = HW_VERSION | F_DISTRIBUTED; */
-/* int version = HW_VERSION | F_DISTRIBUTED | F_COMPRESSED; */
-static int msgid = 1;
-static int sock_flags = -1;
-static int non_blocking = 0;
-static int swap_on = 0;
-static int rtimeout = 40;
-static int wtimeout = 40;
-static int lowerror = 0;
-
-/***********************************************************************
-* Function fnInsStr() *
-* *
-* Insert string in string at position. The old string will be freed *
-* with efree!!! The new string is allocated with malloc. *
-* Parameter: string *str: string in which insstr is to be inserted *
-* int pos: Position where string is to inserted (0=first) *
-* string *insstr: string to be inserted *
-* Return: pointer to new string or NULL. If NULL is returned the *
-* memory for the old string has not been freed. *
-***********************************************************************/
-char *fnInsStr(char *str, int pos, char *insstr)
-{
- char *newstr, *ptr;
-
- if((str == NULL) || (insstr == NULL))
- return NULL;
- if(pos > (int)strlen(str))
- return NULL;
-
- if(insstr[0] == '\0')
- return str;
-
- if(NULL == (newstr = malloc(strlen(str) + strlen(insstr) + 1))) {
- lowerror = LE_MALLOC;
- return NULL;
- }
-
- ptr = newstr;
- memcpy(newstr, str, pos);
- ptr += pos;
- strcpy(ptr, insstr);
- ptr += strlen(insstr);
- strcpy(ptr, str+pos);
-
- free(str);
- return newstr;
-}
-
-/***********************************************************************
-* Function fnAddAnchor() *
-* *
-* Inserts new anchor into anchor list. *
-* Parameter: DLIST pList: Anchor list *
-* int objectID: object ID of Anchor *
-* int start: start position *
-* int end: end position *
-* Return: Pointer to new anchor, NULL if error *
-***********************************************************************/
-#ifdef newlist
-ANCHOR *fnAddAnchor(zend_llist *pAnchorList,
- int objectID,
- int start, int end)
-#else
-ANCHOR *fnAddAnchor(DLIST *pAnchorList,
- int objectID,
- int start, int end)
-#endif
-{
- ANCHOR *cur_ptr;
-
-#ifdef newlist
- ANCHOR **ptr;
- if(NULL == (cur_ptr = (ANCHOR *) emalloc(sizeof(ANCHOR))))
- return NULL;
-#else
- if((cur_ptr = (ANCHOR *) dlst_newnode(sizeof(ANCHOR))) == NULL) {
- return NULL;
- }
-#endif
-
- memset(cur_ptr, 0, sizeof(ANCHOR));
- cur_ptr->start = start;
- cur_ptr->end = end;
- cur_ptr->id = objectID;
- cur_ptr->destdocname = NULL;
- cur_ptr->nameanchor = NULL;
- cur_ptr->link = NULL;
- cur_ptr->tagattr = NULL;
- cur_ptr->htmlattr = NULL;
- cur_ptr->codebase = NULL;
- cur_ptr->code = NULL;
- cur_ptr->keyword = NULL;
- cur_ptr->fragment = NULL;
-
-#ifdef newlist
- zend_llist_prepend_element(pAnchorList, &cur_ptr);
- ptr = (ANCHOR **) zend_llist_get_first(pAnchorList);
-#else
- dlst_insertafter(pAnchorList, cur_ptr, PHP_DLST_HEAD(pAnchorList));
-#endif
-
- return(cur_ptr);
-}
-
-/***********************************************************************
-* Function fnDeleteAnchor() *
-* *
-* Inserts new anchor into anchor list. *
-* Parameter: ptr: pointer to node *
-* Return: void *
-***********************************************************************/
-#ifdef newlist
-void fnDeleteAnchor(void *ptr1)
-#else
-void fnDeleteAnchor(ANCHOR *ptr)
-#endif
-{
-#ifdef newlist
- ANCHOR **ptr2, *ptr;
- ptr2 = (ANCHOR **) ptr1;
- ptr = *ptr2;
-#endif
-
- if(ptr->destdocname) efree(ptr->destdocname);
- if(ptr->nameanchor) efree(ptr->nameanchor);
- if(ptr->link) efree(ptr->link);
- if(ptr->tagattr) efree(ptr->tagattr);
- if(ptr->htmlattr) efree(ptr->htmlattr);
- if(ptr->codebase) efree(ptr->codebase);
- if(ptr->code) efree(ptr->code);
- if(ptr->keyword) efree(ptr->keyword);
- if(ptr->fragment) efree(ptr->fragment);
-
-#ifdef newlist
- efree(ptr);
-#else
- dlst_freenode(ptr);
-#endif
-}
-
-/***********************************************************************
-* Function fnListAnchor() *
-* *
-* Lists all anchors in anchor list. *
-* Parameter: ptr: pointer to list *
-* Return: void *
-***********************************************************************/
-#ifdef newlist
-void fnListAnchor(zend_llist *pAnchorList)
-#else
-void fnListAnchor(DLIST *pAnchorList)
-#endif
-{
-#ifdef newlist
- ANCHOR *cur_ptr, **ptr;
- ptr = (ANCHOR **) zend_llist_get_last(pAnchorList);
- if(ptr)
- cur_ptr = *ptr;
- while(ptr) {
- fprintf(stderr, "0x%X->0x%X ", (int) ptr, (int) cur_ptr);
-#else
- ANCHOR *cur_ptr;
- cur_ptr = (ANCHOR *) dlst_last(pAnchorList);
- while(cur_ptr) {
- fprintf(stderr, "0x%X ", (int) cur_ptr);
-#endif
-
- fprintf(stderr, "%d, %d, %s, %s, %s, %s %s\n", cur_ptr->start,
- cur_ptr->end,
- cur_ptr->tanchor == 1 ? "src" : "dest",
- cur_ptr->destdocname,
- cur_ptr->nameanchor,
- cur_ptr->link,
- cur_ptr->tagattr);
-#ifdef newlist
- ptr = (ANCHOR **) zend_llist_get_prev(pAnchorList);
- if(ptr)
- cur_ptr = *ptr;
-#else
- cur_ptr = (ANCHOR *) dlst_prev(cur_ptr);
-#endif
- }
-}
-
-/***********************************************************************
-* Function fnCmpAnchors() *
-* *
-* Compares to Anchors by its start position *
-* Parameter: ANCHOR a1: First Anchor *
-* ANCHOR a2: Second Anchor *
-* Return: As strcmp *
-***********************************************************************/
-#ifdef newlist
-int fnCmpAnchors(const void *e1, const void *e2)
-{
- ANCHOR *a1, **aa1, *a2, **aa2;
- zend_llist_element **ee1, **ee2;
- ee1 = (zend_llist_element **) e1;
- ee2 = (zend_llist_element **) e2;
- aa1 = (ANCHOR **) (*ee1)->data;
- aa2 = (ANCHOR **) (*ee2)->data;
- a1 = *aa1;
- a2 = *aa2;
-#else
-int fnCmpAnchors(ANCHOR *a1, ANCHOR *a2)
-{
-#endif
- if(a1->start < a2->start)
- return -1;
- if(a1->start == a2->start) {
- /* It's importent to check this case as well, because a link with
- a bigger end has to be inserted first.
- */
- if(a1->end < a2->end)
- return -1;
- /* If both start and end are equal (yes, it is possible)
- we will Src Anchor before a Dest anchor. There has been
- a case where an IMG was surrounded by a NAME which was
- surrounded by a HREF. In such a case the HREF doesn't
- work.
- */
- if(a1->end == a2->end) {
- if(a1->tanchor > a2->tanchor)
- return -1;
- }
- }
-
- return 1;
-}
-
-/***********************************************************************
-* Function fnCreateAnchorList() *
-* Uses either docofanchorrec or reldestrec to create a list of anchors *
-* depending on anchormode *
-* *
-* Returns a list of Anchors converted from an object record *
-* Parameter: int objectID: the object for which the list is created *
-* char **anchors: object records of anchors *
-* char **docofanchorrec: Name of destination absolut *
-* char **reldestrec: Name of destination relativ to current *
-* object *
-* int ancount: number of anchors *
-* int anchormode: 0 = use absolut dest, else rel. dest *
-* Return: List of Anchors, NULL if error *
-***********************************************************************/
-#ifdef newlist
-zend_llist *fnCreateAnchorList(hw_objectID objID, char **anchors, char **docofanchorrec, char **reldestrec, int ancount, int anchormode)
-#else
-DLIST *fnCreateAnchorList(hw_objectID objID, char **anchors, char **docofanchorrec, char **reldestrec, int ancount, int anchormode)
-#endif
-{
- int start, end, i, destid, anchordestid, objectID;
- ANCHOR *cur_ptr = NULL;
-#ifdef newlist
- zend_llist *pAnchorList;
- pAnchorList = (zend_llist *) emalloc(sizeof(zend_llist));
- zend_llist_init(pAnchorList, sizeof(char *), fnDeleteAnchor, 0);
-#else
- DLIST *pAnchorList = dlst_init();
-#endif
-
- for(i=ancount-1; i>=0; i--) {
- char *object = NULL;
- char *docofanchorptr = NULL;
- char *reldestptr = NULL;
- char *str, *str1, link[200];
-
- if(NULL != anchors[i]) {
- object = anchors[i];
- docofanchorptr = docofanchorrec[i];
- if(reldestrec) /* FIXME reldestrec may only be NULL if anchormode != 0 */
- reldestptr = reldestrec[i];
-
- /* Determine Position. Doesn't matter if Src or Dest
- The Position field should always be there. Though there
- are case in which the position has no meaning, e.g. if
- a document is annotated and the annotation text doesn't
- contain a link of type annotation,
- In such a case the Position has the value 'invisible' */
- str = strstr(object, "Position");
- str += 9;
- if(((int) str != 9) && (0 != strncmp(str, "invisible", 9))) {
- sscanf(str, "0x%X 0x%X", &start, &end);
-
- /* Determine ObjectID */
- objectID = 0;
- if(NULL != (str = strstr(object, "ObjectID"))) {
- str += 9;
- sscanf(str, "0x%X", &objectID);
- }
-
- cur_ptr = fnAddAnchor(pAnchorList, objectID, start, end);
-
- /* Determine Type of Anchor */
- str = strstr(object, "TAnchor");
- str += 8;
- if(*str == 'S') {
- char destdocname[200];
- char nameanchor[200];
- cur_ptr->tanchor = 1;
-
- cur_ptr->destdocname = NULL;
- if(NULL != (str = strstr(object, "Dest"))) {
- char *tempptr;
-
- /* No need to care about the value of Dest, because we take the info
- from docofanchorptr.
- Since the anchor has a destination there are two possibilities.
- 1. The destination is an anchor or
- 2. or the destination is a document already.
- In both cases docofanchorptr has the proper info because GETDOCBYANCHOR
- is such a nice message.
- */
- switch(anchormode) {
- case 0:
- tempptr = docofanchorptr;
- break;
- default:
- tempptr = reldestptr;
- }
- if(NULL != tempptr) {
- destid = 0;
- if(NULL != (str = strstr(tempptr, "ObjectID="))) {
- str += 9;
- sscanf(str, "0x%X", &destid);
- }
- /* This is basically for NAME tags. There is no need
- to add the destname if it is the document itself.
- */
-/* if(destid == objID) {
- cur_ptr->destdocname = NULL;
- } else { */
- /* It's always nice to deal with names, so let's first check
- for a name. If there is none we take the ObjectID.
- */
- if(NULL != (str = strstr(tempptr, "Name="))) {
- str += 5;
- } else if(NULL != (str = strstr(tempptr, "ObjectID="))) {
- str += 9;
- }
- if(sscanf(str, "%s\n", destdocname)) {
- cur_ptr->destdocname = estrdup(destdocname);
- }
-/* } */
- }
- }
-
- /* Get the Id of the anchor destination and the document id that belongs
- to that anchor. We need that soon in order to determine if the anchor
- points to a document or a dest anchor in a document.
- */
- anchordestid = 0;
- if(NULL != (str = strstr(object, "Dest="))) {
- str += 5;
- sscanf(str, "0x%X", &anchordestid);
- }
-
- /* if anchordestid != destid then the destination is an anchor in a document whose
- name (objectID) is already in destdocname. We will have to extend the link
- by '#...'
- */
- cur_ptr->nameanchor = NULL;
- if(anchordestid != destid) {
- if(NULL != (str = strstr(object, "Dest="))) {
- str += 5;
- if(sscanf(str, "%s\n", nameanchor))
- cur_ptr->nameanchor = estrdup(nameanchor);
- }
- }
-
- if(!cur_ptr->destdocname) {
- cur_ptr->link = NULL;
- if(NULL != (str = strstr(object, "Hint=URL:"))) {
- str += 9;
- if(sscanf(str, "%s\n", link))
- cur_ptr->link = estrdup(link);
- } else if(NULL != (str = strstr(object, "Hint="))) {
- str += 5;
- if(sscanf(str, "%s\n", link))
- cur_ptr->link = estrdup(link);
- }
- }
-
- cur_ptr->fragment = NULL;
- if(NULL != (str = strstr(object, "Fragment="))) {
- str += 9;
- if(sscanf(str, "%s\n", link))
- cur_ptr->fragment = estrdup(link);
- }
-
- {
- char *htmlattr, *str2;
- int offset;
- str1 = object;
- htmlattr = emalloc(strlen(object)); /* alloc mem big enough for htmlattr */
- htmlattr[0] = '\0';
- offset = 0;
- while(NULL != (str = strstr(str1, "HtmlAttr="))) {
- str += 9;
- str1 = str;
- while((*str1 != '\n') && (*str1 != '\0'))
- str1++;
- /* Find the '=' in the HTML attr and make sure it is part of the
- attr and not somewhere in the objrec. */
- if((NULL != (str2 = strchr(str, '='))) && (str2 < str1)) {
- str2++;
- strncpy(&htmlattr[offset], str, str2 - str);
- offset = offset + (str2 - str);
- htmlattr[offset++] = '"';
- strncpy(&htmlattr[offset], str2, str1 - str2);
- offset = offset + (str1 - str2);
- htmlattr[offset++] = '"';
- htmlattr[offset++] = ' ';
- htmlattr[offset] = '\0';
- }
- }
- if(offset){
- /* remove last space */
- htmlattr[offset-1] = '\0';
- cur_ptr->htmlattr = estrdup(htmlattr);
- }
- efree(htmlattr);
- }
-
- if(NULL != (str = strstr(object, "LinkType="))) {
- str += 9;
- if(strncmp(str, "background", 10) == 0)
- cur_ptr->linktype=HW_BACKGROUND_LINK;
- else
- if(strncmp(str, "intagnodel", 10) == 0) { /* New type introduced by Uwe Steinmann 16.03.2001 */
- cur_ptr->linktype=HW_INTAGNODEL_LINK;
- cur_ptr->tagattr = NULL;
- if(NULL != (str = strstr(object, "TagAttr="))) {
- str += 8;
- str1 = str;
- while((*str1 != '\n') && (*str1 != '\0'))
- str1++;
- cur_ptr->tagattr = emalloc(str1 - str + 1);
- memcpy(cur_ptr->tagattr, str, str1 - str);
- cur_ptr->tagattr[str1 - str] = '\0';
- }
- } else
- if(strncmp(str, "intag", 5) == 0) {
- cur_ptr->linktype=HW_INTAG_LINK;
- cur_ptr->tagattr = NULL;
- if(NULL != (str = strstr(object, "TagAttr="))) {
- str += 8;
- str1 = str;
- while((*str1 != '\n') && (*str1 != '\0'))
- str1++;
- cur_ptr->tagattr = emalloc(str1 - str + 1);
- memcpy(cur_ptr->tagattr, str, str1 - str);
- cur_ptr->tagattr[str1 - str] = '\0';
- }
- } else
- if(strncmp(str, "applet", 6) == 0) {
- cur_ptr->linktype=HW_APPLET_LINK;
- cur_ptr->codebase = NULL;
- if(NULL != (str = strstr(object, "CodeBase="))) {
- str += 9;
- str1 = str;
- while((*str1 != '\n') && (*str1 != '\0'))
- str1++;
- cur_ptr->codebase = emalloc(str1 - str + 1);
- memcpy(cur_ptr->codebase, str, str1 - str);
- cur_ptr->codebase[str1 - str] = '\0';
- }
- cur_ptr->code = NULL;
- if(NULL != (str = strstr(object, "Code="))) {
- str += 5;
- str1 = str;
- while((*str1 != '\n') && (*str1 != '\0'))
- str1++;
- cur_ptr->code = emalloc(str1 - str + 1);
- memcpy(cur_ptr->code, str, str1 - str);
- cur_ptr->code[str1 - str] = '\0';
- }
- } else
- cur_ptr->linktype=HW_DEFAULT_LINK;
- } else
- cur_ptr->linktype=HW_DEFAULT_LINK;
-
- } else { /* Destination Anchor */
- char nameanchor[200];
-
- cur_ptr->tanchor = 2;
- cur_ptr->link = NULL;
-
- /* Here is the only additional info for the name attribute */
- cur_ptr->nameanchor = NULL;
- if(NULL != (str = strstr(object, "ObjectID="))) {
- str += 9;
- if(sscanf(str, "%s\n", nameanchor))
- cur_ptr->nameanchor = estrdup(nameanchor);
- }
-
- cur_ptr->keyword = NULL;
- if(NULL != (str = strstr(object, "Keyword="))) {
- str += 8;
- if(sscanf(str, "%s\n", nameanchor))
- cur_ptr->keyword = estrdup(nameanchor);
- }
-
- }
-
- efree(anchors[i]);
- if(docofanchorrec[i]) efree(docofanchorrec[i]);
- if(reldestrec)
- if(reldestrec[i]) efree(reldestrec[i]);
- }
- }
- }
- return pAnchorList;
-}
-
-/***********************************************************************
-* Function fnInsAnchorsIntoText() *
-* *
-* Returns the text document with all anchors inserted form list *
-* Parameter: char *text: text without anchors *
-* DList *pAnchorList: list of anchors *
-* Return: Text with anchors *
-***********************************************************************/
-#define BUFFERLEN 200
-#ifdef newlist
-char *fnInsAnchorsIntoText(char *text, zend_llist *pAnchorList, char **bodytag, char **urlprefix) {
- ANCHOR **ptr;
-#else
-char *fnInsAnchorsIntoText(char *text, DLIST *pAnchorList, char **bodytag, char **urlprefix) {
-#endif
- ANCHOR *cur_ptr;
- char bgstr[BUFFERLEN], istr[BUFFERLEN];
- char **scriptname;
- char *newtext;
- int offset = 0;
- int laststart=0;
- char emptystring[BUFFERLEN];
- int i;
- ELS_FETCH();
-
- emptystring[0] = '\0';
-
-/* The following is very tricky and depends on how rewriting is setup on your webserver.
- If you skip the scriptname in the url you will have to map each hyperwave name
- to http://<hwname>. This may not always be a good idea. The best solution is
- probably to provide a prefix for such
- a case which is an optional parameter to hw_gettext() or hw_pipedocument().
- FIXME: Currently, the variable SCRIPT_NAME is empty thouht SCRIPT_URL is
- not. In our case this is OK, since as mentioned above it is better to have no
- SCRIPT_NAME than to have if rewriting is on.
-*/
- if(urlprefix) {
- scriptname = urlprefix;
- } else {
- zval **script_name;
- scriptname = emalloc(5*sizeof(char *));
- if (zend_hash_find(&EG(symbol_table), "SCRIPT_NAME", sizeof("SCRIPT_NAME"), (void **) &script_name)==FAILURE)
- for(i=0; i<5; i++)
- scriptname[i] = &emptystring;
- else {
- convert_to_string_ex(script_name);
- for(i=0; i<5; i++)
- scriptname[i] = (*script_name)->value.str.val;
- }
-
-#if 0
-#if APACHE
- {
- int j;
- array_header *arr = table_elts(((request_rec *) SG(server_context))->subprocess_env);
- table_entry *elts = (table_entry *)arr->elts;
-
- for (j=0; j < arr->nelts; j++) {
- if((0 == strcmp(elts[j].key, "SCRIPT_NAME")) ||
- (0 == strcmp(elts[j].key, "SCRIPT_URL")))
- break;
- }
- scriptname = elts[j].val;
- }
-#else
- scriptname = getenv("SCRIPT_FILENAME");
-#endif
-#endif
- }
-
- newtext = text;
- bgstr[0] = '\0';
-#ifdef newlist
- zend_llist_sort(pAnchorList, fnCmpAnchors);
- ptr = (ANCHOR **) zend_llist_get_last(pAnchorList);
- if(ptr)
- cur_ptr = *ptr;
- while(NULL != ptr) {
-#else
- dlst_mergesort(pAnchorList, fnCmpAnchors);
- cur_ptr = (ANCHOR *) dlst_last(pAnchorList);
- while(NULL != cur_ptr) {
-#endif
-
- istr[0] = '\0';
- if(cur_ptr->tanchor == 1) { /* Src Anchor */
- if(laststart >= cur_ptr->end)
- offset = 0;
- if((cur_ptr->link != NULL) && (cur_ptr->link[0] != '\0')) {
- /* The link is only set if the Link points to an external document */
- switch(cur_ptr->linktype) {
- case HW_BACKGROUND_LINK:
- snprintf(istr, BUFFERLEN, " background='%s'", cur_ptr->link);
- break;
- case HW_INTAG_LINK:
- snprintf(istr, BUFFERLEN, " %s='%s'", cur_ptr->tagattr, cur_ptr->link);
- offset -= 4; /* because there is no closing tag </A> */
-/* laststart = cur_ptr->start; */
- break;
- case HW_INTAGNODEL_LINK:
- snprintf(istr, BUFFERLEN, "%s", cur_ptr->link);
- offset -= 4; /* because there is no closing tag </A> */
-/* laststart = cur_ptr->start; */
- break;
- case HW_APPLET_LINK:
- if(cur_ptr->codebase)
- snprintf(istr, BUFFERLEN, " CODEBASE='%s' CODE='%s'", cur_ptr->codebase, cur_ptr->code);
- else
- snprintf(istr, BUFFERLEN, " CODEBASE='/' CODE='%s'", cur_ptr->code);
- break;
- default:
- newtext = fnInsStr(newtext, cur_ptr->end+offset, "</A>");
- if(cur_ptr->fragment)
- snprintf(istr, BUFFERLEN, "<A HREF='%s#%s'", cur_ptr->link, cur_ptr->fragment);
- else
- snprintf(istr, BUFFERLEN, "<A HREF='%s'", cur_ptr->link);
- if(cur_ptr->htmlattr) {
- strncat(istr, " ", BUFFERLEN - 1 - strlen(istr));
- strncat(istr, cur_ptr->htmlattr, BUFFERLEN - 1 - strlen(istr));
- }
- strncat(istr, ">", BUFFERLEN - 1 - strlen(istr));
- }
- } else {
- switch(cur_ptr->linktype) {
- case HW_BACKGROUND_LINK:
- if(NULL != cur_ptr->destdocname) {
- snprintf(istr, BUFFERLEN, " background='%s/%s'", scriptname[HW_BACKGROUND_LINK], cur_ptr->destdocname);
- } else
- istr[0] = '\0';
- break;
- case HW_INTAG_LINK:
- if(cur_ptr->fragment)
- snprintf(istr, BUFFERLEN, " %s='#%s'", cur_ptr->tagattr, cur_ptr->fragment);
- else
- snprintf(istr, BUFFERLEN, " %s='%s/%s'", cur_ptr->tagattr, scriptname[HW_INTAG_LINK], cur_ptr->destdocname);
- offset -= 4; /* because there is no closing tag </A> */
- break;
- case HW_INTAGNODEL_LINK:
- snprintf(istr, BUFFERLEN, "%s", cur_ptr->destdocname);
- offset -= 4; /* because there is no closing tag </A> */
- break;
- case HW_APPLET_LINK:
- if(cur_ptr->codebase)
-/* snprintf(istr, BUFFERLEN, " CODEBASE='%s%s' CODE='%s'", scriptname == NULL ? "" : scriptname, cur_ptr->codebase, cur_ptr->code); */
- snprintf(istr, BUFFERLEN, " CODEBASE='%s%s' CODE='%s'", scriptname[HW_APPLET_LINK], cur_ptr->codebase, cur_ptr->code);
- else
- snprintf(istr, BUFFERLEN, " CODEBASE='/' CODE='%s'", cur_ptr->code);
- break;
- default:
- newtext = fnInsStr(newtext, cur_ptr->end+offset, "</A>");
-
- if(cur_ptr->nameanchor)
- snprintf(istr, BUFFERLEN, "<A HREF='%s/%s#%s'", scriptname[HW_DEFAULT_LINK], cur_ptr->destdocname, cur_ptr->nameanchor);
- else if(cur_ptr->fragment)
- snprintf(istr, BUFFERLEN, "<A HREF=\"%s/%s#%s\"", scriptname[HW_DEFAULT_LINK], cur_ptr->destdocname, cur_ptr->fragment);
- else
- snprintf(istr, BUFFERLEN, "<A HREF='%s/%s'", scriptname[HW_DEFAULT_LINK], cur_ptr->destdocname);
-
- if(cur_ptr->htmlattr) {
- strncat(istr, " ", BUFFERLEN - 1 - strlen(istr));
- strncat(istr, cur_ptr->htmlattr, BUFFERLEN - 1 - strlen(istr));
- }
- strncat(istr, ">", BUFFERLEN - 1 - strlen(istr));
- }
- }
- } else {
- if(laststart >= cur_ptr->end)
- offset = 0;
- newtext = fnInsStr(newtext, cur_ptr->end+offset, "</a>");
-
- /* If we have a keyword, we assume we had a fragment which has been used
- instead of the destdocname
- */
- if(cur_ptr->keyword)
- snprintf(istr, BUFFERLEN, "<A NAME='%s'>", cur_ptr->keyword);
- else if(cur_ptr->nameanchor)
- snprintf(istr, BUFFERLEN, "<A NAME='%s'>", cur_ptr->nameanchor);
- }
- newtext = fnInsStr(newtext, cur_ptr->start, istr);
- /* In case there are several TAGS nested, we accumulate the offset
- You wonder what the 4 means? It's the length of </A> */
- offset += strlen(istr) + 4;
- laststart = cur_ptr->start;
-#ifdef newlist
- ptr = (ANCHOR **) zend_llist_get_prev(pAnchorList);
- if(ptr)
- cur_ptr = *ptr;
-#else
- cur_ptr = (ANCHOR *) dlst_prev(cur_ptr);
-#endif
- }
- snprintf(istr, BUFFERLEN, "<BODY %s>", bgstr);
- *bodytag = estrdup(istr);
- if(scriptname != urlprefix) efree(scriptname);
- return(newtext);
-}
-#undef BUFFERLEN
-
-/***********************************************************************
-* Function fnAttributeValue() *
-* *
-* Returns the value of an attribute *
-* Parameter: char *object: object record *
-* char *attrname: attribute name *
-* Return: char*: attribute value, NULL if name not found *
-***********************************************************************/
-char *fnAttributeValue(char *object, char *attrname)
-{
- char *str, *str1, *attrvalue;
- int len;
-
- str = strstr(object, attrname);
- if(NULL == str)
- return(NULL);
- str += strlen(attrname);
- str++;
- str1 = str;
- while((*str1 != '\0') && (*str1 != '\n'))
- str1++;
- len = str1 - str;
- if(NULL == (attrvalue = emalloc(len+1))) {
- lowerror = LE_MALLOC;
- return NULL;
- }
- memcpy(attrvalue, str, len);
- attrvalue[len] = '\0';
- return(attrvalue);
-}
-
-/***********************************************************************
-* Function fnAttributeCompare() *
-* *
-* Checks if an attribute in an objrec has a certain value *
-* Parameter: char *object: object record *
-* char *attrname: attribute name *
-* char *value: value of attribute *
-* Return: char*: as strcmp *
-***********************************************************************/
-int fnAttributeCompare(char *object, char *attrname, char *value)
-{
- char *str, *str1;
- int len;
-
- if((NULL == object) || (NULL == attrname) || (NULL == value))
- return -2;
-
- /* Find the attribute Name and make sure it is followed by
- a '=' sign and preceded by a '\n';
- */
- str = strstr(object, attrname);
- if((NULL == str) ||
- (str[strlen(attrname)] != '=') ||
- (str[-1] != '\n')) {
- return(-2);
- }
- str += strlen(attrname); /* skip the attribute name */
- str++; /* skip the equal sign */
-
- /* Search for end of attribute value */
- str1 = str;
- while((*str1 != '\0') && (*str1 != '\n'))
- str1++;
- len = str1 - str;
- return(strncmp(str, value, len));
-}
-
-/*********************************************************************
-* Function fnCOpenDataCon() *
-* *
-* Opens data connection on client side. This function is called *
-* right after the client has requested any data from the server *
-* Parameter: int sockfd: socket of control connection *
-* int *port: port of control und data connection *
-* Return : sockfd on success, <0 if error *
-*********************************************************************/
-static int fnCOpenDataCon(int sockfd, int *port)
- {
- int fd;
- struct sockaddr_in serv_addr;
- int len;
- int option = 1;
-
-/* len = sizeof(com_addr);
- if(getsockname(sockfd, (struct sockaddr *) &com_addr, &len) < 0)
- {
- return(-1);
- }
-
- *port = htons(com_addr.sin_port); */
-
- /*
- ** Open a TCP socket (an Internet stream socket)
- */
- if((fd = socket(AF_INET, SOCK_STREAM, 0)) == SOCK_ERR)
- {
- return(-1);
- }
-
- /*
- ** Make sure that address may be reused
- */
-#if defined(SUN) || defined(PHP_WIN32)
- setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (char *)&option, sizeof(option));
-#else
- setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &option, sizeof(option));
-#endif
-
- /*
- ** Open connection aktiv
- ** Let bind() select a port number
- */
- bzero((char *) &serv_addr, sizeof(serv_addr));
- if(bind(fd, (struct sockaddr *) &serv_addr, sizeof(serv_addr)) < 0)
- {
- return(-1);
- }
-
- /*
- ** Get the port number bind selected
- */
- len = sizeof (serv_addr);
- if(getsockname(fd, (struct sockaddr *)&serv_addr, &len) < 0)
- {
- return(-1);
- }
- *port = ntohs(serv_addr.sin_port);
-
- listen(fd, 5);
-
- return(fd);
- }
-
-/*======================================================================
- *
- * Read/write routines with timeout detection.
- *
- * Usage: write_to(fd, buffer, n, timeout)
- * read_to(fd, buffer, n, timeout)
- *
- * David Chavez
- * Engineering Services & Software
- * 7841 New Salem Street
- * San Diego, CA 92126
- * USA
- *
- * dec@essw.com
- *
- *====================================================================*/
-#ifdef PHP_WIN32
-#include <time.h>
-#else
-#include <sys/fcntl.h>
-#include <sys/time.h>
-#include <sys/types.h>
-#endif
-#include <errno.h>
-#include <signal.h>
-
-#ifndef PHP_WIN32
-static sigset_t newmask, oldmask, zeromask;
-#endif
-
-static int set_noblock(int fd)
-{
-#ifdef PHP_WIN32
- u_long argp=1;
-
- return ioctlsocket (fd, FIONBIO , &argp);
-#else
-
- sigemptyset(&zeromask);
- sigemptyset(&newmask);
- sigaddset(&newmask, SIGHUP);
- sigaddset(&newmask, SIGUSR1);
- sigaddset(&newmask, SIGUSR2);
- if (sigprocmask(SIG_BLOCK, &newmask, &oldmask) < 0) return -1;
-
- return fcntl(fd, F_SETFL, O_NONBLOCK | O_NDELAY /* | FNBIO*/);
-#endif
-}
-
-int write_to(int fd, void *buffer, int n, int timeout)
-{
- int nrem, nw=0;
- char *bptr;
- int error=0;
-#if defined(SYSV) || defined(PHP_WIN32)
- int width = 20;
-#else
- int width = getdtablesize();
-#endif
- fd_set writefds;
- struct timeval select_timeout;
-
- select_timeout.tv_sec = timeout;
-#ifdef PHP_WIN32
- select_timeout.tv_usec = 0;
-#else /* is this just a typo? */
- select_timeout.tv_usec = 0.;
-#endif
-
- /* Set fd to non-blocking */
-
- if (set_noblock(fd) != 0) return -1;
-
- /* Write to fd until no more can be written */
-
- FD_ZERO(&writefds);
-
- FD_SET((unsigned int)fd, &writefds);
-
- for( nrem = n, bptr = buffer; nrem;)
- {
- if(( error = select(width,
- (fd_set *) 0,
- &writefds,
- (fd_set *) 0,
- &select_timeout)) <= 0 && errno != EINTR) break;
-
- if(errno != EINTR && ( nw = write(fd, bptr, nrem)) <= 0) {
- /*
- * check for error number - and keep trying to
- * write
- */
- if(errno == EWOULDBLOCK || errno == EAGAIN || errno == EINTR)
- {
- continue;
- }
- else
- {
- error = nw;
- break;
- }
- } else {
- nrem -= nw;
- bptr += nw;
- }
- }
-#ifndef PHP_WIN32
- if (sigprocmask(SIG_SETMASK, &oldmask, NULL) < 0) return -1;
-#endif
- if( ! error ) {
- errno = ETIMEDOUT;
- return(-2);
- } else if (error < 0) {
- return(error);
- } else {
- return(n);
- }
-}
-
-int read_to(int fd, char *buffer, int n, int timeout)
- {
- int nrem, nread, nr=0;
- char *bptr;
- int error=0;
-
-#if defined(SYSV) || defined(PHP_WIN32)
- int width = 20;
-#else
- int width = getdtablesize();
-#endif
- fd_set readfds;
- struct timeval select_timeout;
-
- select_timeout.tv_sec = timeout;
-#ifdef PHP_WIN32
- select_timeout.tv_usec = 0;
-#else
- select_timeout.tv_usec = 0.;
-#endif
-
- /* Set fd to non-blocking */
-
- if (set_noblock(fd) != 0) return -1;
-
- FD_ZERO(&readfds);
-
- FD_SET((unsigned int)fd, &readfds);
-
- for( nrem = n, bptr = buffer, nread = 0; nrem;)
- {
- if(( error = select(width,
- &readfds,
- (fd_set *) 0,
- (fd_set *) 0,
- &select_timeout)) <= 0 && errno != EINTR) break;
-
- if(errno != EINTR && (nr = read (fd, bptr, nrem)) < 0)
- {
- /*
- * check for error number - and keep trying to
- * read
- */
- if(errno == EWOULDBLOCK || errno == EAGAIN || errno == EINTR)
- {
- continue;
- }
- else
- {
- error = nr;
- break;
- }
- }
- else if(nr == 0)
- {
- break;
- }
- else
- {
- nread += nr;
- bptr += nr;
- nrem -= nr;
- }
- }
-
-#ifndef PHP_WIN32
- if (sigprocmask(SIG_SETMASK, &oldmask, NULL) < 0) return -1;
-#endif
- if( ! error )
- {
- errno = ETIMEDOUT;
- return(-2);
- }
- else if ( error < 0)
- {
- return(-1);
- }
- else
- {
- return(nread);
- }
- }
-
-void set_swap(int do_swap)
-{
- swap_on = do_swap;
-}
-
-/***********************************************************************
-* Function open_hg_connection() *
-* *
-***********************************************************************/
-int open_hg_connection(char *server_name, int port)
-{
- int sockfd;
- int option = 1;
- struct sockaddr_in server_addr;
- struct hostent *hp;
-
- if ( NULL == server_name )
- return(-1);
-
- if ( (hp = gethostbyname(server_name)) == NULL ) {
- return(-2);
- }
-
- bzero((char *)&server_addr, sizeof(server_addr));
- server_addr.sin_family = AF_INET;
- if ( port != 0 )
- server_addr.sin_port = htons(port);
- else
- server_addr.sin_port = htons(HG_SERVER_PORT);
-/* bcopy(hp->h_addr, (char *) &server_addr.sin_addr, hp->h_length); */
- server_addr.sin_addr = *(struct in_addr *) hp->h_addr;
-
- if ( (sockfd = socket(AF_INET, SOCK_STREAM, 0)) == SOCK_ERR ) {
- return(-3);
- }
-
-#if defined(SUN) || defined(PHP_WIN32)
- setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, (char *)&option, sizeof(option));
-#else
- setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, &option, sizeof(option));
-#endif /* SUN */
-
- if (connect(sockfd, (struct sockaddr *) &server_addr, sizeof(server_addr)) < 0) {
- HWSOCK_FCLOSE(sockfd);
- return(-4);
- }
-
-#ifndef PHP_WIN32
- if ( (sock_flags = fcntl(sockfd, F_GETFL, 0)) == -1 )
-#endif
-
- if ( set_nonblocking(sockfd) == -1 ) {
- HWSOCK_FCLOSE(sockfd);
- return(-5);
- }
-
- return(sockfd);
-}
-
-
-/***********************************************************************
-* Function initialize_hg_connection() *
-* *
-***********************************************************************/
-int initialize_hg_connection(int sockfd, int *do_swap, int *version, char **userdata, char **server_string, char *username, char *password)
-{
- char buf, c;
- char *tmp;
- hg_msg *ready_msg, *retmsg, msg;
- int i = 0x01;
- int length;
-
- *do_swap = 0;
- buf = 'T';
- if ( hg_write(sockfd, &buf, 1) == -1 ) {
- return(-2);
- }
-
- if ( hg_read_exact(sockfd, &buf, 1) == -1 ) {
- return(-3);
- }
- if ( buf == 'F' ) {
- return(-4);
- }
- if ( buf != 'T' ) {
- return(-5);
- }
-
- buf = c = ( *(char *)&i ) ? 'l' : 'B';
- if ( hg_write(sockfd, &buf, 1) == -1 ) {
- return(-6);
- }
- if ( hg_read_exact(sockfd, &buf, 1) == -1 ) {
- return(-7);
- }
- if ( c != buf ) {
- swap_on = 1;
- *do_swap = 1;
- } else {
- swap_on = 0;
- *do_swap = 0;
- }
-
- if ( send_ready(sockfd) == -1) {
- return(-8);
- }
-
- /* Receive return from Ready message */
- if ( (ready_msg = recv_ready(sockfd)) == NULL ) {
- return(-9);
- }
-
- if ((ready_msg->version_msgid & F_VERSION) < HW_VERSION)
- return(-8);
- *version = ready_msg->version_msgid;
- *server_string = strdup(ready_msg->buf+4);
- efree(ready_msg->buf);
- efree(ready_msg);
-
- /* If we have a username and password then do the identification. */
- if((NULL != username) && (NULL != password)) {
- length = HEADER_LENGTH + sizeof(int) + strlen(username) + 1 + strlen(password) + 1;
-
- build_msg_header(&msg, length, msgid++, IDENTIFY_MESSAGE);
-
- if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) {
- lowerror = LE_MALLOC;
- return(-1);
- }
-
- tmp = build_msg_int(msg.buf, 0);
- tmp = build_msg_str(tmp, username);
- tmp = build_msg_str(tmp, password);
-
- if ( send_hg_msg(sockfd, &msg, length) == -1 ) {
- efree(msg.buf);
- return(-10);
- }
- efree(msg.buf);
- }
-
- if((NULL != username) && (NULL != password)) {
- /* Receive return form identify message */
- retmsg = recv_hg_msg(sockfd);
- if ( retmsg == NULL )
- return(-11);
-
- *userdata = retmsg->buf;
- efree(retmsg);
- }
-
- return(0);
-}
-
-
-static int set_nonblocking(int fd)
-{
-#ifdef PHP_WIN32
- unsigned int argp=0;
-
-/* if ( sock_flags == -1 )
- getsockopt (fd, SOL_SOCKET, optname, optval, optlen);
-*/ if(ioctlsocket (fd, FIONBIO , &argp) == -1)
- return(-1);
-#else
- if ( sock_flags == -1 )
- sock_flags = fcntl(fd, F_GETFL, 0);
- if ( fcntl(fd, F_SETFL, O_NONBLOCK) == -1 )
- return(-1);
-#endif
- non_blocking = 1;
- return(0);
-}
-
-
-/*
-static int set_blocking(int fd)
-{
-#ifdef PHP_WIN32
- unsigned int argp=1;
-
- if(ioctlsocket (fd, FIONBIO , &argp) == -1)
- return(-1);
-#else
- if ( fcntl(fd, F_SETFL, sock_flags) == -1 )
- return(-1);
-#endif
- return(0);
-}
-*/
-
-static int hg_read_exact(int sockfd, char *buf, int size)
-{
- int len = 0;
-
- len = read_to(sockfd, (void *) buf, size, rtimeout);
- if ( len < 0 )
- return -1;
- return(len);
-}
-
-/*
-static int hg_read(int sockfd, char *buf, int size)
-{
- int try = 0;
- int len = 0;
-
- if ( !non_blocking )
- set_nonblocking(sockfd);
- while ( len == 0 ) {
- len = recv(sockfd, (void *) buf, size, 0);
- if ( len == -1 ) {
- if ( (errno == EAGAIN) || (errno == EWOULDBLOCK) ) {
- if ( ++try > 5 )
- return(-1);
- php_sleep(1);
- }
- else return(-1);
- }
- }
- return(len);
-}
-*/
-
-static int hg_write(int sockfd, char *buf, int size)
-{
- int try = 0;
- int len = 0;
-
- if ( !non_blocking )
- set_nonblocking(sockfd);
- while ( size > 0 ) {
- len = send(sockfd, (void *) buf, size, 0);
- if ( len == -1 ) {
- if ( (errno == EAGAIN) || (errno == EWOULDBLOCK) ) {
- if ( ++try > 5 )
- return(-1);
- php_sleep(1);
- }
- else return(-1);
- }
- else {
- size -= len;
- buf += len;
- try = 0;
- }
- }
- return(0);
-}
-
-hg_msg *recv_hg_msg_head(int sockfd)
-{
- hg_msg *msg;
-
- if ( (msg = (hg_msg *)emalloc(sizeof(hg_msg))) == NULL ) {
- lowerror = LE_MALLOC;
- return(NULL);
- }
-
- if ( hg_read_exact(sockfd, (char *)&(msg->length), 4) == -1 ) {
- efree(msg);
- return(NULL);
- }
-
- if ( hg_read_exact(sockfd, (char *)&(msg->version_msgid), 4) == -1 ) {
- efree(msg);
- return(NULL);
- }
-
- if ( hg_read_exact(sockfd, (char *)&(msg->msg_type), 4) == -1 ) {
- efree(msg);
- return(NULL);
- }
-
-#ifdef HW_DEBUG
- php_printf("<B> Recv msg: </B>type = %d -- id = %d<BR>\n", msg->msg_type, msg->version_msgid);
-#endif
- return(msg);
-}
-
-
-hg_msg *recv_hg_msg(int sockfd)
-{
- hg_msg *msg;
-
- if ( (msg = (hg_msg *)emalloc(sizeof(hg_msg))) == NULL ) {
-/* php_printf("recv_hg_msg"); */
- lowerror = LE_MALLOC;
- return(NULL);
- }
-
- if ( hg_read_exact(sockfd, (char *)&(msg->length), 4) == -1 ) {
-/* php_printf("recv_hg_msg: hg_read (1) returned -1\n"); */
- efree(msg);
- return(NULL);
- }
-
- if ( hg_read_exact(sockfd, (char *)&(msg->version_msgid), 4) == -1 ) {
-/* php_printf("recv_hg_msg: hg_read (2) returned -1\n"); */
- efree(msg);
- return(NULL);
- }
-
- if ( hg_read_exact(sockfd, (char *)&(msg->msg_type), 4) == -1 ) {
-/* php_printf("recv_hg_msg: hg_read (3) returned -1\n"); */
- efree(msg);
- return(NULL);
- }
-
- if ( msg->length > HEADER_LENGTH ) {
- if ( (msg->buf = (char *) emalloc(msg->length-HEADER_LENGTH)) == NULL ) {
-/* php_printf("recv_hg_msg"); */
- lowerror = LE_MALLOC;
- efree(msg);
- return(NULL);
- }
- if ( hg_read_exact(sockfd, msg->buf, msg->length-HEADER_LENGTH) == -1 ) {
-/* php_printf("recv_hg_msg: hg_read (4) returned -1\n"); */
- efree(msg->buf);
- efree(msg);
- return(NULL);
- }
- }
- else
- msg->buf = NULL;
-
-#ifdef HW_DEBUG
- php_printf("<B> Recv msg: </B>type = %d -- id = %d<BR>\n", msg->msg_type, msg->version_msgid);
-#endif
- return(msg);
-}
-
-
-hg_msg *recv_ready(int sockfd)
-{
- hg_msg *ready_msg;
-
- if ( (ready_msg = recv_hg_msg(sockfd)) == NULL ) {
-/* php_printf("recv_ready: recv_hg_msg returned NULL\n"); */
- return(NULL);
- }
- if ( ready_msg->msg_type != READY_MESSAGE ) {
-/* php_printf("recv_ready: recv_hg_msg returned wrong message: %d, %d \n", ready_msg->length, ready_msg->msg_type); */
- efree(ready_msg);
- return(NULL);
- }
-
- return(ready_msg);
-}
-
-
-hg_msg *recv_command(int sockfd)
-{
- hg_msg *comm_msg;
-
- if ( (comm_msg = recv_hg_msg(sockfd)) == NULL ) {
-/* fprintf(stderr, "recv_command: recv_hg_msg returned NULL\n"); */
- return(NULL);
- }
- if ( comm_msg->msg_type != COMMAND_MESSAGE ) {
-/* fprintf(stderr, "recv_command: recv_hg_msg returned wrong message\n"); */
- return(NULL);
- }
-
- return(comm_msg);
-}
-
-int send_dummy(int sockfd, hw_objectID objectID, int msgid, char **attributes)
-{
- hg_msg msg, *retmsg;
- int length, error;
- char *tmp;
-
- length = HEADER_LENGTH + sizeof(hw_objectID);
-
- build_msg_header(&msg, length, msgid++, msgid);
-
- if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) {
-/* perror("send_command"); */
- lowerror = LE_MALLOC;
- return(-1);
- }
-
- tmp = build_msg_int(msg.buf, objectID);
-
- if ( send_hg_msg(sockfd, &msg, length) == -1 ) {
- efree(msg.buf);
- return(-1);
- }
-
- efree(msg.buf);
- retmsg = recv_hg_msg(sockfd);
- if ( retmsg == NULL ) {
- *attributes = NULL;
- return(-1);
- }
-
- if(0 == (int) *(retmsg->buf)) {
- *attributes = estrdup(retmsg->buf+sizeof(int));
- efree(retmsg->buf);
- efree(retmsg);
- } else {
- error = *((int *) retmsg->buf);
- *attributes = NULL;
- efree(retmsg->buf);
- efree(retmsg);
- return error;
- }
-
- return(0);
-}
-
-static int bh_send_deleteobject(int sockfd, hw_objectID objectID) {
- hg_msg msg;
- int length;
- char *tmp;
-
- length = HEADER_LENGTH + sizeof(hw_objectID);
-
- build_msg_header(&msg, length, msgid++, DELETEOBJECT_MESSAGE);
-
- if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) {
-/* perror("send_command"); */
- lowerror = LE_MALLOC;
- return(-1);
- }
-
- tmp = build_msg_int(msg.buf, objectID);
-
- if ( send_hg_msg(sockfd, &msg, length) == -1 ) {
- efree(msg.buf);
- return(-1);
- }
- efree(msg.buf);
-
- return(msgid-1);
-}
-
-static int uh_send_deleteobject(int sockfd) {
- hg_msg *retmsg;
- int error;
-
- retmsg = recv_hg_msg(sockfd);
- if ( retmsg == NULL ) {
- return(-1);
- }
-
- if(NULL == retmsg->buf) {
- efree(retmsg);
- return -1;
- }
- error = *((int *) retmsg->buf);
- efree(retmsg->buf);
- efree(retmsg);
- return(error);
-}
-
-int send_deleteobject(int sockfd, hw_objectID objectID)
-{
- if(0 > bh_send_deleteobject(sockfd, objectID))
- return -1;
- return(uh_send_deleteobject(sockfd));
-}
-
-static int bh_send_changeobject(int sockfd, hw_objectID objectID, char *mod) {
- hg_msg msg;
- int length;
- char *tmp;
-
- length = HEADER_LENGTH + sizeof(hw_objectID) + strlen(mod) + 1;
-
- build_msg_header(&msg, length, msgid++, CHANGEOBJECT_MESSAGE);
-
- if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) {
- lowerror = LE_MALLOC;
- return(-1);
- }
-
- tmp = build_msg_int(msg.buf, objectID);
- tmp = build_msg_str(tmp, mod);
-
- if ( send_hg_msg(sockfd, &msg, length) == -1 ) {
- efree(msg.buf);
- return(-1);
- }
- efree(msg.buf);
-
- return(msgid-1);
-}
-
-static int uh_send_changeobject(int sockfd) {
- hg_msg *retmsg;
- int error;
-
- retmsg = recv_hg_msg(sockfd);
- if ( retmsg == NULL ) {
- return(-1);
- }
-
- error = *((int *) retmsg->buf);
- efree(retmsg->buf);
- efree(retmsg);
- return(error);
-}
-
-int send_changeobject(int sockfd, hw_objectID objectID, char *modification)
-{
- if(0 > bh_send_changeobject(sockfd, objectID, modification))
- return -1;
- return(uh_send_changeobject(sockfd));
-}
-
-int send_groupchangeobject(int sockfd, hw_objectID objectID, char *modification)
-{
- hw_objectID *childIDs;
- int count, i, error;
-
- if(0 == (error = send_lock(sockfd, objectID))) {
- send_changeobject(sockfd, objectID, modification);
- send_unlock(sockfd, objectID);
- }/* else
- fprintf(stderr, "Could not lock 0x%X (error = %d)\n", objectID, error); */
-
- if(0 == send_children(sockfd, objectID, &childIDs, &count)) {
-/* fprintf(stderr, "Changing Children of 0x%X\n", objectID); */
- for(i=0; i<count; i++)
- if(0 > send_groupchangeobject(sockfd, childIDs[i], modification))
-/* fprintf(stderr, "Cannot change 0x%X\n", objectID) */;
- if(childIDs)
- efree(childIDs);
- }/* else
- fprintf(stderr, "No Children of 0x%X\n", objectID); */
- return(0);
-}
-
-static int bh_send_getobject(int sockfd, hw_objectID objectID) {
- hg_msg msg;
- int length;
- char *tmp;
-
- length = HEADER_LENGTH + sizeof(hw_objectID);
-
- build_msg_header(&msg, length, msgid++, GETOBJECT_MESSAGE);
-
- if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) {
- lowerror = LE_MALLOC;
- return(-1);
- }
-
- tmp = build_msg_int(msg.buf, objectID);
-
- if ( send_hg_msg(sockfd, &msg, length) == -1 ) {
- efree(msg.buf);
- return(-1);
- }
- efree(msg.buf);
-
- return(msgid-1);
-}
-
-static int uh_send_getobject(int sockfd, char **attributes) {
- hg_msg *retmsg;
- int error;
-
- retmsg = recv_hg_msg(sockfd);
- if ( retmsg == NULL ) {
- *attributes = NULL;
- return(-1);
- }
-
- if(0 == (int) *(retmsg->buf)) {
- *attributes = estrdup(retmsg->buf+sizeof(int));
- efree(retmsg->buf);
- efree(retmsg);
- } else {
- error = *((int *) retmsg->buf);
- *attributes = NULL;
- efree(retmsg->buf);
- efree(retmsg);
- return error;
- }
-
- return(0);
-}
-
-int send_getobject(int sockfd, hw_objectID objectID, char **attributes)
-{
- if(0 > bh_send_getobject(sockfd, objectID))
- return -1;
- return(uh_send_getobject(sockfd, attributes));
-}
-
-int send_getandlock(int sockfd, hw_objectID objectID, char **attributes)
-{
- hg_msg msg, *retmsg;
- int length, error;
- char *tmp;
-
- length = HEADER_LENGTH + sizeof(hw_objectID);
-
- build_msg_header(&msg, length, msgid++, GETANDLOCK_MESSAGE);
-
- if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) {
-/* perror("send_command"); */
- lowerror = LE_MALLOC;
- return(-1);
- }
-
- tmp = build_msg_int(msg.buf, objectID);
-
- if ( send_hg_msg(sockfd, &msg, length) == -1 ) {
- efree(msg.buf);
- return(-1);
- }
-
- efree(msg.buf);
- retmsg = recv_hg_msg(sockfd);
- if ( retmsg == NULL ) {
- *attributes = NULL;
- return(-1);
- }
-
- if(0 == (error = (int) *(retmsg->buf))) {
- *attributes = estrdup(retmsg->buf+sizeof(int));
- } else {
- *attributes = NULL;
- }
-
- efree(retmsg->buf);
- efree(retmsg);
- return error;
-}
-
-int send_lock(int sockfd, hw_objectID objectID)
-{
- hg_msg msg, *retmsg;
- int length, error;
- char *tmp;
-
- length = HEADER_LENGTH + sizeof(hw_objectID);
-
- build_msg_header(&msg, length, msgid++, GETANDLOCK_MESSAGE);
-
- if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) {
- lowerror = LE_MALLOC;
- return(-1);
- }
-
- tmp = build_msg_int(msg.buf, objectID);
-
- if ( send_hg_msg(sockfd, &msg, length) == -1 ) {
- efree(msg.buf);
- return(-1);
- }
-
- efree(msg.buf);
- retmsg = recv_hg_msg(sockfd);
- if ( retmsg == NULL ) {
- return(-1);
- }
-
- error = *((int *) retmsg->buf);
-
- efree(retmsg->buf);
- efree(retmsg);
- return error;
-}
-
-int send_insertobject(int sockfd, char *objrec, char *parms, hw_objectID *objectID)
-{
- hg_msg msg, *retmsg;
- int length, error;
- char *tmp;
- int *ptr;
-
- length = HEADER_LENGTH + strlen(objrec) + 1 + strlen(parms) + 1;
-
- build_msg_header(&msg, length, msgid++, INSERTOBJECT_MESSAGE);
-
- if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) {
-/* perror("send_command"); */
- lowerror = LE_MALLOC;
- return(-1);
- }
-
- tmp = build_msg_str(msg.buf, objrec);
- tmp = build_msg_str(tmp, parms);
-/*fprintf(stderr,"objrec = %s, parms = %s\n", objrec, parms); */
-
- if ( send_hg_msg(sockfd, &msg, length) == -1 ) {
- efree(msg.buf);
- return(-1);
- }
-
- efree(msg.buf);
- retmsg = recv_hg_msg(sockfd);
- if ( retmsg == NULL ) {
- *objectID = 0;
- return(-1);
- }
-
- ptr = (int *) retmsg->buf;
- if(0 == (error = *ptr)) {
- ptr++;
- *objectID = *ptr;
- } else {
- *objectID = 0;
- }
- efree(retmsg->buf);
- efree(retmsg);
- return error;
-}
-
-int send_unlock(int sockfd, hw_objectID objectID)
-{
- hg_msg msg;
- int length;
- char *tmp;
-
- length = HEADER_LENGTH + sizeof(hw_objectID);
-
- build_msg_header(&msg, length, msgid++, UNLOCK_MESSAGE);
-
- if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) {
-/* perror("send_command"); */
- lowerror = LE_MALLOC;
- return(-1);
- }
-
- tmp = build_msg_int(msg.buf, objectID);
-
- if ( send_hg_msg(sockfd, &msg, length) == -1 ) {
- efree(msg.buf);
- return(-1);
- }
-
- efree(msg.buf);
- return 0;
-}
-
-int send_incollections(int sockfd, int retcol, int cobjids, hw_objectID *objectIDs, int ccollids, hw_objectID *collIDs, int *count, hw_objectID **retIDs)
-{
- hg_msg msg, *retmsg;
- int length, error;
- char *tmp;
- int *ptr, *ptr1, i;
-
- length = HEADER_LENGTH + sizeof(hw_objectID) + (cobjids + ccollids) * sizeof(hw_objectID) + 2 * sizeof(int);
-
- build_msg_header(&msg, length, msgid++, INCOLLECTIONS_MESSAGE);
-
- if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) {
- lowerror = LE_MALLOC;
- return(-3);
- }
-
- tmp = build_msg_int(msg.buf, retcol);
- tmp = build_msg_int(tmp, cobjids);
- for(i=0; i<cobjids; i++)
- tmp = build_msg_int(tmp, objectIDs[i]);
- tmp = build_msg_int(tmp, ccollids);
- for(i=0; i<ccollids; i++)
- tmp = build_msg_int(tmp, collIDs[i]);
-
- if ( send_hg_msg(sockfd, &msg, length) == -1 ) {
- efree(msg.buf);
- return(-2);
- }
-
- efree(msg.buf);
- retmsg = recv_hg_msg(sockfd);
- if(retmsg == NULL) {
- return(-1);
- }
-
- ptr = (int *) retmsg->buf;
- if(ptr == NULL) {
- if(retmsg) efree(retmsg);
- return -1;
- }
- if(*ptr++ == 0) {
- *count = *ptr;
- ptr++;
- if(NULL != (*retIDs = emalloc(*count * sizeof(hw_objectID)))) {
- ptr1 = *retIDs;
- for(i=0; i<*count; ptr++, i++)
- ptr1[i] = *ptr;
- efree(retmsg->buf);
- efree(retmsg);
- } else {
- efree(retmsg->buf);
- efree(retmsg);
- lowerror = LE_MALLOC;
- return(-1);
- }
- } else {
- error = *((int *) retmsg->buf);
- if(retmsg->buf) efree(retmsg->buf);
- if(retmsg) efree(retmsg);
- return error;
- }
- return(0);
-}
-
-
-int send_inscoll(int sockfd, hw_objectID objectID, char *objrec, hw_objectID *new_objectID)
-{
- hg_msg msg, *retmsg;
- int length, error;
- char *tmp;
- int *ptr;
-
- length = HEADER_LENGTH + sizeof(hw_objectID) + strlen(objrec) + 1;
-
- build_msg_header(&msg, length, msgid++, INSCOLL_MESSAGE);
-
- if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) {
- lowerror = LE_MALLOC;
- return(-3);
- }
-
- tmp = build_msg_int(msg.buf, objectID);
- tmp = build_msg_str(tmp, objrec);
-
- if ( send_hg_msg(sockfd, &msg, length) == -1 ) {
- efree(msg.buf);
- return(-2);
- }
-
- efree(msg.buf);
- retmsg = recv_hg_msg(sockfd);
- if(retmsg == NULL) {
- return(-1);
- }
-
- ptr = (int *) retmsg->buf;
- if(0 != (error = *ptr)) {
- efree(retmsg->buf);
- efree(retmsg);
- *new_objectID = 0;
- return error;
- }
-
- ptr++;
- *new_objectID = *ptr;
- efree(retmsg->buf);
- efree(retmsg);
- return 0;
-}
-
-int send_insdoc(int sockfd, hw_objectID objectID, char *objrec, char *text, hw_objectID *new_objectID)
-{
- hg_msg msg, *retmsg;
- int length, error;
- char *tmp;
- int *ptr;
-
- length = HEADER_LENGTH + sizeof(hw_objectID) + strlen(objrec) + 1;
- if(text) {
- length += strlen(text);
- length++;
- }
-
- build_msg_header(&msg, length, msgid++, INSDOC_MESSAGE);
-
- if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) {
- lowerror = LE_MALLOC;
- return(-3);
- }
-
- tmp = build_msg_int(msg.buf, objectID);
- tmp = build_msg_str(tmp, objrec);
- if(text)
- tmp = build_msg_str(tmp, text);
-
- if ( send_hg_msg(sockfd, &msg, length) == -1 ) {
- efree(msg.buf);
- return(-2);
- }
-
- efree(msg.buf);
- retmsg = recv_hg_msg(sockfd);
- if(retmsg == NULL) {
- return(-1);
- }
-
- ptr = (int *) retmsg->buf;
- if(0 != (error = *ptr)) {
- efree(retmsg->buf);
- efree(retmsg);
- *new_objectID = 0;
- return error;
- }
-
- ptr++;
- *new_objectID = *ptr;
- efree(retmsg->buf);
- efree(retmsg);
- return 0;
-}
-
-int send_getdestforanchorsobj(int sockfd, char **anchorrec, char ***destrec, int count);
-int send_getreldestforanchorsobj(int sockfd, char **anchorrec, char ***reldestrec, int count, int rootID, int thisID);
-
-int send_gettext(int sockfd, hw_objectID objectID, int mode, int rootid, char **objattr, char **bodytag, char **text, int *count, char *urlprefix)
-{
- hg_msg msg, *retmsg;
- int length, *ptr, ancount, error;
- char *tmp, *attributes, *documenttype;
- char **anchors;
- int i;
-
- length = HEADER_LENGTH + sizeof(hw_objectID);
-
- build_msg_header(&msg, length, msgid++, GETOBJECT_MESSAGE);
-
- if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) {
-/* perror("send_command"); */
- lowerror = LE_MALLOC;
- return(-1);
- }
-
- tmp = build_msg_int(msg.buf, objectID);
-
- if ( send_hg_msg(sockfd, &msg, length) == -1 ) {
- efree(msg.buf);
- return(-1);
- }
-
- efree(msg.buf);
- retmsg = recv_hg_msg(sockfd);
- if(retmsg == NULL) {
- attributes = NULL;
- return(-1);
- }
-
- ptr = (int *) retmsg->buf;
- if(*ptr == 0) {
- attributes = estrdup(retmsg->buf+sizeof(int));
- efree(retmsg->buf);
- efree(retmsg);
- } else {
- error = *ptr;
- attributes = NULL;
- efree(retmsg->buf);
- efree(retmsg);
- return error;
- }
-
- length = HEADER_LENGTH + strlen(attributes) + 1;
- build_msg_header(&msg, length, msgid++, GETTEXT_MESSAGE);
-
- if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) {
-/* perror("send_command"); */
- lowerror = LE_MALLOC;
- return(-1);
- }
-
- tmp = build_msg_str(msg.buf, attributes);
-
- documenttype = fnAttributeValue(attributes, "DocumentType");
- *objattr = strdup(attributes);
- efree(attributes);
-
- if ( send_hg_msg(sockfd, &msg, length) == -1 ) {
- efree(msg.buf);
- return(-1);
- }
-
- efree(msg.buf);
- retmsg = recv_hg_msg(sockfd);
- if (retmsg == NULL) {
- *text = NULL;
- return(-1);
- }
-
- ptr = (int *) retmsg->buf;
- if(*ptr == 0) {
- ptr++;
- *count = retmsg->length-HEADER_LENGTH-sizeof(int);
- if(NULL != (*text = malloc(*count + 1))) {
- memcpy(*text, retmsg->buf+sizeof(int), *count);
-/* *text[*count] = 0; */
- } else {
- efree(retmsg->buf);
- efree(retmsg);
- lowerror = LE_MALLOC;
- return(-1);
- }
- } else {
- error = *ptr;
- efree(retmsg->buf);
- efree(retmsg);
- *text = NULL;
- return(error);
- }
- efree(retmsg->buf);
- efree(retmsg);
-
- if((documenttype != NULL) && (strcmp(documenttype, "Image") != 0)) {
- if(send_getanchorsobj(sockfd, objectID, &anchors, &ancount) == 0) {
- char **destrec, **reldestrec;
-#ifdef newlist
- zend_llist *pAnchorList;
-#else
- DLIST *pAnchorList;
-#endif
-
- /* Get dest as relative and absolut path */
- send_getdestforanchorsobj(sockfd, anchors, &destrec, ancount);
- send_getreldestforanchorsobj(sockfd, anchors, &reldestrec, ancount, rootid, objectID);
- pAnchorList = fnCreateAnchorList(objectID, anchors, destrec, reldestrec, ancount, mode);
-
- /* Free only the array, the objrecs has been freed in fnCreateAnchorList() */
- if(anchors) efree(anchors);
- if(destrec) efree(destrec);
- if(reldestrec) efree(reldestrec);
-
- if(pAnchorList != NULL) {
- char *newtext;
- char *body = NULL;
- char **prefixarray;
-
- prefixarray = emalloc(5*sizeof(char *));
- for(i=0; i<5; i++)
- prefixarray[i] = urlprefix;
-
- newtext = fnInsAnchorsIntoText(*text, pAnchorList, &body, prefixarray);
-
- efree(prefixarray);
-#ifdef newlist
- zend_llist_destroy(pAnchorList);
- efree(pAnchorList);
-#else
- dlst_kill(pAnchorList, fnDeleteAnchor);
-#endif
- *bodytag = strdup(body);
- if(body) efree(body);
- *text = newtext;
- *count = strlen(newtext);
- }
- }
- }
-
- if(documenttype) efree(documenttype);
- return(0);
-}
-
-int send_insertanchors(char **text, int *count, char **anchors, char **destrec, int ancount, char **urlprefix, char **bodytag) {
- char **reldestrec = NULL;
- int mode = 0;
- hw_objectID objectID = 0;
-#ifdef newlist
- zend_llist *pAnchorList = NULL;
-#else
- DLIST *pAnchorList = NULL;
-#endif
- pAnchorList = fnCreateAnchorList(objectID, anchors, destrec, reldestrec, ancount, mode);
-
- /* Free only the array, the objrecs has been freed in fnCreateAnchorList() */
- if(anchors) efree(anchors);
- if(destrec) efree(destrec);
- if(reldestrec) efree(reldestrec);
-
- if(pAnchorList != NULL) {
- char *newtext;
- char *body = NULL;
-
- newtext = fnInsAnchorsIntoText(*text, pAnchorList, &body, urlprefix);
-
-#ifdef newlist
- zend_llist_destroy(pAnchorList);
- efree(pAnchorList);
-#else
- dlst_kill(pAnchorList, fnDeleteAnchor);
-#endif
- *bodytag = strdup(body);
- if(body) efree(body);
-fprintf(stderr, "bodytag = %s\n", *bodytag);
- *text = newtext;
- *count = strlen(newtext);
- }
- return 0;
-}
-
-int send_edittext(int sockfd, char *objattr, char *text)
-{
- hg_msg msg, *retmsg;
- int length, *ptr, error;
- char *tmp, *path, *objid;
- hw_objectID objectID;
-
- objid = fnAttributeValue(objattr, "ObjectID");
- if(objid == NULL)
- return(-1);
- if(!sscanf(objid, "0x%x", &objectID))
- return(-2);
-
- path = fnAttributeValue(objattr, "Path");
- if(path == NULL)
- return(-3);
-
- length = HEADER_LENGTH + sizeof(hw_objectID) + strlen(path) + 1 + 1 + strlen(text) + 1;
- build_msg_header(&msg, length, msgid++, EDITTEXT_MESSAGE);
-
- if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) {
- lowerror = LE_MALLOC;
- return(-4);
- }
-
- tmp = build_msg_int(msg.buf, objectID);
- tmp = build_msg_str(tmp, path);
- tmp = build_msg_str(tmp, "");
- tmp = build_msg_str(tmp, text);
-
- if(path) efree(path);
- if(objid) efree(objid);
-
- if ( send_hg_msg(sockfd, &msg, length) == -1 ) {
- efree(msg.buf);
- return(-5);
- }
-
- efree(msg.buf);
- retmsg = recv_hg_msg(sockfd);
- if (retmsg == NULL) {
- *text = '\0';
- return(-6);
- }
-
- ptr = (int *) retmsg->buf;
- error = *ptr;
- efree(retmsg->buf);
- efree(retmsg);
- return(error);
-}
-
-int send_getcgi(int sockfd, hw_objectID objectID, char *cgi_env_str, char **objattr, char **text, int *count)
-{
- hg_msg msg, *retmsg;
- int length, *ptr, error, new_attr_len;
- char *tmp, *attributes, *new_attr;
-
- length = HEADER_LENGTH + sizeof(hw_objectID);
-
- build_msg_header(&msg, length, msgid++, GETOBJECT_MESSAGE);
-
- if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) {
-/* perror("send_command"); */
- lowerror = LE_MALLOC;
- return(-1);
- }
-
- tmp = build_msg_int(msg.buf, objectID);
-
- if ( send_hg_msg(sockfd, &msg, length) == -1 ) {
- efree(msg.buf);
- return(-1);
- }
-
- efree(msg.buf);
- retmsg = recv_hg_msg(sockfd);
- if(retmsg == NULL) {
- attributes = NULL;
- return(-1);
- }
-
- ptr = (int *) retmsg->buf;
- if(*ptr == 0) {
- attributes = estrdup(retmsg->buf+sizeof(int));
- efree(retmsg->buf);
- efree(retmsg);
- } else {
- error = *ptr;
- attributes = NULL;
- efree(retmsg->buf);
- efree(retmsg);
- return error;
- }
-
- new_attr_len = strlen(attributes) + strlen(cgi_env_str) + 2;
- new_attr = malloc(new_attr_len);
- strcpy(new_attr, attributes);
- strcat(new_attr, cgi_env_str);
- length = HEADER_LENGTH + strlen(new_attr) + 1 + sizeof(int);
- build_msg_header(&msg, length, msgid++, GETCGI_MESSAGE);
-
- if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) {
-/* perror("send_command"); */
- lowerror = LE_MALLOC;
- return(-1);
- }
-
- tmp = build_msg_str(msg.buf, new_attr);
- tmp = build_msg_int(tmp, 0);
-
- *objattr = strdup(attributes);
- efree(attributes);
- free(new_attr);
-
- if ( send_hg_msg(sockfd, &msg, length) == -1 ) {
- efree(msg.buf);
- return(-1);
- }
-
- efree(msg.buf);
- retmsg = recv_hg_msg(sockfd);
- if (retmsg == NULL) {
- *text = NULL;
- return(-1);
- }
-
- /* Attention: It looks like the documentation is not quite right.
- According to the docs the buffer starts with an integer which
- is followed by the output of the cgi script. This seems not to
- be true. There is another integer right after the error.
- The output of the cgi script is also preceded by the 'Content-type'
- header. */
- ptr = (int *) retmsg->buf;
- if(*ptr++ == 1024) {
- *count = *ptr++;
- if(NULL != (*text = malloc(*count + 1))) {
- memcpy(*text, ptr, *count);
- } else {
- efree(retmsg->buf);
- efree(retmsg);
- lowerror = LE_MALLOC;
- return(-1);
- }
- } else {
- error = *ptr + 1024; /* move errors to >2024 */
- efree(retmsg->buf);
- efree(retmsg);
- *text = NULL;
- return(error);
- }
- efree(retmsg->buf);
- efree(retmsg);
-
- return(0);
-}
-
-int send_getremote(int sockfd, hw_objectID objectID, char **objattr, char **text, int *count)
-{
- hg_msg msg, *retmsg;
- int length, *ptr, error;
- char *tmp, *attributes;
-
- length = HEADER_LENGTH + sizeof(hw_objectID);
-
- build_msg_header(&msg, length, msgid++, GETOBJECT_MESSAGE);
-
- if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) {
- lowerror = LE_MALLOC;
- return(-1);
- }
-
- tmp = build_msg_int(msg.buf, objectID);
-
- if ( send_hg_msg(sockfd, &msg, length) == -1 ) {
- efree(msg.buf);
- return(-1);
- }
-
- efree(msg.buf);
- retmsg = recv_hg_msg(sockfd);
- if(retmsg == NULL) {
- attributes = NULL;
- return(-1);
- }
-
- ptr = (int *) retmsg->buf;
- if(*ptr == 0) {
- attributes = estrdup(retmsg->buf+sizeof(int));
- efree(retmsg->buf);
- efree(retmsg);
- } else {
- error = *ptr;
- attributes = NULL;
- efree(retmsg->buf);
- efree(retmsg);
- return error;
- }
-
- length = HEADER_LENGTH + strlen(attributes) + 1 + sizeof(int);
- build_msg_header(&msg, length, msgid++, GETREMOTE_MESSAGE);
-
- if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) {
- lowerror = LE_MALLOC;
- return(-1);
- }
-
- tmp = build_msg_str(msg.buf, attributes);
- tmp = build_msg_int(tmp, 0);
-
- *objattr = strdup(attributes);
- efree(attributes);
-
- if ( send_hg_msg(sockfd, &msg, length) == -1 ) {
- efree(msg.buf);
- return(-1);
- }
-
- efree(msg.buf);
- retmsg = recv_hg_msg(sockfd);
- if (retmsg == NULL) {
- *text = NULL;
- return(-1);
- }
-
- ptr = (int *) retmsg->buf;
- if(*ptr == 1024) {
- *count = retmsg->length-HEADER_LENGTH-sizeof(int)-sizeof(int);
- if(NULL != (*text = malloc(*count + 1))) {
- memcpy(*text, ptr+2, *count);
-/* *text[*count] = 0; */
- } else {
- efree(retmsg->buf);
- efree(retmsg);
- lowerror = LE_MALLOC;
- return(-1);
- }
- } else {
- error = *ptr + 1024; /* move errors to >2024 */
- efree(retmsg->buf);
- efree(retmsg);
- *text = NULL;
- return(error);
- }
- efree(retmsg->buf);
- efree(retmsg);
-
- return(0);
-}
-
-int send_getremotechildren(int sockfd, char *attributes, char **text, int **childIDs, int *count)
-{
- hg_msg msg, *retmsg;
- int length, *ptr, *ptr1, error;
- char *tmp;
-
-/* length = HEADER_LENGTH + sizeof(hw_objectID);
-
- build_msg_header(&msg, length, msgid++, GETOBJECT_MESSAGE);
-
- if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) {
- lowerror = LE_MALLOC;
- return(-1);
- }
-
- tmp = build_msg_int(msg.buf, objectID);
-
- if ( send_hg_msg(sockfd, &msg, length) == -1 ) {
- efree(msg.buf);
- return(-1);
- }
-
- efree(msg.buf);
- retmsg = recv_hg_msg(sockfd);
- if(retmsg == NULL) {
- attributes = NULL;
- return(-1);
- }
-
- ptr = (int *) retmsg->buf;
- if(*ptr == 0) {
- attributes = estrdup(retmsg->buf+sizeof(int));
- efree(retmsg->buf);
- efree(retmsg);
- } else {
- error = *ptr;
- attributes = NULL;
- efree(retmsg->buf);
- efree(retmsg);
- return error;
- }
-*/
- length = HEADER_LENGTH + strlen(attributes) + 1 + sizeof(int);
- build_msg_header(&msg, length, msgid++, GETREMOTECHILDREN_MESSAGE);
-
- if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) {
-/* perror("send_command"); */
- lowerror = LE_MALLOC;
- return(-1);
- }
-
- tmp = build_msg_str(msg.buf, attributes);
- tmp = build_msg_int(tmp, 0);
-
-/* efree(attributes); */
-
- if ( send_hg_msg(sockfd, &msg, length) == -1 ) {
- efree(msg.buf);
- return(-1);
- }
-
- efree(msg.buf);
- retmsg = recv_hg_msg(sockfd);
- if (retmsg == NULL) {
- *childIDs = NULL;
- return(-1);
- }
- ptr = (int *) retmsg->buf;
- if(*ptr++ == 1024) {
- int i, remlen, sum;
- *count = *ptr;
- ptr++;
- if(NULL != (*childIDs = emalloc(*count * sizeof(hw_objectID)))) {
- ptr1 = *childIDs;
- sum = 0;
- for(i=0; i<*count; ptr++, i++) {
- ptr1[i] = *ptr;
- sum += *ptr;
- }
- } else {
- efree(retmsg->buf);
- efree(retmsg);
- lowerror = LE_MALLOC;
- return(-1);
- }
-
- remlen = retmsg->length - HEADER_LENGTH - *count * sizeof(int) - 2 * sizeof(int);
-/*ptr1[i-1] = remlen; */
-/*ptr1[i-2] = sum; */
-/*ptr1[i-3] = *count; */
- if(NULL != (*text = emalloc(remlen + 1))) {
- memcpy(*text, ptr, remlen);
- } else {
- efree(childIDs);
- efree(retmsg->buf);
- efree(retmsg);
- lowerror = LE_MALLOC;
- return(-1);
- }
- efree(retmsg->buf);
- efree(retmsg);
- } else {
- error = *((int *) retmsg->buf);
- efree(retmsg->buf);
- efree(retmsg);
- *childIDs = NULL;
- *text = NULL;
- return error;
- }
- return(0);
-}
-
-int send_mvcpdocscollscoll(int sockfd, hw_objectID *objectIDs, int count, int from, int dest, int cpmv, int doccoll)
-{
- hg_msg msg, *retmsg;
- int length, i, error;
- char *tmp;
-
- if(count <= 0)
- return 0;
-
- /* HEADER_LENGTH + cpmv + from + dest + count + nr of obj */
- length = HEADER_LENGTH + sizeof(hw_objectID) + sizeof(hw_objectID) + sizeof(hw_objectID) + sizeof(hw_objectID) + count * sizeof(hw_objectID);
-
- switch(doccoll) {
- case DOCUMENT:
- build_msg_header(&msg, length, msgid++, MVCPDOCSCOLL_MESSAGE);
- break;
- case COLLECTION:
- build_msg_header(&msg, length, msgid++, MVCPCOLLSCOLL_MESSAGE);
- break;
- }
-
- if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) {
-/* perror("send_command"); */
- lowerror = LE_MALLOC;
- return(-1);
- }
-
- tmp = build_msg_int(msg.buf, cpmv);
- tmp = build_msg_int(tmp, from);
- tmp = build_msg_int(tmp, dest);
- tmp = build_msg_int(tmp, count);
- for(i=0; i<count;i++)
- tmp = build_msg_int(tmp,objectIDs[i]);
-
- if ( send_hg_msg(sockfd, &msg, length) == -1 ) {
- efree(msg.buf);
- return(-1);
- }
-
- efree(msg.buf);
- retmsg = recv_hg_msg(sockfd);
- if ( retmsg == NULL ) {
- return(-1);
- }
-
- error = *((int *) retmsg->buf);
- efree(retmsg->buf);
- efree(retmsg);
- return(error);
-}
-
-int send_docbyanchor(int sockfd, hw_objectID objectID, hw_objectID *anchorID)
-{
- hg_msg msg, *retmsg;
- int length, error;
- char *tmp;
- int *ptr;
-
- length = HEADER_LENGTH + sizeof(hw_objectID);
-
- build_msg_header(&msg, length, msgid++, GETDOCBYANCHOR_MESSAGE);
-
- if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) {
-/* perror("send_command"); */
- lowerror = LE_MALLOC;
- return(-1);
- }
-
- tmp = build_msg_int(msg.buf, objectID);
-
- if ( send_hg_msg(sockfd, &msg, length) == -1 ) {
- efree(msg.buf);
- return(-1);
- }
-
- efree(msg.buf);
- retmsg = recv_hg_msg(sockfd);
- if ( retmsg == NULL ) {
- return(-1);
- }
-
- ptr = (int *) retmsg->buf;
- error = *ptr++;
- if(error == 0) {
- *anchorID = *ptr;
- } else {
- *anchorID = 0;
- }
- efree(retmsg->buf);
- efree(retmsg);
- return error;
-}
-
-int send_docbyanchorobj(int sockfd, hw_objectID objectID, char **objrec)
-{
- hg_msg msg, *retmsg;
- int length, error;
- char *tmp;
- int *ptr, anchorID;
-
- length = HEADER_LENGTH + sizeof(hw_objectID);
-
- build_msg_header(&msg, length, msgid++, GETDOCBYANCHOR_MESSAGE);
-
- if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) {
-/* perror("send_command"); */
- lowerror = LE_MALLOC;
- return(-1);
- }
-
- tmp = build_msg_int(msg.buf, objectID);
-
- if ( send_hg_msg(sockfd, &msg, length) == -1 ) {
- efree(msg.buf);
- return(-1);
- }
-
- efree(msg.buf);
- retmsg = recv_hg_msg(sockfd);
- if ( retmsg == NULL ) {
- return(-1);
- }
-
- ptr = (int *) retmsg->buf;
- error = *ptr++;
- if(error == 0) {
- anchorID = *ptr;
- } else {
- anchorID = 0;
- }
- efree(retmsg->buf);
- efree(retmsg);
-
- if(0 > bh_send_getobject(sockfd, anchorID))
- return -1;
- return(uh_send_getobject(sockfd, objrec));
-}
-
-int send_children(int sockfd, hw_objectID objectID, hw_objectID **childIDs, int *count)
-{
- hg_msg msg, *retmsg;
- int length, i, error;
- char *tmp;
- int *ptr, *ptr1;
-
- length = HEADER_LENGTH + sizeof(hw_objectID);
-
- build_msg_header(&msg, length, msgid++, CHILDREN_MESSAGE);
-
- if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) {
- lowerror = LE_MALLOC;
- return(-1);
- }
-
- tmp = build_msg_int(msg.buf, objectID);
-
- if (-1 == send_hg_msg(sockfd, &msg, length)) {
- efree(msg.buf);
- return(-2);
- }
-
- efree(msg.buf);
- retmsg = recv_hg_msg(sockfd);
- if ( retmsg == NULL ) {
- return(-3);
- }
-
- ptr = (int *) retmsg->buf;
- if(ptr == NULL) {
- if(retmsg) efree(retmsg);
- return -1;
- }
- if(*ptr++ == 0) {
- *count = *ptr++;
- if(NULL != (*childIDs = emalloc(*count * sizeof(hw_objectID)))) {
- ptr1 = *childIDs;
- for(i=0; i<*count; ptr++, i++)
- ptr1[i] = *ptr;
- efree(retmsg->buf);
- efree(retmsg);
- } else {
- efree(retmsg->buf);
- efree(retmsg);
- lowerror = LE_MALLOC;
- return(-1);
- }
- } else {
- error = *((int *) retmsg->buf);
- efree(retmsg->buf);
- efree(retmsg);
- return error;
- }
-
- return(0);
-}
-
-int send_childrenobj(int sockfd, hw_objectID objectID, char ***childrec, int *count)
-{
- hg_msg msg, *retmsg;
- int length, i, error;
- char *tmp;
- int *childIDs = NULL;
- int *ptr;
-
- length = HEADER_LENGTH + sizeof(hw_objectID);
-
- build_msg_header(&msg, length, msgid++, CHILDREN_MESSAGE);
-
- if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) {
-/* perror("send_command"); */
- lowerror = LE_MALLOC;
- return(-1);
- }
-
- tmp = build_msg_int(msg.buf, objectID);
-
- if ( send_hg_msg(sockfd, &msg, length) == -1 ) {
- efree(msg.buf);
- return(-1);
- }
-
- efree(msg.buf);
- retmsg = recv_hg_msg(sockfd);
- if ( retmsg == NULL )
- return(-1);
-
- ptr = (int *) retmsg->buf;
- if(ptr == NULL) {
- if(retmsg) efree(retmsg);
- return -1;
- }
- if(*ptr++ == 0) {
- *count = *ptr++;
- if(NULL != (childIDs = emalloc(*count * sizeof(hw_objectID)))) {
- for(i=0; i<*count; ptr++, i++)
- childIDs[i] = *ptr;
- efree(retmsg->buf);
- efree(retmsg);
- } else {
- efree(retmsg->buf);
- efree(retmsg);
- lowerror = LE_MALLOC;
- return(-1);
- }
- } else {
- error = *((int *) retmsg->buf);
- efree(retmsg->buf);
- efree(retmsg);
- return error;
- }
-
- /* Now get for each child collection the object record */
-#ifdef hw_less_server_stress
- if(0 != send_objectbyidquery(sockfd, childIDs, count, NULL, childrec)) {
- efree(childIDs);
- return -2;
- }
- efree(childIDs);
-#else
- for(i=0; i<*count; i++) {
-
- length = HEADER_LENGTH + sizeof(hw_objectID);
- build_msg_header(&msg, length, childIDs[i], GETOBJECT_MESSAGE);
-
- if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) {
- efree(childIDs);
- lowerror = LE_MALLOC;
- return(-1);
- }
-
- tmp = build_msg_int(msg.buf, childIDs[i]);
-
- if ( send_hg_msg(sockfd, &msg, length) == -1 ) {
- efree(childIDs);
- efree(msg.buf);
- return(-1);
- }
-
- efree(msg.buf);
- }
- efree(childIDs);
-
- if(NULL == (objptr = (char **) emalloc(*count * sizeof(hw_objrec *)))) {
- /* if emalloc fails, get at least all remaining messages from server */
- for(i=0; i<*count; i++) {
- retmsg = recv_hg_msg(sockfd);
- efree(retmsg->buf);
- efree(retmsg);
- }
- *childrec = NULL;
- lowerror = LE_MALLOC;
- return(-1);
- } else {
- *childrec = objptr;
-
- for(i=0; i<*count; i++) {
- retmsg = recv_hg_msg(sockfd);
- if ( retmsg != NULL ) {
- if(0 == (int) *(retmsg->buf)) {
- *objptr = estrdup(retmsg->buf+sizeof(int));
- objptr++;
- efree(retmsg->buf);
- efree(retmsg);
- } else {
- *objptr = NULL;
- objptr++;
- efree(retmsg->buf);
- efree(retmsg);
- }
- }
- }
- }
-#endif
- return(0);
-}
-
-int send_getchildcoll(int sockfd, hw_objectID objectID, hw_objectID **childIDs, int *count)
-{
- hg_msg msg, *retmsg;
- int length, error;
- char *tmp;
- int *ptr, i, *ptr1;
-
- length = HEADER_LENGTH + sizeof(hw_objectID);
-
- build_msg_header(&msg, length, msgid++, GETCHILDCOLL_MESSAGE);
-
- if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) {
-/* perror("send_command"); */
- lowerror = LE_MALLOC;
- return(-1);
- }
-
- tmp = build_msg_int(msg.buf, objectID);
-
- if ( send_hg_msg(sockfd, &msg, length) == -1 ) {
- efree(msg.buf);
- return(-1);
- }
-
- efree(msg.buf);
- retmsg = recv_hg_msg(sockfd);
- if ( retmsg == NULL ) {
- return(-1);
- }
-
- ptr = (int *) retmsg->buf;
- if(ptr == NULL) {
- if(retmsg) efree(retmsg);
- return -1;
- }
- if(*ptr++ == 0) {
- *count = *ptr++;
- if(NULL != (*childIDs = emalloc(*count * sizeof(hw_objectID)))) {
- ptr1 = *childIDs;
- for(i=0; i<*count; ptr++, i++)
- ptr1[i] = *ptr;
- efree(retmsg->buf);
- efree(retmsg);
- } else {
- efree(retmsg->buf);
- efree(retmsg);
- lowerror = LE_MALLOC;
- return(-1);
- }
- } else {
- error = *((int *) retmsg->buf);
- efree(retmsg->buf);
- efree(retmsg);
- return error;
- }
-
- return(0);
-}
-
-int send_getchildcollobj(int sockfd, hw_objectID objectID, char ***childrec, int *count)
-{
- hg_msg msg, *retmsg;
- int length, i, error;
- char *tmp;
- int *childIDs = NULL;
- int *ptr;
-
- length = HEADER_LENGTH + sizeof(hw_objectID);
-
- build_msg_header(&msg, length, msgid++, GETCHILDCOLL_MESSAGE);
-
- if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) {
-/* perror("send_command"); */
- lowerror = LE_MALLOC;
- return(-1);
- }
-
- tmp = build_msg_int(msg.buf, objectID);
-
- if ( send_hg_msg(sockfd, &msg, length) == -1 ) {
- efree(msg.buf);
- return(-1);
- }
-
- efree(msg.buf);
- retmsg = recv_hg_msg(sockfd);
- if ( retmsg == NULL )
- return(-1);
-
- ptr = (int *) retmsg->buf;
- if(ptr == NULL) {
- if(retmsg) efree(retmsg);
- return -1;
- }
- if(*ptr++ == 0) {
- *count = *ptr++;
- if(NULL != (childIDs = emalloc(*count * sizeof(hw_objectID)))) {
- for(i=0; i<*count; ptr++, i++)
- childIDs[i] = *ptr;
- efree(retmsg->buf);
- efree(retmsg);
- } else {
- efree(retmsg->buf);
- efree(retmsg);
- lowerror = LE_MALLOC;
- return(-1);
- }
- } else {
- error = *((int *) retmsg->buf);
- efree(retmsg->buf);
- efree(retmsg);
- return error;
- }
-
- /* Now get for each child collection the object record */
-#ifdef hw_less_server_stress
- if(0 != send_objectbyidquery(sockfd, childIDs, count, NULL, childrec)) {
- efree(childIDs);
- return -2;
- }
- efree(childIDs);
-#else
- for(i=0; i<*count; i++) {
-
- length = HEADER_LENGTH + sizeof(hw_objectID);
- build_msg_header(&msg, length, childIDs[i], GETOBJECT_MESSAGE);
-
- if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) {
- efree(childIDs);
- lowerror = LE_MALLOC;
- return(-1);
- }
-
- tmp = build_msg_int(msg.buf, childIDs[i]);
-
- if ( send_hg_msg(sockfd, &msg, length) == -1 ) {
- efree(childIDs);
- efree(msg.buf);
- return(-1);
- }
-
- efree(msg.buf);
- }
- efree(childIDs);
-
- if(NULL == (objptr = (char **) emalloc(*count * sizeof(hw_objrec *)))) {
- /* if emalloc fails, get at least all remaining messages from server */
- for(i=0; i<*count; i++) {
- retmsg = recv_hg_msg(sockfd);
- efree(retmsg->buf);
- efree(retmsg);
- }
- *childrec = NULL;
- lowerror = LE_MALLOC;
- return(-1);
- } else {
- *childrec = objptr;
-
- for(i=0; i<*count; i++) {
- retmsg = recv_hg_msg(sockfd);
- if ( retmsg != NULL ) {
- if(0 == (int) *(retmsg->buf)) {
- *objptr = estrdup(retmsg->buf+sizeof(int));
- objptr++;
- efree(retmsg->buf);
- efree(retmsg);
- } else {
- *objptr = NULL;
- objptr++;
- efree(retmsg->buf);
- efree(retmsg);
- }
- }
- }
- }
-#endif
- return(0);
-}
-
-int send_getchilddoccoll(int sockfd, hw_objectID objectID, hw_objectID **childIDs, int *count)
-{
- hg_msg msg, *retmsg;
- int length, error;
- char *tmp;
-
- length = HEADER_LENGTH + sizeof(hw_objectID);
-
- build_msg_header(&msg, length, msgid++, GETCHILDDOCCOLL_MESSAGE);
-
- if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) {
-/* perror("send_command"); */
- lowerror = LE_MALLOC;
- return(-1);
- }
-
- tmp = build_msg_int(msg.buf, objectID);
-
- if ( send_hg_msg(sockfd, &msg, length) == -1 ) {
- efree(msg.buf);
- return(-1);
- } else {
- efree(msg.buf);
- retmsg = recv_hg_msg(sockfd);
- if ( retmsg != NULL ) {
- int *ptr, i, *ptr1;
-
- ptr = (int *) retmsg->buf;
- if(ptr == NULL) {
- if(retmsg) efree(retmsg);
- return -1;
- }
- if(*ptr++ == 0) {
- *count = *ptr++;
- if(NULL != (*childIDs = emalloc(*count * sizeof(hw_objectID)))) {
- ptr1 = *childIDs;
- for(i=0; i<*count; ptr++, i++)
- ptr1[i] = *ptr;
- efree(retmsg->buf);
- efree(retmsg);
- } else {
- efree(retmsg->buf);
- efree(retmsg);
- lowerror = LE_MALLOC;
- return(-1);
- }
- } else {
- error = *((int *) retmsg->buf);
- efree(retmsg->buf);
- efree(retmsg);
- return error;
- }
- }
- }
-
- return(0);
-
-}
-
-int send_getchilddoccollobj(int sockfd, hw_objectID objectID, hw_objrec ***childrec, int *count)
-{
- hg_msg msg, *retmsg;
- int length, error;
- char *tmp;
- int *childIDs = NULL;
-
- length = HEADER_LENGTH + sizeof(hw_objectID);
-
- build_msg_header(&msg, length, msgid++, GETCHILDDOCCOLL_MESSAGE);
-
- if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) {
-/* perror("send_command"); */
- lowerror = LE_MALLOC;
- return(-1);
- }
-
- tmp = build_msg_int(msg.buf, objectID);
- if ( send_hg_msg(sockfd, &msg, length) == -1 ) {
- efree(msg.buf);
- return(-1);
- }
- efree(msg.buf);
-
- retmsg = recv_hg_msg(sockfd);
- if ( retmsg != NULL ) {
- int *ptr, i;
-
- ptr = (int *) retmsg->buf;
- if(ptr == NULL) {
- if(retmsg->buf) efree(retmsg->buf);
- return -1;
- }
- if(*ptr++ == 0) {
- *count = *ptr++;
- if(NULL != (childIDs = emalloc(*count * sizeof(hw_objectID)))) {
- for(i=0; i<*count; ptr++, i++)
- childIDs[i] = *ptr;
- efree(retmsg->buf);
- efree(retmsg);
- } else {
- efree(retmsg->buf);
- efree(retmsg);
- lowerror = LE_MALLOC;
- return(-1);
- }
- } else {
- error = *((int *) retmsg->buf);
- efree(retmsg->buf);
- efree(retmsg);
- return error;
- }
- }
-
- /* Now get for each child collection the object record */
-#ifdef hw_less_server_stress
- if(0 != send_objectbyidquery(sockfd, childIDs, count, NULL, childrec)) {
- efree(childIDs);
- return -2;
- }
- efree(childIDs);
-#else
- for(i=0; i<*count; i++) {
- length = HEADER_LENGTH + sizeof(hw_objectID);
- build_msg_header(&msg, length, childIDs[i], GETOBJECT_MESSAGE);
-
- if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) {
-/* perror("send_command"); */
- lowerror = LE_MALLOC;
- return(-1);
- }
-
- tmp = build_msg_int(msg.buf, childIDs[i]);
-
- if ( send_hg_msg(sockfd, &msg, length) == -1 ) {
- efree(msg.buf);
- return(-1);
- }
-
- efree(msg.buf);
- }
-
- if(NULL == (objptr = (char **) emalloc(*count * sizeof(hw_objrec *)))) {
- /* if emalloc fails, get at least all remaining messages from server */
- for(i=0; i<*count; i++) {
- retmsg = recv_hg_msg(sockfd);
- efree(retmsg->buf);
- efree(retmsg);
- }
- *childrec = NULL;
- lowerror = LE_MALLOC;
- return(-1);
- } else {
- *childrec = objptr;
-
- for(i=0; i<*count; i++) {
- retmsg = recv_hg_msg(sockfd);
- if ( retmsg != NULL ) {
- if(0 == (int) *(retmsg->buf)) {
- *objptr = estrdup(retmsg->buf+sizeof(int));
- objptr++;
- efree(retmsg->buf);
- efree(retmsg);
- } else {
- *objptr = NULL;
- objptr++;
- efree(retmsg->buf);
- efree(retmsg);
- }
- }
- }
- }
-#endif
- return(0);
-}
-
-int send_getanchors(int sockfd, hw_objectID objectID, int **anchorIDs, int *count)
-{
- hg_msg msg, *retmsg;
- int length, error;
- char *tmp;
- int *ptr, i, *ptr1;
-
- length = HEADER_LENGTH + sizeof(hw_objectID);
-
- build_msg_header(&msg, length, msgid++, GETANCHORS_MESSAGE);
-
- if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) {
-/* perror("send_command"); */
- lowerror = LE_MALLOC;
- return(-1);
- }
-
- tmp = build_msg_int(msg.buf, objectID);
- if ( send_hg_msg(sockfd, &msg, length) == -1 ) {
- efree(msg.buf);
- return(-1);
- }
- efree(msg.buf);
-
- if (NULL == (retmsg = recv_hg_msg(sockfd)))
- return(-1);
-
- ptr = (int *) retmsg->buf;
- if(ptr == NULL) {
- if(retmsg) efree(retmsg);
- return -1;
- }
- if(*ptr++ == 0) {
- *count = *ptr++;
- if(NULL != (*anchorIDs = emalloc(*count * sizeof(hw_objectID)))) {
- ptr1 = *anchorIDs;
- for(i=0; i<*count; ptr++, i++)
- ptr1[i] = *ptr;
- efree(retmsg->buf);
- efree(retmsg);
- } else {
- efree(retmsg->buf);
- efree(retmsg);
- lowerror = LE_MALLOC;
- return(-1);
- }
- } else {
- error = *((int *) retmsg->buf);
- efree(retmsg->buf);
- efree(retmsg);
- return error;
- }
-
- return(0);
-}
-
-int send_getanchorsobj(int sockfd, hw_objectID objectID, char ***childrec, int *count)
-{
- hg_msg msg, *retmsg;
- int length, error;
- char *tmp;
- int *ptr, i, *ptr1;
- int *anchorIDs = NULL;
-
- length = HEADER_LENGTH + sizeof(hw_objectID);
-
- build_msg_header(&msg, length, 50, GETANCHORS_MESSAGE);
-
- if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) {
-/* perror("send_command"); */
- lowerror = LE_MALLOC;
- return(-1);
- }
-
- tmp = build_msg_int(msg.buf, objectID);
- if ( send_hg_msg(sockfd, &msg, length) == -1 ) {
- efree(msg.buf);
- return(-1);
- }
- efree(msg.buf);
-
- if (NULL == (retmsg = recv_hg_msg(sockfd)))
- return(-1);
-
- ptr = (int *) retmsg->buf;
- if(ptr == NULL) {
- if(retmsg) efree(retmsg);
- return -1;
- }
- if(*ptr++ == 0) {
- *count = *ptr++;
- if(NULL != (anchorIDs = emalloc(*count * sizeof(hw_objectID)))) {
- ptr1 = anchorIDs;
- for(i=0; i<*count; ptr++, i++)
- ptr1[i] = *ptr;
- efree(retmsg->buf);
- efree(retmsg);
- } else {
- efree(retmsg->buf);
- efree(retmsg);
- lowerror = LE_MALLOC;
- return(-1);
- }
- } else {
- error = *((int *) retmsg->buf);
- efree(retmsg->buf);
- efree(retmsg);
- return error;
- }
-
- /* Now get for each anchor the object record */
-#ifdef hw_less_server_stress
- if(0 != send_objectbyidquery(sockfd, anchorIDs, count, NULL, childrec)) {
- efree(anchorIDs);
- return -2;
- }
- efree(anchorIDs);
-#else
- for(i=0; i<*count; i++) {
-
- length = HEADER_LENGTH + sizeof(hw_objectID);
- build_msg_header(&msg, length, anchorIDs[i], GETOBJECT_MESSAGE);
-
- if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) {
-/* perror("send_command"); */
- lowerror = LE_MALLOC;
- return(-1);
- }
-
- tmp = build_msg_int(msg.buf, anchorIDs[i]);
-
- if ( send_hg_msg(sockfd, &msg, length) == -1 ) {
- efree(msg.buf);
- return(-1);
- }
-
- efree(msg.buf);
- }
- if(anchorIDs) efree(anchorIDs);
-
- if(NULL == (objptr = (char **) emalloc(*count * sizeof(hw_objrec *)))) {
- /* if emalloc fails, get at least all remaining messages from server */
- for(i=0; i<*count; i++) {
- retmsg = recv_hg_msg(sockfd);
- efree(retmsg->buf);
- efree(retmsg);
- }
- *childrec = NULL;
- lowerror = LE_MALLOC;
- return(-1);
- } else {
- *childrec = objptr;
-
- for(i=0; i<*count; i++) {
- retmsg = recv_hg_msg(sockfd);
- if ( retmsg != NULL ) {
- if(0 == (int) *(retmsg->buf)) {
- *objptr = estrdup(retmsg->buf+sizeof(int));
- objptr++;
- efree(retmsg->buf);
- efree(retmsg);
- } else {
- *objptr = NULL;
- objptr++;
- efree(retmsg->buf);
- efree(retmsg);
- }
- }
- }
- }
-#endif
- return(0);
-}
-
-int send_getdestforanchorsobj(int sockfd, char **anchorrec, char ***destrec, int count)
-{
- int i;
- char *objptr, **destptr;
- char *str;
- int objectID;
-
- if(NULL == (destptr = (char **) emalloc(count * sizeof(hw_objrec *)))) {
- lowerror = LE_MALLOC;
- return -1;
- }
-
- /* Now get for each anchor the object record of its destination */
- for(i=0; i<count; i++) {
- /* if you retrieve the anchors you sometimes get more than actually accessible.
- */
- if((NULL != anchorrec[i]) && (NULL != (str = fnAttributeValue(anchorrec[i], "Dest")))) {
- sscanf(str, "0x%x", &objectID);
- efree(str);
-
- /* Using send_docbyanchorobj() makes sense because the Destination can
- be both, an anchor or a document. If it is a document you get the
- objectrecord of that document. If it is an anchor the function
- graps the document which belongs to the anchor
- and you get also the objectrecord of that document.
- */
- if(0 > send_docbyanchorobj(sockfd, objectID, &objptr)) {
- efree(destptr);
- return -1;
- }
- destptr[i] = objptr;
- /* if we can't get the object rec of the dest, than this document
- is probably not accessible for us. For later functions simply
- set anchorrec[i] to NULL */
- if(destptr[i] == NULL) {
- if(anchorrec[i]) efree(anchorrec[i]);
- anchorrec[i] = NULL;
- }
- } else {
- destptr[i] = NULL;
- }
- }
- *destrec = destptr;
-
- return(0);
-}
-
-int send_getreldestforanchorsobj(int sockfd, char **anchorrec, char ***reldestrec, int count, int rootID, int thisID)
-{
- int i;
- char *docofanchorptr, **reldestptr;
- char *str;
- int destobjectID;
-
- if(NULL == (reldestptr = (char **) emalloc(count * sizeof(char *)))) {
- lowerror = LE_MALLOC;
- return -1;
- }
-
- /* Now get for each anchor the object record of its destination */
- for(i=0; i<count; i++) {
- /* if you retrieve the anchors you sometimes get more than actually accessible.
- */
- if((NULL != anchorrec[i]) && (NULL != (str = fnAttributeValue(anchorrec[i], "Dest")))) {
- sscanf(str, "0x%x", &destobjectID);
- efree(str);
-
- /* See note in send_getdestforanchorsobj() at same position in source code */
- if(0 > send_docbyanchorobj(sockfd, destobjectID, &docofanchorptr)) {
- efree(reldestptr);
- return -1;
- }
-
- reldestptr[i] = docofanchorptr;
- /* if we can't get the object rec of the dest, than this document
- is probably not accessible for us. For later functions simply
- set anchorrec[i] to NULL */
- if(reldestptr[i] == NULL) {
- if(anchorrec[i]) efree(anchorrec[i]);
- anchorrec[i] = NULL;
- } else {
- int j, *retthisIDs, *retdestIDs, equaltill, mincount, countthis, countdest, destdocid;
- char destdocname[200];
- char anchorstr[300];
- char temp[200];
- char *strptr;
-
- if(NULL != (str = strstr(docofanchorptr, "Name="))) {
- str += 5;
- sscanf(str, "%s\n", destdocname);
- }
- if(NULL != (str = strstr(docofanchorptr, "ObjectID="))) {
- str += 9;
- sscanf(str, "0x%X", &destdocid);
- }
-
- send_incollections(sockfd, 1, 1, &thisID, 1, &rootID, &countthis, &retthisIDs);
- send_incollections(sockfd, 1, 1, &destdocid, 1, &rootID, &countdest, &retdestIDs);
-
-/*
-fprintf(stderr, "%d: ", thisID);
-for(k=0; k<countthis; k++)
- fprintf(stderr,"%d, ", retthisIDs[k]);
-fprintf(stderr,"\n");
-fprintf(stderr,"%d: ", destdocid);
-for(k=0; k<countdest; k++)
- fprintf(stderr,"%d: %d, ", destdocid, retdestIDs[k]);
-fprintf(stderr,"\n");
-*/
-
- mincount = (countthis < countdest) ? countthis : countdest;
- for(j=0; (j<mincount) && (retthisIDs[j]==retdestIDs[j]); j++)
- ;
- equaltill = j;
- strcpy(anchorstr, "Name=");
- for(j=equaltill; j<countthis; j++)
- strcat(anchorstr, "../");
- strcat(anchorstr, "./");
- for(j=equaltill; j<countdest; j++) {
- char *temprec, tempname[100];
- send_getobject(sockfd, retdestIDs[j], &temprec);
- if(NULL != (str = strstr(temprec, "Name="))) {
- str += 5;
- sscanf(str, "%s\n", tempname);
- } else if(NULL != (str = strstr(temprec, "ObjectID="))) {
- str += 9;
- sscanf(str, "%s\n", tempname);
- }
-
- sprintf(temp, "%s", tempname);
- strptr = temp;
- while(*strptr != '\0') {
- if(*strptr == '/')
- *strptr = '_';
- strptr++;
- }
-/* fprintf(stderr, "Adding '%s' to '%s'\n", temp, anchorstr); */
- strcat(anchorstr, temp);
- strcat(anchorstr, "/");
-/* fprintf(stderr, "Is now '%s'\n", anchorstr); */
- efree(temprec);
- }
- /* if the anchor destination is a collection it may not be added anymore. */
- if(destdocid != retdestIDs[countdest-1]) {
- strptr = destdocname;
- while(*strptr != '\0') {
- if(*strptr == '/')
- *strptr = '_';
- strptr++;
- }
- strcat(anchorstr, destdocname);
- } else {
- strcat(anchorstr, "index.html");
- }
- strcat(anchorstr, "\n");
- sprintf(temp, "ObjectID=0x%x", destdocid);
- strcat(anchorstr, temp);
-/* fprintf(stderr, "%s\n", anchorstr); */
- efree(retthisIDs);
- efree(retdestIDs);
- efree(reldestptr[i]);
- reldestptr[i] = estrdup(anchorstr);
- }
- } else {
- reldestptr[i] = NULL;
- }
- }
- *reldestrec = reldestptr;
-
- return(0);
-}
-
-int fn_findpath(int sockfd, int *retIDs, int count, int id) {
- int *pathIDs;
- int *parentIDs, pcount, pid;
- int u, j, i;
-
- if(NULL == (pathIDs = emalloc(count * sizeof(int)))) {
- lowerror = LE_MALLOC;
- return -1;
- }
- u = count-1;
- pid = id;
- pcount = 1;
- /* FIXME but parentIDs is not set at this point, why checking it? */
- while((u >= 0) && (pcount != 0) && (parentIDs != NULL) && (pid != 0)) {
-/*fprintf(stderr, "Get parents for %d\n", pid); */
- if(0 != send_getparents(sockfd, pid, &parentIDs, &pcount)) {
- efree(pathIDs);
- return -1;
- }
- pid = 0;
- for(i=0; i<pcount; i++) {
- for(j=0; j<count; j++) {
- if(parentIDs[i] == retIDs[j]) {
- pathIDs[u--] = retIDs[j];
- pid = retIDs[j];
- }
- }
- }
- if(pid == 0)
- fprintf(stderr, "parent not found in list\n");
- if(parentIDs) efree(parentIDs);
- }
-/*fprintf(stderr, "sorted path: "); */
- for(i=0; i<count; i++) {
- retIDs[i] = pathIDs[i];
-/*fprintf(stderr, "%d, ", retIDs[i]); */
- }
-/*fprintf(stderr, "\n"); */
- efree(pathIDs);
- return 0;
-}
-
-/********************************************************************
-* function getrellink() *
-* *
-* Returns the link to point from document with ID sourceID to *
-* document with id destID. *
-********************************************************************/
-int getrellink(int sockfd, int rootID, int thisID, int destID, char **reldeststr) {
- int i, j, k, *retthisIDs, *retdestIDs, equaltill, count, mincount, countthis, countdest;
- char anchorstr[300];
- char temp[200];
- char *strptr;
-
- send_incollections(sockfd, 1, 1, &thisID, 1, &rootID, &countthis, &retthisIDs);
- send_incollections(sockfd, 1, 1, &destID, 1, &rootID, &countdest, &retdestIDs);
-
-
-fprintf(stderr, "%d: ", thisID);
-for(k=0; k<countthis; k++)
- fprintf(stderr,"%d, ", retthisIDs[k]);
-fprintf(stderr,"\n");
-fprintf(stderr,"%d: ", destID);
-for(k=0; k<countdest; k++)
- fprintf(stderr,"%d, ", retdestIDs[k]);
-fprintf(stderr,"\n");
-
- /*
- ** The message incollections returned a list of collections
- ** in which the destID or thisID is contained. Unfortunately
- ** this list ist not the path for the destID or thisID, but
- ** a sorted list of collection IDs. If for example you are
- ** looking for an ID 20 which has a path 1 -> 5 -> 4 -> 20
- ** (this means: 20 is child of 4, 4 is child of 5, 5 is child
- ** of 1) it will return 1,4,5 instead of 1,5,4
- ** Consequently, we have to create the correct path, by checking
- ** for the parents and identifying it in the list.
- ** But there is another problem. If the id for which the list of
- ** of collection is generated is a colletion itself, it will
- ** show up in the list as well. In order to make the algorithmn
- ** work proberly it has to be the last member of the list.
- */
- for(i=0; i<countdest; i++)
- if(retdestIDs[i] == destID) {
- retdestIDs[i] = retdestIDs[countdest-1];
- retdestIDs[countdest-1] = destID;
- }
- count = (retdestIDs[countdest-1] == destID) ? countdest-1 : countdest;
- if(0 != fn_findpath(sockfd, retdestIDs, count, destID)) {
- efree(retthisIDs);
- efree(retdestIDs);
- return -1;
- }
- for(i=0; i<countthis; i++)
- if(retthisIDs[i] == thisID) {
- retthisIDs[i] = retthisIDs[countthis-1];
- retthisIDs[countthis-1] = thisID;
- }
- count = (retthisIDs[countthis-1] == thisID) ? countthis-1 : countthis;
- if(0 != fn_findpath(sockfd, retthisIDs, count, thisID)) {
- efree(retthisIDs);
- efree(retdestIDs);
- return -1;
- }
-
- mincount = (countthis < countdest) ? countthis : countdest;
-fprintf(stderr,"mincount = %d\n", mincount);
- for(j=0; (j<mincount) && (retthisIDs[j]==retdestIDs[j]); j++)
- ;
- equaltill = j;
-fprintf(stderr, "first unequal = %d\n", j);
- strcpy(anchorstr, "");
- for(j=equaltill; j<countthis; j++)
- strcat(anchorstr, "../");
- strcat(anchorstr, "./");
- for(j=equaltill; j<countdest; j++) {
- char *temprec, *str, tempname[100];
- if(0 == send_getobject(sockfd, retdestIDs[j], &temprec)) {
- if(NULL != (str = strstr(temprec, "Name="))) {
- str += 5;
- sscanf(str, "%s\n", tempname);
- } else if(NULL != (str = strstr(temprec, "ObjectID="))) {
- str += 9;
- sscanf(str, "%s\n", tempname);
- }
-
- sprintf(temp, "%s", tempname);
- strptr = temp;
- while(*strptr != '\0') {
- if(*strptr == '/')
- *strptr = '_';
- strptr++;
- }
-fprintf(stderr, "Adding '%s' (%d) to '%s'\n", temp, retdestIDs[j], anchorstr);
- strcat(anchorstr, temp);
- strcat(anchorstr, "/");
-fprintf(stderr, "Is now '%s'\n", anchorstr);
- efree(temprec);
- } else {
- strcat(anchorstr, "No access/");
- }
- }
- /* if the anchor destination is a collection it may not be added anymore. */
- if(destID != retdestIDs[countdest-1]) {
- char destdocname[100], *str;
- send_getobject(sockfd, destID, &str);
- if(NULL != (strptr = strstr(str, "Name="))) {
- strptr += 5;
- sscanf(strptr, "%s\n", destdocname);
- }
- strptr = destdocname;
- while(*strptr != '\0') {
- if(*strptr == '/')
- *strptr = '_';
- strptr++;
- }
- strcat(anchorstr, destdocname);
- efree(str);
- } else {
-/* strcat(anchorstr, "index.html"); */
- }
-/*fprintf(stderr, "%s\n", anchorstr); */
- efree(retthisIDs);
- efree(retdestIDs);
- *reldeststr = estrdup(anchorstr);
- return 0;
-}
-
-int send_identify(int sockfd, char *name, char *passwd, char **userdata) {
- hg_msg msg, *retmsg;
- int length;
- char *tmp;
-
- length = HEADER_LENGTH + sizeof(int) + strlen(name) + 1 + strlen(passwd) + 1;
-
- build_msg_header(&msg, length, msgid++, IDENTIFY_MESSAGE);
-
- if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) {
-/* perror("send_command"); */
- lowerror = LE_MALLOC;
- return(-1);
- }
-
- tmp = build_msg_int(msg.buf, 0);
- tmp = build_msg_str(tmp, name);
- tmp = build_msg_str(tmp, passwd);
-
- if ( send_hg_msg(sockfd, &msg, length) == -1 ) {
- efree(msg.buf);
- return(-1);
- }
-
- efree(msg.buf);
- retmsg = recv_hg_msg(sockfd);
- if ( retmsg == NULL )
- return(-1);
-
- *userdata = (char *) retmsg->buf;
- efree(retmsg);
-
- return(0);
-}
-
-int send_objectbyidquery(int sockfd, hw_objectID *IDs, int *count, char *query, char ***objrecs)
-{
- hg_msg msg, *retmsg;
- int length;
- char *tmp, *str;
- int *ptr, i;
- int *offsets, *childIDs;
- char **childrec;
-
- if(*count <= 0) {
- *objrecs = emalloc(0);
- return(0);
- }
- length = HEADER_LENGTH + sizeof(int) + sizeof(int) + *count * sizeof(hw_objectID);
- if(query)
- length = length + strlen(query) + 1;
-
- build_msg_header(&msg, length, msgid++, OBJECTBYIDQUERY_MESSAGE);
-
- if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) {
- lowerror = LE_MALLOC;
- return(-1);
- }
-
- tmp = build_msg_int(msg.buf, 1);
- tmp = build_msg_int(tmp, *count);
- for(i=0; i<*count; i++)
- tmp = build_msg_int(tmp, IDs[i]);
- if(query)
- tmp = build_msg_str(tmp, query);
-
- if ( send_hg_msg(sockfd, &msg, length) == -1 ) {
- efree(msg.buf);
- return(-1);
- }
- efree(msg.buf);
-
-#ifdef hw_optimize
- {
- int hg_error;
- int c, allc;
-
- allc = 0;
- retmsg = recv_hg_msg_head(sockfd);
- if ( retmsg == NULL )
- return(-1);
-
- /* read error field */
- if ( (c = hg_read_exact(sockfd, (char *) &hg_error, 4)) == -1 ) {
- if(retmsg) efree(retmsg);
- return(-2);
- }
- allc += c;
-
- if(hg_error) {
- if(retmsg) efree(retmsg);
- return(-3);
- }
-
- /* read count field */
- if ( (c = hg_read_exact(sockfd, (char *) count, 4)) == -1 ) {
- if(retmsg) efree(retmsg);
- return(-2);
- }
- allc += c;
-
- if(NULL != (childIDs = emalloc(*count * sizeof(hw_objectID)))) {
- if((c = hg_read_exact(sockfd, (char *) childIDs, *count * sizeof(hw_objectID))) == -1) {
- efree(childIDs);
- if(retmsg) efree(retmsg);
- return(-3);
- }
- } else {
- efree(retmsg);
- lowerror = LE_MALLOC;
- return(-4);
- }
- allc += c;
-
- if(NULL != (offsets = emalloc(*count * sizeof(int)))) {
- if((c = hg_read_exact(sockfd, (char *) offsets, *count * sizeof(int))) == -1) {
- efree(childIDs);
- efree(offsets);
- if(retmsg) efree(retmsg);
- return(-5);
- }
- } else {
- efree(retmsg);
- efree(childIDs);
- lowerror = LE_MALLOC;
- return(-6);
- }
- allc += c;
-
- str = (char *)ptr;
- if(NULL == (childrec = (char **) emalloc(*count * sizeof(hw_objrec *)))) {
- efree(offsets);
- efree(childIDs);
- efree(retmsg);
- lowerror = LE_MALLOC;
- return(-1);
- } else {
- for(i=0; i<*count; i++) {
- char *ptr;
- childrec[i] = emalloc(offsets[i] + 1);
- ptr = childrec[i];
- c = hg_read_exact(sockfd, (char *) ptr, offsets[i]);
- ptr[c] = '\0';
- allc += c;
- }
- /* Reading the trailing '\0' */
- c = hg_read_exact(sockfd, (char *) &hg_error, 1);
- *objrecs = childrec;
- }
- }
-#else
- retmsg = recv_hg_msg(sockfd);
- if ( retmsg == NULL )
- return(-1);
-
- ptr = (int *) retmsg->buf;
- if(ptr == NULL) {
- if(retmsg) efree(retmsg);
- return -1;
- }
- if(*ptr++ != 0) {
- error = *((int *) retmsg->buf);
- efree(retmsg->buf);
- efree(retmsg);
- return error;
- }
-
- *count = *ptr++;
- if(NULL != (childIDs = emalloc(*count * sizeof(hw_objectID)))) {
- ptr1 = childIDs;
- for(i=0; i<*count; ptr++, i++)
- ptr1[i] = *ptr;
- if(NULL != (offsets = emalloc(*count * sizeof(int)))) {
- ptr1 = offsets;
- for(i=0; i<*count; ptr++, i++)
- ptr1[i] = *ptr;
- } else {
- efree(retmsg->buf);
- efree(retmsg);
- efree(childIDs);
- lowerror = LE_MALLOC;
- return(-1);
- }
- } else {
- efree(retmsg->buf);
- efree(retmsg);
- lowerror = LE_MALLOC;
- return(-1);
- }
-
- str = (char *)ptr;
- if(NULL == (childrec = (char **) emalloc(*count * sizeof(hw_objrec *)))) {
- efree(offsets);
- efree(childIDs);
- efree(retmsg->buf);
- efree(retmsg);
- lowerror = LE_MALLOC;
- return(-1);
- } else {
- for(i=0; i<*count; i++) {
- char *ptr;
- childrec[i] = emalloc(offsets[i] + 1);
- ptr = childrec[i];
- memcpy(ptr, str, offsets[i]);
- ptr[offsets[i]] = '\0';
- str += offsets[i];
- }
- *objrecs = childrec;
- }
-
- efree(retmsg->buf);
-#endif
-
- efree(retmsg);
- efree(childIDs);
- efree(offsets);
- return(0);
-}
-
-int send_getobjbyquery(int sockfd, char *query, int maxhits, hw_objectID **childIDs, int *count)
-{
- hg_msg msg, *retmsg;
- int length, error;
- char *tmp;
- int *ptr, i, *ptr1;
-
- length = HEADER_LENGTH + strlen(query) + 1;
-
- build_msg_header(&msg, length, msgid++, GETOBJBYQUERY_MESSAGE);
-
- if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) {
-/* perror("send_command"); */
- lowerror = LE_MALLOC;
- return(-1);
- }
-
- tmp = build_msg_str(msg.buf, query);
-
- if ( send_hg_msg(sockfd, &msg, length) == -1 ) {
- efree(msg.buf);
- return(-1);
- }
- efree(msg.buf);
- retmsg = recv_hg_msg(sockfd);
- if ( retmsg == NULL )
- return(-1);
-
- ptr = (int *) retmsg->buf;
- if(ptr == NULL) {
- if(retmsg) efree(retmsg);
- return -1;
- }
- if(*ptr++ == 0) {
- *count = (*ptr < maxhits) ? *ptr : maxhits;
- ptr++;
- if(NULL != (*childIDs = emalloc(*count * sizeof(hw_objectID)))) {
- ptr1 = *childIDs;
- for(i=0; i<*count; ptr++, i++)
- ptr1[i] = *ptr;
- efree(retmsg->buf);
- efree(retmsg);
- } else {
- efree(retmsg->buf);
- efree(retmsg);
- lowerror = LE_MALLOC;
- return(-1);
- }
- } else {
- error = *((int *) retmsg->buf);
- efree(retmsg->buf);
- efree(retmsg);
- return error;
- }
- return(0);
-}
-
-int send_getobjbyqueryobj(int sockfd, char *query, int maxhits, char ***childrec, int *count)
-{
- hg_msg msg, *retmsg;
- int length, i, error;
- char *tmp;
- int *childIDs = NULL;
- int *ptr, *ptr1;
-
- length = HEADER_LENGTH + strlen(query) + 1;
-
- build_msg_header(&msg, length, msgid++, GETOBJBYQUERY_MESSAGE);
-
- if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) {
-/* perror("send_command"); */
- lowerror = LE_MALLOC;
- return(-1);
- }
-
- tmp = build_msg_str(msg.buf, query);
-
- if ( send_hg_msg(sockfd, &msg, length) == -1 ) {
- efree(msg.buf);
- return(-2);
- }
-
- efree(msg.buf);
- retmsg = recv_hg_msg(sockfd);
- if ( retmsg == NULL )
- return(-3);
-
- ptr = (int *) retmsg->buf;
- if(ptr == NULL) {
- if(retmsg) efree(retmsg);
- return -4;
- }
- if(*ptr++ == 0) {
- *count = (*ptr < maxhits) ? *ptr : maxhits;
- ptr++;
- if(NULL != (childIDs = emalloc(*count * sizeof(hw_objectID)))) {
- ptr1 = childIDs;
- for(i=0; i<*count; ptr++, i++)
- ptr1[i] = *ptr;
- efree(retmsg->buf);
- efree(retmsg);
- } else {
- efree(retmsg->buf);
- efree(retmsg);
- lowerror = LE_MALLOC;
- return(-5);
- }
- } else {
- error = *((int *) retmsg->buf);
- efree(retmsg->buf);
- efree(retmsg);
- return error;
- }
-
- /* Now get for each child collection the object record */
-#ifdef hw_less_server_stress
- if(0 != send_objectbyidquery(sockfd, childIDs, count, NULL, childrec)) {
- efree(childIDs);
- return -2;
- }
- efree(childIDs);
-#else
- for(i=0; i<*count; i++) {
- length = HEADER_LENGTH + sizeof(hw_objectID);
- build_msg_header(&msg, length, childIDs[i], GETOBJECT_MESSAGE);
-
- if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) {
-/* perror("send_command"); */
- efree(childIDs);
- lowerror = LE_MALLOC;
- return(-6);
- }
-
- tmp = build_msg_int(msg.buf, childIDs[i]);
-
- if ( send_hg_msg(sockfd, &msg, length) == -1 ) {
- efree(msg.buf);
- efree(childIDs);
- return(-7);
- }
-
- efree(msg.buf);
- }
- efree(childIDs);
-
- if(NULL == (objptr = (char **) emalloc(*count * sizeof(hw_objrec *)))) {
- /* if emalloc fails, get at least all remaining messages from server */
- for(i=0; i<*count; i++) {
- retmsg = recv_hg_msg(sockfd);
- efree(retmsg->buf);
- efree(retmsg);
- }
- *childrec = NULL;
- lowerror = LE_MALLOC;
- return(-8);
- } else {
- *childrec = objptr;
-
- for(i=0; i<*count; i++) {
- retmsg = recv_hg_msg(sockfd);
- if ( retmsg != NULL ) {
- if(0 == (int) *(retmsg->buf)) {
- *objptr = estrdup(retmsg->buf+sizeof(int));
- objptr++;
- efree(retmsg->buf);
- efree(retmsg);
- } else {
- *objptr = NULL;
- objptr++;
- efree(retmsg->buf);
- efree(retmsg);
- }
- }
- }
- }
-#endif
- return(0);
-}
-
-int send_getobjbyquerycoll(int sockfd, hw_objectID collID, char *query, int maxhits, hw_objectID **childIDs, int *count)
-{
- hg_msg msg, *retmsg;
- int length, error;
- char *tmp;
- int *ptr, i, *ptr1;
-
- length = HEADER_LENGTH + strlen(query) + 1 + sizeof(int) + sizeof(collID);
-
- build_msg_header(&msg, length, msgid++, GETOBJBYQUERYCOLL_MESSAGE);
-
- if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) {
-/* perror("send_command"); */
- lowerror = LE_MALLOC;
- return(-1);
- }
-
- tmp = build_msg_int(msg.buf, 1);
- tmp = build_msg_int(tmp, collID);
- tmp = build_msg_str(tmp, query);
-
- if ( send_hg_msg(sockfd, &msg, length) == -1 ) {
- efree(msg.buf);
- return(-1);
- }
-
- efree(msg.buf);
- retmsg = recv_hg_msg(sockfd);
- if ( retmsg == NULL )
- return(-1);
-
- ptr = (int *) retmsg->buf;
- if(ptr == NULL) {
- if(retmsg) efree(retmsg);
- return -1;
- }
- if(*ptr++ == 0) {
- *count = (*ptr < maxhits) ? *ptr : maxhits;
- ptr++;
- if(NULL != (*childIDs = emalloc(*count * sizeof(hw_objectID)))) {
- ptr1 = *childIDs;
- for(i=0; i<*count; ptr++, i++)
- ptr1[i] = *ptr;
- efree(retmsg->buf);
- efree(retmsg);
- } else {
- efree(retmsg->buf);
- efree(retmsg);
- lowerror = LE_MALLOC;
- return(-1);
- }
- } else {
- error = *((int *) retmsg->buf);
- efree(retmsg->buf);
- efree(retmsg);
- return error;
- }
- return(0);
-}
-
-int send_getobjbyquerycollobj(int sockfd, hw_objectID collID, char *query, int maxhits, char ***childrec, int *count)
-{
- hg_msg msg, *retmsg;
- int length, i, error;
- char *tmp;
- hw_objectID *childIDs = NULL;
- int *ptr, *ptr1;
-
- length = HEADER_LENGTH + strlen(query) + 1 + sizeof(int) + sizeof(hw_objectID);
-
- build_msg_header(&msg, length, msgid++, GETOBJBYQUERYCOLL_MESSAGE);
-
- if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) {
-/* perror("send_command"); */
- lowerror = LE_MALLOC;
- return(-1);
- }
-
- tmp = build_msg_int(msg.buf, 1);
- tmp = build_msg_int(tmp, collID);
- tmp = build_msg_str(tmp, query);
-
- if ( send_hg_msg(sockfd, &msg, length) == -1 ) {
- efree(msg.buf);
- return(-1);
- }
-
- efree(msg.buf);
- retmsg = recv_hg_msg(sockfd);
- if ( retmsg == NULL )
- return -1;
-
- ptr = (int *) retmsg->buf;
- if(ptr == NULL) {
- if(retmsg) efree(retmsg);
- return -1;
- }
- if(*ptr++ == 0) {
- *count = (*ptr < maxhits) ? *ptr : maxhits;
- ptr++;
- if(NULL != (childIDs = emalloc(*count * sizeof(hw_objectID)))) {
- ptr1 = childIDs;
- for(i=0; i<*count; ptr++, i++)
- ptr1[i] = *ptr;
- efree(retmsg->buf);
- efree(retmsg);
- } else {
- efree(retmsg->buf);
- efree(retmsg);
- lowerror = LE_MALLOC;
- return(-1);
- }
- } else {
- error = *((int *) retmsg->buf);
- efree(retmsg->buf);
- efree(retmsg);
- return error;
- }
-
- /* Now get for each child collection the object record */
-#ifdef hw_less_server_stress
- if(0 != send_objectbyidquery(sockfd, childIDs, count, NULL, childrec)) {
- if(childIDs) efree(childIDs);
- return -2;
- }
- if(childIDs) efree(childIDs);
-#else
- for(i=0; i<*count; i++) {
- length = HEADER_LENGTH + sizeof(hw_objectID);
- build_msg_header(&msg, length, childIDs[i], GETOBJECT_MESSAGE);
-
- if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) {
-/* perror("send_command"); */
- efree(childIDs);
- lowerror = LE_MALLOC;
- return(-1);
- }
-
- tmp = build_msg_int(msg.buf, childIDs[i]);
-
- if ( send_hg_msg(sockfd, &msg, length) == -1 ) {
- efree(msg.buf);
- efree(childIDs);
- return(-1);
- }
-
- efree(msg.buf);
- }
- efree(childIDs);
-
- if(NULL == (objptr = (char **) emalloc(*count * sizeof(hw_objrec *)))) {
- /* if emalloc fails, get at least all remaining messages from server */
- for(i=0; i<*count; i++) {
- retmsg = recv_hg_msg(sockfd);
- efree(retmsg->buf);
- efree(retmsg);
- }
- *childrec = NULL;
- lowerror = LE_MALLOC;
- return(-1);
- } else {
- *childrec = objptr;
-
- for(i=0; i<*count; i++) {
- retmsg = recv_hg_msg(sockfd);
- if ( retmsg != NULL ) {
- if(0 == (int) *(retmsg->buf)) {
- *objptr = estrdup(retmsg->buf+sizeof(int));
- objptr++;
- efree(retmsg->buf);
- efree(retmsg);
- } else {
- *objptr = NULL;
- objptr++;
- efree(retmsg->buf);
- efree(retmsg);
- }
- }
- }
- }
-#endif
- return(0);
-}
-
-int send_getobjbyftquery(int sockfd, char *query, int maxhits, hw_objectID **childIDs, float **weights, int *count)
-{
- hg_msg msg, *retmsg;
- int length, error;
- char *tmp;
- int *ptr, i, *ptr1;
- float *ptr2;
-
- length = HEADER_LENGTH + strlen(query) + 1;
-
- build_msg_header(&msg, length, msgid++, GETOBJBYFTQUERY_MESSAGE);
-
- if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) {
- lowerror = LE_MALLOC;
- return(-1);
- }
-
- tmp = build_msg_str(msg.buf, query);
-
- if ( send_hg_msg(sockfd, &msg, length) == -1 ) {
- efree(msg.buf);
- return(-1);
- }
- efree(msg.buf);
- retmsg = recv_hg_msg(sockfd);
- if ( retmsg == NULL )
- return(-1);
-
- ptr = (int *) retmsg->buf;
- if(ptr == NULL) {
- if(retmsg) efree(retmsg);
- return -1;
- }
- if(*ptr++ == 0) {
- char *cptr, tmp[20];
- float weight;
- int j;
- *count = (*ptr < maxhits) ? *ptr : maxhits;
- ptr++;
- if(NULL != (*childIDs = emalloc(*count * sizeof(hw_objectID)))) {
- ptr1 = *childIDs;
- if(NULL != (*weights = emalloc(*count * sizeof(float)))) {
- ptr2 = *weights;
- for(i=0; i<*count; i++) {
- ptr1[i] = *ptr++; /* Object id */
- cptr = (char *) ptr;
- j = 0;
- while(*cptr != ' ') {
- tmp[j++] = *cptr++;
- }
- cptr++; /* Skip space after weight */
- tmp[j] = '\0';
- sscanf(tmp, "%f", &weight);
- ptr2[i] = weight;
- ptr = (int *) cptr;
- ptr++; /* Skip 0-Integer after weight string */
- }
- efree(retmsg->buf);
- efree(retmsg);
- } else {
- efree(*childIDs);
- efree(retmsg->buf);
- efree(retmsg);
- lowerror = LE_MALLOC;
- return(-1);
- }
- } else {
- efree(retmsg->buf);
- efree(retmsg);
- lowerror = LE_MALLOC;
- return(-1);
- }
- } else {
- error = *((int *) retmsg->buf);
- efree(retmsg->buf);
- efree(retmsg);
- return error;
- }
- return(0);
-}
-
-int send_getobjbyftqueryobj(int sockfd, char *query, int maxhits, char ***childrec, float **weights, int *count)
-{
- hg_msg msg, *retmsg;
- int length, i, error;
- char *tmp;
- int *childIDs = NULL;
- int *ptr, *ptr1;
- float *ptr2;
-
- length = HEADER_LENGTH + strlen(query) + 1;
-
- build_msg_header(&msg, length, msgid++, GETOBJBYFTQUERY_MESSAGE);
-
- if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) {
-/* perror("send_command"); */
- lowerror = LE_MALLOC;
- return(-1);
- }
-
- tmp = build_msg_str(msg.buf, query);
-
- if ( send_hg_msg(sockfd, &msg, length) == -1 ) {
- efree(msg.buf);
- return(-2);
- }
-
- efree(msg.buf);
- retmsg = recv_hg_msg(sockfd);
- if ( retmsg == NULL )
- return(-3);
-
- ptr = (int *) retmsg->buf;
- if(ptr == NULL) {
- if(retmsg) efree(retmsg);
- return -4;
- }
- if(*ptr++ == 0) {
- char *cptr, tmp[20];
- float weight;
- int j;
- *count = (*ptr < maxhits) ? *ptr : maxhits;
- ptr++;
- if(NULL != (childIDs = emalloc(*count * sizeof(hw_objectID)))) {
- ptr1 = childIDs;
- if(NULL != (*weights = emalloc(*count * sizeof(float)))) {
- ptr2 = *weights;
- for(i=0; i<*count; i++) {
- ptr1[i] = *ptr++; /* Object id */
- cptr = (char *) ptr;
- j = 0;
- while(*cptr != ' ') {
- tmp[j++] = *cptr++;
- }
- cptr++; /* Skip space after weight */
- tmp[j] = '\0';
- sscanf(tmp, "%f", &weight);
- ptr2[i] = weight;
- ptr = (int *) cptr;
- ptr++; /* Skip 0-Integer after weight string */
- }
- efree(retmsg->buf);
- efree(retmsg);
- } else {
- efree(childIDs);
- efree(retmsg->buf);
- efree(retmsg);
- lowerror = LE_MALLOC;
- return(-5);
- }
- } else {
- efree(retmsg->buf);
- efree(retmsg);
- lowerror = LE_MALLOC;
- return(-5);
- }
- } else {
- error = *((int *) retmsg->buf);
- efree(retmsg->buf);
- efree(retmsg);
- return error;
- }
-
- /* Now get for each child collection the object record */
-#ifdef hw_less_server_stress
- if(0 != send_objectbyidquery(sockfd, childIDs, count, NULL, childrec)) {
- efree(childIDs);
- efree(*weights);
- return -2;
- }
- efree(childIDs);
-#else
- for(i=0; i<*count; i++) {
- length = HEADER_LENGTH + sizeof(hw_objectID);
- build_msg_header(&msg, length, childIDs[i], GETOBJECT_MESSAGE);
-
- if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) {
- efree(childIDs);
- efree(*weights);
- lowerror = LE_MALLOC;
- return(-6);
- }
-
- tmp = build_msg_int(msg.buf, childIDs[i]);
-
- if ( send_hg_msg(sockfd, &msg, length) == -1 ) {
- efree(msg.buf);
- efree(childIDs);
- efree(*weights);
- return(-7);
- }
-
- efree(msg.buf);
- }
- efree(childIDs);
-
- if(NULL == (objptr = (char **) emalloc(*count * sizeof(hw_objrec *)))) {
- /* if emalloc fails, get at least all remaining messages from server */
- for(i=0; i<*count; i++) {
- retmsg = recv_hg_msg(sockfd);
- efree(retmsg->buf);
- efree(retmsg);
- }
- *childrec = NULL;
- lowerror = LE_MALLOC;
- return(-8);
- } else {
- *childrec = objptr;
-
- for(i=0; i<*count; i++) {
- retmsg = recv_hg_msg(sockfd);
- if ( retmsg != NULL ) {
- if(0 == (int) *(retmsg->buf)) {
- *objptr = estrdup(retmsg->buf+sizeof(int));
- objptr++;
- efree(retmsg->buf);
- efree(retmsg);
- } else {
- *objptr = NULL;
- objptr++;
- efree(retmsg->buf);
- efree(retmsg);
- }
- }
- }
- }
-#endif
- return(0);
-}
-
-int send_getobjbyftquerycoll(int sockfd, hw_objectID collID, char *query, int maxhits, hw_objectID **childIDs, float **weights, int *count)
-{
- hg_msg msg, *retmsg;
- int length, error;
- char *tmp;
- int *ptr, i, *ptr1;
- float *ptr2;
-
- length = HEADER_LENGTH + strlen(query) + 1 + sizeof(int) + sizeof(collID);
-
- build_msg_header(&msg, length, msgid++, GETOBJBYFTQUERYCOLL_MESSAGE);
-
- if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) {
- lowerror = LE_MALLOC;
- return(-1);
- }
-
- tmp = build_msg_int(msg.buf, 1);
- tmp = build_msg_int(tmp, collID);
- tmp = build_msg_str(tmp, query);
-
- if ( send_hg_msg(sockfd, &msg, length) == -1 ) {
- efree(msg.buf);
- return(-1);
- }
-
- efree(msg.buf);
- retmsg = recv_hg_msg(sockfd);
- if ( retmsg == NULL )
- return(-1);
-
- ptr = (int *) retmsg->buf;
- if(ptr == NULL) {
- if(retmsg) efree(retmsg);
- return -1;
- }
- if(*ptr++ == 0) {
- char *cptr, tmp[20];
- float weight;
- int j;
- *count = (*ptr < maxhits) ? *ptr : maxhits;
- ptr++;
- if(NULL != (*childIDs = emalloc(*count * sizeof(hw_objectID)))) {
- ptr1 = *childIDs;
- if(NULL != (*weights = emalloc(*count * sizeof(float)))) {
- ptr2 = *weights;
- for(i=0; i<*count; i++) {
- ptr1[i] = *ptr++; /* Object id */
- cptr = (char *) ptr;
- j = 0;
- while(*cptr != ' ') {
- tmp[j++] = *cptr++;
- }
- cptr++; /* Skip space after weight */
- tmp[j] = '\0';
- sscanf(tmp, "%f", &weight);
- ptr2[i] = weight;
- ptr = (int *) cptr;
- ptr++; /* Skip 0-Integer after weight string */
- }
- } else {
- efree(*childIDs);
- efree(retmsg->buf);
- efree(retmsg);
- lowerror = LE_MALLOC;
- return(-1);
- }
- efree(retmsg->buf);
- efree(retmsg);
- } else {
- efree(retmsg->buf);
- efree(retmsg);
- lowerror = LE_MALLOC;
- return(-1);
- }
- } else {
- error = *((int *) retmsg->buf);
- efree(retmsg->buf);
- efree(retmsg);
- return error;
- }
- return(0);
-}
-
-int send_getobjbyftquerycollobj(int sockfd, hw_objectID collID, char *query, int maxhits, char ***childrec, float **weights, int *count)
-{
- hg_msg msg, *retmsg;
- int length, i, error;
- char *tmp;
- hw_objectID *childIDs = NULL;
- int *ptr, *ptr1;
- float *ptr2;
-
- length = HEADER_LENGTH + strlen(query) + 1 + sizeof(int) + sizeof(hw_objectID);
-
- build_msg_header(&msg, length, msgid++, GETOBJBYFTQUERYCOLL_MESSAGE);
-
- if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) {
- lowerror = LE_MALLOC;
- return(-1);
- }
-
- tmp = build_msg_int(msg.buf, 1);
- tmp = build_msg_int(tmp, collID);
- tmp = build_msg_str(tmp, query);
-
- if ( send_hg_msg(sockfd, &msg, length) == -1 ) {
- efree(msg.buf);
- return(-1);
- }
-
- efree(msg.buf);
- retmsg = recv_hg_msg(sockfd);
- if ( retmsg == NULL )
- return -1;
-
- ptr = (int *) retmsg->buf;
- if(ptr == NULL) {
- if(retmsg) efree(retmsg);
- return -1;
- }
- if(*ptr++ == 0) {
- char *cptr, tmp[20];
- float weight;
- int j;
- *count = (*ptr < maxhits) ? *ptr : maxhits;
- ptr++;
- if(NULL != (childIDs = emalloc(*count * sizeof(hw_objectID)))) {
- ptr1 = childIDs;
- if(NULL != (*weights = emalloc(*count * sizeof(float)))) {
- ptr2 = *weights;
- for(i=0; i<*count; i++) {
- ptr1[i] = *ptr++; /* Object id */
- cptr = (char *) ptr;
- j = 0;
- while(*cptr != ' ') {
- tmp[j++] = *cptr++;
- }
- cptr++; /* Skip space after weight */
- tmp[j] = '\0';
- sscanf(tmp, "%f", &weight);
- ptr2[i] = weight;
- ptr = (int *) cptr;
- ptr++; /* Skip 0-Integer after weight string */
- }
- efree(retmsg->buf);
- efree(retmsg);
- } else {
- efree(childIDs);
- efree(retmsg->buf);
- efree(retmsg);
- lowerror = LE_MALLOC;
- return(-1);
- }
- } else {
- efree(retmsg->buf);
- efree(retmsg);
- lowerror = LE_MALLOC;
- return(-1);
- }
- } else {
- error = *((int *) retmsg->buf);
- efree(retmsg->buf);
- efree(retmsg);
- return error;
- }
-
- /* Now get for each child collection the object record */
-#ifdef hw_less_server_stress
- if(0 != send_objectbyidquery(sockfd, childIDs, count, NULL, childrec)) {
- if(childIDs) efree(childIDs);
- if(*weights) efree(weights);
- return -2;
- }
- if(childIDs) efree(childIDs);
-#else
- for(i=0; i<*count; i++) {
- length = HEADER_LENGTH + sizeof(hw_objectID);
- build_msg_header(&msg, length, childIDs[i], GETOBJECT_MESSAGE);
-
- if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) {
-/* perror("send_command"); */
- efree(childIDs);
- efree(*weights);
- lowerror = LE_MALLOC;
- return(-1);
- }
-
- tmp = build_msg_int(msg.buf, childIDs[i]);
-
- if ( send_hg_msg(sockfd, &msg, length) == -1 ) {
- efree(msg.buf);
- efree(childIDs);
- efree(*weights);
- return(-1);
- }
-
- efree(msg.buf);
- }
- efree(childIDs);
-
- if(NULL == (objptr = (char **) emalloc(*count * sizeof(hw_objrec *)))) {
- /* if emalloc fails, get at least all remaining messages from server */
- for(i=0; i<*count; i++) {
- retmsg = recv_hg_msg(sockfd);
- efree(retmsg->buf);
- efree(retmsg);
- }
- *childrec = NULL;
- lowerror = LE_MALLOC;
- return(-1);
- } else {
- *childrec = objptr;
-
- for(i=0; i<*count; i++) {
- retmsg = recv_hg_msg(sockfd);
- if ( retmsg != NULL ) {
- if(0 == (int) *(retmsg->buf)) {
- *objptr = estrdup(retmsg->buf+sizeof(int));
- objptr++;
- efree(retmsg->buf);
- efree(retmsg);
- } else {
- *objptr = NULL;
- objptr++;
- efree(retmsg->buf);
- efree(retmsg);
- }
- }
- }
- }
-#endif
- return(0);
-}
-
-int send_getparents(int sockfd, hw_objectID objectID, hw_objectID **childIDs, int *count)
-{
- hg_msg msg, *retmsg;
- int length, i, error;
- char *tmp;
- int *ptr, *ptr1;
-
- length = HEADER_LENGTH + sizeof(hw_objectID);
-
- build_msg_header(&msg, length, msgid++, GETPARENT_MESSAGE);
-
- if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) {
-/* perror("send_command"); */
- lowerror = LE_MALLOC;
- return(-1);
- }
-
- tmp = build_msg_int(msg.buf, objectID);
-
- if (-1 == send_hg_msg(sockfd, &msg, length)) {
- efree(msg.buf);
- return(-2);
- }
-
- efree(msg.buf);
- retmsg = recv_hg_msg(sockfd);
- if ( retmsg == NULL ) {
- return(-3);
- }
-
- ptr = (int *) retmsg->buf;
- if(ptr == NULL) {
- if(retmsg) efree(retmsg);
- return -1;
- }
- if(*ptr++ == 0) {
- *count = *ptr++;
- if(NULL != (*childIDs = emalloc(*count * sizeof(hw_objectID)))) {
- ptr1 = *childIDs;
- for(i=0; i<*count; ptr++, i++)
- ptr1[i] = *ptr;
- efree(retmsg->buf);
- efree(retmsg);
- } else {
- efree(retmsg->buf);
- efree(retmsg);
- lowerror = LE_MALLOC;
- return(-1);
- }
- } else {
- error = *((int *) retmsg->buf);
- efree(retmsg->buf);
- efree(retmsg);
- return error;
- }
-
- return(0);
-}
-
-int send_getparentsobj(int sockfd, hw_objectID objectID, char ***childrec, int *count)
-{
- hg_msg msg, *retmsg;
- int length, i, error;
- char *tmp;
- hw_objectID *childIDs = NULL;
- int *ptr;
-
- length = HEADER_LENGTH + sizeof(hw_objectID);
-
- build_msg_header(&msg, length, msgid++, GETPARENT_MESSAGE);
-
- if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) {
-/* perror("send_command"); */
- lowerror = LE_MALLOC;
- return(-1);
- }
-
- tmp = build_msg_int(msg.buf, objectID);
-
- if (-1 == send_hg_msg(sockfd, &msg, length)) {
- efree(msg.buf);
- return(-1);
- }
-
- efree(msg.buf);
- retmsg = recv_hg_msg(sockfd);
- if ( retmsg == NULL ) {
- return(-1);
- }
-
- ptr = (int *) retmsg->buf;
- if(ptr == NULL) {
- if(retmsg) efree(retmsg);
- return -1;
- }
- if(*ptr++ == 0) {
- *count = *ptr++;
- if(NULL != (childIDs = emalloc(*count * sizeof(hw_objectID)))) {
- for(i=0; i<*count; ptr++, i++)
- childIDs[i] = *ptr;
- efree(retmsg->buf);
- efree(retmsg);
- } else {
- efree(retmsg->buf);
- efree(retmsg);
- lowerror = LE_MALLOC;
- return(-1);
- }
- } else {
- error = *((int *) retmsg->buf);
- efree(retmsg->buf);
- efree(retmsg);
- return error;
- }
-
- /* Now get for each parent the object record */
-#ifdef hw_less_server_stress
- if(0 != send_objectbyidquery(sockfd, childIDs, count, NULL, childrec)) {
- efree(childIDs);
- return -2;
- }
- efree(childIDs);
-#else
- for(i=0; i<*count; i++) {
- length = HEADER_LENGTH + sizeof(hw_objectID);
- build_msg_header(&msg, length, childIDs[i], GETOBJECT_MESSAGE);
-
- if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) {
-/* perror("send_command"); */
- lowerror = LE_MALLOC;
- return(-1);
- }
-
- tmp = build_msg_int(msg.buf, childIDs[i]);
-
- if ( send_hg_msg(sockfd, &msg, length) == -1 ) {
- efree(msg.buf);
- return(-1);
- }
-
- efree(msg.buf);
- }
- efree(childIDs);
-
- if(NULL == (objptr = (char **) emalloc(*count * sizeof(hw_objrec *)))) {
- /* if emalloc fails, get at least all remaining messages from server */
- for(i=0; i<*count; i++) {
- retmsg = recv_hg_msg(sockfd);
- efree(retmsg->buf);
- efree(retmsg);
- }
- *childrec = NULL;
- lowerror = LE_MALLOC;
- return(-1);
- } else {
- *childrec = objptr;
-
- for(i=0; i<*count; i++) {
- retmsg = recv_hg_msg(sockfd);
- if ( retmsg != NULL ) {
- if(0 == (int) *(retmsg->buf)) {
- *objptr = estrdup(retmsg->buf+sizeof(int));
- objptr++;
- efree(retmsg->buf);
- efree(retmsg);
- } else {
- *objptr = NULL;
- objptr++;
- efree(retmsg->buf);
- efree(retmsg);
- }
- }
- }
- }
-#endif
- return(0);
-}
-
-int send_pipedocument(int sockfd, char *host, hw_objectID objectID, int mode, int rootid, char **objattr, char **bodytag, char **text, int *count, char **urlprefix)
-{
- hg_msg msg, *retmsg;
- int length, len;
- char *tmp, header[80], *head_ptr, *sizestr;
- struct sockaddr_in serv_addr;
- struct hostent *hostptr;
- char *hostip = NULL;
- char *attributes = NULL;
- char *documenttype;
- char **anchors;
- int newfd, fd, port, size, error, ancount;
- int *ptr;
-
- if(-1 == (fd = fnCOpenDataCon(sockfd, &port))) {
- /* not set yet efree(msg.buf); */
- return(-1);
- }
-
- /*
- ** Get information about host
- */
- if(host) {
- if((hostptr = gethostbyname(host)) == NULL) {
- HWSOCK_FCLOSE(fd);
- return(-2);
- }
- } else {
- HWSOCK_FCLOSE(fd);
- return(-2);
- }
-
- switch(hostptr->h_addrtype) {
- struct in_addr *ptr1;
- char *ptr;
- case AF_INET:
- ptr = hostptr->h_addr_list[0];
- ptr1 = (struct in_addr *) ptr;
- hostip = inet_ntoa(*ptr1);
- break;
- default:
- HWSOCK_FCLOSE(fd);
- return(-3);
- break;
- }
-
- /* Bottom half of send_getobject */
- if(0 > bh_send_getobject(sockfd, objectID)) {
- HWSOCK_FCLOSE(fd);
- return -4;
- }
-
- /* Upper half of send_getobject */
- if(0 > (error = uh_send_getobject(sockfd, &attributes))) {
- HWSOCK_FCLOSE(fd);
- return error;
- }
-
- length = HEADER_LENGTH + sizeof(hw_objectID) + sizeof(int) + strlen(hostip) + 1 + strlen("Refno=0x12345678") + 1;
- build_msg_header(&msg, length, msgid++, PIPEDOCUMENT_MESSAGE);
-
- if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) {
- if(attributes) efree(attributes);
- lowerror = LE_MALLOC;
- return(-5);
- }
-
- tmp = build_msg_int(msg.buf, objectID);
- tmp = build_msg_int(tmp, port);
- tmp = build_msg_str(tmp, hostip);
- tmp = build_msg_str(tmp, "Refno=0x12345678");
-
- if ( send_hg_msg(sockfd, &msg, length) == -1 ) {
- if(attributes) efree(attributes);
- efree(msg.buf);
- HWSOCK_FCLOSE(fd);
- return(-6);
- }
- efree(msg.buf);
-
- /* Just check if the command was understood */
- retmsg = recv_hg_msg(sockfd);
- if ( retmsg == NULL ) {
- if(attributes) efree(attributes);
- HWSOCK_FCLOSE(fd);
- return(-7);
- }
-
- ptr = (int *) retmsg->buf;
- if((ptr == NULL) || (*ptr != 0)) {
- error = *ptr;
- if(retmsg->buf) efree(retmsg->buf);
- efree(retmsg);
- if(attributes) efree(attributes);
- HWSOCK_FCLOSE(fd);
- return(error);
- }
-
- efree(retmsg->buf);
- efree(retmsg);
-
- /* passively open the data connection. The HG server is probably
- already waiting for us.
- */
- len = sizeof(serv_addr);
- if((newfd = accept(fd, (struct sockaddr *) &serv_addr, &len)) < 0) {
-/* php_printf("client: can't open data connection to server\n"); */
- if(attributes) efree(attributes);
- HWSOCK_FCLOSE(fd);
- return(-8);
- } else {
- HWSOCK_FCLOSE(fd);
- }
-
- /* First of all read the header */
- head_ptr = header;
- while((read_to(newfd, head_ptr, 1, rtimeout) == 1) && (*head_ptr != '\0')) {
- head_ptr++;
- }
-
- /* Let's see how big the document is and read it into var text */
- sizestr = strstr(header, "sz=");
- if(sizestr) {
- sizestr += 3;
- sscanf(sizestr, "%d\n", &size);
- *count = size;
- if((size != 0) && (NULL != (*text = malloc(size+1)))) {
- read_to(newfd, *text, size, rtimeout);
- (*text)[size] = '\0';
- }
- } else {
- *text = NULL;
- }
-
- /* close the data connection */
- HWSOCK_FCLOSE(newfd);
-
- documenttype = fnAttributeValue(attributes, "DocumentType");
-
- /* Make a copy with strdup (not estrdup), because we want to
- keep the attributes in hw_document struct.
- */
- *objattr = strdup(attributes);
- efree(attributes);
-
- if((documenttype != NULL) && (!strcmp(documenttype, "text") != 0)) {
- if(send_getanchorsobj(sockfd, objectID, &anchors, &ancount) == 0) {
- char **destrec, **reldestrec;
-#ifdef newlist
- zend_llist *pAnchorList = NULL;
-#else
- DLIST *pAnchorList = NULL;
-#endif
-
- /* Get dest as relative and absolut path */
- send_getdestforanchorsobj(sockfd, anchors, &destrec, ancount);
- send_getreldestforanchorsobj(sockfd, anchors, &reldestrec, ancount, rootid, objectID);
- pAnchorList = fnCreateAnchorList(objectID, anchors, destrec, reldestrec, ancount, mode);
- /* Free only the array, the objrecs has been freed in fnCreateAnchorList() */
- if(anchors) efree(anchors);
- if(destrec) efree(destrec);
- if(reldestrec) efree(reldestrec);
-
- if(pAnchorList != NULL) {
- char *newtext;
- char *body = NULL;
-
- newtext = fnInsAnchorsIntoText(*text, pAnchorList, &body, urlprefix);
-#ifdef newlist
- zend_llist_destroy(pAnchorList);
- efree(pAnchorList);
-#else
- dlst_kill(pAnchorList, fnDeleteAnchor);
-#endif
- *bodytag = strdup(body);
- if(body) efree(body);
- *text = newtext;
- *count = strlen(newtext);
- }
- }
- } else {
- *bodytag = NULL;
- }
-
- if(documenttype) efree(documenttype);
- return(0);
-}
-
-int send_pipecgi(int sockfd, char *host, hw_objectID objectID, char *cgi_env_str, char **objattr, char **text, int *count)
-{
- hg_msg msg, *retmsg;
- int length, len, new_attr_len;
- char *tmp, header[80], *head_ptr, *sizestr;
- struct sockaddr_in serv_addr;
- struct hostent *hostptr;
- char *hostip = NULL;
- char *attributes = NULL;
- char *documenttype, *new_attr;
- int newfd, fd, port, size, error;
- int *ptr;
-
- if(-1 == (fd = fnCOpenDataCon(sockfd, &port))) {
- /* not set yet? efree(msg.buf); */
- return(-1);
- }
-
- /*
- ** Get information about host
- */
- if(host) {
- if((hostptr = gethostbyname(host)) == NULL) {
- HWSOCK_FCLOSE(fd);
- return(-1);
- }
- } else {
- HWSOCK_FCLOSE(fd);
- return(-1);
- }
-
- switch(hostptr->h_addrtype) {
- struct in_addr *ptr1;
- char *ptr;
- case AF_INET:
- ptr = hostptr->h_addr_list[0];
- ptr1 = (struct in_addr *) ptr;
- hostip = inet_ntoa(*ptr1);
- break;
- default:
-/* php_printf(stderr, "unknown address type\n"); */
- break;
- }
-
- /* Bottom half of send_getobject */
- if(0 > bh_send_getobject(sockfd, objectID)) {
- HWSOCK_FCLOSE(fd);
- return -1;
- }
-
- /* Upper half of send_getobject */
- if(0 > (error = uh_send_getobject(sockfd, &attributes))) {
- HWSOCK_FCLOSE(fd);
- return error;
- }
-
- new_attr_len = strlen(attributes) + strlen(cgi_env_str) + 2;
- new_attr = malloc(new_attr_len);
- strcpy(new_attr, attributes);
- strcat(new_attr, cgi_env_str);
- length = HEADER_LENGTH + strlen(new_attr) + 1 + sizeof(int) + strlen(hostip) + 1 + sizeof(int) + sizeof(int);
- build_msg_header(&msg, length, msgid++, PIPECGI_MESSAGE);
-
- if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) {
- if(attributes) efree(attributes);
- lowerror = LE_MALLOC;
- return(-1);
- }
-
- tmp = build_msg_str(msg.buf, hostip);
- tmp = build_msg_int(tmp, port);
- tmp = build_msg_str(tmp, new_attr);
- tmp = build_msg_int(tmp, 1);
- tmp = build_msg_int(tmp, 0x12345678);
- free(new_attr);
-
- if ( send_hg_msg(sockfd, &msg, length) == -1 ) {
- if(attributes) efree(attributes);
- efree(msg.buf);
- HWSOCK_FCLOSE(fd);
- return(-1);
- }
- efree(msg.buf);
-
- /* Just check if the command was understood */
- retmsg = recv_hg_msg(sockfd);
- if ( retmsg == NULL ) {
- if(attributes) efree(attributes);
- HWSOCK_FCLOSE(fd);
- return(-1);
- }
-
- ptr = (int *) retmsg->buf;
- if((ptr == NULL) || (*ptr != 0)) {
- if(retmsg->buf) efree(retmsg->buf);
- efree(retmsg);
- if(attributes) efree(attributes);
- HWSOCK_FCLOSE(fd);
- return(-1);
- }
-
- efree(retmsg->buf);
- efree(retmsg);
-
- /* passively open the data connection. The HG server is probably
- already waiting for us.
- */
- len = sizeof(serv_addr);
- if((newfd = accept(fd, (struct sockaddr *) &serv_addr, &len)) < 0) {
- if(attributes) efree(attributes);
- HWSOCK_FCLOSE(fd);
- return(-1);
- } else {
- HWSOCK_FCLOSE(fd);
- }
-
- /* First of all read the header */
- head_ptr = header;
- while((read_to(newfd, head_ptr, 1, rtimeout) == 1) && (*head_ptr != '\0')) {
- head_ptr++;
- }
-
- /* Let's see how big the document is and read it into var text */
- sizestr = strstr(header, "sz=");
- if(sizestr) {
- sizestr += 3;
- sscanf(sizestr, "%d\n", &size);
- *count = size;
- if((size != 0) && (NULL != (*text = malloc(size+1)))) {
- read_to(newfd, *text, size, rtimeout);
- }
- } else {
- *text = NULL;
- }
-
- /* close the data connection */
- HWSOCK_FCLOSE(newfd);
-
- documenttype = fnAttributeValue(attributes, "DocumentType");
-
- /* Make a copy with strdup (not estrdup), because we want to
- keep the attributes in hw_document struct.
- */
- *objattr = strdup(attributes);
- efree(attributes);
-
- if(documenttype) efree(documenttype);
- return(0);
-}
-
-int send_putdocument(int sockfd, char *host, hw_objectID parentID, char *objectRec, char *text, int count, hw_objectID *objectID)
-{
- hg_msg msg, *retmsg;
- int length, len;
- char *tmp, header[80], parms[30], *head_ptr;
- struct sockaddr_in serv_addr;
- struct hostent *hostptr;
- char *hostip = NULL;
- int newfd, fd, port, error;
- int *ptr;
-
- /* First of all we have to insert the document record */
- sprintf(parms, "Parent=0x%x", parentID);
- length = HEADER_LENGTH + strlen(objectRec) + 1 + strlen(parms) + 1;
-
- build_msg_header(&msg, length, msgid++, INSERTOBJECT_MESSAGE);
-
- if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) {
-/* perror("send_command"); */
- lowerror = LE_MALLOC;
- return(-1);
- }
-
- tmp = build_msg_str(msg.buf, objectRec);
- tmp = build_msg_str(tmp, parms);
-
- if ( send_hg_msg(sockfd, &msg, length) == -1 ) {
- efree(msg.buf);
- return(-2);
- }
-
- efree(msg.buf);
- retmsg = recv_hg_msg(sockfd);
- if ( retmsg == NULL ) {
- return(-3);
- }
-
- ptr = (int *) retmsg->buf;
- if(0 == (error = *ptr)) {
- ptr++;
- *objectID = *ptr;
- } else {
- if(retmsg->buf) efree(retmsg->buf);
- efree(retmsg);
- return(error);
- }
-
- efree(retmsg->buf);
- efree(retmsg);
-
- /*
- ** Get information about host
- */
- if(host) {
- if((hostptr = gethostbyname(host)) == NULL) {
- /* close(fd); fd is not set yet */
- return(-4);
- }
- } else {
- /* close(fd); fd is not set yet */
- return(-5);
- }
-
- switch(hostptr->h_addrtype) {
- struct in_addr *ptr1;
- char *ptr;
- case AF_INET:
- ptr = hostptr->h_addr_list[0];
- ptr1 = (struct in_addr *) ptr;
- hostip = inet_ntoa(*ptr1);
- break;
- default:
-/* fprintf(stderr, "unknown address type\n"); */
- break;
- }
-
- if(-1 == (fd = fnCOpenDataCon(sockfd, &port))) {
- efree(msg.buf);
- return(-6);
- }
-
- /* Start building the PUTDOCUMENT message. I works even if
- the Refno is skipped. I guess the path can be omitted too. */
- length = HEADER_LENGTH + sizeof(hw_objectID) + sizeof(int) + strlen(hostip) + 1 + strlen("Hyperwave") + 1+ strlen("Refno=0x12345678") + 1;
-
- build_msg_header(&msg, length, msgid++, PUTDOCUMENT_MESSAGE);
-
- if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) {
- lowerror = LE_MALLOC;
- return(-7);
- }
-
- tmp = build_msg_int(msg.buf, *objectID);
- tmp = build_msg_int(tmp, port);
- tmp = build_msg_str(tmp, hostip);
- tmp = build_msg_str(tmp, "Hyperwave");
- tmp = build_msg_str(tmp, "Refno=0x12345678");
-
- if ( send_hg_msg(sockfd, &msg, length) == -1 ) {
- efree(msg.buf);
- HWSOCK_FCLOSE(fd);
- return(-8);
- }
- efree(msg.buf);
-
- /* passively open the data connection. The HG server is probably
- already waiting for us.
- */
- len = sizeof(serv_addr);
- if((newfd = accept(fd, (struct sockaddr *) &serv_addr, &len)) < 0) {
- HWSOCK_FCLOSE(fd);
- return(-9);
- } else {
- HWSOCK_FCLOSE(fd);
- }
-
- /* First of all write the header. According to the documentation
- there should be a header first. Well, after some investigation
- with tcpdump I found out, that Harmony and wavemaster don't
- sent it. The also do not sent the Refno in the PUTDOCUMENT msg.
- Anyway, we sent both. */
- head_ptr = header;
- sprintf(header, "HGHDR\nsz=%d\nref=12345678\n", count);
- len = strlen(header) + 1;
- if(len != write_to(newfd, header, len, wtimeout)) {
- HWSOCK_FCLOSE(newfd);
- return(-10);
- }
-
- /* And now the document */
- if(count != write_to(newfd, text, count, wtimeout)) {
- HWSOCK_FCLOSE(newfd);
- return(-11);
- }
-
- /* The data connection has to be close before the return
- msg can be read. The server will not sent it before. */
- HWSOCK_FCLOSE(newfd);
-
- /* Just check if the command was understood */
- retmsg = recv_hg_msg(sockfd);
- if ( retmsg == NULL ) {
- HWSOCK_FCLOSE(fd);
- return(-12);
- }
-
- ptr = (int *) retmsg->buf;
- if((ptr == NULL) || (*ptr != 0)) {
- if(retmsg->buf) efree(retmsg->buf);
- efree(retmsg);
- HWSOCK_FCLOSE(fd);
- return(-13);
- }
-
- efree(retmsg->buf);
- efree(retmsg);
-
- return(0);
-}
-
-int send_getsrcbydest(int sockfd, hw_objectID objectID, char ***childrec, int *count)
-{
- hg_msg msg, *retmsg;
- int length, i, error;
- char *tmp;
- int *childIDs = NULL;
- char **objptr;
- int *ptr, *ptr1;
-
- length = HEADER_LENGTH + sizeof(hw_objectID);
-
- build_msg_header(&msg, length, msgid++, GETSRCBYDEST_MESSAGE);
-
- if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) {
- lowerror = LE_MALLOC;
- return(-1);
- }
-
- tmp = build_msg_int(msg.buf, objectID);
-
- if ( send_hg_msg(sockfd, &msg, length) == -1 ) {
- efree(msg.buf);
- return(-1);
- }
-
- efree(msg.buf);
- retmsg = recv_hg_msg(sockfd);
- if ( retmsg == NULL )
- return(-1);
-
- ptr = (int *) retmsg->buf;
- if(ptr == NULL) {
- if(retmsg) efree(retmsg);
- return -1;
- }
- if(*ptr++ == 0) {
- *count = *ptr;
- ptr++;
- if(NULL != (childIDs = emalloc(*count * sizeof(hw_objectID)))) {
- ptr1 = childIDs;
- for(i=0; i<*count; ptr++, i++)
- ptr1[i] = *ptr;
- efree(retmsg->buf);
- efree(retmsg);
- } else {
- efree(retmsg->buf);
- efree(retmsg);
- lowerror = LE_MALLOC;
- return(-1);
- }
- } else {
- error = *((int *) retmsg->buf);
- efree(retmsg->buf);
- efree(retmsg);
- return error;
- }
-
- /* Now get for each source the object record */
- for(i=0; i<*count; i++) {
- length = HEADER_LENGTH + sizeof(hw_objectID);
- build_msg_header(&msg, length, childIDs[i], GETOBJECT_MESSAGE);
-
- if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) {
-/* perror("send_command"); */
- efree(childIDs);
- lowerror = LE_MALLOC;
- return(-1);
- }
-
- tmp = build_msg_int(msg.buf, childIDs[i]);
-
- if ( send_hg_msg(sockfd, &msg, length) == -1 ) {
- efree(childIDs);
- efree(msg.buf);
- return(-1);
- }
-
- efree(msg.buf);
- }
- efree(childIDs);
-
- if(NULL == (objptr = (char **) emalloc(*count * sizeof(hw_objrec *)))) {
- /* if emalloc fails, get at least all remaining messages from server */
- for(i=0; i<*count; i++) {
- retmsg = recv_hg_msg(sockfd);
- efree(retmsg->buf);
- efree(retmsg);
- }
- *childrec = NULL;
- lowerror = LE_MALLOC;
- return(-1);
- } else {
- *childrec = objptr;
-
- for(i=0; i<*count; i++) {
- retmsg = recv_hg_msg(sockfd);
- if ( retmsg != NULL ) {
- if(0 == (int) *(retmsg->buf)) {
- *objptr = estrdup(retmsg->buf+sizeof(int));
- objptr++;
- efree(retmsg->buf);
- efree(retmsg);
- } else {
- *objptr = NULL;
- objptr++;
- efree(retmsg->buf);
- efree(retmsg);
- }
- }
- }
- }
-
- return(0);
-}
-
-int send_mapid(int sockfd, int servid, hw_objectID id, int *virtid)
-{
- hg_msg msg, *retmsg;
- int length, error;
- char *tmp;
- int *ptr;
-
- length = HEADER_LENGTH + 2 * sizeof(hw_objectID);
-
- build_msg_header(&msg, length, msgid++, HG_MAPID);
-
- if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) {
- lowerror = LE_MALLOC;
- return(-1);
- }
-
- tmp = build_msg_int(msg.buf, servid);
- tmp = build_msg_int(tmp, id);
-
- if (-1 == send_hg_msg(sockfd, &msg, length)) {
- efree(msg.buf);
- return(-2);
- }
-
- efree(msg.buf);
- retmsg = recv_hg_msg(sockfd);
- if ( retmsg == NULL ) {
- return(-3);
- }
-
- ptr = (int *) retmsg->buf;
- if(ptr == NULL) {
- if(retmsg) efree(retmsg);
- return -1;
- }
- if(*ptr++ == 0) {
- *virtid = *ptr;
- } else {
- error = *((int *) retmsg->buf);
- efree(retmsg->buf);
- efree(retmsg);
- return error;
- }
-
- return(0);
-}
-
-#define BUFFERLEN 200
-char *get_hw_info(hw_connection *conn) {
- char temp[BUFFERLEN];
- int len;
- struct sockaddr_in serv_addr;
-
- len = sizeof (serv_addr);
- if(getsockname(conn->socket, (struct sockaddr *)&serv_addr, &len) < 0)
- return(NULL);
-
- snprintf(temp, BUFFERLEN, "%s, %s, %d, %s, %d, %d", conn->server_string, conn->hostname,
- conn->version, conn->username,
- serv_addr.sin_port, conn->swap_on);
- return(estrdup(temp));
-}
-#undef BUFFERLEN
-
-static int send_hg_msg(int sockfd, hg_msg *msg, int length)
-{
- char *buf, *tmp;
-
-#ifdef HW_DEBUG
- php_printf("<B>Sending msg: </B>type = %d -- id = %d<BR>\n", msg->msg_type, msg->version_msgid);
-#endif
- if ( length < HEADER_LENGTH ) {
-/* fprintf(stderr, "send_hg_msg: bad msg\n"); */
- return(-1);
- }
-
- if ( (tmp = buf = (char *)emalloc(length)) == NULL ) {
-/* perror("send_hg_msg"); */
- lowerror = LE_MALLOC;
- return(-1);
- }
-
- memcpy(tmp, (char *) &(msg->length), 4);
- tmp += 4;
- memcpy(tmp, (char *) &(msg->version_msgid), 4);
- tmp += 4;
- memcpy(tmp, (char *) &(msg->msg_type), 4);
- if ( msg->length > HEADER_LENGTH ) {
- tmp += 4;
- memcpy(tmp, msg->buf, length-HEADER_LENGTH);
- }
-
- if ( hg_write(sockfd, buf, length) == -1 ) {
- efree(buf);
- return(-1);
- }
-
- efree(buf);
- return(0);
-}
-
-
-int send_ready(int sockfd)
-{
- hg_msg ready_msg;
-
- build_msg_header(&ready_msg, HEADER_LENGTH, version, READY_MESSAGE);
- ready_msg.buf = NULL;
-
- if ( send_hg_msg(sockfd, &ready_msg, HEADER_LENGTH) == -1 ) {
- return(-1);
- }
-
- return(0);
-}
-
-
-int send_command(int sockfd, int command, char **answer)
-{
- hg_msg comm_msg, *retmsg;
- char *comm_str, *tmp;
- int respond = 1;
- int length;
-
- if ( command == STAT_COMMAND )
- comm_str = STAT_COMMAND_STR;
- else
- comm_str = WHO_COMMAND_STR;
- length = HEADER_LENGTH + sizeof(respond) + strlen(comm_str) + 1;
-
- build_msg_header(&comm_msg, length, msgid++, COMMAND_MESSAGE);
-
- if ( (comm_msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) {
-/* perror("send_command"); */
- lowerror = LE_MALLOC;
- return(-1);
- }
-
-
- tmp = build_msg_int(comm_msg.buf, respond);
- tmp = build_msg_str(tmp, comm_str);
-
-
- if ( send_hg_msg(sockfd, &comm_msg, length) == -1 ) {
- efree(comm_msg.buf);
- return(-1);
- }
- efree(comm_msg.buf);
-
- /* Just check if the command was understood */
- retmsg = recv_hg_msg(sockfd);
- if ( retmsg == NULL ) {
- return(-1);
- }
-
- *answer = retmsg->buf;
- efree(retmsg);
-
- return(0);
-}
-
-
-static void build_msg_header(hg_msg *msg, int length, int version_msgid, int msg_type)
-{
- if ( swap_on ) {
- msg->length = swap(length);
- msg->version_msgid = swap(version_msgid);
- msg->msg_type = swap(msg_type);
- }
- else {
- msg->length = length;
- msg->version_msgid = version_msgid;
- msg->msg_type = msg_type;
- }
-}
-
-
-static char *build_msg_int(char *buf, int val) {
- int tmp;
-
-#ifdef HW_DEBUG
- php_printf(" Added int to header: <B>%d</B><BR>\n", val);
-#endif
- tmp = swap_on ? swap(val) : val;
- memcpy(buf, (char *)&tmp, 4);
-
- return(buf+4);
-}
-
-
-static char *build_msg_str(char *buf, char *str)
-{
- int len = strlen(str)+1;
-
-#ifdef HW_DEBUG
- php_printf(" Added str to header: <B>%s</B> (%d)<BR>\n", str, strlen(str));
-#endif
-
- memcpy(buf, str, len);
-
- return(buf+len);
-}
-
-
-static int swap(int val)
-{
- int tmp;
-
- ((char*)&tmp)[0] = ((char*)&val)[3];
- ((char*)&tmp)[1] = ((char*)&val)[2];
- ((char*)&tmp)[2] = ((char*)&val)[1];
- ((char*)&tmp)[3] = ((char*)&val)[0];
-
- return(tmp);
-}
-
-
-void close_hg_connection(int sockfd)
-{
- shutdown(sockfd, 2);
- HWSOCK_FCLOSE(sockfd);
-}
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * End:
- */
-
diff --git a/ext/hyperwave/hg_comm.h b/ext/hyperwave/hg_comm.h
deleted file mode 100644
index 06d9e2614f..0000000000
--- a/ext/hyperwave/hg_comm.h
+++ /dev/null
@@ -1,238 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef HG_COMM_H
-#define HG_COMM_H
-
-#if HYPERWAVE
-
-#define newlist
-
-#include "hw_error.h"
-#ifdef newlist
-#else
-#include "dlist.h"
-#endif
-#define HG_SERVER_PORT 418
-
-#define F_DISTRIBUTED 0x80000000
-#define F_COMPRESSED 0x40000000
-#define F_VERSION 0x00003fff
-#define HW_VERSION 717L /* 7.17 */
-
-#define HEADER_LENGTH 12
-
-#define STAT_COMMAND_STR "stat"
-#define WHO_COMMAND_STR "who"
-#define STAT_COMMAND 1
-#define WHO_COMMAND 2
-
-#define GETDOCBYANCHOR_MESSAGE 2
-#define GETCHILDCOLL_MESSAGE 3
-#define GETPARENT_MESSAGE 4
-#define GETCHILDDOCCOLL_MESSAGE 5
-#define GETOBJECT_MESSAGE 7
-#define GETANCHORS_MESSAGE 8
-#define GETOBJBYQUERY_MESSAGE 9
-#define GETOBJBYQUERYCOLL_MESSAGE 10
-#define OBJECTBYIDQUERY_MESSAGE 11
-#define GETTEXT_MESSAGE 12
-#define INSDOC_MESSAGE 14
-#define INSCOLL_MESSAGE 17
-#define GETSRCBYDEST_MESSAGE 19
-#define MVCPDOCSCOLL_MESSAGE 22
-#define MVCPCOLLSCOLL_MESSAGE 23
-#define IDENTIFY_MESSAGE 24
-#define READY_MESSAGE 25
-#define COMMAND_MESSAGE 26
-#define CHANGEOBJECT_MESSAGE 27
-#define EDITTEXT_MESSAGE 28
-#define GETANDLOCK_MESSAGE 29
-#define UNLOCK_MESSAGE 30
-#define INCOLLECTIONS_MESSAGE 31
-#define INSERTOBJECT_MESSAGE 32
-#define GETOBJBYFTQUERY_MESSAGE 34
-#define GETOBJBYFTQUERYCOLL_MESSAGE 35
-#define PIPEDOCUMENT_MESSAGE 36
-#define DELETEOBJECT_MESSAGE 37
-#define PUTDOCUMENT_MESSAGE 38
-#define GETREMOTE_MESSAGE 39
-#define GETREMOTECHILDREN_MESSAGE 40
-#define HG_MAPID 43
-#define CHILDREN_MESSAGE 44
-#define GETCGI_MESSAGE 45
-#define PIPECGI_MESSAGE 46
-
-#define HW_DEFAULT_LINK 0
-#define HW_IMAGE_LINK 1
-#define HW_BACKGROUND_LINK 2
-#define HW_INTAG_LINK 3
-#define HW_APPLET_LINK 4
-#define HW_INTAGNODEL_LINK 5
-
-#define COPY 0
-#define MOVE 1
-#define DOCUMENT 0
-#define COLLECTION 1
-
-
-#ifdef PHP_WIN32
-# define SOCK_ERR INVALID_SOCKET
-# define SOCK_CONN_ERR SOCKET_ERROR
-# define HWSOCK_FCLOSE(s) closesocket(s)
-#else
-# define SOCK_ERR -1
-# define SOCK_CONN_ERR -1
-# define HWSOCK_FCLOSE(s) close(s)
-#endif
-
-
-/* Low error messages */
-#define LE_MALLOC -1
-
-typedef struct {
- int id; /* object ID of anchor */
- int tanchor; /* Type of anchor. Can be 1=Src, 2=Dest */
- int start; /* start of anchor */
- int end; /* end of anchor */
- char *nameanchor; /* name tag attribute of destination document */
- /* if anchor is of type Src the following are used as well */
- char *destdocname; /* name of destination document */
- char *link; /* url for external destination */
- int linktype; /* type of link. see above */
- char *tagattr; /* more attributes of tag, like Border=0 */
- char *htmlattr; /* */
- char *codebase; /* codebase of applet */
- char *code; /* code of applet */
- char *fragment; /* name link of Src */
-
- /* if anchor is of type Dest the following are used as well */
- char *keyword; /* name link of Dest */
- } ANCHOR;
-
-typedef struct {
- int length;
- int version_msgid;
- int msg_type;
- char *buf;
-} hg_msg;
-
-typedef struct {
- int socket;
- int swap_on;
- int version;
- char *server_string;
- char *hostname;
- char *username;
- int lasterror;
- int linkroot;
-} hw_connection;
-
-typedef int hw_objectID;
-typedef char hw_objrec;
-typedef float hw_float;
-
-#ifdef newlist
-void fnDeleteAnchor(void *ptr1);
-void fnListAnchor(zend_llist *pAnchorList);
-zend_llist *fnCreateAnchorList(hw_objectID objID, char **anchors, char **docofanchorrec, char **reldestrec, int ancount, int anchormode);
-char *fnInsAnchorsIntoText(char *text, zend_llist *pAnchorList, char **bodytag, char **urlprefix);
-int fnCmpAnchors(const void *e1, const void *e2);
-ANCHOR *fnAddAnchor(zend_llist *pAnchorList, int objectID, int start, int end);
-#else
-void fnDeleteAnchor(ANCHOR *ptr);
-void fnListAnchor(DLIST *pAnchorList);
-DLIST *fnCreateAnchorList(hw_objectID objID, char **anchors, char **docofanchorrec, char **reldestrec, int ancount, int anchormode);
-char *fnInsAnchorsIntoText(char *text, DLIST *pAnchorList, char **bodytag, char **urlprefix);
-int fnCmpAnchors(ANCHOR *a1, ANCHOR *a2);
-ANCHOR *fnAddAnchor(DLIST *pAnchorList, int objectID, int start, int end);
-#endif
-extern void set_swap(int do_swap);
-extern int open_hg_connection(char *server_name, int port);
-extern void close_hg_connection(int sockfd);
-extern int initialize_hg_connection(int sockfd, int *do_swap, int *version, char **userdata, char **server_string, char *username, char *password);
-
-extern int send_ready(int sockfd);
-extern int send_command(int sockfd, int command, char **answer);
-
-extern hg_msg *recv_hg_msg(int sockfd);
-extern hg_msg *recv_ready(int sockfd);
-extern hg_msg *recv_command(int sockfd);
-
-extern char *fnInsStr(char *str, int pos, char *insstr);
-extern int fnAttributeCompare(char *object, char *attrname, char *value);
-extern char *fnAttributeValue(char *object, char *attrname);
-extern int getrellink(int sockfd, int rootID, int thisID, int destID, char **reldesstr);
-
-extern int send_deleteobject(int sockfd, hw_objectID objectID);
-extern int send_changeobject(int sockfd, hw_objectID objectID, char *mod);
-extern int send_groupchangeobject(int sockfd, hw_objectID objectID, char *mod);
-extern int send_getobject(int sockfd, hw_objectID objectID, char **attributes);
-extern int send_getandlock(int sockfd, hw_objectID objectID, char **attributes);
-extern int send_lock(int sockfd, hw_objectID objectID);
-extern int send_unlock(int sockfd, hw_objectID objectID);
-extern int send_gettext(int sockfd, hw_objectID objectID, int mode, int rootid, char **objattr, char **bodytag, char **text, int *count, char *urlprefix);
-extern int send_edittext(int sockfd, char *objattr, char *text);
-extern int send_getcgi(int sockfd, hw_objectID objectID, char *cgi_env_str, char **objattr, char **text, int *count);
-extern int send_getremote(int sockfd, hw_objectID objectID, char **objattr, char **text, int *count);
-extern int send_getremotechildren(int sockfd, char *attributes, char **text, int **childIDs, int *count);
-extern int send_docbyanchor(int sockfd, hw_objectID objectID, hw_objectID *anchorID);
-extern int send_docbyanchorobj(int sockfd, hw_objectID objectID, char **objrec);
-extern int send_mvcpdocscollscoll(int sockfd, hw_objectID *objectIDs, int count, int from, int dest, int cpmv, int docscoll);
-extern int send_childrenobj(int sockfd, hw_objectID objectID, char ***childrec, int *count);
-extern int send_getchildcoll(int sockfd, int objectID, hw_objectID **childIDs, int *count);
-extern int send_getchildcollobj(int sockfd, hw_objectID objectID, hw_objrec ***childrec, int *count);
-extern int send_getchilddoccoll(int sockfd, hw_objectID objectID, hw_objectID **childIDs, int *count);
-extern int send_getchilddoccollobj(int sockfd, hw_objectID objectID, hw_objrec ***childrec, int *count);
-extern int send_getanchors(int sockfd, hw_objectID objectID, hw_objectID **anchorIDs, int *count);
-extern int send_getanchorsobj(int sockfd, hw_objectID objectID, char ***childrec, int *count);
-extern int send_objectbyidquery(int sockfd, hw_objectID *IDs, int *count, char *query, char ***objrecs);
-extern int send_getobjbyquery(int sockfd, char *query, int maxhits, hw_objectID **childIDs, int *count);
-extern int send_getobjbyqueryobj(int sockfd, char *query, int maxhits, char ***childrec, int *count);
-extern int send_getobjbyquerycoll(int sockfd, hw_objectID collID, char *query, int maxhits, hw_objectID **childIDs, int *count);
-extern int send_getobjbyquerycollobj(int sockfd, hw_objectID collID, char *query, int maxhits, char ***childrec, int *count);
-extern int send_getobjbyftquery(int sockfd, char *query, int maxhits, hw_objectID **childIDs, float **weights, int *count);
-extern int send_getobjbyftqueryobj(int sockfd, char *query, int maxhits, char ***childrec, float **weights, int *count);
-extern int send_getobjbyftquerycoll(int sockfd, hw_objectID collID, char *query, int maxhits, hw_objectID **childIDs, float **weight, int *count);
-extern int send_getobjbyftquerycollobj(int sockfd, hw_objectID collID, char *query, int maxhits, char ***childrec, float **weight, int *count);
-extern int send_identify(int sockfd, char *name, char *passwd, char **userdata);
-extern int send_getparents(int sockfd, hw_objectID objectID, hw_objectID **childIDs, int *count);
-extern int send_children(int sockfd, hw_objectID objectID, hw_objectID **childIDs, int *count);
-extern int send_getparentsobj(int sockfd, hw_objectID objectID, char ***childrec, int *count);
-extern int send_pipedocument(int sockfd, char *hostname, hw_objectID objectID, int mode, int rootid, char** objattr, char **bodytag, char **text, int *count, char **urlprefix);
-extern int send_pipecgi(int sockfd, char *host, hw_objectID objectID, char *cgi_env_str, char **objattr, char **text, int *count);
-extern int send_putdocument(int sockfd, char *hostname, hw_objectID parentID, char *objectRec, char *text, int count, hw_objectID *objectID);
-extern int send_inscoll(int sockfd, hw_objectID objectID, char *objrec, hw_objectID *new_objectID);
-extern int send_insertobject(int sockfd, char *objrec, char *parms, hw_objectID *objectID);
-extern int send_insdoc(int sockfd, hw_objectID objectID, char *objrec, char *text, hw_objectID *new_objectID);
-extern int send_incollections(int sockfd, int retcol, int cobjids, hw_objectID *objectIDs, int ccollids, hw_objectID *collIDs, int *count, hw_objectID **retIDs);
-extern int send_getsrcbydest(int sockfd, hw_objectID objid, char ***childrec, int *count);
-extern int send_mapid(int sockfd, int servid, hw_objectID id, int *virtid);
-extern int send_dummy(int sockfd, hw_objectID objectID, int msgid, char **attributes);
-extern int send_insertanchors(char **text, int *count, char **anchors, char **destrec, int ancount, char **urlprefix, char **bodytag);
-extern char *get_hw_info(hw_connection *conn);
-
-#define send_mvcpdocscoll(sockfd,objectIDs,count,from,dest,mvcp) \
- send_mvcpdocscollscoll(sockfd,objectIDs,count,from,dest,mvcp,DOCUMENT)
-#define send_mvcpcollscoll(sockfd,objectIDs,count,from,dest,mvcp) \
- send_mvcpdocscollscoll(sockfd,objectIDs,count,from,dest,mvcp,COLLECTION)
-
-#endif
-#endif
diff --git a/ext/hyperwave/hw.c b/ext/hyperwave/hw.c
deleted file mode 100644
index a8b12ac5ca..0000000000
--- a/ext/hyperwave/hw.c
+++ /dev/null
@@ -1,4474 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Uwe Steinmann |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#include <stdlib.h>
-#include <errno.h>
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "php_globals.h"
-#include "ext/standard/php_standard.h"
-#include "ext/standard/head.h"
-#include "ext/standard/info.h"
-#include "fopen_wrappers.h"
-#include "SAPI.h"
-
-#ifdef PHP_WIN32
-#include <winsock.h>
-#else
-#include "build-defs.h"
-#endif
-#ifdef HAVE_MMAP
-#include <sys/mman.h>
-#endif
-
-#if HYPERWAVE
-
-#include "php_ini.h"
-#include "php_hyperwave.h"
-
-static int le_socketp, le_psocketp, le_document;
-
-/*hw_module php_hw_module;*/
-
-#define HW_ATTR_NONE 1
-#define HW_ATTR_LANG 2
-#define HW_ATTR_NR 3
-
-function_entry hw_functions[] = {
- PHP_FE(hw_connect, NULL)
- PHP_FE(hw_pconnect, NULL)
- PHP_FE(hw_close, NULL)
- PHP_FE(hw_root, NULL)
- PHP_FE(hw_info, NULL)
- PHP_FE(hw_connection_info, NULL)
- PHP_FE(hw_error, NULL)
- PHP_FE(hw_errormsg, NULL)
- PHP_FE(hw_getparentsobj, NULL)
- PHP_FE(hw_getparents, NULL)
- PHP_FE(hw_children, NULL)
- PHP_FE(hw_childrenobj, NULL)
- PHP_FE(hw_getchildcoll, NULL)
- PHP_FE(hw_getchildcollobj, NULL)
- PHP_FE(hw_getobject, NULL)
- PHP_FE(hw_getandlock, NULL)
- PHP_FE(hw_unlock, NULL)
- PHP_FE(hw_gettext, NULL)
- PHP_FE(hw_edittext, NULL)
- PHP_FE(hw_getcgi, NULL)
- PHP_FE(hw_getremote, NULL)
- PHP_FE(hw_getremotechildren, NULL)
- PHP_FE(hw_pipedocument, NULL)
- PHP_FE(hw_pipecgi, NULL)
- PHP_FE(hw_insertdocument, NULL)
- PHP_FE(hw_mv, NULL)
- PHP_FE(hw_cp, NULL)
- PHP_FE(hw_deleteobject, NULL)
- PHP_FE(hw_changeobject, NULL)
- PHP_FE(hw_modifyobject, NULL)
- PHP_FE(hw_docbyanchor, NULL)
- PHP_FE(hw_docbyanchorobj, NULL)
- PHP_FE(hw_getobjectbyquery, NULL)
- PHP_FE(hw_getobjectbyqueryobj, NULL)
- PHP_FE(hw_getobjectbyquerycoll, NULL)
- PHP_FE(hw_getobjectbyquerycollobj, NULL)
- PHP_FE(hw_getobjectbyftquery, NULL)
- PHP_FE(hw_getobjectbyftqueryobj, NULL)
- PHP_FE(hw_getobjectbyftquerycoll, NULL)
- PHP_FE(hw_getobjectbyftquerycollobj, NULL)
- PHP_FE(hw_getchilddoccoll, NULL)
- PHP_FE(hw_getchilddoccollobj, NULL)
- PHP_FE(hw_getanchors, NULL)
- PHP_FE(hw_getanchorsobj, NULL)
- PHP_FE(hw_getusername, NULL)
- PHP_FE(hw_setlinkroot, NULL)
- PHP_FE(hw_identify, NULL)
- PHP_FE(hw_free_document, NULL)
- PHP_FE(hw_new_document, NULL)
- PHP_FE(hw_new_document_from_file, NULL)
- PHP_FE(hw_output_document, NULL)
- PHP_FE(hw_document_size, NULL)
- PHP_FE(hw_document_attributes, NULL)
- PHP_FE(hw_document_bodytag, NULL)
- PHP_FE(hw_document_content, NULL)
- PHP_FE(hw_document_setcontent, NULL)
- PHP_FE(hw_objrec2array, NULL)
- PHP_FE(hw_array2objrec, NULL)
- PHP_FE(hw_incollections, NULL)
- PHP_FE(hw_inscoll, NULL)
- PHP_FE(hw_insertobject, NULL)
- PHP_FE(hw_insdoc, NULL)
- PHP_FE(hw_getsrcbydestobj, NULL)
- PHP_FE(hw_insertanchors, NULL)
- PHP_FE(hw_getrellink, NULL)
- PHP_FE(hw_who, NULL)
- PHP_FE(hw_stat, NULL)
- PHP_FE(hw_mapid, NULL)
- PHP_FE(hw_dummy, NULL)
- {NULL, NULL, NULL}
-};
-
-zend_module_entry hw_module_entry = {
- "hyperwave", hw_functions, PHP_MINIT(hw), PHP_MSHUTDOWN(hw), NULL, NULL, PHP_MINFO(hw), STANDARD_MODULE_PROPERTIES
-};
-
-/*
-#ifdef ZTS
-int hw_globals_id;
-#else
-PHP_HW_API php_hw_globals hw_globals;
-#endif
-*/
-
-ZEND_DECLARE_MODULE_GLOBALS(hw)
-
-#ifdef COMPILE_DL_HYPERWAVE
-ZEND_GET_MODULE(hw)
-#endif
-
-void print_msg(hg_msg *msg, char *str, int txt);
-
-void _close_hw_link(zend_rsrc_list_entry *rsrc)
-{
- hw_connection *conn = (hw_connection *)rsrc->ptr;
- HwSLS_FETCH();
-
- if(conn->hostname)
- free(conn->hostname);
- if(conn->username)
- free(conn->username);
- close(conn->socket);
- free(conn);
- HwSG(num_links)--;
-}
-
-void _close_hw_plink(zend_rsrc_list_entry *rsrc)
-{
- hw_connection *conn = (hw_connection *)rsrc->ptr;
- HwSLS_FETCH();
-
- if(conn->hostname)
- free(conn->hostname);
- if(conn->username)
- free(conn->username);
- close(conn->socket);
- free(conn);
- HwSG(num_links)--;
- HwSG(num_persistent)--;
-}
-
-void _free_hw_document(zend_rsrc_list_entry *rsrc)
-{
- hw_document *doc = (hw_document *)rsrc->ptr;
- if(doc->data)
- free(doc->data);
- if(doc->attributes)
- free(doc->attributes);
- if(doc->bodytag)
- free(doc->bodytag);
- free(doc);
-}
-
-static void php_hw_init_globals(zend_hw_globals *hw_globals)
-{
- hw_globals->num_persistent = 0;
-}
-
-static PHP_INI_MH(OnHyperwavePort) {
- HwSLS_FETCH();
- if (new_value==NULL) {
- HwSG(default_port) = HG_SERVER_PORT;
- } else {
- HwSG(default_port) = atoi(new_value);
- }
- return SUCCESS;
-}
-
-PHP_INI_BEGIN()
- STD_PHP_INI_ENTRY("hyerwave.allow_persistent", "0", PHP_INI_SYSTEM, OnUpdateInt, allow_persistent, zend_hw_globals, hw_globals)
- PHP_INI_ENTRY("hyperwave.default_port", "418", PHP_INI_ALL, OnHyperwavePort)
-PHP_INI_END()
-
-PHP_MINIT_FUNCTION(hw) {
- ZEND_INIT_MODULE_GLOBALS(hw, php_hw_init_globals, NULL);
-
- REGISTER_INI_ENTRIES();
- le_socketp = zend_register_list_destructors_ex(_close_hw_link, NULL, "hyperwave link", module_number);
- le_psocketp = zend_register_list_destructors_ex(NULL, _close_hw_plink, "hyperwave link persistent", module_number);
- le_document = zend_register_list_destructors_ex(_free_hw_document, NULL, "hyperwave document", module_number);
- hw_module_entry.type = type;
-
- REGISTER_LONG_CONSTANT("HW_ATTR_LANG", HW_ATTR_LANG, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("HW_ATTR_NR", HW_ATTR_NR, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("HW_ATTR_NONE", HW_ATTR_NONE, CONST_CS | CONST_PERSISTENT);
- return SUCCESS;
-}
-
-PHP_MSHUTDOWN_FUNCTION(hw)
-{
- UNREGISTER_INI_ENTRIES();
- return SUCCESS;
-}
-
-/* {{{ make_return_objrec
- * creates an array in return value and frees all memory
- * Also adds as an assoc. array at the end of the return array with
- * statistics.
- */
-int make_return_objrec(pval **return_value, char **objrecs, int count)
-{
- zval *stat_arr;
- int i;
- int hidden, collhead, fullcollhead, total;
- int collheadnr, fullcollheadnr;
-
- if (array_init(*return_value) == FAILURE) {
- /* Ups, failed! Let's at least free the memory */
- for(i=0; i<count; i++)
- efree(objrecs[i]);
- efree(objrecs);
- return -1;
- }
-
- hidden = collhead = fullcollhead = total = 0;
- collheadnr = fullcollheadnr = -1;
- for(i=0; i<count; i++) {
- /* Fill the array with entries. No need to free objrecs[i], since
- * it is not duplicated in add_next_index_string().
- */
- if(NULL != objrecs[i]) {
- if(0 == fnAttributeCompare(objrecs[i], "PresentationHints", "Hidden"))
- hidden++;
- if(0 == fnAttributeCompare(objrecs[i], "PresentationHints", "CollectionHead")) {
- collhead++;
- collheadnr = total;
- }
- if(0 == fnAttributeCompare(objrecs[i], "PresentationHints", "FullCollectionHead")) {
- fullcollhead++;
- fullcollheadnr = total;
- }
- total++;
- add_next_index_string(*return_value, objrecs[i], 0);
- }
- }
- efree(objrecs);
-
- /* Array for statistics */
- MAKE_STD_ZVAL(stat_arr);
- if (array_init(stat_arr) == FAILURE) {
- return -1;
- }
-
- add_assoc_long(stat_arr, "Hidden", hidden);
- add_assoc_long(stat_arr, "CollectionHead", collhead);
- add_assoc_long(stat_arr, "FullCollectionHead", fullcollhead);
- add_assoc_long(stat_arr, "Total", total);
- add_assoc_long(stat_arr, "CollectionHeadNr", collheadnr);
- add_assoc_long(stat_arr, "FullCollectionHeadNr", fullcollheadnr);
-
- /* Add the stat array */
- zend_hash_next_index_insert((*return_value)->value.ht, &stat_arr, sizeof(zval), NULL);
-
- return 0;
-}
-/* }}} */
-
-/* {{{ make2_return_array_from_objrec
-** creates an array return value from object record
-*/
-int make2_return_array_from_objrec(pval **return_value, char *objrec, zval *sarr) {
- char *attrname, *str, *temp, language[3];
- zval *spec_arr;
- char *strtok_buf = NULL;
-
- /* Create an array with an entry containing specs for each attribute
- and fill in the specs for Title, Description, Keyword, Group.
- If an array is passed as the last argument use it instead.
- */
- if(NULL != sarr) {
- spec_arr = sarr;
- } else {
- MAKE_STD_ZVAL(spec_arr);
- array_init(spec_arr);
- add_assoc_long(spec_arr, "Title", HW_ATTR_LANG);
- add_assoc_long(spec_arr, "Description", HW_ATTR_LANG);
- add_assoc_long(spec_arr, "Keyword", HW_ATTR_LANG);
- add_assoc_long(spec_arr, "Group", HW_ATTR_NONE);
- add_assoc_long(spec_arr, "HtmlAttr", HW_ATTR_NONE);
- add_assoc_long(spec_arr, "Parent", HW_ATTR_NONE);
- }
-
- if (array_init(*return_value) == FAILURE) {
- (*return_value)->type = IS_STRING;
- (*return_value)->value.str.val = empty_string;
- (*return_value)->value.str.len = 0;
- return -1;
- }
-
- /* Loop through the attributes of object record and check
- if the attribute has a specification. If it has the value
- is added to array in spec record. If not it is added straight
- to the return_value array.
- */
- temp = estrdup(objrec);
- attrname = php_strtok_r(temp, "\n", &strtok_buf);
- while(attrname != NULL) {
- zval *data, **dataptr;
- long spec;
- str = attrname;
-
- /* Check if a specification is available.
- If it isn't available then insert the attribute as
- a string into the return array
- */
- while((*str != '=') && (*str != '\0'))
- str++;
- *str = '\0';
- str++;
- if(zend_hash_find(spec_arr->value.ht, attrname, strlen(attrname)+1, (void **) &dataptr) == FAILURE) {
- add_assoc_string(*return_value, attrname, str, 1);
- } else {
- zval *newarr;
- data = *dataptr;
- spec = data->value.lval;
-
- if(zend_hash_find((*return_value)->value.ht, attrname, strlen(attrname)+1, (void **) &dataptr) == FAILURE) {
- MAKE_STD_ZVAL(newarr);
- array_init(newarr);
- zend_hash_add((*return_value)->value.ht, attrname, strlen(attrname)+1, &newarr, sizeof(zval *), NULL);
- } else {
- newarr = *dataptr;
- }
-
- switch(spec) {
- case HW_ATTR_LANG:
- if(str[2] == ':') {
- str[2] = '\0';
- strcpy(language, str);
- str += 3;
- } else
- strcpy(language, "xx");
-
- add_assoc_string(newarr, language, str, 1);
- break;
- case HW_ATTR_NR:
- if(str[1] == ':') {
- str[1] = '\0';
- strcpy(language, str);
- str += 2;
- } else
- strcpy(language, "x");
-
- add_assoc_string(newarr, language, str, 1);
- break;
- case HW_ATTR_NONE:
- add_next_index_string(newarr, str, 1);
- break;
- }
- }
-
- attrname = php_strtok_r(NULL, "\n", &strtok_buf);
- }
- if(NULL == sarr){
-/*
- spec_arr->refcount--;
- zend_hash_destroy(spec_arr->value.ht);
- efree(spec_arr->value.ht);
-*/
- zval_dtor(spec_arr);
- efree(spec_arr);
- }
- efree(temp);
-
- return(0);
-}
-/* }}} */
-
-/* {{{ make_return_array_from_objrec
- */
-int make_return_array_from_objrec(pval **return_value, char *objrec) {
- char *attrname, *str, *temp, language[3], *title;
- int iTitle, iDesc, iKeyword, iGroup;
- zval *title_arr;
- zval *desc_arr;
- zval *keyword_arr;
- zval *group_arr;
- int hasTitle = 0;
- int hasDescription = 0;
- int hasKeyword = 0;
- int hasGroup = 0;
- char *strtok_buf;
-
- MAKE_STD_ZVAL(title_arr);
- MAKE_STD_ZVAL(desc_arr);
- MAKE_STD_ZVAL(keyword_arr);
- MAKE_STD_ZVAL(group_arr);
-
- if (array_init(*return_value) == FAILURE) {
- (*return_value)->type = IS_STRING;
- (*return_value)->value.str.val = empty_string;
- (*return_value)->value.str.len = 0;
- return -1;
- }
-
- /* Fill Array of titles, descriptions and keywords */
- temp = estrdup(objrec);
- attrname = php_strtok_r(temp, "\n", &strtok_buf);
- while(attrname != NULL) {
- str = attrname;
- iTitle = 0;
- iDesc = 0;
- iKeyword = 0;
- iGroup = 0;
- if(0 == strncmp(attrname, "Title=", 6)) {
- if ((hasTitle == 0) && (array_init(title_arr) == FAILURE)) {
- return -1;
- }
- hasTitle = 1;
- str += 6;
- iTitle = 1;
- } else if(0 == strncmp(attrname, "Description=", 12)) {
- if ((hasDescription == 0) && (array_init(desc_arr) == FAILURE)) {
- return -1;
- }
- hasDescription = 1;
- str += 12;
- iDesc = 1;
- } else if(0 == strncmp(attrname, "Keyword=", 8)) {
- if ((hasKeyword == 0) && (array_init(keyword_arr) == FAILURE)) {
- return -1;
- }
- hasKeyword = 1;
- str += 8;
- iKeyword = 1;
- } else if(0 == strncmp(attrname, "Group=", 6)) {
- if ((hasGroup == 0) && (array_init(group_arr) == FAILURE)) {
- return -1;
- }
- hasGroup = 1;
- str += 6;
- iGroup = 1;
- }
- if(iTitle || iDesc || iKeyword) { /* Poor error check if end of string */
- if(str[2] == ':') {
- str[2] = '\0';
- strcpy(language, str);
- str += 3;
- } else
- strcpy(language, "xx");
-
- title = str;
- if(iTitle)
- add_assoc_string(title_arr, language, title, 1);
- else if(iDesc)
- add_assoc_string(desc_arr, language, title, 1);
- else if(iKeyword)
- add_assoc_string(keyword_arr, language, title, 1);
- } else if(iGroup) {
- if(iGroup)
- add_next_index_string(group_arr, str, 1);
- }
- attrname = php_strtok_r(NULL, "\n", &strtok_buf);
- }
- efree(temp);
-
- /* Add the title array, if we have one */
- if(hasTitle) {
- zend_hash_update((*return_value)->value.ht, "Title", 6, &title_arr, sizeof(zval *), NULL);
-
- } else {
- efree(title_arr);
- }
-
-
- if(hasDescription) {
- /* Add the description array, if we have one */
- zend_hash_update((*return_value)->value.ht, "Description", 12, &desc_arr, sizeof(zval *), NULL);
-
- } else {
- efree(desc_arr);
- }
-
- if(hasKeyword) {
- /* Add the keyword array, if we have one */
- zend_hash_update((*return_value)->value.ht, "Keyword", 8, &keyword_arr, sizeof(zval *), NULL);
-
- } else {
- efree(keyword_arr);
- }
-
- if(hasGroup) {
- /* Add the Group array, if we have one */
- zend_hash_update((*return_value)->value.ht, "Group", 6, &group_arr, sizeof(zval *), NULL);
-
- } else {
- efree(group_arr);
- }
-
- /* All other attributes. Make a another copy first */
- temp = estrdup(objrec);
- attrname = php_strtok_r(temp, "\n", &strtok_buf);
- while(attrname != NULL) {
- str = attrname;
- /* We don't want to insert titles, descr., keywords a second time */
- if((0 != strncmp(attrname, "Title=", 6)) &&
- (0 != strncmp(attrname, "Description=", 12)) &&
- (0 != strncmp(attrname, "Group=", 6)) &&
- (0 != strncmp(attrname, "Keyword=", 8))) {
- while((*str != '=') && (*str != '\0'))
- str++;
- *str = '\0';
- str++;
- add_assoc_string(*return_value, attrname, str, 1);
- }
- attrname = php_strtok_r(NULL, "\n", &strtok_buf);
- }
- efree(temp);
-
- return(0);
-}
-/* }}} */
-
-#define BUFFERLEN 1024
-/* {{{ make_objrec_from_array
- */
-static char * make_objrec_from_array(HashTable *lht) {
- int i, count, keytype;
- ulong length;
- char *key, str[BUFFERLEN], *objrec = NULL;
- zval *keydata, **keydataptr;
-
- if(NULL == lht)
- return NULL;
-
- if(0 == (count = zend_hash_num_elements(lht)))
- return NULL;
-
- zend_hash_internal_pointer_reset(lht);
- objrec = malloc(1);
- *objrec = '\0';
- for(i=0; i<count; i++) {
- keytype = zend_hash_get_current_key(lht, &key, &length, 0);
-/* if(HASH_KEY_IS_STRING == keytype) { */
- zend_hash_get_current_data(lht, (void **) &keydataptr);
- keydata = *keydataptr;
- switch(keydata->type) {
- case IS_STRING:
- if(HASH_KEY_IS_STRING == keytype)
- snprintf(str, BUFFERLEN, "%s=%s\n", key, keydata->value.str.val);
- else
- snprintf(str, BUFFERLEN, "%s\n", keydata->value.str.val);
- break;
- case IS_LONG:
- if(HASH_KEY_IS_STRING == keytype)
- snprintf(str, BUFFERLEN, "%s=0x%lX\n", key, keydata->value.lval);
- else
- snprintf(str, BUFFERLEN, "0x%lX\n", keydata->value.lval);
- break;
- case IS_ARRAY: {
- int i, len, keylen, count;
- char *strarr, *ptr, *ptr1;
- count = zend_hash_num_elements(keydata->value.ht);
- if(count > 0) {
- strarr = make_objrec_from_array(keydata->value.ht);
- len = strlen(strarr) - 1;
- keylen = strlen(key);
- if(NULL == (ptr = malloc(len + 1 + count*(keylen+1)))) {
- free(objrec);
- return(NULL);
- }
- ptr1 = ptr;
- *ptr1 = '\0';
- strcpy(ptr1, key);
- ptr1 += keylen;
- *ptr1++ = '=';
- for(i=0; i<len; i++) {
- *ptr1++ = strarr[i];
- if(strarr[i] == '\n') {
- strcpy(ptr1, key);
- ptr1 += keylen;
- *ptr1++ = '=';
- } else if(strarr[i] == '=')
- ptr1[-1] = ':';
- }
- *ptr1++ = '\n';
- *ptr1 = '\0';
- strlcpy(str, ptr, sizeof(str));
- }
- break;
- }
- }
- objrec = realloc(objrec, strlen(objrec)+strlen(str)+1);
- strcat(objrec, str);
-/* } */
- zend_hash_move_forward(lht);
- }
- return objrec;
-}
-/* }}} */
-#undef BUFFERLEN
-
-/* {{{ make_ints_from_array
- */
-static int * make_ints_from_array(HashTable *lht) {
- int i, count;
- int *objids = NULL;
- zval **keydata;
-
- if(NULL == lht)
- return NULL;
-
- if(0 == (count = zend_hash_num_elements(lht)))
- return NULL;
-
- zend_hash_internal_pointer_reset(lht);
- if(NULL == (objids = emalloc(count*sizeof(int))))
- return NULL;
- for(i=0; i<count; i++) {
- zend_hash_get_current_data(lht, (void **) &keydata);
- switch((*keydata)->type) {
- case IS_LONG:
- objids[i] = (*keydata)->value.lval;
- break;
- default:
- objids[i] = 0;
- }
- zend_hash_move_forward(lht);
- }
- return objids;
-}
-/* }}} */
-
-/* {{{ make_strs_from_array
- */
-static char **make_strs_from_array(HashTable *arrht) {
- char **carr = NULL;
- char **ptr;
- zval *data, **dataptr;
-
- zend_hash_internal_pointer_reset(arrht);
- if(NULL == (carr = emalloc(zend_hash_num_elements(arrht) * sizeof(char *))))
- return(NULL);
- ptr = carr;
-
- /* Iterate through hash */
- while(zend_hash_get_current_data(arrht, (void **) &dataptr) == SUCCESS) {
- data = *dataptr;
- switch(data->type) {
- case IS_STRING:
- *ptr = estrdup(data->value.str.val);
-/*fprintf(stderr, "carr[] = %s\n", *ptr); */
- break;
- default:
- *ptr = NULL;
- }
- ptr++;
-
- zend_hash_move_forward(arrht);
- }
- return(carr);
-}
-/* }}} */
-
-#define BUFFERLEN 30
-/* {{{ php_hw_do_connect
- */
-static void php_hw_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
-{
- zval **argv[4];
- int argc;
- int sockfd;
- int port = 0;
- char *host = NULL;
- char *userdata = NULL;
- char *server_string = NULL;
- char *username = NULL;
- char *password = NULL;
- char *hashed_details;
- char *str = NULL;
- char buffer[BUFFERLEN];
- int hashed_details_length;
- hw_connection *ptr;
- int do_swap;
- int version = 0;
- HwSLS_FETCH();
-
- argc = ZEND_NUM_ARGS();
- switch(argc) {
- case 2:
- case 4:
- if (zend_get_parameters_array_ex(argc, argv) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- }
-
- /* Host: */
- convert_to_string_ex(argv[0]);
- host = (char *) estrndup((*argv[0])->value.str.val, (*argv[0])->value.str.len);
-
- /* Port: */
- convert_to_long_ex(argv[1]);
- port = (*argv[1])->value.lval;
-
- /* Username and Password */
- if(argc > 2) {
- /* Username */
- convert_to_string_ex(argv[2]);
- username = (char *) estrndup((*argv[2])->value.str.val, (*argv[2])->value.str.len);
- /* Password */
- convert_to_string_ex(argv[3]);
- password = (char *) estrndup((*argv[3])->value.str.val, (*argv[3])->value.str.len);
- }
-
- /* Create identifier string for connection */
- snprintf(buffer, BUFFERLEN, "%d", port);
- hashed_details_length = strlen(host)+strlen(buffer)+8;
- if(NULL == (hashed_details = (char *) emalloc(hashed_details_length+1))) {
- if(host) efree(host);
- if(password) efree(password);
- if(username) efree(username);
- php_error(E_ERROR, "Could not get memory for connection details");
- RETURN_FALSE;
- }
- sprintf(hashed_details, "hw_%s_%d", host, port);
-
- if (persistent) {
- list_entry *le;
-
- /* try to find if we already have this link in our persistent list */
- if (zend_hash_find(&EG(persistent_list), hashed_details, hashed_details_length+1, (void **) &le)==FAILURE) {
- list_entry new_le;
-
- if (HwSG(max_links)!=-1 && HwSG(num_links)>=HwSG(max_links)) {
- php_error(E_ERROR,"Hyperwave: Too many open links (%d)",HwSG(num_links));
- if(host) efree(host);
- if(username) efree(username);
- if(password) efree(password);
- efree(hashed_details);
- RETURN_FALSE;
- }
- if (HwSG(max_persistent!=-1) && HwSG(num_persistent)>=HwSG(max_persistent)) {
- php_error(E_ERROR,"Hyperwave: Too many open persistent links (%d)",HwSG(num_persistent));
- if(host) efree(host);
- if(username) efree(username);
- if(password) efree(password);
- efree(hashed_details);
- RETURN_FALSE;
- }
-
- if ( (sockfd = open_hg_connection(host, port)) < 0 ) {
- php_error(E_ERROR, "Could not open connection to %s, Port: %d (retval=%d, errno=%d)", host, port, sockfd, errno);
- if(host) efree(host);
- if(username) efree(username);
- if(password) efree(password);
- efree(hashed_details);
- RETURN_FALSE;
- }
-
- if(NULL == (ptr = malloc(sizeof(hw_connection)))) {
- php_error(E_ERROR, "Could not get memory for connection structure");
- if(host) efree(host);
- if(username) efree(username);
- if(password) efree(password);
- efree(hashed_details);
- RETURN_FALSE;
- }
-
- if(0 != (ptr->lasterror = initialize_hg_connection(sockfd, &do_swap, &version, &userdata, &server_string, username, password))) {
- php_error(E_ERROR, "Could not initalize hyperwave connection");
- if(host) efree(host);
- if(username) efree(username);
- if(password) efree(password);
- if(userdata) efree(userdata);
- if(server_string) free(server_string);
- efree(hashed_details);
- RETURN_FALSE;
- }
-
- if(username) efree(username);
- if(password) efree(password);
-
- ptr->version = version;
- ptr->server_string = server_string;
- ptr->socket = sockfd;
- ptr->swap_on = do_swap;
- ptr->linkroot = 0;
- ptr->hostname = strdup(host);
- ptr->username = strdup("anonymous");
-
- new_le.ptr = (void *) ptr;
- new_le.type = le_psocketp;
-
- if (zend_hash_update(&EG(persistent_list),hashed_details,hashed_details_length+1,(void *) &new_le, sizeof(list_entry), NULL)==FAILURE) {
- php_error(E_ERROR, "Could not hash table with connection details");
- if(host) efree(host);
- if(username) efree(username);
- if(password) efree(password);
- if(server_string) free(server_string);
- efree(hashed_details);
- RETURN_FALSE;
- }
-
- HwSG(num_links)++;
- HwSG(num_persistent)++;
- } else {
- /*php_printf("Found already open connection\n"); */
- if (le->type != le_psocketp) {
- RETURN_FALSE;
- }
- ptr = le->ptr;
- }
-
- return_value->value.lval = zend_list_insert(ptr,le_psocketp);
- return_value->type = IS_RESOURCE;
-
- } else {
- list_entry *index_ptr,new_index_ptr;
-
- /* first we check the hash for the hashed_details key. if it exists,
- * it should point us to the right offset where the actual hyperwave link sits.
- * if it doesn't, open a new hyperwave link, add it to the resource list,
- * and add a pointer to it with hashed_details as the key.
- */
- if (zend_hash_find(&EG(regular_list),hashed_details,hashed_details_length+1,(void **) &index_ptr)==SUCCESS) {
- int type,link;
- void *ptr;
-
- if (index_ptr->type != le_index_ptr) {
- RETURN_FALSE;
- }
- link = (int) index_ptr->ptr;
- ptr = (hw_connection *) zend_list_find(link,&type); /* check if the link is still there */
- if(!ptr || (type!=le_socketp && type!=le_psocketp)) {
- return_value->value.lval = HwSG(default_link) = link;
- return_value->type = IS_LONG;
- efree(hashed_details);
- if(username) efree(username);
- if(password) efree(password);
- if(host) efree(host);
- return;
- } else {
- zend_hash_del(&EG(regular_list),hashed_details,hashed_details_length+1);
- }
- }
-
- if ( (sockfd = open_hg_connection(host, port)) < 0 ) {
- php_error(E_ERROR, "Could not open connection to %s, Port: %d (retval=%d", host, port, sockfd);
- if(host) efree(host);
- if(username) efree(username);
- if(password) efree(password);
- efree(hashed_details);
- RETURN_FALSE;
- }
-
- if(NULL == (ptr = malloc(sizeof(hw_connection)))) {
- if(host) efree(host);
- if(username) efree(username);
- if(password) efree(password);
- efree(hashed_details);
- RETURN_FALSE;
- }
-
- if(0 != (ptr->lasterror = initialize_hg_connection(sockfd, &do_swap, &version, &userdata, &server_string, username, password))) {
- php_error(E_ERROR, "Could not initalize hyperwave connection");
- if(host) efree(host);
- if(username) efree(username);
- if(password) efree(password);
- if(userdata) efree(userdata);
- if(server_string) free(server_string);
- efree(hashed_details);
- RETURN_FALSE;
- }
-
- if(username) efree(username);
- if(password) efree(password);
-
- ptr->version = version;
- ptr->server_string = server_string;
- ptr->socket = sockfd;
- ptr->swap_on = do_swap;
- ptr->linkroot = 0;
- ptr->hostname = strdup(host);
- ptr->username = strdup("anonymous");
-
- return_value->value.lval = zend_list_insert(ptr,le_socketp);
- return_value->type = IS_RESOURCE;
-
- new_index_ptr.ptr = (void *) return_value->value.lval;
- new_index_ptr.type = le_index_ptr;
- if (zend_hash_update(&EG(regular_list),hashed_details,hashed_details_length+1,(void *) &new_index_ptr, sizeof(list_entry), NULL)==FAILURE) {
- php_error(E_ERROR, "Could not update connection details in hash table");
- if(host) efree(host);
- efree(hashed_details);
- RETURN_FALSE;
- }
-
- }
-
- efree(hashed_details);
- if(host) efree(host);
- HwSG(default_link)=return_value->value.lval;
-
- /* At this point we have a working connection. If userdata was given
- we are also indentified.
- If there is no userdata because hw_connect was called without username
- and password, we don't evaluate userdata.
- */
- if(NULL == userdata)
- return;
-
- if(ptr->username) free(ptr->username);
- str = userdata;
- while((*str != 0) && (*str != ' '))
- str++;
- if(*str != '\0')
- ptr->username = strdup(++str);
- else
- ptr->username = NULL;
- efree(userdata);
-}
-/* }}} */
-#undef BUFFERLEN
-
-/* Start of user level functions */
-/* ***************************** */
-/* {{{ proto int hw_connect(string host, int port [string username [, string password]])
- Connect to the Hyperwave server */
-PHP_FUNCTION(hw_connect)
-{
- php_hw_do_connect(INTERNAL_FUNCTION_PARAM_PASSTHRU,0);
-}
-/* }}} */
-
-/* {{{ proto int hw_pconnect(string host, int port [, string username [, string password]])
- Connect to the Hyperwave server persistent */
-PHP_FUNCTION(hw_pconnect)
-{
- php_hw_do_connect(INTERNAL_FUNCTION_PARAM_PASSTHRU,1);
-}
-/* }}} */
-
-/* {{{ proto void hw_close(int link)
- Close connection to Hyperwave server */
-PHP_FUNCTION(hw_close) {
- pval **arg1;
- int id, type;
- hw_connection *ptr;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(arg1);
- id=(*arg1)->value.lval;
- ptr = zend_list_find(id,&type);
- if(!ptr || (type!=le_socketp && type!=le_psocketp)) {
- php_error(E_WARNING,"Unable to find file identifier %d",id);
- RETURN_FALSE;
- }
- zend_list_delete(id);
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void hw_info(int link)
- Outputs info string */
-PHP_FUNCTION(hw_info)
-{
- pval **arg1;
- int id, type;
- hw_connection *ptr;
- char *str;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(arg1);
- id=(*arg1)->value.lval;
- ptr = zend_list_find(id,&type);
- if(!ptr || (type!=le_socketp && type!=le_psocketp)) {
- php_error(E_WARNING,"Unable to find file identifier %d",id);
- RETURN_FALSE;
- }
- if(NULL != (str = get_hw_info(ptr))) {
- /*
- php_printf("%s\n", str);
- efree(str);
- */
- return_value->value.str.len = strlen(str);
- return_value->value.str.val = str;
- return_value->type = IS_STRING;
- return;
- }
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto int hw_error(int link)
- Returns last error number */
-PHP_FUNCTION(hw_error)
-{
- pval **arg1;
- int id, type;
- hw_connection *ptr;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(arg1);
- id=(*arg1)->value.lval;
- ptr = zend_list_find(id,&type);
- if(!ptr || (type!=le_socketp && type!=le_psocketp)) {
- php_error(E_WARNING,"Unable to find file identifier %d",id);
- RETURN_FALSE;
- }
- RETURN_LONG(ptr->lasterror);
-}
-/* }}} */
-
-/* {{{ proto string hw_errormsg(int link)
- Returns last error message */
-PHP_FUNCTION(hw_errormsg)
-{
- pval **arg1;
- int id, type;
- hw_connection *ptr;
- char errstr[100];
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(arg1);
- id=(*arg1)->value.lval;
- ptr = zend_list_find(id,&type);
- if(!ptr || (type!=le_socketp && type!=le_psocketp)) {
- php_error(E_WARNING,"Unable to find file identifier %d",id);
- RETURN_FALSE;
- }
-
- switch (ptr->lasterror) {
- case 0:
- sprintf(errstr, "No error");
- break;
- case NOACCESS:
- sprintf(errstr, "Access denied");
- break;
- case NODOCS:
- sprintf(errstr, "No documents");
- break;
- case NONAME:
- sprintf(errstr, "No collection name");
- break;
- case NODOC:
- sprintf(errstr, "Object is not a document");
- break;
- case NOOBJ:
- sprintf(errstr, "No object received");
- break;
- case NOCOLLS:
- sprintf(errstr, "No collections received");
- break;
- case DBSTUBNG:
- sprintf(errstr, "Connection to low-level database failed");
- break;
- case NOTFOUND:
- sprintf(errstr, "Object not found");
- break;
- case EXIST:
- sprintf(errstr, "Collection already exists");
- break;
- case FATHERDEL:
- sprintf(errstr, "parent collection disappeared");
- break;
- case FATHNOCOLL:
- sprintf(errstr, "parent collection not a collection");
- break;
- case NOTEMPTY:
- sprintf(errstr, "Collection not empty");
- break;
- case DESTNOCOLL:
- sprintf(errstr, "Destination not a collection");
- break;
- case SRCEQDEST:
- sprintf(errstr, "Source equals destination");
- break;
- case REQPEND:
- sprintf(errstr, "Request pending");
- break;
- case TIMEOUT:
- sprintf(errstr, "Timeout");
- break;
- case NAMENOTUNIQUE:
- sprintf(errstr, "Name not unique");
- break;
- case WRITESTOPPED:
- sprintf(errstr, "Database now read-only; try again later");
- break;
- case LOCKED:
- sprintf(errstr, "Object locked; try again later");
- break;
- case CHANGEBASEFLD:
- sprintf(errstr, "Change of base-attribute");
- break;
- case NOTREMOVED:
- sprintf(errstr, "Attribute not removed");
- break;
- case FLDEXISTS:
- sprintf(errstr, "Attribute exists");
- break;
- case CMDSYNTAX:
- sprintf(errstr, "Syntax error in command");
- break;
- case NOLANGUAGE:
- sprintf(errstr, "No or unknown language specified");
- break;
- case WRGTYPE:
- sprintf(errstr, "Wrong type in object");
- break;
- case WRGVERSION:
- sprintf(errstr, "Client version too old");
- break;
- case CONNECTION:
- sprintf(errstr, "No connection to other server");
- break;
- case SYNC:
- sprintf(errstr, "Synchronization error");
- break;
- case NOPATH:
- sprintf(errstr, "No path entry");
- break;
- case WRGPATH:
- sprintf(errstr, "Wrong path entry");
- break;
- case PASSWD:
- sprintf(errstr, "Wrong password (server-to-server server authentication)");
- break;
- case LC_NO_MORE_USERS:
- sprintf(errstr, "No more users for license");
- break;
- case LC_NO_MORE_DOCS:
- sprintf(errstr, "No more documents for this session and license");
- break;
- case RSERV_NRESP:
- sprintf(errstr, "Remote server not responding");
- break;
- case Q_OVERFLOW:
- sprintf(errstr, "Query overflow");
- break;
- case USR_BREAK:
- sprintf(errstr, "Break by user");
- break;
- case N_IMPL:
- sprintf(errstr, "Not implemented");
- break;
- case WRG_VALUE:
- sprintf(errstr, "Wrong value");
- break;
- case INSUFF_FUNDS:
- sprintf(errstr, "Insufficient funds");
- break;
- case REORG:
- sprintf(errstr, "Reorganization in progress");
- break;
- case USER_LIMIT:
- sprintf(errstr, "Limit of simultaneous users reached");
- break;
- case FTCONNECT:
- sprintf(errstr, "No connection to fulltext server");
- break;
- case FTTIMEOUT:
- sprintf(errstr, "Connection timed out");
- break;
- case FTINDEX:
- sprintf(errstr, "Something wrong with fulltext index");
- break;
- case FTSYNTAX:
- sprintf(errstr, "Query syntax error");
- break;
- case REQUESTPENDING:
- sprintf(errstr, "Request pending");
- break;
- case NOCONNECTION:
- sprintf(errstr, "No connection to document server");
- break;
- case WRONGVERSION:
- sprintf(errstr, "Wrong protocol version");
- break;
- case NOTINITIALIZED:
- sprintf(errstr, "Not initialized");
- break;
- case BADREQUEST:
- sprintf(errstr, "Bad request");
- break;
- case BADLRN:
- sprintf(errstr, "Bad document number");
- break;
- case OPENSTORE_WRITE:
- sprintf(errstr, "Cannot write to local store");
- break;
- case OPENSTORE_READ:
- sprintf(errstr, "Cannot read from local store");
- break;
- case READSTORE:
- sprintf(errstr, "Store read error");
- break;
- case WRITESTORE:
- sprintf(errstr, "Write error");
- break;
- case CLOSESTORE:
- sprintf(errstr, "Close error");
- break;
- case BADPATH:
- sprintf(errstr, "Bad path");
- break;
- case NOPATHDC:
- sprintf(errstr, "No path");
- break;
- case OPENFILE:
- sprintf(errstr, "Cannot open file");
- break;
- case READFILE:
- sprintf(errstr, "Cannot read from file // same");
- break;
- case WRITEFILE:
- sprintf(errstr, "Cannot write to file");
- break;
- case CONNECTCLIENT:
- sprintf(errstr, "Could not connect to client");
- break;
- case ACCEPT:
- sprintf(errstr, "Could not accept connection");
- break;
- case READSOCKET:
- sprintf(errstr, "Could not read from socket");
- break;
- case WRITESOCKET:
- sprintf(errstr, "Could not write to socket");
- break;
- case TOOMUCHDATA:
- sprintf(errstr, "Received too much data");
- break;
- case TOOFEWDATA:
- sprintf(errstr, "Received too few data // ...");
- break;
- case NOTIMPLEMENTED:
- sprintf(errstr, "Not implemented");
- break;
- case USERBREAK:
- sprintf(errstr, "User break");
- break;
- case INTERNAL:
- sprintf(errstr, "Internal error");
- break;
- case INVALIDOBJECT:
- sprintf(errstr, "Invalid object");
- break;
- case JOBTIMEOUT:
- sprintf(errstr, "Job timed out");
- break;
- case OPENPORT:
- sprintf(errstr, "Cannot open port // ... for several resons");
- break;
- case NODATA:
- sprintf(errstr, "Received no data");
- break;
- case NOPORT:
- sprintf(errstr, "No port to handle this request");
- break;
- case NOTCACHED:
- sprintf(errstr, "Document not cached");
- break;
- case BADCACHETYPE:
- sprintf(errstr, "Bad cache type");
- break;
- case OPENCACHE_WRITE:
- sprintf(errstr, "Cannot write to cache");
- break;
- case OPENCACHE_READ:
- sprintf(errstr, "Cannot read from cache // same");
- break;
- case NOSOURCE:
- sprintf(errstr, "Do not know what to read");
- break;
- case CLOSECACHE:
- sprintf(errstr, "Could not insert into cache");
- break;
- case CONNECTREMOTE:
- sprintf(errstr, "Could not connect to remote server");
- break;
- case LOCKREFUSED:
- sprintf(errstr, "Lock refused // could not lock the stores");
- break;
- default:
- sprintf(errstr, "Unknown error: %d", ptr->lasterror);
- }
- RETURN_STRING(errstr, 1);
-}
-/* }}} */
-
-/* {{{ proto int hw_root(void)
- Returns object id of root collection */
-PHP_FUNCTION(hw_root)
-{
- return_value->value.lval = 0;
- return_value->type = IS_LONG;
-}
-/* }}} */
-
-/* {{{ php_hw_command
- */
-char *php_hw_command(INTERNAL_FUNCTION_PARAMETERS, int comm) {
- pval **arg1;
- int link, type;
- hw_connection *ptr;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- return NULL;
- }
- convert_to_long_ex(arg1);
- link=(*arg1)->value.lval;
- ptr = zend_list_find(link,&type);
- if(!ptr || (type!=le_socketp && type!=le_psocketp)) {
- php_error(E_WARNING,"Unable to find file identifier %d",link);
- return NULL;
- }
-
- set_swap(ptr->swap_on);
- {
- char *object = NULL;
- if (0 != (ptr->lasterror = send_command(ptr->socket, comm, &object)))
- return NULL;
-
- return object;
- }
-}
-/* }}} */
-
-/* {{{ proto string hw_stat(int link)
- Returns status string */
-PHP_FUNCTION(hw_stat) {
- char *object;
-
- object = php_hw_command(INTERNAL_FUNCTION_PARAM_PASSTHRU, STAT_COMMAND);
- if(object == NULL)
- RETURN_FALSE;
-
- return_value->value.str.val = object;
- return_value->value.str.len = strlen(object);
- return_value->type = IS_STRING;
-}
-/* }}} */
-
-/* {{{ proto array hw_who(int link)
- Returns names and info of users loged in */
-PHP_FUNCTION(hw_who) {
- zval *user_arr;
- char *object, *ptr, *temp, *attrname;
- int i;
- char *strtok_buf;
-
- object = php_hw_command(INTERNAL_FUNCTION_PARAM_PASSTHRU, WHO_COMMAND);
- if(object == NULL)
- RETURN_FALSE;
-
- ptr = object;
-
-php_printf("%s\n", ptr);
- /* Skip first two lines, they just contain:
- Users in Database
-
- */
- while((*ptr != '\0') && (*ptr != '\n'))
- ptr++;
- while((*ptr != '\0') && (*ptr != '\n'))
- ptr++;
- if(*ptr == '\0') {
- efree(object);
- RETURN_FALSE;
- }
-
- if (array_init(return_value) == FAILURE) {
- efree(object);
- RETURN_FALSE;
- }
-
- temp = estrdup(ptr);
- attrname = php_strtok_r(temp, "\n", &strtok_buf);
- i = 0;
- while(attrname != NULL) {
- char *name;
-
- ALLOC_ZVAL(user_arr);
- if (array_init(user_arr) == FAILURE) {
- efree(object);
- RETURN_FALSE;
- }
-
- ptr = attrname;
- if(*ptr++ == '*')
- add_assoc_long(user_arr, "self", 1);
- else
- add_assoc_long(user_arr, "self", 0);
-
- ptr++;
- name = ptr;
- while((*ptr != '\0') && (*ptr != ' '))
- ptr++;
- *ptr = '\0';
- add_assoc_string(user_arr, "id", name, 1);
-
- ptr++;
- name = ptr;
- while((*ptr != '\0') && (*ptr != ' '))
- ptr++;
- *ptr = '\0';
- add_assoc_string(user_arr, "name", name, 1);
-
- ptr++;
- while((*ptr != '\0') && (*ptr == ' '))
- ptr++;
-
- name = ptr;
- while((*ptr != '\0') && (*ptr != ' '))
- ptr++;
- *ptr = '\0';
- add_assoc_string(user_arr, "system", name, 1);
-
- ptr++;
- while((*ptr != '\0') && (*ptr == ' '))
- ptr++;
-
- name = ptr;
- while((*ptr != '\0') && (*ptr != ' '))
- ptr++;
- *ptr = '\0';
- add_assoc_string(user_arr, "onSinceDate", name, 1);
-
- ptr++;
- while((*ptr != '\0') && (*ptr == ' '))
- ptr++;
-
- name = ptr;
- while((*ptr != '\0') && (*ptr != ' '))
- ptr++;
- *ptr = '\0';
- add_assoc_string(user_arr, "onSinceTime", name, 1);
-
- ptr++;
- while((*ptr != '\0') && (*ptr == ' '))
- ptr++;
-
- name = ptr;
- while((*ptr != '\0') && (*ptr != ' '))
- ptr++;
- *ptr = '\0';
- add_assoc_string(user_arr, "TotalTime", name, 1);
-
- /* Add the user array */
- zend_hash_index_update(return_value->value.ht, i++, &user_arr, sizeof(pval), NULL);
-
- attrname = php_strtok_r(NULL, "\n", &strtok_buf);
- }
- efree(temp);
- efree(object);
-
-}
-/* }}} */
-
-/* {{{ proto string hw_dummy(int link, int id, int msgid)
- Hyperwave dummy function */
-PHP_FUNCTION(hw_dummy) {
- pval **arg1, **arg2, **arg3;
- int link, id, type, msgid;
- hw_connection *ptr;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &arg1, &arg2, &arg3) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(arg1);
- convert_to_long_ex(arg2);
- convert_to_long_ex(arg3);
- link=(*arg1)->value.lval;
- id=(*arg2)->value.lval;
- msgid=(*arg3)->value.lval;
- ptr = zend_list_find(link,&type);
- if(!ptr || (type!=le_socketp && type!=le_psocketp)) {
- php_error(E_WARNING,"Unable to find file identifier %d",id);
- RETURN_FALSE;
- }
-
- set_swap(ptr->swap_on);
- {
- char *object = NULL;
- if (0 != (ptr->lasterror = send_dummy(ptr->socket, id, msgid, &object)))
- RETURN_FALSE;
-
-php_printf("%s", object);
- return_value->value.str.val = object;
- return_value->value.str.len = strlen(object);
- return_value->type = IS_STRING;
- }
-}
-/* }}} */
-
-/* {{{ proto string hw_getobject(int link, int objid [, string query])
- Returns object record */
-PHP_FUNCTION(hw_getobject) {
- pval **argv[3];
- int argc, link, id, type, multi;
- char *query;
- hw_connection *ptr;
-
- argc = ZEND_NUM_ARGS();
- if(argc < 2 || argc > 3)
- WRONG_PARAM_COUNT;
- if (zend_get_parameters_array_ex(argc, argv) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_long_ex(argv[0]);
- if((*argv[1])->type == IS_ARRAY) {
- multi = 1;
- convert_to_array_ex(argv[1]);
- } else {
- multi = 0;
- convert_to_long_ex(argv[1]);
- }
-
- if(argc == 3) {
- convert_to_string_ex(argv[2]);
- query = (*argv[2])->value.str.val;
- } else
- query = NULL;
-
- link=(*argv[0])->value.lval;
- ptr = zend_list_find(link,&type);
- if(!ptr || (type!=le_socketp && type!=le_psocketp)) {
- php_error(E_WARNING,"Unable to find file identifier %d", link);
- RETURN_FALSE;
- }
-
- set_swap(ptr->swap_on);
- if(multi) {
- char **objects = NULL;
- int count, *ids, i;
- HashTable *lht;
- zval **keydata;
-
- lht = (*argv[1])->value.ht;
- if(0 == (count = zend_hash_num_elements(lht))) {
- RETURN_FALSE;
- }
- ids = emalloc(count * sizeof(hw_objectID));
-
- zend_hash_internal_pointer_reset(lht);
- for(i=0; i<count; i++) {
- zend_hash_get_current_data(lht, (void **) &keydata);
- switch((*keydata)->type) {
- case IS_LONG:
- ids[i] = (*keydata)->value.lval;
- break;
- default:
- ids[i] = (*keydata)->value.lval;
- }
- zend_hash_move_forward(lht);
- }
-
- if (0 != (ptr->lasterror = send_objectbyidquery(ptr->socket, ids, &count, query, &objects))) {
- efree(ids);
- RETURN_FALSE;
- }
- efree(ids);
- if (array_init(return_value) == FAILURE) {
- efree(objects);
- RETURN_FALSE;
- }
-
- for(i=0; i<count; i++) {
- add_index_string(return_value, i, objects[i], 0);
- }
- efree(objects);
-
- } else {
- char *object = NULL;
- id=(*argv[1])->value.lval;
- if (0 != (ptr->lasterror = send_getobject(ptr->socket, id, &object)))
- RETURN_FALSE;
-
- RETURN_STRING(object, 0);
- }
-}
-/* }}} */
-
-/* {{{ proto int hw_insertobject(int link, string objrec, string parms)
- Inserts an object */
-PHP_FUNCTION(hw_insertobject) {
- pval *arg1, *arg2, *arg3;
- int link, type;
- char *objrec, *parms;
- hw_connection *ptr;
-
- if (ZEND_NUM_ARGS() != 3 || getParameters(ht, 3, &arg1, &arg2, &arg3) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long(arg1);
- convert_to_string(arg2);
- convert_to_string(arg3);
- link=arg1->value.lval;
- objrec=arg2->value.str.val;
- parms=arg3->value.str.val;
- ptr = zend_list_find(link,&type);
- if(!ptr || (type!=le_socketp && type!=le_psocketp)) {
- php_error(E_WARNING,"Unable to find file identifier %d",link);
- RETURN_FALSE;
- }
-
- set_swap(ptr->swap_on);
- {
- int objid;
- if (0 != (ptr->lasterror = send_insertobject(ptr->socket, objrec, parms, &objid)))
- RETURN_FALSE;
-
- RETURN_LONG(objid);
- }
-}
-/* }}} */
-
-/* {{{ proto string hw_getandlock(int link, int objid)
- Returns object record and locks object */
-PHP_FUNCTION(hw_getandlock) {
- pval *arg1, *arg2;
- int link, id, type;
- hw_connection *ptr;
-
- if (ZEND_NUM_ARGS() != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long(arg1);
- convert_to_long(arg2);
- link=arg1->value.lval;
- id=arg2->value.lval;
- ptr = zend_list_find(link,&type);
- if(!ptr || (type!=le_socketp && type!=le_psocketp)) {
- php_error(E_WARNING,"Unable to find file identifier %d",id);
- RETURN_FALSE;
- }
-
- set_swap(ptr->swap_on);
- {
- char *object = NULL;
- if (0 != (ptr->lasterror = send_getandlock(ptr->socket, id, &object)))
- RETURN_FALSE;
-
- RETURN_STRING(object, 0);
- }
-}
-/* }}} */
-
-/* {{{ proto void hw_unlock(int link, int objid)
- Unlocks object */
-PHP_FUNCTION(hw_unlock) {
- pval *arg1, *arg2;
- int link, id, type;
- hw_connection *ptr;
-
- if (ZEND_NUM_ARGS() != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long(arg1);
- convert_to_long(arg2);
- link=arg1->value.lval;
- id=arg2->value.lval;
- ptr = zend_list_find(link,&type);
- if(!ptr || (type!=le_socketp && type!=le_psocketp)) {
- php_error(E_WARNING,"Unable to find file identifier %d",id);
- RETURN_FALSE;
- }
-
- set_swap(ptr->swap_on);
- if (0 != (ptr->lasterror = send_unlock(ptr->socket, id)))
- RETURN_FALSE;
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void hw_deleteobject(int link, int objid)
- Deletes object */
-PHP_FUNCTION(hw_deleteobject) {
- pval *arg1, *arg2;
- int link, id, type;
- hw_connection *ptr;
-
- if (ZEND_NUM_ARGS() != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long(arg1);
- convert_to_long(arg2);
- link=arg1->value.lval;
- id=arg2->value.lval;
- ptr = zend_list_find(link,&type);
- if(!ptr || (type!=le_socketp && type!=le_psocketp)) {
- php_error(E_WARNING,"Unable to find file identifier %d",id);
- RETURN_FALSE;
- }
-
- set_swap(ptr->swap_on);
- if (0 != (ptr->lasterror = send_deleteobject(ptr->socket, id)))
- RETURN_FALSE;
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void hw_changeobject(int link, int objid, array attributes)
- Changes attributes of an object (obsolete) */
-#define BUFFERLEN 200
-PHP_FUNCTION(hw_changeobject) {
- pval *arg1, *arg2, *arg3;
- int link, id, type, i;
- hw_connection *ptr;
- char *modification, *oldobjrec, buf[BUFFERLEN];
- HashTable *newobjarr;
-
- if (ZEND_NUM_ARGS() != 3 || getParameters(ht, 3, &arg1, &arg2, &arg3) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long(arg1); /* Connection */
- convert_to_long(arg2); /* object ID */
- convert_to_array(arg3); /* Array with new attributes */
- link=arg1->value.lval;
- id=arg2->value.lval;
- newobjarr=arg3->value.ht;
- ptr = zend_list_find(link,&type);
- if(!ptr || (type!=le_socketp && type!=le_psocketp)) {
- php_error(E_WARNING,"Unable to find file identifier %d",id);
- RETURN_FALSE;
- }
-
- /* get the old object record */
- if(0 != (ptr->lasterror = send_getandlock(ptr->socket, id, &oldobjrec)))
- RETURN_FALSE;
-
- zend_hash_internal_pointer_reset(newobjarr);
- modification = strdup("");
- for(i=0; i<zend_hash_num_elements(newobjarr); i++) {
- char *key, *str, *str1, newattribute[BUFFERLEN];
- pval *data, **dataptr;
- int j, noinsert=1;
- ulong ind;
-
- zend_hash_get_current_key(newobjarr, &key, &ind, 0);
- zend_hash_get_current_data(newobjarr, (void *) &dataptr);
- data = *dataptr;
- switch(data->type) {
- case IS_STRING:
- if(strlen(data->value.str.val) == 0)
- snprintf(newattribute, BUFFERLEN, "rem %s", key);
- else
- snprintf(newattribute, BUFFERLEN, "add %s=%s", key, data->value.str.val);
- noinsert = 0;
- break;
- default:
- newattribute[0] = '\0';
- }
- if(!noinsert) {
- modification = fnInsStr(modification, 0, "\\");
- modification = fnInsStr(modification, 0, newattribute);
-/* modification = fnInsStr(modification, 0, "add "); */
-
- /* Retrieve the old attribute from object record */
- if(NULL != (str = strstr(oldobjrec, key))) {
- str1 = str;
- j = 0;
- while((str1 != NULL) && (*str1 != '\n') && (j < BUFFERLEN-1)) {
- buf[j++] = *str1++;
- }
- buf[j] = '\0';
- modification = fnInsStr(modification, 0, "\\");
- modification = fnInsStr(modification, 0, buf);
- modification = fnInsStr(modification, 0, "rem ");
- }
- }
- zend_hash_move_forward(newobjarr);
- }
- efree(oldobjrec);
-
- set_swap(ptr->swap_on);
- modification[strlen(modification)-1] = '\0';
- if (0 != (ptr->lasterror = send_changeobject(ptr->socket, id, modification))) {
- free(modification);
- send_unlock(ptr->socket, id);
- RETURN_FALSE;
- }
- free(modification);
- if (0 != (ptr->lasterror = send_unlock(ptr->socket, id))) {
- RETURN_FALSE;
- }
- RETURN_TRUE;
-}
-#undef BUFFERLEN
-/* }}} */
-
-/* {{{ proto void hw_modifyobject(int link, int objid, array remattributes, array addattributes [, int mode])
- Modifies attributes of an object */
-#define BUFFERLEN 200
-PHP_FUNCTION(hw_modifyobject) {
- zval **argv[5];
- int argc;
- int link, id, type, i, mode;
- hw_connection *ptr;
- char *modification;
- HashTable *remobjarr, *addobjarr;
-
- argc = ZEND_NUM_ARGS();
- if((argc > 5) || (argc < 4))
- WRONG_PARAM_COUNT;
-
- if (zend_get_parameters_array_ex(argc, argv) == FAILURE)
- if(argc < 4) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(argv[0]); /* Connection */
- convert_to_long_ex(argv[1]); /* object ID */
- convert_to_array_ex(argv[2]); /* Array with attributes to remove */
- convert_to_array_ex(argv[3]); /* Array with attributes to add */
- if(argc == 5) {
- convert_to_long_ex(argv[4]);
- mode = (*argv[4])->value.lval;
- } else
- mode = 0;
- link=(*argv[0])->value.lval;
- id=(*argv[1])->value.lval;
- remobjarr=(*argv[2])->value.ht;
- addobjarr=(*argv[3])->value.ht;
- ptr = zend_list_find(link,&type);
- if(!ptr || (type!=le_socketp && type!=le_psocketp)) {
- php_error(E_WARNING,"Unable to find file identifier %d",id);
- RETURN_FALSE;
- }
-
- modification = strdup("");
- if(addobjarr != NULL) {
- zend_hash_internal_pointer_reset(addobjarr);
- for(i=0; i<zend_hash_num_elements(addobjarr); i++) {
- char *key, addattribute[BUFFERLEN];
- zval *data, **dataptr;
- int noinsert=1;
- ulong ind;
-
- zend_hash_get_current_key(addobjarr, &key, &ind, 0);
- zend_hash_get_current_data(addobjarr, (void *) &dataptr);
- data = *dataptr;
- switch(data->type) {
- case IS_STRING:
- if(strlen(data->value.str.val) > 0) {
- snprintf(addattribute, BUFFERLEN, "add %s=%s", key, data->value.str.val);
-/* fprintf(stderr, "add: %s\n", addattribute); */
- noinsert = 0;
- }
- break;
- case IS_ARRAY: {
- int i, len, keylen, count;
- char *strarr, *ptr, *ptr1;
- count = zend_hash_num_elements(data->value.ht);
- if(count > 0) {
- strarr = make_objrec_from_array(data->value.ht);
- len = strlen(strarr) - 1;
- keylen = strlen(key);
- if(NULL == (ptr = malloc(len + 1 + count*(keylen+1+4)))) {
- if(modification)
- free(modification);
- RETURN_FALSE;
- }
- ptr1 = ptr;
- *ptr1 = '\0';
- strcpy(ptr1, "add ");
- ptr1 += 4;
- strcpy(ptr1, key);
- ptr1 += keylen;
- *ptr1++ = '=';
- for(i=0; i<len; i++) {
- *ptr1++ = strarr[i];
- if(strarr[i] == '\n') {
- ptr1[-1] = '\\';
- strcpy(ptr1, "add ");
- ptr1 += 4;
- strcpy(ptr1, key);
- ptr1 += keylen;
- *ptr1++ = '=';
- } else if(strarr[i] == '=')
- ptr1[-1] = ':';
- }
- *ptr1 = '\0';
- strlcpy(addattribute, ptr, sizeof(addattribute));
- noinsert = 0;
- }
- break;
- }
- }
- if(!noinsert) {
- modification = fnInsStr(modification, 0, "\\");
- modification = fnInsStr(modification, 0, addattribute);
- }
- zend_hash_move_forward(addobjarr);
- }
- }
-
- if(remobjarr != NULL) {
- int nr;
- zend_hash_internal_pointer_reset(remobjarr);
- nr = zend_hash_num_elements(remobjarr);
- for(i=0; i<nr; i++) {
- char *key, remattribute[BUFFERLEN];
- zval *data, **dataptr;
- int noinsert=1;
- ulong ind;
-
- zend_hash_get_current_key(remobjarr, &key, &ind, 0);
- zend_hash_get_current_data(remobjarr, (void *) &dataptr);
- data = *dataptr;
- switch(data->type) {
- case IS_STRING:
- if(strlen(data->value.str.val) > 0) {
- snprintf(remattribute, BUFFERLEN, "rem %s=%s", key, data->value.str.val);
- noinsert = 0;
- } else {
- snprintf(remattribute, BUFFERLEN, "rem %s", key);
- noinsert = 0;
- }
- break;
- case IS_ARRAY: {
- int i, len, keylen, count;
- char *strarr, *ptr, *ptr1;
- count = zend_hash_num_elements(data->value.ht);
- if(count > 0) {
- strarr = make_objrec_from_array(data->value.ht);
- len = strlen(strarr) - 1;
- keylen = strlen(key);
- if(NULL == (ptr = malloc(len + 1 + count*(keylen+1+4)))) {
- if(modification)
- free(modification);
- RETURN_FALSE;
- }
- ptr1 = ptr;
- *ptr1 = '\0';
- strcpy(ptr1, "rem ");
- ptr1 += 4;
- strcpy(ptr1, key);
- ptr1 += keylen;
- *ptr1++ = '=';
- for(i=0; i<len; i++) {
- *ptr1++ = strarr[i];
- if(strarr[i] == '\n') {
- ptr1[-1] = '\\';
- strcpy(ptr1, "rem ");
- ptr1 += 4;
- strcpy(ptr1, key);
- ptr1 += keylen;
- *ptr1++ = '=';
- } else if(strarr[i] == '=')
- ptr1[-1] = ':';
- }
- *ptr1++ = '\n';
- *ptr1 = '\0';
- strlcpy(remattribute, ptr, sizeof(remattribute));
- noinsert = 0;
- }
- break;
- }
- }
- if(!noinsert) {
- modification = fnInsStr(modification, 0, "\\");
- modification = fnInsStr(modification, 0, remattribute);
- }
- zend_hash_move_forward(remobjarr);
- }
- }
-
- set_swap(ptr->swap_on);
- modification[strlen(modification)-1] = '\0';
- if(strlen(modification) == 0) {
- ptr->lasterror = 0;
- free(modification);
- RETURN_TRUE;
- }
-/* fprintf(stderr, "modifyobject: %s\n", modification); */
- switch(mode) {
- case 0:
- if (0 == (ptr->lasterror = send_lock(ptr->socket, id))) {
- if (0 == (ptr->lasterror = send_changeobject(ptr->socket, id, modification))) {
- if (0 != (ptr->lasterror = send_unlock(ptr->socket, id))) {
- php_error(E_WARNING,"Aiii, Changeobject failed and couldn't unlock object (id = 0x%X)", id);
- free(modification);
- RETURN_FALSE;
- }
- free(modification);
- RETURN_FALSE;
- } else {
- send_unlock(ptr->socket, id);
- free(modification);
- RETURN_FALSE;
- }
- } else {
- php_error(E_WARNING,"Could not lock object (id = 0x%X)", id);
- free(modification);
- RETURN_FALSE;
- }
- break;
- case 1:
-/* WARNING: send_groupchangobject() only works right, if each attribute
- can be modified. Doing a changeobject recursively often tries to
- modify objects which cannot be modified e.g. because an attribute cannot
- be removed. In such a case no further modification on that object is done.
- Doing a 'rem Rights\add Rights=R:a' will fail completely if the attribute
- Rights is not there already. The object locking is done in send_groupchangeobject();
-*/
- if (0 != (ptr->lasterror = send_groupchangeobject(ptr->socket, id, modification))) {
- free(modification);
- RETURN_FALSE;
- }
- break;
- default:
- php_error(E_WARNING,"hw_modifyobject: Mode must be 0 or 1 (recursive)");
- }
- free(modification);
- RETURN_TRUE;
-}
-#undef BUFFERLEN
-/* }}} */
-
-/* {{{ php_hw_mvcp
- */
-void php_hw_mvcp(INTERNAL_FUNCTION_PARAMETERS, int mvcp) {
- pval *arg1, *arg2, *arg3, *arg4;
- int link, type, dest=0, from=0, count;
- HashTable *src_arr;
- hw_connection *ptr;
- int collIDcount, docIDcount, i, *docIDs, *collIDs;
-
- switch(mvcp) {
- case MOVE: /* Move also has fromID */
- if (ZEND_NUM_ARGS() != 4 || getParameters(ht, 4, &arg1, &arg2, &arg3, &arg4) == FAILURE)
- WRONG_PARAM_COUNT;
- break;
- case COPY:
- if (ZEND_NUM_ARGS() != 3 || getParameters(ht, 3, &arg1, &arg2, &arg3) == FAILURE)
- WRONG_PARAM_COUNT;
- break;
- }
- convert_to_long(arg1);
- convert_to_array(arg2);
- convert_to_long(arg3);
- link=arg1->value.lval;
- src_arr=arg2->value.ht;
- switch(mvcp) {
- case MOVE: /* Move also has fromID, which is arg3 --> arg4 becomes destID */
- convert_to_long(arg4);
- from=arg3->value.lval;
- dest=arg4->value.lval;
- break;
- case COPY: /* No fromID for Copy needed --> arg3 is destID */
- dest=arg3->value.lval;
- from = 0;
- break;
- }
- ptr = zend_list_find(link,&type);
- if(!ptr || (type!=le_socketp && type!=le_psocketp)) {
- php_error(E_WARNING,"Unable to find file identifier %d",link);
- RETURN_FALSE;
- }
-
- set_swap(ptr->swap_on);
-
- count = zend_hash_num_elements(src_arr);
- if(NULL == (collIDs = emalloc(count * sizeof(int)))) {
- RETURN_FALSE;
- }
-
- if(NULL == (docIDs = emalloc(count * sizeof(int)))) {
- efree(collIDs);
- RETURN_FALSE;
- }
-
- collIDcount = docIDcount = 0;
- zend_hash_internal_pointer_reset(src_arr);
- for(i=0; i<count; i++) {
- char *objrec;
- zval *keydata, **keydataptr;
- zend_hash_get_current_data(src_arr, (void **) &keydataptr);
- keydata = *keydataptr;
- if(keydata->type == IS_LONG) {
- if(0 != (ptr->lasterror = send_getobject(ptr->socket, keydata->value.lval, &objrec))) {
- efree(collIDs);
- efree(docIDs);
- RETURN_FALSE;
- }
- if(0 == fnAttributeCompare(objrec, "DocumentType", "collection"))
- collIDs[collIDcount++] = keydata->value.lval;
- else
- docIDs[docIDcount++] = keydata->value.lval;
- efree(objrec);
- }
- zend_hash_move_forward(src_arr);
- }
-
- if (0 != (ptr->lasterror = send_mvcpdocscoll(ptr->socket, docIDs, docIDcount, from, dest, mvcp))) {
- efree(collIDs);
- efree(docIDs);
- RETURN_FALSE;
- }
-
- if (0 != (ptr->lasterror = send_mvcpcollscoll(ptr->socket, collIDs, collIDcount, from, dest, mvcp))) {
- efree(collIDs);
- efree(docIDs);
- RETURN_FALSE;
- }
-
- efree(collIDs);
- efree(docIDs);
-
- RETURN_LONG(docIDcount + collIDcount);
-}
-/* }}} */
-
-/* {{{ proto void hw_mv(int link, array objrec, int from, int dest)
- Moves object */
-PHP_FUNCTION(hw_mv) {
- php_hw_mvcp(INTERNAL_FUNCTION_PARAM_PASSTHRU, MOVE);
-}
-/* }}} */
-
-/* {{{ proto void hw_cp(int link, array objrec, int dest)
- Copies object */
-PHP_FUNCTION(hw_cp) {
- php_hw_mvcp(INTERNAL_FUNCTION_PARAM_PASSTHRU, COPY);
-}
-/* }}} */
-
-/* {{{ proto hwdoc hw_gettext(int link, int objid [, int rootid])
- Returns text document. Links are relative to rootid if given */
-PHP_FUNCTION(hw_gettext) {
- pval *argv[3];
- int argc, link, id, type, mode;
- int rootid = 0;
- char *urlprefix;
- hw_document *doc;
- hw_connection *ptr;
-
- argc = ZEND_NUM_ARGS();
- if((argc > 3) || (argc < 2))
- WRONG_PARAM_COUNT;
-
- if (getParametersArray(ht, argc, argv) == FAILURE)
- RETURN_FALSE;
-
- convert_to_long(argv[0]);
- convert_to_long(argv[1]);
- mode = 0;
- urlprefix = NULL;
- if(argc == 3) {
- switch(argv[2]->type) {
- case IS_LONG:
- convert_to_long(argv[2]);
- rootid = argv[2]->value.lval;
- mode = 1;
- break;
- case IS_STRING:
- convert_to_string(argv[2]);
- urlprefix = argv[2]->value.str.val;
- break;
- }
- }
- link=argv[0]->value.lval;
- id=argv[1]->value.lval;
- ptr = zend_list_find(link,&type);
- if(!ptr || (type!=le_socketp && type!=le_psocketp)) {
- php_error(E_WARNING,"Unable to find file identifier %d",id);
- RETURN_FALSE;
- }
-
- set_swap(ptr->swap_on);
- {
- char *object = NULL;
- char *attributes = NULL;
- char *bodytag = NULL;
- int count;
- /* !!!! memory for object and attributes is allocated with malloc !!!! */
- if (0 != (ptr->lasterror = send_gettext(ptr->socket, id, mode, rootid, &attributes, &bodytag, &object, &count, urlprefix)))
- RETURN_FALSE;
- doc = malloc(sizeof(hw_document));
- doc->data = object;
- doc->attributes = attributes;
- doc->bodytag = bodytag;
- doc->size = count;
- return_value->value.lval = zend_list_insert(doc,le_document);
- return_value->type = IS_LONG;
- }
-}
-/* }}} */
-
-/* {{{ proto void hw_edittext(int link, hwdoc doc)
- Modifies text document */
-PHP_FUNCTION(hw_edittext) {
- pval *arg1, *arg2;
- int link, doc, type;
- hw_connection *ptr;
- hw_document *docptr;
-
- if (ZEND_NUM_ARGS() != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long(arg1);
- convert_to_long(arg2);
- link=arg1->value.lval;
- ptr = zend_list_find(link,&type);
-
- if(!ptr || (type!=le_socketp && type!=le_psocketp)) {
- php_error(E_WARNING,"Unable to find socket identifier %d",link);
- RETURN_FALSE;
- }
-
- doc=arg2->value.lval;
- docptr = zend_list_find(doc,&type);
-
- if(!docptr || (type!=le_document)) {
- php_error(E_WARNING,"Unable to find document identifier %d", doc);
- RETURN_FALSE;
- }
-
- set_swap(ptr->swap_on);
- {
- if (0 != (ptr->lasterror = send_edittext(ptr->socket, docptr->attributes, docptr->data))) {
- RETURN_FALSE;
- }
- }
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto hwdoc hw_getcgi(int link, int objid)
- Returns the output of a CGI script */
-#define BUFFERLEN 1000
-/* FIX ME: The buffer cgi_env_str should be allocated dynamically */
-PHP_FUNCTION(hw_getcgi) {
- pval *arg1, *arg2;
- int link, id, type;
- hw_document *doc;
- hw_connection *ptr;
- char cgi_env_str[BUFFERLEN];
-
- if (ZEND_NUM_ARGS() != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long(arg1);
- convert_to_long(arg2);
- link=arg1->value.lval;
- id=arg2->value.lval;
- ptr = zend_list_find(link,&type);
- if(!ptr || (type!=le_socketp && type!=le_psocketp)) {
- php_error(E_WARNING,"Unable to find file identifier %d",id);
- RETURN_FALSE;
- }
-
- set_swap(ptr->swap_on);
- {
- char *object = NULL;
- char *attributes = NULL;
- int count;
-
- /* Here is another undocument function of Hyperwave.
- If you call a cgi script with getcgi-message, you will
- have to provide the complete cgi enviroment, since it is
- only known to the webserver (or wavemaster). This is done
- by extending the object record with the following incomplete
- string. It should contain any enviroment variable a cgi script
- requires.
- */
-#ifdef PHP_WIN32
- snprintf(cgi_env_str, BUFFERLEN, "CGI_REQUEST_METHOD=%s\nCGI_PATH_INFO=%s\nCGI_QUERY_STRING=%s",
- getenv("REQUEST_METHOD"),
- getenv("PATH_INFO"),
- getenv("QUERY_STRING"));
-#else
- snprintf(cgi_env_str, BUFFERLEN, "CGI_REQUEST_METHOD=%s\nCGI_PATH_INFO=%s\nCGI_QUERY_STRING=%s",
- SG(request_info).request_method,
- SG(request_info).request_uri,
- SG(request_info).query_string);
-#endif
- /* !!!! memory for object and attributes is allocated with malloc !!!! */
- if (0 != (ptr->lasterror = send_getcgi(ptr->socket, id, cgi_env_str, &attributes, &object, &count)))
- RETURN_FALSE;
- doc = malloc(sizeof(hw_document));
- doc->data = object;
- doc->attributes = attributes;
- doc->bodytag = NULL;
- doc->size = count;
- return_value->value.lval = zend_list_insert(doc,le_document);
- return_value->type = IS_LONG;
- }
-}
-#undef BUFFERLEN
-/* }}} */
-
-/* {{{ proto int hw_getremote(int link, int objid)
- Returns the content of a remote document */
-PHP_FUNCTION(hw_getremote) {
- pval *arg1, *arg2;
- int link, id, type;
- hw_document *doc;
- hw_connection *ptr;
-
- if (ZEND_NUM_ARGS() != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long(arg1);
- convert_to_long(arg2);
- link=arg1->value.lval;
- id=arg2->value.lval;
- ptr = zend_list_find(link,&type);
- if(!ptr || (type!=le_socketp && type!=le_psocketp)) {
- php_error(E_WARNING,"Unable to find file identifier %d",id);
- RETURN_FALSE;
- }
-
- set_swap(ptr->swap_on);
- {
- char *object = NULL;
- char *attributes = NULL;
- int count;
- /* !!!! memory for object and attributes is allocated with malloc !!!! */
- if (0 != (ptr->lasterror = send_getremote(ptr->socket, id, &attributes, &object, &count)))
- RETURN_FALSE;
- doc = malloc(sizeof(hw_document));
- doc->data = object;
- doc->attributes = attributes;
- doc->bodytag = NULL;
- doc->size = count;
- return_value->value.lval = zend_list_insert(doc,le_document);
- return_value->type = IS_LONG;
- }
-}
-/* }}} */
-
-/* {{{ proto [array|int] hw_getremotechildren(int link, string objrec)
- Returns the remote document or an array of object records */
-PHP_FUNCTION(hw_getremotechildren) {
- pval *arg1, *arg2;
- int link, type, i;
- hw_connection *ptr;
- char *objrec;
-
- if (ZEND_NUM_ARGS() != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long(arg1);
- convert_to_string(arg2);
- link=arg1->value.lval;
- objrec=arg2->value.str.val;
- ptr = zend_list_find(link,&type);
- if(!ptr || (type!=le_socketp && type!=le_psocketp)) {
- php_error(E_WARNING,"Unable to find file identifier %d", link);
- RETURN_FALSE;
- }
- set_swap(ptr->swap_on);
- {
- int count, *offsets;
- char *remainder, *ptr1;
- if (0 != (ptr->lasterror = send_getremotechildren(ptr->socket, objrec, &remainder, &offsets, &count)))
- RETURN_FALSE;
-
-/*
-for(i=0;i<count;i++)
- php_printf("offset[%d] = %d--\n", i, offsets[i]);
-php_printf("count = %d, remainder = <HR>%s---<HR>", count, remainder);
-*/
- /* The remainder depends on the number of returned objects and
- whether the MimeType of the object to retrieve is set. If
- the MimeType is set the result will start with the
- HTTP header 'Content-type: mimetype', otherwise it will be
- a list of object records and therefore starts with
- 'ObjectID=0'. In the first case the offset and count are somewhat
- strange. Quite often count had a value of 6 which appears to be
- meaningless, but if you sum up the offsets you get the length
- of the remainder which is the lenght of the document.
- The document must have been chopped up into 6 pieces, each ending
- with 'ServerId=0xYYYYYYYY'.
- In the second case the offset contains the lenght of
- each object record; count contains the number of object records.
- Even if a remote object has children
- (several sql statements) but the MimeType is set, it will
- return a document in the format of MimeType. On the other
- hand a remote object does not have any children but just
- returns a docuement will not be shown unless the MimeType
- is set. It returns the pure object record of the object without
- the SQLStatement attribute. Quite senseless.
- Though, this behavior depends on how the hgi gateway in Hyperwave
- is implemented.
- */
- if(strncmp(remainder, "ObjectID=0 ", 10)) {
- hw_document *doc;
- char *ptr;
- int i, j, len;
- /* For some reason there is always the string
- 'SeverId=0xYYYYYYYY' at the end, so we cut it off.
- The document may as well be divided into several pieces
- and each of them has the ServerId at the end.
- The following will put the pieces back together and
- strip the ServerId. count contains the number of pieces.
- */
- for(i=0, len=0; i<count; i++)
- len += offsets[i]-18;
-/*fprintf(stderr,"len = %d\n", len); */
- doc = malloc(sizeof(hw_document));
- doc->data = malloc(len+1);
- ptr = doc->data;
- for(i=0, j=0; i<count; i++) {
- memcpy((char *)ptr, (char *)&remainder[j], offsets[i]-18);
-/*fprintf(stderr,"rem = %s\n", &remainder[j]); */
- j += offsets[i];
- ptr += offsets[i] - 18;
- }
- *ptr = '\0';
- doc->attributes = strdup(objrec);
- doc->bodytag = NULL;
- doc->size = strlen(doc->data);
- return_value->value.lval = zend_list_insert(doc,le_document);
- return_value->type = IS_LONG;
- } else {
- if (array_init(return_value) == FAILURE) {
- efree(offsets);
- RETURN_FALSE;
- }
-
- ptr1 = remainder;
- for(i=0; i<count; i++) {
- *(ptr1+offsets[i]-1) = '\0';
- add_index_string(return_value, i, ptr1, 1);
- ptr1 += offsets[i];
- }
- }
-
- efree(offsets);
- efree(remainder);
- }
-}
-/* }}} */
-
-/* {{{ proto void hw_setlinkroot(int link, int rootid)
- Set the id to which links are calculated */
-PHP_FUNCTION(hw_setlinkroot) {
- pval *arg1, *arg2;
- int link, type, rootid;
- hw_connection *ptr;
-
- if (ZEND_NUM_ARGS() != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long(arg1);
- convert_to_long(arg2);
- link = arg1->value.lval;
- rootid = arg2->value.lval;
- ptr = zend_list_find(link,&type);
- if(!ptr || (type!=le_socketp && type!=le_psocketp)) {
- php_error(E_WARNING,"Unable to find file identifier %d",link);
- RETURN_FALSE;
- }
-
- ptr->linkroot = rootid;
- RETURN_LONG(rootid);
-}
-/* }}} */
-
-/* {{{ proto hwdoc hw_pipedocument(int link, int objid [, array urlprefixes])
- Returns document with links inserted. Optionally a array with five urlprefixes may be passed, which will be inserted for the different types of anchors. This should be a named array with the following keys: HW_DEFAULT_LINK, HW_IMAGE_LINK, HW_BACKGROUND_LINK, HW_INTAG_LINK, and HW_APPLET_LINK */
-PHP_FUNCTION(hw_pipedocument) {
- pval *arg1, *arg2, *arg3;
- int i, link, id, type, argc, mode;
- int rootid = 0;
- HashTable *prefixarray;
- char **urlprefix;
- hw_connection *ptr;
- hw_document *doc;
-#if APACHE
- server_rec *serv = ((request_rec *) SG(server_context))->server;
-#endif
-
- argc = ZEND_NUM_ARGS();
- switch(argc)
- {
- case 2:
- if (getParameters(ht, 2, &arg1, &arg2) == FAILURE)
- WRONG_PARAM_COUNT;
- break;
- case 3:
- if (getParameters(ht, 3, &arg1, &arg2, &arg3) == FAILURE)
- WRONG_PARAM_COUNT;
- break;
- default:
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(arg1);
- convert_to_long(arg2);
-
- link=arg1->value.lval;
- id=arg2->value.lval;
- ptr = zend_list_find(link,&type);
- if(!ptr || (type!=le_socketp && type!=le_psocketp)) {
- php_error(E_WARNING,"Unable to find file identifier %d", link);
- RETURN_FALSE;
- }
-
- /* check for the array with urlprefixes */
- if(argc == 3) {
- convert_to_array(arg3);
- prefixarray =arg3->value.ht;
- if((prefixarray == NULL) || (zend_hash_num_elements(prefixarray) != 5)) {
- php_error(E_WARNING,"You must provide 5 urlprefixes (you have provided %d)", zend_hash_num_elements(prefixarray));
- RETURN_FALSE;
- }
-
- urlprefix = emalloc(5*sizeof(char *));
- zend_hash_internal_pointer_reset(prefixarray);
- for(i=0; i<5; i++) {
- char *key;
- zval *data, **dataptr;
- ulong ind;
-
- zend_hash_get_current_key(prefixarray, &key, &ind, 0);
- zend_hash_get_current_data(prefixarray, (void *) &dataptr);
- data = *dataptr;
- if (data->type != IS_STRING) {
- php_error(E_WARNING,"%s must be a String", key);
- RETURN_FALSE;
- } else if ( strcmp(key, "HW_DEFAULT_LINK") == 0 ) {
- urlprefix[HW_DEFAULT_LINK] = data->value.str.val;
- } else if ( strcmp(key, "HW_IMAGE_LINK") == 0 ) {
- urlprefix[HW_IMAGE_LINK] = data->value.str.val;
- } else if ( strcmp(key, "HW_BACKGROUND_LINK") == 0 ) {
- urlprefix[HW_BACKGROUND_LINK] = data->value.str.val;
- } else if ( strcmp(key, "HW_INTAG_LINK") == 0 ) {
- urlprefix[HW_INTAG_LINK] = data->value.str.val;
- } else if ( strcmp(key, "HW_APPLET_LINK") == 0 ) {
- urlprefix[HW_APPLET_LINK] = data->value.str.val;
- } else {
- php_error(E_WARNING,"%s is not a valid urlprefix", key);
- RETURN_FALSE;
- }
- zend_hash_move_forward(prefixarray);
- }
- } else {
- urlprefix = NULL;
- }
-
- mode = 0;
- if(ptr->linkroot > 0)
- mode = 1;
- rootid = ptr->linkroot;
-
- set_swap(ptr->swap_on);
- {
- char *object = NULL;
- char *attributes = NULL;
- char *bodytag = NULL;
- int count;
- /* !!!! memory for object, bodytag and attributes is allocated with malloc !!!! */
- if (0 != (ptr->lasterror = send_pipedocument(ptr->socket,
-#if APACHE
- serv->server_hostname,
-#else
- getenv("HOSTNAME"),
-#endif
- id, mode, rootid, &attributes, &bodytag, &object, &count, urlprefix)))
- RETURN_FALSE;
-
- if(urlprefix) efree(urlprefix);
-
- doc = malloc(sizeof(hw_document));
- doc->data = object;
- doc->attributes = attributes;
- doc->bodytag = bodytag;
- doc->size = count;
-/* fprintf(stderr, "size = %d\n", count); */
- return_value->value.lval = zend_list_insert(doc,le_document);
- return_value->type = IS_LONG;
- }
-}
-/* }}} */
-
-/* {{{ proto hwdoc hw_pipedocument(int link, int objid)
- Returns document */
-PHP_FUNCTION(hw_oldpipedocument) {
- pval *argv[3];
- int link, id, type, argc, mode;
- int rootid = 0;
- hw_connection *ptr;
- hw_document *doc;
-#if APACHE
- server_rec *serv = ((request_rec *) SG(server_context))->server;
-#endif
-
- argc = ZEND_NUM_ARGS();
- if((argc > 2) || (argc < 2))
- WRONG_PARAM_COUNT;
-
- if (getParametersArray(ht, argc, argv) == FAILURE)
- RETURN_FALSE;
-
- convert_to_long(argv[0]);
- convert_to_long(argv[1]);
-/* if(argc == 3) {
- convert_to_long(argv[2]);
- rootid = argv[2]->value.lval;
- if(rootid != 0)
- mode = 1;
- }
-*/ link=argv[0]->value.lval;
- id=argv[1]->value.lval;
- ptr = zend_list_find(link,&type);
- if(!ptr || (type!=le_socketp && type!=le_psocketp)) {
- php_error(E_WARNING,"Unable to find file identifier %d", link);
- RETURN_FALSE;
- }
-
- mode = 0;
- if(ptr->linkroot > 0)
- mode = 1;
- rootid = ptr->linkroot;
-
- set_swap(ptr->swap_on);
- {
- char *object = NULL;
- char *attributes = NULL;
- char *bodytag = NULL;
- int count;
- /* !!!! memory for object, bodytag and attributes is allocated with malloc !!!! */
- if (0 != (ptr->lasterror = send_pipedocument(ptr->socket,
-#if APACHE
- serv->server_hostname,
-#else
- getenv("HOSTNAME"),
-#endif
- id, mode, rootid, &attributes, &bodytag, &object, &count, NULL)))
- RETURN_FALSE;
-
- doc = malloc(sizeof(hw_document));
- doc->data = object;
- doc->attributes = attributes;
- doc->bodytag = bodytag;
- doc->size = count;
-/* fprintf(stderr, "size = %d\n", count); */
- return_value->value.lval = zend_list_insert(doc,le_document);
- return_value->type = IS_LONG;
- }
-}
-/* }}} */
-
-/* {{{ proto hwdoc hw_pipecgi(int link, int objid)
- Returns output of CGI script */
-#define BUFFERLEN 1000
-/* FIX ME: The buffer cgi_env_str should be allocated dynamically */
-PHP_FUNCTION(hw_pipecgi) {
- pval *arg1, *arg2;
- int link, id, type;
- hw_connection *ptr;
- hw_document *doc;
- char cgi_env_str[1000];
-#if APACHE
- server_rec *serv = ((request_rec *) SG(server_context))->server;
-#endif
-
- if (ZEND_NUM_ARGS() != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long(arg1);
- convert_to_long(arg2);
- link=arg1->value.lval;
- id=arg2->value.lval;
- ptr = zend_list_find(link,&type);
- if(!ptr || (type!=le_socketp && type!=le_psocketp)) {
- php_error(E_WARNING,"Unable to find file identifier %d",id);
- RETURN_FALSE;
- }
-
- set_swap(ptr->swap_on);
- {
- char *object = NULL;
- char *attributes = NULL;
- int count;
-
-#ifdef PHP_WIN32
- snprintf(cgi_env_str, BUFFERLEN, "CGI_REQUEST_METHOD=%s\nCGI_PATH_INFO=%s\nCGI_QUERY_STRING=%s",
- getenv("REQUEST_METHOD"),
- getenv("PATH_INFO"),
- getenv("QUERY_STRING"));
-#else
- snprintf(cgi_env_str, BUFFERLEN, "CGI_REQUEST_METHOD=%s\nCGI_PATH_INFO=%s\nCGI_QUERY_STRING=%s",
- SG(request_info).request_method,
- SG(request_info).request_uri,
- SG(request_info).query_string);
-#endif
- /* !!!! memory for object, bodytag and attributes is allocated with malloc !!!! */
- if (0 != (ptr->lasterror = send_pipecgi(ptr->socket,
-#if APACHE
- serv->server_hostname,
-#else
- getenv("HOSTNAME"),
-#endif
- id, cgi_env_str, &attributes, &object, &count)))
- RETURN_FALSE;
-
- doc = malloc(sizeof(hw_document));
- doc->data = object;
- doc->attributes = attributes;
- doc->bodytag = NULL;
- doc->size = count;
- return_value->value.lval = zend_list_insert(doc,le_document);
- return_value->type = IS_LONG;
- }
-}
-#undef BUFFERLEN
-/* }}} */
-
-/* {{{ proto void hw_insertdocument(int link, int parentid, hwdoc doc)
- Insert new document */
-PHP_FUNCTION(hw_insertdocument) {
- pval *arg1, *arg2, *arg3;
- int link, id, doc, type;
- hw_connection *ptr;
- hw_document *docptr;
- hw_objectID objid;
-#if APACHE
- server_rec *serv = ((request_rec *) SG(server_context))->server;
-#endif
-
- if (ZEND_NUM_ARGS() != 3 || getParameters(ht, 3, &arg1, &arg2, &arg3) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long(arg1);
- convert_to_long(arg2);
- convert_to_long(arg3);
- link=arg1->value.lval;
- id=arg2->value.lval;
- ptr = zend_list_find(link,&type);
- if(!ptr || (type!=le_socketp && type!=le_psocketp)) {
- php_error(E_WARNING,"Unable to find connection identifier %d",link);
- RETURN_FALSE;
- }
-
- doc=arg3->value.lval;
- docptr = zend_list_find(doc,&type);
- if(!docptr || (type!=le_document)) {
- php_error(E_WARNING,"Unable to find document identifier %d",doc);
- RETURN_FALSE;
- }
-
- set_swap(ptr->swap_on);
- {
- if (0 != (ptr->lasterror = send_putdocument(ptr->socket,
-#if APACHE
- serv->server_hostname,
-#else
- getenv("HOSTNAME"),
-#endif
- id, docptr->attributes, docptr->data, docptr->size, &objid))) {
- RETURN_FALSE;
- }
- }
- RETURN_LONG(objid);
-}
-/* }}} */
-
-/* {{{ proto hwdoc hw_new_document(string objrec, string data, int size)
- Create a new document */
-PHP_FUNCTION(hw_new_document) {
- pval *arg1, *arg2, *arg3;
- char *ptr;
- hw_document *doc;
-
- if (ZEND_NUM_ARGS() != 3 || getParameters(ht, 3, &arg1, &arg2, &arg3) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string(arg1);
- convert_to_string(arg2);
- convert_to_long(arg3);
-
- doc = malloc(sizeof(hw_document));
- if(NULL == doc)
- RETURN_FALSE;
- doc->data = malloc(arg3->value.lval+1);
- if(NULL == doc->data) {
- free(doc);
- RETURN_FALSE;
- }
- memcpy(doc->data, arg2->value.str.val, arg3->value.lval);
- ptr = doc->data;
- ptr[arg3->value.lval] = '\0';
- doc->attributes = strdup(arg1->value.str.val);
- doc->bodytag = NULL;
- doc->size = arg3->value.lval;
- return_value->value.lval = zend_list_insert(doc,le_document);
- return_value->type = IS_LONG;
-}
-/* }}} */
-
-#define BUFSIZE 8192
-/* {{{ proto hwdoc hw_new_document_from_file(string objrec, string filename)
- Create a new document from a file */
-PHP_FUNCTION(hw_new_document_from_file) {
- pval **arg1, **arg2;
- int len, type;
- char *ptr;
- int issock=0;
- int socketd=0;
- FILE *fp;
- int ready=0;
- int bcount=0;
- int use_include_path=0;
- hw_document *doc;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(arg1);
- convert_to_string_ex(arg2);
-
- fp = php_fopen_wrapper((*arg2)->value.str.val,"r", use_include_path|ENFORCE_SAFE_MODE, &issock, &socketd, NULL);
- if (!fp && !socketd){
- if (issock != BAD_URL) {
- char *tmp = estrndup(Z_STRVAL_PP(arg2), Z_STRLEN_PP(arg2));
- php_strip_url_passwd(tmp);
- php_error(E_WARNING,"hw_new_document_from_file(\"%s\") - %s", tmp, strerror(errno));
- efree(tmp);
- }
- RETURN_FALSE;
- }
-
- doc = malloc(sizeof(hw_document));
- if(NULL == doc)
- RETURN_FALSE;
-
-#ifdef HAVE_MMAP
- if(!issock) {
- int fd;
- struct stat sbuf;
- off_t off;
- void *p;
- size_t len;
-
- fd = fileno(fp);
- fstat(fd, &sbuf);
-
- if (sbuf.st_size > BUFSIZE) {
-/* off = ftell(fp); */
- len = sbuf.st_size;/* - off; */
- p = mmap(0, len, PROT_READ, MAP_PRIVATE, fd, off);
- if (p != (void *) MAP_FAILED) {
- doc->data = malloc(len);
- if(NULL == doc->data) {
- munmap(p, len);
- free(doc);
- RETURN_FALSE;
- }
- memcpy(p, doc->data, len);
- munmap(p, len);
- bcount = len;
- doc->size = len;
- ready = 1;
- }
- }
- }
-#endif
-
- if(!ready) {
- int b;
-
- doc->data = malloc(BUFSIZE);
- if(NULL == doc->data) {
- free(doc);
- RETURN_FALSE;
- }
- ptr = doc->data;
- while ((b = FP_FREAD(&ptr[bcount], BUFSIZE, socketd, fp, issock)) > 0) {
- bcount += b;
- doc->data = realloc(doc->data, bcount+BUFSIZE);
- ptr = doc->data;
- }
- }
-
- if (issock) {
- SOCK_FCLOSE(socketd);
- } else {
- fclose(fp);
- }
-
- doc->data = realloc(doc->data, bcount+1);
- ptr = doc->data;
- ptr[bcount] = '\0';
- doc->attributes = strdup((*arg1)->value.str.val);
- doc->bodytag = NULL;
- doc->size = bcount;
- return_value->value.lval = zend_list_insert(doc,le_document);
- return_value->type = IS_LONG;
-}
-/* }}} */
-#undef BUFSIZE
-
-/* {{{ proto void hw_free_document(hwdoc doc)
- Frees memory of document */
-PHP_FUNCTION(hw_free_document) {
- pval *arg1;
- int id, type;
- hw_document *ptr;
-
- if (ZEND_NUM_ARGS() != 1 || getParameters(ht, 1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long(arg1);
- id=arg1->value.lval;
- ptr = zend_list_find(id,&type);
- if(!ptr || (type!=le_document)) {
- php_error(E_WARNING,"Unable to find file identifier %d",id);
- RETURN_FALSE;
- }
- zend_list_delete(id);
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void hw_outputdocument(hwdoc doc)
- An alias for hw_output_document */
-/* }}} */
-
-/* {{{ proto void hw_output_document(hwdoc doc)
- Prints document */
-PHP_FUNCTION(hw_output_document) {
- pval *arg1;
- int id, type;
- hw_document *ptr;
-
- if (ZEND_NUM_ARGS() != 1 || getParameters(ht, 1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long(arg1);
- id=arg1->value.lval;
- ptr = zend_list_find(id,&type);
- if(!ptr || (type!=le_document)) {
- php_error(E_WARNING,"Unable to find file identifier %d",id);
- RETURN_FALSE;
- }
-
- php_write(ptr->data, ptr->size);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto string hw_documentbodytag(hwdoc doc [, string prefix])
- An alias for hw_document_bodytag */
-/* }}} */
-
-/* {{{ proto string hw_document_bodytag(hwdoc doc [, string prefix])
- Return bodytag prefixed by prefix */
-PHP_FUNCTION(hw_document_bodytag) {
- pval *argv[2];
- int id, type, argc;
- hw_document *ptr;
- char *temp, *str = NULL;
-
- argc = ZEND_NUM_ARGS();
- if((argc > 2) || (argc < 1))
- WRONG_PARAM_COUNT;
-
- if (getParametersArray(ht, argc, argv) == FAILURE)
- RETURN_FALSE;
-
- convert_to_long(argv[0]);
- id=argv[0]->value.lval;
- ptr = zend_list_find(id,&type);
- if(!ptr || (type!=le_document)) {
- php_error(E_WARNING,"Unable to find file identifier %d",id);
- RETURN_FALSE;
- }
-
- if(argc == 2) {
- convert_to_string(argv[1]);
- str=argv[1]->value.str.val;
- }
-
- if(str != NULL) {
- temp = emalloc(argv[1]->value.str.len + strlen(ptr->bodytag) + 2);
- strcpy(temp, ptr->bodytag);
- strcpy(temp+strlen(ptr->bodytag)-1, str);
- strcpy(temp+strlen(ptr->bodytag)-1+argv[1]->value.str.len, ">\n");
- RETURN_STRING(temp, 0);
- } else {
-//fprintf(stderr, "hw_document_bodytag: %s (%s)\n", ptr->bodytag, ptr->attributes);
- if(ptr->bodytag) {
- RETURN_STRING(ptr->bodytag, 1);
- } else {
- RETURN_EMPTY_STRING();
- }
- }
-}
-/* }}} */
-
-/* {{{ proto string hw_document_content(hwdoc doc)
- Returns content of document */
-PHP_FUNCTION(hw_document_content) {
- pval *argv[1];
- int id, type, argc;
- hw_document *ptr;
-
- argc = ZEND_NUM_ARGS();
- if(argc != 1)
- WRONG_PARAM_COUNT;
-
- if (getParametersArray(ht, argc, argv) == FAILURE)
- RETURN_FALSE;
-
- convert_to_long(argv[0]);
- id=argv[0]->value.lval;
- ptr = zend_list_find(id,&type);
- if(!ptr || (type!=le_document)) {
- php_error(E_WARNING,"Unable to find file identifier %d",id);
- RETURN_FALSE;
- }
-
- RETURN_STRINGL(ptr->data, ptr->size, 1);
-}
-/* }}} */
-
-/* {{{ proto int hw_document_setcontent(hwdoc doc, string content)
- Sets/replaces content of document */
-PHP_FUNCTION(hw_document_setcontent) {
- pval *argv[2];
- int id, type, argc;
- hw_document *ptr;
- char *str;
-
- argc = ZEND_NUM_ARGS();
- if(argc != 2)
- WRONG_PARAM_COUNT;
-
- if (getParametersArray(ht, argc, argv) == FAILURE)
- RETURN_FALSE;
-
- convert_to_long(argv[0]);
- convert_to_string(argv[1]);
- id=argv[0]->value.lval;
- ptr = zend_list_find(id,&type);
- if(!ptr || (type!=le_document)) {
- php_error(E_WARNING,"Unable to find file identifier %d",id);
- RETURN_FALSE;
- }
-
- str = ptr->data;
- if(NULL != (ptr->data = strdup(argv[1]->value.str.val))) {
- ptr->size = strlen(ptr->data);
- free(str);
- RETURN_TRUE;
- } else {
- ptr->data = str;
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto int hw_documentsize(hwdoc doc)
- An alias for hw_document_size */
-/* }}} */
-
-/* {{{ proto int hw_document_size(hwdoc doc)
- Returns size of document */
-PHP_FUNCTION(hw_document_size) {
- pval *arg1;
- int id, type;
- hw_document *ptr;
-
- if (ZEND_NUM_ARGS() != 1 || getParameters(ht, 1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long(arg1);
- id=arg1->value.lval;
- ptr = zend_list_find(id,&type);
- if(!ptr || (type!=le_document)) {
- php_error(E_WARNING,"Unable to find file identifier %d",id);
- RETURN_FALSE;
- }
-
- RETURN_LONG(ptr->size);
-}
-/* }}} */
-
-/* {{{ proto string hw_documentattributes(hwdoc doc)
- An alias for hw_document_attributes */
-/* }}} */
-
-/* {{{ proto string hw_document_attributes(hwdoc doc)
- Returns object record of document */
-PHP_FUNCTION(hw_document_attributes) {
- pval *arg1;
- int id, type;
- hw_document *ptr;
-
- if (ZEND_NUM_ARGS() != 1 || getParameters(ht, 1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long(arg1);
- id=arg1->value.lval;
- ptr = zend_list_find(id,&type);
- if(!ptr || (type!=le_document)) {
- php_error(E_WARNING,"Unable to find file identifier %d",id);
- RETURN_FALSE;
- }
-
- RETURN_STRING(ptr->attributes, 1);
-/* make_return_array_from_objrec(&return_value, ptr->attributes); */
-}
-/* }}} */
-
-/* {{{ proto array hw_getparentsobj(int link, int objid)
- Returns array of parent object records */
-PHP_FUNCTION(hw_getparentsobj) {
- pval *arg1, *arg2;
- int link, id, type;
- int count;
- char **childObjRecs = NULL;
- hw_connection *ptr;
-
- if (ZEND_NUM_ARGS() != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long(arg1);
- convert_to_long(arg2);
- link=arg1->value.lval;
- id=arg2->value.lval;
- ptr = zend_list_find(link,&type);
- if(!ptr || (type!=le_socketp && type!=le_psocketp)) {
- php_error(E_WARNING,"Unable to find file identifier %d",id);
- RETURN_FALSE;
- }
-
- set_swap(ptr->swap_on);
-
- if (0 != (ptr->lasterror = send_getparentsobj(ptr->socket, id, &childObjRecs, &count))) {
- php_error(E_WARNING, "send_command (getparentsobj) returned %d\n", ptr->lasterror);
- RETURN_FALSE;
- }
-
- /* create return value and free all memory */
- if( 0 > make_return_objrec(&return_value, childObjRecs, count))
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto array hw_getparents(int link, int objid)
- Returns array of parent object ids */
-PHP_FUNCTION(hw_getparents) {
- pval *arg1, *arg2;
- int link, id, type;
- int count;
- hw_connection *ptr;
-
- if (ZEND_NUM_ARGS() != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long(arg1);
- convert_to_long(arg2);
- link=arg1->value.lval;
- id=arg2->value.lval;
- ptr = zend_list_find(link,&type);
- if(!ptr || (type!=le_socketp && type!=le_psocketp)) {
- php_error(E_WARNING,"Unable to find file identifier %d",id);
- RETURN_FALSE;
- }
-
- set_swap(ptr->swap_on);
- {
- int *childIDs = NULL;
- int i;
-
- if (0 != (ptr->lasterror = send_getparents(ptr->socket, id, &childIDs, &count))) {
- php_error(E_WARNING, "send_command (getparents) returned %d\n", ptr->lasterror);
- RETURN_FALSE;
- }
-
- if (array_init(return_value) == FAILURE) {
- efree(childIDs);
- RETURN_FALSE;
- }
-
- for(i=0; i<count; i++) {
- add_index_long(return_value, i, childIDs[i]);
- }
- efree(childIDs);
- }
-
-}
-/* }}} */
-
-/* {{{ proto array hw_children(int link, int objid)
- Returns array of children object ids */
-PHP_FUNCTION(hw_children) {
- zval **arg1, **arg2;
- int link, id, type;
- int count;
- hw_connection *ptr;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(arg1);
- convert_to_long_ex(arg2);
- link=(*arg1)->value.lval;
- id=(*arg2)->value.lval;
- ptr = zend_list_find(link,&type);
- if(!ptr || (type!=le_socketp && type!=le_psocketp)) {
- php_error(E_WARNING,"Unable to find file identifier %d",id);
- RETURN_FALSE;
- }
-
- set_swap(ptr->swap_on);
- {
- int *childIDs = NULL;
- int i;
-
- if (0 != (ptr->lasterror = send_children(ptr->socket, id, &childIDs, &count))){
- php_error(E_WARNING, "send_command (getchildcoll) returned %d\n", ptr->lasterror);
- RETURN_FALSE;
- }
-
- if (array_init(return_value) == FAILURE) {
- efree(childIDs);
- RETURN_FALSE;
- }
-
- for(i=0; i<count; i++) {
- add_index_long(return_value, i, childIDs[i]);
- }
- efree(childIDs);
- }
-
-}
-/* }}} */
-
-/* {{{ proto array hw_childrenobj(int link, int objid)
- Returns array of children object records */
-PHP_FUNCTION(hw_childrenobj) {
- pval **arg1, **arg2;
- int link, id, type;
- int count;
- char **childObjRecs = NULL;
- hw_connection *ptr;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(arg1);
- convert_to_long_ex(arg2);
- link=(*arg1)->value.lval;
- id=(*arg2)->value.lval;
- ptr = zend_list_find(link,&type);
- if(!ptr || (type!=le_socketp && type!=le_psocketp)) {
- php_error(E_WARNING,"Unable to find file identifier %d",id);
- RETURN_FALSE;
- }
-
- set_swap(ptr->swap_on);
-
- if (0 != (ptr->lasterror = send_childrenobj(ptr->socket, id, &childObjRecs, &count))) {
- php_error(E_WARNING, "send_command (getchildcollobj) returned %d\n", ptr->lasterror);
- RETURN_FALSE;
- }
-
- /* create return value and free all memory */
- if( 0 > make_return_objrec(&return_value, childObjRecs, count))
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto array hw_getchildcoll(int link, int objid)
- Returns array of child collection object ids */
-PHP_FUNCTION(hw_getchildcoll) {
- pval **arg1, **arg2;
- int link, id, type;
- int count;
- hw_connection *ptr;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(arg1);
- convert_to_long_ex(arg2);
- link=(*arg1)->value.lval;
- id=(*arg2)->value.lval;
- ptr = zend_list_find(link,&type);
- if(!ptr || (type!=le_socketp && type!=le_psocketp)) {
- php_error(E_WARNING,"Unable to find file identifier %d",id);
- RETURN_FALSE;
- }
-
- set_swap(ptr->swap_on);
- {
- int *childIDs = NULL;
- int i;
-
- if (0 != (ptr->lasterror = send_getchildcoll(ptr->socket, id, &childIDs, &count))){
- php_error(E_WARNING, "send_command (getchildcoll) returned %d\n", ptr->lasterror);
- RETURN_FALSE;
- }
-
- if (array_init(return_value) == FAILURE) {
- efree(childIDs);
- RETURN_FALSE;
- }
-
- for(i=0; i<count; i++) {
- add_index_long(return_value, i, childIDs[i]);
- }
- efree(childIDs);
- }
-
-}
-/* }}} */
-
-/* {{{ proto array hw_getchildcollobj(int link, int objid)
- Returns array of child collection object records */
-PHP_FUNCTION(hw_getchildcollobj) {
- pval **arg1, **arg2;
- int link, id, type;
- int count;
- char **childObjRecs = NULL;
- hw_connection *ptr;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(arg1);
- convert_to_long_ex(arg2);
- link=(*arg1)->value.lval;
- id=(*arg2)->value.lval;
- ptr = zend_list_find(link,&type);
- if(!ptr || (type!=le_socketp && type!=le_psocketp)) {
- php_error(E_WARNING,"Unable to find file identifier %d",id);
- RETURN_FALSE;
- }
-
- set_swap(ptr->swap_on);
-
- if (0 != (ptr->lasterror = send_getchildcollobj(ptr->socket, id, &childObjRecs, &count))) {
- php_error(E_WARNING, "send_command (getchildcollobj) returned %d\n", ptr->lasterror);
- RETURN_FALSE;
- }
-
- /* create return value and free all memory */
- if( 0 > make_return_objrec(&return_value, childObjRecs, count))
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto int hw_docbyanchor(int link, int anchorid)
- Returns objid of document belonging to anchorid */
-PHP_FUNCTION(hw_docbyanchor) {
- pval **arg1, **arg2;
- int link, id, type;
- hw_connection *ptr;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(ht, 2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(arg1);
- convert_to_long_ex(arg2);
- link=(*arg1)->value.lval;
- id=(*arg2)->value.lval;
- ptr = zend_list_find(link,&type);
- if(!ptr || (type!=le_socketp && type!=le_psocketp)) {
- php_error(E_WARNING,"Unable to find file identifier %d",id);
- RETURN_FALSE;
- }
-
- set_swap(ptr->swap_on);
- {
- int objectID;
- if (0 != (ptr->lasterror = send_docbyanchor(ptr->socket, id, &objectID)))
- RETURN_FALSE;
-
- RETURN_LONG(objectID);
- }
-}
-/* }}} */
-
-/* {{{ proto array hw_docbyanchorobj(int link, int anchorid)
- Returns object record of document belonging to anchorid */
-PHP_FUNCTION(hw_docbyanchorobj) {
- pval **arg1, **arg2;
- int link, id, type;
- hw_connection *ptr;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(arg1);
- convert_to_long_ex(arg2);
- link=(*arg1)->value.lval;
- id=(*arg2)->value.lval;
- ptr = zend_list_find(link,&type);
- if(!ptr || (type!=le_socketp && type!=le_psocketp)) {
- php_error(E_WARNING,"Unable to find file identifier %d",id);
- RETURN_FALSE;
- }
-
- set_swap(ptr->swap_on);
- {
- char *object = NULL;
- if (0 != (ptr->lasterror = send_docbyanchorobj(ptr->socket, id, &object)))
- RETURN_FALSE;
-
- RETURN_STRING(object, 0);
- /*
- make_return_array_from_objrec(&return_value, object);
- efree(object);
- */
- }
-}
-/* }}} */
-
-/* {{{ proto array hw_getobjectbyquery(int link, string query, int maxhits)
- Search for query and return maxhits objids */
-PHP_FUNCTION(hw_getobjectbyquery) {
- pval **arg1, **arg2, **arg3;
- int link, type, maxhits;
- char *query;
- int count, i;
- int *childIDs = NULL;
- hw_connection *ptr;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &arg1, &arg2, &arg3) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(arg1);
- convert_to_string_ex(arg2);
- convert_to_long_ex(arg3);
- link=(*arg1)->value.lval;
- query=(*arg2)->value.str.val;
- maxhits=(*arg3)->value.lval;
- if (maxhits < 0) maxhits=0x7FFFFFFF;
- ptr = zend_list_find(link,&type);
- if(!ptr || (type!=le_socketp && type!=le_psocketp)) {
- php_error(E_WARNING,"Unable to find file identifier %d",link);
- RETURN_FALSE;
- }
-
- set_swap(ptr->swap_on);
- if (0 != (ptr->lasterror = send_getobjbyquery(ptr->socket, query, maxhits, &childIDs, &count))) {
- php_error(E_WARNING, "send_command (getobjectbyquery) returned %d\n", ptr->lasterror);
- RETURN_FALSE;
- }
-
- if (array_init(return_value) == FAILURE) {
- efree(childIDs);
- RETURN_FALSE;
- }
-
- for(i=0; i<count; i++)
- add_index_long(return_value, i, childIDs[i]);
- efree(childIDs);
-}
-/* }}} */
-
-/* {{{ proto array hw_getobjectbyqueryobj(int link, string query, int maxhits)
- Search for query and return maxhits object records */
-PHP_FUNCTION(hw_getobjectbyqueryobj) {
- pval **arg1, **arg2, **arg3;
- int link, type, maxhits;
- char *query;
- int count;
- char **childObjRecs = NULL;
- hw_connection *ptr;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &arg1, &arg2, &arg3) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(arg1);
- convert_to_string_ex(arg2);
- convert_to_long_ex(arg3);
- link=(*arg1)->value.lval;
- query=(*arg2)->value.str.val;
- maxhits=(*arg3)->value.lval;
- if (maxhits < 0) maxhits=0x7FFFFFFF;
- ptr = zend_list_find(link,&type);
- if(!ptr || (type!=le_socketp && type!=le_psocketp)) {
- php_error(E_WARNING,"Unable to find file identifier %d",link);
- RETURN_FALSE;
- }
-
- set_swap(ptr->swap_on);
- if (0 != (ptr->lasterror = send_getobjbyqueryobj(ptr->socket, query, maxhits, &childObjRecs, &count))) {
- php_error(E_WARNING, "send_command (getobjectbyqueryobj) returned %d\n", ptr->lasterror);
- RETURN_FALSE;
- }
-
- /* create return value and free all memory */
- if( 0 > make_return_objrec(&return_value, childObjRecs, count))
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto array hw_getobjectbyquerycoll(int link, int collid, string query, int maxhits)
- Search for query in collection and return maxhits objids */
-PHP_FUNCTION(hw_getobjectbyquerycoll) {
- pval **arg1, **arg2, **arg3, **arg4;
- int link, id, type, maxhits;
- char *query;
- int count, i;
- hw_connection *ptr;
- int *childIDs = NULL;
-
- if (ZEND_NUM_ARGS() != 4 || zend_get_parameters_ex(4, &arg1, &arg2, &arg3, &arg4) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(arg1);
- convert_to_long_ex(arg2);
- convert_to_string_ex(arg3);
- convert_to_long_ex(arg4);
- link=(*arg1)->value.lval;
- id=(*arg2)->value.lval;
- query=(*arg3)->value.str.val;
- maxhits=(*arg4)->value.lval;
- if (maxhits < 0) maxhits=0x7FFFFFFF;
- ptr = zend_list_find(link,&type);
- if(!ptr || (type!=le_socketp && type!=le_psocketp)) {
- php_error(E_WARNING,"Unable to find file identifier %d",id);
- RETURN_FALSE;
- }
-
- set_swap(ptr->swap_on);
- if (0 != (ptr->lasterror = send_getobjbyquerycoll(ptr->socket, id, query, maxhits, &childIDs, &count))) {
- php_error(E_WARNING, "send_command (getobjectbyquerycoll) returned %d\n", ptr->lasterror);
- RETURN_FALSE;
- }
-
- if (array_init(return_value) == FAILURE) {
- efree(childIDs);
- RETURN_FALSE;
- }
-
- for(i=0; i<count; i++)
- add_index_long(return_value, i, childIDs[i]);
- efree(childIDs);
-}
-/* }}} */
-
-/* {{{ proto array hw_getobjectbyquerycollobj(int link, int collid, string query, int maxhits)
- Search for query in collection and return maxhits object records */
-PHP_FUNCTION(hw_getobjectbyquerycollobj) {
- pval **arg1, **arg2, **arg3, **arg4;
- int link, id, type, maxhits;
- char *query;
- int count;
- hw_connection *ptr;
- char **childObjRecs = NULL;
-
- if (ZEND_NUM_ARGS() != 4 || zend_get_parameters_ex(4, &arg1, &arg2, &arg3, &arg4) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(arg1);
- convert_to_long_ex(arg2);
- convert_to_string_ex(arg3);
- convert_to_long_ex(arg4);
- link=(*arg1)->value.lval;
- id=(*arg2)->value.lval;
- query=(*arg3)->value.str.val;
- maxhits=(*arg4)->value.lval;
- if (maxhits < 0) maxhits=0x7FFFFFFF;
- ptr = zend_list_find(link,&type);
- if(!ptr || (type!=le_socketp && type!=le_psocketp)) {
- php_error(E_WARNING,"Unable to find file identifier %d",id);
- RETURN_FALSE;
- }
-
- set_swap(ptr->swap_on);
- if (0 != (ptr->lasterror = send_getobjbyquerycollobj(ptr->socket, id, query, maxhits, &childObjRecs, &count))) {
- php_error(E_WARNING, "send_command (getobjectbyquerycollobj) returned %d\n", ptr->lasterror);
- RETURN_FALSE;
- }
-
- /* create return value and free all memory */
- if( 0 > make_return_objrec(&return_value, childObjRecs, count))
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto array hw_getobjectbyftquery(int link, string query, int maxhits)
- Search for query as fulltext and return maxhits objids */
-PHP_FUNCTION(hw_getobjectbyftquery) {
- pval **arg1, **arg2, **arg3;
- int link, type, maxhits;
- char *query;
- int count, i;
- int *childIDs = NULL;
- float *weights;
- hw_connection *ptr;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &arg1, &arg2, &arg3) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(arg1);
- convert_to_string_ex(arg2);
- convert_to_long_ex(arg3);
- link=(*arg1)->value.lval;
- query=(*arg2)->value.str.val;
- maxhits=(*arg3)->value.lval;
- if (maxhits < 0) maxhits=0x7FFFFFFF;
- ptr = zend_list_find(link,&type);
- if(!ptr || (type!=le_socketp && type!=le_psocketp)) {
- php_error(E_WARNING,"Unable to find file identifier %d",link);
- RETURN_FALSE;
- }
-
- set_swap(ptr->swap_on);
- if (0 != (ptr->lasterror = send_getobjbyftquery(ptr->socket, query, maxhits, &childIDs, &weights, &count))) {
- php_error(E_WARNING, "send_command (getobjectbyftquery) returned %d\n", ptr->lasterror);
- RETURN_FALSE;
- }
-
- if (array_init(return_value) == FAILURE) {
- efree(childIDs);
- RETURN_FALSE;
- }
-
- for(i=0; i<count; i++)
- add_index_long(return_value, i, childIDs[i]);
- efree(childIDs);
-}
-/* }}} */
-
-/* {{{ proto array hw_getobjectbyftqueryobj(int link, string query, int maxhits)
- Search for query as fulltext and return maxhits object records */
-PHP_FUNCTION(hw_getobjectbyftqueryobj) {
- pval **arg1, **arg2, **arg3;
- int link, type, maxhits;
- char *query;
- int count;
- char **childObjRecs = NULL;
- float *weights;
- hw_connection *ptr;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &arg1, &arg2, &arg3) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(arg1);
- convert_to_string_ex(arg2);
- convert_to_long_ex(arg3);
- link=(*arg1)->value.lval;
- query=(*arg2)->value.str.val;
- maxhits=(*arg3)->value.lval;
- if (maxhits < 0) maxhits=0x7FFFFFFF;
- ptr = zend_list_find(link,&type);
- if(!ptr || (type!=le_socketp && type!=le_psocketp)) {
- php_error(E_WARNING,"Unable to find file identifier %d",link);
- RETURN_FALSE;
- }
-
- set_swap(ptr->swap_on);
- if (0 != (ptr->lasterror = send_getobjbyftqueryobj(ptr->socket, query, maxhits, &childObjRecs, &weights, &count))) {
- php_error(E_WARNING, "send_command (getobjectbyftqueryobj) returned %d\n", ptr->lasterror);
- RETURN_FALSE;
- }
-
- /* create return value and free all memory */
- if( 0 > make_return_objrec(&return_value, childObjRecs, count))
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto array hw_getobjectbyftquerycoll(int link, int collid, string query, int maxhits)
- Search for fulltext query in collection and return maxhits objids */
-PHP_FUNCTION(hw_getobjectbyftquerycoll) {
- pval **arg1, **arg2, **arg3, **arg4;
- int link, id, type, maxhits;
- char *query;
- int count, i;
- hw_connection *ptr;
- int *childIDs = NULL;
- float *weights;
-
- if (ZEND_NUM_ARGS() != 4 || zend_get_parameters_ex(4, &arg1, &arg2, &arg3, &arg4) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(arg1);
- convert_to_long_ex(arg2);
- convert_to_string_ex(arg3);
- convert_to_long_ex(arg4);
- link=(*arg1)->value.lval;
- id=(*arg2)->value.lval;
- query=(*arg3)->value.str.val;
- maxhits=(*arg4)->value.lval;
- if (maxhits < 0) maxhits=0x7FFFFFFF;
- ptr = zend_list_find(link,&type);
- if(!ptr || (type!=le_socketp && type!=le_psocketp)) {
- php_error(E_WARNING,"Unable to find file identifier %d",id);
- RETURN_FALSE;
- }
-
- set_swap(ptr->swap_on);
- if (0 != (ptr->lasterror = send_getobjbyftquerycoll(ptr->socket, id, query, maxhits, &childIDs, &weights, &count))) {
- php_error(E_WARNING, "send_command (getobjectbyquerycoll) returned %d\n", ptr->lasterror);
- RETURN_FALSE;
- }
-
- if (array_init(return_value) == FAILURE) {
- efree(childIDs);
- RETURN_FALSE;
- }
-
- for(i=0; i<count; i++)
- add_index_long(return_value, i, childIDs[i]);
- efree(childIDs);
-}
-/* }}} */
-
-/* {{{ proto array hw_getobjectbyftquerycollobj(int link, int collid, string query, int maxhits)
- Search for fulltext query in collection and return maxhits object records */
-PHP_FUNCTION(hw_getobjectbyftquerycollobj) {
- pval **arg1, **arg2, **arg3, **arg4;
- int link, id, type, maxhits;
- char *query;
- int count;
- hw_connection *ptr;
- char **childObjRecs = NULL;
- float *weights;
-
- if (ZEND_NUM_ARGS() != 4 || zend_get_parameters_ex(4, &arg1, &arg2, &arg3, &arg4) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(arg1);
- convert_to_long_ex(arg2);
- convert_to_string_ex(arg3);
- convert_to_long_ex(arg4);
- link=(*arg1)->value.lval;
- id=(*arg2)->value.lval;
- query=(*arg3)->value.str.val;
- maxhits=(*arg4)->value.lval;
- if (maxhits < 0) maxhits=0x7FFFFFFF;
- ptr = zend_list_find(link,&type);
- if(!ptr || (type!=le_socketp && type!=le_psocketp)) {
- php_error(E_WARNING,"Unable to find file identifier %d",id);
- RETURN_FALSE;
- }
-
- set_swap(ptr->swap_on);
- if (0 != (ptr->lasterror = send_getobjbyftquerycollobj(ptr->socket, id, query, maxhits, &childObjRecs, &weights, &count))) {
- php_error(E_WARNING, "send_command (getobjectbyquerycollobj) returned %d\n", ptr->lasterror);
- RETURN_FALSE;
- }
-
- /* create return value and free all memory */
- if( 0 > make_return_objrec(&return_value, childObjRecs, count))
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto array hw_getchilddoccoll(int link, int objid)
- Returns all children ids which are documents */
-PHP_FUNCTION(hw_getchilddoccoll) {
- pval **arg1, **arg2;
- int link, id, type;
- int count, i;
- int *childIDs = NULL;
- hw_connection *ptr;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(arg1);
- convert_to_long_ex(arg2);
- link=(*arg1)->value.lval;
- id=(*arg2)->value.lval;
- ptr = zend_list_find(link,&type);
- if(!ptr || (type!=le_socketp && type!=le_psocketp)) {
- php_error(E_WARNING,"Unable to find file identifier %d",id);
- RETURN_FALSE;
- }
-
- set_swap(ptr->swap_on);
- if (0 != (ptr->lasterror = send_getchilddoccoll(ptr->socket, id, &childIDs, &count))) {
- php_error(E_WARNING, "send_command (getchilddoccoll) returned %d\n", ptr->lasterror);
- RETURN_FALSE;
- }
-
- if (array_init(return_value) == FAILURE) {
- efree(childIDs);
- RETURN_FALSE;
- }
-
- for(i=0; i<count; i++)
- add_index_long(return_value, i, childIDs[i]);
- efree(childIDs);
-}
-/* }}} */
-
-/* {{{ proto array hw_getchilddoccollobj(int link, int objid)
- Returns all children object records which are documents */
-PHP_FUNCTION(hw_getchilddoccollobj) {
- pval **arg1, **arg2;
- int link, id, type;
- int count;
- char **childObjRecs = NULL;
- hw_connection *ptr;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(arg1);
- convert_to_long_ex(arg2);
- link=(*arg1)->value.lval;
- id=(*arg2)->value.lval;
- ptr = zend_list_find(link,&type);
- if(!ptr || (type!=le_socketp && type!=le_psocketp)) {
- php_error(E_WARNING,"Unable to find file identifier %d",id);
- RETURN_FALSE;
- }
-
- set_swap(ptr->swap_on);
- if (0 != (ptr->lasterror = send_getchilddoccollobj(ptr->socket, id, &childObjRecs, &count))) {
- php_error(E_WARNING, "send_command (getchilddoccollobj) returned %d\n", ptr->lasterror);
- RETURN_FALSE;
- }
-
- /* create return value and free all memory */
- if( 0 > make_return_objrec(&return_value, childObjRecs, count))
- RETURN_FALSE;
-
-}
-/* }}} */
-
-/* {{{ proto array hw_getanchors(int link, int objid)
- Return all anchors of object */
-PHP_FUNCTION(hw_getanchors) {
- pval **arg1, **arg2;
- int link, id, type;
- int count, i;
- int *anchorIDs = NULL;
- hw_connection *ptr;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(arg1);
- convert_to_long_ex(arg2);
- link=(*arg1)->value.lval;
- id=(*arg2)->value.lval;
- ptr = zend_list_find(link,&type);
- if(!ptr || (type!=le_socketp && type!=le_psocketp)) {
- php_error(E_WARNING,"Unable to find file identifier %d",id);
- RETURN_FALSE;
- }
-
- set_swap(ptr->swap_on);
- if (0 != (ptr->lasterror = send_getanchors(ptr->socket, id, &anchorIDs, &count))) {
- php_error(E_WARNING, "send_command (getanchors) returned %d\n", ptr->lasterror);
- RETURN_FALSE;
- }
-
- if (array_init(return_value) == FAILURE) {
- efree(anchorIDs);
- RETURN_FALSE;
- }
-
- for(i=0; i<count; i++)
- add_index_long(return_value, i, anchorIDs[i]);
- efree(anchorIDs);
-}
-/* }}} */
-
-/* {{{ proto array hw_getanchorsobj(int link, int objid)
- Return all object records of anchors of object */
-PHP_FUNCTION(hw_getanchorsobj) {
- pval **arg1, **arg2;
- int link, id, type;
- int count;
- char **anchorObjRecs = NULL;
- hw_connection *ptr;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(arg1);
- convert_to_long_ex(arg2);
- link=(*arg1)->value.lval;
- id=(*arg2)->value.lval;
- ptr = (hw_connection *) zend_list_find(link,&type);
- if(!ptr || (type!=le_socketp && type!=le_psocketp)) {
- php_error(E_WARNING,"Unable to find file identifier %d",id);
- RETURN_FALSE;
- }
-
- set_swap(ptr->swap_on);
- if (0 != (ptr->lasterror = send_getanchorsobj(ptr->socket, id, &anchorObjRecs, &count))) {
- php_error(E_WARNING, "send_command (getanchors) returned %d\n", ptr->lasterror);
- RETURN_FALSE;
- }
-
- /* create return value and free all memory */
- if( 0 > make_return_objrec(&return_value, anchorObjRecs, count))
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto string hw_getusername(int link)
- Returns the current user name */
-PHP_FUNCTION(hw_getusername) {
- pval **arg1;
- int link, type;
- hw_connection *ptr;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(arg1);
- link = (*arg1)->value.lval;
- ptr = zend_list_find(link,&type);
- if(!ptr || (type!=le_socketp && type!=le_psocketp)) {
- php_error(E_WARNING,"Unable to find file identifier %d",link);
- RETURN_FALSE;
- }
-
- return_value->value.str.val = estrdup(ptr->username);
- return_value->value.str.len = strlen(ptr->username);
- return_value->type = IS_STRING;
-}
-/* }}} */
-
-/* {{{ proto void hw_identify(int link, string username, string password)
- Identifies at Hyperwave server */
-PHP_FUNCTION(hw_identify) {
- pval **arg1, **arg2, **arg3;
- int link, type;
- char *name, *passwd, *userdata;
- hw_connection *ptr;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &arg1, &arg2, &arg3) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(arg1);
- convert_to_string_ex(arg2);
- convert_to_string_ex(arg3);
- link = (*arg1)->value.lval;
- name=(*arg2)->value.str.val;
- passwd=(*arg3)->value.str.val;
- ptr = zend_list_find(link,&type);
- if(!ptr || (type!=le_socketp && type!=le_psocketp)) {
- php_error(E_WARNING,"Unable to find file identifier %d",link);
- RETURN_FALSE;
- }
-
- set_swap(ptr->swap_on);
- {
- char *str;
-
- if (0 != (ptr->lasterror = send_identify(ptr->socket, name, passwd, &userdata))) {
- php_error(E_WARNING, "send_identify returned %d\n", ptr->lasterror);
- if(ptr->username) free(ptr->username);
- ptr->username = NULL;
- RETURN_FALSE;
- }
-
- return_value->value.str.val = userdata;
- return_value->value.str.len = strlen(userdata);
- return_value->type = IS_STRING;
- if(ptr->username) free(ptr->username);
- str = userdata;
- while((*str != 0) && (*str != ' '))
- str++;
- if(*str != '\0')
- ptr->username = strdup(++str);
- else
- ptr->username = NULL;
- }
-}
-/* }}} */
-
-/* {{{ proto array hw_objrec2array(string objrec, [array format])
- Returns object array of object record */
-PHP_FUNCTION(hw_objrec2array) {
- zval **arg1, **arg2;
-
- switch(ZEND_NUM_ARGS()) {
- case 1:
- if(zend_get_parameters_ex(1, &arg1) == FAILURE)
- WRONG_PARAM_COUNT;
- convert_to_string_ex(arg1);
- make2_return_array_from_objrec(&return_value, (*arg1)->value.str.val, NULL);
- break;
- case 2:
- if(zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE)
- WRONG_PARAM_COUNT;
- convert_to_array_ex(arg2);
- convert_to_string_ex(arg1);
- make2_return_array_from_objrec(&return_value, (*arg1)->value.str.val, *arg2);
- break;
- default:
- WRONG_PARAM_COUNT;
- }
-}
-/* }}} */
-
-/* {{{ proto string hw_array2objrec(array objarr)
- Returns object record of object array */
-PHP_FUNCTION(hw_array2objrec) {
- pval **arg1;
- char *objrec, *retobj;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_array_ex(arg1);
- objrec = make_objrec_from_array((*arg1)->value.ht);
- if(objrec) {
- retobj = estrdup(objrec);
- free(objrec);
- RETURN_STRING(retobj, 0);
- } else
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto array hw_incollections(int link, array objids, array collids, int para)
- Returns object ids which are in collections */
-PHP_FUNCTION(hw_incollections) {
- pval **arg1, **arg2, **arg3, **arg4;
- int type, link, i;
- hw_connection *ptr;
- int cobjids, ccollids, *objectIDs, *collIDs, cretids, *retIDs, retcoll;
-
- if (ZEND_NUM_ARGS() != 4 || zend_get_parameters_ex(4, &arg1, &arg2, &arg3, &arg4) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(arg1);
- convert_to_array_ex(arg2);
- convert_to_array_ex(arg3);
- convert_to_long_ex(arg4);
- link = (*arg1)->value.lval;
- retcoll=(*arg4)->value.lval;
- ptr = zend_list_find(link,&type);
- if(!ptr || (type!=le_socketp && type!=le_psocketp)) {
- php_error(E_WARNING,"Unable to find file identifier %d",link);
- RETURN_FALSE;
- }
-
- cobjids = zend_hash_num_elements((*arg2)->value.ht);
- if(NULL == (objectIDs = make_ints_from_array((*arg2)->value.ht))) {
- php_error(E_WARNING, "Could not create Int Array from Array\n");
- RETURN_FALSE;
- }
-
- ccollids = zend_hash_num_elements((*arg3)->value.ht);
- if(NULL == (collIDs = make_ints_from_array((*arg3)->value.ht))) {
- php_error(E_WARNING, "Could not create Int Array from Array\n");
- efree(objectIDs);
- RETURN_FALSE;
- }
-
- set_swap(ptr->swap_on);
- if (0 != (ptr->lasterror = send_incollections(ptr->socket, retcoll,
- cobjids, objectIDs,
- ccollids, collIDs,
- &cretids, &retIDs))) {
- if(objectIDs) efree(objectIDs);
- if(collIDs) efree(collIDs);
- RETURN_FALSE;
- }
-
- if(objectIDs) efree(objectIDs);
- if(collIDs) efree(collIDs);
-
- if (array_init(return_value) == FAILURE) {
- efree(retIDs);
- RETURN_FALSE;
- }
-
- for(i=0; i<cretids; i++)
- add_index_long(return_value, i, retIDs[i]);
- efree(retIDs);
-
-}
-/* }}} */
-
-/* {{{ proto void hw_inscoll(int link, int parentid, array objarr)
- Inserts collection */
-PHP_FUNCTION(hw_inscoll) {
- pval **arg1, **arg2, **arg3;
- char *objrec;
- int id, newid, type, link;
- hw_connection *ptr;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &arg1, &arg2, &arg3) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(arg1);
- convert_to_long_ex(arg2);
- convert_to_array_ex(arg3);
- link = (*arg1)->value.lval;
- id=(*arg2)->value.lval;
- ptr = zend_list_find(link,&type);
- if(!ptr || (type!=le_socketp && type!=le_psocketp)) {
- php_error(E_WARNING,"Unable to find file identifier %d",link);
- RETURN_FALSE;
- }
-
- if(NULL == (objrec = make_objrec_from_array((*arg3)->value.ht))) {
- php_error(E_WARNING, "Could not create Object Record from Array\n");
- RETURN_FALSE;
- }
-
- set_swap(ptr->swap_on);
- if (0 != (ptr->lasterror = send_inscoll(ptr->socket, id, objrec, &newid))) {
- if(objrec) free(objrec);
- RETURN_FALSE;
- }
-
- if(objrec) free(objrec);
- RETURN_LONG(newid);
-}
-/* }}} */
-
-/* {{{ proto void hw_insdoc(int link, int parentid, string objrec [, string text])
- Inserts document */
-PHP_FUNCTION(hw_insdoc) {
- zval **argv[4];
- char *objrec, *text;
- int id, newid, type, link, argc;
- hw_connection *ptr;
-
- argc = ZEND_NUM_ARGS();
- if((argc < 3) || (argc > 4))
- WRONG_PARAM_COUNT;
-
- if (zend_get_parameters_array_ex(argc, argv) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_long_ex(argv[0]);
- convert_to_long_ex(argv[1]);
- convert_to_string_ex(argv[2]);
- if(argc == 4) {
- convert_to_string_ex(argv[3]);
- text = (*argv[3])->value.str.val;
- } else {
- text = NULL;
- }
- link = (*argv[0])->value.lval;
- id = (*argv[1])->value.lval;
- ptr = zend_list_find(link,&type);
- if(!ptr || (type!=le_socketp && type!=le_psocketp)) {
- php_error(E_WARNING,"Unable to find file identifier %d",link);
- RETURN_FALSE;
- }
-
- set_swap(ptr->swap_on);
- objrec = (*argv[2])->value.str.val;
- if (0 != (ptr->lasterror = send_insdoc(ptr->socket, id, objrec, text, &newid))) {
- RETURN_FALSE;
- }
-
- RETURN_LONG(newid);
-}
-/* }}} */
-
-/* {{{ proto int hw_getsrcbydestobj(int link, int destid)
- Returns object id of source docuent by destination anchor */
-PHP_FUNCTION(hw_getsrcbydestobj) {
- pval **arg1, **arg2;
- int link, type, id;
- int count;
- char **childObjRecs = NULL;
- hw_connection *ptr;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(arg1);
- convert_to_long_ex(arg2);
- link=(*arg1)->value.lval;
- id=(*arg2)->value.lval;
- ptr = zend_list_find(link,&type);
- if(!ptr || (type!=le_socketp && type!=le_psocketp)) {
- php_error(E_WARNING,"Unable to find file identifier %d",link);
- RETURN_FALSE;
- }
-
- set_swap(ptr->swap_on);
- if (0 != (ptr->lasterror = send_getsrcbydest(ptr->socket, id, &childObjRecs, &count))) {
- php_error(E_WARNING, "send_command (getsrcbydest) returned %d\n", ptr->lasterror);
- RETURN_FALSE;
- }
-
- /* create return value and free all memory */
- if( 0 > make_return_objrec(&return_value, childObjRecs, count))
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto int hw_mapid(int link, int serverid, int destid)
- Returns virtual object id of document on remote Hyperwave server */
-PHP_FUNCTION(hw_mapid) {
- pval **arg1, **arg2, **arg3;
- int link, type, servid, id, virtid;
- hw_connection *ptr;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &arg1, &arg2, &arg3) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(arg1);
- convert_to_long_ex(arg2);
- convert_to_long_ex(arg3);
- link=(*arg1)->value.lval;
- servid=(*arg2)->value.lval;
- id=(*arg3)->value.lval;
- ptr = zend_list_find(link,&type);
- if(!ptr || (type!=le_socketp && type!=le_psocketp)) {
- php_error(E_WARNING,"Unable to find file identifier %d",link);
- RETURN_FALSE;
- }
-
- set_swap(ptr->swap_on);
- if (0 != (ptr->lasterror = send_mapid(ptr->socket, servid, id, &virtid))) {
- php_error(E_WARNING, "send_command (mapid) returned %d\n", ptr->lasterror);
- RETURN_FALSE;
- }
- RETURN_LONG(virtid);
-}
-/* }}} */
-
-/* {{{ proto string hw_getrellink(int link, int rootid, int sourceid, int destid)
- Get link from source to dest relative to rootid */
-PHP_FUNCTION(hw_getrellink) {
- pval **arg1, **arg2, **arg3, **arg4;
- int link, type;
- int rootid, destid, sourceid;
- char *anchorstr;
- hw_connection *ptr;
-
- if (ZEND_NUM_ARGS() != 4 || zend_get_parameters_ex(4, &arg1, &arg2, &arg3, &arg4) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(arg1);
- convert_to_long_ex(arg2);
- convert_to_long_ex(arg3);
- convert_to_long_ex(arg4);
- link=(*arg1)->value.lval;
- rootid=(*arg2)->value.lval;
- sourceid=(*arg3)->value.lval;
- destid=(*arg4)->value.lval;
- ptr = zend_list_find(link,&type);
- if(!ptr || (type!=le_socketp && type!=le_psocketp)) {
- php_error(E_WARNING,"Unable to find file identifier %d",link);
- RETURN_FALSE;
- }
-
- set_swap(ptr->swap_on);
- if (0 != (ptr->lasterror = getrellink(ptr->socket, rootid, sourceid, destid, &anchorstr))) {
- php_error(E_WARNING, "command (getrellink) returned %d\n", ptr->lasterror);
- RETURN_FALSE;
- }
-
- RETURN_STRING(anchorstr, 0);
-}
-/* }}} */
-
-/* {{{ proto string hw_insertanchors(int hwdoc, array anchorecs, array dest [, array urlprefixes])
- Inserts only anchors into text */
-PHP_FUNCTION(hw_insertanchors) {
- pval **arg1, **arg2, **arg3, **arg4;
- hw_document *hwdoc;
- int type, docid, error, argc, count;
- char *anchorstr;
- char **anchorrecs;
- char **dest;
- char **urlprefix;
- char *bodytag = NULL;
- HashTable *arrht;
- HashTable *prefixarray;
-
- argc = ZEND_NUM_ARGS();
- switch(argc)
- {
- case 3:
- if (zend_get_parameters_ex(3, &arg1, &arg2, &arg3) == FAILURE)
- WRONG_PARAM_COUNT;
- break;
- case 4:
- if (zend_get_parameters_ex(4, &arg1, &arg2, &arg3, &arg4) == FAILURE)
- WRONG_PARAM_COUNT;
- break;
- default:
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(arg1);
- convert_to_array_ex(arg2);
- convert_to_array_ex(arg3);
- docid=(*arg1)->value.lval;
- hwdoc = zend_list_find(docid, &type);
- if(!hwdoc || (type!=le_document)) {
- php_error(E_WARNING,"Unable to find file identifier %d",docid);
- RETURN_FALSE;
- }
-
- /* check for the array with urlprefixes */
- if(argc == 4) {
- int i;
- convert_to_array_ex(arg4);
- prefixarray =(*arg4)->value.ht;
- if((prefixarray == NULL) || (zend_hash_num_elements(prefixarray) != 5)) {
- php_error(E_WARNING,"You must provide 5 urlprefixes (you have provided %d)", zend_hash_num_elements(prefixarray));
- RETURN_FALSE;
- }
-
- urlprefix = emalloc(5*sizeof(char *));
- zend_hash_internal_pointer_reset(prefixarray);
- for(i=0; i<5; i++) {
- char *key;
- zval *data, **dataptr;
- ulong ind;
-
- zend_hash_get_current_key(prefixarray, &key, &ind, 0);
- zend_hash_get_current_data(prefixarray, (void *) &dataptr);
- data = *dataptr;
- if (data->type != IS_STRING) {
- php_error(E_WARNING,"%s must be a String", key);
- RETURN_FALSE;
- } else if ( strcmp(key, "HW_DEFAULT_LINK") == 0 ) {
- urlprefix[HW_DEFAULT_LINK] = data->value.str.val;
- } else if ( strcmp(key, "HW_IMAGE_LINK") == 0 ) {
- urlprefix[HW_IMAGE_LINK] = data->value.str.val;
- } else if ( strcmp(key, "HW_BACKGROUND_LINK") == 0 ) {
- urlprefix[HW_BACKGROUND_LINK] = data->value.str.val;
- } else if ( strcmp(key, "HW_INTAG_LINK") == 0 ) {
- urlprefix[HW_INTAG_LINK] = data->value.str.val;
- } else if ( strcmp(key, "HW_APPLET_LINK") == 0 ) {
- urlprefix[HW_APPLET_LINK] = data->value.str.val;
- } else {
- php_error(E_WARNING,"%s is not a valid urlprefix", key);
- RETURN_FALSE;
- }
- zend_hash_move_forward(prefixarray);
- }
- } else {
- urlprefix = NULL;
- }
-
- if(zend_hash_num_elements((*arg2)->value.ht) != zend_hash_num_elements((*arg3)->value.ht)) {
- php_error(E_WARNING,"Unequal number of elments in arrays");
- RETURN_FALSE;
- }
-
- /* Turn PHP-Array of strings into C-Array of strings */
- arrht = (*arg2)->value.ht;
- anchorrecs = make_strs_from_array(arrht);
- arrht = (*arg3)->value.ht;
- dest = make_strs_from_array(arrht);
-
- if (0 != (error = send_insertanchors(&(hwdoc->data), &count, anchorrecs, dest, zend_hash_num_elements(arrht), urlprefix, &bodytag))) {
- php_error(E_WARNING, "command (insertanchors) returned %d\n", error);
- RETURN_FALSE;
- }
-/*fprintf(stderr, "in hw_insertanchors: %s\n", hwdoc->attributes); */
- hwdoc->size = count;
- if(hwdoc->bodytag) free (hwdoc->bodytag);
- hwdoc->bodytag = bodytag;
-
- RETURN_TRUE;
-}
-/* }}} */
-
-
-PHP_MINFO_FUNCTION(hw)
-{
- php_info_print_table_start();
- php_info_print_table_row(2, "Hyperwave Support", "enabled");
- php_info_print_table_row(2, "HG-CSP Version", "7.17");
- php_info_print_table_end();
- DISPLAY_INI_ENTRIES();
-}
-
-/* {{{ proto void hw_connection_info(int link)
- Prints information about the connection to Hyperwave server */
-PHP_FUNCTION(hw_connection_info)
-{
- pval **arg1;
- hw_connection *ptr;
- int link, type;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(arg1);
- link=(*arg1)->value.lval;
- ptr = zend_list_find(link,&type);
- if(!ptr || (type!=le_socketp && type!=le_psocketp)) {
- php_error(E_WARNING,"Unable to find file identifier %d",link);
- RETURN_FALSE;
- }
-
- php_printf("Hyperwave Info:\nhost=%s,\nserver string=%s\nversion=%d\nswap=%d\n", ptr->hostname, ptr->server_string, ptr->version, ptr->swap_on);
-}
-/* }}} */
-
-void print_msg(hg_msg *msg, char *str, int txt)
-{
- char *ptr;
- int i;
-
- fprintf(stdout, "\nprint_msg: >>%s<<\n", str);
- fprintf(stdout, "print_msg: length = %d\n", msg->length);
- fprintf(stdout, "print_msg: msgid = %d\n", msg->version_msgid);
- fprintf(stdout, "print_msg: msg_type = %d\n", msg->msg_type);
- if ( msg->length > HEADER_LENGTH ) {
- ptr = msg->buf;
- for ( i = 0; i < msg->length-HEADER_LENGTH; i++ ) {
- if ( *ptr == '\n' )
- fprintf(stdout, "%c", *ptr++);
- else if ( iscntrl(*ptr) )
- {fprintf(stdout, "."); ptr++;}
- else
- fprintf(stdout, "%c", *ptr++);
- }
- }
- fprintf(stdout, "\n\n");
-}
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/hyperwave/hw_error.h b/ext/hyperwave/hw_error.h
deleted file mode 100644
index c9d453b7f9..0000000000
--- a/ext/hyperwave/hw_error.h
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef HW_ERROR_H
-#define HW_ERROR_H
-
-#if HYPERWAVE
-
-#define NOACCESS 1 /* Access denied */
-#define NODOCS 2 /* No documents */
-#define NONAME 3 /* No collection name */
-#define NODOC 4 /* Object is not a document */
-#define NOOBJ 5 /* No object received */
-#define NOCOLLS 6 /* No collections received */
-#define DBSTUBNG 7 /* Connection to low-level database failed */
-#define NOTFOUND 8 /* Object not found */
-#define EXIST 9 /* Collection already exists */
-#define FATHERDEL 10 /* parent collection disappeared */
-#define FATHNOCOLL 11 /* parent collection not a collection */
-#define NOTEMPTY 12 /* Collection not empty */
-#define DESTNOCOLL 13 /* Destination not a collection */
-#define SRCEQDEST 14 /* Source equals destination */
-#define REQPEND 15 /* Request pending */
-#define TIMEOUT 16 /* Timeout */
-#define NAMENOTUNIQUE 17 /* Name not unique */
-#define WRITESTOPPED 18 /* Database now read-only; try again later */
-#define LOCKED 19 /* Object locked; try again later */
-#define CHANGEBASEFLD 20 /* Change of base-attribute */
-#define NOTREMOVED 21 /* Attribute not removed */
-#define FLDEXISTS 22 /* Attribute exists */
-#define CMDSYNTAX 23 /* Syntax error in command */
-#define NOLANGUAGE 24 /* No or unknown language specified */
-#define WRGTYPE 25 /* Wrong type in object */
-#define WRGVERSION 26 /* Client version too old */
-#define CONNECTION 27 /* No connection to other server */
-#define SYNC 28 /* Synchronization error */
-#define NOPATH 29 /* No path entry */
-#define WRGPATH 30 /* Wrong path entry */
-#define PASSWD 31 /* Wrong password (server-to-server server authentication) */
-#define LC_NO_MORE_USERS 32 /* No more users for license */
-#define LC_NO_MORE_DOCS 33 /* No more documents for this session and license */
-#define RSERV_NRESP 34 /* Remote server not responding */
-#define Q_OVERFLOW 35 /* Query overflow */
-#define USR_BREAK 36 /* Break by user */
-#define N_IMPL 37 /* Not implemented */
-#define WRG_VALUE 38 /* Wrong value */
-#define INSUFF_FUNDS 39 /* Insufficient funds */
-#define REORG 40 /* Reorganization in progress */
-#define USER_LIMIT 41 /* Limit of simultaneous users reached */
-#define FTCONNECT 513 /* No connection to fulltext server */
-#define FTTIMEOUT 514 /* Connection timed out */
-#define FTINDEX 515 /* Something wrong with fulltext index */
-#define FTSYNTAX 516 /* Query syntax error */
-#define REQUESTPENDING 1025 /* Request pending */
-#define NOCONNECTION 1026 /* No connection to document server */
-#define WRONGVERSION 1027 /* Wrong protocol version */
-#define NOTINITIALIZED 1028 /* Not initialized */
-#define BADREQUEST 1029 /* Bad request */
-#define BADLRN 1030 /* Bad document number */
-#define OPENSTORE_WRITE 1031 /* Cannot write to local store */
-#define OPENSTORE_READ 1032 /* Cannot read from local store */
-#define READSTORE 1033 /* Store read error */
-#define WRITESTORE 1034 /* Write error */
-#define CLOSESTORE 1035 /* Close error */
-#define BADPATH 1036 /* Bad path */
-#define NOPATHDC 1037 /* No path */
-#define OPENFILE 1038 /* Cannot open file */
-#define READFILE 1039 /* Cannot read from file // same */
-#define WRITEFILE 1040 /* Cannot write to file */
-#define CONNECTCLIENT 1041 /* Could not connect to client */
-#define ACCEPT 1042 /* Could not accept connection */
-#define READSOCKET 1043 /* Could not read from socket */
-#define WRITESOCKET 1044 /* Could not write to socket */
-#define TOOMUCHDATA 1046 /* Received too much data */
-#define TOOFEWDATA 1047 /* Received too few data // ... */
-#define NOTIMPLEMENTED 1049 /* Not implemented */
-#define USERBREAK 1050 /* User break */
-#define INTERNAL 1051 /* Internal error */
-#define INVALIDOBJECT 1052 /* Invalid object */
-#define JOBTIMEOUT 1053 /* Job timed out */
-#define OPENPORT 1054 /* Cannot open port // ... for several resons */
-#define NODATA 1055 /* Received no data */
-#define NOPORT 1056 /* No port to handle this request */
-#define NOTCACHED 1057 /* Document not cached */
-#define BADCACHETYPE 1058 /* Bad cache type */
-#define OPENCACHE_WRITE 1059 /* Cannot write to cache */
-#define OPENCACHE_READ 1060 /* Cannot read from cache // same */
-#define NOSOURCE 1061 /* Do not know what to read */
-#define CLOSECACHE 1062 /* Could not insert into cache */
-#define CONNECTREMOTE 1063 /* Could not connect to remote server */
-#define LOCKREFUSED 1064 /* Lock refused // could not lock the stores */
-
-#endif
-#endif
diff --git a/ext/hyperwave/hyperwave.dsp b/ext/hyperwave/hyperwave.dsp
deleted file mode 100644
index 31c688064e..0000000000
--- a/ext/hyperwave/hyperwave.dsp
+++ /dev/null
@@ -1,120 +0,0 @@
-# Microsoft Developer Studio Project File - Name="hyperwave" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=hyperwave - Win32 Debug_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "hyperwave.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "hyperwave.mak" CFG="hyperwave - Win32 Debug_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "hyperwave - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "hyperwave - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "hyperwave - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "HYPERWAVE_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\TSRM" /D "WIN32" /D "PHP_EXPORTS" /D "COMPILE_DL_HYPERWAVE" /D ZTS=1 /D HYPERWAVE=1 /D ZEND_DEBUG=0 /D "NDEBUG" /D "_WINDOWS" /D "ZEND_WIN32" /D "PHP_WIN32" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x407 /d "NDEBUG"
-# ADD RSC /l 0x407 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 php4ts.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_hyperwave.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
-
-!ELSEIF "$(CFG)" == "hyperwave - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "HYPERWAVE_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\TSRM" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "PHP_EXPORTS" /D "COMPILE_DL_HYPERWAVE" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HYPERWAVE=1 /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x407 /d "_DEBUG"
-# ADD RSC /l 0x407 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 php4ts_debug.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib /nologo /dll /debug /machine:I386 /out:"..\..\Debug_TS/php_hyperwave.dll" /pdbtype:sept /libpath:"..\..\Debug_TS"
-
-!ENDIF
-
-# Begin Target
-
-# Name "hyperwave - Win32 Release_TS"
-# Name "hyperwave - Win32 Debug_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\hg_comm.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\hw.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\hg_comm.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\hw_error.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\php_hyperwave.h
-# End Source File
-# End Group
-# End Target
-# End Project
diff --git a/ext/hyperwave/php_hyperwave.h b/ext/hyperwave/php_hyperwave.h
deleted file mode 100644
index 7fe434df81..0000000000
--- a/ext/hyperwave/php_hyperwave.h
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef PHP_HYPERWAVE_H
-#define PHP_HYPERWAVE_H
-
-#ifdef PHP_WIN32
-#define PHP_HW_API __declspec(dllexport)
-#else
-#define PHP_HW_API
-#endif
-
-#if HYPERWAVE
-#ifndef DLEXPORT
-#define DLEXPORT
-#endif
-
-#ifdef ZTS
-#include "TSRM.h"
-#endif
-
-#include "hg_comm.h"
-
-extern zend_module_entry hw_module_entry;
-#define hw_module_ptr &hw_module_entry
-
-typedef struct {
- long default_link;
- long default_port;
- long num_links,num_persistent;
- long max_links,max_persistent;
- long allow_persistent;
-} zend_hw_globals;
-
-#ifdef ZTS
-# define HwSLS_D zend_hw_globals *hw_globals
-# define HwSLS_DC , HwSLS_D
-# define HwSLS_C hw_globals
-# define HwSLS_CC , HwSLS_C
-# define HwSG(v) (hw_globals->v)
-# define HwSLS_FETCH() zend_hw_globals *hw_globals = ts_resource(hw_globals_id)
-#else
-# define HwSLS_D
-# define HwSLS_DC
-# define HwSLS_C
-# define HwSLS_CC
-# define HwSG(v) (hw_globals.v)
-# define HwSLS_FETCH()
-extern PHP_HW_API zend_hw_globals hw_globals;
-#endif
-
-/*extern hw_module php_hw_module;*/
-
-typedef struct {
- int size;
- char *data;
- char *attributes;
- char *bodytag;
-} hw_document;
-
-extern PHP_MINIT_FUNCTION(hw);
-extern PHP_MSHUTDOWN_FUNCTION(hw);
-PHP_MINFO_FUNCTION(hw);
-
-PHP_FUNCTION(hw_connect);
-PHP_FUNCTION(hw_pconnect);
-PHP_FUNCTION(hw_close);
-PHP_FUNCTION(hw_root);
-PHP_FUNCTION(hw_info);
-PHP_FUNCTION(hw_error);
-PHP_FUNCTION(hw_errormsg);
-PHP_FUNCTION(hw_mv);
-PHP_FUNCTION(hw_cp);
-PHP_FUNCTION(hw_deleteobject);
-PHP_FUNCTION(hw_changeobject);
-PHP_FUNCTION(hw_modifyobject);
-PHP_FUNCTION(hw_getparents);
-PHP_FUNCTION(hw_getparentsobj);
-PHP_FUNCTION(hw_children);
-PHP_FUNCTION(hw_childrenobj);
-PHP_FUNCTION(hw_getchildcoll);
-PHP_FUNCTION(hw_getchildcollobj);
-PHP_FUNCTION(hw_getobject);
-PHP_FUNCTION(hw_getandlock);
-PHP_FUNCTION(hw_unlock);
-PHP_FUNCTION(hw_gettext);
-PHP_FUNCTION(hw_edittext);
-PHP_FUNCTION(hw_getcgi);
-PHP_FUNCTION(hw_getremote);
-PHP_FUNCTION(hw_getremotechildren);
-PHP_FUNCTION(hw_pipedocument);
-PHP_FUNCTION(hw_pipecgi);
-PHP_FUNCTION(hw_insertdocument);
-PHP_FUNCTION(hw_docbyanchorobj);
-PHP_FUNCTION(hw_docbyanchor);
-PHP_FUNCTION(hw_getobjectbyquery);
-PHP_FUNCTION(hw_getobjectbyqueryobj);
-PHP_FUNCTION(hw_getobjectbyquerycoll);
-PHP_FUNCTION(hw_getobjectbyquerycollobj);
-PHP_FUNCTION(hw_getobjectbyftquery);
-PHP_FUNCTION(hw_getobjectbyftqueryobj);
-PHP_FUNCTION(hw_getobjectbyftquerycoll);
-PHP_FUNCTION(hw_getobjectbyftquerycollobj);
-PHP_FUNCTION(hw_getchilddoccoll);
-PHP_FUNCTION(hw_getchilddoccollobj);
-PHP_FUNCTION(hw_getanchors);
-PHP_FUNCTION(hw_getanchorsobj);
-PHP_FUNCTION(hw_getusername);
-PHP_FUNCTION(hw_setlinkroot);
-PHP_FUNCTION(hw_inscoll);
-PHP_FUNCTION(hw_incollections);
-PHP_FUNCTION(hw_insertobject);
-PHP_FUNCTION(hw_insdoc);
-PHP_FUNCTION(hw_identify);
-PHP_FUNCTION(hw_free_document);
-PHP_FUNCTION(hw_new_document);
-PHP_FUNCTION(hw_new_document_from_file);
-PHP_FUNCTION(hw_output_document);
-PHP_FUNCTION(hw_document_size);
-PHP_FUNCTION(hw_document_attributes);
-PHP_FUNCTION(hw_document_bodytag);
-PHP_FUNCTION(hw_document_content);
-PHP_FUNCTION(hw_document_setcontent);
-PHP_FUNCTION(hw_objrec2array);
-PHP_FUNCTION(hw_array2objrec);
-PHP_FUNCTION(hw_connection_info);
-PHP_FUNCTION(hw_getsrcbydestobj);
-PHP_FUNCTION(hw_insertanchors);
-PHP_FUNCTION(hw_getrellink);
-PHP_FUNCTION(hw_dummy);
-PHP_FUNCTION(hw_who);
-PHP_FUNCTION(hw_stat);
-PHP_FUNCTION(hw_mapid);
-
-#else
-#define hw_module_ptr NULL
-#endif /* HYPERWAVE */
-#define phpext_hyperwave_ptr hw_module_ptr
-#endif /* PHP_HYPERWAVE_H */
-
diff --git a/ext/hyperwave/setup.stub b/ext/hyperwave/setup.stub
deleted file mode 100644
index 51099054d1..0000000000
--- a/ext/hyperwave/setup.stub
+++ /dev/null
@@ -1,6 +0,0 @@
-# $Source$
-# $Id$
-
-define_option with-hyperwave 'Hyperwave support?' yesno no \
-' Whether to build with Hyperwave support. More\n
- information about Hyperwave can be found at http://www.hyperwave.com.'
diff --git a/ext/icap/CREDITS b/ext/icap/CREDITS
deleted file mode 100644
index 9ea19c3f9d..0000000000
--- a/ext/icap/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-icap
-Mark Musone
diff --git a/ext/icap/Makefile.in b/ext/icap/Makefile.in
deleted file mode 100644
index 9e43d29867..0000000000
--- a/ext/icap/Makefile.in
+++ /dev/null
@@ -1,7 +0,0 @@
-
-LTLIBRARY_NAME = libicap.la
-LTLIBRARY_SOURCES = php_icap.c
-LTLIBRARY_SHARED_NAME = icap.la
-LTLIBRARY_SHARED_LIBADD = $(ICAP_SHARED_LIBADD)
-
-include $(top_srcdir)/build/dynlib.mk
diff --git a/ext/icap/config.m4 b/ext/icap/config.m4
deleted file mode 100644
index 829677a3de..0000000000
--- a/ext/icap/config.m4
+++ /dev/null
@@ -1,15 +0,0 @@
-dnl $Id$
-
-PHP_ARG_WITH(icap,for ICAP support,
-[ --with-icap[=DIR] Include ICAP support.])
-
-if test "$PHP_ICAP" != "no"; then
- ICAP_DIR=$PHP_ICAP
- test "$ICAP_DIR" = "yes" && ICAP_DIR=/usr/local
-
- PHP_ADD_INCLUDE($ICAP_DIR)
- PHP_SUBST(ICAP_SHARED_LIBADD)
- PHP_ADD_LIBRARY_WITH_PATH(icap, $ICAP_DIR, ICAP_SHARED_LIBADD)
- AC_DEFINE(HAVE_ICAP,1,[ ])
- PHP_EXTENSION(icap, $ext_shared)
-fi
diff --git a/ext/icap/php_icap.c b/ext/icap/php_icap.c
deleted file mode 100644
index d0fa13cf16..0000000000
--- a/ext/icap/php_icap.c
+++ /dev/null
@@ -1,938 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Mark Musone <musone@chek.com> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#define ICAP1
-
-#ifdef ERROR
-#undef ERROR
-#endif
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-
-#if HAVE_ICAP
-
-#include <time.h>
-#include <stdio.h>
-#include <ctype.h>
-#include <signal.h>
-#include <stdarg.h>
-#include "cal.h"
-#include "php_icap.h"
-#include "zend_modules.h"
-#include "ext/standard/info.h"
-#include "ext/standard/basic_functions.h"
-#ifdef PHP_WIN32
-#include "winsock.h"
-#endif
-CALSTREAM *cal_open();
-CALSTREAM *cal_close_it ();
-CALSTREAM *cal_close_full ();
-
-
-typedef struct php_icap_le_struct {
- CALSTREAM *icap_stream;
- long flags;
-} pils;
-
-
-typedef struct cal_list
-{
-php_uint32 uid;
-struct cal_list *next;
-} cal_list_t;
-
-static cal_list_t *g_cal_list=NULL;
-static cal_list_t *g_cal_list_end=NULL;
-/*
- * this array should be set up as:
- * {"PHPScriptFunctionName",dllFunctionName,1}
- */
-
-function_entry icap_functions[] = {
- PHP_FE(icap_open, NULL)
-/* for now it's obviously a dummy
- PHP_FE(icap_popen, NULL)
-*/
- PHP_FE(icap_reopen, NULL)
- PHP_FE(icap_fetch_event, NULL)
- PHP_FE(icap_list_events, NULL)
- PHP_FE(icap_list_alarms, NULL)
- PHP_FE(icap_create_calendar, NULL)
- PHP_FE(icap_rename_calendar, NULL)
- PHP_FE(icap_delete_calendar, NULL)
- PHP_FE(icap_delete_event, NULL)
- PHP_FE(icap_store_event, NULL)
- PHP_FE(icap_snooze, NULL)
- {NULL, NULL, NULL}
-};
-
-
-zend_module_entry php_icap_module_entry = {
- "icap", icap_functions, PHP_MINIT(icap), NULL, NULL, NULL, PHP_MINFO(icap), 0, 0, 0, NULL
-};
-
-
-#ifdef COMPILE_DL_ICAP
-ZEND_GET_MODULE(php_icap)
-#endif
-
-/*
- I believe since this global is used ONLY within this module,
- and nothing will link to this module, we can use the simple
- thread local_ storage
-*/
-int le_icap;
-#ifdef OP_RELOGIN
-/* AJS: persistent connection type */
-int le_picap;
-#endif
-char icap_user[80]="";
-char icap_password[80]="";
-
-CALSTREAM *cal_close_it (zend_rsrc_list_entry *rsrc)
-{
- pils *icap_le_struct = (pils *)rsrc->ptr;
- CALSTREAM *ret;
- ret = cal_close (icap_le_struct->icap_stream,0);
- efree(icap_le_struct);
- return ret;
-}
-
-
-PHP_MINFO_FUNCTION(icap)
-{
- php_info_print_table_start();
- php_info_print_table_row(2, "ICAP Support", "enabled");
- php_info_print_table_row(2, "ICAP Version", CALVER);
- php_info_print_table_end();
-}
-
-PHP_MINIT_FUNCTION(icap)
-{
-
- le_icap = zend_register_list_destructors_ex(cal_close_it, NULL, "icap", module_number);
-
- return SUCCESS;
-}
-
-
-static int add_assoc_object(pval *arg, char *key, pval *tmp)
-{
- HashTable *symtable;
-
- if (arg->type == IS_OBJECT) {
- symtable = arg->value.obj.properties;
- } else {
- symtable = arg->value.ht;
- }
- return zend_hash_update(symtable, key, strlen(key)+1, (void *) &tmp, sizeof(pval *), NULL);
-}
-
-
-void php_icap_do_open(INTERNAL_FUNCTION_PARAMETERS, int persistent)
-{
- pval *calendar;
- pval *user;
- pval *passwd;
- pval *options;
- CALSTREAM *icap_stream;
- pils *icap_le_struct;
- long flags=0;
- long cl_flags=0;
- int ind;
- int myargc=ZEND_NUM_ARGS();
-
-
- if (myargc <3 || myargc >4 || getParameters(ht, myargc, &calendar,&user,&passwd,&options) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string(calendar);
- convert_to_string(user);
- convert_to_string(passwd);
- strcpy(icap_user,user->value.str.val);
- strcpy(icap_password,passwd->value.str.val);
- if(myargc ==4) {
- convert_to_long(options);
- flags=options->value.lval;
- }
- icap_stream = cal_open(NULL,calendar->value.str.val,0);
- if (!icap_stream) {
- php_error(E_WARNING,"Couldn't open stream %s\n",calendar->value.str.val);
- RETURN_FALSE;
- }
-
- icap_le_struct = emalloc(sizeof(pils));
- icap_le_struct->icap_stream = icap_stream;
- icap_le_struct->flags = 0;
- ind = zend_list_insert(icap_le_struct, le_icap);
- RETURN_LONG(ind);
-}
-
-
-/* {{{ proto int icap_close(int stream_id [, int options])
- Close an ICAP stream */
-PHP_FUNCTION(icap_close)
-{
- pval *options, *streamind;
- int ind, ind_type;
- pils *icap_le_struct=NULL;
- int myargcount=ZEND_NUM_ARGS();
- long flags = 0;
-
- if (myargcount < 1 || myargcount > 2 || getParameters(ht, myargcount, &streamind, &options) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long(streamind);
- ind = streamind->value.lval;
- icap_le_struct = (pils *)zend_list_find(ind, &ind_type);
- if (!icap_le_struct ) {
- php_error(E_WARNING, "Unable to find stream pointer");
- RETURN_FALSE;
- }
- if(myargcount==2) {
- convert_to_long(options);
- flags = options->value.lval;
- icap_le_struct->flags = flags;
- }
- zend_list_delete(ind);
- RETURN_TRUE;
-}
-/* }}} */
-
-
-/* {{{ proto int icap_open(string calendar, string user, string password [, int options])
- Open an ICAP stream to a calendar */
-PHP_FUNCTION(icap_open)
-{
- php_icap_do_open(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-/* }}} */
-
-
-/* {{{ proto int icap_reopen(int stream_id, string calendar [, int options])
- Reopen ICAP stream to new calendar */
-PHP_FUNCTION(icap_reopen)
-{
- pval *streamind;
- pval *calendar;
- pval *options;
- CALSTREAM *icap_stream;
- pils *icap_le_struct;
- int ind, ind_type;
- long flags=0;
- long cl_flags=0;
- int myargc=ZEND_NUM_ARGS();
-
- if (myargc<2 || myargc>3 || getParameters(ht,myargc,&streamind, &calendar, &options) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(streamind);
- ind = streamind->value.lval;
- icap_le_struct = (pils *)zend_list_find(ind, &ind_type);
- if (!icap_le_struct ) {
- php_error(E_WARNING, "Unable to find stream pointer");
- RETURN_FALSE;
- }
-
- convert_to_string(calendar);
- if(myargc == 3) {
- convert_to_long(options);
- flags = options->value.lval;
- icap_le_struct->flags = cl_flags;
- }
- /*
- icap_stream = cal_connect(calendar->value.str.val);
- cal_login(icap_stream, calendar->value.str.val);
- */
- if (icap_stream == NULL) {
- php_error(E_WARNING,"Couldn't re-open stream\n");
- RETURN_FALSE;
- }
- RETURN_TRUE;
-}
-/* }}} */
-
-
-/* {{{ proto int icap_expunge(int stream_id)
- Delete all messages marked for deletion */
-PHP_FUNCTION(icap_expunge)
-{
- pval *streamind;
- int ind, ind_type;
- pval *start,*end;
- pils *icap_le_struct;
-
- if (ZEND_NUM_ARGS() != 1 || getParameters(ht, 1, &streamind) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(streamind);
-
- ind = streamind->value.lval;
-
- icap_le_struct = (pils *)zend_list_find(ind, &ind_type);
-
- if (!icap_le_struct ) {
- php_error(E_WARNING, "Unable to find stream pointer");
- RETURN_FALSE;
- }
-
-/* cal_expunge (icap_le_struct->icap_stream);
-*/
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int icap_fetch_event(int stream_id, int eventid [, int options])
- Fetch an event */
-PHP_FUNCTION(icap_fetch_event)
-{
- pval *streamind,*eventid,*start,*end,*options=NULL;
- int ind, ind_type;
- pils *icap_le_struct=NULL;
- CALEVENT *myevent;
- int myargcount=ZEND_NUM_ARGS();
-
- if (myargcount < 1 || myargcount > 3 || getParameters(ht, myargcount, &streamind, &eventid,&options) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long(streamind);
- convert_to_long(eventid);
- ind = streamind->value.lval;
- icap_le_struct = (pils *)zend_list_find(ind, &ind_type);
- if (!icap_le_struct ) {
- php_error(E_WARNING, "Unable to find stream pointer");
- RETURN_FALSE;
- }
- if(myargcount==3) {
- convert_to_long(options);
- }
- cal_fetch(icap_le_struct->icap_stream,eventid->value.lval,&myevent);
-
- object_init(return_value);
- add_property_long(return_value,"id",myevent->id);
- add_property_long(return_value,"public",myevent->public);
- MAKE_STD_ZVAL(start);
- object_init(start);
- if(myevent->start.has_date)
- {
- add_property_long(start,"year",myevent->start.year);
- add_property_long(start,"month",myevent->start.mon);
- add_property_long(start,"mday",myevent->start.mday);
- }
- if(myevent->start.has_time)
- {
- add_property_long(start,"hour",myevent->start.hour);
- add_property_long(start,"min",myevent->start.min);
- add_property_long(start,"sec",myevent->start.sec);
- }
- add_assoc_object(return_value, "start",start);
-
- MAKE_STD_ZVAL(end);
- object_init(end);
- if(myevent->end.has_date)
- {
- add_property_long(end,"year",myevent->end.year);
- add_property_long(end,"month",myevent->end.mon);
- add_property_long(end,"mday",myevent->end.mday);
- }
- if(myevent->end.has_time)
- {
- add_property_long(end,"hour",myevent->end.hour);
- add_property_long(end,"min",myevent->end.min);
- add_property_long(end,"sec",myevent->end.sec);
- }
- add_assoc_object(return_value, "end",end);
-
- add_property_string(return_value,"category",myevent->category,1);
- add_property_string(return_value,"title",myevent->title,1);
- add_property_string(return_value,"description",myevent->description,1);
- add_property_long(return_value,"alarm",myevent->alarm);
-}
-/* }}} */
-
-/* {{{ proto array icap_list_events(int stream_id, int begindate [, int enddate])
- Returns list of UIDs for that day or range of days */
-PHP_FUNCTION(icap_list_events)
-{
- pval *streamind,*begindate,*enddate;
- pval **pvalue;
- int ind, ind_type;
- unsigned long i;
- char *t;
- int icap_folders=0;
- unsigned int msgno;
- pils *icap_le_struct;
- cal_list_t *my_cal_list;
- datetime_t begincal,endcal;
- int myargc;
- myargc=ZEND_NUM_ARGS();
- if (myargc <2 || myargc > 3 || getParameters(ht,myargc,&streamind,&begindate,&enddate) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(streamind);
- convert_to_array(begindate);
- if(myargc == 3) convert_to_array(enddate);
- ind = streamind->value.lval;
-
- icap_le_struct = (pils *)zend_list_find(ind, &ind_type);
-
- if (!icap_le_struct ) {
- php_error(E_WARNING, "Unable to find stream pointer");
- RETURN_FALSE;
- }
-
- /* Initialize return array */
- if (array_init(return_value) == FAILURE) {
- RETURN_FALSE;
- }
- begincal.has_time=0;
- endcal.has_time=0;
- if(zend_hash_find(begindate->value.ht,"year",sizeof("year"),(void **) &pvalue)== SUCCESS){
- SEPARATE_ZVAL(pvalue);
- convert_to_long(*pvalue);
- begincal.year=(*pvalue)->value.lval;
- }
- if(zend_hash_find(begindate->value.ht,"month",sizeof("month"),(void **) &pvalue)== SUCCESS){
- SEPARATE_ZVAL(pvalue);
- convert_to_long(*pvalue);
- begincal.mon=(*pvalue)->value.lval;
- }
- if(zend_hash_find(begindate->value.ht,"day",sizeof("day"),(void **) &pvalue)== SUCCESS){
- SEPARATE_ZVAL(pvalue);
- convert_to_long(*pvalue);
- begincal.mday=(*pvalue)->value.lval;
- }
-if(myargc == 3)
- {
- if(zend_hash_find(enddate->value.ht,"year",sizeof("year"),(void **) &pvalue)== SUCCESS){
- SEPARATE_ZVAL(pvalue);
- convert_to_long(*pvalue);
- endcal.year=(*pvalue)->value.lval;
- }
- if(zend_hash_find(enddate->value.ht,"month",sizeof("month"),(void **) &pvalue)== SUCCESS){
- SEPARATE_ZVAL(pvalue);
- convert_to_long(*pvalue);
- endcal.mon=(*pvalue)->value.lval;
- }
- if(zend_hash_find(enddate->value.ht,"day",sizeof("day"),(void **) &pvalue)== SUCCESS){
- SEPARATE_ZVAL(pvalue);
- convert_to_long(*pvalue);
- endcal.mday=(*pvalue)->value.lval;
- }
- }
-
-
-g_cal_list=NULL;
- cal_search_range(icap_le_struct->icap_stream,&begincal,&endcal);
- my_cal_list=g_cal_list;
- while(my_cal_list != NULL)
- {
- add_next_index_long(return_value,my_cal_list->uid);
- my_cal_list=my_cal_list->next;
- free(g_cal_list);
- g_cal_list=my_cal_list;
- }
-}
-/* }}} */
-
-
-/* {{{ proto string icap_create_calendar(int stream_id, string calendar)
- Create a new calendar*/
-
-PHP_FUNCTION(icap_create_calendar)
-{
- pval *streamind, *calendar;
- int ind, ind_type;
- pils *icap_le_struct;
- int myargc=ZEND_NUM_ARGS();
- if (myargc <1 || myargc > 2 || getParameters(ht,myargc,&streamind,&calendar) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(streamind);
- convert_to_string(calendar);
- ind = streamind->value.lval;
-
- icap_le_struct = (pils *)zend_list_find(ind, &ind_type);
- if (!icap_le_struct ) {
- php_error(E_WARNING, "Unable to find stream pointer");
- RETURN_FALSE;
- }
-/*
- if (icap_create(icap_le_struct->icap_stream,calendar->value.str.val))
- {
- RETURN_TRUE;
- }
- else
- {
- RETURN_FALSE;
- }
-*/
-}
-/* }}} */
-
-
-/* {{{ proto string icap_rename_calendar(int stream_id, string src_calendar, string dest_calendar)
- Rename a calendar*/
-PHP_FUNCTION(icap_rename_calendar)
-{
- pval *streamind, *src_calendar,*dest_calendar;
- int ind, ind_type;
- pils *icap_le_struct;
- int myargc=ZEND_NUM_ARGS();
- if (myargc <2 || myargc > 3 || getParameters(ht,myargc,&streamind,&src_calendar,&dest_calendar) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(streamind);
- convert_to_string(src_calendar);
- convert_to_string(dest_calendar);
- ind = streamind->value.lval;
-
- icap_le_struct = (pils *)zend_list_find(ind, &ind_type);
- if (!icap_le_struct ) {
- php_error(E_WARNING, "Unable to find stream pointer");
- RETURN_FALSE;
- }
-/*
- if(icap_rename(icap_le_struct->icap_stream,src_calendar->value.str.val,dest_calendar->value.str.val)) {RETURN_TRUE;}
- else {RETURN_FALSE; }
-*/
-}
-/* }}} */
-
-
-
-
-/* {{{ proto int icap_list_alarms(int stream_id, array date, array time)
- List alarms for a given time */
-PHP_FUNCTION(icap_list_alarms)
-{
- pval *streamind, *date,*time;
- pval **pvalue;
- datetime_t mydate;
- int ind, ind_type;
- pils *icap_le_struct;
- int icap_folders=0;
- unsigned int msgno;
- cal_list_t *my_cal_list;
-
- int myargc=ZEND_NUM_ARGS();
- if (myargc != 3 || getParameters(ht,myargc,&streamind,&date,&time) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(streamind);
- convert_to_array(date);
- convert_to_array(time);
- ind = streamind->value.lval;
-
- icap_le_struct = (pils *)zend_list_find(ind, &ind_type);
- if (!icap_le_struct ) {
- php_error(E_WARNING, "Unable to find stream pointer");
- RETURN_FALSE;
- }
-
- if (array_init(return_value) == FAILURE) {
- RETURN_FALSE;
- }
- mydate.has_date=1;
- mydate.has_time=1;
- if(zend_hash_find(date->value.ht,"year",sizeof("year"),(void **) &pvalue)== SUCCESS){
- SEPARATE_ZVAL(pvalue);
- convert_to_long(*pvalue);
- mydate.year=(*pvalue)->value.lval;
- }
- if(zend_hash_find(date->value.ht,"month",sizeof("month"),(void **) &pvalue)== SUCCESS){
- SEPARATE_ZVAL(pvalue);
- convert_to_long(*pvalue);
- mydate.mon=(*pvalue)->value.lval;
- }
- if(zend_hash_find(date->value.ht,"day",sizeof("day"),(void **) &pvalue)== SUCCESS){
- SEPARATE_ZVAL(pvalue);
- convert_to_long(*pvalue);
- mydate.mday=(*pvalue)->value.lval;
- }
-
- if(zend_hash_find(time->value.ht,"hour",sizeof("hour"),(void **) &pvalue)== SUCCESS){
- SEPARATE_ZVAL(pvalue);
- convert_to_long(*pvalue);
- mydate.hour=(*pvalue)->value.lval;
- }
- if(zend_hash_find(time->value.ht,"minute",sizeof("minute"),(void **) &pvalue)== SUCCESS){
- SEPARATE_ZVAL(pvalue);
- convert_to_long(*pvalue);
- mydate.min=(*pvalue)->value.lval;
- }
- mydate.sec=0;
- g_cal_list=NULL;
- cal_search_alarm(icap_le_struct->icap_stream,&mydate);
- my_cal_list=g_cal_list;
- while(my_cal_list != NULL)
- {
- add_next_index_long(return_value,my_cal_list->uid);
- my_cal_list=my_cal_list->next;
- free(g_cal_list);
- g_cal_list=my_cal_list;
- }
-
-
-}
-/* }}} */
-
-
-/* {{{ proto string icap_delete_calendar(int stream_id, string calendar)
- Delete calendar */
-PHP_FUNCTION(icap_delete_calendar)
-{
- pval *streamind, *calendar;
- int ind, ind_type;
- pils *icap_le_struct;
- int myargc=ZEND_NUM_ARGS();
- if (myargc <1 || myargc > 2 || getParameters(ht,myargc,&streamind,&calendar) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(streamind);
- convert_to_string(calendar);
- ind = streamind->value.lval;
-
- icap_le_struct = (pils *)zend_list_find(ind, &ind_type);
- if (!icap_le_struct ) {
- php_error(E_WARNING, "Unable to find stream pointer");
- RETURN_FALSE;
- }
-
- if (icap_delete_calendar(icap_le_struct->icap_stream,calendar->value.str.val))
- {
- RETURN_TRUE;
- }
- else
- {
- RETURN_FALSE;
- }
-
-}
-/* }}} */
-
-
-/* {{{ proto string icap_delete_event(int stream_id, int uid)
- Delete event */
-PHP_FUNCTION(icap_delete_event)
-{
- pval *streamind, *uid;
- int ind, ind_type;
- pils *icap_le_struct;
- int myargc=ZEND_NUM_ARGS();
- if (myargc <1 || myargc > 2 || getParameters(ht,myargc,&streamind,&uid) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(streamind);
- convert_to_long(uid);
- ind = streamind->value.lval;
-
- icap_le_struct = (pils *)zend_list_find(ind, &ind_type);
- if (!icap_le_struct ) {
- php_error(E_WARNING, "Unable to find stream pointer");
- RETURN_FALSE;
- }
- if (cal_remove(icap_le_struct->icap_stream,uid->value.lval))
- {
- RETURN_TRUE;
- }
- else
- {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto string icap_delete_calendar(int stream_id, int uid)
- Delete event*/
-icap_delete_calendar(){
- return 1;
-}
-/* }}} */
-
-PHP_FUNCTION(icap_popen)
-{
-}
-
-/* {{{ proto string icap_store_event(int stream_id, object event)
- Store an event */
-PHP_FUNCTION(icap_store_event)
-{
- pval *streamind,*storeobject;
- int ind, ind_type;
- unsigned long i;
- char *t;
- int icap_folders=0;
- unsigned int msgno;
- pils *icap_le_struct;
- pval **pvalue,**temppvalue;
- cal_list_t *my_cal_list;
- int myargc;
- unsigned long uid;
- CALEVENT *myevent;
- myargc=ZEND_NUM_ARGS();
- if (myargc !=2 || getParameters(ht,myargc,&streamind,&storeobject) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(streamind);
- convert_to_array(storeobject);
-
- ind = streamind->value.lval;
-
- icap_le_struct = (pils *)zend_list_find(ind, &ind_type);
-
- if (!icap_le_struct ) {
- php_error(E_WARNING, "Unable to find stream pointer");
- RETURN_FALSE;
- }
-
- /* Initialize return array */
- if (array_init(return_value) == FAILURE) {
- RETURN_FALSE;
- }
- myevent=calevent_new();
- if(zend_hash_find(storeobject->value.ht,"uid",sizeof("uid"),(void **) &pvalue)== SUCCESS){
- SEPARATE_ZVAL(pvalue);
- convert_to_long(*pvalue);
- myevent->id=(*pvalue)->value.lval;
- }
- if(zend_hash_find(storeobject->value.ht,"public",sizeof("public"),(void **) &pvalue)== SUCCESS){
- SEPARATE_ZVAL(pvalue);
- convert_to_long(*pvalue);
- myevent->public=(*pvalue)->value.lval;
- }
- if(zend_hash_find(storeobject->value.ht,"category",sizeof("category"),(void **) &pvalue)== SUCCESS){
- SEPARATE_ZVAL(pvalue);
- convert_to_string(*pvalue);
- myevent->category=strdup((*pvalue)->value.str.val);
- }
- if(zend_hash_find(storeobject->value.ht,"title",sizeof("title"),(void **) &pvalue)== SUCCESS){
- SEPARATE_ZVAL(pvalue);
- convert_to_string(*pvalue);
- myevent->title=strdup((*pvalue)->value.str.val);
- }
- if(zend_hash_find(storeobject->value.ht,"description",sizeof("description"),(void **) &pvalue)== SUCCESS){
- SEPARATE_ZVAL(pvalue);
- convert_to_string(*pvalue);
- myevent->description=strdup((*pvalue)->value.str.val);
- }
-
- if(zend_hash_find(storeobject->value.ht,"alarm",sizeof("alarm"),(void **) &pvalue)== SUCCESS){
- SEPARATE_ZVAL(pvalue);
- convert_to_long(*pvalue);
- myevent->alarm=(*pvalue)->value.lval;
- }
-
-
- if(zend_hash_find(storeobject->value.ht,"start",sizeof("start"),(void **) &temppvalue)== SUCCESS){
- SEPARATE_ZVAL(temppvalue);
- convert_to_array(*temppvalue);
-
- if(zend_hash_find((*temppvalue)->value.ht,"year",sizeof("year"),(void **) &pvalue)== SUCCESS){
- SEPARATE_ZVAL(pvalue);
- convert_to_long(*pvalue);
- myevent->start.year=(*pvalue)->value.lval;
- }
- if(zend_hash_find((*temppvalue)->value.ht,"month",sizeof("month"),(void **) &pvalue)== SUCCESS){
- SEPARATE_ZVAL(pvalue);
- convert_to_long(*pvalue);
- myevent->start.mon=(*pvalue)->value.lval;
- }
- if(zend_hash_find((*temppvalue)->value.ht,"mday",sizeof("mday"),(void **) &pvalue)== SUCCESS){
- SEPARATE_ZVAL(pvalue);
- convert_to_long(*pvalue);
- myevent->start.mday=(*pvalue)->value.lval;
- }
- if(zend_hash_find((*temppvalue)->value.ht,"hour",sizeof("hour"),(void **) &pvalue)== SUCCESS){
- SEPARATE_ZVAL(pvalue);
- convert_to_long(*pvalue);
- myevent->start.hour=(*pvalue)->value.lval;
- }
- if(zend_hash_find((*temppvalue)->value.ht,"min",sizeof("min"),(void **) &pvalue)== SUCCESS){
- SEPARATE_ZVAL(pvalue);
- convert_to_long(*pvalue);
- myevent->start.min=(*pvalue)->value.lval;
- }
- if(zend_hash_find((*temppvalue)->value.ht,"sec",sizeof("sec"),(void **) &pvalue)== SUCCESS){
- SEPARATE_ZVAL(pvalue);
- convert_to_long(*pvalue);
- myevent->start.sec=(*pvalue)->value.lval;
- }
- myevent->start.has_date=true;
- }
-
- if(zend_hash_find(storeobject->value.ht,"end",sizeof("end"),(void **) &temppvalue)== SUCCESS){
- SEPARATE_ZVAL(temppvalue);
- convert_to_array(*temppvalue);
-
- if(zend_hash_find((*temppvalue)->value.ht,"year",sizeof("year"),(void **) &pvalue)== SUCCESS){
- SEPARATE_ZVAL(pvalue);
- convert_to_long(*pvalue);
- myevent->end.year=(*pvalue)->value.lval;
- }
- if(zend_hash_find((*temppvalue)->value.ht,"month",sizeof("month"),(void **) &pvalue)== SUCCESS){
- SEPARATE_ZVAL(pvalue);
- convert_to_long(*pvalue);
- myevent->end.mon=(*pvalue)->value.lval;
- }
- if(zend_hash_find((*temppvalue)->value.ht,"mday",sizeof("mday"),(void **) &pvalue)== SUCCESS){
- SEPARATE_ZVAL(pvalue);
- convert_to_long(*pvalue);
- myevent->end.mday=(*pvalue)->value.lval;
- }
- if(zend_hash_find((*temppvalue)->value.ht,"hour",sizeof("hour"),(void **) &pvalue)== SUCCESS){
- SEPARATE_ZVAL(pvalue);
- convert_to_long(*pvalue);
- myevent->end.hour=(*pvalue)->value.lval;
- }
- if(zend_hash_find((*temppvalue)->value.ht,"min",sizeof("min"),(void **) &pvalue)== SUCCESS){
- SEPARATE_ZVAL(pvalue);
- convert_to_long(*pvalue);
- myevent->end.min=(*pvalue)->value.lval;
- }
- if(zend_hash_find((*temppvalue)->value.ht,"sec",sizeof("sec"),(void **) &pvalue)== SUCCESS){
- SEPARATE_ZVAL(pvalue);
- convert_to_long(*pvalue);
- myevent->end.sec=(*pvalue)->value.lval;
- }
- myevent->end.has_date=true;
- }
-
- cal_append(icap_le_struct->icap_stream,"INBOX",&uid,myevent);
- calevent_free(myevent);
- RETURN_LONG(uid);
-}
-/* }}} */
-
-
-/* {{{ proto string icap_snooze(int stream_id, int uid)
- Snooze an alarm */
-PHP_FUNCTION(icap_snooze)
-{
- pval *streamind,*uid;
- int ind, ind_type;
- pils *icap_le_struct;
- pval **pvalue;
- int myargc;
- myargc=ZEND_NUM_ARGS();
- if (myargc !=2 || getParameters(ht,myargc,&streamind,&uid) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(streamind);
- convert_to_long(uid);
-
- ind = streamind->value.lval;
-
- icap_le_struct = (pils *)zend_list_find(ind, &ind_type);
-
- if (!icap_le_struct ) {
- php_error(E_WARNING, "Unable to find stream pointer");
- RETURN_FALSE;
- }
-
- if(cal_snooze(icap_le_struct->icap_stream,uid->value.lval))
- {
- RETURN_TRUE;
- }
- else
- {
- RETURN_FALSE;
- }
-
-
-}
-/* }}} */
-
-
-/* Interfaces to callbacks */
-
-
-void cc_searched (unsigned long cal_uid)
-{
-
- if(g_cal_list==NULL)
- {
- g_cal_list=malloc(sizeof(struct cal_list));
- g_cal_list->uid=cal_uid;
- g_cal_list->next=NULL;
- g_cal_list_end=g_cal_list;
- }
- else
- {
- g_cal_list_end->next=malloc(sizeof(struct cal_list));
- g_cal_list_end=g_cal_list_end->next;
- g_cal_list_end->uid=cal_uid;
- g_cal_list_end->next=NULL;
- }
-}
-
-
-void cc_appended(php_uint32 uid)
-{
-
-}
-
-
-void cc_fetched(const CALEVENT *event)
-{
-
-}
-
-
-void cc_login(const char **user, const char **pwd)
-{
-
-*user=icap_user;
-*pwd=icap_password;
-}
-
-
-void cc_vlog(const char *fmt,va_list ap)
-{
-}
-void cc_vdlog(const char *fmt,va_list ap)
-{
-}
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/icap/php_icap.h b/ext/icap/php_icap.h
deleted file mode 100644
index 2370f3d270..0000000000
--- a/ext/icap/php_icap.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/* $Id$ */
-
-#ifndef PHP_ICAP_H
-#define PHP_ICAP_H
-
-#if HAVE_ICAP
-
-#ifndef PHP_WIN32
-#include "build-defs.h"
-#endif
-
-extern PHP_MINIT_FUNCTION(icap);
-PHP_MINFO_FUNCTION(icap);
-
-/* Functions accessable to PHP */
-extern zend_module_entry php_icap_module_entry;
-#define php_icap_module_ptr &php_icap_module_entry
-#define phpext_icap_ptr php_icap_module_ptr
-
-extern int icap_init_request(INIT_FUNC_ARGS);
-extern int icap_end_request(void);
-PHP_FUNCTION(icap_open);
-PHP_FUNCTION(icap_popen);
-PHP_FUNCTION(icap_reopen);
-PHP_FUNCTION(icap_close);
-PHP_FUNCTION(icap_fetch_event);
-PHP_FUNCTION(icap_list_events);
-PHP_FUNCTION(icap_create_calendar);
-PHP_FUNCTION(icap_rename_calendar);
-PHP_FUNCTION(icap_delete_calendar);
-PHP_FUNCTION(icap_store_event);
-PHP_FUNCTION(icap_delete_event);
-PHP_FUNCTION(icap_snooze);
-PHP_FUNCTION(icap_list_alarms);
-
-
-#else
-#define php_icap_module_ptr NULL
-#endif /* HAVE_ICAP */
-
-
-#endif
diff --git a/ext/iconv/EXPERIMENTAL b/ext/iconv/EXPERIMENTAL
deleted file mode 100644
index 6443e99646..0000000000
--- a/ext/iconv/EXPERIMENTAL
+++ /dev/null
@@ -1,5 +0,0 @@
-this extension is experimental,
-its functions may change their names
-or move to extension all together
-so do not rely to much on them
-you have been warned!
diff --git a/ext/iconv/Makefile.in b/ext/iconv/Makefile.in
deleted file mode 100644
index 728f5db4a6..0000000000
--- a/ext/iconv/Makefile.in
+++ /dev/null
@@ -1,8 +0,0 @@
-# $Id$
-
-LTLIBRARY_NAME = libiconv.la
-LTLIBRARY_SOURCES = iconv.c
-LTLIBRARY_SHARED_NAME = iconv.la
-LTLIBRARY_SHARED_LIBADD = $(ICONV_SHARED_LIBADD)
-
-include $(top_srcdir)/build/dynlib.mk
diff --git a/ext/iconv/config.m4 b/ext/iconv/config.m4
deleted file mode 100644
index cbdec258f0..0000000000
--- a/ext/iconv/config.m4
+++ /dev/null
@@ -1,38 +0,0 @@
-dnl $Id$
-dnl config.m4 for extension iconv
-
-PHP_ARG_WITH(iconv, for iconv support,
-[ --with-iconv[=DIR] Include iconv support])
-
-if test "$PHP_ICONV" != "no"; then
-
- if test -r $PHP_ICONV/include/iconv.h; then
- ICONV_DIR=$PHP_ICONV
- else
- AC_MSG_CHECKING(for iconv in default path)
- for i in /usr/local /usr; do
- if test -r $i/include/iconv.h; then
- ICONV_DIR=$i
- AC_MSG_RESULT(found in $i)
- fi
- done
- fi
-
- if test -z "$ICONV_DIR"; then
- AC_MSG_RESULT(not found)
- AC_MSG_ERROR(Please reinstall the iconv library)
- fi
-
- PHP_ADD_INCLUDE($ICONV_DIR/include)
-
- PHP_SUBST(ICONV_SHARED_LIBADD)
-
- if test -f $ICONV_DIR/lib/libconv.a -o -f $ICONV_DIR/lib/libiconv.so ; then
- PHP_ADD_LIBRARY_WITH_PATH(iconv, $ICONV_DIR/lib, ICONV_SHARED_LIBADD)
- AC_CHECK_LIB(iconv, iconv_open, AC_DEFINE(HAVE_ICONV, 1, [ ]))
- else
- AC_CHECK_LIB(c, iconv_open, AC_DEFINE(HAVE_ICONV, 1, [ ]))
- fi
-
- PHP_EXTENSION(iconv, $ext_shared)
-fi
diff --git a/ext/iconv/iconv.c b/ext/iconv/iconv.c
deleted file mode 100644
index b852d8c275..0000000000
--- a/ext/iconv/iconv.c
+++ /dev/null
@@ -1,300 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Rui Hirokawa <louis@cityfujisawa.ne.jp> |
- | Stig Bakken <ssb@fast.no> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-
-#if HAVE_ICONV
-
-#include <iconv.h>
-
-#include "php_globals.h"
-#include "php_iconv.h"
-#include "ext/standard/info.h"
-#include "ext/standard/php_output.h"
-#include "SAPI.h"
-#include "php_ini.h"
-
-
-#if HAVE_LIBICONV
-#define icv_open(a,b) libiconv_open(a,b)
-#define icv_close(a) libiconv_close(a)
-#define icv(a,b,c,d,e) libiconv(a,b,c,d,e)
-#else
-#define icv_open(a,b) iconv_open(a,b)
-#define icv_close(a) iconv_close(a)
-#define icv(a,b,c,d,e) iconv(a,b,c,d,e)
-#endif
-
-
-/* {{{ iconv_functions[]
- */
-function_entry iconv_functions[] = {
- PHP_FE(iconv, NULL)
- PHP_FE(ob_iconv_handler, NULL)
- PHP_FE(iconv_get_encoding, NULL)
- PHP_FE(iconv_set_encoding, NULL)
- {NULL, NULL, NULL}
-};
-/* }}} */
-
-/* {{{ iconv_module_entry
- */
-zend_module_entry iconv_module_entry = {
- "iconv",
- iconv_functions,
- PHP_MINIT(miconv),
- PHP_MSHUTDOWN(miconv),
- NULL,
- NULL,
- PHP_MINFO(miconv),
- STANDARD_MODULE_PROPERTIES
-};
-/* }}} */
-
-ZEND_DECLARE_MODULE_GLOBALS(iconv)
-
-#ifdef COMPILE_DL_ICONV
-ZEND_GET_MODULE(iconv)
-#endif
-
-int php_iconv_string(char *, char **, char *, char *);
-
-/* {{{ PHP_INI
- */
-PHP_INI_BEGIN()
- STD_PHP_INI_ENTRY("iconv.input_encoding", ICONV_INPUT_ENCODING, PHP_INI_ALL, OnUpdateString, input_encoding, zend_iconv_globals, iconv_globals)
- STD_PHP_INI_ENTRY("iconv.output_encoding", ICONV_OUTPUT_ENCODING, PHP_INI_ALL, OnUpdateString, output_encoding, zend_iconv_globals, iconv_globals)
- STD_PHP_INI_ENTRY("iconv.internal_encoding", ICONV_INTERNAL_ENCODING, PHP_INI_ALL, OnUpdateString, internal_encoding, zend_iconv_globals, iconv_globals)
-PHP_INI_END()
-/* }}} */
-
-static void
-php_iconv_init_globals(zend_iconv_globals *iconv_globals)
-{
- iconv_globals->input_encoding = NULL;
- iconv_globals->output_encoding = NULL;
- iconv_globals->internal_encoding = NULL;
-}
-
-PHP_MINIT_FUNCTION(miconv)
-{
- ZEND_INIT_MODULE_GLOBALS(iconv, php_iconv_init_globals, NULL);
- REGISTER_INI_ENTRIES();
- return SUCCESS;
-}
-
-PHP_MSHUTDOWN_FUNCTION(miconv)
-{
- UNREGISTER_INI_ENTRIES();
- return SUCCESS;
-}
-
-PHP_MINFO_FUNCTION(miconv)
-{
- php_info_print_table_start();
- php_info_print_table_header(2, "iconv support", "enabled");
- php_info_print_table_end();
-
- DISPLAY_INI_ENTRIES();
-}
-
-/* {{{ php_iconv_string
- */
-int php_iconv_string(char *in_p, char **out, char *in_charset, char *out_charset)
-{
- unsigned int in_size, out_size;
- char *out_buffer, *out_p;
- iconv_t cd;
- size_t result;
- typedef unsigned int ucs4_t;
-
- in_size = strlen(in_p) * sizeof(char) + 1;
- out_size = strlen(in_p) * sizeof(ucs4_t) + 1;
-
- out_buffer = (char *) emalloc(out_size);
- *out = out_buffer;
- out_p = out_buffer;
-
- cd = icv_open(out_charset, in_charset);
-
- if (cd == (iconv_t)(-1)) {
- php_error(E_WARNING, "iconv: cannot convert from `%s' to `%s'",
- in_charset, out_charset);
- efree(out_buffer);
- return FAILURE;
- }
-
- result = icv(cd, (const char **) &in_p, &in_size, (char **)
- &out_p, &out_size);
-
- if (result == (size_t)(-1)) {
- efree(out_buffer);
- return FAILURE;
- }
-
- icv_close(cd);
-
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ proto string iconv(string in_charset, string out_charset, string str)
- Returns str converted to the out_charset character set */
-PHP_FUNCTION(iconv)
-{
- zval **in_charset, **out_charset, **in_buffer;
- char *out_buffer;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &in_charset, &out_charset, &in_buffer) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(in_charset);
- convert_to_string_ex(out_charset);
- convert_to_string_ex(in_buffer);
-
- if (php_iconv_string(Z_STRVAL_PP(in_buffer), &out_buffer, Z_STRVAL_PP(in_charset), Z_STRVAL_PP(out_charset)) == SUCCESS) {
- RETVAL_STRING(out_buffer, 0);
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto string ob_iconv_handler(string contents, int status)
- Returns str in output buffer converted to the iconv.output_encoding character set */
-PHP_FUNCTION(ob_iconv_handler)
-{
- char *out_buffer;
- zval **zv_string, **zv_status;
- SLS_FETCH();
- ICONVLS_FETCH();
-
- if (ZEND_NUM_ARGS()!=2 || zend_get_parameters_ex(2, &zv_string, &zv_status)==FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- convert_to_string_ex(zv_string);
- convert_to_long_ex(zv_status);
-
- if (SG(sapi_headers).send_default_content_type &&
- php_iconv_string(Z_STRVAL_PP(zv_string), &out_buffer,
- ICONVG(internal_encoding),
- ICONVG(output_encoding))==SUCCESS) {
- RETVAL_STRING(out_buffer, 0);
- } else {
- zval_dtor(return_value);
- *return_value = **zv_string;
- zval_copy_ctor(return_value);
- }
-
-}
-/* }}} */
-
-/* {{{ proto bool iconv_set_encoding(string type, string charset)
- Sets internal encoding and output encoding for ob_iconv_handler() */
-PHP_FUNCTION(iconv_set_encoding)
-{
- zval **type, **charset;
- int argc = ZEND_NUM_ARGS();
- ICONVLS_FETCH();
-
- if (argc != 2 || zend_get_parameters_ex(2, &type, &charset) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(type);
- convert_to_string_ex(charset);
-
- if(!strcasecmp("input_encoding",Z_STRVAL_PP(type))) {
- if (ICONVG(input_encoding)) {
- free(ICONVG(input_encoding));
- }
- ICONVG(input_encoding) = estrndup(Z_STRVAL_PP(charset), Z_STRLEN_PP(charset));
- } else if(!strcasecmp("output_encoding",Z_STRVAL_PP(type))) {
- if (ICONVG(output_encoding)) {
- free(ICONVG(output_encoding));
- }
- ICONVG(output_encoding) = estrndup(Z_STRVAL_PP(charset), Z_STRLEN_PP(charset));
- } else if(!strcasecmp("internal_encoding",Z_STRVAL_PP(type))) {
- if (ICONVG(internal_encoding)) {
- free(ICONVG(internal_encoding));
- }
- ICONVG(internal_encoding) = estrndup(Z_STRVAL_PP(charset), Z_STRLEN_PP(charset));
- } else {
- RETURN_FALSE;
- }
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto array iconv_get_encoding([string type])
- Get internal encoding and output encoding for ob_iconv_handler() */
-PHP_FUNCTION(iconv_get_encoding)
-{
- zval **type;
- int argc = ZEND_NUM_ARGS();
- ICONVLS_FETCH();
-
- if (argc < 0 || argc > 1 || zend_get_parameters_ex(1, &type) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(type);
-
- if (argc == 0 || !strcasecmp("all",Z_STRVAL_PP(type))) {
- if (array_init(return_value) == FAILURE) {
- RETURN_FALSE;
- }
- add_assoc_string(return_value, "input_encoding",
- ICONVG(input_encoding), 1);
- add_assoc_string(return_value, "output_encoding",
- ICONVG(output_encoding), 1);
- add_assoc_string(return_value, "internal_encoding",
- ICONVG(internal_encoding), 1);
- } else if (!strcasecmp("input_encoding",Z_STRVAL_PP(type))) {
- RETVAL_STRING(ICONVG(input_encoding), 1);
- } else if (!strcasecmp("output_encoding",Z_STRVAL_PP(type))) {
- RETVAL_STRING(ICONVG(output_encoding), 1);
- } else if (!strcasecmp("internal_encoding",Z_STRVAL_PP(type))) {
- RETVAL_STRING(ICONVG(internal_encoding), 1);
- } else {
- RETURN_FALSE;
- }
-
-}
-/* }}} */
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/iconv/iconv.dsp b/ext/iconv/iconv.dsp
deleted file mode 100644
index 42f85d2299..0000000000
--- a/ext/iconv/iconv.dsp
+++ /dev/null
@@ -1,107 +0,0 @@
-# Microsoft Developer Studio Project File - Name="iconv" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=iconv - Win32 Debug_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "iconv.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "iconv.mak" CFG="iconv - Win32 Debug_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "iconv - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "iconv - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "iconv - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ICONV_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\main" /I "..\..\win32" /D "WIN32" /D "PHP_EXPORTS" /D "COMPILE_DL_ICONV" /D "HAVE_ICONV" /D ZEND_DEBUG=0 /D "NDEBUG" /D "_WINDOWS" /D "ZEND_WIN32" /D "PHP_WIN32" /D ZTS=1 /D "HAVE_LIBICONV" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x407 /d "NDEBUG"
-# ADD RSC /l 0x407 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 php4ts.lib iconv.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_iconv.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
-
-!ELSEIF "$(CFG)" == "iconv - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ICONV_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\main" /I "..\..\win32" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "PHP_EXPORTS" /D "COMPILE_DL_ICONV" /D "ZEND_WIN32" /D "PHP_WIN32" /D "HAVE_ICONV" /D ZTS=1 /D "HAVE_LIBICONV" /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x407 /d "_DEBUG"
-# ADD RSC /l 0x407 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 php4ts_debug.dll iconv-1.3.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"..\..\Debug_TS/php_iconv.dll" /pdbtype:sept /libpath:"..\..\Debug_TS"
-
-!ENDIF
-
-# Begin Target
-
-# Name "iconv - Win32 Release_TS"
-# Name "iconv - Win32 Debug_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\iconv.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_iconv.h
-# End Source File
-# End Group
-# End Target
-# End Project
diff --git a/ext/iconv/php_iconv.h b/ext/iconv/php_iconv.h
deleted file mode 100644
index 2178fa2e4e..0000000000
--- a/ext/iconv/php_iconv.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Rui Hirokawa <louis@cityfujisawa.ne.jp> |
- | Stig Bakken <ssb@fast.no> |
- +----------------------------------------------------------------------+
- */
-
-#ifndef PHP_ICONV_H
-#define PHP_ICONV_H
-
-#ifdef PHP_WIN32
-#define PHP_ICONV_API __declspec(dllexport)
-#else
-#define PHP_ICONV_API
-#endif
-
-extern zend_module_entry iconv_module_entry;
-#define phpext_iconv_ptr &iconv_module_entry
-
-PHP_MINIT_FUNCTION(miconv);
-PHP_MSHUTDOWN_FUNCTION(miconv);
-PHP_MINFO_FUNCTION(miconv);
-
-PHP_FUNCTION(iconv);
-PHP_FUNCTION(ob_iconv_handler);
-PHP_FUNCTION(iconv_get_encoding);
-PHP_FUNCTION(iconv_set_encoding);
-
-ZEND_BEGIN_MODULE_GLOBALS(iconv)
- char *input_encoding;
- char *internal_encoding;
- char *output_encoding;
-ZEND_END_MODULE_GLOBALS(iconv)
-
-#ifdef ZTS
-#define ICONVLS_D zend_iconv_globals *iconv_globals
-#define ICONVLS_C iconv_globals
-#define ICONVG(v) (iconv_globals->v)
-#define ICONVLS_FETCH() zend_iconv_globals *iconv_globals = ts_resource(iconv_globals_id)
-#else
-#define ICONVLS_D
-#define ICONVLS_C
-#define ICONVG(v) (iconv_globals.v)
-#define ICONVLS_FETCH()
-#endif
-
-#define ICONV_INPUT_ENCODING "ISO-8859-1"
-#define ICONV_OUTPUT_ENCODING "ISO-8859-1"
-#define ICONV_INTERNAL_ENCODING "ISO-8859-1"
-
-#endif /* PHP_ICONV_H */
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/iconv/tests/001.phpt b/ext/iconv/tests/001.phpt
deleted file mode 100644
index a380d278aa..0000000000
--- a/ext/iconv/tests/001.phpt
+++ /dev/null
@@ -1,18 +0,0 @@
---TEST--
-iconv test
---SKIPIF--
-<?php if (!extension_loaded("iconv")) print "skip"; ?>
---POST--
---GET--
---FILE--
-<?php
-echo "iconv extension is available";
-$test = "Stig S誥her Bakken";
-print "$test\n";
-printf("%s\n", iconv("iso-8859-1", "utf-8", $test));
-
-?>
---EXPECT--
-iconv extension is available
-Stig S誥her Bakken
-Stig Sテヲther Bakken
diff --git a/ext/imap/CREDITS b/ext/imap/CREDITS
deleted file mode 100644
index 2d19ecd24a..0000000000
--- a/ext/imap/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-IMAP
-Rex Logan, Mark Musone, Brian Wang, Kaj-Michael Lang, Antoni Pamies Olive, Rasmus Lerdorf, Andrew Skalski, Chuck Hagenbuch, Daniel R Kalowsky
diff --git a/ext/imap/IMAP_Win32_HOWTO.txt b/ext/imap/IMAP_Win32_HOWTO.txt
deleted file mode 100644
index 5fbd859a6d..0000000000
--- a/ext/imap/IMAP_Win32_HOWTO.txt
+++ /dev/null
@@ -1,32 +0,0 @@
-Rules for building IMAP
------------------------
-
-Note 1: You *must* use NT's cmd.exe for this job; 4NT.exe will NOT work properly.
-Note 2: During the entire build process, you can ignore warnings about
- inconsistent DLL linkage.
-
-- Open IMAP under php_build. Rename this directory to 'IMAP'.
-- Change to the IMAP directory.
-- Edit .\src\osdep\nt\makefile.nt:
- Search for '/MT', and change it to '/MD'. If you're compiling in DEBUG mode,
- use '/MDd' instead.
- Search for 'ERASE'. Comment out the line that contains the ERASE command.
-- Run 'nmake nt'
-
----Begin Win2K only---
-- At some point, the build will fail. Rerun 'nmake nt'.
-- After a while, the build will fail again, failing to find auths.c.
-- Change directory to 'c-client'
-- Create an a file named auths.c, that includes the following line:
- #include "auth_md5.c"
-- Run 'nmake -f makefile.nt'
----End Win2K only---
-
-At this point (even if the last build apparently failed), you should have the
-client library ready (cclient.lib).
-
-Start Visual Studio, load php_modules.dsw, select the IMAP projects, and build
-it.
-
-
- \ No newline at end of file
diff --git a/ext/imap/Makefile.in b/ext/imap/Makefile.in
deleted file mode 100644
index a1992ce9f3..0000000000
--- a/ext/imap/Makefile.in
+++ /dev/null
@@ -1,7 +0,0 @@
-
-LTLIBRARY_NAME = libimap.la
-LTLIBRARY_SOURCES = php_imap.c
-LTLIBRARY_SHARED_NAME = imap.la
-LTLIBRARY_SHARED_LIBADD = $(IMAP_SHARED_LIBADD)
-
-include $(top_srcdir)/build/dynlib.mk
diff --git a/ext/imap/config.m4 b/ext/imap/config.m4
deleted file mode 100644
index 7cea41a9fa..0000000000
--- a/ext/imap/config.m4
+++ /dev/null
@@ -1,140 +0,0 @@
-dnl
-dnl $Id$
-dnl
-
-AC_DEFUN(IMAP_INC_CHK,[if test -r "$i$1/c-client.h"; then
- AC_DEFINE(HAVE_IMAP2000, 1, [ ])
- IMAP_DIR=$i
- IMAP_INC_DIR=$i$1
- elif test -r "$i$1/rfc822.h"; then
- IMAP_DIR=$i;
- IMAP_INC_DIR=$i$1
-])
-
-AC_DEFUN(IMAP_LIB_CHK,[
- str="$IMAP_DIR/$1/lib$lib.*"
- for i in `echo $str`; do
- if test -r $i; then
- IMAP_LIBDIR=$IMAP_DIR/$1
- break 2
- fi
- done
-])
-
-AC_DEFUN(PHP_IMAP_KRB_CHK, [
- PHP_ARG_WITH(kerberos,for Kerberos support in IMAP,
- [ --with-kerberos[=DIR] IMAP: Include Kerberos support.])
-
- if test "$PHP_KERBEROS" = "yes"; then
- test -d /usr/kerberos && PHP_KERBEROS=/usr/kerberos
- fi
-
- if test "$PHP_KERBEROS" != "no"; then
- AC_DEFINE(HAVE_IMAP_KRB,1,[ ])
- PHP_ADD_LIBPATH($PHP_KERBEROS/lib, IMAP_SHARED_LIBADD)
- PHP_ADD_LIBRARY(gssapi_krb5, 1, IMAP_SHARED_LIBADD)
- PHP_ADD_LIBRARY(krb5, 1, IMAP_SHARED_LIBADD)
- PHP_ADD_LIBRARY(k5crypto, 1, IMAP_SHARED_LIBADD)
- PHP_ADD_LIBRARY(com_err, 1, IMAP_SHARED_LIBADD)
- fi
-])
-
-AC_DEFUN(PHP_IMAP_SSL_CHK, [
- PHP_ARG_WITH(imap-ssl,for SSL support in IMAP,
- [ --with-imap-ssl[=DIR] IMAP: Include SSL support.])
-
- if test "$PHP_IMAP_SSL" = "yes"; then
- PHP_IMAP_SSL=/usr
- fi
-
- if test "$PHP_IMAP_SSL" != "no"; then
- PHP_ADD_LIBPATH($PHP_IMAP_SSL/lib, IMAP_SHARED_LIBADD)
- PHP_ADD_LIBRARY_DEFER(crypto)
- PHP_ADD_LIBRARY_DEFER(ssl)
-
- old_LIBS=$LIBS
- LIBS="$LIBS -lc-client"
- if test $PHP_KERBEROS != "no"; then
- LIBS="$LIBS -lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err"
- fi
- AC_TRY_RUN([
- void mm_log(void){}
- void mm_dlog(void){}
- void mm_flags(void){}
- void mm_fatal(void){}
- void mm_critical(void){}
- void mm_nocritical(void){}
- void mm_notify(void){}
- void mm_login(void){}
- void mm_diskerror(void){}
- void mm_status(void){}
- void mm_lsub(void){}
- void mm_list(void){}
- void mm_exists(void){}
- void mm_searched(void){}
- void mm_expunged(void){}
- char ssl_onceonlyinit();
- int main() {
- ssl_onceonlyinit();
- return 0;
- }
- ],[
- AC_DEFINE(HAVE_IMAP_SSL,1,[ ])
- ], [
- AC_MSG_ERROR(This c-client library does not support SSL. Recompile or remove --with-imap-ssl from configure line.)
- ])
- LIBS=$old_LIBS
- fi
-])
-
-
-PHP_ARG_WITH(imap,for IMAP support,
-[ --with-imap[=DIR] Include IMAP support. DIR is the IMAP include
- and c-client.a directory.])
-
-if test "$PHP_IMAP" != "no"; then
-
- PHP_SUBST(IMAP_SHARED_LIBADD)
- PHP_EXTENSION(imap, $ext_shared)
- AC_DEFINE(HAVE_IMAP,1,[ ])
-
- for i in /usr/local /usr $PHP_IMAP; do
- IMAP_INC_CHK()
- el[]IMAP_INC_CHK(/include/c-client)
- el[]IMAP_INC_CHK(/include/imap)
- el[]IMAP_INC_CHK(/include)
- el[]IMAP_INC_CHK(/imap)
- el[]IMAP_INC_CHK(/c-client)
- fi
- done
-
- AC_CHECK_LIB(pam, pam_start)
-
- PHP_EXPAND_PATH($IMAP_DIR, IMAP_DIR)
-
- if test -z "$IMAP_DIR"; then
- AC_MSG_ERROR(Cannot find rfc822.h. Please check your IMAP installation.)
- fi
-
- if test -r "$IMAP_DIR/c-client/c-client.a"; then
- ln -s "$IMAP_DIR/c-client/c-client.a" "$IMAP_DIR/c-client/libc-client.a" >/dev/null 2>&1
- elif test -r "$IMAP_DIR/lib/c-client.a"; then
- ln -s "$IMAP_DIR/lib/c-client.a" "$IMAP_DIR/lib/libc-client.a" >/dev/null 2>&1
- fi
-
- for lib in imap c-client4 c-client; do
- IMAP_LIB=$lib
- IMAP_LIB_CHK(lib)
- IMAP_LIB_CHK(c-client)
- done
-
- if test -z "$IMAP_LIBDIR"; then
- AC_MSG_ERROR(Cannot find imap library. Please check your IMAP installation.)
- fi
-
- PHP_ADD_INCLUDE($IMAP_INC_DIR)
- PHP_ADD_LIBPATH($IMAP_LIBDIR, IMAP_SHARED_LIBADD)
- PHP_ADD_LIBRARY_DEFER($IMAP_LIB)
- PHP_IMAP_KRB_CHK
- PHP_IMAP_SSL_CHK
-fi
diff --git a/ext/imap/imap.dsp b/ext/imap/imap.dsp
deleted file mode 100644
index a06a50e7e6..0000000000
--- a/ext/imap/imap.dsp
+++ /dev/null
@@ -1,167 +0,0 @@
-# Microsoft Developer Studio Project File - Name="imap" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=imap - Win32 Debug_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "imap.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "imap.mak" CFG="imap - Win32 Debug_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "imap - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "imap - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "imap - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "imap - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "imap - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "IMAP_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\..\php_build\IMAP\c-client" /I "..\..\TSRM" /D "NDEBUG" /D "IMAP_EXPORTS" /D "COMPILE_DL_IMAP" /D HAVE_IMAP=1 /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZEND_WIN32" /D "PHP_WIN32" /D ZEND_DEBUG=0 /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "NDEBUG"
-# ADD RSC /l 0x40d /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4nts.lib wsock32.lib winmm.lib cclient.lib /nologo /dll /machine:I386 /out:"Release/php_imap.dll" /libpath:"..\..\Release" /libpath:"..\..\..\php_build\IMAP\C-Client"
-
-!ELSEIF "$(CFG)" == "imap - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "IMAP_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\..\php_build\IMAP\c-client" /I "..\..\TSRM" /D "_DEBUG" /D "IMAP_EXPORTS" /D "COMPILE_DL_IMAP" /D HAVE_IMAP=1 /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZEND_WIN32" /D "PHP_WIN32" /D ZEND_DEBUG=1 /FR /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "_DEBUG"
-# ADD RSC /l 0x40d /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4nts_debug.lib wsock32.lib winmm.lib cclient.lib /nologo /dll /debug /machine:I386 /out:"Debug/php_imap.dll" /pdbtype:sept /libpath:"..\..\Debug" /libpath:"..\..\..\php_build\IMAP\C-Client"
-
-!ELSEIF "$(CFG)" == "imap - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "IMAP_EXPORTS" /FR /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\..\\" /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\..\php_build\IMAP\c-client" /I "..\..\TSRM" /D "ZTS" /D "_DEBUG" /D "IMAP_EXPORTS" /D "COMPILE_DL_IMAP" /D HAVE_IMAP=1 /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZEND_WIN32" /D "PHP_WIN32" /D ZEND_DEBUG=1 /FR /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "_DEBUG"
-# ADD RSC /l 0x40d /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts_debug.lib wsock32.lib winmm.lib cclient.lib /nologo /dll /debug /machine:I386 /out:"..\..\Debug_TS/php_imap.dll" /pdbtype:sept /libpath:"..\..\..\\" /libpath:"..\..\Debug_TS" /libpath:"..\..\..\php_build\IMAP\C-Client"
-
-!ELSEIF "$(CFG)" == "imap - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "IMAP_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\\" /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\..\php_build\IMAP\c-client" /I "..\..\TSRM" /D "ZTS" /D "NDEBUG" /D "IMAP_EXPORTS" /D "COMPILE_DL_IMAP" /D HAVE_IMAP=1 /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZEND_WIN32" /D "PHP_WIN32" /D ZEND_DEBUG=0 /FR /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "NDEBUG"
-# ADD RSC /l 0x40d /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib wsock32.lib winmm.lib cclient.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_imap.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline" /libpath:"..\..\..\php_build\IMAP\C-Client"
-
-!ENDIF
-
-# Begin Target
-
-# Name "imap - Win32 Release"
-# Name "imap - Win32 Debug"
-# Name "imap - Win32 Debug_TS"
-# Name "imap - Win32 Release_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\php_imap.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_imap.h
-# End Source File
-# End Group
-# Begin Source File
-
-SOURCE=.\IMAP_Win32_HOWTO.txt
-# End Source File
-# End Target
-# End Project
diff --git a/ext/imap/imap.h b/ext/imap/imap.h
deleted file mode 100644
index 914d128316..0000000000
--- a/ext/imap/imap.h
+++ /dev/null
@@ -1,103 +0,0 @@
-#ifndef _INCLUDED_IMAP_H
-#define _INCLUDED_IMAP_H
-
-#if COMPILE_DL
-#undef HAVE_IMAP
-#define HAVE_IMAP 1
-#endif
-
-#if HAVE_IMAP
-
-#ifndef PHP_WIN32
-#include "build-defs.h"
-#endif
-
-/* Functions accessable to PHP */
-extern zend_module_entry imap_module_entry;
-#define imap_module_ptr &imap_module_entry
-
-extern PHP_MINIT_FUNCTION(imap);
-extern PHP_RINIT_FUNCTION(imap);
-extern PHP_RSHUTDOWN_FUNCTION(imap);
-PHP_MINFO_FUNCTION(imap);
-PHP_FUNCTION(imap_open);
-PHP_FUNCTION(imap_popen);
-PHP_FUNCTION(imap_reopen);
-PHP_FUNCTION(imap_num_msg);
-PHP_FUNCTION(imap_num_recent);
-PHP_FUNCTION(imap_headers);
-PHP_FUNCTION(imap_headerinfo);
-PHP_FUNCTION(imap_rfc822_parse_headers);
-PHP_FUNCTION(imap_body);
-PHP_FUNCTION(imap_fetchstructure);
-PHP_FUNCTION(imap_fetchbody);
-PHP_FUNCTION(imap_expunge);
-PHP_FUNCTION(imap_delete);
-PHP_FUNCTION(imap_undelete);
-PHP_FUNCTION(imap_check);
-PHP_FUNCTION(imap_close);
-PHP_FUNCTION(imap_mail_copy);
-PHP_FUNCTION(imap_mail_move);
-PHP_FUNCTION(imap_createmailbox);
-PHP_FUNCTION(imap_renamemailbox);
-PHP_FUNCTION(imap_deletemailbox);
-PHP_FUNCTION(imap_listmailbox);
-PHP_FUNCTION(imap_scanmailbox);
-PHP_FUNCTION(imap_subscribe);
-PHP_FUNCTION(imap_unsubscribe);
-PHP_FUNCTION(imap_append);
-PHP_FUNCTION(imap_ping);
-PHP_FUNCTION(imap_base64);
-PHP_FUNCTION(imap_qprint);
-PHP_FUNCTION(imap_8bit);
-PHP_FUNCTION(imap_binary);
-PHP_FUNCTION(imap_mailboxmsginfo);
-PHP_FUNCTION(imap_rfc822_write_address);
-PHP_FUNCTION(imap_rfc822_parse_adrlist);
-PHP_FUNCTION(imap_setflag_full);
-PHP_FUNCTION(imap_clearflag_full);
-PHP_FUNCTION(imap_sort);
-PHP_FUNCTION(imap_fetchheader);
-PHP_FUNCTION(imap_fetchtext);
-PHP_FUNCTION(imap_uid);
-PHP_FUNCTION(imap_msgno);
-PHP_FUNCTION(imap_list);
-PHP_FUNCTION(imap_list_full);
-PHP_FUNCTION(imap_listscan);
-PHP_FUNCTION(imap_lsub);
-PHP_FUNCTION(imap_lsub_full);
-PHP_FUNCTION(imap_create);
-PHP_FUNCTION(imap_rename);
-PHP_FUNCTION(imap_status);
-PHP_FUNCTION(imap_bodystruct);
-PHP_FUNCTION(imap_fetch_overview);
-PHP_FUNCTION(imap_mail_compose);
-PHP_FUNCTION(imap_alerts);
-PHP_FUNCTION(imap_errors);
-PHP_FUNCTION(imap_last_error);
-PHP_FUNCTION(imap_mail);
-PHP_FUNCTION(imap_search);
-PHP_FUNCTION(imap_utf8);
-PHP_FUNCTION(imap_utf7_decode);
-PHP_FUNCTION(imap_utf7_encode);
-PHP_FUNCTION(imap_mime_header_decode);
-#else
-#define imap_module_ptr NULL
-#endif /* HAVE_IMAP */
-
-#endif
-
-
-
-
-
-
-#define phpext_imap_ptr imap_module_ptr
-
-
-
-
-
-
-
-
diff --git a/ext/imap/php_imap.c b/ext/imap/php_imap.c
deleted file mode 100644
index b37e6fd747..0000000000
--- a/ext/imap/php_imap.c
+++ /dev/null
@@ -1,4432 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Rex Logan <veebert@dimensional.com> |
- | Mark Musone <musone@afterfive.com> |
- | Brian Wang <brian@vividnet.com> |
- | Kaj-Michael Lang <milang@tal.org> |
- | Antoni Pamies Olive <toni@readysoft.net> |
- | Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
- | Chuck Hagenbuch <chuck@horde.org> |
- | Andrew Skalski <askalski@chekinc.com> |
- | Hartmut Holzgraefe <hartmut@six.de> |
- | Jani Taskinen <sniper@iki.fi> |
- | PHP 4.0 updates: Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
- */
-/* $Id$ */
-
-#define IMAP41
-
-#undef OP_RELOGIN
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "php_ini.h"
-#include "ext/standard/php_string.h"
-#include "ext/standard/info.h"
-
-#ifdef ERROR
-#undef ERROR
-#endif
-#include "php_imap.h"
-
-ZEND_DECLARE_MODULE_GLOBALS(imap)
-
-#include <time.h>
-#include <stdio.h>
-#include <ctype.h>
-#include <signal.h>
-#ifdef PHP_WIN32
-#include "winsock.h"
-MAILSTREAM DEFAULTPROTO;
-#endif
-
-#define CRLF "\015\012"
-#define PHP_EXPUNGE 32768
-
-static void _php_make_header_object(zval *myzvalue, ENVELOPE *en);
-static void _php_imap_add_body(zval *arg, BODY *body);
-static void _php_imap_parse_address(ADDRESS *addresslist, char *fulladdress, zval *paddress);
-
-
-/* These function declarations are missing from the IMAP header files... */
-void rfc822_date(char *date);
-char *cpystr(const char *str);
-char *cpytxt(SIZEDTEXT *dst, char *text, unsigned long size);
-long utf8_mime2text(SIZEDTEXT *src, SIZEDTEXT *dst);
-unsigned long find_rightmost_bit(unsigned long *valptr);
-void fs_give(void **block);
-void *fs_get(size_t size);
-int imap_mail(char *to, char *subject, char *message, char *headers, char *cc, char *bcc, char *rpath);
-
-
-void mail_close_it (zend_rsrc_list_entry *rsrc);
-#ifdef OP_RELOGIN
-/* AJS: close persistent connection */
-void mail_userlogout_it(zend_rsrc_list_entry *rsrc);
-void mail_nuke_chain(zend_rsrc_list_entry *rsrc);
-#endif
-
-/* {{{ imap_functions[]
- */
-function_entry imap_functions[] = {
- PHP_FE(imap_open, NULL)
- PHP_FE(imap_popen, NULL)
- PHP_FE(imap_reopen, NULL)
- PHP_FE(imap_num_msg, NULL)
- PHP_FE(imap_num_recent, NULL)
- PHP_FE(imap_headers, NULL)
- PHP_FALIAS(imap_header, imap_headerinfo, NULL)
- PHP_FE(imap_headerinfo, NULL)
- PHP_FE(imap_rfc822_parse_headers, NULL)
- PHP_FE(imap_body, NULL)
- PHP_FE(imap_fetchstructure, NULL)
- PHP_FE(imap_fetchbody, NULL)
- PHP_FE(imap_expunge, NULL)
- PHP_FE(imap_delete, NULL)
- PHP_FE(imap_undelete, NULL)
- PHP_FE(imap_check, NULL)
- PHP_FE(imap_close, NULL)
- PHP_FE(imap_mail_copy, NULL)
- PHP_FE(imap_mail_move, NULL)
- PHP_FE(imap_createmailbox, NULL)
- PHP_FE(imap_renamemailbox, NULL)
- PHP_FE(imap_deletemailbox, NULL)
-#ifdef HAVE_IMAP2000
- PHP_FE(imap_get_quota, NULL)
- PHP_FE(imap_set_quota, NULL)
-#endif
- PHP_FALIAS(imap_listmailbox, imap_list, NULL)
- PHP_FALIAS(imap_getmailboxes, imap_list_full, NULL)
- PHP_FALIAS(imap_scanmailbox, imap_listscan, NULL)
- PHP_FALIAS(imap_listsubscribed, imap_lsub, NULL)
- PHP_FALIAS(imap_getsubscribed, imap_lsub_full, NULL)
- PHP_FE(imap_subscribe, NULL)
- PHP_FE(imap_unsubscribe, NULL)
- PHP_FE(imap_append, NULL)
- PHP_FE(imap_ping, NULL)
- PHP_FE(imap_base64, NULL)
- PHP_FE(imap_qprint, NULL)
- PHP_FE(imap_8bit, NULL)
- PHP_FE(imap_binary, NULL)
- PHP_FE(imap_mailboxmsginfo, NULL)
- PHP_FE(imap_rfc822_write_address, NULL)
- PHP_FE(imap_rfc822_parse_adrlist, NULL)
- PHP_FE(imap_setflag_full, NULL)
- PHP_FE(imap_clearflag_full, NULL)
- PHP_FE(imap_sort, NULL)
- PHP_FE(imap_fetchheader, NULL)
- PHP_FALIAS(imap_fetchtext, imap_body, NULL)
- PHP_FE(imap_uid, NULL)
- PHP_FE(imap_msgno, NULL)
- PHP_FE(imap_list, NULL)
- PHP_FALIAS(imap_scan, imap_listscan, NULL)
- PHP_FE(imap_lsub, NULL)
- PHP_FALIAS(imap_create, imap_createmailbox, NULL)
- PHP_FALIAS(imap_rename, imap_renamemailbox, NULL)
- PHP_FE(imap_status, NULL)
- PHP_FE(imap_bodystruct, NULL)
- PHP_FE(imap_fetch_overview, NULL)
- PHP_FE(imap_mail_compose, NULL)
- PHP_FE(imap_alerts, NULL)
- PHP_FE(imap_errors, NULL)
- PHP_FE(imap_last_error, NULL)
-#ifndef PHP_WIN32
- PHP_FE(imap_mail, NULL)
-#else
- PHP_FALIAS(imap_mail, warn_not_available, NULL)
-#endif
- PHP_FE(imap_search, NULL)
- PHP_FE(imap_utf7_decode, NULL)
- PHP_FE(imap_utf7_encode, NULL)
- PHP_FE(imap_utf8, NULL)
- PHP_FE(imap_mime_header_decode, NULL)
- PHP_FE(imap_thread, NULL)
- {NULL, NULL, NULL}
-};
-/* }}} */
-
-#ifdef OP_RELOGIN
-#define IS_STREAM(ind_type) ((ind_type)==le_imap || (ind_type)==le_pimap)
-#else
-#define IS_STREAM(ind_type) ((ind_type)==le_imap)
-#endif
-
-
-zend_module_entry imap_module_entry = {
- "imap", imap_functions, PHP_MINIT(imap), NULL, PHP_RINIT(imap), PHP_RSHUTDOWN(imap), PHP_MINFO(imap), STANDARD_MODULE_PROPERTIES
-};
-
-
-#ifdef COMPILE_DL_IMAP
-ZEND_GET_MODULE(imap)
-#endif
-
-
-static int le_imap;
-#ifdef OP_RELOGIN
-/* AJS: persistent connection type, chain pointer type */
-static int le_pimap;
-static int le_pimapchain;
-#endif
-
-
-void mail_close_it(zend_rsrc_list_entry *rsrc)
-{
- pils *imap_le_struct = (pils *)rsrc->ptr;
- IMAPLS_FETCH();
-
- mail_close_full(imap_le_struct->imap_stream, imap_le_struct->flags);
-
- if (IMAPG(imap_user)) {
- efree(IMAPG(imap_user));
- IMAPG(imap_user) = 0;
- }
- if (IMAPG(imap_password)) {
- efree(IMAPG(imap_password));
- IMAPG(imap_password) = 0;
- }
-
- efree(imap_le_struct);
-}
-
-#ifdef OP_RELOGIN
-/* AJS: stream close functions for persistent connections */
-void mail_userlogout_it(zend_rsrc_list_entry *rsrc)
-{
- pils *imap_le_struct = (pils *)rsrc->ptr;
- /* Close this user's session, putting the stream back
- * into AUTHENTICATE state. (Note that IMAP does not
- * support this behavior... yet)
- */
- imap_le_struct->busy = 0;
- mail_close_full(imap_le_struct->imap_stream, imap_le_struct->flags | CL_HALF);
-}
-
-void mail_nuke_chain(zend_rsrc_list_entry *rsrc)
-{
- pils **headp = (pils **)rsrc->ptr;
- pils *node, *next;
-
- for (node = *headp; node; node = next) {
- next = node->next;
- mail_close(node->imap_stream);
- free(node);
- }
-
- free(headp);
-}
-#endif
-
-static int add_assoc_object(zval *arg, char *key, zval *tmp)
-{
- HashTable *symtable;
-
- if (arg->type == IS_OBJECT) {
- symtable = arg->value.obj.properties;
- } else {
- symtable = arg->value.ht;
- }
- return zend_hash_update(symtable, key, strlen(key)+1, (void *) &tmp, sizeof(zval *), NULL);
-}
-
-/* Mail instantiate FOBJECTLIST
- * Returns: new FOBJECTLIST list
- * Author: CJH
- */
-FOBJECTLIST *mail_newfolderobjectlist(void)
-{
- return (FOBJECTLIST *) memset(fs_get(sizeof(FOBJECTLIST)),0,
- sizeof(FOBJECTLIST));
-}
-
-
-/* Mail garbage collect FOBJECTLIST
- * Accepts: pointer to FOBJECTLIST pointer
- * Author: CJH
- */
-void mail_free_foblist(FOBJECTLIST **foblist)
-{
- if (*foblist) { /* only free if exists */
- if ((*foblist)->text.data) {
- fs_give ((void **) &(*foblist)->text.data);
- }
- mail_free_foblist (&(*foblist)->next);
- fs_give ((void **) foblist); /* return string to free storage */
- }
-}
-
-
-/* Mail instantiate ERRORLIST
- * Returns: new ERRORLIST list
- * Author: CJH
- */
-ERRORLIST *mail_newerrorlist(void)
-{
- return (ERRORLIST *) memset(fs_get(sizeof(ERRORLIST)), 0, sizeof(ERRORLIST));
-}
-
-/* Mail garbage collect FOBJECTLIST
- * Accepts: pointer to FOBJECTLIST pointer
- * Author: CJH
- */
-void mail_free_errorlist(ERRORLIST **errlist)
-{
- if (*errlist) { /* only free if exists */
- if ((*errlist)->text.data) {
- fs_give((void **) &(*errlist)->text.data);
- }
- mail_free_errorlist (&(*errlist)->next);
- fs_give((void **) errlist); /* return string to free storage */
- }
-}
-
-
-/* Author: CJH */
-PHP_RINIT_FUNCTION(imap)
-{
- IMAPLS_FETCH();
-
- IMAPG(imap_errorstack) = NIL;
- IMAPG(imap_alertstack) = NIL;
- return SUCCESS;
-}
-
-/* Author: CJH */
-PHP_RSHUTDOWN_FUNCTION(imap)
-{
- ERRORLIST *ecur = NIL;
- STRINGLIST *acur = NIL;
- IMAPLS_FETCH();
-
- if (IMAPG(imap_errorstack) != NIL) {
- /* output any remaining errors at their original error level */
- ecur = IMAPG(imap_errorstack);
- while (ecur != NIL) {
- php_error(E_NOTICE, "%s (errflg=%d)", ecur->LTEXT, ecur->errflg);
- ecur = ecur->next;
- }
- mail_free_errorlist(&IMAPG(imap_errorstack));
- }
-
- if (IMAPG(imap_alertstack) != NIL) {
- /* output any remaining alerts at E_NOTICE level */
- acur = IMAPG(imap_alertstack);
- while (acur != NIL) {
- php_error(E_NOTICE, acur->LTEXT);
- acur = acur->next;
- }
- mail_free_stringlist(&IMAPG(imap_alertstack));
- }
- return SUCCESS;
-}
-
-
-inline int add_next_index_object(zval *arg, zval *tmp)
-{
- HashTable *symtable;
-
- if (arg->type == IS_OBJECT) {
- symtable = arg->value.obj.properties;
- } else {
- symtable = arg->value.ht;
- }
-
- return zend_hash_next_index_insert(symtable, (void *) &tmp, sizeof(zval *), NULL);
-}
-
-
-/* Mail instantiate MESSAGELIST
- * Returns: new MESSAGELIST list
- * Author: CJH
- */
-MESSAGELIST *mail_newmessagelist(void)
-{
- return (MESSAGELIST *) memset(fs_get(sizeof(MESSAGELIST)),0,
- sizeof(MESSAGELIST));
-}
-
-#ifdef HAVE_IMAP2000
-/* Mail GET_QUOTA callback
- * Called via the mail_parameter function in c-client:src/c-client/mail.c
- * Author DRK
- */
-void mail_getquota(MAILSTREAM *stream, char *qroot,QUOTALIST *qlist)
-{
- IMAPLS_FETCH();
-
- /* this should only be run through once */
- for (; qlist; qlist = qlist->next)
- {
- IMAPG(quota_usage) = qlist->usage;
- IMAPG(quota_limit) = qlist->limit;
- }
-}
-#endif
-
-/* Mail garbage collect MESSAGELIST
- * Accepts: pointer to MESSAGELIST pointer
- * Author: CJH
- */
-void mail_free_messagelist(MESSAGELIST **msglist)
-{
- if (*msglist) { /* only free if exists */
- mail_free_messagelist (&(*msglist)->next);
- fs_give ((void **) msglist); /* return string to free storage */
- }
-}
-
-/* {{{ PHP_MINFO_FUNCTION
- */
-PHP_MINFO_FUNCTION(imap)
-{
- php_info_print_table_start();
- php_info_print_table_header(2, "IMAP Support", "enabled" );
-#if HAVE_IMAP2000
- php_info_print_table_row(2, "IMAP c-Client Version", "2000");
-#elif defined(IMAP41)
- php_info_print_table_row(2, "IMAP c-Client Version", "4.1");
-#else
- php_info_print_table_row(2, "IMAP c-Client Version", "4.0");
-#endif
-#if HAVE_IMAP_SSL
- php_info_print_table_row(2, "SSL Support", "enabled");
-#endif
-#if HAVE_IMAP_KRB
- php_info_print_table_row(2, "Kerberos Support", "enabled");
-#endif
- php_info_print_table_end();
-}
-/* }}} */
-
-static void php_imap_init_globals(zend_imap_globals *imap_globals)
-{
- imap_globals->imap_user=NIL;
- imap_globals->imap_password=NIL;
- imap_globals->imap_folders=NIL;
- imap_globals->imap_sfolders=NIL;
- imap_globals->imap_alertstack=NIL;
- imap_globals->imap_errorstack=NIL;
- imap_globals->imap_messages=NIL;
- imap_globals->imap_folder_objects=NIL;
- imap_globals->imap_sfolder_objects=NIL;
- imap_globals->folderlist_style = FLIST_ARRAY;
-}
-
-/* {{{ PHP_MINIT_FUNCTION
- */
-PHP_MINIT_FUNCTION(imap)
-{
- unsigned long sa_all = SA_MESSAGES | SA_RECENT | SA_UNSEEN |
- SA_UIDNEXT | SA_UIDVALIDITY;
-
- ZEND_INIT_MODULE_GLOBALS(imap, php_imap_init_globals, NULL)
-
-
-#if 1
-#ifndef PHP_WIN32
- mail_link(&unixdriver); /* link in the unix driver */
-#endif
- mail_link(&imapdriver); /* link in the imap driver */
- mail_link(&nntpdriver); /* link in the nntp driver */
- mail_link(&pop3driver); /* link in the pop3 driver */
-#ifndef PHP_WIN32
- mail_link(&mhdriver); /* link in the mh driver */
- mail_link(&mxdriver); /* link in the mx driver */
-#endif
- mail_link(&mbxdriver); /* link in the mbx driver */
- mail_link(&tenexdriver); /* link in the tenex driver */
- mail_link(&mtxdriver); /* link in the mtx driver */
-#ifndef PHP_WIN32
- mail_link(&mmdfdriver); /* link in the mmdf driver */
- mail_link(&newsdriver); /* link in the news driver */
- mail_link(&philedriver); /* link in the phile driver */
- auth_link(&auth_log); /* link in the log authenticator */
- auth_link(&auth_md5); /* link in the cram-md5 authenticator */
-#ifdef HAVE_IMAP_SSL
- ssl_onceonlyinit ();
-#endif
-#endif
- mail_link(&dummydriver); /* link in the dummy driver */
-#else
- /* link in the c-client mail and auth drivers */
-#include "linkage.c"
-#endif
-
- /* lets allow NIL */
-
- REGISTER_MAIN_LONG_CONSTANT("NIL", NIL, CONST_PERSISTENT | CONST_CS);
-
-
- /* Open Options */
-
- REGISTER_MAIN_LONG_CONSTANT("OP_DEBUG", OP_DEBUG, CONST_PERSISTENT | CONST_CS);
- /* debug protocol negotiations */
-
- REGISTER_MAIN_LONG_CONSTANT("OP_READONLY", OP_READONLY, CONST_PERSISTENT | CONST_CS);
- /* read-only open */
-
- REGISTER_MAIN_LONG_CONSTANT("OP_ANONYMOUS", OP_ANONYMOUS, CONST_PERSISTENT | CONST_CS);
- /* anonymous open of newsgroup */
-
- REGISTER_MAIN_LONG_CONSTANT("OP_SHORTCACHE", OP_SHORTCACHE, CONST_PERSISTENT | CONST_CS);
-
- /* short (elt-only) caching */
-
- REGISTER_MAIN_LONG_CONSTANT("OP_SILENT", OP_SILENT, CONST_PERSISTENT | CONST_CS);
- /* don't pass up events (internal use) */
- REGISTER_MAIN_LONG_CONSTANT("OP_PROTOTYPE", OP_PROTOTYPE, CONST_PERSISTENT | CONST_CS);
- /* return driver prototype */
- REGISTER_MAIN_LONG_CONSTANT("OP_HALFOPEN", OP_HALFOPEN, CONST_PERSISTENT | CONST_CS);
- /* half-open (IMAP connect but no select) */
-
- REGISTER_MAIN_LONG_CONSTANT("OP_EXPUNGE", OP_EXPUNGE, CONST_PERSISTENT | CONST_CS);
- /* silently expunge recycle stream */
-
- REGISTER_MAIN_LONG_CONSTANT("OP_SECURE", OP_SECURE, CONST_PERSISTENT | CONST_CS);
- /* don't do non-secure authentication */
-
- /*
- PHP re-assigns CL_EXPUNGE a custom value that can be used as part of the imap_open() bitfield
- because it seems like a good idea to be able to indicate that the mailbox should be
- automatically expunged during imap_open in case the script get interrupted and it doesn't get
- to the imap_close() where this option is normally placed. If the c-client library adds other
- options and the value for this one conflicts, simply make PHP_EXPUNGE higher at the top of
- this file
- */
- REGISTER_MAIN_LONG_CONSTANT("CL_EXPUNGE", PHP_EXPUNGE, CONST_PERSISTENT | CONST_CS);
- /* expunge silently */
-
-
- /* Fetch options */
-
- REGISTER_MAIN_LONG_CONSTANT("FT_UID", FT_UID, CONST_PERSISTENT | CONST_CS);
- /* argument is a UID */
- REGISTER_MAIN_LONG_CONSTANT("FT_PEEK", FT_PEEK, CONST_PERSISTENT | CONST_CS);
- /* peek at data */
- REGISTER_MAIN_LONG_CONSTANT("FT_NOT", FT_NOT, CONST_PERSISTENT | CONST_CS);
- /* NOT flag for header lines fetch */
- REGISTER_MAIN_LONG_CONSTANT("FT_INTERNAL", FT_INTERNAL, CONST_PERSISTENT | CONST_CS);
- /* text can be internal strings */
- REGISTER_MAIN_LONG_CONSTANT("FT_PREFETCHTEXT", FT_PREFETCHTEXT, CONST_PERSISTENT | CONST_CS);
- /* IMAP prefetch text when fetching header */
-
-
- /* Flagging options */
-
- REGISTER_MAIN_LONG_CONSTANT("ST_UID", ST_UID, CONST_PERSISTENT | CONST_CS);
- /* argument is a UID sequence */
- REGISTER_MAIN_LONG_CONSTANT("ST_SILENT", ST_SILENT, CONST_PERSISTENT | CONST_CS);
- /* don't return results */
- REGISTER_MAIN_LONG_CONSTANT("ST_SET", ST_SET, CONST_PERSISTENT | CONST_CS);
- /* set vs. clear */
-
- /* Copy options */
-
- REGISTER_MAIN_LONG_CONSTANT("CP_UID", CP_UID, CONST_PERSISTENT | CONST_CS);
- /* argument is a UID sequence */
- REGISTER_MAIN_LONG_CONSTANT("CP_MOVE", CP_MOVE, CONST_PERSISTENT | CONST_CS);
- /* delete from source after copying */
-
-
- /* Search/sort options */
-
- REGISTER_MAIN_LONG_CONSTANT("SE_UID", SE_UID, CONST_PERSISTENT | CONST_CS);
- /* return UID */
- REGISTER_MAIN_LONG_CONSTANT("SE_FREE", SE_FREE, CONST_PERSISTENT | CONST_CS);
- /* free search program after finished */
- REGISTER_MAIN_LONG_CONSTANT("SE_NOPREFETCH", SE_NOPREFETCH, CONST_PERSISTENT | CONST_CS);
- /* no search prefetching */
- REGISTER_MAIN_LONG_CONSTANT("SO_FREE", SO_FREE, CONST_PERSISTENT | CONST_CS);
- /* free sort program after finished */
- REGISTER_MAIN_LONG_CONSTANT("SO_NOSERVER", SO_NOSERVER, CONST_PERSISTENT | CONST_CS);
- /* don't do server-based sort */
-
- /* Status options */
-
- REGISTER_MAIN_LONG_CONSTANT("SA_MESSAGES",SA_MESSAGES , CONST_PERSISTENT | CONST_CS);
- /* number of messages */
- REGISTER_MAIN_LONG_CONSTANT("SA_RECENT", SA_RECENT, CONST_PERSISTENT | CONST_CS);
- /* number of recent messages */
- REGISTER_MAIN_LONG_CONSTANT("SA_UNSEEN",SA_UNSEEN , CONST_PERSISTENT | CONST_CS);
- /* number of unseen messages */
- REGISTER_MAIN_LONG_CONSTANT("SA_UIDNEXT", SA_UIDNEXT, CONST_PERSISTENT | CONST_CS);
- /* next UID to be assigned */
- REGISTER_MAIN_LONG_CONSTANT("SA_UIDVALIDITY",SA_UIDVALIDITY , CONST_PERSISTENT | CONST_CS);
- /* UID validity value */
- REGISTER_MAIN_LONG_CONSTANT("SA_ALL", sa_all, CONST_PERSISTENT | CONST_CS);
- /* get all status information */
-
-
-
- /* Bits for mm_list() and mm_lsub() */
-
- REGISTER_MAIN_LONG_CONSTANT("LATT_NOINFERIORS",LATT_NOINFERIORS , CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_LONG_CONSTANT("LATT_NOSELECT", LATT_NOSELECT, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_LONG_CONSTANT("LATT_MARKED", LATT_MARKED, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_LONG_CONSTANT("LATT_UNMARKED",LATT_UNMARKED , CONST_PERSISTENT | CONST_CS);
-
-
- /* Sort functions */
-
- REGISTER_MAIN_LONG_CONSTANT("SORTDATE",SORTDATE , CONST_PERSISTENT | CONST_CS);
- /* date */
- REGISTER_MAIN_LONG_CONSTANT("SORTARRIVAL",SORTARRIVAL , CONST_PERSISTENT | CONST_CS);
- /* arrival date */
- REGISTER_MAIN_LONG_CONSTANT("SORTFROM",SORTFROM , CONST_PERSISTENT | CONST_CS);
- /* from */
- REGISTER_MAIN_LONG_CONSTANT("SORTSUBJECT",SORTSUBJECT , CONST_PERSISTENT | CONST_CS);
- /* subject */
- REGISTER_MAIN_LONG_CONSTANT("SORTTO",SORTTO , CONST_PERSISTENT | CONST_CS);
- /* to */
- REGISTER_MAIN_LONG_CONSTANT("SORTCC",SORTCC , CONST_PERSISTENT | CONST_CS);
- /* cc */
- REGISTER_MAIN_LONG_CONSTANT("SORTSIZE",SORTSIZE , CONST_PERSISTENT | CONST_CS);
- /* size */
-
- REGISTER_MAIN_LONG_CONSTANT("TYPETEXT",TYPETEXT , CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_LONG_CONSTANT("TYPEMULTIPART",TYPEMULTIPART , CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_LONG_CONSTANT("TYPEMESSAGE",TYPEMESSAGE , CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_LONG_CONSTANT("TYPEAPPLICATION",TYPEAPPLICATION , CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_LONG_CONSTANT("TYPEAUDIO",TYPEAUDIO , CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_LONG_CONSTANT("TYPEIMAGE",TYPEIMAGE , CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_LONG_CONSTANT("TYPEVIDEO",TYPEVIDEO , CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_LONG_CONSTANT("TYPEOTHER",TYPEOTHER , CONST_PERSISTENT | CONST_CS);
- /* TYPETEXT unformatted text
- TYPEMULTIPART multiple part
- TYPEMESSAGE encapsulated message
- TYPEAPPLICATION application data
- TYPEAUDIO audio
- TYPEIMAGE static image (GIF, JPEG, etc.)
- TYPEVIDEO video
- TYPEOTHER unknown
- */
- REGISTER_MAIN_LONG_CONSTANT("ENC7BIT",ENC7BIT , CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_LONG_CONSTANT("ENC8BIT",ENC8BIT , CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_LONG_CONSTANT("ENCBINARY",ENCBINARY , CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_LONG_CONSTANT("ENCBASE64",ENCBASE64, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_LONG_CONSTANT("ENCQUOTEDPRINTABLE",ENCQUOTEDPRINTABLE , CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_LONG_CONSTANT("ENCOTHER",ENCOTHER , CONST_PERSISTENT | CONST_CS);
- /*
- ENC7BIT 7 bit SMTP semantic data
- ENC8BIT 8 bit SMTP semantic data
- ENCBINARY 8 bit binary data
- ENCBASE64 base-64 encoded data
- ENCQUOTEDPRINTABLE human-readable 8-as-7 bit data
- ENCOTHER unknown
- */
-
- le_imap = zend_register_list_destructors_ex(mail_close_it, NULL, "imap", module_number);
-#ifdef OP_RELOGIN
- /* AJS: destructors for persistent connections */
- le_pimap = zend_register_list_destructors_ex(mail_userlogout_it, NULL, "imap persistent", module_number);
- le_pimapchain = zend_register_list_destructors_ex(NULL, mail_nuke_chain, "imap chain persistent", module_number);
-#endif
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ imap_do_open
- */
-void imap_do_open(INTERNAL_FUNCTION_PARAMETERS, int persistent)
-{
- zval **mailbox, **user, **passwd, **options;
- MAILSTREAM *imap_stream;
- pils *imap_le_struct;
- long flags=NIL;
- long cl_flags=NIL;
-#ifdef OP_RELOGIN
- NETMBX netmbx;
- char *hashed_details = NULL;
- int hashed_details_length = 0;
-#endif
- int ind;
- int myargc=ZEND_NUM_ARGS();
- IMAPLS_FETCH();
-
- if (myargc <3 || myargc >4 || zend_get_parameters_ex(myargc, &mailbox, &user, &passwd, &options) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- convert_to_string_ex(mailbox);
- convert_to_string_ex(user);
- convert_to_string_ex(passwd);
- if (myargc ==4) {
- convert_to_long_ex(options);
- flags = Z_LVAL_PP(options);
- if (flags & PHP_EXPUNGE) {
- cl_flags = CL_EXPUNGE;
- flags ^= PHP_EXPUNGE;
- }
- }
-
- if (IMAPG(imap_user)) {
- efree(IMAPG(imap_user));
- }
-
- if (IMAPG(imap_password)) {
- efree(IMAPG(imap_password));
- }
-
- IMAPG(imap_user) = estrndup(Z_STRVAL_PP(user), Z_STRLEN_PP(user));
- IMAPG(imap_password) = estrndup(Z_STRVAL_PP(passwd), Z_STRLEN_PP(passwd));
-
-#ifdef OP_RELOGIN
- /* AJS: persistent connection handling */
- /* Cannot use a persistent connection if we cannot parse
- * out the server's hostname.
- */
- if (persistent
- && !mail_valid_net_parse(Z_STRVAL_PP(mailbox), &netmbx)) {
- persistent = 0;
- }
-
- imap_stream = NIL;
- if (persistent) {
- list_entry *le = NULL;
- list_entry new_le;
- pils **headp, *node;
- int need_update = 0;
-
- hashed_details_length = sizeof("imap_") + strlen(netmbx.host);
- hashed_details = (char*) emalloc(hashed_details_length);
- sprintf(hashed_details, "imap_%s", netmbx.host);
-
- /* Check for an existing connection. */
- if ( (zend_hash_find(&EG(persistent_list),
- hashed_details,
- hashed_details_length,
- (void*) &le) == FAILURE) ||
- (le->type != le_pimapchain))
- {
- le = NULL;
- }
-
- /* Re-use existing connection if available. */
- node = NULL;
- headp = NULL;
- if (le) {
- headp = (pils**) le->ptr;
-
- /* find a non-busy connection */
- for (node=*headp; node; node=node->next)
- if (!node->busy)
- break;
- }
-
- /* If we found a node, do a relogin. */
- if (node) {
- imap_stream = mail_open(node->imap_stream, Z_STRVAL_PP(mailbox), flags | OP_RELOGIN);
- if (imap_stream) {
- /* Ping the stream to see if it is
- * still good.
- */
- if (!mail_ping(imap_stream)) {
- mail_close(imap_stream);
- imap_stream = NIL;
- }
- }
- }
-
- /* Get a fresh stream if we don't have one yet. */
- if (imap_stream == NIL) {
- /* Open a new connection. */
- imap_stream = mail_open(NIL, Z_STRVAL_PP(mailbox), flags | OP_RELOGIN);
- }
-
- /* Do we have a stream yet? If not, bail. */
- if (imap_stream == NIL) {
- if (node) {
- /* unlink the node */
- if ((*node->prev = node->next))
- node->next->prev = node->prev;
- free(node);
- /* delete the hash entry if empty */
- if (*headp == NULL) {
- zend_hash_del(&EG(persistent_list), hashed_details, hashed_details_length);
- }
- }
- efree(hashed_details);
- efree(IMAPG(imap_user)); IMAPG(imap_user) = 0;
- efree(IMAPG(imap_password)); IMAPG(imap_password) = 0;
- RETURN_FALSE;
- }
-
- /* Allocate a new node if none. */
- if (node == NULL) {
- /* Alloc new hash entry. */
- node = malloc(sizeof(pils));
- if (node == NULL) {
- efree(hashed_details);
- efree(IMAPG(imap_user)); IMAPG(imap_user) = 0;
- efree(IMAPG(imap_password)); IMAPG(imap_password) = 0;
- RETURN_FALSE;
- }
-
- /* Allocate headp if it does not exist. */
- if (headp == NULL) {
- headp = calloc(1, sizeof(*headp));
- need_update = 1;
- }
-
- node->prev = headp;
- node->next = *headp;
- *headp = node;
- }
-
-
- /* Initialize the node. */
- node->busy = 1;
- node->imap_stream = imap_stream;
- node->flags = cl_flags;
-
- /* Update the hash. */
- new_le.type = le_pimapchain;
- new_le.ptr = headp;
- if (need_update
- && zend_hash_update(&EG(persistent_list), hashed_details,
- hashed_details_length, &new_le,
- sizeof(new_le), NULL) == FAILURE) {
- /* unlink and free the new node */
- if ((*node->prev = node->next)) {
- node->next->prev = node->prev;
- }
- mail_close(node->imap_stream);
- free(node);
-
- free(headp);
- efree(hashed_details);
- efree(IMAPG(imap_user)); IMAPG(imap_user) = 0;
- efree(IMAPG(imap_password)); IMAPG(imap_password) = 0;
- RETURN_FALSE;
- }
-
- efree(hashed_details);
-
- imap_le_struct = node;
- } else {
-#endif
- imap_stream = mail_open(NIL, Z_STRVAL_PP(mailbox), flags);
-
- if (imap_stream == NIL) {
- php_error(E_WARNING, "Couldn't open stream %s\n", (*mailbox)->value.str.val);
- efree(IMAPG(imap_user)); IMAPG(imap_user) = 0;
- efree(IMAPG(imap_password)); IMAPG(imap_password) = 0;
- RETURN_FALSE;
- }
-
- imap_le_struct = emalloc(sizeof(pils));
- imap_le_struct->imap_stream = imap_stream;
- imap_le_struct->flags = cl_flags;
-#ifdef OP_RELOGIN
- }
-
- if (persistent)
- ind = zend_list_insert(imap_le_struct, le_pimap);
- else
-#endif
- ind = zend_list_insert(imap_le_struct, le_imap);
-
- RETURN_LONG(ind);
-}
-/* }}} */
-
-/* {{{ proto int imap_open(string mailbox, string user, string password [, int options])
- Open an IMAP stream to a mailbox */
-PHP_FUNCTION(imap_open)
-{
- imap_do_open(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-/* }}} */
-
-/* {{{ proto int imap_popen(string mailbox, string user, string password [, int options])
- Open a persistant IMAP stream to a mailbox */
-PHP_FUNCTION(imap_popen)
-{
-#ifdef OP_RELOGIN
- imap_do_open(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
- RETURN_TRUE;
-#else
- php_error(E_WARNING, "Persistent IMAP connections are not yet supported.\n");
- RETURN_FALSE;
-#endif
-}
-/* }}} */
-
-/* {{{ proto int imap_reopen(int stream_id, string mailbox [, int options])
- Reopen an IMAP stream to a new mailbox */
-PHP_FUNCTION(imap_reopen)
-{
- zval **streamind;
- zval **mailbox;
- zval **options;
- MAILSTREAM *imap_stream;
- pils *imap_le_struct;
- int ind, ind_type;
- long flags=NIL;
- long cl_flags=NIL;
- int myargc=ZEND_NUM_ARGS();
-
- if (myargc<2 || myargc>3 || zend_get_parameters_ex(myargc, &streamind, &mailbox, &options) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- convert_to_long_ex(streamind);
- ind = Z_LVAL_PP(streamind);
- imap_le_struct = (pils *) zend_list_find(ind, &ind_type);
- if (!imap_le_struct || !IS_STREAM(ind_type)) {
- php_error(E_WARNING, "Unable to find stream pointer");
- RETURN_FALSE;
- }
-
- convert_to_string_ex(mailbox);
- if (myargc == 3) {
- convert_to_long_ex(options);
- flags = Z_LVAL_PP(options);
- if (flags & PHP_EXPUNGE) {
- cl_flags = CL_EXPUNGE;
- flags ^= PHP_EXPUNGE;
- }
- imap_le_struct->flags = cl_flags;
- }
- imap_stream = mail_open(imap_le_struct->imap_stream, (*mailbox)->value.str.val, flags);
- if (imap_stream == NIL) {
- php_error(E_WARNING, "Couldn't re-open stream\n");
- RETURN_FALSE;
- }
- imap_le_struct->imap_stream = imap_stream;
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int imap_append(int stream_id, string folder, string message [, string flags])
- Append a new message to a specified mailbox */
-PHP_FUNCTION(imap_append)
-{
- zval **streamind, **folder, **message, **flags;
- int ind, ind_type;
- pils *imap_le_struct;
- STRING st;
- int myargc=ZEND_NUM_ARGS();
-
- if (myargc < 3 || myargc > 4 || zend_get_parameters_ex(myargc, &streamind, &folder, &message, &flags) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- convert_to_long_ex(streamind);
- convert_to_string_ex(folder);
- convert_to_string_ex(message);
- if (myargc == 4) {
- convert_to_string_ex(flags);
- }
- ind = Z_LVAL_PP(streamind);
-
- imap_le_struct = (pils *) zend_list_find(ind, &ind_type);
-
- if (!imap_le_struct || !IS_STREAM(ind_type)) {
- php_error(E_WARNING, "Unable to find stream pointer");
- RETURN_FALSE;
- }
- INIT (&st, mail_string, (void *) (*message)->value.str.val, (*message)->value.str.len);
- if (mail_append_full(imap_le_struct->imap_stream, (*folder)->value.str.val, myargc==4?(*flags)->value.str.val:NIL, NIL, &st)) {
- RETURN_TRUE;
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto int imap_num_msg(int stream_id)
- Gives the number of messages in the current mailbox */
-PHP_FUNCTION(imap_num_msg)
-{
- zval **streamind;
- int ind, ind_type;
- pils *imap_le_struct;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &streamind) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- convert_to_long_ex(streamind);
-
- ind = Z_LVAL_PP(streamind);
-
- imap_le_struct = (pils *) zend_list_find(ind, &ind_type);
-
- if (!imap_le_struct || !IS_STREAM(ind_type)) {
- php_error(E_WARNING, "Unable to find stream pointer");
- RETURN_FALSE;
- }
-
- RETURN_LONG(imap_le_struct->imap_stream->nmsgs);
-}
-/* }}} */
-
-/* {{{ proto int imap_ping(int stream_id)
- Check if the IMAP stream is still active */
-PHP_FUNCTION(imap_ping)
-{
- zval **streamind;
- int ind, ind_type;
- pils *imap_le_struct;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &streamind) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- convert_to_long_ex(streamind);
- ind = Z_LVAL_PP(streamind);
-
- imap_le_struct = (pils *) zend_list_find(ind, &ind_type);
- if (!imap_le_struct || !IS_STREAM(ind_type)) {
- php_error(E_WARNING, "Unable to find stream pointer");
- RETURN_FALSE;
- }
- RETURN_LONG(mail_ping(imap_le_struct->imap_stream));
-}
-/* }}} */
-
-/* {{{ proto int imap_num_recent(int stream_id)
- Gives the number of recent messages in current mailbox */
-PHP_FUNCTION(imap_num_recent)
-{
- zval **streamind;
- int ind, ind_type;
- pils *imap_le_struct;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &streamind) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
- convert_to_long_ex(streamind);
- ind = Z_LVAL_PP(streamind);
- imap_le_struct = (pils *) zend_list_find(ind, &ind_type);
- if (!imap_le_struct || !IS_STREAM(ind_type)) {
- php_error(E_WARNING, "Unable to find stream pointer");
- RETURN_FALSE;
- }
- RETURN_LONG(imap_le_struct->imap_stream->recent);
-}
-/* }}} */
-
-#ifdef HAVE_IMAP2000
-/* {{{ proto array imap_get_quota(int stream_id, string qroot)
- Returns the quota set to the mailbox account qroot */
-PHP_FUNCTION(imap_get_quota)
-{
- zval **streamind, **qroot;
- int ind, ind_type;
- pils *imap_le_struct;
- IMAPLS_FETCH();
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &streamind, &qroot) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- convert_to_long_ex(streamind);
- convert_to_string_ex(qroot);
-
- ind = Z_LVAL_PP(streamind);
- imap_le_struct = (pils *) zend_list_find(ind, &ind_type);
- if (!imap_le_struct || !IS_STREAM(ind_type)) {
- php_error(E_WARNING, "Unable to find stream pointer");
- RETURN_FALSE;
- }
-
- /* set the callback for the GET_QUOTA function */
- mail_parameters(NIL, SET_QUOTA, (void *) mail_getquota);
- if(!imap_getquota(imap_le_struct->imap_stream, Z_STRVAL_PP(qroot))) {
- php_error(E_WARNING, "c-client imap_getquota failed");
- RETURN_FALSE;
- }
-
- /* MAKE_STD_ZVAL(quota_array); */
- /* if (array_init(quota_array) != SUCCESS) { */
- if (array_init(return_value) == FAILURE) {
- php_error(E_WARNING, "Unable to allocate array memory");
- RETURN_FALSE;
- }
-
- add_assoc_long(return_value, "usage", IMAPG(quota_usage));
- add_assoc_long(return_value, "limit", IMAPG(quota_limit));
-}
-/* }}} */
-
-/* {{{ proto int imap_set_quota(int stream_id, string qroot, int mailbox_size)
- Will set the quota for qroot mailbox */
-PHP_FUNCTION(imap_set_quota)
-{
- zval **streamind, **qroot, **mailbox_size;
- STRINGLIST limits;
- int ind, ind_type;
- pils *imap_le_struct;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &streamind, &qroot, &mailbox_size) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- convert_to_long_ex(streamind);
- convert_to_string_ex(qroot);
- convert_to_long_ex(mailbox_size);
-
- limits.text.data = "STORAGE";
- limits.text.size = Z_LVAL_PP(mailbox_size);
- limits.next = NIL;
-
- ind = Z_LVAL_PP(streamind);
- imap_le_struct = (pils *) zend_list_find(ind, &ind_type);
- if (!imap_le_struct || !IS_STREAM(ind_type)) {
- php_error(E_WARNING, "Unable to find stream pointer");
- RETURN_FALSE;
- }
- RETURN_LONG(imap_setquota(imap_le_struct->imap_stream, Z_STRVAL_PP(qroot), &limits));
-}
-/* }}} */
-#endif
-
-
-/* {{{ proto int imap_expunge(int stream_id)
- Permanently delete all messages marked for deletion */
-PHP_FUNCTION(imap_expunge)
-{
- zval **streamind;
- int ind, ind_type;
- pils *imap_le_struct;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &streamind) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- convert_to_long_ex(streamind);
-
- ind = Z_LVAL_PP(streamind);
-
- imap_le_struct = (pils *) zend_list_find(ind, &ind_type);
-
- if (!imap_le_struct || !IS_STREAM(ind_type)) {
- php_error(E_WARNING, "Unable to find stream pointer");
- RETURN_FALSE;
- }
-
- mail_expunge (imap_le_struct->imap_stream);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int imap_close(int stream_id [, int options])
- Close an IMAP stream */
-PHP_FUNCTION(imap_close)
-{
- zval **options, **streamind;
- int ind, ind_type;
- pils *imap_le_struct=NULL;
- int myargcount=ZEND_NUM_ARGS();
- long flags = NIL;
-
- if (myargcount < 1 || myargcount > 2 || zend_get_parameters_ex(myargcount, &streamind, &options) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
- convert_to_long_ex(streamind);
- ind = Z_LVAL_PP(streamind);
- imap_le_struct = (pils *) zend_list_find(ind, &ind_type);
- if (!imap_le_struct || !IS_STREAM(ind_type)) {
- php_error(E_WARNING, "Unable to find stream pointer");
- RETURN_FALSE;
- }
- if (myargcount==2) {
- convert_to_long_ex(options);
- flags = Z_LVAL_PP(options);
- /* Do the translation from PHP's internal PHP_EXPUNGE define to c-client's CL_EXPUNGE */
- if (flags & PHP_EXPUNGE) {
- flags ^= PHP_EXPUNGE;
- flags |= CL_EXPUNGE;
- }
- imap_le_struct->flags = flags;
- }
-
- zend_list_delete(ind);
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto array imap_headers(int stream_id)
- Returns headers for all messages in a mailbox */
-PHP_FUNCTION(imap_headers)
-{
- zval **streamind;
- int ind, ind_type;
- unsigned long i;
- char *t;
- unsigned int msgno;
- pils *imap_le_struct;
- char tmp[MAILTMPLEN];
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &streamind) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- convert_to_long_ex(streamind);
-
- ind = Z_LVAL_PP(streamind);
- imap_le_struct = (pils *) zend_list_find(ind, &ind_type);
- if (!imap_le_struct || !IS_STREAM(ind_type)) {
- php_error(E_WARNING, "Unable to find stream pointer");
- RETURN_FALSE;
- }
-
- /* Initialize return array */
- if (array_init(return_value) == FAILURE) {
- RETURN_FALSE;
- }
-
- for (msgno = 1; msgno <= imap_le_struct->imap_stream->nmsgs; msgno++) {
- MESSAGECACHE * cache = mail_elt (imap_le_struct->imap_stream,msgno);
- mail_fetchstructure(imap_le_struct->imap_stream,msgno,NIL);
- tmp[0] = cache->recent ? (cache->seen ? 'R': 'N') : ' ';
- tmp[1] = (cache->recent | cache->seen) ? ' ' : 'U';
- tmp[2] = cache->flagged ? 'F' : ' ';
- tmp[3] = cache->answered ? 'A' : ' ';
- tmp[4] = cache->deleted ? 'D' : ' ';
- tmp[5] = cache->draft ? 'X' : ' ';
- sprintf(tmp + 6, "%4ld) ", cache->msgno);
- mail_date(tmp+11, cache);
- tmp[22] = ' ';
- tmp[23] = '\0';
- mail_fetchfrom(tmp+23, imap_le_struct->imap_stream, msgno, (long)20);
- strcat(tmp, " ");
- if ((i = cache->user_flags)) {
- strcat(tmp, "{");
- while (i) {
- strcat(tmp, imap_le_struct->imap_stream->user_flags[find_rightmost_bit (&i)]);
- if (i) strcat(tmp, " ");
- }
- strcat(tmp, "} ");
- }
- mail_fetchsubject(t = tmp + strlen(tmp), imap_le_struct->imap_stream, msgno, (long)25);
- sprintf(t += strlen(t), " (%ld chars)", cache->rfc822_size);
- add_next_index_string(return_value, tmp, 1);
- }
-}
-/* }}} */
-
-/* {{{ proto string imap_body(int stream_id, int msg_no [, int options])
- Read the message body */
-PHP_FUNCTION(imap_body)
-{
- zval **streamind, **msgno, **flags;
- int ind, ind_type, msgindex;
- pils *imap_le_struct;
- int myargc=ZEND_NUM_ARGS();
- if (myargc < 2 || myargc > 3 || zend_get_parameters_ex(myargc, &streamind, &msgno, &flags) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- convert_to_long_ex(streamind);
- convert_to_long_ex(msgno);
- if (myargc == 3) {
- convert_to_long_ex(flags);
- }
- ind = Z_LVAL_PP(streamind);
-
- imap_le_struct = (pils *) zend_list_find(ind, &ind_type);
- if (!imap_le_struct || !IS_STREAM(ind_type)) {
- php_error(E_WARNING, "Unable to find stream pointer");
- RETURN_FALSE;
- }
-
- if ((myargc == 3) && (Z_LVAL_PP(flags) & FT_UID)) {
- /* This should be cached; if it causes an extra RTT to the
- IMAP server, then that's the price we pay for making
- sure we don't crash. */
- msgindex = mail_msgno(imap_le_struct->imap_stream, Z_LVAL_PP(msgno));
- } else {
- msgindex = Z_LVAL_PP(msgno);
- }
- if ((msgindex < 1) || ((unsigned) msgindex > imap_le_struct->imap_stream->nmsgs)) {
- php_error(E_WARNING, "Bad message number");
- RETURN_FALSE;
- }
-
- RETVAL_STRING(mail_fetchtext_full (imap_le_struct->imap_stream, Z_LVAL_PP(msgno), NIL, myargc==3 ? Z_LVAL_PP(flags) : NIL), 1);
-}
-/* }}} */
-
-/* {{{ proto string imap_fetchtext_full(int stream_id, int msg_no [, int options])
- Read the full text of a message */
-PHP_FUNCTION(imap_fetchtext_full)
-{
- zval **streamind, **msgno, **flags;
- int ind, ind_type;
- pils *imap_le_struct;
- int myargcount = ZEND_NUM_ARGS();
- if (myargcount >3 || myargcount <2 || zend_get_parameters_ex(myargcount, &streamind, &msgno, &flags) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- convert_to_long_ex(streamind);
- convert_to_long_ex(msgno);
- if (myargcount == 3) {
- convert_to_long_ex(flags);
- }
- ind = Z_LVAL_PP(streamind);
-
- imap_le_struct = (pils *) zend_list_find(ind, &ind_type);
- if (!imap_le_struct || !IS_STREAM(ind_type)) {
- php_error(E_WARNING, "Unable to find stream pointer");
- RETURN_FALSE;
- }
- RETVAL_STRING(mail_fetchtext_full(imap_le_struct->imap_stream, Z_LVAL_PP(msgno), NIL, myargcount==3 ? Z_LVAL_PP(flags) : NIL), 1);
-}
-/* }}} */
-
-/* {{{ proto int imap_mail_copy(int stream_id, int msg_no, string mailbox [, int options])
- Copy specified message to a mailbox */
-PHP_FUNCTION(imap_mail_copy)
-{
- zval **streamind, **seq, **folder, **options;
- int ind, ind_type;
- pils *imap_le_struct;
- int myargcount = ZEND_NUM_ARGS();
-
- if (myargcount > 4 || myargcount < 3
- || zend_get_parameters_ex(myargcount, &streamind, &seq, &folder, &options) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- convert_to_long_ex(streamind);
- convert_to_string_ex(seq);
- convert_to_string_ex(folder);
- if (myargcount == 4) {
- convert_to_long_ex(options);
- }
- ind = Z_LVAL_PP(streamind);
-
- imap_le_struct = (pils *) zend_list_find(ind, &ind_type);
- if (!imap_le_struct || !IS_STREAM(ind_type)) {
- php_error(E_WARNING, "Unable to find stream pointer");
- RETURN_FALSE;
- }
- if (mail_copy_full(imap_le_struct->imap_stream, Z_STRVAL_PP(seq), Z_STRVAL_PP(folder), myargcount==4 ? Z_LVAL_PP(options) : NIL)==T) {
- RETURN_TRUE;
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto int imap_mail_move(int stream_id, int msg_no, string mailbox [, int options])
- Move specified message to a mailbox */
-PHP_FUNCTION(imap_mail_move)
-{
- zval **streamind, **seq, **folder, **options;
- int ind, ind_type;
- pils *imap_le_struct;
- int myargcount = ZEND_NUM_ARGS();
-
- if (myargcount > 4 || myargcount < 3
- || zend_get_parameters_ex(myargcount, &streamind, &seq, &folder, &options) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- convert_to_long_ex(streamind);
- convert_to_string_ex(seq);
- convert_to_string_ex(folder);
- if (myargcount == 4) {
- convert_to_long_ex(options);
- }
-
- ind = Z_LVAL_PP(streamind);
-
- imap_le_struct = (pils *) zend_list_find(ind, &ind_type);
- if (!imap_le_struct || !IS_STREAM(ind_type)) {
- php_error(E_WARNING, "Unable to find stream pointer");
- RETURN_FALSE;
- }
- if (mail_copy_full(imap_le_struct->imap_stream, Z_STRVAL_PP(seq), Z_STRVAL_PP(folder), myargcount==4 ? (Z_LVAL_PP(options) | CP_MOVE) : CP_MOVE) == T) {
- RETURN_TRUE;
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto int imap_createmailbox(int stream_id, string mailbox)
- Create a new mailbox */
-PHP_FUNCTION(imap_createmailbox)
-{
- zval **streamind, **folder;
- int ind, ind_type;
- pils *imap_le_struct;
-
- if (ZEND_NUM_ARGS()!=2 || zend_get_parameters_ex(2, &streamind, &folder) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- convert_to_long_ex(streamind);
- convert_to_string_ex(folder);
-
- ind = Z_LVAL_PP(streamind);
-
- imap_le_struct = (pils *) zend_list_find(ind, &ind_type);
- if (!imap_le_struct || !IS_STREAM(ind_type)) {
- php_error(E_WARNING, "Unable to find stream pointer");
- RETURN_FALSE;
- }
- if (mail_create(imap_le_struct->imap_stream, Z_STRVAL_PP(folder))==T) {
- RETURN_TRUE;
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto int imap_renamemailbox(int stream_id, string old_name, string new_name)
- Rename a mailbox */
-PHP_FUNCTION(imap_renamemailbox)
-{
- zval **streamind, **old_mailbox, **new_mailbox;
- int ind, ind_type;
- pils *imap_le_struct;
-
- if (ZEND_NUM_ARGS()!=3 || zend_get_parameters_ex(3, &streamind, &old_mailbox, &new_mailbox)==FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- convert_to_long_ex(streamind);
- convert_to_string_ex(old_mailbox);
- convert_to_string_ex(new_mailbox);
-
- ind = Z_LVAL_PP(streamind);
-
- imap_le_struct = (pils *) zend_list_find(ind, &ind_type);
- if (!imap_le_struct || !IS_STREAM(ind_type)) {
- php_error(E_WARNING, "Unable to find stream pointer");
- RETURN_FALSE;
- }
- if (mail_rename(imap_le_struct->imap_stream, Z_STRVAL_PP(old_mailbox), Z_STRVAL_PP(new_mailbox))==T) {
- RETURN_TRUE;
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto int imap_deletemailbox(int stream_id, string mailbox)
- Delete a mailbox */
-PHP_FUNCTION(imap_deletemailbox)
-{
- zval **streamind, **folder;
- int ind, ind_type;
- pils *imap_le_struct;
-
- if (ZEND_NUM_ARGS()!=2 || zend_get_parameters_ex(2, &streamind, &folder) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- convert_to_long_ex(streamind);
- convert_to_string_ex(folder);
-
- ind = Z_LVAL_PP(streamind);
-
- imap_le_struct = (pils *) zend_list_find(ind, &ind_type);
- if (!imap_le_struct || !IS_STREAM(ind_type)) {
- php_error(E_WARNING, "Unable to find stream pointer");
- RETURN_FALSE;
- }
- if (mail_delete(imap_le_struct->imap_stream, Z_STRVAL_PP(folder))==T) {
- RETURN_TRUE;
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto array imap_list(int stream_id, string ref, string pattern)
- Read the list of mailboxes */
-PHP_FUNCTION(imap_list)
-{
- zval **streamind, **ref, **pat;
- int ind, ind_type;
- pils *imap_le_struct;
- STRINGLIST *cur=NIL;
- IMAPLS_FETCH();
-
- /* set flag for normal, old mailbox list */
- IMAPG(folderlist_style) = FLIST_ARRAY;
-
- if (ZEND_NUM_ARGS()!=3
- || zend_get_parameters_ex(3, &streamind, &ref, &pat) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- convert_to_long_ex(streamind);
- convert_to_string_ex(ref);
- convert_to_string_ex(pat);
-
- ind = Z_LVAL_PP(streamind);
-
- imap_le_struct = (pils *) zend_list_find(ind, &ind_type);
- if (!imap_le_struct || !IS_STREAM(ind_type)) {
- php_error(E_WARNING, "Unable to find stream pointer");
- RETURN_FALSE;
- }
- IMAPG(imap_folders) = NIL;
- mail_list(imap_le_struct->imap_stream, Z_STRVAL_PP(ref), Z_STRVAL_PP(pat));
- if (IMAPG(imap_folders) == NIL) {
- RETURN_FALSE;
- }
- array_init(return_value);
- cur=IMAPG(imap_folders);
- while (cur != NIL) {
- add_next_index_string(return_value, cur->LTEXT, 1);
- cur=cur->next;
- }
- mail_free_stringlist (&IMAPG(imap_folders));
-}
-
-/* }}} */
-
-/* {{{ proto array imap_getmailboxes(int stream_id, string ref, string pattern)
- Reads the list of mailboxes and returns a full array of objects containing name, attributes, and delimiter */
-/* Author: CJH */
-PHP_FUNCTION(imap_list_full)
-{
- zval **streamind, **ref, **pat, *mboxob;
- int ind, ind_type;
- pils *imap_le_struct;
- FOBJECTLIST *cur=NIL;
- char *delim=NIL;
- IMAPLS_FETCH();
-
- /* set flag for new, improved array of objects mailbox list */
- IMAPG(folderlist_style) = FLIST_OBJECT;
-
- if (ZEND_NUM_ARGS()!=3
- || zend_get_parameters_ex(3, &streamind, &ref, &pat) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- convert_to_long_ex(streamind);
- convert_to_string_ex(ref);
- convert_to_string_ex(pat);
-
- ind = Z_LVAL_PP(streamind);
- imap_le_struct = (pils *) zend_list_find(ind, &ind_type);
- if (!imap_le_struct || !IS_STREAM(ind_type)) {
- php_error(E_WARNING, "Unable to find stream pointer");
- RETURN_FALSE;
- }
-
- IMAPG(imap_folder_objects) = NIL;
- mail_list(imap_le_struct->imap_stream, Z_STRVAL_PP(ref), Z_STRVAL_PP(pat));
- if (IMAPG(imap_folder_objects) == NIL) {
- RETURN_FALSE;
- }
-
- array_init(return_value);
- delim = emalloc(2 * sizeof(char));
- cur=IMAPG(imap_folder_objects);
- while (cur != NIL) {
- MAKE_STD_ZVAL(mboxob);
- object_init(mboxob);
- add_property_string(mboxob, "name", cur->LTEXT, 1);
- add_property_long(mboxob, "attributes", cur->attributes);
-#ifdef IMAP41
- delim[0] = (char)cur->delimiter;
- delim[1] = 0;
- add_property_string(mboxob, "delimiter", delim, 1);
-#else
- add_property_string(mboxob, "delimiter", cur->delimiter, 1);
-#endif
- add_next_index_object(return_value, mboxob);
- cur=cur->next;
- }
- mail_free_foblist(&IMAPG(imap_folder_objects));
- efree(delim);
- IMAPG(folderlist_style) = FLIST_ARRAY; /* reset to default */
-}
-/* }}} */
-
-/* {{{ proto array imap_scan(int stream_id, string ref, string pattern, string content)
- Read list of mailboxes containing a certain string */
-PHP_FUNCTION(imap_listscan)
-{
- zval **streamind, **ref, **pat, **content;
- int ind, ind_type;
- pils *imap_le_struct;
- STRINGLIST *cur=NIL;
- IMAPLS_FETCH();
-
- if (ZEND_NUM_ARGS()!=4 || zend_get_parameters_ex(4, &streamind, &ref, &pat, &content) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- convert_to_long_ex(streamind);
- convert_to_string_ex(ref);
- convert_to_string_ex(pat);
- convert_to_string_ex(content);
-
- ind = Z_LVAL_PP(streamind);
-
- imap_le_struct = (pils *) zend_list_find(ind, &ind_type);
- if (!imap_le_struct || !IS_STREAM(ind_type)) {
- php_error(E_WARNING, "Unable to find stream pointer");
- RETURN_FALSE;
- }
- IMAPG(imap_folders) = NIL;
- mail_scan(imap_le_struct->imap_stream, Z_STRVAL_PP(ref), Z_STRVAL_PP(pat), Z_STRVAL_PP(content));
- if (IMAPG(imap_folders) == NIL) {
- RETURN_FALSE;
- }
- array_init(return_value);
- cur=IMAPG(imap_folders);
- while (cur != NIL) {
- add_next_index_string(return_value, cur->LTEXT, 1);
- cur=cur->next;
- }
- mail_free_stringlist (&IMAPG(imap_folders));
-}
-
-/* }}} */
-
-/* {{{ proto object imap_check(int stream_id)
- Get mailbox properties */
-PHP_FUNCTION(imap_check)
-{
- zval **streamind;
- int ind, ind_type;
- pils *imap_le_struct;
- char date[100];
-
- if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &streamind) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- convert_to_long_ex(streamind);
-
- ind = Z_LVAL_PP(streamind);
-
- imap_le_struct = (pils *) zend_list_find(ind, &ind_type);
- if (!imap_le_struct || !IS_STREAM(ind_type)) {
- php_error(E_WARNING, "Unable to find stream pointer");
- RETURN_FALSE;
- }
-
- if (mail_ping (imap_le_struct->imap_stream) == NIL) {
- RETURN_FALSE;
- }
- if (imap_le_struct->imap_stream && imap_le_struct->imap_stream->mailbox) {
- rfc822_date(date);
- object_init(return_value);
- add_property_string(return_value, "Date", date, 1);
- add_property_string(return_value, "Driver", imap_le_struct->imap_stream->dtb->name, 1);
- add_property_string(return_value, "Mailbox", imap_le_struct->imap_stream->mailbox, 1);
- add_property_long(return_value, "Nmsgs", imap_le_struct->imap_stream->nmsgs);
- add_property_long(return_value, "Recent", imap_le_struct->imap_stream->recent);
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto int imap_delete(int stream_id, int msg_no [, int flags])
- Mark a message for deletion */
-PHP_FUNCTION(imap_delete)
-{
- zval **streamind, **sequence, **flags;
- int ind, ind_type;
- pils *imap_le_struct;
- int myargc=ZEND_NUM_ARGS();
-
- if (myargc < 2 || myargc > 3 || zend_get_parameters_ex(myargc, &streamind, &sequence, &flags) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- convert_to_long_ex(streamind);
- convert_to_string_ex(sequence);
- if (myargc == 3) {
- convert_to_long_ex(flags);
- }
-
- ind = Z_LVAL_PP(streamind);
-
- imap_le_struct = (pils *) zend_list_find(ind, &ind_type);
- if (!imap_le_struct || !IS_STREAM(ind_type)) {
- php_error(E_WARNING, "Unable to find stream pointer");
- RETURN_FALSE;
- }
-
- mail_setflag_full(imap_le_struct->imap_stream, Z_STRVAL_PP(sequence), "\\DELETED", myargc==3 ? Z_LVAL_PP(flags) : NIL);
- RETVAL_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int imap_undelete(int stream_id, int msg_no)
- Remove the delete flag from a message */
-PHP_FUNCTION(imap_undelete)
-{
- zval **streamind, **sequence, **flags;
- int ind, ind_type;
- pils *imap_le_struct;
- int myargc=ZEND_NUM_ARGS();
-
- if (myargc < 2 || myargc > 3 || zend_get_parameters_ex(myargc, &streamind, &sequence, &flags) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- convert_to_long_ex(streamind);
- convert_to_string_ex(sequence);
- if (myargc == 3) {
- convert_to_long_ex(flags);
- }
-
- ind = Z_LVAL_PP(streamind);
-
- imap_le_struct = (pils *) zend_list_find(ind, &ind_type);
- if (!imap_le_struct || !IS_STREAM(ind_type)) {
- php_error(E_WARNING, "Unable to find stream pointer");
- RETURN_FALSE;
- }
-
- mail_clearflag_full(imap_le_struct->imap_stream, Z_STRVAL_PP(sequence), "\\DELETED", myargc==3 ? Z_LVAL_PP(flags) : NIL);
- RETVAL_TRUE;
-}
-/* }}} */
-
-/* {{{ proto object imap_headerinfo(int stream_id, int msg_no [, int from_length [, int subject_length [, string default_host]]])
- Read the headers of the message */
-PHP_FUNCTION(imap_headerinfo)
-{
- zval **streamind, **msgno, **fromlength, **subjectlength, **defaulthost;
- int ind, ind_type;
- unsigned long length;
- pils *imap_le_struct;
- MESSAGECACHE *cache;
- char *mystring;
- char dummy[2000];
- ENVELOPE *en;
- char fulladdress[MAILTMPLEN];
-
- int myargc = ZEND_NUM_ARGS();
- if (myargc < 2 || myargc > 5 || zend_get_parameters_ex(myargc, &streamind, &msgno, &fromlength, &subjectlength, &defaulthost)==FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- convert_to_long_ex(streamind);
- convert_to_long_ex(msgno);
- if (myargc >= 3) {
- convert_to_long_ex(fromlength);
- } else {
- fromlength = 0x00;
- }
- if (myargc >= 4) {
- convert_to_long_ex(subjectlength);
- } else {
- subjectlength = 0x00;
- }
- if (myargc == 5) {
- convert_to_string_ex(defaulthost);
- }
-
- ind = Z_LVAL_PP(streamind);
- imap_le_struct = (pils *) zend_list_find(ind, &ind_type);
- if (!imap_le_struct || !IS_STREAM(ind_type)) {
- php_error(E_WARNING, "Unable to find stream pointer");
- RETURN_FALSE;
- }
-
- if (!Z_LVAL_PP(msgno) || Z_LVAL_PP(msgno) < 1 || (unsigned) Z_LVAL_PP(msgno) > imap_le_struct->imap_stream->nmsgs) {
- php_error(E_WARNING, "Bad message number");
- RETURN_FALSE;
- }
-
- if (mail_fetchstructure(imap_le_struct->imap_stream, Z_LVAL_PP(msgno), NIL)) {
- cache = mail_elt(imap_le_struct->imap_stream, Z_LVAL_PP(msgno));
- } else {
- RETURN_FALSE;
- }
-
- mystring = mail_fetchheader_full(imap_le_struct->imap_stream, Z_LVAL_PP(msgno), NIL, &length, NIL);
- if (myargc == 5) {
- rfc822_parse_msg(&en, NULL, mystring, length, NULL, Z_STRVAL_PP(defaulthost), NIL);
- } else {
- rfc822_parse_msg(&en, NULL, mystring, length, NULL, "UNKNOWN", NIL);
- }
-
- /* call a function to parse all the text, so that we can use the
- same function to parse text from other sources */
- _php_make_header_object(return_value, en);
-
- /* now run through properties that are only going to be returned
- from a server, not text headers */
- add_property_string(return_value, "Recent", cache->recent ? (cache->seen ? "R": "N") : " ", 1);
- add_property_string(return_value, "Unseen", (cache->recent | cache->seen) ? " " : "U", 1);
- add_property_string(return_value, "Flagged", cache->flagged ? "F" : " ", 1);
- add_property_string(return_value, "Answered", cache->answered ? "A" : " ", 1);
- add_property_string(return_value, "Deleted", cache->deleted ? "D" : " ", 1);
- add_property_string(return_value, "Draft", cache->draft ? "X" : " ", 1);
-
- sprintf(dummy, "%4ld", cache->msgno);
- add_property_string(return_value, "Msgno", dummy, 1);
-
- mail_date(dummy, cache);
- add_property_string(return_value, "MailDate", dummy, 1);
-
- sprintf(dummy, "%ld", cache->rfc822_size);
- add_property_string(return_value, "Size", dummy, 1);
-
- add_property_long(return_value, "udate", mail_longdate(cache));
-
- if (en->from && fromlength) {
- fulladdress[0] = 0x00;
- mail_fetchfrom(fulladdress, imap_le_struct->imap_stream, Z_LVAL_PP(msgno), Z_LVAL_PP(fromlength));
- add_property_string(return_value, "fetchfrom", fulladdress, 1);
- }
- if (en->subject && subjectlength) {
- fulladdress[0] = 0x00;
- mail_fetchsubject(fulladdress, imap_le_struct->imap_stream, Z_LVAL_PP(msgno), Z_LVAL_PP(subjectlength));
- add_property_string(return_value, "fetchsubject", fulladdress, 1);
- }
- mail_free_envelope(&en);
-}
-/* }}} */
-
-/* {{{ proto object imap_rfc822_parse_headers(string headers [, string default_host])
- Parse a set of mail headers contained in a string, and return an object similar to imap_headerinfo() */
-PHP_FUNCTION(imap_rfc822_parse_headers)
-{
- zval **headers, **defaulthost;
- ENVELOPE *en;
-
- int myargc = ZEND_NUM_ARGS();
- if (myargc < 1 || myargc > 2 || zend_get_parameters_ex(myargc, &headers, &defaulthost) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- convert_to_string_ex(headers);
- if (myargc == 2) {
- convert_to_string_ex(defaulthost);
- }
-
- if (myargc == 2) {
- rfc822_parse_msg(&en, NULL, (*headers)->value.str.val, (*headers)->value.str.len, NULL, (*defaulthost)->value.str.val, NIL);
- } else {
- rfc822_parse_msg(&en, NULL, (*headers)->value.str.val, (*headers)->value.str.len, NULL, "UNKNOWN", NIL);
- }
-
- /* call a function to parse all the text, so that we can use the
- same function no matter where the headers are from */
- _php_make_header_object(return_value, en);
- mail_free_envelope(&en);
-}
-/* }}} */
-
-
-/* KMLANG */
-/* {{{ proto array imap_lsub(int stream_id, string ref, string pattern)
- Return a list of subscribed mailboxes */
-PHP_FUNCTION(imap_lsub)
-{
- zval **streamind, **ref, **pat;
- int ind, ind_type;
- pils *imap_le_struct;
- STRINGLIST *cur=NIL;
- IMAPLS_FETCH();
-
-
- /* set flag for normal, old mailbox list */
- IMAPG(folderlist_style) = FLIST_ARRAY;
-
- if (ZEND_NUM_ARGS()!=3 || zend_get_parameters_ex(3, &streamind, &ref, &pat) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- convert_to_long_ex(streamind);
- convert_to_string_ex(ref);
- convert_to_string_ex(pat);
-
- ind = Z_LVAL_PP(streamind);
-
- imap_le_struct = (pils *) zend_list_find(ind, &ind_type);
- if (!imap_le_struct || !IS_STREAM(ind_type)) {
- php_error(E_WARNING, "Unable to find stream pointer");
- RETURN_FALSE;
- }
- IMAPG(imap_sfolders) = NIL;
- mail_lsub(imap_le_struct->imap_stream, Z_STRVAL_PP(ref), Z_STRVAL_PP(pat));
- if (IMAPG(imap_sfolders) == NIL) {
- RETURN_FALSE;
- }
- array_init(return_value);
- cur=IMAPG(imap_sfolders);
- while (cur != NIL) {
- add_next_index_string(return_value, cur->LTEXT, 1);
- cur=cur->next;
- }
- mail_free_stringlist (&IMAPG(imap_sfolders));
-}
-/* }}} */
-
-/* {{{ proto array imap_getsubscribed(int stream_id, string ref, string pattern)
- Return a list of subscribed mailboxes, in the same format as imap_getmailboxes() */
-/* Author: CJH */
-PHP_FUNCTION(imap_lsub_full)
-{
- zval **streamind, **ref, **pat, *mboxob;
- int ind, ind_type;
- pils *imap_le_struct;
- FOBJECTLIST *cur=NIL;
- char *delim=NIL;
- IMAPLS_FETCH();
-
- delim = emalloc(2 * sizeof(char));
-
- /* set flag for new, improved array of objects list */
- IMAPG(folderlist_style) = FLIST_OBJECT;
-
- if (ZEND_NUM_ARGS()!=3 || zend_get_parameters_ex(3, &streamind, &ref, &pat) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- convert_to_long_ex(streamind);
- convert_to_string_ex(ref);
- convert_to_string_ex(pat);
-
- ind = Z_LVAL_PP(streamind);
- imap_le_struct = (pils *) zend_list_find(ind, &ind_type);
- if (!imap_le_struct || !IS_STREAM(ind_type)) {
- php_error(E_WARNING, "Unable to find stream pointer");
- RETURN_FALSE;
- }
-
- IMAPG(imap_sfolder_objects) = NIL;
- mail_lsub(imap_le_struct->imap_stream, Z_STRVAL_PP(ref), Z_STRVAL_PP(pat));
- if (IMAPG(imap_sfolder_objects) == NIL) {
- RETURN_FALSE;
- }
-
- array_init(return_value);
- cur=IMAPG(imap_sfolder_objects);
- while (cur != NIL) {
- MAKE_STD_ZVAL(mboxob);
- object_init(mboxob);
- add_property_string(mboxob, "name", cur->LTEXT, 1);
- add_property_long(mboxob, "attributes", cur->attributes);
-#ifdef IMAP41
- delim[0] = (char)cur->delimiter;
- delim[1] = 0;
- add_property_string(mboxob, "delimiter", delim, 1);
-#else
- add_property_string(mboxob, "delimiter", cur->delimiter, 1);
-#endif
- add_next_index_object(return_value, mboxob);
- cur=cur->next;
- }
- mail_free_foblist (&IMAPG(imap_sfolder_objects));
- efree(delim);
- IMAPG(folderlist_style) = FLIST_ARRAY; /* reset to default */
-}
-/* }}} */
-
-/* {{{ proto int imap_subscribe(int stream_id, string mailbox)
- Subscribe to a mailbox */
-PHP_FUNCTION(imap_subscribe)
-{
- zval **streamind, **folder;
- int ind, ind_type;
- pils *imap_le_struct;
-
- if (ZEND_NUM_ARGS()!=2 || zend_get_parameters_ex(2, &streamind, &folder) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- convert_to_long_ex(streamind);
- convert_to_string_ex(folder);
-
- ind = Z_LVAL_PP(streamind);
-
- imap_le_struct = (pils *) zend_list_find(ind, &ind_type);
- if (!imap_le_struct || !IS_STREAM(ind_type)) {
- php_error(E_WARNING, "Unable to find stream pointer");
- RETURN_FALSE;
- }
- if (mail_subscribe(imap_le_struct->imap_stream, Z_STRVAL_PP(folder))==T) {
- RETURN_TRUE;
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto int imap_unsubscribe(int stream_id, string mailbox)
- Unsubscribe from a mailbox */
-PHP_FUNCTION(imap_unsubscribe)
-{
- zval **streamind, **folder;
- int ind, ind_type;
- pils *imap_le_struct;
- int myargc=ZEND_NUM_ARGS();
- if (myargc !=2 || zend_get_parameters_ex(myargc, &streamind, &folder) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- convert_to_long_ex(streamind);
- convert_to_string_ex(folder);
- ind = Z_LVAL_PP(streamind);
-
- imap_le_struct = (pils *) zend_list_find(ind, &ind_type);
- if (!imap_le_struct || !IS_STREAM(ind_type)) {
- php_error(E_WARNING, "Unable to find stream pointer");
- RETURN_FALSE;
- }
- if (mail_unsubscribe(imap_le_struct->imap_stream, Z_STRVAL_PP(folder))==T) {
- RETURN_TRUE;
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto object imap_fetchstructure(int stream_id, int msg_no [, int options])
- Read the full structure of a message */
-PHP_FUNCTION(imap_fetchstructure)
-{
- zval **streamind, **msgno, **flags;
- int ind, ind_type, msgindex;
- pils *imap_le_struct;
- BODY *body;
- int myargc=ZEND_NUM_ARGS();
-
- if (myargc < 2 || myargc > 3 || zend_get_parameters_ex(myargc, &streamind, &msgno, &flags) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- convert_to_long_ex(streamind);
- convert_to_long_ex(msgno);
- if (Z_LVAL_PP(msgno) < 1) {
- RETURN_FALSE;
- }
- if (myargc == 3) {
- convert_to_long_ex(flags);
- }
- object_init(return_value);
-
- ind = Z_LVAL_PP(streamind);
-
- imap_le_struct = (pils *) zend_list_find(ind, &ind_type);
-
- if (!imap_le_struct || !IS_STREAM(ind_type)) {
- php_error(E_WARNING, "Unable to find stream pointer");
- RETURN_FALSE;
- }
-
- if ((myargc == 3) && (Z_LVAL_PP(flags) & FT_UID)) {
- /* This should be cached; if it causes an extra RTT to the
- IMAP server, then that's the price we pay for making
- sure we don't crash. */
- msgindex = mail_msgno(imap_le_struct->imap_stream, Z_LVAL_PP(msgno));
- } else {
- msgindex = Z_LVAL_PP(msgno);
- }
- if ((msgindex < 1) || ((unsigned) msgindex > imap_le_struct->imap_stream->nmsgs)) {
- php_error(E_WARNING, "Bad message number");
- RETURN_FALSE;
- }
-
- mail_fetchstructure_full(imap_le_struct->imap_stream, Z_LVAL_PP(msgno), &body ,myargc == 3 ? Z_LVAL_PP(flags) : NIL);
-
- if (!body) {
- php_error(E_WARNING, "No body information available");
- RETURN_FALSE;
- }
-
- _php_imap_add_body(return_value, body);
-}
-/* }}} */
-
-/* {{{ proto string imap_fetchbody(int stream_id, int msg_no, int section [, int options])
- Get a specific body section */
-PHP_FUNCTION(imap_fetchbody)
-{
- zval **streamind, **msgno, **sec, **flags;
- int ind, ind_type;
- pils *imap_le_struct;
- char *body;
- unsigned long len;
- int myargc=ZEND_NUM_ARGS();
-
- if (myargc < 3 || myargc >4 || zend_get_parameters_ex(myargc, &streamind, &msgno, &sec, &flags) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- convert_to_long_ex(streamind);
- convert_to_long_ex(msgno);
- convert_to_string_ex(sec);
- if (myargc == 4) {
- convert_to_long_ex(flags);
- }
- ind = Z_LVAL_PP(streamind);
-
- imap_le_struct = (pils *) zend_list_find(ind, &ind_type);
-
- if (!imap_le_struct || !IS_STREAM(ind_type)) {
- php_error(E_WARNING, "Unable to find stream pointer");
- RETURN_FALSE;
- }
-
- body = mail_fetchbody_full(imap_le_struct->imap_stream, Z_LVAL_PP(msgno), Z_STRVAL_PP(sec), &len, myargc==4 ? Z_LVAL_PP(flags) : NIL);
-
- if (!body) {
- php_error(E_WARNING, "No body information available");
- RETURN_FALSE;
- }
- RETVAL_STRINGL(body, len, 1);
-}
-
-/* }}} */
-
-/* {{{ proto string imap_base64(string text)
- Decode BASE64 encoded text */
-PHP_FUNCTION(imap_base64)
-{
- zval **text;
- char *decode;
- unsigned long newlength;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &text) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- convert_to_string_ex(text);
-
- decode = (char *) rfc822_base64((unsigned char *) Z_STRVAL_PP(text), Z_STRLEN_PP(text), &newlength);
- if (decode == NULL) {
- RETURN_FALSE;
- }
- RETVAL_STRINGL(decode, newlength, 1);
- fs_give((void**) &decode);
-}
-/* }}} */
-
-/* {{{ proto string imap_qprint(string text)
- Convert a quoted-printable string to an 8-bit string */
-PHP_FUNCTION(imap_qprint)
-{
- zval **text;
- char *decode;
- unsigned long newlength;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &text) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- convert_to_string_ex(text);
-
- decode = (char *) rfc822_qprint((unsigned char *) Z_STRVAL_PP(text), Z_STRLEN_PP(text), &newlength);
- if (decode == NULL) {
- RETURN_FALSE;
- }
- RETVAL_STRINGL(decode, newlength, 1);
- fs_give((void**) &decode);
-}
-/* }}} */
-
-/* {{{ proto string imap_8bit(string text)
- Convert an 8-bit string to a quoted-printable string */
-PHP_FUNCTION(imap_8bit)
-{
- zval **text;
- char *decode;
- unsigned long newlength;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &text) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- convert_to_string_ex(text);
-
- decode = (char *) rfc822_8bit((unsigned char *) Z_STRVAL_PP(text), Z_STRLEN_PP(text), &newlength);
- RETVAL_STRINGL(decode, newlength, 1);
- fs_give((void**) &decode);
-}
-/* }}} */
-
-/* {{{ proto string imap_binary(string text)
- Convert an 8bit string to a base64 string */
-PHP_FUNCTION(imap_binary)
-{
- zval **text;
- unsigned long len;
- char *decode;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &text) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
- convert_to_string_ex(text);
- decode = rfc822_binary(Z_STRVAL_PP(text), Z_STRLEN_PP(text), &len);
- RETVAL_STRINGL(decode, len, 1);
- fs_give((void**) &decode);
-}
-/* }}} */
-
-/* {{{ proto object imap_mailboxmsginfo(int stream_id)
- Returns info about the current mailbox */
-PHP_FUNCTION(imap_mailboxmsginfo)
-{
- zval **streamind;
- char date[100];
- int ind, ind_type;
- unsigned int msgno;
- pils *imap_le_struct;
- unsigned unreadmsg, deletedmsg, msize;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &streamind) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- convert_to_long_ex(streamind);
-
- ind = Z_LVAL_PP(streamind);
-
- imap_le_struct = (pils *) zend_list_find(ind, &ind_type);
-
- if (!imap_le_struct || !IS_STREAM(ind_type)) {
- php_error(E_WARNING, "Unable to find stream pointer");
- RETURN_FALSE;
- }
-
- /* Initialize return object */
- if (object_init(return_value) == FAILURE) {
- RETURN_FALSE;
- }
-
- unreadmsg = 0;
- deletedmsg = 0;
- msize = 0;
- for (msgno = 1; msgno <= imap_le_struct->imap_stream->nmsgs; msgno++) {
- MESSAGECACHE * cache = mail_elt (imap_le_struct->imap_stream,msgno);
- mail_fetchstructure (imap_le_struct->imap_stream,msgno,NIL);
- if (!cache->seen || cache->recent) unreadmsg++;
- if (cache->deleted) deletedmsg++;
- msize = msize + cache->rfc822_size;
- }
- add_property_long(return_value, "Unread", unreadmsg);
- add_property_long(return_value, "Deleted", deletedmsg);
- add_property_long(return_value, "Nmsgs", imap_le_struct->imap_stream->nmsgs);
- add_property_long(return_value, "Size", msize);
- rfc822_date(date);
- add_property_string(return_value, "Date", date, 1);
- add_property_string(return_value, "Driver", imap_le_struct->imap_stream->dtb->name, 1);
- add_property_string(return_value, "Mailbox", imap_le_struct->imap_stream->mailbox, 1);
- add_property_long(return_value, "Recent", imap_le_struct->imap_stream->recent);
-}
-/* }}} */
-
-/* {{{ proto string imap_rfc822_write_address(string mailbox, string host, string personal)
- Returns a properly formatted email address given the mailbox, host, and personal info */
-PHP_FUNCTION(imap_rfc822_write_address)
-{
- zval **mailbox, **host, **personal;
- ADDRESS *addr;
- char string[MAILTMPLEN];
- int argc;
- argc=ZEND_NUM_ARGS();
-
- if (argc != 3 || zend_get_parameters_ex(argc, &mailbox, &host, &personal) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
- convert_to_string_ex(mailbox);
- convert_to_string_ex(host);
- convert_to_string_ex(personal);
- addr=mail_newaddr();
- if (mailbox) {
- addr->mailbox = cpystr(Z_STRVAL_PP(mailbox));
- }
- if (host) {
- addr->host = cpystr(Z_STRVAL_PP(host));
- }
- if (personal) {
- addr->personal = cpystr(Z_STRVAL_PP(personal));
- }
- addr->next=NIL;
- addr->error=NIL;
- addr->adl=NIL;
-
- string[0]='\0';
- rfc822_write_address(string, addr);
- RETVAL_STRING(string, 1);
-}
-/* }}} */
-
-/* {{{ proto array imap_rfc822_parse_adrlist(string address_string, string default_host)
- Parses an address string */
-PHP_FUNCTION(imap_rfc822_parse_adrlist)
-{
- zval *str, *defaulthost, *tovals;
- ADDRESS *addresstmp;
- ENVELOPE *env;
- int argc;
-
- env=mail_newenvelope();
- argc=ZEND_NUM_ARGS();
- if (argc != 2 || zend_get_parameters(ht, argc, &str, &defaulthost) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
- convert_to_string(str);
- convert_to_string(defaulthost);
- rfc822_parse_adrlist(&env->to, str->value.str.val, defaulthost->value.str.val);
- if (array_init(return_value) == FAILURE) {
- RETURN_FALSE;
- }
- addresstmp=env->to;
- if (addresstmp) do {
- MAKE_STD_ZVAL(tovals);
- object_init(tovals);
- if (addresstmp->mailbox) {
- add_property_string(tovals, "mailbox", addresstmp->mailbox, 1);
- }
- if (addresstmp->host) {
- add_property_string(tovals, "host", addresstmp->host, 1);
- }
- if (addresstmp->personal) {
- add_property_string(tovals, "personal", addresstmp->personal, 1);
- }
- if (addresstmp->adl) {
- add_property_string(tovals, "adl", addresstmp->adl, 1);
- }
- add_next_index_object(return_value, tovals);
- } while ((addresstmp = addresstmp->next));
-}
-/* }}} */
-
-/* {{{ proto string imap_utf8(string string)
- Convert a string to UTF-8 */
-PHP_FUNCTION(imap_utf8)
-{
- zval **str;
- int argc;
- SIZEDTEXT src, dest;
-
- src.data = NULL;
- src.size = 0;
- dest.data = NULL;
- dest.size = 0;
-
- argc = ZEND_NUM_ARGS();
- if (argc != 1 || zend_get_parameters_ex(argc, &str) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- convert_to_string_ex(str);
- cpytxt(&src, Z_STRVAL_PP(str), Z_STRLEN_PP(str));
- utf8_mime2text(&src, &dest);
- RETURN_STRINGL(dest.data, strlen(dest.data), 1);
-}
-/* }}} */
-
-
-/* macros for the modified utf7 conversion functions */
-/* author: Andrew Skalski <askalski@chek.com> */
-
-/* tests `c' and returns true if it is a special character */
-#define SPECIAL(c) ((c) <= 0x1f || (c) >= 0x7f)
-/* validate a modified-base64 character */
-#define B64CHAR(c) (isalnum(c) || (c) == '+' || (c) == ',')
-/* map the low 64 bits of `n' to the modified-base64 characters */
-#define B64(n) ("ABCDEFGHIJKLMNOPQRSTUVWXYZ" \
- "abcdefghijklmnopqrstuvwxyz0123456789+,"[(n) & 0x3f])
-/* map the modified-base64 character `c' to its 64 bit value */
-#define UNB64(c) ((c) == '+' ? 62 : (c) == ',' ? 63 : (c) >= 'a' ? \
- (c) - 71 : (c) >= 'A' ? (c) - 65 : (c) + 4)
-
-/* {{{ proto string imap_utf7_decode(string buf)
- Decode a modified UTF-7 string */
-PHP_FUNCTION(imap_utf7_decode)
-{
- /* author: Andrew Skalski <askalski@chek.com> */
- int argc;
- zval **arg;
- const unsigned char *in, *inp, *endp;
- unsigned char *out, *outp;
- int inlen, outlen;
- enum {
- ST_NORMAL, /* printable text */
- ST_DECODE0, /* encoded text rotation... */
- ST_DECODE1,
- ST_DECODE2,
- ST_DECODE3
- } state;
-
- /* collect arguments */
- argc = ZEND_NUM_ARGS();
- if (argc != 1 || zend_get_parameters_ex(argc, &arg) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- convert_to_writable_string_ex(arg); /* Is this string really modified? */
- in = (const unsigned char *) Z_STRVAL_PP(arg);
- inlen = Z_STRLEN_PP(arg);
-
- /* validate and compute length of output string */
- outlen = 0;
- state = ST_NORMAL;
- for (endp = (inp = in) + inlen; inp < endp; inp++) {
- if (state == ST_NORMAL) {
- /* process printable character */
- if (SPECIAL(*inp)) {
- php_error(E_WARNING, "imap_utf7_decode: "
- "Invalid modified UTF-7 character: "
- "`%c'", *inp);
- RETURN_FALSE;
- } else if (*inp != '&') {
- outlen++;
- } else if (inp + 1 == endp) {
- php_error(E_WARNING, "imap_utf7_decode: "
- "Unexpected end of string");
- RETURN_FALSE;
- } else if (inp[1] != '-') {
- state = ST_DECODE0;
- } else {
- outlen++;
- inp++;
- }
- } else if (*inp == '-') {
- /* return to NORMAL mode */
- if (state == ST_DECODE1) {
- php_error(E_WARNING, "imap_utf7_decode: "
- "Stray modified base64 character: "
- "`%c'", *--inp);
- RETURN_FALSE;
- }
- state = ST_NORMAL;
- } else if (!B64CHAR(*inp)) {
- php_error(E_WARNING, "imap_utf7_decode: "
- "Invalid modified base64 character: "
- "`%c'", *inp);
- RETURN_FALSE;
- } else {
- switch (state) {
- case ST_DECODE3:
- outlen++;
- state = ST_DECODE0;
- break;
- case ST_DECODE2:
- case ST_DECODE1:
- outlen++;
- case ST_DECODE0:
- state++;
- case ST_NORMAL:
- break;
- }
- }
- }
-
- /* enforce end state */
- if (state != ST_NORMAL) {
- php_error(E_WARNING, "imap_utf7_decode: "
- "Unexpected end of string");
- RETURN_FALSE;
- }
-
- /* allocate output buffer */
- if ((out = emalloc(outlen + 1)) == NULL) {
- php_error(E_WARNING, "imap_utf7_decode: "
- "Unable to allocate result string");
- RETURN_FALSE;
- }
-
- /* decode input string */
- outp = out;
- state = ST_NORMAL;
- for (endp = (inp = in) + inlen; inp < endp; inp++) {
- if (state == ST_NORMAL) {
- if (*inp == '&' && inp[1] != '-') {
- state = ST_DECODE0;
- }
- else if ((*outp++ = *inp) == '&') {
- inp++;
- }
- }
- else if (*inp == '-') {
- state = ST_NORMAL;
- }
- else {
- /* decode input character */
- switch (state) {
- case ST_DECODE0:
- *outp = UNB64(*inp) << 2;
- state = ST_DECODE1;
- break;
- case ST_DECODE1:
- outp[1] = UNB64(*inp);
- *outp++ |= outp[1] >> 4;
- *outp <<= 4;
- state = ST_DECODE2;
- break;
- case ST_DECODE2:
- outp[1] = UNB64(*inp);
- *outp++ |= outp[1] >> 2;
- *outp <<= 6;
- state = ST_DECODE3;
- break;
- case ST_DECODE3:
- *outp++ |= UNB64(*inp);
- state = ST_DECODE0;
- case ST_NORMAL:
- break;
- }
- }
- }
-
- *outp = 0;
-
-#if PHP_DEBUG
- /* warn if we computed outlen incorrectly */
- if (outp - out != outlen) {
- php_error(E_WARNING,
- "imap_utf7_decode: outp - out [%d] != outlen [%d]",
- outp - out, outlen);
- }
-#endif
-
- RETURN_STRINGL(out, outlen, 0);
-}
-/* }}} */
-
-/* {{{ proto string imap_utf7_encode(string buf)
- Encode a string in modified UTF-7 */
-PHP_FUNCTION(imap_utf7_encode)
-{
- /* author: Andrew Skalski <askalski@chek.com> */
- int argc;
- zval **arg;
- const unsigned char *in, *inp, *endp;
- unsigned char *out, *outp;
- int inlen, outlen;
- enum {
- ST_NORMAL, /* printable text */
- ST_ENCODE0, /* encoded text rotation... */
- ST_ENCODE1,
- ST_ENCODE2
- } state;
-
- /* collect arguments */
- argc = ZEND_NUM_ARGS();
- if (argc != 1 || zend_get_parameters_ex(argc, &arg) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
- convert_to_string_ex(arg);
- in = (const unsigned char *) Z_STRVAL_PP(arg);
- inlen = Z_STRLEN_PP(arg);
-
- /* compute the length of the result string */
- outlen = 0;
- state = ST_NORMAL;
- endp = (inp = in) + inlen;
- while (inp < endp) {
- if (state == ST_NORMAL) {
- if (SPECIAL(*inp)) {
- state = ST_ENCODE0;
- outlen++;
- } else if (*inp++ == '&') {
- outlen++;
- }
- outlen++;
- } else if (!SPECIAL(*inp)) {
- state = ST_NORMAL;
- } else {
- /* ST_ENCODE0 -> ST_ENCODE1 - two chars
- * ST_ENCODE1 -> ST_ENCODE2 - one char
- * ST_ENCODE2 -> ST_ENCODE0 - one char
- */
- if (state == ST_ENCODE2) {
- state = ST_ENCODE0;
- }
- else if (state++ == ST_ENCODE0) {
- outlen++;
- }
- outlen++;
- inp++;
- }
- }
-
- /* allocate output buffer */
- if ((out = emalloc(outlen + 1)) == NULL) {
- php_error(E_WARNING, "imap_utf7_encode: "
- "Unable to allocate result string");
- RETURN_FALSE;
- }
-
- /* encode input string */
- outp = out;
- state = ST_NORMAL;
- endp = (inp = in) + inlen;
- while (inp < endp || state != ST_NORMAL) {
- if (state == ST_NORMAL) {
- if (SPECIAL(*inp)) {
- /* begin encoding */
- *outp++ = '&';
- state = ST_ENCODE0;
- } else if ((*outp++ = *inp++) == '&') {
- *outp++ = '-';
- }
- } else if (inp == endp || !SPECIAL(*inp)) {
- /* flush overflow and terminate region */
- if (state != ST_ENCODE0) {
- *outp++ = B64(*outp);
- }
- *outp++ = '-';
- state = ST_NORMAL;
- } else {
- /* encode input character */
- switch (state) {
- case ST_ENCODE0:
- *outp++ = B64(*inp >> 2);
- *outp = *inp++ << 4;
- state = ST_ENCODE1;
- break;
- case ST_ENCODE1:
- *outp++ = B64(*outp | *inp >> 4);
- *outp = *inp++ << 2;
- state = ST_ENCODE2;
- break;
- case ST_ENCODE2:
- *outp++ = B64(*outp | *inp >> 6);
- *outp++ = B64(*inp++);
- state = ST_ENCODE0;
- case ST_NORMAL:
- break;
- }
- }
- }
-
- *outp = 0;
-
-#if PHP_DEBUG
- /* warn if we computed outlen incorrectly */
- if (outp - out != outlen) {
- php_error(E_WARNING,
- "imap_utf7_encode: outp - out [%d] != outlen [%d]",
- outp - out, outlen);
- }
-#endif
-
- RETURN_STRINGL(out, outlen, 0);
-}
-/* }}} */
-
-#undef SPECIAL
-#undef B64CHAR
-#undef B64
-#undef UNB64
-
-/* {{{ proto int imap_setflag_full(int stream_id, string sequence, string flag [, int options])
- Sets flags on messages */
-PHP_FUNCTION(imap_setflag_full)
-{
- zval **streamind, **sequence, **flag, **flags;
- int ind, ind_type;
- pils *imap_le_struct;
- int myargc=ZEND_NUM_ARGS();
-
- if (myargc < 3 || myargc > 4 || zend_get_parameters_ex(myargc, &streamind, &sequence, &flag, &flags) ==FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
- convert_to_long_ex(streamind);
- convert_to_string_ex(sequence);
- convert_to_string_ex(flag);
- if (myargc==4) {
- convert_to_long_ex(flags);
- }
-
- ind = Z_LVAL_PP(streamind);
- imap_le_struct = (pils *) zend_list_find(ind, &ind_type);
- if (!imap_le_struct || !IS_STREAM(ind_type)) {
- php_error(E_WARNING, "Unable to find stream pointer");
- RETURN_FALSE;
- }
- mail_setflag_full(imap_le_struct->imap_stream, Z_STRVAL_PP(sequence), Z_STRVAL_PP(flag), myargc==4 ? Z_LVAL_PP(flags) : NIL);
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int imap_clearflag_full(int stream_id, string sequence, string flag [, int options])
- Clears flags on messages */
-PHP_FUNCTION(imap_clearflag_full)
-{
- zval **streamind, **sequence, **flag, **flags;
- int ind, ind_type;
- pils *imap_le_struct;
- int myargc=ZEND_NUM_ARGS();
-
- if (myargc < 3 || myargc > 4 || zend_get_parameters_ex(myargc, &streamind, &sequence, &flag, &flags) ==FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
- convert_to_long_ex(streamind);
- convert_to_string_ex(sequence);
- convert_to_string_ex(flag);
- if (myargc==4) {
- convert_to_long_ex(flags);
- }
- ind = Z_LVAL_PP(streamind);
- imap_le_struct = (pils *) zend_list_find(ind, &ind_type);
- if (!imap_le_struct || !IS_STREAM(ind_type)) {
- php_error(E_WARNING, "Unable to find stream pointer");
- RETURN_FALSE;
- }
- mail_clearflag_full(imap_le_struct->imap_stream, Z_STRVAL_PP(sequence), Z_STRVAL_PP(flag), myargc==4 ? Z_LVAL_PP(flags) : NIL);
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto array imap_sort(int stream_id, int criteria, int reverse [, int options [, string search_criteria]])
- Sort an array of message headers, optionally including only messages that meet specified criteria. */
-PHP_FUNCTION(imap_sort)
-{
- zval **streamind, **pgm, **rev, **flags, **criteria;
- int ind, ind_type;
- unsigned long *slst, *sl;
- char *search_criteria;
- SORTPGM *mypgm=NIL;
- SEARCHPGM *spg=NIL;
- pils *imap_le_struct;
- int myargc = ZEND_NUM_ARGS();
-
- if (myargc < 3 || myargc > 5 || zend_get_parameters_ex(myargc, &streamind, &pgm, &rev, &flags, &criteria) ==FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
- convert_to_long_ex(streamind);
- convert_to_long_ex(rev);
- convert_to_long_ex(pgm);
- if (Z_LVAL_PP(pgm) > SORTSIZE) {
- php_error(E_WARNING, "Unrecognized sort criteria");
- RETURN_FALSE;
- }
- if (myargc >= 4) {
- convert_to_long_ex(flags);
- }
- if (myargc == 5) {
- search_criteria = estrndup(Z_STRVAL_PP(criteria), Z_STRLEN_PP(criteria));
- spg = mail_criteria(search_criteria);
- efree(search_criteria);
- } else {
- spg = mail_newsearchpgm();
- }
-
- ind = Z_LVAL_PP(streamind);
- imap_le_struct = (pils *) zend_list_find(ind, &ind_type);
- if (!imap_le_struct || !IS_STREAM(ind_type)) {
- php_error(E_WARNING, "Unable to find stream pointer");
- RETURN_FALSE;
- }
- mypgm = mail_newsortpgm();
- mypgm->reverse = Z_LVAL_PP(rev);
- mypgm->function = (short) Z_LVAL_PP(pgm);
- mypgm->next = NIL;
-
- slst = mail_sort(imap_le_struct->imap_stream, NIL, spg, mypgm, myargc >= 4 ? Z_LVAL_PP(flags) : NIL);
- if (spg) {
- mail_free_searchpgm(&spg);
- }
-
- array_init(return_value);
- if (slst != NIL && slst != 0) {
- for (sl = slst; *sl; sl++) {
- add_next_index_long(return_value, *sl);
- }
- fs_give ((void **) &slst);
- }
-}
-/* }}} */
-
-/* {{{ proto string imap_fetchheader(int stream_id, int msg_no [, int options])
- Get the full unfiltered header for a message */
-PHP_FUNCTION(imap_fetchheader)
-{
- zval **streamind, **msgno, **flags;
- int ind, ind_type, msgindex;
- pils *imap_le_struct;
- int myargc = ZEND_NUM_ARGS();
-
- if (myargc < 2 || myargc > 3 || zend_get_parameters_ex(myargc, &streamind, &msgno, &flags) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- convert_to_long_ex(streamind);
- convert_to_long_ex(msgno);
- if (myargc == 3) {
- convert_to_long_ex(flags);
- }
- ind = Z_LVAL_PP(streamind);
-
- imap_le_struct = (pils *) zend_list_find(ind, &ind_type);
- if (!imap_le_struct || !IS_STREAM(ind_type)) {
- php_error(E_WARNING, "Unable to find stream pointer");
- RETURN_FALSE;
- }
-
- if ((myargc == 3) && (Z_LVAL_PP(flags) & FT_UID)) {
- /* This should be cached; if it causes an extra RTT to the
- IMAP server, then that's the price we pay for making sure
- we don't crash. */
- msgindex = mail_msgno(imap_le_struct->imap_stream, Z_LVAL_PP(msgno));
- } else {
- msgindex = Z_LVAL_PP(msgno);
- }
- if ((msgindex < 1) || ((unsigned) msgindex > imap_le_struct->imap_stream->nmsgs)) {
- php_error(E_WARNING, "Bad message number");
- RETURN_FALSE;
- }
-
- RETVAL_STRING(mail_fetchheader_full(imap_le_struct->imap_stream, Z_LVAL_PP(msgno), NIL, NIL, (myargc == 3 ? Z_LVAL_PP(flags) : NIL)), 1);
-}
-/* }}} */
-
-/* {{{ proto int imap_uid(int stream_id, int msg_no)
- Get the unique message id associated with a standard sequential message number */
-PHP_FUNCTION(imap_uid)
-{
- zval **streamind, **msgno;
- int ind, ind_type, msgindex;
- pils *imap_le_struct;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &streamind, &msgno) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- convert_to_long_ex(streamind);
- convert_to_long_ex(msgno);
-
- ind = Z_LVAL_PP(streamind);
-
- imap_le_struct = (pils *) zend_list_find(ind, &ind_type);
-
- if (!imap_le_struct || !IS_STREAM(ind_type)) {
- php_error(E_WARNING, "Unable to find stream pointer");
- RETURN_FALSE;
- }
-
- msgindex = Z_LVAL_PP(msgno);
- if ((msgindex < 1) || ((unsigned) msgindex > imap_le_struct->imap_stream->nmsgs)) {
- php_error(E_WARNING, "Bad message number");
- RETURN_FALSE;
- }
-
- RETURN_LONG(mail_uid(imap_le_struct->imap_stream, Z_LVAL_PP(msgno)));
-}
-/* }}} */
-
-/* {{{ proto int imap_msgno(int stream_id, int unique_msg_id)
- Get the sequence number associated with a UID */
-PHP_FUNCTION(imap_msgno)
-{
- zval **streamind, **msgno;
- int ind, ind_type;
- pils *imap_le_struct;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &streamind, &msgno) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- convert_to_long_ex(streamind);
- convert_to_long_ex(msgno);
-
- ind = Z_LVAL_PP(streamind);
-
- imap_le_struct = (pils *) zend_list_find(ind, &ind_type);
-
- if (!imap_le_struct || !IS_STREAM(ind_type)) {
- php_error(E_WARNING, "Unable to find stream pointer");
- RETURN_FALSE;
- }
-
- RETURN_LONG(mail_msgno(imap_le_struct->imap_stream, Z_LVAL_PP(msgno)));
-}
-/* }}} */
-
-/* {{{ proto object imap_status(int stream_id, string mailbox, int options)
- Get status info from a mailbox */
-PHP_FUNCTION(imap_status)
-{
- zval **streamind, **mbx, **flags;
- int ind, ind_type;
- pils *imap_le_struct;
- int myargc=ZEND_NUM_ARGS();
- IMAPLS_FETCH();
-
- if (myargc != 3 || zend_get_parameters_ex(myargc, &streamind, &mbx, &flags) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- convert_to_long_ex(streamind);
- convert_to_string_ex(mbx);
- convert_to_long_ex(flags);
- ind = Z_LVAL_PP(streamind);
-
- imap_le_struct = (pils *) zend_list_find(ind, &ind_type);
-
- if (!imap_le_struct || !IS_STREAM(ind_type)) {
- php_error(E_WARNING, "Unable to find stream pointer");
- RETURN_FALSE;
- }
-
- if (object_init(return_value) == FAILURE) {
- RETURN_FALSE;
- }
-
- if (mail_status(imap_le_struct->imap_stream, Z_STRVAL_PP(mbx), Z_LVAL_PP(flags))) {
- add_property_long(return_value, "flags", IMAPG(status_flags));
- if (IMAPG(status_flags) & SA_MESSAGES) {
- add_property_long(return_value, "messages", IMAPG(status_messages));
- }
- if (IMAPG(status_flags) & SA_RECENT) {
- add_property_long(return_value, "recent", IMAPG(status_recent));
- }
- if (IMAPG(status_flags) & SA_UNSEEN) {
- add_property_long(return_value, "unseen", IMAPG(status_unseen));
- }
- if (IMAPG(status_flags) & SA_UIDNEXT) {
- add_property_long(return_value, "uidnext", IMAPG(status_uidnext));
- }
- if (IMAPG(status_flags) & SA_UIDVALIDITY) {
- add_property_long(return_value, "uidvalidity", IMAPG(status_uidvalidity));
- }
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto object imap_bodystruct(int stream_id, int msg_no, int section)
- Read the structure of a specified body section of a specific message */
-PHP_FUNCTION(imap_bodystruct)
-{
- zval **streamind, **msg, **section;
- int ind, ind_type;
- pils *imap_le_struct;
- zval *parametres, *param, *dparametres, *dparam;
- PARAMETER *par, *dpar;
- BODY *body;
- int myargc=ZEND_NUM_ARGS();
-
- if (myargc != 3 || zend_get_parameters_ex(myargc, &streamind, &msg, &section) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- convert_to_long_ex(streamind);
- convert_to_long_ex(msg);
- convert_to_string_ex(section);
- ind = Z_LVAL_PP(streamind);
-
- imap_le_struct = (pils *) zend_list_find(ind, &ind_type);
-
- if (!imap_le_struct || !IS_STREAM(ind_type)) {
- php_error(E_WARNING, "Unable to find stream pointer");
- RETURN_FALSE;
- }
-
- if (object_init(return_value) == FAILURE) {
- RETURN_FALSE;
- }
-
- body=mail_body(imap_le_struct->imap_stream, Z_LVAL_PP(msg), Z_STRVAL_PP(section));
- if (body->type <= TYPEMAX) {
- add_property_long(return_value, "type", body->type);
- }
- if (body->encoding <= ENCMAX) {
- add_property_long(return_value, "encoding", body->encoding);
- }
-
- if (body->subtype) {
- add_property_long(return_value, "ifsubtype", 1);
- add_property_string(return_value, "subtype", body->subtype, 1);
- } else {
- add_property_long(return_value, "ifsubtype", 0);
- }
-
- if (body->description) {
- add_property_long(return_value, "ifdescription", 1);
- add_property_string(return_value, "description", body->description, 1);
- } else {
- add_property_long(return_value, "ifdescription", 0);
- }
- if (body->id) {
- add_property_long(return_value, "ifid", 1);
- add_property_string(return_value, "id", body->id, 1);
- } else {
- add_property_long(return_value, "ifid", 0);
- }
-
-
- if (body->size.lines) {
- add_property_long(return_value, "lines", body->size.lines);
- }
- if (body->size.bytes) {
- add_property_long(return_value, "bytes", body->size.bytes);
- }
-#ifdef IMAP41
- if (body->disposition.type) {
- add_property_long(return_value, "ifdisposition", 1);
- add_property_string(return_value, "disposition", body->disposition.type, 1);
- } else {
- add_property_long(return_value, "ifdisposition", 0);
- }
-
- if (body->disposition.parameter) {
- dpar = body->disposition.parameter;
- add_property_long(return_value, "ifdparameters", 1);
- MAKE_STD_ZVAL(dparametres);
- array_init(dparametres);
- do {
- MAKE_STD_ZVAL(dparam);
- object_init(dparam);
- add_property_string(dparam, "attribute", dpar->attribute, 1);
- add_property_string(dparam, "value", dpar->value, 1);
- add_next_index_object(dparametres, dparam);
- } while ((dpar = dpar->next));
- add_assoc_object(return_value, "dparameters", dparametres);
- } else {
- add_property_long(return_value, "ifdparameters", 0);
- }
-#endif
-
- if ((par = body->parameter)) {
- add_property_long(return_value, "ifparameters", 1);
-
- MAKE_STD_ZVAL(parametres);
- array_init(parametres);
- do {
- MAKE_STD_ZVAL(param);
- object_init(param);
- if (par->attribute) {
- add_property_string(param, "attribute", par->attribute, 1);
- }
- if (par->value) {
- add_property_string(param, "value", par->value, 1);
- }
-
- add_next_index_object(parametres, param);
- } while ((par = par->next));
- } else {
- MAKE_STD_ZVAL(parametres);
- object_init(parametres);
- add_property_long(return_value, "ifparameters", 0);
- }
- add_assoc_object(return_value, "parameters", parametres);
-}
-
-/* }}} */
-
-/* {{{ proto array imap_fetch_overview(int stream_id, int msg_no)
- Read an overview of the information in the headers of the given message sequence */
-PHP_FUNCTION(imap_fetch_overview)
-{
- zval **streamind, **sequence, **pflags;
- int ind, ind_type;
- pils *imap_le_struct;
- zval *myoverview;
- char address[MAILTMPLEN];
- long status, flags=0L;
-
- switch (ZEND_NUM_ARGS()) {
- case 2:
- if (zend_get_parameters_ex(2, &streamind, &sequence) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
- break;
- case 3:
- if (zend_get_parameters_ex(3, &streamind, &sequence, &pflags) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- } else {
- convert_to_long_ex(pflags);
- flags = Z_LVAL_PP(pflags);
- }
- break;
- default:
- ZEND_WRONG_PARAM_COUNT();
- break;
- }
-
- convert_to_long_ex(streamind);
- convert_to_string_ex(sequence);
-
- ind = Z_LVAL_PP(streamind);
- imap_le_struct = (pils *) zend_list_find(ind, &ind_type);
-
- if (!imap_le_struct || !IS_STREAM(ind_type)) {
- php_error(E_WARNING, "Unable to find stream pointer");
- RETURN_FALSE;
- }
- array_init(return_value);
-
- status = (flags & FT_UID)
- ? mail_uid_sequence (imap_le_struct->imap_stream, Z_STRVAL_PP(sequence))
- : mail_sequence (imap_le_struct->imap_stream, Z_STRVAL_PP(sequence))
- ;
-
-
- if (status) {
- MESSAGECACHE *elt;
- ENVELOPE *env;
- unsigned long i;
-
- for (i = 1; i <= imap_le_struct->imap_stream->nmsgs; i++) {
- if (((elt = mail_elt (imap_le_struct->imap_stream, i))->sequence) &&
- (env = mail_fetch_structure (imap_le_struct->imap_stream, i, NIL, NIL))) {
- MAKE_STD_ZVAL(myoverview);
- object_init(myoverview);
- if (env->subject) {
- add_property_string(myoverview, "subject", env->subject, 1);
- }
- if (env->from) {
- env->from->next=NULL;
- address[0] = '\0';
- rfc822_write_address(address, env->from);
- add_property_string(myoverview, "from", address, 1);
- }
- if (env->to) {
- env->to->next = NULL;
- address[0] = '\0';
- rfc822_write_address(address, env->to);
- add_property_string(myoverview, "to", address, 1);
- }
- if (env->date) {
- add_property_string(myoverview, "date", env->date, 1);
- }
- if (env->message_id) {
- add_property_string(myoverview, "message_id", env->message_id, 1);
- }
- if (env->references) {
- add_property_string(myoverview, "references", env->references, 1);
- }
- add_property_long(myoverview, "size", elt->rfc822_size);
- add_property_long(myoverview, "uid", mail_uid(imap_le_struct->imap_stream, i));
- add_property_long(myoverview, "msgno", i);
- add_property_long(myoverview, "recent", elt->recent);
- add_property_long(myoverview, "flagged", elt->flagged);
- add_property_long(myoverview, "answered", elt->answered);
- add_property_long(myoverview, "deleted", elt->deleted);
- add_property_long(myoverview, "seen", elt->seen);
- add_property_long(myoverview, "draft", elt->draft);
- add_next_index_object(return_value, myoverview);
- }
- }
- }
-}
-/* }}} */
-
-/* {{{ proto string imap_mail_compose(array envelope, array body)
- Create a MIME message based on given envelope and body sections */
-PHP_FUNCTION(imap_mail_compose)
-{
- zval **envelope, **body;
- char *key;
- zval **data, **pvalue, **disp_data, **env_data;
- ulong ind;
- char *cookie = NIL;
- ENVELOPE *env;
- BODY *bod=NULL, *topbod=NULL;
- PART *mypart=NULL, *toppart=NULL, *part;
- PARAMETER *param, *disp_param = NULL, *custom_headers_param = NULL, *tmp_param = NULL;
- char tmp[8 * MAILTMPLEN], *mystring=NULL, *t=NULL, *tempstring=NULL;
- int myargc = ZEND_NUM_ARGS();
-
- if (myargc != 2 || zend_get_parameters_ex(myargc, &envelope, &body) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- if ((*envelope)->type != IS_ARRAY) {
- php_error(E_WARNING, "IMAP: Expected Array as envelope parameter");
- RETURN_FALSE;
- }
-
- if ((*body)->type != IS_ARRAY) {
- php_error(E_WARNING, "IMAP: Expected Array as body parameter");
- RETURN_FALSE;
- }
-
- env = mail_newenvelope();
- if (zend_hash_find(Z_ARRVAL_PP(envelope), "remail", sizeof("remail"), (void **) &pvalue)== SUCCESS) {
- convert_to_string_ex(pvalue);
- env->remail=cpystr(Z_STRVAL_PP(pvalue));
- }
- if (zend_hash_find(Z_ARRVAL_PP(envelope), "return_path", sizeof("return_path"), (void **) &pvalue)== SUCCESS) {
- convert_to_string_ex(pvalue)
- rfc822_parse_adrlist(&env->return_path, Z_STRVAL_PP(pvalue), "NO HOST");
- }
- if (zend_hash_find(Z_ARRVAL_PP(envelope), "date", sizeof("date"), (void **) &pvalue)== SUCCESS) {
- convert_to_string_ex(pvalue);
- env->date=cpystr(Z_STRVAL_PP(pvalue));
- }
- if (zend_hash_find(Z_ARRVAL_PP(envelope), "from", sizeof("from"), (void **) &pvalue)== SUCCESS) {
- convert_to_string_ex(pvalue);
- rfc822_parse_adrlist (&env->from, Z_STRVAL_PP(pvalue), "NO HOST");
- }
- if (zend_hash_find(Z_ARRVAL_PP(envelope), "reply_to", sizeof("reply_to"), (void **) &pvalue)== SUCCESS) {
- convert_to_string_ex(pvalue);
- rfc822_parse_adrlist (&env->reply_to, Z_STRVAL_PP(pvalue), "NO HOST");
- }
- if (zend_hash_find(Z_ARRVAL_PP(envelope), "in_reply_to", sizeof("in_reply_to"), (void **) &pvalue)== SUCCESS) {
- convert_to_string_ex(pvalue);
- env->in_reply_to=cpystr(Z_STRVAL_PP(pvalue));
- }
- if (zend_hash_find(Z_ARRVAL_PP(envelope), "subject", sizeof("subject"), (void **) &pvalue)== SUCCESS) {
- convert_to_string_ex(pvalue);
- env->subject=cpystr(Z_STRVAL_PP(pvalue));
- }
- if (zend_hash_find(Z_ARRVAL_PP(envelope), "to", sizeof("to"), (void **) &pvalue)== SUCCESS) {
- convert_to_string_ex(pvalue);
- rfc822_parse_adrlist (&env->to, Z_STRVAL_PP(pvalue), "NO HOST");
- }
- if (zend_hash_find(Z_ARRVAL_PP(envelope), "cc", sizeof("cc"), (void **) &pvalue)== SUCCESS) {
- convert_to_string_ex(pvalue);
- rfc822_parse_adrlist (&env->cc, Z_STRVAL_PP(pvalue), "NO HOST");
- }
- if (zend_hash_find(Z_ARRVAL_PP(envelope), "bcc", sizeof("bcc"), (void **) &pvalue)== SUCCESS) {
- convert_to_string_ex(pvalue);
- rfc822_parse_adrlist (&env->bcc, Z_STRVAL_PP(pvalue), "NO HOST");
- }
- if (zend_hash_find(Z_ARRVAL_PP(envelope), "message_id", sizeof("message_id"), (void **) &pvalue)== SUCCESS) {
- convert_to_string_ex(pvalue);
- env->message_id=cpystr(Z_STRVAL_PP(pvalue));
- }
-
- if (zend_hash_find(Z_ARRVAL_PP(envelope), "custom_headers", sizeof("custom_headers"), (void **) &pvalue)== SUCCESS) {
- if (Z_TYPE_PP(pvalue) == IS_ARRAY) {
- custom_headers_param = tmp_param = NULL;
- while (zend_hash_get_current_data(Z_ARRVAL_PP(pvalue), (void **) &env_data) == SUCCESS) {
- custom_headers_param = mail_newbody_parameter();
- convert_to_string_ex(env_data);
- custom_headers_param->value = (char *) fs_get(Z_STRLEN_PP(env_data) + 1);
- memcpy(custom_headers_param->value, Z_STRVAL_PP(env_data), Z_STRLEN_PP(env_data) + 1);
- zend_hash_move_forward(Z_ARRVAL_PP(pvalue));
- custom_headers_param->next = tmp_param;
- tmp_param = custom_headers_param;
- }
- }
- }
-
- zend_hash_internal_pointer_reset(Z_ARRVAL_PP(body));
- zend_hash_get_current_data(Z_ARRVAL_PP(body), (void **) &data);
- zend_hash_get_current_key(Z_ARRVAL_PP(body), &key, &ind, 0); /* FIXME: is this necessary? we're not using key/ind */
-
- if (Z_TYPE_PP(data) == IS_ARRAY) {
- bod = mail_newbody();
- topbod = bod;
-
- if (zend_hash_find(Z_ARRVAL_PP(data), "type", sizeof("type"), (void **) &pvalue)== SUCCESS) {
- convert_to_long_ex(pvalue);
- bod->type = (short) Z_LVAL_PP(pvalue);
- }
- if (zend_hash_find(Z_ARRVAL_PP(data), "encoding", sizeof("encoding"), (void **) &pvalue)== SUCCESS) {
- convert_to_long_ex(pvalue);
- bod->encoding = (short) Z_LVAL_PP(pvalue);
- }
- if (zend_hash_find(Z_ARRVAL_PP(data), "charset", sizeof("charset"), (void **) &pvalue)== SUCCESS) {
- convert_to_string_ex(pvalue);
- tmp_param = mail_newbody_parameter();
- tmp_param->value = cpystr(Z_STRVAL_PP(pvalue));
- tmp_param->attribute = "CHARSET";
- tmp_param->next = bod->parameter;
- bod->parameter = tmp_param;
- }
- if (zend_hash_find(Z_ARRVAL_PP(data), "subtype", sizeof("subtype"), (void **) &pvalue)== SUCCESS) {
- convert_to_string_ex(pvalue);
- bod->subtype = cpystr(Z_STRVAL_PP(pvalue));
- }
- if (zend_hash_find(Z_ARRVAL_PP(data), "id", sizeof("id"), (void **) &pvalue)== SUCCESS) {
- convert_to_string_ex(pvalue);
- bod->id = cpystr(Z_STRVAL_PP(pvalue));
- }
- if (zend_hash_find(Z_ARRVAL_PP(data), "description", sizeof("description"), (void **) &pvalue)== SUCCESS) {
- convert_to_string_ex(pvalue);
- bod->description = cpystr(Z_STRVAL_PP(pvalue));
- }
- if (zend_hash_find(Z_ARRVAL_PP(data), "disposition.type", sizeof("disposition.type"), (void **) &pvalue)== SUCCESS) {
- convert_to_string_ex(pvalue);
- bod->disposition.type = (char *) fs_get(Z_STRLEN_PP(pvalue) + 1);
- memcpy(bod->disposition.type, Z_STRVAL_PP(pvalue), Z_STRLEN_PP(pvalue)+1);
- }
- if (zend_hash_find(Z_ARRVAL_PP(data), "disposition", sizeof("disposition"), (void **) &pvalue)== SUCCESS) {
- if (Z_TYPE_PP(pvalue) == IS_ARRAY) {
- disp_param = tmp_param = NULL;
- while (zend_hash_get_current_data(Z_ARRVAL_PP(pvalue), (void **) &disp_data) == SUCCESS) {
- disp_param = mail_newbody_parameter();
- zend_hash_get_current_key(Z_ARRVAL_PP(pvalue), &key, &ind, 0);
- disp_param->attribute = key;
- convert_to_string_ex(disp_data);
- disp_param->value = (char *) fs_get(Z_STRLEN_PP(disp_data) + 1);
- memcpy(disp_param->value, Z_STRVAL_PP(disp_data), Z_STRLEN_PP(disp_data) + 1);
- zend_hash_move_forward(Z_ARRVAL_PP(pvalue));
- disp_param->next = tmp_param;
- tmp_param = disp_param;
- }
- bod->disposition.parameter = disp_param;
- }
- }
- if (zend_hash_find(Z_ARRVAL_PP(data), "contents.data", sizeof("contents.data"), (void **) &pvalue)== SUCCESS) {
- convert_to_string_ex(pvalue);
- bod->contents.text.data = (char *) fs_get(Z_STRLEN_PP(pvalue) + 1);
- memcpy(bod->contents.text.data, Z_STRVAL_PP(pvalue), Z_STRLEN_PP(pvalue)+1);
- bod->contents.text.size = Z_STRLEN_PP(pvalue);
- }
- if (zend_hash_find(Z_ARRVAL_PP(data), "lines", sizeof("lines"), (void **) &pvalue)== SUCCESS) {
- convert_to_long_ex(pvalue);
- bod->size.lines = Z_LVAL_PP(pvalue);
- }
- if (zend_hash_find(Z_ARRVAL_PP(data), "bytes", sizeof("bytes"), (void **) &pvalue)== SUCCESS) {
- convert_to_long_ex(pvalue);
- bod->size.bytes = Z_LVAL_PP(pvalue);
- }
- if (zend_hash_find(Z_ARRVAL_PP(data), "md5", sizeof("md5"), (void **) &pvalue)== SUCCESS) {
- convert_to_string_ex(pvalue);
- bod->md5 = cpystr(Z_STRVAL_PP(pvalue));
- }
- }
-
- zend_hash_move_forward(Z_ARRVAL_PP(body));
-
- while (zend_hash_get_current_data(Z_ARRVAL_PP(body), (void **) &data) == SUCCESS) {
- zend_hash_get_current_key(Z_ARRVAL_PP(body), &key, &ind, 0); /* FIXME: Is this necessary? We're not using key/ind */
- if (Z_TYPE_PP(data) == IS_ARRAY) {
- if (!toppart) {
- bod->nested.part = mail_newbody_part();
- mypart = bod->nested.part;
- toppart = mypart;
- bod=&mypart->body;
- } else {
- mypart->next = mail_newbody_part();
- mypart = mypart->next;
- bod = &mypart->body;
- }
-
- if (zend_hash_find(Z_ARRVAL_PP(data), "type", sizeof("type"), (void **) &pvalue)== SUCCESS) {
- convert_to_long_ex(pvalue);
- bod->type = (short) Z_LVAL_PP(pvalue);
- }
- if (zend_hash_find(Z_ARRVAL_PP(data), "encoding", sizeof("encoding"), (void **) &pvalue)== SUCCESS) {
- convert_to_long_ex(pvalue);
- bod->encoding = (short) Z_LVAL_PP(pvalue);
- }
- if (zend_hash_find(Z_ARRVAL_PP(data), "charset", sizeof("charset"), (void **) &pvalue)== SUCCESS) {
- convert_to_string_ex(pvalue);
- tmp_param = mail_newbody_parameter();
- tmp_param->value = cpystr(Z_STRVAL_PP(pvalue));
- tmp_param->attribute = "CHARSET";
- tmp_param->next = bod->parameter;
- bod->parameter = tmp_param;
- }
- if (zend_hash_find(Z_ARRVAL_PP(data), "subtype", sizeof("subtype"), (void **) &pvalue)== SUCCESS) {
- convert_to_string_ex(pvalue);
- bod->subtype = cpystr(Z_STRVAL_PP(pvalue));
- }
- if (zend_hash_find(Z_ARRVAL_PP(data), "id", sizeof("id"), (void **) &pvalue)== SUCCESS) {
- convert_to_string_ex(pvalue);
- bod->id = cpystr(Z_STRVAL_PP(pvalue));
- }
- if (zend_hash_find(Z_ARRVAL_PP(data), "description", sizeof("description"), (void **) &pvalue)== SUCCESS) {
- convert_to_string_ex(pvalue);
- bod->description = cpystr(Z_STRVAL_PP(pvalue));
- }
- if (zend_hash_find(Z_ARRVAL_PP(data), "disposition.type", sizeof("disposition.type"), (void **) &pvalue)== SUCCESS) {
- convert_to_string_ex(pvalue);
- bod->disposition.type = (char *) fs_get(Z_STRLEN_PP(pvalue) + 1);
- memcpy(bod->disposition.type, Z_STRVAL_PP(pvalue), Z_STRLEN_PP(pvalue)+1);
- }
- if (zend_hash_find(Z_ARRVAL_PP(data), "disposition", sizeof("disposition"), (void **) &pvalue)== SUCCESS) {
- if (Z_TYPE_PP(pvalue) == IS_ARRAY) {
- disp_param = tmp_param = NULL;
- while (zend_hash_get_current_data(Z_ARRVAL_PP(pvalue), (void **) &disp_data) == SUCCESS) {
- disp_param = mail_newbody_parameter();
- zend_hash_get_current_key(Z_ARRVAL_PP(pvalue), &key, &ind, 0);
- disp_param->attribute = key;
- convert_to_string_ex(disp_data);
- disp_param->value = (char *) fs_get(Z_STRLEN_PP(disp_data) + 1);
- memcpy(disp_param->value, Z_STRVAL_PP(disp_data), Z_STRLEN_PP(disp_data) + 1);
- zend_hash_move_forward(Z_ARRVAL_PP(pvalue));
- disp_param->next = tmp_param;
- tmp_param = disp_param;
- }
- bod->disposition.parameter = disp_param;
- }
- }
- if (zend_hash_find(Z_ARRVAL_PP(data), "contents.data", sizeof("contents.data"), (void **) &pvalue)== SUCCESS) {
- convert_to_string_ex(pvalue);
- bod->contents.text.data = (char *) fs_get(Z_STRLEN_PP(pvalue) + 1);
- memcpy(bod->contents.text.data, Z_STRVAL_PP(pvalue), Z_STRLEN_PP(pvalue) + 1);
- bod->contents.text.size = Z_STRLEN_PP(pvalue);
- }
- if (zend_hash_find(Z_ARRVAL_PP(data), "lines", sizeof("lines"), (void **) &pvalue)== SUCCESS) {
- convert_to_long_ex(pvalue);
- bod->size.lines = Z_LVAL_PP(pvalue);
- }
- if (zend_hash_find(Z_ARRVAL_PP(data), "bytes", sizeof("bytes"), (void **) &pvalue)== SUCCESS) {
- convert_to_long_ex(pvalue);
- bod->size.bytes = Z_LVAL_PP(pvalue);
- }
- if (zend_hash_find(Z_ARRVAL_PP(data), "md5", sizeof("md5"), (void **) &pvalue)== SUCCESS) {
- convert_to_string_ex(pvalue);
- bod->md5 = cpystr(Z_STRVAL_PP(pvalue));
- }
-
- zend_hash_move_forward(Z_ARRVAL_PP(body));
- }
- }
-
- rfc822_encode_body_7bit(env, topbod);
- rfc822_header (tmp, env, topbod);
-
- /* add custom envelope headers */
- if (custom_headers_param) {
- /* remove last CRLF from tmp */
- tmp[strlen(tmp) - 2] = '\0';
- tempstring = emalloc(strlen(tmp) + 1);
- strcpy(tempstring, tmp);
- do {
- tempstring = erealloc(tempstring, strlen(tempstring) + strlen(custom_headers_param->value) + strlen(CRLF) + 1);
- sprintf(tempstring, "%s%s%s", tempstring, custom_headers_param->value, CRLF);
- } while ((custom_headers_param = custom_headers_param->next));
-
- mystring = emalloc(strlen(tempstring) + strlen(CRLF) + 1);
- sprintf(mystring, "%s%s", tempstring, CRLF);
- efree(tempstring);
- } else {
- mystring = emalloc(strlen(tmp) + 1);
- strcpy(mystring, tmp);
- }
-
- bod = topbod;
-
- if (bod && bod->type == TYPEMULTIPART) {
-
- /* first body part */
- part = bod->nested.part;
-
- /* find cookie */
- for (param = bod->parameter; param && !cookie; param = param->next) {
- if (!strcmp (param->attribute, "BOUNDARY")) {
- cookie = param->value;
- }
- }
-
- /* yucky default */
- if (!cookie) {
- cookie = "-";
- }
-
- /* for each part */
- do {
- /* build cookie */
- sprintf (t=tmp, "--%s%s", cookie, CRLF);
-
- /* append mini-header */
- rfc822_write_body_header(&t, &part->body);
-
- /* write terminating blank line */
- strcat (t, CRLF);
-
- /* output cookie, mini-header, and contents */
- tempstring=emalloc(strlen(mystring)+strlen(tmp)+1);
- strcpy(tempstring,mystring);
- efree(mystring);
- mystring=tempstring;
- strcat(mystring,tmp);
-
- bod=&part->body;
-
- tempstring=emalloc(strlen(bod->contents.text.data)+strlen(CRLF)+strlen(mystring)+1);
- strcpy(tempstring,mystring);
- efree(mystring);
- mystring=tempstring;
- sprintf(mystring, "%s%s%s", mystring, bod->contents.text.data, CRLF);
-
- } while ((part = part->next));/* until done */
- /* output trailing cookie */
-
- sprintf(tmp, "--%s--", cookie);
- tempstring=emalloc(strlen(tmp)+strlen(CRLF)+strlen(mystring)+1);
- strcpy(tempstring,mystring);
- efree(mystring);
- mystring=tempstring;
- sprintf(mystring, "%s%s%s", mystring, tmp, CRLF);
-
- } else if (bod) {
-
- tempstring=emalloc(strlen(bod->contents.text.data)+strlen(CRLF)+strlen(mystring)+1);
- strcpy(tempstring,mystring);
- efree(mystring);
- mystring=tempstring;
- sprintf(mystring, "%s%s%s", mystring, bod->contents.text.data, CRLF);
-
- } else {
- efree(mystring);
- RETURN_FALSE;
- }
-
- RETVAL_STRINGL(mystring,strlen(mystring), 1);
- efree(tempstring);
-
-}
-/* }}} */
-
-
-#ifndef PHP_WIN32
-/* {{{ _php_imap_mail
- */
-int _php_imap_mail(char *to, char *subject, char *message, char *headers, char *cc, char *bcc, char* rpath)
-{
-#ifdef PHP_WIN32
- int tsm_err;
-#else
- FILE *sendmail;
- int ret;
-#endif
-
-#ifdef PHP_WIN32
- if (imap_TSendMail(INI_STR("smtp"), &tsm_err, headers, subject, to, message, cc, bcc, rpath) != SUCCESS) {
- php_error(E_WARNING, GetSMErrorText(tsm_err));
- return 0;
- }
-#else
- if (!INI_STR("sendmail_path")) {
- return 0;
- }
- sendmail = popen(INI_STR("sendmail_path"), "w");
- if (sendmail) {
- if (rpath && rpath[0]) fprintf(sendmail, "From: %s\n", rpath);
- fprintf(sendmail, "To: %s\n", to);
- if (cc && cc[0]) fprintf(sendmail, "Cc: %s\n", cc);
- if (bcc && bcc[0]) fprintf(sendmail, "Bcc: %s\n", bcc);
- fprintf(sendmail, "Subject: %s\n", subject);
- if (headers != NULL) {
- fprintf(sendmail, "%s\n", headers);
- }
- fprintf(sendmail, "\n%s\n", message);
- ret = pclose(sendmail);
- if (ret == -1) {
- return 0;
- } else {
- return 1;
- }
- } else {
- php_error(E_WARNING, "Could not execute mail delivery program");
- return 0;
- }
-#endif
- return 1;
-}
-/* }}} */
-#endif
-
-#ifndef PHP_WIN32
-/* {{{ proto int imap_mail(string to, string subject, string message [, string additional_headers [, string cc [, string bcc [, string rpath]]]])
- Send an email message */
-PHP_FUNCTION(imap_mail)
-{
- zval *argv[7];
- char *to=NULL, *message=NULL, *headers=NULL, *subject=NULL, *cc=NULL, *bcc=NULL, *rpath=NULL;
- int argc;
-
- argc = ZEND_NUM_ARGS();
- if (argc < 3 || argc > 7 || zend_get_parameters_array(ht, argc, argv) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
- /* To: */
- convert_to_string(argv[0]);
- if (argv[0]->value.str.val) {
- to = argv[0]->value.str.val;
- } else {
- php_error(E_WARNING, "No to field in mail command");
- RETURN_FALSE;
- }
-
- /* Subject: */
- convert_to_string(argv[1]);
- if (argv[1]->value.str.val) {
- subject = argv[1]->value.str.val;
- } else {
- php_error(E_WARNING, "No subject field in mail command");
- RETURN_FALSE;
- }
-
- /* message body */
- convert_to_string(argv[2]);
- if (argv[2]->value.str.val) {
- message = argv[2]->value.str.val;
- } else {
- /* this is not really an error, so it is allowed. */
- php_error(E_WARNING, "No message string in mail command");
- message = NULL;
- }
-
- /* other headers */
- if (argc > 3) {
- convert_to_string(argv[3]);
- headers = argv[3]->value.str.val;
- }
-
- /* cc */
- if (argc > 4) {
- convert_to_string(argv[4]);
- cc = argv[4]->value.str.val;
- }
-
- /* bcc */
- if (argc > 5) {
- convert_to_string(argv[5]);
- bcc = argv[5]->value.str.val;
- }
-
- /* rpath */
- if (argc > 6) {
- convert_to_string(argv[6]);
- rpath = argv[6]->value.str.val;
- }
-
- if (_php_imap_mail(to, subject, message, headers, cc, bcc, rpath)) {
- RETURN_TRUE;
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-#endif
-
-/* {{{ proto array imap_search(int stream_id, string criteria [, long flags])
- Return a list of messages matching the given criteria */
-PHP_FUNCTION(imap_search)
-{
- zval **streamind, **criteria, **search_flags;
- int ind, ind_type, args;
- pils *imap_le_struct;
- long flags;
- char *search_criteria;
- MESSAGELIST *cur;
- IMAPLS_FETCH();
-
- args = ZEND_NUM_ARGS();
- if (args < 2 || args > 3 || zend_get_parameters_ex(args, &streamind, &criteria, &search_flags) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- convert_to_long_ex(streamind);
- convert_to_string_ex(criteria);
- search_criteria = estrndup(Z_STRVAL_PP(criteria), Z_STRLEN_PP(criteria));
-
- if (args == 2) {
- flags = SE_FREE;
- } else {
- convert_to_long_ex(search_flags);
- flags = Z_LVAL_PP(search_flags);
- }
-
- ind = Z_LVAL_PP(streamind);
- imap_le_struct = (pils *) zend_list_find(ind, &ind_type);
- if (!imap_le_struct || !IS_STREAM(ind_type)) {
- php_error(E_WARNING, "Unable to find stream pointer");
- efree(search_criteria);
- RETURN_FALSE;
- }
-
- IMAPG(imap_messages) = NIL;
- mail_search_full(imap_le_struct->imap_stream, NIL, mail_criteria(search_criteria), flags);
- if (IMAPG(imap_messages) == NIL) {
- efree(search_criteria);
- RETURN_FALSE;
- }
-
- array_init(return_value);
- cur = IMAPG(imap_messages);
- while (cur != NIL) {
- add_next_index_long(return_value, cur->msgid);
- cur = cur->next;
- }
- mail_free_messagelist(&IMAPG(imap_messages));
- efree(search_criteria);
-}
-/* }}} */
-
-/* {{{ proto array imap_alerts(void)
- Returns an array of all IMAP alerts that have been generated since the last page load or since the last imap_alerts() call, whichever came last. The alert stack is cleared after imap_alerts() is called. */
-/* Author: CJH */
-PHP_FUNCTION(imap_alerts)
-{
- STRINGLIST *cur=NIL;
- int arg_count = ZEND_NUM_ARGS();
- IMAPLS_FETCH();
-
- if (arg_count > 0) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- if (IMAPG(imap_alertstack) == NIL) {
- RETURN_FALSE;
- }
-
- array_init(return_value);
- cur = IMAPG(imap_alertstack);
- while (cur != NIL) {
- add_next_index_string(return_value, cur->LTEXT, 1);
- cur = cur->next;
- }
- mail_free_stringlist(&IMAPG(imap_alertstack));
- IMAPG(imap_alertstack) = NIL;
-}
-/* }}} */
-
-/* {{{ proto array imap_errors(void)
- Returns an array of all IMAP errors generated since the last page load, or since the last imap_errors() call, whichever came last. The error stack is cleared after imap_errors() is called. */
-/* Author: CJH */
-PHP_FUNCTION(imap_errors)
-{
- ERRORLIST *cur=NIL;
- int arg_count = ZEND_NUM_ARGS();
- IMAPLS_FETCH();
-
- if (arg_count > 0) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- if (IMAPG(imap_errorstack) == NIL) {
- RETURN_FALSE;
- }
-
- array_init(return_value);
- cur = IMAPG(imap_errorstack);
- while (cur != NIL) {
- add_next_index_string(return_value, cur->LTEXT, 1);
- cur = cur->next;
- }
- mail_free_errorlist(&IMAPG(imap_errorstack));
- IMAPG(imap_errorstack) = NIL;
-}
-/* }}} */
-
-/* {{{ proto string imap_last_error(void)
- Returns the last error that was generated by an IMAP function. The error stack is NOT cleared after this call. */
-/* Author: CJH */
-PHP_FUNCTION(imap_last_error)
-{
- ERRORLIST *cur=NIL;
- int arg_count = ZEND_NUM_ARGS();
- IMAPLS_FETCH();
-
- if (arg_count > 0) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- if (IMAPG(imap_errorstack) == NIL) {
- RETURN_FALSE;
- }
-
- cur = IMAPG(imap_errorstack);
- while (cur != NIL) {
- if (cur->next == NIL) {
- RETURN_STRING(cur->LTEXT, 1);
- }
- cur = cur->next;
- }
-}
-/* }}} */
-
-/* {{{ proto array imap_mime_header_decode(string str)
- Decode mime header element in accordance with RFC 2047 and return array of objects containing 'charset' encoding and decoded 'text' */
-PHP_FUNCTION(imap_mime_header_decode)
-{
- /* Author: Ted Parnefors <ted@mtv.se> */
- zval **str, *myobject;
- char *string, *charset, encoding, *text, *decode;
- long charset_token, encoding_token, end_token, end, offset=0, i;
- unsigned long newlength;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &str) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- convert_to_string_ex(str);
-
- if (array_init(return_value) == FAILURE) {
- RETURN_FALSE;
- }
-
- string = (*str)->value.str.val;
- end = (*str)->value.str.len;
-
- if ((charset = ((char *)emalloc((end + 1) * 2)))) {
- text = &charset[end + 1];
- while (offset < end) { /* Reached end of the string? */
- if ((charset_token = (long)php_memnstr(&string[offset], "=?", 2, string + end))) { /* Is there anything encoded in the string? */
- charset_token -= (long)string;
- if (offset != charset_token) { /* Is there anything before the encoded data? */
- /* Retrieve unencoded data that is found before encoded data */
- memcpy(text, &string[offset], charset_token-offset);
- text[charset_token - offset] = 0x00;
- MAKE_STD_ZVAL(myobject);
- object_init(myobject);
- add_property_string(myobject, "charset", "default", 1);
- add_property_string(myobject, "text", text, 1);
- zend_hash_next_index_insert(return_value->value.ht, (void *)&myobject, sizeof(zval *), NULL);
- }
- if ((encoding_token = (long)php_memnstr(&string[charset_token+2], "?", 1, string+end))) { /* Find token for encoding */
- encoding_token -= (long)string;
- if ((end_token = (long)php_memnstr(&string[encoding_token+3], "?=", 2, string+end))) { /* Find token for end of encoded data */
- end_token -= (long)string;
- memcpy(charset, &string[charset_token + 2], encoding_token - (charset_token + 2)); /* Extract charset encoding */
- charset[encoding_token-(charset_token + 2)] = 0x00;
- encoding=string[encoding_token + 1]; /* Extract encoding from string */
- memcpy(text, &string[encoding_token + 3], end_token - (encoding_token + 3)); /* Extract text */
- text[end_token - (encoding_token + 3)] = 0x00;
- decode = text;
- if (encoding == 'q' || encoding == 'Q') { /* Decode 'q' encoded data */
- for(i=0; text[i] != 0x00; i++) if (text[i] == '_') text[i] = ' '; /* Replace all *_' with space. */
- decode = (char *)rfc822_qprint((unsigned char *) text, strlen(text), &newlength);
- } else if (encoding == 'b' || encoding == 'B') {
- decode = (char *)rfc822_base64((unsigned char *) text, strlen(text), &newlength); /* Decode 'B' encoded data */
- }
- if (decode == NULL) {
- efree(charset);
- zval_dtor(return_value);
- RETURN_FALSE;
- }
- MAKE_STD_ZVAL(myobject);
- object_init(myobject);
- add_property_string(myobject, "charset", charset, 1);
- add_property_string(myobject, "text", decode, 1);
- zend_hash_next_index_insert(return_value->value.ht, (void *)&myobject, sizeof(zval *), NULL);
- fs_give((void**)&decode);
-
- offset = end_token+2;
- for (i = 0; (string[offset + i] == ' ') || (string[offset + i] == 0x0a) || (string[offset + i] == 0x0d); i++);
- if ((string[offset + i] == '=') && (string[offset + i + 1] == '?') && (offset + i < end)) {
- offset += i;
- }
- continue; /*/ Iterate the loop again please. */
- }
- }
- } else {
- /* Just some tweaking to optimize the code, and get the end statements work in a general manner.
- If we end up here we didn't find a position for "charset_token",
- so we need to set it to the start of the yet unextracted data. */
- charset_token = offset;
- }
- /* Return the rest of the data as unencoded, as it was either unencoded or was missing separators
- which rendered the the remainder of the string impossible for us to decode. */
- memcpy(text, &string[charset_token], end - charset_token); /* Extract unencoded text from string */
- text[end - charset_token] = 0x00;
- MAKE_STD_ZVAL(myobject);
- object_init(myobject);
- add_property_string(myobject, "charset", "default", 1);
- add_property_string(myobject, "text", text, 1);
- zend_hash_next_index_insert(return_value->value.ht, (void *)&myobject, sizeof(zval *), NULL);
-
- offset = end; /* We have reached the end of the string. */
- }
- efree(charset);
- } else {
- php_error(E_WARNING, "Unable to allocate temporary memory buffer for imap_mime_header_decode");
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-
-/* Support Functions */
-/* {{{ _php_imap_parse_address
- */
-void _php_imap_parse_address (ADDRESS *addresslist, char *fulladdress, zval *paddress)
-{
- ADDRESS *addresstmp, *addresstmp2;
- char tempaddress[MAILTMPLEN];
- zval *tmpvals;
- int ok = 1;
-
- addresstmp = addresslist;
- fulladdress[0] = 0x00;
- while (ok && addresstmp) { /* while length < 1000 and we are not at the end of the list */
- addresstmp2 = addresstmp->next; /* save the pointer to the next address */
- addresstmp->next = NULL; /* make this address the only one now. */
- tempaddress[0] = '\0'; /* reset tempaddress buffer */
- rfc822_write_address(tempaddress, addresstmp); /* ok, write the address into tempaddress string */
- if ((strlen(tempaddress) + strlen(fulladdress)) < 1000) { /* is the new address + total address < 1000 */
- if (strlen(fulladdress)) {
- strcat(fulladdress, ","); /* put in a comma */
- }
- strcat(fulladdress, tempaddress); /* put in the new address */
- } else { /* no */
- ok = 0; /* stop looping */
- strcat(fulladdress, ", ...");
- } /* DO NOT optimize this out - changing it breaks things */
- addresstmp->next = addresstmp2; /* reset the pointer to the next address first! */
- addresstmp = addresstmp->next;
- }
-
- addresstmp = addresslist;
- do {
- MAKE_STD_ZVAL(tmpvals);
- object_init(tmpvals);
- if (addresstmp->personal) add_property_string(tmpvals, "personal", addresstmp->personal, 1);
- if (addresstmp->adl) add_property_string(tmpvals, "adl", addresstmp->adl, 1);
- if (addresstmp->mailbox) add_property_string(tmpvals, "mailbox", addresstmp->mailbox, 1);
- if (addresstmp->host) add_property_string(tmpvals, "host", addresstmp->host, 1);
- add_next_index_object(paddress, tmpvals);
- } while ((addresstmp = addresstmp->next));
-}
-/* }}} */
-
-/* {{{ _php_make_header_object
- */
-void _php_make_header_object(zval *myzvalue, ENVELOPE *en)
-{
- zval *paddress;
- char fulladdress[MAILTMPLEN];
-
- object_init(myzvalue);
-
- if (en->remail) add_property_string(myzvalue, "remail", en->remail, 1);
- if (en->date) add_property_string(myzvalue, "date", en->date, 1);
- if (en->date) add_property_string(myzvalue, "Date", en->date, 1);
- if (en->subject) add_property_string(myzvalue, "subject", en->subject, 1);
- if (en->subject) add_property_string(myzvalue, "Subject", en->subject, 1);
- if (en->in_reply_to) add_property_string(myzvalue, "in_reply_to", en->in_reply_to, 1);
- if (en->message_id) add_property_string(myzvalue, "message_id", en->message_id, 1);
- if (en->newsgroups) add_property_string(myzvalue, "newsgroups", en->newsgroups, 1);
- if (en->followup_to) add_property_string(myzvalue, "followup_to", en->followup_to, 1);
- if (en->references) add_property_string(myzvalue, "references", en->references, 1);
-
- if (en->to) {
- MAKE_STD_ZVAL(paddress);
- array_init(paddress);
- _php_imap_parse_address(en->to, fulladdress, paddress);
- if (fulladdress) add_property_string(myzvalue, "toaddress", fulladdress, 1);
- add_assoc_object(myzvalue, "to", paddress);
- }
-
- if (en->from) {
- MAKE_STD_ZVAL(paddress);
- array_init(paddress);
- _php_imap_parse_address(en->from, fulladdress, paddress);
- if (fulladdress) add_property_string(myzvalue, "fromaddress", fulladdress, 1);
- add_assoc_object(myzvalue, "from", paddress);
- }
-
- if (en->cc) {
- MAKE_STD_ZVAL(paddress);
- array_init(paddress);
- _php_imap_parse_address(en->cc, fulladdress, paddress);
- if (fulladdress) add_property_string(myzvalue, "ccaddress", fulladdress, 1);
- add_assoc_object(myzvalue, "cc", paddress);
- }
-
- if (en->bcc) {
- MAKE_STD_ZVAL(paddress);
- array_init(paddress);
- _php_imap_parse_address(en->bcc, fulladdress, paddress);
- if (fulladdress) add_property_string(myzvalue, "bccaddress", fulladdress, 1);
- add_assoc_object(myzvalue, "bcc", paddress);
- }
-
- if (en->reply_to) {
- MAKE_STD_ZVAL(paddress);
- array_init(paddress);
- _php_imap_parse_address(en->reply_to, fulladdress, paddress);
- if (fulladdress) add_property_string(myzvalue, "reply_toaddress", fulladdress, 1);
- add_assoc_object(myzvalue, "reply_to", paddress);
- }
-
- if (en->sender) {
- MAKE_STD_ZVAL(paddress);
- array_init(paddress);
- _php_imap_parse_address(en->sender, fulladdress, paddress);
- if (fulladdress) add_property_string(myzvalue, "senderaddress", fulladdress, 1);
- add_assoc_object(myzvalue, "sender", paddress);
- }
-
- if (en->return_path) {
- MAKE_STD_ZVAL(paddress);
- array_init(paddress);
- _php_imap_parse_address(en->return_path, fulladdress, paddress);
- if (fulladdress) add_property_string(myzvalue, "return_pathaddress", fulladdress, 1);
- add_assoc_object(myzvalue, "return_path", paddress);
- }
-
-}
-/* }}} */
-
-/* {{{ _php_imap_add_body
- */
-void _php_imap_add_body(zval *arg, BODY *body)
-{
- zval *parametres, *param, *dparametres, *dparam;
- PARAMETER *par, *dpar;
- PART *part;
-
- if (body->type <= TYPEMAX) {
- add_property_long(arg, "type", body->type);
- }
- if (body->encoding <= ENCMAX) {
- add_property_long(arg, "encoding", body->encoding);
- }
-
- if (body->subtype) {
- add_property_long(arg, "ifsubtype", 1);
- add_property_string(arg, "subtype", body->subtype, 1);
- } else {
- add_property_long(arg, "ifsubtype", 0);
- }
-
- if (body->description) {
- add_property_long(arg, "ifdescription", 1);
- add_property_string(arg, "description", body->description, 1);
- } else {
- add_property_long(arg, "ifdescription", 0);
- }
- if (body->id) {
- add_property_long(arg, "ifid", 1);
- add_property_string(arg, "id", body->id, 1);
- } else {
- add_property_long(arg, "ifid", 0);
- }
-
- if (body->size.lines) {
- add_property_long(arg, "lines", body->size.lines);
- }
- if (body->size.bytes) {
- add_property_long(arg, "bytes", body->size.bytes);
- }
-#ifdef IMAP41
- if (body->disposition.type) {
- add_property_long(arg, "ifdisposition", 1);
- add_property_string(arg, "disposition", body->disposition.type, 1);
- } else {
- add_property_long(arg, "ifdisposition", 0);
- }
-
- if (body->disposition.parameter) {
- dpar = body->disposition.parameter;
- add_property_long(arg, "ifdparameters", 1);
- MAKE_STD_ZVAL(dparametres);
- array_init(dparametres);
- do {
- MAKE_STD_ZVAL(dparam);
- object_init(dparam);
- add_property_string(dparam, "attribute", dpar->attribute, 1);
- add_property_string(dparam, "value", dpar->value, 1);
- add_next_index_object(dparametres, dparam);
- } while ((dpar = dpar->next));
- add_assoc_object(arg, "dparameters", dparametres);
- } else {
- add_property_long(arg, "ifdparameters", 0);
- }
-#endif
-
- if ((par = body->parameter)) {
- add_property_long(arg, "ifparameters", 1);
-
- MAKE_STD_ZVAL(parametres);
- array_init(parametres);
- do {
- MAKE_STD_ZVAL(param);
- object_init(param);
- if (par->attribute) {
- add_property_string(param, "attribute", par->attribute, 1);
- }
- if (par->value) {
- add_property_string(param, "value", par->value, 1);
- }
-
- add_next_index_object(parametres, param);
- } while ((par = par->next));
- } else {
- MAKE_STD_ZVAL(parametres);
- object_init(parametres);
- add_property_long(arg, "ifparameters", 0);
- }
- add_assoc_object(arg, "parameters", parametres);
-
- /* multipart message ? */
- if (body->type == TYPEMULTIPART) {
- MAKE_STD_ZVAL(parametres);
- array_init(parametres);
- for (part = body->CONTENT_PART; part; part = part->next) {
- MAKE_STD_ZVAL(param);
- object_init(param);
- _php_imap_add_body(param, &part->body);
- add_next_index_object(parametres, param);
- }
- add_assoc_object(arg, "parts", parametres);
- }
-
- /* encapsulated message ? */
- if ((body->type == TYPEMESSAGE) && (!strcasecmp(body->subtype, "rfc822"))) {
- body = body->CONTENT_MSG_BODY;
- MAKE_STD_ZVAL(parametres);
- array_init(parametres);
- MAKE_STD_ZVAL(param);
- object_init(param);
- _php_imap_add_body(param, body);
- add_next_index_object(parametres, param);
- add_assoc_object(arg, "parts", parametres);
- }
-}
-/* }}} */
-
-/* Interfaces to C-client */
-void mm_searched(MAILSTREAM *stream,unsigned long number)
-{
- MESSAGELIST *cur = NIL;
- IMAPLS_FETCH();
-
- if (IMAPG(imap_messages) == NIL) {
- IMAPG(imap_messages) = mail_newmessagelist();
- IMAPG(imap_messages)->msgid = number;
- IMAPG(imap_messages)->next = NIL;
- } else {
- cur = IMAPG(imap_messages);
- while (cur->next != NIL) {
- cur = cur->next;
- }
- cur->next = mail_newmessagelist();
- cur = cur->next;
- cur->msgid = number;
- cur->next = NIL;
- }
-}
-
-void mm_exists(MAILSTREAM *stream,unsigned long number)
-{
-}
-
-void mm_expunged(MAILSTREAM *stream,unsigned long number)
-{
-}
-
-void mm_flags(MAILSTREAM *stream,unsigned long number)
-{
-}
-
-/* Author: CJH */
-void mm_notify(MAILSTREAM *stream, char *str, long errflg)
-{
- STRINGLIST *cur = NIL;
- IMAPLS_FETCH();
-
- if (strncmp(str, "[ALERT] ", 8) == 0) {
- if (IMAPG(imap_alertstack) == NIL) {
- IMAPG(imap_alertstack) = mail_newstringlist();
- IMAPG(imap_alertstack)->LSIZE = strlen(IMAPG(imap_alertstack)->LTEXT = cpystr(str));
- IMAPG(imap_alertstack)->next = NIL;
- } else {
- cur = IMAPG(imap_alertstack);
- while (cur->next != NIL) {
- cur = cur->next;
- }
- cur->next = mail_newstringlist ();
- cur = cur->next;
- cur->LSIZE = strlen(cur->LTEXT = cpystr(str));
- cur->next = NIL;
- }
- }
-}
-
-void mm_list(MAILSTREAM *stream,DTYPE delimiter, char *mailbox, long attributes)
-{
- STRINGLIST *cur=NIL;
- FOBJECTLIST *ocur=NIL;
- IMAPLS_FETCH();
-
- if (IMAPG(folderlist_style) == FLIST_OBJECT) {
- /* build up a the new array of objects */
- /* Author: CJH */
- if (IMAPG(imap_folder_objects) == NIL) {
- IMAPG(imap_folder_objects) = mail_newfolderobjectlist();
- IMAPG(imap_folder_objects)->LSIZE=strlen(IMAPG(imap_folder_objects)->LTEXT=cpystr(mailbox));
- IMAPG(imap_folder_objects)->delimiter = delimiter;
- IMAPG(imap_folder_objects)->attributes = attributes;
- IMAPG(imap_folder_objects)->next = NIL;
- } else {
- ocur=IMAPG(imap_folder_objects);
- while (ocur->next != NIL) {
- ocur=ocur->next;
- }
- ocur->next=mail_newfolderobjectlist();
- ocur=ocur->next;
- ocur->LSIZE = strlen(ocur->LTEXT = cpystr(mailbox));
- ocur->delimiter = delimiter;
- ocur->attributes = attributes;
- ocur->next = NIL;
- }
-
- } else {
- /* build the old IMAPG(imap_folders) variable to allow old imap_listmailbox() to work */
- if (!(attributes & LATT_NOSELECT)) {
- if (IMAPG(imap_folders) == NIL) {
- IMAPG(imap_folders)=mail_newstringlist();
- IMAPG(imap_folders)->LSIZE=strlen(IMAPG(imap_folders)->LTEXT=cpystr(mailbox));
- IMAPG(imap_folders)->next=NIL;
- } else {
- cur=IMAPG(imap_folders);
- while (cur->next != NIL) {
- cur=cur->next;
- }
- cur->next=mail_newstringlist ();
- cur=cur->next;
- cur->LSIZE = strlen (cur->LTEXT = cpystr (mailbox));
- cur->next = NIL;
- }
- }
- }
-}
-
-void mm_lsub(MAILSTREAM *stream,DTYPE delimiter, char *mailbox, long attributes)
-{
- STRINGLIST *cur=NIL;
- FOBJECTLIST *ocur=NIL;
- IMAPLS_FETCH();
-
- if (IMAPG(folderlist_style) == FLIST_OBJECT) {
- /* build the array of objects */
- /* Author: CJH */
- if (IMAPG(imap_sfolder_objects) == NIL) {
- IMAPG(imap_sfolder_objects) = mail_newfolderobjectlist();
- IMAPG(imap_sfolder_objects)->LSIZE=strlen(IMAPG(imap_sfolder_objects)->LTEXT=cpystr(mailbox));
- IMAPG(imap_sfolder_objects)->delimiter = delimiter;
- IMAPG(imap_sfolder_objects)->attributes = attributes;
- IMAPG(imap_sfolder_objects)->next = NIL;
- } else {
- ocur=IMAPG(imap_sfolder_objects);
- while (ocur->next != NIL) {
- ocur=ocur->next;
- }
- ocur->next=mail_newfolderobjectlist();
- ocur=ocur->next;
- ocur->LSIZE=strlen(ocur->LTEXT = cpystr(mailbox));
- ocur->delimiter = delimiter;
- ocur->attributes = attributes;
- ocur->next = NIL;
- }
- } else {
- /* build the old simple array for imap_listsubscribed() */
- if (IMAPG(imap_sfolders) == NIL) {
- IMAPG(imap_sfolders)=mail_newstringlist();
- IMAPG(imap_sfolders)->LSIZE=strlen(IMAPG(imap_sfolders)->LTEXT=cpystr(mailbox));
- IMAPG(imap_sfolders)->next=NIL;
- } else {
- cur=IMAPG(imap_sfolders);
- while (cur->next != NIL) {
- cur=cur->next;
- }
- cur->next=mail_newstringlist ();
- cur=cur->next;
- cur->LSIZE = strlen (cur->LTEXT = cpystr (mailbox));
- cur->next = NIL;
- }
- }
-}
-
-void mm_status(MAILSTREAM *stream, char *mailbox,MAILSTATUS *status)
-{
- IMAPLS_FETCH();
-
- IMAPG(status_flags)=status->flags;
- if (IMAPG(status_flags) & SA_MESSAGES) {
- IMAPG(status_messages)=status->messages;
- }
- if (IMAPG(status_flags) & SA_RECENT) {
- IMAPG(status_recent)=status->recent;
- }
- if (IMAPG(status_flags) & SA_UNSEEN) {
- IMAPG(status_unseen)=status->unseen;
- }
- if (IMAPG(status_flags) & SA_UIDNEXT) {
- IMAPG(status_uidnext)=status->uidnext;
- }
- if (IMAPG(status_flags) & SA_UIDVALIDITY) {
- IMAPG(status_uidvalidity)=status->uidvalidity;
- }
-}
-
-void mm_log(char *str, long errflg)
-{
- ERRORLIST *cur = NIL;
- IMAPLS_FETCH();
-
- /* Author: CJH */
- if (errflg != NIL) { /* CJH: maybe put these into a more comprehensive log for debugging purposes? */
- if (IMAPG(imap_errorstack) == NIL) {
- IMAPG(imap_errorstack) = mail_newerrorlist();
- IMAPG(imap_errorstack)->LSIZE = strlen(IMAPG(imap_errorstack)->LTEXT = cpystr(str));
- IMAPG(imap_errorstack)->errflg = errflg;
- IMAPG(imap_errorstack)->next = NIL;
- } else {
- cur = IMAPG(imap_errorstack);
- while (cur->next != NIL) {
- cur = cur->next;
- }
- cur->next = mail_newerrorlist();
- cur = cur->next;
- cur->LSIZE = strlen(cur->LTEXT = cpystr(str));
- cur->errflg = errflg;
- cur->next = NIL;
- }
- }
-}
-
-void mm_dlog(char *str)
-{
- /* CJH: this is for debugging; it might be useful to allow setting
- the stream to debug mode and capturing this somewhere - syslog?
- php debugger? */
-}
-
-void mm_login(NETMBX *mb, char *user, char *pwd, long trial)
-{
- IMAPLS_FETCH();
-
- if (*mb->user) {
- strlcpy (user,mb->user, MAILTMPLEN);
- } else {
- strlcpy (user, IMAPG(imap_user), MAILTMPLEN);
- }
- strlcpy (pwd, IMAPG(imap_password), MAILTMPLEN);
-}
-
-void mm_critical(MAILSTREAM *stream)
-{
-}
-
-void mm_nocritical(MAILSTREAM *stream)
-{
-}
-
-long mm_diskerror(MAILSTREAM *stream, long errcode, long serious)
-{
- return 1;
-}
-
-void mm_fatal(char *str)
-{
-}
-
-/* Added imap_thread functionality */
-/* stealing this from header cclient -rjs3 */
-THREADNODE *imap_thread (MAILSTREAM *stream,char *type,char *charset,
- SEARCHPGM *spg,long flags);
-
-void build_thread_tree_helper(THREADNODE *cur, zval *tree, long *numNodes, char *buf) {
- unsigned long thisNode = *numNodes;
-
- /* define "#.num" */
- snprintf(buf,25,"%ld.num", thisNode);
-
- add_assoc_long(tree,buf,cur->num);
-
- snprintf(buf,25,"%ld.next", thisNode);
- if(cur->next) {
- (*numNodes)++;
- add_assoc_long(tree,buf,*numNodes);
- build_thread_tree_helper(cur->next, tree, numNodes, buf);
- } else { /* "null pointer" */
- add_assoc_long(tree,buf,0);
- }
-
- snprintf(buf,25,"%ld.branch", thisNode);
- if(cur->branch) {
- (*numNodes)++;
- add_assoc_long(tree,buf,*numNodes);
- build_thread_tree_helper(cur->branch, tree, numNodes, buf);
- } else { /* "null pointer" */
- add_assoc_long(tree,buf,0);
- }
-}
-
-int build_thread_tree(THREADNODE *top, zval **tree) {
- long numNodes = 0;
- char buf[25];
-
- if(array_init(*tree) != SUCCESS) return FAILURE;
-
- build_thread_tree_helper(top, *tree, &numNodes, buf);
-
- return SUCCESS;
-}
-
-/* {{{ proto int imap_thread(int stream_id)
- Return threaded by REFERENCES tree */
-PHP_FUNCTION (imap_thread)
-{
- pval *streamind, *search_flags;
- int ind, ind_type, args;
- pils *imap_le_struct;
- long flags;
- char criteria[] = "ALL";
- THREADNODE *top;
-
- if(!return_value_used) {
- php_error(E_WARNING, "imap_thread does not make use of return value");
- RETURN_FALSE;
- }
-
- args = ARG_COUNT(ht);
- if ( args < 1 || args > 2
- || getParameters(ht, args, &streamind, &search_flags) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(streamind);
-
- if (args == 1) {
- flags = SE_FREE;
- } else {
- convert_to_long(search_flags);
- flags = search_flags->value.lval;
- }
-
- ind = streamind->value.lval;
- imap_le_struct = (pils *)zend_list_find(ind, &ind_type);
- if (!imap_le_struct || !IS_STREAM(ind_type)) {
- php_error(E_WARNING, "Unable to find stream pointer");
- RETURN_FALSE;
- }
-
- top = mail_thread(imap_le_struct->imap_stream,
- "REFERENCES", NIL, mail_criteria(criteria), flags);
-
- if(top == NIL) {
- php_error(E_WARNING, "imap_thread returned an empty tree");
- RETURN_FALSE;
- }
-
- /* Populate our return value data structure here. */
- if(build_thread_tree(top, &return_value) == FAILURE){
- mail_free_threadnode(&top);
- RETURN_FALSE;
- }
-
- mail_free_threadnode(&top);
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/imap/php_imap.h b/ext/imap/php_imap.h
deleted file mode 100644
index a67eed086b..0000000000
--- a/ext/imap/php_imap.h
+++ /dev/null
@@ -1,196 +0,0 @@
-#ifndef PHP_IMAP_H
-#define PHP_IMAP_H
-
-
-#ifndef PHP_WIN32
-#include "build-defs.h"
-#endif
-
-#ifdef HAVE_IMAP2000
- /* these are used for quota support */
- #include "c-client.h" /* includes mail.h and rfc822.h */
- #include "imap4r1.h" /* location of c-client quota functions */
-#else
- #include "mail.h"
- #include "rfc822.h"
-#endif
-
-#include "zend_modules.h"
-
-extern zend_module_entry imap_module_entry;
-#define imap_module_ptr &imap_module_entry
-
-
-/* Data types */
-
-#ifdef IMAP41
-#define LSIZE text.size
-#define LTEXT text.data
-#define DTYPE int
-#define CONTENT_PART nested.part
-#define CONTENT_MSG_BODY nested.msg->body
-#define IMAPVER "Imap 4R1"
-#else
-#define LSIZE size
-#define LTEXT text
-#define DTYPE char
-#define CONTENT_PART contents.part
-#define CONTENT_MSG_BODY contents.msg.body
-#define IMAPVER "Imap 4"
-#endif
-
-
-/* Determines how mm_list() and mm_lsub() are to return their results. */
-typedef enum {
- FLIST_ARRAY,
- FLIST_OBJECT
-} folderlist_style_t;
-
-typedef struct php_imap_le_struct {
- MAILSTREAM *imap_stream;
- long flags;
-#ifdef OP_RELOGIN
- /* AJS: busy flag for persistent connections, pointers for chaining */
- struct php_imap_le_struct *next;
- struct php_imap_le_struct **prev;
- char busy;
-#endif
-} pils;
-
-typedef struct php_imap_mailbox_struct {
- SIZEDTEXT text;
- DTYPE delimiter;
- long attributes;
- struct php_imap_mailbox_struct *next;
-} FOBJECTLIST;
-
-typedef struct php_imap_error_struct {
- SIZEDTEXT text;
- long errflg;
- struct php_imap_error_struct *next;
-} ERRORLIST;
-
-
-typedef struct _php_imap_message_struct {
- unsigned long msgid;
- struct _php_imap_message_struct *next;
-} MESSAGELIST;
-
-
-
-/* Functions */
-
-PHP_MINIT_FUNCTION(imap);
-PHP_RINIT_FUNCTION(imap);
-PHP_RSHUTDOWN_FUNCTION(imap);
-PHP_MINFO_FUNCTION(imap);
-PHP_FUNCTION(imap_open);
-PHP_FUNCTION(imap_popen);
-PHP_FUNCTION(imap_reopen);
-PHP_FUNCTION(imap_num_msg);
-PHP_FUNCTION(imap_num_recent);
-PHP_FUNCTION(imap_headers);
-PHP_FUNCTION(imap_headerinfo);
-PHP_FUNCTION(imap_rfc822_parse_headers);
-PHP_FUNCTION(imap_body);
-PHP_FUNCTION(imap_fetchstructure);
-PHP_FUNCTION(imap_fetchbody);
-PHP_FUNCTION(imap_expunge);
-PHP_FUNCTION(imap_delete);
-PHP_FUNCTION(imap_undelete);
-PHP_FUNCTION(imap_check);
-PHP_FUNCTION(imap_close);
-PHP_FUNCTION(imap_mail_copy);
-PHP_FUNCTION(imap_mail_move);
-PHP_FUNCTION(imap_createmailbox);
-PHP_FUNCTION(imap_renamemailbox);
-PHP_FUNCTION(imap_deletemailbox);
-PHP_FUNCTION(imap_listmailbox);
-PHP_FUNCTION(imap_scanmailbox);
-#ifdef HAVE_IMAP2000
-PHP_FUNCTION(imap_get_quota);
-PHP_FUNCTION(imap_set_quota);
-#endif
-PHP_FUNCTION(imap_subscribe);
-PHP_FUNCTION(imap_unsubscribe);
-PHP_FUNCTION(imap_append);
-PHP_FUNCTION(imap_ping);
-PHP_FUNCTION(imap_base64);
-PHP_FUNCTION(imap_qprint);
-PHP_FUNCTION(imap_8bit);
-PHP_FUNCTION(imap_binary);
-PHP_FUNCTION(imap_mailboxmsginfo);
-PHP_FUNCTION(imap_rfc822_write_address);
-PHP_FUNCTION(imap_rfc822_parse_adrlist);
-PHP_FUNCTION(imap_setflag_full);
-PHP_FUNCTION(imap_clearflag_full);
-PHP_FUNCTION(imap_sort);
-PHP_FUNCTION(imap_fetchheader);
-PHP_FUNCTION(imap_fetchtext);
-PHP_FUNCTION(imap_uid);
-PHP_FUNCTION(imap_msgno);
-PHP_FUNCTION(imap_list);
-PHP_FUNCTION(imap_list_full);
-PHP_FUNCTION(imap_listscan);
-PHP_FUNCTION(imap_lsub);
-PHP_FUNCTION(imap_lsub_full);
-PHP_FUNCTION(imap_create);
-PHP_FUNCTION(imap_rename);
-PHP_FUNCTION(imap_status);
-PHP_FUNCTION(imap_bodystruct);
-PHP_FUNCTION(imap_fetch_overview);
-PHP_FUNCTION(imap_mail_compose);
-PHP_FUNCTION(imap_alerts);
-PHP_FUNCTION(imap_errors);
-PHP_FUNCTION(imap_last_error);
-PHP_FUNCTION(imap_mail);
-PHP_FUNCTION(imap_search);
-PHP_FUNCTION(imap_utf8);
-PHP_FUNCTION(imap_utf7_decode);
-PHP_FUNCTION(imap_utf7_encode);
-PHP_FUNCTION(imap_mime_header_decode);
-PHP_FUNCTION(imap_thread);
-
-ZEND_BEGIN_MODULE_GLOBALS(imap)
- char *imap_user;
- char *imap_password;
- STRINGLIST *imap_folders;
- STRINGLIST *imap_sfolders;
- STRINGLIST *imap_alertstack;
- ERRORLIST *imap_errorstack;
- MESSAGELIST *imap_messages;
- FOBJECTLIST *imap_folder_objects;
- FOBJECTLIST *imap_sfolder_objects;
- folderlist_style_t folderlist_style;
- long status_flags;
- unsigned long status_messages;
- unsigned long status_recent;
- unsigned long status_unseen;
- unsigned long status_uidnext;
- unsigned long status_uidvalidity;
-#ifdef HAVE_IMAP2000
- unsigned long quota_usage;
- unsigned long quota_limit;
-#endif
-ZEND_END_MODULE_GLOBALS(imap)
-
-
-#ifdef ZTS
-# define IMAPLS_D zend_imap_globals *imap_globals
-# define IMAPLS_DC , IMAPLS_D
-# define IMAPLS_C imap_globals
-# define IMAPLS_CC , IMAPLS_C
-# define IMAPG(v) (imap_globals->v)
-# define IMAPLS_FETCH() zend_imap_globals *imap_globals = ts_resource(imap_globals_id)
-#else
-# define IMAPLS_D
-# define IMAPLS_DC
-# define IMAPLS_C
-# define IMAPLS_CC
-# define IMAPG(v) (imap_globals.v)
-# define IMAPLS_FETCH()
-#endif
-
-#define phpext_imap_ptr imap_module_ptr
-
-#endif
diff --git a/ext/imap/setup.stub b/ext/imap/setup.stub
deleted file mode 100644
index afc77dd90e..0000000000
--- a/ext/imap/setup.stub
+++ /dev/null
@@ -1,7 +0,0 @@
-# $Source$
-# $Id$
-
-define_option with-imap 'IMAP support?' yesnodir \
- 'no /usr/local/imap IMAP base install' \
-' Whether to build with IMAP (Internet Message Access Protocol)\n
- support.\n'
diff --git a/ext/informix/CREDITS b/ext/informix/CREDITS
deleted file mode 100644
index 993073bad4..0000000000
--- a/ext/informix/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-Informix
-Danny Heijl, Christian Cartus
diff --git a/ext/informix/Makefile.in b/ext/informix/Makefile.in
deleted file mode 100644
index 50b78101c6..0000000000
--- a/ext/informix/Makefile.in
+++ /dev/null
@@ -1,20 +0,0 @@
-
-LTLIBRARY_NAME = libinformix.la
-LTLIBRARY_SOURCES = ifx.c
-LTLIBRARY_SHARED_NAME = informix.la
-LTLIBRARY_SHARED_LIBADD = $(INFORMIX_SHARED_LIBADD)
-CLEANFILES = ifx.c libphpifx.a
-
-include $(top_srcdir)/build/dynlib.mk
-
-ifx.c: $(srcdir)/ifx.ec
- (if test -d $(INFORMIXDIR); then \
- $(INFORMIXDIR)/bin/esql -e $(IFX_ESQL_FLAGS) $(srcdir)/ifx.ec; \
- else \
- touch ifx.c; \
- fi)
-
-libphpifx.a:
- $(LINK) $(IFX_LIBOBJS)
-
-all: libphpifx.a
diff --git a/ext/informix/config.m4 b/ext/informix/config.m4
deleted file mode 100644
index 7bf9180b02..0000000000
--- a/ext/informix/config.m4
+++ /dev/null
@@ -1,74 +0,0 @@
-dnl $Id$
-
-PHP_ARG_WITH(informix,for Informix support,
-[ --with-informix[=DIR] Include Informix support. DIR is the Informix base
- install directory, defaults to ${INFORMIXDIR:-nothing}.])
-
-if test "$PHP_INFORMIX" != "no"; then
-
- PHP_EXTENSION(informix, $ext_shared)
- PHP_SUBST(INFORMIX_SHARED_LIBADD)
-
- if test "$INFORMIXDIR" = ""; then
- AC_MSG_ERROR([INFORMIXDIR environment variable is not set.])
- fi
-
- if test "$PHP_INFORMIX" = "yes"; then
- PHP_ADD_INCLUDE($INFORMIXDIR/incl/esql)
- PHP_ADD_LIBPATH($INFORMIXDIR/lib, INFORMIX_SHARED_LIBADD)
- PHP_ADD_LIBPATH($INFORMIXDIR/lib/esql, INFORMIX_SHARED_LIBADD)
- else
- if test "$PHP_INFORMIX" != "$INFORMIXDIR"; then
- AC_MSG_ERROR([Specified Informix base install directory is different than your INFORMIXDIR environment variable.])
- fi
- PHP_ADD_INCLUDE($PHP_INFORMIX/incl/esql)
- PHP_ADD_LIBPATH($PHP_INFORMIX/lib, INFORMIX_SHARED_LIBADD)
- PHP_ADD_LIBPATH($PHP_INFORMIX/lib/esql, INFORMIX_SHARED_LIBADD)
- fi
-
- IFX_LIBS=`$INFORMIXDIR/bin/esql -libs -shared | sed -e 's/-lm$//'`
- dnl -lm twice otherwise?
- IFX_LIBS=`echo $IFX_LIBS | sed -e 's/Libraries to be used://g' -e 's/esql: error -55923: No source or object file\.//g'`
- dnl Seems to get rid of newlines.
- dnl According to Perls DBD-Informix, might contain these strings.
-
- case "$host_alias" in
- *aix*)
- CPPFLAGS="$CPPFLAGS -D__H_LOCALEDEF";;
- esac
-
- AC_MSG_CHECKING([Informix version])
- IFX_VERSION=[`$INFORMIXDIR/bin/esql -V | sed -ne '1 s/^[^0-9]*\([0-9]\)\.\([0-9]*\).*/\1\2/p'`]
- AC_MSG_RESULT($IFX_VERSION)
- AC_DEFINE_UNQUOTED(IFX_VERSION, $IFX_VERSION, [ ])
-
- if test $IFX_VERSION -ge "900"; then
- AC_DEFINE(HAVE_IFX_IUS,1,[ ])
- IFX_ESQL_FLAGS="-EDHAVE_IFX_IUS"
- else
- IFX_ESQL_FLAGS="-EUHAVE_IFX_IUS"
- fi
- PHP_SUBST(IFX_ESQL_FLAGS)
-
- for i in $IFX_LIBS; do
- case "$i" in
- *.o)
- IFX_LIBOBJS="$IFX_LIBOBJS $i"
- PHP_ADD_LIBPATH($ext_builddir, INFORMIX_SHARED_LIBADD)
- PHP_ADD_LIBRARY_DEFER(phpifx, 1, INFORMIX_SHARED_LIBADD)
- ;;
- -l*)
- lib=`echo $i|sed -e "s/^-l//"`
- PHP_ADD_LIBRARY_DEFER($lib, 1, INFORMIX_SHARED_LIBADD)
- ;;
- *.a)
- lib=`echo $i|sed -e "s#^/.*/lib##g;s#\.a##g"`
- PHP_ADD_LIBRARY_DEFER($lib, 1, INFORMIX_SHARED_LIBADD)
- ;;
- esac
- done
-
- AC_DEFINE(HAVE_IFX,1,[ ])
- PHP_SUBST(INFORMIXDIR)
- PHP_SUBST(IFX_LIBOBJS)
-fi
diff --git a/ext/informix/ifx.dsp b/ext/informix/ifx.dsp
deleted file mode 100644
index 34d8922c03..0000000000
--- a/ext/informix/ifx.dsp
+++ /dev/null
@@ -1,134 +0,0 @@
-# Microsoft Developer Studio Project File - Name="ifx" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=ifx - Win32 Debug_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "ifx.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "ifx.mak" CFG="ifx - Win32 Debug_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "ifx - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "ifx - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "ifx - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "..\..\Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "..\..\Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
-# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\..\main" /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL" /D HAVE_IFX=1 /D HAVE_IUS=1 /D "ZTS" /D ZEND_WIN32=1 /D PHP_WIN32=1 /D IFX_VERSION=921 /D COMPILE_DL_INFORMIX=1 /D ZEND_DEBUG=0 /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
-# ADD BASE RSC /l 0x406 /d "NDEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386
-# ADD LINK32 isqlt09a.lib php4ts.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 /out:"..\..\Release_TS/php_ifx.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
-
-!ELSEIF "$(CFG)" == "ifx - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "ifx___W0"
-# PROP BASE Intermediate_Dir "ifx___W0"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
-# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\..\main" /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /D "_DEBUG" /D ZEND_DEBUG=1 /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL" /D HAVE_IFX=1 /D HAVE_IUS=1 /D "ZTS" /D ZEND_WIN32=1 /D PHP_WIN32=1 /D IFX_VERSION=921 /D COMPILE_DL_INFORMIX=1 /YX /FD /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
-# ADD BASE RSC /l 0x406 /d "_DEBUG"
-# ADD RSC /l 0x406 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 isqlt09a.lib php4ts_debug.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /out:"Debug_TS/php_ifx.dll" /pdbtype:sept /libpath:"..\..\Debug_TS"
-
-!ENDIF
-
-# Begin Target
-
-# Name "ifx - Win32 Release_TS"
-# Name "ifx - Win32 Debug_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\ifx.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\ifx.ec
-
-!IF "$(CFG)" == "ifx - Win32 Release_TS"
-
-# Begin Custom Build
-InputPath=.\ifx.ec
-
-".\ifx.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- esql.exe -dcmdl -p -G -subsystem:windows -thread -I..\.. ifx.ec
-
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "ifx - Win32 Debug_TS"
-
-# Begin Custom Build
-InputPath=.\ifx.ec
-
-".\ifx.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- esql.exe -dcmdl -p -G -subsystem:windows -thread -I..\.. ifx.ec
-
-# End Custom Build
-
-!ENDIF
-
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_informix.h
-# End Source File
-# End Group
-# End Target
-# End Project
diff --git a/ext/informix/ifx.ec b/ext/informix/ifx.ec
deleted file mode 100644
index ac0d4c1023..0000000000
--- a/ext/informix/ifx.ec
+++ /dev/null
@@ -1,4809 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Danny Heijl <Danny.Heijl@cevi.be> : initial cut (ODS 7.2x) |
- | PHP4 port |
- | Christian Cartus <chc@idgruppe.de> : blobs, and IUS 9 |
- | Jouni Ahto <jouni.ahto@exdec.fi> : configuration stuff |
- | Based on the MySQL code by: Zeev Suraski <zeev@php.net> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-/* -------------------------------------------------------------------
- * if you want a function reference : "grep '^\*\*' ifx.ec" will give
- * you a very short one
- * -------------------------------------------------------------------
-*/
-
-/* TODO:
- *
- * ? Safe mode implementation
- */
-
-
-/* prevent mod_ssl.h's header file from being included. */
-#define AP_HOOK_H
-
-#include "php.h"
-#include "php_globals.h"
-#include "ext/standard/php_standard.h"
-#include "php_informix.h"
-#include "php_globals.h"
-#include "php_ini.h"
-
-#ifdef PHP_WIN32
-#include <winsock.h>
-#else
-#include "build-defs.h"
-
-#if HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-#include <netdb.h>
-#include <netinet/in.h>
-#endif
-
-
-
-#if HAVE_IFX
-
- /* local function prototypes */
-static void php3_ifx_set_default_link(int id);
-static long php3_intifx_getType(long id, HashTable *list);
-static long php3_intifx_create_blob(long type, long mode, char* param, long len, HashTable *list);
-static long php3_intifx_free_blob(long id, HashTable *list);
-static long php3_intifx2_free_blob(long id, HashTable *list);
-static long php3_intifx_get_blob(long bid, HashTable *list, char** content);
-static long php3_intifx_update_blob(long bid, char* param, long len, HashTable *list);
-static loc_t *php3_intifx_get_blobloc(long bid, HashTable *list);
-static char* php3_intifx_create_tmpfile(long bid);
-static long php3_intifx_copy_blob(long bid, HashTable *list);
-static char* php3_intifx_null();
-static long php3_intifx_create_char(char* param, long len, HashTable *list);
-static long php3_intifx_free_char(long id, HashTable *list);
-static long php3_intifx_update_char(long bid, char* param, long len, HashTable *list);
-static long php3_intifx_get_char(long bid, HashTable *list, char** content);
-#if HAVE_IFX_IUS
-static long php3_intifxus_create_slob(long create_mode, HashTable *list);
-static long php3_intifxus_free_slob(long bid, HashTable *list);
-static long php3_intifxus_close_slob(long bid, HashTable *list);
-static long php3_intifxus_open_slob(long bid, long create_mode, HashTable *list);
-static long php3_intifxus_new_slob(HashTable *list);
-static ifx_lo_t *php3_intifxus_get_slobloc(long bid, HashTable *list);
-#endif
-
-#ifndef CLIENT_SQLI_VER /* 7.10 on (at least) AIX is missing this */
-#define CLIENT_SQLI_VER IFX_VERSION
-#endif
-
-#define TYPE_BLBYTE 0
-#define TYPE_BLTEXT 1
-#define TYPE_SLOB 2
-#define TYPE_CHAR 3
-
-
-#define BLMODE_INMEM 0
-#define BLMODE_INFILE 1
-
-
-#define IFX_SCROLL 1
-#define IFX_HOLD 2
-
-EXEC SQL include locator;
-EXEC SQL include sqltypes;
-EXEC SQL include sqlstype;
-
-#include <errno.h>
-
-typedef char IFX[128];
-
-#define SAFE_STRING(s) ((s)?(s):"")
-
-function_entry ifx_functions[] = {
- PHP_FE(ifx_connect, NULL)
- PHP_FE(ifx_pconnect, NULL)
- PHP_FE(ifx_close, NULL)
- PHP_FE(ifx_query, NULL)
- PHP_FE(ifx_prepare, NULL)
- PHP_FE(ifx_do, NULL)
- PHP_FE(ifx_error, NULL)
- PHP_FE(ifx_errormsg, NULL)
- PHP_FE(ifx_affected_rows, NULL)
- PHP_FE(ifx_num_rows, NULL)
- PHP_FE(ifx_num_fields, NULL)
- PHP_FE(ifx_fetch_row, NULL)
- PHP_FE(ifx_free_result, NULL)
- PHP_FE(ifx_htmltbl_result, NULL)
- PHP_FE(ifx_fieldtypes, NULL)
- PHP_FE(ifx_fieldproperties, NULL)
- PHP_FE(ifx_getsqlca, NULL)
-
- PHP_FE(ifx_create_blob, NULL)
- PHP_FE(ifx_free_blob, NULL)
- PHP_FE(ifx_get_blob, NULL)
- PHP_FE(ifx_update_blob, NULL)
- PHP_FE(ifx_copy_blob, NULL)
- PHP_FE(ifx_textasvarchar, NULL)
- PHP_FE(ifx_byteasvarchar, NULL)
- PHP_FE(ifx_nullformat, NULL)
- PHP_FE(ifx_blobinfile_mode, NULL)
-
- PHP_FE(ifx_create_char, NULL)
- PHP_FE(ifx_free_char, NULL)
- PHP_FE(ifx_get_char, NULL)
- PHP_FE(ifx_update_char, NULL)
-
-$ifdef HAVE_IFX_IUS;
- PHP_FE(ifxus_create_slob, NULL)
- PHP_FE(ifxus_close_slob, NULL)
- PHP_FE(ifxus_open_slob, NULL)
- PHP_FE(ifxus_free_slob, NULL)
- PHP_FE(ifxus_read_slob, NULL)
- PHP_FE(ifxus_write_slob, NULL)
- PHP_FE(ifxus_seek_slob, NULL)
- PHP_FE(ifxus_tell_slob, NULL)
-$endif;
-
- {NULL, NULL, NULL}
-};
-
-zend_module_entry ifx_module_entry = {
- "Informix",
- ifx_functions,
- PHP_MINIT(ifx),
- PHP_MSHUTDOWN(ifx),
- PHP_RINIT(ifx),
- NULL,
- PHP_MINFO(ifx),
- STANDARD_MODULE_PROPERTIES
-};
-
-static php_ifx_listids ifx_listids; /* these are globals, no thread safety needed says zeeev */
-
-
-#ifdef COMPILE_DL_INFORMIX
-ZEND_GET_MODULE(ifx)
-#if 0
-BOOL WINAPI DllMain(HANDLE hModule,
- DWORD ul_reason_for_call,
- LPVOID lpReserved)
-{
- return 1;
-}
-#endif
-#endif
-
-#ifdef ZTS
-int ifx_globals_id;
-#else
-PHP_IFX_API php_ifx_globals ifx_globals;
-#endif
-
-
-#define CHECK_LINK(link) { if (link==0) { php_error(E_WARNING, "Informix: A link to the server could not be established"); RETURN_FALSE; }}
-
-#define DUP 1
-
-EXEC SQL DEFINE IFX_SUCCESS 0;
-EXEC SQL DEFINE IFX_WARNING 1;
-EXEC SQL DEFINE IFX_ERROR -1;
-EXEC SQL DEFINE IFX_NODATA 100;
-
-static int ifx_check()
-{
- int _ifx_check;
-
- _ifx_check = IFX_ERROR;
-
- if (SQLSTATE[0] == '0') {
- switch (SQLSTATE[1]) {
- case '0':
- _ifx_check = IFX_SUCCESS;
- break;
- case '1':
- _ifx_check = IFX_WARNING;
- break;
- case '2':
- _ifx_check = IFX_NODATA;
- break;
- default :
- _ifx_check = IFX_ERROR;
- break;
- }
- }
-
- return _ifx_check;
-}
-
-static char *ifx_error(ifx)
- EXEC SQL BEGIN DECLARE SECTION;
- PARAMETER char *ifx;
- EXEC SQL END DECLARE SECTION;
-{
- char *ifx_err_msg;
- char c;
- int errorcode;
-
- IFXLS_FETCH();
-
- if (IFXG(sv_sqlcode) == 0)
- errorcode = SQLCODE;
- else
- errorcode = IFXG(sv_sqlcode);
-
- switch (ifx_check()) {
- case IFX_SUCCESS:
- c = ' ';
- break;
- case IFX_WARNING:
- c = 'W';
- break;
- case IFX_ERROR:
- c = 'E';
- break;
- case IFX_NODATA:
- c = 'N';
- break;
- default:
- c = '?';
- break;
- }
- ifx_err_msg = emalloc(64);
- sprintf(ifx_err_msg,"%c [SQLSTATE=%c%c %c%c%c SQLCODE=%d]",
- c,
- SQLSTATE[0],
- SQLSTATE[1],
- SQLSTATE[2],
- SQLSTATE[3],
- SQLSTATE[4],
- errorcode);
- return(ifx_err_msg);
-}
-
-
-
-static void _close_ifx_link(link)
- EXEC SQL BEGIN DECLARE SECTION;
- PARAMETER char *link;
- EXEC SQL END DECLARE SECTION;
-{
-
- IFXLS_FETCH();
-
- EXEC SQL SET CONNECTION :link;
- if (ifx_check() >= 0) {
- EXEC SQL close database;
- EXEC SQL DISCONNECT CURRENT;
- }
- efree(link);
- IFXG(num_links)--;
-}
-
-static void _close_ifx_plink(link)
-EXEC SQL BEGIN DECLARE SECTION;
- PARAMETER char *link;
-EXEC SQL END DECLARE SECTION;
-{
-
- IFXLS_FETCH();
-
- EXEC SQL SET CONNECTION :link;
- if (ifx_check() >= 0) {
- EXEC SQL close database;
- EXEC SQL DISCONNECT CURRENT;
- }
- free(link);
- IFXG(num_persistent)--;
- IFXG(num_links)--;
-}
-
-static void ifx_free_result(a_result_id)
-char *a_result_id;
-{
- return;
-}
-
-
-/* static PHP_INI_DISP(display_link_numbers)
-{
- char *value;
-
- if (type==PHP_INI_DISPLAY_ORIG && ini_entry->modified) {
- value = ini_entry->orig_value;
- } else {
- if (ini_entry->value) {
- value = ini_entry->value;
- } else {
- value = NULL;
- }
- }
- if (value) {
- if (atoi(value)==-1) {
- PUTS("Unlimited");
- } else {
- php_printf("%s", value);
- }
- }
-}
-*/
-
-
-
-PHP_INI_BEGIN()
- STD_PHP_INI_BOOLEAN("ifx.allow_persistent", "1", PHP_INI_SYSTEM,
- OnUpdateInt, allow_persistent, php_ifx_globals, ifx_globals)
- STD_PHP_INI_ENTRY_EX("ifx.max_persistent", "-1", PHP_INI_SYSTEM,
- OnUpdateInt, max_persistent, php_ifx_globals, ifx_globals,
- display_link_numbers)
- STD_PHP_INI_ENTRY_EX("ifx.max_links", "-1", PHP_INI_SYSTEM,
- OnUpdateInt, max_links, php_ifx_globals, ifx_globals,
- display_link_numbers)
- STD_PHP_INI_ENTRY("ifx.default_host", NULL, PHP_INI_SYSTEM,
- OnUpdateString, default_host, php_ifx_globals, ifx_globals)
- STD_PHP_INI_ENTRY("ifx.default_user", NULL, PHP_INI_SYSTEM,
- OnUpdateString, default_user, php_ifx_globals, ifx_globals)
- STD_PHP_INI_ENTRY("ifx.default_password", NULL, PHP_INI_SYSTEM,
- OnUpdateString, default_password, php_ifx_globals, ifx_globals)
- STD_PHP_INI_ENTRY("ifx.blobinfile", "1", PHP_INI_ALL,
- OnUpdateInt, blobinfile, php_ifx_globals, ifx_globals)
- STD_PHP_INI_ENTRY("ifx.textasvarchar", "0", PHP_INI_ALL,
- OnUpdateInt, textasvarchar, php_ifx_globals, ifx_globals)
- STD_PHP_INI_ENTRY("ifx.byteasvarchar", "0", PHP_INI_ALL,
- OnUpdateInt, byteasvarchar, php_ifx_globals, ifx_globals)
- STD_PHP_INI_ENTRY("ifx.charasvarchar", "0", PHP_INI_ALL,
- OnUpdateInt, charasvarchar, php_ifx_globals, ifx_globals)
- STD_PHP_INI_ENTRY("ifx.nullformat", "0", PHP_INI_ALL,
- OnUpdateInt, nullformat, php_ifx_globals, ifx_globals)
-PHP_INI_END()
-
-#ifdef ZTS
-static void php_ifx_init_globals(php_ifx_globals *ifx_globals)
-{
- IFXG(num_persistent) = 0;
- IFXG(nullvalue) = malloc(1);
- IFXG(nullvalue)[0] = 0;
- IFXG(nullstring) = malloc(5);
- strcpy(IFXG(nullstring), "NULL");
-
- IFXG(num_persistent)=0;
- IFXG(sv_sqlcode)=0;
-
-}
-#endif
-
-PHP_MINIT_FUNCTION(ifx)
-{
- /*ELS_FETCH();*/
-
-#ifdef ZTS
- ifx_globals_id = ts_allocate_id(sizeof(php_ifx_globals), php_ifx_init_globals, NULL);
-
-#else
- IFXG(num_persistent)=0;
- IFXG(nullvalue) = malloc(1);
- IFXG(nullvalue)[0] = 0;
- IFXG(nullstring) = malloc(5);
- strcpy(IFXG(nullstring), "NULL");
-
- IFXG(num_persistent)=0;
- IFXG(sv_sqlcode)=0;
-
-#endif
-
- REGISTER_INI_ENTRIES();
-
- IFXL(le_result) = register_list_destructors(ifx_free_result,NULL);
- IFXL(le_idresult) = register_list_destructors(ifx_free_result,NULL);
- IFXL(le_link) = register_list_destructors(_close_ifx_link,NULL);
- IFXL(le_plink) = register_list_destructors(NULL,_close_ifx_plink);
-
- ifx_module_entry.type = type;
-
-#if 0
- printf("Registered: %d,%d,%d\n",
- IFXL(le_result),
- IFXL(le_link),
- IFXL(le_plink));
-#endif
-
- REGISTER_LONG_CONSTANT("IFX_SCROLL", IFX_SCROLL, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("IFX_HOLD", IFX_HOLD, CONST_CS | CONST_PERSISTENT);
-$ifdef HAVE_IFX_IUS;
- REGISTER_LONG_CONSTANT("IFX_LO_RDONLY", LO_RDONLY, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("IFX_LO_WRONLY", LO_WRONLY, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("IFX_LO_APPEND", LO_APPEND, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("IFX_LO_RDWR", LO_RDWR, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("IFX_LO_BUFFER", LO_BUFFER, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("IFX_LO_NOBUFFER", LO_NOBUFFER, CONST_CS | CONST_PERSISTENT);
-$endif;
-
- return SUCCESS;
-}
-
-
-PHP_MSHUTDOWN_FUNCTION(ifx)
-{
-
- UNREGISTER_INI_ENTRIES();
- return SUCCESS;
-
-}
-
-PHP_RINIT_FUNCTION(ifx)
-{
- IFXLS_FETCH();
-
- IFXG(default_link)=-1;
- IFXG(num_links) = IFXG(num_persistent);
- return SUCCESS;
-}
-
-PHP_MINFO_FUNCTION(ifx)
-{
- char buf[32];
- char maxp[16],maxl[16];
-
- IFXLS_FETCH();
-
-
- if (IFXG(max_persistent)==-1) {
- strcpy(maxp,"Unlimited");
- } else {
- snprintf(maxp,15,"%ld",IFXG(max_persistent));
- maxp[15]=0;
- }
- if (IFXG(max_links)==-1) {
- strcpy(maxl,"Unlimited");
- } else {
- snprintf(maxl,15,"%ld",IFXG(max_links));
- maxl[15]=0;
- }
-
- php_info_print_table_start();
- php_info_print_table_header(2, "Informix support", "enabled");
- sprintf(buf, "%ld", IFXG(num_persistent));
- php_info_print_table_row(2, "Persistent links", buf);
- sprintf(buf, "%ld", IFXG(num_links));
- php_info_print_table_row(2, "Total links", buf);
- sprintf(buf, "%02.2f", (double)(IFX_VERSION/100.0));
- php_info_print_table_row(2, "ESQL/C Version", buf);
- php_info_print_table_end();
-
- DISPLAY_INI_ENTRIES();
-
-}
-
-static void php3_ifx_set_default_link(int id)
-{
-
- IFXLS_FETCH();
-
- if (IFXG(default_link) != -1) {
- zend_list_delete(IFXG(default_link));
- }
- IFXG(default_link) = id;
- zend_list_addref(id);
-
-}
-
-/* ----------------------------------------------------------------------
-** int ifx_(p)connect(string database, string userid, string password)
-**
-** connects to $database (db@server syntax) using $userid and $password
-**
-** returns a connection id on success or FALSE one error
-** ----------------------------------------------------------------------
-*/
-
-static void php3_ifx_do_connect(INTERNAL_FUNCTION_PARAMETERS,int persistent)
-{
-
- EXEC SQL BEGIN DECLARE SECTION;
- char *user,*passwd,*host;
- char *ifx;
- EXEC SQL END DECLARE SECTION;
-
- char *hashed_details;
- int hashed_details_length;
- IFXLS_FETCH();
- PLS_FETCH();
-
- if (PG(sql_safe_mode)) {
- if (ZEND_NUM_ARGS()>0) {
- php_error(E_NOTICE,
- "SQL safe mode in effect - ignoring host/user/password information");
- }
- host = passwd = NULL;
- user = php_get_current_user();
- hashed_details_length = strlen(user)+3+3;
- hashed_details = (char *) emalloc(hashed_details_length+1);
- sprintf(hashed_details,"ifx__%s_",user);
- } else {
- host = IFXG(default_host);
- user = IFXG(default_user);
- passwd = IFXG(default_password);
-
- switch(ZEND_NUM_ARGS()) {
- case 0: /* defaults */
- break;
- case 1: {
- pval *yyhost;
-
- if (getParameters(ht, 1, &yyhost)==FAILURE) {
- RETURN_FALSE;
- }
- convert_to_string(yyhost);
- host = yyhost->value.str.val;
- }
- break;
- case 2: {
- pval *yyhost,*yyuser;
-
- if (getParameters(ht, 2, &yyhost, &yyuser)==FAILURE) {
- RETURN_FALSE;
- }
- convert_to_string(yyhost);
- convert_to_string(yyuser);
- host = yyhost->value.str.val;
- user = yyuser->value.str.val;
- }
- break;
- case 3: {
- pval *yyhost,*yyuser,*yypasswd;
-
- if (getParameters(ht, 3, &yyhost, &yyuser, &yypasswd) == FAILURE) {
- RETURN_FALSE;
- }
- convert_to_string(yyhost);
- convert_to_string(yyuser);
- convert_to_string(yypasswd);
- host = yyhost->value.str.val;
- user = yyuser->value.str.val;
- passwd = yypasswd->value.str.val;
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- hashed_details_length = sizeof("ifx___")-1 +
- strlen(SAFE_STRING(host))+
- strlen(SAFE_STRING(user))+
- strlen(SAFE_STRING(passwd));
- hashed_details = (char *) emalloc(hashed_details_length+1);
- sprintf(hashed_details,"ifx_%s_%s_%s",
- SAFE_STRING(host),
- SAFE_STRING(user),
- SAFE_STRING(passwd));
- }
-
-
- IFXG(sv_sqlcode) = 0;
-
- if (!IFXG(allow_persistent)) {
- persistent=0;
- }
- if (persistent) {
- list_entry *le;
-
- /* try to find if we already have this link in our persistent list */
- if (zend_hash_find(&EG(persistent_list), hashed_details, hashed_details_length+1,
- (void **) &le)==FAILURE) { /* we don't */
- list_entry new_le;
-
- if (IFXG(max_links)!=-1 &&
- IFXG(num_links) >=
- IFXG(max_links)) {
- php_error(E_WARNING,
- "Informix: Too many open links (%d)",
- IFXG(num_links));
- efree(hashed_details);
- RETURN_FALSE;
- }
- if (IFXG(max_persistent)!=-1 &&
- IFXG(num_persistent) >=
- IFXG(max_persistent)) {
- php_error(E_WARNING,
- "Informix: Too many open persistent links (%d)",
- IFXG(num_persistent));
- efree(hashed_details);
- RETURN_FALSE;
- }
- /* create the link */
- ifx = (char *)malloc(sizeof(IFX));
- IFXG(connectionid)++;
- sprintf(ifx,"%s%x",
- user,
- IFXG(connectionid));
-
- EXEC SQL CONNECT TO :host AS :ifx
- USER :user USING :passwd
- WITH CONCURRENT TRANSACTION;
-
- if (ifx_check() == IFX_ERROR) {
- IFXG(sv_sqlcode) = SQLCODE;
- php_error(E_WARNING,ifx_error(ifx));
- free(ifx);
- efree(hashed_details);
- RETURN_FALSE;
- }
-
- /* hash it up */
- new_le.type = IFXL(le_plink);
- new_le.ptr = ifx;
- if (zend_hash_update(&EG(persistent_list), hashed_details,
- hashed_details_length+1,
- (void *) &new_le, sizeof(list_entry), NULL)==FAILURE) {
- free(ifx);
- efree(hashed_details);
- RETURN_FALSE;
- }
- IFXG(num_persistent)++;
- IFXG(num_links)++;
- } else { /* we do */
- if (le->type != IFXL(le_plink)) {
- RETURN_FALSE;
- }
- /* ensure that the link did not die */
- ifx = le->ptr;
- EXEC SQL SET CONNECTION :ifx;
- if (ifx_check() == IFX_ERROR) {
- /* the link died */
- ifx = le->ptr; /* reconnect silently */
- EXEC SQL CONNECT TO :host AS :ifx
- USER :user USING :passwd
- WITH CONCURRENT TRANSACTION;
-
- if (ifx_check() == IFX_ERROR) {
- IFXG(sv_sqlcode) = SQLCODE;
- php_error(E_WARNING,
- "Informix: Link to server lost, unable to reconnect (%s)",
- ifx_error(ifx));
- zend_hash_del(&EG(persistent_list), hashed_details,
- hashed_details_length+1);
- efree(hashed_details);
- RETURN_FALSE;
- }
- }
- ifx = le->ptr;
- }
- ZEND_REGISTER_RESOURCE(return_value, ifx, IFXL(le_plink));
- } else { /* non persistent */
- list_entry *index_ptr,new_index_ptr;
-
- /* first we check the hash for the hashed_details key. if it exists,
- * it should point us to the right offset where the actual ifx link sits.
- * if it doesn't, open a new ifx link, add it to the resource list,
- * and add a pointer to it with hashed_details as the key.
- */
- if (zend_hash_find(&EG(regular_list),hashed_details,hashed_details_length+1,
- (void **) &index_ptr) == SUCCESS) {
- int type,link;
- void *ptr;
-
- if (index_ptr->type != le_index_ptr) {
- RETURN_FALSE;
- }
- link = (int) index_ptr->ptr;
- ptr = zend_list_find(link, &type); /* check if the link is still there */
- if (ptr && (type==IFXL(le_link) || type==IFXL(le_plink))) {
- /* ensure that the link is not closed */
- ifx = ptr;
- EXEC SQL SET CONNECTION :ifx;
- if (ifx_check() == IFX_ERROR) {
- /* the link is closed */
- ifx = ptr; /* reconnect silently */
- EXEC SQL CONNECT TO :host AS :ifx
- USER :user USING :passwd
- WITH CONCURRENT TRANSACTION;
-
- if (ifx_check() == IFX_ERROR) {
- IFXG(sv_sqlcode) = SQLCODE;
- php_error(E_WARNING,"Informix: unable to connect (%s)", ifx_error(ifx));
- zend_hash_del(&EG(regular_list), hashed_details, hashed_details_length+1);
- efree(hashed_details);
- RETURN_FALSE;
- }
- }
- zend_list_addref(link);
- return_value->value.lval = link;
- php3_ifx_set_default_link(link);
- return_value->type = IS_RESOURCE;
- efree(hashed_details);
- return;
- } else {
- zend_hash_del(&EG(regular_list),hashed_details,hashed_details_length+1);
- }
- }
- if (IFXG(max_links) != -1 &&
- IFXG(num_links) >=
- IFXG(max_links)) {
- php_error(E_WARNING,
- "Informix: Too many open links (%d)",
- IFXG(num_links));
- efree(hashed_details);
- RETURN_FALSE;
- }
- ifx = (char *) emalloc(sizeof(IFX));
- IFXG(connectionid)++;
- sprintf(ifx,"connec%x",
- IFXG(connectionid));
-
- EXEC SQL CONNECT TO :host AS :ifx
- USER :user USING :passwd
- WITH CONCURRENT TRANSACTION;
- if (ifx_check() == IFX_ERROR) {
- IFXG(sv_sqlcode) = SQLCODE;
- php_error(E_WARNING,"ifx_connect : %s", ifx_error(ifx));
- efree(hashed_details);
- efree(ifx);
- RETURN_FALSE;
- }
-
- /* add it to the list */
- ZEND_REGISTER_RESOURCE(return_value, ifx, IFXL(le_link));
-
- /* add it to the hash */
- new_index_ptr.ptr = (void *) return_value->value.lval;
- new_index_ptr.type = le_index_ptr;
- if (zend_hash_update(&EG(regular_list),
- hashed_details,
- hashed_details_length+1,
- (void *) &new_index_ptr,
- sizeof(list_entry), NULL) == FAILURE) {
- efree(hashed_details);
- RETURN_FALSE;
- }
- IFXG(num_links)++;
- }
- efree(hashed_details);
- php3_ifx_set_default_link(return_value->value.lval);
-}
-
-
-/* {{{ proto int ifx_connect([string database [, string userid [, string password]]])
- Connects to database using userid/password, returns connection id */
-PHP_FUNCTION(ifx_connect)
-{
- php3_ifx_do_connect(INTERNAL_FUNCTION_PARAM_PASSTHRU,0);
-}
-/* }}} */
-
-/* {{{ proto int ifx_pconnect([string database [, string userid [, string password]]])
- Connects to database using userid/password, returns connection id */
-PHP_FUNCTION(ifx_pconnect)
-{
- php3_ifx_do_connect(INTERNAL_FUNCTION_PARAM_PASSTHRU,1);
-}
-/* }}} */
-
-static int php3_ifx_get_default_link(INTERNAL_FUNCTION_PARAMETERS)
-{
- IFXLS_FETCH();
-
- if (IFXG(default_link)==-1) { /* no link opened yet, implicitly open one */
- ht = 0;
- php3_ifx_do_connect(INTERNAL_FUNCTION_PARAM_PASSTHRU,0);
- }
- return IFXG(default_link);
-}
-
-/* ----------------------------------------------------------------------
-** int ifx_close(int connid)
-**
-** closes connection connid
-** always returns TRUE
-** ----------------------------------------------------------------------
-*/
-
-/* {{{ proto int ifx_close(int connid)
- Close informix connection */
-PHP_FUNCTION(ifx_close)
-{
- pval **ifx_link = NULL;
- int id;
-
-EXEC SQL BEGIN DECLARE SECTION;
- char *ifx;
-EXEC SQL END DECLARE SECTION;
-
- IFXLS_FETCH();
-
-
-
- id = -1;
-
- switch (ZEND_NUM_ARGS()) {
- case 0:
- id = IFXG(default_link);
- break;
- case 1:
- if (zend_get_parameters_ex(1, &ifx_link)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- IFXG(sv_sqlcode) = 0;
-
- ZEND_FETCH_RESOURCE2(ifx, char *, ifx_link, id, "IFX link", IFXL(le_link), IFXL(le_plink));
-
- EXEC SQL SET CONNECTION :ifx;
- EXEC SQL close database;
- EXEC SQL DISCONNECT CURRENT;
-
- zend_list_delete(id);
- RETURN_TRUE;
-}
-/* }}} */
-
-/* ----------------------------------------------------------------------
-** int ifx_query(string query, int connid
-** [, int cursortype] [, array blobidarray])
-** cursortype and blobidarray are optional
-**
-** executes query query on connection connid
-** for select queries a cursor is declared and opened
-** non-select queries are "execute immediate"
-** select queries accept an optional cursortype param:
-** IFX_SCROLL, IFX_HOLD (or'ed mask)
-** non-select queries accept an optional "blobarryid" parameter
-** blobsupport: mark the blob-column(s) with ? in the insert/update query
-** and add a blob-id-array-functionparameter
-** select queries return "blob-ids" for blob columns
-** except if text/byteasvarchar is set
-** example: ifx_query("insert into catalog (stock_num, manu_code,
-** cat_descr,cat_picture) values(1,'HRO',?,?)",$cid,$bidarray);
-**
-** returns a "result id" on success or FALSE on error
-** also sets "affected_rows for retrieval by ifx_affected_rows()
-** ----------------------------------------------------------------------
-*/
-
-/* {{{ proto int ifx_query(string query, int connid [, int cursortype] [, array idarray])
- Perform a query on a given connection */
-PHP_FUNCTION(ifx_query)
-{
- pval **query,**ifx_link, **cursortype, **dummy;
- int id;
- IFX_RES *Ifx_Result;
-
-EXEC SQL BEGIN DECLARE SECTION;
- char *ifx; /* connection ID */
- char cursorid[32]; /* query cursor id */
- char statemid[32]; /* statement id */
- char descrpid[32]; /* descriptor id */
- char *statement; /* query text */
- int fieldcount; /* field count */
- int i; /* field index */
- short fieldtype;
- loc_t *locator;
- int loc_t_type=CLOCATORTYPE; /* WORKAROUND:TYPE=CLOCATORTYPE doesn't work, */
- int sqlchar_type=SQLCHAR; /* don't ask me, why. */
- char *char_tmp;
- long len;
- int indicator;
-$ifdef HAVE_IFX_IUS;
- fixed binary 'blob' ifx_lo_t *slocator;
-$endif;
-
-EXEC SQL END DECLARE SECTION;
-
- char *blobfilename;
- int locind;
- int ctype;
- int affected_rows;
- long sqlerrd[6];
- int e;
- int query_type;
- int cursoryproc;
-
- IFXLS_FETCH();
-
- if(ZEND_NUM_ARGS()<2) {
- WRONG_PARAM_COUNT;
- }
-
- IFXG(sv_sqlcode) = 0;
-
- /* get the first 2 parameters,
- php4 insists on the correct number of arguments */
- switch(ZEND_NUM_ARGS()) {
- case 2:
- if (zend_get_parameters_ex(2, &query, &ifx_link)==FAILURE)
- RETURN_FALSE;
- break;
- case 3:
- if (zend_get_parameters_ex(3, &query, &ifx_link, &dummy)==FAILURE)
- RETURN_FALSE;
- break;
- case 4:
- if (zend_get_parameters_ex(4, &query, &ifx_link, &dummy, &dummy)==FAILURE)
- RETURN_FALSE;
- break;
- }
-
- id = -1;
- ZEND_FETCH_RESOURCE2(ifx, char *, ifx_link, id, "IFX link", IFXL(le_link), IFXL(le_plink));
-
-
- affected_rows = -1; /* invalid */
-
- convert_to_string_ex(query);
-
- statement = (*query)->value.str.val;
- IFXG(cursorid)++;
- sprintf(statemid, "statem%x", IFXG(cursorid));
- sprintf(cursorid, "cursor%x", IFXG(cursorid));
- sprintf(descrpid, "descrp%x", IFXG(cursorid));
-
- EXEC SQL set connection :ifx;
- if (ifx_check() < 0) {
- IFXG(sv_sqlcode) = SQLCODE;
- php_error(E_WARNING,"Set connection %s fails (%s)",
- ifx,
- ifx_error(ifx));
- RETURN_FALSE;
- }
- EXEC SQL PREPARE :statemid FROM :statement;
- if (ifx_check() < 0) {
- IFXG(sv_sqlcode) = SQLCODE;
- php_error(E_WARNING,"Prepare fails (%s)",
- ifx_error(ifx));
- RETURN_FALSE;
- }
-
- affected_rows = sqlca.sqlerrd[0]; /* save estimated affected rows */
- for (e = 0; e < 6; e++) sqlerrd[e] = sqlca.sqlerrd[e];
-
- EXEC SQL ALLOCATE DESCRIPTOR :descrpid WITH MAX 384;
- if (ifx_check() < 0) {
- IFXG(sv_sqlcode) = SQLCODE;
- php_error(E_WARNING,"Allocate desciptor <%s> fails (%s)",
- descrpid,
- ifx_error(ifx));
- EXEC SQL free :statemid;
- RETURN_FALSE;
- }
- EXEC SQL DESCRIBE :statemid USING SQL DESCRIPTOR :descrpid;
- if (ifx_check() < 0) {
- IFXG(sv_sqlcode) = SQLCODE;
- php_error(E_WARNING,"Describe fails (%s)",
- ifx_error(ifx));
- EXEC SQL DEALLOCATE DESCRIPTOR :descrpid;
- EXEC SQL free :statemid;
- RETURN_FALSE;
- }
-
- query_type = sqlca.sqlcode;
-
- Ifx_Result = (IFX_RES *)emalloc(sizeof(IFX_RES));
- if (Ifx_Result == NULL) {
- php_error(E_WARNING,"Out of memory allocating IFX_RES");
- EXEC SQL DEALLOCATE DESCRIPTOR :descrpid;
- EXEC SQL free :statemid;
- RETURN_FALSE;
- }
-
- /* initialize result data structure */
-
- Ifx_Result->rowid = 0;
- strcpy(Ifx_Result->connecid, ifx);
- strcpy(Ifx_Result->descrpid, descrpid);
- for (i = 0; i < MAX_RESID; ++i)
- Ifx_Result->res_id[i] = -1;
-
- cursoryproc = 0;
- if (query_type == SQ_EXECPROC) {
- EXEC SQL GET DESCRIPTOR :descrpid :i = COUNT;
- if (i > 0) {
- cursoryproc = 1;
- }
- }
-
- Ifx_Result->iscursory = -1; /* prevent ifx_do */
- Ifx_Result->paramquery=0;
-
- if ((query_type != 0) && (!cursoryproc)) { /* NO RESULT SET */
- /* ##
- ## NONSELECT-STATEMENT
- ##
- */
- pval **pblobidarr, **tmp;
-
- Ifx_Result->iscursory = 0;
-
- strcpy(Ifx_Result->cursorid, "");
- strcpy(Ifx_Result->descrpid, descrpid);
- strcpy(Ifx_Result->statemid, statemid);
-
- if(ZEND_NUM_ARGS()>3) {
- WRONG_PARAM_COUNT;
- }
-
- if(ZEND_NUM_ARGS()==3) {
- if (zend_get_parameters_ex(3, &dummy, &dummy, &pblobidarr) == FAILURE) {
- php_error(E_WARNING,"Can't get blob array param");
- EXEC SQL DEALLOCATE DESCRIPTOR :descrpid;
- EXEC SQL free :statemid;
- efree(Ifx_Result);
- RETURN_FALSE;
- }
- if ((*pblobidarr)->type != IS_ARRAY) {
- php_error(E_WARNING,"blob-parameter not an array");
- EXEC SQL DEALLOCATE DESCRIPTOR :descrpid;
- EXEC SQL free :statemid;
- efree(Ifx_Result);
- RETURN_FALSE;
- }
-
- zend_hash_internal_pointer_reset((*pblobidarr)->value.ht);
- i=1;
- while (zend_hash_get_current_data((*pblobidarr)->value.ht,
- (void **) &tmp) == SUCCESS) {
- convert_to_long(*tmp);
- if ((query_type == SQ_UPDATE) || (query_type == SQ_UPDALL)) {
- EXEC SQL SET DESCRIPTOR :descrpid COUNT = :i;
- }
- /* TEXT/BYTE */
- if(php3_intifx_getType((int)(*tmp)->value.lval,&EG(regular_list))==TYPE_BLTEXT || php3_intifx_getType((int)(*tmp)->value.lval,&EG(regular_list))==TYPE_BLBYTE) {
- locator=php3_intifx_get_blobloc((int)((*tmp)->value.lval),&EG(regular_list));
- if(locator==NULL) {
- php_error(E_WARNING,"%d is not a Informix blob-result index",
- (int)((*tmp)->value.lval));
- EXEC SQL DEALLOCATE DESCRIPTOR :descrpid;
- EXEC SQL free :statemid;
- efree(Ifx_Result);
- RETURN_FALSE;
- }
- if(locator->loc_loctype==LOCFNAME) {
- locator->loc_oflags=LOC_RONLY;
- }
- EXEC SQL SET DESCRIPTOR :descrpid VALUE :i
- DATA= :*locator,
- TYPE= :loc_t_type;
- }
-
- /* CHAR */
- if(php3_intifx_getType((int)(*tmp)->value.lval,&EG(regular_list))==TYPE_CHAR) {
- len=php3_intifx_get_char((int)((*tmp)->value.lval),&EG(regular_list),&char_tmp);
- indicator=0;
- if(char_tmp==NULL || len<0)
- indicator=-1;
- len++;
- EXEC SQL SET DESCRIPTOR :descrpid VALUE :i
- DATA= :char_tmp,
- LENGTH= :len,
- INDICATOR= :indicator,
- TYPE= :sqlchar_type;
- }
-
-
- i++;
- zend_hash_move_forward((*pblobidarr)->value.ht);
- }
- Ifx_Result->paramquery=1;
- EXEC SQL EXECUTE :statemid USING SQL DESCRIPTOR :descrpid;
- } else {
- EXEC SQL EXECUTE :statemid;
- }
- if (ifx_check() < 0) {
- IFXG(sv_sqlcode) = SQLCODE;
- php_error(E_WARNING,"Execute immediate fails : %s (%s)",
- statement,
- ifx_error(ifx));
- efree(Ifx_Result);
- EXEC SQL DEALLOCATE DESCRIPTOR :descrpid;
- EXEC SQL free :statemid;
- RETURN_FALSE;
- }
- Ifx_Result->affected_rows = sqlca.sqlerrd[2]; /* really affected */
- for (e = 0; e < 6; e++) Ifx_Result->sqlerrd[e] = sqlca.sqlerrd[e];
- } else {
- /* ##
- ** SELECT-STATEMENT
- **
- */
-
- ctype = 0; /* preset */
-
- switch(ZEND_NUM_ARGS()) {
- case 2:
- break;
- case 3:
- if (zend_get_parameters_ex(3,
- &dummy,
- &dummy,
- &cursortype)==FAILURE) {
- RETURN_FALSE;
- }
- convert_to_long_ex(cursortype);
- ctype = (*cursortype)->value.lval;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
-
-
- Ifx_Result->affected_rows = affected_rows; /* saved estimated from prepare */
- for (e = 0; e < 6; e++) Ifx_Result->sqlerrd[e] = sqlerrd[e];
-
- EXEC SQL GET DESCRIPTOR :descrpid :fieldcount = COUNT;
- if (ifx_check() < 0) {
- IFXG(sv_sqlcode) = SQLCODE;
- php_error(E_WARNING,"Can not get descriptor %s (%s)",
- descrpid,
- ifx_error(ifx));
- EXEC SQL DEALLOCATE DESCRIPTOR :descrpid;
- EXEC SQL free :statemid;
- efree(Ifx_Result);
- RETURN_FALSE;
- }
- Ifx_Result->numcols = fieldcount;
-
- Ifx_Result->isscroll = Ifx_Result->ishold = 0;
- if (ctype & IFX_SCROLL)
- Ifx_Result->isscroll = 1;
- if (ctype & IFX_HOLD)
- Ifx_Result->ishold = 1;
-
- if (Ifx_Result->isscroll)
- if (Ifx_Result->ishold)
- EXEC SQL DECLARE :cursorid SCROLL CURSOR WITH HOLD FOR :statemid;
- else
- EXEC SQL DECLARE :cursorid SCROLL CURSOR FOR :statemid;
- else
- if (Ifx_Result->ishold)
- EXEC SQL DECLARE :cursorid CURSOR WITH HOLD FOR :statemid;
- else
- EXEC SQL DECLARE :cursorid CURSOR FOR :statemid;
-
- if (ifx_check() < 0) {
- IFXG(sv_sqlcode) = SQLCODE;
- php_error(E_WARNING,"Declare cursor fails (%s)", ifx_error(ifx));
- efree(Ifx_Result);
- EXEC SQL DEALLOCATE DESCRIPTOR :descrpid;
- EXEC SQL free :statemid;
- RETURN_FALSE;
- }
- EXEC SQL OPEN :cursorid;
- if (ifx_check() < 0) {
- IFXG(sv_sqlcode) = SQLCODE;
- php_error(E_WARNING,"Open cursor fails (%s)", ifx_error(ifx));
- efree(Ifx_Result);
- EXEC SQL DEALLOCATE DESCRIPTOR :descrpid;
- EXEC SQL free :statemid;
- EXEC SQL free :cursorid;
- RETURN_FALSE;
- }
- strcpy(Ifx_Result->cursorid, cursorid);
- strcpy(Ifx_Result->descrpid, descrpid);
- strcpy(Ifx_Result->statemid, statemid);
-
- /* check for text/blob columns */
-
-
- locind = 0;
- for (i = 1; i <= fieldcount; ++i) {
- EXEC SQL GET DESCRIPTOR :descrpid VALUE :i :fieldtype = TYPE;
- if (
- (fieldtype == SQLTEXT) || (fieldtype == SQLBYTES)
-$ifdef HAVE_IFX_IUS;
- || (fieldtype==SQLUDTFIXED)
-$endif;
- ) {
-
- int bid = 0;
- if(fieldtype==SQLTEXT) {
- bid=php3_intifx_create_blob(TYPE_BLTEXT,BLMODE_INMEM,"",-1,&EG(regular_list));
- locator=php3_intifx_get_blobloc(bid,&EG(regular_list));
- EXEC SQL SET DESCRIPTOR :descrpid VALUE :i DATA = :*locator;
- }
- if(fieldtype==SQLBYTES) {
- if(IFXG(blobinfile)==0) {
- bid=php3_intifx_create_blob(TYPE_BLBYTE,BLMODE_INMEM,"",-1,&EG(regular_list));
- locator=php3_intifx_get_blobloc(bid,&EG(regular_list));
- } else {
- blobfilename=php3_intifx_create_tmpfile(i);
- bid=php3_intifx_create_blob(
- TYPE_BLBYTE,BLMODE_INFILE,
- blobfilename,strlen(blobfilename),&EG(regular_list));
- locator=php3_intifx_get_blobloc(bid,&EG(regular_list));
- locator->loc_oflags=LOC_WONLY;
- }
- EXEC SQL SET DESCRIPTOR :descrpid VALUE :i DATA = :*locator;
- }
-$ifdef HAVE_IFX_IUS;
- if(fieldtype==SQLUDTFIXED) {
- bid=php3_intifxus_new_slob(&EG(regular_list));
- slocator=php3_intifxus_get_slobloc(bid,&EG(regular_list));
- EXEC SQL SET DESCRIPTOR :descrpid VALUE :i DATA = :*slocator;
- }
-$endif;
- Ifx_Result->res_id[locind]=bid;
- ++locind;
- }
- }
-
- }
-
- ZEND_REGISTER_RESOURCE(return_value, Ifx_Result, IFXL(le_result));
-}
-/* }}} */
-
-
-/* ----------------------------------------------------------------------
-** int ifx_prepare(string query, int connid,
-** [, int cursortype] [, array blobidarry])
-**
-** $hold, $scroll are optional and valid only for select queries
-** $blobidarray is optional, an array of blob id's
-**
-** prepares query $query on connection $connid
-** select queries accept an optional cursortype param: IFX_SCROLL, IFX_HOLD (or'ed mask)
-** blobsupport: mark the blob-column with ? and add a blob-id-functionparameter
-** example: ifx_query("insert into catalog (stock_num, manu_code ,cat_descr,
-** cat_picture) values(1,'HRO',?,?)",$cid,$bid1,$bid2);
-**
-** returns a "result id" on success or FALSE on error
-** also sets "affected_rows for retrieval by ifx_affected_rows
-** ----------------------------------------------------------------------
-*/
-
-/* {{{ proto int ifx_prepare(string query, int connid [, int cursortype] [, array idarray])
- Prepare a query on a given connection */
-PHP_FUNCTION(ifx_prepare)
-{
-
- pval **query,**ifx_link, **cursortype, **dummy;
- int id;
- IFX_RES *Ifx_Result;
-
-EXEC SQL BEGIN DECLARE SECTION;
- char *ifx; /* connection ID */
- char cursorid[32]; /* query cursor id */
- char statemid[32]; /* statement id */
- char descrpid[32]; /* descriptor id */
- char *statement; /* query text */
- int fieldcount; /* field count */
- int i; /* field index */
- loc_t *locator;
- int loc_t_type=CLOCATORTYPE; /* WORKAROUND: TYPE=CLOCATORTYPE doesn't work, */
- int sqlchar_type=SQLCHAR; /* don't ask me, why. */
- char *char_tmp;
- long len;
- int indicator;
- long sqlerrd[6];
- int e;
-
-
-EXEC SQL END DECLARE SECTION;
-
- int ctype;
- int affected_rows;
- int query_type;
- int cursoryproc;
-
- IFXLS_FETCH();
-
- if(ZEND_NUM_ARGS()<2) {
- WRONG_PARAM_COUNT;
- }
-
- IFXG(sv_sqlcode) = 0;
-
- /* get the first 2 parameters,
- php4 insists on the correct number of arguments */
- switch(ZEND_NUM_ARGS()) {
- case 2:
- if (zend_get_parameters_ex(2, &query, &ifx_link)==FAILURE)
- RETURN_FALSE;
- break;
- case 3:
- if (zend_get_parameters_ex(3, &query, &ifx_link, &dummy)==FAILURE)
- RETURN_FALSE;
- break;
- case 4:
- if (zend_get_parameters_ex(4, &query, &ifx_link, &dummy, &dummy)==FAILURE)
- RETURN_FALSE;
- break;
- }
-
- id = -1;
- ZEND_FETCH_RESOURCE2(ifx, char *, ifx_link, id, "IFX link", IFXL(le_link), IFXL(le_plink));
-
- affected_rows = -1; /* invalid */
-
-
- convert_to_string_ex(query);
-
- statement = (*query)->value.str.val;
- IFXG(cursorid)++;
- sprintf(statemid, "statem%x", IFXG(cursorid));
- sprintf(cursorid, "cursor%x", IFXG(cursorid));
- sprintf(descrpid, "descrp%x", IFXG(cursorid));
-
- EXEC SQL set connection :ifx;
- if (ifx_check() < 0) {
- IFXG(sv_sqlcode) = SQLCODE;
- php_error(E_WARNING,"Set connection %s fails (%s)",
- ifx,
- ifx_error(ifx));
- RETURN_FALSE;
- }
- EXEC SQL PREPARE :statemid FROM :statement;
- if (ifx_check() < 0) {
- IFXG(sv_sqlcode) = SQLCODE;
- php_error(E_WARNING,"Prepare fails (%s)",
- ifx_error(ifx));
- RETURN_FALSE;
- }
- affected_rows = sqlca.sqlerrd[0]; /* save estimated affected rows */
- for (e = 0; e < 6; e++) sqlerrd[e] = sqlca.sqlerrd[e];
- EXEC SQL ALLOCATE DESCRIPTOR :descrpid WITH MAX 384;
- if (ifx_check() < 0) {
- IFXG(sv_sqlcode) = SQLCODE;
- php_error(E_WARNING,"Allocate desciptor <%s> fails (%s)",
- descrpid,
- ifx_error(ifx));
- EXEC SQL free :statemid;
- RETURN_FALSE;
- }
- EXEC SQL DESCRIBE :statemid USING SQL DESCRIPTOR :descrpid;
- if (ifx_check() < 0) {
- IFXG(sv_sqlcode) = SQLCODE;
- php_error(E_WARNING,"Describe fails (%s)",
- ifx_error(ifx));
- EXEC SQL DEALLOCATE DESCRIPTOR :descrpid;
- EXEC SQL free :statemid;
- RETURN_FALSE;
- }
-
- query_type = sqlca.sqlcode;
-
- Ifx_Result = (IFX_RES *)emalloc(sizeof(IFX_RES));
- if (Ifx_Result == NULL) {
- IFXG(sv_sqlcode) = SQLCODE;
- php_error(E_WARNING,"Out of memory allocating IFX_RES");
- EXEC SQL DEALLOCATE DESCRIPTOR :descrpid;
- EXEC SQL free :statemid;
- RETURN_FALSE;
- }
-
- /* initialize result data structure */
-
- Ifx_Result->rowid = 0;
- strcpy(Ifx_Result->connecid, ifx);
- strcpy(Ifx_Result->descrpid, descrpid);
- strcpy(Ifx_Result->statemid, statemid);
- for (i = 0; i < MAX_RESID; ++i)
- Ifx_Result->res_id[i] = -1;
-
- cursoryproc = 0;
- if (query_type == SQ_EXECPROC) {
- EXEC SQL GET DESCRIPTOR :descrpid :i = COUNT;
- if (i > 0) {
- cursoryproc = 1;
- }
- }
-
- Ifx_Result->iscursory = -1; /* prevent ifx_do */
- Ifx_Result->paramquery=0;
-
- if ((query_type != 0) && (!cursoryproc)) { /* NO RESULT SET */
- /* ##
- ## NONSELECT-STATEMENT
- ##
- */
- pval **pblobidarr, **tmp;
-
- Ifx_Result->iscursory = 0;
-
- strcpy(Ifx_Result->cursorid, cursorid);
- strcpy(Ifx_Result->cursorid, "");
- strcpy(Ifx_Result->descrpid, descrpid);
-
-
- if(ZEND_NUM_ARGS()>3) {
- WRONG_PARAM_COUNT;
- }
- if(ZEND_NUM_ARGS()==3) {
- Ifx_Result->paramquery=1;
- if (zend_get_parameters_ex(3, &dummy, &dummy,&pblobidarr) == FAILURE) {
- php_error(E_WARNING,"Can't get blob array param");
- EXEC SQL DEALLOCATE DESCRIPTOR :descrpid;
- EXEC SQL free :statemid;
- efree(Ifx_Result);
- RETURN_FALSE;
- }
- if((*pblobidarr)->type != IS_ARRAY) {
- php_error(E_WARNING,"blob-parameter not an array");
- EXEC SQL DEALLOCATE DESCRIPTOR :descrpid;
- EXEC SQL free :statemid;
- efree(Ifx_Result);
- RETURN_FALSE;
- }
- zend_hash_internal_pointer_reset((*pblobidarr)->value.ht);
- i=1;
- while (zend_hash_get_current_data((*pblobidarr)->value.ht,
- (void **) &tmp) == SUCCESS) {
- convert_to_long(*tmp);
- if ((query_type == SQ_UPDATE) || (query_type == SQ_UPDALL)) {
- EXEC SQL SET DESCRIPTOR :descrpid COUNT = :i;
- }
- /* TEXT/BYTE */
- if(php3_intifx_getType((int)((*tmp)->value.lval),&EG(regular_list))==TYPE_BLTEXT || php3_intifx_getType((int)((*tmp)->value.lval),&EG(regular_list))==TYPE_BLBYTE) {
- locator=php3_intifx_get_blobloc((int)((*tmp)->value.lval),&EG(regular_list));
- if(locator==NULL) {
- php_error(E_WARNING,"%d is not a Informix blob-result index",
- (int)((*tmp)->value.lval));
- EXEC SQL DEALLOCATE DESCRIPTOR :descrpid;
- EXEC SQL free :statemid;
- efree(Ifx_Result);
- RETURN_FALSE;
- }
- if(locator->loc_loctype==LOCFNAME) {
- locator->loc_oflags=LOC_RONLY;
- }
- EXEC SQL SET DESCRIPTOR :descrpid VALUE :i
- DATA= :*locator,
- TYPE=:loc_t_type;
- }
- /* CHAR */
- if(php3_intifx_getType((int)((*tmp)->value.lval),&EG(regular_list))==TYPE_CHAR) {
- len=php3_intifx_get_char((int)((*tmp)->value.lval),&EG(regular_list),&char_tmp);
- indicator=0;
- if(char_tmp==NULL || len<0)
- indicator=-1;
- len++;
- EXEC SQL SET DESCRIPTOR :descrpid VALUE :i
- DATA= :char_tmp,
- LENGTH= :len,
- INDICATOR= :indicator,
- TYPE= :sqlchar_type;
- }
-
- i++;
- zend_hash_move_forward((*pblobidarr)->value.ht);
- } /* while */
- } /* if paramquery */
- Ifx_Result->affected_rows = affected_rows; /* saved estimated from prepare */
- for (e = 0; e < 6; e++) Ifx_Result->sqlerrd[e] = sqlerrd[e];
- } else {
- /* ##
- ** SELECT-STATEMENT
- **
- */
-
- ctype = 0;; /* preset */
-
- switch(ZEND_NUM_ARGS()) {
- case 2:
- break;
- case 3:
- if (zend_get_parameters_ex(3, &dummy, &dummy, &cursortype)==FAILURE) {
- RETURN_FALSE;
- }
- convert_to_long_ex(cursortype);
- ctype = (*cursortype)->value.lval;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- } /* case */
- strcpy(Ifx_Result->cursorid, cursorid);
-
- Ifx_Result->iscursory = 1;
- Ifx_Result->affected_rows = affected_rows; /* saved estimated from prepare */
- for (e = 0; e < 6; e++) Ifx_Result->sqlerrd[e] = sqlerrd[e];
- EXEC SQL GET DESCRIPTOR :descrpid :fieldcount = COUNT;
- if (ifx_check() < 0) {
- IFXG(sv_sqlcode) = SQLCODE;
- php_error(E_WARNING,"Can not get descriptor %s (%s)",
- descrpid,
- ifx_error(ifx));
- EXEC SQL DEALLOCATE DESCRIPTOR :descrpid;
- EXEC SQL free :statemid;
- efree(Ifx_Result);
- RETURN_FALSE;
- }
- Ifx_Result->numcols = fieldcount;
-
- Ifx_Result->isscroll = Ifx_Result->ishold = 0;
- if (ctype & IFX_SCROLL)
- Ifx_Result->isscroll = 1;
- if (ctype & IFX_HOLD)
- Ifx_Result->ishold = 1;
-
- } /* if select */
-
- ZEND_REGISTER_RESOURCE(return_value, Ifx_Result, IFXL(le_result));
-
-}
-/* }}} */
-
-/* ----------------------------------------------------------------------
-** int ifx_do(int resultid)
-**
-** executes a previously prepared query or opens a cursor for it
-**
-** returns TRUE on success, false on error
-** does NOT free $resultid on error !!!
-**
-** also sets (real) affected_rows for non-select statements
-** for retrieval by ifx_affected_rows
-** ----------------------------------------------------------------------
-*/
-
-/* {{{ proto int ifx_do(int resultid)
- Executes a previously prepared query or opens a cursor for it */
-PHP_FUNCTION(ifx_do)
-{
- pval **result;
- IFX_RES *Ifx_Result;
-
-EXEC SQL BEGIN DECLARE SECTION;
- char *ifx; /* connection ID */
- char *cursorid; /* query cursor id */
- char *statemid; /* statement id */
- char *descrpid; /* descriptor id */
- int fieldcount; /* field count */
- int i; /* field index */
- short fieldtype;
- loc_t *locator;
-
- int e;
-
-$ifdef HAVE_IFX_IUS;
- fixed binary 'blob' ifx_lo_t *slocator;
-$endif;
-
-EXEC SQL END DECLARE SECTION;
-
- int locind;
- char *blobfilename;
-
- IFXLS_FETCH();
-
- switch(ZEND_NUM_ARGS()) {
- case 0:
- WRONG_PARAM_COUNT;
- break;
- case 1:
- if (zend_get_parameters_ex(1, &result)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- ZEND_FETCH_RESOURCE(Ifx_Result, IFX_RES *, result, -1, "Informix Result", IFXL(le_result));
-
- IFXG(sv_sqlcode) = 0;
-
- ifx = Ifx_Result->connecid;
- cursorid = Ifx_Result->cursorid;
- statemid = Ifx_Result->statemid;
- descrpid = Ifx_Result->descrpid;
- fieldcount = Ifx_Result->numcols;
-
- EXEC SQL set connection :ifx;
- if (ifx_check() < 0) {
- IFXG(sv_sqlcode) = SQLCODE;
- php_error(E_WARNING,"Set connection %s fails (%s)",
- ifx,
- ifx_error(ifx));
- RETURN_FALSE;
- }
-
- if (Ifx_Result->iscursory < 0) {
- php_error(E_WARNING, "Resultindex %d is not a prepared query",
- (*result)->value.lval);
- RETURN_FALSE;
- }
- if (Ifx_Result->iscursory==0) { /* execute immediate */
- if(Ifx_Result->paramquery!=0) {
- EXEC SQL EXECUTE :statemid USING SQL DESCRIPTOR :descrpid;
- } else {
- EXEC SQL EXECUTE :statemid;
- }
- if (ifx_check() < 0) {
- IFXG(sv_sqlcode) = SQLCODE;
- php_error(E_WARNING,"Execute immediate fails : %s ",
- ifx_error(ifx));
- RETURN_FALSE;
- }
- Ifx_Result->affected_rows = sqlca.sqlerrd[2]; /* really affected */
- for (e = 0; e < 6; e++) Ifx_Result->sqlerrd[e] = sqlca.sqlerrd[e];
- } else { /* open cursor */
- if (Ifx_Result->isscroll)
- if (Ifx_Result->ishold)
- EXEC SQL DECLARE :cursorid SCROLL CURSOR WITH HOLD FOR :statemid;
- else
- EXEC SQL DECLARE :cursorid SCROLL CURSOR FOR :statemid;
- else
- if (Ifx_Result->ishold)
- EXEC SQL DECLARE :cursorid CURSOR WITH HOLD FOR :statemid;
- else
- EXEC SQL DECLARE :cursorid CURSOR FOR :statemid;
-
- if (ifx_check() < 0) {
- IFXG(sv_sqlcode) = SQLCODE;
- php_error(E_WARNING,"Declare cursor fails (%s)", ifx_error(ifx));
- RETURN_FALSE;
- }
- EXEC SQL OPEN :cursorid;
- if (ifx_check() < 0) {
- IFXG(sv_sqlcode) = SQLCODE;
- php_error(E_WARNING,"Open cursor fails (%s)", ifx_error(ifx));
- RETURN_FALSE;
- }
-
- /* check for text/blob columns */
-
-
- locind = 0;
- for (i = 1; i <= fieldcount; ++i) {
- EXEC SQL GET DESCRIPTOR :descrpid VALUE :i :fieldtype = TYPE;
- if (
- (fieldtype == SQLTEXT) || (fieldtype == SQLBYTES)
-$ifdef HAVE_IFX_IUS;
- || (fieldtype==SQLUDTFIXED)
-$endif;
- ) {
-
- int bid = 0;
- if(fieldtype==SQLTEXT) {
- bid=php3_intifx_create_blob(TYPE_BLTEXT,BLMODE_INMEM,"",-1,&EG(regular_list));
- locator=php3_intifx_get_blobloc(bid,&EG(regular_list));
- EXEC SQL SET DESCRIPTOR :descrpid VALUE :i DATA = :*locator;
- }
- if(fieldtype==SQLBYTES) {
- if(IFXG(blobinfile)==0) {
- bid=php3_intifx_create_blob(TYPE_BLBYTE,BLMODE_INMEM,"",-1,&EG(regular_list));
- locator=php3_intifx_get_blobloc(bid,&EG(regular_list));
- } else {
- blobfilename=php3_intifx_create_tmpfile(i);
- bid=php3_intifx_create_blob(
- TYPE_BLBYTE,BLMODE_INFILE,
- blobfilename,strlen(blobfilename),&EG(regular_list));
- locator=php3_intifx_get_blobloc(bid,&EG(regular_list));
- locator->loc_oflags=LOC_WONLY;
- }
- EXEC SQL SET DESCRIPTOR :descrpid VALUE :i DATA = :*locator;
- }
-$ifdef HAVE_IFX_IUS;
- if(fieldtype==SQLUDTFIXED) {
- bid=php3_intifxus_new_slob(&EG(regular_list));
- slocator=php3_intifxus_get_slobloc(bid,&EG(regular_list));
- EXEC SQL SET DESCRIPTOR :descrpid VALUE :i DATA = :*slocator;
- }
-$endif;
- Ifx_Result->res_id[locind]=bid;
- ++locind;
- }
- }
-
- } /* end open cursor */
-
- RETURN_TRUE;
-
-}
-/* }}} */
-
-
-
-
-/* ----------------------------------------------------------------------
-** string ifx_error([int connection_id]);
-**
-** returns the Informix error codes (SQLSTATE & SQLCODE)
-**
-** connection id is not checked, but remains for compatibility
-** ----------------------------------------------------------------------
-*/
-
-/* {{{ proto string ifx_error([int connection_id])
- Returns the Informix error codes (SQLSTATE & SQLCODE) */
-PHP_FUNCTION(ifx_error)
-{
- pval **ifx_link;
- int id;
- IFXLS_FETCH();
-
-
- switch(ZEND_NUM_ARGS()) {
- case 0:
- id = IFXG(default_link);
- break;
- case 1:
- if (zend_get_parameters_ex(1, &ifx_link)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- RETURN_STRING(ifx_error(0),0); /* ifx_error returns emalloced string */
-}
-/* }}} */
-
-/* ----------------------------------------------------------------------
-** string ifx_errormsg([int errorcode])
-**
-** returns the Informix errormessage associated with
-** the most recent Informix error if SQLCODE is nonzero, or,
-** when the optional "errocode" param is present, the errormessage
-** corresponding to "errorcode".
-** ----------------------------------------------------------------------
-*/
-
-/* {{{ proto string ifx_errormsg([int errorcode])
- Returns the Informix errormessage associated with */
-PHP_FUNCTION(ifx_errormsg)
-{
- pval **errcode;
-
- int ifx_errorcode;
- int msglen, maxmsglen;
- char *ifx_errmsg;
- char * returnmsg;
-
- IFXLS_FETCH();
-
- switch(ZEND_NUM_ARGS()) {
- case 0:
- if (IFXG(sv_sqlcode) == 0)
- ifx_errorcode = SQLCODE;
- else
- ifx_errorcode = IFXG(sv_sqlcode);
- break;
- case 1:
- if (zend_get_parameters_ex(1, &errcode)==FAILURE) {
- RETURN_FALSE;
- }
- convert_to_long_ex(errcode);
- ifx_errorcode = (*errcode)->value.lval;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- maxmsglen = 255;
- ifx_errmsg = (char *)malloc(maxmsglen+1);
- if (ifx_errorcode != 0) {
- rgetlmsg(ifx_errorcode, ifx_errmsg, maxmsglen, &msglen);
- if (msglen > maxmsglen) {
- maxmsglen = msglen + 1;
- free(ifx_errmsg);
- ifx_errmsg = (char *)malloc(maxmsglen + 1);
- rgetlmsg(ifx_errorcode, ifx_errmsg, maxmsglen, &msglen);
- }
- } else {
- ifx_errmsg[0] = 0;
- }
-
- returnmsg = (char *) emalloc(strlen(ifx_errmsg) + 128);
- sprintf(returnmsg,ifx_errmsg, sqlca.sqlerrm);
- free(ifx_errmsg);
- RETURN_STRING(returnmsg,0);
-
-}
-/* }}} */
-
-/* --------------------------------------------------------------
-** int ifx_affected_rows(int resultid)
-**
-** returns the number of rows affected by query $resultid
-**
-** for selects : estimated number of rows (sqlerrd[0])
-** for insert/update/delete : real number (sqlerrd[2])
-** ---------------------------------------------------------------
-*/
-
-/* {{{ proto int ifx_affected_rows(int resultid)
- Returns the number of rows affected by query identified by resultid */
-PHP_FUNCTION(ifx_affected_rows)
-{
- pval **result;
- IFX_RES *Ifx_Result;
-
- IFXLS_FETCH();
-
- switch(ZEND_NUM_ARGS()) {
- case 0:
- WRONG_PARAM_COUNT;
- break;
- case 1:
- if (zend_get_parameters_ex(1, &result)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- IFXG(sv_sqlcode )= 0;
-
- ZEND_FETCH_RESOURCE(Ifx_Result, IFX_RES *, result, -1, "Informix Result", IFXL(le_result));
-
- return_value->value.lval = Ifx_Result->affected_rows;
- return_value->type = IS_LONG;
-}
-/* }}} */
-
-/* ----------------------------------------------------------------------
-** array ifx_fetch_row(int resultid [, mixed $position])
-**
-** fetches the next row, or if using a scroll cursor, and position
-** is present, the row as given in position, into an associative
-** array with the fieldnames as key
-**
-** returns FALSE on error
-**
-** position can be : "FIRST", "NEXT", "LAST", "PREVIOUS", "CURRENT"
-** or an absolute row number
-** ----------------------------------------------------------------------
-*/
-
-/* {{{ proto array ifx_fetch_row(int resultid [, mixed position])
- Fetches the next row or <position> row if using a scroll cursor */
-PHP_FUNCTION(ifx_fetch_row)
-{
- pval **result, **position;
- IFX_RES *Ifx_Result;
-
-EXEC SQL BEGIN DECLARE SECTION;
- char *ifx; /* connection ID */
- char *cursorid; /* query cursor id */
- char *statemid; /* statement id */
- char *descrpid; /* descriptor id */
- int fieldcount; /* field count */
- int i; /* an index */
- char fieldname[64]; /* fieldname */
- short fieldtype; /* field type */
- int fieldleng; /* field length */
-
-$ifdef HAVE_IFX_IUS;
- ifx_int8_t int8_var;
- lvarchar *lvar_tmp;
-$endif;
-
- short indicator;
- int int_data;
- char *char_data;
- long date_data;
- interval intvl_data = {0};
- datetime dt_data = {0};
- decimal dec_data = {0};
- short short_data;
- loc_t *locator_b;
-
-$ifdef HAVE_IFX_IUS;
- fixed binary 'blob' ifx_lo_t *slocator;
-$endif;
-
- float float_data;
- double double_data;
- int fetch_row;
-EXEC SQL END DECLARE SECTION;
-
- int num_fields;
- int locind,bid,bid_b;
-
- char string_data[256];
- long long_data;
- char *p;
- char *blobfilename;
-
- char *fetch_pos;
-
- char *nullstr;
-
- IFXLS_FETCH();
-
- switch(ZEND_NUM_ARGS()) {
- case 0:
- WRONG_PARAM_COUNT;
- break;
- case 1:
- if (zend_get_parameters_ex(1, &result)==FAILURE) {
- RETURN_FALSE;
- }
- fetch_pos = NULL;
- fetch_row = 0;
- break;
- case 2:
- if (zend_get_parameters_ex(2, &result, &position)==FAILURE) {
- RETURN_FALSE;
- }
- if ((*position)->type != IS_STRING) {
- fetch_pos = NULL;
- fetch_row = (*position)->value.lval;
- } else {
- fetch_pos = (*position)->value.str.val;
- fetch_row = 0;
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- ZEND_FETCH_RESOURCE(Ifx_Result, IFX_RES *, result, -1, "Informix Result", IFXL(le_result));
-
- nullstr=php3_intifx_null();
-
- IFXG(sv_sqlcode) = 0;
-
- if (strcmp(Ifx_Result->cursorid,"") == 0) {
- php_error(E_WARNING,"Not a select cursor !");
- RETURN_FALSE;
- }
-
- ifx = Ifx_Result->connecid;
- cursorid = Ifx_Result->cursorid;
- statemid = Ifx_Result->statemid;
- descrpid = Ifx_Result->descrpid;
- fieldcount = Ifx_Result->numcols;
-
- EXEC SQL set connection :ifx;
- if (ifx_check() < 0) {
- IFXG(sv_sqlcode) = SQLCODE;
- php_error(E_WARNING,"Set connection %s fails (%s)",
- ifx,
- ifx_error(ifx));
- RETURN_FALSE;
- }
-
-
- if (! Ifx_Result->isscroll) {
- EXEC SQL FETCH :cursorid USING SQL DESCRIPTOR :descrpid;
- } else {
- if (fetch_pos == NULL) {
- if (fetch_row != 0) {
- EXEC SQL FETCH ABSOLUTE :fetch_row
- :cursorid USING SQL DESCRIPTOR :descrpid;
- } else {
- EXEC SQL FETCH NEXT :cursorid USING SQL DESCRIPTOR :descrpid;
- }
- } else {
- if (strcasecmp(fetch_pos,"NEXT") == 0) {
- EXEC SQL FETCH NEXT :cursorid USING SQL DESCRIPTOR :descrpid;
- } else {
- if (strcasecmp(fetch_pos,"PREVIOUS") == 0) {
- EXEC SQL FETCH PREVIOUS :cursorid USING SQL DESCRIPTOR :descrpid;
- } else {
- if (strcasecmp(fetch_pos,"FIRST") == 0) {
- EXEC SQL FETCH FIRST :cursorid USING SQL DESCRIPTOR :descrpid;
- } else {
- if (strcasecmp(fetch_pos,"LAST") == 0) {
- EXEC SQL FETCH LAST :cursorid USING SQL DESCRIPTOR :descrpid;
- } else {
- if (strcasecmp(fetch_pos,"CURRENT") == 0) {
- EXEC SQL FETCH CURRENT :cursorid USING SQL DESCRIPTOR :descrpid;
- } else {
- php_error(E_WARNING, "invalid positioning arg on fetch");
- }}}}}
- }
- }
- if(SQLCODE!=-451) {
- switch (ifx_check()) {
- case IFX_ERROR:
- IFXG(sv_sqlcode) = SQLCODE;
- php_error(E_WARNING,
- "Can not fetch row on cursor %s (%s)",
- ifx_error(ifx),
- cursorid);
- RETURN_FALSE;
- break;
- case IFX_NODATA:
- RETURN_FALSE;
- break;
- default:
- break;
- }
- }
- Ifx_Result->rowid++;
-
- if (array_init(return_value)==FAILURE) {
- RETURN_FALSE;
- }
- num_fields = fieldcount;
-
- locind = 0;
- for (i = 1; i <= num_fields; i++) {
- EXEC SQL GET DESCRIPTOR :descrpid VALUE :i :fieldtype = TYPE,
- :fieldname = NAME,
- :fieldleng = LENGTH,
- :indicator = INDICATOR;
- if (ifx_check() < 0) {
- IFXG(sv_sqlcode) = SQLCODE;
- php_error(E_WARNING,"Get descriptor (field # %d) fails (%s)",
- i,
- ifx_error(ifx));
- RETURN_FALSE;
- }
-
- p = fieldname; /* rtrim fieldname */
- while ((*p != ' ') && (p < &fieldname[sizeof(fieldname) - 1])) ++p;
- *p = 0;
-
- if (strcmp("(expression)", fieldname) == 0) /* stored proc */
- sprintf(fieldname, "[Expr_%d]", i);
-
- if (indicator == -1) { /* NULL */
- if((IFXG(textasvarchar)==0
- && fieldtype==SQLTEXT)
- || (IFXG(byteasvarchar)==0
- && fieldtype==SQLBYTES)) {
-
- bid_b=Ifx_Result->res_id[locind];
- bid=php3_intifx_copy_blob(bid_b, &EG(regular_list));
- php3_intifx_update_blob(bid,nullstr,strlen(nullstr),&EG(regular_list));
- add_assoc_long(return_value,fieldname,bid);
- ++locind;
- continue;
- }
- if (
- (fieldtype==SQLTEXT) || (fieldtype==SQLBYTES)
-$ifdef HAVE_IFX_IUS;
- || (fieldtype==SQLUDTFIXED)
-$endif;
- ) {
- ++locind;
- }
- add_assoc_string(return_value, fieldname, nullstr, DUP);
- continue;
- } /* NULL */
- switch (fieldtype) {
- case SQLSERIAL :
- case SQLINT :
- EXEC SQL GET DESCRIPTOR :descrpid VALUE :i :int_data = DATA;
- long_data = int_data;
- sprintf(string_data,"%ld", long_data);
- add_assoc_string(return_value, fieldname, string_data, DUP);
- break;
- case SQLSMINT :
- EXEC SQL GET DESCRIPTOR :descrpid VALUE :i :short_data = DATA;
- long_data = short_data;
- sprintf(string_data,"%ld", long_data);
- add_assoc_string(return_value, fieldname, string_data, DUP);
- break;
- case SQLDECIMAL :
- case SQLMONEY :
- EXEC SQL GET DESCRIPTOR :descrpid VALUE :i :dec_data = DATA;
- memset(string_data, 0x20, 64);
- dectoasc(&dec_data, string_data, 63, -1);
- for (p =string_data; *p != ' '; ++p) ;
- *p = 0;
- add_assoc_string(return_value, fieldname, string_data, DUP);
- break;
- case SQLSMFLOAT :
- EXEC SQL GET DESCRIPTOR :descrpid VALUE :i :float_data = DATA;
- double_data = float_data;
- sprintf(string_data,"%17.17g", double_data);
- add_assoc_string(return_value, fieldname, string_data, DUP);
- break;
- case SQLFLOAT :
- EXEC SQL GET DESCRIPTOR :descrpid VALUE :i :double_data = DATA;
- sprintf(string_data,"%17.17g", double_data);
- add_assoc_string(return_value, fieldname, string_data, DUP);
- break;
- case SQLDATE :
- EXEC SQL GET DESCRIPTOR :descrpid VALUE :i :date_data = DATA;
- rdatestr(date_data, string_data);
- add_assoc_string(return_value, fieldname, string_data, DUP);
- break;
- case SQLDTIME :
- EXEC SQL GET DESCRIPTOR :descrpid VALUE :i :dt_data = DATA;
- dttoasc(&dt_data, string_data);
- add_assoc_string(return_value, fieldname, string_data, DUP);
- break;
- case SQLINTERVAL:
- EXEC SQL GET DESCRIPTOR :descrpid VALUE :i :intvl_data = DATA;
- intoasc(&intvl_data, string_data);
- add_assoc_string(return_value, fieldname, string_data, DUP);
- break;
-
-$ifdef HAVE_IFX_IUS;
- case SQLSERIAL8 :
- case SQLINT8 :
- EXEC SQL GET DESCRIPTOR :descrpid VALUE :i :int8_var = DATA;
- memset(string_data, ' ', sizeof(string_data));
- ifx_int8toasc(&int8_var,string_data,200);
- p = string_data; /* rtrim string_data */
- while ((*p != ' ') && (p < &string_data[sizeof(string_data) - 1])) ++p;
- *p = 0;
- add_assoc_string(return_value, fieldname, string_data, DUP);
- break;
- case SQLLVARCHAR:
- ifx_var_flag(&lvar_tmp,1);
- EXEC SQL GET DESCRIPTOR :descrpid VALUE :i :lvar_tmp = DATA;
-
- fieldleng=ifx_var_getlen(&lvar_tmp);
-
- if (fieldleng > 2) fieldleng -= 2; /* fix by Alex Shepherd */
-
- if ((char_data = (char *)emalloc(fieldleng + 1)) == NULL) {
- php_error(E_WARNING, "Out of memory");
- RETURN_FALSE;
- }
- memcpy(char_data,ifx_var_getdata(&lvar_tmp),fieldleng);
- ifx_var_dealloc(&lvar_tmp);
- add_assoc_stringl(return_value, fieldname, char_data, fieldleng,0);
- break;
- case SQLBOOL:
-$endif;
- case SQLVCHAR :
- case SQLNVCHAR :
- case SQLCHAR :
- case SQLNCHAR :
- if ((char_data = (char *)emalloc(fieldleng + 1)) == NULL) {
- php_error(E_WARNING, "Out of memory");
- RETURN_FALSE;
- }
- EXEC SQL GET DESCRIPTOR :descrpid VALUE :i :char_data = DATA;
- if (IFXG(charasvarchar) != 0
- && (fieldtype == SQLCHAR || fieldtype == SQLNCHAR)) {
- ldchar(char_data, fieldleng, char_data);
- }
- add_assoc_string(return_value, fieldname, char_data, DUP);
- efree(char_data);
- char_data = NULL;
- break;
-
-$ifdef HAVE_IFX_IUS;
- case SQLUDTFIXED :
- bid_b=Ifx_Result->res_id[locind];
- add_assoc_long(return_value,fieldname,bid_b);
-
- bid=php3_intifxus_new_slob(&EG(regular_list));
- slocator=php3_intifxus_get_slobloc(bid,&EG(regular_list));
- EXEC SQL SET DESCRIPTOR :descrpid VALUE :i DATA = :*slocator;
- Ifx_Result->res_id[locind]=bid;
- ++locind;
- break;
-$endif;
-
- case SQLBYTES :
- case SQLTEXT :
- bid_b=Ifx_Result->res_id[locind];
- locator_b=php3_intifx_get_blobloc(bid_b,&EG(regular_list));
- ++locind;
-
- EXEC SQL GET DESCRIPTOR :descrpid VALUE :i :*locator_b = DATA;
- /* work around for ESQL/C bug with NULL values and BLOBS */
- if ((locator_b->loc_status < 0) && (locator_b->loc_bufsize == 0)){
- locator_b->loc_indicator = -1;
- }
- /* normal check for NULL values */
- if (locator_b->loc_indicator == -1) {
- if((IFXG(textasvarchar)==0 && fieldtype==SQLTEXT)
- || (IFXG(byteasvarchar)==0 && fieldtype==SQLBYTES)) {
- bid_b=Ifx_Result->res_id[locind];
- bid=php3_intifx_copy_blob(bid_b, &EG(regular_list));
- php3_intifx_update_blob(bid,nullstr,strlen(nullstr),&EG(regular_list));
- add_assoc_long(return_value,fieldname,bid);
- break;
- }
- if (
- (fieldtype==SQLTEXT) || (fieldtype==SQLBYTES)
-$ifdef HAVE_IFX_IUS;
- || (fieldtype==SQLUDTFIXED)
-$endif;
- ) {
- add_assoc_string(return_value, fieldname, nullstr, DUP);
- break;
- }
- }
-
- if (locator_b->loc_status < 0) { /* blob too large */
- php_error(E_WARNING,"no memory (%d bytes) for blob",
- locator_b->loc_bufsize);
- RETURN_FALSE;
- }
- /* copy blob */
- bid=php3_intifx_copy_blob(bid_b, &EG(regular_list));
- /* and generate new tempfile for next row */
- if(locator_b->loc_loctype==LOCFNAME) {
- blobfilename=php3_intifx_create_tmpfile(bid_b);
- php3_intifx_update_blob(bid_b,blobfilename,strlen(blobfilename),&EG(regular_list));
- efree(blobfilename);
- EXEC SQL SET DESCRIPTOR :descrpid VALUE :i
- DATA= :*locator_b;
- }
-
- /* return blob as VARCHAR ? */
- /* note that in case of "blobinfile" */
- /* you get the file name */
- /* a new one for every row ! */
- if((IFXG(textasvarchar)!=0
- && fieldtype==SQLTEXT)
- || (IFXG(byteasvarchar)!=0
- && fieldtype==SQLBYTES)) {
- char *content;
- long lg;
- lg=php3_intifx_get_blob(bid, &EG(regular_list), &content);
- if(content==NULL || lg<0) {
- add_assoc_string(return_value,fieldname,nullstr,DUP);
- } else {
- add_assoc_stringl(return_value,fieldname,content,lg,DUP);
- }
- php3_intifx_free_blob(bid, &EG(regular_list));
- break;
- }
- /* no, return as blob id */
- add_assoc_long(return_value,fieldname,bid);
- break;
- default :
- sprintf(string_data,"ESQL/C : %s : unsupported field type[%d]",
- fieldname,
- fieldleng);
- add_assoc_string(return_value, fieldname, string_data, DUP);
- break;
- }
-
- continue;
- }
-
-}
-/* }}} */
-
-
-
-/* ----------------------------------------------------------------------
-** int ifx_htmltbl_result(int resultid [, string htmltableoptions])
-**
-** formats all rows of the resultid query into a html table
-** the optional second argument is a string of <table> tag options
-**
-** returns the number of rows printed or FALSE on error
-** ----------------------------------------------------------------------
-*/
-
-/* {{{ proto int ifx_htmltbl_result(int resultid [, string htmltableoptions])
- Formats all rows of the resultid query into a html table */
-PHP_FUNCTION(ifx_htmltbl_result)
-{
- pval **result, **arg2;
- IFX_RES *Ifx_Result;
-
-EXEC SQL BEGIN DECLARE SECTION;
- char *ifx; /* connection ID */
- char *cursorid; /* query cursor id */
- char *statemid; /* statement id */
- char *descrpid; /* descriptor id */
- int fieldcount; /* field count */
- int i; /* an index */
- char fieldname[64]; /* fieldname */
- short fieldtype; /* field type */
- int fieldleng; /* field length */
-
-$ifdef HAVE_IFX_IUS;
- ifx_int8_t int8_var;
- lvarchar *lvar_tmp;
-$endif;
-
- short indicator;
- int int_data;
- char *char_data = NULL;
- long date_data;
- interval intvl_data = {0};
- datetime dt_data = {0};
- decimal dec_data = {0};
- short short_data;
- float float_data;
- double double_data;
- loc_t *locator_b;
-EXEC SQL END DECLARE SECTION;
-
-
- char *content;
- char *copy_content;
- long lg;
-
- char *nullstr;
-
- int num_fields;
-
- char string_data[256];
- long long_data;
- char *p;
- int locind,bid_b;
- char *table_options;
- int moredata;
-
- IFXLS_FETCH();
-
- switch (ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &result)==FAILURE) {
- RETURN_FALSE;
- }
- table_options = NULL;
- break;
- case 2:
- if (zend_get_parameters_ex(2, &result, &arg2)==FAILURE) {
- RETURN_FALSE;
- }
- table_options = (*arg2)->value.str.val;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- IFXG(sv_sqlcode) = 0;
-
- ZEND_FETCH_RESOURCE(Ifx_Result, IFX_RES *, result, -1, "Informix Result", IFXL(le_result));
-
- if (strcmp(Ifx_Result->cursorid,"") == 0) {
- php_error(E_WARNING,"Not a select cursor !");
- RETURN_FALSE;
- }
-
- ifx = Ifx_Result->connecid;
- cursorid = Ifx_Result->cursorid;
- statemid = Ifx_Result->statemid;
- descrpid = Ifx_Result->descrpid;
- fieldcount = Ifx_Result->numcols;
-
- EXEC SQL set connection :ifx;
- if (ifx_check() < 0) {
- IFXG(sv_sqlcode) = SQLCODE;
- php_error(E_WARNING,"Set connection %s fails (%s)",
- ifx,
- ifx_error(ifx));
- RETURN_FALSE;
- }
-
-
- /* try to fetch the first row */
- EXEC SQL FETCH :cursorid USING SQL DESCRIPTOR :descrpid;
- switch (ifx_check()) {
- case IFX_ERROR:
- IFXG(sv_sqlcode) = SQLCODE;
- php_error(E_WARNING,
- "Can not fetch next row on cursor %s (%s)",
- ifx_error(ifx),
- cursorid);
- RETURN_FALSE;
- break;
- case IFX_NODATA:
- moredata = 0;
- break;
- default:
- Ifx_Result->rowid = moredata = 1;
- break;
- }
-
- if(! moredata) {
- php_printf("<h2>No rows found</h2>\n");
- RETURN_LONG(0);
- }
- num_fields = fieldcount;
- nullstr = php3_intifx_null();
-
- /* start table tag */
- if (table_options == NULL)
- php_printf("<table><tr>");
- else
- php_printf("<table %s><tr>", table_options);
-
- /* table headings */
- for (i = 1; i <= num_fields; i++) {
- EXEC SQL GET DESCRIPTOR :descrpid VALUE :i :fieldname = NAME;
- if (ifx_check() < 0) {
- IFXG(sv_sqlcode) = SQLCODE;
- php_error(E_WARNING,"Get descriptor (field # %d) fails (%s)",
- i,
- ifx_error(ifx));
- RETURN_FALSE;
- }
-
- p = fieldname; /* Capitalize and rtrim fieldname */
- *p = toupper(*p);
- while ((*p != ' ') && (p < &fieldname[sizeof(fieldname) - 1])) ++p;
- *p = 0;
- if (strcmp("(expression)", fieldname) == 0) /* stored proc */
- sprintf(fieldname, "[Expr_%d]", i);
-
- php_printf("<th>%s</th>", fieldname);
- }
- php_printf("</tr>\n");
-
- /* start spitting out rows untill none left */
- while (moredata) {
- php_printf("<tr>");
- locind = 0;
- for (i = 1; i <= num_fields; i++) {
- EXEC SQL GET DESCRIPTOR :descrpid VALUE :i :fieldtype = TYPE,
- :fieldleng = LENGTH,
- :indicator = INDICATOR;
- if (ifx_check() < 0) {
- IFXG(sv_sqlcode) = SQLCODE;
- php_error(E_WARNING,"Get descriptor (field # %d) fails (%s)",
- i,
- ifx_error(ifx));
- RETURN_FALSE;
- }
-
- if (indicator == -1) { /* NULL */
- if(fieldtype==SQLTEXT || fieldtype==SQLBYTES) {
- ++locind;
- }
- php_printf("<td>%s</td>", nullstr);
- continue;
- }
- switch (fieldtype) {
- case SQLSERIAL :
- case SQLINT :
- EXEC SQL GET DESCRIPTOR :descrpid VALUE :i :int_data = DATA;
- long_data = int_data;
- sprintf(string_data,"%ld", long_data);
- php_printf("<td>%s</td>", string_data);
- break;
- case SQLSMINT :
- EXEC SQL GET DESCRIPTOR :descrpid VALUE :i :short_data = DATA;
- long_data = short_data;
- sprintf(string_data,"%ld", long_data);
- php_printf("<td>%s</td>", string_data);
- break;
- case SQLDECIMAL :
- case SQLMONEY :
- EXEC SQL GET DESCRIPTOR :descrpid VALUE :i :dec_data = DATA;
- memset(string_data, 0x20, 64);
- dectoasc(&dec_data, string_data, 63, -1);
- for (p =string_data; *p != ' '; ++p) ;
- *p = 0;
- php_printf("<td>%s</td>", string_data);
- break;
- case SQLSMFLOAT :
- EXEC SQL GET DESCRIPTOR :descrpid VALUE :i :float_data = DATA;
- double_data = float_data;
- sprintf(string_data,"%17.17g", double_data);
- php_printf("<td>%s</td>", string_data);
- break;
- case SQLFLOAT :
- EXEC SQL GET DESCRIPTOR :descrpid VALUE :i :double_data = DATA;
- sprintf(string_data,"%17.17g", double_data);
- php_printf("<td>%s</td>", string_data);
- break;
- case SQLDATE :
- EXEC SQL GET DESCRIPTOR :descrpid VALUE :i :date_data = DATA;
- rdatestr(date_data, string_data);
- php_printf("<td>%s</td>", string_data);
- break;
- case SQLDTIME :
- EXEC SQL GET DESCRIPTOR :descrpid VALUE :i :dt_data = DATA;
- dttoasc(&dt_data, string_data);
- php_printf("<td>%s</td>", string_data);
- break;
- case SQLINTERVAL:
- EXEC SQL GET DESCRIPTOR :descrpid VALUE :i :intvl_data = DATA;
- intoasc(&intvl_data, string_data);
- php_printf("<td>%s</td>", string_data);
- break;
-$ifdef HAVE_IFX_IUS;
- case SQLSERIAL8:
- case SQLINT8 :
- EXEC SQL GET DESCRIPTOR :descrpid VALUE :i :int8_var = DATA;
- memset(string_data, ' ', sizeof(string_data));
- ifx_int8toasc(&int8_var,string_data,200);
- p = string_data; /* rtrim string_data */
- while ((*p != ' ') && (p < &string_data[sizeof(string_data) - 1])) ++p;
- *p = 0;
- php_printf("<td>%s</td>", string_data);
- break;
- case SQLLVARCHAR:
- ifx_var_flag(&lvar_tmp,1);
- EXEC SQL GET DESCRIPTOR :descrpid VALUE :i :lvar_tmp = DATA;
-
- fieldleng=ifx_var_getlen(&lvar_tmp);
-
- if (fieldleng > 2) fieldleng -= 2; /* fix by Alex Shepherd */
-
- if ((char_data = (char *)emalloc(fieldleng + 1)) == NULL) {
- php_error(E_WARNING, "Out of memory");
- RETURN_FALSE;
- }
- memcpy(char_data,ifx_var_getdata(&lvar_tmp),fieldleng);
- ifx_var_dealloc(&lvar_tmp);
- add_assoc_stringl(return_value, fieldname, char_data, fieldleng,0);
- break;
-
- case SQLBOOL :
-$endif;
- case SQLCHAR :
- case SQLVCHAR :
- case SQLNCHAR :
- case SQLNVCHAR :
- if ((char_data = (char *)emalloc(fieldleng + 1)) == NULL) {
- php_error(E_WARNING, "Out of memory");
- RETURN_FALSE;
- }
- EXEC SQL GET DESCRIPTOR :descrpid VALUE :i :char_data = DATA;
- if (IFXG(charasvarchar) != 0
- && (fieldtype == SQLCHAR || fieldtype == SQLNCHAR)) {
- ldchar(char_data, fieldleng, char_data);
- }
- php_printf("<td>%s</td>", char_data);
- efree(char_data);
- char_data = NULL;
- break;
- case SQLTEXT :
- /* treated always as a long VARCHAR here */
- /* if blobinbfile, too bad */
- bid_b=Ifx_Result->res_id[locind];
- ++locind;
-
- locator_b=php3_intifx_get_blobloc(bid_b,&EG(regular_list));
-
- EXEC SQL GET DESCRIPTOR :descrpid VALUE :i
- :*locator_b = DATA;
- /* work around for ESQL/C bug with NULL values and BLOBS */
- if ((locator_b->loc_status < 0) && (locator_b->loc_bufsize == 0)){
- locator_b->loc_indicator = -1;
- }
- /* normal check for NULL values */
- if (locator_b->loc_indicator == -1) {
- if (
- (fieldtype==SQLTEXT) || (fieldtype==SQLBYTES)
-$ifdef HAVE_IFX_IUS;
- || (fieldtype==SQLUDTFIXED)
-$endif;
- ) {
- php_printf("<td>%s</td>", nullstr);
- break;
- }
- }
- if (locator_b->loc_status < 0) { /* blob too large */
- php_error(E_WARNING,"no memory (%d bytes) for blob",
- locator_b->loc_bufsize);
- RETURN_FALSE;
- }
-
- /* get blob contents */
- lg=php3_intifx_get_blob(bid_b, &EG(regular_list), &content);
-
- if(content==NULL || lg<0) {
- php_printf("<td>%s</td>", nullstr);
- } else {
- /* need an extra byte for string terminator */
- copy_content = malloc(lg + 1);
- if (copy_content == NULL) {
- php_error(E_WARNING,"no memory for TEXT column");
- RETURN_FALSE;
- }
- memcpy(copy_content, content, lg);
- copy_content[lg]=0;
- php_printf("<td>%s</td>", copy_content);
- free(copy_content);
- }
- break;
-
- case SQLBYTES :
- ++locind;
- php_printf("<td>(BYTE)</td>");
- break;
- default :
- sprintf(string_data,
- "ESQL/C : %s : unsupported field type[%d]",
- fieldname,
- fieldleng);
- php_printf("<td>%s</td>", string_data);
- break;
- }
-
- continue;
- }
- php_printf("</tr>\n");
- /* fetch next row */
- EXEC SQL FETCH :cursorid USING SQL DESCRIPTOR :descrpid;
- switch (ifx_check()) {
- case IFX_ERROR:
- IFXG(sv_sqlcode) = SQLCODE;
- php_error(E_WARNING,
- "Can not fetch next row on cursor %s (%s)",
- ifx_error(ifx),
- cursorid);
- RETURN_FALSE;
- break;
- case IFX_NODATA:
- moredata = 0;
- break;
- default:
- break;
- }
- Ifx_Result->rowid++;
-
- } /* endwhile (moredata); */
- php_printf("</table>\n");
- RETURN_LONG(Ifx_Result->rowid);
-
-}
-/* }}} */
-
-/* ----------------------------------------------------------------------
-** array ifx_fieldtypes(int resultid)
-**
-** returns an associative array with fieldnames as key
-** and SQL fieldtypes as data for query $resultid
-**
-** returns FALSE on error
-** ----------------------------------------------------------------------
-*/
-
-
-/* {{{ proto array ifx_fieldtypes(int resultid)
- Returns an associative array with fieldnames as key for query <resultid> */
-PHP_FUNCTION(ifx_fieldtypes)
-{
- pval **result;
- IFX_RES *Ifx_Result;
-
-EXEC SQL BEGIN DECLARE SECTION;
- char *ifx; /* connection ID */
- char *cursorid; /* query cursor id */
- char *statemid; /* statement id */
- char *descrpid; /* descriptor id */
- int fieldcount; /* field count */
- int i; /* an index */
- char fieldname[64]; /* fieldname */
- short fieldtype; /* field type */
-
- char *char_data = NULL;
-
-EXEC SQL END DECLARE SECTION;
-
- int num_fields;
-
- char *p;
-
- IFXLS_FETCH();
-
- switch (ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &result)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- IFXG(sv_sqlcode) = 0;
-
- ZEND_FETCH_RESOURCE(Ifx_Result, IFX_RES *, result, -1, "Informix Result", IFXL(le_result));
-
- if (strcmp(Ifx_Result->cursorid,"") == 0) {
- php_error(E_WARNING,"Not a select cursor !");
- RETURN_FALSE;
- }
-
- ifx = Ifx_Result->connecid;
- cursorid = Ifx_Result->cursorid;
- statemid = Ifx_Result->statemid;
- descrpid = Ifx_Result->descrpid;
- fieldcount = Ifx_Result->numcols;
-
- EXEC SQL set connection :ifx;
- if (ifx_check() < 0) {
- IFXG(sv_sqlcode) = SQLCODE;
- php_error(E_WARNING,"Set connection %s fails (%s)",
- ifx,
- ifx_error(ifx));
- RETURN_FALSE;
- }
-
- if (array_init(return_value)==FAILURE) {
- RETURN_FALSE;
- }
- num_fields = fieldcount;
- for (i = 1; i <= num_fields; i++) {
- EXEC SQL GET DESCRIPTOR :descrpid VALUE :i :fieldname = NAME,
- :fieldtype = TYPE;
- if (ifx_check() < 0) {
- IFXG(sv_sqlcode) = SQLCODE;
- php_error(E_WARNING,"Get descriptor (field # %d) fails (%s)",
- i,
- ifx_error(ifx));
- RETURN_FALSE;
- }
-
- p = fieldname; /* rtrim fieldname */
- while ((*p != ' ') && (p < &fieldname[sizeof(fieldname) - 1])) ++p;
- *p = 0;
- if (strcmp("(expression)", fieldname) == 0) /* stored proc */
- sprintf(fieldname, "[Expr_%d]", i);
-
- switch (fieldtype) {
- case SQLSERIAL :
- char_data = "SQLSERIAL";
- break;
- case SQLINT :
- char_data = "SQLINT";
- break;
- case SQLSMINT :
- char_data = "SQLSMINT";
- break;
- case SQLDECIMAL :
- char_data = "SQLDECIMAL";
- break;
- case SQLMONEY :
- char_data = "SQLMONEY";
- break;
- case SQLSMFLOAT :
- char_data = "SQLSMFLOAT";
- break;
- case SQLFLOAT :
- char_data = "SQLFLOAT";
- break;
- case SQLDATE :
- char_data = "SQLDATE";
- break;
- case SQLDTIME :
- char_data = "SQLDTIME";
- break;
- case SQLINTERVAL:
- char_data = "SQLINTERVAL";
- break;
- case SQLCHAR :
- char_data = "SQLCHAR";
- break;
- case SQLVCHAR :
- char_data = "SQLVCHAR";
- break;
- case SQLNCHAR :
- char_data = "SQLNCHAR";
- break;
- case SQLNVCHAR :
- char_data = "SQLNVCHAR";
- break;
- case SQLTEXT :
- char_data = "SQLTEXT";
- break;
- case SQLBYTES :
- char_data = "SQLBYTES";
- break;
-$ifdef HAVE_IFX_IUS;
- case SQLUDTFIXED :
- char_data = "SQLUDTFIXED";
- break;
- case SQLBOOL :
- char_data = "SQLBOOL";
- break;
- case SQLINT8 :
- char_data = "SQLINT8";
- break;
- case SQLSERIAL8 :
- char_data = "SQLSERIAL8";
- break;
- case SQLLVARCHAR :
- char_data = "SQLLVARCHAR";
- break;
-$endif;
- default :
- char_data=emalloc(20);
- sprintf(char_data,"ESQL/C : %i",fieldtype);
- break;
- } /* switch (fieldtype) */
-
- add_assoc_string(return_value, fieldname, char_data, DUP);
-
- } /* for() */
-
-}
-/* }}} */
-
-/* ----------------------------------------------------------------------
-** array ifx_fieldproperties(int resultid)
-**
-** returns an associative array with fieldnames as key
-** and SQL fieldproperties as data for query $resultid
-**
-** properties are encoded as : "SQLTYPE;length;precision;scale;ISNULLABLE"
-** where SQLTYPE = the Informix type like "SQLVCHAR" etc...
-** ISNULLABLE = "Y" or "N"
-**
-** returns FALSE on error
-** ----------------------------------------------------------------------
-*/
-
-/* {{{ proto array ifx_fieldproperties(int resultid)
- Returns an associative for query <resultid> array with fieldnames as key */
-PHP_FUNCTION(ifx_fieldproperties)
-{
- pval **result;
- IFX_RES *Ifx_Result;
-
-EXEC SQL BEGIN DECLARE SECTION;
- char *ifx; /* connection ID */
- char *cursorid; /* query cursor id */
- char *statemid; /* statement id */
- char *descrpid; /* descriptor id */
- int fieldcount; /* field count */
- int i; /* an index */
- char fieldname[64]; /* fieldname */
- short fieldtype; /* field type */
- char *char_data = NULL;
- int size;
- int precision;
- int scale;
- int isnullable;
-EXEC SQL END DECLARE SECTION;
-
- int num_fields;
-
- char string_data[256];
- char *p;
-
- IFXLS_FETCH();
-
- switch (ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &result)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- IFXG(sv_sqlcode) = 0;
-
- ZEND_FETCH_RESOURCE(Ifx_Result, IFX_RES *, result, -1, "Informix Result", IFXL(le_result));
-
- if (strcmp(Ifx_Result->cursorid,"") == 0) {
- php_error(E_WARNING,"Not a select cursor !");
- RETURN_FALSE;
- }
-
- ifx = Ifx_Result->connecid;
- cursorid = Ifx_Result->cursorid;
- statemid = Ifx_Result->statemid;
- descrpid = Ifx_Result->descrpid;
- fieldcount = Ifx_Result->numcols;
-
- EXEC SQL set connection :ifx;
- if (ifx_check() < 0) {
- IFXG(sv_sqlcode) = SQLCODE;
- php_error(E_WARNING,"Set connection %s fails (%s)",
- ifx,
- ifx_error(ifx));
- RETURN_FALSE;
- }
-
-
- if (array_init(return_value)==FAILURE) {
- RETURN_FALSE;
- }
- num_fields = fieldcount;
- for (i = 1; i <= num_fields; i++) {
- EXEC SQL GET DESCRIPTOR :descrpid VALUE :i :fieldname = NAME,
- :fieldtype = TYPE,
- :size = LENGTH,
- :precision = PRECISION,
- :scale = SCALE,
- :isnullable = NULLABLE;
- if (ifx_check() < 0) {
- IFXG(sv_sqlcode) = SQLCODE;
- php_error(E_WARNING,"Get descriptor (field # %d) fails (%s)",
- i,
- ifx_error(ifx));
- RETURN_FALSE;
- }
-
- p = fieldname; /* rtrim fieldname */
- while ((*p != ' ') && (p < &fieldname[sizeof(fieldname) - 1])) ++p;
- *p = 0;
- if (strcmp("(expression)", fieldname) == 0) /* stored proc */
- sprintf(fieldname, "[Expr_%d]", i);
-
- switch (fieldtype) {
- case SQLSERIAL :
- char_data = "SQLSERIAL";
- break;
- case SQLINT :
- char_data = "SQLINT";
- break;
- case SQLSMINT :
- char_data = "SQLSMINT";
- break;
- case SQLDECIMAL :
- char_data = "SQLDECIMAL";
- break;
- case SQLMONEY :
- char_data = "SQLMONEY";
- break;
- case SQLSMFLOAT :
- char_data = "SQLSMFLOAT";
- break;
- case SQLFLOAT :
- char_data = "SQLFLOAT";
- break;
- case SQLDATE :
- char_data = "SQLDATE";
- break;
- case SQLDTIME :
- char_data = "SQLDTIME";
- break;
- case SQLINTERVAL:
- char_data = "SQLINTERVAL";
- break;
- case SQLCHAR :
- char_data = "SQLCHAR";
- break;
- case SQLVCHAR :
- char_data = "SQLVCHAR";
- break;
- case SQLTEXT :
- char_data = "SQLTEXT";
- break;
- case SQLBYTES :
- char_data = "SQLBYTES";
- break;
- case SQLNCHAR :
- char_data = "SQLNCHAR";
- break;
- case SQLNVCHAR :
- char_data = "SQLNVCHAR";
- break;
-$ifdef HAVE_IFX_IUS;
- case SQLUDTFIXED :
- char_data = "SQLUDTFIXED";
- break;
- case SQLBOOL :
- char_data = "SQLBOOL";
- break;
- case SQLINT8 :
- char_data = "SQLINT8";
- break;
- case SQLSERIAL8 :
- char_data = "SQLSERIAL8";
- break;
- case SQLLVARCHAR :
- char_data = "SQLLVARCHAR";
- break;
-$endif;
- default :
- char_data=emalloc(20);
- sprintf(char_data,"ESQL/C : %i",fieldtype);
- break;
- } /* switch (fieldtype) */
-
- sprintf(string_data,"%s;%d;%d;%d;%c",
- char_data,
- size,
- precision,
- scale,
- (isnullable?'Y':'N'));
- add_assoc_string(return_value, fieldname, string_data, DUP);
-
- } /* for() */
-
-}
-/* }}} */
-
-
-/* --------------------------------------------------------------
-** int ifx_num_rows(int resultid)
-**
-** returns the number of rows already fetched for query resultid
-**
-** ---------------------------------------------------------------
-*/
-
-/* {{{ proto int ifx_num_rows(int resultid)
- Returns the number of rows already fetched for query identified by resultid */
-PHP_FUNCTION(ifx_num_rows)
-{
- pval **result;
- IFX_RES *Ifx_Result;
-
- IFXLS_FETCH();
-
- if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &result)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- IFXG(sv_sqlcode) = 0;
-
- ZEND_FETCH_RESOURCE(Ifx_Result, IFX_RES *, result, -1, "Informix Result", IFXL(le_result));
-
- return_value->value.lval = Ifx_Result->rowid;
- return_value->type = IS_LONG;
-}
-/* }}} */
-
-
-/* --------------------------------------------------------------
-** int ifx_getsqlca(int resultid)
-**
-** returns the sqlerrd[] fields of the sqlca struct for query resultid
-** following the prepare (select) or execute immediate (insert/update/execute procedure)
-**
-** ---------------------------------------------------------------
-*/
-
-/* {{{ proto int ifx_getsqlca(int resultid)
- Returns the sqlerrd[] fields of the sqlca struct for query resultid */
-PHP_FUNCTION(ifx_getsqlca)
-{
- pval **result;
- IFX_RES *Ifx_Result;
-
- char fieldname[16];
- int e;
-
- IFXLS_FETCH();
-
- if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &result)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- IFXG(sv_sqlcode) = 0;
-
- ZEND_FETCH_RESOURCE(Ifx_Result, IFX_RES *, result, -1, "Informix Result", IFXL(le_result));
-
- /* create pseudo-row array to return */
- if (array_init(return_value)==FAILURE) {
- RETURN_FALSE;
- }
- /* fill array with 6 fields sqlerrd0 .. sqlerrd5 */
- /* each ESQLC call saves these sqlca values */
- for (e = 0; e < 6; e++) {
- sprintf(fieldname,"sqlerrd%d", e);
- add_assoc_long(return_value, fieldname, Ifx_Result->sqlerrd[e]);
- }
-
-}
-/* }}} */
-
-
-
-/* ----------------------------------------------------------------------
-** int ifx_num_fields(int resultid)
-**
-** returns the number of columns in query resultid
-** or FALSE on error
-** ----------------------------------------------------------------------
-*/
-
-/* {{{ proto int ifx_num_fields(int resultid)
- Returns the number of columns in query resultid */
-PHP_FUNCTION(ifx_num_fields)
-{
- pval **result;
- IFX_RES *Ifx_Result;
-
- IFXLS_FETCH();
-
- if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &result)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- IFXG(sv_sqlcode) = 0;
-
- ZEND_FETCH_RESOURCE(Ifx_Result, IFX_RES *, result, -1, "Informix Result", IFXL(le_result));
-
- return_value->value.lval = Ifx_Result->numcols;
- return_value->type = IS_LONG;
-}
-/* }}} */
-
-
-
-
-/* ----------------------------------------------------------------------
-** int ifx_free_result(int resultid)
-**
-** releases resources for query associated with resultid
-**
-** returns FALSE on error
-** ----------------------------------------------------------------------
-*/
-
-/* {{{ proto int ifx_free_result(int resultid)
- Releases resources for query associated with resultid */
-PHP_FUNCTION(ifx_free_result)
-{
- pval **result;
- IFX_RES *Ifx_Result;
-
-EXEC SQL BEGIN DECLARE SECTION;
- char *ifx; /* connection ID */
- char *cursorid; /* query cursor id */
- char *statemid; /* statement id */
- char *descrpid; /* descriptor id */
-EXEC SQL END DECLARE SECTION;
-
- int i;
-
- IFXLS_FETCH();
-
- if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &result)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(Ifx_Result, IFX_RES *, result, -1, "Informix Result", IFXL(le_result));
-
- IFXG(sv_sqlcode = 0);
-
- for (i = 0; i < MAX_RESID; ++i) {
- if (Ifx_Result->res_id[i]>0) {
- php3_intifx2_free_blob(Ifx_Result->res_id[i],&EG(regular_list));
- Ifx_Result->res_id[i]=-1;
- }
- }
-
- ifx = Ifx_Result->connecid;
- cursorid = Ifx_Result->cursorid;
- statemid = Ifx_Result->statemid;
- descrpid = Ifx_Result->descrpid;
-
- EXEC SQL set connection :ifx;
- if (ifx_check() < 0) {
- IFXG(sv_sqlcode) = SQLCODE;
- php_error(E_WARNING,"Set connection %s fails (%s)",
- ifx,
- ifx_error(ifx));
- RETURN_FALSE;
- }
-
-
- EXEC SQL free :statemid;
- if (strlen(cursorid) != 0) {
- EXEC SQL CLOSE :cursorid;
- EXEC SQL FREE :cursorid;
- }
-
-
- EXEC SQL DEALLOCATE DESCRIPTOR :descrpid;
-
- efree(Ifx_Result); /* this can be safely done now */
-
- zend_list_delete((*result)->value.lval);
- RETURN_TRUE;
-}
-/* }}} */
-
-
-
-
-
-/* ----------------------------------------------------------------------
- * internal function
- * long php3_intifx_getType(long id, HashTable *list)
- *
- * returns the type of an id-object
- * bid: Id of object
- * list: internal hashlist of php3
- *
- * return -1 on error otherwise the type: TYPE_BLTEXT, TYPE_BLBYTE, TYPE_SLOB
- * ----------------------------------------------------------------------
-*/
-static long php3_intifx_getType(long id, HashTable *list) {
- IFX_IDRES *Ifx_res;
- int type;
-
- IFXLS_FETCH();
-
- Ifx_res = (IFX_IDRES *) zend_list_find(id,&type);
- if (type!=IFXL(le_idresult)) {
- php_error(E_WARNING,"%d is not a Informix id-result index",
- id);
- return -1;
- }
- return Ifx_res->type;
- }
-
-
-
-
-/* ----------------------------------------------------------------------
-** int ifx_create_blob(int type, int mode, string param)
-**
-** creates a blob-object
-** type: 1=TEXT, 0=BYTE
-** mode: blob-object holds 0=the content in memory, 1=content in file
-** param: if mode=0: pointer to the content
-** mode=1: pointer to the filestring
-** return false on error otherwise the new Blob-Object-id
-** ----------------------------------------------------------------------
-*/
-
-/* {{{ proto int ifx_create_blob(int type, int mode, string param)
- Creates a blob-object */
-PHP_FUNCTION(ifx_create_blob) {
- pval *pmode, *pparam,*ptype;
- long id;
- long mode,type;
-
- if (ZEND_NUM_ARGS()!=3 || getParameters(ht, 3, &ptype,&pmode,&pparam)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long(pmode);
- convert_to_string(pparam);
- convert_to_long(ptype);
-
- type=ptype->value.lval;
- if(type!=0)
- type=TYPE_BLTEXT;
- mode=pmode->value.lval;
- if(mode!=0)
- mode=BLMODE_INFILE;
-
- id=php3_intifx_create_blob(type,mode,pparam->value.str.val,pparam->value.str.len,&EG(regular_list));
- if(id<0) {
- RETURN_FALSE;
- }
- RETURN_LONG(id);
-}
-/* }}} */
-
-/* ----------------------------------------------------------------------
- * internal function
- * long php3_intifx_create_blob(long type, long mode, char* param, long len, HashTable *list)
- *
- * creates an blob-object
- * type: 1=TEXT, 0=BYTE
- * mode: blob-object holds 0=the content in momory, 1=content in file
- * param: if mode=0: pointer to the content
- * mode=1: pointer to the filestring
- * len: length of param
- * list: internal hashlist of php3
- * return -1 on error otherwise the new Blob-Object-id
- * ----------------------------------------------------------------------
-*/
-static long php3_intifx_create_blob(long type, long mode, char* param, long len, HashTable *list) {
- IFX_IDRES *Ifx_blob;
-
- IFXLS_FETCH();
-
- Ifx_blob=emalloc(sizeof(IFX_IDRES));
- if(Ifx_blob==NULL) {
- php_error(E_WARNING,"can't create blob-resource");
- return -1;
- }
-
- memset(Ifx_blob, 0, sizeof(IFX_IDRES));
-
- if(type==0 ) {
- Ifx_blob->type=TYPE_BLBYTE;
- } else {
- Ifx_blob->type=TYPE_BLTEXT;
- }
- Ifx_blob->BLOB.mode=(int)mode;
-
- if(mode==BLMODE_INMEM) {
- if(len>=0) {
- char *content=emalloc(len);
- if(content==NULL) {
- php_error(E_WARNING,"can't create blob-resource");
- return -1;
- }
- memcpy(content,param,len);
- Ifx_blob->BLOB.blob_data.loc_loctype=LOCMEMORY;
- Ifx_blob->BLOB.blob_data.loc_buffer=content;
- Ifx_blob->BLOB.blob_data.loc_bufsize=len;
- Ifx_blob->BLOB.blob_data.loc_size=len;
- Ifx_blob->BLOB.blob_data.loc_mflags=0;
- Ifx_blob->BLOB.blob_data.loc_oflags=0;
- } else {
- Ifx_blob->BLOB.blob_data.loc_loctype=LOCMEMORY;
- Ifx_blob->BLOB.blob_data.loc_buffer=NULL;
- Ifx_blob->BLOB.blob_data.loc_bufsize=-1;
- Ifx_blob->BLOB.blob_data.loc_size=-1;
- Ifx_blob->BLOB.blob_data.loc_mflags=0;
- Ifx_blob->BLOB.blob_data.loc_oflags=0;
- }
- } else { /* mode = BLMODE_INFILE */
- char *filename=emalloc(len+1);
- if(filename==NULL) {
- php_error(E_WARNING,"can't create blob-resource");
- return -1;
- }
- memcpy(filename,param,len);
- filename[len]=0;
- Ifx_blob->BLOB.blob_data.loc_loctype=LOCFNAME;
- Ifx_blob->BLOB.blob_data.loc_fname=filename;
- Ifx_blob->BLOB.blob_data.loc_oflags=LOC_WONLY;
- Ifx_blob->BLOB.blob_data.loc_size=-1;
- }
- return zend_list_insert(Ifx_blob,IFXL(le_idresult));
-}
-
-
-
-
-/* ----------------------------------------------------------------------
-** int ifx_copy_blob(int bid)
-**
-** duplicates the given blob-object
-** bid: Id of Blobobject
-**
-** return false on error otherwise the new Blob-Object-id
-** ----------------------------------------------------------------------
-*/
-
-/* {{{ proto int ifx_copy_blob(int bid)
- Duplicates the given blob-object */
-PHP_FUNCTION(ifx_copy_blob) {
- pval *pbid;
- long newid;
-
- if (ZEND_NUM_ARGS()!=1 || getParameters(ht, 1, &pbid)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long(pbid);
-
- newid=php3_intifx_copy_blob(pbid->value.lval,&EG(regular_list));
- if(newid<0) {
- RETURN_FALSE;
- }
-
- RETURN_LONG(newid);
-}
-/* }}} */
-
-
-
-/* ----------------------------------------------------------------------
- * internal function
- * long php3_intifx_copy_blob(long bid, HashTable *list)
- *
- * duplicates the given blob-object
- * bid: Id of Blobobject
- * list: internal hashlist of php3
- *
- * return -1 on error otherwise the new Blob-Object-id
- * ----------------------------------------------------------------------
-*/
-static long php3_intifx_copy_blob(long bid, HashTable *list) {
- IFX_IDRES *Ifx_blob, *Ifx_blob_orig;
- loc_t *locator, *locator_orig;
- int type;
-
- IFXLS_FETCH();
-
- Ifx_blob_orig = (IFX_IDRES *) zend_list_find(bid,&type);
- if (type!=IFXL(le_idresult) || !(Ifx_blob_orig->type==TYPE_BLBYTE || Ifx_blob_orig->type==TYPE_BLTEXT)) {
- php_error(E_WARNING,"%d is not a Informix blob-result index",
- bid);
- return -1;
- }
- Ifx_blob=emalloc(sizeof(IFX_IDRES));
- if(Ifx_blob==NULL) {
- php_error(E_WARNING,"can't create blob-resource");
- return -1;
- }
-
- memset(Ifx_blob, 0, sizeof(IFX_IDRES));
-
- Ifx_blob->type=Ifx_blob_orig->type;
- Ifx_blob->BLOB.mode=Ifx_blob_orig->BLOB.mode;
-
- locator=&(Ifx_blob->BLOB.blob_data);
- locator_orig=&(Ifx_blob_orig->BLOB.blob_data);
-
- if(Ifx_blob->BLOB.mode==BLMODE_INMEM) {
- char *content;
- if(locator_orig->loc_size>=0 && locator_orig->loc_buffer!=NULL) {
- if((content=emalloc(locator_orig->loc_size))==NULL) {
- php_error(E_WARNING,"can't create blob-resource");
- return -1;
- }
- memcpy(content,locator_orig->loc_buffer, locator_orig->loc_size);
- locator->loc_buffer=content;
- locator->loc_bufsize=locator_orig->loc_size;
- locator->loc_size=locator_orig->loc_size;
- } else {
- locator->loc_buffer=NULL;
- locator->loc_bufsize=-1;
- locator->loc_size=-1;
- }
- locator->loc_loctype=LOCMEMORY;
- locator->loc_mflags=0;
- locator->loc_oflags=0;
- } else { /* BLMODE_INFILE */
- char *filename;
-
- if((filename=emalloc(strlen(locator_orig->loc_fname)+1))==NULL) {
- php_error(E_WARNING,"can't create blob-resource");
- return -1;
- }
- strcpy(filename,locator_orig->loc_fname);
- locator->loc_loctype=LOCFNAME;
- locator->loc_fname=filename;
- locator->loc_size=-1;
- locator->loc_oflags=locator_orig->loc_oflags;
- }
-
- return zend_list_insert(Ifx_blob,IFXL(le_idresult));
-}
-
-
-
-/* ----------------------------------------------------------------------
-** int ifx_free_blob(int bid)
-**
-** deletes the blob-object
-** bid: Id of Blobobject
-** return false on error otherwise true
-** ----------------------------------------------------------------------
-*/
-
-/* {{{ proto int ifx_free_blob(int bid)
- Deletes the blob-object */
-PHP_FUNCTION(ifx_free_blob) {
- pval *pid;
- long ret;
-
- if (ZEND_NUM_ARGS()!=1 || getParameters(ht, 1, &pid)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long(pid);
-
- ret=php3_intifx_free_blob(pid->value.lval,&EG(regular_list));
- if(ret<0) {
- RETURN_FALSE;
- }
- RETURN_TRUE;
-}
-/* }}} */
-
-/* ----------------------------------------------------------------------
- * internal function
- * long php3_intifx_free_blob(long bid, HashTable *list)
- *
- * deletes the blob-object
- * bid: Id of Blobobject
- * list: internal hashlist of php3
- *
- * return -1 on error otherwise 0
- * FREES BYTE-MEMORY WITH EFREE()
- * ----------------------------------------------------------------------
-*/
-static long php3_intifx_free_blob(long bid, HashTable *list) {
- IFX_IDRES *Ifx_blob;
- int type;
-
- IFXLS_FETCH();
-
- Ifx_blob = (IFX_IDRES *) zend_list_find(bid,&type);
- if (type!=IFXL(le_idresult) && !(Ifx_blob->type==TYPE_BLTEXT || Ifx_blob->type==TYPE_BLBYTE)) {
- php_error(E_WARNING,"%d is not a Informix blob-result index",
- bid);
- return -1;
- }
- if(Ifx_blob->BLOB.mode==BLMODE_INMEM) {
- if(Ifx_blob->BLOB.blob_data.loc_buffer==NULL
- || Ifx_blob->BLOB.blob_data.loc_size<=0) {;} else {
- efree(Ifx_blob->BLOB.blob_data.loc_buffer);
- }
- } else { /* BLMODE_INFILE */
- if(Ifx_blob->BLOB.blob_data.loc_fname!=NULL) {
- efree(Ifx_blob->BLOB.blob_data.loc_fname);
- }
- }
-
-
- zend_list_delete(bid);
- efree(Ifx_blob);
- return 0;
-}
-
-
-
-/* ----------------------------------------------------------------------
- * internal function
- * long php3_intifx2_free_blob(long bid, HashTable *list)
- *
- * deletes the blob-object
- * bid: Id of Blobobject
- * list: internal hashlist of php3
- *
- * return -1 on error otherwise 0
- * FREES BYTE-MEMORY WITH FREE(), for blob memory allocated by ESQL/C
- * use this for freeing blob-source after select (in ifx_free_result)
- * ----------------------------------------------------------------------
-*/
-static long php3_intifx2_free_blob(long bid, HashTable *list) {
- IFX_IDRES *Ifx_blob;
- int type;
-
- IFXLS_FETCH();
-
- Ifx_blob = (IFX_IDRES *) zend_list_find(bid,&type);
- if (type!=IFXL(le_idresult) && !(Ifx_blob->type==TYPE_BLTEXT || Ifx_blob->type==TYPE_BLBYTE)) {
- php_error(E_WARNING,"%d is not a Informix blob-result index",
- bid);
- return -1;
- }
-#if IFX_VERSION < 724 /* this Informix memory leak is fixed from 7.24 on */
- /* according to the current PERL DBD::Informix */
- /* and otherwise I get segmenation violations with 7.30 */
-
- if(Ifx_blob->BLOB.mode==BLMODE_INMEM) {
- if(Ifx_blob->BLOB.blob_data.loc_buffer==NULL ||
- Ifx_blob->BLOB.blob_data.loc_size<=0) {;} else {
- free(Ifx_blob->BLOB.blob_data.loc_buffer);
- }
- } else {
- if(Ifx_blob->BLOB.blob_data.loc_fname!=NULL) {
- efree(Ifx_blob->BLOB.blob_data.loc_fname);
- }
- }
-
-#endif
-
- zend_list_delete(bid);
- efree(Ifx_blob);
- return 0;
-}
-
-/* ----------------------------------------------------------------------
-** string ifx_get_blob(int bid)
-**
-** returns the content of the blob-object
-** bid: Id of Blobobject
-** return the content
-** ----------------------------------------------------------------------
-*/
-
-/* {{{ proto string ifx_get_blob(int bid)
- Returns the content of the blob-object */
-PHP_FUNCTION(ifx_get_blob) {
- pval *pbid;
- char *content;
- long len;
-
-
- if (ZEND_NUM_ARGS()!=1 || getParameters(ht, 1, &pbid)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long(pbid);
-
- len=php3_intifx_get_blob(pbid->value.lval,&EG(regular_list),&content);
- if(content==NULL || len<0) {
- RETURN_STRING(php3_intifx_null(),1);
- }
- RETURN_STRINGL(content,len,1);
-}
-/* }}} */
-
-
-/* ----------------------------------------------------------------------
- * internal function
- * long php3_intifx_get_blob(long bid, HashTable *list, char** content)
- *
- * returns the content of the blob-object
- * bid: Id of Blobobject
- * list: internal hashlist of php3
- *
- * return -1 on error
- * returns the pointer to the content in char** content and the amount of content in bytes
- * ----------------------------------------------------------------------
-*/
-static long php3_intifx_get_blob(long bid, HashTable *list, char** content) {
- IFX_IDRES *Ifx_blob;
- int type;
-
- IFXLS_FETCH();
-
- Ifx_blob = (IFX_IDRES *) zend_list_find(bid,&type);
- if (type!=IFXL(le_idresult) && !(Ifx_blob->type==TYPE_BLTEXT || Ifx_blob->type==TYPE_BLBYTE)) {
- php_error(E_WARNING,"%d is not a Informix blob-result index",
- bid);
- return -1;
- }
-
- if(Ifx_blob->BLOB.mode==BLMODE_INMEM) {
- *content=Ifx_blob->BLOB.blob_data.loc_buffer;
- return Ifx_blob->BLOB.blob_data.loc_size;
- }
- *content=Ifx_blob->BLOB.blob_data.loc_fname;
- return strlen(Ifx_blob->BLOB.blob_data.loc_fname);
-}
-
-
-/* ----------------------------------------------------------------------
- * internal function
- * loc_t *php3_intifx_get_blobloc(long bid, HashTable *list)
- *
- * returns the blob-locator-structur
- * bid: Id of Blobobject
- * list: internal hashlist of php3
- * return NULL on error or the pointer to the locator-structur
- * ----------------------------------------------------------------------
-*/
-static loc_t *php3_intifx_get_blobloc(long bid, HashTable *list) {
- IFX_IDRES *Ifx_blob;
- int type;
-
- IFXLS_FETCH();
-
- Ifx_blob = (IFX_IDRES *) zend_list_find(bid,&type);
- if (type!=IFXL(le_idresult) && !(Ifx_blob->type==TYPE_BLTEXT || Ifx_blob->type==TYPE_BLBYTE)) {
- php_error(E_WARNING,"%d is not a Informix blob-result index",
- bid);
- return NULL;
- }
-
- return &(Ifx_blob->BLOB.blob_data);
-}
-
-
-
-/* ----------------------------------------------------------------------
-** int update_blob(int bid, string content)
-**
-** updates the content of the blob-object
-** bid: Id of Blobobject
-** content: string of new data
-** return false on error otherwise true
-** ----------------------------------------------------------------------
-*/
-
-/* {{{ proto int ifx_update_blob(int bid, string content)
- Updates the content of the blob-object */
-PHP_FUNCTION(ifx_update_blob) {
- pval *pbid,*pparam;
- long ret;
-
-
- if (ZEND_NUM_ARGS()!=2 || getParameters(ht, 2, &pbid,&pparam)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long(pbid);
- convert_to_string(pparam);
-
- ret=php3_intifx_update_blob(pbid->value.lval,
- pparam->value.str.val,
- pparam->value.str.len,
- &EG(regular_list));
- if(ret<0) {
- RETURN_FALSE;
- }
- RETURN_TRUE;
-}
-/* }}} */
-
-
-/* ----------------------------------------------------------------------
- * internal function
- * long php3_intifx_update_blob(long bid, char* param, long len, HashTable *list)
- *
- * updates the content of the blob-object
- * bid: Id of Blobobject
- * param: string of new data
- * len: length of string
- * list: internal hashlist of php3
- * return nothing
- * ----------------------------------------------------------------------
-*/
-static long php3_intifx_update_blob(long bid, char* param, long len, HashTable *list) {
- IFX_IDRES *Ifx_blob;
- int type;
-
- IFXLS_FETCH();
-
- Ifx_blob = (IFX_IDRES *) zend_list_find(bid,&type);
- if (type!=IFXL(le_idresult) && !(Ifx_blob->type==TYPE_BLTEXT || Ifx_blob->type==TYPE_BLBYTE)) {
- php_error(E_WARNING,"%d is not a Informix blob-result index",
- bid);
- return -1;
- }
-
- if(Ifx_blob->BLOB.mode==BLMODE_INMEM) {
- char *content;
-
- if(Ifx_blob->BLOB.blob_data.loc_buffer!=NULL)
- efree(Ifx_blob->BLOB.blob_data.loc_buffer);
- if(len>=0) {
- if((content=emalloc(len))==NULL) {
- php_error(E_WARNING,"can't create blob-resource");
- return -1;
- }
- memcpy(content,param, len);
- Ifx_blob->BLOB.blob_data.loc_buffer=content;
- Ifx_blob->BLOB.blob_data.loc_bufsize=len;
- Ifx_blob->BLOB.blob_data.loc_size=len;
- } else {
- Ifx_blob->BLOB.blob_data.loc_buffer=NULL;
- Ifx_blob->BLOB.blob_data.loc_bufsize=-1;
- Ifx_blob->BLOB.blob_data.loc_size=-1;
- }
- Ifx_blob->BLOB.blob_data.loc_mflags=0;
- Ifx_blob->BLOB.blob_data.loc_oflags=0;
- } else {
- char *filename;
-
- if(Ifx_blob->BLOB.blob_data.loc_fname!=NULL)
- efree(Ifx_blob->BLOB.blob_data.loc_fname);
- if((filename=emalloc(len+1))==NULL) {
- php_error(E_WARNING,"can't create blob-resource");
- return -1;
- }
- memcpy(filename,param, len);
- filename[len]=0;
- Ifx_blob->BLOB.blob_data.loc_fname=filename;
- Ifx_blob->BLOB.blob_data.loc_size=-1;
- }
- return 0;
-}
-
-
-
-/*-------------------------------------------------
- * internal function
- *
- * php3_intifx_create_tmpfile(long bid)
- * creates a temporary file to store a blob in
- *-------------------------------------------------
-*/
-
-
-static char* php3_intifx_create_tmpfile(long bid) {
- char filename[10];
- char *blobdir;
- char *blobfile;
- char *retval;
-
- if ((blobdir = getenv("php3_blobdir")) == NULL)
- blobdir=".";
-
- sprintf(filename,"blb%d",(int)bid);
- blobfile=tempnam(blobdir,filename);
- /* free(blobdir); */
-
- if (blobfile == NULL)
- return NULL;
-
- retval=emalloc(strlen(blobfile)+1);
- if(retval==NULL)
- return NULL;
- strcpy(retval,blobfile);
- free(blobfile);
- return retval;
-}
-
-
-
-
-/* ----------------------------------------------------------------------
-** void ifx_blobinfile_mode(int mode)
-**
-** sets the default blob-mode for all select-queries
-** mode=0: save Byte-Blobs in momory
-** mode=1: save Byte-Blobs in a file
-** return nothing
-** ----------------------------------------------------------------------
-*/
-
-/* {{{ proto void ifx_blobinfile_mode(int mode)
- Sets the default blob-mode for all select-queries */
-PHP_FUNCTION(ifx_blobinfile_mode) {
- pval *pmode;
-
-
- IFXLS_FETCH();
-
- if (ZEND_NUM_ARGS()!=1 || getParameters(ht, 1, &pmode)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long(pmode);
-
- IFXG(blobinfile)=pmode->value.lval;
- RETURN_TRUE;
-}
-/* }}} */
-
-
-
-/* ----------------------------------------------------------------------
-** void ifx_textasvarchar(int mode)
-**
-** sets the default text-mode for all select-queries
-** mode=0: select returns a blob-id
-** mode=1: select returns a varchar with text-content
-** return nothing
-** ----------------------------------------------------------------------
-*/
-
-/* {{{ proto void ifx_textasvarchar(int mode)
- Sets the default text-mode for all select-queries */
-PHP_FUNCTION(ifx_textasvarchar) {
- pval *pmode;
-
- IFXLS_FETCH();
-
- if (ZEND_NUM_ARGS()!=1 || getParameters(ht, 1, &pmode)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long(pmode);
-
- IFXG(textasvarchar)=pmode->value.lval;
- RETURN_TRUE;
-}
-/* }}} */
-
-
-
-/* ----------------------------------------------------------------------
-** void ifx_byteasvarchar(int mode)
-**
-** sets the default byte-mode for all select-queries
-** mode=0: select returns a blob-id
-** mode=1: select returns a varchar with byte-content
-** return nothing
-** ----------------------------------------------------------------------
-*/
-
-/* {{{ proto void ifx_byteasvarchar(int mode)
- Sets the default byte-mode for all select-queries */
-PHP_FUNCTION(ifx_byteasvarchar) {
- pval *pmode;
-
-
- IFXLS_FETCH();
-
- if (ZEND_NUM_ARGS()!=1 || getParameters(ht, 1, &pmode)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long(pmode);
-
- IFXG(byteasvarchar)=pmode->value.lval;
- RETURN_TRUE;
-}
-
-
-
-/* ----------------------------------------------------------------------
-** void ifx_nullformat(int mode)
-**
-** sets the default return value of a NULL-value on a fetch-row
-** mode=0: return ""
-** mode=1: return "NULL"
-** return nothing
-** ----------------------------------------------------------------------
-*/
-
-/* {{{ proto void ifx_nullformat(int mode)
- Sets the default return value of a NULL-value on a fetch-row */
-PHP_FUNCTION(ifx_nullformat) {
- pval *pmode;
-
-
- IFXLS_FETCH();
-
-
- if (ZEND_NUM_ARGS()!=1 || getParameters(ht, 1, &pmode)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long(pmode);
-
- IFXG(nullformat)=pmode->value.lval;
- RETURN_TRUE;
-}
-/* }}} */
-
-
-/* ----------------------------------------------------------------------
- * void php3_intifx_null()
- *
- * return the NULL-string depending on .nullformat
- * return "" or "NULL"
- * ----------------------------------------------------------------------
-*/
-static char* php3_intifx_null() {
- char* tmp;
-
-
- IFXLS_FETCH();
-
- if(IFXG(nullformat)==0) {
- tmp=IFXG(nullvalue);
- } else {
- tmp=IFXG(nullstring);
- }
- return tmp;
-}
-
-
-
-/* ----------------------------------------------------------------------
-** int ifx_create_char(string param)
-**
-** creates an char-object
-** param: content
-** return false on error otherwise the new char-Object-id
-** ----------------------------------------------------------------------
-*/
-
-/* {{{ proto int ifx_create_char(string param)
- Creates a char-object */
-PHP_FUNCTION(ifx_create_char) {
- pval *pparam;
- long id;
-
- if (ZEND_NUM_ARGS()!=1 || getParameters(ht, 1, &pparam)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string(pparam);
-
- id=php3_intifx_create_char(pparam->value.str.val,pparam->value.str.len,&EG(regular_list));
- if(id<0) {
- RETURN_FALSE;
- }
- RETURN_LONG(id);
-}
-/* }}} */
-
-/* ----------------------------------------------------------------------
- * internal function
- * long php3_intifx_create_char(char* param, long len, HashTable *list)
- *
- * creates an char-object
- * param: content
- * len: length of param
- * list: internal hashlist of php3
- * return -1 on error otherwise the new char-Object-id
- * ----------------------------------------------------------------------
-*/
-static long php3_intifx_create_char(char* param, long len, HashTable *list) {
- IFX_IDRES *Ifx_char;
-
-
- IFXLS_FETCH();
-
- Ifx_char=emalloc(sizeof(IFX_IDRES));
- if(Ifx_char==NULL) {
- php_error(E_WARNING,"can't create char-resource");
- return -1;
- }
-
- Ifx_char->type=TYPE_CHAR;
-
- if(param==NULL || len<0) {
- Ifx_char->CHAR.char_data=NULL;
- Ifx_char->CHAR.len=0;
- } else {
- Ifx_char->CHAR.char_data=emalloc(len+1);
- if(Ifx_char->CHAR.char_data==NULL) {
- efree(Ifx_char);
- php_error(E_WARNING,"can't create char-resource");
- return -1;
- }
- memcpy(Ifx_char->CHAR.char_data,param,len);
- Ifx_char->CHAR.char_data[len]=0;
- Ifx_char->CHAR.len=len;
- }
- return zend_list_insert(Ifx_char,IFXL(le_idresult));
-}
-
-/* ----------------------------------------------------------------------
-** string ifx_get_char(int bid)
-**
-** returns the content of the char-object
-** bid: Id of charobject
-** return the content
-** ----------------------------------------------------------------------
-*/
-
-/* {{{ proto string ifx_get_char(int bid)
- Returns the content of the char-object */
-PHP_FUNCTION(ifx_get_char) {
- pval *pbid;
- char *content;
- long len;
-
-
- if (ZEND_NUM_ARGS()!=1 || getParameters(ht, 1, &pbid)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long(pbid);
-
- len=php3_intifx_get_char(pbid->value.lval,&EG(regular_list),&content);
- if(content==NULL || len<0) {
- RETURN_STRING("",1);
- }
- RETURN_STRINGL(content,len,1);
-}
-/* }}} */
-
-
-/* ----------------------------------------------------------------------
- * internal function
- * long php3_intifx_get_char(long bid, HashTable *list, char** content)
- *
- * returns the content of the char-object
- * bid: Id of charobject
- * list: internal hashlist of php3
- *
- * return -1 on error
- * returns the pointer to the content in char** content and the amount of content in bytes
- * ----------------------------------------------------------------------
-*/
-static long php3_intifx_get_char(long bid, HashTable *list, char** content) {
- IFX_IDRES *Ifx_char;
- int type;
-
- IFXLS_FETCH();
-
- Ifx_char = (IFX_IDRES *) zend_list_find(bid,&type);
- if (type!=IFXL(le_idresult) && !(Ifx_char->type==TYPE_CHAR)) {
- php_error(E_WARNING,"%d is not a Informix char-result index",
- bid);
- return -1;
- }
-
- *content=Ifx_char->CHAR.char_data;
- return Ifx_char->CHAR.len;
-}
-
-/* ----------------------------------------------------------------------
-** int ifx_free_char(int bid)
-**
-** deletes the char-object
-** bid: Id of charobject
-** return false on error otherwise true
-** ----------------------------------------------------------------------
-*/
-
-/* {{{ proto int ifx_free_char(int bid)
- Deletes the char-object */
-PHP_FUNCTION(ifx_free_char) {
- pval *pid;
- long ret;
-
- if (ZEND_NUM_ARGS()!=1 || getParameters(ht, 1, &pid)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long(pid);
-
- ret=php3_intifx_free_char(pid->value.lval,&EG(regular_list));
- if(ret<0) {
- RETURN_FALSE;
- }
- RETURN_TRUE;
-}
-/* }}} */
-
-/* ----------------------------------------------------------------------
- * internal function
- * long php3_intifx_free_char(long bid, HashTable *list)
- *
- * deletes the char-object
- * bid: Id of Charobject
- * list: internal hashlist of php3
- *
- * return -1 on error otherwise 0
- * ----------------------------------------------------------------------
-*/
-static long php3_intifx_free_char(long bid, HashTable *list) {
- IFX_IDRES *Ifx_char;
- int type;
-
-
- IFXLS_FETCH();
-
- Ifx_char = (IFX_IDRES *) zend_list_find(bid,&type);
- if (type!=IFXL(le_idresult) && !(Ifx_char->type==TYPE_CHAR)) {
- php_error(E_WARNING,"%d is not a Informix char-result index",
- bid);
- return -1;
- }
-
- if(Ifx_char->CHAR.char_data!=NULL) {
- efree(Ifx_char->CHAR.char_data);
- }
-
- zend_list_delete(bid);
- efree(Ifx_char);
- return 0;
-}
-
-/* ----------------------------------------------------------------------
-** int ifx_update_char(int bid, string content)
-**
-** updates the content of the char-object
-** bid: Id of charobject
-** content: string of new data
-** return false on error otherwise true
-** ----------------------------------------------------------------------
-*/
-
-/* {{{ proto int ifx_update_char(int bid, string content)
- Updates the content of the char-object */
-PHP_FUNCTION(ifx_update_char) {
- pval *pbid,*pparam;
- long ret;
-
-
- if (ZEND_NUM_ARGS()!=2 || getParameters(ht, 2, &pbid,&pparam)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long(pbid);
- convert_to_string(pparam);
-
- ret=php3_intifx_update_char(pbid->value.lval,
- pparam->value.str.val,
- pparam->value.str.len,
- &EG(regular_list));
- if(ret<0) {
- RETURN_FALSE;
- }
- RETURN_TRUE;
-}
-/* }}} */
-
-
-/* ----------------------------------------------------------------------
- * internal function
- * long php3_intifx_update_char(long bid, char* param, long len, HashTable *list)
- *
- * updates the content of the char-object
- * bid: Id of charobject
- * param: string of new data
- * len: length of string
- * list: internal hashlist of php3
- * return nothing
- * ----------------------------------------------------------------------
-*/
-static long php3_intifx_update_char(long bid, char* param, long len, HashTable *list) {
- IFX_IDRES *Ifx_char;
- int type;
-
- IFXLS_FETCH();
-
- Ifx_char = (IFX_IDRES *) zend_list_find(bid,&type);
- if (type!=IFXL(le_idresult) && !(Ifx_char->type==TYPE_CHAR)) {
- php_error(E_WARNING,"%d is not a Informix char-result index",
- bid);
- return -1;
- }
-
- if(Ifx_char->CHAR.char_data!=NULL) {
- efree(Ifx_char->CHAR.char_data);
- }
- Ifx_char->CHAR.char_data=NULL;
- Ifx_char->CHAR.len=0;
-
- if(param==NULL || len<0) {
- Ifx_char->CHAR.char_data=NULL;
- Ifx_char->CHAR.len=0;
- } else {
- Ifx_char->CHAR.char_data=emalloc(len+1);
- if(Ifx_char->CHAR.char_data==NULL) {
- php_error(E_WARNING,"can't create char-resource");
- return -1;
- }
- memcpy(Ifx_char->CHAR.char_data,param,len);
- Ifx_char->CHAR.char_data[len]=0;
- Ifx_char->CHAR.len=len;
- }
- return 0;
-}
-
-
-$ifdef HAVE_IFX_IUS;
-
-
-/* ----------------------------------------------------------------------
-** int ifxus_create_slob(int mode)
-**
-** creates an slob-object and opens it
-** mode: 1=LO_RDONLY, 2=LO_WRONLY, 4=LO_APPEND, 8=LO_RDWR, 16=LO_BUFFER, 32=LO_NOBUFFER -> or-mask
-** return false on error otherwise the new Slob-Object-id
-** ----------------------------------------------------------------------
-*/
-
-/* {{{ proto int ifxus_create_slob(int mode)
- Creates a slob-object and opens it */
-PHP_FUNCTION(ifxus_create_slob) {
- pval *pmode;
- long id;
- long mode,create_mode;
-
- if (ZEND_NUM_ARGS()!=1 || getParameters(ht, 1, &pmode)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long(pmode);
-
- mode=pmode->value.lval;
-
- create_mode=0;
- if((mode&1) !=0)
- create_mode|=LO_RDONLY;
- if((mode&2) !=0)
- create_mode|=LO_WRONLY;
- if((mode&4) !=0)
- create_mode|=LO_APPEND;
- if((mode&8) !=0)
- create_mode|=LO_RDWR;
- if((mode&16) !=0)
- create_mode|=LO_BUFFER;
- if((mode&32) !=0)
- create_mode|=LO_NOBUFFER;
-
-
- id=php3_intifxus_create_slob(create_mode,&EG(regular_list));
- if(id<0) {
- RETURN_FALSE;
- }
- RETURN_LONG(id);
-}
-/* }}} */
-
-/* ----------------------------------------------------------------------
- * internal function
- * long php3_intifx_create_slob(long create_mode, HashTable *list)
- *
- * creates an slob-object and opens it
- * mode: 1=LO_RDONLY, 2=LO_WRONLY, 4=LO_APPEND, 8=LO_RDWR, 16=LO_BUFFER, 32=LO_NOBUFFER -> or-mask
- * list: internal hashlist of php3
- * return -1 on error otherwise the new Blob-Object-id
- * ----------------------------------------------------------------------
-*/
-static long php3_intifxus_create_slob(long create_mode, HashTable *list) {
- IFX_IDRES *Ifx_slob;
- int errcode;
-
-
- Ifx_slob=emalloc(sizeof(IFX_IDRES));
- if(Ifx_slob==NULL) {
- php_error(E_WARNING,"can't create slob-resource");
- return -1;
- }
-
- errcode=ifx_lo_def_create_spec(&(Ifx_slob->SLOB.createspec));
- if(errcode<0) {
- php_error(E_WARNING,"can't create slob-resource");
- return -1;
- }
-
- Ifx_slob->type=TYPE_SLOB;
- Ifx_slob->SLOB.lofd=ifx_lo_create(Ifx_slob->SLOB.createspec,create_mode,&(Ifx_slob->SLOB.slob_data),&errcode);
- if(errcode<0 || Ifx_slob->SLOB.lofd<0) {
- php_error(E_WARNING,"can't create slob-resource");
- return -1;
- }
-
- return zend_list_insert(Ifx_slob,IFXL(le_idresult));
-}
-
-
-
-/* ----------------------------------------------------------------------
-** int ifxus_free_slob(int bid)
-**
-** deletes the slob-object
-** bid: Id of Slobobject
-** return false on error otherwise true
-** ----------------------------------------------------------------------
-*/
-
-/* {{{ proto int ifxus_free_slob(int bid)
- Deletes the slob-object */
-PHP_FUNCTION(ifxus_free_slob) {
- pval *pid;
- long ret;
-
- if (ZEND_NUM_ARGS()!=1 || getParameters(ht, 1, &pid)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long(pid);
-
- ret=php3_intifxus_close_slob(pid->value.lval,&EG(regular_list));
- if(ret<0) {
- RETURN_FALSE;
- }
- RETURN_TRUE;
-}
-/* }}} */
-
-/* ----------------------------------------------------------------------
- * internal function
- * long php3_intifxus_free_slob(long bid, HashTable *list)
- *
- * deletes the slob-object
- * bid: Id of Slobobject
- * list: internal hashlist of php3
- *
- * return -1 on error otherwise 0
- * ----------------------------------------------------------------------
-*/
-static long php3_intifxus_free_slob(long bid, HashTable *list) {
- IFX_IDRES *Ifx_slob;
- int type;
-
- IFXLS_FETCH();
-
- Ifx_slob = (IFX_IDRES *) zend_list_find(bid,&type);
- if (type!=IFXL(le_idresult) || Ifx_slob->type!=TYPE_SLOB) {
- php_error(E_WARNING,"%d is not a Informix slob-result index",
- bid);
- return -1;
- }
-
-
- if(php3_intifxus_close_slob(bid, &EG(regular_list))<0) {
- return -1;
- }
- if(Ifx_slob->SLOB.createspec!=NULL) {
- ifx_lo_spec_free(Ifx_slob->SLOB.createspec);
- Ifx_slob->SLOB.createspec=NULL;
- }
- efree(Ifx_slob);
- zend_list_delete(bid);
- return 0;
-}
-
-
-
-
-/* ----------------------------------------------------------------------
-** int ifxus_close_slob(int bid)
-**
-** deletes the slob-object
-** bid: Id of Slobobject
-** return false on error otherwise true
-** ----------------------------------------------------------------------
-*/
-
-/* {{{ proto int ifxus_close_slob(int bid)
- Deletes the slob-object */
-PHP_FUNCTION(ifxus_close_slob) {
- pval *pid;
- long ret;
-
- if (ZEND_NUM_ARGS()!=1 || getParameters(ht, 1, &pid)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long(pid);
-
- ret=php3_intifxus_close_slob(pid->value.lval,&EG(regular_list));
- if(ret<0) {
- RETURN_FALSE;
- }
- RETURN_TRUE;
-}
-/* }}} */
-
-/* ----------------------------------------------------------------------
- * internal function
- * long php3_intifxus_close_slob(long bid, HashTable *list)
- *
- * deletes the slob-object
- * bid: Id of Slobobject
- * list: internal hashlist of php3
- *
- * return -1 on error otherwise 0
- * ----------------------------------------------------------------------
-*/
-static long php3_intifxus_close_slob(long bid, HashTable *list) {
- IFX_IDRES *Ifx_slob;
- int type;
-
- IFXLS_FETCH();
-
- Ifx_slob = (IFX_IDRES *) zend_list_find(bid,&type);
- if (type!=IFXL(le_idresult) || Ifx_slob->type!=TYPE_SLOB) {
- php_error(E_WARNING,"%d is not a Informix slob-result index",
- bid);
- return -1;
- }
-
-
- if(Ifx_slob->SLOB.lofd<0) {
- php_error(E_WARNING,"slob-resource already closed");
- return -1;
- }
-
- if(ifx_lo_close(Ifx_slob->SLOB.lofd)<0) {
- php_error(E_WARNING,"can't close slob-resource");
- return -1;
- }
-
- Ifx_slob->SLOB.lofd=-1;
- return 0;
-}
-
-
-
-
-
-/* ----------------------------------------------------------------------
-** int ifxus_open_slob(long bid, int mode)
-**
-** opens an slob-object
-** bid: existing slob-id
-** mode: 1=LO_RDONLY, 2=LO_WRONLY, 4=LO_APPEND, 8=LO_RDWR, 16=LO_BUFFER, 32=LO_NOBUFFER -> or-mask
-** return false on error otherwise the new Slob-Object-id
-** ----------------------------------------------------------------------
-*/
-
-/* {{{ proto int ifxus_open_slob(long bid, int mode)
- Opens an slob-object */
-PHP_FUNCTION(ifxus_open_slob) {
- pval *pbid,*pmode;
- long mode,create_mode;
-
- if (ZEND_NUM_ARGS()!=2 || getParameters(ht, 1, &pbid,&pmode)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long(pmode);
- convert_to_long(pbid);
- mode=pmode->value.lval;
-
- create_mode=0;
- if((mode&1) !=0)
- create_mode|=LO_RDONLY;
- if((mode&2) !=0)
- create_mode|=LO_WRONLY;
- if((mode&4) !=0)
- create_mode|=LO_APPEND;
- if((mode&8) !=0)
- create_mode|=LO_RDWR;
- if((mode&16) !=0)
- create_mode|=LO_BUFFER;
- if((mode&32) !=0)
- create_mode|=LO_NOBUFFER;
-
- RETURN_LONG(php3_intifxus_open_slob(pbid->value.lval,create_mode,&EG(regular_list)));
-}
-/* }}} */
-
-
-/* ----------------------------------------------------------------------
- * internal function
- * long php3_intifx_open_slob(long bid,long create_mode, HashTable *list)
- *
- * opens an slob-object
- * mode: 1=LO_RDONLY, 2=LO_WRONLY, 4=LO_APPEND, 8=LO_RDWR, 16=LO_BUFFER, 32=LO_NOBUFFER -> or-mask
- * list: internal hashlist of php3
- * return -1 on error otherwise the new Blob-Object-id
- * ----------------------------------------------------------------------
-*/
-static long php3_intifxus_open_slob(long bid, long create_mode, HashTable *list) {
- IFX_IDRES *Ifx_slob;
- int errcode;
- int type;
-
- IFXLS_FETCH();
-
- Ifx_slob = (IFX_IDRES *) zend_list_find(bid,&type);
- if (type!=IFXL(le_idresult) || Ifx_slob->type!=TYPE_SLOB) {
- php_error(E_WARNING,"%d is not a Informix slob-result index",
- bid);
- return -1;
- }
-
- if(Ifx_slob->SLOB.lofd>0) {
- php_error(E_WARNING,"slob-resource already open");
- return -1;
- }
-
- Ifx_slob->SLOB.lofd=ifx_lo_open(&(Ifx_slob->SLOB.slob_data),create_mode,&errcode);
- if(errcode<0 || Ifx_slob->SLOB.lofd<0) {
- php_error(E_WARNING,"can't open slob-resource");
- return -1;
- }
-
- return 0;
-}
-
-
-/* ----------------------------------------------------------------------
- * internal function
- * long php3_intifxus_new_slob(HashTable *list)
- *
- * creates an slob-object but don't open it
- * list: internal hashlist of php3
- * return -1 on error otherwise the new slob-Object-id
- * ----------------------------------------------------------------------
-*/
-static long php3_intifxus_new_slob(HashTable *list) {
- IFX_IDRES *Ifx_slob;
-
- IFXLS_FETCH();
-
- Ifx_slob=emalloc(sizeof(IFX_IDRES));
- if(Ifx_slob==NULL) {
- php_error(E_WARNING,"can't create slob-resource");
- return -1;
- }
-
- Ifx_slob->type=TYPE_SLOB;
- Ifx_slob->SLOB.lofd=-1;
- Ifx_slob->SLOB.createspec=NULL;
- return zend_list_insert(Ifx_slob,IFXL(le_idresult));
-}
-
-
-
-/* ----------------------------------------------------------------------
- * internal function
- * ifx_lo_t *php3_intifxus_get_slobloc(long bid, HashTable *list)
- *
- * retuens the ifx_lo_t-structure of a slob-object
- * list: internal hashlist of php3
- * return -1 on error otherwise the new Blob-Object-id
- * ----------------------------------------------------------------------
-*/
-static ifx_lo_t *php3_intifxus_get_slobloc(long bid, HashTable *list) {
- IFX_IDRES *Ifx_slob;
- int type;
-
- IFXLS_FETCH();
-
- Ifx_slob = (IFX_IDRES *) zend_list_find(bid,&type);
- if (type!=IFXL(le_idresult) || Ifx_slob->type!=TYPE_SLOB) {
- php_error(E_WARNING,"%d is not a Informix slob-result index",
- bid);
- return NULL;
- }
-
- return &(Ifx_slob->SLOB.slob_data);
-}
-
-
-
-/* ----------------------------------------------------------------------
-** int ifxus_tell_slob(long bid)
-**
-** returns the current file or seek position of an open slob-object
-** bid: existing slob-id
-** return false on error otherwise the seek-position
-** ----------------------------------------------------------------------
-*/
-
-/* {{{ proto int ifxus_tell_slob(long bid)
- Returns the current file or seek position of an open slob-object */
-PHP_FUNCTION(ifxus_tell_slob) {
- pval *pbid;
- long bid;
- IFX_IDRES *Ifx_slob;
- ifx_int8_t akt_seek_pos;
- int type;
- long lakt_seek_pos;
-
- IFXLS_FETCH();
-
-
- if (ZEND_NUM_ARGS()!=1 || getParameters(ht, 1, &pbid)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long(pbid);
- bid=pbid->value.lval;
- Ifx_slob = (IFX_IDRES *) zend_list_find(bid,&type);
- if (type!=IFXL(le_idresult) || Ifx_slob->type!=TYPE_SLOB) {
- php_error(E_WARNING,"%d is not a Informix slob-result index",
- bid);
- RETURN_FALSE;
- }
-
- if(ifx_lo_tell(Ifx_slob->SLOB.lofd,&akt_seek_pos)<0) {
- php_error(E_WARNING,"can't perform tell-operation");
- RETURN_FALSE;
- }
-
- if(ifx_int8tolong(&akt_seek_pos,&lakt_seek_pos)<0) {
- php_error(E_WARNING,"seek-position to large for long");
- RETURN_FALSE;
- }
- RETURN_LONG(lakt_seek_pos);
-}
-/* }}} */
-
-
-
-/* ----------------------------------------------------------------------
-** int ifxus_seek_slob(long bid, int mode, long offset)
-**
-** sets the current file or seek position of an open slob-object
-** bid: existing slob-id
-** mode: 0=LO_SEEK_SET, 1=LO_SEEK_CUR, 2=LO_SEEK_END
-** offset: byte-offset
-** return false on error otherwise the seek-position
-** ----------------------------------------------------------------------
-*/
-
-/* {{{ proto int ifxus_seek_slob(long bid, int mode, long offset)
- Sets the current file or seek position of an open slob-object */
-PHP_FUNCTION(ifxus_seek_slob) {
- pval *pbid, *pmode, *poffset;
- long bid,lakt_seek_pos;
- IFX_IDRES *Ifx_slob;
- ifx_int8_t akt_seek_pos,offset;
- int type,mode;
-
-
- IFXLS_FETCH();
-
- if (ZEND_NUM_ARGS()!=3 || getParameters(ht, 3, &pbid, &pmode, &poffset)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long(pbid);
- convert_to_long(pmode);
- convert_to_long(poffset);
-
- bid=pbid->value.lval;
- Ifx_slob = (IFX_IDRES *) zend_list_find(bid,&type);
- if (type!=IFXL(le_idresult) || Ifx_slob->type!=TYPE_SLOB) {
- php_error(E_WARNING,"%d is not a Informix slob-result index",
- bid);
- RETURN_FALSE;
- }
-
- mode=LO_SEEK_SET;
- if(pmode->value.lval==1) {
- mode=LO_SEEK_CUR;
- }
- if(pmode->value.lval==2) {
- mode=LO_SEEK_END;
- }
-
- ifx_int8cvlong(poffset->value.lval,&offset);
- if(ifx_lo_seek(Ifx_slob->SLOB.lofd,&offset, mode,&akt_seek_pos)<0) {
- php_error(E_WARNING,"can't perform seek-operation");
- RETURN_FALSE;
- }
-
- if(ifx_int8tolong(&akt_seek_pos,&lakt_seek_pos)<0) {
- php_error(E_WARNING,"seek-position to large for long");
- RETURN_FALSE;
- }
- RETURN_LONG(lakt_seek_pos);
-}
-/* }}} */
-
-
-
-
-/* ----------------------------------------------------------------------
-** int ifxus_read_slob(long bid, long nbytes)
-**
-** reads nbytes of the slob-object
-** bid: existing slob-id
-** nbytes: bytes zu read
-** return false on error otherwise the string
-** ----------------------------------------------------------------------
-*/
-
-/* {{{ proto int ifxus_read_slob(long bid, long nbytes)
- Reads nbytes of the slob-object */
-PHP_FUNCTION(ifxus_read_slob) {
- pval *pbid, *pnbytes;
- long bid, nbytes;
- IFX_IDRES *Ifx_slob;
- int errcode,type;
- char *buffer;
-
-
- IFXLS_FETCH();
-
-
- if (ZEND_NUM_ARGS()!=2 || getParameters(ht, 2, &pbid, &pnbytes)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long(pbid);
- convert_to_long(pnbytes);
-
- bid=pbid->value.lval;
- Ifx_slob = (IFX_IDRES *) zend_list_find(bid,&type);
- if (type!=IFXL(le_idresult) || Ifx_slob->type!=TYPE_SLOB) {
- php_error(E_WARNING,"%d is not a Informix slob-result index",
- bid);
- RETURN_FALSE;
- }
-
- nbytes=pnbytes->value.lval;
- buffer=emalloc (nbytes);
- if(buffer==NULL) {
- php_error(E_WARNING,"cannot allocate memory");
- RETURN_FALSE;
- }
- if(ifx_lo_read(Ifx_slob->SLOB.lofd,buffer,nbytes,&errcode)<0) {
- efree(buffer);
- php_error(E_WARNING,"error during reading slob");
- RETURN_FALSE;
- }
-
- RETURN_STRINGL(buffer,nbytes,0);
-}
-/* }}} */
-
-
-/* ----------------------------------------------------------------------
-** int ifxus_write_slob(long bid, string content)
-**
-** writes a string into the slob-object
-** bid: existing slob-id
-** content: content to write
-** return false on error otherwise bytes written
-** ----------------------------------------------------------------------
-*/
-
-/* {{{ proto int ifxus_write_slob(long bid, string content)
- Writes a string into the slob-object */
-PHP_FUNCTION(ifxus_write_slob) {
- pval *pbid, *pcontent;
- long bid, nbytes;
- IFX_IDRES *Ifx_slob;
- int errcode,type;
- char *buffer;
-
-
- IFXLS_FETCH();
-
-
- if (ZEND_NUM_ARGS()!=2 || getParameters(ht, 2, &pbid, &pcontent)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long(pbid);
- convert_to_string(pcontent);
-
- bid=pbid->value.lval;
- Ifx_slob = (IFX_IDRES *) zend_list_find(bid,&type);
- if (type!=IFXL(le_idresult) || Ifx_slob->type!=TYPE_SLOB) {
- php_error(E_WARNING,"%d is not a Informix slob-result index",
- bid);
- RETURN_FALSE;
- }
-
- buffer=pcontent->value.str.val;
- nbytes=pcontent->value.str.len;
- if(nbytes<=0) {
- php_error(E_WARNING,"string has no content");
- RETURN_FALSE;
- }
- if((nbytes=ifx_lo_write(Ifx_slob->SLOB.lofd,buffer,nbytes,&errcode))<0) {
- php_error(E_WARNING,"error during writing slob");
- RETURN_FALSE;
- }
-
- RETURN_LONG(nbytes);
-}
-/* }}} */
-
-$endif;
-
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/informix/php_informix.h b/ext/informix/php_informix.h
deleted file mode 100644
index 78774eaba2..0000000000
--- a/ext/informix/php_informix.h
+++ /dev/null
@@ -1,216 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Danny Heijl <Danny.Heijl@cevi.be>, initial cut (ODS 7) |
- | Christian Cartus <chc@idgruppe.de>, blobs, and IUS 9 |
- | Jouni Ahto <jouni.ahto@exdec.fi>, configuration stuff |
- | based on mysql code by: Zeev Suraski <zeev@php.net> |
- +----------------------------------------------------------------------+
- */
-
-
-#ifndef PHP_INFORMIX_H
-#define PHP_INFORMIX_H
-
-#ifdef PHP_WIN32
-#define PHP_IFX_API __declspec(dllexport)
-#else
-#define PHP_IFX_API
-#endif
-
-
-#if HAVE_IFX /* with Informix */
-
-#ifndef DLEXPORT
-#define DLEXPORT
-#endif
-
-#ifdef ZTS
-#include "TSRM.h"
-#endif
-
-extern zend_module_entry ifx_module_entry;
-#define ifx_module_ptr &ifx_module_entry
-
-#undef TYPEMAX
-#undef CHAR
-
-#include "locator.h"
-#include "sqltypes.h"
-
-/* user functions */
-PHP_MINIT_FUNCTION(ifx);
-PHP_RINIT_FUNCTION(ifx);
-PHP_MSHUTDOWN_FUNCTION(ifx);
-PHP_MINFO_FUNCTION(ifx);
-/* functions common to all Informix versions */
-PHP_FUNCTION(ifx_connect);
-PHP_FUNCTION(ifx_pconnect);
-PHP_FUNCTION(ifx_close);
-PHP_FUNCTION(ifx_query);
-PHP_FUNCTION(ifx_prepare);
-PHP_FUNCTION(ifx_do);
-PHP_FUNCTION(ifx_error);
-PHP_FUNCTION(ifx_errormsg);
-PHP_FUNCTION(ifx_affected_rows);
-PHP_FUNCTION(ifx_num_rows);
-PHP_FUNCTION(ifx_num_fields);
-PHP_FUNCTION(ifx_fetch_row);
-PHP_FUNCTION(ifx_free_result);
-PHP_FUNCTION(ifx_htmltbl_result);
-PHP_FUNCTION(ifx_fieldtypes);
-PHP_FUNCTION(ifx_fieldproperties);
-PHP_FUNCTION(ifx_getsqlca);
-/* BLOB related stuff, IDS & IUS only */
-PHP_FUNCTION(ifx_create_blob);
-PHP_FUNCTION(ifx_free_blob) ;
-PHP_FUNCTION(ifx_get_blob);
-PHP_FUNCTION(ifx_update_blob);
-PHP_FUNCTION(ifx_blobinfile_mode);
-PHP_FUNCTION(ifx_copy_blob);
-PHP_FUNCTION(ifx_textasvarchar);
-PHP_FUNCTION(ifx_byteasvarchar);
-PHP_FUNCTION(ifx_nullformat);
-PHP_FUNCTION(ifx_create_char);
-PHP_FUNCTION(ifx_free_char) ;
-PHP_FUNCTION(ifx_update_char);
-PHP_FUNCTION(ifx_get_char);
-
-/* SLOB, CLOB : IUS only functions */
-#if HAVE_IFX_IUS
-PHP_FUNCTION(ifxus_create_slob);
-PHP_FUNCTION(ifxus_free_slob) ;
-PHP_FUNCTION(ifxus_close_slob) ;
-PHP_FUNCTION(ifxus_open_slob) ;
-PHP_FUNCTION(ifxus_read_slob);
-PHP_FUNCTION(ifxus_write_slob);
-PHP_FUNCTION(ifxus_seek_slob);
-PHP_FUNCTION(ifxus_tell_slob);
-#endif
-
-typedef struct {
- long default_link;
- long num_links,num_persistent;
- long max_links,max_persistent;
- long allow_persistent;
- char *default_host, *default_user, *default_password;
- int connectionid;
- int cursorid;
- int sv_sqlcode; /* saved informix SQLCODE value */
- long blobinfile; /* 0=save in memory, 1=save in file */
- long textasvarchar; /* 0=as id, 1=as varchar */
- long byteasvarchar; /* 0=as id, 1=as varchar */
- long charasvarchar; /* 0=don't strip trailing blanks, 1=strip */
- long nullformat; /* 0=NULL as "", 1= NULL as "NULL" */
- char *nullvalue; /* "" */
- char *nullstring; /* "NULL" */
-} php_ifx_globals; /* formerly "ifx_module" in the php3 version */
-
-typedef struct {
- int le_result;
- int le_link;
- int le_plink;
- int le_idresult;
-} php_ifx_listids;
-
-#define IFXL(v) (ifx_listids.v)
-
-#ifndef ZTS
-extern php_ifx_globals ifx_globals;
-#endif
-
-#ifdef ZTS
-# define IFXLS_D php_ifx_globals *ifx_globals
-# define IFXLS_DC , IFXLS_D
-# define IFXLS_C ifx_globals
-# define IFXLS_CC , IFXLS_C
-# define IFXG(v) (ifx_globals->v)
-# define IFXLS_FETCH() php_ifx_globals *ifx_globals = ts_resource(ifx_globals_id)
-# define IFX_TLS_VARS char *globals; IFXLS_FETCH(); globals = (char *)ifx_globals;
-#else
-# define IFXLS_D
-# define IFXLS_DC
-# define IFXLS_C
-# define IFXLS_CC
-# define IFXG(v) (ifx_globals.v)
-# define IFXLS_FETCH()
-# define IFX_TLS_VARS char *globals = (char *)&ifx_globals
-extern ZEND_API php_ifx_globals ifx_globals;
-#endif
-
-
-#define MAX_RESID 64
-#define BLOBINFILE 0 /* 0=in memory, 1=in file */
-
-/* query result set data */
-typedef struct ifx_res {
- char connecid[16];
- char cursorid[16];
- char descrpid[16];
- char statemid[16];
- int isscroll;
- int ishold;
- int iscursory;
- int paramquery;
- int numcols;
- int rowid;
- int affected_rows;
- long sqlerrd[6];
- int res_id[MAX_RESID];
-} IFX_RES;
-
-
-
-
-
-typedef struct _IFX_IDRES {
- int type;
- union {
- struct {
- int mode;
- loc_t blob_data;
- } BLOBRES;
- struct {
- char *char_data;
- int len;
- } CHARRES;
-#if HAVE_IFX_IUS
- struct {
- ifx_lo_t slob_data;
- ifx_lo_create_spec_t *createspec;
- int lofd;
- } SLOBRES;
-#endif
- } DATARES;
-} IFX_IDRES;
-
-
-
-#define BLOB DATARES.BLOBRES
-#define CHAR DATARES.CHARRES
-
-#if HAVE_IFX_IUS
-#define SLOB DATARES.SLOBRES
-#endif
-
-
-#else /* not HAVE_IFX */
-
-#define ifx_module_ptr NULL
-
-#endif
-
-#define phpext_informix_ptr ifx_module_ptr
-
-#endif /* PHP_INFORMIX_H */
diff --git a/ext/informix/setup.stub b/ext/informix/setup.stub
deleted file mode 100644
index 9a9d1ad841..0000000000
--- a/ext/informix/setup.stub
+++ /dev/null
@@ -1,9 +0,0 @@
-# $Source$
-# $Id$
-
-define_option with-informix 'Informix support?' yesnodir \
- "no $INFORMIXDIR Informix home" \
-' Whether to build PHP with Informix support. If you have not set up your\n
- Informix environment, enter what $INFORMIXDIR is usually set to here.\n
- You MUST set $INFORMIXDIR before trying to compile!\n
- More info about Informix can be found at http://www.informix.com/.'
diff --git a/ext/informix/stub.c b/ext/informix/stub.c
deleted file mode 100644
index e69de29bb2..0000000000
--- a/ext/informix/stub.c
+++ /dev/null
diff --git a/ext/ingres_ii/CREDITS b/ext/ingres_ii/CREDITS
deleted file mode 100644
index f23fb1d63f..0000000000
--- a/ext/ingres_ii/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-Ingres II
-David Hénot
diff --git a/ext/ingres_ii/EXPERIMENTAL b/ext/ingres_ii/EXPERIMENTAL
deleted file mode 100644
index 6443e99646..0000000000
--- a/ext/ingres_ii/EXPERIMENTAL
+++ /dev/null
@@ -1,5 +0,0 @@
-this extension is experimental,
-its functions may change their names
-or move to extension all together
-so do not rely to much on them
-you have been warned!
diff --git a/ext/ingres_ii/Makefile.in b/ext/ingres_ii/Makefile.in
deleted file mode 100644
index 827b44e649..0000000000
--- a/ext/ingres_ii/Makefile.in
+++ /dev/null
@@ -1,8 +0,0 @@
-# $Id$
-
-LTLIBRARY_NAME = libingres_ii.la
-LTLIBRARY_SOURCES = ii.c
-LTLIBRARY_SHARED_NAME = ingres_ii.la
-LTLIBRARY_SHARED_LIBADD = $(II_SHARED_LIBADD)
-
-include $(top_srcdir)/build/dynlib.mk
diff --git a/ext/ingres_ii/README b/ext/ingres_ii/README
deleted file mode 100644
index d16d152c09..0000000000
--- a/ext/ingres_ii/README
+++ /dev/null
@@ -1,13 +0,0 @@
-Ingres II extension for PHP 4.0
-===============================
-
-This extension provides access to Ingres II servers from PHP 4.0.
-It is still in development and has been only quickly tested on
-Linux (Mandrake 5.3 for Intel), so you should avoid using it with
-critical data.
-
-To enable the extension just add --with-ingres to your ./configure
-line. If the Ingres files are not found, use --with-ingres=DIR instead
-to specify your Ingres installation directory.
-
-Please report suggestions to henot@php.net.
diff --git a/ext/ingres_ii/config.m4 b/ext/ingres_ii/config.m4
deleted file mode 100644
index 6d28c51ae6..0000000000
--- a/ext/ingres_ii/config.m4
+++ /dev/null
@@ -1,34 +0,0 @@
-dnl $Id$
-dnl config.m4 for extension ingres_ii
-
-PHP_ARG_WITH(ingres, for Ingres II support,
-[ --with-ingres[=DIR] Include Ingres II support. DIR is the Ingres
- base directory (default $II_SYSTEM/II/ingres)])
-
-if test "$PHP_INGRES" != "no"; then
- AC_DEFINE(HAVE_II, 1, [Whether you have Ingres II])
- PHP_EXTENSION(ingres_ii, $ext_shared)
- PHP_SUBST(II_SHARED_LIBADD)
-
- if test "$PHP_INGRES" = "yes"; then
- II_DIR=$II_SYSTEM/ingres
- else
- II_DIR=$PHP_INGRES
- fi
-
- if test -r $II_DIR/files/iiapi.h; then
- II_INC_DIR=$II_DIR/files
- else
- AC_MSG_ERROR(Cannot find iiapi.h under $II_DIR/files)
- fi
-
- if test -r $II_DIR/lib/libiiapi.a; then
- II_LIB_DIR=$II_DIR/lib
- else
- AC_MSG_ERROR(Cannot find libiiapi.a under $II_DIR/lib)
- fi
-
- PHP_ADD_LIBRARY_WITH_PATH(iiapi, $II_LIB_DIR, II_SHARED_LIBADD)
- PHP_ADD_LIBRARY_WITH_PATH(ingres, $II_LIB_DIR, II_SHARED_LIBADD)
- PHP_ADD_INCLUDE($II_INC_DIR)
-fi
diff --git a/ext/ingres_ii/ii.c b/ext/ingres_ii/ii.c
deleted file mode 100644
index bddf3b5c1e..0000000000
--- a/ext/ingres_ii/ii.c
+++ /dev/null
@@ -1,1387 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Contributed by ECL IP'S Software & Services |
- | http://www.eclips-software.com |
- | mailto://idev@eclips-software.com |
- | Author: David Hénot <henot@php.net> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "php_globals.h"
-#include "php_ini.h"
-#include "ext/standard/info.h"
-#include "php_ii.h"
-#include "ii.h"
-#include "ext/standard/php_string.h"
-
-#if HAVE_II
-
-ZEND_DECLARE_MODULE_GLOBALS(ii)
-
-/* True globals, no need for thread safety */
-static int le_ii_link,le_ii_plink;
-
-#define SAFE_STRING(s) ((s)?(s):"")
-
-/* Every user visible function must have an entry in ii_functions[].
-*/
-function_entry ii_functions[] = {
- PHP_FE(ingres_connect, NULL)
- PHP_FE(ingres_pconnect, NULL)
- PHP_FE(ingres_close, NULL)
- PHP_FE(ingres_query, NULL)
- PHP_FE(ingres_num_rows, NULL)
- PHP_FE(ingres_num_fields, NULL)
- PHP_FE(ingres_field_name, NULL)
- PHP_FE(ingres_field_type, NULL)
- PHP_FE(ingres_field_nullable, NULL)
- PHP_FE(ingres_field_length, NULL)
- PHP_FE(ingres_field_precision, NULL)
- PHP_FE(ingres_field_scale, NULL)
- PHP_FE(ingres_fetch_array, NULL)
- PHP_FE(ingres_fetch_row, NULL)
- PHP_FE(ingres_fetch_object, NULL)
- PHP_FE(ingres_rollback, NULL)
- PHP_FE(ingres_commit, NULL)
- PHP_FE(ingres_autocommit, NULL)
- {NULL, NULL, NULL} /* Must be the last line in ii_functions[] */
-};
-
-zend_module_entry ingres_ii_module_entry = {
- "ingres_ii",
- ii_functions,
- PHP_MINIT(ii),
- PHP_MSHUTDOWN(ii),
- PHP_RINIT(ii),
- PHP_RSHUTDOWN(ii),
- PHP_MINFO(ii),
- STANDARD_MODULE_PROPERTIES
-};
-
-#ifdef COMPILE_DL_INGRES_II
-ZEND_GET_MODULE(ingres_ii)
-#endif
-
-/* php.ini entries
-*/
-PHP_INI_BEGIN()
- STD_PHP_INI_BOOLEAN("ingres.allow_persistent", "1", PHP_INI_SYSTEM, OnUpdateInt, allow_persistent, zend_ii_globals, ii_globals)
- STD_PHP_INI_ENTRY_EX("ingres.max_persistent", "-1", PHP_INI_SYSTEM, OnUpdateInt, max_persistent, zend_ii_globals, ii_globals, display_link_numbers)
- STD_PHP_INI_ENTRY_EX("ingres.max_links", "-1", PHP_INI_SYSTEM, OnUpdateInt, max_links, zend_ii_globals, ii_globals, display_link_numbers)
- STD_PHP_INI_ENTRY("ingres.default_database", NULL, PHP_INI_ALL, OnUpdateString, default_database, zend_ii_globals, ii_globals)
- STD_PHP_INI_ENTRY("ingres.default_user", NULL, PHP_INI_ALL, OnUpdateString, default_user, zend_ii_globals, ii_globals)
- STD_PHP_INI_ENTRY("ingres.default_password", NULL, PHP_INI_ALL, OnUpdateString, default_password, zend_ii_globals, ii_globals)
-PHP_INI_END()
-
-/* closes statement in given link
-*/
-static int _close_statement(II_LINK *link)
-{
- IIAPI_CLOSEPARM closeParm;
-
- closeParm.cl_genParm.gp_callback = NULL;
- closeParm.cl_genParm.gp_closure = NULL;
- closeParm.cl_stmtHandle = link->stmtHandle;
-
- IIapi_close(&closeParm);
- ii_sync(&(closeParm.cl_genParm));
-
- if(ii_success(&(closeParm.cl_genParm))==II_FAIL) {
- return 1;
- }
-
- link->stmtHandle = NULL;
- link->fieldCount = 0;
- link->descriptor = NULL;
- return 0;
-}
-
-/* rolls back transaction in given link
- after closing the active transaction (if any)
-*/
-static int _rollback_transaction(II_LINK *link)
-{
- IIAPI_ROLLBACKPARM rollbackParm;
-
- if(link->stmtHandle && _close_statement(link)) {
- php_error(E_WARNING,"Ingres II: Unable to close statement !!");
- return 1;
- }
-
- rollbackParm.rb_genParm.gp_callback = NULL;
- rollbackParm.rb_genParm.gp_closure = NULL;
- rollbackParm.rb_tranHandle = link->tranHandle;
- rollbackParm.rb_savePointHandle = NULL;
-
- IIapi_rollback(&rollbackParm);
- ii_sync(&(rollbackParm.rb_genParm));
-
- if(ii_success(&(rollbackParm.rb_genParm))==II_FAIL) {
- return 1;
- }
-
- link->tranHandle = NULL;
- return 0;
-}
-
-static void _close_ii_link(II_LINK *link)
-{
- IIAPI_DISCONNPARM disconnParm;
- IILS_FETCH();
-
- if(link->tranHandle && _rollback_transaction(link)) {
- php_error(E_WARNING,"Ingres II: Unable to rollback transaction !!");
- }
-
- disconnParm.dc_genParm.gp_callback = NULL;
- disconnParm.dc_genParm.gp_closure = NULL;
- disconnParm.dc_connHandle = link->connHandle;
-
- IIapi_disconnect(&disconnParm);
-
- free(link);
-
- IIG(num_links)--;
-}
-
-/* closes the given link, actually disconnecting from server
- and releasing associated resources after rolling back the
- active transaction (if any)
-*/
-static void php_close_ii_link(zend_rsrc_list_entry *rsrc)
-{
- II_LINK *link = (II_LINK *)rsrc->ptr;
- _close_ii_link(link);
-}
-
-
-/* closes the given persistent link, see _close_ii_link
-*/
-static void _close_ii_plink(zend_rsrc_list_entry *rsrc)
-{
- II_LINK *link = (II_LINK *)rsrc->ptr;
- IILS_FETCH();
-
- _close_ii_link(link);
- IIG(num_persistent)--;
-}
-
-/* cleans up the given persistent link.
- used when the request ends to 'refresh' the link for use
- by the next request
-*/
-static void _clean_ii_plink(zend_rsrc_list_entry *rsrc)
-{
- II_LINK *link = (II_LINK *)rsrc->ptr;
- IIAPI_AUTOPARM autoParm;
- IILS_FETCH();
-
- if(link->autocommit) {
-
- if(link->stmtHandle && _close_statement(link)) {
- php_error(E_WARNING,"Ingres II: Unable to close statement !!");
- }
-
- autoParm.ac_genParm.gp_callback = NULL;
- autoParm.ac_genParm.gp_closure = NULL;
- autoParm.ac_connHandle = link->connHandle;
- autoParm.ac_tranHandle = link->tranHandle;
-
- IIapi_autocommit(&autoParm);
- ii_sync(&(autoParm.ac_genParm));
-
- if(ii_success(&(autoParm.ac_genParm))==II_FAIL) {
- php_error(E_WARNING,"Ingres II: Unable to disable autocommit");
- }
-
- link->autocommit = 0;
- link->tranHandle = NULL;
- }
-
- if(link->tranHandle && _rollback_transaction(link)) {
- php_error(E_WARNING,"Ingres II: Unable to rollback transaction !!");
- }
-}
-
-/* sets the default link
-*/
-static void php_ii_set_default_link(int id)
-{
- IILS_FETCH();
-
- if (IIG(default_link)!=-1) {
- zend_list_delete(IIG(default_link));
- }
- IIG(default_link) = id;
- zend_list_addref(id);
-}
-
-/* gets the default link
- if none has been set, tries to open a new one with default
- parameters
-*/
-static int php_ii_get_default_link(INTERNAL_FUNCTION_PARAMETERS IILS_DC)
-{
- if (IIG(default_link)==-1) { /* no link opened yet, implicitly open one */
- ht = 0;
- php_ii_do_connect(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
- }
- return IIG(default_link);
-}
-
-static void php_ii_globals_init(zend_ii_globals *ii_globals)
-{
- ii_globals->num_persistent = 0;
-}
-
-/* Module initialization
-*/
-PHP_MINIT_FUNCTION(ii)
-{
- IIAPI_INITPARM initParm;
-
- ZEND_INIT_MODULE_GLOBALS(ii, php_ii_globals_init, NULL);
- REGISTER_INI_ENTRIES();
-
- le_ii_link = zend_register_list_destructors_ex(php_close_ii_link, NULL, "ingres", module_number);
- le_ii_plink = zend_register_list_destructors_ex(_clean_ii_plink, _close_ii_plink, "ingres persistent", module_number);
-
- /* Constants registration */
- REGISTER_LONG_CONSTANT("INGRES_ASSOC", II_ASSOC, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("INGRES_NUM", II_NUM, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("INGRES_BOTH", II_BOTH, CONST_CS | CONST_PERSISTENT);
-
- /* Ingres api initialization */
- initParm.in_timeout = -1; /* timeout in ms, -1 = no timeout */
- initParm.in_version = IIAPI_VERSION_1; /* api version used */
-
- IIapi_initialize(&initParm);
- if (initParm.in_status==IIAPI_ST_SUCCESS) {
- return SUCCESS;
- } else {
- return FAILURE;
- }
-}
-
-/* Module shutdown
-*/
-PHP_MSHUTDOWN_FUNCTION(ii)
-{
- IIAPI_TERMPARM termParm;
-
- UNREGISTER_INI_ENTRIES();
-
- /* Ingres api termination */
- IIapi_terminate(&termParm);
- if (termParm.tm_status==IIAPI_ST_SUCCESS) {
- return SUCCESS;
- } else {
- return FAILURE;
- }
-}
-
-/* New request initialization
-*/
-PHP_RINIT_FUNCTION(ii)
-{
- IILS_FETCH();
-
- IIG(default_link) = -1;
- IIG(num_links) = IIG(num_persistent);
- return SUCCESS;
-}
-
-/* End of request
-*/
-PHP_RSHUTDOWN_FUNCTION(ii)
-{
- IILS_FETCH();
-
- if (IIG(default_link)!=-1) {
- zend_list_delete(IIG(default_link));
- IIG(default_link) = -1;
- }
- return SUCCESS;
-}
-
-/* Informations reported to phpinfo()
-*/
-PHP_MINFO_FUNCTION(ii)
-{
- char buf[32];
- IILS_FETCH();
-
- php_info_print_table_start();
- php_info_print_table_header(2, "Ingres II Support", "enabled");
- sprintf(buf, "%ld", IIG(num_persistent));
- php_info_print_table_row(2, "Active Persistent Links", buf);
- sprintf(buf, "%ld", IIG(num_links));
- php_info_print_table_row(2, "Active Links", buf);
- php_info_print_table_end();
-
- DISPLAY_INI_ENTRIES();
-}
-
-/* Waits for completion of the last Ingres api call
- used because of the asynchronous design of this api
-*/
-static int ii_sync(IIAPI_GENPARM *genParm)
-{
- static IIAPI_WAITPARM waitParm = {
- -1, /* no timeout, we don't want asynchronous queries */
- 0 /* wt_status (output) */
- };
-
- while( genParm->gp_completed == FALSE ) {
- IIapi_wait(&waitParm);
- }
-
- if (waitParm.wt_status != IIAPI_ST_SUCCESS) {
- php_error(E_WARNING,"Ingres II: Unexpected failure of IIapi_wait()");
- return 0;
- }
- return 1;
-}
-
-/* Handles errors from Ingres api
-*/
-static int ii_success(IIAPI_GENPARM *genParm)
-{
- switch(genParm->gp_status) {
- case IIAPI_ST_SUCCESS:
- return II_OK;
- case IIAPI_ST_NO_DATA:
- return II_NO_DATA;
- default:
- if(genParm->gp_errorHandle == NULL) { /* no error message available */
- php_error(E_WARNING,"Ingres II: Server or API error - no error message available");
- } else {
- IIAPI_GETEINFOPARM getEInfoParm;
-
- getEInfoParm.ge_errorHandle = genParm->gp_errorHandle;
- IIapi_getErrorInfo(&getEInfoParm);
- php_error(E_WARNING,"Ingres II: Server or API error : %s", getEInfoParm.ge_message);
- php_error(E_WARNING,"Ingres II: SQLSTATE : %s", getEInfoParm.ge_SQLSTATE);
- }
- return II_FAIL;
- }
-}
-
-/* Actually handles connection creation, either persistent or not
-*/
-static void php_ii_do_connect(INTERNAL_FUNCTION_PARAMETERS,int persistent)
-{
- zval **database, **username, **password;
- char *db, *user, *pass;
- int argc;
- char *hashed_details;
- int hashed_details_length;
- IIAPI_CONNPARM connParm;
- II_LINK *link;
- IILS_FETCH();
- PLS_FETCH();
-
- /* Setting db, user and pass according to sql_safe_mode, parameters and/or default values */
- argc = ZEND_NUM_ARGS();
-
- if (PG(sql_safe_mode)) {
-
- if (argc>0) {
- php_error(E_NOTICE,"SQL safe mode in effect - ignoring host/user/password information");
- }
-
- db = pass = NULL;
- user=php_get_current_user();
- hashed_details_length = strlen(user) + sizeof("ingres___")-1;
- hashed_details = (char *) emalloc(hashed_details_length+1);
- sprintf(hashed_details,"ingres__%s_",user);
- } else {
- db = IIG(default_database);
- user = IIG(default_user);
- pass = IIG(default_password);
-
- if (argc > 3 || zend_get_parameters_ex(argc, &database, &username, &password) == FAILURE){
- WRONG_PARAM_COUNT;
- }
-
- switch(argc) {
- case 3:
- convert_to_string_ex(password);
- pass = (*password)->value.str.val;
- /* Fall-through. */
- case 2:
- convert_to_string_ex(username);
- user = (*username)->value.str.val;
- /* Fall-through. */
- case 1:
- convert_to_string_ex(database);
- db = (*database)->value.str.val;
- /* Fall-through. */
- case 0:
- break;
- }
-
- hashed_details_length = sizeof("ingres___")-1 + strlen(SAFE_STRING(db))+strlen(SAFE_STRING(user))+strlen(SAFE_STRING(pass));
- hashed_details = (char *) emalloc(hashed_details_length+1);
- sprintf(hashed_details,"ingres_%s_%s_%s",SAFE_STRING(db), SAFE_STRING(user), SAFE_STRING(pass));
- }
-
- /* if asked for unauthorized persistency, issue a warning
- and go for a non-persistent link */
- if (persistent && !IIG(allow_persistent)) {
- php_error(E_WARNING,"Ingres II: Persistent links disabled !");
- persistent = 0;
- }
-
- if (persistent) {
- list_entry *le;
-
- /* is this link already in the persistent list ? */
- if (zend_hash_find(&EG(persistent_list), hashed_details, hashed_details_length+1, (void **) &le)==FAILURE) { /* no, new persistent connection */
-
- list_entry new_le;
-
- if (IIG(max_links)!=-1 && IIG(num_links)>=IIG(max_links)) {
- php_error(E_WARNING,"Ingres II: Too many open links (%d)",IIG(num_links));
- efree(hashed_details);
- RETURN_FALSE;
- }
- if (IIG(max_persistent)!=-1 && IIG(num_persistent)>=IIG(max_persistent)) {
- php_error(E_WARNING,"Ingres II: Too many open persistent links (%d)",IIG(num_persistent));
- efree(hashed_details);
- RETURN_FALSE;
- }
-
- /* create the link */
- connParm.co_genParm.gp_callback = NULL;
- connParm.co_genParm.gp_closure = NULL;
- connParm.co_target = db;
- connParm.co_username = user;
- connParm.co_password = pass;
- connParm.co_timeout = -1; /* -1 is no timeout */
- connParm.co_connHandle = NULL;
- connParm.co_tranHandle = NULL;
-
- IIapi_connect(&connParm);
-
- if(!ii_sync(&(connParm.co_genParm)) || ii_success(&(connParm.co_genParm)) == II_FAIL) {
- efree(hashed_details);
- php_error(E_WARNING,"Ingres II: Unable to connect to database (%s)", db);
- RETURN_FALSE;
- }
-
- link = (II_LINK *) malloc(sizeof(II_LINK));
- link->connHandle = connParm.co_connHandle;
- link->tranHandle = NULL;
- link->stmtHandle = NULL;
- link->fieldCount = 0;
- link->descriptor = NULL;
- link->autocommit = 0;
-
- /* hash it up */
- new_le.type = le_ii_plink;
- new_le.ptr = link;
- if (zend_hash_update(&EG(persistent_list), hashed_details, hashed_details_length+1, (void *) &new_le, sizeof(list_entry), NULL)==FAILURE) {
- php_error(E_WARNING,"Ingres II: Unable to hash (%s)", hashed_details);
- free(link);
- efree(hashed_details);
- RETURN_FALSE;
- }
- IIG(num_persistent)++;
- IIG(num_links)++;
- } else { /* already open persistent connection */
- if (le->type != le_ii_plink) {
- RETURN_FALSE;
- }
- /* here we should ensure that the link did not die */
- /* unable to figure out the right way to do this
- maybe does the api handle the reconnection transparently ? */
- link = (II_LINK *) le->ptr;
- }
- ZEND_REGISTER_RESOURCE(return_value, link, le_ii_plink);
- } else { /* non persistent */
- list_entry *index_ptr,new_index_ptr;
-
- /* first we check the hash for the hashed_details key. if it exists,
- * it should point us to the right offset where the actual link sits.
- * if it doesn't, open a new link, add it to the resource list,
- * and add a pointer to it with hashed_details as the key.
- */
- if (zend_hash_find(&EG(regular_list),hashed_details,hashed_details_length+1,(void **) &index_ptr)==SUCCESS) {
- int type;
- void *ptr;
-
- if (index_ptr->type != le_index_ptr) {
- RETURN_FALSE;
- }
- link = (II_LINK *) index_ptr->ptr;
- ptr = zend_list_find((int) link,&type); /* check if the link is still there */
- if (ptr && (type==le_ii_link || type==le_ii_plink)) {
- zend_list_addref((int) link);
- return_value->value.lval = (int) link;
-
- php_ii_set_default_link((int) link);
-
- return_value->type = IS_RESOURCE;
- efree(hashed_details);
- return;
- } else {
- zend_hash_del(&EG(regular_list),hashed_details,hashed_details_length+1);
- }
- }
- if (IIG(max_links)!=-1 && IIG(num_links)>=IIG(max_links)) {
- php_error(E_WARNING,"Ingres II: Too many open links (%d)",IIG(num_links));
- efree(hashed_details);
- RETURN_FALSE;
- }
-
- /* create the link */
- connParm.co_genParm.gp_callback = NULL;
- connParm.co_genParm.gp_closure = NULL;
- connParm.co_target = db;
- connParm.co_username = user;
- connParm.co_password = pass;
- connParm.co_timeout = -1; /* -1 is no timeout */
- connParm.co_connHandle = NULL;
- connParm.co_tranHandle = NULL;
-
- IIapi_connect(&connParm);
-
- if(!ii_sync(&(connParm.co_genParm)) || ii_success(&(connParm.co_genParm)) == II_FAIL) {
- efree(hashed_details);
- php_error(E_WARNING,"Ingres II: Unable to connect to database (%s)", db);
- RETURN_FALSE;
- }
-
- link = (II_LINK *) malloc(sizeof(II_LINK));
- link->connHandle = connParm.co_connHandle;
- link->tranHandle = NULL;
- link->stmtHandle = NULL;
- link->fieldCount = 0;
- link->descriptor = NULL;
- link->autocommit = 0;
-
- /* add it to the list */
- ZEND_REGISTER_RESOURCE(return_value, link, le_ii_link);
-
- /* add it to the hash */
- new_index_ptr.ptr = (void *) return_value->value.lval;
- new_index_ptr.type = le_index_ptr;
- if (zend_hash_update(&EG(regular_list),hashed_details,hashed_details_length+1,(void *) &new_index_ptr, sizeof(list_entry), NULL)==FAILURE) {
- php_error(E_WARNING,"Ingres II: Unable to hash (%s)", hashed_details);
- free(link);
- efree(hashed_details);
- RETURN_FALSE;
- }
- IIG(num_links)++;
- }
-
- efree(hashed_details);
- php_ii_set_default_link(return_value->value.lval);
-}
-
-/* {{{ proto resource ingres_connect([string database [, string username [, string password]]])
- Open a connection to an Ingres II database the syntax of database is [node_id::]dbname[/svr_class] */
-PHP_FUNCTION(ingres_connect)
-{
- php_ii_do_connect(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-/* }}} */
-
-/* {{{ proto resource ingres_pconnect([string database [, string username [, string password]]])
- Open a persistent connection to an Ingres II database the syntax of database is [node_id::]dbname[/svr_class] */
-PHP_FUNCTION(ingres_pconnect)
-{
- php_ii_do_connect(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
-}
-/* }}} */
-
-/* {{{ proto bool ingres_close([resource link])
- Close an Ingres II database connection */
-PHP_FUNCTION(ingres_close)
-{
- zval **link;
- int argc;
- int link_id = -1;
- II_LINK *ii_link;
- IILS_FETCH();
-
- argc = ZEND_NUM_ARGS();
- if (argc > 1 || (argc && zend_get_parameters_ex(argc, &link) == FAILURE)){
- WRONG_PARAM_COUNT;
- }
-
- if (argc == 0) {
- link_id = IIG(default_link);
- }
- ZEND_FETCH_RESOURCE2(ii_link, II_LINK *, link, link_id, "Ingres II Link", le_ii_link, le_ii_plink);
-
- zend_list_delete(link_id);
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool ingres_query(string query [, resource link])
- Send a SQL query to Ingres II */
-/* This should go into the documentation */
-/* Unsupported query types:
- - close
- - commit
- - connect
- - disconnect
- - get dbevent
- - prepare to commit
- - rollback
- - savepoint
- - set autocommit
- - <all cursor related queries>
- (look for dedicated functions instead) */
-PHP_FUNCTION(ingres_query)
-{
- zval **query, **link;
- int argc;
- int link_id = -1;
- II_LINK *ii_link;
- IIAPI_QUERYPARM queryParm;
- IIAPI_GETDESCRPARM getDescrParm;
- IILS_FETCH();
-
- argc = ZEND_NUM_ARGS();
- if (argc < 1 || argc > 2 || zend_get_parameters_ex(argc, &query, &link) == FAILURE){
- WRONG_PARAM_COUNT;
- }
-
- if (argc < 2) {
- link_id = php_ii_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU IILS_CC);
- }
- ZEND_FETCH_RESOURCE2(ii_link, II_LINK *, link, link_id, "Ingres II Link", le_ii_link, le_ii_plink);
-
- convert_to_string_ex(query);
-
- /* if there's already an active statement, close it */
- if(ii_link->stmtHandle && _close_statement(ii_link)) {
- php_error(E_WARNING,"Ingres II: Unable to close statement !!");
- RETURN_FALSE;
- }
-
- /* send the query */
- queryParm.qy_genParm.gp_callback = NULL;
- queryParm.qy_genParm.gp_closure = NULL;
- queryParm.qy_connHandle = ii_link->connHandle;
- queryParm.qy_tranHandle = ii_link->tranHandle;
- queryParm.qy_stmtHandle = NULL;
- queryParm.qy_queryType = IIAPI_QT_QUERY;
- queryParm.qy_parameters = FALSE;
- queryParm.qy_queryText = Z_STRVAL_PP(query);
-
- IIapi_query(&queryParm);
- ii_sync(&(queryParm.qy_genParm));
-
- if(ii_success(&(queryParm.qy_genParm))==II_FAIL) {
- RETURN_FALSE;
- }
-
- /* store transaction and statement handles */
- ii_link->tranHandle = queryParm.qy_tranHandle;
- ii_link->stmtHandle = queryParm.qy_stmtHandle;
-
- /* get description of results */
- getDescrParm.gd_genParm.gp_callback = NULL;
- getDescrParm.gd_genParm.gp_closure = NULL;
- getDescrParm.gd_stmtHandle = ii_link->stmtHandle;
-
- IIapi_getDescriptor(&getDescrParm);
- ii_sync(&(getDescrParm.gd_genParm));
-
- if(ii_success(&(getDescrParm.gd_genParm))==II_FAIL) {
- RETURN_FALSE;
- }
-
- /* store the results */
- ii_link->fieldCount = getDescrParm.gd_descriptorCount;
- ii_link->descriptor = getDescrParm.gd_descriptor;
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int ingres_num_rows([resource link])
- Return the number of rows affected/returned by the last query */
-
-/* Warning : don't call ingres_num_rows() before ingres_fetch_xx(),
- or ingres_fetch_xx() wouldn't find any data */
-PHP_FUNCTION(ingres_num_rows)
-{
- zval **link;
- int argc;
- int link_id = -1;
- II_LINK *ii_link;
- IIAPI_GETQINFOPARM getQInfoParm;
- IILS_FETCH();
-
- argc = ZEND_NUM_ARGS();
- if (argc > 1 || zend_get_parameters_ex(argc, &link) == FAILURE){
- WRONG_PARAM_COUNT;
- }
-
- if (argc < 1) {
- link_id = php_ii_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU IILS_CC);
- }
-
- ZEND_FETCH_RESOURCE2(ii_link, II_LINK *, link, link_id, "Ingres II Link", le_ii_link, le_ii_plink);
-
- /* get number of affected rows */
- getQInfoParm.gq_genParm.gp_callback = NULL;
- getQInfoParm.gq_genParm.gp_closure = NULL;
- getQInfoParm.gq_stmtHandle = ii_link->stmtHandle;
-
- IIapi_getQueryInfo(&getQInfoParm);
- ii_sync(&(getQInfoParm.gq_genParm));
-
- if(ii_success(&(getQInfoParm.gq_genParm))==II_FAIL) {
- RETURN_FALSE;
- }
-
- /* return the result */
- if(getQInfoParm.gq_mask & IIAPI_GQ_ROW_COUNT) {
- RETURN_LONG(getQInfoParm.gq_rowCount);
- } else {
- RETURN_LONG(0);
- }
-}
-/* }}} */
-
-/* {{{ proto int ingres_num_fields([resource link])
- Return the number of fields returned by the last query */
-PHP_FUNCTION(ingres_num_fields)
-{
- zval **link;
- int argc;
- int link_id = -1;
- II_LINK *ii_link;
- IILS_FETCH();
-
- argc = ZEND_NUM_ARGS();
- if (argc > 1 || zend_get_parameters_ex(argc, &link) == FAILURE){
- WRONG_PARAM_COUNT;
- }
-
- if (argc < 1) {
- link_id = php_ii_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU IILS_CC);
- }
-
- ZEND_FETCH_RESOURCE2(ii_link, II_LINK *, link, link_id, "Ingres II Link", le_ii_link, le_ii_plink);
-
- RETURN_LONG(ii_link->fieldCount);
-}
-/* }}} */
-
-#define II_FIELD_INFO_NAME 1
-#define II_FIELD_INFO_TYPE 2
-#define II_FIELD_INFO_NULLABLE 3
-#define II_FIELD_INFO_LENGTH 4
-#define II_FIELD_INFO_PRECISION 5
-#define II_FIELD_INFO_SCALE 6
-
-/* Return information about a field in a query result
-*/
-static void php_ii_field_info(INTERNAL_FUNCTION_PARAMETERS, int info_type)
-{
- zval **idx, **link;
- int argc;
- int link_id = -1;
- char *name, *fun_name;
- int index;
- II_LINK *ii_link;
- IILS_FETCH();
-
- argc = ZEND_NUM_ARGS();
- if (argc < 1 || argc > 2 || zend_get_parameters_ex(argc, &idx, &link) == FAILURE){
- WRONG_PARAM_COUNT;
- }
-
- if (argc < 2) {
- link_id = php_ii_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU IILS_CC);
- }
-
- ZEND_FETCH_RESOURCE2(ii_link, II_LINK *, link, link_id, "Ingres II Link", le_ii_link, le_ii_plink);
-
- convert_to_long_ex(idx);
- index = Z_LVAL_PP(idx);
-
- if(index < 1 || index > ii_link->fieldCount) {
- switch(info_type) {
- case II_FIELD_INFO_NAME:
- fun_name = "ii_field_name";
- break;
- case II_FIELD_INFO_TYPE:
- fun_name = "ii_field_type";
- break;
- case II_FIELD_INFO_NULLABLE:
- fun_name = "ii_field_nullable";
- break;
- case II_FIELD_INFO_LENGTH:
- fun_name = "ii_field_length";
- break;
- case II_FIELD_INFO_PRECISION:
- fun_name = "ii_field_precision";
- break;
- case II_FIELD_INFO_SCALE:
- fun_name = "ii_field_scale";
- break;
- default:
- break;
- }
- php_error(E_WARNING,"Ingres II: %s() called with wrong index (%d)",fun_name,index);
- RETURN_FALSE;
- }
-
- switch (info_type) {
- case II_FIELD_INFO_NAME:
- name = php_ii_field_name(ii_link, index);
- if(name == NULL) {
- RETURN_FALSE;
- }
- RETURN_STRING(name, 1);
- break;
- case II_FIELD_INFO_TYPE:
- switch((ii_link->descriptor[index - 1]).ds_dataType) {
- case IIAPI_BYTE_TYPE: RETURN_STRING("IIAPI_BYTE_TYPE",1);
- case IIAPI_CHA_TYPE: RETURN_STRING("IIAPI_CHA_TYPE",1);
- case IIAPI_CHR_TYPE: RETURN_STRING("IIAPI_CHR_TYPE",1);
- case IIAPI_DEC_TYPE: RETURN_STRING("IIAPI_DEC_TYPE",1);
- case IIAPI_DTE_TYPE: RETURN_STRING("IIAPI_DTE_TYPE",1);
- case IIAPI_FLT_TYPE: RETURN_STRING("IIAPI_FLT_TYPE",1);
- case IIAPI_INT_TYPE: RETURN_STRING("IIAPI_INT_TYPE",1);
- case IIAPI_LOGKEY_TYPE: RETURN_STRING("IIAPI_LOGKEY_TYPE",1);
- case IIAPI_LBYTE_TYPE: RETURN_STRING("IIAPI_LBYTE_TYPE",1);
- case IIAPI_LVCH_TYPE: RETURN_STRING("IIAPI_LVCH_TYPE",1);
- case IIAPI_MNY_TYPE: RETURN_STRING("IIAPI_MNY_TYPE",1);
- case IIAPI_TABKEY_TYPE: RETURN_STRING("IIAPI_TABKEY_TYPE",1);
- case IIAPI_TXT_TYPE: RETURN_STRING("IIAPI_TXT_TYPE",1);
- case IIAPI_VBYTE_TYPE: RETURN_STRING("IIAPI_VBYTE_TYPE",1);
- case IIAPI_VCH_TYPE: RETURN_STRING("IIAPI_VCH_TYPE",1);
- default:
- php_error(E_WARNING,"Ingres II: Unknown Ingres data type");
- RETURN_FALSE;
- break;
- }
- break;
- case II_FIELD_INFO_NULLABLE:
- if((ii_link->descriptor[index - 1]).ds_nullable) {
- RETURN_TRUE;
- } else {
- RETURN_FALSE;
- }
- break;
- case II_FIELD_INFO_LENGTH:
- RETURN_LONG((ii_link->descriptor[index - 1]).ds_length);
- break;
- case II_FIELD_INFO_PRECISION:
- RETURN_LONG((ii_link->descriptor[index - 1]).ds_precision);
- break;
- case II_FIELD_INFO_SCALE:
- RETURN_LONG((ii_link->descriptor[index - 1]).ds_scale);
- break;
- default:
- RETURN_FALSE;
- }
-}
-
-/* Return the name of a field in a query result
-*/
-static char *php_ii_field_name(II_LINK *ii_link, int index)
-{
- if(index < 1 || index > ii_link->fieldCount) {
- php_error(E_WARNING,"Ingres II: php_ii_field_name() called with wrong index (%d)",index);
- return NULL;
- }
-
- return (ii_link->descriptor[index - 1]).ds_columnName;
-}
-
-/* {{{ proto string ingres_field_name(int index [, resource link])
- Return the name of a field in a query result index must be >0 and <= ingres_num_fields() */
-PHP_FUNCTION(ingres_field_name)
-{
- php_ii_field_info(INTERNAL_FUNCTION_PARAM_PASSTHRU, II_FIELD_INFO_NAME);
-}
-/* }}} */
-
-/* {{{ proto string ingres_field_type(int index [, resource link])
- Return the type of a field in a query result index must be >0 and <= ingres_num_fields() */
-PHP_FUNCTION(ingres_field_type)
-{
- php_ii_field_info(INTERNAL_FUNCTION_PARAM_PASSTHRU, II_FIELD_INFO_TYPE);
-}
-/* }}} */
-
-/* {{{ proto string ingres_field_nullable(int index [, resource link])
- Return true if the field is nullable and false otherwise index must be >0 and <= ingres_num_fields() */
-PHP_FUNCTION(ingres_field_nullable)
-{
- php_ii_field_info(INTERNAL_FUNCTION_PARAM_PASSTHRU, II_FIELD_INFO_NULLABLE);
-}
-/* }}} */
-
-/* {{{ proto string ingres_field_length(int index [, resource link])
- Return the length of a field in a query result index must be >0 and <= ingres_num_fields() */
-PHP_FUNCTION(ingres_field_length)
-{
- php_ii_field_info(INTERNAL_FUNCTION_PARAM_PASSTHRU, II_FIELD_INFO_LENGTH);
-}
-/* }}} */
-
-/* {{{ proto string ingres_field_precision(int index [, resource link])
- Return the precision of a field in a query result index must be >0 and <= ingres_num_fields() */
-PHP_FUNCTION(ingres_field_precision)
-{
- php_ii_field_info(INTERNAL_FUNCTION_PARAM_PASSTHRU, II_FIELD_INFO_PRECISION);
-}
-/* }}} */
-
-/* {{{ proto string ingres_field_scale(int index [, resource link])
- Return the scale of a field in a query result index must be >0 and <= ingres_num_fields() */
-PHP_FUNCTION(ingres_field_scale)
-{
- php_ii_field_info(INTERNAL_FUNCTION_PARAM_PASSTHRU, II_FIELD_INFO_SCALE);
-}
-/* }}} */
-
-/* Convert complex Ingres data types to php-usable ones
-*/
-#define IIAPI_CONVERT(destType,destSize,precision) {\
- convertParm.cv_srcDesc.ds_dataType = (ii_link->descriptor[i+k-2]).ds_dataType;\
- convertParm.cv_srcDesc.ds_nullable = (ii_link->descriptor[i+k-2]).ds_nullable;\
- convertParm.cv_srcDesc.ds_length = (ii_link->descriptor[i+k-2]).ds_length;\
- convertParm.cv_srcDesc.ds_precision = (ii_link->descriptor[i+k-2]).ds_precision;\
- convertParm.cv_srcDesc.ds_scale = (ii_link->descriptor[i+k-2]).ds_scale;\
- convertParm.cv_srcDesc.ds_columnType = (ii_link->descriptor[i+k-2]).ds_columnType;\
- convertParm.cv_srcDesc.ds_columnName = (ii_link->descriptor[i+k-2]).ds_columnName;\
- convertParm.cv_srcValue.dv_null = columnData[k-1].dv_null;\
- convertParm.cv_srcValue.dv_length = columnData[k-1].dv_length;\
- convertParm.cv_srcValue.dv_value = columnData[k-1].dv_value;\
- convertParm.cv_dstDesc.ds_dataType = destType;\
- convertParm.cv_dstDesc.ds_nullable = FALSE;\
- convertParm.cv_dstDesc.ds_length = destSize;\
- convertParm.cv_dstDesc.ds_precision = precision;\
- convertParm.cv_dstDesc.ds_scale = 0;\
- convertParm.cv_dstDesc.ds_columnType = IIAPI_COL_TUPLE;\
- convertParm.cv_dstDesc.ds_columnName = NULL;\
- convertParm.cv_dstValue.dv_null = FALSE;\
- convertParm.cv_dstValue.dv_length = convertParm.cv_dstDesc.ds_length;\
- convertParm.cv_dstValue.dv_value = emalloc(convertParm.cv_dstDesc.ds_length+1);\
-\
- IIapi_convertData(&convertParm);\
-\
- if(ii_success(&(getColParm.gc_genParm))!=II_OK) {\
- RETURN_FALSE;\
- }\
-\
- columnData[k-1].dv_length = convertParm.cv_dstValue.dv_length;\
- columnData[k-1].dv_value = convertParm.cv_dstValue.dv_value;\
- efree(convertParm.cv_srcValue.dv_value);}
-
-/* Fetch a row of result
-*/
-static void php_ii_fetch(INTERNAL_FUNCTION_PARAMETERS, II_LINK *ii_link, int result_type)
-{
- IIAPI_GETCOLPARM getColParm;
- IIAPI_DATAVALUE *columnData;
- IIAPI_CONVERTPARM convertParm;
- int i,j,k;
- int more;
- double value_double;
- long value_long;
- char *value_char_p;
- int len, should_copy, correct_length;
- PLS_FETCH();
-
- /* array initialization */
- if (array_init(return_value)==FAILURE) {
- RETURN_FALSE;
- }
-
- /* going through all fields */
- for (i=1; i<=ii_link->fieldCount;) {
- j = 1;
-
- /* as long as there are no long byte or long varchar fields,
- Ingres is able to fetch many fields at a time, so try to find
- these types and stop if they're found.
- variable j will get number of fields to fetch */
- if ((ii_link->descriptor[i]).ds_dataType != IIAPI_LBYTE_TYPE &&
- (ii_link->descriptor[i]).ds_dataType != IIAPI_LVCH_TYPE) {
- while ((ii_link->descriptor[i+j-1]).ds_dataType != IIAPI_LBYTE_TYPE &&
- (ii_link->descriptor[i+j-1]).ds_dataType != IIAPI_LVCH_TYPE &&
- i+j <= ii_link->fieldCount) {
- j++;
- }
- }
-
- /* allocate memory for j fields */
- columnData = (IIAPI_DATAVALUE *) emalloc(j*sizeof(IIAPI_DATAVALUE));
- for(k=1; k<=j; k++) {
- columnData[k-1].dv_value = (II_PTR) emalloc((ii_link->descriptor[i+k-2]).ds_length);
- }
-
- more = 1; /* this is for multi segment LBYTE and LVCH elements */
- while (more) {
- getColParm.gc_genParm.gp_callback = NULL;
- getColParm.gc_genParm.gp_closure = NULL;
- getColParm.gc_rowCount = 1;
- getColParm.gc_columnCount = j;
- getColParm.gc_columnData = columnData;
- getColParm.gc_stmtHandle = ii_link->stmtHandle;
- getColParm.gc_moreSegments = 0;
-
- IIapi_getColumns(&getColParm);
- ii_sync(&(getColParm.gc_genParm));
-
- if(ii_success(&(getColParm.gc_genParm))!=II_OK) {
- RETURN_FALSE;
- }
-
- more = getColParm.gc_moreSegments;
- if(more){ /* more segments of LBYTE or LVCH element to come */
- /* Multi segment LBYTE and LVCH elements not supported yet */
- php_error(E_ERROR,"Ingres II: Multi segment LBYTE and LVCH elements not supported yet");
- } else {
- for(k=1; k<=j; k++) {
- if(columnData[k-1].dv_null) { /* NULL value ? */
-
- if(result_type & II_NUM) {
- add_index_null(return_value, i+k-1);
- }
- if(result_type & II_ASSOC) {
- add_assoc_null(return_value, php_ii_field_name(ii_link, i+k-1));
- }
-
- } else { /* non NULL value */
- correct_length = 0;
-
- switch((ii_link->descriptor[i+k-2]).ds_dataType) {
- case IIAPI_DEC_TYPE: /* decimal (fixed point number) */
- case IIAPI_MNY_TYPE: /* money */
- /* convert to floating point number */
- IIAPI_CONVERT(IIAPI_FLT_TYPE,sizeof(II_FLOAT8),53);
- /* NO break */
- case IIAPI_FLT_TYPE: /* floating point number */
- switch(columnData[k-1].dv_length) {
- case 4:
- value_double = (double) *((II_FLOAT4 *) columnData[k-1].dv_value);
- break;
- case 8:
- value_double = (double) *((II_FLOAT8 *) columnData[k-1].dv_value);
- break;
- default:
- php_error(E_WARNING,"Ingres II: Invalid size for IIAPI_FLT_TYPE data (%d)",columnData[k-1].dv_length);
- break;
- }
- if(result_type & II_NUM) {
- add_index_double(return_value, i+k-1, value_double);
- }
- if(result_type & II_ASSOC) {
- add_assoc_double(return_value, php_ii_field_name(ii_link, i+k-1), value_double);
- }
- break;
- case IIAPI_INT_TYPE: /* integer */
- switch(columnData[k-1].dv_length) {
- case 1:
- value_long = (long) *((II_INT1 *) columnData[k-1].dv_value);
- break;
- case 2:
- value_long = (long) *((II_INT2 *) columnData[k-1].dv_value);
- break;
- case 4:
- value_long = (long) *((II_INT4 *) columnData[k-1].dv_value);
- break;
- default:
- php_error(E_WARNING,"Ingres II: Invalid size for IIAPI_INT_TYPE data (%d)",columnData[k-1].dv_length);
- break;
- }
- if(result_type & II_NUM) {
- add_index_long(return_value, i+k-1, value_long);
- }
- if(result_type & II_ASSOC) {
- add_assoc_long(return_value, php_ii_field_name(ii_link, i+k-1), value_long);
- }
- break;
- case IIAPI_TXT_TYPE: /* variable length character string */
- case IIAPI_VBYTE_TYPE: /* variable length binary string */
- case IIAPI_VCH_TYPE: /* variable length character string */
- /* real length is stored in first 2 bytes of data, so adjust
- length variable and data pointer */
- columnData[k-1].dv_length = *((II_INT2 *) columnData[k-1].dv_value);
- ((II_INT2 *)columnData[k-1].dv_value)++;
- correct_length = 1;
- /* NO break */
- case IIAPI_BYTE_TYPE: /* fixed length binary string */
- case IIAPI_CHA_TYPE: /* fixed length character string */
- case IIAPI_CHR_TYPE: /* fixed length character string */
- case IIAPI_LOGKEY_TYPE: /* value unique to database */
- case IIAPI_TABKEY_TYPE: /* value unique to table */
- case IIAPI_DTE_TYPE: /* date */
- /* eventualy convert date to string */
- if((ii_link->descriptor[i+k-2]).ds_dataType==IIAPI_DTE_TYPE) {
- IIAPI_CONVERT(IIAPI_CHA_TYPE,32,0);
- }
- /* use php_addslashes if asked to */
- if(PG(magic_quotes_runtime)) {
- value_char_p = php_addslashes((char *) columnData[k-1].dv_value,columnData[k-1].dv_length,&len,0);
- should_copy = 0;
- } else {
- value_char_p = (char *) columnData[k-1].dv_value;
- len = columnData[k-1].dv_length;
- should_copy = 1;
- }
-
- if(result_type & II_NUM) {
- add_index_stringl(return_value, i+k-1, value_char_p, len, should_copy);
- }
- if(result_type & II_ASSOC) {
- add_assoc_stringl(return_value, php_ii_field_name(ii_link, i+k-1), value_char_p, len, should_copy);
- }
- /* eventualy restore data pointer state for
- variable length data types */
- if(correct_length) {
- ((II_INT2 *)columnData[k-1].dv_value)--;
- }
- break;
- default:
- php_error(E_WARNING,"Ingres II: Invalid SQL data type in fetched field (%d -- length : %d)",(ii_link->descriptor[i+k-2]).ds_dataType,columnData[k-1].dv_length);
- break;
- }
- }
- }
- }
- }
- /* free the memory buffers */
- for(k=1; k<=j; k++) {
- efree(columnData[k-1].dv_value);
- }
- efree(columnData);
-
- /* increase field pointer by number of fetched fields */
- i+=j;
- }
-
-}
-
-/* {{{ proto array ingres_fetch_array([int result_type [, resource link]])
- Fetch a row of result into an array result_type can be II_NUM for enumerated array, II_ASSOC for associative array, or II_BOTH (default) */
-PHP_FUNCTION(ingres_fetch_array)
-{
- zval **result_type, **link;
- int argc;
- int link_id = -1;
- II_LINK *ii_link;
- IILS_FETCH();
-
- argc = ZEND_NUM_ARGS();
- if (argc > 2 || zend_get_parameters_ex(argc, &result_type, &link) == FAILURE){
- WRONG_PARAM_COUNT;
- }
-
- if (argc != 2) {
- link_id = php_ii_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU IILS_CC);
- }
-
- if (argc != 0) {
- convert_to_long_ex(result_type);
- }
-
- ZEND_FETCH_RESOURCE2(ii_link, II_LINK *, link, link_id, "Ingres II Link", le_ii_link, le_ii_plink);
-
- php_ii_fetch(INTERNAL_FUNCTION_PARAM_PASSTHRU, ii_link,
- (argc == 0 ? II_BOTH : Z_LVAL_PP(result_type)));
-}
-/* }}} */
-
-/* {{{ proto array ingres_fetch_row([resource link])
- Fetch a row of result into an enumerated array */
-PHP_FUNCTION(ingres_fetch_row)
-{
- zval **link;
- int argc;
- int link_id = -1;
- II_LINK *ii_link;
- IILS_FETCH();
-
- argc = ZEND_NUM_ARGS();
- if (argc > 1 || zend_get_parameters_ex(argc, &link) == FAILURE){
- WRONG_PARAM_COUNT;
- }
-
- if (argc != 1) {
- link_id = php_ii_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU IILS_CC);
- }
-
- ZEND_FETCH_RESOURCE2(ii_link, II_LINK *, link, link_id, "Ingres II Link", le_ii_link, le_ii_plink);
-
- php_ii_fetch(INTERNAL_FUNCTION_PARAM_PASSTHRU, ii_link, II_NUM);
-}
-/* }}} */
-
-/* {{{ proto array ingres_fetch_object([int result_type [, resource link]])
- Fetch a row of result into an object result_type can be II_NUM for enumerated object, II_ASSOC for associative object, or II_BOTH (default) */
-PHP_FUNCTION(ingres_fetch_object)
-{
- zval **result_type, **link;
- int argc;
- int link_id = -1;
- II_LINK *ii_link;
- IILS_FETCH();
-
- argc = ZEND_NUM_ARGS();
- if (argc > 2 || zend_get_parameters_ex(argc, &result_type, &link) == FAILURE){
- WRONG_PARAM_COUNT;
- }
-
- if (argc != 2) {
- link_id = php_ii_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU IILS_CC);
- }
-
- if (argc != 0) {
- convert_to_long_ex(result_type);
- }
-
- ZEND_FETCH_RESOURCE2(ii_link, II_LINK *, link, link_id, "Ingres II Link", le_ii_link, le_ii_plink);
-
- php_ii_fetch(INTERNAL_FUNCTION_PARAM_PASSTHRU, ii_link,
- (argc == 0 ? II_BOTH : Z_LVAL_PP(result_type)));
- if(Z_TYPE_P(return_value)==IS_ARRAY) {
- convert_to_object(return_value);
- }
-}
-/* }}} */
-
-/* {{{ proto bool ingres_rollback([resource link])
- Roll back a transaction */
-PHP_FUNCTION(ingres_rollback)
-{
- zval **link;
- int argc;
- int link_id = -1;
- II_LINK *ii_link;
- IILS_FETCH();
-
- argc = ZEND_NUM_ARGS();
- if (argc > 1 || (argc && zend_get_parameters_ex(argc, &link) == FAILURE)){
- WRONG_PARAM_COUNT;
- }
-
- if (argc == 0) {
- link_id = IIG(default_link);
- }
- ZEND_FETCH_RESOURCE2(ii_link, II_LINK *, link, link_id, "Ingres II Link", le_ii_link, le_ii_plink);
-
- if(_rollback_transaction(ii_link)) {
- RETURN_FALSE;
- }
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool ingres_commit([resource link])
- Commit a transaction */
-PHP_FUNCTION(ingres_commit)
-{
- zval **link;
- int argc;
- int link_id = -1;
- II_LINK *ii_link;
- IIAPI_COMMITPARM commitParm;
- IILS_FETCH();
-
- argc = ZEND_NUM_ARGS();
- if (argc > 1 || (argc && zend_get_parameters_ex(argc, &link) == FAILURE)){
- WRONG_PARAM_COUNT;
- }
-
- if (argc == 0) {
- link_id = IIG(default_link);
- }
- ZEND_FETCH_RESOURCE2(ii_link, II_LINK *, link, link_id, "Ingres II Link", le_ii_link, le_ii_plink);
-
- if(ii_link->stmtHandle && _close_statement(ii_link)) {
- php_error(E_WARNING,"Ingres II: Unable to close statement !!");
- RETURN_FALSE;
- }
-
- commitParm.cm_genParm.gp_callback = NULL;
- commitParm.cm_genParm.gp_closure = NULL;
- commitParm.cm_tranHandle = ii_link->tranHandle;
-
- IIapi_commit(&commitParm);
- ii_sync(&(commitParm.cm_genParm));
-
- if(ii_success(&(commitParm.cm_genParm))==II_FAIL) {
- RETURN_FALSE;
- }
-
- ii_link->tranHandle = NULL;
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool ingres_autocommit([resource link])
- Switch autocommit on or off */
-PHP_FUNCTION(ingres_autocommit)
-{
- zval **link;
- int argc;
- int link_id = -1;
- II_LINK *ii_link;
- IIAPI_AUTOPARM autoParm;
- IILS_FETCH();
-
- argc = ZEND_NUM_ARGS();
- if (argc > 1 || (argc && zend_get_parameters_ex(argc, &link) == FAILURE)){
- WRONG_PARAM_COUNT;
- }
-
- if (argc == 0) {
- link_id = IIG(default_link);
- }
- ZEND_FETCH_RESOURCE2(ii_link, II_LINK *, link, link_id, "Ingres II Link", le_ii_link, le_ii_plink);
-
- autoParm.ac_genParm.gp_callback = NULL;
- autoParm.ac_genParm.gp_closure = NULL;
- autoParm.ac_connHandle = ii_link->connHandle;
- autoParm.ac_tranHandle = ii_link->tranHandle;
-
- IIapi_autocommit(&autoParm);
- ii_sync(&(autoParm.ac_genParm));
-
- if(ii_success(&(autoParm.ac_genParm))==II_FAIL) {
- RETURN_FALSE;
- }
-
- ii_link->autocommit = (ii_link->autocommit ? 0 : 1);
- ii_link->tranHandle = autoParm.ac_tranHandle;
- RETURN_TRUE;
-}
-/* }}} */
-
-#endif /* HAVE_II */
-
diff --git a/ext/ingres_ii/ii.h b/ext/ingres_ii/ii.h
deleted file mode 100644
index d5da50acb5..0000000000
--- a/ext/ingres_ii/ii.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Contributed by ECL IP'S Software & Services |
- | http://www.eclips-software.com |
- | mailto://idev@eclips-software.com |
- | Author: David Hénot <henot@php.net> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifndef II_H
-#define II_H
-
-#if HAVE_II
-#include "php_ii.h"
-#include "iiapi.h"
-
-typedef struct _II_LINK {
- int autocommit;
- II_PTR connHandle;
- II_PTR tranHandle;
- II_PTR stmtHandle;
- II_LONG fieldCount;
- IIAPI_DESCRIPTOR *descriptor;
-} II_LINK;
-
-static int ii_sync(IIAPI_GENPARM *genParm);
-static int ii_success(IIAPI_GENPARM *genParm);
-#define II_FAIL 0
-#define II_OK 1
-#define II_NO_DATA 2
-static int _close_statement(II_LINK *link);
-static int _rollback_transaction(II_LINK *link);
-static void _close_ii_link(II_LINK *link);
-static void _close_ii_plink(zend_rsrc_list_entry *link);
-static int php_ii_get_default_link(INTERNAL_FUNCTION_PARAMETERS IILS_DC);
-static void php_ii_set_default_link(int id);
-static void php_ii_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent);
-static char *php_ii_field_name(II_LINK *ii_link, int index);
-static void php_ii_field_info(INTERNAL_FUNCTION_PARAMETERS, int info_type);
-static void php_ii_fetch(INTERNAL_FUNCTION_PARAMETERS, II_LINK *ii_link, int result_type);
-
-#endif /* HAVE_II */
-#endif /* II_H */
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/ingres_ii/ingres.dsp b/ext/ingres_ii/ingres.dsp
deleted file mode 100644
index c3815ac63a..0000000000
--- a/ext/ingres_ii/ingres.dsp
+++ /dev/null
@@ -1,111 +0,0 @@
-# Microsoft Developer Studio Project File - Name="ingres" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=ingres - Win32 Debug_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "ingres.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "ingres.mak" CFG="ingres - Win32 Debug_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "ingres - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "ingres - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "ingres - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "INGRES_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\TSRM" /D ZEND_DEBUG=0 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "COMPILE_DL_INGRES_II" /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_II=1 /D ZTS=1 /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x407 /d "NDEBUG"
-# ADD RSC /l 0x407 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 php4ts.lib oiapi.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_ingres.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
-
-!ELSEIF "$(CFG)" == "ingres - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "INGRES_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\TSRM" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "PHP_EXPORTS" /D "COMPILE_DL_INGRES_II" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_II=1 /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x407 /d "_DEBUG"
-# ADD RSC /l 0x407 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 php4ts_debug.lib oiapi.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"..\..\Debug_TS/php_ingres.dll" /pdbtype:sept /libpath:"..\..\Debug_TS"
-
-!ENDIF
-
-# Begin Target
-
-# Name "ingres - Win32 Release_TS"
-# Name "ingres - Win32 Debug_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\ii.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\ii.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\php_ii.h
-# End Source File
-# End Group
-# End Target
-# End Project
diff --git a/ext/ingres_ii/php_ii.h b/ext/ingres_ii/php_ii.h
deleted file mode 100644
index af9ee73d7a..0000000000
--- a/ext/ingres_ii/php_ii.h
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Contributed by ECL IP'S Software & Services |
- | http://www.eclips-software.com |
- | mailto://idev@eclips-software.com |
- | Author: David Hénot <henot@php.net> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifndef PHP_II_H
-#define PHP_II_H
-
-#if HAVE_II
-
-extern zend_module_entry ingres_ii_module_entry;
-#define phpext_ingres_ii_ptr &ingres_ii_module_entry
-
-#ifdef PHP_WIN32
-#define PHP_II_API __declspec(dllexport)
-#else
-#define PHP_II_API
-#endif
-
-PHP_MINIT_FUNCTION(ii);
-PHP_MSHUTDOWN_FUNCTION(ii);
-PHP_RINIT_FUNCTION(ii);
-PHP_RSHUTDOWN_FUNCTION(ii);
-PHP_MINFO_FUNCTION(ii);
-
-PHP_FUNCTION(ingres_connect);
-PHP_FUNCTION(ingres_pconnect);
-PHP_FUNCTION(ingres_close);
-PHP_FUNCTION(ingres_query);
-PHP_FUNCTION(ingres_num_rows);
-PHP_FUNCTION(ingres_num_fields);
-PHP_FUNCTION(ingres_field_name);
-PHP_FUNCTION(ingres_field_type);
-PHP_FUNCTION(ingres_field_nullable);
-PHP_FUNCTION(ingres_field_length);
-PHP_FUNCTION(ingres_field_precision);
-PHP_FUNCTION(ingres_field_scale);
-PHP_FUNCTION(ingres_fetch_array);
-PHP_FUNCTION(ingres_fetch_row);
-PHP_FUNCTION(ingres_fetch_object);
-PHP_FUNCTION(ingres_rollback);
-PHP_FUNCTION(ingres_commit);
-PHP_FUNCTION(ingres_autocommit);
-
-ZEND_BEGIN_MODULE_GLOBALS(ii)
- long allow_persistent;
- long max_persistent;
- long max_links;
- char *default_database;
- char *default_user;
- char *default_password;
-
- long num_persistent;
- long num_links;
- long default_link;
-ZEND_END_MODULE_GLOBALS(ii)
-
-#define II_ASSOC (1<<0)
-#define II_NUM (1<<1)
-#define II_BOTH (II_ASSOC|II_NUM)
-
-#ifdef ZTS
-#define IILS_D zend_ii_globals *ii_globals
-#define IILS_DC , IILS_D
-#define IILS_C ii_globals
-#define IILS_CC , IILS_C
-#define IIG(v) (ii_globals->v)
-#define IILS_FETCH() zend_ii_globals *ii_globals = ts_resource(ii_globals_id)
-#else
-#define IILS_D
-#define IILS_DC
-#define IILS_C
-#define IILS_CC
-#define IIG(v) (ii_globals.v)
-#define IILS_FETCH()
-#endif
-
-#else
-
-#define phpext_ii_ptr NULL
-
-#endif
-
-#endif /* PHP_II_H */
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/interbase/CREDITS b/ext/interbase/CREDITS
deleted file mode 100644
index 2decd031dd..0000000000
--- a/ext/interbase/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-InterBase
-Jouni Ahto, Andrew Avdeev
diff --git a/ext/interbase/Makefile.in b/ext/interbase/Makefile.in
deleted file mode 100644
index bb2176afad..0000000000
--- a/ext/interbase/Makefile.in
+++ /dev/null
@@ -1,7 +0,0 @@
-
-LTLIBRARY_NAME = libinterbase.la
-LTLIBRARY_SOURCES = interbase.c
-LTLIBRARY_SHARED_NAME = interbase.la
-LTLIBRARY_SHARED_LIBADD = $(INTERBASE_SHARED_LIBADD)
-
-include $(top_srcdir)/build/dynlib.mk
diff --git a/ext/interbase/config.m4 b/ext/interbase/config.m4
deleted file mode 100644
index f7a4f03a7c..0000000000
--- a/ext/interbase/config.m4
+++ /dev/null
@@ -1,21 +0,0 @@
-dnl $Id$
-
-PHP_ARG_WITH(interbase,for InterBase support,
-[ --with-interbase[=DIR] Include InterBase support. DIR is the InterBase base
- install directory, defaults to /usr/interbase])
-
-if test "$PHP_INTERBASE" != "no"; then
- if test "$PHP_INTERBASE" = "yes"; then
- IBASE_INCDIR=/usr/interbase/include
- IBASE_LIBDIR=/usr/interbase/lib
- else
- IBASE_INCDIR=$PHP_INTERBASE/include
- IBASE_LIBDIR=$PHP_INTERBASE/lib
- fi
- PHP_ADD_LIBRARY_WITH_PATH(gds, $IBASE_LIBDIR, INTERBASE_SHARED_LIBADD)
- PHP_ADD_INCLUDE($IBASE_INCDIR)
- AC_DEFINE(HAVE_IBASE,1,[ ])
-dnl AC_CHECK_LIB(c, strptime, [AC_DEFINE(HAVE_STRPTIME,1,[])])
- PHP_EXTENSION(interbase, $ext_shared)
- PHP_SUBST(INTERBASE_SHARED_LIBADD)
-fi
diff --git a/ext/interbase/interbase.c b/ext/interbase/interbase.c
deleted file mode 100644
index e39dfab7e8..0000000000
--- a/ext/interbase/interbase.c
+++ /dev/null
@@ -1,2930 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Jouni Ahto <jouni.ahto@exdec.fi> |
- | Andrew Avdeev <andy@rsc.mv.ru> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-
-/* TODO: Arrays, roles?
-A lot... */
-
-/*
- Changes:
- 1999-09-21: Ivo Panacek <ivop@regionet.cz>
- - added COMPILE_DL section
- - more verbose php_info_ibase function
- mostly stolen from pgsql.c for now
- 1999-10-05: Ivo Panacek <ivop@regionet.cz>
- - safe rinit/rfinish: check for NULL so
- rfinish could be called repeatedly
- emalloc & co. replaced with malloc & co.
-*/
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "php_ini.h"
-#include "ext/standard/php_standard.h"
-#include "php_globals.h"
-#include "php_interbase.h"
-
-#if HAVE_IBASE
-#include <ibase.h>
-#include <time.h>
-#include "ext/standard/fsock.h"
-#include "ext/standard/info.h"
-
-#ifdef SQL_INT64
-#include <math.h>
-#endif
-
-#ifndef SQL_DIALECT_CURRENT
-#define SQL_DIALECT_CURRENT 1
-#endif
-
-/*
-#define IBDEBUG(a) php_printf("::: %s (%d)\n", a, __LINE__);
-*/
-#define IBDEBUG(a)
-
-#define SAFE_STRING(s) ((s)?(s):"")
-
-/* {{{ extension definition structures */
-function_entry ibase_functions[] = {
- PHP_FE(ibase_connect, NULL)
- PHP_FE(ibase_pconnect, NULL)
- PHP_FE(ibase_close, NULL)
- PHP_FE(ibase_query, NULL)
- PHP_FE(ibase_fetch_row, NULL)
- PHP_FE(ibase_fetch_object, NULL)
- PHP_FE(ibase_free_result, NULL)
- PHP_FE(ibase_prepare, NULL)
- PHP_FE(ibase_execute, NULL)
- PHP_FE(ibase_free_query, NULL)
- PHP_FE(ibase_timefmt, NULL)
-
- PHP_FE(ibase_num_fields, NULL)
- PHP_FE(ibase_field_info, NULL)
-
- PHP_FE(ibase_trans, NULL)
- PHP_FE(ibase_commit, NULL)
- PHP_FE(ibase_rollback, NULL)
-
- PHP_FE(ibase_blob_info, NULL)
- PHP_FE(ibase_blob_create, NULL)
- PHP_FE(ibase_blob_add, NULL)
- PHP_FE(ibase_blob_cancel, NULL)
- PHP_FE(ibase_blob_close, NULL)
- PHP_FE(ibase_blob_open, NULL)
- PHP_FE(ibase_blob_get, NULL)
- PHP_FE(ibase_blob_echo, NULL)
- PHP_FE(ibase_blob_import, NULL)
- PHP_FE(ibase_errmsg, NULL)
- {NULL, NULL, NULL}
-};
-
-zend_module_entry ibase_module_entry =
-{
- "interbase",
- ibase_functions,
- PHP_MINIT(ibase),
- PHP_MSHUTDOWN(ibase),
- PHP_RINIT(ibase),
- PHP_RSHUTDOWN(ibase),
- PHP_MINFO(ibase),
- STANDARD_MODULE_PROPERTIES
-};
-
-#ifdef COMPILE_DL_INTERBASE
-ZEND_GET_MODULE(ibase)
-
-#define DL_MALLOC(size) malloc(size)
-#define DL_STRDUP(str) strdup(str)
-#define DL_FREE(ptr) free(ptr)
-
-#else
-
-#define DL_MALLOC(size) emalloc(size)
-#define DL_STRDUP(str) estrdup(str)
-#define DL_FREE(ptr) efree(ptr)
-
-#endif
-
-/* True globals, no need for thread safety */
-static int le_blob, le_link, le_plink, le_result, le_query, le_trans;
-
-ZEND_DECLARE_MODULE_GLOBALS(ibase)
-
-/* }}} */
-
-/* {{{ internal macros, functions and structures */
-
-#define IB_STATUS (IBG(status))
-
-/* Fill ib_link and trans_n with the correct database link and transaction slot number. */
-
-static void get_link_trans(INTERNAL_FUNCTION_PARAMETERS, zval **link_id, ibase_db_link **ib_link, int *trans_n, int *trans_id) {
- int type;
- void *resource = NULL;
- ibase_tr_link *ib_trans;
- IBLS_FETCH();
-
- IBDEBUG("Transaction or database link?");
- if ((resource = zend_list_find(Z_LVAL_PP(link_id), &type))) {
- IBDEBUG("Found in list");
- if (type == le_trans) {
- /* Transaction resource. Fetch it, database link resource
- is stored in ib_trans->link_rsrc. */
- IBDEBUG("Type is le_trans");
- *trans_id = (Z_LVAL_PP(link_id));
- ZEND_FETCH_RESOURCE(ib_trans, ibase_tr_link *, link_id, -1, "InterBase transaction", le_trans);
- *trans_n = ib_trans->trans_num;
- ZEND_FETCH_RESOURCE2(resource, ibase_db_link *, link_id, ib_trans->link_rsrc, "InterBase link", le_link, le_plink);
- } else {
- IBDEBUG("Type is le_[p]link");
- /* Database link resource, use default transaction (=0). */
- *trans_n = 0;
- ZEND_FETCH_RESOURCE2(resource, ibase_db_link *, link_id, -1, "InterBase link", le_link, le_plink);
- }
- }
- *ib_link = resource;
-}
-
-#define RESET_ERRMSG { IBG(errmsg)[0] = '\0';}
-
-#define TEST_ERRMSG ( IBG(errmsg)[0] != '\0')
-
-/* sql variables union
- used for convert and binding input variables
-*/
-typedef struct {
- union {
- short sval;
- float fval;
- ISC_QUAD qval;
-#ifdef ISC_TIMESTAMP
- ISC_TIMESTAMP tsval;
- ISC_DATE dtval;
- ISC_TIME tmval;
-#endif
- } val;
- short sqlind;
-} BIND_BUF;
-
-
-/* get blob identifier from argument
- on empty unset argument ib_blob set to NULL
-*/
-#define GET_BLOB_ID_ARG(blob_arg, ib_blob)\
-{\
- if (blob_arg->type == IS_STRING && blob_arg->value.str.len == 0) {\
- ib_blob = NULL;\
- } else if (blob_arg->type != IS_STRING\
- || blob_arg->value.str.len != sizeof(ibase_blob_handle)\
- || ((ibase_blob_handle *)(blob_arg->value.str.val))->bl_handle != 0){\
- _php_ibase_module_error("invalid blob id");\
- RETURN_FALSE;\
- } else {\
- ib_blob = (ibase_blob_handle *)blob_arg->value.str.val;\
- }\
-}
-
-
-/* get blob handle from argument
- note: blob already open when handle active
-*/
-#define GET_BLOB_HANDLE_ARG(blob_arg, blob_ptr) \
-{ \
- int type; \
- convert_to_long(blob_arg); \
- blob_ptr = (ibase_blob_handle *) zend_list_find(blob_arg->value.lval, &type); \
- if (type!=le_blob) { \
- _php_ibase_module_error("%d is not blob handle",blob_arg->value.lval); \
- RETURN_FALSE; \
- } \
-}
-
-/* blob information struct */
-typedef struct {
- ISC_LONG max_segment; /* Length of longest segment */
- ISC_LONG num_segments; /* Total number of segments */
- ISC_LONG total_length; /* Total length of blob */
- int bl_stream; /* blob is stream ? */
-} IBASE_BLOBINFO;
-
-/* }}} */
-
-/* error handling ---------------------------- */
-
-/* {{{ proto string ibase_errmsg(void)
- Return error message */
-PHP_FUNCTION(ibase_errmsg)
-{
- IBLS_FETCH();
-
- if (IBG(errmsg[0])) {
- RETURN_STRING(IBG(errmsg),1);
- }
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ _php_ibase_error()
- print interbase error and save it for ibase_errmsg() */
-static void _php_ibase_error(void)
-{
- char *s;
- ISC_STATUS *statusp;
- IBLS_FETCH();
-
- s = IBG(errmsg);
- statusp = IB_STATUS;
- while ((s - IBG(errmsg)) < MAX_ERRMSG - (IBASE_MSGSIZE + 2) && isc_interprete(s, &statusp)) {
- strcat(IBG(errmsg), " ");
- s = IBG(errmsg) + strlen(IBG(errmsg));
- }
- php_error(E_WARNING, "InterBase: %s", IBG(errmsg));
-}
-/* }}} */
-
-/* {{{ _php_ibase_module_error()
- print php interbase module error and save it for ibase_errmsg() */
-static void _php_ibase_module_error(char *msg, ...)
-{
- va_list ap;
- int len;
- IBLS_FETCH();
-
- va_start(ap, msg);
- len = vsnprintf(IBG(errmsg), MAX_ERRMSG - 1, msg, ap);
- va_end(ap);
- IBG(errmsg[len]) = '\0';
-
- php_error(E_WARNING, "InterBase module: %s", IBG(errmsg));
-}
-/* }}} */
-
-
-/* destructors ---------------------- */
-
-/* {{{ _php_ibase_free_xsqlda() */
-/* not actual destructor ... */
-static void _php_ibase_free_xsqlda(XSQLDA *sqlda)
-{
- int i;
- XSQLVAR *var;
-
- IBDEBUG("Free XSQLDA?");
- if (sqlda) {
- IBDEBUG("Freeing XSQLDA...");
- var = sqlda->sqlvar;
- for (i = 0; i < sqlda->sqld; i++, var++) {
- efree(var->sqldata);
- if(var->sqlind)
- efree(var->sqlind);
- }
- efree(sqlda);
- }
-}
-/* }}} */
-
-/* {{{ _php_ibase_commit_link() */
-static void _php_ibase_commit_link(ibase_db_link *link)
-{
- int i;
- IBLS_FETCH();
-
- IBDEBUG("Checking transactions to close...");
- if (link->trans[0] != NULL) { /* commit default */
- IBDEBUG("Committing default transaction...");
- if (isc_commit_transaction(IB_STATUS, &link->trans[0])) {
- _php_ibase_error();
- }
- link->trans[0] = NULL;
- }
- for (i = 1; i < IBASE_TRANS_ON_LINK; i++) {
- if (link->trans[i] != NULL) {
- IBDEBUG("Rolling back other transactions...");
- if (isc_rollback_transaction(IB_STATUS, &link->trans[i])) {
- _php_ibase_error();
- }
- link->trans[i] = NULL;
- }
- }
-}
-/* }}} */
-
-static void php_ibase_commit_link_rsrc(zend_rsrc_list_entry *rsrc)
-{
- ibase_db_link *link = (ibase_db_link *)rsrc->ptr;
- _php_ibase_commit_link(link);
-}
-
-/* {{{ _php_ibase_close_link() */
-static void _php_ibase_close_link(zend_rsrc_list_entry *rsrc)
-{
- ibase_db_link *link = (ibase_db_link *)rsrc->ptr;
- IBLS_FETCH();
-
- _php_ibase_commit_link(link);
- IBDEBUG("Closing normal link...");
- isc_detach_database(IB_STATUS, &link->link);
- IBG(num_links)--;
- efree(link);
-}
-/* }}} */
-
-/* {{{ _php_ibase_close_plink() */
-static void _php_ibase_close_plink(zend_rsrc_list_entry *rsrc)
-{
- ibase_db_link *link = (ibase_db_link *)rsrc->ptr;
- IBLS_FETCH();
-
- _php_ibase_commit_link(link);
- IBDEBUG("Closing permanent link...");
- isc_detach_database(IB_STATUS, &link->link);
- IBG(num_persistent)--;
- IBG(num_links)--;
- free(link);
-}
-/* }}} */
-
-/* {{{ _php_ibase_free_result() */
-static void _php_ibase_free_result(zend_rsrc_list_entry *rsrc)
-{
- ibase_result *ib_result = (ibase_result *)rsrc->ptr;
- IBLS_FETCH();
-
- IBDEBUG("Freeing result...");
- if (ib_result){
- _php_ibase_free_xsqlda(ib_result->out_sqlda);
- if (ib_result->drop_stmt && ib_result->stmt) {
- IBDEBUG("Dropping statement handle (free_result)...");
- if (isc_dsql_free_statement(IB_STATUS, &ib_result->stmt, DSQL_drop)) {
- _php_ibase_error();
- }
- } else {
- /* Shouldn't be here unless query was select and had parameter
- placeholders, in which case ibase_execute handles this???
- (Testing seems to confirm the decision was a right one.)
- */
- IBDEBUG("Closing statement handle...");
- /*
- if (isc_dsql_free_statement(IB_STATUS, &ib_result->stmt, DSQL_close)) {
- _php_ibase_error();
- }
- */
- }
- if (ib_result->out_array) {
- efree(ib_result->out_array);
- }
- efree(ib_result);
- }
-}
-/* }}} */
-
-/* {{{ _php_ibase_free_query() */
-static void _php_ibase_free_query(ibase_query *ib_query)
-{
- IBLS_FETCH();
-
- IBDEBUG("Freeing query...");
- if (ib_query) {
- if (ib_query->in_sqlda) {
- efree(ib_query->in_sqlda);
- }
- if (ib_query->out_sqlda) {
- efree(ib_query->out_sqlda);
- }
- if (ib_query->stmt) {
- IBDEBUG("Dropping statement handle (free_query)...");
- if (isc_dsql_free_statement(IB_STATUS, &ib_query->stmt, DSQL_drop)){
- _php_ibase_error();
- }
- }
- if (ib_query->in_array) {
- efree(ib_query->in_array);
- }
- if (ib_query->out_array) {
- efree(ib_query->out_array);
- }
- efree(ib_query);
- }
-}
-/* }}} */
-
-static void php_ibase_free_query_rsrc(zend_rsrc_list_entry *rsrc)
-{
- ibase_query *query = (ibase_query *)rsrc->ptr;
- _php_ibase_free_query(query);
-}
-
-/* {{{ _php_ibase_free_blob() */
-static void _php_ibase_free_blob(zend_rsrc_list_entry *rsrc)
-{
- ibase_blob_handle *ib_blob = (ibase_blob_handle *)rsrc->ptr;
- IBLS_FETCH();
-
- if (ib_blob->bl_handle != NULL) { /* blob open*/
- if (isc_cancel_blob(IB_STATUS, &ib_blob->bl_handle)) {
- _php_ibase_error();
- }
- }
- efree(ib_blob);
-}
-/* }}} */
-
-/* {{{ _php_ibase_free_trans() */
-static void _php_ibase_free_trans(zend_rsrc_list_entry *rsrc)
-{
- ibase_tr_link *ib_trans = (ibase_tr_link *)rsrc->ptr;
- ibase_db_link *ib_link;
- IBLS_FETCH();
-
- ib_link = (ibase_db_link *) zend_fetch_resource(NULL, ib_trans->link_rsrc, "InterBase link", NULL, 2, le_link, le_plink);
-
- if (ib_link) {
- if (ib_link->trans[ib_trans->trans_num] != NULL) {
- IBDEBUG("Rolling back unhandled transaction...");
- if (isc_rollback_transaction(IB_STATUS, &ib_link->trans[ib_trans->trans_num])) {
- _php_ibase_error();
- }
- ib_link->trans[ib_trans->trans_num] = NULL;
- }
- }
-
- efree(ib_trans);
-}
-/* }}} */
-
-/* {{{ startup, shutdown and info functions */
-PHP_INI_BEGIN()
- STD_PHP_INI_BOOLEAN("ibase.allow_persistent", "1", PHP_INI_SYSTEM, OnUpdateInt, allow_persistent, zend_ibase_globals, ibase_globals)
- STD_PHP_INI_ENTRY_EX("ibase.max_persistent", "-1", PHP_INI_SYSTEM, OnUpdateInt, max_persistent, zend_ibase_globals, ibase_globals, display_link_numbers)
- STD_PHP_INI_ENTRY_EX("ibase.max_links", "-1", PHP_INI_SYSTEM, OnUpdateInt, max_links, zend_ibase_globals, ibase_globals, display_link_numbers)
- STD_PHP_INI_ENTRY("ibase.default_user", NULL, PHP_INI_ALL, OnUpdateString, default_user, zend_ibase_globals, ibase_globals)
- STD_PHP_INI_ENTRY("ibase.default_password", NULL, PHP_INI_ALL, OnUpdateString, default_password, zend_ibase_globals, ibase_globals)
- STD_PHP_INI_ENTRY("ibase.timestampformat", "%m/%d/%Y %H:%M:%S", PHP_INI_ALL, OnUpdateString, cfg_timestampformat, zend_ibase_globals, ibase_globals)
- STD_PHP_INI_ENTRY("ibase.dateformat", "%m/%d/%Y", PHP_INI_ALL, OnUpdateString, cfg_dateformat, zend_ibase_globals, ibase_globals)
- STD_PHP_INI_ENTRY("ibase.timeformat", "%H:%M:%S", PHP_INI_ALL, OnUpdateString, cfg_timeformat, zend_ibase_globals, ibase_globals)
-PHP_INI_END()
-
-static void php_ibase_init_globals(IBLS_D)
-{
- IBG(timestampformat) = NULL;
- IBG(dateformat) = NULL;
- IBG(timeformat) = NULL;
- IBG(errmsg) = NULL;
- IBG(num_persistent) = 0;
-}
-
-PHP_MINIT_FUNCTION(ibase)
-{
- IBLS_FETCH();
-
- ZEND_INIT_MODULE_GLOBALS(ibase, php_ibase_init_globals, NULL);
-
- REGISTER_INI_ENTRIES();
-
- le_result = zend_register_list_destructors_ex(_php_ibase_free_result, NULL, "interbase result", module_number);
- le_query = zend_register_list_destructors_ex(php_ibase_free_query_rsrc, NULL, "interbase query", module_number);
- le_blob = zend_register_list_destructors_ex(_php_ibase_free_blob, NULL, "interbase blob", module_number);
- le_link = zend_register_list_destructors_ex(_php_ibase_close_link, NULL, "interbase link", module_number);
- le_plink = zend_register_list_destructors_ex(php_ibase_commit_link_rsrc, _php_ibase_close_plink, "interbase link persistent", module_number);
- le_trans = zend_register_list_destructors_ex(_php_ibase_free_trans, NULL, "interbase transaction", module_number);
-
- REGISTER_LONG_CONSTANT("IBASE_DEFAULT", PHP_IBASE_DEFAULT, CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("IBASE_TEXT", PHP_IBASE_TEXT, CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("IBASE_UNIXTIME", PHP_IBASE_UNIXTIME, CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("IBASE_READ", PHP_IBASE_READ, CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("IBASE_COMMITTED", PHP_IBASE_COMMITTED, CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("IBASE_CONSISTENCY", PHP_IBASE_CONSISTENCY, CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("IBASE_NOWAIT", PHP_IBASE_NOWAIT, CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("IBASE_TIMESTAMP", PHP_IBASE_TIMESTAMP, CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("IBASE_DATE", PHP_IBASE_DATE, CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("IBASE_TIME", PHP_IBASE_TIME, CONST_PERSISTENT);
-
- return SUCCESS;
-}
-
-
-PHP_RINIT_FUNCTION(ibase)
-{
- IBLS_FETCH();
-
- IBG(default_link)= -1;
- IBG(num_links) = IBG(num_persistent);
-
- if (IBG(timestampformat))
- DL_FREE(IBG(timestampformat));
- IBG(timestampformat) = DL_STRDUP(IBG(cfg_timestampformat));
-
- if (IBG(dateformat))
- DL_FREE(IBG(dateformat));
- IBG(dateformat) = DL_STRDUP(IBG(cfg_dateformat));
-
- if (IBG(timeformat))
- DL_FREE(IBG(timeformat));
- IBG(timeformat) = DL_STRDUP(IBG(cfg_timeformat));
-
- if (IBG(errmsg))
- DL_FREE(IBG(errmsg));
- IBG(errmsg) = DL_MALLOC(sizeof(char)*MAX_ERRMSG+1);
-
- return SUCCESS;
-}
-
-
-PHP_MSHUTDOWN_FUNCTION(ibase)
-{
- UNREGISTER_INI_ENTRIES();
- return SUCCESS;
-}
-
-
-PHP_RSHUTDOWN_FUNCTION(ibase)
-{
- IBLS_FETCH();
-
- if (IBG(timestampformat))
- DL_FREE(IBG(timestampformat));
- IBG(timestampformat) = NULL;
-
- if (IBG(dateformat))
- DL_FREE(IBG(dateformat));
- IBG(dateformat) = NULL;
-
- if (IBG(timeformat))
- DL_FREE(IBG(timeformat));
- IBG(timeformat) = NULL;
-
- if (IBG(errmsg))
- DL_FREE(IBG(errmsg));
- IBG(errmsg) = NULL;
-
- return SUCCESS;
-}
-
-
-PHP_MINFO_FUNCTION(ibase)
-{
- char tmp[32];
- IBLS_FETCH();
-
- php_info_print_table_start();
- php_info_print_table_row(2, "Interbase Support", "enabled");
- php_info_print_table_row(2, "Revision", "$Revision$");
-#ifdef COMPILE_DL_INTERBASE
- php_info_print_table_row(2, "Dynamic Module", "yes");
-#endif
- php_info_print_table_row(2, "Allow Persistent Links", (IBG(allow_persistent)?"Yes":"No") );
-
- if (IBG(max_persistent) == -1) {
- snprintf(tmp, 31, "%ld/unlimited", IBG(num_persistent));
- } else {
- snprintf(tmp, 31, "%ld/%ld", IBG(num_persistent), IBG(max_persistent));
- }
- tmp[31]=0;
- php_info_print_table_row(2, "Persistent Links", tmp );
-
- if (IBG(max_links) == -1) {
- snprintf(tmp, 31, "%ld/unlimited", IBG(num_links));
- } else {
- snprintf(tmp, 31, "%ld/%ld", IBG(num_links), IBG(max_links));
- }
- tmp[31]=0;
- php_info_print_table_row(2, "Total Links", tmp );
-
- php_info_print_table_row(2, "Timestamp Format", IBG(timestampformat) );
- php_info_print_table_row(2, "Date Format", IBG(dateformat) );
- php_info_print_table_row(2, "Time Format", IBG(timeformat) );
-
- php_info_print_table_end();
-}
-/* }}} */
-
-/* {{{ _php_ibase_attach_db() */
-static int _php_ibase_attach_db(char *server, char *uname, char *passwd, char *charset, int buffers, char *role, isc_db_handle *db)
-{
- char dpb_buffer[256], *dpb, *p;
- int dpb_length, len;
- IBLS_FETCH();
-
- dpb = dpb_buffer;
-
- *dpb++ = isc_dpb_version1;
-
- if (uname != NULL && (len = strlen(uname))) {
- *dpb++ = isc_dpb_user_name;
- *dpb++ = len;
- for (p = uname; *p;) {
- *dpb++ = *p++;
- }
- }
-
- if (passwd != NULL && (len = strlen(passwd))) {
- *dpb++ = isc_dpb_password;
- *dpb++ = strlen(passwd);
- for (p = passwd; *p;) {
- *dpb++ = *p++;
- }
- }
-
- if (charset != NULL && (len = strlen(charset))) {
- *dpb++ = isc_dpb_lc_ctype;
- *dpb++ = strlen(charset);
- for (p = charset; *p;) {
- *dpb++ = *p++;
- }
- }
-
- if (buffers) {
- *dpb++ = isc_dpb_num_buffers;
- *dpb++ = 1;
- *dpb++ = buffers;
- }
-
-#ifdef isc_dpb_sql_role_name
- if (role != NULL && (len = strlen(role))) {
- *dpb++ = isc_dpb_sql_role_name;
- *dpb++ = strlen(role);
- for (p = role; *p;) {
- *dpb++ = *p++;
- }
- }
-#endif
-
- dpb_length = dpb - dpb_buffer;
-
- if (isc_attach_database(IB_STATUS, (short) strlen(server), server, db, (short) dpb_length, dpb_buffer)) {
- _php_ibase_error();
- return FAILURE;
- }
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ _php_ibase_connect() */
-static void _php_ibase_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
-{
- pval ***args;
- char *ib_server = NULL, *ib_uname, *ib_passwd, *ib_charset = NULL, *ib_buffers = NULL, *ib_dialect = NULL, *ib_role = NULL;
- int i, ib_uname_len, ib_passwd_len;
- isc_db_handle db_handle = NULL;
- char *hashed_details;
- int hashed_details_length = 0;
- ibase_db_link *ib_link = NULL;
- IBLS_FETCH();
- PLS_FETCH();
-
- RESET_ERRMSG;
-
- ib_uname = IBG(default_user);
- ib_passwd = IBG(default_password);
- ib_uname_len = ib_uname ? strlen(ib_uname) : 0;
- ib_passwd_len = ib_passwd ? strlen(ib_passwd) : 0;
-
- if(ZEND_NUM_ARGS() < 1 || ZEND_NUM_ARGS() > 7){
- WRONG_PARAM_COUNT;
- }
-
- args = (pval ***) emalloc(sizeof(pval **)*ZEND_NUM_ARGS());
- if (zend_get_parameters_array_ex(ZEND_NUM_ARGS(), args) == FAILURE) {
- efree(args);
- RETURN_FALSE;
- }
-
- switch(ZEND_NUM_ARGS()) {
- case 7:
- convert_to_string_ex(args[6]);
- ib_role = (*args[6])->value.str.val;
- hashed_details_length += (*args[6])->value.str.len;
- /* fallout */
- case 6:
- convert_to_string_ex(args[5]);
- ib_dialect = (*args[5])->value.str.val;
- hashed_details_length += (*args[5])->value.str.len;
- /* fallout */
- case 5:
- convert_to_string_ex(args[4]);
- ib_buffers = (*args[4])->value.str.val;
- hashed_details_length += (*args[4])->value.str.len;
- /* fallout */
- case 4:
- convert_to_string_ex(args[3]);
- ib_charset = (*args[3])->value.str.val;
- hashed_details_length += (*args[3])->value.str.len;
- /* fallout */
- case 3:
- convert_to_string_ex(args[2]);
- ib_passwd = (*args[2])->value.str.val;
- hashed_details_length += (*args[2])->value.str.len;
- /* fallout */
- case 2:
- convert_to_string_ex(args[1]);
- ib_uname = (*args[1])->value.str.val;
- hashed_details_length += (*args[1])->value.str.len;
- /* fallout */
- case 1:
- convert_to_string_ex(args[0]);
- ib_server = (*args[0])->value.str.val;
- hashed_details_length += (*args[0])->value.str.len;
- } /* case */
-
- efree(args);
-
- hashed_details = (char *) emalloc(hashed_details_length+strlen("ibase_%s_%s_%s_%s_%s_%s_%s")+1);
- sprintf(hashed_details, "ibase_%s_%s_%s_%s_%s_%s_%s", SAFE_STRING(ib_server), SAFE_STRING(ib_uname), SAFE_STRING(ib_passwd), SAFE_STRING(ib_charset), SAFE_STRING(ib_buffers), SAFE_STRING(ib_dialect), SAFE_STRING(ib_role));
-
- if (persistent) {
- list_entry *le;
- int open_new_connection = 1;
-
- if (zend_hash_find(&EG(persistent_list), hashed_details, hashed_details_length+1, (void **) &le) != FAILURE) {
- char tmp_1[] = {isc_info_base_level, isc_info_end};
- char tmp_2[8]; /* Enough? Hope so... */
-
- if (le->type != le_plink) {
- RETURN_FALSE;
- }
- /* Check if connection has timed out */
- ib_link = (ibase_db_link *) le->ptr;
- if (!isc_database_info(IB_STATUS, &ib_link->link, sizeof(tmp_1), tmp_1, sizeof(tmp_2), tmp_2)) {
- open_new_connection = 0;
- }
- }
-
- /* There was no previous connection to use or it has timed out */
- if (open_new_connection) {
- list_entry new_le;
-
- if ((IBG(max_links) != -1) && (IBG(num_links) >= IBG(max_links))) {
- _php_ibase_module_error("Too many open links (%d)", IBG(num_links));
- efree(hashed_details);
- RETURN_FALSE;
- }
- if ((IBG(max_persistent) != -1) && (IBG(num_persistent) >= IBG(max_persistent))) {
- _php_ibase_module_error("Too many open persistent links (%d)", IBG(num_persistent));
- efree(hashed_details);
- RETURN_FALSE;
- }
-
- /* create the ib_link */
-
- if (_php_ibase_attach_db(ib_server, ib_uname, ib_passwd, ib_charset,
- (ib_buffers ? strtoul(ib_buffers, NULL, 0) : 0),
- ib_role, &db_handle) == FAILURE) {
- efree(hashed_details);
- RETURN_FALSE;
- }
-
- ib_link = (ibase_db_link *) malloc(sizeof(ibase_db_link));
- ib_link->link = db_handle;
- ib_link->dialect = (ib_dialect ? (unsigned short) strtoul(ib_dialect, NULL, 10) : SQL_DIALECT_CURRENT);
- for (i = 0; i < IBASE_TRANS_ON_LINK; i++)
- ib_link->trans[i] = NULL;
-
- /* hash it up */
- new_le.type = le_plink;
- new_le.ptr = ib_link;
- if (zend_hash_update(&EG(persistent_list), hashed_details, hashed_details_length+1, (void *) &new_le, sizeof(list_entry), NULL)==FAILURE) {
- efree(hashed_details);
- free(ib_link);
- RETURN_FALSE;
- }
- IBG(num_links)++;
- IBG(num_persistent)++;
- }
-
- ZEND_REGISTER_RESOURCE(return_value, ib_link, le_plink);
-
- } else {
- list_entry *index_ptr, new_index_ptr;
-
- /* first we check the hash for the hashed_details key. if it exists,
- * it should point us to the right offset where the actual ib_link sits.
- * if it doesn't, open a new ib_link, add it to the resource list,
- * and add a pointer to it with hashed_details as the key.
- */
- if (zend_hash_find(&EG(regular_list), hashed_details, hashed_details_length+1, (void **) &index_ptr)==SUCCESS) {
- int type,xlink;
- void *ptr;
- if (index_ptr->type != le_index_ptr) {
- RETURN_FALSE;
- }
- xlink = (int) index_ptr->ptr;
- ptr = zend_list_find(xlink, &type); /* check if the xlink is still there */
- if (ptr && (type==le_link || type==le_plink)) {
- zend_list_addref(xlink);
- return_value->value.lval = xlink;
- return_value->type = IS_RESOURCE;
- IBG(default_link) = return_value->value.lval;
- efree(hashed_details);
- return;
- } else {
- zend_hash_del(&EG(regular_list), hashed_details, hashed_details_length+1);
- }
- }
- if ((IBG(max_links) != -1) && (IBG(num_links) >= IBG(max_links))) {
- _php_ibase_module_error("Too many open links (%d)", IBG(num_links));
- efree(hashed_details);
- RETURN_FALSE;
- }
- /* create the ib_link */
-
- if (_php_ibase_attach_db(ib_server, ib_uname, ib_passwd, ib_charset,
- (ib_buffers ? strtoul(ib_buffers, NULL, 0) : 0),
- ib_role, &db_handle) == FAILURE) {
- efree(hashed_details);
- RETURN_FALSE;
- }
-
- ib_link = (ibase_db_link *) emalloc(sizeof(ibase_db_link));
- ib_link->link = db_handle;
- ib_link->dialect = (ib_dialect ? (unsigned short) strtoul(ib_dialect, NULL, 10) : SQL_DIALECT_CURRENT);
- for (i = 0; i < IBASE_TRANS_ON_LINK; i++)
- ib_link->trans[i] = NULL;
-
- ZEND_REGISTER_RESOURCE(return_value, ib_link, le_link);
-
- /* add it to the hash */
- new_index_ptr.ptr = (void *) return_value->value.lval;
- new_index_ptr.type = le_index_ptr;
- if (zend_hash_update(&EG(regular_list), hashed_details, hashed_details_length+1, (void *) &new_index_ptr, sizeof(list_entry), NULL)==FAILURE) {
- efree(hashed_details);
- RETURN_FALSE;
- }
- IBG(num_links)++;
- }
- efree(hashed_details);
- zend_list_addref(return_value->value.lval);
- IBG(default_link) = return_value->value.lval;
-}
-/* }}} */
-
-/* {{{ proto int ibase_connect(string database [, string username] [, string password] [, string charset] [, int buffers] [, int dialect] [, string role])
- Open a connection to an InterBase database */
-PHP_FUNCTION(ibase_connect)
-{
- _php_ibase_connect(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-/* }}} */
-
-/* {{{ proto int ibase_pconnect(string database [, string username] [, string password] [, string charset] [, int buffers] [, int dialect] [, string role])
- Open a persistent connection to an InterBase database */
-PHP_FUNCTION(ibase_pconnect)
-{
- _php_ibase_connect(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
-}
-/* }}} */
-
-/* {{{ proto int ibase_close([int link_identifier])
- Close an InterBase connection */
-PHP_FUNCTION(ibase_close)
-{
- zval **link_arg;
- ibase_db_link *ib_link;
- int link_id;
- IBLS_FETCH();
-
- RESET_ERRMSG;
-
- switch (ZEND_NUM_ARGS()) {
- case 0:
- link_id = IBG(default_link);
- break;
- case 1:
- if (zend_get_parameters_ex(1, &link_arg) == FAILURE) {
- RETURN_FALSE;
- }
- convert_to_long_ex(link_arg);
- link_id = (*link_arg)->value.lval;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- ZEND_FETCH_RESOURCE2(ib_link, ibase_db_link *, link_arg, link_id, "InterBase link", le_link, le_plink);
- zend_list_delete(link_id);
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ _php_ibase_alloc_array() */
-static int _php_ibase_alloc_array(ibase_array **ib_arrayp, int *array_cntp,
- XSQLDA *sqlda, isc_db_handle link, isc_tr_handle trans)
-{
-#define IB_ARRAY (*ib_arrayp)
-
- int i, dim, ar_cnt, ar_length;
- XSQLVAR *var;
- IBLS_FETCH();
-
- IB_ARRAY = NULL;
-
- ar_cnt = 0; /* find arrays */
- var = sqlda->sqlvar;
- for (i = 0; i < sqlda->sqld; i++, var++) {
- if ((var->sqltype & ~1) == SQL_ARRAY)
- ar_cnt++;
- }
-
- if (ar_cnt) { /* have arrays ? */
-
- *array_cntp = ar_cnt;
- IB_ARRAY = emalloc(sizeof(ibase_array)*ar_cnt);
- ar_cnt = 0;
- var = sqlda->sqlvar;
- for (i = 0; i < sqlda->sqld; i++, var++) {
- if ((var->sqltype & ~1) == SQL_ARRAY) {
-
- ISC_ARRAY_DESC *ar_desc = &IB_ARRAY[ar_cnt].ar_desc;
-
- if (isc_array_lookup_bounds(IB_STATUS, &link, &trans,
- var->relname, var->sqlname, ar_desc)) {
- _php_ibase_error();
- efree(IB_ARRAY);
- IB_ARRAY = NULL;
- return FAILURE;
- }
-
- switch (ar_desc->array_desc_dtype) {
- case blr_text:
- case blr_text2:
- IB_ARRAY[ar_cnt].el_type = SQL_TEXT;
- IB_ARRAY[ar_cnt].el_size = ar_desc->array_desc_length+1;
- break;
- case blr_short:
- IB_ARRAY[ar_cnt].el_type = SQL_SHORT;
- IB_ARRAY[ar_cnt].el_size = sizeof(short);
- break;
- case blr_long:
- IB_ARRAY[ar_cnt].el_type = SQL_LONG;
- IB_ARRAY[ar_cnt].el_size = sizeof(long);
- break;
- case blr_float:
- IB_ARRAY[ar_cnt].el_type = SQL_FLOAT;
- IB_ARRAY[ar_cnt].el_size = sizeof(float);
- break;
- case blr_double:
- IB_ARRAY[ar_cnt].el_type = SQL_DOUBLE;
- IB_ARRAY[ar_cnt].el_size = sizeof(double);
- break;
- case blr_date:
- IB_ARRAY[ar_cnt].el_type = SQL_DATE;
- IB_ARRAY[ar_cnt].el_size = sizeof(ISC_QUAD);
- break;
- case blr_varying:
- case blr_varying2: /* changed to SQL_TEXT ? */
- /* sql_type = SQL_VARYING; Why? FIXME: ??? */
- IB_ARRAY[ar_cnt].el_type = SQL_TEXT;
- IB_ARRAY[ar_cnt].el_size = ar_desc->array_desc_length+sizeof(short);
- break;
- default:
- _php_ibase_module_error("unexpected array type %d in relation '%s' column '%s')",
- ar_desc->array_desc_dtype,var->relname, var->sqlname);
- efree(IB_ARRAY);
- IB_ARRAY = NULL;
- return FAILURE;
- } /* switch array_desc_type */
-
- ar_length = 0; /* calculate elements count */
- for (dim = 0; dim < ar_desc->array_desc_dimensions; dim++) {
- ar_length += 1 + ar_desc->array_desc_bounds[dim].array_bound_upper
- - ar_desc->array_desc_bounds[dim].array_bound_lower;
- }
- IB_ARRAY[ar_cnt].ar_size = IB_ARRAY[ar_cnt].el_size * ar_length;
-
- ar_cnt++;
-
- } /* if SQL_ARRAY */
- } /* for column */
- } /* if array_cnt */
-
- return SUCCESS;
-#undef IB_ARRAY
-}
-/* }}} */
-
-/* {{{ _php_ibase_alloc_query() */
-/* allocate and prepare query */
-static int _php_ibase_alloc_query(ibase_query **ib_queryp, isc_db_handle link, isc_tr_handle trans, char *query, unsigned short dialect)
-{
-#define IB_QUERY (*ib_queryp)
- IBLS_FETCH();
-
- IB_QUERY = emalloc(sizeof(ibase_query));
- IB_QUERY->link = link;
- IB_QUERY->trans = trans;
- IB_QUERY->stmt = NULL;
- IB_QUERY->out_sqlda = NULL;
- IB_QUERY->in_sqlda = NULL;
- IB_QUERY->in_array = NULL;
- IB_QUERY->in_array_cnt = 0;
- IB_QUERY->out_array = NULL;
- IB_QUERY->out_array_cnt = 0;
- IB_QUERY->dialect = dialect;
-
- if (isc_dsql_allocate_statement(IB_STATUS, &link, &IB_QUERY->stmt)) {
- _php_ibase_error();
- goto _php_ibase_alloc_query_error;
- }
-
- IB_QUERY->out_sqlda = (XSQLDA *) emalloc(XSQLDA_LENGTH(0));
- IB_QUERY->out_sqlda->sqln = 0;
- IB_QUERY->out_sqlda->version = SQLDA_VERSION1;
-
- if (isc_dsql_prepare(IB_STATUS, &IB_QUERY->trans, &IB_QUERY->stmt, 0, query, dialect, IB_QUERY->out_sqlda)) {
- _php_ibase_error();
- goto _php_ibase_alloc_query_error;
- }
-
- /* not enough output variables ? */
- if (IB_QUERY->out_sqlda->sqld > IB_QUERY->out_sqlda->sqln) {
- IB_QUERY->out_sqlda = erealloc(IB_QUERY->out_sqlda,XSQLDA_LENGTH(IB_QUERY->out_sqlda->sqld));
- IB_QUERY->out_sqlda->sqln = IB_QUERY->out_sqlda->sqld;
- IB_QUERY->out_sqlda->version = SQLDA_VERSION1;
- if (isc_dsql_describe(IB_STATUS, &IB_QUERY->stmt, SQLDA_VERSION1, IB_QUERY->out_sqlda)) {
- _php_ibase_error();
- goto _php_ibase_alloc_query_error;
- }
- }
-
- /* maybe have input placeholders? */
- IB_QUERY->in_sqlda = emalloc(XSQLDA_LENGTH(0));
- IB_QUERY->in_sqlda->sqln = 0;
- IB_QUERY->in_sqlda->version = SQLDA_VERSION1;
- if (isc_dsql_describe_bind(IB_STATUS, &IB_QUERY->stmt, SQLDA_VERSION1, IB_QUERY->in_sqlda)) {
- _php_ibase_error();
- goto _php_ibase_alloc_query_error;
- }
-
- /* not enough input variables ? */
- if (IB_QUERY->in_sqlda->sqln < IB_QUERY->in_sqlda->sqld) {
- IB_QUERY->in_sqlda = erealloc(IB_QUERY->in_sqlda,XSQLDA_LENGTH(IB_QUERY->in_sqlda->sqld));
- IB_QUERY->in_sqlda->sqln = IB_QUERY->in_sqlda->sqld;
- IB_QUERY->in_sqlda->version = SQLDA_VERSION1;
- if (isc_dsql_describe_bind(IB_STATUS, &IB_QUERY->stmt, SQLDA_VERSION1, IB_QUERY->in_sqlda)) {
- _php_ibase_error();
- goto _php_ibase_alloc_query_error;
- }
- }
-
- /* allocate arrays... */
- if (_php_ibase_alloc_array(&IB_QUERY->in_array, &IB_QUERY->in_array_cnt,
- IB_QUERY->in_sqlda, link, trans) == FAILURE) {
- goto _php_ibase_alloc_query_error; /* error report already done */
- }
-
- if (_php_ibase_alloc_array(&IB_QUERY->out_array, &IB_QUERY->out_array_cnt,
- IB_QUERY->out_sqlda, link, trans) == FAILURE) {
- goto _php_ibase_alloc_query_error;
- }
-
- /* no, haven't placeholders at all */
- if (IB_QUERY->in_sqlda->sqld == 0) {
- efree(IB_QUERY->in_sqlda);
- IB_QUERY->in_sqlda = NULL;
- }
-
- if (IB_QUERY->out_sqlda->sqld == 0) {
- efree(IB_QUERY->out_sqlda);
- IB_QUERY->out_sqlda = NULL;
- }
-
- return SUCCESS;
-
-_php_ibase_alloc_query_error:
-
- if (IB_QUERY->out_sqlda)
- efree(IB_QUERY->out_sqlda);
- if (IB_QUERY->in_sqlda)
- efree(IB_QUERY->in_sqlda);
- if (IB_QUERY->out_array)
- efree(IB_QUERY->out_array);
- efree(IB_QUERY);
- IB_QUERY = NULL;
-
- return FAILURE;
-#undef IB_QUERY
-}
-/* }}} */
-
-/* {{{ _php_ibase_bind()
- Bind parameter placeholders in a previously prepared query */
-static int _php_ibase_bind(XSQLDA *sqlda, pval **b_vars, BIND_BUF *buf)
-{
- XSQLVAR *var;
- pval *b_var;
- int i;
-
- var = sqlda->sqlvar;
- for (i = 0; i < sqlda->sqld; var++, i++) { /* binded vars */
-
- buf[i].sqlind = 0;
- var->sqlind = &buf[i].sqlind;
- b_var = b_vars[i];
-
- switch(var->sqltype & ~1) {
- case SQL_TEXT: /* direct to variable */
- case SQL_VARYING:
- convert_to_string(b_var);
- var->sqldata = (void ISC_FAR *)b_var->value.str.val;
- var->sqllen = b_var->value.str.len;
- var->sqltype = SQL_TEXT + (var->sqltype & 1);
- break;
- case SQL_SHORT:
- convert_to_long(b_var);
- if (b_var->value.lval > SHRT_MAX || b_var->value.lval < SHRT_MIN) {
- _php_ibase_module_error("field %*s overflow", var->aliasname_length, var->aliasname);
- return FAILURE;
- }
- buf[i].val.sval = (short)b_var->value.lval;
- var->sqldata = (void ISC_FAR *)(&buf[i].val.sval);
- break;
- case SQL_LONG:
- if (var->sqlscale < 0) {
- /*
- DECIMAL or NUMERIC field stored internally as scaled integer.
- Coerce it to string and let InterBase's internal routines
- handle it.
- */
- convert_to_string(b_var);
- var->sqldata = (void ISC_FAR *)b_var->value.str.val;
- var->sqllen = b_var->value.str.len;
- var->sqltype = SQL_TEXT;
- } else {
- convert_to_long(b_var);
- var->sqldata = (void ISC_FAR *)(&b_var->value.lval);
- }
- break;
- case SQL_FLOAT:
- convert_to_double(b_var);
- buf[i].val.fval = (float)b_var->value.dval;
- var->sqldata = (void ISC_FAR *)(&buf[i].val.fval);
- break;
- case SQL_DOUBLE: /* direct to variable */
- convert_to_double(b_var);
- var->sqldata = (void ISC_FAR *)(&b_var->value.dval);
- break;
-#ifdef SQL_INT64
- case SQL_INT64:
- /*
- Just let InterBase's internal routines handle it.
- Besides, it might even have originally been a string
- to avoid rounding errors...
- */
- convert_to_string(b_var);
- var->sqldata = (void ISC_FAR *)b_var->value.str.val;
- var->sqllen = b_var->value.str.len;
- var->sqltype = SQL_TEXT;
- break;
-#endif
-#ifndef SQL_TIMESTAMP
- case SQL_DATE:
-#else
- case SQL_TIMESTAMP:
- case SQL_TYPE_DATE:
- case SQL_TYPE_TIME:
-#endif
-#ifndef HAVE_STRPTIME
-#ifndef SQL_TIMESTAMP
- /* Parsing doesn't seem to happen with older versions... */
- {
- struct tm t;
- int n;
-
- t.tm_year = t.tm_mon = t.tm_mday = t.tm_hour =
- t.tm_min = t.tm_sec = 0;
-
- convert_to_string(b_var);
-
- n = sscanf(b_var->value.str.val,"%d%*[/]%d%*[/]%d %d%*[:]%d%*[:]%d",
- &t.tm_mon, &t.tm_mday, &t.tm_year, &t.tm_hour, &t.tm_min, &t.tm_sec);
- if(n != 3 && n != 6){
- _php_ibase_module_error("invalid date/time format");
- return FAILURE;
- }
- t.tm_year -= 1900;
- t.tm_mon--;
- isc_encode_date(&t, &buf[i].val.qval);
- var->sqldata = (void ISC_FAR *)(&buf[i].val.qval);
- }
-#else
- /*
- Once again, InterBase's internal parsing routines
- seems to be a good solution... Might change this on
- platforms that have strptime()? Code is there and works,
- but the functions existence is not yet tested...
- ask Sascha?
- */
- convert_to_string(b_var);
- var->sqldata = (void ISC_FAR *)b_var->value.str.val;
- var->sqllen = b_var->value.str.len;
- var->sqltype = SQL_TEXT;
-#endif
-#else
- {
- struct tm t;
-
- convert_to_string(b_var);
-#ifndef SQL_TIMESTAMP
- strptime(b_var->value.str.val, IBG(timestampformat), &t);
- isc_encode_date(&t, &buf[i].val.qval);
- var->sqldata = (void ISC_FAR *)(&buf[i].val.qval);
-#else
- switch (var->sqltype & ~1) {
- case SQL_TIMESTAMP:
- strptime(b_var->value.str.val, IBG(timestampformat), &t);
- isc_encode_timestamp(&t, &buf[i].val.tsval);
- var->sqldata = (void ISC_FAR *)(&buf[i].val.tsval);
- break;
- case SQL_TYPE_DATE:
- strptime(b_var->value.str.val, IBG(dateformat), &t);
- isc_encode_sql_date(&t, &buf[i].val.dtval);
- var->sqldata = (void ISC_FAR *)(&buf[i].val.dtval);
- break;
- case SQL_TYPE_TIME:
- strptime(b_var->value.str.val, IBG(timeformat), &t);
- isc_encode_sql_time(&t, &buf[i].val.tmval);
- var->sqldata = (void ISC_FAR *)(&buf[i].val.tmval);
- break;
- }
-#endif
- }
-#endif
- break;
- case SQL_BLOB:
- {
- ibase_blob_handle *ib_blob_id;
- if (b_var->type != IS_STRING
- || b_var->value.str.len != sizeof(ibase_blob_handle)
- || ((ibase_blob_handle *)(b_var->value.str.val))->bl_handle != 0) {
- _php_ibase_module_error("invalid blob id string");
- return FAILURE;
- }
- ib_blob_id = (ibase_blob_handle *)b_var->value.str.val;
-
- var->sqldata = (void ISC_FAR *)&ib_blob_id->bl_qd;
- }
- break;
- case SQL_ARRAY:
- _php_ibase_module_error("binding arrays not supported yet");
- return FAILURE;
- break;
- } /*switch*/
- } /*for*/
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ _php_ibase_alloc_xsqlda() */
-static void _php_ibase_alloc_xsqlda(XSQLDA *sqlda)
-{
- int i;
- XSQLVAR *var = sqlda->sqlvar;
-
-
- for (i = 0; i < sqlda->sqld; i++, var++) {
- switch(var->sqltype & ~1) {
- case SQL_TEXT:
- var->sqldata = emalloc(sizeof(char)*(var->sqllen));
- break;
- case SQL_VARYING:
- var->sqldata = emalloc(sizeof(char)*(var->sqllen+sizeof(short)));
- break;
- case SQL_SHORT:
- var->sqldata = emalloc(sizeof(short));
- break;
- case SQL_LONG:
- var->sqldata = emalloc(sizeof(long));
- break;
- case SQL_FLOAT:
- var->sqldata = emalloc(sizeof(float));
- break;
- case SQL_DOUBLE:
- var->sqldata = emalloc(sizeof(double));
- break;
-#ifdef SQL_INT64
- case SQL_INT64:
- var->sqldata = emalloc(sizeof(ISC_INT64));
- break;
-#endif
-#ifdef SQL_TIMESTAMP
- case SQL_TIMESTAMP:
- var->sqldata = emalloc(sizeof(ISC_TIMESTAMP));
- break;
- case SQL_TYPE_DATE:
- var->sqldata = emalloc(sizeof(ISC_DATE));
- break;
- case SQL_TYPE_TIME:
- var->sqldata = emalloc(sizeof(ISC_TIME));
- break;
-#else
- case SQL_DATE:
-#endif
- case SQL_BLOB:
- case SQL_ARRAY:
- var->sqldata = emalloc(sizeof(ISC_QUAD));
- break;
- } /*switch*/
- if (var->sqltype & 1) /* sql NULL flag */
- var->sqlind = emalloc(sizeof(short));
- else
- var->sqlind = NULL;
- } /* for*/
-}
-/* }}} */
-
-/* {{{ _php_ibase_exec() */
-static int _php_ibase_exec(ibase_result **ib_resultp, ibase_query *ib_query, int argc, pval **args)
-{
-#define IB_RESULT (*ib_resultp)
- XSQLDA *in_sqlda = NULL, *out_sqlda = NULL;
- BIND_BUF *bind_buf = NULL;
- int rv = FAILURE;
- IBLS_FETCH();
-
- IB_RESULT = NULL;
-
- /* allocate sqlda and output buffers */
- if (ib_query->out_sqlda) { /* output variables in select, select for update */
- IBDEBUG("Query wants XSQLDA for output");
- IB_RESULT = emalloc(sizeof(ibase_result));
- IB_RESULT->link = ib_query->link;
- IB_RESULT->trans = ib_query->trans;
- IB_RESULT->stmt = ib_query->stmt;
- IB_RESULT->drop_stmt = 0; /* when free result close but not drop!*/
-
- out_sqlda = IB_RESULT->out_sqlda = emalloc(XSQLDA_LENGTH(ib_query->out_sqlda->sqld));
- memcpy(out_sqlda,ib_query->out_sqlda,XSQLDA_LENGTH(ib_query->out_sqlda->sqld));
- _php_ibase_alloc_xsqlda(out_sqlda);
-
- if (ib_query->out_array) {
- IB_RESULT->out_array = emalloc(sizeof(ibase_array)*ib_query->out_array_cnt);
- memcpy(IB_RESULT->out_array, ib_query->out_array, sizeof(ibase_array)*ib_query->out_array_cnt);
- } else {
- IB_RESULT->out_array = NULL;
- }
- }
-
- if (ib_query->in_sqlda) { /* has placeholders */
- IBDEBUG("Query wants XSQLDA for input");
- if (ib_query->in_sqlda->sqld != argc) {
- _php_ibase_module_error("placeholders (%d) and variables (%d) mismatch", ib_query->in_sqlda->sqld, argc);
- goto _php_ibase_exec_error; /* yes mommy, goto! */
- }
- in_sqlda = emalloc(XSQLDA_LENGTH(ib_query->in_sqlda->sqld));
- memcpy(in_sqlda, ib_query->in_sqlda, XSQLDA_LENGTH(ib_query->in_sqlda->sqld));
- bind_buf = emalloc(sizeof(BIND_BUF) * ib_query->in_sqlda->sqld);
- if (_php_ibase_bind(in_sqlda, args, bind_buf) == FAILURE) {
- IBDEBUG("Could not bind input XSQLDA... (_php_ibase_exec)");
- goto _php_ibase_exec_error;
- }
- }
-
- if (isc_dsql_execute(IB_STATUS, &ib_query->trans, &ib_query->stmt, ib_query->dialect, in_sqlda)) {
- IBDEBUG("Could not execute query... (_php_ibase_exec)");
- _php_ibase_error();
- goto _php_ibase_exec_error;
- }
-
- rv = SUCCESS;
-
-_php_ibase_exec_error: /* I'm a bad boy... */
-
- if (in_sqlda){
- efree(in_sqlda);
- }
- if (bind_buf)
- efree(bind_buf);
-
- if (rv == FAILURE) {
- if (IB_RESULT) {
- efree(IB_RESULT);
- IB_RESULT = NULL;
- }
- if (out_sqlda)
- _php_ibase_free_xsqlda(out_sqlda);
- }
-
- return rv;
-#undef IB_RESULT
-}
-/* }}} */
-
-/* {{{ proto int ibase_trans([int trans_args [, int link_identifier]])
- Start transaction */
-PHP_FUNCTION(ibase_trans)
-{
- pval ***args;
- char tpb[20], *tpbp = NULL;
- long trans_argl = 0;
- int tpb_len = 0, argn, link_id, trans_n = 0, i;
- ibase_db_link *ib_link;
- ibase_tr_link *ib_trans;
- IBLS_FETCH();
-
- RESET_ERRMSG;
-
- link_id = IBG(default_link);
-
- /* TODO: multi-databases trans */
- argn = ZEND_NUM_ARGS();
- if (argn < 0 || argn > 20) {
- WRONG_PARAM_COUNT;
- }
-
- if (argn) {
- args = (pval ***) emalloc(sizeof(pval **)*argn);
- if (zend_get_parameters_array_ex(argn, args) == FAILURE) {
- efree(args);
- RETURN_FALSE;
- }
-
- /* Handle all database links, although we don't support multibase
- transactions yet, so only the last one is will be used. */
- for (i = argn-1; i > 0 && Z_TYPE_PP(args[i]) == IS_RESOURCE; i--) {
- ZEND_FETCH_RESOURCE2(ib_link, ibase_db_link *, args[i], -1, "InterBase link", le_link, le_plink);
- link_id = Z_LVAL_PP(args[i]);
- }
-
- /* First argument is transaction parameters */
- convert_to_long_ex(args[0]);
- trans_argl = (*args[0])->value.lval;
-
- efree(args);
- }
-
- if (argn < 2) {
- ZEND_FETCH_RESOURCE2(ib_link, ibase_db_link *, NULL, link_id, "InterBase link", le_link, le_plink);
- }
-
- if (trans_argl ) {
- tpb[tpb_len++] = isc_tpb_version3;
- tpbp = tpb;
- /* access mode */
- if (trans_argl & PHP_IBASE_READ) /* READ ONLY TRANSACTION */
- tpb[tpb_len++] = isc_tpb_read;
- else
- tpb[tpb_len++] = isc_tpb_write;
- /* isolation level */
- if (trans_argl & PHP_IBASE_COMMITTED) {
- tpb[tpb_len++] = isc_tpb_read_committed;
- } else if (trans_argl & PHP_IBASE_CONSISTENCY)
- tpb[tpb_len++] = isc_tpb_consistency;
- else
- tpb[tpb_len++] = isc_tpb_concurrency;
- /* lock resolution */
- if (trans_argl & PHP_IBASE_NOWAIT)
- tpb[tpb_len++] = isc_tpb_nowait;
- else
- tpb[tpb_len++] = isc_tpb_wait;
-
- }
-
- /* find empty transaction slot */
- for (trans_n = 0; trans_n < IBASE_TRANS_ON_LINK
- && ib_link->trans[trans_n]; trans_n++)
- ;
- if (trans_n == IBASE_TRANS_ON_LINK) {
- _php_ibase_module_error("too many transactions on link");
- RETURN_FALSE;
- }
-
- if (isc_start_transaction(IB_STATUS, &ib_link->trans[trans_n], 1, &ib_link->link, tpb_len, tpbp)) {
- _php_ibase_error();
- RETURN_FALSE;
- }
-
- ib_trans = (ibase_tr_link *) emalloc(sizeof(ibase_tr_link));
- ib_trans->trans_num = trans_n;
- ib_trans->link_rsrc = link_id;
- ZEND_REGISTER_RESOURCE(return_value, ib_trans, le_trans);
-}
-/* }}} */
-
-/* {{{ _php_ibase_def_trans() */
-/* open default transaction */
-static int _php_ibase_def_trans(ibase_db_link * ib_link, int trans_n)
-{
- IBLS_FETCH();
-
- if (trans_n == 0 && ib_link->trans[0] == NULL) {
- if (isc_start_transaction(IB_STATUS, &ib_link->trans[0], 1, &ib_link->link, 0, NULL)) {
- _php_ibase_error();
- return FAILURE;
- }
- }
- return SUCCESS;
-}
-/*}}}*/
-
-/* {{{ _php_ibase_trans_end() */
-#define COMMIT 1
-#define ROLLBACK 0
-static void _php_ibase_trans_end(INTERNAL_FUNCTION_PARAMETERS, int commit)
-{
- pval **link_trans_arg = NULL;
- int link_id = 0, trans_n = 0, trans_id = 0;
- ibase_db_link *ib_link;
- IBLS_FETCH();
-
- RESET_ERRMSG;
-
- switch (ZEND_NUM_ARGS()) {
- case 0:
- link_id = IBG(default_link);
- ZEND_FETCH_RESOURCE2(ib_link, ibase_db_link *, link_trans_arg, link_id, "InterBase link", le_link, le_plink);
- break;
- case 1:
- if (zend_get_parameters_ex(1, &link_trans_arg) == FAILURE) {
- RETURN_FALSE;
- }
- get_link_trans(INTERNAL_FUNCTION_PARAM_PASSTHRU, link_trans_arg, &ib_link, &trans_n, &trans_id);
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- if (ib_link->trans[trans_n] == NULL) {
- php_error(E_WARNING, "Trying to commit or rollback an already handled transaction");
- RETURN_FALSE;
- }
-
- if (commit) {
- if (isc_commit_transaction(IB_STATUS, &ib_link->trans[trans_n])) {
- _php_ibase_error();
- RETURN_FALSE;
- }
- } else {
- if (isc_rollback_transaction(IB_STATUS, &ib_link->trans[trans_n])) {
- _php_ibase_error();
- RETURN_FALSE;
- }
- }
- ib_link->trans[trans_n] = NULL;
-
- /* Don't try to destroy imnplicitly opened transaction from list... */
- if (trans_id) {
- zend_list_delete(trans_id);
- }
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int ibase_commit([int link_identifier,] int trans_number)
- Commit transaction */
-PHP_FUNCTION(ibase_commit)
-{
- _php_ibase_trans_end(INTERNAL_FUNCTION_PARAM_PASSTHRU, COMMIT);
-}
-/* }}} */
-
-/* {{{ proto int ibase_rollback([int link_identifier,] int trans_number)
- Roolback transaction */
-PHP_FUNCTION(ibase_rollback)
-{
- _php_ibase_trans_end(INTERNAL_FUNCTION_PARAM_PASSTHRU, ROLLBACK);
-}
-/* }}} */
-
-/* {{{ proto int ibase_query([int link_identifier,] string query [, int bind_args])
- Execute a query */
-PHP_FUNCTION(ibase_query)
-{
- pval ***args, **bind_args = NULL, **dummy = NULL;
- int i, link_id = 0, trans_n = 0, bind_n = 0, trans_id = 0;
- char *query;
- ibase_db_link *ib_link;
- ibase_query *ib_query;
- ibase_result *ib_result;
- IBLS_FETCH();
-
- RESET_ERRMSG;
-
- if (ZEND_NUM_ARGS() < 1) {
- WRONG_PARAM_COUNT;
- }
-
- args = (pval ***) emalloc(sizeof(pval **)*ZEND_NUM_ARGS());
- if (zend_get_parameters_array_ex(ZEND_NUM_ARGS(), args) == FAILURE) {
- efree(args);
- RETURN_FALSE;
- }
-
- i = 0;
- if ((*args[i])->type == IS_RESOURCE) { /* link or transaction argument */
- get_link_trans(INTERNAL_FUNCTION_PARAM_PASSTHRU, args[i], &ib_link, &trans_n, &trans_id);
- i++; /* next arg */
- } else {
- link_id = IBG(default_link);
- ZEND_FETCH_RESOURCE2(ib_link, ibase_db_link *, dummy, link_id, "InterBase link", le_link, le_plink);
- }
-
- if ((*args[i])->type == IS_STRING) { /* query argument */
- convert_to_string_ex(args[i]);
- query = (*args[i])->value.str.val;
- i++; /* next arg */
- } else {
- _php_ibase_module_error("query argument missed");
- efree(args);
- RETURN_FALSE;
- }
-
- if (ZEND_NUM_ARGS() > i) { /* have variables to bind */
- /* XXX Remove or fix??? Variable placeholders and binding makes
- absolutely no sense if not using a prepared SQL statement.
- */
- bind_n = ZEND_NUM_ARGS() - i;
- bind_args = args[i];
- }
-
- /* open default transaction */
- if (_php_ibase_def_trans(ib_link, trans_n) == FAILURE) {
- efree(args);
- RETURN_FALSE;
- }
-
- if (_php_ibase_alloc_query(&ib_query, ib_link->link, ib_link->trans[trans_n], query, ib_link->dialect) == FAILURE) {
- efree(args);
- RETURN_FALSE;
- }
-
- if (_php_ibase_exec(&ib_result, ib_query, bind_n, bind_args) == FAILURE) {
- _php_ibase_free_query(ib_query);
- efree(args);
- RETURN_FALSE;
- }
-
- efree(args);
-
- if (ib_result) { /* select statement */
- ib_result->drop_stmt = 1; /* drop stmt when free result */
- ib_query->stmt = NULL; /* keep stmt when free query */
- _php_ibase_free_query(ib_query);
- ZEND_REGISTER_RESOURCE(return_value, ib_result, le_result);
- } else {
- _php_ibase_free_query(ib_query);
- RETURN_TRUE;
- }
-}
-/* }}} */
-
-/* {{{ _php_ibase_var_pval() */
-static int _php_ibase_var_pval(pval *val, void *data, int type, int len, int scale, int flag)
-{
- char string_data[255];
- IBLS_FETCH();
- PLS_FETCH();
-
- switch(type & ~1) {
- case SQL_VARYING:
- len = ((IBASE_VCHAR *) data)->var_len;
- data = ((IBASE_VCHAR *) data)->var_str;
- /* fallout */
- case SQL_TEXT:
- val->value.str.val = (char *)emalloc(sizeof(char)*(len+1));
- memcpy(val->value.str.val, data, len);
- val->value.str.val[len] = '\0';
- if (PG(magic_quotes_runtime)) {
- val->value.str.val = php_addslashes(val->value.str.val, len, &len, 1);
- }
- val->type = IS_STRING;
- val->value.str.len = len;
- break;
- case SQL_LONG:
- if (scale) {
- int j, f = 1;
- float n = (float) *(long *)(data);
-
- for (j = 0; j < -scale; j++) {
- f *= 10;
- }
- val->type = IS_STRING;
- val->value.str.len = sprintf(string_data, "%.*f", -scale, n / f);
- val->value.str.val = estrdup(string_data);
- } else {
- val->type = IS_LONG;
- val->value.lval = *(long *)(data);
- }
- break;
- case SQL_SHORT:
- val->type = IS_LONG;
- val->value.lval = *(short *)(data);
- break;
- case SQL_FLOAT:
- val->type = IS_DOUBLE;
- val->value.dval = *(float *)(data);
- break;
- case SQL_DOUBLE:
- if (scale) {
- val->type = IS_STRING;
- val->value.str.len = sprintf(string_data, "%.*f", -scale, *(double *)data);
- val->value.str.val = estrdup(string_data);
- /*
- val->value.str.val = string_data;
- */
- } else {
- val->type = IS_DOUBLE;
- val->value.dval = *(double *)data;
- }
- break;
-#ifdef SQL_INT64
- case SQL_INT64:
- val->type = IS_STRING;
- val->value.str.len = sprintf(string_data, "%Ld.%0*Ld",
- (ISC_INT64) (*((ISC_INT64 *)data) / (int) pow(10.0, (double) -scale)), -scale,
- (ISC_INT64) abs((int) (*((ISC_INT64 *)data) % (int) pow(10.0, (double) -scale))));
- val->value.str.val = estrdup(string_data);
- break;
-#endif
-#ifndef SQL_TIMESTAMP
- case SQL_DATE:
-#else
- case SQL_TIMESTAMP:
- case SQL_TYPE_DATE:
- case SQL_TYPE_TIME:
-#endif
- {
- struct tm t;
- char *format = NULL;
- long timestamp = -1;
-
-#ifndef SQL_TIMESTAMP
- isc_decode_date((ISC_QUAD *) data, &t);
- format = IBG(timestampformat);
-#else
- switch (type & ~1) {
- case SQL_TIMESTAMP:
- isc_decode_timestamp((ISC_TIMESTAMP *) data, &t);
- format = IBG(timestampformat);
- break;
- case SQL_TYPE_DATE:
- isc_decode_sql_date((ISC_DATE *) data, &t);
- format = IBG(dateformat);
- break;
- case SQL_TYPE_TIME:
- isc_decode_sql_time((ISC_TIME *) data, &t);
- format = IBG(timeformat);
- break;
- }
-#endif
- /*
- XXX - Might have to remove this later - seems that isc_decode_date()
- always sets tm_isdst to 0, sometimes incorrectly (InterBase 6 bug?)
- */
- t.tm_isdst = -1;
- timestamp = mktime(&t);
-#if HAVE_TM_ZONE
- t.tm_zone = tzname[0];
-#endif
- if (flag & PHP_IBASE_UNIXTIME) {
- val->type = IS_LONG;
- val->value.lval = timestamp;
- } else {
- val->type = IS_STRING;
-#if HAVE_STRFTIME
- val->value.str.len = strftime(string_data, sizeof(string_data), format, &t);
-#else
- /* FIXME */
- if (!t.tm_hour && !t.tm_min && !t.tm_sec)
- val->value.str.len = sprintf(string_data, "%02d/%02d/%4d", t.tm_mon+1, t.tm_mday, t.tm_year+1900);
- else
- val->value.str.len = sprintf(string_data, "%02d/%02d/%4d %02d:%02d:%02d",
- t.tm_mon+1, t.tm_mday, t.tm_year+1900, t.tm_hour, t.tm_min, t.tm_sec);
-#endif
- val->value.str.val = estrdup(string_data);
- /*
- val->value.str.val = string_data;
- */
- break;
- }
- }
- default:
- return FAILURE;
- } /* switch (type) */
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ _php_ibase_arr_pval() */
-/* create multidimension array - resursion function
- (*datap) argument changed */
-static int _php_ibase_arr_pval(pval *ar_pval, char **datap, ibase_array *ib_array, int dim, int flag)
-{
- pval tmp;
- int i, dim_len, l_bound, u_bound;
-
-
- if (dim > 16) { /* InterBase limit */
- _php_ibase_module_error("php module internal error in %s %d",__FILE__,__LINE__);
- return FAILURE;
- }
-
- u_bound = ib_array->ar_desc.array_desc_bounds[dim].array_bound_upper;
- l_bound = ib_array->ar_desc.array_desc_bounds[dim].array_bound_lower;
- dim_len = 1 + u_bound - l_bound;
-
- if (dim < ib_array->ar_desc.array_desc_dimensions - 1) { /* array again */
- for (i = 0; i < dim_len; i++) {
- /* recursion here */
- if (_php_ibase_arr_pval(ar_pval, datap, ib_array, dim+1, flag) == FAILURE) {
- return FAILURE;
- }
- }
- } else { /* data at last */
-
- array_init(ar_pval);
-
- for (i = 0; i < dim_len; i++) {
- if (_php_ibase_var_pval(&tmp, *datap, ib_array->el_type,
- ib_array->ar_desc.array_desc_length,
- ib_array->ar_desc.array_desc_scale,
- flag) == FAILURE){
- return FAILURE;
- }
- /* FIXME ??? */
- zend_hash_index_update(ar_pval->value.ht,
- l_bound + i,
- (void *) &tmp, sizeof(pval),NULL);
- *datap += ib_array->el_size;
- }
- }
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ _php_ibase_fetch_hash() */
-
-#define FETCH_ARRAY 1
-#define FETCH_OBJECT 2
-
-static void _php_ibase_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, int fetch_type)
-{
- zval **result_arg, **flag_arg;
- long flag = 0;
- int i, arr_cnt;
- ibase_result *ib_result;
- XSQLVAR *var;
- IBLS_FETCH();
-
- RESET_ERRMSG;
-
- switch(ZEND_NUM_ARGS()) {
- case 1:
- if (ZEND_NUM_ARGS()==1 && zend_get_parameters_ex(1, &result_arg)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- case 2:
- if (ZEND_NUM_ARGS()==2 && zend_get_parameters_ex(2, &result_arg, &flag_arg)==FAILURE) {
- RETURN_FALSE;
- }
- convert_to_long_ex(flag_arg);
- flag = (*flag_arg)->value.lval;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- ZEND_FETCH_RESOURCE(ib_result, ibase_result *, result_arg, -1, "InterBase result", le_result);
-
- if (ib_result->out_sqlda == NULL) {
- _php_ibase_module_error("trying to fetch results from a non-select query");
- RETURN_FALSE;
- }
-
- if (isc_dsql_fetch(IB_STATUS, &ib_result->stmt, 1, ib_result->out_sqlda) == 100L) {
- RETURN_FALSE; /* end of cursor */
- }
-
- if (IB_STATUS[0] && IB_STATUS[1]) { /* error in fetch */
- _php_ibase_error();
- RETURN_FALSE;
- }
-
- if (fetch_type == FETCH_ARRAY) {
- if (array_init(return_value)==FAILURE) {
- RETURN_FALSE;
- }
- } else if (fetch_type == FETCH_OBJECT) {
- if (object_init(return_value)==FAILURE) {
- RETURN_FALSE;
- }
- }
-
- arr_cnt = 0;
- var = ib_result->out_sqlda->sqlvar;
- for (i = 0; i < ib_result->out_sqlda->sqld; i++, var++) {
- if (((var->sqltype & 1) == 0) || *var->sqlind != -1) {
- pval *tmp;
- tmp = emalloc(sizeof(pval));
- switch(var->sqltype & ~1) {
- case SQL_VARYING:
- case SQL_TEXT:
- case SQL_SHORT:
- case SQL_LONG:
- case SQL_FLOAT:
- case SQL_DOUBLE:
-#ifdef SQL_INT64
- case SQL_INT64:
-#endif
-#ifndef SQL_TIMESTAMP
- case SQL_DATE:
-#else
- case SQL_TIMESTAMP:
- case SQL_TYPE_DATE:
- case SQL_TYPE_TIME:
-#endif
- _php_ibase_var_pval(tmp, var->sqldata, var->sqltype, var->sqllen, var->sqlscale, flag);
- break;
- case SQL_BLOB:
- if (flag & PHP_IBASE_TEXT) { /* text ? */
- int stat;
- isc_blob_handle bl_handle = NULL;
- ISC_LONG max_len = 0, cur_len = 0;
- char bl_items[1], *bl_data, bl_info[20], *p;
-
- if (isc_open_blob(IB_STATUS, &ib_result->link, &ib_result->trans, &bl_handle, (ISC_QUAD ISC_FAR *) var->sqldata)) {
- _php_ibase_error();
- RETURN_FALSE;
- }
-
- bl_items[0] = isc_info_blob_total_length;
- if (isc_blob_info(IB_STATUS,&bl_handle,sizeof(bl_items),bl_items,sizeof(bl_info),bl_info)) {
- _php_ibase_error();
- RETURN_FALSE;
- }
-
- /* find total length of blob's data */
- for (p = bl_info; *p != isc_info_end && p < bl_info+sizeof(bl_info);) {
- unsigned short item_len, item = *p++;
-
- item_len = (short) isc_vax_integer(p, 2);
- p += 2;
- if (item == isc_info_blob_total_length)
- max_len = isc_vax_integer(p, item_len);
- p += item_len;
- }
-
- bl_data = emalloc(max_len+1);
-
- for (cur_len = stat = 0; stat == 0 && cur_len < max_len; ) {
- unsigned short seg_len;
- unsigned short max_seg = (unsigned short) (max_len - cur_len > USHRT_MAX ? USHRT_MAX : max_len-cur_len);
- stat = isc_get_segment(IB_STATUS, &bl_handle, &seg_len, max_seg, &bl_data[cur_len]);
- cur_len += seg_len;
- if (cur_len > max_len) { /* never!*/
- efree(bl_data);
- _php_ibase_module_error("php module internal error in %s %d",__FILE__,__LINE__);
- RETURN_FALSE;
- }
- }
-
- if (IB_STATUS[0] && IB_STATUS[1] && (IB_STATUS[1] != isc_segstr_eof)) {
- efree(bl_data);
- _php_ibase_error();
- RETURN_FALSE;
- }
- bl_data[cur_len] = '\0';
- if (isc_close_blob(IB_STATUS, &bl_handle)) {
- efree(bl_data);
- _php_ibase_error();
- RETURN_FALSE;
- }
- tmp->type = IS_STRING;
- tmp->value.str.len = cur_len;
- tmp->value.str.val = estrndup(bl_data, cur_len);
- efree(bl_data);
- } else { /* blob id only */
- ISC_QUAD *bl_qd = (ISC_QUAD ISC_FAR *) var->sqldata;
- ibase_blob_handle *ib_blob_id;
-
- ib_blob_id = (ibase_blob_handle *) emalloc(sizeof(ibase_blob_handle));
-
- ib_blob_id->link = ib_result->link;
- ib_blob_id->trans_handle = ib_result->trans;
- ib_blob_id->bl_qd.gds_quad_high = bl_qd->gds_quad_high;
- ib_blob_id->bl_qd.gds_quad_low = bl_qd->gds_quad_low;
- ib_blob_id->bl_handle = NULL;
-
- tmp->type = IS_STRING;
- tmp->value.str.len = sizeof(ibase_blob_handle);
- tmp->value.str.val = estrndup((char *)ib_blob_id, sizeof(ibase_blob_handle));
- efree(ib_blob_id);
- }
- break;
- case SQL_ARRAY:{
- ISC_QUAD ar_qd = *(ISC_QUAD ISC_FAR *) var->sqldata;
- ibase_array *ib_array = &ib_result->out_array[arr_cnt];
- void *ar_data;
- char *tmp_ptr;
-
- ar_data = emalloc(ib_array->ar_size);
-
- if (isc_array_get_slice(IB_STATUS, &ib_result->link, &ib_result->trans,
- &ar_qd, &ib_array->ar_desc, ar_data, &ib_array->ar_size)) {
- _php_ibase_error();
- RETURN_FALSE;
- }
-
- tmp_ptr = ar_data; /* avoid changes in _arr_pval */
- if (_php_ibase_arr_pval(tmp, &tmp_ptr, ib_array, 0, flag) == FAILURE) {
- RETURN_FALSE;
- }
- efree(ar_data);
- }
- break;
- default:
- break;
- } /*switch*/
- if (fetch_type & FETCH_ARRAY) {
- switch (tmp->type) {
- case IS_STRING:
- add_index_stringl(return_value, i, tmp->value.str.val, tmp->value.str.len, 0);
- break;
- case IS_LONG:
- add_index_long(return_value, i, tmp->value.lval);
- break;
- case IS_DOUBLE:
- add_index_double(return_value, i, tmp->value.dval);
- break;
- }
- } else {
- switch (tmp->type) {
- case IS_STRING:
- add_property_stringl(return_value, var->aliasname, tmp->value.str.val, tmp->value.str.len, 0);
-break;
- case IS_LONG:
- add_property_long(return_value, var->aliasname, tmp->value.lval);
- break;
- case IS_DOUBLE:
- add_property_double(return_value, var->aliasname, tmp->value.dval);
- break;
- }
- }
- efree(tmp);
- } /* if not null */
- if ((var->sqltype & ~1) == SQL_ARRAY) {
- arr_cnt++;
- }
- } /*for field*/
-}
-/* }}} */
-
-/* {{{ proto array ibase_fetch_row(int result [, int blob_flag])
- Fetch a row from the results of a query */
-PHP_FUNCTION(ibase_fetch_row)
-{
- _php_ibase_fetch_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU, FETCH_ARRAY);
-}
-/* }}} */
-
-/* {{{ proto object ibase_fetch_object(int result [, int blob_flag])
- Fetch a object from the results of a query */
-PHP_FUNCTION(ibase_fetch_object)
-{
- _php_ibase_fetch_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU, FETCH_OBJECT);
-}
-/* }}} */
-
-/* {{{ proto int ibase_free_result(int result)
- Free the memory used by a result */
-PHP_FUNCTION(ibase_free_result)
-{
- zval **result_arg;
- ibase_result *ib_result;
- IBLS_FETCH();
-
- RESET_ERRMSG;
-
- if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &result_arg)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(ib_result, ibase_result *, result_arg, -1, "InterBase result", le_result);
- zend_list_delete((*result_arg)->value.lval);
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int ibase_prepare([int link_identifier,] string query)
- Prepare a query for later execution */
-PHP_FUNCTION(ibase_prepare)
-{
- zval **link_arg, **query_arg;
- int link_id, trans_n = 0, trans_id = 0;
- ibase_db_link *ib_link;
- ibase_query *ib_query;
- char *query;
- IBLS_FETCH();
-
- RESET_ERRMSG;
-
- switch (ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &query_arg) == FAILURE) {
- RETURN_FALSE;
- }
- link_id = IBG(default_link);
- ZEND_FETCH_RESOURCE2(ib_link, ibase_db_link *, NULL, link_id, "InterBase link", le_link, le_plink);
- break;
- case 2:
- if (zend_get_parameters_ex(2, &link_arg, &query_arg) == FAILURE) {
- RETURN_FALSE;
- }
- get_link_trans(INTERNAL_FUNCTION_PARAM_PASSTHRU, link_arg, &ib_link, &trans_n, &trans_id);
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- convert_to_string_ex(query_arg);
- query = (*query_arg)->value.str.val;
-
- /* open default transaction */
- if (_php_ibase_def_trans(ib_link, trans_n) == FAILURE) {
- RETURN_FALSE;
- }
-
- if (_php_ibase_alloc_query(&ib_query, ib_link->link, ib_link->trans[trans_n], query, ib_link->dialect) == FAILURE) {
- RETURN_FALSE;
- }
- ib_query->cursor_open = 0;
-
- zend_list_addref(link_id);
-
- ZEND_REGISTER_RESOURCE(return_value, ib_query, le_query);
-
-}
-/* }}} */
-
-/* {{{ proto int ibase_execute(int query [, int bind_args [, int ...]])
- Execute a previously prepared query */
-PHP_FUNCTION(ibase_execute)
-{
- pval ***args, **bind_args = NULL;
- ibase_query *ib_query;
- ibase_result *ib_result;
- IBLS_FETCH();
-
- RESET_ERRMSG;
-
- if (ZEND_NUM_ARGS() < 1) {
- WRONG_PARAM_COUNT;
- }
-
- args = (pval ***)emalloc(ZEND_NUM_ARGS() * sizeof(pval **));
- if (zend_get_parameters_array_ex(ZEND_NUM_ARGS(), args) == FAILURE) {
- efree(args);
- RETURN_FALSE;
- }
-
- ZEND_FETCH_RESOURCE(ib_query, ibase_query *, args[0], -1, "InterBase query", le_query);
-
- if (ZEND_NUM_ARGS() > 1) { /* have variables to bind */
- bind_args = args[1];
- }
-
- /* Have we used this cursor before and it's still open? */
- if (ib_query->cursor_open) {
- IBDEBUG("Implicitly closing a cursor");
- if (isc_dsql_free_statement(IB_STATUS, &ib_query->stmt, DSQL_close)){
- efree(args);
- _php_ibase_error();
- }
- }
-
- if ( _php_ibase_exec(&ib_result, ib_query, ZEND_NUM_ARGS()-1, bind_args) == FAILURE) {
- efree(args);
- RETURN_FALSE;
- }
-
- efree(args);
-
- if (ib_result) { /* select statement */
- ib_query->cursor_open = 1;
- ZEND_REGISTER_RESOURCE(return_value, ib_result, le_result);
- } else {
- ib_query->cursor_open = 0;
- RETURN_TRUE;
- }
-}
-/* }}} */
-
-/* {{{ proto int ibase_free_query(int query)
- Free memory used by a query */
-PHP_FUNCTION(ibase_free_query)
-{
- pval **query_arg;
- ibase_query *ib_query;
- IBLS_FETCH();
-
- RESET_ERRMSG;
-
- if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &query_arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(ib_query, ibase_query *, query_arg, -1, "InterBase query", le_query);
- zend_list_delete((*query_arg)->value.lval);
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int ibase_timefmt(string format)
- Sets the format of timestamp, date and time columns returned from queries */
-PHP_FUNCTION(ibase_timefmt)
-{
-#if HAVE_STRFTIME
- pval ***args;
- char *fmt = NULL;
- int type = PHP_IBASE_TIMESTAMP;
- IBLS_FETCH();
-
- RESET_ERRMSG; /* ??? */
-
-
- if (ZEND_NUM_ARGS() < 1 || ZEND_NUM_ARGS() > 2){
- WRONG_PARAM_COUNT;
- }
-
- args = (pval ***) emalloc(sizeof(pval **)*ZEND_NUM_ARGS());
- if (zend_get_parameters_array_ex(ZEND_NUM_ARGS(), args) == FAILURE) {
- efree(args);
- RETURN_FALSE;
- }
-
- switch (ZEND_NUM_ARGS()) {
- case 2:
- convert_to_long_ex(args[1]);
- type = (*args[1])->value.lval;
- case 1:
- convert_to_string_ex(args[0]);
- fmt = (*args[0])->value.str.val;
- }
-
- switch (type) {
- case PHP_IBASE_TIMESTAMP:
- if (IBG(timestampformat))
- DL_FREE(IBG(timestampformat));
- IBG(timestampformat) = DL_STRDUP(fmt);
- break;
- case PHP_IBASE_DATE:
- if (IBG(dateformat))
- DL_FREE(IBG(dateformat));
- IBG(dateformat) = DL_STRDUP(fmt);
- break;
- case PHP_IBASE_TIME:
- if (IBG(timeformat))
- DL_FREE(IBG(timeformat));
- IBG(timeformat) = DL_STRDUP(fmt);
- break;
- }
-
- efree(args);
- RETURN_TRUE;
-#else
- _php_ibase_module_error("ibase_timefmt not supported on this platform");
- RETURN_FALSE;
-#endif
-}
-/* }}} */
-
-/* {{{ proto int ibase_num_fields(int result)
- Get the number of fields in result */
-PHP_FUNCTION(ibase_num_fields)
-{
- pval **result;
- ibase_result *ib_result;
- IBLS_FETCH();
-
- RESET_ERRMSG;
-
- if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &result)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(ib_result, ibase_result *, result, -1, "InterBase result", le_result);
-
- if (ib_result->out_sqlda == NULL) {
- _php_ibase_module_error("trying to get num fields from a non-select query");
- RETURN_FALSE;
- }
-
- RETURN_LONG(ib_result->out_sqlda->sqld);
-}
-/* }}} */
-
-/* {{{ proto array ibase_field_info(int result, int field_number)
- Get information about a field */
-PHP_FUNCTION(ibase_field_info)
-{
- pval *ret_val;
- zval **result_arg, **field_arg;
- ibase_result *ib_result;
- char buf[30], *s;
- int len;
- XSQLVAR *var;
- IBLS_FETCH();
-
- RESET_ERRMSG;
-
- if (ZEND_NUM_ARGS()!=2 || zend_get_parameters_ex(2, &result_arg, &field_arg)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(ib_result, ibase_result *, result_arg, -1, "InterBase result", le_result);
-
- if (ib_result->out_sqlda == NULL) {
- _php_ibase_module_error("trying to get field info from a non-select query");
- RETURN_FALSE;
- }
-
- convert_to_long_ex(field_arg);
-
- if ((*field_arg)->value.lval<0 || (*field_arg)->value.lval>=ib_result->out_sqlda->sqld)
- RETURN_FALSE;
-
- if (array_init(return_value)==FAILURE)
- RETURN_FALSE;
-
- var = ib_result->out_sqlda->sqlvar + (*field_arg)->value.lval;
-
- add_get_index_stringl(return_value, 0, var->sqlname, var->sqlname_length, (void **) &ret_val, 1);
- add_assoc_stringl(return_value, "name", var->sqlname, var->sqlname_length, 1);
-
- add_get_index_stringl(return_value, 1, var->aliasname, var->aliasname_length, (void **) &ret_val, 1);
- add_assoc_stringl(return_value, "alias", var->aliasname, var->aliasname_length, 1);
-
- add_get_index_stringl(return_value, 2, var->relname, var->relname_length, (void **) &ret_val, 1);
- add_assoc_stringl(return_value, "relation", var->relname, var->relname_length, 1);
-
- len = sprintf(buf, "%d", var->sqllen);
- add_get_index_stringl(return_value, 3, buf, len, (void **) &ret_val, 1);
- add_assoc_stringl(return_value, "length", buf, len, 1);
-
- switch (var->sqltype & ~1) {
- case SQL_TEXT: s = "TEXT"; break;
- case SQL_VARYING: s = "VARYING"; break;
- case SQL_SHORT: s = "SHORT"; break;
- case SQL_LONG: s = "LONG"; break;
- case SQL_FLOAT: s = "FLOAT"; break;
- case SQL_DOUBLE: s = "DOUBLE"; break;
- case SQL_D_FLOAT: s = "D_FLOAT"; break;
-#ifdef SQL_INT64
- case SQL_INT64: s = "INT64"; break;
-#endif
-#ifdef SQL_TIMESTAMP
- case SQL_TIMESTAMP: s = "TIMESTAMP"; break;
- case SQL_TYPE_DATE: s = "DATE"; break;
- case SQL_TYPE_TIME: s = "TIME"; break;
-#else
- case SQL_DATE: s = "DATE"; break;
-#endif
- case SQL_BLOB: s = "BLOB"; break;
- case SQL_ARRAY: s = "ARRAY"; break;
- case SQL_QUAD: s = "QUAD"; break;
- default:
- sprintf(buf,"unknown (%d)", var->sqltype & ~1);
- s = buf;
- break;
- }
- add_get_index_stringl(return_value, 4, s, strlen(s), (void **) &ret_val, 1);
- add_assoc_stringl(return_value, "type", s, strlen(s), 1);
-}
-/* }}} */
-
-/* blobs ----------------------------------- */
-
-/* {{{ _php_ibase_blob_info(isc_blob_handle bl_handle,IBASE_BLOBINFO *bl_info) */
-static int _php_ibase_blob_info(isc_blob_handle bl_handle,IBASE_BLOBINFO *bl_info)
-{
-
- static char bl_items[] = {
- isc_info_blob_num_segments,
- isc_info_blob_max_segment,
- isc_info_blob_total_length,
- isc_info_blob_type
- };
-
- char bl_inf[sizeof(long)*8], *p;
- IBLS_FETCH();
-
- bl_info->max_segment = 0;
- bl_info->num_segments = 0;
- bl_info->total_length = 0;
- bl_info->bl_stream = 0;
-
- if (isc_blob_info(IB_STATUS,&bl_handle,sizeof(bl_items),bl_items,sizeof(bl_inf),bl_inf)) {
- _php_ibase_error();
- return FAILURE;
- }
-
- for (p = bl_inf; *p != isc_info_end && p < bl_inf+sizeof(bl_inf);) {
- unsigned short item_len;
- int item = *p++;
-
- item_len = (short)isc_vax_integer(p, 2);
- p += 2;
- switch (item) {
- case isc_info_blob_num_segments:
- bl_info->num_segments = isc_vax_integer(p, item_len);
- break;
- case isc_info_blob_max_segment:
- bl_info->max_segment = isc_vax_integer(p, item_len);
- break;
- case isc_info_blob_total_length:
- bl_info->total_length = isc_vax_integer(p, item_len);
- break;
- case isc_info_blob_type:
- bl_info->bl_stream = isc_vax_integer(p, item_len);
- break;
- case isc_info_end:
- break;
- case isc_info_truncated:
- case isc_info_error: /* hmm. don't think so...*/
- _php_ibase_module_error("php module internal error in %s %d",__FILE__,__LINE__);
- return FAILURE;
- } /*switch*/
- p += item_len;
- } /*for*/
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ proto int ibase_blob_create([int link_identifier])
- Create blob for adding data */
-PHP_FUNCTION(ibase_blob_create)
-{
- zval **link_arg;
- int trans_n = 0, trans_id = 0, link_id;
- ibase_db_link *ib_link;
- ibase_blob_handle *ib_blob;
- IBLS_FETCH();
-
- RESET_ERRMSG;
-
- switch (ZEND_NUM_ARGS()) {
- case 0:
- link_id = IBG(default_link);
- ZEND_FETCH_RESOURCE2(ib_link, ibase_db_link *, NULL, link_id, "InterBase link", le_link, le_plink);
- break;
- case 1:
- if (zend_get_parameters_ex(1, &link_arg) == FAILURE) {
- RETURN_FALSE;
- }
- get_link_trans(INTERNAL_FUNCTION_PARAM_PASSTHRU, link_arg, &ib_link, &trans_n, &trans_id);
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- /* open default transaction */
- if(_php_ibase_def_trans(ib_link, trans_n) == FAILURE){
- RETURN_FALSE;
- }
-
- ib_blob = (ibase_blob_handle *) emalloc(sizeof(ibase_blob_handle));
- ib_blob->trans_handle = ib_link->trans[trans_n];
- ib_blob->link = ib_link->link;
- ib_blob->bl_handle = NULL;
-
- if (isc_create_blob(IB_STATUS, &ib_blob->link, &ib_blob->trans_handle, &ib_blob->bl_handle,&ib_blob->bl_qd)) {
- efree(ib_blob);
- _php_ibase_error();
- RETURN_FALSE;
- }
-
- RETURN_LONG(zend_list_insert(ib_blob, le_blob));
-}
-/* }}} */
-
-/* {{{ proto int ibase_blob_open(string blob_id)
- Open blob for retriving data parts */
-PHP_FUNCTION(ibase_blob_open)
-{
- pval *blob_arg;
- ibase_blob_handle *ib_blob, *ib_blob_id;
- IBLS_FETCH();
-
- RESET_ERRMSG;
-
- if (ZEND_NUM_ARGS()!=1 || getParameters(ht, 1, &blob_arg)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ib_blob = (ibase_blob_handle *) emalloc(sizeof(ibase_blob_handle));
-
- GET_BLOB_ID_ARG(blob_arg,ib_blob_id);
-
- if (ib_blob_id == NULL) { /* blob IS NULL or argument unset */
- RETURN_FALSE;
- }
-
- ib_blob->link = ib_blob_id->link;
- ib_blob->trans_handle = ib_blob_id->trans_handle;
- ib_blob->bl_qd.gds_quad_high = ib_blob_id->bl_qd.gds_quad_high;
- ib_blob->bl_qd.gds_quad_low = ib_blob_id->bl_qd.gds_quad_low;
- ib_blob->bl_handle = NULL;
- if (isc_open_blob(IB_STATUS, &ib_blob->link, &ib_blob->trans_handle, &ib_blob->bl_handle, &ib_blob->bl_qd)) {
- efree(ib_blob);
- _php_ibase_error();
- RETURN_FALSE;
- }
-
- RETURN_LONG(zend_list_insert(ib_blob, le_blob));
-}
-/* }}} */
-
-/* {{{ proto int ibase_blob_add(int blob_id, string data)
- Add data into created blob */
-PHP_FUNCTION(ibase_blob_add)
-{
- pval *blob_arg,*string_arg;
- ibase_blob_handle *ib_blob;
- IBLS_FETCH();
-
- RESET_ERRMSG;
-
- if (ZEND_NUM_ARGS()!=2 || getParameters(ht, 2, &blob_arg, &string_arg)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- GET_BLOB_HANDLE_ARG(blob_arg, ib_blob);
-
- convert_to_string(string_arg);
-
- if (isc_put_segment(IB_STATUS, &ib_blob->bl_handle, (unsigned short) string_arg->value.str.len, string_arg->value.str.val)) {
- _php_ibase_error();
- RETURN_FALSE;
- }
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto string ibase_blob_get(int blob_id, int len)
- Get len bytes data from open blob */
-PHP_FUNCTION(ibase_blob_get)
-{
- pval *blob_arg, *len_arg;
- int stat;
- char *bl_data;
- unsigned short max_len = 0, cur_len, seg_len;
- ibase_blob_handle *ib_blob;
- IBLS_FETCH();
-
- RESET_ERRMSG;
-
- if (ZEND_NUM_ARGS() != 2 || getParameters(ht, 2, &blob_arg, &len_arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(len_arg);
- max_len = (unsigned short) len_arg->value.lval;
-
- GET_BLOB_HANDLE_ARG(blob_arg, ib_blob);
-
- if (ib_blob->bl_qd.gds_quad_high || ib_blob->bl_qd.gds_quad_low) { /*not null ?*/
-
- bl_data = emalloc(max_len+1);
-
- for (cur_len = stat = 0; stat == 0; ) {
- stat = isc_get_segment(IB_STATUS, &ib_blob->bl_handle, &seg_len, (unsigned short) (max_len-cur_len), &bl_data[cur_len]);
- cur_len += seg_len;
- if (cur_len > max_len) { /* never!*/
- efree(bl_data);
- _php_ibase_module_error("php module internal error in %s %d",__FILE__,__LINE__);
- RETURN_FALSE;
- }
- }
-
- bl_data[cur_len] = '\0';
- if (IB_STATUS[0] && (IB_STATUS[1] != isc_segstr_eof && IB_STATUS[1] != isc_segment)) {
- efree(bl_data);
- _php_ibase_error();
- RETURN_FALSE;
- }
- RETURN_STRINGL(bl_data,cur_len,0);
- } else { /* null blob */
- RETURN_STRING("",1); /* empty string */
- }
-}
-/* }}} */
-
-#define BLOB_CLOSE 1
-#define BLOB_CANCEL 2
-
-/* {{{ _php_ibase_blob_end() */
-/* Close or Cancel created or Close open blob */
-static void _php_ibase_blob_end(INTERNAL_FUNCTION_PARAMETERS, int bl_end)
-{
- pval *blob_arg;
- ibase_blob_handle *ib_blob;
- IBLS_FETCH();
-
- RESET_ERRMSG;
-
- if (ZEND_NUM_ARGS()!=1 || getParameters(ht, 1, &blob_arg)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- GET_BLOB_HANDLE_ARG(blob_arg, ib_blob);
-
- if (bl_end == BLOB_CLOSE) { /* return id here */
- if (ib_blob->bl_qd.gds_quad_high || ib_blob->bl_qd.gds_quad_low) { /*not null ?*/
- if (isc_close_blob(IB_STATUS, &ib_blob->bl_handle)) {
- _php_ibase_error();
- RETURN_FALSE;
- }
- }
- ib_blob->bl_handle = NULL;
- RETVAL_STRINGL((char *)ib_blob, sizeof(ibase_blob_handle), 1);
- zend_list_delete(blob_arg->value.lval);
- } else { /* discard created blob */
- if (isc_cancel_blob(IB_STATUS, &ib_blob->bl_handle)) {
- _php_ibase_error();
- RETURN_FALSE;
- }
- ib_blob->bl_handle = NULL;
- zend_list_delete(blob_arg->value.lval);
- RETURN_TRUE;
- }
-}
-/* }}} */
-
-/* {{{ proto int ibase_blob_close(int blob_id)
- Close blob */
-PHP_FUNCTION(ibase_blob_close)
-{
- _php_ibase_blob_end(INTERNAL_FUNCTION_PARAM_PASSTHRU,BLOB_CLOSE);
-}
-/* }}} */
-
-/* {{{ proto int ibase_blob_cancel(int blob_id)
- Cancel creating blob */
-PHP_FUNCTION(ibase_blob_cancel)
-{
- _php_ibase_blob_end(INTERNAL_FUNCTION_PARAM_PASSTHRU,BLOB_CANCEL);
-}
-/* }}} */
-
-/* {{{ proto object ibase_blob_info(string blob_id_str)
- Return blob length and other useful info */
-PHP_FUNCTION(ibase_blob_info)
-{
- pval *blob_arg, *result_var;
- ibase_blob_handle *ib_blob_id;
- IBASE_BLOBINFO bl_info;
- IBLS_FETCH();
-
- RESET_ERRMSG;
-
- if (ZEND_NUM_ARGS()!=1 || getParameters(ht, 1, &blob_arg)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- GET_BLOB_ID_ARG(blob_arg, ib_blob_id);
-
- if (array_init(return_value)==FAILURE){
- RETURN_FALSE;
- }
-
- if (ib_blob_id->bl_qd.gds_quad_high || ib_blob_id->bl_qd.gds_quad_low) { /*not null ?*/
- if (isc_open_blob(IB_STATUS, &ib_blob_id->link, &ib_blob_id->trans_handle,
- &ib_blob_id->bl_handle, &ib_blob_id->bl_qd)) {
- _php_ibase_error();
- RETURN_FALSE;
- }
-
- if (_php_ibase_blob_info(ib_blob_id->bl_handle,&bl_info)) {
- RETURN_FALSE;
- }
- if (isc_close_blob(IB_STATUS, &ib_blob_id->bl_handle)) {
- _php_ibase_error();
- RETURN_FALSE;
- }
- ib_blob_id->bl_handle = NULL;
- } else { /* null blob, all values to zero */
- bl_info.max_segment = 0;
- bl_info.num_segments = 0;
- bl_info.total_length = 0;
- bl_info.bl_stream = 0;
- }
-
- /* FIXME */
- add_get_index_long(return_value, 0, bl_info.total_length, (void **)&result_var);
- /*
- zend_hash_pointer_update(return_value->value.ht, "length", sizeof("length"), result_var);
- */
-
- add_get_index_long(return_value, 1, bl_info.num_segments, (void **)&result_var);
- /*
- zend_hash_pointer_update(return_value->value.ht, "numseg", sizeof("numseg"), result_var);
- */
-
- add_get_index_long(return_value, 2, bl_info.max_segment, (void **)&result_var);
- /*
- zend_hash_pointer_update(return_value->value.ht, "maxseg", sizeof("maxseg"), result_var);
- */
-
- add_get_index_long(return_value, 3, bl_info.bl_stream, (void **)&result_var);
- /*
- zend_hash_pointer_update(return_value->value.ht, "stream", sizeof("stream"), result_var);
- */
-
- add_get_index_long(return_value, 4,
- (!ib_blob_id->bl_qd.gds_quad_high
- && !ib_blob_id->bl_qd.gds_quad_low),
- (void **)&result_var);
- /*
- zend_hash_pointer_update(return_value->value.ht, "isnull", sizeof("isnull"), result_var);
- */
-}
-/* }}} */
-
-/* {{{ proto int ibase_blob_echo(string blob_id_str)
- Output blob contents to browser */
-PHP_FUNCTION(ibase_blob_echo)
-{
- pval *blob_arg;
- char bl_data[IBASE_BLOB_SEG];
- unsigned short seg_len;
- ibase_blob_handle *ib_blob_id;
- IBLS_FETCH();
-
- RESET_ERRMSG;
-
- if (ZEND_NUM_ARGS()!=1 || getParameters(ht, 1, &blob_arg)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- GET_BLOB_ID_ARG(blob_arg, ib_blob_id);
-
- if (ib_blob_id) { /*not null ?*/
-
- if (isc_open_blob(IB_STATUS, &ib_blob_id->link, &ib_blob_id->trans_handle,
- &ib_blob_id->bl_handle,&ib_blob_id->bl_qd)) {
- _php_ibase_error();
- RETURN_FALSE;
- }
-
- while (!isc_get_segment(IB_STATUS, &ib_blob_id->bl_handle, &seg_len, sizeof(bl_data), bl_data)
- || IB_STATUS[1] == isc_segment) {
- PHPWRITE(bl_data,seg_len);
- }
-
- if (IB_STATUS[0] && (IB_STATUS[1] != isc_segstr_eof)) {
- _php_ibase_error();
- RETURN_FALSE;
- }
-
- if (isc_close_blob(IB_STATUS, &ib_blob_id->bl_handle)) {
- _php_ibase_error();
- RETURN_FALSE;
- }
- ib_blob_id->bl_handle = NULL;
- } /* not null ? */
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/*
-extern int le_fp, le_pp;
-extern int wsa_fp;
-*/
-/*to handle reading and writing to windows sockets*/
-
-/* {{{ proto string ibase_blob_import([link_identifier,] int file_id)
- Create blob, copy file in it, and close it */
-
-PHP_FUNCTION(ibase_blob_import)
-{
- zval **link_arg, **file_arg;
- int trans_n = 0, link_id = 0, trans_id = 0, size;
- unsigned short b;
- int issock=0, socketd=0;
- ibase_blob_handle ib_blob;
- ibase_db_link *ib_link;
- char bl_data[IBASE_BLOB_SEG]; /* FIXME? blob_seg_size parameter? */
- FILE *fp;
- IBLS_FETCH();
- void * what;
- int type;
-
- RESET_ERRMSG;
-
- switch (ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &file_arg) == FAILURE) {
- RETURN_FALSE;
- }
- link_id = IBG(default_link);
- ZEND_FETCH_RESOURCE2(ib_link, ibase_db_link *, NULL, link_id, "InterBase link", le_link, le_plink);
- break;
- case 2:
- if (zend_get_parameters_ex(2, &link_arg, &file_arg) == FAILURE) {
- RETURN_FALSE;
- }
- get_link_trans(INTERNAL_FUNCTION_PARAM_PASSTHRU, link_arg, &ib_link, &trans_n, &trans_id);
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- /* open default transaction */
- if (_php_ibase_def_trans(ib_link, trans_n) == FAILURE) {
- RETURN_FALSE;
- }
-
- what = zend_fetch_resource(file_arg, -1, "File-Handle", &type, 2, php_file_le_fopen(), php_file_le_stream());
- ZEND_VERIFY_RESOURCE(what);
-
- if (type == php_file_le_fopen())
- fp = (FILE*)what;
-
- ib_blob.link = ib_link->link;
- ib_blob.trans_handle = ib_link->trans[trans_n];
- ib_blob.bl_handle = NULL;
- ib_blob.bl_qd.gds_quad_high = 0;
- ib_blob.bl_qd.gds_quad_low = 0;
-
- if (isc_create_blob(IB_STATUS, &ib_blob.link, &ib_blob.trans_handle, &ib_blob.bl_handle,&ib_blob.bl_qd)) {
- _php_ibase_error();
- RETURN_FALSE;
- }
-
- size = 0;
-
-#if HAVE_PHP_STREAM
- if (type == php_file_le_stream()) {
- while(b = php_stream_read((php_stream*)what, bl_data, 1, sizeof(bl_data)) > 0) {
- if (isc_put_segment(IB_STATUS, &ib_blob.bl_handle, b, bl_data)) {
- _php_ibase_error();
- RETURN_FALSE;
- }
- size += b;
-
- }
- }
- else {
-#endif
- /* Can't see much use for the issock stuff here, it should be nuked --Wez */
- while (issock?(b=SOCK_FREAD(bl_data,sizeof(bl_data),socketd)):(b = fread(bl_data, 1, sizeof(bl_data), fp)) > 0) {
- if (isc_put_segment(IB_STATUS, &ib_blob.bl_handle, b, bl_data)) {
- _php_ibase_error();
- RETURN_FALSE;
- }
- size += b;
- }
-
-#if HAVE_PHP_STREAM
- }
-#endif
-
- if (isc_close_blob(IB_STATUS, &ib_blob.bl_handle)) {
- _php_ibase_error();
- RETURN_FALSE;
- }
-
- ib_blob.bl_handle = NULL;
- RETVAL_STRINGL((char *)&ib_blob, sizeof(ibase_blob_handle), 1);
-}
-/* }}} */
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/interbase/interbase.dsp b/ext/interbase/interbase.dsp
deleted file mode 100644
index 7df75ba14d..0000000000
--- a/ext/interbase/interbase.dsp
+++ /dev/null
@@ -1,113 +0,0 @@
-# Microsoft Developer Studio Project File - Name="interbase" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=interbase - Win32 Debug_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "interbase.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "interbase.mak" CFG="interbase - Win32 Debug_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "interbase - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "interbase - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "interbase - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\..\main" /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\..\php_build\Interbase SDK\include" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "INTERBASE_EXPORTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D ZEND_DEBUG=1 /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\..\main" /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\..\php_build\Interbase SDK\include" /I "..\..\..\bindlib_w32" /D "_DEBUG" /D ZEND_DEBUG=1 /D "ZTS" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "INTERBASE_EXPORTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_IBASE=1 /FR /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "_DEBUG"
-# ADD RSC /l 0x40d /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ib_util_ms.lib gds32_ms.lib php4ts_debug.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib gds32_ms.lib php4ts_debug.lib /nologo /dll /debug /machine:I386 /out:"..\..\Debug_TS/php_interbase.dll" /pdbtype:sept /libpath:"..\..\..\php_build\Interbase SDK\lib_ms" /libpath:"..\..\Debug_TS"
-
-!ELSEIF "$(CFG)" == "interbase - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "..\..\main" /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\..\php_build\Interbase SDK\include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "INTERBASE_EXPORTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_IBASE=1 /D ZEND_DEBUG=0 /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\main" /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\..\php_build\Interbase SDK\include" /I "..\..\..\bindlib_w32" /D "NDEBUG" /D ZEND_DEBUG=0 /D "ZTS" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "INTERBASE_EXPORTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_IBASE=1 /D "COMPILE_DL_INTERBASE" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "NDEBUG"
-# ADD RSC /l 0x40d /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 php4ts.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ib_util_ms.lib gds32_ms.lib /nologo /dll /machine:I386
-# ADD LINK32 php4ts.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib gds32_ms.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_interbase.dll" /libpath:"..\..\..\php_build\Interbase SDK\lib_ms" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
-
-!ENDIF
-
-# Begin Target
-
-# Name "interbase - Win32 Debug_TS"
-# Name "interbase - Win32 Release_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\interbase.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_interbase.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/ext/interbase/php_interbase.h b/ext/interbase/php_interbase.h
deleted file mode 100644
index e1e4e0e5cd..0000000000
--- a/ext/interbase/php_interbase.h
+++ /dev/null
@@ -1,186 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Jouni Ahto <jouni.ahto@exdec.fi> |
- | Andrew Avdeev <andy@simgts.mv.ru> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifndef PHP_INTERBASE_H
-#define PHP_INTERBASE_H
-
-#if HAVE_IBASE
-#include <ibase.h>
-
-extern zend_module_entry ibase_module_entry;
-#define phpext_interbase_ptr &ibase_module_entry
-
-#ifdef PHP_WIN32
-#define PHP_IBASE_API __declspec(dllexport)
-#else
-#define PHP_IBASE_API
-#endif
-
-extern PHP_MINIT_FUNCTION(ibase);
-extern PHP_RINIT_FUNCTION(ibase);
-extern PHP_MSHUTDOWN_FUNCTION(ibase);
-extern PHP_RSHUTDOWN_FUNCTION(ibase);
-PHP_MINFO_FUNCTION(ibase);
-
-PHP_FUNCTION(ibase_connect);
-PHP_FUNCTION(ibase_pconnect);
-PHP_FUNCTION(ibase_close);
-PHP_FUNCTION(ibase_query);
-PHP_FUNCTION(ibase_fetch_row);
-PHP_FUNCTION(ibase_fetch_object);
-PHP_FUNCTION(ibase_free_result);
-PHP_FUNCTION(ibase_prepare);
-PHP_FUNCTION(ibase_execute);
-PHP_FUNCTION(ibase_free_query);
-PHP_FUNCTION(ibase_timefmt);
-
-PHP_FUNCTION(ibase_num_fields);
-PHP_FUNCTION(ibase_field_info);
-
-PHP_FUNCTION(ibase_trans);
-PHP_FUNCTION(ibase_commit);
-PHP_FUNCTION(ibase_rollback);
-
-PHP_FUNCTION(ibase_blob_create);
-PHP_FUNCTION(ibase_blob_add);
-PHP_FUNCTION(ibase_blob_cancel);
-PHP_FUNCTION(ibase_blob_open);
-PHP_FUNCTION(ibase_blob_get);
-PHP_FUNCTION(ibase_blob_close);
-PHP_FUNCTION(ibase_blob_echo);
-PHP_FUNCTION(ibase_blob_info);
-PHP_FUNCTION(ibase_blob_import);
-
-PHP_FUNCTION(ibase_errmsg);
-
-#define IBASE_MSGSIZE 256
-#define MAX_ERRMSG (IBASE_MSGSIZE*2)
-#define IBASE_TRANS_ON_LINK 10
-#define IBASE_BLOB_SEG 4096
-
-ZEND_BEGIN_MODULE_GLOBALS(ibase)
- ISC_STATUS status[20];
- long default_link;
- long num_links, num_persistent;
- long max_links, max_persistent;
- long allow_persistent;
- char *default_user, *default_password;
- char *timestampformat;
- char *cfg_timestampformat;
- char *dateformat;
- char *cfg_dateformat;
- char *timeformat;
- char *cfg_timeformat;
- char *errmsg;
-ZEND_END_MODULE_GLOBALS(ibase)
-
-typedef struct {
- isc_tr_handle trans[IBASE_TRANS_ON_LINK];
- isc_db_handle link;
- unsigned short dialect;
-} ibase_db_link;
-
-typedef struct {
- int trans_num;
- int link_rsrc;
-} ibase_tr_link;
-
-typedef struct {
- ISC_ARRAY_DESC ar_desc;
- int el_type, /* sqltype kinda SQL_TEXT, ...*/
- el_size; /* element size in bytes */
- ISC_LONG ISC_FAR ar_size; /* all array size in bytes */
-} ibase_array;
-
-typedef struct {
- isc_tr_handle trans_handle;
- isc_db_handle link;
- ISC_QUAD bl_qd;
- isc_blob_handle bl_handle;
-} ibase_blob_handle;
-
-typedef struct {
- isc_db_handle link; /* db link for this result */
- isc_tr_handle trans;
- isc_stmt_handle stmt;
- int drop_stmt;
- XSQLDA *in_sqlda, *out_sqlda;
- ibase_array *in_array, *out_array;
- int in_array_cnt, out_array_cnt;
- unsigned short dialect;
- int cursor_open;
-} ibase_query;
-
-typedef struct {
- isc_db_handle link; /* db link for this result */
- isc_tr_handle trans;
- isc_stmt_handle stmt;
- int drop_stmt;
- XSQLDA *out_sqlda;
- ibase_array *out_array;
-} ibase_result;
-
-typedef struct _php_ibase_varchar {
- short var_len;
- char var_str[1];
-} IBASE_VCHAR;
-
-/* extern ibase_module php_ibase_module; */
-
-enum php_interbase_option {
- PHP_IBASE_DEFAULT = 0,
- PHP_IBASE_TEXT = 1,
- PHP_IBASE_UNIXTIME = 2,
- PHP_IBASE_READ = 4,
- PHP_IBASE_COMMITTED = 8,
- PHP_IBASE_CONSISTENCY = 16,
- PHP_IBASE_NOWAIT = 32,
- PHP_IBASE_TIMESTAMP = 64,
- PHP_IBASE_DATE = 128,
- PHP_IBASE_TIME = 256
-};
-
-#ifdef ZTS
-#define IBLS_D zend_ibase_globals *ibase_globals
-#define IBLS_C ibase_globals
-#define IBG(v) (ibase_globals->v)
-#define IBLS_FETCH() zend_ibase_globals *ibase_globals = ts_resource(ibase_globals_id)
-#else
-#define IBLS_D
-#define IBLS_C
-#define IBG(v) (ibase_globals.v)
-#define IBLS_FETCH()
-#endif
-
-#else
-
-#define phpext_interbase_ptr NULL
-
-#endif /* HAVE_IBASE */
-
-#endif /* PHP_INTERBASE_H */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/interbase/setup.stub b/ext/interbase/setup.stub
deleted file mode 100644
index 3c6a41fe0f..0000000000
--- a/ext/interbase/setup.stub
+++ /dev/null
@@ -1,7 +0,0 @@
-# $Source$
-# $Id$
-
-define_option with-interbase 'InterBase support?' yesnodir \
- 'no /usr/interbase InterBase base install' \
-' Whether to build PHP with InterBase support. More\n
- information about InterBase can be found at http://www.interbase.com/.'
diff --git a/ext/interbase/tests/001.phpt b/ext/interbase/tests/001.phpt
deleted file mode 100644
index 79263d6f5c..0000000000
--- a/ext/interbase/tests/001.phpt
+++ /dev/null
@@ -1,34 +0,0 @@
---TEST--
-InterBase: create test database
---SKIPIF--
-<?php if (!extension_loaded("interbase")) print "skip"; ?>
---POST--
---GET--
---FILE--
-<?
-/* $Id$ */
-
- $test_base = "ibase_test.tmp";
- $name = tempnam("","CREATEDB");
- $ftmp = fopen($name,"w");
- if (is_file($test_base))
- fwrite($ftmp,
- "connect \"$test_base\";
- drop database;\n"
- );
- fwrite($ftmp,
- "create database \"$test_base\";
- create table test1 (
- i integer,
- c varchar(100)
- );
- commit;
- insert into test1(i, c) values(1, 'test table created with isql');
- exit;\n"
- );
- fclose($ftmp);
- exec("isql -i $name 2>&1");
- unlink($name);
-?>
---EXPECT--
-
diff --git a/ext/interbase/tests/002.phpt b/ext/interbase/tests/002.phpt
deleted file mode 100644
index 6ea1b498ba..0000000000
--- a/ext/interbase/tests/002.phpt
+++ /dev/null
@@ -1,35 +0,0 @@
---TEST--
-InterBase: connect, close and pconnect
---SKIPIF--
-<?php if (!extension_loaded("interbase")) print "skip"; ?>
---POST--
---GET--
---FILE--
-<?
-/* $Id$ */
-
- require("interbase/interbase.inc");
-
- $test_base = "ibase_test.tmp";
-
- ibase_connect($test_base);
- out_table("test1");
- ibase_close();
-
- $con = ibase_connect($test_base);
- $pcon1 = ibase_pconnect($test_base);
- $pcon2 = ibase_pconnect($test_base);
- ibase_close($con);
- ibase_close($pcon1);
-
- out_table("test1");
-
- ibase_close($pcon2);
-?>
---EXPECT--
---- test1 ---
-1 test table created with isql
----
---- test1 ---
-1 test table created with isql
----
diff --git a/ext/interbase/tests/003.phpt b/ext/interbase/tests/003.phpt
deleted file mode 100644
index 5398b52850..0000000000
--- a/ext/interbase/tests/003.phpt
+++ /dev/null
@@ -1,93 +0,0 @@
---TEST--
-InterBase: misc sql types (may take a while)
---SKIPIF--
-<?php if (!extension_loaded("interbase")) print "skip"; ?>
---POST--
---GET--
---FILE--
-<?
-/* $Id$ */
-
- require("interbase/interbase.inc");
-
- $test_base = "ibase_test.tmp";
-
- ibase_connect($test_base);
-
- ibase_query(
- "create table test3 (
- iter integer,
- v_char char(1000),
- v_date date,
- v_decimal decimal(12,3),
- v_double double precision,
- v_float float,
- v_integer integer,
- v_numeric numeric(4,2),
- v_smallint smallint,
- v_varchar varchar(10000)
- )");
- ibase_commit();
-
- /* if timefmt is not supported, suppress error here*/
- @ibase_timefmt("%m/%d/%Y %H:%M:%S");
-
- for($iter = 0; $iter < 10; $iter++){
- /* prepare data */
- $v_char = rand_str(1000);
- $v_date = rand_datetime();
- $v_decimal = rand_number(12,3);
- $v_double = rand_number(20);
- $v_float = rand_number(7);
- $v_integer = rand_number(9,0);
- $v_numeric = rand_number(4,2);
- $v_smallint = rand_number(5) % 32767;
- $v_varchar = rand_str(10000);
-
- ibase_query(
- "insert into test3 (iter, v_char,v_date,v_decimal,v_double,v_float,v_integer,v_numeric,v_smallint,v_varchar)
- values ($iter, '$v_char','$v_date',$v_decimal,$v_double,$v_float,$v_integer,$v_numeric,$v_smallint,'$v_varchar')");
- $sel = ibase_query("select * from test3 where iter = $iter");
-
- $row = ibase_fetch_object($sel);
- if(substr($row->V_CHAR,0,strlen($v_char)) != $v_char){
- echo " CHAR fail:\n";
- echo " in: $v_char\n";
- echo " out: $row->V_CHAR\n";
- }
- if($row->V_DATE != $v_date){
- echo " DATE fail\n";
- echo " in: $v_date\n";
- echo " out: $row->V_DATE\n";
- }
- if($row->V_DECIMAL != $v_decimal){
- echo " DECIMAL fail\n";
- echo " in: $v_decimal\n";
- echo " out: $row->V_DECIMAL\n";
- }
- if(abs($row->V_DOUBLE - $v_double) > abs($v_double / 1E15)){
- echo " DOUBLE fail\n";
- echo " in: $v_double\n";
- echo " out: $row->V_DOUBLE\n";
- }
- if(abs($row->V_FLOAT - $v_float) > abs($v_float / 1E7)){
- echo " FLOAT fail\n";
- echo " in: $v_float\n";
- echo " out: $row->V_FLOAT\n";
- }
- if($row->V_INTEGER != $v_integer){
- echo " INTEGER fail\n";
- echo " in: $v_integer\n";
- echo " out: $row->V_INTEGER\n";
- }
- ibase_free_result($sel);
- }/* for($iter)*/
-
- ibase_close();
- echo "end of test\n";
-?>
---EXPECT--
-
-end of test
-
-
diff --git a/ext/interbase/tests/004.phpt b/ext/interbase/tests/004.phpt
deleted file mode 100644
index 04df7ae991..0000000000
--- a/ext/interbase/tests/004.phpt
+++ /dev/null
@@ -1,179 +0,0 @@
---TEST--
-InterBase: BLOB test
---SKIPIF--
-<?php if (!extension_loaded("interbase")) print "skip"; ?>
---POST--
---GET--
---FILE--
-<?
-/* $Id$ */
-
- require("interbase/interbase.inc");
-
- $test_base = "ibase_test.tmp";
-
- ibase_connect($test_base);
-
- ibase_query(
- "create table test4 (
- v_integer integer,
- v_blob blob)");
- ibase_commit();
-
- /* create 10k blob file */
- $blob_str = rand_binstr(10*1024);
-
- $name = tempnam("","blob.tmp");
- $name = "blob.tmp";
- $ftmp = fopen($name,"w");
- fwrite($ftmp,$blob_str);
- fclose($ftmp);
-
- echo "import blob 1\n";
- $ftmp = fopen($name,"r");
- $bl_s = ibase_blob_import($ftmp);
- ibase_query("insert into test4 (v_integer, v_blob) values (1, ?)", $bl_s);
-
- echo "test blob 1\n";
- $q = ibase_query("select v_blob from test4 where v_integer = 1");
- $row = ibase_fetch_object($q);
- $bl_h = ibase_blob_open($row->V_BLOB);
-
- while($piece = ibase_blob_get($bl_h, rand() % 1024))
- $blob .= $piece;
- if($blob != $blob_str)
- echo " BLOB 1 fail\n";
- ibase_blob_close($bl_h);
- ibase_free_result($q);
- unset($blob);
-
- echo "create blob 2\n";
-
- $bl_h = ibase_blob_create();
- $ftmp = fopen($name,"r");
- while($piece = fread($ftmp, rand() % 1024)){
- ibase_blob_add($bl_h, $piece);
- }
- fclose($ftmp);
- $bl_s = ibase_blob_close($bl_h);
- ibase_query("insert into test4 (v_integer, v_blob) values (2, ?)", $bl_s);
-
- echo "test blob 2\n";
-
- $q = ibase_query("select v_blob from test4 where v_integer = 2");
- $row = ibase_fetch_object($q);
- $bl_h = ibase_blob_open($row->V_BLOB);
- while($piece = ibase_blob_get($bl_h, rand() % 1024))
- $blob .= $piece;
- if($blob != $blob_str)
- echo " BLOB 2 fail\n";
- ibase_blob_close($bl_h);
- ibase_free_result($q);
- unset($blob);
-
-
- echo "create blob 3\n";
-
- $bl_h = ibase_blob_create();
-
- ibase_blob_add($bl_h, "+----------------------------------------------------------------------+\n");
- ibase_blob_add($bl_h, "| PHP HTML Embedded Scripting Language Version 3.0 |\n");
- ibase_blob_add($bl_h, "+----------------------------------------------------------------------+\n");
- ibase_blob_add($bl_h, "| Copyright (c) 1997-2000 PHP Development Team (See Credits file) |\n");
- ibase_blob_add($bl_h, "+----------------------------------------------------------------------+\n");
- ibase_blob_add($bl_h, "| This program is free software; you can redistribute it and/or modify |\n");
- ibase_blob_add($bl_h, "| it under the terms of one of the following licenses: |\n");
- ibase_blob_add($bl_h, "| |\n");
- ibase_blob_add($bl_h, "| A) the GNU General Public License as published by the Free Software |\n");
- ibase_blob_add($bl_h, "| Foundation; either version 2 of the License, or (at your option) |\n");
- ibase_blob_add($bl_h, "| any later version. |\n");
- ibase_blob_add($bl_h, "| |\n");
- ibase_blob_add($bl_h, "| B) the PHP License as published by the PHP Development Team and |\n");
- ibase_blob_add($bl_h, "| included in the distribution in the file: LICENSE |\n");
- ibase_blob_add($bl_h, "| |\n");
- ibase_blob_add($bl_h, "| This program is distributed in the hope that it will be useful, |\n");
- ibase_blob_add($bl_h, "| but WITHOUT ANY WARRANTY; without even the implied warranty of |\n");
- ibase_blob_add($bl_h, "| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |\n");
- ibase_blob_add($bl_h, "| GNU General Public License for more details. |\n");
- ibase_blob_add($bl_h, "| |\n");
- ibase_blob_add($bl_h, "| You should have received a copy of both licenses referred to here. |\n");
- ibase_blob_add($bl_h, "| If you did not, or have any questions about PHP licensing, please |\n");
- ibase_blob_add($bl_h, "| contact core@php.net. |\n");
- ibase_blob_add($bl_h, "+----------------------------------------------------------------------+\n");
- $bl_s = ibase_blob_close($bl_h);
- ibase_query("insert into test4 (v_integer, v_blob) values (3, ?)", $bl_s);
-
- echo "echo blob 3\n";
-
- $q = ibase_query("select v_blob from test4 where v_integer = 3");
- $row = ibase_fetch_object($q);
- ibase_blob_echo($row->V_BLOB);
- ibase_free_result($q);
-
- echo "fetch blob 3\n";
- $q = ibase_query("select v_blob from test4 where v_integer = 3");
- $row = ibase_fetch_object($q,IBASE_TEXT);
- echo $row->V_BLOB;
- ibase_free_result($q);
-
- ibase_close();
- unlink($name);
- echo "end of test\n";
-?>
---EXPECT--
-import blob 1
-test blob 1
-create blob 2
-test blob 2
-create blob 3
-echo blob 3
-+----------------------------------------------------------------------+
-| PHP HTML Embedded Scripting Language Version 3.0 |
-+----------------------------------------------------------------------+
-| Copyright (c) 1997-2000 PHP Development Team (See Credits file) |
-+----------------------------------------------------------------------+
-| This program is free software; you can redistribute it and/or modify |
-| it under the terms of one of the following licenses: |
-| |
-| A) the GNU General Public License as published by the Free Software |
-| Foundation; either version 2 of the License, or (at your option) |
-| any later version. |
-| |
-| B) the PHP License as published by the PHP Development Team and |
-| included in the distribution in the file: LICENSE |
-| |
-| This program is distributed in the hope that it will be useful, |
-| but WITHOUT ANY WARRANTY; without even the implied warranty of |
-| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
-| GNU General Public License for more details. |
-| |
-| You should have received a copy of both licenses referred to here. |
-| If you did not, or have any questions about PHP licensing, please |
-| contact core@php.net. |
-+----------------------------------------------------------------------+
-fetch blob 3
-+----------------------------------------------------------------------+
-| PHP HTML Embedded Scripting Language Version 3.0 |
-+----------------------------------------------------------------------+
-| Copyright (c) 1997-2000 PHP Development Team (See Credits file) |
-+----------------------------------------------------------------------+
-| This program is free software; you can redistribute it and/or modify |
-| it under the terms of one of the following licenses: |
-| |
-| A) the GNU General Public License as published by the Free Software |
-| Foundation; either version 2 of the License, or (at your option) |
-| any later version. |
-| |
-| B) the PHP License as published by the PHP Development Team and |
-| included in the distribution in the file: LICENSE |
-| |
-| This program is distributed in the hope that it will be useful, |
-| but WITHOUT ANY WARRANTY; without even the implied warranty of |
-| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
-| GNU General Public License for more details. |
-| |
-| You should have received a copy of both licenses referred to here. |
-| If you did not, or have any questions about PHP licensing, please |
-| contact core@php.net. |
-+----------------------------------------------------------------------+
-end of test
diff --git a/ext/interbase/tests/005.phpt b/ext/interbase/tests/005.phpt
deleted file mode 100644
index 5cf77667e0..0000000000
--- a/ext/interbase/tests/005.phpt
+++ /dev/null
@@ -1,275 +0,0 @@
---TEST--
-InterBase: transactions
---SKIPIF--
-<?php if (!extension_loaded("interbase")) print "skip"; ?>
---POST--
---GET--
---FILE--
-<?
-/* $Id$ */
-
- require("interbase/interbase.inc");
-
- $test_base = "ibase_test.tmp";
-
- ibase_connect($test_base);
-
- @ibase_query("create table test5 (i integer)");
- @ibase_query("delete from test5");
- ibase_close();
-
-
- echo "default transaction:\n";
-
-/*
-Difference between default and other transactions:
-default commited when you call ibase_close().
-Other transaction doing rollback.
-
-If you not open default transaction with
-ibase_trans, default transaction open
-when you call ibase_query(), ibase_prepare(),
-ibase_blob_create(), ibase_blob_import() first time.
-*/
-
-/*
-simple default transaction test without ibase_trans()
-*/
-
- ibase_connect($test_base);
-
- echo "empty table\n";
-
- /* out_table call ibase_query()
- and ibase_query() start default transaction */
- out_table("test5");
-
- /* in default transaction context */
- ibase_query("insert into test5 (i) values (1)");
-
- echo "one row\n";
- out_table("test5");
-
- ibase_rollback(); /* default rolled */
-
- echo "after rollback table empty again\n";
- out_table("test5"); /* started new default transaction */
-
- ibase_query("insert into test5 (i) values (2)");
-
- ibase_close(); /* commit here! */
-
- ibase_connect($test_base);
-
- echo "one row\n";
- out_table("test5");
- ibase_close();
-
-/*
-default transaction on default link
-First open transaction on link will be default.
-$tr_def_l1 may be ommited. All queryes without link and trans
-parameters run in this context
-*/
-
- $link_def = ibase_connect($test_base);
-
- $tr_def_l1 = ibase_trans(IBASE_READ); /* here transaction start */
-
- /* all default */
- $res = ibase_query("select * from test5");
-
- echo "one row\n";
- out_result($res,"test5");
-
- ibase_free_result($res);
-
- /* specify transaction context... */
- $res = ibase_query($tr_def_l1, "select * from test5");
-
- echo "one row... again.\n";
- out_result($res,"test5");
-
- ibase_free_result($res);
-
- /* specify default transaction on link */
- $res = ibase_query($link_def, "select * from test5");
-
- echo "one row.\n";
- out_result($res,"test5");
-
- ibase_free_result($res);
-
- ibase_rollback($link_def); /* just for example */
-
- ibase_close();
-
-/*
-three transaction on default link
-*/
- ibase_connect($test_base);
-
- $tr_1 = ibase_trans(); /* this default transaction also */
- $tr_2 = ibase_trans(IBASE_READ);
- $tr_3 = ibase_trans(IBASE_READ+IBASE_COMMITED);
-
- $res = ibase_query("select * from test5");
-
- echo "one row\n";
- out_result($res,"test5");
-
- ibase_free_result($res);
-
- /* insert in first transaction context... */
- /* as default */
- ibase_query("insert into test5 (i) values (3)");
- /* specify context */
- ibase_query($tr_1, "insert into test5 (i) values (4)");
-
- $res = ibase_query("select * from test5");
-
- echo "three rows\n";
- out_result($res,"test5");
-
- ibase_free_result($res);
-
- $res = ibase_query($tr_1, "select * from test5");
-
- echo "three rows again\n";
- out_result($res,"test5");
-
- ibase_free_result($res);
-
- ibase_commit($tr_1);
-
- $res = ibase_query($tr_2, "select * from test5");
-
- echo "one row in second transaction\n";
- out_result($res,"test5");
-
- ibase_free_result($res);
-
- $res = ibase_query($tr_3, "select * from test5");
-
- echo "three rows in third transaction\n";
- out_result($res,"test5");
-
- ibase_free_result($res);
-
- ibase_close();
-
-/*
-transactions on second link
-*/
- $link_1 = ibase_pconnect($test_base);
- $link_2 = ibase_pconnect($test_base);
-
- $tr_1 = ibase_trans($link_2, IBASE_DEFAULT); /* this default transaction also */
- $tr_2 = ibase_trans($link_2, IBASE_COMMITED);
-
- $res = ibase_query($tr_1, "select * from test5");
-
- echo "three rows\n";
- out_result($res,"test5");
-
- ibase_free_result($res);
-
- ibase_query($tr_1, "insert into test5 (i) values (5)");
-
- $res = ibase_query($tr_1, "select * from test5");
-
- echo "four rows\n";
- out_result($res,"test5");
-
- ibase_free_result($res);
-
- ibase_commit($tr_1);
-
- $res = ibase_query($tr_2, "select * from test5");
-
- echo "four rows again\n";
- out_result($res,"test5");
-
- ibase_free_result($res);
-
- ibase_close($link_1);
- ibase_close($link_2);
-
- echo "end of test\n";
-?>
---EXPECT--
-default transaction:
-empty table
---- test5 ---
----
-one row
---- test5 ---
-1
----
-after rollback table empty again
---- test5 ---
----
-one row
---- test5 ---
-2
----
-one row
---- test5 ---
-2
----
-one row... again.
---- test5 ---
-2
----
-one row.
---- test5 ---
-2
----
-one row
---- test5 ---
-2
----
-three rows
---- test5 ---
-2
-3
-4
----
-three rows again
---- test5 ---
-2
-3
-4
----
-one row in second transaction
---- test5 ---
-2
----
-three rows in third transaction
---- test5 ---
-2
-3
-4
----
-three rows
---- test5 ---
-2
-3
-4
----
-four rows
---- test5 ---
-2
-3
-4
-5
----
-four rows again
---- test5 ---
-2
-3
-4
-5
----
-end of test
-
diff --git a/ext/interbase/tests/006.phpt b/ext/interbase/tests/006.phpt
deleted file mode 100644
index bad07e3315..0000000000
--- a/ext/interbase/tests/006.phpt
+++ /dev/null
@@ -1,227 +0,0 @@
---TEST--
-InterBase: binding (may take a while)
---SKIPIF--
-<?php if (!extension_loaded("interbase")) print "skip"; ?>
---POST--
---GET--
---FILE--
-<?
-/* $Id$ */
-
- require("interbase/interbase.inc");
-
- $test_base = "ibase_test.tmp";
-
- ibase_connect($test_base);
-
- ibase_query(
- "create table test6 (
- iter integer,
- v_char char(1000),
- v_date date,
- v_decimal decimal(12,3),
- v_double double precision,
- v_float float,
- v_integer integer,
- v_numeric numeric(4,2),
- v_smallint smallint,
- v_varchar varchar(10000)
- )");
- ibase_commit();
-
- /* if timefmt not supported, hide error */
- @ibase_timefmt("%m/%d/%Y %H:%M:%S");
-
- echo "insert\n";
-
- for($iter = 0; $iter < 3; $iter++){
- /* prepare data */
- $v_char = rand_str(1000);
- $v_date = rand_datetime();
- $v_decimal = rand_number(12,3);
- $v_double = rand_number(20);
- $v_float = rand_number(7);
- $v_integer = rand_number(9,0);
- $v_numeric = rand_number(4,2);
- $v_smallint = rand_number(5) % 32767;
- $v_varchar = rand_str(10000);
-
- ibase_query("insert into test6
- (iter,v_char,v_date,v_decimal,v_double,v_float,
- v_integer,v_numeric,v_smallint,v_varchar)
- values (?,?,?,?,?,?,?,?,?,?)",
- $iter, $v_char, $v_date, $v_decimal, $v_double, $v_float,
- $v_integer, $v_numeric, $v_smallint, $v_varchar);
- $sel = ibase_query("select * from test6 where iter = $iter");
-
- $row = ibase_fetch_object($sel);
- if(substr($row->V_CHAR,0,strlen($v_char)) != $v_char){
- echo " CHAR fail:\n";
- echo " in: $v_char\n";
- echo " out: $row->V_CHAR\n";
- }
- if($row->V_DATE != $v_date){
- echo " DATE fail\n";
- echo " in: $v_date\n";
- echo " out: $row->V_DATE\n";
- }
- if($row->V_DECIMAL != $v_decimal){
- echo " DECIMAL fail\n";
- echo " in: $v_decimal\n";
- echo " out: $row->V_DECIMAL\n";
- }
- if(abs($row->V_DOUBLE - $v_double) > abs($v_double / 1E15)){
- echo " DOUBLE fail\n";
- echo " in: $v_double\n";
- echo " out: $row->V_DOUBLE\n";
- }
- if(abs($row->V_FLOAT - $v_float) > abs($v_float / 1E7)){
- echo " FLOAT fail\n";
- echo " in: $v_float\n";
- echo " out: $row->V_FLOAT\n";
- }
- if($row->V_INTEGER != $v_integer){
- echo " INTEGER fail\n";
- echo " in: $v_integer\n";
- echo " out: $row->V_INTEGER\n";
- }
- ibase_free_result($sel);
- }/* for($iter)*/
-
- echo "select\n";
- for($iter = 0; $iter < 3; $iter++){
- /* prepare data */
- $v_char = rand_str(1000);
- $v_date = rand_datetime();
- $v_decimal = rand_number(12,3);
- $v_double = rand_number(20);
- $v_float = rand_number(7);
- $v_integer = rand_number(9,0);
- $v_numeric = rand_number(4,2);
- $v_smallint = rand_number(5) % 32767;
- $v_varchar = rand_str(10000);
-
- /* clear table*/
- ibase_query("delete from test6");
-
- /* make one record */
- ibase_query("insert into test6
- (iter, v_char,v_date,v_decimal,
- v_integer,v_numeric,v_smallint,v_varchar)
- values (666, '$v_char','$v_date',$v_decimal, $v_integer,
- $v_numeric, $v_smallint, '$v_varchar')");
-
- /* test all types */
- if(!($sel = ibase_query(
- "select iter from test6 where v_char = ?", $v_char)))
- echo "CHAR fail\n";
- ibase_free_result($sel);
- if(!($sel = ibase_query(
- "select iter from test6 where v_date = ?", $v_date)))
- echo "DATE fail\n";
- ibase_free_result($sel);
- if(!($sel = ibase_query(
- "select iter from test6 where v_decimal = ?", $v_decimal)))
- echo "DECIMAL fail\n";
- ibase_free_result($sel);
- if(!($sel = ibase_query(
- "select iter from test6 where v_integer = ?", $v_integer)))
- echo "INTEGER fail\n";
- ibase_free_result($sel);
- if(!($sel = ibase_query(
- "select iter from test6 where v_numeric = ?", $v_numeric)))
- echo "NUMERIC fail\n";
- ibase_free_result($sel);
- if(!($sel = ibase_query(
- "select iter from test6 where v_smallint = ?", $v_smallint)))
- echo "SMALLINT fail\n";
- ibase_free_result($sel);
- if(!($sel = ibase_query(
- "select iter from test6 where v_varchar = ?", $v_varchar)))
- echo "VARCHAR fail\n";
- ibase_free_result($sel);
-
- }/*for iter*/
-
- echo "prepare and exec insert\n";
-
- /* prepare table */
- ibase_query("delete from test6");
-
- /* prepare query */
- $query = ibase_prepare(
- "insert into test6 (v_integer) values (?)");
-
- for($i = 0; $i < 10; $i++)
- ibase_execute($query, $i);
-
- out_table("test6");
-
- ibase_free_query($query);
-
-
- echo "prepare and exec select\n";
-
- /* prepare query */
- $query = ibase_prepare("select * from test6
- where v_integer between ? and ?");
-
- $low_border = 2;
- $high_border = 6;
-
- $res = ibase_execute($query, $low_border, $high_border);
- out_result($res, "test6");
- ibase_free_result($res);
-
- $low_border = 0;
- $high_border = 4;
- $res = ibase_execute($query, $low_border, $high_border);
- out_result($res, "test6");
- ibase_free_result($res);
-
- $res = ibase_execute($query, "5", 7.5);
- out_result($res, "test6");
- ibase_free_result($res);
-
- ibase_free_query($query);
- ibase_close();
- echo "end of test\n";
-?>
---EXPECT--
-insert
-select
-prepare and exec insert
---- test6 ---
- 0
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
----
-prepare and exec select
---- test6 ---
- 2
- 3
- 4
- 5
- 6
----
---- test6 ---
- 0
- 1
- 2
- 3
- 4
----
---- test6 ---
- 5
- 6
- 7
----
-end of test
-
diff --git a/ext/interbase/tests/extension b/ext/interbase/tests/extension
deleted file mode 100755
index 3b561c46a9..0000000000
--- a/ext/interbase/tests/extension
+++ /dev/null
@@ -1 +0,0 @@
-InterBase
diff --git a/ext/interbase/tests/interbase.inc b/ext/interbase/tests/interbase.inc
deleted file mode 100755
index f261cb01b5..0000000000
--- a/ext/interbase/tests/interbase.inc
+++ /dev/null
@@ -1,77 +0,0 @@
-<?
-/* $Id$ */
-/* used in tests */
-
-srand((double)microtime()*1000000);
-
-function out_table($table_name)
-{
- echo "--- $table_name ---\n";
- $res = ibase_query("select * from $table_name");
- $f = ibase_num_fields($res);
- while ($r = ibase_fetch_row($res)){
- for($i = 0; $i < $f; $i++)
- echo "$r[$i]\t";
- echo "\n";
- }
- ibase_free_result($res);
- echo "---\n";
-}
-
-function out_result($result, $table_name = "")
-{
- echo "--- $table_name ---\n";
- $f = ibase_num_fields($result);
- while ($r = ibase_fetch_row($result)){
- for($i = 0; $i < $f; $i++)
- echo "$r[$i]\t";
- echo "\n";
- }
- echo "---\n";
-}
-
-/* M/D/Y H:M:S */
-function rand_datetime()
-{
- return sprintf("%02d/%02d/%4d %02d:%02d:%02d",
- rand()%12+1, rand()%28+1, rand()%100+1910,
- rand()%24, rand()%60, rand()%60);
-}
-
-/* random binary string */
-function rand_binstr($max_len)
-{
- $len = rand() % $max_len;
- $s = "";
- while($len--)
- $s .= sprintf("%c", rand() % 256);
- return $s;
-}
-
-function rand_str($max_len)
-{
- $len = rand() % $max_len;
- $s = "";
- while($len--)
- $s .= sprintf("%c", rand() % 26 + 65);;
- return $s;
-}
-
-function rand_number($len , $prec = -1, $sign = 1)
-{
- if($prec == -1){
- $n = substr(rand() . rand(), 0, rand() % $len + 1);
- if(strlen($n) < $len)
- $n .= "." . substr(rand(), 0, rand() % ($len - strlen($n)) + 1);
- }elseif ($prec == 0){
- $n = substr(rand() . rand(), 0, rand() % $len + 1);
- }else{
- $n = substr(rand() . rand(), 0, rand() % ($len - $prec) + 1);
- $n .= "." . substr(rand(), 0, $prec);
- }
- if($sign && (rand() % 3 == 0))
- $n = "-" .$n;
- return $n;
-}
-
-?> \ No newline at end of file
diff --git a/ext/java/CREDITS b/ext/java/CREDITS
deleted file mode 100644
index f49489bcf8..0000000000
--- a/ext/java/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-Java
-Sam Ruby
diff --git a/ext/java/Makefile.in b/ext/java/Makefile.in
deleted file mode 100644
index 2a980157d2..0000000000
--- a/ext/java/Makefile.in
+++ /dev/null
@@ -1,25 +0,0 @@
-
-LTLIBRARY_SHARED_NAME = libphp_java.la
-LTLIBRARY_SOURCES = java.c
-LTLIBRARY_DEPENDENCIES = php_java.jar
-
-LTLIBRARY_LDFLAGS = $(EXTRA_LDFLAGS) $(LDFLAGS) $(PHP_RPATHS)
-LTLIBRARY_SHARED_LIBADD = $(LTLIBRARY_DEPENDENCIES) $(EXTRA_LIBS)
-
-EXTRA_CFLAGS = $(JAVA_CFLAGS)
-EXTRA_INCLUDES = $(JAVA_INCLUDE)
-
-make_shared = yes
-
-include $(top_srcdir)/build/dynlib.mk
-
-php_java.jar : reflect.java
- $(mkinstalldirs) net/php
- @cp $(srcdir)/reflect.java net/php
- @echo library=php_java>net/php/reflect.properties
- javac net/php/reflect.java
- @test ! -f reflect.class || mv reflect.class net/php # bug in KJC javac
- $(JAVA_JAR) php_java.jar net/php/*.class net/php/*.properties
- @rm net/php/reflect.*
- @rmdir net/php
- @rmdir net
diff --git a/ext/java/README b/ext/java/README
deleted file mode 100644
index 1cfdc113eb..0000000000
--- a/ext/java/README
+++ /dev/null
@@ -1,243 +0,0 @@
-What is PHP4 ext/java?
-
- PHP4 ext/java provides a simple and effective means for creating and
- invoking methods on Java objects from PHP. The JVM is created using JNI,
- and everything runs in-process.
-
- Two examples are provided, jver and jawt, to illustrate usage of this
- extension. A few things to note:
-
- 1) new Java() will create an instance of a class if a suitable constructor
- is available. If no parameters are passed and the default constructor
- is useful as it provides access to classes like "java.lang.System"
- which expose most of their functionallity through static methods.
-
- 2) Accessing a member of an instance will first look for bean properties
- then public fields. In other words, "print $date.time" will first
- attempt to be resolved as "$date.getTime()", then as "$date.time";
-
- 3) Both static and instance members can be accessed on an object with
- the same syntax. Furthermore, if the java object is of type
- "java.lang.Class", then static members of the class (fields and
- methods) can be accessed.
-
- 4) Exceptions raised result in PHP warnings, and null results. The
- warnings may be eliminated by prefixing the method call with an
- "@" sign. The following APIs may be used to retrieve and reset
- the last error:
-
- java_last_exception_get()
- java_last_exception_clear()
-
- 5) Overload resolution is in general a hard problem given the
- differences in types between the two languages. The PHP Java
- extension employs a simple, but fairly effective, metric for
- determining which overload is the best match.
-
- Additionally, method names in PHP are not case sensitive, potentially
- increasing the number of overloads to select from.
-
- Once a method is selected, the parameters are cooerced if necessary,
- possibly with a loss of data (example: double precision floating point
- numbers will be converted to boolean).
-
- 6) In the tradition of PHP, arrays and hashtables may pretty much
- be used interchangably. Note that hashtables in PHP may only be
- indexed by integers or strings; and that arrays of primitive types
- in Java can not be sparse. Also note that these constructs are
- passed by value, so may be expensive in terms of memory and time.
-
-Build and execution instructions:
-
- Given the number of platforms and providers of JVMs, no single set of
- instructions will be able to cover all cases. So in place of hard and
- fast instructions, below are a working examples for a number of free and
- commercial implementations and platforms. Please adjust the paths to
- suit your installation. Also, if you happen to get this to work on
- another JVM/platform combination, please let me know, particularly if
- a unique build or execution setup was required.
-
- Note for Windows users: semi-colons (";") mark the beginning of
- comments in php.ini files, so if you wish to add to the classpath,
- make sure that the entire string is in quotes. See the JDK 1.1.8
- instructions below for an example.
-
- This function has been tested in both CGI and Apache (apxs) modes. As
- the current design requires shared libraries, this support can not be
- linked statically into Apache.
-
- With ext/java, no Java Virtual Machines are created until the first
- Java call is made. This not only eliminates unnecessary overhead if
- the extension is never used, it also provides error messages directly
- back to the user instead of being burried in a log some place.
-
- For people interested in robustness, performance, and more complete
- integration with Java, consider using the sapi/servlet interface which
- is built upon the Java extension. Running PHP as a servlet enables PHP
- to utilize the existing JVM and threads from the servlet engine, and
- provides direct access to the servlet request and response objects.
-
- Finally, the bottom of this readme contains some guidance for how to
- approach situations in which these instructions don't work on your
- machine.
-
-========================================================================
-=== JVM=Kaffe 1.0.4 (as delivered with OS), OS=Redhat Linux 6.1 ===
-========================================================================
-
-build instructions:
-
- ./configure --with-java
-
-php.ini:
-
- [java]
- java.library.path=/usr/lib/kaffe:/home/rubys/php4/modules
- java.class.path=/usr/share/kaffe/Klasses.jar:/home/rubys/php4/modules/php_java.jar
- extension_dir=/home/rubys/php4/modules
- extension=libphp_java.so
-
-========================================================================
-=== JVM=Kaffe 1.0.5 (built from source), OS=Redhat Linux 6.1 ===
-========================================================================
-
-build instructions:
-
- ./configure --with-java
-
-php.ini:
-
- [java]
- java.library.path=/usr/local/lib/kaffe:/home/rubys/php4/modules
- java.class.path=/usr/local/share/kaffe/Klasses.jar:/home/rubys/php4/modules/php_java.jar
- extension_dir=/home/rubys/php4/modules
- extension=libphp_java.so
-
-========================================================================
-=== JVM=IBM 1.1.8, OS=Redhat Linux 6.1 ===
-========================================================================
-
-build instructions:
-
- ./configure --with-java
-
-php.ini:
-
- [java]
- java.class.path=/home/jdk118/lib/classes.zip:/home/rubys/php4/modules/php_java.jar
- extension_dir=/home/rubys/php4/modules
- extension=libphp_java.so
-
-========================================================================
-=== JVM=Blackdown 1.2.2 RC4, OS=Redhat Linux 6.1 ===
-========================================================================
-
-build instructions:
-
- ./configure --with-java
-
-php.ini:
-
- [java]
- java.class.path=/home/rubys/php4/lib/php_java.jar
- extension_dir=/home/rubys/php4/modules
- extension=libphp_java.so
-
-========================================================================
-=== JVM=Sun JDK 1.2.2, OS=Linux ===
-========================================================================
-
-build instructions:
-
- ./configure --with-java
-
-php.ini:
-
- [java]
- java.class.path=/home/rubys/php4/lib/php_java.jar
- java.library.path=/home/rubys/php4/modules
- extension_dir=/home/rubys/php4/modules
- extension=libphp_java.so
-
-========================================================================
-=== JVM=Sun JDK 1.1.8, OS=Windows NT 4 ===
-========================================================================
-
-build instructions:
-
- SET JAVA_HOME=D:\jdk1.1.8
- msdev ext\java\java.dsp /MAKE "java - Win32 Debug_TS"
-
-php.ini:
-
- [java]
- java.class.path="D:\jdk1.1.8\lib\classes.zip;F:\PHP4\Debug_TS\php_java.jar"
- extension=php_java.dll
-
-========================================================================
-=== JVM=Sun JDK 1.2.2, OS=Windows NT 4 ===
-========================================================================
-
-build instructions:
-
- SET JAVA_HOME=D:\jdk1.2.2
- msdev ext\java\java.dsp /MAKE "java - Win32 Debug_TS"
-
-php.ini:
-
- [java]
- java.class.path=F:\PHP4\Debug_TS\php_java.jar
- extension=php_java.dll
-
-=========================================================================
-
-Guidance for when these instructions don't work.
-
- JDK vendors don't typically document their internal workings, and are
- typically very reliant on code inside of the JAVA main program and the
- installation directory structure. For this reason, running PHP as a
- servlet is typically much easier to get working. But if for some reason
- this is not appropriate for you, and the instructions above don't work,
- then read on.
-
- The first thing to realize is that the directory structure of the JDK is
- very important. Some users (particularly on Windows) get a message about
- a DLL or shared library not being available and proceed to find that file
- and copy it into a system directory. This typically just gets you to the
- next problem - for example, it appears that many JDKs attempt to locate
- the runtime Java classes (rt.jar) in a directory relative to these system
- libraries. So unless you are inclined to copy your entire Java
- installation, you are much better adjusting your PATHs.
-
- Not documented above, but useful for many JDK's is ability to specify the
- library path via java.library.path in the php.ini. On many Unix machines,
- determining the initial value for this can be done by changing directory
- to where you find a shared library that can't be loaded (example:
- libjava.so), and executing "ld libjava.so". If you see some modules
- listed as "not found", add the necessary directories to LD_LIBRARY_PATH
- and repeat until successful. On my system, I require the following
- two directories.
-
- /home/jdk1.2.2/jre/lib/i386/native_threads
- /home/jdk1.2.2/jre/lib/i386/classic
-
- Note: this only determines the statically loaded libraries. Additional
- libraries (such as libzip.so) may be loaded dynamically. On my system,
- libzip.so is located in
-
- /home/jdk1.2.2/jre/lib/i386
-
- Another php.ini variable which may be helpful is java.home.
-
- If java.library.path doesn't work for you (it won't on any JDK 1.1
- implementations, for example), then try setting the system PATH or the
- LD_LIBRARY_PATH before starting your web server. For Apache on Linux
- systems, this can be accomplished by editing the Root's .bashrc and
- adding the necessary export LD_LIBRARY_PATH statement.
-
- If that doesn't work, try dividing an (hopefully) conquering by temporarily
- eliminating items such as Apache from the process by adjusting the
- arguments passed to the ./configure command (i.e., removing --with-apxs).
-
- If all else fails, "man dlopen" on Unix systems will give more insight on
- what the system is trying to do internally.
diff --git a/ext/java/config.m4 b/ext/java/config.m4
deleted file mode 100644
index 34aa68a27f..0000000000
--- a/ext/java/config.m4
+++ /dev/null
@@ -1,118 +0,0 @@
-# $Id$
-# config.m4 for extension java
-
-AC_MSG_CHECKING(for Java support)
-AC_ARG_WITH(java,
-[ --with-java[=DIR] Include Java support. DIR is the base install
- directory for the JDK. This extension can only
- be built as a shared dl.],
-[
- if test "$withval" != "no"; then
- JAVA_SHARED=libphp_java.la
-
- pltform=`uname -s 2>/dev/null`
- java_libext=libjava.so
- case $pltform in
- AIX) java_libext=libjava.a ;;
- HP-UX) java_libext=libjava.sl ;;
- esac
- # substitute zip for systems which don't have jar in the PATH
- if JAVA_JAR=`which jar 2>/dev/null`; then
- JAVA_JAR="$JAVA_JAR cf"
- else
- JAVA_JAR='zip -q0'
- fi
-
- if test "$withval" = "yes"; then
- withval=`cd \`dirname \\\`which javac\\\`\`/..;pwd`
- fi
-
- if test -d $withval/lib/kaffe; then
- PHP_ADD_LIBPATH($withval/lib)
- PHP_ADD_LIBPATH($withval/lib/kaffe)
-
- JAVA_CFLAGS=-DKAFFE
- JAVA_INCLUDE=-I$withval/include/kaffe
- JAVA_CLASSPATH=$withval/share/kaffe/Klasses.jar
- JAVA_LIB=kaffevm
- java_libext=kaffevm
-
- test -f $withval/lib/$JAVA_LIB && JAVA_LIBPATH=$withval/lib
- test -f $withval/lib/kaffe/$JAVA_LIB && JAVA_LIBPATH=$withval/lib/kaffe
-
- # accomodate old versions of kaffe which don't support jar
- if kaffe -version 2>&1 | grep 1.0b > /dev/null; then
- JAVA_JAR='zip -q0'
- fi
-
- elif test -f $withval/lib/$java_libext; then
- JAVA_LIB=java
- JAVA_LIBPATH=$withval/lib
- JAVA_INCLUDE=-I$withval/include
- test -f $withval/lib/classes.zip && JAVA_CFLAGS=-DJNI_11
- test -f $withval/lib/jvm.jar && JAVA_CFLAGS=-DJNI_12
- test -f $withval/lib/classes.zip && JAVA_CLASSPATH=$withval/lib/classes.zip
- test -f $withval/lib/jvm.jar && JAVA_CLASSPATH=$withval/lib/jvm.jar
- for i in $JAVA_INCLUDE/*; do
- test -f $i/jni_md.h && JAVA_INCLUDE="$JAVA_INCLUDE $i"
- done
-
- else
-
- for i in `find $withval/include -type d`; do
- test -f $i/jni.h && JAVA_INCLUDE=-I$i
- test -f $i/jni_md.h && JAVA_INCLUDE="$JAVA_INCLUDE -I$i"
- done
-
- for i in `find $withval -type d`; do
- test -f $i/classes.zip && JAVA_CFLAGS=-DJNI_11
- test -f $i/rt.jar && JAVA_CFLAGS=-DJNI_12
- test -f $i/classes.zip && JAVA_CLASSPATH=$i/classes.zip
- test -f $i/rt.jar && JAVA_CLASSPATH=$i/rt.jar
-
- if test -f $i/$java_libext; then
- JAVA_LIB=java
- JAVA_LIBPATH=$i
- test -d $i/hotspot && PHP_ADD_LIBPATH($i/hotspot)
- test -d $i/classic && PHP_ADD_LIBPATH($i/classic)
- test -d $i/server && PHP_ADD_LIBPATH($i/server)
- test -d $i/native_threads && PHP_ADD_LIBPATH($i/native_threads)
- fi
- done
-
- if test -z "$JAVA_INCLUDE"; then
- AC_MSG_RESULT(no)
- AC_MSG_ERROR(unable to find Java VM libraries)
- fi
-
- JAVA_CFLAGS="$JAVA_CFLAGS -D_REENTRANT"
- fi
-
- AC_DEFINE(HAVE_JAVA,1,[ ])
- PHP_ADD_LIBPATH($JAVA_LIBPATH)
- JAVA_CFLAGS="$JAVA_CFLAGS '-DJAVALIB=\"$JAVA_LIBPATH/$java_libext\"'"
-
- if test "$PHP_SAPI" != "servlet"; then
- PHP_EXTENSION(java, shared)
-
- if test "$PHP_SAPI" = "cgi"; then
- PHP_ADD_LIBRARY($JAVA_LIB)
- fi
-
- INSTALL_IT="$INSTALL_IT; \$(srcdir)/build/shtool mkdir -p -f -m 0755 \$(INSTALL_ROOT)\$(libdir)"
- INSTALL_IT="$INSTALL_IT; \$(INSTALL) -m 0755 \$(srcdir)/ext/java/php_java.jar \$(INSTALL_ROOT)\$(libdir)"
- fi
-
- AC_MSG_RESULT(yes)
- else
- AC_MSG_RESULT(no)
- fi
-],[
- AC_MSG_RESULT(no)
-])
-
-PHP_SUBST(JAVA_CFLAGS)
-PHP_SUBST(JAVA_CLASSPATH)
-PHP_SUBST(JAVA_INCLUDE)
-PHP_SUBST(JAVA_SHARED)
-PHP_SUBST(JAVA_JAR)
diff --git a/ext/java/except.php b/ext/java/except.php
deleted file mode 100644
index a7e6a79c08..0000000000
--- a/ext/java/except.php
+++ /dev/null
@@ -1,23 +0,0 @@
-<?
- $stack=new Java("java.util.Stack");
- $stack->push(1);
-
- #
- # Should succeed and print out "1"
- #
- $result = $stack->pop();
- $ex = java_last_exception_get();
- if (!$ex) print "$result\n";
-
- #
- # Should fail - note the "@" eliminates the warning
- #
- $result=@$stack->pop();
- $ex=java_last_exception_get();
- if ($ex) print $ex->toString();
-
- #
- # Reset last exception
- #
- java_last_exception_clear();
-?>
diff --git a/ext/java/java.c b/ext/java/java.c
deleted file mode 100644
index 27bfc1e14c..0000000000
--- a/ext/java/java.c
+++ /dev/null
@@ -1,795 +0,0 @@
- /*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Sam Ruby (rubys@us.ibm.com) |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-/*
- * This module implements Zend OO syntax overloading support for Java
- * components using JNI and reflection.
- */
-
-
-#include "php.h"
-#include "zend_compile.h"
-#include "php_ini.h"
-#include "php_globals.h"
-
-#ifdef PHP_WIN32
- #include "win32/winutil.h"
- #define DL_ERROR php_win_err()
-#else
- #define DL_ERROR dlerror()
-#endif
-
-#include <jni.h>
-
-#include <stdio.h>
-
-#define IS_EXCEPTION 86
-
-/***************************************************************************/
-
-#ifndef KAFFE
-#ifndef JNI_11
-#ifndef JNI_12
-
-#ifdef JNI_VERSION_1_2
-#define JNI_12
-#else
-#define JNI_11
-#endif
-
-#endif
-#endif
-#endif
-
-#ifdef PHP_WIN32
-#ifdef JNI_12
-#define JAVALIB "jvm.dll"
-#else
-#define JAVALIB "javai.dll"
-#endif
-#else
-#endif
-
-/***************************************************************************/
-
-static int le_jobject = 0;
-
-static char *classpath = 0;
-static char *libpath = 0;
-static char *javahome = 0;
-static char *javalib = 0;
-
-static int iniUpdated = 0;
-static void *dl_handle = 0;
-
-typedef struct {
- JavaVM *jvm;
- JNIEnv *jenv;
- jobject php_reflect;
- jclass reflect_class;
-} php_java_globals;
-
-#ifdef ZTS
-#define JG(v) (java_globals->v)
-#define JG_FETCH() php_java_globals *java_globals = ts_resource(java_globals_id)
-#define JG_D php_java_globals *java_globals
-#define JG_DC , JG_D
-#define JG_C java_globals
-#define JG_CC , JG_C
-int java_globals_id;
-#else
-#define JG(v) (java_globals.v)
-#define JG_FETCH()
-#define JG_D
-#define JG_DC
-#define JG_C
-#define JG_CC
-php_java_globals java_globals;
-#endif
-
-static zend_class_entry java_class_entry;
-
-static PHP_INI_MH(OnIniUpdate) {
- if (new_value) *(char**)mh_arg1 = new_value;
- iniUpdated=1;
- return SUCCESS;
-}
-
-PHP_INI_BEGIN()
- PHP_INI_ENTRY1("java.class.path",
- NULL, PHP_INI_ALL, OnIniUpdate, &classpath)
-#ifndef JNI_11
- PHP_INI_ENTRY1("java.home",
- NULL, PHP_INI_ALL, OnIniUpdate, &javahome)
- PHP_INI_ENTRY1("java.library.path",
- NULL, PHP_INI_ALL, OnIniUpdate, &libpath)
-#endif
-#ifdef JAVALIB
- PHP_INI_ENTRY1("java.library",
- JAVALIB, PHP_INI_ALL, OnIniUpdate, &javalib)
-#else
- PHP_INI_ENTRY1("java.library",
- NULL, PHP_INI_ALL, OnIniUpdate, &javalib)
-#endif
-PHP_INI_END()
-
-/***************************************************************************/
-
-/*
- * Destroy a Java Virtual Machine.
- */
-void jvm_destroy() {
- JG_FETCH();
-
- if (JG(php_reflect)) (*JG(jenv))->DeleteGlobalRef(JG(jenv), JG(php_reflect));
- if (JG(jvm)) {
- (*JG(jvm))->DetachCurrentThread(JG(jvm));
- (*JG(jvm))->DestroyJavaVM(JG(jvm));
- JG(jvm) = 0;
- }
- if (dl_handle) DL_UNLOAD(dl_handle);
- JG(php_reflect) = 0;
- JG(jenv) = 0;
-}
-
-/*
- * Create a Java Virtual Machine.
- * - class.path, home, and library.path are read out of the INI file
- * - appropriate (pre 1.1, JDK 1.1, and JDK 1.2) initialization is performed
- * - net.php.reflect class file is located
- */
-
-#ifdef JNI_12
-static void addJVMOption(JavaVMInitArgs *vm_args, char *name, char *value) {
- char *option = (char*) malloc(strlen(name) + strlen(value) + 1);
- strcpy(option, name);
- strcat(option, value);
- vm_args->options[vm_args->nOptions++].optionString = option;
-}
-#endif
-
-static int jvm_create() {
- int rc;
- jobject local_php_reflect;
- jthrowable error;
-
- jint (JNICALL *JNI_CreateVM)(const void*,const void*,void*);
-#ifndef JNI_12
- jint (JNICALL *JNI_DefaultArgs)(void*);
-#endif
-
-#ifdef JNI_11
- JDK1_1InitArgs vm_args;
-#else
- JavaVMInitArgs vm_args;
-#ifdef JNI_12
- JavaVMOption options[3];
-#endif
-#endif
-
- JG_FETCH();
-
- iniUpdated=0;
-
- if (javalib) {
- dl_handle = DL_LOAD(javalib);
-
- if (!dl_handle) {
- php_error(E_ERROR, "Unable to load Java Library %s, error: %s",
- javalib, DL_ERROR);
- return -1;
- }
- }
-
-#ifndef JAVALIB
- if (!dl_handle)
- JNI_CreateVM = &JNI_CreateJavaVM;
- else
-#endif
-
- JNI_CreateVM = (jint (JNICALL *)(const void*,const void*,void*))
- DL_FETCH_SYMBOL(dl_handle, "JNI_CreateJavaVM");
-
- if (!JNI_CreateVM) {
- php_error(E_ERROR, "Unable to locate CreateJavaVM function");
- return -1;
- }
-
-#ifdef JNI_12
-
- vm_args.version = JNI_VERSION_1_2;
- vm_args.ignoreUnrecognized = JNI_FALSE;
- vm_args.options = options;
- vm_args.nOptions = 0;
-
- if (classpath) addJVMOption(&vm_args, "-Djava.class.path=", classpath);
- if (javahome) addJVMOption(&vm_args, "-Djava.home=", javahome);
- if (libpath) addJVMOption(&vm_args, "-Djava.library.path=", libpath);
-
-#else
-
-#ifndef JAVALIB
- if (!dl_handle)
- JNI_DefaultArgs = &JNI_GetDefaultJavaVMInitArgs;
- else
-#endif
-
- JNI_DefaultArgs = (jint (JNICALL *)(void*))
- DL_FETCH_SYMBOL(dl_handle, "JNI_GetDefaultJavaVMInitArgs");
-
- if (!JNI_DefaultArgs) {
- php_error(E_ERROR, "Unable to locate GetDefaultJavaVMInitArgs function");
- return -1;
- }
-
- vm_args.version=0x00010001;
- (*JNI_DefaultArgs)(&vm_args);
-
- if (!classpath) classpath = "";
- vm_args.classpath = classpath;
-#ifdef KAFFE
- vm_args.classhome = javahome;
- vm_args.libraryhome = libpath;
-#endif
-
-#endif
-
- rc = (*JNI_CreateVM)(&JG(jvm), &JG(jenv), &vm_args);
-
- if (rc) {
- php_error(E_ERROR, "Unable to create Java Virtual Machine");
- return rc;
- }
-
- JG(reflect_class) = (*JG(jenv))->FindClass(JG(jenv), "net/php/reflect");
- error = (*JG(jenv))->ExceptionOccurred(JG(jenv));
- if (error) {
- jclass errClass;
- jmethodID toString;
- jobject errString;
- const char *errAsUTF;
- jboolean isCopy;
- JNIEnv *jenv = JG(jenv);
- (*jenv)->ExceptionClear(jenv);
- errClass = (*jenv)->GetObjectClass(jenv, error);
- toString = (*jenv)->GetMethodID(jenv, errClass, "toString",
- "()Ljava/lang/String;");
- errString = (*jenv)->CallObjectMethod(jenv, error, toString);
- errAsUTF = (*jenv)->GetStringUTFChars(jenv, errString, &isCopy);
- php_error(E_ERROR, "%s", errAsUTF);
- if (isCopy) (*jenv)->ReleaseStringUTFChars(jenv, error, errAsUTF);
- jvm_destroy();
- return -1;
- }
-
- local_php_reflect = (*JG(jenv))->AllocObject(JG(jenv), JG(reflect_class));
- JG(php_reflect) = (*JG(jenv))->NewGlobalRef(JG(jenv), local_php_reflect);
- return rc;
-}
-
-/***************************************************************************/
-
-static jobject _java_makeObject(pval* arg JG_DC) {
- JNIEnv *jenv = JG(jenv);
- jobject result;
- pval **handle;
- int type;
- jmethodID makeArg;
- jclass hashClass;
-
- switch (arg->type) {
- case IS_STRING:
- result=(*jenv)->NewByteArray(jenv,arg->value.str.len);
- (*jenv)->SetByteArrayRegion(jenv,(jbyteArray)result,0,
- arg->value.str.len, arg->value.str.val);
- break;
-
- case IS_OBJECT:
- zend_hash_index_find(arg->value.obj.properties, 0, (void*)&handle);
- result = zend_list_find((*handle)->value.lval, &type);
- break;
-
- case IS_BOOL:
- makeArg = (*jenv)->GetMethodID(jenv, JG(reflect_class), "MakeArg",
- "(Z)Ljava/lang/Object;");
- result = (*jenv)->CallObjectMethod(jenv, JG(php_reflect), makeArg,
- (jboolean)(arg->value.lval));
- break;
-
- case IS_LONG:
- makeArg = (*jenv)->GetMethodID(jenv, JG(reflect_class), "MakeArg",
- "(J)Ljava/lang/Object;");
- result = (*jenv)->CallObjectMethod(jenv, JG(php_reflect), makeArg,
- (jlong)(arg->value.lval));
- break;
-
- case IS_DOUBLE:
- makeArg = (*jenv)->GetMethodID(jenv, JG(reflect_class), "MakeArg",
- "(D)Ljava/lang/Object;");
- result = (*jenv)->CallObjectMethod(jenv, JG(php_reflect), makeArg,
- (jdouble)(arg->value.dval));
- break;
-
- case IS_ARRAY:
- {
- jobject jkey, jval;
- zval **value;
- zval key;
- char *string_key;
- ulong num_key;
- jobject jold;
- jmethodID put, init;
-
- hashClass = (*jenv)->FindClass(jenv, "java/util/Hashtable");
- init = (*jenv)->GetMethodID(jenv, hashClass, "<init>", "()V");
- result = (*jenv)->NewObject(jenv, hashClass, init);
-
- put = (*jenv)->GetMethodID(jenv, hashClass, "put",
- "(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;");
-
- /* Iterate through hash */
- zend_hash_internal_pointer_reset(arg->value.ht);
- while(zend_hash_get_current_data(arg->value.ht, (void**)&value) == SUCCESS) {
- jval = _java_makeObject(*value JG_CC);
-
- switch (zend_hash_get_current_key(arg->value.ht, &string_key, &num_key, 0)) {
- case HASH_KEY_IS_STRING:
- key.type = IS_STRING;
- key.value.str.val = string_key;
- key.value.str.len = strlen(string_key);
- jkey = _java_makeObject(&key JG_CC);
- break;
- case HASH_KEY_IS_LONG:
- key.type = IS_LONG;
- key.value.lval = num_key;
- jkey = _java_makeObject(&key JG_CC);
- break;
- default: /* HASH_KEY_NON_EXISTANT */
- jkey = 0;
- }
- jold = (*jenv)->CallObjectMethod(jenv, result, put, jkey, jval);
- if ((*value)->type != IS_OBJECT) (*jenv)->DeleteLocalRef(jenv, jval);
- zend_hash_move_forward(arg->value.ht);
- }
-
- break;
- }
-
- default:
- result=0;
- }
-
- return result;
-}
-
-/***************************************************************************/
-
-static jobjectArray _java_makeArray(int argc, pval** argv JG_DC) {
- JNIEnv *jenv = JG(jenv);
-
- jclass objectClass = (*jenv)->FindClass(jenv, "java/lang/Object");
- jobjectArray result = (*jenv)->NewObjectArray(jenv, argc, objectClass, 0);
- jobject arg;
- int i;
-
- for (i=0; i<argc; i++) {
- arg = _java_makeObject(argv[i] JG_CC);
- (*jenv)->SetObjectArrayElement(jenv, result, i, arg);
- if (argv[i]->type != IS_OBJECT) (*jenv)->DeleteLocalRef(jenv, arg);
- }
- return result;
-}
-
-static int checkError(pval *value) {
- if (value->type == IS_EXCEPTION) {
- php_error(E_WARNING, "%s", value->value.str.val);
- efree(value->value.str.val);
- var_reset(value);
- return 1;
- };
- return 0;
-}
-
-
-/***************************************************************************/
-
-/*
- * Invoke a method on an object. If method name is "java", create a new
- * object instead.
- */
-void java_call_function_handler
- (INTERNAL_FUNCTION_PARAMETERS, zend_property_reference *property_reference)
-{
- JNIEnv *jenv;
-
- pval *object = property_reference->object;
- zend_overloaded_element *function_name = (zend_overloaded_element *)
- property_reference->elements_list->tail->data;
-
- int arg_count = ZEND_NUM_ARGS();
- jlong result = 0;
- pval **arguments = (pval **) emalloc(sizeof(pval *)*arg_count);
-
- JG_FETCH();
-
- getParametersArray(ht, arg_count, arguments);
-
- if (iniUpdated && JG(jenv)) jvm_destroy();
- if (!JG(jenv)) jvm_create();
- if (!JG(jenv)) return;
- jenv = JG(jenv);
-
- if (!strcmp("java",function_name->element.value.str.val)) {
-
- /* construct a Java object:
- First argument is the class name. Any additional arguments will
- be treated as constructor parameters. */
-
- jmethodID co = (*jenv)->GetMethodID(jenv, JG(reflect_class), "CreateObject",
- "(Ljava/lang/String;[Ljava/lang/Object;J)V");
- jstring className;
- result = (jlong)(long)object;
-
- if (ZEND_NUM_ARGS() < 1) {
- php_error(E_ERROR, "Missing classname in new Java() call");
- return;
- }
-
- className=(*jenv)->NewStringUTF(jenv, arguments[0]->value.str.val);
- (*jenv)->CallVoidMethod(jenv, JG(php_reflect), co,
- className, _java_makeArray(arg_count-1, arguments+1 JG_CC), result);
-
- (*jenv)->DeleteLocalRef(jenv, className);
-
- } else {
-
- pval **handle;
- int type;
- jobject obj;
- jstring method;
-
- /* invoke a method on the given object */
-
- jmethodID invoke = (*jenv)->GetMethodID(jenv, JG(reflect_class), "Invoke",
- "(Ljava/lang/Object;Ljava/lang/String;[Ljava/lang/Object;J)V");
- zend_hash_index_find(object->value.obj.properties, 0, (void**) &handle);
- obj = zend_list_find((*handle)->value.lval, &type);
- method = (*jenv)->NewStringUTF(jenv, function_name->element.value.str.val);
- result = (jlong)(long)return_value;
-
- (*jenv)->CallVoidMethod(jenv, JG(php_reflect), invoke,
- obj, method, _java_makeArray(arg_count, arguments JG_CC), result);
-
- (*jenv)->DeleteLocalRef(jenv, method);
-
- }
-
- efree(arguments);
- pval_destructor(&function_name->element);
-
- checkError((pval*)(long)result);
-}
-
-/***************************************************************************/
-
-PHP_FUNCTION(java_last_exception_get)
-{
- jlong result = 0;
- jmethodID lastEx;
-
- JG_FETCH();
-
- if (ZEND_NUM_ARGS()!=0) WRONG_PARAM_COUNT;
-
- result = (jlong)(long)return_value;
-
- lastEx = (*JG(jenv))->GetMethodID(JG(jenv), JG(reflect_class),
- "lastException", "(J)V");
-
- (*JG(jenv))->CallVoidMethod(JG(jenv), JG(php_reflect), lastEx, result);
-}
-
-/***************************************************************************/
-
-PHP_FUNCTION(java_last_exception_clear)
-{
- jlong result = 0;
- jmethodID clearEx;
-
- JG_FETCH();
-
- if (ZEND_NUM_ARGS()!=0) WRONG_PARAM_COUNT;
-
- result = (jlong)(long)return_value;
-
- clearEx = (*JG(jenv))->GetMethodID(JG(jenv), JG(reflect_class),
- "clearException", "()V");
-
- (*JG(jenv))->CallVoidMethod(JG(jenv), JG(php_reflect), clearEx);
-}
-
-/***************************************************************************/
-
-static pval _java_getset_property
- (zend_property_reference *property_reference, jobjectArray value)
-{
- pval presult;
- jlong result = 0;
- pval **pobject;
- jobject obj;
- int type;
-
- /* get the property name */
- zend_llist_element *element = property_reference->elements_list->head;
- zend_overloaded_element *property=(zend_overloaded_element *)element->data;
- jstring propName;
-
- JNIEnv *jenv;
- JG_FETCH();
- jenv = JG(jenv);
-
- propName = (*jenv)->NewStringUTF(jenv, property->element.value.str.val);
-
- /* get the object */
- zend_hash_index_find(property_reference->object->value.obj.properties,
- 0, (void **) &pobject);
- obj = zend_list_find((*pobject)->value.lval,&type);
- result = (jlong)(long) &presult;
- var_uninit(&presult);
-
- if (!obj || (type!=le_jobject)) {
- php_error(E_ERROR,
- "Attempt to access a Java property on a non-Java object");
- } else {
- /* invoke the method */
- jmethodID gsp = (*jenv)->GetMethodID(jenv, JG(reflect_class), "GetSetProp",
- "(Ljava/lang/Object;Ljava/lang/String;[Ljava/lang/Object;J)V");
- (*jenv)->CallVoidMethod
- (jenv, JG(php_reflect), gsp, obj, propName, value, result);
- }
-
- (*jenv)->DeleteLocalRef(jenv, propName);
- pval_destructor(&property->element);
- return presult;
-}
-
-pval java_get_property_handler
- (zend_property_reference *property_reference)
-{
- pval presult = _java_getset_property(property_reference, 0);
- checkError(&presult);
- return presult;
-}
-
-
-int java_set_property_handler
- (zend_property_reference *property_reference, pval *value)
-{
- pval presult;
- JG_FETCH();
- presult = _java_getset_property
- (property_reference, _java_makeArray(1, &value JG_CC));
- return checkError(&presult) ? FAILURE : SUCCESS;
-}
-
-/***************************************************************************/
-
-static void _php_java_destructor(zend_rsrc_list_entry *rsrc)
-{
- void *jobject = (void *)rsrc->ptr;
- JG_FETCH();
- if (JG(jenv)) (*JG(jenv))->DeleteGlobalRef(JG(jenv), jobject);
-}
-
-#ifdef ZTS
-static void alloc_java_globals_ctor(php_java_globals *java_globals) {
- memset(java_globals, 0, sizeof(php_java_globals));
-}
-#endif
-
-PHP_MINIT_FUNCTION(java) {
- INIT_OVERLOADED_CLASS_ENTRY(java_class_entry, "java", NULL,
- java_call_function_handler,
- java_get_property_handler,
- java_set_property_handler);
-
- zend_register_internal_class(&java_class_entry);
-
- le_jobject = zend_register_list_destructors_ex(_php_java_destructor, NULL, "java", module_number);
-
- REGISTER_INI_ENTRIES();
-
- if (!classpath) classpath = getenv("CLASSPATH");
-
- if (!libpath) {
- PLS_FETCH();
- libpath=PG(extension_dir);
- }
-
-#ifdef ZTS
- java_globals_id = ts_allocate_id(sizeof(php_java_globals),
- (ts_allocate_ctor)alloc_java_globals_ctor, NULL);
-#endif
-
- return SUCCESS;
-}
-
-
-PHP_MSHUTDOWN_FUNCTION(java) {
- JG_FETCH();
- UNREGISTER_INI_ENTRIES();
- if (JG(jvm)) jvm_destroy();
- return SUCCESS;
-}
-
-function_entry java_functions[] = {
- PHP_FE(java_last_exception_get, NULL)
- PHP_FE(java_last_exception_clear, NULL)
- {NULL, NULL, NULL}
-};
-
-
-static PHP_MINFO_FUNCTION(java) {
- DISPLAY_INI_ENTRIES();
-}
-
-zend_module_entry java_module_entry = {
- "java",
- java_functions,
- PHP_MINIT(java),
- PHP_MSHUTDOWN(java),
- NULL,
- NULL,
- PHP_MINFO(java),
- STANDARD_MODULE_PROPERTIES
-};
-
-ZEND_GET_MODULE(java)
-
-/***************************************************************************/
-
-JNIEXPORT void JNICALL Java_net_php_reflect_setResultFromString
- (JNIEnv *jenv, jclass self, jlong result, jbyteArray jvalue)
-{
- jboolean isCopy;
- jbyte *value = (*jenv)->GetByteArrayElements(jenv, jvalue, &isCopy);
- pval *presult = (pval*)(long)result;
- presult->type=IS_STRING;
- presult->value.str.len=(*jenv)->GetArrayLength(jenv, jvalue);
- presult->value.str.val=emalloc(presult->value.str.len+1);
- memcpy(presult->value.str.val, value, presult->value.str.len);
- presult->value.str.val[presult->value.str.len]=0;
- if (isCopy) (*jenv)->ReleaseByteArrayElements(jenv, jvalue, value, 0);
-}
-
-JNIEXPORT void JNICALL Java_net_php_reflect_setResultFromLong
- (JNIEnv *jenv, jclass self, jlong result, jlong value)
-{
- pval *presult = (pval*)(long)result;
- presult->type=IS_LONG;
- presult->value.lval=(long)value;
-}
-
-JNIEXPORT void JNICALL Java_net_php_reflect_setResultFromDouble
- (JNIEnv *jenv, jclass self, jlong result, jdouble value)
-{
- pval *presult = (pval*)(long)result;
- presult->type=IS_DOUBLE;
- presult->value.dval=value;
-}
-
-JNIEXPORT void JNICALL Java_net_php_reflect_setResultFromBoolean
- (JNIEnv *jenv, jclass self, jlong result, jboolean value)
-{
- pval *presult = (pval*)(long)result;
- presult->type=IS_BOOL;
- presult->value.lval=value;
-}
-
-JNIEXPORT void JNICALL Java_net_php_reflect_setResultFromObject
- (JNIEnv *jenv, jclass self, jlong result, jobject value)
-{
- /* wrapper the java object in a pval object */
- pval *presult = (pval*)(long)result;
- pval *handle;
-
- if (presult->type != IS_OBJECT) {
- presult->type=IS_OBJECT;
- presult->value.obj.ce=&java_class_entry;
- ALLOC_HASHTABLE(presult->value.obj.properties);
- presult->is_ref=1;
- presult->refcount=1;
- zend_hash_init(presult->value.obj.properties, 0, NULL, ZVAL_PTR_DTOR, 0);
- };
-
- ALLOC_ZVAL(handle);
- handle->type = IS_LONG;
- handle->value.lval =
- zend_list_insert((*jenv)->NewGlobalRef(jenv,value), le_jobject);
- pval_copy_constructor(handle);
- INIT_PZVAL(handle);
- zend_hash_index_update(presult->value.obj.properties, 0,
- &handle, sizeof(pval *), NULL);
-}
-
-JNIEXPORT void JNICALL Java_net_php_reflect_setResultFromArray
- (JNIEnv *jenv, jclass self, jlong result)
-{
- array_init( (pval*)(long)result );
-}
-
-JNIEXPORT jlong JNICALL Java_net_php_reflect_nextElement
- (JNIEnv *jenv, jclass self, jlong array)
-{
- pval *result;
- pval *handle = (pval*)(long)array;
- ALLOC_ZVAL(result);
- zend_hash_next_index_insert(handle->value.ht, &result, sizeof(zval *), NULL);
- return (jlong)(long)result;
-}
-
-JNIEXPORT jlong JNICALL Java_net_php_reflect_hashIndexUpdate
- (JNIEnv *jenv, jclass self, jlong array, jlong key)
-{
- pval *result;
- pval *handle = (pval*)(long)array;
- ALLOC_ZVAL(result);
- zend_hash_index_update(handle->value.ht, (unsigned long)key,
- &result, sizeof(zval *), NULL);
- return (jlong)(long)result;
-}
-
-JNIEXPORT jlong JNICALL Java_net_php_reflect_hashUpdate
- (JNIEnv *jenv, jclass self, jlong array, jbyteArray key)
-{
- pval *result;
- pval pkey;
- pval *handle = (pval*)(long)array;
- ALLOC_ZVAL(result);
- Java_net_php_reflect_setResultFromString(jenv, self, (jlong)(long)&pkey, key);
- zend_hash_update(handle->value.ht, pkey.value.str.val, pkey.value.str.len+1,
- &result, sizeof(zval *), NULL);
- return (jlong)(long)result;
-}
-
-JNIEXPORT void JNICALL Java_net_php_reflect_setException
- (JNIEnv *jenv, jclass self, jlong result, jbyteArray value)
-{
- pval *presult = (pval*)(long)result;
- Java_net_php_reflect_setResultFromString(jenv, self, result, value);
- presult->type=IS_EXCEPTION;
-}
-
-JNIEXPORT void JNICALL Java_net_php_reflect_setEnv
- (JNIEnv *newJenv, jclass self)
-{
- jobject local_php_reflect;
- JG_FETCH();
-
- iniUpdated=0;
- JG(jenv)=newJenv;
-
- if (!self) self = (*JG(jenv))->FindClass(JG(jenv), "net/php/reflect");
- JG(reflect_class) = self;
-
- if (JG(php_reflect)) (*JG(jenv))->DeleteGlobalRef(JG(jenv), JG(php_reflect));
- local_php_reflect = (*JG(jenv))->AllocObject(JG(jenv), JG(reflect_class));
- JG(php_reflect) = (*JG(jenv))->NewGlobalRef(JG(jenv), local_php_reflect);
-}
diff --git a/ext/java/java.dsp b/ext/java/java.dsp
deleted file mode 100644
index 603f685439..0000000000
--- a/ext/java/java.dsp
+++ /dev/null
@@ -1,258 +0,0 @@
-# Microsoft Developer Studio Project File - Name="java" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=java - Win32 Debug_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "java.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "java.mak" CFG="java - Win32 Debug_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "java - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "java - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "java - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "java - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "java - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "..\..\Release"
-# PROP BASE Intermediate_Dir "..\..\Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "..\..\Release"
-# PROP Intermediate_Dir "..\..\Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "PHP_WIN32" /D "ZEND_WIN32" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "$(JAVA_HOME)\include\win32" /I "$(JAVA_HOME)\include" /I "..\..\..\bindlib_w32" /D "NDEBUG" /D ZEND_DEBUG=0 /D "PHP_WIN32" /D "ZEND_WIN32" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_JAVA" /D HAVE_JAVA=1 /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "NDEBUG"
-# ADD RSC /l 0x40d /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\Release/php_java.dll" /libpath:"$(JAVA_HOME)\lib" /libpath:"..\..\Release"
-
-!ELSEIF "$(CFG)" == "java - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "..\..\Debug"
-# PROP BASE Intermediate_Dir "..\..\Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "..\..\Debug"
-# PROP Intermediate_Dir "..\..\Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "PHP_WIN32" /D "ZEND_WIN32" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\Zend" /I "$(JAVA_HOME)\include\win32" /I "$(JAVA_HOME)\include" /I "..\..\..\bindlib_w32" /D "_DEBUG" /D ZEND_DEBUG=1 /D "PHP_WIN32" /D "ZEND_WIN32" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_JAVA" /D HAVE_JAVA=1 /FR /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "_DEBUG"
-# ADD RSC /l 0x40d /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"..\..\Debug/php_java.dll" /pdbtype:sept /libpath:"$(JAVA_HOME)\lib" /libpath:"..\..\Debug"
-
-!ELSEIF "$(CFG)" == "java - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "..\..\Debug_TS"
-# PROP BASE Intermediate_Dir "..\..\Debug_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "..\..\Debug_TS"
-# PROP Intermediate_Dir "..\..\Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\..\Zend" /I "$(JAVA_HOME)\include\win32" /I "$(JAVA_HOME)\include" /I "..\..\..\bindlib_w32" /D "_DEBUG" /D "PHP_WIN32" /D "ZEND_WIN32" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_JAVA" /FR /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\..\\" /I "..\..\main" /I "..\..\TSRM" /I "..\..\Zend" /I "$(JAVA_HOME)\include\win32" /I "$(JAVA_HOME)\include" /I "..\..\..\bindlib_w32" /D "_DEBUG" /D ZEND_DEBUG=1 /D "ZTS" /D "PHP_WIN32" /D "ZEND_WIN32" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_JAVA" /D HAVE_JAVA=1 /FR /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "_DEBUG"
-# ADD RSC /l 0x40d /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts_debug.lib /nologo /dll /debug /machine:I386 /out:"..\..\Debug_TS/php_java.dll" /pdbtype:sept /libpath:"$(JAVA_HOME)\lib" /libpath:"..\..\Debug_TS"
-
-!ELSEIF "$(CFG)" == "java - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "..\..\Release_TS"
-# PROP BASE Intermediate_Dir "..\..\Release_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "..\..\Release_TS"
-# PROP Intermediate_Dir "..\..\Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\..\Zend" /I "$(JAVA_HOME)\include\win32" /I "$(JAVA_HOME)\include" /I "..\..\..\bindlib_w32" /D "NDEBUG" /D "PHP_WIN32" /D "ZEND_WIN32" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_JAVA" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\\" /I "..\..\main" /I "..\..\TSRM" /I "..\..\Zend" /I "$(JAVA_HOME)\include\win32" /I "$(JAVA_HOME)\include" /I "..\..\..\bindlib_w32" /D "NDEBUG" /D ZEND_DEBUG=0 /D "ZTS" /D "PHP_WIN32" /D "ZEND_WIN32" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_JAVA" /D HAVE_JAVA=1 /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "NDEBUG"
-# ADD RSC /l 0x40d /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_java.dll" /libpath:"$(JAVA_HOME)\lib" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
-
-!ENDIF
-
-# Begin Target
-
-# Name "java - Win32 Release"
-# Name "java - Win32 Debug"
-# Name "java - Win32 Debug_TS"
-# Name "java - Win32 Release_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\java.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\..\..\win32\winutil.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_java.h
-# End Source File
-# End Group
-# Begin Group "Java Files"
-
-# PROP Default_Filter "java"
-# Begin Source File
-
-SOURCE=.\reflect.java
-
-!IF "$(CFG)" == "java - Win32 Release"
-
-# Begin Custom Build
-OutDir=.\..\..\Release
-InputPath=.\reflect.java
-
-"$(OutDir)\php_java.jar" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- if not exist net mkdir net
- if not exist net\php mkdir net\php
- copy $(InputPath) net\php > nul
- echo library=php_java>net\php\reflect.properties
- $(JAVA_HOME)\bin\javac net\php\reflect.java
- $(JAVA_HOME)\bin\jar c0f $(OutDir)\php_java.jar net\php\*.class net\php\*.properties
- erase net\php\reflect.*
- rmdir net\php
- rmdir net
-
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "java - Win32 Debug"
-
-# Begin Custom Build
-OutDir=.\..\..\Debug
-InputPath=.\reflect.java
-
-"$(OutDir)\php_java.jar" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- if not exist net mkdir net
- if not exist net\php mkdir net\php
- copy $(InputPath) net\php > nul
- echo library=php_java>net\php\reflect.properties
- $(JAVA_HOME)\bin\javac -g net\php\reflect.java
- $(JAVA_HOME)\bin\jar c0f $(OutDir)\php_java.jar net\php\*.class net\php\*.properties
- erase net\php\reflect.*
- rmdir net\php
- rmdir net
-
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "java - Win32 Debug_TS"
-
-# Begin Custom Build
-OutDir=.\..\..\Debug_TS
-InputPath=.\reflect.java
-
-"$(OutDir)\php_java.jar" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- if not exist net mkdir net
- if not exist net\php mkdir net\php
- copy $(InputPath) net\php > nul
- echo library=php_java>net\php\reflect.properties
- $(JAVA_HOME)\bin\javac -g net\php\reflect.java
- $(JAVA_HOME)\bin\jar c0f $(OutDir)\php_java.jar net\php\*.class net\php\*.properties
- erase net\php\reflect.*
- rmdir net\php
- rmdir net
-
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "java - Win32 Release_TS"
-
-# Begin Custom Build
-OutDir=.\..\..\Release_TS
-InputPath=.\reflect.java
-
-"$(OutDir)\php_java.jar" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- if not exist net mkdir net
- if not exist net\php mkdir net\php
- copy $(InputPath) net\php > nul
- echo library=php_java>net\php\reflect.properties
- $(JAVA_HOME)\bin\javac net\php\reflect.java
- $(JAVA_HOME)\bin\jar c0f $(OutDir)\php_java.jar net\php\*.class net\php\*.properties
- erase net\php\reflect.*
- rmdir net\php
- rmdir net
-
-# End Custom Build
-
-!ENDIF
-
-# End Source File
-# End Group
-# Begin Source File
-
-SOURCE=.\jtest.php
-# End Source File
-# End Target
-# End Project
diff --git a/ext/java/jawt.php b/ext/java/jawt.php
deleted file mode 100644
index 30f2235611..0000000000
--- a/ext/java/jawt.php
+++ /dev/null
@@ -1,27 +0,0 @@
-<?
-
- // This example is only intented to be run as a CGI.
-
- $frame = new Java("java.awt.Frame", "Zend");
- $button = new Java("java.awt.Button", "Hello Java world!");
- $frame->add("North", $button);
- $frame->validate();
- $frame->pack();
- $frame->visible = True;
-
- $thread = new Java("java.lang.Thread");
- $thread->sleep(10000);
-
- $frame->dispose();
-
- // Odd behavior noted with Sun JVMs:
- //
- // 1) $thread->destroy() will fail with a NoSuchMethodError exception.
- // 2) The call to (*jvm)->DestroyJVM(jvm) made when PHP terminates
- // will hang, unless _BOTH_ the calls to pack and setVisible above
- // are removed.
- //
- // Even more odd: both effects are seen with a 100% Java implementation
- // of the above!
-
-?>
diff --git a/ext/java/jver.php b/ext/java/jver.php
deleted file mode 100644
index 7015944101..0000000000
--- a/ext/java/jver.php
+++ /dev/null
@@ -1,17 +0,0 @@
-<html>
-<?
-
- $system = new Java("java.lang.System");
- print "Java version=".$system->getProperty("java.version")." <br>\n";
- print "Java vendor=".$system->getProperty("java.vendor")." <p>\n\n";
- print "OS=".$system->getProperty("os.name")." ".
- $system->getProperty("os.version")." on ".
- $system->getProperty("os.arch")." <br>\n";
-
- $formatter = new Java("java.text.SimpleDateFormat",
- "EEEE, MMMM dd, yyyy 'at' h:mm:ss a zzzz");
-
- print $formatter->format(new Java("java.util.Date"))."\n";
-
-?>
-</html>
diff --git a/ext/java/reflect.java b/ext/java/reflect.java
deleted file mode 100644
index 3e924d975b..0000000000
--- a/ext/java/reflect.java
+++ /dev/null
@@ -1,419 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Sam Ruby (rubys@us.ibm.com) |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-package net.php;
-
-import java.lang.reflect.*;
-import java.util.*;
-import java.beans.*;
-
-public class reflect {
-
- static { loadLibrary("reflect"); }
-
- protected static void loadLibrary(String property) {
- try {
- ResourceBundle bundle = ResourceBundle.getBundle("net.php."+property);
- System.loadLibrary(bundle.getString("library"));
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- //
- // Native methods
- //
- private static native void setResultFromString(long result, byte value[]);
- private static native void setResultFromLong(long result, long value);
- private static native void setResultFromDouble(long result, double value);
- private static native void setResultFromBoolean(long result, boolean value);
- private static native void setResultFromObject(long result, Object value);
- private static native void setResultFromArray(long result);
- private static native long nextElement(long array);
- private static native long hashUpdate(long array, byte key[]);
- private static native long hashIndexUpdate(long array, long key);
- private static native void setException(long result, byte value[]);
- public static native void setEnv();
-
- //
- // Helper routines which encapsulate the native methods
- //
- public static void setResult(long result, Object value) {
- if (value == null) return;
-
- if (value instanceof java.lang.String) {
-
- setResultFromString(result, ((String)value).getBytes());
-
- } else if (value instanceof java.lang.Number) {
-
- if (value instanceof java.lang.Integer ||
- value instanceof java.lang.Short ||
- value instanceof java.lang.Byte) {
- setResultFromLong(result, ((Number)value).longValue());
- } else {
- /* Float, Double, BigDecimal, BigInteger, Double, Long, ... */
- setResultFromDouble(result, ((Number)value).doubleValue());
- }
-
- } else if (value instanceof java.lang.Boolean) {
-
- setResultFromBoolean(result, ((Boolean)value).booleanValue());
-
- } else if (value.getClass().isArray()) {
-
- long length = Array.getLength(value);
- setResultFromArray(result);
- for (int i=0; i<length; i++) {
- setResult(nextElement(result), Array.get(value, i));
- }
-
- } else if (value instanceof java.util.Hashtable) {
-
- Hashtable ht = (Hashtable) value;
- setResultFromArray(result);
- for (Enumeration e = ht.keys(); e.hasMoreElements(); ) {
- Object key = e.nextElement();
- long slot;
- if (key instanceof Number &&
- !(key instanceof Double || key instanceof Float))
- slot = hashIndexUpdate(result, ((Number)key).longValue());
- else
- slot = hashUpdate(result, key.toString().getBytes());
- setResult(slot, ht.get(key));
- }
-
- } else {
-
- setResultFromObject(result, value);
-
- }
- }
-
- Throwable lastException = null;
-
- void lastException(long result) {
- setResult(result, lastException);
- }
-
- void clearException() {
- lastException = null;
- }
-
- void setException(long result, Throwable e) {
- if (e instanceof InvocationTargetException) {
- Throwable t = ((InvocationTargetException)e).getTargetException();
- if (t!=null) e=t;
- }
-
- lastException = e;
- setException(result, e.toString().getBytes());
- }
-
- //
- // Create an new instance of a given class
- //
- public void CreateObject(String name, Object args[], long result) {
- try {
- Vector matches = new Vector();
-
- Constructor cons[] = Class.forName(name).getConstructors();
- for (int i=0; i<cons.length; i++) {
- if (cons[i].getParameterTypes().length == args.length) {
- matches.addElement(cons[i]);
- }
- }
-
- Constructor selected = (Constructor)select(matches, args);
-
- if (selected == null) {
- if (args.length > 0) {
- throw new InstantiationException("No matching constructor found");
- } else {
- // for classes which have no visible constructor, return the class
- // useful for classes like java.lang.System and java.util.Calendar.
- setResult(result, Class.forName(name));
- return;
- }
- }
-
- Object coercedArgs[] = coerce(selected.getParameterTypes(), args);
- setResultFromObject(result, selected.newInstance(coercedArgs));
-
- } catch (Exception e) {
- setException(result, e);
- }
- }
-
- //
- // Select the best match from a list of methods
- //
- private static Object select(Vector methods, Object args[]) {
- if (methods.size() == 1) return methods.firstElement();
-
- Object selected = null;
- int best = Integer.MAX_VALUE;
-
- for (Enumeration e = methods.elements(); e.hasMoreElements(); ) {
- Object element = e.nextElement();
- int weight=0;
-
- Class parms[] = (element instanceof Method) ?
- ((Method)element).getParameterTypes() :
- ((Constructor)element).getParameterTypes();
-
- for (int i=0; i<parms.length; i++) {
- if (parms[i].isInstance(args[i])) {
- for (Class c=parms[i]; (c=c.getSuperclass()) != null; ) {
- if (!c.isInstance(args[i])) break;
- weight++;
- }
- } else if (parms[i].isAssignableFrom(java.lang.String.class)) {
- if (!(args[i] instanceof byte[]) && !(args[i] instanceof String))
- weight+=9999;
- } else if (parms[i].isArray()) {
- if (args[i] instanceof java.util.Hashtable)
- weight+=256;
- else
- weight+=9999;
- } else if (parms[i].isPrimitive()) {
- Class c=parms[i];
- if (args[i] instanceof Number) {
- if (c==Boolean.TYPE) weight+=5;
- if (c==Character.TYPE) weight+=4;
- if (c==Byte.TYPE) weight+=3;
- if (c==Short.TYPE) weight+=2;
- if (c==Integer.TYPE) weight++;
- if (c==Float.TYPE) weight++;
- } else if (args[i] instanceof Boolean) {
- if (c!=Boolean.TYPE) weight+=9999;
- } else if (args[i] instanceof String) {
- if (c== Character.TYPE || ((String)args[i]).length()>0)
- weight+=((String)args[i]).length();
- else
- weight+=64;
- } else {
- weight+=9999;
- }
- } else {
- weight+=9999;
- }
- }
-
- if (weight < best) {
- if (weight == 0) return element;
- best = weight;
- selected = element;
- }
- }
-
- return selected;
- }
-
- //
- // Coerce arguments when possible to conform to the argument list.
- // Java's reflection will automatically do widening conversions,
- // unfortunately PHP only supports wide formats, so to be practical
- // some (possibly lossy) conversions are required.
- //
- private static Object[] coerce(Class parms[], Object args[]) {
- Object result[] = args;
- for (int i=0; i<args.length; i++) {
- if (args[i] instanceof byte[] && !parms[i].isArray()) {
- Class c = parms[i];
- String s = new String((byte[])args[i]);
- result[i] = s;
- try {
- if (c == Boolean.TYPE) result[i]=new Boolean(s);
- if (c == Byte.TYPE) result[i]=new Byte(s);
- if (c == Short.TYPE) result[i]=new Short(s);
- if (c == Integer.TYPE) result[i]=new Integer(s);
- if (c == Float.TYPE) result[i]=new Float(s);
- if (c == Long.TYPE) result[i]=new Long(s);
- if (c == Character.TYPE && s.length()>0)
- result[i]=new Character(s.charAt(0));
- } catch (NumberFormatException n) {
- // oh well, we tried!
- }
- } else if (args[i] instanceof Number && parms[i].isPrimitive()) {
- if (result==args) result=(Object[])result.clone();
- Class c = parms[i];
- Number n = (Number)args[i];
- if (c == Boolean.TYPE) result[i]=new Boolean(0.0!=n.floatValue());
- if (c == Byte.TYPE) result[i]=new Byte(n.byteValue());
- if (c == Short.TYPE) result[i]=new Short(n.shortValue());
- if (c == Integer.TYPE) result[i]=new Integer(n.intValue());
- if (c == Float.TYPE) result[i]=new Float(n.floatValue());
- if (c == Long.TYPE && !(n instanceof Long))
- result[i]=new Long(n.longValue());
- } else if (args[i] instanceof Hashtable && parms[i].isArray()) {
- try {
- Hashtable ht = (Hashtable)args[i];
- int size = ht.size();
-
- // Verify that the keys are Long, and determine maximum
- for (Enumeration e = ht.keys(); e.hasMoreElements(); ) {
- int index = ((Long)e.nextElement()).intValue();
- if (index >= size) size = index+1;
- }
-
- Object tempArray[] = new Object[size];
- Class tempTarget[] = new Class[size];
- Class targetType = parms[i].getComponentType();
-
- // flatten the hash table into an array
- for (int j=0; j<size; j++) {
- tempArray[j] = ht.get(new Long(j));
- if (tempArray[j] == null && targetType.isPrimitive())
- throw new Exception("bail");
- tempTarget[j] = targetType;
- }
-
- // coerce individual elements into the target type
- Object coercedArray[] = coerce(tempTarget, tempArray);
-
- // copy the results into the desired array type
- Object array = Array.newInstance(targetType,size);
- for (int j=0; j<size; j++) {
- Array.set(array, j, coercedArray[j]);
- }
-
- result[i]=array;
- } catch (Exception e) {
- // leave result[i] alone...
- }
- }
- }
- return result;
- }
-
- //
- // Invoke a method on a given object
- //
- public void Invoke
- (Object object, String method, Object args[], long result)
- {
- try {
- Vector matches = new Vector();
-
- // gather
- for (Class jclass = object.getClass();;jclass=(Class)object) {
- while (!Modifier.isPublic(jclass.getModifiers())) {
- // OK, some joker gave us an instance of a non-public class
- // This often occurs in the case of enumerators
- // Substitute the first public interface in its place,
- // and barring that, try the superclass
- Class interfaces[] = jclass.getInterfaces();
- jclass=jclass.getSuperclass();
- for (int i=interfaces.length; i-->0;) {
- if (Modifier.isPublic(interfaces[i].getModifiers())) {
- jclass=interfaces[i];
- }
- }
- }
- Method methods[] = jclass.getMethods();
- for (int i=0; i<methods.length; i++) {
- if (methods[i].getName().equalsIgnoreCase(method) &&
- methods[i].getParameterTypes().length == args.length) {
- matches.addElement(methods[i]);
- }
- }
-
- // try a second time with the object itself, if it is of type Class
- if (!(object instanceof Class) || (jclass==object)) break;
- }
-
- Method selected = (Method)select(matches, args);
- if (selected == null) throw new NoSuchMethodException(method);
-
- Object coercedArgs[] = coerce(selected.getParameterTypes(), args);
- setResult(result, selected.invoke(object, coercedArgs));
-
- } catch (Exception e) {
- setException(result, e);
- }
- }
-
- //
- // Get or Set a property
- //
- public void GetSetProp
- (Object object, String prop, Object args[], long result)
- {
- try {
-
- for (Class jclass = object.getClass();;jclass=(Class)object) {
- while (!Modifier.isPublic(jclass.getModifiers())) {
- // OK, some joker gave us an instance of a non-public class
- // Substitute the first public interface in its place,
- // and barring that, try the superclass
- Class interfaces[] = jclass.getInterfaces();
- jclass=jclass.getSuperclass();
- for (int i=interfaces.length; i-->0;) {
- if (Modifier.isPublic(interfaces[i].getModifiers())) {
- jclass=interfaces[i];
- }
- }
- }
- BeanInfo beanInfo = Introspector.getBeanInfo(jclass);
- PropertyDescriptor props[] = beanInfo.getPropertyDescriptors();
- for (int i=0; i<props.length; i++) {
- if (props[i].getName().equalsIgnoreCase(prop)) {
- Method method;
- if (args!=null && args.length>0) {
- method=props[i].getWriteMethod();
- args = coerce(method.getParameterTypes(), args);
- } else {
- method=props[i].getReadMethod();
- }
- setResult(result, method.invoke(object, args));
- return;
- }
- }
-
- Field jfields[] = jclass.getFields();
- for (int i=0; i<jfields.length; i++) {
- if (jfields[i].getName().equalsIgnoreCase(prop)) {
- if (args!=null && args.length>0) {
- args = coerce(new Class[] {jfields[i].getType()}, args);
- jfields[i].set(object, args[0]);
- } else {
- setResult(result, jfields[i].get(object));
- }
- return;
- }
- }
-
- // try a second time with the object itself, if it is of type Class
- if (!(object instanceof Class) || (jclass==object)) break;
- }
-
- } catch (Exception e) {
- setException(result, e);
- }
- }
-
- //
- // Helper routines for the C implementation
- //
- public Object MakeArg(boolean b) { return new Boolean(b); }
- public Object MakeArg(long l) { return new Long(l); }
- public Object MakeArg(double d) { return new Double(d); }
-}
diff --git a/ext/ldap/CREDITS b/ext/ldap/CREDITS
deleted file mode 100644
index 5dc3d01974..0000000000
--- a/ext/ldap/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-LDAP
-Amitay Isaacs, Eric Warnke, Rasmus Lerdorf, Gerrit Thomson, Stig Venaas
diff --git a/ext/ldap/LDAP_Win32_HOWTO.txt b/ext/ldap/LDAP_Win32_HOWTO.txt
deleted file mode 100644
index ae085de86b..0000000000
--- a/ext/ldap/LDAP_Win32_HOWTO.txt
+++ /dev/null
@@ -1,33 +0,0 @@
-Rules for building LDAP
------------------------
-
-Note 1: During the entire build process, you can ignore warnings about
- inconsistent DLL linkage.
-
-
-- Open LDAP under php_build. Rename this directory to 'OpenLDAP'.
-- Rename OpenLDAP\include\portable.h.nt to OpenLDAP\include\portable.h
-- Rename OpenLDAP\include\ldapconfig.h.nt to OpenLDAP\include\ldapconfig.h
-- Launch Visual Studio with OpenLDAP\libraries\libldap\libldap.dsw
-- Enter Project->Settings.
- Select the C/C++ tab, and select 'Code Generation' in the Category box.
- For 'Win32 Debug', change the runtime library to 'Debug Multithreaded DLL'
- For 'Win32 Release', change the runtime library to 'Multithreaded DLL'
- Select the Preprocessor tab, select 'All Configurations'.
- Add '..\..\..\..\php4\regex' to the 'Additional include directories' list.
- Add 'HAVE_MKTEMP' to the 'Preprocessor definitions' list.
-- Compile (you can compile both Debug and Release versions).
-
-
-- Launch Visual Studio with OpenLDAP\libraries\liblber\liblber.dsw
-- Enter Project->Settings.
- Select the C/C++ tab, and select 'Code Generation' in the Category box.
- For 'Win32 Debug', change the runtime library to 'Debug Multithreaded DLL'
- For 'Win32 Release', change the runtime library to 'Multithreaded DLL'
- Select the Preprocessor tab, select 'All Configurations'.
- Add 'HAVE_MKTEMP' to the 'Preprocessor definitions' list.
-- Compile (you can compile both Debug and Release versions).
-
-
-Start Visual Studio, load php_modules.dsw, select the LDAP project, and build
-it.
diff --git a/ext/ldap/Makefile.in b/ext/ldap/Makefile.in
deleted file mode 100644
index 6ca95599ff..0000000000
--- a/ext/ldap/Makefile.in
+++ /dev/null
@@ -1,7 +0,0 @@
-
-LTLIBRARY_NAME = libldap.la
-LTLIBRARY_SOURCES = ldap.c
-LTLIBRARY_SHARED_NAME = ldap.la
-LTLIBRARY_SHARED_LIBADD = $(LDAP_SHARED_LIBADD)
-
-include $(top_srcdir)/build/dynlib.mk
diff --git a/ext/ldap/config.m4 b/ext/ldap/config.m4
deleted file mode 100644
index 42fbda1e96..0000000000
--- a/ext/ldap/config.m4
+++ /dev/null
@@ -1,93 +0,0 @@
-dnl $Id$
-
-AC_DEFUN(PHP_LDAP_CHECKS, [
- if test -f $1/include/ldap.h; then
- LDAP_DIR=$1
- LDAP_INCDIR=$1/include
- LDAP_LIBDIR=$1/lib
- elif test -f $1/include/umich-ldap/ldap.h; then
- LDAP_DIR=$i
- LDAP_INCDIR=$1/include/umich-ldap
- LDAP_LIBDIR=$1/lib
- elif test -f $1/ldap/public/ldap.h; then
- LDAP_DIR=$i
- LDAP_INCDIR=$1/ldap/public
- LDAP_LIBDIR=$1/lib
- fi
-])
-
-PHP_ARG_WITH(ldap,whether to include LDAP support,
-[ --with-ldap[=DIR] Include LDAP support. DIR is the LDAP base
- install directory.])
-
-if test "$PHP_LDAP" != "no"; then
-
- PHP_EXTENSION(ldap,$ext_shared)
-
- if test "$PHP_LDAP" = "yes"; then
- for i in /usr/local /usr; do
- PHP_LDAP_CHECKS($i)
- done
- else
- PHP_LDAP_CHECKS($PHP_LDAP)
- fi
-
- if test -z "$LDAP_DIR"; then
- AC_MSG_ERROR(Cannot find ldap.h)
- fi
-
- dnl The Linux version of the SDK need -lpthread
- dnl I have tested Solaris, and it doesn't, but others may. Add
- dnl these here if necessary. -RL
- dnl Is this really necessary? -Troels Arvin
-
- if test `uname` = "Linux"; then
- LDAP_PTHREAD=pthread
- else
- LDAP_PTHREAD=
- fi
-
- if test -f $LDAP_LIBDIR/liblber.a -o -f $LDAP_LIBDIR/liblber.so -o -f $LDAP_LIBDIR/liblber.sl; then
- PHP_ADD_LIBRARY_WITH_PATH(lber, $LDAP_LIBDIR, LDAP_SHARED_LIBADD)
- PHP_ADD_LIBRARY_WITH_PATH(ldap, $LDAP_LIBDIR, LDAP_SHARED_LIBADD)
-
- elif test -f $LDAP_LIBDIR/libldap.so.3; then
- PHP_ADD_LIBRARY_WITH_PATH(ldap, $LDAP_LIBDIR, LDAP_SHARED_LIBADD)
-
- elif test -f $LDAP_LIBDIR/libldapssl41.so -o -f $LDAP_LIBDIR/libldapssl41.sl; then
- if test -n "$LDAP_PTHREAD"; then
- PHP_ADD_LIBRARY($LDAP_PTHREAD)
- fi
- PHP_ADD_LIBRARY_WITH_PATH(nspr3, $LDAP_LIBDIR, LDAP_SHARED_LIBADD)
- PHP_ADD_LIBRARY_WITH_PATH(plc3, $LDAP_LIBDIR, LDAP_SHARED_LIBADD)
- PHP_ADD_LIBRARY_WITH_PATH(plds3, $LDAP_LIBDIR, LDAP_SHARED_LIBADD)
- PHP_ADD_LIBRARY_WITH_PATH(ldapssl41, $LDAP_LIBDIR, LDAP_SHARED_LIBADD)
- AC_DEFINE(HAVE_NSLDAP,1,[ ])
-
- elif test -f $LDAP_LIBDIR/libldapssl30.so -o -f $LDAP_LIBDIR/libldapssl30.sl; then
- if test -n "$LDAP_PTHREAD"; then
- PHP_ADD_LIBRARY($LDAP_PTHREAD)
- fi
- PHP_ADD_LIBRARY_WITH_PATH(ldapssl30, $LDAP_LIBDIR, LDAP_SHARED_LIBADD)
- AC_DEFINE(HAVE_NSLDAP,1,[ ])
-
- elif test -f $LDAP_LIBDIR/libldap30.so -o -f $LDAP_LIBDIR/libldap30.sl; then
- if test -n "$LDAP_PTHREAD"; then
- PHP_ADD_LIBRARY($LDAP_PTHREAD)
- fi
- PHP_ADD_LIBRARY_WITH_PATH(ldap30, $LDAP_LIBDIR, LDAP_SHARED_LIBADD)
- AC_DEFINE(HAVE_NSLDAP,1,[ ])
-
- elif test -f $LDAP_LIBDIR/libumich_ldap.so; then
- PHP_ADD_LIBRARY_WITH_PATH(umich_lber, $LDAP_LIBDIR, LDAP_SHARED_LIBADD)
- PHP_ADD_LIBRARY_WITH_PATH(umich_ldap, $LDAP_LIBDIR, LDAP_SHARED_LIBADD)
-
- elif test -f $LDAP_LIBDIR/libclntsh.so; then
- PHP_ADD_LIBRARY_WITH_PATH(clntsh, $LDAP_LIBDIR, LDAP_SHARED_LIBADD)
- AC_DEFINE(HAVE_ORALDAP,1,[ ])
- fi
-
- PHP_ADD_INCLUDE($LDAP_INCDIR)
- PHP_SUBST(LDAP_SHARED_LIBADD)
- AC_DEFINE(HAVE_LDAP,1,[ ])
-fi
diff --git a/ext/ldap/ldap.c b/ext/ldap/ldap.c
deleted file mode 100644
index 2b43fcd8e3..0000000000
--- a/ext/ldap/ldap.c
+++ /dev/null
@@ -1,2006 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Amitay Isaacs <amitay@w-o-i.com> |
- | Eric Warnke <ericw@albany.edu> |
- | Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
- | Gerrit Thomson <334647@swin.edu.au> |
- | Jani Taskinen <sniper@iki.fi> |
- | Stig Venaas <venaas@uninett.no> |
- | PHP 4.0 updates: Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-#define IS_EXT_MODULE
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "php_ini.h"
-
-#include "ext/standard/dl.h"
-#include "php_ldap.h"
-
-#ifdef PHP_WIN32
-#include <string.h>
-#if HAVE_NSLDAP
-#include <winsock.h>
-#endif
-#define strdup _strdup
-#undef WINDOWS
-#undef strcasecmp
-#undef strncasecmp
-#define WINSOCK 1
-#define __STDC__ 1
-#endif
-
-#include "ext/standard/php_string.h"
-#include "ext/standard/info.h"
-
-ZEND_DECLARE_MODULE_GLOBALS(ldap)
-
-static unsigned char third_argument_force_ref[] = { 3, BYREF_NONE, BYREF_NONE, BYREF_FORCE };
-static unsigned char arg3to6of6_force_ref[] = { 6, BYREF_NONE, BYREF_NONE, BYREF_FORCE, BYREF_FORCE, BYREF_FORCE, BYREF_FORCE };
-
-static int le_link, le_result, le_result_entry, le_ber_entry;
-
-/*
- This is just a small subset of the functionality provided by the LDAP library. All the
- operations are synchronous. Referrals are not handled automatically.
-*/
-/* {{{ ldap_functions[]
- */
-function_entry ldap_functions[] = {
- PHP_FE(ldap_connect, NULL)
- PHP_FALIAS(ldap_close, ldap_unbind, NULL)
- PHP_FE(ldap_bind, NULL)
- PHP_FE(ldap_unbind, NULL)
- PHP_FE(ldap_read, NULL)
- PHP_FE(ldap_list, NULL)
- PHP_FE(ldap_search, NULL)
- PHP_FE(ldap_free_result, NULL)
- PHP_FE(ldap_count_entries, NULL)
- PHP_FE(ldap_first_entry, NULL)
- PHP_FE(ldap_next_entry, NULL)
- PHP_FE(ldap_get_entries, NULL)
- PHP_FE(ldap_first_attribute, third_argument_force_ref)
- PHP_FE(ldap_next_attribute, third_argument_force_ref)
- PHP_FE(ldap_get_attributes, NULL)
- PHP_FE(ldap_get_values, NULL)
- PHP_FE(ldap_get_values_len, NULL)
- PHP_FE(ldap_get_dn, NULL)
- PHP_FE(ldap_explode_dn, NULL)
- PHP_FE(ldap_dn2ufn, NULL)
- PHP_FE(ldap_add, NULL)
- PHP_FE(ldap_delete, NULL)
- PHP_FE(ldap_modify, NULL)
-
-/* additional functions for attribute based modifications, Gerrit Thomson */
- PHP_FE(ldap_mod_add, NULL)
- PHP_FE(ldap_mod_replace, NULL)
- PHP_FE(ldap_mod_del, NULL)
-/* end gjt mod */
-
- PHP_FE(ldap_errno, NULL)
- PHP_FE(ldap_err2str, NULL)
- PHP_FE(ldap_error, NULL)
- PHP_FE(ldap_compare, NULL)
-
-#if ( LDAP_API_VERSION > 2000 ) || HAVE_NSLDAP
- PHP_FE(ldap_get_option, third_argument_force_ref)
- PHP_FE(ldap_set_option, NULL)
- PHP_FE(ldap_parse_result, arg3to6of6_force_ref)
- PHP_FE(ldap_first_reference, NULL)
- PHP_FE(ldap_next_reference, NULL)
- PHP_FE(ldap_parse_reference, third_argument_force_ref)
- PHP_FE(ldap_rename, NULL)
-#endif
-
-#ifdef STR_TRANSLATION
- PHP_FE(ldap_t61_to_8859, NULL)
- PHP_FE(ldap_8859_to_t61, NULL)
-#endif
-
- {NULL, NULL, NULL}
-};
-/* }}} */
-
-zend_module_entry ldap_module_entry = {
- "ldap",
- ldap_functions,
- PHP_MINIT(ldap),
- PHP_MSHUTDOWN(ldap),
- NULL,
- NULL,
- PHP_MINFO(ldap),
- STANDARD_MODULE_PROPERTIES
-};
-
-
-#ifdef COMPILE_DL_LDAP
-ZEND_GET_MODULE(ldap)
-#endif
-
-
-static void _close_ldap_link(zend_rsrc_list_entry *rsrc)
-{
- LDAP *ld = (LDAP *)rsrc->ptr;
- LDAPLS_FETCH();
-
- ldap_unbind_s(ld);
- LDAPG(num_links)--;
-}
-
-
-static void _free_ldap_result(zend_rsrc_list_entry *rsrc)
-{
- LDAPMessage *result = (LDAPMessage *)rsrc->ptr;
- ldap_msgfree(result);
-}
-
-/* {{{ PHP_INI_BEGIN
- */
-PHP_INI_BEGIN()
- STD_PHP_INI_ENTRY_EX("ldap.max_links", "-1", PHP_INI_SYSTEM, OnUpdateInt, max_links, zend_ldap_globals, ldap_globals, display_link_numbers)
- STD_PHP_INI_ENTRY("ldap.base_dn", NULL, PHP_INI_ALL, OnUpdateString, base_dn, zend_ldap_globals, ldap_globals)
-PHP_INI_END()
-/* }}} */
-
-/* {{{ php_ldap_init_globals
- */
-static void php_ldap_init_globals(zend_ldap_globals *ldap_globals)
-{
- ldap_globals->num_links = 0;
-}
-/* }}} */
-
-/* {{{ PHP_MINIT_FUNCTION
- */
-PHP_MINIT_FUNCTION(ldap)
-{
- ZEND_INIT_MODULE_GLOBALS(ldap, php_ldap_init_globals, NULL);
-
- REGISTER_INI_ENTRIES();
-
- /* Constants to be used with deref-parameter in php_ldap_do_search() */
- REGISTER_MAIN_LONG_CONSTANT("LDAP_DEREF_NEVER", LDAP_DEREF_NEVER, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_LONG_CONSTANT("LDAP_DEREF_SEARCHING", LDAP_DEREF_SEARCHING, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_LONG_CONSTANT("LDAP_DEREF_FINDING", LDAP_DEREF_FINDING, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_LONG_CONSTANT("LDAP_DEREF_ALWAYS", LDAP_DEREF_ALWAYS, CONST_PERSISTENT | CONST_CS);
-
-#if ( LDAP_API_VERSION > 2000 ) || HAVE_NSLDAP
- /* LDAP options */
- REGISTER_MAIN_LONG_CONSTANT("LDAP_OPT_DEREF", LDAP_OPT_DEREF, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_LONG_CONSTANT("LDAP_OPT_SIZELIMIT", LDAP_OPT_SIZELIMIT, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_LONG_CONSTANT("LDAP_OPT_TIMELIMIT", LDAP_OPT_TIMELIMIT, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_LONG_CONSTANT("LDAP_OPT_PROTOCOL_VERSION", LDAP_OPT_PROTOCOL_VERSION, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_LONG_CONSTANT("LDAP_OPT_ERROR_NUMBER", LDAP_OPT_ERROR_NUMBER, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_LONG_CONSTANT("LDAP_OPT_REFERRALS", LDAP_OPT_REFERRALS, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_LONG_CONSTANT("LDAP_OPT_RESTART", LDAP_OPT_RESTART, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_LONG_CONSTANT("LDAP_OPT_HOST_NAME", LDAP_OPT_HOST_NAME, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_LONG_CONSTANT("LDAP_OPT_ERROR_STRING", LDAP_OPT_ERROR_STRING, CONST_PERSISTENT | CONST_CS);
-#ifdef LDAP_OPT_MATCHED_DN
- REGISTER_MAIN_LONG_CONSTANT("LDAP_OPT_MATCHED_DN", LDAP_OPT_MATCHED_DN, CONST_PERSISTENT | CONST_CS);
-#endif
- REGISTER_MAIN_LONG_CONSTANT("LDAP_OPT_SERVER_CONTROLS", LDAP_OPT_SERVER_CONTROLS, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_LONG_CONSTANT("LDAP_OPT_CLIENT_CONTROLS", LDAP_OPT_CLIENT_CONTROLS, CONST_PERSISTENT | CONST_CS);
-#endif
-
-#ifdef ORALDAP
- REGISTER_MAIN_LONG_CONSTANT("GSLC_SSL_NO_AUTH", GSLC_SSL_NO_AUTH, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_LONG_CONSTANT("GSLC_SSL_ONEWAY_AUTH", GSLC_SSL_ONEWAY_AUTH, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_LONG_CONSTANT("GSLC_SSL_TWOWAY_AUTH", GSLC_SSL_TWOWAY_AUTH, CONST_PERSISTENT | CONST_CS);
-#endif
-
- le_result = zend_register_list_destructors_ex(_free_ldap_result, NULL, "ldap result", module_number);
- le_link = zend_register_list_destructors_ex(_close_ldap_link, NULL, "ldap link", module_number);
- le_result_entry = zend_register_list_destructors_ex(_free_ldap_result, NULL, "ldap result entry", module_number);
-
- ldap_module_entry.type = type;
-
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_MSHUTDOWN_FUNCTION
- */
-PHP_MSHUTDOWN_FUNCTION(ldap)
-{
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_MINFO_FUNCTION
- */
-PHP_MINFO_FUNCTION(ldap)
-{
- char maxl[32];
-#ifdef LDAP_API_VERSION
- char ldapapiversion[32];
-#endif
-#if HAVE_NSLDAP
- char tmp[32];
- LDAPVersion ver;
- double SDKVersion;
-#endif
-
- LDAPLS_FETCH();
-
-#if HAVE_NSLDAP
-/* Print version information */
- SDKVersion = ldap_version( &ver );
-#endif
-
- if (LDAPG(max_links) == -1) {
- snprintf(maxl, 31, "%ld/unlimited", LDAPG(num_links) );
- } else {
- snprintf(maxl, 31, "%ld/%ld", LDAPG(num_links), LDAPG(max_links));
- }
- maxl[31] = 0;
-
- php_info_print_table_start();
- php_info_print_table_row(2, "LDAP Support", "enabled" );
- php_info_print_table_row(2, "RCS Version", "$Id$" );
- php_info_print_table_row(2, "Total Links", maxl );
-
-#ifdef LDAP_API_VERSION
- snprintf(ldapapiversion, 31, "%d", LDAP_API_VERSION);
- php_info_print_table_row(2, "API Version", ldapapiversion);
-#endif
-
-#if HAVE_NSLDAP
- snprintf(tmp, 31, "%f", SDKVersion/100.0 );
- tmp[31]=0;
- php_info_print_table_row(2, "SDK Version", tmp );
-
- snprintf(tmp, 31, "%f", ver.protocol_version/100.0 );
- tmp[31]=0;
- php_info_print_table_row(2, "Highest LDAP Protocol Supported", tmp );
-
- snprintf(tmp, 31, "%f", ver.SSL_version/100.0 );
- tmp[31]=0;
- php_info_print_table_row(2, "SSL Level Supported", tmp );
-
- if ( ver.security_level != LDAP_SECURITY_NONE ) {
- snprintf(tmp, 31, "%d", ver.security_level );
- tmp[31]=0;
- } else {
- strcpy(tmp, "SSL not enabled" );
- }
- php_info_print_table_row(2, "Level of Encryption", tmp );
-#endif
-
- php_info_print_table_end();
-
-}
-/* }}} */
-
-/* {{{ proto int ldap_connect([string host [, int port]])
- Connect to an LDAP server */
-PHP_FUNCTION(ldap_connect)
-{
- char *host;
- int port;
-#ifdef HAVE_ORALDAP
- char *wallet, *walletpasswd;
- int authmode;
- int ssl=0;
-#endif
- /* char *hashed_details;
- int hashed_details_length;*/
- LDAP *ldap;
- LDAPLS_FETCH();
-
- switch(ZEND_NUM_ARGS()) {
- case 0:
- host = NULL;
- port = 0;
- /* hashed_details = estrndup("ldap_", 5);
- hashed_details_length = 4+1; */
- break;
-
- case 1: {
- pval **yyhost;
-
- if (zend_get_parameters_ex(1, &yyhost) == FAILURE) {
- RETURN_FALSE;
- }
-
- convert_to_string_ex(yyhost);
- host = (*yyhost)->value.str.val;
- port = 389; /* Default port */
-
- /* hashed_details_length = yyhost->value.str.len+4+1;
- hashed_details = emalloc(hashed_details_length+1);
- sprintf(hashed_details, "ldap_%s", yyhost->value.str.val);*/
- }
- break;
-
- case 2: {
- pval **yyhost, **yyport;
-
- if (zend_get_parameters_ex(2, &yyhost,&yyport) == FAILURE) {
- RETURN_FALSE;
- }
-
- convert_to_string_ex(yyhost);
- host = (*yyhost)->value.str.val;
- convert_to_long_ex(yyport);
- port = (*yyport)->value.lval;
-
- /* Do we need to take care of hosts running multiple LDAP servers ? */
- /* hashed_details_length = yyhost->value.str.len+4+1;
- hashed_details = emalloc(hashed_details_length+1);
- sprintf(hashed_details, "ldap_%s", yyhost->value.str.val);*/
- }
- break;
-#ifdef HAVE_ORALDAP
-
- case 5: {
- pval **yyhost, **yyport, **yywallet, **yywalletpasswd, **yyauthmode;
-
- if (zend_get_parameters_ex(5, &yyhost, &yyport, &yywallet, &yywalletpasswd, &yyauthmode) == FAILURE) {
- RETURN_FALSE;
- }
-
- convert_to_string_ex(yyhost);
- convert_to_long_ex(yyport);
- convert_to_string_ex(yywallet);
- convert_to_string_ex(yywalletpasswd);
- convert_to_long_ex(yyauthmode);
- host = (*yyhost)->value.str.val;
- port = (*yyport)->value.lval;
- wallet = (*yywallet)->value.str.val;
- walletpasswd = (*yywalletpasswd)->value.str.val;
- authmode = (*yyauthmode)->value.lval;
- ssl = 1;
- }
- break;
-#endif
-
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- if (LDAPG(max_links) != -1 && LDAPG(num_links) >= LDAPG(max_links)) {
- php_error(E_WARNING, "LDAP: Too many open links (%d)", LDAPG(num_links));
- RETURN_FALSE;
- }
-
-#ifdef LDAP_API_FEATURE_X_OPENLDAP
- if (strchr(host, '/')) {
- int rc;
-
- rc = ldap_initialize(&ldap, host);
- if (rc != LDAP_SUCCESS) {
- php_error(E_WARNING, "Could not create LDAP session handle (%d): %s\n", rc, ldap_err2string(rc));
- RETURN_FALSE;
- }
- } else
-#endif
- {
- ldap = ldap_open(host,port);
- }
-
- if ( ldap == NULL ) {
- RETURN_FALSE;
- } else {
-#ifdef HAVE_ORALDAP
- if (ssl) {
- if (ldap_init_SSL(&ldap->ld_sb, wallet, walletpasswd, authmode)) {
- php_error(E_WARNING, "LDAP: SSL init failed");
- RETURN_FALSE;
- }
- }
-#endif
- LDAPG(num_links)++;
- ZEND_REGISTER_RESOURCE(return_value, ldap, le_link);
- }
-
-}
-/* }}} */
-
-/* {{{ _get_lderrno
- */
-static int _get_lderrno(LDAP *ldap)
-{
-#if !HAVE_NSLDAP
-#if LDAP_API_VERSION > 2000
- int lderr;
-
- /* New versions of OpenLDAP do it this way */
- ldap_get_option(ldap, LDAP_OPT_ERROR_NUMBER, &lderr);
- return lderr;
-#else
- return ldap->ld_errno;
-#endif
-#else
- return ldap_get_lderrno(ldap,NULL,NULL);
-#endif
-}
-/* }}} */
-
-/* {{{ proto int ldap_bind(int link [, string dn, string password])
- Bind to LDAP directory */
-PHP_FUNCTION(ldap_bind)
-{
- pval **link, **bind_rdn, **bind_pw;
- char *ldap_bind_rdn, *ldap_bind_pw;
- LDAP *ldap;
-
- switch(ZEND_NUM_ARGS()) {
- case 1: /* Anonymous Bind */
- if (zend_get_parameters_ex(1, &link) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ldap_bind_rdn = NULL;
- ldap_bind_pw = NULL;
-
- break;
-
- case 3 :
- if (zend_get_parameters_ex(3, &link, &bind_rdn,&bind_pw) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(bind_rdn);
- convert_to_string_ex(bind_pw);
-
- ldap_bind_rdn = (*bind_rdn)->value.str.val;
- ldap_bind_pw = (*bind_pw)->value.str.val;
-
- break;
-
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- ZEND_FETCH_RESOURCE(ldap, LDAP *, link, -1, "ldap link", le_link);
-
- if (ldap_bind_s(ldap, ldap_bind_rdn, ldap_bind_pw, LDAP_AUTH_SIMPLE) != LDAP_SUCCESS) {
- php_error(E_WARNING,"LDAP: Unable to bind to server: %s",ldap_err2string(_get_lderrno(ldap)));
- RETURN_FALSE;
- } else {
- RETURN_TRUE;
- }
-}
-/* }}} */
-
-/* {{{ proto int ldap_unbind(int link)
- Unbind from LDAP directory */
-PHP_FUNCTION(ldap_unbind)
-{
- pval **link;
- LDAP *ldap;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &link) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(ldap, LDAP *, link, -1, "ldap link", le_link);
-
- zend_list_delete((*link)->value.lval);
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ hp_set_opts
- */
-static void php_set_opts(LDAP *ldap, int sizelimit, int timelimit, int deref)
-{
- /* sizelimit */
- if (sizelimit > -1) {
-#if ( LDAP_API_VERSION >= 2004 ) || HAVE_NSLDAP
- ldap_set_option(ldap, LDAP_OPT_SIZELIMIT, &sizelimit);
-#else
- ldap->ld_sizelimit = sizelimit;
-#endif
- }
-
- /* timelimit */
- if (timelimit > -1) {
-#if ( LDAP_API_VERSION >= 2004 ) || HAVE_NSLDAP
- ldap_set_option(ldap, LDAP_OPT_TIMELIMIT, &timelimit);
-#else
- ldap->ld_timelimit = timelimit;
-#endif
- }
-
- /* deref */
- if (deref > -1) {
-#if ( LDAP_API_VERSION >= 2004 ) || HAVE_NSLDAP
- ldap_set_option(ldap, LDAP_OPT_DEREF, &deref);
-#else
- ldap->ld_deref = deref;
-#endif
- }
-}
-/* }}} */
-
-/* {{{ php_ldap_do_search
- */
-static void php_ldap_do_search(INTERNAL_FUNCTION_PARAMETERS, int scope)
-{
- pval **link, **base_dn, **filter, **attrs, **attr, **attrsonly, **sizelimit, **timelimit, **deref;
- char *ldap_base_dn, *ldap_filter;
- char **ldap_attrs = NULL;
- LDAP *ldap;
- LDAPMessage *ldap_res;
- int ldap_attrsonly = 0;
- int ldap_sizelimit = -1;
- int ldap_timelimit = -1;
- int ldap_deref = -1;
- int num_attribs = 0;
- int i, errno;
- int myargcount = ZEND_NUM_ARGS();
- LDAPLS_FETCH();
-
- if (myargcount < 3 || myargcount > 8 || zend_get_parameters_ex(myargcount, &link, &base_dn, &filter, &attrs, &attrsonly, &sizelimit, &timelimit, &deref) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- /* Reverse -> fall through */
- switch(myargcount) {
- case 8 :
- convert_to_long_ex(deref);
- ldap_deref = (*deref)->value.lval;
-
- case 7 :
- convert_to_long_ex(timelimit);
- ldap_timelimit = (*timelimit)->value.lval;
-
- case 6 :
- convert_to_long_ex(sizelimit);
- ldap_sizelimit = (*sizelimit)->value.lval;
-
- case 5 :
- convert_to_long_ex(attrsonly);
- ldap_attrsonly = (*attrsonly)->value.lval;
-
- case 4 :
- if ((*attrs)->type != IS_ARRAY) {
- php_error(E_WARNING, "LDAP: Expected Array as last element");
- RETURN_FALSE;
- }
-
- num_attribs = zend_hash_num_elements((*attrs)->value.ht);
- if ((ldap_attrs = emalloc((num_attribs+1) * sizeof(char *))) == NULL) {
- php_error(E_WARNING, "LDAP: Could not allocate memory");
- RETURN_FALSE;
- }
-
- for(i=0; i<num_attribs; i++) {
- if(zend_hash_index_find((*attrs)->value.ht, i, (void **) &attr) == FAILURE) {
- php_error(E_WARNING, "LDAP: Array initialization wrong");
- efree(ldap_attrs);
- RETURN_FALSE;
- }
-
- SEPARATE_ZVAL(attr);
- convert_to_string_ex(attr);
- ldap_attrs[i] = (*attr)->value.str.val;
- }
- ldap_attrs[num_attribs] = NULL;
-
- case 3 :
- /* parallel search? */
- if (Z_TYPE_PP(link) != IS_ARRAY) {
- convert_to_string_ex(filter);
- ldap_filter = Z_STRVAL_PP(filter);
- convert_to_string_ex(base_dn);
- ldap_base_dn = Z_STRVAL_PP(base_dn);
- }
- break;
-
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- /* parallel search? */
- if (Z_TYPE_PP(link) == IS_ARRAY) {
- int i, nlinks, nbases, nfilters, *rcs;
- LDAP **links;
- zval **entry;
-
- nlinks = zend_hash_num_elements(Z_ARRVAL_PP(link));
- if (nlinks == 0) {
- php_error(E_WARNING, "LDAP: No links in link array");
- if (ldap_attrs != NULL) {
- efree(ldap_attrs);
- }
- RETURN_FALSE;
- }
-
- if (Z_TYPE_PP(base_dn) == IS_ARRAY) {
- nbases = zend_hash_num_elements(Z_ARRVAL_PP(base_dn));
- if (nbases != nlinks) {
- php_error(E_WARNING, "LDAP: Base must either be a string, or an array with the same number of elements as the links array");
- if (ldap_attrs != NULL) {
- efree(ldap_attrs);
- }
- RETURN_FALSE;
- }
- zend_hash_internal_pointer_reset(Z_ARRVAL_PP(base_dn));
- } else {
- nbases = 0; /* this means string, not array */
- convert_to_string_ex(base_dn);
- ldap_base_dn = Z_STRLEN_PP(base_dn) < 1 ? NULL : Z_STRVAL_PP(base_dn);
- }
-
- if (Z_TYPE_PP(filter) == IS_ARRAY) {
- nfilters = zend_hash_num_elements(Z_ARRVAL_PP(filter));
- if (nfilters != nlinks) {
- php_error(E_WARNING, "LDAP: Filter must either be a string, or an array with the same number of elements as the links array");
- if (ldap_attrs != NULL) {
- efree(ldap_attrs);
- }
- RETURN_FALSE;
- }
- zend_hash_internal_pointer_reset(Z_ARRVAL_PP(filter));
- } else {
- nfilters = 0; /* this means string, not array */
- convert_to_string_ex(filter);
- ldap_filter = Z_STRVAL_PP(filter);
- }
-
- links = emalloc(nlinks * sizeof(*links));
- rcs = emalloc(nlinks * sizeof(*rcs));
-
- zend_hash_internal_pointer_reset(Z_ARRVAL_PP(link));
- for (i=0; i<nlinks; i++) {
- zend_hash_get_current_data(Z_ARRVAL_PP(link), (void **)&entry);
-
- ZEND_FETCH_RESOURCE(ldap, LDAP *, entry, -1, "ldap link", le_link);
-
- if (ldap == NULL) {
- efree(links);
- efree(rcs);
- if (ldap_attrs != NULL) {
- efree(ldap_attrs);
- }
- RETURN_FALSE;
- }
- if (nbases != 0) { /* base_dn an array? */
- zend_hash_get_current_data(Z_ARRVAL_PP(base_dn), (void **)&entry);
- zend_hash_move_forward(Z_ARRVAL_PP(base_dn));
- convert_to_string_ex(entry);
- ldap_base_dn = Z_STRLEN_PP(entry) < 1 ? NULL : Z_STRVAL_PP(entry);
- }
- if (nfilters != 0) { /* filter an array? */
- zend_hash_get_current_data(Z_ARRVAL_PP(filter), (void **)&entry);
- zend_hash_move_forward(Z_ARRVAL_PP(filter));
- convert_to_string_ex(entry);
- ldap_filter = Z_STRVAL_PP(entry);
- }
-
- php_set_opts(ldap, ldap_sizelimit, ldap_timelimit, ldap_deref);
-
- /* Run the actual search */
- rcs[i] = ldap_search(ldap, ldap_base_dn, scope, ldap_filter, ldap_attrs, ldap_attrsonly);
- links[i] = ldap;
- zend_hash_move_forward(Z_ARRVAL_PP(link));
- }
-
- if (ldap_attrs != NULL) {
- efree(ldap_attrs);
- }
-
- if (array_init(return_value) == FAILURE) {
- efree(links);
- efree(rcs);
- RETURN_FALSE;
- }
-
- /* Collect results from the searches */
- for (i=0; i<nlinks; i++) {
- if (rcs[i] != -1) {
- rcs[i] = ldap_result(links[i], LDAP_RES_ANY, 1 /* LDAP_MSG_ALL */, NULL, &ldap_res);
- }
- if (rcs[i] != -1) {
- add_next_index_long(return_value, zend_list_insert(ldap_res, le_result));
- } else {
- add_next_index_bool(return_value, 0);
- }
- };
- efree(links);
- efree(rcs);
- return;
- }
-
- /* fix to make null base_dn's work */
- if ( strlen(ldap_base_dn) < 1 ) {
- ldap_base_dn = NULL;
- }
-
- ZEND_FETCH_RESOURCE(ldap, LDAP *, link, -1, "ldap link", le_link);
- if (ldap == NULL) {
- if (ldap_attrs != NULL) {
- efree(ldap_attrs);
- }
- RETURN_FALSE;
- }
-
- php_set_opts(ldap, ldap_sizelimit, ldap_timelimit, ldap_deref);
-
- /* Run the actual search */
- errno = ldap_search_s(ldap, ldap_base_dn, scope, ldap_filter, ldap_attrs, ldap_attrsonly, &ldap_res);
-
- if (ldap_attrs != NULL) {
- efree(ldap_attrs);
- }
-
- if (errno != LDAP_SUCCESS
- && errno != LDAP_SIZELIMIT_EXCEEDED
-#ifdef LDAP_ADMINLIMIT_EXCEEDED
- && errno != LDAP_ADMINLIMIT_EXCEEDED
-#endif
-#ifdef LDAP_REFERRAL
- && errno != LDAP_REFERRAL
-#endif
- ) {
- php_error(E_WARNING,"LDAP: Unable to perform the search: %s",ldap_err2string(_get_lderrno(ldap)));
- RETVAL_FALSE;
- } else {
- if (errno == LDAP_SIZELIMIT_EXCEEDED) {
- php_error(E_WARNING,"LDAP: Partial search results returned: Sizelimit exceeded.");
- }
-#ifdef LDAP_ADMINLIMIT_EXCEEDED
- else if (errno == LDAP_ADMINLIMIT_EXCEEDED) {
- php_error(E_WARNING,"LDAP: Partial search results returned: Adminlimit exceeded.");
- }
-#endif
-
- ZEND_REGISTER_RESOURCE(return_value, ldap_res, le_result);
- }
-}
-/* }}} */
-
-/* {{{ proto int ldap_read(int link, string base_dn, string filter [, array attrs [, int attrsonly [, int sizelimit [, int timelimit [, int deref]]]]])
- Read an entry */
-PHP_FUNCTION(ldap_read)
-{
- php_ldap_do_search(INTERNAL_FUNCTION_PARAM_PASSTHRU, LDAP_SCOPE_BASE);
-}
-/* }}} */
-
-/* {{{ proto int ldap_list(int link, string base_dn, string filter [, array attrs [, int attrsonly [, int sizelimit [, int timelimit [, int deref]]]]])
- Single-level search */
-PHP_FUNCTION(ldap_list)
-{
- php_ldap_do_search(INTERNAL_FUNCTION_PARAM_PASSTHRU, LDAP_SCOPE_ONELEVEL);
-}
-/* }}} */
-
-/* {{{ proto int ldap_search(int link, string base_dn, string filter [, array attrs [, int attrsonly [, int sizelimit [, int timelimit [, int deref]]]]])
- Search LDAP tree under base_dn */
-PHP_FUNCTION(ldap_search)
-{
- php_ldap_do_search(INTERNAL_FUNCTION_PARAM_PASSTHRU, LDAP_SCOPE_SUBTREE);
-}
-/* }}} */
-
-/* {{{ proto int ldap_free_result(int result)
- Free result memory */
-PHP_FUNCTION(ldap_free_result)
-{
- pval **result;
- LDAPMessage *ldap_result;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &result) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(ldap_result, LDAPMessage *, result, -1, "ldap result", le_result);
-
- if (ldap_result == NULL) {
- RETVAL_FALSE;
- } else {
- zend_list_delete((*result)->value.lval); /* Delete list entry and call registered destructor function */
- RETVAL_TRUE;
- }
- return;
-}
-/* }}} */
-
-/* {{{ proto int ldap_count_entries(int link, int result)
- Count the number of entries in a search result */
-PHP_FUNCTION(ldap_count_entries)
-{
- pval **link, **result;
- LDAP *ldap;
- LDAPMessage *ldap_result;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &link, &result) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(ldap, LDAP *, link, -1, "ldap link", le_link);
- ZEND_FETCH_RESOURCE(ldap_result, LDAPMessage *, result, -1, "ldap result", le_result);
-
- RETURN_LONG(ldap_count_entries(ldap, ldap_result));
-}
-/* }}} */
-
-/* {{{ proto int ldap_first_entry(int link, int result)
- Return first result id */
-PHP_FUNCTION(ldap_first_entry)
-{
- pval **link, **result;
- LDAP *ldap;
- LDAPMessage *ldap_result, *ldap_result_entry;
- LDAPLS_FETCH();
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &link, &result) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(ldap, LDAP *, link, -1, "ldap link", le_link);
- ZEND_FETCH_RESOURCE(ldap_result, LDAPMessage *, result, -1, "ldap result", le_result);
-
- if ((ldap_result_entry = ldap_first_entry(ldap, ldap_result)) == NULL) {
- RETVAL_FALSE;
- } else {
- ZEND_REGISTER_RESOURCE(return_value, ldap_result_entry, le_result_entry);
- }
-}
-/* }}} */
-
-/* {{{ proto int ldap_next_entry(int link, int entry)
- Get next result entry */
-PHP_FUNCTION(ldap_next_entry)
-{
- pval **link, **result_entry;
- LDAP *ldap;
- LDAPMessage *ldap_result_entry, *ldap_result_entry_next;
- LDAPLS_FETCH();
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &link, &result_entry) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(ldap, LDAP *, link, -1, "ldap link", le_link);
- ZEND_FETCH_RESOURCE(ldap_result_entry, LDAPMessage *, result_entry, -1, "ldap result entry", le_result_entry);
-
- if ((ldap_result_entry_next = ldap_next_entry(ldap, ldap_result_entry)) == NULL) {
- RETVAL_FALSE;
- } else {
- ZEND_REGISTER_RESOURCE(return_value, ldap_result_entry_next, le_result_entry);
- }
-}
-/* }}} */
-
-/* {{{ proto array ldap_get_entries(int link, int result)
- Get all result entries */
-PHP_FUNCTION(ldap_get_entries)
-{
- pval **link, **result;
- LDAPMessage *ldap_result, *ldap_result_entry;
- pval *tmp1, *tmp2;
- LDAP *ldap;
- int num_entries, num_attrib, num_values, i;
- BerElement *ber;
- char *attribute;
- size_t attr_len;
- char **ldap_value;
- char *dn;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &link, &result) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(ldap, LDAP *, link, -1, "ldap link", le_link);
- ZEND_FETCH_RESOURCE(ldap_result, LDAPMessage *, result, -1, "ldap result", le_result);
-
- num_entries = ldap_count_entries(ldap, ldap_result);
-
- array_init(return_value);
- add_assoc_long(return_value, "count", num_entries);
-
- if (num_entries == 0) return;
- num_entries = 0;
-
- ldap_result_entry = ldap_first_entry(ldap, ldap_result);
- if (ldap_result_entry == NULL) RETURN_FALSE;
-
- while(ldap_result_entry != NULL) {
-
- MAKE_STD_ZVAL(tmp1);
- array_init(tmp1);
-
- num_attrib = 0;
- attribute = ldap_first_attribute(ldap, ldap_result_entry, &ber);
-
- while (attribute != NULL) {
- ldap_value = ldap_get_values(ldap, ldap_result_entry, attribute);
- num_values = ldap_count_values(ldap_value);
-
- MAKE_STD_ZVAL(tmp2);
- array_init(tmp2);
- add_assoc_long(tmp2, "count", num_values);
- for(i=0; i < num_values; i++) {
- add_index_string(tmp2, i, ldap_value[i], 1);
- }
- ldap_value_free(ldap_value);
-
- attr_len = strlen(attribute);
- zend_hash_update(tmp1->value.ht, php_strtolower(attribute, attr_len), attr_len+1, (void *) &tmp2, sizeof(pval *), NULL);
- add_index_string(tmp1, num_attrib, attribute, 1);
-
- num_attrib++;
-#if ( LDAP_API_VERSION > 2000 ) || HAVE_NSLDAP || WINDOWS
- ldap_memfree(attribute);
-#endif
- attribute = ldap_next_attribute(ldap, ldap_result_entry, ber);
- }
-#if ( LDAP_API_VERSION > 2000 ) || HAVE_NSLDAP || WINDOWS
- if (ber != NULL)
- ber_free(ber, 0);
-#endif
-
- add_assoc_long(tmp1, "count", num_attrib);
- dn = ldap_get_dn(ldap, ldap_result_entry);
- add_assoc_string(tmp1, "dn", dn, 1);
-#if ( LDAP_API_VERSION > 2000 ) || HAVE_NSLDAP || WINDOWS
- ldap_memfree(dn);
-#endif
-
- zend_hash_index_update(return_value->value.ht, num_entries, (void *) &tmp1, sizeof(pval *), NULL);
-
- num_entries++;
- ldap_result_entry = ldap_next_entry(ldap, ldap_result_entry);
- }
-
- add_assoc_long(return_value, "count", num_entries);
-
-}
-/* }}} */
-
-/* {{{ proto string ldap_first_attribute(int link, int result, int ber)
- Return first attribute */
-PHP_FUNCTION(ldap_first_attribute)
-{
- pval **link, **result, **berp;
- LDAP *ldap;
- LDAPMessage *ldap_result_entry;
- BerElement *ber;
- char *attribute;
- LDAPLS_FETCH();
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &link, &result, &berp) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(ldap, LDAP *, link, -1, "ldap link", le_link);
- ZEND_FETCH_RESOURCE(ldap_result_entry, LDAPMessage *, result, -1, "ldap result entry", le_result_entry);
-
- if ((attribute = ldap_first_attribute(ldap, ldap_result_entry, &ber)) == NULL) {
- RETURN_FALSE;
- } else {
- ZEND_REGISTER_RESOURCE(return_value, ber, le_ber_entry);
-
- RETVAL_STRING(attribute,1);
-#ifdef WINDOWS
- ldap_memfree(attribute);
-#endif
- }
-}
-/* }}} */
-
-/* {{{ proto string ldap_next_attribute(int link, int result, int ber)
- Get the next attribute in result */
-PHP_FUNCTION(ldap_next_attribute)
-{
- pval **link, **result, **berp;
- LDAP *ldap;
- LDAPMessage *ldap_result_entry;
- BerElement *ber;
- char *attribute;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &link, &result, &berp) == FAILURE ) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(ldap, LDAP *, link, -1, "ldap link", le_link);
- ZEND_FETCH_RESOURCE(ldap_result_entry, LDAPMessage *, result, -1, "ldap result entry", le_result_entry);
- ZEND_FETCH_RESOURCE(ber, BerElement *, berp, -1, "ldap ber entry", le_ber_entry);
-
- if ((attribute = ldap_next_attribute(ldap, ldap_result_entry, ber)) == NULL) {
- RETURN_FALSE;
- } else {
- ZEND_REGISTER_RESOURCE(return_value, ber, le_ber_entry);
-
- RETVAL_STRING(attribute,1);
-#ifdef WINDOWS
- ldap_memfree(attribute);
-#endif
- }
-}
-/* }}} */
-
-/* {{{ proto array ldap_get_attributes(int link, int result)
- Get attributes from a search result entry */
-PHP_FUNCTION(ldap_get_attributes)
-{
- pval **link, **result_entry;
- pval *tmp;
- LDAP *ldap;
- LDAPMessage *ldap_result_entry;
- char *attribute;
- char **ldap_value;
- int i, num_values, num_attrib;
- BerElement *ber;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &link, &result_entry) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(ldap, LDAP *, link, -1, "ldap link", le_link);
- ZEND_FETCH_RESOURCE(ldap_result_entry, LDAPMessage *, result_entry, -1, "ldap result entry", le_result_entry);
-
- array_init(return_value);
- num_attrib = 0;
-
- attribute = ldap_first_attribute(ldap, ldap_result_entry, &ber);
- while (attribute != NULL) {
- ldap_value = ldap_get_values(ldap, ldap_result_entry, attribute);
- num_values = ldap_count_values(ldap_value);
-
- MAKE_STD_ZVAL(tmp);
- array_init(tmp);
- add_assoc_long(tmp, "count", num_values);
- for(i=0; i<num_values; i++) {
- add_index_string(tmp, i, ldap_value[i], 1);
- }
- ldap_value_free(ldap_value);
-
- zend_hash_update(return_value->value.ht, attribute, strlen(attribute)+1, (void *) &tmp, sizeof(pval *), NULL);
- add_index_string(return_value, num_attrib, attribute, 1);
-
- num_attrib++;
- attribute = ldap_next_attribute(ldap, ldap_result_entry, ber);
- }
-
- add_assoc_long(return_value, "count", num_attrib);
-}
-/* }}} */
-
-/* {{{ proto array ldap_get_values(int link, int result, string attribute)
- Get all values from a result entry */
-PHP_FUNCTION(ldap_get_values)
-{
- pval **link, **result_entry, **attr;
- LDAP *ldap;
- LDAPMessage *ldap_result_entry;
- char *attribute;
- char **ldap_value;
- int i, num_values;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &link,&result_entry, &attr) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(ldap, LDAP *, link, -1, "ldap link", le_link);
- ZEND_FETCH_RESOURCE(ldap_result_entry, LDAPMessage *, result_entry, -1, "ldap result entry", le_result_entry);
-
- convert_to_string_ex(attr);
- attribute = (*attr)->value.str.val;
-
- if ((ldap_value = ldap_get_values(ldap, ldap_result_entry, attribute)) == NULL) {
- php_error(E_WARNING, "LDAP: Cannot get the value(s) of attribute %s", ldap_err2string(_get_lderrno(ldap)));
- RETURN_FALSE;
- }
-
- num_values = ldap_count_values(ldap_value);
-
- if (array_init(return_value) == FAILURE) {
- RETURN_FALSE;
- }
-
- for(i=0; i<num_values; i++) {
- add_next_index_string(return_value, ldap_value[i], 1);
- }
-
- add_assoc_long(return_value, "count", num_values);
- ldap_value_free(ldap_value);
-
-}
-/* }}} */
-
-/* {{{ proto array ldap_get_values_len(int link, int result, string attribute)
- Get all values with lengths from a result entry */
-PHP_FUNCTION(ldap_get_values_len)
-{
- pval **link, **result_entry, **attr;
- LDAP* ldap;
- LDAPMessage* ldap_result_entry;
- char* attribute;
- struct berval **ldap_value_len;
- int i, num_values;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &link, &result_entry, &attr) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(ldap, LDAP *, link, -1, "ldap link", le_link);
- ZEND_FETCH_RESOURCE(ldap_result_entry, LDAPMessage *, result_entry, -1, "ldap result entry", le_result_entry);
-
- convert_to_string_ex(attr);
- attribute = (*attr)->value.str.val;
-
- if ((ldap_value_len = ldap_get_values_len(ldap, ldap_result_entry, attribute)) == NULL) {
- php_error(E_WARNING, "LDAP: Cannot get the value(s) of attribute %s", ldap_err2string(_get_lderrno(ldap)));
- RETURN_FALSE;
- }
-
- num_values = ldap_count_values_len(ldap_value_len);
- if (array_init(return_value) == FAILURE) {
- php_error(E_ERROR, "Cannot initialize return value");
- RETURN_FALSE;
- }
-
- for (i=0; i<num_values; i++) {
- add_next_index_stringl(return_value, ldap_value_len[i]->bv_val, ldap_value_len[i]->bv_len, 1);
- }
-
- add_assoc_long(return_value, "count", num_values);
- ldap_value_free_len(ldap_value_len);
-
-}
-/* }}} */
-
-/* {{{ proto string ldap_get_dn(int link, int result)
- Get the DN of a result entry */
-PHP_FUNCTION(ldap_get_dn)
-{
- pval **link,**result_entry;
- LDAP *ldap;
- LDAPMessage *ldap_result_entry;
- char *text;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &link, &result_entry) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(ldap, LDAP *, link, -1, "ldap link", le_link);
- ZEND_FETCH_RESOURCE(ldap_result_entry, LDAPMessage *, result_entry, -1, "ldap result entry", le_result_entry);
-
- text = ldap_get_dn(ldap, ldap_result_entry);
- if ( text != NULL ) {
- RETVAL_STRING(text,1);
-#ifdef WINDOWS
- ldap_memfree(text);
-#endif
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto array ldap_explode_dn(string dn, int with_attrib)
- Splits DN into its component parts */
-PHP_FUNCTION(ldap_explode_dn)
-{
- pval **dn, **with_attrib;
- char **ldap_value;
- int i, count;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &dn,&with_attrib) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(dn);
- convert_to_long_ex(with_attrib);
-
- ldap_value = ldap_explode_dn((*dn)->value.str.val,(*with_attrib)->value.lval);
-
- i=0;
- while(ldap_value[i] != NULL) i++;
- count = i;
-
- if (array_init(return_value) == FAILURE) {
- RETURN_FALSE;
- }
-
- add_assoc_long(return_value, "count", count);
- for(i=0; i<count; i++) {
- add_index_string(return_value, i, ldap_value[i], 1);
- }
-
- ldap_value_free(ldap_value);
-}
-/* }}} */
-
-/* {{{ proto string ldap_dn2ufn(string dn)
- Convert DN to User Friendly Naming format */
-PHP_FUNCTION(ldap_dn2ufn)
-{
- pval **dn;
- char *ufn;
-
- if (ZEND_NUM_ARGS() !=1 || zend_get_parameters_ex(1,&dn)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(dn);
-
- ufn = ldap_dn2ufn((*dn)->value.str.val);
-
- if (ufn !=NULL) {
- RETVAL_STRING(ufn,1);
-#ifdef WINDOWS
- ldap_memfree(ufn);
-#endif
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-
-/* added to fix use of ldap_modify_add for doing an ldap_add, gerrit thomson. */
-#define PHP_LD_FULL_ADD 0xff
-/* {{{ php_ldap_do_modify
- */
-static void php_ldap_do_modify(INTERNAL_FUNCTION_PARAMETERS, int oper)
-{
- pval **link, **dn, **entry, **value, **ivalue;
- LDAP *ldap;
- char *ldap_dn;
- LDAPMod **ldap_mods;
- int i, j, num_attribs, num_values;
- int *num_berval;
- char *attribute;
- ulong index;
- int is_full_add=0; /* flag for full add operation so ldap_mod_add can be put back into oper, gerrit THomson */
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &link, &dn, &entry) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if ((*entry)->type != IS_ARRAY) {
- php_error(E_WARNING, "LDAP: Expected Array as the last element");
- RETURN_FALSE;
- }
-
- ZEND_FETCH_RESOURCE(ldap, LDAP *, link, -1, "ldap link", le_link);
-
- convert_to_string_ex(dn);
- ldap_dn = (*dn)->value.str.val;
-
- num_attribs = zend_hash_num_elements((*entry)->value.ht);
- ldap_mods = emalloc((num_attribs+1) * sizeof(LDAPMod *));
- num_berval = emalloc(num_attribs * sizeof(int));
- zend_hash_internal_pointer_reset((*entry)->value.ht);
-
- /* added by gerrit thomson to fix ldap_add using ldap_mod_add */
- if ( oper == PHP_LD_FULL_ADD ) {
- oper = LDAP_MOD_ADD;
- is_full_add = 1;
- }
- /* end additional , gerrit thomson */
-
- for(i=0; i<num_attribs; i++) {
- ldap_mods[i] = emalloc(sizeof(LDAPMod));
- ldap_mods[i]->mod_op = oper | LDAP_MOD_BVALUES;
-
- if (zend_hash_get_current_key((*entry)->value.ht, &attribute, &index, 0) == HASH_KEY_IS_STRING) {
- ldap_mods[i]->mod_type = estrdup(attribute);
- } else {
- php_error(E_ERROR, "LDAP: Unknown Attribute in the data");
- /* Free allocated memory */
- while (i >= 0) {
- efree(ldap_mods[i--]);
- }
- efree(num_berval);
- efree(ldap_mods);
- RETURN_FALSE;
- }
-
- zend_hash_get_current_data((*entry)->value.ht, (void **)&value);
-
- if ((*value)->type != IS_ARRAY) {
- num_values = 1;
- } else {
- num_values = zend_hash_num_elements((*value)->value.ht);
- }
-
- num_berval[i] = num_values;
- ldap_mods[i]->mod_bvalues = emalloc((num_values + 1) * sizeof(struct berval *));
-
-/* allow for arrays with one element, no allowance for arrays with none but probably not required, gerrit thomson. */
-/* if (num_values == 1) {*/
- if ((num_values == 1) && ((*value)->type != IS_ARRAY)) {
- convert_to_string_ex(value);
- ldap_mods[i]->mod_bvalues[0] = (struct berval *) emalloc (sizeof(struct berval));
- ldap_mods[i]->mod_bvalues[0]->bv_len = (*value)->value.str.len;
- ldap_mods[i]->mod_bvalues[0]->bv_val = (*value)->value.str.val;
- } else {
- for(j=0; j < num_values; j++) {
- zend_hash_index_find((*value)->value.ht,j, (void **) &ivalue);
- convert_to_string_ex(ivalue);
- ldap_mods[i]->mod_bvalues[j] = (struct berval *) emalloc (sizeof(struct berval));
- ldap_mods[i]->mod_bvalues[j]->bv_len = (*ivalue)->value.str.len;
- ldap_mods[i]->mod_bvalues[j]->bv_val = (*ivalue)->value.str.val;
- }
- }
- ldap_mods[i]->mod_bvalues[num_values] = NULL;
- zend_hash_move_forward((*entry)->value.ht);
- }
- ldap_mods[num_attribs] = NULL;
-
-/* check flag to see if do_mod was called to perform full add , gerrit thomson */
-/* if (oper == LDAP_MOD_ADD) { */
- if (is_full_add == 1) {
- if (ldap_add_s(ldap, ldap_dn, ldap_mods) != LDAP_SUCCESS) {
- ldap_perror(ldap, "LDAP");
- php_error(E_WARNING, "LDAP: add operation could not be completed.");
- RETVAL_FALSE;
- } else RETVAL_TRUE;
- } else {
- if (ldap_modify_s(ldap, ldap_dn, ldap_mods) != LDAP_SUCCESS) {
- php_error(E_WARNING, "LDAP: modify operation could not be completed.");
- RETVAL_FALSE;
- } else RETVAL_TRUE;
- }
-
- for(i=0; i < num_attribs; i++) {
- efree(ldap_mods[i]->mod_type);
- for(j=0; j<num_berval[i]; j++) {
- efree(ldap_mods[i]->mod_bvalues[j]);
- }
- efree(ldap_mods[i]->mod_bvalues);
- efree(ldap_mods[i]);
- }
- efree(num_berval);
- efree(ldap_mods);
-
- return;
-}
-/* }}} */
-
-/* {{{ proto int ldap_add(int link, string dn, array entry)
- Add entries to LDAP directory */
-PHP_FUNCTION(ldap_add)
-{
- /* use a newly define parameter into the do_modify so ldap_mod_add can be used the way it is supposed to be used , Gerrit THomson */
- /* php_ldap_do_modify(INTERNAL_FUNCTION_PARAM_PASSTHRU, LDAP_MOD_ADD);*/
- php_ldap_do_modify(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_LD_FULL_ADD);
-}
-/* }}} */
-
-/* {{{ proto int ldap_modify(int link, string dn, array entry)
- Modify an LDAP entry */
-PHP_FUNCTION(ldap_modify)
-{
- php_ldap_do_modify(INTERNAL_FUNCTION_PARAM_PASSTHRU, LDAP_MOD_REPLACE);
-}
-/* }}} */
-
-
-/* three functions for attribute base modifications, gerrit Thomson */
-
-/* {{{ proto int ldap_mod_replace(int link, string dn, array entry)
- Replace attribute values with new ones */
-PHP_FUNCTION(ldap_mod_replace)
-{
- php_ldap_do_modify(INTERNAL_FUNCTION_PARAM_PASSTHRU, LDAP_MOD_REPLACE);
-}
-/* }}} */
-
-/* {{{ proto int ldap_mod_add(int link, string dn, array entry)
- Add attribute values to current */
-PHP_FUNCTION(ldap_mod_add)
-{
- php_ldap_do_modify(INTERNAL_FUNCTION_PARAM_PASSTHRU, LDAP_MOD_ADD);
-}
-/* }}} */
-
-/* {{{ proto int ldap_mod_del(int link, string dn, array entry)
- Delete attribute values */
-PHP_FUNCTION(ldap_mod_del)
-{
- php_ldap_do_modify(INTERNAL_FUNCTION_PARAM_PASSTHRU, LDAP_MOD_DELETE);
-}
-/* }}} */
-
-/* end of attribute based functions , gerrit thomson */
-
-
-/* {{{ proto int ldap_delete(int link, string dn)
- Delete an entry from a directory */
-PHP_FUNCTION(ldap_delete)
-{
- pval **link, **dn;
- LDAP *ldap;
- char *ldap_dn;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &link, &dn) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(ldap, LDAP *, link, -1, "ldap link", le_link);
-
- convert_to_string_ex(dn);
- ldap_dn = (*dn)->value.str.val;
-
- if (ldap_delete_s(ldap, ldap_dn) != LDAP_SUCCESS) {
- ldap_perror(ldap, "LDAP");
- RETURN_FALSE;
- }
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int ldap_errno(int link)
- Get the current ldap error number */
-PHP_FUNCTION(ldap_errno)
-{
- pval **link;
- LDAP *ldap;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(ht, &link) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(ldap, LDAP *, link, -1, "ldap link", le_link);
-
- if (ldap == NULL) {
- RETURN_LONG(0);
- }
-
- RETURN_LONG( _get_lderrno(ldap) );
-}
-/* }}} */
-
-/* {{{ proto string ldap_err2str(int errno)
- Convert error number to error string */
-PHP_FUNCTION(ldap_err2str)
-{
- zval **perrno;
-
- if ( ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(ht, &perrno) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(perrno);
- RETURN_STRING(ldap_err2string((*perrno)->value.lval), 1);
-}
-/* }}} */
-
-/* {{{ proto string ldap_error(int link)
- Get the current ldap error string */
-PHP_FUNCTION(ldap_error)
-{
- pval **link;
- LDAP *ldap;
- int ld_errno;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(ht, &link) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(ldap, LDAP *, link, -1, "ldap link", le_link);
-
- ld_errno = _get_lderrno(ldap);
-
- RETURN_STRING(ldap_err2string(ld_errno), 1);
-}
-/* }}} */
-
-/* {{{ proto int ldap_compare(int link, string dn, string attr, string value)
- Determine if an entry has a specific value for one of its attributes */
-PHP_FUNCTION(ldap_compare)
-{
- pval **link, **dn, **attr, **value;
- char *ldap_dn, *ldap_attr, *ldap_value;
- LDAP *ldap;
- int errno;
-
- if (ZEND_NUM_ARGS() != 4 || zend_get_parameters_ex(4, &link, &dn, &attr, &value) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(ldap, LDAP *, link, -1, "ldap link", le_link);
-
- if (ldap == NULL) RETURN_LONG(-1);
-
- convert_to_string_ex(dn);
- convert_to_string_ex(attr);
- convert_to_string_ex(value);
-
- ldap_dn = (*dn)->value.str.val;
- ldap_attr = (*attr)->value.str.val;
- ldap_value = (*value)->value.str.val;
-
- errno = ldap_compare_s(ldap, ldap_dn, ldap_attr, ldap_value);
-
- switch(errno) {
- case LDAP_COMPARE_TRUE :
- RETURN_TRUE;
- break;
-
- case LDAP_COMPARE_FALSE :
- RETURN_FALSE;
- break;
- }
-
- php_error(E_WARNING, "LDAP: Compare operation could not be completed: %s", ldap_err2string(errno));
- RETURN_LONG(-1);
-
-}
-/* }}} */
-
-
-#if ( LDAP_API_VERSION > 2000 ) || HAVE_NSLDAP
-/* {{{ proto boolean ldap_get_option(int link, int option, mixed retval)
- Get the current value of various session-wide parameters */
-PHP_FUNCTION(ldap_get_option)
-{
- pval **link, **option, **retval;
- LDAP *ldap;
- int opt;
-
- if (ZEND_NUM_ARGS() != 3 ||
- zend_get_parameters_ex(3, &link, &option, &retval) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(ldap, LDAP *, link, -1, "ldap link", le_link);
-
- convert_to_long_ex(option);
- opt = (*option)->value.lval;
-
- switch(opt) {
- /* options with int value */
- case LDAP_OPT_DEREF:
- case LDAP_OPT_SIZELIMIT:
- case LDAP_OPT_TIMELIMIT:
- case LDAP_OPT_PROTOCOL_VERSION:
- case LDAP_OPT_ERROR_NUMBER:
- case LDAP_OPT_REFERRALS:
- case LDAP_OPT_RESTART:
- {
- int val;
- if (ldap_get_option(ldap, opt, &val)) {
- RETURN_FALSE;
- }
- zval_dtor(*retval);
- ZVAL_LONG(*retval, val);
- } break;
- /* options with string value */
- case LDAP_OPT_HOST_NAME:
- case LDAP_OPT_ERROR_STRING:
-#ifdef LDAP_OPT_MATCHED_DN
- case LDAP_OPT_MATCHED_DN:
-#endif
- {
- char *val;
- if (ldap_get_option(ldap, opt, &val)) {
- RETURN_FALSE;
- }
- zval_dtor(*retval);
- ZVAL_STRING(*retval, val, 1);
- ldap_memfree(val);
- } break;
-/* options not implemented
- case LDAP_OPT_SERVER_CONTROLS:
- case LDAP_OPT_CLIENT_CONTROLS:
- case LDAP_OPT_API_INFO:
- case LDAP_OPT_API_FEATURE_INFO:
-*/
- default:
- RETURN_FALSE;
- }
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto boolean ldap_set_option(int link, int option, mixed newval)
- Set the value of various session-wide parameters */
-PHP_FUNCTION(ldap_set_option)
-{
- pval **link, **option, **newval;
- LDAP *ldap;
- int opt;
-
- if (ZEND_NUM_ARGS() != 3 ||
- zend_get_parameters_ex(3, &link, &option, &newval) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(ldap, LDAP *, link, -1, "ldap link", le_link);
-
- convert_to_long_ex(option);
- opt = (*option)->value.lval;
-
- switch(opt) {
- /* options with int value */
- case LDAP_OPT_DEREF:
- case LDAP_OPT_SIZELIMIT:
- case LDAP_OPT_TIMELIMIT:
- case LDAP_OPT_PROTOCOL_VERSION:
- case LDAP_OPT_ERROR_NUMBER:
- {
- int val;
- convert_to_long_ex(newval);
- val = (*newval)->value.lval;
- if (ldap_set_option(ldap, opt, &val)) {
- RETURN_FALSE;
- }
- } break;
- /* options with string value */
- case LDAP_OPT_HOST_NAME:
- case LDAP_OPT_ERROR_STRING:
-#ifdef LDAP_OPT_MATCHED_DN
- case LDAP_OPT_MATCHED_DN:
-#endif
- {
- char *val;
- convert_to_string_ex(newval);
- val = (*newval)->value.str.val;
- if (ldap_set_option(ldap, opt, val)) {
- RETURN_FALSE;
- }
- } break;
- /* options with boolean value */
- case LDAP_OPT_REFERRALS:
- case LDAP_OPT_RESTART:
- {
- void *val;
- convert_to_boolean_ex(newval);
- val = (*newval)->value.lval
- ? LDAP_OPT_ON : LDAP_OPT_OFF;
- if (ldap_set_option(ldap, opt, val)) {
- RETURN_FALSE;
- }
- } break;
- /* options with control list value */
- case LDAP_OPT_SERVER_CONTROLS:
- case LDAP_OPT_CLIENT_CONTROLS:
- {
- LDAPControl *ctrl, **ctrls, **ctrlp;
- zval **ctrlval, **val;
- int ncontrols;
- char error=0;
-
- if ((Z_TYPE_PP(newval) != IS_ARRAY) || !(ncontrols = zend_hash_num_elements(Z_ARRVAL_PP(newval)))) {
- php_error(E_WARNING, "Expected non-empty array value for this option");
- RETURN_FALSE;
- }
- ctrls = emalloc((1 + ncontrols) * sizeof(*ctrls));
- *ctrls = NULL;
- ctrlp = ctrls;
- zend_hash_internal_pointer_reset(Z_ARRVAL_PP(newval));
- while (zend_hash_get_current_data(Z_ARRVAL_PP(newval), (void**)&ctrlval) == SUCCESS) {
- if (Z_TYPE_PP(ctrlval) != IS_ARRAY) {
- php_error(E_WARNING, "The array value must contain only arrays, where each array is a control");
- error = 1;
- break;
- }
- if (zend_hash_find(Z_ARRVAL_PP(ctrlval), "oid", sizeof("oid"), (void **) &val) == FAILURE) {
- php_error(E_WARNING, "Control must have an oid key");
- error = 1;
- break;
- }
- ctrl = *ctrlp = emalloc(sizeof(**ctrlp));
- convert_to_string_ex(val);
- ctrl->ldctl_oid = Z_STRVAL_PP(val);
- if (zend_hash_find(Z_ARRVAL_PP(ctrlval), "value", sizeof("value"), (void **) &val) == SUCCESS) {
- convert_to_string_ex(val);
- ctrl->ldctl_value.bv_val = Z_STRVAL_PP(val);
- ctrl->ldctl_value.bv_len = Z_STRLEN_PP(val);
- } else {
- ctrl->ldctl_value.bv_val = NULL;
- ctrl->ldctl_value.bv_len = 0;
- }
- if (zend_hash_find(Z_ARRVAL_PP(ctrlval), "iscritical", sizeof("iscritical"), (void **) &val) == SUCCESS) {
- convert_to_boolean_ex(val);
- ctrl->ldctl_iscritical = Z_BVAL_PP(val);
- } else {
- ctrl->ldctl_iscritical = 0;
- }
-
- ++ctrlp;
- *ctrlp = NULL;
- zend_hash_move_forward(Z_ARRVAL_PP(newval));
- }
- if (!error) {
- error = ldap_set_option(ldap, opt, ctrls);
- }
- ctrlp = ctrls;
- while ( *ctrlp ) {
- efree(*ctrlp);
- ctrlp++;
- }
- efree(ctrls);
- if (error) {
- RETURN_FALSE;
- }
- } break;
- default:
- RETURN_FALSE;
- }
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto boolean ldap_parse_result(int link, int result, int errcode, string matcheddn, string errmsg, array referrals)
- Extract information from result */
-PHP_FUNCTION(ldap_parse_result)
-{
- pval **link, **result, **errcode, **matcheddn, **errmsg, **referrals;
- LDAP *ldap;
- LDAPMessage *ldap_result;
- char **lreferrals, **refp;
- char *lmatcheddn, *lerrmsg;
- int rc, lerrcode, myargcount = ZEND_NUM_ARGS();
-
- if (myargcount < 3 || myargcount > 6 || zend_get_parameters_ex(myargcount, &link, &result, &errcode, &matcheddn, &errmsg, &referrals) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(ldap, LDAP *, link, -1, "ldap link", le_link);
- ZEND_FETCH_RESOURCE(ldap_result, LDAPMessage *, result, -1, "ldap result", le_result);
-
- rc = ldap_parse_result( ldap, ldap_result, &lerrcode,
- myargcount > 3 ? &lmatcheddn : NULL,
- myargcount > 4 ? &lerrmsg : NULL,
- myargcount > 5 ? &lreferrals : NULL,
- NULL /* &serverctrls */,
- 0 );
- if (rc != LDAP_SUCCESS ) {
- php_error(E_WARNING,"LDAP: Unable to parse result: %s", ldap_err2string(_get_lderrno(ldap)));
- RETURN_FALSE;
- }
-
- zval_dtor(*errcode);
- ZVAL_LONG(*errcode, lerrcode);
-
- /* Reverse -> fall through */
- switch(myargcount) {
- case 6 :
- zval_dtor(*referrals);
- if (array_init(*referrals) == FAILURE) {
- php_error(E_ERROR, "Cannot initialize return value");
- ldap_value_free(lreferrals);
- ldap_memfree(lerrmsg);
- ldap_memfree(lmatcheddn);
- RETURN_FALSE;
- }
- if (lreferrals != NULL) {
- refp = lreferrals;
- while (*refp) {
- add_next_index_string(*referrals, *refp, 1);
- refp++;
- }
- ldap_value_free(lreferrals);
- }
- case 5 :
- zval_dtor(*errmsg);
- if (lerrmsg == NULL) {
- ZVAL_EMPTY_STRING(*errmsg);
- } else {
- ZVAL_STRING(*errmsg, lerrmsg, 1);
- ldap_memfree(lerrmsg);
- }
- case 4 :
- zval_dtor(*matcheddn);
- if (lmatcheddn == NULL) {
- ZVAL_EMPTY_STRING(*matcheddn);
- } else {
- ZVAL_STRING(*matcheddn, lmatcheddn, 1);
- ldap_memfree(lmatcheddn);
- }
- }
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int ldap_first_reference(int link, int result)
- Return first reference */
-PHP_FUNCTION(ldap_first_reference)
-{
- pval **link, **result;
- LDAP *ldap;
- LDAPMessage *ldap_result;
- LDAPMessage *ldap_result_entry;
- LDAPLS_FETCH();
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &link, &result) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(ldap, LDAP *, link, -1, "ldap link", le_link);
- ZEND_FETCH_RESOURCE(ldap_result, LDAPMessage *, result, -1, "ldap result", le_result);
-
- if ((ldap_result_entry = ldap_first_reference(ldap, ldap_result)) == NULL) {
- RETVAL_FALSE;
- } else {
- ZEND_REGISTER_RESOURCE(return_value, ldap_result_entry, le_result_entry);
- }
-}
-/* }}} */
-
-/* {{{ proto int ldap_next_reference(int link, int entry)
- Get next reference */
-PHP_FUNCTION(ldap_next_reference)
-{
- pval **link, **result_entry;
- LDAP *ldap;
- LDAPMessage *ldap_result_entry, *ldap_result_entry_next;
- LDAPLS_FETCH();
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &link, &result_entry) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(ldap, LDAP *, link, -1, "ldap link", le_link);
- ZEND_FETCH_RESOURCE(ldap_result_entry, LDAPMessage *, result_entry, -1, "ldap result entry", le_result_entry);
-
- if ((ldap_result_entry_next = ldap_next_reference(ldap, ldap_result_entry)) == NULL) {
- RETVAL_FALSE;
- } else {
- ZEND_REGISTER_RESOURCE(return_value, ldap_result_entry_next, le_result_entry);
- }
-}
-/* }}} */
-
-/* {{{ proto boolean ldap_parse_reference(int link, int entry, array referrals)
- Extract information from reference entry */
-PHP_FUNCTION(ldap_parse_reference)
-{
- pval **link, **result_entry, **referrals;
- LDAP *ldap;
- LDAPMessage *ldap_result_entry;
- char **lreferrals, **refp;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &link, &result_entry, &referrals) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(ldap, LDAP *, link, -1, "ldap link", le_link);
- ZEND_FETCH_RESOURCE(ldap_result_entry, LDAPMessage *, result_entry, -1, "ldap result entry", le_result_entry);
-
- if (ldap_parse_reference(ldap, ldap_result_entry, &lreferrals, NULL /* &serverctrls */, 0) != LDAP_SUCCESS) {
- RETURN_FALSE;
- }
-
- zval_dtor(*referrals);
- if (array_init(*referrals) == FAILURE) {
- php_error(E_ERROR, "Cannot initialize return value");
- ldap_value_free(lreferrals);
- RETURN_FALSE;
- }
- if (lreferrals != NULL) {
- refp = lreferrals;
- while (*refp) {
- add_next_index_string(*referrals, *refp, 1);
- refp++;
- }
- ldap_value_free(lreferrals);
- }
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto boolean ldap_rename(int link, string dn, string newrdn, string newparent, boolean deleteoldrdn);
- Modify the name of an entry */
-PHP_FUNCTION(ldap_rename)
-{
- pval **link, **dn, **newrdn, **newparent, **deleteoldrdn;
- LDAP *ldap;
- int rc;
-
- if (ZEND_NUM_ARGS() != 5 || zend_get_parameters_ex(5, &link, &dn, &newrdn, &newparent, &deleteoldrdn) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(ldap, LDAP *, link, -1, "ldap link", le_link);
-
- convert_to_string_ex(dn);
- convert_to_string_ex(newrdn);
- convert_to_string_ex(newparent);
- convert_to_boolean_ex(deleteoldrdn);
-
-#if ( LDAP_API_VERSION > 2000 ) || HAVE_NSLDAP
- rc = ldap_rename_s(ldap, Z_STRVAL_PP(dn), Z_STRVAL_PP(newrdn), Z_STRVAL_PP(newparent), Z_BVAL_PP(deleteoldrdn), NULL, NULL);
-#else
- if (Z_STRLEN_PP(newparent) != 0) {
- php_error(E_WARNING, "You are using old LDAP API, newparent must be the empty string, can only modify RDN");
- RETURN_FALSE;
- }
-/* could support old APIs but need check for ldap_modrdn2()/ldap_modrdn() */
- rc = ldap_modrdn2_s(ldap, Z_STRVAL_PP(dn), Z_STRVAL_PP(newrdn), Z_BVAL_PP(deleteoldrdn));
-#endif
-
- if (rc == LDAP_SUCCESS) {
- RETURN_TRUE;
- }
- RETURN_FALSE;
-}
-/* }}} */
-#endif
-
-
-#ifdef STR_TRANSLATION
-/* {{{ php_ldap_do_translate
- */
-static void php_ldap_do_translate(INTERNAL_FUNCTION_PARAMETERS, int way)
-{
- zval **value;
- char *ldap_buf;
- unsigned long ldap_len;
- int result;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &value) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(value);
- ldap_buf = (*value)->value.str.val;
- ldap_len = (*value)->value.str.len;
-
- if(ldap_len == 0) {
- RETURN_FALSE;
- }
-
- if(way == 1) {
- result = ldap_8859_to_t61(&ldap_buf, &ldap_len, 0);
- } else {
- result = ldap_t61_to_8859(&ldap_buf, &ldap_len, 0);
- }
-
- if (result == LDAP_SUCCESS) {
- RETVAL_STRINGL(ldap_buf,ldap_len,1);
- free(ldap_buf);
- } else {
- php_error(E_ERROR, "LDAP: Conversion from iso-8859-1 to t61 failed.");
- RETVAL_FALSE;
- }
-
- return;
-}
-/* }}} */
-
-/* {{{ proto string ldap_t61_to_8859(string value)
- Translate t61 characters to 8859 characters */
-PHP_FUNCTION(ldap_t61_to_8859) {
- php_ldap_do_translate(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-/* }}} */
-
-/* {{{ proto string ldap_8859_to_t61(string value)
- Translate 8859 characters to t61 characters */
-PHP_FUNCTION(ldap_8859_to_t61) {
- php_ldap_do_translate(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
-}
-/* }}} */
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/ldap/ldap.dsp b/ext/ldap/ldap.dsp
deleted file mode 100644
index 94bd7c4fa9..0000000000
--- a/ext/ldap/ldap.dsp
+++ /dev/null
@@ -1,230 +0,0 @@
-# Microsoft Developer Studio Project File - Name="ldap" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=ldap - Win32 Debug_TS SASL
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "ldap.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "ldap.mak" CFG="ldap - Win32 Debug_TS SASL"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "ldap - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "ldap - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "ldap - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "ldap - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "ldap - Win32 Release_TS SASL" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "ldap - Win32 Debug_TS SASL" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "ldap - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LDAP_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /I "..\..\..\php_build\openldap\include" /D "NDEBUG" /D ZEND_DEBUG=0 /D "COMPILE_DL_LDAP_LDAP" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LDAP_EXPORTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_LDAP=1 /D "COMPILE_DL_LDAP" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 oldap32.lib olber32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib php4nts.lib /nologo /dll /machine:I386 /out:"Release/php_ldap.dll" /libpath:"..\..\Release" /libpath:"..\..\..\php_build\openldap\libraries\Release"
-
-!ELSEIF "$(CFG)" == "ldap - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LDAP_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /I "..\..\..\php_build\openldap\include" /D "_DEBUG" /D ZEND_DEBUG=1 /D "COMPILE_DL_LDAP_LDAP" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LDAP_EXPORTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_LDAP=1 /D "COMPILE_DL_LDAP" /FR /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 oldap32.lib olber32.lib php4nts_debug.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib /nologo /dll /debug /machine:I386 /out:"Debug/php_ldap.dll" /pdbtype:sept /libpath:"..\..\Debug" /libpath:"..\..\..\php_build\openldap\libraries\Debug"
-
-!ELSEIF "$(CFG)" == "ldap - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /I "..\..\..\openldap\include" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LDAP_EXPORTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_LDAP=1 /D ZEND_DEBUG=1 /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /I "..\..\..\php_build\openldap\include" /D "_DEBUG" /D ZEND_DEBUG=1 /D "ZTS" /D "COMPILE_DL_LDAP" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LDAP_EXPORTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_LDAP=1 /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 oldap32.lib olber32.lib php4nts_debug.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\openldap\libraries\Debug" /libpath:"..\..\Debug"
-# ADD LINK32 oldap32.lib olber32.lib php4ts_debug.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib /nologo /dll /debug /machine:I386 /out:"..\..\Debug_TS/php_ldap.dll" /pdbtype:sept /libpath:"..\..\Debug_TS" /libpath:"..\..\..\php_build\openldap\libraries\Debug"
-
-!ELSEIF "$(CFG)" == "ldap - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /I "..\..\..\openldap\include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LDAP_EXPORTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_LDAP=1 /D ZEND_DEBUG=0 /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /I "..\..\..\php_build\openldap\include" /D "NDEBUG" /D ZEND_DEBUG=0 /D "ZTS" /D "COMPILE_DL_LDAP" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LDAP_EXPORTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_LDAP=1 /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 oldap32.lib olber32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib php4ts.lib /nologo /dll /machine:I386
-# ADD LINK32 oldap32.lib olber32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib php4ts.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_ldap.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\..\php_build\openldap\libraries\Release" /libpath:"..\..\Release_TS_Inline"
-
-!ELSEIF "$(CFG)" == "ldap - Win32 Release_TS SASL"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "ldap___Win32_Release_TS_SASL"
-# PROP BASE Intermediate_Dir "ldap___Win32_Release_TS_SASL"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS_SASL"
-# PROP Intermediate_Dir "Release_TS_SASL"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /I "..\..\..\php_build\openldap\include" /D "NDEBUG" /D ZEND_DEBUG=0 /D "ZTS" /D "COMPILE_DL_LDAP" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LDAP_EXPORTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_LDAP=1 /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /I "..\..\..\php_build\openldap\include" /D "NDEBUG" /D ZEND_DEBUG=0 /D "ZTS" /D "COMPILE_DL_LDAP" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LDAP_EXPORTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_LDAP=1 /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 oldap32.lib olber32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib php4ts.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_ldap.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\..\php_build\openldap\libraries\Release" /libpath:"..\..\Release_TS_Inline"
-# ADD LINK32 oldap32.lib olber32.lib libsasl.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib php4ts.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_ldap.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\..\php_build\openldap\libraries\Release" /libpath:"..\..\Release_TS_Inline"
-
-!ELSEIF "$(CFG)" == "ldap - Win32 Debug_TS SASL"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "ldap___Win32_Debug_TS_SASL"
-# PROP BASE Intermediate_Dir "ldap___Win32_Debug_TS_SASL"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug_TS_SASL"
-# PROP Intermediate_Dir "Debug_TS_SASL"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /I "..\..\..\php_build\openldap\include" /D "_DEBUG" /D ZEND_DEBUG=1 /D "ZTS" /D "COMPILE_DL_LDAP" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LDAP_EXPORTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_LDAP=1 /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /I "..\..\..\php_build\openldap\include" /D "_DEBUG" /D ZEND_DEBUG=1 /D "ZTS" /D "COMPILE_DL_LDAP" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LDAP_EXPORTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_LDAP=1 /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 oldap32.lib olber32.lib php4ts_debug.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib /nologo /dll /debug /machine:I386 /out:"Debug_TS/php_ldap.dll" /pdbtype:sept /libpath:"..\..\Debug_TS" /libpath:"..\..\..\php_build\openldap\libraries\Debug"
-# ADD LINK32 oldap32.lib olber32.lib libsasl.lib php4ts_debug.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib /nologo /dll /debug /machine:I386 /out:"..\..\Debug_TS/php_ldap.dll" /pdbtype:sept /libpath:"..\..\Debug_TS" /libpath:"..\..\..\php_build\openldap\libraries\Debug"
-
-!ENDIF
-
-# Begin Target
-
-# Name "ldap - Win32 Release"
-# Name "ldap - Win32 Debug"
-# Name "ldap - Win32 Debug_TS"
-# Name "ldap - Win32 Release_TS"
-# Name "ldap - Win32 Release_TS SASL"
-# Name "ldap - Win32 Debug_TS SASL"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\ldap.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_ldap.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# Begin Source File
-
-SOURCE=.\LDAP_Win32_HOWTO.txt
-# End Source File
-# End Target
-# End Project
diff --git a/ext/ldap/php_ldap.h b/ext/ldap/php_ldap.h
deleted file mode 100644
index b35df480ff..0000000000
--- a/ext/ldap/php_ldap.h
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Amitay Isaacs <amitay@w-o-i.com> |
- | Eric Warnke <ericw@albany.edu> |
- | Jani Taskinen <sniper@iki.fi> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef PHP_LDAP_H
-#define PHP_LDAP_H
-
-#ifndef HAVE_ORALDAP
-#include <lber.h>
-#endif
-#include <ldap.h>
-
-extern zend_module_entry ldap_module_entry;
-#define ldap_module_ptr &ldap_module_entry
-
-/* LDAP functions */
-PHP_MINIT_FUNCTION(ldap);
-PHP_MSHUTDOWN_FUNCTION(ldap);
-
-PHP_MINFO_FUNCTION(ldap);
-
-PHP_FUNCTION(ldap_connect);
-
-PHP_FUNCTION(ldap_bind);
-PHP_FUNCTION(ldap_unbind);
-
-PHP_FUNCTION(ldap_read);
-PHP_FUNCTION(ldap_list);
-PHP_FUNCTION(ldap_search);
-
-PHP_FUNCTION(ldap_free_result);
-PHP_FUNCTION(ldap_count_entries);
-
-PHP_FUNCTION(ldap_first_entry);
-PHP_FUNCTION(ldap_next_entry);
-PHP_FUNCTION(ldap_get_entries);
-PHP_FUNCTION(ldap_first_attribute);
-PHP_FUNCTION(ldap_next_attribute);
-PHP_FUNCTION(ldap_get_attributes);
-
-PHP_FUNCTION(ldap_get_values);
-PHP_FUNCTION(ldap_get_values_len);
-
-PHP_FUNCTION(ber_free);
-PHP_FUNCTION(ldap_get_dn);
-PHP_FUNCTION(ldap_explode_dn);
-PHP_FUNCTION(ldap_dn2ufn);
-
-PHP_FUNCTION(ldap_add);
-PHP_FUNCTION(ldap_delete);
-PHP_FUNCTION(ldap_modify);
-
-PHP_FUNCTION(ldap_mod_add);
-PHP_FUNCTION(ldap_mod_replace);
-PHP_FUNCTION(ldap_mod_del);
-
-PHP_FUNCTION(ldap_errno);
-PHP_FUNCTION(ldap_err2str);
-PHP_FUNCTION(ldap_error);
-
-PHP_FUNCTION(ldap_compare);
-
-#if ( LDAP_API_VERSION > 2000 ) || HAVE_NSLDAP
-PHP_FUNCTION(ldap_get_option);
-PHP_FUNCTION(ldap_set_option);
-PHP_FUNCTION(ldap_parse_result);
-PHP_FUNCTION(ldap_first_reference);
-PHP_FUNCTION(ldap_next_reference);
-PHP_FUNCTION(ldap_parse_reference);
-PHP_FUNCTION(ldap_rename);
-#endif
-
-#ifdef STR_TRANSLATION
-PHP_FUNCTION(ldap_t61_to_8859);
-PHP_FUNCTION(ldap_8859_to_t61);
-#endif
-
-ZEND_BEGIN_MODULE_GLOBALS(ldap)
- long default_link;
- long num_links;
- long max_links;
- char *base_dn;
-ZEND_END_MODULE_GLOBALS(ldap)
-
-#ifdef ZTS
-# define LDAPLS_D zend_ldap_globals *ldap_globals
-# define LDAPLS_DC , LDAPLS_D
-# define LDAPLS_C ldap_globals
-# define LDAPLS_CC , LDAPLS_C
-# define LDAPG(v) (ldap_globals->v)
-# define LDAPLS_FETCH() zend_ldap_globals *ldap_globals = ts_resource(ldap_globals_id)
-#else
-# define LDAPLS_D
-# define LDAPLS_DC
-# define LDAPLS_C
-# define LDAPLS_CC
-# define LDAPG(v) (ldap_globals.v)
-# define LDAPLS_FETCH()
-#endif
-
-
-#define phpext_ldap_ptr ldap_module_ptr
-
-#endif /* PHP_LDAP_H */
diff --git a/ext/ldap/setup.stub b/ext/ldap/setup.stub
deleted file mode 100644
index 72182a28ef..0000000000
--- a/ext/ldap/setup.stub
+++ /dev/null
@@ -1,8 +0,0 @@
-# $Source$
-# $Id$
-
-define_option with-ldap 'LDAP support?' yesnodir \
- 'no /usr/local/ldap LDAP base install' \
-' Whether to build with LDAP (Lightweight Directory Access Protocol)\n
- support.\n
- More information about LDAP can be found in RFC1777 and RFC1778.'
diff --git a/ext/mailparse/CREDITS b/ext/mailparse/CREDITS
deleted file mode 100644
index 02afd3368b..0000000000
--- a/ext/mailparse/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-Mailparse MIME parsing and manipulation functions
-Wez Furlong
diff --git a/ext/mailparse/EXPERIMENTAL b/ext/mailparse/EXPERIMENTAL
deleted file mode 100644
index 6443e99646..0000000000
--- a/ext/mailparse/EXPERIMENTAL
+++ /dev/null
@@ -1,5 +0,0 @@
-this extension is experimental,
-its functions may change their names
-or move to extension all together
-so do not rely to much on them
-you have been warned!
diff --git a/ext/mailparse/Makefile.in b/ext/mailparse/Makefile.in
deleted file mode 100644
index 72e38c7492..0000000000
--- a/ext/mailparse/Makefile.in
+++ /dev/null
@@ -1,15 +0,0 @@
-# $Id$
-
-LTLIBRARY_NAME = libmailparse.la
-LTLIBRARY_SOURCES = \
- mailparse.c rfc2045.c \
- rfc2045acchk.c rfc2045acprep.c \
- rfc2045appendurl.c rfc2045cdecode.c rfc2045decode.c \
- rfc2045find.c \
- rfc822.c rfc822_getaddr.c \
- rfc822_getaddrs.c
-
-LTLIBRARY_SHARED_NAME = mailparse.la
-LTLIBRARY_SHARED_LIBADD = $(MAILPARSE_SHARED_LIBADD)
-
-include $(top_srcdir)/build/dynlib.mk
diff --git a/ext/mailparse/README b/ext/mailparse/README
deleted file mode 100644
index 8a3ee3b215..0000000000
--- a/ext/mailparse/README
+++ /dev/null
@@ -1,79 +0,0 @@
-mailparse library for PHP 4
-===========================
-
-This library is build upon the librfc822 and librfc2045 libraries that
-originated from the maildrop component of the courier mail server.
-The copyright for most of the work belongs to Double Precision Inc.,
-although distribution of the library is carried out under the terms of the
-GPL.
-
-Example for PHP:
-=============
-
-$file = "/path/to/rfc822/compliant/message";
-
-$mime = mailparse_rfc2045_parse_file($file);
-$ostruct = mailparse_rfc2045_getstructure($mime);
-foreach($ostruct as $st) {
- $section = mailparse_rfc2045_find($mime, $st);
- $struct[$st] = mailparse_rfc2045_getinfo($section);
-}
-var_dump($struct);
-
-array mailparse_rfc822_parse_addresses(string addresses)
- parses an rfc822 compliant recipient list, such as that found in To: From:
- headers. Returns a indexed array of assoc. arrays for each recipient:
- array(0 => array("display" => "Wez Furlong", "address" => "wez@php.net"))
-
-resource mailparse_rfc2045_create()
- Create a mime mail resource
-
-boolean mailparse_rfc2045_parse(resource mimemail, string data)
- incrementally parse data into the supplied mime mail resource.
- Concept: you can stream portions of a file at a time, rather than read
- and parse the whole thing.
-
-
-resource mailparse_rfc2045_parse_file(string $filename)
- Parse a file and return a $mime resource.
- The file is opened and streamed through the parser.
- This is the optimal way of parsing a mail file that
- you have on disk.
-
-
-array mailparse_rfc2045_getstructure(resource mimemail)
- returns an array containing a list of message parts in the form:
- array("1", "1.1", "1.2")
-
-resource mailparse_rfc2045_find(resource mimemail, string partname)
- returns an mime mail resource representing the named section
-
-array mailparse_rfc2045_getinfo(resource mimemail)
- returns an array containing the bounds, content type and headers of the
- section.
-
-mailparse_rfc2045_extract_file(resource mimemail, string filename[, string
- callbackfunc])
- Extracts/decodes a message section from the supplied filename.
- If no callback func is supplied, it outputs the results into the current
- output buffer, otherwise it calls the callback with a string parameter
- containing the text.
- The contents of the section will be decoded according to their transfer
- encoding - base64, quoted-printable and uuencoded text are supported.
-
-All operations are done incrementally; streaming the input and output so that
-memory usage is on the whole lower than something like procmail or doing this
-stuff in PHP space. The aim is that it stays this way to handle large
-quantities of email.
-
-TODO:
-=====
-
-. Add support for binhex encoding?
-. Extracting a message part without decoding the transfer encoding so that
- eg: pgp-signatures can be verified.
-
-. Work the other way around - build up a rfc2045 compliant message file from
- simple structure information and filenames/variables.
-
-vim:tw=78
diff --git a/ext/mailparse/config.m4 b/ext/mailparse/config.m4
deleted file mode 100644
index 4e2c4f7d60..0000000000
--- a/ext/mailparse/config.m4
+++ /dev/null
@@ -1,13 +0,0 @@
-dnl $Id$
-dnl config.m4 for extension mailparse
-
-PHP_ARG_ENABLE(mailparse, whether to enable mailparse support,
-[ --enable-mailparse Enable mailparse support])
-
-if test "$PHP_MAILPARSE" != "no"; then
- if test "$ext_shared" != "yes" && test "$enable_mbstring" != "yes"; then
- AC_MSG_WARN(Activating mbstring)
- enable_mbstring=yes
- fi
- PHP_EXTENSION(mailparse, $ext_shared)
-fi
diff --git a/ext/mailparse/libs.mk b/ext/mailparse/libs.mk
deleted file mode 100644
index 7c6e176717..0000000000
--- a/ext/mailparse/libs.mk
+++ /dev/null
@@ -1,7 +0,0 @@
-include $(top_builddir)/config_vars.mk
-LTLIBRARY_OBJECTS = $(LTLIBRARY_SOURCES:.c=.lo) $(LTLIBRARY_OBJECTS_X)
-LTLIBRARY_SHARED_OBJECTS = $(LTLIBRARY_OBJECTS:.lo=.slo)
-$(LTLIBRARY_NAME): $(LTLIBRARY_OBJECTS) $(LTLIBRARY_DEPENDENCIES)
- $(LINK) $(LTLIBRARY_LDFLAGS) $(LTLIBRARY_OBJECTS) $(LTLIBRARY_LIBADD)
-
-targets = $(LTLIBRARY_NAME)
diff --git a/ext/mailparse/mailparse.c b/ext/mailparse/mailparse.c
deleted file mode 100755
index 541d929525..0000000000
--- a/ext/mailparse/mailparse.c
+++ /dev/null
@@ -1,800 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997, 1998, 1999, 2000, 2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: |
- | Wez Furlong (wez@thebrainroom.com) |
- | Credit also given to Double Precision Inc. who wrote the code that |
- | the support routines for this extension were based upon. |
- +----------------------------------------------------------------------+
- */
-/* $Id$ */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "php_ini.h"
-#include "ext/standard/file.h"
-#include "php_mailparse.h"
-#include "mailparse_rfc822.h"
-#include "ext/standard/info.h"
-#include "ext/standard/php_output.h"
-
-/* just in case the config check doesn't enable mbstring automatically */
-#if !HAVE_MBSTRING
-#error The mailparse extension requires the mbstring extension!
-#endif
-
-#include "ext/mbstring/mbfilter.h"
-
-static int le_rfc2045;
-/* this is for sections we "found": we mustn't free them, as this will cause
- * a SEGFAULT when the parent is freed */
-static int le_rfc2045_nofree;
-
-
-function_entry mailparse_functions[] = {
- PHP_FE(mailparse_msg_parse_file, NULL)
- PHP_FE(mailparse_msg_get_part, NULL)
- PHP_FE(mailparse_msg_get_structure, NULL)
- PHP_FE(mailparse_msg_get_part_data, NULL)
- PHP_FE(mailparse_msg_extract_part, NULL)
- PHP_FE(mailparse_msg_extract_part_file, NULL)
-
- PHP_FE(mailparse_msg_create, NULL)
- PHP_FE(mailparse_msg_free, NULL)
- PHP_FE(mailparse_msg_parse, NULL)
- PHP_FE(mailparse_rfc822_parse_addresses, NULL)
- PHP_FE(mailparse_determine_best_xfer_encoding, NULL)
- PHP_FE(mailparse_stream_encode, NULL)
-
- {NULL, NULL, NULL}
-};
-
-zend_module_entry mailparse_module_entry = {
- "mailparse",
- mailparse_functions,
- PHP_MINIT(mailparse),
- PHP_MSHUTDOWN(mailparse),
- PHP_RINIT(mailparse),
- PHP_RSHUTDOWN(mailparse),
- PHP_MINFO(mailparse),
- STANDARD_MODULE_PROPERTIES
-};
-
-ZEND_DECLARE_MODULE_GLOBALS(mailparse)
-
-#ifdef COMPILE_DL_MAILPARSE
-ZEND_GET_MODULE(mailparse)
-#endif
-
-
-ZEND_RSRC_DTOR_FUNC(rfc2045_dtor)
-{
- rfc2045_free(rsrc->ptr);
-}
-
-PHP_INI_BEGIN()
- STD_PHP_INI_ENTRY("mailparse.def_charset", RFC2045CHARSET, PHP_INI_ALL, OnUpdateString, def_charset, zend_mailparse_globals, mailparse_globals)
-PHP_INI_END()
-
-#define mailparse_msg_name "mailparse_mail_structure"
-
-#define mailparse_fetch_rfc2045_resource(rfcvar, zvalarg) ZEND_FETCH_RESOURCE2(rfcvar, struct rfc2045 *, zvalarg, -1, mailparse_msg_name, le_rfc2045, le_rfc2045_nofree)
-
-PHP_MINIT_FUNCTION(mailparse)
-{
- le_rfc2045 = zend_register_list_destructors_ex(rfc2045_dtor, NULL, mailparse_msg_name, module_number);
- le_rfc2045_nofree = zend_register_list_destructors_ex(NULL, NULL, mailparse_msg_name, module_number);
-
- REGISTER_INI_ENTRIES();
-
- return SUCCESS;
-}
-
-PHP_MSHUTDOWN_FUNCTION(mailparse)
-{
- UNREGISTER_INI_ENTRIES();
- return SUCCESS;
-}
-
-PHP_MINFO_FUNCTION(mailparse)
-{
- php_info_print_table_start();
- php_info_print_table_header(2, "mailparse support", "enabled");
- php_info_print_table_end();
-
- DISPLAY_INI_ENTRIES();
-}
-
-
-PHP_RINIT_FUNCTION(mailparse)
-{
- return SUCCESS;
-}
-
-
-PHP_RSHUTDOWN_FUNCTION(mailparse)
-{
- return SUCCESS;
-}
-
-static void mailparse_rfc822t_errfunc(const char * msg, int num)
-{
- php_error(E_WARNING, "%s(): %s %d", get_active_function_name(), msg, num);
-}
-
-/* {{{ proto array mailparse_rfc822_parse_addresses(string addresses)
- parse addresses and return a hash containing that data
-*/
-PHP_FUNCTION(mailparse_rfc822_parse_addresses)
-{
- zval ** addresses;
- struct rfc822t * tokens;
- struct rfc822a * addrs;
- int i;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &addresses) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(addresses);
-
- tokens = mailparse_rfc822t_alloc(Z_STRVAL_PP(addresses), mailparse_rfc822t_errfunc);
-
- if (tokens) {
- addrs = mailparse_rfc822a_alloc(tokens);
- if (addrs) {
-
- array_init(return_value);
-
- for (i = 0; i < addrs->naddrs; i++) {
- char * p;
- zval * item;
-
- MAKE_STD_ZVAL(item);
-
- if (array_init(item) == FAILURE)
- break;
-
- p = mailparse_rfc822_getname(addrs, i);
- add_assoc_string(item, "display", p, 0); /* don't duplicate - getname allocated the memory for us */
- p = mailparse_rfc822_getaddr(addrs, i);
- add_assoc_string(item, "address", p, 0); /* don't duplicate - getaddr allocated the memory for us */
-
- /* add this to the result */
- zend_hash_next_index_insert(HASH_OF(return_value), &item, sizeof(item), NULL);
- }
-
- mailparse_rfc822a_free(addrs);
- }
-
- mailparse_rfc822t_free(tokens);
- }
-}
-/* }}} */
-
-/* {{{ proto long mailparse_determine_best_xfer_encoding(resource fp)
- figure out the best way of encoding the content read from the file pointer fp, which must be seek-able.
-*/
-PHP_FUNCTION(mailparse_determine_best_xfer_encoding)
-{
- zval ** file;
- FILE * fp;
- int longline = 0;
- int linelen = 0;
- int c;
- enum mbfl_no_encoding bestenc = mbfl_no_encoding_7bit;
- void * what;
- int type;
- char * name;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &file) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- what = zend_fetch_resource(file, -1, "File-Handle", &type, 2, php_file_le_fopen(), php_file_le_stream());
- ZEND_VERIFY_RESOURCE(what);
-
-#if HAVE_PHP_STREAM
- if (type == php_file_le_stream()) {
- php_stream * stream = (php_stream*)what;
-
- php_stream_rewind(stream);
- while(!php_stream_eof(stream)) {
- c = php_stream_getc(stream);
- if (c == EOF)
- break;
- if (c > 0x80)
- bestenc = mbfl_no_encoding_8bit;
- else if (c == 0) {
- bestenc = mbfl_no_encoding_base64;
- longline = 0;
- break;
- }
- if (c == '\n')
- linelen = 0;
- else if (++linelen > 200)
- longline = 1;
- }
- if (longline)
- bestenc = mbfl_no_encoding_qprint;
- php_stream_rewind(stream);
- }
- else {
-#endif
- fp = (FILE*)what;
-
- rewind(fp);
- while(!feof(fp)) {
- c = fgetc(fp);
- if (c == EOF)
- break;
- if (c > 0x80)
- bestenc = mbfl_no_encoding_8bit;
- else if (c == 0) {
- bestenc = mbfl_no_encoding_base64;
- longline = 0;
- break;
- }
- if (c == '\n')
- linelen = 0;
- else if (++linelen > 200)
- longline = 1;
- }
- if (longline)
- bestenc = mbfl_no_encoding_qprint;
- rewind(fp);
-#if HAVE_PHP_STREAM
- }
-#endif
-
- name = (char *)mbfl_no2preferred_mime_name(bestenc);
- if (name)
- {
- RETVAL_STRING(name, 1);
- }
- else
- {
- RETVAL_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto boolean mailparse_stream_encode(resource sourcefp, resource destfp, string encoding)
- stream data from source file pointer, apply encoding and write to destfp
-*/
-
-static int mailparse_fp_output(int c, void * fp)
-{
- return fputc(c, (FILE*)fp);
-}
-static int mailparse_fp_flush(void * fp)
-{
- return fflush((FILE*)fp);
-}
-
-PHP_FUNCTION(mailparse_stream_encode)
-{
- zval ** srcfile, ** destfile, ** encod;
- FILE * srcfp, * destfp;
- char * buf;
- size_t len;
- size_t bufsize = 2048;
- enum mbfl_no_encoding enc;
- mbfl_convert_filter * conv = NULL;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &srcfile, &destfile, &encod) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if ((*srcfile)->type == IS_RESOURCE && (*srcfile)->value.lval == 0) {
- RETURN_FALSE;
- }
- ZEND_FETCH_RESOURCE(srcfp, FILE *, srcfile, -1, "File-Handle", php_file_le_fopen());
-
- if ((*destfile)->type == IS_RESOURCE && (*destfile)->value.lval == 0) {
- RETURN_FALSE;
- }
- ZEND_FETCH_RESOURCE(destfp, FILE *, destfile, -1, "File-Handle", php_file_le_fopen());
-
- convert_to_string_ex(encod);
- enc = mbfl_name2no_encoding(Z_STRVAL_PP(encod));
- if (enc == mbfl_no_encoding_invalid) {
- zend_error(E_WARNING, "%s(): unknown encoding \"%s\"",
- get_active_function_name(),
- Z_STRVAL_PP(encod)
- );
- RETURN_FALSE;
- }
-
- buf = emalloc(bufsize);
- RETVAL_TRUE;
-
- conv = mbfl_convert_filter_new(mbfl_no_encoding_8bit,
- enc,
- mailparse_fp_output,
- mailparse_fp_flush,
- destfp
- );
- while(!feof(srcfp)) {
- len = fread(buf, sizeof(char), bufsize, srcfp);
- if (len > 0)
- {
- int i;
- for (i=0; i<len; i++)
- mbfl_convert_filter_feed(buf[i], conv);
- }
- }
-
- mbfl_convert_filter_flush(conv);
- mbfl_convert_filter_delete(conv);
- efree(buf);
-}
-/* }}} */
-
-/* {{{ proto void mailparse_msg_parse(resource rfc2045buf, string data)
- Incrementally parse data into buffer
-*/
-PHP_FUNCTION(mailparse_msg_parse)
-{
- zval ** arg, ** data;
- struct rfc2045 * rfcbuf;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg, &data) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if ((*arg)->type == IS_RESOURCE && (*arg)->value.lval == 0) {
- RETURN_FALSE;
- }
-
- mailparse_fetch_rfc2045_resource(rfcbuf, arg);
-
- convert_to_string_ex(data);
-
- rfc2045_parse(rfcbuf, (*data)->value.str.val, (*data)->value.str.len);
-}
-/* }}} */
-
-/* {{{ proto resource mailparse_msg_parse_file(string filename)
- Parse file and return a resource representing the structure
-*/
-PHP_FUNCTION(mailparse_msg_parse_file)
-{
- zval ** filename;
- struct rfc2045 * rfcbuf;
- char * filebuf;
- FILE * fp;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &filename) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(filename);
-
- /* open file and read it in */
- fp = VCWD_FOPEN(Z_STRVAL_PP(filename), "r");
- if (fp == NULL) {
- zend_error(E_WARNING, "%s(): unable to open file %s", get_active_function_name(), Z_STRVAL_PP(filename));
- RETURN_FALSE;
- }
-
- filebuf = emalloc(MAILPARSE_BUFSIZ);
-
- rfcbuf = rfc2045_alloc_ac();
- if (rfcbuf) {
- ZEND_REGISTER_RESOURCE(return_value, rfcbuf, le_rfc2045);
-
- while(!feof(fp)) {
- int got = fread(filebuf, sizeof(char), MAILPARSE_BUFSIZ, fp);
- if (got > 0) {
- rfc2045_parse(rfcbuf, filebuf, got);
- }
- }
- fclose(fp);
- }
- efree(filebuf);
-}
-/* }}} */
-
-/* {{{ proto void mailparse_msg_free(resource rfc2045buf)
- Frees a handle allocated by mailparse_msg_create
-*/
-PHP_FUNCTION(mailparse_msg_free)
-{
- zval **arg;
- struct rfc2045 * rfcbuf;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if ((*arg)->type == IS_RESOURCE && (*arg)->value.lval == 0) {
- RETURN_FALSE;
- }
-
- ZEND_FETCH_RESOURCE(rfcbuf, struct rfc2045 *, arg, -1, mailparse_msg_name, le_rfc2045);
-
- zend_list_delete((*arg)->value.lval);
- RETURN_TRUE;
-}
-/* }}} */
-
-
-/* {{{ proto long mailparse_msg_create()
- Return a handle that can be used to parse a message
-*/
-PHP_FUNCTION(mailparse_msg_create)
-{
- struct rfc2045 * rfcbuf;
-
- rfcbuf = rfc2045_alloc_ac();
-
- ZEND_REGISTER_RESOURCE(return_value, rfcbuf, le_rfc2045);
-}
-/* }}} */
-
-static void get_structure_callback(struct rfc2045 *p, struct rfc2045id * id, void * ptr)
-{
- zval * return_value = (zval *)ptr;
- char intbuf[16];
- char buf[256];
- int len, i = 0;
- while(id && i < sizeof(buf)) {
- sprintf(intbuf, "%d", id->idnum);
- len = strlen(intbuf);
- if (len > (sizeof(buf)-i)) {
- /* too many sections: bail */
- zend_error(E_WARNING, "%s(): too many nested sections in message", get_active_function_name());
- return;
- }
- sprintf(&buf[i], "%s%c", intbuf, id->next ? '.' : '\0');
- i += len + (id->next ? 1 : 0);
- id = id->next;
- }
- add_next_index_string(return_value, buf,1);
-}
-
-/* {{{ proto array mailparse_msg_get_structure(resource rfc2045)
- Returns an array of mime section names in the supplied message
-*/
-PHP_FUNCTION(mailparse_msg_get_structure)
-{
- zval **arg;
- struct rfc2045 * rfcbuf;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if ((*arg)->type == IS_RESOURCE && (*arg)->value.lval == 0) {
- RETURN_FALSE;
- }
-
- mailparse_fetch_rfc2045_resource(rfcbuf, arg);
-
- if (array_init(return_value) == FAILURE) {
- RETURN_FALSE;
- }
-
- rfc2045_decode(rfcbuf, &get_structure_callback, return_value);
-}
-/* }}} */
-
-/* callback for decoding using a "userdefined" php function */
-static int extract_callback_user_func(const char *p, size_t n, zval *userfunc)
-{
- zval * retval;
- zval * arg;
- ELS_FETCH();
-
- MAKE_STD_ZVAL(retval);
- retval->type = IS_BOOL;
- retval->value.lval = 0;
-
- MAKE_STD_ZVAL(arg);
- ZVAL_STRINGL(arg, (char*)p, (int)n, 1);
-
- /* TODO: use zend_is_callable */
-
- if (call_user_function(EG(function_table), NULL, userfunc, retval, 1, &arg) == FAILURE)
- zend_error(E_WARNING, "%s(): unable to call user function", get_active_function_name());
-
- zval_dtor(retval);
- zval_dtor(arg);
- efree(retval);
- efree(arg);
-
- return 0;
-}
-
-/* callback for decoding to the current output buffer */
-static int extract_callback_stdout(const char *p, size_t n, void *ptr)
-{
- ZEND_WRITE(p, n);
- return 0;
-}
-
-/* {{{ proto void mailparse_msg_extract_part(resource rfc2045, string msgbody[, string callbackfunc])
- Extracts/decodes a message section. If callbackfunc is not specified, the contents will be sent to "stdout".
-*/
-PHP_FUNCTION(mailparse_msg_extract_part)
-{
- zval **arg, **bodystr, **cbfunc;
- struct rfc2045 * rfcbuf;
- off_t start, end, body;
- off_t nlines;
- off_t nbodylines;
-
- switch(ZEND_NUM_ARGS()) {
- case 3:
- if (zend_get_parameters_ex(3, &arg, &bodystr, &cbfunc) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- if (Z_TYPE_PP(cbfunc) != IS_ARRAY)
- convert_to_string_ex(cbfunc);
- break;
- case 2:
- if (zend_get_parameters_ex(2, &arg, &bodystr) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- cbfunc = NULL;
- break;
- }
- convert_to_string_ex(bodystr);
-
- if ((*arg)->type == IS_RESOURCE && (*arg)->value.lval == 0) {
- RETURN_FALSE;
- }
- mailparse_fetch_rfc2045_resource(rfcbuf, arg);
-
-
- rfc2045_mimepos(rfcbuf, &start, &end, &body, &nlines, &nbodylines);
-
- if (cbfunc)
- rfc2045_cdecode_start(rfcbuf, (rfc2045_decode_user_func_t)&extract_callback_user_func, *cbfunc);
- else
- rfc2045_cdecode_start(rfcbuf, &extract_callback_stdout, NULL);
-
- if (Z_STRLEN_PP(bodystr) < end)
- end = Z_STRLEN_PP(bodystr);
- else
- end = end-body;
-
- rfc2045_cdecode(rfcbuf, Z_STRVAL_PP(bodystr) + body, end);
- rfc2045_cdecode_end(rfcbuf);
-
- RETURN_TRUE;
-
-}
-/* }}} */
-
-/* {{{ proto string mailparse_msg_extract_part_file(resource rfc2045, string filename[, string callbackfunc])
- Extracts/decodes a message section, decoding the transfer encoding
-*/
-PHP_FUNCTION(mailparse_msg_extract_part_file)
-{
- zval **arg, **filename, **cbfunc;
- struct rfc2045 * rfcbuf;
- char * filebuf = NULL;
- FILE * fp = NULL;
- off_t start, end, body;
- off_t nlines;
- off_t nbodylines;
-
- switch(ZEND_NUM_ARGS()) {
- case 3:
- if (zend_get_parameters_ex(3, &arg, &filename, &cbfunc) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- if (Z_TYPE_PP(cbfunc) != IS_ARRAY)
- convert_to_string_ex(cbfunc);
- break;
- case 2:
- if (zend_get_parameters_ex(2, &arg, &filename) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- cbfunc = NULL;
- break;
- }
- convert_to_string_ex(filename);
-
- if ((*arg)->type == IS_RESOURCE && (*arg)->value.lval == 0) {
- RETURN_FALSE;
- }
- mailparse_fetch_rfc2045_resource(rfcbuf, arg);
-
- /* figure out where the message part starts/ends */
- rfc2045_mimepos(rfcbuf, &start, &end, &body, &nlines, &nbodylines);
-
- if (cbfunc)
- rfc2045_cdecode_start(rfcbuf, (rfc2045_decode_user_func_t)&extract_callback_user_func, *cbfunc);
- else
- rfc2045_cdecode_start(rfcbuf, &extract_callback_stdout, NULL);
-
- /* open file and read it in */
- fp = VCWD_FOPEN(Z_STRVAL_PP(filename), "rb");
- if (fp == NULL) {
- zend_error(E_WARNING, "%s(): unable to open file %s", get_active_function_name(), Z_STRVAL_PP(filename));
- RETURN_FALSE;
- }
- if (fseek(fp, body, SEEK_SET) == -1)
- {
- zend_error(E_WARNING, "%s(): unable to seek to section start", get_active_function_name());
- RETVAL_FALSE;
- goto cleanup;
- }
- filebuf = emalloc(MAILPARSE_BUFSIZ);
-
-
- while (body < end)
- {
- size_t n = MAILPARSE_BUFSIZ;
-
- if ((off_t)n > end-body)
- n=end-body;
- n = fread(filebuf, sizeof(char), n, fp);
- if (n == 0)
- {
- zend_error(E_WARNING, "%s(): error reading from file \"%s\", offset %d", get_active_function_name(), Z_STRVAL_PP(filename), body);
- RETVAL_FALSE;
- goto cleanup;
- }
- rfc2045_cdecode(rfcbuf, filebuf, n);
- body += n;
- }
- RETVAL_TRUE;
-
-cleanup:
- rfc2045_cdecode_end(rfcbuf);
- if (fp)
- fclose(fp);
- if (filebuf)
- efree(filebuf);
-}
-/* }}} */
-
-/* {{{ proto array mailparse_msg_get_part_data(resource rfc2045)
- Return an assoc. array of info about the message
-*/
-/* NOTE: you may add keys to the array, but PLEASE do not remove the key/value pairs
- that are emitted here - it will break my PHP scripts if you do! */
-PHP_FUNCTION(mailparse_msg_get_part_data)
-{
- zval ** arg;
- struct rfc2045 * rfcbuf;
- char * content_type, *transfer_encoding, *charset;
- off_t start, end, body, nlines, nbodylines;
- char * disposition, * disposition_name, *disposition_filename;
- char *p;
- struct rfc2045attr * attr;
- zval * headers;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if ((*arg)->type == IS_RESOURCE && (*arg)->value.lval == 0) {
- RETURN_FALSE;
- }
-
-
- mailparse_fetch_rfc2045_resource(rfcbuf, arg);
-
- if (array_init(return_value) == FAILURE) {
- RETURN_FALSE;
- }
-
-
- rfc2045_mimeinfo(rfcbuf, (const char**)&content_type, (const char**)&transfer_encoding, (const char**)&charset);
- rfc2045_mimepos(rfcbuf, &start, &end, &body, &nlines, &nbodylines);
-
- if (content_type && *content_type)
- add_assoc_string(return_value, "content-type", content_type, 1);
-
- /* get attributes for content-type */
- attr = rfcbuf->content_type_attr;
- while (attr != NULL) {
- char buf[80];
- strcpy(buf, "content-");
- strcat(buf, attr->name);
- add_assoc_string(return_value, buf, attr->value, 1);
- attr = attr->next;
- }
- /* get attributes for content-disposition */
- attr = rfcbuf->content_disposition_attr;
- while (attr != NULL) {
- char buf[80];
- strcpy(buf, "disposition-");
- strcat(buf, attr->name);
- add_assoc_string(return_value, buf, attr->value, 1);
- attr = attr->next;
- }
- /* get headers for this section */
- MAKE_STD_ZVAL(headers);
- *headers = *rfcbuf->headerhash;
- INIT_PZVAL(headers);
- zval_copy_ctor(headers);
- /* add to result */
- zend_hash_update(HASH_OF(return_value), "headers", sizeof("headers"), &headers, sizeof(headers), NULL);
-
- add_assoc_string(return_value, "transfer-encoding", transfer_encoding, 1);
- add_assoc_string(return_value, "charset", charset, 1);
-
- rfc2045_dispositioninfo(rfcbuf, (const char**)&disposition, (const char**)&disposition_name, (const char**)&disposition_filename);
- if (disposition && *disposition)
- add_assoc_string(return_value, "content-disposition", disposition, 1);
-
- if (*(p=(char*)rfc2045_content_id(rfcbuf)))
- add_assoc_string(return_value, "content-id", p, 1);
- if (*(p=(char*)rfc2045_content_description(rfcbuf)))
- add_assoc_string(return_value, "content-description", p, 1);
- if (*(p=(char*)rfc2045_content_language(rfcbuf)))
- add_assoc_string(return_value, "content-language", p, 1);
- if (*(p=(char*)rfc2045_content_md5(rfcbuf)))
- add_assoc_string(return_value, "content-md5", p, 1);
- if (*(p=(char*)rfc2045_content_base(rfcbuf))) {
- add_assoc_string(return_value, "content-base", p, 1);
- /* content base allocates mem */
- efree(p);
- }
-
-
- add_assoc_long(return_value, "starting-pos", start);
- add_assoc_long(return_value, "starting-pos-body", body);
- add_assoc_long(return_value, "ending-pos", end);
- add_assoc_long(return_value, "line-count", nlines);
- add_assoc_long(return_value, "body-line-count", nbodylines);
-}
-/* }}} */
-
-/* {{{ proto long mailparse_msg_get_part(resource rfc2045, string mimesection)
- Return a handle on a given section in a mimemessage
-*/
-PHP_FUNCTION(mailparse_msg_get_part)
-{
- zval ** arg, ** mimesection;
- struct rfc2045 * rfcbuf, * newsection;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg, &mimesection) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if ((*arg)->type == IS_RESOURCE && (*arg)->value.lval == 0) {
- RETURN_FALSE;
- }
-
- mailparse_fetch_rfc2045_resource(rfcbuf, arg);
-
- convert_to_string_ex(mimesection);
-
- newsection = rfc2045_find(rfcbuf, (*mimesection)->value.str.val);
-
- if (!newsection) {
- php_error(E_WARNING, "%s(): cannot find section %s in message", get_active_function_name(), (*mimesection)->value.str.val);
- RETURN_FALSE;
- }
- ZEND_REGISTER_RESOURCE(return_value, newsection, le_rfc2045_nofree);
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/mailparse/mailparse_rfc822.h b/ext/mailparse/mailparse_rfc822.h
deleted file mode 100644
index 74a4eb28bf..0000000000
--- a/ext/mailparse/mailparse_rfc822.h
+++ /dev/null
@@ -1,161 +0,0 @@
-/* $Id$ */
-#ifndef mailparse_rfc822_h
-#define mailparse_rfc822_h
-
-/*
-** Copyright 1998 - 2000 Double Precision, Inc.
-** See COPYING for distribution information.
-*/
-
-#include <time.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
-** The text string we want to parse is first tokenized into an array of
-** struct rfc822token records. 'ptr' points into the original text
-** string, and 'len' has how many characters from 'ptr' belongs to this
-** token.
-*/
-
-struct rfc822token {
- struct rfc822token *next; /* Unused by librfc822, for use by
- ** clients */
- int token;
-/*
- Values for token:
-
- '(' - comment
- '"' - quoted string
- '<', '>', '@', ',', ';', ':', '.', '[', ']', '%', '!', '=', '?', '/' - RFC atoms.
- 0 - atom
-*/
-
-#define mailparse_rfc822_is_atom(p) ( (p) == 0 || (p) == '"' || (p) == '(' )
-
- const char *ptr; /* Pointer to value for the token. */
- int len; /* Length of token value */
-} ;
-
-/*
-** After the struct rfc822token array is built, it is used to create
-** the rfc822addr array, which is the array of addresses (plus
-** syntactical fluff) extracted from those text strings. Each rfc822addr
-** record has several possible interpretation:
-**
-** tokens is NULL - syntactical fluff, look in name/nname for tokens
-** representing the syntactical fluff ( which is semicolons
-** and list name:
-**
-** tokens is not NULL - actual address. The tokens representing the actual
-** address is in tokens/ntokens. If there are comments in
-** the address that are possible "real name" for the address
-** they are saved in name/nname (name may be null if there
-** is none).
-** If nname is 1, and name points to a comment token,
-** the address was specified in old-style format. Otherwise
-** the address was specified in new-style route-addr format.
-**
-** The tokens and name pointers are set to point to the original rfc822token
-** array.
-*/
-
-struct rfc822addr {
- struct rfc822token *tokens;
- struct rfc822token *name;
-} ;
-
-/***************************************************************************
-**
-** rfc822 tokens
-**
-***************************************************************************/
-
-struct rfc822t {
- struct rfc822token *tokens;
- int ntokens;
-} ;
-
-struct rfc822t * mailparse_rfc822t_alloc(const char *p,
- void (*err_func)(const char *, int)); /* Parse addresses */
-void mailparse_rfc822t_free(struct rfc822t *); /* Free rfc822 structure */
-
-void mailparse_rfc822tok_print(const struct rfc822token *, void (*)(char, void *), void *);
- /* Print the tokens */
-
-/***************************************************************************
-**
-** rfc822 addresses
-**
-***************************************************************************/
-
-struct rfc822a {
- struct rfc822addr *addrs;
- int naddrs;
-} ;
-
-struct rfc822a * mailparse_rfc822a_alloc(struct rfc822t *);
-void mailparse_rfc822a_free(struct rfc822a *); /* Free rfc822 structure */
-
-void mailparse_rfc822_deladdr(struct rfc822a *, int);
-
-/* rfc822_print "unparses" the rfc822 structure. Each rfc822addr is "printed"
- (via the attached function). NOTE: instead of separating addresses by
- commas, the print_separator function is called.
-*/
-
-void mailparse_rfc822_print(const struct rfc822a *a,
- void (*print_func)(char, void *),
- void (*print_separator)(const char *, void *), void *);
-
-/* rfc822_print_common is an internal function */
-
-void mailparse_rfc822_print_common(const struct rfc822a *a,
- char *(*decode_func)(const char *, const char *),
- const char *chset,
- void (*print_func)(char, void *),
- void (*print_separator)(const char *, void *), void *);
-
-/* Another unparser, except that only the raw addresses are extracted,
- and each address is followed by a newline character */
-
-void mailparse_rfc822_addrlist(const struct rfc822a *, void (*print_func)(char, void *),
- void *);
-
-/* Now, just the comments. If comments not given, the address. */
-void mailparse_rfc822_namelist(const struct rfc822a *, void (*print_func)(char, void *),
- void *);
-
-/* Unparse an individual name/addr from a list of addresses. If the given
- index points to some syntactical fluff, this is a noop */
-
-void mailparse_rfc822_prname(const struct rfc822a *, int, void (*)(char, void *), void *);
-void mailparse_rfc822_praddr(const struct rfc822a *, int, void (*)(char, void *), void *);
-
-/* Like rfc822_prname, except that we'll also print the legacy format
-** of a list designation.
-*/
-
-void mailparse_rfc822_prname_orlist(const struct rfc822a *, int,
- void (*)(char, void *), void *);
-
-/* Extra functions */
-
-char *mailparse_rfc822_gettok(const struct rfc822token *);
-char *mailparse_rfc822_getaddr(const struct rfc822a *, int);
-char *mailparse_rfc822_getname(const struct rfc822a *, int);
-char *mailparse_rfc822_getname_orlist(const struct rfc822a *, int);
-char *mailparse_rfc822_getaddrs(const struct rfc822a *);
-char *mailparse_rfc822_getaddrs_wrap(const struct rfc822a *, int);
-
-
-char *mailparse_rfc822_coresubj(const char *, int *);
-char *mailparse_rfc822_coresubj_nouc(const char *, int *);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/ext/mailparse/php_mailparse.h b/ext/mailparse/php_mailparse.h
deleted file mode 100755
index 3cc0449dbf..0000000000
--- a/ext/mailparse/php_mailparse.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997, 1998, 1999, 2000 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: |
- | Wez Furlong <wez@thebrainroom.com> |
- | Credit also given to Double Precision Inc. who wrote the code that |
- | the support routines for this extension were based upon. |
- +----------------------------------------------------------------------+
- */
-/* $Id$ */
-
-#ifndef PHP_MAILPARSE_H
-#define PHP_MAILPARSE_H
-
-extern zend_module_entry mailparse_module_entry;
-#define phpext_mailparse_ptr &mailparse_module_entry
-
-#ifdef PHP_WIN32
-#define PHP_MAILPARSE_API __declspec(dllexport)
-#else
-#define PHP_MAILPARSE_API
-#endif
-
-PHP_MINIT_FUNCTION(mailparse);
-PHP_MSHUTDOWN_FUNCTION(mailparse);
-PHP_RINIT_FUNCTION(mailparse);
-PHP_RSHUTDOWN_FUNCTION(mailparse);
-PHP_MINFO_FUNCTION(mailparse);
-
-PHP_FUNCTION(mailparse_msg_parse_file);
-PHP_FUNCTION(mailparse_msg_get_part);
-PHP_FUNCTION(mailparse_msg_get_structure);
-PHP_FUNCTION(mailparse_msg_get_part_data);
-PHP_FUNCTION(mailparse_msg_extract_part);
-PHP_FUNCTION(mailparse_msg_extract_part_file);
-
-PHP_FUNCTION(mailparse_msg_create);
-PHP_FUNCTION(mailparse_msg_free);
-PHP_FUNCTION(mailparse_msg_parse);
-PHP_FUNCTION(mailparse_msg_parse_file);
-
-PHP_FUNCTION(mailparse_msg_find);
-PHP_FUNCTION(mailparse_msg_getstructure);
-PHP_FUNCTION(mailparse_msg_getinfo);
-PHP_FUNCTION(mailparse_msg_extract);
-PHP_FUNCTION(mailparse_msg_extract_file);
-PHP_FUNCTION(mailparse_rfc822_parse_addresses);
-PHP_FUNCTION(mailparse_determine_best_xfer_encoding);
-PHP_FUNCTION(mailparse_stream_encode);
-
-#include "rfc2045.h"
-#include "mailparse_rfc822.h"
-
-#define MAILPARSE_BUFSIZ 4096
-ZEND_BEGIN_MODULE_GLOBALS(mailparse)
- char * def_charset; /* default charset for use in (re)writing mail */
-ZEND_END_MODULE_GLOBALS(mailparse);
-
-extern ZEND_DECLARE_MODULE_GLOBALS(mailparse);
-
-
-#ifdef ZTS
-#define MAILPARSEG(v) (mailparse_globals->v)
-#define MAILPARSELS_FETCH() zend_mailparse_globals *mailparse_globals = ts_resource(mailparse_globals_id)
-#else
-#define MAILPARSEG(v) (mailparse_globals.v)
-#define MAILPARSELS_FETCH()
-#endif
-
-#endif
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim: sw=4 ts=4 tw=78
- */
diff --git a/ext/mailparse/rfc2045.c b/ext/mailparse/rfc2045.c
deleted file mode 100755
index ea61cfdb2b..0000000000
--- a/ext/mailparse/rfc2045.c
+++ /dev/null
@@ -1,1174 +0,0 @@
-/* $Id$ */
-/*
- ** Copyright 1998 - 1999 Double Precision, Inc. See COPYING for
- ** distribution information.
- */
-
-#include "php.h"
-#include "php_mailparse.h"
-
-#define MAXLEVELS 20
-#define MAXPARTS 300
-
-/*
- New RFC2045 structure.
- */
-
-struct rfc2045 *rfc2045_alloc()
-{
- struct rfc2045 *p=(struct rfc2045 *)emalloc(sizeof(struct rfc2045));
-
- /* Initialize everything to nulls, except for one thing */
-
- memset(p, 0, sizeof(*p));
-
- p->pindex=1; /* Start with part #1 */
-
- /* Most of the time, we're about to read a header */
- p->workinheader=1;
-
- MAKE_STD_ZVAL(p->headerhash);
- array_init(p->headerhash);
-
- return (p);
-}
-
-const char *rfc2045_getattr(const struct rfc2045attr *p, const char *name)
-{
- while (p)
- {
- if (p->name && strcmp(p->name, name) == 0)
- return (p->value);
- p=p->next;
- }
- return (0);
-}
-
-void rfc2045_setattr(struct rfc2045attr **p, const char *name, const char *val)
-{
- char *v;
-
- while (*p)
- {
- if (strcmp( (*p)->name, name) == 0) break;
- p=&(*p)->next;
- }
- if (val == 0)
- {
- struct rfc2045attr *q= *p;
-
- if (q)
- {
- *p=q->next;
- if (q->name) efree(q->name);
- if (q->value) efree(q->value);
- efree(q);
- }
- return;
- }
-
- v = estrdup(val);
-
- if (!*p)
- {
- *p = (struct rfc2045attr *)emalloc(sizeof(**p));
- memset( (*p), 0, sizeof(**p));
- (*p)->name = estrdup(name);
- }
- if ( (*p)->value )
- efree ( (*p)->value );
- (*p)->value=v;
-}
-
-/* static const char cb_name[]="boundary"; */
-
-/* #define ContentBoundary(p) (rfc2045_getattr( (p)->content_type_attr, cb_name)) */
-
-#define ContentBoundary(p) ( (p)->boundary )
-
-/*
- Unallocate the RFC2045 structure. Recursively unallocate
- all sub-structures. Unallocate all associated buffers.
- */
-
-static void rfc2045_freeattr(struct rfc2045attr *p)
-{
- while (p)
- {
- struct rfc2045attr *q=p->next;
-
- if (p->name) efree(p->name);
- if (p->value) efree(p->value);
- efree(p);
- p=q;
- }
-}
-
-void rfc2045_free(struct rfc2045 *p)
-{
- struct rfc2045 *q, *r;
-
- for (q=p->firstpart; q; )
- {
- r=q->next;
- rfc2045_free(q);
- q=r;
- }
- rfc2045_freeattr(p->content_type_attr);
- rfc2045_freeattr(p->content_disposition_attr);
-
- if (p->content_md5) efree(p->content_md5);
- if (p->content_base) efree(p->content_base);
- if (p->content_location) efree(p->content_location);
- if (p->content_language) efree(p->content_language);
- if (p->content_id) efree(p->content_id);
- if (p->content_description) efree(p->content_description);
- if (p->content_transfer_encoding) efree(p->content_transfer_encoding);
- if (p->boundary) efree(p->boundary);
- if (p->content_type) efree(p->content_type);
- if (p->mime_version) efree(p->mime_version);
- if (p->workbuf) efree(p->workbuf);
- if (p->header) efree(p->header);
- if (p->content_disposition) efree(p->content_disposition);
- if (p->rw_transfer_encoding) efree(p->rw_transfer_encoding);
- if (p->rfc2045acptr)
- efree(p->rfc2045acptr);
- zval_dtor(p->headerhash);
- efree(p->headerhash);
- efree(p);
-}
-
-/*
- Generic dynamic buffer append.
- */
-
-void rfc2045_add_buf(
- char **bufptr, /* Buffer */
- size_t *bufsize, /* Buffer's maximum size */
- size_t *buflen, /* Buffer's current size */
-
- const char *p, size_t len) /* Append this data */
-{
- if (len + *buflen > *bufsize)
- {
- size_t newsize=len+*buflen+256;
- char *p= *bufptr ? (char *)erealloc(*bufptr, newsize):
- (char *)emalloc(newsize);
-
- *bufptr=p;
- *bufsize=newsize;
- }
-
- memcpy(*bufptr + *buflen, p, len);
- *buflen += len;
-}
-
-/* Append to the work buffer */
-
-void rfc2045_add_workbuf(struct rfc2045 *h, const char *p, size_t len)
-{
- rfc2045_add_buf( &h->workbuf, &h->workbufsize, &h->workbuflen, p, len);
-}
-
-/* Append one character to the work buffer */
-
-void rfc2045_add_workbufch(struct rfc2045 *h, int c)
-{
- char cc= (char)c;
-
- rfc2045_add_workbuf(h, &cc, 1);
-}
-
-/*
- Generic function to duplicate contents of a string.
- The destination string may already be previously allocated,
- so unallocate it.
- */
-
-static void set_string(char **p,
- const char *q)
-{
- if (*p) {
- efree(*p);
- *p=0;
- }
- if (!q) return;
-
- *p = estrdup(q);
-}
-
-/* Update byte counts for this structure, and all the superstructures */
-
-static void update_counts(struct rfc2045 *p, size_t newcnt, size_t newendcnt,
- unsigned nlines)
-{
- while (p)
- {
- p->endpos = newcnt;
- p->endbody = newendcnt;
- p->nlines += nlines;
- if (!p->workinheader)
- p->nbodylines += nlines;
- p=p->parent;
- }
-}
-
-/*
- Main entry point for RFC2045 parsing. External data is fed
- by repetitively calling rfc2045_parse().
-
- rfc2045_parse() breaks up input into lines, and calls doline()
- to process each line.
- */
-
-static void doline(struct rfc2045 *);
-
-void rfc2045_parse(struct rfc2045 *h, const char *buf, size_t s)
-{
- size_t l;
-
- while (s)
- {
- for (l=0; l<s; l++)
- if (buf[l] == '\n') break;
- if (l < s && buf[l] == '\n')
- {
- ++l;
- rfc2045_add_workbuf(h, buf, l);
- doline(h);
- h->workbuflen=0;
- }
- else
- rfc2045_add_workbuf(h, buf, l);
- buf += l;
- s -= l;
- }
-
- /*
- ** Our buffer's getting pretty big. Let's see if we can
- ** partially handle it.
- */
-
- if (h->workbuflen > 512)
- {
- struct rfc2045 *p;
- int l, i;
-
- for (p=h; p->lastpart && !p->lastpart->workclosed;
- p=p->lastpart)
- ;
-
- /* If p->workinheader, we've got a mother of all headers
- ** here. Well, that's just too bad, we'll end up garbling
- ** it.
- */
-
- l=h->workbuflen;
-
- /* We do need to make sure that the final \r\n gets
- ** stripped off, so don't gobble up everything if
- ** the last character we see is a \r
- */
-
- if (h->workbuf[l-1] == '\r')
- --l;
-
- /* If we'll be rewriting, make sure rwprep knows about
- ** stuff that was skipped just now. */
-
- if (h->rfc2045acptr && !p->workinheader &&
- (!p->lastpart || !p->lastpart->workclosed))
- (*h->rfc2045acptr->section_contents)(h->rfc2045acptr, h->workbuf, l);
-
- update_counts(p, p->endpos+l, p->endpos+l, 0);
- p->informdata=1;
- for (i=0; l<h->workbuflen; l++)
- h->workbuf[i++]=h->workbuf[l];
- h->workbuflen=i;
- }
-}
-
-/*
- Append a new RFC2045 subpart. Adds new RFC2045 structure to the
- end of the list of existing RFC2045 substructures.
- */
-
-static struct rfc2045 *append_part_noinherit(struct rfc2045 *p, size_t startpos)
-{
- struct rfc2045 *newp;
-
- newp=rfc2045_alloc();
- if (p->lastpart)
- {
- p->lastpart->next=newp;
- newp->pindex=p->lastpart->pindex+1;
- }
- else
- {
- p->firstpart=newp;
- newp->pindex=0;
- }
- p->lastpart=newp;
- newp->parent=p;
-
- /* Initialize source pointers */
- newp->startpos = newp->endpos = newp->startbody = newp->endbody = startpos;
-
- while (p->parent)
- p=p->parent;
- ++p->numparts;
-
- return (newp);
-}
-
-static struct rfc2045 *append_part(struct rfc2045 *p, size_t startpos)
-{
- struct rfc2045 *newp=append_part_noinherit(p, startpos);
-
- /* Substructures inherit content transfer encoding and character set */
-
- set_string(&newp->content_transfer_encoding,
- p->content_transfer_encoding);
- rfc2045_setattr(&newp->content_type_attr, "charset",
- rfc2045_getattr(p->content_type_attr, "charset"));
- return (newp);
-}
-
-/*
- doline() processes next line in the RFC2045 message.
-
- Drills down the list of all the multipart messages currently open,
- and checks if the line is a boundary line for the given multipart.
- In theory the boundary line, if there is one, should be the boundary
- line only for the inner multipart only, but, this takes into account
- broken MIME messages.
- */
-
-static void do_header(struct rfc2045 *);
-
-static void doline(struct rfc2045 *p)
-{
- size_t cnt=p->workbuflen;
- char *c=p->workbuf;
- size_t n=cnt-1; /* Strip \n (we always get at least a \n here) */
- struct rfc2045 *newp;
- struct rfc2045ac *rwp=p->rfc2045acptr;
- unsigned num_levels=0;
-
- size_t k;
- int bit8=0;
-
- if (p->numparts > MAXPARTS)
- {
- p->rfcviolation |= RFC2045_ERR2COMPLEX;
- return;
- }
-
- for (k=0; k<cnt; k++)
- if (c[k] & 0x80) bit8=1;
-
- if (n && c[n-1] == '\r') /* Strip trailing \r */
- --n;
-
- /* Before the main drill down loop before, look ahead and see if we're
- ** in a middle of a form-data section. */
-
- for (newp=p; newp->lastpart &&
- !newp->lastpart->workclosed; newp=newp->lastpart,
- ++num_levels)
- {
- if (ContentBoundary(newp) == 0 || newp->workinheader)
- continue;
-
- if (newp->lastpart->informdata)
- {
- p=newp->lastpart;
- p->informdata=0;
- break;
- }
- }
-
- /* Drill down until we match a boundary, or until we've reached
- the last RFC2045 section that has been opened.
- */
-
- while (p->lastpart)
- {
- size_t l;
- const char *cb;
-
- if (p->lastpart->workclosed)
- {
- update_counts(p, p->endpos+cnt, p->endpos+cnt, 1);
- return;
- }
- /* Leftover trash -- workclosed is set when the final
- ** terminating boundary has been seen */
-
- /* content_boundary may be set before the entire header
- ** has been seen, so continue drilling down in that case
- */
-
- cb=ContentBoundary(p);
-
- if (cb == 0 || p->workinheader)
- {
- p=p->lastpart;
- ++num_levels;
- continue;
- }
-
- l=strlen(cb);
-
- if (c[0] == '-' && c[1] == '-' && n >= 2+l &&
- strncasecmp(cb, c+2, l) == 0)
- {
-
- if (rwp && (!p->lastpart || !p->lastpart->isdummy))
- (*rwp->end_section)(rwp);
-
- /* Ok, we've found a boundary */
-
- if (n >= 4+l && strncmp(c+2+l, "--", 2) == 0)
- {
- /* Last boundary */
-
- p->lastpart->workclosed=1;
- update_counts(p, p->endpos+cnt, p->endpos+cnt,
- 1);
- return;
- }
-
- /* Create new RFC2045 section */
-
- newp=append_part(p, p->endpos+cnt);
- update_counts(p, p->endpos+cnt, p->endpos+n, 1);
-
- /* The new RFC2045 section is MIME compliant */
-
- newp->mime_version = estrdup(p->mime_version);
- return;
- }
- p=p->lastpart;
- ++num_levels;
- }
-
- /* Ok, we've found the RFC2045 section that we're working with.
- ** Now what?
- */
-
- if (! p->workinheader)
- {
- /* Processing body, just update the counts. */
-
- size_t cnt_update=cnt;
-
- if (bit8 && !p->content_8bit &&
- (p->rfcviolation & RFC2045_ERR8BITCONTENT) == 0)
- {
- struct rfc2045 *q;
-
- for (q=p; q; q=q->parent)
- q->rfcviolation |= RFC2045_ERR8BITCONTENT;
- }
-
- /*
- ** In multiparts, the final newline in a part belongs to the
- ** boundary, otherwise, include it in the text.
- */
- if (p->parent && p->parent->content_type &&
- strncasecmp(p->parent->content_type,
- "multipart/", 10) == 0)
- cnt_update=n;
-
- if (!p->lastpart || !p->lastpart->workclosed)
- {
- if (rwp && !p->isdummy)
- (*rwp->section_contents)(rwp, c, cnt);
-
- update_counts(p, p->endpos+cnt, p->endpos+cnt_update,
- 1);
- }
- return;
- }
-
- if (bit8 && (p->rfcviolation & RFC2045_ERR8BITHEADER) == 0)
- {
- struct rfc2045 *q;
-
- for (q=p; q; q=q->parent)
- q->rfcviolation |= RFC2045_ERR8BITHEADER;
- }
-
- /* In the header */
-
- if ( n == 0 ) /* End of header, body begins. Parse header. */
- {
- do_header(p); /* Clean up any left over header line */
- p->workinheader=0;
-
- /* Message body starts right here */
-
- p->startbody=p->endpos+cnt;
- update_counts(p, p->startbody, p->startbody, 1);
- --p->nbodylines; /* Don't count the blank line */
-
- /* Discard content type and boundary if I don't understand this MIME flavor.
- * Allow broken messages that omit the Mime-Version header to still be
- * parsed.
- */
-
- if (p->mime_version == NULL && p->content_type != NULL) {
- /* technically in violation of the spec, but there are some broken
- * mailers out there that send this. Sadly, they are so broken
- * they don't set X-Mailer so we can't tell what they are...
- * Lets be useful and allow it, but flag it as a boo-boo */
- p->mime_version = estrdup("1.0");
- p->rfcviolation |= RFC2045_ERRNOMIMEVERSION;
- }
-
- if (!RFC2045_ISMIME1(p->mime_version))
- {
- set_string(&p->content_type, 0);
-
- rfc2045_freeattr(p->content_type_attr);
- p->content_type_attr=0;
- set_string(&p->content_disposition, 0);
- rfc2045_freeattr(p->content_disposition_attr);
- p->content_disposition_attr=0;
- if (p->boundary)
- {
- efree(p->boundary);
- p->boundary=0;
- }
- }
-
- /* Normally, if we don't have a content_type, default it
- ** to text/plain. However, if the multipart type is
- ** multipart/digest, it is message/rfc822.
- */
-
- if (RFC2045_ISMIME1(p->mime_version) && !p->content_type)
- {
- char *q="text/plain";
-
- if (p->parent && p->parent->content_type &&
- strcmp(p->parent->content_type,
- "multipart/digest") == 0)
- q="message/rfc822";
- set_string(&p->content_type, q);
- }
-
- /* If this is not a multipart section, we don't want to
- ** hear about any boundaries
- */
-
- if (!p->content_type ||
- strncmp(p->content_type, "multipart/", 10))
- rfc2045_setattr(&p->content_type_attr, "boundary", 0);
-
- /* If this section's a message, we will expect to see
- ** more RFC2045 stuff, so create a nested RFC2045 structure,
- ** and indicate that we expect to see headers.
- */
-
- if (p->content_type &&
- strcmp(p->content_type, "message/rfc822") == 0)
- {
- newp=append_part_noinherit(p, p->startbody);
- newp->workinheader=1;
- return;
- }
-
- /*
- ** If this is a multipart message (boundary defined),
- ** create a RFC2045 structure for the pseudo-section
- ** that precedes the first boundary line.
- */
-
- if (ContentBoundary(p))
- {
- newp=append_part(p, p->startbody);
- newp->workinheader=0;
- newp->isdummy=1;
- /* It's easier just to create it. */
- return;
- }
-
- if (rwp)
- (*rwp->start_section)(rwp, p);
- return;
- }
-
- /* RFC822 header continues */
-
- update_counts(p, p->endpos + cnt, p->endpos+n, 1);
-
- /* If this header line starts with a space, append one space
- ** to the saved contents of the previous line, and append this
- ** line to it.
- */
-
- if (isspace((int)(unsigned char)*c))
- {
- rfc2045_add_buf(&p->header, &p->headersize, &p->headerlen, " ", 1);
- }
- else
- {
- /* Otherwise the previous header line is complete, so process it */
-
- do_header(p);
- p->headerlen=0;
- }
-
- /* Save this line in the header buffer, because the next line
- ** could be a continuation.
- */
-
- rfc2045_add_buf( &p->header, &p->headersize, &p->headerlen, c, n);
-}
-
-/***********************************************************************/
-
-/*
- ** paste_tokens() - recombine an array of RFC822 tokens back as a string.
- ** (Comments) are ignored.
- */
-
-static char *paste_tokens(struct rfc822t *h, int start, int cnt)
-{
- int l;
- int i;
- char *p;
-
- /* Calculate string size */
-
- l=1;
- for (i=0; i<cnt; i++)
- {
- if (h->tokens[start+i].token == '(')
- continue;
-
- if (mailparse_rfc822_is_atom(h->tokens[start+i].token))
- l += h->tokens[start+i].len;
- else
- l++;
- }
-
- /* Do it */
-
- p=( char *)emalloc(l);
- l=0;
-
- for (i=0; i<cnt; i++)
- {
- if (h->tokens[start+i].token == '(')
- continue;
-
- if (mailparse_rfc822_is_atom(h->tokens[start+i].token))
- {
- int l2=h->tokens[start+i].len;
-
- memcpy(p+l, h->tokens[start+i].ptr, l2);
- l += l2;
- }
- else p[l++]=h->tokens[start+i].token;
- }
- p[l]=0;
- return (p);
-}
-
-/* Various permutations of the above, including forcing the string to
- ** lowercase
- */
-
-static char *lower_paste_tokens(struct rfc822t *h, int start, int cnt)
-{
- char *p=paste_tokens(h, start, cnt);
- char *q;
-
- for (q=p; q && *q; q++)
- *q=tolower(*q);
- return (p);
-}
-
-static char *paste_token(struct rfc822t *h, int i)
-{
- if (i >= h->ntokens) return (0);
- return (paste_tokens(h, i, 1));
-}
-
-static char *lower_paste_token(struct rfc822t *h, int i)
-{
- char *p=paste_token(h, i);
- char *q;
-
- for (q=p; q && *q; q++)
- *q=tolower(*q);
- return (p);
-}
-
-/*
- do_header() - process completed RFC822 header.
- */
-
-static void mime_version(struct rfc2045 *, struct rfc822t *);
-static void content_type(struct rfc2045 *, struct rfc822t *);
-static void content_transfer_encoding(struct rfc2045 *, struct rfc822t *);
-static void content_disposition(struct rfc2045 *, struct rfc822t *);
-static void content_id(struct rfc2045 *, struct rfc822t *);
-static void content_description(struct rfc2045 *, const char *);
-static void content_language(struct rfc2045 *, const char *);
-static void content_md5(struct rfc2045 *, const char *);
-static void content_base(struct rfc2045 *, struct rfc822t *);
-static void content_location(struct rfc2045 *, struct rfc822t *);
-
-static void do_header(struct rfc2045 *p)
-{
- struct rfc822t *header;
- char *t;
- char * val;
-
- if (p->headerlen == 0) return;
- rfc2045_add_buf( &p->header, &p->headersize, &p->headerlen, "", 1);
- /* 0 terminate */
-
- /* Parse the header line according to RFC822 */
-
- header=mailparse_rfc822t_alloc(p->header, NULL);
-
- if (!header) return; /* Broken header */
-
- if (header->ntokens < 2 ||
- header->tokens[0].token ||
- header->tokens[1].token != ':')
- {
- mailparse_rfc822t_free(header);
- return; /* Broken header */
- }
-
- t=lower_paste_token(header, 0);
-
-
- if (t != 0) {
-
- /* add the header to the hash */
- val = strchr(p->header, ':');
- if (val) {
- val++;
- while(isspace(*val))
- val++;
- add_assoc_string(p->headerhash, t, val, 1);
- }
- if (strcmp(t, "mime-version") == 0)
- {
- efree(t);
- mime_version(p, header);
- }
- else if (strcmp(t, "content-type") == 0)
- {
- efree(t);
- content_type(p, header);
- } else if (strcmp(t, "content-transfer-encoding") == 0)
- {
- efree(t);
- content_transfer_encoding(p, header);
- } else if (strcmp(t, "content-disposition") == 0)
- {
- efree(t);
- content_disposition(p, header);
- } else if (strcmp(t, "content-id") == 0)
- {
- efree(t);
- content_id(p, header);
- } else if (strcmp(t, "content-description") == 0)
- {
- efree(t);
- t=strchr(p->header, ':');
- if (t) ++t;
- while (t && isspace((int)(unsigned char)*t))
- ++t;
- content_description(p, t);
- } else if (strcmp(t, "content-language") == 0)
- {
- efree(t);
- t=strchr(p->header, ':');
- if (t) ++t;
- while (t && isspace((int)(unsigned char)*t))
- ++t;
- content_language(p, t);
- } else if (strcmp(t, "content-base") == 0)
- {
- efree(t);
- content_base(p, header);
- } else if (strcmp(t, "content-location") == 0)
- {
- efree(t);
- content_location(p, header);
- } else if (strcmp(t, "content-md5") == 0)
- {
- efree(t);
- t=strchr(p->header, ':');
- if (t) ++t;
- while (t && isspace((int)(unsigned char)*t))
- ++t;
- content_md5(p, t);
- }
- else efree(t);
- }
- mailparse_rfc822t_free(header);
-}
-
-/* Mime-Version: and Content-Transfer-Encoding: headers are easy */
-
-static void mime_version(struct rfc2045 *p, struct rfc822t *header)
-{
- char *vers=paste_tokens(header, 2, header->ntokens-2);
-
- if (!vers) return;
-
- if (p->mime_version) efree(p->mime_version);
- p->mime_version=vers;
-}
-
-static void content_transfer_encoding(struct rfc2045 *r,
- struct rfc822t *header)
-{
- char *p;
-
- p=lower_paste_tokens(header, 2, header->ntokens-2);
- if (!p) return;
-
- if (r->content_transfer_encoding)
- efree(r->content_transfer_encoding);
- r->content_transfer_encoding=p;
-
- if (strcmp(p, "8bit") == 0)
- r->content_8bit=1;
-}
-
-/* Dig into the content_type header */
-
-static void parse_content_header(struct rfc2045 *r, struct rfc822t *header,
- void (*init_token)(struct rfc2045 *, char *),
- void (*init_parameter)(struct rfc2045 *, const char *,
- struct rfc822t *, int, int))
-{
- int start;
- int i, j;
- char *p;
-
- /* Look for the 1st ; */
-
- for (start=2; start < header->ntokens; start++)
- if (header->tokens[start].token == ';')
- break;
-
- /* Everything up to the 1st ; is the content type */
-
- p=lower_paste_tokens(header, 2, start-2);
- if (!p) return;
-
- (*init_token)(r, p);
- if (start < header->ntokens) start++;
-
- /* Handle the remainder of the Content-Type: header */
-
- while (start < header->ntokens)
- {
- /* Look for next ; */
-
- for (i=start; i<header->ntokens; i++)
- if (header->tokens[i].token == ';')
- break;
- j=start;
- if (j < i)
- {
- ++j;
-
- /* We only understand <atom>= */
-
- while (j < i && header->tokens[j].token == '(')
- ++j;
- if (j < i && header->tokens[j].token == '=')
- {
- ++j;
- p=lower_paste_token(header, start);
- if (!p) return;
- (*init_parameter)(r, p, header, j, i-j);
- efree(p);
- }
- }
- if ( i<header->ntokens ) ++i; /* Skip over ; */
- start=i;
- }
-}
-
-/* Dig into the content_type header */
-
-static void save_content_type(struct rfc2045 *, char *);
-static void save_content_type_parameter( struct rfc2045 *, const char *,
- struct rfc822t *, int, int);
-
-static void content_type(struct rfc2045 *r, struct rfc822t *header)
-{
- parse_content_header(r, header, &save_content_type,
- &save_content_type_parameter);
-}
-
-static void save_content_type(struct rfc2045 *r, char *content_type)
-{
- if (r->content_type) efree(r->content_type);
- r->content_type=content_type;
-}
-
-static void save_content_type_parameter(
- struct rfc2045 *r, const char *name,
- struct rfc822t *header, int start, int len)
-{
- char *p;
-
- p=strcmp(name, "charset") == 0 ?
- lower_paste_tokens(header, start, len):
- paste_tokens(header, start, len);
- if (!p) return;
-
- rfc2045_setattr(&r->content_type_attr, name, p);
- efree(p);
-
- if (strcmp(name, "boundary") == 0)
- {
- if (r->boundary)
- efree(r->boundary);
- p=lower_paste_tokens(header, start, len);
- r->boundary=p;
- }
-}
-
-/* Dig into content-disposition */
-
-static void save_content_disposition(struct rfc2045 *, char *);
-static void save_content_disposition_parameter( struct rfc2045 *, const char *,
- struct rfc822t *, int, int);
-
-static void content_disposition(struct rfc2045 *r, struct rfc822t *header)
-{
- parse_content_header(r, header, &save_content_disposition,
- &save_content_disposition_parameter);
-}
-
-static void save_content_disposition(struct rfc2045 *r,
- char *content_disposition)
-{
- if (r->content_disposition) efree(r->content_disposition);
- r->content_disposition=content_disposition;
-}
-
-static void save_content_disposition_parameter(
- struct rfc2045 *r, const char *name,
- struct rfc822t *header, int start, int len)
-{
- char *p;
-
- p=paste_tokens(header, start, len);
- if (!p) return;
-
- rfc2045_setattr(&r->content_disposition_attr, name, p);
- efree(p);
-}
-
-char *rfc2045_related_start(const struct rfc2045 *p)
-{
- const char *cb=rfc2045_getattr( p->content_type_attr, "start");
- struct rfc822t *t;
- struct rfc822a *a;
- int i;
-
- if (!cb || !*cb) return (0);
-
- t=mailparse_rfc822t_alloc(cb, 0);
- a=mailparse_rfc822a_alloc(t);
- for (i=0; i<a->naddrs; i++)
- if (a->addrs[i].tokens)
- {
- char *s=mailparse_rfc822_getaddr(a, i);
-
- mailparse_rfc822a_free(a);
- mailparse_rfc822t_free(t);
- return (s);
- }
-
- mailparse_rfc822a_free(a);
- mailparse_rfc822t_free(t);
- return (0);
-}
-
-static void content_id(struct rfc2045 *p, struct rfc822t *t)
-{
- struct rfc822a *a=mailparse_rfc822a_alloc(t);
- int i;
-
-
- for (i=0; i<a->naddrs; i++)
- if (a->addrs[i].tokens)
- {
- char *s=mailparse_rfc822_getaddr(a, i);
- if (p->content_id)
- efree(p->content_id);
- p->content_id=s;
- break;
- }
-
- mailparse_rfc822a_free(a);
-}
-
-static void content_description(struct rfc2045 *p, const char *s)
-{
- if (s && *s)
- set_string(&p->content_description, s);
-}
-
-static void content_language(struct rfc2045 *p, const char *s)
-{
- if (s && *s)
- set_string(&p->content_language, s);
-}
-
-static void content_md5(struct rfc2045 *p, const char *s)
-{
- if (s && *s)
- set_string(&p->content_md5, s);
-}
-
-static void content_base(struct rfc2045 *p, struct rfc822t *t)
-{
- char *s;
- int i;
-
- for (i=0; i<t->ntokens; i++)
- if (t->tokens[i].token == '"')
- t->tokens[i].token=0;
-
- s=paste_tokens(t, 2, t->ntokens-2);
- set_string(&p->content_base, s);
-}
-
-static void content_location(struct rfc2045 *p, struct rfc822t *t)
-{
- char *s;
- int i;
-
- for (i=0; i<t->ntokens; i++)
- if (t->tokens[i].token == '"')
- t->tokens[i].token=0;
-
- s=paste_tokens(t, 2, t->ntokens-2);
- set_string(&p->content_location, s);
-}
-
-/* -------------------- */
-
-#define GETINFO(s, def) ( (s) && (*s) ? (s):def)
-
-void rfc2045_mimeinfo(const struct rfc2045 *p,
- const char **content_type_s,
- const char **content_transfer_encoding_s,
- const char **charset_s)
-{
- const char *c;
- MAILPARSELS_FETCH();
-
- *content_type_s=GETINFO(p->content_type, "text/plain");
- *content_transfer_encoding_s=GETINFO(p->content_transfer_encoding,
- "8bit");
-
- c=rfc2045_getattr(p->content_type_attr, "charset");
- if (!c)
- c = MAILPARSEG(def_charset);
-
- *charset_s=c;
-}
-
-const char *rfc2045_boundary(const struct rfc2045 *p)
-{
- const char *cb=rfc2045_getattr( p->content_type_attr, "boundary");
-
- if (!cb) cb="";
- return (cb);
-}
-
-void rfc2045_dispositioninfo(const struct rfc2045 *p,
- const char **disposition_s,
- const char **disposition_name_s,
- const char **disposition_filename_s)
-{
- *disposition_s=p->content_disposition;
- *disposition_name_s=rfc2045_getattr(p->content_disposition_attr,
- "name");
- *disposition_filename_s=rfc2045_getattr(p->content_disposition_attr,
- "filename");
-}
-
-const char *rfc2045_contentname(const struct rfc2045 *p)
-{
- const char *q=rfc2045_getattr(p->content_type_attr, "name");
-
- if (!q) q="";
- return (q);
-}
-
-const char *rfc2045_content_id(const struct rfc2045 *p)
-{
- return (p->content_id ? p->content_id:"");
-}
-
-const char *rfc2045_content_description(const struct rfc2045 *p)
-{
- return (p->content_description ? p->content_description:"");
-}
-
-const char *rfc2045_content_language(const struct rfc2045 *p)
-{
- return (p->content_language ? p->content_language:"");
-}
-
-const char *rfc2045_content_md5(const struct rfc2045 *p)
-{
- return (p->content_md5 ? p->content_md5:"");
-}
-
-void rfc2045_mimepos(const struct rfc2045 *p,
- off_t *start_pos, off_t *end_pos, off_t *start_body,
- off_t *nlines, off_t *nbodylines)
-{
- *start_pos=p->startpos;
- *end_pos=p->endpos;
-
- *nlines=p->nlines;
- *nbodylines=p->nbodylines;
- if (p->parent) /* MIME parts do not have the trailing CRLF */
- {
- *end_pos=p->endbody;
- if (*nlines) --*nlines;
- if (*nbodylines) --*nbodylines;
- }
- *start_body=p->startbody;
-}
-
-unsigned rfc2045_mimepartcount(const struct rfc2045 *p)
-{
- const struct rfc2045 *q;
- unsigned n=0;
-
- for (q=p->firstpart; q; q=q->next) ++n;
- return (n);
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/mailparse/rfc2045.h b/ext/mailparse/rfc2045.h
deleted file mode 100755
index a9f445e834..0000000000
--- a/ext/mailparse/rfc2045.h
+++ /dev/null
@@ -1,208 +0,0 @@
-/*
-** Copyright 1998 - 2000 Double Precision, Inc. See COPYING for
-** distribution information.
-*/
-
-/*
-** $Id$
-*/
-#ifndef rfc2045_h
-#define rfc2045_h
-
-#include "php_mailparse.h"
-#include "ext/mbstring/mbfilter.h"
-
-#define RFC2045CHARSET "us-ascii"
-#define RFC2045MIMEMSG "This is a MIME-formatted message.\n"
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define RFC2045_ISMIME1(p) ((p) && atoi(p) == 1)
-#define RFC2045_ISMIME1DEF(p) (!(p) || atoi(p) == 1)
-
-struct rfc2045;
-
-/* callback for de/encoding */
-typedef int (*rfc2045_decode_user_func_t)(const char *p, size_t n, void *ptr);
-typedef int (*rfc2045_decode_func_t)(struct rfc2045 * part, const char * buf, size_t n);
-
-/* the attributes of a given header */
-struct rfc2045attr {
- struct rfc2045attr *next;
- char *name;
- char *value;
-};
-
-struct rfc2045 {
- struct rfc2045 *parent;
- unsigned pindex;
- struct rfc2045 *next;
-
- off_t startpos, /* At which offset in msg this section starts */
- endpos, /* Where it ends */
- startbody, /* Where the body of the msg starts */
- endbody; /* endpos - trailing CRLF terminator */
- off_t nlines; /* Number of lines in message */
- off_t nbodylines; /* Number of lines only in the body */
- char *mime_version;
- char *content_type;
- struct rfc2045attr *content_type_attr; /* Content-Type: attributes */
-
- char *content_disposition;
- char *boundary;
- struct rfc2045attr *content_disposition_attr;
- char *content_transfer_encoding;
- /* Set if content_transfer_encoding is 8bit */
- int content_8bit;
- char *content_id;
- char *content_description;
- char *content_language;
- char *content_md5;
- char *content_base;
- char *content_location;
- struct rfc2045ac *rfc2045acptr;
- int has8bitchars; /* For rewriting */
- int haslongline; /* For rewriting */
- unsigned rfcviolation; /* Boo-boos */
-
-#define RFC2045_ERR8BITHEADER 1 /* 8 bit characters in headers */
-#define RFC2045_ERR8BITCONTENT 2 /* 8 bit contents, but no 8bit content-transfer-encoding */
-#define RFC2045_ERR2COMPLEX 4 /* Too many nested contents */
-#define RFC2045_ERRNOMIMEVERSION 8 /* missing Mime-Version header, but boundary set in content type */
- unsigned numparts; /* # of parts allocated */
-
- char *rw_transfer_encoding; /* For rewriting */
-
-#define RFC2045_RW_7BIT 1
-#define RFC2045_RW_8BIT 2
-
- /* Subsections */
-
- struct rfc2045 *firstpart, *lastpart;
-
- /* Working area */
-
- char *workbuf;
- size_t workbufsize;
- size_t workbuflen;
- int workinheader;
- int workclosed;
- int isdummy;
- int informdata; /* In a middle of a long form-data part */
- char *header;
- size_t headersize;
- size_t headerlen;
-
- zval * headerhash; /* a record of all of the headers */
-
- /* decoding filter to use */
- mbfl_convert_filter * decode_filter;
- /* "user" function to accept the decoding output */
- rfc2045_decode_user_func_t udecode_func;
- /* this is passed as the last param to the user decode func */
- void *misc_decode_ptr;
-} ;
-
-
-struct rfc2045 *rfc2045_alloc();
-void rfc2045_parse(struct rfc2045 *, const char *, size_t);
-void rfc2045_free(struct rfc2045 *);
-
-
-const char *rfc2045_contentname(const struct rfc2045 *);
-void rfc2045_mimeinfo(const struct rfc2045 *,
- const char **,
- const char **,
- const char **);
-const char *rfc2045_boundary(const struct rfc2045 *);
-char *rfc2045_related_start(const struct rfc2045 *);
-const char *rfc2045_content_id(const struct rfc2045 *);
-const char *rfc2045_content_description(const struct rfc2045 *);
-const char *rfc2045_content_language(const struct rfc2045 *);
-const char *rfc2045_content_md5(const struct rfc2045 *);
-
-void rfc2045_dispositioninfo(const struct rfc2045 *,
- const char **,
- const char **,
- const char **);
-
-void rfc2045_mimepos(const struct rfc2045 *, off_t *, off_t *, off_t *,
- off_t *, off_t *);
-unsigned rfc2045_mimepartcount(const struct rfc2045 *);
-
-struct rfc2045id {
- struct rfc2045id *next;
- int idnum;
-} ;
-
-void rfc2045_decode(struct rfc2045 *,
- void (*)(struct rfc2045 *, struct rfc2045id *, void *),
- void *);
-
-struct rfc2045 *rfc2045_find(struct rfc2045 *, const char *);
-
-
-
-
-/* begin an en/decoding process */
-void rfc2045_cdecode_start(struct rfc2045 *, rfc2045_decode_user_func_t cb, void *);
-int rfc2045_cdecode(struct rfc2045 *, const char *, size_t);
-int rfc2045_cdecode_end(struct rfc2045 *);
-
-struct rfc2045ac {
- void (*start_section)(struct rfc2045ac *, struct rfc2045 *);
- void (*section_contents)(struct rfc2045ac *, const char *, size_t);
- void (*end_section)(struct rfc2045ac *);
- /* private vars used in acprep */
- int curlinepos;
- struct rfc2045 *currwp;
- enum {
- rfc2045ac_raw,
- rfc2045ac_quotedprint,
- rfc2045ac_qpseeneq,
- rfc2045ac_qpseeneqh,
- rfc2045ac_base64
- } curstate;
- int statechar;
-
-
-};
-
-struct rfc2045 *rfc2045_alloc_ac();
-int rfc2045_ac_check(struct rfc2045 *, int);
-int rfc2045_rewrite(struct rfc2045 *, int, int, const char *);
-int rfc2045_rewrite_func(struct rfc2045 *p, int,
- int (*)(const char *, int, void *), void *,
- const char *);
-
-/* Internal functions */
-
-int rfc2045_try_boundary(struct rfc2045 *, int, const char *);
-char *rfc2045_mk_boundary(struct rfc2045 *, int);
-const char *rfc2045_getattr(const struct rfc2045attr *, const char *);
-void rfc2045_setattr(struct rfc2045attr **, const char *, const char *);
-
-/* MIME content base/location */
-
-char *rfc2045_content_base(struct rfc2045 *p);
- /* This joins Content-Base: and Content-Location:, as best as I
- ** can figure it out.
- */
-
-char *rfc2045_append_url(const char *, const char *);
- /* Do this with two arbitrary URLs */
-
-
-
-void rfc2045_add_workbuf(struct rfc2045 *h, const char *p, size_t len);
-void rfc2045_add_workbufch(struct rfc2045 *h, int c);
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/ext/mailparse/rfc2045acchk.c b/ext/mailparse/rfc2045acchk.c
deleted file mode 100644
index 8fcd16dbaf..0000000000
--- a/ext/mailparse/rfc2045acchk.c
+++ /dev/null
@@ -1,123 +0,0 @@
-/* $Id$ */
-/*
-** Copyright 1998 - 1999 Double Precision, Inc. See COPYING for
-** distribution information.
-*/
-#include "php.h"
-#include "php_mailparse.h"
-
-
-int rfc2045_ac_check(struct rfc2045 *p, int rwmode)
-{
- int flag=0; /* Flag - rewriting suggested */
- struct rfc2045 *c;
- int hasnon7bit=p->has8bitchars;
- /* hasnon7bit: 8bit chars in this section or subsections */
- const char *te;
- int is8bitte;
- MAILPARSELS_FETCH();
-
- for (c=p->firstpart; c; c=c->next)
- if (!c->isdummy)
- {
- if (rfc2045_ac_check(c, rwmode)) flag=1;
- if (strcmp(c->content_transfer_encoding, "7bit") &&
- strcmp(c->content_transfer_encoding, "quoted-printable"))
- hasnon7bit=1;
- if (c->has8bitchars)
- p->has8bitchars=1;
- }
-
- if (RFC2045_ISMIME1DEF(p->mime_version) && !p->content_type)
- {
- p->content_type = estrdup("text/plain");
- if (p->mime_version)
- {
- flag=1;
- }
- }
-
- if (RFC2045_ISMIME1DEF(p->mime_version)
- && !rfc2045_getattr(p->content_type_attr, "charset")
- && strncasecmp(p->content_type, "text/", 5) == 0)
- {
- rfc2045_setattr(&p->content_type_attr, "charset",
- MAILPARSEG(def_charset));
-
- if (p->mime_version
-
- && p->firstpart == 0 /* sam - don't trigger rewrites on changes to multipart headers */
-
- )
- {
- flag=1;
- }
- }
-
- if (RFC2045_ISMIME1DEF(p->mime_version)
- && !p->content_transfer_encoding)
- {
- p->content_transfer_encoding = estrdup(hasnon7bit ? "8bit":"7bit");
- if (p->mime_version
-
- && p->firstpart == 0 /* sam - don't trigger rewrites on changes to multipart headers */
- )
- {
- flag=1;
- }
- }
-
-#if 0
- if (RFC2045_ISMIME1DEF(p->mime_version)
- && strncmp(p->content_type, "text/", 5) == 0 && !hasnon7bit
- && strcmp(p->content_transfer_encoding, "7bit"))
- {
- if (p->mime_version)
- {
- flag=1;
- }
- }
-#endif
-
- if (RFC2045_ISMIME1DEF(p->mime_version))
- {
- /* Check for conversions */
-
- te=p->content_transfer_encoding;
- is8bitte=strcasecmp(te, "base64") &&
- strcasecmp(te, "quoted-printable") &&
- strcasecmp(te, "7bit"); /* 8 bit contents */
-
- if (is8bitte && !p->has8bitchars && !p->haslongline)
- {
- if (p->rw_transfer_encoding)
- efree(p->rw_transfer_encoding);
- p->rw_transfer_encoding=estrdup("7bit");
- flag=1;
- is8bitte=0;
- }
-
- if (rwmode == RFC2045_RW_7BIT && (is8bitte || p->haslongline))
- {
- if (p->rw_transfer_encoding)
- efree(p->rw_transfer_encoding);
- p->rw_transfer_encoding=estrdup("quoted-printable");
- flag=1;
- }
- else if (rwmode == RFC2045_RW_8BIT &&
- strcasecmp(te, "quoted-printable") == 0 &&
- !p->haslongline)
- {
- if (p->rw_transfer_encoding)
- efree(p->rw_transfer_encoding);
- p->rw_transfer_encoding=estrdup(hasnon7bit ? "8bit":"7bit");
- flag=1;
- }
- }
-
- if (!p->mime_version)
- {
- p->mime_version = estrdup("1.0");
- }
- return (flag);
-}
diff --git a/ext/mailparse/rfc2045acprep.c b/ext/mailparse/rfc2045acprep.c
deleted file mode 100644
index acbc560092..0000000000
--- a/ext/mailparse/rfc2045acprep.c
+++ /dev/null
@@ -1,99 +0,0 @@
-/* $Id$ */
-
-/*
-** Copyright 1998 - 1999 Double Precision, Inc. See COPYING for
-** distribution information.
-*/
-#include "php.h"
-#include "php_mailparse.h"
-
-
-static void start_rwprep(struct rfc2045ac *, struct rfc2045 *);
-static void do_rwprep(struct rfc2045ac *, const char *, size_t);
-static void end_rwprep(struct rfc2045ac *);
-
-static struct rfc2045ac rfc2045acprep={
- &start_rwprep,
- &do_rwprep,
- &end_rwprep};
-
-#define h2nyb(c) ( (c) >= 'a' && (c) <= 'f' ? (c)-('a'-10): \
- (c) >= 'A' && (c) <= 'F' ? (c)-('A'-10): (c)-'0')
-
-struct rfc2045 *rfc2045_alloc_ac()
-{
- struct rfc2045 *p=rfc2045_alloc();
-
- if (p)
- {
- p->rfc2045acptr = emalloc(sizeof(struct rfc2045ac));
- memcpy(p->rfc2045acptr, &rfc2045acprep, sizeof(struct rfc2045ac));
- p->rfc2045acptr->curlinepos = 0;
- p->rfc2045acptr->currwp = NULL;
- }
- return (p);
-}
-
-
-static void start_rwprep(struct rfc2045ac * this_ptr, struct rfc2045 *p)
-{
- this_ptr->currwp = p;
- this_ptr->curlinepos=0;
- this_ptr->curstate=rfc2045ac_raw;
- if (p->content_transfer_encoding)
- {
- if (strcmp(p->content_transfer_encoding,
- "quoted-printable") == 0)
- this_ptr->curstate = rfc2045ac_quotedprint;
- else if (strcmp(p->content_transfer_encoding, "base64") == 0)
- this_ptr->curstate = rfc2045ac_base64;
- }
-}
-
-static void do_rwprep(struct rfc2045ac * this_ptr, const char * p, size_t n)
-{
- if (!this_ptr->currwp)
- return;
- for ( ; n; --n, ++p)
- switch (this_ptr->curstate) {
- case rfc2045ac_quotedprint:
- if (*p == '=')
- {
- this_ptr->curstate = rfc2045ac_qpseeneq;
- continue;
- }
- /* FALLTHRU */
- case rfc2045ac_raw:
- if (*p == '\r' || *p == '\n')
- this_ptr->curlinepos = 0;
- else if (++this_ptr->curlinepos > 500)
- this_ptr->currwp->haslongline = 1;
- if ((unsigned char)*p >= 127)
- this_ptr->currwp->has8bitchars = 1;
- break;
- case rfc2045ac_qpseeneq:
- if (*p == '\n')
- {
- this_ptr->curstate = rfc2045ac_quotedprint;
- continue;
- }
- if (isspace((int)(unsigned char)*p)) continue; /* Ignore WSP */
- this_ptr->statechar = *p;
- this_ptr->curstate = rfc2045ac_qpseeneqh;
- continue;
- case rfc2045ac_qpseeneqh:
- this_ptr->curstate = rfc2045ac_quotedprint;
- if ( (unsigned char)
- ( (h2nyb(this_ptr->statechar) << 4) + h2nyb(*p) ) >= 127
- ) this_ptr->currwp->has8bitchars=1;
- if (++this_ptr->curlinepos > 500)
- this_ptr->currwp->haslongline=1;
- continue;
- case rfc2045ac_base64:
- break;
- }
-}
-
-static void end_rwprep(struct rfc2045ac * this_ptr)
-{
-}
diff --git a/ext/mailparse/rfc2045appendurl.c b/ext/mailparse/rfc2045appendurl.c
deleted file mode 100644
index 1683c0a390..0000000000
--- a/ext/mailparse/rfc2045appendurl.c
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997, 1998, 1999, 2000, 2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: |
- | Wez Furlong (wez@thebrainroom.com) |
- +----------------------------------------------------------------------+
- */
-/* $Id$ */
-
-/*
-** Copyright 2000 Double Precision, Inc. See COPYING for
-** distribution information.
-*/
-
-#include "php.h"
-#include "php_mailparse.h"
-
-/*
-** ---------------------------------------------------------------------
-** Attempt to parse Content-Base: and Content-Location:, and return the
-** "base" of all the relative URLs in the section.
-** ---------------------------------------------------------------------
-*/
-
-/* {{{ get_method_path
- */
-static void get_method_path(const char *p,
- const char **method,
- unsigned *methodl,
- const char **path)
-{
- unsigned i;
-
- for (i=0; p && p[i]; i++)
- {
- if (p[i] == ':')
- {
- *method=p;
- *methodl= ++i;
- *path=p+i;
- return;
- }
-
- if (!isalpha( (int)(unsigned char)p[i]))
- break;
- }
-
- *method=0;
- *methodl=0;
- *path=p;
-}
-/* }}} */
-
-/* {{{ rfc2045_append_url
- */
-char *rfc2045_append_url(const char *base, const char *loc)
-{
- const char *base_method;
- unsigned base_method_l;
- const char *base_path;
-
- const char *loc_method;
- unsigned loc_method_l;
- const char *loc_path;
- char *buf, *q;
-
- get_method_path(base, &base_method, &base_method_l, &base_path);
- get_method_path(loc, &loc_method, &loc_method_l, &loc_path);
-
- if (loc_method_l)
- {
- buf = emalloc(strlen(loc)+1);
- strcpy(buf, loc);
- return (buf);
- }
-
- loc_method = base_method;
- loc_method_l = base_method_l;
-
- if (!base_path) base_path = "";
- if (!loc_path) loc_path = "";
-
- buf = emalloc(loc_method_l + strlen(base_path)+strlen(loc_path) + 3);
-
- if (loc_method_l)
- memcpy(buf, loc_method, loc_method_l);
- buf[loc_method_l] = 0;
-
- q=buf + loc_method_l;
-
- strcat(strcpy(q, base_path), "/");
-
- if ( loc_path[0] == '/')
- {
- char *r;
-
- if (loc_path[1] == '/') {
- *q=0; /* Location is absolute */
- }
- else if ( q[0] == '/' && q[1] == '/' && (r=strchr(q+2, '/')) != 0) {
- *r=0; /* Relative to top of base */
- }
- else {
- *q=0; /* No sys in base, just start with / */
- }
- }
-
- strcat(q, loc_path);
-
- return (buf);
-}
-/* }}} */
-
-char *rfc2045_content_base(struct rfc2045 *p)
-{
- return (rfc2045_append_url(p->content_base, p->content_location));
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/mailparse/rfc2045cdecode.c b/ext/mailparse/rfc2045cdecode.c
deleted file mode 100755
index 858f48dfde..0000000000
--- a/ext/mailparse/rfc2045cdecode.c
+++ /dev/null
@@ -1,90 +0,0 @@
-/* $Id$ */
-/*
- ** Copyright 1998 - 1999 Double Precision, Inc. See COPYING for
- ** distribution information.
- */
-
-#include "php.h"
-#include "php_mailparse.h"
-
-
-static int op_func(int c, void *dat)
-{
- struct rfc2045 * p = (struct rfc2045*)dat;
-
- rfc2045_add_workbufch(p, c);
-
- /* drain buffer */
- if (p->workbuflen >= 4096) {
- (*p->udecode_func)(p->workbuf, p->workbuflen, p->misc_decode_ptr);
- p->workbuflen = 0;
- }
-
- return c;
-}
-
-void rfc2045_cdecode_start(struct rfc2045 *p,
- rfc2045_decode_user_func_t u,
- void *miscptr)
-{
- enum mbfl_no_encoding from = mbfl_no_encoding_8bit;
-
- if (p->content_transfer_encoding)
- {
- from = mbfl_name2no_encoding(p->content_transfer_encoding);
- if (from == mbfl_no_encoding_invalid) {
- zend_error(E_WARNING, "%s(): I don't know how to decode %s transfer encoding!",
- get_active_function_name(),
- p->content_transfer_encoding);
- from = mbfl_no_encoding_8bit;
- }
- }
-
- p->misc_decode_ptr=miscptr;
- p->udecode_func=u;
- p->workbuflen=0;
-
- if (from == mbfl_no_encoding_8bit)
- p->decode_filter = NULL;
- else
- p->decode_filter = mbfl_convert_filter_new(
- from, mbfl_no_encoding_8bit,
- op_func,
- NULL,
- p
- );
-}
-
-int rfc2045_cdecode_end(struct rfc2045 *p)
-{
- if (p->decode_filter)
- {
- mbfl_convert_filter_flush(p->decode_filter);
- mbfl_convert_filter_delete(p->decode_filter);
- p->decode_filter = NULL;
- if (p->workbuflen > 0)
- (*p->udecode_func)(p->workbuf, p->workbuflen, p->misc_decode_ptr);
- }
- return 0;
-}
-
-int rfc2045_cdecode(struct rfc2045 *p, const char *s, size_t l)
-{
- if (s && l)
- {
- int i;
-
- if (p->decode_filter)
- {
- for (i=0; i<l; i++)
- {
- if (mbfl_convert_filter_feed(s[i], p->decode_filter) < 0)
- return -1;
- }
- }
- else
- return ((*p->udecode_func)(s,l,p->misc_decode_ptr));
-
- }
- return (0);
-}
diff --git a/ext/mailparse/rfc2045decode.c b/ext/mailparse/rfc2045decode.c
deleted file mode 100644
index 1c066e3a99..0000000000
--- a/ext/mailparse/rfc2045decode.c
+++ /dev/null
@@ -1,40 +0,0 @@
-/* $Id$ */
-/*
-** Copyright 1998 - 1999 Double Precision, Inc. See COPYING for
-** distribution information.
-*/
-
-#include "php.h"
-#include "php_mailparse.h"
-
-static void decode(struct rfc2045id *topid,
- struct rfc2045id **childidptr,
- struct rfc2045 *r,
- void (*func)(struct rfc2045 *, struct rfc2045id *, void *),
- void *ptr)
-{
-struct rfc2045id nextid;
-
- *childidptr=0;
- (*func)(r, topid, ptr);
- *childidptr=&nextid;
- nextid.idnum=1;
- if (r->content_type && strncmp(r->content_type, "multipart/", 10) == 0)
- nextid.idnum=0;
- for (r=r->firstpart; r; r=r->next)
- {
- if (nextid.idnum)
- decode(topid, &nextid.next, r, func, ptr);
- ++nextid.idnum;
- }
-}
-
-void rfc2045_decode(struct rfc2045 *p,
- void (*func)(struct rfc2045 *, struct rfc2045id *, void *),
- void *ptr)
-{
-struct rfc2045id topid;
-
- topid.idnum=1;
- decode(&topid, &topid.next, p, func, ptr);
-}
diff --git a/ext/mailparse/rfc2045find.c b/ext/mailparse/rfc2045find.c
deleted file mode 100644
index ab93c2be4a..0000000000
--- a/ext/mailparse/rfc2045find.c
+++ /dev/null
@@ -1,47 +0,0 @@
-/* $Id$ */
-/*
-** Copyright 1998 - 1999 Double Precision, Inc. See COPYING for
-** distribution information.
-*/
-
-#include "php.h"
-#include "php_mailparse.h"
-
-struct rfc2045findstruct {
- const char *partnum;
- struct rfc2045 *ptr;
-} ;
-
-static void do_decode(struct rfc2045 *p, struct rfc2045id *id, void *ptr)
-{
- struct rfc2045findstruct *fs=(struct rfc2045findstruct *)ptr;
- const char *partnum=fs->partnum;
- unsigned n;
-
- while (id)
- {
- if (!isdigit((int)(unsigned char)*partnum)) return;
- n=0;
- while (isdigit((int)(unsigned char)*partnum))
- n=n*10 + *partnum++ - '0';
- if (*partnum)
- {
- if (*partnum != '.') return;
- ++partnum;
- }
- if (n != (unsigned)id->idnum) return;
- id=id->next;
- }
- if ( *partnum == '\0') fs->ptr=p;
-}
-
-
-struct rfc2045 *rfc2045_find(struct rfc2045 *p, const char *str)
-{
- struct rfc2045findstruct fs;
-
- fs.partnum=str;
- fs.ptr=0;
- rfc2045_decode(p, &do_decode, &fs);
- return (fs.ptr);
-}
diff --git a/ext/mailparse/rfc822.c b/ext/mailparse/rfc822.c
deleted file mode 100755
index 312bf66cc7..0000000000
--- a/ext/mailparse/rfc822.c
+++ /dev/null
@@ -1,716 +0,0 @@
-/* $Id$ */
-/*
- ** Copyright 1998 - 1999 Double Precision, Inc.
- ** See COPYING for distribution information.
- */
-
-#include "php.h"
-#include "php_mailparse.h"
-
-static void tokenize(const char *p, struct rfc822token *tokp, int *toklen,
- void (*err_func)(const char *, int))
-{
- const char *addr=p;
- int i=0;
- int inbracket=0;
-
- *toklen=0;
- while (*p)
- {
- if (isspace((int)(unsigned char)*p))
- {
- p++;
- i++;
- continue;
- }
-
- switch (*p) {
- int level;
-
- case '(':
- if (tokp)
- {
- tokp->token='(';
- tokp->ptr=p;
- tokp->len=0;
- }
- level=0;
- for (;;)
- {
- if (!*p)
- {
- if (err_func) (*err_func)(addr, i);
- if (tokp) tokp->token='"';
- ++*toklen;
- return;
- }
- if (*p == '(')
- ++level;
- if (*p == ')' && --level == 0)
- {
- p++;
- i++;
- if (tokp) tokp->len++;
- break;
- }
- if (*p == '\\' && p[1])
- {
- p++;
- i++;
- if (tokp) tokp->len++;
- }
-
- i++;
- if (tokp) tokp->len++;
- p++;
- }
- if (tokp) ++tokp;
- ++*toklen;
- continue;
-
- case '"':
- p++;
- i++;
-
- if (tokp)
- {
- tokp->token='"';
- tokp->ptr=p;
- }
- while (*p != '"')
- {
- if (!*p)
- {
- if (err_func) (*err_func)(addr, i);
- ++*toklen;
- return;
- }
- if (*p == '\\' && p[1])
- {
- if (tokp) tokp->len++;
- p++;
- i++;
- }
- if (tokp) tokp->len++;
- p++;
- i++;
- }
- ++*toklen;
- if (tokp) ++tokp;
- p++;
- i++;
- continue;
- case '\\':
- case ')':
- if (err_func) (*err_func)(addr, i);
- ++p;
- ++i;
- continue;
- case '<':
- case '>':
- case '@':
- case ',':
- case ';':
- case ':':
- case '.':
- case '[':
- case ']':
- case '%':
- case '!':
- case '?':
- case '=':
- case '/':
-
- if ( (*p == '<' && inbracket) ||
- (*p == '>' && !inbracket))
- {
- if (err_func) (*err_func)(addr, i);
- ++p;
- ++i;
- continue;
- }
-
- if (*p == '<')
- inbracket=1;
-
- if (*p == '>')
- inbracket=0;
-
- if (tokp)
- {
- tokp->token= *p;
- tokp->ptr=p;
- tokp->len=1;
- ++tokp;
- }
- ++*toklen;
-
- if (*p == '<' && p[1] == '>')
- /* Fake a null address */
- {
- if (tokp)
- {
- tokp->token=0;
- tokp->ptr="";
- tokp->len=0;
- ++tokp;
- }
- ++*toklen;
- }
- ++p;
- ++i;
- continue;
- default:
-
- if (tokp)
- {
- tokp->token=0;
- tokp->ptr=p;
- tokp->len=0;
- }
- while (*p && !isspace((int)(unsigned char)*p) && strchr(
- "<>@,;:.[]()%!\"\\?=/", *p) == 0)
- {
- if (tokp) ++tokp->len;
- ++p;
- ++i;
- }
- if (i == 0) /* Idiot check */
- {
- if (err_func) (*err_func)(addr, i);
- if (tokp)
- {
- tokp->token='"';
- tokp->ptr=p;
- tokp->len=1;
- ++tokp;
- }
- ++*toklen;
- ++p;
- ++i;
- continue;
- }
- if (tokp) ++tokp;
- ++*toklen;
- }
- }
-}
-
-static void parseaddr(struct rfc822token *tokens, int ntokens,
- struct rfc822addr *addrs, int *naddrs)
-{
- int flag, j, k;
- struct rfc822token save_token;
-
- *naddrs=0;
-
- while (ntokens)
- {
- int i;
-
- /* atoms (token=0) or quoted strings, followed by a : token
- is a list name. */
-
- for (i=0; i<ntokens; i++)
- if (tokens[i].token && tokens[i].token != '"')
- break;
- if (i < ntokens && tokens[i].token == ':')
- {
- ++i;
- if (addrs)
- {
- addrs->tokens=0;
- addrs->name=i ? tokens:0;
- for (j=1; j<i; j++)
- addrs->name[j-1].next=addrs->name+j;
- if (i)
- addrs->name[i-1].next=0;
- addrs++;
- }
- ++*naddrs;
- tokens += i;
- ntokens -= i;
- continue; /* Group=phrase ":" */
- }
-
- /* Spurious commas are skipped, ;s are recorded */
-
- if (tokens->token == ',' || tokens->token == ';')
- {
- if (tokens->token == ';')
- {
- if (addrs)
- {
- addrs->tokens=0;
- addrs->name=tokens;
- addrs->name->next=0;
- addrs++;
- }
- ++*naddrs;
- }
- ++tokens;
- --ntokens;
- continue;
- }
-
- /* If we can find a '<' before the next comma or semicolon,
- we have new style RFC path address */
-
- for (i=0; i<ntokens && tokens[i].token != ';' &&
- tokens[i].token != ',' &&
- tokens[i].token != '<'; i++)
- ;
-
- if (i < ntokens && tokens[i].token == '<')
- {
- int j;
-
- /* Ok -- what to do with the stuff before '>'???
- If it consists exclusively of atoms, leave them alone.
- Else, make them all a quoted string. */
-
- for (j=0; j<i && (tokens[j].token == 0 ||
- tokens[j].token == '('); j++)
- ;
-
- if (j == i)
- {
- if (addrs)
- {
- addrs->name= i ? tokens:0;
- for (k=1; k<i; k++)
- addrs->name[k-1].next=addrs->name+k;
- if (i)
- addrs->name[i-1].next=0;
- }
- }
- else /* Intentionally corrupt the original toks */
- {
- if (addrs)
- {
- tokens->len= tokens[i-1].ptr
- + tokens[i-1].len
- - tokens->ptr;
- /* We know that all the ptrs point
- to parts of the same string. */
- tokens->token='"';
- /* Quoted string. */
- addrs->name=tokens;
- addrs->name->next=0;
- }
- }
-
- /* Any comments in the name part are changed to quotes */
-
- if (addrs)
- {
- struct rfc822token *t;
-
- for (t=addrs->name; t; t=t->next)
- if (t->token == '(')
- t->token='"';
- }
-
- /* Now that's done and over with, see what can
- be done with the <...> part. */
-
- ++i;
- tokens += i;
- ntokens -= i;
- for (i=0; i<ntokens && tokens[i].token != '>'; i++)
- ;
- if (addrs)
- {
- addrs->tokens=i ? tokens:0;
- for (k=1; k<i; k++)
- addrs->tokens[k-1].next=addrs->tokens+k;
- if (i)
- addrs->tokens[i-1].next=0;
- ++addrs;
- }
- ++*naddrs;
- tokens += i;
- ntokens -= i;
- if (ntokens) /* Skip the '>' token */
- {
- --ntokens;
- ++tokens;
- }
- continue;
- }
-
- /* Ok - old style address. Assume the worst */
-
- /* Try to figure out where the address ends. It ends upon:
- a comma, semicolon, or two consecutive atoms. */
-
- flag=0;
- for (i=0; i<ntokens && tokens[i].token != ',' &&
- tokens[i].token != ';'; i++)
- {
- if (tokens[i].token == '(') continue;
- /* Ignore comments */
- if (tokens[i].token == 0 || tokens[i].token == '"')
- /* Atom */
- {
- if (flag) break;
- flag=1;
- }
- else flag=0;
- }
- if (i == 0) /* Must be spurious comma, or something */
- {
- ++tokens;
- --ntokens;
- continue;
- }
-
- if (addrs)
- {
- addrs->name=0;
- }
-
- /* Ok, now get rid of embedded comments in the address.
- Consider the last comment to be the real name */
-
- if (addrs)
- {
-
- save_token.ptr=0;
- save_token.len=0;
-
- for (j=k=0; j<i; j++)
- {
- if (tokens[j].token == '(')
- {
- save_token=tokens[j];
- continue;
- }
- tokens[k]=tokens[j];
- k++;
- }
-
- if (save_token.ptr)
- {
- tokens[i-1]=save_token;
- addrs->name=tokens+i-1;
- addrs->name->next=0;
- }
- addrs->tokens=k ? tokens:NULL;
- for (j=1; j<k; j++)
- addrs->tokens[j-1].next=addrs->tokens+j;
- if (k)
- addrs->tokens[k-1].next=0;
- ++addrs;
- }
- ++*naddrs;
- tokens += i;
- ntokens -= i;
- }
-}
-
-static void print_token(const struct rfc822token *token,
- void (*print_func)(char, void *), void *ptr)
-{
- const char *p;
- int n;
-
- if (token->token == 0 || token->token == '(')
- {
- for (n=token->len, p=token->ptr; n; --n, ++p)
- (*print_func)(*p, ptr);
- return;
- }
-
- if (token->token != '"')
- {
- (*print_func)(token->token, ptr);
- return;
- }
-
- (*print_func)('"', ptr);
- n=token->len;
- p=token->ptr;
- while (n)
- {
- if (*p == '"' || (*p == '\\' && n == 1)) (*print_func)('\\', ptr);
- if (*p == '\\' && n > 1)
- {
- (*print_func)('\\', ptr);
- ++p;
- --n;
- }
- (*print_func)(*p++, ptr);
- --n;
- }
- (*print_func)('"', ptr);
-}
-
-void mailparse_rfc822tok_print(const struct rfc822token *token,
- void (*print_func)(char, void *), void *ptr)
-{
- int prev_isatom=0;
- int isatom;
-
- while (token)
- {
- isatom=mailparse_rfc822_is_atom(token->token);
- if (prev_isatom && isatom)
- (*print_func)(' ', ptr);
- print_token(token, print_func, ptr);
- prev_isatom=isatom;
- token=token->next;
- }
-}
-
-void mailparse_rfc822_print(const struct rfc822a *rfcp, void (*print_func)(char, void *),
- void (*print_separator)(const char *s, void *), void *ptr)
-{
- mailparse_rfc822_print_common(rfcp, 0, 0, print_func, print_separator, ptr);
-}
-
-void mailparse_rfc822_print_common(const struct rfc822a *rfcp,
- char *(*decode_func)(const char *, const char *), const char *chset,
- void (*print_func)(char, void *),
- void (*print_separator)(const char *, void *), void *ptr)
-{
- const struct rfc822addr *addrs=rfcp->addrs;
- int naddrs=rfcp->naddrs;
-
- while (naddrs)
- {
- if (addrs->tokens == 0)
- {
- mailparse_rfc822tok_print(addrs->name, print_func, ptr);
- ++addrs;
- --naddrs;
- if (addrs[-1].name && naddrs)
- {
- struct rfc822token *t;
-
- for (t=addrs[-1].name; t && t->next; t=t->next)
- ;
-
- if (t && (t->token == ':' || t->token == ';'))
- (*print_separator)(" ", ptr);
- }
- continue;
- }
- else if (addrs->name && addrs->name->token == '(')
- { /* old style */
- char *p;
-
- mailparse_rfc822tok_print(addrs->tokens, print_func, ptr);
- (*print_func)(' ', ptr);
-
- if (decode_func && (p=mailparse_rfc822_gettok(addrs->name))!=0)
- {
- char *q= (*decode_func)(p, chset);
- char *r;
-
- for (r=q; r && *r; r++)
- (*print_func)( (int)(unsigned char)*r,
- ptr);
- if (q) efree(q);
- efree(p);
- }
- else mailparse_rfc822tok_print(addrs->name, print_func, ptr);
- }
- else
- {
- int print_braces=0;
- char *p;
-
- if (addrs->name)
- {
- if (decode_func &&
- (p=mailparse_rfc822_gettok(addrs->name)) != 0)
- {
- char *q= (*decode_func)(p, chset);
- char *r;
-
- for (r=q; r && *r; r++)
- (*print_func)(
- (int)(unsigned char)*r,
- ptr);
- if (q) efree(q);
- efree(p);
- }
- else mailparse_rfc822tok_print(addrs->name,
- print_func, ptr);
- (*print_func)(' ', ptr);
- print_braces=1;
- }
- else
- {
- struct rfc822token *p;
-
- for (p=addrs->tokens; p && p->next; p=p->next)
- if (mailparse_rfc822_is_atom(p->token) &&
- mailparse_rfc822_is_atom(p->next->token))
- print_braces=1;
- }
- if (print_braces)
- (*print_func)('<', ptr);
- mailparse_rfc822tok_print(addrs->tokens, print_func, ptr);
- if (print_braces)
- {
- (*print_func)('>', ptr);
- }
- }
- ++addrs;
- --naddrs;
- if (naddrs)
- if (addrs->tokens || (addrs->name &&
- mailparse_rfc822_is_atom(addrs->name->token)))
- (*print_separator)(", ", ptr);
- }
-}
-
-void mailparse_rfc822t_free(struct rfc822t *p)
-{
- if (p->tokens) efree(p->tokens);
- efree(p);
-}
-
-void mailparse_rfc822a_free(struct rfc822a *p)
-{
- if (p->addrs) efree(p->addrs);
- efree(p);
-}
-
-void mailparse_rfc822_deladdr(struct rfc822a *rfcp, int index)
-{
- int i;
-
- if (index < 0 || index >= rfcp->naddrs) return;
-
- for (i=index+1; i<rfcp->naddrs; i++)
- rfcp->addrs[i-1]=rfcp->addrs[i];
- if (--rfcp->naddrs == 0)
- {
- efree(rfcp->addrs);
- rfcp->addrs=0;
- }
-}
-
-struct rfc822t *mailparse_rfc822t_alloc(const char *addr,
- void (*err_func)(const char *, int))
-{
- struct rfc822t *p=(struct rfc822t *)emalloc(sizeof(struct rfc822t));
-
- if (!p) return (NULL);
- memset(p, 0, sizeof(*p));
-
- tokenize(addr, NULL, &p->ntokens, err_func);
- p->tokens=p->ntokens ? (struct rfc822token *)
- ecalloc(p->ntokens, sizeof(struct rfc822token)):0;
- if (p->ntokens && !p->tokens)
- {
- mailparse_rfc822t_free(p);
- return (NULL);
- }
- tokenize(addr, p->tokens, &p->ntokens, NULL);
- return (p);
-}
-
-struct rfc822a *mailparse_rfc822a_alloc(struct rfc822t *t)
-{
- struct rfc822a *p=(struct rfc822a *)emalloc(sizeof(struct rfc822a));
-
- if (!p) return (NULL);
- memset(p, 0, sizeof(*p));
-
- parseaddr(t->tokens, t->ntokens, NULL, &p->naddrs);
- p->addrs=p->naddrs ? (struct rfc822addr *)
- ecalloc(p->naddrs, sizeof(struct rfc822addr)):0;
- if (p->naddrs && !p->addrs)
- {
- mailparse_rfc822a_free(p);
- return (NULL);
- }
- parseaddr(t->tokens, t->ntokens, p->addrs, &p->naddrs);
- return (p);
-}
-
-void mailparse_rfc822_praddr(const struct rfc822a *rfcp, int index,
- void (*print_func)(char, void *), void *ptr)
-{
- const struct rfc822addr *addrs;
-
- if (index < 0 || index >= rfcp->naddrs) return;
-
- addrs=rfcp->addrs+index;
- if (addrs->tokens)
- {
- mailparse_rfc822tok_print(addrs->tokens, print_func, ptr);
- (*print_func)('\n', ptr);
- }
-}
-
-void mailparse_rfc822_addrlist(const struct rfc822a *rfcp,
- void (*print_func)(char, void *), void *ptr)
-{
- int i;
-
- for (i=0; i<rfcp->naddrs; i++)
- mailparse_rfc822_praddr(rfcp, i, print_func, ptr);
-}
-
-void mailparse_rfc822_prname(const struct rfc822a *rfcp, int index,
- void (*print_func)(char, void *), void *ptr)
-{
- const struct rfc822addr *addrs;
-
- if (index < 0 || index >= rfcp->naddrs) return;
-
- addrs=rfcp->addrs+index;
-
- if (!addrs->tokens) return;
- mailparse_rfc822_prname_orlist(rfcp, index, print_func, ptr);
-}
-
-void mailparse_rfc822_prname_orlist(const struct rfc822a *rfcp, int index,
- void (*print_func)(char, void *), void *ptr)
-{
- const struct rfc822addr *addrs;
-
- if (index < 0 || index >= rfcp->naddrs) return;
-
- addrs=rfcp->addrs+index;
-
- if (addrs->name)
- {
- struct rfc822token *i;
- int n;
- int prev_isatom=0;
- int isatom=0;
-
- for (i=addrs->name; i; i=i->next, prev_isatom=isatom)
- {
- isatom=mailparse_rfc822_is_atom(i->token);
- if (isatom && prev_isatom)
- (*print_func)(' ', ptr);
-
- if (i->token != '(')
- {
- print_token(i, print_func, ptr);
- continue;
- }
-
- for (n=2; n<i->len; n++)
- (*print_func)(i->ptr[n-1], ptr);
- }
- } else
- mailparse_rfc822tok_print(addrs->tokens, print_func, ptr);
- (*print_func)('\n', ptr);
-}
-
-void mailparse_rfc822_namelist(const struct rfc822a *rfcp,
- void (*print_func)(char, void *), void *ptr)
-{
- int i;
-
- for (i=0; i<rfcp->naddrs; i++)
- mailparse_rfc822_prname(rfcp, i, print_func, ptr);
-}
diff --git a/ext/mailparse/rfc822_getaddr.c b/ext/mailparse/rfc822_getaddr.c
deleted file mode 100644
index 7b9d204e7b..0000000000
--- a/ext/mailparse/rfc822_getaddr.c
+++ /dev/null
@@ -1,99 +0,0 @@
-/* $Id$ */
-/*
- ** Copyright 1998 - 1999 Double Precision, Inc.
- ** See COPYING for distribution information.
- */
-
-#include "php.h"
-#include "php_mailparse.h"
-
-static void cntlen(char c, void *p)
-{
- if (c != '\n')
- ++ *(size_t *)p;
-}
-
-static void saveaddr(char c, void *p)
-{
- if (c != '\n')
- {
- char **cp=(char **)p;
-
- *(*cp)++=c;
- }
-}
-
-char *mailparse_rfc822_getaddr(const struct rfc822a *rfc, int n)
-{
- size_t addrbuflen=0;
- char *addrbuf, *ptr;
-
- mailparse_rfc822_praddr(rfc, n, &cntlen, &addrbuflen);
- if (!(addrbuf=emalloc(addrbuflen+1)))
- return (0);
-
- ptr=addrbuf;
- mailparse_rfc822_praddr(rfc, n, &saveaddr, &ptr);
- addrbuf[addrbuflen]=0;
- return (addrbuf);
-}
-
-char *mailparse_rfc822_getname(const struct rfc822a *rfc, int n)
-{
- char *p, *q;
- size_t addrbuflen=0;
- char *addrbuf, *ptr;
-
- mailparse_rfc822_prname(rfc, n, &cntlen, &addrbuflen);
- if (!(addrbuf=emalloc(addrbuflen+1)))
- return (0);
-
- ptr=addrbuf;
- mailparse_rfc822_prname(rfc, n, &saveaddr, &ptr);
- addrbuf[addrbuflen]=0;
-
- /* Get rid of surrounding quotes */
-
- for (p=q=addrbuf; *p; p++)
- if (*p != '"') *q++=*p;
- *q=0;
- return (addrbuf);
-}
-
-char *mailparse_rfc822_getname_orlist(const struct rfc822a *rfc, int n)
-{
- char *p, *q;
- size_t addrbuflen=0;
- char *addrbuf, *ptr;
-
- mailparse_rfc822_prname_orlist(rfc, n, &cntlen, &addrbuflen);
- if (!(addrbuf=emalloc(addrbuflen+1)))
- return (0);
-
- ptr=addrbuf;
- mailparse_rfc822_prname_orlist(rfc, n, &saveaddr, &ptr);
- addrbuf[addrbuflen]=0;
-
- /* Get rid of surrounding quotes */
-
- for (p=q=addrbuf; *p; p++)
- if (*p != '"') *q++=*p;
- *q=0;
- return (addrbuf);
-}
-
-char *mailparse_rfc822_gettok(const struct rfc822token *t)
-{
- size_t addrbuflen=0;
- char *addrbuf, *ptr;
-
- mailparse_rfc822tok_print(t, &cntlen, &addrbuflen);
-
- if (!(addrbuf=emalloc(addrbuflen+1)))
- return (0);
-
- ptr=addrbuf;
- mailparse_rfc822tok_print(t, &saveaddr, &ptr);
- addrbuf[addrbuflen]=0;
- return (addrbuf);
-}
diff --git a/ext/mailparse/rfc822_getaddrs.c b/ext/mailparse/rfc822_getaddrs.c
deleted file mode 100644
index aa498d4119..0000000000
--- a/ext/mailparse/rfc822_getaddrs.c
+++ /dev/null
@@ -1,92 +0,0 @@
-/* $Id$ */
-/*
-** Copyright 1998 - 1999 Double Precision, Inc.
-** See COPYING for distribution information.
-*/
-
-#include "php.h"
-#include "php_mailparse.h"
-
-static void cntlen(char c, void *p)
-{
- c=c;
- ++ *(size_t *)p;
-}
-
-static void cntlensep(const char *p, void *ptr)
-{
- while (*p) cntlen(*p++, ptr);
-}
-
-static void saveaddr(char c, void *ptr)
-{
- *(*(char **)ptr)++=c;
-}
-
-static void saveaddrsep(const char *p, void *ptr)
-{
- while (*p) saveaddr(*p++, ptr);
-}
-
-char *mailparse_rfc822_getaddrs(const struct rfc822a *rfc)
-{
-size_t addrbuflen=0;
-char *addrbuf, *ptr;
-
- mailparse_rfc822_print(rfc, &cntlen, &cntlensep, &addrbuflen);
- if (!(addrbuf=emalloc(addrbuflen+1)))
- return (0);
-
- ptr=addrbuf;
- mailparse_rfc822_print(rfc, &saveaddr, &saveaddrsep, &ptr);
- addrbuf[addrbuflen]=0;
- return (addrbuf);
-}
-
-static void saveaddrsep_wrap(const char *p, void *ptr)
-{
-int c;
-
- while ((c=*p++) != 0)
- {
- if (c == ' ') c='\n';
- saveaddr(c, ptr);
- }
-}
-
-char *mailparse_rfc822_getaddrs_wrap(const struct rfc822a *rfc, int w)
-{
-size_t addrbuflen=0;
-char *addrbuf, *ptr, *start, *lastnl;
-
- mailparse_rfc822_print(rfc, &cntlen, &cntlensep, &addrbuflen);
- if (!(addrbuf=emalloc(addrbuflen+1)))
- return (0);
-
- ptr=addrbuf;
- mailparse_rfc822_print(rfc, &saveaddr, &saveaddrsep_wrap, &ptr);
- addrbuf[addrbuflen]=0;
-
- for (lastnl=0, start=ptr=addrbuf; *ptr; )
- {
- while (*ptr && *ptr != '\n') ptr++;
- if (ptr-start < w)
- {
- if (lastnl) *lastnl=' ';
- lastnl=ptr;
- if (*ptr) ++ptr;
- }
- else
- {
- if (lastnl)
- start=lastnl+1;
- else
- {
- start=ptr+1;
- if (*ptr) ++ptr;
- }
- lastnl=0;
- }
- }
- return (addrbuf);
-}
diff --git a/ext/mailparse/tests/001.phpt b/ext/mailparse/tests/001.phpt
deleted file mode 100644
index d9cb030cbb..0000000000
--- a/ext/mailparse/tests/001.phpt
+++ /dev/null
@@ -1,12 +0,0 @@
---TEST--
-Check for mailparse presence
---SKIPIF--
-<?php if (!extension_loaded("mailparse")) print "skip"; ?>
---POST--
---GET--
---FILE--
-<?php
-echo "mailparse extension is available";
-?>
---EXPECT--
-mailparse extension is available
diff --git a/ext/mailparse/tests/002.phpt b/ext/mailparse/tests/002.phpt
deleted file mode 100644
index 81f7405260..0000000000
--- a/ext/mailparse/tests/002.phpt
+++ /dev/null
@@ -1,22 +0,0 @@
---TEST--
-Check stream encoding
---SKIPIF--
-<?php if (!extension_loaded("mailparse")) print "skip"; ?>
---POST--
---GET--
---FILE--
-<?php
-$text = <<<EOD
-hello, this is some text=hello.
-EOD;
-$fp = tmpfile();
-fwrite($fp, $text);
-rewind($fp);
-$dest = tmpfile();
-mailparse_stream_encode($fp, $dest, "quoted-printable");
-rewind($dest);
-$data = fread($dest, 2048);
-echo $data;
-?>
---EXPECT--
-hello, this is some text=3Dhello.
diff --git a/ext/mailparse/try.php b/ext/mailparse/try.php
deleted file mode 100755
index ac2a32f1d8..0000000000
--- a/ext/mailparse/try.php
+++ /dev/null
@@ -1,53 +0,0 @@
-<?php
-/*
- * This is a simple email viewer.
- * make sure that $filename points to a file containing an email message and
- * load this page in your browser.
- * You will be able to choose a part to view.
- * */
-
-#$filename = "/home/CLIENTWEB/worlddo/mimetests/namib.rfc822";
-$filename = "/home/CLIENTWEB/worlddo/mimetests/uumsg";
-#$filename = "/home/CLIENTWEB/worlddo/mimetests/segblob.txt";
-#$filename = "yourmessage.txt";
-
-/* parse the message and return a mime message resource */
-$mime = mailparse_msg_parse_file($filename);
-/* return an array of message parts - this contsists of the names of the parts
- * only */
-$struct = mailparse_msg_get_structure($mime);
-
-echo "<table>\n";
-/* print a choice of sections */
-foreach($struct as $st) {
- echo "<tr>\n";
- echo "<td><a href=\"$PHP_SELF?showpart=$st\">$st</a></td>\n";
- /* get a handle on the message resource for a subsection */
- $section = mailparse_msg_get_part($mime, $st);
- /* get content-type, encoding and header information for that section */
- $info = mailparse_msg_get_part_data($section);
- echo "\n";
- echo "<td>" . $info["content-type"] . "</td>\n";
- echo "<td>" . $info["content-disposition"] . "</td>\n";
- echo "<td>" . $info["disposition-filename"] . "</td>\n";
- echo "<td>" . $info["charset"] . "</td>\n";
- echo "</tr>";
-}
-echo "</table>";
-
-/* if we were called to display a part, do so now */
-if ($showpart) {
- /* get a handle on the message resource for the desired part */
- $sec = mailparse_msg_get_part($mime, $showpart);
-
- echo "<table border=1><tr><th>Section $showpart</th></tr><tr><td>";
- ob_start();
- /* extract the part from the message file and dump it to the output buffer
- * */
- mailparse_msg_extract_part_file($sec, $filename);
- $contents = ob_get_contents();
- ob_end_clean();
- /* quote the message for safe display in a browser */
- echo nl2br(htmlentities($contents)) . "</td></tr></table>";;
-}
-?>
diff --git a/ext/mbstring/CREDITS b/ext/mbstring/CREDITS
deleted file mode 100644
index 14b6215f1d..0000000000
--- a/ext/mbstring/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-Multibyte (Japanese) String Functions
-Tsukada Takuya
diff --git a/ext/mbstring/EXPERIMENTAL b/ext/mbstring/EXPERIMENTAL
deleted file mode 100644
index 6443e99646..0000000000
--- a/ext/mbstring/EXPERIMENTAL
+++ /dev/null
@@ -1,5 +0,0 @@
-this extension is experimental,
-its functions may change their names
-or move to extension all together
-so do not rely to much on them
-you have been warned!
diff --git a/ext/mbstring/Makefile.in b/ext/mbstring/Makefile.in
deleted file mode 100644
index 28a5910132..0000000000
--- a/ext/mbstring/Makefile.in
+++ /dev/null
@@ -1,7 +0,0 @@
-# $Id$
-
-LTLIBRARY_NAME = libmbstring.la
-LTLIBRARY_SOURCES = mbfilter_ja.c mbfilter.c mbstring.c
-LTLIBRARY_SHARED_NAME = mbstring.la
-
-include $(top_srcdir)/build/dynlib.mk
diff --git a/ext/mbstring/README_PHP3-i18n-ja b/ext/mbstring/README_PHP3-i18n-ja
deleted file mode 100644
index cac00b82a1..0000000000
--- a/ext/mbstring/README_PHP3-i18n-ja
+++ /dev/null
@@ -1,774 +0,0 @@
-==========================================
- README for I18N Package
-==========================================
-
-o Name and location of package
-
-Name: php-3.0.18-i18n-ja-2
-Location: http://www.happysize.co.jp/techie/php-ja-jp/
- ftp://ftp.happysize.co.jp/php-ja-jp/
- http://php.vdomains.org/
- ftp://ftp.vdomains.org/pub/php-ja-jp/
- http://php.jpnnet.com/
-
-Currently, this I18N version of PHP only adds Japanese support to base
-PHP. It allows you to use Japanese in scripts, as well as conversion
-between various Japanese encodings. It will work perfectly fine with
-ASCII with i18n option enabled. (note: executable is bit larger due
-to UNICODE table). The basic design aproach is to allow for other
-languages to be added in the future. Developers are encourage to join
-us!
-
-For more information on Japanese encodings, please refer to the
-section "Additional Notes."
-
-
-o What is this package?
-
-This package allows you to handle multiple Japanese encodings (SJIS, EUC,
-UTF-8, JIS) in PHP. If you find any bugs in this package, please report
-them to the appropriate mailing list. For now, the PHP-jp mailing list
-is the best place for this.
-
-PHP-jp ML mailto:PHP-jp@sidecar.ics.es.osaka-u.ac.jp
- http://sidecar.ics.es.osaka-u.ac.jp/php-jp/
- (discussions are in Japanese)
-
-
-o Who should use this
-
-Due to lack of documentation, it's not intended for beginners. If
-something goes wrong, be prepared to fix it on your own.
-
-
-o Warranty and Copyright
-
-There is no warranty with this package. Use it at your own risk.
-
-Please refer to the source code for the copyrights. In general, each
-program's copyright is owned by the programmer. Unless you obey the
-copyright holders restrictions, you are not allowed to use it in any
-form.
-
-
-o Redistribution
-
-As described in the source code, this package and the components are
-allowed to be redistributed with certain restrictions.
-
-Due to this package being still in beta, please try to redistribute
-it as an entire package. Please try not to distribute it as a form
-of patch. Because we would prefer to have this package distributed
-as one single package (not patch of patch of patch), avoid releasing
-any patch to this package.
-
-
-o Who made this
-
-A team of volunteers, PHP3 Internationalization, has been contributing
-their free time producing it. Although we are not related to the core
-PHP programmers, we are hoping to have our modifications merged into the
-core distribution in the near future. Thus, we did not call this a
-"Japanese Patch" (or distribution). Our final goal is to have true
-i18nized PHP!
-
-For anyone interested in this project, please drop us a line.
-
-Contact Address:
- phpj-dev@kage.net
- (Discussions are in Japanese, but feel free to write us in English)
-
-Webpage (English and Japanese):
- http://php.jpnnet.com/
-
-Project Outline (Japanese):
- http://www.happysize.co.jp/techie/php-ja-jp/spec.htm
-
-Developers:
- Hironori Sato <satoh@jpnnet.com>
- Shigeru Kanemoto <sgk@happysize.co.jp>
- Tsukada Takuya <tsukada@fminn.nagano.nagano.jp>
- U. Kenkichi <kenkichi@axes.co.jp>
- Tateyama <tateyan@amy.hi-ho.ne.jp>
- Other gracious contributors
-
-
-o Future plans
-
-- fulfilling what's written in outline
-- support for other languages other than Japanese
-- make the character conversion as a library (?)
-- more testing
-
-
-o Special Thanks to
-
-PHP Japanese webpage maintainer, Hirokawa-san
- http://www.cityfujisawa.ne.jp/%7Elouis/apps/phpfi/
-PHP-JP ML's Yamamoto-san
- http://sidecar.ics.es.osaka-u.ac.jp/php-jp/
-Previous jp-patch developers
-
-
-
-==========================================
- Advantages of using I18N package
-==========================================
-
-- allows you to use various character encodings for script files and
- http output
-- distinguish character encoding in POST/GET/COOKIE
-- proper mail output using JIS as body and MIME/Base64/JIS subject
-- if http output's Content-Type is text/html, it will set proper charset
-- stable character encoding conversion
-- multibyte regex
-
-
-
-==========================================
- Installation
-==========================================
-
-o Summary
-
-Add --enable-i18n option when running configure. For your own setup,
-add any other appropriate options as well.
-
-Don't forget to copy php3.ini-dist to desired location.
-(ex. /usr/local/lib/php3.ini)
-
-If you have already installed PHP3, copy all the entries in php3.ini-dist
-which start with "i18n.xxxx" to php3.ini.
-
-
-o configure option
- --enable-i18n
- include i18n features
-
- --enable-mbregex
- include multibyte regex library
- (without i18n enabled, mbregex functions will not function)
-
-
-o creating cgi version
-
- % tar xvzf php-3.0.18-i18n-ja-2.tar.gz
- % cd php-3.0.18-i18n-ja-2
- % ./configure --enable-i18n --enable-mbregex
- % make
-
-
-o creating Apache version (regular module)
-
- % tar xvzf php-3.0.18-i18n-ja-2.tar.gz
- % tar xvzf apache_1.3.x.tar.gz
- % cd apache_1.3.x
- % ./configure
- % cd ../php-3.0.18-i18n-ja-2
- % ./configure --with-apache=../apache_1.3.x --enable-i18n --enable-mbregex
- % make
- % make install
- % cd ../apache_1.3.x
- % ./configure --activate-module=src/modules/php3/libphp3.a
- % make
- % make install
-
-
-o creating Apache DSO version
-
- create DSO capable Apache first
- % tar xvzf apache_1.3.x.tar.gz
- % cd apache-1.3.x
- % ./configure --enable-shared=max
- % make
- % make install
-
- now create php3
- % cd php-3.0.18-i18n-ja-2
- % ./configure --with-apxs=/usr/local/apache/bin/apxs --enable-i18n \
- --enable-mbregex
- % make
- % make install
-
-
-==========================================
- Additional Notes
-==========================================
-
-o Multibyte regex library
-
-From beta4, we have included the multibyte (mb) regex library which comes with
-Ruby. With this addition, you can now use regex in EUC, SJIS and UTF-8
-encoding. To avoid any conflicts with HSREGEX included with Apache,
-each function name has been changed. Therefore, mb regex functions are
-named differently from the original ereg functions in PHP. The character
-encoding used in mb regex is configured in i18n.internal_encoding.
-
-
-o Binary Output
-
-If http output encoding is set to other than 'pass', conversion of encoding
-from internal encoding to http output is done automatically. Thus,
-if you prefer to spit out anything in raw binary format, your data
-may be corrupted. In such event, set http_output to 'pass'.
-
-ex.
- <?
- i18n_http_output("pass");
- ...
- echo $the_binary_data_string;
- ?>
-
-
-o Content-Type
-
-Depending on the setting of http_output, PHP will output the proper charset.
-ex. Content-Type: text/html; charset="..."
-
-Be aware of following:
-
-- If you set Content-Type header using header() function, that will
- override the automatic addition of charset.
-- Be cautious when you set i18n_http_output, since if any output is
- made prior to this, proper header may have been sent out to the
- client already.
-
-
-o In the event of trouble
-
-If you find any bugs or trouble, please contact us at the above address.
-It may help us to track the problem if you send us the script as well.
-
-If you encounter any memory related error such as segmentation violation,
-add --enable-debug when you run configure. This will give you more
-detail information on where error has occurred. The error is stored
-in the server log or regular http output in CGI mode.
-
-
-o About Japanese encodings
-
-Due to historical reason, there are multiple character encodings used
-for Japanese. The most common encodings are: SJIS, EUC, JIS, and UTF-8.
-Here are (very) brief description of them:
-
-EUC
- commonly used in UNIX environment
- 8bit-8bit combo
- always >=0x80
-
-SJIS
- commonly used in Mac or PCs
- similar to EUC
- mostly 8bit-8bit (some 8bit-7bit)
- mostly >=0x80
- there are some halfwidth (size of ASCII) multibytes
-
-JIS
- commonly used in 7bit environment (nntp and smtp)
- starts with escaping char, \033 and a few more characters
-
-UTF-8
- 16bit+ encoding
- defines many languages existing in this world
- see http://www.unicode.org/ for more detail
-
-Because of having all these character encodings, PHP needs to translate
-between these encodings on the fly. Also, the addition of the mb regex
-library allows you to handle mb strings without fear of getting mb char
-chopped in half.
-
-Since Japanese is not the only language with multiple encodings, we
-encourage other developers to modify our code to suit your needs. We
-definitely need people to work with Korean, Chinese (both traditional
-and simplified), and Russian. Let us know if you are interested in
-this project!
-
-
-
-==========================================
- php3.ini setting
-==========================================
-
-The following init options will allow you to change the default settings.
-Define these settings in the global section of php3.ini.
-
-All keywords are case-insensitive.
-
-o Encoding naming
-
- For each encoding, there are three names: standarized, alias, MIME
-
- - UTF-8
- standard: UTF-8
- alias: N/A
- mime: UTF-8
-
- - ASCII
- standard: ASCII
- alias: N/A
- mime: US-ASCII
-
- - Japanese EUC
- standard: EUC-JP
- alias: EUC, EUC_JP, eucJP, x-euc-jp
- mime: EUC-JP
-
- - Shift JIS
- standard: SJIS
- alias: x-sjis, MS_Kanji
- mime: Shift_JIS
-
- - JIS
- standard: JIS
- alias: N/A
- mime: ISO-2022-JP
-
- - Quoted-Printable
- standard: Quoted-Printable
- alias: qprint
- mime: N/A
-
- - BASE64
- standard: BASE64
- alias: N/A
- mime: N/A
-
- - no conversion
- standard: pass
- alias: none
- mime: N/A
-
- - auto encoding detection
- standard: auto
- alias: unknown
- mime: N/A
-
- * N/A - Not Applicapable
-
-o i18n.http_output - default http output encoding
-
- i18n.http_output = EUC-JP|SJIS|JIS|UTF-8|pass
- EUC-JP : EUC
- SJIS: SJIS
- JIS : JIS
- UTF-8: UTF-8
- pass: no conversion
-
- The default is pass (internal encoding is used)
- It can be re-configured on the fly using i18n_http_output().
-
-
-o i18n.internal_encoding - internal encoding
-
- i18n.internal_encoding = EUC-JP|SJIS|UTF-8
- EUC-JP : EUC
- SJIS: SJIS
- UTF-8: UTF-8
-
- The default is EUC-JP.
-
- PHP parser is designed based on using ISO-8859-1. For other
- encodings, following conditions have to be satisfied in order
- to use them:
- - per byte encoding
- - single byte charactor in range of 00h-7fh which is compatible
- with ASCII
- - multibyte without 00h-7fh
- In case of Japanese, EUC-JP and UTF-8 are the only encoding that
- meets this criteria.
-
- If i18n.internal_encoding and i18n.http_output differs, conversion
- takes place at the time of output. If you convert any data within
- PHP scripts to URL encoding, BASE64 or Quoted-Printable, encoding
- stays as defined in i18n.internal_encoding. Thus, if you would
- prefer to encode in compliance with i18n.http_output, you need
- to manually convert encoding.
-
- ex. $str = urlencode( i18n_convert($str, i18n_http_output()) );
-
- Encoding such as ISO-2022-** and HZ encoding which uses escape
- sequences can not be used as internal encoding. If used, they
- result in following errors:
- - parser pukes funky error
- - magic_quotes_*** breaks encoding (SJIS may have similar problem)
- - string manipulation and regex will malfunction
-
-
-o i18n.script_encoding - script encoding
-
- i18n.script_encoding = auto|EUC-JP|SJIS|JIS|UTF-8
- auto: automatic
- EUC-JP : EUC
- SJIS: SJIS
- JIS : JIS
- UTF-8: UTF-8
-
- The default is auto.
- The script's encoding is converted to i18n.internal_encoding before
- entering the script parser.
-
- Be aware that auto detection may fail under some conditions.
- For best auto detection, add multibyte charactor at begining of
- script.
-
-
-o i18n.http_input - handling of http input (GET/POST/COOKIE)
-
- i18n.http_input = pass|auto
- auto: auto conversion
- pass: no conversion
-
- The default is auto.
- If set to pass, no conversion will take place.
- If set to auto, it will automatically detect the encoding. If
- detection is successful, it will convert to the proper internal
- encoding. If not, it will assume the input as defined in
- i18n.http_input_default.
-
-o i18n.http_input_default - default http input encoding
-
- i18n.http_input_default = pass|EUC-JP|SJIS|JIS|UTF-8
- pass: no conversion
- EUC-JP : EUC
- SJIS: SJIS
- JIS : JIS
- UTF-8: UTF-8
-
- The default is pass.
- This option is only effective as long as i18n.http_input is set to
- auto. If the auto detection fails, this encoding is used as an
- assumption to convert the http input to the internal encoding.
- If set to pass, no conversion will take place.
-
-o sample settings
-
- 1) For most flexibility, we recommend using following example.
- i18n.http_output = SJIS
- i18n.internal_encoding = EUC-JP
- i18n.script_encoding = auto
- i18n.http_input = auto
- i18n.http_input_default = SJIS
-
- 2) To avoid unexpected encoding problems, try these:
-
- i18n.http_output = pass
- i18n.internal_encoding = EUC-JP
- i18n.script_encoding = pass
- i18n.http_input = pass
- i18n.http_input_default = pass
-
-
-
-==========================================
- PHP functions
-==========================================
-
-The following describes the additional PHP functions.
-
-All keywords are case-insensitive.
-
-o i18n_http_output(encoding)
-o encoding = i18n_http_output()
-
- This will set the http output encoding. Any output following this
- function will be controlled by this function. If no argument is given,
- the current http output encode setting is returned.
-
- encodings
- EUC-JP : EUC
- SJIS: SJIS
- JIS : JIS
- UTF-8: UTF-8
- pass: no conversion
-
- NONE is not allowed
-
-
-o encoding = i18n_internal_encoding()
-
- Returns the current internal encoding as a string.
-
- internal encoding
- EUC-JP : EUC
- SJIS: SJIS
- UTF-8: UTF-8
-
-
-o encoding = i18n_http_input()
-
- Returns http input encoding.
-
- encodings
- EUC-JP : EUC
- SJIS: SJIS
- JIS : JIS
- UTF-8: UTF-8
- pass: no conversion (only if i18n.http_input is set to pass)
-
-
-o string = i18n_convert(string, encoding)
- string = i18n_convert(string, encoding, pre-conversion-encoding)
-
- Returns converted string in desired encoding. If
- pre-conversion-encoding is not defined, the given
- string is assumed to be in internal encoding.
-
- encoding
- EUC-JP : EUC
- SJIS: SJIS
- JIS : JIS
- UTF-8: UTF-8
- pass: no conversion
-
- pre-conversion-encoding
- EUC-JP : EUC
- SJIS: SJIS
- JIS : JIS
- UTF-8: UTF-8
- pass: no conversion
- auto: auto detection
-
-
-o encoding = i18n_discover_encoding(string)
-
- Encoding of the given string is returned (as a string).
-
- encoding
- EUC-JP : EUC
- SJIS: SJIS
- JIS : JIS
- UTF-8: UTF-8
- ASCII: ASCII (only 09h, 0Ah, 0Dh, 20h-7Eh)
- pass: unable to determine (text is too short to determine)
- unknown: unknown or possible error
-
-
-o int = mbstrlen(string)
-o int = mbstrlen(string, encoding)
-
- Returns character length of a given string. If no encoding is defined,
- the encoding of string is assumed to be the internal encoding.
-
- encoding
- EUC-JP : EUC
- SJIS: SJIS
- JIS : JIS
- UTF-8: UTF-8
- auto: automatic
-
-
-o int = mbstrpos(string1, string2)
-o int = mbstrpos(string1, string2, start)
-o int = mbstrpos(string1, string2, start, encoding)
-
- Same as strpos. If no encoding is defined, the encoding of string
- is assumed to be the internal encoding.
-
- encoding
- EUC-JP : EUC
- SJIS: SJIS
- JIS : JIS
- UTF-8: UTF-8
-
-
-o int = mbstrrpos(string1, string2)
-o int = mbstrrpos(string1, string2, encoding)
-
- Same as strrpos. If no encoding is defined, the encoding of string
- is assumed to be the internal encoding.
-
- encoding
- EUC-JP : EUC
- SJIS: SJIS
- JIS : JIS
- UTF-8: UTF-8
-
-
-o string = mbsubstr(string, position)
-o string = mbsubstr(string, position, length)
-o string = mbsubstr(string, position, length, encoding)
-
- Same as substr. If no encoding is defined, the encoding of string
- is assumed to be the internal encoding.
-
- encoding
- EUC-JP : EUC
- SJIS: SJIS
- JIS : JIS
- UTF-8: UTF-8
-
-
-o string = mbstrcut(string, position)
-o string = mbstrcut(string, position, length)
-o string = mbstrcut(string, position, length, encoding)
-
- Same as subcut. If position is the 2nd byte of a mb character, it will cut
- from the first byte of that character. It will cut the string without
- chopping a single byte from a mb character. In another words, if you
- set length to 5, you will only get two mb characters. If no encoding
- is defined, the encoding of string is assumed to be the internal encoding.
-
- encoding
- EUC-JP : EUC
- SJIS: SJIS
- JIS : JIS
- UTF-8: UTF-8
-
-
-o string = i18n_mime_header_encode(string)
- MIME encode the string in the format of =?ISO-2022-JP?B?[string]?=.
-
-
-o string = i18n_mime_header_decode(string)
- MIME decodes the string.
-
-
-o string = i18n_ja_jp_hantozen(string)
-o string = i18n_ja_jp_hantozen(string, option)
-o string = i18n_ja_jp_hantozen(string, option, encoding)
-
- Conversion between full width character and halfwidth character.
-
- option
- The following options are allowed. The default is "KV".
- Acronym: FW = fullwidth, HW = halfwidth
-
- "r" : FW alphabet -> HW alphabet
-
- "R" : HW alphabet -> FW alphabet
-
- "n" : FW number -> HW number
-
- "N" : HW number -> FW number
-
- "a" : FW alpha numeric (21h-7Eh) -> HW alpha numeric
-
- "A" : HW alpha numeric (21h-7Eh) -> FW alpha numeric
-
- "k" : FW katakana -> HW katakana
-
- "K" : HW katakana -> FW katakana
-
- "h" : FW hiragana -> HW hiragana
-
- "H" : HW hiragana -> FW katakana
-
- "c" : FW katakana -> FW hiragana
-
- "C" : FW hiragana -> FW katakana
-
- "V" : merge dakuon character. only works with "K" and "H" option
-
- encoding
- If no encoding is defined, the encoding of string is assumed to be
- the internal encoding.
- EUC-JP : EUC
- SJIS: SJIS
- JIS : JIS
- UTF-8: UTF-8
-
-
-int = mbereg(regex_pattern, string, string)
-int = mberegi(regex_pattern, string, string)
- mb version of ereg() and eregi()
-
-
-string = mbereg_replace(regex_pattern, string, string)
-string = mberegi_replace(regex_pattern, string, string)
- mb version of ereg_replace() and eregi_replace()
-
-
-string_array = mbsplit(regex, string, limit)
- mb version of split()
-
-
-
-==========================================
- FAQ
-==========================================
-
-Here, we have gathered some commonly asked questions on PHP-jp mailing
-list.
-
-o To use Japanese in GET method
-
-If you need to assign Japanese text in GET method with argument, such as;
-xxxx.php?data=<Japanese text>, use urlencode function in PHP. If not,
-text may not be passed onto action php properly.
-
-ex: <a href="hoge.php?data=<? echo urlencode($data) ?>">Link</a>
-
-
-o When passing data via GET/POST/COOKIE, \ character sneaks in
-
-When using SJIS as internal encoding, or passed-on data includes '"\,
-PHP automatically inserts escaping character, \. Set magic_quotes_gpc
-in php3.ini from On to Off. An alternative work around to this problem
-is to use StripSlashes().
-
-If $quote_str is in SJIS and you would like to extract Japanese text,
-use ereg_replace as follows:
-
-ereg_replace(sprintf("([%c-%c%c-%c]\\\\)\\\\",0x81,0x9f,0xe0,0xfc),
- "\\1",$quote_str);
-
-This will effectively extract Japanese text out of $quote_str.
-
-
-o Sometimes, encoding detection fails
-
-If i18n_http_input() returns 'pass', it's likely that PHP failed to
-detect whether it's SJIS or EUC. In such case, use <input type=hidden
-value="some Japanese text"> to properly detect the incoming text's
-encoding.
-
-
-
-==========================================
- Japanese Manual
-==========================================
-Translated manual done by "PHP Japanese Manual Project" :
-
-http://www.php.net/manual/ja/manual.php
-
-Starting 3.0.18-i18n-ja, we have removed doc-jp from tarball package.
-
-
-==========================================
- Change Logs
-==========================================
-
-o 2000-10-28, Rui Hirokawa <hirokawa@php.net>
-
-This patch is derived from php-3.0.15-i18n-ja as well as php-3.0.16 by
-Kuwamura applied to original php-3.0.18. It also includes following fixes:
-
-1) allows you to set charset in mail().
-2) fixed mbregex definitions to avoid conflicts with system regex
-3) php3.ini-dist now uses PASS for http_output instead of SJIS
-
-o 2000-11-24, Hironori Sato <satoh@yyplanet.com>
-
-Applied above patched and added detection for gdImageStringTTF in configure.
-Following setups are known to work:
-
-gd-1.3-6, gd-devel-1.3-6, freetype-1.3.1-5, freetype-devel-1.3.1-5
- ImageTTFText($im,$size,$angle,$x1,$y1,$color,"/path/to/font.ttf",
- i18n_convert("ÆüËܸì", "UTF-8"));
- ImageGif($im);
-
-gd-1.7.3-1k1, gd-devel-1.7.3-1k1, freetype-1.3.1-5, freetype-devel-1.3.1-5
- ImageTTFText($im,$size,$angle,$x1,$y1,$color,"/path/to/font.ttf","ÆüËܸì");
- ImagePng($im);
- * i18n_internal_encoding = EUC Ëô¤Ï SJIS
-
-For any gd libraries before 1.6.2, you need to use i18n_convert. For
-gd-1.5.2/3, upgrade to anything above 1.7 to use ImageTTFText without
-using i18n_convert. As long as you have internal_encoding set to EUC or
-SJIS, ImageTTFText should work without mojibake. Again, make sure you
-have i18n_http_output("pass") before calling ImageGif, ImagePng, ImageJpeg!
-
-o 2000-12-09, Rui Hirokawa <hirokawa@php.net>
-
-Fixed mail() which was causing segmentation fault when header was null.
-
diff --git a/ext/mbstring/config.m4 b/ext/mbstring/config.m4
deleted file mode 100644
index 1718a91464..0000000000
--- a/ext/mbstring/config.m4
+++ /dev/null
@@ -1,23 +0,0 @@
-dnl $Id$
-dnl config.m4 for extension mbstring
-
-PHP_ARG_ENABLE(mbstring, whether to enable multibyte string support,
-[ --enable-mbstring Enable multibyte string support])
-
-if test "$PHP_MBSTRING" != "no"; then
- AC_DEFINE(HAVE_MBSTRING,1,[ ])
- PHP_EXTENSION(mbstring, $ext_shared)
-fi
-
-AC_MSG_CHECKING(whether to enable japanese encoding translation)
-AC_ARG_ENABLE(mbstr_enc_trans,
-[ --enable-mbstr-enc-trans Enable japanese encoding translation],[
- if test "$enableval" = "yes" ; then
- AC_DEFINE(MBSTR_ENC_TRANS, 1, [ ])
- AC_MSG_RESULT(yes)
- else
- AC_MSG_RESULT(no)
- fi
-],[
- AC_MSG_RESULT(no)
-])
diff --git a/ext/mbstring/mbfilter.c b/ext/mbstring/mbfilter.c
deleted file mode 100644
index 3984432a31..0000000000
--- a/ext/mbstring/mbfilter.c
+++ /dev/null
@@ -1,8470 +0,0 @@
-/* charset=UTF-8
- * vim: encoding=utf-8:
- * */
-
-/*
- * "streamable kanji code filter and converter"
- *
- * Copyright (c) 1998,1999,2000,2001 HappySize, Inc. All rights reserved.
- *
- * This software is released under the GNU Lesser General Public License.
- * (Version 2.1, February 1999)
- * Please read the following detail of the licence (in japanese).
- *
- * ◆使用許諾æ¡ä»¶â—†
- *
- * ã“ã®ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã¯æ ªå¼ä¼šç¤¾ãƒãƒƒãƒ”ーサイズã«ã‚ˆã£ã¦é–‹ç™ºã•ã‚Œã¾ã—ãŸã€‚æ ªå¼ä¼šç¤¾ãƒãƒƒ
- * ピーサイズã¯ã€è‘—作権法ãŠã‚ˆã³ä¸‡å›½è‘—作権æ¡ç´„ã®å®šã‚ã«ã‚ˆã‚Šã€ã“ã®ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã«é–¢
- * ã™ã‚‹ã™ã¹ã¦ã®æ¨©åˆ©ã‚’ç•™ä¿ã™ã‚‹æ¨©åˆ©ã‚’æŒã¡ã€ã“ã“ã«è¡Œä½¿ã—ã¾ã™ã€‚æ ªå¼ä¼šç¤¾ãƒãƒƒãƒ”ーサイ
- * ズã¯ä»¥ä¸‹ã«æ˜Žè¨˜ã—ãŸæ¡ä»¶ã«å¾“ã£ã¦ã€ã“ã®ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã‚’使用ã™ã‚‹æŽ’ä»–çš„ã§ã¯ãªã„権利
- * ã‚’ãŠå®¢æ§˜ã«è¨±è«¾ã—ã¾ã™ã€‚何人ãŸã‚Šã¨ã‚‚ã€ä»¥ä¸‹ã®æ¡ä»¶ã«åã—ã¦ã“ã®ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã‚’使用
- * ã™ã‚‹ã“ã¨ã¯ã§ãã¾ã›ã‚“。
- *
- * ã“ã®ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã‚’「GNU Lesser General Public License (Version 2.1, February
- * 1999)ã€ã«ç¤ºã•ã‚ŒãŸæ¡ä»¶ã§ä½¿ç”¨ã™ã‚‹ã“ã¨ã‚’ã€å…¨ã¦ã®æ–¹ã«è¨±è«¾ã—ã¾ã™ã€‚「GNU Lesser
- * General Public Licenseã€ã‚’満ãŸã•ãªã„使用ã«ã¯ã€æ ªå¼ä¼šç¤¾ãƒãƒƒãƒ”ーサイズã‹ã‚‰æ›¸é¢
- * ã«ã‚ˆã‚‹è¨±è«¾ã‚’å¾—ã‚‹å¿…è¦ãŒã‚ã‚Šã¾ã™ã€‚
- *
- * 「GNU Lesser General Public Licenseã€ã®å…¨æ–‡ã¯ä»¥ä¸‹ã®ã‚¦ã‚§ãƒ–ページã‹ã‚‰å–å¾—ã§ã
- * ã¾ã™ã€‚「GNU Lesser General Public Licenseã€ã¨ã¯ã€ã“ã‚Œã¾ã§Library General
- * Public Licenseã¨å‘¼ã°ã‚Œã¦ã„ãŸã‚‚ã®ã§ã™ã€‚
- * http://www.gnu.org/ --- GNUウェブサイト
- * http://www.gnu.org/copyleft/lesser.html --- ライセンス文é¢
- * ã“ã®ãƒ©ã‚¤ã‚»ãƒ³ã‚¹ã®å†…容ãŒã‚ã‹ã‚‰ãªã„æ–¹ã€å®ˆã‚Œãªã„æ–¹ã«ã¯ä½¿ç”¨ã‚’許諾ã—ã¾ã›ã‚“。
- *
- * ã—ã‹ã—ãªãŒã‚‰ã€å½“社ã¨GNUプロジェクトã¨ã®ç‰¹å®šã®é–¢ä¿‚を示唆ã¾ãŸã¯ä¸»å¼µã™ã‚‹ã‚‚ã®ã§
- * ã¯ã‚ã‚Šã¾ã›ã‚“。
- *
- * â—†ä¿è¨¼å†…容◆
- *
- * ã“ã®ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã¯ã€æœŸå¾…ã•ã‚ŒãŸå‹•ä½œãƒ»æ©Ÿèƒ½ãƒ»æ€§èƒ½ã‚’æŒã¤ã“ã¨ã‚’目標ã¨ã—ã¦è¨­è¨ˆã•ã‚Œ
- * 開発ã•ã‚Œã¦ã„ã¾ã™ãŒã€ã“れをä¿è¨¼ã™ã‚‹ã‚‚ã®ã§ã¯ã‚ã‚Šã¾ã›ã‚“。ã“ã®ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã¯ã€Œã“
- * ã®ã¾ã¾ã€ã®çŠ¶æ…‹ã§æä¾›ã•ã‚Œã¦ãŠã‚Šã€ãŸã¨ãˆã°ã“ã®ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã®æœ‰ç”¨æ€§ãªã„ã—特定ã®
- * 目的ã«åˆè‡´ã™ã‚‹ã“ã¨ã¨ã„ã£ãŸã€ä½•ã‚‰ã‹ã®ä¿è¨¼å†…容ãŒã€æ˜Žç¤ºã•ã‚ŒãŸã‚Šæš—é»™ã«ç¤ºã•ã‚Œã¦ã„
- * ã‚‹å ´åˆã§ã‚ã£ã¦ã‚‚ã€ãã®ä¿è¨¼ã¯ç„¡åŠ¹ã§ã™ã€‚ã“ã®ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã‚’使用ã—ãŸçµæžœãªã„ã—使
- * 用ã—ãªã‹ã£ãŸçµæžœã«ã‚ˆã£ã¦ã€ç›´æŽ¥ã‚ã‚‹ã„ã¯é–“接ã«å—ã‘ãŸèº«ä½“çš„ãªå‚·å®³ã€è²¡ç”£ä¸Šã®æ害
- * ã€ãƒ‡ãƒ¼ã‚¿ã®æ失ã‚ã‚‹ã„ã¯ãã®ä»–ã®å…¨ã¦ã®æ害ã«ã¤ã„ã¦ã¯ã€ãã®æ害ã®å¯èƒ½æ€§ãŒä½¿ç”¨è€…
- * ã€å½“社ã‚ã‚‹ã„ã¯ç¬¬ä¸‰è€…ã«ã‚ˆã£ã¦è­¦å‘Šã•ã‚Œã¦ã„ãŸå ´åˆã§ã‚ã£ã¦ã‚‚ã€å½“社ã¯ãã®æ害ã®è³ 
- * å„ŸãŠã‚ˆã³è£œå¡«ã‚’è¡Œã„ã¾ã›ã‚“。ã“ã®è¦å®šã¯ä»–ã®å…¨ã¦ã®ã€æ›¸é¢ä¸Šã¾ãŸã¯æ›¸é¢ã«ç„¡ã„ä¿è¨¼ãƒ»
- * 契約・è¦å®šã«å„ªå…ˆã—ã¾ã™ã€‚
- *
- * ◆著作権者ã®é€£çµ¡å…ˆãŠã‚ˆã³ä½¿ç”¨æ¡ä»¶ã«ã¤ã„ã¦ã®å•ã„åˆã‚ã›å…ˆâ—†
- *
- * 〒102-0073
- * æ±äº¬éƒ½åƒä»£ç”°åŒºä¹æ®µåŒ—1-13-5日本地所第一ビル4F
- * æ ªå¼ä¼šç¤¾ãƒãƒƒãƒ”ーサイズ
- * Phone: 03-3512-3655, Fax: 03-3512-3656
- * Email: sales@happysize.co.jp
- * Web: http://happysize.com/
- *
- * ◆著者◆
- *
- * 金本 茂 <sgk@happysize.co.jp>
- *
- * ◆履歴◆
- *
- * 1998/11/10 sgk implementation in C++
- * 1999/4/25 sgk Cã§æ›¸ããªãŠã—。
- * 1999/4/26 sgk 入力フィルタを実装。漢字コードを推定ã—ãªãŒã‚‰ãƒ•ã‚£ãƒ«ã‚¿ã‚’追加。
- * 1999/6/?? Unicodeサãƒãƒ¼ãƒˆã€‚
- * 1999/6/22 sgk ライセンスをLGPLã«å¤‰æ›´ã€‚
- *
- */
-
-/*
- * Unicode support
- *
- * Portions copyright (c) 1999,2000,2001 by the PHP3 internationalization team.
- * All rights reserved.
- *
- */
-
-/* $Id$ */
-
-
-#include <stdlib.h>
-#include "mbfilter.h"
-#include "mbfilter_ja.h"
-#include "zend.h"
-
-#ifdef PHP_WIN32
-#include "win95nt.h"
-#endif
-
-#define mbfl_malloc emalloc
-#define mbfl_realloc erealloc
-#define mbfl_calloc ecalloc
-#define mbfl_free efree
-
-#define mbfl_pmalloc malloc
-#define mbfl_prealloc realloc
-#define mbfl_pfree free
-
-/* unicode table */
-extern const unsigned short iso8859_2_ucs_table[];
-extern const unsigned short iso8859_3_ucs_table[];
-extern const unsigned short iso8859_4_ucs_table[];
-extern const unsigned short iso8859_5_ucs_table[];
-extern const unsigned short iso8859_6_ucs_table[];
-extern const unsigned short iso8859_7_ucs_table[];
-extern const unsigned short iso8859_8_ucs_table[];
-extern const unsigned short iso8859_9_ucs_table[];
-extern const unsigned short iso8859_10_ucs_table[];
-extern const unsigned short iso8859_13_ucs_table[];
-extern const unsigned short iso8859_14_ucs_table[];
-extern const unsigned short iso8859_15_ucs_table[];
-
-/* charactor property table */
-#define MBFL_CHP_CTL 0x01
-#define MBFL_CHP_DIGIT 0x02
-#define MBFL_CHP_UALPHA 0x04
-#define MBFL_CHP_LALPHA 0x08
-#define MBFL_CHP_MMHQENC 0x10 /* must Q-encoding in MIME Header encoded-word */
-#define MBFL_CHP_MSPECIAL 0x20 /* RFC822 Special characters */
-
-extern const unsigned char mbfl_charprop_table[];
-
-
-/* language structure */
-static const char *mbfl_language_uni_aliases[] = {"universal", "none", NULL};
-
-static mbfl_language mbfl_language_uni = {
- mbfl_no_language_uni,
- "uni",
- "uni",
- &mbfl_language_uni_aliases,
- mbfl_no_encoding_utf8,
- mbfl_no_encoding_base64,
- mbfl_no_encoding_base64
-};
-
-static mbfl_language mbfl_language_japanese = {
- mbfl_no_language_japanese,
- "Japanese",
- "ja",
- NULL,
- mbfl_no_encoding_2022jp,
- mbfl_no_encoding_base64,
- mbfl_no_encoding_7bit
-};
-
-static mbfl_language mbfl_language_english = {
- mbfl_no_language_english,
- "English",
- "en",
- NULL,
- mbfl_no_encoding_8859_1,
- mbfl_no_encoding_qprint,
- mbfl_no_encoding_8bit
-};
-
-static mbfl_language *mbfl_language_ptr_table[] = {
- &mbfl_language_uni,
- &mbfl_language_japanese,
- &mbfl_language_english,
- NULL
-};
-
-
-/* encoding byte width table */
-static const unsigned char mblen_table_utf8[] = {
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 1, 1
-};
-
-static const unsigned char mblen_table_eucjp[] = { /* 0xA1-0xFE */
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1
-};
-
-static const unsigned char mblen_table_sjis[] = { /* 0x80-0x9f,0xE0-0xFF */
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2
-};
-
-
-/* encoding structure */
-static const char *mbfl_encoding_pass_aliases[] = {"none", NULL};
-
-static mbfl_encoding mbfl_encoding_pass = {
- mbfl_no_encoding_pass,
- "pass",
- NULL,
- &mbfl_encoding_pass_aliases,
- NULL,
- 0
-};
-
-static const char *mbfl_encoding_auto_aliases[] = {"unknown", NULL};
-
-static mbfl_encoding mbfl_encoding_auto = {
- mbfl_no_encoding_auto,
- "auto",
- NULL,
- &mbfl_encoding_auto_aliases,
- NULL,
- 0
-};
-
-static mbfl_encoding mbfl_encoding_wchar = {
- mbfl_no_encoding_wchar,
- "wchar",
- NULL,
- NULL,
- NULL,
- MBFL_ENCTYPE_WCS4BE
-};
-
-static mbfl_encoding mbfl_encoding_byte2be = {
- mbfl_no_encoding_byte2be,
- "byte2be",
- NULL,
- NULL,
- NULL,
- MBFL_ENCTYPE_SBCS
-};
-
-static mbfl_encoding mbfl_encoding_byte2le = {
- mbfl_no_encoding_byte2le,
- "byte2le",
- NULL,
- NULL,
- NULL,
- MBFL_ENCTYPE_SBCS
-};
-
-static mbfl_encoding mbfl_encoding_byte4be = {
- mbfl_no_encoding_byte4be,
- "byte4be",
- NULL,
- NULL,
- NULL,
- MBFL_ENCTYPE_SBCS
-};
-
-static mbfl_encoding mbfl_encoding_byte4le = {
- mbfl_no_encoding_byte4le,
- "byte4le",
- NULL,
- NULL,
- NULL,
- MBFL_ENCTYPE_SBCS
-};
-
-static mbfl_encoding mbfl_encoding_base64 = {
- mbfl_no_encoding_base64,
- "BASE64",
- "BASE64",
- NULL,
- NULL,
- MBFL_ENCTYPE_SBCS
-};
-
-static mbfl_encoding mbfl_encoding_uuencode = {
- mbfl_no_encoding_uuencode,
- "UUENCODE",
- "x-uuencode",
- NULL,
- NULL,
- MBFL_ENCTYPE_SBCS
-};
-
-static const char *mbfl_encoding_qprint_aliases[] = {"qprint", NULL};
-
-static mbfl_encoding mbfl_encoding_qprint = {
- mbfl_no_encoding_qprint,
- "Quoted-Printable",
- "Quoted-Printable",
- &mbfl_encoding_qprint_aliases,
- NULL,
- MBFL_ENCTYPE_SBCS
-};
-
-static mbfl_encoding mbfl_encoding_7bit = {
- mbfl_no_encoding_7bit,
- "7bit",
- "7bit",
- NULL,
- NULL,
- MBFL_ENCTYPE_SBCS
-};
-
-static mbfl_encoding mbfl_encoding_8bit = {
- mbfl_no_encoding_8bit,
- "8bit",
- "8bit",
- NULL,
- NULL,
- MBFL_ENCTYPE_SBCS
-};
-
-static const char *mbfl_encoding_ucs2_aliases[] = {"ISO-10646-UCS-2", "UCS2" , "UNICODE", NULL};
-
-static mbfl_encoding mbfl_encoding_ucs2 = {
- mbfl_no_encoding_ucs2,
- "UCS-2",
- "UCS-2",
- &mbfl_encoding_ucs2_aliases,
- NULL,
- MBFL_ENCTYPE_WCS2BE
-};
-
-static mbfl_encoding mbfl_encoding_ucs2be = {
- mbfl_no_encoding_ucs2be,
- "UCS-2BE",
- "UCS-2BE",
- NULL,
- NULL,
- MBFL_ENCTYPE_WCS2BE
-};
-
-static mbfl_encoding mbfl_encoding_ucs2le = {
- mbfl_no_encoding_ucs2le,
- "UCS-2LE",
- "UCS-2LE",
- NULL,
- NULL,
- MBFL_ENCTYPE_WCS2LE
-};
-
-static const char *mbfl_encoding_ucs4_aliases[] = {"ISO-10646-UCS-4", "UCS4", NULL};
-
-static mbfl_encoding mbfl_encoding_ucs4 = {
- mbfl_no_encoding_ucs4,
- "UCS-4",
- "UCS-4",
- &mbfl_encoding_ucs4_aliases,
- NULL,
- MBFL_ENCTYPE_WCS4BE
-};
-
-static mbfl_encoding mbfl_encoding_ucs4be = {
- mbfl_no_encoding_ucs4be,
- "UCS-4BE",
- "UCS-4BE",
- NULL,
- NULL,
- MBFL_ENCTYPE_WCS4BE
-};
-
-static mbfl_encoding mbfl_encoding_ucs4le = {
- mbfl_no_encoding_ucs4le,
- "UCS-4LE",
- "UCS-4LE",
- NULL,
- NULL,
- MBFL_ENCTYPE_WCS4LE
-};
-
-static const char *mbfl_encoding_utf32_aliases[] = {"utf32", NULL};
-
-static mbfl_encoding mbfl_encoding_utf32 = {
- mbfl_no_encoding_utf32,
- "UTF-32",
- "UTF-32",
- &mbfl_encoding_utf32_aliases,
- NULL,
- MBFL_ENCTYPE_WCS4BE
-};
-
-static mbfl_encoding mbfl_encoding_utf32be = {
- mbfl_no_encoding_utf32be,
- "UTF-32BE",
- "UTF-32BE",
- NULL,
- NULL,
- MBFL_ENCTYPE_WCS4BE
-};
-
-static mbfl_encoding mbfl_encoding_utf32le = {
- mbfl_no_encoding_utf32le,
- "UTF-32LE",
- "UTF-32LE",
- NULL,
- NULL,
- MBFL_ENCTYPE_WCS4LE
-};
-
-static const char *mbfl_encoding_utf16_aliases[] = {"utf16", NULL};
-
-static mbfl_encoding mbfl_encoding_utf16 = {
- mbfl_no_encoding_utf16,
- "UTF-16",
- "UTF-16",
- &mbfl_encoding_utf16_aliases,
- NULL,
- MBFL_ENCTYPE_MWC2BE
-};
-
-static mbfl_encoding mbfl_encoding_utf16be = {
- mbfl_no_encoding_utf16be,
- "UTF-16BE",
- "UTF-16BE",
- NULL,
- NULL,
- MBFL_ENCTYPE_MWC2BE
-};
-
-static mbfl_encoding mbfl_encoding_utf16le = {
- mbfl_no_encoding_utf16le,
- "UTF-16LE",
- "UTF-16LE",
- NULL,
- NULL,
- MBFL_ENCTYPE_MWC2LE
-};
-
-static const char *mbfl_encoding_utf8_aliases[] = {"utf8", NULL};
-
-static mbfl_encoding mbfl_encoding_utf8 = {
- mbfl_no_encoding_utf8,
- "UTF-8",
- "UTF-8",
- &mbfl_encoding_utf8_aliases,
- mblen_table_utf8,
- MBFL_ENCTYPE_MBCS
-};
-
-static const char *mbfl_encoding_utf7_aliases[] = {"utf7", NULL};
-
-static mbfl_encoding mbfl_encoding_utf7 = {
- mbfl_no_encoding_utf7,
- "UTF-7",
- "UTF-7",
- &mbfl_encoding_utf7_aliases,
- NULL,
- MBFL_ENCTYPE_MBCS | MBFL_ENCTYPE_SHFTCODE
-};
-
-static mbfl_encoding mbfl_encoding_utf7imap = {
- mbfl_no_encoding_utf7imap,
- "UTF7-IMAP",
- NULL,
- NULL,
- NULL,
- MBFL_ENCTYPE_MBCS | MBFL_ENCTYPE_SHFTCODE
-};
-
-static mbfl_encoding mbfl_encoding_ascii = {
- mbfl_no_encoding_ascii,
- "ASCII",
- "US-ASCII",
- NULL,
- NULL,
- MBFL_ENCTYPE_SBCS
-};
-
-static const char *mbfl_encoding_euc_jp_aliases[] = {"EUC", "EUC_JP", "eucJP", "x-euc-jp", NULL};
-
-static mbfl_encoding mbfl_encoding_euc_jp = {
- mbfl_no_encoding_euc_jp,
- "EUC-JP",
- "EUC-JP",
- &mbfl_encoding_euc_jp_aliases,
- mblen_table_eucjp,
- MBFL_ENCTYPE_MBCS
-};
-
-static const char *mbfl_encoding_sjis_aliases[] = {"x-sjis", "SHIFT-JIS", NULL};
-
-static mbfl_encoding mbfl_encoding_sjis = {
- mbfl_no_encoding_sjis,
- "SJIS",
- "Shift_JIS",
- &mbfl_encoding_sjis_aliases,
- mblen_table_sjis,
- MBFL_ENCTYPE_MBCS
-};
-
-static const char *mbfl_encoding_eucjp_win_aliases[] = {"eucJP-open", NULL};
-
-static mbfl_encoding mbfl_encoding_eucjp_win = {
- mbfl_no_encoding_eucjp_win,
- "eucJP-win",
- "EUC-JP",
- &mbfl_encoding_eucjp_win_aliases,
- mblen_table_eucjp,
- MBFL_ENCTYPE_MBCS
-};
-
-static const char *mbfl_encoding_sjis_win_aliases[] = {"SJIS-open", "MS_Kanji", "Windows-31J", NULL};
-
-static mbfl_encoding mbfl_encoding_sjis_win = {
- mbfl_no_encoding_sjis_win,
- "SJIS-win",
- "Shift_JIS",
- &mbfl_encoding_sjis_win_aliases,
- mblen_table_sjis,
- MBFL_ENCTYPE_MBCS
-};
-
-static mbfl_encoding mbfl_encoding_jis = {
- mbfl_no_encoding_jis,
- "JIS",
- "ISO-2022-JP",
- NULL,
- NULL,
- MBFL_ENCTYPE_MBCS | MBFL_ENCTYPE_SHFTCODE
-};
-
-static mbfl_encoding mbfl_encoding_2022jp = {
- mbfl_no_encoding_2022jp,
- "ISO-2022-JP",
- "ISO-2022-JP",
- NULL,
- NULL,
- MBFL_ENCTYPE_MBCS | MBFL_ENCTYPE_SHFTCODE
-};
-
-static const char *mbfl_encoding_8859_1_aliases[] = {"ISO_8859-1", "latin1", NULL};
-
-static mbfl_encoding mbfl_encoding_8859_1 = {
- mbfl_no_encoding_8859_1,
- "ISO-8859-1",
- "ISO-8859-1",
- &mbfl_encoding_8859_1_aliases,
- NULL,
- MBFL_ENCTYPE_SBCS
-};
-
-static const char *mbfl_encoding_8859_2_aliases[] = {"ISO_8859-2", "latin2", NULL};
-
-static mbfl_encoding mbfl_encoding_8859_2 = {
- mbfl_no_encoding_8859_2,
- "ISO-8859-2",
- "ISO-8859-2",
- &mbfl_encoding_8859_2_aliases,
- NULL,
- MBFL_ENCTYPE_SBCS
-};
-
-static const char *mbfl_encoding_8859_3_aliases[] = {"ISO_8859-3", "latin3", NULL};
-
-static mbfl_encoding mbfl_encoding_8859_3 = {
- mbfl_no_encoding_8859_3,
- "ISO-8859-3",
- "ISO-8859-3",
- &mbfl_encoding_8859_3_aliases,
- NULL,
- MBFL_ENCTYPE_SBCS
-};
-
-static const char *mbfl_encoding_8859_4_aliases[] = {"ISO_8859-4", "latin4", NULL};
-
-static mbfl_encoding mbfl_encoding_8859_4 = {
- mbfl_no_encoding_8859_4,
- "ISO-8859-4",
- "ISO-8859-4",
- &mbfl_encoding_8859_4_aliases,
- NULL,
- MBFL_ENCTYPE_SBCS
-};
-
-static const char *mbfl_encoding_8859_5_aliases[] = {"ISO_8859-5", "cyrillic", NULL};
-
-static mbfl_encoding mbfl_encoding_8859_5 = {
- mbfl_no_encoding_8859_5,
- "ISO-8859-5",
- "ISO-8859-5",
- &mbfl_encoding_8859_5_aliases,
- NULL,
- MBFL_ENCTYPE_SBCS
-};
-
-static const char *mbfl_encoding_8859_6_aliases[] = {"ISO_8859-6", "arabic", NULL};
-
-static mbfl_encoding mbfl_encoding_8859_6 = {
- mbfl_no_encoding_8859_6,
- "ISO-8859-6",
- "ISO-8859-6",
- &mbfl_encoding_8859_6_aliases,
- NULL,
- MBFL_ENCTYPE_SBCS
-};
-
-static const char *mbfl_encoding_8859_7_aliases[] = {"ISO_8859-7", "greek", NULL};
-
-static mbfl_encoding mbfl_encoding_8859_7 = {
- mbfl_no_encoding_8859_7,
- "ISO-8859-7",
- "ISO-8859-7",
- &mbfl_encoding_8859_7_aliases,
- NULL,
- MBFL_ENCTYPE_SBCS
-};
-
-static const char *mbfl_encoding_8859_8_aliases[] = {"ISO_8859-8", "hebrew", NULL};
-
-static mbfl_encoding mbfl_encoding_8859_8 = {
- mbfl_no_encoding_8859_8,
- "ISO-8859-8",
- "ISO-8859-8",
- &mbfl_encoding_8859_8_aliases,
- NULL,
- MBFL_ENCTYPE_SBCS
-};
-
-static const char *mbfl_encoding_8859_9_aliases[] = {"ISO_8859-9", "latin5", NULL};
-
-static mbfl_encoding mbfl_encoding_8859_9 = {
- mbfl_no_encoding_8859_9,
- "ISO-8859-9",
- "ISO-8859-9",
- &mbfl_encoding_8859_9_aliases,
- NULL,
- MBFL_ENCTYPE_SBCS
-};
-
-static const char *mbfl_encoding_8859_10_aliases[] = {"ISO_8859-10", "latin6", NULL};
-
-static mbfl_encoding mbfl_encoding_8859_10 = {
- mbfl_no_encoding_8859_10,
- "ISO-8859-10",
- "ISO-8859-10",
- &mbfl_encoding_8859_10_aliases,
- NULL,
- MBFL_ENCTYPE_SBCS
-};
-
-static const char *mbfl_encoding_8859_13_aliases[] = {"ISO_8859-13", NULL};
-
-static mbfl_encoding mbfl_encoding_8859_13 = {
- mbfl_no_encoding_8859_13,
- "ISO-8859-13",
- "ISO-8859-13",
- &mbfl_encoding_8859_13_aliases,
- NULL,
- MBFL_ENCTYPE_SBCS
-};
-
-static const char *mbfl_encoding_8859_14_aliases[] = {"ISO_8859-14", "latin8", NULL};
-
-static mbfl_encoding mbfl_encoding_8859_14 = {
- mbfl_no_encoding_8859_14,
- "ISO-8859-14",
- "ISO-8859-14",
- &mbfl_encoding_8859_14_aliases,
- NULL,
- MBFL_ENCTYPE_SBCS
-};
-
-static const char *mbfl_encoding_8859_15_aliases[] = {"ISO_8859-15", NULL};
-
-static mbfl_encoding mbfl_encoding_8859_15 = {
- mbfl_no_encoding_8859_15,
- "ISO-8859-15",
- "ISO-8859-15",
- &mbfl_encoding_8859_15_aliases,
- NULL,
- MBFL_ENCTYPE_SBCS
-};
-
-static mbfl_encoding *mbfl_encoding_ptr_list[] = {
- &mbfl_encoding_pass,
- &mbfl_encoding_auto,
- &mbfl_encoding_wchar,
- &mbfl_encoding_byte2be,
- &mbfl_encoding_byte2le,
- &mbfl_encoding_byte4be,
- &mbfl_encoding_byte4le,
- &mbfl_encoding_base64,
- &mbfl_encoding_uuencode,
- &mbfl_encoding_qprint,
- &mbfl_encoding_7bit,
- &mbfl_encoding_8bit,
- &mbfl_encoding_ucs4,
- &mbfl_encoding_ucs4be,
- &mbfl_encoding_ucs4le,
- &mbfl_encoding_ucs2,
- &mbfl_encoding_ucs2be,
- &mbfl_encoding_ucs2le,
- &mbfl_encoding_utf32,
- &mbfl_encoding_utf32be,
- &mbfl_encoding_utf32le,
- &mbfl_encoding_utf16,
- &mbfl_encoding_utf16be,
- &mbfl_encoding_utf16le,
- &mbfl_encoding_utf8,
- &mbfl_encoding_utf7,
- &mbfl_encoding_utf7imap,
- &mbfl_encoding_ascii,
- &mbfl_encoding_euc_jp,
- &mbfl_encoding_sjis,
- &mbfl_encoding_eucjp_win,
- &mbfl_encoding_sjis_win,
- &mbfl_encoding_jis,
- &mbfl_encoding_2022jp,
- &mbfl_encoding_8859_1,
- &mbfl_encoding_8859_2,
- &mbfl_encoding_8859_3,
- &mbfl_encoding_8859_4,
- &mbfl_encoding_8859_5,
- &mbfl_encoding_8859_6,
- &mbfl_encoding_8859_7,
- &mbfl_encoding_8859_8,
- &mbfl_encoding_8859_9,
- &mbfl_encoding_8859_10,
- &mbfl_encoding_8859_13,
- &mbfl_encoding_8859_14,
- &mbfl_encoding_8859_15,
- NULL
-};
-
-/* forward */
-static void mbfl_filt_conv_common_ctor(mbfl_convert_filter *filter);
-static int mbfl_filt_conv_common_flush(mbfl_convert_filter *filter);
-static void mbfl_filt_conv_common_dtor(mbfl_convert_filter *filter);
-
-static int mbfl_filt_conv_pass(int c, mbfl_convert_filter *filter);
-static int mbfl_filt_conv_wchar_byte2be(int c, mbfl_convert_filter *filter);
-static int mbfl_filt_conv_byte2be_wchar(int c, mbfl_convert_filter *filter);
-static int mbfl_filt_conv_wchar_byte2le(int c, mbfl_convert_filter *filter);
-static int mbfl_filt_conv_byte2le_wchar(int c, mbfl_convert_filter *filter);
-static int mbfl_filt_conv_wchar_byte4be(int c, mbfl_convert_filter *filter);
-static int mbfl_filt_conv_byte4be_wchar(int c, mbfl_convert_filter *filter);
-static int mbfl_filt_conv_wchar_byte4le(int c, mbfl_convert_filter *filter);
-static int mbfl_filt_conv_byte4le_wchar(int c, mbfl_convert_filter *filter);
-static int mbfl_filt_conv_any_7bit(int c, mbfl_convert_filter *filter);
-
-static int mbfl_filt_conv_base64enc(int c, mbfl_convert_filter *filter);
-static int mbfl_filt_conv_base64enc_flush(mbfl_convert_filter *filter);
-static int mbfl_filt_conv_base64dec(int c, mbfl_convert_filter *filter);
-static int mbfl_filt_conv_base64dec_flush(mbfl_convert_filter *filter);
-static int mbfl_filt_conv_uudec(int c, mbfl_convert_filter *filter);
-
-static int mbfl_filt_conv_qprintenc(int c, mbfl_convert_filter *filter);
-static int mbfl_filt_conv_qprintenc_flush(mbfl_convert_filter *filter);
-static int mbfl_filt_conv_qprintdec(int c, mbfl_convert_filter *filter);
-static int mbfl_filt_conv_qprintdec_flush(mbfl_convert_filter *filter);
-
-static int mbfl_filt_conv_ucs4_wchar(int c, mbfl_convert_filter *filter);
-static int mbfl_filt_conv_wchar_ucs4be(int c, mbfl_convert_filter *filter);
-static int mbfl_filt_conv_wchar_ucs4le(int c, mbfl_convert_filter *filter);
-static int mbfl_filt_conv_ucs2_wchar(int c, mbfl_convert_filter *filter);
-static int mbfl_filt_conv_wchar_ucs2be(int c, mbfl_convert_filter *filter);
-static int mbfl_filt_conv_wchar_ucs2le(int c, mbfl_convert_filter *filter);
-static int mbfl_filt_conv_utf16_wchar(int c, mbfl_convert_filter *filter);
-static int mbfl_filt_conv_utf16be_wchar(int c, mbfl_convert_filter *filter);
-static int mbfl_filt_conv_wchar_utf16be(int c, mbfl_convert_filter *filter);
-static int mbfl_filt_conv_utf16le_wchar(int c, mbfl_convert_filter *filter);
-static int mbfl_filt_conv_wchar_utf16le(int c, mbfl_convert_filter *filter);
-static int mbfl_filt_conv_utf8_wchar(int c, mbfl_convert_filter *filter);
-static int mbfl_filt_conv_wchar_utf8(int c, mbfl_convert_filter *filter);
-static int mbfl_filt_conv_utf7_wchar(int c, mbfl_convert_filter *filter);
-static int mbfl_filt_conv_wchar_utf7(int c, mbfl_convert_filter *filter);
-static int mbfl_filt_conv_wchar_utf7_flush(mbfl_convert_filter *filter);
-static int mbfl_filt_conv_utf7imap_wchar(int c, mbfl_convert_filter *filter);
-static int mbfl_filt_conv_wchar_utf7imap(int c, mbfl_convert_filter *filter);
-static int mbfl_filt_conv_wchar_utf7imap_flush(mbfl_convert_filter *filter);
-static int mbfl_filt_conv_wchar_ascii(int c, mbfl_convert_filter *filter);
-
-static int mbfl_filt_conv_wchar_8859_1(int c, mbfl_convert_filter *filter);
-static int mbfl_filt_conv_8859_2_wchar(int c, mbfl_convert_filter *filter);
-static int mbfl_filt_conv_wchar_8859_2(int c, mbfl_convert_filter *filter);
-static int mbfl_filt_conv_8859_3_wchar(int c, mbfl_convert_filter *filter);
-static int mbfl_filt_conv_wchar_8859_3(int c, mbfl_convert_filter *filter);
-static int mbfl_filt_conv_8859_4_wchar(int c, mbfl_convert_filter *filter);
-static int mbfl_filt_conv_wchar_8859_4(int c, mbfl_convert_filter *filter);
-static int mbfl_filt_conv_8859_5_wchar(int c, mbfl_convert_filter *filter);
-static int mbfl_filt_conv_wchar_8859_5(int c, mbfl_convert_filter *filter);
-static int mbfl_filt_conv_8859_6_wchar(int c, mbfl_convert_filter *filter);
-static int mbfl_filt_conv_wchar_8859_6(int c, mbfl_convert_filter *filter);
-static int mbfl_filt_conv_8859_7_wchar(int c, mbfl_convert_filter *filter);
-static int mbfl_filt_conv_wchar_8859_7(int c, mbfl_convert_filter *filter);
-static int mbfl_filt_conv_8859_8_wchar(int c, mbfl_convert_filter *filter);
-static int mbfl_filt_conv_wchar_8859_8(int c, mbfl_convert_filter *filter);
-static int mbfl_filt_conv_8859_9_wchar(int c, mbfl_convert_filter *filter);
-static int mbfl_filt_conv_wchar_8859_9(int c, mbfl_convert_filter *filter);
-static int mbfl_filt_conv_8859_10_wchar(int c, mbfl_convert_filter *filter);
-static int mbfl_filt_conv_wchar_8859_10(int c, mbfl_convert_filter *filter);
-static int mbfl_filt_conv_8859_13_wchar(int c, mbfl_convert_filter *filter);
-static int mbfl_filt_conv_wchar_8859_13(int c, mbfl_convert_filter *filter);
-static int mbfl_filt_conv_8859_14_wchar(int c, mbfl_convert_filter *filter);
-static int mbfl_filt_conv_wchar_8859_14(int c, mbfl_convert_filter *filter);
-static int mbfl_filt_conv_8859_15_wchar(int c, mbfl_convert_filter *filter);
-static int mbfl_filt_conv_wchar_8859_15(int c, mbfl_convert_filter *filter);
-
-static void mbfl_filt_ident_common_ctor(mbfl_identify_filter *filter);
-static void mbfl_filt_ident_common_dtor(mbfl_identify_filter *filter);
-static void mbfl_filt_ident_false_ctor(mbfl_identify_filter *filter);
-static int mbfl_filt_ident_utf8(int c, mbfl_identify_filter *filter);
-static int mbfl_filt_ident_utf7(int c, mbfl_identify_filter *filter);
-static int mbfl_filt_ident_ascii(int c, mbfl_identify_filter *filter);
-static int mbfl_filt_ident_eucjp(int c, mbfl_identify_filter *filter);
-static int mbfl_filt_ident_sjis(int c, mbfl_identify_filter *filter);
-static int mbfl_filt_ident_sjiswin(int c, mbfl_identify_filter *filter);
-static int mbfl_filt_ident_jis(int c, mbfl_identify_filter *filter);
-static int mbfl_filt_ident_2022jp(int c, mbfl_identify_filter *filter);
-static int mbfl_filt_ident_false(int c, mbfl_identify_filter *filter);
-static int mbfl_filt_ident_true(int c, mbfl_identify_filter *filter);
-
-/* convert filter function table */
-static struct mbfl_convert_vtbl vtbl_pass = {
- mbfl_no_encoding_pass,
- mbfl_no_encoding_pass,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_pass,
- mbfl_filt_conv_common_flush };
-
-static struct mbfl_convert_vtbl vtbl_byte2be_wchar = {
- mbfl_no_encoding_byte2be,
- mbfl_no_encoding_wchar,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_byte2be_wchar,
- mbfl_filt_conv_common_flush };
-
-static struct mbfl_convert_vtbl vtbl_wchar_byte2be = {
- mbfl_no_encoding_wchar,
- mbfl_no_encoding_byte2be,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_wchar_byte2be,
- mbfl_filt_conv_common_flush };
-
-static struct mbfl_convert_vtbl vtbl_byte2le_wchar = {
- mbfl_no_encoding_byte2le,
- mbfl_no_encoding_wchar,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_byte2le_wchar,
- mbfl_filt_conv_common_flush };
-
-static struct mbfl_convert_vtbl vtbl_wchar_byte2le = {
- mbfl_no_encoding_wchar,
- mbfl_no_encoding_byte2le,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_wchar_byte2le,
- mbfl_filt_conv_common_flush };
-
-static struct mbfl_convert_vtbl vtbl_byte4be_wchar = {
- mbfl_no_encoding_byte4be,
- mbfl_no_encoding_wchar,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_byte4be_wchar,
- mbfl_filt_conv_common_flush };
-
-static struct mbfl_convert_vtbl vtbl_wchar_byte4be = {
- mbfl_no_encoding_wchar,
- mbfl_no_encoding_byte4be,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_wchar_byte4be,
- mbfl_filt_conv_common_flush };
-
-static struct mbfl_convert_vtbl vtbl_byte4le_wchar = {
- mbfl_no_encoding_byte4le,
- mbfl_no_encoding_wchar,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_byte4le_wchar,
- mbfl_filt_conv_common_flush };
-
-static struct mbfl_convert_vtbl vtbl_wchar_byte4le = {
- mbfl_no_encoding_wchar,
- mbfl_no_encoding_byte4le,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_wchar_byte4le,
- mbfl_filt_conv_common_flush };
-
-static struct mbfl_convert_vtbl vtbl_8bit_b64 = {
- mbfl_no_encoding_8bit,
- mbfl_no_encoding_base64,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_base64enc,
- mbfl_filt_conv_base64enc_flush };
-
-static struct mbfl_convert_vtbl vtbl_b64_8bit = {
- mbfl_no_encoding_base64,
- mbfl_no_encoding_8bit,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_base64dec,
- mbfl_filt_conv_base64dec_flush };
-
-static struct mbfl_convert_vtbl vtbl_uuencode_8bit = {
- mbfl_no_encoding_uuencode,
- mbfl_no_encoding_8bit,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_uudec,
- mbfl_filt_conv_common_flush
-};
-
-
-static struct mbfl_convert_vtbl vtbl_8bit_qprint = {
- mbfl_no_encoding_8bit,
- mbfl_no_encoding_qprint,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_qprintenc,
- mbfl_filt_conv_qprintenc_flush };
-
-static struct mbfl_convert_vtbl vtbl_qprint_8bit = {
- mbfl_no_encoding_qprint,
- mbfl_no_encoding_8bit,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_qprintdec,
- mbfl_filt_conv_qprintdec_flush };
-
-static struct mbfl_convert_vtbl vtbl_8bit_7bit = {
- mbfl_no_encoding_8bit,
- mbfl_no_encoding_7bit,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_any_7bit,
- mbfl_filt_conv_common_flush };
-
-static struct mbfl_convert_vtbl vtbl_7bit_8bit = {
- mbfl_no_encoding_7bit,
- mbfl_no_encoding_8bit,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_pass,
- mbfl_filt_conv_common_flush };
-
-static struct mbfl_convert_vtbl vtbl_ucs4_wchar = {
- mbfl_no_encoding_ucs4,
- mbfl_no_encoding_wchar,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_ucs4_wchar,
- mbfl_filt_conv_common_flush };
-
-static struct mbfl_convert_vtbl vtbl_wchar_ucs4 = {
- mbfl_no_encoding_wchar,
- mbfl_no_encoding_ucs4,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_wchar_ucs4be,
- mbfl_filt_conv_common_flush };
-
-static struct mbfl_convert_vtbl vtbl_ucs4be_wchar = {
- mbfl_no_encoding_ucs4be,
- mbfl_no_encoding_wchar,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_byte4be_wchar,
- mbfl_filt_conv_common_flush };
-
-static struct mbfl_convert_vtbl vtbl_wchar_ucs4be = {
- mbfl_no_encoding_wchar,
- mbfl_no_encoding_ucs4be,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_wchar_ucs4be,
- mbfl_filt_conv_common_flush };
-
-static struct mbfl_convert_vtbl vtbl_ucs4le_wchar = {
- mbfl_no_encoding_ucs4le,
- mbfl_no_encoding_wchar,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_byte4le_wchar,
- mbfl_filt_conv_common_flush };
-
-static struct mbfl_convert_vtbl vtbl_wchar_ucs4le = {
- mbfl_no_encoding_wchar,
- mbfl_no_encoding_ucs4le,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_wchar_ucs4le,
- mbfl_filt_conv_common_flush };
-
-static struct mbfl_convert_vtbl vtbl_ucs2_wchar = {
- mbfl_no_encoding_ucs2,
- mbfl_no_encoding_wchar,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_ucs2_wchar,
- mbfl_filt_conv_common_flush };
-
-static struct mbfl_convert_vtbl vtbl_wchar_ucs2 = {
- mbfl_no_encoding_wchar,
- mbfl_no_encoding_ucs2,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_wchar_ucs2be,
- mbfl_filt_conv_common_flush };
-
-static struct mbfl_convert_vtbl vtbl_ucs2be_wchar = {
- mbfl_no_encoding_ucs2be,
- mbfl_no_encoding_wchar,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_byte2be_wchar,
- mbfl_filt_conv_common_flush };
-
-static struct mbfl_convert_vtbl vtbl_wchar_ucs2be = {
- mbfl_no_encoding_wchar,
- mbfl_no_encoding_ucs2be,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_wchar_ucs2be,
- mbfl_filt_conv_common_flush };
-
-static struct mbfl_convert_vtbl vtbl_ucs2le_wchar = {
- mbfl_no_encoding_ucs2le,
- mbfl_no_encoding_wchar,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_byte2le_wchar,
- mbfl_filt_conv_common_flush };
-
-static struct mbfl_convert_vtbl vtbl_wchar_ucs2le = {
- mbfl_no_encoding_wchar,
- mbfl_no_encoding_ucs2le,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_wchar_ucs2le,
- mbfl_filt_conv_common_flush };
-
-static struct mbfl_convert_vtbl vtbl_utf32_wchar = {
- mbfl_no_encoding_utf32,
- mbfl_no_encoding_wchar,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_ucs4_wchar,
- mbfl_filt_conv_common_flush };
-
-static struct mbfl_convert_vtbl vtbl_wchar_utf32 = {
- mbfl_no_encoding_wchar,
- mbfl_no_encoding_utf32,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_wchar_ucs4be,
- mbfl_filt_conv_common_flush };
-
-static struct mbfl_convert_vtbl vtbl_utf32be_wchar = {
- mbfl_no_encoding_utf32be,
- mbfl_no_encoding_wchar,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_byte4be_wchar,
- mbfl_filt_conv_common_flush };
-
-static struct mbfl_convert_vtbl vtbl_wchar_utf32be = {
- mbfl_no_encoding_wchar,
- mbfl_no_encoding_utf32be,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_wchar_ucs4be,
- mbfl_filt_conv_common_flush };
-
-static struct mbfl_convert_vtbl vtbl_utf32le_wchar = {
- mbfl_no_encoding_utf32le,
- mbfl_no_encoding_wchar,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_byte4le_wchar,
- mbfl_filt_conv_common_flush };
-
-static struct mbfl_convert_vtbl vtbl_wchar_utf32le = {
- mbfl_no_encoding_wchar,
- mbfl_no_encoding_utf32le,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_wchar_ucs4le,
- mbfl_filt_conv_common_flush };
-
-static struct mbfl_convert_vtbl vtbl_utf16_wchar = {
- mbfl_no_encoding_utf16,
- mbfl_no_encoding_wchar,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_utf16_wchar,
- mbfl_filt_conv_common_flush };
-
-static struct mbfl_convert_vtbl vtbl_wchar_utf16 = {
- mbfl_no_encoding_wchar,
- mbfl_no_encoding_utf16,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_wchar_utf16be,
- mbfl_filt_conv_common_flush };
-
-static struct mbfl_convert_vtbl vtbl_utf16be_wchar = {
- mbfl_no_encoding_utf16be,
- mbfl_no_encoding_wchar,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_utf16be_wchar,
- mbfl_filt_conv_common_flush };
-
-static struct mbfl_convert_vtbl vtbl_wchar_utf16be = {
- mbfl_no_encoding_wchar,
- mbfl_no_encoding_utf16be,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_wchar_utf16be,
- mbfl_filt_conv_common_flush };
-
-static struct mbfl_convert_vtbl vtbl_utf16le_wchar = {
- mbfl_no_encoding_utf16le,
- mbfl_no_encoding_wchar,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_utf16le_wchar,
- mbfl_filt_conv_common_flush };
-
-static struct mbfl_convert_vtbl vtbl_wchar_utf16le = {
- mbfl_no_encoding_wchar,
- mbfl_no_encoding_utf16le,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_wchar_utf16le,
- mbfl_filt_conv_common_flush };
-
-static struct mbfl_convert_vtbl vtbl_utf8_wchar = {
- mbfl_no_encoding_utf8,
- mbfl_no_encoding_wchar,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_utf8_wchar,
- mbfl_filt_conv_common_flush };
-
-static struct mbfl_convert_vtbl vtbl_wchar_utf8 = {
- mbfl_no_encoding_wchar,
- mbfl_no_encoding_utf8,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_wchar_utf8,
- mbfl_filt_conv_common_flush };
-
-static struct mbfl_convert_vtbl vtbl_utf7_wchar = {
- mbfl_no_encoding_utf7,
- mbfl_no_encoding_wchar,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_utf7_wchar,
- mbfl_filt_conv_common_flush };
-
-static struct mbfl_convert_vtbl vtbl_wchar_utf7 = {
- mbfl_no_encoding_wchar,
- mbfl_no_encoding_utf7,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_wchar_utf7,
- mbfl_filt_conv_wchar_utf7_flush };
-
-static struct mbfl_convert_vtbl vtbl_utf7imap_wchar = {
- mbfl_no_encoding_utf7imap,
- mbfl_no_encoding_wchar,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_utf7imap_wchar,
- mbfl_filt_conv_common_flush };
-
-static struct mbfl_convert_vtbl vtbl_wchar_utf7imap = {
- mbfl_no_encoding_wchar,
- mbfl_no_encoding_utf7imap,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_wchar_utf7imap,
- mbfl_filt_conv_wchar_utf7imap_flush };
-
-static struct mbfl_convert_vtbl vtbl_ascii_wchar = {
- mbfl_no_encoding_ascii,
- mbfl_no_encoding_wchar,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_pass,
- mbfl_filt_conv_common_flush };
-
-static struct mbfl_convert_vtbl vtbl_wchar_ascii = {
- mbfl_no_encoding_wchar,
- mbfl_no_encoding_ascii,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_wchar_ascii,
- mbfl_filt_conv_common_flush };
-
-static struct mbfl_convert_vtbl vtbl_eucjp_wchar = {
- mbfl_no_encoding_euc_jp,
- mbfl_no_encoding_wchar,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_eucjp_wchar,
- mbfl_filt_conv_common_flush };
-
-static struct mbfl_convert_vtbl vtbl_wchar_eucjp = {
- mbfl_no_encoding_wchar,
- mbfl_no_encoding_euc_jp,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_wchar_eucjp,
- mbfl_filt_conv_common_flush };
-
-static struct mbfl_convert_vtbl vtbl_sjis_wchar = {
- mbfl_no_encoding_sjis,
- mbfl_no_encoding_wchar,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_sjis_wchar,
- mbfl_filt_conv_common_flush };
-
-static struct mbfl_convert_vtbl vtbl_wchar_sjis = {
- mbfl_no_encoding_wchar,
- mbfl_no_encoding_sjis,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_wchar_sjis,
- mbfl_filt_conv_common_flush };
-
-static struct mbfl_convert_vtbl vtbl_jis_wchar = {
- mbfl_no_encoding_jis,
- mbfl_no_encoding_wchar,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_jis_wchar,
- mbfl_filt_conv_common_flush };
-
-static struct mbfl_convert_vtbl vtbl_wchar_jis = {
- mbfl_no_encoding_wchar,
- mbfl_no_encoding_jis,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_wchar_jis,
- mbfl_filt_conv_any_jis_flush };
-
-static struct mbfl_convert_vtbl vtbl_2022jp_wchar = {
- mbfl_no_encoding_2022jp,
- mbfl_no_encoding_wchar,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_jis_wchar,
- mbfl_filt_conv_common_flush };
-
-static struct mbfl_convert_vtbl vtbl_wchar_2022jp = {
- mbfl_no_encoding_wchar,
- mbfl_no_encoding_2022jp,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_wchar_2022jp,
- mbfl_filt_conv_any_jis_flush };
-
-static struct mbfl_convert_vtbl vtbl_eucjpwin_wchar = {
- mbfl_no_encoding_eucjp_win,
- mbfl_no_encoding_wchar,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_eucjpwin_wchar,
- mbfl_filt_conv_common_flush };
-
-static struct mbfl_convert_vtbl vtbl_wchar_eucjpwin = {
- mbfl_no_encoding_wchar,
- mbfl_no_encoding_eucjp_win,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_wchar_eucjpwin,
- mbfl_filt_conv_common_flush };
-
-static struct mbfl_convert_vtbl vtbl_sjiswin_wchar = {
- mbfl_no_encoding_sjis_win,
- mbfl_no_encoding_wchar,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_sjiswin_wchar,
- mbfl_filt_conv_common_flush };
-
-static struct mbfl_convert_vtbl vtbl_wchar_sjiswin = {
- mbfl_no_encoding_wchar,
- mbfl_no_encoding_sjis_win,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_wchar_sjiswin,
- mbfl_filt_conv_common_flush };
-
-static struct mbfl_convert_vtbl vtbl_8859_1_wchar = {
- mbfl_no_encoding_8859_1,
- mbfl_no_encoding_wchar,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_pass,
- mbfl_filt_conv_common_flush };
-
-static struct mbfl_convert_vtbl vtbl_wchar_8859_1 = {
- mbfl_no_encoding_wchar,
- mbfl_no_encoding_8859_1,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_wchar_8859_1,
- mbfl_filt_conv_common_flush };
-
-static struct mbfl_convert_vtbl vtbl_8859_2_wchar = {
- mbfl_no_encoding_8859_2,
- mbfl_no_encoding_wchar,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_8859_2_wchar,
- mbfl_filt_conv_common_flush };
-
-static struct mbfl_convert_vtbl vtbl_wchar_8859_2 = {
- mbfl_no_encoding_wchar,
- mbfl_no_encoding_8859_2,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_wchar_8859_2,
- mbfl_filt_conv_common_flush };
-
-static struct mbfl_convert_vtbl vtbl_8859_3_wchar = {
- mbfl_no_encoding_8859_3,
- mbfl_no_encoding_wchar,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_8859_3_wchar,
- mbfl_filt_conv_common_flush };
-
-static struct mbfl_convert_vtbl vtbl_wchar_8859_3 = {
- mbfl_no_encoding_wchar,
- mbfl_no_encoding_8859_3,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_wchar_8859_3,
- mbfl_filt_conv_common_flush };
-
-static struct mbfl_convert_vtbl vtbl_8859_4_wchar = {
- mbfl_no_encoding_8859_4,
- mbfl_no_encoding_wchar,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_8859_4_wchar,
- mbfl_filt_conv_common_flush };
-
-static struct mbfl_convert_vtbl vtbl_wchar_8859_4 = {
- mbfl_no_encoding_wchar,
- mbfl_no_encoding_8859_4,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_wchar_8859_4,
- mbfl_filt_conv_common_flush };
-
-static struct mbfl_convert_vtbl vtbl_8859_5_wchar = {
- mbfl_no_encoding_8859_5,
- mbfl_no_encoding_wchar,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_8859_5_wchar,
- mbfl_filt_conv_common_flush };
-
-static struct mbfl_convert_vtbl vtbl_wchar_8859_5 = {
- mbfl_no_encoding_wchar,
- mbfl_no_encoding_8859_5,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_wchar_8859_5,
- mbfl_filt_conv_common_flush };
-
-static struct mbfl_convert_vtbl vtbl_8859_6_wchar = {
- mbfl_no_encoding_8859_6,
- mbfl_no_encoding_wchar,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_8859_6_wchar,
- mbfl_filt_conv_common_flush };
-
-static struct mbfl_convert_vtbl vtbl_wchar_8859_6 = {
- mbfl_no_encoding_wchar,
- mbfl_no_encoding_8859_6,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_wchar_8859_6,
- mbfl_filt_conv_common_flush };
-
-static struct mbfl_convert_vtbl vtbl_8859_7_wchar = {
- mbfl_no_encoding_8859_7,
- mbfl_no_encoding_wchar,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_8859_7_wchar,
- mbfl_filt_conv_common_flush };
-
-static struct mbfl_convert_vtbl vtbl_wchar_8859_7 = {
- mbfl_no_encoding_wchar,
- mbfl_no_encoding_8859_7,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_wchar_8859_7,
- mbfl_filt_conv_common_flush };
-
-static struct mbfl_convert_vtbl vtbl_8859_8_wchar = {
- mbfl_no_encoding_8859_8,
- mbfl_no_encoding_wchar,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_8859_8_wchar,
- mbfl_filt_conv_common_flush };
-
-static struct mbfl_convert_vtbl vtbl_wchar_8859_8 = {
- mbfl_no_encoding_wchar,
- mbfl_no_encoding_8859_8,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_wchar_8859_8,
- mbfl_filt_conv_common_flush };
-
-static struct mbfl_convert_vtbl vtbl_8859_9_wchar = {
- mbfl_no_encoding_8859_9,
- mbfl_no_encoding_wchar,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_8859_9_wchar,
- mbfl_filt_conv_common_flush };
-
-static struct mbfl_convert_vtbl vtbl_wchar_8859_9 = {
- mbfl_no_encoding_wchar,
- mbfl_no_encoding_8859_9,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_wchar_8859_9,
- mbfl_filt_conv_common_flush };
-
-static struct mbfl_convert_vtbl vtbl_8859_10_wchar = {
- mbfl_no_encoding_8859_10,
- mbfl_no_encoding_wchar,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_8859_10_wchar,
- mbfl_filt_conv_common_flush };
-
-static struct mbfl_convert_vtbl vtbl_wchar_8859_10 = {
- mbfl_no_encoding_wchar,
- mbfl_no_encoding_8859_10,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_wchar_8859_10,
- mbfl_filt_conv_common_flush };
-
-static struct mbfl_convert_vtbl vtbl_8859_13_wchar = {
- mbfl_no_encoding_8859_13,
- mbfl_no_encoding_wchar,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_8859_13_wchar,
- mbfl_filt_conv_common_flush };
-
-static struct mbfl_convert_vtbl vtbl_wchar_8859_13 = {
- mbfl_no_encoding_wchar,
- mbfl_no_encoding_8859_13,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_wchar_8859_13,
- mbfl_filt_conv_common_flush };
-
-static struct mbfl_convert_vtbl vtbl_8859_14_wchar = {
- mbfl_no_encoding_8859_14,
- mbfl_no_encoding_wchar,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_8859_14_wchar,
- mbfl_filt_conv_common_flush };
-
-static struct mbfl_convert_vtbl vtbl_wchar_8859_14 = {
- mbfl_no_encoding_wchar,
- mbfl_no_encoding_8859_14,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_wchar_8859_14,
- mbfl_filt_conv_common_flush };
-
-static struct mbfl_convert_vtbl vtbl_8859_15_wchar = {
- mbfl_no_encoding_8859_15,
- mbfl_no_encoding_wchar,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_8859_15_wchar,
- mbfl_filt_conv_common_flush };
-
-static struct mbfl_convert_vtbl vtbl_wchar_8859_15 = {
- mbfl_no_encoding_wchar,
- mbfl_no_encoding_8859_15,
- mbfl_filt_conv_common_ctor,
- mbfl_filt_conv_common_dtor,
- mbfl_filt_conv_wchar_8859_15,
- mbfl_filt_conv_common_flush };
-
-
-static struct mbfl_convert_vtbl *mbfl_convert_filter_list[] = {
- &vtbl_utf8_wchar,
- &vtbl_wchar_utf8,
- &vtbl_eucjp_wchar,
- &vtbl_wchar_eucjp,
- &vtbl_sjis_wchar,
- &vtbl_wchar_sjis,
- &vtbl_jis_wchar,
- &vtbl_wchar_jis,
- &vtbl_2022jp_wchar,
- &vtbl_wchar_2022jp,
- &vtbl_eucjpwin_wchar,
- &vtbl_wchar_eucjpwin,
- &vtbl_sjiswin_wchar,
- &vtbl_wchar_sjiswin,
- &vtbl_ascii_wchar,
- &vtbl_wchar_ascii,
- &vtbl_8859_1_wchar,
- &vtbl_wchar_8859_1,
- &vtbl_8859_2_wchar,
- &vtbl_wchar_8859_2,
- &vtbl_8859_3_wchar,
- &vtbl_wchar_8859_3,
- &vtbl_8859_4_wchar,
- &vtbl_wchar_8859_4,
- &vtbl_8859_5_wchar,
- &vtbl_wchar_8859_5,
- &vtbl_8859_6_wchar,
- &vtbl_wchar_8859_6,
- &vtbl_8859_7_wchar,
- &vtbl_wchar_8859_7,
- &vtbl_8859_8_wchar,
- &vtbl_wchar_8859_8,
- &vtbl_8859_9_wchar,
- &vtbl_wchar_8859_9,
- &vtbl_8859_10_wchar,
- &vtbl_wchar_8859_10,
- &vtbl_8859_13_wchar,
- &vtbl_wchar_8859_13,
- &vtbl_8859_14_wchar,
- &vtbl_wchar_8859_14,
- &vtbl_8859_15_wchar,
- &vtbl_wchar_8859_15,
- &vtbl_8bit_b64,
- &vtbl_b64_8bit,
- &vtbl_uuencode_8bit,
- &vtbl_8bit_qprint,
- &vtbl_qprint_8bit,
- &vtbl_8bit_7bit,
- &vtbl_7bit_8bit,
- &vtbl_utf7_wchar,
- &vtbl_wchar_utf7,
- &vtbl_utf7imap_wchar,
- &vtbl_wchar_utf7imap,
- &vtbl_utf16_wchar,
- &vtbl_wchar_utf16,
- &vtbl_utf16be_wchar,
- &vtbl_wchar_utf16be,
- &vtbl_utf16le_wchar,
- &vtbl_wchar_utf16le,
- &vtbl_utf32_wchar,
- &vtbl_wchar_utf32,
- &vtbl_utf32be_wchar,
- &vtbl_wchar_utf32be,
- &vtbl_utf32le_wchar,
- &vtbl_wchar_utf32le,
- &vtbl_ucs4_wchar,
- &vtbl_wchar_ucs4,
- &vtbl_ucs4be_wchar,
- &vtbl_wchar_ucs4be,
- &vtbl_ucs4le_wchar,
- &vtbl_wchar_ucs4le,
- &vtbl_ucs2_wchar,
- &vtbl_wchar_ucs2,
- &vtbl_ucs2be_wchar,
- &vtbl_wchar_ucs2be,
- &vtbl_ucs2le_wchar,
- &vtbl_wchar_ucs2le,
- &vtbl_byte4be_wchar,
- &vtbl_wchar_byte4be,
- &vtbl_byte4le_wchar,
- &vtbl_wchar_byte4le,
- &vtbl_byte2be_wchar,
- &vtbl_wchar_byte2be,
- &vtbl_byte2le_wchar,
- &vtbl_wchar_byte2le,
- &vtbl_pass,
- NULL
-};
-
-
-/* identify filter function table */
-static struct mbfl_identify_vtbl vtbl_identify_ascii = {
- mbfl_no_encoding_ascii,
- mbfl_filt_ident_common_ctor,
- mbfl_filt_ident_common_dtor,
- mbfl_filt_ident_ascii };
-
-static struct mbfl_identify_vtbl vtbl_identify_utf8 = {
- mbfl_no_encoding_utf8,
- mbfl_filt_ident_common_ctor,
- mbfl_filt_ident_common_dtor,
- mbfl_filt_ident_utf8 };
-
-static struct mbfl_identify_vtbl vtbl_identify_utf7 = {
- mbfl_no_encoding_utf7,
- mbfl_filt_ident_common_ctor,
- mbfl_filt_ident_common_dtor,
- mbfl_filt_ident_utf7 };
-
-static struct mbfl_identify_vtbl vtbl_identify_eucjp = {
- mbfl_no_encoding_euc_jp,
- mbfl_filt_ident_common_ctor,
- mbfl_filt_ident_common_dtor,
- mbfl_filt_ident_eucjp };
-
-static struct mbfl_identify_vtbl vtbl_identify_eucjpwin = {
- mbfl_no_encoding_eucjp_win,
- mbfl_filt_ident_common_ctor,
- mbfl_filt_ident_common_dtor,
- mbfl_filt_ident_eucjp };
-
-static struct mbfl_identify_vtbl vtbl_identify_sjis = {
- mbfl_no_encoding_sjis,
- mbfl_filt_ident_common_ctor,
- mbfl_filt_ident_common_dtor,
- mbfl_filt_ident_sjis };
-
-static struct mbfl_identify_vtbl vtbl_identify_sjiswin = {
- mbfl_no_encoding_sjis_win,
- mbfl_filt_ident_common_ctor,
- mbfl_filt_ident_common_dtor,
- mbfl_filt_ident_sjiswin };
-
-static struct mbfl_identify_vtbl vtbl_identify_jis = {
- mbfl_no_encoding_jis,
- mbfl_filt_ident_common_ctor,
- mbfl_filt_ident_common_dtor,
- mbfl_filt_ident_jis };
-
-static struct mbfl_identify_vtbl vtbl_identify_2022jp = {
- mbfl_no_encoding_2022jp,
- mbfl_filt_ident_common_ctor,
- mbfl_filt_ident_common_dtor,
- mbfl_filt_ident_2022jp };
-
-static struct mbfl_identify_vtbl vtbl_identify_8859_1 = {
- mbfl_no_encoding_8859_1,
- mbfl_filt_ident_common_ctor,
- mbfl_filt_ident_common_dtor,
- mbfl_filt_ident_true };
-
-static struct mbfl_identify_vtbl vtbl_identify_8859_2 = {
- mbfl_no_encoding_8859_2,
- mbfl_filt_ident_common_ctor,
- mbfl_filt_ident_common_dtor,
- mbfl_filt_ident_true };
-
-static struct mbfl_identify_vtbl vtbl_identify_8859_3 = {
- mbfl_no_encoding_8859_3,
- mbfl_filt_ident_common_ctor,
- mbfl_filt_ident_common_dtor,
- mbfl_filt_ident_true };
-
-static struct mbfl_identify_vtbl vtbl_identify_8859_4 = {
- mbfl_no_encoding_8859_4,
- mbfl_filt_ident_common_ctor,
- mbfl_filt_ident_common_dtor,
- mbfl_filt_ident_true };
-
-static struct mbfl_identify_vtbl vtbl_identify_8859_5 = {
- mbfl_no_encoding_8859_5,
- mbfl_filt_ident_common_ctor,
- mbfl_filt_ident_common_dtor,
- mbfl_filt_ident_true };
-
-static struct mbfl_identify_vtbl vtbl_identify_8859_6 = {
- mbfl_no_encoding_8859_6,
- mbfl_filt_ident_common_ctor,
- mbfl_filt_ident_common_dtor,
- mbfl_filt_ident_true };
-
-static struct mbfl_identify_vtbl vtbl_identify_8859_7 = {
- mbfl_no_encoding_8859_7,
- mbfl_filt_ident_common_ctor,
- mbfl_filt_ident_common_dtor,
- mbfl_filt_ident_true };
-
-static struct mbfl_identify_vtbl vtbl_identify_8859_8 = {
- mbfl_no_encoding_8859_8,
- mbfl_filt_ident_common_ctor,
- mbfl_filt_ident_common_dtor,
- mbfl_filt_ident_true };
-
-static struct mbfl_identify_vtbl vtbl_identify_8859_9 = {
- mbfl_no_encoding_8859_9,
- mbfl_filt_ident_common_ctor,
- mbfl_filt_ident_common_dtor,
- mbfl_filt_ident_true };
-
-static struct mbfl_identify_vtbl vtbl_identify_8859_10 = {
- mbfl_no_encoding_8859_10,
- mbfl_filt_ident_common_ctor,
- mbfl_filt_ident_common_dtor,
- mbfl_filt_ident_true };
-
-static struct mbfl_identify_vtbl vtbl_identify_8859_13 = {
- mbfl_no_encoding_8859_13,
- mbfl_filt_ident_common_ctor,
- mbfl_filt_ident_common_dtor,
- mbfl_filt_ident_true };
-
-static struct mbfl_identify_vtbl vtbl_identify_8859_14 = {
- mbfl_no_encoding_8859_14,
- mbfl_filt_ident_common_ctor,
- mbfl_filt_ident_common_dtor,
- mbfl_filt_ident_true };
-
-static struct mbfl_identify_vtbl vtbl_identify_8859_15 = {
- mbfl_no_encoding_8859_15,
- mbfl_filt_ident_common_ctor,
- mbfl_filt_ident_common_dtor,
- mbfl_filt_ident_true };
-
-static struct mbfl_identify_vtbl vtbl_identify_false = {
- mbfl_no_encoding_pass,
- mbfl_filt_ident_false_ctor,
- mbfl_filt_ident_common_dtor,
- mbfl_filt_ident_false };
-
-static struct mbfl_identify_vtbl *mbfl_identify_filter_list[] = {
- &vtbl_identify_utf8,
- &vtbl_identify_utf7,
- &vtbl_identify_ascii,
- &vtbl_identify_eucjp,
- &vtbl_identify_sjis,
- &vtbl_identify_eucjpwin,
- &vtbl_identify_sjiswin,
- &vtbl_identify_jis,
- &vtbl_identify_2022jp,
- &vtbl_identify_8859_1,
- &vtbl_identify_8859_2,
- &vtbl_identify_8859_3,
- &vtbl_identify_8859_4,
- &vtbl_identify_8859_5,
- &vtbl_identify_8859_6,
- &vtbl_identify_8859_7,
- &vtbl_identify_8859_8,
- &vtbl_identify_8859_9,
- &vtbl_identify_8859_10,
- &vtbl_identify_8859_13,
- &vtbl_identify_8859_14,
- &vtbl_identify_8859_15,
- &vtbl_identify_false,
- NULL
-};
-
-
-/* language resolver */
-mbfl_language *
-mbfl_name2language(const char *name)
-{
- mbfl_language *language;
- int i, j;
-
- if (name == NULL) {
- return NULL;
- }
-
- i = 0;
- while ((language = mbfl_language_ptr_table[i++]) != NULL){
- if (strcasecmp(language->name, name) == 0) {
- return language;
- }
- }
-
- i = 0;
- while ((language = mbfl_language_ptr_table[i++]) != NULL){
- if (strcasecmp(language->short_name, name) == 0) {
- return language;
- }
- }
-
- /* serch aliases */
- i = 0;
- while ((language = mbfl_language_ptr_table[i++]) != NULL) {
- if (language->aliases != NULL) {
- j = 0;
- while ((*language->aliases)[j] != NULL) {
- if (strcasecmp((*language->aliases)[j], name) == 0) {
- return language;
- }
- j++;
- }
- }
- }
-
- return NULL;
-}
-
-mbfl_language *
-mbfl_no2language(enum mbfl_no_language no_language)
-{
- mbfl_language *language;
- int i;
-
- i = 0;
- while ((language = mbfl_language_ptr_table[i++]) != NULL){
- if (language->no_language == no_language) {
- return language;
- }
- }
-
- return NULL;
-}
-
-enum mbfl_no_language
-mbfl_name2no_language(const char *name)
-{
- mbfl_language *language;
-
- language = mbfl_name2language(name);
- if (language == NULL) {
- return mbfl_no_language_invalid;
- } else {
- return language->no_language;
- }
-}
-
-const char *
-mbfl_no_language2name(enum mbfl_no_language no_language)
-{
- mbfl_language *language;
-
- language = mbfl_no2language(no_language);
- if (language == NULL) {
- return "";
- } else {
- return language->name;
- }
-}
-
-
-
-/* encoding resolver */
-mbfl_encoding *
-mbfl_name2encoding(const char *name)
-{
- mbfl_encoding *encoding;
- int i, j;
-
- if (name == NULL) {
- return NULL;
- }
-
- i = 0;
- while ((encoding = mbfl_encoding_ptr_list[i++]) != NULL){
- if (strcasecmp(encoding->name, name) == 0) {
- return encoding;
- }
- }
-
- /* serch MIME charset name */
- i = 0;
- while ((encoding = mbfl_encoding_ptr_list[i++]) != NULL) {
- if (encoding->mime_name != NULL) {
- if (strcasecmp(encoding->mime_name, name) == 0) {
- return encoding;
- }
- }
- }
-
- /* serch aliases */
- i = 0;
- while ((encoding = mbfl_encoding_ptr_list[i++]) != NULL) {
- if (encoding->aliases != NULL) {
- j = 0;
- while ((*encoding->aliases)[j] != NULL) {
- if (strcasecmp((*encoding->aliases)[j], name) == 0) {
- return encoding;
- }
- j++;
- }
- }
- }
-
- return NULL;
-}
-
-mbfl_encoding *
-mbfl_no2encoding(enum mbfl_no_encoding no_encoding)
-{
- mbfl_encoding *encoding;
- int i;
-
- i = 0;
- while ((encoding = mbfl_encoding_ptr_list[i++]) != NULL){
- if (encoding->no_encoding == no_encoding) {
- return encoding;
- }
- }
-
- return NULL;
-}
-
-enum mbfl_no_encoding
-mbfl_name2no_encoding(const char *name)
-{
- mbfl_encoding *encoding;
-
- encoding = mbfl_name2encoding(name);
- if (encoding == NULL) {
- return mbfl_no_encoding_invalid;
- } else {
- return encoding->no_encoding;
- }
-}
-
-const char *
-mbfl_no_encoding2name(enum mbfl_no_encoding no_encoding)
-{
- mbfl_encoding *encoding;
-
- encoding = mbfl_no2encoding(no_encoding);
- if (encoding == NULL) {
- return "";
- } else {
- return encoding->name;
- }
-}
-
-const char *
-mbfl_no2preferred_mime_name(enum mbfl_no_encoding no_encoding)
-{
- mbfl_encoding *encoding;
-
- encoding = mbfl_no2encoding(no_encoding);
- if (encoding != NULL && encoding->mime_name != NULL && encoding->mime_name[0] != '\0') {
- return encoding->mime_name;
- } else {
- return NULL;
- }
-}
-
-int
-mbfl_is_support_encoding(const char *name)
-{
- mbfl_encoding *encoding;
-
- encoding = mbfl_name2encoding(name);
- if (encoding == NULL) {
- return 0;
- } else {
- return 1;
- }
-}
-
-
-
-/*
- * memory device output functions
- */
-void
-mbfl_memory_device_init(mbfl_memory_device *device, int initsz, int allocsz)
-{
- if (device) {
- device->length = 0;
- device->buffer = (unsigned char *)0;
- if (initsz > 0) {
- device->buffer = (unsigned char *)mbfl_malloc(initsz*sizeof(unsigned char));
- if (device->buffer != NULL) {
- device->length = initsz;
- }
- }
- device->pos= 0;
- if (allocsz > MBFL_MEMORY_DEVICE_ALLOC_SIZE) {
- device->allocsz = allocsz;
- } else {
- device->allocsz = MBFL_MEMORY_DEVICE_ALLOC_SIZE;
- }
- }
-}
-
-void
-mbfl_memory_device_realloc(mbfl_memory_device *device, int initsz, int allocsz)
-{
- unsigned char *tmp;
-
- if (device) {
- if (initsz > device->length) {
- tmp = (unsigned char *)mbfl_realloc((void *)device->buffer, initsz*sizeof(unsigned char));
- if (tmp != NULL) {
- device->buffer = tmp;
- device->length = initsz;
- }
- }
- if (allocsz > MBFL_MEMORY_DEVICE_ALLOC_SIZE) {
- device->allocsz = allocsz;
- } else {
- device->allocsz = MBFL_MEMORY_DEVICE_ALLOC_SIZE;
- }
- }
-}
-
-void
-mbfl_memory_device_clear(mbfl_memory_device *device)
-{
- if (device) {
- if (device->buffer) {
- mbfl_free(device->buffer);
- }
- device->buffer = (unsigned char *)0;
- device->length = 0;
- device->pos = 0;
- }
-}
-
-void
-mbfl_memory_device_reset(mbfl_memory_device *device)
-{
- if (device) {
- device->pos = 0;
- }
-}
-
-void
-mbfl_memory_device_unput(mbfl_memory_device *device)
-{
- if (device->pos > 0) {
- device->pos--;
- }
-}
-
-mbfl_string *
-mbfl_memory_device_result(mbfl_memory_device *device, mbfl_string *result)
-{
- if (device && result) {
- result->len = device->pos;
- mbfl_memory_device_output4('\0', device);
- result->val = device->buffer;
- device->buffer = (unsigned char *)0;
- device->length = 0;
- device->pos= 0;
- if (result->val == NULL) {
- result->len = 0;
- result = NULL;
- }
- } else {
- result = NULL;
- }
-
- return result;
-}
-
-int
-mbfl_memory_device_output(int c, void *data)
-{
- mbfl_memory_device *device = (mbfl_memory_device *)data;
-
- if (device->pos >= device->length) {
- /* reallocate buffer */
- int newlen;
- unsigned char *tmp;
-
- newlen = device->length + device->allocsz;
- tmp = (unsigned char *)mbfl_realloc((void *)device->buffer, newlen*sizeof(unsigned char));
- if (tmp == NULL) {
- return -1;
- }
- device->length = newlen;
- device->buffer = tmp;
- }
-
- device->buffer[device->pos++] = (unsigned char)c;
- return c;
-}
-
-int
-mbfl_memory_device_output2(int c, void *data)
-{
- mbfl_memory_device *device = (mbfl_memory_device *)data;
-
- if ((device->pos + 2) >= device->length) {
- /* reallocate buffer */
- int newlen;
- unsigned char *tmp;
-
- newlen = device->length + device->allocsz;
- tmp = (unsigned char *)mbfl_realloc((void *)device->buffer, newlen*sizeof(unsigned char));
- if (tmp == NULL) {
- return -1;
- }
- device->length = newlen;
- device->buffer = tmp;
- }
-
- device->buffer[device->pos++] = (unsigned char)((c >> 8) & 0xff);
- device->buffer[device->pos++] = (unsigned char)(c & 0xff);
-
- return c;
-}
-
-int
-mbfl_memory_device_output4(int c, void* data)
-{
- mbfl_memory_device *device = (mbfl_memory_device *)data;
-
- if ((device->pos + 4) >= device->length) {
- /* reallocate buffer */
- int newlen;
- unsigned char *tmp;
-
- newlen = device->length + device->allocsz;
- tmp = (unsigned char *)mbfl_realloc((void *)device->buffer, newlen*sizeof(unsigned char));
- if (tmp == NULL) {
- return -1;
- }
- device->length = newlen;
- device->buffer = tmp;
- }
-
- device->buffer[device->pos++] = (unsigned char)((c >> 24) & 0xff);
- device->buffer[device->pos++] = (unsigned char)((c >> 16) & 0xff);
- device->buffer[device->pos++] = (unsigned char)((c >> 8) & 0xff);
- device->buffer[device->pos++] = (unsigned char)(c & 0xff);
-
- return c;
-}
-
-int
-mbfl_memory_device_strcat(mbfl_memory_device *device, const char *psrc)
-{
- int len;
- unsigned char *w;
- const unsigned char *p;
-
- len = 0;
- p = psrc;
- while (*p) {
- p++;
- len++;
- }
-
- if ((device->pos + len) >= device->length) {
- /* reallocate buffer */
- int newlen = device->length + (len + MBFL_MEMORY_DEVICE_ALLOC_SIZE)*sizeof(unsigned char);
- unsigned char *tmp = (unsigned char *)mbfl_realloc((void *)device->buffer, newlen*sizeof(unsigned char));
- if (tmp == NULL) {
- return -1;
- }
- device->length = newlen;
- device->buffer = tmp;
- }
-
- p = psrc;
- w = &device->buffer[device->pos];
- device->pos += len;
- while (len > 0) {
- *w++ = *p++;
- len--;
- }
-
- return len;
-}
-
-int
-mbfl_memory_device_strncat(mbfl_memory_device *device, const char *psrc, int len)
-{
- unsigned char *w;
-
- if ((device->pos + len) >= device->length) {
- /* reallocate buffer */
- int newlen = device->length + len + MBFL_MEMORY_DEVICE_ALLOC_SIZE;
- unsigned char *tmp = (unsigned char *)mbfl_realloc((void *)device->buffer, newlen*sizeof(unsigned char));
- if (tmp == NULL) {
- return -1;
- }
- device->length = newlen;
- device->buffer = tmp;
- }
-
- w = &device->buffer[device->pos];
- device->pos += len;
- while (len > 0) {
- *w++ = *psrc++;
- len--;
- }
-
- return len;
-}
-
-int
-mbfl_memory_device_devcat(mbfl_memory_device *dest, mbfl_memory_device *src)
-{
- int n;
- unsigned char *p, *w;
-
- if ((dest->pos + src->pos) >= dest->length) {
- /* reallocate buffer */
- int newlen = dest->length + src->pos + MBFL_MEMORY_DEVICE_ALLOC_SIZE;
- unsigned char *tmp = (unsigned char *)mbfl_realloc((void *)dest->buffer, newlen*sizeof(unsigned char));
- if (tmp == NULL) {
- return -1;
- }
- dest->length = newlen;
- dest->buffer = tmp;
- }
-
- p = src->buffer;
- w = &dest->buffer[dest->pos];
- n = src->pos;
- dest->pos += n;
- while (n > 0) {
- *w++ = *p++;
- n--;
- }
-
- return n;
-}
-
-void
-mbfl_wchar_device_init(mbfl_wchar_device *device)
-{
- if (device) {
- device->buffer = (unsigned int *)0;
- device->length = 0;
- device->pos= 0;
- device->allocsz = MBFL_MEMORY_DEVICE_ALLOC_SIZE;
- }
-}
-
-void
-mbfl_wchar_device_clear(mbfl_wchar_device *device)
-{
- if (device) {
- if (device->buffer) {
- mbfl_free(device->buffer);
- }
- device->buffer = (unsigned int*)0;
- device->length = 0;
- device->pos = 0;
- }
-}
-
-int
-mbfl_wchar_device_output(int c, void *data)
-{
- mbfl_wchar_device *device = (mbfl_wchar_device *)data;
-
- if (device->pos >= device->length) {
- /* reallocate buffer */
- int newlen;
- unsigned int *tmp;
-
- newlen = device->length + device->allocsz;
- tmp = (unsigned int *)mbfl_realloc((void *)device->buffer, newlen*sizeof(int));
- if (tmp == NULL) {
- return -1;
- }
- device->length = newlen;
- device->buffer = tmp;
- }
-
- device->buffer[device->pos++] = c;
-
- return c;
-}
-
-
-/*
- * string object
- */
-void
-mbfl_string_init(mbfl_string *string)
-{
- if (string) {
- string->no_language = mbfl_no_language_uni;
- string->no_encoding = mbfl_no_encoding_pass;
- string->val = (unsigned char*)0;
- string->len = 0;
- }
-}
-
-void
-mbfl_string_init_set(mbfl_string *string, enum mbfl_no_language no_language, enum mbfl_no_encoding no_encoding)
-{
- if (string) {
- string->no_language = no_language;
- string->no_encoding = no_encoding;
- string->val = (unsigned char*)0;
- string->len = 0;
- }
-}
-
-void
-mbfl_string_clear(mbfl_string *string)
-{
- if (string) {
- if (string->val != (unsigned char*)0) {
- mbfl_free(string->val);
- }
- string->val = (unsigned char*)0;
- string->len = 0;
- }
-}
-
-
-
-/*
- * encoding filter
- */
-#define CK(statement) do { if ((statement) < 0) return (-1); } while (0)
-
-/*
- * commonly used constructor and destructor
- */
-static void
-mbfl_filt_conv_common_ctor(mbfl_convert_filter *filter)
-{
- filter->status = 0;
- filter->cache = 0;
-}
-
-static int
-mbfl_filt_conv_common_flush(mbfl_convert_filter *filter)
-{
- filter->status = 0;
- filter->cache = 0;
- return 0;
-}
-
-static void
-mbfl_filt_conv_common_dtor(mbfl_convert_filter *filter)
-{
- filter->status = 0;
- filter->cache = 0;
-}
-
-static int
-mbfl_filt_conv_pass(int c, mbfl_convert_filter *filter)
-{
- return (*filter->output_function)(c, filter->data);
-}
-
-static int
-mbfl_filt_conv_any_7bit(int c, mbfl_convert_filter *filter)
-{
- if (c >= 0 && c < 0x80) {
- CK((*filter->output_function)(c, filter->data));
- }
- return c;
-}
-
-static int
-mbfl_filt_conv_byte2be_wchar(int c, mbfl_convert_filter *filter)
-{
- int n;
-
- if (filter->status == 0) {
- filter->status = 1;
- n = (c & 0xff) << 8;
- filter->cache = n;
- } else {
- filter->status = 0;
- n = (c & 0xff) | filter->cache;
- CK((*filter->output_function)(n, filter->data));
- }
- return c;
-}
-
-static int
-mbfl_filt_conv_wchar_byte2be(int c, mbfl_convert_filter *filter)
-{
- CK((*filter->output_function)((c >> 8) & 0xff, filter->data));
- CK((*filter->output_function)(c & 0xff, filter->data));
- return c;
-}
-
-static int
-mbfl_filt_conv_byte2le_wchar(int c, mbfl_convert_filter *filter)
-{
- int n;
-
- if (filter->status == 0) {
- filter->status = 1;
- n = c & 0xff;
- filter->cache = n;
- } else {
- filter->status = 0;
- n = ((c & 0xff) << 8) | filter->cache;
- CK((*filter->output_function)(n, filter->data));
- }
- return c;
-}
-
-static int
-mbfl_filt_conv_wchar_byte2le(int c, mbfl_convert_filter *filter)
-{
- CK((*filter->output_function)(c & 0xff, filter->data));
- CK((*filter->output_function)((c >> 8) & 0xff, filter->data));
- return c;
-}
-
-static int
-mbfl_filt_conv_byte4be_wchar(int c, mbfl_convert_filter *filter)
-{
- int n;
-
- if (filter->status == 0) {
- filter->status = 1;
- n = (c & 0xff) << 24;
- filter->cache = n;
- } else if (filter->status == 1) {
- filter->status = 2;
- n = (c & 0xff) << 16;
- filter->cache |= n;
- } else if (filter->status == 2) {
- filter->status = 3;
- n = (c & 0xff) << 8;
- filter->cache |= n;
- } else {
- filter->status = 0;
- n = (c & 0xff) | filter->cache;
- CK((*filter->output_function)(n, filter->data));
- }
- return c;
-}
-
-static int
-mbfl_filt_conv_wchar_byte4be(int c, mbfl_convert_filter *filter)
-{
- CK((*filter->output_function)((c >> 24) & 0xff, filter->data));
- CK((*filter->output_function)((c >> 16) & 0xff, filter->data));
- CK((*filter->output_function)((c >> 8) & 0xff, filter->data));
- CK((*filter->output_function)(c & 0xff, filter->data));
- return c;
-}
-
-static int
-mbfl_filt_conv_byte4le_wchar(int c, mbfl_convert_filter *filter)
-{
- int n;
-
- if (filter->status == 0) {
- filter->status = 1;
- n = (c & 0xff);
- filter->cache = n;
- } else if (filter->status == 1) {
- filter->status = 2;
- n = (c & 0xff) << 8;
- filter->cache |= n;
- } else if (filter->status == 2) {
- filter->status = 3;
- n = (c & 0xff) << 16;
- filter->cache |= n;
- } else {
- filter->status = 0;
- n = ((c & 0xff) << 24) | filter->cache;
- CK((*filter->output_function)(n, filter->data));
- }
- return c;
-}
-
-static int
-mbfl_filt_conv_wchar_byte4le(int c, mbfl_convert_filter *filter)
-{
- CK((*filter->output_function)(c & 0xff, filter->data));
- CK((*filter->output_function)((c >> 8) & 0xff, filter->data));
- CK((*filter->output_function)((c >> 16) & 0xff, filter->data));
- CK((*filter->output_function)((c >> 24) & 0xff, filter->data));
- return c;
-}
-
-
-/* uuencode => any */
-#define UUDEC(c) (char)(((c)-' ')&077)
-static const char * uuenc_begin_text = "begin ";
-enum { uudec_state_ground=0, uudec_state_inbegin,
- uudec_state_until_newline,
- uudec_state_size, uudec_state_a, uudec_state_b, uudec_state_c, uudec_state_d,
- uudec_state_skip_newline};
-static int
-mbfl_filt_conv_uudec(int c, mbfl_convert_filter * filter)
-{
- int n;
-
- switch(filter->status) {
- case uudec_state_ground:
- /* looking for "begin 0666 filename\n" line */
- if (filter->cache == 0 && c == 'b')
- {
- filter->status = uudec_state_inbegin;
- filter->cache = 1; /* move to 'e' */
- }
- else if (c == '\n')
- filter->cache = 0;
- else
- filter->cache++;
- break;
- case uudec_state_inbegin:
- if (uuenc_begin_text[filter->cache++] != c) {
- /* doesn't match pattern */
- filter->status = uudec_state_ground;
- break;
- }
- if (filter->cache == 5)
- {
- /* thats good enough - wait for a newline */
- filter->status = uudec_state_until_newline;
- filter->cache = 0;
- }
- break;
- case uudec_state_until_newline:
- if (c == '\n')
- filter->status = uudec_state_size;
- break;
- case uudec_state_size:
- /* get "size" byte */
- n = UUDEC(c);
- filter->cache = n << 24;
- filter->status = uudec_state_a;
- break;
- case uudec_state_a:
- /* get "a" byte */
- n = UUDEC(c);
- filter->cache |= (n << 16);
- filter->status = uudec_state_b;
- break;
- case uudec_state_b:
- /* get "b" byte */
- n = UUDEC(c);
- filter->cache |= (n << 8);
- filter->status = uudec_state_c;
- break;
- case uudec_state_c:
- /* get "c" byte */
- n = UUDEC(c);
- filter->cache |= n;
- filter->status = uudec_state_d;
- break;
- case uudec_state_d:
- /* get "d" byte */
- {
- int A, B, C, D = UUDEC(c);
- A = (filter->cache >> 16) & 0xff;
- B = (filter->cache >> 8) & 0xff;
- C = (filter->cache) & 0xff;
- n = (filter->cache >> 24) & 0xff;
- if (n-- > 0)
- CK((*filter->output_function)( (A << 2) | (B >> 4), filter->data));
- if (n-- > 0)
- CK((*filter->output_function)( (B << 4) | (C >> 2), filter->data));
- if (n-- > 0)
- CK((*filter->output_function)( (C << 6) | D, filter->data));
- filter->cache = n << 24;
-
- if (n == 0)
- filter->status = uudec_state_skip_newline; /* skip next byte (newline) */
- else
- filter->status = uudec_state_a; /* go back to fetch "A" byte */
- }
- break;
- case uudec_state_skip_newline:
- /* skip newline */
- filter->status = 0;
- }
- return c;
-}
-
-/*
- * any => BASE64
- */
-static const unsigned char mbfl_base64_table[] =
-{
- /* 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', */
- 0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4a,0x4b,0x4c,0x4d,
- /* 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', */
- 0x4e,0x4f,0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5a,
- /* 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', */
- 0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6a,0x6b,0x6c,0x6d,
- /* 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', */
- 0x6e,0x6f,0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7a,
- /* '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '/', '\0' */
- 0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x2b,0x2f,0x00
-};
-
-#define MBFL_BASE64_STS_MIME_HEADER 0x1000000
-
-static int
-mbfl_filt_conv_base64enc(int c, mbfl_convert_filter *filter)
-{
- int n;
-
- n = (filter->status & 0xff);
- if (n == 0) {
- filter->status++;
- filter->cache = (c & 0xff) << 16;
- } else if (n == 1) {
- filter->status++;
- filter->cache |= (c & 0xff) << 8;
- } else {
- filter->status &= ~0xff;
- if ((filter->status & MBFL_BASE64_STS_MIME_HEADER) == 0) {
- n = (filter->status & 0xff00) >> 8;
- if (n > 72) {
- CK((*filter->output_function)(0x0d, filter->data)); /* CR */
- CK((*filter->output_function)(0x0a, filter->data)); /* LF */
- filter->status &= ~0xff00;
- }
- filter->status += 0x400;
- }
- n = filter->cache | (c & 0xff);
- CK((*filter->output_function)(mbfl_base64_table[(n >> 18) & 0x3f], filter->data));
- CK((*filter->output_function)(mbfl_base64_table[(n >> 12) & 0x3f], filter->data));
- CK((*filter->output_function)(mbfl_base64_table[(n >> 6) & 0x3f], filter->data));
- CK((*filter->output_function)(mbfl_base64_table[n & 0x3f], filter->data));
- }
-
- return c;
-}
-
-static int
-mbfl_filt_conv_base64enc_flush(mbfl_convert_filter *filter)
-{
- int status, cache, len;
-
- status = filter->status & 0xff;
- cache = filter->cache;
- len = (filter->status & 0xff00) >> 8;
- filter->status &= ~0xffff;
- filter->cache = 0;
- /* flush fragments */
- if (status >= 1) {
- if ((filter->status & MBFL_BASE64_STS_MIME_HEADER) == 0) {
- if (len > 72){
- CK((*filter->output_function)(0x0d, filter->data)); /* CR */
- CK((*filter->output_function)(0x0a, filter->data)); /* LF */
- }
- }
- CK((*filter->output_function)(mbfl_base64_table[(cache >> 18) & 0x3f], filter->data));
- CK((*filter->output_function)(mbfl_base64_table[(cache >> 12) & 0x3f], filter->data));
- if (status == 1) {
- CK((*filter->output_function)(0x3d, filter->data)); /* '=' */
- CK((*filter->output_function)(0x3d, filter->data)); /* '=' */
- } else {
- CK((*filter->output_function)(mbfl_base64_table[(cache >> 6) & 0x3f], filter->data));
- CK((*filter->output_function)(0x3d, filter->data)); /* '=' */
- }
- }
- return 0;
-}
-
-/*
- * BASE64 => any
- */
-static int
-mbfl_filt_conv_base64dec(int c, mbfl_convert_filter *filter)
-{
- int n;
-
- if (c == 0x0d || c == 0x0a || c == 0x20 || c == 0x09 || c == 0x3d) { /* CR or LF or SPACE or HTAB or '=' */
- return c;
- }
-
- n = 0;
- if (c >= 0x41 && c <= 0x5a) { /* A - Z */
- n = c - 65;
- } else if (c >= 0x61 && c <= 0x7a) { /* a - z */
- n = c - 71;
- } else if (c >= 0x30 && c <= 0x39) { /* 0 - 9 */
- n = c + 4;
- } else if (c == 0x2b) { /* '+' */
- n = 62;
- } else if (c == 0x2f) { /* '/' */
- n = 63;
- }
- n &= 0x3f;
-
- switch (filter->status) {
- case 0:
- filter->status = 1;
- filter->cache = n << 18;
- break;
- case 1:
- filter->status = 2;
- filter->cache |= n << 12;
- break;
- case 2:
- filter->status = 3;
- filter->cache |= n << 6;
- break;
- default:
- filter->status = 0;
- n |= filter->cache;
- CK((*filter->output_function)((n >> 16) & 0xff, filter->data));
- CK((*filter->output_function)((n >> 8) & 0xff, filter->data));
- CK((*filter->output_function)(n & 0xff, filter->data));
- break;
- }
-
- return c;
-}
-
-static int
-mbfl_filt_conv_base64dec_flush(mbfl_convert_filter *filter)
-{
- int status, cache;
-
- status = filter->status;
- cache = filter->cache;
- filter->status = 0;
- filter->cache = 0;
- /* flush fragments */
- if (status >= 2) {
- CK((*filter->output_function)((cache >> 16) & 0xff, filter->data));
- if (status >= 3) {
- CK((*filter->output_function)((cache >> 8) & 0xff, filter->data));
- }
- }
- return 0;
-}
-
-/*
- * any => Quoted-Printable
- */
-#define MBFL_QPRINT_STS_MIME_HEADER 0x1000000
-
-static int
-mbfl_filt_conv_qprintenc(int c, mbfl_convert_filter *filter)
-{
- int s, n;
-
- switch (filter->status & 0xff) {
- case 0:
- filter->cache = c;
- filter->status++;
- break;
- default:
- s = filter->cache;
- filter->cache = c;
- n = (filter->status & 0xff00) >> 8;
-
- if (s == 0) { /* null */
- CK((*filter->output_function)(s, filter->data));
- filter->status &= ~0xff00;
- break;
- }
-
- if ((filter->status & MBFL_QPRINT_STS_MIME_HEADER) == 0) {
- if (s == 0x0a || (s == 0x0d && c != 0x0a)) { /* line feed */
- CK((*filter->output_function)(0x0d, filter->data)); /* CR */
- CK((*filter->output_function)(0x0a, filter->data)); /* LF */
- filter->status &= ~0xff00;
- break;
- } else if (s == 0x0d) {
- break;
- }
- }
-
- if ((filter->status & MBFL_QPRINT_STS_MIME_HEADER) == 0 && n >= 72) { /* soft line feed */
- CK((*filter->output_function)(0x3d, filter->data)); /* '=' */
- CK((*filter->output_function)(0x0d, filter->data)); /* CR */
- CK((*filter->output_function)(0x0a, filter->data)); /* LF */
- filter->status &= ~0xff00;
- }
-
- if (s <= 0 || s >= 0x80 || s == 0x3d /* not ASCII or '=' */
- || ((filter->status & MBFL_QPRINT_STS_MIME_HEADER) != 0 &&
- (mbfl_charprop_table[s] & MBFL_CHP_MMHQENC) != 0)) {
- /* hex-octet */
- CK((*filter->output_function)(0x3d, filter->data)); /* '=' */
- n = (s >> 4) & 0xf;
- if (n < 10) {
- n += 48; /* '0' */
- } else {
- n += 55; /* 'A' - 10 */
- }
- CK((*filter->output_function)(n, filter->data));
- n = s & 0xf;
- if (n < 10) {
- n += 48;
- } else {
- n += 55;
- }
- CK((*filter->output_function)(n, filter->data));
- if ((filter->status & MBFL_QPRINT_STS_MIME_HEADER) == 0) {
- filter->status += 0x300;
- }
- } else {
- CK((*filter->output_function)(s, filter->data));
- if ((filter->status & MBFL_QPRINT_STS_MIME_HEADER) == 0) {
- filter->status += 0x100;
- }
- }
- break;
- }
-
- return c;
-}
-
-static int
-mbfl_filt_conv_qprintenc_flush(mbfl_convert_filter *filter)
-{
- /* flush filter cache */
- (*filter->filter_function)('\0', filter);
- filter->status &= ~0xffff;
- filter->cache = 0;
- return 0;
-}
-
-/*
- * Quoted-Printable => any
- */
-static int
-mbfl_filt_conv_qprintdec(int c, mbfl_convert_filter *filter)
-{
- int n;
-
- switch (filter->status) {
- case 1:
- if ((c >= 0x30 && c <= 0x39) || (c >= 0x41 && c <= 0x46)) { /* 0 - 9 or A - F */
- filter->cache = c;
- filter->status = 2;
- } else if (c == 0x0d) { /* soft line feed */
- filter->status = 3;
- } else if (c == 0x0a) { /* soft line feed */
- filter->status = 0;
- } else {
- CK((*filter->output_function)(0x3d, filter->data)); /* '=' */
- CK((*filter->output_function)(c, filter->data));
- filter->status = 0;
- }
- break;
- case 2:
- n = filter->cache;
- if (n >= 0x30 && n <= 0x39) { /* '0' - '9' */
- n -= 48; /* 48 = '0' */
- } else {
- n -= 55; /* 55 = 'A' - 10 */
- }
- n <<= 4;
- if (c >= 0x30 && c <= 0x39) { /* '0' - '9' */
- n += (c - 48);
- } else if (c >= 0x41 && c <= 0x46) { /* 'A' - 'F' */
- n += (c - 55);
- } else {
- CK((*filter->output_function)(0x3d, filter->data)); /* '=' */
- CK((*filter->output_function)(filter->cache, filter->data));
- n = c;
- }
- CK((*filter->output_function)(n, filter->data));
- filter->status = 0;
- break;
- case 3:
- if (c != 0x0a) { /* LF */
- CK((*filter->output_function)(c, filter->data));
- }
- filter->status = 0;
- break;
- default:
- if (c == 0x3d) { /* '=' */
- filter->status = 1;
- } else {
- CK((*filter->output_function)(c, filter->data));
- }
- break;
- }
-
- return c;
-}
-
-static int
-mbfl_filt_conv_qprintdec_flush(mbfl_convert_filter *filter)
-{
- int status, cache;
-
- status = filter->status;
- cache = filter->cache;
- filter->status = 0;
- filter->cache = 0;
- /* flush fragments */
- if (status == 1) {
- CK((*filter->output_function)(0x3d, filter->data)); /* '=' */
- } else if (status == 2) {
- CK((*filter->output_function)(0x3d, filter->data)); /* '=' */
- CK((*filter->output_function)(cache, filter->data));
- }
-
- return 0;
-}
-
-
-/*
- * UCS-4 => wchar
- */
-static int
-mbfl_filt_conv_ucs4_wchar(int c, mbfl_convert_filter *filter)
-{
- int n, endian;
-
- endian = filter->status & 0xff00;
- switch (filter->status & 0xff) {
- case 0:
- if (endian) {
- n = c & 0xff;
- } else {
- n = (c & 0xff) << 24;
- }
- filter->cache = n;
- filter->status++;
- break;
- case 1:
- if (endian) {
- n = (c & 0xff) << 8;
- } else {
- n = (c & 0xff) << 16;
- }
- filter->cache |= n;
- filter->status++;
- break;
- case 2:
- if (endian) {
- n = (c & 0xff) << 16;
- } else {
- n = (c & 0xff) << 8;
- }
- filter->cache |= n;
- filter->status++;
- break;
- default:
- if (endian) {
- n = (c & 0xff) << 24;
- } else {
- n = c & 0xff;
- }
- n |= filter->cache;
- if ((n & 0xffff) == 0 && ((n >> 16) & 0xffff) == 0xfffe) {
- if (endian) {
- filter->status = 0; /* big-endian */
- } else {
- filter->status = 0x100; /* little-endian */
- }
- CK((*filter->output_function)(0xfeff, filter->data));
- } else {
- filter->status &= ~0xff;
- CK((*filter->output_function)(n, filter->data));
- }
- break;
- }
-
- return c;
-}
-
-/*
- * wchar => UCS-4BE
- */
-static int
-mbfl_filt_conv_wchar_ucs4be(int c, mbfl_convert_filter *filter)
-{
- if (c >= 0 && c < MBFL_WCSGROUP_UCS4MAX) {
- CK((*filter->output_function)((c >> 24) & 0xff, filter->data));
- CK((*filter->output_function)((c >> 16) & 0xff, filter->data));
- CK((*filter->output_function)((c >> 8) & 0xff, filter->data));
- CK((*filter->output_function)(c & 0xff, filter->data));
- } else {
- if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) {
- CK(mbfl_filt_conv_illegal_output(c, filter));
- }
- }
-
- return c;
-}
-
-/*
- * wchar => UCS-4LE
- */
-static int
-mbfl_filt_conv_wchar_ucs4le(int c, mbfl_convert_filter *filter)
-{
- if (c >= 0 && c < MBFL_WCSGROUP_UCS4MAX) {
- CK((*filter->output_function)(c & 0xff, filter->data));
- CK((*filter->output_function)((c >> 8) & 0xff, filter->data));
- CK((*filter->output_function)((c >> 16) & 0xff, filter->data));
- CK((*filter->output_function)((c >> 24) & 0xff, filter->data));
- } else {
- if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) {
- CK(mbfl_filt_conv_illegal_output(c, filter));
- }
- }
-
- return c;
-}
-
-/*
- * UCS-2 => wchar
- */
-static int
-mbfl_filt_conv_ucs2_wchar(int c, mbfl_convert_filter *filter)
-{
- int n, endian;
-
- endian = filter->status & 0xff00;
- switch (filter->status & 0xff) {
- case 0:
- if (endian) {
- n = c & 0xff;
- } else {
- n = (c & 0xff) << 8;
- }
- filter->cache = n;
- filter->status++;
- break;
- default:
- if (endian) {
- n = (c & 0xff) << 8;
- } else {
- n = c & 0xff;
- }
- n |= filter->cache;
- if (n == 0xfffe) {
- if (endian) {
- filter->status = 0; /* big-endian */
- } else {
- filter->status = 0x100; /* little-endian */
- }
- CK((*filter->output_function)(0xfeff, filter->data));
- } else {
- filter->status &= ~0xff;
- CK((*filter->output_function)(n, filter->data));
- }
- break;
- }
-
- return c;
-}
-
-/*
- * wchar => UCS-2BE
- */
-static int
-mbfl_filt_conv_wchar_ucs2be(int c, mbfl_convert_filter *filter)
-{
- if (c >= 0 && c < MBFL_WCSPLANE_UCS2MAX) {
- CK((*filter->output_function)((c >> 8) & 0xff, filter->data));
- CK((*filter->output_function)(c & 0xff, filter->data));
- } else {
- if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) {
- CK(mbfl_filt_conv_illegal_output(c, filter));
- }
- }
-
- return c;
-}
-
-/*
- * wchar => UCS-2LE
- */
-static int
-mbfl_filt_conv_wchar_ucs2le(int c, mbfl_convert_filter *filter)
-{
- if (c >= 0 && c < MBFL_WCSPLANE_UCS2MAX) {
- CK((*filter->output_function)(c & 0xff, filter->data));
- CK((*filter->output_function)((c >> 8) & 0xff, filter->data));
- } else {
- if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) {
- CK(mbfl_filt_conv_illegal_output(c, filter));
- }
- }
-
- return c;
-}
-
-
-/*
- * UTF-16 => wchar
- */
-static int
-mbfl_filt_conv_utf16_wchar(int c, mbfl_convert_filter *filter)
-{
- int n, endian;
-
- endian = filter->status & 0xff00;
- switch (filter->status & 0xff) {
- case 0:
- if (endian) {
- n = c & 0xff;
- } else {
- n = (c & 0xff) << 8;
- }
- filter->cache |= n;
- filter->status++;
- break;
- default:
- if (endian) {
- n = (c & 0xff) << 8;
- } else {
- n = c & 0xff;
- }
- n |= filter->cache & 0xffff;
- filter->status &= ~0xff;
- if (n == 0xfffe) {
- if (endian) {
- filter->status = 0; /* big-endian */
- } else {
- filter->status = 0x100; /* little-endian */
- }
- CK((*filter->output_function)(0xfeff, filter->data));
- } else if (n >= 0xd800 && n < 0xdc00) {
- filter->cache = ((n & 0x3ff) << 16) + 0x400000;
- } else if (n >= 0xdc00 && n < 0xe000) {
- n &= 0x3ff;
- n |= (filter->cache & 0xfff0000) >> 6;
- filter->cache = 0;
- if (n >= MBFL_WCSPLANE_SUPMIN && n < MBFL_WCSPLANE_SUPMAX) {
- CK((*filter->output_function)(n, filter->data));
- } else { /* illegal character */
- n &= MBFL_WCSGROUP_MASK;
- n |= MBFL_WCSGROUP_THROUGH;
- CK((*filter->output_function)(n, filter->data));
- }
- } else {
- filter->cache = 0;
- CK((*filter->output_function)(n, filter->data));
- }
- break;
- }
-
- return c;
-}
-
-/*
- * UTF-16BE => wchar
- */
-static int
-mbfl_filt_conv_utf16be_wchar(int c, mbfl_convert_filter *filter)
-{
- int n;
-
- switch (filter->status) {
- case 0:
- filter->status = 1;
- n = (c & 0xff) << 8;
- filter->cache |= n;
- break;
- default:
- filter->status = 0;
- n = (filter->cache & 0xff00) | (c & 0xff);
- if (n >= 0xd800 && n < 0xdc00) {
- filter->cache = ((n & 0x3ff) << 16) + 0x400000;
- } else if (n >= 0xdc00 && n < 0xe000) {
- n &= 0x3ff;
- n |= (filter->cache & 0xfff0000) >> 6;
- filter->cache = 0;
- if (n >= MBFL_WCSPLANE_SUPMIN && n < MBFL_WCSPLANE_SUPMAX) {
- CK((*filter->output_function)(n, filter->data));
- } else { /* illegal character */
- n &= MBFL_WCSGROUP_MASK;
- n |= MBFL_WCSGROUP_THROUGH;
- CK((*filter->output_function)(n, filter->data));
- }
- } else {
- filter->cache = 0;
- CK((*filter->output_function)(n, filter->data));
- }
- break;
- }
-
- return c;
-}
-
-/*
- * wchar => UTF-16BE
- */
-static int
-mbfl_filt_conv_wchar_utf16be(int c, mbfl_convert_filter *filter)
-{
- int n;
-
- if (c >= 0 && c < MBFL_WCSPLANE_UCS2MAX) {
- CK((*filter->output_function)((c >> 8) & 0xff, filter->data));
- CK((*filter->output_function)(c & 0xff, filter->data));
- } else if (c >= MBFL_WCSPLANE_SUPMIN && c < MBFL_WCSPLANE_SUPMAX) {
- n = ((c >> 10) - 0x40) | 0xd800;
- CK((*filter->output_function)((n >> 8) & 0xff, filter->data));
- CK((*filter->output_function)(n & 0xff, filter->data));
- n = (c & 0x3ff) | 0xdc00;
- CK((*filter->output_function)((n >> 8) & 0xff, filter->data));
- CK((*filter->output_function)(n & 0xff, filter->data));
- } else {
- if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) {
- CK(mbfl_filt_conv_illegal_output(c, filter));
- }
- }
-
- return c;
-}
-
-/*
- * UTF-16LE => wchar
- */
-static int
-mbfl_filt_conv_utf16le_wchar(int c, mbfl_convert_filter *filter)
-{
- int n;
-
- switch (filter->status) {
- case 0:
- filter->status = 1;
- n = c & 0xff;
- filter->cache |= n;
- break;
- default:
- filter->status = 0;
- n = (filter->cache & 0xff) | ((c & 0xff) << 8);
- if (n >= 0xd800 && n < 0xdc00) {
- filter->cache = ((n & 0x3ff) << 16) + 0x400000;
- } else if (n >= 0xdc00 && n < 0xe000) {
- n &= 0x3ff;
- n |= (filter->cache & 0xfff0000) >> 6;
- filter->cache = 0;
- if (n >= MBFL_WCSPLANE_SUPMIN && n < MBFL_WCSPLANE_SUPMAX) {
- CK((*filter->output_function)(n, filter->data));
- } else { /* illegal character */
- n &= MBFL_WCSGROUP_MASK;
- n |= MBFL_WCSGROUP_THROUGH;
- CK((*filter->output_function)(n, filter->data));
- }
- } else {
- filter->cache = 0;
- CK((*filter->output_function)(n, filter->data));
- }
- break;
- }
-
- return c;
-}
-
-/*
- * wchar => UTF-16LE
- */
-static int
-mbfl_filt_conv_wchar_utf16le(int c, mbfl_convert_filter *filter)
-{
- int n;
-
- if (c >= 0 && c < MBFL_WCSPLANE_UCS2MAX) {
- CK((*filter->output_function)(c & 0xff, filter->data));
- CK((*filter->output_function)((c >> 8) & 0xff, filter->data));
- } else if (c >= MBFL_WCSPLANE_SUPMIN && c < MBFL_WCSPLANE_SUPMAX) {
- n = ((c >> 10) - 0x40) | 0xd800;
- CK((*filter->output_function)(n & 0xff, filter->data));
- CK((*filter->output_function)((n >> 8) & 0xff, filter->data));
- n = (c & 0x3ff) | 0xdc00;
- CK((*filter->output_function)(n & 0xff, filter->data));
- CK((*filter->output_function)((n >> 8) & 0xff, filter->data));
- } else {
- if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) {
- CK(mbfl_filt_conv_illegal_output(c, filter));
- }
- }
-
- return c;
-}
-
-
-/*
- * UTF-8 => wchar
- */
-static int
-mbfl_filt_conv_utf8_wchar(int c, mbfl_convert_filter *filter)
-{
- int s;
-
- if (c < 0x80) {
- if (c >= 0) {
- CK((*filter->output_function)(c, filter->data));
- }
- filter->status = 0;
- } else if (c < 0xc0) {
- switch (filter->status & 0xff) {
- case 0x10: /* 2byte code 2nd char */
- case 0x21: /* 3byte code 3rd char */
- case 0x32: /* 4byte code 4th char */
- case 0x43: /* 5byte code 5th char */
- case 0x54: /* 6byte code 6th char */
- filter->status = 0;
- s = filter->cache | (c & 0x3f);
- if (s >= 0x80) {
- CK((*filter->output_function)(s, filter->data));
- }
- break;
- case 0x20: /* 3byte code 2nd char */
- case 0x31: /* 4byte code 3rd char */
- case 0x42: /* 5byte code 4th char */
- case 0x53: /* 6byte code 5th char */
- filter->cache |= ((c & 0x3f) << 6);
- filter->status++;
- break;
- case 0x30: /* 4byte code 2nd char */
- case 0x41: /* 5byte code 3rd char */
- case 0x52: /* 6byte code 4th char */
- filter->cache |= ((c & 0x3f) << 12);
- filter->status++;
- break;
- case 0x40: /* 5byte code 2nd char */
- case 0x51: /* 6byte code 3rd char */
- filter->cache |= ((c & 0x3f) << 18);
- filter->status++;
- break;
- case 0x50: /* 6byte code 2nd char */
- filter->cache |= ((c & 0x3f) << 24);
- filter->status++;
- break;
- default:
- filter->status = 0;
- break;
- }
- } else if (c < 0xe0) { /* 2byte code first char */
- filter->status = 0x10;
- filter->cache = (c & 0x1f) << 6;
- } else if (c < 0xf0) { /* 3byte code first char */
- filter->status = 0x20;
- filter->cache = (c & 0xf) << 12;
- } else if (c < 0xf8) { /* 4byte code first char */
- filter->status = 0x30;
- filter->cache = (c & 0x7) << 18;
- } else if (c < 0xfc) { /* 5byte code first char */
- filter->status = 0x40;
- filter->cache = (c & 0x3) << 24;
- } else if (c < 0xfe) { /* 6 byte code first char */
- filter->status = 0x50;
- filter->cache = (c & 0x1) << 30;
- } else {
- filter->status = 0;
- filter->cache = 0;
- }
-
- return c;
-}
-
-/*
- * wchar => UTF-8
- */
-static int
-mbfl_filt_conv_wchar_utf8(int c, mbfl_convert_filter *filter)
-{
- if (c >= 0 && c < MBFL_WCSGROUP_UCS4MAX) {
- if (c < 0x80) {
- CK((*filter->output_function)(c, filter->data));
- } else if (c < 0x800) {
- CK((*filter->output_function)(((c >> 6) & 0x1f) | 0xc0, filter->data));
- CK((*filter->output_function)((c & 0x3f) | 0x80, filter->data));
- } else if (c < 0x10000) {
- CK((*filter->output_function)(((c >> 12) & 0x0f) | 0xe0, filter->data));
- CK((*filter->output_function)(((c >> 6) & 0x3f) | 0x80, filter->data));
- CK((*filter->output_function)((c & 0x3f) | 0x80, filter->data));
- } else if (c < 0x200000) {
- CK((*filter->output_function)(((c >> 18) & 0x07) | 0xf0, filter->data));
- CK((*filter->output_function)(((c >> 12) & 0x3f) | 0x80, filter->data));
- CK((*filter->output_function)(((c >> 6) & 0x3f) | 0x80, filter->data));
- CK((*filter->output_function)((c & 0x3f) | 0x80, filter->data));
- } else if (c < 0x4000000) {
- CK((*filter->output_function)(((c >> 24) & 0x03) | 0xf8, filter->data));
- CK((*filter->output_function)(((c >> 18) & 0x3f) | 0x80, filter->data));
- CK((*filter->output_function)(((c >> 12) & 0x3f) | 0x80, filter->data));
- CK((*filter->output_function)(((c >> 6) & 0x3f) | 0x80, filter->data));
- CK((*filter->output_function)((c & 0x3f) | 0x80, filter->data));
- } else {
- CK((*filter->output_function)(((c >> 30) & 0x01) | 0xfc, filter->data));
- CK((*filter->output_function)(((c >> 24) & 0x3f) | 0x80, filter->data));
- CK((*filter->output_function)(((c >> 18) & 0x3f) | 0x80, filter->data));
- CK((*filter->output_function)(((c >> 12) & 0x3f) | 0x80, filter->data));
- CK((*filter->output_function)(((c >> 6) & 0x3f) | 0x80, filter->data));
- CK((*filter->output_function)((c & 0x3f) | 0x80, filter->data));
- }
- } else {
- if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) {
- CK(mbfl_filt_conv_illegal_output(c, filter));
- }
- }
-
- return c;
-}
-
-
-/*
- * UTF-7 => wchar
- */
-static int
-mbfl_filt_conv_utf7_wchar(int c, mbfl_convert_filter *filter)
-{
- int s, n;
-
- n = -1;
- if (filter->status != 0) { /* Modified Base64 */
- if (c >= 0x41 && c <= 0x5a) { /* A - Z */
- n = c - 65;
- } else if (c >= 0x61 && c <= 0x7a) { /* a - z */
- n = c - 71;
- } else if (c >= 0x30 && c <= 0x39) { /* 0 - 9 */
- n = c + 4;
- } else if (c == 0x2b) { /* '+' */
- n = 62;
- } else if (c == 0x2f) { /* '/' */
- n = 63;
- }
- if (n < 0 || n > 63) {
- if (c == 0x2d) {
- if (filter->status == 1) { /* "+-" -> "+" */
- CK((*filter->output_function)(0x2b, filter->data));
- }
- } else if (c >= 0 && c < 0x80) { /* ASCII exclude '-' */
- CK((*filter->output_function)(c, filter->data));
- } else { /* illegal character */
- s = c & MBFL_WCSGROUP_MASK;
- s |= MBFL_WCSGROUP_THROUGH;
- CK((*filter->output_function)(s, filter->data));
- }
- filter->cache = 0;
- filter->status = 0;
- return c;
- }
- }
-
- switch (filter->status) {
- /* directly encoded characters */
- case 0:
- if (c == 0x2b) { /* '+' shift character */
- filter->status = 1;
- } else if (c >= 0 && c < 0x80) { /* ASCII */
- CK((*filter->output_function)(c, filter->data));
- } else { /* illegal character */
- s = c & MBFL_WCSGROUP_MASK;
- s |= MBFL_WCSGROUP_THROUGH;
- CK((*filter->output_function)(s, filter->data));
- }
- break;
-
- /* decode Modified Base64 */
- case 1:
- case 2:
- filter->cache |= n << 10;
- filter->status = 3;
- break;
- case 3:
- filter->cache |= n << 4;
- filter->status = 4;
- break;
- case 4:
- s = ((n >> 2) & 0xf) | (filter->cache & 0xffff);
- n = (n & 0x3) << 14;
- filter->status = 5;
- if (s >= 0xd800 && s < 0xdc00) {
- s = (((s & 0x3ff) << 16) + 0x400000) | n;
- filter->cache = s;
- } else if (s >= 0xdc00 && s < 0xe000) {
- s &= 0x3ff;
- s |= (filter->cache & 0xfff0000) >> 6;
- filter->cache = n;
- if (s >= MBFL_WCSPLANE_SUPMIN && s < MBFL_WCSPLANE_SUPMAX) {
- CK((*filter->output_function)(s, filter->data));
- } else { /* illegal character */
- s &= MBFL_WCSGROUP_MASK;
- s |= MBFL_WCSGROUP_THROUGH;
- CK((*filter->output_function)(s, filter->data));
- }
- } else {
- filter->cache = n;
- CK((*filter->output_function)(s, filter->data));
- }
- break;
-
- case 5:
- filter->cache |= n << 8;
- filter->status = 6;
- break;
- case 6:
- filter->cache |= n << 2;
- filter->status = 7;
- break;
- case 7:
- s = ((n >> 4) & 0x3) | (filter->cache & 0xffff);
- n = (n & 0xf) << 12;
- filter->status = 8;
- if (s >= 0xd800 && s < 0xdc00) {
- s = (((s & 0x3ff) << 16) + 0x400000) | n;
- filter->cache = s;
- } else if (s >= 0xdc00 && s < 0xe000) {
- s &= 0x3ff;
- s |= (filter->cache & 0xfff0000) >> 6;
- filter->cache = n;
- if (s >= MBFL_WCSPLANE_SUPMIN && s < MBFL_WCSPLANE_SUPMAX) {
- CK((*filter->output_function)(s, filter->data));
- } else { /* illegal character */
- s &= MBFL_WCSGROUP_MASK;
- s |= MBFL_WCSGROUP_THROUGH;
- CK((*filter->output_function)(s, filter->data));
- }
- } else {
- filter->cache = n;
- CK((*filter->output_function)(s, filter->data));
- }
- break;
-
- case 8:
- filter->cache |= n << 6;
- filter->status = 9;
- break;
- case 9:
- s = n | (filter->cache & 0xffff);
- filter->status = 2;
- if (s >= 0xd800 && s < 0xdc00) {
- s = (((s & 0x3ff) << 16) + 0x400000);
- filter->cache = s;
- } else if (s >= 0xdc00 && s < 0xe000) {
- s &= 0x3ff;
- s |= (filter->cache & 0xfff0000) >> 6;
- filter->cache = 0;
- if (s >= MBFL_WCSPLANE_SUPMIN && s < MBFL_WCSPLANE_SUPMAX) {
- CK((*filter->output_function)(s, filter->data));
- } else { /* illegal character */
- s &= MBFL_WCSGROUP_MASK;
- s |= MBFL_WCSGROUP_THROUGH;
- CK((*filter->output_function)(s, filter->data));
- }
- } else {
- filter->cache = 0;
- CK((*filter->output_function)(s, filter->data));
- }
- break;
-
- default:
- filter->status = 0;
- break;
- }
-
- return c;
-}
-
-/*
- * wchar => UTF-7
- */
-static int
-mbfl_filt_conv_wchar_utf7(int c, mbfl_convert_filter *filter)
-{
- int s, n;
-
- n = 0;
- if (c >= 0 && c < 0x80) { /* ASCII */
- if (c >= 0x41 && c <= 0x5a) { /* A - Z */
- n = 1;
- } else if (c >= 0x61 && c <= 0x7a) { /* a - z */
- n = 1;
- } else if (c >= 0x30 && c <= 0x39) { /* 0 - 9 */
- n = 1;
- } else if (c == '\0') { /* '\0' */
- n = 1;
- } else if (c == 0x2f) { /* '/' */
- n = 1;
- } else if (c == 0x2d) { /* '-' */
- n = 1;
- } else if (c == 0x20) { /* SPACE */
- n = 2;
- } else if (c == 0x09) { /* HTAB */
- n = 2;
- } else if (c == 0x0d) { /* CR */
- n = 2;
- } else if (c == 0x0a) { /* LF */
- n = 2;
- } else if (c == 0x27) { /* "'" */
- n = 2;
- } else if (c == 0x28) { /* '(' */
- n = 2;
- } else if (c == 0x29) { /* ')' */
- n = 2;
- } else if (c == 0x2c) { /* ',' */
- n = 2;
- } else if (c == 0x2e) { /* '.' */
- n = 2;
- } else if (c == 0x3a) { /* ':' */
- n = 2;
- } else if (c == 0x3f) { /* '?' */
- n = 2;
- }
- } else if (c >= 0 && c < MBFL_WCSPLANE_UCS2MAX) {
- ;
- } else if (c >= MBFL_WCSPLANE_SUPMIN && c < MBFL_WCSPLANE_SUPMAX) {
- s = ((c >> 10) - 0x40) | 0xd800;
- CK((*filter->filter_function)(s, filter));
- s = (c & 0x3ff) | 0xdc00;
- CK((*filter->filter_function)(s, filter));
- return c;
- } else {
- if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) {
- CK(mbfl_filt_conv_illegal_output(c, filter));
- }
- return c;
- }
-
- switch (filter->status) {
- case 0:
- if (n != 0) { /* directly encode characters */
- CK((*filter->output_function)(c, filter->data));
- } else { /* Modified Base64 */
- CK((*filter->output_function)(0x2b, filter->data)); /* '+' */
- filter->status++;
- filter->cache = c;
- }
- break;
-
- /* encode Modified Base64 */
- case 1:
- s = filter->cache;
- CK((*filter->output_function)(mbfl_base64_table[(s >> 10) & 0x3f], filter->data));
- CK((*filter->output_function)(mbfl_base64_table[(s >> 4) & 0x3f], filter->data));
- if (n != 0) {
- CK((*filter->output_function)(mbfl_base64_table[(s << 2) & 0x3c], filter->data));
- if (n == 1) {
- CK((*filter->output_function)(0x2d, filter->data)); /* '-' */
- }
- CK((*filter->output_function)(c, filter->data));
- filter->status = 0;
- } else {
- filter->status++;
- filter->cache = ((s & 0xf) << 16) | c;
- }
- break;
-
- case 2:
- s = filter->cache;
- CK((*filter->output_function)(mbfl_base64_table[(s >> 14) & 0x3f], filter->data));
- CK((*filter->output_function)(mbfl_base64_table[(s >> 8) & 0x3f], filter->data));
- CK((*filter->output_function)(mbfl_base64_table[(s >> 2) & 0x3f], filter->data));
- if (n != 0) {
- CK((*filter->output_function)(mbfl_base64_table[(s << 4) & 0x30], filter->data));
- if (n == 1) {
- CK((*filter->output_function)(0x2d, filter->data)); /* '-' */
- }
- CK((*filter->output_function)(c, filter->data));
- filter->status = 0;
- } else {
- filter->status++;
- filter->cache = ((s & 0x3) << 16) | c;
- }
- break;
-
- case 3:
- s = filter->cache;
- CK((*filter->output_function)(mbfl_base64_table[(s >> 12) & 0x3f], filter->data));
- CK((*filter->output_function)(mbfl_base64_table[(s >> 6) & 0x3f], filter->data));
- CK((*filter->output_function)(mbfl_base64_table[s & 0x3f], filter->data));
- if (n != 0) {
- if (n == 1) {
- CK((*filter->output_function)(0x2d, filter->data)); /* '-' */
- }
- CK((*filter->output_function)(c, filter->data));
- filter->status = 0;
- } else {
- filter->status = 1;
- filter->cache = c;
- }
- break;
-
- default:
- filter->status = 0;
- break;
- }
-
- return c;
-
-}
-
-static int
-mbfl_filt_conv_wchar_utf7_flush(mbfl_convert_filter *filter)
-{
- int status, cache;
-
- status = filter->status;
- cache = filter->cache;
- filter->status = 0;
- filter->cache = 0;
- /* flush fragments */
- switch (status) {
- case 1:
- CK((*filter->output_function)(mbfl_base64_table[(cache >> 10) & 0x3f], filter->data));
- CK((*filter->output_function)(mbfl_base64_table[(cache >> 4) & 0x3f], filter->data));
- CK((*filter->output_function)(mbfl_base64_table[(cache << 2) & 0x3c], filter->data));
- CK((*filter->output_function)(0x2d, filter->data)); /* '-' */
- break;
-
- case 2:
- CK((*filter->output_function)(mbfl_base64_table[(cache >> 14) & 0x3f], filter->data));
- CK((*filter->output_function)(mbfl_base64_table[(cache >> 8) & 0x3f], filter->data));
- CK((*filter->output_function)(mbfl_base64_table[(cache >> 2) & 0x3f], filter->data));
- CK((*filter->output_function)(mbfl_base64_table[(cache << 4) & 0x30], filter->data));
- CK((*filter->output_function)(0x2d, filter->data)); /* '-' */
- break;
-
- case 3:
- CK((*filter->output_function)(mbfl_base64_table[(cache >> 12) & 0x3f], filter->data));
- CK((*filter->output_function)(mbfl_base64_table[(cache >> 6) & 0x3f], filter->data));
- CK((*filter->output_function)(mbfl_base64_table[cache & 0x3f], filter->data));
- CK((*filter->output_function)(0x2d, filter->data)); /* '-' */
- break;
- }
- return 0;
-}
-
-
-/*
- * UTF7-IMAP => wchar
- */
-static int
-mbfl_filt_conv_utf7imap_wchar(int c, mbfl_convert_filter *filter)
-{
- int s, n;
-
- n = -1;
- if (filter->status != 0) { /* Modified Base64 */
- if (c >= 0x41 && c <= 0x5a) { /* A - Z */
- n = c - 65;
- } else if (c >= 0x61 && c <= 0x7a) { /* a - z */
- n = c - 71;
- } else if (c >= 0x30 && c <= 0x39) { /* 0 - 9 */
- n = c + 4;
- } else if (c == 0x2b) { /* '+' */
- n = 62;
- } else if (c == 0x2c) { /* ',' */
- n = 63;
- }
- if (n < 0 || n > 63) {
- if (c == 0x2d) {
- if (filter->status == 1) { /* "&-" -> "&" */
- CK((*filter->output_function)(0x26, filter->data));
- }
- } else if (c >= 0 && c < 0x80) { /* ASCII exclude '-' */
- CK((*filter->output_function)(c, filter->data));
- } else { /* illegal character */
- s = c & MBFL_WCSGROUP_MASK;
- s |= MBFL_WCSGROUP_THROUGH;
- CK((*filter->output_function)(s, filter->data));
- }
- filter->cache = 0;
- filter->status = 0;
- return c;
- }
- }
-
- switch (filter->status) {
- /* directly encoded characters */
- case 0:
- if (c == 0x26) { /* '&' shift character */
- filter->status++;
- } else if (c >= 0 && c < 0x80) { /* ASCII */
- CK((*filter->output_function)(c, filter->data));
- } else { /* illegal character */
- s = c & MBFL_WCSGROUP_MASK;
- s |= MBFL_WCSGROUP_THROUGH;
- CK((*filter->output_function)(s, filter->data));
- }
- break;
-
- /* decode Modified Base64 */
- case 1:
- case 2:
- filter->cache |= n << 10;
- filter->status = 3;
- break;
- case 3:
- filter->cache |= n << 4;
- filter->status = 4;
- break;
- case 4:
- s = ((n >> 2) & 0xf) | (filter->cache & 0xffff);
- n = (n & 0x3) << 14;
- filter->status = 5;
- if (s >= 0xd800 && s < 0xdc00) {
- s = (((s & 0x3ff) << 16) + 0x400000) | n;
- filter->cache = s;
- } else if (s >= 0xdc00 && s < 0xe000) {
- s &= 0x3ff;
- s |= (filter->cache & 0xfff0000) >> 6;
- filter->cache = n;
- if (s >= MBFL_WCSPLANE_SUPMIN && s < MBFL_WCSPLANE_SUPMAX) {
- CK((*filter->output_function)(s, filter->data));
- } else { /* illegal character */
- s &= MBFL_WCSGROUP_MASK;
- s |= MBFL_WCSGROUP_THROUGH;
- CK((*filter->output_function)(s, filter->data));
- }
- } else {
- filter->cache = n;
- CK((*filter->output_function)(s, filter->data));
- }
- break;
-
- case 5:
- filter->cache |= n << 8;
- filter->status = 6;
- break;
- case 6:
- filter->cache |= n << 2;
- filter->status = 7;
- break;
- case 7:
- s = ((n >> 4) & 0x3) | (filter->cache & 0xffff);
- n = (n & 0xf) << 12;
- filter->status = 8;
- if (s >= 0xd800 && s < 0xdc00) {
- s = (((s & 0x3ff) << 16) + 0x400000) | n;
- filter->cache = s;
- } else if (s >= 0xdc00 && s < 0xe000) {
- s &= 0x3ff;
- s |= (filter->cache & 0xfff0000) >> 6;
- filter->cache = n;
- if (s >= MBFL_WCSPLANE_SUPMIN && s < MBFL_WCSPLANE_SUPMAX) {
- CK((*filter->output_function)(s, filter->data));
- } else { /* illegal character */
- s &= MBFL_WCSGROUP_MASK;
- s |= MBFL_WCSGROUP_THROUGH;
- CK((*filter->output_function)(s, filter->data));
- }
- } else {
- filter->cache = n;
- CK((*filter->output_function)(s, filter->data));
- }
- break;
-
- case 8:
- filter->cache |= n << 6;
- filter->status = 9;
- break;
- case 9:
- s = n | (filter->cache & 0xffff);
- filter->status = 2;
- if (s >= 0xd800 && s < 0xdc00) {
- s = (((s & 0x3ff) << 16) + 0x400000);
- filter->cache = s;
- } else if (s >= 0xdc00 && s < 0xe000) {
- s &= 0x3ff;
- s |= (filter->cache & 0xfff0000) >> 6;
- filter->cache = 0;
- if (s >= MBFL_WCSPLANE_SUPMIN && s < MBFL_WCSPLANE_SUPMAX) {
- CK((*filter->output_function)(s, filter->data));
- } else { /* illegal character */
- s &= MBFL_WCSGROUP_MASK;
- s |= MBFL_WCSGROUP_THROUGH;
- CK((*filter->output_function)(s, filter->data));
- }
- } else {
- filter->cache = 0;
- CK((*filter->output_function)(s, filter->data));
- }
- break;
-
- default:
- filter->status = 0;
- break;
- }
-
- return c;
-}
-
-static const unsigned char mbfl_utf7imap_base64_table[] =
-{
- /* 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', */
- 0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4a,0x4b,0x4c,0x4d,
- /* 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', */
- 0x4e,0x4f,0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5a,
- /* 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', */
- 0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6a,0x6b,0x6c,0x6d,
- /* 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', */
- 0x6e,0x6f,0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7a,
- /* '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', ',', '\0' */
- 0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x2b,0x2c,0x00
-};
-
-/*
- * wchar => UTF7-IMAP
- */
-static int
-mbfl_filt_conv_wchar_utf7imap(int c, mbfl_convert_filter *filter)
-{
- int n, s;
-
- n = 0;
- if (c == 0x26) {
- n = 1;
- } else if ((c >= 0x20 && c <= 0x7e) || c == 0) {
- n = 2;
- } else if (c >= 0 && c < MBFL_WCSPLANE_UCS2MAX) {
- ;
- } else if (c >= MBFL_WCSPLANE_SUPMIN && c < MBFL_WCSPLANE_SUPMAX) {
- s = ((c >> 10) - 0x40) | 0xd800;
- CK((*filter->filter_function)(s, filter));
- s = (c & 0x3ff) | 0xdc00;
- CK((*filter->filter_function)(s, filter));
- return c;
- } else {
- if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) {
- CK(mbfl_filt_conv_illegal_output(c, filter));
- }
- return c;
- }
-
- switch (filter->status) {
- case 0:
- if (n != 0) { /* directly encode characters */
- CK((*filter->output_function)(c, filter->data));
- if (n == 1) {
- CK((*filter->output_function)(0x2d, filter->data)); /* '-' */
- }
- } else { /* Modified Base64 */
- CK((*filter->output_function)(0x26, filter->data)); /* '&' */
- filter->status = 1;
- filter->cache = c;
- }
- break;
-
- /* encode Modified Base64 */
- case 1:
- s = filter->cache;
- CK((*filter->output_function)(mbfl_utf7imap_base64_table[(s >> 10) & 0x3f], filter->data));
- CK((*filter->output_function)(mbfl_utf7imap_base64_table[(s >> 4) & 0x3f], filter->data));
- if (n != 0) {
- CK((*filter->output_function)(mbfl_utf7imap_base64_table[(s << 2) & 0x3c], filter->data));
- CK((*filter->output_function)(0x2d, filter->data)); /* '-' */
- CK((*filter->output_function)(c, filter->data));
- if (n == 1) {
- CK((*filter->output_function)(0x2d, filter->data)); /* '-' */
- }
- filter->status = 0;
- } else {
- filter->status = 2;
- filter->cache = ((s & 0xf) << 16) | c;
- }
- break;
-
- case 2:
- s = filter->cache;
- CK((*filter->output_function)(mbfl_utf7imap_base64_table[(s >> 14) & 0x3f], filter->data));
- CK((*filter->output_function)(mbfl_utf7imap_base64_table[(s >> 8) & 0x3f], filter->data));
- CK((*filter->output_function)(mbfl_utf7imap_base64_table[(s >> 2) & 0x3f], filter->data));
- if (n != 0) {
- CK((*filter->output_function)(mbfl_utf7imap_base64_table[(s << 4) & 0x30], filter->data));
- CK((*filter->output_function)(0x2d, filter->data)); /* '-' */
- CK((*filter->output_function)(c, filter->data));
- if (n == 1) {
- CK((*filter->output_function)(0x2d, filter->data)); /* '-' */
- }
- filter->status = 0;
- } else {
- filter->status = 3;
- filter->cache = ((s & 0x3) << 16) | c;
- }
- break;
-
- case 3:
- s = filter->cache;
- CK((*filter->output_function)(mbfl_utf7imap_base64_table[(s >> 12) & 0x3f], filter->data));
- CK((*filter->output_function)(mbfl_utf7imap_base64_table[(s >> 6) & 0x3f], filter->data));
- CK((*filter->output_function)(mbfl_utf7imap_base64_table[s & 0x3f], filter->data));
- if (n != 0) {
- CK((*filter->output_function)(0x2d, filter->data)); /* '-' */
- CK((*filter->output_function)(c, filter->data));
- if (n == 1) {
- CK((*filter->output_function)(0x2d, filter->data)); /* '-' */
- }
- filter->status = 0;
- } else {
- filter->status = 1;
- filter->cache = c;
- }
- break;
-
- default:
- filter->status = 0;
- break;
- }
-
- return c;
-
-}
-
-static int
-mbfl_filt_conv_wchar_utf7imap_flush(mbfl_convert_filter *filter)
-{
- int status, cache;
-
- status = filter->status;
- cache = filter->cache;
- filter->status = 0;
- filter->cache = 0;
- /* flush fragments */
- switch (status) {
- case 1:
- CK((*filter->output_function)(mbfl_utf7imap_base64_table[(cache >> 10) & 0x3f], filter->data));
- CK((*filter->output_function)(mbfl_utf7imap_base64_table[(cache >> 4) & 0x3f], filter->data));
- CK((*filter->output_function)(mbfl_utf7imap_base64_table[(cache << 2) & 0x3c], filter->data));
- CK((*filter->output_function)(0x2d, filter->data)); /* '-' */
- break;
-
- case 2:
- CK((*filter->output_function)(mbfl_utf7imap_base64_table[(cache >> 14) & 0x3f], filter->data));
- CK((*filter->output_function)(mbfl_utf7imap_base64_table[(cache >> 8) & 0x3f], filter->data));
- CK((*filter->output_function)(mbfl_utf7imap_base64_table[(cache >> 2) & 0x3f], filter->data));
- CK((*filter->output_function)(mbfl_utf7imap_base64_table[(cache << 4) & 0x30], filter->data));
- CK((*filter->output_function)(0x2d, filter->data)); /* '-' */
- break;
-
- case 3:
- CK((*filter->output_function)(mbfl_utf7imap_base64_table[(cache >> 12) & 0x3f], filter->data));
- CK((*filter->output_function)(mbfl_utf7imap_base64_table[(cache >> 6) & 0x3f], filter->data));
- CK((*filter->output_function)(mbfl_utf7imap_base64_table[cache & 0x3f], filter->data));
- CK((*filter->output_function)(0x2d, filter->data)); /* '-' */
- break;
- }
- return 0;
-}
-
-
-/*
- * wchar => ASCII
- */
-static int
-mbfl_filt_conv_wchar_ascii(int c, mbfl_convert_filter *filter)
-{
- if (c >= 0 && c < 0x80) {
- CK((*filter->output_function)(c, filter->data));
- } else {
- if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) {
- CK(mbfl_filt_conv_illegal_output(c, filter));
- }
- }
-
- return c;
-}
-
-
-/*
- * wchar => ISO-8859-1
- */
-static int
-mbfl_filt_conv_wchar_8859_1(int c, mbfl_convert_filter *filter)
-{
- if (c >= 0 && c < 0x100) {
- CK((*filter->output_function)(c, filter->data));
- } else {
- if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) {
- CK(mbfl_filt_conv_illegal_output(c, filter));
- }
- }
-
- return c;
-}
-
-/*
- * ISO-8859-2 => wchar
- */
-static int
-mbfl_filt_conv_8859_2_wchar(int c, mbfl_convert_filter *filter)
-{
- int s;
-
- if (c >= 0 && c < 0xa0) {
- s = c;
- } else if (c >= 0xa0 && c < 0x100) {
- s = iso8859_2_ucs_table[c - 0xa0];
- if (s <= 0) {
- s = c;
- s &= MBFL_WCSPLANE_MASK;
- s |= MBFL_WCSPLANE_8859_2;
- }
- } else {
- s = c;
- s &= MBFL_WCSGROUP_MASK;
- s |= MBFL_WCSGROUP_THROUGH;
- }
-
- CK((*filter->output_function)(s, filter->data));
-
- return c;
-}
-
-/*
- * wchar => ISO-8859-2
- */
-static int
-mbfl_filt_conv_wchar_8859_2(int c, mbfl_convert_filter *filter)
-{
- int s, n;
-
- if (c >= 0 && c < 0xa0) {
- s = c;
- } else {
- s = -1;
- n = 95;
- while (n >= 0) {
- if (c == iso8859_2_ucs_table[n]) {
- s = 0xa0 + n;
- break;
- }
- n--;
- }
- if (s <= 0 && (c & ~MBFL_WCSPLANE_MASK) == MBFL_WCSPLANE_8859_2) {
- s = c & MBFL_WCSPLANE_MASK;
- }
- }
-
- if (s >= 0) {
- CK((*filter->output_function)(s, filter->data));
- } else {
- if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) {
- CK(mbfl_filt_conv_illegal_output(c, filter));
- }
- }
-
- return c;
-}
-
-/*
- * ISO-8859-3 => wchar
- */
-static int
-mbfl_filt_conv_8859_3_wchar(int c, mbfl_convert_filter *filter)
-{
- int s;
-
- if (c >= 0 && c < 0xa0) {
- s = c;
- } else if (c >= 0xa0 && c < 0x100) {
- s = iso8859_3_ucs_table[c - 0xa0];
- if (s <= 0) {
- s = c;
- s &= MBFL_WCSPLANE_MASK;
- s |= MBFL_WCSPLANE_8859_3;
- }
- } else {
- s = c;
- s &= MBFL_WCSGROUP_MASK;
- s |= MBFL_WCSGROUP_THROUGH;
- }
-
- CK((*filter->output_function)(s, filter->data));
-
- return c;
-}
-
-/*
- * wchar => ISO-8859-3
- */
-static int
-mbfl_filt_conv_wchar_8859_3(int c, mbfl_convert_filter *filter)
-{
- int s, n;
-
- if (c >= 0 && c < 0xa0) {
- s = c;
- } else {
- s = -1;
- n = 95;
- while (n >= 0) {
- if (c == iso8859_3_ucs_table[n]) {
- s = 0xa0 + n;
- break;
- }
- n--;
- }
- if (s <= 0 && (c & ~MBFL_WCSPLANE_MASK) == MBFL_WCSPLANE_8859_3) {
- s = c & MBFL_WCSPLANE_MASK;
- }
- }
-
- if (s >= 0) {
- CK((*filter->output_function)(s, filter->data));
- } else {
- if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) {
- CK(mbfl_filt_conv_illegal_output(c, filter));
- }
- }
-
- return c;
-}
-
-/*
- * ISO-8859-4 => wchar
- */
-static int
-mbfl_filt_conv_8859_4_wchar(int c, mbfl_convert_filter *filter)
-{
- int s;
-
- if (c >= 0 && c < 0xa0) {
- s = c;
- } else if (c >= 0xa0 && c < 0x100) {
- s = iso8859_4_ucs_table[c - 0xa0];
- if (s <= 0) {
- s = c;
- s &= MBFL_WCSPLANE_MASK;
- s |= MBFL_WCSPLANE_8859_4;
- }
- } else {
- s = c;
- s &= MBFL_WCSGROUP_MASK;
- s |= MBFL_WCSGROUP_THROUGH;
- }
-
- CK((*filter->output_function)(s, filter->data));
-
- return c;
-}
-
-/*
- * wchar => ISO-8859-4
- */
-static int
-mbfl_filt_conv_wchar_8859_4(int c, mbfl_convert_filter *filter)
-{
- int s, n;
-
- if (c >= 0 && c < 0xa0) {
- s = c;
- } else {
- s = -1;
- n = 95;
- while (n >= 0) {
- if (c == iso8859_4_ucs_table[n]) {
- s = 0xa0 + n;
- break;
- }
- n--;
- }
- if (s <= 0 && (c & ~MBFL_WCSPLANE_MASK) == MBFL_WCSPLANE_8859_4) {
- s = c & MBFL_WCSPLANE_MASK;
- }
- }
-
- if (s >= 0) {
- CK((*filter->output_function)(s, filter->data));
- } else {
- if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) {
- CK(mbfl_filt_conv_illegal_output(c, filter));
- }
- }
-
- return c;
-}
-
-/*
- * ISO-8859-5 => wchar
- */
-static int
-mbfl_filt_conv_8859_5_wchar(int c, mbfl_convert_filter *filter)
-{
- int s;
-
- if (c >= 0 && c < 0xa0) {
- s = c;
- } else if (c >= 0xa0 && c < 0x100) {
- s = iso8859_5_ucs_table[c - 0xa0];
- if (s <= 0) {
- s = c;
- s &= MBFL_WCSPLANE_MASK;
- s |= MBFL_WCSPLANE_8859_5;
- }
- } else {
- s = c;
- s &= MBFL_WCSGROUP_MASK;
- s |= MBFL_WCSGROUP_THROUGH;
- }
-
- CK((*filter->output_function)(s, filter->data));
-
- return c;
-}
-
-/*
- * wchar => ISO-8859-5
- */
-static int
-mbfl_filt_conv_wchar_8859_5(int c, mbfl_convert_filter *filter)
-{
- int s, n;
-
- if (c >= 0 && c < 0xa0) {
- s = c;
- } else {
- s = -1;
- n = 95;
- while (n >= 0) {
- if (c == iso8859_5_ucs_table[n]) {
- s = 0xa0 + n;
- break;
- }
- n--;
- }
- if (s <= 0 && (c & ~MBFL_WCSPLANE_MASK) == MBFL_WCSPLANE_8859_5) {
- s = c & MBFL_WCSPLANE_MASK;
- }
- }
-
- if (s >= 0) {
- CK((*filter->output_function)(s, filter->data));
- } else {
- if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) {
- CK(mbfl_filt_conv_illegal_output(c, filter));
- }
- }
-
- return c;
-}
-
-/*
- * ISO-8859-6 => wchar
- */
-static int
-mbfl_filt_conv_8859_6_wchar(int c, mbfl_convert_filter *filter)
-{
- int s;
-
- if (c >= 0 && c < 0xa0) {
- s = c;
- } else if (c >= 0xa0 && c < 0x100) {
- s = iso8859_6_ucs_table[c - 0xa0];
- if (s <= 0) {
- s = c;
- s &= MBFL_WCSPLANE_MASK;
- s |= MBFL_WCSPLANE_8859_6;
- }
- } else {
- s = c;
- s &= MBFL_WCSGROUP_MASK;
- s |= MBFL_WCSGROUP_THROUGH;
- }
-
- CK((*filter->output_function)(s, filter->data));
-
- return c;
-}
-
-/*
- * wchar => ISO-8859-6
- */
-static int
-mbfl_filt_conv_wchar_8859_6(int c, mbfl_convert_filter *filter)
-{
- int s, n;
-
- if (c >= 0 && c < 0xa0) {
- s = c;
- } else {
- s = -1;
- n = 95;
- while (n >= 0) {
- if (c == iso8859_6_ucs_table[n]) {
- s = 0xa0 + n;
- break;
- }
- n--;
- }
- if (s <= 0 && (c & ~MBFL_WCSPLANE_MASK) == MBFL_WCSPLANE_8859_6) {
- s = c & MBFL_WCSPLANE_MASK;
- }
- }
-
- if (s >= 0) {
- CK((*filter->output_function)(s, filter->data));
- } else {
- if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) {
- CK(mbfl_filt_conv_illegal_output(c, filter));
- }
- }
-
- return c;
-}
-
-/*
- * ISO-8859-7 => wchar
- */
-static int
-mbfl_filt_conv_8859_7_wchar(int c, mbfl_convert_filter *filter)
-{
- int s;
-
- if (c >= 0 && c < 0xa0) {
- s = c;
- } else if (c >= 0xa0 && c < 0x100) {
- s = iso8859_7_ucs_table[c - 0xa0];
- if (s <= 0) {
- s = c;
- s &= MBFL_WCSPLANE_MASK;
- s |= MBFL_WCSPLANE_8859_7;
- }
- } else {
- s = c;
- s &= MBFL_WCSGROUP_MASK;
- s |= MBFL_WCSGROUP_THROUGH;
- }
-
- CK((*filter->output_function)(s, filter->data));
-
- return c;
-}
-
-/*
- * wchar => ISO-8859-7
- */
-static int
-mbfl_filt_conv_wchar_8859_7(int c, mbfl_convert_filter *filter)
-{
- int s, n;
-
- if (c >= 0 && c < 0xa0) {
- s = c;
- } else {
- s = -1;
- n = 95;
- while (n >= 0) {
- if (c == iso8859_7_ucs_table[n]) {
- s = 0xa0 + n;
- break;
- }
- n--;
- }
- if (s <= 0 && (c & ~MBFL_WCSPLANE_MASK) == MBFL_WCSPLANE_8859_7) {
- s = c & MBFL_WCSPLANE_MASK;
- }
- }
-
- if (s >= 0) {
- CK((*filter->output_function)(s, filter->data));
- } else {
- if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) {
- CK(mbfl_filt_conv_illegal_output(c, filter));
- }
- }
-
- return c;
-}
-
-/*
- * ISO-8859-8 => wchar
- */
-static int
-mbfl_filt_conv_8859_8_wchar(int c, mbfl_convert_filter *filter)
-{
- int s;
-
- if (c >= 0 && c < 0xa0) {
- s = c;
- } else if (c >= 0xa0 && c < 0x100) {
- s = iso8859_8_ucs_table[c - 0xa0];
- if (s <= 0) {
- s = c;
- s &= MBFL_WCSPLANE_MASK;
- s |= MBFL_WCSPLANE_8859_8;
- }
- } else {
- s = c;
- s &= MBFL_WCSGROUP_MASK;
- s |= MBFL_WCSGROUP_THROUGH;
- }
-
- CK((*filter->output_function)(s, filter->data));
-
- return c;
-}
-
-/*
- * wchar => ISO-8859-8
- */
-static int
-mbfl_filt_conv_wchar_8859_8(int c, mbfl_convert_filter *filter)
-{
- int s, n;
-
- if (c >= 0 && c < 0xa0) {
- s = c;
- } else {
- s = -1;
- n = 95;
- while (n >= 0) {
- if (c == iso8859_8_ucs_table[n]) {
- s = 0xa0 + n;
- break;
- }
- n--;
- }
- if (s <= 0 && (c & ~MBFL_WCSPLANE_MASK) == MBFL_WCSPLANE_8859_8) {
- s = c & MBFL_WCSPLANE_MASK;
- }
- }
-
- if (s >= 0) {
- CK((*filter->output_function)(s, filter->data));
- } else {
- if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) {
- CK(mbfl_filt_conv_illegal_output(c, filter));
- }
- }
-
- return c;
-}
-
-/*
- * ISO-8859-9 => wchar
- */
-static int
-mbfl_filt_conv_8859_9_wchar(int c, mbfl_convert_filter *filter)
-{
- int s;
-
- if (c >= 0 && c < 0xa0) {
- s = c;
- } else if (c >= 0xa0 && c < 0x100) {
- s = iso8859_9_ucs_table[c - 0xa0];
- if (s <= 0) {
- s = c;
- s &= MBFL_WCSPLANE_MASK;
- s |= MBFL_WCSPLANE_8859_9;
- }
- } else {
- s = c;
- s &= MBFL_WCSGROUP_MASK;
- s |= MBFL_WCSGROUP_THROUGH;
- }
-
- CK((*filter->output_function)(s, filter->data));
-
- return c;
-}
-
-/*
- * wchar => ISO-8859-9
- */
-static int
-mbfl_filt_conv_wchar_8859_9(int c, mbfl_convert_filter *filter)
-{
- int s, n;
-
- if (c >= 0 && c < 0xa0) {
- s = c;
- } else {
- s = -1;
- n = 95;
- while (n >= 0) {
- if (c == iso8859_9_ucs_table[n]) {
- s = 0xa0 + n;
- break;
- }
- n--;
- }
- if (s <= 0 && (c & ~MBFL_WCSPLANE_MASK) == MBFL_WCSPLANE_8859_9) {
- s = c & MBFL_WCSPLANE_MASK;
- }
- }
-
- if (s >= 0) {
- CK((*filter->output_function)(s, filter->data));
- } else {
- if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) {
- CK(mbfl_filt_conv_illegal_output(c, filter));
- }
- }
-
- return c;
-}
-
-/*
- * ISO-8859-10 => wchar
- */
-static int
-mbfl_filt_conv_8859_10_wchar(int c, mbfl_convert_filter *filter)
-{
- int s;
-
- if (c >= 0 && c < 0xa0) {
- s = c;
- } else if (c >= 0xa0 && c < 0x100) {
- s = iso8859_10_ucs_table[c - 0xa0];
- if (s <= 0) {
- s = c;
- s &= MBFL_WCSPLANE_MASK;
- s |= MBFL_WCSPLANE_8859_10;
- }
- } else {
- s = c;
- s &= MBFL_WCSGROUP_MASK;
- s |= MBFL_WCSGROUP_THROUGH;
- }
-
- CK((*filter->output_function)(s, filter->data));
-
- return c;
-}
-
-/*
- * wchar => ISO-8859-10
- */
-static int
-mbfl_filt_conv_wchar_8859_10(int c, mbfl_convert_filter *filter)
-{
- int s, n;
-
- if (c >= 0 && c < 0xa0) {
- s = c;
- } else {
- s = -1;
- n = 95;
- while (n >= 0) {
- if (c == iso8859_10_ucs_table[n]) {
- s = 0xa0 + n;
- break;
- }
- n--;
- }
- if (s <= 0 && (c & ~MBFL_WCSPLANE_MASK) == MBFL_WCSPLANE_8859_10) {
- s = c & MBFL_WCSPLANE_MASK;
- }
- }
-
- if (s >= 0) {
- CK((*filter->output_function)(s, filter->data));
- } else {
- if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) {
- CK(mbfl_filt_conv_illegal_output(c, filter));
- }
- }
-
- return c;
-}
-
-/*
- * ISO-8859-13 => wchar
- */
-static int
-mbfl_filt_conv_8859_13_wchar(int c, mbfl_convert_filter *filter)
-{
- int s;
-
- if (c >= 0 && c < 0xa0) {
- s = c;
- } else if (c >= 0xa0 && c < 0x100) {
- s = iso8859_13_ucs_table[c - 0xa0];
- if (s <= 0) {
- s = c;
- s &= MBFL_WCSPLANE_MASK;
- s |= MBFL_WCSPLANE_8859_13;
- }
- } else {
- s = c;
- s &= MBFL_WCSGROUP_MASK;
- s |= MBFL_WCSGROUP_THROUGH;
- }
-
- CK((*filter->output_function)(s, filter->data));
-
- return c;
-}
-
-/*
- * wchar => ISO-8859-13
- */
-static int
-mbfl_filt_conv_wchar_8859_13(int c, mbfl_convert_filter *filter)
-{
- int s, n;
-
- if (c >= 0 && c < 0xa0) {
- s = c;
- } else {
- s = -1;
- n = 95;
- while (n >= 0) {
- if (c == iso8859_13_ucs_table[n]) {
- s = 0xa0 + n;
- break;
- }
- n--;
- }
- if (s <= 0 && (c & ~MBFL_WCSPLANE_MASK) == MBFL_WCSPLANE_8859_13) {
- s = c & MBFL_WCSPLANE_MASK;
- }
- }
-
- if (s >= 0) {
- CK((*filter->output_function)(s, filter->data));
- } else {
- if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) {
- CK(mbfl_filt_conv_illegal_output(c, filter));
- }
- }
-
- return c;
-}
-
-/*
- * ISO-8859-14 => wchar
- */
-static int
-mbfl_filt_conv_8859_14_wchar(int c, mbfl_convert_filter *filter)
-{
- int s;
-
- if (c >= 0 && c < 0xa0) {
- s = c;
- } else if (c >= 0xa0 && c < 0x100) {
- s = iso8859_14_ucs_table[c - 0xa0];
- if (s <= 0) {
- s = c;
- s &= MBFL_WCSPLANE_MASK;
- s |= MBFL_WCSPLANE_8859_14;
- }
- } else {
- s = c;
- s &= MBFL_WCSGROUP_MASK;
- s |= MBFL_WCSGROUP_THROUGH;
- }
-
- CK((*filter->output_function)(s, filter->data));
-
- return c;
-}
-
-/*
- * wchar => ISO-8859-14
- */
-static int
-mbfl_filt_conv_wchar_8859_14(int c, mbfl_convert_filter *filter)
-{
- int s, n;
-
- if (c >= 0 && c < 0xa0) {
- s = c;
- } else {
- s = -1;
- n = 95;
- while (n >= 0) {
- if (c == iso8859_14_ucs_table[n]) {
- s = 0xa0 + n;
- break;
- }
- n--;
- }
- if (s <= 0 && (c & ~MBFL_WCSPLANE_MASK) == MBFL_WCSPLANE_8859_14) {
- s = c & MBFL_WCSPLANE_MASK;
- }
- }
-
- if (s >= 0) {
- CK((*filter->output_function)(s, filter->data));
- } else {
- if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) {
- CK(mbfl_filt_conv_illegal_output(c, filter));
- }
- }
-
- return c;
-}
-
-/*
- * ISO-8859-15 => wchar
- */
-static int
-mbfl_filt_conv_8859_15_wchar(int c, mbfl_convert_filter *filter)
-{
- int s;
-
- if (c >= 0 && c < 0xa0) {
- s = c;
- } else if (c >= 0xa0 && c < 0x100) {
- s = iso8859_15_ucs_table[c - 0xa0];
- if (s <= 0) {
- s = c;
- s &= MBFL_WCSPLANE_MASK;
- s |= MBFL_WCSPLANE_8859_15;
- }
- } else {
- s = c;
- s &= MBFL_WCSGROUP_MASK;
- s |= MBFL_WCSGROUP_THROUGH;
- }
-
- CK((*filter->output_function)(s, filter->data));
-
- return c;
-}
-
-/*
- * wchar => ISO-8859-15
- */
-static int
-mbfl_filt_conv_wchar_8859_15(int c, mbfl_convert_filter *filter)
-{
- int s, n;
-
- if (c >= 0 && c < 0xa0) {
- s = c;
- } else {
- s = -1;
- n = 95;
- while (n >= 0) {
- if (c == iso8859_15_ucs_table[n]) {
- s = 0xa0 + n;
- break;
- }
- n--;
- }
- if (s <= 0 && (c & ~MBFL_WCSPLANE_MASK) == MBFL_WCSPLANE_8859_15) {
- s = c & MBFL_WCSPLANE_MASK;
- }
- }
-
- if (s >= 0) {
- CK((*filter->output_function)(s, filter->data));
- } else {
- if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) {
- CK(mbfl_filt_conv_illegal_output(c, filter));
- }
- }
-
- return c;
-}
-
-
-
-/*
- *
- * identify filter functions
- *
- */
-
-static void
-mbfl_filt_ident_common_ctor(mbfl_identify_filter *filter)
-{
- filter->status = 0;
- filter->flag = 0;
-}
-
-static void
-mbfl_filt_ident_common_dtor(mbfl_identify_filter *filter)
-{
- filter->status = 0;
-}
-
-static int
-mbfl_filt_ident_ascii(int c, mbfl_identify_filter *filter)
-{
- if (c >= 0x20 && c < 0x80) {
- ;
- } else if (c == 0x0d || c == 0x0a || c == 0x09 || c == 0) { /* CR or LF or HTAB or null */
- ;
- } else {
- filter->flag = 1;
- }
-
- return c;
-}
-
-static int
-mbfl_filt_ident_utf8(int c, mbfl_identify_filter *filter)
-{
- if (c < 0x80) {
- if (c < 0) {
- filter->flag = 1; /* bad */
- } else if (c != 0 && filter->status) {
- filter->flag = 1; /* bad */
- }
- filter->status = 0;
- } else if (c < 0xc0) {
- switch (filter->status) {
- case 0x20: /* 3 byte code 2nd char */
- case 0x30: /* 4 byte code 2nd char */
- case 0x31: /* 4 byte code 3rd char */
- case 0x40: /* 5 byte code 2nd char */
- case 0x41: /* 5 byte code 3rd char */
- case 0x42: /* 5 byte code 4th char */
- case 0x50: /* 6 byte code 2nd char */
- case 0x51: /* 6 byte code 3rd char */
- case 0x52: /* 6 byte code 4th char */
- case 0x53: /* 6 byte code 5th char */
- filter->status++;
- break;
- case 0x10: /* 2 byte code 2nd char */
- case 0x21: /* 3 byte code 3rd char */
- case 0x32: /* 4 byte code 4th char */
- case 0x43: /* 5 byte code 5th char */
- case 0x54: /* 6 byte code 6th char */
- filter->status = 0;
- break;
- default:
- filter->flag = 1; /* bad */
- filter->status = 0;
- break;
- }
- } else {
- if (filter->status) {
- filter->flag = 1; /* bad */
- }
- filter->status = 0;
- if (c < 0xe0) { /* 2 byte code first char */
- filter->status = 0x10;
- } else if (c < 0xf0) { /* 3 byte code 1st char */
- filter->status = 0x20;
- } else if (c < 0xf8) { /* 4 byte code 1st char */
- filter->status = 0x30;
- } else if (c < 0xfc) { /* 5 byte code 1st char */
- filter->status = 0x40;
- } else if (c < 0xfe) { /* 6 byte code 1st char */
- filter->status = 0x50;
- } else {
- filter->flag = 1; /* bad */
- }
- }
-
- return c;
-}
-
-static int
-mbfl_filt_ident_utf7(int c, mbfl_identify_filter *filter)
-{
- int n;
-
- switch (filter->status) {
- /* directly encoded characters */
- case 0:
- if (c == 0x2b) { /* '+' shift character */
- filter->status++;
- } else if (c == 0x5c || c == 0x7e || c < 0 || c > 0x7f) { /* illegal character */
- filter->flag = 1; /* bad */
- }
- break;
-
- /* Modified Base64 */
- case 1:
- case 2:
- n = 0;
- if (c >= 0x41 && c <= 0x5a) { /* A - Z */
- n = 1;
- } else if (c >= 0x61 && c <= 0x7a) { /* a - z */
- n = 1;
- } else if (c >= 0x30 && c <= 0x39) { /* 0 - 9 */
- n = 1;
- } else if (c == 0x2b) { /* '+' */
- n = 1;
- } else if (c == 0x2f) { /* '/' */
- n = 1;
- }
- if (n <= 0) {
- if (filter->status == 1 && c != 0x2d) {
- filter->flag = 1; /* bad */
- } else if (c < 0 || c > 0x7f) {
- filter->flag = 1; /* bad */
- }
- filter->status = 0;
- } else {
- filter->status = 2;
- }
- break;
-
- default:
- filter->status = 0;
- break;
- }
-
- return c;
-}
-
-static int
-mbfl_filt_ident_eucjp(int c, mbfl_identify_filter *filter)
-{
- switch (filter->status) {
- case 0: /* latin */
- if (c >= 0 && c < 0x80) { /* ok */
- ;
- } else if (c > 0xa0 && c < 0xff) { /* kanji first char */
- filter->status = 1;
- } else if (c == 0x8e) { /* kana first char */
- filter->status = 2;
- } else if (c == 0x8f) { /* X 0212 first char */
- filter->status = 3;
- } else { /* bad */
- filter->flag = 1;
- }
- break;
-
- case 1: /* got first half */
- if (c < 0xa1 || c > 0xfe) { /* bad */
- filter->flag = 1;
- }
- filter->status = 0;
- break;
-
- case 2: /* got 0x8e */
- if (c < 0xa1 || c > 0xdf) { /* bad */
- filter->flag = 1;
- }
- filter->status = 0;
- break;
-
- case 3: /* got 0x8f */
- if (c < 0xa1 || c > 0xfe) { /* bad */
- filter->flag = 1;
- }
- filter->status++;
- break;
- case 4: /* got 0x8f */
- if (c < 0xa1 || c > 0xfe) { /* bad */
- filter->flag = 1;
- }
- filter->status = 0;
- break;
-
- default:
- filter->status = 0;
- break;
- }
-
- return c;
-}
-
-static int
-mbfl_filt_ident_sjis(int c, mbfl_identify_filter *filter)
-{
- if (filter->status) { /* kanji second char */
- if (c < 0x40 || c > 0xfc || c == 0x7f) { /* bad */
- filter->flag = 1;
- }
- filter->status = 0;
- } else if (c >= 0 && c < 0x80) { /* latin ok */
- ;
- } else if (c > 0xa0 && c < 0xe0) { /* kana ok */
- ;
- } else if (c > 0x80 && c < 0xf0 && c != 0xa0) { /* kanji first char */
- filter->status = 1;
- } else { /* bad */
- filter->flag = 1;
- }
-
- return c;
-}
-
-static int
-mbfl_filt_ident_sjiswin(int c, mbfl_identify_filter *filter)
-{
- if (filter->status) { /* kanji second char */
- if (c < 0x40 || c > 0xfc || c == 0x7f) { /* bad */
- filter->flag = 1;
- }
- filter->status = 0;
- } else if (c >= 0 && c < 0x80) { /* latin ok */
- ;
- } else if (c > 0xa0 && c < 0xe0) { /* kana ok */
- ;
- } else if (c > 0x80 && c < 0xfd && c != 0xa0) { /* kanji first char */
- filter->status = 1;
- } else { /* bad */
- filter->flag = 1;
- }
-
- return c;
-}
-
-static int
-mbfl_filt_ident_jis(int c, mbfl_identify_filter *filter)
-{
-retry:
- switch (filter->status & 0xf) {
-/* case 0x00: ASCII */
-/* case 0x10: X 0201 latin */
-/* case 0x20: X 0201 kana */
-/* case 0x80: X 0208 */
-/* case 0x90: X 0212 */
- case 0:
- if (c == 0x1b) {
- filter->status += 2;
- } else if (c == 0x0e) { /* "kana in" */
- filter->status = 0x20;
- } else if (c == 0x0f) { /* "kana out" */
- filter->status = 0;
- } else if ((filter->status == 0x80 || filter->status == 0x90) && c > 0x20 && c < 0x7f) { /* kanji first char */
- filter->status += 1;
- } else if (c >= 0 && c < 0x80) { /* latin, CTLs */
- ;
- } else {
- filter->flag = 1; /* bad */
- }
- break;
-
-/* case 0x81: X 0208 second char */
-/* case 0x91: X 0212 second char */
- case 1:
- filter->status &= ~0xf;
- if (c == 0x1b) {
- goto retry;
- } else if (c < 0x21 || c > 0x7e) { /* bad */
- filter->flag = 1;
- }
- break;
-
- /* ESC */
- case 2:
- if (c == 0x24) { /* '$' */
- filter->status++;
- } else if (c == 0x28) { /* '(' */
- filter->status += 3;
- } else {
- filter->flag = 1; /* bad */
- filter->status &= ~0xf;
- goto retry;
- }
- break;
-
- /* ESC $ */
- case 3:
- if (c == 0x40 || c == 0x42) { /* '@' or 'B' */
- filter->status = 0x80;
- } else if (c == 0x28) { /* '(' */
- filter->status++;
- } else {
- filter->flag = 1; /* bad */
- filter->status &= ~0xf;
- goto retry;
- }
- break;
-
- /* ESC $ ( */
- case 4:
- if (c == 0x40 || c == 0x42) { /* '@' or 'B' */
- filter->status = 0x80;
- } else if (c == 0x44) { /* 'D' */
- filter->status = 0x90;
- } else {
- filter->flag = 1; /* bad */
- filter->status &= ~0xf;
- goto retry;
- }
- break;
-
- /* ESC ( */
- case 5:
- if (c == 0x42 || c == 0x48) { /* 'B' or 'H' */
- filter->status = 0;
- } else if (c == 0x4a) { /* 'J' */
- filter->status = 0x10;
- } else if (c == 0x49) { /* 'I' */
- filter->status = 0x20;
- } else {
- filter->flag = 1; /* bad */
- filter->status &= ~0xf;
- goto retry;
- }
- break;
-
- default:
- filter->status = 0;
- break;
- }
-
- return c;
-}
-
-static int
-mbfl_filt_ident_2022jp(int c, mbfl_identify_filter *filter)
-{
-retry:
- switch (filter->status & 0xf) {
-/* case 0x00: ASCII */
-/* case 0x10: X 0201 latin */
-/* case 0x80: X 0208 */
- case 0:
- if (c == 0x1b) {
- filter->status += 2;
- } else if (filter->status == 0x80 && c > 0x20 && c < 0x7f) { /* kanji first char */
- filter->status += 1;
- } else if (c >= 0 && c < 0x80) { /* latin, CTLs */
- ;
- } else {
- filter->flag = 1; /* bad */
- }
- break;
-
-/* case 0x81: X 0208 second char */
- case 1:
- if (c == 0x1b) {
- filter->status++;
- } else {
- filter->status &= ~0xf;
- if (c < 0x21 || c > 0x7e) { /* bad */
- filter->flag = 1;
- }
- }
- break;
-
- /* ESC */
- case 2:
- if (c == 0x24) { /* '$' */
- filter->status++;
- } else if (c == 0x28) { /* '(' */
- filter->status += 3;
- } else {
- filter->flag = 1; /* bad */
- filter->status &= ~0xf;
- goto retry;
- }
- break;
-
- /* ESC $ */
- case 3:
- if (c == 0x40 || c == 0x42) { /* '@' or 'B' */
- filter->status = 0x80;
- } else {
- filter->flag = 1; /* bad */
- filter->status &= ~0xf;
- goto retry;
- }
- break;
-
- /* ESC ( */
- case 5:
- if (c == 0x42) { /* 'B' */
- filter->status = 0;
- } else if (c == 0x4a) { /* 'J' */
- filter->status = 0x10;
- } else {
- filter->flag = 1; /* bad */
- filter->status &= ~0xf;
- goto retry;
- }
- break;
-
- default:
- filter->status = 0;
- break;
- }
-
- return c;
-}
-
-static void
-mbfl_filt_ident_false_ctor(mbfl_identify_filter *filter)
-{
- filter->status = 0;
- filter->flag = 1;
-}
-
-static int
-mbfl_filt_ident_false(int c, mbfl_identify_filter *filter)
-{
- filter->flag = 1; /* bad */
- return c;
-}
-
-static int
-mbfl_filt_ident_true(int c, mbfl_identify_filter *filter)
-{
- return c;
-}
-
-
-
-/*
- * convert filter
- */
-
-/* setup filter function table */
-static void
-mbfl_convert_filter_set_vtbl(mbfl_convert_filter *filter, struct mbfl_convert_vtbl *vtbl)
-{
- if (filter && vtbl) {
- filter->filter_ctor = vtbl->filter_ctor;
- filter->filter_dtor = vtbl->filter_dtor;
- filter->filter_function = vtbl->filter_function;
- filter->filter_flush = vtbl->filter_flush;
- }
-}
-
-
-static struct mbfl_convert_vtbl *
-mbfl_convert_filter_get_vtbl(enum mbfl_no_encoding from, enum mbfl_no_encoding to)
-{
- struct mbfl_convert_vtbl *vtbl;
- int i;
-
- if (to == mbfl_no_encoding_base64 ||
- to == mbfl_no_encoding_qprint ||
- to == mbfl_no_encoding_7bit) {
- from = mbfl_no_encoding_8bit;
- } else if (from == mbfl_no_encoding_base64 ||
- from == mbfl_no_encoding_qprint ||
- from == mbfl_no_encoding_uuencode) {
- to = mbfl_no_encoding_8bit;
- }
-
- i = 0;
- while ((vtbl = mbfl_convert_filter_list[i++]) != NULL){
- if (vtbl->from == from && vtbl->to == to) {
- return vtbl;
- }
- }
-
- return NULL;
-}
-
-
-static void
-mbfl_convert_filter_select_vtbl(mbfl_convert_filter *filter)
-{
- struct mbfl_convert_vtbl *vtbl;
-
- vtbl = mbfl_convert_filter_get_vtbl(filter->from->no_encoding, filter->to->no_encoding);
- if (vtbl == NULL) {
- vtbl = &vtbl_pass;
- }
- mbfl_convert_filter_set_vtbl(filter, vtbl);
-}
-
-
-/* filter pipe */
-static int
-mbfl_filter_output_pipe(int c, void* data)
-{
- mbfl_convert_filter *filter = (mbfl_convert_filter*)data;
- return (*filter->filter_function)(c, filter);
-}
-
-
-/* null output */
-static int
-mbfl_filter_output_null(int c, void* data)
-{
- return c;
-}
-
-
-mbfl_convert_filter *
-mbfl_convert_filter_new(
- enum mbfl_no_encoding from,
- enum mbfl_no_encoding to,
- int (*output_function)(int, void*),
- int (*flush_function)(void*),
- void* data)
-{
- mbfl_convert_filter * filter;
-
- /* allocate */
- filter = (mbfl_convert_filter *)mbfl_malloc(sizeof(mbfl_convert_filter));
- if (filter == NULL) {
- return NULL;
- }
-
- /* encoding structure */
- filter->from = mbfl_no2encoding(from);
- filter->to = mbfl_no2encoding(to);
- if (filter->from == NULL) {
- filter->from = &mbfl_encoding_pass;
- }
- if (filter->to == NULL) {
- filter->to = &mbfl_encoding_pass;
- }
-
- if (output_function != NULL) {
- filter->output_function = output_function;
- } else {
- filter->output_function = mbfl_filter_output_null;
- }
- filter->flush_function = flush_function;
- filter->data = data;
- filter->illegal_mode = MBFL_OUTPUTFILTER_ILLEGAL_MODE_CHAR;
- filter->illegal_substchar = 0x3f; /* '?' */
-
- /* setup the function table */
- mbfl_convert_filter_select_vtbl(filter);
-
- /* constructor */
- (*filter->filter_ctor)(filter);
-
- return filter;
-}
-
-void
-mbfl_convert_filter_delete(mbfl_convert_filter *filter)
-{
- if (filter) {
- (*filter->filter_dtor)(filter);
- mbfl_free((void*)filter);
- }
-}
-
-int
-mbfl_convert_filter_feed(int c, mbfl_convert_filter *filter)
-{
- return (*filter->filter_function)(c, filter);
-}
-
-int
-mbfl_convert_filter_flush(mbfl_convert_filter *filter)
-{
- (*filter->filter_flush)(filter);
- return (filter->flush_function ? (*filter->flush_function)(filter->data) : 0);
-}
-
-void
-mbfl_convert_filter_reset(
- mbfl_convert_filter *filter,
- enum mbfl_no_encoding from,
- enum mbfl_no_encoding to)
-{
- /* destruct old filter */
- (*filter->filter_dtor)(filter);
-
- /* resset filter member */
- filter->from = mbfl_no2encoding(from);
- filter->to = mbfl_no2encoding(to);
-
- /* set the vtbl */
- mbfl_convert_filter_select_vtbl(filter);
-
- /* construct new filter */
- (*filter->filter_ctor)(filter);
-}
-
-void
-mbfl_convert_filter_copy(
- mbfl_convert_filter *src,
- mbfl_convert_filter *dist)
-{
- dist->filter_ctor = src->filter_ctor;
- dist->filter_dtor = src->filter_dtor;
- dist->filter_function = src->filter_function;
- dist->filter_flush = src->filter_flush;
- dist->output_function = src->output_function;
- dist->flush_function = src->flush_function;
- dist->data = src->data;
- dist->status = src->status;
- dist->cache = src->cache;
- dist->from = src->from;
- dist->to = src->to;
- dist->illegal_mode = src->illegal_mode;
- dist->illegal_substchar = src->illegal_substchar;
-}
-
-static int
-mbfl_convert_filter_devcat(mbfl_convert_filter *filter, mbfl_memory_device *src)
-{
- int n;
- unsigned char *p;
-
- p = src->buffer;
- n = src->pos;
- while (n > 0) {
- if ((*filter->filter_function)(*p++, filter) < 0) {
- return -1;
- }
- n--;
- }
-
- return n;
-}
-
-static int
-mbfl_convert_filter_strcat(mbfl_convert_filter *filter, const unsigned char *p)
-{
- int c;
-
- while ((c = *p++) != '\0') {
- if ((*filter->filter_function)(c, filter) < 0) {
- return -1;
- }
- }
-
- return 0;
-}
-
-#if 0
-static int
-mbfl_convert_filter_strncat(mbfl_convert_filter *filter, const unsigned char *p, int n)
-{
- while (n > 0) {
- if ((*filter->filter_function)(*p++, filter) < 0) {
- return -1;
- }
- n--;
- }
-
- return n;
-}
-#endif
-
-/* hex character table "0123456789ABCDEF" */
-static char mbfl_hexchar_table[] = {
- 0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x41,0x42,0x43,0x44,0x45,0x46
-};
-
-/* illegal character output function for conv-filter */
-int
-mbfl_filt_conv_illegal_output(int c, mbfl_convert_filter *filter)
-{
- int mode_backup, ret, n, m, r;
-
- ret = 0;
- mode_backup = filter->illegal_mode;
- filter->illegal_mode = MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE;
- switch (mode_backup) {
- case MBFL_OUTPUTFILTER_ILLEGAL_MODE_CHAR:
- ret = (*filter->filter_function)(filter->illegal_substchar, filter);
- break;
- case MBFL_OUTPUTFILTER_ILLEGAL_MODE_LONG:
- if (c >= 0) {
- if (c < MBFL_WCSGROUP_UCS4MAX) { /* unicode */
- ret = mbfl_convert_filter_strcat(filter, "U+");
- } else {
- if (c < MBFL_WCSGROUP_WCHARMAX) {
- m = c & ~MBFL_WCSPLANE_MASK;
- switch (m) {
- case MBFL_WCSPLANE_JIS0208:
- ret = mbfl_convert_filter_strcat(filter, "JIS+");
- break;
- case MBFL_WCSPLANE_JIS0212:
- ret = mbfl_convert_filter_strcat(filter, "JIS2+");
- break;
- case MBFL_WCSPLANE_WINCP932:
- ret = mbfl_convert_filter_strcat(filter, "W932+");
- break;
- case MBFL_WCSPLANE_8859_1:
- ret = mbfl_convert_filter_strcat(filter, "I8859_1+");
- break;
- default:
- ret = mbfl_convert_filter_strcat(filter, "?+");
- break;
- }
- c &= MBFL_WCSPLANE_MASK;
- } else {
- ret = mbfl_convert_filter_strcat(filter, "BAD+");
- c &= MBFL_WCSGROUP_MASK;
- }
- }
- if (ret >= 0) {
- m = 0;
- r = 28;
- while (r >= 0) {
- n = (c >> r) & 0xf;
- if (n || m) {
- m = 1;
- ret = (*filter->filter_function)(mbfl_hexchar_table[n], filter);
- if (ret < 0) {
- break;
- }
- }
- r -= 4;
- }
- if (m == 0 && ret >= 0) {
- ret = (*filter->filter_function)(mbfl_hexchar_table[0], filter);
- }
- }
- }
- break;
- default:
- break;
- }
- filter->illegal_mode = mode_backup;
-
- return ret;
-}
-
-
-/*
- * identify filter
- */
-
-static void
-mbfl_identify_filter_set_vtbl(mbfl_identify_filter *filter, struct mbfl_identify_vtbl *vtbl)
-{
- if (filter && vtbl) {
- filter->filter_ctor = vtbl->filter_ctor;
- filter->filter_dtor = vtbl->filter_dtor;
- filter->filter_function = vtbl->filter_function;
- }
-}
-
-static struct mbfl_identify_vtbl *
-mbfl_identify_filter_get_vtbl(enum mbfl_no_encoding encoding)
-{
- struct mbfl_identify_vtbl *vtbl;
- int i;
-
- i = 0;
- while ((vtbl = mbfl_identify_filter_list[i++]) != NULL) {
- if (vtbl->encoding == encoding) {
- break;
- }
- }
-
- return vtbl;
-}
-
-static void
-mbfl_identify_filter_select_vtbl(mbfl_identify_filter *filter)
-{
- struct mbfl_identify_vtbl *vtbl;
-
- vtbl = mbfl_identify_filter_get_vtbl(filter->encoding->no_encoding);
- if (vtbl == NULL) {
- vtbl = &vtbl_identify_false;
- }
- mbfl_identify_filter_set_vtbl(filter, vtbl);
-}
-
-mbfl_identify_filter *
-mbfl_identify_filter_new(enum mbfl_no_encoding encoding)
-{
- mbfl_identify_filter * filter;
-
- /* allocate */
- filter = (mbfl_identify_filter *)mbfl_malloc(sizeof(mbfl_identify_filter));
- if (filter == NULL) {
- return NULL;
- }
-
- /* encoding structure */
- filter->encoding = mbfl_no2encoding(encoding);
- if (filter->encoding == NULL) {
- filter->encoding = &mbfl_encoding_pass;
- }
-
- filter->status = 0;
- filter->flag = 0;
- filter->score = 0;
-
- /* setup the function table */
- mbfl_identify_filter_select_vtbl(filter);
-
- /* constructor */
- (*filter->filter_ctor)(filter);
-
- return filter;
-}
-
-void
-mbfl_identify_filter_delete(mbfl_identify_filter *filter)
-{
- if (filter) {
- (*filter->filter_dtor)(filter);
- mbfl_free((void*)filter);
- }
-}
-
-
-
-/*
- * buffering converter
- */
-mbfl_buffer_converter *
-mbfl_buffer_converter_new(
- enum mbfl_no_encoding from,
- enum mbfl_no_encoding to,
- int buf_initsz)
-{
- mbfl_buffer_converter *convd;
-
- /* allocate */
- convd = (mbfl_buffer_converter*)mbfl_malloc(sizeof (mbfl_buffer_converter));
- if (convd == NULL) {
- return NULL;
- }
-
- /* initialize */
- convd->from = mbfl_no2encoding(from);
- convd->to = mbfl_no2encoding(to);
- if (convd->from == NULL) {
- convd->from = &mbfl_encoding_pass;
- }
- if (convd->to == NULL) {
- convd->to = &mbfl_encoding_pass;
- }
-
- /* create convert filter */
- convd->filter1 = NULL;
- convd->filter2 = NULL;
- if (mbfl_convert_filter_get_vtbl(convd->from->no_encoding, convd->to->no_encoding) != NULL) {
- convd->filter1 = mbfl_convert_filter_new(convd->from->no_encoding, convd->to->no_encoding, mbfl_memory_device_output, 0, &convd->device);
- } else {
- convd->filter2 = mbfl_convert_filter_new(mbfl_no_encoding_wchar, convd->to->no_encoding, mbfl_memory_device_output, 0, &convd->device);
- if (convd->filter2 != NULL) {
- convd->filter1 = mbfl_convert_filter_new(convd->from->no_encoding, mbfl_no_encoding_wchar, (int (*)(int, void*))convd->filter2->filter_function, NULL, convd->filter2);
- if (convd->filter1 == NULL) {
- mbfl_convert_filter_delete(convd->filter2);
- }
- }
- }
- if (convd->filter1 == NULL) {
- return NULL;
- }
-
- mbfl_memory_device_init(&convd->device, buf_initsz, buf_initsz/4);
-
- return convd;
-}
-
-void
-mbfl_buffer_converter_delete(mbfl_buffer_converter *convd)
-{
- if (convd != NULL) {
- if (convd->filter1) {
- mbfl_convert_filter_delete(convd->filter1);
- }
- if (convd->filter2) {
- mbfl_convert_filter_delete(convd->filter2);
- }
- mbfl_memory_device_clear(&convd->device);
- mbfl_free((void*)convd);
- }
-}
-
-void
-mbfl_buffer_converter_reset(mbfl_buffer_converter *convd)
-{
- mbfl_memory_device_reset(&convd->device);
-}
-
-int
-mbfl_buffer_converter_illegal_mode(mbfl_buffer_converter *convd, int mode)
-{
- if (convd != NULL) {
- if (convd->filter2 != NULL) {
- convd->filter2->illegal_mode = mode;
- } else if (convd->filter1 != NULL) {
- convd->filter1->illegal_mode = mode;
- } else {
- return 0;
- }
- }
-
- return 1;
-}
-
-int
-mbfl_buffer_converter_illegal_substchar(mbfl_buffer_converter *convd, int substchar)
-{
- if (convd != NULL) {
- if (convd->filter2 != NULL) {
- convd->filter2->illegal_substchar = substchar;
- } else if (convd->filter1 != NULL) {
- convd->filter1->illegal_substchar = substchar;
- } else {
- return 0;
- }
- }
-
- return 1;
-}
-
-int
-mbfl_buffer_converter_strncat(mbfl_buffer_converter *convd, const unsigned char *p, int n)
-{
- mbfl_convert_filter *filter;
- int (*filter_function)(int c, mbfl_convert_filter *filter);
-
- if (convd != NULL && p != NULL) {
- filter = convd->filter1;
- if (filter != NULL) {
- filter_function = filter->filter_function;
- while (n > 0) {
- if ((*filter_function)(*p++, filter) < 0) {
- break;
- }
- n--;
- }
- }
- }
-
- return n;
-}
-
-int
-mbfl_buffer_converter_feed(mbfl_buffer_converter *convd, mbfl_string *string)
-{
- int n;
- unsigned char *p;
- mbfl_convert_filter *filter;
- int (*filter_function)(int c, mbfl_convert_filter *filter);
-
- if (convd == NULL || string == NULL) {
- return -1;
- }
- mbfl_memory_device_realloc(&convd->device, convd->device.pos + string->len, string->len/4);
- /* feed data */
- n = string->len;
- p = string->val;
- filter = convd->filter1;
- if (filter != NULL) {
- filter_function = filter->filter_function;
- while (n > 0) {
- if ((*filter_function)(*p++, filter) < 0) {
- return -1;
- }
- n--;
- }
- }
-
- return 0;
-}
-
-int
-mbfl_buffer_converter_flush(mbfl_buffer_converter *convd)
-{
- if (convd == NULL) {
- return -1;
- }
-
- if (convd->filter1 != NULL) {
- mbfl_convert_filter_flush(convd->filter1);
- }
- if (convd->filter2 != NULL) {
- mbfl_convert_filter_flush(convd->filter2);
- }
-
- return 0;
-}
-
-mbfl_string *
-mbfl_buffer_converter_getbuffer(mbfl_buffer_converter *convd, mbfl_string *result)
-{
- if (convd != NULL && result != NULL && convd->device.buffer != NULL) {
- result->no_encoding = convd->to->no_encoding;
- result->val = convd->device.buffer;
- result->len = convd->device.pos;
- } else {
- result = NULL;
- }
-
- return result;
-}
-
-mbfl_string *
-mbfl_buffer_converter_result(mbfl_buffer_converter *convd, mbfl_string *result)
-{
- if (convd == NULL || result == NULL) {
- return NULL;
- }
- result->no_encoding = convd->to->no_encoding;
- return mbfl_memory_device_result(&convd->device, result);
-}
-
-mbfl_string *
-mbfl_buffer_converter_feed_result(mbfl_buffer_converter *convd, mbfl_string *string, mbfl_string *result)
-{
- if (convd == NULL || string == NULL || result == NULL) {
- return NULL;
- }
- mbfl_buffer_converter_feed(convd, string);
- if (convd->filter1 != NULL) {
- mbfl_convert_filter_flush(convd->filter1);
- }
- if (convd->filter2 != NULL) {
- mbfl_convert_filter_flush(convd->filter2);
- }
- result->no_encoding = convd->to->no_encoding;
- return mbfl_memory_device_result(&convd->device, result);
-}
-
-
-/*
- * encoding detector
- */
-mbfl_encoding_detector *
-mbfl_encoding_detector_new(enum mbfl_no_encoding *elist, int eliztsz)
-{
- mbfl_encoding_detector *identd;
-
- int i, num;
- mbfl_identify_filter *filter;
-
- if (elist == NULL || eliztsz <= 0) {
- return NULL;
- }
-
- /* allocate */
- identd = (mbfl_encoding_detector*)mbfl_malloc(sizeof(mbfl_encoding_detector));
- if (identd == NULL) {
- return NULL;
- }
- identd->filter_list = (mbfl_identify_filter **)mbfl_calloc(eliztsz, sizeof(mbfl_identify_filter *));
- if (identd->filter_list == NULL) {
- mbfl_free(identd);
- return NULL;
- }
-
- /* create filters */
- i = 0;
- num = 0;
- while (i < eliztsz) {
- filter = mbfl_identify_filter_new(elist[i]);
- if (filter != NULL) {
- identd->filter_list[num] = filter;
- num++;
- }
- i++;
- }
- identd->filter_list_size = num;
-
- return identd;
-}
-
-void
-mbfl_encoding_detector_delete(mbfl_encoding_detector *identd)
-{
- int i;
-
- if (identd != NULL) {
- if (identd->filter_list != NULL) {
- i = identd->filter_list_size;
- while (i > 0) {
- i--;
- mbfl_identify_filter_delete(identd->filter_list[i]);
- }
- mbfl_free((void *)identd->filter_list);
- }
- mbfl_free((void *)identd);
- }
-}
-
-int
-mbfl_encoding_detector_feed(mbfl_encoding_detector *identd, mbfl_string *string)
-{
- int i, n, num, bad, res;
- unsigned char *p;
- mbfl_identify_filter *filter;
-
- res = 0;
- /* feed data */
- if (identd != NULL && string != NULL && string->val != NULL) {
- num = identd->filter_list_size;
- n = string->len;
- p = string->val;
- while (n > 0) {
- i = 0;
- bad = 0;
- while (i < num) {
- filter = identd->filter_list[i];
- (*filter->filter_function)(*p, filter);
- if (filter->flag) {
- bad++;
- }
- i++;
- }
- if ((num - 1) <= bad) {
- res = 1;
- break;
- }
- p++;
- n--;
- }
- }
-
- return res;
-}
-
-enum mbfl_no_encoding mbfl_encoding_detector_judge(mbfl_encoding_detector *identd)
-{
- mbfl_identify_filter *filter;
- enum mbfl_no_encoding encoding;
- int n;
-
- /* judge */
- encoding = mbfl_no_encoding_invalid;
- if (identd != NULL) {
- n = identd->filter_list_size - 1;
- while (n >= 0) {
- filter = identd->filter_list[n];
- if (!filter->flag) {
- encoding = filter->encoding->no_encoding;
- }
- n--;
- }
- }
-
- return encoding;
-}
-
-
-/*
- * encoding converter
- */
-mbfl_string *
-mbfl_convert_encoding(
- mbfl_string *string,
- mbfl_string *result,
- enum mbfl_no_encoding toenc)
-{
- int n;
- unsigned char *p;
- mbfl_encoding *encoding;
- mbfl_memory_device device;
- mbfl_convert_filter *filter1;
- mbfl_convert_filter *filter2;
-
- /* initialize */
- encoding = mbfl_no2encoding(toenc);
- if (encoding == NULL || string == NULL || result == NULL) {
- return NULL;
- }
-
- filter1 = NULL;
- filter2 = NULL;
- if (mbfl_convert_filter_get_vtbl(string->no_encoding, toenc) != NULL) {
- filter1 = mbfl_convert_filter_new(string->no_encoding, toenc, mbfl_memory_device_output, 0, &device);
- } else {
- filter2 = mbfl_convert_filter_new(mbfl_no_encoding_wchar, toenc, mbfl_memory_device_output, 0, &device);
- if (filter2 != NULL) {
- filter1 = mbfl_convert_filter_new(string->no_encoding, mbfl_no_encoding_wchar, (int (*)(int, void*))filter2->filter_function, NULL, filter2);
- if (filter1 == NULL) {
- mbfl_convert_filter_delete(filter2);
- }
- }
- }
- if (filter1 == NULL) {
- return NULL;
- }
- filter2->illegal_mode = MBFL_OUTPUTFILTER_ILLEGAL_MODE_CHAR;
- filter2->illegal_substchar = 0x3f; /* '?' */
- mbfl_memory_device_init(&device, string->len, (string->len >> 2) + 8);
-
- /* feed data */
- n = string->len;
- p = string->val;
- if (p != NULL) {
- while (n > 0) {
- if ((*filter1->filter_function)(*p++, filter1) < 0) {
- break;
- }
- n--;
- }
- }
-
- mbfl_convert_filter_flush(filter1);
- mbfl_convert_filter_delete(filter1);
- if (filter2 != NULL) {
- mbfl_convert_filter_flush(filter2);
- mbfl_convert_filter_delete(filter2);
- }
-
- return mbfl_memory_device_result(&device, result);
-}
-
-
-/*
- * identify encoding
- */
-mbfl_encoding *
-mbfl_identify_encoding(mbfl_string *string, enum mbfl_no_encoding *elist, int eliztsz)
-{
- int i, n, num, bad;
- unsigned char *p;
- struct mbfl_identify_vtbl *vtbl;
- mbfl_identify_filter *flist, *filter;
- mbfl_encoding *encoding;
-
- /* initialize */
- flist = (mbfl_identify_filter *)mbfl_calloc(eliztsz, sizeof(mbfl_identify_filter));
- if (flist == NULL) {
- return NULL;
- }
- i = 0;
- num = 0;
- if (elist != NULL) {
- while (i < eliztsz) {
- vtbl = mbfl_identify_filter_get_vtbl(elist[i]);
- if (vtbl != NULL) {
- filter = &flist[num];
- mbfl_identify_filter_set_vtbl(filter, vtbl);
- filter->encoding = mbfl_no2encoding(vtbl->encoding);
- (*filter->filter_ctor)(filter);
- num++;
- }
- i++;
- }
- }
-
- /* feed data */
- n = string->len;
- p = string->val;
- if (p != NULL) {
- while (n > 0) {
- i = 0;
- bad = 0;
- while (i < num) {
- filter = &flist[i];
- (*filter->filter_function)(*p, filter);
- if (filter->flag) {
- bad++;
- }
- i++;
- }
- if ((num - 1) <= bad) {
- break;
- }
- p++;
- n--;
- }
- }
-
- /* judge */
- i = num - 1;
- bad = 1;
- encoding = NULL;
- while (i >= 0) {
- filter = &flist[i];
- if (filter->flag) {
- bad++;
- } else {
- encoding = filter->encoding;
- }
- i--;
- }
-#if 0
- if (bad < num) {
- encoding = NULL;
- }
-#endif
-
- i = 0;
- while (i < num) {
- filter = &flist[i];
- (*filter->filter_dtor)(filter);
- i++;
- }
- mbfl_free((void *)flist);
-
- return encoding;
-}
-
-const char*
-mbfl_identify_encoding_name(mbfl_string *string, enum mbfl_no_encoding *elist, int eliztsz)
-{
- mbfl_encoding *encoding;
-
- encoding = mbfl_identify_encoding(string, elist, eliztsz);
- if (encoding != NULL &&
- encoding->no_encoding > mbfl_no_encoding_charset_min &&
- encoding->no_encoding < mbfl_no_encoding_charset_max) {
- return encoding->name;
- } else {
- return NULL;
- }
-}
-
-enum mbfl_no_encoding
-mbfl_identify_encoding_no(mbfl_string *string, enum mbfl_no_encoding *elist, int eliztsz)
-{
- mbfl_encoding *encoding;
-
- encoding = mbfl_identify_encoding(string, elist, eliztsz);
- if (encoding != NULL &&
- encoding->no_encoding > mbfl_no_encoding_charset_min &&
- encoding->no_encoding < mbfl_no_encoding_charset_max) {
- return encoding->no_encoding;
- } else {
- return mbfl_no_encoding_invalid;
- }
-}
-
-
-/*
- * strlen
- */
-static int
-filter_count_output(int c, void *data)
-{
- (*(int *)data)++;
- return c;
-}
-
-int
-mbfl_strlen(mbfl_string *string)
-{
- int len, n, m, k;
- unsigned char *p;
- const unsigned char *mbtab;
- mbfl_encoding *encoding;
-
- encoding = mbfl_no2encoding(string->no_encoding);
- if (encoding == NULL || string == NULL) {
- return -1;
- }
-
- len = 0;
- if (encoding->flag & MBFL_ENCTYPE_SBCS) {
- len = string->len;
- } else if (encoding->flag & (MBFL_ENCTYPE_WCS2BE | MBFL_ENCTYPE_WCS2LE)) {
- len = string->len/2;
- } else if (encoding->flag & (MBFL_ENCTYPE_WCS4BE | MBFL_ENCTYPE_WCS4LE)) {
- len = string->len/4;
- } else if (encoding->mblen_table != NULL) {
- mbtab = encoding->mblen_table;
- n = 0;
- p = string->val;
- k = string->len;
- /* count */
- if (p != NULL) {
- while (n < k) {
- m = mbtab[*p];
- n += m;
- p += m;
- len++;
- };
- }
- } else {
- /* wchar filter */
- mbfl_convert_filter *filter = mbfl_convert_filter_new(
- string->no_encoding,
- mbfl_no_encoding_wchar,
- filter_count_output, 0, &len);
- if (filter == NULL) {
- return -1;
- }
- /* count */
- n = string->len;
- p = string->val;
- if (p != NULL) {
- while (n > 0) {
- (*filter->filter_function)(*p++, filter);
- n--;
- }
- }
- mbfl_convert_filter_delete(filter);
- }
-
- return len;
-}
-
-
-/*
- * strpos
- */
-struct collector_strpos_data {
- mbfl_convert_filter *next_filter;
- mbfl_wchar_device needle;
- int needle_len;
- int start;
- int output;
- int found_pos;
- int needle_pos;
- int matched_pos;
-};
-
-static int
-collector_strpos(int c, void* data)
-{
- int *p, *h, *m, n;
- struct collector_strpos_data *pc = (struct collector_strpos_data*)data;
-
- if (pc->output >= pc->start) {
- if (c == pc->needle.buffer[pc->needle_pos]) {
- if (pc->needle_pos == 0) {
- pc->found_pos = pc->output; /* found position */
- }
- pc->needle_pos++; /* needle pointer */
- if (pc->needle_pos >= pc->needle_len) {
- pc->matched_pos = pc->found_pos; /* matched position */
- pc->needle_pos--;
- goto retry;
- }
- } else if (pc->needle_pos != 0) {
-retry:
- h = pc->needle.buffer;
- h++;
- for (;;) {
- pc->found_pos++;
- p = h;
- m = pc->needle.buffer;
- n = pc->needle_pos - 1;
- while (n > 0 && *p == *m) {
- n--;
- p++;
- m++;
- }
- if (n <= 0) {
- if (*m != c) {
- pc->needle_pos = 0;
- }
- break;
- } else {
- h++;
- pc->needle_pos--;
- }
- }
- }
- }
-
- pc->output++;
- return c;
-}
-
-int
-mbfl_strpos(
- mbfl_string *haystack,
- mbfl_string *needle,
- int offset,
- int reverse)
-{
- int n, result;
- unsigned char *p;
- mbfl_convert_filter *filter;
- struct collector_strpos_data pc;
-
- if (haystack == NULL || needle == NULL) {
- return -8;
- }
- /* needle is converted into wchar */
- mbfl_wchar_device_init(&pc.needle);
- filter = mbfl_convert_filter_new(
- needle->no_encoding,
- mbfl_no_encoding_wchar,
- mbfl_wchar_device_output, 0, &pc.needle);
- if (filter == NULL) {
- return -4;
- }
- p = needle->val;
- n = needle->len;
- if (p != NULL) {
- while (n > 0) {
- if ((*filter->filter_function)(*p++, filter) < 0) {
- break;
- }
- n--;
- }
- }
- mbfl_convert_filter_flush(filter);
- mbfl_convert_filter_delete(filter);
- pc.needle_len = pc.needle.pos;
- if (pc.needle.buffer == NULL) {
- return -4;
- }
- if (pc.needle_len <= 0) {
- mbfl_wchar_device_clear(&pc.needle);
- return -2;
- }
- /* initialize filter and collector data */
- filter = mbfl_convert_filter_new(
- haystack->no_encoding,
- mbfl_no_encoding_wchar,
- collector_strpos, 0, &pc);
- if (filter == NULL) {
- mbfl_wchar_device_clear(&pc.needle);
- return -4;
- }
- pc.start = offset;
- pc.output = 0;
- pc.needle_pos = 0;
- pc.found_pos = 0;
- pc.matched_pos = -1;
-
- /* feed data */
- p = haystack->val;
- n = haystack->len;
- if (p != NULL) {
- while (n > 0) {
- if ((*filter->filter_function)(*p++, filter) < 0) {
- pc.matched_pos = -4;
- break;
- }
- if (pc.matched_pos >= 0 && !reverse) {
- break;
- }
- n--;
- }
- }
- mbfl_convert_filter_flush(filter);
- result = pc.matched_pos;
- mbfl_convert_filter_delete(filter);
- mbfl_wchar_device_clear(&pc.needle);
-
- return result;
-}
-
-
-/*
- * substr
- */
-struct collector_substr_data {
- mbfl_convert_filter *next_filter;
- int start;
- int stop;
- int output;
-};
-
-static int
-collector_substr(int c, void* data)
-{
- struct collector_substr_data *pc = (struct collector_substr_data*)data;
-
- if (pc->output >= pc->stop) {
- return -1;
- }
-
- if (pc->output >= pc->start) {
- (*pc->next_filter->filter_function)(c, pc->next_filter);
- }
-
- pc->output++;
-
- return c;
-}
-
-mbfl_string *
-mbfl_substr(
- mbfl_string *string,
- mbfl_string *result,
- int from,
- int length)
-{
- mbfl_encoding *encoding;
- int n, m, k, len, start, end;
- unsigned char *p, *w;
- const unsigned char *mbtab;
-
- encoding = mbfl_no2encoding(string->no_encoding);
- if (encoding == NULL || string == NULL || result == NULL) {
- return NULL;
- }
- mbfl_string_init(result);
- result->no_language = string->no_language;
- result->no_encoding = string->no_encoding;
-
- if ((encoding->flag & (MBFL_ENCTYPE_SBCS | MBFL_ENCTYPE_WCS2BE | MBFL_ENCTYPE_WCS2LE | MBFL_ENCTYPE_WCS4BE | MBFL_ENCTYPE_WCS4LE)) ||
- encoding->mblen_table != NULL) {
- len = string->len;
- start = from;
- end = from + length;
- if (encoding->flag & (MBFL_ENCTYPE_WCS2BE | MBFL_ENCTYPE_MWC2LE)) {
- start *= 2;
- end = start + length*2;
- } else if (encoding->flag & (MBFL_ENCTYPE_WCS4BE | MBFL_ENCTYPE_MWC4LE)) {
- start *= 4;
- end = start + length*4;
- } else if (encoding->mblen_table != NULL) {
- mbtab = encoding->mblen_table;
- start = 0;
- end = 0;
- n = 0;
- k = 0;
- p = string->val;
- if (p != NULL) {
- /* search start position */
- while (k <= from) {
- start = n;
- if (n >= len) {
- break;
- }
- m = mbtab[*p];
- n += m;
- p += m;
- k++;
- }
- /* detect end position */
- k = 0;
- end = start;
- while (k < length) {
- end = n;
- if (n >= len) {
- break;
- }
- m = mbtab[*p];
- n += m;
- p += m;
- k++;
- }
- }
- }
-
- if (start > len) {
- start = len;
- }
- if (start < 0) {
- start = 0;
- }
- if (end > len) {
- end = len;
- }
- if (end < 0) {
- end = 0;
- }
- if (start > end) {
- start = end;
- }
-
- /* allocate memory and copy */
- n = end - start;
- result->len = 0;
- result->val = w = (unsigned char*)mbfl_malloc((n + 8)*sizeof(unsigned char));
- if (w != NULL) {
- p = string->val;
- if (p != NULL) {
- p += start;
- result->len = n;
- while (n > 0) {
- *w++ = *p++;
- n--;
- }
- }
- *w++ = '\0';
- *w++ = '\0';
- *w++ = '\0';
- *w = '\0';
- } else {
- result = NULL;
- }
- } else {
- mbfl_memory_device device;
- struct collector_substr_data pc;
- mbfl_convert_filter *decoder;
- mbfl_convert_filter *encoder;
-
- mbfl_memory_device_init(&device, length + 1, 0);
- mbfl_string_init(result);
- result->no_language = string->no_language;
- result->no_encoding = string->no_encoding;
- /* output code filter */
- decoder = mbfl_convert_filter_new(
- mbfl_no_encoding_wchar,
- string->no_encoding,
- mbfl_memory_device_output, 0, &device);
- /* wchar filter */
- encoder = mbfl_convert_filter_new(
- string->no_encoding,
- mbfl_no_encoding_wchar,
- collector_substr, 0, &pc);
- if (decoder == NULL || encoder == NULL) {
- mbfl_convert_filter_delete(encoder);
- mbfl_convert_filter_delete(decoder);
- return NULL;
- }
- pc.next_filter = decoder;
- pc.start = from;
- pc.stop = from + length;
- pc.output = 0;
-
- /* feed data */
- p = string->val;
- n = string->len;
- if (p != NULL) {
- while (n > 0) {
- if ((*encoder->filter_function)(*p++, encoder) < 0) {
- break;
- }
- n--;
- }
- }
-
- mbfl_convert_filter_flush(encoder);
- mbfl_convert_filter_flush(decoder);
- result = mbfl_memory_device_result(&device, result);
- mbfl_convert_filter_delete(encoder);
- mbfl_convert_filter_delete(decoder);
- }
-
- return result;
-}
-
-
-/*
- * strcut
- */
-mbfl_string *
-mbfl_strcut(
- mbfl_string *string,
- mbfl_string *result,
- int from,
- int length)
-{
- mbfl_encoding *encoding;
- int n, m, k, len, start, end;
- unsigned char *p, *w;
- const unsigned char *mbtab;
- mbfl_memory_device device;
- mbfl_convert_filter *encoder, *encoder_tmp, *decoder, *decoder_tmp;
-
- encoding = mbfl_no2encoding(string->no_encoding);
- if (encoding == NULL || string == NULL || result == NULL) {
- return NULL;
- }
- mbfl_string_init(result);
- result->no_language = string->no_language;
- result->no_encoding = string->no_encoding;
-
- if ((encoding->flag & (MBFL_ENCTYPE_SBCS | MBFL_ENCTYPE_WCS2BE | MBFL_ENCTYPE_WCS2LE | MBFL_ENCTYPE_WCS4BE | MBFL_ENCTYPE_WCS4LE)) ||
- encoding->mblen_table != NULL) {
- len = string->len;
- start = from;
- end = from + length;
- if (encoding->flag & (MBFL_ENCTYPE_WCS2BE | MBFL_ENCTYPE_WCS2LE)) {
- start /= 2;
- start *= 2;
- end = length/2;
- end *= 2;
- end += start;
- } else if (encoding->flag & (MBFL_ENCTYPE_WCS4BE | MBFL_ENCTYPE_WCS4LE)) {
- start /= 4;
- start *= 4;
- end = length/4;
- end *= 4;
- end += start;
- } else if (encoding->mblen_table != NULL) {
- mbtab = encoding->mblen_table;
- start = 0;
- end = 0;
- n = 0;
- p = string->val;
- if (p != NULL) {
- /* search start position */
- for (;;) {
- m = mbtab[*p];
- n += m;
- p += m;
- if (n > from) {
- break;
- }
- start = n;
- }
- /* search end position */
- k = start + length;
- if (k >= string->len) {
- end = string->len;
- } else {
- end = start;
- while (n <= k) {
- end = n;
- m = mbtab[*p];
- n += m;
- p += m;
- }
- }
- }
- }
-
- if (start > len) {
- start = len;
- }
- if (start < 0) {
- start = 0;
- }
- if (end > len) {
- end = len;
- }
- if (end < 0) {
- end = 0;
- }
- if (start > end) {
- start = end;
- }
- /* allocate memory and copy string */
- n = end - start;
- result->len = 0;
- result->val = w = (unsigned char*)mbfl_malloc((n + 8)*sizeof(unsigned char));
- if (w != NULL) {
- result->len = n;
- p = &(string->val[start]);
- while (n > 0) {
- *w++ = *p++;
- n--;
- }
- *w++ = '\0';
- *w++ = '\0';
- *w++ = '\0';
- *w = '\0';
- } else {
- result = NULL;
- }
- } else {
- /* wchar filter */
- encoder = mbfl_convert_filter_new(
- string->no_encoding,
- mbfl_no_encoding_wchar,
- mbfl_filter_output_null, 0, 0);
- encoder_tmp = mbfl_convert_filter_new(
- string->no_encoding,
- mbfl_no_encoding_wchar,
- mbfl_filter_output_null, 0, 0);
- /* output code filter */
- decoder = mbfl_convert_filter_new(
- mbfl_no_encoding_wchar,
- string->no_encoding,
- mbfl_memory_device_output, 0, &device);
- decoder_tmp = mbfl_convert_filter_new(
- mbfl_no_encoding_wchar,
- string->no_encoding,
- mbfl_memory_device_output, 0, &device);
- if (encoder == NULL || encoder_tmp == NULL || decoder == NULL || decoder_tmp == NULL) {
- mbfl_convert_filter_delete(encoder);
- mbfl_convert_filter_delete(encoder_tmp);
- mbfl_convert_filter_delete(decoder);
- mbfl_convert_filter_delete(decoder_tmp);
- return NULL;
- }
- mbfl_memory_device_init(&device, length + 8, 0);
- k = 0;
- n = 0;
- p = string->val;
- if (p != NULL) {
- /* seartch start position */
- while (n < from) {
- (*encoder->filter_function)(*p++, encoder);
- n++;
- }
- /* output a little shorter than "length" */
- encoder->output_function = mbfl_filter_output_pipe;
- encoder->data = decoder;
- k = length - 20;
- len = string->len;
- while (n < len && device.pos < k) {
- (*encoder->filter_function)(*p++, encoder);
- n++;
- }
- /* detect end position */
- for (;;) {
- /* backup current state */
- k = device.pos;
- mbfl_convert_filter_copy(encoder, encoder_tmp);
- mbfl_convert_filter_copy(decoder, decoder_tmp);
- if (n >= len) {
- break;
- }
- /* feed 1byte and flush */
- (*encoder->filter_function)(*p, encoder);
- (*encoder->filter_flush)(encoder);
- (*decoder->filter_flush)(decoder);
- if (device.pos > length) {
- break;
- }
- /* restore filter and re-feed data */
- device.pos = k;
- mbfl_convert_filter_copy(encoder_tmp, encoder);
- mbfl_convert_filter_copy(decoder_tmp, decoder);
- (*encoder->filter_function)(*p, encoder);
- p++;
- n++;
- }
- device.pos = k;
- mbfl_convert_filter_copy(encoder_tmp, encoder);
- mbfl_convert_filter_copy(decoder_tmp, decoder);
- mbfl_convert_filter_flush(encoder);
- mbfl_convert_filter_flush(decoder);
- }
- result = mbfl_memory_device_result(&device, result);
- mbfl_convert_filter_delete(encoder);
- mbfl_convert_filter_delete(encoder_tmp);
- mbfl_convert_filter_delete(decoder);
- mbfl_convert_filter_delete(decoder_tmp);
- }
-
- return result;
-}
-
-
-/*
- * strwidth
- */
-static int
-filter_count_width(int c, void* data)
-{
- if (c >= 0x20) {
- if (c < 0x2000 || (c > 0xff60 && c < 0xffa0)) {
- (*(int *)data)++;
- } else {
- (*(int *)data) += 2;
- }
- }
-
- return c;
-}
-
-int
-mbfl_strwidth(mbfl_string *string)
-{
- int len, n;
- unsigned char *p;
- mbfl_convert_filter *filter;
-
- len = 0;
- if (string->len > 0 && string->val != NULL) {
- /* wchar filter */
- filter = mbfl_convert_filter_new(
- string->no_encoding,
- mbfl_no_encoding_wchar,
- filter_count_width, 0, &len);
- if (filter == NULL) {
- mbfl_convert_filter_delete(filter);
- return -1;
- }
-
- /* feed data */
- p = string->val;
- n = string->len;
- while (n > 0) {
- (*filter->filter_function)(*p++, filter);
- n--;
- }
-
- mbfl_convert_filter_flush(filter);
- mbfl_convert_filter_delete(filter);
- }
-
- return len;
-}
-
-
-/*
- * strimwidth
- */
-struct collector_strimwidth_data {
- mbfl_convert_filter *decoder;
- mbfl_convert_filter *decoder_backup;
- mbfl_memory_device device;
- int from;
- int width;
- int outwidth;
- int outchar;
- int status;
- int endpos;
-};
-
-static int
-collector_strimwidth(int c, void* data)
-{
- struct collector_strimwidth_data *pc = (struct collector_strimwidth_data*)data;
-
- switch (pc->status) {
- case 10:
- (*pc->decoder->filter_function)(c, pc->decoder);
- break;
- default:
- if (pc->outchar >= pc->from) {
- if (c >= 0x20) {
- if (c < 0x2000 || (c > 0xff60 && c < 0xffa0)) {
- pc->outwidth++;
- } else {
- pc->outwidth += 2;
- }
- }
- if (pc->outwidth > pc->width) {
- if (pc->status == 0) {
- pc->endpos = pc->device.pos;
- mbfl_convert_filter_copy(pc->decoder, pc->decoder_backup);
- }
- pc->status++;
- (*pc->decoder->filter_function)(c, pc->decoder);
- c = -1;
- } else {
- (*pc->decoder->filter_function)(c, pc->decoder);
- }
- }
- pc->outchar++;
- break;
- }
-
- return c;
-}
-
-mbfl_string *
-mbfl_strimwidth(
- mbfl_string *string,
- mbfl_string *marker,
- mbfl_string *result,
- int from,
- int width)
-{
- struct collector_strimwidth_data pc;
- mbfl_convert_filter *encoder;
- int n, mkwidth;
- unsigned char *p;
-
- if (string == NULL || result == NULL) {
- return NULL;
- }
- mbfl_string_init(result);
- result->no_language = string->no_language;
- result->no_encoding = string->no_encoding;
- mbfl_memory_device_init(&pc.device, width, 0);
-
- /* output code filter */
- pc.decoder = mbfl_convert_filter_new(
- mbfl_no_encoding_wchar,
- string->no_encoding,
- mbfl_memory_device_output, 0, &pc.device);
- pc.decoder_backup = mbfl_convert_filter_new(
- mbfl_no_encoding_wchar,
- string->no_encoding,
- mbfl_memory_device_output, 0, &pc.device);
- /* wchar filter */
- encoder = mbfl_convert_filter_new(
- string->no_encoding,
- mbfl_no_encoding_wchar,
- collector_strimwidth, 0, &pc);
- if (pc.decoder == NULL || pc.decoder_backup == NULL || encoder == NULL) {
- mbfl_convert_filter_delete(encoder);
- mbfl_convert_filter_delete(pc.decoder);
- mbfl_convert_filter_delete(pc.decoder_backup);
- return NULL;
- }
- mkwidth = 0;
- if (marker) {
- mkwidth = mbfl_strwidth(marker);
- }
- pc.from = from;
- pc.width = width - mkwidth;
- pc.outwidth = 0;
- pc.outchar = 0;
- pc.status = 0;
- pc.endpos = 0;
-
- /* feed data */
- p = string->val;
- n = string->len;
- if (p != NULL) {
- while (n > 0) {
- if ((*encoder->filter_function)(*p++, encoder) < 0) {
- break;
- }
- n--;
- }
- mbfl_convert_filter_flush(encoder);
- if (pc.status != 0 && mkwidth > 0) {
- pc.width += mkwidth;
- while (n > 0) {
- if ((*encoder->filter_function)(*p++, encoder) < 0) {
- break;
- }
- n--;
- }
- mbfl_convert_filter_flush(encoder);
- if (pc.status != 1) {
- pc.status = 10;
- pc.device.pos = pc.endpos;
- mbfl_convert_filter_copy(pc.decoder_backup, pc.decoder);
- mbfl_convert_filter_reset(encoder, marker->no_encoding, mbfl_no_encoding_wchar);
- p = marker->val;
- n = marker->len;
- while (n > 0) {
- if ((*encoder->filter_function)(*p++, encoder) < 0) {
- break;
- }
- n--;
- }
- mbfl_convert_filter_flush(encoder);
- }
- } else if (pc.status != 0) {
- pc.device.pos = pc.endpos;
- mbfl_convert_filter_copy(pc.decoder_backup, pc.decoder);
- }
- mbfl_convert_filter_flush(pc.decoder);
- }
- result = mbfl_memory_device_result(&pc.device, result);
- mbfl_convert_filter_delete(encoder);
- mbfl_convert_filter_delete(pc.decoder);
- mbfl_convert_filter_delete(pc.decoder_backup);
-
- return result;
-}
-
-
-
-/*
- * convert Hankaku and Zenkaku
- */
-struct collector_hantozen_data {
- mbfl_convert_filter *next_filter;
- int mode;
- int status;
- int cache;
-};
-
-static const unsigned char hankana2zenkata_table[64] = {
- 0x00,0x02,0x0C,0x0D,0x01,0xFB,0xF2,0xA1,0xA3,0xA5,
- 0xA7,0xA9,0xE3,0xE5,0xE7,0xC3,0xFC,0xA2,0xA4,0xA6,
- 0xA8,0xAA,0xAB,0xAD,0xAF,0xB1,0xB3,0xB5,0xB7,0xB9,
- 0xBB,0xBD,0xBF,0xC1,0xC4,0xC6,0xC8,0xCA,0xCB,0xCC,
- 0xCD,0xCE,0xCF,0xD2,0xD5,0xD8,0xDB,0xDE,0xDF,0xE0,
- 0xE1,0xE2,0xE4,0xE6,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,
- 0xEF,0xF3,0x9B,0x9C
-};
-static const unsigned char hankana2zenhira_table[64] = {
- 0x00,0x02,0x0C,0x0D,0x01,0xFB,0x92,0x41,0x43,0x45,
- 0x47,0x49,0x83,0x85,0x87,0x63,0xFC,0x42,0x44,0x46,
- 0x48,0x4A,0x4B,0x4D,0x4F,0x51,0x53,0x55,0x57,0x59,
- 0x5B,0x5D,0x5F,0x61,0x64,0x66,0x68,0x6A,0x6B,0x6C,
- 0x6D,0x6E,0x6F,0x72,0x75,0x78,0x7B,0x7E,0x7F,0x80,
- 0x81,0x82,0x84,0x86,0x88,0x89,0x8A,0x8B,0x8C,0x8D,
- 0x8F,0x93,0x9B,0x9C
-};
-static const unsigned char zenkana2hankana_table[84][2] = {
- {0x67,0x00},{0x71,0x00},{0x68,0x00},{0x72,0x00},{0x69,0x00},
- {0x73,0x00},{0x6A,0x00},{0x74,0x00},{0x6B,0x00},{0x75,0x00},
- {0x76,0x00},{0x76,0x9E},{0x77,0x00},{0x77,0x9E},{0x78,0x00},
- {0x78,0x9E},{0x79,0x00},{0x79,0x9E},{0x7A,0x00},{0x7A,0x9E},
- {0x7B,0x00},{0x7B,0x9E},{0x7C,0x00},{0x7C,0x9E},{0x7D,0x00},
- {0x7D,0x9E},{0x7E,0x00},{0x7E,0x9E},{0x7F,0x00},{0x7F,0x9E},
- {0x80,0x00},{0x80,0x9E},{0x81,0x00},{0x81,0x9E},{0x6F,0x00},
- {0x82,0x00},{0x82,0x9E},{0x83,0x00},{0x83,0x9E},{0x84,0x00},
- {0x84,0x9E},{0x85,0x00},{0x86,0x00},{0x87,0x00},{0x88,0x00},
- {0x89,0x00},{0x8A,0x00},{0x8A,0x9E},{0x8A,0x9F},{0x8B,0x00},
- {0x8B,0x9E},{0x8B,0x9F},{0x8C,0x00},{0x8C,0x9E},{0x8C,0x9F},
- {0x8D,0x00},{0x8D,0x9E},{0x8D,0x9F},{0x8E,0x00},{0x8E,0x9E},
- {0x8E,0x9F},{0x8F,0x00},{0x90,0x00},{0x91,0x00},{0x92,0x00},
- {0x93,0x00},{0x6C,0x00},{0x94,0x00},{0x6D,0x00},{0x95,0x00},
- {0x6E,0x00},{0x96,0x00},{0x97,0x00},{0x98,0x00},{0x99,0x00},
- {0x9A,0x00},{0x9B,0x00},{0x9C,0x00},{0x9C,0x00},{0x72,0x00},
- {0x74,0x00},{0x66,0x00},{0x9D,0x00},{0x73,0x9E}
-};
-
-static int
-collector_hantozen(int c, void* data)
-{
- int s, mode, n;
- struct collector_hantozen_data *pc = (struct collector_hantozen_data*)data;
-
- s = c;
- mode = pc->mode;
-
- if (mode & 0xf) { /* hankaku to zenkaku */
- if ((mode & 0x1) && c >= 0x21 && c <= 0x7d && c != 0x22 && c != 0x27 && c != 0x5c) { /* all except <"> <'> <\> <~> */
- s = c + 0xfee0;
- } else if ((mode & 0x2) && ((c >= 0x41 && c <= 0x5a) || (c >= 0x61 && c <= 0x7a))) { /* alpha */
- s = c + 0xfee0;
- } else if ((mode & 0x4) && c >= 0x30 && c <= 0x39) { /* num */
- s = c + 0xfee0;
- } else if ((mode & 0x8) && c == 0x20) { /* spase */
- s = 0x3000;
- }
- }
-
- if (mode & 0xf0) { /* zenkaku to hankaku */
- if ((mode & 0x10) && c >= 0xff01 && c <= 0xff5d && c != 0xff02 && c != 0xff07 && c!= 0xff3c) { /* all except <"> <'> <\> <~> */
- s = c - 0xfee0;
- } else if ((mode & 0x20) && ((c >= 0xff21 && c <= 0xff3a) || (c >= 0xff41 && c <= 0xff5a))) { /* alpha */
- s = c - 0xfee0;
- } else if ((mode & 0x40) && (c >= 0xff10 && c <= 0xff19)) { /* num */
- s = c - 0xfee0;
- } else if ((mode & 0x80) && (c == 0x3000)) { /* spase */
- s = 0x20;
- } else if ((mode & 0x10) && (c == 0x2212)) { /* MINUS SIGN */
- s = 0x2d;
- }
- }
-
- if (mode & 0x300) { /* hankaku kana to zenkaku kana */
- if ((mode & 0x100) && (mode & 0x800)) { /* hankaku kana to zenkaku katakana and glue voiced sound mark */
- if (c >= 0xff61 && c <= 0xff9f) {
- if (pc->status) {
- n = (pc->cache - 0xff60) & 0x3f;
- if (c == 0xff9e && ((n >= 22 && n <= 36) || (n >= 42 && n <= 46))) {
- pc->status = 0;
- s = 0x3001 + hankana2zenkata_table[n];
- } else if (c == 0xff9e && n == 19) {
- pc->status = 0;
- s = 0x30f4;
- } else if (c == 0xff9f && (n >= 42 && n <= 46)) {
- pc->status = 0;
- s = 0x3002 + hankana2zenkata_table[n];
- } else {
- pc->status = 1;
- pc->cache = c;
- s = 0x3000 + hankana2zenkata_table[n];
- }
- } else {
- pc->status = 1;
- pc->cache = c;
- return c;
- }
- } else {
- if (pc->status) {
- n = (pc->cache - 0xff60) & 0x3f;
- pc->status = 0;
- (*pc->next_filter->filter_function)(0x3000 + hankana2zenkata_table[n], pc->next_filter);
- }
- }
- } else if ((mode & 0x200) && (mode & 0x800)) { /* hankaku kana to zenkaku hirangana and glue voiced sound mark */
- if (c >= 0xff61 && c <= 0xff9f) {
- if (pc->status) {
- n = (pc->cache - 0xff60) & 0x3f;
- if (c == 0xff9e && ((n >= 22 && n <= 36) || (n >= 42 && n <= 46))) {
- pc->status = 0;
- s = 0x3001 + hankana2zenhira_table[n];
- } else if (c == 0xff9f && (n >= 42 && n <= 46)) {
- pc->status = 0;
- s = 0x3002 + hankana2zenhira_table[n];
- } else {
- pc->status = 1;
- pc->cache = c;
- s = 0x3000 + hankana2zenhira_table[n];
- }
- } else {
- pc->status = 1;
- pc->cache = c;
- return c;
- }
- } else {
- if (pc->status) {
- n = (pc->cache - 0xff60) & 0x3f;
- pc->status = 0;
- (*pc->next_filter->filter_function)(0x3000 + hankana2zenhira_table[n], pc->next_filter);
- }
- }
- } else if ((mode & 0x100) && c >= 0xff61 && c <= 0xff9f) { /* hankaku kana to zenkaku katakana */
- s = 0x3000 + hankana2zenkata_table[c - 0xff60];
- } else if ((mode & 0x200) && c >= 0xff61 && c <= 0xff9f) { /* hankaku kana to zenkaku hirangana */
- s = 0x3000 + hankana2zenhira_table[c - 0xff60];
- }
- }
-
- if (mode & 0x3000) { /* Zenkaku kana to hankaku kana */
- if ((mode & 0x1000) && c >= 0x30a1 && c <= 0x30f4) { /* Zenkaku katakana to hankaku kana */
- n = c - 0x30a1;
- if (zenkana2hankana_table[n][1] != 0) {
- (*pc->next_filter->filter_function)(0xff00 + zenkana2hankana_table[n][0], pc->next_filter);
- s = 0xff00 + zenkana2hankana_table[n][1];
- } else {
- s = 0xff00 + zenkana2hankana_table[n][0];
- }
- } else if ((mode & 0x2000) && c >= 0x3041 && c <= 0x3093) { /* Zenkaku hirangana to hankaku kana */
- n = c - 0x3041;
- if (zenkana2hankana_table[n][1] != 0) {
- (*pc->next_filter->filter_function)(0xff00 + zenkana2hankana_table[n][0], pc->next_filter);
- s = 0xff00 + zenkana2hankana_table[n][1];
- } else {
- s = 0xff00 + zenkana2hankana_table[n][0];
- }
- } else if (c == 0x3001) {
- s = 0xff64; /* HALFWIDTH IDEOGRAPHIC COMMA */
- } else if (c == 0x3002) {
- s = 0xff61; /* HALFWIDTH IDEOGRAPHIC FULL STOP */
- } else if (c == 0x300c) {
- s = 0xff62; /* HALFWIDTH LEFT CORNER BRACKET */
- } else if (c == 0x300d) {
- s = 0xff63; /* HALFWIDTH RIGHT CORNER BRACKET */
- } else if (c == 0x309b) {
- s = 0xff9e; /* HALFWIDTH KATAKANA VOICED SOUND MARK */
- } else if (c == 0x309c) {
- s = 0xff9f; /* HALFWIDTH KATAKANA SEMI-VOICED SOUND MARK */
- } else if (c == 0x30fc) {
- s = 0xff70; /* HALFWIDTH KATAKANA-HIRAGANA PROLONGED SOUND MARK */
- } else if (c == 0x30fb) {
- s = 0xff65; /* HALFWIDTH KATAKANA MIDDLE DOT */
- }
- } else if (mode & 0x30000) {
- if ((mode & 0x10000) && c >= 0x3041 && c <= 0x3093) { /* Zenkaku hirangana to Zenkaku katakana */
- s = c + 0x60;
- } else if ((mode & 0x20000) && c >= 0x30a1 && c <= 0x30f3) { /* Zenkaku katakana to Zenkaku hirangana */
- s = c - 0x60;
- }
- }
-
- if (mode & 0x100000) { /* special ascii to symbol */
- if (c == 0x5c) {
- s = 0xffe5; /* FULLWIDTH YEN SIGN */
- } else if (c == 0xa5) { /* YEN SIGN */
- s = 0xffe5; /* FULLWIDTH YEN SIGN */
- } else if (c == 0x7e) {
- s = 0xffe3; /* FULLWIDTH MACRON */
- } else if (c == 0x203e) { /* OVERLINE */
- s = 0xffe3; /* FULLWIDTH MACRON */
- } else if (c == 0x27) {
- s = 0x2019; /* RIGHT SINGLE QUOTATION MARK */
- } else if (c == 0x22) {
- s = 0x201d; /* RIGHT DOUBLE QUOTATION MARK */
- }
- } else if (mode & 0x200000) { /* special symbol to ascii */
- if (c == 0xffe5) { /* FULLWIDTH YEN SIGN */
- s = 0x5c;
- } else if (c == 0xff3c) { /* FULLWIDTH REVERSE SOLIDUS */
- s = 0x5c;
- } else if (c == 0xffe3) { /* FULLWIDTH MACRON */
- s = 0x7e;
- } else if (c == 0x203e) { /* OVERLINE */
- s = 0x7e;
- } else if (c == 0x2018) { /* LEFT SINGLE QUOTATION MARK*/
- s = 0x27;
- } else if (c == 0x2019) { /* RIGHT SINGLE QUOTATION MARK */
- s = 0x27;
- } else if (c == 0x201c) { /* LEFT DOUBLE QUOTATION MARK */
- s = 0x22;
- } else if (c == 0x201d) { /* RIGHT DOUBLE QUOTATION MARK */
- s = 0x22;
- }
- }
-
- if (mode & 0x400000) { /* special ascii to symbol */
- if (c == 0x5c) {
- s = 0xff3c; /* FULLWIDTH REVERSE SOLIDUS */
- } else if (c == 0x7e) {
- s = 0xff5e; /* FULLWIDTH TILDE */
- } else if (c == 0x27) {
- s = 0xff07; /* FULLWIDTH APOSTROPHE */
- } else if (c == 0x22) {
- s = 0xff02; /* FULLWIDTH QUOTATION MARK */
- }
- } else if (mode & 0x800000) { /* special symbol to ascii */
- if (c == 0xff3c) { /* FULLWIDTH REVERSE SOLIDUS */
- s = 0x5c;
- } else if (c == 0xff5e) { /* FULLWIDTH TILDE */
- s = 0x7e;
- } else if (c == 0xff07) { /* FULLWIDTH APOSTROPHE */
- s = 0x27;
- } else if (c == 0xff02) { /* FULLWIDTH QUOTATION MARK */
- s = 0x22;
- }
- }
-
- return (*pc->next_filter->filter_function)(s, pc->next_filter);
-}
-
-static int
-collector_hantozen_flush(struct collector_hantozen_data *pc)
-{
- int ret, n;
-
- ret = 0;
- if (pc->status) {
- n = (pc->cache - 0xff60) & 0x3f;
- if (pc->mode & 0x100) { /* hankaku kana to zenkaku katakana */
- ret = (*pc->next_filter->filter_function)(0x3000 + hankana2zenkata_table[n], pc->next_filter);
- } else if (pc->mode & 0x200) { /* hankaku kana to zenkaku hirangana */
- ret = (*pc->next_filter->filter_function)(0x3000 + hankana2zenhira_table[n], pc->next_filter);
- }
- pc->status = 0;
- }
-
- return ret;
-}
-
-mbfl_string *
-mbfl_ja_jp_hantozen(
- mbfl_string *string,
- mbfl_string *result,
- int mode)
-{
- int n;
- unsigned char *p;
- mbfl_encoding *encoding;
- mbfl_memory_device device;
- struct collector_hantozen_data pc;
- mbfl_convert_filter *decoder;
- mbfl_convert_filter *encoder;
-
- /* initialize */
- if (string == NULL || result == NULL) {
- return NULL;
- }
- encoding = mbfl_no2encoding(string->no_encoding);
- if (encoding == NULL) {
- return NULL;
- }
- mbfl_memory_device_init(&device, string->len, 0);
- mbfl_string_init(result);
- result->no_language = string->no_language;
- result->no_encoding = string->no_encoding;
- decoder = mbfl_convert_filter_new(
- mbfl_no_encoding_wchar,
- string->no_encoding,
- mbfl_memory_device_output, 0, &device);
- encoder = mbfl_convert_filter_new(
- string->no_encoding,
- mbfl_no_encoding_wchar,
- collector_hantozen, 0, &pc);
- if (decoder == NULL || encoder == NULL) {
- mbfl_convert_filter_delete(encoder);
- mbfl_convert_filter_delete(decoder);
- return NULL;
- }
- pc.next_filter = decoder;
- pc.mode = mode;
- pc.status = 0;
- pc.cache = 0;
-
- /* feed data */
- p = string->val;
- n = string->len;
- if (p != NULL) {
- while (n > 0) {
- if ((*encoder->filter_function)(*p++, encoder) < 0) {
- break;
- }
- n--;
- }
- }
-
- mbfl_convert_filter_flush(encoder);
- collector_hantozen_flush(&pc);
- mbfl_convert_filter_flush(decoder);
- result = mbfl_memory_device_result(&device, result);
- mbfl_convert_filter_delete(encoder);
- mbfl_convert_filter_delete(decoder);
-
- return result;
-}
-
-
-/*
- * MIME header encode
- */
-struct mime_header_encoder_data {
- mbfl_convert_filter *conv1_filter;
- mbfl_convert_filter *block_filter;
- mbfl_convert_filter *conv2_filter;
- mbfl_convert_filter *conv2_filter_backup;
- mbfl_convert_filter *encod_filter;
- mbfl_convert_filter *encod_filter_backup;
- mbfl_memory_device outdev;
- mbfl_memory_device tmpdev;
- int status1;
- int status2;
- int prevpos;
- int linehead;
- int firstindent;
- int encnamelen;
- int lwsplen;
- char encname[128];
- char lwsp[16];
-};
-
-static int
-mime_header_encoder_block_collector(int c, void *data)
-{
- int n;
- struct mime_header_encoder_data *pe = (struct mime_header_encoder_data *)data;
-
- switch (pe->status2) {
- case 1: /* encoded word */
- pe->prevpos = pe->outdev.pos;
- mbfl_convert_filter_copy(pe->conv2_filter, pe->conv2_filter_backup);
- mbfl_convert_filter_copy(pe->encod_filter, pe->encod_filter_backup);
- (*pe->conv2_filter->filter_function)(c, pe->conv2_filter);
- (*pe->conv2_filter->filter_flush)(pe->conv2_filter);
- (*pe->encod_filter->filter_flush)(pe->encod_filter);
- n = pe->outdev.pos - pe->linehead + pe->firstindent;
- pe->outdev.pos = pe->prevpos;
- mbfl_convert_filter_copy(pe->conv2_filter_backup, pe->conv2_filter);
- mbfl_convert_filter_copy(pe->encod_filter_backup, pe->encod_filter);
- if (n >= 74) {
- (*pe->conv2_filter->filter_flush)(pe->conv2_filter);
- (*pe->encod_filter->filter_flush)(pe->encod_filter);
- mbfl_memory_device_strncat(&pe->outdev, "\x3f\x3d", 2); /* ?= */
- mbfl_memory_device_strncat(&pe->outdev, pe->lwsp, pe->lwsplen);
- pe->linehead = pe->outdev.pos;
- pe->firstindent = 0;
- mbfl_memory_device_strncat(&pe->outdev, pe->encname, pe->encnamelen);
- c = (*pe->conv2_filter->filter_function)(c, pe->conv2_filter);
- } else {
- c = (*pe->conv2_filter->filter_function)(c, pe->conv2_filter);
- }
- break;
-
- default:
- mbfl_memory_device_strncat(&pe->outdev, pe->encname, pe->encnamelen);
- c = (*pe->conv2_filter->filter_function)(c, pe->conv2_filter);
- pe->status2 = 1;
- break;
- }
-
- return c;
-}
-
-static int
-mime_header_encoder_collector(int c, void *data)
-{
- int n;
- struct mime_header_encoder_data *pe = (struct mime_header_encoder_data *)data;
-
- switch (pe->status1) {
- case 11: /* encoded word */
- (*pe->block_filter->filter_function)(c, pe->block_filter);
- break;
-
- default: /* ASCII */
- if (c >= 0x21 && c < 0x7f) { /* ASCII exclude SPACE and CTLs */
- mbfl_memory_device_output(c, &pe->tmpdev);
- pe->status1 = 1;
- } else if (pe->status1 == 0 && c == 0x20) { /* repeat SPACE */
- mbfl_memory_device_output(c, &pe->tmpdev);
- } else {
- if (pe->tmpdev.pos < 74 && c == 0x20) {
- n = pe->outdev.pos - pe->linehead + pe->tmpdev.pos + pe->firstindent;
- if (n > 74) {
- mbfl_memory_device_strncat(&pe->outdev, pe->lwsp, pe->lwsplen); /* LWSP */
- pe->linehead = pe->outdev.pos;
- pe->firstindent = 0;
- } else if (pe->outdev.pos > 0) {
- mbfl_memory_device_output(0x20, &pe->outdev);
- }
- mbfl_memory_device_devcat(&pe->outdev, &pe->tmpdev);
- mbfl_memory_device_reset(&pe->tmpdev);
- pe->status1 = 0;
- } else {
- n = pe->outdev.pos - pe->linehead + pe->encnamelen + pe->firstindent;
- if (n > 60) {
- mbfl_memory_device_strncat(&pe->outdev, pe->lwsp, pe->lwsplen); /* LWSP */
- pe->linehead = pe->outdev.pos;
- pe->firstindent = 0;
- } else if (pe->outdev.pos > 0) {
- mbfl_memory_device_output(0x20, &pe->outdev);
- }
- mbfl_convert_filter_devcat(pe->block_filter, &pe->tmpdev);
- mbfl_memory_device_reset(&pe->tmpdev);
- (*pe->block_filter->filter_function)(c, pe->block_filter);
- pe->status1 = 11;
- }
- }
- break;
- }
-
- return c;
-}
-
-mbfl_string *
-mime_header_encoder_result(struct mime_header_encoder_data *pe, mbfl_string *result)
-{
- if (pe->status1 >= 10) {
- (*pe->conv2_filter->filter_flush)(pe->conv2_filter);
- (*pe->encod_filter->filter_flush)(pe->encod_filter);
- mbfl_memory_device_strncat(&pe->outdev, "\x3f\x3d", 2); /* ?= */
- } else if (pe->tmpdev.pos > 0) {
- if (pe->outdev.pos > 0) {
- if ((pe->outdev.pos - pe->linehead + pe->tmpdev.pos) > 74) {
- mbfl_memory_device_strncat(&pe->outdev, pe->lwsp, pe->lwsplen);
- } else {
- mbfl_memory_device_output(0x20, &pe->outdev);
- }
- }
- mbfl_memory_device_devcat(&pe->outdev, &pe->tmpdev);
- }
- mbfl_memory_device_reset(&pe->tmpdev);
- pe->prevpos = 0;
- pe->linehead = 0;
- pe->status1 = 0;
- pe->status2 = 0;
-
- return mbfl_memory_device_result(&pe->outdev, result);
-}
-
-struct mime_header_encoder_data*
-mime_header_encoder_new(
- enum mbfl_no_encoding incode,
- enum mbfl_no_encoding outcode,
- enum mbfl_no_encoding transenc)
-{
- int n;
- const char *s;
- mbfl_encoding *outencoding;
- struct mime_header_encoder_data *pe;
-
- /* get output encoding and check MIME charset name */
- outencoding = mbfl_no2encoding(outcode);
- if (outencoding == NULL || outencoding->mime_name == NULL || outencoding->mime_name[0] == '\0') {
- return NULL;
- }
-
- pe = (struct mime_header_encoder_data*)mbfl_malloc(sizeof(struct mime_header_encoder_data));
- if (pe == NULL) {
- return NULL;
- }
-
- mbfl_memory_device_init(&pe->outdev, 0, 0);
- mbfl_memory_device_init(&pe->tmpdev, 0, 0);
- pe->prevpos = 0;
- pe->linehead = 0;
- pe->firstindent = 0;
- pe->status1 = 0;
- pe->status2 = 0;
-
- /* make the encoding description string exp. "=?ISO-2022-JP?B?" */
- n = 0;
- pe->encname[n++] = 0x3d;
- pe->encname[n++] = 0x3f;
- s = outencoding->mime_name;
- while (*s) {
- pe->encname[n++] = *s++;
- }
- pe->encname[n++] = 0x3f;
- if (transenc == mbfl_no_encoding_qprint) {
- pe->encname[n++] = 0x51;
- } else {
- pe->encname[n++] = 0x42;
- transenc = mbfl_no_encoding_base64;
- }
- pe->encname[n++] = 0x3f;
- pe->encname[n] = '\0';
- pe->encnamelen = n;
-
- n = 0;
- pe->lwsp[n++] = 0x0d;
- pe->lwsp[n++] = 0x0a;
- pe->lwsp[n++] = 0x20;
- pe->lwsp[n] = '\0';
- pe->lwsplen = n;
-
- /* transfer encode filter */
- pe->encod_filter = mbfl_convert_filter_new(outcode, transenc, mbfl_memory_device_output, 0, &(pe->outdev));
- pe->encod_filter_backup = mbfl_convert_filter_new(outcode, transenc, mbfl_memory_device_output, 0, &(pe->outdev));
-
- /* Output code filter */
- pe->conv2_filter = mbfl_convert_filter_new(mbfl_no_encoding_wchar, outcode, mbfl_filter_output_pipe, 0, pe->encod_filter);
- pe->conv2_filter_backup = mbfl_convert_filter_new(mbfl_no_encoding_wchar, outcode, mbfl_filter_output_pipe, 0, pe->encod_filter);
-
- /* encoded block filter */
- pe->block_filter = mbfl_convert_filter_new(mbfl_no_encoding_wchar, mbfl_no_encoding_wchar, mime_header_encoder_block_collector, 0, pe);
-
- /* Input code filter */
- pe->conv1_filter = mbfl_convert_filter_new(incode, mbfl_no_encoding_wchar, mime_header_encoder_collector, 0, pe);
-
- if (pe->encod_filter == NULL ||
- pe->encod_filter_backup == NULL ||
- pe->conv2_filter == NULL ||
- pe->conv2_filter_backup == NULL ||
- pe->conv1_filter == NULL) {
- mime_header_encoder_delete(pe);
- return NULL;
- }
-
- if (transenc == mbfl_no_encoding_qprint) {
- pe->encod_filter->status |= MBFL_QPRINT_STS_MIME_HEADER;
- pe->encod_filter_backup->status |= MBFL_QPRINT_STS_MIME_HEADER;
- } else {
- pe->encod_filter->status |= MBFL_BASE64_STS_MIME_HEADER;
- pe->encod_filter_backup->status |= MBFL_BASE64_STS_MIME_HEADER;
- }
-
- return pe;
-}
-
-void
-mime_header_encoder_delete(struct mime_header_encoder_data *pe)
-{
- if (pe) {
- mbfl_convert_filter_delete(pe->conv1_filter);
- mbfl_convert_filter_delete(pe->block_filter);
- mbfl_convert_filter_delete(pe->conv2_filter);
- mbfl_convert_filter_delete(pe->conv2_filter_backup);
- mbfl_convert_filter_delete(pe->encod_filter);
- mbfl_convert_filter_delete(pe->encod_filter_backup);
- mbfl_memory_device_clear(&pe->outdev);
- mbfl_memory_device_clear(&pe->tmpdev);
- mbfl_free((void*)pe);
- }
-}
-
-int
-mime_header_encoder_feed(int c, struct mime_header_encoder_data *pe)
-{
- return (*pe->conv1_filter->filter_function)(c, pe->conv1_filter);
-}
-
-mbfl_string *
-mbfl_mime_header_encode(
- mbfl_string *string,
- mbfl_string *result,
- enum mbfl_no_encoding outcode,
- enum mbfl_no_encoding encoding,
- const char *linefeed,
- int indent)
-{
- int n;
- unsigned char *p;
- struct mime_header_encoder_data *pe;
-
- mbfl_string_init(result);
- result->no_language = string->no_language;
- result->no_encoding = mbfl_no_encoding_ascii;
-
- pe = mime_header_encoder_new(string->no_encoding, outcode, encoding);
- if (pe == NULL) {
- return NULL;
- }
-
- if (linefeed != NULL) {
- n = 0;
- while (*linefeed && n < 8) {
- pe->lwsp[n++] = *linefeed++;
- }
- pe->lwsp[n++] = 0x20;
- pe->lwsp[n] = '\0';
- pe->lwsplen = n;
- }
- if (indent > 0 && indent < 74) {
- pe->firstindent = indent;
- }
-
- n = string->len;
- p = string->val;
- while (n > 0) {
- (*pe->conv1_filter->filter_function)(*p++, pe->conv1_filter);
- n--;
- }
-
- result = mime_header_encoder_result(pe, result);
- mime_header_encoder_delete(pe);
-
- return result;
-}
-
-
-/*
- * MIME header decode
- */
-struct mime_header_decoder_data {
- mbfl_convert_filter *deco_filter;
- mbfl_convert_filter *conv1_filter;
- mbfl_convert_filter *conv2_filter;
- mbfl_memory_device outdev;
- mbfl_memory_device tmpdev;
- int cspos;
- int status;
- enum mbfl_no_encoding encoding;
- enum mbfl_no_encoding incode;
- enum mbfl_no_encoding outcode;
-};
-
-static int
-mime_header_decoder_collector(int c, void* data)
-{
- mbfl_encoding *encoding;
- struct mime_header_decoder_data *pd = (struct mime_header_decoder_data*)data;
-
- switch (pd->status) {
- case 1:
- if (c == 0x3f) { /* ? */
- mbfl_memory_device_output(c, &pd->tmpdev);
- pd->cspos = pd->tmpdev.pos;
- pd->status = 2;
- } else {
- mbfl_convert_filter_devcat(pd->conv1_filter, &pd->tmpdev);
- mbfl_memory_device_reset(&pd->tmpdev);
- if (c == 0x3d) { /* = */
- mbfl_memory_device_output(c, &pd->tmpdev);
- } else if (c == 0x0d || c == 0x0a) { /* CR or LF */
- pd->status = 9;
- } else {
- (*pd->conv1_filter->filter_function)(c, pd->conv1_filter);
- pd->status = 0;
- }
- }
- break;
- case 2: /* store charset string */
- if (c == 0x3f) { /* ? */
- /* identify charset */
- mbfl_memory_device_output('\0', &pd->tmpdev);
- encoding = mbfl_name2encoding(&pd->tmpdev.buffer[pd->cspos]);
- if (encoding != NULL) {
- pd->incode = encoding->no_encoding;
- pd->status = 3;
- }
- mbfl_memory_device_unput(&pd->tmpdev);
- mbfl_memory_device_output(c, &pd->tmpdev);
- } else {
- mbfl_memory_device_output(c, &pd->tmpdev);
- if (pd->tmpdev.pos > 100) { /* too long charset string */
- pd->status = 0;
- } else if (c == 0x0d || c == 0x0a) { /* CR or LF */
- mbfl_memory_device_unput(&pd->tmpdev);
- pd->status = 9;
- }
- if (pd->status != 2) {
- mbfl_convert_filter_devcat(pd->conv1_filter, &pd->tmpdev);
- mbfl_memory_device_reset(&pd->tmpdev);
- }
- }
- break;
- case 3: /* identify encoding */
- mbfl_memory_device_output(c, &pd->tmpdev);
- if (c == 0x42 || c == 0x62) { /* 'B' or 'b' */
- pd->encoding = mbfl_no_encoding_base64;
- pd->status = 4;
- } else if (c == 0x51 || c == 0x71) { /* 'Q' or 'q' */
- pd->encoding = mbfl_no_encoding_qprint;
- pd->status = 4;
- } else {
- if (c == 0x0d || c == 0x0a) { /* CR or LF */
- mbfl_memory_device_unput(&pd->tmpdev);
- pd->status = 9;
- } else {
- pd->status = 0;
- }
- mbfl_convert_filter_devcat(pd->conv1_filter, &pd->tmpdev);
- mbfl_memory_device_reset(&pd->tmpdev);
- }
- break;
- case 4: /* reset filter */
- mbfl_memory_device_output(c, &pd->tmpdev);
- if (c == 0x3f) { /* ? */
- /* charset convert filter */
- mbfl_convert_filter_reset(pd->conv1_filter, pd->incode, mbfl_no_encoding_wchar);
- /* decode filter */
- mbfl_convert_filter_reset(pd->deco_filter, pd->encoding, mbfl_no_encoding_8bit);
- pd->status = 5;
- } else {
- if (c == 0x0d || c == 0x0a) { /* CR or LF */
- mbfl_memory_device_unput(&pd->tmpdev);
- pd->status = 9;
- } else {
- pd->status = 0;
- }
- mbfl_convert_filter_devcat(pd->conv1_filter, &pd->tmpdev);
- }
- mbfl_memory_device_reset(&pd->tmpdev);
- break;
- case 5: /* encoded block */
- if (c == 0x3f) { /* ? */
- pd->status = 6;
- } else {
- (*pd->deco_filter->filter_function)(c, pd->deco_filter);
- }
- break;
- case 6: /* check end position */
- if (c == 0x3d) { /* = */
- /* flush and reset filter */
- (*pd->deco_filter->filter_flush)(pd->deco_filter);
- (*pd->conv1_filter->filter_flush)(pd->conv1_filter);
- mbfl_convert_filter_reset(pd->conv1_filter, mbfl_no_encoding_ascii, mbfl_no_encoding_wchar);
- pd->status = 7;
- } else {
- (*pd->deco_filter->filter_function)(0x3f, pd->deco_filter);
- if (c != 0x3f) { /* ? */
- (*pd->deco_filter->filter_function)(c, pd->deco_filter);
- pd->status = 5;
- }
- }
- break;
- case 7: /* after encoded block */
- if (c == 0x0d || c == 0x0a) { /* CR LF */
- pd->status = 8;
- } else {
- mbfl_memory_device_output(c, &pd->tmpdev);
- if (c == 0x3d) { /* = */
- pd->status = 1;
- } else if (c != 0x20 && c != 0x09) { /* not space */
- mbfl_convert_filter_devcat(pd->conv1_filter, &pd->tmpdev);
- mbfl_memory_device_reset(&pd->tmpdev);
- pd->status = 0;
- }
- }
- break;
- case 8: /* folding */
- case 9: /* folding */
- if (c != 0x0d && c != 0x0a && c != 0x20 && c != 0x09) {
- if (c == 0x3d) { /* = */
- if (pd->status == 8) {
- mbfl_memory_device_output(0x20, &pd->tmpdev); /* SPACE */
- } else {
- (*pd->conv1_filter->filter_function)(0x20, pd->conv1_filter);
- }
- mbfl_memory_device_output(c, &pd->tmpdev);
- pd->status = 1;
- } else {
- mbfl_memory_device_output(0x20, &pd->tmpdev);
- mbfl_memory_device_output(c, &pd->tmpdev);
- mbfl_convert_filter_devcat(pd->conv1_filter, &pd->tmpdev);
- mbfl_memory_device_reset(&pd->tmpdev);
- pd->status = 0;
- }
- }
- break;
- default: /* non encoded block */
- if (c == 0x0d || c == 0x0a) { /* CR LF */
- pd->status = 9;
- } else if (c == 0x3d) { /* = */
- mbfl_memory_device_output(c, &pd->tmpdev);
- pd->status = 1;
- } else {
- (*pd->conv1_filter->filter_function)(c, pd->conv1_filter);
- }
- break;
- }
-
- return c;
-}
-
-mbfl_string *
-mime_header_decoder_result(struct mime_header_decoder_data *pd, mbfl_string *result)
-{
- switch (pd->status) {
- case 1:
- case 2:
- case 3:
- case 4:
- case 7:
- case 8:
- case 9:
- mbfl_convert_filter_devcat(pd->conv1_filter, &pd->tmpdev);
- break;
- case 5:
- case 6:
- (*pd->deco_filter->filter_flush)(pd->deco_filter);
- (*pd->conv1_filter->filter_flush)(pd->conv1_filter);
- break;
- }
- (*pd->conv2_filter->filter_flush)(pd->conv2_filter);
- mbfl_memory_device_reset(&pd->tmpdev);
- pd->status = 0;
-
- return mbfl_memory_device_result(&pd->outdev, result);
-}
-
-struct mime_header_decoder_data*
-mime_header_decoder_new(enum mbfl_no_encoding outcode)
-{
- struct mime_header_decoder_data *pd;
-
- pd = (struct mime_header_decoder_data*)mbfl_malloc(sizeof(struct mime_header_decoder_data));
- if (pd == NULL) {
- return NULL;
- }
-
- mbfl_memory_device_init(&pd->outdev, 0, 0);
- mbfl_memory_device_init(&pd->tmpdev, 0, 0);
- pd->cspos = 0;
- pd->status = 0;
- pd->encoding = mbfl_no_encoding_pass;
- pd->incode = mbfl_no_encoding_ascii;
- pd->outcode = outcode;
- /* charset convert filter */
- pd->conv2_filter = mbfl_convert_filter_new(mbfl_no_encoding_wchar, pd->outcode, mbfl_memory_device_output, 0, &pd->outdev);
- pd->conv1_filter = mbfl_convert_filter_new(pd->incode, mbfl_no_encoding_wchar, mbfl_filter_output_pipe, 0, pd->conv2_filter);
- /* decode filter */
- pd->deco_filter = mbfl_convert_filter_new(pd->encoding, mbfl_no_encoding_8bit, mbfl_filter_output_pipe, 0, pd->conv1_filter);
-
- if (pd->conv1_filter == NULL || pd->conv2_filter == NULL || pd->deco_filter == NULL) {
- mime_header_decoder_delete(pd);
- return NULL;
- }
-
- return pd;
-}
-
-void
-mime_header_decoder_delete(struct mime_header_decoder_data *pd)
-{
- if (pd) {
- mbfl_convert_filter_delete(pd->conv2_filter);
- mbfl_convert_filter_delete(pd->conv1_filter);
- mbfl_convert_filter_delete(pd->deco_filter);
- mbfl_memory_device_clear(&pd->outdev);
- mbfl_memory_device_clear(&pd->tmpdev);
- mbfl_free((void*)pd);
- }
-}
-
-int
-mime_header_decoder_feed(int c, struct mime_header_decoder_data *pd)
-{
- return mime_header_decoder_collector(c, pd);
-}
-
-mbfl_string *
-mbfl_mime_header_decode(
- mbfl_string *string,
- mbfl_string *result,
- enum mbfl_no_encoding outcode)
-{
- int n;
- unsigned char *p;
- struct mime_header_decoder_data *pd;
-
- mbfl_string_init(result);
- result->no_language = string->no_language;
- result->no_encoding = outcode;
-
- pd = mime_header_decoder_new(outcode);
- if (pd == NULL) {
- return NULL;
- }
-
- /* feed data */
- n = string->len;
- p = string->val;
- while (n > 0) {
- mime_header_decoder_collector(*p++, pd);
- n--;
- }
-
- result = mime_header_decoder_result(pd, result);
- mime_header_decoder_delete(pd);
-
- return result;
-}
-
-
-
-/*
- * convert HTML numeric entity
- */
-struct collector_htmlnumericentity_data {
- mbfl_convert_filter *decoder;
- int status;
- int cache;
- int digit;
- int *convmap;
- int mapsize;
-};
-
-static int
-collector_encode_htmlnumericentity(int c, void *data)
-{
- struct collector_htmlnumericentity_data *pc = (struct collector_htmlnumericentity_data *)data;
- int f, n, s, r, d, size, *mapelm;
-
- size = pc->mapsize;
- f = 0;
- n = 0;
- while (n < size) {
- mapelm = &(pc->convmap[n*4]);
- if (c >= mapelm[0] && c <= mapelm[1]) {
- s = (c + mapelm[2]) & mapelm[3];
- if (s >= 0) {
- (*pc->decoder->filter_function)(0x26, pc->decoder); /* '&' */
- (*pc->decoder->filter_function)(0x23, pc->decoder); /* '#' */
- r = 100000000;
- s %= r;
- while (r > 0) {
- d = s/r;
- if (d || f) {
- f = 1;
- s %= r;
- (*pc->decoder->filter_function)(mbfl_hexchar_table[d], pc->decoder);
- }
- r /= 10;
- }
- if (!f) {
- f = 1;
- (*pc->decoder->filter_function)(mbfl_hexchar_table[0], pc->decoder);
- }
- (*pc->decoder->filter_function)(0x3b, pc->decoder); /* ';' */
- }
- }
- if (f) {
- break;
- }
- n++;
- }
- if (!f) {
- (*pc->decoder->filter_function)(c, pc->decoder);
- }
-
- return c;
-}
-
-static int
-collector_decode_htmlnumericentity(int c, void *data)
-{
- struct collector_htmlnumericentity_data *pc = (struct collector_htmlnumericentity_data *)data;
- int f, n, s, r, d, size, *mapelm;
-
- switch (pc->status) {
- case 1:
- if (c == 0x23) { /* '#' */
- pc->status = 2;
- } else {
- pc->status = 0;
- (*pc->decoder->filter_function)(0x26, pc->decoder); /* '&' */
- (*pc->decoder->filter_function)(c, pc->decoder);
- }
- break;
- case 2:
- if (c >= 0x30 && c <= 0x39) { /* '0' - '9' */
- pc->cache = c - 0x30;
- pc->status = 3;
- pc->digit = 1;
- } else {
- pc->status = 0;
- (*pc->decoder->filter_function)(0x26, pc->decoder); /* '&' */
- (*pc->decoder->filter_function)(0x23, pc->decoder); /* '#' */
- (*pc->decoder->filter_function)(c, pc->decoder);
- }
- break;
- case 3:
- s = 0;
- f = 0;
- if (c >= 0x30 && c <= 0x39) { /* '0' - '9' */
- if (pc->digit > 9) {
- pc->status = 0;
- s = pc->cache;
- f = 1;
- } else {
- s = pc->cache*10 + c - 0x30;
- pc->cache = s;
- pc->digit++;
- }
- } else {
- pc->status = 0;
- s = pc->cache;
- f = 1;
- n = 0;
- size = pc->mapsize;
- while (n < size) {
- mapelm = &(pc->convmap[n*4]);
- d = s - mapelm[2];
- if (d >= mapelm[0] && d <= mapelm[1]) {
- f = 0;
- (*pc->decoder->filter_function)(d, pc->decoder);
- if (c != 0x3b) { /* ';' */
- (*pc->decoder->filter_function)(c, pc->decoder);
- }
- break;
- }
- n++;
- }
- }
- if (f) {
- (*pc->decoder->filter_function)(0x26, pc->decoder); /* '&' */
- (*pc->decoder->filter_function)(0x23, pc->decoder); /* '#' */
- r = 1;
- n = pc->digit;
- while (n > 0) {
- r *= 10;
- n--;
- }
- s %= r;
- r /= 10;
- while (r > 0) {
- d = s/r;
- s %= r;
- r /= 10;
- (*pc->decoder->filter_function)(mbfl_hexchar_table[d], pc->decoder);
- }
- (*pc->decoder->filter_function)(c, pc->decoder);
- }
- break;
- default:
- if (c == 0x26) { /* '&' */
- pc->status = 1;
- } else {
- (*pc->decoder->filter_function)(c, pc->decoder);
- }
- break;
- }
-
- return c;
-}
-
-mbfl_string *
-mbfl_html_numeric_entity(
- mbfl_string *string,
- mbfl_string *result,
- int *convmap,
- int mapsize,
- int type)
-{
- struct collector_htmlnumericentity_data pc;
- mbfl_memory_device device;
- mbfl_convert_filter *encoder;
- int n;
- unsigned char *p;
-
- if (string == NULL || result == NULL) {
- return NULL;
- }
- mbfl_string_init(result);
- result->no_language = string->no_language;
- result->no_encoding = string->no_encoding;
- mbfl_memory_device_init(&device, string->len, 0);
-
- /* output code filter */
- pc.decoder = mbfl_convert_filter_new(
- mbfl_no_encoding_wchar,
- string->no_encoding,
- mbfl_memory_device_output, 0, &device);
- /* wchar filter */
- if (type == 0) {
- encoder = mbfl_convert_filter_new(
- string->no_encoding,
- mbfl_no_encoding_wchar,
- collector_encode_htmlnumericentity, 0, &pc);
- } else {
- encoder = mbfl_convert_filter_new(
- string->no_encoding,
- mbfl_no_encoding_wchar,
- collector_decode_htmlnumericentity, 0, &pc);
- }
- if (pc.decoder == NULL || encoder == NULL) {
- mbfl_convert_filter_delete(encoder);
- mbfl_convert_filter_delete(pc.decoder);
- return NULL;
- }
- pc.status = 0;
- pc.cache = 0;
- pc.digit = 0;
- pc.convmap = convmap;
- pc.mapsize = mapsize;
-
- /* feed data */
- p = string->val;
- n = string->len;
- if (p != NULL) {
- while (n > 0) {
- if ((*encoder->filter_function)(*p++, encoder) < 0) {
- break;
- }
- n--;
- }
- }
- mbfl_convert_filter_flush(encoder);
- mbfl_convert_filter_flush(pc.decoder);
- result = mbfl_memory_device_result(&device, result);
- mbfl_convert_filter_delete(encoder);
- mbfl_convert_filter_delete(pc.decoder);
-
- return result;
-}
-
-
-
-
-
-/*
- * Unicode table
- */
-static const unsigned short iso8859_2_ucs_table[] = {
- 0x00A0,0x0104,0x02D8,0x0141,0x00A4,0x013D,0x015A,0x00A7,
- 0x00A8,0x0160,0x015E,0x0164,0x0179,0x00AD,0x017D,0x017B,
- 0x00B0,0x0105,0x02DB,0x0142,0x00B4,0x013E,0x015B,0x02C7,
- 0x00B8,0x0161,0x015F,0x0165,0x017A,0x02DD,0x017E,0x017C,
- 0x0154,0x00C1,0x00C2,0x0102,0x00C4,0x0139,0x0106,0x00C7,
- 0x010C,0x00C9,0x0118,0x00CB,0x011A,0x00CD,0x00CE,0x010E,
- 0x0110,0x0143,0x0147,0x00D3,0x00D4,0x0150,0x00D6,0x00D7,
- 0x0158,0x016E,0x00DA,0x0170,0x00DC,0x00DD,0x0162,0x00DF,
- 0x0155,0x00E1,0x00E2,0x0103,0x00E4,0x013A,0x0107,0x00E7,
- 0x010D,0x00E9,0x0119,0x00EB,0x011B,0x00ED,0x00EE,0x010F,
- 0x0111,0x0144,0x0148,0x00F3,0x00F4,0x0151,0x00F6,0x00F7,
- 0x0159,0x016F,0x00FA,0x0171,0x00FC,0x00FD,0x0163,0x02D9
-};
-
-
-static const unsigned short iso8859_3_ucs_table[] = {
- 0x00A0,0x0126,0x02D8,0x00A3,0x00A4,0x0000,0x0124,0x00A7,
- 0x00A8,0x0130,0x015E,0x011E,0x0134,0x00AD,0x0000,0x017B,
- 0x00B0,0x0127,0x00B2,0x00B3,0x00B4,0x00B5,0x0125,0x00B7,
- 0x00B8,0x0131,0x015F,0x011F,0x0135,0x00BD,0x0000,0x017C,
- 0x00C0,0x00C1,0x00C2,0x0000,0x00C4,0x010A,0x0108,0x00C7,
- 0x00C8,0x00C9,0x00CA,0x00CB,0x00CC,0x00CD,0x00CE,0x00CF,
- 0x0000,0x00D1,0x00D2,0x00D3,0x00D4,0x0120,0x00D6,0x00D7,
- 0x011C,0x00D9,0x00DA,0x00DB,0x00DC,0x016C,0x015C,0x00DF,
- 0x00E0,0x00E1,0x00E2,0x0000,0x00E4,0x010B,0x0109,0x00E7,
- 0x00E8,0x00E9,0x00EA,0x00EB,0x00EC,0x00ED,0x00EE,0x00EF,
- 0x0000,0x00F1,0x00F2,0x00F3,0x00F4,0x0121,0x00F6,0x00F7,
- 0x011D,0x00F9,0x00FA,0x00FB,0x00FC,0x016D,0x015D,0x02D9
-};
-
-
-static const unsigned short iso8859_4_ucs_table[] = {
- 0x00A0,0x0104,0x0138,0x0156,0x00A4,0x0128,0x013B,0x00A7,
- 0x00A8,0x0160,0x0112,0x0122,0x0166,0x00AD,0x017D,0x00AF,
- 0x00B0,0x0105,0x02DB,0x0157,0x00B4,0x0129,0x013C,0x02C7,
- 0x00B8,0x0161,0x0113,0x0123,0x0167,0x014A,0x017E,0x014B,
- 0x0100,0x00C1,0x00C2,0x00C3,0x00C4,0x00C5,0x00C6,0x012E,
- 0x010C,0x00C9,0x0118,0x00CB,0x0116,0x00CD,0x00CE,0x012A,
- 0x0110,0x0145,0x014C,0x0136,0x00D4,0x00D5,0x00D6,0x00D7,
- 0x00D8,0x0172,0x00DA,0x00DB,0x00DC,0x0168,0x016A,0x00DF,
- 0x0101,0x00E1,0x00E2,0x00E3,0x00E4,0x00E5,0x00E6,0x012F,
- 0x010D,0x00E9,0x0119,0x00EB,0x0117,0x00ED,0x00EE,0x012B,
- 0x0111,0x0146,0x014D,0x0137,0x00F4,0x00F5,0x00F6,0x00F7,
- 0x00F8,0x0173,0x00FA,0x00FB,0x00FC,0x0169,0x016B,0x02D9
-};
-
-
-static const unsigned short iso8859_5_ucs_table[] = {
- 0x00A0,0x0401,0x0402,0x0403,0x0404,0x0405,0x0406,0x0407,
- 0x0408,0x0409,0x040A,0x040B,0x040C,0x00AD,0x040E,0x040F,
- 0x0410,0x0411,0x0412,0x0413,0x0414,0x0415,0x0416,0x0417,
- 0x0418,0x0419,0x041A,0x041B,0x041C,0x041D,0x041E,0x041F,
- 0x0420,0x0421,0x0422,0x0423,0x0424,0x0425,0x0426,0x0427,
- 0x0428,0x0429,0x042A,0x042B,0x042C,0x042D,0x042E,0x042F,
- 0x0430,0x0431,0x0432,0x0433,0x0434,0x0435,0x0436,0x0437,
- 0x0438,0x0439,0x043A,0x043B,0x043C,0x043D,0x043E,0x043F,
- 0x0440,0x0441,0x0442,0x0443,0x0444,0x0445,0x0446,0x0447,
- 0x0448,0x0449,0x044A,0x044B,0x044C,0x044D,0x044E,0x044F,
- 0x2116,0x0451,0x0452,0x0453,0x0454,0x0455,0x0456,0x0457,
- 0x0458,0x0459,0x045A,0x045B,0x045C,0x00A7,0x045E,0x045F
-};
-
-
-static const unsigned short iso8859_6_ucs_table[] = {
- 0x00A0,0x0000,0x0000,0x0000,0x00A4,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x060C,0x00AD,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x061B,0x0000,0x0000,0x0000,0x061F,
- 0x0000,0x0621,0x0622,0x0623,0x0624,0x0625,0x0626,0x0627,
- 0x0628,0x0629,0x062A,0x062B,0x062C,0x062D,0x062E,0x062F,
- 0x0630,0x0631,0x0632,0x0633,0x0634,0x0635,0x0636,0x0637,
- 0x0638,0x0639,0x063A,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0640,0x0641,0x0642,0x0643,0x0644,0x0645,0x0646,0x0647,
- 0x0648,0x0649,0x064A,0x064B,0x064C,0x064D,0x064E,0x064F,
- 0x0650,0x0651,0x0652,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x060C,0x00AD,0x0000,0x0000
-};
-
-
-static const unsigned short iso8859_7_ucs_table[] = {
- 0x00A0,0x2018,0x2019,0x00A3,0x0000,0x0000,0x00A6,0x00A7,
- 0x00A8,0x00A9,0x0000,0x00AB,0x00AC,0x00AD,0x0000,0x2015,
- 0x00B0,0x00B1,0x00B2,0x00B3,0x0384,0x0385,0x0386,0x00B7,
- 0x0388,0x0389,0x038A,0x00BB,0x038C,0x00BD,0x038E,0x038F,
- 0x0390,0x0391,0x0392,0x0393,0x0394,0x0395,0x0396,0x0397,
- 0x0398,0x0399,0x039A,0x039B,0x039C,0x039D,0x039E,0x039F,
- 0x03A0,0x03A1,0x0000,0x03A3,0x03A4,0x03A5,0x03A6,0x03A7,
- 0x03A8,0x03A9,0x03AA,0x03AB,0x03AC,0x03AD,0x03AE,0x03AF,
- 0x03B0,0x03B1,0x03B2,0x03B3,0x03B4,0x03B5,0x03B6,0x03B7,
- 0x03B8,0x03B9,0x03BA,0x03BB,0x03BC,0x03BD,0x03BE,0x03BF,
- 0x03C0,0x03C1,0x03C2,0x03C3,0x03C4,0x03C5,0x03C6,0x03C7,
- 0x03C8,0x03C9,0x03CA,0x03CB,0x03CC,0x03CD,0x03CE,0x0000
-};
-
-
-static const unsigned short iso8859_8_ucs_table[] = {
- 0x00A0,0x0000,0x00A2,0x00A3,0x00A4,0x00A5,0x00A6,0x00A7,
- 0x00A8,0x00A9,0x00D7,0x00AB,0x00AC,0x00AD,0x00AE,0x203E,
- 0x00B0,0x00B1,0x00B2,0x00B3,0x00B4,0x00B5,0x00B6,0x00B7,
- 0x00B8,0x00B9,0x00F7,0x00BB,0x00BC,0x00BD,0x00BE,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x2017,
- 0x05D0,0x05D1,0x05D2,0x05D3,0x05D4,0x05D5,0x05D6,0x05D7,
- 0x05D8,0x05D9,0x05DA,0x05DB,0x05DC,0x05DD,0x05DE,0x05DF,
- 0x05E0,0x05E1,0x05E2,0x05E3,0x05E4,0x05E5,0x05E6,0x05E7,
- 0x05E8,0x05E9,0x05EA,0x0000,0x0000,0x0000,0x0000,0x0000
-};
-
-
-static const unsigned short iso8859_9_ucs_table[] = {
- 0x00A0,0x00A1,0x00A2,0x00A3,0x00A4,0x00A5,0x00A6,0x00A7,
- 0x00A8,0x00A9,0x00AA,0x00AB,0x00AC,0x00AD,0x00AE,0x00AF,
- 0x00B0,0x00B1,0x00B2,0x00B3,0x00B4,0x00B5,0x00B6,0x00B7,
- 0x00B8,0x00B9,0x00BA,0x00BB,0x00BC,0x00BD,0x00BE,0x00BF,
- 0x00C0,0x00C1,0x00C2,0x00C3,0x00C4,0x00C5,0x00C6,0x00C7,
- 0x00C8,0x00C9,0x00CA,0x00CB,0x00CC,0x00CD,0x00CE,0x00CF,
- 0x011E,0x00D1,0x00D2,0x00D3,0x00D4,0x00D5,0x00D6,0x00D7,
- 0x00D8,0x00D9,0x00DA,0x00DB,0x00DC,0x0130,0x015E,0x00DF,
- 0x00E0,0x00E1,0x00E2,0x00E3,0x00E4,0x00E5,0x00E6,0x00E7,
- 0x00E8,0x00E9,0x00EA,0x00EB,0x00EC,0x00ED,0x00EE,0x00EF,
- 0x011F,0x00F1,0x00F2,0x00F3,0x00F4,0x00F5,0x00F6,0x00F7,
- 0x00F8,0x00F9,0x00FA,0x00FB,0x00FC,0x0131,0x015F,0x00FF
-};
-
-
-static const unsigned short iso8859_10_ucs_table[] = {
- 0x00A0,0x0104,0x0112,0x0122,0x0124,0x0128,0x0136,0x00A7,
- 0x013B,0x0110,0x0160,0x0166,0x017D,0x00AD,0x016A,0x014A,
- 0x00B0,0x0105,0x0113,0x0123,0x012B,0x0129,0x0137,0x00B7,
- 0x013C,0x0111,0x0161,0x0167,0x017E,0x2015,0x016B,0x014B,
- 0x0100,0x00C1,0x00C2,0x00C3,0x00C4,0x00C5,0x00C6,0x012E,
- 0x010C,0x00C9,0x0118,0x00CB,0x0116,0x00CD,0x00CE,0x00CF,
- 0x00D0,0x0145,0x014C,0x00D3,0x00D4,0x00D5,0x00D6,0x0168,
- 0x00D8,0x0172,0x00DA,0x00DB,0x00DC,0x00DD,0x00DE,0x00DF,
- 0x0101,0x00E1,0x00E2,0x00E3,0x00E4,0x00E5,0x00E6,0x012F,
- 0x010D,0x00E9,0x0119,0x00EB,0x0117,0x00ED,0x00EE,0x00EF,
- 0x00F0,0x0146,0x014D,0x00F3,0x00F4,0x00F5,0x00F6,0x0169,
- 0x00F8,0x0173,0x00FA,0x00FB,0x00FC,0x00FD,0x00FE,0x0138
-};
-
-
-static const unsigned short iso8859_13_ucs_table[] = {
- 0x00A0,0x201D,0x00A2,0x00A3,0x00A4,0x201E,0x00A6,0x00A7,
- 0x00D8,0x00A9,0x0156,0x00AB,0x00AC,0x00AD,0x00AE,0x00C6,
- 0x00B0,0x00B1,0x00B2,0x00B3,0x201C,0x00B5,0x00B6,0x00B7,
- 0x00F8,0x00B9,0x0157,0x00BB,0x00BC,0x00BD,0x00BE,0x00E6,
- 0x0104,0x012E,0x0100,0x0106,0x00C4,0x00C5,0x0118,0x0112,
- 0x010C,0x00C9,0x0179,0x0116,0x0122,0x0136,0x012A,0x013B,
- 0x0160,0x0143,0x0145,0x00D3,0x014C,0x00D5,0x00D6,0x00D7,
- 0x0172,0x0141,0x015A,0x016A,0x00DC,0x017B,0x017D,0x00DF,
- 0x0105,0x012F,0x0101,0x0107,0x00E4,0x00E5,0x0119,0x0113,
- 0x010D,0x00E9,0x017A,0x0117,0x0123,0x0137,0x012B,0x013C,
- 0x0161,0x0144,0x0146,0x00F3,0x014D,0x00F5,0x00F6,0x00F7,
- 0x0173,0x0142,0x015B,0x016B,0x00FC,0x017C,0x017E,0x2019
-};
-
-
-static const unsigned short iso8859_14_ucs_table[] = {
- 0x00A0,0x1E02,0x1E03,0x00A3,0x010A,0x010B,0x1E0A,0x00A7,
- 0x1E80,0x00A9,0x1E82,0x1E0B,0x1EF2,0x00AD,0x00AE,0x0178,
- 0x1E1E,0x1E1F,0x0120,0x0121,0x1E40,0x1E41,0x00B6,0x1E56,
- 0x1E81,0x1E57,0x1E83,0x1E60,0x1EF3,0x1E84,0x1E85,0x1E61,
- 0x00C0,0x00C1,0x00C2,0x00C3,0x00C4,0x00C5,0x00C6,0x00C7,
- 0x00C8,0x00C9,0x00CA,0x00CB,0x00CC,0x00CD,0x00CE,0x00CF,
- 0x0174,0x00D1,0x00D2,0x00D3,0x00D4,0x00D5,0x00D6,0x1E6A,
- 0x00D8,0x00D9,0x00DA,0x00DB,0x00DC,0x00DD,0x0176,0x00DF,
- 0x00E0,0x00E1,0x00E2,0x00E3,0x00E4,0x00E5,0x00E6,0x00E7,
- 0x00E8,0x00E9,0x00EA,0x00EB,0x00EC,0x00ED,0x00EE,0x00EF,
- 0x0175,0x00F1,0x00F2,0x00F3,0x00F4,0x00F5,0x00F6,0x1E6B,
- 0x00F8,0x00F9,0x00FA,0x00FB,0x00FC,0x00FD,0x0177,0x00FF
-};
-
-
-static const unsigned short iso8859_15_ucs_table[] = {
- 0x00A0,0x00A1,0x00A2,0x00A3,0x20AC,0x00A5,0x0160,0x00A7,
- 0x0161,0x00A9,0x00AA,0x00AB,0x00AC,0x00AD,0x00AE,0x00AF,
- 0x00B0,0x00B1,0x00B2,0x00B3,0x017D,0x00B5,0x00B6,0x00B7,
- 0x017E,0x00B9,0x00BA,0x00BB,0x0152,0x0153,0x0178,0x00BF,
- 0x00C0,0x00C1,0x00C2,0x00C3,0x00C4,0x00C5,0x00C6,0x00C7,
- 0x00C8,0x00C9,0x00CA,0x00CB,0x00CC,0x00CD,0x00CE,0x00CF,
- 0x00D0,0x00D1,0x00D2,0x00D3,0x00D4,0x00D5,0x00D6,0x00D7,
- 0x00D8,0x00D9,0x00DA,0x00DB,0x00DC,0x00DD,0x00DE,0x00DF,
- 0x00E0,0x00E1,0x00E2,0x00E3,0x00E4,0x00E5,0x00E6,0x00E7,
- 0x00E8,0x00E9,0x00EA,0x00EB,0x00EC,0x00ED,0x00EE,0x00EF,
- 0x00F0,0x00F1,0x00F2,0x00F3,0x00F4,0x00F5,0x00F6,0x00F7,
- 0x00F8,0x00F9,0x00FA,0x00FB,0x00FC,0x00FD,0x00FE,0x00FF
-};
-
-
-static const unsigned char mbfl_charprop_table[] = {
-/* NUL 0 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC,
-/* SCH 1 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC ,
-/* SIX 2 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC ,
-/* EIX 3 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC ,
-/* EOT 4 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC ,
-/* ENQ 5 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC ,
-/* ACK 6 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC ,
-/* BEL 7 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC ,
-/* BS 8 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC ,
-/* HI 9 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC ,
-/* LF 10 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC ,
-/* VI 11 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC ,
-/* FF 12 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC ,
-/* CR 13 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC ,
-/* SO 14 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC ,
-/* SI 15 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC ,
-/* SLE 16 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC ,
-/* CSI 17 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC ,
-/* DC2 18 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC ,
-/* DC3 19 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC ,
-/* DC4 20 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC ,
-/* NAK 21 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC ,
-/* SYN 22 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC ,
-/* EIB 23 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC ,
-/* CAN 24 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC ,
-/* EM 25 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC ,
-/* SLB 26 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC ,
-/* ESC 27 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC ,
-/* FS 28 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC ,
-/* GS 29 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC ,
-/* RS 30 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC ,
-/* US 31 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC ,
-/* SP 32 */ MBFL_CHP_MMHQENC ,
-/* ! 33 */ 0 ,
-/* " 34 */ MBFL_CHP_MMHQENC | MBFL_CHP_MSPECIAL ,
-/* # 35 */ MBFL_CHP_MMHQENC ,
-/* $ 36 */ MBFL_CHP_MMHQENC ,
-/* % 37 */ MBFL_CHP_MMHQENC ,
-/* & 38 */ MBFL_CHP_MMHQENC ,
-/* ' 39 */ MBFL_CHP_MMHQENC ,
-/* ( 40 */ MBFL_CHP_MMHQENC | MBFL_CHP_MSPECIAL ,
-/* ) 41 */ MBFL_CHP_MMHQENC | MBFL_CHP_MSPECIAL ,
-/* * 42 */ 0 ,
-/* + 43 */ 0 ,
-/* , 44 */ MBFL_CHP_MMHQENC | MBFL_CHP_MSPECIAL ,
-/* - 45 */ 0 ,
-/* . 46 */ MBFL_CHP_MMHQENC | MBFL_CHP_MSPECIAL ,
-/* / 47 */ 0 ,
-/* 0 48 */ MBFL_CHP_DIGIT | MBFL_CHP_MMHQENC ,
-/* 1 49 */ MBFL_CHP_DIGIT | MBFL_CHP_MMHQENC ,
-/* 2 50 */ MBFL_CHP_DIGIT | MBFL_CHP_MMHQENC ,
-/* 3 51 */ MBFL_CHP_DIGIT | MBFL_CHP_MMHQENC ,
-/* 4 52 */ MBFL_CHP_DIGIT | MBFL_CHP_MMHQENC ,
-/* 5 53 */ MBFL_CHP_DIGIT | MBFL_CHP_MMHQENC ,
-/* 6 54 */ MBFL_CHP_DIGIT | MBFL_CHP_MMHQENC ,
-/* 7 55 */ MBFL_CHP_DIGIT | MBFL_CHP_MMHQENC ,
-/* 8 56 */ MBFL_CHP_DIGIT | MBFL_CHP_MMHQENC ,
-/* 9 57 */ MBFL_CHP_DIGIT | MBFL_CHP_MMHQENC ,
-/* : 58 */ MBFL_CHP_MMHQENC | MBFL_CHP_MSPECIAL ,
-/* ; 59 */ MBFL_CHP_MMHQENC | MBFL_CHP_MSPECIAL ,
-/* < 60 */ MBFL_CHP_MMHQENC | MBFL_CHP_MSPECIAL ,
-/* = 61 */ 0 ,
-/* > 62 */ MBFL_CHP_MMHQENC | MBFL_CHP_MSPECIAL ,
-/* ? 63 */ MBFL_CHP_MMHQENC ,
-/* @ 64 */ MBFL_CHP_MMHQENC | MBFL_CHP_MSPECIAL ,
-/* A 65 */ MBFL_CHP_UALPHA ,
-/* B 66 */ MBFL_CHP_UALPHA ,
-/* C 67 */ MBFL_CHP_UALPHA ,
-/* D 68 */ MBFL_CHP_UALPHA ,
-/* E 69 */ MBFL_CHP_UALPHA ,
-/* F 70 */ MBFL_CHP_UALPHA ,
-/* G 71 */ MBFL_CHP_UALPHA ,
-/* H 72 */ MBFL_CHP_UALPHA ,
-/* I 73 */ MBFL_CHP_UALPHA ,
-/* J 74 */ MBFL_CHP_UALPHA ,
-/* K 75 */ MBFL_CHP_UALPHA ,
-/* L 76 */ MBFL_CHP_UALPHA ,
-/* M 77 */ MBFL_CHP_UALPHA ,
-/* N 78 */ MBFL_CHP_UALPHA ,
-/* O 79 */ MBFL_CHP_UALPHA ,
-/* P 80 */ MBFL_CHP_UALPHA ,
-/* Q 81 */ MBFL_CHP_UALPHA ,
-/* R 82 */ MBFL_CHP_UALPHA ,
-/* S 83 */ MBFL_CHP_UALPHA ,
-/* T 84 */ MBFL_CHP_UALPHA ,
-/* U 85 */ MBFL_CHP_UALPHA ,
-/* V 86 */ MBFL_CHP_UALPHA ,
-/* W 87 */ MBFL_CHP_UALPHA ,
-/* X 88 */ MBFL_CHP_UALPHA ,
-/* Y 89 */ MBFL_CHP_UALPHA ,
-/* Z 90 */ MBFL_CHP_UALPHA ,
-/* [ 91 */ MBFL_CHP_MMHQENC | MBFL_CHP_MSPECIAL ,
-/* \ 92 */ MBFL_CHP_MMHQENC | MBFL_CHP_MSPECIAL ,
-/* ] 93 */ MBFL_CHP_MMHQENC | MBFL_CHP_MSPECIAL ,
-/* ^ 94 */ MBFL_CHP_MMHQENC ,
-/* _ 95 */ MBFL_CHP_MMHQENC ,
-/* ` 96 */ MBFL_CHP_MMHQENC ,
-/* a 97 */ MBFL_CHP_LALPHA ,
-/* b 98 */ MBFL_CHP_LALPHA ,
-/* c 99 */ MBFL_CHP_LALPHA ,
-/* d 100 */ MBFL_CHP_LALPHA ,
-/* e 101 */ MBFL_CHP_LALPHA ,
-/* f 102 */ MBFL_CHP_LALPHA ,
-/* g 103 */ MBFL_CHP_LALPHA ,
-/* h 104 */ MBFL_CHP_LALPHA ,
-/* i 105 */ MBFL_CHP_LALPHA ,
-/* j 106 */ MBFL_CHP_LALPHA ,
-/* k 107 */ MBFL_CHP_LALPHA ,
-/* l 108 */ MBFL_CHP_LALPHA ,
-/* m 109 */ MBFL_CHP_LALPHA ,
-/* n 110 */ MBFL_CHP_LALPHA ,
-/* o 111 */ MBFL_CHP_LALPHA ,
-/* p 112 */ MBFL_CHP_LALPHA ,
-/* q 113 */ MBFL_CHP_LALPHA ,
-/* r 114 */ MBFL_CHP_LALPHA ,
-/* s 115 */ MBFL_CHP_LALPHA ,
-/* t 116 */ MBFL_CHP_LALPHA ,
-/* u 117 */ MBFL_CHP_LALPHA ,
-/* v 118 */ MBFL_CHP_LALPHA ,
-/* w 119 */ MBFL_CHP_LALPHA ,
-/* x 120 */ MBFL_CHP_LALPHA ,
-/* y 121 */ MBFL_CHP_LALPHA ,
-/* z 122 */ MBFL_CHP_LALPHA ,
-/* { 123 */ MBFL_CHP_MMHQENC ,
-/* | 124 */ MBFL_CHP_MMHQENC ,
-/* } 125 */ MBFL_CHP_MMHQENC ,
-/* ~ 126 */ MBFL_CHP_MMHQENC ,
-/* DEL 127 */ MBFL_CHP_MMHQENC
-};
diff --git a/ext/mbstring/mbfilter.h b/ext/mbstring/mbfilter.h
deleted file mode 100644
index 5f93c7841b..0000000000
--- a/ext/mbstring/mbfilter.h
+++ /dev/null
@@ -1,547 +0,0 @@
-/* charset=UTF-8 */
-
-/*
- * "streamable kanji code filter and converter"
- *
- * Copyright (c) 1998,1999,2000,2001 HappySize, Inc. All rights reserved.
- *
- * This software is released under the GNU Lesser General Public License.
- * (Version 2.1, February 1999)
- * Please read the following detail of the licence (in japanese).
- *
- * ◆使用許諾æ¡ä»¶â—†
- *
- * ã“ã®ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã¯æ ªå¼ä¼šç¤¾ãƒãƒƒãƒ”ーサイズã«ã‚ˆã£ã¦é–‹ç™ºã•ã‚Œã¾ã—ãŸã€‚æ ªå¼ä¼šç¤¾ãƒãƒƒ
- * ピーサイズã¯ã€è‘—作権法ãŠã‚ˆã³ä¸‡å›½è‘—作権æ¡ç´„ã®å®šã‚ã«ã‚ˆã‚Šã€ã“ã®ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã«é–¢
- * ã™ã‚‹ã™ã¹ã¦ã®æ¨©åˆ©ã‚’ç•™ä¿ã™ã‚‹æ¨©åˆ©ã‚’æŒã¡ã€ã“ã“ã«è¡Œä½¿ã—ã¾ã™ã€‚æ ªå¼ä¼šç¤¾ãƒãƒƒãƒ”ーサイ
- * ズã¯ä»¥ä¸‹ã«æ˜Žè¨˜ã—ãŸæ¡ä»¶ã«å¾“ã£ã¦ã€ã“ã®ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã‚’使用ã™ã‚‹æŽ’ä»–çš„ã§ã¯ãªã„権利
- * ã‚’ãŠå®¢æ§˜ã«è¨±è«¾ã—ã¾ã™ã€‚何人ãŸã‚Šã¨ã‚‚ã€ä»¥ä¸‹ã®æ¡ä»¶ã«åã—ã¦ã“ã®ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã‚’使用
- * ã™ã‚‹ã“ã¨ã¯ã§ãã¾ã›ã‚“。
- *
- * ã“ã®ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã‚’「GNU Lesser General Public License (Version 2.1, February
- * 1999)ã€ã«ç¤ºã•ã‚ŒãŸæ¡ä»¶ã§ä½¿ç”¨ã™ã‚‹ã“ã¨ã‚’ã€å…¨ã¦ã®æ–¹ã«è¨±è«¾ã—ã¾ã™ã€‚「GNU Lesser
- * General Public Licenseã€ã‚’満ãŸã•ãªã„使用ã«ã¯ã€æ ªå¼ä¼šç¤¾ãƒãƒƒãƒ”ーサイズã‹ã‚‰æ›¸é¢
- * ã«ã‚ˆã‚‹è¨±è«¾ã‚’å¾—ã‚‹å¿…è¦ãŒã‚ã‚Šã¾ã™ã€‚
- *
- * 「GNU Lesser General Public Licenseã€ã®å…¨æ–‡ã¯ä»¥ä¸‹ã®ã‚¦ã‚§ãƒ–ページã‹ã‚‰å–å¾—ã§ã
- * ã¾ã™ã€‚「GNU Lesser General Public Licenseã€ã¨ã¯ã€ã“ã‚Œã¾ã§Library General
- * Public Licenseã¨å‘¼ã°ã‚Œã¦ã„ãŸã‚‚ã®ã§ã™ã€‚
- * http://www.gnu.org/ --- GNUウェブサイト
- * http://www.gnu.org/copyleft/lesser.html --- ライセンス文é¢
- * ã“ã®ãƒ©ã‚¤ã‚»ãƒ³ã‚¹ã®å†…容ãŒã‚ã‹ã‚‰ãªã„æ–¹ã€å®ˆã‚Œãªã„æ–¹ã«ã¯ä½¿ç”¨ã‚’許諾ã—ã¾ã›ã‚“。
- *
- * ã—ã‹ã—ãªãŒã‚‰ã€å½“社ã¨GNUプロジェクトã¨ã®ç‰¹å®šã®é–¢ä¿‚を示唆ã¾ãŸã¯ä¸»å¼µã™ã‚‹ã‚‚ã®ã§
- * ã¯ã‚ã‚Šã¾ã›ã‚“。
- *
- * â—†ä¿è¨¼å†…容◆
- *
- * ã“ã®ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã¯ã€æœŸå¾…ã•ã‚ŒãŸå‹•ä½œãƒ»æ©Ÿèƒ½ãƒ»æ€§èƒ½ã‚’æŒã¤ã“ã¨ã‚’目標ã¨ã—ã¦è¨­è¨ˆã•ã‚Œ
- * 開発ã•ã‚Œã¦ã„ã¾ã™ãŒã€ã“れをä¿è¨¼ã™ã‚‹ã‚‚ã®ã§ã¯ã‚ã‚Šã¾ã›ã‚“。ã“ã®ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã¯ã€Œã“
- * ã®ã¾ã¾ã€ã®çŠ¶æ…‹ã§æä¾›ã•ã‚Œã¦ãŠã‚Šã€ãŸã¨ãˆã°ã“ã®ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã®æœ‰ç”¨æ€§ãªã„ã—特定ã®
- * 目的ã«åˆè‡´ã™ã‚‹ã“ã¨ã¨ã„ã£ãŸã€ä½•ã‚‰ã‹ã®ä¿è¨¼å†…容ãŒã€æ˜Žç¤ºã•ã‚ŒãŸã‚Šæš—é»™ã«ç¤ºã•ã‚Œã¦ã„
- * ã‚‹å ´åˆã§ã‚ã£ã¦ã‚‚ã€ãã®ä¿è¨¼ã¯ç„¡åŠ¹ã§ã™ã€‚ã“ã®ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã‚’使用ã—ãŸçµæžœãªã„ã—使
- * 用ã—ãªã‹ã£ãŸçµæžœã«ã‚ˆã£ã¦ã€ç›´æŽ¥ã‚ã‚‹ã„ã¯é–“接ã«å—ã‘ãŸèº«ä½“çš„ãªå‚·å®³ã€è²¡ç”£ä¸Šã®æ害
- * ã€ãƒ‡ãƒ¼ã‚¿ã®æ失ã‚ã‚‹ã„ã¯ãã®ä»–ã®å…¨ã¦ã®æ害ã«ã¤ã„ã¦ã¯ã€ãã®æ害ã®å¯èƒ½æ€§ãŒä½¿ç”¨è€…
- * ã€å½“社ã‚ã‚‹ã„ã¯ç¬¬ä¸‰è€…ã«ã‚ˆã£ã¦è­¦å‘Šã•ã‚Œã¦ã„ãŸå ´åˆã§ã‚ã£ã¦ã‚‚ã€å½“社ã¯ãã®æ害ã®è³ 
- * å„ŸãŠã‚ˆã³è£œå¡«ã‚’è¡Œã„ã¾ã›ã‚“。ã“ã®è¦å®šã¯ä»–ã®å…¨ã¦ã®ã€æ›¸é¢ä¸Šã¾ãŸã¯æ›¸é¢ã«ç„¡ã„ä¿è¨¼ãƒ»
- * 契約・è¦å®šã«å„ªå…ˆã—ã¾ã™ã€‚
- *
- * ◆著作権者ã®é€£çµ¡å…ˆãŠã‚ˆã³ä½¿ç”¨æ¡ä»¶ã«ã¤ã„ã¦ã®å•ã„åˆã‚ã›å…ˆâ—†
- *
- * 〒102-0073
- * æ±äº¬éƒ½åƒä»£ç”°åŒºä¹æ®µåŒ—1-13-5日本地所第一ビル4F
- * æ ªå¼ä¼šç¤¾ãƒãƒƒãƒ”ーサイズ
- * Phone: 03-3512-3655, Fax: 03-3512-3656
- * Email: sales@happysize.co.jp
- * Web: http://happysize.com/
- *
- * ◆著者◆
- *
- * 金本 茂 <sgk@happysize.co.jp>
- *
- * ◆履歴◆
- *
- * 1998/11/10 sgk implementation in C++
- * 1999/4/25 sgk Cã§æ›¸ããªãŠã—。
- * 1999/4/26 sgk 入力フィルタを実装。漢字コードを推定ã—ãªãŒã‚‰ãƒ•ã‚£ãƒ«ã‚¿ã‚’追加。
- * 1999/6/?? Unicodeサãƒãƒ¼ãƒˆã€‚
- * 1999/6/22 sgk ライセンスをLGPLã«å¤‰æ›´ã€‚
- *
- */
-
-/*
- * Unicode support
- *
- * Portions copyright (c) 1999,2000,2001 by the PHP3 internationalization team.
- * All rights reserved.
- *
- */
-
-/*
- *
- * streamable kanji code filter and converter
- * mbfl : Multi Byte FiLter Liblary
- *
- */
-
-/* $Id$ */
-
-
-#ifndef MBFL_MBFILTER_H
-#define MBFL_MBFILTER_H
-
-enum mbfl_no_language {
- mbfl_no_language_invalid = -1,
- mbfl_no_language_uni,
- mbfl_no_language_min,
- mbfl_no_language_catalan, /* ca */
- mbfl_no_language_danish, /* da */
- mbfl_no_language_german, /* de */
- mbfl_no_language_english, /* en */
- mbfl_no_language_estonian, /* et */
- mbfl_no_language_greek, /* el */
- mbfl_no_language_spanish, /* es */
- mbfl_no_language_french, /* fr */
- mbfl_no_language_italian, /* it */
- mbfl_no_language_japanese, /* ja */
- mbfl_no_language_korean, /* ko */
- mbfl_no_language_dutch, /* nl */
- mbfl_no_language_polish, /* pl */
- mbfl_no_language_portuguese, /* pt */
- mbfl_no_language_swedish, /* sv */
- mbfl_no_language_chinese, /* zh */
- mbfl_no_language_max
-};
-
-enum mbfl_no_encoding {
- mbfl_no_encoding_invalid = -1,
- mbfl_no_encoding_pass,
- mbfl_no_encoding_auto,
- mbfl_no_encoding_wchar,
- mbfl_no_encoding_byte2be,
- mbfl_no_encoding_byte2le,
- mbfl_no_encoding_byte4be,
- mbfl_no_encoding_byte4le,
- mbfl_no_encoding_base64,
- mbfl_no_encoding_uuencode,
- mbfl_no_encoding_qprint,
- mbfl_no_encoding_7bit,
- mbfl_no_encoding_8bit,
- mbfl_no_encoding_charset_min,
- mbfl_no_encoding_ucs4,
- mbfl_no_encoding_ucs4be,
- mbfl_no_encoding_ucs4le,
- mbfl_no_encoding_ucs2,
- mbfl_no_encoding_ucs2be,
- mbfl_no_encoding_ucs2le,
- mbfl_no_encoding_utf32,
- mbfl_no_encoding_utf32be,
- mbfl_no_encoding_utf32le,
- mbfl_no_encoding_utf16,
- mbfl_no_encoding_utf16be,
- mbfl_no_encoding_utf16le,
- mbfl_no_encoding_utf8,
- mbfl_no_encoding_utf7,
- mbfl_no_encoding_utf7imap,
- mbfl_no_encoding_ascii,
- mbfl_no_encoding_euc_jp,
- mbfl_no_encoding_sjis,
- mbfl_no_encoding_eucjp_win,
- mbfl_no_encoding_sjis_win,
- mbfl_no_encoding_sjis_mac,
- mbfl_no_encoding_jis,
- mbfl_no_encoding_2022jp,
- mbfl_no_encoding_8859_1,
- mbfl_no_encoding_8859_2,
- mbfl_no_encoding_8859_3,
- mbfl_no_encoding_8859_4,
- mbfl_no_encoding_8859_5,
- mbfl_no_encoding_8859_6,
- mbfl_no_encoding_8859_7,
- mbfl_no_encoding_8859_8,
- mbfl_no_encoding_8859_9,
- mbfl_no_encoding_8859_10,
- mbfl_no_encoding_8859_13,
- mbfl_no_encoding_8859_14,
- mbfl_no_encoding_8859_15,
- mbfl_no_encoding_charset_max
-};
-
-
-/*
- * language
- */
-typedef struct _mbfl_language {
- enum mbfl_no_language no_language;
- const char *name;
- const char *short_name;
- const char *(*aliases)[];
- enum mbfl_no_encoding mail_charset;
- enum mbfl_no_encoding mail_header_encoding;
- enum mbfl_no_encoding mail_body_encoding;
-} mbfl_language;
-
-
-/*
- * encoding
- */
-typedef struct _mbfl_encoding {
- enum mbfl_no_encoding no_encoding;
- const char *name;
- const char *mime_name;
- const char *(*aliases)[];
- const unsigned char *mblen_table;
- unsigned int flag;
-} mbfl_encoding;
-
-
-#define MBFL_ENCTYPE_SBCS 0x00000001
-#define MBFL_ENCTYPE_MBCS 0x00000002
-#define MBFL_ENCTYPE_WCS2BE 0x00000010
-#define MBFL_ENCTYPE_WCS2LE 0x00000020
-#define MBFL_ENCTYPE_MWC2BE 0x00000040
-#define MBFL_ENCTYPE_MWC2LE 0x00000080
-#define MBFL_ENCTYPE_WCS4BE 0x00000100
-#define MBFL_ENCTYPE_WCS4LE 0x00000200
-#define MBFL_ENCTYPE_MWC4BE 0x00000400
-#define MBFL_ENCTYPE_MWC4LE 0x00000800
-#define MBFL_ENCTYPE_SHFTCODE 0x00001000
-
-/* wchar plane, spesial charactor */
-#define MBFL_WCSPLANE_MASK 0xffff
-#define MBFL_WCSPLANE_UCS2MAX 0x00010000
-#define MBFL_WCSPLANE_SUPMIN 0x00010000
-#define MBFL_WCSPLANE_SUPMAX 0x00200000
-#define MBFL_WCSPLANE_JIS0208 0x70e10000 /* JIS HEX : 2121h - 7E7Eh */
-#define MBFL_WCSPLANE_JIS0212 0x70e20000 /* JIS HEX : 2121h - 7E7Eh */
-#define MBFL_WCSPLANE_WINCP932 0x70e30000 /* JIS HEX : 2121h - 9898h */
-#define MBFL_WCSPLANE_8859_1 0x70e40000 /* 00h - FFh */
-#define MBFL_WCSPLANE_8859_2 0x70e50000 /* 00h - FFh */
-#define MBFL_WCSPLANE_8859_3 0x70e60000 /* 00h - FFh */
-#define MBFL_WCSPLANE_8859_4 0x70e70000 /* 00h - FFh */
-#define MBFL_WCSPLANE_8859_5 0x70e80000 /* 00h - FFh */
-#define MBFL_WCSPLANE_8859_6 0x70e90000 /* 00h - FFh */
-#define MBFL_WCSPLANE_8859_7 0x70ea0000 /* 00h - FFh */
-#define MBFL_WCSPLANE_8859_8 0x70eb0000 /* 00h - FFh */
-#define MBFL_WCSPLANE_8859_9 0x70ec0000 /* 00h - FFh */
-#define MBFL_WCSPLANE_8859_10 0x70ed0000 /* 00h - FFh */
-#define MBFL_WCSPLANE_8859_13 0x70ee0000 /* 00h - FFh */
-#define MBFL_WCSPLANE_8859_14 0x70ef0000 /* 00h - FFh */
-#define MBFL_WCSPLANE_8859_15 0x70f00000 /* 00h - FFh */
-#define MBFL_WCSPLANE_KSC5601 0x70f10000 /* 2121h - 7E7Eh */
-#define MBFL_WCSPLANE_GB2312 0x70f20000 /* 2121h - 7E7Eh */
-
-#define MBFL_WCSGROUP_MASK 0xffffff
-#define MBFL_WCSGROUP_UCS4MAX 0x70000000
-#define MBFL_WCSGROUP_WCHARMAX 0x78000000
-#define MBFL_WCSGROUP_THROUGH 0x78000000 /* 000000h - FFFFFFh */
-
-
-/*
- * string object
- */
-typedef struct _mbfl_string {
- enum mbfl_no_language no_language;
- enum mbfl_no_encoding no_encoding;
- unsigned char *val;
- unsigned int len;
-} mbfl_string;
-
-void mbfl_string_init(mbfl_string *string);
-void mbfl_string_init_set(mbfl_string *string, enum mbfl_no_language no_language, enum mbfl_no_encoding no_encoding);
-void mbfl_string_clear(mbfl_string *string);
-
-
-/*
- * language resolver
- */
-mbfl_language * mbfl_name2language(const char *name);
-mbfl_language * mbfl_no2language(enum mbfl_no_language no_language);
-enum mbfl_no_language mbfl_name2no_language(const char *name);
-const char * mbfl_no_language2name(enum mbfl_no_language no_language);
-
-
-/*
- * encoding resolver
- */
-mbfl_encoding * mbfl_name2encoding(const char *name);
-mbfl_encoding * mbfl_no2encoding(enum mbfl_no_encoding no_encoding);
-enum mbfl_no_encoding mbfl_name2no_encoding(const char *name);
-const char * mbfl_no_encoding2name(enum mbfl_no_encoding no_encoding);
-const char * mbfl_no2preferred_mime_name(enum mbfl_no_encoding no_encoding);
-int mbfl_is_support_encoding(const char *name);
-
-
-/*
- * memory output function
- */
-#define MBFL_MEMORY_DEVICE_ALLOC_SIZE 64
-
-typedef struct _mbfl_memory_device {
- unsigned char *buffer;
- int length;
- int pos;
- int allocsz;
-} mbfl_memory_device;
-
-typedef struct _mbfl_wchar_device {
- unsigned int *buffer;
- int length;
- int pos;
- int allocsz;
-} mbfl_wchar_device;
-
-void mbfl_memory_device_init(mbfl_memory_device *device, int initsz, int allocsz);
-void mbfl_memory_device_realloc(mbfl_memory_device *device, int initsz, int allocsz);
-void mbfl_memory_device_clear(mbfl_memory_device *device);
-void mbfl_memory_device_reset(mbfl_memory_device *device);
-mbfl_string * mbfl_memory_device_result(mbfl_memory_device *device, mbfl_string *result);
-int mbfl_memory_device_output(int c, void *data);
-int mbfl_memory_device_output2(int c, void *data);
-int mbfl_memory_device_output4(int c, void *data);
-int mbfl_memory_device_strcat(mbfl_memory_device *device, const char *psrc);
-int mbfl_memory_device_strncat(mbfl_memory_device *device, const char *psrc, int len);
-int mbfl_memory_device_devcat(mbfl_memory_device *dest, mbfl_memory_device *src);
-
-void mbfl_wchar_device_init(mbfl_wchar_device *device);
-int mbfl_wchar_device_output(int c, void *data);
-
-
-/*
- * convert filter
- */
-#define MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE 0
-#define MBFL_OUTPUTFILTER_ILLEGAL_MODE_CHAR 1
-#define MBFL_OUTPUTFILTER_ILLEGAL_MODE_LONG 2
-
-typedef struct _mbfl_convert_filter mbfl_convert_filter;
-
-struct _mbfl_convert_filter {
- void (*filter_ctor)(mbfl_convert_filter *filter);
- void (*filter_dtor)(mbfl_convert_filter *filter);
- int (*filter_function)(int c, mbfl_convert_filter *filter);
- int (*filter_flush)(mbfl_convert_filter *filter);
- int (*output_function)(int c, void *data);
- int (*flush_function)(void *data);
- void *data;
- int status;
- int cache;
- mbfl_encoding *from;
- mbfl_encoding *to;
- int illegal_mode;
- int illegal_substchar;
-};
-
-struct mbfl_convert_vtbl {
- enum mbfl_no_encoding from;
- enum mbfl_no_encoding to;
- void (*filter_ctor)(mbfl_convert_filter *filter);
- void (*filter_dtor)(mbfl_convert_filter *filter);
- int (*filter_function)(int c, mbfl_convert_filter *filter);
- int (*filter_flush)(mbfl_convert_filter *filter);
-};
-
-mbfl_convert_filter *
-mbfl_convert_filter_new(
- enum mbfl_no_encoding from,
- enum mbfl_no_encoding to,
- int (*output_function)(int, void *),
- int (*flush_function)(void *),
- void *data);
-void mbfl_convert_filter_delete(mbfl_convert_filter *filter);
-int mbfl_convert_filter_feed(int c, mbfl_convert_filter *filter);
-int mbfl_convert_filter_flush(mbfl_convert_filter *filter);
-void mbfl_convert_filter_reset(mbfl_convert_filter *filter, enum mbfl_no_encoding from, enum mbfl_no_encoding to);
-void mbfl_convert_filter_copy(mbfl_convert_filter *src, mbfl_convert_filter *dist);
-int mbfl_filt_conv_illegal_output(int c, mbfl_convert_filter *filter);
-
-
-/*
- * identify filter
- */
-typedef struct _mbfl_identify_filter mbfl_identify_filter;
-
-struct _mbfl_identify_filter {
- void (*filter_ctor)(mbfl_identify_filter *filter);
- void (*filter_dtor)(mbfl_identify_filter *filter);
- int (*filter_function)(int c, mbfl_identify_filter *filter);
- int status;
- int flag;
- int score;
- mbfl_encoding *encoding;
-};
-
-struct mbfl_identify_vtbl {
- enum mbfl_no_encoding encoding;
- void (*filter_ctor)(mbfl_identify_filter *filter);
- void (*filter_dtor)(mbfl_identify_filter *filter);
- int (*filter_function)(int c, mbfl_identify_filter *filter);
-};
-
-mbfl_identify_filter * mbfl_identify_filter_new(enum mbfl_no_encoding encoding);
-void mbfl_identify_filter_delete(mbfl_identify_filter *filter);
-
-
-/*
- * buffering converter
- */
-typedef struct _mbfl_buffer_converter mbfl_buffer_converter;
-
-struct _mbfl_buffer_converter {
- mbfl_convert_filter *filter1;
- mbfl_convert_filter *filter2;
- mbfl_memory_device device;
- mbfl_encoding *from;
- mbfl_encoding *to;
-};
-
-mbfl_buffer_converter * mbfl_buffer_converter_new(enum mbfl_no_encoding from, enum mbfl_no_encoding to, int buf_initsz);
-void mbfl_buffer_converter_delete(mbfl_buffer_converter *convd);
-void mbfl_buffer_converter_reset(mbfl_buffer_converter *convd);
-int mbfl_buffer_converter_illegal_mode(mbfl_buffer_converter *convd, int mode);
-int mbfl_buffer_converter_illegal_substchar(mbfl_buffer_converter *convd, int substchar);
-int mbfl_buffer_converter_strncat(mbfl_buffer_converter *convd, const unsigned char *p, int n);
-int mbfl_buffer_converter_feed(mbfl_buffer_converter *convd, mbfl_string *string);
-int mbfl_buffer_converter_flush(mbfl_buffer_converter *convd);
-mbfl_string * mbfl_buffer_converter_getbuffer(mbfl_buffer_converter *convd, mbfl_string *result);
-mbfl_string * mbfl_buffer_converter_result(mbfl_buffer_converter *convd, mbfl_string *result);
-mbfl_string * mbfl_buffer_converter_feed_result(mbfl_buffer_converter *convd, mbfl_string *string, mbfl_string *result);
-
-
-/*
- * encoding detector
- */
-typedef struct _mbfl_encoding_detector mbfl_encoding_detector;
-
-struct _mbfl_encoding_detector {
- mbfl_identify_filter **filter_list;
- int filter_list_size;
-};
-
-mbfl_encoding_detector * mbfl_encoding_detector_new(enum mbfl_no_encoding *elist, int eliztsz);
-void mbfl_encoding_detector_delete(mbfl_encoding_detector *identd);
-int mbfl_encoding_detector_feed(mbfl_encoding_detector *identd, mbfl_string *string);
-enum mbfl_no_encoding mbfl_encoding_detector_judge(mbfl_encoding_detector *identd);
-
-
-/*
- * encoding converter
- */
-mbfl_string *
-mbfl_convert_encoding(mbfl_string *string, mbfl_string *result, enum mbfl_no_encoding toenc);
-
-
-/*
- * identify encoding
- */
-mbfl_encoding *
-mbfl_identify_encoding(mbfl_string *string, enum mbfl_no_encoding *elist, int eliztsz);
-
-const char *
-mbfl_identify_encoding_name(mbfl_string *string, enum mbfl_no_encoding *elist, int eliztsz);
-
-enum mbfl_no_encoding
-mbfl_identify_encoding_no(mbfl_string *string, enum mbfl_no_encoding *elist, int eliztsz);
-
-/*
- * strlen
- */
-int
-mbfl_strlen(mbfl_string *string);
-
-/*
- * strpos
- */
-int
-mbfl_strpos(mbfl_string *haystack, mbfl_string *needle, int offset, int reverse);
-
-/*
- * substr
- */
-mbfl_string *
-mbfl_substr(mbfl_string *string, mbfl_string *result, int from, int length);
-
-/*
- * strcut
- */
-mbfl_string *
-mbfl_strcut(mbfl_string *string, mbfl_string *result, int from, int length);
-
-/*
- * strwidth
- */
-int
-mbfl_strwidth(mbfl_string *string);
-
-/*
- * strimwidth
- */
-mbfl_string *
-mbfl_strimwidth(mbfl_string *string, mbfl_string *marker, mbfl_string *result, int from, int width);
-
-/*
- * MIME header encode
- */
-struct mime_header_encoder_data; /* forward declaration */
-
-struct mime_header_encoder_data *
-mime_header_encoder_new(
- enum mbfl_no_encoding incode,
- enum mbfl_no_encoding outcode,
- enum mbfl_no_encoding encoding);
-
-void
-mime_header_encoder_delete(struct mime_header_encoder_data *pe);
-
-int
-mime_header_encoder_feed(int c, struct mime_header_encoder_data *pe);
-
-mbfl_string *
-mime_header_encoder_result(struct mime_header_encoder_data *pe, mbfl_string *result);
-
-mbfl_string *
-mbfl_mime_header_encode(
- mbfl_string *string, mbfl_string *result,
- enum mbfl_no_encoding outcode,
- enum mbfl_no_encoding encoding,
- const char *linefeed,
- int indent);
-
-/*
- * MIME header decode
- */
-struct mime_header_decoder_data; /* forward declaration */
-
-struct mime_header_decoder_data *
-mime_header_decoder_new(enum mbfl_no_encoding outcode);
-
-void
-mime_header_decoder_delete(struct mime_header_decoder_data *pd);
-
-int
-mime_header_decoder_feed(int c, struct mime_header_decoder_data *pd);
-
-mbfl_string *
-mime_header_decoder_result(struct mime_header_decoder_data *pd, mbfl_string *result);
-
-mbfl_string *
-mbfl_mime_header_decode(
- mbfl_string *string,
- mbfl_string *result,
- enum mbfl_no_encoding outcode);
-
-
-/*
- * convert HTML numeric entity
- */
-mbfl_string *
-mbfl_html_numeric_entity(mbfl_string *string, mbfl_string *result, int *convmap, int mapsize, int type);
-
-
-/*
- * convert of harfwidth and fullwidth for japanese
- */
-mbfl_string *
-mbfl_ja_jp_hantozen(mbfl_string *string, mbfl_string *result, int mode);
-
-#endif /* MBFL_MBFILTER_H */
diff --git a/ext/mbstring/mbfilter_ja.c b/ext/mbstring/mbfilter_ja.c
deleted file mode 100644
index aad415b0de..0000000000
--- a/ext/mbstring/mbfilter_ja.c
+++ /dev/null
@@ -1,7334 +0,0 @@
-/* charset=UTF-8 */
-
-/*
- * "streamable kanji code filter and converter"
- *
- * Copyright (c) 1998,1999,2000,2001 HappySize, Inc. All rights reserved.
- *
- * This software is released under the GNU Lesser General Public License.
- * (Version 2.1, February 1999)
- * Please read the following detail of the licence (in japanese).
- *
- * ◆使用許諾æ¡ä»¶â—†
- *
- * ã“ã®ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã¯æ ªå¼ä¼šç¤¾ãƒãƒƒãƒ”ーサイズã«ã‚ˆã£ã¦é–‹ç™ºã•ã‚Œã¾ã—ãŸã€‚æ ªå¼ä¼šç¤¾ãƒãƒƒ
- * ピーサイズã¯ã€è‘—作権法ãŠã‚ˆã³ä¸‡å›½è‘—作権æ¡ç´„ã®å®šã‚ã«ã‚ˆã‚Šã€ã“ã®ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã«é–¢
- * ã™ã‚‹ã™ã¹ã¦ã®æ¨©åˆ©ã‚’ç•™ä¿ã™ã‚‹æ¨©åˆ©ã‚’æŒã¡ã€ã“ã“ã«è¡Œä½¿ã—ã¾ã™ã€‚æ ªå¼ä¼šç¤¾ãƒãƒƒãƒ”ーサイ
- * ズã¯ä»¥ä¸‹ã«æ˜Žè¨˜ã—ãŸæ¡ä»¶ã«å¾“ã£ã¦ã€ã“ã®ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã‚’使用ã™ã‚‹æŽ’ä»–çš„ã§ã¯ãªã„権利
- * ã‚’ãŠå®¢æ§˜ã«è¨±è«¾ã—ã¾ã™ã€‚何人ãŸã‚Šã¨ã‚‚ã€ä»¥ä¸‹ã®æ¡ä»¶ã«åã—ã¦ã“ã®ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã‚’使用
- * ã™ã‚‹ã“ã¨ã¯ã§ãã¾ã›ã‚“。
- *
- * ã“ã®ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã‚’「GNU Lesser General Public License (Version 2.1, February
- * 1999)ã€ã«ç¤ºã•ã‚ŒãŸæ¡ä»¶ã§ä½¿ç”¨ã™ã‚‹ã“ã¨ã‚’ã€å…¨ã¦ã®æ–¹ã«è¨±è«¾ã—ã¾ã™ã€‚「GNU Lesser
- * General Public Licenseã€ã‚’満ãŸã•ãªã„使用ã«ã¯ã€æ ªå¼ä¼šç¤¾ãƒãƒƒãƒ”ーサイズã‹ã‚‰æ›¸é¢
- * ã«ã‚ˆã‚‹è¨±è«¾ã‚’å¾—ã‚‹å¿…è¦ãŒã‚ã‚Šã¾ã™ã€‚
- *
- * 「GNU Lesser General Public Licenseã€ã®å…¨æ–‡ã¯ä»¥ä¸‹ã®ã‚¦ã‚§ãƒ–ページã‹ã‚‰å–å¾—ã§ã
- * ã¾ã™ã€‚「GNU Lesser General Public Licenseã€ã¨ã¯ã€ã“ã‚Œã¾ã§Library General
- * Public Licenseã¨å‘¼ã°ã‚Œã¦ã„ãŸã‚‚ã®ã§ã™ã€‚
- * http://www.gnu.org/ --- GNUウェブサイト
- * http://www.gnu.org/copyleft/lesser.html --- ライセンス文é¢
- * ã“ã®ãƒ©ã‚¤ã‚»ãƒ³ã‚¹ã®å†…容ãŒã‚ã‹ã‚‰ãªã„æ–¹ã€å®ˆã‚Œãªã„æ–¹ã«ã¯ä½¿ç”¨ã‚’許諾ã—ã¾ã›ã‚“。
- *
- * ã—ã‹ã—ãªãŒã‚‰ã€å½“社ã¨GNUプロジェクトã¨ã®ç‰¹å®šã®é–¢ä¿‚を示唆ã¾ãŸã¯ä¸»å¼µã™ã‚‹ã‚‚ã®ã§
- * ã¯ã‚ã‚Šã¾ã›ã‚“。
- *
- * â—†ä¿è¨¼å†…容◆
- *
- * ã“ã®ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã¯ã€æœŸå¾…ã•ã‚ŒãŸå‹•ä½œãƒ»æ©Ÿèƒ½ãƒ»æ€§èƒ½ã‚’æŒã¤ã“ã¨ã‚’目標ã¨ã—ã¦è¨­è¨ˆã•ã‚Œ
- * 開発ã•ã‚Œã¦ã„ã¾ã™ãŒã€ã“れをä¿è¨¼ã™ã‚‹ã‚‚ã®ã§ã¯ã‚ã‚Šã¾ã›ã‚“。ã“ã®ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã¯ã€Œã“
- * ã®ã¾ã¾ã€ã®çŠ¶æ…‹ã§æä¾›ã•ã‚Œã¦ãŠã‚Šã€ãŸã¨ãˆã°ã“ã®ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã®æœ‰ç”¨æ€§ãªã„ã—特定ã®
- * 目的ã«åˆè‡´ã™ã‚‹ã“ã¨ã¨ã„ã£ãŸã€ä½•ã‚‰ã‹ã®ä¿è¨¼å†…容ãŒã€æ˜Žç¤ºã•ã‚ŒãŸã‚Šæš—é»™ã«ç¤ºã•ã‚Œã¦ã„
- * ã‚‹å ´åˆã§ã‚ã£ã¦ã‚‚ã€ãã®ä¿è¨¼ã¯ç„¡åŠ¹ã§ã™ã€‚ã“ã®ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã‚’使用ã—ãŸçµæžœãªã„ã—使
- * 用ã—ãªã‹ã£ãŸçµæžœã«ã‚ˆã£ã¦ã€ç›´æŽ¥ã‚ã‚‹ã„ã¯é–“接ã«å—ã‘ãŸèº«ä½“çš„ãªå‚·å®³ã€è²¡ç”£ä¸Šã®æ害
- * ã€ãƒ‡ãƒ¼ã‚¿ã®æ失ã‚ã‚‹ã„ã¯ãã®ä»–ã®å…¨ã¦ã®æ害ã«ã¤ã„ã¦ã¯ã€ãã®æ害ã®å¯èƒ½æ€§ãŒä½¿ç”¨è€…
- * ã€å½“社ã‚ã‚‹ã„ã¯ç¬¬ä¸‰è€…ã«ã‚ˆã£ã¦è­¦å‘Šã•ã‚Œã¦ã„ãŸå ´åˆã§ã‚ã£ã¦ã‚‚ã€å½“社ã¯ãã®æ害ã®è³ 
- * å„ŸãŠã‚ˆã³è£œå¡«ã‚’è¡Œã„ã¾ã›ã‚“。ã“ã®è¦å®šã¯ä»–ã®å…¨ã¦ã®ã€æ›¸é¢ä¸Šã¾ãŸã¯æ›¸é¢ã«ç„¡ã„ä¿è¨¼ãƒ»
- * 契約・è¦å®šã«å„ªå…ˆã—ã¾ã™ã€‚
- *
- * ◆著作権者ã®é€£çµ¡å…ˆãŠã‚ˆã³ä½¿ç”¨æ¡ä»¶ã«ã¤ã„ã¦ã®å•ã„åˆã‚ã›å…ˆâ—†
- *
- * 〒102-0073
- * æ±äº¬éƒ½åƒä»£ç”°åŒºä¹æ®µåŒ—1-13-5日本地所第一ビル4F
- * æ ªå¼ä¼šç¤¾ãƒãƒƒãƒ”ーサイズ
- * Phone: 03-3512-3655, Fax: 03-3512-3656
- * Email: sales@happysize.co.jp
- * Web: http://happysize.com/
- *
- * ◆著者◆
- *
- * 金本 茂 <sgk@happysize.co.jp>
- *
- * ◆履歴◆
- *
- * 1998/11/10 sgk implementation in C++
- * 1999/4/25 sgk Cã§æ›¸ããªãŠã—。
- * 1999/4/26 sgk 入力フィルタを実装。漢字コードを推定ã—ãªãŒã‚‰ãƒ•ã‚£ãƒ«ã‚¿ã‚’追加。
- * 1999/6/?? Unicodeサãƒãƒ¼ãƒˆã€‚
- * 1999/6/22 sgk ライセンスをLGPLã«å¤‰æ›´ã€‚
- *
- */
-
-/*
- * Unicode support
- *
- * Portions copyright (c) 1999,2000,2001 by the PHP3 internationalization team.
- * All rights reserved.
- *
- */
-
-/* $Id$ */
-
-#include "mbfilter.h"
-#include "mbfilter_ja.h"
-
-/* cp932 table */
-extern const unsigned short cp932ext3_eucjp_table[];
-extern const int cp932ext3_eucjp_table_size;
-
-/* unicode table */
-extern const unsigned short jisx0208_ucs_table[];
-extern const unsigned short jisx0212_ucs_table[];
-extern const unsigned short cp932ext1_ucs_table[];
-extern const unsigned short cp932ext2_ucs_table[];
-extern const unsigned short cp932ext3_ucs_table[];
-extern const unsigned short ucs_a1_jis_table[];
-extern const unsigned short ucs_a2_jis_table[];
-extern const unsigned short ucs_i_jis_table[];
-extern const unsigned short ucs_r_jis_table[];
-extern const int jisx0208_ucs_table_size;
-extern const int jisx0212_ucs_table_size;
-extern const int cp932ext1_ucs_table_min;
-extern const int cp932ext1_ucs_table_max;
-extern const int cp932ext2_ucs_table_min;
-extern const int cp932ext2_ucs_table_max;
-extern const int cp932ext3_ucs_table_min;
-extern const int cp932ext3_ucs_table_max;
-extern const int ucs_a1_jis_table_min;
-extern const int ucs_a1_jis_table_max;
-extern const int ucs_a2_jis_table_min;
-extern const int ucs_a2_jis_table_max;
-extern const int ucs_i_jis_table_min;
-extern const int ucs_i_jis_table_max;
-extern const int ucs_r_jis_table_min;
-extern const int ucs_r_jis_table_max;
-
-#define CK(statement) do { if ((statement) < 0) return (-1); } while (0)
-
-#define SJIS_ENCODE(c1,c2,s1,s2) \
- do { \
- s1 = c1; \
- s1--; \
- s1 >>= 1; \
- if ((c1) < 0x5f) { \
- s1 += 0x71; \
- } else { \
- s1 += 0xb1; \
- } \
- s2 = c2; \
- if ((c1) & 1) { \
- if ((c2) < 0x60) { \
- s2--; \
- } \
- s2 += 0x20; \
- } else { \
- s2 += 0x7e; \
- } \
- } while (0)
-
-#define SJIS_DECODE(c1,c2,s1,s2) \
- do { \
- s1 = c1; \
- if (s1 < 0xa0) { \
- s1 -= 0x81; \
- } else { \
- s1 -= 0xc1; \
- } \
- s1 <<= 1; \
- s1 += 0x21; \
- s2 = c2; \
- if (s2 < 0x9f) { \
- if (s2 < 0x7f) { \
- s2++; \
- } \
- s2 -= 0x20; \
- } else { \
- s1++; \
- s2 -= 0x7e; \
- } \
- } while (0)
-
-
-/*
- * EUC-JP => wchar
- */
-int
-mbfl_filt_conv_eucjp_wchar(int c, mbfl_convert_filter *filter)
-{
- int c1, s, w;
-
- switch (filter->status) {
- case 0:
- if (c >= 0 && c < 0x80) { /* latin */
- CK((*filter->output_function)(c, filter->data));
- } else if (c > 0xa0 && c < 0xff) { /* X 0208 first char */
- filter->status = 1;
- filter->cache = c;
- } else if (c == 0x8e) { /* kana first char */
- filter->status = 2;
- } else if (c == 0x8f) { /* X 0212 first char */
- filter->status = 3;
- } else {
- w = c & MBFL_WCSGROUP_MASK;
- w |= MBFL_WCSGROUP_THROUGH;
- CK((*filter->output_function)(w, filter->data));
- }
- break;
-
- case 1: /* got first half */
- filter->status = 0;
- c1 = filter->cache;
- if (c > 0xa0 && c < 0xff) {
- s = (c1 - 0xa1)*94 + c - 0xa1;
- if (s >= 0 && s < jisx0208_ucs_table_size) {
- w = jisx0208_ucs_table[s];
- } else {
- w = 0;
- }
- if (w <= 0) {
- w = ((c1 & 0x7f) << 8) | (c & 0x7f);
- w &= MBFL_WCSPLANE_MASK;
- w |= MBFL_WCSPLANE_JIS0208;
- }
- CK((*filter->output_function)(w, filter->data));
- } else if ((c >= 0 && c < 0x21) || c == 0x7f) { /* CTLs */
- CK((*filter->output_function)(c, filter->data));
- } else {
- w = (c1 << 8) | c;
- w &= MBFL_WCSGROUP_MASK;
- w |= MBFL_WCSGROUP_THROUGH;
- CK((*filter->output_function)(w, filter->data));
- }
- break;
-
- case 2: /* got 0x8e */
- filter->status = 0;
- if (c > 0xa0 && c < 0xe0) {
- w = 0xfec0 + c;
- CK((*filter->output_function)(w, filter->data));
- } else if ((c >= 0 && c < 0x21) || c == 0x7f) { /* CTLs */
- CK((*filter->output_function)(c, filter->data));
- } else {
- w = 0x8e00 | c;
- w &= MBFL_WCSGROUP_MASK;
- w |= MBFL_WCSGROUP_THROUGH;
- CK((*filter->output_function)(w, filter->data));
- }
- break;
-
- case 3: /* got 0x8f, X 0212 first char */
- if ((c >= 0 && c < 0x21) || c == 0x7f) { /* CTLs */
- CK((*filter->output_function)(c, filter->data));
- filter->status = 0;
- } else {
- filter->status++;
- filter->cache = c;
- }
- break;
- case 4: /* got 0x8f, X 0212 second char */
- filter->status = 0;
- c1 = filter->cache;
- if (c1 > 0xa0 && c1 < 0xff && c > 0xa0 && c < 0xff) {
- s = (c1 - 0xa1)*94 + c - 0xa1;
- if (s >= 0 && s < jisx0212_ucs_table_size) {
- w = jisx0212_ucs_table[s];
- } else {
- w = 0;
- }
- if (w <= 0) {
- w = ((c1 & 0x7f) << 8) | (c & 0x7f);
- w &= MBFL_WCSPLANE_MASK;
- w |= MBFL_WCSPLANE_JIS0212;
- }
- CK((*filter->output_function)(w, filter->data));
- } else if ((c >= 0 && c < 0x21) || c == 0x7f) { /* CTLs */
- CK((*filter->output_function)(c, filter->data));
- } else {
- w = (c1 << 8) | c | 0x8f0000;
- w &= MBFL_WCSGROUP_MASK;
- w |= MBFL_WCSGROUP_THROUGH;
- CK((*filter->output_function)(w, filter->data));
- }
- break;
-
- default:
- filter->status = 0;
- break;
- }
-
- return c;
-}
-
-/*
- * wchar => EUC-JP
- */
-int
-mbfl_filt_conv_wchar_eucjp(int c, mbfl_convert_filter *filter)
-{
- int c1, s;
-
- s = 0;
- if (c >= ucs_a1_jis_table_min && c < ucs_a1_jis_table_max) {
- s = ucs_a1_jis_table[c - ucs_a1_jis_table_min];
- } else if (c >= ucs_a2_jis_table_min && c < ucs_a2_jis_table_max) {
- s = ucs_a2_jis_table[c - ucs_a2_jis_table_min];
- } else if (c >= ucs_i_jis_table_min && c < ucs_i_jis_table_max) {
- s = ucs_i_jis_table[c - ucs_i_jis_table_min];
- } else if (c >= ucs_r_jis_table_min && c < ucs_r_jis_table_max) {
- s = ucs_r_jis_table[c - ucs_r_jis_table_min];
- }
- if (s <= 0) {
- c1 = c & ~MBFL_WCSPLANE_MASK;
- if (c1 == MBFL_WCSPLANE_JIS0208) {
- s = c & MBFL_WCSPLANE_MASK;
- } else if (c1 == MBFL_WCSPLANE_JIS0212) {
- s = c & MBFL_WCSPLANE_MASK;
- s |= 0x8080;
- } else if (c == 0xff3c) { /* FULLWIDTH REVERSE SOLIDUS */
- s = 0x2140;
- } else if (c == 0xff5e) { /* FULLWIDTH TILDE */
- s = 0x2141;
- } else if (c == 0x2225) { /* PARALLEL TO */
- s = 0x2142;
- } else if (c == 0xff0d) { /* FULLWIDTH HYPHEN-MINUS */
- s = 0x215d;
- } else if (c == 0xffe0) { /* FULLWIDTH CENT SIGN */
- s = 0x2171;
- } else if (c == 0xffe1) { /* FULLWIDTH POUND SIGN */
- s = 0x2172;
- } else if (c == 0xffe2) { /* FULLWIDTH NOT SIGN */
- s = 0x224c;
- }
- if (c == 0) {
- s = 0;
- } else if (s <= 0) {
- s = -1;
- }
- }
- if (s >= 0) {
- if (s < 0x80) { /* latin */
- CK((*filter->output_function)(s, filter->data));
- } else if (s < 0x100) { /* kana */
- CK((*filter->output_function)(0x8e, filter->data));
- CK((*filter->output_function)(s, filter->data));
- } else if (s < 0x8080) { /* X 0208 */
- CK((*filter->output_function)(((s >> 8) & 0xff) | 0x80, filter->data));
- CK((*filter->output_function)((s & 0xff) | 0x80, filter->data));
- } else { /* X 0212 */
- CK((*filter->output_function)(0x8f, filter->data));
- CK((*filter->output_function)(((s >> 8) & 0xff) | 0x80, filter->data));
- CK((*filter->output_function)((s & 0xff) | 0x80, filter->data));
- }
- } else {
- if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) {
- CK(mbfl_filt_conv_illegal_output(c, filter));
- }
- }
-
- return c;
-}
-
-
-/*
- * eucJP-win => wchar
- */
-int
-mbfl_filt_conv_eucjpwin_wchar(int c, mbfl_convert_filter *filter)
-{
- int c1, s, w, n;
-
- switch (filter->status) {
- case 0:
- if (c >= 0 && c < 0x80) { /* latin */
- CK((*filter->output_function)(c, filter->data));
- } else if (c > 0xa0 && c < 0xff) { /* CP932 first char */
- filter->status = 1;
- filter->cache = c;
- } else if (c == 0x8e) { /* kana first char */
- filter->status = 2;
- } else if (c == 0x8f) { /* X 0212 first char */
- filter->status = 3;
- } else {
- w = c & MBFL_WCSGROUP_MASK;
- w |= MBFL_WCSGROUP_THROUGH;
- CK((*filter->output_function)(w, filter->data));
- }
- break;
-
- case 1: /* got first half */
- filter->status = 0;
- c1 = filter->cache;
- if (c > 0xa0 && c < 0xff) {
- w = 0;
- s = (c1 - 0xa1)*94 + c - 0xa1;
- if (s <= 137) {
- if (s == 31) {
- w = 0xff3c; /* FULLWIDTH REVERSE SOLIDUS */
- } else if (s == 32) {
- w = 0xff5e; /* FULLWIDTH TILDE */
- } else if (s == 33) {
- w = 0x2225; /* PARALLEL TO */
- } else if (s == 60) {
- w = 0xff0d; /* FULLWIDTH HYPHEN-MINUS */
- } else if (s == 80) {
- w = 0xffe0; /* FULLWIDTH CENT SIGN */
- } else if (s == 81) {
- w = 0xffe1; /* FULLWIDTH POUND SIGN */
- } else if (s == 137) {
- w = 0xffe2; /* FULLWIDTH NOT SIGN */
- }
- }
- if (w == 0) {
- if (s >= cp932ext1_ucs_table_min && s < cp932ext1_ucs_table_max) { /* vendor ext1 (13ku) */
- w = cp932ext1_ucs_table[s - cp932ext1_ucs_table_min];
- } else if (s >= 0 && s < jisx0208_ucs_table_size) { /* X 0208 */
- w = jisx0208_ucs_table[s];
- } else if (s >= (84*94)) { /* user (85ku - 94ku) */
- w = s - (84*94) + 0xe000;
- }
- }
- if (w <= 0) {
- w = ((c1 & 0x7f) << 8) | (c & 0x7f);
- w &= MBFL_WCSPLANE_MASK;
- w |= MBFL_WCSPLANE_WINCP932;
- }
- CK((*filter->output_function)(w, filter->data));
- } else if ((c >= 0 && c < 0x21) || c == 0x7f) { /* CTLs */
- CK((*filter->output_function)(c, filter->data));
- } else {
- w = (c1 << 8) | c;
- w &= MBFL_WCSGROUP_MASK;
- w |= MBFL_WCSGROUP_THROUGH;
- CK((*filter->output_function)(w, filter->data));
- }
- break;
-
- case 2: /* got 0x8e, X0201 kana */
- filter->status = 0;
- if (c > 0xa0 && c < 0xe0) {
- w = 0xfec0 + c;
- CK((*filter->output_function)(w, filter->data));
- } else if ((c >= 0 && c < 0x21) || c == 0x7f) { /* CTLs */
- CK((*filter->output_function)(c, filter->data));
- } else {
- w = 0x8e00 | c;
- w &= MBFL_WCSGROUP_MASK;
- w |= MBFL_WCSGROUP_THROUGH;
- CK((*filter->output_function)(w, filter->data));
- }
- break;
-
- case 3: /* got 0x8f, X 0212 first char */
- if ((c >= 0 && c < 0x21) || c == 0x7f) { /* CTLs */
- CK((*filter->output_function)(c, filter->data));
- filter->status = 0;
- } else {
- filter->status++;
- filter->cache = c;
- }
- break;
- case 4: /* got 0x8f, X 0212 second char */
- filter->status = 0;
- c1 = filter->cache;
- if (c1 > 0xa0 && c1 < 0xff && c > 0xa0 && c < 0xff) {
- s = (c1 - 0xa1)*94 + c - 0xa1;
- if (s >= 0 && s < jisx0212_ucs_table_size) {
- w = jisx0212_ucs_table[s];
- } else if (s >= (82*94) && s < (84*94)) { /* vender ext3 (83ku - 84ku) <-> CP932 (115ku -120ku) */
- s = (c1<< 8) | c;
- w = 0;
- n = 0;
- while (n < cp932ext3_eucjp_table_size) {
- if (s == cp932ext3_eucjp_table[n]) {
- if (n < (cp932ext3_ucs_table_max - cp932ext3_ucs_table_min)) {
- w = cp932ext3_ucs_table[n];
- }
- break;
- }
- n++;
- }
- } else if (s >= (84*94)) { /* user (85ku - 94ku) */
- w = s - (84*94) + (0xe000 + (94*10));
- } else {
- w = 0;
- }
- if (w <= 0) {
- w = ((c1 & 0x7f) << 8) | (c & 0x7f);
- w &= MBFL_WCSPLANE_MASK;
- w |= MBFL_WCSPLANE_JIS0212;
- }
- CK((*filter->output_function)(w, filter->data));
- } else if ((c >= 0 && c < 0x21) || c == 0x7f) { /* CTLs */
- CK((*filter->output_function)(c, filter->data));
- } else {
- w = (c1 << 8) | c | 0x8f0000;
- w &= MBFL_WCSGROUP_MASK;
- w |= MBFL_WCSGROUP_THROUGH;
- CK((*filter->output_function)(w, filter->data));
- }
- break;
-
- default:
- filter->status = 0;
- break;
- }
-
- return c;
-}
-
-/*
- * wchar => eucJP-win
- */
-int
-mbfl_filt_conv_wchar_eucjpwin(int c, mbfl_convert_filter *filter)
-{
- int c1, c2, s1;
-
- s1 = 0;
- if (c >= ucs_a1_jis_table_min && c < ucs_a1_jis_table_max) {
- s1 = ucs_a1_jis_table[c - ucs_a1_jis_table_min];
- } else if (c >= ucs_a2_jis_table_min && c < ucs_a2_jis_table_max) {
- s1 = ucs_a2_jis_table[c - ucs_a2_jis_table_min];
- } else if (c >= ucs_i_jis_table_min && c < ucs_i_jis_table_max) {
- s1 = ucs_i_jis_table[c - ucs_i_jis_table_min];
- } else if (c >= ucs_r_jis_table_min && c < ucs_r_jis_table_max) {
- s1 = ucs_r_jis_table[c - ucs_r_jis_table_min];
- } else if (c >= 0xe000 && c < (0xe000 + 10*94)) { /* user (X0208 85ku - 94ku) */
- s1 = c - 0xe000;
- c1 = s1/94 + 0x75;
- c2 = s1%94 + 0x21;
- s1 = (c1 << 8) | c2;
- } else if (c >= (0xe000 + 10*94) && c < (0xe000 + 20*94)) { /* user (X0212 85ku - 94ku) */
- s1 = c - (0xe000 + 10*94);
- c1 = s1/94 + 0xf5;
- c2 = s1%94 + 0xa1;
- s1 = (c1 << 8) | c2;
- }
- if (s1 <= 0) {
- c1 = c & ~MBFL_WCSPLANE_MASK;
- if (c1 == MBFL_WCSPLANE_WINCP932) {
- s1 = c & MBFL_WCSPLANE_MASK;
- if (s1 >= ((85 + 0x20) << 8)) { /* 85ku - 120ku */
- s1 = -1;
- }
- } else if (c1 == MBFL_WCSPLANE_JIS0208) {
- s1 = c & MBFL_WCSPLANE_MASK;
- if (s1 >= ((85 + 0x20) << 8)) { /* 85ku - 94ku */
- s1 = -1;
- }
- } else if (c1 == MBFL_WCSPLANE_JIS0212) {
- s1 = c & MBFL_WCSPLANE_MASK;
- if (s1 >= ((83 + 0x20) << 8)) { /* 83ku - 94ku */
- s1 = -1;
- } else {
- s1 |= 0x8080;
- }
- } else if (c == 0xa5) { /* YEN SIGN */
- s1 = 0x216f; /* FULLWIDTH YEN SIGN */
- } else if (c == 0x203e) { /* OVER LINE */
- s1 = 0x2131; /* FULLWIDTH MACRON */
- } else if (c == 0xff3c) { /* FULLWIDTH REVERSE SOLIDUS */
- s1 = 0x2140;
- } else if (c == 0xff5e) { /* FULLWIDTH TILDE */
- s1 = 0x2141;
- } else if (c == 0x2225) { /* PARALLEL TO */
- s1 = 0x2142;
- } else if (c == 0xff0d) { /* FULLWIDTH HYPHEN-MINUS */
- s1 = 0x215d;
- } else if (c == 0xffe0) { /* FULLWIDTH CENT SIGN */
- s1 = 0x2171;
- } else if (c == 0xffe1) { /* FULLWIDTH POUND SIGN */
- s1 = 0x2172;
- } else if (c == 0xffe2) { /* FULLWIDTH NOT SIGN */
- s1 = 0x224c;
- } else {
- s1 = -1;
- c1 = 0;
- c2 = cp932ext1_ucs_table_max - cp932ext1_ucs_table_min;
- while (c1 < c2) { /* CP932 vendor ext1 (13ku) */
- if (c == cp932ext1_ucs_table[c1]) {
- s1 = ((c1/94 + 0x2d) << 8) + (c1%94 + 0x21);
- break;
- }
- c1++;
- }
- if (s1 < 0) {
- c1 = 0;
- c2 = cp932ext3_ucs_table_max - cp932ext3_ucs_table_min;
- while (c1 < c2) { /* CP932 vendor ext3 (115ku - 119ku) */
- if (c == cp932ext3_ucs_table[c1]) {
- if (c1 < cp932ext3_eucjp_table_size) {
- s1 = cp932ext3_eucjp_table[c1];
- }
- break;
- }
- c1++;
- }
- }
- }
- if (c == 0) {
- s1 = 0;
- } else if (s1 <= 0) {
- s1 = -1;
- }
- }
-
- if (s1 >= 0) {
- if (s1 < 0x80) { /* latin */
- CK((*filter->output_function)(s1, filter->data));
- } else if (s1 < 0x100) { /* kana */
- CK((*filter->output_function)(0x8e, filter->data));
- CK((*filter->output_function)(s1, filter->data));
- } else if (s1 < 0x8080) { /* X 0208 */
- CK((*filter->output_function)(((s1 >> 8) & 0xff) | 0x80, filter->data));
- CK((*filter->output_function)((s1 & 0xff) | 0x80, filter->data));
- } else { /* X 0212 */
- CK((*filter->output_function)(0x8f, filter->data));
- CK((*filter->output_function)(((s1 >> 8) & 0xff) | 0x80, filter->data));
- CK((*filter->output_function)((s1 & 0xff) | 0x80, filter->data));
- }
- } else {
- if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) {
- CK(mbfl_filt_conv_illegal_output(c, filter));
- }
- }
-
- return c;
-}
-
-
-/*
- * SJIS => wchar
- */
-int
-mbfl_filt_conv_sjis_wchar(int c, mbfl_convert_filter *filter)
-{
- int c1, s1, s2, w;
-
- switch (filter->status) {
- case 0:
- if (c >= 0 && c < 0x80) { /* latin */
- CK((*filter->output_function)(c, filter->data));
- } else if (c > 0xa0 && c < 0xe0) { /* kana */
- CK((*filter->output_function)(0xfec0 + c, filter->data));
- } else if (c > 0x80 && c < 0xfd && c != 0xa0) { /* kanji first char */
- filter->status = 1;
- filter->cache = c;
- } else {
- w = c & MBFL_WCSGROUP_MASK;
- w |= MBFL_WCSGROUP_THROUGH;
- CK((*filter->output_function)(w, filter->data));
- }
- break;
-
- case 1: /* kanji second char */
- filter->status = 0;
- c1 = filter->cache;
- if (c > 0x39 && c < 0xfd && c != 0x7f) {
- SJIS_DECODE(c1, c, s1, s2);
- w = (s1 - 0x21)*94 + s2 - 0x21;
- if (w >= 0 && w < jisx0208_ucs_table_size) {
- w = jisx0208_ucs_table[w];
- } else {
- w = 0;
- }
- if (w <= 0) {
- if (s1 < 0x7f && s2 < 0x7f) {
- w = (s1 << 8) | s2;
- w &= MBFL_WCSPLANE_MASK;
- w |= MBFL_WCSPLANE_JIS0208;
- } else {
- w = (c1 << 8) | c;
- w &= MBFL_WCSGROUP_MASK;
- w |= MBFL_WCSGROUP_THROUGH;
- }
- }
- CK((*filter->output_function)(w, filter->data));
- } else if ((c >= 0 && c < 0x21) || c == 0x7f) { /* CTLs */
- CK((*filter->output_function)(c, filter->data));
- } else {
- w = (c1 << 8) | c;
- w &= MBFL_WCSGROUP_MASK;
- w |= MBFL_WCSGROUP_THROUGH;
- CK((*filter->output_function)(w, filter->data));
- }
- break;
-
- default:
- filter->status = 0;
- break;
- }
-
- return c;
-}
-
-/*
- * wchar => SJIS
- */
-int
-mbfl_filt_conv_wchar_sjis(int c, mbfl_convert_filter *filter)
-{
- int c1, c2, s1, s2;
-
- s1 = 0;
- if (c >= ucs_a1_jis_table_min && c < ucs_a1_jis_table_max) {
- s1 = ucs_a1_jis_table[c - ucs_a1_jis_table_min];
- } else if (c >= ucs_a2_jis_table_min && c < ucs_a2_jis_table_max) {
- s1 = ucs_a2_jis_table[c - ucs_a2_jis_table_min];
- } else if (c >= ucs_i_jis_table_min && c < ucs_i_jis_table_max) {
- s1 = ucs_i_jis_table[c - ucs_i_jis_table_min];
- } else if (c >= ucs_r_jis_table_min && c < ucs_r_jis_table_max) {
- s1 = ucs_r_jis_table[c - ucs_r_jis_table_min];
- }
- if (s1 <= 0) {
- c1 = c & ~MBFL_WCSPLANE_MASK;
- if (c1 == MBFL_WCSPLANE_JIS0208) {
- s1 = c & MBFL_WCSPLANE_MASK;
- } else if (c == 0xa5) { /* YEN SIGN */
- s1 = 0x216f; /* FULLWIDTH YEN SIGN */
- } else if (c == 0x203e) { /* OVER LINE */
- s1 = 0x2131; /* FULLWIDTH MACRON */
- } else if (c == 0xff3c) { /* FULLWIDTH REVERSE SOLIDUS */
- s1 = 0x2140;
- } else if (c == 0xff5e) { /* FULLWIDTH TILDE */
- s1 = 0x2141;
- } else if (c == 0x2225) { /* PARALLEL TO */
- s1 = 0x2142;
- } else if (c == 0xff0d) { /* FULLWIDTH HYPHEN-MINUS */
- s1 = 0x215d;
- } else if (c == 0xffe0) { /* FULLWIDTH CENT SIGN */
- s1 = 0x2171;
- } else if (c == 0xffe1) { /* FULLWIDTH POUND SIGN */
- s1 = 0x2172;
- } else if (c == 0xffe2) { /* FULLWIDTH NOT SIGN */
- s1 = 0x224c;
- }
- if (c == 0) {
- s1 = 0;
- } else if (s1 <= 0) {
- s1 = -1;
- }
- } else if (s1 >= 0x8080) {
- s1 = -1;
- }
- if (s1 >= 0) {
- if (s1 < 0x100) { /* latin or kana */
- CK((*filter->output_function)(s1, filter->data));
- } else { /* kanji */
- c1 = (s1 >> 8) & 0xff;
- c2 = s1 & 0xff;
- SJIS_ENCODE(c1, c2, s1, s2);
- CK((*filter->output_function)(s1, filter->data));
- CK((*filter->output_function)(s2, filter->data));
- }
- } else {
- if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) {
- CK(mbfl_filt_conv_illegal_output(c, filter));
- }
- }
-
- return c;
-}
-
-
-/*
- * SJIS-win => wchar
- */
-int
-mbfl_filt_conv_sjiswin_wchar(int c, mbfl_convert_filter *filter)
-{
- int c1, s, s1, s2, w;
-
- switch (filter->status) {
- case 0:
- if (c >= 0 && c < 0x80) { /* latin */
- CK((*filter->output_function)(c, filter->data));
- } else if (c > 0xa0 && c < 0xe0) { /* kana */
- CK((*filter->output_function)(0xfec0 + c, filter->data));
- } else if (c > 0x80 && c < 0xfd && c != 0xa0) { /* kanji first char */
- filter->status = 1;
- filter->cache = c;
- } else {
- w = c & MBFL_WCSGROUP_MASK;
- w |= MBFL_WCSGROUP_THROUGH;
- CK((*filter->output_function)(w, filter->data));
- }
- break;
-
- case 1: /* kanji second char */
- filter->status = 0;
- c1 = filter->cache;
- if (c > 0x39 && c < 0xfd && c != 0x7f) {
- w = 0;
- SJIS_DECODE(c1, c, s1, s2);
- s = (s1 - 0x21)*94 + s2 - 0x21;
- if (s <= 137) {
- if (s == 31) {
- w = 0xff3c; /* FULLWIDTH REVERSE SOLIDUS */
- } else if (s == 32) {
- w = 0xff5e; /* FULLWIDTH TILDE */
- } else if (s == 33) {
- w = 0x2225; /* PARALLEL TO */
- } else if (s == 60) {
- w = 0xff0d; /* FULLWIDTH HYPHEN-MINUS */
- } else if (s == 80) {
- w = 0xffe0; /* FULLWIDTH CENT SIGN */
- } else if (s == 81) {
- w = 0xffe1; /* FULLWIDTH POUND SIGN */
- } else if (s == 137) {
- w = 0xffe2; /* FULLWIDTH NOT SIGN */
- }
- }
- if (w == 0) {
- if (s >= cp932ext1_ucs_table_min && s < cp932ext1_ucs_table_max) { /* vendor ext1 (13ku) */
- w = cp932ext1_ucs_table[s - cp932ext1_ucs_table_min];
- } else if (s >= 0 && s < jisx0208_ucs_table_size) { /* X 0208 */
- w = jisx0208_ucs_table[s];
- } else if (s >= cp932ext2_ucs_table_min && s < cp932ext2_ucs_table_max) { /* vendor ext2 (89ku - 92ku) */
- w = cp932ext2_ucs_table[s - cp932ext2_ucs_table_min];
- } else if (s >= cp932ext3_ucs_table_min && s < cp932ext3_ucs_table_max) { /* vendor ext3 (115ku - 119ku) */
- w = cp932ext3_ucs_table[s - cp932ext3_ucs_table_min];
- } else if (s >= (94*94) && s < (114*94)) { /* user (95ku - 114ku) */
- w = s - (94*94) + 0xe000;
- }
- }
- if (w <= 0) {
- w = (s1 << 8) | s2;
- w &= MBFL_WCSPLANE_MASK;
- w |= MBFL_WCSPLANE_WINCP932;
- }
- CK((*filter->output_function)(w, filter->data));
- } else if ((c >= 0 && c < 0x21) || c == 0x7f) { /* CTLs */
- CK((*filter->output_function)(c, filter->data));
- } else {
- w = (c1 << 8) | c;
- w &= MBFL_WCSGROUP_MASK;
- w |= MBFL_WCSGROUP_THROUGH;
- CK((*filter->output_function)(w, filter->data));
- }
- break;
-
- default:
- filter->status = 0;
- break;
- }
-
- return c;
-}
-
-/*
- * wchar => SJIS-win
- */
-int
-mbfl_filt_conv_wchar_sjiswin(int c, mbfl_convert_filter *filter)
-{
- int c1, c2, s1, s2;
-
- s1 = 0;
- s2 = 0;
- if (c >= ucs_a1_jis_table_min && c < ucs_a1_jis_table_max) {
- s1 = ucs_a1_jis_table[c - ucs_a1_jis_table_min];
- } else if (c >= ucs_a2_jis_table_min && c < ucs_a2_jis_table_max) {
- s1 = ucs_a2_jis_table[c - ucs_a2_jis_table_min];
- } else if (c >= ucs_i_jis_table_min && c < ucs_i_jis_table_max) {
- s1 = ucs_i_jis_table[c - ucs_i_jis_table_min];
- } else if (c >= ucs_r_jis_table_min && c < ucs_r_jis_table_max) {
- s1 = ucs_r_jis_table[c - ucs_r_jis_table_min];
- } else if (c >= 0xe000 && c < (0xe000 + 20*94)) { /* user (95ku - 114ku) */
- s1 = c - 0xe000;
- c1 = s1/94 + 0x7f;
- c2 = s1%94 + 0x21;
- s1 = (c1 << 8) | c2;
- s2 = 1;
- }
- if (s1 <= 0) {
- c1 = c & ~MBFL_WCSPLANE_MASK;
- if (c1 == MBFL_WCSPLANE_WINCP932) {
- s1 = c & MBFL_WCSPLANE_MASK;
- s2 = 1;
- } else if (c1 == MBFL_WCSPLANE_JIS0208) {
- s1 = c & MBFL_WCSPLANE_MASK;
- } else if (c1 == MBFL_WCSPLANE_JIS0212) {
- s1 = c & MBFL_WCSPLANE_MASK;
- s1 |= 0x8080;
- } else if (c == 0xa5) { /* YEN SIGN */
- s1 = 0x216f; /* FULLWIDTH YEN SIGN */
- } else if (c == 0x203e) { /* OVER LINE */
- s1 = 0x2131; /* FULLWIDTH MACRON */
- } else if (c == 0xff3c) { /* FULLWIDTH REVERSE SOLIDUS */
- s1 = 0x2140;
- } else if (c == 0xff5e) { /* FULLWIDTH TILDE */
- s1 = 0x2141;
- } else if (c == 0x2225) { /* PARALLEL TO */
- s1 = 0x2142;
- } else if (c == 0xff0d) { /* FULLWIDTH HYPHEN-MINUS */
- s1 = 0x215d;
- } else if (c == 0xffe0) { /* FULLWIDTH CENT SIGN */
- s1 = 0x2171;
- } else if (c == 0xffe1) { /* FULLWIDTH POUND SIGN */
- s1 = 0x2172;
- } else if (c == 0xffe2) { /* FULLWIDTH NOT SIGN */
- s1 = 0x224c;
- }
- }
- if ((s1 <= 0) || (s1 >= 0x8080 && s2 == 0)) { /* not found or X 0212 */
- s1 = -1;
- c1 = 0;
- c2 = cp932ext1_ucs_table_max - cp932ext1_ucs_table_min;
- while (c1 < c2) { /* CP932 vendor ext1 (13ku) */
- if (c == cp932ext1_ucs_table[c1]) {
- s1 = ((c1/94 + 0x2d) << 8) + (c1%94 + 0x21);
- break;
- }
- c1++;
- }
- if (s1 <= 0) {
- c1 = 0;
- c2 = cp932ext3_ucs_table_max - cp932ext3_ucs_table_min;
- while (c1 < c2) { /* CP932 vendor ext3 (115ku - 119ku) */
- if (c == cp932ext3_ucs_table[c1]) {
- s1 = ((c1/94 + 0x93) << 8) + (c1%94 + 0x21);
- break;
- }
- c1++;
- }
- }
- if (c == 0) {
- s1 = 0;
- } else if (s1 <= 0) {
- s1 = -1;
- }
- }
- if (s1 >= 0) {
- if (s1 < 0x100) { /* latin or kana */
- CK((*filter->output_function)(s1, filter->data));
- } else { /* kanji */
- c1 = (s1 >> 8) & 0xff;
- c2 = s1 & 0xff;
- SJIS_ENCODE(c1, c2, s1, s2);
- CK((*filter->output_function)(s1, filter->data));
- CK((*filter->output_function)(s2, filter->data));
- }
- } else {
- if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) {
- CK(mbfl_filt_conv_illegal_output(c, filter));
- }
- }
-
- return c;
-}
-
-
-/*
- * JIS => wchar
- */
-int
-mbfl_filt_conv_jis_wchar(int c, mbfl_convert_filter *filter)
-{
- int c1, s, w;
-
-retry:
- switch (filter->status & 0xf) {
-/* case 0x00: ASCII */
-/* case 0x10: X 0201 latin */
-/* case 0x20: X 0201 kana */
-/* case 0x80: X 0208 */
-/* case 0x90: X 0212 */
- case 0:
- if (c == 0x1b) {
- filter->status += 2;
- } else if (c == 0x0e) { /* "kana in" */
- filter->status = 0x20;
- } else if (c == 0x0f) { /* "kana out" */
- filter->status = 0;
- } else if (filter->status == 0x10 && c == 0x5c) { /* YEN SIGN */
- CK((*filter->output_function)(0xa5, filter->data));
- } else if (filter->status == 0x10 && c == 0x7e) { /* OVER LINE */
- CK((*filter->output_function)(0x203e, filter->data));
- } else if (filter->status == 0x20 && c > 0x20 && c < 0x60) { /* kana */
- CK((*filter->output_function)(0xff40 + c, filter->data));
- } else if ((filter->status == 0x80 || filter->status == 0x90) && c > 0x20 && c < 0x7f) { /* kanji first char */
- filter->cache = c;
- filter->status += 1;
- } else if (c >= 0 && c < 0x80) { /* latin, CTLs */
- CK((*filter->output_function)(c, filter->data));
- } else if (c > 0xa0 && c < 0xe0) { /* GR kana */
- CK((*filter->output_function)(0xfec0 + c, filter->data));
- } else {
- w = c & MBFL_WCSGROUP_MASK;
- w |= MBFL_WCSGROUP_THROUGH;
- CK((*filter->output_function)(w, filter->data));
- }
- break;
-
-/* case 0x81: X 0208 second char */
-/* case 0x91: X 0212 second char */
- case 1:
- filter->status &= ~0xf;
- c1 = filter->cache;
- if (c > 0x20 && c < 0x7f) {
- s = (c1 - 0x21)*94 + c - 0x21;
- if (filter->status == 0x80) {
- if (s >= 0 && s < jisx0208_ucs_table_size) {
- w = jisx0208_ucs_table[s];
- } else {
- w = 0;
- }
- if (w <= 0) {
- w = (c1 << 8) | c;
- w &= MBFL_WCSPLANE_MASK;
- w |= MBFL_WCSPLANE_JIS0208;
- }
- } else {
- if (s >= 0 && s < jisx0212_ucs_table_size) {
- w = jisx0212_ucs_table[s];
- } else {
- w = 0;
- }
- if (w <= 0) {
- w = (c1 << 8) | c;
- w &= MBFL_WCSPLANE_MASK;
- w |= MBFL_WCSPLANE_JIS0212;
- }
- }
- CK((*filter->output_function)(w, filter->data));
- } else if (c == 0x1b) {
- filter->status += 2;
- } else if ((c >= 0 && c < 0x21) || c == 0x7f) { /* CTLs */
- CK((*filter->output_function)(c, filter->data));
- } else {
- w = (c1 << 8) | c;
- w &= MBFL_WCSGROUP_MASK;
- w |= MBFL_WCSGROUP_THROUGH;
- CK((*filter->output_function)(w, filter->data));
- }
- break;
-
- /* ESC */
-/* case 0x02: */
-/* case 0x12: */
-/* case 0x22: */
-/* case 0x82: */
-/* case 0x92: */
- case 2:
- if (c == 0x24) { /* '$' */
- filter->status++;
- } else if (c == 0x28) { /* '(' */
- filter->status += 3;
- } else {
- filter->status &= ~0xf;
- CK((*filter->output_function)(0x1b, filter->data));
- goto retry;
- }
- break;
-
- /* ESC $ */
-/* case 0x03: */
-/* case 0x13: */
-/* case 0x23: */
-/* case 0x83: */
-/* case 0x93: */
- case 3:
- if (c == 0x40 || c == 0x42) { /* '@' or 'B' */
- filter->status = 0x80;
- } else if (c == 0x28) { /* '(' */
- filter->status++;
- } else {
- filter->status &= ~0xf;
- CK((*filter->output_function)(0x1b, filter->data));
- CK((*filter->output_function)(0x24, filter->data));
- goto retry;
- }
- break;
-
- /* ESC $ ( */
-/* case 0x04: */
-/* case 0x14: */
-/* case 0x24: */
-/* case 0x84: */
-/* case 0x94: */
- case 4:
- if (c == 0x40 || c == 0x42) { /* '@' or 'B' */
- filter->status = 0x80;
- } else if (c == 0x44) { /* 'D' */
- filter->status = 0x90;
- } else {
- filter->status &= ~0xf;
- CK((*filter->output_function)(0x1b, filter->data));
- CK((*filter->output_function)(0x24, filter->data));
- CK((*filter->output_function)(0x28, filter->data));
- goto retry;
- }
- break;
-
- /* ESC ( */
-/* case 0x05: */
-/* case 0x15: */
-/* case 0x25: */
-/* case 0x85: */
-/* case 0x95: */
- case 5:
- if (c == 0x42 || c == 0x48) { /* 'B' or 'H' */
- filter->status = 0;
- } else if (c == 0x4a) { /* 'J' */
- filter->status = 0x10;
- } else if (c == 0x49) { /* 'I' */
- filter->status = 0x20;
- } else {
- filter->status &= ~0xf;
- CK((*filter->output_function)(0x1b, filter->data));
- CK((*filter->output_function)(0x28, filter->data));
- goto retry;
- }
- break;
-
- default:
- filter->status = 0;
- break;
- }
-
- return c;
-}
-
-/*
- * wchar => JIS
- */
-int
-mbfl_filt_conv_wchar_jis(int c, mbfl_convert_filter *filter)
-{
- int c1, s;
-
- s = 0;
- if (c >= ucs_a1_jis_table_min && c < ucs_a1_jis_table_max) {
- s = ucs_a1_jis_table[c - ucs_a1_jis_table_min];
- } else if (c >= ucs_a2_jis_table_min && c < ucs_a2_jis_table_max) {
- s = ucs_a2_jis_table[c - ucs_a2_jis_table_min];
- } else if (c >= ucs_i_jis_table_min && c < ucs_i_jis_table_max) {
- s = ucs_i_jis_table[c - ucs_i_jis_table_min];
- } else if (c >= ucs_r_jis_table_min && c < ucs_r_jis_table_max) {
- s = ucs_r_jis_table[c - ucs_r_jis_table_min];
- }
- if (s <= 0) {
- c1 = c & ~MBFL_WCSPLANE_MASK;
- if (c1 == MBFL_WCSPLANE_JIS0208) {
- s = c & MBFL_WCSPLANE_MASK;
- } else if (c1 == MBFL_WCSPLANE_JIS0212) {
- s = c & MBFL_WCSPLANE_MASK;
- s |= 0x8080;
- } else if (c == 0xa5) { /* YEN SIGN */
- s = 0x1005c;
- } else if (c == 0x203e) { /* OVER LINE */
- s = 0x1007e;
- } else if (c == 0xff3c) { /* FULLWIDTH REVERSE SOLIDUS */
- s = 0x2140;
- } else if (c == 0xff5e) { /* FULLWIDTH TILDE */
- s = 0x2141;
- } else if (c == 0x2225) { /* PARALLEL TO */
- s = 0x2142;
- } else if (c == 0xff0d) { /* FULLWIDTH HYPHEN-MINUS */
- s = 0x215d;
- } else if (c == 0xffe0) { /* FULLWIDTH CENT SIGN */
- s = 0x2171;
- } else if (c == 0xffe1) { /* FULLWIDTH POUND SIGN */
- s = 0x2172;
- } else if (c == 0xffe2) { /* FULLWIDTH NOT SIGN */
- s = 0x224c;
- }
- if (c == 0) {
- s = 0;
- } else if (s <= 0) {
- s = -1;
- }
- }
- if (s >= 0) {
- if (s < 0x80) { /* ASCII */
- if ((filter->status & 0xff00) != 0) {
- CK((*filter->output_function)(0x1b, filter->data)); /* ESC */
- CK((*filter->output_function)(0x28, filter->data)); /* '(' */
- CK((*filter->output_function)(0x42, filter->data)); /* 'B' */
- }
- filter->status = 0;
- CK((*filter->output_function)(s, filter->data));
- } else if (s < 0x100) { /* kana */
- if ((filter->status & 0xff00) != 0x100) {
- CK((*filter->output_function)(0x1b, filter->data)); /* ESC */
- CK((*filter->output_function)(0x28, filter->data)); /* '(' */
- CK((*filter->output_function)(0x49, filter->data)); /* 'I' */
- }
- filter->status = 0x100;
- CK((*filter->output_function)(s & 0x7f, filter->data));
- } else if (s < 0x8080) { /* X 0208 */
- if ((filter->status & 0xff00) != 0x200) {
- CK((*filter->output_function)(0x1b, filter->data)); /* ESC */
- CK((*filter->output_function)(0x24, filter->data)); /* '$' */
- CK((*filter->output_function)(0x42, filter->data)); /* 'B' */
- }
- filter->status = 0x200;
- CK((*filter->output_function)((s >> 8) & 0x7f, filter->data));
- CK((*filter->output_function)(s & 0x7f, filter->data));
- } else if (s < 0x10000) { /* X 0212 */
- if ((filter->status & 0xff00) != 0x300) {
- CK((*filter->output_function)(0x1b, filter->data)); /* ESC */
- CK((*filter->output_function)(0x24, filter->data)); /* '$' */
- CK((*filter->output_function)(0x28, filter->data)); /* '(' */
- CK((*filter->output_function)(0x44, filter->data)); /* 'D' */
- }
- filter->status = 0x300;
- CK((*filter->output_function)((s >> 8) & 0x7f, filter->data));
- CK((*filter->output_function)(s & 0x7f, filter->data));
- } else { /* X 0201 latin */
- if ((filter->status & 0xff00) != 0x400) {
- CK((*filter->output_function)(0x1b, filter->data)); /* ESC */
- CK((*filter->output_function)(0x28, filter->data)); /* '(' */
- CK((*filter->output_function)(0x4a, filter->data)); /* 'J' */
- }
- filter->status = 0x400;
- CK((*filter->output_function)(s & 0x7f, filter->data));
- }
- } else {
- if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) {
- CK(mbfl_filt_conv_illegal_output(c, filter));
- }
- }
-
- return c;
-}
-
-
-/*
- * wchar => ISO-2022-JP
- */
-int
-mbfl_filt_conv_wchar_2022jp(int c, mbfl_convert_filter *filter)
-{
- int s;
-
- s = 0;
- if (c >= ucs_a1_jis_table_min && c < ucs_a1_jis_table_max) {
- s = ucs_a1_jis_table[c - ucs_a1_jis_table_min];
- } else if (c >= ucs_a2_jis_table_min && c < ucs_a2_jis_table_max) {
- s = ucs_a2_jis_table[c - ucs_a2_jis_table_min];
- } else if (c >= ucs_i_jis_table_min && c < ucs_i_jis_table_max) {
- s = ucs_i_jis_table[c - ucs_i_jis_table_min];
- } else if (c >= ucs_r_jis_table_min && c < ucs_r_jis_table_max) {
- s = ucs_r_jis_table[c - ucs_r_jis_table_min];
- }
- if (s <= 0) {
- if (c == 0xa5) { /* YEN SIGN */
- s = 0x1005c;
- } else if (c == 0x203e) { /* OVER LINE */
- s = 0x1007e;
- } else if (c == 0xff3c) { /* FULLWIDTH REVERSE SOLIDUS */
- s = 0x2140;
- } else if (c == 0xff5e) { /* FULLWIDTH TILDE */
- s = 0x2141;
- } else if (c == 0x2225) { /* PARALLEL TO */
- s = 0x2142;
- } else if (c == 0xff0d) { /* FULLWIDTH HYPHEN-MINUS */
- s = 0x215d;
- } else if (c == 0xffe0) { /* FULLWIDTH CENT SIGN */
- s = 0x2171;
- } else if (c == 0xffe1) { /* FULLWIDTH POUND SIGN */
- s = 0x2172;
- } else if (c == 0xffe2) { /* FULLWIDTH NOT SIGN */
- s = 0x224c;
- }
- if (c == 0) {
- s = 0;
- } else if (s <= 0) {
- s = -1;
- }
- } else if ((s >= 0x80 && s < 0x2121) || (s > 0x8080)) {
- s = -1;
- }
- if (s >= 0) {
- if (s < 0x80) { /* ASCII */
- if ((filter->status & 0xff00) != 0) {
- CK((*filter->output_function)(0x1b, filter->data)); /* ESC */
- CK((*filter->output_function)(0x28, filter->data)); /* '(' */
- CK((*filter->output_function)(0x42, filter->data)); /* 'B' */
- }
- filter->status = 0;
- CK((*filter->output_function)(s, filter->data));
- } else if (s < 0x10000) { /* X 0208 */
- if ((filter->status & 0xff00) != 0x200) {
- CK((*filter->output_function)(0x1b, filter->data)); /* ESC */
- CK((*filter->output_function)(0x24, filter->data)); /* '$' */
- CK((*filter->output_function)(0x42, filter->data)); /* 'B' */
- }
- filter->status = 0x200;
- CK((*filter->output_function)((s >> 8) & 0x7f, filter->data));
- CK((*filter->output_function)(s & 0x7f, filter->data));
- } else { /* X 0201 latin */
- if ((filter->status & 0xff00) != 0x400) {
- CK((*filter->output_function)(0x1b, filter->data)); /* ESC */
- CK((*filter->output_function)(0x28, filter->data)); /* '(' */
- CK((*filter->output_function)(0x4a, filter->data)); /* 'J' */
- }
- filter->status = 0x400;
- CK((*filter->output_function)(s & 0x7f, filter->data));
- }
- } else {
- if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) {
- CK(mbfl_filt_conv_illegal_output(c, filter));
- }
- }
-
- return c;
-}
-
-int
-mbfl_filt_conv_any_jis_flush(mbfl_convert_filter *filter)
-{
- /* back to latin */
- if ((filter->status & 0xff00) != 0) {
- CK((*filter->output_function)(0x1b, filter->data)); /* ESC */
- CK((*filter->output_function)(0x28, filter->data)); /* '(' */
- CK((*filter->output_function)(0x42, filter->data)); /* 'B' */
- }
- filter->status &= 0xff;
- return 0;
-}
-
-
-
-/*
- * cp932 table
- */
-static const unsigned short cp932ext3_eucjp_table[] = {
- /* ku 115 */
- 0xF3F3,0xF3F4,0xF3F5,0xF3F6,0xF3F7,0xF3F8,0xF3F9,0xF3FA,
- 0xF3FB,0xF3FC,0xF3FD,0xF3FE,0xF4A1,0xF4A2,0xF4A3,0xF4A4,
- 0xF4A5,0xF4A6,0xF4A7,0xF4A8,0x224C,0xA2C3,0xF4A9,0xF4AA,
- 0xF4AB,0xF4AC,0xF4AD,0x2268,0xD4E3,0xDCDF,0xE4E9,0xE3F8,
- 0xD9A1,0xB1BB,0xF4AE,0xC2AD,0xC3FC,0xE4D0,0xC2BF,0xBCF4,
- 0xB0A9,0xB0C8,0xF4AF,0xB0D2,0xB0D4,0xB0E3,0xB0EE,0xB1A7,
- 0xB1A3,0xB1AC,0xB1A9,0xB1BE,0xB1DF,0xB1D8,0xB1C8,0xB1D7,
- 0xB1E3,0xB1F4,0xB1E1,0xB2A3,0xF4B0,0xB2BB,0xB2E6,0xB2ED,
- 0xB2F5,0xB2FC,0xF4B1,0xB3B5,0xB3D8,0xB3DB,0xB3E5,0xB3EE,
- 0xB3FB,0xF4B2,0xF4B3,0xB4C0,0xB4C7,0xB4D0,0xB4DE,0xF4B4,
- 0xB5AA,0xF4B5,0xB5AF,0xB5C4,0xB5E8,0xF4B6,0xB7C2,0xB7E4,
- 0xB7E8,0xB7E7,0xF4B7,0xF4B8,0xF4B9,0xB8CE,
-
- /* ku 116 */
- 0xB8E1,0xB8F5,0xB8F7,0xB8F8,0xB8FC,0xB9AF,0xB9B7,0xBABE,
- 0xBADB,0xCDAA,0xBAE1,0xF4BA,0xBAEB,0xBBB3,0xBBB8,0xF4BB,
- 0xBBCA,0xF4BC,0xF4BD,0xBBD0,0xBBDE,0xBBF4,0xBBF5,0xBBF9,
- 0xBCE4,0xBCED,0xBCFE,0xF4BE,0xBDC2,0xBDE7,0xF4BF,0xBDF0,
- 0xBEB0,0xBEAC,0xF4C0,0xBEB3,0xBEBD,0xBECD,0xBEC9,0xBEE4,
- 0xBFA8,0xBFC9,0xC0C4,0xC0E4,0xC0F4,0xC1A6,0xF4C1,0xC1F5,
- 0xC1FC,0xF4C2,0xC1F8,0xC2AB,0xC2A1,0xC2A5,0xF4C3,0xC2B8,
- 0xC2BA,0xF4C4,0xC2C4,0xC2D2,0xC2D7,0xC2DB,0xC2DE,0xC2ED,
- 0xC2F0,0xF4C5,0xC3A1,0xC3B5,0xC3C9,0xC3B9,0xF4C6,0xC3D8,
- 0xC3FE,0xF4C7,0xC4CC,0xF4C8,0xC4D9,0xC4EA,0xC4FD,0xF4C9,
- 0xC5A7,0xC5B5,0xC5B6,0xF4CA,0xC5D5,0xC6B8,0xC6D7,0xC6E0,
- 0xC6EA,0xC6E3,0xC7A1,0xC7AB,0xC7C7,0xC7C3,
-
- /* ku 117 */
- 0xC7CB,0xC7CF,0xC7D9,0xF4CB,0xF4CC,0xC7E6,0xC7EE,0xC7FC,
- 0xC7EB,0xC7F0,0xC8B1,0xC8E5,0xC8F8,0xC9A6,0xC9AB,0xC9AD,
- 0xF4CD,0xC9CA,0xC9D3,0xC9E9,0xC9E3,0xC9FC,0xC9F4,0xC9F5,
- 0xF4CE,0xCAB3,0xCABD,0xCAEF,0xCAF1,0xCBAE,0xF4CF,0xCBCA,
- 0xCBE6,0xCBEA,0xCBF0,0xCBF4,0xCBEE,0xCCA5,0xCBF9,0xCCAB,
- 0xCCAE,0xCCAD,0xCCB2,0xCCC2,0xCCD0,0xCCD9,0xF4D0,0xCDBB,
- 0xF4D1,0xCEBB,0xF4D2,0xCEBA,0xCEC3,0xF4D3,0xCEF2,0xB3DD,
- 0xCFD5,0xCFE2,0xCFE9,0xCFED,0xF4D4,0xF4D5,0xF4D6,0xF4D7,
- 0xD0E5,0xF4D8,0xD0E9,0xD1E8,0xF4D9,0xF4DA,0xD1EC,0xD2BB,
- 0xF4DB,0xD3E1,0xD3E8,0xD4A7,0xF4DC,0xF4DD,0xD4D4,0xD4F2,
- 0xD5AE,0xF4DE,0xD7DE,0xF4DF,0xD8A2,0xD8B7,0xD8C1,0xD8D1,
- 0xD8F4,0xD9C6,0xD9C8,0xD9D1,0xF4E0,0xF4E1,
-
- /* ku 118 */
- 0xF4E2,0xF4E3,0xF4E4,0xDCD3,0xDDC8,0xDDD4,0xDDEA,0xDDFA,
- 0xDEA4,0xDEB0,0xF4E5,0xDEB5,0xDECB,0xF4E6,0xDFB9,0xF4E7,
- 0xDFC3,0xF4E8,0xF4E9,0xE0D9,0xF4EA,0xF4EB,0xE1E2,0xF4EC,
- 0xF4ED,0xF4EE,0xE2C7,0xE3A8,0xE3A6,0xE3A9,0xE3AF,0xE3B0,
- 0xE3AA,0xE3AB,0xE3BC,0xE3C1,0xE3BF,0xE3D5,0xE3D8,0xE3D6,
- 0xE3DF,0xE3E3,0xE3E1,0xE3D4,0xE3E9,0xE4A6,0xE3F1,0xE3F2,
- 0xE4CB,0xE4C1,0xE4C3,0xE4BE,0xF4EF,0xE4C0,0xE4C7,0xE4BF,
- 0xE4E0,0xE4DE,0xE4D1,0xF4F0,0xE4DC,0xE4D2,0xE4DB,0xE4D4,
- 0xE4FA,0xE4EF,0xE5B3,0xE5BF,0xE5C9,0xE5D0,0xE5E2,0xE5EA,
- 0xE5EB,0xF4F1,0xF4F2,0xF4F3,0xE6E8,0xE6EF,0xE7AC,0xF4F4,
- 0xE7AE,0xF4F5,0xE7B1,0xF4F6,0xE7B2,0xE8B1,0xE8B6,0xF4F7,
- 0xF4F8,0xE8DD,0xF4F9,0xF4FA,0xE9D1,0xF4FB,
-
- /* ku 119 */
- 0xE9ED,0xEACD,0xF4FC,0xEADB,0xEAE6,0xEAEA,0xEBA5,0xEBFB,
- 0xEBFA,0xF4FD,0xECD6,0xF4FE
-};
-
-static const int cp932ext3_eucjp_table_size = (sizeof (cp932ext3_eucjp_table) / sizeof (unsigned short));
-
-
-
-/*
- * Unicode table
- */
-static const unsigned short jisx0208_ucs_table[] = {
- /* ku 1 */
- 0x3000,0x3001,0x3002,0xFF0C,0xFF0E,0x30FB,0xFF1A,0xFF1B,
- 0xFF1F,0xFF01,0x309B,0x309C,0x00B4,0xFF40,0x00A8,0xFF3E,
- 0xFFE3,0xFF3F,0x30FD,0x30FE,0x309D,0x309E,0x3003,0x4EDD,
- 0x3005,0x3006,0x3007,0x30FC,0x2015,0x2010,0xFF0F,0xFF3C,
- 0x301C,0x2016,0xFF5C,0x2026,0x2025,0x2018,0x2019,0x201C,
- 0x201D,0xFF08,0xFF09,0x3014,0x3015,0xFF3B,0xFF3D,0xFF5B,
- 0xFF5D,0x3008,0x3009,0x300A,0x300B,0x300C,0x300D,0x300E,
- 0x300F,0x3010,0x3011,0xFF0B,0x2212,0x00B1,0x00D7,0x00F7,
- 0xFF1D,0x2260,0xFF1C,0xFF1E,0x2266,0x2267,0x221E,0x2234,
- 0x2642,0x2640,0x00B0,0x2032,0x2033,0x2103,0xFFE5,0xFF04,
- 0x00A2,0x00A3,0xFF05,0xFF03,0xFF06,0xFF0A,0xFF20,0x00A7,
- 0x2606,0x2605,0x25CB,0x25CF,0x25CE,0x25C7,
-
- /* ku 2 */
- 0x25C6,0x25A1,0x25A0,0x25B3,0x25B2,0x25BD,0x25BC,0x203B,
- 0x3012,0x2192,0x2190,0x2191,0x2193,0x3013,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x2208,0x220B,0x2286,0x2287,0x2282,0x2283,0x222A,
- 0x2229,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x2227,0x2228,0x00AC,0x21D2,0x21D4,0x2200,0x2203,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x2220,0x22A5,0x2312,0x2202,0x2207,
- 0x2261,0x2252,0x226A,0x226B,0x221A,0x223D,0x221D,0x2235,
- 0x222B,0x222C,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x212B,0x2030,0x266F,0x266D,0x266A,0x2020,0x2021,
- 0x00B6,0x0000,0x0000,0x0000,0x0000,0x25EF,
-
- /* ku 3 */
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xFF10,
- 0xFF11,0xFF12,0xFF13,0xFF14,0xFF15,0xFF16,0xFF17,0xFF18,
- 0xFF19,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0xFF21,0xFF22,0xFF23,0xFF24,0xFF25,0xFF26,0xFF27,0xFF28,
- 0xFF29,0xFF2A,0xFF2B,0xFF2C,0xFF2D,0xFF2E,0xFF2F,0xFF30,
- 0xFF31,0xFF32,0xFF33,0xFF34,0xFF35,0xFF36,0xFF37,0xFF38,
- 0xFF39,0xFF3A,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0xFF41,0xFF42,0xFF43,0xFF44,0xFF45,0xFF46,0xFF47,0xFF48,
- 0xFF49,0xFF4A,0xFF4B,0xFF4C,0xFF4D,0xFF4E,0xFF4F,0xFF50,
- 0xFF51,0xFF52,0xFF53,0xFF54,0xFF55,0xFF56,0xFF57,0xFF58,
- 0xFF59,0xFF5A,0x0000,0x0000,0x0000,0x0000,
-
- /* ku 4 */
- 0x3041,0x3042,0x3043,0x3044,0x3045,0x3046,0x3047,0x3048,
- 0x3049,0x304A,0x304B,0x304C,0x304D,0x304E,0x304F,0x3050,
- 0x3051,0x3052,0x3053,0x3054,0x3055,0x3056,0x3057,0x3058,
- 0x3059,0x305A,0x305B,0x305C,0x305D,0x305E,0x305F,0x3060,
- 0x3061,0x3062,0x3063,0x3064,0x3065,0x3066,0x3067,0x3068,
- 0x3069,0x306A,0x306B,0x306C,0x306D,0x306E,0x306F,0x3070,
- 0x3071,0x3072,0x3073,0x3074,0x3075,0x3076,0x3077,0x3078,
- 0x3079,0x307A,0x307B,0x307C,0x307D,0x307E,0x307F,0x3080,
- 0x3081,0x3082,0x3083,0x3084,0x3085,0x3086,0x3087,0x3088,
- 0x3089,0x308A,0x308B,0x308C,0x308D,0x308E,0x308F,0x3090,
- 0x3091,0x3092,0x3093,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-
- /* ku 5 */
- 0x30A1,0x30A2,0x30A3,0x30A4,0x30A5,0x30A6,0x30A7,0x30A8,
- 0x30A9,0x30AA,0x30AB,0x30AC,0x30AD,0x30AE,0x30AF,0x30B0,
- 0x30B1,0x30B2,0x30B3,0x30B4,0x30B5,0x30B6,0x30B7,0x30B8,
- 0x30B9,0x30BA,0x30BB,0x30BC,0x30BD,0x30BE,0x30BF,0x30C0,
- 0x30C1,0x30C2,0x30C3,0x30C4,0x30C5,0x30C6,0x30C7,0x30C8,
- 0x30C9,0x30CA,0x30CB,0x30CC,0x30CD,0x30CE,0x30CF,0x30D0,
- 0x30D1,0x30D2,0x30D3,0x30D4,0x30D5,0x30D6,0x30D7,0x30D8,
- 0x30D9,0x30DA,0x30DB,0x30DC,0x30DD,0x30DE,0x30DF,0x30E0,
- 0x30E1,0x30E2,0x30E3,0x30E4,0x30E5,0x30E6,0x30E7,0x30E8,
- 0x30E9,0x30EA,0x30EB,0x30EC,0x30ED,0x30EE,0x30EF,0x30F0,
- 0x30F1,0x30F2,0x30F3,0x30F4,0x30F5,0x30F6,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-
- /* ku 6 */
- 0x0391,0x0392,0x0393,0x0394,0x0395,0x0396,0x0397,0x0398,
- 0x0399,0x039A,0x039B,0x039C,0x039D,0x039E,0x039F,0x03A0,
- 0x03A1,0x03A3,0x03A4,0x03A5,0x03A6,0x03A7,0x03A8,0x03A9,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x03B1,0x03B2,0x03B3,0x03B4,0x03B5,0x03B6,0x03B7,0x03B8,
- 0x03B9,0x03BA,0x03BB,0x03BC,0x03BD,0x03BE,0x03BF,0x03C0,
- 0x03C1,0x03C3,0x03C4,0x03C5,0x03C6,0x03C7,0x03C8,0x03C9,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-
- /* ku 7 */
- 0x0410,0x0411,0x0412,0x0413,0x0414,0x0415,0x0401,0x0416,
- 0x0417,0x0418,0x0419,0x041A,0x041B,0x041C,0x041D,0x041E,
- 0x041F,0x0420,0x0421,0x0422,0x0423,0x0424,0x0425,0x0426,
- 0x0427,0x0428,0x0429,0x042A,0x042B,0x042C,0x042D,0x042E,
- 0x042F,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0430,0x0431,0x0432,0x0433,0x0434,0x0435,0x0451,0x0436,
- 0x0437,0x0438,0x0439,0x043A,0x043B,0x043C,0x043D,0x043E,
- 0x043F,0x0440,0x0441,0x0442,0x0443,0x0444,0x0445,0x0446,
- 0x0447,0x0448,0x0449,0x044A,0x044B,0x044C,0x044D,0x044E,
- 0x044F,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-
- /* ku 8 */
- 0x2500,0x2502,0x250C,0x2510,0x2518,0x2514,0x251C,0x252C,
- 0x2524,0x2534,0x253C,0x2501,0x2503,0x250F,0x2513,0x251B,
- 0x2517,0x2523,0x2533,0x252B,0x253B,0x254B,0x2520,0x252F,
- 0x2528,0x2537,0x253F,0x251D,0x2530,0x2525,0x2538,0x2542,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-
- /* ku 9 */
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-
- /* ku 10 */
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-
- /* ku 11 */
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-
- /* ku 12 */
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-
- /* ku 13 */
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-
- /* ku 14 */
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-
- /* ku 15 */
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-
- /* ku 16 */
- 0x4E9C,0x5516,0x5A03,0x963F,0x54C0,0x611B,0x6328,0x59F6,
- 0x9022,0x8475,0x831C,0x7A50,0x60AA,0x63E1,0x6E25,0x65ED,
- 0x8466,0x82A6,0x9BF5,0x6893,0x5727,0x65A1,0x6271,0x5B9B,
- 0x59D0,0x867B,0x98F4,0x7D62,0x7DBE,0x9B8E,0x6216,0x7C9F,
- 0x88B7,0x5B89,0x5EB5,0x6309,0x6697,0x6848,0x95C7,0x978D,
- 0x674F,0x4EE5,0x4F0A,0x4F4D,0x4F9D,0x5049,0x56F2,0x5937,
- 0x59D4,0x5A01,0x5C09,0x60DF,0x610F,0x6170,0x6613,0x6905,
- 0x70BA,0x754F,0x7570,0x79FB,0x7DAD,0x7DEF,0x80C3,0x840E,
- 0x8863,0x8B02,0x9055,0x907A,0x533B,0x4E95,0x4EA5,0x57DF,
- 0x80B2,0x90C1,0x78EF,0x4E00,0x58F1,0x6EA2,0x9038,0x7A32,
- 0x8328,0x828B,0x9C2F,0x5141,0x5370,0x54BD,0x54E1,0x56E0,
- 0x59FB,0x5F15,0x98F2,0x6DEB,0x80E4,0x852D,
-
- /* ku 17 */
- 0x9662,0x9670,0x96A0,0x97FB,0x540B,0x53F3,0x5B87,0x70CF,
- 0x7FBD,0x8FC2,0x96E8,0x536F,0x9D5C,0x7ABA,0x4E11,0x7893,
- 0x81FC,0x6E26,0x5618,0x5504,0x6B1D,0x851A,0x9C3B,0x59E5,
- 0x53A9,0x6D66,0x74DC,0x958F,0x5642,0x4E91,0x904B,0x96F2,
- 0x834F,0x990C,0x53E1,0x55B6,0x5B30,0x5F71,0x6620,0x66F3,
- 0x6804,0x6C38,0x6CF3,0x6D29,0x745B,0x76C8,0x7A4E,0x9834,
- 0x82F1,0x885B,0x8A60,0x92ED,0x6DB2,0x75AB,0x76CA,0x99C5,
- 0x60A6,0x8B01,0x8D8A,0x95B2,0x698E,0x53AD,0x5186,0x5712,
- 0x5830,0x5944,0x5BB4,0x5EF6,0x6028,0x63A9,0x63F4,0x6CBF,
- 0x6F14,0x708E,0x7114,0x7159,0x71D5,0x733F,0x7E01,0x8276,
- 0x82D1,0x8597,0x9060,0x925B,0x9D1B,0x5869,0x65BC,0x6C5A,
- 0x7525,0x51F9,0x592E,0x5965,0x5F80,0x5FDC,
-
- /* ku 18 */
- 0x62BC,0x65FA,0x6A2A,0x6B27,0x6BB4,0x738B,0x7FC1,0x8956,
- 0x9D2C,0x9D0E,0x9EC4,0x5CA1,0x6C96,0x837B,0x5104,0x5C4B,
- 0x61B6,0x81C6,0x6876,0x7261,0x4E59,0x4FFA,0x5378,0x6069,
- 0x6E29,0x7A4F,0x97F3,0x4E0B,0x5316,0x4EEE,0x4F55,0x4F3D,
- 0x4FA1,0x4F73,0x52A0,0x53EF,0x5609,0x590F,0x5AC1,0x5BB6,
- 0x5BE1,0x79D1,0x6687,0x679C,0x67B6,0x6B4C,0x6CB3,0x706B,
- 0x73C2,0x798D,0x79BE,0x7A3C,0x7B87,0x82B1,0x82DB,0x8304,
- 0x8377,0x83EF,0x83D3,0x8766,0x8AB2,0x5629,0x8CA8,0x8FE6,
- 0x904E,0x971E,0x868A,0x4FC4,0x5CE8,0x6211,0x7259,0x753B,
- 0x81E5,0x82BD,0x86FE,0x8CC0,0x96C5,0x9913,0x99D5,0x4ECB,
- 0x4F1A,0x89E3,0x56DE,0x584A,0x58CA,0x5EFB,0x5FEB,0x602A,
- 0x6094,0x6062,0x61D0,0x6212,0x62D0,0x6539,
-
- /* ku 19 */
- 0x9B41,0x6666,0x68B0,0x6D77,0x7070,0x754C,0x7686,0x7D75,
- 0x82A5,0x87F9,0x958B,0x968E,0x8C9D,0x51F1,0x52BE,0x5916,
- 0x54B3,0x5BB3,0x5D16,0x6168,0x6982,0x6DAF,0x788D,0x84CB,
- 0x8857,0x8A72,0x93A7,0x9AB8,0x6D6C,0x99A8,0x86D9,0x57A3,
- 0x67FF,0x86CE,0x920E,0x5283,0x5687,0x5404,0x5ED3,0x62E1,
- 0x64B9,0x683C,0x6838,0x6BBB,0x7372,0x78BA,0x7A6B,0x899A,
- 0x89D2,0x8D6B,0x8F03,0x90ED,0x95A3,0x9694,0x9769,0x5B66,
- 0x5CB3,0x697D,0x984D,0x984E,0x639B,0x7B20,0x6A2B,0x6A7F,
- 0x68B6,0x9C0D,0x6F5F,0x5272,0x559D,0x6070,0x62EC,0x6D3B,
- 0x6E07,0x6ED1,0x845B,0x8910,0x8F44,0x4E14,0x9C39,0x53F6,
- 0x691B,0x6A3A,0x9784,0x682A,0x515C,0x7AC3,0x84B2,0x91DC,
- 0x938C,0x565B,0x9D28,0x6822,0x8305,0x8431,
-
- /* ku 20 */
- 0x7CA5,0x5208,0x82C5,0x74E6,0x4E7E,0x4F83,0x51A0,0x5BD2,
- 0x520A,0x52D8,0x52E7,0x5DFB,0x559A,0x582A,0x59E6,0x5B8C,
- 0x5B98,0x5BDB,0x5E72,0x5E79,0x60A3,0x611F,0x6163,0x61BE,
- 0x63DB,0x6562,0x67D1,0x6853,0x68FA,0x6B3E,0x6B53,0x6C57,
- 0x6F22,0x6F97,0x6F45,0x74B0,0x7518,0x76E3,0x770B,0x7AFF,
- 0x7BA1,0x7C21,0x7DE9,0x7F36,0x7FF0,0x809D,0x8266,0x839E,
- 0x89B3,0x8ACC,0x8CAB,0x9084,0x9451,0x9593,0x9591,0x95A2,
- 0x9665,0x97D3,0x9928,0x8218,0x4E38,0x542B,0x5CB8,0x5DCC,
- 0x73A9,0x764C,0x773C,0x5CA9,0x7FEB,0x8D0B,0x96C1,0x9811,
- 0x9854,0x9858,0x4F01,0x4F0E,0x5371,0x559C,0x5668,0x57FA,
- 0x5947,0x5B09,0x5BC4,0x5C90,0x5E0C,0x5E7E,0x5FCC,0x63EE,
- 0x673A,0x65D7,0x65E2,0x671F,0x68CB,0x68C4,
-
- /* ku 21 */
- 0x6A5F,0x5E30,0x6BC5,0x6C17,0x6C7D,0x757F,0x7948,0x5B63,
- 0x7A00,0x7D00,0x5FBD,0x898F,0x8A18,0x8CB4,0x8D77,0x8ECC,
- 0x8F1D,0x98E2,0x9A0E,0x9B3C,0x4E80,0x507D,0x5100,0x5993,
- 0x5B9C,0x622F,0x6280,0x64EC,0x6B3A,0x72A0,0x7591,0x7947,
- 0x7FA9,0x87FB,0x8ABC,0x8B70,0x63AC,0x83CA,0x97A0,0x5409,
- 0x5403,0x55AB,0x6854,0x6A58,0x8A70,0x7827,0x6775,0x9ECD,
- 0x5374,0x5BA2,0x811A,0x8650,0x9006,0x4E18,0x4E45,0x4EC7,
- 0x4F11,0x53CA,0x5438,0x5BAE,0x5F13,0x6025,0x6551,0x673D,
- 0x6C42,0x6C72,0x6CE3,0x7078,0x7403,0x7A76,0x7AAE,0x7B08,
- 0x7D1A,0x7CFE,0x7D66,0x65E7,0x725B,0x53BB,0x5C45,0x5DE8,
- 0x62D2,0x62E0,0x6319,0x6E20,0x865A,0x8A31,0x8DDD,0x92F8,
- 0x6F01,0x79A6,0x9B5A,0x4EA8,0x4EAB,0x4EAC,
-
- /* ku 22 */
- 0x4F9B,0x4FA0,0x50D1,0x5147,0x7AF6,0x5171,0x51F6,0x5354,
- 0x5321,0x537F,0x53EB,0x55AC,0x5883,0x5CE1,0x5F37,0x5F4A,
- 0x602F,0x6050,0x606D,0x631F,0x6559,0x6A4B,0x6CC1,0x72C2,
- 0x72ED,0x77EF,0x80F8,0x8105,0x8208,0x854E,0x90F7,0x93E1,
- 0x97FF,0x9957,0x9A5A,0x4EF0,0x51DD,0x5C2D,0x6681,0x696D,
- 0x5C40,0x66F2,0x6975,0x7389,0x6850,0x7C81,0x50C5,0x52E4,
- 0x5747,0x5DFE,0x9326,0x65A4,0x6B23,0x6B3D,0x7434,0x7981,
- 0x79BD,0x7B4B,0x7DCA,0x82B9,0x83CC,0x887F,0x895F,0x8B39,
- 0x8FD1,0x91D1,0x541F,0x9280,0x4E5D,0x5036,0x53E5,0x533A,
- 0x72D7,0x7396,0x77E9,0x82E6,0x8EAF,0x99C6,0x99C8,0x99D2,
- 0x5177,0x611A,0x865E,0x55B0,0x7A7A,0x5076,0x5BD3,0x9047,
- 0x9685,0x4E32,0x6ADB,0x91E7,0x5C51,0x5C48,
-
- /* ku 23 */
- 0x6398,0x7A9F,0x6C93,0x9774,0x8F61,0x7AAA,0x718A,0x9688,
- 0x7C82,0x6817,0x7E70,0x6851,0x936C,0x52F2,0x541B,0x85AB,
- 0x8A13,0x7FA4,0x8ECD,0x90E1,0x5366,0x8888,0x7941,0x4FC2,
- 0x50BE,0x5211,0x5144,0x5553,0x572D,0x73EA,0x578B,0x5951,
- 0x5F62,0x5F84,0x6075,0x6176,0x6167,0x61A9,0x63B2,0x643A,
- 0x656C,0x666F,0x6842,0x6E13,0x7566,0x7A3D,0x7CFB,0x7D4C,
- 0x7D99,0x7E4B,0x7F6B,0x830E,0x834A,0x86CD,0x8A08,0x8A63,
- 0x8B66,0x8EFD,0x981A,0x9D8F,0x82B8,0x8FCE,0x9BE8,0x5287,
- 0x621F,0x6483,0x6FC0,0x9699,0x6841,0x5091,0x6B20,0x6C7A,
- 0x6F54,0x7A74,0x7D50,0x8840,0x8A23,0x6708,0x4EF6,0x5039,
- 0x5026,0x5065,0x517C,0x5238,0x5263,0x55A7,0x570F,0x5805,
- 0x5ACC,0x5EFA,0x61B2,0x61F8,0x62F3,0x6372,
-
- /* ku 24 */
- 0x691C,0x6A29,0x727D,0x72AC,0x732E,0x7814,0x786F,0x7D79,
- 0x770C,0x80A9,0x898B,0x8B19,0x8CE2,0x8ED2,0x9063,0x9375,
- 0x967A,0x9855,0x9A13,0x9E78,0x5143,0x539F,0x53B3,0x5E7B,
- 0x5F26,0x6E1B,0x6E90,0x7384,0x73FE,0x7D43,0x8237,0x8A00,
- 0x8AFA,0x9650,0x4E4E,0x500B,0x53E4,0x547C,0x56FA,0x59D1,
- 0x5B64,0x5DF1,0x5EAB,0x5F27,0x6238,0x6545,0x67AF,0x6E56,
- 0x72D0,0x7CCA,0x88B4,0x80A1,0x80E1,0x83F0,0x864E,0x8A87,
- 0x8DE8,0x9237,0x96C7,0x9867,0x9F13,0x4E94,0x4E92,0x4F0D,
- 0x5348,0x5449,0x543E,0x5A2F,0x5F8C,0x5FA1,0x609F,0x68A7,
- 0x6A8E,0x745A,0x7881,0x8A9E,0x8AA4,0x8B77,0x9190,0x4E5E,
- 0x9BC9,0x4EA4,0x4F7C,0x4FAF,0x5019,0x5016,0x5149,0x516C,
- 0x529F,0x52B9,0x52FE,0x539A,0x53E3,0x5411,
-
- /* ku 25 */
- 0x540E,0x5589,0x5751,0x57A2,0x597D,0x5B54,0x5B5D,0x5B8F,
- 0x5DE5,0x5DE7,0x5DF7,0x5E78,0x5E83,0x5E9A,0x5EB7,0x5F18,
- 0x6052,0x614C,0x6297,0x62D8,0x63A7,0x653B,0x6602,0x6643,
- 0x66F4,0x676D,0x6821,0x6897,0x69CB,0x6C5F,0x6D2A,0x6D69,
- 0x6E2F,0x6E9D,0x7532,0x7687,0x786C,0x7A3F,0x7CE0,0x7D05,
- 0x7D18,0x7D5E,0x7DB1,0x8015,0x8003,0x80AF,0x80B1,0x8154,
- 0x818F,0x822A,0x8352,0x884C,0x8861,0x8B1B,0x8CA2,0x8CFC,
- 0x90CA,0x9175,0x9271,0x783F,0x92FC,0x95A4,0x964D,0x9805,
- 0x9999,0x9AD8,0x9D3B,0x525B,0x52AB,0x53F7,0x5408,0x58D5,
- 0x62F7,0x6FE0,0x8C6A,0x8F5F,0x9EB9,0x514B,0x523B,0x544A,
- 0x56FD,0x7A40,0x9177,0x9D60,0x9ED2,0x7344,0x6F09,0x8170,
- 0x7511,0x5FFD,0x60DA,0x9AA8,0x72DB,0x8FBC,
-
- /* ku 26 */
- 0x6B64,0x9803,0x4ECA,0x56F0,0x5764,0x58BE,0x5A5A,0x6068,
- 0x61C7,0x660F,0x6606,0x6839,0x68B1,0x6DF7,0x75D5,0x7D3A,
- 0x826E,0x9B42,0x4E9B,0x4F50,0x53C9,0x5506,0x5D6F,0x5DE6,
- 0x5DEE,0x67FB,0x6C99,0x7473,0x7802,0x8A50,0x9396,0x88DF,
- 0x5750,0x5EA7,0x632B,0x50B5,0x50AC,0x518D,0x6700,0x54C9,
- 0x585E,0x59BB,0x5BB0,0x5F69,0x624D,0x63A1,0x683D,0x6B73,
- 0x6E08,0x707D,0x91C7,0x7280,0x7815,0x7826,0x796D,0x658E,
- 0x7D30,0x83DC,0x88C1,0x8F09,0x969B,0x5264,0x5728,0x6750,
- 0x7F6A,0x8CA1,0x51B4,0x5742,0x962A,0x583A,0x698A,0x80B4,
- 0x54B2,0x5D0E,0x57FC,0x7895,0x9DFA,0x4F5C,0x524A,0x548B,
- 0x643E,0x6628,0x6714,0x67F5,0x7A84,0x7B56,0x7D22,0x932F,
- 0x685C,0x9BAD,0x7B39,0x5319,0x518A,0x5237,
-
- /* ku 27 */
- 0x5BDF,0x62F6,0x64AE,0x64E6,0x672D,0x6BBA,0x85A9,0x96D1,
- 0x7690,0x9BD6,0x634C,0x9306,0x9BAB,0x76BF,0x6652,0x4E09,
- 0x5098,0x53C2,0x5C71,0x60E8,0x6492,0x6563,0x685F,0x71E6,
- 0x73CA,0x7523,0x7B97,0x7E82,0x8695,0x8B83,0x8CDB,0x9178,
- 0x9910,0x65AC,0x66AB,0x6B8B,0x4ED5,0x4ED4,0x4F3A,0x4F7F,
- 0x523A,0x53F8,0x53F2,0x55E3,0x56DB,0x58EB,0x59CB,0x59C9,
- 0x59FF,0x5B50,0x5C4D,0x5E02,0x5E2B,0x5FD7,0x601D,0x6307,
- 0x652F,0x5B5C,0x65AF,0x65BD,0x65E8,0x679D,0x6B62,0x6B7B,
- 0x6C0F,0x7345,0x7949,0x79C1,0x7CF8,0x7D19,0x7D2B,0x80A2,
- 0x8102,0x81F3,0x8996,0x8A5E,0x8A69,0x8A66,0x8A8C,0x8AEE,
- 0x8CC7,0x8CDC,0x96CC,0x98FC,0x6B6F,0x4E8B,0x4F3C,0x4F8D,
- 0x5150,0x5B57,0x5BFA,0x6148,0x6301,0x6642,
-
- /* ku 28 */
- 0x6B21,0x6ECB,0x6CBB,0x723E,0x74BD,0x75D4,0x78C1,0x793A,
- 0x800C,0x8033,0x81EA,0x8494,0x8F9E,0x6C50,0x9E7F,0x5F0F,
- 0x8B58,0x9D2B,0x7AFA,0x8EF8,0x5B8D,0x96EB,0x4E03,0x53F1,
- 0x57F7,0x5931,0x5AC9,0x5BA4,0x6089,0x6E7F,0x6F06,0x75BE,
- 0x8CEA,0x5B9F,0x8500,0x7BE0,0x5072,0x67F4,0x829D,0x5C61,
- 0x854A,0x7E1E,0x820E,0x5199,0x5C04,0x6368,0x8D66,0x659C,
- 0x716E,0x793E,0x7D17,0x8005,0x8B1D,0x8ECA,0x906E,0x86C7,
- 0x90AA,0x501F,0x52FA,0x5C3A,0x6753,0x707C,0x7235,0x914C,
- 0x91C8,0x932B,0x82E5,0x5BC2,0x5F31,0x60F9,0x4E3B,0x53D6,
- 0x5B88,0x624B,0x6731,0x6B8A,0x72E9,0x73E0,0x7A2E,0x816B,
- 0x8DA3,0x9152,0x9996,0x5112,0x53D7,0x546A,0x5BFF,0x6388,
- 0x6A39,0x7DAC,0x9700,0x56DA,0x53CE,0x5468,
-
- /* ku 29 */
- 0x5B97,0x5C31,0x5DDE,0x4FEE,0x6101,0x62FE,0x6D32,0x79C0,
- 0x79CB,0x7D42,0x7E4D,0x7FD2,0x81ED,0x821F,0x8490,0x8846,
- 0x8972,0x8B90,0x8E74,0x8F2F,0x9031,0x914B,0x916C,0x96C6,
- 0x919C,0x4EC0,0x4F4F,0x5145,0x5341,0x5F93,0x620E,0x67D4,
- 0x6C41,0x6E0B,0x7363,0x7E26,0x91CD,0x9283,0x53D4,0x5919,
- 0x5BBF,0x6DD1,0x795D,0x7E2E,0x7C9B,0x587E,0x719F,0x51FA,
- 0x8853,0x8FF0,0x4FCA,0x5CFB,0x6625,0x77AC,0x7AE3,0x821C,
- 0x99FF,0x51C6,0x5FAA,0x65EC,0x696F,0x6B89,0x6DF3,0x6E96,
- 0x6F64,0x76FE,0x7D14,0x5DE1,0x9075,0x9187,0x9806,0x51E6,
- 0x521D,0x6240,0x6691,0x66D9,0x6E1A,0x5EB6,0x7DD2,0x7F72,
- 0x66F8,0x85AF,0x85F7,0x8AF8,0x52A9,0x53D9,0x5973,0x5E8F,
- 0x5F90,0x6055,0x92E4,0x9664,0x50B7,0x511F,
-
- /* ku 30 */
- 0x52DD,0x5320,0x5347,0x53EC,0x54E8,0x5546,0x5531,0x5617,
- 0x5968,0x59BE,0x5A3C,0x5BB5,0x5C06,0x5C0F,0x5C11,0x5C1A,
- 0x5E84,0x5E8A,0x5EE0,0x5F70,0x627F,0x6284,0x62DB,0x638C,
- 0x6377,0x6607,0x660C,0x662D,0x6676,0x677E,0x68A2,0x6A1F,
- 0x6A35,0x6CBC,0x6D88,0x6E09,0x6E58,0x713C,0x7126,0x7167,
- 0x75C7,0x7701,0x785D,0x7901,0x7965,0x79F0,0x7AE0,0x7B11,
- 0x7CA7,0x7D39,0x8096,0x83D6,0x848B,0x8549,0x885D,0x88F3,
- 0x8A1F,0x8A3C,0x8A54,0x8A73,0x8C61,0x8CDE,0x91A4,0x9266,
- 0x937E,0x9418,0x969C,0x9798,0x4E0A,0x4E08,0x4E1E,0x4E57,
- 0x5197,0x5270,0x57CE,0x5834,0x58CC,0x5B22,0x5E38,0x60C5,
- 0x64FE,0x6761,0x6756,0x6D44,0x72B6,0x7573,0x7A63,0x84B8,
- 0x8B72,0x91B8,0x9320,0x5631,0x57F4,0x98FE,
-
- /* ku 31 */
- 0x62ED,0x690D,0x6B96,0x71ED,0x7E54,0x8077,0x8272,0x89E6,
- 0x98DF,0x8755,0x8FB1,0x5C3B,0x4F38,0x4FE1,0x4FB5,0x5507,
- 0x5A20,0x5BDD,0x5BE9,0x5FC3,0x614E,0x632F,0x65B0,0x664B,
- 0x68EE,0x699B,0x6D78,0x6DF1,0x7533,0x75B9,0x771F,0x795E,
- 0x79E6,0x7D33,0x81E3,0x82AF,0x85AA,0x89AA,0x8A3A,0x8EAB,
- 0x8F9B,0x9032,0x91DD,0x9707,0x4EBA,0x4EC1,0x5203,0x5875,
- 0x58EC,0x5C0B,0x751A,0x5C3D,0x814E,0x8A0A,0x8FC5,0x9663,
- 0x976D,0x7B25,0x8ACF,0x9808,0x9162,0x56F3,0x53A8,0x9017,
- 0x5439,0x5782,0x5E25,0x63A8,0x6C34,0x708A,0x7761,0x7C8B,
- 0x7FE0,0x8870,0x9042,0x9154,0x9310,0x9318,0x968F,0x745E,
- 0x9AC4,0x5D07,0x5D69,0x6570,0x67A2,0x8DA8,0x96DB,0x636E,
- 0x6749,0x6919,0x83C5,0x9817,0x96C0,0x88FE,
-
- /* ku 32 */
- 0x6F84,0x647A,0x5BF8,0x4E16,0x702C,0x755D,0x662F,0x51C4,
- 0x5236,0x52E2,0x59D3,0x5F81,0x6027,0x6210,0x653F,0x6574,
- 0x661F,0x6674,0x68F2,0x6816,0x6B63,0x6E05,0x7272,0x751F,
- 0x76DB,0x7CBE,0x8056,0x58F0,0x88FD,0x897F,0x8AA0,0x8A93,
- 0x8ACB,0x901D,0x9192,0x9752,0x9759,0x6589,0x7A0E,0x8106,
- 0x96BB,0x5E2D,0x60DC,0x621A,0x65A5,0x6614,0x6790,0x77F3,
- 0x7A4D,0x7C4D,0x7E3E,0x810A,0x8CAC,0x8D64,0x8DE1,0x8E5F,
- 0x78A9,0x5207,0x62D9,0x63A5,0x6442,0x6298,0x8A2D,0x7A83,
- 0x7BC0,0x8AAC,0x96EA,0x7D76,0x820C,0x8749,0x4ED9,0x5148,
- 0x5343,0x5360,0x5BA3,0x5C02,0x5C16,0x5DDD,0x6226,0x6247,
- 0x64B0,0x6813,0x6834,0x6CC9,0x6D45,0x6D17,0x67D3,0x6F5C,
- 0x714E,0x717D,0x65CB,0x7A7F,0x7BAD,0x7DDA,
-
- /* ku 33 */
- 0x7E4A,0x7FA8,0x817A,0x821B,0x8239,0x85A6,0x8A6E,0x8CCE,
- 0x8DF5,0x9078,0x9077,0x92AD,0x9291,0x9583,0x9BAE,0x524D,
- 0x5584,0x6F38,0x7136,0x5168,0x7985,0x7E55,0x81B3,0x7CCE,
- 0x564C,0x5851,0x5CA8,0x63AA,0x66FE,0x66FD,0x695A,0x72D9,
- 0x758F,0x758E,0x790E,0x7956,0x79DF,0x7C97,0x7D20,0x7D44,
- 0x8607,0x8A34,0x963B,0x9061,0x9F20,0x50E7,0x5275,0x53CC,
- 0x53E2,0x5009,0x55AA,0x58EE,0x594F,0x723D,0x5B8B,0x5C64,
- 0x531D,0x60E3,0x60F3,0x635C,0x6383,0x633F,0x63BB,0x64CD,
- 0x65E9,0x66F9,0x5DE3,0x69CD,0x69FD,0x6F15,0x71E5,0x4E89,
- 0x75E9,0x76F8,0x7A93,0x7CDF,0x7DCF,0x7D9C,0x8061,0x8349,
- 0x8358,0x846C,0x84BC,0x85FB,0x88C5,0x8D70,0x9001,0x906D,
- 0x9397,0x971C,0x9A12,0x50CF,0x5897,0x618E,
-
- /* ku 34 */
- 0x81D3,0x8535,0x8D08,0x9020,0x4FC3,0x5074,0x5247,0x5373,
- 0x606F,0x6349,0x675F,0x6E2C,0x8DB3,0x901F,0x4FD7,0x5C5E,
- 0x8CCA,0x65CF,0x7D9A,0x5352,0x8896,0x5176,0x63C3,0x5B58,
- 0x5B6B,0x5C0A,0x640D,0x6751,0x905C,0x4ED6,0x591A,0x592A,
- 0x6C70,0x8A51,0x553E,0x5815,0x59A5,0x60F0,0x6253,0x67C1,
- 0x8235,0x6955,0x9640,0x99C4,0x9A28,0x4F53,0x5806,0x5BFE,
- 0x8010,0x5CB1,0x5E2F,0x5F85,0x6020,0x614B,0x6234,0x66FF,
- 0x6CF0,0x6EDE,0x80CE,0x817F,0x82D4,0x888B,0x8CB8,0x9000,
- 0x902E,0x968A,0x9EDB,0x9BDB,0x4EE3,0x53F0,0x5927,0x7B2C,
- 0x918D,0x984C,0x9DF9,0x6EDD,0x7027,0x5353,0x5544,0x5B85,
- 0x6258,0x629E,0x62D3,0x6CA2,0x6FEF,0x7422,0x8A17,0x9438,
- 0x6FC1,0x8AFE,0x8338,0x51E7,0x86F8,0x53EA,
-
- /* ku 35 */
- 0x53E9,0x4F46,0x9054,0x8FB0,0x596A,0x8131,0x5DFD,0x7AEA,
- 0x8FBF,0x68DA,0x8C37,0x72F8,0x9C48,0x6A3D,0x8AB0,0x4E39,
- 0x5358,0x5606,0x5766,0x62C5,0x63A2,0x65E6,0x6B4E,0x6DE1,
- 0x6E5B,0x70AD,0x77ED,0x7AEF,0x7BAA,0x7DBB,0x803D,0x80C6,
- 0x86CB,0x8A95,0x935B,0x56E3,0x58C7,0x5F3E,0x65AD,0x6696,
- 0x6A80,0x6BB5,0x7537,0x8AC7,0x5024,0x77E5,0x5730,0x5F1B,
- 0x6065,0x667A,0x6C60,0x75F4,0x7A1A,0x7F6E,0x81F4,0x8718,
- 0x9045,0x99B3,0x7BC9,0x755C,0x7AF9,0x7B51,0x84C4,0x9010,
- 0x79E9,0x7A92,0x8336,0x5AE1,0x7740,0x4E2D,0x4EF2,0x5B99,
- 0x5FE0,0x62BD,0x663C,0x67F1,0x6CE8,0x866B,0x8877,0x8A3B,
- 0x914E,0x92F3,0x99D0,0x6A17,0x7026,0x732A,0x82E7,0x8457,
- 0x8CAF,0x4E01,0x5146,0x51CB,0x558B,0x5BF5,
-
- /* ku 36 */
- 0x5E16,0x5E33,0x5E81,0x5F14,0x5F35,0x5F6B,0x5FB4,0x61F2,
- 0x6311,0x66A2,0x671D,0x6F6E,0x7252,0x753A,0x773A,0x8074,
- 0x8139,0x8178,0x8776,0x8ABF,0x8ADC,0x8D85,0x8DF3,0x929A,
- 0x9577,0x9802,0x9CE5,0x52C5,0x6357,0x76F4,0x6715,0x6C88,
- 0x73CD,0x8CC3,0x93AE,0x9673,0x6D25,0x589C,0x690E,0x69CC,
- 0x8FFD,0x939A,0x75DB,0x901A,0x585A,0x6802,0x63B4,0x69FB,
- 0x4F43,0x6F2C,0x67D8,0x8FBB,0x8526,0x7DB4,0x9354,0x693F,
- 0x6F70,0x576A,0x58F7,0x5B2C,0x7D2C,0x722A,0x540A,0x91E3,
- 0x9DB4,0x4EAD,0x4F4E,0x505C,0x5075,0x5243,0x8C9E,0x5448,
- 0x5824,0x5B9A,0x5E1D,0x5E95,0x5EAD,0x5EF7,0x5F1F,0x608C,
- 0x62B5,0x633A,0x63D0,0x68AF,0x6C40,0x7887,0x798E,0x7A0B,
- 0x7DE0,0x8247,0x8A02,0x8AE6,0x8E44,0x9013,
-
- /* ku 37 */
- 0x90B8,0x912D,0x91D8,0x9F0E,0x6CE5,0x6458,0x64E2,0x6575,
- 0x6EF4,0x7684,0x7B1B,0x9069,0x93D1,0x6EBA,0x54F2,0x5FB9,
- 0x64A4,0x8F4D,0x8FED,0x9244,0x5178,0x586B,0x5929,0x5C55,
- 0x5E97,0x6DFB,0x7E8F,0x751C,0x8CBC,0x8EE2,0x985B,0x70B9,
- 0x4F1D,0x6BBF,0x6FB1,0x7530,0x96FB,0x514E,0x5410,0x5835,
- 0x5857,0x59AC,0x5C60,0x5F92,0x6597,0x675C,0x6E21,0x767B,
- 0x83DF,0x8CED,0x9014,0x90FD,0x934D,0x7825,0x783A,0x52AA,
- 0x5EA6,0x571F,0x5974,0x6012,0x5012,0x515A,0x51AC,0x51CD,
- 0x5200,0x5510,0x5854,0x5858,0x5957,0x5B95,0x5CF6,0x5D8B,
- 0x60BC,0x6295,0x642D,0x6771,0x6843,0x68BC,0x68DF,0x76D7,
- 0x6DD8,0x6E6F,0x6D9B,0x706F,0x71C8,0x5F53,0x75D8,0x7977,
- 0x7B49,0x7B54,0x7B52,0x7CD6,0x7D71,0x5230,
-
- /* ku 38 */
- 0x8463,0x8569,0x85E4,0x8A0E,0x8B04,0x8C46,0x8E0F,0x9003,
- 0x900F,0x9419,0x9676,0x982D,0x9A30,0x95D8,0x50CD,0x52D5,
- 0x540C,0x5802,0x5C0E,0x61A7,0x649E,0x6D1E,0x77B3,0x7AE5,
- 0x80F4,0x8404,0x9053,0x9285,0x5CE0,0x9D07,0x533F,0x5F97,
- 0x5FB3,0x6D9C,0x7279,0x7763,0x79BF,0x7BE4,0x6BD2,0x72EC,
- 0x8AAD,0x6803,0x6A61,0x51F8,0x7A81,0x6934,0x5C4A,0x9CF6,
- 0x82EB,0x5BC5,0x9149,0x701E,0x5678,0x5C6F,0x60C7,0x6566,
- 0x6C8C,0x8C5A,0x9041,0x9813,0x5451,0x66C7,0x920D,0x5948,
- 0x90A3,0x5185,0x4E4D,0x51EA,0x8599,0x8B0E,0x7058,0x637A,
- 0x934B,0x6962,0x99B4,0x7E04,0x7577,0x5357,0x6960,0x8EDF,
- 0x96E3,0x6C5D,0x4E8C,0x5C3C,0x5F10,0x8FE9,0x5302,0x8CD1,
- 0x8089,0x8679,0x5EFF,0x65E5,0x4E73,0x5165,
-
- /* ku 39 */
- 0x5982,0x5C3F,0x97EE,0x4EFB,0x598A,0x5FCD,0x8A8D,0x6FE1,
- 0x79B0,0x7962,0x5BE7,0x8471,0x732B,0x71B1,0x5E74,0x5FF5,
- 0x637B,0x649A,0x71C3,0x7C98,0x4E43,0x5EFC,0x4E4B,0x57DC,
- 0x56A2,0x60A9,0x6FC3,0x7D0D,0x80FD,0x8133,0x81BF,0x8FB2,
- 0x8997,0x86A4,0x5DF4,0x628A,0x64AD,0x8987,0x6777,0x6CE2,
- 0x6D3E,0x7436,0x7834,0x5A46,0x7F75,0x82AD,0x99AC,0x4FF3,
- 0x5EC3,0x62DD,0x6392,0x6557,0x676F,0x76C3,0x724C,0x80CC,
- 0x80BA,0x8F29,0x914D,0x500D,0x57F9,0x5A92,0x6885,0x6973,
- 0x7164,0x72FD,0x8CB7,0x58F2,0x8CE0,0x966A,0x9019,0x877F,
- 0x79E4,0x77E7,0x8429,0x4F2F,0x5265,0x535A,0x62CD,0x67CF,
- 0x6CCA,0x767D,0x7B94,0x7C95,0x8236,0x8584,0x8FEB,0x66DD,
- 0x6F20,0x7206,0x7E1B,0x83AB,0x99C1,0x9EA6,
-
- /* ku 40 */
- 0x51FD,0x7BB1,0x7872,0x7BB8,0x8087,0x7B48,0x6AE8,0x5E61,
- 0x808C,0x7551,0x7560,0x516B,0x9262,0x6E8C,0x767A,0x9197,
- 0x9AEA,0x4F10,0x7F70,0x629C,0x7B4F,0x95A5,0x9CE9,0x567A,
- 0x5859,0x86E4,0x96BC,0x4F34,0x5224,0x534A,0x53CD,0x53DB,
- 0x5E06,0x642C,0x6591,0x677F,0x6C3E,0x6C4E,0x7248,0x72AF,
- 0x73ED,0x7554,0x7E41,0x822C,0x85E9,0x8CA9,0x7BC4,0x91C6,
- 0x7169,0x9812,0x98EF,0x633D,0x6669,0x756A,0x76E4,0x78D0,
- 0x8543,0x86EE,0x532A,0x5351,0x5426,0x5983,0x5E87,0x5F7C,
- 0x60B2,0x6249,0x6279,0x62AB,0x6590,0x6BD4,0x6CCC,0x75B2,
- 0x76AE,0x7891,0x79D8,0x7DCB,0x7F77,0x80A5,0x88AB,0x8AB9,
- 0x8CBB,0x907F,0x975E,0x98DB,0x6A0B,0x7C38,0x5099,0x5C3E,
- 0x5FAE,0x6787,0x6BD8,0x7435,0x7709,0x7F8E,
-
- /* ku 41 */
- 0x9F3B,0x67CA,0x7A17,0x5339,0x758B,0x9AED,0x5F66,0x819D,
- 0x83F1,0x8098,0x5F3C,0x5FC5,0x7562,0x7B46,0x903C,0x6867,
- 0x59EB,0x5A9B,0x7D10,0x767E,0x8B2C,0x4FF5,0x5F6A,0x6A19,
- 0x6C37,0x6F02,0x74E2,0x7968,0x8868,0x8A55,0x8C79,0x5EDF,
- 0x63CF,0x75C5,0x79D2,0x82D7,0x9328,0x92F2,0x849C,0x86ED,
- 0x9C2D,0x54C1,0x5F6C,0x658C,0x6D5C,0x7015,0x8CA7,0x8CD3,
- 0x983B,0x654F,0x74F6,0x4E0D,0x4ED8,0x57E0,0x592B,0x5A66,
- 0x5BCC,0x51A8,0x5E03,0x5E9C,0x6016,0x6276,0x6577,0x65A7,
- 0x666E,0x6D6E,0x7236,0x7B26,0x8150,0x819A,0x8299,0x8B5C,
- 0x8CA0,0x8CE6,0x8D74,0x961C,0x9644,0x4FAE,0x64AB,0x6B66,
- 0x821E,0x8461,0x856A,0x90E8,0x5C01,0x6953,0x98A8,0x847A,
- 0x8557,0x4F0F,0x526F,0x5FA9,0x5E45,0x670D,
-
- /* ku 42 */
- 0x798F,0x8179,0x8907,0x8986,0x6DF5,0x5F17,0x6255,0x6CB8,
- 0x4ECF,0x7269,0x9B92,0x5206,0x543B,0x5674,0x58B3,0x61A4,
- 0x626E,0x711A,0x596E,0x7C89,0x7CDE,0x7D1B,0x96F0,0x6587,
- 0x805E,0x4E19,0x4F75,0x5175,0x5840,0x5E63,0x5E73,0x5F0A,
- 0x67C4,0x4E26,0x853D,0x9589,0x965B,0x7C73,0x9801,0x50FB,
- 0x58C1,0x7656,0x78A7,0x5225,0x77A5,0x8511,0x7B86,0x504F,
- 0x5909,0x7247,0x7BC7,0x7DE8,0x8FBA,0x8FD4,0x904D,0x4FBF,
- 0x52C9,0x5A29,0x5F01,0x97AD,0x4FDD,0x8217,0x92EA,0x5703,
- 0x6355,0x6B69,0x752B,0x88DC,0x8F14,0x7A42,0x52DF,0x5893,
- 0x6155,0x620A,0x66AE,0x6BCD,0x7C3F,0x83E9,0x5023,0x4FF8,
- 0x5305,0x5446,0x5831,0x5949,0x5B9D,0x5CF0,0x5CEF,0x5D29,
- 0x5E96,0x62B1,0x6367,0x653E,0x65B9,0x670B,
-
- /* ku 43 */
- 0x6CD5,0x6CE1,0x70F9,0x7832,0x7E2B,0x80DE,0x82B3,0x840C,
- 0x84EC,0x8702,0x8912,0x8A2A,0x8C4A,0x90A6,0x92D2,0x98FD,
- 0x9CF3,0x9D6C,0x4E4F,0x4EA1,0x508D,0x5256,0x574A,0x59A8,
- 0x5E3D,0x5FD8,0x5FD9,0x623F,0x66B4,0x671B,0x67D0,0x68D2,
- 0x5192,0x7D21,0x80AA,0x81A8,0x8B00,0x8C8C,0x8CBF,0x927E,
- 0x9632,0x5420,0x982C,0x5317,0x50D5,0x535C,0x58A8,0x64B2,
- 0x6734,0x7267,0x7766,0x7A46,0x91E6,0x52C3,0x6CA1,0x6B86,
- 0x5800,0x5E4C,0x5954,0x672C,0x7FFB,0x51E1,0x76C6,0x6469,
- 0x78E8,0x9B54,0x9EBB,0x57CB,0x59B9,0x6627,0x679A,0x6BCE,
- 0x54E9,0x69D9,0x5E55,0x819C,0x6795,0x9BAA,0x67FE,0x9C52,
- 0x685D,0x4EA6,0x4FE3,0x53C8,0x62B9,0x672B,0x6CAB,0x8FC4,
- 0x4FAD,0x7E6D,0x9EBF,0x4E07,0x6162,0x6E80,
-
- /* ku 44 */
- 0x6F2B,0x8513,0x5473,0x672A,0x9B45,0x5DF3,0x7B95,0x5CAC,
- 0x5BC6,0x871C,0x6E4A,0x84D1,0x7A14,0x8108,0x5999,0x7C8D,
- 0x6C11,0x7720,0x52D9,0x5922,0x7121,0x725F,0x77DB,0x9727,
- 0x9D61,0x690B,0x5A7F,0x5A18,0x51A5,0x540D,0x547D,0x660E,
- 0x76DF,0x8FF7,0x9298,0x9CF4,0x59EA,0x725D,0x6EC5,0x514D,
- 0x68C9,0x7DBF,0x7DEC,0x9762,0x9EBA,0x6478,0x6A21,0x8302,
- 0x5984,0x5B5F,0x6BDB,0x731B,0x76F2,0x7DB2,0x8017,0x8499,
- 0x5132,0x6728,0x9ED9,0x76EE,0x6762,0x52FF,0x9905,0x5C24,
- 0x623B,0x7C7E,0x8CB0,0x554F,0x60B6,0x7D0B,0x9580,0x5301,
- 0x4E5F,0x51B6,0x591C,0x723A,0x8036,0x91CE,0x5F25,0x77E2,
- 0x5384,0x5F79,0x7D04,0x85AC,0x8A33,0x8E8D,0x9756,0x67F3,
- 0x85AE,0x9453,0x6109,0x6108,0x6CB9,0x7652,
-
- /* ku 45 */
- 0x8AED,0x8F38,0x552F,0x4F51,0x512A,0x52C7,0x53CB,0x5BA5,
- 0x5E7D,0x60A0,0x6182,0x63D6,0x6709,0x67DA,0x6E67,0x6D8C,
- 0x7336,0x7337,0x7531,0x7950,0x88D5,0x8A98,0x904A,0x9091,
- 0x90F5,0x96C4,0x878D,0x5915,0x4E88,0x4F59,0x4E0E,0x8A89,
- 0x8F3F,0x9810,0x50AD,0x5E7C,0x5996,0x5BB9,0x5EB8,0x63DA,
- 0x63FA,0x64C1,0x66DC,0x694A,0x69D8,0x6D0B,0x6EB6,0x7194,
- 0x7528,0x7AAF,0x7F8A,0x8000,0x8449,0x84C9,0x8981,0x8B21,
- 0x8E0A,0x9065,0x967D,0x990A,0x617E,0x6291,0x6B32,0x6C83,
- 0x6D74,0x7FCC,0x7FFC,0x6DC0,0x7F85,0x87BA,0x88F8,0x6765,
- 0x83B1,0x983C,0x96F7,0x6D1B,0x7D61,0x843D,0x916A,0x4E71,
- 0x5375,0x5D50,0x6B04,0x6FEB,0x85CD,0x862D,0x89A7,0x5229,
- 0x540F,0x5C65,0x674E,0x68A8,0x7406,0x7483,
-
- /* ku 46 */
- 0x75E2,0x88CF,0x88E1,0x91CC,0x96E2,0x9678,0x5F8B,0x7387,
- 0x7ACB,0x844E,0x63A0,0x7565,0x5289,0x6D41,0x6E9C,0x7409,
- 0x7559,0x786B,0x7C92,0x9686,0x7ADC,0x9F8D,0x4FB6,0x616E,
- 0x65C5,0x865C,0x4E86,0x4EAE,0x50DA,0x4E21,0x51CC,0x5BEE,
- 0x6599,0x6881,0x6DBC,0x731F,0x7642,0x77AD,0x7A1C,0x7CE7,
- 0x826F,0x8AD2,0x907C,0x91CF,0x9675,0x9818,0x529B,0x7DD1,
- 0x502B,0x5398,0x6797,0x6DCB,0x71D0,0x7433,0x81E8,0x8F2A,
- 0x96A3,0x9C57,0x9E9F,0x7460,0x5841,0x6D99,0x7D2F,0x985E,
- 0x4EE4,0x4F36,0x4F8B,0x51B7,0x52B1,0x5DBA,0x601C,0x73B2,
- 0x793C,0x82D3,0x9234,0x96B7,0x96F6,0x970A,0x9E97,0x9F62,
- 0x66A6,0x6B74,0x5217,0x52A3,0x70C8,0x88C2,0x5EC9,0x604B,
- 0x6190,0x6F23,0x7149,0x7C3E,0x7DF4,0x806F,
-
- /* ku 47 */
- 0x84EE,0x9023,0x932C,0x5442,0x9B6F,0x6AD3,0x7089,0x8CC2,
- 0x8DEF,0x9732,0x52B4,0x5A41,0x5ECA,0x5F04,0x6717,0x697C,
- 0x6994,0x6D6A,0x6F0F,0x7262,0x72FC,0x7BED,0x8001,0x807E,
- 0x874B,0x90CE,0x516D,0x9E93,0x7984,0x808B,0x9332,0x8AD6,
- 0x502D,0x548C,0x8A71,0x6B6A,0x8CC4,0x8107,0x60D1,0x67A0,
- 0x9DF2,0x4E99,0x4E98,0x9C10,0x8A6B,0x85C1,0x8568,0x6900,
- 0x6E7E,0x7897,0x8155,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-
- /* ku 48 */
- 0x5F0C,0x4E10,0x4E15,0x4E2A,0x4E31,0x4E36,0x4E3C,0x4E3F,
- 0x4E42,0x4E56,0x4E58,0x4E82,0x4E85,0x8C6B,0x4E8A,0x8212,
- 0x5F0D,0x4E8E,0x4E9E,0x4E9F,0x4EA0,0x4EA2,0x4EB0,0x4EB3,
- 0x4EB6,0x4ECE,0x4ECD,0x4EC4,0x4EC6,0x4EC2,0x4ED7,0x4EDE,
- 0x4EED,0x4EDF,0x4EF7,0x4F09,0x4F5A,0x4F30,0x4F5B,0x4F5D,
- 0x4F57,0x4F47,0x4F76,0x4F88,0x4F8F,0x4F98,0x4F7B,0x4F69,
- 0x4F70,0x4F91,0x4F6F,0x4F86,0x4F96,0x5118,0x4FD4,0x4FDF,
- 0x4FCE,0x4FD8,0x4FDB,0x4FD1,0x4FDA,0x4FD0,0x4FE4,0x4FE5,
- 0x501A,0x5028,0x5014,0x502A,0x5025,0x5005,0x4F1C,0x4FF6,
- 0x5021,0x5029,0x502C,0x4FFE,0x4FEF,0x5011,0x5006,0x5043,
- 0x5047,0x6703,0x5055,0x5050,0x5048,0x505A,0x5056,0x506C,
- 0x5078,0x5080,0x509A,0x5085,0x50B4,0x50B2,
-
- /* ku 49 */
- 0x50C9,0x50CA,0x50B3,0x50C2,0x50D6,0x50DE,0x50E5,0x50ED,
- 0x50E3,0x50EE,0x50F9,0x50F5,0x5109,0x5101,0x5102,0x5116,
- 0x5115,0x5114,0x511A,0x5121,0x513A,0x5137,0x513C,0x513B,
- 0x513F,0x5140,0x5152,0x514C,0x5154,0x5162,0x7AF8,0x5169,
- 0x516A,0x516E,0x5180,0x5182,0x56D8,0x518C,0x5189,0x518F,
- 0x5191,0x5193,0x5195,0x5196,0x51A4,0x51A6,0x51A2,0x51A9,
- 0x51AA,0x51AB,0x51B3,0x51B1,0x51B2,0x51B0,0x51B5,0x51BD,
- 0x51C5,0x51C9,0x51DB,0x51E0,0x8655,0x51E9,0x51ED,0x51F0,
- 0x51F5,0x51FE,0x5204,0x520B,0x5214,0x520E,0x5227,0x522A,
- 0x522E,0x5233,0x5239,0x524F,0x5244,0x524B,0x524C,0x525E,
- 0x5254,0x526A,0x5274,0x5269,0x5273,0x527F,0x527D,0x528D,
- 0x5294,0x5292,0x5271,0x5288,0x5291,0x8FA8,
-
- /* ku 50 */
- 0x8FA7,0x52AC,0x52AD,0x52BC,0x52B5,0x52C1,0x52CD,0x52D7,
- 0x52DE,0x52E3,0x52E6,0x98ED,0x52E0,0x52F3,0x52F5,0x52F8,
- 0x52F9,0x5306,0x5308,0x7538,0x530D,0x5310,0x530F,0x5315,
- 0x531A,0x5323,0x532F,0x5331,0x5333,0x5338,0x5340,0x5346,
- 0x5345,0x4E17,0x5349,0x534D,0x51D6,0x535E,0x5369,0x536E,
- 0x5918,0x537B,0x5377,0x5382,0x5396,0x53A0,0x53A6,0x53A5,
- 0x53AE,0x53B0,0x53B6,0x53C3,0x7C12,0x96D9,0x53DF,0x66FC,
- 0x71EE,0x53EE,0x53E8,0x53ED,0x53FA,0x5401,0x543D,0x5440,
- 0x542C,0x542D,0x543C,0x542E,0x5436,0x5429,0x541D,0x544E,
- 0x548F,0x5475,0x548E,0x545F,0x5471,0x5477,0x5470,0x5492,
- 0x547B,0x5480,0x5476,0x5484,0x5490,0x5486,0x54C7,0x54A2,
- 0x54B8,0x54A5,0x54AC,0x54C4,0x54C8,0x54A8,
-
- /* ku 51 */
- 0x54AB,0x54C2,0x54A4,0x54BE,0x54BC,0x54D8,0x54E5,0x54E6,
- 0x550F,0x5514,0x54FD,0x54EE,0x54ED,0x54FA,0x54E2,0x5539,
- 0x5540,0x5563,0x554C,0x552E,0x555C,0x5545,0x5556,0x5557,
- 0x5538,0x5533,0x555D,0x5599,0x5580,0x54AF,0x558A,0x559F,
- 0x557B,0x557E,0x5598,0x559E,0x55AE,0x557C,0x5583,0x55A9,
- 0x5587,0x55A8,0x55DA,0x55C5,0x55DF,0x55C4,0x55DC,0x55E4,
- 0x55D4,0x5614,0x55F7,0x5616,0x55FE,0x55FD,0x561B,0x55F9,
- 0x564E,0x5650,0x71DF,0x5634,0x5636,0x5632,0x5638,0x566B,
- 0x5664,0x562F,0x566C,0x566A,0x5686,0x5680,0x568A,0x56A0,
- 0x5694,0x568F,0x56A5,0x56AE,0x56B6,0x56B4,0x56C2,0x56BC,
- 0x56C1,0x56C3,0x56C0,0x56C8,0x56CE,0x56D1,0x56D3,0x56D7,
- 0x56EE,0x56F9,0x5700,0x56FF,0x5704,0x5709,
-
- /* ku 52 */
- 0x5708,0x570B,0x570D,0x5713,0x5718,0x5716,0x55C7,0x571C,
- 0x5726,0x5737,0x5738,0x574E,0x573B,0x5740,0x574F,0x5769,
- 0x57C0,0x5788,0x5761,0x577F,0x5789,0x5793,0x57A0,0x57B3,
- 0x57A4,0x57AA,0x57B0,0x57C3,0x57C6,0x57D4,0x57D2,0x57D3,
- 0x580A,0x57D6,0x57E3,0x580B,0x5819,0x581D,0x5872,0x5821,
- 0x5862,0x584B,0x5870,0x6BC0,0x5852,0x583D,0x5879,0x5885,
- 0x58B9,0x589F,0x58AB,0x58BA,0x58DE,0x58BB,0x58B8,0x58AE,
- 0x58C5,0x58D3,0x58D1,0x58D7,0x58D9,0x58D8,0x58E5,0x58DC,
- 0x58E4,0x58DF,0x58EF,0x58FA,0x58F9,0x58FB,0x58FC,0x58FD,
- 0x5902,0x590A,0x5910,0x591B,0x68A6,0x5925,0x592C,0x592D,
- 0x5932,0x5938,0x593E,0x7AD2,0x5955,0x5950,0x594E,0x595A,
- 0x5958,0x5962,0x5960,0x5967,0x596C,0x5969,
-
- /* ku 53 */
- 0x5978,0x5981,0x599D,0x4F5E,0x4FAB,0x59A3,0x59B2,0x59C6,
- 0x59E8,0x59DC,0x598D,0x59D9,0x59DA,0x5A25,0x5A1F,0x5A11,
- 0x5A1C,0x5A09,0x5A1A,0x5A40,0x5A6C,0x5A49,0x5A35,0x5A36,
- 0x5A62,0x5A6A,0x5A9A,0x5ABC,0x5ABE,0x5ACB,0x5AC2,0x5ABD,
- 0x5AE3,0x5AD7,0x5AE6,0x5AE9,0x5AD6,0x5AFA,0x5AFB,0x5B0C,
- 0x5B0B,0x5B16,0x5B32,0x5AD0,0x5B2A,0x5B36,0x5B3E,0x5B43,
- 0x5B45,0x5B40,0x5B51,0x5B55,0x5B5A,0x5B5B,0x5B65,0x5B69,
- 0x5B70,0x5B73,0x5B75,0x5B78,0x6588,0x5B7A,0x5B80,0x5B83,
- 0x5BA6,0x5BB8,0x5BC3,0x5BC7,0x5BC9,0x5BD4,0x5BD0,0x5BE4,
- 0x5BE6,0x5BE2,0x5BDE,0x5BE5,0x5BEB,0x5BF0,0x5BF6,0x5BF3,
- 0x5C05,0x5C07,0x5C08,0x5C0D,0x5C13,0x5C20,0x5C22,0x5C28,
- 0x5C38,0x5C39,0x5C41,0x5C46,0x5C4E,0x5C53,
-
- /* ku 54 */
- 0x5C50,0x5C4F,0x5B71,0x5C6C,0x5C6E,0x4E62,0x5C76,0x5C79,
- 0x5C8C,0x5C91,0x5C94,0x599B,0x5CAB,0x5CBB,0x5CB6,0x5CBC,
- 0x5CB7,0x5CC5,0x5CBE,0x5CC7,0x5CD9,0x5CE9,0x5CFD,0x5CFA,
- 0x5CED,0x5D8C,0x5CEA,0x5D0B,0x5D15,0x5D17,0x5D5C,0x5D1F,
- 0x5D1B,0x5D11,0x5D14,0x5D22,0x5D1A,0x5D19,0x5D18,0x5D4C,
- 0x5D52,0x5D4E,0x5D4B,0x5D6C,0x5D73,0x5D76,0x5D87,0x5D84,
- 0x5D82,0x5DA2,0x5D9D,0x5DAC,0x5DAE,0x5DBD,0x5D90,0x5DB7,
- 0x5DBC,0x5DC9,0x5DCD,0x5DD3,0x5DD2,0x5DD6,0x5DDB,0x5DEB,
- 0x5DF2,0x5DF5,0x5E0B,0x5E1A,0x5E19,0x5E11,0x5E1B,0x5E36,
- 0x5E37,0x5E44,0x5E43,0x5E40,0x5E4E,0x5E57,0x5E54,0x5E5F,
- 0x5E62,0x5E64,0x5E47,0x5E75,0x5E76,0x5E7A,0x9EBC,0x5E7F,
- 0x5EA0,0x5EC1,0x5EC2,0x5EC8,0x5ED0,0x5ECF,
-
- /* ku 55 */
- 0x5ED6,0x5EE3,0x5EDD,0x5EDA,0x5EDB,0x5EE2,0x5EE1,0x5EE8,
- 0x5EE9,0x5EEC,0x5EF1,0x5EF3,0x5EF0,0x5EF4,0x5EF8,0x5EFE,
- 0x5F03,0x5F09,0x5F5D,0x5F5C,0x5F0B,0x5F11,0x5F16,0x5F29,
- 0x5F2D,0x5F38,0x5F41,0x5F48,0x5F4C,0x5F4E,0x5F2F,0x5F51,
- 0x5F56,0x5F57,0x5F59,0x5F61,0x5F6D,0x5F73,0x5F77,0x5F83,
- 0x5F82,0x5F7F,0x5F8A,0x5F88,0x5F91,0x5F87,0x5F9E,0x5F99,
- 0x5F98,0x5FA0,0x5FA8,0x5FAD,0x5FBC,0x5FD6,0x5FFB,0x5FE4,
- 0x5FF8,0x5FF1,0x5FDD,0x60B3,0x5FFF,0x6021,0x6060,0x6019,
- 0x6010,0x6029,0x600E,0x6031,0x601B,0x6015,0x602B,0x6026,
- 0x600F,0x603A,0x605A,0x6041,0x606A,0x6077,0x605F,0x604A,
- 0x6046,0x604D,0x6063,0x6043,0x6064,0x6042,0x606C,0x606B,
- 0x6059,0x6081,0x608D,0x60E7,0x6083,0x609A,
-
- /* ku 56 */
- 0x6084,0x609B,0x6096,0x6097,0x6092,0x60A7,0x608B,0x60E1,
- 0x60B8,0x60E0,0x60D3,0x60B4,0x5FF0,0x60BD,0x60C6,0x60B5,
- 0x60D8,0x614D,0x6115,0x6106,0x60F6,0x60F7,0x6100,0x60F4,
- 0x60FA,0x6103,0x6121,0x60FB,0x60F1,0x610D,0x610E,0x6147,
- 0x613E,0x6128,0x6127,0x614A,0x613F,0x613C,0x612C,0x6134,
- 0x613D,0x6142,0x6144,0x6173,0x6177,0x6158,0x6159,0x615A,
- 0x616B,0x6174,0x616F,0x6165,0x6171,0x615F,0x615D,0x6153,
- 0x6175,0x6199,0x6196,0x6187,0x61AC,0x6194,0x619A,0x618A,
- 0x6191,0x61AB,0x61AE,0x61CC,0x61CA,0x61C9,0x61F7,0x61C8,
- 0x61C3,0x61C6,0x61BA,0x61CB,0x7F79,0x61CD,0x61E6,0x61E3,
- 0x61F6,0x61FA,0x61F4,0x61FF,0x61FD,0x61FC,0x61FE,0x6200,
- 0x6208,0x6209,0x620D,0x620C,0x6214,0x621B,
-
- /* ku 57 */
- 0x621E,0x6221,0x622A,0x622E,0x6230,0x6232,0x6233,0x6241,
- 0x624E,0x625E,0x6263,0x625B,0x6260,0x6268,0x627C,0x6282,
- 0x6289,0x627E,0x6292,0x6293,0x6296,0x62D4,0x6283,0x6294,
- 0x62D7,0x62D1,0x62BB,0x62CF,0x62FF,0x62C6,0x64D4,0x62C8,
- 0x62DC,0x62CC,0x62CA,0x62C2,0x62C7,0x629B,0x62C9,0x630C,
- 0x62EE,0x62F1,0x6327,0x6302,0x6308,0x62EF,0x62F5,0x6350,
- 0x633E,0x634D,0x641C,0x634F,0x6396,0x638E,0x6380,0x63AB,
- 0x6376,0x63A3,0x638F,0x6389,0x639F,0x63B5,0x636B,0x6369,
- 0x63BE,0x63E9,0x63C0,0x63C6,0x63E3,0x63C9,0x63D2,0x63F6,
- 0x63C4,0x6416,0x6434,0x6406,0x6413,0x6426,0x6436,0x651D,
- 0x6417,0x6428,0x640F,0x6467,0x646F,0x6476,0x644E,0x652A,
- 0x6495,0x6493,0x64A5,0x64A9,0x6488,0x64BC,
-
- /* ku 58 */
- 0x64DA,0x64D2,0x64C5,0x64C7,0x64BB,0x64D8,0x64C2,0x64F1,
- 0x64E7,0x8209,0x64E0,0x64E1,0x62AC,0x64E3,0x64EF,0x652C,
- 0x64F6,0x64F4,0x64F2,0x64FA,0x6500,0x64FD,0x6518,0x651C,
- 0x6505,0x6524,0x6523,0x652B,0x6534,0x6535,0x6537,0x6536,
- 0x6538,0x754B,0x6548,0x6556,0x6555,0x654D,0x6558,0x655E,
- 0x655D,0x6572,0x6578,0x6582,0x6583,0x8B8A,0x659B,0x659F,
- 0x65AB,0x65B7,0x65C3,0x65C6,0x65C1,0x65C4,0x65CC,0x65D2,
- 0x65DB,0x65D9,0x65E0,0x65E1,0x65F1,0x6772,0x660A,0x6603,
- 0x65FB,0x6773,0x6635,0x6636,0x6634,0x661C,0x664F,0x6644,
- 0x6649,0x6641,0x665E,0x665D,0x6664,0x6667,0x6668,0x665F,
- 0x6662,0x6670,0x6683,0x6688,0x668E,0x6689,0x6684,0x6698,
- 0x669D,0x66C1,0x66B9,0x66C9,0x66BE,0x66BC,
-
- /* ku 59 */
- 0x66C4,0x66B8,0x66D6,0x66DA,0x66E0,0x663F,0x66E6,0x66E9,
- 0x66F0,0x66F5,0x66F7,0x670F,0x6716,0x671E,0x6726,0x6727,
- 0x9738,0x672E,0x673F,0x6736,0x6741,0x6738,0x6737,0x6746,
- 0x675E,0x6760,0x6759,0x6763,0x6764,0x6789,0x6770,0x67A9,
- 0x677C,0x676A,0x678C,0x678B,0x67A6,0x67A1,0x6785,0x67B7,
- 0x67EF,0x67B4,0x67EC,0x67B3,0x67E9,0x67B8,0x67E4,0x67DE,
- 0x67DD,0x67E2,0x67EE,0x67B9,0x67CE,0x67C6,0x67E7,0x6A9C,
- 0x681E,0x6846,0x6829,0x6840,0x684D,0x6832,0x684E,0x68B3,
- 0x682B,0x6859,0x6863,0x6877,0x687F,0x689F,0x688F,0x68AD,
- 0x6894,0x689D,0x689B,0x6883,0x6AAE,0x68B9,0x6874,0x68B5,
- 0x68A0,0x68BA,0x690F,0x688D,0x687E,0x6901,0x68CA,0x6908,
- 0x68D8,0x6922,0x6926,0x68E1,0x690C,0x68CD,
-
- /* ku 60 */
- 0x68D4,0x68E7,0x68D5,0x6936,0x6912,0x6904,0x68D7,0x68E3,
- 0x6925,0x68F9,0x68E0,0x68EF,0x6928,0x692A,0x691A,0x6923,
- 0x6921,0x68C6,0x6979,0x6977,0x695C,0x6978,0x696B,0x6954,
- 0x697E,0x696E,0x6939,0x6974,0x693D,0x6959,0x6930,0x6961,
- 0x695E,0x695D,0x6981,0x696A,0x69B2,0x69AE,0x69D0,0x69BF,
- 0x69C1,0x69D3,0x69BE,0x69CE,0x5BE8,0x69CA,0x69DD,0x69BB,
- 0x69C3,0x69A7,0x6A2E,0x6991,0x69A0,0x699C,0x6995,0x69B4,
- 0x69DE,0x69E8,0x6A02,0x6A1B,0x69FF,0x6B0A,0x69F9,0x69F2,
- 0x69E7,0x6A05,0x69B1,0x6A1E,0x69ED,0x6A14,0x69EB,0x6A0A,
- 0x6A12,0x6AC1,0x6A23,0x6A13,0x6A44,0x6A0C,0x6A72,0x6A36,
- 0x6A78,0x6A47,0x6A62,0x6A59,0x6A66,0x6A48,0x6A38,0x6A22,
- 0x6A90,0x6A8D,0x6AA0,0x6A84,0x6AA2,0x6AA3,
-
- /* ku 61 */
- 0x6A97,0x8617,0x6ABB,0x6AC3,0x6AC2,0x6AB8,0x6AB3,0x6AAC,
- 0x6ADE,0x6AD1,0x6ADF,0x6AAA,0x6ADA,0x6AEA,0x6AFB,0x6B05,
- 0x8616,0x6AFA,0x6B12,0x6B16,0x9B31,0x6B1F,0x6B38,0x6B37,
- 0x76DC,0x6B39,0x98EE,0x6B47,0x6B43,0x6B49,0x6B50,0x6B59,
- 0x6B54,0x6B5B,0x6B5F,0x6B61,0x6B78,0x6B79,0x6B7F,0x6B80,
- 0x6B84,0x6B83,0x6B8D,0x6B98,0x6B95,0x6B9E,0x6BA4,0x6BAA,
- 0x6BAB,0x6BAF,0x6BB2,0x6BB1,0x6BB3,0x6BB7,0x6BBC,0x6BC6,
- 0x6BCB,0x6BD3,0x6BDF,0x6BEC,0x6BEB,0x6BF3,0x6BEF,0x9EBE,
- 0x6C08,0x6C13,0x6C14,0x6C1B,0x6C24,0x6C23,0x6C5E,0x6C55,
- 0x6C62,0x6C6A,0x6C82,0x6C8D,0x6C9A,0x6C81,0x6C9B,0x6C7E,
- 0x6C68,0x6C73,0x6C92,0x6C90,0x6CC4,0x6CF1,0x6CD3,0x6CBD,
- 0x6CD7,0x6CC5,0x6CDD,0x6CAE,0x6CB1,0x6CBE,
-
- /* ku 62 */
- 0x6CBA,0x6CDB,0x6CEF,0x6CD9,0x6CEA,0x6D1F,0x884D,0x6D36,
- 0x6D2B,0x6D3D,0x6D38,0x6D19,0x6D35,0x6D33,0x6D12,0x6D0C,
- 0x6D63,0x6D93,0x6D64,0x6D5A,0x6D79,0x6D59,0x6D8E,0x6D95,
- 0x6FE4,0x6D85,0x6DF9,0x6E15,0x6E0A,0x6DB5,0x6DC7,0x6DE6,
- 0x6DB8,0x6DC6,0x6DEC,0x6DDE,0x6DCC,0x6DE8,0x6DD2,0x6DC5,
- 0x6DFA,0x6DD9,0x6DE4,0x6DD5,0x6DEA,0x6DEE,0x6E2D,0x6E6E,
- 0x6E2E,0x6E19,0x6E72,0x6E5F,0x6E3E,0x6E23,0x6E6B,0x6E2B,
- 0x6E76,0x6E4D,0x6E1F,0x6E43,0x6E3A,0x6E4E,0x6E24,0x6EFF,
- 0x6E1D,0x6E38,0x6E82,0x6EAA,0x6E98,0x6EC9,0x6EB7,0x6ED3,
- 0x6EBD,0x6EAF,0x6EC4,0x6EB2,0x6ED4,0x6ED5,0x6E8F,0x6EA5,
- 0x6EC2,0x6E9F,0x6F41,0x6F11,0x704C,0x6EEC,0x6EF8,0x6EFE,
- 0x6F3F,0x6EF2,0x6F31,0x6EEF,0x6F32,0x6ECC,
-
- /* ku 63 */
- 0x6F3E,0x6F13,0x6EF7,0x6F86,0x6F7A,0x6F78,0x6F81,0x6F80,
- 0x6F6F,0x6F5B,0x6FF3,0x6F6D,0x6F82,0x6F7C,0x6F58,0x6F8E,
- 0x6F91,0x6FC2,0x6F66,0x6FB3,0x6FA3,0x6FA1,0x6FA4,0x6FB9,
- 0x6FC6,0x6FAA,0x6FDF,0x6FD5,0x6FEC,0x6FD4,0x6FD8,0x6FF1,
- 0x6FEE,0x6FDB,0x7009,0x700B,0x6FFA,0x7011,0x7001,0x700F,
- 0x6FFE,0x701B,0x701A,0x6F74,0x701D,0x7018,0x701F,0x7030,
- 0x703E,0x7032,0x7051,0x7063,0x7099,0x7092,0x70AF,0x70F1,
- 0x70AC,0x70B8,0x70B3,0x70AE,0x70DF,0x70CB,0x70DD,0x70D9,
- 0x7109,0x70FD,0x711C,0x7119,0x7165,0x7155,0x7188,0x7166,
- 0x7162,0x714C,0x7156,0x716C,0x718F,0x71FB,0x7184,0x7195,
- 0x71A8,0x71AC,0x71D7,0x71B9,0x71BE,0x71D2,0x71C9,0x71D4,
- 0x71CE,0x71E0,0x71EC,0x71E7,0x71F5,0x71FC,
-
- /* ku 64 */
- 0x71F9,0x71FF,0x720D,0x7210,0x721B,0x7228,0x722D,0x722C,
- 0x7230,0x7232,0x723B,0x723C,0x723F,0x7240,0x7246,0x724B,
- 0x7258,0x7274,0x727E,0x7282,0x7281,0x7287,0x7292,0x7296,
- 0x72A2,0x72A7,0x72B9,0x72B2,0x72C3,0x72C6,0x72C4,0x72CE,
- 0x72D2,0x72E2,0x72E0,0x72E1,0x72F9,0x72F7,0x500F,0x7317,
- 0x730A,0x731C,0x7316,0x731D,0x7334,0x732F,0x7329,0x7325,
- 0x733E,0x734E,0x734F,0x9ED8,0x7357,0x736A,0x7368,0x7370,
- 0x7378,0x7375,0x737B,0x737A,0x73C8,0x73B3,0x73CE,0x73BB,
- 0x73C0,0x73E5,0x73EE,0x73DE,0x74A2,0x7405,0x746F,0x7425,
- 0x73F8,0x7432,0x743A,0x7455,0x743F,0x745F,0x7459,0x7441,
- 0x745C,0x7469,0x7470,0x7463,0x746A,0x7476,0x747E,0x748B,
- 0x749E,0x74A7,0x74CA,0x74CF,0x74D4,0x73F1,
-
- /* ku 65 */
- 0x74E0,0x74E3,0x74E7,0x74E9,0x74EE,0x74F2,0x74F0,0x74F1,
- 0x74F8,0x74F7,0x7504,0x7503,0x7505,0x750C,0x750E,0x750D,
- 0x7515,0x7513,0x751E,0x7526,0x752C,0x753C,0x7544,0x754D,
- 0x754A,0x7549,0x755B,0x7546,0x755A,0x7569,0x7564,0x7567,
- 0x756B,0x756D,0x7578,0x7576,0x7586,0x7587,0x7574,0x758A,
- 0x7589,0x7582,0x7594,0x759A,0x759D,0x75A5,0x75A3,0x75C2,
- 0x75B3,0x75C3,0x75B5,0x75BD,0x75B8,0x75BC,0x75B1,0x75CD,
- 0x75CA,0x75D2,0x75D9,0x75E3,0x75DE,0x75FE,0x75FF,0x75FC,
- 0x7601,0x75F0,0x75FA,0x75F2,0x75F3,0x760B,0x760D,0x7609,
- 0x761F,0x7627,0x7620,0x7621,0x7622,0x7624,0x7634,0x7630,
- 0x763B,0x7647,0x7648,0x7646,0x765C,0x7658,0x7661,0x7662,
- 0x7668,0x7669,0x766A,0x7667,0x766C,0x7670,
-
- /* ku 66 */
- 0x7672,0x7676,0x7678,0x767C,0x7680,0x7683,0x7688,0x768B,
- 0x768E,0x7696,0x7693,0x7699,0x769A,0x76B0,0x76B4,0x76B8,
- 0x76B9,0x76BA,0x76C2,0x76CD,0x76D6,0x76D2,0x76DE,0x76E1,
- 0x76E5,0x76E7,0x76EA,0x862F,0x76FB,0x7708,0x7707,0x7704,
- 0x7729,0x7724,0x771E,0x7725,0x7726,0x771B,0x7737,0x7738,
- 0x7747,0x775A,0x7768,0x776B,0x775B,0x7765,0x777F,0x777E,
- 0x7779,0x778E,0x778B,0x7791,0x77A0,0x779E,0x77B0,0x77B6,
- 0x77B9,0x77BF,0x77BC,0x77BD,0x77BB,0x77C7,0x77CD,0x77D7,
- 0x77DA,0x77DC,0x77E3,0x77EE,0x77FC,0x780C,0x7812,0x7926,
- 0x7820,0x792A,0x7845,0x788E,0x7874,0x7886,0x787C,0x789A,
- 0x788C,0x78A3,0x78B5,0x78AA,0x78AF,0x78D1,0x78C6,0x78CB,
- 0x78D4,0x78BE,0x78BC,0x78C5,0x78CA,0x78EC,
-
- /* ku 67 */
- 0x78E7,0x78DA,0x78FD,0x78F4,0x7907,0x7912,0x7911,0x7919,
- 0x792C,0x792B,0x7940,0x7960,0x7957,0x795F,0x795A,0x7955,
- 0x7953,0x797A,0x797F,0x798A,0x799D,0x79A7,0x9F4B,0x79AA,
- 0x79AE,0x79B3,0x79B9,0x79BA,0x79C9,0x79D5,0x79E7,0x79EC,
- 0x79E1,0x79E3,0x7A08,0x7A0D,0x7A18,0x7A19,0x7A20,0x7A1F,
- 0x7980,0x7A31,0x7A3B,0x7A3E,0x7A37,0x7A43,0x7A57,0x7A49,
- 0x7A61,0x7A62,0x7A69,0x9F9D,0x7A70,0x7A79,0x7A7D,0x7A88,
- 0x7A97,0x7A95,0x7A98,0x7A96,0x7AA9,0x7AC8,0x7AB0,0x7AB6,
- 0x7AC5,0x7AC4,0x7ABF,0x9083,0x7AC7,0x7ACA,0x7ACD,0x7ACF,
- 0x7AD5,0x7AD3,0x7AD9,0x7ADA,0x7ADD,0x7AE1,0x7AE2,0x7AE6,
- 0x7AED,0x7AF0,0x7B02,0x7B0F,0x7B0A,0x7B06,0x7B33,0x7B18,
- 0x7B19,0x7B1E,0x7B35,0x7B28,0x7B36,0x7B50,
-
- /* ku 68 */
- 0x7B7A,0x7B04,0x7B4D,0x7B0B,0x7B4C,0x7B45,0x7B75,0x7B65,
- 0x7B74,0x7B67,0x7B70,0x7B71,0x7B6C,0x7B6E,0x7B9D,0x7B98,
- 0x7B9F,0x7B8D,0x7B9C,0x7B9A,0x7B8B,0x7B92,0x7B8F,0x7B5D,
- 0x7B99,0x7BCB,0x7BC1,0x7BCC,0x7BCF,0x7BB4,0x7BC6,0x7BDD,
- 0x7BE9,0x7C11,0x7C14,0x7BE6,0x7BE5,0x7C60,0x7C00,0x7C07,
- 0x7C13,0x7BF3,0x7BF7,0x7C17,0x7C0D,0x7BF6,0x7C23,0x7C27,
- 0x7C2A,0x7C1F,0x7C37,0x7C2B,0x7C3D,0x7C4C,0x7C43,0x7C54,
- 0x7C4F,0x7C40,0x7C50,0x7C58,0x7C5F,0x7C64,0x7C56,0x7C65,
- 0x7C6C,0x7C75,0x7C83,0x7C90,0x7CA4,0x7CAD,0x7CA2,0x7CAB,
- 0x7CA1,0x7CA8,0x7CB3,0x7CB2,0x7CB1,0x7CAE,0x7CB9,0x7CBD,
- 0x7CC0,0x7CC5,0x7CC2,0x7CD8,0x7CD2,0x7CDC,0x7CE2,0x9B3B,
- 0x7CEF,0x7CF2,0x7CF4,0x7CF6,0x7CFA,0x7D06,
-
- /* ku 69 */
- 0x7D02,0x7D1C,0x7D15,0x7D0A,0x7D45,0x7D4B,0x7D2E,0x7D32,
- 0x7D3F,0x7D35,0x7D46,0x7D73,0x7D56,0x7D4E,0x7D72,0x7D68,
- 0x7D6E,0x7D4F,0x7D63,0x7D93,0x7D89,0x7D5B,0x7D8F,0x7D7D,
- 0x7D9B,0x7DBA,0x7DAE,0x7DA3,0x7DB5,0x7DC7,0x7DBD,0x7DAB,
- 0x7E3D,0x7DA2,0x7DAF,0x7DDC,0x7DB8,0x7D9F,0x7DB0,0x7DD8,
- 0x7DDD,0x7DE4,0x7DDE,0x7DFB,0x7DF2,0x7DE1,0x7E05,0x7E0A,
- 0x7E23,0x7E21,0x7E12,0x7E31,0x7E1F,0x7E09,0x7E0B,0x7E22,
- 0x7E46,0x7E66,0x7E3B,0x7E35,0x7E39,0x7E43,0x7E37,0x7E32,
- 0x7E3A,0x7E67,0x7E5D,0x7E56,0x7E5E,0x7E59,0x7E5A,0x7E79,
- 0x7E6A,0x7E69,0x7E7C,0x7E7B,0x7E83,0x7DD5,0x7E7D,0x8FAE,
- 0x7E7F,0x7E88,0x7E89,0x7E8C,0x7E92,0x7E90,0x7E93,0x7E94,
- 0x7E96,0x7E8E,0x7E9B,0x7E9C,0x7F38,0x7F3A,
-
- /* ku 70 */
- 0x7F45,0x7F4C,0x7F4D,0x7F4E,0x7F50,0x7F51,0x7F55,0x7F54,
- 0x7F58,0x7F5F,0x7F60,0x7F68,0x7F69,0x7F67,0x7F78,0x7F82,
- 0x7F86,0x7F83,0x7F88,0x7F87,0x7F8C,0x7F94,0x7F9E,0x7F9D,
- 0x7F9A,0x7FA3,0x7FAF,0x7FB2,0x7FB9,0x7FAE,0x7FB6,0x7FB8,
- 0x8B71,0x7FC5,0x7FC6,0x7FCA,0x7FD5,0x7FD4,0x7FE1,0x7FE6,
- 0x7FE9,0x7FF3,0x7FF9,0x98DC,0x8006,0x8004,0x800B,0x8012,
- 0x8018,0x8019,0x801C,0x8021,0x8028,0x803F,0x803B,0x804A,
- 0x8046,0x8052,0x8058,0x805A,0x805F,0x8062,0x8068,0x8073,
- 0x8072,0x8070,0x8076,0x8079,0x807D,0x807F,0x8084,0x8086,
- 0x8085,0x809B,0x8093,0x809A,0x80AD,0x5190,0x80AC,0x80DB,
- 0x80E5,0x80D9,0x80DD,0x80C4,0x80DA,0x80D6,0x8109,0x80EF,
- 0x80F1,0x811B,0x8129,0x8123,0x812F,0x814B,
-
- /* ku 71 */
- 0x968B,0x8146,0x813E,0x8153,0x8151,0x80FC,0x8171,0x816E,
- 0x8165,0x8166,0x8174,0x8183,0x8188,0x818A,0x8180,0x8182,
- 0x81A0,0x8195,0x81A4,0x81A3,0x815F,0x8193,0x81A9,0x81B0,
- 0x81B5,0x81BE,0x81B8,0x81BD,0x81C0,0x81C2,0x81BA,0x81C9,
- 0x81CD,0x81D1,0x81D9,0x81D8,0x81C8,0x81DA,0x81DF,0x81E0,
- 0x81E7,0x81FA,0x81FB,0x81FE,0x8201,0x8202,0x8205,0x8207,
- 0x820A,0x820D,0x8210,0x8216,0x8229,0x822B,0x8238,0x8233,
- 0x8240,0x8259,0x8258,0x825D,0x825A,0x825F,0x8264,0x8262,
- 0x8268,0x826A,0x826B,0x822E,0x8271,0x8277,0x8278,0x827E,
- 0x828D,0x8292,0x82AB,0x829F,0x82BB,0x82AC,0x82E1,0x82E3,
- 0x82DF,0x82D2,0x82F4,0x82F3,0x82FA,0x8393,0x8303,0x82FB,
- 0x82F9,0x82DE,0x8306,0x82DC,0x8309,0x82D9,
-
- /* ku 72 */
- 0x8335,0x8334,0x8316,0x8332,0x8331,0x8340,0x8339,0x8350,
- 0x8345,0x832F,0x832B,0x8317,0x8318,0x8385,0x839A,0x83AA,
- 0x839F,0x83A2,0x8396,0x8323,0x838E,0x8387,0x838A,0x837C,
- 0x83B5,0x8373,0x8375,0x83A0,0x8389,0x83A8,0x83F4,0x8413,
- 0x83EB,0x83CE,0x83FD,0x8403,0x83D8,0x840B,0x83C1,0x83F7,
- 0x8407,0x83E0,0x83F2,0x840D,0x8422,0x8420,0x83BD,0x8438,
- 0x8506,0x83FB,0x846D,0x842A,0x843C,0x855A,0x8484,0x8477,
- 0x846B,0x84AD,0x846E,0x8482,0x8469,0x8446,0x842C,0x846F,
- 0x8479,0x8435,0x84CA,0x8462,0x84B9,0x84BF,0x849F,0x84D9,
- 0x84CD,0x84BB,0x84DA,0x84D0,0x84C1,0x84C6,0x84D6,0x84A1,
- 0x8521,0x84FF,0x84F4,0x8517,0x8518,0x852C,0x851F,0x8515,
- 0x8514,0x84FC,0x8540,0x8563,0x8558,0x8548,
-
- /* ku 73 */
- 0x8541,0x8602,0x854B,0x8555,0x8580,0x85A4,0x8588,0x8591,
- 0x858A,0x85A8,0x856D,0x8594,0x859B,0x85EA,0x8587,0x859C,
- 0x8577,0x857E,0x8590,0x85C9,0x85BA,0x85CF,0x85B9,0x85D0,
- 0x85D5,0x85DD,0x85E5,0x85DC,0x85F9,0x860A,0x8613,0x860B,
- 0x85FE,0x85FA,0x8606,0x8622,0x861A,0x8630,0x863F,0x864D,
- 0x4E55,0x8654,0x865F,0x8667,0x8671,0x8693,0x86A3,0x86A9,
- 0x86AA,0x868B,0x868C,0x86B6,0x86AF,0x86C4,0x86C6,0x86B0,
- 0x86C9,0x8823,0x86AB,0x86D4,0x86DE,0x86E9,0x86EC,0x86DF,
- 0x86DB,0x86EF,0x8712,0x8706,0x8708,0x8700,0x8703,0x86FB,
- 0x8711,0x8709,0x870D,0x86F9,0x870A,0x8734,0x873F,0x8737,
- 0x873B,0x8725,0x8729,0x871A,0x8760,0x875F,0x8778,0x874C,
- 0x874E,0x8774,0x8757,0x8768,0x876E,0x8759,
-
- /* ku 74 */
- 0x8753,0x8763,0x876A,0x8805,0x87A2,0x879F,0x8782,0x87AF,
- 0x87CB,0x87BD,0x87C0,0x87D0,0x96D6,0x87AB,0x87C4,0x87B3,
- 0x87C7,0x87C6,0x87BB,0x87EF,0x87F2,0x87E0,0x880F,0x880D,
- 0x87FE,0x87F6,0x87F7,0x880E,0x87D2,0x8811,0x8816,0x8815,
- 0x8822,0x8821,0x8831,0x8836,0x8839,0x8827,0x883B,0x8844,
- 0x8842,0x8852,0x8859,0x885E,0x8862,0x886B,0x8881,0x887E,
- 0x889E,0x8875,0x887D,0x88B5,0x8872,0x8882,0x8897,0x8892,
- 0x88AE,0x8899,0x88A2,0x888D,0x88A4,0x88B0,0x88BF,0x88B1,
- 0x88C3,0x88C4,0x88D4,0x88D8,0x88D9,0x88DD,0x88F9,0x8902,
- 0x88FC,0x88F4,0x88E8,0x88F2,0x8904,0x890C,0x890A,0x8913,
- 0x8943,0x891E,0x8925,0x892A,0x892B,0x8941,0x8944,0x893B,
- 0x8936,0x8938,0x894C,0x891D,0x8960,0x895E,
-
- /* ku 75 */
- 0x8966,0x8964,0x896D,0x896A,0x896F,0x8974,0x8977,0x897E,
- 0x8983,0x8988,0x898A,0x8993,0x8998,0x89A1,0x89A9,0x89A6,
- 0x89AC,0x89AF,0x89B2,0x89BA,0x89BD,0x89BF,0x89C0,0x89DA,
- 0x89DC,0x89DD,0x89E7,0x89F4,0x89F8,0x8A03,0x8A16,0x8A10,
- 0x8A0C,0x8A1B,0x8A1D,0x8A25,0x8A36,0x8A41,0x8A5B,0x8A52,
- 0x8A46,0x8A48,0x8A7C,0x8A6D,0x8A6C,0x8A62,0x8A85,0x8A82,
- 0x8A84,0x8AA8,0x8AA1,0x8A91,0x8AA5,0x8AA6,0x8A9A,0x8AA3,
- 0x8AC4,0x8ACD,0x8AC2,0x8ADA,0x8AEB,0x8AF3,0x8AE7,0x8AE4,
- 0x8AF1,0x8B14,0x8AE0,0x8AE2,0x8AF7,0x8ADE,0x8ADB,0x8B0C,
- 0x8B07,0x8B1A,0x8AE1,0x8B16,0x8B10,0x8B17,0x8B20,0x8B33,
- 0x97AB,0x8B26,0x8B2B,0x8B3E,0x8B28,0x8B41,0x8B4C,0x8B4F,
- 0x8B4E,0x8B49,0x8B56,0x8B5B,0x8B5A,0x8B6B,
-
- /* ku 76 */
- 0x8B5F,0x8B6C,0x8B6F,0x8B74,0x8B7D,0x8B80,0x8B8C,0x8B8E,
- 0x8B92,0x8B93,0x8B96,0x8B99,0x8B9A,0x8C3A,0x8C41,0x8C3F,
- 0x8C48,0x8C4C,0x8C4E,0x8C50,0x8C55,0x8C62,0x8C6C,0x8C78,
- 0x8C7A,0x8C82,0x8C89,0x8C85,0x8C8A,0x8C8D,0x8C8E,0x8C94,
- 0x8C7C,0x8C98,0x621D,0x8CAD,0x8CAA,0x8CBD,0x8CB2,0x8CB3,
- 0x8CAE,0x8CB6,0x8CC8,0x8CC1,0x8CE4,0x8CE3,0x8CDA,0x8CFD,
- 0x8CFA,0x8CFB,0x8D04,0x8D05,0x8D0A,0x8D07,0x8D0F,0x8D0D,
- 0x8D10,0x9F4E,0x8D13,0x8CCD,0x8D14,0x8D16,0x8D67,0x8D6D,
- 0x8D71,0x8D73,0x8D81,0x8D99,0x8DC2,0x8DBE,0x8DBA,0x8DCF,
- 0x8DDA,0x8DD6,0x8DCC,0x8DDB,0x8DCB,0x8DEA,0x8DEB,0x8DDF,
- 0x8DE3,0x8DFC,0x8E08,0x8E09,0x8DFF,0x8E1D,0x8E1E,0x8E10,
- 0x8E1F,0x8E42,0x8E35,0x8E30,0x8E34,0x8E4A,
-
- /* ku 77 */
- 0x8E47,0x8E49,0x8E4C,0x8E50,0x8E48,0x8E59,0x8E64,0x8E60,
- 0x8E2A,0x8E63,0x8E55,0x8E76,0x8E72,0x8E7C,0x8E81,0x8E87,
- 0x8E85,0x8E84,0x8E8B,0x8E8A,0x8E93,0x8E91,0x8E94,0x8E99,
- 0x8EAA,0x8EA1,0x8EAC,0x8EB0,0x8EC6,0x8EB1,0x8EBE,0x8EC5,
- 0x8EC8,0x8ECB,0x8EDB,0x8EE3,0x8EFC,0x8EFB,0x8EEB,0x8EFE,
- 0x8F0A,0x8F05,0x8F15,0x8F12,0x8F19,0x8F13,0x8F1C,0x8F1F,
- 0x8F1B,0x8F0C,0x8F26,0x8F33,0x8F3B,0x8F39,0x8F45,0x8F42,
- 0x8F3E,0x8F4C,0x8F49,0x8F46,0x8F4E,0x8F57,0x8F5C,0x8F62,
- 0x8F63,0x8F64,0x8F9C,0x8F9F,0x8FA3,0x8FAD,0x8FAF,0x8FB7,
- 0x8FDA,0x8FE5,0x8FE2,0x8FEA,0x8FEF,0x9087,0x8FF4,0x9005,
- 0x8FF9,0x8FFA,0x9011,0x9015,0x9021,0x900D,0x901E,0x9016,
- 0x900B,0x9027,0x9036,0x9035,0x9039,0x8FF8,
-
- /* ku 78 */
- 0x904F,0x9050,0x9051,0x9052,0x900E,0x9049,0x903E,0x9056,
- 0x9058,0x905E,0x9068,0x906F,0x9076,0x96A8,0x9072,0x9082,
- 0x907D,0x9081,0x9080,0x908A,0x9089,0x908F,0x90A8,0x90AF,
- 0x90B1,0x90B5,0x90E2,0x90E4,0x6248,0x90DB,0x9102,0x9112,
- 0x9119,0x9132,0x9130,0x914A,0x9156,0x9158,0x9163,0x9165,
- 0x9169,0x9173,0x9172,0x918B,0x9189,0x9182,0x91A2,0x91AB,
- 0x91AF,0x91AA,0x91B5,0x91B4,0x91BA,0x91C0,0x91C1,0x91C9,
- 0x91CB,0x91D0,0x91D6,0x91DF,0x91E1,0x91DB,0x91FC,0x91F5,
- 0x91F6,0x921E,0x91FF,0x9214,0x922C,0x9215,0x9211,0x925E,
- 0x9257,0x9245,0x9249,0x9264,0x9248,0x9295,0x923F,0x924B,
- 0x9250,0x929C,0x9296,0x9293,0x929B,0x925A,0x92CF,0x92B9,
- 0x92B7,0x92E9,0x930F,0x92FA,0x9344,0x932E,
-
- /* ku 79 */
- 0x9319,0x9322,0x931A,0x9323,0x933A,0x9335,0x933B,0x935C,
- 0x9360,0x937C,0x936E,0x9356,0x93B0,0x93AC,0x93AD,0x9394,
- 0x93B9,0x93D6,0x93D7,0x93E8,0x93E5,0x93D8,0x93C3,0x93DD,
- 0x93D0,0x93C8,0x93E4,0x941A,0x9414,0x9413,0x9403,0x9407,
- 0x9410,0x9436,0x942B,0x9435,0x9421,0x943A,0x9441,0x9452,
- 0x9444,0x945B,0x9460,0x9462,0x945E,0x946A,0x9229,0x9470,
- 0x9475,0x9477,0x947D,0x945A,0x947C,0x947E,0x9481,0x947F,
- 0x9582,0x9587,0x958A,0x9594,0x9596,0x9598,0x9599,0x95A0,
- 0x95A8,0x95A7,0x95AD,0x95BC,0x95BB,0x95B9,0x95BE,0x95CA,
- 0x6FF6,0x95C3,0x95CD,0x95CC,0x95D5,0x95D4,0x95D6,0x95DC,
- 0x95E1,0x95E5,0x95E2,0x9621,0x9628,0x962E,0x962F,0x9642,
- 0x964C,0x964F,0x964B,0x9677,0x965C,0x965E,
-
- /* ku 80 */
- 0x965D,0x965F,0x9666,0x9672,0x966C,0x968D,0x9698,0x9695,
- 0x9697,0x96AA,0x96A7,0x96B1,0x96B2,0x96B0,0x96B4,0x96B6,
- 0x96B8,0x96B9,0x96CE,0x96CB,0x96C9,0x96CD,0x894D,0x96DC,
- 0x970D,0x96D5,0x96F9,0x9704,0x9706,0x9708,0x9713,0x970E,
- 0x9711,0x970F,0x9716,0x9719,0x9724,0x972A,0x9730,0x9739,
- 0x973D,0x973E,0x9744,0x9746,0x9748,0x9742,0x9749,0x975C,
- 0x9760,0x9764,0x9766,0x9768,0x52D2,0x976B,0x9771,0x9779,
- 0x9785,0x977C,0x9781,0x977A,0x9786,0x978B,0x978F,0x9790,
- 0x979C,0x97A8,0x97A6,0x97A3,0x97B3,0x97B4,0x97C3,0x97C6,
- 0x97C8,0x97CB,0x97DC,0x97ED,0x9F4F,0x97F2,0x7ADF,0x97F6,
- 0x97F5,0x980F,0x980C,0x9838,0x9824,0x9821,0x9837,0x983D,
- 0x9846,0x984F,0x984B,0x986B,0x986F,0x9870,
-
- /* ku 81 */
- 0x9871,0x9874,0x9873,0x98AA,0x98AF,0x98B1,0x98B6,0x98C4,
- 0x98C3,0x98C6,0x98E9,0x98EB,0x9903,0x9909,0x9912,0x9914,
- 0x9918,0x9921,0x991D,0x991E,0x9924,0x9920,0x992C,0x992E,
- 0x993D,0x993E,0x9942,0x9949,0x9945,0x9950,0x994B,0x9951,
- 0x9952,0x994C,0x9955,0x9997,0x9998,0x99A5,0x99AD,0x99AE,
- 0x99BC,0x99DF,0x99DB,0x99DD,0x99D8,0x99D1,0x99ED,0x99EE,
- 0x99F1,0x99F2,0x99FB,0x99F8,0x9A01,0x9A0F,0x9A05,0x99E2,
- 0x9A19,0x9A2B,0x9A37,0x9A45,0x9A42,0x9A40,0x9A43,0x9A3E,
- 0x9A55,0x9A4D,0x9A5B,0x9A57,0x9A5F,0x9A62,0x9A65,0x9A64,
- 0x9A69,0x9A6B,0x9A6A,0x9AAD,0x9AB0,0x9ABC,0x9AC0,0x9ACF,
- 0x9AD1,0x9AD3,0x9AD4,0x9ADE,0x9ADF,0x9AE2,0x9AE3,0x9AE6,
- 0x9AEF,0x9AEB,0x9AEE,0x9AF4,0x9AF1,0x9AF7,
-
- /* ku 82 */
- 0x9AFB,0x9B06,0x9B18,0x9B1A,0x9B1F,0x9B22,0x9B23,0x9B25,
- 0x9B27,0x9B28,0x9B29,0x9B2A,0x9B2E,0x9B2F,0x9B32,0x9B44,
- 0x9B43,0x9B4F,0x9B4D,0x9B4E,0x9B51,0x9B58,0x9B74,0x9B93,
- 0x9B83,0x9B91,0x9B96,0x9B97,0x9B9F,0x9BA0,0x9BA8,0x9BB4,
- 0x9BC0,0x9BCA,0x9BB9,0x9BC6,0x9BCF,0x9BD1,0x9BD2,0x9BE3,
- 0x9BE2,0x9BE4,0x9BD4,0x9BE1,0x9C3A,0x9BF2,0x9BF1,0x9BF0,
- 0x9C15,0x9C14,0x9C09,0x9C13,0x9C0C,0x9C06,0x9C08,0x9C12,
- 0x9C0A,0x9C04,0x9C2E,0x9C1B,0x9C25,0x9C24,0x9C21,0x9C30,
- 0x9C47,0x9C32,0x9C46,0x9C3E,0x9C5A,0x9C60,0x9C67,0x9C76,
- 0x9C78,0x9CE7,0x9CEC,0x9CF0,0x9D09,0x9D08,0x9CEB,0x9D03,
- 0x9D06,0x9D2A,0x9D26,0x9DAF,0x9D23,0x9D1F,0x9D44,0x9D15,
- 0x9D12,0x9D41,0x9D3F,0x9D3E,0x9D46,0x9D48,
-
- /* ku 83 */
- 0x9D5D,0x9D5E,0x9D64,0x9D51,0x9D50,0x9D59,0x9D72,0x9D89,
- 0x9D87,0x9DAB,0x9D6F,0x9D7A,0x9D9A,0x9DA4,0x9DA9,0x9DB2,
- 0x9DC4,0x9DC1,0x9DBB,0x9DB8,0x9DBA,0x9DC6,0x9DCF,0x9DC2,
- 0x9DD9,0x9DD3,0x9DF8,0x9DE6,0x9DED,0x9DEF,0x9DFD,0x9E1A,
- 0x9E1B,0x9E1E,0x9E75,0x9E79,0x9E7D,0x9E81,0x9E88,0x9E8B,
- 0x9E8C,0x9E92,0x9E95,0x9E91,0x9E9D,0x9EA5,0x9EA9,0x9EB8,
- 0x9EAA,0x9EAD,0x9761,0x9ECC,0x9ECE,0x9ECF,0x9ED0,0x9ED4,
- 0x9EDC,0x9EDE,0x9EDD,0x9EE0,0x9EE5,0x9EE8,0x9EEF,0x9EF4,
- 0x9EF6,0x9EF7,0x9EF9,0x9EFB,0x9EFC,0x9EFD,0x9F07,0x9F08,
- 0x76B7,0x9F15,0x9F21,0x9F2C,0x9F3E,0x9F4A,0x9F52,0x9F54,
- 0x9F63,0x9F5F,0x9F60,0x9F61,0x9F66,0x9F67,0x9F6C,0x9F6A,
- 0x9F77,0x9F72,0x9F76,0x9F95,0x9F9C,0x9FA0,
-
- /* ku 84 */
- 0x582F,0x69C7,0x9059,0x7464,0x51DC,0x7199
-};
-
-static const int jisx0208_ucs_table_size = (sizeof (jisx0208_ucs_table) / sizeof (unsigned short));
-
-static const unsigned short cp932ext1_ucs_table[] = {
- /* ku 13 */
- 0x2460,0x2461,0x2462,0x2463,0x2464,0x2465,0x2466,0x2467,
- 0x2468,0x2469,0x246A,0x246B,0x246C,0x246D,0x246E,0x246F,
- 0x2470,0x2471,0x2472,0x2473,0x2160,0x2161,0x2162,0x2163,
- 0x2164,0x2165,0x2166,0x2167,0x2168,0x2169,0x0000,0x3349,
- 0x3314,0x3322,0x334D,0x3318,0x3327,0x3303,0x3336,0x3351,
- 0x3357,0x330D,0x3326,0x3323,0x332B,0x334A,0x333B,0x339C,
- 0x339D,0x339E,0x338E,0x338F,0x33C4,0x33A1,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x337B,0x301D,
- 0x301F,0x2116,0x33CD,0x2121,0x32A4,0x32A5,0x32A6,0x32A7,
- 0x32A8,0x3231,0x3232,0x3239,0x337E,0x337D,0x337C,0x2252,
- 0x2261,0x222B,0x222E,0x2211,0x221A,0x22A5,0x2220,0x221F,
- 0x22BF,0x2235,0x2229,0x222A,0x0000,0x0000
-};
-static const int cp932ext1_ucs_table_min = (13 - 1)*94;
-static const int cp932ext1_ucs_table_max = (13 - 1)*94 + (sizeof (cp932ext1_ucs_table) / sizeof (unsigned short));
-
-static const unsigned short cp932ext2_ucs_table[] = {
- /* ku 89 */
- 0x7E8A,0x891C,0x9348,0x9288,0x84DC,0x4FC9,0x70BB,0x6631,
- 0x68C8,0x92F9,0x66FB,0x5F45,0x4E28,0x4EE1,0x4EFC,0x4F00,
- 0x4F03,0x4F39,0x4F56,0x4F92,0x4F8A,0x4F9A,0x4F94,0x4FCD,
- 0x5040,0x5022,0x4FFF,0x501E,0x5046,0x5070,0x5042,0x5094,
- 0x50F4,0x50D8,0x514A,0x5164,0x519D,0x51BE,0x51EC,0x5215,
- 0x529C,0x52A6,0x52C0,0x52DB,0x5300,0x5307,0x5324,0x5372,
- 0x5393,0x53B2,0x53DD,0xFA0E,0x549C,0x548A,0x54A9,0x54FF,
- 0x5586,0x5759,0x5765,0x57AC,0x57C8,0x57C7,0xFA0F,0xFA10,
- 0x589E,0x58B2,0x590B,0x5953,0x595B,0x595D,0x5963,0x59A4,
- 0x59BA,0x5B56,0x5BC0,0x752F,0x5BD8,0x5BEC,0x5C1E,0x5CA6,
- 0x5CBA,0x5CF5,0x5D27,0x5D53,0xFA11,0x5D42,0x5D6D,0x5DB8,
- 0x5DB9,0x5DD0,0x5F21,0x5F34,0x5F67,0x5FB7,
-
- /* ku 90 */
- 0x5FDE,0x605D,0x6085,0x608A,0x60DE,0x60D5,0x6120,0x60F2,
- 0x6111,0x6137,0x6130,0x6198,0x6213,0x62A6,0x63F5,0x6460,
- 0x649D,0x64CE,0x654E,0x6600,0x6615,0x663B,0x6609,0x662E,
- 0x661E,0x6624,0x6665,0x6657,0x6659,0xFA12,0x6673,0x6699,
- 0x66A0,0x66B2,0x66BF,0x66FA,0x670E,0xF929,0x6766,0x67BB,
- 0x6852,0x67C0,0x6801,0x6844,0x68CF,0xFA13,0x6968,0xFA14,
- 0x6998,0x69E2,0x6A30,0x6A6B,0x6A46,0x6A73,0x6A7E,0x6AE2,
- 0x6AE4,0x6BD6,0x6C3F,0x6C5C,0x6C86,0x6C6F,0x6CDA,0x6D04,
- 0x6D87,0x6D6F,0x6D96,0x6DAC,0x6DCF,0x6DF8,0x6DF2,0x6DFC,
- 0x6E39,0x6E5C,0x6E27,0x6E3C,0x6EBF,0x6F88,0x6FB5,0x6FF5,
- 0x7005,0x7007,0x7028,0x7085,0x70AB,0x710F,0x7104,0x715C,
- 0x7146,0x7147,0xFA15,0x71C1,0x71FE,0x72B1,
-
- /* ku 91 */
- 0x72BE,0x7324,0xFA16,0x7377,0x73BD,0x73C9,0x73D6,0x73E3,
- 0x73D2,0x7407,0x73F5,0x7426,0x742A,0x7429,0x742E,0x7462,
- 0x7489,0x749F,0x7501,0x756F,0x7682,0x769C,0x769E,0x769B,
- 0x76A6,0xFA17,0x7746,0x52AF,0x7821,0x784E,0x7864,0x787A,
- 0x7930,0xFA18,0xFA19,0xFA1A,0x7994,0xFA1B,0x799B,0x7AD1,
- 0x7AE7,0xFA1C,0x7AEB,0x7B9E,0xFA1D,0x7D48,0x7D5C,0x7DB7,
- 0x7DA0,0x7DD6,0x7E52,0x7F47,0x7FA1,0xFA1E,0x8301,0x8362,
- 0x837F,0x83C7,0x83F6,0x8448,0x84B4,0x8553,0x8559,0x856B,
- 0xFA1F,0x85B0,0xFA20,0xFA21,0x8807,0x88F5,0x8A12,0x8A37,
- 0x8A79,0x8AA7,0x8ABE,0x8ADF,0xFA22,0x8AF6,0x8B53,0x8B7F,
- 0x8CF0,0x8CF4,0x8D12,0x8D76,0xFA23,0x8ECF,0xFA24,0xFA25,
- 0x9067,0x90DE,0xFA26,0x9115,0x9127,0x91DA,
-
- /* ku 92 */
- 0x91D7,0x91DE,0x91ED,0x91EE,0x91E4,0x91E5,0x9206,0x9210,
- 0x920A,0x923A,0x9240,0x923C,0x924E,0x9259,0x9251,0x9239,
- 0x9267,0x92A7,0x9277,0x9278,0x92E7,0x92D7,0x92D9,0x92D0,
- 0xFA27,0x92D5,0x92E0,0x92D3,0x9325,0x9321,0x92FB,0xFA28,
- 0x931E,0x92FF,0x931D,0x9302,0x9370,0x9357,0x93A4,0x93C6,
- 0x93DE,0x93F8,0x9431,0x9445,0x9448,0x9592,0xF9DC,0xFA29,
- 0x969D,0x96AF,0x9733,0x973B,0x9743,0x974D,0x974F,0x9751,
- 0x9755,0x9857,0x9865,0xFA2A,0xFA2B,0x9927,0xFA2C,0x999E,
- 0x9A4E,0x9AD9,0x9ADC,0x9B75,0x9B72,0x9B8F,0x9BB1,0x9BBB,
- 0x9C00,0x9D70,0x9D6B,0xFA2D,0x9E19,0x9ED1,0x0000,0x0000,
- 0x2170,0x2171,0x2172,0x2173,0x2174,0x2175,0x2176,0x2177,
- 0x2178,0x2179,0xFFE2,0xFFE4,0xFF07,0xFF02
-};
-static const int cp932ext2_ucs_table_min = (89 - 1)*94;
-static const int cp932ext2_ucs_table_max = (89 - 1)*94 + (sizeof (cp932ext2_ucs_table) / sizeof (unsigned short));
-
-static const unsigned short cp932ext3_ucs_table[] = {
- /* ku 115 */
- 0x2170,0x2171,0x2172,0x2173,0x2174,0x2175,0x2176,0x2177,
- 0x2178,0x2179,0x2160,0x2161,0x2162,0x2163,0x2164,0x2165,
- 0x2166,0x2167,0x2168,0x2169,0xFFE2,0xFFE4,0xFF07,0xFF02,
- 0x3231,0x2116,0x2121,0x2235,0x7E8A,0x891C,0x9348,0x9288,
- 0x84DC,0x4FC9,0x70BB,0x6631,0x68C8,0x92F9,0x66FB,0x5F45,
- 0x4E28,0x4EE1,0x4EFC,0x4F00,0x4F03,0x4F39,0x4F56,0x4F92,
- 0x4F8A,0x4F9A,0x4F94,0x4FCD,0x5040,0x5022,0x4FFF,0x501E,
- 0x5046,0x5070,0x5042,0x5094,0x50F4,0x50D8,0x514A,0x5164,
- 0x519D,0x51BE,0x51EC,0x5215,0x529C,0x52A6,0x52C0,0x52DB,
- 0x5300,0x5307,0x5324,0x5372,0x5393,0x53B2,0x53DD,0xFA0E,
- 0x549C,0x548A,0x54A9,0x54FF,0x5586,0x5759,0x5765,0x57AC,
- 0x57C8,0x57C7,0xFA0F,0xFA10,0x589E,0x58B2,
-
- /* ku 116 */
- 0x590B,0x5953,0x595B,0x595D,0x5963,0x59A4,0x59BA,0x5B56,
- 0x5BC0,0x752F,0x5BD8,0x5BEC,0x5C1E,0x5CA6,0x5CBA,0x5CF5,
- 0x5D27,0x5D53,0xFA11,0x5D42,0x5D6D,0x5DB8,0x5DB9,0x5DD0,
- 0x5F21,0x5F34,0x5F67,0x5FB7,0x5FDE,0x605D,0x6085,0x608A,
- 0x60DE,0x60D5,0x6120,0x60F2,0x6111,0x6137,0x6130,0x6198,
- 0x6213,0x62A6,0x63F5,0x6460,0x649D,0x64CE,0x654E,0x6600,
- 0x6615,0x663B,0x6609,0x662E,0x661E,0x6624,0x6665,0x6657,
- 0x6659,0xFA12,0x6673,0x6699,0x66A0,0x66B2,0x66BF,0x66FA,
- 0x670E,0xF929,0x6766,0x67BB,0x6852,0x67C0,0x6801,0x6844,
- 0x68CF,0xFA13,0x6968,0xFA14,0x6998,0x69E2,0x6A30,0x6A6B,
- 0x6A46,0x6A73,0x6A7E,0x6AE2,0x6AE4,0x6BD6,0x6C3F,0x6C5C,
- 0x6C86,0x6C6F,0x6CDA,0x6D04,0x6D87,0x6D6F,
-
- /* ku 117 */
- 0x6D96,0x6DAC,0x6DCF,0x6DF8,0x6DF2,0x6DFC,0x6E39,0x6E5C,
- 0x6E27,0x6E3C,0x6EBF,0x6F88,0x6FB5,0x6FF5,0x7005,0x7007,
- 0x7028,0x7085,0x70AB,0x710F,0x7104,0x715C,0x7146,0x7147,
- 0xFA15,0x71C1,0x71FE,0x72B1,0x72BE,0x7324,0xFA16,0x7377,
- 0x73BD,0x73C9,0x73D6,0x73E3,0x73D2,0x7407,0x73F5,0x7426,
- 0x742A,0x7429,0x742E,0x7462,0x7489,0x749F,0x7501,0x756F,
- 0x7682,0x769C,0x769E,0x769B,0x76A6,0xFA17,0x7746,0x52AF,
- 0x7821,0x784E,0x7864,0x787A,0x7930,0xFA18,0xFA19,0xFA1A,
- 0x7994,0xFA1B,0x799B,0x7AD1,0x7AE7,0xFA1C,0x7AEB,0x7B9E,
- 0xFA1D,0x7D48,0x7D5C,0x7DB7,0x7DA0,0x7DD6,0x7E52,0x7F47,
- 0x7FA1,0xFA1E,0x8301,0x8362,0x837F,0x83C7,0x83F6,0x8448,
- 0x84B4,0x8553,0x8559,0x856B,0xFA1F,0x85B0,
-
- /* ku 118 */
- 0xFA20,0xFA21,0x8807,0x88F5,0x8A12,0x8A37,0x8A79,0x8AA7,
- 0x8ABE,0x8ADF,0xFA22,0x8AF6,0x8B53,0x8B7F,0x8CF0,0x8CF4,
- 0x8D12,0x8D76,0xFA23,0x8ECF,0xFA24,0xFA25,0x9067,0x90DE,
- 0xFA26,0x9115,0x9127,0x91DA,0x91D7,0x91DE,0x91ED,0x91EE,
- 0x91E4,0x91E5,0x9206,0x9210,0x920A,0x923A,0x9240,0x923C,
- 0x924E,0x9259,0x9251,0x9239,0x9267,0x92A7,0x9277,0x9278,
- 0x92E7,0x92D7,0x92D9,0x92D0,0xFA27,0x92D5,0x92E0,0x92D3,
- 0x9325,0x9321,0x92FB,0xFA28,0x931E,0x92FF,0x931D,0x9302,
- 0x9370,0x9357,0x93A4,0x93C6,0x93DE,0x93F8,0x9431,0x9445,
- 0x9448,0x9592,0xF9DC,0xFA29,0x969D,0x96AF,0x9733,0x973B,
- 0x9743,0x974D,0x974F,0x9751,0x9755,0x9857,0x9865,0xFA2A,
- 0xFA2B,0x9927,0xFA2C,0x999E,0x9A4E,0x9AD9,
-
- /* ku 119 */
- 0x9ADC,0x9B75,0x9B72,0x9B8F,0x9BB1,0x9BBB,0x9C00,0x9D70,
- 0x9D6B,0xFA2D,0x9E19,0x9ED1
-};
-static const int cp932ext3_ucs_table_min = (115 - 1)*94;
-static const int cp932ext3_ucs_table_max = (115 - 1)*94 + (sizeof (cp932ext3_ucs_table) / sizeof (unsigned short));
-
-
-static const unsigned short jisx0212_ucs_table[] = {
- /* ku 1 */
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-
- /* ku 2 */
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x02D8,0x02C7,
- 0x00B8,0x02D9,0x02DD,0x00AF,0x02DB,0x02DA,0x007E,0x0384,
- 0x0385,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x00A1,0x00A6,0x00BF,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x00BA,0x00AA,0x00A9,0x00AE,0x2122,0x00A4,
- 0x2116,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-
- /* ku 3 */
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-
- /* ku 4 */
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-
- /* ku 5 */
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-
- /* ku 6 */
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0386,0x0388,0x0389,0x038A,0x03AA,0x0000,0x038C,0x0000,
- 0x038E,0x03AB,0x0000,0x038F,0x0000,0x0000,0x0000,0x0000,
- 0x03AC,0x03AD,0x03AE,0x03AF,0x03CA,0x0390,0x03CC,0x03C2,
- 0x03CD,0x03CB,0x03B0,0x03CE,0x0000,0x0000,
-
- /* ku 7 */
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0402,0x0403,0x0404,0x0405,0x0406,0x0407,0x0408,
- 0x0409,0x040A,0x040B,0x040C,0x040E,0x040F,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0452,0x0453,0x0454,0x0455,0x0456,0x0457,0x0458,
- 0x0459,0x045A,0x045B,0x045C,0x045E,0x045F,
-
- /* ku 8 */
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-
- /* ku 9 */
- 0x00C6,0x0110,0x0000,0x0126,0x0000,0x0132,0x0000,0x0141,
- 0x013F,0x0000,0x014A,0x00D8,0x0152,0x0000,0x0166,0x00DE,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x00E6,0x0111,0x00F0,0x0127,0x0131,0x0133,0x0138,0x0142,
- 0x0140,0x0149,0x014B,0x00F8,0x0153,0x00DF,0x0167,0x00FE,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-
- /* ku 10 */
- 0x00C1,0x00C0,0x00C4,0x00C2,0x0102,0x01CD,0x0100,0x0104,
- 0x00C5,0x00C3,0x0106,0x0108,0x010C,0x00C7,0x010A,0x010E,
- 0x00C9,0x00C8,0x00CB,0x00CA,0x011A,0x0116,0x0112,0x0118,
- 0x0000,0x011C,0x011E,0x0122,0x0120,0x0124,0x00CD,0x00CC,
- 0x00CF,0x00CE,0x01CF,0x0130,0x012A,0x012E,0x0128,0x0134,
- 0x0136,0x0139,0x013D,0x013B,0x0143,0x0147,0x0145,0x00D1,
- 0x00D3,0x00D2,0x00D6,0x00D4,0x01D1,0x0150,0x014C,0x00D5,
- 0x0154,0x0158,0x0156,0x015A,0x015C,0x0160,0x015E,0x0164,
- 0x0162,0x00DA,0x00D9,0x00DC,0x00DB,0x016C,0x01D3,0x0170,
- 0x016A,0x0172,0x016E,0x0168,0x01D7,0x01DB,0x01D9,0x01D5,
- 0x0174,0x00DD,0x0178,0x0176,0x0179,0x017D,0x017B,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-
- /* ku 11 */
- 0x00E1,0x00E0,0x00E4,0x00E2,0x0103,0x01CE,0x0101,0x0105,
- 0x00E5,0x00E3,0x0107,0x0109,0x010D,0x00E7,0x010B,0x010F,
- 0x00E9,0x00E8,0x00EB,0x00EA,0x011B,0x0117,0x0113,0x0119,
- 0x01F5,0x011D,0x011F,0x0000,0x0121,0x0125,0x00ED,0x00EC,
- 0x00EF,0x00EE,0x01D0,0x0000,0x012B,0x012F,0x0129,0x0135,
- 0x0137,0x013A,0x013E,0x013C,0x0144,0x0148,0x0146,0x00F1,
- 0x00F3,0x00F2,0x00F6,0x00F4,0x01D2,0x0151,0x014D,0x00F5,
- 0x0155,0x0159,0x0157,0x015B,0x015D,0x0161,0x015F,0x0165,
- 0x0163,0x00FA,0x00F9,0x00FC,0x00FB,0x016D,0x01D4,0x0171,
- 0x016B,0x0173,0x016F,0x0169,0x01D8,0x01DC,0x01DA,0x01D6,
- 0x0175,0x00FD,0x00FF,0x0177,0x017A,0x017E,0x017C,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-
- /* ku 12 */
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-
- /* ku 13 */
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-
- /* ku 14 */
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-
- /* ku 15 */
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-
- /* ku 16 */
- 0x4E02,0x4E04,0x4E05,0x4E0C,0x4E12,0x4E1F,0x4E23,0x4E24,
- 0x4E28,0x4E2B,0x4E2E,0x4E2F,0x4E30,0x4E35,0x4E40,0x4E41,
- 0x4E44,0x4E47,0x4E51,0x4E5A,0x4E5C,0x4E63,0x4E68,0x4E69,
- 0x4E74,0x4E75,0x4E79,0x4E7F,0x4E8D,0x4E96,0x4E97,0x4E9D,
- 0x4EAF,0x4EB9,0x4EC3,0x4ED0,0x4EDA,0x4EDB,0x4EE0,0x4EE1,
- 0x4EE2,0x4EE8,0x4EEF,0x4EF1,0x4EF3,0x4EF5,0x4EFD,0x4EFE,
- 0x4EFF,0x4F00,0x4F02,0x4F03,0x4F08,0x4F0B,0x4F0C,0x4F12,
- 0x4F15,0x4F16,0x4F17,0x4F19,0x4F2E,0x4F31,0x4F60,0x4F33,
- 0x4F35,0x4F37,0x4F39,0x4F3B,0x4F3E,0x4F40,0x4F42,0x4F48,
- 0x4F49,0x4F4B,0x4F4C,0x4F52,0x4F54,0x4F56,0x4F58,0x4F5F,
- 0x4F63,0x4F6A,0x4F6C,0x4F6E,0x4F71,0x4F77,0x4F78,0x4F79,
- 0x4F7A,0x4F7D,0x4F7E,0x4F81,0x4F82,0x4F84,
-
- /* ku 17 */
- 0x4F85,0x4F89,0x4F8A,0x4F8C,0x4F8E,0x4F90,0x4F92,0x4F93,
- 0x4F94,0x4F97,0x4F99,0x4F9A,0x4F9E,0x4F9F,0x4FB2,0x4FB7,
- 0x4FB9,0x4FBB,0x4FBC,0x4FBD,0x4FBE,0x4FC0,0x4FC1,0x4FC5,
- 0x4FC6,0x4FC8,0x4FC9,0x4FCB,0x4FCC,0x4FCD,0x4FCF,0x4FD2,
- 0x4FDC,0x4FE0,0x4FE2,0x4FF0,0x4FF2,0x4FFC,0x4FFD,0x4FFF,
- 0x5000,0x5001,0x5004,0x5007,0x500A,0x500C,0x500E,0x5010,
- 0x5013,0x5017,0x5018,0x501B,0x501C,0x501D,0x501E,0x5022,
- 0x5027,0x502E,0x5030,0x5032,0x5033,0x5035,0x5040,0x5041,
- 0x5042,0x5045,0x5046,0x504A,0x504C,0x504E,0x5051,0x5052,
- 0x5053,0x5057,0x5059,0x505F,0x5060,0x5062,0x5063,0x5066,
- 0x5067,0x506A,0x506D,0x5070,0x5071,0x503B,0x5081,0x5083,
- 0x5084,0x5086,0x508A,0x508E,0x508F,0x5090,
-
- /* ku 18 */
- 0x5092,0x5093,0x5094,0x5096,0x509B,0x509C,0x509E,0x509F,
- 0x50A0,0x50A1,0x50A2,0x50AA,0x50AF,0x50B0,0x50B9,0x50BA,
- 0x50BD,0x50C0,0x50C3,0x50C4,0x50C7,0x50CC,0x50CE,0x50D0,
- 0x50D3,0x50D4,0x50D8,0x50DC,0x50DD,0x50DF,0x50E2,0x50E4,
- 0x50E6,0x50E8,0x50E9,0x50EF,0x50F1,0x50F6,0x50FA,0x50FE,
- 0x5103,0x5106,0x5107,0x5108,0x510B,0x510C,0x510D,0x510E,
- 0x50F2,0x5110,0x5117,0x5119,0x511B,0x511C,0x511D,0x511E,
- 0x5123,0x5127,0x5128,0x512C,0x512D,0x512F,0x5131,0x5133,
- 0x5134,0x5135,0x5138,0x5139,0x5142,0x514A,0x514F,0x5153,
- 0x5155,0x5157,0x5158,0x515F,0x5164,0x5166,0x517E,0x5183,
- 0x5184,0x518B,0x518E,0x5198,0x519D,0x51A1,0x51A3,0x51AD,
- 0x51B8,0x51BA,0x51BC,0x51BE,0x51BF,0x51C2,
-
- /* ku 19 */
- 0x51C8,0x51CF,0x51D1,0x51D2,0x51D3,0x51D5,0x51D8,0x51DE,
- 0x51E2,0x51E5,0x51EE,0x51F2,0x51F3,0x51F4,0x51F7,0x5201,
- 0x5202,0x5205,0x5212,0x5213,0x5215,0x5216,0x5218,0x5222,
- 0x5228,0x5231,0x5232,0x5235,0x523C,0x5245,0x5249,0x5255,
- 0x5257,0x5258,0x525A,0x525C,0x525F,0x5260,0x5261,0x5266,
- 0x526E,0x5277,0x5278,0x5279,0x5280,0x5282,0x5285,0x528A,
- 0x528C,0x5293,0x5295,0x5296,0x5297,0x5298,0x529A,0x529C,
- 0x52A4,0x52A5,0x52A6,0x52A7,0x52AF,0x52B0,0x52B6,0x52B7,
- 0x52B8,0x52BA,0x52BB,0x52BD,0x52C0,0x52C4,0x52C6,0x52C8,
- 0x52CC,0x52CF,0x52D1,0x52D4,0x52D6,0x52DB,0x52DC,0x52E1,
- 0x52E5,0x52E8,0x52E9,0x52EA,0x52EC,0x52F0,0x52F1,0x52F4,
- 0x52F6,0x52F7,0x5300,0x5303,0x530A,0x530B,
-
- /* ku 20 */
- 0x530C,0x5311,0x5313,0x5318,0x531B,0x531C,0x531E,0x531F,
- 0x5325,0x5327,0x5328,0x5329,0x532B,0x532C,0x532D,0x5330,
- 0x5332,0x5335,0x533C,0x533D,0x533E,0x5342,0x534C,0x534B,
- 0x5359,0x535B,0x5361,0x5363,0x5365,0x536C,0x536D,0x5372,
- 0x5379,0x537E,0x5383,0x5387,0x5388,0x538E,0x5393,0x5394,
- 0x5399,0x539D,0x53A1,0x53A4,0x53AA,0x53AB,0x53AF,0x53B2,
- 0x53B4,0x53B5,0x53B7,0x53B8,0x53BA,0x53BD,0x53C0,0x53C5,
- 0x53CF,0x53D2,0x53D3,0x53D5,0x53DA,0x53DD,0x53DE,0x53E0,
- 0x53E6,0x53E7,0x53F5,0x5402,0x5413,0x541A,0x5421,0x5427,
- 0x5428,0x542A,0x542F,0x5431,0x5434,0x5435,0x5443,0x5444,
- 0x5447,0x544D,0x544F,0x545E,0x5462,0x5464,0x5466,0x5467,
- 0x5469,0x546B,0x546D,0x546E,0x5474,0x547F,
-
- /* ku 21 */
- 0x5481,0x5483,0x5485,0x5488,0x5489,0x548D,0x5491,0x5495,
- 0x5496,0x549C,0x549F,0x54A1,0x54A6,0x54A7,0x54A9,0x54AA,
- 0x54AD,0x54AE,0x54B1,0x54B7,0x54B9,0x54BA,0x54BB,0x54BF,
- 0x54C6,0x54CA,0x54CD,0x54CE,0x54E0,0x54EA,0x54EC,0x54EF,
- 0x54F6,0x54FC,0x54FE,0x54FF,0x5500,0x5501,0x5505,0x5508,
- 0x5509,0x550C,0x550D,0x550E,0x5515,0x552A,0x552B,0x5532,
- 0x5535,0x5536,0x553B,0x553C,0x553D,0x5541,0x5547,0x5549,
- 0x554A,0x554D,0x5550,0x5551,0x5558,0x555A,0x555B,0x555E,
- 0x5560,0x5561,0x5564,0x5566,0x557F,0x5581,0x5582,0x5586,
- 0x5588,0x558E,0x558F,0x5591,0x5592,0x5593,0x5594,0x5597,
- 0x55A3,0x55A4,0x55AD,0x55B2,0x55BF,0x55C1,0x55C3,0x55C6,
- 0x55C9,0x55CB,0x55CC,0x55CE,0x55D1,0x55D2,
-
- /* ku 22 */
- 0x55D3,0x55D7,0x55D8,0x55DB,0x55DE,0x55E2,0x55E9,0x55F6,
- 0x55FF,0x5605,0x5608,0x560A,0x560D,0x560E,0x560F,0x5610,
- 0x5611,0x5612,0x5619,0x562C,0x5630,0x5633,0x5635,0x5637,
- 0x5639,0x563B,0x563C,0x563D,0x563F,0x5640,0x5641,0x5643,
- 0x5644,0x5646,0x5649,0x564B,0x564D,0x564F,0x5654,0x565E,
- 0x5660,0x5661,0x5662,0x5663,0x5666,0x5669,0x566D,0x566F,
- 0x5671,0x5672,0x5675,0x5684,0x5685,0x5688,0x568B,0x568C,
- 0x5695,0x5699,0x569A,0x569D,0x569E,0x569F,0x56A6,0x56A7,
- 0x56A8,0x56A9,0x56AB,0x56AC,0x56AD,0x56B1,0x56B3,0x56B7,
- 0x56BE,0x56C5,0x56C9,0x56CA,0x56CB,0x56CF,0x56D0,0x56CC,
- 0x56CD,0x56D9,0x56DC,0x56DD,0x56DF,0x56E1,0x56E4,0x56E5,
- 0x56E6,0x56E7,0x56E8,0x56F1,0x56EB,0x56ED,
-
- /* ku 23 */
- 0x56F6,0x56F7,0x5701,0x5702,0x5707,0x570A,0x570C,0x5711,
- 0x5715,0x571A,0x571B,0x571D,0x5720,0x5722,0x5723,0x5724,
- 0x5725,0x5729,0x572A,0x572C,0x572E,0x572F,0x5733,0x5734,
- 0x573D,0x573E,0x573F,0x5745,0x5746,0x574C,0x574D,0x5752,
- 0x5762,0x5765,0x5767,0x5768,0x576B,0x576D,0x576E,0x576F,
- 0x5770,0x5771,0x5773,0x5774,0x5775,0x5777,0x5779,0x577A,
- 0x577B,0x577C,0x577E,0x5781,0x5783,0x578C,0x5794,0x5797,
- 0x5799,0x579A,0x579C,0x579D,0x579E,0x579F,0x57A1,0x5795,
- 0x57A7,0x57A8,0x57A9,0x57AC,0x57B8,0x57BD,0x57C7,0x57C8,
- 0x57CC,0x57CF,0x57D5,0x57DD,0x57DE,0x57E4,0x57E6,0x57E7,
- 0x57E9,0x57ED,0x57F0,0x57F5,0x57F6,0x57F8,0x57FD,0x57FE,
- 0x57FF,0x5803,0x5804,0x5808,0x5809,0x57E1,
-
- /* ku 24 */
- 0x580C,0x580D,0x581B,0x581E,0x581F,0x5820,0x5826,0x5827,
- 0x582D,0x5832,0x5839,0x583F,0x5849,0x584C,0x584D,0x584F,
- 0x5850,0x5855,0x585F,0x5861,0x5864,0x5867,0x5868,0x5878,
- 0x587C,0x587F,0x5880,0x5881,0x5887,0x5888,0x5889,0x588A,
- 0x588C,0x588D,0x588F,0x5890,0x5894,0x5896,0x589D,0x58A0,
- 0x58A1,0x58A2,0x58A6,0x58A9,0x58B1,0x58B2,0x58C4,0x58BC,
- 0x58C2,0x58C8,0x58CD,0x58CE,0x58D0,0x58D2,0x58D4,0x58D6,
- 0x58DA,0x58DD,0x58E1,0x58E2,0x58E9,0x58F3,0x5905,0x5906,
- 0x590B,0x590C,0x5912,0x5913,0x5914,0x8641,0x591D,0x5921,
- 0x5923,0x5924,0x5928,0x592F,0x5930,0x5933,0x5935,0x5936,
- 0x593F,0x5943,0x5946,0x5952,0x5953,0x5959,0x595B,0x595D,
- 0x595E,0x595F,0x5961,0x5963,0x596B,0x596D,
-
- /* ku 25 */
- 0x596F,0x5972,0x5975,0x5976,0x5979,0x597B,0x597C,0x598B,
- 0x598C,0x598E,0x5992,0x5995,0x5997,0x599F,0x59A4,0x59A7,
- 0x59AD,0x59AE,0x59AF,0x59B0,0x59B3,0x59B7,0x59BA,0x59BC,
- 0x59C1,0x59C3,0x59C4,0x59C8,0x59CA,0x59CD,0x59D2,0x59DD,
- 0x59DE,0x59DF,0x59E3,0x59E4,0x59E7,0x59EE,0x59EF,0x59F1,
- 0x59F2,0x59F4,0x59F7,0x5A00,0x5A04,0x5A0C,0x5A0D,0x5A0E,
- 0x5A12,0x5A13,0x5A1E,0x5A23,0x5A24,0x5A27,0x5A28,0x5A2A,
- 0x5A2D,0x5A30,0x5A44,0x5A45,0x5A47,0x5A48,0x5A4C,0x5A50,
- 0x5A55,0x5A5E,0x5A63,0x5A65,0x5A67,0x5A6D,0x5A77,0x5A7A,
- 0x5A7B,0x5A7E,0x5A8B,0x5A90,0x5A93,0x5A96,0x5A99,0x5A9C,
- 0x5A9E,0x5A9F,0x5AA0,0x5AA2,0x5AA7,0x5AAC,0x5AB1,0x5AB2,
- 0x5AB3,0x5AB5,0x5AB8,0x5ABA,0x5ABB,0x5ABF,
-
- /* ku 26 */
- 0x5AC4,0x5AC6,0x5AC8,0x5ACF,0x5ADA,0x5ADC,0x5AE0,0x5AE5,
- 0x5AEA,0x5AEE,0x5AF5,0x5AF6,0x5AFD,0x5B00,0x5B01,0x5B08,
- 0x5B17,0x5B34,0x5B19,0x5B1B,0x5B1D,0x5B21,0x5B25,0x5B2D,
- 0x5B38,0x5B41,0x5B4B,0x5B4C,0x5B52,0x5B56,0x5B5E,0x5B68,
- 0x5B6E,0x5B6F,0x5B7C,0x5B7D,0x5B7E,0x5B7F,0x5B81,0x5B84,
- 0x5B86,0x5B8A,0x5B8E,0x5B90,0x5B91,0x5B93,0x5B94,0x5B96,
- 0x5BA8,0x5BA9,0x5BAC,0x5BAD,0x5BAF,0x5BB1,0x5BB2,0x5BB7,
- 0x5BBA,0x5BBC,0x5BC0,0x5BC1,0x5BCD,0x5BCF,0x5BD6,0x5BD7,
- 0x5BD8,0x5BD9,0x5BDA,0x5BE0,0x5BEF,0x5BF1,0x5BF4,0x5BFD,
- 0x5C0C,0x5C17,0x5C1E,0x5C1F,0x5C23,0x5C26,0x5C29,0x5C2B,
- 0x5C2C,0x5C2E,0x5C30,0x5C32,0x5C35,0x5C36,0x5C59,0x5C5A,
- 0x5C5C,0x5C62,0x5C63,0x5C67,0x5C68,0x5C69,
-
- /* ku 27 */
- 0x5C6D,0x5C70,0x5C74,0x5C75,0x5C7A,0x5C7B,0x5C7C,0x5C7D,
- 0x5C87,0x5C88,0x5C8A,0x5C8F,0x5C92,0x5C9D,0x5C9F,0x5CA0,
- 0x5CA2,0x5CA3,0x5CA6,0x5CAA,0x5CB2,0x5CB4,0x5CB5,0x5CBA,
- 0x5CC9,0x5CCB,0x5CD2,0x5CDD,0x5CD7,0x5CEE,0x5CF1,0x5CF2,
- 0x5CF4,0x5D01,0x5D06,0x5D0D,0x5D12,0x5D2B,0x5D23,0x5D24,
- 0x5D26,0x5D27,0x5D31,0x5D34,0x5D39,0x5D3D,0x5D3F,0x5D42,
- 0x5D43,0x5D46,0x5D48,0x5D55,0x5D51,0x5D59,0x5D4A,0x5D5F,
- 0x5D60,0x5D61,0x5D62,0x5D64,0x5D6A,0x5D6D,0x5D70,0x5D79,
- 0x5D7A,0x5D7E,0x5D7F,0x5D81,0x5D83,0x5D88,0x5D8A,0x5D92,
- 0x5D93,0x5D94,0x5D95,0x5D99,0x5D9B,0x5D9F,0x5DA0,0x5DA7,
- 0x5DAB,0x5DB0,0x5DB4,0x5DB8,0x5DB9,0x5DC3,0x5DC7,0x5DCB,
- 0x5DD0,0x5DCE,0x5DD8,0x5DD9,0x5DE0,0x5DE4,
-
- /* ku 28 */
- 0x5DE9,0x5DF8,0x5DF9,0x5E00,0x5E07,0x5E0D,0x5E12,0x5E14,
- 0x5E15,0x5E18,0x5E1F,0x5E20,0x5E2E,0x5E28,0x5E32,0x5E35,
- 0x5E3E,0x5E4B,0x5E50,0x5E49,0x5E51,0x5E56,0x5E58,0x5E5B,
- 0x5E5C,0x5E5E,0x5E68,0x5E6A,0x5E6B,0x5E6C,0x5E6D,0x5E6E,
- 0x5E70,0x5E80,0x5E8B,0x5E8E,0x5EA2,0x5EA4,0x5EA5,0x5EA8,
- 0x5EAA,0x5EAC,0x5EB1,0x5EB3,0x5EBD,0x5EBE,0x5EBF,0x5EC6,
- 0x5ECC,0x5ECB,0x5ECE,0x5ED1,0x5ED2,0x5ED4,0x5ED5,0x5EDC,
- 0x5EDE,0x5EE5,0x5EEB,0x5F02,0x5F06,0x5F07,0x5F08,0x5F0E,
- 0x5F19,0x5F1C,0x5F1D,0x5F21,0x5F22,0x5F23,0x5F24,0x5F28,
- 0x5F2B,0x5F2C,0x5F2E,0x5F30,0x5F34,0x5F36,0x5F3B,0x5F3D,
- 0x5F3F,0x5F40,0x5F44,0x5F45,0x5F47,0x5F4D,0x5F50,0x5F54,
- 0x5F58,0x5F5B,0x5F60,0x5F63,0x5F64,0x5F67,
-
- /* ku 29 */
- 0x5F6F,0x5F72,0x5F74,0x5F75,0x5F78,0x5F7A,0x5F7D,0x5F7E,
- 0x5F89,0x5F8D,0x5F8F,0x5F96,0x5F9C,0x5F9D,0x5FA2,0x5FA7,
- 0x5FAB,0x5FA4,0x5FAC,0x5FAF,0x5FB0,0x5FB1,0x5FB8,0x5FC4,
- 0x5FC7,0x5FC8,0x5FC9,0x5FCB,0x5FD0,0x5FD1,0x5FD2,0x5FD3,
- 0x5FD4,0x5FDE,0x5FE1,0x5FE2,0x5FE8,0x5FE9,0x5FEA,0x5FEC,
- 0x5FED,0x5FEE,0x5FEF,0x5FF2,0x5FF3,0x5FF6,0x5FFA,0x5FFC,
- 0x6007,0x600A,0x600D,0x6013,0x6014,0x6017,0x6018,0x601A,
- 0x601F,0x6024,0x602D,0x6033,0x6035,0x6040,0x6047,0x6048,
- 0x6049,0x604C,0x6051,0x6054,0x6056,0x6057,0x605D,0x6061,
- 0x6067,0x6071,0x607E,0x607F,0x6082,0x6086,0x6088,0x608A,
- 0x608E,0x6091,0x6093,0x6095,0x6098,0x609D,0x609E,0x60A2,
- 0x60A4,0x60A5,0x60A8,0x60B0,0x60B1,0x60B7,
-
- /* ku 30 */
- 0x60BB,0x60BE,0x60C2,0x60C4,0x60C8,0x60C9,0x60CA,0x60CB,
- 0x60CE,0x60CF,0x60D4,0x60D5,0x60D9,0x60DB,0x60DD,0x60DE,
- 0x60E2,0x60E5,0x60F2,0x60F5,0x60F8,0x60FC,0x60FD,0x6102,
- 0x6107,0x610A,0x610C,0x6110,0x6111,0x6112,0x6113,0x6114,
- 0x6116,0x6117,0x6119,0x611C,0x611E,0x6122,0x612A,0x612B,
- 0x6130,0x6131,0x6135,0x6136,0x6137,0x6139,0x6141,0x6145,
- 0x6146,0x6149,0x615E,0x6160,0x616C,0x6172,0x6178,0x617B,
- 0x617C,0x617F,0x6180,0x6181,0x6183,0x6184,0x618B,0x618D,
- 0x6192,0x6193,0x6197,0x6198,0x619C,0x619D,0x619F,0x61A0,
- 0x61A5,0x61A8,0x61AA,0x61AD,0x61B8,0x61B9,0x61BC,0x61C0,
- 0x61C1,0x61C2,0x61CE,0x61CF,0x61D5,0x61DC,0x61DD,0x61DE,
- 0x61DF,0x61E1,0x61E2,0x61E7,0x61E9,0x61E5,
-
- /* ku 31 */
- 0x61EC,0x61ED,0x61EF,0x6201,0x6203,0x6204,0x6207,0x6213,
- 0x6215,0x621C,0x6220,0x6222,0x6223,0x6227,0x6229,0x622B,
- 0x6239,0x623D,0x6242,0x6243,0x6244,0x6246,0x624C,0x6250,
- 0x6251,0x6252,0x6254,0x6256,0x625A,0x625C,0x6264,0x626D,
- 0x626F,0x6273,0x627A,0x627D,0x628D,0x628E,0x628F,0x6290,
- 0x62A6,0x62A8,0x62B3,0x62B6,0x62B7,0x62BA,0x62BE,0x62BF,
- 0x62C4,0x62CE,0x62D5,0x62D6,0x62DA,0x62EA,0x62F2,0x62F4,
- 0x62FC,0x62FD,0x6303,0x6304,0x630A,0x630B,0x630D,0x6310,
- 0x6313,0x6316,0x6318,0x6329,0x632A,0x632D,0x6335,0x6336,
- 0x6339,0x633C,0x6341,0x6342,0x6343,0x6344,0x6346,0x634A,
- 0x634B,0x634E,0x6352,0x6353,0x6354,0x6358,0x635B,0x6365,
- 0x6366,0x636C,0x636D,0x6371,0x6374,0x6375,
-
- /* ku 32 */
- 0x6378,0x637C,0x637D,0x637F,0x6382,0x6384,0x6387,0x638A,
- 0x6390,0x6394,0x6395,0x6399,0x639A,0x639E,0x63A4,0x63A6,
- 0x63AD,0x63AE,0x63AF,0x63BD,0x63C1,0x63C5,0x63C8,0x63CE,
- 0x63D1,0x63D3,0x63D4,0x63D5,0x63DC,0x63E0,0x63E5,0x63EA,
- 0x63EC,0x63F2,0x63F3,0x63F5,0x63F8,0x63F9,0x6409,0x640A,
- 0x6410,0x6412,0x6414,0x6418,0x641E,0x6420,0x6422,0x6424,
- 0x6425,0x6429,0x642A,0x642F,0x6430,0x6435,0x643D,0x643F,
- 0x644B,0x644F,0x6451,0x6452,0x6453,0x6454,0x645A,0x645B,
- 0x645C,0x645D,0x645F,0x6460,0x6461,0x6463,0x646D,0x6473,
- 0x6474,0x647B,0x647D,0x6485,0x6487,0x648F,0x6490,0x6491,
- 0x6498,0x6499,0x649B,0x649D,0x649F,0x64A1,0x64A3,0x64A6,
- 0x64A8,0x64AC,0x64B3,0x64BD,0x64BE,0x64BF,
-
- /* ku 33 */
- 0x64C4,0x64C9,0x64CA,0x64CB,0x64CC,0x64CE,0x64D0,0x64D1,
- 0x64D5,0x64D7,0x64E4,0x64E5,0x64E9,0x64EA,0x64ED,0x64F0,
- 0x64F5,0x64F7,0x64FB,0x64FF,0x6501,0x6504,0x6508,0x6509,
- 0x650A,0x650F,0x6513,0x6514,0x6516,0x6519,0x651B,0x651E,
- 0x651F,0x6522,0x6526,0x6529,0x652E,0x6531,0x653A,0x653C,
- 0x653D,0x6543,0x6547,0x6549,0x6550,0x6552,0x6554,0x655F,
- 0x6560,0x6567,0x656B,0x657A,0x657D,0x6581,0x6585,0x658A,
- 0x6592,0x6595,0x6598,0x659D,0x65A0,0x65A3,0x65A6,0x65AE,
- 0x65B2,0x65B3,0x65B4,0x65BF,0x65C2,0x65C8,0x65C9,0x65CE,
- 0x65D0,0x65D4,0x65D6,0x65D8,0x65DF,0x65F0,0x65F2,0x65F4,
- 0x65F5,0x65F9,0x65FE,0x65FF,0x6600,0x6604,0x6608,0x6609,
- 0x660D,0x6611,0x6612,0x6615,0x6616,0x661D,
-
- /* ku 34 */
- 0x661E,0x6621,0x6622,0x6623,0x6624,0x6626,0x6629,0x662A,
- 0x662B,0x662C,0x662E,0x6630,0x6631,0x6633,0x6639,0x6637,
- 0x6640,0x6645,0x6646,0x664A,0x664C,0x6651,0x664E,0x6657,
- 0x6658,0x6659,0x665B,0x665C,0x6660,0x6661,0x66FB,0x666A,
- 0x666B,0x666C,0x667E,0x6673,0x6675,0x667F,0x6677,0x6678,
- 0x6679,0x667B,0x6680,0x667C,0x668B,0x668C,0x668D,0x6690,
- 0x6692,0x6699,0x669A,0x669B,0x669C,0x669F,0x66A0,0x66A4,
- 0x66AD,0x66B1,0x66B2,0x66B5,0x66BB,0x66BF,0x66C0,0x66C2,
- 0x66C3,0x66C8,0x66CC,0x66CE,0x66CF,0x66D4,0x66DB,0x66DF,
- 0x66E8,0x66EB,0x66EC,0x66EE,0x66FA,0x6705,0x6707,0x670E,
- 0x6713,0x6719,0x671C,0x6720,0x6722,0x6733,0x673E,0x6745,
- 0x6747,0x6748,0x674C,0x6754,0x6755,0x675D,
-
- /* ku 35 */
- 0x6766,0x676C,0x676E,0x6774,0x6776,0x677B,0x6781,0x6784,
- 0x678E,0x678F,0x6791,0x6793,0x6796,0x6798,0x6799,0x679B,
- 0x67B0,0x67B1,0x67B2,0x67B5,0x67BB,0x67BC,0x67BD,0x67F9,
- 0x67C0,0x67C2,0x67C3,0x67C5,0x67C8,0x67C9,0x67D2,0x67D7,
- 0x67D9,0x67DC,0x67E1,0x67E6,0x67F0,0x67F2,0x67F6,0x67F7,
- 0x6852,0x6814,0x6819,0x681D,0x681F,0x6828,0x6827,0x682C,
- 0x682D,0x682F,0x6830,0x6831,0x6833,0x683B,0x683F,0x6844,
- 0x6845,0x684A,0x684C,0x6855,0x6857,0x6858,0x685B,0x686B,
- 0x686E,0x686F,0x6870,0x6871,0x6872,0x6875,0x6879,0x687A,
- 0x687B,0x687C,0x6882,0x6884,0x6886,0x6888,0x6896,0x6898,
- 0x689A,0x689C,0x68A1,0x68A3,0x68A5,0x68A9,0x68AA,0x68AE,
- 0x68B2,0x68BB,0x68C5,0x68C8,0x68CC,0x68CF,
-
- /* ku 36 */
- 0x68D0,0x68D1,0x68D3,0x68D6,0x68D9,0x68DC,0x68DD,0x68E5,
- 0x68E8,0x68EA,0x68EB,0x68EC,0x68ED,0x68F0,0x68F1,0x68F5,
- 0x68F6,0x68FB,0x68FC,0x68FD,0x6906,0x6909,0x690A,0x6910,
- 0x6911,0x6913,0x6916,0x6917,0x6931,0x6933,0x6935,0x6938,
- 0x693B,0x6942,0x6945,0x6949,0x694E,0x6957,0x695B,0x6963,
- 0x6964,0x6965,0x6966,0x6968,0x6969,0x696C,0x6970,0x6971,
- 0x6972,0x697A,0x697B,0x697F,0x6980,0x698D,0x6992,0x6996,
- 0x6998,0x69A1,0x69A5,0x69A6,0x69A8,0x69AB,0x69AD,0x69AF,
- 0x69B7,0x69B8,0x69BA,0x69BC,0x69C5,0x69C8,0x69D1,0x69D6,
- 0x69D7,0x69E2,0x69E5,0x69EE,0x69EF,0x69F1,0x69F3,0x69F5,
- 0x69FE,0x6A00,0x6A01,0x6A03,0x6A0F,0x6A11,0x6A15,0x6A1A,
- 0x6A1D,0x6A20,0x6A24,0x6A28,0x6A30,0x6A32,
-
- /* ku 37 */
- 0x6A34,0x6A37,0x6A3B,0x6A3E,0x6A3F,0x6A45,0x6A46,0x6A49,
- 0x6A4A,0x6A4E,0x6A50,0x6A51,0x6A52,0x6A55,0x6A56,0x6A5B,
- 0x6A64,0x6A67,0x6A6A,0x6A71,0x6A73,0x6A7E,0x6A81,0x6A83,
- 0x6A86,0x6A87,0x6A89,0x6A8B,0x6A91,0x6A9B,0x6A9D,0x6A9E,
- 0x6A9F,0x6AA5,0x6AAB,0x6AAF,0x6AB0,0x6AB1,0x6AB4,0x6ABD,
- 0x6ABE,0x6ABF,0x6AC6,0x6AC9,0x6AC8,0x6ACC,0x6AD0,0x6AD4,
- 0x6AD5,0x6AD6,0x6ADC,0x6ADD,0x6AE4,0x6AE7,0x6AEC,0x6AF0,
- 0x6AF1,0x6AF2,0x6AFC,0x6AFD,0x6B02,0x6B03,0x6B06,0x6B07,
- 0x6B09,0x6B0F,0x6B10,0x6B11,0x6B17,0x6B1B,0x6B1E,0x6B24,
- 0x6B28,0x6B2B,0x6B2C,0x6B2F,0x6B35,0x6B36,0x6B3B,0x6B3F,
- 0x6B46,0x6B4A,0x6B4D,0x6B52,0x6B56,0x6B58,0x6B5D,0x6B60,
- 0x6B67,0x6B6B,0x6B6E,0x6B70,0x6B75,0x6B7D,
-
- /* ku 38 */
- 0x6B7E,0x6B82,0x6B85,0x6B97,0x6B9B,0x6B9F,0x6BA0,0x6BA2,
- 0x6BA3,0x6BA8,0x6BA9,0x6BAC,0x6BAD,0x6BAE,0x6BB0,0x6BB8,
- 0x6BB9,0x6BBD,0x6BBE,0x6BC3,0x6BC4,0x6BC9,0x6BCC,0x6BD6,
- 0x6BDA,0x6BE1,0x6BE3,0x6BE6,0x6BE7,0x6BEE,0x6BF1,0x6BF7,
- 0x6BF9,0x6BFF,0x6C02,0x6C04,0x6C05,0x6C09,0x6C0D,0x6C0E,
- 0x6C10,0x6C12,0x6C19,0x6C1F,0x6C26,0x6C27,0x6C28,0x6C2C,
- 0x6C2E,0x6C33,0x6C35,0x6C36,0x6C3A,0x6C3B,0x6C3F,0x6C4A,
- 0x6C4B,0x6C4D,0x6C4F,0x6C52,0x6C54,0x6C59,0x6C5B,0x6C5C,
- 0x6C6B,0x6C6D,0x6C6F,0x6C74,0x6C76,0x6C78,0x6C79,0x6C7B,
- 0x6C85,0x6C86,0x6C87,0x6C89,0x6C94,0x6C95,0x6C97,0x6C98,
- 0x6C9C,0x6C9F,0x6CB0,0x6CB2,0x6CB4,0x6CC2,0x6CC6,0x6CCD,
- 0x6CCF,0x6CD0,0x6CD1,0x6CD2,0x6CD4,0x6CD6,
-
- /* ku 39 */
- 0x6CDA,0x6CDC,0x6CE0,0x6CE7,0x6CE9,0x6CEB,0x6CEC,0x6CEE,
- 0x6CF2,0x6CF4,0x6D04,0x6D07,0x6D0A,0x6D0E,0x6D0F,0x6D11,
- 0x6D13,0x6D1A,0x6D26,0x6D27,0x6D28,0x6C67,0x6D2E,0x6D2F,
- 0x6D31,0x6D39,0x6D3C,0x6D3F,0x6D57,0x6D5E,0x6D5F,0x6D61,
- 0x6D65,0x6D67,0x6D6F,0x6D70,0x6D7C,0x6D82,0x6D87,0x6D91,
- 0x6D92,0x6D94,0x6D96,0x6D97,0x6D98,0x6DAA,0x6DAC,0x6DB4,
- 0x6DB7,0x6DB9,0x6DBD,0x6DBF,0x6DC4,0x6DC8,0x6DCA,0x6DCE,
- 0x6DCF,0x6DD6,0x6DDB,0x6DDD,0x6DDF,0x6DE0,0x6DE2,0x6DE5,
- 0x6DE9,0x6DEF,0x6DF0,0x6DF4,0x6DF6,0x6DFC,0x6E00,0x6E04,
- 0x6E1E,0x6E22,0x6E27,0x6E32,0x6E36,0x6E39,0x6E3B,0x6E3C,
- 0x6E44,0x6E45,0x6E48,0x6E49,0x6E4B,0x6E4F,0x6E51,0x6E52,
- 0x6E53,0x6E54,0x6E57,0x6E5C,0x6E5D,0x6E5E,
-
- /* ku 40 */
- 0x6E62,0x6E63,0x6E68,0x6E73,0x6E7B,0x6E7D,0x6E8D,0x6E93,
- 0x6E99,0x6EA0,0x6EA7,0x6EAD,0x6EAE,0x6EB1,0x6EB3,0x6EBB,
- 0x6EBF,0x6EC0,0x6EC1,0x6EC3,0x6EC7,0x6EC8,0x6ECA,0x6ECD,
- 0x6ECE,0x6ECF,0x6EEB,0x6EED,0x6EEE,0x6EF9,0x6EFB,0x6EFD,
- 0x6F04,0x6F08,0x6F0A,0x6F0C,0x6F0D,0x6F16,0x6F18,0x6F1A,
- 0x6F1B,0x6F26,0x6F29,0x6F2A,0x6F2F,0x6F30,0x6F33,0x6F36,
- 0x6F3B,0x6F3C,0x6F2D,0x6F4F,0x6F51,0x6F52,0x6F53,0x6F57,
- 0x6F59,0x6F5A,0x6F5D,0x6F5E,0x6F61,0x6F62,0x6F68,0x6F6C,
- 0x6F7D,0x6F7E,0x6F83,0x6F87,0x6F88,0x6F8B,0x6F8C,0x6F8D,
- 0x6F90,0x6F92,0x6F93,0x6F94,0x6F96,0x6F9A,0x6F9F,0x6FA0,
- 0x6FA5,0x6FA6,0x6FA7,0x6FA8,0x6FAE,0x6FAF,0x6FB0,0x6FB5,
- 0x6FB6,0x6FBC,0x6FC5,0x6FC7,0x6FC8,0x6FCA,
-
- /* ku 41 */
- 0x6FDA,0x6FDE,0x6FE8,0x6FE9,0x6FF0,0x6FF5,0x6FF9,0x6FFC,
- 0x6FFD,0x7000,0x7005,0x7006,0x7007,0x700D,0x7017,0x7020,
- 0x7023,0x702F,0x7034,0x7037,0x7039,0x703C,0x7043,0x7044,
- 0x7048,0x7049,0x704A,0x704B,0x7054,0x7055,0x705D,0x705E,
- 0x704E,0x7064,0x7065,0x706C,0x706E,0x7075,0x7076,0x707E,
- 0x7081,0x7085,0x7086,0x7094,0x7095,0x7096,0x7097,0x7098,
- 0x709B,0x70A4,0x70AB,0x70B0,0x70B1,0x70B4,0x70B7,0x70CA,
- 0x70D1,0x70D3,0x70D4,0x70D5,0x70D6,0x70D8,0x70DC,0x70E4,
- 0x70FA,0x7103,0x7104,0x7105,0x7106,0x7107,0x710B,0x710C,
- 0x710F,0x711E,0x7120,0x712B,0x712D,0x712F,0x7130,0x7131,
- 0x7138,0x7141,0x7145,0x7146,0x7147,0x714A,0x714B,0x7150,
- 0x7152,0x7157,0x715A,0x715C,0x715E,0x7160,
-
- /* ku 42 */
- 0x7168,0x7179,0x7180,0x7185,0x7187,0x718C,0x7192,0x719A,
- 0x719B,0x71A0,0x71A2,0x71AF,0x71B0,0x71B2,0x71B3,0x71BA,
- 0x71BF,0x71C0,0x71C1,0x71C4,0x71CB,0x71CC,0x71D3,0x71D6,
- 0x71D9,0x71DA,0x71DC,0x71F8,0x71FE,0x7200,0x7207,0x7208,
- 0x7209,0x7213,0x7217,0x721A,0x721D,0x721F,0x7224,0x722B,
- 0x722F,0x7234,0x7238,0x7239,0x7241,0x7242,0x7243,0x7245,
- 0x724E,0x724F,0x7250,0x7253,0x7255,0x7256,0x725A,0x725C,
- 0x725E,0x7260,0x7263,0x7268,0x726B,0x726E,0x726F,0x7271,
- 0x7277,0x7278,0x727B,0x727C,0x727F,0x7284,0x7289,0x728D,
- 0x728E,0x7293,0x729B,0x72A8,0x72AD,0x72AE,0x72B1,0x72B4,
- 0x72BE,0x72C1,0x72C7,0x72C9,0x72CC,0x72D5,0x72D6,0x72D8,
- 0x72DF,0x72E5,0x72F3,0x72F4,0x72FA,0x72FB,
-
- /* ku 43 */
- 0x72FE,0x7302,0x7304,0x7305,0x7307,0x730B,0x730D,0x7312,
- 0x7313,0x7318,0x7319,0x731E,0x7322,0x7324,0x7327,0x7328,
- 0x732C,0x7331,0x7332,0x7335,0x733A,0x733B,0x733D,0x7343,
- 0x734D,0x7350,0x7352,0x7356,0x7358,0x735D,0x735E,0x735F,
- 0x7360,0x7366,0x7367,0x7369,0x736B,0x736C,0x736E,0x736F,
- 0x7371,0x7377,0x7379,0x737C,0x7380,0x7381,0x7383,0x7385,
- 0x7386,0x738E,0x7390,0x7393,0x7395,0x7397,0x7398,0x739C,
- 0x739E,0x739F,0x73A0,0x73A2,0x73A5,0x73A6,0x73AA,0x73AB,
- 0x73AD,0x73B5,0x73B7,0x73B9,0x73BC,0x73BD,0x73BF,0x73C5,
- 0x73C6,0x73C9,0x73CB,0x73CC,0x73CF,0x73D2,0x73D3,0x73D6,
- 0x73D9,0x73DD,0x73E1,0x73E3,0x73E6,0x73E7,0x73E9,0x73F4,
- 0x73F5,0x73F7,0x73F9,0x73FA,0x73FB,0x73FD,
-
- /* ku 44 */
- 0x73FF,0x7400,0x7401,0x7404,0x7407,0x740A,0x7411,0x741A,
- 0x741B,0x7424,0x7426,0x7428,0x7429,0x742A,0x742B,0x742C,
- 0x742D,0x742E,0x742F,0x7430,0x7431,0x7439,0x7440,0x7443,
- 0x7444,0x7446,0x7447,0x744B,0x744D,0x7451,0x7452,0x7457,
- 0x745D,0x7462,0x7466,0x7467,0x7468,0x746B,0x746D,0x746E,
- 0x7471,0x7472,0x7480,0x7481,0x7485,0x7486,0x7487,0x7489,
- 0x748F,0x7490,0x7491,0x7492,0x7498,0x7499,0x749A,0x749C,
- 0x749F,0x74A0,0x74A1,0x74A3,0x74A6,0x74A8,0x74A9,0x74AA,
- 0x74AB,0x74AE,0x74AF,0x74B1,0x74B2,0x74B5,0x74B9,0x74BB,
- 0x74BF,0x74C8,0x74C9,0x74CC,0x74D0,0x74D3,0x74D8,0x74DA,
- 0x74DB,0x74DE,0x74DF,0x74E4,0x74E8,0x74EA,0x74EB,0x74EF,
- 0x74F4,0x74FA,0x74FB,0x74FC,0x74FF,0x7506,
-
- /* ku 45 */
- 0x7512,0x7516,0x7517,0x7520,0x7521,0x7524,0x7527,0x7529,
- 0x752A,0x752F,0x7536,0x7539,0x753D,0x753E,0x753F,0x7540,
- 0x7543,0x7547,0x7548,0x754E,0x7550,0x7552,0x7557,0x755E,
- 0x755F,0x7561,0x756F,0x7571,0x7579,0x757A,0x757B,0x757C,
- 0x757D,0x757E,0x7581,0x7585,0x7590,0x7592,0x7593,0x7595,
- 0x7599,0x759C,0x75A2,0x75A4,0x75B4,0x75BA,0x75BF,0x75C0,
- 0x75C1,0x75C4,0x75C6,0x75CC,0x75CE,0x75CF,0x75D7,0x75DC,
- 0x75DF,0x75E0,0x75E1,0x75E4,0x75E7,0x75EC,0x75EE,0x75EF,
- 0x75F1,0x75F9,0x7600,0x7602,0x7603,0x7604,0x7607,0x7608,
- 0x760A,0x760C,0x760F,0x7612,0x7613,0x7615,0x7616,0x7619,
- 0x761B,0x761C,0x761D,0x761E,0x7623,0x7625,0x7626,0x7629,
- 0x762D,0x7632,0x7633,0x7635,0x7638,0x7639,
-
- /* ku 46 */
- 0x763A,0x763C,0x764A,0x7640,0x7641,0x7643,0x7644,0x7645,
- 0x7649,0x764B,0x7655,0x7659,0x765F,0x7664,0x7665,0x766D,
- 0x766E,0x766F,0x7671,0x7674,0x7681,0x7685,0x768C,0x768D,
- 0x7695,0x769B,0x769C,0x769D,0x769F,0x76A0,0x76A2,0x76A3,
- 0x76A4,0x76A5,0x76A6,0x76A7,0x76A8,0x76AA,0x76AD,0x76BD,
- 0x76C1,0x76C5,0x76C9,0x76CB,0x76CC,0x76CE,0x76D4,0x76D9,
- 0x76E0,0x76E6,0x76E8,0x76EC,0x76F0,0x76F1,0x76F6,0x76F9,
- 0x76FC,0x7700,0x7706,0x770A,0x770E,0x7712,0x7714,0x7715,
- 0x7717,0x7719,0x771A,0x771C,0x7722,0x7728,0x772D,0x772E,
- 0x772F,0x7734,0x7735,0x7736,0x7739,0x773D,0x773E,0x7742,
- 0x7745,0x7746,0x774A,0x774D,0x774E,0x774F,0x7752,0x7756,
- 0x7757,0x775C,0x775E,0x775F,0x7760,0x7762,
-
- /* ku 47 */
- 0x7764,0x7767,0x776A,0x776C,0x7770,0x7772,0x7773,0x7774,
- 0x777A,0x777D,0x7780,0x7784,0x778C,0x778D,0x7794,0x7795,
- 0x7796,0x779A,0x779F,0x77A2,0x77A7,0x77AA,0x77AE,0x77AF,
- 0x77B1,0x77B5,0x77BE,0x77C3,0x77C9,0x77D1,0x77D2,0x77D5,
- 0x77D9,0x77DE,0x77DF,0x77E0,0x77E4,0x77E6,0x77EA,0x77EC,
- 0x77F0,0x77F1,0x77F4,0x77F8,0x77FB,0x7805,0x7806,0x7809,
- 0x780D,0x780E,0x7811,0x781D,0x7821,0x7822,0x7823,0x782D,
- 0x782E,0x7830,0x7835,0x7837,0x7843,0x7844,0x7847,0x7848,
- 0x784C,0x784E,0x7852,0x785C,0x785E,0x7860,0x7861,0x7863,
- 0x7864,0x7868,0x786A,0x786E,0x787A,0x787E,0x788A,0x788F,
- 0x7894,0x7898,0x78A1,0x789D,0x789E,0x789F,0x78A4,0x78A8,
- 0x78AC,0x78AD,0x78B0,0x78B1,0x78B2,0x78B3,
-
- /* ku 48 */
- 0x78BB,0x78BD,0x78BF,0x78C7,0x78C8,0x78C9,0x78CC,0x78CE,
- 0x78D2,0x78D3,0x78D5,0x78D6,0x78E4,0x78DB,0x78DF,0x78E0,
- 0x78E1,0x78E6,0x78EA,0x78F2,0x78F3,0x7900,0x78F6,0x78F7,
- 0x78FA,0x78FB,0x78FF,0x7906,0x790C,0x7910,0x791A,0x791C,
- 0x791E,0x791F,0x7920,0x7925,0x7927,0x7929,0x792D,0x7931,
- 0x7934,0x7935,0x793B,0x793D,0x793F,0x7944,0x7945,0x7946,
- 0x794A,0x794B,0x794F,0x7951,0x7954,0x7958,0x795B,0x795C,
- 0x7967,0x7969,0x796B,0x7972,0x7979,0x797B,0x797C,0x797E,
- 0x798B,0x798C,0x7991,0x7993,0x7994,0x7995,0x7996,0x7998,
- 0x799B,0x799C,0x79A1,0x79A8,0x79A9,0x79AB,0x79AF,0x79B1,
- 0x79B4,0x79B8,0x79BB,0x79C2,0x79C4,0x79C7,0x79C8,0x79CA,
- 0x79CF,0x79D4,0x79D6,0x79DA,0x79DD,0x79DE,
-
- /* ku 49 */
- 0x79E0,0x79E2,0x79E5,0x79EA,0x79EB,0x79ED,0x79F1,0x79F8,
- 0x79FC,0x7A02,0x7A03,0x7A07,0x7A09,0x7A0A,0x7A0C,0x7A11,
- 0x7A15,0x7A1B,0x7A1E,0x7A21,0x7A27,0x7A2B,0x7A2D,0x7A2F,
- 0x7A30,0x7A34,0x7A35,0x7A38,0x7A39,0x7A3A,0x7A44,0x7A45,
- 0x7A47,0x7A48,0x7A4C,0x7A55,0x7A56,0x7A59,0x7A5C,0x7A5D,
- 0x7A5F,0x7A60,0x7A65,0x7A67,0x7A6A,0x7A6D,0x7A75,0x7A78,
- 0x7A7E,0x7A80,0x7A82,0x7A85,0x7A86,0x7A8A,0x7A8B,0x7A90,
- 0x7A91,0x7A94,0x7A9E,0x7AA0,0x7AA3,0x7AAC,0x7AB3,0x7AB5,
- 0x7AB9,0x7ABB,0x7ABC,0x7AC6,0x7AC9,0x7ACC,0x7ACE,0x7AD1,
- 0x7ADB,0x7AE8,0x7AE9,0x7AEB,0x7AEC,0x7AF1,0x7AF4,0x7AFB,
- 0x7AFD,0x7AFE,0x7B07,0x7B14,0x7B1F,0x7B23,0x7B27,0x7B29,
- 0x7B2A,0x7B2B,0x7B2D,0x7B2E,0x7B2F,0x7B30,
-
- /* ku 50 */
- 0x7B31,0x7B34,0x7B3D,0x7B3F,0x7B40,0x7B41,0x7B47,0x7B4E,
- 0x7B55,0x7B60,0x7B64,0x7B66,0x7B69,0x7B6A,0x7B6D,0x7B6F,
- 0x7B72,0x7B73,0x7B77,0x7B84,0x7B89,0x7B8E,0x7B90,0x7B91,
- 0x7B96,0x7B9B,0x7B9E,0x7BA0,0x7BA5,0x7BAC,0x7BAF,0x7BB0,
- 0x7BB2,0x7BB5,0x7BB6,0x7BBA,0x7BBB,0x7BBC,0x7BBD,0x7BC2,
- 0x7BC5,0x7BC8,0x7BCA,0x7BD4,0x7BD6,0x7BD7,0x7BD9,0x7BDA,
- 0x7BDB,0x7BE8,0x7BEA,0x7BF2,0x7BF4,0x7BF5,0x7BF8,0x7BF9,
- 0x7BFA,0x7BFC,0x7BFE,0x7C01,0x7C02,0x7C03,0x7C04,0x7C06,
- 0x7C09,0x7C0B,0x7C0C,0x7C0E,0x7C0F,0x7C19,0x7C1B,0x7C20,
- 0x7C25,0x7C26,0x7C28,0x7C2C,0x7C31,0x7C33,0x7C34,0x7C36,
- 0x7C39,0x7C3A,0x7C46,0x7C4A,0x7C55,0x7C51,0x7C52,0x7C53,
- 0x7C59,0x7C5A,0x7C5B,0x7C5C,0x7C5D,0x7C5E,
-
- /* ku 51 */
- 0x7C61,0x7C63,0x7C67,0x7C69,0x7C6D,0x7C6E,0x7C70,0x7C72,
- 0x7C79,0x7C7C,0x7C7D,0x7C86,0x7C87,0x7C8F,0x7C94,0x7C9E,
- 0x7CA0,0x7CA6,0x7CB0,0x7CB6,0x7CB7,0x7CBA,0x7CBB,0x7CBC,
- 0x7CBF,0x7CC4,0x7CC7,0x7CC8,0x7CC9,0x7CCD,0x7CCF,0x7CD3,
- 0x7CD4,0x7CD5,0x7CD7,0x7CD9,0x7CDA,0x7CDD,0x7CE6,0x7CE9,
- 0x7CEB,0x7CF5,0x7D03,0x7D07,0x7D08,0x7D09,0x7D0F,0x7D11,
- 0x7D12,0x7D13,0x7D16,0x7D1D,0x7D1E,0x7D23,0x7D26,0x7D2A,
- 0x7D2D,0x7D31,0x7D3C,0x7D3D,0x7D3E,0x7D40,0x7D41,0x7D47,
- 0x7D48,0x7D4D,0x7D51,0x7D53,0x7D57,0x7D59,0x7D5A,0x7D5C,
- 0x7D5D,0x7D65,0x7D67,0x7D6A,0x7D70,0x7D78,0x7D7A,0x7D7B,
- 0x7D7F,0x7D81,0x7D82,0x7D83,0x7D85,0x7D86,0x7D88,0x7D8B,
- 0x7D8C,0x7D8D,0x7D91,0x7D96,0x7D97,0x7D9D,
-
- /* ku 52 */
- 0x7D9E,0x7DA6,0x7DA7,0x7DAA,0x7DB3,0x7DB6,0x7DB7,0x7DB9,
- 0x7DC2,0x7DC3,0x7DC4,0x7DC5,0x7DC6,0x7DCC,0x7DCD,0x7DCE,
- 0x7DD7,0x7DD9,0x7E00,0x7DE2,0x7DE5,0x7DE6,0x7DEA,0x7DEB,
- 0x7DED,0x7DF1,0x7DF5,0x7DF6,0x7DF9,0x7DFA,0x7E08,0x7E10,
- 0x7E11,0x7E15,0x7E17,0x7E1C,0x7E1D,0x7E20,0x7E27,0x7E28,
- 0x7E2C,0x7E2D,0x7E2F,0x7E33,0x7E36,0x7E3F,0x7E44,0x7E45,
- 0x7E47,0x7E4E,0x7E50,0x7E52,0x7E58,0x7E5F,0x7E61,0x7E62,
- 0x7E65,0x7E6B,0x7E6E,0x7E6F,0x7E73,0x7E78,0x7E7E,0x7E81,
- 0x7E86,0x7E87,0x7E8A,0x7E8D,0x7E91,0x7E95,0x7E98,0x7E9A,
- 0x7E9D,0x7E9E,0x7F3C,0x7F3B,0x7F3D,0x7F3E,0x7F3F,0x7F43,
- 0x7F44,0x7F47,0x7F4F,0x7F52,0x7F53,0x7F5B,0x7F5C,0x7F5D,
- 0x7F61,0x7F63,0x7F64,0x7F65,0x7F66,0x7F6D,
-
- /* ku 53 */
- 0x7F71,0x7F7D,0x7F7E,0x7F7F,0x7F80,0x7F8B,0x7F8D,0x7F8F,
- 0x7F90,0x7F91,0x7F96,0x7F97,0x7F9C,0x7FA1,0x7FA2,0x7FA6,
- 0x7FAA,0x7FAD,0x7FB4,0x7FBC,0x7FBF,0x7FC0,0x7FC3,0x7FC8,
- 0x7FCE,0x7FCF,0x7FDB,0x7FDF,0x7FE3,0x7FE5,0x7FE8,0x7FEC,
- 0x7FEE,0x7FEF,0x7FF2,0x7FFA,0x7FFD,0x7FFE,0x7FFF,0x8007,
- 0x8008,0x800A,0x800D,0x800E,0x800F,0x8011,0x8013,0x8014,
- 0x8016,0x801D,0x801E,0x801F,0x8020,0x8024,0x8026,0x802C,
- 0x802E,0x8030,0x8034,0x8035,0x8037,0x8039,0x803A,0x803C,
- 0x803E,0x8040,0x8044,0x8060,0x8064,0x8066,0x806D,0x8071,
- 0x8075,0x8081,0x8088,0x808E,0x809C,0x809E,0x80A6,0x80A7,
- 0x80AB,0x80B8,0x80B9,0x80C8,0x80CD,0x80CF,0x80D2,0x80D4,
- 0x80D5,0x80D7,0x80D8,0x80E0,0x80ED,0x80EE,
-
- /* ku 54 */
- 0x80F0,0x80F2,0x80F3,0x80F6,0x80F9,0x80FA,0x80FE,0x8103,
- 0x810B,0x8116,0x8117,0x8118,0x811C,0x811E,0x8120,0x8124,
- 0x8127,0x812C,0x8130,0x8135,0x813A,0x813C,0x8145,0x8147,
- 0x814A,0x814C,0x8152,0x8157,0x8160,0x8161,0x8167,0x8168,
- 0x8169,0x816D,0x816F,0x8177,0x8181,0x8190,0x8184,0x8185,
- 0x8186,0x818B,0x818E,0x8196,0x8198,0x819B,0x819E,0x81A2,
- 0x81AE,0x81B2,0x81B4,0x81BB,0x81CB,0x81C3,0x81C5,0x81CA,
- 0x81CE,0x81CF,0x81D5,0x81D7,0x81DB,0x81DD,0x81DE,0x81E1,
- 0x81E4,0x81EB,0x81EC,0x81F0,0x81F1,0x81F2,0x81F5,0x81F6,
- 0x81F8,0x81F9,0x81FD,0x81FF,0x8200,0x8203,0x820F,0x8213,
- 0x8214,0x8219,0x821A,0x821D,0x8221,0x8222,0x8228,0x8232,
- 0x8234,0x823A,0x8243,0x8244,0x8245,0x8246,
-
- /* ku 55 */
- 0x824B,0x824E,0x824F,0x8251,0x8256,0x825C,0x8260,0x8263,
- 0x8267,0x826D,0x8274,0x827B,0x827D,0x827F,0x8280,0x8281,
- 0x8283,0x8284,0x8287,0x8289,0x828A,0x828E,0x8291,0x8294,
- 0x8296,0x8298,0x829A,0x829B,0x82A0,0x82A1,0x82A3,0x82A4,
- 0x82A7,0x82A8,0x82A9,0x82AA,0x82AE,0x82B0,0x82B2,0x82B4,
- 0x82B7,0x82BA,0x82BC,0x82BE,0x82BF,0x82C6,0x82D0,0x82D5,
- 0x82DA,0x82E0,0x82E2,0x82E4,0x82E8,0x82EA,0x82ED,0x82EF,
- 0x82F6,0x82F7,0x82FD,0x82FE,0x8300,0x8301,0x8307,0x8308,
- 0x830A,0x830B,0x8354,0x831B,0x831D,0x831E,0x831F,0x8321,
- 0x8322,0x832C,0x832D,0x832E,0x8330,0x8333,0x8337,0x833A,
- 0x833C,0x833D,0x8342,0x8343,0x8344,0x8347,0x834D,0x834E,
- 0x8351,0x8355,0x8356,0x8357,0x8370,0x8378,
-
- /* ku 56 */
- 0x837D,0x837F,0x8380,0x8382,0x8384,0x8386,0x838D,0x8392,
- 0x8394,0x8395,0x8398,0x8399,0x839B,0x839C,0x839D,0x83A6,
- 0x83A7,0x83A9,0x83AC,0x83BE,0x83BF,0x83C0,0x83C7,0x83C9,
- 0x83CF,0x83D0,0x83D1,0x83D4,0x83DD,0x8353,0x83E8,0x83EA,
- 0x83F6,0x83F8,0x83F9,0x83FC,0x8401,0x8406,0x840A,0x840F,
- 0x8411,0x8415,0x8419,0x83AD,0x842F,0x8439,0x8445,0x8447,
- 0x8448,0x844A,0x844D,0x844F,0x8451,0x8452,0x8456,0x8458,
- 0x8459,0x845A,0x845C,0x8460,0x8464,0x8465,0x8467,0x846A,
- 0x8470,0x8473,0x8474,0x8476,0x8478,0x847C,0x847D,0x8481,
- 0x8485,0x8492,0x8493,0x8495,0x849E,0x84A6,0x84A8,0x84A9,
- 0x84AA,0x84AF,0x84B1,0x84B4,0x84BA,0x84BD,0x84BE,0x84C0,
- 0x84C2,0x84C7,0x84C8,0x84CC,0x84CF,0x84D3,
-
- /* ku 57 */
- 0x84DC,0x84E7,0x84EA,0x84EF,0x84F0,0x84F1,0x84F2,0x84F7,
- 0x8532,0x84FA,0x84FB,0x84FD,0x8502,0x8503,0x8507,0x850C,
- 0x850E,0x8510,0x851C,0x851E,0x8522,0x8523,0x8524,0x8525,
- 0x8527,0x852A,0x852B,0x852F,0x8533,0x8534,0x8536,0x853F,
- 0x8546,0x854F,0x8550,0x8551,0x8552,0x8553,0x8556,0x8559,
- 0x855C,0x855D,0x855E,0x855F,0x8560,0x8561,0x8562,0x8564,
- 0x856B,0x856F,0x8579,0x857A,0x857B,0x857D,0x857F,0x8581,
- 0x8585,0x8586,0x8589,0x858B,0x858C,0x858F,0x8593,0x8598,
- 0x859D,0x859F,0x85A0,0x85A2,0x85A5,0x85A7,0x85B4,0x85B6,
- 0x85B7,0x85B8,0x85BC,0x85BD,0x85BE,0x85BF,0x85C2,0x85C7,
- 0x85CA,0x85CB,0x85CE,0x85AD,0x85D8,0x85DA,0x85DF,0x85E0,
- 0x85E6,0x85E8,0x85ED,0x85F3,0x85F6,0x85FC,
-
- /* ku 58 */
- 0x85FF,0x8600,0x8604,0x8605,0x860D,0x860E,0x8610,0x8611,
- 0x8612,0x8618,0x8619,0x861B,0x861E,0x8621,0x8627,0x8629,
- 0x8636,0x8638,0x863A,0x863C,0x863D,0x8640,0x8642,0x8646,
- 0x8652,0x8653,0x8656,0x8657,0x8658,0x8659,0x865D,0x8660,
- 0x8661,0x8662,0x8663,0x8664,0x8669,0x866C,0x866F,0x8675,
- 0x8676,0x8677,0x867A,0x868D,0x8691,0x8696,0x8698,0x869A,
- 0x869C,0x86A1,0x86A6,0x86A7,0x86A8,0x86AD,0x86B1,0x86B3,
- 0x86B4,0x86B5,0x86B7,0x86B8,0x86B9,0x86BF,0x86C0,0x86C1,
- 0x86C3,0x86C5,0x86D1,0x86D2,0x86D5,0x86D7,0x86DA,0x86DC,
- 0x86E0,0x86E3,0x86E5,0x86E7,0x8688,0x86FA,0x86FC,0x86FD,
- 0x8704,0x8705,0x8707,0x870B,0x870E,0x870F,0x8710,0x8713,
- 0x8714,0x8719,0x871E,0x871F,0x8721,0x8723,
-
- /* ku 59 */
- 0x8728,0x872E,0x872F,0x8731,0x8732,0x8739,0x873A,0x873C,
- 0x873D,0x873E,0x8740,0x8743,0x8745,0x874D,0x8758,0x875D,
- 0x8761,0x8764,0x8765,0x876F,0x8771,0x8772,0x877B,0x8783,
- 0x8784,0x8785,0x8786,0x8787,0x8788,0x8789,0x878B,0x878C,
- 0x8790,0x8793,0x8795,0x8797,0x8798,0x8799,0x879E,0x87A0,
- 0x87A3,0x87A7,0x87AC,0x87AD,0x87AE,0x87B1,0x87B5,0x87BE,
- 0x87BF,0x87C1,0x87C8,0x87C9,0x87CA,0x87CE,0x87D5,0x87D6,
- 0x87D9,0x87DA,0x87DC,0x87DF,0x87E2,0x87E3,0x87E4,0x87EA,
- 0x87EB,0x87ED,0x87F1,0x87F3,0x87F8,0x87FA,0x87FF,0x8801,
- 0x8803,0x8806,0x8809,0x880A,0x880B,0x8810,0x8819,0x8812,
- 0x8813,0x8814,0x8818,0x881A,0x881B,0x881C,0x881E,0x881F,
- 0x8828,0x882D,0x882E,0x8830,0x8832,0x8835,
-
- /* ku 60 */
- 0x883A,0x883C,0x8841,0x8843,0x8845,0x8848,0x8849,0x884A,
- 0x884B,0x884E,0x8851,0x8855,0x8856,0x8858,0x885A,0x885C,
- 0x885F,0x8860,0x8864,0x8869,0x8871,0x8879,0x887B,0x8880,
- 0x8898,0x889A,0x889B,0x889C,0x889F,0x88A0,0x88A8,0x88AA,
- 0x88BA,0x88BD,0x88BE,0x88C0,0x88CA,0x88CB,0x88CC,0x88CD,
- 0x88CE,0x88D1,0x88D2,0x88D3,0x88DB,0x88DE,0x88E7,0x88EF,
- 0x88F0,0x88F1,0x88F5,0x88F7,0x8901,0x8906,0x890D,0x890E,
- 0x890F,0x8915,0x8916,0x8918,0x8919,0x891A,0x891C,0x8920,
- 0x8926,0x8927,0x8928,0x8930,0x8931,0x8932,0x8935,0x8939,
- 0x893A,0x893E,0x8940,0x8942,0x8945,0x8946,0x8949,0x894F,
- 0x8952,0x8957,0x895A,0x895B,0x895C,0x8961,0x8962,0x8963,
- 0x896B,0x896E,0x8970,0x8973,0x8975,0x897A,
-
- /* ku 61 */
- 0x897B,0x897C,0x897D,0x8989,0x898D,0x8990,0x8994,0x8995,
- 0x899B,0x899C,0x899F,0x89A0,0x89A5,0x89B0,0x89B4,0x89B5,
- 0x89B6,0x89B7,0x89BC,0x89D4,0x89D5,0x89D6,0x89D7,0x89D8,
- 0x89E5,0x89E9,0x89EB,0x89ED,0x89F1,0x89F3,0x89F6,0x89F9,
- 0x89FD,0x89FF,0x8A04,0x8A05,0x8A07,0x8A0F,0x8A11,0x8A12,
- 0x8A14,0x8A15,0x8A1E,0x8A20,0x8A22,0x8A24,0x8A26,0x8A2B,
- 0x8A2C,0x8A2F,0x8A35,0x8A37,0x8A3D,0x8A3E,0x8A40,0x8A43,
- 0x8A45,0x8A47,0x8A49,0x8A4D,0x8A4E,0x8A53,0x8A56,0x8A57,
- 0x8A58,0x8A5C,0x8A5D,0x8A61,0x8A65,0x8A67,0x8A75,0x8A76,
- 0x8A77,0x8A79,0x8A7A,0x8A7B,0x8A7E,0x8A7F,0x8A80,0x8A83,
- 0x8A86,0x8A8B,0x8A8F,0x8A90,0x8A92,0x8A96,0x8A97,0x8A99,
- 0x8A9F,0x8AA7,0x8AA9,0x8AAE,0x8AAF,0x8AB3,
-
- /* ku 62 */
- 0x8AB6,0x8AB7,0x8ABB,0x8ABE,0x8AC3,0x8AC6,0x8AC8,0x8AC9,
- 0x8ACA,0x8AD1,0x8AD3,0x8AD4,0x8AD5,0x8AD7,0x8ADD,0x8ADF,
- 0x8AEC,0x8AF0,0x8AF4,0x8AF5,0x8AF6,0x8AFC,0x8AFF,0x8B05,
- 0x8B06,0x8B0B,0x8B11,0x8B1C,0x8B1E,0x8B1F,0x8B0A,0x8B2D,
- 0x8B30,0x8B37,0x8B3C,0x8B42,0x8B43,0x8B44,0x8B45,0x8B46,
- 0x8B48,0x8B52,0x8B53,0x8B54,0x8B59,0x8B4D,0x8B5E,0x8B63,
- 0x8B6D,0x8B76,0x8B78,0x8B79,0x8B7C,0x8B7E,0x8B81,0x8B84,
- 0x8B85,0x8B8B,0x8B8D,0x8B8F,0x8B94,0x8B95,0x8B9C,0x8B9E,
- 0x8B9F,0x8C38,0x8C39,0x8C3D,0x8C3E,0x8C45,0x8C47,0x8C49,
- 0x8C4B,0x8C4F,0x8C51,0x8C53,0x8C54,0x8C57,0x8C58,0x8C5B,
- 0x8C5D,0x8C59,0x8C63,0x8C64,0x8C66,0x8C68,0x8C69,0x8C6D,
- 0x8C73,0x8C75,0x8C76,0x8C7B,0x8C7E,0x8C86,
-
- /* ku 63 */
- 0x8C87,0x8C8B,0x8C90,0x8C92,0x8C93,0x8C99,0x8C9B,0x8C9C,
- 0x8CA4,0x8CB9,0x8CBA,0x8CC5,0x8CC6,0x8CC9,0x8CCB,0x8CCF,
- 0x8CD6,0x8CD5,0x8CD9,0x8CDD,0x8CE1,0x8CE8,0x8CEC,0x8CEF,
- 0x8CF0,0x8CF2,0x8CF5,0x8CF7,0x8CF8,0x8CFE,0x8CFF,0x8D01,
- 0x8D03,0x8D09,0x8D12,0x8D17,0x8D1B,0x8D65,0x8D69,0x8D6C,
- 0x8D6E,0x8D7F,0x8D82,0x8D84,0x8D88,0x8D8D,0x8D90,0x8D91,
- 0x8D95,0x8D9E,0x8D9F,0x8DA0,0x8DA6,0x8DAB,0x8DAC,0x8DAF,
- 0x8DB2,0x8DB5,0x8DB7,0x8DB9,0x8DBB,0x8DC0,0x8DC5,0x8DC6,
- 0x8DC7,0x8DC8,0x8DCA,0x8DCE,0x8DD1,0x8DD4,0x8DD5,0x8DD7,
- 0x8DD9,0x8DE4,0x8DE5,0x8DE7,0x8DEC,0x8DF0,0x8DBC,0x8DF1,
- 0x8DF2,0x8DF4,0x8DFD,0x8E01,0x8E04,0x8E05,0x8E06,0x8E0B,
- 0x8E11,0x8E14,0x8E16,0x8E20,0x8E21,0x8E22,
-
- /* ku 64 */
- 0x8E23,0x8E26,0x8E27,0x8E31,0x8E33,0x8E36,0x8E37,0x8E38,
- 0x8E39,0x8E3D,0x8E40,0x8E41,0x8E4B,0x8E4D,0x8E4E,0x8E4F,
- 0x8E54,0x8E5B,0x8E5C,0x8E5D,0x8E5E,0x8E61,0x8E62,0x8E69,
- 0x8E6C,0x8E6D,0x8E6F,0x8E70,0x8E71,0x8E79,0x8E7A,0x8E7B,
- 0x8E82,0x8E83,0x8E89,0x8E90,0x8E92,0x8E95,0x8E9A,0x8E9B,
- 0x8E9D,0x8E9E,0x8EA2,0x8EA7,0x8EA9,0x8EAD,0x8EAE,0x8EB3,
- 0x8EB5,0x8EBA,0x8EBB,0x8EC0,0x8EC1,0x8EC3,0x8EC4,0x8EC7,
- 0x8ECF,0x8ED1,0x8ED4,0x8EDC,0x8EE8,0x8EEE,0x8EF0,0x8EF1,
- 0x8EF7,0x8EF9,0x8EFA,0x8EED,0x8F00,0x8F02,0x8F07,0x8F08,
- 0x8F0F,0x8F10,0x8F16,0x8F17,0x8F18,0x8F1E,0x8F20,0x8F21,
- 0x8F23,0x8F25,0x8F27,0x8F28,0x8F2C,0x8F2D,0x8F2E,0x8F34,
- 0x8F35,0x8F36,0x8F37,0x8F3A,0x8F40,0x8F41,
-
- /* ku 65 */
- 0x8F43,0x8F47,0x8F4F,0x8F51,0x8F52,0x8F53,0x8F54,0x8F55,
- 0x8F58,0x8F5D,0x8F5E,0x8F65,0x8F9D,0x8FA0,0x8FA1,0x8FA4,
- 0x8FA5,0x8FA6,0x8FB5,0x8FB6,0x8FB8,0x8FBE,0x8FC0,0x8FC1,
- 0x8FC6,0x8FCA,0x8FCB,0x8FCD,0x8FD0,0x8FD2,0x8FD3,0x8FD5,
- 0x8FE0,0x8FE3,0x8FE4,0x8FE8,0x8FEE,0x8FF1,0x8FF5,0x8FF6,
- 0x8FFB,0x8FFE,0x9002,0x9004,0x9008,0x900C,0x9018,0x901B,
- 0x9028,0x9029,0x902F,0x902A,0x902C,0x902D,0x9033,0x9034,
- 0x9037,0x903F,0x9043,0x9044,0x904C,0x905B,0x905D,0x9062,
- 0x9066,0x9067,0x906C,0x9070,0x9074,0x9079,0x9085,0x9088,
- 0x908B,0x908C,0x908E,0x9090,0x9095,0x9097,0x9098,0x9099,
- 0x909B,0x90A0,0x90A1,0x90A2,0x90A5,0x90B0,0x90B2,0x90B3,
- 0x90B4,0x90B6,0x90BD,0x90CC,0x90BE,0x90C3,
-
- /* ku 66 */
- 0x90C4,0x90C5,0x90C7,0x90C8,0x90D5,0x90D7,0x90D8,0x90D9,
- 0x90DC,0x90DD,0x90DF,0x90E5,0x90D2,0x90F6,0x90EB,0x90EF,
- 0x90F0,0x90F4,0x90FE,0x90FF,0x9100,0x9104,0x9105,0x9106,
- 0x9108,0x910D,0x9110,0x9114,0x9116,0x9117,0x9118,0x911A,
- 0x911C,0x911E,0x9120,0x9125,0x9122,0x9123,0x9127,0x9129,
- 0x912E,0x912F,0x9131,0x9134,0x9136,0x9137,0x9139,0x913A,
- 0x913C,0x913D,0x9143,0x9147,0x9148,0x914F,0x9153,0x9157,
- 0x9159,0x915A,0x915B,0x9161,0x9164,0x9167,0x916D,0x9174,
- 0x9179,0x917A,0x917B,0x9181,0x9183,0x9185,0x9186,0x918A,
- 0x918E,0x9191,0x9193,0x9194,0x9195,0x9198,0x919E,0x91A1,
- 0x91A6,0x91A8,0x91AC,0x91AD,0x91AE,0x91B0,0x91B1,0x91B2,
- 0x91B3,0x91B6,0x91BB,0x91BC,0x91BD,0x91BF,
-
- /* ku 67 */
- 0x91C2,0x91C3,0x91C5,0x91D3,0x91D4,0x91D7,0x91D9,0x91DA,
- 0x91DE,0x91E4,0x91E5,0x91E9,0x91EA,0x91EC,0x91ED,0x91EE,
- 0x91EF,0x91F0,0x91F1,0x91F7,0x91F9,0x91FB,0x91FD,0x9200,
- 0x9201,0x9204,0x9205,0x9206,0x9207,0x9209,0x920A,0x920C,
- 0x9210,0x9212,0x9213,0x9216,0x9218,0x921C,0x921D,0x9223,
- 0x9224,0x9225,0x9226,0x9228,0x922E,0x922F,0x9230,0x9233,
- 0x9235,0x9236,0x9238,0x9239,0x923A,0x923C,0x923E,0x9240,
- 0x9242,0x9243,0x9246,0x9247,0x924A,0x924D,0x924E,0x924F,
- 0x9251,0x9258,0x9259,0x925C,0x925D,0x9260,0x9261,0x9265,
- 0x9267,0x9268,0x9269,0x926E,0x926F,0x9270,0x9275,0x9276,
- 0x9277,0x9278,0x9279,0x927B,0x927C,0x927D,0x927F,0x9288,
- 0x9289,0x928A,0x928D,0x928E,0x9292,0x9297,
-
- /* ku 68 */
- 0x9299,0x929F,0x92A0,0x92A4,0x92A5,0x92A7,0x92A8,0x92AB,
- 0x92AF,0x92B2,0x92B6,0x92B8,0x92BA,0x92BB,0x92BC,0x92BD,
- 0x92BF,0x92C0,0x92C1,0x92C2,0x92C3,0x92C5,0x92C6,0x92C7,
- 0x92C8,0x92CB,0x92CC,0x92CD,0x92CE,0x92D0,0x92D3,0x92D5,
- 0x92D7,0x92D8,0x92D9,0x92DC,0x92DD,0x92DF,0x92E0,0x92E1,
- 0x92E3,0x92E5,0x92E7,0x92E8,0x92EC,0x92EE,0x92F0,0x92F9,
- 0x92FB,0x92FF,0x9300,0x9302,0x9308,0x930D,0x9311,0x9314,
- 0x9315,0x931C,0x931D,0x931E,0x931F,0x9321,0x9324,0x9325,
- 0x9327,0x9329,0x932A,0x9333,0x9334,0x9336,0x9337,0x9347,
- 0x9348,0x9349,0x9350,0x9351,0x9352,0x9355,0x9357,0x9358,
- 0x935A,0x935E,0x9364,0x9365,0x9367,0x9369,0x936A,0x936D,
- 0x936F,0x9370,0x9371,0x9373,0x9374,0x9376,
-
- /* ku 69 */
- 0x937A,0x937D,0x937F,0x9380,0x9381,0x9382,0x9388,0x938A,
- 0x938B,0x938D,0x938F,0x9392,0x9395,0x9398,0x939B,0x939E,
- 0x93A1,0x93A3,0x93A4,0x93A6,0x93A8,0x93AB,0x93B4,0x93B5,
- 0x93B6,0x93BA,0x93A9,0x93C1,0x93C4,0x93C5,0x93C6,0x93C7,
- 0x93C9,0x93CA,0x93CB,0x93CC,0x93CD,0x93D3,0x93D9,0x93DC,
- 0x93DE,0x93DF,0x93E2,0x93E6,0x93E7,0x93F9,0x93F7,0x93F8,
- 0x93FA,0x93FB,0x93FD,0x9401,0x9402,0x9404,0x9408,0x9409,
- 0x940D,0x940E,0x940F,0x9415,0x9416,0x9417,0x941F,0x942E,
- 0x942F,0x9431,0x9432,0x9433,0x9434,0x943B,0x943F,0x943D,
- 0x9443,0x9445,0x9448,0x944A,0x944C,0x9455,0x9459,0x945C,
- 0x945F,0x9461,0x9463,0x9468,0x946B,0x946D,0x946E,0x946F,
- 0x9471,0x9472,0x9484,0x9483,0x9578,0x9579,
-
- /* ku 70 */
- 0x957E,0x9584,0x9588,0x958C,0x958D,0x958E,0x959D,0x959E,
- 0x959F,0x95A1,0x95A6,0x95A9,0x95AB,0x95AC,0x95B4,0x95B6,
- 0x95BA,0x95BD,0x95BF,0x95C6,0x95C8,0x95C9,0x95CB,0x95D0,
- 0x95D1,0x95D2,0x95D3,0x95D9,0x95DA,0x95DD,0x95DE,0x95DF,
- 0x95E0,0x95E4,0x95E6,0x961D,0x961E,0x9622,0x9624,0x9625,
- 0x9626,0x962C,0x9631,0x9633,0x9637,0x9638,0x9639,0x963A,
- 0x963C,0x963D,0x9641,0x9652,0x9654,0x9656,0x9657,0x9658,
- 0x9661,0x966E,0x9674,0x967B,0x967C,0x967E,0x967F,0x9681,
- 0x9682,0x9683,0x9684,0x9689,0x9691,0x9696,0x969A,0x969D,
- 0x969F,0x96A4,0x96A5,0x96A6,0x96A9,0x96AE,0x96AF,0x96B3,
- 0x96BA,0x96CA,0x96D2,0x5DB2,0x96D8,0x96DA,0x96DD,0x96DE,
- 0x96DF,0x96E9,0x96EF,0x96F1,0x96FA,0x9702,
-
- /* ku 71 */
- 0x9703,0x9705,0x9709,0x971A,0x971B,0x971D,0x9721,0x9722,
- 0x9723,0x9728,0x9731,0x9733,0x9741,0x9743,0x974A,0x974E,
- 0x974F,0x9755,0x9757,0x9758,0x975A,0x975B,0x9763,0x9767,
- 0x976A,0x976E,0x9773,0x9776,0x9777,0x9778,0x977B,0x977D,
- 0x977F,0x9780,0x9789,0x9795,0x9796,0x9797,0x9799,0x979A,
- 0x979E,0x979F,0x97A2,0x97AC,0x97AE,0x97B1,0x97B2,0x97B5,
- 0x97B6,0x97B8,0x97B9,0x97BA,0x97BC,0x97BE,0x97BF,0x97C1,
- 0x97C4,0x97C5,0x97C7,0x97C9,0x97CA,0x97CC,0x97CD,0x97CE,
- 0x97D0,0x97D1,0x97D4,0x97D7,0x97D8,0x97D9,0x97DD,0x97DE,
- 0x97E0,0x97DB,0x97E1,0x97E4,0x97EF,0x97F1,0x97F4,0x97F7,
- 0x97F8,0x97FA,0x9807,0x980A,0x9819,0x980D,0x980E,0x9814,
- 0x9816,0x981C,0x981E,0x9820,0x9823,0x9826,
-
- /* ku 72 */
- 0x982B,0x982E,0x982F,0x9830,0x9832,0x9833,0x9835,0x9825,
- 0x983E,0x9844,0x9847,0x984A,0x9851,0x9852,0x9853,0x9856,
- 0x9857,0x9859,0x985A,0x9862,0x9863,0x9865,0x9866,0x986A,
- 0x986C,0x98AB,0x98AD,0x98AE,0x98B0,0x98B4,0x98B7,0x98B8,
- 0x98BA,0x98BB,0x98BF,0x98C2,0x98C5,0x98C8,0x98CC,0x98E1,
- 0x98E3,0x98E5,0x98E6,0x98E7,0x98EA,0x98F3,0x98F6,0x9902,
- 0x9907,0x9908,0x9911,0x9915,0x9916,0x9917,0x991A,0x991B,
- 0x991C,0x991F,0x9922,0x9926,0x9927,0x992B,0x9931,0x9932,
- 0x9933,0x9934,0x9935,0x9939,0x993A,0x993B,0x993C,0x9940,
- 0x9941,0x9946,0x9947,0x9948,0x994D,0x994E,0x9954,0x9958,
- 0x9959,0x995B,0x995C,0x995E,0x995F,0x9960,0x999B,0x999D,
- 0x999F,0x99A6,0x99B0,0x99B1,0x99B2,0x99B5,
-
- /* ku 73 */
- 0x99B9,0x99BA,0x99BD,0x99BF,0x99C3,0x99C9,0x99D3,0x99D4,
- 0x99D9,0x99DA,0x99DC,0x99DE,0x99E7,0x99EA,0x99EB,0x99EC,
- 0x99F0,0x99F4,0x99F5,0x99F9,0x99FD,0x99FE,0x9A02,0x9A03,
- 0x9A04,0x9A0B,0x9A0C,0x9A10,0x9A11,0x9A16,0x9A1E,0x9A20,
- 0x9A22,0x9A23,0x9A24,0x9A27,0x9A2D,0x9A2E,0x9A33,0x9A35,
- 0x9A36,0x9A38,0x9A47,0x9A41,0x9A44,0x9A4A,0x9A4B,0x9A4C,
- 0x9A4E,0x9A51,0x9A54,0x9A56,0x9A5D,0x9AAA,0x9AAC,0x9AAE,
- 0x9AAF,0x9AB2,0x9AB4,0x9AB5,0x9AB6,0x9AB9,0x9ABB,0x9ABE,
- 0x9ABF,0x9AC1,0x9AC3,0x9AC6,0x9AC8,0x9ACE,0x9AD0,0x9AD2,
- 0x9AD5,0x9AD6,0x9AD7,0x9ADB,0x9ADC,0x9AE0,0x9AE4,0x9AE5,
- 0x9AE7,0x9AE9,0x9AEC,0x9AF2,0x9AF3,0x9AF5,0x9AF9,0x9AFA,
- 0x9AFD,0x9AFF,0x9B00,0x9B01,0x9B02,0x9B03,
-
- /* ku 74 */
- 0x9B04,0x9B05,0x9B08,0x9B09,0x9B0B,0x9B0C,0x9B0D,0x9B0E,
- 0x9B10,0x9B12,0x9B16,0x9B19,0x9B1B,0x9B1C,0x9B20,0x9B26,
- 0x9B2B,0x9B2D,0x9B33,0x9B34,0x9B35,0x9B37,0x9B39,0x9B3A,
- 0x9B3D,0x9B48,0x9B4B,0x9B4C,0x9B55,0x9B56,0x9B57,0x9B5B,
- 0x9B5E,0x9B61,0x9B63,0x9B65,0x9B66,0x9B68,0x9B6A,0x9B6B,
- 0x9B6C,0x9B6D,0x9B6E,0x9B73,0x9B75,0x9B77,0x9B78,0x9B79,
- 0x9B7F,0x9B80,0x9B84,0x9B85,0x9B86,0x9B87,0x9B89,0x9B8A,
- 0x9B8B,0x9B8D,0x9B8F,0x9B90,0x9B94,0x9B9A,0x9B9D,0x9B9E,
- 0x9BA6,0x9BA7,0x9BA9,0x9BAC,0x9BB0,0x9BB1,0x9BB2,0x9BB7,
- 0x9BB8,0x9BBB,0x9BBC,0x9BBE,0x9BBF,0x9BC1,0x9BC7,0x9BC8,
- 0x9BCE,0x9BD0,0x9BD7,0x9BD8,0x9BDD,0x9BDF,0x9BE5,0x9BE7,
- 0x9BEA,0x9BEB,0x9BEF,0x9BF3,0x9BF7,0x9BF8,
-
- /* ku 75 */
- 0x9BF9,0x9BFA,0x9BFD,0x9BFF,0x9C00,0x9C02,0x9C0B,0x9C0F,
- 0x9C11,0x9C16,0x9C18,0x9C19,0x9C1A,0x9C1C,0x9C1E,0x9C22,
- 0x9C23,0x9C26,0x9C27,0x9C28,0x9C29,0x9C2A,0x9C31,0x9C35,
- 0x9C36,0x9C37,0x9C3D,0x9C41,0x9C43,0x9C44,0x9C45,0x9C49,
- 0x9C4A,0x9C4E,0x9C4F,0x9C50,0x9C53,0x9C54,0x9C56,0x9C58,
- 0x9C5B,0x9C5D,0x9C5E,0x9C5F,0x9C63,0x9C69,0x9C6A,0x9C5C,
- 0x9C6B,0x9C68,0x9C6E,0x9C70,0x9C72,0x9C75,0x9C77,0x9C7B,
- 0x9CE6,0x9CF2,0x9CF7,0x9CF9,0x9D0B,0x9D02,0x9D11,0x9D17,
- 0x9D18,0x9D1C,0x9D1D,0x9D1E,0x9D2F,0x9D30,0x9D32,0x9D33,
- 0x9D34,0x9D3A,0x9D3C,0x9D45,0x9D3D,0x9D42,0x9D43,0x9D47,
- 0x9D4A,0x9D53,0x9D54,0x9D5F,0x9D63,0x9D62,0x9D65,0x9D69,
- 0x9D6A,0x9D6B,0x9D70,0x9D76,0x9D77,0x9D7B,
-
- /* ku 76 */
- 0x9D7C,0x9D7E,0x9D83,0x9D84,0x9D86,0x9D8A,0x9D8D,0x9D8E,
- 0x9D92,0x9D93,0x9D95,0x9D96,0x9D97,0x9D98,0x9DA1,0x9DAA,
- 0x9DAC,0x9DAE,0x9DB1,0x9DB5,0x9DB9,0x9DBC,0x9DBF,0x9DC3,
- 0x9DC7,0x9DC9,0x9DCA,0x9DD4,0x9DD5,0x9DD6,0x9DD7,0x9DDA,
- 0x9DDE,0x9DDF,0x9DE0,0x9DE5,0x9DE7,0x9DE9,0x9DEB,0x9DEE,
- 0x9DF0,0x9DF3,0x9DF4,0x9DFE,0x9E0A,0x9E02,0x9E07,0x9E0E,
- 0x9E10,0x9E11,0x9E12,0x9E15,0x9E16,0x9E19,0x9E1C,0x9E1D,
- 0x9E7A,0x9E7B,0x9E7C,0x9E80,0x9E82,0x9E83,0x9E84,0x9E85,
- 0x9E87,0x9E8E,0x9E8F,0x9E96,0x9E98,0x9E9B,0x9E9E,0x9EA4,
- 0x9EA8,0x9EAC,0x9EAE,0x9EAF,0x9EB0,0x9EB3,0x9EB4,0x9EB5,
- 0x9EC6,0x9EC8,0x9ECB,0x9ED5,0x9EDF,0x9EE4,0x9EE7,0x9EEC,
- 0x9EED,0x9EEE,0x9EF0,0x9EF1,0x9EF2,0x9EF5,
-
- /* ku 77 */
- 0x9EF8,0x9EFF,0x9F02,0x9F03,0x9F09,0x9F0F,0x9F10,0x9F11,
- 0x9F12,0x9F14,0x9F16,0x9F17,0x9F19,0x9F1A,0x9F1B,0x9F1F,
- 0x9F22,0x9F26,0x9F2A,0x9F2B,0x9F2F,0x9F31,0x9F32,0x9F34,
- 0x9F37,0x9F39,0x9F3A,0x9F3C,0x9F3D,0x9F3F,0x9F41,0x9F43,
- 0x9F44,0x9F45,0x9F46,0x9F47,0x9F53,0x9F55,0x9F56,0x9F57,
- 0x9F58,0x9F5A,0x9F5D,0x9F5E,0x9F68,0x9F69,0x9F6D,0x9F6E,
- 0x9F6F,0x9F70,0x9F71,0x9F73,0x9F75,0x9F7A,0x9F7D,0x9F8F,
- 0x9F90,0x9F91,0x9F92,0x9F94,0x9F96,0x9F97,0x9F9E,0x9FA1,
- 0x9FA2,0x9FA3,0x9FA5
-};
-
-static const int jisx0212_ucs_table_size = (sizeof (jisx0212_ucs_table) / sizeof (unsigned short));
-
-
-static const unsigned short ucs_a1_jis_table[] = {
- /* 0000h */
- 0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007,
- 0x0008,0x0009,0x000A,0x000B,0x000C,0x000D,0x000E,0x000F,
- 0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017,
- 0x0018,0x0019,0x001A,0x001B,0x001C,0x001D,0x001E,0x001F,
- 0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027,
- 0x0028,0x0029,0x002A,0x002B,0x002C,0x002D,0x002E,0x002F,
- 0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037,
- 0x0038,0x0039,0x003A,0x003B,0x003C,0x003D,0x003E,0x003F,
- 0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047,
- 0x0048,0x0049,0x004A,0x004B,0x004C,0x004D,0x004E,0x004F,
- 0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057,
- 0x0058,0x0059,0x005A,0x005B,0x005C,0x005D,0x005E,0x005F,
- 0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067,
- 0x0068,0x0069,0x006A,0x006B,0x006C,0x006D,0x006E,0x006F,
- 0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077,
- 0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x007F,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0xA2C2,0x2171,0x2172,0xA2F0,0x0000,0xA2C3,0x2178,
- 0x212F,0xA2ED,0xA2EC,0x0000,0x224C,0x0000,0xA2EE,0xA2B4,
- 0x216B,0x215E,0x0000,0x0000,0x212D,0x0000,0x2279,0x0000,
- 0xA2B1,0x0000,0xA2EB,0x0000,0x0000,0x0000,0x0000,0xA2C4,
- 0xAAA2,0xAAA1,0xAAA4,0xAAAA,0xAAA3,0xAAA9,0xA9A1,0xAAAE,
- 0xAAB2,0xAAB1,0xAAB4,0xAAB3,0xAAC0,0xAABF,0xAAC2,0xAAC1,
- 0x0000,0xAAD0,0xAAD2,0xAAD1,0xAAD4,0xAAD8,0xAAD3,0x215F,
- 0xA9AC,0xAAE3,0xAAE2,0xAAE5,0xAAE4,0xAAF2,0xA9B0,0xA9CE,
- 0xABA2,0xABA1,0xABA4,0xABAA,0xABA3,0xABA9,0xA9C1,0xABAE,
- 0xABB2,0xABB1,0xABB4,0xABB3,0xABC0,0xABBF,0xABC2,0xABC1,
- 0xA9C3,0xABD0,0xABD2,0xABD1,0xABD4,0xABD8,0xABD3,0x2160,
- 0xA9CC,0xABE3,0xABE2,0xABE5,0xABE4,0xABF2,0xA9D0,0xABF3,
-
- /* 0100h */
- 0xAAA7,0xABA7,0xAAA5,0xABA5,0xAAA8,0xABA8,0xAAAB,0xABAB,
- 0xAAAC,0xABAC,0xAAAF,0xABAF,0xAAAD,0xABAD,0xAAB0,0xABB0,
- 0xA9A2,0xA9C2,0xAAB7,0xABB7,0x0000,0x0000,0xAAB6,0xABB6,
- 0xAAB8,0xABB8,0xAAB5,0xABB5,0xAABA,0xABBA,0xAABB,0xABBB,
- 0xAABD,0xABBD,0xAABC,0x0000,0xAABE,0xABBE,0xA9A4,0xA9C4,
- 0xAAC7,0xABC7,0xAAC5,0xABC5,0x0000,0x0000,0xAAC6,0xABC6,
- 0xAAC4,0xA9C5,0xA9A6,0xA9C6,0xAAC8,0xABC8,0xAAC9,0xABC9,
- 0xA9C7,0xAACA,0xABCA,0xAACC,0xABCC,0xAACB,0xABCB,0xA9A9,
- 0xA9C9,0xA9A8,0xA9C8,0xAACD,0xABCD,0xAACF,0xABCF,0xAACE,
- 0xABCE,0xA9CA,0xA9AB,0xA9CB,0xAAD7,0xABD7,0x0000,0x0000,
- 0xAAD6,0xABD6,0xA9AD,0xA9CD,0xAAD9,0xABD9,0xAADB,0xABDB,
- 0xAADA,0xABDA,0xAADC,0xABDC,0xAADD,0xABDD,0xAADF,0xABDF,
- 0xAADE,0xABDE,0xAAE1,0xABE1,0xAAE0,0xABE0,0xA9AF,0xA9CF,
- 0xAAEC,0xABEC,0xAAE9,0xABE9,0xAAE6,0xABE6,0xAAEB,0xABEB,
- 0xAAE8,0xABE8,0xAAEA,0xABEA,0xAAF1,0xABF1,0xAAF4,0xABF4,
- 0xAAF3,0xAAF5,0xABF5,0xAAF7,0xABF7,0xAAF6,0xABF6,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0xAAA6,0xABA6,0xAAC3,
- 0xABC3,0xAAD5,0xABD5,0xAAE7,0xABE7,0xAAF0,0xABF0,0xAAED,
- 0xABED,0xAAEF,0xABEF,0xAAEE,0xABEE,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0xABB9,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-
- /* 0200h */
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xA2B0,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0xA2AF,0xA2B2,0xA2B6,0xA2B5,0x0000,0xA2B3,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-
- /* 0300h */
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0xA2B8,0xA2B9,0xA6E1,0x0000,
- 0xA6E2,0xA6E3,0xA6E4,0x0000,0xA6E7,0x0000,0xA6E9,0xA6EC,
- 0xA6F6,0x2621,0x2622,0x2623,0x2624,0x2625,0x2626,0x2627,
- 0x2628,0x2629,0x262A,0x262B,0x262C,0x262D,0x262E,0x262F,
- 0x2630,0x2631,0x0000,0x2632,0x2633,0x2634,0x2635,0x2636,
- 0x2637,0x2638,0xA6E5,0xA6EA,0xA6F1,0xA6F2,0xA6F3,0xA6F4,
- 0xA6FB,0x2641,0x2642,0x2643,0x2644,0x2645,0x2646,0x2647,
- 0x2648,0x2649,0x264A,0x264B,0x264C,0x264D,0x264E,0x264F,
- 0x2650,0x2651,0xA6F8,0x2652,0x2653,0x2654,0x2655,0x2656,
- 0x2657,0x2658,0xA6F5,0xA6FA,0xA6F7,0xA6F9,0xA6FC,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-
- /* 0400h */
- 0x0000,0x2727,0xA7C2,0xA7C3,0xA7C4,0xA7C5,0xA7C6,0xA7C7,
- 0xA7C8,0xA7C9,0xA7CA,0xA7CB,0xA7CC,0x0000,0xA7CD,0xA7CE,
- 0x2721,0x2722,0x2723,0x2724,0x2725,0x2726,0x2728,0x2729,
- 0x272A,0x272B,0x272C,0x272D,0x272E,0x272F,0x2730,0x2731,
- 0x2732,0x2733,0x2734,0x2735,0x2736,0x2737,0x2738,0x2739,
- 0x273A,0x273B,0x273C,0x273D,0x273E,0x273F,0x2740,0x2741,
- 0x2751,0x2752,0x2753,0x2754,0x2755,0x2756,0x2758,0x2759,
- 0x275A,0x275B,0x275C,0x275D,0x275E,0x275F,0x2760,0x2761,
- 0x2762,0x2763,0x2764,0x2765,0x2766,0x2767,0x2768,0x2769,
- 0x276A,0x276B,0x276C,0x276D,0x276E,0x276F,0x2770,0x2771,
- 0x0000,0x2757,0xA7F2,0xA7F3,0xA7F4,0xA7F5,0xA7F6,0xA7F7,
- 0xA7F8,0xA7F9,0xA7FA,0xA7FB,0xA7FC,0x0000,0xA7FD,0xA7FE
-};
-static const int ucs_a1_jis_table_min = 0x0000;
-static const int ucs_a1_jis_table_max = 0x0000 + (sizeof (ucs_a1_jis_table) / sizeof (unsigned short));
-
-
-static const unsigned short ucs_a2_jis_table[] = {
- /* 2000h */
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x213E,0x0000,0x0000,0x0000,0x0000,0x213D,0x2142,0x0000,
- 0x2146,0x2147,0x0000,0x0000,0x2148,0x2149,0x0000,0x0000,
- 0x2277,0x2278,0x0000,0x0000,0x0000,0x2145,0x2144,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x2273,0x0000,0x216C,0x216D,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x2228,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-
- /* 2100h */
- 0x0000,0x0000,0x0000,0x216E,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xA2F1,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0xA2EF,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x2272,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x222B,0x222C,0x222A,0x222D,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x224D,0x0000,0x224E,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-
- /* 2200h */
- 0x224F,0x0000,0x225F,0x2250,0x0000,0x0000,0x0000,0x2260,
- 0x223A,0x0000,0x0000,0x223B,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x215D,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x2265,0x0000,0x0000,0x2267,0x2167,0x0000,
- 0x225C,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x224A,
- 0x224B,0x2241,0x2240,0x2269,0x226A,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x2168,0x2268,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x2266,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x2262,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x2162,0x2261,0x0000,0x0000,0x0000,0x0000,0x2165,0x2166,
- 0x0000,0x0000,0x2263,0x2264,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x223E,0x223F,0x0000,0x0000,0x223C,0x223D,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x225D,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-
- /* 2300h */
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x225E,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-
- /* 2400h */
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-
- /* 2500h */
- 0x2821,0x282C,0x2822,0x282D,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x2823,0x0000,0x0000,0x282E,
- 0x2824,0x0000,0x0000,0x282F,0x2826,0x0000,0x0000,0x2831,
- 0x2825,0x0000,0x0000,0x2830,0x2827,0x283C,0x0000,0x0000,
- 0x2837,0x0000,0x0000,0x2832,0x2829,0x283E,0x0000,0x0000,
- 0x2839,0x0000,0x0000,0x2834,0x2828,0x0000,0x0000,0x2838,
- 0x283D,0x0000,0x0000,0x2833,0x282A,0x0000,0x0000,0x283A,
- 0x283F,0x0000,0x0000,0x2835,0x282B,0x0000,0x0000,0x283B,
- 0x0000,0x0000,0x2840,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x2836,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x2223,0x2222,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x2225,0x2224,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x2227,0x2226,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x2221,0x217E,
- 0x0000,0x0000,0x0000,0x217B,0x0000,0x0000,0x217D,0x217C,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x227E,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-
- /* 2600h */
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x217A,0x2179,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x216A,0x0000,0x2169,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x2276,0x0000,0x0000,0x2275,0x0000,0x2274,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-
- /* 2700h */
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-
- /* 2800h */
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-
- /* 2900h */
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-
- /* 2A00h */
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-
- /* 2B00h */
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-
- /* 2C00h */
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-
- /* 2D00h */
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-
- /* 2E00h */
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-
- /* 2F00h */
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-
- /* 3000h */
- 0x2121,0x2122,0x2123,0x2137,0x0000,0x2139,0x213A,0x213B,
- 0x2152,0x2153,0x2154,0x2155,0x2156,0x2157,0x2158,0x2159,
- 0x215A,0x215B,0x2229,0x222E,0x214C,0x214D,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x2141,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x2421,0x2422,0x2423,0x2424,0x2425,0x2426,0x2427,
- 0x2428,0x2429,0x242A,0x242B,0x242C,0x242D,0x242E,0x242F,
- 0x2430,0x2431,0x2432,0x2433,0x2434,0x2435,0x2436,0x2437,
- 0x2438,0x2439,0x243A,0x243B,0x243C,0x243D,0x243E,0x243F,
- 0x2440,0x2441,0x2442,0x2443,0x2444,0x2445,0x2446,0x2447,
- 0x2448,0x2449,0x244A,0x244B,0x244C,0x244D,0x244E,0x244F,
- 0x2450,0x2451,0x2452,0x2453,0x2454,0x2455,0x2456,0x2457,
- 0x2458,0x2459,0x245A,0x245B,0x245C,0x245D,0x245E,0x245F,
- 0x2460,0x2461,0x2462,0x2463,0x2464,0x2465,0x2466,0x2467,
- 0x2468,0x2469,0x246A,0x246B,0x246C,0x246D,0x246E,0x246F,
- 0x2470,0x2471,0x2472,0x2473,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x212B,0x212C,0x2135,0x2136,0x0000,
- 0x0000,0x2521,0x2522,0x2523,0x2524,0x2525,0x2526,0x2527,
- 0x2528,0x2529,0x252A,0x252B,0x252C,0x252D,0x252E,0x252F,
- 0x2530,0x2531,0x2532,0x2533,0x2534,0x2535,0x2536,0x2537,
- 0x2538,0x2539,0x253A,0x253B,0x253C,0x253D,0x253E,0x253F,
- 0x2540,0x2541,0x2542,0x2543,0x2544,0x2545,0x2546,0x2547,
- 0x2548,0x2549,0x254A,0x254B,0x254C,0x254D,0x254E,0x254F,
- 0x2550,0x2551,0x2552,0x2553,0x2554,0x2555,0x2556,0x2557,
- 0x2558,0x2559,0x255A,0x255B,0x255C,0x255D,0x255E,0x255F,
- 0x2560,0x2561,0x2562,0x2563,0x2564,0x2565,0x2566,0x2567,
- 0x2568,0x2569,0x256A,0x256B,0x256C,0x256D,0x256E,0x256F,
- 0x2570,0x2571,0x2572,0x2573,0x2574,0x2575,0x2576,0x0000,
- 0x0000,0x0000,0x0000,0x2126,0x213C,0x2133,0x2134,0x0000
-};
-static const int ucs_a2_jis_table_min = 0x2000;
-static const int ucs_a2_jis_table_max = 0x2000 + (sizeof (ucs_a2_jis_table) / sizeof (unsigned short));
-
-
-static const unsigned short ucs_i_jis_table[] = {
- /* 4E00h */
- 0x306C,0x437A,0xB0A1,0x3C37,0xB0A2,0xB0A3,0x0000,0x4B7C,
- 0x3E66,0x3B30,0x3E65,0x323C,0xB0A4,0x4954,0x4D3F,0x0000,
- 0x5022,0x312F,0xB0A5,0x0000,0x336E,0x5023,0x4024,0x5242,
- 0x3556,0x4A3A,0x0000,0x0000,0x0000,0x0000,0x3E67,0xB0A6,
- 0x0000,0x4E3E,0x0000,0xB0A7,0xB0A8,0x0000,0x4A42,0x0000,
- 0xB0A9,0x0000,0x5024,0xB0AA,0x0000,0x4366,0xB0AB,0xB0AC,
- 0xB0AD,0x5025,0x367A,0x0000,0x0000,0xB0AE,0x5026,0x0000,
- 0x345D,0x4330,0x0000,0x3C67,0x5027,0x0000,0x0000,0x5028,
- 0xB0AF,0xB0B0,0x5029,0x4735,0xB0B1,0x3557,0x0000,0xB0B2,
- 0x0000,0x0000,0x0000,0x4737,0x0000,0x4663,0x3843,0x4B33,
- 0x0000,0xB0B3,0x0000,0x0000,0x0000,0x6949,0x502A,0x3E68,
- 0x502B,0x3235,0xB0B4,0x0000,0xB0B5,0x3665,0x3870,0x4C69,
- 0x0000,0x0000,0x5626,0xB0B6,0x0000,0x0000,0x0000,0x0000,
- 0xB0B7,0xB0B8,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x4D70,0x0000,0x467D,0xB0B9,0xB0BA,0x0000,0x0000,
- 0x0000,0xB0BB,0x0000,0x0000,0x0000,0x0000,0x3425,0xB0BC,
- 0x3535,0x0000,0x502C,0x0000,0x0000,0x502D,0x4E3B,0x0000,
- 0x4D3D,0x4168,0x502F,0x3B76,0x4673,0xB0BD,0x5032,0x0000,
- 0x0000,0x313E,0x385F,0x0000,0x385E,0x3066,0xB0BE,0xB0BF,
- 0x4F4B,0x4F4A,0x0000,0x3A33,0x3021,0xB0C0,0x5033,0x5034,
- 0x5035,0x4B34,0x5036,0x0000,0x3872,0x3067,0x4B72,0x0000,
- 0x357C,0x0000,0x0000,0x357D,0x357E,0x4462,0x4E3C,0xB0C1,
- 0x5037,0x0000,0x0000,0x5038,0x0000,0x0000,0x5039,0x0000,
- 0x0000,0xB0C2,0x3F4D,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x3D3A,0x3F4E,0x503E,0xB0C3,0x503C,0x0000,0x503D,0x3558,
- 0x0000,0x0000,0x3A23,0x3270,0x0000,0x503B,0x503A,0x4A29,
- 0xB0C4,0x0000,0x0000,0x0000,0x3B46,0x3B45,0x423E,0x503F,
- 0x4955,0x4067,0xB0C5,0xB0C6,0x0000,0x2138,0x5040,0x5042,
- 0xB0C7,0xB0C8,0xB0C9,0x4265,0x4E61,0x304A,0x0000,0x0000,
- 0xB0CA,0x0000,0x0000,0x0000,0x0000,0x5041,0x323E,0xB0CB,
- 0x3644,0xB0CC,0x4367,0xB0CD,0x0000,0xB0CE,0x376F,0x5043,
- 0x0000,0x0000,0x0000,0x4724,0x0000,0xB0CF,0xB0D0,0xB0D1,
-
- /* 4F00h */
- 0xB0D2,0x346B,0xB0D3,0xB0D4,0x0000,0x0000,0x0000,0x0000,
- 0xB0D5,0x5044,0x304B,0xB0D6,0xB0D7,0x3860,0x346C,0x497A,
- 0x4832,0x3559,0xB0D8,0x0000,0x0000,0xB0D9,0xB0DA,0xB0DB,
- 0x0000,0xB0DC,0x3271,0x0000,0x5067,0x4541,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xB0DD,0x476C,
- 0x5046,0xB0DE,0x0000,0xB0E0,0x483C,0xB0E1,0x4E62,0xB0E2,
- 0x3F2D,0xB0E3,0x3B47,0xB0E4,0x3B77,0x3240,0xB0E5,0x0000,
- 0xB0E6,0x0000,0xB0E7,0x4451,0x0000,0x0000,0x4322,0x504A,
- 0xB0E8,0xB0E9,0x0000,0xB0EA,0xB0EB,0x304C,0x4463,0x3D3B,
- 0x3A34,0x4D24,0xB0EC,0x424E,0xB0ED,0x323F,0xB0EE,0x5049,
- 0xB0EF,0x4D3E,0x5045,0x5047,0x3A6E,0x5048,0x5524,0xB0F0,
- 0xB0DF,0x0000,0x0000,0xB0F1,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x5050,0xB0F2,0x0000,0xB0F3,0x0000,0xB0F4,0x5053,
- 0x5051,0xB0F5,0x0000,0x3242,0x0000,0x4A3B,0x504B,0xB0F6,
- 0xB0F7,0xB0F8,0xB0F9,0x504F,0x3873,0xB0FA,0xB0FB,0x3B48,
- 0x0000,0xB0FC,0xB0FD,0x3426,0xB0FE,0xB1A1,0x5054,0x0000,
- 0x504C,0xB1A2,0xB1A3,0x4E63,0xB1A4,0x3B78,0xB1A5,0x504D,
- 0xB1A6,0x5052,0xB1A7,0xB1A8,0xB1A9,0x0000,0x5055,0xB1AA,
- 0x504E,0xB1AB,0xB1AC,0x3621,0x0000,0x304D,0xB1AD,0xB1AE,
- 0x3622,0x3241,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x5525,0x0000,0x4B79,0x496E,0x3874,
- 0x0000,0x0000,0xB1AF,0x0000,0x0000,0x3F2F,0x4E37,0xB1B0,
- 0x0000,0xB1B1,0x0000,0xB1B2,0xB1B3,0xB1B4,0xB1B5,0x4A58,
- 0xB1B6,0xB1B7,0x3738,0x4225,0x3264,0xB1B8,0xB1B9,0x0000,
- 0xB1BA,0xB1BB,0x3D53,0xB1BC,0xB1BD,0xB1BE,0x5059,0xB1BF,
- 0x505E,0x505C,0xB1C0,0x0000,0x5057,0x0000,0x0000,0x422F,
- 0x505A,0x0000,0x505D,0x505B,0xB1C1,0x4A5D,0x0000,0x5058,
- 0xB1C2,0x3F2E,0xB1C3,0x4B73,0x505F,0x5060,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x3D24,0x506D,
- 0xB1C4,0x0000,0xB1C5,0x4750,0x0000,0x4936,0x5068,0x0000,
- 0x4A70,0x0000,0x3236,0x0000,0xB1C6,0xB1C7,0x506C,0xB1C8,
-
- /* 5000h */
- 0xB1C9,0xB1CA,0x0000,0x0000,0xB1CB,0x5066,0x506F,0xB1CC,
- 0x0000,0x4152,0xB1CD,0x3844,0xB1CE,0x475C,0xB1CF,0x6047,
- 0xB1D0,0x506E,0x455D,0xB1D1,0x5063,0x0000,0x3876,0xB1D2,
- 0xB1D3,0x3875,0x5061,0xB1D4,0xB1D5,0xB1D6,0xB1D7,0x3C5A,
- 0x0000,0x5069,0xB1D8,0x4A6F,0x434D,0x5065,0x3771,0xB1D9,
- 0x5062,0x506A,0x5064,0x4E51,0x506B,0x4F41,0xB1DA,0x0000,
- 0xB1DB,0x0000,0xB1DC,0xB1DD,0x0000,0xB1DE,0x3666,0x0000,
- 0x0000,0x3770,0x0000,0xB1F6,0x0000,0x0000,0x0000,0x0000,
- 0xB1DF,0xB1E0,0xB1E1,0x5070,0x0000,0xB1E2,0xB1E3,0x5071,
- 0x5075,0x304E,0xB1E4,0x0000,0xB1E5,0x0000,0xB1E6,0x4A50,
- 0x5074,0xB1E7,0xB1E8,0xB1E9,0x0000,0x5073,0x5077,0xB1EA,
- 0x0000,0xB1EB,0x5076,0x0000,0x4464,0x0000,0x0000,0xB1EC,
- 0xB1ED,0x0000,0xB1EE,0xB1EF,0x0000,0x3772,0xB1F0,0xB1F1,
- 0x0000,0x0000,0xB1F2,0x0000,0x5078,0xB1F3,0x0000,0x0000,
- 0xB1F4,0xB1F5,0x3C45,0x0000,0x4226,0x4465,0x3676,0x0000,
- 0x5079,0x0000,0x0000,0x0000,0x0000,0x3536,0x0000,0x0000,
- 0x507A,0xB1F7,0x0000,0xB1F8,0xB1F9,0x507C,0xB1FA,0x0000,
- 0x0000,0x0000,0xB1FB,0x0000,0x0000,0x4B35,0xB1FC,0xB1FD,
- 0xB1FE,0x3766,0xB2A1,0xB2A2,0xB2A3,0x0000,0xB2A4,0x0000,
- 0x3B31,0x4877,0x507B,0xB2A5,0xB2A6,0x0000,0xB2A7,0xB2A8,
- 0xB2A9,0xB2AA,0xB2AB,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0xB2AC,0x0000,0x3A45,0x4D43,0x0000,0xB2AD,
- 0xB2AE,0x0000,0x507E,0x5123,0x507D,0x3A44,0x0000,0x3D7D,
- 0x0000,0xB2AF,0xB2B0,0x0000,0x0000,0xB2B1,0x3739,0x0000,
- 0xB2B2,0x0000,0x5124,0xB2B3,0xB2B4,0x364F,0x0000,0xB2B5,
- 0x0000,0x5121,0x5122,0x0000,0xB2B6,0x462F,0xB2B7,0x417C,
- 0xB2B8,0x3623,0x0000,0xB2B9,0xB2BA,0x4B4D,0x5125,0x0000,
- 0xB2BB,0x0000,0x4E3D,0x0000,0xB2BC,0xB2BD,0x5126,0xB2BE,
- 0x0000,0x0000,0xB2BF,0x5129,0xB2C0,0x5127,0xB2C1,0x414E,
- 0xB2C2,0xB2C3,0x0000,0x0000,0x0000,0x5128,0x512A,0xB2C4,
- 0x0000,0xB2C5,0xB2D1,0x0000,0x0000,0x512C,0xB2C6,0x0000,
- 0x0000,0x512B,0xB2C7,0x4A48,0x0000,0x0000,0xB2C8,0x0000,
-
- /* 5100h */
- 0x3537,0x512E,0x512F,0xB2C9,0x322F,0x0000,0xB2CA,0xB2CB,
- 0xB2CC,0x512D,0x0000,0xB2CD,0xB2CE,0xB2CF,0xB2D0,0x0000,
- 0xB2D2,0x0000,0x3C74,0x0000,0x5132,0x5131,0x5130,0xB2D3,
- 0x5056,0xB2D4,0x5133,0xB2D5,0xB2D6,0xB2D7,0xB2D8,0x3D7E,
- 0x0000,0x5134,0x0000,0xB2D9,0x0000,0x0000,0x0000,0xB2DA,
- 0xB2DB,0x0000,0x4D25,0x0000,0xB2DC,0xB2DD,0x0000,0xB2DE,
- 0x0000,0xB2DF,0x4C59,0xB2E0,0xB2E1,0xB2E2,0x0000,0x5136,
- 0xB2E3,0xB2E4,0x5135,0x5138,0x5137,0x0000,0x0000,0x5139,
- 0x513A,0x3074,0xB2E5,0x3835,0x373B,0x3D3C,0x437B,0x3624,
- 0x4068,0x3877,0xB2E6,0x396E,0x513C,0x4C48,0x4546,0xB2E7,
- 0x3B79,0x0000,0x513B,0xB2E8,0x513D,0xB2E9,0x0000,0xB2EA,
- 0xB2EB,0x0000,0x455E,0x0000,0x3375,0x0000,0x0000,0xB2EC,
- 0x0000,0x0000,0x513E,0x0000,0xB2ED,0x467E,0xB2EE,0x0000,
- 0x4134,0x5140,0x5141,0x482C,0x3878,0x4F3B,0x5142,0x0000,
- 0x0000,0x3626,0x0000,0x0000,0x0000,0x4A3C,0x4236,0x3671,
- 0x4535,0x0000,0x0000,0x0000,0x3773,0x0000,0xB2EF,0x0000,
- 0x5143,0x0000,0x5144,0xB2F0,0xB2F1,0x4662,0x315F,0x0000,
- 0x0000,0x5147,0x3A7D,0xB2F2,0x5146,0x3A46,0xB2F3,0x5148,
- 0x666E,0x5149,0x4B41,0x514A,0x0000,0x514B,0x514C,0x3E69,
- 0xB2F4,0x3C4C,0x0000,0x0000,0x0000,0xB2F5,0x0000,0x0000,
- 0x3427,0xB2F6,0x514F,0xB2F7,0x514D,0x4C3D,0x514E,0x0000,
- 0x495A,0x5150,0x5151,0x5152,0x455F,0xB2F8,0x0000,0x0000,
- 0x5156,0x5154,0x5155,0x5153,0x3A63,0x5157,0x4C6A,0x4E64,
- 0xB2F9,0x0000,0xB2FA,0x0000,0xB2FB,0x5158,0xB2FC,0xB2FD,
- 0x0000,0x0000,0xB2FE,0x0000,0x4028,0x5159,0x3D5A,0x0000,
- 0xB3A1,0x515A,0x0000,0x437C,0x4E3F,0x4560,0x0000,0xB3A2,
- 0x0000,0xB3A3,0xB3A4,0xB3A5,0x0000,0xB3A6,0x5245,0x0000,
- 0xB3A7,0x0000,0x0000,0x515B,0x7425,0x3645,0xB3A8,0x0000,
- 0x515C,0x4B5E,0xB3A9,0x0000,0x0000,0xB3AA,0x3D68,0x427C,
- 0x0000,0x515E,0x4664,0x0000,0x0000,0x515F,0xB3AB,0x0000,
- 0x5160,0x332E,0xB3AC,0xB3AD,0xB3AE,0x5161,0x3627,0xB3AF,
- 0x464C,0x317A,0x3D50,0x0000,0x0000,0x4821,0x5162,0x0000,
-
- /* 5200h */
- 0x4561,0xB3B0,0xB3B1,0x3F4F,0x5163,0xB3B2,0x4A2C,0x405A,
- 0x3422,0x0000,0x3429,0x5164,0x0000,0x0000,0x5166,0x0000,
- 0x0000,0x373A,0xB3B3,0xB3B4,0x5165,0xB3B5,0xB3B6,0x4E73,
- 0xB3B7,0x0000,0x0000,0x0000,0x0000,0x3D69,0x0000,0x0000,
- 0x0000,0x0000,0xB3B8,0x0000,0x483D,0x4A4C,0x0000,0x5167,
- 0xB3B9,0x4D78,0x5168,0x0000,0x0000,0x0000,0x5169,0x0000,
- 0x457E,0xB3BA,0xB3BB,0x516A,0x0000,0xB3BC,0x4029,0x3A7E,
- 0x3774,0x516B,0x3B49,0x396F,0xB3BD,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x4466,0x516D,0xB3BE,0x0000,0x4227,
- 0x0000,0xB3BF,0x3A6F,0x516E,0x516F,0x4130,0x0000,0x516C,
- 0x0000,0x0000,0x0000,0x0000,0x5171,0xB3C0,0x4B36,0xB3C1,
- 0xB3C2,0x0000,0xB3C3,0x3964,0xB3C4,0x0000,0x5170,0xB3C5,
- 0xB3C6,0xB3C7,0x0000,0x3775,0x3A5E,0x476D,0xB3C8,0x0000,
- 0x0000,0x5174,0x5172,0x0000,0x0000,0x0000,0xB3C9,0x497B,
- 0x3E6A,0x517B,0x3364,0x5175,0x5173,0x414F,0x0000,0xB3CA,
- 0xB3CB,0xB3CC,0x0000,0x0000,0x0000,0x5177,0x0000,0x5176,
- 0xB3CD,0x0000,0xB3CE,0x3344,0x0000,0xB3CF,0x0000,0x3760,
- 0x517C,0x4E2D,0xB3D0,0x0000,0xB3D1,0x5178,0x0000,0x0000,
- 0x0000,0x517D,0x517A,0xB3D2,0x5179,0xB3D3,0xB3D4,0xB3D5,
- 0xB3D6,0x0000,0xB3D7,0x4E4F,0xB3D8,0x0000,0x0000,0x3879,
- 0x3243,0x0000,0x0000,0x4E74,0xB3D9,0xB3DA,0xB3DB,0xB3DC,
- 0x0000,0x3D75,0x4558,0x3965,0x5222,0x5223,0x0000,0xB3DD,
- 0xB3DE,0x4E65,0x0000,0x0000,0x4F2B,0x5225,0xB3DF,0xB3E0,
- 0xB3E1,0x387A,0xB3E2,0xB3E3,0x5224,0xB3E4,0x332F,0x0000,
- 0xB3E5,0x5226,0x0000,0x4B56,0xB3E6,0x443C,0xB3E7,0x4D26,
- 0xB3E8,0x4A59,0x0000,0x0000,0xB3E9,0x5227,0x0000,0xB3EA,
- 0x0000,0xB3EB,0x7055,0x0000,0xB3EC,0x4630,0xB3ED,0x5228,
- 0x342A,0x4C33,0x0000,0xB3EE,0xB3EF,0x3E21,0x5229,0x4A67,
- 0x522D,0xB3F0,0x402A,0x522A,0x3650,0xB3F1,0x522B,0x342B,
- 0xB3F2,0xB3F3,0xB3F4,0x0000,0xB3F5,0x0000,0x0000,0x0000,
- 0xB3F6,0xB3F7,0x372E,0x522E,0xB3F8,0x522F,0xB3F9,0xB3FA,
- 0x5230,0x5231,0x3C5B,0x0000,0x0000,0x0000,0x387B,0x4C5E,
-
- /* 5300h */
- 0xB3FB,0x4C68,0x4677,0xB3FC,0x0000,0x4A71,0x5232,0x0000,
- 0x5233,0x0000,0xB3FD,0xB3FE,0xB4A1,0x5235,0x0000,0x5237,
- 0x5236,0xB4A2,0x0000,0xB4A3,0x0000,0x5238,0x323D,0x4B4C,
- 0xB4A4,0x3A7C,0x5239,0xB4A5,0xB4A6,0x4159,0xB4A7,0xB4A8,
- 0x3E22,0x3629,0x0000,0x523A,0x0000,0xB4A9,0x0000,0xB4AA,
- 0xB4AB,0xB4AC,0x485B,0xB4AD,0xB4AE,0xB4AF,0x0000,0x523B,
- 0xB4B0,0x523C,0xB4B1,0x523D,0x0000,0xB4B2,0x0000,0x0000,
- 0x523E,0x4924,0x3668,0x3065,0xB4B3,0xB4B4,0xB4B5,0x463F,
- 0x523F,0x3D3D,0xB4B6,0x4069,0x0000,0x5241,0x5240,0x3E23,
- 0x3861,0x5243,0x483E,0xB4B8,0xB4B7,0x5244,0x0000,0x0000,
- 0x0000,0x485C,0x4234,0x426E,0x3628,0x0000,0x0000,0x466E,
- 0x4331,0xB4B9,0x476E,0xB4BA,0x4B4E,0x0000,0x5246,0x0000,
- 0x406A,0xB4BB,0x0000,0xB4BC,0x0000,0xB4BD,0x3735,0x0000,
- 0x0000,0x5247,0x0000,0x0000,0xB4BE,0xB4BF,0x5248,0x312C,
- 0x3075,0x346D,0xB4C0,0x4228,0x3551,0x4D71,0x0000,0x524B,
- 0x3237,0xB4C1,0x0000,0x524A,0x0000,0x0000,0xB4C2,0x362A,
- 0x0000,0x0000,0x524C,0xB4C3,0x4C71,0x0000,0x0000,0xB4C4,
- 0xB4C5,0x0000,0x0000,0x0000,0x0000,0x0000,0xB4C6,0x0000,
- 0x0000,0x0000,0x0000,0xB4C7,0xB4C8,0x0000,0x524D,0x0000,
- 0x4E52,0xB4C9,0x387C,0x0000,0x0000,0xB4CA,0x0000,0x3836,
- 0x524E,0xB4CB,0x0000,0x0000,0xB4CC,0x5250,0x524F,0x0000,
- 0x3F5F,0x3139,0xB4CD,0xB4CE,0x0000,0x315E,0x5251,0xB4CF,
- 0x5252,0x0000,0xB4D0,0x3837,0xB4D1,0xB4D2,0x5253,0xB4D3,
- 0xB4D4,0x0000,0xB4D5,0x356E,0x0000,0xB4D6,0x0000,0x0000,
- 0xB4D7,0x0000,0x3B32,0x5254,0x0000,0xB4D8,0x0000,0x0000,
- 0x4B74,0x3A35,0x355A,0x4D27,0x4150,0x483F,0x3C7D,0xB4D9,
- 0x0000,0x0000,0xB4DA,0xB4DB,0x3D47,0xB4DC,0x3C68,0x3C75,
- 0x0000,0x3D76,0xB4DD,0x4840,0x0000,0xB4DE,0xB4DF,0x5257,
- 0xB4E0,0x3143,0x4151,0x387D,0x3845,0x3667,0xB4E1,0xB4E2,
- 0x525B,0x4321,0x427E,0x362B,0x3E24,0x525C,0x525A,0x3244,
- 0x4266,0x3C38,0x3B4B,0x3126,0x0000,0xB4E3,0x3370,0x3966,
- 0x3B4A,0x0000,0x525D,0x0000,0x0000,0x0000,0x0000,0x0000,
-
- /* 5400h */
- 0x0000,0x525E,0xB4E4,0x3549,0x3346,0x0000,0x0000,0x0000,
- 0x3967,0x3548,0x445F,0x3125,0x4631,0x4C3E,0x3921,0x4D79,
- 0x4547,0x387E,0x0000,0xB4E5,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0xB4E6,0x372F,0x0000,0x5267,0x0000,0x3663,
- 0x4B4A,0xB4E7,0x0000,0x0000,0x0000,0x0000,0x485D,0xB4E8,
- 0xB4E9,0x5266,0xB4EA,0x345E,0x5261,0x5262,0x5264,0xB4EB,
- 0x0000,0xB4EC,0x0000,0x0000,0xB4ED,0xB4EE,0x5265,0x0000,
- 0x355B,0x3F61,0x0000,0x4A2D,0x5263,0x525F,0x3863,0x0000,
- 0x5260,0x0000,0x4F24,0xB4EF,0xB4F0,0x0000,0x4A72,0xB4F1,
- 0x4468,0x3862,0x3970,0x0000,0x0000,0xB4F2,0x5268,0xB4F3,
- 0x0000,0x465D,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xB4F4,0x526C,
- 0x0000,0x0000,0xB4F5,0x0000,0xB4F6,0x0000,0xB4F7,0xB4F8,
- 0x3C7E,0xB4F9,0x3C76,0xB4FA,0x0000,0xB4FB,0xB4FC,0x0000,
- 0x526F,0x526D,0x0000,0x4C23,0xB4FD,0x526A,0x5273,0x526E,
- 0x0000,0x0000,0x0000,0x5271,0x3846,0x4C3F,0x0000,0xB4FE,
- 0x5272,0xB5A1,0x0000,0xB5A2,0x5274,0xB5A3,0x5276,0x0000,
- 0xB5A4,0xB5A5,0x0000,0x3A70,0x4F42,0xB5A6,0x526B,0x5269,
- 0x5275,0xB5A7,0x5270,0x0000,0x0000,0xB5A8,0xB5A9,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0xB5AA,0x0000,0x0000,0xB5AB,
- 0x0000,0xB5AC,0x5278,0x0000,0x5323,0x527A,0xB5AD,0xB5AE,
- 0x527E,0xB5AF,0xB5B0,0x5321,0x527B,0xB5B1,0xB5B2,0x533E,
- 0x0000,0xB5B3,0x3A69,0x3331,0x0000,0x0000,0x0000,0xB5B4,
- 0x5279,0xB5B5,0xB5B6,0xB5B7,0x5325,0x3076,0x5324,0xB5B8,
- 0x3025,0x494A,0x5322,0x0000,0x527C,0x0000,0xB5B9,0x5277,
- 0x527D,0x3A48,0xB5BA,0x0000,0x0000,0xB5BB,0xB5BC,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x5326,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0xB5BD,0x3077,0x532F,0x0000,0x0000,0x5327,0x5328,0x0000,
- 0x3E25,0x4B69,0xB5BE,0x0000,0xB5BF,0x532D,0x532C,0xB5C0,
- 0x0000,0x0000,0x452F,0x0000,0x0000,0x0000,0xB5C1,0x0000,
- 0x0000,0x0000,0x532E,0x0000,0xB5C2,0x532B,0xB5C3,0xB5C4,
-
- /* 5500h */
- 0xB5C5,0xB5C6,0x0000,0x0000,0x3134,0xB5C7,0x3A36,0x3F30,
- 0xB5C8,0xB5C9,0x0000,0x0000,0xB5CA,0xB5CB,0xB5CC,0x5329,
- 0x4562,0x0000,0x0000,0x0000,0x532A,0xB5CD,0x3022,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0xB5CE,0xB5CF,0x0000,0x0000,0x5334,0x4D23,
- 0x0000,0x3E27,0xB5D0,0x533A,0x0000,0xB5D1,0xB5D2,0x0000,
- 0x5339,0x5330,0x0000,0xB5D3,0xB5D4,0xB5D5,0x4243,0x0000,
- 0x5331,0xB5D6,0x0000,0x0000,0x426F,0x5336,0x3E26,0xB5D7,
- 0x0000,0xB5D8,0xB5D9,0x0000,0x5333,0xB5DA,0x0000,0x4C64,
- 0xB5DB,0xB5DC,0x0000,0x373C,0x0000,0x0000,0x5337,0x5338,
- 0xB5DD,0x0000,0xB5DE,0xB5DF,0x5335,0x533B,0xB5E0,0x0000,
- 0xB5E1,0xB5E2,0x0000,0x5332,0xB5E3,0x0000,0xB5E4,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x5341,0x5346,0x0000,0x5342,0xB5E5,
- 0x533D,0xB5E6,0xB5E7,0x5347,0x4131,0x0000,0xB5E8,0x5349,
- 0xB5E9,0x3922,0x533F,0x437D,0x0000,0x0000,0xB5EA,0xB5EB,
- 0x0000,0xB5EC,0xB5ED,0xB5EE,0xB5EF,0x0000,0x0000,0xB5F0,
- 0x5343,0x533C,0x342D,0x0000,0x346E,0x3365,0x5344,0x5340,
- 0x0000,0x0000,0x0000,0xB5F1,0xB5F2,0x0000,0x0000,0x3776,
- 0x534A,0x5348,0x4153,0x354A,0x362C,0xB5F3,0x5345,0x0000,
- 0x3674,0x0000,0xB5F4,0x0000,0x0000,0x0000,0x3144,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xB5F5,
- 0x0000,0xB5F6,0x0000,0xB5F7,0x534E,0x534C,0xB5F8,0x5427,
- 0x0000,0xB5F9,0x0000,0xB5FA,0xB5FB,0x0000,0xB5FC,0x0000,
- 0x0000,0xB5FD,0xB5FE,0xB6A1,0x5351,0x0000,0x0000,0xB6A2,
- 0xB6A3,0x0000,0x534B,0xB6A4,0x534F,0x0000,0xB6A5,0x534D,
- 0x0000,0x0000,0xB6A6,0x3B4C,0x5350,0x0000,0x0000,0x0000,
- 0x0000,0xB6A7,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xB6A8,0x5353,
- 0x0000,0x5358,0x0000,0x0000,0x0000,0x5356,0x5355,0xB6A9,
-
- /* 5600h */
- 0x0000,0x0000,0x0000,0x0000,0x0000,0xB6AA,0x4332,0x0000,
- 0xB6AB,0x3245,0xB6AC,0x0000,0x0000,0xB6AD,0xB6AE,0xB6AF,
- 0xB6B0,0xB6B1,0xB6B2,0x0000,0x5352,0x0000,0x5354,0x3E28,
- 0x3133,0xB6B3,0x0000,0x5357,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x325E,0x0000,0x0000,0xB6B4,0x0000,0x0000,0x5362,
- 0xB6B5,0x3E7C,0x535E,0xB6B6,0x535C,0xB6B7,0x535D,0xB6B8,
- 0x535F,0xB6B9,0x0000,0xB6BA,0xB6BB,0xB6BC,0x0000,0xB6BD,
- 0xB6BE,0xB6BF,0x313D,0xB6C0,0xB6C1,0x0000,0xB6C2,0x0000,
- 0x0000,0xB6C3,0x0000,0xB6C4,0x4139,0xB6C5,0x5359,0xB6C6,
- 0x535A,0x0000,0x0000,0x0000,0xB6C7,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x337A,0x0000,0x0000,0xB6C8,0x0000,
- 0xB6C9,0xB6CA,0xB6CB,0xB6CC,0x5361,0x0000,0xB6CD,0x0000,
- 0x346F,0xB6CE,0x5364,0x5360,0x5363,0xB6CF,0x0000,0xB6D0,
- 0x0000,0xB6D1,0xB6D2,0x0000,0x4A2E,0xB6D3,0x0000,0x0000,
- 0x4655,0x0000,0x4838,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x5366,0x0000,0x0000,0x0000,0xB6D4,0xB6D5,0x5365,0x3345,
- 0xB6D6,0x0000,0x5367,0xB6D7,0xB6D8,0x0000,0x0000,0x536A,
- 0x0000,0x0000,0x0000,0x0000,0x5369,0xB6D9,0x0000,0x0000,
- 0x0000,0xB6DA,0xB6DB,0x0000,0x0000,0xB6DC,0xB6DD,0xB6DE,
- 0x5368,0x0000,0x4739,0x0000,0x0000,0x536B,0xB6DF,0xB6E0,
- 0xB6E1,0xB6E2,0x0000,0xB6E3,0xB6E4,0xB6E5,0x536C,0x0000,
- 0x0000,0xB6E6,0x0000,0xB6E7,0x536E,0x0000,0x536D,0xB6E8,
- 0x0000,0x0000,0x0000,0x0000,0x5370,0x0000,0xB6E9,0x0000,
- 0x5373,0x5371,0x536F,0x5372,0x0000,0xB6EA,0x0000,0x0000,
- 0x5374,0xB6EB,0xB6EC,0xB6ED,0xB6F0,0xB6F1,0x5375,0xB6EE,
- 0xB6EF,0x5376,0x0000,0x5377,0x0000,0x0000,0x0000,0x5378,
- 0x5145,0xB6F2,0x3C7C,0x3B4D,0xB6F3,0xB6F4,0x3273,0xB6F5,
- 0x3078,0xB6F6,0x0000,0x4344,0xB6F7,0xB6F8,0xB6F9,0xB6FA,
- 0xB6FB,0x0000,0x0000,0xB6FD,0x0000,0xB6FE,0x5379,0x0000,
- 0x3A24,0xB6FC,0x304F,0x3F5E,0x0000,0x0000,0xB7A1,0xB7A2,
- 0x0000,0x537A,0x3847,0x0000,0x0000,0x3971,0x0000,0x537C,
-
- /* 5700h */
- 0x537B,0xB7A3,0xB7A4,0x4A60,0x537D,0x0000,0x0000,0xB7A5,
- 0x5421,0x537E,0xB7A6,0x5422,0xB7A7,0x5423,0x0000,0x3777,
- 0x0000,0xB7A8,0x3160,0x5424,0x0000,0xB7A9,0x5426,0x0000,
- 0x5425,0x0000,0xB7AA,0xB7AB,0x5428,0xB7AC,0x0000,0x455A,
- 0xB7AD,0x0000,0xB7AE,0xB7AF,0xB7B0,0xB7B1,0x5429,0x3035,
- 0x3A5F,0xB7B2,0xB7B3,0x0000,0xB7B4,0x373D,0xB7B5,0xB7B6,
- 0x434F,0x0000,0x0000,0xB7B7,0xB7B8,0x0000,0x0000,0x542A,
- 0x542B,0x0000,0x0000,0x542D,0x0000,0xB7B9,0xB7BA,0xB7BB,
- 0x542E,0x0000,0x3A64,0x0000,0x0000,0xB7BC,0xB7BD,0x3651,
- 0x0000,0x0000,0x4B37,0x0000,0xB7BE,0xB7BF,0x542C,0x542F,
- 0x3A41,0x3923,0xB7C0,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x5433,0xB7C1,0x0000,0x3A25,0xB7C2,0x4333,0xB7C3,
- 0xB7C4,0x5430,0x445A,0xB7C5,0x0000,0xB7C6,0xB7C7,0xB7C8,
- 0xB7C9,0xB7CA,0x0000,0xB7CB,0xB7CC,0xB7CD,0x0000,0xB7CE,
- 0x0000,0xB7CF,0xB7D0,0xB7D1,0xB7D2,0x0000,0xB7D3,0x5434,
- 0x0000,0xB7D4,0x3F62,0xB7D5,0x0000,0x0000,0x0000,0x0000,
- 0x5432,0x5435,0x0000,0x373F,0xB7D6,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x5436,0xB7D7,0xB7E0,0x0000,0xB7D8,
- 0x0000,0xB7D9,0xB7DA,0x0000,0xB7DB,0xB7DC,0xB7DD,0xB7DE,
- 0x5437,0xB7DF,0x3924,0x3340,0x5439,0x0000,0x0000,0xB7E1,
- 0xB7E2,0xB7E3,0x543A,0x0000,0xB7E4,0x0000,0x0000,0x0000,
- 0x543B,0x0000,0x0000,0x5438,0x0000,0x0000,0x0000,0x0000,
- 0xB7E5,0x0000,0x0000,0x0000,0x0000,0xB7E6,0x0000,0x0000,
- 0x5431,0x0000,0x0000,0x543C,0x0000,0x0000,0x543D,0xB7E7,
- 0xB7E8,0x0000,0x0000,0x4B64,0xB7E9,0x0000,0x3E6B,0xB7EA,
- 0x0000,0x0000,0x543F,0x5440,0x543E,0xB7EB,0x5442,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x4738,0xB7EC,0xB7ED,0x3068,
- 0x4956,0xB7FE,0x0000,0x5443,0xB7EE,0x0000,0xB7EF,0xB7F0,
- 0x0000,0xB7F1,0x0000,0x0000,0x0000,0xB7F2,0x0000,0x0000,
- 0xB7F3,0x0000,0x0000,0x0000,0x3E7D,0xB7F4,0xB7F5,0x3C39,
- 0xB7F6,0x475D,0x3470,0x0000,0x3A6B,0xB7F7,0xB7F8,0xB7F9,
-
- /* 5800h */
- 0x4B59,0x0000,0x4632,0xB7FA,0xB7FB,0x3778,0x424F,0x0000,
- 0xB7FC,0xB7FD,0x5441,0x5444,0xB8A1,0xB8A2,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x4244,0x0000,0x0000,
- 0x0000,0x5445,0x0000,0xB8A3,0x0000,0x5446,0xB8A4,0xB8A5,
- 0xB8A6,0x5448,0x0000,0x0000,0x4469,0x0000,0xB8A7,0xB8A8,
- 0x0000,0x0000,0x342E,0x0000,0x0000,0xB8A9,0x0000,0x7421,
- 0x3161,0x4A73,0xB8AA,0x0000,0x3E6C,0x4548,0x0000,0x0000,
- 0x0000,0xB8AB,0x3A66,0x0000,0x0000,0x544E,0x0000,0xB8AC,
- 0x4A3D,0x4E5D,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0xB8AD,0x3274,0x544A,0xB8AE,0xB8AF,0x0000,0xB8B0,
- 0xB8B1,0x413A,0x544D,0x0000,0x4563,0xB8B2,0x0000,0x4549,
- 0x4564,0x4839,0x444D,0x0000,0x0000,0x0000,0x3A49,0xB8B3,
- 0x0000,0xB8B4,0x5449,0x0000,0xB8B5,0x0000,0x0000,0xB8B6,
- 0xB8B7,0x3176,0x0000,0x4536,0x0000,0x0000,0x0000,0x0000,
- 0x544B,0x0000,0x5447,0x0000,0x0000,0x3F50,0x0000,0x0000,
- 0xB8B8,0x544F,0x0000,0x0000,0xB8B9,0x0000,0x3D4E,0xB8BA,
- 0xB8BB,0xB8BC,0x0000,0x362D,0x0000,0x5450,0x0000,0xB8BD,
- 0xB8BE,0xB8BF,0xB8C0,0x0000,0xB8C1,0xB8C2,0x0000,0xB8C3,
- 0xB8C4,0x0000,0x0000,0x4A68,0xB8C5,0x0000,0xB8C6,0x417D,
- 0x0000,0x0000,0x0000,0x0000,0x4446,0xB8C7,0x0000,0x5452,
- 0xB8C8,0xB8C9,0xB8CA,0x0000,0x0000,0x0000,0xB8CB,0x0000,
- 0x4B4F,0xB8CC,0x0000,0x5453,0x0000,0x0000,0x5458,0x0000,
- 0x0000,0xB8CD,0xB8CE,0x4A2F,0x0000,0x0000,0x0000,0x0000,
- 0x5457,0x5451,0x5454,0x5456,0xB8D0,0x0000,0x3A26,0x0000,
- 0x0000,0x4A49,0xB8D1,0x0000,0xB8CF,0x5459,0x0000,0x4345,
- 0xB8D2,0x0000,0x3275,0x0000,0x3E6D,0xB8D3,0xB8D4,0x0000,
- 0xB8D5,0x545B,0xB8D6,0x545A,0xB8D7,0x3968,0xB8D8,0x545C,
- 0x545E,0x545D,0xB8D9,0x0000,0x5460,0xB8DA,0x5455,0x5462,
- 0x0000,0xB8DB,0xB8DC,0x0000,0x5461,0x545F,0x0000,0x0000,
- 0x0000,0xB8DD,0x0000,0x3B4E,0x3F51,0x0000,0x4154,0x5463,
- 0x403C,0x306D,0x4764,0xB8DE,0x0000,0x0000,0x0000,0x445B,
- 0x0000,0x5465,0x5464,0x5466,0x5467,0x5468,0x0000,0x0000,
-
- /* 5900h */
- 0x0000,0x0000,0x5469,0x0000,0x0000,0xB8DF,0xB8E0,0x0000,
- 0x0000,0x4A51,0x546A,0xB8E1,0xB8E2,0x0000,0x0000,0x3246,
- 0x546B,0x0000,0xB8E3,0xB8E4,0xB8E5,0x4D3C,0x3330,0x0000,
- 0x5249,0x3D48,0x423F,0x546C,0x4C6B,0xB8E7,0x0000,0x0000,
- 0x0000,0xB8E8,0x4C34,0xB8E9,0xB8EA,0x546E,0x0000,0x4267,
- 0xB8EB,0x4537,0x4240,0x4957,0x546F,0x5470,0x317B,0xB8EC,
- 0xB8ED,0x3C3A,0x5471,0xB8EE,0x0000,0xB8EF,0xB8F0,0x3050,
- 0x5472,0x0000,0x0000,0x0000,0x0000,0x0000,0x5473,0xB8F1,
- 0x0000,0x0000,0x0000,0xB8F2,0x3162,0x0000,0xB8F3,0x3471,
- 0x4660,0x4A74,0x0000,0x0000,0x0000,0x0000,0x5477,0x4155,
- 0x5476,0x3740,0xB8F4,0xB8F5,0x4B5B,0x5475,0x0000,0x4565,
- 0x5479,0xB8F6,0x5478,0xB8F7,0x0000,0xB8F8,0xB8F9,0xB8FA,
- 0x547B,0xB8FB,0x547A,0xB8FC,0x0000,0x317C,0x0000,0x547C,
- 0x3E29,0x547E,0x4325,0xB8FD,0x547D,0xB8FE,0x4A33,0xB9A1,
- 0x0000,0x0000,0xB9A2,0x3D77,0x455B,0xB9A3,0xB9A4,0x0000,
- 0x5521,0xB9A5,0x0000,0xB9A6,0xB9A7,0x3925,0x0000,0x0000,
- 0x0000,0x5522,0x4721,0x485E,0x4C51,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x4725,0xB9A8,0xB9A9,0x552B,0xB9AA,0x0000,
- 0x0000,0x0000,0xB9AB,0x3538,0x0000,0xB9AC,0x4D45,0xB9AD,
- 0x0000,0x4C2F,0x0000,0x562C,0x0000,0x5523,0x0000,0xB9AE,
- 0x0000,0x0000,0x0000,0x5526,0xB9AF,0x4245,0x0000,0xB9B0,
- 0x4B38,0x0000,0x0000,0x0000,0x454A,0xB9B1,0xB9B2,0xB9B3,
- 0xB9B4,0x0000,0x5527,0xB9B5,0x0000,0x0000,0x0000,0xB9B6,
- 0x0000,0x4B65,0xB9B7,0x3A4A,0xB9B8,0x0000,0x3E2A,0x0000,
- 0x0000,0xB9B9,0x0000,0xB9BA,0xB9BB,0x0000,0x5528,0x0000,
- 0xB9BC,0x3B50,0xB9BD,0x3B4F,0x0000,0xB9BE,0x0000,0x0000,
- 0x3039,0x3848,0xB9BF,0x402B,0x3051,0x0000,0x0000,0x0000,
- 0x0000,0x552C,0x552D,0x0000,0x552A,0xB9C0,0xB9C1,0xB9C2,
- 0x0000,0x0000,0x0000,0xB9C3,0xB9C4,0x3138,0x342F,0xB9C5,
- 0x5529,0x0000,0x4C45,0x4931,0x0000,0x0000,0xB9C6,0xB9C7,
- 0x0000,0xB9C8,0xB9C9,0x0000,0xB9CA,0x0000,0x3028,0xB9CB,
- 0x0000,0x0000,0x0000,0x3079,0x0000,0x0000,0x0000,0x3B51,
-
- /* 5A00h */
- 0xB9CC,0x3052,0x0000,0x3023,0xB9CD,0x0000,0x0000,0x0000,
- 0x0000,0x5532,0x0000,0x0000,0xB9CE,0xB9CF,0xB9D0,0x0000,
- 0x0000,0x5530,0xB9D1,0xB9D2,0x0000,0x0000,0x0000,0x0000,
- 0x4C3C,0x0000,0x5533,0x0000,0x5531,0x0000,0xB9D3,0x552F,
- 0x3F31,0x0000,0x0000,0xB9D4,0xB9D5,0x552E,0x0000,0xB9D6,
- 0xB9D7,0x4A5A,0xB9D8,0x0000,0x0000,0xB9D9,0x0000,0x3864,
- 0xB9DA,0x0000,0x0000,0x0000,0x0000,0x5537,0x5538,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x3E2B,0x0000,0x0000,0x0000,
- 0x5534,0x4F2C,0x0000,0x0000,0xB9DB,0xB9DC,0x474C,0xB9DD,
- 0xB9DE,0x5536,0x0000,0x0000,0xB9DF,0x0000,0x0000,0x0000,
- 0xB9E0,0x0000,0x0000,0x0000,0x0000,0xB9E1,0x0000,0x0000,
- 0x0000,0x0000,0x3A27,0x0000,0x0000,0x0000,0xB9E2,0x0000,
- 0x0000,0x0000,0x5539,0xB9E3,0x0000,0xB9E4,0x4958,0xB9E5,
- 0x0000,0x0000,0x553A,0x0000,0x5535,0xB9E6,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xB9E7,
- 0x0000,0x0000,0xB9E8,0xB9E9,0x0000,0x0000,0xB9EA,0x4C3B,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0xB9EB,0x0000,0x0000,0x0000,0x0000,
- 0xB9EC,0x0000,0x475E,0xB9ED,0x0000,0x0000,0xB9EE,0x0000,
- 0x0000,0xB9EF,0x553B,0x4932,0xB9F0,0x0000,0xB9F1,0xB9F2,
- 0xB9F3,0x0000,0xB9F4,0x0000,0x0000,0x0000,0x0000,0xB9F5,
- 0x0000,0x0000,0x0000,0x0000,0xB9F6,0x0000,0x0000,0x0000,
- 0x0000,0xB9F7,0xB9F8,0xB9F9,0x0000,0xB9FA,0x0000,0x0000,
- 0xB9FB,0x0000,0xB9FC,0xB9FD,0x553C,0x5540,0x553D,0xB9FE,
- 0x0000,0x3247,0x553F,0x0000,0xBAA1,0x0000,0xBAA2,0x0000,
- 0xBAA3,0x3C3B,0x0000,0x553E,0x3779,0x0000,0x0000,0xBAA4,
- 0x554C,0x0000,0x0000,0x0000,0x0000,0x0000,0x5545,0x5542,
- 0x0000,0x0000,0xBAA5,0x0000,0xBAA6,0x0000,0x0000,0x0000,
- 0xBAA7,0x4364,0x0000,0x5541,0x0000,0xBAA8,0x5543,0x0000,
- 0x0000,0x5544,0xBAA9,0x0000,0x0000,0x0000,0xBAAA,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0xBAAB,0xBAAC,0x0000,
- 0x0000,0x0000,0x5546,0x5547,0x0000,0xBAAD,0x0000,0x0000,
-
- /* 5B00h */
- 0xBAAE,0xBAAF,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0xBAB0,0x3472,0x0000,0x5549,0x5548,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x554A,0xBAB1,
- 0x0000,0xBAB3,0x0000,0xBAB4,0x0000,0xBAB5,0x0000,0x0000,
- 0x0000,0xBAB6,0x3E6E,0x0000,0x0000,0xBAB7,0x0000,0x0000,
- 0x0000,0x0000,0x554D,0x0000,0x445C,0xBAB8,0x0000,0x0000,
- 0x3145,0x0000,0x554B,0x0000,0xBAB2,0x0000,0x554E,0x0000,
- 0xBAB9,0x0000,0x0000,0x0000,0x0000,0x0000,0x554F,0x0000,
- 0x5552,0xBABA,0x0000,0x5550,0x0000,0x5551,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0xBABB,0xBABC,0x0000,0x0000,0x0000,
- 0x3B52,0x5553,0xBABD,0x0000,0x3926,0x5554,0xBABE,0x3B7A,
- 0x4238,0x0000,0x5555,0x5556,0x3B5A,0x3927,0xBABF,0x4C52,
- 0x0000,0x0000,0x0000,0x3528,0x3849,0x5557,0x3358,0x0000,
- 0xBAC0,0x5558,0x0000,0x4239,0x0000,0x0000,0xBAC1,0xBAC2,
- 0x5559,0x5623,0x0000,0x555A,0x0000,0x555B,0x0000,0x0000,
- 0x555C,0x0000,0x555E,0x0000,0xBAC3,0xBAC4,0xBAC5,0xBAC6,
- 0x555F,0xBAC7,0x0000,0x5560,0xBAC8,0x4270,0xBAC9,0x3127,
- 0x3C69,0x3042,0xBACA,0x4157,0x3430,0x3C35,0xBACB,0x3928,
- 0xBACC,0xBACD,0x0000,0xBACE,0xBACF,0x4566,0xBAD0,0x3D21,
- 0x3431,0x4368,0x446A,0x3038,0x3539,0x4A75,0x0000,0x3C42,
- 0x0000,0x0000,0x3552,0x406B,0x3C3C,0x4D28,0x5561,0x0000,
- 0xBAD1,0xBAD2,0x0000,0x0000,0xBAD3,0xBAD4,0x355C,0xBAD5,
- 0x3A4B,0xBAD6,0xBAD7,0x3332,0x3163,0x3E2C,0x3248,0xBAD8,
- 0x5562,0x4D46,0xBAD9,0x0000,0xBADA,0x0000,0x0000,0x3D49,
- 0xBADB,0xBADC,0x3C64,0x5563,0x3473,0x4652,0x4C29,0x5564,
- 0x0000,0x5565,0x0000,0x0000,0x4959,0xBADD,0x0000,0xBADE,
- 0x5567,0x0000,0x3428,0x3677,0x5566,0x0000,0xBADF,0xBAE0,
- 0xBAE1,0xBAE2,0xBAE3,0x3432,0x0000,0x3F32,0x556B,0x3B21,
- 0xBAE4,0x3249,0x556A,0x0000,0x5568,0x556C,0x5569,0x472B,
- 0x5C4D,0x3F33,0x0000,0x556D,0x0000,0x0000,0x4E40,0xBAE5,
- 0x556E,0xBAE6,0x0000,0x5570,0xBAE7,0x437E,0x556F,0x0000,
- 0x4023,0x0000,0x3B7B,0x0000,0x0000,0xBAE8,0x4250,0x3C77,
-
- /* 5C00h */
- 0x0000,0x4975,0x406C,0x0000,0x3C4D,0x5571,0x3E2D,0x5572,
- 0x5573,0x3053,0x423A,0x3F52,0xBAE9,0x5574,0x4633,0x3E2E,
- 0x0000,0x3E2F,0x0000,0x5575,0x0000,0x0000,0x406D,0xBAEA,
- 0x0000,0x0000,0x3E30,0x0000,0x0000,0x0000,0xBAEB,0xBAEC,
- 0x5576,0x0000,0x5577,0xBAED,0x4C60,0x0000,0xBAEE,0x0000,
- 0x5578,0xBAEF,0x0000,0xBAF0,0xBAF1,0x3646,0xBAF2,0x0000,
- 0xBAF3,0x3D22,0xBAF4,0x0000,0x0000,0xBAF5,0xBAF6,0x0000,
- 0x5579,0x557A,0x3C5C,0x3F2C,0x4674,0x3F54,0x4878,0x4722,
- 0x3649,0x557B,0x0000,0x0000,0x0000,0x356F,0x557C,0x0000,
- 0x367E,0x0000,0x464F,0x3230,0x0000,0x3B53,0x557D,0x5622,
- 0x5621,0x367D,0x0000,0x557E,0x0000,0x4538,0x0000,0x0000,
- 0x0000,0xBAF7,0xBAF8,0x0000,0xBAF9,0x0000,0x4230,0x0000,
- 0x454B,0x3C48,0xBAFA,0xBAFB,0x4158,0x4D7A,0x0000,0xBAFC,
- 0xBAFD,0xBAFE,0x0000,0x0000,0x5624,0xBBA1,0x5625,0x4656,
- 0xBBA2,0x3B33,0x0000,0x0000,0xBBA3,0xBBA4,0x5627,0x0000,
- 0x0000,0x5628,0xBBA5,0xBBA6,0xBBA7,0xBBA8,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xBBA9,
- 0xBBAA,0x0000,0xBBAB,0x0000,0x5629,0x0000,0x0000,0xBBAC,
- 0x3474,0x562A,0xBBAD,0x0000,0x562B,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0xBBAE,0x0000,0xBBAF,
- 0xBBB0,0x322C,0xBBB1,0xBBB2,0x0000,0x0000,0xBBB3,0x0000,
- 0x413B,0x3464,0xBBB4,0x562D,0x4C28,0x0000,0x0000,0x0000,
- 0x0000,0x4252,0xBBB5,0x3359,0xBBB6,0xBBB7,0x562F,0x5631,
- 0x345F,0x0000,0xBBB8,0x562E,0x5630,0x0000,0x5633,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x5632,0x0000,0x5634,
- 0x0000,0xBBB9,0x0000,0xBBBA,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0xBBBB,0x0000,0x0000,0x0000,0x0000,0xBBBD,
- 0x0000,0x5635,0x0000,0x0000,0x0000,0xBBBC,0x0000,0x0000,
- 0x463D,0x362E,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x3265,0x5636,0x563B,0x0000,0x0000,0x5639,0xBBBE,0x4A77,
- 0x4A76,0xBBBF,0xBBC0,0x0000,0xBBC1,0x0000,0x4567,0x0000,
- 0x0000,0x0000,0x5638,0x3D54,0x0000,0x5637,0x0000,0x0000,
-
- /* 5D00h */
- 0x0000,0xBBC2,0x0000,0x0000,0x0000,0x0000,0xBBC3,0x3F72,
- 0x0000,0x0000,0x0000,0x563C,0x0000,0xBBC4,0x3A6A,0x0000,
- 0x0000,0x5642,0xBBC5,0x0000,0x5643,0x563D,0x3333,0x563E,
- 0x5647,0x5646,0x5645,0x5641,0x0000,0x0000,0x0000,0x5640,
- 0x0000,0x0000,0x5644,0xBBC7,0xBBC8,0x0000,0xBBC9,0xBBCA,
- 0x0000,0x4A78,0x0000,0xBBC6,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0xBBCB,0x0000,0x0000,0xBBCC,0x0000,0x0000,0x0000,
- 0x0000,0xBBCD,0x0000,0x0000,0x0000,0xBBCE,0x0000,0xBBCF,
- 0x0000,0x0000,0xBBD0,0xBBD1,0x0000,0x0000,0xBBD2,0x0000,
- 0xBBD3,0x0000,0xBBD7,0x564B,0x5648,0x0000,0x564A,0x0000,
- 0x4D72,0xBBD5,0x5649,0x0000,0x0000,0xBBD4,0x0000,0x0000,
- 0x0000,0xBBD6,0x0000,0x0000,0x563F,0x0000,0x0000,0xBBD8,
- 0xBBD9,0xBBDA,0xBBDB,0x0000,0xBBDC,0x0000,0x0000,0x0000,
- 0x0000,0x3F73,0xBBDD,0x0000,0x564C,0xBBDE,0x0000,0x3A37,
- 0xBBDF,0x0000,0x0000,0x564D,0x0000,0x0000,0x564E,0x0000,
- 0x0000,0xBBE0,0xBBE1,0x0000,0x0000,0x0000,0xBBE2,0xBBE3,
- 0x0000,0xBBE4,0x5651,0xBBE5,0x5650,0x0000,0x0000,0x564F,
- 0xBBE6,0x0000,0xBBE7,0x4568,0x563A,0x0000,0x0000,0x0000,
- 0x5657,0x0000,0xBBE8,0xBBE9,0xBBEA,0xBBEB,0x0000,0x0000,
- 0x0000,0xBBEC,0x0000,0xBBED,0x0000,0x5653,0x0000,0xBBEE,
- 0xBBEF,0x0000,0x5652,0x0000,0x0000,0x0000,0x0000,0xBBF0,
- 0x0000,0x0000,0x0000,0xBBF1,0x5654,0x0000,0x5655,0x0000,
- 0xBBF2,0x0000,0xE6F4,0x0000,0xBBF3,0x0000,0x0000,0x5658,
- 0xBBF4,0xBBF5,0x4E66,0x0000,0x5659,0x5656,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0xBBF6,0x0000,0x0000,0x0000,0xBBF7,
- 0x0000,0x565A,0x0000,0xBBF8,0x3460,0x565B,0xBBFA,0x0000,
- 0xBBF9,0x0000,0x565D,0x565C,0x0000,0x0000,0x565E,0x0000,
- 0xBBFB,0xBBFC,0x0000,0x565F,0x0000,0x406E,0x3D23,0x0000,
- 0xBBFD,0x3D64,0x0000,0x4163,0xBBFE,0x3929,0x3A38,0x392A,
- 0x3570,0xBCA1,0x0000,0x5660,0x0000,0x0000,0x3A39,0x0000,
- 0x0000,0x384A,0x5661,0x4C26,0x4743,0x5662,0x0000,0x392B,
- 0xBCA2,0xBCA3,0x0000,0x342C,0x0000,0x4327,0x3652,0x0000,
-
- /* 5E00h */
- 0xBCA4,0x0000,0x3B54,0x495B,0x0000,0x0000,0x4841,0xBCA5,
- 0x0000,0x0000,0x0000,0x5663,0x3475,0xBCA6,0x0000,0x0000,
- 0x0000,0x5666,0xBCA7,0x0000,0xBCA8,0xBCA9,0x4421,0x0000,
- 0xBCAA,0x5665,0x5664,0x5667,0x0000,0x446B,0x0000,0xBCAB,
- 0xBCAC,0x0000,0x0000,0x0000,0x0000,0x3F63,0x0000,0x0000,
- 0xBCAE,0x0000,0x0000,0x3B55,0x0000,0x404A,0xBCAD,0x4253,
- 0x3522,0x0000,0xBCAF,0x4422,0x0000,0xBCB0,0x5668,0x5669,
- 0x3E6F,0x0000,0x0000,0x0000,0x0000,0x4B39,0xBCB1,0x0000,
- 0x566C,0x0000,0x0000,0x566B,0x566A,0x497D,0x0000,0x5673,
- 0x0000,0xBCB4,0x0000,0xBCB2,0x4B5A,0x0000,0x566D,0x0000,
- 0xBCB3,0xBCB5,0x0000,0x0000,0x566F,0x4B6B,0xBCB6,0x566E,
- 0xBCB7,0x0000,0x0000,0xBCB8,0xBCB9,0x0000,0xBCBA,0x5670,
- 0x0000,0x4828,0x5671,0x4A3E,0x5672,0x0000,0x0000,0x0000,
- 0xBCBB,0x0000,0xBCBC,0xBCBD,0xBCBE,0xBCBF,0xBCC0,0x0000,
- 0xBCC1,0x0000,0x3433,0x4A3F,0x472F,0x5674,0x5675,0x0000,
- 0x392C,0x3434,0x5676,0x3838,0x4D44,0x4D29,0x3476,0x5678,
- 0xBCC2,0x4423,0x0000,0x392D,0x3E31,0x0000,0x0000,0x485F,
- 0x0000,0x0000,0x3E32,0xBCC3,0x0000,0x0000,0xBCC4,0x3D78,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x446C,0x4A79,0x4539,
- 0x0000,0x0000,0x392E,0x0000,0x495C,0x0000,0x0000,0x0000,
- 0x5679,0x0000,0xBCC5,0x0000,0xBCC6,0xBCC7,0x4559,0x3A42,
- 0xBCC8,0x0000,0xBCC9,0x384B,0xBCCA,0x446D,0x0000,0x0000,
- 0x0000,0xBCCB,0x0000,0xBCCC,0x0000,0x3043,0x3D6E,0x392F,
- 0x4D47,0x0000,0x0000,0x0000,0x0000,0xBCCD,0xBCCE,0xBCCF,
- 0x0000,0x567A,0x567B,0x4751,0x0000,0x0000,0xBCD0,0x0000,
- 0x567C,0x4E77,0x4F2D,0xBCD2,0xBCD1,0x0000,0xBCD3,0x567E,
- 0x567D,0xBCD4,0xBCD5,0x3347,0xBCD6,0xBCD7,0x5721,0x0000,
- 0x0000,0x0000,0x5724,0x5725,0xBCD8,0x5723,0xBCD9,0x4940,
- 0x3E33,0x5727,0x5726,0x5722,0x0000,0xBCDA,0x0000,0x0000,
- 0x5728,0x5729,0x0000,0xBCDB,0x572A,0x0000,0x0000,0x0000,
- 0x572D,0x572B,0x0000,0x572C,0x572E,0x0000,0x3164,0x446E,
- 0x572F,0x0000,0x377A,0x3276,0x4736,0x0000,0x5730,0x467B,
-
- /* 5F00h */
- 0x0000,0x4A5B,0xBCDC,0x5731,0x4F2E,0x0000,0xBCDD,0xBCDE,
- 0xBCDF,0x5732,0x4A40,0x5735,0x5021,0x5031,0xBCE0,0x3C30,
- 0x4675,0x5736,0x0000,0x355D,0x4424,0x307A,0x5737,0x4A26,
- 0x3930,0xBCE1,0x0000,0x4350,0xBCE2,0xBCE3,0x0000,0x446F,
- 0x0000,0xBCE4,0xBCE5,0xBCE6,0xBCE7,0x4C6F,0x3839,0x384C,
- 0xBCE8,0x5738,0x0000,0xBCE9,0xBCEA,0x5739,0xBCEB,0x573F,
- 0xBCEC,0x3C65,0x0000,0x0000,0xBCED,0x4425,0xBCEE,0x362F,
- 0x573A,0x0000,0x0000,0xBCEF,0x492B,0xBCF0,0x4346,0xBCF1,
- 0xBCF2,0x573B,0x0000,0x0000,0xBCF3,0xBCF4,0x0000,0xBCF5,
- 0x573C,0x0000,0x3630,0x0000,0x573D,0xBCF6,0x573E,0x0000,
- 0xBCF7,0x5740,0x0000,0x4576,0xBCF8,0x0000,0x5741,0x5742,
- 0xBCF9,0x5743,0x0000,0xBCFA,0x5734,0x5733,0x0000,0x0000,
- 0xBCFB,0x5744,0x3741,0xBCFC,0xBCFD,0x0000,0x4927,0xBCFE,
- 0x0000,0x3A4C,0x4937,0x4426,0x494B,0x5745,0x0000,0xBDA1,
- 0x3E34,0x3146,0xBDA2,0x5746,0xBDA3,0xBDA4,0x0000,0x5747,
- 0xBDA5,0x4C72,0xBDA6,0x0000,0x4860,0xBDA7,0xBDA8,0x574A,
- 0x317D,0x402C,0x5749,0x5748,0x3742,0x4254,0x0000,0x574E,
- 0x574C,0xBDA9,0x574B,0x4E27,0x3865,0xBDAA,0x0000,0xBDAB,
- 0x3D79,0x574D,0x454C,0x3D3E,0x0000,0x0000,0xBDAC,0x4640,
- 0x5751,0x5750,0x0000,0x0000,0xBDAD,0xBDAE,0x574F,0x0000,
- 0x5752,0x3866,0xBDAF,0x0000,0xBDB2,0x0000,0x0000,0xBDB0,
- 0x5753,0x497C,0x3D5B,0xBDB1,0xBDB3,0x5754,0x4879,0xBDB4,
- 0xBDB5,0xBDB6,0x0000,0x4641,0x4427,0x0000,0x0000,0x0000,
- 0xBDB7,0x4530,0x0000,0x0000,0x5755,0x352B,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x3F34,0xBDB8,0x492C,0x0000,0xBDB9,
- 0xBDBA,0xBDBB,0x0000,0xBDBC,0x3477,0x4726,0x0000,0x0000,
- 0xBDBD,0xBDBE,0xBDBF,0xBDC0,0xBDC1,0x0000,0x5756,0x3B56,
- 0x4B3A,0x4B3B,0x0000,0x0000,0x317E,0x575B,0xBDC2,0x0000,
- 0x4369,0xBDC3,0xBDC4,0x0000,0x5758,0x0000,0x0000,0x0000,
- 0xBDC5,0xBDC6,0xBDC7,0x3277,0xBDC8,0xBDC9,0xBDCA,0xBDCB,
- 0x582D,0x575A,0xBDCC,0xBDCD,0x0000,0x4730,0xBDCE,0x0000,
- 0x5759,0x0000,0xBDCF,0x5757,0xBDD0,0x397A,0x0000,0x575D,
-
- /* 6000h */
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xBDD1,
- 0x0000,0x0000,0xBDD2,0x0000,0x0000,0xBDD3,0x5763,0x5769,
- 0x5761,0x0000,0x455C,0xBDD4,0xBDD5,0x5766,0x495D,0xBDD6,
- 0xBDD7,0x5760,0xBDD8,0x5765,0x4E67,0x3B57,0x0000,0xBDD9,
- 0x4255,0x575E,0x0000,0x0000,0xBDDA,0x355E,0x5768,0x402D,
- 0x3165,0x5762,0x3278,0x5767,0x0000,0xBDDB,0x0000,0x3631,
- 0x0000,0x5764,0x0000,0xBDDC,0x0000,0xBDDD,0x0000,0x0000,
- 0x0000,0x0000,0x576A,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0xBDDE,0x576C,0x5776,0x5774,0x0000,0x0000,0x5771,0xBDDF,
- 0xBDE0,0xBDE1,0x5770,0x4E78,0xBDE2,0x5772,0x0000,0x0000,
- 0x3632,0xBDE3,0x3931,0x0000,0xBDE4,0x3D7A,0xBDE5,0xBDE6,
- 0x0000,0x5779,0x576B,0x0000,0x0000,0xBDE7,0x0000,0x576F,
- 0x575F,0xBDE8,0x327A,0x5773,0x5775,0x4351,0x0000,0xBDE9,
- 0x3A28,0x3238,0x576D,0x5778,0x5777,0x3633,0x0000,0x4229,
- 0x3366,0xBDEA,0x0000,0x0000,0x0000,0x3743,0x0000,0x576E,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xBDEB,0xBDEC,
- 0x0000,0x577A,0xBDED,0x577D,0x5821,0x0000,0xBDEE,0x0000,
- 0xBDEF,0x3C3D,0xBDF0,0x5827,0x4470,0x577B,0xBDF1,0x0000,
- 0x0000,0xBDF2,0x5825,0xBDF3,0x3279,0xBDF4,0x5823,0x5824,
- 0xBDF5,0x0000,0x577E,0x5822,0x0000,0xBDF6,0xBDF7,0x3867,
- 0x4D2A,0x0000,0xBDF8,0x3435,0xBDF9,0xBDFA,0x3159,0x5826,
- 0xBDFB,0x473A,0x302D,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0xBDFC,0xBDFD,0x4861,0x575C,0x582C,0x5830,0x4C65,0xBDFE,
- 0x5829,0x0000,0x0000,0xBEA1,0x4569,0x582E,0xBEA2,0x0000,
- 0x0000,0x0000,0xBEA3,0x0000,0xBEA4,0x3E70,0x582F,0x4657,
- 0xBEA5,0xBEA6,0xBEA7,0xBEA8,0x0000,0x0000,0xBEA9,0xBEAA,
- 0x0000,0x4F47,0x0000,0x582B,0xBEAB,0xBEAC,0x0000,0x0000,
- 0x5831,0xBEAD,0x397B,0xBEAE,0x404B,0xBEAF,0xBEB0,0x3054,
- 0x582A,0x5828,0xBEB1,0x415A,0x0000,0xBEB2,0x0000,0x577C,
- 0x3B34,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x4246,0x583D,0xBEB3,0x415B,0x5838,0xBEB4,0x5835,0x5836,
- 0xBEB5,0x3C66,0x5839,0x583C,0xBEB6,0xBEB7,0x0000,0x0000,
-
- /* 6100h */
- 0x5837,0x3D25,0xBEB8,0x583A,0x0000,0x0000,0x5834,0xBEB9,
- 0x4C7C,0x4C7B,0xBEBA,0x0000,0xBEBB,0x583E,0x583F,0x3055,
- 0xBEBC,0xBEBD,0xBEBE,0xBEBF,0xBEC0,0x5833,0xBEC1,0xBEC2,
- 0x0000,0xBEC3,0x3672,0x3026,0xBEC4,0x0000,0xBEC5,0x3436,
- 0x0000,0x583B,0xBEC6,0x0000,0x0000,0x0000,0x0000,0x5843,
- 0x5842,0x0000,0xBEC7,0xBEC8,0x5847,0x0000,0x0000,0x0000,
- 0xBEC9,0xBECA,0x0000,0x0000,0x5848,0xBECB,0xBECC,0xBECD,
- 0x0000,0xBECE,0x0000,0x0000,0x5846,0x5849,0x5841,0x5845,
- 0x0000,0xBECF,0x584A,0x0000,0x584B,0xBED0,0xBED1,0x5840,
- 0x3B7C,0xBED2,0x5844,0x4256,0x3932,0x5832,0x3F35,0x0000,
- 0x0000,0x0000,0x0000,0x5858,0x0000,0x4A69,0x0000,0x0000,
- 0x584E,0x584F,0x5850,0x0000,0x0000,0x5857,0xBED3,0x5856,
- 0xBED4,0x0000,0x4B7D,0x3437,0x0000,0x5854,0x0000,0x3745,
- 0x3334,0x0000,0x0000,0x5851,0xBED5,0x0000,0x4E38,0x5853,
- 0x3056,0x5855,0xBED6,0x584C,0x5852,0x5859,0x3744,0x584D,
- 0xBED7,0x0000,0x0000,0xBED8,0xBED9,0x0000,0x4D5D,0xBEDA,
- 0xBEDB,0xBEDC,0x4D2B,0xBEDD,0xBEDE,0x0000,0x0000,0x585C,
- 0x0000,0x0000,0x5860,0xBEDF,0x0000,0xBEE0,0x417E,0x0000,
- 0x4E79,0x5861,0xBEE1,0xBEE2,0x585E,0x0000,0x585B,0xBEE3,
- 0xBEE4,0x585A,0x585F,0x0000,0xBEE5,0xBEE6,0x0000,0xBEE7,
- 0xBEE8,0x0000,0x0000,0x0000,0x4A30,0xBEE9,0x0000,0x4634,
- 0xBEEA,0x3746,0xBEEB,0x5862,0x585D,0xBEEC,0x5863,0x0000,
- 0x0000,0x0000,0x377B,0x0000,0x0000,0x0000,0x3231,0x0000,
- 0xBEED,0xBEEE,0x586B,0x0000,0xBEEF,0x0000,0x3438,0x0000,
- 0xBEF0,0xBEF1,0xBEF2,0x5869,0x0000,0x0000,0x586A,0x3A29,
- 0x5868,0x5866,0x5865,0x586C,0x5864,0x586E,0xBEF3,0xBEF4,
- 0x327B,0x0000,0x0000,0x0000,0x0000,0xBEF5,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0xBEF6,0xBEF7,0xBEF8,0xBEF9,
- 0x0000,0xBEFA,0xBEFB,0x5870,0x0000,0xBEFE,0x586F,0xBEFC,
- 0x0000,0xBEFD,0x0000,0x0000,0xBFA1,0xBFA2,0x0000,0xBFA3,
- 0x0000,0x0000,0x4428,0x0000,0x5873,0x0000,0x5871,0x5867,
- 0x377C,0x0000,0x5872,0x0000,0x5876,0x5875,0x5877,0x5874,
-
- /* 6200h */
- 0x5878,0xBFA4,0x0000,0xBFA5,0xBFA6,0x0000,0x0000,0xBFA7,
- 0x5879,0x587A,0x4A6A,0x0000,0x587C,0x587B,0x3D3F,0x0000,
- 0x402E,0x3266,0x327C,0xBFA8,0x587D,0xBFA9,0x303F,0x0000,
- 0x0000,0x0000,0x404C,0x587E,0xBFAA,0x6C43,0x5921,0x3761,
- 0xBFAB,0x5922,0xBFAC,0xBFAD,0x0000,0x0000,0x406F,0xBFAE,
- 0x0000,0xBFAF,0x5923,0xBFB0,0x0000,0x0000,0x5924,0x353A,
- 0x5925,0x0000,0x5926,0x5927,0x4257,0x0000,0x0000,0x0000,
- 0x384D,0xBFB1,0x0000,0x4C61,0x0000,0xBFB2,0x0000,0x4B3C,
- 0x3D6A,0x5928,0xBFB3,0xBFB4,0xBFB5,0x0000,0xBFB6,0x4070,
- 0x6E3D,0x4862,0x0000,0x3C6A,0xBFB7,0x3A4D,0x5929,0x0000,
- 0xBFB8,0xBFB9,0xBFBA,0x4247,0xBFBB,0x4A27,0xBFBC,0x0000,
- 0x4271,0x0000,0xBFBD,0x592C,0xBFBE,0x0000,0x592A,0x0000,
- 0x592D,0x0000,0x0000,0x592B,0xBFBF,0x0000,0x0000,0x0000,
- 0x592E,0x0000,0x0000,0x0000,0x0000,0xBFC0,0x4A31,0xBFC1,
- 0x0000,0x3037,0x0000,0xBFC2,0x0000,0x0000,0x495E,0x0000,
- 0x0000,0x4863,0xBFC3,0x0000,0x592F,0xBFC4,0x5932,0x3E35,
- 0x353B,0x0000,0x5930,0x5937,0x3E36,0x0000,0x0000,0x0000,
- 0x0000,0x5931,0x4744,0x0000,0x0000,0xBFC5,0xBFC6,0xBFC7,
- 0xBFC8,0x4D5E,0x5933,0x5934,0x5938,0x456A,0x5935,0x3933,
- 0x405E,0x0000,0x0000,0x5946,0x4834,0x0000,0x4272,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xBFC9,0x0000,
- 0xBFCA,0x0000,0x0000,0x4864,0x5A2D,0x0000,0x0000,0x0000,
- 0x0000,0x4A7A,0x0000,0xBFCB,0x0000,0x4471,0xBFCC,0xBFCD,
- 0x0000,0x4B75,0xBFCE,0x593B,0x3221,0x436A,0xBFCF,0xBFD0,
- 0x0000,0x0000,0x5944,0x0000,0xBFD1,0x4334,0x593E,0x5945,
- 0x5940,0x5947,0x5943,0x0000,0x5942,0x476F,0xBFD2,0x593C,
- 0x327D,0x593A,0x3571,0x4273,0x5936,0xBFD3,0xBFD4,0x5939,
- 0x3934,0x405B,0xBFD5,0x3E37,0x5941,0x4752,0x0000,0x0000,
- 0x3572,0x3348,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0xBFD6,0x0000,0x3367,0x3F21,0x5949,0x594E,
- 0x0000,0x594A,0xBFD7,0x377D,0xBFD8,0x594F,0x3B22,0x3969,
- 0x0000,0x0000,0x0000,0x0000,0xBFD9,0xBFDA,0x3D26,0x593D,
-
- /* 6300h */
- 0x0000,0x3B7D,0x594C,0xBFDB,0xBFDC,0x0000,0x0000,0x3B58,
- 0x594D,0x3044,0xBFDD,0xBFDE,0x5948,0xBFDF,0x0000,0x0000,
- 0xBFE0,0x4429,0x0000,0xBFE1,0x0000,0x0000,0xBFE2,0x0000,
- 0xBFE3,0x3573,0x0000,0x0000,0x0000,0x0000,0x0000,0x3634,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x594B,
- 0x3027,0xBFE4,0xBFE5,0x3A43,0x0000,0xBFE6,0x0000,0x3F36,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0xBFE7,0xBFE8,0x0000,
- 0x0000,0xBFE9,0x4472,0x0000,0xBFEA,0x4854,0x5951,0x415E,
- 0x0000,0xBFEB,0xBFEC,0xBFED,0xBFEE,0x0000,0xBFEF,0x0000,
- 0x0000,0x422A,0xBFF0,0xBFF1,0x3B2B,0x5952,0xBFF2,0x5954,
- 0x5950,0x0000,0xBFF3,0xBFF4,0xBFF5,0x4A61,0x0000,0x443D,
- 0xBFF6,0x0000,0x0000,0xBFF7,0x415C,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0xBFF8,0xBFF9,0x4A7B,
- 0x3C4E,0x5960,0x0000,0x595F,0xBFFA,0xBFFB,0x3F78,0x0000,
- 0x0000,0xBFFC,0x377E,0x0000,0xBFFD,0xBFFE,0x5959,0x3E39,
- 0xC0A1,0x0000,0x4668,0x4731,0xC0A2,0xC0A3,0x0000,0xC0A4,
- 0x5957,0x0000,0xC0A5,0x415D,0xC0A6,0x0000,0x0000,0xC0A7,
- 0x3C78,0x595C,0xC0A8,0x0000,0x3E38,0x0000,0x5956,0x595B,
- 0xC0A9,0x0000,0x4753,0x0000,0xC0AA,0xC0AB,0x5955,0x0000,
- 0x3721,0xC0AC,0xC0AD,0x335D,0x0000,0x0000,0xC0AE,0x595D,
- 0x4E2B,0x3A4E,0x4335,0x595A,0xC0AF,0x405C,0xC0B0,0x3935,
- 0x3F64,0x3166,0x413C,0x5958,0x3545,0xC0B1,0xC0B2,0xC0B3,
- 0x0000,0x0000,0x3747,0x0000,0x444F,0x595E,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x415F,0x0000,0xC0B4,0x5961,0x0000,
- 0x5963,0xC0B5,0x0000,0x4237,0x5969,0xC0B6,0x5964,0x0000,
- 0xC0B7,0x5966,0x0000,0x0000,0x0000,0x0000,0xC0B8,0x4941,
- 0x4473,0xC0B9,0x5967,0xC0BA,0xC0BB,0xC0BC,0x4D2C,0x0000,
- 0x0000,0x0000,0x4D48,0x3439,0xC0BD,0x0000,0x0000,0x0000,
- 0xC0BE,0x302E,0x0000,0x5965,0x0000,0xC0BF,0x0000,0x0000,
- 0x0000,0x5962,0xC0C0,0x0000,0xC0C1,0x0000,0x3478,0x0000,
- 0x0000,0x0000,0xC0C2,0xC0C3,0x3167,0xC0C4,0x5968,0x0000,
- 0xC0C5,0xC0C6,0x4D49,0x0000,0x0000,0x0000,0x0000,0x0000,
-
- /* 6400h */
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x596C,0x0000,
- 0x0000,0xC0C7,0xC0C8,0x0000,0x0000,0x423B,0x0000,0x5973,
- 0xC0C9,0x0000,0xC0CA,0x596D,0xC0CB,0x0000,0x596A,0x5971,
- 0xC0CC,0x0000,0x0000,0x0000,0x5953,0x0000,0xC0CD,0x0000,
- 0xC0CE,0x0000,0xC0CF,0x0000,0xC0D0,0xC0D1,0x596E,0x0000,
- 0x5972,0xC0D2,0xC0D3,0x0000,0x4842,0x456B,0x0000,0xC0D4,
- 0xC0D5,0x0000,0x0000,0x0000,0x596B,0xC0D6,0x596F,0x0000,
- 0x0000,0x0000,0x3748,0x0000,0x0000,0xC0D7,0x3A71,0xC0D8,
- 0x0000,0x0000,0x405D,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0xC0D9,0x0000,0x0000,0x5977,0xC0DA,
- 0x0000,0xC0DB,0xC0DC,0xC0DD,0xC0DE,0x0000,0x0000,0x0000,
- 0x4526,0x0000,0xC0DF,0xC0E0,0xC0E1,0xC0E2,0x0000,0xC0E3,
- 0xC0E4,0xC0E5,0x0000,0xC0E6,0x0000,0x0000,0x0000,0x5974,
- 0x0000,0x4B60,0x0000,0x0000,0x0000,0xC0E7,0x0000,0x5975,
- 0x0000,0x0000,0x0000,0xC0E8,0xC0E9,0x0000,0x5976,0x0000,
- 0x4C4E,0x0000,0x4022,0xC0EA,0x0000,0xC0EB,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x3762,0x0000,0xC0EC,0x0000,0xC0ED,
- 0x597D,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xC0EE,
- 0xC0EF,0xC0F0,0x3B35,0x597A,0x0000,0x5979,0x0000,0x0000,
- 0xC0F1,0xC0F2,0x4732,0xC0F3,0x0000,0xC0F4,0x4635,0xC0F5,
- 0x0000,0xC0F6,0x0000,0xC0F7,0x4531,0x597B,0xC0F8,0x0000,
- 0xC0F9,0x597C,0x0000,0x496F,0xC0FA,0x4745,0x3B23,0x0000,
- 0x4071,0x0000,0x4B50,0xC0FB,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x3349,0x0000,0x5A25,0x597E,0xC0FC,0xC0FD,0xC0FE,
- 0x0000,0x4D4A,0x5A27,0x0000,0xC1A1,0x5A23,0x0000,0x5A24,
- 0x0000,0xC1A2,0xC1A3,0xC1A4,0xC1A5,0x4160,0xC1A6,0x0000,
- 0xC1A7,0xC1A8,0x5A22,0x0000,0x593F,0xC1A9,0x0000,0xC1AA,
- 0x5A26,0x0000,0x5A21,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x5A2B,0x5A2C,0x4527,0x5A2E,0xC1AB,0xC1AC,0x3B24,0x5A29,
- 0x0000,0xC1AD,0xC1AE,0x0000,0x353C,0xC1AF,0x0000,0x5A2F,
- 0xC1B0,0x5A28,0x5A33,0x0000,0x5A32,0xC1B1,0x5A31,0xC1B2,
- 0x0000,0x0000,0x5A34,0xC1B3,0x0000,0x5A36,0x3E71,0xC1B4,
-
- /* 6500h */
- 0x5A35,0xC1B5,0x0000,0x0000,0xC1B6,0x5A39,0x0000,0x0000,
- 0xC1B7,0xC1B8,0xC1B9,0x0000,0x0000,0x0000,0x0000,0xC1BA,
- 0x0000,0x0000,0x0000,0xC1BB,0xC1BC,0x0000,0xC1BD,0x0000,
- 0x5A37,0xC1BE,0x0000,0xC1BF,0x5A38,0x5970,0xC1C0,0xC1C1,
- 0x0000,0x0000,0xC1C2,0x5A3B,0x5A3A,0x0000,0xC1C3,0x0000,
- 0x0000,0xC1C4,0x5978,0x5A3C,0x5A30,0x0000,0xC1C5,0x3B59,
- 0x0000,0xC1C6,0x0000,0x0000,0x5A3D,0x5A3E,0x5A40,0x5A3F,
- 0x5A41,0x327E,0xC1C7,0x3936,0xC1C8,0xC1C9,0x4A7C,0x402F,
- 0x0000,0x0000,0x0000,0xC1CA,0x0000,0x384E,0x0000,0xC1CB,
- 0x5A43,0xC1CC,0x0000,0x0000,0x0000,0x5A46,0x0000,0x4952,
- 0xC1CD,0x355F,0xC1CE,0x0000,0xC1CF,0x5A45,0x5A44,0x4754,
- 0x5A47,0x3635,0x0000,0x0000,0x0000,0x5A49,0x5A48,0xC1D0,
- 0xC1D1,0x0000,0x343A,0x3B36,0x0000,0x0000,0x4658,0xC1D2,
- 0x0000,0x0000,0x0000,0xC1D3,0x3749,0x0000,0x0000,0x0000,
- 0x3F74,0x0000,0x5A4A,0x0000,0x4030,0x4528,0x0000,0x495F,
- 0x5A4B,0x0000,0xC1D4,0x0000,0x0000,0xC1D5,0x0000,0x0000,
- 0x0000,0xC1D6,0x5A4C,0x5A4D,0x0000,0xC1D7,0x0000,0x4A38,
- 0x555D,0x4046,0xC1D8,0x0000,0x494C,0x0000,0x3A58,0x0000,
- 0x4865,0x4843,0xC1D9,0x0000,0x0000,0xC1DA,0x0000,0x454D,
- 0xC1DB,0x4E41,0x0000,0x5A4F,0x3C50,0xC1DC,0x0000,0x5A50,
- 0xC1DD,0x3036,0x0000,0xC1DE,0x3654,0x404D,0xC1DF,0x4960,
- 0x0000,0x0000,0x0000,0x5A51,0x3B42,0x4347,0xC1E0,0x3B5B,
- 0x3F37,0x0000,0xC1E1,0xC1E2,0xC1E3,0x0000,0x0000,0x5A52,
- 0x0000,0x4A7D,0x0000,0x0000,0x3177,0x3B5C,0x0000,0xC1E4,
- 0x0000,0x5A55,0xC1E5,0x5A53,0x5A56,0x4E39,0x5A54,0x0000,
- 0xC1E6,0xC1E7,0x0000,0x407B,0x5A57,0x0000,0xC1E8,0x4232,
- 0xC1E9,0x0000,0x5A58,0x0000,0xC1EA,0x0000,0xC1EB,0x347A,
- 0xC1EC,0x5A5A,0x0000,0x5A59,0x0000,0x0000,0x0000,0xC1ED,
- 0x5A5B,0x5A5C,0x347B,0x0000,0x0000,0x467C,0x4336,0x356C,
- 0x3B5D,0x4161,0x0000,0x0000,0x3D5C,0x3030,0x0000,0x0000,
- 0xC1EE,0x5A5D,0xC1EF,0x0000,0xC1F0,0xC1F1,0x0000,0x0000,
- 0x0000,0xC1F2,0x3222,0x5A61,0x0000,0x0000,0xC1F3,0xC1F4,
-
- /* 6600h */
- 0xC1F5,0x0000,0x3937,0x5A60,0xC1F6,0x0000,0x3A2B,0x3E3A,
- 0xC1F7,0xC1F8,0x5A5F,0x0000,0x3E3B,0xC1F9,0x4C40,0x3A2A,
- 0x0000,0xC1FA,0xC1FB,0x3057,0x404E,0xC1FC,0xC1FD,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x5A66,0xC1FE,0xC2A1,0x4031,
- 0x3147,0xC2A2,0xC2A3,0xC2A4,0xC2A5,0x3D55,0xC2A6,0x4B66,
- 0x3A72,0xC2A7,0xC2A8,0xC2A9,0xC2AA,0x3E3C,0xC2AB,0x4027,
- 0xC2AC,0xC2AD,0x0000,0xC2AE,0x5A65,0x5A63,0x5A64,0xC2B0,
- 0x0000,0xC2AF,0x0000,0x0000,0x436B,0x0000,0x0000,0x5B26,
- 0xC2B1,0x5A6A,0x3B7E,0x3938,0x5A68,0xC2B2,0xC2B3,0x0000,
- 0x0000,0x5A69,0xC2B4,0x3F38,0xC2B5,0x0000,0xC2B7,0x5A67,
- 0x0000,0xC2B6,0x3B2F,0x0000,0x0000,0x0000,0x0000,0xC2B8,
- 0xC2B9,0xC2BA,0x0000,0xC2BB,0xC2BC,0x5A6C,0x5A6B,0x5A70,
- 0xC2BD,0xC2BE,0x5A71,0x0000,0x5A6D,0x0000,0x3322,0x5A6E,
- 0x5A6F,0x4855,0xC2C0,0xC2C1,0xC2C2,0x0000,0x4961,0x374A,
- 0x5A72,0x0000,0x0000,0xC2C4,0x4032,0xC2C5,0x3E3D,0xC2C7,
- 0xC2C8,0xC2C9,0x4352,0xC2CA,0xC2CC,0x0000,0xC2C3,0xC2C6,
- 0xC2CB,0x3647,0x0000,0x5A73,0x5A77,0x0000,0x0000,0x324B,
- 0x5A74,0x5A76,0x0000,0xC2CD,0xC2CE,0xC2CF,0x5A75,0x0000,
- 0xC2D0,0x3D6B,0xC2D1,0x0000,0x0000,0x0000,0x4348,0x3045,
- 0x5A78,0xC2D2,0xC2D3,0xC2D4,0xC2D5,0x5A79,0x0000,0xC2D6,
- 0xC2D7,0x0000,0x442A,0x0000,0xC2D8,0x0000,0x4E71,0x0000,
- 0x0000,0x0000,0x0000,0x3B43,0x0000,0xC2D9,0x4A6B,0x0000,
- 0x0000,0xC2DA,0xC2DB,0x0000,0x4B3D,0xC2DC,0x0000,0x0000,
- 0x5B22,0x5A7B,0x0000,0xC2DD,0x5A7E,0x0000,0x5A7D,0xC2DE,
- 0xC2DF,0x5A7A,0xC2E0,0xC2E1,0x5B21,0x0000,0x0000,0x465E,
- 0xC2E2,0x5A7C,0x0000,0x0000,0xC2E3,0x0000,0xC2E4,0xC2E5,
- 0x0000,0x0000,0x0000,0x0000,0xC2E6,0x0000,0x5B23,0x0000,
- 0x0000,0x3D6C,0x5B24,0xC2E7,0x4D4B,0x4778,0x0000,0xC2E8,
- 0x5B25,0x0000,0x0000,0x0000,0x0000,0x0000,0x5B27,0x0000,
- 0xC2E9,0x5B28,0x0000,0xC2EA,0xC2EB,0x0000,0xC2EC,0x0000,
- 0x5B29,0x0000,0x364A,0x3148,0x3939,0x5B2A,0x0000,0x5B2B,
- 0x3D71,0x4162,0xC2ED,0xC2BF,0x5258,0x413E,0x413D,0x4258,
-
- /* 6700h */
- 0x3A47,0x0000,0x0000,0x5072,0x0000,0xC2EE,0x0000,0xC2EF,
- 0x376E,0x4D2D,0x0000,0x4A7E,0x0000,0x497E,0xC2F0,0x5B2C,
- 0x0000,0x0000,0x0000,0xC2F1,0x3A73,0x443F,0x5B2D,0x4F2F,
- 0x0000,0xC2F2,0x0000,0x4B3E,0xC2F3,0x442B,0x5B2E,0x347C,
- 0xC2F4,0x0000,0xC2F5,0x0000,0x0000,0x0000,0x5B2F,0x5B30,
- 0x4C5A,0x0000,0x4C24,0x4B76,0x4B5C,0x3B25,0x5B32,0x0000,
- 0x0000,0x3C6B,0x0000,0xC2F6,0x4B51,0x0000,0x5B34,0x5B37,
- 0x5B36,0x0000,0x3479,0x0000,0x0000,0x3560,0xC2F7,0x5B33,
- 0x0000,0x5B35,0x0000,0x0000,0x0000,0xC2F8,0x5B38,0xC2F9,
- 0xC2FA,0x3F79,0x0000,0x0000,0xC2FB,0x0000,0x4D7B,0x3049,
- 0x3A60,0x423C,0x0000,0x3C5D,0xC2FC,0xC2FD,0x3E73,0x0000,
- 0x0000,0x5B3B,0x0000,0x0000,0x454E,0xC2FE,0x5B39,0x422B,
- 0x5B3A,0x3E72,0x4C5D,0x5B3C,0x5B3D,0x4D68,0xC3A1,0x0000,
- 0x0000,0x0000,0x5B42,0x0000,0xC3A2,0x393A,0xC3A3,0x4755,
- 0x5B3F,0x456C,0x5A5E,0x5A62,0xC3A4,0x354F,0xC3A5,0x4747,
- 0x0000,0x0000,0x0000,0xC3A6,0x5B41,0x0000,0x3E3E,0x4844,
- 0x0000,0xC3A7,0x0000,0x0000,0xC3A8,0x5B47,0x0000,0x487A,
- 0x0000,0x5B3E,0x0000,0x5B44,0x5B43,0x0000,0xC3A9,0xC3AA,
- 0x404F,0xC3AB,0x0000,0xC3AC,0x0000,0x4B6D,0xC3AD,0x4E53,
- 0xC3AE,0xC3AF,0x4B67,0xC3B0,0x324C,0x3B5E,0x0000,0x0000,
- 0x4F48,0x5B46,0x3F75,0x0000,0x0000,0x0000,0x5B45,0x0000,
- 0x0000,0x5B40,0x0000,0x0000,0x0000,0x0000,0x0000,0x384F,
- 0xC3B1,0xC3B2,0xC3B3,0x5B4C,0x5B4A,0xC3B4,0x324D,0x5B48,
- 0x5B4E,0x5B54,0x0000,0xC3B5,0xC3B6,0xC3B7,0x0000,0x0000,
- 0xC3B9,0x4248,0xC3BA,0xC3BB,0x4A41,0xC3BC,0x5B56,0x0000,
- 0xC3BD,0xC3BE,0x4922,0x0000,0x0000,0x0000,0x5B55,0x4770,
- 0x4B3F,0x343B,0xC3BF,0x4077,0x3D40,0x0000,0x0000,0xC3C0,
- 0x4453,0xC3C1,0x4D2E,0x0000,0xC3C2,0x5B51,0x5B50,0x0000,
- 0x0000,0xC3C3,0x5B52,0x0000,0x5B4F,0x0000,0xC3C4,0x5B57,
- 0x0000,0x5B4D,0x0000,0x0000,0x5B4B,0x0000,0x5B53,0x5B49,
- 0xC3C5,0x436C,0xC3C6,0x4C78,0x3C46,0x3A74,0xC3C7,0xC3C8,
- 0x0000,0xC3B8,0x0000,0x3A3A,0x0000,0x0000,0x4B6F,0x3341,
-
- /* 6800h */
- 0x0000,0x0000,0x444E,0x464A,0x3149,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x4072,0xC3CA,0x0000,0x4034,0x372A,
- 0x0000,0xC3CB,0x0000,0x0000,0x0000,0xC3CC,0x5B59,0xC3CD,
- 0x0000,0x393B,0x337C,0x0000,0x0000,0x0000,0x0000,0xC3CF,
- 0xC3CE,0x5B5B,0x3374,0x5B61,0xC3D0,0xC3D1,0x0000,0xC3D2,
- 0xC3D3,0xC3D4,0x5B5E,0xC3D5,0x4073,0x0000,0x0000,0x0000,
- 0x334B,0x3A2C,0x0000,0xC3D6,0x334A,0x3A4F,0x0000,0xC3D7,
- 0x5B5C,0x3765,0x374B,0x456D,0xC3D8,0xC3D9,0x5B5A,0x0000,
- 0x3046,0x0000,0xC3DA,0x0000,0xC3DB,0x5B5D,0x5B5F,0x0000,
- 0x364D,0x372C,0xC3C9,0x343C,0x354B,0xC3DC,0x0000,0xC3DD,
- 0xC3DE,0x5B62,0x0000,0xC3DF,0x3A79,0x4B71,0x0000,0x3B37,
- 0x0000,0x0000,0x0000,0x5B63,0x0000,0x0000,0x0000,0x4930,
- 0x0000,0x0000,0x0000,0xC3E0,0x0000,0x0000,0xC3E1,0xC3E2,
- 0xC3E3,0xC3E4,0xC3E5,0x0000,0x5B6F,0xC3E6,0x3233,0x5B64,
- 0x0000,0xC3E7,0xC3E8,0xC3E9,0xC3EA,0x0000,0x5B75,0x5B65,
- 0x0000,0x4E42,0xC3EB,0x5B6C,0xC3EC,0x475F,0xC3ED,0x0000,
- 0xC3EE,0x0000,0x0000,0x0000,0x0000,0x5B74,0x0000,0x5B67,
- 0x0000,0x0000,0x0000,0x3034,0x5B69,0x0000,0xC3EF,0x393C,
- 0xC3F0,0x0000,0xC3F1,0x5B6B,0xC3F2,0x5B6A,0x0000,0x5B66,
- 0x5B71,0xC3F3,0x3E3F,0xC3F4,0x0000,0xC3F5,0x546D,0x3868,
- 0x4D7C,0xC3F6,0xC3F7,0x0000,0x0000,0x5B68,0xC3F8,0x4474,
- 0x3323,0x3A2D,0xC3F9,0x5B60,0x0000,0x5B70,0x3361,0x0000,
- 0x0000,0x5B6E,0x5B72,0xC3FA,0x456E,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x347E,0xC3FB,0x5C32,0x0000,
- 0xC3FC,0x4C49,0x5B77,0x347D,0xC3FD,0x5B7E,0x0000,0xC3FE,
- 0xC4A1,0xC4A2,0x4B40,0xC4A3,0x5C21,0x5C23,0xC4A4,0x5C27,
- 0x5B79,0xC4A5,0x432A,0x0000,0xC4A6,0xC4A7,0x0000,0x456F,
- 0x5C2B,0x5B7C,0x0000,0x5C28,0x0000,0xC4A8,0x0000,0x5C22,
- 0xC4A9,0x0000,0xC4AA,0xC4AB,0xC4AC,0xC4AD,0x3F39,0x5C2C,
- 0xC4AE,0xC4AF,0x4033,0x0000,0x0000,0xC4B0,0xC4B1,0x0000,
- 0x0000,0x5C2A,0x343D,0xC4B2,0xC4B3,0xC4B4,0x0000,0x0000,
-
- /* 6900h */
- 0x4F50,0x5B76,0x0000,0x0000,0x5C26,0x3058,0xC4B5,0x0000,
- 0x5B78,0xC4B6,0xC4B7,0x4C3A,0x5B7D,0x3F22,0x4447,0x5B73,
- 0xC4B8,0xC4B9,0x5C25,0xC4BA,0x0000,0x0000,0xC4BB,0xC4BC,
- 0x0000,0x3F7A,0x5C2F,0x3371,0x3821,0x0000,0x0000,0x0000,
- 0x0000,0x5C31,0x5B7A,0x5C30,0x0000,0x5C29,0x5B7B,0x0000,
- 0x5C2D,0x0000,0x5C2E,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x5C3F,0xC4BD,0x0000,0xC4BE,0x464E,0xC4BF,0x5C24,0x0000,
- 0xC4C0,0x5C3B,0x0000,0xC4C1,0x0000,0x5C3D,0x0000,0x4458,
- 0x0000,0x0000,0xC4C2,0x0000,0x0000,0xC4C3,0x0000,0x0000,
- 0x0000,0xC4C4,0x4D4C,0x0000,0x0000,0x0000,0xC4C5,0x0000,
- 0x0000,0x0000,0x0000,0x4976,0x5C38,0x424A,0x0000,0xC4C6,
- 0x0000,0x5C3E,0x413F,0xC4C7,0x5C35,0x5C42,0x5C41,0x0000,
- 0x466F,0x5C40,0x466A,0xC4C8,0xC4C9,0xC4CA,0xC4CB,0x0000,
- 0xC4CC,0xC4CD,0x5C44,0x5C37,0xC4CE,0x3648,0x5C3A,0x3D5D,
- 0xC4CF,0xC4D0,0xC4D1,0x4760,0x5C3C,0x364B,0x0000,0x5C34,
- 0x5C36,0x5C33,0xC4D2,0xC4D3,0x4F30,0x335A,0x5C39,0xC4D4,
- 0xC4D5,0x5C43,0x3335,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x3A67,0x0000,0x0000,0xC4D6,0x315D,0x0000,
- 0x0000,0x5C54,0xC4D7,0x0000,0x4F31,0x5C57,0xC4D8,0x0000,
- 0xC4D9,0x0000,0x0000,0x3F3A,0x5C56,0x0000,0x0000,0x0000,
- 0x5C55,0xC4DA,0x0000,0x0000,0x0000,0xC4DB,0xC4DC,0x5C52,
- 0xC4DD,0x0000,0x0000,0xC4DE,0x0000,0xC4DF,0x5C46,0xC4E0,
- 0x0000,0x5C63,0x5C45,0x0000,0x5C58,0x0000,0x0000,0xC4E1,
- 0xC4E2,0x0000,0xC4E3,0x5C50,0xC4E4,0x0000,0x5C4B,0x5C48,
- 0x0000,0x5C49,0x0000,0x5C51,0x0000,0xC4E5,0x0000,0x7422,
- 0xC4E6,0x0000,0x5C4E,0x393D,0x4448,0x4164,0x5C4C,0x0000,
- 0x5C47,0xC4E7,0x0000,0x5C4A,0x0000,0x0000,0xC4E8,0xC4E9,
- 0x4D4D,0x4B6A,0x0000,0x0000,0x0000,0x5C4F,0x5C59,0x0000,
- 0x0000,0x0000,0xC4EA,0x0000,0x0000,0xC4EB,0x0000,0x5C61,
- 0x5C5A,0x0000,0x0000,0x5C67,0x0000,0x5C65,0xC4EC,0xC4ED,
- 0x0000,0xC4EE,0x5C60,0xC4EF,0x0000,0xC4F0,0x0000,0x0000,
- 0x0000,0x5C5F,0x0000,0x4450,0x0000,0x4165,0xC4F1,0x5C5D,
-
- /* 6A00h */
- 0xC4F2,0xC4F3,0x5C5B,0xC4F4,0x0000,0x5C62,0x0000,0x0000,
- 0x0000,0x0000,0x5C68,0x4875,0x5C6E,0x0000,0x0000,0xC4F5,
- 0x0000,0xC4F6,0x5C69,0x5C6C,0x5C66,0xC4F7,0x0000,0x4374,
- 0x0000,0x4938,0xC4F8,0x5C5C,0x0000,0xC4F9,0x5C64,0x3E40,
- 0xC4FA,0x4C4F,0x5C78,0x5C6B,0xC4FB,0x0000,0x0000,0x0000,
- 0xC4FC,0x3822,0x3223,0x335F,0x0000,0x0000,0x5C53,0x0000,
- 0xC4FD,0x0000,0xC4FE,0x0000,0xC5A1,0x3E41,0x5C70,0xC5A2,
- 0x5C77,0x3C79,0x3372,0xC5A3,0x0000,0x432E,0xC5A4,0xC5A5,
- 0x0000,0x0000,0x0000,0x0000,0x5C6D,0xC5A6,0xC5A7,0x5C72,
- 0x5C76,0xC5A8,0xC5A9,0x3636,0x0000,0x0000,0xC5AA,0x0000,
- 0xC5AB,0xC5AC,0xC5AD,0x0000,0x0000,0xC5AE,0xC5AF,0x0000,
- 0x354C,0x5C74,0x0000,0xC5B0,0x0000,0x0000,0x0000,0x3521,
- 0x0000,0x464B,0x5C73,0x0000,0xC5B1,0x0000,0x5C75,0xC5B2,
- 0x0000,0x0000,0xC5B3,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0xC5B4,0x5C6F,0xC5B5,0x0000,0x0000,0x0000,0x0000,
- 0x5C71,0x0000,0x0000,0x0000,0x0000,0x0000,0xC5B6,0x3360,
- 0x4349,0xC5B7,0x0000,0xC5B8,0x5C7C,0x0000,0xC5B9,0xC5BA,
- 0x0000,0xC5BB,0x0000,0xC5BC,0x0000,0x5C7A,0x3869,0x0000,
- 0x5C79,0xC5BD,0x0000,0x0000,0x0000,0x0000,0x0000,0x5D21,
- 0x0000,0x0000,0x0000,0xC5BE,0x5B58,0xC5BF,0xC5C0,0xC5C1,
- 0x5C7B,0x0000,0x5C7D,0x5C7E,0x0000,0xC5C2,0x0000,0x0000,
- 0x0000,0x0000,0x5D2C,0xC5C3,0x5D28,0x0000,0x5B6D,0xC5C4,
- 0xC5C5,0xC5C6,0x0000,0x5D27,0xC5C7,0x0000,0x0000,0x0000,
- 0x5D26,0x0000,0x0000,0x5D23,0x0000,0xC5C8,0xC5C9,0xC5CA,
- 0x0000,0x5C6A,0x5D25,0x5D24,0x0000,0x0000,0xC5CB,0x0000,
- 0xC5CD,0xC5CC,0x0000,0x0000,0xC5CE,0x0000,0x0000,0x0000,
- 0xC5CF,0x5D2A,0x0000,0x4F26,0xC5D0,0xC5D1,0xC5D2,0x0000,
- 0x0000,0x0000,0x5D2D,0x367B,0xC5D3,0xC5D4,0x5D29,0x5D2B,
- 0x0000,0x0000,0x0000,0x0000,0xC5D5,0x0000,0x0000,0xC5D6,
- 0x4827,0x0000,0x5D2E,0x0000,0xC5D7,0x0000,0x0000,0x0000,
- 0xC5D8,0xC5D9,0xC5DA,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x5D32,0x5D2F,0xC5DB,0xC5DC,0x0000,0x0000,
-
- /* 6B00h */
- 0x0000,0x0000,0xC5DD,0xC5DE,0x4D73,0x5D30,0xC5DF,0xC5E0,
- 0x0000,0xC5E1,0x5C5E,0x0000,0x0000,0x0000,0x0000,0xC5E2,
- 0xC5E3,0xC5E4,0x5D33,0x0000,0x0000,0x0000,0x5D34,0xC5E5,
- 0x0000,0x0000,0x0000,0xC5E6,0x0000,0x3135,0xC5E7,0x5D36,
- 0x3767,0x3C21,0x0000,0x3655,0xC5E8,0x0000,0x0000,0x3224,
- 0xC5E9,0x0000,0x0000,0xC5EA,0xC5EB,0x0000,0x0000,0xC5EC,
- 0x0000,0x0000,0x4D5F,0x0000,0x0000,0xC5ED,0xC5EE,0x5D38,
- 0x5D37,0x5D3A,0x353D,0xC5EF,0x0000,0x3656,0x343E,0xC5F0,
- 0x0000,0x0000,0x0000,0x5D3D,0x0000,0x0000,0xC5F1,0x5D3C,
- 0x0000,0x5D3E,0xC5F2,0x0000,0x324E,0xC5F3,0x4337,0x0000,
- 0x5D3F,0x0000,0xC5F4,0x343F,0x5D41,0x0000,0xC5F5,0x0000,
- 0xC5F6,0x5D40,0x0000,0x5D42,0x0000,0xC5F7,0x0000,0x5D43,
- 0xC5F8,0x5D44,0x3B5F,0x4035,0x3A21,0x0000,0x4970,0xC5F9,
- 0x0000,0x4A62,0x4F44,0xC5FA,0x0000,0x0000,0xC5FB,0x3B75,
- 0xC5FC,0x0000,0x0000,0x3A50,0x4E72,0xC5FD,0x0000,0x0000,
- 0x5D45,0x5D46,0x0000,0x3B60,0x0000,0xC5FE,0xC6A1,0x5D47,
- 0x5D48,0x0000,0xC6A2,0x5D4A,0x5D49,0xC6A3,0x4B58,0x0000,
- 0x0000,0x3D5E,0x3C6C,0x3B44,0x0000,0x5D4B,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x5D4D,0x3F23,0xC6A4,
- 0x5D4C,0x0000,0x0000,0xC6A5,0x0000,0x0000,0x5D4E,0xC6A6,
- 0xC6A7,0x0000,0xC6A8,0xC6A9,0x5D4F,0x0000,0x0000,0x0000,
- 0xC6AA,0xC6AB,0x5D50,0x5D51,0xC6AC,0xC6AD,0xC6AE,0x5D52,
- 0xC6AF,0x5D54,0x5D53,0x5D55,0x3225,0x434A,0x0000,0x5D56,
- 0xC6B0,0xC6B1,0x3B26,0x334C,0x5D57,0xC6B2,0xC6B3,0x4542,
- 0x544C,0x0000,0x0000,0xC6B4,0xC6B5,0x3523,0x5D58,0x0000,
- 0x0000,0xC6B6,0x0000,0x5D59,0xC6B7,0x4A6C,0x4B68,0x0000,
- 0x0000,0x0000,0x4647,0x5D5A,0x4866,0x0000,0xC6B8,0x0000,
- 0x487B,0x0000,0xC6B9,0x4C53,0x0000,0x0000,0x0000,0x5D5B,
- 0x0000,0xC6BA,0x0000,0xC6BB,0x0000,0x0000,0xC6BC,0xC6BD,
- 0x0000,0x0000,0x0000,0x5D5D,0x5D5C,0x0000,0xC6BE,0x5D5F,
- 0x0000,0xC6BF,0x0000,0x5D5E,0x0000,0x0000,0x0000,0xC6C0,
- 0x0000,0xC6C1,0x0000,0x0000,0x0000,0x0000,0x0000,0xC6C2,
-
- /* 6C00h */
- 0x0000,0x0000,0xC6C3,0x0000,0xC6C4,0xC6C5,0x0000,0x0000,
- 0x5D61,0xC6C6,0x0000,0x0000,0x0000,0xC6C7,0xC6C8,0x3B61,
- 0xC6C9,0x4C31,0xC6CA,0x5D62,0x5D63,0x0000,0x0000,0x3524,
- 0x0000,0xC6CB,0x0000,0x5D64,0x0000,0x0000,0x0000,0xC6CC,
- 0x0000,0x0000,0x0000,0x5D66,0x5D65,0x0000,0xC6CD,0xC6CE,
- 0xC6CF,0x0000,0x0000,0x0000,0xC6D0,0x0000,0xC6D1,0x0000,
- 0x0000,0x0000,0x0000,0xC6D2,0x3F65,0xC6D3,0xC6D4,0x4939,
- 0x314A,0x0000,0xC6D5,0xC6D6,0x0000,0x0000,0x4845,0xC6D7,
- 0x4475,0x3D41,0x3561,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0xC6D8,0xC6D9,0x0000,0xC6DA,0x4846,0xC6DB,
- 0x3C2E,0x0000,0xC6DC,0x0000,0xC6DD,0x5D68,0x0000,0x3440,
- 0x0000,0xC6DE,0x3178,0xC6DF,0xC6E0,0x4672,0x5D67,0x393E,
- 0x4353,0x0000,0x5D69,0x0000,0x0000,0x0000,0x0000,0xC7B6,
- 0x5D71,0x0000,0x5D6A,0xC6E1,0x0000,0xC6E2,0x0000,0xC6E3,
- 0x4241,0x0000,0x3562,0x5D72,0xC6E4,0x0000,0xC6E5,0x0000,
- 0xC6E6,0xC6E7,0x3768,0xC6E8,0x0000,0x3525,0x5D70,0x0000,
- 0x0000,0x5D6E,0x5D6B,0x4D60,0x0000,0xC6E9,0xC6EA,0xC6EB,
- 0x4440,0xC6EC,0x0000,0x0000,0x4659,0x5D6C,0x0000,0x0000,
- 0x5D74,0x0000,0x5D73,0x3723,0xC6ED,0xC6EE,0x322D,0xC6EF,
- 0xC6F0,0x3A3B,0x5D6D,0x5D6F,0xC6F1,0x0000,0x0000,0xC6F2,
- 0x0000,0x4B57,0x4274,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x4B77,0x0000,0x0000,0x5D7C,0x0000,
- 0xC6F3,0x5D7D,0xC6F4,0x324F,0xC6F5,0x0000,0x0000,0x0000,
- 0x4A28,0x4C7D,0x5E21,0x3C23,0x3E42,0x5D78,0x5D7E,0x3168,
- 0x0000,0x3637,0xC6F6,0x0000,0x5D75,0x5D7A,0xC6F7,0x0000,
- 0x0000,0x4074,0x4771,0x0000,0x4867,0xC6F8,0x0000,0xC6F9,
- 0xC6FA,0xC6FB,0xC6FC,0x5D77,0xC6FD,0x4B21,0xC6FE,0x5D79,
- 0x0000,0x5E24,0xC7A1,0x5E22,0xC7A2,0x5D7B,0x0000,0x0000,
- 0xC7A3,0x4B22,0x4748,0x3563,0x0000,0x4525,0x0000,0xC7A4,
- 0x436D,0xC7A5,0x5E25,0xC7A6,0xC7A7,0x0000,0xC7A8,0x5E23,
- 0x4259,0x5D76,0xC7A9,0x314B,0xC7AA,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-
- /* 6D00h */
- 0x0000,0x0000,0x0000,0x0000,0xC7AB,0x0000,0x0000,0xC7AC,
- 0x0000,0x0000,0xC7AD,0x4D4E,0x5E30,0x0000,0xC7AE,0xC7AF,
- 0x0000,0xC7B0,0x5E2F,0xC7B1,0x0000,0x0000,0x0000,0x4076,
- 0x0000,0x5E2C,0xC7B2,0x4D6C,0x0000,0x0000,0x4636,0x5E26,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x4445,0xC7B3,0xC7B4,
- 0xC7B5,0x314C,0x393F,0x5E29,0x0000,0x0000,0xC7B7,0xC7B8,
- 0x0000,0xC7B9,0x3D27,0x5E2E,0x0000,0x5E2D,0x5E28,0x0000,
- 0x5E2B,0xC7BA,0x0000,0x3368,0xC7BB,0x5E2A,0x4749,0xC7BC,
- 0x0000,0x4E2E,0x0000,0x0000,0x3E74,0x4075,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xC7BD,
- 0x0000,0x5E36,0x5E34,0x0000,0x494D,0x0000,0xC7BE,0xC7BF,
- 0x0000,0xC7C0,0x0000,0x5E31,0x5E33,0xC7C1,0x313A,0xC7C2,
- 0x0000,0x3940,0x4F32,0x0000,0x333D,0x0000,0x4962,0xC7C3,
- 0xC7C4,0x0000,0x0000,0x0000,0x4D61,0x0000,0x0000,0x3324,
- 0x3F3B,0x5E35,0x0000,0x0000,0xC7C5,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0xC7C6,0x0000,0x0000,0x5E3A,0x0000,0xC7C7,
- 0x3E43,0x0000,0x0000,0x0000,0x4D30,0x0000,0x5E37,0x0000,
- 0x0000,0xC7C8,0xC7C9,0x5E32,0xC7CA,0x5E38,0xC7CB,0xC7CC,
- 0xC7CD,0x4E5E,0x0000,0x4573,0x4642,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0xC7CE,0x0000,0xC7CF,0x0000,0x0000,0x3336,
- 0x0000,0x0000,0x3155,0x0000,0xC7D0,0x5E3E,0x0000,0xC7D1,
- 0x5E41,0xC7D2,0x0000,0x0000,0x4E43,0xC7D3,0x0000,0xC7D4,
- 0x4D64,0x0000,0x0000,0x0000,0xC7D5,0x5E48,0x5E42,0x5E3F,
- 0xC7D6,0x0000,0xC7D7,0x4E54,0x5E45,0x0000,0xC7D8,0xC7D9,
- 0x0000,0x3D4A,0x5E47,0x0000,0x0000,0x5E4C,0xC7DA,0x0000,
- 0x4571,0x5E4A,0x0000,0xC7DB,0x0000,0xC7DC,0x5E44,0xC7DD,
- 0xC7DE,0x4338,0xC7DF,0x0000,0x5E4B,0xC7E0,0x5E40,0x0000,
- 0x5E46,0xC7E1,0x5E4D,0x307C,0x5E43,0x0000,0x5E4E,0xC7E2,
- 0xC7E3,0x3F3C,0x0000,0x3D5F,0xC7E4,0x4A25,0xC7E5,0x3A2E,
- 0x0000,0x5E3B,0x5E49,0x453A,0xC7E6,0x0000,0x0000,0x0000,
-
- /* 6E00h */
- 0xC7E7,0x0000,0x0000,0x0000,0xC7E8,0x4036,0x0000,0x3369,
- 0x3A51,0x3E44,0x5E3D,0x3D42,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x374C,0x0000,0x5E3C,0x0000,0x0000,
- 0x0000,0x5E52,0x3D6D,0x383A,0x0000,0x5E61,0xC7E9,0x5E5B,
- 0x3574,0x454F,0xC7EA,0x5E56,0x5E5F,0x302F,0x3132,0xC7EB,
- 0x0000,0x3239,0x0000,0x5E58,0x422C,0x5E4F,0x5E51,0x3941,
- 0x0000,0x0000,0xC7EC,0x0000,0x0000,0x0000,0xC7ED,0x0000,
- 0x5E62,0xC7EE,0x5E5D,0xC7EF,0xC7F0,0x0000,0x5E55,0x0000,
- 0x0000,0x0000,0x0000,0x5E5C,0xC7F1,0xC7F2,0x0000,0x0000,
- 0xC7F3,0xC7F4,0x4C2B,0xC7F5,0x0000,0x5E5A,0x5E5E,0xC7F6,
- 0x0000,0xC7F7,0xC7F8,0xC7F9,0xC7FA,0x0000,0x3850,0xC7FB,
- 0x3E45,0x0000,0x0000,0x4339,0xC7FC,0xC7FD,0xC7FE,0x5E54,
- 0x0000,0x0000,0xC8A1,0xC8A2,0x0000,0x0000,0x0000,0x4D2F,
- 0xC8A3,0x0000,0x0000,0x5E57,0x0000,0x0000,0x5E50,0x4572,
- 0x0000,0x0000,0x5E53,0xC8A4,0x0000,0x0000,0x5E59,0x0000,
- 0x0000,0x0000,0x0000,0xC8A5,0x0000,0xC8A6,0x4F51,0x3C3E,
- 0x4B7E,0x0000,0x5E63,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x482E,0xC8A7,0x0000,0x5E6F,
- 0x383B,0x0000,0x0000,0xC8A8,0x0000,0x0000,0x3D60,0x0000,
- 0x5E65,0xC8A9,0x0000,0x0000,0x4E2F,0x3942,0x0000,0x5E72,
- 0xC8AA,0x0000,0x306E,0x0000,0x0000,0x5E70,0x0000,0xC8AB,
- 0x0000,0x0000,0x5E64,0x0000,0x0000,0xC8AC,0xC8AD,0x5E6A,
- 0x0000,0xC8AE,0x5E6C,0xC8AF,0x0000,0x0000,0x4D4F,0x5E67,
- 0x0000,0x0000,0x452E,0xC8B0,0x0000,0x5E69,0x0000,0xC8B1,
- 0xC8B2,0xC8B3,0x5E71,0xC8B4,0x5E6B,0x4C47,0x0000,0xC8B5,
- 0xC8B6,0x5E66,0xC8B7,0x3C22,0x5E7E,0xC8B8,0xC8B9,0xC8BA,
- 0x0000,0x336A,0x0000,0x5E68,0x5E6D,0x5E6E,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x426C,0x425A,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0xC8BB,0x5E76,0xC8BC,0xC8BD,0x5E7C,
- 0x0000,0x0000,0x5E7A,0x0000,0x4529,0x0000,0x0000,0x5F23,
- 0x5E77,0xC8BE,0x0000,0xC8BF,0x0000,0xC8C0,0x5E78,0x5E60,
-
- /* 6F00h */
- 0x0000,0x3579,0x493A,0x0000,0xC8C1,0x0000,0x3C3F,0x0000,
- 0xC8C2,0x3977,0xC8C3,0x0000,0xC8C4,0xC8C5,0x0000,0x4F33,
- 0x0000,0x5E74,0x0000,0x5F22,0x3169,0x4166,0xC8C6,0x0000,
- 0xC8C7,0x0000,0xC8C8,0xC8C9,0x0000,0x0000,0x0000,0x0000,
- 0x4779,0x0000,0x3441,0x4E7A,0x0000,0x0000,0xC8CA,0x0000,
- 0x0000,0xC8CB,0xC8CC,0x4C21,0x4452,0xC8D3,0x0000,0xC8CD,
- 0xC8CE,0x5E7B,0x5E7D,0xC8CF,0x0000,0x0000,0xC8D0,0x0000,
- 0x4132,0x0000,0x0000,0xC8D1,0xC8D2,0x0000,0x5F21,0x5E79,
- 0x0000,0x5E73,0x0000,0x0000,0x0000,0x3443,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xC8D4,
- 0x0000,0xC8D5,0xC8D6,0xC8D7,0x3769,0x0000,0x0000,0xC8D8,
- 0x5F2F,0xC8D9,0xC8DA,0x5F2A,0x4078,0xC8DB,0xC8DC,0x3363,
- 0x0000,0xC8DD,0xC8DE,0x0000,0x3D61,0x0000,0x5F33,0x0000,
- 0xC8DF,0x0000,0x0000,0x0000,0xC8E0,0x5F2C,0x442C,0x5F29,
- 0x4459,0x0000,0x0000,0x0000,0x5F4C,0x0000,0x0000,0x0000,
- 0x5F26,0x0000,0x5F25,0x0000,0x5F2E,0xC8E1,0xC8E2,0x0000,
- 0x5F28,0x5F27,0x5F2D,0xC8E3,0x4021,0x0000,0x5F24,0xC8E4,
- 0xC8E5,0x0000,0x0000,0xC8E6,0xC8E7,0xC8E8,0x5F30,0x0000,
- 0xC8E9,0x5F31,0xC8EA,0xC8EB,0xC8EC,0x0000,0xC8ED,0x3442,
- 0x0000,0x0000,0xC8EE,0x0000,0x0000,0x0000,0x0000,0xC8EF,
- 0xC8F0,0x5F36,0x0000,0x5F35,0x5F37,0xC8F1,0xC8F2,0xC8F3,
- 0xC8F4,0x0000,0x5F3A,0x0000,0x0000,0x0000,0xC8F5,0xC8F6,
- 0xC8F7,0x4543,0x0000,0x5F34,0x0000,0xC8F8,0xC8F9,0x0000,
- 0x0000,0x5F38,0x0000,0x0000,0xC8FA,0x0000,0x0000,0x0000,
- 0x3763,0x4279,0x5F32,0x473B,0x0000,0xC8FB,0x5F39,0xC8FC,
- 0xC8FD,0x0000,0xC8FE,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x5F3E,0x5F3C,0x0000,0x0000,
- 0x5F3F,0x0000,0xC9A1,0x5F42,0x0000,0x0000,0xC9A2,0x5F3B,
- 0x396A,0x4728,0x0000,0x0000,0x5E39,0x0000,0x0000,0x0000,
- 0xC9A3,0xC9A4,0x0000,0x4D74,0x5F3D,0x0000,0x5F41,0x4275,
- 0xC9A5,0x5F40,0x0000,0x5F2B,0x0000,0xC9A6,0x6F69,0x0000,
- 0x0000,0xC9A7,0x5F45,0x0000,0xC9A8,0xC9A9,0x5F49,0x0000,
-
- /* 7000h */
- 0xC9AA,0x5F47,0x0000,0x0000,0x0000,0xC9AB,0xC9AC,0xC9AD,
- 0x0000,0x5F43,0x0000,0x5F44,0x0000,0xC9AE,0x0000,0x5F48,
- 0x0000,0x5F46,0x0000,0x0000,0x0000,0x494E,0x0000,0xC9AF,
- 0x5F4E,0x0000,0x5F4B,0x5F4A,0x0000,0x5F4D,0x4654,0x5F4F,
- 0xC9B0,0x0000,0x0000,0xC9B1,0x0000,0x0000,0x4375,0x426D,
- 0x0000,0x0000,0x0000,0x0000,0x4025,0x0000,0x0000,0xC9B2,
- 0x5F50,0x0000,0x5F52,0x0000,0xC9B3,0x0000,0x0000,0xC9B4,
- 0x0000,0xC9B5,0x0000,0x0000,0xC9B6,0x0000,0x5F51,0x0000,
- 0x0000,0x0000,0x0000,0xC9B7,0xC9B8,0x0000,0x0000,0x0000,
- 0xC9B9,0xC9BA,0xC9BB,0xC9BC,0x5E75,0x0000,0xC9C1,0x0000,
- 0x0000,0x5F53,0x0000,0x0000,0xC9BD,0xC9BE,0x0000,0x0000,
- 0x4667,0x0000,0x0000,0x0000,0x0000,0xC9BF,0xC9C0,0x0000,
- 0x0000,0x0000,0x0000,0x5F54,0xC9C2,0xC9C3,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x3250,0xC9C4,0x0000,0xC9C5,0x4574,
- 0x3325,0x0000,0x0000,0x0000,0x0000,0xC9C6,0xC9C7,0x0000,
- 0x3564,0x0000,0x0000,0x0000,0x3C5E,0x3A52,0xC9C8,0x0000,
- 0x0000,0xC9C9,0x0000,0x0000,0x0000,0xC9CA,0xC9CB,0x0000,
- 0x0000,0x4F27,0x3F66,0x0000,0x0000,0x0000,0x316A,0x0000,
- 0x0000,0x0000,0x5F56,0x0000,0xC9CC,0xC9CD,0xC9CE,0xC9CF,
- 0xC9D0,0x5F55,0x0000,0xC9D1,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0xC9D2,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0xC9D3,0x5F59,0x433A,0x5F5C,0x5F57,
- 0xC9D4,0xC9D5,0x0000,0x5F5B,0xC9D6,0x0000,0x0000,0xC9D7,
- 0x5F5A,0x4540,0x3059,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x4E75,0x0000,0xC9D8,0x5F5E,0x0000,0x0000,0x0000,0x3128,
- 0x0000,0xC9D9,0x0000,0xC9DA,0xC9DB,0xC9DC,0xC9DD,0x0000,
- 0xC9DE,0x5F60,0x0000,0x0000,0xC9DF,0x5F5F,0x0000,0x5F5D,
- 0x0000,0x0000,0x0000,0x0000,0xC9E0,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x5F58,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x4B23,0xC9E1,0x0000,0x0000,0x5F62,0x0000,0x0000,
-
- /* 7100h */
- 0x0000,0x0000,0x0000,0xC9E2,0xC9E3,0xC9E4,0xC9E5,0xC9E6,
- 0x0000,0x5F61,0x0000,0xC9E7,0xC9E8,0x0000,0x0000,0xC9E9,
- 0x0000,0x0000,0x0000,0x0000,0x316B,0x0000,0x0000,0x0000,
- 0x0000,0x5F64,0x4A32,0x0000,0x5F63,0x0000,0xC9EA,0x0000,
- 0xC9EB,0x4C35,0x0000,0x0000,0x0000,0x0000,0x3E47,0x0000,
- 0x0000,0x0000,0x0000,0xC9EC,0x0000,0xC9ED,0x0000,0xC9EE,
- 0xC9EF,0xC9F0,0x0000,0x0000,0x0000,0x0000,0x4133,0x0000,
- 0xC9F1,0x0000,0x0000,0x0000,0x3E46,0x0000,0x0000,0x0000,
- 0x0000,0xC9F2,0x0000,0x0000,0x0000,0xC9F3,0xC9F4,0xC9F5,
- 0x0000,0x4E7B,0xC9F6,0xC9F7,0x5F6A,0x0000,0x4079,0x0000,
- 0xC9F8,0x0000,0xC9F9,0x0000,0x0000,0x5F66,0x5F6B,0xC9FA,
- 0x0000,0x316C,0xC9FB,0x0000,0xC9FC,0x0000,0xC9FD,0x0000,
- 0xC9FE,0x0000,0x5F69,0x0000,0x4761,0x5F65,0x5F68,0x3E48,
- 0xCAA1,0x4851,0x0000,0x0000,0x5F6C,0x0000,0x3C51,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0xCAA2,0x0000,0x0000,0x0000,0x407A,0x0000,0x0000,
- 0xCAA3,0x0000,0x0000,0x0000,0x5F6F,0xCAA4,0x0000,0xCAA5,
- 0x5F67,0x0000,0x3727,0x0000,0xCAA6,0x0000,0x0000,0x5F6D,
- 0x0000,0x0000,0xCAA7,0x0000,0x4D50,0x5F70,0x0000,0x0000,
- 0x0000,0x7426,0xCAA8,0xCAA9,0x0000,0x0000,0x0000,0x3D4F,
- 0xCAAA,0x0000,0xCAAB,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x5F71,0x0000,0x0000,0x0000,0x5F72,0x0000,0x0000,0xCAAC,
- 0xCAAD,0x472E,0xCAAE,0xCAAF,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x5F74,0xCAB0,0x0000,0x0000,0x0000,0x5F75,0xCAB1,
- 0xCAB2,0xCAB3,0x0000,0x4733,0xCAB4,0x0000,0x0000,0x0000,
- 0x4575,0x5F77,0x0000,0xCAB5,0xCAB6,0x0000,0x5F79,0x0000,
- 0x4E55,0x0000,0x5F76,0xCAB7,0x5F78,0x316D,0xCAB8,0x5F73,
- 0x0000,0xCAB9,0xCABA,0x0000,0xCABB,0x0000,0x0000,0x535B,
- 0x5F7A,0x0000,0x0000,0x0000,0x0000,0x4167,0x3B38,0x5F7C,
- 0x0000,0x0000,0x0000,0x0000,0x5F7B,0x3F24,0x5259,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x5F7D,0x0000,0x0000,
- 0xCABC,0x6021,0x0000,0x5F6E,0x5F7E,0x0000,0xCABD,0x6022,
-
- /* 7200h */
- 0xCABE,0x0000,0x0000,0x0000,0x0000,0x0000,0x477A,0xCABF,
- 0xCAC0,0xCAC1,0x0000,0x0000,0x0000,0x6023,0x0000,0x0000,
- 0x6024,0x0000,0x0000,0xCAC2,0x0000,0x0000,0x0000,0xCAC3,
- 0x0000,0x0000,0xCAC4,0x6025,0x0000,0xCAC5,0x0000,0xCAC6,
- 0x0000,0x0000,0x0000,0x0000,0xCAC7,0x0000,0x0000,0x0000,
- 0x6026,0x0000,0x445E,0xCAC8,0x6028,0x6027,0x0000,0xCAC9,
- 0x6029,0x0000,0x602A,0x0000,0xCACA,0x3C5F,0x4963,0x0000,
- 0xCACB,0xCACC,0x4C6C,0x602B,0x602C,0x4156,0x3C24,0x602D,
- 0x602E,0xCACD,0xCACE,0xCACF,0x0000,0xCAD0,0x602F,0x4A52,
- 0x4847,0x0000,0x0000,0x6030,0x4757,0x0000,0xCAD1,0xCAD2,
- 0xCAD3,0x0000,0x442D,0xCAD4,0x0000,0xCAD5,0xCAD6,0x0000,
- 0x6031,0x3267,0xCAD7,0x356D,0xCAD8,0x4C46,0xCAD9,0x4C36,
- 0xCADA,0x3234,0x4F34,0xCADB,0x0000,0x0000,0x0000,0x4B52,
- 0xCADC,0x4A2A,0x0000,0xCADD,0x0000,0x0000,0xCADE,0xCADF,
- 0x0000,0xCAE0,0x4037,0x0000,0x6032,0x0000,0x0000,0xCAE1,
- 0xCAE2,0x4643,0x0000,0xCAE3,0xCAE4,0x3823,0x6033,0xCAE5,
- 0x3A54,0x6035,0x6034,0x0000,0xCAE6,0x0000,0x0000,0x6036,
- 0x0000,0xCAE7,0x0000,0x0000,0x0000,0xCAE8,0xCAE9,0x0000,
- 0x0000,0x0000,0x6037,0xCAEA,0x0000,0x0000,0x6038,0x0000,
- 0x0000,0x0000,0x0000,0xCAEB,0x0000,0x0000,0x0000,0x0000,
- 0x353E,0x0000,0x6039,0x0000,0x0000,0x0000,0x0000,0x603A,
- 0xCAEC,0x0000,0x0000,0x0000,0x3824,0xCAED,0xCAEE,0x4848,
- 0x0000,0xCAEF,0x603C,0x0000,0xCAF0,0x0000,0x3E75,0x0000,
- 0x0000,0x603B,0x0000,0x0000,0x0000,0x0000,0xCAF1,0x0000,
- 0x0000,0xCAF2,0x3638,0x603D,0x603F,0x0000,0x603E,0xCAF3,
- 0x0000,0xCAF4,0x0000,0x0000,0xCAF5,0x0000,0x6040,0x0000,
- 0x3851,0x0000,0x6041,0x0000,0x0000,0xCAF6,0xCAF7,0x3669,
- 0xCAF8,0x4140,0x0000,0x397D,0x0000,0x0000,0x0000,0xCAF9,
- 0x6043,0x6044,0x6042,0x0000,0x0000,0xCAFA,0x0000,0x0000,
- 0x0000,0x3C6D,0x0000,0x0000,0x4648,0x3639,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0xCAFB,0xCAFC,0x0000,0x0000,0x6046,
- 0x432C,0x6045,0xCAFD,0xCAFE,0x4F35,0x4762,0xCBA1,0x0000,
-
- /* 7300h */
- 0x0000,0x0000,0xCBA2,0x0000,0xCBA3,0xCBA4,0x0000,0xCBA5,
- 0x0000,0x0000,0x6049,0xCBA6,0x0000,0xCBA7,0x0000,0x0000,
- 0x0000,0x0000,0xCBA8,0xCBA9,0x0000,0x0000,0x604B,0x6048,
- 0xCBAA,0xCBAB,0x0000,0x4C54,0x604A,0x604C,0xCBAC,0x4E44,
- 0x0000,0x0000,0xCBAD,0x0000,0xCBAE,0x6050,0x0000,0xCBAF,
- 0xCBB0,0x604F,0x4376,0x472D,0xCBB1,0x0000,0x3825,0x604E,
- 0x0000,0xCBB2,0xCBB3,0x0000,0x604D,0xCBB4,0x4D31,0x4D32,
- 0x0000,0x0000,0xCBB5,0xCBB6,0x0000,0xCBB7,0x6051,0x316E,
- 0x0000,0x0000,0x0000,0xCBB8,0x3976,0x3B62,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0xCBB9,0x6052,0x6053,
- 0xCBBA,0x0000,0xCBBB,0x0000,0x0000,0x0000,0xCBBC,0x6055,
- 0xCBBD,0x0000,0x0000,0x0000,0x0000,0xCBBE,0xCBBF,0xCBC0,
- 0xCBC1,0x0000,0x0000,0x3D43,0x0000,0x0000,0xCBC2,0xCBC3,
- 0x6057,0xCBC4,0x6056,0xCBC5,0xCBC6,0x0000,0xCBC7,0xCBC8,
- 0x6058,0xCBC9,0x334D,0x0000,0x0000,0x605A,0x0000,0xCBCA,
- 0x6059,0xCBCB,0x605C,0x605B,0xCBCC,0x0000,0x0000,0x0000,
- 0xCBCD,0xCBCE,0x0000,0xCBCF,0x383C,0xCBD0,0xCBD1,0x4E28,
- 0x0000,0x364C,0x0000,0x3226,0x0000,0x0000,0xCBD2,0x0000,
- 0xCBD3,0x0000,0x0000,0xCBD4,0x0000,0xCBD5,0x366A,0xCBD6,
- 0xCBD7,0x0000,0x0000,0x0000,0xCBD8,0x0000,0xCBD9,0xCBDA,
- 0xCBDB,0x0000,0xCBDC,0x0000,0x0000,0xCBDD,0xCBDE,0x0000,
- 0x0000,0x3461,0xCBDF,0xCBE0,0x0000,0xCBE1,0x0000,0x0000,
- 0x0000,0x0000,0x4E68,0x605E,0x0000,0xCBE2,0x0000,0xCBE3,
- 0x0000,0xCBE4,0x0000,0x6060,0xCBE5,0xCBE6,0x0000,0xCBE7,
- 0x6061,0x0000,0x3251,0x0000,0x0000,0xCBE8,0xCBE9,0x0000,
- 0x605D,0xCBEA,0x3B39,0xCBEB,0xCBEC,0x4441,0x605F,0xCBED,
- 0x0000,0x0000,0xCBEE,0xCBEF,0x0000,0x0000,0xCBF0,0x0000,
- 0x0000,0xCBF1,0x0000,0x0000,0x0000,0xCBF2,0x6064,0x0000,
- 0x3C6E,0xCBF3,0x0000,0xCBF4,0x0000,0x6062,0xCBF5,0xCBF6,
- 0x0000,0xCBF7,0x373E,0x0000,0x0000,0x4849,0x6063,0x0000,
- 0x0000,0x607E,0x0000,0x0000,0xCBF8,0xCBF9,0x0000,0xCBFA,
- 0x6069,0xCBFB,0xCBFC,0xCBFD,0x0000,0xCBFE,0x383D,0xCCA1,
-
- /* 7400h */
- 0xCCA2,0xCCA3,0x0000,0x3565,0xCCA4,0x6066,0x4D7D,0xCCA5,
- 0x0000,0x4E30,0xCCA6,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0xCCA7,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0xCCA8,0xCCA9,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x4276,0x0000,0xCCAA,0x6068,0xCCAB,0x0000,
- 0xCCAC,0xCCAD,0xCCAE,0xCCAF,0xCCB0,0xCCB1,0xCCB2,0xCCB3,
- 0xCCB4,0xCCB5,0x606A,0x4E56,0x3657,0x487C,0x474A,0x0000,
- 0x0000,0xCCB6,0x606B,0x0000,0x0000,0x0000,0x0000,0x606D,
- 0xCCB7,0x6070,0x0000,0xCCB8,0xCCB9,0x0000,0xCCBA,0xCCBB,
- 0x0000,0x0000,0x0000,0xCCBC,0x0000,0xCCBD,0x0000,0x0000,
- 0x0000,0xCCBE,0xCCBF,0x0000,0x0000,0x606C,0x0000,0xCCC0,
- 0x0000,0x606F,0x386A,0x314D,0x6071,0xCCC1,0x3F70,0x606E,
- 0x4E5C,0x0000,0xCCC2,0x6074,0x7424,0x0000,0xCCC3,0xCCC4,
- 0xCCC5,0x6072,0x6075,0xCCC6,0x0000,0xCCC7,0xCCC8,0x6067,
- 0x6073,0xCCC9,0xCCCA,0x3A3C,0x0000,0x0000,0x6076,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x6077,0x0000,
- 0xCCCB,0xCCCC,0x0000,0x4D7E,0x0000,0xCCCD,0xCCCE,0xCCCF,
- 0x0000,0xCCD0,0x0000,0x6078,0x0000,0x0000,0x0000,0xCCD1,
- 0xCCD2,0xCCD3,0xCCD4,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0xCCD5,0xCCD6,0xCCD7,0x0000,0xCCD8,0x0000,0x6079,0xCCD9,
- 0xCCDA,0xCCDB,0x6065,0xCCDC,0x0000,0x0000,0xCCDD,0x607A,
- 0xCCDE,0xCCDF,0xCCE0,0xCCE1,0x0000,0x0000,0xCCE2,0xCCE3,
- 0x3444,0xCCE4,0xCCE5,0x0000,0x0000,0xCCE6,0x0000,0x0000,
- 0x0000,0xCCE7,0x0000,0xCCE8,0x0000,0x3C25,0x0000,0xCCE9,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0xCCEA,0xCCEB,0x607B,0x0000,0xCCEC,0x0000,0x0000,0x607C,
- 0xCCED,0x0000,0x0000,0xCCEE,0x607D,0x0000,0x0000,0x0000,
- 0xCCEF,0x0000,0xCCF0,0xCCF1,0x313B,0x0000,0xCCF2,0xCCF3,
- 0x6121,0x0000,0x493B,0x6122,0xCCF4,0x0000,0x3424,0x6123,
- 0xCCF5,0x6124,0xCCF6,0xCCF7,0x0000,0x0000,0x6125,0xCCF8,
- 0x6127,0x6128,0x6126,0x0000,0xCCF9,0x0000,0x4953,0x612A,
- 0x6129,0x0000,0xCCFA,0xCCFB,0xCCFC,0x0000,0x0000,0xCCFD,
-
- /* 7500h */
- 0x0000,0x0000,0x0000,0x612C,0x612B,0x612D,0xCCFE,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x612E,0x6130,0x612F,0x0000,
- 0x0000,0x3979,0xCDA1,0x6132,0x0000,0x6131,0xCDA2,0xCDA3,
- 0x3445,0x0000,0x3F53,0x0000,0x453C,0x0000,0x6133,0x4038,
- 0xCDA4,0xCDA5,0x0000,0x3B3A,0xCDA6,0x3179,0x6134,0xCDA7,
- 0x4D51,0xCDA8,0xCDA9,0x4A63,0x6135,0x0000,0x0000,0xCDAA,
- 0x4544,0x4D33,0x3943,0x3F3D,0x0000,0x0000,0xCDAB,0x434B,
- 0x5234,0xCDAC,0x442E,0x3268,0x6136,0xCDAD,0xCDAE,0xCDAF,
- 0xCDB0,0x0000,0x0000,0xCDB1,0x6137,0x0000,0x613C,0xCDB2,
- 0xCDB3,0x613A,0x6139,0x5A42,0x3326,0x6138,0xCDB4,0x305A,
- 0xCDB5,0x482A,0xCDB6,0x0000,0x484A,0x0000,0x0000,0xCDB7,
- 0x0000,0x4E31,0x613D,0x613B,0x435C,0x4026,0xCDB8,0xCDB9,
- 0x482B,0xCDBA,0x492D,0x0000,0x613F,0x4E2C,0x374D,0x6140,
- 0x0000,0x613E,0x4856,0x6141,0x0000,0x6142,0x0000,0xCDBB,
- 0x305B,0xCDBC,0x0000,0x3E76,0x6147,0x0000,0x6144,0x466D,
- 0x6143,0xCDBD,0xCDBE,0xCDBF,0xCDC0,0xCDC1,0xCDC2,0x3526,
- 0x0000,0xCDC3,0x614A,0x0000,0x0000,0xCDC4,0x6145,0x6146,
- 0x0000,0x6149,0x6148,0x4925,0x0000,0x0000,0x4142,0x4141,
- 0xCDC5,0x353F,0xCDC6,0xCDC7,0x614B,0xCDC8,0x0000,0x0000,
- 0x0000,0xCDC9,0x614C,0x0000,0xCDCA,0x614D,0x0000,0x0000,
- 0x0000,0x0000,0xCDCB,0x614F,0xCDCC,0x614E,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x3156,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x6157,0x4868,0x6151,0xCDCD,0x6153,0x0000,0x0000,
- 0x6155,0x3F3E,0xCDCE,0x0000,0x6156,0x6154,0x3C40,0xCDCF,
- 0xCDD0,0xCDD1,0x6150,0x6152,0xCDD2,0x4942,0xCDD3,0x3E49,
- 0x0000,0x0000,0x6159,0x0000,0xCDD4,0x6158,0xCDD5,0xCDD6,
- 0x0000,0x0000,0x615A,0x0000,0x3C26,0x3A2F,0x0000,0xCDD7,
- 0x4577,0x615B,0x0000,0x444B,0xCDD8,0x0000,0x615D,0xCDD9,
- 0xCDDA,0xCDDB,0x4E21,0x615C,0xCDDC,0x0000,0x0000,0xCDDD,
- 0x0000,0x4169,0x0000,0x0000,0xCDDE,0x0000,0xCDDF,0xCDE0,
- 0x6162,0xCDE1,0x6164,0x6165,0x4354,0x0000,0x0000,0x0000,
- 0x0000,0xCDE2,0x6163,0x0000,0x6160,0x0000,0x615E,0x615F,
-
- /* 7600h */
- 0xCDE3,0x6161,0xCDE4,0xCDE5,0xCDE6,0x0000,0x0000,0xCDE7,
- 0xCDE8,0x6168,0xCDE9,0x6166,0xCDEA,0x6167,0x0000,0xCDEB,
- 0x0000,0x0000,0xCDEC,0xCDED,0x0000,0xCDEE,0xCDEF,0x0000,
- 0x0000,0xCDF0,0x0000,0xCDF1,0xCDF2,0xCDF3,0xCDF4,0x6169,
- 0x616B,0x616C,0x616D,0xCDF5,0x616E,0xCDF6,0xCDF7,0x616A,
- 0x0000,0xCDF8,0x0000,0x0000,0x0000,0xCDF9,0x0000,0x0000,
- 0x6170,0x0000,0xCDFA,0xCDFB,0x616F,0xCDFC,0x0000,0x0000,
- 0xCDFD,0xCDFE,0xCEA1,0x6171,0xCEA2,0x0000,0x0000,0x0000,
- 0xCEA4,0xCEA5,0x4E45,0xCEA6,0xCEA7,0xCEA8,0x6174,0x6172,
- 0x6173,0xCEA9,0xCEA3,0xCEAA,0x3462,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x4C7E,0x0000,0x0000,0xCEAB,0x4A4A,0x0000,
- 0x6176,0xCEAC,0x0000,0x0000,0x6175,0x0000,0x0000,0xCEAD,
- 0x0000,0x6177,0x6178,0x0000,0xCEAE,0xCEAF,0x0000,0x617C,
- 0x6179,0x617A,0x617B,0x0000,0x617D,0xCEB0,0xCEB1,0xCEB2,
- 0x617E,0xCEB3,0x6221,0x0000,0xCEB4,0x0000,0x6222,0x0000,
- 0x6223,0x0000,0x482F,0x4550,0x6224,0x4772,0x4934,0x0000,
- 0x6225,0xCEB5,0x0000,0x6226,0x452A,0xCEB6,0x3327,0x3944,
- 0x6227,0x0000,0x0000,0x6228,0xCEB7,0xCEB8,0x6229,0x0000,
- 0x3B29,0x0000,0x0000,0x622B,0x0000,0xCEB9,0x622A,0x0000,
- 0x0000,0x622C,0x622D,0xCEBA,0xCEBB,0xCEBC,0x0000,0xCEBD,
- 0xCEBE,0x0000,0xCEBF,0xCEC0,0xCEC1,0xCEC2,0xCEC3,0xCEC4,
- 0xCEC5,0x0000,0xCEC6,0x0000,0x0000,0xCEC7,0x4869,0x0000,
- 0x622E,0x0000,0x0000,0x0000,0x622F,0x0000,0x0000,0x7369,
- 0x6230,0x6231,0x6232,0x0000,0x0000,0xCEC8,0x0000,0x3B2E,
- 0x0000,0xCEC9,0x6233,0x4756,0x0000,0xCECA,0x4B5F,0x0000,
- 0x314E,0xCECB,0x3157,0xCECC,0xCECD,0x6234,0xCECE,0x0000,
- 0x0000,0x0000,0x6236,0x0000,0xCECF,0x0000,0x6235,0x4570,
- 0x0000,0xCED0,0x0000,0x4039,0x5D39,0x0000,0x6237,0x4C41,
- 0xCED1,0x6238,0x0000,0x3446,0x4857,0x6239,0xCED2,0x623A,
- 0xCED3,0x0000,0x623B,0x0000,0xCED4,0x0000,0x4C5C,0x0000,
- 0xCED5,0xCED6,0x4C55,0x0000,0x443E,0x0000,0xCED7,0x0000,
- 0x416A,0xCED8,0x0000,0x623D,0xCED9,0x0000,0x3D62,0x0000,
-
- /* 7700h */
- 0xCEDA,0x3E4A,0x0000,0x0000,0x6240,0x0000,0xCEDB,0x623F,
- 0x623E,0x487D,0xCEDC,0x3447,0x3829,0x0000,0xCEDD,0x0000,
- 0x0000,0x0000,0xCEDE,0x0000,0xCEDF,0xCEE0,0x0000,0xCEE1,
- 0x0000,0xCEE2,0xCEE3,0x6246,0xCEE4,0x0000,0x6243,0x3F3F,
- 0x4C32,0x0000,0xCEE5,0x0000,0x6242,0x6244,0x6245,0x0000,
- 0xCEE6,0x6241,0x0000,0x0000,0x0000,0xCEE7,0xCEE8,0xCEE9,
- 0x0000,0x0000,0x0000,0x0000,0xCEEA,0xCEEB,0xCEEC,0x6247,
- 0x6248,0xCEED,0x442F,0x0000,0x3463,0xCEEE,0xCEEF,0x0000,
- 0x4365,0x0000,0xCEF0,0x0000,0x0000,0xCEF1,0xCEF2,0x6249,
- 0x0000,0x0000,0xCEF3,0x0000,0x0000,0xCEF4,0xCEF5,0xCEF6,
- 0x0000,0x0000,0xCEF7,0x0000,0x0000,0x0000,0xCEF8,0xCEF9,
- 0x0000,0x0000,0x624A,0x624D,0xCEFA,0x0000,0xCEFB,0xCEFC,
- 0xCEFD,0x3F67,0xCEFE,0x4644,0xCFA1,0x624E,0x4B53,0xCFA2,
- 0x624B,0x0000,0xCFA3,0x624C,0xCFA4,0x0000,0x0000,0x0000,
- 0xCFA5,0x0000,0xCFA6,0xCFA7,0xCFA8,0x0000,0x0000,0x0000,
- 0x0000,0x6251,0xCFA9,0x0000,0x0000,0xCFAA,0x6250,0x624F,
- 0xCFAB,0x0000,0x0000,0x0000,0xCFAC,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x6253,0xCFAD,0xCFAE,0x6252,0x0000,
- 0x0000,0x6254,0x0000,0x0000,0xCFAF,0xCFB0,0xCFB1,0x0000,
- 0x0000,0x0000,0xCFB2,0x0000,0x0000,0x0000,0x6256,0xCFB3,
- 0x6255,0x0000,0xCFB4,0x0000,0x0000,0x4A4D,0x0000,0xCFB5,
- 0x0000,0x0000,0xCFB6,0x0000,0x3D56,0x4E46,0xCFB7,0xCFB8,
- 0x6257,0xCFB9,0x0000,0x4637,0x0000,0xCFBA,0x6258,0x0000,
- 0x0000,0x6259,0x0000,0x625D,0x625B,0x625C,0xCFBB,0x625A,
- 0x0000,0x0000,0x0000,0xCFBC,0x0000,0x0000,0x0000,0x625E,
- 0x0000,0xCFBD,0x0000,0x0000,0x0000,0x625F,0x0000,0x0000,
- 0x0000,0xCFBE,0xCFBF,0x0000,0x0000,0xCFC0,0x0000,0x6260,
- 0x0000,0xCFC1,0x6261,0x4C37,0x6262,0x0000,0xCFC2,0xCFC3,
- 0xCFC4,0x0000,0x4C70,0x6263,0xCFC5,0x434E,0xCFC6,0x476A,
- 0x0000,0x366B,0xCFC7,0x0000,0xCFC8,0x433B,0x6264,0x363A,
- 0xCFC9,0xCFCA,0x0000,0x4050,0xCFCB,0x0000,0x0000,0x0000,
- 0xCFCC,0x0000,0x0000,0xCFCD,0x6265,0x0000,0x0000,0x0000,
-
- /* 7800h */
- 0x0000,0x0000,0x3A3D,0x0000,0x0000,0xCFCE,0xCFCF,0x0000,
- 0x0000,0xCFD0,0x0000,0x0000,0x6266,0xCFD1,0xCFD2,0x0000,
- 0x0000,0xCFD3,0x6267,0x0000,0x3826,0x3A55,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0xCFD4,0x0000,0x0000,
- 0x6269,0xCFD5,0xCFD6,0xCFD7,0x0000,0x4556,0x3A56,0x354E,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0xCFD8,0xCFD9,0x0000,
- 0xCFDA,0x0000,0x4B24,0x0000,0x474B,0xCFDB,0x0000,0xCFDC,
- 0x0000,0x0000,0x4557,0x0000,0x0000,0x0000,0x0000,0x395C,
- 0x0000,0x0000,0x0000,0xCFDD,0xCFDE,0x626B,0x0000,0xCFDF,
- 0xCFE0,0x0000,0x0000,0x0000,0xCFE1,0x0000,0xCFE2,0x0000,
- 0x0000,0x0000,0xCFE3,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0xCFE4,0x3E4B,0xCFE5,0x0000,
- 0xCFE6,0xCFE7,0x0000,0xCFE8,0xCFE9,0x0000,0x0000,0x0000,
- 0xCFEA,0x0000,0xCFEB,0x4E32,0x3945,0x0000,0xCFEC,0x3827,
- 0x0000,0x0000,0x4823,0x0000,0x626D,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0xCFED,0x0000,0x626F,0x0000,0xCFEE,0x0000,
- 0x0000,0x386B,0x0000,0x0000,0x0000,0x0000,0x626E,0x4476,
- 0x0000,0x0000,0xCFEF,0x0000,0x6271,0x3337,0x626C,0xCFF0,
- 0x0000,0x486A,0x0000,0x3130,0xCFF1,0x3A6C,0x0000,0x4F52,
- 0xCFF2,0x0000,0x6270,0x0000,0x0000,0xCFF4,0xCFF5,0xCFF6,
- 0x0000,0xCFF3,0x0000,0x6272,0xCFF7,0x0000,0x0000,0x4A4B,
- 0xCFF8,0x4059,0x6274,0x0000,0xCFF9,0xCFFA,0x0000,0x6275,
- 0xCFFB,0xCFFC,0xCFFD,0xCFFE,0x0000,0x6273,0x0000,0x0000,
- 0x0000,0x0000,0x334E,0xD0A1,0x627B,0xD0A2,0x627A,0xD0A3,
- 0x0000,0x3C27,0x0000,0x0000,0x0000,0x627C,0x6277,0xD0A4,
- 0xD0A5,0xD0A6,0x627D,0x6278,0xD0A7,0x0000,0xD0A8,0x0000,
- 0x4858,0x6276,0xD0A9,0xD0AA,0x6279,0xD0AB,0xD0AC,0x0000,
- 0x0000,0x0000,0x6322,0xD0AE,0x0000,0x0000,0x0000,0xD0AF,
- 0xD0B0,0xD0B1,0x0000,0x0000,0xD0AD,0x0000,0xD0B2,0x6321,
- 0x4B61,0x0000,0xD0B3,0x0000,0x627E,0x0000,0x0000,0x306B,
- 0x0000,0x0000,0xD0B4,0xD0B5,0x6324,0x0000,0xD0B7,0xD0B8,
- 0x0000,0x0000,0xD0B9,0xD0BA,0x0000,0x6323,0x0000,0xD0BB,
-
- /* 7900h */
- 0xD0B6,0x3E4C,0x0000,0x0000,0x0000,0x0000,0xD0BC,0x6325,
- 0x0000,0x0000,0x0000,0x0000,0xD0BD,0x0000,0x4143,0x0000,
- 0xD0BE,0x6327,0x6326,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x6328,0xD0BF,0x0000,0xD0C0,0x0000,0xD0C1,0xD0C2,
- 0xD0C3,0x0000,0x0000,0x0000,0x0000,0xD0C4,0x6268,0xD0C5,
- 0x0000,0xD0C6,0x626A,0x632A,0x6329,0xD0C7,0x0000,0x0000,
- 0x0000,0xD0C8,0x0000,0x0000,0xD0C9,0xD0CA,0x0000,0x0000,
- 0x0000,0x0000,0x3C28,0xD0CB,0x4E69,0xD0CC,0x3C52,0xD0CD,
- 0x632B,0x3737,0x0000,0x0000,0xD0CE,0xD0CF,0xD0D0,0x3540,
- 0x3527,0x3B63,0xD0D1,0xD0D2,0x0000,0x0000,0x0000,0xD0D3,
- 0x4D34,0xD0D4,0x0000,0x6331,0xD0D5,0x6330,0x4144,0x632D,
- 0xD0D6,0x0000,0x632F,0xD0D7,0xD0D8,0x3D4B,0x3F40,0x632E,
- 0x632C,0x0000,0x472A,0x0000,0x0000,0x3E4D,0x0000,0xD0D9,
- 0x493C,0xD0DA,0x0000,0xD0DB,0x0000,0x3A57,0x0000,0x0000,
- 0x0000,0x0000,0xD0DC,0x0000,0x0000,0x0000,0x0000,0x4578,
- 0x0000,0xD0DD,0x6332,0xD0DE,0xD0DF,0x0000,0xD0E0,0x6333,
- 0x6349,0x3658,0x0000,0x0000,0x4F3D,0x4135,0x0000,0x0000,
- 0x0000,0x0000,0x6334,0xD0E1,0xD0E2,0x3252,0x4477,0x4A21,
- 0x0000,0xD0E3,0x0000,0xD0E4,0xD0E5,0xD0E6,0xD0E7,0x0000,
- 0xD0E8,0x0000,0x0000,0xD0E9,0xD0EA,0x6335,0x0000,0x0000,
- 0x0000,0xD0EB,0x0000,0x0000,0x0000,0x0000,0x357A,0x6336,
- 0xD0EC,0xD0ED,0x6338,0xD0EE,0x0000,0x0000,0x6339,0xD0EF,
- 0x4729,0xD0F0,0x0000,0x633A,0xD0F1,0x0000,0x0000,0x0000,
- 0xD0F2,0x633B,0x633C,0xD0F3,0x0000,0x3659,0x3253,0x4645,
- 0x3D28,0x3B64,0xD0F4,0x0000,0xD0F5,0x0000,0x0000,0xD0F6,
- 0xD0F7,0x633D,0xD0F8,0x3D29,0x0000,0x0000,0x0000,0xD0F9,
- 0x0000,0x324A,0x4943,0x0000,0xD0FA,0x633E,0xD0FB,0x0000,
- 0x486B,0x0000,0xD0FC,0x0000,0x0000,0xD0FD,0xD0FE,0x4145,
- 0xD1A1,0x6341,0xD1A2,0x6342,0x4769,0xD1A3,0x3F41,0x633F,
- 0x0000,0x4361,0xD1A4,0xD1A5,0x6340,0xD1A6,0x0000,0x0000,
- 0x3E4E,0xD1A7,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0xD1A8,0x0000,0x0000,0x305C,0xD1A9,0x0000,0x0000,0x0000,
-
- /* 7A00h */
- 0x3529,0x0000,0xD1AA,0xD1AB,0x0000,0x0000,0x0000,0xD1AC,
- 0x6343,0xD1AD,0xD1AE,0x4478,0xD1AF,0x6344,0x4047,0x0000,
- 0x0000,0xD1B0,0x0000,0x0000,0x4C2D,0xD1B1,0x0000,0x4923,
- 0x6345,0x6346,0x4355,0xD1B2,0x4E47,0x0000,0xD1B3,0x6348,
- 0x6347,0xD1B4,0x0000,0x0000,0x0000,0x0000,0x0000,0xD1B5,
- 0x0000,0x0000,0x0000,0xD1B6,0x0000,0xD1B7,0x3C6F,0xD1B8,
- 0xD1B9,0x634A,0x3070,0x0000,0xD1BA,0xD1BB,0x0000,0x634D,
- 0xD1BC,0xD1BD,0xD1BE,0x634B,0x3254,0x374E,0x634C,0x3946,
- 0x3972,0x0000,0x4A66,0x634E,0xD1BF,0xD1C0,0x4B54,0xD1C1,
- 0xD1C2,0x6350,0x0000,0x0000,0xD1C3,0x4051,0x314F,0x323A,
- 0x302C,0x0000,0x0000,0x0000,0x0000,0xD1C4,0xD1C5,0x634F,
- 0x0000,0xD1C6,0x0000,0x0000,0xD1C7,0xD1C8,0x0000,0xD1C9,
- 0xD1CA,0x6351,0x6352,0x3E77,0x0000,0xD1CB,0x0000,0xD1CC,
- 0x0000,0x6353,0xD1CD,0x334F,0x0000,0xD1CE,0x0000,0x0000,
- 0x6355,0x0000,0x0000,0x0000,0x376A,0xD1CF,0x3566,0x0000,
- 0xD1D0,0x6356,0x3675,0x0000,0x0000,0x6357,0xD1D1,0x407C,
- 0xD1D2,0x464D,0xD1D3,0x4060,0x3A75,0xD1D4,0xD1D5,0x0000,
- 0x6358,0x0000,0xD1D6,0xD1D7,0x0000,0x0000,0x0000,0x0000,
- 0xD1D8,0xD1D9,0x4362,0x416B,0xD1DA,0x635A,0x635C,0x6359,
- 0x635B,0x0000,0x0000,0x0000,0x0000,0x0000,0xD1DB,0x3722,
- 0xD1DC,0x0000,0x0000,0xD1DD,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x635D,0x3726,0x0000,0xD1DE,0x0000,0x3567,0x4D52,
- 0x635F,0x0000,0x0000,0xD1DF,0x0000,0xD1E0,0x6360,0x0000,
- 0x0000,0xD1E1,0x312E,0xD1E2,0xD1E3,0x0000,0x0000,0x6363,
- 0x0000,0x0000,0x0000,0x3376,0x6362,0x6361,0xD1E4,0x6365,
- 0x635E,0xD1E5,0x6366,0x4E29,0xD1E6,0x6367,0xD1E7,0x6368,
- 0x0000,0xD1E8,0x5474,0x636A,0x0000,0x6369,0x0000,0x0000,
- 0x0000,0x636B,0x636C,0xD1E9,0x4E35,0x636D,0x0000,0x706F,
- 0x3E4F,0x636E,0x636F,0x3D57,0x0000,0x4638,0x6370,0x0000,
- 0xD1EA,0xD1EB,0x4328,0xD1EC,0xD1ED,0x6371,0x0000,0x433C,
- 0x6372,0xD1EE,0x0000,0x0000,0xD1EF,0x0000,0x3625,0x0000,
- 0x513F,0x435D,0x3C33,0xD1F0,0x0000,0xD1F1,0xD1F2,0x3448,
-
- /* 7B00h */
- 0x0000,0x0000,0x6373,0x0000,0x6422,0x0000,0x6376,0xD1F3,
- 0x3568,0x0000,0x6375,0x6424,0x0000,0x0000,0x0000,0x6374,
- 0x0000,0x3E50,0x0000,0x0000,0xD1F4,0x0000,0x0000,0x0000,
- 0x6378,0x6379,0x0000,0x452B,0x0000,0x0000,0x637A,0xD1F5,
- 0x335E,0x0000,0x0000,0xD1F6,0x0000,0x3F5A,0x4964,0xD1F7,
- 0x637C,0xD1F8,0xD1F9,0xD1FA,0x4268,0xD1FB,0xD1FC,0xD1FD,
- 0xD1FE,0xD2A1,0x0000,0x6377,0xD2A2,0x637B,0x637D,0x0000,
- 0x0000,0x3A7B,0x0000,0x0000,0x0000,0xD2A3,0x0000,0xD2A4,
- 0xD2A5,0xD2A6,0x0000,0x0000,0x0000,0x6426,0x492E,0xD2A7,
- 0x4826,0x4579,0x0000,0x365A,0x6425,0x6423,0xD2A8,0x4835,
- 0x637E,0x435E,0x457B,0x0000,0x457A,0xD2A9,0x3A76,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x6438,0x0000,0x0000,
- 0xD2AA,0x0000,0x0000,0x0000,0xD2AB,0x6428,0xD2AC,0x642A,
- 0x0000,0xD2AD,0xD2AE,0x0000,0x642D,0xD2AF,0x642E,0xD2B0,
- 0x642B,0x642C,0xD2B1,0xD2B2,0x6429,0x6427,0x0000,0xD2B3,
- 0x0000,0x0000,0x6421,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0xD2B4,0x0000,0x4A4F,0x3255,
- 0x0000,0xD2B5,0x0000,0x6435,0x0000,0x6432,0xD2B6,0x6437,
- 0xD2B7,0xD2B8,0x6436,0x0000,0x4773,0x4C27,0xD2B9,0x3B3B,
- 0x6430,0x6439,0x6434,0xD2BA,0x6433,0x642F,0xD2BB,0x6431,
- 0xD2BC,0x3449,0x0000,0x0000,0x0000,0xD2BD,0x0000,0x0000,
- 0x0000,0x0000,0x433D,0x0000,0xD2BE,0x407D,0x0000,0xD2BF,
- 0xD2C0,0x4822,0xD2C1,0x0000,0x643E,0xD2C2,0xD2C3,0x0000,
- 0x4824,0x0000,0xD2C4,0xD2C5,0xD2C6,0xD2C7,0x0000,0x0000,
- 0x4061,0x643B,0xD2C8,0x0000,0x484F,0xD2C9,0x643F,0x4A53,
- 0xD2CA,0x435B,0xD2CB,0x643A,0x643C,0x0000,0x0000,0x643D,
- 0x0000,0x0000,0x0000,0x0000,0xD2CC,0x0000,0xD2CD,0xD2CE,
- 0x0000,0xD2CF,0xD2D0,0xD2D1,0x0000,0x6440,0x0000,0x0000,
- 0x3C44,0x0000,0x0000,0x0000,0x4646,0x6445,0x6444,0x0000,
- 0xD2D2,0x6441,0xD2D3,0x0000,0x0000,0x4F36,0x0000,0x0000,
- 0x0000,0x0000,0xD2D4,0x644A,0xD2D5,0xD2D6,0x644E,0x644B,
- 0xD2D7,0xD2D8,0xD2D9,0x0000,0xD2DA,0x0000,0xD2DB,0x0000,
-
- /* 7C00h */
- 0x6447,0xD2DC,0xD2DD,0xD2DE,0xD2DF,0x0000,0xD2E0,0x6448,
- 0x0000,0xD2E1,0x0000,0xD2E2,0xD2E3,0x644D,0xD2E4,0xD2E5,
- 0x0000,0x6442,0x5255,0x6449,0x6443,0x0000,0x0000,0x644C,
- 0x0000,0xD2E6,0x0000,0xD2E7,0x0000,0x0000,0x0000,0x6452,
- 0xD2E8,0x344A,0x0000,0x644F,0x0000,0xD2E9,0xD2EA,0x6450,
- 0xD2EB,0x0000,0x6451,0x6454,0xD2EC,0x0000,0x0000,0x0000,
- 0x0000,0xD2ED,0x0000,0xD2EE,0xD2EF,0x0000,0xD2F0,0x6453,
- 0x4876,0xD2F1,0xD2F2,0x0000,0x0000,0x6455,0x4E7C,0x4A6D,
- 0x645A,0x0000,0x0000,0x6457,0x0000,0x0000,0xD2F3,0x0000,
- 0x0000,0x0000,0xD2F4,0x0000,0x6456,0x4052,0x0000,0x6459,
- 0x645B,0xD2F6,0xD2F7,0xD2F8,0x6458,0xD2F5,0x645F,0x0000,
- 0x645C,0xD2F9,0xD2FA,0xD2FB,0xD2FC,0xD2FD,0xD2FE,0x645D,
- 0x6446,0xD3A1,0x0000,0xD3A2,0x645E,0x6460,0x0000,0xD3A3,
- 0x0000,0xD3A4,0x0000,0x0000,0x6461,0xD3A5,0xD3A6,0x0000,
- 0xD3A7,0x0000,0xD3A8,0x4A46,0x0000,0x6462,0x0000,0x0000,
- 0x0000,0xD3A9,0x0000,0x0000,0xD3AA,0xD3AB,0x4C62,0x0000,
- 0x0000,0x364E,0x3729,0x6463,0x0000,0x0000,0xD3AC,0xD3AD,
- 0x0000,0x4A34,0x0000,0x3F68,0x0000,0x4C30,0x0000,0xD3AE,
- 0x6464,0x0000,0x4E33,0x0000,0xD3AF,0x4774,0x0000,0x4146,
- 0x4734,0x0000,0x0000,0x3D4D,0x0000,0x0000,0xD3B0,0x3040,
- 0xD3B1,0x6469,0x6467,0x0000,0x6465,0x3421,0xD3B2,0x3E51,
- 0x646A,0x0000,0x0000,0x6468,0x0000,0x6466,0x646E,0x0000,
- 0xD3B3,0x646D,0x646C,0x646B,0x0000,0x0000,0xD3B4,0xD3B5,
- 0x0000,0x646F,0xD3B6,0xD3B7,0xD3B8,0x6470,0x403A,0xD3B9,
- 0x6471,0x0000,0x6473,0x0000,0xD3BA,0x6472,0x0000,0xD3BB,
- 0xD3BC,0xD3BD,0x3852,0x0000,0x0000,0xD3BE,0x4138,0xD3BF,
- 0x0000,0x0000,0x6475,0xD3C0,0xD3C1,0xD3C2,0x457C,0xD3C3,
- 0x6474,0xD3C4,0xD3C5,0x0000,0x6476,0xD3C6,0x4A35,0x416C,
- 0x3947,0x0000,0x6477,0x0000,0x0000,0x0000,0xD3C7,0x4E48,
- 0x0000,0xD3C8,0x0000,0xD3C9,0x0000,0x0000,0x0000,0x6479,
- 0x0000,0x0000,0x647A,0x0000,0x647B,0xD3CA,0x647C,0x0000,
- 0x3B65,0x0000,0x647D,0x374F,0x0000,0x0000,0x356A,0x0000,
-
- /* 7D00h */
- 0x352A,0x0000,0x6521,0xD3CB,0x4C73,0x3948,0x647E,0xD3CC,
- 0xD3CD,0xD3CE,0x6524,0x4C66,0x0000,0x473C,0x0000,0xD3CF,
- 0x4933,0xD3D0,0xD3D1,0xD3D2,0x3D63,0x6523,0xD3D3,0x3C53,
- 0x3949,0x3B66,0x3569,0x4A36,0x6522,0xD3D4,0xD3D5,0x0000,
- 0x4147,0x4B42,0x3A77,0xD3D6,0x0000,0x0000,0xD3D7,0x0000,
- 0x0000,0x0000,0xD3D8,0x3B67,0x445D,0xD3D9,0x6527,0x4E5F,
- 0x3A59,0xD3DA,0x6528,0x3F42,0x0000,0x652A,0x0000,0x0000,
- 0x0000,0x3E52,0x3A30,0x0000,0xD3DB,0xD3DC,0xD3DD,0x6529,
- 0xD3DE,0xD3DF,0x3D2A,0x383E,0x4148,0x6525,0x652B,0xD3E0,
- 0xD3E1,0x0000,0x0000,0x6526,0x3750,0xD3E2,0x652E,0x6532,
- 0x376B,0xD3E3,0x0000,0xD3E4,0x0000,0x0000,0x652D,0xD3E5,
- 0x0000,0xD3E6,0xD3E7,0x6536,0xD3E8,0xD3E9,0x394A,0x0000,
- 0x0000,0x4D6D,0x303C,0x6533,0x0000,0xD3EA,0x356B,0xD3EB,
- 0x6530,0x0000,0xD3EC,0x0000,0x0000,0x0000,0x6531,0x0000,
- 0xD3ED,0x457D,0x652F,0x652C,0x0000,0x3328,0x4064,0x0000,
- 0xD3EE,0x3828,0xD3EF,0xD3F0,0x0000,0x6538,0x0000,0xD3F1,
- 0x0000,0xD3F2,0xD3F3,0xD3F4,0x0000,0xD3F5,0xD3F6,0x0000,
- 0xD3F7,0x6535,0x0000,0xD3F8,0xD3F9,0xD3FA,0x0000,0x6537,
- 0x0000,0xD3FB,0x0000,0x6534,0x0000,0x0000,0xD3FC,0xD3FD,
- 0x0000,0x3751,0x4233,0x6539,0x416E,0xD3FE,0xD4A1,0x6546,
- 0x0000,0x0000,0x6542,0x653C,0x0000,0x0000,0xD4A2,0xD4A3,
- 0x0000,0x0000,0xD4A4,0x6540,0x3C7A,0x305D,0x653B,0x6543,
- 0x6547,0x394B,0x4C56,0xD4A5,0x4456,0x653D,0xD4A6,0xD4A7,
- 0x6545,0xD4A8,0x653A,0x433E,0x0000,0x653F,0x303D,0x4C4A,
- 0x0000,0x0000,0xD4A9,0xD4AA,0xD4AB,0xD4AC,0xD4AD,0x653E,
- 0x0000,0x0000,0x365B,0x486C,0xD4AE,0xD4AF,0xD4B0,0x416D,
- 0x0000,0x4E50,0x3D6F,0x0000,0x0000,0x656E,0x0000,0xD4B1,
- 0x6548,0xD4B2,0x407E,0x0000,0x6544,0x6549,0x654B,0x0000,
- 0x4479,0x654E,0xD4B4,0x0000,0x654A,0xD4B5,0xD4B6,0x0000,
- 0x4A54,0x344B,0xD4B7,0xD4B8,0x4C4B,0xD4B9,0x0000,0x305E,
- 0x0000,0xD4BA,0x654D,0x0000,0x4E7D,0xD4BB,0xD4BC,0x0000,
- 0x0000,0xD4BD,0xD4BE,0x654C,0x0000,0x0000,0x0000,0x0000,
-
- /* 7E00h */
- 0xD4B3,0x316F,0x0000,0x0000,0x466C,0x654F,0x0000,0x0000,
- 0xD4BF,0x6556,0x6550,0x6557,0x0000,0x0000,0x0000,0x0000,
- 0xD4C0,0xD4C1,0x6553,0x0000,0x0000,0xD4C2,0x0000,0xD4C3,
- 0x0000,0x0000,0x0000,0x477B,0xD4C4,0xD4C5,0x3C4A,0x6555,
- 0xD4C6,0x6552,0x6558,0x6551,0x0000,0x0000,0x3D44,0xD4C7,
- 0xD4C8,0x0000,0x0000,0x4B25,0xD4C9,0xD4CA,0x3D4C,0xD4CB,
- 0x0000,0x6554,0x6560,0xD4CC,0x0000,0x655C,0xD4CD,0x655F,
- 0x0000,0x655D,0x6561,0x655B,0x0000,0x6541,0x4053,0xD4CE,
- 0x0000,0x484B,0x0000,0x655E,0xD4CF,0xD4D0,0x6559,0xD4D1,
- 0x0000,0x0000,0x4121,0x3752,0x0000,0x3D2B,0xD4D2,0x0000,
- 0xD4D3,0x0000,0xD4D4,0x0000,0x3F25,0x4136,0x6564,0x0000,
- 0xD4D5,0x6566,0x6567,0x0000,0x0000,0x6563,0x6565,0xD4D6,
- 0x0000,0xD4D7,0xD4D8,0x0000,0x0000,0xD4D9,0x655A,0x6562,
- 0x0000,0x656A,0x6569,0xD4DA,0x0000,0x4B7A,0xD4DB,0xD4DC,
- 0x372B,0x0000,0x0000,0xD4DD,0x0000,0x0000,0x0000,0x0000,
- 0xD4DE,0x6568,0x0000,0x656C,0x656B,0x656F,0xD4DF,0x6571,
- 0x0000,0xD4E0,0x3B3C,0x656D,0x0000,0x0000,0xD4E1,0xD4E2,
- 0x6572,0x6573,0xD4E3,0x0000,0x6574,0xD4E4,0x657A,0x453B,
- 0x6576,0xD4E5,0x6575,0x6577,0x6578,0xD4E6,0x6579,0x0000,
- 0xD4E7,0x0000,0xD4E8,0x657B,0x657C,0xD4E9,0xD4EA,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-
- /* 7F00h */
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x344C,0x0000,
- 0x657D,0x0000,0x657E,0xD4EC,0xD4EB,0xD4ED,0xD4EE,0xD4EF,
- 0x0000,0x0000,0x0000,0xD4F0,0xD4F1,0x6621,0x0000,0xD4F2,
- 0x0000,0x0000,0x0000,0x0000,0x6622,0x6623,0x6624,0xD4F3,
- 0x6625,0x6626,0xD4F4,0xD4F5,0x6628,0x6627,0x0000,0x0000,
- 0x6629,0x0000,0x0000,0xD4F6,0xD4F7,0xD4F8,0x0000,0x662A,
- 0x662B,0xD4F9,0x0000,0xD4FA,0xD4FB,0xD4FC,0xD4FD,0x662E,
- 0x662C,0x662D,0x3A61,0x3753,0x0000,0xD4FE,0x4356,0x0000,
- 0x4833,0xD5A1,0x3D70,0x0000,0x0000,0x474D,0x0000,0x486D,
- 0x662F,0x586D,0x0000,0x0000,0x0000,0xD5A2,0xD5A3,0xD5A4,
- 0xD5A5,0x0000,0x6630,0x6632,0x0000,0x4D65,0x6631,0x6634,
- 0x6633,0x0000,0x4D53,0xD5A6,0x6635,0xD5A7,0x487E,0xD5A8,
- 0xD5A9,0xD5AA,0x0000,0x0000,0x6636,0x0000,0xD5AB,0xD5AC,
- 0x0000,0x0000,0x6639,0x0000,0xD5AD,0x6638,0x6637,0x0000,
- 0x0000,0xD5AE,0xD5AF,0x663A,0x3732,0x0000,0xD5B0,0x0000,
- 0x4122,0x3541,0xD5B1,0x0000,0x0000,0xD5B2,0x663E,0x663B,
- 0x0000,0x0000,0x663C,0x0000,0xD5B3,0x0000,0x663F,0x0000,
- 0x6640,0x663D,0x0000,0x0000,0xD5B4,0x3129,0x0000,0xD5B5,
- 0xD5B6,0x3227,0x0000,0xD5B7,0x0000,0x6642,0x6643,0x0000,
- 0xD5B8,0x0000,0x6644,0x0000,0x4D62,0x0000,0xD5B9,0xD5BA,
- 0x0000,0x0000,0x3D2C,0x0000,0x6646,0x6645,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0xD5BB,0x0000,0x0000,0x0000,0xD5BC,
- 0x3F69,0x6647,0x0000,0xD5BD,0x0000,0xD5BE,0x6648,0x0000,
- 0xD5BF,0x6649,0x0000,0x3465,0xD5C0,0x0000,0xD5C1,0xD5C2,
- 0x344D,0x0000,0xD5C3,0x664A,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x664B,0xD5C4,0x4B5D,0x4D63,0xD5C5,0xD5C6,0xD5C7,
-
- /* 8000h */
- 0x4D54,0x4F37,0x0000,0x394D,0x664E,0x3C54,0x664D,0xD5C8,
- 0xD5C9,0x0000,0xD5CA,0x664F,0x3C29,0xD5CB,0xD5CC,0xD5CD,
- 0x4251,0xD5CE,0x6650,0xD5CF,0xD5D0,0x394C,0xD5D1,0x4C57,
- 0x6651,0x6652,0x0000,0x0000,0x6653,0xD5D2,0xD5D3,0xD5D4,
- 0xD5D5,0x6654,0x0000,0x0000,0xD5D6,0x0000,0xD5D7,0x0000,
- 0x6655,0x0000,0x0000,0x0000,0xD5D8,0x0000,0xD5D9,0x0000,
- 0xD5DA,0x0000,0x0000,0x3C2A,0xD5DB,0xD5DC,0x4C6D,0xD5DD,
- 0x0000,0xD5DE,0xD5DF,0x6657,0xD5E0,0x433F,0xD5E1,0x6656,
- 0xD5E2,0x0000,0x0000,0x0000,0xD5E3,0x0000,0x6659,0x0000,
- 0x0000,0x0000,0x6658,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x665A,0x0000,0x0000,0x0000,0x403B,0x0000,
- 0x665B,0x0000,0x665C,0x0000,0x0000,0x0000,0x4A39,0x665D,
- 0xD5E4,0x416F,0x665E,0x0000,0xD5E5,0x0000,0xD5E6,0x0000,
- 0x665F,0x0000,0x0000,0x0000,0x0000,0xD5E7,0x0000,0x4E7E,
- 0x6662,0xD5E8,0x6661,0x6660,0x4430,0xD5E9,0x6663,0x3F26,
- 0x0000,0x6664,0x0000,0x0000,0x0000,0x6665,0x4F38,0x6666,
- 0x0000,0xD5EA,0x0000,0x0000,0x6667,0x6669,0x6668,0x4825,
- 0xD5EB,0x4679,0x0000,0x4F3E,0x4829,0x0000,0xD5EC,0x0000,
- 0x0000,0x0000,0x0000,0x666B,0x0000,0x0000,0x3E53,0x0000,
- 0x492A,0x0000,0x666C,0x666A,0xD5ED,0x344E,0xD5EE,0x0000,
- 0x0000,0x3854,0x3B68,0x0000,0x0000,0x486E,0xD5EF,0xD5F0,
- 0x0000,0x382A,0x4B43,0xD5F1,0x666F,0x666D,0x0000,0x394E,
- 0x0000,0x394F,0x3069,0x0000,0x3A68,0x0000,0x0000,0x0000,
- 0xD5F2,0xD5F3,0x4759,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x305F,0x6674,0x0000,0x4340,0x0000,
- 0xD5F4,0x0000,0x0000,0x0000,0x4758,0xD5F5,0x425B,0xD5F6,
- 0x0000,0x0000,0xD5F7,0x0000,0xD5F8,0xD5F9,0x6676,0xD5FA,
- 0xD5FB,0x6672,0x6675,0x6670,0x0000,0x6673,0x4B26,0x0000,
- 0xD5FC,0x3855,0x0000,0x0000,0x307D,0x6671,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0xD5FD,0xD5FE,0x6678,
- 0xD6A1,0x6679,0xD6A2,0xD6A3,0x4639,0x0000,0xD6A4,0x0000,
- 0x363B,0xD6A5,0xD6A6,0x0000,0x6726,0x473D,0xD6A7,0x0000,
-
- /* 8100h */
- 0x0000,0x0000,0x3B69,0xD6A8,0x0000,0x363C,0x4048,0x4F46,
- 0x4C2E,0x6677,0x4054,0xD6A9,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xD6AA,0xD6AB,
- 0xD6AC,0x0000,0x3553,0x667A,0xD6AD,0x0000,0xD6AE,0x0000,
- 0xD6AF,0x0000,0x0000,0x667C,0xD6B0,0x0000,0x0000,0xD6B1,
- 0x0000,0x667B,0x0000,0x0000,0xD6B2,0x0000,0x0000,0x667D,
- 0xD6B3,0x4326,0x0000,0x473E,0x0000,0xD6B4,0x0000,0x0000,
- 0x0000,0x4431,0xD6B5,0x0000,0xD6B6,0x0000,0x6723,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0xD6B7,0x6722,0xD6B8,
- 0x0000,0x0000,0xD6B9,0x667E,0xD6BA,0x0000,0x3F55,0x0000,
- 0x4965,0x6725,0xD6BB,0x6724,0x3950,0x4F53,0x0000,0xD6BC,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x6735,
- 0xD6BD,0xD6BE,0x0000,0x0000,0x0000,0x6729,0x672A,0xD6BF,
- 0xD6C0,0xD6C1,0x0000,0x3C70,0x0000,0xD6C2,0x6728,0xD6C3,
- 0x3978,0x6727,0x0000,0x0000,0x672B,0x0000,0x0000,0xD6C4,
- 0x4432,0x4A22,0x4123,0x0000,0x0000,0x0000,0x0000,0x425C,
- 0x672F,0xD6C5,0x6730,0x672C,0xD6C7,0xD6C8,0xD6C9,0x0000,
- 0x672D,0x0000,0x672E,0xD6CA,0x0000,0x0000,0xD6CB,0x3951,
- 0xD6C6,0x0000,0x0000,0x6736,0x0000,0x6732,0xD6CC,0x0000,
- 0xD6CD,0x0000,0x4966,0xD6CE,0x4B6C,0x4928,0xD6CF,0x0000,
- 0x6731,0x0000,0xD6D0,0x6734,0x6733,0x0000,0x0000,0x0000,
- 0x4B44,0x6737,0x0000,0x0000,0x0000,0x0000,0xD6D1,0x0000,
- 0x6738,0x0000,0xD6D2,0x4137,0xD6D3,0x6739,0x0000,0x0000,
- 0x673B,0x0000,0x673F,0xD6D4,0x0000,0x673C,0x673A,0x473F,
- 0x673D,0x0000,0x673E,0xD6D6,0x0000,0xD6D7,0x3232,0x0000,
- 0x6745,0x6740,0xD6D8,0xD6D5,0x0000,0x6741,0xD6D9,0xD6DA,
- 0x0000,0x6742,0x0000,0x4221,0x0000,0xD6DB,0x0000,0xD6DC,
- 0x6744,0x6743,0x6746,0xD6DD,0x0000,0xD6DE,0xD6DF,0x6747,
- 0x6748,0xD6E0,0x0000,0x3F43,0xD6E1,0x3269,0x0000,0x6749,
- 0x4E57,0x0000,0x3C2B,0xD6E2,0xD6E3,0x3D2D,0x0000,0x0000,
- 0xD6E4,0xD6E5,0xD6E6,0x3B6A,0x4357,0xD6E7,0xD6E8,0x0000,
- 0xD6E9,0xD6EA,0x674A,0x674B,0x3131,0xD6EB,0x674C,0xD6EC,
-
- /* 8200h */
- 0xD6ED,0x674D,0x674E,0xD6EE,0x0000,0x674F,0x0000,0x6750,
- 0x363D,0x5A2A,0x6751,0x0000,0x4065,0x6752,0x3C4B,0xD6EF,
- 0x6753,0x0000,0x5030,0xD6F0,0xD6F1,0x0000,0x6754,0x4A5E,
- 0x345C,0xD6F2,0xD6F3,0x4124,0x3D58,0xD6F4,0x4971,0x3D2E,
- 0x0000,0xD6F5,0xD6F6,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0xD6F7,0x6755,0x3952,0x6756,0x484C,0x0000,0x6764,0x0000,
- 0x0000,0x0000,0xD6F8,0x6758,0xD6F9,0x4249,0x4775,0x383F,
- 0x6757,0x4125,0xD6FA,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x6759,0x0000,0x0000,0xD6FB,0xD6FC,0xD6FD,0xD6FE,0x447A,
- 0x0000,0x0000,0x0000,0xD7A1,0x0000,0x0000,0xD7A2,0xD7A3,
- 0x0000,0xD7A4,0x0000,0x0000,0x0000,0x0000,0xD7A5,0x0000,
- 0x675B,0x675A,0x675D,0x0000,0xD7A6,0x675C,0x0000,0x675E,
- 0xD7A7,0x0000,0x6760,0xD7A8,0x675F,0x0000,0x344F,0xD7A9,
- 0x6761,0x0000,0x6762,0x6763,0x0000,0xD7AA,0x3A31,0x4E49,
- 0x0000,0x6765,0x3F27,0x0000,0xD7AB,0x0000,0x3170,0x6766,
- 0x6767,0x0000,0x0000,0xD7AC,0x0000,0xD7AD,0x6768,0xD7AE,
- 0xD7AF,0xD7B0,0x0000,0xD7B1,0xD7B2,0x0000,0x0000,0xD7B3,
- 0x0000,0xD7B4,0xD7B5,0x3072,0x0000,0x6769,0xD7B6,0x0000,
- 0x0000,0xD7B7,0x676A,0x0000,0xD7B8,0x0000,0xD7B9,0x0000,
- 0xD7BA,0x4967,0xD7BB,0xD7BC,0x0000,0x3C47,0x0000,0x676C,
- 0xD7BD,0xD7BE,0x0000,0xD7BF,0xD7C0,0x3329,0x3032,0xD7C1,
- 0xD7C2,0xD7C3,0xD7C4,0x676B,0x676E,0x474E,0xD7C5,0x3F44,
- 0xD7C6,0x3256,0xD7C7,0x4B27,0xD7C8,0x0000,0x0000,0xD7C9,
- 0x375D,0x365C,0xD7CA,0x676D,0xD7CB,0x326A,0xD7CC,0xD7CD,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x3423,0xD7CE,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0xD7CF,0x3171,0x6772,0x4E6A,0x425D,0xD7D0,0x0000,0x4944,
- 0x0000,0x677E,0xD7D1,0x3257,0x677C,0x0000,0x677A,0x6771,
- 0xD7D2,0x676F,0xD7D3,0x6770,0xD7D4,0x3C63,0x366C,0x4377,
- 0xD7D5,0x0000,0xD7D6,0x4651,0x0000,0xD7D7,0x0000,0xD7D8,
- 0x0000,0x3151,0x0000,0x6774,0x6773,0x0000,0xD7D9,0xD7DA,
- 0x0000,0x6779,0x6775,0x6778,0x0000,0xD7DB,0xD7DC,0x0000,
-
- /* 8300h */
- 0xD7DD,0xD7DE,0x4C50,0x6777,0x3258,0x337D,0x677B,0xD7DF,
- 0xD7E0,0x677D,0xD7E1,0xD7E2,0x0000,0x0000,0x3754,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x6823,0x682C,
- 0x682D,0x0000,0x0000,0xD7E4,0x302B,0xD7E5,0xD7E6,0xD7E7,
- 0x0000,0xD7E8,0xD7E9,0x6834,0x0000,0x0000,0x0000,0x0000,
- 0x3071,0x0000,0x0000,0x682B,0xD7EA,0xD7EB,0xD7EC,0x682A,
- 0xD7ED,0x6825,0x6824,0xD7EE,0x6822,0x6821,0x4363,0xD7EF,
- 0x427B,0x6827,0xD7F0,0x0000,0xD7F1,0xD7F2,0x0000,0x0000,
- 0x6826,0x0000,0xD7F3,0xD7F4,0xD7F5,0x6829,0x0000,0xD7F6,
- 0x0000,0x4170,0x3755,0x0000,0x0000,0xD7F7,0xD7F8,0x3141,
- 0x6828,0xD7F9,0x3953,0xD8BE,0xD7E3,0xD7FA,0xD7FB,0xD7FC,
- 0x4171,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0xD7FD,0x0000,0x0000,0x683A,0x0000,0x683B,0x0000,0x3259,
- 0xD7FE,0x0000,0x0000,0x322E,0x6838,0xD8A1,0x0000,0xD8A2,
- 0xD8A3,0x0000,0xD8A4,0x0000,0xD8A5,0x682E,0xD8A6,0x6836,
- 0x0000,0x683D,0x6837,0x0000,0x0000,0xD8A7,0x6835,0x0000,
- 0x0000,0x0000,0xD8A8,0x6776,0xD8A9,0xD8AA,0x6833,0x0000,
- 0xD8AB,0xD8AC,0x682F,0xD8AD,0xD8AE,0xD8AF,0x3450,0x6831,
- 0x683C,0x0000,0x6832,0x0000,0x0000,0x0000,0xD8B0,0xD8B1,
- 0x683E,0xD8B2,0x6830,0x477C,0xD8B3,0xD8CC,0x0000,0x0000,
- 0x0000,0x4D69,0x0000,0x0000,0x0000,0x6839,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x684F,0xD8B4,0xD8B5,
- 0xD8B6,0x6847,0x0000,0x0000,0x0000,0x3F7B,0x0000,0xD8B7,
- 0x0000,0xD8B8,0x3546,0x0000,0x365D,0x0000,0x6842,0xD8B9,
- 0xD8BA,0xD8BB,0x0000,0x325B,0xD8BC,0x0000,0x3E54,0x0000,
- 0x6845,0x0000,0x0000,0x0000,0x3A5A,0xD8BD,0x0000,0x4551,
- 0x684A,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0xD8BF,0x4A6E,0xD8C0,0x6841,0x0000,0x0000,0x0000,0x325A,
- 0x3856,0x4929,0x684B,0x0000,0x683F,0x0000,0xD8C1,0x6848,
- 0xD8C2,0xD8C3,0x0000,0x6852,0xD8C4,0x6843,0x0000,0x0000,
-
- /* 8400h */
- 0x0000,0xD8C5,0x0000,0x6844,0x463A,0x0000,0xD8C6,0x6849,
- 0x0000,0x0000,0xD8C7,0x6846,0x4B28,0x684C,0x3060,0xD8C8,
- 0x0000,0xD8C9,0x0000,0x6840,0x0000,0xD8CA,0x0000,0x0000,
- 0x0000,0xD8CB,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x684E,0x0000,0x684D,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x476B,0x6854,0x0000,0x685F,0x0000,0x0000,0xD8CD,
- 0x0000,0x337E,0x0000,0x0000,0x0000,0x6862,0x0000,0x0000,
- 0x6850,0xD8CE,0x0000,0x0000,0x6855,0x4D6E,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0xD8CF,0x685E,0xD8D0,
- 0xD8D1,0x4D55,0xD8D2,0x0000,0x0000,0xD8D3,0x4E2A,0xD8D4,
- 0x0000,0xD8D5,0xD8D6,0x0000,0x0000,0x0000,0xD8D7,0x4378,
- 0xD8D8,0xD8D9,0xD8DA,0x336B,0xD8DB,0x0000,0x0000,0x0000,
- 0xD8DC,0x4972,0x6864,0x4621,0xD8DD,0xD8DE,0x3031,0xD8DF,
- 0x0000,0x685D,0xD8E0,0x6859,0x4172,0x6853,0x685B,0x6860,
- 0xD8E1,0x472C,0x0000,0xD8E2,0xD8E3,0x302A,0xD8E4,0x6858,
- 0xD8E5,0x6861,0x4978,0x0000,0xD8E6,0xD8E7,0x0000,0x0000,
- 0x0000,0xD8E8,0x685C,0x0000,0x6857,0xD8E9,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x3E55,0x0000,0x0000,0x0000,0x0000,
- 0x3D2F,0x0000,0xD8EA,0xD8EB,0x3C2C,0xD8EC,0x0000,0x0000,
- 0x0000,0x4C58,0x0000,0x0000,0x4947,0x0000,0xD8ED,0x6867,
- 0x0000,0x6870,0x0000,0x0000,0x0000,0x0000,0xD8EE,0x0000,
- 0xD8EF,0xD8F0,0xD8F1,0x0000,0x0000,0x685A,0x0000,0xD8F2,
- 0x0000,0xD8F3,0x3377,0x0000,0xD8F4,0x0000,0x0000,0x0000,
- 0x3E78,0x6865,0xD8F5,0x686A,0x4173,0xD8F6,0xD8F7,0x6866,
- 0xD8F8,0x686D,0xD8F9,0x0000,0x435F,0x0000,0x686E,0xD8FA,
- 0xD8FB,0x4D56,0x6863,0x3338,0xD8FC,0x6869,0x0000,0xD8FD,
- 0x686C,0x4C2C,0x0000,0xD8FE,0x0000,0x0000,0x686F,0x0000,
- 0x0000,0x6868,0x686B,0x0000,0xD9A1,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xD9A2,
- 0x0000,0x0000,0xD9A3,0x0000,0x4B29,0x0000,0x4F21,0xD9A4,
- 0xD9A5,0xD9A6,0xD9A7,0x0000,0x6873,0x0000,0x0000,0xD9A8,
- 0x0000,0x0000,0xD9AA,0xD9AB,0x687A,0xD9AC,0x0000,0x6872,
-
- /* 8500h */
- 0x3C43,0x0000,0xD9AD,0xD9AE,0x0000,0x0000,0x6851,0xD9AF,
- 0x0000,0x0000,0x0000,0x0000,0xD9B0,0x0000,0xD9B1,0x0000,
- 0xD9B2,0x4A4E,0x0000,0x4C22,0x6879,0x6878,0x0000,0x6874,
- 0x6875,0x0000,0x3136,0x0000,0xD9B3,0x0000,0xD9B4,0x6877,
- 0x0000,0x6871,0xD9B5,0xD9B6,0xD9B7,0xD9B8,0x4455,0xD9B9,
- 0x0000,0x0000,0xD9BA,0xD9BB,0x6876,0x307E,0x0000,0xD9BC,
- 0x0000,0x0000,0xD9A9,0xD9BD,0xD9BE,0x4222,0xD9BF,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x4A43,0x0000,0xD9C0,
- 0x687B,0x6921,0x0000,0x4859,0x0000,0x0000,0xD9C1,0x0000,
- 0x687E,0x3E56,0x3C49,0x6923,0x0000,0x0000,0x363E,0xD9C2,
- 0xD9C3,0xD9C4,0xD9C5,0xD9C6,0x0000,0x6924,0xD9C7,0x4979,
- 0x687D,0xD9C8,0x6856,0x0000,0xD9C9,0xD9CA,0xD9CB,0xD9CC,
- 0xD9CD,0xD9CE,0xD9CF,0x687C,0xD9D0,0x0000,0x0000,0x0000,
- 0x4F4F,0x4622,0x4973,0xD9D1,0x0000,0x692B,0x0000,0xD9D2,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x6931,
- 0x0000,0xD9D3,0xD9D4,0xD9D5,0x0000,0xD9D6,0x6932,0xD9D7,
- 0x6925,0xD9D8,0x0000,0x0000,0x4776,0xD9D9,0xD9DA,0x692F,
- 0x6927,0xD9DB,0x6929,0xD9DC,0xD9DD,0x0000,0x0000,0xD9DE,
- 0x6933,0x6928,0x0000,0xD9DF,0x692C,0x0000,0x0000,0x3172,
- 0xD9E0,0x4665,0x0000,0x692D,0x6930,0xD9E1,0x0000,0xD9E2,
- 0xD9E3,0x0000,0xD9E4,0x0000,0x6926,0xD9E5,0x4126,0xD9E6,
- 0x692A,0x3B27,0x3F45,0x3730,0x4C74,0xD9F4,0x4C79,0x3D72,
- 0x0000,0x0000,0x0000,0x0000,0xD9E7,0x0000,0xD9E8,0xD9E9,
- 0xD9EA,0x6937,0x6935,0x0000,0xD9EB,0xD9EC,0xD9ED,0xD9EE,
- 0x0000,0x4F4E,0xD9EF,0x0000,0x0000,0x0000,0x0000,0xD9F0,
- 0x0000,0x6934,0xD9F1,0xD9F2,0x0000,0x4D75,0xD9F3,0x6936,
- 0x6938,0x0000,0x0000,0x0000,0x0000,0x6939,0x0000,0x0000,
- 0xD9F5,0x0000,0xD9F6,0x0000,0x693C,0x693A,0x0000,0xD9F7,
- 0xD9F8,0x0000,0x0000,0x0000,0x4623,0x693B,0xD9F9,0x0000,
- 0xD9FA,0x484D,0x692E,0x0000,0x0000,0xD9FB,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0xD9FC,0x0000,0x0000,0xD9FD,0x3D73,
- 0x0000,0x693D,0x6942,0x4174,0xD9FE,0x0000,0x6941,0xDAA1,
-
- /* 8600h */
- 0xDAA2,0x0000,0x6922,0x0000,0xDAA3,0xDAA4,0x6943,0x4149,
- 0x0000,0x0000,0x693E,0x6940,0x0000,0xDAA5,0xDAA6,0x0000,
- 0xDAA7,0xDAA8,0xDAA9,0x693F,0x0000,0x0000,0x5D31,0x5D22,
- 0xDAAA,0xDAAB,0x6945,0xDAAC,0x0000,0x0000,0xDAAD,0x0000,
- 0x0000,0xDAAE,0x6944,0x0000,0x0000,0x0000,0x0000,0xDAAF,
- 0x0000,0xDAB0,0x0000,0x0000,0x0000,0x4D76,0x0000,0x623C,
- 0x6946,0x0000,0x0000,0x0000,0x0000,0x0000,0xDAB1,0x0000,
- 0xDAB2,0x0000,0xDAB3,0x0000,0xDAB4,0xDAB5,0x0000,0x6947,
- 0xDAB6,0xB8E6,0xDAB7,0x0000,0x0000,0x0000,0xDAB8,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x6948,0x3857,0x0000,
- 0x3554,0x0000,0xDAB9,0xDABA,0x694A,0x515D,0xDABB,0xDABC,
- 0xDABD,0xDABE,0x3575,0x0000,0x4E3A,0xDABF,0x3673,0x694B,
- 0xDAC0,0xDAC1,0xDAC2,0xDAC3,0xDAC4,0x0000,0x0000,0x694C,
- 0x0000,0xDAC5,0x0000,0x436E,0xDAC6,0x0000,0x0000,0xDAC7,
- 0x0000,0x694D,0x0000,0x0000,0x0000,0xDAC8,0xDAC9,0xDACA,
- 0x0000,0x467A,0xDACB,0x303A,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0xDAED,0x0000,0x3263,0x6952,0x6953,0xDACC,0x0000,0x0000,
- 0x0000,0xDACD,0x0000,0x694E,0x0000,0x3B3D,0xDACE,0x0000,
- 0xDACF,0x0000,0xDAD0,0x0000,0xDAD1,0x0000,0x0000,0x0000,
- 0x0000,0xDAD2,0x0000,0x694F,0x4742,0x0000,0xDAD3,0xDAD4,
- 0xDAD5,0x6950,0x6951,0x695B,0x0000,0xDAD6,0x0000,0x6955,
- 0x6958,0xDAD7,0x0000,0xDAD8,0xDAD9,0xDADA,0x6954,0xDADB,
- 0xDADC,0xDADD,0x0000,0x0000,0x0000,0x0000,0x0000,0xDADE,
- 0xDADF,0xDAE0,0x0000,0xDAE1,0x6956,0xDAE2,0x6957,0x3C58,
- 0x0000,0x6959,0x0000,0x4341,0x0000,0x3756,0x3342,0x0000,
- 0x0000,0xDAE3,0xDAE4,0x0000,0x695C,0xDAE5,0x0000,0xDAE6,
- 0x0000,0x333F,0xDAE7,0x6961,0xDAE8,0x0000,0x695D,0x6960,
- 0xDAE9,0x0000,0x0000,0xDAEA,0x483A,0xDAEB,0x0000,0xDAEC,
- 0x0000,0x695E,0x0000,0x0000,0x695F,0x4948,0x485A,0x6962,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x427D,0x696C,0xDAEE,0x6968,0xDAEF,0xDAF0,0x326B,0x0000,
-
- /* 8700h */
- 0x6966,0x0000,0x4B2A,0x6967,0xDAF1,0xDAF2,0x6964,0xDAF3,
- 0x6965,0x696A,0x696D,0xDAF4,0x0000,0x696B,0xDAF5,0xDAF6,
- 0xDAF7,0x6969,0x6963,0xDAF8,0xDAF9,0x0000,0x0000,0x0000,
- 0x4358,0xDAFA,0x6974,0x0000,0x4C2A,0x0000,0xDAFB,0xDAFC,
- 0x0000,0xDAFD,0x0000,0xDAFE,0x0000,0x6972,0x0000,0x0000,
- 0xDBA1,0x6973,0x0000,0x0000,0x0000,0x0000,0xDBA2,0xDBA3,
- 0x0000,0xDBA4,0xDBA5,0x0000,0x696E,0x0000,0x0000,0x6970,
- 0x0000,0xDBA6,0xDBA7,0x6971,0xDBA8,0xDBA9,0xDBAA,0x696F,
- 0xDBAB,0x0000,0x0000,0xDBAC,0x0000,0xDBAD,0x0000,0x0000,
- 0x0000,0x4066,0x0000,0x4F39,0x6978,0xDBAE,0x6979,0x0000,
- 0x0000,0x0000,0x0000,0x6A21,0x0000,0x3F2A,0x0000,0x697B,
- 0xDBAF,0x697E,0x0000,0x0000,0x0000,0xDBB0,0x0000,0x6976,
- 0x6975,0xDBB1,0x0000,0x6A22,0xDBB2,0xDBB3,0x325C,0x0000,
- 0x697C,0x0000,0x6A23,0x0000,0x0000,0x0000,0x697D,0xDBB4,
- 0x0000,0xDBB5,0xDBB6,0x0000,0x697A,0x0000,0x4433,0x0000,
- 0x6977,0x0000,0x0000,0xDBB7,0x0000,0x0000,0x0000,0x4768,
- 0x0000,0x0000,0x6A27,0xDBB8,0xDBB9,0xDBBA,0xDBBB,0xDBBC,
- 0xDBBD,0xDBBE,0x0000,0xDBBF,0xDBC0,0x4D3B,0x0000,0x0000,
- 0xDBC1,0x0000,0x0000,0xDBC2,0x0000,0xDBC3,0x0000,0xDBC4,
- 0xDBC5,0xDBC6,0x0000,0x0000,0x0000,0x0000,0xDBC7,0x6A26,
- 0xDBC8,0x0000,0x6A25,0xDBC9,0x0000,0x0000,0x0000,0xDBCA,
- 0x0000,0x0000,0x0000,0x6A2E,0xDBCB,0xDBCC,0xDBCD,0x6A28,
- 0x0000,0xDBCE,0x0000,0x6A30,0x0000,0xDBCF,0x0000,0x0000,
- 0x0000,0x0000,0x4D66,0x6A33,0x0000,0x6A2A,0xDBD0,0xDBD1,
- 0x6A2B,0xDBD2,0x0000,0x0000,0x6A2F,0x0000,0x6A32,0x6A31,
- 0xDBD3,0xDBD4,0xDBD5,0x6A29,0x0000,0x0000,0xDBD6,0x0000,
- 0x6A2C,0x0000,0x6A3D,0x0000,0x0000,0xDBD7,0xDBD8,0x0000,
- 0x0000,0xDBD9,0xDBDA,0x0000,0xDBDB,0x0000,0x0000,0xDBDC,
- 0x6A36,0x0000,0xDBDD,0xDBDE,0xDBDF,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0xDBE0,0xDBE1,0x0000,0xDBE2,0x0000,0x6A34,
- 0x0000,0xDBE3,0x6A35,0xDBE4,0x0000,0x0000,0x6A3A,0x6A3B,
- 0xDBE5,0x332A,0xDBE6,0x3542,0x0000,0x0000,0x6A39,0xDBE7,
-
- /* 8800h */
- 0x0000,0xDBE8,0x0000,0xDBE9,0x0000,0x6A24,0xDBEA,0x0000,
- 0x0000,0xDBEB,0xDBEC,0xDBED,0x0000,0x6A38,0x6A3C,0x6A37,
- 0xDBEE,0x6A3E,0xDBF0,0xDBF1,0xDBF2,0x6A40,0x6A3F,0x0000,
- 0xDBF3,0xDBEF,0xDBF4,0xDBF5,0xDBF6,0x0000,0xDBF7,0xDBF8,
- 0x0000,0x6A42,0x6A41,0x695A,0x0000,0x0000,0x0000,0x6A46,
- 0xDBF9,0x0000,0x0000,0x0000,0x0000,0xDBFA,0xDBFB,0x0000,
- 0xDBFC,0x6A43,0xDBFD,0x0000,0x0000,0xDBFE,0x6A44,0x0000,
- 0x0000,0x6A45,0xDCA1,0x6A47,0xDCA2,0x0000,0x0000,0x0000,
- 0x376C,0xDCA3,0x6A49,0xDCA4,0x6A48,0xDCA5,0x3D30,0x0000,
- 0xDCA6,0xDCA7,0xDCA8,0xDCA9,0x3954,0x5E27,0xDCAA,0x0000,
- 0x0000,0xDCAB,0x6A4A,0x3D51,0x0000,0xDCAC,0xDCAD,0x3339,
- 0xDCAE,0x6A4B,0xDCAF,0x3152,0xDCB0,0x3E57,0x6A4C,0xDCB1,
- 0xDCB2,0x3955,0x6A4D,0x3061,0xDCB3,0x0000,0x0000,0x0000,
- 0x493D,0xDCB4,0x0000,0x6A4E,0x0000,0x0000,0x0000,0x0000,
- 0x3F6A,0xDCB5,0x6A55,0x0000,0x0000,0x6A52,0x0000,0x436F,
- 0x0000,0xDCB6,0x0000,0xDCB7,0x0000,0x6A53,0x6A50,0x365E,
- 0xDCB8,0x6A4F,0x6A56,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x3736,0x0000,0x0000,0x425E,0x0000,0x6A5C,0x0000,0x0000,
- 0x0000,0x0000,0x6A58,0x0000,0x0000,0x0000,0x4235,0x6A57,
- 0xDCB9,0x6A5A,0xDCBA,0xDCBB,0xDCBC,0x0000,0x6A51,0xDCBD,
- 0xDCBE,0x0000,0x6A5B,0x0000,0x6A5D,0x0000,0x0000,0x0000,
- 0xDCBF,0x0000,0xDCC0,0x486F,0x0000,0x0000,0x6A59,0x0000,
- 0x6A5E,0x6A60,0x0000,0x0000,0x3853,0x6A54,0x0000,0x3041,
- 0x0000,0x0000,0xDCC1,0x0000,0x0000,0xDCC2,0xDCC3,0x6A5F,
- 0xDCC4,0x3A5B,0x4E76,0x6A61,0x6A62,0x4175,0x0000,0x0000,
- 0x0000,0x0000,0xDCC5,0xDCC6,0xDCC7,0xDCC8,0xDCC9,0x4E22,
- 0x0000,0xDCCA,0xDCCB,0xDCCC,0x6A63,0x4D35,0x0000,0x0000,
- 0x6A64,0x6A65,0x0000,0xDCCD,0x4A64,0x6A66,0xDCCE,0x3A40,
- 0x0000,0x4E23,0x0000,0x0000,0x0000,0x0000,0x0000,0xDCCF,
- 0x6A6B,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xDCD0,
- 0xDCD1,0xDCD2,0x6A6C,0x3E58,0x6A6A,0xDCD3,0x0000,0xDCD4,
- 0x4D67,0x6A67,0x0000,0x0000,0x6A69,0x403D,0x3F7E,0x0000,
-
- /* 8900h */
- 0x0000,0xDCD5,0x6A68,0x0000,0x6A6D,0x0000,0xDCD6,0x4A23,
- 0x0000,0x0000,0x6A6F,0x0000,0x6A6E,0xDCD7,0xDCD8,0xDCD9,
- 0x336C,0x0000,0x4B2B,0x6A70,0x0000,0xDCDA,0xDCDB,0x0000,
- 0xDCDC,0xDCDD,0xDCDE,0x0000,0xDCDF,0x6A7C,0x6A72,0x0000,
- 0xDCE0,0x0000,0x0000,0x0000,0x0000,0x6A73,0xDCE1,0xDCE2,
- 0xDCE3,0x0000,0x6A74,0x6A75,0x0000,0x0000,0x0000,0x0000,
- 0xDCE4,0xDCE5,0xDCE6,0x0000,0x0000,0xDCE7,0x6A79,0x0000,
- 0x6A7A,0xDCE8,0xDCE9,0x6A78,0x0000,0x0000,0xDCEA,0x0000,
- 0xDCEB,0x6A76,0xDCEC,0x6A71,0x6A77,0xDCED,0xDCEE,0x0000,
- 0x0000,0xDCEF,0x0000,0x0000,0x6A7B,0x7037,0x0000,0xDCF0,
- 0x0000,0x0000,0xDCF1,0x0000,0x0000,0x0000,0x3228,0xDCF2,
- 0x0000,0x0000,0xDCF3,0xDCF4,0xDCF5,0x0000,0x6A7E,0x365F,
- 0x6A7D,0xDCF6,0xDCF7,0xDCF8,0x6B22,0x0000,0x6B21,0x0000,
- 0x0000,0x0000,0x6B24,0xDCF9,0x0000,0x6B23,0xDCFA,0x6B25,
- 0xDCFB,0x0000,0x3D31,0xDCFC,0x6B26,0xDCFD,0x0000,0x6B27,
- 0x0000,0x0000,0xDCFE,0xDDA1,0xDDA2,0xDDA3,0x6B28,0x403E,
- 0x0000,0x4D57,0x0000,0x6B29,0x0000,0x0000,0x4A24,0x4746,
- 0x6B2A,0xDDA4,0x6B2B,0x382B,0x0000,0xDDA5,0x0000,0x352C,
- 0xDDA6,0x0000,0x0000,0x6B2C,0xDDA7,0xDDA8,0x3B6B,0x4741,
- 0x6B2D,0x0000,0x3350,0xDDA9,0xDDAA,0x0000,0x0000,0xDDAB,
- 0xDDAC,0x6B2E,0x0000,0x0000,0x0000,0xDDAD,0x6B30,0x4D77,
- 0x0000,0x6B2F,0x3F46,0x0000,0x6B31,0x0000,0x0000,0x6B32,
- 0xDDAE,0x0000,0x6B33,0x3451,0xDDAF,0xDDB0,0xDDB1,0xDDB2,
- 0x0000,0x0000,0x6B34,0x0000,0xDDB3,0x6B35,0x0000,0x6B36,
- 0x6B37,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x3351,0x0000,0xDDB4,0xDDB5,0xDDB6,0xDDB7,
- 0xDDB8,0x0000,0x6B38,0x0000,0x6B39,0x6B3A,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x3272,0x0000,0xDDB9,0x3F28,0x6B3B,
- 0x0000,0xDDBA,0x0000,0xDDBB,0x0000,0xDDBC,0x0000,0x0000,
- 0x0000,0xDDBD,0x0000,0xDDBE,0x6B3C,0x0000,0xDDBF,0x0000,
- 0x6B3D,0xDDC0,0x0000,0x0000,0x0000,0xDDC1,0x0000,0xDDC2,
-
- /* 8A00h */
- 0x3840,0x0000,0x447B,0x6B3E,0xDDC3,0xDDC4,0x0000,0xDDC5,
- 0x3757,0x0000,0x3F56,0x0000,0x6B41,0x0000,0x4624,0xDDC6,
- 0x6B40,0xDDC7,0xDDC8,0x3731,0xDDC9,0xDDCA,0x6B3F,0x4277,
- 0x352D,0x0000,0x0000,0x6B42,0x0000,0x6B43,0xDDCB,0x3E59,
- 0xDDCC,0x0000,0xDDCD,0x376D,0xDDCE,0x6B44,0xDDCF,0x0000,
- 0x0000,0x0000,0x4B2C,0xDDD0,0xDDD1,0x405F,0x0000,0xDDD2,
- 0x0000,0x3576,0x0000,0x4C75,0x414A,0xDDD3,0x6B45,0xDDD4,
- 0x0000,0x0000,0x3F47,0x4370,0x3E5A,0xDDD5,0xDDD6,0x0000,
- 0xDDD7,0x6B46,0x0000,0xDDD8,0x0000,0xDDD9,0x6B49,0xDDDA,
- 0x6B4A,0xDDDB,0x0000,0x0000,0x0000,0xDDDC,0xDDDD,0x0000,
- 0x3A3E,0x4242,0x6B48,0xDDDE,0x3E5B,0x493E,0xDDDF,0xDDE0,
- 0xDDE1,0x0000,0x0000,0x6B47,0xDDE2,0xDDE3,0x3B6C,0x0000,
- 0x3153,0xDDE4,0x6B4E,0x3758,0x0000,0xDDE5,0x3B6E,0xDDE6,
- 0x0000,0x3B6D,0x0000,0x4F4D,0x6B4D,0x6B4C,0x4127,0x0000,
- 0x354D,0x4F43,0x333A,0x3E5C,0x0000,0xDDE7,0xDDE8,0xDDE9,
- 0x0000,0xDDEA,0xDDEB,0xDDEC,0x6B4B,0x0000,0xDDED,0xDDEE,
- 0xDDEF,0x0000,0x6B50,0xDDF0,0x6B51,0x6B4F,0xDDF1,0x3858,
- 0x0000,0x4D40,0x0000,0xDDF2,0x3B6F,0x4727,0x0000,0xDDF3,
- 0xDDF4,0x6B54,0xDDF5,0x4040,0x0000,0x4342,0xDDF6,0xDDF7,
- 0x4D36,0xDDF8,0x6B57,0x0000,0x0000,0x0000,0x386C,0xDDF9,
- 0x403F,0x6B53,0x0000,0x6B58,0x386D,0x6B55,0x6B56,0xDDFA,
- 0x6B52,0xDDFB,0x0000,0x0000,0x4062,0x4649,0xDDFC,0xDDFD,
- 0x432F,0x0000,0x325D,0xDDFE,0x0000,0x0000,0xDEA1,0xDEA2,
- 0x0000,0x4870,0x0000,0xDEA3,0x3543,0x0000,0xDEA4,0x4434,
- 0x0000,0x0000,0x6B5B,0xDEA5,0x6B59,0x0000,0xDEA6,0x434C,
- 0xDEA7,0xDEA8,0xDEA9,0x4041,0x3452,0x6B5A,0x0000,0x3F5B,
- 0x0000,0xDEAA,0x4E4A,0xDEAB,0xDEAC,0xDEAD,0x4F40,0xDEAE,
- 0x0000,0x0000,0x6B5C,0x6B67,0x4435,0xDEAF,0x6B66,0xDEB0,
- 0x6B63,0x6B6B,0x6B64,0x0000,0x6B60,0x0000,0x447C,0x6B5F,
- 0x0000,0x0000,0x0000,0x6B5D,0xDEB1,0x4D21,0x3B70,0x0000,
- 0xDEB2,0x6B61,0x0000,0x6B5E,0xDEB3,0xDEB4,0xDEB5,0x6B65,
- 0x3D74,0x0000,0x3841,0x0000,0xDEB6,0x0000,0x427A,0xDEB7,
-
- /* 8B00h */
- 0x4B45,0x315A,0x3062,0x0000,0x4625,0xDEB8,0xDEB9,0x6B69,
- 0x0000,0x0000,0xDEBF,0xDEBA,0x6B68,0x0000,0x4666,0x0000,
- 0x6B6D,0xDEBB,0x0000,0x0000,0x6B62,0x0000,0x6B6C,0x6B6E,
- 0x0000,0x382C,0x6B6A,0x3956,0xDEBC,0x3C55,0xDEBD,0xDEBE,
- 0x6B6F,0x4D58,0x0000,0x0000,0x0000,0x0000,0x6B72,0x0000,
- 0x6B75,0x0000,0x0000,0x6B73,0x4935,0xDEC0,0x0000,0x0000,
- 0xDEC1,0x0000,0x0000,0x6B70,0x0000,0x0000,0x0000,0xDEC2,
- 0x0000,0x3660,0x0000,0x0000,0xDEC3,0x0000,0x6B74,0x0000,
- 0x0000,0x6B76,0xDEC4,0xDEC5,0xDEC6,0xDEC7,0xDEC8,0x0000,
- 0xDEC9,0x6B7A,0x0000,0x0000,0x6B77,0xDECE,0x6B79,0x6B78,
- 0x0000,0x0000,0xDECA,0xDECB,0xDECC,0x0000,0x6B7B,0x0000,
- 0x3C31,0xDECD,0x6B7D,0x6B7C,0x4968,0x0000,0xDECF,0x6C21,
- 0x0000,0x0000,0x0000,0xDED0,0x0000,0x0000,0x3759,0x0000,
- 0x0000,0x0000,0x0000,0x6B7E,0x6C22,0xDED1,0x0000,0x6C23,
- 0x3544,0x6641,0x3E79,0x0000,0x6C24,0x0000,0xDED2,0x386E,
- 0xDED3,0xDED4,0x0000,0x0000,0xDED5,0x6C25,0xDED6,0x0000,
- 0x6C26,0xDED7,0x0000,0x3B3E,0xDED8,0xDED9,0x0000,0x0000,
- 0x0000,0x0000,0x5A4E,0xDEDA,0x6C27,0xDEDB,0x6C28,0xDEDC,
- 0x3D32,0x0000,0x6C29,0x6C2A,0xDEDD,0xDEDE,0x6C2B,0x0000,
- 0x0000,0x6C2C,0x6C2D,0x0000,0xDEDF,0x0000,0xDEE0,0xDEE1,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-
- /* 8C00h */
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x432B,
- 0xDEE2,0xDEE3,0x6C2E,0x0000,0x0000,0xDEE4,0xDEE5,0x6C30,
- 0x0000,0x6C2F,0x0000,0x0000,0x0000,0xDEE6,0x4626,0xDEE7,
- 0x6C31,0xDEE8,0x4B2D,0xDEE9,0x6C32,0x0000,0x6C33,0xDEEA,
- 0x6C34,0xDEEB,0x0000,0xDEEC,0xDEED,0x6C35,0x0000,0xDEEE,
- 0xDEEF,0xDEF2,0x465A,0xDEF0,0x0000,0xDEF1,0x0000,0x0000,
- 0x0000,0x3E5D,0x6C36,0xDEF3,0xDEF4,0x0000,0xDEF5,0x0000,
- 0xDEF6,0xDEF7,0x396B,0x502E,0x6C37,0xDEF8,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0xDEF9,0x0000,0xDEFA,0xDEFB,0x0000,
- 0x6C38,0x493F,0x6C39,0xDEFC,0x6C41,0x0000,0xDEFD,0x0000,
- 0x0000,0x0000,0x6C3A,0x0000,0x0000,0x6C3C,0xDEFE,0xDFA1,
- 0x0000,0x6C3B,0x6C3D,0xDFA2,0x4B46,0x6C3E,0x6C3F,0x0000,
- 0xDFA3,0x0000,0xDFA4,0xDFA5,0x6C40,0x0000,0x0000,0x0000,
- 0x6C42,0xDFA6,0x0000,0xDFA7,0xDFA8,0x332D,0x4467,0x0000,
- 0x4969,0x3A62,0x3957,0x0000,0xDFA9,0x0000,0x0000,0x494F,
- 0x325F,0x484E,0x6C45,0x3453,0x4055,0x6C44,0x6C49,0x4379,
- 0x4C63,0x0000,0x6C47,0x6C48,0x352E,0x0000,0x6C4A,0x4763,
- 0x425F,0xDFAA,0xDFAB,0x4871,0x453D,0x6C46,0x0000,0x4B47,
- 0x326C,0x6C4C,0x4F28,0x4442,0x4F45,0xDFAC,0xDFAD,0x3B71,
- 0x6C4B,0xDFAE,0x4231,0xDFAF,0x0000,0x6C5C,0x4128,0xDFB0,
- 0x0000,0x4678,0x0000,0x4950,0x0000,0xDFB2,0xDFB1,0x0000,
- 0x0000,0xDFB3,0x6C4F,0x3B3F,0x3B72,0xDFB4,0x3E5E,0x0000,
- 0x4765,0xDFB5,0x382D,0x6C4E,0x6C4D,0x0000,0x496A,0x0000,
- 0xDFB6,0x0000,0x3C41,0x0000,0xDFB7,0x4552,0x0000,0xDFB8,
- 0xDFB9,0x0000,0xDFBA,0x0000,0x0000,0xDFBB,0x0000,0xDFBC,
- 0xDFBD,0x0000,0x6C51,0x6C52,0x3958,0x6C50,0xDFBE,0xDFBF,
-
- /* 8D00h */
- 0x0000,0xDFC0,0x0000,0xDFC1,0x6C53,0x6C54,0x0000,0x6C56,
- 0x4223,0xDFC2,0x6C55,0x3466,0x0000,0x6C58,0x0000,0x6C57,
- 0x6C59,0x0000,0xDFC3,0x6C5B,0x6C5D,0x0000,0x6C5E,0xDFC4,
- 0x0000,0x0000,0x0000,0xDFC5,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x4056,0xDFC6,0x3C4F,0x6C5F,
- 0x0000,0xDFC7,0x0000,0x3352,0xDFC8,0x6C60,0xDFC9,0x0000,
- 0x4176,0x6C61,0x0000,0x6C62,0x496B,0x0000,0x0000,0x352F,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xDFCA,
- 0x0000,0x6C63,0xDFCB,0x0000,0xDFCC,0x4436,0x0000,0x0000,
- 0xDFCD,0x0000,0x315B,0x0000,0x0000,0xDFCE,0x0000,0x0000,
- 0xDFCF,0xDFD0,0x0000,0x0000,0x0000,0xDFD1,0x0000,0x0000,
- 0x0000,0x6C64,0x0000,0x0000,0x0000,0x0000,0xDFD2,0xDFD3,
- 0xDFD4,0x0000,0x0000,0x3C71,0x0000,0x0000,0xDFD5,0x0000,
- 0x3F76,0x0000,0x0000,0xDFD6,0xDFD7,0x0000,0x0000,0xDFD8,
- 0x0000,0x0000,0xDFD9,0x422D,0x0000,0xDFDA,0x0000,0xDFDB,
- 0x0000,0xDFDC,0x6C67,0xDFDD,0xDFEF,0x0000,0x6C66,0x0000,
- 0xDFDE,0x0000,0x6C65,0x0000,0x0000,0xDFDF,0xDFE0,0xDFE1,
- 0xDFE2,0x0000,0xDFE3,0x6C6D,0x6C6B,0x0000,0xDFE4,0x6C68,
- 0x0000,0xDFE5,0x0000,0x0000,0xDFE6,0xDFE7,0x6C6A,0xDFE8,
- 0x0000,0xDFE9,0x6C69,0x6C6C,0x0000,0x3577,0x0000,0x6C70,
- 0x0000,0x4057,0x0000,0x6C71,0xDFEA,0xDFEB,0x0000,0xDFEC,
- 0x3859,0x0000,0x6C6E,0x6C6F,0xDFED,0x0000,0x0000,0x4F29,
- 0xDFEE,0xDFF0,0xDFF1,0x4437,0xDFF2,0x4129,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x6C72,0xDFF3,0x0000,0x6C75,
-
- /* 8E00h */
- 0x0000,0xDFF4,0x0000,0x0000,0xDFF5,0xDFF6,0xDFF7,0x0000,
- 0x6C73,0x6C74,0x4D59,0xDFF8,0x0000,0x0000,0x0000,0x4627,
- 0x6C78,0xDFF9,0x0000,0x0000,0xDFFA,0x0000,0xDFFB,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x6C76,0x6C77,0x6C79,
- 0xDFFC,0xDFFD,0xDFFE,0xE0A1,0x0000,0x0000,0xE0A2,0xE0A3,
- 0x0000,0x0000,0x6D29,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x6C7C,0xE0A4,0x0000,0xE0A5,0x6C7D,0x6C7B,0xE0A6,0xE0A7,
- 0xE0A8,0xE0A9,0x0000,0x0000,0x0000,0xE0AA,0x0000,0x0000,
- 0xE0AB,0xE0AC,0x6C7A,0x0000,0x447D,0x0000,0x0000,0x6D21,
- 0x6D25,0x6D22,0x6C7E,0xE0AD,0x6D23,0xE0AE,0xE0AF,0xE0B0,
- 0x6D24,0x0000,0x0000,0x0000,0xE0B1,0x6D2B,0x0000,0x0000,
- 0x0000,0x6D26,0x0000,0xE0B2,0xE0B3,0xE0B4,0xE0B5,0x4058,
- 0x6D28,0xE0B6,0xE0B7,0x6D2A,0x6D27,0x0000,0x0000,0x0000,
- 0x0000,0xE0B8,0x0000,0x0000,0xE0B9,0xE0BA,0x0000,0xE0BB,
- 0xE0BC,0xE0BD,0x6D2D,0x0000,0x3D33,0x0000,0x6D2C,0x0000,
- 0x0000,0xE0BE,0xE0BF,0xE0C0,0x6D2E,0x0000,0x0000,0x0000,
- 0x0000,0x6D2F,0xE0C1,0xE0C2,0x6D32,0x6D31,0x0000,0x6D30,
- 0x0000,0xE0C3,0x6D34,0x6D33,0x0000,0x4C76,0x0000,0x0000,
- 0xE0C4,0x6D36,0xE0C5,0x6D35,0x6D37,0xE0C6,0x0000,0x0000,
- 0x0000,0x6D38,0xE0C7,0xE0C8,0x0000,0xE0C9,0xE0CA,0x0000,
- 0x0000,0x6D3A,0xE0CB,0x0000,0x0000,0x0000,0x0000,0xE0CC,
- 0x0000,0xE0CD,0x6D39,0x3F48,0x6D3B,0xE0CE,0xE0CF,0x366D,
- 0x6D3C,0x6D3E,0x0000,0xE0D0,0x0000,0xE0D1,0x0000,0x0000,
- 0x0000,0x0000,0xE0D2,0xE0D3,0x0000,0x0000,0x6D3F,0x0000,
- 0xE0D4,0xE0D5,0x0000,0xE0D6,0xE0D7,0x6D40,0x6D3D,0xE0D8,
- 0x6D41,0x0000,0x3C56,0x6D42,0x3530,0x3733,0x0000,0xE0D9,
- 0x0000,0xE0DA,0x382E,0x0000,0xE0DB,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x6D43,0xE0DC,0x0000,0x0000,0x4670,
- 0x0000,0x0000,0x453E,0x6D44,0x0000,0x0000,0x0000,0x0000,
- 0xE0DD,0x0000,0x0000,0x6D47,0x0000,0xE0E4,0xE0DE,0x0000,
- 0xE0DF,0xE0E0,0x0000,0x0000,0x0000,0x0000,0x0000,0xE0E1,
- 0x3C34,0xE0E2,0xE0E3,0x6D46,0x6D45,0x375A,0x6D48,0x0000,
-
- /* 8F00h */
- 0xE0E5,0x0000,0xE0E6,0x3353,0x0000,0x6D4A,0x0000,0xE0E7,
- 0xE0E8,0x3A5C,0x6D49,0x0000,0x6D52,0x0000,0x0000,0xE0E9,
- 0xE0EA,0x0000,0x6D4C,0x6D4E,0x4A65,0x6D4B,0xE0EB,0xE0EC,
- 0xE0ED,0x6D4D,0x0000,0x6D51,0x6D4F,0x3531,0xE0EE,0x6D50,
- 0xE0EF,0xE0F0,0x0000,0xE0F1,0x0000,0xE0F2,0x6D53,0xE0F3,
- 0xE0F4,0x475A,0x4E58,0x0000,0xE0F5,0xE0F6,0xE0F7,0x3D34,
- 0x0000,0x0000,0x0000,0x6D54,0xE0F8,0xE0F9,0xE0FA,0xE0FB,
- 0x4D22,0x6D56,0xE0FC,0x6D55,0x0000,0x0000,0x6D59,0x4D41,
- 0xE0FD,0xE0FE,0x6D58,0xE1A1,0x336D,0x6D57,0x6D5C,0xE1A2,
- 0x0000,0x6D5B,0x0000,0x0000,0x6D5A,0x4532,0x6D5D,0xE1A3,
- 0x0000,0xE1A4,0xE1A5,0xE1A6,0xE1A7,0xE1A8,0x0000,0x6D5E,
- 0xE1A9,0x0000,0x0000,0x0000,0x6D5F,0xE1AA,0xE1AB,0x396C,
- 0x0000,0x3725,0x6D60,0x6D61,0x6D62,0xE1AC,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x3F49,0x6D63,0xE1AD,0x3C2D,0x6D64,
- 0xE1AE,0xE1AF,0x0000,0x6D65,0xE1B0,0xE1B1,0xE1B2,0x5221,
- 0x517E,0x0000,0x0000,0x0000,0x0000,0x6D66,0x6570,0x6D67,
- 0x4324,0x3F2B,0x4740,0x0000,0x0000,0xE1B3,0xE1B4,0x6D68,
- 0xE1B5,0x0000,0x4A55,0x4454,0x397E,0x0000,0xE1B6,0x4329,
- 0xE1B7,0xE1B8,0x312A,0x0000,0x4B78,0x3F57,0xE1B9,0x0000,
- 0x0000,0x0000,0xE1BA,0xE1BB,0x0000,0xE1BC,0x375E,0x0000,
- 0xE1BD,0x3661,0xE1BE,0xE1BF,0x4A56,0xE1C0,0x0000,0x0000,
- 0x0000,0x0000,0x6D69,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0xE1C1,0x0000,0x6D6B,0xE1C2,0xE1C3,0x6D6A,0x3260,0x0000,
- 0xE1C4,0x4676,0x6D6C,0x4777,0x0000,0x4533,0xE1C5,0x6D6D,
- 0x3D52,0xE1C6,0x0000,0x0000,0x6D6F,0xE1C7,0xE1C8,0x4C42,
- 0x6D7E,0x6D71,0x6D72,0xE1C9,0x0000,0x4449,0xE1CA,0x0000,
-
- /* 9000h */
- 0x4260,0x4177,0xE1CB,0x4628,0xE1CC,0x6D70,0x3555,0x0000,
- 0xE1CD,0x0000,0x0000,0x6D79,0xE1CE,0x6D76,0x6E25,0x4629,
- 0x4360,0x6D73,0x0000,0x447E,0x4553,0x6D74,0x6D78,0x3F60,
- 0xE1CF,0x4767,0x444C,0xE1D0,0x0000,0x4042,0x6D77,0x422E,
- 0x4224,0x6D75,0x3029,0x4F22,0x0000,0x0000,0x0000,0x6D7A,
- 0xE1D1,0xE1D2,0xE1D4,0x0000,0xE1D5,0xE1D6,0x4261,0xE1D3,
- 0x0000,0x3D35,0x3F4A,0xE1D7,0xE1D8,0x6D7C,0x6D7B,0xE1D9,
- 0x306F,0x6D7D,0x0000,0x0000,0x492F,0x0000,0x6E27,0xE1DA,
- 0x0000,0x465B,0x3F6B,0xE1DB,0xE1DC,0x4359,0x0000,0x3678,
- 0x0000,0x6E26,0x4D37,0x313F,0xE1DD,0x4A57,0x3261,0x6E21,
- 0x6E22,0x6E23,0x6E24,0x463B,0x4323,0x3063,0x6E28,0x0000,
- 0x6E29,0x7423,0x0000,0xE1DE,0x423D,0xE1DF,0x6E2A,0x0000,
- 0x3173,0x414C,0xE1E0,0x382F,0x0000,0x4D5A,0xE1E1,0xE1E2,
- 0x6E2B,0x452C,0x0000,0x0000,0xE1E3,0x4178,0x3C57,0x6E2C,
- 0xE1E4,0x0000,0x6E2F,0x0000,0xE1E5,0x3D65,0x6E2D,0x412B,
- 0x412A,0xE1E6,0x3064,0x0000,0x4E4B,0x6E31,0x0000,0x4872,
- 0x6E33,0x6E32,0x6E30,0x6364,0x3454,0xE1E7,0x0000,0x6D6E,
- 0xE1E8,0x6E35,0x6E34,0xE1E9,0xE1EA,0x0000,0xE1EB,0x6E36,
- 0xE1EC,0x4D38,0x0000,0x0000,0x0000,0xE1ED,0x0000,0xE1EE,
- 0xE1EF,0xE1F0,0x0000,0xE1F1,0x0000,0x0000,0x0000,0x0000,
- 0xE1F2,0xE1F3,0xE1F4,0x4661,0x0000,0xE1F5,0x4B2E,0x0000,
- 0x6E37,0x0000,0x3C59,0x0000,0x0000,0x0000,0x0000,0x6E38,
- 0xE1F6,0x6E39,0xE1F7,0xE1F8,0xE1F9,0x6E3A,0xE1FA,0x0000,
- 0x4521,0x0000,0x0000,0x0000,0x0000,0xE1FB,0xE1FD,0x0000,
- 0x0000,0x306A,0x0000,0xE1FE,0xE2A1,0xE2A2,0x0000,0xE2A3,
- 0xE2A4,0x0000,0x3959,0x0000,0xE1FC,0x0000,0x4F3A,0x0000,
- 0x0000,0x0000,0xE2AD,0x0000,0x0000,0xE2A5,0x0000,0xE2A6,
- 0xE2A7,0xE2A8,0x0000,0x6E3E,0xE2A9,0xE2AA,0x0000,0xE2AB,
- 0x0000,0x3734,0x6E3B,0x0000,0x6E3C,0xE2AC,0x0000,0x0000,
- 0x4974,0x0000,0x0000,0xE2AF,0x0000,0x3354,0x0000,0xE2B0,
- 0xE2B1,0x0000,0x0000,0x0000,0xE2B2,0x4D39,0xE2AE,0x363F,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x4554,0xE2B3,0xE2B4,
-
- /* 9100h */
- 0xE2B5,0x0000,0x6E3F,0x0000,0xE2B6,0xE2B7,0xE2B8,0x0000,
- 0xE2B9,0x0000,0x0000,0x0000,0x0000,0xE2BA,0x0000,0x0000,
- 0xE2BB,0x0000,0x6E40,0x0000,0xE2BC,0x0000,0xE2BD,0xE2BE,
- 0xE2BF,0x6E41,0xE2C0,0x0000,0xE2C1,0x0000,0xE2C2,0x0000,
- 0xE2C3,0x0000,0xE2C5,0xE2C6,0x0000,0xE2C4,0x0000,0xE2C7,
- 0x0000,0xE2C8,0x0000,0x0000,0x0000,0x4522,0xE2C9,0xE2CA,
- 0x6E43,0xE2CB,0x6E42,0x0000,0xE2CC,0x0000,0xE2CD,0xE2CE,
- 0x0000,0xE2CF,0xE2D0,0x0000,0xE2D1,0xE2D2,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0xE2D3,0x0000,0x0000,0x0000,0xE2D4,
- 0xE2D5,0x4653,0x6E44,0x3D36,0x3C60,0x475B,0x4371,0xE2D6,
- 0x0000,0x0000,0x3C72,0xE2D7,0x3F6C,0x0000,0x6E45,0xE2D8,
- 0x6E46,0xE2D9,0xE2DA,0xE2DB,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0xE2DC,0x3F5D,0x6E47,0xE2DD,0x6E48,0x0000,0xE2DE,
- 0x0000,0x6E49,0x4D6F,0x0000,0x3D37,0xE2DF,0x0000,0x0000,
- 0x0000,0x0000,0x6E4B,0x6E4A,0xE2E0,0x395A,0x0000,0x3973,
- 0x3B40,0xE2E1,0xE2E2,0xE2E3,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0xE2E4,0x6E4E,0xE2E5,0x0000,0xE2E6,0xE2E7,0x3D66,
- 0x0000,0x6E4D,0xE2E8,0x6E4C,0x0000,0x4269,0xE2E9,0x0000,
- 0x386F,0xE2EA,0x4043,0xE2EB,0xE2EC,0xE2ED,0x0000,0x4830,
- 0xE2EE,0x0000,0x0000,0x0000,0x3D39,0x0000,0xE2EF,0x0000,
- 0x0000,0xE2F0,0x6E4F,0x0000,0x3E5F,0x0000,0xE2F1,0x0000,
- 0xE2F2,0x0000,0x6E52,0x6E50,0xE2F3,0xE2F4,0xE2F5,0x6E51,
- 0xE2F6,0xE2F7,0xE2F8,0xE2F9,0x6E54,0x6E53,0xE2FA,0x0000,
- 0x3E7A,0x0000,0x6E55,0xE2FB,0xE2FC,0xE2FD,0x0000,0xE2FE,
- 0x6E56,0x6E57,0xE3A1,0xE3A2,0x0000,0xE3A3,0x4850,0x3A53,
- 0x3C61,0x6E58,0x0000,0x6E59,0x4E24,0x3D45,0x4C6E,0x4E4C,
- 0x6E5A,0x3662,0x0000,0xE3A4,0xE3A5,0x0000,0x6E5B,0xE3A6,
- 0x4523,0xE3A7,0xE3A8,0x6E5E,0x3378,0x3F4B,0xE3A9,0x6E5C,
- 0x0000,0x6E5D,0x0000,0x4460,0xE3AA,0xE3AB,0x4B55,0x367C,
- 0x0000,0xE3AC,0xE3AD,0x0000,0xE3AE,0xE3AF,0xE3B0,0xE3B1,
- 0xE3B2,0xE3B3,0x0000,0x0000,0x0000,0x6E60,0x6E61,0xE3B4,
- 0x0000,0xE3B5,0x0000,0xE3B6,0x6E5F,0xE3B7,0x0000,0x6E63,
-
- /* 9200h */
- 0xE3B8,0xE3B9,0x0000,0x0000,0xE3BA,0xE3BB,0xE3BC,0xE3BD,
- 0x0000,0xE3BE,0xE3BF,0x0000,0xE3C0,0x465F,0x3343,0x0000,
- 0xE3C1,0x6E67,0xE3C2,0xE3C3,0x6E64,0x6E66,0xE3C4,0x0000,
- 0xE3C5,0x0000,0x0000,0x0000,0xE3C6,0xE3C7,0x6E62,0x0000,
- 0x0000,0x0000,0x0000,0xE3C8,0xE3C9,0xE3CA,0xE3CB,0x0000,
- 0xE3CC,0x6F4F,0x0000,0x0000,0x6E65,0x0000,0xE3CD,0xE3CE,
- 0xE3CF,0x0000,0x0000,0xE3D0,0x4E6B,0xE3D1,0xE3D2,0x385A,
- 0xE3D3,0xE3D4,0xE3D5,0x0000,0xE3D6,0x0000,0xE3D7,0x6E6F,
- 0xE3D8,0x0000,0xE3D9,0xE3DA,0x4534,0x6E6A,0xE3DB,0xE3DC,
- 0x6E6D,0x6E6B,0xE3DD,0x6E70,0x0000,0xE3DE,0xE3DF,0xE3E0,
- 0x6E71,0xE3E1,0x0000,0x0000,0x0000,0x0000,0x0000,0x6E69,
- 0xE3E2,0xE3E3,0x6E76,0x3174,0xE3E4,0xE3E5,0x6E68,0x0000,
- 0xE3E6,0xE3E7,0x482D,0x0000,0x6E6C,0xE3E8,0x3E60,0xE3E9,
- 0xE3EA,0xE3EB,0x0000,0x0000,0x0000,0x0000,0xE3EC,0xE3ED,
- 0xE3EE,0x395B,0x0000,0x0000,0x0000,0xE3EF,0xE3F0,0xE3F1,
- 0xE3F2,0xE3F3,0x0000,0xE3F4,0xE3F5,0xE3F6,0x4B48,0xE3F7,
- 0x3664,0x0000,0x0000,0x3D46,0x0000,0x463C,0x0000,0x0000,
- 0xE3F8,0xE3F9,0xE3FA,0x0000,0x0000,0xE3FB,0xE3FC,0x0000,
- 0x0000,0x412D,0xE3FD,0x6E74,0x0000,0x6E6E,0x6E73,0xE3FE,
- 0x4C43,0xE4A1,0x4438,0x6E75,0x6E72,0x0000,0x0000,0xE4A2,
- 0xE4A3,0x0000,0x0000,0x0000,0xE4A4,0xE4A5,0x0000,0xE4A6,
- 0xE4A7,0x0000,0x0000,0xE4A8,0x0000,0x412C,0x0000,0xE4A9,
- 0x0000,0x0000,0xE4AA,0x0000,0x0000,0x0000,0xE4AB,0x6E79,
- 0xE4AC,0x6E78,0xE4AD,0xE4AE,0xE4AF,0xE4B0,0x0000,0xE4B1,
- 0xE4B2,0xE4B3,0xE4B4,0xE4B5,0x0000,0xE4B6,0xE4B7,0xE4B8,
- 0xE4B9,0x0000,0x0000,0xE4BA,0xE4BB,0xE4BC,0xE4BD,0x6E77,
- 0xE4BE,0x0000,0x4B2F,0xE4BF,0x0000,0xE4C0,0x0000,0xE4C1,
- 0xE4C2,0xE4C3,0x0000,0x0000,0xE4C4,0xE4C5,0x0000,0xE4C6,
- 0xE4C7,0xE4C8,0x0000,0xE4C9,0x3D7B,0xE4CA,0x0000,0xE4CB,
- 0xE4CC,0x6E7A,0x4A5F,0x0000,0xE4CD,0x3154,0xE4CE,0x0000,
- 0xE4CF,0x0000,0x4946,0x4372,0x0000,0x0000,0x0000,0x0000,
- 0x3578,0xE4D0,0x6E7C,0xE4D1,0x395D,0x0000,0x0000,0xE4D2,
-
- /* 9300h */
- 0xE4D3,0x0000,0xE4D4,0x0000,0x0000,0x0000,0x3B2C,0x0000,
- 0xE4D5,0x0000,0x0000,0x0000,0x0000,0xE4D6,0x0000,0x6E7B,
- 0x3F6D,0xE4D7,0x0000,0x0000,0xE4D8,0xE4D9,0x0000,0x0000,
- 0x3F6E,0x6F21,0x6F23,0x0000,0xE4DA,0xE4DB,0xE4DC,0xE4DD,
- 0x3E7B,0xE4DE,0x6F22,0x6F24,0xE4DF,0xE4E0,0x3653,0xE4E1,
- 0x4945,0xE4E2,0xE4E3,0x3C62,0x4F23,0x0000,0x6E7E,0x3A78,
- 0x0000,0x0000,0x4F3F,0xE4E4,0xE4E5,0x6F26,0xE4E6,0xE4E7,
- 0x0000,0x0000,0x6F25,0x6F27,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x6E7D,0x0000,0x0000,0xE4E8,
- 0xE4E9,0xE4EA,0x0000,0x4669,0x0000,0x4555,0x0000,0x0000,
- 0xE4EB,0xE4EC,0xE4ED,0x0000,0x4457,0xE4EE,0x6F2C,0xE4EF,
- 0xE4F0,0x0000,0xE4F1,0x4343,0x6F28,0x0000,0xE4F2,0x0000,
- 0x6F29,0x0000,0x0000,0x0000,0xE4F3,0xE4F4,0x0000,0xE4F5,
- 0x0000,0xE4F6,0xE4F7,0x0000,0x372D,0xE4F8,0x6F2B,0xE4F9,
- 0xE4FA,0xE4FB,0x0000,0xE4FC,0xE4FD,0x3830,0xE4FE,0x0000,
- 0x0000,0x0000,0xE5A1,0x0000,0x6F2A,0xE5A2,0x3E61,0xE5A3,
- 0xE5A4,0xE5A5,0xE5A6,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0xE5A7,0x0000,0xE5A8,0xE5A9,0x3379,0xE5AA,0x0000,0xE5AB,
- 0x0000,0x0000,0xE5AC,0x0000,0x6F30,0xE5AD,0x3A3F,0x4179,
- 0xE5AE,0x0000,0x444A,0xE5AF,0x0000,0x0000,0xE5B0,0x0000,
- 0x0000,0xE5B1,0x0000,0xE5B2,0xE5B3,0x0000,0xE5B4,0x333B,
- 0xE5B5,0xE5BB,0x0000,0xE5B6,0x6F2E,0x6F2F,0x4443,0x0000,
- 0x6F2D,0x0000,0x0000,0x0000,0xE5B7,0xE5B8,0xE5B9,0x0000,
- 0x0000,0x6F31,0xE5BA,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0xE5BC,0x0000,0x6F37,0xE5BD,0xE5BE,0xE5BF,0xE5C0,
- 0x6F3A,0xE5C1,0xE5C2,0xE5C3,0xE5C4,0xE5C5,0x0000,0x0000,
- 0x6F39,0x452D,0x0000,0xE5C6,0x0000,0x0000,0x6F32,0x6F33,
- 0x6F36,0xE5C7,0x0000,0x0000,0xE5C8,0x6F38,0xE5C9,0xE5CA,
- 0x0000,0x3640,0xE5CB,0x0000,0x6F3B,0x6F35,0xE5CC,0xE5CD,
- 0x6F34,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xE5CF,
- 0xE5D0,0xE5CE,0xE5D1,0xE5D2,0x0000,0xE5D3,0x0000,0x0000,
-
- /* 9400h */
- 0x0000,0xE5D4,0xE5D5,0x6F3F,0xE5D6,0x0000,0x0000,0x6F40,
- 0xE5D7,0xE5D8,0x0000,0x0000,0x0000,0xE5D9,0xE5DA,0xE5DB,
- 0x6F41,0x0000,0x0000,0x6F3E,0x6F3D,0xE5DC,0xE5DD,0xE5DE,
- 0x3E62,0x462A,0x6F3C,0x0000,0x0000,0x0000,0x0000,0xE5DF,
- 0x0000,0x6F45,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x6F43,0x0000,0x0000,0xE5E0,0xE5E1,
- 0x0000,0xE5E2,0xE5E3,0xE5E4,0xE5E5,0x6F44,0x6F42,0x0000,
- 0x4278,0x0000,0x6F46,0xE5E6,0x0000,0xE5E8,0x0000,0xE5E7,
- 0x0000,0x6F47,0x0000,0xE5E9,0x6F49,0xE5EA,0x0000,0x0000,
- 0xE5EB,0x0000,0xE5EC,0x0000,0xE5ED,0x0000,0x0000,0x0000,
- 0x0000,0x3455,0x6F48,0x4C7A,0x0000,0xE5EE,0x0000,0x0000,
- 0x0000,0xE5EF,0x6F54,0x6F4A,0xE5F0,0x0000,0x6F4D,0xE5F1,
- 0x6F4B,0xE5F2,0x6F4C,0xE5F3,0x0000,0x0000,0x0000,0x0000,
- 0xE5F4,0x0000,0x6F4E,0xE5F5,0x0000,0xE5F6,0xE5F7,0xE5F8,
- 0x6F50,0xE5F9,0xE5FA,0x0000,0x0000,0x6F51,0x0000,0x6F52,
- 0x0000,0x0000,0x0000,0x0000,0x6F55,0x6F53,0x6F56,0x6F58,
- 0x0000,0x6F57,0x0000,0xE5FC,0xE5FB,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-
- /* 9500h */
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x4439,
- 0xE5FD,0xE5FE,0x0000,0x0000,0x0000,0x0000,0xE6A1,0x0000,
- 0x4C67,0x0000,0x6F59,0x412E,0xE6A2,0x0000,0x0000,0x6F5A,
- 0xE6A3,0x4A44,0x6F5B,0x332B,0xE6A4,0xE6A5,0xE6A6,0x313C,
- 0x0000,0x3457,0x0000,0x3456,0x6F5C,0x0000,0x6F5D,0x0000,
- 0x6F5E,0x6F5F,0x0000,0x0000,0x0000,0xE6A7,0xE6A8,0xE6A9,
- 0x6F60,0xE6AA,0x3458,0x3355,0x395E,0x4836,0xE6AB,0x6F62,
- 0x6F61,0xE6AC,0x0000,0xE6AD,0xE6AE,0x6F63,0x0000,0x0000,
- 0x0000,0x0000,0x315C,0x0000,0xE6AF,0x0000,0xE6B0,0x0000,
- 0x0000,0x6F66,0xE6B1,0x6F65,0x6F64,0xE6B2,0x6F67,0xE6B3,
- 0x0000,0x0000,0x0000,0x6F6A,0x0000,0x0000,0xE6B4,0x3047,
- 0xE6B5,0xE6B6,0x6F68,0xE6B7,0x6F6C,0x6F6B,0x0000,0x0000,
- 0xE6B8,0xE6B9,0xE6BA,0xE6BB,0x6F6E,0x6F6D,0x6F6F,0x0000,
- 0x462E,0xE6BC,0xE6BD,0x0000,0x6F70,0xE6BE,0xE6BF,0xE6C0,
- 0xE6C1,0x6F71,0x6F73,0x0000,0xE6C2,0x6F72,0xE6C3,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-
- /* 9600h */
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x496C,0xE6C4,0xE6C5,0x0000,
- 0x0000,0x6F74,0xE6C6,0x0000,0xE6C7,0xE6C8,0xE6C9,0x0000,
- 0x6F75,0x0000,0x3A65,0x0000,0xE6CA,0x0000,0x6F76,0x6F77,
- 0x0000,0xE6CB,0x4B49,0xE6CC,0x0000,0x0000,0x0000,0xE6CD,
- 0xE6CE,0xE6CF,0xE6D0,0x414B,0xE6D1,0xE6D2,0x0000,0x3024,
- 0x424B,0xE6D3,0x6F78,0x0000,0x496D,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x6F7B,0x6F79,0x395F,0x0000,0x6F7A,
- 0x3842,0x0000,0xE6D4,0x0000,0xE6D5,0x0000,0xE6D6,0xE6D7,
- 0xE6D8,0x0000,0x0000,0x4A45,0x6F7D,0x7021,0x6F7E,0x7022,
- 0x0000,0xE6D9,0x3121,0x3F58,0x3D7C,0x3459,0x7023,0x0000,
- 0x0000,0x0000,0x4766,0x0000,0x7025,0x0000,0xE6DA,0x0000,
- 0x3122,0x0000,0x7024,0x4444,0xE6DB,0x4E4D,0x462B,0x6F7C,
- 0x4E26,0x0000,0x3831,0xE6DC,0xE6DD,0x4D5B,0xE6DE,0xE6DF,
- 0x0000,0xE6E0,0xE6E1,0xE6E2,0xE6E3,0x3679,0x4E34,0x0000,
- 0x3728,0xE6E4,0x4262,0x6721,0x0000,0x7026,0x332C,0x3F6F,
- 0x0000,0xE6E5,0x0000,0x0000,0x3356,0x7028,0xE6E6,0x7029,
- 0x7027,0x3764,0xE6E7,0x3A5D,0x3E63,0xE6E8,0x0000,0xE6E9,
- 0x3123,0x0000,0x0000,0x4E59,0xE6EA,0xE6EB,0xE6EC,0x702B,
- 0x6E2E,0xE6ED,0x702A,0x0000,0x0000,0x0000,0xE6EE,0xE6EF,
- 0x702E,0x702C,0x702D,0xE6F0,0x702F,0x0000,0x7030,0x4E6C,
- 0x7031,0x7032,0xE6F1,0x4049,0x483B,0x0000,0x0000,0x0000,
- 0x3F7D,0x3467,0x0000,0x0000,0x4D3A,0x326D,0x3D38,0x385B,
- 0x0000,0x7035,0xE6F2,0x7034,0x3B73,0x7036,0x7033,0x0000,
- 0x0000,0x3B28,0xE6F3,0x0000,0x0000,0x703A,0x6A2D,0x0000,
- 0xE6F5,0x5256,0xE6F6,0x3F77,0x7038,0xE6F7,0xE6F8,0xE6F9,
- 0x0000,0x0000,0x4E25,0x4671,0x0000,0x0000,0x0000,0x0000,
- 0x312B,0xE6FA,0x4063,0x3C36,0x0000,0x0000,0x0000,0xE6FB,
- 0x4A37,0xE6FC,0x3140,0x0000,0x0000,0x0000,0x4E6D,0x4D6B,
- 0x0000,0x703B,0xE6FD,0x4545,0x0000,0x0000,0x0000,0x0000,
-
- /* 9700h */
- 0x3C7B,0x0000,0xE6FE,0xE7A1,0x703C,0xE7A2,0x703D,0x3F4C,
- 0x703E,0xE7A3,0x4E6E,0x0000,0x0000,0x7039,0x7040,0x7042,
- 0x0000,0x7041,0x0000,0x703F,0x0000,0x0000,0x7043,0x0000,
- 0x0000,0x7044,0xE7A4,0xE7A5,0x417A,0xE7A6,0x3262,0x0000,
- 0x0000,0xE7A7,0xE7A8,0xE7A9,0x7045,0x0000,0x0000,0x4C38,
- 0xE7AA,0x0000,0x7046,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x7047,0xE7AB,0x4F2A,0xE7AC,0x0000,0x0000,0x0000,0x0000,
- 0x5B31,0x7048,0x0000,0x0000,0x0000,0x7049,0x704A,0x0000,
- 0x0000,0xE7AD,0x704E,0xE7AE,0x704B,0x0000,0x704C,0x0000,
- 0x704D,0x704F,0xE7AF,0x0000,0x0000,0x0000,0xE7B0,0xE7B1,
- 0x0000,0x0000,0x4044,0x0000,0x0000,0xE7B2,0x4C77,0xE7B3,
- 0xE7B4,0x4045,0xE7B5,0xE7B6,0x7050,0x0000,0x4873,0x0000,
- 0x7051,0x7353,0x4C4C,0xE7B7,0x7052,0x0000,0x7053,0xE7B8,
- 0x7054,0x3357,0xE7B9,0x7056,0x0000,0x3F59,0xE7BA,0x0000,
- 0x0000,0x7057,0x0000,0xE7BB,0x3724,0x0000,0xE7BC,0xE7BD,
- 0xE7BE,0x7058,0x705C,0xE7BF,0x705A,0xE7C0,0x0000,0xE7C1,
- 0xE7C2,0x705B,0x0000,0x0000,0x3373,0x7059,0x705D,0x0000,
- 0x0000,0xE7C3,0x0000,0x705E,0x0000,0x3048,0x0000,0x705F,
- 0x7060,0x0000,0x0000,0x0000,0x0000,0xE7C4,0xE7C5,0xE7C6,
- 0x3E64,0xE7C7,0xE7C8,0x0000,0x7061,0x0000,0xE7C9,0xE7CA,
- 0x3547,0x0000,0xE7CB,0x7064,0x0000,0x0000,0x7063,0x0000,
- 0x7062,0x0000,0x0000,0x6B71,0xE7CC,0x4A5C,0xE7CD,0x0000,
- 0x0000,0xE7CE,0xE7CF,0x7065,0x7066,0xE7D0,0xE7D1,0x0000,
- 0xE7D2,0xE7D3,0xE7D4,0x0000,0xE7D5,0x0000,0xE7D6,0xE7D7,
- 0x0000,0xE7D8,0x0000,0x7067,0xE7D9,0xE7DA,0x7068,0xE7DB,
- 0x7069,0xE7DC,0xE7DD,0x706A,0xE7DE,0xE7DF,0xE7E0,0x0000,
- 0xE7E1,0xE7E2,0x0000,0x345A,0xE7E3,0x0000,0x0000,0xE7E4,
- 0xE7E5,0xE7E6,0x0000,0xE7EA,0x706B,0xE7E7,0xE7E8,0x0000,
- 0xE7E9,0xE7EB,0x0000,0x0000,0xE7EC,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x706C,0x4723,0xE7ED,
- 0x0000,0xE7EE,0x706E,0x323B,0xE7EF,0x7071,0x7070,0xE7F0,
- 0xE7F1,0x0000,0xE7F2,0x3124,0x0000,0x0000,0x0000,0x3641,
-
- /* 9800h */
- 0x0000,0x4A47,0x443A,0x3A22,0x0000,0x3960,0x3D67,0xE7F3,
- 0x3F5C,0x0000,0xE7F4,0x0000,0x7073,0xE7F6,0xE7F7,0x7072,
- 0x4D42,0x3468,0x4852,0x465C,0xE7F8,0x0000,0xE7F9,0x3F7C,
- 0x4E4E,0xE7F5,0x375B,0x0000,0xE7FA,0x0000,0xE7FB,0x0000,
- 0xE7FC,0x7076,0x0000,0xE7FD,0x7075,0xE8A8,0xE7FE,0x0000,
- 0x0000,0x0000,0x0000,0xE8A1,0x4B4B,0x462C,0xE8A2,0xE8A3,
- 0xE8A4,0x0000,0xE8A5,0xE8A6,0x3150,0xE8A7,0x0000,0x7077,
- 0x7074,0x0000,0x0000,0x4951,0x4D6A,0x7078,0xE8A9,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0xE8AA,0x0000,0x7079,0xE8AB,
- 0x0000,0x0000,0xE8AC,0x707B,0x426A,0x335B,0x335C,0x707A,
- 0x0000,0xE8AD,0xE8AE,0xE8AF,0x3469,0x3832,0xE8B0,0xE8B1,
- 0x346A,0xE8B2,0xE8B3,0x453F,0x0000,0x0000,0x4E60,0x0000,
- 0x0000,0x0000,0xE8B4,0xE8B5,0x0000,0xE8B6,0xE8B7,0x385C,
- 0x0000,0x0000,0xE8B8,0x707C,0xE8B9,0x0000,0x0000,0x707D,
- 0x707E,0x7121,0x0000,0x7123,0x7122,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x4977,0x0000,0x7124,0xE8BA,0x0000,0xE8BB,0xE8BC,0x7125,
- 0xE8BD,0x7126,0x0000,0x0000,0xE8BE,0x0000,0x7127,0xE8BF,
- 0xE8C0,0x0000,0xE8C1,0xE8C2,0x0000,0x0000,0x0000,0xE8C3,
- 0x0000,0x0000,0xE8C4,0x7129,0x7128,0xE8C5,0x712A,0x0000,
- 0xE8C6,0x0000,0x0000,0x0000,0xE8C7,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x4874,0x664C,0x0000,0x0000,0x3F29,
- 0x0000,0xE8C8,0x3532,0xE8C9,0x0000,0xE8CA,0xE8CB,0xE8CC,
- 0x0000,0x712B,0xE8CD,0x712C,0x0000,0x522C,0x5D3B,0x4853,
- 0x0000,0x0000,0x307B,0xE8CE,0x303B,0x0000,0xE8CF,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x3B74,0x4B30,0x3E7E,0x0000,
-
- /* 9900h */
- 0x0000,0x0000,0xE8D0,0x712D,0x0000,0x4C5F,0x0000,0xE8D1,
- 0xE8D2,0x712E,0x4D5C,0x0000,0x3142,0x0000,0x0000,0x0000,
- 0x3B41,0xE8D3,0x712F,0x326E,0x7130,0xE8D4,0xE8D5,0xE8D6,
- 0x7131,0x0000,0xE8D7,0xE8D8,0xE8D9,0x7133,0x7134,0xE8DA,
- 0x7136,0x7132,0xE8DB,0x0000,0x7135,0x0000,0xE8DC,0xE8DD,
- 0x345B,0x0000,0x0000,0xE8DE,0x7137,0x0000,0x7138,0x0000,
- 0x0000,0xE8DF,0xE8E0,0xE8E1,0xE8E2,0xE8E3,0x0000,0x0000,
- 0x0000,0xE8E4,0xE8E5,0xE8E6,0xE8E7,0x7139,0x713A,0x0000,
- 0xE8E8,0xE8E9,0x713B,0x0000,0x0000,0x713D,0xE8EA,0xE8EB,
- 0xE8EC,0x713C,0x0000,0x713F,0x7142,0xE8ED,0xE8EE,0x0000,
- 0x713E,0x7140,0x7141,0x0000,0xE8EF,0x7143,0x0000,0x3642,
- 0xE8F0,0xE8F1,0x0000,0xE8F2,0xE8F3,0x0000,0xE8F4,0xE8F5,
- 0xE8F6,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x3C73,0x7144,
- 0x7145,0x3961,0x0000,0xE8F7,0x0000,0xE8F8,0x0000,0xE8F9,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x7146,0xE8FA,0x0000,
- 0x333E,0x0000,0x0000,0x0000,0x474F,0x7147,0x7148,0x0000,
- 0xE8FB,0xE8FC,0xE8FD,0x435A,0x466B,0xE8FE,0x0000,0x0000,
- 0x0000,0xE9A1,0xE9A2,0x0000,0x7149,0xE9A3,0x0000,0xE9A4,
- 0x0000,0x477D,0x0000,0xE9A5,0x424C,0x3158,0x366E,0x0000,
- 0x366F,0xE9A6,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x4373,0x714E,0x3670,0xE9A7,0xE9A8,0x326F,0x0000,0x0000,
- 0x714D,0xE9A9,0xE9AA,0x714B,0xE9AB,0x714C,0xE9AC,0x714A,
- 0x0000,0x0000,0x7158,0x0000,0x0000,0x0000,0x0000,0xE9AD,
- 0x0000,0x0000,0xE9AE,0xE9AF,0xE9B0,0x714F,0x7150,0x0000,
- 0xE9B1,0x7151,0x7152,0x0000,0xE9B2,0xE9B3,0x0000,0x0000,
- 0x7154,0xE9B4,0x0000,0x7153,0x0000,0xE9B5,0xE9B6,0x3D59,
-
- /* 9A00h */
- 0x0000,0x7155,0xE9B7,0xE9B8,0xE9B9,0x7157,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0xE9BA,0xE9BB,0x0000,0x3533,0x7156,
- 0xE9BC,0xE9BD,0x417B,0x3833,0x0000,0x0000,0xE9BE,0x0000,
- 0x0000,0x7159,0x0000,0x0000,0x0000,0x0000,0xE9BF,0x0000,
- 0xE9C0,0x0000,0xE9C1,0xE9C2,0xE9C3,0x0000,0x0000,0xE9C4,
- 0x424D,0x0000,0x0000,0x715A,0x0000,0xE9C5,0xE9C6,0x0000,
- 0x462D,0x0000,0x0000,0xE9C7,0x0000,0xE9C8,0xE9C9,0x715B,
- 0xE9CA,0x0000,0x0000,0x0000,0x0000,0x0000,0x7160,0x0000,
- 0x715E,0xE9CC,0x715D,0x715F,0xE9CD,0x715C,0x0000,0xE9CB,
- 0x0000,0x0000,0xE9CE,0xE9CF,0xE9D0,0x7162,0xE9D1,0x0000,
- 0x0000,0xE9D2,0x0000,0x0000,0xE9D3,0x7161,0xE9D4,0x7164,
- 0x0000,0x0000,0x3643,0x7163,0x0000,0xE9D5,0x0000,0x7165,
- 0x0000,0x0000,0x7166,0x0000,0x7168,0x7167,0x0000,0x0000,
- 0x0000,0x7169,0x716B,0x716A,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x397C,0x0000,0xE9D6,0x0000,0xE9D7,0x716C,0xE9D8,0xE9D9,
- 0x716D,0x0000,0xE9DA,0x0000,0xE9DB,0xE9DC,0xE9DD,0x0000,
- 0x333C,0xE9DE,0x0000,0xE9DF,0x716E,0x0000,0xE9E0,0xE9E1,
- 0x716F,0xE9E2,0x0000,0xE9E3,0x3F71,0x0000,0xE9E4,0x0000,
- 0xE9E5,0x0000,0x0000,0x0000,0x0000,0x0000,0xE9E6,0x7170,
- 0xE9E7,0x7171,0xE9E8,0x7172,0x7173,0xE9E9,0xE9EA,0xE9EB,
- 0x3962,0x0000,0x0000,0xE9EC,0xE9ED,0x0000,0x7174,0x7175,
- 0xE9EE,0x0000,0x7176,0x7177,0xE9EF,0xE9F0,0x7178,0xE9F1,
- 0x0000,0xE9F2,0x4831,0x717A,0xE9F3,0x4926,0x717B,0x7179,
- 0x0000,0x717D,0xE9F4,0xE9F5,0x717C,0xE9F6,0x0000,0x717E,
- 0x0000,0xE9F7,0xE9F8,0x7221,0x0000,0xE9F9,0x0000,0xE9FA,
-
- /* 9B00h */
- 0xE9FB,0xE9FC,0xE9FD,0xE9FE,0xEAA1,0xEAA2,0x7222,0x0000,
- 0xEAA3,0xEAA4,0x0000,0xEAA5,0xEAA6,0xEAA7,0xEAA8,0x0000,
- 0xEAA9,0x0000,0xEAAA,0x0000,0x0000,0x0000,0xEAAB,0x0000,
- 0x7223,0xEAAC,0x7224,0xEAAD,0xEAAE,0x0000,0x0000,0x7225,
- 0xEAAF,0x0000,0x7226,0x7227,0x0000,0x7228,0xEAB0,0x7229,
- 0x722A,0x722B,0x722C,0xEAB1,0x0000,0xEAB2,0x722D,0x722E,
- 0x0000,0x5D35,0x722F,0xEAB3,0xEAB4,0xEAB5,0x0000,0xEAB6,
- 0x0000,0xEAB7,0xEAB8,0x6478,0x3534,0xEAB9,0x0000,0x0000,
- 0x0000,0x3321,0x3A32,0x7231,0x7230,0x4C25,0x0000,0x0000,
- 0xEABA,0x0000,0x0000,0xEABB,0xEABC,0x7233,0x7234,0x7232,
- 0x0000,0x7235,0x0000,0x0000,0x4B62,0xEABD,0xEABE,0xEABF,
- 0x7236,0x0000,0x357B,0xEAC0,0x0000,0x0000,0xEAC1,0x0000,
- 0x0000,0xEAC2,0x0000,0xEAC3,0x0000,0xEAC4,0xEAC5,0x0000,
- 0xEAC6,0x0000,0xEAC7,0xEAC8,0xEAC9,0xEACA,0xEACB,0x4F25,
- 0x0000,0x0000,0x0000,0xEACC,0x7237,0xEACD,0x0000,0xEACE,
- 0xEACF,0xEAD0,0x0000,0x0000,0x0000,0x0000,0x0000,0xEAD1,
- 0xEAD2,0x0000,0x0000,0x7239,0xEAD3,0xEAD4,0xEAD5,0xEAD6,
- 0x0000,0xEAD7,0xEAD8,0xEAD9,0x0000,0xEADA,0x303E,0xEADB,
- 0xEADC,0x723A,0x4A2B,0x7238,0xEADD,0x0000,0x723B,0x723C,
- 0x0000,0x0000,0xEADE,0x0000,0x0000,0xEADF,0xEAE0,0x723D,
- 0x723E,0x0000,0x0000,0x0000,0x0000,0x0000,0xEAE1,0xEAE2,
- 0x723F,0xEAE3,0x4B6E,0x3B2D,0xEAE4,0x3A7A,0x412F,0x0000,
- 0xEAE5,0xEAE6,0xEAE7,0x0000,0x7240,0x0000,0x0000,0xEAE8,
- 0xEAE9,0x7243,0x0000,0xEAEA,0xEAEB,0x0000,0xEAEC,0xEAED,
- 0x7241,0xEAEE,0x0000,0x0000,0x0000,0x0000,0x7244,0xEAEF,
- 0xEAF0,0x3871,0x7242,0x0000,0x0000,0x0000,0xEAF1,0x7245,
- 0xEAF2,0x7246,0x7247,0x0000,0x724B,0x0000,0x3B2A,0xEAF3,
- 0xEAF4,0x0000,0x0000,0x4264,0x0000,0xEAF5,0x0000,0xEAF6,
- 0x0000,0x724C,0x7249,0x7248,0x724A,0xEAF7,0x0000,0xEAF8,
- 0x375F,0x0000,0xEAF9,0xEAFA,0x0000,0x0000,0x0000,0xEAFB,
- 0x7250,0x724F,0x724E,0xEAFC,0x0000,0x3033,0x0000,0xEAFD,
- 0xEAFE,0xEBA1,0xEBA2,0x0000,0x0000,0xEBA3,0x0000,0xEBA4,
-
- /* 9C00h */
- 0xEBA5,0x0000,0xEBA6,0x0000,0x725A,0x0000,0x7256,0x0000,
- 0x7257,0x7253,0x7259,0xEBA7,0x7255,0x3362,0x0000,0xEBA8,
- 0x4F4C,0xEBA9,0x7258,0x7254,0x7252,0x7251,0xEBAA,0x0000,
- 0xEBAB,0xEBAC,0xEBAD,0x725C,0xEBAE,0x0000,0xEBAF,0x0000,
- 0x0000,0x725F,0xEBB0,0xEBB1,0x725E,0x725D,0xEBB2,0xEBB3,
- 0xEBB4,0xEBB5,0xEBB6,0x0000,0x0000,0x4949,0x725B,0x3073,
- 0x7260,0xEBB7,0x7262,0x0000,0x0000,0xEBB8,0xEBB9,0xEBBA,
- 0x0000,0x336F,0x724D,0x3137,0x0000,0xEBBB,0x7264,0x0000,
- 0x0000,0xEBBC,0x0000,0xEBBD,0xEBBE,0xEBBF,0x7263,0x7261,
- 0x432D,0xEBC0,0xEBC1,0x0000,0x0000,0x0000,0xEBC2,0xEBC3,
- 0xEBC4,0x0000,0x4B70,0xEBC5,0xEBC6,0x0000,0xEBC7,0x4E5A,
- 0xEBC8,0x0000,0x7265,0xEBC9,0xEBD0,0xEBCA,0xEBCB,0xEBCC,
- 0x7266,0x0000,0x0000,0xEBCD,0x0000,0x0000,0x0000,0x7267,
- 0xEBD2,0xEBCE,0xEBCF,0xEBD1,0x0000,0x0000,0xEBD3,0x0000,
- 0xEBD4,0x0000,0xEBD5,0x0000,0x0000,0xEBD6,0x7268,0xEBD7,
- 0x7269,0x0000,0x0000,0xEBD8,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x443B,0xEBD9,0x726A,
- 0x0000,0x4837,0x0000,0x726F,0x726B,0x0000,0x0000,0x0000,
- 0x726C,0x0000,0xEBDA,0x4B31,0x4C44,0x0000,0x4650,0xEBDB,
- 0x0000,0xEBDC,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
-
- /* 9D00h */
- 0x0000,0x0000,0xEBDE,0x7270,0x0000,0x0000,0x7271,0x463E,
- 0x726E,0x726D,0x0000,0xEBDD,0x0000,0x0000,0x322A,0x0000,
- 0x0000,0xEBDF,0x7279,0x0000,0x0000,0x7278,0x0000,0xEBE0,
- 0xEBE1,0x0000,0x0000,0x3175,0xEBE2,0xEBE3,0xEBE4,0x7276,
- 0x0000,0x0000,0x0000,0x7275,0x0000,0x0000,0x7273,0x0000,
- 0x337B,0x0000,0x7272,0x3C32,0x3229,0x0000,0x0000,0xEBE5,
- 0xEBE6,0x0000,0xEBE7,0xEBE8,0xEBE9,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0xEBEA,0x3963,0xEBEB,0xEBED,0x727C,0x727B,
- 0x0000,0x727A,0xEBEE,0xEBEF,0x7277,0xEBEC,0x727D,0xEBF0,
- 0x727E,0x0000,0xEBF1,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x7325,0x7324,0x0000,0xEBF2,0xEBF3,0x0000,0x0000,0x0000,
- 0x0000,0x7326,0x0000,0x0000,0x312D,0x7321,0x7322,0xEBF4,
- 0x3974,0x4C39,0xEBF6,0xEBF5,0x7323,0xEBF7,0x0000,0x0000,
- 0x0000,0xEBF8,0xEBF9,0xEBFA,0x4B32,0x0000,0x0000,0x732B,
- 0xEBFB,0x0000,0x7327,0x0000,0x0000,0x0000,0xEBFC,0xEBFD,
- 0x0000,0x0000,0x732C,0xEBFE,0xECA1,0x0000,0xECA2,0x0000,
- 0x0000,0x0000,0x0000,0xECA3,0xECA4,0x0000,0xECA5,0x7329,
- 0x0000,0x7328,0xECA6,0x0000,0x0000,0xECA7,0xECA8,0x375C,
- 0x0000,0x0000,0xECA9,0xECAA,0x0000,0xECAB,0xECAC,0xECAD,
- 0xECAE,0x0000,0x732D,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0xECAF,0x0000,0x0000,0x732E,0x0000,0x0000,0x0000,
- 0x0000,0x732F,0xECB0,0x732A,0xECB1,0x0000,0xECB2,0x7274,
- 0x0000,0xECB3,0x7330,0x0000,0x4461,0xECB4,0x0000,0x0000,
- 0x7334,0xECB5,0x7335,0x7333,0xECB6,0x0000,0x0000,0xECB7,
- 0x0000,0x7332,0x7338,0xECB8,0x7331,0x0000,0x7336,0xECB9,
- 0x0000,0xECBA,0xECBB,0x0000,0x0000,0x0000,0x0000,0x7337,
- 0x0000,0x0000,0x0000,0x733A,0xECBC,0xECBD,0xECBE,0xECBF,
- 0x0000,0x7339,0xECC0,0x0000,0x0000,0x0000,0xECC1,0xECC2,
- 0xECC3,0x0000,0x0000,0x0000,0x0000,0xECC4,0x733C,0xECC5,
- 0x0000,0xECC6,0x0000,0xECC7,0x0000,0x733D,0xECC8,0x733E,
- 0xECC9,0x0000,0x4F49,0xECCA,0xECCB,0x0000,0x0000,0x0000,
- 0x733B,0x426B,0x3A6D,0x0000,0x0000,0x733F,0xECCC,0x0000,
-
- /* 9E00h */
- 0x0000,0x0000,0xECCE,0x0000,0x0000,0x0000,0x0000,0xECCF,
- 0x0000,0x0000,0xECCD,0x0000,0x0000,0x0000,0xECD0,0x0000,
- 0xECD1,0xECD2,0xECD3,0x0000,0x0000,0xECD4,0xECD5,0x0000,
- 0x0000,0xECD6,0x7340,0x7341,0xECD7,0xECD8,0x7342,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x7343,0x0000,0x0000,
- 0x3834,0x7344,0xECD9,0xECDA,0xECDB,0x7345,0x0000,0x3C2F,
- 0xECDC,0x7346,0xECDD,0xECDE,0xECDF,0xECE0,0x0000,0xECE1,
- 0x7347,0x0000,0x0000,0x7348,0x7349,0x0000,0xECE2,0xECE3,
- 0x0000,0x734C,0x734A,0x4F3C,0x0000,0x734B,0xECE4,0x4E6F,
- 0xECE5,0x0000,0x0000,0xECE6,0x0000,0x734D,0xECE7,0x4E5B,
- 0x0000,0x0000,0x0000,0x0000,0xECE8,0x734E,0x477E,0x0000,
- 0xECE9,0x734F,0x7351,0x0000,0xECEA,0x7352,0xECEB,0xECEC,
- 0xECED,0x0000,0x0000,0xECEE,0xECEF,0xECF0,0x0000,0x0000,
- 0x7350,0x396D,0x4C4D,0x4B63,0x5677,0x0000,0x5D60,0x4B7B,
- 0x0000,0x0000,0x0000,0x0000,0x322B,0x0000,0xECF1,0x0000,
- 0xECF2,0x0000,0x0000,0xECF3,0x7354,0x3550,0x7355,0x7356,
- 0x7357,0x0000,0x3975,0x0000,0x7358,0xECF4,0x0000,0x0000,
- 0x6054,0x4C5B,0x0000,0x4263,0x7359,0x735B,0x735A,0xECF5,
- 0x735C,0x0000,0x0000,0x0000,0xECF6,0x735D,0x0000,0xECF7,
- 0x735E,0x0000,0x0000,0x0000,0xECF8,0xECF9,0xECFA,0x735F,
- 0xECFB,0xECFC,0xECFD,0x0000,0x7360,0xECFE,0x7361,0x7362,
- 0xEDA1,0x7363,0x0000,0x7364,0x7365,0x7366,0x0000,0xEDA2,
-
- /* 9F00h */
- 0x0000,0x0000,0xEDA3,0xEDA4,0x0000,0x0000,0x0000,0x7367,
- 0x7368,0xEDA5,0x0000,0x0000,0x0000,0x0000,0x4524,0xEDA6,
- 0xEDA7,0xEDA8,0xEDA9,0x385D,0xEDAA,0x736A,0xEDAB,0xEDAC,
- 0x0000,0xEDAD,0xEDAE,0xEDAF,0x0000,0x0000,0x0000,0xEDB0,
- 0x414D,0x736B,0xEDB1,0x0000,0x0000,0x0000,0xEDB2,0x0000,
- 0x0000,0x0000,0xEDB3,0xEDB4,0x736C,0x0000,0x0000,0xEDB5,
- 0x0000,0xEDB6,0xEDB7,0x0000,0xEDB8,0x0000,0x0000,0xEDB9,
- 0x0000,0xEDBA,0xEDBB,0x4921,0xEDBC,0xEDBD,0x736D,0xEDBE,
- 0x0000,0xEDBF,0x0000,0xEDC0,0xEDC1,0xEDC2,0xEDC3,0xEDC4,
- 0x0000,0x0000,0x736E,0x6337,0x0000,0x0000,0x6C5A,0x706D,
- 0x0000,0x0000,0x736F,0xEDC5,0x7370,0xEDC6,0xEDC7,0xEDC8,
- 0xEDC9,0x0000,0xEDCA,0x0000,0x0000,0xEDCB,0xEDCC,0x7372,
- 0x7373,0x7374,0x4E70,0x7371,0x0000,0x0000,0x7375,0x7376,
- 0xEDCD,0xEDCE,0x7378,0x0000,0x7377,0xEDCF,0xEDD0,0xEDD1,
- 0xEDD2,0xEDD3,0x737A,0xEDD4,0x0000,0xEDD5,0x737B,0x7379,
- 0x0000,0x0000,0xEDD6,0x0000,0x0000,0xEDD7,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x4E36,0x0000,0xEDD8,
- 0xEDD9,0xEDDA,0xEDDB,0x0000,0xEDDC,0x737C,0xEDDD,0xEDDE,
- 0x0000,0x0000,0x0000,0x0000,0x737D,0x6354,0xEDDF,0x0000,
- 0x737E,0xEDE0,0xEDE1,0xEDE2,0x0000,0xEDE3,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000
-};
-static const int ucs_i_jis_table_min = 0x4E00;
-static const int ucs_i_jis_table_max = 0x4E00 + (sizeof (ucs_i_jis_table) / sizeof (unsigned short));
-
-
-static const unsigned short ucs_r_jis_table[] = {
- /* FF00h */
- 0x0000,0x212A,0x0000,0x2174,0x2170,0x2173,0x2175,0x0000,
- 0x214A,0x214B,0x2176,0x215C,0x2124,0x0000,0x2125,0x213F,
- 0x2330,0x2331,0x2332,0x2333,0x2334,0x2335,0x2336,0x2337,
- 0x2338,0x2339,0x2127,0x2128,0x2163,0x2161,0x2164,0x2129,
- 0x2177,0x2341,0x2342,0x2343,0x2344,0x2345,0x2346,0x2347,
- 0x2348,0x2349,0x234A,0x234B,0x234C,0x234D,0x234E,0x234F,
- 0x2350,0x2351,0x2352,0x2353,0x2354,0x2355,0x2356,0x2357,
- 0x2358,0x2359,0x235A,0x214E,0x2140,0x214F,0x2130,0x2132,
- 0x212E,0x2361,0x2362,0x2363,0x2364,0x2365,0x2366,0x2367,
- 0x2368,0x2369,0x236A,0x236B,0x236C,0x236D,0x236E,0x236F,
- 0x2370,0x2371,0x2372,0x2373,0x2374,0x2375,0x2376,0x2377,
- 0x2378,0x2379,0x237A,0x2150,0x2143,0x2151,0x0000,0x0000,
- 0x0000,0x00A1,0x00A2,0x00A3,0x00A4,0x00A5,0x00A6,0x00A7,
- 0x00A8,0x00A9,0x00AA,0x00AB,0x00AC,0x00AD,0x00AE,0x00AF,
- 0x00B0,0x00B1,0x00B2,0x00B3,0x00B4,0x00B5,0x00B6,0x00B7,
- 0x00B8,0x00B9,0x00BA,0x00BB,0x00BC,0x00BD,0x00BE,0x00BF,
- 0x00C0,0x00C1,0x00C2,0x00C3,0x00C4,0x00C5,0x00C6,0x00C7,
- 0x00C8,0x00C9,0x00CA,0x00CB,0x00CC,0x00CD,0x00CE,0x00CF,
- 0x00D0,0x00D1,0x00D2,0x00D3,0x00D4,0x00D5,0x00D6,0x00D7,
- 0x00D8,0x00D9,0x00DA,0x00DB,0x00DC,0x00DD,0x00DE,0x00DF,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x2131,0x0000,0x216F
-};
-static const int ucs_r_jis_table_min = 0xFF00;
-static const int ucs_r_jis_table_max = 0xFF00 + (sizeof (ucs_r_jis_table) / sizeof (unsigned short));
-
diff --git a/ext/mbstring/mbfilter_ja.h b/ext/mbstring/mbfilter_ja.h
deleted file mode 100644
index c1c2ea98c7..0000000000
--- a/ext/mbstring/mbfilter_ja.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/* charset=UTF-8 */
-
-/*
- * "streamable kanji code filter and converter"
- *
- * Copyright (c) 1998,1999,2000,2001 HappySize, Inc. All rights reserved.
- *
- * This software is released under the GNU Lesser General Public License.
- * (Version 2.1, February 1999)
- * Please read the following detail of the licence (in japanese).
- *
- * ◆使用許諾æ¡ä»¶â—†
- *
- * ã“ã®ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã¯æ ªå¼ä¼šç¤¾ãƒãƒƒãƒ”ーサイズã«ã‚ˆã£ã¦é–‹ç™ºã•ã‚Œã¾ã—ãŸã€‚æ ªå¼ä¼šç¤¾ãƒãƒƒ
- * ピーサイズã¯ã€è‘—作権法ãŠã‚ˆã³ä¸‡å›½è‘—作権æ¡ç´„ã®å®šã‚ã«ã‚ˆã‚Šã€ã“ã®ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã«é–¢
- * ã™ã‚‹ã™ã¹ã¦ã®æ¨©åˆ©ã‚’ç•™ä¿ã™ã‚‹æ¨©åˆ©ã‚’æŒã¡ã€ã“ã“ã«è¡Œä½¿ã—ã¾ã™ã€‚æ ªå¼ä¼šç¤¾ãƒãƒƒãƒ”ーサイ
- * ズã¯ä»¥ä¸‹ã«æ˜Žè¨˜ã—ãŸæ¡ä»¶ã«å¾“ã£ã¦ã€ã“ã®ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã‚’使用ã™ã‚‹æŽ’ä»–çš„ã§ã¯ãªã„権利
- * ã‚’ãŠå®¢æ§˜ã«è¨±è«¾ã—ã¾ã™ã€‚何人ãŸã‚Šã¨ã‚‚ã€ä»¥ä¸‹ã®æ¡ä»¶ã«åã—ã¦ã“ã®ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã‚’使用
- * ã™ã‚‹ã“ã¨ã¯ã§ãã¾ã›ã‚“。
- *
- * ã“ã®ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã‚’「GNU Lesser General Public License (Version 2.1, February
- * 1999)ã€ã«ç¤ºã•ã‚ŒãŸæ¡ä»¶ã§ä½¿ç”¨ã™ã‚‹ã“ã¨ã‚’ã€å…¨ã¦ã®æ–¹ã«è¨±è«¾ã—ã¾ã™ã€‚「GNU Lesser
- * General Public Licenseã€ã‚’満ãŸã•ãªã„使用ã«ã¯ã€æ ªå¼ä¼šç¤¾ãƒãƒƒãƒ”ーサイズã‹ã‚‰æ›¸é¢
- * ã«ã‚ˆã‚‹è¨±è«¾ã‚’å¾—ã‚‹å¿…è¦ãŒã‚ã‚Šã¾ã™ã€‚
- *
- * 「GNU Lesser General Public Licenseã€ã®å…¨æ–‡ã¯ä»¥ä¸‹ã®ã‚¦ã‚§ãƒ–ページã‹ã‚‰å–å¾—ã§ã
- * ã¾ã™ã€‚「GNU Lesser General Public Licenseã€ã¨ã¯ã€ã“ã‚Œã¾ã§Library General
- * Public Licenseã¨å‘¼ã°ã‚Œã¦ã„ãŸã‚‚ã®ã§ã™ã€‚
- * http://www.gnu.org/ --- GNUウェブサイト
- * http://www.gnu.org/copyleft/lesser.html --- ライセンス文é¢
- * ã“ã®ãƒ©ã‚¤ã‚»ãƒ³ã‚¹ã®å†…容ãŒã‚ã‹ã‚‰ãªã„æ–¹ã€å®ˆã‚Œãªã„æ–¹ã«ã¯ä½¿ç”¨ã‚’許諾ã—ã¾ã›ã‚“。
- *
- * ã—ã‹ã—ãªãŒã‚‰ã€å½“社ã¨GNUプロジェクトã¨ã®ç‰¹å®šã®é–¢ä¿‚を示唆ã¾ãŸã¯ä¸»å¼µã™ã‚‹ã‚‚ã®ã§
- * ã¯ã‚ã‚Šã¾ã›ã‚“。
- *
- * â—†ä¿è¨¼å†…容◆
- *
- * ã“ã®ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã¯ã€æœŸå¾…ã•ã‚ŒãŸå‹•ä½œãƒ»æ©Ÿèƒ½ãƒ»æ€§èƒ½ã‚’æŒã¤ã“ã¨ã‚’目標ã¨ã—ã¦è¨­è¨ˆã•ã‚Œ
- * 開発ã•ã‚Œã¦ã„ã¾ã™ãŒã€ã“れをä¿è¨¼ã™ã‚‹ã‚‚ã®ã§ã¯ã‚ã‚Šã¾ã›ã‚“。ã“ã®ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã¯ã€Œã“
- * ã®ã¾ã¾ã€ã®çŠ¶æ…‹ã§æä¾›ã•ã‚Œã¦ãŠã‚Šã€ãŸã¨ãˆã°ã“ã®ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã®æœ‰ç”¨æ€§ãªã„ã—特定ã®
- * 目的ã«åˆè‡´ã™ã‚‹ã“ã¨ã¨ã„ã£ãŸã€ä½•ã‚‰ã‹ã®ä¿è¨¼å†…容ãŒã€æ˜Žç¤ºã•ã‚ŒãŸã‚Šæš—é»™ã«ç¤ºã•ã‚Œã¦ã„
- * ã‚‹å ´åˆã§ã‚ã£ã¦ã‚‚ã€ãã®ä¿è¨¼ã¯ç„¡åŠ¹ã§ã™ã€‚ã“ã®ã‚½ãƒ•ãƒˆã‚¦ã‚§ã‚¢ã‚’使用ã—ãŸçµæžœãªã„ã—使
- * 用ã—ãªã‹ã£ãŸçµæžœã«ã‚ˆã£ã¦ã€ç›´æŽ¥ã‚ã‚‹ã„ã¯é–“接ã«å—ã‘ãŸèº«ä½“çš„ãªå‚·å®³ã€è²¡ç”£ä¸Šã®æ害
- * ã€ãƒ‡ãƒ¼ã‚¿ã®æ失ã‚ã‚‹ã„ã¯ãã®ä»–ã®å…¨ã¦ã®æ害ã«ã¤ã„ã¦ã¯ã€ãã®æ害ã®å¯èƒ½æ€§ãŒä½¿ç”¨è€…
- * ã€å½“社ã‚ã‚‹ã„ã¯ç¬¬ä¸‰è€…ã«ã‚ˆã£ã¦è­¦å‘Šã•ã‚Œã¦ã„ãŸå ´åˆã§ã‚ã£ã¦ã‚‚ã€å½“社ã¯ãã®æ害ã®è³ 
- * å„ŸãŠã‚ˆã³è£œå¡«ã‚’è¡Œã„ã¾ã›ã‚“。ã“ã®è¦å®šã¯ä»–ã®å…¨ã¦ã®ã€æ›¸é¢ä¸Šã¾ãŸã¯æ›¸é¢ã«ç„¡ã„ä¿è¨¼ãƒ»
- * 契約・è¦å®šã«å„ªå…ˆã—ã¾ã™ã€‚
- *
- * ◆著作権者ã®é€£çµ¡å…ˆãŠã‚ˆã³ä½¿ç”¨æ¡ä»¶ã«ã¤ã„ã¦ã®å•ã„åˆã‚ã›å…ˆâ—†
- *
- * 〒102-0073
- * æ±äº¬éƒ½åƒä»£ç”°åŒºä¹æ®µåŒ—1-13-5日本地所第一ビル4F
- * æ ªå¼ä¼šç¤¾ãƒãƒƒãƒ”ーサイズ
- * Phone: 03-3512-3655, Fax: 03-3512-3656
- * Email: sales@happysize.co.jp
- * Web: http://happysize.com/
- *
- * ◆著者◆
- *
- * 金本 茂 <sgk@happysize.co.jp>
- *
- * ◆履歴◆
- *
- * 1998/11/10 sgk implementation in C++
- * 1999/4/25 sgk Cã§æ›¸ããªãŠã—。
- * 1999/4/26 sgk 入力フィルタを実装。漢字コードを推定ã—ãªãŒã‚‰ãƒ•ã‚£ãƒ«ã‚¿ã‚’追加。
- * 1999/6/?? Unicodeサãƒãƒ¼ãƒˆã€‚
- * 1999/6/22 sgk ライセンスをLGPLã«å¤‰æ›´ã€‚
- *
- */
-
-/*
- * Unicode support
- *
- * Portions copyright (c) 1999,2000,2001 by the PHP3 internationalization team.
- * All rights reserved.
- *
- */
-
-/* $Id$ */
-
-#ifndef MBFL_MBFILTER_JA_H
-#define MBFL_MBFILTER_JA_H
-
-int mbfl_filt_conv_eucjp_wchar(int c, mbfl_convert_filter *filter);
-int mbfl_filt_conv_wchar_eucjp(int c, mbfl_convert_filter *filter);
-int mbfl_filt_conv_eucjpwin_wchar(int c, mbfl_convert_filter *filter);
-int mbfl_filt_conv_wchar_eucjpwin(int c, mbfl_convert_filter *filter);
-int mbfl_filt_conv_sjis_wchar(int c, mbfl_convert_filter *filter);
-int mbfl_filt_conv_wchar_sjis(int c, mbfl_convert_filter *filter);
-int mbfl_filt_conv_sjiswin_wchar(int c, mbfl_convert_filter *filter);
-int mbfl_filt_conv_wchar_sjiswin(int c, mbfl_convert_filter *filter);
-int mbfl_filt_conv_jis_wchar(int c, mbfl_convert_filter *filter);
-int mbfl_filt_conv_wchar_jis(int c, mbfl_convert_filter *filter);
-int mbfl_filt_conv_wchar_2022jp(int c, mbfl_convert_filter *filter);
-int mbfl_filt_conv_any_jis_flush(mbfl_convert_filter *filter);
-
-#endif /* MBFL_MBFILTER_JA_H */
diff --git a/ext/mbstring/mbstring.c b/ext/mbstring/mbstring.c
deleted file mode 100644
index 1cd74cfdc5..0000000000
--- a/ext/mbstring/mbstring.c
+++ /dev/null
@@ -1,2684 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Tsukada Takuya <tsukada@fminn.nagano.nagano.jp> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-/*
- * PHP4 Multibyte String module "mbstring" (currently only for Japanese)
- *
- * History:
- * 2000.5.19 Release php-4.0RC2_jstring-1.0
- * 2001.4.1 Release php4_jstring-1.0.91
- * 2001.4.30 Release php4_jstring-1.1 (contribute to The PHP Group)
- * 2001.5.1 Renamed from jstring to mbstring (hirokawa@php.net)
- */
-
-/*
- * PHP3 Internationalization support program.
- *
- * Copyright (c) 1999,2000 by the PHP3 internationalization team.
- * All rights reserved.
- *
- * See README_PHP3-i18n-ja for more detail.
- *
- * Authors:
- * Hironori Sato <satoh@jpnnet.com>
- * Shigeru Kanemoto <sgk@happysize.co.jp>
- * Tsukada Takuya <tsukada@fminn.nagano.nagano.jp>
- */
-
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "php_ini.h"
-#include "php_variables.h"
-#include "mbstring.h"
-#include "ext/standard/php_string.h"
-#include "ext/standard/php_mail.h"
-#include "ext/standard/url.h"
-#include "ext/standard/php_output.h"
-#include "ext/standard/info.h"
-
-#include "php_variables.h"
-#include "php_globals.h"
-#include "rfc1867.h"
-#include "php_content_types.h"
-#include "SAPI.h"
-
-#if HAVE_MBSTRING
-
-static enum mbfl_no_encoding php_mbstr_default_identify_list[] = {
- mbfl_no_encoding_ascii,
- mbfl_no_encoding_jis,
- mbfl_no_encoding_utf8,
- mbfl_no_encoding_euc_jp,
- mbfl_no_encoding_sjis
-};
-
-static int php_mbstr_default_identify_list_size = sizeof(php_mbstr_default_identify_list)/sizeof(enum mbfl_no_encoding);
-
-static unsigned char third_and_rest_force_ref[] = { 3, BYREF_NONE, BYREF_NONE, BYREF_FORCE_REST };
-
-#if defined(MBSTR_ENC_TRANS)
-SAPI_POST_HANDLER_FUNC(php_mbstr_post_handler);
-
-static sapi_post_entry mbstr_post_entries[] = {
- { DEFAULT_POST_CONTENT_TYPE, sizeof(DEFAULT_POST_CONTENT_TYPE)-1, sapi_read_standard_form_data, php_mbstr_post_handler },
- { MULTIPART_CONTENT_TYPE, sizeof(MULTIPART_CONTENT_TYPE)-1, sapi_read_standard_form_data, rfc1867_post_handler },
- { NULL, 0, NULL }
-};
-#endif
-
-function_entry mbstring_functions[] = {
- PHP_FE(mb_language, NULL)
- PHP_FE(mb_internal_encoding, NULL)
- PHP_FE(mb_http_input, NULL)
- PHP_FE(mb_http_output, NULL)
- PHP_FE(mb_detect_order, NULL)
- PHP_FE(mb_substitute_character, NULL)
- PHP_FE(mb_parse_str, second_arg_force_ref)
- PHP_FE(mb_output_handler, NULL)
- PHP_FE(mb_preferred_mime_name, NULL)
- PHP_FE(mb_strlen, NULL)
- PHP_FE(mb_strpos, NULL)
- PHP_FE(mb_strrpos, NULL)
- PHP_FE(mb_substr, NULL)
- PHP_FE(mb_strcut, NULL)
- PHP_FE(mb_strwidth, NULL)
- PHP_FE(mb_strimwidth, NULL)
- PHP_FE(mb_convert_encoding, NULL)
- PHP_FE(mb_detect_encoding, NULL)
- PHP_FE(mb_convert_kana, NULL)
- PHP_FE(mb_encode_mimeheader, NULL)
- PHP_FE(mb_decode_mimeheader, NULL)
- PHP_FE(mb_convert_variables, third_and_rest_force_ref)
- PHP_FE(mb_encode_numericentity, NULL)
- PHP_FE(mb_decode_numericentity, NULL)
- PHP_FE(mb_send_mail, NULL)
- PHP_FALIAS(mbstrlen, mb_strlen, NULL)
- PHP_FALIAS(mbstrpos, mb_strpos, NULL)
- PHP_FALIAS(mbstrrpos, mb_strrpos, NULL)
- PHP_FALIAS(mbsubstr, mb_substr, NULL)
- PHP_FALIAS(mbstrcut, mb_strcut, NULL)
- PHP_FALIAS(i18n_internal_encoding, mb_internal_encoding, NULL)
- PHP_FALIAS(i18n_http_input, mb_http_input, NULL)
- PHP_FALIAS(i18n_http_output, mb_http_output, NULL)
- PHP_FALIAS(i18n_convert, mb_convert_encoding, NULL)
- PHP_FALIAS(i18n_discover_encoding, mb_detect_encoding, NULL)
- PHP_FALIAS(i18n_mime_header_encode, mb_encode_mimeheader, NULL)
- PHP_FALIAS(i18n_mime_header_decode, mb_decode_mimeheader, NULL)
- PHP_FALIAS(i18n_ja_jp_hantozen, mb_convert_kana, NULL)
- { NULL, NULL, NULL }
-};
-
-zend_module_entry mbstring_module_entry = {
- "mbstring",
- mbstring_functions,
- PHP_MINIT(mbstring),
- PHP_MSHUTDOWN(mbstring),
- PHP_RINIT(mbstring),
- PHP_RSHUTDOWN(mbstring),
- PHP_MINFO(mbstring),
- STANDARD_MODULE_PROPERTIES
-};
-
-ZEND_DECLARE_MODULE_GLOBALS(mbstring)
-
-#ifdef COMPILE_DL_MBSTRING
-ZEND_GET_MODULE(mbstring)
-#endif
-
-
-static int
-php_mbstring_parse_encoding_list(const char *value, int value_length, int **return_list, int *return_size, int persistent)
-{
- int n, l, size, bauto, *src, *list, *entry;
- char *p, *p1, *p2, *endp, *tmpstr;
- enum mbfl_no_encoding no_encoding;
-
- list = NULL;
- if (value == NULL || value_length <= 0) {
- return 0;
- } else {
- /* copy the value string for work */
- tmpstr = (char *)estrndup(value, value_length);
- if (tmpstr == NULL) {
- return 0;
- }
- /* count the number of listed encoding names */
- endp = tmpstr + value_length;
- n = 1;
- p1 = tmpstr;
- while ((p2 = php_memnstr(p1, ",", 1, endp)) != NULL) {
- p1 = p2 + 1;
- n++;
- }
- size = n + php_mbstr_default_identify_list_size;
- /* make list */
- list = (int *)pecalloc(size, sizeof(int), persistent);
- if (list != NULL) {
- entry = list;
- n = 0;
- bauto = 0;
- p1 = tmpstr;
- do {
- p2 = p = php_memnstr(p1, ",", 1, endp);
- if (p == NULL) {
- p = endp;
- }
- *p = '\0';
- /* trim spaces */
- while (p1 < p && (*p1 == ' ' || *p1 == '\t')) {
- p1++;
- }
- p--;
- while (p > p1 && (*p == ' ' || *p == '\t')) {
- *p = '\0';
- p--;
- }
- /* convert to the encoding number and check encoding */
- no_encoding = mbfl_name2no_encoding(p1);
- if (no_encoding == mbfl_no_encoding_auto) {
- if (!bauto) {
- bauto = 1;
- l = php_mbstr_default_identify_list_size;
- src = php_mbstr_default_identify_list;
- while (l > 0) {
- *entry++ = *src++;
- l--;
- n++;
- }
- }
- } else if (no_encoding != mbfl_no_encoding_invalid) {
- *entry++ = no_encoding;
- n++;
- }
- p1 = p2 + 1;
- } while (n < size && p2 != NULL);
- *return_list = list;
- *return_size = n;
- }
- efree(tmpstr);
- }
-
- if (list == NULL) {
- return 0;
- }
-
- return 1;
-}
-
-static int
-php_mbstring_parse_encoding_array(zval *array, int **return_list, int *return_size, int persistent)
-{
- zval **hash_entry;
- HashTable *target_hash;
- int i, n, l, size, bauto, *list, *entry, *src;
- enum mbfl_no_encoding no_encoding;
-
- list = NULL;
- if (Z_TYPE_P(array) == IS_ARRAY) {
- target_hash = array->value.ht;
- zend_hash_internal_pointer_reset(target_hash);
- i = zend_hash_num_elements(target_hash);
- size = i + php_mbstr_default_identify_list_size;
- list = (int *)pecalloc(size, sizeof(int), persistent);
- if (list != NULL) {
- entry = list;
- bauto = 0;
- n = 0;
- while (i > 0) {
- if (zend_hash_get_current_data(target_hash, (void **) &hash_entry) == FAILURE) {
- break;
- }
- convert_to_string_ex(hash_entry);
- no_encoding = mbfl_name2no_encoding(Z_STRVAL_PP(hash_entry));
- if (no_encoding == mbfl_no_encoding_auto) {
- if (!bauto) {
- bauto = 1;
- l = php_mbstr_default_identify_list_size;
- src = php_mbstr_default_identify_list;
- while (l > 0) {
- *entry++ = *src++;
- l--;
- n++;
- }
- }
- } else if (no_encoding != mbfl_no_encoding_invalid) {
- *entry++ = no_encoding;
- n++;
- }
- zend_hash_move_forward(target_hash);
- i--;
- }
- *return_list = list;
- *return_size = n;
- }
- }
-
- if (list == NULL) {
- return 0;
- }
-
- return 1;
-}
-
-
-/* php.ini directive handler */
-static PHP_INI_MH(OnUpdate_mbstring_detect_order)
-{
- int *list, size;
- MBSTRLS_FETCH();
-
- if (php_mbstring_parse_encoding_list(new_value, new_value_length, &list, &size, 1)) {
- if (MBSTRG(detect_order_list) != NULL) {
- free(MBSTRG(detect_order_list));
- }
- MBSTRG(detect_order_list) = list;
- MBSTRG(detect_order_list_size) = size;
- } else {
- return FAILURE;
- }
-
- return SUCCESS;
-}
-
-static PHP_INI_MH(OnUpdate_mbstring_http_input)
-{
- int *list, size;
- MBSTRLS_FETCH();
-
- if (php_mbstring_parse_encoding_list(new_value, new_value_length, &list, &size, 1)) {
- if (MBSTRG(http_input_list) != NULL) {
- free(MBSTRG(http_input_list));
- }
- MBSTRG(http_input_list) = list;
- MBSTRG(http_input_list_size) = size;
- } else {
- return FAILURE;
- }
-
- return SUCCESS;
-}
-
-static PHP_INI_MH(OnUpdate_mbstring_http_output)
-{
- enum mbfl_no_encoding no_encoding;
- MBSTRLS_FETCH();
-
- no_encoding = mbfl_name2no_encoding(new_value);
- if (no_encoding != mbfl_no_encoding_invalid) {
- MBSTRG(http_output_encoding) = no_encoding;
- MBSTRG(current_http_output_encoding) = no_encoding;
- } else {
- if (new_value != NULL && new_value_length > 0) {
- return FAILURE;
- }
- }
-
- return SUCCESS;
-}
-
-static PHP_INI_MH(OnUpdate_mbstring_internal_encoding)
-{
- enum mbfl_no_encoding no_encoding;
- MBSTRLS_FETCH();
-
- no_encoding = mbfl_name2no_encoding(new_value);
- if (no_encoding != mbfl_no_encoding_invalid) {
- MBSTRG(internal_encoding) = no_encoding;
- MBSTRG(current_internal_encoding) = no_encoding;
- } else {
- if (new_value != NULL && new_value_length > 0) {
- return FAILURE;
- }
- }
-
- return SUCCESS;
-}
-
-static PHP_INI_MH(OnUpdate_mbstring_substitute_character)
-{
- MBSTRLS_FETCH();
-
- if (new_value != NULL) {
- if (strcasecmp("none", new_value) == 0) {
- MBSTRG(filter_illegal_mode) = MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE;
- } else if (strcasecmp("long", new_value) == 0) {
- MBSTRG(filter_illegal_mode) = MBFL_OUTPUTFILTER_ILLEGAL_MODE_LONG;
- } else {
- MBSTRG(filter_illegal_mode) = MBFL_OUTPUTFILTER_ILLEGAL_MODE_CHAR;
- MBSTRG(filter_illegal_substchar) = zend_atoi(new_value, new_value_length);
- }
- }
-
- return SUCCESS;
-}
-
-/* php.ini directive registration */
-PHP_INI_BEGIN()
- PHP_INI_ENTRY("mbstring.detect_order", NULL, PHP_INI_ALL, OnUpdate_mbstring_detect_order)
- PHP_INI_ENTRY("mbstring.http_input", NULL, PHP_INI_ALL, OnUpdate_mbstring_http_input)
- PHP_INI_ENTRY("mbstring.http_output", NULL, PHP_INI_ALL, OnUpdate_mbstring_http_output)
- PHP_INI_ENTRY("mbstring.internal_encoding", NULL, PHP_INI_ALL, OnUpdate_mbstring_internal_encoding)
- PHP_INI_ENTRY("mbstring.substitute_character", NULL, PHP_INI_ALL, OnUpdate_mbstring_substitute_character)
-PHP_INI_END()
-
-
-/* module global initialize handler */
-static void
-php_mbstring_init_globals(zend_mbstring_globals *pglobals)
-{
- pglobals->language = mbfl_no_language_japanese;
- pglobals->current_language = mbfl_no_language_japanese;
- pglobals->internal_encoding = mbfl_no_encoding_euc_jp;
- pglobals->current_internal_encoding = mbfl_no_encoding_euc_jp;
- pglobals->http_output_encoding = mbfl_no_encoding_invalid;
- pglobals->current_http_output_encoding = mbfl_no_encoding_invalid;
- pglobals->http_input_identify = mbfl_no_encoding_invalid;
- pglobals->http_input_identify_get = mbfl_no_encoding_invalid;
- pglobals->http_input_identify_post = mbfl_no_encoding_invalid;
- pglobals->http_input_identify_cookie = mbfl_no_encoding_invalid;
- pglobals->http_input_identify_string = mbfl_no_encoding_invalid;
- pglobals->http_input_list = NULL;
- pglobals->http_input_list_size = 0;
- pglobals->detect_order_list = NULL;
- pglobals->detect_order_list_size = 0;
- pglobals->current_detect_order_list = NULL;
- pglobals->current_detect_order_list_size = 0;
- pglobals->filter_illegal_mode = MBFL_OUTPUTFILTER_ILLEGAL_MODE_CHAR;
- pglobals->filter_illegal_substchar = 0x3f; /* '?' */
- pglobals->current_filter_illegal_mode = MBFL_OUTPUTFILTER_ILLEGAL_MODE_CHAR;
- pglobals->current_filter_illegal_substchar = 0x3f; /* '?' */
- pglobals->outconv = NULL;
-}
-
-PHP_MINIT_FUNCTION(mbstring)
-{
- ZEND_INIT_MODULE_GLOBALS(mbstring, php_mbstring_init_globals, NULL);
- REGISTER_INI_ENTRIES();
-
-#if defined(MBSTR_ENC_TRANS)
- sapi_unregister_post_entry(mbstr_post_entries);
- sapi_register_post_entries(mbstr_post_entries);
-#endif
-
- return SUCCESS;
-}
-
-
-PHP_MSHUTDOWN_FUNCTION(mbstring)
-{
- MBSTRLS_FETCH();
- UNREGISTER_INI_ENTRIES();
-
- if (MBSTRG(http_input_list)) {
- free(MBSTRG(http_input_list));
- }
- if (MBSTRG(detect_order_list)) {
- free(MBSTRG(detect_order_list));
- }
-
- return SUCCESS;
-}
-
-
-PHP_RINIT_FUNCTION(mbstring)
-{
- int n, *list, *entry;
- MBSTRLS_FETCH();
-
- MBSTRG(current_language) = MBSTRG(language);
- MBSTRG(current_internal_encoding) = MBSTRG(internal_encoding);
- MBSTRG(current_http_output_encoding) = MBSTRG(http_output_encoding);
- MBSTRG(current_filter_illegal_mode) = MBSTRG(filter_illegal_mode);
- MBSTRG(current_filter_illegal_substchar) = MBSTRG(filter_illegal_substchar);
-
- n = 0;
- if (MBSTRG(detect_order_list)) {
- list = MBSTRG(detect_order_list);
- n = MBSTRG(detect_order_list_size);
- }
- if (n <= 0) {
- list = php_mbstr_default_identify_list;
- n = php_mbstr_default_identify_list_size;
- }
- entry = (int *)emalloc(n*sizeof(int));
- if (entry != NULL) {
- MBSTRG(current_detect_order_list) = entry;
- MBSTRG(current_detect_order_list_size) = n;
- while (n > 0) {
- *entry++ = *list++;
- n--;
- }
- }
-
- return SUCCESS;
-}
-
-
-PHP_RSHUTDOWN_FUNCTION(mbstring)
-{
- MBSTRLS_FETCH();
-
- if (MBSTRG(current_detect_order_list) != NULL) {
- efree(MBSTRG(current_detect_order_list));
- MBSTRG(current_detect_order_list) = NULL;
- MBSTRG(current_detect_order_list_size) = 0;
- }
- if (MBSTRG(outconv) != NULL) {
- mbfl_buffer_converter_delete(MBSTRG(outconv));
- MBSTRG(outconv) = NULL;
- }
-
- /* clear http input identification. */
- MBSTRG(http_input_identify) = mbfl_no_encoding_invalid;
- MBSTRG(http_input_identify_post) = mbfl_no_encoding_invalid;
- MBSTRG(http_input_identify_get) = mbfl_no_encoding_invalid;
- MBSTRG(http_input_identify_cookie) = mbfl_no_encoding_invalid;
- MBSTRG(http_input_identify_string) = mbfl_no_encoding_invalid;
-
- return SUCCESS;
-}
-
-
-PHP_MINFO_FUNCTION(mbstring)
-{
- php_info_print_table_start();
- php_info_print_table_header(2, "Multibyte (Japanese) Support", "enabled");
-#if defined(MBSTR_ENC_TRANS)
- php_info_print_table_row(2, "http input encoding translation", "enabled");
-#endif
- php_info_print_table_end();
-
- DISPLAY_INI_ENTRIES();
-}
-
-
-
-/* {{{ proto string mb_language([string language])
- Sets the current language or Returns the current language as a string. */
-PHP_FUNCTION(mb_language)
-{
- pval **arg1;
- char *name;
- enum mbfl_no_language no_language;
- MBSTRLS_FETCH();
-
- if (ZEND_NUM_ARGS() == 0) {
- name = (char *)mbfl_no_language2name(MBSTRG(current_language));
- if (name != NULL) {
- RETURN_STRING(name, 1);
- } else {
- RETURN_FALSE;
- }
- } else if (ZEND_NUM_ARGS() == 1 && zend_get_parameters_ex(1, &arg1) != FAILURE) {
- convert_to_string_ex(arg1);
- no_language = mbfl_name2no_language(Z_STRVAL_PP(arg1));
- if (no_language == mbfl_no_language_invalid) {
- php_error(E_WARNING, "unknown language \"%s\"", Z_STRVAL_PP(arg1));
- RETURN_FALSE;
- } else {
- MBSTRG(current_language) = no_language;
- RETURN_TRUE;
- }
- } else {
- WRONG_PARAM_COUNT;
- }
-}
-/* }}} */
-
-
-
-/* {{{ proto string mb_internal_encoding([string encoding])
- Sets the current internal encoding or Returns the current internal encoding as a string. */
-PHP_FUNCTION(mb_internal_encoding)
-{
- pval **arg1;
- char *name;
- enum mbfl_no_encoding no_encoding;
- MBSTRLS_FETCH();
-
- if (ZEND_NUM_ARGS() == 0) {
- name = (char *)mbfl_no_encoding2name(MBSTRG(current_internal_encoding));
- if (name != NULL) {
- RETURN_STRING(name, 1);
- } else {
- RETURN_FALSE;
- }
- } else if (ZEND_NUM_ARGS() == 1 && zend_get_parameters_ex(1, &arg1) != FAILURE) {
- convert_to_string_ex(arg1);
- no_encoding = mbfl_name2no_encoding(Z_STRVAL_PP(arg1));
- if (no_encoding == mbfl_no_encoding_invalid) {
- php_error(E_WARNING, "unknown encoding \"%s\"", Z_STRVAL_PP(arg1));
- RETURN_FALSE;
- } else {
- MBSTRG(current_internal_encoding) = no_encoding;
- RETURN_TRUE;
- }
- } else {
- WRONG_PARAM_COUNT;
- }
-}
-/* }}} */
-
-
-/* {{{ proto string mb_http_input([string type])
- Returns the input encoding. */
-PHP_FUNCTION(mb_http_input)
-{
- pval **arg1;
- int result, retname, n, *entry;
- char *name;
- MBSTRLS_FETCH();
-
- retname = 1;
- if (ZEND_NUM_ARGS() == 0) {
- result = MBSTRG(http_input_identify);
- } else if (ARG_COUNT(ht) == 1 && zend_get_parameters_ex(1, &arg1) != FAILURE) {
- convert_to_string_ex(arg1);
- switch (*(Z_STRVAL_PP(arg1))) {
- case 'G':
- case 'g':
- result = MBSTRG(http_input_identify_get);
- break;
- case 'P':
- case 'p':
- result = MBSTRG(http_input_identify_post);
- break;
- case 'C':
- case 'c':
- result = MBSTRG(http_input_identify_cookie);
- break;
- case 'S':
- case 's':
- result = MBSTRG(http_input_identify_string);
- break;
- case 'I':
- case 'i':
- if (array_init(return_value) == FAILURE) {
- RETURN_FALSE;
- }
- entry = MBSTRG(http_input_list);
- n = MBSTRG(http_input_list_size);
- while (n > 0) {
- name = (char *)mbfl_no_encoding2name(*entry);
- if (name) {
- add_next_index_string(return_value, name, 1);
- }
- entry++;
- n--;
- }
- retname = 0;
- break;
- default:
- result = MBSTRG(http_input_identify);
- break;
- }
- } else {
- WRONG_PARAM_COUNT;
- }
-
- if (retname) {
- name = (char *)mbfl_no_encoding2name(result);
- if (name != NULL) {
- RETVAL_STRING(name, 1);
- } else {
- RETVAL_FALSE;
- }
- }
-}
-/* }}} */
-
-
-/* {{{ proto string mb_http_output([string encoding])
- Sets the current output_encoding or Returns the current output_encoding as a string. */
-PHP_FUNCTION(mb_http_output)
-{
- pval **arg1;
- char *name;
- enum mbfl_no_encoding no_encoding;
- MBSTRLS_FETCH();
-
- if (ZEND_NUM_ARGS() == 0) {
- name = (char *)mbfl_no_encoding2name(MBSTRG(current_http_output_encoding));
- if (name != NULL) {
- RETURN_STRING(name, 1);
- } else {
- RETURN_FALSE;
- }
- } else if (ZEND_NUM_ARGS() == 1 && zend_get_parameters_ex(1, &arg1) != FAILURE) {
- convert_to_string_ex(arg1);
- no_encoding = mbfl_name2no_encoding(Z_STRVAL_PP(arg1));
- if (no_encoding == mbfl_no_encoding_invalid) {
- php_error(E_WARNING, "unknown encoding \"%s\"", Z_STRVAL_PP(arg1));
- RETURN_FALSE;
- } else {
- MBSTRG(current_http_output_encoding) = no_encoding;
- RETURN_TRUE;
- }
- } else {
- WRONG_PARAM_COUNT;
- }
-}
-/* }}} */
-
-
-/* {{{ proto array mb_detect_order([mixed encoding-list])
- Sets the current detect_order or Return the current detect_order as a array. */
-PHP_FUNCTION(mb_detect_order)
-{
- pval **arg1;
- int n, size, *list, *entry;
- char *name;
- MBSTRLS_FETCH();
-
- if (ZEND_NUM_ARGS() == 0) {
- if (array_init(return_value) == FAILURE) {
- RETURN_FALSE;
- }
- entry = MBSTRG(current_detect_order_list);
- n = MBSTRG(current_detect_order_list_size);
- while (n > 0) {
- name = (char *)mbfl_no_encoding2name(*entry);
- if (name) {
- add_next_index_string(return_value, name, 1);
- }
- entry++;
- n--;
- }
- } else if (ZEND_NUM_ARGS() == 1 && zend_get_parameters_ex(1, &arg1) != FAILURE) {
- list = NULL;
- size = 0;
- switch (Z_TYPE_PP(arg1)) {
- case IS_ARRAY:
- php_mbstring_parse_encoding_array(*arg1, &list, &size, 0);
- break;
- default:
- convert_to_string_ex(arg1);
- php_mbstring_parse_encoding_list(Z_STRVAL_PP(arg1), Z_STRLEN_PP(arg1), &list, &size, 0);
- break;
- }
- if (list == NULL) {
- RETVAL_FALSE;
- } else {
- if (MBSTRG(current_detect_order_list)) {
- efree(MBSTRG(current_detect_order_list));
- }
- MBSTRG(current_detect_order_list) = list;
- MBSTRG(current_detect_order_list_size) = size;
- RETVAL_TRUE;
- }
- } else {
- WRONG_PARAM_COUNT;
- }
-}
-/* }}} */
-
-
-/* {{{ proto mixed mb_substitute_character([mixed substchar])
- Sets the current substitute_character or Returns the current substitute_character. */
-PHP_FUNCTION(mb_substitute_character)
-{
- pval **arg1;
- MBSTRLS_FETCH();
-
- if (ZEND_NUM_ARGS() == 0) {
- if (MBSTRG(current_filter_illegal_mode) == MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) {
- RETVAL_STRING("none", 1);
- } else if(MBSTRG(current_filter_illegal_mode) == MBFL_OUTPUTFILTER_ILLEGAL_MODE_LONG) {
- RETVAL_STRING("long", 1);
- } else {
- RETVAL_LONG(MBSTRG(current_filter_illegal_substchar));
- }
- } else if (ZEND_NUM_ARGS() == 1 && zend_get_parameters_ex(1, &arg1) != FAILURE) {
- switch (Z_TYPE_PP(arg1)) {
- case IS_STRING:
- if (strcasecmp("none", Z_STRVAL_PP(arg1)) == 0) {
- MBSTRG(current_filter_illegal_mode) = MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE;
- } else if (strcasecmp("long", Z_STRVAL_PP(arg1)) == 0) {
- MBSTRG(current_filter_illegal_mode) = MBFL_OUTPUTFILTER_ILLEGAL_MODE_LONG;
- } else {
- convert_to_long_ex(arg1);
- MBSTRG(current_filter_illegal_mode) = MBFL_OUTPUTFILTER_ILLEGAL_MODE_CHAR;
- MBSTRG(current_filter_illegal_substchar) = Z_LVAL_PP(arg1);
- }
- break;
- default:
- convert_to_long_ex(arg1);
- MBSTRG(current_filter_illegal_mode) = MBFL_OUTPUTFILTER_ILLEGAL_MODE_CHAR;
- MBSTRG(current_filter_illegal_substchar) = Z_LVAL_PP(arg1);
- break;
- }
- RETVAL_TRUE;
- } else {
- WRONG_PARAM_COUNT;
- }
-}
-/* }}} */
-
-
-/* {{{ proto string mb_preferred_mime_name(string encoding)
- Return the preferred MIME name (charset) as a string. */
-PHP_FUNCTION(mb_preferred_mime_name)
-{
- pval **arg1;
- enum mbfl_no_encoding no_encoding;
- const char *name;
- MBSTRLS_FETCH();
-
- if (ZEND_NUM_ARGS() == 1 && zend_get_parameters_ex(1, &arg1) != FAILURE) {
- convert_to_string_ex(arg1);
- no_encoding = mbfl_name2no_encoding(Z_STRVAL_PP(arg1));
- if (no_encoding == mbfl_no_encoding_invalid) {
- php_error(E_WARNING, "unknown encoding \"%s\"", Z_STRVAL_PP(arg1));
- RETVAL_FALSE;
- } else {
- name = mbfl_no2preferred_mime_name(no_encoding);
- if (name == NULL || *name == '\0') {
- php_error(E_WARNING, "no name for \"%s\"", Z_STRVAL_PP(arg1));
- RETVAL_FALSE;
- } else {
- RETVAL_STRING((char *)name, 1);
- }
- }
- } else {
- WRONG_PARAM_COUNT;
- }
-}
-/* }}} */
-
-#if defined(MBSTR_ENC_TRANS)
-static void
-php_mbstr_encoding_handler(zval *arg, char *res, char *separator) {
-
- char *var, *val;
- char *strtok_buf = NULL, **val_list;
- zval *array_ptr = (zval *) arg;
- int n, num, *len_list, *elist, elistsz;
- enum mbfl_no_encoding from_encoding, to_encoding;
- mbfl_string string, result, *ret;
- mbfl_encoding_detector *identd;
- mbfl_buffer_converter *convd;
- MBSTRLS_FETCH();
- ELS_FETCH();
- PLS_FETCH();
-
- mbfl_string_init(&string);
- mbfl_string_init(&result);
- string.no_language = MBSTRG(current_language);
- string.no_encoding = MBSTRG(current_internal_encoding);
-
- /* count the variables contained in the query */
- num = 1;
- var = res;
- n = strlen(res);
- while(n > 0) {
- if (*var == *separator) {
- num++;
- }
- var++;
- n--;
- }
- num *= 2;
- val_list = (char **)ecalloc(num, sizeof(char *));
- len_list = (int *)ecalloc(num, sizeof(int));
-
- /* split and decode the query */
- n = 0;
- strtok_buf = NULL;
- var = php_strtok_r(res, separator, &strtok_buf);
-
- while (var && n < num) {
- val = strchr(var, '=');
- if (val) { /* have a value */
- *val++ = '\0';
- val_list[n] = var;
- len_list[n] = php_url_decode(var, strlen(var));
- n++;
- val_list[n] = val;
- len_list[n] = php_url_decode(val, strlen(val));
- } else {
- val_list[n] = var;
- len_list[n] = php_url_decode(var, strlen(var));
- n++;
- val_list[n] = NULL;
- len_list[n] = 0;
- }
- n++;
- var = php_strtok_r(NULL, separator, &strtok_buf);
- }
- num = n;
-
- /* initialize converter */
- to_encoding = MBSTRG(current_internal_encoding);
- elist = MBSTRG(http_input_list);
- elistsz = MBSTRG(http_input_list_size);
- if (elistsz <= 0) {
- from_encoding = mbfl_no_encoding_pass;
- } else if (elistsz == 1) {
- from_encoding = *elist;
- } else {
- /* auto detect */
- from_encoding = mbfl_no_encoding_invalid;
- identd = mbfl_encoding_detector_new(elist, elistsz);
- if (identd) {
- n = 0;
- while (n < num) {
- string.val = val_list[n];
- string.len = len_list[n];
- if (mbfl_encoding_detector_feed(identd, &string)) {
- break;
- }
- n++;
- }
- from_encoding = mbfl_encoding_detector_judge(identd);
- mbfl_encoding_detector_delete(identd);
- }
- if (from_encoding == mbfl_no_encoding_invalid) {
- from_encoding = mbfl_no_encoding_pass;
- }
- }
- convd = NULL;
- if (from_encoding != mbfl_no_encoding_pass) {
- convd = mbfl_buffer_converter_new(from_encoding, to_encoding, 0);
- if (convd != NULL) {
- mbfl_buffer_converter_illegal_mode(convd, MBSTRG(current_filter_illegal_mode));
- mbfl_buffer_converter_illegal_substchar(convd, MBSTRG(current_filter_illegal_substchar));
- } else {
- php_error(E_WARNING, "Unable to create converter in php_mb_encoding_handler()");
- }
- }
-
- /* convert encoding */
- string.no_encoding = from_encoding;
- n = 0;
- while (n < num) {
- string.val = val_list[n+1];
- string.len = len_list[n+1];
- ret = NULL;
- if (convd) {
- ret = mbfl_buffer_converter_feed_result(convd, &string, &result);
- }
- if (ret != NULL) {
- php_register_variable_safe(val_list[n], ret->val, ret->len, array_ptr ELS_CC PLS_CC);
- efree(ret->val);
- } else {
- php_register_variable_safe(val_list[n], val_list[n+1], len_list[n+1], array_ptr ELS_CC PLS_CC);
- }
- n+=2;
- }
- MBSTRG(http_input_identify) = from_encoding;
-
- if (convd != NULL) {
- mbfl_buffer_converter_delete(convd);
- }
- if (val_list != NULL) {
- efree((void *)val_list);
- }
- if (len_list != NULL) {
- efree((void *)len_list);
- }
-
-}
-
-SAPI_POST_HANDLER_FUNC(php_mbstr_post_handler)
-{
- MBSTRLS_FETCH();
-
- MBSTRG(http_input_identify_post) = mbfl_no_encoding_invalid;
-
- php_mbstr_encoding_handler(arg, SG(request_info).post_data, "&");
-
- if (MBSTRG(http_input_identify) != mbfl_no_encoding_invalid) {
- MBSTRG(http_input_identify_post) = MBSTRG(http_input_identify);
- }
-}
-
-/* http input processing */
-void mbstr_treat_data(int arg, char *str, zval* destArray ELS_DC PLS_DC SLS_DC)
-{
- char *res = NULL, *var, *val, *separator=NULL;
- const char *c_var;
- pval *array_ptr;
- int free_buffer=0;
- MBSTRLS_FETCH();
-
- switch (arg) {
- case PARSE_POST:
- case PARSE_GET:
- case PARSE_COOKIE:
- ALLOC_ZVAL(array_ptr);
- array_init(array_ptr);
- INIT_PZVAL(array_ptr);
- switch (arg) {
- case PARSE_POST:
- PG(http_globals)[TRACK_VARS_POST] = array_ptr;
- break;
- case PARSE_GET:
- PG(http_globals)[TRACK_VARS_GET] = array_ptr;
- break;
- case PARSE_COOKIE:
- PG(http_globals)[TRACK_VARS_COOKIE] = array_ptr;
- break;
- }
- break;
- default:
- array_ptr=destArray;
- break;
- }
-
- if (arg==PARSE_POST) {
- sapi_handle_post(array_ptr SLS_CC);
- return;
- }
-
- if (arg == PARSE_GET) { /* GET data */
- c_var = SG(request_info).query_string;
- if (c_var && *c_var) {
- res = (char *) estrdup(c_var);
- free_buffer = 1;
- } else {
- free_buffer = 0;
- }
- } else if (arg == PARSE_COOKIE) { /* Cookie data */
- c_var = SG(request_info).cookie_data;
- if (c_var && *c_var) {
- res = (char *) estrdup(c_var);
- free_buffer = 1;
- } else {
- free_buffer = 0;
- }
- } else if (arg == PARSE_STRING) { /* String data */
- res = str;
- free_buffer = 1;
- }
-
- if (!res) {
- return;
- }
-
- switch (arg) {
- case PARSE_POST:
- case PARSE_GET:
- case PARSE_STRING:
- separator = (char *) estrdup(PG(arg_separator).input);
- break;
- case PARSE_COOKIE:
- separator = ";\0";
- break;
- }
-
- switch(arg) {
- case PARSE_POST:
- MBSTRG(http_input_identify_post) = mbfl_no_encoding_invalid;
- break;
- case PARSE_GET:
- MBSTRG(http_input_identify_get) = mbfl_no_encoding_invalid;
- break;
- case PARSE_COOKIE:
- MBSTRG(http_input_identify_cookie) = mbfl_no_encoding_invalid;
- break;
- case PARSE_STRING:
- MBSTRG(http_input_identify_string) = mbfl_no_encoding_invalid;
- break;
- }
-
- php_mbstr_encoding_handler(array_ptr, res, separator);
-
- if (MBSTRG(http_input_identify) != mbfl_no_encoding_invalid) {
- switch(arg){
- case PARSE_POST:
- MBSTRG(http_input_identify_post) = MBSTRG(http_input_identify);
- break;
- case PARSE_GET:
- MBSTRG(http_input_identify_get) = MBSTRG(http_input_identify);
- break;
- case PARSE_COOKIE:
- MBSTRG(http_input_identify_cookie) = MBSTRG(http_input_identify);
- break;
- case PARSE_STRING:
- MBSTRG(http_input_identify_string) = MBSTRG(http_input_identify);
- break;
- }
- }
-
- if(arg != PARSE_COOKIE) {
- efree(separator);
- }
-
- if (free_buffer) {
- efree(res);
- }
-}
-#endif
-
-/* {{{ proto bool mb_parse_str(string encoded_string, [array result])
- Parses GET/POST/COOKIE data and sets global variables */
-PHP_FUNCTION(mb_parse_str)
-{
- pval **arg_str, **arg_array, *track_vars_array;
- char *var, *val, *encstr, *strtok_buf, **str_list, *separator;
- int n, num, val_len, *len_list, *elist, elistsz, old_rg, argc;
- enum mbfl_no_encoding from_encoding, to_encoding;
- mbfl_string string, resvar, resval;
- mbfl_encoding_detector *identd;
- mbfl_buffer_converter *convd;
- PLS_FETCH();
- MBSTRLS_FETCH();
-
- track_vars_array = NULL;
- argc = ZEND_NUM_ARGS();
- if (argc == 1) {
- if (zend_get_parameters_ex(1, &arg_str) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- } else if (argc == 2) {
- if (zend_get_parameters_ex(2, &arg_str, &arg_array) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- /* Clear out the array */
- zval_dtor(*arg_array);
- array_init(*arg_array);
- track_vars_array = *arg_array;
- } else {
- WRONG_PARAM_COUNT;
- }
- separator = (char *)estrdup(PG(arg_separator).input);
- if (separator == NULL) {
- RETURN_FALSE;
- }
- convert_to_string_ex(arg_str);
- encstr = estrndup(Z_STRVAL_PP(arg_str), Z_STRLEN_PP(arg_str));
- if (encstr == NULL) {
- efree((void *)separator);
- RETURN_FALSE;
- }
- mbfl_string_init_set(&string, MBSTRG(current_language), MBSTRG(current_internal_encoding));
- mbfl_string_init_set(&resvar, MBSTRG(current_language), MBSTRG(current_internal_encoding));
- mbfl_string_init_set(&resval, MBSTRG(current_language), MBSTRG(current_internal_encoding));
-
- /* count the variables contained in the query */
- num = 1;
- var = encstr;
- n = Z_STRLEN_PP(arg_str);
- while (n > 0) {
- if (*var == *separator) {
- num++;
- }
- var++;
- n--;
- }
- num *= 2;
- str_list = (char **)ecalloc(num, sizeof(char *));
- if (str_list == NULL) {
- efree((void *)separator);
- efree((void *)encstr);
- RETURN_FALSE;
- }
- len_list = (int *)ecalloc(num, sizeof(int));
- if (len_list == NULL) {
- efree((void *)separator);
- efree((void *)encstr);
- efree((void *)str_list);
- RETURN_FALSE;
- }
-
- /* split and decode the query */
- n = 0;
- strtok_buf = NULL;
- var = php_strtok_r(encstr, separator, &strtok_buf);
- while (var && n < num) {
- val = strchr(var, '=');
- if (val) { /* have a value */
- *val++ = '\0';
- str_list[n] = var;
- len_list[n] = php_url_decode(var, strlen(var));
- n++;
- str_list[n] = val;
- len_list[n] = php_url_decode(val, strlen(val));
- } else {
- str_list[n] = var;
- len_list[n] = php_url_decode(var, strlen(var));
- n++;
- str_list[n] = NULL;
- len_list[n] = 0;
- }
- n++;
- var = php_strtok_r(NULL, separator, &strtok_buf);
- }
- num = n;
-
- /* initialize converter */
- to_encoding = MBSTRG(current_internal_encoding);
- elist = MBSTRG(http_input_list);
- elistsz = MBSTRG(http_input_list_size);
- if (elistsz <= 0) {
- from_encoding = mbfl_no_encoding_pass;
- } else if (elistsz == 1) {
- from_encoding = *elist;
- } else {
- /* auto detect */
- from_encoding = mbfl_no_encoding_invalid;
- identd = mbfl_encoding_detector_new(elist, elistsz);
- if (identd != NULL) {
- n = 0;
- while (n < num) {
- string.val = str_list[n];
- string.len = len_list[n];
- if (mbfl_encoding_detector_feed(identd, &string)) {
- break;
- }
- n++;
- }
- from_encoding = mbfl_encoding_detector_judge(identd);
- mbfl_encoding_detector_delete(identd);
- }
- if (from_encoding == mbfl_no_encoding_invalid) {
- php_error(E_WARNING, "Unable to detect encoding in mb_parse_str()");
- from_encoding = mbfl_no_encoding_pass;
- }
- }
- convd = NULL;
- if (from_encoding != mbfl_no_encoding_pass) {
- convd = mbfl_buffer_converter_new(from_encoding, to_encoding, 0);
- if (convd != NULL) {
- mbfl_buffer_converter_illegal_mode(convd, MBSTRG(current_filter_illegal_mode));
- mbfl_buffer_converter_illegal_substchar(convd, MBSTRG(current_filter_illegal_substchar));
- } else {
- php_error(E_WARNING, "Unable to create converter in mb_parse_str()");
- }
- }
-
- /* convert encoding */
- string.no_encoding = from_encoding;
- old_rg = PG(register_globals);
- if(argc == 1) {
- PG(register_globals) = 1;
- } else {
- PG(register_globals) = 0;
- }
- n = 0;
- while (n < num) {
- /* convert variable name */
- string.val = str_list[n];
- string.len = len_list[n];
- if (convd != NULL && mbfl_buffer_converter_feed_result(convd, &string, &resvar) != NULL) {
- var = resvar.val;
- } else {
- var = str_list[n];
- }
- n++;
- /* convert value */
- string.val = str_list[n];
- string.len = len_list[n];
- if (convd != NULL && mbfl_buffer_converter_feed_result(convd, &string, &resval) != NULL) {
- val = resval.val;
- val_len = resval.len;
- } else {
- val = str_list[n];
- val_len = len_list[n];
- }
- n++;
- /* add variable to symbol table */
- php_register_variable_safe(var, val, val_len, track_vars_array ELS_CC PLS_CC);
- mbfl_string_clear(&resvar);
- mbfl_string_clear(&resval);
- }
- PG(register_globals) = old_rg;
-
- if (convd != NULL) {
- mbfl_buffer_converter_delete(convd);
- }
- efree((void *)str_list);
- efree((void *)len_list);
- efree((void *)encstr);
- efree((void *)separator);
- MBSTRG(http_input_identify) = from_encoding;
- MBSTRG(http_input_identify_string) = from_encoding;
- RETURN_TRUE;
-}
-/* }}} */
-
-
-
-/* {{{ proto string mb_output_handler(string contents, int status)
- Returns string in output buffer converted to the http_output encoding */
-PHP_FUNCTION(mb_output_handler)
-{
- pval **arg_string, **arg_status;
- mbfl_string string, result, *ret;
- const char *mimetype, *charset;
- mbfl_memory_device device;
- SLS_FETCH();
- MBSTRLS_FETCH();
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg_string, &arg_status) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(arg_string);
- convert_to_long_ex(arg_status);
-
- if ( SG(sapi_headers).send_default_content_type && ! SG(headers_sent) &&
- MBSTRG(current_http_output_encoding) != mbfl_no_encoding_pass &&
- (Z_LVAL_PP(arg_status) & PHP_OUTPUT_HANDLER_START) != 0) {
- mimetype = SG(default_mimetype) ? SG(default_mimetype) : SAPI_DEFAULT_MIMETYPE;
- charset = mbfl_no2preferred_mime_name(MBSTRG(current_http_output_encoding));
- if ( charset != NULL && (*mimetype == '\0' || strncasecmp(mimetype, "text/", 5) == 0) ) {
- mbfl_memory_device_init(&device, 0, 0);
- mbfl_memory_device_strcat(&device, "Content-Type: ");
- if (*mimetype == '\0') {
- mbfl_memory_device_strcat(&device, "text/html");
- } else {
- mbfl_memory_device_strcat(&device, mimetype);
- }
- mbfl_memory_device_strcat(&device, ";charset=");
- mbfl_memory_device_strcat(&device, charset);
- ret = mbfl_memory_device_result(&device, &result);
- if (ret != NULL) {
- if (sapi_add_header(ret->val, ret->len, 0) != FAILURE) {
- SG(sapi_headers).send_default_content_type = 0;
- }
- }
- }
- }
-
- ret = NULL;
- if (MBSTRG(current_http_output_encoding) != mbfl_no_encoding_pass && MBSTRG(outconv) == NULL) {
- MBSTRG(outconv) = mbfl_buffer_converter_new(MBSTRG(current_internal_encoding), MBSTRG(current_http_output_encoding), 0);
- }
- if (MBSTRG(current_http_output_encoding) != mbfl_no_encoding_pass && MBSTRG(outconv) != NULL) {
- mbfl_buffer_converter_illegal_mode(MBSTRG(outconv), MBSTRG(current_filter_illegal_mode));
- mbfl_buffer_converter_illegal_substchar(MBSTRG(outconv), MBSTRG(current_filter_illegal_substchar));
- mbfl_string_init(&string);
- string.no_language = MBSTRG(current_language);
- string.no_encoding = MBSTRG(current_internal_encoding);
- string.val = Z_STRVAL_PP(arg_string);
- string.len = Z_STRLEN_PP(arg_string);
- if ((Z_LVAL_PP(arg_status) & PHP_OUTPUT_HANDLER_END) != 0) {
- mbfl_buffer_converter_feed(MBSTRG(outconv), &string);
- mbfl_buffer_converter_flush(MBSTRG(outconv));
- ret = mbfl_buffer_converter_result(MBSTRG(outconv), &result);
- } else {
- mbfl_buffer_converter_feed(MBSTRG(outconv), &string);
- ret = mbfl_buffer_converter_result(MBSTRG(outconv), &result);
- }
- }
-
- if (ret != NULL) {
- RETVAL_STRINGL(ret->val, ret->len, 0); /* the string is already strdup()'ed */
- } else {
- zval_dtor(return_value);
- *return_value = **arg_string;
- zval_copy_ctor(return_value);
- }
- if ((Z_LVAL_PP(arg_status) & PHP_OUTPUT_HANDLER_END) != 0) {
- mbfl_buffer_converter_delete(MBSTRG(outconv));
- MBSTRG(outconv) = NULL;
- }
-}
-/* }}} */
-
-
-
-/* {{{ proto int mb_strlen(string str, [string encoding])
- Get character numbers of a string */
-PHP_FUNCTION(mb_strlen)
-{
- pval **arg1, **arg2;
- int n;
- mbfl_string string;
- MBSTRLS_FETCH();
-
- n = ZEND_NUM_ARGS();
- if ((n == 1 && zend_get_parameters_ex(1, &arg1) == FAILURE) ||
- (n == 2 && zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) ||
- n < 1 || n > 2) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(arg1);
- mbfl_string_init(&string);
- string.no_language = MBSTRG(current_language);
- string.no_encoding = MBSTRG(current_internal_encoding);
- string.val = Z_STRVAL_PP(arg1);
- string.len = Z_STRLEN_PP(arg1);
-
- if (n == 2) {
- convert_to_string_ex(arg2);
- string.no_encoding = mbfl_name2no_encoding(Z_STRVAL_PP(arg2));
- if(string.no_encoding == mbfl_no_encoding_invalid) {
- php_error(E_WARNING, "unknown encoding \"%s\"", Z_STRVAL_PP(arg2));
- RETURN_FALSE;
- }
- }
-
- n = mbfl_strlen(&string);
- if (n >= 0) {
- RETVAL_LONG(n);
- } else {
- RETVAL_FALSE;
- }
-}
-/* }}} */
-
-
-
-/* {{{ proto int mb_strpos(string haystack, string needle [, int offset [, string encoding]])
- Find position of first occurrence of a string within another */
-PHP_FUNCTION(mb_strpos)
-{
- pval **arg1, **arg2, **arg3, **arg4;
- int offset, n;
- mbfl_string haystack, needle;
- MBSTRLS_FETCH();
-
- mbfl_string_init(&haystack);
- mbfl_string_init(&needle);
- haystack.no_language = MBSTRG(current_language);
- haystack.no_encoding = MBSTRG(current_internal_encoding);
- needle.no_language = MBSTRG(current_language);
- needle.no_encoding = MBSTRG(current_internal_encoding);
- offset = 0;
- switch (ZEND_NUM_ARGS()) {
- case 2:
- if (zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- break;
- case 3:
- if (zend_get_parameters_ex(3, &arg1, &arg2, &arg3) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(arg3);
- offset = Z_LVAL_PP(arg3);
- break;
- case 4:
- if (zend_get_parameters_ex(4, &arg1, &arg2, &arg3, &arg4) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(arg3);
- offset = Z_LVAL_PP(arg3);
- convert_to_string_ex(arg4);
- haystack.no_encoding = needle.no_encoding = mbfl_name2no_encoding(Z_STRVAL_PP(arg4));
- if(haystack.no_encoding == mbfl_no_encoding_invalid) {
- php_error(E_WARNING, "unknown encoding \"%s\"", Z_STRVAL_PP(arg4));
- RETURN_FALSE;
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(arg1);
- convert_to_string_ex(arg2);
- if (offset < 0) {
- php_error(E_WARNING,"offset is minus value");
- offset = 0;
- }
- if (offset > Z_STRLEN_PP(arg1)) {
- php_error(E_WARNING,"offset not contained in string");
- RETURN_FALSE;
- }
- if (Z_STRLEN_PP(arg2) == 0) {
- php_error(E_WARNING,"Empty needle");
- RETURN_FALSE;
- }
- haystack.val = Z_STRVAL_PP(arg1);
- haystack.len = Z_STRLEN_PP(arg1);
- needle.val = Z_STRVAL_PP(arg2);
- needle.len = Z_STRLEN_PP(arg2);
-
- n = mbfl_strpos(&haystack, &needle, offset, 0);
- if (n >= 0) {
- RETVAL_LONG(n);
- } else {
- RETVAL_FALSE;
- }
-}
-/* }}} */
-
-
-
-/* {{{ proto int mb_strrpos(string haystack, string needle [, string encoding])
- Find the last occurrence of a character in a string within another */
-PHP_FUNCTION(mb_strrpos)
-{
- pval **arg1, **arg2, **arg3;
- int n;
- mbfl_string haystack, needle;
- MBSTRLS_FETCH();
-
- mbfl_string_init(&haystack);
- mbfl_string_init(&needle);
- haystack.no_language = MBSTRG(current_language);
- haystack.no_encoding = MBSTRG(current_internal_encoding);
- needle.no_language = MBSTRG(current_language);
- needle.no_encoding = MBSTRG(current_internal_encoding);
- switch (ZEND_NUM_ARGS()) {
- case 2:
- if (zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- break;
- case 3:
- if (zend_get_parameters_ex(3, &arg1, &arg2, &arg3) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(arg3);
- haystack.no_encoding = needle.no_encoding = mbfl_name2no_encoding(Z_STRVAL_PP(arg3));
- if(haystack.no_encoding == mbfl_no_encoding_invalid) {
- php_error(E_WARNING, "unknown encoding \"%s\"", Z_STRVAL_PP(arg3));
- RETURN_FALSE;
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(arg1);
- convert_to_string_ex(arg2);
- if (Z_STRLEN_PP(arg1) <= 0) {
- php_error(E_WARNING,"Empty haystack");
- RETURN_FALSE;
- }
- if (Z_STRLEN_PP(arg2) <= 0) {
- php_error(E_WARNING,"Empty needle");
- RETURN_FALSE;
- }
- haystack.val = Z_STRVAL_PP(arg1);
- haystack.len = Z_STRLEN_PP(arg1);
- needle.val = Z_STRVAL_PP(arg2);
- needle.len = Z_STRLEN_PP(arg2);
- n = mbfl_strpos(&haystack, &needle, 0, 1);
- if (n >= 0) {
- RETVAL_LONG(n);
- } else {
- RETVAL_FALSE;
- }
-}
-/* }}} */
-
-
-
-/* {{{ proto string mb_substr(string str, int start [, int length [, string encoding]])
- Return part of a string */
-PHP_FUNCTION(mb_substr)
-{
- pval **arg1, **arg2, **arg3, **arg4;
- int argc, from, len, mblen;
- mbfl_string string, result, *ret;
- MBSTRLS_FETCH();
-
- mbfl_string_init(&string);
- string.no_language = MBSTRG(current_language);
- string.no_encoding = MBSTRG(current_internal_encoding);
-
- argc = ZEND_NUM_ARGS();
- switch (argc) {
- case 2:
- if (zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- break;
- case 3:
- if (zend_get_parameters_ex(3, &arg1, &arg2, &arg3) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- break;
- case 4:
- if (zend_get_parameters_ex(4, &arg1, &arg2, &arg3, &arg4) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(arg4);
- string.no_encoding = mbfl_name2no_encoding(Z_STRVAL_PP(arg4));
- if (string.no_encoding == mbfl_no_encoding_invalid) {
- php_error(E_WARNING, "unknown encoding \"%s\"", Z_STRVAL_PP(arg4));
- RETURN_FALSE;
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(arg1);
- string.val = Z_STRVAL_PP(arg1);
- string.len = Z_STRLEN_PP(arg1);
-
- convert_to_long_ex(arg2);
- from = Z_LVAL_PP(arg2);
- if (argc >= 3) {
- convert_to_long_ex(arg3);
- len = Z_LVAL_PP(arg3);
- } else {
- len = Z_STRLEN_PP(arg1);
- }
-
- /* measures length */
- mblen = 0;
- if (from < 0 || len < 0) {
- mblen = mbfl_strlen(&string);
- }
-
- /* if "from" position is negative, count start position from the end
- * of the string
- */
- if (from < 0) {
- from = mblen + from;
- if (from < 0) {
- from = 0;
- }
- }
-
- /* if "length" position is negative, set it to the length
- * needed to stop that many chars from the end of the string
- */
- if (len < 0) {
- len = (mblen - from) + len;
- if (len < 0) {
- len = 0;
- }
- }
-
- ret = mbfl_substr(&string, &result, from, len);
- if (ret != NULL) {
- RETVAL_STRINGL(ret->val, ret->len, 0); /* the string is already strdup()'ed */
- } else {
- RETVAL_FALSE;
- }
-}
-/* }}} */
-
-
-
-/* {{{ proto string mb_strcut(string str, int start [, int length [, string encoding]])
- Return part of a string */
-PHP_FUNCTION(mb_strcut)
-{
- pval **arg1, **arg2, **arg3, **arg4;
- int argc, from, len;
- mbfl_string string, result, *ret;
- MBSTRLS_FETCH();
-
- mbfl_string_init(&string);
- string.no_language = MBSTRG(current_language);
- string.no_encoding = MBSTRG(current_internal_encoding);
-
- argc = ZEND_NUM_ARGS();
- switch (argc) {
- case 2:
- if (zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- break;
- case 3:
- if (zend_get_parameters_ex(3, &arg1, &arg2, &arg3) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- break;
- case 4:
- if (zend_get_parameters_ex(4, &arg1, &arg2, &arg3, &arg4) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(arg4);
- string.no_encoding = mbfl_name2no_encoding(Z_STRVAL_PP(arg4));
- if (string.no_encoding == mbfl_no_encoding_invalid) {
- php_error(E_WARNING, "unknown encoding \"%s\"", Z_STRVAL_PP(arg4));
- RETURN_FALSE;
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(arg1);
- string.val = Z_STRVAL_PP(arg1);
- string.len = Z_STRLEN_PP(arg1);
-
- convert_to_long_ex(arg2);
- from = Z_LVAL_PP(arg2);
- if (argc >= 3) {
- convert_to_long_ex(arg3);
- len = Z_LVAL_PP(arg3);
- } else {
- len = Z_STRLEN_PP(arg1);
- }
-
- /* if "from" position is negative, count start position from the end
- * of the string
- */
- if (from < 0) {
- from = (*arg1)->value.str.len + from;
- if (from < 0) {
- from = 0;
- }
- }
-
- /* if "length" position is negative, set it to the length
- * needed to stop that many chars from the end of the string
- */
- if (len < 0) {
- len = ((*arg1)->value.str.len - from) + len;
- if (len < 0) {
- len = 0;
- }
- }
-
- ret = mbfl_strcut(&string, &result, from, len);
- if (ret != NULL) {
- RETVAL_STRINGL(ret->val, ret->len, 0); /* the string is already strdup()'ed */
- } else {
- RETVAL_FALSE;
- }
-}
-/* }}} */
-
-
-
-/* {{{ proto int mb_strwidth(string str, [string encoding])
- Get terminal width of a string */
-PHP_FUNCTION(mb_strwidth)
-{
- pval **arg1, **arg2;
- int n;
- mbfl_string string;
- MBSTRLS_FETCH();
-
- n = ZEND_NUM_ARGS();
- if ((n == 1 && zend_get_parameters_ex(1, &arg1) == FAILURE) ||
- (n == 2 && zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) ||
- n < 1 || n > 2) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(arg1);
- mbfl_string_init(&string);
- string.no_language = MBSTRG(current_language);
- string.no_encoding = MBSTRG(current_internal_encoding);
- string.val = Z_STRVAL_PP(arg1);
- string.len = Z_STRLEN_PP(arg1);
-
- if (n == 2){
- convert_to_string_ex(arg2);
- string.no_encoding = mbfl_name2no_encoding(Z_STRVAL_PP(arg2));
- if(string.no_encoding == mbfl_no_encoding_invalid) {
- php_error(E_WARNING, "unknown encoding \"%s\"", Z_STRVAL_PP(arg2));
- RETURN_FALSE;
- }
- }
-
- n = mbfl_strwidth(&string);
- if (n >= 0) {
- RETVAL_LONG(n);
- } else {
- RETVAL_FALSE;
- }
-}
-/* }}} */
-
-
-
-/* {{{ proto string mb_strimwidth(string str, int start, int width [, string trimmarker [, string encoding]])
- Trim the string in terminal width */
-PHP_FUNCTION(mb_strimwidth)
-{
- pval **arg1, **arg2, **arg3, **arg4, **arg5;
- int from, width;
- mbfl_string string, result, marker, *ret;
- MBSTRLS_FETCH();
-
- mbfl_string_init(&string);
- mbfl_string_init(&marker);
- string.no_language = MBSTRG(current_language);
- string.no_encoding = MBSTRG(current_internal_encoding);
- marker.no_language = MBSTRG(current_language);
- marker.no_encoding = MBSTRG(current_internal_encoding);
- marker.val = NULL;
- marker.len = 0;
-
- switch (ZEND_NUM_ARGS()) {
- case 3:
- if (zend_get_parameters_ex(3, &arg1, &arg2, &arg3) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- break;
- case 4:
- if (zend_get_parameters_ex(4, &arg1, &arg2, &arg3, &arg4) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- break;
- case 5:
- if (zend_get_parameters_ex(5, &arg1, &arg2, &arg3, &arg4, &arg5) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(arg5);
- string.no_encoding = marker.no_encoding = mbfl_name2no_encoding(Z_STRVAL_PP(arg5));
- if (string.no_encoding == mbfl_no_encoding_invalid) {
- php_error(E_WARNING, "unknown encoding \"%s\"", Z_STRVAL_PP(arg5));
- RETURN_FALSE;
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(arg1);
- string.val = Z_STRVAL_PP(arg1);
- string.len = Z_STRLEN_PP(arg1);
-
- convert_to_long_ex(arg2);
- from = Z_LVAL_PP(arg2);
- convert_to_long_ex(arg3);
- width = Z_LVAL_PP(arg3);
-
- if (ZEND_NUM_ARGS() >= 4) {
- convert_to_string_ex(arg4);
- marker.val = Z_STRVAL_PP(arg4);
- marker.len = Z_STRLEN_PP(arg4);
- }
-
- ret = mbfl_strimwidth(&string, &marker, &result, from, width);
- if (ret != NULL) {
- RETVAL_STRINGL(ret->val, ret->len, 0); /* the string is already strdup()'ed */
- } else {
- RETVAL_FALSE;
- }
-}
-/* }}} */
-
-
-
-/* {{{ proto string mb_convert_encoding(string str, string to-encoding [, mixed from-encoding])
- Returns converted string in desired encoding */
-PHP_FUNCTION(mb_convert_encoding)
-{
- pval **arg_str, **arg_new, **arg_old;
- mbfl_string string, result, *ret;
- enum mbfl_no_encoding from_encoding, to_encoding;
- mbfl_buffer_converter *convd;
- int size, *list;
- MBSTRLS_FETCH();
-
- if (ZEND_NUM_ARGS() == 2) {
- if (zend_get_parameters_ex(2, &arg_str, &arg_new) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- } else if (ZEND_NUM_ARGS() == 3) {
- if (zend_get_parameters_ex(3, &arg_str, &arg_new, &arg_old) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- } else {
- WRONG_PARAM_COUNT;
- }
-
- /* new encoding */
- convert_to_string_ex(arg_new);
- to_encoding = mbfl_name2no_encoding(Z_STRVAL_PP(arg_new));
- if (to_encoding == mbfl_no_encoding_invalid) {
- php_error(E_WARNING, "unknown encoding \"%s\"", Z_STRVAL_PP(arg_new));
- RETURN_FALSE;
- }
-
- /* initialize string */
- convert_to_string_ex(arg_str);
- mbfl_string_init(&string);
- mbfl_string_init(&result);
- from_encoding = MBSTRG(current_internal_encoding);
- string.no_encoding = from_encoding;
- string.no_language = MBSTRG(current_language);
- string.val = Z_STRVAL_PP(arg_str);
- string.len = Z_STRLEN_PP(arg_str);
-
- /* pre-conversion encoding */
- if (ZEND_NUM_ARGS() >= 3) {
- list = NULL;
- size = 0;
- switch (Z_TYPE_PP(arg_old)) {
- case IS_ARRAY:
- php_mbstring_parse_encoding_array(*arg_old, &list, &size, 0);
- break;
- default:
- convert_to_string_ex(arg_old);
- php_mbstring_parse_encoding_list(Z_STRVAL_PP(arg_old), Z_STRLEN_PP(arg_old), &list, &size, 0);
- break;
- }
- if (size == 1) {
- from_encoding = *list;
- } else if (size > 1) {
- /* auto detect */
- from_encoding = mbfl_identify_encoding_no(&string, list, size);
- if (from_encoding != mbfl_no_encoding_invalid) {
- string.no_encoding = from_encoding;
- } else {
- php_error(E_WARNING, "Unable to detect encoding in mb_convert_encoding()");
- from_encoding = mbfl_no_encoding_pass;
- to_encoding = from_encoding;
- string.no_encoding = from_encoding;
- }
- } else {
- php_error(E_WARNING, "illegal from-encoding in mb_convert_encoding()");
- }
- if (list != NULL) {
- efree((void *)list);
- }
- }
-
- /* initialize converter */
- convd = mbfl_buffer_converter_new(from_encoding, to_encoding, string.len);
- if (convd == NULL) {
- php_error(E_WARNING, "Unable to create converter in mb_convert_encoding()");
- RETURN_FALSE;
- }
- mbfl_buffer_converter_illegal_mode(convd, MBSTRG(current_filter_illegal_mode));
- mbfl_buffer_converter_illegal_substchar(convd, MBSTRG(current_filter_illegal_substchar));
-
- /* do it */
- ret = mbfl_buffer_converter_feed_result(convd, &string, &result);
- if (ret != NULL) {
- RETVAL_STRINGL(ret->val, ret->len, 0); /* the string is already strdup()'ed */
- } else {
- RETVAL_FALSE;
- }
-
- mbfl_buffer_converter_delete(convd);
-}
-/* }}} */
-
-
-
-/* {{{ proto string mb_detect_encoding(string str [, mixed encoding_list])
- Encoding of the given string is returned (as a string) */
-PHP_FUNCTION(mb_detect_encoding)
-{
- pval **arg_str, **arg_list;
- mbfl_string string;
- const char *ret;
- enum mbfl_no_encoding *elist;
- int size, *list;
- MBSTRLS_FETCH();
-
- if (ZEND_NUM_ARGS() == 1) {
- if (zend_get_parameters_ex(1, &arg_str) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- } else if (ZEND_NUM_ARGS() == 2) {
- if (zend_get_parameters_ex(2, &arg_str, &arg_list) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- } else {
- WRONG_PARAM_COUNT;
- }
-
- /* make encoding list */
- list = NULL;
- size = 0;
- if (ZEND_NUM_ARGS() >= 2) {
- switch (Z_TYPE_PP(arg_list)) {
- case IS_ARRAY:
- php_mbstring_parse_encoding_array(*arg_list, &list, &size, 0);
- break;
- default:
- convert_to_string_ex(arg_list);
- php_mbstring_parse_encoding_list(Z_STRVAL_PP(arg_list), Z_STRLEN_PP(arg_list), &list, &size, 0);
- break;
- }
- if (size <= 0) {
- php_error(E_WARNING, "illegal argument");
- }
- }
-
- if (size > 0 && list != NULL) {
- elist = list;
- } else {
- elist = MBSTRG(current_detect_order_list);
- size = MBSTRG(current_detect_order_list_size);
- }
-
- convert_to_string_ex(arg_str);
- mbfl_string_init(&string);
- string.no_language = MBSTRG(current_language);
- string.val = Z_STRVAL_PP(arg_str);
- string.len = Z_STRLEN_PP(arg_str);
- ret = mbfl_identify_encoding_name(&string, elist, size);
- if (list != NULL) {
- efree((void *)list);
- }
- if (ret != NULL) {
- RETVAL_STRING((char *)ret, 1);
- } else {
- RETVAL_FALSE;
- }
-}
-/* }}} */
-
-
-
-/* {{{ proto string mb_encode_mimeheader(string str [, string charset [, string transfer-encoding [, string linefeed]]])
- Convert the string to MIME "encoded-word" in the format of =?charset?(B|Q)?encoded_string?= */
-PHP_FUNCTION(mb_encode_mimeheader)
-{
- pval **argv[4];
- enum mbfl_no_encoding charset, transenc;
- mbfl_string string, result, *ret;
- char *p, *linefeed;
- MBSTRLS_FETCH();
-
- if (ZEND_NUM_ARGS() < 1 || ZEND_NUM_ARGS() > 4 || zend_get_parameters_array_ex(ZEND_NUM_ARGS(), argv) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- charset = mbfl_no_encoding_pass;
- transenc = mbfl_no_encoding_base64;
- if (ZEND_NUM_ARGS() >= 2) {
- convert_to_string_ex(argv[1]);
- charset = mbfl_name2no_encoding(Z_STRVAL_PP(argv[1]));
- if (charset == mbfl_no_encoding_invalid) {
- php_error(E_WARNING, "unknown encoding \"%s\"", Z_STRVAL_PP(argv[1]));
- RETURN_FALSE;
- }
- } else {
- switch (MBSTRG(current_language)) {
- case mbfl_no_language_japanese:
- charset = mbfl_no_encoding_2022jp;
- break;
- case mbfl_no_language_english:
- charset = mbfl_no_encoding_8859_1;
- transenc = mbfl_no_encoding_qprint;
- break;
- default:
- charset = mbfl_no_encoding_utf8;
- break;
- }
- }
-
- if (ZEND_NUM_ARGS() >= 3) {
- convert_to_string_ex(argv[2]);
- p = Z_STRVAL_PP(argv[2]);
- if (*p == 'B' || *p == 'b') {
- transenc = mbfl_no_encoding_base64;
- } else if (*p == 'Q' || *p == 'q') {
- transenc = mbfl_no_encoding_qprint;
- }
- }
-
- linefeed = "\r\n";
- if (ZEND_NUM_ARGS() >= 4) {
- convert_to_string_ex(argv[3]);
- linefeed = Z_STRVAL_PP(argv[3]);
- }
-
- convert_to_string_ex(argv[0]);
- mbfl_string_init(&string);
- mbfl_string_init(&result);
- string.no_language = MBSTRG(current_language);
- string.no_encoding = MBSTRG(current_internal_encoding);
- string.val = Z_STRVAL_PP(argv[0]);
- string.len = Z_STRLEN_PP(argv[0]);
- ret = mbfl_mime_header_encode(&string, &result, charset, transenc, linefeed, 0);
- if (ret != NULL) {
- RETVAL_STRINGL(ret->val, ret->len, 0) /* the string is already strdup()'ed */
- } else {
- RETVAL_FALSE;
- }
-}
-/* }}} */
-
-
-
-/* {{{ proto string mb_decode_mimeheader(string string)
- Decodes the MIME "encoded-word" in the string */
-PHP_FUNCTION(mb_decode_mimeheader)
-{
- pval **arg_str;
- mbfl_string string, result, *ret;
- MBSTRLS_FETCH();
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg_str) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(arg_str);
- mbfl_string_init(&string);
- mbfl_string_init(&result);
- string.no_language = MBSTRG(current_language);
- string.no_encoding = MBSTRG(current_internal_encoding);
- string.val = Z_STRVAL_PP(arg_str);
- string.len = Z_STRLEN_PP(arg_str);
- ret = mbfl_mime_header_decode(&string, &result, MBSTRG(current_internal_encoding));
- if (ret != NULL) {
- RETVAL_STRINGL(ret->val, ret->len, 0) /* the string is already strdup()'ed */
- } else {
- RETVAL_FALSE;
- }
-}
-/* }}} */
-
-
-
-/* {{{ proto string mb_convert_kana(string str [,string option] [, string encoding])
- Conversion between full-width character and half-width character (Japanese) */
-PHP_FUNCTION(mb_convert_kana)
-{
- pval **arg1, **arg2, **arg3;
- int argc, opt, i, n;
- char *p;
- mbfl_string string, result, *ret;
- enum mbfl_no_encoding no_encoding;
- MBSTRLS_FETCH();
-
- mbfl_string_init(&string);
- string.no_language = MBSTRG(current_language);
- string.no_encoding = MBSTRG(current_internal_encoding);
-
- argc = ZEND_NUM_ARGS();
- if ((argc == 1 && zend_get_parameters_ex(1, &arg1) == FAILURE) ||
- (argc == 2 && zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) ||
- (argc == 3 && zend_get_parameters_ex(3, &arg1, &arg2, &arg3) == FAILURE) ||
- argc < 1 || argc > 3) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(arg1);
- string.val = Z_STRVAL_PP(arg1);
- string.len = Z_STRLEN_PP(arg1);
-
- /* option */
- if (argc >= 2){
- convert_to_string_ex(arg2);
- p = Z_STRVAL_PP(arg2);
- n = Z_STRLEN_PP(arg2);
- i = 0;
- opt = 0;
- while (i < n) {
- i++;
- switch (*p++) {
- case 'A':
- opt |= 0x1;
- break;
- case 'a':
- opt |= 0x10;
- break;
- case 'R':
- opt |= 0x2;
- break;
- case 'r':
- opt |= 0x20;
- break;
- case 'N':
- opt |= 0x4;
- break;
- case 'n':
- opt |= 0x40;
- break;
- case 'S':
- opt |= 0x8;
- break;
- case 's':
- opt |= 0x80;
- break;
- case 'K':
- opt |= 0x100;
- break;
- case 'k':
- opt |= 0x1000;
- break;
- case 'H':
- opt |= 0x200;
- break;
- case 'h':
- opt |= 0x2000;
- break;
- case 'V':
- opt |= 0x800;
- break;
- case 'C':
- opt |= 0x10000;
- break;
- case 'c':
- opt |= 0x20000;
- break;
- case 'M':
- opt |= 0x100000;
- break;
- case 'm':
- opt |= 0x200000;
- break;
- }
- }
- } else {
- opt = 0x900;
- }
-
- /* encoding */
- if (argc == 3) {
- convert_to_string_ex(arg3);
- no_encoding = mbfl_name2no_encoding(Z_STRVAL_PP(arg3));
- if (no_encoding == mbfl_no_encoding_invalid) {
- php_error(E_WARNING, "unknown encoding \"%s\"", Z_STRVAL_PP(arg3));
- RETURN_FALSE;
- } else {
- string.no_encoding = no_encoding;
- }
- }
-
- ret = mbfl_ja_jp_hantozen(&string, &result, opt);
- if (ret != NULL) {
- RETVAL_STRINGL(ret->val, ret->len, 0); /* the string is already strdup()'ed */
- } else {
- RETVAL_FALSE;
- }
-}
-/* }}} */
-
-#define PHP_MBSTR_STACK_BLOCK_SIZE 32
-
-/* {{{ proto string mb_convert_variables(string to-encoding, mixed from-encoding [, mixed ...])
- Converts the string resource in variables to desired encoding */
-PHP_FUNCTION(mb_convert_variables)
-{
- pval ***args, ***stack, **var, **hash_entry;
- HashTable *target_hash;
- mbfl_string string, result, *ret;
- enum mbfl_no_encoding from_encoding, to_encoding;
- mbfl_encoding_detector *identd;
- mbfl_buffer_converter *convd;
- int n, argc, stack_level, stack_max, *elist, elistsz;
- char *name;
- void *ptmp;
- MBSTRLS_FETCH();
-
- argc = ZEND_NUM_ARGS();
- if (argc < 3) {
- WRONG_PARAM_COUNT;
- }
- args = (pval ***)ecalloc(argc, sizeof(pval **));
- if (args == NULL) {
- RETURN_FALSE;
- }
- if (zend_get_parameters_array_ex(argc, args) == FAILURE) {
- efree((void *)args);
- WRONG_PARAM_COUNT;
- }
-
- /* new encoding */
- convert_to_string_ex(args[0]);
- to_encoding = mbfl_name2no_encoding(Z_STRVAL_PP(args[0]));
- if (to_encoding == mbfl_no_encoding_invalid) {
- php_error(E_WARNING, "unknown encoding \"%s\"", Z_STRVAL_PP(args[0]));
- efree((void *)args);
- RETURN_FALSE;
- }
-
- /* initialize string */
- mbfl_string_init(&string);
- mbfl_string_init(&result);
- from_encoding = MBSTRG(current_internal_encoding);
- string.no_encoding = from_encoding;
- string.no_language = MBSTRG(current_language);
-
- /* pre-conversion encoding */
- elist = NULL;
- elistsz = 0;
- switch (Z_TYPE_PP(args[1])) {
- case IS_ARRAY:
- php_mbstring_parse_encoding_array(*args[1], &elist, &elistsz, 0);
- break;
- default:
- convert_to_string_ex(args[1]);
- php_mbstring_parse_encoding_list(Z_STRVAL_PP(args[1]), Z_STRLEN_PP(args[1]), &elist, &elistsz, 0);
- break;
- }
- if (elistsz <= 0) {
- from_encoding = mbfl_no_encoding_pass;
- } else if (elistsz == 1) {
- from_encoding = *elist;
- } else {
- /* auto detect */
- from_encoding = mbfl_no_encoding_invalid;
- stack_max = PHP_MBSTR_STACK_BLOCK_SIZE;
- stack = (pval ***)emalloc(stack_max*sizeof(pval **));
- if (stack != NULL) {
- stack_level = 0;
- identd = mbfl_encoding_detector_new(elist, elistsz);
- if (identd != NULL) {
- n = 2;
- while (n < argc || stack_level > 0) {
- if (stack_level <= 0) {
- var = args[n++];
- if (Z_TYPE_PP(var) == IS_ARRAY || Z_TYPE_PP(var) == IS_OBJECT) {
- target_hash = HASH_OF(*var);
- if (target_hash != NULL) {
- zend_hash_internal_pointer_reset(target_hash);
- }
- }
- } else {
- stack_level--;
- var = stack[stack_level];
- }
- if (Z_TYPE_PP(var) == IS_ARRAY || Z_TYPE_PP(var) == IS_OBJECT) {
- target_hash = HASH_OF(*var);
- if (target_hash != NULL) {
- while (zend_hash_get_current_data(target_hash, (void **) &hash_entry) != FAILURE) {
- zend_hash_move_forward(target_hash);
- if (Z_TYPE_PP(hash_entry) == IS_ARRAY || Z_TYPE_PP(hash_entry) == IS_OBJECT) {
- if (stack_level >= stack_max) {
- stack_max += PHP_MBSTR_STACK_BLOCK_SIZE;
- ptmp = erealloc(stack, sizeof(pval **)*stack_max);
- if (ptmp == NULL) {
- php_error(E_WARNING, "stack err at %s:(%d)", __FILE__, __LINE__);
- continue;
- }
- stack = (pval ***)ptmp;
- }
- stack[stack_level] = var;
- stack_level++;
- var = hash_entry;
- target_hash = HASH_OF(*var);
- if (target_hash != NULL) {
- zend_hash_internal_pointer_reset(target_hash);
- continue;
- }
- } else if (Z_TYPE_PP(hash_entry) == IS_STRING) {
- string.val = Z_STRVAL_PP(hash_entry);
- string.len = Z_STRLEN_PP(hash_entry);
- if (mbfl_encoding_detector_feed(identd, &string)) {
- goto detect_end; /* complete detecting */
- }
- }
- }
- }
- } else if (Z_TYPE_PP(var) == IS_STRING) {
- string.val = Z_STRVAL_PP(args[n]);
- string.len = Z_STRLEN_PP(args[n]);
- if (mbfl_encoding_detector_feed(identd, &string)) {
- goto detect_end; /* complete detecting */
- }
- }
- }
-detect_end:
- from_encoding = mbfl_encoding_detector_judge(identd);
- mbfl_encoding_detector_delete(identd);
- }
- efree(stack);
- }
- if (from_encoding == mbfl_no_encoding_invalid) {
- php_error(E_WARNING, "Unable to detect encoding in mb_convert_variables()");
- from_encoding = mbfl_no_encoding_pass;
- }
- }
- if (elist != NULL) {
- efree((void *)elist);
- }
- /* create converter */
- convd = NULL;
- if (from_encoding != mbfl_no_encoding_pass) {
- convd = mbfl_buffer_converter_new(from_encoding, to_encoding, 0);
- if (convd == NULL) {
- php_error(E_WARNING, "Unable to create converter in mb_convert_variables()");
- RETURN_FALSE;
- }
- mbfl_buffer_converter_illegal_mode(convd, MBSTRG(current_filter_illegal_mode));
- mbfl_buffer_converter_illegal_substchar(convd, MBSTRG(current_filter_illegal_substchar));
- }
-
- /* convert */
- if (convd != NULL) {
- stack_max = PHP_MBSTR_STACK_BLOCK_SIZE;
- stack = (pval ***)emalloc(stack_max*sizeof(pval **));
- if (stack != NULL) {
- stack_level = 0;
- n = 2;
- while (n < argc || stack_level > 0) {
- if (stack_level <= 0) {
- if (!ParameterPassedByReference(ht, n + 1)) {
- n++;
- php_error(E_WARNING, "argument %d not passed by reference", n);
- continue;
- }
- var = args[n++];
- if (Z_TYPE_PP(var) == IS_ARRAY || Z_TYPE_PP(var) == IS_OBJECT) {
- target_hash = HASH_OF(*var);
- if (target_hash != NULL) {
- zend_hash_internal_pointer_reset(target_hash);
- }
- }
- } else {
- stack_level--;
- var = stack[stack_level];
- }
- if (Z_TYPE_PP(var) == IS_ARRAY || Z_TYPE_PP(var) == IS_OBJECT) {
- target_hash = HASH_OF(*var);
- if (target_hash != NULL) {
- while (zend_hash_get_current_data(target_hash, (void **) &hash_entry) != FAILURE) {
- zend_hash_move_forward(target_hash);
- if (Z_TYPE_PP(hash_entry) == IS_ARRAY || Z_TYPE_PP(hash_entry) == IS_OBJECT) {
- if (stack_level >= stack_max) {
- stack_max += PHP_MBSTR_STACK_BLOCK_SIZE;
- ptmp = erealloc(stack, sizeof(pval **)*stack_max);
- if (ptmp == NULL) {
- php_error(E_WARNING, "stack err at %s:(%d)", __FILE__, __LINE__);
- continue;
- }
- stack = (pval ***)ptmp;
- }
- stack[stack_level] = var;
- stack_level++;
- var = hash_entry;
- target_hash = HASH_OF(*var);
- if (target_hash != NULL) {
- zend_hash_internal_pointer_reset(target_hash);
- continue;
- }
- } else if (Z_TYPE_PP(hash_entry) == IS_STRING) {
- string.val = Z_STRVAL_PP(hash_entry);
- string.len = Z_STRLEN_PP(hash_entry);
- ret = mbfl_buffer_converter_feed_result(convd, &string, &result);
- if (ret != NULL) {
- STR_FREE(Z_STRVAL_PP(hash_entry));
- Z_STRVAL_PP(hash_entry) = ret->val;
- Z_STRLEN_PP(hash_entry) = ret->len;
- }
- }
- }
- }
- } else if (Z_TYPE_PP(var) == IS_STRING) {
- string.val = Z_STRVAL_PP(var);
- string.len = Z_STRLEN_PP(var);
- ret = mbfl_buffer_converter_feed_result(convd, &string, &result);
- if (ret != NULL) {
- STR_FREE(Z_STRVAL_PP(var));
- Z_STRVAL_PP(var) = ret->val;
- Z_STRLEN_PP(var) = ret->len;
- }
- }
- }
- efree(stack);
- }
- mbfl_buffer_converter_delete(convd);
- }
-
- efree((void *)args);
-
- name = (char *)mbfl_no_encoding2name(from_encoding);
- if (name != NULL) {
- RETURN_STRING(name, 1);
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-
-/* HTML numeric entity */
-static void
-php_mbstr_numericentity_exec(INTERNAL_FUNCTION_PARAMETERS, int type)
-{
- pval **arg1, **arg2, **arg3, **hash_entry;
- HashTable *target_hash;
- int argc, i, *convmap, *mapelm, mapsize;
- mbfl_string string, result, *ret;
- enum mbfl_no_encoding no_encoding;
- MBSTRLS_FETCH();
-
- argc = ZEND_NUM_ARGS();
- if ((argc == 2 && zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) ||
- (argc == 3 && zend_get_parameters_ex(3, &arg1, &arg2, &arg3) == FAILURE) ||
- argc < 2 || argc > 3) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(arg1);
- mbfl_string_init(&string);
- string.no_language = MBSTRG(current_language);
- string.no_encoding = MBSTRG(current_internal_encoding);
- string.val = Z_STRVAL_PP(arg1);
- string.len = Z_STRLEN_PP(arg1);
-
- /* encoding */
- if (argc == 3) {
- convert_to_string_ex(arg3);
- no_encoding = mbfl_name2no_encoding(Z_STRVAL_PP(arg3));
- if (no_encoding == mbfl_no_encoding_invalid) {
- php_error(E_WARNING, "unknown encoding \"%s\"", Z_STRVAL_PP(arg3));
- RETURN_FALSE;
- } else {
- string.no_encoding = no_encoding;
- }
- }
-
- /* conversion map */
- convmap = NULL;
- if (Z_TYPE_PP(arg2) == IS_ARRAY){
- target_hash = (*arg2)->value.ht;
- zend_hash_internal_pointer_reset(target_hash);
- i = zend_hash_num_elements(target_hash);
- if (i > 0) {
- convmap = (int *)emalloc(i*sizeof(int));
- if (convmap != NULL) {
- mapelm = convmap;
- mapsize = 0;
- while (i > 0) {
- if (zend_hash_get_current_data(target_hash, (void **) &hash_entry) == FAILURE) {
- break;
- }
- convert_to_long_ex(hash_entry);
- *mapelm++ = Z_LVAL_PP(hash_entry);
- mapsize++;
- i--;
- zend_hash_move_forward(target_hash);
- }
- }
- }
- }
- if (convmap == NULL) {
- RETURN_FALSE;
- }
- mapsize /= 4;
-
- ret = mbfl_html_numeric_entity(&string, &result, convmap, mapsize, type);
- if (ret != NULL) {
- RETVAL_STRINGL(ret->val, ret->len, 0);
- } else {
- RETVAL_FALSE;
- }
- efree((void *)convmap);
-}
-
-/* {{{ proto string mb_encode_numericentity(string string, array convmap [, string encoding])
- Convert specified characters to HTML numeric entities */
-PHP_FUNCTION(mb_encode_numericentity)
-{
- php_mbstr_numericentity_exec(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-/* }}} */
-
-
-/* {{{ proto string mb_decode_numericentity(string string, array convmap [, string encoding])
- Converts HTML numeric entities to character code */
-PHP_FUNCTION(mb_decode_numericentity)
-{
- php_mbstr_numericentity_exec(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
-}
-/* }}} */
-
-
-
-#if HAVE_SENDMAIL
-/* {{{ proto int mb_send_mail(string to, string subject, string message [, string additional_headers [, string additional_parameters]])
- Sends an email message with MIME scheme */
-PHP_FUNCTION(mb_send_mail)
-{
- int argc, n;
- pval **argv[4];
- char *to=NULL, *message=NULL, *headers=NULL, *subject=NULL, *extra_cmd=NULL;
- char *message_buf=NULL, *subject_buf=NULL, *p;
- mbfl_string orig_str, conv_str;
- mbfl_string *pstr; /* pointer to mbfl string for return value */
- enum mbfl_no_encoding
- tran_cs, /* transfar text charset */
- head_enc, /* header transfar encoding */
- body_enc; /* body transfar encoding */
- mbfl_memory_device device; /* automatic allocateable buffer for additional header */
- int err = 0;
- MBSTRLS_FETCH();
-
- /* initialize */
- mbfl_memory_device_init(&device, 0, 0);
- mbfl_string_init(&orig_str);
- mbfl_string_init(&conv_str);
-
- /* character-set, transfer-encoding */
- tran_cs = mbfl_no_encoding_utf8;
- head_enc = mbfl_no_encoding_base64;
- body_enc = mbfl_no_encoding_base64;
- switch (MBSTRG(current_language)) {
- case mbfl_no_language_japanese:
- tran_cs = mbfl_no_encoding_2022jp;
- body_enc = mbfl_no_encoding_7bit;
- break;
- case mbfl_no_language_english:
- tran_cs = mbfl_no_encoding_8859_1;
- head_enc = mbfl_no_encoding_qprint;
- body_enc = mbfl_no_encoding_qprint;
- break;
- }
-
- argc = ZEND_NUM_ARGS();
- if (argc < 3 || argc > 5 || zend_get_parameters_array_ex(argc, argv) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- /* To: */
- convert_to_string_ex(argv[0]);
- if (Z_STRVAL_PP(argv[0])) {
- to = Z_STRVAL_PP(argv[0]);
- } else {
- php_error(E_WARNING, "No to field in mb_send_mail()");
- err = 1;
- }
-
- /* Subject: */
- convert_to_string_ex(argv[1]);
- if (Z_STRVAL_PP(argv[1])) {
- orig_str.no_language = MBSTRG(current_language);
- orig_str.val = Z_STRVAL_PP(argv[1]);
- orig_str.len = Z_STRLEN_PP(argv[1]);
- orig_str.no_encoding = mbfl_identify_encoding_no(&orig_str, MBSTRG(current_detect_order_list), MBSTRG(current_detect_order_list_size));
- if(orig_str.no_encoding == mbfl_no_encoding_invalid) {
- orig_str.no_encoding = MBSTRG(current_internal_encoding);
- }
- pstr = mbfl_mime_header_encode(&orig_str, &conv_str, tran_cs, head_enc, "\n", sizeof("Subject: [PHP-jp nnnnnnnn]"));
- if (pstr != NULL) {
- subject_buf = subject = pstr->val;
- } else {
- subject = Z_STRVAL_PP(argv[1]);
- }
- } else {
- php_error(E_WARNING, "No subject field in mb_send_mail()");
- err = 1;
- }
-
- /* message body */
- convert_to_string_ex(argv[2]);
- if (Z_STRVAL_PP(argv[2])) {
- orig_str.no_language = MBSTRG(current_language);
- orig_str.val = Z_STRVAL_PP(argv[2]);
- orig_str.len = Z_STRLEN_PP(argv[2]);
- orig_str.no_encoding = mbfl_identify_encoding_no(&orig_str, MBSTRG(current_detect_order_list), MBSTRG(current_detect_order_list_size));
- if(orig_str.no_encoding == mbfl_no_encoding_invalid) {
- orig_str.no_encoding = MBSTRG(current_internal_encoding);
- }
- pstr = mbfl_convert_encoding(&orig_str, &conv_str, tran_cs);
- if (pstr != NULL) {
- message_buf = message = pstr->val;
- } else {
- message = Z_STRVAL_PP(argv[2]);
- }
- } else {
- /* this is not really an error, so it is allowed. */
- php_error(E_WARNING, "No message string in mb_send_mail()");
- message = NULL;
- }
-
- /* other headers */
-#define PHP_MBSTR_MAIL_MIME_HEADER1 "Mime-Version: 1.0\nContent-Type: text/plain"
-#define PHP_MBSTR_MAIL_MIME_HEADER2 "; charset="
-#define PHP_MBSTR_MAIL_MIME_HEADER3 "\nContent-Transfer-Encoding: "
- if (argc == 4) {
- convert_to_string_ex(argv[3]);
- p = Z_STRVAL_PP(argv[3]);
- n = Z_STRLEN_PP(argv[3]);
- mbfl_memory_device_strncat(&device, p, n);
- if (p[n - 1] != '\n') {
- mbfl_memory_device_strncat(&device, "\n", 1);
- }
- }
- mbfl_memory_device_strncat(&device, PHP_MBSTR_MAIL_MIME_HEADER1, sizeof(PHP_MBSTR_MAIL_MIME_HEADER1) - 1);
- p = (char *)mbfl_no2preferred_mime_name(tran_cs);
- if (p != NULL) {
- mbfl_memory_device_strncat(&device, PHP_MBSTR_MAIL_MIME_HEADER2, sizeof(PHP_MBSTR_MAIL_MIME_HEADER2) - 1);
- mbfl_memory_device_strcat(&device, p);
- }
- mbfl_memory_device_strncat(&device, PHP_MBSTR_MAIL_MIME_HEADER3, sizeof(PHP_MBSTR_MAIL_MIME_HEADER3) - 1);
- p = (char *)mbfl_no2preferred_mime_name(body_enc);
- if (p == NULL) {
- p = "7bit";
- }
- mbfl_memory_device_strcat(&device, p);
- mbfl_memory_device_output('\0', &device);
- headers = device.buffer;
-
- if (argc == 5) { /* extra options that get passed to the mailer */
- convert_to_string_ex(argv[4]);
- extra_cmd = (*argv[4])->value.str.val;
- }
-
- if (!err && php_mail(to, subject, message, headers, extra_cmd)){
- RETVAL_TRUE;
- } else {
- RETVAL_FALSE;
- }
-
- if (subject_buf) {
- efree((void *)subject_buf);
- }
- if (message_buf) {
- efree((void *)message_buf);
- }
- mbfl_memory_device_clear(&device);
-}
-/* }}} */
-
-#else /* HAVE_SENDMAIL */
-
-PHP_FUNCTION(mb_send_mail)
-{
- RETURN_FALSE;
-}
-
-#endif /* HAVE_SENDMAIL */
-
-#endif /* HAVE_MBSTRING */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/mbstring/mbstring.dsp b/ext/mbstring/mbstring.dsp
deleted file mode 100644
index fd094c0258..0000000000
--- a/ext/mbstring/mbstring.dsp
+++ /dev/null
@@ -1,101 +0,0 @@
-# Microsoft Developer Studio Project File - Name="mbstring" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=mbstring - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "mbstring.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "mbstring.mak" CFG="mbstring - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "mbstring - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "mbstring - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "mbstring - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MBSTRING_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MBSTRING_EXPORTS" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x407 /d "NDEBUG"
-# ADD RSC /l 0x407 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-
-!ELSEIF "$(CFG)" == "mbstring - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MBSTRING_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MBSTRING_EXPORTS" /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x407 /d "_DEBUG"
-# ADD RSC /l 0x407 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-
-!ENDIF
-
-# Begin Target
-
-# Name "mbstring - Win32 Release"
-# Name "mbstring - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/ext/mbstring/mbstring.h b/ext/mbstring/mbstring.h
deleted file mode 100644
index 8445540e07..0000000000
--- a/ext/mbstring/mbstring.h
+++ /dev/null
@@ -1,151 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Tsukada Takuya <tsukada@fminn.nagano.nagano.jp> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-/*
- * PHP4 Multibyte String module "mbstring" (currently only for Japanese)
- *
- * History:
- * 2000.5.19 Release php-4.0RC2_jstring-1.0
- * 2001.4.1 Release php4_jstring-1.0.91
- * 2001.4.30 Release php4-jstring-1.1 (contribute to The PHP Group)
- * 2001.5.1 Renamed from jstring to mbstring (hirokawa@php.net)
- */
-
-/*
- * PHP3 Internationalization support program.
- *
- * Copyright (c) 1999,2000 by the PHP3 internationalization team.
- * All rights reserved.
- *
- * See README_PHP3-i18n-ja for more detail.
- *
- * Authors:
- * Hironori Sato <satoh@jpnnet.com>
- * Shigeru Kanemoto <sgk@happysize.co.jp>
- * Tsukada Takuya <tsukada@fminn.nagano.nagano.jp>
- */
-
-
-#ifndef _MBSTRING_H
-#define _MBSTRING_H
-
-#ifdef COMPILE_DL_MBSTRING
-#undef HAVE_MBSTRING
-#define HAVE_MBSTRING 1
-#endif
-
-#if HAVE_MBSTRING
-
-#include "mbfilter.h"
-
-extern zend_module_entry mbstring_module_entry;
-#define mbstring_module_ptr &mbstring_module_entry
-
-extern PHP_MINIT_FUNCTION(mbstring);
-extern PHP_MSHUTDOWN_FUNCTION(mbstring);
-extern PHP_RINIT_FUNCTION(mbstring);
-extern PHP_RSHUTDOWN_FUNCTION(mbstring);
-PHP_MINFO_FUNCTION(mbstring);
-
-/* php function registration */
-PHP_FUNCTION(mb_language);
-PHP_FUNCTION(mb_internal_encoding);
-PHP_FUNCTION(mb_http_input);
-PHP_FUNCTION(mb_http_output);
-PHP_FUNCTION(mb_detect_order);
-PHP_FUNCTION(mb_substitute_character);
-PHP_FUNCTION(mb_preferred_mime_name);
-PHP_FUNCTION(mb_parse_str);
-PHP_FUNCTION(mb_output_handler);
-PHP_FUNCTION(mb_strlen);
-PHP_FUNCTION(mb_strpos);
-PHP_FUNCTION(mb_strrpos);
-PHP_FUNCTION(mb_substr);
-PHP_FUNCTION(mb_strcut);
-PHP_FUNCTION(mb_strwidth);
-PHP_FUNCTION(mb_strimwidth);
-PHP_FUNCTION(mb_convert_encoding);
-PHP_FUNCTION(mb_detect_encoding);
-PHP_FUNCTION(mb_convert_kana);
-PHP_FUNCTION(mb_encode_mimeheader);
-PHP_FUNCTION(mb_decode_mimeheader);
-PHP_FUNCTION(mb_convert_variables);
-PHP_FUNCTION(mb_encode_numericentity);
-PHP_FUNCTION(mb_decode_numericentity);
-PHP_FUNCTION(mb_send_mail);
-
-ZEND_BEGIN_MODULE_GLOBALS(mbstring)
- int language;
- int current_language;
- int internal_encoding;
- int current_internal_encoding;
- int http_output_encoding;
- int current_http_output_encoding;
- int http_input_identify;
- int http_input_identify_get;
- int http_input_identify_post;
- int http_input_identify_cookie;
- int http_input_identify_string;
- int *http_input_list;
- int http_input_list_size;
- int *detect_order_list;
- int detect_order_list_size;
- int *current_detect_order_list;
- int current_detect_order_list_size;
- int filter_illegal_mode;
- int filter_illegal_substchar;
- int current_filter_illegal_mode;
- int current_filter_illegal_substchar;
- mbfl_buffer_converter *outconv;
-ZEND_END_MODULE_GLOBALS(mbstring);
-
-
-#ifdef ZTS
-#define MBSTRLS_D zend_mbstring_globals *mbstring_globals
-#define MBSTRLS_DC , MBSTRLS_D
-#define MBSTRLS_C mbstring_globals
-#define MBSTRLS_CC , MBSTRLS_C
-#define MBSTRG(v) (mbstring_globals->v)
-#define MBSTRLS_FETCH() zend_mbstring_globals *mbstring_globals = ts_resource(mbstring_globals_id)
-#else
-#define MBSTRLS_D
-#define MBSTRLS_DC
-#define MBSTRLS_C
-#define MBSTRLS_CC
-#define MBSTRG(v) (mbstring_globals.v)
-#define MBSTRLS_FETCH()
-#endif
-
-#else /* HAVE_MBSTRING */
-
-#define mbstring_module_ptr NULL
-
-#endif /* HAVE_MBSTRING */
-
-#define phpext_mbstring_ptr mbstring_module_ptr
-
-#endif /* _MBSTRING_H */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/mcal/CREDITS b/ext/mcal/CREDITS
deleted file mode 100644
index 7d9c3a1290..0000000000
--- a/ext/mcal/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-MCAL
-Mark Musone, Chuck Hagenbuch
diff --git a/ext/mcal/Makefile.in b/ext/mcal/Makefile.in
deleted file mode 100644
index cda0b29b9e..0000000000
--- a/ext/mcal/Makefile.in
+++ /dev/null
@@ -1,7 +0,0 @@
-
-LTLIBRARY_NAME = libmcal.la
-LTLIBRARY_SOURCES = php_mcal.c
-LTLIBRARY_SHARED_NAME = mcal.la
-LTLIBRARY_SHARED_LIBADD = $(MCAL_SHARED_LIBADD)
-
-include $(top_srcdir)/build/dynlib.mk
diff --git a/ext/mcal/config.m4 b/ext/mcal/config.m4
deleted file mode 100644
index 6a6e6eea85..0000000000
--- a/ext/mcal/config.m4
+++ /dev/null
@@ -1,48 +0,0 @@
-dnl $Id$
-
-PHP_ARG_WITH(mcal,for MCAL support,
-[ --with-mcal[=DIR] Include MCAL support.])
-
-if test "$PHP_MCAL" != "no"; then
- MCAL_DEFAULT_SEARCH=/usr/local
- if test "$PHP_MCAL" = "yes"; then
- MCAL_DIR=$MCAL_DEFAULT_SEARCH
- else
- PHP_EXPAND_PATH($PHP_MCAL, MCAL_DIR)
- fi
-
- for i in $MCAL_DIR $MCAL_DIR/mcal $MCAL_DIR/mcal/include $MCAL_DIR/include/mcal $MCAL_DIR/include; do
- if test -r "$i/mcal.h"; then
- MCAL_INCLUDE=$i
- fi
- done
-
- for i in $MCAL_DIR $MCAL_DIR/mcal $MCAL_DIR/mcal/lib $MCAL_DIR/lib/mcal $MCAL_DIR/lib; do
- if test -r "$i/libmcal.a"; then
- MCAL_LIBRARY=$i
- fi
- done
-
- if test ! -f "$MCAL_INCLUDE/mcal.h"; then
- AC_MSG_ERROR(Unable to locate your libmcal header files - mcal.h should be in the directory you specify or in the include/ subdirectory below it - default search location is $MCAL_DEFAULT_SEARCH)
- fi
-
- if test ! -f "$MCAL_INCLUDE/cal_misc.h"; then
- AC_MSG_ERROR(Unable to locate your libmcal header files - cal_misc.h should be in the directory you specify or in the include/ subdirectory below it - default search location is $MCAL_DEFAULT_SEARCH)
- fi
-
- if test ! -f "$MCAL_INCLUDE/icalroutines.h"; then
- AC_MSG_ERROR(Unable to locate your libmcal header files - icalroutines.h should be in the directory you specify or in the include/ subdirectory below it - default search location is $MCAL_DEFAULT_SEARCH)
- fi
-
- if test ! -f "$MCAL_LIBRARY/libmcal.a"; then
- AC_MSG_ERROR(Unable to locate your libmcal library files - libmcal.a should be in the directory you specify or in the lib/ subdirectory below it - default search location is $MCAL_DEFAULT_SEARCH)
- fi
-
- PHP_ADD_INCLUDE($MCAL_INCLUDE)
- PHP_ADD_LIBRARY_WITH_PATH(mcal, $MCAL_LIBRARY, MCAL_SHARED_LIBADD)
- PHP_SUBST(MCAL_SHARED_LIBADD)
- AC_DEFINE(HAVE_MCAL,1,[ ])
- PHP_EXTENSION(mcal,$ext_shared)
-fi
-
diff --git a/ext/mcal/php_mcal.c b/ext/mcal/php_mcal.c
deleted file mode 100644
index cb42cbd962..0000000000
--- a/ext/mcal/php_mcal.c
+++ /dev/null
@@ -1,1620 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Mark Musone <musone@chek.com> |
- | Chuck Hagenbuch <chuck@horde.org> |
- +----------------------------------------------------------------------+
-*/
-
-#define MCAL1
-
-#ifdef ERROR
-#undef ERROR
-#endif
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-
-#if HAVE_MCAL
-
-#include <time.h>
-#include <stdio.h>
-#include <ctype.h>
-#include <signal.h>
-#include <stdarg.h>
-#include "mcal.h"
-#include "php_mcal.h"
-#include "zend_modules.h"
-#include "ext/standard/info.h"
-#include "ext/standard/basic_functions.h"
-#ifdef PHP_WIN32
-#include "winsock.h"
-#endif
-
-void cal_close_it(zend_rsrc_list_entry *rsrc);
-
-typedef struct _php_mcal_le_struct {
- CALSTREAM *mcal_stream;
- long public;
- CALEVENT *event;
- long flags;
-} pils;
-
-
-typedef struct cal_list {
- php_uint32 uid;
- struct cal_list *next;
-} cal_list_t;
-
-static cal_list_t *g_cal_list=NULL;
-static cal_list_t *g_cal_list_end=NULL;
-/*
- * this array should be set up as:
- * {"PHPScriptFunctionName",dllFunctionName,1}
- */
-
-function_entry mcal_functions[] = {
- PHP_FE(mcal_open,NULL)
- PHP_FE(mcal_close,NULL)
- PHP_FE(mcal_popen,NULL)
- PHP_FE(mcal_reopen,NULL)
- PHP_FE(mcal_fetch_event,NULL)
- PHP_FE(mcal_list_events,NULL)
- PHP_FE(mcal_list_alarms,NULL)
- PHP_FE(mcal_create_calendar,NULL)
- PHP_FE(mcal_rename_calendar,NULL)
- PHP_FE(mcal_delete_calendar,NULL)
- PHP_FE(mcal_delete_event,NULL)
- PHP_FE(mcal_append_event,NULL)
- PHP_FE(mcal_store_event,NULL)
- PHP_FE(mcal_snooze,NULL)
- PHP_FE(mcal_event_set_category,NULL)
- PHP_FE(mcal_event_set_title,NULL)
- PHP_FE(mcal_event_set_description,NULL)
- PHP_FE(mcal_event_set_start,NULL)
- PHP_FE(mcal_event_set_end,NULL)
- PHP_FE(mcal_event_set_alarm,NULL)
- PHP_FE(mcal_event_set_class,NULL)
- PHP_FE(mcal_event_add_attribute,NULL)
- PHP_FE(mcal_is_leap_year,NULL)
- PHP_FE(mcal_days_in_month,NULL)
- PHP_FE(mcal_date_valid,NULL)
- PHP_FE(mcal_time_valid,NULL)
- PHP_FE(mcal_day_of_week,NULL)
- PHP_FE(mcal_day_of_year,NULL)
- PHP_FE(mcal_week_of_year,NULL)
- PHP_FE(mcal_date_compare,NULL)
- PHP_FE(mcal_event_init,NULL)
- PHP_FE(mcal_next_recurrence,NULL)
- PHP_FE(mcal_event_set_recur_none,NULL)
- PHP_FE(mcal_event_set_recur_daily,NULL)
- PHP_FE(mcal_event_set_recur_weekly,NULL)
- PHP_FE(mcal_event_set_recur_monthly_mday,NULL)
- PHP_FE(mcal_event_set_recur_monthly_wday,NULL)
- PHP_FE(mcal_event_set_recur_yearly,NULL)
- PHP_FE(mcal_fetch_current_stream_event,NULL)
- {NULL, NULL, NULL}
-};
-
-zend_module_entry php_mcal_module_entry = {
- "mcal", mcal_functions, PHP_MINIT(mcal), NULL, NULL, NULL, PHP_MINFO(mcal), STANDARD_MODULE_PROPERTIES
-};
-
-#ifdef COMPILE_DL_MCAL
-ZEND_GET_MODULE(php_mcal)
-#endif
-
-/*
- I believe since this global is used ONLY within this module,
- and nothing will link to this module, we can use the simple
- thread local_ storage
-*/
-int le_mcal;
-char *mcal_user;
-char *mcal_password;
-
-void cal_close_it (zend_rsrc_list_entry *rsrc)
-{
- pils *mcal_le_struct = (pils *)rsrc->ptr;
- cal_close (mcal_le_struct->mcal_stream,0);
- efree(mcal_le_struct);
-}
-
-
-PHP_MINFO_FUNCTION(mcal)
-{
- char tmp[128];
-
- php_info_print_table_start();
- php_info_print_table_row(2, "MCAL Support", "enabled" );
-#ifdef MCALVER
- snprintf(tmp, 128, "%s<BR>%d", CALVER, MCALVER);
-#else
- snprintf(tmp, 128, "%s", CALVER );
-#endif
- php_info_print_table_row(2, "MCAL Version", tmp );
- php_info_print_table_end();
-}
-
-PHP_MINIT_FUNCTION(mcal)
-{
- le_mcal = zend_register_list_destructors_ex(cal_close_it, NULL, "mcal", module_number);
-
- REGISTER_MAIN_LONG_CONSTANT("MCAL_SUNDAY", SUNDAY, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_LONG_CONSTANT("MCAL_MONDAY", MONDAY, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_LONG_CONSTANT("MCAL_TUESDAY", TUESDAY, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_LONG_CONSTANT("MCAL_WEDNESDAY", WEDNESDAY, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_LONG_CONSTANT("MCAL_THURSDAY", THURSDAY, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_LONG_CONSTANT("MCAL_FRIDAY", FRIDAY, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_LONG_CONSTANT("MCAL_SATURDAY", SATURDAY, CONST_PERSISTENT | CONST_CS);
-
- REGISTER_MAIN_LONG_CONSTANT("MCAL_JANUARY", JANUARY, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_LONG_CONSTANT("MCAL_FEBRUARY", FEBRUARY, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_LONG_CONSTANT("MCAL_MARCH", MARCH, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_LONG_CONSTANT("MCAL_APRIL", APRIL, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_LONG_CONSTANT("MCAL_MAY", MAY, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_LONG_CONSTANT("MCAL_JUNE", JUNE, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_LONG_CONSTANT("MCAL_JULY", JULY, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_LONG_CONSTANT("MCAL_AUGUST", AUGUST, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_LONG_CONSTANT("MCAL_SEPTEMBER", SEPTEMBER, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_LONG_CONSTANT("MCAL_OCTOBER", OCTOBER, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_LONG_CONSTANT("MCAL_NOVEMBER", NOVEMBER, CONST_PERSISTENT | CONST_CS);
-
- REGISTER_MAIN_LONG_CONSTANT("MCAL_RECUR_NONE", RECUR_NONE, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_LONG_CONSTANT("MCAL_RECUR_DAILY", RECUR_DAILY, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_LONG_CONSTANT("MCAL_RECUR_WEEKLY", RECUR_WEEKLY, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_LONG_CONSTANT("MCAL_RECUR_MONTHLY_MDAY", RECUR_MONTHLY_MDAY, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_LONG_CONSTANT("MCAL_RECUR_MONTHLY_WDAY", RECUR_MONTHLY_WDAY, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_LONG_CONSTANT("MCAL_RECUR_YEARLY", RECUR_YEARLY, CONST_PERSISTENT | CONST_CS);
-
- REGISTER_MAIN_LONG_CONSTANT("MCAL_M_SUNDAY", M_SUNDAY, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_LONG_CONSTANT("MCAL_M_MONDAY", M_MONDAY, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_LONG_CONSTANT("MCAL_M_TUESDAY", M_TUESDAY, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_LONG_CONSTANT("MCAL_M_WEDNESDAY", M_WEDNESDAY, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_LONG_CONSTANT("MCAL_M_THURSDAY", M_THURSDAY, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_LONG_CONSTANT("MCAL_M_FRIDAY", M_FRIDAY, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_LONG_CONSTANT("MCAL_M_SATURDAY", M_SATURDAY, CONST_PERSISTENT | CONST_CS);
-
- REGISTER_MAIN_LONG_CONSTANT("MCAL_M_WEEKDAYS", M_WEEKDAYS, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_LONG_CONSTANT("MCAL_M_WEEKEND", M_WEEKEND, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_LONG_CONSTANT("MCAL_M_ALLDAYS", M_ALLDAYS, CONST_PERSISTENT | CONST_CS);
-
- return SUCCESS;
-}
-
-static int add_assoc_object(zval *arg, char *key, zval *tmp)
-{
- HashTable *symtable;
-
- if (arg->type == IS_OBJECT) {
- symtable = arg->value.obj.properties;
- } else {
- symtable = arg->value.ht;
- }
- return zend_hash_update(symtable, key, strlen(key)+1, (void *)&tmp, sizeof(zval *), NULL);
-}
-
-void php_mcal_do_open(INTERNAL_FUNCTION_PARAMETERS, int persistent)
-{
- zval **calendar, **user, **passwd, **options;
- CALSTREAM *mcal_stream;
- pils *mcal_le_struct;
- long flags=0;
- int ind;
-
- int myargc = ZEND_NUM_ARGS();
- if (myargc < 3 || myargc > 4 || zend_get_parameters_ex(myargc, &calendar, &user, &passwd, &options) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(calendar);
- convert_to_string_ex(user);
- convert_to_string_ex(passwd);
- mcal_user = estrndup(Z_STRVAL_PP(user), Z_STRLEN_PP(user));
- mcal_password = estrndup(Z_STRVAL_PP(passwd), Z_STRLEN_PP(passwd));
- if (myargc == 4) {
- convert_to_long_ex(options);
- flags = (*options)->value.lval;
- }
- mcal_stream = cal_open(NULL, (*calendar)->value.str.val, 0);
- efree(mcal_user);
- efree(mcal_password);
-
- if (!mcal_stream) {
- php_error(E_WARNING, "Couldn't open stream %s\n", (*calendar)->value.str.val);
- RETURN_FALSE;
- }
-
- mcal_le_struct = emalloc(sizeof(pils));
- mcal_le_struct->mcal_stream = mcal_stream;
- mcal_le_struct->event=calevent_new();
-
- ind = zend_list_insert(mcal_le_struct, le_mcal);
- RETURN_LONG(ind);
-}
-
-void php_mcal_event_init(struct _php_mcal_le_struct *mystruct)
-{
- calevent_free(mystruct->event);
- mystruct->event=calevent_new();
-}
-
-void _php_make_event_object(zval *myzvalue, CALEVENT *event)
-{
- zval *start, *end, *recurend, *attrlist;
- CALATTR *attr;
-
- object_init(myzvalue);
- add_property_long(myzvalue,"id",event->id);
- add_property_long(myzvalue,"public",event->public);
-
- MAKE_STD_ZVAL(start);
- object_init(start);
- if (event->start.has_date) {
- add_property_long(start,"year",event->start.year);
- add_property_long(start,"month",event->start.mon);
- add_property_long(start,"mday",event->start.mday);
- }
- if (event->start.has_time) {
- add_property_long(start,"hour",event->start.hour);
- add_property_long(start,"min",event->start.min);
- add_property_long(start,"sec",event->start.sec);
- }
- add_assoc_object(myzvalue, "start", start);
-
- MAKE_STD_ZVAL(end);
- object_init(end);
- if (event->end.has_date) {
- add_property_long(end,"year",event->end.year);
- add_property_long(end,"month",event->end.mon);
- add_property_long(end,"mday",event->end.mday);
- }
- if (event->end.has_time) {
- add_property_long(end,"hour",event->end.hour);
- add_property_long(end,"min",event->end.min);
- add_property_long(end,"sec",event->end.sec);
- }
- add_assoc_object(myzvalue, "end", end);
-
- if (event->category)
- add_property_string(myzvalue,"category",event->category,1);
- if (event->title)
- add_property_string(myzvalue,"title",event->title,1);
- if (event->description)
- add_property_string(myzvalue,"description",event->description,1);
- add_property_long(myzvalue,"alarm",event->alarm);
- add_property_long(myzvalue,"recur_type",event->recur_type);
- add_property_long(myzvalue,"recur_interval",event->recur_interval);
-
- MAKE_STD_ZVAL(recurend);
- object_init(recurend);
- if (event->recur_enddate.has_date) {
- add_property_long(recurend,"year",event->recur_enddate.year);
- add_property_long(recurend,"month",event->recur_enddate.mon);
- add_property_long(recurend,"mday",event->recur_enddate.mday);
- }
- if (event->recur_enddate.has_time) {
- add_property_long(recurend,"hour",event->recur_enddate.hour);
- add_property_long(recurend,"min",event->recur_enddate.min);
- add_property_long(recurend,"sec",event->recur_enddate.sec);
- }
- add_assoc_object(myzvalue, "recur_enddate", recurend);
-
- add_property_long(myzvalue,"recur_data",event->recur_data.weekly_wday);
-
- if (event->attrlist) {
- MAKE_STD_ZVAL(attrlist);
- object_init(attrlist);
- array_init(attrlist);
- for (attr = event->attrlist; attr; attr = attr->next) {
- add_assoc_string(attrlist, attr->name, attr->value, 1);
- }
- add_assoc_object(myzvalue, "attrlist", attrlist);
- }
-}
-
-/* {{{ proto int mcal_close(int stream_id [, int options])
- Close an MCAL stream */
-PHP_FUNCTION(mcal_close)
-{
- zval **options, **streamind;
- int ind, ind_type;
- pils *mcal_le_struct=NULL;
- int myargcount=ZEND_NUM_ARGS();
- long flags = 0;
-
- if (myargcount < 1 || myargcount > 2 || zend_get_parameters_ex(myargcount, &streamind, &options) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(streamind);
- ind = (*streamind)->value.lval;
- mcal_le_struct = (pils *)zend_list_find(ind, &ind_type);
- if (!mcal_le_struct) {
- php_error(E_WARNING, "Unable to find stream pointer");
- RETURN_FALSE;
- }
- if (myargcount==2) {
- convert_to_long_ex(options);
- flags = (*options)->value.lval;
- mcal_le_struct->flags = flags;
- }
- zend_list_delete(ind);
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int mcal_open(string calendar, string user, string password [, int options])
- Open an MCAL stream to a calendar */
-PHP_FUNCTION(mcal_open)
-{
- php_mcal_do_open(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-/* }}} */
-
-/* {{{ proto string mcal_popen(string calendar, string user, string password [, int options])
- Open a persistent MCAL stream to a calendar */
-PHP_FUNCTION(mcal_popen)
-{
- php_mcal_do_open(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-
-/* {{{ proto int mcal_reopen(int stream_id, string calendar [, int options])
- Reopen MCAL stream to a new calendar */
-PHP_FUNCTION(mcal_reopen)
-{
- zval **streamind, **calendar, **options;
- CALSTREAM *mcal_stream=NULL;
- pils *mcal_le_struct;
- int ind, ind_type;
- long flags=0;
- long cl_flags=0;
- int myargc=ZEND_NUM_ARGS();
-
- if (myargc < 2 || myargc > 3 || zend_get_parameters_ex(myargc, &streamind, &calendar, &options) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(streamind);
- ind = (*streamind)->value.lval;
- mcal_le_struct = (pils *)zend_list_find(ind, &ind_type);
- if (!mcal_le_struct) {
- php_error(E_WARNING, "Unable to find stream pointer");
- RETURN_FALSE;
- }
-
- convert_to_string_ex(calendar);
- if (myargc == 3) {
- convert_to_long_ex(options);
- flags = (*options)->value.lval;
- mcal_le_struct->flags = cl_flags;
- }
- if (mcal_stream == NULL) {
- php_error(E_WARNING,"Couldn't re-open stream\n");
- RETURN_FALSE;
- }
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int mcal_expunge(int stream_id)
- Delete all events marked for deletion */
-PHP_FUNCTION(mcal_expunge)
-{
- zval **streamind;
- int ind, ind_type;
- pils *mcal_le_struct;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &streamind) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(streamind);
- ind = (*streamind)->value.lval;
-
- mcal_le_struct = (pils *)zend_list_find(ind, &ind_type);
- if (!mcal_le_struct) {
- php_error(E_WARNING, "Unable to find stream pointer");
- RETURN_FALSE;
- }
-
- /* cal_expunge (mcal_le_struct->mcal_stream);
- */
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int mcal_fetch_event(int stream_id, int eventid [, int options])
- Fetch an event */
-PHP_FUNCTION(mcal_fetch_event)
-{
- zval **streamind, **eventid, **options=NULL;
- int ind, ind_type;
- pils *mcal_le_struct=NULL;
- CALEVENT *myevent;
- int myargcount=ZEND_NUM_ARGS();
-
- if (myargcount < 1 || myargcount > 3 || zend_get_parameters_ex(myargcount, &streamind, &eventid, &options) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(streamind);
- convert_to_long_ex(eventid);
- ind = (*streamind)->value.lval;
- mcal_le_struct = (pils *)zend_list_find(ind, &ind_type);
- if (!mcal_le_struct) {
- php_error(E_WARNING, "Unable to find stream pointer");
- RETURN_FALSE;
- }
- if (myargcount == 3) {
- convert_to_long_ex(options);
- }
- cal_fetch(mcal_le_struct->mcal_stream, (*eventid)->value.lval, &myevent);
- if (myevent == NULL) {
- RETURN_FALSE;
- }
- calevent_free(mcal_le_struct->event);
- mcal_le_struct->event = myevent;
- _php_make_event_object(return_value, mcal_le_struct->event);
-}
-/* }}} */
-
-/* {{{ proto object mcal_fetch_current_stream_event(int stream_id)
- Fetch the current event stored in the stream's event structure */
-PHP_FUNCTION(mcal_fetch_current_stream_event)
-{
- zval **streamind;
- int ind, ind_type;
- pils *mcal_le_struct=NULL;
- int myargcount=ZEND_NUM_ARGS();
-
- if (myargcount != 1 || zend_get_parameters_ex(1, &streamind) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(streamind);
- ind = (*streamind)->value.lval;
- mcal_le_struct = (pils *)zend_list_find(ind, &ind_type);
- if (!mcal_le_struct) {
- php_error(E_WARNING, "Unable to find stream pointer");
- RETURN_FALSE;
- }
- _php_make_event_object(return_value, mcal_le_struct->event);
-}
-/* }}} */
-
-/* {{{ proto array mcal_list_events(int stream_id, object begindate [, object enddate])
- Returns list of UIDs for that day or range of days */
-PHP_FUNCTION(mcal_list_events)
-{
- zval **streamind, **startyear, **startmonth, **startday;
- zval **endyear, **endmonth, **endday;
- int ind, ind_type;
- pils *mcal_le_struct;
- cal_list_t *my_cal_list;
- int myargc;
- datetime_t startdate=DT_INIT;
- datetime_t enddate=DT_INIT;
-
- myargc = ZEND_NUM_ARGS();
- if ((myargc != 1 && myargc != 7) || zend_get_parameters_ex(myargc, &streamind, &startyear, &startmonth, &startday, &endyear, &endmonth, &endday) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(streamind);
- ind = (*streamind)->value.lval;
- mcal_le_struct = (pils *)zend_list_find(ind, &ind_type);
- if (!mcal_le_struct) {
- php_error(E_WARNING, "Unable to find stream pointer");
- RETURN_FALSE;
- }
-
- /* Initialize return array */
- if (array_init(return_value) == FAILURE) {
- RETURN_FALSE;
- }
-
- if (myargc == 7) {
- convert_to_long_ex(startyear);
- convert_to_long_ex(startmonth);
- convert_to_long_ex(startday);
- convert_to_long_ex(endyear);
- convert_to_long_ex(endmonth);
- convert_to_long_ex(endday);
- dt_setdate(&startdate, (*startyear)->value.lval, (*startmonth)->value.lval, (*startday)->value.lval);
- dt_setdate(&enddate, (*endyear)->value.lval, (*endmonth)->value.lval, (*endday)->value.lval);
- }
- else {
- startdate = mcal_le_struct->event->start;
- enddate = mcal_le_struct->event->end;
- }
-
- g_cal_list = NULL;
- cal_search_range(mcal_le_struct->mcal_stream, &startdate, &enddate);
- my_cal_list = g_cal_list;
- while (my_cal_list != NULL) {
- add_next_index_long(return_value, my_cal_list->uid);
- my_cal_list = my_cal_list->next;
- free(g_cal_list);
- g_cal_list = my_cal_list;
- }
-}
-/* }}} */
-
-/* {{{ proto string mcal_create_calendar(int stream_id, string calendar)
- Create a new calendar */
-PHP_FUNCTION(mcal_create_calendar)
-{
- zval **streamind, **calendar;
- int ind, ind_type;
- pils *mcal_le_struct;
- int myargc = ZEND_NUM_ARGS();
- if (myargc != 2 || zend_get_parameters_ex(2, &streamind, &calendar) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(streamind);
- convert_to_string_ex(calendar);
- ind = (*streamind)->value.lval;
- mcal_le_struct = (pils *)zend_list_find(ind, &ind_type);
- if (!mcal_le_struct) {
- php_error(E_WARNING, "Unable to find stream pointer");
- RETURN_FALSE;
- }
- /*
- if (mcal_create(mcal_le_struct->mcal_stream,calendar->value.str.val))
- {
- RETURN_TRUE;
- }
- else
- {
- RETURN_FALSE;
- }
- */
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto string mcal_rename_calendar(int stream_id, string src_calendar, string dest_calendar)
- Rename a calendar */
-PHP_FUNCTION(mcal_rename_calendar)
-{
- zval **streamind, **src_calendar, **dest_calendar;
- int ind, ind_type;
- pils *mcal_le_struct;
- int myargc=ZEND_NUM_ARGS();
- if (myargc != 3 || zend_get_parameters_ex(3, &streamind, &src_calendar, &dest_calendar) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(streamind);
- convert_to_string_ex(src_calendar);
- convert_to_string_ex(dest_calendar);
-
- ind = (*streamind)->value.lval;
- mcal_le_struct = (pils *)zend_list_find(ind, &ind_type);
- if (!mcal_le_struct) {
- php_error(E_WARNING, "Unable to find stream pointer");
- RETURN_FALSE;
- }
-
- /*
- if(mcal_rename(mcal_le_struct->mcal_stream,src_calendar->value.str.val,dest_calendar->value.str.val)) {RETURN_TRUE;}
- else {RETURN_FALSE; }
- */
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool mcal_list_alarms(int stream_id, int year, int month, int day, int hour, int min, int sec)
- List alarms for a given time */
-PHP_FUNCTION(mcal_list_alarms)
-{
- zval **streamind, **year, **month, **day, **hour, **min, **sec;
- datetime_t mydate=DT_INIT;
- int ind, ind_type;
- pils *mcal_le_struct;
- cal_list_t *my_cal_list;
- int myargc=ZEND_NUM_ARGS();
- if ((myargc != 1 && myargc != 7) || zend_get_parameters_ex(myargc, &streamind, &year, &month, &day, &hour, &min, &sec) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(streamind);
- ind = (*streamind)->value.lval;
- mcal_le_struct = (pils *)zend_list_find(ind, &ind_type);
- if (!mcal_le_struct) {
- php_error(E_WARNING, "Unable to find stream pointer");
- RETURN_FALSE;
- }
-
- if (array_init(return_value) == FAILURE) {
- RETURN_FALSE;
- }
-
- if (myargc == 7) {
- convert_to_long_ex(year);
- convert_to_long_ex(month);
- convert_to_long_ex(day);
- convert_to_long_ex(hour);
- convert_to_long_ex(min);
- convert_to_long_ex(sec);
- dt_setdate(&mydate, (*year)->value.lval, (*month)->value.lval, (*day)->value.lval);
- dt_settime(&mydate, (*hour)->value.lval, (*min)->value.lval, (*sec)->value.lval);
- }
- else {
- mydate = mcal_le_struct->event->start;
- }
- g_cal_list = NULL;
- cal_search_alarm(mcal_le_struct->mcal_stream, &mydate);
- my_cal_list = g_cal_list;
- while (my_cal_list != NULL) {
- add_next_index_long(return_value, my_cal_list->uid);
- my_cal_list = my_cal_list->next;
- free(g_cal_list);
- g_cal_list = my_cal_list;
- }
-}
-/* }}} */
-
-/* {{{ proto string mcal_delete_calendar(int stream_id, string calendar)
- Delete calendar */
-PHP_FUNCTION(mcal_delete_calendar)
-{
- zval **streamind, **calendar;
- int ind, ind_type;
- pils *mcal_le_struct;
- int myargc=ZEND_NUM_ARGS();
- if (myargc != 2 || zend_get_parameters_ex(2, &streamind, &calendar) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(streamind);
- convert_to_string_ex(calendar);
-
- ind = (*streamind)->value.lval;
- mcal_le_struct = (pils *)zend_list_find(ind, &ind_type);
- if (!mcal_le_struct) {
- php_error(E_WARNING, "Unable to find stream pointer");
- RETURN_FALSE;
- }
-
- /* if (mcal_delete_calendar(mcal_le_struct->mcal_stream,calendar->value.str.val))
- {
- RETURN_TRUE;
- }
- else
- {
- RETURN_FALSE;
- }
- */
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto string mcal_delete_event(int stream_id, int event_id)
- Delete an event */
-PHP_FUNCTION(mcal_delete_event)
-{
- zval **streamind, **event_id;
- int ind, ind_type;
- pils *mcal_le_struct;
- int myargc=ZEND_NUM_ARGS();
- if (myargc != 2 || zend_get_parameters_ex(2, &streamind, &event_id) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(streamind);
- convert_to_long_ex(event_id);
-
- ind = (*streamind)->value.lval;
- mcal_le_struct = (pils *)zend_list_find(ind, &ind_type);
- if (!mcal_le_struct) {
- php_error(E_WARNING, "Unable to find stream pointer");
- RETURN_FALSE;
- }
-
- if (cal_remove(mcal_le_struct->mcal_stream, (*event_id)->value.lval)) {
- RETURN_TRUE;
- }
- else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto string mcal_append_event(int stream_id)
- Append a new event to the calendar stream */
-PHP_FUNCTION(mcal_append_event)
-{
- zval **streamind;
- int ind, ind_type;
- pils *mcal_le_struct;
- int myargc;
- unsigned long event_id;
- CALEVENT *myevent=NULL;
-
- myargc = ZEND_NUM_ARGS();
- if (myargc != 1 || zend_get_parameters_ex(1, &streamind) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(streamind);
- ind = (*streamind)->value.lval;
- mcal_le_struct = (pils *)zend_list_find(ind, &ind_type);
- if (!mcal_le_struct) {
- php_error(E_WARNING, "Unable to find stream pointer");
- RETURN_FALSE;
- }
-
- myevent = mcal_le_struct->event;
- cal_append(mcal_le_struct->mcal_stream, "INBOX", &event_id, myevent);
- calevent_free(myevent);
- RETURN_LONG(event_id);
-}
-/* }}} */
-
-/* {{{ proto string mcal_store_event(int stream_id)
- Store changes to an event */
-PHP_FUNCTION(mcal_store_event)
-{
- zval **streamind;
- int ind, ind_type;
- pils *mcal_le_struct;
- int myargc;
- CALEVENT *myevent=NULL;
-
- myargc = ZEND_NUM_ARGS();
- if (myargc != 1 || zend_get_parameters_ex(1, &streamind) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(streamind);
- ind = (*streamind)->value.lval;
- mcal_le_struct = (pils *)zend_list_find(ind, &ind_type);
- if (!mcal_le_struct) {
- php_error(E_WARNING, "Unable to find stream pointer");
- RETURN_FALSE;
- }
-
- myevent = mcal_le_struct->event;
- cal_store(mcal_le_struct->mcal_stream, myevent);
- RETURN_LONG(myevent->id);
-}
-/* }}} */
-
-/* {{{ proto string mcal_snooze(int stream_id, int uid)
- Snooze an alarm */
-PHP_FUNCTION(mcal_snooze)
-{
- zval **streamind, **uid;
- int ind, ind_type;
- pils *mcal_le_struct;
- int myargc;
- myargc = ZEND_NUM_ARGS();
- if (myargc != 2 || zend_get_parameters_ex(2, &streamind, &uid) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(streamind);
- convert_to_long_ex(uid);
-
- ind = (*streamind)->value.lval;
- mcal_le_struct = (pils *)zend_list_find(ind, &ind_type);
- if (!mcal_le_struct) {
- php_error(E_WARNING, "Unable to find stream pointer");
- RETURN_FALSE;
- }
-
- if (cal_snooze(mcal_le_struct->mcal_stream, (*uid)->value.lval)) {
- RETURN_TRUE;
- }
- else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto string mcal_event_set_category(int stream_id, string category)
- Attach a category to an event */
-PHP_FUNCTION(mcal_event_set_category)
-{
- zval **streamind, **category;
- int ind, ind_type;
- pils *mcal_le_struct;
- int myargc;
-
- myargc = ZEND_NUM_ARGS();
- if (myargc != 2 || zend_get_parameters_ex(2, &streamind, &category) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(streamind);
- convert_to_string_ex(category);
-
- ind = (*streamind)->value.lval;
- mcal_le_struct = (pils *)zend_list_find(ind, &ind_type);
- if (!mcal_le_struct) {
- php_error(E_WARNING, "Unable to find stream pointer");
- RETURN_FALSE;
- }
- mcal_le_struct->event->category = strdup((*category)->value.str.val);
-}
-/* }}} */
-
-/* {{{ proto string mcal_event_set_title(int stream_id, string title)
- Attach a title to an event */
-PHP_FUNCTION(mcal_event_set_title)
-{
- zval **streamind, **title;
- int ind, ind_type;
- pils *mcal_le_struct;
- int myargc;
-
- myargc = ZEND_NUM_ARGS();
- if (myargc != 2 || zend_get_parameters_ex(2, &streamind, &title) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(streamind);
- convert_to_string_ex(title);
-
- ind = (*streamind)->value.lval;
- mcal_le_struct = (pils *)zend_list_find(ind, &ind_type);
- if (!mcal_le_struct) {
- php_error(E_WARNING, "Unable to find stream pointer");
- RETURN_FALSE;
- }
- mcal_le_struct->event->title = strdup((*title)->value.str.val);
-}
-/* }}} */
-
-/* {{{ proto string mcal_event_set_description(int stream_id, string description)
- Attach a description to an event */
-PHP_FUNCTION(mcal_event_set_description)
-{
- zval **streamind, **description;
- int ind, ind_type;
- pils *mcal_le_struct;
- int myargc;
-
- myargc = ZEND_NUM_ARGS();
- if (myargc != 2 || zend_get_parameters_ex(2, &streamind, &description) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(streamind);
- convert_to_string_ex(description);
-
- ind = (*streamind)->value.lval;
- mcal_le_struct = (pils *)zend_list_find(ind, &ind_type);
- if (!mcal_le_struct) {
- php_error(E_WARNING, "Unable to find stream pointer");
- RETURN_FALSE;
- }
- mcal_le_struct->event->description = strdup((*description)->value.str.val);
-}
-/* }}} */
-
-/* {{{ proto string mcal_event_set_start(int stream_id, int year,int month, int day [[[, int hour], int min], int sec])
- Attach a start datetime to an event */
-PHP_FUNCTION(mcal_event_set_start)
-{
- zval **streamind, **year, **month, **date, **hour, **min, **sec;
- int ind, ind_type;
- int myhour=0, mymin=0, mysec=0;
- pils *mcal_le_struct;
- int myargc;
-
- myargc = ZEND_NUM_ARGS();
- if (myargc < 4 || myargc > 7 || zend_get_parameters_ex(myargc, &streamind, &year, &month, &date, &hour, &min, &sec) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(streamind);
- convert_to_long_ex(year);
- convert_to_long_ex(month);
- convert_to_long_ex(date);
- if (myargc > 4) convert_to_long_ex(hour);
- if (myargc > 5) convert_to_long_ex(min);
- if (myargc > 6) convert_to_long_ex(sec);
-
- ind = (*streamind)->value.lval;
- mcal_le_struct = (pils *)zend_list_find(ind, &ind_type);
- if (!mcal_le_struct) {
- php_error(E_WARNING, "Unable to find stream pointer");
- RETURN_FALSE;
- }
-
- dt_setdate(&(mcal_le_struct->event->start), (*year)->value.lval, (*month)->value.lval, (*date)->value.lval);
-
- if (myargc > 4) myhour = (*hour)->value.lval;
- if (myargc > 5) mymin = (*min)->value.lval;
- if (myargc > 6) mysec = (*sec)->value.lval;
- if (myargc > 4) dt_settime(&(mcal_le_struct->event->start), myhour, mymin, mysec);
-}
-/* }}} */
-
-/* {{{ proto string mcal_event_set_end(int stream_id, int year,int month, int day [[[, int hour], int min], int sec])
- Attach an end datetime to an event */
-PHP_FUNCTION(mcal_event_set_end)
-{
- zval **streamind, **year, **month, **date, **hour, **min, **sec;
- int ind, ind_type;
- /* initialize these to zero to make sure we don't use them
- uninitialized (and to avoid the gcc warning) */
- int myhour = 0; int mymin = 0; int mysec = 0;
- pils *mcal_le_struct;
- int myargc;
-
- myargc = ZEND_NUM_ARGS();
- if (myargc < 4 || myargc > 7 || zend_get_parameters_ex(myargc, &streamind, &year, &month, &date, &hour, &min, &sec) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(streamind);
- convert_to_long_ex(year);
- convert_to_long_ex(month);
- convert_to_long_ex(date);
- if (myargc > 4) convert_to_long_ex(hour);
- if (myargc > 5) convert_to_long_ex(min);
- if (myargc > 6) convert_to_long_ex(sec);
-
- ind = (*streamind)->value.lval;
- mcal_le_struct = (pils *)zend_list_find(ind, &ind_type);
- if (!mcal_le_struct) {
- php_error(E_WARNING, "Unable to find stream pointer");
- RETURN_FALSE;
- }
-
- dt_setdate(&(mcal_le_struct->event->end), (*year)->value.lval, (*month)->value.lval, (*date)->value.lval);
-
- if (myargc > 4) myhour = (*hour)->value.lval;
- if (myargc > 5) mymin = (*min)->value.lval;
- if (myargc > 6) mysec = (*sec)->value.lval;
- if (myargc > 4) dt_settime(&(mcal_le_struct->event->end), myhour, mymin, mysec);
-}
-/* }}} */
-
-/* {{{ proto int mcal_event_set_alarm(int stream_id, int alarm)
- Add an alarm to the streams global event */
-PHP_FUNCTION(mcal_event_set_alarm)
-{
- zval **streamind, **alarm;
- int ind, ind_type;
- pils *mcal_le_struct;
- int myargc;
- myargc=ZEND_NUM_ARGS();
- if (myargc != 2 || zend_get_parameters_ex(2, &streamind, &alarm) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(streamind);
- convert_to_long_ex(alarm);
-
- ind = (*streamind)->value.lval;
- mcal_le_struct = (pils *)zend_list_find(ind, &ind_type);
- if (!mcal_le_struct) {
- php_error(E_WARNING, "Unable to find stream pointer");
- RETURN_FALSE;
- }
-
- mcal_le_struct->event->alarm = (*alarm)->value.lval;
-}
-/* }}} */
-
-/* {{{ proto int mcal_event_init(int stream_id)
- Initialize a streams global event */
-PHP_FUNCTION(mcal_event_init)
-{
- zval **streamind;
- int ind, ind_type;
- pils *mcal_le_struct;
- int myargc;
-
- myargc = ZEND_NUM_ARGS();
- if (myargc != 1 || zend_get_parameters_ex(1, &streamind) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(streamind);
- ind = (*streamind)->value.lval;
- mcal_le_struct = (pils *)zend_list_find(ind, &ind_type);
- if (!mcal_le_struct) {
- php_error(E_WARNING, "Unable to find stream pointer");
- RETURN_FALSE;
- }
-
- php_mcal_event_init(mcal_le_struct);
-}
-/* }}} */
-
-/* {{{ proto int mcal_event_set_class(int stream_id, int class)
- Add an class to the streams global event */
-PHP_FUNCTION(mcal_event_set_class)
-{
- zval **streamind, **class;
- int ind, ind_type;
- pils *mcal_le_struct;
- int myargc;
-
- myargc = ZEND_NUM_ARGS();
- if (myargc != 2 || zend_get_parameters_ex(2, &streamind, &class) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(streamind);
- convert_to_long_ex(class);
-
- ind = (*streamind)->value.lval;
- mcal_le_struct = (pils *)zend_list_find(ind, &ind_type);
- if (!mcal_le_struct) {
- php_error(E_WARNING, "Unable to find stream pointer");
- RETURN_FALSE;
- }
-
- mcal_le_struct->event->public = (*class)->value.lval;
-}
-/* }}} */
-
-/* {{{ proto string mcal_event_add_attribute(int stream_id, string attribute, string value)
- Add an attribute and value to an event */
-PHP_FUNCTION(mcal_event_add_attribute)
-{
- zval **streamind, **attribute, **val;
- int ind, ind_type;
- pils *mcal_le_struct;
- int myargc;
-
- myargc = ZEND_NUM_ARGS();
- if (myargc != 3 || zend_get_parameters_ex(3, &streamind, &attribute, &val) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(streamind);
- convert_to_string_ex(attribute);
- convert_to_string_ex(val);
-
- ind = (*streamind)->value.lval;
- mcal_le_struct = (pils *)zend_list_find(ind, &ind_type);
- if (!mcal_le_struct) {
- php_error(E_WARNING, "Unable to find stream pointer");
- RETURN_FALSE;
- }
-#if MCALVER >= 20000121
- if (calevent_setattr(mcal_le_struct->event, (*attribute)->value.str.val, (*val)->value.str.val)) {
- RETURN_TRUE;
- }
- else
-#endif
- {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto bool mcal_is_leap_year(int year)
- Returns true if year is a leap year, false if not */
-PHP_FUNCTION(mcal_is_leap_year)
-{
- zval **year;
- int myargc;
-
- myargc = ZEND_NUM_ARGS();
- if (myargc != 1 || zend_get_parameters_ex(1, &year) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(year);
-
- if (isleapyear((*year)->value.lval)) {
- RETURN_TRUE;
- }
- else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto int mcal_days_in_month(int month, bool leap_year)
- Returns the number of days in the given month, needs to know if the year is a leap year or not */
-PHP_FUNCTION(mcal_days_in_month)
-{
- zval **month, **leap;
- int myargc;
-
- myargc = ZEND_NUM_ARGS();
- if (myargc != 2 || zend_get_parameters_ex(2, &month, &leap) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(month);
- convert_to_long_ex(leap);
- convert_to_boolean_ex(leap);
-
- RETURN_LONG(daysinmonth((*month)->value.lval, (*leap)->value.lval));
-}
-/* }}} */
-
-/* {{{ proto bool mcal_date_valid(int year, int month, int day)
- Returns true if the date is a valid date */
-PHP_FUNCTION(mcal_date_valid)
-{
- zval **year, **month, **day;
- int myargc;
-
- myargc = ZEND_NUM_ARGS();
- if (myargc != 3 || zend_get_parameters_ex(3, &year, &month, &day) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(year);
- convert_to_long_ex(month);
- convert_to_long_ex(day);
-
- if (datevalid((*year)->value.lval, (*month)->value.lval, (*day)->value.lval)) {
- RETURN_TRUE;
- }
- else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto bool mcal_time_valid(int hour, int min, int sec)
- Returns true if the time is a valid time */
-PHP_FUNCTION(mcal_time_valid)
-{
- zval **hour, **min, **sec;
- int myargc;
-
- myargc = ZEND_NUM_ARGS();
- if (myargc != 3 || zend_get_parameters_ex(3, &hour, &min, &sec) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(hour);
- convert_to_long_ex(min);
- convert_to_long_ex(sec);
-
- if (timevalid((*hour)->value.lval, (*min)->value.lval, (*sec)->value.lval)) {
- RETURN_TRUE;
- }
- else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto int mcal_day_of_week(int year, int month, int day)
- Returns the day of the week of the given date */
-PHP_FUNCTION(mcal_day_of_week)
-{
- zval **year, **month, **day;
- int myargc;
- datetime_t mydate;
-
- myargc = ZEND_NUM_ARGS();
- if (myargc != 3 || zend_get_parameters_ex(3, &year, &month, &day) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(year);
- convert_to_long_ex(month);
- convert_to_long_ex(day);
-
- dt_init(&mydate);
- dt_setdate(&mydate, (*year)->value.lval, (*month)->value.lval, (*day)->value.lval);
-
- RETURN_LONG(dt_dayofweek(&mydate));
-}
-/* }}} */
-
-/* {{{ proto int mcal_day_of_year(int year, int month, int day)
- Returns the day of the year of the given date */
-PHP_FUNCTION(mcal_day_of_year)
-{
- zval **year, **month, **day;
- int myargc;
- datetime_t mydate;
-
- myargc = ZEND_NUM_ARGS();
- if (myargc != 3 || zend_get_parameters_ex(3, &year, &month, &day) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(year);
- convert_to_long_ex(month);
- convert_to_long_ex(day);
-
- dt_init(&mydate);
- dt_setdate(&mydate, (*year)->value.lval, (*month)->value.lval, (*day)->value.lval);
-
- RETURN_LONG(dt_dayofyear(&mydate));
-}
-/* }}} */
-
-/* {{{ proto int mcal_week_of_year(int day, int month, int year)
- Returns the week number of the given date */
-PHP_FUNCTION(mcal_week_of_year)
-{
- zval **year, **month, **day;
- int myargc;
-
- myargc = ZEND_NUM_ARGS();
- if (myargc != 3 || zend_get_parameters_ex(3, &day, &month, &year) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(year);
- convert_to_long_ex(month);
- convert_to_long_ex(day);
-
- if (datevalid((*year)->value.lval, (*month)->value.lval, (*day)->value.lval)) {
- RETURN_LONG(dt_weekofyear((*day)->value.lval, (*month)->value.lval, (*year)->value.lval));
- }
- else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto int mcal_date_compare(int ayear, int amonth, int aday, int byear, int bmonth, int bday)
- Returns <0, 0, >0 if a<b, a==b, a>b respectively */
-PHP_FUNCTION(mcal_date_compare)
-{
- zval **ayear, **amonth, **aday;
- zval **byear, **bmonth, **bday;
- int myargc;
- datetime_t myadate, mybdate;
-
- myargc = ZEND_NUM_ARGS();
- if (myargc != 6 || zend_get_parameters_ex(6, &ayear, &amonth, &aday, &byear, &bmonth, &bday) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(ayear);
- convert_to_long_ex(amonth);
- convert_to_long_ex(aday);
- convert_to_long_ex(byear);
- convert_to_long_ex(bmonth);
- convert_to_long_ex(bday);
-
- dt_init(&myadate);
- dt_init(&mybdate);
- dt_setdate(&myadate, (*ayear)->value.lval, (*amonth)->value.lval, (*aday)->value.lval);
- dt_setdate(&mybdate, (*byear)->value.lval, (*bmonth)->value.lval, (*bday)->value.lval);
-
- RETURN_LONG(dt_compare(&myadate, &mybdate));
-}
-/* }}} */
-
-/* {{{ proto object mcal_next_recurrence(int stream_id, int weekstart, array next)
- Returns an object filled with the next date the event occurs, on or after the supplied date. Returns empty date field if event does not occur or something is invalid. */
-PHP_FUNCTION(mcal_next_recurrence)
-{
- zval **streamind, **weekstart, **next, **zvalue;
- int ind, ind_type;
- pils *mcal_le_struct;
- int myargc;
- datetime_t mydate;
-
- myargc=ZEND_NUM_ARGS();
- if (myargc != 3 || zend_get_parameters_ex(3, &streamind, &weekstart, &next) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(streamind);
- convert_to_long_ex(weekstart);
- convert_to_array_ex(next);
-
- ind = (*streamind)->value.lval;
- mcal_le_struct = (pils *)zend_list_find(ind, &ind_type);
- if (!mcal_le_struct) {
- php_error(E_WARNING, "Unable to find stream pointer");
- RETURN_FALSE;
- }
-
- if (zend_hash_find((*next)->value.ht, "year", sizeof("year"), (void **) &zvalue) == SUCCESS) {
- SEPARATE_ZVAL(zvalue);
- convert_to_long_ex(zvalue);
- mydate.year = (*zvalue)->value.lval;
- }
- if (zend_hash_find((*next)->value.ht, "month", sizeof("month"), (void **) &zvalue) == SUCCESS) {
- SEPARATE_ZVAL(zvalue);
- convert_to_long_ex(zvalue);
- mydate.mon = (*zvalue)->value.lval;
- }
- if (zend_hash_find((*next)->value.ht, "mday", sizeof("mday"), (void **) &zvalue) == SUCCESS) {
- SEPARATE_ZVAL(zvalue);
- convert_to_long_ex(zvalue);
- mydate.mday = (*zvalue)->value.lval;
- }
- if (zend_hash_find((*next)->value.ht, "hour", sizeof("hour"), (void **) &zvalue) == SUCCESS) {
- SEPARATE_ZVAL(zvalue);
- convert_to_long_ex(zvalue);
- mydate.hour = (*zvalue)->value.lval;
- }
- if (zend_hash_find((*next)->value.ht, "min", sizeof("min"), (void **) &zvalue) == SUCCESS) {
- SEPARATE_ZVAL(zvalue);
- convert_to_long_ex(zvalue);
- mydate.min = (*zvalue)->value.lval;
- }
- if (zend_hash_find((*next)->value.ht, "sec", sizeof("sec"), (void **) &zvalue) == SUCCESS) {
- SEPARATE_ZVAL(zvalue);
- convert_to_long_ex(zvalue);
- mydate.sec = (*zvalue)->value.lval;
- }
-
- calevent_next_recurrence(mcal_le_struct->event, &mydate, (*weekstart)->value.lval);
-
- if (object_init(return_value) == FAILURE) {
- RETURN_FALSE;
- }
-
- if (mydate.has_date) {
- add_property_long(return_value, "year", mydate.year);
- add_property_long(return_value, "month", mydate.mon);
- add_property_long(return_value, "mday", mydate.mday);
- }
- if (mydate.has_time) {
- add_property_long(return_value, "hour", mydate.hour);
- add_property_long(return_value, "min", mydate.min);
- add_property_long(return_value, "sec", mydate.sec);
- }
-}
-/* }}} */
-
-/* {{{ proto string mcal_event_set_recur_none(int stream_id)
- Create a daily recurrence */
-PHP_FUNCTION(mcal_event_set_recur_none)
-{
- zval **streamind;
- int ind, ind_type;
- pils *mcal_le_struct;
- int myargc;
-
- myargc = ZEND_NUM_ARGS();
- if (myargc != 1 || zend_get_parameters_ex(1, &streamind) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(streamind);
-
- ind = (*streamind)->value.lval;
- mcal_le_struct = (pils *)zend_list_find(ind, &ind_type);
- if (!mcal_le_struct) {
- php_error(E_WARNING, "Unable to find stream pointer");
- RETURN_FALSE;
- }
-
- calevent_recur_none(mcal_le_struct->event);
-}
-/* }}} */
-
-/* {{{ proto string mcal_event_set_recur_daily(int stream_id, int year, int month, int day, int interval)
- Create a daily recurrence */
-PHP_FUNCTION(mcal_event_set_recur_daily)
-{
- zval **streamind, **year, **month, **day, **interval;
- int ind, ind_type;
- pils *mcal_le_struct;
- int myargc;
- datetime_t endtime = DT_INIT;
-
- myargc = ZEND_NUM_ARGS();
- if (myargc != 5 || zend_get_parameters_ex(5, &streamind, &year, &month, &day, &interval) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(streamind);
- convert_to_long_ex(year);
- convert_to_long_ex(month);
- convert_to_long_ex(day);
- convert_to_long_ex(interval);
-
- ind = (*streamind)->value.lval;
- mcal_le_struct = (pils *)zend_list_find(ind, &ind_type);
- if (!mcal_le_struct) {
- php_error(E_WARNING, "Unable to find stream pointer");
- RETURN_FALSE;
- }
-
- dt_setdate(&endtime, (*year)->value.lval, (*month)->value.lval, (*day)->value.lval);
- calevent_recur_daily(mcal_le_struct->event, &endtime, (*interval)->value.lval);
-}
-/* }}} */
-
-/* {{{ proto string mcal_event_set_recur_weekly(int stream_id, int year, int month, int day, int interval, int weekdays)
- Create a weekly recurrence */
-PHP_FUNCTION(mcal_event_set_recur_weekly)
-{
- zval **streamind, **year, **month, **day, **interval, **weekdays;
- int ind, ind_type;
- pils *mcal_le_struct;
- int myargc;
- datetime_t endtime=DT_INIT;
-
- myargc = ZEND_NUM_ARGS();
- if (myargc != 6 || zend_get_parameters_ex(6, &streamind, &year, &month, &day, &interval, &weekdays) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(streamind);
- convert_to_long_ex(year);
- convert_to_long_ex(month);
- convert_to_long_ex(day);
- convert_to_long_ex(interval);
- convert_to_long_ex(weekdays);
-
- ind = (*streamind)->value.lval;
- mcal_le_struct = (pils *)zend_list_find(ind, &ind_type);
- if (!mcal_le_struct) {
- php_error(E_WARNING, "Unable to find stream pointer");
- RETURN_FALSE;
- }
-
- dt_setdate(&endtime, (*year)->value.lval, (*month)->value.lval, (*day)->value.lval);
- calevent_recur_weekly(mcal_le_struct->event, &endtime, (*interval)->value.lval, (*weekdays)->value.lval);
-}
-/* }}} */
-
-/* {{{ proto string mcal_event_set_recur_monthly_mday(int stream_id, int year, int month, int day, int interval)
- Create a monthly by day recurrence */
-PHP_FUNCTION(mcal_event_set_recur_monthly_mday)
-{
- zval **streamind, **year, **month, **day, **interval;
- int ind, ind_type;
- pils *mcal_le_struct;
- int myargc;
- datetime_t endtime=DT_INIT;
-
- myargc = ZEND_NUM_ARGS();
- if (myargc != 5 || zend_get_parameters_ex(5, &streamind, &year, &month, &day, &interval) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(streamind);
- convert_to_long_ex(year);
- convert_to_long_ex(month);
- convert_to_long_ex(day);
- convert_to_long_ex(interval);
-
- ind = (*streamind)->value.lval;
- mcal_le_struct = (pils *)zend_list_find(ind, &ind_type);
- if (!mcal_le_struct) {
- php_error(E_WARNING, "Unable to find stream pointer");
- RETURN_FALSE;
- }
-
- dt_setdate(&endtime, (*year)->value.lval, (*month)->value.lval, (*day)->value.lval);
- calevent_recur_monthly_mday(mcal_le_struct->event, &endtime, (*interval)->value.lval);
-}
-/* }}} */
-
-/* {{{ proto string mcal_event_set_recur_monthly_wday(int stream_id, int year, int month, int day, int interval)
- Create a monthly by week recurrence */
-PHP_FUNCTION(mcal_event_set_recur_monthly_wday)
-{
- zval **streamind, **year, **month, **day, **interval;
- int ind, ind_type;
- pils *mcal_le_struct;
- int myargc;
- datetime_t endtime=DT_INIT;
-
- myargc = ZEND_NUM_ARGS();
- if (myargc != 5 || zend_get_parameters_ex(5, &streamind, &year, &month, &day, &interval) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(streamind);
- convert_to_long_ex(year);
- convert_to_long_ex(month);
- convert_to_long_ex(day);
- convert_to_long_ex(interval);
-
- ind = (*streamind)->value.lval;
- mcal_le_struct = (pils *)zend_list_find(ind, &ind_type);
- if (!mcal_le_struct) {
- php_error(E_WARNING, "Unable to find stream pointer");
- RETURN_FALSE;
- }
-
- dt_setdate(&endtime, (*year)->value.lval, (*month)->value.lval, (*day)->value.lval);
- calevent_recur_monthly_wday(mcal_le_struct->event, &endtime, (*interval)->value.lval);
-}
-/* }}} */
-
-/* {{{ proto string mcal_event_set_recur_yearly(int stream_id, int year, int month, int day, int interval)
- Create a yearly recurrence */
-PHP_FUNCTION(mcal_event_set_recur_yearly)
-{
- zval **streamind, **year, **month, **day, **interval;
- int ind, ind_type;
- pils *mcal_le_struct;
- int myargc;
- datetime_t endtime=DT_INIT;
-
- myargc = ZEND_NUM_ARGS();
- if (myargc != 5 || zend_get_parameters_ex(5, &streamind, &year, &month, &day, &interval) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(streamind);
- convert_to_long_ex(year);
- convert_to_long_ex(month);
- convert_to_long_ex(day);
- convert_to_long_ex(interval);
-
- ind = (*streamind)->value.lval;
- mcal_le_struct = (pils *)zend_list_find(ind, &ind_type);
- if (!mcal_le_struct) {
- php_error(E_WARNING, "Unable to find stream pointer");
- RETURN_FALSE;
- }
-
- dt_setdate(&endtime, (*year)->value.lval, (*month)->value.lval, (*day)->value.lval);
- calevent_recur_yearly(mcal_le_struct->event, &endtime, (*interval)->value.lval);
-}
-/* }}} */
-
-
-/* Interfaces to callbacks */
-void cc_searched (unsigned long cal_uid)
-{
- if (g_cal_list == NULL) {
- g_cal_list = malloc(sizeof(struct cal_list));
- g_cal_list->uid = cal_uid;
- g_cal_list->next = NULL;
- g_cal_list_end = g_cal_list;
- }
- else {
- g_cal_list_end->next = malloc(sizeof(struct cal_list));
- g_cal_list_end = g_cal_list_end->next;
- g_cal_list_end->uid = cal_uid;
- g_cal_list_end->next = NULL;
- }
-}
-
-void cc_appended(php_uint32 uid)
-{
-}
-
-void cc_fetched(const CALEVENT *event)
-{
-}
-
-void cc_login(const char **user, const char **pwd)
-{
- *user=mcal_user;
- *pwd=mcal_password;
-}
-
-void cc_vlog(const char *fmt,va_list ap)
-{
-}
-
-void cc_vdlog(const char *fmt,va_list ap)
-{
-}
-
-#endif
-
-/*
- * Local_ variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/mcal/php_mcal.h b/ext/mcal/php_mcal.h
deleted file mode 100644
index 902c25dcc2..0000000000
--- a/ext/mcal/php_mcal.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/* $Id$ */
-
-#ifndef PHP_MCAL_H
-#define PHP_MCAL_H
-
-#if HAVE_MCAL
-
-#ifndef PHP_WIN32
-#include "build-defs.h"
-#endif
-
-/* Functions accessable to PHP */
-/* extern zend_module_entry php_mcal_module_entry; */
-extern zend_module_entry php_mcal_module_entry;
-#define php_mcal_module_ptr &php_mcal_module_entry
-#define phpext_mcal_ptr php_mcal_module_ptr
-
-#ifdef ZEND_VERSION
-extern PHP_MINIT_FUNCTION(mcal);
-PHP_MINFO_FUNCTION(mcal);
-#else
-extern int PHP_MINIT_FUNCTION(INIT_FUNC_ARGS);
-extern void PHP_MINFO_FUNCTION(void);
-#endif
-
-
-extern int mcal_init_request(INIT_FUNC_ARGS);
-extern int mcal_end_request(void);
-void make_event_object();
-void php_mcal_event_init();
-
-PHP_FUNCTION(mcal_open);
-PHP_FUNCTION(mcal_popen);
-PHP_FUNCTION(mcal_reopen);
-PHP_FUNCTION(mcal_close);
-PHP_FUNCTION(mcal_fetch_event);
-PHP_FUNCTION(mcal_list_events);
-PHP_FUNCTION(mcal_create_calendar);
-PHP_FUNCTION(mcal_rename_calendar);
-PHP_FUNCTION(mcal_delete_calendar);
-PHP_FUNCTION(mcal_append_event);
-PHP_FUNCTION(mcal_store_event);
-PHP_FUNCTION(mcal_delete_event);
-PHP_FUNCTION(mcal_snooze);
-PHP_FUNCTION(mcal_list_alarms);
-PHP_FUNCTION(mcal_event_set_category);
-PHP_FUNCTION(mcal_event_set_title);
-PHP_FUNCTION(mcal_event_set_description);
-PHP_FUNCTION(mcal_event_set_start);
-PHP_FUNCTION(mcal_event_set_end);
-PHP_FUNCTION(mcal_event_set_alarm);
-PHP_FUNCTION(mcal_event_set_class);
-PHP_FUNCTION(mcal_event_add_attribute);
-PHP_FUNCTION(mcal_is_leap_year);
-PHP_FUNCTION(mcal_days_in_month);
-PHP_FUNCTION(mcal_date_valid);
-PHP_FUNCTION(mcal_time_valid);
-PHP_FUNCTION(mcal_day_of_week);
-PHP_FUNCTION(mcal_day_of_year);
-PHP_FUNCTION(mcal_week_of_year);
-PHP_FUNCTION(mcal_date_compare);
-PHP_FUNCTION(mcal_event_init);
-PHP_FUNCTION(mcal_next_recurrence);
-PHP_FUNCTION(mcal_event_set_recur_none);
-PHP_FUNCTION(mcal_event_set_recur_daily);
-PHP_FUNCTION(mcal_event_set_recur_weekly);
-PHP_FUNCTION(mcal_event_set_recur_monthly_mday);
-PHP_FUNCTION(mcal_event_set_recur_monthly_wday);
-PHP_FUNCTION(mcal_event_set_recur_yearly);
-PHP_FUNCTION(mcal_fetch_current_stream_event);
-
-
-#else
-#define php_mcal_module_ptr NULL
-#endif /* HAVE_MCAL */
-
-
-#endif
diff --git a/ext/mcrypt/CREDITS b/ext/mcrypt/CREDITS
deleted file mode 100644
index 00f871b171..0000000000
--- a/ext/mcrypt/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-mcrypt
-Sascha Schumann, Derick Rethans
diff --git a/ext/mcrypt/Makefile.in b/ext/mcrypt/Makefile.in
deleted file mode 100644
index 5212cc69b7..0000000000
--- a/ext/mcrypt/Makefile.in
+++ /dev/null
@@ -1,7 +0,0 @@
-
-LTLIBRARY_NAME = libmcrypt.la
-LTLIBRARY_SOURCES = mcrypt.c
-LTLIBRARY_SHARED_NAME = mcrypt.la
-LTLIBRARY_SHARED_LIBADD = $(MCRYPT_SHARED_LIBADD)
-
-include $(top_srcdir)/build/dynlib.mk
diff --git a/ext/mcrypt/config.m4 b/ext/mcrypt/config.m4
deleted file mode 100644
index 8b26ee67da..0000000000
--- a/ext/mcrypt/config.m4
+++ /dev/null
@@ -1,43 +0,0 @@
-dnl
-dnl $Id$
-dnl
-
-PHP_ARG_WITH(mcrypt, for mcrypt support,
-[ --with-mcrypt[=DIR] Include mcrypt support. DIR is the mcrypt install
- directory.])
-
-if test "$PHP_MCRYPT" != "no"; then
- for i in /usr/local /usr $PHP_MCRYPT; do
- if test -f $i/include/mcrypt.h; then
- MCRYPT_DIR=$i
- fi
- done
-
- if test -z "$MCRYPT_DIR"; then
- AC_MSG_ERROR(mcrypt.h not found. Please reinstall libmcrypt.)
- fi
-
- AC_CHECK_LIB(mcrypt, mcrypt_module_open,
- [
- PHP_ADD_LIBRARY(ltdl,, MCRYPT_SHARED_LIBADD)
- AC_DEFINE(HAVE_LIBMCRYPT24,1,[ ])
- ],[
- AC_CHECK_LIB(mcrypt, init_mcrypt,
- [
- AC_DEFINE(HAVE_LIBMCRYPT22,1,[ ])
- ],[
- AC_MSG_ERROR(Sorry, I was not able to diagnose which libmcrypt version you have installed.)
- ],[
- -L$MCRYPT_DIR/lib
- ])
- ],[
- -L$MCRYPT_DIR/lib -lltdl
- ])
-
- PHP_ADD_LIBRARY_WITH_PATH(mcrypt, $MCRYPT_DIR/lib, MCRYPT_SHARED_LIBADD)
- PHP_ADD_INCLUDE($MCRYPT_DIR/include)
- AC_DEFINE(HAVE_LIBMCRYPT,1,[ ])
-
- PHP_SUBST(MCRYPT_SHARED_LIBADD)
- PHP_EXTENSION(mcrypt, $ext_shared)
-fi
diff --git a/ext/mcrypt/mcrypt.c b/ext/mcrypt/mcrypt.c
deleted file mode 100644
index 2656892bb9..0000000000
--- a/ext/mcrypt/mcrypt.c
+++ /dev/null
@@ -1,1663 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Sascha Schumann <sascha@schumann.cx> |
- | Derick Rethans <d.rethans@jdimedia.nl> |
- +----------------------------------------------------------------------+
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-
-#if HAVE_LIBMCRYPT
-
-#include "php_mcrypt.h"
-#include "fcntl.h"
-
-#define NON_FREE
-#define MCRYPT2
-#include "mcrypt.h"
-#include "php_ini.h"
-#include "php_globals.h"
-#include "ext/standard/info.h"
-
-
-function_entry mcrypt_functions[] = {
- PHP_FE(mcrypt_ecb, NULL)
- PHP_FE(mcrypt_cbc, NULL)
- PHP_FE(mcrypt_cfb, NULL)
- PHP_FE(mcrypt_ofb, NULL)
- PHP_FE(mcrypt_get_key_size, NULL)
- PHP_FE(mcrypt_get_block_size, NULL)
- PHP_FE(mcrypt_get_cipher_name, NULL)
- PHP_FE(mcrypt_create_iv, NULL)
-#if HAVE_LIBMCRYPT24
- PHP_FE(mcrypt_list_algorithms, NULL)
- PHP_FE(mcrypt_list_modes, NULL)
- PHP_FE(mcrypt_get_iv_size, NULL)
- PHP_FE(mcrypt_encrypt, NULL)
- PHP_FE(mcrypt_decrypt, NULL)
-
- PHP_FE(mcrypt_module_open, NULL)
- PHP_FE(mcrypt_generic_init, NULL)
- PHP_FE(mcrypt_generic, NULL)
- PHP_FE(mdecrypt_generic, NULL)
- PHP_FE(mcrypt_generic_end, NULL)
- PHP_FE(mcrypt_enc_self_test, NULL)
- PHP_FE(mcrypt_enc_is_block_algorithm_mode, NULL)
- PHP_FE(mcrypt_enc_is_block_algorithm, NULL)
- PHP_FE(mcrypt_enc_is_block_mode, NULL)
- PHP_FE(mcrypt_enc_get_block_size, NULL)
- PHP_FE(mcrypt_enc_get_key_size, NULL)
- PHP_FE(mcrypt_enc_get_supported_key_sizes, NULL)
- PHP_FE(mcrypt_enc_get_iv_size, NULL)
- PHP_FE(mcrypt_enc_get_algorithms_name, NULL)
- PHP_FE(mcrypt_enc_get_modes_name, NULL)
- PHP_FE(mcrypt_module_self_test, NULL)
-
- PHP_FE(mcrypt_module_is_block_algorithm_mode, NULL)
- PHP_FE(mcrypt_module_is_block_algorithm, NULL)
- PHP_FE(mcrypt_module_is_block_mode, NULL)
- PHP_FE(mcrypt_module_get_algo_block_size, NULL)
- PHP_FE(mcrypt_module_get_algo_key_size, NULL)
- PHP_FE(mcrypt_module_get_supported_key_sizes, NULL)
-
- PHP_FE(mcrypt_module_close, NULL)
-#endif
- {0},
-};
-
-static PHP_MINFO_FUNCTION(mcrypt);
-static PHP_MINIT_FUNCTION(mcrypt);
-static PHP_MSHUTDOWN_FUNCTION(mcrypt);
-
-zend_module_entry mcrypt_module_entry = {
- "mcrypt",
- mcrypt_functions,
- PHP_MINIT(mcrypt), PHP_MSHUTDOWN(mcrypt),
- NULL, NULL,
- PHP_MINFO(mcrypt),
- STANDARD_MODULE_PROPERTIES,
-};
-
-#if HAVE_LIBMCRYPT24
-ZEND_DECLARE_MODULE_GLOBALS(mcrypt)
-#endif
-
-#ifdef COMPILE_DL_MCRYPT
-ZEND_GET_MODULE(mcrypt)
-#endif
-
-#define MCRYPT_ARGS2 \
- zval **cipher, **data, **key, **mode; \
- int td; \
- char *ndata; \
- size_t bsize; \
- size_t nr; \
- size_t nsize
-
-#define MCRYPT_ARGS \
- MCRYPT_ARGS2; \
- zval **iv
-
-#if HAVE_LIBMCRYPT22
-#define MCRYPT_CONVERT \
- convert_to_long_ex(cipher); \
- convert_to_long_ex(mode); \
- convert_to_string_ex(data); \
- convert_to_string_ex(key)
-#else
-#define MCRYPT_CONVERT \
- convert_to_string_ex(cipher); \
- convert_to_string_ex(mode); \
- convert_to_string_ex(data); \
- convert_to_string_ex(key)
-#define MCRYPT_CONVERT_WO_MODE \
- convert_to_string_ex(cipher); \
- convert_to_string_ex(data); \
- convert_to_string_ex(key)
-#endif
-
-#define MCRYPT_SIZE \
- bsize = mcrypt_get_block_size(Z_LVAL_PP(cipher)); \
- nr = (Z_STRLEN_PP(data) + bsize - 1) / bsize; \
- nsize = nr * bsize
-
-#define MCRYPT_CHECK_TD_CPY \
- if(td < 0) { \
- php_error(E_WARNING, MCRYPT_FAILED); \
- RETURN_FALSE; \
- } \
- ndata = ecalloc(nr, bsize); \
- memcpy(ndata, Z_STRVAL_PP(data), Z_STRLEN_PP(data))
-
-#define MCRYPT_CHECK_IV \
- convert_to_string_ex(iv); \
- if(Z_STRLEN_PP(iv) != bsize) { \
- php_error(E_WARNING, MCRYPT_IV_WRONG_SIZE); \
- RETURN_FALSE; \
- }
-
-#define MCRYPT_ACTION(x) \
- if(Z_LVAL_PP(mode) == 0) \
- mcrypt_##x(td, ndata, nsize); \
- else \
- mdecrypt_##x(td, ndata, nsize); \
- end_mcrypt_##x(td)
-
-#define MCRYPT_IV_WRONG_SIZE "The IV parameter must be as long as the blocksize"
-
-#if HAVE_LIBMCRYPT24
-#define MCRYPT_ENCRYPT 0
-#define MCRYPT_DECRYPT 1
-
-#define MCRYPT_GET_INI \
- cipher_dir_string = MCG(algorithms_dir); \
- module_dir_string = MCG(modes_dir);
-
-#define MCRYPT_CHECK_PARAM_COUNT(a,b) \
- if (argc < (a) || argc > (b)) { \
- WRONG_PARAM_COUNT; \
- }
-
-#define MCRYPT_GET_CRYPT_ARGS \
- switch (argc) { \
- case 5: \
- if (zend_get_parameters_ex(5, &cipher, &key, &data, &mode, &iv) == FAILURE) { \
- WRONG_PARAM_COUNT; \
- } \
- convert_to_string_ex(iv); \
- break; \
- case 4: \
- if (zend_get_parameters_ex(4, &cipher, &key, &data, &mode) == FAILURE) { \
- WRONG_PARAM_COUNT; \
- } \
- iv = NULL; \
- break; \
- default: \
- WRONG_PARAM_COUNT; \
- }
-
-#define MCRYPT_GET_TD_ARG \
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &mcryptind) == FAILURE) { \
- WRONG_PARAM_COUNT \
- } \
- ZEND_FETCH_RESOURCE (td, MCRYPT, mcryptind, -1, "MCrypt", MCG(le_h));
-
-#define MCRYPT_GET_MODE_DIR_ARGS(DIRECTORY) \
- switch (argc) { \
- case 2: \
- lib_dir_s = Z_STRVAL_PP(lib_dir); \
- if (zend_get_parameters_ex(2, &arg1, &lib_dir) == FAILURE) \
- { \
- WRONG_PARAM_COUNT; \
- } \
- convert_to_string_ex (lib_dir); \
- break; \
- case 1: \
- lib_dir_s = MCG(DIRECTORY); \
- if (zend_get_parameters_ex(1, &arg1) == FAILURE) \
- { \
- WRONG_PARAM_COUNT; \
- } \
- break; \
- default: \
- WRONG_PARAM_COUNT; \
- } \
- convert_to_string_ex(arg1);
-
-#endif
-
-#if HAVE_LIBMCRYPT22
-#define MCRYPT_FAILED "mcrypt initialization failed"
-#else
-#define MCRYPT_OPEN_MODULE_FAILED "mcrypt module initialization failed"
-#endif
-
-#if HAVE_LIBMCRYPT22
-#define MCRYPT_ENTRY_NAMED(a,b) REGISTER_LONG_CONSTANT("MCRYPT_" #a, b, CONST_PERSISTENT)
-#define MCRYPT_ENTRY2(a) MCRYPT_ENTRY_NAMED(a, MCRYPT_##a)
-#define MCRYPT_ENTRY(a) MCRYPT_ENTRY_NAMED(a, a)
-#else /* MCRYPT_2_4 */
-#define MCRYPT_ENTRY2_2_4(a,b) REGISTER_STRING_CONSTANT("MCRYPT_" #a, b, CONST_PERSISTENT)
-#define MCRYPT_ENTRY2_4(a) MCRYPT_ENTRY_NAMED(a, a)
-#endif
-
-#if HAVE_LIBMCRYPT24
-PHP_INI_BEGIN()
- STD_PHP_INI_ENTRY("mcrypt.algorithms_dir", NULL, PHP_INI_ALL, OnUpdateString, algorithms_dir, zend_mcrypt_globals, mcrypt_globals)
- STD_PHP_INI_ENTRY("mcrypt.modes_dir", NULL, PHP_INI_ALL, OnUpdateString, modes_dir, zend_mcrypt_globals, mcrypt_globals)
-PHP_INI_END()
-#endif
-
-static PHP_MINIT_FUNCTION(mcrypt)
-{
-#if defined(ZTS) && defined(HAVE_LIBMCRYPT24)
- ZEND_INIT_MODULE_GLOBALS(mcrypt, NULL, NULL);
- Z_TYPE(mcrypt_module_entry) = type;
-#endif
- /* modes for mcrypt_??? routines */
- REGISTER_LONG_CONSTANT("MCRYPT_ENCRYPT", 0, CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("MCRYPT_DECRYPT", 1, CONST_PERSISTENT);
-
- /* sources for mcrypt_create_iv */
- REGISTER_LONG_CONSTANT("MCRYPT_DEV_RANDOM", 0, CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("MCRYPT_DEV_URANDOM", 1, CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("MCRYPT_RAND", 2, CONST_PERSISTENT);
-
- /* ciphers */
-#if HAVE_LIBMCRYPT22
- MCRYPT_ENTRY2(BLOWFISH_448);
- MCRYPT_ENTRY2(DES);
- MCRYPT_ENTRY2(3DES);
- MCRYPT_ENTRY2(3WAY);
- MCRYPT_ENTRY2(GOST);
- MCRYPT_ENTRY2(SAFER_64);
- MCRYPT_ENTRY2(SAFER_128);
- MCRYPT_ENTRY2(CAST_128);
- MCRYPT_ENTRY2(XTEA);
- MCRYPT_ENTRY2(RC2_1024);
- MCRYPT_ENTRY2(TWOFISH_128);
- MCRYPT_ENTRY2(TWOFISH_192);
- MCRYPT_ENTRY2(TWOFISH_256);
- MCRYPT_ENTRY2(BLOWFISH_128);
- MCRYPT_ENTRY2(BLOWFISH_192);
- MCRYPT_ENTRY2(BLOWFISH_256);
- MCRYPT_ENTRY2(CAST_256);
- MCRYPT_ENTRY2(SAFERPLUS);
- MCRYPT_ENTRY2(LOKI97);
- MCRYPT_ENTRY2(SERPENT_128);
- MCRYPT_ENTRY2(SERPENT_192);
- MCRYPT_ENTRY2(SERPENT_256);
- MCRYPT_ENTRY2(RIJNDAEL_128);
- MCRYPT_ENTRY2(RIJNDAEL_192);
- MCRYPT_ENTRY2(RIJNDAEL_256);
- MCRYPT_ENTRY2(RC2_256);
- MCRYPT_ENTRY2(RC2_128);
- MCRYPT_ENTRY2(RC6_256);
- MCRYPT_ENTRY2(IDEA);
- MCRYPT_ENTRY2(RC6_128);
- MCRYPT_ENTRY2(RC6_192);
- MCRYPT_ENTRY2(RC4);
-#endif
-#if HAVE_LIBMCRYPT24
- MCRYPT_ENTRY2_2_4(ARCFOUR_IV, "arcfour-iv");
- MCRYPT_ENTRY2_2_4(ARCFOUR, "arcfour");
- MCRYPT_ENTRY2_2_4(BLOWFISH, "blowfish");
- MCRYPT_ENTRY2_2_4(BLOWFISH_COMPAT, "blowfish-compat");
- MCRYPT_ENTRY2_2_4(CAST_128, "cast-128");
- MCRYPT_ENTRY2_2_4(CAST_256, "cast-256");
- MCRYPT_ENTRY2_2_4(CRYPT, "crypt");
- MCRYPT_ENTRY2_2_4(DES, "des");
- MCRYPT_ENTRY2_2_4(ENIGNA, "crypt");
- MCRYPT_ENTRY2_2_4(GOST, "gost");
- MCRYPT_ENTRY2_2_4(LOKI97, "loki97");
- MCRYPT_ENTRY2_2_4(PANAMA, "panama");
- MCRYPT_ENTRY2_2_4(RC2, "rc2");
- MCRYPT_ENTRY2_2_4(RIJNDAEL_128, "rijndael-128");
- MCRYPT_ENTRY2_2_4(RIJNDAEL_192, "rijndael-192");
- MCRYPT_ENTRY2_2_4(RIJNDAEL_256, "rijndael-256");
- MCRYPT_ENTRY2_2_4(SAFER64, "safer-sk64");
- MCRYPT_ENTRY2_2_4(SAFER128, "safer-sk128");
- MCRYPT_ENTRY2_2_4(SAFERPLUS, "saferplus");
- MCRYPT_ENTRY2_2_4(SERPENT, "serpent");
- MCRYPT_ENTRY2_2_4(THREEWAY, "threeway");
- MCRYPT_ENTRY2_2_4(TRIPLEDES, "tripledes");
- MCRYPT_ENTRY2_2_4(TWOFISH, "twofish");
- MCRYPT_ENTRY2_2_4(WAKE, "wake");
- MCRYPT_ENTRY2_2_4(XTEA, "xtea");
-
- MCRYPT_ENTRY2_2_4(IDEA, "idea");
- MCRYPT_ENTRY2_2_4(MARS, "mars");
- MCRYPT_ENTRY2_2_4(RC6, "rc6");
- MCRYPT_ENTRY2_2_4(SKIPJACK, "skipjack");
-/* modes */
- MCRYPT_ENTRY2_2_4(MODE_CBC, "cbc");
- MCRYPT_ENTRY2_2_4(MODE_CFB, "cfb");
- MCRYPT_ENTRY2_2_4(MODE_ECB, "ecb");
- MCRYPT_ENTRY2_2_4(MODE_NOFB, "nofb");
- MCRYPT_ENTRY2_2_4(MODE_OFB, "ofb");
- MCRYPT_ENTRY2_2_4(MODE_STREAM, "stream");
- REGISTER_INI_ENTRIES();
-#endif
- return SUCCESS;
-}
-
-static PHP_MSHUTDOWN_FUNCTION(mcrypt)
-{
- UNREGISTER_INI_ENTRIES();
- return SUCCESS;
-}
-
-#include "ext/standard/php_smart_str.h"
-
-PHP_MINFO_FUNCTION(mcrypt)
-{
-#if HAVE_LIBMCRYPT24
- char **modules;
- int i, count;
- smart_str tmp1 = {0};
- smart_str tmp2 = {0};
- MCLS_FETCH();
-
- modules = mcrypt_list_algorithms (MCG(algorithms_dir), &count);
- if (count == 0) {
- smart_str_appends (&tmp1, "none");
- }
- for (i = 0; i < count; i++) {
- smart_str_appends (&tmp1, modules[i]);
- smart_str_appendc (&tmp1, ' ');
- }
- smart_str_0 (&tmp1);
- mcrypt_free_p (modules, count);
-
- modules = mcrypt_list_modes (MCG(modes_dir), &count);
- if (count == 0) {
- smart_str_appends (&tmp2, "none");
- }
- for (i = 0; i < count; i++) {
- smart_str_appends (&tmp2, modules[i]);
- smart_str_appendc (&tmp2, ' ');
- }
- smart_str_0 (&tmp2);
- mcrypt_free_p (modules, count);
-#endif
-
- php_info_print_table_start();
- php_info_print_table_header(2, "mcrypt support", "enabled");
-#if HAVE_LIBMCRYPT22
- php_info_print_table_row(2, "version", "2.2.x");
-#endif
-#if HAVE_LIBMCRYPT24
- php_info_print_table_row(2, "version", "2.4.x");
- php_info_print_table_row(2, "Supported ciphers", tmp1.c);
- php_info_print_table_row(2, "Supported modes", tmp2.c);
- smart_str_free (&tmp1);
- smart_str_free (&tmp2);
-#endif
- php_info_print_table_end();
-
- DISPLAY_INI_ENTRIES();
-}
-
-typedef enum {
- RANDOM = 0,
- URANDOM,
- RAND
-} iv_source;
-
-#if HAVE_LIBMCRYPT24
-
-/* {{{ proto resource mcrypt_module_open(string cipher, string cipher_directory, string mode, string mode_directory)
- Opens the module of the algorithm and the mode to be used */
-PHP_FUNCTION(mcrypt_module_open)
-{
- zval **cipher, **cipher_directory, **mode, **mode_directory;
- MCRYPT td;
- int argc;
- MCLS_FETCH();
-
- argc = ZEND_NUM_ARGS();
- MCRYPT_CHECK_PARAM_COUNT (4,4)
-
- zend_get_parameters_ex(4, &cipher, &cipher_directory, &mode, &mode_directory);
- convert_to_string_ex(cipher);
- convert_to_string_ex(cipher_directory);
- convert_to_string_ex(mode);
- convert_to_string_ex(mode_directory);
-
- td = mcrypt_module_open (Z_STRVAL_PP(cipher),
- Z_STRLEN_PP(cipher_directory) > 0 ? Z_STRVAL_PP(cipher_directory) : MCG(algorithms_dir),
- Z_STRVAL_PP(mode),
- Z_STRLEN_PP(mode_directory) > 0 ? Z_STRVAL_PP(mode_directory) : MCG(modes_dir));
-
- if (td == MCRYPT_FAILED) {
- php_error (E_WARNING, "could not open encryption module");
- RETURN_FALSE;
- } else {
- ZEND_REGISTER_RESOURCE (return_value, td, MCG(le_h));
- }
-}
-/* }}} */
-
-
-/* {{{ proto int mcrypt_generic_init(resource td, string key, string iv)
- This function initializes all buffers for the specific module */
-PHP_FUNCTION(mcrypt_generic_init)
-{
- zval **key, **iv;
- zval **mcryptind;
- unsigned char *key_s, *iv_s;
- char dummy[256];
- int max_key_size, key_size, iv_size;
- MCRYPT td;
- int argc;
- MCLS_FETCH();
-
- argc = ZEND_NUM_ARGS();
- MCRYPT_CHECK_PARAM_COUNT (3,3)
-
- zend_get_parameters_ex(3, &mcryptind, &key, &iv);
- ZEND_FETCH_RESOURCE (td, MCRYPT, mcryptind, -1, "MCrypt", MCG(le_h));
- convert_to_string_ex (key);
- convert_to_string_ex (iv);
-
- max_key_size = mcrypt_enc_get_key_size (td);
- iv_size = mcrypt_enc_get_iv_size (td);
-
- key_s = emalloc (Z_STRLEN_PP(key));
- memset (key_s, 0, Z_STRLEN_PP(key));
-
- iv_s = emalloc (iv_size + 1);
- memset (iv_s, 0, iv_size + 1);
-
- if (Z_STRLEN_PP(key) > max_key_size) {
- sprintf (dummy, "key size too large; supplied length: %d, max: %d",
- Z_STRLEN_PP(key), max_key_size);
- php_error (E_WARNING, dummy);
- key_size = max_key_size;
- } else {
- key_size = Z_STRLEN_PP(key);
- }
- memcpy (key_s, Z_STRVAL_PP(key), Z_STRLEN_PP(key));
-
- if (Z_STRLEN_PP(iv) != iv_size) {
- sprintf (dummy, "iv size incorrect; supplied length: %d, needed: %d",
- Z_STRLEN_PP(iv), iv_size);
- php_error (E_WARNING, dummy);
- }
- memcpy (iv_s, Z_STRVAL_PP(iv), iv_size);
-
- RETVAL_LONG (mcrypt_generic_init (td, key_s, key_size, iv_s));
- efree (iv_s);
- efree (key_s);
-}
-/* }}} */
-
-
-/* {{{ proto string mcrypt_generic(resource td, string data)
- This function encrypts the plaintext */
-PHP_FUNCTION(mcrypt_generic)
-{
- zval **data, **mcryptind;
- MCRYPT td;
- int argc;
- unsigned char* data_s;
- int block_size, data_size;
- MCLS_FETCH();
-
- argc = ZEND_NUM_ARGS();
- MCRYPT_CHECK_PARAM_COUNT (2,2)
-
- zend_get_parameters_ex(2, &mcryptind, &data);
- ZEND_FETCH_RESOURCE (td, MCRYPT, mcryptind, -1, "MCrypt", MCG(le_h));
- convert_to_string_ex (data);
-
- /* Check blocksize */
- if (mcrypt_enc_is_block_mode (td) == 1) { /* It's a block algorithm */
- block_size = mcrypt_enc_get_block_size (td);
- data_size = (((Z_STRLEN_PP(data) - 1) / block_size) + 1) * block_size;
- data_s = emalloc (data_size);
- memset (data_s, 0, data_size);
- memcpy (data_s, Z_STRVAL_PP(data), Z_STRLEN_PP(data));
- }
- else { /* It's not a block algorithm */
- data_size = Z_STRLEN_PP(data);
- data_s = emalloc (data_size);
- memset (data_s, 0, data_size);
- memcpy (data_s, Z_STRVAL_PP(data), Z_STRLEN_PP(data));
- }
-
- mcrypt_generic (td, data_s, data_size);
-
- RETVAL_STRINGL (data_s, data_size, 1);
- efree (data_s);
-}
-/* }}} */
-
-
-/* {{{ proto string mdecrypt_generic(resource td, string data)
- This function decrypts the plaintext */
-PHP_FUNCTION(mdecrypt_generic)
-{
- zval **data, **mcryptind;
- MCRYPT td;
- int argc;
- char* data_s;
- int block_size, data_size;
- MCLS_FETCH();
-
- argc = ZEND_NUM_ARGS();
- MCRYPT_CHECK_PARAM_COUNT (2,2)
-
- zend_get_parameters_ex(2, &mcryptind, &data);
- ZEND_FETCH_RESOURCE (td, MCRYPT, mcryptind, -1, "MCrypt", MCG(le_h));
- convert_to_string_ex (data);
-
- /* Check blocksize */
- if (mcrypt_enc_is_block_mode (td) == 1) { /* It's a block algorithm */
- block_size = mcrypt_enc_get_block_size (td);
- data_size = (((Z_STRLEN_PP(data) - 1) / block_size) + 1) * block_size;
- data_s = emalloc (data_size);
- memset (data_s, 0, data_size);
- memcpy (data_s, Z_STRVAL_PP(data), Z_STRLEN_PP(data));
- }
- else { /* It's not a block algorithm */
- data_size = Z_STRLEN_PP(data);
- data_s = emalloc (data_size);
- memset (data_s, 0, data_size);
- memcpy (data_s, Z_STRVAL_PP(data), Z_STRLEN_PP(data));
- }
-
- mdecrypt_generic (td, data_s, data_size);
-
- RETVAL_STRINGL (data_s, data_size, 1);
- efree (data_s);
-}
-/* }}} */
-
-
-/* {{{ proto int mcrypt_enc_get_supported_key_sizes(resource td)
- This function decrypts the crypttext */
-PHP_FUNCTION(mcrypt_enc_get_supported_key_sizes)
-{
- zval **mcryptind;
- MCRYPT td;
- int argc, i, count;
- int *key_sizes;
- MCLS_FETCH();
-
- argc = ZEND_NUM_ARGS();
- MCRYPT_GET_TD_ARG
-
- key_sizes = mcrypt_enc_get_supported_key_sizes (td, &count);
-
- if (array_init(return_value) == FAILURE) {
- php_error(E_ERROR, "Unable to initialize array");
- return;
- }
- if (count != 0) {
- for (i = 0; i < count; i++) {
- add_index_long(return_value, i, key_sizes[i]);
- }
- }
- mcrypt_free (key_sizes);
-}
-/* }}} */
-
-
-/* {{{ proto int mcrypt_enc_self_test(resource td)
- This function runs the self test on the algorithm specified by the descriptor td */
-PHP_FUNCTION(mcrypt_enc_self_test)
-{
- zval **mcryptind;
- MCRYPT td;
- MCLS_FETCH();
-
- MCRYPT_GET_TD_ARG
-
- RETURN_LONG (mcrypt_enc_self_test (td));
-}
-/* }}} */
-
-
-PHP_FUNCTION(mcrypt_module_close)
-{
- zval **mcryptind;
- MCRYPT td;
- MCLS_FETCH();
-
- MCRYPT_GET_TD_ARG
-
- if (mcrypt_module_close (td) < 0) {
- php_error (E_WARNING, "could not close module");
- RETURN_FALSE
- } else {
- zend_list_delete (Z_LVAL_PP(mcryptind));
- RETURN_TRUE
- }
-}
-
-
-/* {{{ proto bool mcrypt_generic_end(resource td)
- This function terminates encrypt specified by the descriptor td */
-PHP_FUNCTION(mcrypt_generic_end)
-{
- zval **mcryptind;
- MCRYPT td;
- MCLS_FETCH();
-
- MCRYPT_GET_TD_ARG
-
- if (mcrypt_generic_end (td) < 0) {
- php_error (E_WARNING, "could not terminate encryption specifier");
- RETURN_FALSE
- }
- RETURN_TRUE
-}
-/* }}} */
-
-
-/* {{{ proto bool mcrypt_enc_is_block_algorithm_mode(resource td)
- Returns TRUE if the mode is for use with block algorithms */
-PHP_FUNCTION(mcrypt_enc_is_block_algorithm_mode)
-{
- zval **mcryptind;
- MCRYPT td;
- MCLS_FETCH();
-
- MCRYPT_GET_TD_ARG
-
- if (mcrypt_enc_is_block_algorithm_mode (td) == 1)
- RETURN_TRUE
- else
- RETURN_FALSE
-}
-/* }}} */
-
-
-/* {{{ proto bool mcrypt_enc_is_block_algorithm(resource td)
- Returns TRUE if the alrogithm is a block algorithms */
-PHP_FUNCTION(mcrypt_enc_is_block_algorithm)
-{
- zval **mcryptind;
- MCRYPT td;
- MCLS_FETCH();
-
- MCRYPT_GET_TD_ARG
-
- if (mcrypt_enc_is_block_algorithm (td) == 1)
- RETURN_TRUE
- else
- RETURN_FALSE
-}
-/* }}} */
-
-
-/* {{{ proto bool mcrypt_enc_is_block_mode(resource td)
- Returns TRUE if the mode outputs blocks */
-PHP_FUNCTION(mcrypt_enc_is_block_mode)
-{
- zval **mcryptind;
- MCRYPT td;
- MCLS_FETCH();
-
- MCRYPT_GET_TD_ARG
-
- if (mcrypt_enc_is_block_mode (td) == 1)
- RETURN_TRUE
- else
- RETURN_FALSE
-}
-/* }}} */
-
-
-/* {{{ proto int mcrypt_enc_get_block_size(resource td)
- Returns the block size of the cipher specified by the descriptor td */
-PHP_FUNCTION(mcrypt_enc_get_block_size)
-{
- zval **mcryptind;
- MCRYPT td;
- MCLS_FETCH();
-
- MCRYPT_GET_TD_ARG
-
- RETURN_LONG (mcrypt_enc_get_block_size (td));
-}
-/* }}} */
-
-
-/* {{{ proto int mcrypt_enc_get_key_size(resource td)
- Returns the maximum supported key size in bytes of the algorithm specified by the descriptor td */
-PHP_FUNCTION(mcrypt_enc_get_key_size)
-{
- zval **mcryptind;
- MCRYPT td;
- MCLS_FETCH();
-
- MCRYPT_GET_TD_ARG
-
- RETURN_LONG (mcrypt_enc_get_key_size (td));
-}
-/* }}} */
-
-
-/* {{{ proto int mcrypt_enc_get_iv_size(resource td)
- Returns the size of the IV in bytes of the algorithm specified by the descriptor td */
-PHP_FUNCTION(mcrypt_enc_get_iv_size)
-{
- zval **mcryptind;
- MCRYPT td;
- MCLS_FETCH();
-
- MCRYPT_GET_TD_ARG
-
- RETURN_LONG (mcrypt_enc_get_iv_size (td));
-}
-/* }}} */
-
-
-/* {{{ proto string mcrypt_enc_get_algorithms_name(resource td)
- Returns the name of the algorithm specified by the descriptor td */
-PHP_FUNCTION(mcrypt_enc_get_algorithms_name)
-{
- zval **mcryptind;
- MCRYPT td;
- char *name;
- MCLS_FETCH();
-
- MCRYPT_GET_TD_ARG
-
- name = mcrypt_enc_get_algorithms_name (td);
- RETVAL_STRING (name, 1);
- mcrypt_free (name);
-}
-/* }}} */
-
-
-/* {{{ proto string mcrypt_enc_get_modes_name(resource td)
- Returns the name of the mode specified by the descriptor td */
-PHP_FUNCTION(mcrypt_enc_get_modes_name)
-{
- zval **mcryptind;
- MCRYPT td;
- char *name;
- MCLS_FETCH();
-
- MCRYPT_GET_TD_ARG
-
- name = mcrypt_enc_get_modes_name (td);
- RETVAL_STRING (name, 1);
- mcrypt_free (name);
-}
-/* }}} */
-
-
-/* {{{ proto bool mcrypt_module_self_test(string algorithm [, string lib_dir])
- Does a self test of the module "module" */
-PHP_FUNCTION(mcrypt_module_self_test)
-{
- zval **arg1, **lib_dir;
- char *lib_dir_s;
- int argc;
- MCLS_FETCH();
-
- argc = ZEND_NUM_ARGS();
-
- MCRYPT_GET_MODE_DIR_ARGS(algorithms_dir);
-
- if (mcrypt_module_self_test ((*arg1)->value.str.val, lib_dir_s) == 0) {
- RETURN_TRUE;
- }
- else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-
-/* {{{ proto bool mcrypt_module_is_block_algorithm_mode(string mode [, string lib_dir])
- Returns TRUE if the mode is for use with block algorithms */
-PHP_FUNCTION(mcrypt_module_is_block_algorithm_mode)
-{
- zval **arg1, **lib_dir;
- char *lib_dir_s;
- int argc;
- MCLS_FETCH();
-
- argc = ZEND_NUM_ARGS();
-
- MCRYPT_GET_MODE_DIR_ARGS(modes_dir)
-
- if (mcrypt_module_is_block_algorithm_mode ((*arg1)->value.str.val, lib_dir_s) == 0) {
- RETURN_TRUE;
- }
- else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-
-/* {{{ proto bool mcrypt_module_is_block_algorithm(string algorithm [, string lib_dir])
- Returns TRUE if the algorithm is a block algorithm */
-PHP_FUNCTION(mcrypt_module_is_block_algorithm)
-{
- zval **arg1, **lib_dir;
- char *lib_dir_s;
- int argc;
- MCLS_FETCH();
-
- argc = ZEND_NUM_ARGS();
-
- MCRYPT_GET_MODE_DIR_ARGS(algorithms_dir)
-
- if (mcrypt_module_is_block_algorithm ((*arg1)->value.str.val, lib_dir_s) == 0) {
- RETURN_TRUE;
- }
- else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-
-/* {{{ proto bool mcrypt_module_is_block_mode(string mode [, string lib_dir])
- Returns TRUE if the mode outputs blocks of bytes */
-PHP_FUNCTION(mcrypt_module_is_block_mode)
-{
- zval **arg1, **lib_dir;
- char *lib_dir_s;
- int argc;
- MCLS_FETCH();
-
- argc = ZEND_NUM_ARGS();
-
- MCRYPT_GET_MODE_DIR_ARGS(modes_dir)
-
- if (mcrypt_module_is_block_mode ((*arg1)->value.str.val, lib_dir_s) == 0) {
- RETURN_TRUE;
- }
- else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-
-/* {{{ proto int mcrypt_module_get_algo_block_size(string algorithm [, string lib_dir])
- Returns the block size of the algorithm */
-PHP_FUNCTION(mcrypt_module_get_algo_block_size)
-{
- zval **arg1, **lib_dir;
- char *lib_dir_s;
- int argc;
- MCLS_FETCH();
-
- argc = ZEND_NUM_ARGS();
-
- MCRYPT_GET_MODE_DIR_ARGS(algorithms_dir)
-
- RETURN_LONG(mcrypt_module_get_algo_block_size ((*arg1)->value.str.val, lib_dir_s))
-}
-/* }}} */
-
-
-/* {{{ proto int mcrypt_module_get_algo_key_size(string algorithm [, string lib_dir])
- Returns the maximum supported key size of the algorithm */
-PHP_FUNCTION(mcrypt_module_get_algo_key_size)
-{
- zval **arg1, **lib_dir;
- char *lib_dir_s;
- int argc;
- MCLS_FETCH();
-
- argc = ZEND_NUM_ARGS();
-
- MCRYPT_GET_MODE_DIR_ARGS(algorithms_dir);
-
- RETURN_LONG(mcrypt_module_get_algo_key_size ((*arg1)->value.str.val, lib_dir_s))
-}
-/* }}} */
-
-
-/* {{{ proto int mcrypt_module_get_supported_key_sizes(string algorithm [, string lib_dir])
- This function decrypts the crypttext */
-PHP_FUNCTION(mcrypt_module_get_supported_key_sizes)
-{
- zval **arg1, **lib_dir;
- char *lib_dir_s;
- int argc, i, count;
- int *key_sizes;
- MCLS_FETCH();
-
- argc = ZEND_NUM_ARGS();
-
- MCRYPT_GET_MODE_DIR_ARGS(algorithms_dir)
-
- key_sizes = mcrypt_module_get_algo_supported_key_sizes ((*arg1)->value.str.val, lib_dir_s, &count);
-
- if (array_init(return_value) == FAILURE) {
- php_error(E_ERROR, "Unable to initialize array");
- return;
- }
- if (count != 0) {
- for (i = 0; i < count; i++) {
- add_index_long(return_value, i, key_sizes[i]);
- }
- }
- mcrypt_free (key_sizes);
-}
-/* }}} */
-
-
-/* {{{ proto array mcrypt_list_algorithms([string lib_dir])
- List all algorithms in "module_dir" */
-PHP_FUNCTION(mcrypt_list_algorithms)
-{
- zval **lib_dir;
- char **modules;
- char *lib_dir_s;
- int i, count, argc;
-
- argc = ZEND_NUM_ARGS();
- MCRYPT_CHECK_PARAM_COUNT (0,1)
-
- switch (argc) {
- case 1:
- if (zend_get_parameters_ex (1, &lib_dir) == FAILURE) {
- WRONG_PARAM_COUNT
- }
- convert_to_string_ex (lib_dir);
- lib_dir_s = Z_STRVAL_PP(lib_dir);
- break;
- case 0:
- lib_dir_s = INI_STR("mcrypt.algorithms_dir");
- break;
- default:
- WRONG_PARAM_COUNT
- }
-
- modules = mcrypt_list_algorithms (lib_dir_s, &count);
-
- if (array_init(return_value) == FAILURE) {
- php_error(E_ERROR, "Unable to initialize array");
- return;
- }
- if (count == 0) {
- php_error (E_WARNING, "No algorithms found in module dir");
- }
- for (i = 0; i < count; i++) {
- add_index_string(return_value, i, modules[i], 1);
- }
- mcrypt_free_p (modules, count);
-}
-/* }}} */
-
-
-/* {{{ proto array mcrypt_list_modes([string lib_dir])
- List all modes "module_dir" */
-PHP_FUNCTION(mcrypt_list_modes)
-{
- zval **lib_dir;
- char **modules;
- char *lib_dir_s;
- int i, count, argc;
- MCLS_FETCH();
-
- argc = ZEND_NUM_ARGS();
- MCRYPT_CHECK_PARAM_COUNT (0,1)
-
- switch (argc) {
- case 1:
- if (zend_get_parameters_ex (1, &lib_dir) == FAILURE) {
- WRONG_PARAM_COUNT
- }
- convert_to_string_ex (lib_dir);
- lib_dir_s = Z_STRVAL_PP(lib_dir);
- break;
- case 0:
- lib_dir_s = MCG(modes_dir);
- break;
- default:
- WRONG_PARAM_COUNT
- }
-
- modules = mcrypt_list_modes (lib_dir_s, &count);
-
- if (array_init(return_value) == FAILURE) {
- php_error(E_ERROR, "Unable to initialize array");
- return;
- }
- if (count == 0) {
- php_error (E_WARNING, "No modes found in module dir");
- }
- for (i = 0; i < count; i++) {
- add_index_string(return_value, i, modules[i], 1);
- }
- mcrypt_free_p (modules, count);
-}
-/* }}} */
-
-
-/* {{{ proto int mcrypt_get_key_size(string cipher, string module)
- Get the key size of cipher */
-PHP_FUNCTION(mcrypt_get_key_size)
-{
- zval **cipher;
- zval **module;
- char *cipher_dir_string;
- char *module_dir_string;
- long key_size;
- MCRYPT td;
- MCLS_FETCH();
-
- MCRYPT_GET_INI
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &cipher, &module) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(cipher);
- convert_to_string_ex(module);
-
- td = mcrypt_module_open(
- Z_STRVAL_PP(cipher),
- cipher_dir_string,
- Z_STRVAL_PP(module),
- module_dir_string);
- if (td != MCRYPT_FAILED)
- {
- key_size = mcrypt_enc_get_key_size(td);
- mcrypt_module_close(td);
- RETVAL_LONG(key_size);
- }
- else
- {
- php_error (E_WARNING, MCRYPT_OPEN_MODULE_FAILED);
- RETVAL_LONG(0);
- }
-}
-/* }}} */
-
-
-/* {{{ proto int mcrypt_get_block_size(string cipher, string module)
- Get the key size of cipher */
-PHP_FUNCTION(mcrypt_get_block_size)
-{
- zval **cipher;
- zval **module;
- char *cipher_dir_string;
- char *module_dir_string;
- long key_size;
- MCRYPT td;
- MCLS_FETCH();
-
- MCRYPT_GET_INI
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &cipher, &module) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(cipher);
- convert_to_string_ex(module);
-
- td = mcrypt_module_open(
- Z_STRVAL_PP(cipher),
- cipher_dir_string,
- Z_STRVAL_PP(module),
- module_dir_string);
- if (td != MCRYPT_FAILED)
- {
- key_size = mcrypt_enc_get_block_size(td);
- mcrypt_module_close(td);
- RETVAL_LONG(key_size);
- }
- else
- {
- php_error (E_WARNING, MCRYPT_OPEN_MODULE_FAILED);
- RETVAL_LONG(0);
- }
-}
-/* }}} */
-
-
-/* {{{ proto int mcrypt_get_iv_size(string cipher, string module)
- Get the IV size of cipher (Usually the same as the blocksize) */
-PHP_FUNCTION(mcrypt_get_iv_size)
-{
- zval **cipher;
- zval **module;
- char *cipher_dir_string;
- char *module_dir_string;
- long key_size;
- MCRYPT td;
- MCLS_FETCH();
-
- MCRYPT_GET_INI
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &cipher, &module) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(cipher);
- convert_to_string_ex(module);
-
- td = mcrypt_module_open(
- Z_STRVAL_PP(cipher),
- cipher_dir_string,
- Z_STRVAL_PP(module),
- module_dir_string);
- if (td != MCRYPT_FAILED)
- {
- key_size = mcrypt_enc_get_iv_size(td);
- mcrypt_module_close(td);
- RETURN_LONG(key_size);
- }
- else
- {
- php_error (E_WARNING, MCRYPT_OPEN_MODULE_FAILED);
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-
-/* {{{ proto string mcrypt_get_cipher_name(string cipher)
- Get the key size of cipher */
-PHP_FUNCTION(mcrypt_get_cipher_name)
-{
- zval **cipher;
- char *cipher_dir_string;
- char *module_dir_string;
- char *cipher_name;
- MCRYPT td;
- MCLS_FETCH();
-
- MCRYPT_GET_INI
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &cipher) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(cipher);
-
- /* The code below is actually not very nice, but I didn see a better method */
- td = mcrypt_module_open(
- Z_STRVAL_PP(cipher),
- cipher_dir_string,
- "ecb",
- module_dir_string);
- if (td != MCRYPT_FAILED)
- {
- cipher_name = mcrypt_enc_get_algorithms_name(td);
- mcrypt_module_close(td);
- RETVAL_STRING(cipher_name,1);
- mcrypt_free (cipher_name);
- }
- else
- {
- td = mcrypt_module_open(
- Z_STRVAL_PP(cipher),
- cipher_dir_string,
- "stream",
- module_dir_string);
- if (td != MCRYPT_FAILED)
- {
- cipher_name = mcrypt_enc_get_algorithms_name(td);
- mcrypt_module_close(td);
- RETVAL_STRING(cipher_name,1);
- mcrypt_free (cipher_name);
- }
- else
- {
- php_error (E_WARNING, MCRYPT_OPEN_MODULE_FAILED);
- RETURN_FALSE;
- }
- }
-}
-/* }}} */
-
-
-static void php_mcrypt_do_crypt (char* cipher, zval **key, zval **data, char *mode, zval **iv, int argc, int dencrypt, zval* return_value)
-{
- char *cipher_dir_string;
- char *module_dir_string;
- int block_size, max_key_length, use_key_length, i, count, iv_size;
- unsigned long int data_size;
- int *key_length_sizes;
- char *key_s = NULL, *iv_s;
- char *data_s;
- MCRYPT td;
- MCLS_FETCH();
-
- MCRYPT_GET_INI
-
- td = mcrypt_module_open (
- cipher,
- cipher_dir_string,
- mode,
- module_dir_string);
- if (td == MCRYPT_FAILED) {
- php_error (E_WARNING, MCRYPT_OPEN_MODULE_FAILED);
- RETURN_FALSE;
- }
- /* Checking for key-length */
- max_key_length = mcrypt_enc_get_key_size (td);
- if (Z_STRLEN_PP(key) > max_key_length) {
- php_error (E_WARNING, "size of key is too large for this algorithm");
- }
- key_length_sizes = mcrypt_enc_get_supported_key_sizes (td, &count);
- if (count == 0 && key_length_sizes == NULL) { /* all lengths 1 - k_l_s = OK */
- use_key_length = Z_STRLEN_PP(key);
- key_s = emalloc (use_key_length);
- memset (key_s, 0, use_key_length);
- memcpy (key_s, Z_STRVAL_PP(key), use_key_length);
- }
- else if (count == 1) { /* only m_k_l = OK */
- key_s = emalloc (key_length_sizes[0]);
- memset (key_s, 0, key_length_sizes[0]);
- memcpy (key_s, Z_STRVAL_PP(key), Z_STRLEN_PP(key));
- use_key_length = key_length_sizes[0];
- }
- else { /* derterminating smallest supported key > length of requested key */
- use_key_length = max_key_length; /* start with max key length */
- for (i = 0; i < count; i++) {
- if (key_length_sizes[i] >= Z_STRLEN_PP(key) &&
- key_length_sizes[i] < use_key_length)
- {
- use_key_length = key_length_sizes[i];
- }
- }
- key_s = emalloc (use_key_length);
- memset (key_s, 0, use_key_length);
- memcpy (key_s, Z_STRVAL_PP(key), Z_STRLEN_PP(key));
- }
- mcrypt_free (key_length_sizes);
-
- /* Check IV */
- iv_s = NULL;
- iv_size = mcrypt_enc_get_iv_size (td);
- if (argc == 5) {
- if (iv_size != Z_STRLEN_PP(iv)) {
- php_error (E_WARNING, MCRYPT_IV_WRONG_SIZE);
-
- }
- else {
- iv_s = emalloc (iv_size + 1);
- memcpy (iv_s, Z_STRVAL_PP(iv), iv_size);
- }
- }
- else if (argc == 4)
- {
- if (iv_size != 0) {
- php_error (E_WARNING, "attempt to use an empty IV, which is NOT recommend");
- iv_s = emalloc (iv_size + 1);
- memset (iv_s, 0, iv_size + 1);
- }
- }
-
- /* Check blocksize */
- if (mcrypt_enc_is_block_mode (td) == 1) { /* It's a block algorithm */
- block_size = mcrypt_enc_get_block_size (td);
- data_size = (((Z_STRLEN_PP(data) - 1) / block_size) + 1) * block_size;
- data_s = emalloc (data_size);
- memset (data_s, 0, data_size);
- memcpy (data_s, Z_STRVAL_PP(data), Z_STRLEN_PP(data));
- }
- else { /* It's not a block algorithm */
- data_size = Z_STRLEN_PP(data);
- data_s = emalloc (data_size);
- memset (data_s, 0, data_size);
- memcpy (data_s, Z_STRVAL_PP(data), Z_STRLEN_PP(data));
- }
-
- if (mcrypt_generic_init (td, key_s, use_key_length, iv_s) < 0) {
- php_error (E_ERROR, "generic_init failed");
- }
- if (dencrypt == MCRYPT_ENCRYPT)
- mcrypt_generic (td, data_s, data_size);
- else
- mdecrypt_generic (td, data_s, data_size);
-
- RETVAL_STRINGL (data_s, data_size, 1);
-
-/* freeing vars */
- mcrypt_generic_end (td);
- if (key_s != NULL)
- efree (key_s);
- if (iv_s != NULL)
- efree (iv_s);
- efree (data_s);
-}
-
-/* {{{ proto string mcrypt_encrypt(string cipher, string key, string data, string mode, string iv)
- OFB crypt/decrypt data using key key with cipher cipher starting with iv */
-PHP_FUNCTION(mcrypt_encrypt)
-{
- zval **cipher, **key, **data, **mode, **iv;
- int argc;
-
- argc = ZEND_NUM_ARGS();
-
- MCRYPT_CHECK_PARAM_COUNT (4, 5)
- MCRYPT_GET_CRYPT_ARGS
-
- MCRYPT_CONVERT;
-
- php_mcrypt_do_crypt (Z_STRVAL_PP(cipher), key, data, Z_STRVAL_PP(mode), iv, argc, MCRYPT_ENCRYPT, return_value);
-}
-/* }}} */
-
-/* {{{ proto string mcrypt_decrypt(string cipher, string key, string data, string mode, string iv)
- OFB crypt/decrypt data using key key with cipher cipher starting with iv */
-PHP_FUNCTION(mcrypt_decrypt)
-{
- zval **cipher, **key, **data, **mode, **iv;
- int argc;
-
- argc = ZEND_NUM_ARGS();
-
- MCRYPT_CHECK_PARAM_COUNT (4, 5)
- MCRYPT_GET_CRYPT_ARGS
-
- MCRYPT_CONVERT;
-
- php_mcrypt_do_crypt (Z_STRVAL_PP(cipher), key, data, Z_STRVAL_PP(mode), iv, argc, MCRYPT_DECRYPT, return_value);
-}
-/* }}} */
-
-/* {{{ proto string mcrypt_ecb(int cipher, string key, string data, int mode, string iv)
- ECB crypt/decrypt data using key key with cipher cipher starting with iv */
-PHP_FUNCTION(mcrypt_ecb)
-{
- zval **cipher, **key, **data, **mode, **iv;
- int argc;
-
- argc = ZEND_NUM_ARGS();
-
- MCRYPT_CHECK_PARAM_COUNT (4, 5)
- MCRYPT_GET_CRYPT_ARGS
-
- MCRYPT_CONVERT_WO_MODE;
- convert_to_long_ex(mode);
-
- php_mcrypt_do_crypt (Z_STRVAL_PP(cipher), key, data, "ecb", iv, argc, Z_LVAL_PP(mode), return_value);
-}
-/* }}} */
-
-/* {{{ proto string mcrypt_cbc(int cipher, string key, string data, int mode, string iv)
- CBC crypt/decrypt data using key key with cipher cipher starting with iv */
-PHP_FUNCTION(mcrypt_cbc)
-{
- zval **cipher, **key, **data, **mode, **iv;
- int argc;
-
- argc = ZEND_NUM_ARGS();
-
- MCRYPT_CHECK_PARAM_COUNT (4, 5)
- MCRYPT_GET_CRYPT_ARGS
-
- MCRYPT_CONVERT_WO_MODE;
- convert_to_long_ex(mode);
-
- php_mcrypt_do_crypt (Z_STRVAL_PP(cipher), key, data, "cbc", iv, argc, Z_LVAL_PP(mode), return_value);
-}
-/* }}} */
-
-/* {{{ proto string mcrypt_cfb(int cipher, string key, string data, int mode, string iv)
- CFB crypt/decrypt data using key key with cipher cipher starting with iv */
-PHP_FUNCTION(mcrypt_cfb)
-{
- zval **cipher, **key, **data, **mode, **iv;
- int argc;
-
- argc = ZEND_NUM_ARGS();
-
- MCRYPT_CHECK_PARAM_COUNT (4, 5)
- MCRYPT_GET_CRYPT_ARGS
-
- MCRYPT_CONVERT_WO_MODE;
- convert_to_long_ex(mode);
-
- php_mcrypt_do_crypt (Z_STRVAL_PP(cipher), key, data, "cfb", iv, argc, Z_LVAL_PP(mode), return_value);
-}
-/* }}} */
-
-/* {{{ proto string mcrypt_ofb(int cipher, string key, string data, int mode, string iv)
- OFB crypt/decrypt data using key key with cipher cipher starting with iv */
-PHP_FUNCTION(mcrypt_ofb)
-{
- zval **cipher, **key, **data, **mode, **iv;
- int argc;
-
- argc = ZEND_NUM_ARGS();
-
- MCRYPT_CHECK_PARAM_COUNT (4, 5)
- MCRYPT_GET_CRYPT_ARGS
-
- MCRYPT_CONVERT_WO_MODE;
- convert_to_long_ex(mode);
-
- php_mcrypt_do_crypt (Z_STRVAL_PP(cipher), key, data, "ofb", iv, argc, Z_LVAL_PP(mode), return_value);
-}
-/* }}} */
-
-#endif
-
-/* {{{ proto string mcrypt_create_iv(int size, int source)
- Create an initializing vector (IV) */
-PHP_FUNCTION(mcrypt_create_iv)
-{
- zval **size, **psource;
- char *iv;
- iv_source source;
- int i;
- int n = 0;
-
- if(ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &size, &psource) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(size);
- convert_to_long_ex(psource);
-
- source = Z_LVAL_PP(psource);
- i = Z_LVAL_PP(size);
-
- if(i <= 0) {
- php_error(E_WARNING, "can not create an IV with size 0 or smaller");
- RETURN_FALSE;
- }
-
- iv = ecalloc(i, 1);
-
- if(source == RANDOM || source == URANDOM) {
- int fd;
- size_t read_bytes = 0;
-
- fd = open(source == RANDOM ? "/dev/random" : "/dev/urandom",
- O_RDONLY);
- if(fd < 0) {
- efree(iv);
- php_error(E_WARNING, "cannot open source device");
- RETURN_FALSE;
- }
- while (read_bytes < i) {
- n = read(fd, iv + read_bytes, i - read_bytes);
- if (n < 0)
- break;
- read_bytes += n;
- }
- n = read_bytes;
- close(fd);
- } else {
- while(i) {
- iv[--i] = 255.0 * rand() / RAND_MAX;
- }
- n = Z_LVAL_PP(size);
- }
- RETURN_STRINGL(iv, n, 0);
-}
-/* }}} */
-
-
-#if HAVE_LIBMCRYPT22
-
-/* {{{ proto string mcrypt_get_cipher_name(int cipher)
- Get the name of cipher */
-PHP_FUNCTION(mcrypt_get_cipher_name)
-{
- zval **cipher;
- char *str, *nstr;
-
- if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &cipher) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(cipher);
-
- str = mcrypt_get_algorithms_name(Z_LVAL_PP(cipher));
- if (str) {
- nstr = estrdup(str);
- free(str);
- RETURN_STRING(nstr, 0);
- }
-
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto int mcrypt_get_key_size(int cipher)
- Get the key size of cipher */
-PHP_FUNCTION(mcrypt_get_key_size)
-{
- zval **cipher;
-
- if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &cipher) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(cipher);
-
- RETURN_LONG(mcrypt_get_key_size(Z_LVAL_PP(cipher)));
-}
-/* }}} */
-
-/* {{{ proto int mcrypt_get_block_size(int cipher)
- Get the block size of cipher */
-PHP_FUNCTION(mcrypt_get_block_size)
-{
- zval **cipher;
-
- if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &cipher) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(cipher);
-
- RETURN_LONG(mcrypt_get_block_size(Z_LVAL_PP(cipher)));
-}
-/* }}} */
-
-/* {{{ proto string mcrypt_ofb(int cipher, string key, string data, int mode, string iv)
- OFB crypt/decrypt data using key key with cipher cipher starting with iv */
-PHP_FUNCTION(mcrypt_ofb)
-{
- MCRYPT_ARGS;
-
- if(ZEND_NUM_ARGS() != 5 ||
- zend_get_parameters_ex(5, &cipher, &key, &data, &mode, &iv) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- MCRYPT_CONVERT;
- MCRYPT_SIZE;
- MCRYPT_CHECK_IV;
-
- td = init_mcrypt_ofb(Z_LVAL_PP(cipher), Z_STRVAL_PP(key), Z_STRLEN_PP(key), Z_STRVAL_PP(iv));
- MCRYPT_CHECK_TD_CPY;
- MCRYPT_ACTION(ofb);
-
- RETURN_STRINGL(ndata, nsize, 0);
-}
-/* }}} */
-
-/* {{{ proto string mcrypt_cfb(int cipher, string key, string data, int mode, string iv)
- CFB crypt/decrypt data using key key with cipher cipher starting with iv */
-PHP_FUNCTION(mcrypt_cfb)
-{
- MCRYPT_ARGS;
-
- if(ZEND_NUM_ARGS() != 5 ||
- zend_get_parameters_ex(5, &cipher, &key, &data, &mode, &iv) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- MCRYPT_CONVERT;
- MCRYPT_SIZE;
- MCRYPT_CHECK_IV;
-
- td = init_mcrypt_cfb(Z_LVAL_PP(cipher), Z_STRVAL_PP(key), Z_STRLEN_PP(key), Z_STRVAL_PP(iv));
- MCRYPT_CHECK_TD_CPY;
- MCRYPT_ACTION(cfb);
-
- RETURN_STRINGL(ndata, nsize, 0);
-}
-/* }}} */
-
-/* {{{ proto string mcrypt_cbc(int cipher, string key, string data, int mode [, string iv])
- CBC crypt/decrypt data using key key with cipher cipher using optional iv */
-PHP_FUNCTION(mcrypt_cbc)
-{
- MCRYPT_ARGS;
- int ac = ZEND_NUM_ARGS();
-
- if(ac < 4 || ac > 5 ||
- zend_get_parameters_ex(ac, &cipher, &key, &data, &mode, &iv) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- MCRYPT_CONVERT;
- MCRYPT_SIZE;
- if(ac > 4) {
- MCRYPT_CHECK_IV;
- }
-
- td = init_mcrypt_cbc(Z_LVAL_PP(cipher), Z_STRVAL_PP(key), Z_STRLEN_PP(key));
- MCRYPT_CHECK_TD_CPY;
-
- if(ac > 4) {
- mcrypt(td, Z_STRVAL_PP(iv));
- }
-
- MCRYPT_ACTION(cbc);
-
- RETURN_STRINGL(ndata, nsize, 0);
-}
-/* }}} */
-
-/* {{{ proto string mcrypt_ecb(int cipher, string key, string data, int mode)
- ECB crypt/decrypt data using key key with cipher cipher */
-PHP_FUNCTION(mcrypt_ecb)
-{
- MCRYPT_ARGS2;
-
- if(ZEND_NUM_ARGS() != 4 ||
- zend_get_parameters_ex(4, &cipher, &key, &data, &mode) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- MCRYPT_CONVERT;
- MCRYPT_SIZE;
-
- td = init_mcrypt_ecb(Z_LVAL_PP(cipher), Z_STRVAL_PP(key), Z_STRLEN_PP(key));
- MCRYPT_CHECK_TD_CPY;
- MCRYPT_ACTION(ecb);
-
- RETURN_STRINGL(ndata, nsize, 0);
-}
-/* }}} */
-
-#endif /* MCRYPT_2_2 */
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/mcrypt/mcrypt.dsp b/ext/mcrypt/mcrypt.dsp
deleted file mode 100644
index 57ed3e36b8..0000000000
--- a/ext/mcrypt/mcrypt.dsp
+++ /dev/null
@@ -1,117 +0,0 @@
-# Microsoft Developer Studio Project File - Name="mcrypt" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=mcrypt - Win32 Release_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "mcrypt.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "mcrypt.mak" CFG="mcrypt - Win32 Release_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "mcrypt - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "mcrypt - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "mcrypt - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\..\TSRM" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MSSQL_EXPORTS" /D "COMPILE_DL_MCRYPT" /D "DBNTWIN32" /D ZTS=1 /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /I "..\..\..\php_build\mcrypt\include" /D ZEND_DEBUG=0 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MCRYPT_EXPORTS" /D "COMPILE_DL_MCRYPT" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_LIBMCRYPT=1 /D HAVE_LIBMCRYPT24=1 /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x406 /d "NDEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib ntwdblib.lib /nologo /dll /machine:I386 /out:"MSSQL_65_Release/php_mssql.dll" /libpath:"..\..\Release_TS"
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib libmcrypt.lib libltdl.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_mcrypt.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\..\php_build\mcrypt" /libpath:"..\..\Release_TS_Inline" /libpath:"..\..\TSRM\Release_TS" /libpath:"..\..\TSRM\Release_TS_Inline"
-
-!ELSEIF "$(CFG)" == "mcrypt - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /I "mssql-70" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MSSQL_EXPORTS" /D "COMPILE_DL_MCRYPT" /D "DBNTWIN32" /D ZTS=1 /D MSSQL70=1 /YX /FD /c
-# ADD CPP /nologo /MDd /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /I "..\..\..\php_build\mcrypt\include" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MCRYPT_EXPORTS" /D "COMPILE_DL_MCRYPT" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_LIBMCRYPT=1 /D HAVE_LIBMCRYPT24=1 /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x406 /d "NDEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib ntwdblib.lib /nologo /dll /machine:I386 /out:"MSSQL_65_Release/php_mssql.dll" /libpath:"..\..\Release_TS" /libpath:"mssql-70"
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts_debug.lib libmcrypt.lib libltdl.lib /nologo /dll /machine:I386 /out:"..\..\Debug_TS/php_mcrypt.dll" /libpath:"..\..\Debug_TS" /libpath:"..\..\..\php_build\mcrypt\lib"
-
-!ENDIF
-
-# Begin Target
-
-# Name "mcrypt - Win32 Release_TS"
-# Name "mcrypt - Win32 Debug_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\mcrypt.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\win32\readdir.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_mcrypt.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\win32\readdir.h
-# End Source File
-# End Group
-# End Target
-# End Project
diff --git a/ext/mcrypt/php_mcrypt.h b/ext/mcrypt/php_mcrypt.h
deleted file mode 100644
index 3858abdf2a..0000000000
--- a/ext/mcrypt/php_mcrypt.h
+++ /dev/null
@@ -1,93 +0,0 @@
-#ifndef PHP_MCRYPT_H
-#define PHP_MCRYPT_H
-
-#if HAVE_LIBMCRYPT
-
-#ifdef ZTS
-#include "TSRM.h"
-#endif
-
-#if PHP_API_VERSION < 19990421
-#define zend_module_entry zend_module_entry
-#include "zend_modules.h"
-#include "internal_functions.h"
-#endif
-
-extern zend_module_entry mcrypt_module_entry;
-
-#define mcrypt_module_ptr &mcrypt_module_entry
-
-/* Functions for both old and new API */
-PHP_FUNCTION(mcrypt_ecb);
-PHP_FUNCTION(mcrypt_cbc);
-PHP_FUNCTION(mcrypt_cfb);
-PHP_FUNCTION(mcrypt_ofb);
-PHP_FUNCTION(mcrypt_get_cipher_name);
-PHP_FUNCTION(mcrypt_get_block_size);
-PHP_FUNCTION(mcrypt_get_key_size);
-PHP_FUNCTION(mcrypt_create_iv);
-
-#if HAVE_LIBMCRYPT24
-/* Support functions for old API */
-PHP_FUNCTION(mcrypt_list_algorithms);
-PHP_FUNCTION(mcrypt_list_modes);
-PHP_FUNCTION(mcrypt_get_iv_size);
-PHP_FUNCTION(mcrypt_encrypt);
-PHP_FUNCTION(mcrypt_decrypt);
-
-/* Functions for new API */
-PHP_FUNCTION(mcrypt_module_open);
-PHP_FUNCTION(mcrypt_generic_init);
-PHP_FUNCTION(mcrypt_generic);
-PHP_FUNCTION(mdecrypt_generic);
-PHP_FUNCTION(mcrypt_generic_end);
-PHP_FUNCTION(mcrypt_enc_self_test);
-PHP_FUNCTION(mcrypt_enc_is_block_algorithm_mode);
-PHP_FUNCTION(mcrypt_enc_is_block_algorithm);
-PHP_FUNCTION(mcrypt_enc_is_block_mode);
-PHP_FUNCTION(mcrypt_enc_get_block_size);
-PHP_FUNCTION(mcrypt_enc_get_key_size);
-PHP_FUNCTION(mcrypt_enc_get_supported_key_sizes);
-PHP_FUNCTION(mcrypt_enc_get_iv_size);
-PHP_FUNCTION(mcrypt_enc_get_algorithms_name);
-PHP_FUNCTION(mcrypt_enc_get_modes_name);
-PHP_FUNCTION(mcrypt_module_self_test);
-PHP_FUNCTION(mcrypt_module_is_block_algorithm_mode);
-PHP_FUNCTION(mcrypt_module_is_block_algorithm);
-PHP_FUNCTION(mcrypt_module_is_block_mode);
-PHP_FUNCTION(mcrypt_module_get_algo_block_size);
-PHP_FUNCTION(mcrypt_module_get_algo_key_size);
-PHP_FUNCTION(mcrypt_module_get_supported_key_sizes);
-PHP_FUNCTION(mcrypt_module_close);
-
-ZEND_BEGIN_MODULE_GLOBALS(mcrypt)
- int le_h;
- char *modes_dir;
- char *algorithms_dir;
-ZEND_END_MODULE_GLOBALS(mcrypt)
-
-#ifdef ZTS
-# define MCLS_D zend_mcrypt_globals *mcrypt_globals
-# define MCLS_DC , MCLS_D
-# define MCLS_C mcrypt_globals
-# define MCLS_CC , MCLS_C
-# define MCG(v) (mcrypt_globals->v)
-# define MCLS_FETCH() zend_mcrypt_globals *mcrypt_globals = ts_resource(mcrypt_globals_id)
-#else
-# define MCLS_D
-# define MCLS_DC
-# define MCLS_C
-# define MCLS_CC
-# define MCG(v) (mcrypt_globals.v)
-# define MCLS_FETCH()
-#endif
-
-#endif
-
-#else
-#define mcrypt_module_ptr NULL
-#endif
-
-#define phpext_mcrypt_ptr mcrypt_module_ptr
-
-#endif
diff --git a/ext/mcrypt/setup.stub b/ext/mcrypt/setup.stub
deleted file mode 100644
index 76d795b16e..0000000000
--- a/ext/mcrypt/setup.stub
+++ /dev/null
@@ -1,6 +0,0 @@
-# $Source$
-# $Id$
-
-define_option with-mcrypt 'mcrypt support?' yesnodir no \
-' Whether to build the mcrypt extension.'
-
diff --git a/ext/mcrypt/tests/001.phpt b/ext/mcrypt/tests/001.phpt
deleted file mode 100644
index 0cefdb5600..0000000000
--- a/ext/mcrypt/tests/001.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Bug #8040
---SKIPIF--
-<?php if (!extension_loaded("mcrypt")) print "skip"; ?>
---POST--
---GET--
---FILE--
-<?php
- echo MCRYPT_TWOFISH."\n";
- echo MCRYPT_MODE_CBC."\n";
-?>
-
-<?php
- define ("MODE1", MCRYPT_MODE_CBC);
- echo MODE1."\n";
-?>
-
-<?php
- define ("CIPHER", MCRYPT_TWOFISH);
- define ("MODE1", MCRYPT_MODE_CBC);
- define ("MODE2", MCRYPT_CBC);
-
- printf ("cipher=".CIPHER. " mode1=".MODE1. " mode2=". MODE2."\n");
-?>
---EXPECT--
-twofish
-cbc
-
-cbc
-
-cipher=twofish mode1=cbc mode2=MCRYPT_CBC
diff --git a/ext/mhash/CREDITS b/ext/mhash/CREDITS
deleted file mode 100644
index 54851e1ac7..0000000000
--- a/ext/mhash/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-mhash
-Sascha Schumann
diff --git a/ext/mhash/Makefile.in b/ext/mhash/Makefile.in
deleted file mode 100644
index 2adac58bb7..0000000000
--- a/ext/mhash/Makefile.in
+++ /dev/null
@@ -1,7 +0,0 @@
-
-LTLIBRARY_NAME = libmhash.la
-LTLIBRARY_SOURCES = mhash.c
-LTLIBRARY_SHARED_NAME = mhash.la
-LTLIBRARY_SHARED_LIBADD = $(MHASH_SHARED_LIBADD)
-
-include $(top_srcdir)/build/dynlib.mk
diff --git a/ext/mhash/config.m4 b/ext/mhash/config.m4
deleted file mode 100644
index bd99ebb52f..0000000000
--- a/ext/mhash/config.m4
+++ /dev/null
@@ -1,26 +0,0 @@
-dnl $Id$
-dnl config.m4 for extension mhash
-dnl don't forget to call PHP_EXTENSION(mhash)
-
-PHP_ARG_WITH(mhash, for mhash support,
-[ --with-mhash[=DIR] Include mhash support. DIR is the mhash
- install directory.])
-
-if test "$PHP_MHASH" != "no"; then
- for i in /usr/local /usr /opt/mhash $PHP_MHASH; do
- if test -f $i/include/mhash.h; then
- MHASH_DIR=$i
- fi
- done
-
- if test -z "$MHASH_DIR"; then
- AC_MSG_ERROR(Please reinstall libmhash - I cannot find mhash.h)
- fi
- PHP_ADD_INCLUDE($MHASH_DIR/include)
- PHP_ADD_LIBRARY_WITH_PATH(mhash, $MHASH_DIR/lib, MHASH_SHARED_LIBADD)
- PHP_SUBST(MHASH_SHARED_LIBADD)
-
- AC_DEFINE(HAVE_LIBMHASH,1,[ ])
-
- PHP_EXTENSION(mhash, $ext_shared)
-fi
diff --git a/ext/mhash/mhash.c b/ext/mhash/mhash.c
deleted file mode 100644
index 75d86c5bbf..0000000000
--- a/ext/mhash/mhash.c
+++ /dev/null
@@ -1,280 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Sascha Schumann <sascha@schumann.cx> |
- | |
- | HMAC and KEYGEN functionality added by |
- | Nikos Mavroyanopoulos <nmav@hellug.gr> |
- +----------------------------------------------------------------------+
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-
-#if HAVE_LIBMHASH
-
-#include "fcntl.h"
-#include "php_mhash.h"
-#include "mhash.h"
-#include "php_ini.h"
-#include "php_globals.h"
-#include "ext/standard/info.h"
-
-function_entry mhash_functions[] = {
- PHP_FE(mhash_get_block_size, NULL)
- PHP_FE(mhash_get_hash_name, NULL)
- PHP_FE(mhash_keygen_s2k, NULL)
- PHP_FE(mhash_count, NULL)
- PHP_FE(mhash, NULL) {0}
- ,
-};
-
-static PHP_MINIT_FUNCTION(mhash);
-
-zend_module_entry mhash_module_entry = {
- "mhash",
- mhash_functions,
- PHP_MINIT(mhash), NULL,
- NULL, NULL,
- NULL,
- STANDARD_MODULE_PROPERTIES,
-};
-
-#ifdef COMPILE_DL_MHASH
-ZEND_GET_MODULE(mhash)
-#endif
-#define MHASH_FAILED_MSG "mhash initialization failed"
-#define MHASH_KEYGEN_FAILED_MSG "mhash key generation failed"
-static PHP_MINIT_FUNCTION(mhash)
-{
- int i;
- char *name;
- char buf[128];
-
- for (i = 0; i <= mhash_count(); i++) {
- name = mhash_get_hash_name(i);
- if (name) {
- snprintf(buf, 127, "MHASH_%s", name);
- zend_register_long_constant(buf, strlen(buf) + 1,
- i, CONST_PERSISTENT,
- module_number ELS_CC);
- free(name);
- }
- }
-
- return SUCCESS;
-}
-
-/* {{{ proto int mhash_count(void)
- Gets the number of available hashes */
-PHP_FUNCTION(mhash_count)
-{
- RETURN_LONG(mhash_count());
-}
-
-/* }}} */
-
-/* {{{ proto int mhash_get_block_size(int hash)
- Gets the block size of hash */
-PHP_FUNCTION(mhash_get_block_size)
-{
- pval **hash;
-
- if (ZEND_NUM_ARGS() != 1
- || zend_get_parameters_ex(1, &hash) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(hash);
-
- RETURN_LONG(mhash_get_block_size(Z_LVAL_PP(hash)));
-}
-
-/* }}} */
-
-/* {{{ proto string mhash_get_hash_name(int hash)
- Gets the name of hash */
-PHP_FUNCTION(mhash_get_hash_name)
-{
- pval **hash;
- char *name;
-
- if (ZEND_NUM_ARGS() != 1
- || zend_get_parameters_ex(1, &hash) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(hash);
-
- name = mhash_get_hash_name(Z_LVAL_PP(hash));
- if (name) {
- RETVAL_STRING(name, 1);
- free(name);
- } else {
- RETVAL_FALSE;
- }
-}
-
-/* }}} */
-
-/* {{{ proto string mhash(int hash, string data [, string key])
- Hash data with hash */
-PHP_FUNCTION(mhash)
-{
- pval **hash, **data, **key;
- MHASH td;
- int bsize;
- unsigned char *hash_data;
- int num_args;
-
- num_args = ZEND_NUM_ARGS();
-
- if (num_args < 2 || num_args > 3) {
- WRONG_PARAM_COUNT;
- }
- if (num_args == 2) { /* 2 arguments, just hash */
- if (zend_get_parameters_ex(2, &hash, &data) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- } else { /* 3 arguments, do HMAC hash (keyed hash) */
- if (zend_get_parameters_ex(3, &hash, &data, &key) ==
- FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(key);
- }
-
- convert_to_long_ex(hash);
- convert_to_string_ex(data);
-
- bsize = mhash_get_block_size(Z_LVAL_PP(hash));
-
- if (num_args == 3) {
- if (mhash_get_hash_pblock(Z_LVAL_PP(hash)) == 0) {
- php_error(E_WARNING, MHASH_FAILED_MSG);
- RETURN_FALSE;
- }
- td = mhash_hmac_init(Z_LVAL_PP(hash),
- Z_STRVAL_PP(key),
- Z_STRLEN_PP(key),
- mhash_get_hash_pblock(Z_LVAL_PP(hash)));
- } else {
- td = mhash_init(Z_LVAL_PP(hash));
- }
- if (td == MHASH_FAILED) {
- php_error(E_WARNING, MHASH_FAILED_MSG);
- RETURN_FALSE;
- }
-
- mhash(td, Z_STRVAL_PP(data), Z_STRLEN_PP(data));
-
- if (num_args == 3) {
- hash_data = (unsigned char *) mhash_hmac_end(td);
- } else {
- hash_data = (unsigned char *) mhash_end(td);
- }
- if (hash_data) {
- RETVAL_STRINGL(hash_data, bsize, 1);
- mhash_free(hash_data);
- } else {
- RETURN_FALSE;
- }
-}
-
-/* }}} */
-
-/* {{{ proto string mhash_keygen_s2k(int hash, string input_password, string salt, int bytes)
- Generates a key using hash functions */
-/* SALTED S2K uses a fixed salt */
-#define SALT_SIZE 8
-PHP_FUNCTION(mhash_keygen_s2k)
-{
- pval **hash, **input_password, **bytes, **input_salt;
- unsigned char *key;
- int password_len, salt_len;
- int hashid, size=0, val;
- KEYGEN keystruct;
- char salt[SALT_SIZE], *ret;
- char* password, error[128];
-
- if (ZEND_NUM_ARGS() != 4) {
- WRONG_PARAM_COUNT;
- }
- if (zend_get_parameters_ex(4, &hash, &input_password, &input_salt, &bytes) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(hash);
- convert_to_string_ex(input_password);
- convert_to_string_ex(input_salt);
- convert_to_long_ex(bytes);
-
- password = Z_STRVAL_PP(input_password);
- password_len = Z_STRLEN_PP(input_password);
-
- salt_len = Z_STRLEN_PP(input_salt);
-
- if (salt_len > mhash_get_keygen_salt_size(KEYGEN_S2K_SALTED)) {
- sprintf( error, "The specified salt [%d] is more bytes than the required by the algorithm [%d]\n", salt_len, mhash_get_keygen_salt_size(KEYGEN_S2K_SALTED));
-
- php_error(E_WARNING, error);
- }
-
- memset( salt, 0, SALT_SIZE);
- memcpy( salt, Z_STRVAL_PP(input_salt), salt_len);
- salt_len=SALT_SIZE;
-
-/* if (salt_len==0) {
- * php_error(E_WARNING, "Not using salt is really not recommended);
- * }
- */
-
- hashid = Z_LVAL_PP(hash);
- size = Z_LVAL_PP(bytes);
-
- keystruct.hash_algorithm[0]=hashid;
- keystruct.hash_algorithm[1]=hashid;
- keystruct.count=0;
- keystruct.salt = salt;
- keystruct.salt_size = salt_len;
-
- ret = emalloc(size);
- if (ret==NULL) {
- php_error(E_WARNING, MHASH_KEYGEN_FAILED_MSG);
- RETURN_FALSE;
- }
-
- val = mhash_keygen_ext( KEYGEN_S2K_SALTED, keystruct, ret, size, password, password_len);
- if (val >= 0) {
- RETVAL_STRINGL(ret, size, 0);
- } else {
- php_error(E_WARNING, MHASH_KEYGEN_FAILED_MSG);
- efree(ret);
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/mhash/mhash.dsp b/ext/mhash/mhash.dsp
deleted file mode 100644
index 12525935d8..0000000000
--- a/ext/mhash/mhash.dsp
+++ /dev/null
@@ -1,115 +0,0 @@
-# Microsoft Developer Studio Project File - Name="mhash" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=mhash - Win32 Release_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "mhash.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "mhash.mak" CFG="mhash - Win32 Release_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "mhash - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "mhash - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "mhash - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "..\..\Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\..\Zend" /I "..\..\..\TSRM" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_MHASH" /D ZTS=1 /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\main" /I "..\..\win32" /D "WIN32" /D "MHASH_EXPORTS" /D "COMPILE_DL_MHASH" /D HAVE_LIBMHASH=1 /D ZEND_DEBUG=0 /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZEND_WIN32" /D "PHP_WIN32" /D ZTS=1 /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x406 /d "NDEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib /nologo /dll /machine:I386
-# ADD LINK32 php4ts.lib libmhash.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_mhash.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
-# SUBTRACT LINK32 /pdb:none
-
-!ELSEIF "$(CFG)" == "mhash - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "..\..\Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_MHASH" /D ZTS=1 /YX /FD /c
-# ADD CPP /nologo /MDd /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\main" /I "..\..\win32" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MHASH_EXPORTS" /D "COMPILE_DL_MHASH" /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_MHASH=1 /D ZTS=1 /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x406 /d "NDEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts_debug.lib /nologo /dll /machine:I386
-# ADD LINK32 php4ts_debug.lib libmhash.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\Debug_TS/php_mhash.dll" /libpath:"..\..\Debug_TS"
-# SUBTRACT LINK32 /pdb:none
-
-!ENDIF
-
-# Begin Target
-
-# Name "mhash - Win32 Release_TS"
-# Name "mhash - Win32 Debug_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\mhash.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_mhash.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/ext/mhash/php_mhash.h b/ext/mhash/php_mhash.h
deleted file mode 100644
index 9acd447d81..0000000000
--- a/ext/mhash/php_mhash.h
+++ /dev/null
@@ -1,27 +0,0 @@
-#ifndef PHP_MHASH_H
-#define PHP_MHASH_H
-
-#if HAVE_LIBMHASH
-
-#if PHP_API_VERSION < 19990421
-#define zend_module_entry zend_module_entry
-#include "zend_modules.h"
-#include "internal_functions.h"
-#endif
-
-extern zend_module_entry mhash_module_entry;
-#define mhash_module_ptr &mhash_module_entry
-
-PHP_FUNCTION(mhash_get_block_size);
-PHP_FUNCTION(mhash_get_hash_name);
-PHP_FUNCTION(mhash_count);
-PHP_FUNCTION(mhash_keygen_s2k);
-PHP_FUNCTION(mhash);
-
-#else
-#define mhash_module_ptr NULL
-#endif
-
-#define phpext_mhash_ptr mhash_module_ptr
-
-#endif
diff --git a/ext/mhash/setup.stub b/ext/mhash/setup.stub
deleted file mode 100644
index 1af26d8434..0000000000
--- a/ext/mhash/setup.stub
+++ /dev/null
@@ -1,6 +0,0 @@
-# $Source$
-# $Id$
-
-define_option with-mhash 'mhash support?' yesnodir no \
-' Whether to build the mhash extension.'
-
diff --git a/ext/ming/CREDITS b/ext/ming/CREDITS
deleted file mode 100644
index 56058457f6..0000000000
--- a/ext/ming/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-MING
-Dave Hayden
diff --git a/ext/ming/EXPERIMENTAL b/ext/ming/EXPERIMENTAL
deleted file mode 100644
index 6443e99646..0000000000
--- a/ext/ming/EXPERIMENTAL
+++ /dev/null
@@ -1,5 +0,0 @@
-this extension is experimental,
-its functions may change their names
-or move to extension all together
-so do not rely to much on them
-you have been warned!
diff --git a/ext/ming/Makefile.in b/ext/ming/Makefile.in
deleted file mode 100644
index 41f432e52c..0000000000
--- a/ext/ming/Makefile.in
+++ /dev/null
@@ -1,8 +0,0 @@
-# $Id$
-
-LTLIBRARY_NAME = libming.la
-LTLIBRARY_SOURCES = ming.c
-LTLIBRARY_SHARED_NAME = ming.la
-LTLIBRARY_SHARED_LIBADD = $(MING_SHARED_LIBADD)
-
-include $(top_srcdir)/build/dynlib.mk
diff --git a/ext/ming/config.m4 b/ext/ming/config.m4
deleted file mode 100644
index 6e0709f27d..0000000000
--- a/ext/ming/config.m4
+++ /dev/null
@@ -1,30 +0,0 @@
-dnl $Id$
-dnl config.m4 for extension libming
-
-PHP_ARG_WITH(ming, whether to include ming support,
-[ --with-ming[=DIR] Include ming support])
-
-if test "$PHP_MING" != "no"; then
- for i in $PHP_MING /usr/local /usr; do
- if test -r $i/lib/libming.so; then
- MING_DIR=$i
- fi
- done
-
- if test -z "$MING_DIR"; then
- AC_MSG_ERROR(Please reinstall libming.so - I cannot find libming.so)
- fi
-
- PHP_ADD_INCLUDE($MING_DIR/include)
-
- PHP_SUBST(MING_SHARED_LIBADD)
- PHP_ADD_LIBRARY_WITH_PATH(ming, $MING_DIR/lib, MING_SHARED_LIBADD)
-
- AC_CHECK_LIB(ming, Ming_setScale, [
- AC_DEFINE(HAVE_MING,1,[ ])
- ],[
- AC_MSG_ERROR(Ming library 0.1.0 or greater required.)
- ])
-
- PHP_EXTENSION(ming, $ext_shared)
-fi
diff --git a/ext/ming/ming.c b/ext/ming/ming.c
deleted file mode 100644
index bcd2e2d540..0000000000
--- a/ext/ming/ming.c
+++ /dev/null
@@ -1,3046 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.01 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_01.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: dave@opaque.net |
- +----------------------------------------------------------------------+
-*/
-
-#include <stdio.h>
-#include <math.h>
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-
-#if HAVE_MING
-#include "ext/standard/info.h"
-#include "ext/standard/file.h"
-#include "php_ming.h"
-
-static zend_function_entry ming_functions[] = {
- PHP_FALIAS(ming_setcubicthreshold, ming_setCubicThreshold, NULL)
- PHP_FALIAS(ming_setscale, ming_setScale, NULL)
- PHP_FALIAS(swfbutton_keypress, swfbutton_keypress, NULL)
- { NULL, NULL, NULL }
-};
-
-static SWFMovie getMovie(zval *id);
-static SWFFill getFill(zval *id);
-static SWFGradient getGradient(zval *id);
-static SWFBitmap getBitmap(zval *id);
-static SWFShape getShape(zval *id);
-static SWFFont getFont(zval *id);
-static SWFText getText(zval *id);
-static SWFTextField getTextField(zval *id);
-static SWFDisplayItem getDisplayItem(zval *id);
-static SWFButton getButton(zval *id);
-static SWFAction getAction(zval *id);
-static SWFMorph getMorph(zval *id);
-static SWFMovieClip getSprite(zval *id);
-
-PHP_FUNCTION(ming_setCubicThreshold)
-{
- zval **num;
-
- if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &num) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_long_ex(num);
-
- Ming_setCubicThreshold(Z_LVAL_PP(num));
-}
-
-PHP_FUNCTION(ming_setScale)
-{
- zval **num;
-
- if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &num) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_double_ex(num);
-
- Ming_setScale(Z_DVAL_PP(num));
-}
-
-static int le_swfmoviep;
-static int le_swfshapep;
-static int le_swffillp;
-static int le_swfgradientp;
-static int le_swfbitmapp;
-static int le_swffontp;
-static int le_swftextp;
-static int le_swftextfieldp;
-static int le_swfdisplayitemp;
-static int le_swfbuttonp;
-static int le_swfactionp;
-static int le_swfmorphp;
-static int le_swfspritep;
-
-static int le_fopen;
-
-zend_class_entry movie_class_entry;
-zend_class_entry shape_class_entry;
-zend_class_entry fill_class_entry;
-zend_class_entry gradient_class_entry;
-zend_class_entry bitmap_class_entry;
-zend_class_entry font_class_entry;
-zend_class_entry text_class_entry;
-zend_class_entry textfield_class_entry;
-zend_class_entry displayitem_class_entry;
-zend_class_entry button_class_entry;
-zend_class_entry action_class_entry;
-zend_class_entry morph_class_entry;
-zend_class_entry sprite_class_entry;
-
-/* {{{ internal function SWFgetProperty
- */
-
-static void *SWFgetProperty(zval *id, char *name, int namelen, int proptype)
-{
- zval **tmp;
- int id_to_find;
- void *property;
- int type;
-
- if(id)
- {
- if(zend_hash_find(id->value.obj.properties, name, namelen+1, (void **)&tmp) == FAILURE)
- {
- php_error(E_WARNING, "unable to find property %s", name);
- return NULL;
- }
- id_to_find = (*tmp)->value.lval;
- }
- else
- return NULL;
-
- property = zend_list_find(id_to_find, &type);
-
- if (!property || type != proptype)
- {
- php_error(E_WARNING, "unable to find identifier (%d)", id_to_find);
- return NULL;
- }
-
- return property;
-}
-
-/* }}} */
-/* {{{ SWFCharacter - not a real class */
-
-/* {{{ internal function SWFCharacter getCharacter(zval *id)
- Returns the SWFCharacter contained in zval *id */
-
-SWFCharacter getCharacter(zval *id)
-{
- if(id->value.obj.ce == &shape_class_entry)
- return (SWFCharacter)getShape(id);
- else if(id->value.obj.ce == &font_class_entry)
- return (SWFCharacter)getFont(id);
- else if(id->value.obj.ce == &text_class_entry)
- return (SWFCharacter)getText(id);
- else if(id->value.obj.ce == &textfield_class_entry)
- return (SWFCharacter)getTextField(id);
- else if(id->value.obj.ce == &button_class_entry)
- return (SWFCharacter)getButton(id);
- else if(id->value.obj.ce == &morph_class_entry)
- return (SWFCharacter)getMorph(id);
- else if(id->value.obj.ce == &sprite_class_entry)
- return (SWFCharacter)getSprite(id);
- else
- php_error(E_ERROR, "called object is not an SWFCharacter");
-}
-
-/* }}} */
-
-/* }}} */
-
-/* {{{ SWFAction */
-
-static zend_function_entry swfaction_functions[] = {
- PHP_FALIAS(swfaction, swfaction_init, NULL)
- { NULL, NULL, NULL }
-};
-
-/* {{{ proto object swfaction_init(string)
- returns a new SWFAction object, compiling the given script */
-
-PHP_FUNCTION(swfaction_init)
-{
- SWFAction action;
- zval **script;
- int ret;
-
- if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &script) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_string_ex(script);
-
- /* XXX - need to deal with compiler errors */
- action = compileSWFActionCode(Z_STRVAL_PP(script));
-
- if(!action)
- php_error(E_ERROR, "Couldn't compile code. And I'm not smart enough to tell you why, sorry.");
-
- ret = zend_list_insert(action, le_swfactionp);
-
- object_init_ex(getThis(), &action_class_entry);
- add_property_resource(getThis(), "action", ret);
- zend_list_addref(ret);
-}
-/* no destructor for SWFAction, it's not a character */
-
-/* }}} */
-/* {{{ internal function getAction
- Returns the SWFAction object contained in zval *id */
-
-static SWFAction getAction(zval *id)
-{
- void *action = SWFgetProperty(id, "action", 6, le_swfactionp);
-
- if(!action)
- php_error(E_ERROR, "called object is not an SWFAction!");
-
- return (SWFAction)action;
-}
-
-/* }}} */
-
-/* }}} */
-/* {{{ SWFBitmap */
-
-static zend_function_entry swfbitmap_functions[] = {
- PHP_FALIAS(swfbitmap, swfbitmap_init, NULL)
- PHP_FALIAS(getwidth, swfbitmap_getWidth, NULL)
- PHP_FALIAS(getheight, swfbitmap_getHeight, NULL)
- { NULL, NULL, NULL }
-};
-
-/* {{{ proto class swfbitmap_init(file, [maskfile])
- Returns a new SWFBitmap object from jpg (with optional mask) or dbl file */
-
-PHP_FUNCTION(swfbitmap_init)
-{
- zval **file, **mask;
- char *filename, *maskname = NULL;
- SWFBitmap bitmap;
- int ret, l;
-
- if(ZEND_NUM_ARGS() == 1)
- {
- if(zend_get_parameters_ex(1, &file) == FAILURE)
- WRONG_PARAM_COUNT;
- }
- else if(ZEND_NUM_ARGS() == 2)
- {
- if(zend_get_parameters_ex(2, &file, &mask) == FAILURE)
- WRONG_PARAM_COUNT;
-
- maskname = Z_STRVAL_PP(mask);
- }
- else
- WRONG_PARAM_COUNT;
-
- filename = Z_STRVAL_PP(file);
- l = Z_STRLEN_PP(file);
-
- if(strncasecmp(filename+l-4, ".jpg", 4) == 0 ||
- strncasecmp(filename+l-5, ".jpeg", 5) == 0)
- {
- if(maskname != NULL)
- {
- FILE *jpeg, *mask;
- if((jpeg = VCWD_FOPEN(filename, "rb")) == NULL)
- php_error(E_ERROR, "Couldn't find file %s", filename);
-
- if((mask = VCWD_FOPEN(maskname, "rb")) == NULL)
- php_error(E_ERROR, "Couldn't find file %s", maskname);
-
- bitmap = newSWFJpegWithAlpha(jpeg, mask);
-
- ZEND_REGISTER_RESOURCE(NULL, jpeg, le_fopen);
- ZEND_REGISTER_RESOURCE(NULL, mask, le_fopen);
- }
- else
- {
- FILE *jpeg;
-
- if((jpeg = VCWD_FOPEN(filename, "rb")) == NULL)
- php_error(E_ERROR, "Couldn't find file %s", filename);
-
- bitmap = newSWFJpegBitmap(jpeg);
-
- ZEND_REGISTER_RESOURCE(NULL, jpeg, le_fopen);
- }
- }
- else if(strncasecmp(filename+l-4, ".dbl", 4) == 0)
- {
- FILE *dbl;
-
- if((dbl = VCWD_FOPEN(filename, "rb")) == NULL)
- php_error(E_ERROR, "Couldn't find file %s", filename);
-
- bitmap = newSWFDBLBitmap(dbl);
-
- ZEND_REGISTER_RESOURCE(NULL, dbl, le_fopen);
- }
- else
- php_error(E_ERROR, "Sorry, can't tell what type of file %s is", filename);
-
- ret = zend_list_insert(bitmap, le_swfbitmapp);
- object_init_ex(getThis(), &bitmap_class_entry);
- add_property_resource(getThis(), "bitmap", ret);
- zend_list_addref(ret);
-}
-static void destroy_SWFBitmap_resource(zend_rsrc_list_entry *resource)
-{
- destroySWFBitmap((SWFBitmap)resource->ptr);
-}
-
-/* }}} */
-/* {{{ internal function getBitmap
- Returns the SWFBitmap object contained in zval *id */
-
-static SWFBitmap getBitmap(zval *id)
-{
- void *bitmap = SWFgetProperty(id, "bitmap", 6, le_swfbitmapp);
-
- if(!bitmap)
- php_error(E_ERROR, "called object is not an SWFBitmap!");
-
- return (SWFBitmap)bitmap;
-}
-
-/* }}} */
-/* {{{ proto void swfbitmap_getWidth()
- Returns the width of this bitmap */
-
-PHP_FUNCTION(swfbitmap_getWidth)
-{
- if(ZEND_NUM_ARGS() != 0)
- WRONG_PARAM_COUNT;
-
- RETURN_DOUBLE(SWFBitmap_getWidth(getBitmap(getThis())));
-}
-
-/* }}} */
-/* {{{ proto void swfbitmap_getHeight()
- Returns the height of this bitmap */
-
-PHP_FUNCTION(swfbitmap_getHeight)
-{
- if(ZEND_NUM_ARGS() != 0)
- WRONG_PARAM_COUNT;
-
- RETURN_DOUBLE(SWFBitmap_getHeight(getBitmap(getThis())));
-}
-
-/* }}} */
-
-/* }}} */
-/* {{{ SWFButton */
-
-static zend_function_entry swfbutton_functions[] = {
- PHP_FALIAS(swfbutton, swfbutton_init, NULL)
- PHP_FALIAS(sethit, swfbutton_setHit, NULL)
- PHP_FALIAS(setover, swfbutton_setOver, NULL)
- PHP_FALIAS(setup, swfbutton_setUp, NULL)
- PHP_FALIAS(setdown, swfbutton_setDown, NULL)
- PHP_FALIAS(setaction, swfbutton_setAction, NULL)
- PHP_FALIAS(addshape, swfbutton_addShape, NULL)
- PHP_FALIAS(addaction, swfbutton_addAction, NULL)
- { NULL, NULL, NULL }
-};
-
-/* {{{ proto object swfbutton_init(void)
- returns a new SWFButton object */
-
-PHP_FUNCTION(swfbutton_init)
-{
- SWFButton button = newSWFButton();
- int ret = zend_list_insert(button, le_swfbuttonp);
-
- object_init_ex(getThis(), &button_class_entry);
- add_property_resource(getThis(), "button", ret);
- zend_list_addref(ret);
-}
-static void destroy_SWFButton_resource(zend_rsrc_list_entry *resource)
-{
- destroySWFButton((SWFButton)resource->ptr);
-}
-
-/* }}} */
-/* {{{ internal function getButton
- Returns the SWFButton object contained in zval *id */
-
-static SWFButton getButton(zval *id)
-{
- void *button = SWFgetProperty(id, "button", 6, le_swfbuttonp);
-
- if(!button)
- php_error(E_ERROR, "called object is not an SWFButton!");
-
- return (SWFButton)button;
-}
-
-/* }}} */
-/* {{{ proto void swfbutton_setHit(SWFCharacter)
- sets the character for this button's hit test state */
-
-PHP_FUNCTION(swfbutton_setHit)
-{
- zval **zchar;
- SWFButton button = getButton(getThis());
- SWFCharacter character;
-
- if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &zchar) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_object_ex(zchar);
- character = getCharacter(*zchar);
-
- SWFButton_addShape(button, character, SWFBUTTONRECORD_HITSTATE);
-}
-
-/* }}} */
-/* {{{ proto void swfbutton_setOver(SWFCharacter)
- sets the character for this button's over state */
-
-PHP_FUNCTION(swfbutton_setOver)
-{
- zval **zchar;
- SWFButton button = getButton(getThis());
- SWFCharacter character;
-
- if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &zchar) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_object_ex(zchar);
- character = getCharacter(*zchar);
-
- SWFButton_addShape(button, character, SWFBUTTONRECORD_OVERSTATE);
-}
-
-/* }}} */
-/* {{{ proto void swfbutton_setUp(SWFCharacter)
- sets the character for this button's up state */
-
-PHP_FUNCTION(swfbutton_setUp)
-{
- zval **zchar;
- SWFButton button = getButton(getThis());
- SWFCharacter character;
-
- if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &zchar) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_object_ex(zchar);
- character = getCharacter(*zchar);
-
- SWFButton_addShape(button, character, SWFBUTTONRECORD_UPSTATE);
-}
-
-/* }}} */
-/* {{{ proto void swfbutton_setDown(SWFCharacter)
- sets the character for this button's down state */
-
-PHP_FUNCTION(swfbutton_setDown)
-{
- zval **zchar;
- SWFButton button = getButton(getThis());
- SWFCharacter character;
-
- if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &zchar) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_object_ex(zchar);
- character = getCharacter(*zchar);
-
- SWFButton_addShape(button, character, SWFBUTTONRECORD_DOWNSTATE);
-}
-
-/* }}} */
-/* {{{ proto void swfbutton_addShape(SWFCharacter character, int flags)
- sets the character to display for the condition described in flags */
-
-PHP_FUNCTION(swfbutton_addShape)
-{
- zval **zchar, **flags;
- SWFButton button = getButton(getThis());
- SWFCharacter character;
-
- if(ZEND_NUM_ARGS() != 2 ||
- zend_get_parameters_ex(2, &zchar, &flags) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_object_ex(zchar);
- character = getCharacter(*zchar);
-
- convert_to_long_ex(flags);
-
- SWFButton_addShape(button, character, Z_LVAL_PP(flags));
-}
-
-/* }}} */
-/* {{{ proto void swfbutton_setAction(SWFAction)
- sets the action to perform when button is pressed */
-
-PHP_FUNCTION(swfbutton_setAction)
-{
- zval **zaction;
- SWFButton button = getButton(getThis());
- SWFAction action;
-
- if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &zaction) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_object_ex(zaction);
- action = getAction(*zaction);
-
- SWFButton_addAction(button, action, SWFBUTTON_OVERDOWNTOOVERUP);
-}
-
-/* }}} */
-/* {{{ proto void swfbutton_addAction(SWFAction action, int flags)
- sets the action to perform when conditions described in flags is met */
-
-PHP_FUNCTION(swfbutton_addAction)
-{
- zval **zaction, **flags;
- SWFButton button = getButton(getThis());
- SWFAction action;
-
- if(ZEND_NUM_ARGS() != 2 ||
- zend_get_parameters_ex(2, &zaction, &flags) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_object_ex(zaction);
- action = getAction(*zaction);
-
- convert_to_long_ex(flags);
-
- SWFButton_addAction(button, action, Z_LVAL_PP(flags));
-}
-
-/* }}} */
-/* {{{ proto int SWFBUTTON_KEYPRESS(char)
- returns the action flag for keyPress(char) */
-
-PHP_FUNCTION(swfbutton_keypress)
-{
- zval **key;
- char c;
-
- if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &key) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_string_ex(key);
-
- if(Z_STRLEN_PP(key) > 1)
- php_error(E_ERROR, "SWFBUTTON_KEYPRESS expects only one character!");
-
- c = Z_STRVAL_PP(key)[0];
-
- RETURN_LONG((c&0x7f)<<9);
-}
-
-/* }}} */
-/* }}} */
-/* {{{ SWFDisplayitem */
-
-static zend_function_entry swfdisplayitem_functions[] = {
- PHP_FALIAS(moveto, swfdisplayitem_moveTo, NULL)
- PHP_FALIAS(move, swfdisplayitem_move, NULL)
- PHP_FALIAS(scaleto, swfdisplayitem_scaleTo, NULL)
- PHP_FALIAS(scale, swfdisplayitem_scale, NULL)
- PHP_FALIAS(rotateto, swfdisplayitem_rotateTo, NULL)
- PHP_FALIAS(rotate, swfdisplayitem_rotate, NULL)
- PHP_FALIAS(skewxto, swfdisplayitem_skewXTo, NULL)
- PHP_FALIAS(skewx, swfdisplayitem_skewX, NULL)
- PHP_FALIAS(skewyto, swfdisplayitem_skewYTo, NULL)
- PHP_FALIAS(skewy, swfdisplayitem_skewY, NULL)
- PHP_FALIAS(setmatrix, swfdisplayitem_setMatrix, NULL)
- PHP_FALIAS(setdepth, swfdisplayitem_setDepth, NULL)
- PHP_FALIAS(setratio, swfdisplayitem_setRatio, NULL)
- PHP_FALIAS(addcolor, swfdisplayitem_addColor, NULL)
- PHP_FALIAS(multcolor, swfdisplayitem_multColor, NULL)
- PHP_FALIAS(setname, swfdisplayitem_setName, NULL)
- { NULL, NULL, NULL }
-};
-
-/* {{{ internal function getDisplayItem
- Returns the SWFDisplayItem contained in zval *id */
-
-static SWFDisplayItem getDisplayItem(zval *id)
-{
- void *item = SWFgetProperty(id, "displayitem", 11, le_swfdisplayitemp);
-
- if(!item)
- php_error(E_ERROR, "called object is not an SWFDisplayItem!");
-
- return (SWFDisplayItem)item;
-}
-
-/* }}} */
-/* {{{ proto void swfdisplayitem_moveTo(int x, int y)
- Moves this SWFDisplayItem to movie coordinates (x,y) */
-
-PHP_FUNCTION(swfdisplayitem_moveTo)
-{
- zval **x, **y;
-
- if(ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &x, &y) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_double_ex(x);
- convert_to_double_ex(y);
-
- SWFDisplayItem_moveTo(getDisplayItem(getThis()), Z_DVAL_PP(x), Z_DVAL_PP(y));
-}
-
-/* }}} */
-/* {{{ proto void swfdisplayitem_move(int dx, int dy)
- Displaces this SWFDisplayItem by (dx,dy) in movie coordinates. */
-
-PHP_FUNCTION(swfdisplayitem_move)
-{
- zval **x, **y;
-
- if(ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &x, &y) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_double_ex(x);
- convert_to_double_ex(y);
-
- SWFDisplayItem_move(getDisplayItem(getThis()), Z_DVAL_PP(x), Z_DVAL_PP(y));
-}
-
-/* }}} */
-/* {{{ proto void swfdisplayitem_scaleTo(float xScale, [float yScale])
- Scales this SWFDisplayItem by xScale in the x direction, yScale in the y,
- or both to xScale if only one arg. */
-
-PHP_FUNCTION(swfdisplayitem_scaleTo)
-{
- zval **x, **y;
-
- if(ZEND_NUM_ARGS() == 1)
- {
- if(zend_get_parameters_ex(1, &x) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_double_ex(x);
-
- SWFDisplayItem_scaleTo(getDisplayItem(getThis()),
- Z_DVAL_PP(x), Z_DVAL_PP(x));
- }
- else if(ZEND_NUM_ARGS() == 2)
- {
- if(zend_get_parameters_ex(2, &x, &y) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_double_ex(x);
- convert_to_double_ex(y);
-
- SWFDisplayItem_scaleTo(getDisplayItem(getThis()),
- Z_DVAL_PP(x), Z_DVAL_PP(y));
- }
- else
- WRONG_PARAM_COUNT;
-}
-
-/* }}} */
-/* {{{ proto void swfdisplayitem_scale(float xScale, float yScale)
- Multiplies this SWFDisplayItem's current x scale by xScale,
- its y scale by yScale */
-
-PHP_FUNCTION(swfdisplayitem_scale)
-{
- zval **x, **y;
-
- if(ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &x, &y) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_double_ex(x);
- convert_to_double_ex(y);
-
- SWFDisplayItem_scale(getDisplayItem(getThis()), Z_DVAL_PP(x), Z_DVAL_PP(y));
-}
-
-/* }}} */
-/* {{{ proto void swfdisplayitem_rotateTo(float degrees)
- Rotates this SWFDisplayItem the given (clockwise) degrees from its original
- orientation */
-
-PHP_FUNCTION(swfdisplayitem_rotateTo)
-{
- zval **degrees;
-
- if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &degrees) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_double_ex(degrees);
-
- SWFDisplayItem_rotateTo(getDisplayItem(getThis()), Z_DVAL_PP(degrees));
-}
-
-/* }}} */
-/* {{{ proto void swfdisplayitem_rotate(float degrees)
- Rotates this SWFDisplayItem the given (clockwise) degrees from its current
- orientation */
-
-PHP_FUNCTION(swfdisplayitem_rotate)
-{
- zval **degrees;
-
- if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &degrees) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_double_ex(degrees);
-
- SWFDisplayItem_rotate(getDisplayItem(getThis()), Z_DVAL_PP(degrees));
-}
-
-/* }}} */
-/* {{{ proto void swfdisplayitem_skewXTo(float xSkew)
- Sets this SWFDisplayItem's x skew value to xSkew */
-
-PHP_FUNCTION(swfdisplayitem_skewXTo)
-{
- zval **x;
-
- if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &x) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_double_ex(x);
-
- SWFDisplayItem_skewXTo(getDisplayItem(getThis()), Z_DVAL_PP(x));
-}
-
-/* }}} */
-/* {{{ proto void swfdisplayitem_skewX(float xSkew)
- Adds xSkew to this SWFDisplayItem's x skew value */
-
-PHP_FUNCTION(swfdisplayitem_skewX)
-{
- zval **x;
-
- if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &x) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_double_ex(x);
-
- SWFDisplayItem_skewX(getDisplayItem(getThis()), Z_DVAL_PP(x));
-}
-
-/* }}} */
-/* {{{ proto void swfdisplayitem_skewYTo(float ySkew)
- Sets this SWFDisplayItem's y skew value to ySkew */
-
-PHP_FUNCTION(swfdisplayitem_skewYTo)
-{
- zval **y;
-
- if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &y) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_double_ex(y);
-
- SWFDisplayItem_skewYTo(getDisplayItem(getThis()), Z_DVAL_PP(y));
-}
-
-/* }}} */
-/* {{{ proto void swfdisplayitem_skewY(float ySkew)
- Adds ySkew to this SWFDisplayItem's y skew value */
-
-PHP_FUNCTION(swfdisplayitem_skewY)
-{
- zval **y;
-
- if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &y) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_double_ex(y);
-
- SWFDisplayItem_skewY(getDisplayItem(getThis()), Z_DVAL_PP(y));
-}
-
-/* }}} */
-/* {{{ proto void swfdisplayitem_setMatrix(float a, float b, float c, float d, float x, float y)
- Sets the item's transform matrix */
-
-PHP_FUNCTION(swfdisplayitem_setMatrix)
-{
- zval **a, **b, **c, **d, **x, **y;
-
- if(ZEND_NUM_ARGS() != 6 ||
- zend_get_parameters_ex(6, &a, &b, &c, &d, &x, &y) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_double_ex(a);
- convert_to_double_ex(b);
- convert_to_double_ex(c);
- convert_to_double_ex(d);
- convert_to_double_ex(x);
- convert_to_double_ex(y);
-
- SWFDisplayItem_setMatrix(getDisplayItem(getThis()),
- Z_DVAL_PP(a), Z_DVAL_PP(b), Z_DVAL_PP(c),
- Z_DVAL_PP(d), Z_DVAL_PP(x), Z_DVAL_PP(y));
-}
-
-/* }}} */
-/* {{{ proto void swfdisplayitem_setDepth(int depth)
- Sets this SWFDisplayItem's z-depth to depth. Items with higher depth
- values are drawn on top of those with lower values */
-
-PHP_FUNCTION(swfdisplayitem_setDepth)
-{
- zval **depth;
-
- if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &depth) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_long_ex(depth);
-
- SWFDisplayItem_setDepth(getDisplayItem(getThis()), Z_LVAL_PP(depth));
-}
-
-/* }}} */
-/* {{{ proto void swfdisplayitem_setRatio(float ratio)
- Sets this SWFDisplayItem's ratio to ratio. Obviously only does anything
- if displayitem was created from an SWFMorph */
-
-PHP_FUNCTION(swfdisplayitem_setRatio)
-{
- zval **ratio;
-
- if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &ratio) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_double_ex(ratio);
-
- SWFDisplayItem_setRatio(getDisplayItem(getThis()), Z_DVAL_PP(ratio));
-}
-
-/* }}} */
-/* {{{ proto void swfdisplayitem_addColor(int r, int g, int b [, int a])
- Sets the add color part of this SWFDisplayItem's CXform to (r,g,b,[a]).
- a defaults to 0 */
-
-PHP_FUNCTION(swfdisplayitem_addColor)
-{
- zval **r, **g, **b, **za;
- int a = 0;
-
- if(ZEND_NUM_ARGS() == 4)
- {
- if(zend_get_parameters_ex(4, &r, &g, &b, &za) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_long_ex(za);
- a = Z_LVAL_PP(za);
- }
- else if(ZEND_NUM_ARGS() == 3)
- {
- if(zend_get_parameters_ex(3, &r, &g, &b) == FAILURE)
- WRONG_PARAM_COUNT;
- }
- else
- WRONG_PARAM_COUNT;
-
- convert_to_long_ex(r);
- convert_to_long_ex(g);
- convert_to_long_ex(b);
-
- SWFDisplayItem_setColorAdd(getDisplayItem(getThis()),
- Z_LVAL_PP(r), Z_LVAL_PP(g), Z_LVAL_PP(b), a);
-}
-
-/* }}} */
-/* {{{ proto void swfdisplayitem_multColor(float r, float g, float b, [float a])
- Sets the multiply color part of this SWFDisplayItem's CXform to (r,g,b,[a]).
- a defaults to 1.0 */
-
-PHP_FUNCTION(swfdisplayitem_multColor)
-{
- zval **r, **g, **b, **za;
- float a = 1.0;
-
- if(ZEND_NUM_ARGS() == 4)
- {
- if(zend_get_parameters_ex(4, &r, &g, &b, &za) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_double_ex(za);
- a = Z_DVAL_PP(za);
- }
- else if(ZEND_NUM_ARGS() == 3)
- {
- if(zend_get_parameters_ex(3, &r, &g, &b) == FAILURE)
- WRONG_PARAM_COUNT;
- }
- else
- WRONG_PARAM_COUNT;
-
- convert_to_double_ex(r);
- convert_to_double_ex(g);
- convert_to_double_ex(b);
-
- SWFDisplayItem_setColorMult(getDisplayItem(getThis()),
- Z_DVAL_PP(r), Z_DVAL_PP(g), Z_DVAL_PP(b), a);
-}
-
-/* }}} */
-/* {{{ proto void swfdisplayitem_setName(string name)
- Sets this SWFDisplayItem's name to name. */
-
-PHP_FUNCTION(swfdisplayitem_setName)
-{
- zval **name;
- SWFDisplayItem item = getDisplayItem(getThis());
-
- if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &name) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_string_ex(name);
-
- SWFDisplayItem_setName(item, Z_STRVAL_PP(name));
-}
-
-/* }}} */
-
-/* }}} */
-/* {{{ SWFFill */
-
-static zend_function_entry swffill_functions[] = {
- PHP_FALIAS(swffill, swffill_init, NULL)
- PHP_FALIAS(moveto, swffill_moveTo, NULL)
- PHP_FALIAS(scaleto, swffill_scaleTo, NULL)
- PHP_FALIAS(rotateto, swffill_rotateTo, NULL)
- PHP_FALIAS(skewxto, swffill_skewXTo, NULL)
- PHP_FALIAS(skewyto, swffill_skewYTo, NULL)
- { NULL, NULL, NULL }
-};
-
-/* {{{ proto class swffill_init(void)
- Returns a new SWFFill object */
-
-PHP_FUNCTION(swffill_init)
-{
- php_error(E_ERROR, "Instantiating SWFFill won't do any good- use SWFShape::addFill() instead!");
-}
-static void destroy_SWFFill_resource(zend_rsrc_list_entry *resource)
-{
- /* this only destroys the shallow wrapper for SWFFillStyle,
- which SWFShape destroys. So everything's okay. I hope. */
-
- destroySWFFill((SWFFill)resource->ptr);
-}
-
-/* }}} */
-/* {{{ internal function getFill
- Returns the SWFFill object contained in zval *id */
-
-static SWFFill getFill(zval *id)
-{
- void *fill = SWFgetProperty(id, "fill", 4, le_swffillp);
-
- if(!fill)
- php_error(E_ERROR, "called object is not an SWFFill!");
-
- return (SWFFill)fill;
-}
-
-/* }}} */
-
-/* {{{ proto void swffill_moveTo(int x, int y)
- Moves this SWFFill to shape coordinates (x,y) */
-
-PHP_FUNCTION(swffill_moveTo)
-{
- zval **x, **y;
-
- if(ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &x, &y) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_double_ex(x);
- convert_to_double_ex(y);
-
- SWFFill_moveTo(getFill(getThis()), Z_DVAL_PP(x), Z_DVAL_PP(y));
-}
-
-/* }}} */
-/* {{{ proto void swffill_scaleTo(float xScale, [float yScale])
- Scales this SWFFill by xScale in the x direction, yScale in the y,
- or both to xScale if only one arg. */
-
-PHP_FUNCTION(swffill_scaleTo)
-{
- zval **x, **y;
-
- if(ZEND_NUM_ARGS() == 1)
- {
- if(zend_get_parameters_ex(1, &x) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_double_ex(x);
-
- SWFFill_scaleXYTo(getFill(getThis()), Z_DVAL_PP(x), Z_DVAL_PP(x));
- }
- else if(ZEND_NUM_ARGS() == 2)
- {
- if(zend_get_parameters_ex(2, &x, &y) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_double_ex(x);
- convert_to_double_ex(y);
-
- SWFFill_scaleXYTo(getFill(getThis()), Z_DVAL_PP(x), Z_DVAL_PP(y));
- }
- else
- WRONG_PARAM_COUNT;
-}
-
-/* }}} */
-/* {{{ proto void swffill_rotateTo(float degrees)
- Rotates this SWFFill the given (clockwise) degrees from its original
- orientation */
-
-PHP_FUNCTION(swffill_rotateTo)
-{
- zval **degrees;
-
- if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &degrees) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_double_ex(degrees);
-
- SWFFill_rotateTo(getFill(getThis()), Z_DVAL_PP(degrees));
-}
-
-/* }}} */
-/* {{{ proto void swffill_skewXTo(float xSkew)
- Sets this SWFFill's x skew value to xSkew */
-
-PHP_FUNCTION(swffill_skewXTo)
-{
- zval **x;
-
- if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &x) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_double_ex(x);
-
- SWFFill_skewXTo(getFill(getThis()), Z_DVAL_PP(x));
-}
-
-/* }}} */
-/* {{{ proto void swffill_skewYTo(float ySkew)
- Sets this SWFFill's y skew value to ySkew */
-
-PHP_FUNCTION(swffill_skewYTo)
-{
- zval **y;
-
- if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &y) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_double_ex(y);
-
- SWFFill_skewYTo(getFill(getThis()), Z_DVAL_PP(y));
-}
-
-/* }}} */
-
-/* }}} */
-/* {{{ SWFFont */
-
-static zend_function_entry swffont_functions[] = {
- PHP_FALIAS(swffont, swffont_init, NULL)
- PHP_FALIAS(getwidth, swffont_getWidth, NULL)
- PHP_FALIAS(getascent, swffont_getAscent, NULL)
- PHP_FALIAS(getdescent, swffont_getDescent, NULL)
- PHP_FALIAS(getleading, swffont_getLeading, NULL)
- { NULL, NULL, NULL }
-};
-
-/* {{{ internal function SWFText getFont(zval *id)
- Returns the Font object in zval *id */
-
-SWFFont getFont(zval *id)
-{
- void *font = SWFgetProperty(id, "font", 4, le_swffontp);
-
- if(!font)
- php_error(E_ERROR, "called object is not an SWFFont!");
-
- return (SWFFont)font;
-}
-
-/* }}} */
-/* {{{ proto class swffont_init(string filename)
- Returns a new SWFFont object from given file */
-
-PHP_FUNCTION(swffont_init)
-{
- FILE *file;
- zval **zfile;
- SWFFont font;
- int ret;
-
- if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &zfile) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_string_ex(zfile);
-
- if(strcmp(Z_STRVAL_PP(zfile)+Z_STRLEN_PP(zfile)-4, ".fdb") == 0)
- {
- file = VCWD_FOPEN(Z_STRVAL_PP(zfile), "rb");
-
- if(!file)
- php_error(E_ERROR, "Couldn't find FDB file %s", Z_STRVAL_PP(zfile));
-
- font = loadSWFFontFromFile(file);
- fclose(file);
- }
- else
- font = newSWFBrowserFont(Z_STRVAL_PP(zfile));
-
- ret = zend_list_insert(font, le_swffontp);
-
- object_init_ex(getThis(), &font_class_entry);
- add_property_resource(getThis(), "font", ret);
- zend_list_addref(ret);
-}
-static void destroy_SWFFont_resource(zend_rsrc_list_entry *resource)
-{
- destroySWFBlock((SWFBlock)resource->ptr);
-}
-
-/* }}} */
-/* {{{ proto int swffont_getWidth(string)
- calculates the width of the given string in this font at full height */
-
-PHP_FUNCTION(swffont_getWidth)
-{
- zval **zstring;
- float width;
-
- if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &zstring) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_string_ex(zstring);
-
- width = SWFFont_getStringWidth(getFont(getThis()), Z_STRVAL_PP(zstring));
-
- RETURN_DOUBLE(width);
-}
-
-/* }}} */
-/* {{{ proto int swffont_getAscent()
- returns the ascent of the font, or 0 if not available */
-
-PHP_FUNCTION(swffont_getAscent)
-{
- if(ZEND_NUM_ARGS() != 0)
- WRONG_PARAM_COUNT;
-
- RETURN_DOUBLE(SWFFont_getAscent(getFont(getThis())));
-}
-
-/* }}} */
-/* {{{ proto int swffont_getDescent()
- returns the descent of the font, or 0 if not available */
-
-PHP_FUNCTION(swffont_getDescent)
-{
- if(ZEND_NUM_ARGS() != 0)
- WRONG_PARAM_COUNT;
-
- RETURN_DOUBLE(SWFFont_getDescent(getFont(getThis())));
-}
-
-/* }}} */
-/* {{{ proto int swffont_getLeading()
- returns the leading of the font, or 0 if not available */
-
-PHP_FUNCTION(swffont_getLeading)
-{
- if(ZEND_NUM_ARGS() != 0)
- WRONG_PARAM_COUNT;
-
- RETURN_DOUBLE(SWFFont_getLeading(getFont(getThis())));
-}
-
-/* }}} */
-
-/* }}} */
-/* {{{ SWFGradient */
-
-static zend_function_entry swfgradient_functions[] = {
- PHP_FALIAS(swfgradient, swfgradient_init, NULL)
- PHP_FALIAS(addentry, swfgradient_addEntry, NULL)
- { NULL, NULL, NULL }
-};
-
-/* {{{ proto class swfgradient_init(void)
- Returns a new SWFGradient object */
-
-PHP_FUNCTION(swfgradient_init)
-{
- SWFGradient gradient = newSWFGradient();
- int ret = zend_list_insert(gradient, le_swfgradientp);
-
- object_init_ex(getThis(), &gradient_class_entry);
- add_property_resource(getThis(), "gradient", ret);
- zend_list_addref(ret);
-}
-static void destroy_SWFGradient_resource(zend_rsrc_list_entry *resource)
-{
- destroySWFGradient((SWFGradient)resource->ptr);
-}
-
-/* }}} */
-/* {{{ internal function getGradient
- Returns the SWFGradient object contained in zval *id */
-
-static SWFGradient getGradient(zval *id)
-{
- void *gradient = SWFgetProperty(id, "gradient", 8, le_swfgradientp);
-
- if(!gradient)
- php_error(E_ERROR, "called object is not an SWFGradient!");
-
- return (SWFGradient)gradient;
-}
-
-/* }}} */
-/* {{{ proto void swfgradient_addEntry(float ratio, byte r, byte g, byte b [, byte a]
- add given entry to the gradient */
-
-PHP_FUNCTION(swfgradient_addEntry)
-{
- zval **ratio, **r, **g, **b, **za;
- byte a = 0xff;
-
- if(ZEND_NUM_ARGS() == 4)
- {
- if(zend_get_parameters_ex(4, &ratio, &r, &g, &b) == FAILURE)
- WRONG_PARAM_COUNT;
- }
- else if(ZEND_NUM_ARGS() == 5)
- {
- zval **za;
-
- if(zend_get_parameters_ex(5, &ratio, &r, &g, &b, &za) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_long_ex(za);
- a = Z_LVAL_PP(za);
- }
- else
- WRONG_PARAM_COUNT;
-
- convert_to_double_ex(ratio);
- convert_to_long_ex(r);
- convert_to_long_ex(g);
- convert_to_long_ex(b);
-
- SWFGradient_addEntry(getGradient(getThis()), Z_DVAL_PP(ratio),
- Z_LVAL_PP(r), Z_LVAL_PP(g), Z_LVAL_PP(b), a);
-}
-
-/* }}} */
-
-/* }}} */
-/* {{{ SWFMorph */
-
-static zend_function_entry swfmorph_functions[] = {
- PHP_FALIAS(swfmorph, swfmorph_init, NULL)
- PHP_FALIAS(getshape1, swfmorph_getShape1, NULL)
- PHP_FALIAS(getshape2, swfmorph_getShape2, NULL)
- { NULL, NULL, NULL }
-};
-
-/* {{{ proto object swfmorph_init()
- returns a new SWFMorph object */
-
-PHP_FUNCTION(swfmorph_init)
-{
- SWFMorph morph = newSWFMorphShape();
- int ret = zend_list_insert(morph, le_swfmorphp);
-
- object_init_ex(getThis(), &morph_class_entry);
- add_property_resource(getThis(), "morph", ret);
- zend_list_addref(ret);
-}
-static void destroy_SWFMorph_resource(zend_rsrc_list_entry *resource)
-{
- destroySWFMorph((SWFMorph)resource->ptr);
-}
-
-/* }}} */
-/* {{{ internal function getMorph
- Returns the SWFMorph object contained in zval *id */
-
-static SWFMorph getMorph(zval *id)
-{
- void *morph = SWFgetProperty(id, "morph", 5, le_swfmorphp);
-
- if(!morph)
- php_error(E_ERROR, "called object is not an SWFMorph!");
-
- return (SWFMorph)morph;
-}
-
-/* }}} */
-/* {{{ proto SWFShape swfmorph_getShape1()
- return's this SWFMorph's start shape */
-
-PHP_FUNCTION(swfmorph_getShape1)
-{
- SWFMorph morph = getMorph(getThis());
- SWFShape shape = SWFMorph_getShape1(morph);
- int ret = zend_list_insert(shape, le_swfshapep);
-
- object_init_ex(return_value, &shape_class_entry);
- add_property_resource(return_value, "shape", ret);
- zend_list_addref(ret);
-}
-
-/* }}} */
-/* {{{ proto SWFShape swfmorph_getShape2()
- return's this SWFMorph's start shape */
-
-PHP_FUNCTION(swfmorph_getShape2)
-{
- SWFMorph morph = getMorph(getThis());
- SWFShape shape = SWFMorph_getShape2(morph);
- int ret = zend_list_insert(shape, le_swfshapep);
-
- object_init_ex(return_value, &shape_class_entry);
- add_property_resource(return_value, "shape", ret);
- zend_list_addref(ret);
-}
-
-/* }}} */
-
-/* }}} */
-/* {{{ SWFMovie */
-
-static zend_function_entry swfmovie_functions[] = {
- PHP_FALIAS(swfmovie, swfmovie_init, NULL)
- PHP_FALIAS(nextframe, swfmovie_nextFrame, NULL)
- PHP_FALIAS(labelframe, swfmovie_labelFrame, NULL)
- PHP_FALIAS(add, swfmovie_add, NULL)
- PHP_FALIAS(remove, swfmovie_remove, NULL)
- PHP_FALIAS(output, swfmovie_output, NULL)
- PHP_FALIAS(save, swfmovie_save, NULL)
- PHP_FALIAS(savetofile, swfmovie_saveToFile, NULL)
- PHP_FALIAS(setbackground, swfmovie_setBackground, NULL)
- PHP_FALIAS(setrate, swfmovie_setRate, NULL)
- PHP_FALIAS(setdimension, swfmovie_setDimension, NULL)
- PHP_FALIAS(setframes, swfmovie_setFrames, NULL)
- PHP_FALIAS(streammp3, swfmovie_streamMp3, NULL)
- { NULL, NULL, NULL }
-};
-
-/* {{{ swfmovie_init */
-
-PHP_FUNCTION(swfmovie_init)
-{
- zval **version;
- SWFMovie movie;
- int ret;
-
- if(ZEND_NUM_ARGS() == 1)
- {
- if(zend_get_parameters_ex(1, &version) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_long_ex(version);
-
- movie = newSWFMovie(Z_LVAL_PP(version));
- }
- else
- movie = newSWFMovie(4); /* default version 4 */
-
- ret = zend_list_insert(movie, le_swfmoviep);
-
- object_init_ex(getThis(), &movie_class_entry);
- add_property_resource(getThis(), "movie", ret);
- zend_list_addref(ret);
-}
-static void destroy_SWFMovie_resource(zend_rsrc_list_entry *resource)
-{
- destroySWFMovie((SWFMovie)resource->ptr);
-}
-
-/* }}} */
-/* {{{ getMovie */
-
-SWFMovie getMovie(zval *id)
-{
- void *movie = SWFgetProperty(id, "movie", 5, le_swfmoviep);
-
- if(!movie)
- php_error(E_ERROR, "called object is not an SWFMovie!");
-
- return (SWFMovie)movie;
-}
-
-/* }}} */
-/* {{{ swfmovie_nextframe */
-
-PHP_FUNCTION(swfmovie_nextFrame)
-{
- SWFMovie_nextFrame(getMovie(getThis()));
-}
-
-/* }}} */
-/* {{{ swfmovie_labelframe */
-
-PHP_FUNCTION(swfmovie_labelFrame)
-{
- zval **label;
-
- if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &label) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_string_ex(label);
-
- SWFMovie_labelFrame(getMovie(getThis()), Z_STRVAL_PP(label));
-}
-
-/* }}} */
-/* {{{ swfmovie_add */
-
-PHP_FUNCTION(swfmovie_add)
-{
- zval **zchar;
- int ret;
- SWFBlock block;
- SWFDisplayItem item;
- SWFMovie movie = getMovie(getThis());
-
- if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &zchar) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_object_ex(zchar);
-
- /* XXX - SWFMovie_add deals w/ all block types. Probably will need to add that.. */
- if((*zchar)->value.obj.ce == &action_class_entry)
- block = (SWFBlock)getAction(*zchar);
- else
- block = (SWFBlock)getCharacter(*zchar);
-
- item = SWFMovie_add(movie, block);
-
- if(item != NULL)
- {
- /* try and create a displayitem object */
- ret = zend_list_insert(item, le_swfdisplayitemp);
- object_init_ex(return_value, &displayitem_class_entry);
- add_property_resource(return_value, "displayitem", ret);
- }
-}
-
-/* }}} */
-/* {{{ swfmovie_remove */
-
-PHP_FUNCTION(swfmovie_remove)
-{
- zval **zchar;
- SWFDisplayItem item;
- SWFMovie movie = getMovie(getThis());
-
- if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &zchar) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_object_ex(zchar);
- item = getDisplayItem(*zchar);
-
- SWFMovie_remove(movie, item);
-}
-
-
-/* }}} */
-/* {{{ swfmovie_output */
-
-void phpByteOutputMethod(byte b, void *data)
-{
- php_write(&b, 1);
-}
-
-PHP_FUNCTION(swfmovie_output)
-{
- SWFMovie movie = getMovie(getThis());
-
- RETURN_LONG(SWFMovie_output(movie, &phpByteOutputMethod, NULL));
-}
-
-
-/* }}} */
-/* {{{ swfmovie_saveToFile */
-
-void phpFileOutputMethod(byte b, void *data)
-{
- fwrite(&b, 1, 1, (FILE *)data);
-}
-
-PHP_FUNCTION(swfmovie_saveToFile)
-{
- zval **x;
- SWFMovie movie = getMovie(getThis());
- int type;
- int le_fopen;
- void *what;
-
- if((ZEND_NUM_ARGS() != 1) || zend_get_parameters_ex(1, &x) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(what, FILE *, x, -1,"File-Handle",php_file_le_fopen());
- RETURN_LONG(SWFMovie_output(movie, &phpFileOutputMethod, what));
-}
-
-
-/* }}} */
-/* {{{ swfmovie_save */
-
-PHP_FUNCTION(swfmovie_save)
-{
- zval **x;
- FILE *file;
- long retval;
-
- if((ZEND_NUM_ARGS() != 1) || zend_get_parameters_ex(1, &x) == FAILURE)
- WRONG_PARAM_COUNT;
-
- if((*x)->type == IS_RESOURCE)
- {
- ZEND_FETCH_RESOURCE(file, FILE *, x, -1,"File-Handle",php_file_le_fopen());
-
- RETURN_LONG(SWFMovie_output(getMovie(getThis()),
- &phpFileOutputMethod, file));
- }
-
- convert_to_string_ex(x);
-
- file = VCWD_FOPEN(Z_STRVAL_PP(x), "wb");
-
- if(file == NULL)
- php_error(E_ERROR, "couldn't open file %s for writing", Z_STRVAL_PP(x));
-
- retval = SWFMovie_output(getMovie(getThis()),
- &phpFileOutputMethod, (void *)file);
-
- fclose(file);
-
- RETURN_LONG(retval);
-}
-
-
-/* }}} */
-/* {{{ swfmovie_setbackground */
-
-PHP_FUNCTION(swfmovie_setBackground)
-{
- zval **r, **g, **b;
- SWFMovie movie = getMovie(getThis());
-
- if((ZEND_NUM_ARGS() != 3) || zend_get_parameters_ex(3, &r, &g, &b) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_long_ex(r);
- convert_to_long_ex(g);
- convert_to_long_ex(b);
-
- SWFMovie_setBackground(movie, Z_LVAL_PP(r), Z_LVAL_PP(g), Z_LVAL_PP(b));
-}
-
-/* }}} */
-/* {{{ swfmovie_setrate */
-
-PHP_FUNCTION(swfmovie_setRate)
-{
- zval **rate;
- SWFMovie movie = getMovie(getThis());
-
- if((ZEND_NUM_ARGS() != 1) || zend_get_parameters_ex(1, &rate) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_double_ex(rate);
-
- SWFMovie_setRate(movie, Z_DVAL_PP(rate));
-}
-
-/* }}} */
-/* {{{ swfmovie_setDimension */
-
-PHP_FUNCTION(swfmovie_setDimension)
-{
- zval **x, **y;
- SWFMovie movie = getMovie(getThis());
-
- if((ZEND_NUM_ARGS() != 2) || zend_get_parameters_ex(2, &x, &y) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_double_ex(x);
- convert_to_double_ex(y);
-
- SWFMovie_setDimension(movie, Z_DVAL_PP(x), Z_DVAL_PP(y));
-}
-
-/* }}} */
-/* {{{ swfmovie_setframes */
-
-PHP_FUNCTION(swfmovie_setFrames)
-{
- zval **frames;
- SWFMovie movie = getMovie(getThis());
-
- if((ZEND_NUM_ARGS() != 1) || zend_get_parameters_ex(1, &frames) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_long_ex(frames);
-
- SWFMovie_setNumberOfFrames(movie, Z_LVAL_PP(frames));
-}
-
-/* }}} */
-/* {{{ swfmovie_streamMp3 */
-
-PHP_FUNCTION(swfmovie_streamMp3)
-{
- FILE *file;
- zval **zfile;
- SWFSound sound;
- SWFMovie movie = getMovie(getThis());
-
- if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &zfile) == FAILURE)
- WRONG_PARAM_COUNT;
-
- if((*zfile)->type == IS_RESOURCE)
- {
- ZEND_FETCH_RESOURCE(file, FILE *, zfile, -1,"File-Handle",php_file_le_fopen());
- }
- else
- {
- convert_to_string_ex(zfile);
-
- file = VCWD_FOPEN(Z_STRVAL_PP(zfile), "rb");
-
- if(!file)
- php_error(E_ERROR, "Couldn't find file %s", Z_STRVAL_PP(zfile));
-
- ZEND_REGISTER_RESOURCE(NULL, file, le_fopen);
- }
-
- sound = newSWFSound(file);
- SWFMovie_setSoundStream(movie, sound);
-}
-
-/* }}} */
-
-/* }}} */
-/* {{{ SWFShape */
-
-static zend_function_entry swfshape_functions[] = {
- PHP_FALIAS(swfshape, swfshape_init, NULL)
- PHP_FALIAS(setline, swfshape_setline, NULL)
- PHP_FALIAS(addfill, swfshape_addfill, NULL)
- PHP_FALIAS(setleftfill, swfshape_setleftfill, NULL)
- PHP_FALIAS(setrightfill, swfshape_setrightfill, NULL)
- PHP_FALIAS(movepento, swfshape_movepento, NULL)
- PHP_FALIAS(movepen, swfshape_movepen, NULL)
- PHP_FALIAS(drawlineto, swfshape_drawlineto, NULL)
- PHP_FALIAS(drawline, swfshape_drawline, NULL)
- PHP_FALIAS(drawcurveto, swfshape_drawcurveto, NULL)
- PHP_FALIAS(drawcurve, swfshape_drawcurve, NULL)
- PHP_FALIAS(drawglyph, swfshape_drawglyph, NULL)
- PHP_FALIAS(drawcircle, swfshape_drawcircle, NULL)
- PHP_FALIAS(drawarc, swfshape_drawarc, NULL)
- PHP_FALIAS(drawcubic, swfshape_drawcubic, NULL)
- PHP_FALIAS(drawcubicto, swfshape_drawcubicto, NULL)
- { NULL, NULL, NULL }
-};
-
-/* {{{ proto class swfshape_init(void)
- Returns a new SWFShape object */
-
-PHP_FUNCTION(swfshape_init)
-{
- SWFShape shape = newSWFShape();
- int ret = zend_list_insert(shape, le_swfshapep);
-
- object_init_ex(getThis(), &shape_class_entry);
- add_property_resource(getThis(), "shape", ret);
- zend_list_addref(ret);
-}
-static void destroy_SWFShape_resource(zend_rsrc_list_entry *resource)
-{
- destroySWFShape((SWFShape)resource->ptr);
-}
-
-/* }}} */
-/* {{{ internal function getShape
- Returns the SWFShape object contained in zval *id */
-
-static SWFShape getShape(zval *id)
-{
- void *shape = SWFgetProperty(id, "shape", 5, le_swfshapep);
-
- if(!shape)
- php_error(E_ERROR, "called object is not an SWFShape!");
-
- return (SWFShape)shape;
-}
-
-/* }}} */
-/* {{{ proto void swfshape_setline(int width, int r, int g, int b [, int a])
- Sets the current line style for this SWFShape */
-
-PHP_FUNCTION(swfshape_setline)
-{
- zval **w, **r, **g, **b, **a;
-
- if(ZEND_NUM_ARGS() == 4)
- {
- if(zend_get_parameters_ex(4, &w, &r, &g, &b) == FAILURE)
- WRONG_PARAM_COUNT;
- }
- else if(ZEND_NUM_ARGS() == 5)
- {
- if(zend_get_parameters_ex(5, &w, &r, &g, &b, &a) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_long_ex(a);
- }
- else if(ZEND_NUM_ARGS() == 1)
- {
- SWFShape_setLine(getShape(getThis()), 0, 0, 0, 0, 0);
- return;
- }
- else
- WRONG_PARAM_COUNT;
-
- convert_to_long_ex(w);
- convert_to_long_ex(r);
- convert_to_long_ex(g);
- convert_to_long_ex(b);
-
- if(ZEND_NUM_ARGS() == 4)
- {
- SWFShape_setLine(getShape(getThis()),
- Z_LVAL_PP(w), Z_LVAL_PP(r), Z_LVAL_PP(g),
- Z_LVAL_PP(b), 0xff);
- }
- else
- {
- SWFShape_setLine(getShape(getThis()),
- Z_LVAL_PP(w), Z_LVAL_PP(r), Z_LVAL_PP(g),
- Z_LVAL_PP(b), Z_LVAL_PP(a));
- }
-}
-
-/* }}} */
-/* {{{ proto int swfshape_addfill(fill, flags)
- Returns a fill object, for use with swfshape_setleftfill and
- swfshape_setrightfill */
-
-PHP_FUNCTION(swfshape_addfill)
-{
- SWFFill fill;
- int ret;
-
- if(ZEND_NUM_ARGS() == 1 || ZEND_NUM_ARGS() == 2)
- {
- /* it's a gradient or bitmap */
-
- zval **arg1;
- unsigned char flags = 0;
-
- if(ZEND_NUM_ARGS() == 2)
- {
- zval **arg2;
-
- if(zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_long_ex(arg2);
- flags = (unsigned char)Z_LVAL_PP(arg2);
- }
- else
- {
- if(zend_get_parameters_ex(1, &arg1) == FAILURE)
- WRONG_PARAM_COUNT;
- }
-
- convert_to_object_ex(arg1);
-
- if((*arg1)->value.obj.ce == &gradient_class_entry)
- {
- if(flags == 0)
- flags = SWFFILL_LINEAR_GRADIENT;
-
- fill = SWFShape_addGradientFill(getShape(getThis()), getGradient(*arg1),
- flags);
- }
- else if((*arg1)->value.obj.ce == &bitmap_class_entry)
- {
- if(flags == 0)
- flags = SWFFILL_TILED_BITMAP;
-
- fill = SWFShape_addBitmapFill(getShape(getThis()), getBitmap(*arg1),
- flags);
- }
- else
- php_error(E_ERROR, "argument to addfill not a bitmap nor a gradient");
- }
-
- else if(ZEND_NUM_ARGS() == 3 || ZEND_NUM_ARGS() == 4)
- {
- /* it's a solid fill */
- zval **r, **g, **b, **za;
- int a = 0xff;
-
- if(ZEND_NUM_ARGS() == 3)
- {
- if(zend_get_parameters_ex(3, &r, &g, &b) == FAILURE)
- WRONG_PARAM_COUNT;
- }
- else if(ZEND_NUM_ARGS() == 4)
- {
- if(zend_get_parameters_ex(4, &r, &g, &b, &za) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_long_ex(za);
- a = Z_LVAL_PP(za);
- }
- else
- WRONG_PARAM_COUNT;
-
- convert_to_long_ex(r);
- convert_to_long_ex(g);
- convert_to_long_ex(b);
-
- fill = SWFShape_addSolidFill(getShape(getThis()),
- Z_LVAL_PP(r), Z_LVAL_PP(g),
- Z_LVAL_PP(b), a);
- }
-
- else
- WRONG_PARAM_COUNT;
-
- if(!fill)
- php_error(E_ERROR, "Error adding fill to shape!");
-
-
- /* return an SWFFill object */
- ret = zend_list_insert(fill, le_swffillp);
- object_init_ex(return_value, &fill_class_entry);
- add_property_resource(return_value, "fill", ret);
-}
-
-/* }}} */
-/* {{{ proto void swfshape_setleftfill(SWFFill fill)
- Sets the left side fill style to fill */
-
-PHP_FUNCTION(swfshape_setleftfill)
-{
- zval **zfill, **r, **g, **b, **a;
- SWFFill fill;
-
- if(ZEND_NUM_ARGS() == 3)
- {
- if(zend_get_parameters_ex(3, &r, &g, &b) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_long_ex(r);
- convert_to_long_ex(g);
- convert_to_long_ex(b);
-
- fill = SWFShape_addSolidFill(getShape(getThis()), Z_LVAL_PP(r),
- Z_LVAL_PP(g), Z_LVAL_PP(b), 0xff);
- }
-
- else if(ZEND_NUM_ARGS() == 4)
- {
- if(zend_get_parameters_ex(4, &r, &g, &b, &a) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_long_ex(r);
- convert_to_long_ex(g);
- convert_to_long_ex(b);
- convert_to_long_ex(a);
-
- fill = SWFShape_addSolidFill(getShape(getThis()), Z_LVAL_PP(r),
- Z_LVAL_PP(g), Z_LVAL_PP(b), Z_LVAL_PP(a));
- }
-
- else if(ZEND_NUM_ARGS() == 1)
- {
- if(zend_get_parameters_ex(1, &zfill) == FAILURE)
- WRONG_PARAM_COUNT;
-
- if(Z_LVAL_PP(zfill) != 0)
- {
- convert_to_object_ex(zfill);
- fill = getFill(*zfill);
- }
- else
- fill = NULL;
- }
-
- SWFShape_setLeftFill(getShape(getThis()), fill);
-}
-
-/* }}} */
-/* {{{ proto void swfshape_setrightfill(SWFFill fill)
- Sets the right side fill style to fill */
-
-PHP_FUNCTION(swfshape_setrightfill)
-{
- zval **zfill, **r, **g, **b, **a;
- SWFFill fill;
-
- if(ZEND_NUM_ARGS() == 3)
- {
- if(zend_get_parameters_ex(3, &r, &g, &b) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_long_ex(r);
- convert_to_long_ex(g);
- convert_to_long_ex(b);
-
- fill = SWFShape_addSolidFill(getShape(getThis()), Z_LVAL_PP(r),
- Z_LVAL_PP(g), Z_LVAL_PP(b), 0xff);
- }
-
- else if(ZEND_NUM_ARGS() == 4)
- {
- if(zend_get_parameters_ex(4, &r, &g, &b, &a) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_long_ex(r);
- convert_to_long_ex(g);
- convert_to_long_ex(b);
- convert_to_long_ex(a);
-
- fill = SWFShape_addSolidFill(getShape(getThis()), Z_LVAL_PP(r),
- Z_LVAL_PP(g), Z_LVAL_PP(b), Z_LVAL_PP(a));
- }
-
- else if(ZEND_NUM_ARGS() == 1)
- {
- if(zend_get_parameters_ex(1, &zfill) == FAILURE)
- WRONG_PARAM_COUNT;
-
- if(Z_LVAL_PP(zfill) != 0)
- {
- convert_to_object_ex(zfill);
- fill = getFill(*zfill);
- }
- else
- fill = NULL;
- }
-
- SWFShape_setRightFill(getShape(getThis()), fill);
-}
-
-/* }}} */
-/* {{{ proto void swfshape_movepento(double x, double y)
- Moves the pen to shape coordinates (x,y) */
-
-PHP_FUNCTION(swfshape_movepento)
-{
- zval **x, **y;
-
- if((ZEND_NUM_ARGS() != 2) || zend_get_parameters_ex(2, &x, &y) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_double_ex(x);
- convert_to_double_ex(y);
-
- SWFShape_movePenTo(getShape(getThis()),
- Z_DVAL_PP(x), Z_DVAL_PP(y));
-}
-
-/* }}} */
-/* {{{ proto void swfshape_movepen(double x, double y)
- Moves the pen from its current location by vector (x,y) */
-
-PHP_FUNCTION(swfshape_movepen)
-{
- zval **x, **y;
-
- if((ZEND_NUM_ARGS() != 2) || zend_get_parameters_ex(2, &x, &y) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_double_ex(x);
- convert_to_double_ex(y);
-
- SWFShape_movePen(getShape(getThis()),
- Z_DVAL_PP(x), Z_DVAL_PP(y));
-}
-
-/* }}} */
-/* {{{ proto void swfshape_drawlineto(double x, double y)
- Draws a line from the current pen position to shape coordinates (x,y)
- in the current line style */
-
-PHP_FUNCTION(swfshape_drawlineto)
-{
- zval **x, **y;
-
- if ((ZEND_NUM_ARGS() != 2) || zend_get_parameters_ex(2, &x, &y) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_double_ex(x);
- convert_to_double_ex(y);
-
- SWFShape_drawLineTo(getShape(getThis()), Z_DVAL_PP(x), Z_DVAL_PP(y));
-}
-
-/* }}} */
-/* {{{ proto void swfshape_drawline(double dx, double dy)
- Draws a line from the current pen position (x,y) to the point (x+dx,y+dy)
- in the current line style */
-
-PHP_FUNCTION(swfshape_drawline)
-{
- zval **x, **y;
-
- if ((ZEND_NUM_ARGS() != 2) || zend_get_parameters_ex(2, &x, &y) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_double_ex(x);
- convert_to_double_ex(y);
-
- SWFShape_drawLine(getShape(getThis()), Z_DVAL_PP(x), Z_DVAL_PP(y));
-}
-
-/* }}} */
-/* {{{ proto void swfshape_drawcurveto(double ax, double ay, double bx, double by [, double dx, double dy])
- Draws a curve from the current pen position (x,y) to the point (bx,by)
- in the current line style, using point (ax,ay) as a control point.
- Or draws a cubic bezier to point (dx,dy) with control points (ax,ay) and (bx,by)
-*/
-
-PHP_FUNCTION(swfshape_drawcurveto)
-{
- if(ZEND_NUM_ARGS() == 4)
- {
- zval **cx, **cy, **ax, **ay;
-
- if(zend_get_parameters_ex(4, &cx, &cy, &ax, &ay) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_double_ex(cx);
- convert_to_double_ex(cy);
- convert_to_double_ex(ax);
- convert_to_double_ex(ay);
-
- SWFShape_drawCurveTo(getShape(getThis()),
- Z_DVAL_PP(cx), Z_DVAL_PP(cy),
- Z_DVAL_PP(ax), Z_DVAL_PP(ay));
- }
- else if(ZEND_NUM_ARGS() == 6)
- {
- zval **bx, **by, **cx, **cy, **dx, **dy;
-
- if(zend_get_parameters_ex(6, &bx, &by, &cx, &cy, &dx, &dy) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_double_ex(bx);
- convert_to_double_ex(by);
- convert_to_double_ex(cx);
- convert_to_double_ex(cy);
- convert_to_double_ex(dx);
- convert_to_double_ex(dy);
-
- RETURN_LONG(SWFShape_drawCubicTo(getShape(getThis()),
- Z_DVAL_PP(bx), Z_DVAL_PP(by),
- Z_DVAL_PP(cx), Z_DVAL_PP(cy),
- Z_DVAL_PP(dx), Z_DVAL_PP(dy)));
- }
- else
- WRONG_PARAM_COUNT;
-}
-
-/* }}} */
-/* {{{ proto void swfshape_drawcurve(double adx, double ady, double bdx, double bdy [, double cdx, double cdy])
- Draws a curve from the current pen position (x,y) to the point (x+bdx,y+bdy)
- in the current line style, using point (x+adx,y+ady) as a control point
- Or draws a cubic bezier to point (x+cdx,x+cdy) with control points
- (x+adx,y+ady) and (x+bdx,y+bdy)
-*/
-
-PHP_FUNCTION(swfshape_drawcurve)
-{
- if(ZEND_NUM_ARGS() == 4)
- {
- zval **cx, **cy, **ax, **ay;
-
- if(zend_get_parameters_ex(4, &cx, &cy, &ax, &ay) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_double_ex(cx);
- convert_to_double_ex(cy);
- convert_to_double_ex(ax);
- convert_to_double_ex(ay);
-
- SWFShape_drawCurve(getShape(getThis()),
- Z_DVAL_PP(cx), Z_DVAL_PP(cy),
- Z_DVAL_PP(ax), Z_DVAL_PP(ay));
- }
- else if(ZEND_NUM_ARGS() == 6)
- {
- zval **bx, **by, **cx, **cy, **dx, **dy;
-
- if(zend_get_parameters_ex(6, &bx, &by, &cx, &cy, &dx, &dy) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_double_ex(bx);
- convert_to_double_ex(by);
- convert_to_double_ex(cx);
- convert_to_double_ex(cy);
- convert_to_double_ex(dx);
- convert_to_double_ex(dy);
-
- RETURN_LONG(SWFShape_drawCubic(getShape(getThis()),
- Z_DVAL_PP(bx), Z_DVAL_PP(by),
- Z_DVAL_PP(cx), Z_DVAL_PP(cy),
- Z_DVAL_PP(dx), Z_DVAL_PP(dy)));
- }
- else
- WRONG_PARAM_COUNT;
-}
-
-/* }}} */
-/* {{{ proto void swfshape_drawglyph(SWFFont font, string character)
- Draws the first character in the given string into the shape using the
- glyph definition from the given font */
-
-PHP_FUNCTION(swfshape_drawglyph)
-{
- zval **font, **c;
-
- if((ZEND_NUM_ARGS() != 2) || zend_get_parameters_ex(2, &font, &c) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_string_ex(c);
-
- SWFShape_drawFontGlyph(getShape(getThis()), getFont(*font),
- Z_STRVAL_PP(c)[0]);
-}
-
-/* }}} */
-/* {{{ proto void swfshape_drawcircle(int r)
- Draws a circle of radius r centered at the current location,
- in a counter-clockwise fashion */
-
-PHP_FUNCTION(swfshape_drawcircle)
-{
- zval **r;
-
- if((ZEND_NUM_ARGS() != 1) || zend_get_parameters_ex(1, &r) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_double_ex(r);
-
- SWFShape_drawCircle(getShape(getThis()), Z_DVAL_PP(r));
-}
-
-/* }}} */
-/* {{{ proto void swfshape_drawarc(int r, float startAngle, float endAngle)
- Draws an arc of radius r centered at the current location, from angle
- startAngle to angle endAngle measured counterclockwise from 12 o'clock */
-
-PHP_FUNCTION(swfshape_drawarc)
-{
- zval **r, **start, **end;
-
- if((ZEND_NUM_ARGS() != 3) ||
- zend_get_parameters_ex(3, &r, &start, &end) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_double_ex(r);
- convert_to_double_ex(start);
- convert_to_double_ex(end);
-
- /* convert angles to radians, since that's what php uses elsewhere */
- SWFShape_drawArc(getShape(getThis()), Z_DVAL_PP(r),
- Z_DVAL_PP(start)*M_PI/180, Z_DVAL_PP(end)*M_PI/180);
-}
-
-/* }}} */
-/* {{{ proto void swfshape_drawcubic(double bx, double by, double cx, double cy, double dx, double dy)
- Draws a cubic bezier curve using the current position and the three given
- points as control points */
-
-PHP_FUNCTION(swfshape_drawcubic)
-{
- zval **bx, **by, **cx, **cy, **dx, **dy;
-
- if((ZEND_NUM_ARGS() != 6) ||
- zend_get_parameters_ex(6, &bx, &by, &cx, &cy, &dx, &dy) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_double_ex(bx);
- convert_to_double_ex(by);
- convert_to_double_ex(cx);
- convert_to_double_ex(cy);
- convert_to_double_ex(dx);
- convert_to_double_ex(dy);
-
- RETURN_LONG(SWFShape_drawCubic(getShape(getThis()),
- Z_DVAL_PP(bx), Z_DVAL_PP(by),
- Z_DVAL_PP(cx), Z_DVAL_PP(cy),
- Z_DVAL_PP(dx), Z_DVAL_PP(dy)));
-}
-
-/* }}} */
-/* {{{ proto void swfshape_drawcubic(double bx, double by, double cx, double cy, double dx, double dy)
- Draws a cubic bezier curve using the current position and the three given
- points as control points */
-
-PHP_FUNCTION(swfshape_drawcubicto)
-{
- zval **bx, **by, **cx, **cy, **dx, **dy;
-
- if((ZEND_NUM_ARGS() != 6) ||
- zend_get_parameters_ex(6, &bx, &by, &cx, &cy, &dx, &dy) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_double_ex(bx);
- convert_to_double_ex(by);
- convert_to_double_ex(cx);
- convert_to_double_ex(cy);
- convert_to_double_ex(dx);
- convert_to_double_ex(dy);
-
- RETURN_LONG(SWFShape_drawCubicTo(getShape(getThis()),
- Z_DVAL_PP(bx), Z_DVAL_PP(by),
- Z_DVAL_PP(cx), Z_DVAL_PP(cy),
- Z_DVAL_PP(dx), Z_DVAL_PP(dy)));
-}
-
-/* }}} */
-
-
-/* }}} */
-/* {{{ SWFSprite */
-
-static zend_function_entry swfsprite_functions[] = {
- PHP_FALIAS(swfsprite, swfsprite_init, NULL)
- PHP_FALIAS(add, swfsprite_add, NULL)
- PHP_FALIAS(remove, swfsprite_remove, NULL)
- PHP_FALIAS(nextframe, swfsprite_nextFrame, NULL)
- PHP_FALIAS(labelframe, swfsprite_labelFrame, NULL)
- PHP_FALIAS(setframes, swfsprite_setFrames, NULL)
- { NULL, NULL, NULL }
-};
-
-/* {{{ proto class swfsprite_init()
- Returns a new SWFSprite object */
-
-PHP_FUNCTION(swfsprite_init)
-{
- SWFMovieClip sprite = newSWFMovieClip();
- int ret = zend_list_insert(sprite, le_swfspritep);
-
- object_init_ex(getThis(), &sprite_class_entry);
- add_property_resource(getThis(), "sprite", ret);
- zend_list_addref(ret);
-}
-static void destroy_SWFSprite_resource(zend_rsrc_list_entry *resource)
-{
- destroySWFMovieClip((SWFMovieClip)resource->ptr);
-}
-
-/* }}} */
-/* {{{ internal function SWFSprite getSprite(zval *id)
- Returns the SWFSprite object in zval *id */
-
-SWFMovieClip getSprite(zval *id)
-{
- void *sprite = SWFgetProperty(id, "sprite", 6, le_swfspritep);
-
- if(!sprite)
- php_error(E_ERROR, "called object is not an SWFSprite!");
-
- return (SWFMovieClip)sprite;
-}
-
-/* }}} */
-/* {{{ proto SWFDisplayItem swfsprite_add(SWFCharacter)
- Adds the character to the sprite, returns a displayitem */
-
-PHP_FUNCTION(swfsprite_add)
-{
- zval **zchar;
- int ret;
- SWFBlock block;
- SWFDisplayItem item;
- SWFMovieClip sprite = getSprite(getThis());
-
- if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &zchar) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_object_ex(zchar);
-
- if((*zchar)->value.obj.ce == &action_class_entry)
- block = (SWFBlock)getAction(*zchar);
- else
- block = (SWFBlock)getCharacter(*zchar);
-
- item = SWFMovieClip_add(sprite, block);
-
- if(item != NULL)
- {
- /* try and create a displayitem object */
- ret = zend_list_insert(item, le_swfdisplayitemp);
- object_init_ex(return_value, &displayitem_class_entry);
- add_property_resource(return_value, "displayitem", ret);
- }
-}
-
-/* }}} */
-/* {{{ proto void swfsprite_remove(SWFDisplayItem)
- Remove the named character from the sprite's display list */
-
-PHP_FUNCTION(swfsprite_remove)
-{
- zval **zchar;
- SWFDisplayItem item;
- SWFMovieClip movie = getSprite(getThis());
-
- if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &zchar) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_object_ex(zchar);
- item = getDisplayItem(*zchar);
-
- SWFMovieClip_remove(movie, item);
-}
-
-/* }}} */
-/* {{{ proto void swfsprite_nextFrame()
- moves the sprite to the next frame */
-
-PHP_FUNCTION(swfsprite_nextFrame)
-{
- SWFMovieClip_nextFrame(getSprite(getThis()));
-}
-
-/* }}} */
-/* {{{ swfmovie_labelframe */
-
-PHP_FUNCTION(swfsprite_labelFrame)
-{
- zval **label;
-
- if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &label) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_string_ex(label);
-
- SWFMovieClip_labelFrame(getSprite(getThis()), Z_STRVAL_PP(label));
-}
-
-/* }}} */
-/* {{{ proto void swfsprite_setFrames(int)
- sets the number of frames in this SWFSprite */
-
-PHP_FUNCTION(swfsprite_setFrames)
-{
- zval **frames;
- SWFMovieClip sprite = getSprite(getThis());
-
- if((ZEND_NUM_ARGS() != 1) || zend_get_parameters_ex(1, &frames) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_long_ex(frames);
-
- SWFMovieClip_setNumberOfFrames(sprite, Z_LVAL_PP(frames));
-}
-
-/* }}} */
-
-/* }}} */
-/* {{{ SWFText */
-
-static zend_function_entry swftext_functions[] = {
- PHP_FALIAS(swftext, swftext_init, NULL)
- PHP_FALIAS(setfont, swftext_setFont, NULL)
- PHP_FALIAS(setheight, swftext_setHeight, NULL)
- PHP_FALIAS(setspacing, swftext_setSpacing, NULL)
- PHP_FALIAS(setcolor, swftext_setColor, NULL)
- PHP_FALIAS(moveto, swftext_moveTo, NULL)
- PHP_FALIAS(addstring, swftext_addString, NULL)
- PHP_FALIAS(getwidth, swftext_getWidth, NULL)
- PHP_FALIAS(getascent, swftext_getAscent, NULL)
- PHP_FALIAS(getdescent, swftext_getDescent, NULL)
- PHP_FALIAS(getleading, swftext_getLeading, NULL)
- { NULL, NULL, NULL }
-};
-
-/* {{{ proto class swftext_init(void)
- Returns new SWFText object */
-
-PHP_FUNCTION(swftext_init)
-{
- SWFText text = newSWFText2();
- int ret = zend_list_insert(text, le_swftextp);
-
- object_init_ex(getThis(), &text_class_entry);
- add_property_resource(getThis(), "text", ret);
- zend_list_addref(ret);
-}
-static void destroy_SWFText_resource(zend_rsrc_list_entry *resource)
-{
- destroySWFText((SWFText)resource->ptr);
-}
-
-/* }}} */
-/* {{{ internal function SWFText getText(zval *id)
- Returns the SWFText contained in zval *id */
-
-SWFText getText(zval *id)
-{
- void *text = SWFgetProperty(id, "text", 4, le_swftextp);
-
- if(!text)
- php_error(E_ERROR, "called object is not an SWFText!");
-
- return (SWFText)text;
-}
-
-/* }}} */
-/* {{{ proto void swftext_setFont(class font)
- Sets this SWFText object's current font to given font */
-
-PHP_FUNCTION(swftext_setFont)
-{
- zval **zfont;
- SWFText text = getText(getThis());
- SWFFont font;
-
- if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &zfont) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_object_ex(zfont);
- font = getFont(*zfont);
-
- SWFText_setFont(text, font);
-}
-
-/* }}} */
-/* {{{ proto void swftext_setHeight(double height)
- Sets this SWFText object's current height to given height */
-
-PHP_FUNCTION(swftext_setHeight)
-{
- zval **height;
- SWFText text = getText(getThis());
-
- if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &height) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_double_ex(height);
-
- SWFText_setHeight(text, Z_DVAL_PP(height));
-}
-
-/* }}} */
-/* {{{ proto void swftext_setSpacing(float spacing)
- Sets this SWFText object's current letterspacing to given spacing */
-
-PHP_FUNCTION(swftext_setSpacing)
-{
- zval **spacing;
- SWFText text = getText(getThis());
-
- if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &spacing) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_double_ex(spacing);
-
- SWFText_setSpacing(text, Z_DVAL_PP(spacing));
-}
-
-/* }}} */
-/* {{{ proto void swftext_setColor(int r, int g, int b, [int a])
- Sets this SWFText object's current color to the given color */
-
-PHP_FUNCTION(swftext_setColor)
-{
- zval **r, **g, **b, **a;
- SWFText text = getText(getThis());
-
- if(ZEND_NUM_ARGS() == 3)
- {
- if(zend_get_parameters_ex(3, &r, &g, &b) == FAILURE)
- WRONG_PARAM_COUNT;
- }
- else if(ZEND_NUM_ARGS() == 4)
- {
- if(zend_get_parameters_ex(4, &r, &g, &b, &a) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_long_ex(a);
- }
- else
- WRONG_PARAM_COUNT;
-
- convert_to_long_ex(r);
- convert_to_long_ex(g);
- convert_to_long_ex(b);
-
- if(ZEND_NUM_ARGS() == 4)
- {
- SWFText_setColor(text, Z_LVAL_PP(r), Z_LVAL_PP(g), Z_LVAL_PP(b), Z_LVAL_PP(a));
- }
- else
- {
- SWFText_setColor(text, Z_LVAL_PP(r), Z_LVAL_PP(g), Z_LVAL_PP(b), 0xff);
- }
-}
-
-/* }}} */
-/* {{{ proto void swftext_moveTo(double x, double y)
- Moves this SWFText object's current pen position to (x,y) in text
- coordinates */
-
-PHP_FUNCTION(swftext_moveTo)
-{
- zval **x, **y;
- SWFText text = getText(getThis());
-
- if(ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &x, &y) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_double_ex(x);
- convert_to_double_ex(y);
-
- SWFText_setXY(text, Z_DVAL_PP(x), Z_DVAL_PP(y));
-}
-
-/* }}} */
-/* {{{ proto void swftext_addString(string text)
- Writes the given text into this SWFText object at the current pen position,
- using the current font, height, spacing, and color */
-
-PHP_FUNCTION(swftext_addString)
-{
- zval **s;
- SWFText text = getText(getThis());
-
- if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &s) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_string_ex(s);
-
- SWFText_addString(text, Z_STRVAL_PP(s), NULL);
-}
-
-/* }}} */
-/* {{{ proto double swftext_getWidth(string)
- calculates the width of the given string in this text objects current font and size */
-
-PHP_FUNCTION(swftext_getWidth)
-{
- zval **zstring;
- int width;
-
- if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &zstring) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_string_ex(zstring);
-
- width = SWFText_getStringWidth(getText(getThis()), Z_STRVAL_PP(zstring));
-
- RETURN_DOUBLE(width);
-}
-
-/* }}} */
-/* {{{ proto double swftext_getAscent()
- returns the ascent of the current font at its current size, or 0 if not available */
-
-PHP_FUNCTION(swftext_getAscent)
-{
- if(ZEND_NUM_ARGS() != 0)
- WRONG_PARAM_COUNT;
-
- RETURN_DOUBLE(SWFText_getAscent(getText(getThis())));
-}
-
-/* }}} */
-/* {{{ proto double swftext_getDescent()
- returns the descent of the current font at its current size, or 0 if not available */
-
-PHP_FUNCTION(swftext_getDescent)
-{
- if(ZEND_NUM_ARGS() != 0)
- WRONG_PARAM_COUNT;
-
- RETURN_DOUBLE(SWFText_getDescent(getText(getThis())));
-}
-
-/* }}} */
-/* {{{ proto double swftext_getLeading()
- returns the leading of the current font at its current size, or 0 if not available */
-
-PHP_FUNCTION(swftext_getLeading)
-{
- if(ZEND_NUM_ARGS() != 0)
- WRONG_PARAM_COUNT;
-
- RETURN_DOUBLE(SWFText_getLeading(getText(getThis())));
-}
-
-/* }}} */
-
-/* }}} */
-/* {{{ SWFTextField */
-
-static zend_function_entry swftextfield_functions[] = {
- PHP_FALIAS(swftextfield, swftextfield_init, NULL)
- PHP_FALIAS(setfont, swftextfield_setFont, NULL)
- PHP_FALIAS(setbounds, swftextfield_setBounds, NULL)
- PHP_FALIAS(align, swftextfield_align, NULL)
- PHP_FALIAS(setheight, swftextfield_setHeight, NULL)
- PHP_FALIAS(setleftmargin, swftextfield_setLeftMargin, NULL)
- PHP_FALIAS(setrightmargin, swftextfield_setRightMargin, NULL)
- PHP_FALIAS(setmargins, swftextfield_setMargins, NULL)
- PHP_FALIAS(setindentation, swftextfield_setIndentation, NULL)
- PHP_FALIAS(setlinespacing, swftextfield_setLineSpacing, NULL)
- PHP_FALIAS(setcolor, swftextfield_setColor, NULL)
- PHP_FALIAS(setname, swftextfield_setName, NULL)
- PHP_FALIAS(addstring, swftextfield_addString, NULL)
- { NULL, NULL, NULL }
-};
-
-/* {{{ proto object swftextfield_init(void)
- returns a new SWFTextField object */
-
-PHP_FUNCTION(swftextfield_init)
-{
- zval **flags;
- SWFTextField field = newSWFTextField();
- int ret = zend_list_insert(field, le_swftextfieldp);
-
- object_init_ex(getThis(), &textfield_class_entry);
- add_property_resource(getThis(), "textfield", ret);
- zend_list_addref(ret);
-
- if(ZEND_NUM_ARGS() == 1)
- {
- if(zend_get_parameters_ex(1, &flags) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_long_ex(flags);
- SWFTextField_setFlags(field, Z_LVAL_PP(flags));
- }
-}
-static void destroy_SWFTextField_resource(zend_rsrc_list_entry *resource)
-{
- destroySWFTextField((SWFTextField)resource->ptr);
-}
-
-/* }}} */
-/* {{{ internal function getTextField
- Returns the SWFTextField object contained in zval *id */
-
-static SWFTextField getTextField(zval *id)
-{
- void *field = SWFgetProperty(id, "textfield", 9, le_swftextfieldp);
-
- if(!field)
- php_error(E_ERROR, "called object is not an SWFTextField!");
-
- return (SWFTextField)field;
-}
-
-/* }}} */
-/* {{{ proto void swftextfield_setFont
- set the font for this textfield */
-
-PHP_FUNCTION(swftextfield_setFont)
-{
- zval **font;
- SWFTextField field = getTextField(getThis());
-
- if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &font) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_object_ex(font);
-
- SWFTextField_setFont(field, getFont(*font));
-}
-
-/* }}} */
-/* {{{ proto void swftextfield_setBounds(double width, double height)
- sets the width and height of this textfield */
-
-PHP_FUNCTION(swftextfield_setBounds)
-{
- zval **width, **height;
- SWFTextField field = getTextField(getThis());
-
- if(ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &width, &height) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_double_ex(width);
- convert_to_double_ex(height);
-
- SWFTextField_setBounds(field, Z_DVAL_PP(width), Z_DVAL_PP(height));
-}
-
-/* }}} */
-/* {{{ proto void swftextfield_align(alignment)
- sets the alignment of this textfield */
-
-PHP_FUNCTION(swftextfield_align)
-{
- zval **align;
- SWFTextField field = getTextField(getThis());
-
- if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &align) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_long_ex(align);
-
- SWFTextField_setAlignment(field, Z_LVAL_PP(align));
-}
-
-/* }}} */
-/* {{{ proto void swftextfield_setHeight(double height)
- sets the font height of this textfield */
-
-PHP_FUNCTION(swftextfield_setHeight)
-{
- zval **height;
- SWFTextField field = getTextField(getThis());
-
- if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &height) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_double_ex(height);
-
- SWFTextField_setHeight(field, Z_DVAL_PP(height));
-}
-
-/* }}} */
-/* {{{ proto void swftextfield_setLeftMargin(double)
- sets the left margin of this textfield */
-
-PHP_FUNCTION(swftextfield_setLeftMargin)
-{
- zval **margin;
- SWFTextField field = getTextField(getThis());
-
- if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &margin) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_double_ex(margin);
-
- SWFTextField_setLeftMargin(field, Z_DVAL_PP(margin));
-}
-
-/* }}} */
-/* {{{ proto void swftextfield_setRightMargin(double)
- sets the right margin of this textfield */
-
-PHP_FUNCTION(swftextfield_setRightMargin)
-{
- zval **margin;
- SWFTextField field = getTextField(getThis());
-
- if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &margin) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_double_ex(margin);
-
- SWFTextField_setRightMargin(field, Z_DVAL_PP(margin));
-}
-
-/* }}} */
-/* {{{ proto void swftextfield_setMargins(double left, double right)
- sets both margins of this textfield */
-
-PHP_FUNCTION(swftextfield_setMargins)
-{
- zval **left, **right;
- SWFTextField field = getTextField(getThis());
-
- if(ZEND_NUM_ARGS() != 2 ||
- zend_get_parameters_ex(2, &left, &right) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_double_ex(left);
- convert_to_double_ex(right);
-
- SWFTextField_setLeftMargin(field, Z_DVAL_PP(left));
- SWFTextField_setRightMargin(field, Z_DVAL_PP(right));
-}
-
-/* }}} */
-/* {{{ proto void swftextfield_setIndentation(double)
- sets the indentation of the first line of this textfield */
-
-PHP_FUNCTION(swftextfield_setIndentation)
-{
- zval **indent;
- SWFTextField field = getTextField(getThis());
-
- if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &indent) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_double_ex(indent);
-
- SWFTextField_setIndentation(field, Z_DVAL_PP(indent));
-}
-
-/* }}} */
-/* {{{ proto void swftextfield_setLineSpacing(double)
- sets the line spacing of this textfield */
-
-PHP_FUNCTION(swftextfield_setLineSpacing)
-{
- zval **spacing;
- SWFTextField field = getTextField(getThis());
-
- if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &spacing) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_double_ex(spacing);
-
- SWFTextField_setLineSpacing(field, Z_DVAL_PP(spacing));
-}
-
-/* }}} */
-/* {{{ proto void swftextfield_setColor(int r, int g, int b [, int a])
- sets the color of this textfield */
-
-PHP_FUNCTION(swftextfield_setColor)
-{
- zval **r, **g, **b, **a;
- SWFTextField field = getTextField(getThis());
- int alpha = 0xff;
-
- if(ZEND_NUM_ARGS() == 3)
- {
- if(zend_get_parameters_ex(3, &r, &g, &b) == FAILURE)
- WRONG_PARAM_COUNT;
- }
- else if(ZEND_NUM_ARGS() == 4)
- {
- if(zend_get_parameters_ex(4, &r, &g, &b, &a) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_long_ex(a);
- alpha = Z_LVAL_PP(a);
- }
- else
- WRONG_PARAM_COUNT;
-
- convert_to_long_ex(r);
- convert_to_long_ex(g);
- convert_to_long_ex(b);
-
- SWFTextField_setColor(field, Z_LVAL_PP(r), Z_LVAL_PP(g), Z_LVAL_PP(b), alpha);
-}
-
-/* }}} */
-/* {{{ proto void swftextfield_setName(string)
- sets the variable name of this textfield */
-
-PHP_FUNCTION(swftextfield_setName)
-{
- zval **name;
- SWFTextField field = getTextField(getThis());
-
- if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &name) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_string_ex(name);
-
- SWFTextField_setVariableName(field, Z_STRVAL_PP(name));
-}
-
-/* }}} */
-/* {{{ proto void swftextfield_addString(string)
- adds the given string to this textfield */
-
-PHP_FUNCTION(swftextfield_addString)
-{
- zval **string;
- SWFTextField field = getTextField(getThis());
-
- if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &string) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_string_ex(string);
-
- SWFTextField_addString(field, Z_STRVAL_PP(string));
-}
-
-/* }}} */
-
-/* }}} */
-
-zend_module_entry ming_module_entry = {
- "ming",
- ming_functions,
- PHP_MINIT(ming),
- NULL,
- NULL,
- NULL,
- PHP_MINFO(ming),
- STANDARD_MODULE_PROPERTIES
-};
-
-#if defined(COMPILE_DL) || defined(COMPILE_DL_MING)
-ZEND_GET_MODULE(ming)
-#endif
-
-/* {{{ proto PHP_MINFO_FUNCTION(ming)
-*/
-
-PHP_MINFO_FUNCTION(ming)
-{
- php_info_print_table_start();
- php_info_print_table_row(2, "Ming SWF output library", "the funk in your trunk");
- php_info_print_table_row(2, "Version", MING_VERSION_TEXT);
- php_info_print_table_end();
-}
-
-/* }}} */
-/* {{{ proto PHP_MINIT_FUNCTION(ming)
-*/
-
-PHP_MINIT_FUNCTION(ming)
-{
- if(Ming_init() != 0)
- php_error(E_ERROR, "Error initializing Ming module");
-
- le_fopen = php_file_le_fopen();
-
-
-#define CONSTANT(s,c) REGISTER_LONG_CONSTANT((s), (c), CONST_CS | CONST_PERSISTENT)
-
- /* flags for SWFButton_addShape */
- CONSTANT("SWFBUTTON_HIT", SWFBUTTONRECORD_HITSTATE);
- CONSTANT("SWFBUTTON_DOWN", SWFBUTTONRECORD_DOWNSTATE);
- CONSTANT("SWFBUTTON_OVER", SWFBUTTONRECORD_OVERSTATE);
- CONSTANT("SWFBUTTON_UP", SWFBUTTONRECORD_UPSTATE);
-
- /* flags for SWFButton_addAction */
- CONSTANT("SWFBUTTON_MOUSEUPOUTSIDE", SWFBUTTON_MOUSEUPOUTSIDE);
- CONSTANT("SWFBUTTON_DRAGOVER", SWFBUTTON_DRAGOVER);
- CONSTANT("SWFBUTTON_DRAGOUT", SWFBUTTON_DRAGOUT);
- CONSTANT("SWFBUTTON_MOUSEUP", SWFBUTTON_MOUSEUP);
- CONSTANT("SWFBUTTON_MOUSEDOWN", SWFBUTTON_MOUSEDOWN);
- CONSTANT("SWFBUTTON_MOUSEOUT", SWFBUTTON_MOUSEOUT);
- CONSTANT("SWFBUTTON_MOUSEOVER", SWFBUTTON_MOUSEOVER);
-
- /* flags for SWFFill */
- CONSTANT("SWFFILL_RADIAL_GRADIENT", SWFFILL_RADIAL_GRADIENT);
- CONSTANT("SWFFILL_LINEAR_GRADIENT", SWFFILL_LINEAR_GRADIENT);
- CONSTANT("SWFFILL_TILED_BITMAP", SWFFILL_TILED_BITMAP);
- CONSTANT("SWFFILL_CLIPPED_BITMAP", SWFFILL_CLIPPED_BITMAP);
-
- /* flags for SWFTextField_init */
- CONSTANT("SWFTEXTFIELD_HASLENGTH", SWFTEXTFIELD_HASLENGTH);
- CONSTANT("SWFTEXTFIELD_NOEDIT", SWFTEXTFIELD_NOEDIT);
- CONSTANT("SWFTEXTFIELD_PASSWORD", SWFTEXTFIELD_PASSWORD);
- CONSTANT("SWFTEXTFIELD_MULTILINE", SWFTEXTFIELD_MULTILINE);
- CONSTANT("SWFTEXTFIELD_WORDWRAP", SWFTEXTFIELD_WORDWRAP);
- CONSTANT("SWFTEXTFIELD_DRAWBOX", SWFTEXTFIELD_DRAWBOX);
- CONSTANT("SWFTEXTFIELD_NOSELECT", SWFTEXTFIELD_NOSELECT);
-#ifdef SWFTEXTFIELD_HTML
- CONSTANT("SWFTEXTFIELD_HTML", SWFTEXTFIELD_HTML);
-#endif
-
- /* flags for SWFTextField_align */
- CONSTANT("SWFTEXTFIELD_ALIGN_LEFT", SWFTEXTFIELD_ALIGN_LEFT);
- CONSTANT("SWFTEXTFIELD_ALIGN_RIGHT", SWFTEXTFIELD_ALIGN_RIGHT);
- CONSTANT("SWFTEXTFIELD_ALIGN_CENTER", SWFTEXTFIELD_ALIGN_CENTER);
- CONSTANT("SWFTEXTFIELD_ALIGN_JUSTIFY", SWFTEXTFIELD_ALIGN_JUSTIFY);
-
- le_swfmoviep = zend_register_list_destructors_ex(destroy_SWFMovie_resource, NULL, "SWFMovie", module_number);
- le_swfshapep = zend_register_list_destructors_ex(destroy_SWFShape_resource, NULL, "SWFShape", module_number);
- le_swffillp = zend_register_list_destructors_ex(destroy_SWFFill_resource, NULL, "SWFFill", module_number);
- le_swfgradientp = zend_register_list_destructors_ex(destroy_SWFGradient_resource, NULL, "SWFGradient", module_number);
- le_swfbitmapp = zend_register_list_destructors_ex(destroy_SWFBitmap_resource, NULL, "SWFBitmap", module_number);
- le_swftextp = zend_register_list_destructors_ex(destroy_SWFText_resource, NULL, "SWFText", module_number);
- le_swftextfieldp = zend_register_list_destructors_ex(destroy_SWFTextField_resource, NULL, "SWFTextField", module_number);
- le_swffontp = zend_register_list_destructors_ex(destroy_SWFFont_resource, NULL, "SWFFont", module_number);
- le_swfbuttonp = zend_register_list_destructors_ex(destroy_SWFButton_resource, NULL, "SWFButton", module_number);
- le_swfmorphp = zend_register_list_destructors_ex(destroy_SWFMorph_resource, NULL, "SWFMorph", module_number);
- le_swfspritep = zend_register_list_destructors_ex(destroy_SWFSprite_resource, NULL, "SWFSprite", module_number);
-
- le_swfdisplayitemp = zend_register_list_destructors_ex(NULL, NULL, "SWFDisplayItem", module_number);
- le_swfactionp = zend_register_list_destructors_ex(NULL, NULL, "SWFAction", module_number);
-
- INIT_CLASS_ENTRY(shape_class_entry, "swfshape", swfshape_functions);
- INIT_CLASS_ENTRY(fill_class_entry, "swffill", swffill_functions);
- INIT_CLASS_ENTRY(gradient_class_entry, "swfgradient", swfgradient_functions);
- INIT_CLASS_ENTRY(bitmap_class_entry, "swfbitmap", swfbitmap_functions);
- INIT_CLASS_ENTRY(text_class_entry, "swftext", swftext_functions);
- INIT_CLASS_ENTRY(textfield_class_entry, "swftextfield",
- swftextfield_functions);
- INIT_CLASS_ENTRY(font_class_entry, "swffont", swffont_functions);
- INIT_CLASS_ENTRY(displayitem_class_entry, "swfdisplayitem",
- swfdisplayitem_functions);
- INIT_CLASS_ENTRY(movie_class_entry, "swfmovie", swfmovie_functions);
- INIT_CLASS_ENTRY(button_class_entry, "swfbutton", swfbutton_functions);
- INIT_CLASS_ENTRY(action_class_entry, "swfaction", swfaction_functions);
- INIT_CLASS_ENTRY(morph_class_entry, "swfmorph", swfmorph_functions);
- INIT_CLASS_ENTRY(sprite_class_entry, "swfsprite", swfsprite_functions);
-
- zend_register_internal_class(&shape_class_entry);
- zend_register_internal_class(&fill_class_entry);
- zend_register_internal_class(&gradient_class_entry);
- zend_register_internal_class(&bitmap_class_entry);
- zend_register_internal_class(&text_class_entry);
- zend_register_internal_class(&textfield_class_entry);
- zend_register_internal_class(&font_class_entry);
- zend_register_internal_class(&displayitem_class_entry);
- zend_register_internal_class(&movie_class_entry);
- zend_register_internal_class(&button_class_entry);
- zend_register_internal_class(&action_class_entry);
- zend_register_internal_class(&morph_class_entry);
- zend_register_internal_class(&sprite_class_entry);
-
- return SUCCESS;
-}
-
-/* }}} */
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/ming/ming.dsp b/ext/ming/ming.dsp
deleted file mode 100644
index 1202d9fcf2..0000000000
--- a/ext/ming/ming.dsp
+++ /dev/null
@@ -1,107 +0,0 @@
-# Microsoft Developer Studio Project File - Name="ming" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=ming - Win32 Debug_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "ming.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "ming.mak" CFG="ming - Win32 Debug_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "ming - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "ming - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "ming - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MING_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\main" /I "..\..\win32" /D "WIN32" /D "PHP_EXPORTS" /D "COMPILE_DL_MING" /D "HAVE_MING" /D ZEND_DEBUG=0 /D "NDEBUG" /D "_WINDOWS" /D "ZEND_WIN32" /D "PHP_WIN32" /D ZTS=1 /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x407 /d "NDEBUG"
-# ADD RSC /l 0x407 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 php4ts.lib libming.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_ming.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
-
-!ELSEIF "$(CFG)" == "ming - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MING_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\main" /I "..\..\win32" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "PHP_EXPORTS" /D "COMPILE_DL_MING" /D "ZEND_WIN32" /D "PHP_WIN32" /D "HAVE_MING" /D ZTS=1 /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x407 /d "_DEBUG"
-# ADD RSC /l 0x407 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 php4ts_debug.lib libming.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"..\..\Debug_TS/php_ming.dll" /pdbtype:sept /libpath:"..\..\Debug_TS"
-
-!ENDIF
-
-# Begin Target
-
-# Name "ming - Win32 Release_TS"
-# Name "ming - Win32 Debug_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\ming.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_ming.h
-# End Source File
-# End Group
-# End Target
-# End Project
diff --git a/ext/ming/php_ming.h b/ext/ming/php_ming.h
deleted file mode 100644
index 6fa8caaf6d..0000000000
--- a/ext/ming/php_ming.h
+++ /dev/null
@@ -1,164 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.01 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_01.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: dave@opaque.net |
- +----------------------------------------------------------------------+
-*/
-
-#include "php.h"
-
-#ifndef _PHP_MING_H
-#define _PHP_MING_H
-
-#ifdef COMPILE_DL_MING
-#undef HAVE_MING
-#define HAVE_MING 1
-#endif
-
-#if HAVE_MING
-
-#include "ming.h"
-
-extern zend_module_entry ming_module_entry;
-#define ming_module_ptr &ming_module_entry
-
-PHP_MINIT_FUNCTION(ming);
-PHP_MINFO_FUNCTION(ming);
-
-PHP_FUNCTION(swfbitmap_init);
-PHP_FUNCTION(swfbitmap_getWidth);
-PHP_FUNCTION(swfbitmap_getHeight);
-
-PHP_FUNCTION(swffill_init);
-PHP_FUNCTION(swffill_moveTo);
-PHP_FUNCTION(swffill_scaleTo);
-PHP_FUNCTION(swffill_rotateTo);
-PHP_FUNCTION(swffill_skewXTo);
-PHP_FUNCTION(swffill_skewYTo);
-
-PHP_FUNCTION(swfgradient_init);
-PHP_FUNCTION(swfgradient_addEntry);
-
-PHP_FUNCTION(swfshape_init);
-PHP_FUNCTION(swfshape_addfill);
-PHP_FUNCTION(swfshape_setrightfill);
-PHP_FUNCTION(swfshape_setleftfill);
-PHP_FUNCTION(swfshape_setline);
-PHP_FUNCTION(swfshape_movepento);
-PHP_FUNCTION(swfshape_movepen);
-PHP_FUNCTION(swfshape_drawlineto);
-PHP_FUNCTION(swfshape_drawline);
-PHP_FUNCTION(swfshape_drawcurveto);
-PHP_FUNCTION(swfshape_drawcurve);
-PHP_FUNCTION(swfshape_drawglyph);
-PHP_FUNCTION(swfshape_drawarc);
-PHP_FUNCTION(swfshape_drawcircle);
-PHP_FUNCTION(swfshape_drawcubic);
-PHP_FUNCTION(swfshape_drawcubicto);
-
-PHP_FUNCTION(swfmovie_init);
-PHP_FUNCTION(swfmovie_output);
-PHP_FUNCTION(swfmovie_saveToFile);
-PHP_FUNCTION(swfmovie_save);
-PHP_FUNCTION(swfmovie_add);
-PHP_FUNCTION(swfmovie_remove);
-PHP_FUNCTION(swfmovie_nextFrame);
-PHP_FUNCTION(swfmovie_labelFrame);
-PHP_FUNCTION(swfmovie_setBackground);
-PHP_FUNCTION(swfmovie_setRate);
-PHP_FUNCTION(swfmovie_setDimension);
-PHP_FUNCTION(swfmovie_setFrames);
-PHP_FUNCTION(swfmovie_streamMp3);
-
-PHP_FUNCTION(swfsprite_init);
-PHP_FUNCTION(swfsprite_add);
-PHP_FUNCTION(swfsprite_remove);
-PHP_FUNCTION(swfsprite_nextFrame);
-PHP_FUNCTION(swfsprite_labelFrame);
-PHP_FUNCTION(swfsprite_setFrames);
-
-PHP_FUNCTION(swffont_init);
-PHP_FUNCTION(swffont_getWidth);
-PHP_FUNCTION(swffont_getAscent);
-PHP_FUNCTION(swffont_getDescent);
-PHP_FUNCTION(swffont_getLeading);
-
-PHP_FUNCTION(swftext_init);
-PHP_FUNCTION(swftext_setFont);
-PHP_FUNCTION(swftext_setHeight);
-PHP_FUNCTION(swftext_setSpacing);
-PHP_FUNCTION(swftext_setColor);
-PHP_FUNCTION(swftext_moveTo);
-PHP_FUNCTION(swftext_addString);
-PHP_FUNCTION(swftext_getWidth);
-PHP_FUNCTION(swftext_getAscent);
-PHP_FUNCTION(swftext_getDescent);
-PHP_FUNCTION(swftext_getLeading);
-
-PHP_FUNCTION(swftextfield_init);
-PHP_FUNCTION(swftextfield_setFont);
-PHP_FUNCTION(swftextfield_setBounds);
-PHP_FUNCTION(swftextfield_align);
-PHP_FUNCTION(swftextfield_setHeight);
-PHP_FUNCTION(swftextfield_setLeftMargin);
-PHP_FUNCTION(swftextfield_setRightMargin);
-PHP_FUNCTION(swftextfield_setMargins);
-PHP_FUNCTION(swftextfield_setIndentation);
-PHP_FUNCTION(swftextfield_setLineSpacing);
-PHP_FUNCTION(swftextfield_setColor);
-PHP_FUNCTION(swftextfield_setName);
-PHP_FUNCTION(swftextfield_addString);
-
-PHP_FUNCTION(swfdisplayitem_move);
-PHP_FUNCTION(swfdisplayitem_moveTo);
-PHP_FUNCTION(swfdisplayitem_scale);
-PHP_FUNCTION(swfdisplayitem_scaleTo);
-PHP_FUNCTION(swfdisplayitem_rotate);
-PHP_FUNCTION(swfdisplayitem_rotateTo);
-PHP_FUNCTION(swfdisplayitem_skewX);
-PHP_FUNCTION(swfdisplayitem_skewXTo);
-PHP_FUNCTION(swfdisplayitem_skewY);
-PHP_FUNCTION(swfdisplayitem_skewYTo);
-PHP_FUNCTION(swfdisplayitem_setMatrix);
-PHP_FUNCTION(swfdisplayitem_setDepth);
-PHP_FUNCTION(swfdisplayitem_setRatio);
-PHP_FUNCTION(swfdisplayitem_addColor);
-PHP_FUNCTION(swfdisplayitem_multColor);
-PHP_FUNCTION(swfdisplayitem_setName);
-
-PHP_FUNCTION(swfbutton_init);
-PHP_FUNCTION(swfbutton_setHit);
-PHP_FUNCTION(swfbutton_setOver);
-PHP_FUNCTION(swfbutton_setUp);
-PHP_FUNCTION(swfbutton_setDown);
-PHP_FUNCTION(swfbutton_setAction);
-PHP_FUNCTION(swfbutton_addShape);
-PHP_FUNCTION(swfbutton_addAction);
-
-PHP_FUNCTION(swfbutton_keypress);
-
-PHP_FUNCTION(swfaction_init);
-
-PHP_FUNCTION(swfmorph_init);
-PHP_FUNCTION(swfmorph_getShape1);
-PHP_FUNCTION(swfmorph_getShape2);
-
-PHP_FUNCTION(ming_setCubicThreshold);
-PHP_FUNCTION(ming_setScale);
-
-#else
-#define ming_module_ptr NULL
-#endif /* HAVE_MING */
-#define phpext_ming_ptr ming_module_ptr
-#endif /* _PHP_MING_H */
diff --git a/ext/mnogosearch/CREDITS b/ext/mnogosearch/CREDITS
deleted file mode 100644
index 93dada0a4f..0000000000
--- a/ext/mnogosearch/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-mnoGoSearch
-Alex Barkov, Ramil Kalimullin, Sergey Kartashoff
diff --git a/ext/mnogosearch/Makefile.in b/ext/mnogosearch/Makefile.in
deleted file mode 100644
index bccc75f79a..0000000000
--- a/ext/mnogosearch/Makefile.in
+++ /dev/null
@@ -1,9 +0,0 @@
-# $Source$
-# $Id$
-
-LTLIBRARY_NAME = libmnogosearch.la
-LTLIBRARY_SOURCES = php_mnogo.c
-LTLIBRARY_SHARED_NAME = mnogosearch.la
-LTLIBRARY_SHARED_LIBADD = $(MNOGOSEARCH_SHARED_LIBADD)
-
-include $(top_srcdir)/build/dynlib.mk
diff --git a/ext/mnogosearch/README b/ext/mnogosearch/README
deleted file mode 100644
index e646a725af..0000000000
--- a/ext/mnogosearch/README
+++ /dev/null
@@ -1,17 +0,0 @@
-$Source$
-$Id$
-
-mnoGoSearch extension module for PHP4.
-
-For details please refer to http://search.mnogo.ru
-
-If used with mysql you should not use bundled mysql library
-in the php distribution. You should use native mysql
-library. To do this you should compile php with specefying mysql-dir
-(for example --with-mysql=/usr, not --with-mysql).
-
- TODO
- ----
-
-Implement indexing functions of the library.
-For example retrieving, parsing, checking of the URL and so on...
diff --git a/ext/mnogosearch/config.m4 b/ext/mnogosearch/config.m4
deleted file mode 100644
index 07df218739..0000000000
--- a/ext/mnogosearch/config.m4
+++ /dev/null
@@ -1,52 +0,0 @@
-dnl $Source$
-dnl $Id$
-
-PHP_ARG_WITH(mnogosearch,for mnoGoSearch support,
-[ --with-mnogosearch[=DIR]
- Include mnoGoSearch support. DIR is the mnoGoSearch
- base install directory, defaults to
- /usr/local/mnogosearch.])
-
- if test "$PHP_MNOGOSEARCH" != "no"; then
-
- if test "$PHP_MNOGOSEARCH" = "yes"; then
- MNOGOSEARCH_BINDIR=/usr/local/mnogosearch/bin
- MNOGOSEARCH_INCDIR=/usr/local/mnogosearch/include
- MNOGOSEARCH_LIBDIR=/usr/local/mnogosearch/lib
- else
- MNOGOSEARCH_BINDIR=$PHP_MNOGOSEARCH/bin
- MNOGOSEARCH_INCDIR=$PHP_MNOGOSEARCH/include
- MNOGOSEARCH_LIBDIR=$PHP_MNOGOSEARCH/lib
- fi
-
- AC_MSG_CHECKING(for mnoGoSearch version)
-
- if test -x "$MNOGOSEARCH_BINDIR/udm-config"; then
- MNOGOSEARCH_VERSION=`$MNOGOSEARCH_BINDIR/udm-config --version`
- MNOGOSEARCH_VERSION_ID=`$MNOGOSEARCH_BINDIR/udm-config --version-id`
-
- if test $? -ne 0; then
- AC_MSG_RESULT(<= 3.1.9)
- AC_MSG_ERROR(mnoGoSearch 3.1.10 at least required)
- fi
-
- if test "$MNOGOSEARCH_VERSION_ID" -lt 30110; then
- AC_MSG_RESULT(<= 3.1.9)
- AC_MSG_ERROR(mnoGoSearch 3.1.10 at least required)
- fi
-
- AC_MSG_RESULT($MNOGOSEARCH_VERSION)
-
- PHP_EVAL_LIBLINE(`$MNOGOSEARCH_BINDIR/udm-config --libs`, MNOGOSEARCH_SHARED_LIBADD)
- else
- AC_MSG_ERROR(udm-config script not found in $MNOGOSEARCH_BINDIR)
- fi
-
- PHP_ADD_INCLUDE($MNOGOSEARCH_INCDIR)
-
- AC_DEFINE(HAVE_MNOGOSEARCH,1,[ ])
-
- PHP_SUBST(MNOGOSEARCH_SHARED_LIBADD)
- PHP_EXTENSION(mnogosearch,$ext_shared)
-
- fi
diff --git a/ext/mnogosearch/php_mnogo.c b/ext/mnogosearch/php_mnogo.c
deleted file mode 100644
index 85c017ff7b..0000000000
--- a/ext/mnogosearch/php_mnogo.c
+++ /dev/null
@@ -1,1249 +0,0 @@
-/* $Source$ */
-/* $Id$ */
-
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997, 1998, 1999, 2000, 2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: |
- | Initial version by Alex Barkov <bar@izhcom.ru> |
- | and Ramil Kalimullin <ram@izhcom.ru> |
- | Further development by Sergey Kartashoff <gluke@biosys.net> |
- +----------------------------------------------------------------------+
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "php_mnogo.h"
-#include "ext/standard/php_standard.h"
-#include "ext/standard/info.h"
-#include "php_globals.h"
-
-#ifdef HAVE_MNOGOSEARCH
-
-#define UDM_FIELD_URLID 1
-#define UDM_FIELD_URL 2
-#define UDM_FIELD_CONTENT 3
-#define UDM_FIELD_TITLE 4
-#define UDM_FIELD_KEYWORDS 5
-#define UDM_FIELD_DESC 6
-#define UDM_FIELD_TEXT 7
-#define UDM_FIELD_SIZE 8
-#define UDM_FIELD_RATING 9
-#define UDM_FIELD_MODIFIED 10
-#define UDM_FIELD_ORDER 11
-#define UDM_FIELD_CRC 12
-#define UDM_FIELD_CATEGORY 13
-
-/* udm_set_agent_param constants */
-#define UDM_PARAM_PAGE_SIZE 1
-#define UDM_PARAM_PAGE_NUM 2
-#define UDM_PARAM_SEARCH_MODE 3
-#define UDM_PARAM_CACHE_MODE 4
-#define UDM_PARAM_TRACK_MODE 5
-#define UDM_PARAM_CHARSET 6
-#define UDM_PARAM_STOPTABLE 7
-#define UDM_PARAM_STOPFILE 8
-#define UDM_PARAM_WEIGHT_FACTOR 9
-#define UDM_PARAM_WORD_MATCH 10
-#define UDM_PARAM_PHRASE_MODE 11
-#define UDM_PARAM_MIN_WORD_LEN 12
-#define UDM_PARAM_MAX_WORD_LEN 13
-#define UDM_PARAM_ISPELL_PREFIXES 14
-#define UDM_PARAM_CROSS_WORDS 15
-
-/* udm_add_search_limit constants */
-#define UDM_LIMIT_URL 1
-#define UDM_LIMIT_TAG 2
-#define UDM_LIMIT_LANG 3
-#define UDM_LIMIT_CAT 4
-#define UDM_LIMIT_DATE 5
-
-/* track modes */
-#define UDM_TRACK_ENABLED 1
-#define UDM_TRACK_DISABLED 0
-
-/* phrase modes */
-#define UDM_PHRASE_ENABLED 1
-#define UDM_PHRASE_DISABLED 0
-
-/* prefix modes */
-#define UDM_PREFIXES_ENABLED 1
-#define UDM_PREFIXES_DISABLED 0
-
-/* crosswords modes */
-#define UDM_CROSS_WORDS_ENABLED 1
-#define UDM_CROSS_WORDS_DISABLED 0
-
-/* udm_get_res_param constants */
-#define UDM_PARAM_NUM_ROWS 256
-#define UDM_PARAM_FOUND 257
-#define UDM_PARAM_WORDINFO 258
-#define UDM_PARAM_SEARCHTIME 259
-#define UDM_PARAM_FIRST_DOC 260
-#define UDM_PARAM_LAST_DOC 261
-
-/* udm_load_ispell_data constants */
-#define UDM_ISPELL_TYPE_AFFIX 1
-#define UDM_ISPELL_TYPE_SPELL 2
-#define UDM_ISPELL_TYPE_DB 3
-#define UDM_ISPELL_TYPE_SERVER 4
-
-/* True globals, no need for thread safety */
-static int le_link,le_res;
-
-#include <udm_config.h>
-#include <udmsearch.h>
-
-/* {{{ mnogosearch_functions[]
- */
-function_entry mnogosearch_functions[] = {
- PHP_FE(udm_api_version, NULL)
-
- PHP_FE(udm_alloc_agent, NULL)
- PHP_FE(udm_set_agent_param, NULL)
-
- PHP_FE(udm_load_ispell_data, NULL)
- PHP_FE(udm_free_ispell_data, NULL)
-
- PHP_FE(udm_add_search_limit, NULL)
- PHP_FE(udm_clear_search_limits, NULL)
-
- PHP_FE(udm_errno, NULL)
- PHP_FE(udm_error, NULL)
-
- PHP_FE(udm_find, NULL)
- PHP_FE(udm_get_res_param, NULL)
- PHP_FE(udm_get_res_field, NULL)
-
- PHP_FE(udm_cat_list, NULL)
- PHP_FE(udm_cat_path, NULL)
-
- PHP_FE(udm_free_res, NULL)
- PHP_FE(udm_free_agent, NULL)
-
-#if UDM_VERSION_ID > 30110
- PHP_FE(udm_get_doc_count, NULL)
-#endif
-
- {NULL, NULL, NULL}
-};
-/* }}} */
-
-zend_module_entry mnogosearch_module_entry = {
- "mnogosearch",
- mnogosearch_functions,
- PHP_MINIT(mnogosearch),
- PHP_MSHUTDOWN(mnogosearch),
- PHP_RINIT(mnogosearch),
- NULL,
- PHP_MINFO(mnogosearch),
- STANDARD_MODULE_PROPERTIES
-};
-
-
-#ifdef COMPILE_DL_MNOGOSEARCH
-ZEND_GET_MODULE(mnogosearch)
-#endif
-
-static void _free_udm_agent(zend_rsrc_list_entry *rsrc){
- UDM_AGENT * Agent = (UDM_AGENT *)rsrc->ptr;
- UdmFreeEnv(Agent->Conf);
- UdmFreeAgent(Agent);
-}
-
-static void _free_udm_res(zend_rsrc_list_entry *rsrc){
- UDM_RESULT * Res = (UDM_RESULT *)rsrc->ptr;
- UdmFreeResult(Res);
-}
-
-/* {{{ PHP_MINIT_FUNCTION
- */
-DLEXPORT PHP_MINIT_FUNCTION(mnogosearch)
-{
- UdmInit();
- le_link = zend_register_list_destructors_ex(_free_udm_agent,NULL,"mnogosearch agent",module_number);
- le_res = zend_register_list_destructors_ex(_free_udm_res,NULL,"mnogosearch result",module_number);
-
- REGISTER_LONG_CONSTANT("UDM_FIELD_URLID", UDM_FIELD_URLID,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_FIELD_URL", UDM_FIELD_URL,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_FIELD_CONTENT", UDM_FIELD_CONTENT,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_FIELD_TITLE", UDM_FIELD_TITLE,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_FIELD_KEYWORDS", UDM_FIELD_KEYWORDS,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_FIELD_DESC", UDM_FIELD_DESC,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_FIELD_DESCRIPTION", UDM_FIELD_DESC,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_FIELD_TEXT", UDM_FIELD_TEXT,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_FIELD_SIZE", UDM_FIELD_SIZE,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_FIELD_RATING", UDM_FIELD_RATING,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_FIELD_SCORE", UDM_FIELD_RATING,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_FIELD_MODIFIED", UDM_FIELD_MODIFIED,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_FIELD_ORDER", UDM_FIELD_ORDER,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_FIELD_CRC", UDM_FIELD_CRC,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_FIELD_CATEGORY", UDM_FIELD_CATEGORY,CONST_CS | CONST_PERSISTENT);
-
- /* udm_set_agent_param constants */
- REGISTER_LONG_CONSTANT("UDM_PARAM_PAGE_SIZE", UDM_PARAM_PAGE_SIZE,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_PARAM_PAGE_NUM", UDM_PARAM_PAGE_NUM,CONST_CS | CONST_PERSISTENT);
-
- REGISTER_LONG_CONSTANT("UDM_PARAM_SEARCH_MODE", UDM_PARAM_SEARCH_MODE,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_PARAM_CACHE_MODE", UDM_PARAM_CACHE_MODE,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_PARAM_TRACK_MODE", UDM_PARAM_TRACK_MODE,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_PARAM_PHRASE_MODE", UDM_PARAM_PHRASE_MODE,CONST_CS | CONST_PERSISTENT);
-
- REGISTER_LONG_CONSTANT("UDM_PARAM_CHARSET", UDM_PARAM_CHARSET,CONST_CS | CONST_PERSISTENT);
-
- REGISTER_LONG_CONSTANT("UDM_PARAM_STOPTABLE", UDM_PARAM_STOPTABLE,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_PARAM_STOP_TABLE", UDM_PARAM_STOPTABLE,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_PARAM_STOPFILE", UDM_PARAM_STOPFILE,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_PARAM_STOP_FILE", UDM_PARAM_STOPFILE,CONST_CS | CONST_PERSISTENT);
-
- REGISTER_LONG_CONSTANT("UDM_PARAM_WEIGHT_FACTOR",UDM_PARAM_WEIGHT_FACTOR,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_PARAM_WORD_MATCH", UDM_PARAM_WORD_MATCH,CONST_CS | CONST_PERSISTENT);
-
- REGISTER_LONG_CONSTANT("UDM_PARAM_MAX_WORD_LEN",UDM_PARAM_MAX_WORD_LEN,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_PARAM_MAX_WORDLEN", UDM_PARAM_MAX_WORD_LEN,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_PARAM_MIN_WORD_LEN",UDM_PARAM_MIN_WORD_LEN,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_PARAM_MIN_WORDLEN", UDM_PARAM_MIN_WORD_LEN,CONST_CS | CONST_PERSISTENT);
-
- REGISTER_LONG_CONSTANT("UDM_PARAM_ISPELL_PREFIXES",UDM_PARAM_ISPELL_PREFIXES,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_PARAM_ISPELL_PREFIX",UDM_PARAM_ISPELL_PREFIXES,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_PARAM_PREFIXES", UDM_PARAM_ISPELL_PREFIXES,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_PARAM_PREFIX", UDM_PARAM_ISPELL_PREFIXES,CONST_CS | CONST_PERSISTENT);
-
- REGISTER_LONG_CONSTANT("UDM_PARAM_CROSS_WORDS", UDM_PARAM_CROSS_WORDS,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_PARAM_CROSSWORDS", UDM_PARAM_CROSS_WORDS,CONST_CS | CONST_PERSISTENT);
-
- /* udm_add_search_limit constants */
- REGISTER_LONG_CONSTANT("UDM_LIMIT_CAT", UDM_LIMIT_CAT,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_LIMIT_URL", UDM_LIMIT_URL,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_LIMIT_TAG", UDM_LIMIT_TAG,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_LIMIT_LANG", UDM_LIMIT_LANG,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_LIMIT_DATE", UDM_LIMIT_DATE,CONST_CS | CONST_PERSISTENT);
-
- /* udm_get_res_param constants */
- REGISTER_LONG_CONSTANT("UDM_PARAM_FOUND", UDM_PARAM_FOUND,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_PARAM_NUM_ROWS", UDM_PARAM_NUM_ROWS,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_PARAM_WORDINFO", UDM_PARAM_WORDINFO,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_PARAM_WORD_INFO", UDM_PARAM_WORDINFO,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_PARAM_SEARCHTIME", UDM_PARAM_SEARCHTIME,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_PARAM_SEARCH_TIME", UDM_PARAM_SEARCHTIME,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_PARAM_FIRST_DOC", UDM_PARAM_FIRST_DOC,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_PARAM_LAST_DOC", UDM_PARAM_LAST_DOC,CONST_CS | CONST_PERSISTENT);
-
- /* search modes */
- REGISTER_LONG_CONSTANT("UDM_MODE_ALL", UDM_MODE_ALL,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_MODE_ANY", UDM_MODE_ANY,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_MODE_BOOL", UDM_MODE_BOOL,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_MODE_PHRASE", UDM_MODE_PHRASE,CONST_CS | CONST_PERSISTENT);
-
- /* search cache params */
- REGISTER_LONG_CONSTANT("UDM_CACHE_ENABLED", UDM_CACHE_ENABLED,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_CACHE_DISABLED", UDM_CACHE_DISABLED,CONST_CS | CONST_PERSISTENT);
-
- /* track mode params */
- REGISTER_LONG_CONSTANT("UDM_TRACK_ENABLED", UDM_TRACK_ENABLED,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_TRACK_DISABLED", UDM_TRACK_DISABLED,CONST_CS | CONST_PERSISTENT);
-
- /* phrase mode params */
- REGISTER_LONG_CONSTANT("UDM_PHRASE_ENABLED", UDM_PHRASE_ENABLED,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_PHRASE_DISABLED", UDM_PHRASE_DISABLED,CONST_CS | CONST_PERSISTENT);
-
- /* crosswords mode params */
- REGISTER_LONG_CONSTANT("UDM_CROSS_WORDS_ENABLED",UDM_CROSS_WORDS_ENABLED,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_CROSSWORDS_ENABLED",UDM_CROSS_WORDS_ENABLED,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_CROSS_WORDS_DISABLED",UDM_CROSS_WORDS_DISABLED,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_CROSSWORDS_DISABLED",UDM_CROSS_WORDS_DISABLED,CONST_CS | CONST_PERSISTENT);
-
- /* prefixes mode params */
- REGISTER_LONG_CONSTANT("UDM_PREFIXES_ENABLED", UDM_PREFIXES_ENABLED,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_PREFIX_ENABLED", UDM_PREFIXES_ENABLED,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_ISPELL_PREFIXES_ENABLED",UDM_PREFIXES_ENABLED,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_ISPELL_PREFIX_ENABLED",UDM_PREFIXES_ENABLED,CONST_CS | CONST_PERSISTENT);
-
- REGISTER_LONG_CONSTANT("UDM_PREFIXES_DISABLED", UDM_PREFIXES_DISABLED,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_PREFIX_DISABLED", UDM_PREFIXES_DISABLED,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_ISPELL_PREFIXES_DISABLED",UDM_PREFIXES_DISABLED,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_ISPELL_PREFIX_DISABLED",UDM_PREFIXES_DISABLED,CONST_CS | CONST_PERSISTENT);
-
- /* ispell type params */
- REGISTER_LONG_CONSTANT("UDM_ISPELL_TYPE_AFFIX", UDM_ISPELL_TYPE_AFFIX,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_ISPELL_TYPE_SPELL", UDM_ISPELL_TYPE_SPELL,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_ISPELL_TYPE_DB", UDM_ISPELL_TYPE_DB,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_ISPELL_TYPE_SERVER",UDM_ISPELL_TYPE_SERVER,CONST_CS | CONST_PERSISTENT);
-
- /* word match mode params */
- REGISTER_LONG_CONSTANT("UDM_MATCH_WORD", UDM_MATCH_WORD,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_MATCH_BEGIN", UDM_MATCH_BEGIN,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_MATCH_SUBSTR", UDM_MATCH_SUBSTR,CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("UDM_MATCH_END", UDM_MATCH_END,CONST_CS | CONST_PERSISTENT);
-
- return SUCCESS;
-}
-/* }}} */
-
-DLEXPORT PHP_MSHUTDOWN_FUNCTION(mnogosearch)
-{
- return SUCCESS;
-}
-
-
-DLEXPORT PHP_RINIT_FUNCTION(mnogosearch)
-{
- return SUCCESS;
-}
-
-
-DLEXPORT PHP_MINFO_FUNCTION(mnogosearch)
-{
- char buf[32];
-
- php_info_print_table_start();
- php_info_print_table_row(2, "mnoGoSearch Support", "enabled" );
-
- sprintf(buf,"%d", UDM_VERSION_ID);
- php_info_print_table_row(2, "mnoGoSearch library version", buf );
- php_info_print_table_end();
-}
-
-
-/* {{{ proto int udm_alloc_agent(string dbaddr [, string dbmode])
- Allocate mnoGoSearch session */
-DLEXPORT PHP_FUNCTION(udm_alloc_agent)
-{
- switch(ZEND_NUM_ARGS()){
-
- case 1: {
- pval **yydbaddr;
- char *dbaddr;
- UDM_ENV * Env;
- UDM_AGENT * Agent;
-
- if(zend_get_parameters_ex(1,&yydbaddr)==FAILURE){
- RETURN_FALSE;
- }
- convert_to_string_ex(yydbaddr);
- dbaddr = (*yydbaddr)->value.str.val;
-
- Env=UdmAllocEnv();
- UdmEnvSetDBAddr(Env,dbaddr);
- Agent=UdmAllocAgent(Env,0,UDM_OPEN_MODE_READ);
-
- ZEND_REGISTER_RESOURCE(return_value,Agent,le_link);
- }
- break;
-
- case 2: {
- pval **yydbaddr;
- pval **yydbmode;
- char *dbaddr;
- char *dbmode;
- UDM_ENV * Env;
- UDM_AGENT * Agent;
-
- if(zend_get_parameters_ex(2,&yydbaddr,&yydbmode)==FAILURE){
- RETURN_FALSE;
- }
- convert_to_string_ex(yydbaddr);
- convert_to_string_ex(yydbmode);
- dbaddr = (*yydbaddr)->value.str.val;
- dbmode = (*yydbmode)->value.str.val;
-
- Env=UdmAllocEnv();
- UdmEnvSetDBAddr(Env,dbaddr);
- UdmEnvSetDBMode(Env,dbmode);
- Agent=UdmAllocAgent(Env,0,UDM_OPEN_MODE_READ);
-
- ZEND_REGISTER_RESOURCE(return_value,Agent,le_link);
- }
- break;
-
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-}
-/* }}} */
-
-/* {{{ proto int udm_set_agent_param(int agent, int var, string val)
- Set mnoGoSearch agent session parameters */
-DLEXPORT PHP_FUNCTION(udm_set_agent_param)
-{
- pval **yyagent, **yyvar, **yyval;
- char *val;
- int var;
- UDM_AGENT * Agent;
-
- switch(ZEND_NUM_ARGS()){
-
- case 3:
- if(zend_get_parameters_ex(3,&yyagent,&yyvar,&yyval)==FAILURE){
- RETURN_FALSE;
- }
- convert_to_long_ex(yyvar);
- convert_to_string_ex(yyval);
- ZEND_FETCH_RESOURCE(Agent, UDM_AGENT *, yyagent, -1, "mnoGoSearch-agent", le_link);
- var = (*yyvar)->value.lval;
- val = (*yyval)->value.str.val;
-
- break;
-
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- switch(var){
- case UDM_PARAM_PAGE_SIZE:
- Agent->page_size=atoi(val);
- if(Agent->page_size<1)Agent->page_size=20;
-
- break;
-
- case UDM_PARAM_PAGE_NUM:
- Agent->page_number=atoi(val);
- if(Agent->page_number<0)Agent->page_number=0;
-
- break;
-
- case UDM_PARAM_SEARCH_MODE:
- switch (atoi(val)){
- case UDM_MODE_ALL:
- Agent->search_mode=UDM_MODE_ALL;
- break;
-
- case UDM_MODE_ANY:
- Agent->search_mode=UDM_MODE_ANY;
- break;
-
- case UDM_MODE_BOOL:
- Agent->search_mode=UDM_MODE_BOOL;
- break;
-
- case UDM_MODE_PHRASE:
- Agent->search_mode=UDM_MODE_PHRASE;
- break;
-
- default:
- php_error(E_WARNING,"Udm_Set_Agent_Param: Unknown search mode");
- RETURN_FALSE;
- break;
- }
-
- break;
-
- case UDM_PARAM_WORD_MATCH:
- switch (atoi(val)){
- case UDM_MATCH_WORD:
- Agent->word_match=UDM_MATCH_WORD;
- break;
-
- case UDM_MATCH_BEGIN:
- Agent->word_match=UDM_MATCH_BEGIN;
- break;
-
- case UDM_MATCH_END:
- Agent->word_match=UDM_MATCH_END;
- break;
-
- case UDM_MATCH_SUBSTR:
- Agent->word_match=UDM_MATCH_SUBSTR;
- break;
-
- default:
- php_error(E_WARNING,"Udm_Set_Agent_Param: Unknown word match mode");
- RETURN_FALSE;
- break;
- }
-
- break;
-
- case UDM_PARAM_CACHE_MODE:
- switch (atoi(val)){
- case UDM_CACHE_ENABLED:
- Agent->cache_mode=UDM_CACHE_ENABLED;
- break;
-
- case UDM_CACHE_DISABLED:
- Agent->cache_mode=UDM_CACHE_DISABLED;
- break;
-
- default:
- Agent->cache_mode=UDM_CACHE_DISABLED;
- php_error(E_WARNING,"Udm_Set_Agent_Param: Unknown cache mode");
- RETURN_FALSE;
- break;
- }
-
- break;
-
- case UDM_PARAM_TRACK_MODE:
- switch (atoi(val)){
- case UDM_TRACK_ENABLED:
- Agent->track_mode|=UDM_TRACK_QUERIES;
- break;
-
- case UDM_TRACK_DISABLED:
- Agent->track_mode &= ~(UDM_TRACK_QUERIES);
- break;
-
- default:
- php_error(E_WARNING,"Udm_Set_Agent_Param: Unknown track mode");
- RETURN_FALSE;
- break;
- }
-
- break;
-
- case UDM_PARAM_PHRASE_MODE:
- switch (atoi(val)){
- case UDM_PHRASE_ENABLED:
- Agent->Conf->use_phrases=UDM_PHRASE_ENABLED;
- break;
-
- case UDM_PHRASE_DISABLED:
- Agent->Conf->use_phrases=UDM_PHRASE_DISABLED;
- break;
-
- default:
- php_error(E_WARNING,"Udm_Set_Agent_Param: Unknown phrase mode");
- RETURN_FALSE;
- break;
- }
-
- break;
-
- case UDM_PARAM_ISPELL_PREFIXES:
- switch (atoi(val)){
- case UDM_PREFIXES_ENABLED:
- Agent->Conf->ispell_mode |= UDM_ISPELL_USE_PREFIXES;
- break;
-
- case UDM_PREFIXES_DISABLED:
- Agent->Conf->ispell_mode &= ~UDM_ISPELL_USE_PREFIXES;
- break;
-
- default:
- php_error(E_WARNING,"Udm_Set_Agent_Param: Unknown ispell prefixes mode");
- RETURN_FALSE;
- break;
- }
-
- break;
-
- case UDM_PARAM_CHARSET:
- Agent->Conf->local_charset=UdmGetCharset(val);
- Agent->charset=Agent->Conf->local_charset;
-
- break;
-
- case UDM_PARAM_STOPTABLE:
- strcat(Agent->Conf->stop_tables," ");
- strcat(Agent->Conf->stop_tables,val);
-
- break;
-
- case UDM_PARAM_STOPFILE:
- if (UdmFileLoadStopList(Agent->Conf,val)) {
- php_error(E_WARNING,Agent->Conf->errstr);
- RETURN_FALSE;
- }
-
- break;
-
- case UDM_PARAM_WEIGHT_FACTOR:
- Agent->weight_factor=strdup(val);
-
- break;
-
- case UDM_PARAM_MIN_WORD_LEN:
- Agent->Conf->min_word_len=atoi(val);
-
- break;
-
- case UDM_PARAM_MAX_WORD_LEN:
- Agent->Conf->max_word_len=atoi(val);
-
- break;
-
-#if UDM_VERSION_ID > 30110
-
- case UDM_PARAM_CROSS_WORDS:
- switch (atoi(val)){
- case UDM_CROSS_WORDS_ENABLED:
- Agent->Conf->use_crossword=UDM_CROSS_WORDS_ENABLED;
- break;
-
- case UDM_CROSS_WORDS_DISABLED:
- Agent->Conf->use_crossword=UDM_CROSS_WORDS_DISABLED;
- break;
-
- default:
- php_error(E_WARNING,"Udm_Set_Agent_Param: Unknown crosswords mode");
- RETURN_FALSE;
- break;
- }
-
- break;
-
-#endif
-
- default:
- php_error(E_WARNING,"Udm_Set_Agent_Param: Unknown agent session parameter");
- RETURN_FALSE;
- break;
- }
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int udm_load_ispell_data(int agent, int var, string val1, string val2, int flag)
- Load ispell data */
-DLEXPORT PHP_FUNCTION(udm_load_ispell_data)
-{
- pval **yyagent, **yyvar, **yyval1, **yyval2, **yyflag;
- char *val1, *val2;
- int var, flag;
- UDM_AGENT * Agent;
-
- switch(ZEND_NUM_ARGS()){
-
- case 5:
- if(zend_get_parameters_ex(5,&yyagent,&yyvar,&yyval1,&yyval2,&yyflag)==FAILURE){
- RETURN_FALSE;
- }
- convert_to_long_ex(yyvar);
- convert_to_long_ex(yyflag);
- convert_to_string_ex(yyval1);
- convert_to_string_ex(yyval2);
- ZEND_FETCH_RESOURCE(Agent, UDM_AGENT *, yyagent, -1, "mnoGoSearch-agent", le_link);
- var = (*yyvar)->value.lval;
- flag = (*yyflag)->value.lval;
- val1 = (*yyval1)->value.str.val;
- val2 = (*yyval2)->value.str.val;
-
- break;
-
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- switch(var){
- case UDM_ISPELL_TYPE_DB:
- Agent->Conf->ispell_mode |= UDM_ISPELL_MODE_DB;
-
- if (UdmDBImportAffixes(Agent,Agent->charset) ||
- UdmImportDictionaryFromDB(Agent)) {
- RETURN_FALSE;
- }
-
- break;
-
- case UDM_ISPELL_TYPE_AFFIX:
- Agent->Conf->ispell_mode &= ~UDM_ISPELL_MODE_DB;
-
-#if UDM_VERSION_ID > 30111
- Agent->Conf->ispell_mode &= ~UDM_ISPELL_MODE_SERVER;
-#endif
-
- if (UdmImportAffixes(Agent->Conf,val1,val2,NULL,0)) {
- php_error(E_WARNING,"Udm_Load_Ispell_Data: Cannot load affix file %s",val2);
- RETURN_FALSE;
- }
-
- break;
-
- case UDM_ISPELL_TYPE_SPELL:
- Agent->Conf->ispell_mode &= ~UDM_ISPELL_MODE_DB;
-
-#if UDM_VERSION_ID > 30111
- Agent->Conf->ispell_mode &= ~UDM_ISPELL_MODE_SERVER;
-#endif
-
- if (UdmImportDictionary(Agent->Conf,val1,val2,1,"")) {
- php_error(E_WARNING,"Udm_Load_Ispell_Data: Cannot load spell file %s",val2);
- RETURN_FALSE;
- }
-
- break;
-
-#if UDM_VERSION_ID > 30111
-
- case UDM_ISPELL_TYPE_SERVER:
- Agent->Conf->ispell_mode &= ~UDM_ISPELL_MODE_DB;
- Agent->Conf->ispell_mode |= UDM_ISPELL_MODE_SERVER;
-
- Agent->Conf->spellhost = strdup(val1);
-
- break;
-
-#endif
-
- default:
- php_error(E_WARNING,"Udm_Load_Ispell_Data: Unknown ispell type parameter");
- RETURN_FALSE;
- break;
- }
-
- if (flag) {
- if(Agent->Conf->nspell) {
- UdmSortDictionary(Agent->Conf);
- UdmSortAffixes(Agent->Conf);
- }
- }
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int udm_free_ispell_data(int agent)
- Free memory allocated for ispell data */
-DLEXPORT PHP_FUNCTION(udm_free_ispell_data)
-{
- pval ** yyagent;
- UDM_AGENT * Agent;
- switch(ZEND_NUM_ARGS()){
- case 1: {
- if (zend_get_parameters_ex(1, &yyagent)==FAILURE) {
- RETURN_FALSE;
- }
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- ZEND_FETCH_RESOURCE(Agent, UDM_AGENT *, yyagent, -1, "mnoGoSearch-Agent", le_link);
-
-#if UDM_VERSION_ID > 30111
- UdmFreeIspell(Agent->Conf);
-#endif
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int udm_add_search_limit(int agent, int var, string val)
- Add mnoGoSearch search restrictions */
-DLEXPORT PHP_FUNCTION(udm_add_search_limit)
-{
- pval **yyagent, **yyvar, **yyval;
- char *val;
- int var;
- UDM_AGENT * Agent;
-
- switch(ZEND_NUM_ARGS()){
-
- case 3:
- if(zend_get_parameters_ex(3,&yyagent,&yyvar,&yyval)==FAILURE){
- RETURN_FALSE;
- }
- convert_to_long_ex(yyvar);
- convert_to_string_ex(yyval);
- ZEND_FETCH_RESOURCE(Agent, UDM_AGENT *, yyagent, -1, "mnoGoSearch-agent", le_link);
- var = (*yyvar)->value.lval;
- val = (*yyval)->value.str.val;
-
- break;
-
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- switch(var){
- case UDM_LIMIT_URL:
- UdmAddURLLimit(Agent->Conf,val);
-
- break;
-
- case UDM_LIMIT_TAG:
- UdmAddTagLimit(Agent->Conf,val);
-
- break;
-
- case UDM_LIMIT_LANG:
- UdmAddLangLimit(Agent->Conf,val);
-
- break;
-
- case UDM_LIMIT_CAT:
- UdmAddCatLimit(Agent->Conf,val);
-
- break;
-
- case UDM_LIMIT_DATE: {
- struct udm_stl_info_t stl_info = { 0, 0, 0 };
-
- if (val[0] == '>') {
- stl_info.type=1;
- } else if (val[0] == '<') {
- stl_info.type=-1;
- } else {
- php_error(E_WARNING,"Udm_Add_Search_Limit: Incorrect date limit format");
- RETURN_FALSE;
- }
-
- stl_info.t1=(time_t)(atol(val+1));
- UdmAddTimeLimit(Agent->Conf,&stl_info);
-
- break;
- }
- default:
- php_error(E_WARNING,"Udm_Add_Search_Limit: Unknown search limit parameter");
- RETURN_FALSE;
- break;
- }
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int udm_clear_search_limits(int agent)
- Clear all mnoGoSearch search restrictions */
-DLEXPORT PHP_FUNCTION(udm_clear_search_limits)
-{
- pval ** yyagent;
- UDM_AGENT * Agent;
- switch(ZEND_NUM_ARGS()){
- case 1: {
- if (zend_get_parameters_ex(1, &yyagent)==FAILURE) {
- RETURN_FALSE;
- }
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- ZEND_FETCH_RESOURCE(Agent, UDM_AGENT *, yyagent, -1, "mnoGoSearch-Agent", le_link);
-
- UdmClearLimits(Agent->Conf);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int udm_find(int agent, string query)
- Perform search */
-DLEXPORT PHP_FUNCTION(udm_find)
-{
- pval ** yyquery, ** yyagent;
- UDM_RESULT * Res;
- UDM_AGENT * Agent;
- int id=-1;
-
- switch(ZEND_NUM_ARGS()){
- case 2: {
- if (zend_get_parameters_ex(2, &yyagent,&yyquery)==FAILURE) {
- RETURN_FALSE;
- }
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- ZEND_FETCH_RESOURCE(Agent, UDM_AGENT *, yyagent, id, "mnoGoSearch-Agent", le_link);
- convert_to_string_ex(yyquery);
-
- if ((Res=UdmFind(Agent,UdmTolower((*yyquery)->value.str.val,Agent->charset)))) {
- ZEND_REGISTER_RESOURCE(return_value,Res,le_res);
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto string udm_get_res_field(int res, int row, int field)
- Fetch mnoGoSearch result field */
-DLEXPORT PHP_FUNCTION(udm_get_res_field){
- pval **yyres, **yyrow_num, **yyfield_name;
-
- UDM_RESULT * Res;
- int row,field;
-
- switch(ZEND_NUM_ARGS()){
- case 3: {
- if (zend_get_parameters_ex(3, &yyres,&yyrow_num,&yyfield_name)==FAILURE){
- RETURN_FALSE;
- }
- convert_to_string_ex(yyrow_num);
- convert_to_string_ex(yyfield_name);
- field=atoi((*yyfield_name)->value.str.val);
- row=atoi((*yyrow_num)->value.str.val);
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- ZEND_FETCH_RESOURCE(Res, UDM_RESULT *, yyres, -1, "mnoGoSearch-Result", le_res);
- if(row<Res->num_rows){
- switch(field){
- case UDM_FIELD_URL:
- RETURN_STRING((Res->Doc[row].url),1);
- break;
-
- case UDM_FIELD_CONTENT:
- RETURN_STRING((Res->Doc[row].content_type),1);
- break;
-
- case UDM_FIELD_TITLE:
- RETURN_STRING((Res->Doc[row].title),1);
- break;
-
- case UDM_FIELD_KEYWORDS:
- RETURN_STRING((Res->Doc[row].keywords),1);
- break;
-
- case UDM_FIELD_DESC:
- RETURN_STRING((Res->Doc[row].description),1);
- break;
-
- case UDM_FIELD_TEXT:
- RETURN_STRING((Res->Doc[row].text),1);
- break;
-
- case UDM_FIELD_SIZE:
- RETURN_LONG((Res->Doc[row].size));
- break;
-
- case UDM_FIELD_URLID:
- RETURN_LONG((Res->Doc[row].url_id));
- break;
-
- case UDM_FIELD_RATING:
- RETURN_LONG((Res->Doc[row].rating));
- break;
-
- case UDM_FIELD_MODIFIED:
- RETURN_LONG((Res->Doc[row].last_mod_time));
- break;
-
- case UDM_FIELD_ORDER:
- RETURN_LONG((Res->Doc[row].order));
- break;
-
- case UDM_FIELD_CRC:
- RETURN_LONG((Res->Doc[row].crc32));
- break;
-
- case UDM_FIELD_CATEGORY:
- RETURN_STRING((Res->Doc[row].category),1);
- break;
-
- default:
- php_error(E_WARNING,"Udm_Get_Res_Field: Unknown mnoGoSearch field name");
- RETURN_FALSE;
- break;
- }
- }else{
- php_error(E_WARNING,"Udm_Get_Res_Field: row number too large");
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto string udm_get_res_param(int res, int param)
- Get mnoGoSearch result parameters */
-DLEXPORT PHP_FUNCTION(udm_get_res_param)
-{
- pval ** yyres, ** yyparam;
- int param;
- UDM_RESULT * Res;
- switch(ZEND_NUM_ARGS()){
- case 2: {
- if (zend_get_parameters_ex(2, &yyres, &yyparam)==FAILURE) {
- RETURN_FALSE;
- }
- convert_to_long_ex(yyparam);
- param=((*yyparam)->value.lval);
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- ZEND_FETCH_RESOURCE(Res, UDM_RESULT *, yyres, -1, "mnoGoSearch-Result", le_res);
- switch(param){
- case UDM_PARAM_NUM_ROWS:
- RETURN_LONG(Res->num_rows);
- break;
-
- case UDM_PARAM_FOUND:
- RETURN_LONG(Res->total_found);
- break;
-
- case UDM_PARAM_WORDINFO:
- RETURN_STRING(Res->wordinfo,1);
- break;
-
- case UDM_PARAM_SEARCHTIME:
- RETURN_DOUBLE(((double)Res->work_time)/1000);
- break;
-
- case UDM_PARAM_FIRST_DOC:
- RETURN_LONG(Res->first);
- break;
-
- case UDM_PARAM_LAST_DOC:
- RETURN_LONG(Res->last);
- break;
-
- default:
- php_error(E_WARNING,"Udm_Get_Res_Param: Unknown mnoGoSearch param name");
- RETURN_FALSE;
- break;
- }
-}
-/* }}} */
-
-/* {{{ proto int udm_free_res(int res)
- mnoGoSearch free result */
-DLEXPORT PHP_FUNCTION(udm_free_res)
-{
- pval ** yyres;
- UDM_RESULT * Res;
- switch(ZEND_NUM_ARGS()){
- case 1: {
- if (zend_get_parameters_ex(1, &yyres)==FAILURE) {
- RETURN_FALSE;
- }
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- ZEND_FETCH_RESOURCE(Res, UDM_RESULT *, yyres, -1, "mnoGoSearch-Result", le_res);
- zend_list_delete((*yyres)->value.lval);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int udm_free_agent(int agent)
- Free mnoGoSearch session */
-DLEXPORT PHP_FUNCTION(udm_free_agent)
-{
- pval ** yyagent;
- UDM_RESULT * Agent;
- switch(ZEND_NUM_ARGS()){
- case 1: {
- if (zend_get_parameters_ex(1, &yyagent)==FAILURE) {
- RETURN_FALSE;
- }
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- ZEND_FETCH_RESOURCE(Agent, UDM_RESULT *, yyagent, -1, "mnoGoSearch-agent", le_link);
- zend_list_delete((*yyagent)->value.lval);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int udm_errno(int agent)
- Get mnoGoSearch error number */
-DLEXPORT PHP_FUNCTION(udm_errno)
-{
- pval ** yyagent;
- UDM_AGENT * Agent;
- switch(ZEND_NUM_ARGS()){
- case 1: {
- if (zend_get_parameters_ex(1, &yyagent)==FAILURE) {
- RETURN_FALSE;
- }
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- ZEND_FETCH_RESOURCE(Agent, UDM_AGENT *, yyagent, -1, "mnoGoSearch-Agent", le_link);
- RETURN_LONG(UdmDBErrorCode(Agent->db));
-}
-/* }}} */
-
-/* {{{ proto string udm_error(int agent)
- Get mnoGoSearch error message */
-DLEXPORT PHP_FUNCTION(udm_error)
-{
- pval ** yyagent;
- UDM_AGENT * Agent;
-
- switch(ZEND_NUM_ARGS()){
- case 1: {
- if (zend_get_parameters_ex(1, &yyagent)==FAILURE) {
- RETURN_FALSE;
- }
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- ZEND_FETCH_RESOURCE(Agent, UDM_AGENT *, yyagent, -1, "mnoGoSearch-Agent", le_link);
- RETURN_STRING(UdmDBErrorMsg(Agent->db),1);
-}
-/* }}} */
-
-/* {{{ proto int udm_api_version()
- Get mnoGoSearch API version */
-DLEXPORT PHP_FUNCTION(udm_api_version)
-{
- RETURN_LONG(UDM_VERSION_ID);
-}
-/* }}} */
-
-/* {{{ proto array udm_cat_list(int agent, string category)
- Get mnoGoSearch categories list with the same root */
-DLEXPORT PHP_FUNCTION(udm_cat_list)
-{
- pval ** yycat, ** yyagent;
- UDM_AGENT * Agent;
- char *cat;
- UDM_CATEGORY *c=NULL;
- char *buf=NULL;
- int id=-1;
-
- switch(ZEND_NUM_ARGS()){
- case 2: {
- if (zend_get_parameters_ex(2, &yyagent,&yycat)==FAILURE) {
- RETURN_FALSE;
- }
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- ZEND_FETCH_RESOURCE(Agent, UDM_AGENT *, yyagent, id, "mnoGoSearch-Agent", le_link);
- convert_to_string_ex(yycat);
- cat = (*yycat)->value.str.val;
-
- if((c=UdmCatList(Agent,cat))){
- if (array_init(return_value)==FAILURE) {
- RETURN_FALSE;
- }
-
- if (!(buf=calloc(1,UDMSTRSIZ+1))) {
- RETURN_FALSE;
- }
-
- while(c->rec_id){
- snprintf(buf, UDMSTRSIZ, "%s%s",c->link[0]?"@ ":"", c->name);
- add_next_index_string(return_value, c->link[0]?c->link:c->path, 1);
- add_next_index_string(return_value, buf, 1);
- c++;
- }
-
- free(buf);
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto array udm_cat_path(int agent, string category)
- Get mnoGoSearch categories path from the root to the given catgory */
-DLEXPORT PHP_FUNCTION(udm_cat_path)
-{
- pval ** yycat, ** yyagent;
- UDM_AGENT * Agent;
- char *cat;
- UDM_CATEGORY *c=NULL;
- char *buf=NULL;
- int id=-1;
-
- switch(ZEND_NUM_ARGS()){
- case 2: {
- if (zend_get_parameters_ex(2, &yyagent,&yycat)==FAILURE) {
- RETURN_FALSE;
- }
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- ZEND_FETCH_RESOURCE(Agent, UDM_AGENT *, yyagent, id, "mnoGoSearch-Agent", le_link);
- convert_to_string_ex(yycat);
- cat = (*yycat)->value.str.val;
-
- if((c=UdmCatPath(Agent,cat))){
- if (array_init(return_value)==FAILURE) {
- RETURN_FALSE;
- }
-
- if (!(buf=calloc(1,UDMSTRSIZ+1))) {
- RETURN_FALSE;
- }
-
- while(c->rec_id){
- snprintf(buf, UDMSTRSIZ, "%s%s",c->link[0]?"@ ":"", c->name);
- add_next_index_string(return_value, c->link[0]?c->link:c->path, 1);
- add_next_index_string(return_value, buf, 1);
- c++;
- }
-
- free(buf);
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-#if UDM_VERSION_ID > 30110
-/* {{{ proto int udm_get_doc_count(int agent)
- Get total number of documents in database */
-DLEXPORT PHP_FUNCTION(udm_get_doc_count)
-{
- pval ** yyagent;
- UDM_AGENT * Agent;
- int id=-1;
-
- switch(ZEND_NUM_ARGS()){
- case 1: {
- if (zend_get_parameters_ex(1, &yyagent)==FAILURE) {
- RETURN_FALSE;
- }
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- ZEND_FETCH_RESOURCE(Agent, UDM_AGENT *, yyagent, id, "mnoGoSearch-Agent", le_link);
- RETURN_LONG(UdmGetDocCount(Agent));
-}
-/* }}} */
-#endif
-
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/mnogosearch/php_mnogo.h b/ext/mnogosearch/php_mnogo.h
deleted file mode 100644
index 07238754ad..0000000000
--- a/ext/mnogosearch/php_mnogo.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/* $Source$ */
-/* $Id$ */
-
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997, 1998, 1999, 2000, 2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: |
- | Initial version by Alex Barkov <bar@izhcom.ru> |
- | and Ramil Kalimullin <ram@izhcom.ru> |
- | Further development by Sergey Kartashoff <gluke@biosys.net> |
- +----------------------------------------------------------------------+
- */
-
-#ifndef _PHP_MNOGO_H
-#define _PHP_MNOGO_H
-
-#if HAVE_MNOGOSEARCH
-
-#include <udm_config.h>
-#include <udmsearch.h>
-
-extern zend_module_entry mnogosearch_module_entry;
-#define mnogosearch_module_ptr &mnogosearch_module_entry
-
-#ifdef PHP_WIN32
-#define PHP_MNOGO_API __declspec(dllexport)
-#else
-#define PHP_MNOGO_API
-#endif
-
-#ifdef ZTS
-#include "TSRM.h"
-#endif
-
-/* mnoGoSearch functions */
-DLEXPORT PHP_MINIT_FUNCTION(mnogosearch);
-DLEXPORT PHP_RINIT_FUNCTION(mnogosearch);
-DLEXPORT PHP_MSHUTDOWN_FUNCTION(mnogosearch);
-DLEXPORT PHP_MINFO_FUNCTION(mnogosearch);
-
-DLEXPORT PHP_FUNCTION(udm_api_version);
-
-DLEXPORT PHP_FUNCTION(udm_alloc_agent);
-DLEXPORT PHP_FUNCTION(udm_set_agent_param);
-
-DLEXPORT PHP_FUNCTION(udm_load_ispell_data);
-DLEXPORT PHP_FUNCTION(udm_free_ispell_data);
-
-DLEXPORT PHP_FUNCTION(udm_add_search_limit);
-DLEXPORT PHP_FUNCTION(udm_clear_search_limits);
-
-DLEXPORT PHP_FUNCTION(udm_error);
-DLEXPORT PHP_FUNCTION(udm_errno);
-
-DLEXPORT PHP_FUNCTION(udm_find);
-DLEXPORT PHP_FUNCTION(udm_get_res_field);
-DLEXPORT PHP_FUNCTION(udm_get_res_param);
-
-DLEXPORT PHP_FUNCTION(udm_cat_list);
-DLEXPORT PHP_FUNCTION(udm_cat_path);
-
-DLEXPORT PHP_FUNCTION(udm_free_res);
-DLEXPORT PHP_FUNCTION(udm_free_agent);
-
-#if UDM_VERSION_ID > 30110
-DLEXPORT PHP_FUNCTION(udm_get_doc_count);
-#endif
-
-#else
-
-#define mnogosearch_module_ptr NULL
-
-#endif
-
-#define phpext_mnogosearch_ptr mnogosearch_module_ptr
-
-#endif /* _PHP_MNOGO_H */
diff --git a/ext/mnogosearch/setup.stub b/ext/mnogosearch/setup.stub
deleted file mode 100644
index e92ebc06f9..0000000000
--- a/ext/mnogosearch/setup.stub
+++ /dev/null
@@ -1,10 +0,0 @@
-# $Source$
-# $Id$
-
-define_option with-mnogosearch 'mnoGoSearch support?' yesnodir \
- 'no /usr/local/udmsearch mnoGoSearch install' \
-' Whether to build PHP with mnoGoSearch support.
- More info about mnoGoSearch can be found at http://search.mnogo.ru/.'
-
-
- \ No newline at end of file
diff --git a/ext/mnogosearch/test.php b/ext/mnogosearch/test.php
deleted file mode 100644
index 3b8f6d0d87..0000000000
--- a/ext/mnogosearch/test.php
+++ /dev/null
@@ -1,137 +0,0 @@
-<!--
- $Source$
- $Id$
--->
-
-<html>
-<body>
-
-<form method=post>
-<input type=text size=30 name=q value="<? echo htmlspecialchars(stripslashes($q)); ?>">
-<input type=submit value=" Search ! ">
-</form>
-
-<pre>
-
-<?
- if ($q=='') {
- print("</pre></body></html>\n");
- exit();
- }
-
-// Stage 1: allocate UdmSearch agent, set DBAddr and DBMode
-// DBMode is optional, "single" by default
-
- $udm=Udm_Alloc_Agent("mysql://udm:udm@localhost/udm/",'single');
-
- if (Udm_Api_Version() >= 30111) {
- print "Total number of urls in database: ".Udm_Get_Doc_Count($udm)."<br>\n";
- }
-
-// Stage 2: set search parameters
-
- $page_size=10;
- $page_number=0;
-
- Udm_Set_Agent_Param($udm,UDM_PARAM_PAGE_SIZE,$page_size);
- Udm_Set_Agent_Param($udm,UDM_PARAM_PAGE_NUM,$page_number);
- Udm_Set_Agent_Param($udm,UDM_PARAM_SEARCH_MODE,UDM_MODE_BOOL);
- Udm_Set_Agent_Param($udm,UDM_PARAM_CACHE_MODE,UDM_CACHE_DISABLED);
- Udm_Set_Agent_Param($udm,UDM_PARAM_TRACK_MODE,UDM_TRACK_DISABLED);
- Udm_Set_Agent_Param($udm,UDM_PARAM_CHARSET,"koi8-r");
-// Udm_Set_Agent_Param($udm,UDM_PARAM_STOPTABLE,"stopword");
-// Udm_Set_Agent_Param($udm,UDM_PARAM_STOPFILE,"stop.txt");
- Udm_Set_Agent_Param($udm,UDM_PARAM_WEIGHT_FACTOR,"F9421");
- Udm_Set_Agent_Param($udm,UDM_PARAM_WORD_MATCH,UDM_MATCH_WORD);
- Udm_Set_Agent_Param($udm,UDM_PARAM_PHRASE_MODE,UDM_PHRASE_DISABLED);
- Udm_Set_Agent_Param($udm,UDM_PARAM_MIN_WORD_LEN,2);
- Udm_Set_Agent_Param($udm,UDM_PARAM_MAX_WORD_LEN,16);
- Udm_Set_Agent_Param($udm,UDM_PARAM_PREFIX,UDM_PREFIX_DISABLED);
-
- if (Udm_Api_Version() >= 30111) {
- Udm_Set_Agent_Param($udm,UDM_PARAM_CROSS_WORDS,UDM_CROSS_WORDS_DISABLED);
- }
-
-// if (! Udm_Load_Ispell_Data($udm,UDM_ISPELL_TYPE_DB,'','',1)) {
-// printf("Error #%d: '%s'\n",Udm_Errno($udm),Udm_Error($udm));
-// exit;
-// }
-
-// if ((! Udm_Load_Ispell_Data($udm,UDM_ISPELL_TYPE_AFFIX,'en','/opt/udm/ispell/en.aff',0)) ||
-// (! Udm_Load_Ispell_Data($udm,UDM_ISPELL_TYPE_SPELL,'en','/opt/udm/ispell/en.dict',1))) {
-// printf("Error loading ispell data from files<br>\n");
-// exit;
-// }
-
-// if (! Udm_Load_Ispell_Data($udm,UDM_ISPELL_TYPE_SERVER,'','',1)) {
-// printf("Error loading ispell data from server<br>\n");
-// exit;
-// }
-
-// Stage 3: add search limits
-// Udm_Add_Search_Limit($udm,UDM_LIMIT_URL,"http://www.mydomain.com/%");
-// Udm_Add_Search_Limit($udm,UDM_LIMIT_TAG,"01");
-// Udm_Add_Search_Limit($udm,UDM_LIMIT_CAT,"01");
-// Udm_Add_Search_Limit($udm,UDM_LIMIT_LANG,"en");
-// Udm_Add_Search_Limit($udm,UDM_LIMIT_DATE,"<908012006");
-
-// Udm_Clear_Search_Limits($udm);
-
-// Stage 4: perform search
-
- $res=Udm_Find($udm,$q);
-
-// Stage 5: display results
-
- // Check error code
- if(($errno=Udm_Errno($udm))>0){
- // Display error message
- printf("Error #%d: '%s'\n",$errno,Udm_Error($udm));
- }else{
- $first=$page_size*$page_number+1;
-
- // Get result parameters
- $total=Udm_Get_Res_Param($res,UDM_PARAM_FOUND);
- $rows=Udm_Get_Res_Param($res,UDM_PARAM_NUM_ROWS);
- $wordinfo=Udm_Get_Res_Param($res,UDM_PARAM_WORDINFO);
- $searchtime=Udm_Get_Res_Param($res,UDM_PARAM_SEARCHTIME);
- $first_doc=Udm_Get_Res_Param($res,UDM_PARAM_FIRST_DOC);
- $last_doc=Udm_Get_Res_Param($res,UDM_PARAM_LAST_DOC);
-
- printf("Searchtime: ".$searchtime."\n\n");
-
- printf("Documents %d-%d from %d total found; %s\n\n",
- $first_doc,$last_doc,$total,$wordinfo);
-
- // Fetch all rows
- for($i=0;$i<$rows;$i++){
- printf("%3d. %s\n",$first+$i,Udm_Get_Res_Field($res,$i,UDM_FIELD_URL));
- printf(" ORDER : %d\n",Udm_Get_Res_Field($res,$i,UDM_FIELD_ORDER));
- printf(" CONT : %s\n",htmlspecialchars(Udm_Get_Res_Field($res,$i,UDM_FIELD_CONTENT)));
- printf(" TITLE: %s\n",htmlspecialchars(Udm_Get_Res_Field($res,$i,UDM_FIELD_TITLE)));
- printf(" KEYWORDS: %s\n",htmlspecialchars(Udm_Get_Res_Field($res,$i,UDM_FIELD_KEYWORDS)));
- printf(" DESC: %s\n",htmlspecialchars(Udm_Get_Res_Field($res,$i,UDM_FIELD_DESC)));
- printf(" TEXT: %s\n",htmlspecialchars(Udm_Get_Res_Field($res,$i,UDM_FIELD_TEXT)));
- printf(" SIZE : %d\n",Udm_Get_Res_Field($res,$i,UDM_FIELD_SIZE));
- printf(" MODIFIED : %s\n",Udm_Get_Res_Field($res,$i,UDM_FIELD_MODIFIED));
- printf(" URLID : %d\n",Udm_Get_Res_Field($res,$i,UDM_FIELD_URLID));
- printf(" RATING : %d\n",Udm_Get_Res_Field($res,$i,UDM_FIELD_RATING));
- printf(" CRC : %d\n",Udm_Get_Res_Field($res,$i,UDM_FIELD_CRC));
- printf("---------\n");
- }
-
- // Free result
- Udm_Free_Res($res);
- }
-
-//Stage 6: free ispell data if loaded before
-// Udm_Free_Ispell_Data($udm);
-
-//Stage 7: free UdmSearch agent
-
- Udm_Free_Agent($udm);
-?>
-
-</pre>
-</body>
-</html>
diff --git a/ext/msql/CREDITS b/ext/msql/CREDITS
deleted file mode 100644
index 31ad918eaf..0000000000
--- a/ext/msql/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-mSQL
-Zeev Suraski
diff --git a/ext/msql/Makefile.in b/ext/msql/Makefile.in
deleted file mode 100644
index ae6502dbc5..0000000000
--- a/ext/msql/Makefile.in
+++ /dev/null
@@ -1,7 +0,0 @@
-
-LTLIBRARY_NAME = libmsql.la
-LTLIBRARY_SOURCES = php_msql.c
-LTLIBRARY_SHARED_NAME = msql.la
-LTLIBRARY_SHARED_LIBADD = $(MSQL_SHARED_LIBADD)
-
-include $(top_srcdir)/build/dynlib.mk
diff --git a/ext/msql/config.m4 b/ext/msql/config.m4
deleted file mode 100644
index 523ec15e30..0000000000
--- a/ext/msql/config.m4
+++ /dev/null
@@ -1,40 +0,0 @@
-dnl $Id$
-
-dnl
-dnl Test mSQL version by checking if msql.h has "IDX_TYPE" defined.
-dnl
-AC_DEFUN(PHP_MSQL_VERSION,[
- AC_MSG_CHECKING([mSQL version])
- ac_php_oldcppflags=$CPPFLAGS
- CPPFLAGS="$INCLUDES $CPPFLAGS"
- AC_TRY_COMPILE([#include <sys/types.h>
-#include "msql.h"],[int i = IDX_TYPE],[
- AC_DEFINE(MSQL1,0,[ ])
- MSQL_VERSION="2.0 or newer"
- ],[
- AC_DEFINE(MSQL1,1,[ ])
- MSQL_VERSION=1.0
- ])
- CPPFLAGS=$ac_php_oldcppflags
- AC_MSG_RESULT($MSQL_VERSION)
-])
-
-PHP_ARG_WITH(msql,for mSQL support,
-[ --with-msql[=DIR] Include mSQL support. DIR is the mSQL base
- install directory, defaults to /usr/local/Hughes.])
-
- if test "$PHP_MSQL" != "no"; then
- if test "$PHP_MSQL" = "yes"; then
- MSQL_INCDIR=/usr/local/Hughes/include
- MSQL_LIBDIR=/usr/local/Hughes/lib
- else
- MSQL_INCDIR=$PHP_MSQL/include
- MSQL_LIBDIR=$PHP_MSQL/lib
- fi
- PHP_ADD_LIBRARY_WITH_PATH(msql, $MSQL_LIBDIR, MSQL_SHARED_LIBADD)
- PHP_ADD_INCLUDE($MSQL_INCDIR)
- AC_DEFINE(HAVE_MSQL,1,[ ])
- PHP_SUBST(MSQL_SHARED_LIBADD)
- PHP_EXTENSION(msql,$ext_shared)
- PHP_MSQL_VERSION
- fi
diff --git a/ext/msql/msql.dsp b/ext/msql/msql.dsp
deleted file mode 100644
index 7b77d36edd..0000000000
--- a/ext/msql/msql.dsp
+++ /dev/null
@@ -1,107 +0,0 @@
-# Microsoft Developer Studio Project File - Name="msql" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=msql - Win32 Debug_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "msql.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "msql.mak" CFG="msql - Win32 Debug_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "msql - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "msql - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "msql - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MSQL_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\main" /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\win32" /D "WIN32" /D "COMPILE_DL_MSQL" /D ZTS=1 /D HAVE_MSQL=1 /D ZEND_DEBUG=0 /D "NDEBUG" /D "_WINDOWS" /D "ZEND_WIN32" /D "PHP_WIN32" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x407 /d "NDEBUG"
-# ADD RSC /l 0x407 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 kernel32.lib php4ts.lib msql_dll.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_msql.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
-
-!ELSEIF "$(CFG)" == "msql - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MSQL_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\TSRM" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_MSQL=1 /D COMPILE_DL_MSQL=1 /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x407 /d "_DEBUG"
-# ADD RSC /l 0x407 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib php4ts_debug.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"..\..\Debug_TS/php_msql.dll" /pdbtype:sept /libpath:"..\..\Debug_TS"
-
-!ENDIF
-
-# Begin Target
-
-# Name "msql - Win32 Release_TS"
-# Name "msql - Win32 Debug_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\php_msql.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_msql.h
-# End Source File
-# End Group
-# End Target
-# End Project
diff --git a/ext/msql/php_msql.c b/ext/msql/php_msql.c
deleted file mode 100644
index 104ec19ea8..0000000000
--- a/ext/msql/php_msql.c
+++ /dev/null
@@ -1,1323 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "php_msql.h"
-#include "ext/standard/php_standard.h"
-#include "ext/standard/info.h"
-#include "php_globals.h"
-
-#if HAVE_MSQL
-
-#define OS_UNIX 1
-
-#if defined(WIN32) && defined(MSQL1)
-#include <msql1.h>
-#else
-#include <msql.h>
-#endif
-
-static php_msql_globals msql_globals;
-
-#define MSQL_ASSOC 1<<0
-#define MSQL_NUM 1<<1
-#define MSQL_BOTH (MSQL_ASSOC|MSQL_NUM)
-
-/* {{{ msql_functions[]
- */
-function_entry msql_functions[] = {
- PHP_FE(msql_connect, NULL)
- PHP_FE(msql_pconnect, NULL)
- PHP_FE(msql_close, NULL)
- PHP_FE(msql_select_db, NULL)
- PHP_FE(msql_create_db, NULL)
- PHP_FE(msql_drop_db, NULL)
- PHP_FE(msql_query, NULL)
- PHP_FE(msql_db_query, NULL)
- PHP_FE(msql_list_dbs, NULL)
- PHP_FE(msql_list_tables, NULL)
- PHP_FE(msql_list_fields, NULL)
- PHP_FE(msql_error, NULL)
- PHP_FE(msql_result, NULL)
- PHP_FE(msql_num_rows, NULL)
- PHP_FE(msql_num_fields, NULL)
- PHP_FE(msql_fetch_row, NULL)
- PHP_FE(msql_fetch_array, NULL)
- PHP_FE(msql_fetch_object, NULL)
- PHP_FE(msql_data_seek, NULL)
- PHP_FE(msql_fetch_field, NULL)
- PHP_FE(msql_field_seek, NULL)
- PHP_FE(msql_free_result, NULL)
- PHP_FE(msql_field_name, NULL)
- PHP_FE(msql_field_table, NULL)
- PHP_FE(msql_field_len, NULL)
- PHP_FE(msql_field_type, NULL)
- PHP_FE(msql_field_flags, NULL)
-
- PHP_FALIAS(msql_fieldname, msql_field_name, NULL)
- PHP_FALIAS(msql_fieldtable, msql_field_table, NULL)
- PHP_FALIAS(msql_fieldlen, msql_field_len, NULL)
- PHP_FALIAS(msql_fieldtype, msql_field_type, NULL)
- PHP_FALIAS(msql_fieldflags, msql_field_flags, NULL)
-
- PHP_FALIAS(msql_regcase, sql_regcase, NULL)
-
- PHP_FALIAS(msql_affected_rows, msql_affected_rows, NULL)
-
- /* for downwards compatability */
- PHP_FALIAS(msql, msql_db_query, NULL)
- PHP_FALIAS(msql_selectdb, msql_select_db, NULL)
- PHP_FALIAS(msql_createdb, msql_create_db, NULL)
- PHP_FALIAS(msql_dropdb, msql_drop_db, NULL)
- PHP_FALIAS(msql_freeresult, msql_free_result, NULL)
- PHP_FALIAS(msql_numfields, msql_num_fields, NULL)
- PHP_FALIAS(msql_numrows, msql_num_rows, NULL)
- PHP_FALIAS(msql_listdbs, msql_list_dbs, NULL)
- PHP_FALIAS(msql_listtables, msql_list_tables, NULL)
- PHP_FALIAS(msql_listfields, msql_list_fields, NULL)
- PHP_FALIAS(msql_dbname, msql_result, NULL)
- PHP_FALIAS(msql_tablename, msql_result, NULL)
- {NULL, NULL, NULL}
-};
-/* }}} */
-
-zend_module_entry msql_module_entry = {
- "msql", msql_functions, PHP_MINIT(msql), NULL, PHP_RINIT(msql), NULL,
- PHP_MINFO(msql), STANDARD_MODULE_PROPERTIES
-};
-
-
-#ifdef COMPILE_DL_MSQL
-ZEND_GET_MODULE(msql)
-#endif
-
-typedef struct {
- m_result *result;
- int af_rows;
-} m_query;
-
-#define MSQL_GET_QUERY(res) \
- ZEND_FETCH_RESOURCE(msql_query, m_query *, &res, -1, "mSQL result", msql_globals.le_query); \
- msql_result = msql_query->result
-
-static void _delete_query(zend_rsrc_list_entry *rsrc)
-{
- m_query *query = (m_query *)rsrc->ptr;
-
- if(query->result) msqlFreeResult(query->result);
- efree(query);
-}
-
-static m_query *php_msql_query_wrapper(m_result *res, int af_rows)
-{
- m_query *query = (m_query *) emalloc(sizeof(m_query));
-
- query->result = res;
- query->af_rows = af_rows;
-
- return query;
-}
-
-static void _close_msql_link(zend_rsrc_list_entry *rsrc)
-{
- int link = (int)rsrc->ptr;
- msqlClose(link);
- msql_globals.num_links--;
-}
-
-
-static void _close_msql_plink(zend_rsrc_list_entry *rsrc)
-{
- int link = (int)rsrc->ptr;
- msqlClose(link);
- msql_globals.num_persistent--;
- msql_globals.num_links--;
-}
-
-/* {{{ PHP_MINIT_FUNCTION
- */
-PHP_MINIT_FUNCTION(msql)
-{
- if (cfg_get_long("msql.allow_persistent",&msql_globals.allow_persistent)==FAILURE) {
- msql_globals.allow_persistent=1;
- }
- if (cfg_get_long("msql.max_persistent",&msql_globals.max_persistent)==FAILURE) {
- msql_globals.max_persistent=-1;
- }
- if (cfg_get_long("msql.max_links",&msql_globals.max_links)==FAILURE) {
- msql_globals.max_links=-1;
- }
- msql_globals.num_persistent=0;
- msql_globals.le_query = zend_register_list_destructors_ex(_delete_query, NULL, "msql query", module_number);
- msql_globals.le_link = zend_register_list_destructors_ex(_close_msql_link, NULL, "msql link", module_number);
- msql_globals.le_plink = zend_register_list_destructors_ex(NULL, _close_msql_plink, "msql link persistent", module_number);
-
- msql_module_entry.type = type;
-
- REGISTER_LONG_CONSTANT("MSQL_ASSOC", MSQL_ASSOC, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("MSQL_NUM", MSQL_NUM, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("MSQL_BOTH", MSQL_BOTH, CONST_CS | CONST_PERSISTENT);
-
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_RINIT_FUNCTION
- */
-PHP_RINIT_FUNCTION(msql)
-{
- msql_globals.default_link=-1;
- msql_globals.num_links = msql_globals.num_persistent;
- msqlErrMsg[0]=0;
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_MINFO_FUNCTION
- */
-PHP_MINFO_FUNCTION(msql)
-{
- char maxp[32],maxl[32];
-
- if (msql_globals.max_persistent==-1) {
- snprintf(maxp, 31, "%d/unlimited", msql_globals.num_persistent );
- } else {
- snprintf(maxp, 31, "%d/%ld", msql_globals.num_persistent, msql_globals.max_persistent);
- }
- maxp[31]=0;
-
- if (msql_globals.max_links==-1) {
- snprintf(maxl, 15, "%d/unlimited", msql_globals.num_links );
- } else {
- snprintf(maxl, 15, "%d/%ld", msql_globals.num_links, msql_globals.max_links);
- }
- maxl[31]=0;
-
- php_info_print_table_start();
- php_info_print_table_row(2, "MSQL Support", "enabled" );
- php_info_print_table_row(2, "Allow Persistent Links", (msql_globals.allow_persistent?"yes":"no") );
- php_info_print_table_row(2, "Persistent Links", maxp );
- php_info_print_table_row(2, "Total Links", maxl );
- php_info_print_table_end();
-
-}
-/* }}} */
-
-/* {{{ php_msql_do_connect
- */
-static void php_msql_do_connect(INTERNAL_FUNCTION_PARAMETERS,int persistent)
-{
- char *host;
- char *hashed_details;
- int hashed_details_length;
- int msql;
-
- switch(ZEND_NUM_ARGS()) {
- case 0: /* defaults */
- host=NULL;
- hashed_details=estrndup("msql_",5);
- hashed_details_length=4+1;
- break;
- case 1: {
- pval *yyhost;
-
- if (getParameters(ht, 1, &yyhost) == FAILURE) {
- RETURN_FALSE;
- }
- convert_to_string(yyhost);
- host = yyhost->value.str.val;
- hashed_details_length = yyhost->value.str.len+4+1;
- hashed_details = emalloc(hashed_details_length+1);
- sprintf(hashed_details,"msql_%s",yyhost->value.str.val); /* SAFE */
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- if (!msql_globals.allow_persistent) {
- persistent=0;
- }
- if (persistent) {
- list_entry *le;
-
- if (msql_globals.max_links!=-1 && msql_globals.num_links>=msql_globals.max_links) {
- php_error(E_WARNING,"mSQL: Too many open links (%d)",msql_globals.num_links);
- efree(hashed_details);
- RETURN_FALSE;
- }
- if (msql_globals.max_persistent!=-1 && msql_globals.num_persistent>=msql_globals.max_persistent) {
- php_error(E_WARNING,"mSQL: Too many open persistent links (%d)",msql_globals.num_persistent);
- efree(hashed_details);
- RETURN_FALSE;
- }
-
- /* try to find if we already have this link in our persistent list */
- if (zend_hash_find(&EG(persistent_list), hashed_details, hashed_details_length+1, (void **) &le)==FAILURE) { /* we don't */
- list_entry new_le;
-
- /* create the link */
- if ((msql=msqlConnect(host))==-1) {
- efree(hashed_details);
- RETURN_FALSE;
- }
-
- /* hash it up */
- new_le.type = msql_globals.le_plink;
- new_le.ptr = (void *) msql;
- if (zend_hash_update(&EG(persistent_list), hashed_details, hashed_details_length+1, (void *) &new_le, sizeof(list_entry), NULL)==FAILURE) {
- efree(hashed_details);
- RETURN_FALSE;
- }
- msql_globals.num_persistent++;
- msql_globals.num_links++;
- } else { /* we do */
- if (le->type != msql_globals.le_plink) {
- efree(hashed_details);
- RETURN_FALSE;
- }
-#if 0
- /* ensure that the link did not die */
- /* still have to find a way to do this nicely with mSQL */
- if (msql_stat(le->ptr)==NULL) { /* the link died */
- if (msql_connect(le->ptr,host,user,passwd)==NULL) {
- php_error(E_WARNING,"mSQL link lost, unable to reconnect");
- zend_hash_del(&EG(persistent_list),hashed_details,hashed_details_length+1);
- efree(hashed_details);
- RETURN_FALSE;
- }
- }
-#endif
- msql = (int) le->ptr;
- }
- ZEND_REGISTER_RESOURCE(return_value, (void *) msql, msql_globals.le_plink);
- } else {
- list_entry *index_ptr,new_index_ptr;
-
- /* first we check the hash for the hashed_details key. if it exists,
- * it should point us to the right offset where the actual msql link sits.
- * if it doesn't, open a new msql link, add it to the resource list,
- * and add a pointer to it with hashed_details as the key.
- */
- if (zend_hash_find(&EG(regular_list),hashed_details,hashed_details_length+1,(void **) &index_ptr)==SUCCESS) {
- int type,link;
- void *ptr;
-
- if (index_ptr->type != le_index_ptr) {
- RETURN_FALSE;
- }
- link = (int) index_ptr->ptr;
- ptr = zend_list_find(link,&type); /* check if the link is still there */
- if (ptr && (type==msql_globals.le_link || type==msql_globals.le_plink)) {
- return_value->value.lval = msql_globals.default_link = link;
- return_value->type = IS_RESOURCE;
- efree(hashed_details);
- return;
- } else {
- zend_hash_del(&EG(regular_list),hashed_details,hashed_details_length+1);
- }
- }
- if (msql_globals.max_links!=-1 && msql_globals.num_links>=msql_globals.max_links) {
- php_error(E_WARNING,"mSQL: Too many open links (%d)",msql_globals.num_links);
- efree(hashed_details);
- RETURN_FALSE;
- }
- if ((msql=msqlConnect(host))==-1) {
- efree(hashed_details);
- RETURN_FALSE;
- }
-
- /* add it to the list */
- ZEND_REGISTER_RESOURCE(return_value, (void *) msql, msql_globals.le_link);
-
- /* add it to the hash */
- new_index_ptr.ptr = (void *) return_value->value.lval;
- new_index_ptr.type = le_index_ptr;
- if (zend_hash_update(&EG(regular_list),hashed_details,hashed_details_length+1,(void *) &new_index_ptr, sizeof(list_entry), NULL)==FAILURE) {
- efree(hashed_details);
- RETURN_FALSE;
- }
- msql_globals.num_links++;
- }
- efree(hashed_details);
- msql_globals.default_link=return_value->value.lval;
-}
-/* }}} */
-
-/* {{{ php_msql_get_default_link
- */
-static int php_msql_get_default_link(INTERNAL_FUNCTION_PARAMETERS)
-{
- if (msql_globals.default_link==-1) { /* no link opened yet, implicitly open one */
- ht = 0;
- php_msql_do_connect(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
- }
- return msql_globals.default_link;
-}
-/* }}} */
-
-/* {{{ proto int msql_connect([string hostname[:port]] [, string username] [, string password])
- Open a connection to an mSQL Server */
-PHP_FUNCTION(msql_connect)
-{
- php_msql_do_connect(INTERNAL_FUNCTION_PARAM_PASSTHRU,0);
-}
-/* }}} */
-
-/* {{{ proto int msql_pconnect([string hostname[:port]] [, string username] [, string password])
- Open a persistent connection to an mSQL Server */
-PHP_FUNCTION(msql_pconnect)
-{
- php_msql_do_connect(INTERNAL_FUNCTION_PARAM_PASSTHRU,1);
-}
-/* }}} */
-
-/* {{{ proto int msql_close([int link_identifier])
- Close an mSQL connection */
-PHP_FUNCTION(msql_close)
-{
- pval *msql_link;
- int id;
- int msql;
-
- switch (ZEND_NUM_ARGS()) {
- case 0:
- id = msql_globals.default_link;
- break;
- case 1:
- if (getParameters(ht, 1, &msql_link)==FAILURE) {
- RETURN_FALSE;
- }
- id = -1;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- ZEND_FETCH_RESOURCE2(msql, int, &msql_link, id, "mSQL-Link", msql_globals.le_link, msql_globals.le_plink);
-
- if (id==-1) { /* explicit resource number */
- zend_list_delete(Z_RESVAL_P(msql_link));
- }
-
- if (id!=-1
- || (msql_link && Z_RESVAL_P(msql_link)==msql_globals.default_link)) {
- zend_list_delete(msql_globals.default_link);
- msql_globals.default_link = -1;
- }
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int msql_select_db(string database_name [, int link_identifier])
- Select an mSQL database */
-PHP_FUNCTION(msql_select_db)
-{
- pval *db,*msql_link;
- int id;
- int msql;
-
- switch(ZEND_NUM_ARGS()) {
- case 1:
- if (getParameters(ht, 1, &db)==FAILURE) {
- RETURN_FALSE;
- }
- id = php_msql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU);
- break;
- case 2:
- if (getParameters(ht, 2, &db, &msql_link)==FAILURE) {
- RETURN_FALSE;
- }
- id = -1;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
-
- ZEND_FETCH_RESOURCE2(msql, int, &msql_link, id, "mSQL-Link", msql_globals.le_link, msql_globals.le_plink);
-
- convert_to_string(db);
-
- if (msqlSelectDB(msql,db->value.str.val)==-1) {
- RETURN_FALSE;
- } else {
- RETURN_TRUE;
- }
-}
-/* }}} */
-
-/* {{{ proto int msql_create_db(string database_name [, int link_identifier])
- Create an mSQL database */
-PHP_FUNCTION(msql_create_db)
-{
- pval *db,*msql_link;
- int id;
- int msql;
-
- switch(ZEND_NUM_ARGS()) {
- case 1:
- if (getParameters(ht, 1, &db)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
- id = php_msql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU);
- break;
- case 2:
- if (getParameters(ht, 2, &db, &msql_link)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
- id = -1;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- ZEND_FETCH_RESOURCE2(msql, int, &msql_link, id, "mSQL-Link", msql_globals.le_link, msql_globals.le_plink);
-
- convert_to_string(db);
- if (msqlCreateDB(msql,db->value.str.val)<0) {
- RETURN_FALSE;
- } else {
- RETURN_TRUE;
- }
-}
-/* }}} */
-
-/* {{{ proto int msql_drop_db(string database_name [, int link_identifier])
- Drop (delete) an mSQL database */
-PHP_FUNCTION(msql_drop_db)
-{
- pval *db,*msql_link;
- int id;
- int msql;
-
- switch(ZEND_NUM_ARGS()) {
- case 1:
- if (getParameters(ht, 1, &db)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
- id = php_msql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU);
- break;
- case 2:
- if (getParameters(ht, 2, &db, &msql_link)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
- id = -1;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- ZEND_FETCH_RESOURCE2(msql, int, &msql_link, id, "mSQL-Link", msql_globals.le_link, msql_globals.le_plink);
-
- convert_to_string(db);
- if (msqlDropDB(msql,db->value.str.val)<0) {
- RETURN_FALSE;
- } else {
- RETURN_TRUE;
- }
-}
-/* }}} */
-
-/* {{{ proto int msql_query(string query [, int link_identifier])
- Send an SQL query to mSQL */
-PHP_FUNCTION(msql_query)
-{
- pval *query,*msql_link;
- int id;
- int msql;
- int af_rows;
-
- switch(ZEND_NUM_ARGS()) {
- case 1:
- if (getParameters(ht, 1, &query)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
- id = msql_globals.default_link;
- break;
- case 2:
- if (getParameters(ht, 2, &query, &msql_link)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
- id = -1;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- ZEND_FETCH_RESOURCE2(msql, int, &msql_link, id, "mSQL-Link", msql_globals.le_link, msql_globals.le_plink);
-
- convert_to_string(query);
- if ((af_rows = msqlQuery(msql,query->value.str.val))==-1) {
- RETURN_FALSE;
- }
- ZEND_REGISTER_RESOURCE(return_value, php_msql_query_wrapper(msqlStoreResult(), af_rows), msql_globals.le_query);
-}
-/* }}} */
-
-/* {{{ proto int msql_db_query(string database_name, string query [, int link_identifier])
- Send an SQL query to mSQL */
-PHP_FUNCTION(msql_db_query)
-{
- pval *db,*query,*msql_link;
- int id;
- int msql;
- int af_rows;
-
- switch(ZEND_NUM_ARGS()) {
- case 2:
- if (getParameters(ht, 2, &db, &query)==FAILURE) {
- RETURN_FALSE;
- }
- id = php_msql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU);
- break;
- case 3:
- if (getParameters(ht, 3, &db, &query, &msql_link)==FAILURE) {
- RETURN_FALSE;
- }
- id = -1;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- ZEND_FETCH_RESOURCE2(msql, int, &msql_link, id, "mSQL-Link", msql_globals.le_link, msql_globals.le_plink);
-
- convert_to_string(db);
- if (msqlSelectDB(msql,db->value.str.val)==-1) {
- RETURN_FALSE;
- }
-
- convert_to_string(query);
- if ((af_rows = msqlQuery(msql,query->value.str.val))==-1) {
- RETURN_FALSE;
- }
- ZEND_REGISTER_RESOURCE(return_value, php_msql_query_wrapper(msqlStoreResult(), af_rows), msql_globals.le_query);
-}
-/* }}} */
-
-/* {{{ proto int msql_list_dbs([int link_identifier])
- List databases available on an mSQL server */
-PHP_FUNCTION(msql_list_dbs)
-{
- pval *msql_link;
- int id;
- int msql;
- m_result *msql_result;
-
- switch(ZEND_NUM_ARGS()) {
- case 0:
- id = php_msql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU);
- break;
- case 1:
- if (getParameters(ht, 1, &msql_link)==FAILURE) {
- RETURN_FALSE;
- }
- id = -1;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- ZEND_FETCH_RESOURCE2(msql, int, &msql_link, id, "mSQL-Link", msql_globals.le_link, msql_globals.le_plink);
-
- if ((msql_result=msqlListDBs(msql))==NULL) {
- php_error(E_WARNING,"Unable to save mSQL query result");
- RETURN_FALSE;
- }
- ZEND_REGISTER_RESOURCE(return_value, php_msql_query_wrapper(msql_result, 0), msql_globals.le_query);
-}
-/* }}} */
-
-/* {{{ proto int msql_list_tables(string database_name [, int link_identifier])
- List tables in an mSQL database */
-PHP_FUNCTION(msql_list_tables)
-{
- pval *db,*msql_link;
- int id;
- int msql;
- m_result *msql_result;
-
- switch(ZEND_NUM_ARGS()) {
- case 1:
- if (getParameters(ht, 1, &db)==FAILURE) {
- RETURN_FALSE;
- }
- id = php_msql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU);
- break;
- case 2:
- if (getParameters(ht, 2, &db, &msql_link)==FAILURE) {
- RETURN_FALSE;
- }
- id = -1;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- ZEND_FETCH_RESOURCE2(msql, int, &msql_link, id, "mSQL-Link", msql_globals.le_link, msql_globals.le_plink);
-
- convert_to_string(db);
- if (msqlSelectDB(msql,db->value.str.val)==-1) {
- RETURN_FALSE;
- }
- if ((msql_result=msqlListTables(msql))==NULL) {
- php_error(E_WARNING,"Unable to save mSQL query result");
- RETURN_FALSE;
- }
- ZEND_REGISTER_RESOURCE(return_value, php_msql_query_wrapper(msql_result, 0), msql_globals.le_query);
-}
-/* }}} */
-
-/* {{{ proto int msql_list_fields(string database_name, string table_name [, int link_identifier])
- List mSQL result fields */
-PHP_FUNCTION(msql_list_fields)
-{
- pval *db,*table,*msql_link;
- int id;
- int msql;
- m_result *msql_result;
-
- switch(ZEND_NUM_ARGS()) {
- case 2:
- if (getParameters(ht, 2, &db, &table)==FAILURE) {
- RETURN_FALSE;
- }
- id = php_msql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU);
- break;
- case 3:
- if (getParameters(ht, 3, &db, &table, &msql_link)==FAILURE) {
- RETURN_FALSE;
- }
- id = -1;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- ZEND_FETCH_RESOURCE2(msql, int, &msql_link, id, "mSQL-Link", msql_globals.le_link, msql_globals.le_plink);
-
- convert_to_string(db);
- if (msqlSelectDB(msql,db->value.str.val)==-1) {
- RETURN_FALSE;
- }
- convert_to_string(table);
- if ((msql_result=msqlListFields(msql,table->value.str.val))==NULL) {
- php_error(E_WARNING,"Unable to save mSQL query result");
- RETURN_FALSE;
- }
- ZEND_REGISTER_RESOURCE(return_value, php_msql_query_wrapper(msql_result, 0), msql_globals.le_query);
-}
-/* }}} */
-
-/* {{{ proto string msql_error([int link_identifier])
- Returns the text of the error message from previous mSQL operation */
-PHP_FUNCTION(msql_error)
-{
- if (ZEND_NUM_ARGS()) {
- WRONG_PARAM_COUNT;
- }
- RETURN_STRING(msqlErrMsg,1);
-}
-/* }}} */
-
-/* {{{ proto int msql_result(int query, int row [, mixed field])
- Get result data */
-PHP_FUNCTION(msql_result)
-{
- pval *result, *row, *field=NULL;
- m_result *msql_result;
- m_query *msql_query;
- m_row sql_row;
- int field_offset=0;
- PLS_FETCH();
-
- switch (ZEND_NUM_ARGS()) {
- case 2:
- if (getParameters(ht, 2, &result, &row)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- case 3:
- if (getParameters(ht, 3, &result, &row, &field)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- MSQL_GET_QUERY(result);
-
- convert_to_long(row);
- if (row->value.lval<0 || row->value.lval>=msqlNumRows(msql_result)) {
- php_error(E_WARNING,"Unable to jump to row %d on mSQL query index %d",row->value.lval,result->value.lval);
- RETURN_FALSE;
- }
- msqlDataSeek(msql_result,row->value.lval);
- if ((sql_row=msqlFetchRow(msql_result))==NULL) { /* shouldn't happen? */
- RETURN_FALSE;
- }
-
- if (field) {
- switch(field->type) {
- case IS_STRING: {
- int i=0;
- m_field *tmp_field;
- char *table_name,*field_name,*tmp;
-
- if ((tmp=strchr(field->value.str.val,'.'))) {
- *tmp = 0;
- table_name = estrdup(field->value.str.val);
- field_name = estrdup(tmp+1);
- } else {
- table_name = NULL;
- field_name = estrndup(field->value.str.val,field->value.str.len);
- }
- msqlFieldSeek(msql_result,0);
- while ((tmp_field=msqlFetchField(msql_result))) {
- if ((!table_name || !strcasecmp(tmp_field->table,table_name)) && !strcasecmp(tmp_field->name,field_name)) {
- field_offset = i;
- break;
- }
- i++;
- }
- if (!tmp_field) { /* no match found */
- php_error(E_WARNING,"%s%s%s not found in mSQL query index %d",
- (table_name?table_name:""), (table_name?".":""), field_name, result->value.lval);
- efree(field_name);
- if (table_name) {
- efree(table_name);
- }
- RETURN_FALSE;
- }
- efree(field_name);
- if (table_name) {
- efree(table_name);
- }
- }
- break;
- default:
- convert_to_long(field);
- field_offset = field->value.lval;
- if (field_offset<0 || field_offset>=msqlNumFields(msql_result)) {
- php_error(E_WARNING,"Bad column offset specified");
- RETURN_FALSE;
- }
- break;
- }
- }
-
- if (sql_row[field_offset]) {
- if (PG(magic_quotes_runtime)) {
- return_value->value.str.val = php_addslashes(sql_row[field_offset],0,&return_value->value.str.len,0);
- } else {
- return_value->value.str.len = (sql_row[field_offset]?strlen(sql_row[field_offset]):0);
- return_value->value.str.val = (char *) safe_estrndup(sql_row[field_offset],return_value->value.str.len);
- }
- } else {
- var_reset(return_value);
- }
-
- return_value->type = IS_STRING;
-}
-/* }}} */
-
-/* {{{ proto int msql_num_rows(int query)
- Get number of rows in a result */
-PHP_FUNCTION(msql_num_rows)
-{
- pval *result;
- m_result *msql_result;
- m_query *msql_query;
-
- if (ZEND_NUM_ARGS()!=1 || getParameters(ht, 1, &result)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- MSQL_GET_QUERY(result);
- RETVAL_LONG(msql_result ? msqlNumRows(msql_result) : 0);
-}
-/* }}} */
-
-/* {{{ proto int msql_num_fields(int query)
- Get number of fields in a result */
-PHP_FUNCTION(msql_num_fields)
-{
- pval *result;
- m_result *msql_result;
- m_query *msql_query;
-
- if (ZEND_NUM_ARGS()!=1 || getParameters(ht, 1, &result)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- MSQL_GET_QUERY(result);
- RETVAL_LONG(msql_result ? msqlNumFields(msql_result) : 0);
-}
-/* }}} */
-
-/* {{{ php_msql_fetch_hash
- */
-static void php_msql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, int result_type)
-{
- pval *result, *arg2;
- m_result *msql_result;
- m_row msql_row;
- m_field *msql_field;
- m_query *msql_query;
- int num_fields;
- int i;
- PLS_FETCH();
-
- switch (ZEND_NUM_ARGS()) {
- case 1:
- if (getParameters(ht, 1, &result)==FAILURE) {
- RETURN_FALSE;
- }
- if (!result_type) {
- result_type = MSQL_BOTH;
- }
- break;
- case 2:
- if (getParameters(ht, 2, &result, &arg2)==FAILURE) {
- RETURN_FALSE;
- }
- convert_to_long(arg2);
- result_type = arg2->value.lval;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- MSQL_GET_QUERY(result);
- if (!msql_result || (msql_row=msqlFetchRow(msql_result))==NULL) {
- RETURN_FALSE;
- }
-
- num_fields = msqlNumFields(msql_result);
-
- if (array_init(return_value)==FAILURE) {
- RETURN_FALSE;
- }
-
- msqlFieldSeek(msql_result,0);
- for (msql_field=msqlFetchField(msql_result),i=0; msql_field; msql_field=msqlFetchField(msql_result),i++) {
- if (msql_row[i]) {
- char *data;
- int data_len;
- int should_copy;
-
- if (PG(magic_quotes_runtime)) {
- data = php_addslashes(msql_row[i], 0, &data_len, 0);
- should_copy = 0;
- } else {
- data = msql_row[i];
- data_len = strlen(data);
- should_copy = 1;
- }
-
- if (result_type & MSQL_NUM) {
- add_index_stringl(return_value, i, data, data_len, should_copy);
- should_copy = 1;
- }
-
- if (result_type & MSQL_ASSOC) {
- add_assoc_stringl(return_value, msql_field->name, data, data_len, should_copy);
- }
- } else {
- /*
- add_get_index_stringl(return_value, i, empty_string, 0, (void **) &pval_ptr, 1);
- */
- }
- }
-}
-/* }}} */
-
-/* {{{ proto array msql_fetch_row(int query)
- Get a result row as an enumerated array */
-PHP_FUNCTION(msql_fetch_row)
-{
- php_msql_fetch_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU, MSQL_NUM);
-}
-/* }}} */
-
-/* {{{ proto object msql_fetch_object(int query [, int result_type])
- Fetch a result row as an object */
-PHP_FUNCTION(msql_fetch_object)
-{
- php_msql_fetch_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
- if (return_value->type==IS_ARRAY) {
- return_value->type=IS_OBJECT;
- return_value->value.obj.properties = return_value->value.ht;
- return_value->value.obj.ce = &zend_standard_class_def;
- }
-}
-/* }}} */
-
-/* {{{ proto array msql_fetch_array(int query [, int result_type])
- Fetch a result row as an associative array */
-PHP_FUNCTION(msql_fetch_array)
-{
- php_msql_fetch_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-/* }}} */
-
-/* {{{ proto int msql_data_seek(int query, int row_number)
- Move internal result pointer */
-PHP_FUNCTION(msql_data_seek)
-{
- pval *result,*offset;
- m_result *msql_result;
- m_query *msql_query;
-
- if (ZEND_NUM_ARGS()!=2 || getParameters(ht, 2, &result, &offset)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- MSQL_GET_QUERY(result);
- convert_to_long(offset);
- if (!msql_result ||
- offset->value.lval<0 ||
- offset->value.lval>=msqlNumRows(msql_result)) {
- php_error(E_WARNING,"Offset %d is invalid for mSQL query index %d",offset->value.lval,result->value.lval);
- RETURN_FALSE;
- }
- msqlDataSeek(msql_result,offset->value.lval);
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ php_msql_get_field_name
- */
-static char *php_msql_get_field_name(int field_type)
-{
- switch (field_type) {
-#if MSQL1
- case INT_TYPE:
- return "int";
- break;
- case CHAR_TYPE:
- return "char";
- break;
- case REAL_TYPE:
- return "real";
- break;
- case IDENT_TYPE:
- return "ident";
- break;
- case NULL_TYPE:
- return "null";
- break;
-#else
- case INT_TYPE:
- case UINT_TYPE:
- case CHAR_TYPE:
- case TEXT_TYPE:
- case REAL_TYPE:
- case NULL_TYPE:
- case DATE_TYPE:
- case TIME_TYPE:
- case MONEY_TYPE:
- return msqlTypeNames[field_type];
- break;
-#endif
- default:
- return "unknown";
- break;
- }
-}
-/* }}} */
-
-/* {{{ proto object msql_fetch_field(int query [, int field_offset])
- Get column information from a result and return as an object */
-PHP_FUNCTION(msql_fetch_field)
-{
- pval *result, *field=NULL;
- m_result *msql_result;
- m_field *msql_field;
- m_query *msql_query;
-
- switch (ZEND_NUM_ARGS()) {
- case 1:
- if (getParameters(ht, 1, &result)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- case 2:
- if (getParameters(ht, 2, &result, &field)==FAILURE) {
- RETURN_FALSE;
- }
- convert_to_long(field);
- default:
- WRONG_PARAM_COUNT;
- }
-
- MSQL_GET_QUERY(result);
-
- if (field) {
- if (field->value.lval<0 || field->value.lval>=msqlNumRows(msql_result)) {
- php_error(E_NOTICE,"mSQL: Bad field offset specified");
- RETURN_FALSE;
- }
- msqlFieldSeek(msql_result,field->value.lval);
- }
- if (!msql_result || (msql_field=msqlFetchField(msql_result))==NULL) {
- RETURN_FALSE;
- }
- if (object_init(return_value)==FAILURE) {
- RETURN_FALSE;
- }
-
- add_property_string(return_value, "name",(msql_field->name?msql_field->name:empty_string), 1);
- add_property_string(return_value, "table",(msql_field->table?msql_field->table:empty_string), 1);
- add_property_long(return_value, "not_null",IS_NOT_NULL(msql_field->flags));
-#if MSQL1
- add_property_long(return_value, "primary_key",(msql_field->flags&PRI_KEY_FLAG?1:0));
-#else
- add_property_long(return_value, "unique",(msql_field->flags&UNIQUE_FLAG?1:0));
-#endif
-
- add_property_string(return_value, "type",php_msql_get_field_name(msql_field->type), 1);
-}
-/* }}} */
-
-/* {{{ proto int msql_field_seek(int query, int field_offset)
- Set result pointer to a specific field offset */
-PHP_FUNCTION(msql_field_seek)
-{
- pval *result, *offset;
- m_result *msql_result;
- m_query *msql_query;
-
- if (ZEND_NUM_ARGS()!=2 || getParameters(ht, 2, &result, &offset)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- MSQL_GET_QUERY(result);
- convert_to_long(offset);
- if(!msql_result) {
- RETURN_FALSE;
- }
- if (offset->value.lval<0 || offset->value.lval>=msqlNumFields(msql_result)) {
- php_error(E_WARNING,"Field %d is invalid for mSQL query index %d",
- offset->value.lval,result->value.lval);
- RETURN_FALSE;
- }
- msqlFieldSeek(msql_result,offset->value.lval);
- RETURN_TRUE;
-}
-/* }}} */
-
-#define PHP_MSQL_FIELD_NAME 1
-#define PHP_MSQL_FIELD_TABLE 2
-#define PHP_MSQL_FIELD_LEN 3
-#define PHP_MSQL_FIELD_TYPE 4
-#define PHP_MSQL_FIELD_FLAGS 5
-
-/* {{{ php_msql_field_info
- */
-static void php_msql_field_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type)
-{
- pval *result, *field;
- m_result *msql_result;
- m_field *msql_field;
- m_query *msql_query;
-
- if (ZEND_NUM_ARGS()!=2 || getParameters(ht, 2, &result, &field)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- MSQL_GET_QUERY(result);
- if(!msql_result) {
- RETURN_FALSE;
- }
- convert_to_long(field);
- if (field->value.lval<0 || field->value.lval>=msqlNumFields(msql_result)) {
- php_error(E_WARNING,"Field %d is invalid for mSQL query index %d",field->value.lval,result->value.lval);
- RETURN_FALSE;
- }
- msqlFieldSeek(msql_result,field->value.lval);
- if ((msql_field=msqlFetchField(msql_result))==NULL) {
- RETURN_FALSE;
- }
-
- switch (entry_type) {
- case PHP_MSQL_FIELD_NAME:
- return_value->value.str.len = strlen(msql_field->name);
- return_value->value.str.val = estrndup(msql_field->name,return_value->value.str.len);
- return_value->type = IS_STRING;
- break;
- case PHP_MSQL_FIELD_TABLE:
- return_value->value.str.len = strlen(msql_field->table);
- return_value->value.str.val = estrndup(msql_field->table,return_value->value.str.len);
- return_value->type = IS_STRING;
- break;
- case PHP_MSQL_FIELD_LEN:
- return_value->value.lval = msql_field->length;
- return_value->type = IS_LONG;
- break;
- case PHP_MSQL_FIELD_TYPE:
- return_value->value.str.val = estrdup(php_msql_get_field_name(msql_field->type));
- return_value->value.str.len = strlen(return_value->value.str.val);
- return_value->type = IS_STRING;
- break;
- case PHP_MSQL_FIELD_FLAGS:
-#if MSQL1
- if ((msql_field->flags&NOT_NULL_FLAG) && (msql_field->flags&PRI_KEY_FLAG)) {
- return_value->value.str.val = estrndup("primary key not null",20);
- return_value->value.str.len = 20;
- return_value->type = IS_STRING;
- } else if (msql_field->flags&NOT_NULL_FLAG) {
- return_value->value.str.val = estrndup("not null",8);
- return_value->value.str.len = 8;
- return_value->type = IS_STRING;
- } else if (msql_field->flags&PRI_KEY_FLAG) {
- return_value->value.str.val = estrndup("primary key",11);
- return_value->value.str.len = 11;
- return_value->type = IS_STRING;
- } else {
- var_reset(return_value);
- }
-#else
- if ((msql_field->flags&NOT_NULL_FLAG) && (msql_field->flags&UNIQUE_FLAG)) {
- return_value->value.str.val = estrndup("unique not null",15);
- return_value->value.str.len = 15;
- return_value->type = IS_STRING;
- } else if (msql_field->flags&NOT_NULL_FLAG) {
- return_value->value.str.val = estrndup("not null",8);
- return_value->value.str.len = 8;
- return_value->type = IS_STRING;
- } else if (msql_field->flags&UNIQUE_FLAG) {
- return_value->value.str.val = estrndup("unique",6);
- return_value->value.str.len = 6;
- return_value->type = IS_STRING;
- } else {
- var_reset(return_value);
- }
-#endif
- break;
- default:
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto string msql_field_name(int query, int field_index)
- Get the name of the specified field in a result */
-PHP_FUNCTION(msql_field_name)
-{
- php_msql_field_info(INTERNAL_FUNCTION_PARAM_PASSTHRU,PHP_MSQL_FIELD_NAME);
-}
-/* }}} */
-
-/* {{{ proto string msql_field_table(int query, int field_offset)
- Get name of the table the specified field is in */
-PHP_FUNCTION(msql_field_table)
-{
- php_msql_field_info(INTERNAL_FUNCTION_PARAM_PASSTHRU,PHP_MSQL_FIELD_TABLE);
-}
-/* }}} */
-
-/* {{{ proto int msql_field_len(int query, int field_offet)
- Returns the length of the specified field */
-PHP_FUNCTION(msql_field_len)
-{
- php_msql_field_info(INTERNAL_FUNCTION_PARAM_PASSTHRU,PHP_MSQL_FIELD_LEN);
-}
-/* }}} */
-
-/* {{{ proto string msql_field_type(int query, int field_offset)
- Get the type of the specified field in a result */
-PHP_FUNCTION(msql_field_type)
-{
- php_msql_field_info(INTERNAL_FUNCTION_PARAM_PASSTHRU,PHP_MSQL_FIELD_TYPE);
-}
-/* }}} */
-
-/* {{{ proto string msql_field_flags(int query, int field_offset)
- Get the flags associated with the specified field in a result */
-PHP_FUNCTION(msql_field_flags)
-{
- php_msql_field_info(INTERNAL_FUNCTION_PARAM_PASSTHRU,PHP_MSQL_FIELD_FLAGS);
-}
-/* }}} */
-
-/* {{{ proto int msql_free_result(int query)
- Free result memory */
-PHP_FUNCTION(msql_free_result)
-{
- pval *result;
- m_result *msql_result;
- m_query *msql_query;
-
- if (ZEND_NUM_ARGS()!=1 || getParameters(ht, 1, &result)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- MSQL_GET_QUERY(result);
- zend_list_delete(result->value.lval);
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int msql_affected_rows(int query)
- Return number of affected rows */
-PHP_FUNCTION(msql_affected_rows)
-{
- pval *result;
- m_result *msql_result;
- m_query *msql_query;
-
- if(ZEND_NUM_ARGS() != 1 || getParameters(ht, 1, &result) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- MSQL_GET_QUERY(result);
- RETVAL_LONG(msql_query->af_rows);
-}
-/* }}} */
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/msql/php_msql.h b/ext/msql/php_msql.h
deleted file mode 100644
index 098822f1a8..0000000000
--- a/ext/msql/php_msql.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef PHP_MSQL_H
-#define PHP_MSQL_H
-
-#if HAVE_MSQL
-
-extern zend_module_entry msql_module_entry;
-#define msql_module_ptr &msql_module_entry
-
-/* mSQL functions */
-PHP_MINIT_FUNCTION(msql);
-PHP_RINIT_FUNCTION(msql);
-PHP_MSHUTDOWN_FUNCTION(msql);
-PHP_MINFO_FUNCTION(msql);
-
-PHP_FUNCTION(msql_connect);
-PHP_FUNCTION(msql_pconnect);
-PHP_FUNCTION(msql_close);
-PHP_FUNCTION(msql_select_db);
-PHP_FUNCTION(msql_create_db);
-PHP_FUNCTION(msql_drop_db);
-PHP_FUNCTION(msql_list_dbs);
-PHP_FUNCTION(msql_list_tables);
-PHP_FUNCTION(msql_list_fields);
-PHP_FUNCTION(msql_error);
-PHP_FUNCTION(msql_affected_rows);
-PHP_FUNCTION(msql_query);
-PHP_FUNCTION(msql_db_query);
-PHP_FUNCTION(msql_result);
-PHP_FUNCTION(msql_num_rows);
-PHP_FUNCTION(msql_num_fields);
-PHP_FUNCTION(msql_fetch_row);
-PHP_FUNCTION(msql_data_seek);
-PHP_FUNCTION(msql_fetch_field);
-PHP_FUNCTION(msql_field_seek);
-PHP_FUNCTION(msql_free_result);
-PHP_FUNCTION(msql_field_name);
-PHP_FUNCTION(msql_field_table);
-PHP_FUNCTION(msql_field_len);
-PHP_FUNCTION(msql_field_type);
-PHP_FUNCTION(msql_field_flags);
-PHP_FUNCTION(msql_fetch_array);
-PHP_FUNCTION(msql_fetch_object);
-
-typedef struct {
- long default_link;
- long num_links,num_persistent;
- long max_links,max_persistent;
- long allow_persistent;
- int le_query;
- int le_link;
- int le_plink;
-} php_msql_globals;
-
-#else
-
-#define msql_module_ptr NULL
-
-#endif
-
-#define phpext_msql_ptr msql_module_ptr
-
-#endif /* PHP_MSQL_H */
diff --git a/ext/msql/setup.stub b/ext/msql/setup.stub
deleted file mode 100644
index cced055d90..0000000000
--- a/ext/msql/setup.stub
+++ /dev/null
@@ -1,11 +0,0 @@
-# $Source$
-# $Id$
-
-define_option with-msql 'mSQL support?' yesnodir \
- 'no /usr/local/Hughes mSQL install' \
-' Whether to build PHP with mSQL support. PHP supports both mSQL 1.0 and\n
- mSQL 2.0. However, if you build PHP with mSQL 1.0 libraries, you will\n
- only be able to access mSQL 1.0 databases, ditto for mSQL 2.0.\n
- More info about mSQL can be found at http://www.hughes.com.au/.'
-
-
diff --git a/ext/mssql/CREDITS b/ext/mssql/CREDITS
deleted file mode 100644
index 548684afca..0000000000
--- a/ext/mssql/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-MS SQL
-Frank M. Kromann
diff --git a/ext/mssql/mssql.dsp b/ext/mssql/mssql.dsp
deleted file mode 100644
index ea79d3ba4e..0000000000
--- a/ext/mssql/mssql.dsp
+++ /dev/null
@@ -1,117 +0,0 @@
-# Microsoft Developer Studio Project File - Name="mssql" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=mssql - Win32 Release_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "mssql.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "mssql.mak" CFG="mssql - Win32 MSSQL 70 Debug_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "mssql - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "mssql - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "mssql - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D MSSQL70=1 /D ZEND_DEBUG=0 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MSSQL_EXPORTS" /D "COMPILE_DL_MSSQL" /D "DBNTWIN32" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_MSSQL=1 /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D MSSQL70=1 /D ZEND_DEBUG=0 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MSSQL_EXPORTS" /D "COMPILE_DL_MSSQL" /D "DBNTWIN32" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_MSSQL=1 /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x406 /d "NDEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib ntwdblib.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_mssql70.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\..\php_build\mssql-70\lib" /libpath:"..\..\Release_TS_Inline"
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib ntwdblib.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_mssql.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\..\php_build\mssql-70\lib" /libpath:"..\..\Release_TS_Inline"
-
-!ELSEIF "$(CFG)" == "mssql - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MDd /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D MSSQL70=1 /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MSSQL_EXPORTS" /D "COMPILE_DL_MSSQL" /D "DBNTWIN32" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_MSSQL=1 /YX /FD /c
-# ADD CPP /nologo /MDd /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D MSSQL70=1 /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MSSQL_EXPORTS" /D "COMPILE_DL_MSSQL" /D "DBNTWIN32" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_MSSQL=1 /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x406 /d "NDEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts_debug.lib ntwdblib.lib /nologo /dll /machine:I386 /out:"..\..\Debug_TS/php_mssql70.dll" /libpath:"..\..\Debug_TS" /libpath:"..\..\..\php_build\mssql-70\lib"
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts_debug.lib ntwdblib.lib /nologo /dll /machine:I386 /out:"..\..\Debug_TS/php_mssql.dll" /libpath:"..\..\Debug_TS" /libpath:"..\..\..\php_build\mssql-70\lib"
-
-!ENDIF
-
-# Begin Target
-
-# Name "mssql - Win32 Release_TS"
-# Name "mssql - Win32 Debug_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\php_mssql.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_mssql.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# Begin Source File
-
-SOURCE=.\mssql_win32_howto.txt
-# End Source File
-# End Target
-# End Project
diff --git a/ext/mssql/mssql_win32_howto.txt b/ext/mssql/mssql_win32_howto.txt
deleted file mode 100644
index 901099fb64..0000000000
--- a/ext/mssql/mssql_win32_howto.txt
+++ /dev/null
@@ -1,35 +0,0 @@
-Rules for building MSSQL
-------------------------
-
-The MSSQL project contains 2 configurations.
-
-The files needed for each configurations are:
-
-Win32 Release_TS
-Win32 Debug_TS
-
- php_build\mssql-70\include\sqldb.h
- php_build\mssql-70\include\sqlfront.h
- php_build\mssql-70\lib\ntwdblib.lib
-
-php_build is a directory at the same level as php4.
-
-Start Visual Studio, load php_modules.dsw, select the MSSQL projects,
-configuration and build it.
-
-This module requires ntwdblib.dll and one or more of the following dll's
-
-dbmsadsn.dll
-dbmsrpcn.dll
-dbmsshrn.dll
-dbmssocn.dll for tcp/ip connections
-dbmsspxn.dll for ipx/spx connections
-dbmsvinn.dll
-dbnmpntw.dll for netbios connections
-
-All these files are installed while installing MS SQL Server. If the SQL Server
-is installed on another maschine you need to install the client tools on
-the web server as well.
-
-
- \ No newline at end of file
diff --git a/ext/mssql/php_mssql.c b/ext/mssql/php_mssql.c
deleted file mode 100644
index 68cd61fe4d..0000000000
--- a/ext/mssql/php_mssql.c
+++ /dev/null
@@ -1,2128 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Frank M. Kromann frank@frontbase.com> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifdef COMPILE_DL_MSSQL
-#define HAVE_MSSQL 1
-#endif
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "php_globals.h"
-#include "ext/standard/php_standard.h"
-#include "ext/standard/info.h"
-#include "php_mssql.h"
-#include "php_ini.h"
-
-#if HAVE_MSSQL
-#define SAFE_STRING(s) ((s)?(s):"")
-
-#define MSSQL_ASSOC 1<<0
-#define MSSQL_NUM 1<<1
-#define MSSQL_BOTH (MSSQL_ASSOC|MSSQL_NUM)
-
-static int le_result, le_link, le_plink, le_statement;
-
-static void php_mssql_get_column_content_with_type(mssql_link *mssql_ptr,int offset,zval *result, int column_type);
-static void php_mssql_get_column_content_without_type(mssql_link *mssql_ptr,int offset,zval *result, int column_type);
-
-static void _mssql_bind_hash_dtor(void *data);
-static unsigned char a3_arg_force_ref[] = { 3, BYREF_NONE, BYREF_NONE, BYREF_FORCE };
-
-function_entry mssql_functions[] = {
- PHP_FE(mssql_connect, NULL)
- PHP_FE(mssql_pconnect, NULL)
- PHP_FE(mssql_close, NULL)
- PHP_FE(mssql_select_db, NULL)
- PHP_FE(mssql_query, NULL)
- PHP_FE(mssql_fetch_batch, NULL)
- PHP_FE(mssql_rows_affected, NULL)
- PHP_FE(mssql_free_result, NULL)
- PHP_FE(mssql_get_last_message, NULL)
- PHP_FE(mssql_num_rows, NULL)
- PHP_FE(mssql_num_fields, NULL)
- PHP_FE(mssql_fetch_field, NULL)
- PHP_FE(mssql_fetch_row, NULL)
- PHP_FE(mssql_fetch_array, NULL)
- PHP_FE(mssql_fetch_object, NULL)
- PHP_FE(mssql_field_length, NULL)
- PHP_FE(mssql_field_name, NULL)
- PHP_FE(mssql_field_type, NULL)
- PHP_FE(mssql_data_seek, NULL)
- PHP_FE(mssql_field_seek, NULL)
- PHP_FE(mssql_result, NULL)
- PHP_FE(mssql_next_result, NULL)
- PHP_FE(mssql_min_error_severity, NULL)
- PHP_FE(mssql_min_message_severity, NULL)
- PHP_FE(mssql_init, NULL)
- PHP_FE(mssql_bind, a3_arg_force_ref)
- PHP_FE(mssql_execute, NULL)
- {NULL, NULL, NULL}
-};
-
-zend_module_entry mssql_module_entry =
-{
- "mssql",
- mssql_functions,
- PHP_MINIT(mssql),
- PHP_MSHUTDOWN(mssql),
- PHP_RINIT(mssql),
- PHP_RSHUTDOWN(mssql),
- PHP_MINFO(mssql),
- STANDARD_MODULE_PROPERTIES
-};
-
-ZEND_DECLARE_MODULE_GLOBALS(mssql)
-
-#ifdef COMPILE_DL_MSSQL
-ZEND_GET_MODULE(mssql)
-#endif
-
-#define CHECK_LINK(link) { if (link==-1) { php_error(E_WARNING,"MS SQL: A link to the server could not be established"); RETURN_FALSE; } }
-
-static PHP_INI_DISP(display_text_size)
-{
- char *value;
-
- if (type == PHP_INI_DISPLAY_ORIG && ini_entry->modified) {
- value = ini_entry->orig_value;
- } else if (ini_entry->value) {
- value = ini_entry->value;
- } else {
- value = NULL;
- }
-
- if (atoi(value) == -1) {
- PUTS("Server default");
- } else {
- php_printf("%s", value);
- }
-}
-
-PHP_INI_BEGIN()
- STD_PHP_INI_BOOLEAN("mssql.allow_persistent", "1", PHP_INI_SYSTEM, OnUpdateBool, allow_persistent, zend_mssql_globals, mssql_globals)
- STD_PHP_INI_ENTRY_EX("mssql.max_persistent", "-1", PHP_INI_SYSTEM, OnUpdateInt, max_persistent, zend_mssql_globals, mssql_globals, display_link_numbers)
- STD_PHP_INI_ENTRY_EX("mssql.max_links", "-1", PHP_INI_SYSTEM, OnUpdateInt, max_links, zend_mssql_globals, mssql_globals, display_link_numbers)
- STD_PHP_INI_ENTRY_EX("mssql.min_error_severity", "10", PHP_INI_ALL, OnUpdateInt, cfg_min_error_severity, zend_mssql_globals, mssql_globals, display_link_numbers)
- STD_PHP_INI_ENTRY_EX("mssql.min_message_severity", "10", PHP_INI_ALL, OnUpdateInt, cfg_min_message_severity, zend_mssql_globals, mssql_globals, display_link_numbers)
- STD_PHP_INI_BOOLEAN("mssql.compatability_mode", "0", PHP_INI_ALL, OnUpdateBool, compatability_mode, zend_mssql_globals, mssql_globals)
- STD_PHP_INI_ENTRY_EX("mssql.connect_timeout", "5", PHP_INI_ALL, OnUpdateInt, connect_timeout, zend_mssql_globals, mssql_globals, display_link_numbers)
- STD_PHP_INI_ENTRY_EX("mssql.timeout", "60", PHP_INI_ALL, OnUpdateInt, timeout, zend_mssql_globals, mssql_globals, display_link_numbers)
- STD_PHP_INI_ENTRY_EX("mssql.textsize", "-1", PHP_INI_ALL, OnUpdateInt, textsize, zend_mssql_globals, mssql_globals, display_text_size)
- STD_PHP_INI_ENTRY_EX("mssql.textlimit", "-1", PHP_INI_ALL, OnUpdateInt, textlimit, zend_mssql_globals, mssql_globals, display_text_size)
- STD_PHP_INI_ENTRY_EX("mssql.batchsize", "0", PHP_INI_ALL, OnUpdateInt, batchsize, zend_mssql_globals, mssql_globals, display_link_numbers)
-PHP_INI_END()
-
-/* error handler */
-static int php_mssql_error_handler(DBPROCESS *dbproc, int severity, int dberr, int oserr, char *dberrstr, char *oserrstr)
-{
- MSSQLLS_FETCH();
- if (severity >= MS_SQL_G(min_error_severity)) {
- php_error(E_WARNING,"MS SQL error: %s (severity %d)", dberrstr, severity);
- }
- return INT_CANCEL;
-}
-
-/* message handler */
-static int php_mssql_message_handler(DBPROCESS *dbproc, DBINT msgno,int msgstate, int severity,char *msgtext,char *srvname, char *procname,DBUSMALLINT line)
-{
- MSSQLLS_FETCH();
- if (severity >= MS_SQL_G(min_message_severity)) {
- php_error(E_WARNING,"MS SQL message: %s (severity %d)", msgtext, severity);
- }
- STR_FREE(MS_SQL_G(server_message));
- MS_SQL_G(server_message) = estrdup(msgtext);
- return 0;
-}
-
-static int _clean_invalid_results(list_entry *le)
-{
- MSSQLLS_FETCH();
- if (le->type == le_result) {
- mssql_link *mssql_ptr = ((mssql_result *) le->ptr)->mssql_ptr;
-
- if (!mssql_ptr->valid) {
- return 1;
- }
- }
- return 0;
-}
-
-static void _free_result(mssql_result *result, int free_fields)
-{
- int i,j;
-
- if (result->data) {
- for (i=0; i<result->num_rows; i++) {
- if (result->data[i]) {
- for (j=0; j<result->num_fields; j++) {
- zval_dtor(&result->data[i][j]);
- }
- efree(result->data[i]);
- }
- }
- efree(result->data);
- result->data = NULL;
- result->blocks_initialized = 0;
- }
-
- if (free_fields && result->fields) {
- for (i=0; i<result->num_fields; i++) {
- STR_FREE(result->fields[i].name);
- STR_FREE(result->fields[i].column_source);
- }
- efree(result->fields);
- }
-}
-
-static void _free_mssql_statement(mssql_statement *statement)
-{
- if (statement->binds) {
- zend_hash_destroy(statement->binds);
- efree(statement->binds);
- }
-
- efree(statement);
-}
-
-static void _free_mssql_result(zend_rsrc_list_entry *rsrc)
-{
- mssql_result *result = (mssql_result *)rsrc->ptr;
- _free_result(result, 1);
- efree(result);
-}
-
-static void php_mssql_set_default_link(int id)
-{
- MSSQLLS_FETCH();
-
- if (MS_SQL_G(default_link)!=-1) {
- zend_list_delete(MS_SQL_G(default_link));
- }
- MS_SQL_G(default_link) = id;
- zend_list_addref(id);
-}
-
-static void _close_mssql_link(zend_rsrc_list_entry *rsrc)
-{
- mssql_link *mssql_ptr = (mssql_link *)rsrc->ptr;
- MSSQLLS_FETCH();
- ELS_FETCH();
-
- mssql_ptr->valid = 0;
- zend_hash_apply(&EG(regular_list),(int (*)(void *))_clean_invalid_results);
- dbclose(mssql_ptr->link);
- dbfreelogin(mssql_ptr->login);
- efree(mssql_ptr);
- MS_SQL_G(num_links)--;
-}
-
-
-static void _close_mssql_plink(zend_rsrc_list_entry *rsrc)
-{
- mssql_link *mssql_ptr = (mssql_link *)rsrc->ptr;
- MSSQLLS_FETCH();
-
- dbclose(mssql_ptr->link);
- dbfreelogin(mssql_ptr->login);
- free(mssql_ptr);
- MS_SQL_G(num_persistent)--;
- MS_SQL_G(num_links)--;
-}
-
-static mssql_statement* _mssql_get_statement(zval **stmt)
-{
- mssql_statement *statement;
-
- statement = (mssql_statement *) zend_fetch_resource(stmt, -1, "MS SQL-Statement", NULL, 1, le_statement);
-
- if (statement) {
- return statement;
- } else {
- return (mssql_statement *) NULL;
- }
-}
-
-static void _mssql_bind_hash_dtor(void *data)
-{
- mssql_bind *bind= (mssql_bind *) data;
-
- zval_ptr_dtor(&(bind->zval));
-}
-
-static void php_mssql_init_globals(zend_mssql_globals *mssql_globals)
-{
- long compatability_mode;
-
- MS_SQL_G(num_persistent) = 0;
- if (cfg_get_long("mssql.compatability_mode", &compatability_mode) == SUCCESS) {
- if (compatability_mode) {
- MS_SQL_G(get_column_content) = php_mssql_get_column_content_without_type;
- } else {
- MS_SQL_G(get_column_content) = php_mssql_get_column_content_with_type;
- }
- }
-}
-
-PHP_MINIT_FUNCTION(mssql)
-{
- ZEND_INIT_MODULE_GLOBALS(mssql, php_mssql_init_globals, NULL);
-
- REGISTER_INI_ENTRIES();
-
- le_statement = register_list_destructors(_free_mssql_statement, NULL);
- le_result = zend_register_list_destructors_ex(_free_mssql_result, NULL, "mssql result", module_number);
- le_link = zend_register_list_destructors_ex(_close_mssql_link, NULL, "mssql link", module_number);
- le_plink = zend_register_list_destructors_ex(NULL, _close_mssql_plink, "mssql link persistent", module_number);
- mssql_module_entry.type = type;
-
- if (dbinit()==FAIL) {
- return FAILURE;
- }
-
- /* BEGIN MSSQL data types for mssql_bind */
- REGISTER_LONG_CONSTANT("MSSQL_ASSOC", MSSQL_ASSOC, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("MSSQL_NUM", MSSQL_NUM, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("MSSQL_BOTH", MSSQL_BOTH, CONST_CS | CONST_PERSISTENT);
-
- REGISTER_LONG_CONSTANT("SQLTEXT",SQLTEXT, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SQLVARCHAR",SQLVARCHAR, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SQLCHAR",SQLCHAR, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SQLINT1",SQLINT1, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SQLINT2",SQLINT2, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SQLINT4",SQLINT4, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SQLBIT",SQLBIT, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SQLFLT8",SQLFLT8, CONST_CS | CONST_PERSISTENT);
- /* END MSSQL data types for mssql_sp_bind */
-
- dberrhandle((DBERRHANDLE_PROC) php_mssql_error_handler);
- dbmsghandle((DBMSGHANDLE_PROC) php_mssql_message_handler);
-
- return SUCCESS;
-}
-
-PHP_MSHUTDOWN_FUNCTION(mssql)
-{
- UNREGISTER_INI_ENTRIES();
- dbexit();
- return SUCCESS;
-}
-
-PHP_RINIT_FUNCTION(mssql)
-{
- MSSQLLS_FETCH();
-
- MS_SQL_G(default_link) = -1;
- MS_SQL_G(num_links) = MS_SQL_G(num_persistent);
- MS_SQL_G(appname) = estrndup("PHP 4.0",7);
- MS_SQL_G(server_message) = empty_string;
- MS_SQL_G(min_error_severity) = MS_SQL_G(cfg_min_error_severity);
- MS_SQL_G(min_message_severity) = MS_SQL_G(cfg_min_message_severity);
- if (MS_SQL_G(connect_timeout) < 1) MS_SQL_G(connect_timeout) = 1;
- dbsetlogintime(MS_SQL_G(connect_timeout));
- if (MS_SQL_G(timeout) < 0) MS_SQL_G(timeout) = 60;
- dbsettime(MS_SQL_G(timeout));
-
- return SUCCESS;
-}
-
-PHP_RSHUTDOWN_FUNCTION(mssql)
-{
- MSSQLLS_FETCH();
-
- STR_FREE(MS_SQL_G(appname));
- if (MS_SQL_G(server_message)) {
- STR_FREE(MS_SQL_G(server_message));
- }
- return SUCCESS;
-}
-
-PHP_MINFO_FUNCTION(mssql)
-{
- char buf[32];
- MSSQLLS_FETCH();
-
- php_info_print_table_start();
- php_info_print_table_header(2, "MSSQL Support", "enabled");
-
- sprintf(buf, "%ld", MS_SQL_G(num_persistent));
- php_info_print_table_row(2, "Active Persistent Links", buf);
- sprintf(buf, "%ld", MS_SQL_G(num_links));
- php_info_print_table_row(2, "Active Links", buf);
-
- php_info_print_table_row(2, "Library version", MSSQL_VERSION);
- php_info_print_table_end();
-
- DISPLAY_INI_ENTRIES();
-
-}
-
-static void php_mssql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
-{
- char *user, *passwd, *host;
- char *hashed_details;
- int hashed_details_length;
- mssql_link mssql, *mssql_ptr;
- char buffer[32];
- MSSQLLS_FETCH();
-/* PLS_FETCH(); */
-
- switch(ZEND_NUM_ARGS()) {
- case 0: /* defaults */
- host=user=passwd=NULL;
- hashed_details_length=5+3;
- hashed_details = (char *) emalloc(hashed_details_length+1);
- strcpy(hashed_details,"mssql___");
- break;
- case 1: {
- zval **yyhost;
-
- if (zend_get_parameters_ex(1, &yyhost)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(yyhost);
- host = (*yyhost)->value.str.val;
- user=passwd=NULL;
- hashed_details_length = (*yyhost)->value.str.len+5+3;
- hashed_details = (char *) emalloc(hashed_details_length+1);
- sprintf(hashed_details,"mssql_%s__",(*yyhost)->value.str.val);
- }
- break;
- case 2: {
- zval **yyhost,**yyuser;
-
- if (zend_get_parameters_ex(2, &yyhost, &yyuser)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(yyhost);
- convert_to_string_ex(yyuser);
- host = (*yyhost)->value.str.val;
- user = (*yyuser)->value.str.val;
- passwd=NULL;
- hashed_details_length = (*yyhost)->value.str.len+(*yyuser)->value.str.len+5+3;
- hashed_details = (char *) emalloc(hashed_details_length+1);
- sprintf(hashed_details,"mssql_%s_%s_",(*yyhost)->value.str.val,(*yyuser)->value.str.val);
- }
- break;
- case 3: {
- zval **yyhost,**yyuser,**yypasswd;
-
- if (zend_get_parameters_ex(3, &yyhost, &yyuser, &yypasswd) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(yyhost);
- convert_to_string_ex(yyuser);
- convert_to_string_ex(yypasswd);
- host = (*yyhost)->value.str.val;
- user = (*yyuser)->value.str.val;
- passwd = (*yypasswd)->value.str.val;
- hashed_details_length = (*yyhost)->value.str.len+(*yyuser)->value.str.len+(*yypasswd)->value.str.len+5+3;
- hashed_details = (char *) emalloc(hashed_details_length+1);
- sprintf(hashed_details,"mssql_%s_%s_%s",(*yyhost)->value.str.val,(*yyuser)->value.str.val,(*yypasswd)->value.str.val); /* SAFE */
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- if (hashed_details == NULL) {
- php_error(E_WARNING, "Out of memory");
- RETURN_FALSE;
- }
-
- /* set a DBLOGIN record */
- if ((mssql.login = dblogin()) == NULL) {
- php_error(E_WARNING,"MS SQL: Unable to allocate login record");
- RETURN_FALSE;
- }
-
- if (user) {
- DBSETLUSER(mssql.login,user);
- }
- if (passwd) {
- DBSETLPWD(mssql.login,passwd);
- }
- DBSETLAPP(mssql.login,MS_SQL_G(appname));
- mssql.valid = 1;
-
- DBSETLVERSION(mssql.login, DBVER60);
-/* DBSETLTIME(mssql.login, TIMEOUT_INFINITE); */
-
- if (!MS_SQL_G(allow_persistent)) {
- persistent=0;
- }
- if (persistent) {
- list_entry *le;
-
- /* try to find if we already have this link in our persistent list */
- if (zend_hash_find(&EG(persistent_list), hashed_details, hashed_details_length + 1, (void **) &le)==FAILURE) { /* we don't */
- list_entry new_le;
-
- if (MS_SQL_G(max_links) != -1 && MS_SQL_G(num_links) >= MS_SQL_G(max_links)) {
- php_error(E_WARNING,"MS SQL: Too many open links (%d)",MS_SQL_G(num_links));
- efree(hashed_details);
- dbfreelogin(mssql.login);
- RETURN_FALSE;
- }
- if (MS_SQL_G(max_persistent) != -1 && MS_SQL_G(num_persistent) >= MS_SQL_G(max_persistent)) {
- php_error(E_WARNING,"MS SQL: Too many open persistent links (%d)",MS_SQL_G(num_persistent));
- efree(hashed_details);
- dbfreelogin(mssql.login);
- RETURN_FALSE;
- }
- /* create the link */
- if ((mssql.link = dbopen(mssql.login, host)) == FAIL) {
- php_error(E_WARNING,"MS SQL: Unable to connect to server: %s", host);
- efree(hashed_details);
- dbfreelogin(mssql.login);
- RETURN_FALSE;
- }
-
- if (dbsetopt(mssql.link, DBBUFFER, "2")==FAIL) {
- efree(hashed_details);
- dbfreelogin(mssql.login);
- dbclose(mssql.link);
- RETURN_FALSE;
- }
-
- if (MS_SQL_G(textlimit) != -1) {
- sprintf(buffer, "%li", MS_SQL_G(textlimit));
- if (dbsetopt(mssql.link, DBTEXTLIMIT, buffer)==FAIL) {
- efree(hashed_details);
- dbfreelogin(mssql.login);
- RETURN_FALSE;
- }
- }
- if (MS_SQL_G(textsize) != -1) {
- sprintf(buffer, "SET TEXTSIZE %li", MS_SQL_G(textsize));
- dbcmd(mssql.link, buffer);
- dbsqlexec(mssql.link);
- dbresults(mssql.link);
- }
-
- /* hash it up */
- mssql_ptr = (mssql_link *) malloc(sizeof(mssql_link));
- memcpy(mssql_ptr, &mssql, sizeof(mssql_link));
- new_le.type = le_plink;
- new_le.ptr = mssql_ptr;
- if (zend_hash_update(&EG(persistent_list), hashed_details, hashed_details_length + 1, &new_le, sizeof(list_entry), NULL)==FAILURE) {
- free(mssql_ptr);
- efree(hashed_details);
- dbfreelogin(mssql.login);
- RETURN_FALSE;
- }
- MS_SQL_G(num_persistent)++;
- MS_SQL_G(num_links)++;
- } else { /* we do */
- if (le->type != le_plink) {
-#if BROKEN_MSSQL_PCONNECTS
- log_error("PHP/MS SQL: Hashed persistent link is not a MS SQL link!",php_rqst->server);
-#endif
- php_error(E_WARNING,"MS SQL: Hashed persistent link is not a MS SQL link!");
- RETURN_FALSE;
- }
-
- mssql_ptr = (mssql_link *) le->ptr;
- /* test that the link hasn't died */
- if (DBDEAD(mssql_ptr->link) == TRUE) {
-#if BROKEN_MSSQL_PCONNECTS
- log_error("PHP/MS SQL: Persistent link died, trying to reconnect...",php_rqst->server);
-#endif
- if ((mssql_ptr->link=dbopen(mssql_ptr->login,host))==FAIL) {
-#if BROKEN_MSSQL_PCONNECTS
- log_error("PHP/MS SQL: Unable to reconnect!",php_rqst->server);
-#endif
- php_error(E_WARNING,"MS SQL: Link to server lost, unable to reconnect");
- zend_hash_del(&EG(persistent_list), hashed_details, hashed_details_length+1);
- efree(hashed_details);
- RETURN_FALSE;
- }
-#if BROKEN_MSSQL_PCONNECTS
- log_error("PHP/MS SQL: Reconnect successful!",php_rqst->server);
-#endif
- if (dbsetopt(mssql_ptr->link, DBBUFFER, "2")==FAIL) {
-#if BROKEN_MSSQL_PCONNECTS
- log_error("PHP/MS SQL: Unable to set required options",php_rqst->server);
-#endif
- zend_hash_del(&EG(persistent_list), hashed_details, hashed_details_length + 1);
- efree(hashed_details);
- RETURN_FALSE;
- }
- }
- }
- ZEND_REGISTER_RESOURCE(return_value, mssql_ptr, le_plink);
- } else { /* non persistent */
- list_entry *index_ptr, new_index_ptr;
-
- /* first we check the hash for the hashed_details key. if it exists,
- * it should point us to the right offset where the actual mssql link sits.
- * if it doesn't, open a new mssql link, add it to the resource list,
- * and add a pointer to it with hashed_details as the key.
- */
- if (zend_hash_find(&EG(regular_list), hashed_details, hashed_details_length + 1,(void **) &index_ptr)==SUCCESS) {
- int type,link;
- void *ptr;
-
- if (index_ptr->type != le_index_ptr) {
- RETURN_FALSE;
- }
- link = (int) index_ptr->ptr;
- ptr = zend_list_find(link,&type); /* check if the link is still there */
- if (ptr && (type==le_link || type==le_plink)) {
- zend_list_addref(link);
- return_value->value.lval = link;
- php_mssql_set_default_link(link);
- return_value->type = IS_RESOURCE;
- efree(hashed_details);
- return;
- } else {
- zend_hash_del(&EG(regular_list), hashed_details, hashed_details_length + 1);
- }
- }
- if (MS_SQL_G(max_links) != -1 && MS_SQL_G(num_links) >= MS_SQL_G(max_links)) {
- php_error(E_WARNING,"MS SQL: Too many open links (%d)",MS_SQL_G(num_links));
- efree(hashed_details);
- RETURN_FALSE;
- }
-
- if ((mssql.link=dbopen(mssql.login, host))==NULL) {
- php_error(E_WARNING,"MS SQL: Unable to connect to server: %s", host);
- efree(hashed_details);
- RETURN_FALSE;
- }
-
- if (dbsetopt(mssql.link, DBBUFFER,"2")==FAIL) {
- efree(hashed_details);
- dbfreelogin(mssql.login);
- dbclose(mssql.link);
- RETURN_FALSE;
- }
-
- if (MS_SQL_G(textlimit) != -1) {
- sprintf(buffer, "%li", MS_SQL_G(textlimit));
- if (dbsetopt(mssql.link, DBTEXTLIMIT, buffer)==FAIL) {
- efree(hashed_details);
- dbfreelogin(mssql.login);
- RETURN_FALSE;
- }
- }
- if (MS_SQL_G(textsize) != -1) {
- sprintf(buffer, "SET TEXTSIZE %li", MS_SQL_G(textsize));
- dbcmd(mssql.link, buffer);
- dbsqlexec(mssql.link);
- dbresults(mssql.link);
- }
-
- /* add it to the list */
- mssql_ptr = (mssql_link *) emalloc(sizeof(mssql_link));
- memcpy(mssql_ptr, &mssql, sizeof(mssql_link));
- ZEND_REGISTER_RESOURCE(return_value, mssql_ptr, le_link);
-
- /* add it to the hash */
- new_index_ptr.ptr = (void *) return_value->value.lval;
- new_index_ptr.type = le_index_ptr;
- if (zend_hash_update(&EG(regular_list), hashed_details, hashed_details_length + 1,(void *) &new_index_ptr, sizeof(list_entry),NULL)==FAILURE) {
- efree(hashed_details);
- RETURN_FALSE;
- }
- MS_SQL_G(num_links)++;
- }
- efree(hashed_details);
- php_mssql_set_default_link(return_value->value.lval);
-}
-
-
-static int php_mssql_get_default_link(INTERNAL_FUNCTION_PARAMETERS MSSQLLS_DC)
-{
- if (MS_SQL_G(default_link)==-1) { /* no link opened yet, implicitly open one */
- ht = 0;
- php_mssql_do_connect(INTERNAL_FUNCTION_PARAM_PASSTHRU,0);
- }
- return MS_SQL_G(default_link);
-}
-
-/* {{{ proto int mssql_connect([string servername [, string username [, string password]]])
- Establishes a connection to a MS-SQL server */
-PHP_FUNCTION(mssql_connect)
-{
- php_mssql_do_connect(INTERNAL_FUNCTION_PARAM_PASSTHRU,0);
-}
-
-/* }}} */
-
-/* {{{ proto int mssql_pconnect([string servername [, string username [, string password]]])
- Establishes a persistent connection to a MS-SQL server */
-PHP_FUNCTION(mssql_pconnect)
-{
- php_mssql_do_connect(INTERNAL_FUNCTION_PARAM_PASSTHRU,1);
-}
-
-/* }}} */
-
-/* {{{ proto int mssql_close([int connectionid])
- Closes a connection to a MS-SQL server */
-PHP_FUNCTION(mssql_close)
-{
- zval **mssql_link_index=NULL;
- int id;
- mssql_link *mssql_ptr;
- MSSQLLS_FETCH();
-
-
- switch (ZEND_NUM_ARGS()) {
- case 0:
- id = php_mssql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU MSSQLLS_CC);
- CHECK_LINK(id);
- break;
- case 1:
- if (zend_get_parameters_ex(1, &mssql_link_index)==FAILURE) {
- RETURN_FALSE;
- }
- id = -1;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- ZEND_FETCH_RESOURCE2(mssql_ptr, mssql_link *, mssql_link_index, id, "MS SQL-Link", le_link, le_plink);
-
- if (mssql_link_index)
- zend_list_delete((*mssql_link_index)->value.lval);
- else
- zend_list_delete(id);
-
- RETURN_TRUE;
-}
-
-/* }}} */
-
-/* {{{ proto bool mssql_select_db(string database_name [, int conn_id])
- Select a MS-SQL database */
-PHP_FUNCTION(mssql_select_db)
-{
- zval **db, **mssql_link_index;
- int id;
- mssql_link *mssql_ptr;
- MSSQLLS_FETCH();
-
-
- switch(ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &db)==FAILURE) {
- RETURN_FALSE;
- }
- id = php_mssql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU MSSQLLS_CC);
- CHECK_LINK(id);
- break;
- case 2:
- if (zend_get_parameters_ex(2, &db, &mssql_link_index)==FAILURE) {
- RETURN_FALSE;
- }
- id = -1;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- ZEND_FETCH_RESOURCE2(mssql_ptr, mssql_link *, mssql_link_index, id, "MS SQL-Link", le_link, le_plink);
-
- convert_to_string_ex(db);
-
- if (dbuse(mssql_ptr->link, (*db)->value.str.val)==FAIL) {
- php_error(E_WARNING,"MS SQL: Unable to select database: %s", (*db)->value.str.val);
- RETURN_FALSE;
- } else {
- RETURN_TRUE;
- }
-}
-
-/* }}} */
-
-static void php_mssql_get_column_content_with_type(mssql_link *mssql_ptr,int offset,zval *result, int column_type)
-{
- if (dbdatlen(mssql_ptr->link,offset) == 0) {
- ZVAL_NULL(result);
- return;
- }
-
- switch (column_type)
- {
- case SQLINT1:
- case SQLINT2:
- case SQLINT4:
- case SQLINTN: {
- result->value.lval = (long) anyintcol(offset);
- result->type = IS_LONG;
- break;
- }
- case SQLCHAR:
- case SQLVARCHAR:
- case SQLTEXT: {
- int length;
- char *data = charcol(offset);
-
- length=dbdatlen(mssql_ptr->link,offset);
- while (length>0 && data[length-1] == ' ') { /* nuke trailing whitespace */
- length--;
- }
- result->value.str.val = estrndup(data,length);
- result->value.str.len = length;
- result->type = IS_STRING;
- break;
- }
- case SQLFLT8: {
- result->value.dval = (double) floatcol(offset);
- result->type = IS_DOUBLE;
- break;
- }
- case SQLVARBINARY:
- case SQLBINARY:
- case SQLIMAGE: {
- DBBINARY *bin;
- unsigned char *res_buf;
- int res_length = dbdatlen(mssql_ptr->link, offset);
-
- res_buf = (unsigned char *) emalloc(res_length + 1);
- bin = ((DBBINARY *)dbdata(mssql_ptr->link, offset));
- memcpy(res_buf,bin,res_length);
- res_buf[res_length] = '\0';
- result->value.str.len = res_length;
- result->value.str.val = res_buf;
- result->type = IS_STRING;
- }
- break;
- case SQLNUMERIC:
- default: {
- if (dbwillconvert(column_type,SQLCHAR)) {
- char *res_buf;
- int res_length = dbdatlen(mssql_ptr->link,offset);
- if (column_type == SQLDATETIM4) res_length += 14;
- if (column_type == SQLDATETIME) res_length += 10;
-
- res_buf = (char *) emalloc(res_length + 1);
- res_length = dbconvert(NULL,column_type,dbdata(mssql_ptr->link,offset), res_length,SQLCHAR,res_buf,-1);
-
- result->value.str.val = res_buf;
- result->value.str.len = res_length;
- result->type = IS_STRING;
- } else {
- php_error(E_WARNING,"MS SQL: column %d has unknown data type (%d)", offset, coltype(offset));
- var_reset(result);
- }
- }
- }
-}
-
-static void php_mssql_get_column_content_without_type(mssql_link *mssql_ptr,int offset,zval *result, int column_type)
-{
- if (dbdatlen(mssql_ptr->link,offset) == 0) {
- ZVAL_NULL(result);
- return;
- }
-
- if (column_type == SQLVARBINARY ||
- column_type == SQLBINARY ||
- column_type == SQLIMAGE) {
- DBBINARY *bin;
- unsigned char *res_buf;
- int res_length = dbdatlen(mssql_ptr->link, offset);
-
- res_buf = (unsigned char *) emalloc(res_length + 1);
- bin = ((DBBINARY *)dbdata(mssql_ptr->link, offset));
- memcpy(res_buf, bin, res_length);
- res_buf[res_length] = '\0';
- result->value.str.len = res_length;
- result->value.str.val = res_buf;
- result->type = IS_STRING;
- }
- else if (dbwillconvert(coltype(offset),SQLCHAR)) {
- unsigned char *res_buf;
- int res_length = dbdatlen(mssql_ptr->link,offset);
- if (column_type == SQLDATETIM4) res_length += 14;
- if (column_type == SQLDATETIME) res_length += 10;
-
- res_buf = (unsigned char *) emalloc(res_length + 1);
- res_length = dbconvert(NULL,coltype(offset),dbdata(mssql_ptr->link,offset), res_length, SQLCHAR,res_buf,-1);
-
- result->value.str.val = res_buf;
- result->value.str.len = res_length;
- result->type = IS_STRING;
- } else {
- php_error(E_WARNING,"MS SQL: column %d has unknown data type (%d)", offset, coltype(offset));
- var_reset(result);
- }
-}
-
-int _mssql_fetch_batch(mssql_link *mssql_ptr, mssql_result *result, int retvalue)
-{
- int i, j = 0;
- int *column_types;
- char computed_buf[16];
- MSSQLLS_FETCH();
-
- column_types = (int *) emalloc(sizeof(int) * result->num_fields);
- for (i=0; i<result->num_fields; i++) {
- char *fname = (char *)dbcolname(mssql_ptr->link,i+1);
-
- if (*fname) {
- result->fields[i].name = estrdup(fname);
- } else {
- if (j>0) {
- snprintf(computed_buf,16,"computed%d",j);
- } else {
- strcpy(computed_buf,"computed");
- }
- result->fields[i].name = estrdup(computed_buf);
- j++;
- }
- result->fields[i].max_length = dbcollen(mssql_ptr->link,i+1);
- result->fields[i].column_source = estrdup(dbcolsource(mssql_ptr->link,i+1));
- if (!result->fields[i].column_source) {
- result->fields[i].column_source = empty_string;
- }
-
- column_types[i] = coltype(i+1);
-
- result->fields[i].type = column_types[i];
- /* set numeric flag */
- switch (column_types[i]) {
- case SQLINT1:
- case SQLINT2:
- case SQLINT4:
- case SQLINTN:
- case SQLFLT8:
- case SQLNUMERIC:
- case SQLDECIMAL:
- result->fields[i].numeric = 1;
- break;
- case SQLCHAR:
- case SQLVARCHAR:
- case SQLTEXT:
- default:
- result->fields[i].numeric = 0;
- break;
- }
- }
-
- i=0;
- if (!result->data) {
- result->data = (zval **) emalloc(sizeof(zval *)*MSSQL_ROWS_BLOCK*(++result->blocks_initialized));
- }
- while (retvalue!=FAIL && retvalue!=NO_MORE_ROWS) {
- result->num_rows++;
- if (result->num_rows > result->blocks_initialized*MSSQL_ROWS_BLOCK) {
- result->data = (zval **) erealloc(result->data,sizeof(zval *)*MSSQL_ROWS_BLOCK*(++result->blocks_initialized));
- }
- result->data[i] = (zval *) emalloc(sizeof(zval)*result->num_fields);
- for (j=0; j<result->num_fields; j++) {
- INIT_ZVAL(result->data[i][j]);
- MS_SQL_G(get_column_content(mssql_ptr, j+1, &result->data[i][j], column_types[j]));
- }
- if (i<result->batchsize || result->batchsize==0) {
- i++;
- dbclrbuf(mssql_ptr->link,DBLASTROW(mssql_ptr->link));
- retvalue=dbnextrow(mssql_ptr->link);
- }
- else
- break;
- result->lastresult = retvalue;
- }
- efree(column_types);
- return i;
-}
-
-/* {{{ proto int mssql_fetch_batch(string result_index)
- Returns the next batch of records */
-PHP_FUNCTION(mssql_fetch_batch) {
- zval **mssql_result_index;
- mssql_result *result;
- mssql_link *mssql_ptr;
- MSSQLLS_FETCH();
-
-
- if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &mssql_result_index)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if ((*mssql_result_index)->type==IS_RESOURCE && (*mssql_result_index)->value.lval==0) {
- RETURN_FALSE;
- }
-
- ZEND_FETCH_RESOURCE(result, mssql_result *, mssql_result_index, -1, "MS SQL-result", le_result);
- mssql_ptr = result->mssql_ptr;
- _free_result(result, 0);
- result->cur_row=result->num_rows=0;
- result->num_rows = _mssql_fetch_batch(mssql_ptr, result, result->lastresult);
- RETURN_LONG(result->num_rows);
-}
-/* }}} */
-
-/* {{{ proto int mssql_query(string query [, int conn_id [, int batch_size]])
- Perform an SQL query on a MS-SQL server database */
-PHP_FUNCTION(mssql_query)
-{
- zval **query, **mssql_link_index, **zbatchsize;
- int retvalue;
- mssql_link *mssql_ptr;
- mssql_result *result;
- int id, num_fields;
- int batchsize;
- MSSQLLS_FETCH();
-
- batchsize = MS_SQL_G(batchsize);
- switch(ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &query)==FAILURE) {
- RETURN_FALSE;
- }
- id = php_mssql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU MSSQLLS_CC);
- CHECK_LINK(id);
- break;
- case 2:
- if (zend_get_parameters_ex(2, &query, &mssql_link_index)==FAILURE) {
- RETURN_FALSE;
- }
- id = -1;
- break;
- case 3:
- if (zend_get_parameters_ex(3, &query, &mssql_link_index, &zbatchsize)==FAILURE) {
- RETURN_FALSE;
- }
- id = -1;
- convert_to_long_ex(zbatchsize);
- batchsize = (*zbatchsize)->value.lval;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- ZEND_FETCH_RESOURCE2(mssql_ptr, mssql_link *, mssql_link_index, id, "MS SQL-Link", le_link, le_plink);
-
- convert_to_string_ex(query);
-
- if (dbcmd(mssql_ptr->link, (*query)->value.str.val)==FAIL) {
- php_error(E_WARNING,"MS SQL: Unable to set query");
- RETURN_FALSE;
- }
- if (dbsqlexec(mssql_ptr->link)==FAIL || dbresults(mssql_ptr->link)==FAIL) {
- php_error(E_WARNING,"MS SQL: Query failed");
- RETURN_FALSE;
- }
-
- /* The following is more or less the equivalent of mysql_store_result().
- * fetch all rows from the server into the row buffer, thus:
- * 1) Being able to fire up another query without explicitly reading all rows
- * 2) Having numrows accessible
- */
- retvalue=dbnextrow(mssql_ptr->link);
-
- if (retvalue==FAIL) {
- RETURN_FALSE;
- }
-
- if ((num_fields = dbnumcols(mssql_ptr->link)) <= 0) {
- RETURN_TRUE;
- }
-
- result = (mssql_result *) emalloc(sizeof(mssql_result));
- result->num_fields = num_fields;
- result->blocks_initialized = 1;
-
- result->batchsize = batchsize;
- result->data = NULL;
- result->blocks_initialized = 0;
- result->mssql_ptr = mssql_ptr;
- result->cur_field=result->cur_row=result->num_rows=0;
-
- result->fields = (mssql_field *) emalloc(sizeof(mssql_field)*result->num_fields);
- result->num_rows = _mssql_fetch_batch(mssql_ptr, result, retvalue);
-
- ZEND_REGISTER_RESOURCE(return_value, result, le_result);
-}
-/* }}} */
-
-/* {{{ proto int mssql_rows_affected(int conn_id)
- Returns the number of records affected by the query */
-PHP_FUNCTION(mssql_rows_affected) {
- zval **mssql_link_index;
- mssql_link *mssql_ptr;
- MSSQLLS_FETCH();
-
- if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &mssql_link_index)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE2(mssql_ptr, mssql_link *, mssql_link_index, -1, "MS SQL-Link", le_link, le_plink);
- RETURN_LONG(DBCOUNT(mssql_ptr->link));
-}
-/* }}} */
-
-
-/* {{{ proto int mssql_free_result(string result_index)
- Free a MS-SQL result index */
-PHP_FUNCTION(mssql_free_result)
-{
- zval **mssql_result_index;
- mssql_result *result;
- MSSQLLS_FETCH();
-
-
- if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &mssql_result_index)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if ((*mssql_result_index)->type==IS_RESOURCE && (*mssql_result_index)->value.lval==0) {
- RETURN_FALSE;
- }
-
- ZEND_FETCH_RESOURCE(result, mssql_result *, mssql_result_index, -1, "MS SQL-result", le_result);
- zend_list_delete((*mssql_result_index)->value.lval);
- RETURN_TRUE;
-}
-
-/* }}} */
-
-/* {{{ proto string mssql_get_last_message(void)
- Gets the last message from the MS-SQL server */
-PHP_FUNCTION(mssql_get_last_message)
-{
- MSSQLLS_FETCH();
-
- RETURN_STRING(MS_SQL_G(server_message),1);
-}
-
-/* }}} */
-
-/* {{{ proto int mssql_num_rows(int mssql_result_index)
- Returns the number of rows fetched in from the result id specified */
-PHP_FUNCTION(mssql_num_rows)
-{
- zval **mssql_result_index;
- mssql_result *result;
- MSSQLLS_FETCH();
-
-
- if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &mssql_result_index)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(result, mssql_result *, mssql_result_index, -1, "MS SQL-result", le_result);
-
- return_value->value.lval = result->num_rows;
- return_value->type = IS_LONG;
-}
-
-/* }}} */
-
-/* {{{ proto int mssql_num_fields(int mssql_result_index)
- Returns the number of fields fetched in from the result id specified */
-PHP_FUNCTION(mssql_num_fields)
-{
- zval **mssql_result_index;
- mssql_result *result;
- MSSQLLS_FETCH();
-
-
- if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &mssql_result_index)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(result, mssql_result *, mssql_result_index, -1, "MS SQL-result", le_result);
-
- return_value->value.lval = result->num_fields;
- return_value->type = IS_LONG;
-}
-
-/* }}} */
-
-static void php_mssql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, int result_type)
-{
- zval **mssql_result_index, **resulttype = NULL;
- mssql_result *result;
- int i;
- MSSQLLS_FETCH();
- PLS_FETCH();
-
- switch (ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &mssql_result_index)==FAILURE) {
- RETURN_FALSE;
- }
- if (!result_type) {
- result_type = MSSQL_BOTH;
- }
- break;
- case 2:
- if (zend_get_parameters_ex(2, &mssql_result_index, &resulttype)==FAILURE) {
- RETURN_FALSE;
- }
- convert_to_long_ex(resulttype);
- result_type = (*resulttype)->value.lval;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- ZEND_FETCH_RESOURCE(result, mssql_result *, mssql_result_index, -1, "MS SQL-result", le_result);
-
- if (result->cur_row >= result->num_rows) {
- RETURN_FALSE;
- }
-
- if (array_init(return_value)==FAILURE) {
- RETURN_FALSE;
- }
-
- for (i=0; i<result->num_fields; i++) {
- if (Z_TYPE(result->data[result->cur_row][i]) != IS_NULL) {
- char *data;
- int data_len;
- int should_copy;
-
- if (Z_TYPE(result->data[result->cur_row][i]) == IS_STRING) {
- if (PG(magic_quotes_runtime)) {
- data = php_addslashes(Z_STRVAL(result->data[result->cur_row][i]), Z_STRLEN(result->data[result->cur_row][i]), &result->data[result->cur_row][i].value.str.len, 1);
- should_copy = 0;
- }
- else
- {
- data = Z_STRVAL(result->data[result->cur_row][i]);
- data_len = Z_STRLEN(result->data[result->cur_row][i]);
- should_copy = 1;
- }
-
- if (result_type & MSSQL_NUM) {
- add_index_stringl(return_value, i, data, data_len, should_copy);
- should_copy = 1;
- }
-
- if (result_type & MSSQL_ASSOC) {
- add_assoc_stringl(return_value, result->fields[i].name, data, data_len, should_copy);
- }
- }
- else if (Z_TYPE(result->data[result->cur_row][i]) == IS_LONG) {
- if (result_type & MSSQL_NUM)
- add_index_long(return_value, i, result->data[result->cur_row][i].value.lval);
-
- if (result_type & MSSQL_ASSOC)
- add_assoc_long(return_value, result->fields[i].name, result->data[result->cur_row][i].value.lval);
- }
- else if (Z_TYPE(result->data[result->cur_row][i]) == IS_DOUBLE) {
- if (result_type & MSSQL_NUM)
- add_index_double(return_value, i, result->data[result->cur_row][i].value.dval);
-
- if (result_type & MSSQL_ASSOC)
- add_assoc_double(return_value, result->fields[i].name, result->data[result->cur_row][i].value.dval);
- }
- }
- else
- {
- if (result_type & MSSQL_NUM)
- add_index_null(return_value, i);
- if (result_type & MSSQL_ASSOC)
- add_assoc_null(return_value, result->fields[i].name);
- }
- }
- result->cur_row++;
-}
-
-/* {{{ proto array mssql_fetch_row(int result_id [, int result_type])
- Returns an array of the current row in the result set specified by result_id */
-PHP_FUNCTION(mssql_fetch_row)
-{
- php_mssql_fetch_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU, MSSQL_NUM);
-}
-
-/* }}} */
-
-/* {{{ proto object mssql_fetch_object(int result_id [, int result_type])
- Returns a psuedo-object of the current row in the result set specified by result_id */
-PHP_FUNCTION(mssql_fetch_object)
-{
- php_mssql_fetch_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU, MSSQL_ASSOC);
- if (return_value->type==IS_ARRAY) {
- return_value->type=IS_OBJECT;
- return_value->value.obj.properties = return_value->value.ht;
- return_value->value.obj.ce = &zend_standard_class_def;
- }
-}
-
-/* }}} */
-
-/* {{{ proto array mssql_fetch_array(int result_id [, int result_type])
- Returns an associative array of the current row in the result set specified by result_id */
-PHP_FUNCTION(mssql_fetch_array)
-{
- php_mssql_fetch_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU, MSSQL_ASSOC);
-}
-
-/* }}} */
-
-
-/* {{{ proto int mssql_data_seek(int result_id, int offset)
- Moves the internal row pointer of the MS-SQL result associated with the specified result identifier to pointer to the specified row number */
-PHP_FUNCTION(mssql_data_seek)
-{
- zval **mssql_result_index, **offset;
- mssql_result *result;
- MSSQLLS_FETCH();
-
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &mssql_result_index, &offset)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(result, mssql_result *, mssql_result_index, -1, "MS SQL-result", le_result);
-
- convert_to_long_ex(offset);
- if ((*offset)->value.lval<0 || (*offset)->value.lval>=result->num_rows) {
- php_error(E_WARNING,"MS SQL: Bad row offset");
- RETURN_FALSE;
- }
-
- result->cur_row = (*offset)->value.lval;
- RETURN_TRUE;
-}
-
-/* }}} */
-
-static char *php_mssql_get_field_name(int type)
-{
- switch (type) {
- case SQLBINARY:
- case SQLVARBINARY:
- return "blob";
- break;
- case SQLCHAR:
- case SQLVARCHAR:
- return "char";
- break;
- case SQLTEXT:
- return "text";
- break;
- case SQLDATETIME:
- case SQLDATETIM4:
- case SQLDATETIMN:
- return "datetime";
- break;
- case SQLDECIMAL:
- case SQLFLT8:
- case SQLFLTN:
- return "real";
- break;
- case SQLINT1:
- case SQLINT2:
- case SQLINT4:
- case SQLINTN:
- return "int";
- break;
- case SQLNUMERIC:
- return "numeric";
- break;
- case SQLMONEY:
- case SQLMONEY4:
- case SQLMONEYN:
- return "money";
- break;
- case SQLBIT:
- return "bit";
- break;
- case SQLIMAGE:
- return "image";
- break;
- default:
- return "unknown";
- break;
- }
-}
-
-/* {{{ proto object mssql_fetch_field(int result_id [, int offset])
- Gets information about certain fields in a query result */
-PHP_FUNCTION(mssql_fetch_field)
-{
- zval **mssql_result_index, **offset;
- int field_offset;
- mssql_result *result;
- MSSQLLS_FETCH();
-
-
- switch (ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &mssql_result_index)==FAILURE) {
- RETURN_FALSE;
- }
- field_offset=-1;
- break;
- case 2:
- if (zend_get_parameters_ex(2, &mssql_result_index, &offset)==FAILURE) {
- RETURN_FALSE;
- }
- convert_to_long_ex(offset);
- field_offset = (*offset)->value.lval;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- ZEND_FETCH_RESOURCE(result, mssql_result *, mssql_result_index, -1, "MS SQL-result", le_result);
-
- if (field_offset==-1) {
- field_offset = result->cur_field;
- result->cur_field++;
- }
-
- if (field_offset<0 || field_offset >= result->num_fields) {
- if (ZEND_NUM_ARGS()==2) { /* field specified explicitly */
- php_error(E_WARNING,"MS SQL: Bad column offset");
- }
- RETURN_FALSE;
- }
-
- if (object_init(return_value)==FAILURE) {
- RETURN_FALSE;
- }
- add_property_string(return_value, "name",result->fields[field_offset].name, 1);
- add_property_long(return_value, "max_length",result->fields[field_offset].max_length);
- add_property_string(return_value, "column_source",result->fields[field_offset].column_source, 1);
- add_property_long(return_value, "numeric", result->fields[field_offset].numeric);
- add_property_string(return_value, "type", php_mssql_get_field_name(result->fields[field_offset].type), 1);
-}
-
-/* }}} */
-
-/* {{{ proto int mssql_field_length(int result_id [, int offset])
- Get the length of a MS-SQL field */
-PHP_FUNCTION(mssql_field_length)
-{
- zval **mssql_result_index, **offset;
- int field_offset;
- mssql_result *result;
- MSSQLLS_FETCH();
-
-
- switch (ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &mssql_result_index)==FAILURE) {
- RETURN_FALSE;
- }
- field_offset=-1;
- break;
- case 2:
- if (zend_get_parameters_ex(2, &mssql_result_index, &offset)==FAILURE) {
- RETURN_FALSE;
- }
- convert_to_long_ex(offset);
- field_offset = (*offset)->value.lval;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- ZEND_FETCH_RESOURCE(result, mssql_result *, mssql_result_index, -1, "MS SQL-result", le_result);
-
- if (field_offset==-1) {
- field_offset = result->cur_field;
- result->cur_field++;
- }
-
- if (field_offset<0 || field_offset >= result->num_fields) {
- if (ZEND_NUM_ARGS()==2) { /* field specified explicitly */
- php_error(E_WARNING,"MS SQL: Bad column offset");
- }
- RETURN_FALSE;
- }
-
- return_value->value.lval = result->fields[field_offset].max_length;
- return_value->type = IS_LONG;
-}
-
-/* }}} */
-
-/* {{{ proto string mssql_field_name(int result_id [, int offset])
- Returns the name of the field given by offset in the result set given by result_id */
-PHP_FUNCTION(mssql_field_name)
-{
- zval **mssql_result_index, **offset;
- int field_offset;
- mssql_result *result;
- MSSQLLS_FETCH();
-
-
- switch (ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &mssql_result_index)==FAILURE) {
- RETURN_FALSE;
- }
- field_offset=-1;
- break;
- case 2:
- if (zend_get_parameters_ex(2, &mssql_result_index, &offset)==FAILURE) {
- RETURN_FALSE;
- }
- convert_to_long_ex(offset);
- field_offset = (*offset)->value.lval;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- ZEND_FETCH_RESOURCE(result, mssql_result *, mssql_result_index, -1, "MS SQL-result", le_result);
-
- if (field_offset==-1) {
- field_offset = result->cur_field;
- result->cur_field++;
- }
-
- if (field_offset<0 || field_offset >= result->num_fields) {
- if (ZEND_NUM_ARGS()==2) { /* field specified explicitly */
- php_error(E_WARNING,"MS SQL: Bad column offset");
- }
- RETURN_FALSE;
- }
-
- return_value->value.str.val = estrdup(result->fields[field_offset].name);
- return_value->value.str.len = strlen(result->fields[field_offset].name);
- return_value->type = IS_STRING;
-}
-
-/* }}} */
-
-/* {{{ proto string mssql_field_type(int result_id [, int offset])
- Returns the type of a field */
-PHP_FUNCTION(mssql_field_type)
-{
- zval **mssql_result_index, **offset;
- int field_offset;
- mssql_result *result;
- MSSQLLS_FETCH();
-
-
- switch (ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &mssql_result_index)==FAILURE) {
- RETURN_FALSE;
- }
- field_offset=-1;
- break;
- case 2:
- if (zend_get_parameters_ex(2, &mssql_result_index, &offset)==FAILURE) {
- RETURN_FALSE;
- }
- convert_to_long_ex(offset);
- field_offset = (*offset)->value.lval;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- ZEND_FETCH_RESOURCE(result, mssql_result *, mssql_result_index, -1, "MS SQL-result", le_result);
-
- if (field_offset==-1) {
- field_offset = result->cur_field;
- result->cur_field++;
- }
-
- if (field_offset<0 || field_offset >= result->num_fields) {
- if (ZEND_NUM_ARGS()==2) { /* field specified explicitly */
- php_error(E_WARNING,"MS SQL: Bad column offset");
- }
- RETURN_FALSE;
- }
-
- return_value->value.str.val = estrdup(php_mssql_get_field_name(result->fields[field_offset].type));
- return_value->value.str.len = strlen(php_mssql_get_field_name(result->fields[field_offset].type));
- return_value->type = IS_STRING;
-}
-
-/* }}} */
-
-/* {{{ proto bool mssql_field_seek(int result_id, int offset)
- Seeks to the specified field offset */
-PHP_FUNCTION(mssql_field_seek)
-{
- zval **mssql_result_index, **offset;
- int field_offset;
- mssql_result *result;
- MSSQLLS_FETCH();
-
-
- if (ZEND_NUM_ARGS()!=2 || zend_get_parameters_ex(2, &mssql_result_index, &offset)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(result, mssql_result *, mssql_result_index, -1, "MS SQL-result", le_result);
-
- convert_to_long_ex(offset);
- field_offset = (*offset)->value.lval;
-
- if (field_offset<0 || field_offset >= result->num_fields) {
- php_error(E_WARNING,"MS SQL: Bad column offset");
- RETURN_FALSE;
- }
-
- result->cur_field = field_offset;
- RETURN_TRUE;
-}
-
-/* }}} */
-
-/* {{{ proto string mssql_result(int result_id, int row, mixed field)
- Returns the contents of one cell from a MS-SQL result set */
-PHP_FUNCTION(mssql_result)
-{
- zval **row, **field, **mssql_result_index;
- int field_offset=0;
- mssql_result *result;
- MSSQLLS_FETCH();
-
-
- if (ZEND_NUM_ARGS()!=3 || zend_get_parameters_ex(3, &mssql_result_index, &row, &field)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(result, mssql_result *, mssql_result_index, -1, "MS SQL-result", le_result);
-
- convert_to_long_ex(row);
- if ((*row)->value.lval < 0 || (*row)->value.lval >= result->num_rows) {
- php_error(E_WARNING,"MS SQL: Bad row offset (%d)", (*row)->value.lval);
- RETURN_FALSE;
- }
-
- switch((*field)->type) {
- case IS_STRING: {
- int i;
-
- for (i=0; i<result->num_fields; i++) {
- if (!strcasecmp(result->fields[i].name, (*field)->value.str.val)) {
- field_offset = i;
- break;
- }
- }
- if (i>=result->num_fields) { /* no match found */
- php_error(E_WARNING,"MS SQL: %s field not found in result", (*field)->value.str.val);
- RETURN_FALSE;
- }
- break;
- }
- default:
- convert_to_long_ex(field);
- field_offset = (*field)->value.lval;
- if (field_offset<0 || field_offset>=result->num_fields) {
- php_error(E_WARNING,"MS SQL: Bad column offset specified");
- RETURN_FALSE;
- }
- break;
- }
-
- *return_value = result->data[(*row)->value.lval][field_offset];
- ZVAL_COPY_CTOR(return_value);
-}
-/* }}} */
-
-/* {{{ proto string mssql_next_result(int result_id)
- Move the internal result pointer to the next result */
-PHP_FUNCTION(mssql_next_result)
-{
- zval **mssql_result_index;
- int retvalue;
- mssql_result *result;
- mssql_link *mssql_ptr;
- MSSQLLS_FETCH();
-
-
- if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &mssql_result_index)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(result, mssql_result *, mssql_result_index, -1, "MS SQL-result", le_result);
-
- mssql_ptr = result->mssql_ptr;
- retvalue = dbresults(mssql_ptr->link);
- if (retvalue == FAIL || retvalue == NO_MORE_RESULTS || retvalue == NO_MORE_RPC_RESULTS) {
- RETURN_FALSE;
- }
- else {
- _free_result(result, 1);
- result->cur_row=result->num_fields=result->num_rows=0;
- dbclrbuf(mssql_ptr->link,DBLASTROW(mssql_ptr->link));
- retvalue = dbnextrow(mssql_ptr->link);
-
- result->num_fields = dbnumcols(mssql_ptr->link);
- result->fields = (mssql_field *) emalloc(sizeof(mssql_field)*result->num_fields);
- result->num_rows = _mssql_fetch_batch(mssql_ptr, result, retvalue);
- RETURN_TRUE;
- }
-
-}
-/* }}} */
-
-
-/* {{{ proto void mssql_min_error_severity(int severity)
- Sets the lower error severity */
-PHP_FUNCTION(mssql_min_error_severity)
-{
- zval **severity;
- MSSQLLS_FETCH();
-
-
- if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &severity)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(severity);
- MS_SQL_G(min_error_severity) = (*severity)->value.lval;
-}
-
-/* }}} */
-
-/* {{{ proto void mssql_min_message_severity(int severity)
- Sets the lower message severity */
-PHP_FUNCTION(mssql_min_message_severity)
-{
- zval **severity;
- MSSQLLS_FETCH();
-
-
- if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &severity)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(severity);
- MS_SQL_G(min_message_severity) = (*severity)->value.lval;
-}
-/* }}} */
-
-/* {{{ proto int mssql_init(string sp_name [, int conn_id])
- Initializes a stored procedure or a remote stored procedure */
-PHP_FUNCTION(mssql_init)
-{
- zval **sp_name, **mssql_link_index;
- mssql_link *mssql_ptr;
- mssql_statement *statement;
- int id;
- MSSQLLS_FETCH();
-
- switch(ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &sp_name)==FAILURE) {
- RETURN_FALSE;
- }
- id = php_mssql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU MSSQLLS_CC);
- CHECK_LINK(id);
- break;
-
- case 2:
- if (zend_get_parameters_ex(2, &sp_name, &mssql_link_index)==FAILURE) {
- RETURN_FALSE;
- }
- id = -1;
- break;
-
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- ZEND_FETCH_RESOURCE2(mssql_ptr, mssql_link *, mssql_link_index, id, "MS SQL-Link", le_link, le_plink);
-
- convert_to_string_ex(sp_name);
-
- if (dbrpcinit(mssql_ptr->link, (*sp_name)->value.str.val,0)==FAIL) {
- php_error(E_WARNING,"MS SQL: unable to init stored procedure");
- RETURN_FALSE;
- }
-
- statement=NULL;
- statement = ecalloc(1,sizeof(mssql_statement));
-
- if (statement!=NULL) {
- statement->link = mssql_ptr;
- statement->executed=FALSE;
- }
- else {
- php_error(E_WARNING,"mssql_init: unable to allocate statement");
- RETURN_FALSE;
- }
-
- statement->id = zend_list_insert(statement,le_statement);
-
- RETURN_RESOURCE(statement->id);
-}
-/* }}} */
-
-/* {{{ proto int mssql_bind(int stmt, string param_name, mixed var, int type
- [, int is_output[, int is_null[, int maxlen]])
- Adds a parameter to a stored procedure or a remote stored procedure */
-PHP_FUNCTION(mssql_bind)
-{
- int type, is_output, is_null, datalen, maxlen;
- zval **stmt, **param_name, **var, **yytype;
- mssql_link *mssql_ptr;
- mssql_statement *statement;
- mssql_bind bind,*bindp;
- int id, status;
-
- LPBYTE value;
- MSSQLLS_FETCH();
-
- id=0;
- status=0;
-
- /* BEGIN input validation */
- switch(ZEND_NUM_ARGS()) {
- case 4:
- if (zend_get_parameters_ex(4, &stmt, &param_name, &var, &yytype)==FAILURE) {
- RETURN_FALSE;
- }
- convert_to_long_ex(yytype);
- type=(*yytype)->value.lval;
- is_null=FALSE;
- is_output=FALSE;
- maxlen=-1;
-
- break;
-
- case 5: {
- zval **yyis_output;
-
- if (zend_get_parameters_ex(5, &stmt, &param_name, &var, &yytype, &yyis_output)==FAILURE) {
- RETURN_FALSE;
- }
- convert_to_long_ex(yytype);
- convert_to_long_ex(yyis_output);
- type=(*yytype)->value.lval;
- is_null=FALSE;
- is_output=(*yyis_output)->value.lval;
- maxlen=-1;
- }
- break;
-
- case 6: {
- zval **yyis_output, **yyis_null;
-
- if (zend_get_parameters_ex(6, &stmt, &param_name, &var, &yytype, &yyis_output, &yyis_null)==FAILURE) {
- RETURN_FALSE;
- }
- convert_to_long_ex(yytype);
- convert_to_long_ex(yyis_output);
- convert_to_long_ex(yyis_null);
- type=(*yytype)->value.lval;
- is_output=(*yyis_output)->value.lval;
- is_null=(*yyis_null)->value.lval;
- maxlen=-1;
- }
- break;
-
- case 7: {
- zval **yyis_output, **yyis_null, **yymaxlen;
-
- if (zend_get_parameters_ex(7, &stmt, &param_name, &var, &yytype, &yyis_output, &yyis_null, &yymaxlen)==FAILURE) {
- RETURN_FALSE;
- }
- convert_to_long_ex(yytype);
- convert_to_long_ex(yyis_output);
- convert_to_long_ex(yyis_null);
- convert_to_long_ex(yymaxlen);
- type=(*yytype)->value.lval;
- is_output=(*yyis_output)->value.lval;
- is_null=(*yyis_null)->value.lval;
- maxlen=(*yymaxlen)->value.lval;
- }
- break;
-
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- /* END input validation */
-
- statement = _mssql_get_statement(stmt);
- if (statement==NULL) {
- RETURN_FALSE;
- }
- mssql_ptr=statement->link;
-
- /* modify datalen and maxlen according to dbrpcparam documentation */
- if ( (type==SQLVARCHAR) || (type==SQLCHAR) || (type==SQLTEXT) ) { /* variable-length type */
- if (is_null) {
- maxlen=0;
- datalen=0;
- }
- else {
- convert_to_string_ex(var);
- datalen=(*var)->value.str.len;
- value=(LPBYTE)(*var)->value.str.val;
- }
- }
- else { /* fixed-length type */
- if (is_null) {
- datalen=0;
- }
- else {
- datalen=-1;
- }
- maxlen=-1;
-
- switch (type) {
-
- case SQLFLT8:
- convert_to_double_ex(var);
- value=(LPBYTE)(&(*var)->value.dval);
- break;
-
- case SQLINT1:
- case SQLINT2:
- case SQLINT4:
- convert_to_long_ex(var);
- value=(LPBYTE)(&(*var)->value.lval);
- break;
-
- default:
- php_error(E_WARNING,"mssql_bind: unsupported type");
- RETURN_FALSE;
- break;
- }
- }
-
- convert_to_string_ex(param_name);
-
- if (is_output) {
- status=DBRPCRETURN;
- }
-
- /* hashtable of binds */
- if (! statement->binds) {
- ALLOC_HASHTABLE(statement->binds);
- zend_hash_init(statement->binds, 13, NULL, _mssql_bind_hash_dtor, 0);
- }
-
- memset((void*)&bind,0,sizeof(mssql_bind));
- zend_hash_add(statement->binds,(*param_name)->value.str.val,(*param_name)->value.str.len,&bind,sizeof(mssql_bind),(void **)&bindp);
- bindp->zval=*var;
- zval_add_ref(var);
-
- /* no call to dbrpcparam if RETVAL */
- if ( strcmp("RETVAL",(*param_name)->value.str.val)!=0 ) {
- if (dbrpcparam(mssql_ptr->link, (*param_name)->value.str.val, (BYTE)status, type, maxlen, datalen, (LPCBYTE)value)==FAIL) {
- php_error(E_WARNING,"MS SQL: Unable to set parameter");
- RETURN_FALSE;
- }
- }
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int mssql_execute(int stmt)
- Executes a stored procedure on a MS-SQL server database */
-PHP_FUNCTION(mssql_execute)
-{
- zval **stmt;
- int retvalue,retval_results;
- mssql_link *mssql_ptr;
- mssql_statement *statement;
- mssql_bind *bind;
- mssql_result *result;
- int num_fields,num_rets,type;
- int blocks_initialized=1;
- int i,j;
- int *column_types;
- int batchsize;
- int ac = ZEND_NUM_ARGS();
- char *parameter;
- MSSQLLS_FETCH();
-
- batchsize = MS_SQL_G(batchsize);
- if (ac !=1 || zend_get_parameters_ex(1, &stmt)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- statement = _mssql_get_statement(stmt);
- if (statement==NULL) {
- RETURN_FALSE;
- }
- mssql_ptr=statement->link;
-
- if (dbrpcexec(mssql_ptr->link)==FAIL || dbsqlok(mssql_ptr->link)==FAIL) {
- php_error(E_WARNING,"MS SQL: stored procedure execution failed.");
- RETURN_FALSE;
- }
-
- retval_results=dbresults(mssql_ptr->link);
-
- if (retval_results==FAIL) {
- php_error(E_WARNING,"MS SQL: could not retrieve results");
- RETURN_FALSE;
- }
-
- /* The following is just like mssql_query, fetch all rows from the server into
- * the row buffer. We add here the RETVAL and OUTPUT parameters stuff
- */
- result=NULL;
- /* if multiple recordsets in a stored procedure were supported, we would
- use a "while (retval_results!=NO_MORE_RESULTS)" instead an "if" */
- if (retval_results==SUCCEED) {
- if ( (retvalue=(dbnextrow(mssql_ptr->link)))!=NO_MORE_ROWS ) {
- num_fields = dbnumcols(mssql_ptr->link);
- if (num_fields <= 0) {
- RETURN_TRUE;
- }
-
- result = (mssql_result *) emalloc(sizeof(mssql_result));
- column_types = (int *) emalloc(sizeof(int) * num_fields);
- for (i=0; i<num_fields; i++) {
- column_types[i] = coltype(i+1);
- }
-
- result->batchsize = batchsize;
- result->data = (zval **) emalloc(sizeof(zval *)*MSSQL_ROWS_BLOCK);
- result->mssql_ptr = mssql_ptr;
- result->cur_field=result->cur_row=result->num_rows=0;
- result->num_fields = num_fields;
-
- result->num_rows = _mssql_fetch_batch(mssql_ptr, result, retvalue);
-
- result->fields = (mssql_field *) emalloc(sizeof(mssql_field)*num_fields);
- j=0;
- for (i=0; i<num_fields; i++) {
- char *fname = (char *)dbcolname(mssql_ptr->link,i+1);
- char computed_buf[16];
-
- if (*fname) {
- result->fields[i].name = estrdup(fname);
- } else {
- if (j>0) {
- snprintf(computed_buf,16,"computed%d",j);
- } else {
- strcpy(computed_buf,"computed");
- }
- result->fields[i].name = estrdup(computed_buf);
- j++;
- }
- result->fields[i].max_length = dbcollen(mssql_ptr->link,i+1);
- result->fields[i].column_source = estrdup(dbcolsource(mssql_ptr->link,i+1));
- if (!result->fields[i].column_source) {
- result->fields[i].column_source = empty_string;
- }
- result->fields[i].type = column_types[i];
- /* set numeric flag */
- switch (column_types[i]) {
- case SQLINT1:
- case SQLINT2:
- case SQLINT4:
- case SQLFLT8:
- case SQLNUMERIC:
- case SQLDECIMAL:
- result->fields[i].numeric = 1;
- break;
- case SQLCHAR:
- case SQLVARCHAR:
- case SQLTEXT:
- default:
- result->fields[i].numeric = 0;
- break;
- }
- }
- efree(column_types);
- }
- retval_results=dbresults(mssql_ptr->link);
- }
-
- if (retval_results==SUCCEED) {
- php_error(E_WARNING,"mssql_execute: multiple recordsets from a stored procedure not supported yet! (Skipping...)");
- retval_results=dbresults(mssql_ptr->link);
-
- while (retval_results==SUCCEED) {
- retval_results=dbresults(mssql_ptr->link);
- }
- }
-
- if (retval_results==NO_MORE_RESULTS) {
- /* Now to fetch RETVAL and OUTPUT values*/
- num_rets = dbnumrets(mssql_ptr->link);
-
- if (num_rets!=0) {
- for (i = 1; i <= num_rets; i++) {
- parameter=(char*)dbretname(mssql_ptr->link, i);
- type=dbrettype(mssql_ptr->link, i);
-
- if (statement->binds!=NULL ) { /* Maybe a non-parameter sp */
- if (zend_hash_find(statement->binds, parameter, strlen(parameter), (void**)&bind)==SUCCESS) {
- switch (type) {
- case SQLBIT:
- case SQLINT1:
- case SQLINT2:
- case SQLINT4:
- convert_to_long_ex(&bind->zval);
- bind->zval->value.lval=*((int *)(dbretdata(mssql_ptr->link,i)));
- break;
-
- case SQLFLT8:
- convert_to_double_ex(&bind->zval);
- bind->zval->value.dval=*((double *)(dbretdata(mssql_ptr->link,i)));
- break;
-
- case SQLCHAR:
- case SQLVARCHAR:
- case SQLTEXT:
- convert_to_string_ex(&bind->zval);
- bind->zval->value.str.len=dbretlen(mssql_ptr->link,i);
- bind->zval->value.str.val = estrndup(dbretdata(mssql_ptr->link,i),bind->zval->value.str.len);
- break;
- }
- }
- else {
- php_error(E_WARNING,"mssql_execute: an output parameter variable was not provided");
- }
- }
- }
- }
-
- if (statement->binds!=NULL ) { /* Maybe a non-parameter sp */
- if (zend_hash_find(statement->binds, "RETVAL", 6, (void**)&bind)==SUCCESS) {
- if (dbhasretstat(mssql_ptr->link)) {
- convert_to_long_ex(&bind->zval);
- bind->zval->value.lval=dbretstatus(mssql_ptr->link);
- }
- else {
- php_error(E_WARNING,"mssql_execute: stored procedure has no return value. Nothing was returned into RETVAL");
- }
- }
- }
- }
-
- if (result==NULL) {
- RETURN_TRUE; /* no recordset returned ...*/
- }
- else {
- ZEND_REGISTER_RESOURCE(return_value, result, le_result);
- }
-}
-/* }}} */
-
-#endif
diff --git a/ext/mssql/php_mssql.h b/ext/mssql/php_mssql.h
deleted file mode 100644
index 4fab922cd1..0000000000
--- a/ext/mssql/php_mssql.h
+++ /dev/null
@@ -1,166 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Frank M. Kromann frank@frontbase.com> |
- +----------------------------------------------------------------------+
- */
-
-
-/* $Id$ */
-
-#ifndef PHP_MSSQL_H
-#define PHP_MSSQL_H
-
-
-#if HAVE_MSSQL
-#ifdef PHP_WIN32
-#define PHP_MSSQL_API __declspec(dllexport)
-#else
-#define PHP_MSSQL_API
-#endif
-
-
-#define MSSQL_VERSION "7.0"
-#include "sqlfront.h"
-#include "sqldb.h"
-
-#define coltype(j) dbcoltype(mssql_ptr->link,j)
-#define intcol(i) ((int) *(DBINT *) dbdata(mssql_ptr->link,i))
-#define smallintcol(i) ((int) *(DBSMALLINT *) dbdata(mssql_ptr->link,i))
-#define tinyintcol(i) ((int) *(DBTINYINT *) dbdata(mssql_ptr->link,i))
-#define anyintcol(j) (coltype(j)==SQLINT4?intcol(j):(coltype(j)==SQLINT2?smallintcol(j):tinyintcol(j)))
-#define charcol(i) ((DBCHAR *) dbdata(mssql_ptr->link,i))
-#define floatcol(i) ((float) *(DBFLT8 *) dbdata(mssql_ptr->link,i))
-
-#ifdef ZTS
-#include "TSRM.h"
-#endif
-
-extern zend_module_entry mssql_module_entry;
-#define mssql_module_ptr &mssql_module_entry
-
-extern PHP_MINIT_FUNCTION(mssql);
-extern PHP_MSHUTDOWN_FUNCTION(mssql);
-extern PHP_RINIT_FUNCTION(mssql);
-extern PHP_RSHUTDOWN_FUNCTION(mssql);
-PHP_MINFO_FUNCTION(mssql);
-
-PHP_FUNCTION(mssql_connect);
-PHP_FUNCTION(mssql_pconnect);
-PHP_FUNCTION(mssql_close);
-PHP_FUNCTION(mssql_select_db);
-PHP_FUNCTION(mssql_query);
-PHP_FUNCTION(mssql_fetch_batch);
-PHP_FUNCTION(mssql_rows_affected);
-PHP_FUNCTION(mssql_free_result);
-PHP_FUNCTION(mssql_get_last_message);
-PHP_FUNCTION(mssql_num_rows);
-PHP_FUNCTION(mssql_num_fields);
-PHP_FUNCTION(mssql_fetch_field);
-PHP_FUNCTION(mssql_fetch_row);
-PHP_FUNCTION(mssql_fetch_array);
-PHP_FUNCTION(mssql_fetch_object);
-PHP_FUNCTION(mssql_field_length);
-PHP_FUNCTION(mssql_field_name);
-PHP_FUNCTION(mssql_field_type);
-PHP_FUNCTION(mssql_data_seek);
-PHP_FUNCTION(mssql_field_seek);
-PHP_FUNCTION(mssql_result);
-PHP_FUNCTION(mssql_next_result);
-PHP_FUNCTION(mssql_min_error_severity);
-PHP_FUNCTION(mssql_min_message_severity);
-PHP_FUNCTION(mssql_init);
-PHP_FUNCTION(mssql_bind);
-PHP_FUNCTION(mssql_execute);
-
-typedef struct mssql_link {
- LOGINREC *login;
- DBPROCESS *link;
- int valid;
-} mssql_link;
-
-typedef struct mssql_statement {
- int id;
- mssql_link *link;
- HashTable *binds;
- int executed;
-} mssql_statement;
-
-typedef struct {
-
- zval *zval;
- /* TODO: more data for special types (BLOBS, NUMERIC...) */
-} mssql_bind;
-
-ZEND_BEGIN_MODULE_GLOBALS(mssql)
- long default_link;
- long num_links,num_persistent;
- long max_links,max_persistent;
- long allow_persistent;
- char *appname;
- char *server_message;
- long min_error_severity, min_message_severity;
- long cfg_min_error_severity, cfg_min_message_severity;
- long compatability_mode, connect_timeout, timeout;
- void (*get_column_content)(mssql_link *mssql_ptr,int offset,pval *result,int column_type);
- long textsize, textlimit, batchsize;
- HashTable *resource_list, *resource_plist;
-ZEND_END_MODULE_GLOBALS(mssql)
-
-#define MSSQL_ROWS_BLOCK 128
-
-typedef struct mssql_field {
- char *name,*column_source;
- long max_length;
- int numeric;
- int type;
-} mssql_field;
-
-typedef struct mssql_result {
- pval **data;
- mssql_field *fields;
- mssql_link *mssql_ptr;
- int batchsize;
- int lastresult;
- int blocks_initialized;
- int cur_row,cur_field;
- int num_rows,num_fields;
-} mssql_result;
-
-
-#ifdef ZTS
-# define MSSQLLS_D zend_mssql_globals *mssql_globals
-# define MSSQLLS_DC , MSSQLLS_D
-# define MSSQLLS_C mssql_globals
-# define MSSQLLS_CC , MSSQLLS_C
-# define MS_SQL_G(v) (mssql_globals->v)
-# define MSSQLLS_FETCH() zend_mssql_globals *mssql_globals = ts_resource(mssql_globals_id)
-#else
-# define MSSQLLS_D
-# define MSSQLLS_DC
-# define MSSQLLS_C
-# define MSSQLLS_CC
-# define MS_SQL_G(v) (mssql_globals.v)
-# define MSSQLLS_FETCH()
-#endif
-
-#else
-
-#define mssql_module_ptr NULL
-
-#endif /* HAVE_MSSQL */
-
-#define phpext_mssql_ptr mssql_module_ptr
-
-#endif /* PHP_MSSQL_H */
diff --git a/ext/muscat/EXPERIMENTAL b/ext/muscat/EXPERIMENTAL
deleted file mode 100644
index 4f0b763eeb..0000000000
--- a/ext/muscat/EXPERIMENTAL
+++ /dev/null
@@ -1 +0,0 @@
-This extension cannot be distributed with PHP - It is GPL'ed
diff --git a/ext/muscat/LICENSE b/ext/muscat/LICENSE
deleted file mode 100644
index 8677a0cce2..0000000000
--- a/ext/muscat/LICENSE
+++ /dev/null
@@ -1,282 +0,0 @@
- GNU GENERAL PUBLIC LICENSE
- Version 2, June 1991
-
- Copyright (C) 1989, 1991 Free Software Foundation, Inc.
- 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
- Preamble
-
- The licenses for most software are designed to take away your
-freedom to share and change it. By contrast, the GNU General Public
-License is intended to guarantee your freedom to share and change free
-software--to make sure the software is free for all its users. This
-General Public License applies to most of the Free Software
-Foundation's software and to any other program whose authors commit to
-using it. (Some other Free Software Foundation software is covered by
-the GNU Library General Public License instead.) You can apply it to
-your programs, too.
-
- When we speak of free software, we are referring to freedom, not
-price. Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-this service if you wish), that you receive source code or can get it
-if you want it, that you can change the software or use pieces of it
-in new free programs; and that you know you can do these things.
-
- To protect your rights, we need to make restrictions that forbid
-anyone to deny you these rights or to ask you to surrender the rights.
-These restrictions translate to certain responsibilities for you if you
-distribute copies of the software, or if you modify it.
-
- For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must give the recipients all the rights that
-you have. You must make sure that they, too, receive or can get the
-source code. And you must show them these terms so they know their
-rights.
-
- We protect your rights with two steps: (1) copyright the software, and
-(2) offer you this license which gives you legal permission to copy,
-distribute and/or modify the software.
-
- Also, for each author's protection and ours, we want to make certain
-that everyone understands that there is no warranty for this free
-software. If the software is modified by someone else and passed on, we
-want its recipients to know that what they have is not the original, so
-that any problems introduced by others will not reflect on the original
-authors' reputations.
-
- Finally, any free program is threatened constantly by software
-patents. We wish to avoid the danger that redistributors of a free
-program will individually obtain patent licenses, in effect making the
-program proprietary. To prevent this, we have made it clear that any
-patent must be licensed for everyone's free use or not licensed at all.
-
- The precise terms and conditions for copying, distribution and
-modification follow.
-
- GNU GENERAL PUBLIC LICENSE
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
- 0. This License applies to any program or other work which contains
-a notice placed by the copyright holder saying it may be distributed
-under the terms of this General Public License. The "Program", below,
-refers to any such program or work, and a "work based on the Program"
-means either the Program or any derivative work under copyright law:
-that is to say, a work containing the Program or a portion of it,
-either verbatim or with modifications and/or translated into another
-language. (Hereinafter, translation is included without limitation in
-the term "modification".) Each licensee is addressed as "you".
-
-Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope. The act of
-running the Program is not restricted, and the output from the Program
-is covered only if its contents constitute a work based on the
-Program (independent of having been made by running the Program).
-Whether that is true depends on what the Program does.
-
- 1. You may copy and distribute verbatim copies of the Program's
-source code as you receive it, in any medium, provided that you
-conspicuously and appropriately publish on each copy an appropriate
-copyright notice and disclaimer of warranty; keep intact all the
-notices that refer to this License and to the absence of any warranty;
-and give any other recipients of the Program a copy of this License
-along with the Program.
-
-You may charge a fee for the physical act of transferring a copy, and
-you may at your option offer warranty protection in exchange for a fee.
-
- 2. You may modify your copy or copies of the Program or any portion
-of it, thus forming a work based on the Program, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
- a) You must cause the modified files to carry prominent notices
- stating that you changed the files and the date of any change.
-
- b) You must cause any work that you distribute or publish, that in
- whole or in part contains or is derived from the Program or any
- part thereof, to be licensed as a whole at no charge to all third
- parties under the terms of this License.
-
- c) If the modified program normally reads commands interactively
- when run, you must cause it, when started running for such
- interactive use in the most ordinary way, to print or display an
- announcement including an appropriate copyright notice and a
- notice that there is no warranty (or else, saying that you provide
- a warranty) and that users may redistribute the program under
- these conditions, and telling the user how to view a copy of this
- License. (Exception: if the Program itself is interactive but
- does not normally print such an announcement, your work based on
- the Program is not required to print an announcement.)
-
-These requirements apply to the modified work as a whole. If
-identifiable sections of that work are not derived from the Program,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works. But when you
-distribute the same sections as part of a whole which is a work based
-on the Program, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Program.
-
-In addition, mere aggregation of another work not based on the Program
-with the Program (or with a work based on the Program) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
- 3. You may copy and distribute the Program (or a work based on it,
-under Section 2) in object code or executable form under the terms of
-Sections 1 and 2 above provided that you also do one of the following:
-
- a) Accompany it with the complete corresponding machine-readable
- source code, which must be distributed under the terms of Sections
- 1 and 2 above on a medium customarily used for software interchange; or,
-
- b) Accompany it with a written offer, valid for at least three
- years, to give any third party, for a charge no more than your
- cost of physically performing source distribution, a complete
- machine-readable copy of the corresponding source code, to be
- distributed under the terms of Sections 1 and 2 above on a medium
- customarily used for software interchange; or,
-
- c) Accompany it with the information you received as to the offer
- to distribute corresponding source code. (This alternative is
- allowed only for noncommercial distribution and only if you
- received the program in object code or executable form with such
- an offer, in accord with Subsection b above.)
-
-The source code for a work means the preferred form of the work for
-making modifications to it. For an executable work, complete source
-code means all the source code for all modules it contains, plus any
-associated interface definition files, plus the scripts used to
-control compilation and installation of the executable. However, as a
-special exception, the source code distributed need not include
-anything that is normally distributed (in either source or binary
-form) with the major components (compiler, kernel, and so on) of the
-operating system on which the executable runs, unless that component
-itself accompanies the executable.
-
-If distribution of executable or object code is made by offering
-access to copy from a designated place, then offering equivalent
-access to copy the source code from the same place counts as
-distribution of the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
- 4. You may not copy, modify, sublicense, or distribute the Program
-except as expressly provided under this License. Any attempt
-otherwise to copy, modify, sublicense or distribute the Program is
-void, and will automatically terminate your rights under this License.
-However, parties who have received copies, or rights, from you under
-this License will not have their licenses terminated so long as such
-parties remain in full compliance.
-
- 5. You are not required to accept this License, since you have not
-signed it. However, nothing else grants you permission to modify or
-distribute the Program or its derivative works. These actions are
-prohibited by law if you do not accept this License. Therefore, by
-modifying or distributing the Program (or any work based on the
-Program), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Program or works based on it.
-
- 6. Each time you redistribute the Program (or any work based on the
-Program), the recipient automatically receives a license from the
-original licensor to copy, distribute or modify the Program subject to
-these terms and conditions. You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties to
-this License.
-
- 7. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Program at all. For example, if a patent
-license would not permit royalty-free redistribution of the Program by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Program.
-
-If any portion of this section is held invalid or unenforceable under
-any particular circumstance, the balance of the section is intended to
-apply and the section as a whole is intended to apply in other
-circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system, which is
-implemented by public license practices. Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
- 8. If the distribution and/or use of the Program is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Program under this License
-may add an explicit geographical distribution limitation excluding
-those countries, so that distribution is permitted only in or among
-countries not thus excluded. In such case, this License incorporates
-the limitation as if written in the body of this License.
-
- 9. The Free Software Foundation may publish revised and/or new versions
-of the General Public License from time to time. Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
-Each version is given a distinguishing version number. If the Program
-specifies a version number of this License which applies to it and "any
-later version", you have the option of following the terms and conditions
-either of that version or of any later version published by the Free
-Software Foundation. If the Program does not specify a version number of
-this License, you may choose any version ever published by the Free Software
-Foundation.
-
- 10. If you wish to incorporate parts of the Program into other free
-programs whose distribution conditions are different, write to the author
-to ask for permission. For software which is copyrighted by the Free
-Software Foundation, write to the Free Software Foundation; we sometimes
-make exceptions for this. Our decision will be guided by the two goals
-of preserving the free status of all derivatives of our free software and
-of promoting the sharing and reuse of software generally.
-
- NO WARRANTY
-
- 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
-FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
-OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
-PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
-OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
-TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
-PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
-REPAIR OR CORRECTION.
-
- 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
-REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
-INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
-OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
-TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
-YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
-PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGES.
-
- END OF TERMS AND CONDITIONS
-
-
diff --git a/ext/muscat/LICENSE.about b/ext/muscat/LICENSE.about
deleted file mode 100644
index aaeec10074..0000000000
--- a/ext/muscat/LICENSE.about
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Muscat/Empower 1.5 Module for PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 2000 Ananova Ltd |
- | http://www.ananova.com |
- | Ananova Ltd, PO Box 36, Leeds, LS11 5ZA, United Kingdom |
- +----------------------------------------------------------------------+
- | This program is free software; you can redistribute it and/or |
- | modify it under the terms of the GNU General Public License |
- | as published by the Free Software Foundation; either version 2 |
- | of the License, or (at your option) any later version. |
- | |
- | This program is distributed in the hope that it will be useful, |
- | but WITHOUT ANY WARRANTY; without even the implied warranty of |
- | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
- | GNU General Public License for more details. |
- | |
- | You should have received a copy of the GNU General Public License |
- | along with this program; if not, write to the Free Software |
- | Foundation, Inc., 59 Temple Place - Suite 330, Boston, |
- | MA 02111-1307, USA. |
- | |
- | A copy is availble at http://www.gnu.org/copyleft/gpl.txt |
- +----------------------------------------------------------------------+
- | Author: Sam Liddicott <sam@ananova.com> |
- +----------------------------------------------------------------------+
- */
-
-
diff --git a/ext/muscat/Makefile.in b/ext/muscat/Makefile.in
deleted file mode 100644
index 94e193c550..0000000000
--- a/ext/muscat/Makefile.in
+++ /dev/null
@@ -1,7 +0,0 @@
-
-LTLIBRARY_NAME = libmuscat.la
-LTLIBRARY_SOURCES = muscat.c muscat_net.c
-LTLIBRARY_SHARED_NAME = muscat.la
-LTLIBRARY_SHARED_LIBADD = $(MUSCAT_SHARED_LIBADD)
-
-include $(top_srcdir)/build/dynlib.mk
diff --git a/ext/muscat/config.m4 b/ext/muscat/config.m4
deleted file mode 100644
index b9c680d994..0000000000
--- a/ext/muscat/config.m4
+++ /dev/null
@@ -1,35 +0,0 @@
-dnl $Id$
-
-PHP_ARG_WITH(muscat, for Muscat support,
-[ --with-muscat[=DIR] Include muscat support.])
-
-if test "$PHP_MUSCAT" != "no"; then
- PHP_EXTENSION(muscat, $ext_shared)
- for i in $PHP_MUSCAT /usr/local /usr /usr/local/empower /usr/local/empower/developer; do
- if test -f $i/include/Muscat.h; then
- MUSCAT_INCDIR=$i/include
- MUSCAT_DIR=$i
- fi
- if test -f $i/libs/libhdmuscat3.6.a; then
- MUSCAT_LIBDIR=$i/libs
- MUSCAT_DIR=$i
- elif test -f $i/lib/libhdmuscat3.6.a; then
- MUSCAT_LIBDIR=$i/lib
- MUSCAT_DIR=$i
- fi
- done
-
- if test -z "$MUSCAT_INCDIR"; then
- AC_MSG_ERROR(Cannot find Muscat include dir)
- fi
-
- if test -z "$MUSCAT_LIBDIR"; then
- AC_MSG_ERROR(Cannot find Muscat lib dir)
- fi
-
- AC_DEFINE(HAVE_MUSCAT, 1, [ ])
- PHP_SUBST(MUSCAT_SHARED_LIBADD)
- AC_DEFINE_UNQUOTED(PHP_MUSCAT_DIR, "$MUSCAT_DIR", [ ])
- PHP_ADD_LIBRARY_WITH_PATH(hdmuscat3.6, $MUSCAT_LIBDIR, MUSCAT_SHARED_LIBADD)
- PHP_ADD_INCLUDE($MUSCAT_INCDIR)
-fi
diff --git a/ext/muscat/muscat.c b/ext/muscat/muscat.c
deleted file mode 100644
index 89dbf82daf..0000000000
--- a/ext/muscat/muscat.c
+++ /dev/null
@@ -1,356 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Muscat/Empower 1.5 Module for PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 2000 Ananova Ltd |
- | http://www.ananova.com |
- | Ananova Ltd, PO Box 36, Leeds, LS11 5ZA, United Kingdom |
- +----------------------------------------------------------------------+
- | This program is free software; you can redistribute it and/or |
- | modify it under the terms of the GNU General Public License |
- | as published by the Free Software Foundation; either version 2 |
- | of the License, or (at your option) any later version. |
- | |
- | This program is distributed in the hope that it will be useful, |
- | but WITHOUT ANY WARRANTY; without even the implied warranty of |
- | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
- | GNU General Public License for more details. |
- | |
- | You should have received a copy of the GNU General Public License |
- | along with this program; if not, write to the Free Software |
- | Foundation, Inc., 59 Temple Place - Suite 330, Boston, |
- | MA 02111-1307, USA. |
- | |
- | A copy is availble at http://www.gnu.org/copyleft/gpl.txt |
- +----------------------------------------------------------------------+
- | Author: Sam Liddicott <sam@ananova.com> |
- +----------------------------------------------------------------------+
- */
-
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "php_ini.h"
-#include "php_muscat.h"
-
-/* You should tweak config.m4 so this symbol (or some else suitable)
- gets defined.
-*/
-#if HAVE_MUSCAT
-#include <muscat_handles.h>
-#include "../standard/file.h"
-
-/* If you declare any globals in php_muscat.h uncomment this:*/
-ZEND_DECLARE_MODULE_GLOBALS(muscat)
-
-/* True global resources - no need for thread safety here */
-static int le_muscat;
-
-/* Every user visible function must have an entry in muscat_functions[].
-*/
-function_entry muscat_functions[] = {
- PHP_FE(muscat_setup, NULL)
- PHP_FE(muscat_setup_net, NULL)
- PHP_FE(muscat_give, NULL)
- PHP_FE(muscat_get, NULL)
- PHP_FE(muscat_close, NULL)
- {NULL, NULL, NULL} /* Must be the last line in muscat_functions[] */
-};
-
-zend_module_entry muscat_module_entry = {
- "muscat",
- muscat_functions,
- PHP_MINIT(muscat),
- PHP_MSHUTDOWN(muscat),
- PHP_RINIT(muscat), /* Replace with NULL if there's nothing to do at request start */
- PHP_RSHUTDOWN(muscat), /* Replace with NULL if there's nothing to do at request end */
- PHP_MINFO(muscat),
- STANDARD_MODULE_PROPERTIES
-};
-
-#ifdef COMPILE_DL_MUSCAT
-ZEND_GET_MODULE(muscat)
-#endif
-
-/* {{{ destructor to close and free muscat handles
- */
-void _muscat_close(_muscat_handle * handle) {
- if (handle->open) {
- if (handle->net) _net_muscat_close(&handle->handles.muscatnet_handle);
- else H_Close_Muscat(&handle->handles.muscat_handle);
- handle->open=0;
- }
-}
-
-/* {{{ destructor to close and free muscat handles
- */
-void _muscat_dispose(_muscat_handle * handle) {
- if (handle->open) {
- _muscat_close(handle);
- }
- efree(handle);
-}
-
-/* }}} */
-
-/* Remove comments and fill if you need to have entries in php.ini
-PHP_INI_BEGIN()
-PHP_INI_END()
-*/
-
-PHP_MINIT_FUNCTION(muscat)
-{
-/* Remove comments if you have entries in php.ini
- REGISTER_INI_ENTRIES();
-*/
- le_muscat=register_list_destructors(_muscat_dispose, NULL);
- return SUCCESS;
-}
-
-PHP_MSHUTDOWN_FUNCTION(muscat)
-{
-/* Remove comments if you have entries in php.ini
- UNREGISTER_INI_ENTRIES();
-*/
- return SUCCESS;
-}
-
-/* Remove if there's nothing to do at request start */
-PHP_RINIT_FUNCTION(muscat)
-{
- return SUCCESS;
-}
-
-/* Remove if there's nothing to do at request end */
-PHP_RSHUTDOWN_FUNCTION(muscat)
-{
- return SUCCESS;
-}
-
-PHP_MINFO_FUNCTION(muscat)
-{
- php_info_print_table_start();
- php_info_print_table_header(2, "muscat support", "enabled");
- php_info_print_table_row(2, "Muscat/Empower 1.5 Module for PHP version 4.0<br>Copyright (c) 2000 <a href=\"www.ananova.com\">Ananova Ltd<a/>","For information on Muscat/Empower without php see <a href=\"www.smartlogik.com\">www.smartlogik.com</a><br><small>Muscat and Empower are probably trade marks</small>");
- php_info_print_table_row(2, "muscat path", PHP_MUSCAT_DIR);
- php_info_print_table_end();
-
- /* Remove comments if you have entries in php.ini
- DISPLAY_INI_ENTRIES();
- */
-}
-
-/* {{{ _local_discard(Muscat_handle * handle) {
- This is not a user function, it throws away all muscat_get output */
-void _local_discard(struct Muscat_handle * handle) {
- while(! H_Getfrom_Muscat(handle)) {};
-}
-/* }}} */
-
-/* {{{ _discard(Muscat_handle * handle) {
- This is not a user function, it throws away all muscat_get output */
-void _discard(_muscat_handle * handle) {
- if (handle->net) _net_discard(&handle->handles.muscatnet_handle);
- else _local_discard(&handle->handles.muscat_handle);
-}
-/* }}} */
-
-
-/* {{{ proto resource setup_muscat(int size [, string muscat_dir])
- Creates a new muscat session and returns the handle. Size is the ammount of memory in bytes to allocate for muscat muscat_dir is the muscat installation dir e.g. "/usr/local/empower", it defaults to the compile time muscat directory */
-PHP_FUNCTION(muscat_setup)
-{
- zval **size_arg, **muscat_dir_arg;
- int size;
- int muscat_dir_len;
- char *muscat_dir = NULL;
- int r;
-
- _muscat_handle *handle=emalloc(sizeof(_muscat_handle));
- handle->net=0;
- handle->open=0;
-
- switch (ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &size_arg)==FAILURE) WRONG_PARAM_COUNT;
- muscat_dir=PHP_MUSCAT_DIR;
- muscat_dir_len=strlen(muscat_dir);
- break;
- case 2:
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &size_arg, &muscat_dir_arg) == FAILURE) WRONG_PARAM_COUNT;
- convert_to_string_ex(muscat_dir_arg);
- muscat_dir = Z_STRVAL_PP(muscat_dir_arg);
- muscat_dir_len = Z_STRLEN_PP(muscat_dir_arg);
- default:
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(size_arg);
- size = Z_LVAL_PP(size_arg);
-
- if (r=H_Setup_Muscat(&handle->handles.muscat_handle,size,muscat_dir,"",0)) {
- handle->open=1;
- _discard(handle);
- ZEND_REGISTER_RESOURCE(return_value, handle, le_muscat);
- } else { // destroy this failure!
- efree(handle);
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto resource setup_muscat_net(string muscat_host, int port)
- Creates a new muscat session and returns the handle. muscat_host is the hostname to connect to port is the port number to connect to - actually takes exactly the same args as fsockopen */
-PHP_FUNCTION(muscat_setup_net)
-{
- zval **socket_arg;
- _muscat_handle * handle;
- void *what;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &socket_arg) == FAILURE){
- WRONG_PARAM_COUNT;
- }
-
- if ((*socket_arg)->type!=IS_RESOURCE) {
- zend_error(E_ERROR,"First parameter must be a socket handle");
- RETURN_FALSE;
- }
-
- // Must have been successful open
- handle=emalloc(sizeof(_muscat_handle));
- memset(handle,0,sizeof(*handle));
- MAKE_STD_ZVAL(handle->handles.muscatnet_handle.socketr);
- handle->net=1;
- handle->open=1;
- // now need to store this result to keep its reference counted
- *(handle->handles.muscatnet_handle.socketr)=**socket_arg;
- zval_copy_ctor(handle->handles.muscatnet_handle.socketr);
-
- // but for our convenience extract the FD
- what=zend_fetch_resource(socket_arg,-1,"Socket-Handle",NULL,1,php_file_le_socket());
- ZEND_VERIFY_RESOURCE(what);
- handle->handles.muscatnet_handle.socketd=*(int*)what;
- php_set_sock_blocking(handle->handles.muscatnet_handle.socketd,1);
- _discard(handle);
- ZEND_REGISTER_RESOURCE(return_value, handle, le_muscat);
-}
-
-PHP_FUNCTION(muscat_setup_net_)
-{
- _muscat_handle * handle;
- void *what;
-
-// php_fsockopen(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
- if ((return_value)->type!=IS_RESOURCE) return;
-
- // Must have been successful open
- handle=emalloc(sizeof(_muscat_handle));
- memset(handle,0,sizeof(*handle));
- handle->net=1;
- handle->open=1;
- // now need to store this result to keep its reference counted
- *handle->handles.muscatnet_handle.socketr=*return_value;
- zval_copy_ctor(handle->handles.muscatnet_handle.socketr);
- // but for our convenience extract the FD
- what=zend_fetch_resource(&return_value,-1,"File-Handle",NULL,1,php_file_le_socket);
- ZEND_VERIFY_RESOURCE(what);
- handle->handles.muscatnet_handle.socketd=*(int*)what;
- _discard(handle);
- ZEND_REGISTER_RESOURCE(return_value, handle, le_muscat);
-}
-/* }}} */
-
-/* {{{ proto int muscat_give(resource muscat_handle, string string)
- Sends string to the core muscat api */
-PHP_FUNCTION(muscat_give)
-{
- zval **Muscat_handle_arg, **string_arg;
- int string_len;
- char *string = NULL;
- _muscat_handle *handle;
- int r;
- MUSCATLS_FETCH();
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &Muscat_handle_arg, &string_arg) == FAILURE){
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(handle, _muscat_handle *,
- Muscat_handle_arg, -1, MUSCAT_HANDLE_RESOURCE, le_muscat);
-
- convert_to_string_ex(string_arg);
- string = Z_STRVAL_PP(string_arg);
- string_len = Z_STRLEN_PP(string_arg);
- _discard(handle);
- if (handle->net) r=_net_muscat_give(&handle->handles.muscatnet_handle,string);
- else r=H_Give_Muscat(&handle->handles.muscat_handle,string);
-}
-/* }}} */
-
-/* {{{ proto string muscat_get(resource muscat_handle)
- Gets a line back from the core muscat api. Returns a literal FALSE when there is no more to get (as opposed to ""). Use === FALSE or !== FALSE to check for this */
-PHP_FUNCTION(muscat_get)
-{
- zval **Muscat_handle_arg;
- _muscat_handle *handle;
- int r;
- MUSCATLS_FETCH();
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &Muscat_handle_arg) == FAILURE){
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(handle, _muscat_handle *,
- Muscat_handle_arg, -1, MUSCAT_HANDLE_RESOURCE, le_muscat);
-
- if (handle->net) { // returns strings for US, no need to dup
- if (! (r=_net_muscat_get(&handle->handles.muscatnet_handle))) {
- RETURN_STRINGL(handle->handles.muscatnet_handle.muscat_response.p,
- handle->handles.muscatnet_handle.muscat_response.length,0);
- } else RETURN_FALSE;
- } else { // must dup string
- if (! (r=H_Getfrom_Muscat(&handle->handles.muscat_handle))) {
- RETURN_STRINGL(handle->handles.muscat_handle.p,
- handle->handles.muscat_handle.length,1);
- } else RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto int muscat_close(resource muscat_handle)
- Shuts down the muscat session and releases any memory back to php. [Not back to the system, note!] */
-PHP_FUNCTION(muscat_close)
-{
- zval **muscat_handle_arg;
- _muscat_handle *handle;
- MUSCATLS_FETCH();
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &muscat_handle_arg) == FAILURE){
- WRONG_PARAM_COUNT;
- }
- if ((*muscat_handle_arg)->type!=IS_RESOURCE) {
- zend_error(E_ERROR,"First parameter must be a muscat handle");
- RETURN_FALSE;
- }
-
- ZEND_FETCH_RESOURCE(handle, _muscat_handle *,
- muscat_handle_arg, -1, MUSCAT_HANDLE_RESOURCE, le_muscat);
-
- _muscat_close(handle);
- // Let destructor take care of efree!
- zend_list_delete((*muscat_handle_arg)->value.lval);
-}
-/* }}} */
-
-
-#endif /* HAVE_MUSCAT */
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/muscat/muscat.php b/ext/muscat/muscat.php
deleted file mode 100644
index 86c9db9d3d..0000000000
--- a/ext/muscat/muscat.php
+++ /dev/null
@@ -1,10 +0,0 @@
-<?
-$module = 'muscat';
-$function = 'confirm_' . $module . '_compiled';
-if (extension_loaded($module)) {
- $str = $function($module);
-} else {
- $str = "Module $module is not compiled into PHP";
-}
-echo "$str\n";
-?>
diff --git a/ext/muscat/muscat_handles.h b/ext/muscat/muscat_handles.h
deleted file mode 100644
index 47862d9a40..0000000000
--- a/ext/muscat/muscat_handles.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Muscat/Empower 1.5 Module for PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 2000 Ananova Ltd |
- | http://www.ananova.com |
- | Ananova Ltd, PO Box 36, Leeds, LS11 5ZA, United Kingdom |
- +----------------------------------------------------------------------+
- | This program is free software; you can redistribute it and/or |
- | modify it under the terms of the GNU General Public License |
- | as published by the Free Software Foundation; either version 2 |
- | of the License, or (at your option) any later version. |
- | |
- | This program is distributed in the hope that it will be useful, |
- | but WITHOUT ANY WARRANTY; without even the implied warranty of |
- | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
- | GNU General Public License for more details. |
- | |
- | You should have received a copy of the GNU General Public License |
- | along with this program; if not, write to the Free Software |
- | Foundation, Inc., 59 Temple Place - Suite 330, Boston, |
- | MA 02111-1307, USA. |
- | |
- | A copy is availble at http://www.gnu.org/copyleft/gpl.txt |
- +----------------------------------------------------------------------+
- | Author: Sam Liddicott <sam@ananova.com> |
- +----------------------------------------------------------------------+
- */
-
-
-#ifndef PHP_MUSCAT_HANDLES_H
-#define PHP_MUSCAT_HANDLES_H
-
-#if HAVE_MUSCAT
-#include <muscat.h>
-#include <muscat_net.h>
-
-typedef union _muscat_handles_union {
- struct Muscat_handle muscat_handle;
- struct MuscatNet_handle muscatnet_handle;
- struct Muscat_response muscat_response;
-} _muscat_handles;
-
-typedef struct _muscat_handle_struct {
- int open;
- int net;
- _muscat_handles handles;
-} _muscat_handle;
-
-#endif
-
-#endif /* PHP_MUSCAT_HANDLES_H */
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/muscat/muscat_net.c b/ext/muscat/muscat_net.c
deleted file mode 100644
index 9e1621d6f9..0000000000
--- a/ext/muscat/muscat_net.c
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Muscat/Empower 1.5 Module for PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 2000 Ananova Ltd |
- | http://www.ananova.com |
- | Ananova Ltd, PO Box 36, Leeds, LS11 5ZA, United Kingdom |
- +----------------------------------------------------------------------+
- | This program is free software; you can redistribute it and/or |
- | modify it under the terms of the GNU General Public License |
- | as published by the Free Software Foundation; either version 2 |
- | of the License, or (at your option) any later version. |
- | |
- | This program is distributed in the hope that it will be useful, |
- | but WITHOUT ANY WARRANTY; without even the implied warranty of |
- | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
- | GNU General Public License for more details. |
- | |
- | You should have received a copy of the GNU General Public License |
- | along with this program; if not, write to the Free Software |
- | Foundation, Inc., 59 Temple Place - Suite 330, Boston, |
- | MA 02111-1307, USA. |
- | |
- | A copy is availble at http://www.gnu.org/copyleft/gpl.txt |
- +----------------------------------------------------------------------+
- | Author: Sam Liddicott <sam@ananova.com> |
- +----------------------------------------------------------------------+
- */
-
-
-#include "php.h"
-#include "php_ini.h"
-#include "php_muscat.h"
-
-#if HAVE_MUSCAT
-#include "muscat_net.h"
-
-int _net_muscat_close(struct MuscatNet_handle *handle) {
-
-}
-
-int _net_muscat_give(struct MuscatNet_handle *handle, char* string) {
- handle->muscat_response.type=' ';
- SOCK_WRITEL(string,strlen(string),handle->socketd);
- SOCK_WRITEL("\n",1,handle->socketd);
-}
-
-int _net_muscat_get(struct MuscatNet_handle * handle) {
- char *buf;
- char *end;
- size_t ammount;
- int clen;
- int rlen;
-
- if (handle->muscat_response.type == 'P') return GIVING;
-
- // we can use bcom ourselves!!!
- // read in the 6 byte header...
- if (end=php_sock_fgets((char *)&(handle->muscat_response.bcom), 6, handle->socketd)==NULL) {
- ammount=(char *) end - (char *) (&(handle->muscat_response.bcom)) +1;
- return 1; // NEED TO RAISE ERROR HERE
- }
- ammount=strlen((char *)&(handle->muscat_response.bcom));
- if (handle->muscat_response.bcom[5]!=' ') {
- printf("%s 5 was not space but [%d]\n",&handle->muscat_response.bcom,handle->muscat_response.bcom[5]);
- return 1; // NEED TO RAISE ERROR HERE
- }
- handle->muscat_response.bcom[5]=0;
- handle->muscat_response.type=handle->muscat_response.bcom[0];
- // now read bcom[1-4] and turn to an int
- clen=atoi(&(handle->muscat_response.bcom[1]))+1;
-
- // now read length bytes in!
- buf=emalloc(clen+1);
- memset(buf,0,clen+1);
-
- if (end=php_sock_fgets(buf, clen, handle->socketd)==NULL) {
- ammount=(char *) end - (char *) (&(handle->muscat_response.bcom)) +1;
- }
- handle->muscat_response.p=buf;
- handle->muscat_response.length=strlen(buf);
- return 0;
-}
-
-void _net_discard(struct MuscatNet_handle * handle) {
- while(handle->muscat_response.type!='P') {
- if (0!=_net_muscat_get(handle)) break;
- }
-}
-
-#endif /* HAVE_MUSCAT */
diff --git a/ext/muscat/muscat_net.h b/ext/muscat/muscat_net.h
deleted file mode 100644
index 79be6039f3..0000000000
--- a/ext/muscat/muscat_net.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Muscat/Empower 1.5 Module for PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 2000 Ananova Ltd |
- | http://www.ananova.com |
- | Ananova Ltd, PO Box 36, Leeds, LS11 5ZA, United Kingdom |
- +----------------------------------------------------------------------+
- | This program is free software; you can redistribute it and/or |
- | modify it under the terms of the GNU General Public License |
- | as published by the Free Software Foundation; either version 2 |
- | of the License, or (at your option) any later version. |
- | |
- | This program is distributed in the hope that it will be useful, |
- | but WITHOUT ANY WARRANTY; without even the implied warranty of |
- | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
- | GNU General Public License for more details. |
- | |
- | You should have received a copy of the GNU General Public License |
- | along with this program; if not, write to the Free Software |
- | Foundation, Inc., 59 Temple Place - Suite 330, Boston, |
- | MA 02111-1307, USA. |
- | |
- | A copy is availble at http://www.gnu.org/copyleft/gpl.txt |
- +----------------------------------------------------------------------+
- | Author: Sam Liddicott <sam@ananova.com> |
- +----------------------------------------------------------------------+
- */
-
-
-#ifndef PHP_MUSCAT_NET_H
-#define PHP_MUSCAT_NET_H
-
-#if HAVE_MUSCAT
-
-#include "../standard/fsock.h"
-struct MuscatNet_handle {
- struct Muscat_response muscat_response;
- zval *socketr;
- int socketd;
- char buffer[1024];
-};
-
-int _net_muscat_close(struct MuscatNet_handle *handle);
-int _net_muscat_give(struct MuscatNet_handle *handle, char* string);
-int _net_muscat_get(struct MuscatNet_handle * handle);
-void _net_discard(struct MuscatNet_handle * handle);
-
-#endif
-
-#endif /* PHP_MUSCAT_NET_H */
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/muscat/php_muscat.h b/ext/muscat/php_muscat.h
deleted file mode 100644
index 4bffeeb27c..0000000000
--- a/ext/muscat/php_muscat.h
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Muscat/Empower 1.5 Module for PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 2000 Ananova Ltd |
- | http://www.ananova.com |
- | Ananova Ltd, PO Box 36, Leeds, LS11 5ZA, United Kingdom |
- +----------------------------------------------------------------------+
- | This program is free software; you can redistribute it and/or |
- | modify it under the terms of the GNU General Public License |
- | as published by the Free Software Foundation; either version 2 |
- | of the License, or (at your option) any later version. |
- | |
- | This program is distributed in the hope that it will be useful, |
- | but WITHOUT ANY WARRANTY; without even the implied warranty of |
- | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
- | GNU General Public License for more details. |
- | |
- | You should have received a copy of the GNU General Public License |
- | along with this program; if not, write to the Free Software |
- | Foundation, Inc., 59 Temple Place - Suite 330, Boston, |
- | MA 02111-1307, USA. |
- | |
- | A copy is availble at http://www.gnu.org/copyleft/gpl.txt |
- +----------------------------------------------------------------------+
- | Author: Sam Liddicott <sam@ananova.com> |
- +----------------------------------------------------------------------+
- */
-
-
-#ifndef PHP_MUSCAT_H
-#define PHP_MUSCAT_H
-
-/* You should tweak config.m4 so this symbol (or some else suitable)
- gets defined.
-*/
-#if HAVE_MUSCAT
-#include <muscat.h>
-
-#define MUSCAT_HANDLE_RESOURCE "muscat handle"
-
-extern zend_module_entry muscat_module_entry;
-#define phpext_muscat_ptr &muscat_module_entry
-
-#ifdef PHP_WIN32
-#define PHP_MUSCAT_API __declspec(dllexport)
-#else
-#define PHP_MUSCAT_API
-#endif
-
-PHP_MINIT_FUNCTION(muscat);
-PHP_MSHUTDOWN_FUNCTION(muscat);
-PHP_RINIT_FUNCTION(muscat);
-PHP_RSHUTDOWN_FUNCTION(muscat);
-PHP_MINFO_FUNCTION(muscat);
-
-PHP_FUNCTION(muscat_setup);
-PHP_FUNCTION(muscat_setup_net);
-PHP_FUNCTION(muscat_give);
-PHP_FUNCTION(muscat_get);
-PHP_FUNCTION(muscat_close);
-
-/*
- Declare any global variables you may need between the BEGIN
- and END macros here:
-*/
-ZEND_BEGIN_MODULE_GLOBALS(muscat)
-ZEND_END_MODULE_GLOBALS(muscat)
-
-/* In every function that needs to use variables in php_muscat_globals,
- do call MUSCATLS_FETCH(); after declaring other variables used by
- that function, and always refer to them as MUSCATG(variable).
- You are encouraged to rename these macros something shorter, see
- examples in any other php module directory.
-*/
-
-#ifdef ZTS
-#define MUSCATG(v) (muscat_globals->v)
-#define MUSCATLS_FETCH() php_muscat_globals *muscat_globals = ts_resource(muscat_globals_id)
-#else
-#define MUSCATG(v) (muscat_globals.v)
-#define MUSCATLS_FETCH()
-#endif
-
-#else
-
-#define phpext_muscat_ptr NULL
-
-#endif
-
-#endif /* PHP_MUSCAT_H */
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/mysql/CREDITS b/ext/mysql/CREDITS
deleted file mode 100644
index a9e6c3b00c..0000000000
--- a/ext/mysql/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-MySQL
-Zeev Suraski
diff --git a/ext/mysql/Makefile.in b/ext/mysql/Makefile.in
deleted file mode 100644
index 110388f9f5..0000000000
--- a/ext/mysql/Makefile.in
+++ /dev/null
@@ -1,10 +0,0 @@
-
-LTLIBRARY_NAME = libmysql.la
-LTLIBRARY_SOURCES = php_mysql.c
-LTLIBRARY_LIBADD = $(MYSQL_LIBADD)
-LTLIBRARY_SHARED_NAME = mysql.la
-LTLIBRARY_SHARED_LIBADD = $(MYSQL_SHARED_LIBADD)
-
-SUBDIRS = $(MYSQL_SUBDIRS)
-
-include $(top_srcdir)/build/dynlib.mk
diff --git a/ext/mysql/config.m4 b/ext/mysql/config.m4
deleted file mode 100644
index 2e4cf29d91..0000000000
--- a/ext/mysql/config.m4
+++ /dev/null
@@ -1,100 +0,0 @@
-dnl $Id$
-
-sinclude(ext/mysql/libmysql/acinclude.m4)
-sinclude(ext/mysql/libmysql/mysql.m4)
-sinclude(libmysql/acinclude.m4)
-sinclude(libmysql/mysql.m4)
-
-AC_DEFUN(MYSQL_LIB_CHK,[
- str="$MYSQL_DIR/$1/libmysqlclient.*"
- for j in `echo $str`; do
- if test -r $j; then
- MYSQL_LIB_DIR=$MYSQL_DIR/$1
- break 2
- fi
- done
-])
-
-AC_DEFUN(PHP_MYSQL_SOCK,[
- AC_MSG_CHECKING(for MySQL UNIX socket)
- MYSQL_SOCK=/tmp/mysql.sock
- for i in \
- /var/run/mysqld/mysqld.sock \
- /var/tmp/mysql.sock \
- /var/lib/mysql/mysql.sock \
- /var/mysql/mysql.sock \
- ; do
- if test -r $i; then
- MYSQL_SOCK=$i
- fi
- done
- AC_DEFINE_UNQUOTED(MYSQL_UNIX_ADDR, "$MYSQL_SOCK", [ ])
- AC_MSG_RESULT($MYSQL_SOCK)
-])
-
-PHP_ARG_WITH(mysql, for MySQL support,
-[ --with-mysql[=DIR] Include MySQL support. DIR is the MySQL base
- directory. If unspecified, the bundled MySQL library
- will be used.], yes)
-
-if test "$PHP_MYSQL" != "no"; then
- AC_DEFINE(HAVE_MYSQL, 1, [Whether you have MySQL])
- PHP_EXTENSION(mysql,$ext_shared)
-fi
-
-if test "$PHP_MYSQL" = "yes"; then
- PHP_MYSQL_SOCK
- MYSQL_CHECKS
- MYSQL_LIBADD=libmysql/libmysql_client.la
- MYSQL_SHARED_LIBADD=libmysql/libmysql_client.la
- MYSQL_SUBDIRS=libmysql
- PHP_SUBST(MYSQL_LIBADD)
- PHP_SUBST(MYSQL_SUBDIRS)
- LIB_BUILD($ext_builddir/libmysql,$ext_shared,yes)
- PHP_ADD_INCLUDE($ext_srcdir/libmysql)
- MYSQL_MODULE_TYPE=builtin
-elif test "$PHP_MYSQL" != "no"; then
- for i in $PHP_MYSQL; do
- if test -r $i/include/mysql/mysql.h; then
- MYSQL_DIR=$i
- MYSQL_INC_DIR=$i/include/mysql
- elif test -r $i/include/mysql.h; then
- MYSQL_DIR=$i
- MYSQL_INC_DIR=$i/include
- fi
- done
-
- if test -z "$MYSQL_DIR"; then
- AC_MSG_ERROR(Cannot find header files under $PHP_MYSQL)
- fi
-
- MYSQL_MODULE_TYPE=external
-
- for i in lib lib/mysql; do
- MYSQL_LIB_CHK($i)
- done
-
- if test -z "$MYSQL_LIB_DIR"; then
- AC_MSG_ERROR(Cannot find mysqlclient library under $MYSQL_DIR)
- fi
-
- if test "$PHP_ZLIB_DIR" != "no"; then
- PHP_ADD_LIBRARY(z,, MYSQL_SHARED_LIBADD)
- MYSQL_LIBS="-L$PHP_ZLIB_DIR -z"
- fi
-
- PHP_ADD_LIBRARY_WITH_PATH(mysqlclient, $MYSQL_LIB_DIR, MYSQL_SHARED_LIBADD)
- MYSQL_LIBS="-L$MYSQL_LIB_DIR -lmysqlclient $MYSQL_LIBS"
-
- PHP_ADD_INCLUDE($MYSQL_INC_DIR)
- MYSQL_INCLUDE="-I$MYSQL_INC_DIR"
- PHP_MYSQL_SOCK
-
-else
- MYSQL_MODULE_TYPE=none
-fi
-
-PHP_SUBST(MYSQL_SHARED_LIBADD)
-PHP_SUBST_OLD(MYSQL_MODULE_TYPE)
-PHP_SUBST_OLD(MYSQL_LIBS)
-PHP_SUBST_OLD(MYSQL_INCLUDE)
diff --git a/ext/mysql/libmysql/Makefile.in b/ext/mysql/libmysql/Makefile.in
deleted file mode 100644
index e40915d13d..0000000000
--- a/ext/mysql/libmysql/Makefile.in
+++ /dev/null
@@ -1,16 +0,0 @@
-
-LTLIBRARY_NAME = libmysql_client.la
-LTLIBRARY_SOURCES = libmysql.c errmsg.c net.c violite.c password.c \
- my_init.c my_lib.c my_static.c my_malloc.c my_realloc.c my_create.c \
- my_delete.c my_tempnam.c my_open.c mf_casecnv.c my_read.c \
- my_write.c errors.c my_error.c my_getwd.c my_div.c mf_pack.c \
- my_messnc.c mf_dirname.c mf_fn_ext.c mf_wcomp.c typelib.c safemalloc.c \
- my_alloc.c mf_format.c mf_path.c mf_unixpath.c my_fopen.c mf_loadpath.c \
- my_pthread.c my_thr_init.c thr_mutex.c mulalloc.c string.c default.c \
- my_compress.c array.c my_once.c list.c my_net.c dbug.c \
- strmov.c strxmov.c strnmov.c strmake.c strend.c strfill.c \
- is_prefix.c int2str.c str2int.c strinstr.c \
- strcont.c strcend.c bchange.c bmove.c bmove_upp.c \
- longlong2str.c strtoull.c strtoll.c charset.c ctype.c
-
-include $(top_srcdir)/build/dynlib.mk
diff --git a/ext/mysql/libmysql/acinclude.m4 b/ext/mysql/libmysql/acinclude.m4
deleted file mode 100644
index 0fb030b803..0000000000
--- a/ext/mysql/libmysql/acinclude.m4
+++ /dev/null
@@ -1,355 +0,0 @@
-# Local macros for automake & autoconf
-
-AC_DEFUN(MYSQL_FUNCTION_CHECKS,[
-
-# Standard MySQL list
-AC_CHECK_FUNCS(alarm bmove \
- chsize ftruncate rint finite fpsetmask fpresetsticky\
- cuserid fcntl fconvert \
- getrusage getpwuid getcwd getrlimit getwd index locking longjmp \
- perror pread realpath rename \
- socket strnlen madvise \
- strtoul strtoull snprintf tempnam thr_setconcurrency \
- gethostbyaddr_r gethostbyname_r getpwnam \
- bfill bzero bcmp strstr strpbrk strerror\
- tell atod memcpy memmove \
- setupterm strcasecmp sighold \
- vidattr setupterm lrand48 localtime_r \
- sigset sigthreadmask pthread_sigmask pthread_setprio pthread_setprio_np \
- pthread_setschedparam pthread_attr_setprio pthread_attr_setschedparam \
- pthread_attr_create pthread_getsequence_np pthread_attr_setstacksize \
- pthread_condattr_create rwlock_init \
- crypt dlopen dlerror fchmod getpass getpassphrase)
-
-# This is special for libmysql
-AC_CHECK_FUNCS(strtok_r)
-
-MYSQL_CHECK_GETHOSTNAME_R
-])
-
-AC_DEFUN(MYSQL_CHECK_GETHOSTNAME_R,[
-# Check definition of gethostbyname_r (glibc2.0.100 is different from Solaris)
-ac_save_CXXFLAGS="$CXXFLAGS"
-AC_CACHE_CHECK([style of gethostname_r routines], mysql_cv_gethostname_style,
-AC_LANG_SAVE
-AC_LANG_CPLUSPLUS
-if test "$ac_cv_prog_gxx" = "yes"
-then
- CXXFLAGS="$CXXFLAGS -Werror"
-fi
-AC_TRY_COMPILE(
-[#if !defined(SCO) && !defined(__osf__)
-#define _REENTRANT
-#endif
-#include <pthread.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <netdb.h>],
-[int skr;
-
- skr = gethostbyname_r((const char *) 0,
- (struct hostent*) 0, (char*) 0, 0, (struct hostent **) 0, &skr);],
-mysql_cv_gethostname_style=glibc2, mysql_cv_gethostname_style=other))
-AC_LANG_RESTORE
-CXXFLAGS="$ac_save_CXXFLAGS"
-if test "$mysql_cv_gethostname_style" = "glibc2"
-then
- AC_DEFINE(HAVE_GETHOSTBYNAME_R_GLIBC2_STYLE, , [ ])
-fi
-
-# Check 3rd argument of getthostbyname_r
-ac_save_CXXFLAGS="$CXXFLAGS"
-AC_CACHE_CHECK([3 argument to gethostname_r routines], mysql_cv_gethostname_arg,
-AC_LANG_SAVE
-AC_LANG_CPLUSPLUS
-if test "$ac_cv_prog_gxx" = "yes"
-then
- CXXFLAGS="$CXXFLAGS -Werror"
-fi
-AC_TRY_COMPILE(
-[#if !defined(SCO) && !defined(__osf__)
-#define _REENTRANT
-#endif
-#include <pthread.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <netdb.h>],
-[int skr;
-
- skr = gethostbyname_r((const char *) 0, (struct hostent*) 0, (hostent_data*) 0);],
-mysql_cv_gethostname_arg=hostent_data, mysql_cv_gethostname_arg=char))
-AC_LANG_RESTORE
-CXXFLAGS="$ac_save_CXXFLAGS"
-if test "$mysql_cv_gethostname_arg" = "hostent_data"
-then
- AC_DEFINE(HAVE_GETHOSTBYNAME_R_RETURN_INT, , [ ])
-fi
-])
-
-AC_DEFUN(MYSQL_CHECK_SIGWAIT_STYLE,[
-# Check definition av posix sigwait()
-AC_CACHE_CHECK("style of sigwait", mysql_cv_sigwait,
-AC_TRY_LINK(
-[#ifndef SCO
-#define _REENTRANT
-#endif
-#define _POSIX_PTHREAD_SEMANTICS
-#include <pthread.h>
-#include <signal.h>],
-[#ifndef _AIX
-sigset_t set;
-int sig;
-sigwait(&set,&sig);
-#endif],
-mysql_cv_sigwait=POSIX, mysql_cv_sigwait=other))
-if test "$mysql_cv_sigwait" = "POSIX"
-then
- AC_DEFINE(HAVE_SIGWAIT,,[ ])
-fi
-
-if test "$mysql_cv_sigwait" != "POSIX"
-then
-unset mysql_cv_sigwait
-# Check definition av posix sigwait()
-AC_CACHE_CHECK("style of sigwait", mysql_cv_sigwait,
-AC_TRY_LINK(
-[#ifndef SCO
-#define _REENTRANT
-#endif
-#define _POSIX_PTHREAD_SEMANTICS
-#include <pthread.h>
-#include <signal.h>],
-[sigset_t set;
-int sig;
-sigwait(&set);],
-mysql_cv_sigwait=NONPOSIX, mysql_cv_sigwait=other))
-if test "$mysql_cv_sigwait" = "NONPOSIX"
-then
- AC_DEFINE(HAVE_NONPOSIX_SIGWAIT,,[ ])
-fi
-fi
-])
-
-AC_DEFUN(MYSQL_CHECK_READDIR_R_ARGS,[
-# Check definition of readdir_r
-AC_CACHE_CHECK("args to readdir_r", mysql_cv_readdir_r,
-AC_TRY_LINK(
-[#ifndef SCO
-#define _REENTRANT
-#endif
-#define _POSIX_PTHREAD_SEMANTICS
-#include <pthread.h>
-#include <dirent.h>],
-[ int readdir_r(DIR *dirp, struct dirent *entry, struct dirent **result);
-readdir_r((DIR *) NULL, (struct dirent *) NULL, (struct dirent **) NULL); ],
-mysql_cv_readdir_r=POSIX, mysql_cv_readdir_r=other))
-if test "$mysql_cv_readdir_r" = "POSIX"
-then
- AC_DEFINE(HAVE_READDIR_R,,[ ])
-fi
-])
-
-AC_DEFUN(MYSQL_CHECK_PTHREAD_MUTEX_INIT,[
- # Check definition of pthread_mutex_init
- AC_CACHE_CHECK("args to pthread_mutex_init", mysql_cv_mutex_init_args,
- AC_TRY_COMPILE(
-[#ifndef SCO
-#define _REENTRANT
-#endif
-#define _POSIX_PTHREAD_SEMANTICS
-#include <pthread.h> ],
-[
- pthread_mutexattr_t attr;
- pthread_mutex_t mp;
- pthread_mutex_init(&mp,&attr); ],
-mysql_cv_mutex_init_args=POSIX, mysql_cv_mutex_init_args=other))
- if test "$mysql_cv_mutex_init_args" = "other"
- then
- AC_DEFINE(HAVE_NONPOSIX_PTHREAD_MUTEX_INIT,,[ ])
- fi
-])
-
-AC_DEFUN(MYSQL_CHECK_PTHREAD_GETSPECIFIC,[
- # Check definition of pthread_getspecific
- AC_CACHE_CHECK("args to pthread_getspecific", mysql_cv_getspecific_args,
- AC_TRY_COMPILE(
-[#ifndef SCO
-#define _REENTRANT
-#endif
-#define _POSIX_PTHREAD_SEMANTICS
-#include <pthread.h> ],
-[ void *pthread_getspecific(pthread_key_t key);
-pthread_getspecific((pthread_key_t) NULL); ],
-mysql_cv_getspecific_args=POSIX, mysql_cv_getspecific_args=other))
- if test "$mysql_cv_getspecific_args" = "other"
- then
- AC_DEFINE(HAVE_NONPOSIX_PTHREAD_GETSPECIFIC,,[ ])
- fi
-])
-
-AC_DEFUN(MYSQL_TYPE_ACCEPT,
-[ac_save_CXXFLAGS="$CXXFLAGS"
-AC_CACHE_CHECK([base type of last arg to accept], mysql_cv_btype_last_arg_accept,
-AC_LANG_SAVE
-AC_LANG_CPLUSPLUS
-if test "$ac_cv_prog_gxx" = "yes"
-then
- CXXFLAGS="$CXXFLAGS -Werror"
-fi
-mysql_cv_btype_last_arg_accept=none
-[AC_TRY_COMPILE([#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-],
-[int a = accept(1, (struct sockaddr *) 0, (socklen_t *) 0);],
-mysql_cv_btype_last_arg_accept=socklen_t)]
-if test $mysql_cv_btype_last_arg_accept = none; then
-[AC_TRY_COMPILE([#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-],
-[int a = accept(1, (struct sockaddr *) 0, (size_t *) 0);],
-mysql_cv_btype_last_arg_accept=size_t)]
-fi
-if test $mysql_cv_btype_last_arg_accept = none; then
-mysql_cv_btype_last_arg_accept=int
-fi)
-AC_LANG_RESTORE
-AC_DEFINE_UNQUOTED(SOCKET_SIZE_TYPE, $mysql_cv_btype_last_arg_accept,[ ])
-CXXFLAGS="$ac_save_CXXFLAGS"
-])
-
-dnl Find type of qsort
-AC_DEFUN(MYSQL_TYPE_QSORT,
-[AC_CACHE_CHECK([return type of qsort], mysql_cv_type_qsort,
-[AC_TRY_COMPILE([#include <stdlib.h>
-#ifdef __cplusplus extern "C"
-#endif
-void qsort(void *base, size_t nel, size_t width,
- int (*compar) (const void *, const void *));
-],
-[int i;], mysql_cv_type_qsort=void, mysql_cv_type_qsort=int)])
-AC_DEFINE_UNQUOTED(RETQSORTTYPE, $mysql_cv_type_qsort, [ ])
-if test "$mysql_cv_type_qsort" = "void"
-then
- AC_DEFINE_UNQUOTED(QSORT_TYPE_IS_VOID, 1, [ ])
-fi ])
-
-
-#---START: Used in for client configure
-AC_DEFUN(MYSQL_CHECK_ULONG,
-[AC_MSG_CHECKING(for type ulong)
-AC_CACHE_VAL(ac_cv_ulong,
-[AC_TRY_RUN([#include <stdio.h>
-#include <sys/types.h>
-main()
-{
- ulong foo;
- foo++;
- exit(0);
-}], ac_cv_ulong=yes, ac_cv_ulong=no, ac_cv_ulong=no)])
-AC_MSG_RESULT($ac_cv_ulong)
-if test "$ac_cv_ulong" = "yes"
-then
- AC_DEFINE(HAVE_ULONG,,[ ])
-fi
-])
-
-AC_DEFUN(MYSQL_CHECK_UCHAR,
-[AC_MSG_CHECKING(for type uchar)
-AC_CACHE_VAL(ac_cv_uchar,
-[AC_TRY_RUN([#include <stdio.h>
-#include <sys/types.h>
-main()
-{
- uchar foo;
- foo++;
- exit(0);
-}], ac_cv_uchar=yes, ac_cv_uchar=no, ac_cv_uchar=no)])
-AC_MSG_RESULT($ac_cv_uchar)
-if test "$ac_cv_uchar" = "yes"
-then
- AC_DEFINE(HAVE_UCHAR,,[ ])
-fi
-])
-
-AC_DEFUN(MYSQL_CHECK_UINT,
-[AC_MSG_CHECKING(for type uint)
-AC_CACHE_VAL(ac_cv_uint,
-[AC_TRY_RUN([#include <stdio.h>
-#include <sys/types.h>
-main()
-{
- uint foo;
- foo++;
- exit(0);
-}], ac_cv_uint=yes, ac_cv_uint=no, ac_cv_uint=no)])
-AC_MSG_RESULT($ac_cv_uint)
-if test "$ac_cv_uint" = "yes"
-then
- AC_DEFINE(HAVE_UINT,,[ ])
-fi
-])
-
-AC_DEFUN(MYSQL_CHECK_INT_8_16_32,
-[AC_MSG_CHECKING([for int8])
-AC_TRY_RUN([
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
-
-#ifdef HAVE_STDDEF_H
-#include <stddef.h>
-#endif
-
-#ifdef HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-
-int main()
-{
- int8 i;
- return 0;
-}
-], AC_DEFINE(HAVE_INT_8_16_32, , [ ]) AC_MSG_RESULT([yes]), AC_MSG_RESULT([no])
-)
-])
-
-AC_DEFUN(MYSQL_HEADER_CHECKS,[
-AC_HEADER_STDC
-AC_CHECK_HEADERS(sgtty.h sys/ioctl.h \
- fcntl.h float.h floatingpoint.h ieeefp.h limits.h \
- memory.h pwd.h select.h \
- stdlib.h stddef.h \
- strings.h string.h synch.h sys/mman.h sys/socket.h \
- sys/timeb.h sys/types.h sys/un.h sys/vadvise.h sys/wait.h term.h \
- unistd.h utime.h sys/utime.h termio.h termios.h sched.h crypt.h alloca.h)
-])
-
-AC_DEFUN(MYSQL_TYPE_CHECKS,[
-
-AC_REQUIRE([AC_C_CONST])
-AC_REQUIRE([AC_C_INLINE])
-AC_CHECK_SIZEOF(char, 1)
-
-AC_CHECK_SIZEOF(int, 4)
-AC_CHECK_SIZEOF(long, 4)
-AC_CHECK_SIZEOF(long long, 8)
-AC_TYPE_SIZE_T
-AC_HEADER_TIME
-AC_TYPE_UID_T
-
-MYSQL_CHECK_ULONG
-MYSQL_CHECK_UCHAR
-MYSQL_CHECK_UINT
-MYSQL_CHECK_INT_8_16_32
-
-MYSQL_TYPE_ACCEPT
-MYSQL_TYPE_QSORT
-
-AC_REQUIRE([AC_TYPE_SIGNAL])
-])
diff --git a/ext/mysql/libmysql/array.c b/ext/mysql/libmysql/array.c
deleted file mode 100644
index dcf1cb07b4..0000000000
--- a/ext/mysql/libmysql/array.c
+++ /dev/null
@@ -1,163 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-/* Handling of arrays that can grow dynamicly. */
-
-#if defined(WIN32) || defined(__WIN__)
-#undef SAFEMALLOC /* Problems with threads */
-#endif
-
-#include "mysys_priv.h"
-#include "m_string.h"
-
-/*
- Initiate array and alloc space for init_alloc elements. Array is usable
- even if space allocation failed
-*/
-
-my_bool init_dynamic_array(DYNAMIC_ARRAY *array, uint element_size,
- uint init_alloc, uint alloc_increment)
-{
- DBUG_ENTER("init_dynamic_array");
- if (!alloc_increment)
- {
- alloc_increment=max((8192-MALLOC_OVERHEAD)/element_size,16);
- if (init_alloc > 8 && alloc_increment > init_alloc * 2)
- alloc_increment=init_alloc*2;
- }
-
- if (!init_alloc)
- init_alloc=alloc_increment;
- array->elements=0;
- array->max_element=init_alloc;
- array->alloc_increment=alloc_increment;
- array->size_of_element=element_size;
- if (!(array->buffer=(char*) my_malloc(element_size*init_alloc,MYF(MY_WME))))
- {
- array->max_element=0;
- DBUG_RETURN(TRUE);
- }
- DBUG_RETURN(FALSE);
-}
-
-
-my_bool insert_dynamic(DYNAMIC_ARRAY *array, gptr element)
-{
- gptr buffer;
- if (array->elements == array->max_element)
- { /* Call only when nessesary */
- if (!(buffer=alloc_dynamic(array)))
- return TRUE;
- }
- else
- {
- buffer=array->buffer+(array->elements * array->size_of_element);
- array->elements++;
- }
- memcpy(buffer,element,(size_t) array->size_of_element);
- return FALSE;
-}
-
-
- /* Alloc room for one element */
-
-byte *alloc_dynamic(DYNAMIC_ARRAY *array)
-{
- if (array->elements == array->max_element)
- {
- char *new_ptr;
- if (!(new_ptr=(char*) my_realloc(array->buffer,(array->max_element+
- array->alloc_increment)*
- array->size_of_element,
- MYF(MY_WME | MY_ALLOW_ZERO_PTR))))
- return 0;
- array->buffer=new_ptr;
- array->max_element+=array->alloc_increment;
- }
- return array->buffer+(array->elements++ * array->size_of_element);
-}
-
-
- /* remove last element from array and return it */
-
-byte *pop_dynamic(DYNAMIC_ARRAY *array)
-{
- if (array->elements)
- return array->buffer+(--array->elements * array->size_of_element);
- return 0;
-}
-
-
-my_bool set_dynamic(DYNAMIC_ARRAY *array, gptr element, uint idx)
-{
- if (idx >= array->elements)
- {
- if (idx >= array->max_element)
- {
- uint size;
- char *new_ptr;
- size=(idx+array->alloc_increment)/array->alloc_increment;
- size*= array->alloc_increment;
- if (!(new_ptr=(char*) my_realloc(array->buffer,size*
- array->size_of_element,
- MYF(MY_WME | MY_ALLOW_ZERO_PTR))))
- return TRUE;
- array->buffer=new_ptr;
- array->max_element=size;
- }
- bzero((gptr) (array->buffer+array->elements*array->size_of_element),
- (idx - array->elements)*array->size_of_element);
- array->elements=idx+1;
- }
- memcpy(array->buffer+(idx * array->size_of_element),element,
- (size_t) array->size_of_element);
- return FALSE;
-}
-
-
-void get_dynamic(DYNAMIC_ARRAY *array, gptr element, uint idx)
-{
- if (idx >= array->elements)
- {
- DBUG_PRINT("warning",("To big array idx: %d, array size is %d",
- idx,array->elements));
- bzero(element,array->size_of_element);
- return;
- }
- memcpy(element,array->buffer+idx*array->size_of_element,
- (size_t) array->size_of_element);
-}
-
-
-void delete_dynamic(DYNAMIC_ARRAY *array)
-{
- if (array->buffer)
- {
- my_free(array->buffer,MYF(MY_WME));
- array->buffer=0;
- array->elements=array->max_element=0;
- }
-}
-
-
-void delete_dynamic_element(DYNAMIC_ARRAY *array, uint idx)
-{
- char *ptr=array->buffer+array->size_of_element*idx;
- array->elements--;
- memmove(ptr,ptr+array->size_of_element,
- (array->elements-idx)*array->size_of_element);
-}
-
-
-void freeze_size(DYNAMIC_ARRAY *array)
-{
- uint elements=max(array->elements,1);
-
- if (array->buffer && array->max_element != elements)
- {
- array->buffer=(char*) my_realloc(array->buffer,
- elements*array->size_of_element,
- MYF(MY_WME));
- array->max_element=elements;
- }
-}
diff --git a/ext/mysql/libmysql/bchange.c b/ext/mysql/libmysql/bchange.c
deleted file mode 100644
index 95d363d52d..0000000000
--- a/ext/mysql/libmysql/bchange.c
+++ /dev/null
@@ -1,25 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-/* File : bchange.c
- Author : Michael widenius
- Updated: 1987-03-20
- Defines: bchange()
-
- bchange(dst, old_length, src, new_length, tot_length)
- replaces old_length characters at dst to new_length characters from
- src in a buffer with tot_length bytes.
-*/
-
-#include <global.h>
-#include "m_string.h"
-
-void bchange(register char *dst, uint old_length, register const char *src, uint new_length, uint tot_length)
-{
- uint rest=tot_length-old_length;
- if (old_length < new_length)
- bmove_upp(dst+rest+new_length,dst+tot_length,rest);
- else
- bmove(dst+new_length,dst+old_length,rest);
- memcpy(dst,src,new_length);
-}
diff --git a/ext/mysql/libmysql/bmove.c b/ext/mysql/libmysql/bmove.c
deleted file mode 100644
index f63ff0bd4f..0000000000
--- a/ext/mysql/libmysql/bmove.c
+++ /dev/null
@@ -1,63 +0,0 @@
-/* File : bmove.c
- Author : Richard A. O'Keefe.
- Michael Widenius; ifdef MC68000
- Updated: 23 April 1984
- Defines: bmove()
-
- bmove(dst, src, len) moves exactly "len" bytes from the source "src"
- to the destination "dst". It does not check for NUL characters as
- strncpy() and strnmov() do. Thus if your C compiler doesn't support
- structure assignment, you can simulate it with
- bmove(&to, &from, sizeof from);
- The standard 4.2bsd routine for this purpose is bcopy. But as bcopy
- has its first two arguments the other way around you may find this a
- bit easier to get right.
- No value is returned.
-
- Note: the "b" routines are there to exploit certain VAX order codes,
- but the MOVC3 instruction will only move 65535 characters. The asm
- code is presented for your interest and amusement.
-*/
-
-#include <global.h>
-#include "m_string.h"
-
-#if !defined(HAVE_BMOVE) && !defined(bmove)
-
-#if VaxAsm
-
-void bmove(dst, src, len)
- char *dst, *src;
- uint len;
- {
- asm("movc3 12(ap),*8(ap),*4(ap)");
- }
-
-#else
-#if defined(MC68000) && defined(DS90)
-
-void bmove(dst, src, len)
-char *dst,*src;
-uint len; /* 0 <= len <= 65535 */
-{
-asm(" movl 12(a7),d0 ");
-asm(" subql #1,d0 ");
-asm(" blt .L5 ");
-asm(" movl 4(a7),a1 ");
-asm(" movl 8(a7),a0 ");
-asm(".L4: movb (a0)+,(a1)+ ");
-asm(" dbf d0,.L4 ");
-asm(".L5: ");
-}
-#else
-
-void bmove(dst, src, len)
-register char *dst;
-register const char *src;
-register uint len;
-{
- while (len-- != 0) *dst++ = *src++;
-}
-#endif
-#endif
-#endif
diff --git a/ext/mysql/libmysql/bmove_upp.c b/ext/mysql/libmysql/bmove_upp.c
deleted file mode 100644
index e10f6978f7..0000000000
--- a/ext/mysql/libmysql/bmove_upp.c
+++ /dev/null
@@ -1,37 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-/* File : bmove.c
- Author : Michael widenius
- Updated: 1987-03-20
- Defines: bmove_upp()
-
- bmove_upp(dst, src, len) moves exactly "len" bytes from the source
- "src-len" to the destination "dst-len" counting downwards.
-*/
-
-#include <global.h>
-#include "m_string.h"
-
-#if defined(MC68000) && defined(DS90)
-
-/* 0 <= len <= 65535 */
-void bmove_upp(byte *dst, const byte *src,uint len)
-{
-asm(" movl 12(a7),d0 ");
-asm(" subql #1,d0 ");
-asm(" blt .L5 ");
-asm(" movl 4(a7),a1 ");
-asm(" movl 8(a7),a0 ");
-asm(".L4: movb -(a0),-(a1) ");
-asm(" dbf d0,.L4 ");
-asm(".L5: ");
-}
-#else
-
-void bmove_upp(register char *dst, register const char *src, register uint len)
-{
- while (len-- != 0) *--dst = *--src;
-}
-
-#endif
diff --git a/ext/mysql/libmysql/charset.c b/ext/mysql/libmysql/charset.c
deleted file mode 100644
index 85a09314cd..0000000000
--- a/ext/mysql/libmysql/charset.c
+++ /dev/null
@@ -1,550 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-#include "mysys_priv.h"
-#include "mysys_err.h"
-#include <m_ctype.h>
-#include <m_string.h>
-#include <my_dir.h>
-
-typedef struct cs_id_st {
- char *name;
- uint number;
-} CS_ID;
-
-const char *charsets_dir = NULL;
-static DYNAMIC_ARRAY cs_info_table;
-static CS_ID **available_charsets;
-static int charset_initialized=0;
-
-#define MAX_LINE 1024
-
-#define CTYPE_TABLE_SIZE 257
-#define TO_LOWER_TABLE_SIZE 256
-#define TO_UPPER_TABLE_SIZE 256
-#define SORT_ORDER_TABLE_SIZE 256
-
-struct simpleconfig_buf_st {
- FILE *f;
- char buf[MAX_LINE];
- char *p;
-};
-
-/* Defined in strings/ctype.c */
-
-CHARSET_INFO *find_compiled_charset(uint cs_number);
-uint compiled_charset_number(const char *name);
-const char *compiled_charset_name(uint charset_number);
-
-
-static uint num_from_csname(CS_ID **cs, const char *name)
-{
- CS_ID **c;
- for (c = cs; *c; ++c)
- if (!strcmp((*c)->name, name))
- return (*c)->number;
- return 0; /* this mimics find_type() */
-}
-
-static char *name_from_csnum(CS_ID **cs, uint number)
-{
- CS_ID **c;
- if(cs)
- for (c = cs; *c; ++c)
- if ((*c)->number == number)
- return (*c)->name;
- return (char*) "?"; /* this mimics find_type() */
-}
-
-static my_bool get_word(struct simpleconfig_buf_st *fb, char *buf)
-{
- char *endptr=fb->p;
-
- for (;;)
- {
- while (isspace(*endptr))
- ++endptr;
- if (*endptr && *endptr != '#') /* Not comment */
- break; /* Found something */
- if ((fgets(fb->buf, sizeof(fb->buf), fb->f)) == NULL)
- return TRUE; /* end of file */
- endptr = fb->buf;
- }
-
- while (!isspace(*endptr))
- *buf++= *endptr++;
- *buf=0;
- fb->p = endptr;
-
- return FALSE;
-}
-
-
-char *get_charsets_dir(char *buf)
-{
- const char *sharedir = SHAREDIR;
- DBUG_ENTER("get_charsets_dir");
-
- if (charsets_dir != NULL)
- strmake(buf, charsets_dir, FN_REFLEN-1);
- else
- {
- if (test_if_hard_path(sharedir) ||
- is_prefix(sharedir, DEFAULT_CHARSET_HOME))
- strxmov(buf, sharedir, "/", CHARSET_DIR, NullS);
- else
- strxmov(buf, DEFAULT_CHARSET_HOME, "/", sharedir, "/", CHARSET_DIR,
- NullS);
- }
- convert_dirname(buf);
- DBUG_PRINT("info",("charsets dir='%s'", buf));
- DBUG_RETURN(strend(buf));
-}
-
-
-static my_bool read_charset_index(CS_ID ***charsets, myf myflags)
-{
- struct simpleconfig_buf_st fb;
- char buf[MAX_LINE], num_buf[MAX_LINE];
- DYNAMIC_ARRAY cs;
- CS_ID *csid;
-
- strmov(get_charsets_dir(buf), "Index");
-
- if ((fb.f = my_fopen(buf, O_RDONLY, myflags)) == NULL)
- return TRUE;
- fb.buf[0] = '\0';
- fb.p = fb.buf;
-
- if (init_dynamic_array(&cs, sizeof(CS_ID *), 32, 32))
- return TRUE;
-
- while (!get_word(&fb, buf) && !get_word(&fb, num_buf))
- {
- uint csnum;
- uint length;
-
- if (!(csnum = atoi(num_buf)))
- {
- /* corrupt Index file */
- my_fclose(fb.f,myflags);
- return TRUE;
- }
-
- if (!(csid = (CS_ID*) my_once_alloc(sizeof(CS_ID), myflags)) ||
- !(csid->name=
- (char*) my_once_alloc(length= (uint) strlen(buf)+1, myflags)))
- {
- my_fclose(fb.f,myflags);
- return TRUE;
- }
- memcpy(csid->name,buf,length);
- csid->number = csnum;
-
- insert_dynamic(&cs, (gptr) &csid);
- }
- my_fclose(fb.f,myflags);
-
-
- if (!(*charsets =
- (CS_ID **) my_once_alloc((cs.elements + 1) * sizeof(CS_ID *), myflags)))
- return TRUE;
- /* unwarranted chumminess with dynamic_array implementation? */
- memcpy((byte *) *charsets, cs.buffer, cs.elements * sizeof(CS_ID *));
- (*charsets)[cs.elements] = NULL;
- delete_dynamic(&cs);
-
- return FALSE;
-}
-
-
-static my_bool init_available_charsets(myf myflags)
-{
- my_bool error=0;
- /*
- We have to use charset_initialized to not lock on THR_LOCK_charset
- inside get_internal_charset...
- */
- if (!charset_initialized)
- {
- /*
- To make things thread safe we are not allowing other threads to interfere
- while we may changing the cs_info_table
- */
- pthread_mutex_lock(&THR_LOCK_charset);
- if (!cs_info_table.buffer) /* If not initialized */
- {
- init_dynamic_array(&cs_info_table, sizeof(CHARSET_INFO*), 16, 8);
- error = read_charset_index(&available_charsets, myflags);
- }
- charset_initialized=1;
- pthread_mutex_unlock(&THR_LOCK_charset);
- }
- if(!available_charsets || !available_charsets[0])
- error = TRUE;
- return error;
-}
-
-
-void free_charsets(void)
-{
- delete_dynamic(&cs_info_table);
-}
-
-
-static my_bool fill_array(uchar *array, int sz, struct simpleconfig_buf_st *fb)
-{
- char buf[MAX_LINE];
- while (sz--)
- {
- if (get_word(fb, buf))
- {
- DBUG_PRINT("error",("get_word failed, expecting %d more words", sz + 1));
- return 1;
- }
- *array++ = (uchar) strtol(buf, NULL, 16);
- }
- return 0;
-}
-
-
-static void get_charset_conf_name(uint cs_number, char *buf)
-{
- strxmov(get_charsets_dir(buf),
- name_from_csnum(available_charsets, cs_number), ".conf", NullS);
-}
-
-
-static my_bool read_charset_file(uint cs_number, CHARSET_INFO *set,
- myf myflags)
-{
- struct simpleconfig_buf_st fb;
- char buf[FN_REFLEN];
- my_bool result;
- DBUG_ENTER("read_charset_file");
- DBUG_PRINT("enter",("cs_number: %d", cs_number));
-
- if (cs_number <= 0)
- DBUG_RETURN(TRUE);
-
- get_charset_conf_name(cs_number, buf);
- DBUG_PRINT("info",("file name: %s", buf));
-
- if ((fb.f = my_fopen(buf, O_RDONLY, myflags)) == NULL)
- DBUG_RETURN(TRUE);
-
- fb.buf[0] = '\0'; /* Init for get_word */
- fb.p = fb.buf;
-
- result=FALSE;
- if (fill_array(set->ctype, CTYPE_TABLE_SIZE, &fb) ||
- fill_array(set->to_lower, TO_LOWER_TABLE_SIZE, &fb) ||
- fill_array(set->to_upper, TO_UPPER_TABLE_SIZE, &fb) ||
- fill_array(set->sort_order, SORT_ORDER_TABLE_SIZE, &fb))
- result=TRUE;
-
- my_fclose(fb.f, MYF(0));
- DBUG_RETURN(result);
-}
-
-
-uint get_charset_number(const char *charset_name)
-{
- my_bool error;
- error = init_available_charsets(MYF(0)); /* If it isn't initialized */
- if (error)
- return compiled_charset_number(charset_name);
- else
- return num_from_csname(available_charsets, charset_name);
-}
-
-const char *get_charset_name(uint charset_number)
-{
- my_bool error;
- error = init_available_charsets(MYF(0)); /* If it isn't initialized */
- if (error)
- return compiled_charset_name(charset_number);
- else
- return name_from_csnum(available_charsets, charset_number);
-}
-
-
-static CHARSET_INFO *find_charset(CHARSET_INFO **table, uint cs_number,
- size_t tablesz)
-{
- uint i;
- for (i = 0; i < tablesz; ++i)
- if (table[i]->number == cs_number)
- return table[i];
- return NULL;
-}
-
-static CHARSET_INFO *find_charset_by_name(CHARSET_INFO **table, const char *name,
- size_t tablesz)
-{
- uint i;
- for (i = 0; i < tablesz; ++i)
- if (!strcmp(table[i]->name,name))
- return table[i];
- return NULL;
-}
-
-static CHARSET_INFO *add_charset(uint cs_number, const char *cs_name)
-{
- CHARSET_INFO tmp_cs,*cs;
- uchar tmp_ctype[CTYPE_TABLE_SIZE];
- uchar tmp_to_lower[TO_LOWER_TABLE_SIZE];
- uchar tmp_to_upper[TO_UPPER_TABLE_SIZE];
- uchar tmp_sort_order[SORT_ORDER_TABLE_SIZE];
-
- /* Don't allocate memory if we are not sure we can find the char set */
- cs= &tmp_cs;
- bzero((char*) cs, sizeof(*cs));
- cs->ctype=tmp_ctype;
- cs->to_lower=tmp_to_lower;
- cs->to_upper=tmp_to_upper;
- cs->sort_order=tmp_sort_order;
- if (read_charset_file(cs_number, cs, MYF(MY_WME)))
- return NULL;
-
- cs = (CHARSET_INFO*) my_once_alloc(sizeof(CHARSET_INFO),
- MYF(MY_WME));
- *cs=tmp_cs;
- cs->name = (char *) my_once_alloc((uint) strlen(cs_name)+1, MYF(MY_WME));
- cs->ctype = (uchar*) my_once_alloc(CTYPE_TABLE_SIZE, MYF(MY_WME));
- cs->to_lower = (uchar*) my_once_alloc(TO_LOWER_TABLE_SIZE, MYF(MY_WME));
- cs->to_upper = (uchar*) my_once_alloc(TO_UPPER_TABLE_SIZE, MYF(MY_WME));
- cs->sort_order=(uchar*) my_once_alloc(SORT_ORDER_TABLE_SIZE, MYF(MY_WME));
- cs->number = cs_number;
- memcpy((char*) cs->name, (char*) cs_name, strlen(cs_name) + 1);
- memcpy((char*) cs->ctype, (char*) tmp_ctype, sizeof(tmp_ctype));
- memcpy((char*) cs->to_lower, (char*) tmp_to_lower, sizeof(tmp_to_lower));
- memcpy((char*) cs->to_upper, (char*) tmp_to_upper, sizeof(tmp_to_upper));
- memcpy((char*) cs->sort_order, (char*) tmp_sort_order,
- sizeof(tmp_sort_order));
- insert_dynamic(&cs_info_table, (gptr) &cs);
- return cs;
-}
-
-static CHARSET_INFO *get_internal_charset(uint cs_number)
-{
- CHARSET_INFO *cs;
- /*
- To make things thread safe we are not allowing other threads to interfere
- while we may changing the cs_info_table
- */
- pthread_mutex_lock(&THR_LOCK_charset);
- if (!(cs = find_charset((CHARSET_INFO**) cs_info_table.buffer, cs_number,
- cs_info_table.elements)))
- if (!(cs = find_compiled_charset(cs_number)))
- cs=add_charset(cs_number, get_charset_name(cs_number));
- pthread_mutex_unlock(&THR_LOCK_charset);
- return cs;
-}
-
-
-static CHARSET_INFO *get_internal_charset_by_name(const char *name)
-{
- CHARSET_INFO *cs;
- /*
- To make things thread safe we are not allowing other threads to interfere
- while we may changing the cs_info_table
- */
- pthread_mutex_lock(&THR_LOCK_charset);
- if (!(cs = find_charset_by_name((CHARSET_INFO**) cs_info_table.buffer, name,
- cs_info_table.elements)))
- if (!(cs = find_compiled_charset_by_name(name)))
- cs=add_charset(get_charset_number(name), name);
- pthread_mutex_unlock(&THR_LOCK_charset);
- return cs;
-}
-
-
-CHARSET_INFO *get_charset(uint cs_number, myf flags)
-{
- CHARSET_INFO *cs;
- (void) init_available_charsets(MYF(0)); /* If it isn't initialized */
- cs=get_internal_charset(cs_number);
-
- if (!cs && (flags & MY_WME))
- {
- char index_file[FN_REFLEN], cs_string[23];
- strmov(get_charsets_dir(index_file), "Index");
- cs_string[0]='#';
- int10_to_str(cs_number, cs_string+1, 10);
- my_error(EE_UNKNOWN_CHARSET, MYF(ME_BELL), cs_string, index_file);
- }
- return cs;
-}
-
-my_bool set_default_charset(uint cs, myf flags)
-{
- CHARSET_INFO *new;
- DBUG_ENTER("set_default_charset");
- DBUG_PRINT("enter",("character set: %d",(int) cs));
- new = get_charset(cs, flags);
- if (!new)
- {
- DBUG_PRINT("error",("Couldn't set default character set"));
- DBUG_RETURN(TRUE); /* error */
- }
- default_charset_info = new;
- DBUG_RETURN(FALSE);
-}
-
-CHARSET_INFO *get_charset_by_name(const char *cs_name, myf flags)
-{
- CHARSET_INFO *cs;
- (void) init_available_charsets(MYF(0)); /* If it isn't initialized */
- cs=get_internal_charset_by_name(cs_name);
-
- if (!cs && (flags & MY_WME))
- {
- char index_file[FN_REFLEN];
- strmov(get_charsets_dir(index_file), "Index");
- my_error(EE_UNKNOWN_CHARSET, MYF(ME_BELL), cs_name, index_file);
- }
-
- return cs;
-}
-
-my_bool set_default_charset_by_name(const char *cs_name, myf flags)
-{
- CHARSET_INFO *new;
- DBUG_ENTER("set_default_charset_by_name");
- DBUG_PRINT("enter",("character set: %s", cs_name));
- new = get_charset_by_name(cs_name, flags);
- if (!new)
- {
- DBUG_PRINT("error",("Couldn't set default character set"));
- DBUG_RETURN(TRUE); /* error */
- }
-
- default_charset_info = new;
- DBUG_RETURN(FALSE);
-}
-
-/* Only append name if it doesn't exist from before */
-
-static my_bool charset_in_string(const char *name, DYNAMIC_STRING *s)
-{
- uint length= (uint) strlen(name);
- const char *pos;
- for (pos=s->str ; (pos=strstr(pos,name)) ; pos++)
- {
- if (! pos[length] || pos[length] == ' ')
- return TRUE; /* Already existed */
- }
-
- return FALSE;
-}
-
-static void charset_append(DYNAMIC_STRING *s, const char *name)
-{
- if (!charset_in_string(name, s)) {
- dynstr_append(s, name);
- dynstr_append(s, " ");
- }
-}
-
-
-/* Returns a dynamically-allocated string listing the character sets
- requested. The caller is responsible for freeing the memory. */
-
-char * list_charsets(myf want_flags)
-{
- DYNAMIC_STRING s;
- char *p;
-
- (void)init_available_charsets(MYF(0));
- init_dynamic_string(&s, NullS, 256, 1024);
-
- if (want_flags & MY_COMPILED_SETS)
- {
- CHARSET_INFO *cs;
- for (cs = compiled_charsets; cs->number > 0; cs++)
- {
- dynstr_append(&s, cs->name);
- dynstr_append(&s, " ");
- }
- }
-
- if (want_flags & MY_CONFIG_SETS)
- {
- CS_ID **c;
- char buf[FN_REFLEN];
- MY_STAT status;
-
- if((c=available_charsets))
- for (; *c; ++c)
- {
- if (charset_in_string((*c)->name, &s))
- continue;
- get_charset_conf_name((*c)->number, buf);
- if (!my_stat(buf, &status, MYF(0)))
- continue; /* conf file doesn't exist */
- dynstr_append(&s, (*c)->name);
- dynstr_append(&s, " ");
- }
- }
-
- if (want_flags & MY_INDEX_SETS)
- {
- CS_ID **c;
- for (c = available_charsets; *c; ++c)
- charset_append(&s, (*c)->name);
- }
-
- if (want_flags & MY_LOADED_SETS)
- {
- uint i;
- for (i = 0; i < cs_info_table.elements; i++)
- charset_append(&s,
- dynamic_element(&cs_info_table, i, CHARSET_INFO *)->name);
- }
- s.str[s.length - 1] = '\0'; /* chop trailing space */
- p = my_strdup(s.str, MYF(MY_WME));
- dynstr_free(&s);
-
- return p;
-}
-
-/****************************************************************************
-* Code for debugging.
-****************************************************************************/
-
-
-static void _print_array(uint8 *data, uint size)
-{
- uint i;
- for (i = 0; i < size; ++i)
- {
- if (i == 0 || i % 16 == size % 16) printf(" ");
- printf(" %02x", data[i]);
- if ((i+1) % 16 == size % 16) printf("\n");
- }
-}
-
-/* _print_csinfo is called from test_charset.c */
-void _print_csinfo(CHARSET_INFO *cs)
-{
- printf("%s #%d\n", cs->name, cs->number);
- printf("ctype:\n"); _print_array(cs->ctype, 257);
- printf("to_lower:\n"); _print_array(cs->to_lower, 256);
- printf("to_upper:\n"); _print_array(cs->to_upper, 256);
- printf("sort_order:\n"); _print_array(cs->sort_order, 256);
- printf("collate: %3s (%d, %p, %p, %p, %p, %p)\n",
- cs->strxfrm_multiply ? "yes" : "no",
- cs->strxfrm_multiply,
- cs->strcoll,
- cs->strxfrm,
- cs->strnncoll,
- cs->strnxfrm,
- cs->like_range);
- printf("multi-byte: %3s (%d, %p, %p, %p)\n",
- cs->mbmaxlen ? "yes" : "no",
- cs->mbmaxlen,
- cs->ismbchar,
- cs->ismbhead,
- cs->mbcharlen);
-}
diff --git a/ext/mysql/libmysql/config-win.h b/ext/mysql/libmysql/config-win.h
deleted file mode 100644
index 5d4d40d98b..0000000000
--- a/ext/mysql/libmysql/config-win.h
+++ /dev/null
@@ -1,293 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-/* Defines for Win32 to make it compatible for MySQL */
-
-#include <sys/locking.h>
-#include <windows.h>
-#include <math.h> /* Because of rint() */
-#include <fcntl.h>
-#include <io.h>
-#include <malloc.h>
-
-#if defined(__NT__)
-#define SYSTEM_TYPE "NT"
-#elif defined(__WIN2000__)
-#define SYSTEM_TYPE "WIN2000"
-#else
-#define SYSTEM_TYPE "Win95/Win98"
-#endif
-
-#ifdef _WIN64
-#define MACHINE_TYPE "ia64" /* Define to machine type name */
-#else
-#define MACHINE_TYPE "i32" /* Define to machine type name */
-#ifndef _WIN32
-#define _WIN32 /* Compatible with old source */
-#endif
-#ifndef __WIN32__
-#define __WIN32__
-#endif
-#endif /* _WIN64 */
-#ifndef __WIN__
-#define __WIN__ /* To make it easier in VC++ */
-#endif
-
-/* File and lock constants */
-#define O_SHARE 0x1000 /* Open file in sharing mode */
-#ifdef __BORLANDC__
-#define F_RDLCK LK_NBLCK /* read lock */
-#define F_WRLCK LK_NBRLCK /* write lock */
-#define F_UNLCK LK_UNLCK /* remove lock(s) */
-#else
-#define F_RDLCK _LK_NBLCK /* read lock */
-#define F_WRLCK _LK_NBRLCK /* write lock */
-#define F_UNLCK _LK_UNLCK /* remove lock(s) */
-#endif
-
-#define F_EXCLUSIVE 1 /* We have only exclusive locking */
-#define F_TO_EOF (INT_MAX32/2) /* size for lock of all file */
-#define F_OK 0 /* parameter to access() */
-
-#define S_IROTH S_IREAD /* for my_lib */
-
-#ifdef __BORLANDC__
-#define FILE_BINARY O_BINARY /* my_fopen in binary mode */
-#define O_TEMPORARY 0
-#define O_SHORT_LIVED 0
-#define SH_DENYNO _SH_DENYNO
-#else
-#define O_BINARY _O_BINARY /* compability with MSDOS */
-#define FILE_BINARY _O_BINARY /* my_fopen in binary mode */
-#define O_TEMPORARY _O_TEMPORARY
-#define O_SHORT_LIVED _O_SHORT_LIVED
-#define SH_DENYNO _SH_DENYNO
-#endif
-#define NO_OPEN_3 /* For my_create() */
-
-#define SIGQUIT SIGTERM /* No SIGQUIT */
-
-#undef _REENTRANT /* Crashes something for win32 */
-#undef SAFE_MUTEX /* Can't be used on windows */
-
-#define LONGLONG_MIN ((__int64) 0x8000000000000000)
-#define LONGLONG_MAX ((__int64) 0x7FFFFFFFFFFFFFFF)
-#define LL(A) ((__int64) A)
-
-/* Type information */
-
-typedef unsigned short ushort;
-typedef unsigned int uint;
-typedef unsigned __int64 ulonglong; /* Microsofts 64 bit types */
-typedef __int64 longlong;
-typedef int sigset_t;
-#define longlong_defined
-/* off_t should not be __int64 because of conflicts in header files;
- Use my_off_t or os_off_t instead */
-typedef long off_t;
-typedef __int64 os_off_t;
-#ifdef _WIN64
-typedef UINT_PTR rf_SetTimer;
-#else
-typedef unsigned int size_t;
-typedef uint rf_SetTimer;
-#endif
-
-#define Socket_defined
-#define my_socket SOCKET
-#define bool BOOL
-#define SIGPIPE SIGINT
-#define RETQSORTTYPE void
-#define QSORT_TYPE_IS_VOID
-#define RETSIGTYPE void
-#define SOCKET_SIZE_TYPE int
-#define my_socket_defined
-#define bool_defined
-#define byte_defined
-#define HUGE_PTR
-#define STDCALL __stdcall /* Used by libmysql.dll */
-
-#ifndef UNDEF_THREAD_HACK
-#define THREAD
-#endif
-#define VOID_SIGHANDLER
-#define SIZEOF_CHAR 1
-#define SIZEOF_LONG 4
-#define SIZEOF_LONG_LONG 8
-#define SIZEOF_OFF_T 8
-#define HAVE_BROKEN_NETINET_INCLUDES
-#ifdef __NT__
-#define HAVE_NAMED_PIPE /* We can only create pipes on NT */
-#endif
-
-/* Use all character sets in MySQL */
-#define USE_MB 1
-#define USE_MB_IDENT 1
-#define USE_STRCOLL 1
-
-/* Convert some simple functions to Posix */
-
-#define sigset(A,B) signal((A),(B))
-#define finite(A) _finite(A)
-#define sleep(A) Sleep((A)*1000)
-
-#ifndef __BORLANDC__
-#define access(A,B) _access(A,B)
-#endif
-
-#if defined(__cplusplus)
-
-inline double rint(double nr)
-{
- double f = floor(nr);
- double c = ceil(nr);
- return (((c-nr) >= (nr-f)) ? f :c);
-}
-
-#ifdef _WIN64
-#define ulonglong2double(A) ((double) (A))
-#define my_off_t2double(A) ((double) (A))
-
-#else
-inline double ulonglong2double(ulonglong value)
-{
- longlong nr=(longlong) value;
- if (nr >= 0)
- return (double) nr;
- return (18446744073709551616.0 + (double) nr);
-}
-#define my_off_t2double(A) ulonglong2double(A)
-#endif /* _WIN64 */
-#else
-#define inline __inline
-#endif /* __cplusplus */
-
-#if SIZEOF_OFF_T > 4
-#define lseek(A,B,C) _lseeki64((A),(longlong) (B),(C))
-#define tell(A) _telli64(A)
-#endif
-
-#define STACK_DIRECTION -1
-
-/* Optimized store functions for Intel x86 */
-
-#define sint2korr(A) (*((int16 *) (A)))
-#define sint3korr(A) ((int32) ((((uchar) (A)[2]) & 128) ? \
- (((uint32) 255L << 24) | \
- (((uint32) (uchar) (A)[2]) << 16) |\
- (((uint32) (uchar) (A)[1]) << 8) | \
- ((uint32) (uchar) (A)[0])) : \
- (((uint32) (uchar) (A)[2]) << 16) |\
- (((uint32) (uchar) (A)[1]) << 8) | \
- ((uint32) (uchar) (A)[0])))
-#define sint4korr(A) (*((long *) (A)))
-#define uint2korr(A) (*((uint16 *) (A)))
-#define uint3korr(A) (long) (*((unsigned long *) (A)) & 0xFFFFFF)
-#define uint4korr(A) (*((unsigned long *) (A)))
-#define uint5korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) +\
- (((uint32) ((uchar) (A)[1])) << 8) +\
- (((uint32) ((uchar) (A)[2])) << 16) +\
- (((uint32) ((uchar) (A)[3])) << 24)) +\
- (((ulonglong) ((uchar) (A)[4])) << 32))
-#define uint8korr(A) (*((ulonglong *) (A)))
-#define sint8korr(A) (*((longlong *) (A)))
-#define int2store(T,A) *((uint16*) (T))= (uint16) (A)
-#define int3store(T,A) { *(T)= (uchar) ((A));\
- *(T+1)=(uchar) (((uint) (A) >> 8));\
- *(T+2)=(uchar) (((A) >> 16)); }
-#define int4store(T,A) *((long *) (T))= (long) (A)
-#define int5store(T,A) { *(T)= (uchar)((A));\
- *((T)+1)=(uchar) (((A) >> 8));\
- *((T)+2)=(uchar) (((A) >> 16));\
- *((T)+3)=(uchar) (((A) >> 24)); \
- *((T)+4)=(uchar) (((A) >> 32)); }
-#define int8store(T,A) *((ulonglong *) (T))= (ulonglong) (A)
-
-#define doubleget(V,M) { *((long *) &V) = *((long*) M); \
- *(((long *) &V)+1) = *(((long*) M)+1); }
-#define doublestore(T,V) { *((long *) T) = *((long*) &V); \
- *(((long *) T)+1) = *(((long*) &V)+1); }
-#define float4get(V,M) { *((long *) &(V)) = *((long*) (M)); }
-#define float8get(V,M) doubleget((V),(M))
-#define float4store(V,M) memcpy((byte*) V,(byte*) (&M),sizeof(float))
-#define float8store(V,M) doublestore((V),(M))
-
-
-#define HAVE_PERROR
-#define HAVE_VFPRINT
-#define HAVE_CHSIZE /* System has chsize() function */
-#define HAVE_RENAME /* Have rename() as function */
-#define HAVE_BINARY_STREAMS /* Have "b" flag in streams */
-#define HAVE_LONG_JMP /* Have long jump function */
-#define HAVE_LOCKING /* have locking() call */
-#define HAVE_ERRNO_AS_DEFINE /* errno is a define */
-#define HAVE_STDLIB /* everything is include in this file */
-#define HAVE_MEMCPY
-#define HAVE_MEMMOVE
-#define HAVE_GETCWD
-#define HAVE_TELL
-#define HAVE_TZNAME
-#define HAVE_PUTENV
-#define HAVE_SELECT
-#define HAVE_SETLOCALE
-#define HAVE_SOCKET /* Giangi */
-#define HAVE_FLOAT_H
-#define HAVE_LIMITS_H
-#define HAVE_STDDEF_H
-#define HAVE_RINT /* defined in this file */
-#define NO_FCNTL_NONBLOCK /* No FCNTL */
-#define HAVE_ALLOCA
-#define HAVE_STRPBRK
-#define HAVE_STRSTR
-/* #define HAVE_COMPRESS -- not with PHP, please */
-
-#ifdef NOT_USED
-#define HAVE_SNPRINTF /* Gave link error */
-#define _snprintf snprintf
-#endif
-
-#ifdef _MSC_VER
-#define HAVE_LDIV /* The optimizer breaks in zortech for ldiv */
-#define HAVE_ANSI_INCLUDE
-#define HAVE_SYS_UTIME_H
-#define HAVE_STRTOUL
-#endif
-#define my_reinterpret_cast(A) reinterpret_cast <A>
-#define my_const_cast(A) const_cast<A>
-
-/* MYSQL OPTIONS */
-
-#ifdef _CUSTOMCONFIG_
-#include <custom_conf.h>
-#else
-#define DEFAULT_MYSQL_HOME "c:\\mysql"
-#define PACKAGE "mysql"
-#define DEFAULT_BASEDIR "C:\\"
-#define SHAREDIR "share"
-#define DEFAULT_CHARSET_HOME "C:/mysql/"
-#endif
-
-/* File name handling */
-
-#define FN_LIBCHAR '\\'
-#define FN_ROOTDIR "\\"
-#define FN_NETWORK_DRIVES /* Uses \\ to indicate network drives */
-#define FN_NO_CASE_SENCE /* Files are not case-sensitive */
-#define FN_LOWER_CASE TRUE /* Files are represented in lower case */
-#define MY_NFILE 1024
-
-#define DO_NOT_REMOVE_THREAD_WRAPPERS
-#define thread_safe_increment(V,L) InterlockedIncrement((long*) &(V))
-/* The following is only used for statistics, so it should be good enough */
-#ifdef __NT__ /* This should also work on Win98 but .. */
-#define thread_safe_add(V,C,L) InterlockedExchangeAdd((long*) &(V),(C))
-#define thread_safe_sub(V,C,L) InterlockedExchangeAdd((long*) &(V),-(long) (C))
-#define statistic_add(V,C,L) thread_safe_add((V),(C),(L))
-#else
-#define thread_safe_add(V,C,L) \
- pthread_mutex_lock((L)); (V)+=(C); pthread_mutex_unlock((L));
-#define thread_safe_sub(V,C,L) \
- pthread_mutex_lock((L)); (V)-=(C); pthread_mutex_unlock((L));
-#define statistic_add(V,C,L) (V)+=(C)
-#endif
-#define statistic_increment(V,L) thread_safe_increment((V),(L))
diff --git a/ext/mysql/libmysql/ctype.c b/ext/mysql/libmysql/ctype.c
deleted file mode 100644
index 151266ce0e..0000000000
--- a/ext/mysql/libmysql/ctype.c
+++ /dev/null
@@ -1,54 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-#include <global.h>
-
-#include <m_ctype.h>
-
-/* generated by make, using conf_to_src */
-#include "ctype_extra_sources.c"
-
-/* generated by configure */
-#include "ctype_autoconf.c"
-
-CHARSET_INFO *default_charset_info = &compiled_charsets[0];
-
-CHARSET_INFO *find_compiled_charset(uint cs_number)
-{
- CHARSET_INFO *cs;
- for (cs = compiled_charsets; cs->number > 0; cs++)
- if (cs->number == cs_number)
- return cs;
-
- return NULL;
-}
-
-CHARSET_INFO *find_compiled_charset_by_name(const char *name)
-{
- CHARSET_INFO *cs;
- for (cs = compiled_charsets; cs->number > 0; cs++)
- if (!strcmp(cs->name, name))
- return cs;
-
- return NULL;
-}
-
-uint8 compiled_charset_number(const char *name)
-{
- CHARSET_INFO *cs;
- for (cs = compiled_charsets; cs->number > 0; cs++)
- if (!strcmp(cs->name, name))
- return cs->number;
-
- return 0; /* this mimics find_type() */
-}
-
-const char *compiled_charset_name(uint8 charset_number)
-{
- CHARSET_INFO *cs;
- for (cs = compiled_charsets; cs->number > 0; cs++)
- if (cs->number == charset_number)
- return cs->name;
-
- return "?"; /* this mimics get_type() */
-}
diff --git a/ext/mysql/libmysql/ctype_autoconf.c b/ext/mysql/libmysql/ctype_autoconf.c
deleted file mode 100644
index 22da693433..0000000000
--- a/ext/mysql/libmysql/ctype_autoconf.c
+++ /dev/null
@@ -1,44 +0,0 @@
-/* This file is generated automatically by configure. */
-
-CHARSET_INFO compiled_charsets[] = {
-
- /* this information is filled in by configure */
- {
- 8, /* number */
- "latin1", /* name */
- ctype_latin1,
- to_lower_latin1,
- to_upper_latin1,
- sort_order_latin1,
- 0, /* strxfrm_multiply */
- NULL, /* strcoll */
- NULL, /* strxfrm */
- NULL, /* strnncoll */
- NULL, /* strnxfrm */
- NULL, /* like_range */
- 0, /* mbmaxlen */
- NULL, /* ismbchar */
- NULL, /* ismbhead */
- NULL /* mbcharlen */
- },
-
- /* this information is filled in by configure */
- {
- 0, /* end-of-list marker */
- NullS,
- NULL,
- NULL,
- NULL,
- NULL,
- 0,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- 0,
- NULL,
- NULL,
- NULL
- }
-};
diff --git a/ext/mysql/libmysql/ctype_extra_sources.c b/ext/mysql/libmysql/ctype_extra_sources.c
deleted file mode 100644
index 97f0d38646..0000000000
--- a/ext/mysql/libmysql/ctype_extra_sources.c
+++ /dev/null
@@ -1,82 +0,0 @@
-/* The latin1 character set. Generated automatically by configure and
- * the ./conf_to_src program
- */
-
-uchar ctype_latin1[] = {
- 0,
- 32, 32, 32, 32, 32, 32, 32, 32, 32, 40, 40, 40, 40, 40, 32, 32,
- 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
- 72, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 132,132,132,132,132,132,132,132,132,132, 16, 16, 16, 16, 16, 16,
- 16,129,129,129,129,129,129, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 16, 16, 16, 16, 16,
- 16,130,130,130,130,130,130, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 16, 16, 16, 16, 32,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 72, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 16, 1, 1, 1, 1, 1, 1, 1, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 16, 2, 2, 2, 2, 2, 2, 2, 2
-};
-
-uchar to_lower_latin1[] = {
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
- 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
- 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
- 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
- 64, 97, 98, 99,100,101,102,103,104,105,106,107,108,109,110,111,
- 112,113,114,115,116,117,118,119,120,121,122, 91, 92, 93, 94, 95,
- 96, 97, 98, 99,100,101,102,103,104,105,106,107,108,109,110,111,
- 112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,
- 128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,
- 144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,
- 160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,
- 176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,
- 224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,
- 240,241,242,243,244,245,246,215,248,249,250,251,252,253,254,223,
- 224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,
- 240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255
-};
-
-uchar to_upper_latin1[] = {
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
- 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
- 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
- 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
- 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
- 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95,
- 96, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
- 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90,123,124,125,126,127,
- 128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,
- 144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,
- 160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,
- 176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,
- 192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,
- 208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,
- 192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,
- 208,209,210,211,212,213,214,247,216,217,218,219,220,221,222,255
-};
-
-uchar sort_order_latin1[] = {
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
- 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
- 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
- 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
- 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
- 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95,
- 96, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
- 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90,123,124,125,126,127,
- 128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,
- 144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,
- 160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,
- 176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,
- 65, 65, 65, 65, 92, 91, 92, 67, 69, 69, 69, 69, 73, 73, 73, 73,
- 68, 78, 79, 79, 79, 79, 93,215,216, 85, 85, 85, 89, 89,222,223,
- 65, 65, 65, 65, 92, 91, 92, 67, 69, 69, 69, 69, 73, 73, 73, 73,
- 68, 78, 79, 79, 79, 79, 93,247,216, 85, 85, 85, 89, 89,222,255
-};
-
-
diff --git a/ext/mysql/libmysql/dbug.c b/ext/mysql/libmysql/dbug.c
deleted file mode 100644
index f600b28100..0000000000
--- a/ext/mysql/libmysql/dbug.c
+++ /dev/null
@@ -1,2076 +0,0 @@
-/******************************************************************************
- * *
- * N O T I C E *
- * *
- * Copyright Abandoned, 1987, Fred Fish *
- * *
- * *
- * This previously copyrighted work has been placed into the public *
- * domain by the author and may be freely used for any purpose, *
- * private or commercial. *
- * *
- * Because of the number of inquiries I was receiving about the use *
- * of this product in commercially developed works I have decided to *
- * simply make it public domain to further its unrestricted use. I *
- * specifically would be most happy to see this material become a *
- * part of the standard Unix distributions by AT&T and the Berkeley *
- * Computer Science Research Group, and a standard part of the GNU *
- * system from the Free Software Foundation. *
- * *
- * I would appreciate it, as a courtesy, if this notice is left in *
- * all copies and derivative works. Thank you. *
- * *
- * The author makes no warranty of any kind with respect to this *
- * product and explicitly disclaims any implied warranties of mer- *
- * chantability or fitness for any particular purpose. *
- * *
- ******************************************************************************
- */
-
-
-/*
- * FILE
- *
- * dbug.c runtime support routines for dbug package
- *
- * SCCS
- *
- * @(#)dbug.c 1.25 7/25/89
- *
- * DESCRIPTION
- *
- * These are the runtime support routines for the dbug package.
- * The dbug package has two main components; the user include
- * file containing various macro definitions, and the runtime
- * support routines which are called from the macro expansions.
- *
- * Externally visible functions in the runtime support module
- * use the naming convention pattern "_db_xx...xx_", thus
- * they are unlikely to collide with user defined function names.
- *
- * AUTHOR(S)
- *
- * Fred Fish (base code)
- * Enhanced Software Technologies, Tempe, AZ
- * asuvax!mcdphx!estinc!fnf
- *
- * Binayak Banerjee (profiling enhancements)
- * seismo!bpa!sjuvax!bbanerje
- *
- * Michael Widenius:
- * DBUG_DUMP - To dump a pice of memory.
- * PUSH_FLAG "O" - To be used insted of "o" if we don't
- * want flushing (for slow systems)
- * PUSH_FLAG "A" - as 'O', but we will append to the out file instead
- * of creating a new one.
- * Check of malloc on entry/exit (option "S")
- */
-
-#ifdef DBUG_OFF
-#undef DBUG_OFF
-#endif
-#include <global.h>
-#include <m_string.h>
-#include <errno.h>
-#if defined(MSDOS) || defined(__WIN__)
-#include <process.h>
-#endif
-
-#ifdef _DBUG_CONDITION_
-#define _DBUG_START_CONDITION_ "d:t"
-#else
-#define _DBUG_START_CONDITION_ ""
-#endif
-
-/*
- * Manifest constants that should not require any changes.
- */
-
-#define EOS '\000' /* End Of String marker */
-
-/*
- * Manifest constants which may be "tuned" if desired.
- */
-
-#define PRINTBUF 1024 /* Print buffer size */
-#define INDENT 2 /* Indentation per trace level */
-#define MAXDEPTH 200 /* Maximum trace depth default */
-
-/*
- * The following flags are used to determine which
- * capabilities the user has enabled with the state
- * push macro.
- */
-
-#define TRACE_ON 000001 /* Trace enabled */
-#define DEBUG_ON 000002 /* Debug enabled */
-#define FILE_ON 000004 /* File name print enabled */
-#define LINE_ON 000010 /* Line number print enabled */
-#define DEPTH_ON 000020 /* Function nest level print enabled */
-#define PROCESS_ON 000040 /* Process name print enabled */
-#define NUMBER_ON 000100 /* Number each line of output */
-#define PROFILE_ON 000200 /* Print out profiling code */
-#define PID_ON 000400 /* Identify each line with process id */
-#define SANITY_CHECK_ON 001000 /* Check safemalloc on DBUG_ENTER */
-#define FLUSH_ON_WRITE 002000 /* Flush on every write */
-
-#define TRACING (stack -> flags & TRACE_ON)
-#define DEBUGGING (stack -> flags & DEBUG_ON)
-#define PROFILING (stack -> flags & PROFILE_ON)
-#define STREQ(a,b) (strcmp(a,b) == 0)
-
-/*
- * Typedefs to make things more obvious.
- */
-
-#ifndef __WIN__
-typedef int BOOLEAN;
-#else
-#define BOOLEAN BOOL
-#endif
-
-/*
- * Make it easy to change storage classes if necessary.
- */
-
-#define IMPORT extern /* Names defined externally */
-#define EXPORT /* Allocated here, available globally */
-#define AUTO auto /* Names to be allocated on stack */
-#define REGISTER register /* Names to be placed in registers */
-
-/*
- * The default file for profiling. Could also add another flag
- * (G?) which allowed the user to specify this.
- *
- * If the automatic variables get allocated on the stack in
- * reverse order from their declarations, then define AUTOS_REVERSE.
- * This is used by the code that keeps track of stack usage. For
- * forward allocation, the difference in the dbug frame pointers
- * represents stack used by the callee function. For reverse allocation,
- * the difference represents stack used by the caller function.
- *
- */
-
-#define PROF_FILE "dbugmon.out"
-#define PROF_EFMT "E\t%ld\t%s\n"
-#define PROF_SFMT "S\t%lx\t%lx\t%s\n"
-#define PROF_XFMT "X\t%ld\t%s\n"
-
-#ifdef M_I386 /* predefined by xenix 386 compiler */
-#define AUTOS_REVERSE 1
-#endif
-
-/*
- * Variables which are available externally but should only
- * be accessed via the macro package facilities.
- */
-
-EXPORT FILE *_db_fp_ = (FILE *) 0; /* Output stream, default stderr */
-EXPORT char *_db_process_ = (char*) "dbug"; /* Pointer to process name; argv[0] */
-EXPORT FILE *_db_pfp_ = (FILE *)0; /* Profile stream, 'dbugmon.out' */
-EXPORT BOOLEAN _db_on_ = FALSE; /* TRUE if debugging currently on */
-EXPORT BOOLEAN _db_pon_ = FALSE; /* TRUE if profile currently on */
-EXPORT BOOLEAN _no_db_ = FALSE; /* TRUE if no debugging at all */
-
-/*
- * Externally supplied functions.
- */
-
-#ifndef HAVE_PERROR
-static void perror (); /* Fake system/library error print routine */
-#endif
-
-IMPORT int _sanity(const char *file,uint line);
-
-/*
- * The user may specify a list of functions to trace or
- * debug. These lists are kept in a linear linked list,
- * a very simple implementation.
- */
-
-struct link {
- char *str; /* Pointer to link's contents */
- struct link *next_link; /* Pointer to the next link */
-};
-
-/*
- * Debugging states can be pushed or popped off of a
- * stack which is implemented as a linked list. Note
- * that the head of the list is the current state and the
- * stack is pushed by adding a new state to the head of the
- * list or popped by removing the first link.
- */
-
-struct state {
- int flags; /* Current state flags */
- int maxdepth; /* Current maximum trace depth */
- uint delay; /* Delay after each output line */
- int sub_level; /* Sub this from code_state->level */
- FILE *out_file; /* Current output stream */
- FILE *prof_file; /* Current profiling stream */
- char name[FN_REFLEN]; /* Name of output file */
- struct link *functions; /* List of functions */
- struct link *p_functions; /* List of profiled functions */
- struct link *keywords; /* List of debug keywords */
- struct link *processes; /* List of process names */
- struct state *next_state; /* Next state in the list */
-};
-
-
-/*
- * Local variables not seen by user.
- */
-
-
-static my_bool init_done = FALSE; /* Set to TRUE when initialization done */
-static struct state *stack=0;
-
-typedef struct st_code_state {
- int lineno; /* Current debugger output line number */
- int level; /* Current function nesting level */
- const char *func; /* Name of current user function */
- const char *file; /* Name of current user file */
- char **framep; /* Pointer to current frame */
- int jmplevel; /* Remember nesting level at setjmp () */
- const char *jmpfunc; /* Remember current function for setjmp */
- const char *jmpfile; /* Remember current file for setjmp */
-
-/*
- * The following variables are used to hold the state information
- * between the call to _db_pargs_() and _db_doprnt_(), during
- * expansion of the DBUG_PRINT macro. This is the only macro
- * that currently uses these variables.
- *
- * These variables are currently used only by _db_pargs_() and
- * _db_doprnt_().
- */
-
- uint u_line; /* User source code line number */
- const char *u_keyword; /* Keyword for current macro */
- int locked; /* If locked with _db_lock_file */
-} CODE_STATE;
-
- /* Parse a debug command string */
-static struct link *ListParse(char *ctlp);
- /* Make a fresh copy of a string */
-static char *StrDup(const char *str);
- /* Open debug output stream */
-static void DBUGOpenFile(const char *name, int append);
-#ifndef THREAD
- /* Open profile output stream */
-static FILE *OpenProfile(const char *name);
- /* Profile if asked for it */
-static BOOLEAN DoProfile(void);
-#endif
- /* Return current user time (ms) */
-#ifndef THREAD
-static unsigned long Clock (void);
-#endif
- /* Close debug output stream */
-static void CloseFile(FILE *fp);
- /* Push current debug state */
-static void PushState(void);
- /* Test for tracing enabled */
-static BOOLEAN DoTrace(CODE_STATE *state);
- /* Test to see if file is writable */
-#if !(!defined(HAVE_ACCESS) || defined(MSDOS))
-static BOOLEAN Writable(char *pathname);
- /* Change file owner and group */
-static void ChangeOwner(char *pathname);
- /* Allocate memory for runtime support */
-#endif
-static char *DbugMalloc(int size);
- /* Remove leading pathname components */
-static char *BaseName(const char *pathname);
-static void DoPrefix(uint line);
-static void FreeList(struct link *linkp);
-static void Indent(int indent);
-static BOOLEAN InList(struct link *linkp,const char *cp);
-static void dbug_flush(CODE_STATE *);
-static void DbugExit(const char *why);
-static int DelayArg(int value);
- /* Supplied in Sys V runtime environ */
- /* Break string into tokens */
-static char *static_strtok(char *s1,pchar chr);
-
-/*
- * Miscellaneous printf format strings.
- */
-
-#define ERR_MISSING_RETURN "%s: missing DBUG_RETURN or DBUG_VOID_RETURN macro in function \"%s\"\n"
-#define ERR_OPEN "%s: can't open debug output stream \"%s\": "
-#define ERR_CLOSE "%s: can't close debug file: "
-#define ERR_ABORT "%s: debugger aborting because %s\n"
-#define ERR_CHOWN "%s: can't change owner/group of \"%s\": "
-
-/*
- * Macros and defines for testing file accessibility under UNIX and MSDOS.
- */
-
-#if !defined(HAVE_ACCESS) || defined(MSDOS)
-#define EXISTS(pathname) (FALSE) /* Assume no existance */
-#define Writable(name) (TRUE)
-#else
-#define EXISTS(pathname) (access (pathname, F_OK) == 0)
-#define WRITABLE(pathname) (access (pathname, W_OK) == 0)
-#endif
-#ifndef MSDOS
-#define ChangeOwner(name)
-#endif
-
-/*
- * Translate some calls among different systems.
- */
-
-#if defined(unix) || defined(xenix) || defined(VMS) || defined(__NetBSD__)
-# define Delay(A) sleep((uint) A)
-#elif defined(AMIGA)
-IMPORT int Delay (); /* Pause for given number of ticks */
-#else
-static int Delay(int ticks);
-#endif
-
-
-/*
-** Macros to allow dbugging with threads
-*/
-
-#ifdef THREAD
-#include <my_pthread.h>
-pthread_mutex_t THR_LOCK_dbug;
-
-static void init_dbug_state(void)
-{
- pthread_mutex_init(&THR_LOCK_dbug,MY_MUTEX_INIT_FAST);
-}
-
-static CODE_STATE *code_state(void)
-{
- CODE_STATE *state=0;
- struct st_my_thread_var *tmp=my_thread_var;
- if (tmp)
- {
- if (!(state=(CODE_STATE *) tmp->dbug))
- {
- state=(CODE_STATE*) DbugMalloc(sizeof(*state));
- bzero((char*) state,sizeof(*state));
- state->func="?func";
- state->file="?file";
- tmp->dbug=(gptr) state;
- }
- }
- return state;
-}
-
-#else /* !THREAD */
-
-#define init_dbug_state()
-#define code_state() (&static_code_state)
-#define pthread_mutex_lock(A) {}
-#define pthread_mutex_unlock(A) {}
-static CODE_STATE static_code_state = { 0,0,"?func","?file",NULL,0,NULL,
- NULL,0,"?",0};
-#endif
-
-
-/*
- * FUNCTION
- *
- * _db_push_ push current debugger state and set up new one
- *
- * SYNOPSIS
- *
- * VOID _db_push_ (control)
- * char *control;
- *
- * DESCRIPTION
- *
- * Given pointer to a debug control string in "control", pushes
- * the current debug state, parses the control string, and sets
- * up a new debug state.
- *
- * The only attribute of the new state inherited from the previous
- * state is the current function nesting level. This can be
- * overridden by using the "r" flag in the control string.
- *
- * The debug control string is a sequence of colon separated fields
- * as follows:
- *
- * <field_1>:<field_2>:...:<field_N>
- *
- * Each field consists of a mandatory flag character followed by
- * an optional "," and comma separated list of modifiers:
- *
- * flag[,modifier,modifier,...,modifier]
- *
- * The currently recognized flag characters are:
- *
- * d Enable output from DBUG_<N> macros for
- * for the current state. May be followed
- * by a list of keywords which selects output
- * only for the DBUG macros with that keyword.
- * A null list of keywords implies output for
- * all macros.
- *
- * D Delay after each debugger output line.
- * The argument is the number of tenths of seconds
- * to delay, subject to machine capabilities.
- * I.E. -#D,20 is delay two seconds.
- *
- * f Limit debugging and/or tracing, and profiling to the
- * list of named functions. Note that a null list will
- * disable all functions. The appropriate "d" or "t"
- * flags must still be given, this flag only limits their
- * actions if they are enabled.
- *
- * F Identify the source file name for each
- * line of debug or trace output.
- *
- * i Identify the process with the pid for each line of
- * debug or trace output.
- *
- * g Enable profiling. Create a file called 'dbugmon.out'
- * containing information that can be used to profile
- * the program. May be followed by a list of keywords
- * that select profiling only for the functions in that
- * list. A null list implies that all functions are
- * considered.
- *
- * L Identify the source file line number for
- * each line of debug or trace output.
- *
- * n Print the current function nesting depth for
- * each line of debug or trace output.
- *
- * N Number each line of dbug output.
- *
- * o Redirect the debugger output stream to the
- * specified file. The default output is stderr.
- *
- * O As O but the file is really flushed between each
- * write. When neaded the file is closed and reopened
- * between each write.
- *
- * p Limit debugger actions to specified processes.
- * A process must be identified with the
- * DBUG_PROCESS macro and match one in the list
- * for debugger actions to occur.
- *
- * P Print the current process name for each
- * line of debug or trace output.
- *
- * r When pushing a new state, do not inherit
- * the previous state's function nesting level.
- * Useful when the output is to start at the
- * left margin.
- *
- * S Do function _sanity(_file_,_line_) at each
- * debugged function until _sanity() returns
- * something that differs from 0.
- * (Moustly used with safemalloc)
- *
- * t Enable function call/exit trace lines.
- * May be followed by a list (containing only
- * one modifier) giving a numeric maximum
- * trace level, beyond which no output will
- * occur for either debugging or tracing
- * macros. The default is a compile time
- * option.
- *
- * Some examples of debug control strings which might appear
- * on a shell command line (the "-#" is typically used to
- * introduce a control string to an application program) are:
- *
- * -#d:t
- * -#d:f,main,subr1:F:L:t,20
- * -#d,input,output,files:n
- *
- * For convenience, any leading "-#" is stripped off.
- *
- */
-
-void _db_push_ (control)
-const char *control;
-{
- reg1 char *scan;
- reg2 struct link *temp;
- CODE_STATE *state;
- char *new_str;
-
- if (! _db_fp_)
- _db_fp_= stderr; /* Output stream, default stderr */
-
- if (control && *control == '-')
- {
- if (*++control == '#')
- control++;
- }
- if (*control)
- _no_db_=0; /* We are using dbug after all */
-
- new_str = StrDup (control);
- PushState ();
- state=code_state();
-
- scan = static_strtok (new_str, ':');
- for (; scan != NULL; scan = static_strtok ((char *)NULL, ':')) {
- switch (*scan++) {
- case 'd':
- _db_on_ = TRUE;
- stack -> flags |= DEBUG_ON;
- if (*scan++ == ',') {
- stack -> keywords = ListParse (scan);
- }
- break;
- case 'D':
- stack -> delay = 0;
- if (*scan++ == ',') {
- temp = ListParse (scan);
- stack -> delay = DelayArg (atoi (temp -> str));
- FreeList (temp);
- }
- break;
- case 'f':
- if (*scan++ == ',') {
- stack -> functions = ListParse (scan);
- }
- break;
- case 'F':
- stack -> flags |= FILE_ON;
- break;
- case 'i':
- stack -> flags |= PID_ON;
- break;
-#ifndef THREAD
- case 'g':
- _db_pon_ = TRUE;
- if (OpenProfile(PROF_FILE))
- {
- stack -> flags |= PROFILE_ON;
- if (*scan++ == ',')
- stack -> p_functions = ListParse (scan);
- }
- break;
-#endif
- case 'L':
- stack -> flags |= LINE_ON;
- break;
- case 'n':
- stack -> flags |= DEPTH_ON;
- break;
- case 'N':
- stack -> flags |= NUMBER_ON;
- break;
- case 'A':
- case 'O':
- stack -> flags |= FLUSH_ON_WRITE;
- case 'a':
- case 'o':
- if (*scan++ == ',') {
- temp = ListParse (scan);
- DBUGOpenFile(temp -> str, (int) (scan[-2] == 'A' || scan[-2] == 'a'));
- FreeList (temp);
- } else {
- DBUGOpenFile ("-",0);
- }
- break;
- case 'p':
- if (*scan++ == ',') {
- stack -> processes = ListParse (scan);
- }
- break;
- case 'P':
- stack -> flags |= PROCESS_ON;
- break;
- case 'r':
- stack->sub_level= state->level;
- break;
- case 't':
- stack -> flags |= TRACE_ON;
- if (*scan++ == ',') {
- temp = ListParse (scan);
- stack -> maxdepth = atoi (temp -> str);
- FreeList (temp);
- }
- break;
- case 'S':
- stack -> flags |= SANITY_CHECK_ON;
- break;
- }
- }
- free (new_str);
-}
-
-
-/*
- * FUNCTION
- *
- * _db_pop_ pop the debug stack
- *
- * DESCRIPTION
- *
- * Pops the debug stack, returning the debug state to its
- * condition prior to the most recent _db_push_ invocation.
- * Note that the pop will fail if it would remove the last
- * valid state from the stack. This prevents user errors
- * in the push/pop sequence from screwing up the debugger.
- * Maybe there should be some kind of warning printed if the
- * user tries to pop too many states.
- *
- */
-
-void _db_pop_ ()
-{
- reg1 struct state *discard;
- discard = stack;
- if (discard != NULL && discard -> next_state != NULL) {
- stack = discard -> next_state;
- _db_fp_ = stack -> out_file;
- _db_pfp_ = stack -> prof_file;
- if (discard -> keywords != NULL) {
- FreeList (discard -> keywords);
- }
- if (discard -> functions != NULL) {
- FreeList (discard -> functions);
- }
- if (discard -> processes != NULL) {
- FreeList (discard -> processes);
- }
- if (discard -> p_functions != NULL) {
- FreeList (discard -> p_functions);
- }
- CloseFile (discard -> out_file);
- if (discard -> prof_file)
- CloseFile (discard -> prof_file);
- free ((char *) discard);
- if (!(stack->flags & DEBUG_ON))
- _db_on_=0;
- }
- else
- {
- _db_on_=0;
- }
-}
-
-
-/*
- * FUNCTION
- *
- * _db_enter_ process entry point to user function
- *
- * SYNOPSIS
- *
- * VOID _db_enter_ (_func_, _file_, _line_,
- * _sfunc_, _sfile_, _slevel_, _sframep_)
- * char *_func_; points to current function name
- * char *_file_; points to current file name
- * int _line_; called from source line number
- * char **_sfunc_; save previous _func_
- * char **_sfile_; save previous _file_
- * int *_slevel_; save previous nesting level
- * char ***_sframep_; save previous frame pointer
- *
- * DESCRIPTION
- *
- * Called at the beginning of each user function to tell
- * the debugger that a new function has been entered.
- * Note that the pointers to the previous user function
- * name and previous user file name are stored on the
- * caller's stack (this is why the ENTER macro must be
- * the first "executable" code in a function, since it
- * allocates these storage locations). The previous nesting
- * level is also stored on the callers stack for internal
- * self consistency checks.
- *
- * Also prints a trace line if tracing is enabled and
- * increments the current function nesting depth.
- *
- * Note that this mechanism allows the debugger to know
- * what the current user function is at all times, without
- * maintaining an internal stack for the function names.
- *
- */
-
-void _db_enter_ (_func_, _file_, _line_, _sfunc_, _sfile_, _slevel_,
- _sframep_)
-const char *_func_;
-const char *_file_;
-uint _line_;
-const char **_sfunc_;
-const char **_sfile_;
-uint *_slevel_;
-char ***_sframep_ __attribute__((unused));
-{
- reg1 CODE_STATE *state;
-
- if (!_no_db_)
- {
- int save_errno=errno;
- if (!init_done)
- _db_push_ (_DBUG_START_CONDITION_);
- state=code_state();
-
- *_sfunc_ = state->func;
- *_sfile_ = state->file;
- state->func =(char*) _func_;
- state->file = (char*) _file_; /* BaseName takes time !! */
- *_slevel_ = ++state->level;
-#ifndef THREAD
- *_sframep_ = state->framep;
- state->framep = (char **) _sframep_;
- if (DoProfile ())
- {
- long stackused;
- if (*state->framep == NULL) {
- stackused = 0;
- } else {
- stackused = ((long)(*state->framep)) - ((long)(state->framep));
- stackused = stackused > 0 ? stackused : -stackused;
- }
- (void) fprintf (_db_pfp_, PROF_EFMT , Clock (), state->func);
-#ifdef AUTOS_REVERSE
- (void) fprintf (_db_pfp_, PROF_SFMT, state->framep, stackused, *_sfunc_);
-#else
- (void) fprintf (_db_pfp_, PROF_SFMT, (ulong) state->framep, stackused,
- state->func);
-#endif
- (void) fflush (_db_pfp_);
- }
-#endif
- if (DoTrace (state))
- {
- if (!state->locked)
- pthread_mutex_lock(&THR_LOCK_dbug);
- DoPrefix (_line_);
- Indent (state -> level);
- (void) fprintf (_db_fp_, ">%s\n", state->func);
- dbug_flush (state); /* This does a unlock */
- }
-#ifdef SAFEMALLOC
- if (stack -> flags & SANITY_CHECK_ON)
- if (_sanity(_file_,_line_)) /* Check of safemalloc */
- stack -> flags &= ~SANITY_CHECK_ON;
-#endif
- errno=save_errno;
- }
-}
-
-/*
- * FUNCTION
- *
- * _db_return_ process exit from user function
- *
- * SYNOPSIS
- *
- * VOID _db_return_ (_line_, _sfunc_, _sfile_, _slevel_)
- * int _line_; current source line number
- * char **_sfunc_; where previous _func_ is to be retrieved
- * char **_sfile_; where previous _file_ is to be retrieved
- * int *_slevel_; where previous level was stashed
- *
- * DESCRIPTION
- *
- * Called just before user function executes an explicit or implicit
- * return. Prints a trace line if trace is enabled, decrements
- * the current nesting level, and restores the current function and
- * file names from the defunct function's stack.
- *
- */
-
-void _db_return_ (_line_, _sfunc_, _sfile_, _slevel_)
-uint _line_;
-const char **_sfunc_;
-const char **_sfile_;
-uint *_slevel_;
-{
- CODE_STATE *state;
-
- if (!_no_db_)
- {
- int save_errno=errno;
- if (!init_done)
- _db_push_ ("");
- if (!(state=code_state()))
- return; /* Only happens at end of program */
- if (stack->flags & (TRACE_ON | DEBUG_ON | PROFILE_ON))
- {
- if (!state->locked)
- pthread_mutex_lock(&THR_LOCK_dbug);
- if (state->level != (int) *_slevel_)
- (void) fprintf (_db_fp_, ERR_MISSING_RETURN, _db_process_,
- state->func);
- else
- {
-#ifdef SAFEMALLOC
- if (stack -> flags & SANITY_CHECK_ON)
- if (_sanity(*_sfile_,_line_))
- stack->flags &= ~SANITY_CHECK_ON;
-#endif
-#ifndef THREAD
- if (DoProfile ())
- (void) fprintf (_db_pfp_, PROF_XFMT, Clock(), state->func);
-#endif
- if (DoTrace (state))
- {
- DoPrefix (_line_);
- Indent (state->level);
- (void) fprintf (_db_fp_, "<%s\n", state->func);
- }
- }
- dbug_flush(state);
- }
- state->level = *_slevel_-1;
- state->func = *_sfunc_;
- state->file = *_sfile_;
-#ifndef THREAD
- if (state->framep != NULL)
- state->framep = (char **) *state->framep;
-#endif
- errno=save_errno;
- }
-}
-
-
-/*
- * FUNCTION
- *
- * _db_pargs_ log arguments for subsequent use by _db_doprnt_()
- *
- * SYNOPSIS
- *
- * VOID _db_pargs_ (_line_, keyword)
- * int _line_;
- * char *keyword;
- *
- * DESCRIPTION
- *
- * The new universal printing macro DBUG_PRINT, which replaces
- * all forms of the DBUG_N macros, needs two calls to runtime
- * support routines. The first, this function, remembers arguments
- * that are used by the subsequent call to _db_doprnt_().
- *
- */
-
-void _db_pargs_ (_line_, keyword)
-uint _line_;
-const char *keyword;
-{
- CODE_STATE *state=code_state();
- state->u_line = _line_;
- state->u_keyword = (char*) keyword;
-}
-
-
-/*
- * FUNCTION
- *
- * _db_doprnt_ handle print of debug lines
- *
- * SYNOPSIS
- *
- * VOID _db_doprnt_ (format, va_alist)
- * char *format;
- * va_dcl;
- *
- * DESCRIPTION
- *
- * When invoked via one of the DBUG macros, tests the current keyword
- * set by calling _db_pargs_() to see if that macro has been selected
- * for processing via the debugger control string, and if so, handles
- * printing of the arguments via the format string. The line number
- * of the DBUG macro in the source is found in u_line.
- *
- * Note that the format string SHOULD NOT include a terminating
- * newline, this is supplied automatically.
- *
- */
-
-#include <stdarg.h>
-
-void _db_doprnt_ (const char *format,...)
-{
- va_list args;
- CODE_STATE *state;
- state=code_state();
-
- va_start(args,format);
-
- if (_db_keyword_ (state->u_keyword)) {
- int save_errno=errno;
- if (!state->locked)
- pthread_mutex_lock(&THR_LOCK_dbug);
- DoPrefix (state->u_line);
- if (TRACING) {
- Indent (state->level + 1);
- } else {
- (void) fprintf (_db_fp_, "%s: ", state->func);
- }
- (void) fprintf (_db_fp_, "%s: ", state->u_keyword);
- (void) vfprintf (_db_fp_, format, args);
- va_end(args);
- (void) fputc('\n',_db_fp_);
- dbug_flush(state);
- errno=save_errno;
- }
- va_end(args);
-}
-
-
-/*
- * FUNCTION
- *
- * _db_dump_ dump a string until '\0' is found
- *
- * SYNOPSIS
- *
- * void _db_dump_ (_line_,keyword,memory,length)
- * int _line_; current source line number
- * char *keyword;
- * char *memory; Memory to print
- * int length; Bytes to print
- *
- * DESCRIPTION
- * Dump N characters in a binary array.
- * Is used to examine corrputed memory or arrays.
- */
-
-void _db_dump_(_line_,keyword,memory,length)
-uint _line_,length;
-const char *keyword;
-const char *memory;
-{
- int pos;
- char dbuff[90];
- CODE_STATE *state;
- state=code_state();
-
- if (_db_keyword_ ((char*) keyword))
- {
- if (!state->locked)
- pthread_mutex_lock(&THR_LOCK_dbug);
- DoPrefix (_line_);
- if (TRACING)
- {
- Indent (state->level + 1);
- pos= min(max(state->level-stack->sub_level,0)*INDENT,80);
- }
- else
- {
- fprintf(_db_fp_, "%s: ", state->func);
- }
- sprintf(dbuff,"%s: Memory: %lx Bytes: (%d)\n",
- keyword,(ulong) memory, length);
- (void) fputs(dbuff,_db_fp_);
-
- pos=0;
- while (length-- > 0)
- {
- uint tmp= *((unsigned char*) memory++);
- if ((pos+=3) >= 80)
- {
- fputc('\n',_db_fp_);
- pos=3;
- }
- fputc(_dig_vec[((tmp >> 4) & 15)], _db_fp_);
- fputc(_dig_vec[tmp & 15], _db_fp_);
- fputc(' ',_db_fp_);
- }
- (void) fputc('\n',_db_fp_);
- dbug_flush(state);
- }
-}
-
-/*
- * FUNCTION
- *
- * ListParse parse list of modifiers in debug control string
- *
- * SYNOPSIS
- *
- * static struct link *ListParse (ctlp)
- * char *ctlp;
- *
- * DESCRIPTION
- *
- * Given pointer to a comma separated list of strings in "cltp",
- * parses the list, building a list and returning a pointer to it.
- * The original comma separated list is destroyed in the process of
- * building the linked list, thus it had better be a duplicate
- * if it is important.
- *
- * Note that since each link is added at the head of the list,
- * the final list will be in "reverse order", which is not
- * significant for our usage here.
- *
- */
-
-static struct link *ListParse (ctlp)
-char *ctlp;
-{
- REGISTER char *start;
- REGISTER struct link *new;
- REGISTER struct link *head;
-
- head = NULL;
- while (*ctlp != EOS) {
- start = ctlp;
- while (*ctlp != EOS && *ctlp != ',') {
- ctlp++;
- }
- if (*ctlp == ',') {
- *ctlp++ = EOS;
- }
- new = (struct link *) DbugMalloc (sizeof (struct link));
- new -> str = StrDup (start);
- new -> next_link = head;
- head = new;
- }
- return (head);
-}
-
-/*
- * FUNCTION
- *
- * InList test a given string for member of a given list
- *
- * SYNOPSIS
- *
- * static BOOLEAN InList (linkp, cp)
- * struct link *linkp;
- * char *cp;
- *
- * DESCRIPTION
- *
- * Tests the string pointed to by "cp" to determine if it is in
- * the list pointed to by "linkp". Linkp points to the first
- * link in the list. If linkp is NULL then the string is treated
- * as if it is in the list (I.E all strings are in the null list).
- * This may seem rather strange at first but leads to the desired
- * operation if no list is given. The net effect is that all
- * strings will be accepted when there is no list, and when there
- * is a list, only those strings in the list will be accepted.
- *
- */
-
-static BOOLEAN InList (linkp, cp)
-struct link *linkp;
-const char *cp;
-{
- REGISTER struct link *scan;
- REGISTER BOOLEAN result;
-
- if (linkp == NULL) {
- result = TRUE;
- } else {
- result = FALSE;
- for (scan = linkp; scan != NULL; scan = scan -> next_link) {
- if (STREQ (scan -> str, cp)) {
- result = TRUE;
- break;
- }
- }
- }
- return (result);
-}
-
-
-/*
- * FUNCTION
- *
- * PushState push current state onto stack and set up new one
- *
- * SYNOPSIS
- *
- * static VOID PushState ()
- *
- * DESCRIPTION
- *
- * Pushes the current state on the state stack, and initializes
- * a new state. The only parameter inherited from the previous
- * state is the function nesting level. This action can be
- * inhibited if desired, via the "r" flag.
- *
- * The state stack is a linked list of states, with the new
- * state added at the head. This allows the stack to grow
- * to the limits of memory if necessary.
- *
- */
-
-static void PushState ()
-{
- REGISTER struct state *new;
-
- if (!init_done)
- {
- init_dbug_state();
- init_done=TRUE;
- }
- (void) code_state(); /* Alloc memory */
- new = (struct state *) DbugMalloc (sizeof (struct state));
- new -> flags = 0;
- new -> delay = 0;
- new -> maxdepth = MAXDEPTH;
- new -> sub_level=0;
- new -> out_file = stderr;
- new -> prof_file = (FILE*) 0;
- new -> functions = NULL;
- new -> p_functions = NULL;
- new -> keywords = NULL;
- new -> processes = NULL;
- new -> next_state = stack;
- stack=new;
-}
-
-
-/*
- * FUNCTION
- *
- * DoTrace check to see if tracing is current enabled
- *
- * SYNOPSIS
- *
- * static BOOLEAN DoTrace (stack)
- *
- * DESCRIPTION
- *
- * Checks to see if tracing is enabled based on whether the
- * user has specified tracing, the maximum trace depth has
- * not yet been reached, the current function is selected,
- * and the current process is selected. Returns TRUE if
- * tracing is enabled, FALSE otherwise.
- *
- */
-
-static BOOLEAN DoTrace (CODE_STATE *state)
-{
- reg2 BOOLEAN trace=FALSE;
-
- if (TRACING &&
- state->level <= stack -> maxdepth &&
- InList (stack -> functions, state->func) &&
- InList (stack -> processes, _db_process_))
- trace = TRUE;
- return (trace);
-}
-
-
-/*
- * FUNCTION
- *
- * DoProfile check to see if profiling is current enabled
- *
- * SYNOPSIS
- *
- * static BOOLEAN DoProfile ()
- *
- * DESCRIPTION
- *
- * Checks to see if profiling is enabled based on whether the
- * user has specified profiling, the maximum trace depth has
- * not yet been reached, the current function is selected,
- * and the current process is selected. Returns TRUE if
- * profiling is enabled, FALSE otherwise.
- *
- */
-
-#ifndef THREAD
-static BOOLEAN DoProfile ()
-{
- REGISTER BOOLEAN profile;
- CODE_STATE *state;
- state=code_state();
-
- profile = FALSE;
- if (PROFILING &&
- state->level <= stack -> maxdepth &&
- InList (stack -> p_functions, state->func) &&
- InList (stack -> processes, _db_process_))
- profile = TRUE;
- return (profile);
-}
-#endif
-
-
-/*
- * FUNCTION
- *
- * _db_keyword_ test keyword for member of keyword list
- *
- * SYNOPSIS
- *
- * BOOLEAN _db_keyword_ (keyword)
- * char *keyword;
- *
- * DESCRIPTION
- *
- * Test a keyword to determine if it is in the currently active
- * keyword list. As with the function list, a keyword is accepted
- * if the list is null, otherwise it must match one of the list
- * members. When debugging is not on, no keywords are accepted.
- * After the maximum trace level is exceeded, no keywords are
- * accepted (this behavior subject to change). Additionally,
- * the current function and process must be accepted based on
- * their respective lists.
- *
- * Returns TRUE if keyword accepted, FALSE otherwise.
- *
- */
-
-BOOLEAN _db_keyword_ (keyword)
-const char *keyword;
-{
- REGISTER BOOLEAN result;
- CODE_STATE *state;
-
- if (!init_done)
- _db_push_ ("");
- state=code_state();
- result = FALSE;
- if (DEBUGGING &&
- state->level <= stack -> maxdepth &&
- InList (stack -> functions, state->func) &&
- InList (stack -> keywords, keyword) &&
- InList (stack -> processes, _db_process_))
- result = TRUE;
- return (result);
-}
-
-/*
- * FUNCTION
- *
- * Indent indent a line to the given indentation level
- *
- * SYNOPSIS
- *
- * static VOID Indent (indent)
- * int indent;
- *
- * DESCRIPTION
- *
- * Indent a line to the given level. Note that this is
- * a simple minded but portable implementation.
- * There are better ways.
- *
- * Also, the indent must be scaled by the compile time option
- * of character positions per nesting level.
- *
- */
-
-static void Indent (indent)
-int indent;
-{
- REGISTER int count;
-
- indent= max(indent-1-stack->sub_level,0)*INDENT;
- for (count = 0; count < indent ; count++)
- {
- if ((count % INDENT) == 0)
- fputc('|',_db_fp_);
- else
- fputc(' ',_db_fp_);
- }
-}
-
-
-/*
- * FUNCTION
- *
- * FreeList free all memory associated with a linked list
- *
- * SYNOPSIS
- *
- * static VOID FreeList (linkp)
- * struct link *linkp;
- *
- * DESCRIPTION
- *
- * Given pointer to the head of a linked list, frees all
- * memory held by the list and the members of the list.
- *
- */
-
-static void FreeList (linkp)
-struct link *linkp;
-{
- REGISTER struct link *old;
-
- while (linkp != NULL) {
- old = linkp;
- linkp = linkp -> next_link;
- if (old -> str != NULL) {
- free (old -> str);
- }
- free ((char *) old);
- }
-}
-
-
-/*
- * FUNCTION
- *
- * StrDup make a duplicate of a string in new memory
- *
- * SYNOPSIS
- *
- * static char *StrDup (my_string)
- * char *string;
- *
- * DESCRIPTION
- *
- * Given pointer to a string, allocates sufficient memory to make
- * a duplicate copy, and copies the string to the newly allocated
- * memory. Failure to allocated sufficient memory is immediately
- * fatal.
- *
- */
-
-
-static char *StrDup (str)
-const char *str;
-{
- reg1 char *new;
- new = DbugMalloc ((int) strlen (str) + 1);
- (void) strcpy (new, str);
- return (new);
-}
-
-
-/*
- * FUNCTION
- *
- * DoPrefix print debugger line prefix prior to indentation
- *
- * SYNOPSIS
- *
- * static VOID DoPrefix (_line_)
- * int _line_;
- *
- * DESCRIPTION
- *
- * Print prefix common to all debugger output lines, prior to
- * doing indentation if necessary. Print such information as
- * current process name, current source file name and line number,
- * and current function nesting depth.
- *
- */
-
-static void DoPrefix (_line_)
-uint _line_;
-{
- CODE_STATE *state;
- state=code_state();
-
- state->lineno++;
- if (stack -> flags & PID_ON) {
-#ifdef THREAD
- (void) fprintf (_db_fp_, "%-7s: ", my_thread_name());
-#else
- (void) fprintf (_db_fp_, "%5d: ", getpid ());
-#endif
- }
- if (stack -> flags & NUMBER_ON) {
- (void) fprintf (_db_fp_, "%5d: ", state->lineno);
- }
- if (stack -> flags & PROCESS_ON) {
- (void) fprintf (_db_fp_, "%s: ", _db_process_);
- }
- if (stack -> flags & FILE_ON) {
- (void) fprintf (_db_fp_, "%14s: ", BaseName(state->file));
- }
- if (stack -> flags & LINE_ON) {
- (void) fprintf (_db_fp_, "%5d: ", _line_);
- }
- if (stack -> flags & DEPTH_ON) {
- (void) fprintf (_db_fp_, "%4d: ", state->level);
- }
-}
-
-
-/*
- * FUNCTION
- *
- * DBUGOpenFile open new output stream for debugger output
- *
- * SYNOPSIS
- *
- * static VOID DBUGOpenFile (name)
- * char *name;
- *
- * DESCRIPTION
- *
- * Given name of a new file (or "-" for stdout) opens the file
- * and sets the output stream to the new file.
- *
- */
-
-static void DBUGOpenFile (const char *name,int append)
-{
- REGISTER FILE *fp;
- REGISTER BOOLEAN newfile;
-
- if (name != NULL)
- {
- strmov(stack->name,name);
- if (strcmp (name, "-") == 0)
- {
- _db_fp_ = stdout;
- stack -> out_file = _db_fp_;
- stack -> flags |= FLUSH_ON_WRITE;
- }
- else
- {
- if (!Writable(name))
- {
- (void) fprintf (stderr, ERR_OPEN, _db_process_, name);
- perror ("");
- fflush(stderr);
- }
- else
- {
- newfile= !EXISTS (name);
- if (!(fp = fopen(name, append ? "a+" : "w")))
- {
- (void) fprintf (stderr, ERR_OPEN, _db_process_, name);
- perror ("");
- fflush(stderr);
- }
- else
- {
- _db_fp_ = fp;
- stack -> out_file = fp;
- if (newfile) {
- ChangeOwner (name);
- }
- }
- }
- }
- }
-}
-
-
-/*
- * FUNCTION
- *
- * OpenProfile open new output stream for profiler output
- *
- * SYNOPSIS
- *
- * static FILE *OpenProfile (name)
- * char *name;
- *
- * DESCRIPTION
- *
- * Given name of a new file, opens the file
- * and sets the profiler output stream to the new file.
- *
- * It is currently unclear whether the prefered behavior is
- * to truncate any existing file, or simply append to it.
- * The latter behavior would be desirable for collecting
- * accumulated runtime history over a number of separate
- * runs. It might take some changes to the analyzer program
- * though, and the notes that Binayak sent with the profiling
- * diffs indicated that append was the normal mode, but this
- * does not appear to agree with the actual code. I haven't
- * investigated at this time [fnf; 24-Jul-87].
- */
-
-#ifndef THREAD
-static FILE *OpenProfile (const char *name)
-{
- REGISTER FILE *fp;
- REGISTER BOOLEAN newfile;
-
- fp=0;
- if (!Writable (name))
- {
- (void) fprintf (_db_fp_, ERR_OPEN, _db_process_, name);
- perror ("");
- dbug_flush(0);
- (void) Delay (stack -> delay);
- }
- else
- {
- newfile= !EXISTS (name);
- if (!(fp = fopen (name, "w")))
- {
- (void) fprintf (_db_fp_, ERR_OPEN, _db_process_, name);
- perror ("");
- dbug_flush(0);
- }
- else
- {
- _db_pfp_ = fp;
- stack -> prof_file = fp;
- if (newfile)
- {
- ChangeOwner (name);
- }
- }
- }
- return fp;
-}
-#endif
-
-/*
- * FUNCTION
- *
- * CloseFile close the debug output stream
- *
- * SYNOPSIS
- *
- * static VOID CloseFile (fp)
- * FILE *fp;
- *
- * DESCRIPTION
- *
- * Closes the debug output stream unless it is standard output
- * or standard error.
- *
- */
-
-static void CloseFile (fp)
-FILE *fp;
-{
- if (fp != stderr && fp != stdout) {
- if (fclose (fp) == EOF) {
- pthread_mutex_lock(&THR_LOCK_dbug);
- (void) fprintf (_db_fp_, ERR_CLOSE, _db_process_);
- perror ("");
- dbug_flush(0);
- }
- }
-}
-
-
-/*
- * FUNCTION
- *
- * DbugExit print error message and exit
- *
- * SYNOPSIS
- *
- * static VOID DbugExit (why)
- * char *why;
- *
- * DESCRIPTION
- *
- * Prints error message using current process name, the reason for
- * aborting (typically out of memory), and exits with status 1.
- * This should probably be changed to use a status code
- * defined in the user's debugger include file.
- *
- */
-
-static void DbugExit (const char *why)
-{
- (void) fprintf (stderr, ERR_ABORT, _db_process_, why);
- (void) fflush (stderr);
- exit (1);
-}
-
-
-/*
- * FUNCTION
- *
- * DbugMalloc allocate memory for debugger runtime support
- *
- * SYNOPSIS
- *
- * static long *DbugMalloc (size)
- * int size;
- *
- * DESCRIPTION
- *
- * Allocate more memory for debugger runtime support functions.
- * Failure to to allocate the requested number of bytes is
- * immediately fatal to the current process. This may be
- * rather unfriendly behavior. It might be better to simply
- * print a warning message, freeze the current debugger state,
- * and continue execution.
- *
- */
-
-static char *DbugMalloc (size)
-int size;
-{
- register char *new;
-
- if (!(new = malloc ((unsigned int) size)))
- DbugExit ("out of memory");
- return (new);
-}
-
-
-/*
- * As strtok but two separators in a row are changed to one
- * separator (to allow directory-paths in dos).
- */
-
-static char *static_strtok (s1, separator)
-char *s1;
-pchar separator;
-{
- static char *end = NULL;
- reg1 char *rtnval,*cpy;
-
- rtnval = NULL;
- if (s1 != NULL)
- end = s1;
- if (end != NULL && *end != EOS)
- {
- rtnval=cpy=end;
- do
- {
- if ((*cpy++ = *end++) == separator)
- {
- if (*end != separator)
- {
- cpy--; /* Point at separator */
- break;
- }
- end++; /* Two separators in a row, skipp one */
- }
- } while (*end != EOS);
- *cpy=EOS; /* Replace last separator */
- }
- return (rtnval);
-}
-
-
-/*
- * FUNCTION
- *
- * BaseName strip leading pathname components from name
- *
- * SYNOPSIS
- *
- * static char *BaseName (pathname)
- * char *pathname;
- *
- * DESCRIPTION
- *
- * Given pointer to a complete pathname, locates the base file
- * name at the end of the pathname and returns a pointer to
- * it.
- *
- */
-
-static char *BaseName (const char *pathname)
-{
- register const char *base;
-
- base = strrchr (pathname, FN_LIBCHAR);
- if (base++ == NullS)
- base = pathname;
- return ((char*) base);
-}
-
-
-/*
- * FUNCTION
- *
- * Writable test to see if a pathname is writable/creatable
- *
- * SYNOPSIS
- *
- * static BOOLEAN Writable (pathname)
- * char *pathname;
- *
- * DESCRIPTION
- *
- * Because the debugger might be linked in with a program that
- * runs with the set-uid-bit (suid) set, we have to be careful
- * about opening a user named file for debug output. This consists
- * of checking the file for write access with the real user id,
- * or checking the directory where the file will be created.
- *
- * Returns TRUE if the user would normally be allowed write or
- * create access to the named file. Returns FALSE otherwise.
- *
- */
-
-
-#ifndef Writable
-
-static BOOLEAN Writable (pathname)
-char *pathname;
-{
- REGISTER BOOLEAN granted;
- REGISTER char *lastslash;
-
- granted = FALSE;
- if (EXISTS (pathname)) {
- if (WRITABLE (pathname)) {
- granted = TRUE;
- }
- } else {
- lastslash = strrchr (pathname, '/');
- if (lastslash != NULL) {
- *lastslash = EOS;
- } else {
- pathname = ".";
- }
- if (WRITABLE (pathname)) {
- granted = TRUE;
- }
- if (lastslash != NULL) {
- *lastslash = '/';
- }
- }
- return (granted);
-}
-#endif
-
-
-/*
- * FUNCTION
- *
- * ChangeOwner change owner to real user for suid programs
- *
- * SYNOPSIS
- *
- * static VOID ChangeOwner (pathname)
- *
- * DESCRIPTION
- *
- * For unix systems, change the owner of the newly created debug
- * file to the real owner. This is strictly for the benefit of
- * programs that are running with the set-user-id bit set.
- *
- * Note that at this point, the fact that pathname represents
- * a newly created file has already been established. If the
- * program that the debugger is linked to is not running with
- * the suid bit set, then this operation is redundant (but
- * harmless).
- *
- */
-
-#ifndef ChangeOwner
-static void ChangeOwner (pathname)
-char *pathname;
-{
- if (chown (pathname, getuid (), getgid ()) == -1)
- {
- (void) fprintf (stderr, ERR_CHOWN, _db_process_, pathname);
- perror ("");
- (void) fflush (stderr);
- }
-}
-#endif
-
-
-/*
- * FUNCTION
- *
- * _db_setjmp_ save debugger environment
- *
- * SYNOPSIS
- *
- * VOID _db_setjmp_ ()
- *
- * DESCRIPTION
- *
- * Invoked as part of the user's DBUG_SETJMP macro to save
- * the debugger environment in parallel with saving the user's
- * environment.
- *
- */
-
-#ifdef HAVE_LONGJMP
-
-EXPORT void _db_setjmp_ ()
-{
- CODE_STATE *state;
- state=code_state();
-
- state->jmplevel = state->level;
- state->jmpfunc = state->func;
- state->jmpfile = state->file;
-}
-
-/*
- * FUNCTION
- *
- * _db_longjmp_ restore previously saved debugger environment
- *
- * SYNOPSIS
- *
- * VOID _db_longjmp_ ()
- *
- * DESCRIPTION
- *
- * Invoked as part of the user's DBUG_LONGJMP macro to restore
- * the debugger environment in parallel with restoring the user's
- * previously saved environment.
- *
- */
-
-EXPORT void _db_longjmp_ ()
-{
- CODE_STATE *state;
- state=code_state();
-
- state->level = state->jmplevel;
- if (state->jmpfunc) {
- state->func = state->jmpfunc;
- }
- if (state->jmpfile) {
- state->file = state->jmpfile;
- }
-}
-#endif
-
-/*
- * FUNCTION
- *
- * DelayArg convert D flag argument to appropriate value
- *
- * SYNOPSIS
- *
- * static int DelayArg (value)
- * int value;
- *
- * DESCRIPTION
- *
- * Converts delay argument, given in tenths of a second, to the
- * appropriate numerical argument used by the system to delay
- * that that many tenths of a second. For example, on the
- * amiga, there is a system call "Delay()" which takes an
- * argument in ticks (50 per second). On unix, the sleep
- * command takes seconds. Thus a value of "10", for one
- * second of delay, gets converted to 50 on the amiga, and 1
- * on unix. Other systems will need to use a timing loop.
- *
- */
-
-#ifdef AMIGA
-#define HZ (50) /* Probably in some header somewhere */
-#endif
-
-static int DelayArg (value)
-int value;
-{
- uint delayarg = 0;
-
-#if (unix || xenix)
- delayarg = value / 10; /* Delay is in seconds for sleep () */
-#endif
-#ifdef AMIGA
- delayarg = (HZ * value) / 10; /* Delay in ticks for Delay () */
-#endif
- return (delayarg);
-}
-
-
-/*
- * A dummy delay stub for systems that do not support delays.
- * With a little work, this can be turned into a timing loop.
- */
-
-#if ! defined(Delay) && ! defined(AMIGA)
-static int Delay (ticks)
-int ticks;
-{
- return ticks;
-}
-#endif
-
-
-/*
- * FUNCTION
- *
- * perror perror simulation for systems that don't have it
- *
- * SYNOPSIS
- *
- * static VOID perror (s)
- * char *s;
- *
- * DESCRIPTION
- *
- * Perror produces a message on the standard error stream which
- * provides more information about the library or system error
- * just encountered. The argument string s is printed, followed
- * by a ':', a blank, and then a message and a newline.
- *
- * An undocumented feature of the unix perror is that if the string
- * 's' is a null string (NOT a NULL pointer!), then the ':' and
- * blank are not printed.
- *
- * This version just complains about an "unknown system error".
- *
- */
-
-#ifndef HAVE_PERROR
-static void perror (s)
-char *s;
-{
- if (s && *s != EOS) {
- (void) fprintf (stderr, "%s: ", s);
- }
- (void) fprintf (stderr, "<unknown system error>\n");
-}
-#endif /* HAVE_PERROR */
-
-
- /* flush dbug-stream, free mutex lock & wait delay */
- /* This is because some systems (MSDOS!!) dosn't flush fileheader */
- /* and dbug-file isn't readable after a system crash !! */
-
-static void dbug_flush(CODE_STATE *state)
-{
-#ifndef THREAD
- if (stack->flags & FLUSH_ON_WRITE)
-#endif
- {
-#if defined(MSDOS) || defined(__WIN__)
- if (_db_fp_ != stdout && _db_fp_ != stderr)
- {
- if (!(freopen(stack->name,"a",_db_fp_)))
- {
- (void) fprintf(stderr, ERR_OPEN, _db_process_);
- fflush(stderr);
- _db_fp_ = stdout;
- stack -> out_file = _db_fp_;
- stack -> flags|=FLUSH_ON_WRITE;
- }
- }
- else
-#endif
- {
- (void) fflush (_db_fp_);
- if (stack->delay)
- (void) Delay (stack->delay);
- }
- }
- if (!state || !state->locked)
- pthread_mutex_unlock(&THR_LOCK_dbug);
-} /* dbug_flush */
-
-
-void _db_lock_file()
-{
- CODE_STATE *state;
- state=code_state();
- pthread_mutex_lock(&THR_LOCK_dbug);
- state->locked=1;
-}
-
-void _db_unlock_file()
-{
- CODE_STATE *state;
- state=code_state();
- state->locked=0;
- pthread_mutex_unlock(&THR_LOCK_dbug);
-}
-
-/*
- * Here we need the definitions of the clock routine. Add your
- * own for whatever system that you have.
- */
-
-#ifdef HAVE_GETRUSAGE
-
-#include <sys/param.h>
-#include <sys/resource.h>
-
-/* extern int getrusage(int, struct rusage *); */
-
-/*
- * Returns the user time in milliseconds used by this process so
- * far.
- */
-
-static unsigned long Clock ()
-{
- struct rusage ru;
-
- (void) getrusage (RUSAGE_SELF, &ru);
- return ((ru.ru_utime.tv_sec * 1000) + (ru.ru_utime.tv_usec / 1000));
-}
-
-#else
-#if defined(MSDOS) || defined(__WIN__)
-
-static ulong Clock()
-{
- return clock()*(1000/CLOCKS_PER_SEC);
-}
-#else
-#ifdef amiga
-
-struct DateStamp { /* Yes, this is a hack, but doing it right */
- long ds_Days; /* is incredibly ugly without splitting this */
- long ds_Minute; /* off into a separate file */
- long ds_Tick;
-};
-
-static int first_clock = TRUE;
-static struct DateStamp begin;
-static struct DateStamp elapsed;
-
-static unsigned long Clock ()
-{
- register struct DateStamp *now;
- register unsigned long millisec = 0;
- extern VOID *AllocMem ();
-
- now = (struct DateStamp *) AllocMem ((long) sizeof (struct DateStamp), 0L);
- if (now != NULL) {
- if (first_clock == TRUE) {
- first_clock = FALSE;
- (void) DateStamp (now);
- begin = *now;
- }
- (void) DateStamp (now);
- millisec = 24 * 3600 * (1000 / HZ) * (now -> ds_Days - begin.ds_Days);
- millisec += 60 * (1000 / HZ) * (now -> ds_Minute - begin.ds_Minute);
- millisec += (1000 / HZ) * (now -> ds_Tick - begin.ds_Tick);
- (void) FreeMem (now, (long) sizeof (struct DateStamp));
- }
- return (millisec);
-}
-
-#else
-
-#ifndef THREAD
-static unsigned long Clock ()
-{
- return (0);
-}
-#endif
-#endif /* amiga */
-#endif /* MSDOS || __WIN__ */
-#endif /* RUSAGE */
-
-
-#ifdef NO_VARARGS
-
-/*
- * Fake vfprintf for systems that don't support it. If this
- * doesn't work, you are probably SOL...
- */
-
-static int vfprintf (stream, format, ap)
-FILE *stream;
-char *format;
-va_list ap;
-{
- int rtnval;
- ARGS_DCL;
-
- ARG0 = va_arg (ap, ARGS_TYPE);
- ARG1 = va_arg (ap, ARGS_TYPE);
- ARG2 = va_arg (ap, ARGS_TYPE);
- ARG3 = va_arg (ap, ARGS_TYPE);
- ARG4 = va_arg (ap, ARGS_TYPE);
- ARG5 = va_arg (ap, ARGS_TYPE);
- ARG6 = va_arg (ap, ARGS_TYPE);
- ARG7 = va_arg (ap, ARGS_TYPE);
- ARG8 = va_arg (ap, ARGS_TYPE);
- ARG9 = va_arg (ap, ARGS_TYPE);
- rtnval = fprintf (stream, format, ARGS_LIST);
- return (rtnval);
-}
-
-#endif /* NO_VARARGS */
diff --git a/ext/mysql/libmysql/dbug.h b/ext/mysql/libmysql/dbug.h
deleted file mode 100644
index d811b584a5..0000000000
--- a/ext/mysql/libmysql/dbug.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-#ifndef _dbug_h
-#define _dbug_h
-#ifdef __cplusplus
-extern "C" {
-#endif
-#if !defined(DBUG_OFF) && !defined(_lint)
-extern int _db_on_,_no_db_;
-extern FILE *_db_fp_;
-extern char *_db_process_;
-extern int _db_keyword_(const char *keyword);
-extern void _db_setjmp_(void);
-extern void _db_longjmp_(void);
-extern void _db_push_(const char *control);
-extern void _db_pop_(void);
-extern void _db_enter_(const char *_func_,const char *_file_,uint _line_,
- const char **_sfunc_,const char **_sfile_,
- uint *_slevel_, char ***);
-extern void _db_return_(uint _line_,const char **_sfunc_,const char **_sfile_,
- uint *_slevel_);
-extern void _db_pargs_(uint _line_,const char *keyword);
-extern void _db_doprnt_ _VARARGS((const char *format,...));
-extern void _db_dump_(uint _line_,const char *keyword,const char *memory,
- uint length);
-extern void _db_lock_file();
-extern void _db_unlock_file();
-
-#define DBUG_ENTER(a) const char *_db_func_, *_db_file_; uint _db_level_; \
- char **_db_framep_; \
- _db_enter_ (a,__FILE__,__LINE__,&_db_func_,&_db_file_,&_db_level_, \
- &_db_framep_)
-#define DBUG_LEAVE \
- (_db_return_ (__LINE__, &_db_func_, &_db_file_, &_db_level_))
-#define DBUG_RETURN(a1) {DBUG_LEAVE; return(a1);}
-#define DBUG_VOID_RETURN {DBUG_LEAVE; return;}
-#define DBUG_EXECUTE(keyword,a1) \
- {if (_db_on_) {if (_db_keyword_ (keyword)) { a1 }}}
-#define DBUG_PRINT(keyword,arglist) \
- {if (_db_on_) {_db_pargs_(__LINE__,keyword); _db_doprnt_ arglist;}}
-#define DBUG_PUSH(a1) _db_push_ (a1)
-#define DBUG_POP() _db_pop_ ()
-#define DBUG_PROCESS(a1) (_db_process_ = a1)
-#define DBUG_FILE (_db_fp_)
-#define DBUG_SETJMP(a1) (_db_setjmp_ (), setjmp (a1))
-#define DBUG_LONGJMP(a1,a2) (_db_longjmp_ (), longjmp (a1, a2))
-#define DBUG_DUMP(keyword,a1,a2)\
- {if (_db_on_) {_db_dump_(__LINE__,keyword,a1,a2);}}
-#define DBUG_IN_USE (_db_fp_ && _db_fp_ != stderr)
-#define DEBUGGER_OFF _no_db_=1;_db_on_=0;
-#define DEBUGGER_ON _no_db_=0
-#define DBUG_LOCK_FILE { _db_lock_file(); }
-#define DBUG_UNLOCK_FILE { _db_unlock_file(); }
-#define DBUG_ASSERT(A) A
-#else /* No debugger */
-
-#define DBUG_ENTER(a1)
-#define DBUG_RETURN(a1) return(a1)
-#define DBUG_VOID_RETURN return
-#define DBUG_EXECUTE(keyword,a1) {}
-#define DBUG_PRINT(keyword,arglist) {}
-#define DBUG_PUSH(a1) {}
-#define DBUG_POP() {}
-#define DBUG_PROCESS(a1) {}
-#define DBUG_FILE (stderr)
-#define DBUG_SETJMP setjmp
-#define DBUG_LONGJMP longjmp
-#define DBUG_DUMP(keyword,a1,a2) {}
-#define DBUG_IN_USE 0
-#define DEBUGGER_OFF
-#define DEBUGGER_ON
-#define DBUG_LOCK_FILE
-#define DBUG_UNLOCK_FILE
-#define DBUG_ASSERT(A) {}
-#endif
-#ifdef __cplusplus
-}
-#endif
-#endif
diff --git a/ext/mysql/libmysql/default.c b/ext/mysql/libmysql/default.c
deleted file mode 100644
index d9dbfcf1c6..0000000000
--- a/ext/mysql/libmysql/default.c
+++ /dev/null
@@ -1,384 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-/****************************************************************************
-** Add all options from files named "group".cnf from the default_directories
-** before the command line arguments.
-** On Windows defaults will also search in the Windows directory for a file
-** called 'group'.ini
-** As long as the program uses the last argument for conflicting
-** options one only have to add a call to "load_defaults" to enable
-** use of default values.
-** pre- and end 'blank space' are removed from options and values. The
-** following escape sequences are recognized in values: \b \t \n \r \\
-**
-** The following arguments are handled automaticly; If used, they must be
-** first argument on the command line!
-** --no-defaults ; no options are read.
-** --defaults-file=full-path-to-default-file ; Only this file will be read.
-** --defaults-extra-file=full-path-to-default-file ; Read this file before ~/
-** --print-defaults ; Print the modified command line and exit
-****************************************************************************/
-
-#undef SAFEMALLOC /* safe_malloc is not yet initailized */
-
-#include "mysys_priv.h"
-#include "m_string.h"
-#include "m_ctype.h"
-
-char *defaults_extra_file=0;
-
-/* Which directories are searched for options (and in which order) */
-
-const char *default_directories[]= {
-#ifdef __WIN__
-"C:/",
-#else
-"/etc/",
-#endif
-#ifdef DATADIR
-DATADIR,
-#endif
-"", /* Place for defaults_extra_dir */
-#ifndef __WIN__
-"~/",
-#endif
-NullS,
-};
-
-#define default_ext ".cnf" /* extension for config file */
-#ifdef __WIN__
-#include <winbase.h>
-#define windows_ext ".ini"
-#endif
-
-static my_bool search_default_file(DYNAMIC_ARRAY *args, MEM_ROOT *alloc,
- const char *dir, const char *config_file,
- const char *ext, TYPELIB *group);
-
-
-void load_defaults(const char *conf_file, const char **groups,
- int *argc, char ***argv)
-{
- DYNAMIC_ARRAY args;
- const char **dirs, *forced_default_file;
- TYPELIB group;
- my_bool found_print_defaults=0;
- uint args_used=0;
- MEM_ROOT alloc;
- char *ptr,**res;
- DBUG_ENTER("load_defaults");
-
- init_alloc_root(&alloc,128,0);
- if (*argc >= 2 && !strcmp(argv[0][1],"--no-defaults"))
- {
- /* remove the --no-defaults argument and return only the other arguments */
- uint i;
- if (!(ptr=(char*) alloc_root(&alloc,sizeof(alloc)+
- (*argc + 1)*sizeof(char*))))
- goto err;
- res= (char**) (ptr+sizeof(alloc));
- res[0]= **argv; /* Copy program name */
- for (i=2 ; i < (uint) *argc ; i++)
- res[i-1]=argv[0][i];
- (*argc)--;
- *argv=res;
- *(MEM_ROOT*) ptr= alloc; /* Save alloc root for free */
- DBUG_VOID_RETURN;
- }
-
- /* Check if we want to force the use a specific default file */
- forced_default_file=0;
- if (*argc >= 2)
- {
- if (is_prefix(argv[0][1],"--defaults-file="))
- {
- forced_default_file=strchr(argv[0][1],'=')+1;
- args_used++;
- }
- else if (is_prefix(argv[0][1],"--defaults-extra-file="))
- {
- defaults_extra_file=strchr(argv[0][1],'=')+1;
- args_used++;
- }
- }
-
- group.count=0;
- group.name= "defaults";
- group.type_names= groups;
- for (; *groups ; groups++)
- group.count++;
-
- if (init_dynamic_array(&args, sizeof(char*),*argc, 32))
- goto err;
- if (forced_default_file)
- {
- if (search_default_file(&args, &alloc, "", forced_default_file, "",
- &group))
- goto err;
- }
- else if (dirname_length(conf_file))
- {
- if (search_default_file(&args, &alloc, NullS, conf_file, default_ext,
- &group))
- goto err;
- }
- else
- {
-#ifdef __WIN__
- char system_dir[FN_REFLEN];
- GetWindowsDirectory(system_dir,sizeof(system_dir));
- if (search_default_file(&args, &alloc, system_dir, conf_file, windows_ext,
- &group))
- goto err;
-#endif
-#ifdef __EMX__
- if (getenv("ETC") &&
- search_default_file(&args, &alloc, getenv("ETC"), conf_file,
- default_ext, &group))
- goto err;
-#endif
- for (dirs=default_directories ; *dirs; dirs++)
- {
- int error=0;
- if (**dirs)
- error=search_default_file(&args, &alloc, *dirs, conf_file,
- default_ext, &group);
- else if (defaults_extra_file)
- error=search_default_file(&args, &alloc, NullS, defaults_extra_file,
- default_ext, &group);
- if (error)
- goto err;
- }
- }
- if (!(ptr=(char*) alloc_root(&alloc,sizeof(alloc)+
- (args.elements + *argc +1) *sizeof(char*))))
- goto err;
- res= (char**) (ptr+sizeof(alloc));
-
- /* copy name + found arguments + command line arguments to new array */
- res[0]=argv[0][0];
- memcpy((gptr) (res+1), args.buffer, args.elements*sizeof(char*));
- /* Skipp --defaults-file and --defaults-extra-file */
- (*argc)-= args_used;
- (*argv)+= args_used;
-
- /* Check if we wan't to see the new argument list */
- if (*argc >= 2 && !strcmp(argv[0][1],"--print-defaults"))
- {
- found_print_defaults=1;
- --*argc; ++*argv; /* skipp argument */
- }
-
- memcpy((gptr) (res+1+args.elements), (char*) ((*argv)+1),
- (*argc-1)*sizeof(char*));
- res[args.elements+ *argc]=0; /* last null */
-
- (*argc)+=args.elements;
- *argv= (char**) res;
- *(MEM_ROOT*) ptr= alloc; /* Save alloc root for free */
- delete_dynamic(&args);
- if (found_print_defaults)
- {
- int i;
- printf("%s would have been started with the following arguments:\n",
- **argv);
- for (i=1 ; i < *argc ; i++)
- printf("%s ", (*argv)[i]);
- puts("");
- exit(1);
- }
- DBUG_VOID_RETURN;
-
- err:
- fprintf(stderr,"Program aborted\n");
- exit(1);
-}
-
-
-void free_defaults(char **argv)
-{
- MEM_ROOT ptr;
- memcpy_fixed((char*) &ptr,(char *) argv - sizeof(ptr), sizeof(ptr));
- free_root(&ptr,MYF(0));
-}
-
-
-static my_bool search_default_file(DYNAMIC_ARRAY *args, MEM_ROOT *alloc,
- const char *dir, const char *config_file,
- const char *ext, TYPELIB *group)
-{
- char name[FN_REFLEN+10],buff[FN_REFLEN+1],*ptr,*end,*value,*tmp;
- FILE *fp;
- uint line=0;
- my_bool read_values=0,found_group=0;
-
- if ((dir ? strlen(dir) : 0 )+strlen(config_file) >= FN_REFLEN-3)
- return 0; /* Ignore wrong paths */
- if (dir)
- {
- strmov(name,dir);
- convert_dirname(name);
- if (dir[0] == FN_HOMELIB) /* Add . to filenames in home */
- strcat(name,".");
- strxmov(strend(name),config_file,ext,NullS);
- }
- else
- {
- strmov(name,config_file);
- }
- if (!(fp = my_fopen(fn_format(name,name,"","",4),O_RDONLY,MYF(0))))
- return 0; /* Ignore wrong files */
-
- while (fgets(buff,sizeof(buff)-1,fp))
- {
- line++;
- /* Ignore comment and empty lines */
- for (ptr=buff ; isspace(*ptr) ; ptr++ ) ;
- if (*ptr == '#' || *ptr == ';' || !*ptr)
- continue;
- if (*ptr == '[') /* Group name */
- {
- found_group=1;
- if (!(end=(char *) strchr(++ptr,']')))
- {
- fprintf(stderr,
- "error: Wrong group definition in config file: %s at line %d\n",
- name,line);
- goto err;
- }
- for ( ; isspace(end[-1]) ; end--) ; /* Remove end space */
- end[0]=0;
- read_values=find_type(ptr,group,3) > 0;
- continue;
- }
- if (!found_group)
- {
- fprintf(stderr,
- "error: Found option without preceding group in config file: %s at line: %d\n",
- name,line);
- goto err;
- }
- if (!read_values)
- continue;
- if (!(end=value=strchr(ptr,'=')))
- end=strend(ptr); /* Option without argument */
- for ( ; isspace(end[-1]) ; end--) ;
- if (!value)
- {
- if (!(tmp=alloc_root(alloc,(uint) (end-ptr)+3)))
- goto err;
- strmake(strmov(tmp,"--"),ptr,(uint) (end-ptr));
- if (insert_dynamic(args,(gptr) &tmp))
- goto err;
- }
- else
- {
- /* Remove pre- and end space */
- char *value_end;
- for (value++ ; isspace(*value); value++) ;
- value_end=strend(value);
- for ( ; isspace(value_end[-1]) ; value_end--) ;
- if (value_end < value) /* Empty string */
- value_end=value;
- if (!(tmp=alloc_root(alloc,(uint) (end-ptr)+3 +
- (uint) (value_end-value)+1)))
- goto err;
- if (insert_dynamic(args,(gptr) &tmp))
- goto err;
- ptr=strnmov(strmov(tmp,"--"),ptr,(uint) (end-ptr));
- *ptr++= '=';
- for ( ; value != value_end; value++)
- {
- if (*value == '\\' && value != value_end-1)
- {
- switch(*++value) {
- case 'n':
- *ptr++='\n';
- break;
- case 't':
- *ptr++= '\t';
- break;
- case 'r':
- *ptr++ = '\r';
- break;
- case 'b':
- *ptr++ = '\b';
- break;
- case 's':
- *ptr++= ' '; /* space */
- break;
- case '\\':
- *ptr++= '\\';
- break;
- default: /* Unknown; Keep '\' */
- *ptr++= '\\';
- *ptr++= *value;
- break;
- }
- }
- else
- *ptr++= *value;
- }
- *ptr=0;
- }
- }
- my_fclose(fp,MYF(0));
- return(0);
-
- err:
- my_fclose(fp,MYF(0));
- return 1;
-}
-
-
-void print_defaults(const char *conf_file, const char **groups)
-{
-#ifdef __WIN__
- bool have_ext=fn_ext(conf_file)[0] != 0;
-#endif
- char name[FN_REFLEN];
- const char **dirs;
- puts("\nDefault options are read from the following files in the given order:");
-
- if (dirname_length(conf_file))
- fputs(conf_file,stdout);
- else
- {
-#ifdef __WIN__
- GetWindowsDirectory(name,sizeof(name));
- printf("%s\\%s%s ",name,conf_file,have_ext ? "" : windows_ext);
-#endif
-#ifdef __EMX__
- if (getenv("ETC"))
- printf("%s\\%s%s ", getenv("ETC"), conf_file, default_ext);
-#endif
- for (dirs=default_directories ; *dirs; dirs++)
- {
- if (**dirs)
- strmov(name,*dirs);
- else if (defaults_extra_file)
- strmov(name,defaults_extra_file);
- else
- continue;
- convert_dirname(name);
- if (name[0] == FN_HOMELIB) /* Add . to filenames in home */
- strcat(name,".");
- strxmov(strend(name),conf_file,default_ext," ",NullS);
- fputs(name,stdout);
- }
- puts("");
- }
- fputs("The following groups are read:",stdout);
- for ( ; *groups ; groups++)
- {
- fputc(' ',stdout);
- fputs(*groups,stdout);
- }
- puts("\nThe following options may be given as the first argument:\n\
---print-defaults Print the program argument list and exit\n\
---no-defaults Don't read default options from any options file\n\
---defaults-file=# Only read default options from the given file #\n\
---defaults-extra-file=# Read this file after the global files are read");
-}
-
diff --git a/ext/mysql/libmysql/dll.c b/ext/mysql/libmysql/dll.c
deleted file mode 100644
index fb666c0f3b..0000000000
--- a/ext/mysql/libmysql/dll.c
+++ /dev/null
@@ -1,98 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-/*
-** Handling initialization of the dll library
-*/
-
-#include <global.h>
-#include <my_sys.h>
-#include <my_pthread.h>
-
-static bool libmysql_inited=0;
-
-void libmysql_init(void)
-{
- if (libmysql_inited)
- return;
- libmysql_inited=1;
- my_init();
- {
- DBUG_ENTER("libmysql_init");
-#ifdef LOG_ALL
- DBUG_PUSH("d:t:S:O,c::\\tmp\\libmysql.log");
-#else
- if (getenv("LIBMYSQL_LOG") != NULL)
- DBUG_PUSH(getenv("LIBMYSQL_LOG"));
-#endif
- DBUG_VOID_RETURN;
- }
-}
-
-#ifdef __WIN__
-
-static int inited=0,threads=0;
-HINSTANCE NEAR s_hModule; /* Saved module handle */
-DWORD main_thread;
-
-BOOL APIENTRY LibMain(HANDLE hInst,DWORD ul_reason_being_called,
- LPVOID lpReserved)
-{
- switch (ul_reason_being_called) {
- case DLL_PROCESS_ATTACH: /* case of libentry call in win 3.x */
- if (!inited++)
- {
- s_hModule=hInst;
- libmysql_init();
- main_thread=GetCurrentThreadId();
- }
- break;
- case DLL_THREAD_ATTACH:
- threads++;
- my_thread_init();
- break;
- case DLL_PROCESS_DETACH: /* case of wep call in win 3.x */
- if (!--inited) /* Safety */
- {
- /* my_thread_init() */ /* This may give extra safety */
- my_end(0);
- }
- break;
- case DLL_THREAD_DETACH:
- /* Main thread will free by my_end() */
- threads--;
- if (main_thread != GetCurrentThreadId())
- my_thread_end();
- break;
- default:
- break;
- } /* switch */
-
- return TRUE;
-
- UNREFERENCED_PARAMETER(lpReserved);
-} /* LibMain */
-
-int __stdcall DllMain(HANDLE hInst,DWORD ul_reason_being_called,LPVOID lpReserved)
-{
- return LibMain(hInst,ul_reason_being_called,lpReserved);
-}
-
-#elif defined(WINDOWS)
-
-/****************************************************************************
-** This routine is called by LIBSTART.ASM at module load time. All it
-** does in this sample is remember the DLL module handle. The module
-** handle is needed if you want to do things like load stuff from the
-** resource file (for instance string resources).
-****************************************************************************/
-
-int _export FAR PASCAL libmain(HANDLE hModule,short cbHeapSize,
- UCHAR FAR *lszCmdLine)
-{
- s_hModule = hModule;
- libmysql_init();
- return TRUE;
-}
-
-#endif
diff --git a/ext/mysql/libmysql/errmsg.c b/ext/mysql/libmysql/errmsg.c
deleted file mode 100644
index 216693042d..0000000000
--- a/ext/mysql/libmysql/errmsg.c
+++ /dev/null
@@ -1,68 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-/* Error messages for MySQL clients */
-/* error messages for the demon is in share/language/errmsg.sys */
-
-#include <global.h>
-#include <my_sys.h>
-#include "errmsg.h"
-
-#ifdef GERMAN
-const char *client_errors[]=
-{
- "Unbekannter MySQL Fehler",
- "Kann UNIX-Socket nicht anlegen (%d)",
- "Keine Verbindung zu lokalem MySQL Server, socket: '%-.64s' (%d)",
- "Keine Verbindung zu MySQL Server auf %-.64s (%d)",
- "Kann TCP/IP-Socket nicht anlegen (%d)",
- "Unbekannter MySQL Server Host (%-.64s) (%d)",
- "MySQL Server nicht vorhanden",
- "Protokolle ungleich. Server Version = % d Client Version = %d",
- "MySQL client got out of memory",
- "Wrong host info",
- "Localhost via UNIX socket",
- "%-.64s via TCP/IP",
- "Error in server handshake",
- "Lost connection to MySQL server during query",
- "Commands out of sync; You can't run this command now",
- "Verbindung ueber Named Pipe; Host: %-.64s",
- "Kann nicht auf Named Pipe warten. Host: %-.64s pipe: %-.32s (%lu)",
- "Kann Named Pipe nicht oeffnen. Host: %-.64s pipe: %-.32s (%lu)",
- "Kann den Status der Named Pipe nicht setzen. Host: %-.64s pipe: %-.32s (%lu)",
- "Can't initialize character set %-.64s (path: %-.64s)",
- "Got packet bigger than 'max_allowed_packet'"
-};
-
-#else /* ENGLISH */
-const char *client_errors[]=
-{
- "Unknown MySQL error",
- "Can't create UNIX socket (%d)",
- "Can't connect to local MySQL server through socket '%-.64s' (%d)",
- "Can't connect to MySQL server on '%-.64s' (%d)",
- "Can't create TCP/IP socket (%d)",
- "Unknown MySQL Server Host '%-.64s' (%d)",
- "MySQL server has gone away",
- "Protocol mismatch. Server Version = %d Client Version = %d",
- "MySQL client run out of memory",
- "Wrong host info",
- "Localhost via UNIX socket",
- "%-.64s via TCP/IP",
- "Error in server handshake",
- "Lost connection to MySQL server during query",
- "Commands out of sync; You can't run this command now",
- "%-.64s via named pipe",
- "Can't wait for named pipe to host: %-.64s pipe: %-.32s (%lu)",
- "Can't open named pipe to host: %-.64s pipe: %-.32s (%lu)",
- "Can't set state of named pipe to host: %-.64s pipe: %-.32s (%lu)",
- "Can't initialize character set %-.64s (path: %-.64s)",
- "Got packet bigger than 'max_allowed_packet'"
-};
-#endif
-
-
-void init_client_errs(void)
-{
- my_errmsg[CLIENT_ERRMAP] = &client_errors[0];
-}
diff --git a/ext/mysql/libmysql/errmsg.h b/ext/mysql/libmysql/errmsg.h
deleted file mode 100644
index f81bf962db..0000000000
--- a/ext/mysql/libmysql/errmsg.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-/* Error messages for mysql clients */
-/* error messages for the demon is in share/language/errmsg.sys */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-void init_client_errs(void);
-extern const char *client_errors[]; /* Error messages */
-#ifdef __cplusplus
-}
-#endif
-
-#define CR_MIN_ERROR 2000 /* For easier client code */
-#define CR_MAX_ERROR 2999
-#define ER(X) client_errors[(X)-CR_MIN_ERROR]
-#define CLIENT_ERRMAP 2 /* Errormap used by my_error() */
-
-#define CR_UNKNOWN_ERROR 2000
-#define CR_SOCKET_CREATE_ERROR 2001
-#define CR_CONNECTION_ERROR 2002
-#define CR_CONN_HOST_ERROR 2003
-#define CR_IPSOCK_ERROR 2004
-#define CR_UNKNOWN_HOST 2005
-#define CR_SERVER_GONE_ERROR 2006
-#define CR_VERSION_ERROR 2007
-#define CR_OUT_OF_MEMORY 2008
-#define CR_WRONG_HOST_INFO 2009
-#define CR_LOCALHOST_CONNECTION 2010
-#define CR_TCP_CONNECTION 2011
-#define CR_SERVER_HANDSHAKE_ERR 2012
-#define CR_SERVER_LOST 2013
-#define CR_COMMANDS_OUT_OF_SYNC 2014
-#define CR_NAMEDPIPE_CONNECTION 2015
-#define CR_NAMEDPIPEWAIT_ERROR 2016
-#define CR_NAMEDPIPEOPEN_ERROR 2017
-#define CR_NAMEDPIPESETSTATE_ERROR 2018
-#define CR_CANT_READ_CHARSET 2019
-#define CR_NET_PACKET_TOO_LARGE 2020
diff --git a/ext/mysql/libmysql/errors.c b/ext/mysql/libmysql/errors.c
deleted file mode 100644
index 9b11bfb47a..0000000000
--- a/ext/mysql/libmysql/errors.c
+++ /dev/null
@@ -1,78 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-#include "mysys_priv.h"
-#include "mysys_err.h"
-
-#ifndef SHARED_LIBRARY
-
-const char * NEAR globerrs[GLOBERRS]=
-{
- "File '%s' not found (Errcode: %d)",
- "Can't create/write to file '%s' (Errcode: %d)",
- "Error reading file '%s' (Errcode: %d)",
- "Error writing file '%s' (Errcode: %d)",
- "Error on close of '%s' (Errcode: %d)",
- "Out of memory (Needed %u bytes)",
- "Error on delete of '%s' (Errcode: %d)",
- "Error on rename of '%s' to '%s' (Errcode: %d)",
- "",
- "Unexpected eof found when reading file '%s' (Errcode: %d)",
- "Can't lock file (Errcode: %d)",
- "Can't unlock file (Errcode: %d)",
- "Can't read dir of '%s' (Errcode: %d)",
- "Can't get stat of '%s' (Errcode: %d)",
- "Can't change size of file (Errcode: %d)",
- "Can't open stream from handle (Errcode: %d)",
- "Can't get working dirctory (Errcode: %d)",
- "Can't change dir to '%s' (Errcode: %d)",
- "Warning: '%s' had %d links",
- "%d files and %d streams is left open\n",
- "Disk is full writing '%s'. Waiting for someone to free space...",
- "Can't create directory '%s' (Errcode: %d)",
- "Character set '%s' is not a compiled character set and is not specified in the '%s' file",
- "Out of resources when opening file '%s' (Errcode: %d)",
- "Can't read value for symlink '%s' (Error %d)",
- "Can't create symlink '%s' pointing at '%s' (Error %d)",
- "Error on realpath() on '%s' (Error %d)",
-};
-
-void init_glob_errs(void)
-{
- my_errmsg[GLOB] = & globerrs[0];
-} /* init_glob_errs */
-
-#else
-
-void init_glob_errs()
-{
- my_errmsg[GLOB] = & globerrs[0];
-
- EE(EE_FILENOTFOUND) = "File '%s' not found (Errcode: %d)";
- EE(EE_CANTCREATEFILE) = "Can't create/write to file '%s' (Errcode: %d)";
- EE(EE_READ) = "Error reading file '%s' (Errcode: %d)";
- EE(EE_WRITE) = "Error writing file '%s' (Errcode: %d)";
- EE(EE_BADCLOSE) = "Error on close of '%'s (Errcode: %d)";
- EE(EE_OUTOFMEMORY) = "Out of memory (Needed %u bytes)";
- EE(EE_DELETE) = "Error on delete of '%s' (Errcode: %d)";
- EE(EE_LINK) = "Error on rename of '%s' to '%s' (Errcode: %d)";
- EE(EE_EOFERR) = "Unexpected eof found when reading file '%s' (Errcode: %d)";
- EE(EE_CANTLOCK) = "Can't lock file (Errcode: %d)";
- EE(EE_CANTUNLOCK) = "Can't unlock file (Errcode: %d)";
- EE(EE_DIR) = "Can't read dir of '%s' (Errcode: %d)";
- EE(EE_STAT) = "Can't get stat of '%s' (Errcode: %d)";
- EE(EE_CANT_CHSIZE) = "Can't change size of file (Errcode: %d)";
- EE(EE_CANT_OPEN_STREAM)= "Can't open stream from handle (Errcode: %d)";
- EE(EE_GETWD) = "Can't get working dirctory (Errcode: %d)";
- EE(EE_SETWD) = "Can't change dir to '%s' (Errcode: %d)";
- EE(EE_LINK_WARNING) = "Warning: '%s' had %d links";
- EE(EE_OPEN_WARNING) = "%d files and %d streams is left open\n";
- EE(EE_DISK_FULL) = "Disk is full writing '%s'. Waiting for someone to free space...";
- EE(EE_CANT_MKDIR) ="Can't create directory '%s' (Errcode: %d)";
- EE(EE_UNKNOWN_CHARSET)= "Character set is not a compiled character set and is not specified in the %s file";
- EE(EE_OUT_OF_FILERESOURCES)="Out of resources when opening file '%s' (Errcode: %d)";
- EE(EE_CANT_READLINK)="Can't read value for symlink '%s' (Error %d)";
- EE(EE_CANT_SYMLINK)="Can't create symlink '%s' pointing at '%s' (Error %d)";
- EE(EE_REALPATH)="Error on realpath() on '%s' (Error %d)";
-}
-#endif
diff --git a/ext/mysql/libmysql/fix_copyright b/ext/mysql/libmysql/fix_copyright
deleted file mode 100755
index a4d479ecc0..0000000000
--- a/ext/mysql/libmysql/fix_copyright
+++ /dev/null
@@ -1,35 +0,0 @@
-#! /bin/sh
-#
-# This script removes the Copyright messages and inserts
-# Copyright Abandoned messages.
-#
-
-
-if test -z "$1"; then
- echo "Usage: $0 files"
- echo
- echo 'Usual parameters: *.c *.h'
- exit 1
-fi
-
-
-for i in $@; do
- sed \
- -e '/Copyright Abandoned.*MySQL.*/,/NO WARRANTY of any kind/c\
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB \
-This file is public domain and comes with NO WARRANTY of any kind */' \
- -e '/Copyright.*MySQL.*/,/MA 02111/c\
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB \
-This file is public domain and comes with NO WARRANTY of any kind */' \
- -e '/Copyright (C) .*MySQL.*TCX/,/For a more info/c\
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB \
-This file is public domain and comes with NO WARRANTY of any kind */' \
- -e '/Copyright (C) .*TCX.*Monty/,/For a more info/c\
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB \
-This file is public domain and comes with NO WARRANTY of any kind */' \
- -e '/Copyright (C) .... Monty.*/,/be preserved on all copies/c\
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB \
-This file is public domain and comes with NO WARRANTY of any kind */' \
- < $i > tmp
- cp tmp $i
-done
diff --git a/ext/mysql/libmysql/get_password.c b/ext/mysql/libmysql/get_password.c
deleted file mode 100644
index c0c6f90406..0000000000
--- a/ext/mysql/libmysql/get_password.c
+++ /dev/null
@@ -1,198 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-/*
-** Ask for a password from tty
-** This is an own file to avoid conflicts with curses
-*/
-#include <global.h>
-#include <my_sys.h>
-#include "mysql.h"
-#include <m_string.h>
-#include <m_ctype.h>
-#include <dbug.h>
-
-#if defined(HAVE_BROKEN_GETPASS) && !defined(HAVE_GETPASSPHRASE)
-#undef HAVE_GETPASS
-#endif
-
-#ifdef HAVE_GETPASS
-#ifdef HAVE_PWD_H
-#include <pwd.h>
-#endif /* HAVE_PWD_H */
-#else /* ! HAVE_GETPASS */
-#ifndef __WIN__
-#include <sys/ioctl.h>
-#ifdef HAVE_TERMIOS_H /* For tty-password */
-#include <termios.h>
-#define TERMIO struct termios
-#else
-#ifdef HAVE_TERMIO_H /* For tty-password */
-#include <termio.h>
-#define TERMIO struct termio
-#else
-#include <sgtty.h>
-#define TERMIO struct sgttyb
-#endif
-#endif
-#ifdef alpha_linux_port
-#include <asm/ioctls.h> /* QQ; Fix this in configure */
-#include <asm/termiobits.h>
-#endif
-#else
-#include <conio.h>
-#endif /* __WIN__ */
-#endif /* HAVE_GETPASS */
-
-#ifdef HAVE_GETPASSPHRASE /* For Solaris */
-#define getpass(A) getpassphrase(A)
-#endif
-
-#ifdef __WIN__
-/* were just going to fake it here and get input from
- the keyboard */
-
-char *get_tty_password(char *opt_message)
-{
- char to[80];
- char *pos=to,*end=to+sizeof(to)-1;
- int i=0;
- DBUG_ENTER("get_tty_password");
- fprintf(stdout,opt_message ? opt_message : "Enter password: ");
- for (;;)
- {
- char tmp;
- tmp=_getch();
- if (tmp == '\b' || (int) tmp == 127)
- {
- if (pos != to)
- {
- _cputs("\b \b");
- pos--;
- continue;
- }
- }
- if (tmp == '\n' || tmp == '\r' || tmp == 3)
- break;
- if (iscntrl(tmp) || pos == end)
- continue;
- _cputs("*");
- *(pos++) = tmp;
- }
- while (pos != to && isspace(pos[-1]) == ' ')
- pos--; /* Allow dummy space at end */
- *pos=0;
- _cputs("\n");
- DBUG_RETURN(my_strdup(to,MYF(MY_FAE)));
-}
-
-#else
-
-
-#ifndef HAVE_GETPASS
-/*
-** Can't use fgets, because readline will get confused
-** length is max number of chars in to, not counting \0
-* to will not include the eol characters.
-*/
-
-static void get_password(char *to,uint length,int fd,bool echo)
-{
- char *pos=to,*end=to+length;
-
- for (;;)
- {
- char tmp;
- if (my_read(fd,&tmp,1,MYF(0)) != 1)
- break;
- if (tmp == '\b' || (int) tmp == 127)
- {
- if (pos != to)
- {
- if (echo)
- {
- fputs("\b \b",stdout);
- fflush(stdout);
- }
- pos--;
- continue;
- }
- }
- if (tmp == '\n' || tmp == '\r' || tmp == 3)
- break;
- if (iscntrl(tmp) || pos == end)
- continue;
- if (echo)
- {
- fputc('*',stdout);
- fflush(stdout);
- }
- *(pos++) = tmp;
- }
- while (pos != to && isspace(pos[-1]) == ' ')
- pos--; /* Allow dummy space at end */
- *pos=0;
- return;
-}
-#endif /* ! HAVE_GETPASS */
-
-
-char *get_tty_password(char *opt_message)
-{
-#ifdef HAVE_GETPASS
- char *passbuff;
-#else /* ! HAVE_GETPASS */
- TERMIO org,tmp;
-#endif /* HAVE_GETPASS */
- char buff[80];
-
- DBUG_ENTER("get_tty_password");
-
-#ifdef HAVE_GETPASS
- passbuff = getpass(opt_message ? opt_message : "Enter password: ");
-
- /* copy the password to buff and clear original (static) buffer */
- strnmov(buff, passbuff, sizeof(buff) - 1);
-#ifdef _PASSWORD_LEN
- memset(passbuff, 0, _PASSWORD_LEN);
-#endif
-#else
- if (isatty(fileno(stdout)))
- {
- fputs(opt_message ? opt_message : "Enter password: ",stdout);
- fflush(stdout);
- }
-#if defined(HAVE_TERMIOS_H)
- tcgetattr(fileno(stdin), &org);
- tmp = org;
- tmp.c_lflag &= ~(ECHO | ISIG | ICANON);
- tmp.c_cc[VMIN] = 1;
- tmp.c_cc[VTIME] = 0;
- tcsetattr(fileno(stdin), TCSADRAIN, &tmp);
- get_password(buff, sizeof(buff)-1, fileno(stdin), isatty(fileno(stdout)));
- tcsetattr(fileno(stdin), TCSADRAIN, &org);
-#elif defined(HAVE_TERMIO_H)
- ioctl(fileno(stdin), (int) TCGETA, &org);
- tmp=org;
- tmp.c_lflag &= ~(ECHO | ISIG | ICANON);
- tmp.c_cc[VMIN] = 1;
- tmp.c_cc[VTIME]= 0;
- ioctl(fileno(stdin),(int) TCSETA, &tmp);
- get_password(buff,sizeof(buff)-1,fileno(stdin),isatty(fileno(stdout)));
- ioctl(fileno(stdin),(int) TCSETA, &org);
-#else
- gtty(fileno(stdin), &org);
- tmp=org;
- tmp.sg_flags &= ~ECHO;
- tmp.sg_flags |= RAW;
- stty(fileno(stdin), &tmp);
- get_password(buff,sizeof(buff)-1,fileno(stdin),isatty(fileno(stdout)));
- stty(fileno(stdin), &org);
-#endif
- if (isatty(fileno(stdout)))
- fputc('\n',stdout);
-#endif /* HAVE_GETPASS */
-
- DBUG_RETURN(my_strdup(buff,MYF(MY_FAE)));
-}
-#endif /*__WIN__*/
diff --git a/ext/mysql/libmysql/global.h b/ext/mysql/libmysql/global.h
deleted file mode 100644
index f9e3295961..0000000000
--- a/ext/mysql/libmysql/global.h
+++ /dev/null
@@ -1,913 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-/* This is the main include file that should included 'first' in every
- C file. */
-
-#ifndef _global_h
-#define _global_h
-
-#if defined( __EMX__) && !defined( MYSQL_SERVER)
-/* moved here to use below VOID macro redefinition */
-#define INCL_BASE
-#define INCL_NOPMAPI
-#include <os2.h>
-#endif /* __EMX__ */
-
-#ifdef __CYGWIN__
-/* We use a Unix API, so pretend it's not Windows */
-#undef WIN
-#undef WIN32
-#undef _WIN
-#undef _WIN32
-#undef _WIN64
-#undef __WIN__
-#undef __WIN32__
-#define HAVE_ERRNO_AS_DEFINE
-#endif /* __CYGWIN__ */
-
-
-#if defined(_WIN32) || defined(_WIN64) || defined(__WIN32__) || defined(WIN32)
-#include <config-win.h>
-#else
-#include <my_config.h>
-#endif
-#if defined(__cplusplus)
-#if defined(inline)
-#undef inline /* fix configure problem */
-#endif
-#endif /* _cplusplus */
-
-/* Fix problem with S_ISLNK() on Linux */
-#if defined(HAVE_LINUXTHREADS)
-#undef _GNU_SOURCE
-#define _GNU_SOURCE 1
-#endif
-
-/* The client defines this to avoid all thread code */
-#if defined(UNDEF_THREADS_HACK)
-#undef THREAD
-#undef HAVE_mit_thread
-#undef HAVE_LINUXTHREADS
-#undef HAVE_UNIXWARE7_THREADS
-#endif
-
-#ifdef HAVE_THREADS_WITHOUT_SOCKETS
-/* MIT pthreads does not work with unix sockets */
-#undef HAVE_SYS_UN_H
-#endif
-
-#define __EXTENSIONS__ 1 /* We want some extension */
-#ifndef __STDC_EXT__
-#define __STDC_EXT__ 1 /* To get large file support on hpux */
-#endif
-
-#if defined(THREAD) && !defined(__WIN__)
-#ifndef _POSIX_PTHREAD_SEMANTICS
-#define _POSIX_PTHREAD_SEMANTICS /* We want posix threads */
-#endif
-/* was #if defined(HAVE_LINUXTHREADS) || defined(HAVE_DEC_THREADS) || defined(HPUX) */
-#if !defined(SCO)
-#define _REENTRANT 1 /* Some thread libraries require this */
-#endif
-#if !defined(_THREAD_SAFE) && !defined(_AIX)
-#define _THREAD_SAFE /* Required for OSF1 */
-#endif
-#ifndef HAVE_mit_thread
-#ifdef HAVE_UNIXWARE7_THREADS
-#include <thread.h>
-#else
-#include <pthread.h> /* AIX must have this included first */
-#endif /* HAVE_UNIXWARE7_THREADS */
-#endif /* HAVE_mit_thread */
-#if !defined(SCO) && !defined(_REENTRANT)
-#define _REENTRANT 1 /* Threads requires reentrant code */
-#endif
-#endif /* THREAD */
-
-/* Go around some bugs in different OS and compilers */
-#ifdef _AIX /* By soren@t.dk */
-#define _H_STRINGS
-#define _SYS_STREAM_H
-#define _AIX32_CURSES
-#endif
-
-#ifdef HAVE_BROKEN_SNPRINTF /* HPUX 10.20 don't have this defined */
-#undef HAVE_SNPRINTF
-#endif
-#ifdef HAVE_BROKEN_PREAD /* These doesn't work on HPUX 11.x */
-#undef HAVE_PREAD
-#undef HAVE_PWRITE
-#endif
-
-#ifdef UNDEF_HAVE_GETHOSTBYNAME_R /* For OSF4.x */
-#undef HAVE_GETHOSTBYNAME_R
-#endif
-#ifdef UNDEF_HAVE_INITGROUPS /* For AIX 4.3 */
-#undef HAVE_INITGROUPS
-#endif
-
-/* Fix a bug in gcc 2.8.0 on IRIX 6.2 */
-#if SIZEOF_LONG == 4 && defined(__LONG_MAX__)
-#undef __LONG_MAX__ /* Is a longlong value in gcc 2.8.0 ??? */
-#define __LONG_MAX__ 2147483647
-#endif
-
-/* egcs 1.1.2 has a problem with memcpy on Alpha */
-#if defined(__GNUC__) && defined(__alpha__) && ! (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95))
-#define BAD_MEMCPY
-#endif
-
-/* In Linux-alpha we have atomic.h if we are using gcc */
-#if defined(HAVE_LINUXTHREADS) && defined(__GNUC__) && defined(__alpha__) && (__GNUC__ > 2 || ( __GNUC__ == 2 && __GNUC_MINOR__ >= 95)) && !defined(HAVE_ATOMIC_ADD)
-#define HAVE_ATOMIC_ADD
-#define HAVE_ATOMIC_SUB
-#endif
-
-/* In Linux-ia64 including atomic.h will give us an error */
-#if (defined(HAVE_LINUXTHREADS) && defined(__GNUC__) && defined(__ia64__)) || !defined(THREAD)
-#undef HAVE_ATOMIC_ADD
-#undef HAVE_ATOMIC_SUB
-#endif
-
-#if defined(_lint) && !defined(lint)
-#define lint
-#endif
-#if SIZEOF_LONG_LONG > 4 && !defined(_LONG_LONG)
-#define _LONG_LONG 1 /* For AIX string library */
-#endif
-
-#ifndef stdin
-#include <stdio.h>
-#endif
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
-#ifdef HAVE_STDDEF_H
-#include <stddef.h>
-#endif
-
-#include <math.h>
-#ifdef HAVE_LIMITS_H
-#include <limits.h>
-#endif
-#ifdef HAVE_FLOAT_H
-#include <float.h>
-#endif
-
-#ifdef HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-#ifdef HAVE_FCNTL_H
-#include <fcntl.h>
-#endif
-#ifdef HAVE_SYS_TIMEB_H
-#include <sys/timeb.h> /* Avoid warnings on SCO */
-#endif
-#if TIME_WITH_SYS_TIME
-# include <sys/time.h>
-# include <time.h>
-#else
-# if HAVE_SYS_TIME_H
-# include <sys/time.h>
-# else
-# include <time.h>
-# endif
-#endif /* TIME_WITH_SYS_TIME */
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#if defined(__cplusplus) && defined(NO_CPLUSPLUS_ALLOCA)
-#undef HAVE_ALLOCA
-#undef HAVE_ALLOCA_H
-#endif
-#ifdef HAVE_ALLOCA_H
-#include <alloca.h>
-#endif
-#ifdef HAVE_ATOMIC_ADD
-#define __SMP__
-#include <asm/atomic.h>
-#endif
-
-/* Go around some bugs in different OS and compilers */
-#if defined(_HPUX_SOURCE) && defined(HAVE_SYS_STREAM_H)
-#include <sys/stream.h> /* HPUX 10.20 defines ulong here. UGLY !!! */
-#define HAVE_ULONG
-#endif
-#ifdef DONT_USE_FINITE /* HPUX 11.x has is_finite() */
-#undef HAVE_FINITE
-#endif
-
-/* We can not live without these */
-
-#define USE_MYFUNC 1 /* Must use syscall indirection */
-#define MASTER 1 /* Compile without unireg */
-#define ENGLISH 1 /* Messages in English */
-#define POSIX_MISTAKE 1 /* regexp: Fix stupid spec error */
-#define USE_REGEX 1 /* We want the use the regex library */
-/* Do not define for ultra sparcs */
-#define USE_BMOVE512 1 /* Use this unless the system bmove is faster */
-
-/* Paranoid settings. Define I_AM_PARANOID if you are paranoid */
-#ifdef I_AM_PARANOID
-#define DONT_ALLOW_USER_CHANGE 1
-#define DONT_USE_MYSQL_PWD 1
-#endif
-
-/* #define USE_some_charset 1 was deprecated by changes to configure */
-/* my_ctype my_to_upper, my_to_lower, my_sort_order gain theit right value */
-/* automagically during configuration */
-
-/* Does the system remember a signal handler after a signal ? */
-#ifndef HAVE_BSD_SIGNALS
-#define DONT_REMEMBER_SIGNAL
-#endif
-
-/* Define void to stop lint from generating "null effekt" comments */
-#ifndef DONT_DEFINE_VOID
-#ifdef _lint
-int __void__;
-#define VOID(X) (__void__ = (int) (X))
-#else
-#undef VOID
-#define VOID(X) (X)
-#endif
-#endif /* DONT_DEFINE_VOID */
-
-#if defined(_lint) || defined(FORCE_INIT_OF_VARS)
-#define LINT_INIT(var) var=0 /* No uninitialize-warning */
-#else
-#define LINT_INIT(var)
-#endif
-
-/* Define som useful general macros */
-#if defined(__cplusplus) && defined(__GNUC__)
-#define max(a, b) ((a) >? (b))
-#define min(a, b) ((a) <? (b))
-#elif !defined(max)
-#define max(a, b) ((a) > (b) ? (a) : (b))
-#define min(a, b) ((a) < (b) ? (a) : (b))
-#endif
-
-#if defined(__EMX__) || !defined(HAVE_UINT)
-typedef unsigned int uint;
-typedef unsigned short ushort;
-#endif
-
-#define sgn(a) (((a) < 0) ? -1 : ((a) > 0) ? 1 : 0)
-#define swap(t,a,b) { register t dummy; dummy = a; a = b; b = dummy; }
-#define test(a) ((a) ? 1 : 0)
-#define set_if_bigger(a,b) { if ((a) < (b)) (a)=(b); }
-#define set_if_smaller(a,b) { if ((a) > (b)) (a)=(b); }
-#define test_all_bits(a,b) (((a) & (b)) == (b))
-#define array_elements(A) ((uint) (sizeof(A)/sizeof(A[0])))
-#ifndef HAVE_RINT
-#define rint(A) floor((A)+0.5)
-#endif
-
-/* Define som general constants */
-#ifndef TRUE
-#define TRUE (1) /* Logical true */
-#define FALSE (0) /* Logical false */
-#endif
-
-#if defined(__GNUC__)
-#define function_volatile volatile
-#define my_reinterpret_cast(A) reinterpret_cast<A>
-#define my_const_cast(A) const_cast<A>
-#elif !defined(my_reinterpret_cast)
-#define my_reinterpret_cast(A) (A)
-#define my_const_cast(A) (A)
-#endif
-#if !defined(__attribute__) && (defined(__cplusplus) || !defined(__GNUC__) || __GNUC__ == 2 && __GNUC_MINOR__ < 8)
-#define __attribute__(A)
-#endif
-
-/* From old s-system.h */
-
-/* Support macros for non ansi & other old compilers. Since such
- things are no longer supported we do nothing. We keep then since
- some of our code may still be needed to upgrade old customers. */
-#define _VARARGS(X) X
-#define _STATIC_VARARGS(X) X
-#define _PC(X) X
-
-#if defined(DBUG_ON) && defined(DBUG_OFF)
-#undef DBUG_OFF
-#endif
-
-#if defined(_lint) && !defined(DBUG_OFF)
-#define DBUG_OFF
-#endif
-
-#include <dbug.h>
-#ifndef DBUG_OFF
-#define dbug_assert(A) assert(A)
-#else
-#define dbug_assert(A)
-#endif
-
-#define MIN_ARRAY_SIZE 0 /* Zero or One. Gcc allows zero*/
-#define ASCII_BITS_USED 8 /* Bit char used */
-#define NEAR_F /* No near function handling */
-
-/* Some types that is different between systems */
-
-typedef int File; /* File descriptor */
-#ifndef Socket_defined
-typedef int my_socket; /* File descriptor for sockets */
-#define INVALID_SOCKET -1
-#endif
-/* Type for fuctions that handles signals */
-#define sig_handler RETSIGTYPE
-typedef void (*sig_return)();/* Returns type from signal */
-#if defined(__GNUC__) && !defined(_lint)
-typedef char pchar; /* Mixed prototypes can take char */
-typedef char puchar; /* Mixed prototypes can take char */
-typedef char pbool; /* Mixed prototypes can take char */
-typedef short pshort; /* Mixed prototypes can take short int */
-typedef float pfloat; /* Mixed prototypes can take float */
-#else
-typedef int pchar; /* Mixed prototypes can't take char */
-typedef uint puchar; /* Mixed prototypes can't take char */
-typedef int pbool; /* Mixed prototypes can't take char */
-typedef int pshort; /* Mixed prototypes can't take short int */
-typedef double pfloat; /* Mixed prototypes can't take float */
-#endif
-typedef int (*qsort_cmp)(const void *,const void *);
-#ifdef HAVE_mit_thread
-#define qsort_t void
-#undef QSORT_TYPE_IS_VOID
-#define QSORT_TYPE_IS_VOID
-#else
-#define qsort_t RETQSORTTYPE /* Broken GCC cant handle typedef !!!! */
-#endif
-#ifdef HAVE_mit_thread
-#define size_socket socklen_t /* Type of last arg to accept */
-#else
-#ifdef HAVE_SYS_SOCKET_H
-#include <sys/socket.h>
-#endif
-typedef SOCKET_SIZE_TYPE size_socket;
-#endif
-
-#ifndef SOCKOPT_OPTLEN_TYPE
-#define SOCKOPT_OPTLEN_TYPE size_socket
-#endif
-
-/* file create flags */
-
-#ifndef O_SHARE
-#define O_SHARE 0 /* Flag to my_open for shared files */
-#ifndef O_BINARY
-#define O_BINARY 0 /* Flag to my_open for binary files */
-#endif
-#define FILE_BINARY 0 /* Flag to my_fopen for binary streams */
-#ifdef HAVE_FCNTL
-#define HAVE_FCNTL_LOCK
-#define F_TO_EOF 0L /* Param to lockf() to lock rest of file */
-#endif
-#endif /* O_SHARE */
-#ifndef O_TEMPORARY
-#define O_TEMPORARY 0
-#endif
-#ifndef O_SHORT_LIVED
-#define O_SHORT_LIVED 0
-#endif
-
-/* #define USE_RECORD_LOCK */
-
- /* Unsigned types supported by the compiler */
-#define UNSINT8 /* unsigned int8 (char) */
-#define UNSINT16 /* unsigned int16 */
-#define UNSINT32 /* unsigned int32 */
-
- /* General constants */
-#define SC_MAXWIDTH 256 /* Max width of screen (for error messages) */
-#define FN_LEN 256 /* Max file name len */
-#define FN_HEADLEN 253 /* Max length of filepart of file name */
-#define FN_EXTLEN 20 /* Max length of extension (part of FN_LEN) */
-#define FN_REFLEN 512 /* Max length of full path-name */
-#define FN_EXTCHAR '.'
-#define FN_HOMELIB '~' /* ~/ is used as abbrev for home dir */
-#define FN_CURLIB '.' /* ./ is used as abbrev for current dir */
-#define FN_PARENTDIR ".." /* Parentdirectory; Must be a string */
-#define FN_DEVCHAR ':'
-
-#ifndef FN_LIBCHAR
-#ifdef __EMX__
-#define FN_LIBCHAR '\\'
-#define FN_ROOTDIR "\\"
-#else
-#define FN_LIBCHAR '/'
-#define FN_ROOTDIR "/"
-#endif
-#define MY_NFILE 1024 /* This is only used to save filenames */
-#endif
-
-/* #define EXT_IN_LIBNAME */
-/* #define FN_NO_CASE_SENCE */
-/* #define FN_UPPER_CASE TRUE */
-
-/* Io buffer size; Must be a power of 2 and a multiple of 512. May be
- smaller what the disk page size. This influences the speed of the
- isam btree library. eg to big to slow. */
-#define IO_SIZE 4096
-/* How much overhead does malloc have. The code often allocates
- something like 1024-MALLOC_OVERHEAD bytes */
-#ifdef SAFEMALLOC
-#define MALLOC_OVERHEAD (8+24+4)
-#else
-#define MALLOC_OVERHEAD 8
-#endif
- /* get memory in huncs */
-#define ONCE_ALLOC_INIT (uint) (4096-MALLOC_OVERHEAD)
- /* Typical record cash */
-#define RECORD_CACHE_SIZE (uint) (64*1024-MALLOC_OVERHEAD)
- /* Typical key cash */
-#define KEY_CACHE_SIZE (uint) (8*1024*1024-MALLOC_OVERHEAD)
-
- /* Some things that this system doesn't have */
-
-#define ONLY_OWN_DATABASES /* We are using only databases by monty */
-#define NO_PISAM /* Not needed anymore */
-#define NO_MISAM /* Not needed anymore */
-#define NO_HASH /* Not needed anymore */
-#ifdef __WIN__
-#define NO_DIR_LIBRARY /* Not standar dir-library */
-#define USE_MY_STAT_STRUCT /* For my_lib */
-#endif
-
-/* Some things that this system does have */
-
-#ifndef HAVE_ITOA
-#define USE_MY_ITOA /* There is no itoa */
-#endif
-
-/* Some defines of functions for portability */
-
-#ifndef HAVE_ATOD
-#define atod atof
-#endif
-#ifdef USE_MY_ATOF
-#define atof my_atof
-extern void init_my_atof(void);
-extern double my_atof(const char*);
-#endif
-#undef remove /* Crashes MySQL on SCO 5.0.0 */
-#ifndef __WIN__
-#define closesocket(A) close(A)
-#ifndef ulonglong2double
-#define ulonglong2double(A) ((double) (A))
-#define my_off_t2double(A) ((double) (A))
-#endif
-#endif
-
-#ifndef offsetof
-#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
-#endif
-#define ulong_to_double(X) ((double) (ulong) (X))
-#define SET_STACK_SIZE(X) /* Not needed on real machines */
-
-#if !defined(HAVE_mit_thread) && !defined(HAVE_STRTOK_R)
-#define strtok_r(A,B,C) strtok((A),(B))
-#endif
-
-#ifdef HAVE_LINUXTHREADS
-/* #define pthread_sigmask(A,B,C) sigprocmask((A),(B),(C)) */
-/* #define sigset(A,B) signal((A),(B)) */
-#endif
-
-/* Remove some things that mit_thread break or doesn't support */
-#if defined(HAVE_mit_thread) && defined(THREAD)
-#undef HAVE_PREAD
-#undef HAVE_REALPATH
-#undef HAVE_MLOCK
-#undef HAVE_TEMPNAM /* Use ours */
-#undef HAVE_PTHREAD_SETPRIO
-#undef HAVE_FTRUNCATE
-#undef HAVE_READLINK
-#endif
-
-/* This is from the old m-machine.h file */
-
-#if SIZEOF_LONG_LONG > 4
-#define HAVE_LONG_LONG 1
-#endif
-
-#if defined(HAVE_LONG_LONG) && !defined(LONGLONG_MIN)
-#define LONGLONG_MIN ((long long) 0x8000000000000000LL)
-#define LONGLONG_MAX ((long long) 0x7FFFFFFFFFFFFFFFLL)
-#endif
-
-#if SIZEOF_LONG == 4
-#define INT_MIN32 (long) 0x80000000L
-#define INT_MAX32 (long) 0x7FFFFFFFL
-#define INT_MIN24 ((long) 0xff800000L)
-#define INT_MAX24 0x007fffffL
-#define INT_MIN16 ((short int) 0x8000)
-#define INT_MAX16 0x7FFF
-#define INT_MIN8 ((char) 0x80)
-#define INT_MAX8 ((char) 0x7F)
-#else /* Probably Alpha */
-#define INT_MIN32 ((long) (int) 0x80000000)
-#define INT_MAX32 ((long) (int) 0x7FFFFFFF)
-#define INT_MIN24 ((long) (int) 0xff800000)
-#define INT_MAX24 ((long) (int) 0x007fffff)
-#define INT_MIN16 ((short int) 0xffff8000)
-#define INT_MAX16 ((short int) 0x00007FFF)
-#endif
-
-/* From limits.h instead */
-#ifndef DBL_MIN
-#define DBL_MIN 4.94065645841246544e-324
-#define FLT_MIN ((float)1.40129846432481707e-45)
-#endif
-#ifndef DBL_MAX
-#define DBL_MAX 1.79769313486231470e+308
-#define FLT_MAX ((float)3.40282346638528860e+38)
-#endif
-
-/* Max size that must be added to a so that we know Size to make
- adressable obj. */
-typedef long my_ptrdiff_t;
-#define MY_ALIGN(A,L) (((A) + (L) - 1) & ~((L) - 1))
-#define ALIGN_SIZE(A) MY_ALIGN((A),sizeof(double))
-/* Size to make adressable obj. */
-#define ALIGN_PTR(A, t) ((t*) MY_ALIGN((A),sizeof(t)))
- /* Offset of filed f in structure t */
-#define OFFSET(t, f) ((size_t)(char *)&((t *)0)->f)
-#define ADD_TO_PTR(ptr,size,type) (type) ((byte*) (ptr)+size)
-#define PTR_BYTE_DIFF(A,B) (my_ptrdiff_t) ((byte*) (A) - (byte*) (B))
-
-#define NullS (char *) 0
-/* Nowdays we do not support MessyDos */
-#ifndef NEAR
-#define NEAR /* Who needs segments ? */
-#define FAR /* On a good machine */
-#define HUGE_PTR
-#endif
-#ifndef STDCALL
-#define STDCALL
-#endif
-
-/* Typdefs for easyier portability */
-
-#if defined(VOIDTYPE)
-typedef void *gptr; /* Generic pointer */
-#else
-typedef char *gptr; /* Generic pointer */
-#endif
-#ifndef HAVE_INT_8_16_32
-typedef char int8; /* Signed integer >= 8 bits */
-typedef short int16; /* Signed integer >= 16 bits */
-#endif
-#ifndef HAVE_UCHAR
-typedef unsigned char uchar; /* Short for unsigned char */
-#endif
-typedef unsigned char uint8; /* Short for unsigned integer >= 8 bits */
-typedef unsigned short uint16; /* Short for unsigned integer >= 16 bits */
-
-#if SIZEOF_INT == 4
-#ifndef HAVE_INT_8_16_32
-typedef int int32;
-#endif
-typedef unsigned int uint32; /* Short for unsigned integer >= 32 bits */
-#elif SIZEOF_LONG == 4
-#ifndef HAVE_INT_8_16_32
-typedef long int32;
-#endif
-typedef unsigned long uint32; /* Short for unsigned integer >= 32 bits */
-#else
-error "Neither int or long is of 4 bytes width"
-#endif
-
-#if !defined(HAVE_ULONG) && !defined(HAVE_LINUXTHREADS) && !defined(__USE_MISC)
-typedef unsigned long ulong; /* Short for unsigned long */
-#endif
-#ifndef longlong_defined
-#if defined(HAVE_LONG_LONG) && SIZEOF_LONG != 8
-typedef unsigned long long ulonglong; /* ulong or unsigned long long */
-typedef long long longlong;
-#else
-typedef unsigned long ulonglong; /* ulong or unsigned long long */
-typedef long longlong;
-#endif
-#endif
-
-#ifdef USE_RAID
-/* The following is done with a if to not get problems with pre-processors
- with late define evaluation */
-#if SIZEOF_OFF_T == 4
-#define SYSTEM_SIZEOF_OFF_T 4
-#else
-#define SYSTEM_SIZEOF_OFF_T 8
-#endif
-#undef SIZEOF_OFF_T
-#define SIZEOF_OFF_T 8
-#else
-#define SYSTEM_SIZEOF_OFF_T SIZEOF_OFF_T
-#endif /* USE_RAID */
-
-#if SIZEOF_OFF_T > 4
-typedef ulonglong my_off_t;
-#else
-typedef unsigned long my_off_t;
-#endif
-#define MY_FILEPOS_ERROR (~(my_off_t) 0)
-#ifndef __WIN__
-typedef off_t os_off_t;
-#endif
-
-typedef uint8 int7; /* Most effective integer 0 <= x <= 127 */
-typedef short int15; /* Most effective integer 0 <= x <= 32767 */
-typedef char *my_string; /* String of characters */
-typedef unsigned long size_s; /* Size of strings (In string-funcs) */
-typedef int myf; /* Type of MyFlags in my_funcs */
-#ifndef byte_defined
-typedef char byte; /* Smallest addressable unit */
-#endif
-typedef char my_bool; /* Small bool */
-#if !defined(bool) && !defined(bool_defined) && (!defined(HAVE_BOOL) || !defined(__cplusplus))
-typedef char bool; /* Ordinary boolean values 0 1 */
-#endif
- /* Macros for converting *constants* to the right type */
-#define INT8(v) (int8) (v)
-#define INT16(v) (int16) (v)
-#define INT32(v) (int32) (v)
-#define MYF(v) (myf) (v)
-
-/* Defines to make it possible to prioritize register assignments. No
- longer needed with moder compilers */
-#ifndef USING_X
-#define reg1 register
-#define reg2 register
-#define reg3 register
-#define reg4 register
-#define reg5 register
-#define reg6 register
-#define reg7 register
-#define reg8 register
-#define reg9 register
-#define reg10 register
-#define reg11 register
-#define reg12 register
-#define reg13 register
-#define reg14 register
-#define reg15 register
-#define reg16 register
-#endif
-
-/* Defines for time function */
-#define SCALE_SEC 100
-#define SCALE_USEC 10000
-#define MY_HOW_OFTEN_TO_ALARM 2 /* How often we want info on screen */
-#define MY_HOW_OFTEN_TO_WRITE 1000 /* How often we want info on screen */
-
-/*
-** Define-funktions for reading and storing in machine independent format
-** (low byte first)
-*/
-
-/* Optimized store functions for Intel x86 */
-#ifdef __i386__
-#define sint2korr(A) (*((int16 *) (A)))
-#define sint3korr(A) ((int32) ((((uchar) (A)[2]) & 128) ? \
- (((uint32) 255L << 24) | \
- (((uint32) (uchar) (A)[2]) << 16) |\
- (((uint32) (uchar) (A)[1]) << 8) | \
- ((uint32) (uchar) (A)[0])) : \
- (((uint32) (uchar) (A)[2]) << 16) |\
- (((uint32) (uchar) (A)[1]) << 8) | \
- ((uint32) (uchar) (A)[0])))
-#define sint4korr(A) (*((long *) (A)))
-#define uint2korr(A) (*((uint16 *) (A)))
-#define uint3korr(A) (long) (*((unsigned long *) (A)) & 0xFFFFFF)
-#define uint4korr(A) (*((unsigned long *) (A)))
-#define uint5korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) +\
- (((uint32) ((uchar) (A)[1])) << 8) +\
- (((uint32) ((uchar) (A)[2])) << 16) +\
- (((uint32) ((uchar) (A)[3])) << 24)) +\
- (((ulonglong) ((uchar) (A)[4])) << 32))
-#define uint8korr(A) (*((ulonglong *) (A)))
-#define sint8korr(A) (*((longlong *) (A)))
-#define int2store(T,A) *((uint16*) (T))= (uint16) (A)
-#define int3store(T,A) { *(T)= (uchar) ((A));\
- *(T+1)=(uchar) (((uint) (A) >> 8));\
- *(T+2)=(uchar) (((A) >> 16)); }
-#define int4store(T,A) *((long *) (T))= (long) (A)
-#define int5store(T,A) { *(T)= (uchar)((A));\
- *((T)+1)=(uchar) (((A) >> 8));\
- *((T)+2)=(uchar) (((A) >> 16));\
- *((T)+3)=(uchar) (((A) >> 24)); \
- *((T)+4)=(uchar) (((A) >> 32)); }
-#define int8store(T,A) *((ulonglong *) (T))= (ulonglong) (A)
-
-typedef union {
- double v;
- long m[2];
-} doubleget_union;
-#define doubleget(V,M) { ((doubleget_union *)&V)->m[0] = *((long*) M); \
- ((doubleget_union *)&V)->m[1] = *(((long*) M)+1); }
-#define doublestore(T,V) { *((long *) T) = ((doubleget_union *)&V)->m[0]; \
- *(((long *) T)+1) = ((doubleget_union *)&V)->m[1]; }
-#define float4get(V,M) { *((long *) &(V)) = *((long*) (M)); }
-#define float8get(V,M) doubleget((V),(M))
-#define float4store(V,M) memcpy((byte*) V,(byte*) (&M),sizeof(float))
-#define float8store(V,M) doublestore((V),(M))
-#endif /* __i386__ */
-
-#ifndef sint2korr
-#define sint2korr(A) (int16) (((int16) ((uchar) (A)[0])) +\
- ((int16) ((int16) (A)[1]) << 8))
-#define sint3korr(A) ((int32) ((((uchar) (A)[2]) & 128) ? \
- (((uint32) 255L << 24) | \
- (((uint32) (uchar) (A)[2]) << 16) |\
- (((uint32) (uchar) (A)[1]) << 8) | \
- ((uint32) (uchar) (A)[0])) : \
- (((uint32) (uchar) (A)[2]) << 16) |\
- (((uint32) (uchar) (A)[1]) << 8) | \
- ((uint32) (uchar) (A)[0])))
-#define sint4korr(A) (int32) (((int32) ((uchar) (A)[0])) +\
- (((int32) ((uchar) (A)[1]) << 8)) +\
- (((int32) ((uchar) (A)[2]) << 16)) +\
- (((int32) ((int16) (A)[3]) << 24)))
-#define sint8korr(A) (longlong) uint8korr(A)
-#define uint2korr(A) (uint16) (((uint16) ((uchar) (A)[0])) +\
- ((uint16) ((uchar) (A)[1]) << 8))
-#define uint3korr(A) (uint32) (((uint32) ((uchar) (A)[0])) +\
- (((uint32) ((uchar) (A)[1])) << 8) +\
- (((uint32) ((uchar) (A)[2])) << 16))
-#define uint4korr(A) (uint32) (((uint32) ((uchar) (A)[0])) +\
- (((uint32) ((uchar) (A)[1])) << 8) +\
- (((uint32) ((uchar) (A)[2])) << 16) +\
- (((uint32) ((uchar) (A)[3])) << 24))
-#define uint5korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) +\
- (((uint32) ((uchar) (A)[1])) << 8) +\
- (((uint32) ((uchar) (A)[2])) << 16) +\
- (((uint32) ((uchar) (A)[3])) << 24)) +\
- (((ulonglong) ((uchar) (A)[4])) << 32))
-#define uint8korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) +\
- (((uint32) ((uchar) (A)[1])) << 8) +\
- (((uint32) ((uchar) (A)[2])) << 16) +\
- (((uint32) ((uchar) (A)[3])) << 24)) +\
- (((ulonglong) (((uint32) ((uchar) (A)[4])) +\
- (((uint32) ((uchar) (A)[5])) << 8) +\
- (((uint32) ((uchar) (A)[6])) << 16) +\
- (((uint32) ((uchar) (A)[7])) << 24))) <<\
- 32))
-#define int2store(T,A) { uint def_temp= (uint) (A) ;\
- *((uchar*) (T))= (uchar)(def_temp); \
- *((uchar*) (T+1))=(uchar)((def_temp >> 8)); }
-#define int3store(T,A) { /*lint -save -e734 */\
- *((T))=(char) ((A));\
- *((T)+1)=(char) (((A) >> 8));\
- *((T)+2)=(char) (((A) >> 16)); \
- /*lint -restore */}
-#define int4store(T,A) { *(T)=(char) ((A));\
- *((T)+1)=(char) (((A) >> 8));\
- *((T)+2)=(char) (((A) >> 16));\
- *((T)+3)=(char) (((A) >> 24)); }
-#define int5store(T,A) { *(T)=((A));\
- *((T)+1)=(((A) >> 8));\
- *((T)+2)=(((A) >> 16));\
- *((T)+3)=(((A) >> 24)); \
- *((T)+4)=(((A) >> 32)); }
-#define int8store(T,A) { uint def_temp= (uint) (A), def_temp2= (uint) ((A) >> 32); \
- int4store((T),def_temp); \
- int4store((T+4),def_temp2); \
- }
-#ifdef WORDS_BIGENDIAN
-#define float4store(T,A) { *(T)= ((byte *) &A)[3];\
- *((T)+1)=(char) ((byte *) &A)[2];\
- *((T)+2)=(char) ((byte *) &A)[1];\
- *((T)+3)=(char) ((byte *) &A)[0]; }
-
-#define float4get(V,M) { float def_temp;\
- ((byte*) &def_temp)[0]=(M)[3];\
- ((byte*) &def_temp)[1]=(M)[2];\
- ((byte*) &def_temp)[2]=(M)[1];\
- ((byte*) &def_temp)[3]=(M)[0];\
- (V)=def_temp; }
-#define float8store(T,V) { *(T)= ((byte *) &V)[7];\
- *((T)+1)=(char) ((byte *) &V)[6];\
- *((T)+2)=(char) ((byte *) &V)[5];\
- *((T)+3)=(char) ((byte *) &V)[4];\
- *((T)+4)=(char) ((byte *) &V)[3];\
- *((T)+5)=(char) ((byte *) &V)[2];\
- *((T)+6)=(char) ((byte *) &V)[1];\
- *((T)+7)=(char) ((byte *) &V)[0]; }
-
-#define float8get(V,M) { double def_temp;\
- ((byte*) &def_temp)[0]=(M)[7];\
- ((byte*) &def_temp)[1]=(M)[6];\
- ((byte*) &def_temp)[2]=(M)[5];\
- ((byte*) &def_temp)[3]=(M)[4];\
- ((byte*) &def_temp)[4]=(M)[3];\
- ((byte*) &def_temp)[5]=(M)[2];\
- ((byte*) &def_temp)[6]=(M)[1];\
- ((byte*) &def_temp)[7]=(M)[0];\
- (V) = def_temp; }
-#else
-#define float4get(V,M) memcpy_fixed((byte*) &V,(byte*) (M),sizeof(float))
-#define float4store(V,M) memcpy_fixed((byte*) V,(byte*) (&M),sizeof(float))
-
-#if defined(__FLOAT_WORD_ORDER) && (__FLOAT_WORD_ORDER == __BIG_ENDIAN)
-#define doublestore(T,V) { *(T)= ((byte *) &V)[4];\
- *((T)+1)=(char) ((byte *) &V)[5];\
- *((T)+2)=(char) ((byte *) &V)[6];\
- *((T)+3)=(char) ((byte *) &V)[7];\
- *((T)+4)=(char) ((byte *) &V)[0];\
- *((T)+5)=(char) ((byte *) &V)[1];\
- *((T)+6)=(char) ((byte *) &V)[2];\
- *((T)+7)=(char) ((byte *) &V)[3]; }
-#define doubleget(V,M) { double def_temp;\
- ((byte*) &def_temp)[0]=(M)[4];\
- ((byte*) &def_temp)[1]=(M)[5];\
- ((byte*) &def_temp)[2]=(M)[6];\
- ((byte*) &def_temp)[3]=(M)[7];\
- ((byte*) &def_temp)[4]=(M)[0];\
- ((byte*) &def_temp)[5]=(M)[1];\
- ((byte*) &def_temp)[6]=(M)[2];\
- ((byte*) &def_temp)[7]=(M)[3];\
- (V) = def_temp; }
-#endif /* __FLOAT_WORD_ORDER */
-
-#define float8get(V,M) doubleget((V),(M))
-#define float8store(V,M) doublestore((V),(M))
-#endif /* WORDS_BIGENDIAN */
-
-#endif /* sint2korr */
-
-/* Define-funktions for reading and storing in machine format from/to
- short/long to/from some place in memory V should be a (not
- register) variable, M is a pointer to byte */
-
-#ifdef WORDS_BIGENDIAN
-
-#define ushortget(V,M) { V = (uint16) (((uint16) ((uchar) (M)[1]))+\
- ((uint16) ((uint16) (M)[0]) << 8)); }
-#define shortget(V,M) { V = (short) (((short) ((uchar) (M)[1]))+\
- ((short) ((short) (M)[0]) << 8)); }
-#define longget(V,M) { int32 def_temp;\
- ((byte*) &def_temp)[0]=(M)[0];\
- ((byte*) &def_temp)[1]=(M)[1];\
- ((byte*) &def_temp)[2]=(M)[2];\
- ((byte*) &def_temp)[3]=(M)[3];\
- (V)=def_temp; }
-#define ulongget(V,M) { uint32 def_temp;\
- ((byte*) &def_temp)[0]=(M)[0];\
- ((byte*) &def_temp)[1]=(M)[1];\
- ((byte*) &def_temp)[2]=(M)[2];\
- ((byte*) &def_temp)[3]=(M)[3];\
- (V)=def_temp; }
-#define shortstore(T,A) { uint def_temp=(uint) (A) ;\
- *(T+1)=(char)(def_temp); \
- *(T+0)=(char)(def_temp >> 8); }
-#define longstore(T,A) { *((T)+3)=((A));\
- *((T)+2)=(((A) >> 8));\
- *((T)+1)=(((A) >> 16));\
- *((T)+0)=(((A) >> 24)); }
-
-#define doubleget(V,M) memcpy((byte*) &V,(byte*) (M),sizeof(double))
-#define doublestore(T,V) memcpy((byte*) (T),(byte*) &V,sizeof(double))
-#define longlongget(V,M) memcpy((byte*) &V,(byte*) (M),sizeof(ulonglong))
-#define longlongstore(T,V) memcpy((byte*) (T),(byte*) &V,sizeof(ulonglong))
-
-#else
-
-#define ushortget(V,M) { V = uint2korr(M); }
-#define shortget(V,M) { V = sint2korr(M); }
-#define longget(V,M) { V = sint4korr(M); }
-#define ulongget(V,M) { V = uint4korr(M); }
-#define shortstore(T,V) int2store(T,V)
-#define longstore(T,V) int4store(T,V)
-#ifndef doubleget
-#define doubleget(V,M) memcpy_fixed((byte*) &V,(byte*) (M),sizeof(double))
-#define doublestore(T,V) memcpy_fixed((byte*) (T),(byte*) &V,sizeof(double))
-#endif /* doubleget */
-#define longlongget(V,M) memcpy_fixed((byte*) &V,(byte*) (M),sizeof(ulonglong))
-#define longlongstore(T,V) memcpy_fixed((byte*) (T),(byte*) &V,sizeof(ulonglong))
-
-#endif /* WORDS_BIGENDIAN */
-
-/* sprintf does not always return the number of bytes :- */
-#ifdef SPRINTF_RETURNS_INT
-#define my_sprintf(buff,args) sprintf args
-#else
-#ifdef SPRINTF_RETURNS_PTR
-#define my_sprintf(buff,args) ((int)(sprintf args - buff))
-#else
-#define my_sprintf(buff,args) sprintf args,strlen(buff)
-#endif
-#endif
-
-#ifndef THREAD
-#define thread_safe_increment(V,L) (V)++
-#define thread_safe_add(V,C,L) (V)+=(C)
-#define thread_safe_sub(V,C,L) (V)-=(C)
-#define statistic_increment(V,L) (V)++
-#define statistic_add(V,C,L) (V)+=(C)
-#endif
-
-#endif /* _global_h */
diff --git a/ext/mysql/libmysql/int2str.c b/ext/mysql/libmysql/int2str.c
deleted file mode 100644
index bb12b00cdc..0000000000
--- a/ext/mysql/libmysql/int2str.c
+++ /dev/null
@@ -1,141 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-/*
- Defines: int2str(), itoa(), ltoa()
-
- int2str(dst, radix, val)
- converts the (long) integer "val" to character form and moves it to
- the destination string "dst" followed by a terminating NUL. The
- result is normally a pointer to this NUL character, but if the radix
- is dud the result will be NullS and nothing will be changed.
-
- If radix is -2..-36, val is taken to be SIGNED.
- If radix is 2.. 36, val is taken to be UNSIGNED.
- That is, val is signed if and only if radix is. You will normally
- use radix -10 only through itoa and ltoa, for radix 2, 8, or 16
- unsigned is what you generally want.
-
- _dig_vec is public just in case someone has a use for it.
- The definitions of itoa and ltoa are actually macros in m_string.h,
- but this is where the code is.
-
- Note: The standard itoa() returns a pointer to the argument, when int2str
- returns the pointer to the end-null.
- itoa assumes that 10 -base numbers are allways signed and other arn't.
-*/
-
-#include <global.h>
-#include "m_string.h"
-
-char NEAR _dig_vec[] =
- "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
-
-
-char *int2str(register long int val, register char *dst, register int radix)
-{
- char buffer[65];
- register char *p;
- long int new_val;
-
- if (radix < 0) {
- if (radix < -36 || radix > -2) return NullS;
- if (val < 0) {
- *dst++ = '-';
- val = -val;
- }
- radix = -radix;
- } else {
- if (radix > 36 || radix < 2) return NullS;
- }
- /* The slightly contorted code which follows is due to the
- fact that few machines directly support unsigned long / and %.
- Certainly the VAX C compiler generates a subroutine call. In
- the interests of efficiency (hollow laugh) I let this happen
- for the first digit only; after that "val" will be in range so
- that signed integer division will do. Sorry 'bout that.
- CHECK THE CODE PRODUCED BY YOUR C COMPILER. The first % and /
- should be unsigned, the second % and / signed, but C compilers
- tend to be extraordinarily sensitive to minor details of style.
- This works on a VAX, that's all I claim for it.
- */
- p = &buffer[sizeof(buffer)-1];
- *p = '\0';
- new_val=(ulong) val / (ulong) radix;
- *--p = _dig_vec[(uchar) ((ulong) val- (ulong) new_val*(ulong) radix)];
- val = new_val;
-#ifdef HAVE_LDIV
- while (val != 0)
- {
- ldiv_t res;
- res=ldiv(val,radix);
- *--p = _dig_vec[res.rem];
- val= res.quot;
- }
-#else
- while (val != 0)
- {
- new_val=val/radix;
- *--p = _dig_vec[(uchar) (val-new_val*radix)];
- val= new_val;
- }
-#endif
- while ((*dst++ = *p++) != 0) ;
- return dst-1;
-}
-
-
-/*
- This is a faster version of the above optimized for the normal case of
- radix 10 / -10
-*/
-
-char *int10_to_str(long int val,char *dst,int radix)
-{
- char buffer[65];
- register char *p;
- long int new_val;
-
- if (radix < 0) /* -10 */
- {
- if (val < 0)
- {
- *dst++ = '-';
- val = -val;
- }
- }
-
- p = &buffer[sizeof(buffer)-1];
- *p = '\0';
- new_val= (long) ((unsigned long int) val / 10);
- *--p = '0'+ (char) ((unsigned long int) val - (unsigned long) new_val * 10);
- val = new_val;
-
- while (val != 0)
- {
- new_val=val/10;
- *--p = '0' + (char) (val-new_val*10);
- val= new_val;
- }
- while ((*dst++ = *p++) != 0) ;
- return dst-1;
-}
-
-
-#ifdef USE_MY_ITOA
-
- /* Change to less general itoa interface */
-
-char *my_itoa(int val, char *dst, int radix)
-{
- VOID(int2str((long) val,dst,(radix == 10 ? -10 : radix)));
- return dst;
-}
-
-char *my_ltoa(long int val, char *dst, int radix)
-{
- VOID(int2str((long) val,dst,(radix == 10 ? -10 : radix)));
- return dst;
-}
-
-#endif
diff --git a/ext/mysql/libmysql/is_prefix.c b/ext/mysql/libmysql/is_prefix.c
deleted file mode 100644
index c0ed472103..0000000000
--- a/ext/mysql/libmysql/is_prefix.c
+++ /dev/null
@@ -1,20 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-/* File : is_prefix.c
- Author : Michael Widenius
- Defines: is_prefix()
-
- is_prefix(s, t) returns 1 if s starts with t.
- A empty t is allways a prefix.
-*/
-
-#include <global.h>
-#include "m_string.h"
-
-int is_prefix(register const char *s, register const char *t)
-{
- while (*t)
- if (*s++ != *t++) return 0;
- return 1; /* WRONG */
-}
diff --git a/ext/mysql/libmysql/libmysql.c b/ext/mysql/libmysql/libmysql.c
deleted file mode 100644
index 48d388b798..0000000000
--- a/ext/mysql/libmysql/libmysql.c
+++ /dev/null
@@ -1,2566 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-#define DONT_USE_RAID
-#include <global.h>
-#if defined(__WIN__) || defined(_WIN32) || defined(_WIN64)
-#include <winsock.h>
-#include <odbcinst.h>
-#endif
-#include <my_sys.h>
-#include <mysys_err.h>
-#include <m_string.h>
-#include <m_ctype.h>
-#include "mysql.h"
-#include "mysql_version.h"
-#include "mysqld_error.h"
-#include "errmsg.h"
-#include <violite.h>
-#include <sys/stat.h>
-#include <signal.h>
-#include <time.h>
-#ifdef HAVE_PWD_H
-#include <pwd.h>
-#endif
-#if !defined(MSDOS) && !defined(__WIN__)
-#include <sys/socket.h>
-#include <netinet/in.h>
-#ifdef HAVE_ARPA_INET_H
-#include <arpa/inet.h>
-#endif
-#include <netdb.h>
-#ifdef HAVE_SELECT_H
-# include <select.h>
-#endif
-#ifdef HAVE_SYS_SELECT_H
-#include <sys/select.h>
-#endif
-#endif
-#ifdef HAVE_SYS_UN_H
-# include <sys/un.h>
-#endif
-#if defined(THREAD) && !defined(__WIN__)
-#include <my_pthread.h> /* because of signal() */
-#endif
-#ifndef INADDR_NONE
-#define INADDR_NONE -1
-#endif
-
-static my_bool mysql_client_init=0;
-uint mysql_port=0;
-my_string mysql_unix_port=0;
-
-#define CLIENT_CAPABILITIES (CLIENT_LONG_PASSWORD | CLIENT_LONG_FLAG | CLIENT_LOCAL_FILES | CLIENT_TRANSACTIONS)
-
-#ifdef __WIN__
-#define CONNECT_TIMEOUT 20
-#else
-#define CONNECT_TIMEOUT 0
-#endif
-
-#if defined(MSDOS) || defined(__WIN__)
-#define ERRNO WSAGetLastError()
-#define perror(A)
-#else
-#include <errno.h>
-#define ERRNO errno
-#define SOCKET_ERROR -1
-#define closesocket(A) close(A)
-#endif
-
-static void mysql_once_init(void);
-static MYSQL_DATA *read_rows (MYSQL *mysql,MYSQL_FIELD *fields,
- uint field_count);
-static int read_one_row(MYSQL *mysql,uint fields,MYSQL_ROW row,
- ulong *lengths);
-static void end_server(MYSQL *mysql);
-static void read_user_name(char *name);
-static void append_wild(char *to,char *end,const char *wild);
-static my_bool mysql_reconnect(MYSQL *mysql);
-static int send_file_to_server(MYSQL *mysql,const char *filename);
-static sig_handler pipe_sig_handler(int sig);
-static ulong mysql_sub_escape_string(CHARSET_INFO *charset_info, char *to,
- const char *from, ulong length);
-
-/*
- Let the user specify that we don't want SIGPIPE; This doesn't however work
- with threaded applications as we can have multiple read in progress.
-*/
-
-#if !defined(__WIN__) && defined(SIGPIPE) && !defined(THREAD)
-#define init_sigpipe_variables sig_return old_signal_handler=(sig_return) 0;
-#define set_sigpipe(mysql) if ((mysql)->client_flag & CLIENT_IGNORE_SIGPIPE) old_signal_handler=signal(SIGPIPE,pipe_sig_handler)
-#define reset_sigpipe(mysql) if ((mysql)->client_flag & CLIENT_IGNORE_SIGPIPE) signal(SIGPIPE,old_signal_handler);
-#else
-#define init_sigpipe_variables
-#define set_sigpipe(mysql)
-#define reset_sigpipe(mysql)
-#endif
-
-/****************************************************************************
-* A modified version of connect(). connect2() allows you to specify
-* a timeout value, in seconds, that we should wait until we
-* derermine we can't connect to a particular host. If timeout is 0,
-* connect2() will behave exactly like connect().
-*
-* Base version coded by Steve Bernacki, Jr. <steve@navinet.net>
-*****************************************************************************/
-
-static int connect2(my_socket s, const struct sockaddr *name, uint namelen,
- uint timeout)
-{
-#if defined(__WIN__)
- return connect(s, (struct sockaddr*) name, namelen);
-#else
- int flags, res, s_err;
- SOCKOPT_OPTLEN_TYPE s_err_size = sizeof(uint);
- fd_set sfds;
- struct timeval tv;
- time_t start_time, now_time;
-
- /* If they passed us a timeout of zero, we should behave
- * exactly like the normal connect() call does.
- */
-
- if (timeout == 0)
- return connect(s, (struct sockaddr*) name, namelen);
-
- flags = fcntl(s, F_GETFL, 0); /* Set socket to not block */
-#ifdef O_NONBLOCK
- fcntl(s, F_SETFL, flags | O_NONBLOCK); /* and save the flags.. */
-#endif
-
- res = connect(s, (struct sockaddr*) name, namelen);
- s_err = errno; /* Save the error... */
- fcntl(s, F_SETFL, flags);
- if ((res != 0) && (s_err != EINPROGRESS))
- {
- errno = s_err; /* Restore it */
- return(-1);
- }
- if (res == 0) /* Connected quickly! */
- return(0);
-
- /* Otherwise, our connection is "in progress." We can use
- * the select() call to wait up to a specified period of time
- * for the connection to suceed. If select() returns 0
- * (after waiting howevermany seconds), our socket never became
- * writable (host is probably unreachable.) Otherwise, if
- * select() returns 1, then one of two conditions exist:
- *
- * 1. An error occured. We use getsockopt() to check for this.
- * 2. The connection was set up sucessfully: getsockopt() will
- * return 0 as an error.
- *
- * Thanks goes to Andrew Gierth <andrew@erlenstar.demon.co.uk>
- * who posted this method of timing out a connect() in
- * comp.unix.programmer on August 15th, 1997.
- */
-
- FD_ZERO(&sfds);
- FD_SET(s, &sfds);
- /*
- * select could be interrupted by a signal, and if it is,
- * the timeout should be adjusted and the select restarted
- * to work around OSes that don't restart select and
- * implementations of select that don't adjust tv upon
- * failure to reflect the time remaining
- */
- start_time = time(NULL);
- for (;;)
- {
- tv.tv_sec = (long) timeout;
- tv.tv_usec = 0;
- if ((res = select(s+1, NULL, &sfds, NULL, &tv)) >= 0)
- break;
- now_time=time(NULL);
- timeout-= (uint) (now_time - start_time);
- if (errno != EINTR || (int) timeout <= 0)
- return -1;
- }
-
- /* select() returned something more interesting than zero, let's
- * see if we have any errors. If the next two statements pass,
- * we've got an open socket!
- */
-
- s_err=0;
- if (getsockopt(s, SOL_SOCKET, SO_ERROR, (char*) &s_err, &s_err_size) != 0)
- return(-1);
-
- if (s_err)
- { /* getsockopt could succeed */
- errno = s_err;
- return(-1); /* but return an error... */
- }
- return(0); /* It's all good! */
-#endif
-}
-
-/*
-** Create a named pipe connection
-*/
-
-#ifdef __WIN__
-
-HANDLE create_named_pipe(NET *net, uint connect_timeout, char **arg_host,
- char **arg_unix_socket)
-{
- HANDLE hPipe=INVALID_HANDLE_VALUE;
- char szPipeName [ 257 ];
- DWORD dwMode;
- int i;
- my_bool testing_named_pipes=0;
- char *host= *arg_host, *unix_socket= *arg_unix_socket;
-
- if ( ! unix_socket || (unix_socket)[0] == 0x00)
- unix_socket = mysql_unix_port;
- if (!host || !strcmp(host,LOCAL_HOST))
- host=LOCAL_HOST_NAMEDPIPE;
-
- sprintf( szPipeName, "\\\\%s\\pipe\\%s", host, unix_socket);
- DBUG_PRINT("info",("Server name: '%s'. Named Pipe: %s",
- host, unix_socket));
-
- for (i=0 ; i < 100 ; i++) /* Don't retry forever */
- {
- if ((hPipe = CreateFile(szPipeName,
- GENERIC_READ | GENERIC_WRITE,
- 0,
- NULL,
- OPEN_EXISTING,
- 0,
- NULL )) != INVALID_HANDLE_VALUE)
- break;
- if (GetLastError() != ERROR_PIPE_BUSY)
- {
- net->last_errno=CR_NAMEDPIPEOPEN_ERROR;
- sprintf(net->last_error,ER(net->last_errno),host, unix_socket,
- (ulong) GetLastError());
- return INVALID_HANDLE_VALUE;
- }
- /* wait for for an other instance */
- if (! WaitNamedPipe(szPipeName, connect_timeout*1000) )
- {
- net->last_errno=CR_NAMEDPIPEWAIT_ERROR;
- sprintf(net->last_error,ER(net->last_errno),host, unix_socket,
- (ulong) GetLastError());
- return INVALID_HANDLE_VALUE;
- }
- }
- if (hPipe == INVALID_HANDLE_VALUE)
- {
- net->last_errno=CR_NAMEDPIPEOPEN_ERROR;
- sprintf(net->last_error,ER(net->last_errno),host, unix_socket,
- (ulong) GetLastError());
- return INVALID_HANDLE_VALUE;
- }
- dwMode = PIPE_READMODE_BYTE | PIPE_WAIT;
- if ( !SetNamedPipeHandleState(hPipe, &dwMode, NULL, NULL) )
- {
- CloseHandle( hPipe );
- net->last_errno=CR_NAMEDPIPESETSTATE_ERROR;
- sprintf(net->last_error,ER(net->last_errno),host, unix_socket,
- (ulong) GetLastError());
- return INVALID_HANDLE_VALUE;
- }
- *arg_host=host ; *arg_unix_socket=unix_socket; /* connect arg */
- return (hPipe);
-}
-#endif
-
-
-/*****************************************************************************
-** read a packet from server. Give error message if socket was down
-** or packet is an error message
-*****************************************************************************/
-
-static uint
-net_safe_read(MYSQL *mysql)
-{
- NET *net= &mysql->net;
- uint len=0;
- init_sigpipe_variables
-
- /* Don't give sigpipe errors if the client doesn't want them */
- set_sigpipe(mysql);
- if (net->vio != 0)
- len=my_net_read(net);
- reset_sigpipe(mysql);
-
- if (len == packet_error || len == 0)
- {
- DBUG_PRINT("error",("Wrong connection or packet. fd: %s len: %d",
- vio_description(net->vio),len));
- end_server(mysql);
- net->last_errno=(net->last_errno == ER_NET_PACKET_TOO_LARGE ?
- CR_NET_PACKET_TOO_LARGE:
- CR_SERVER_LOST);
- strmov(net->last_error,ER(net->last_errno));
- return(packet_error);
- }
- if (net->read_pos[0] == 255)
- {
- if (len > 3)
- {
- char *pos=(char*) net->read_pos+1;
- if (mysql->protocol_version > 9)
- { /* New client protocol */
- net->last_errno=uint2korr(pos);
- pos+=2;
- len-=2;
- }
- else
- {
- net->last_errno=CR_UNKNOWN_ERROR;
- len--;
- }
- (void) strmake(net->last_error,(char*) pos,
- min(len,sizeof(net->last_error)-1));
- }
- else
- {
- net->last_errno=CR_UNKNOWN_ERROR;
- (void) strmov(net->last_error,ER(net->last_errno));
- }
- DBUG_PRINT("error",("Got error: %d (%s)", net->last_errno,
- net->last_error));
- return(packet_error);
- }
- return len;
-}
-
-
-/* Get the length of next field. Change parameter to point at fieldstart */
-static ulong
-net_field_length(uchar **packet)
-{
- reg1 uchar *pos= *packet;
- if (*pos < 251)
- {
- (*packet)++;
- return (ulong) *pos;
- }
- if (*pos == 251)
- {
- (*packet)++;
- return NULL_LENGTH;
- }
- if (*pos == 252)
- {
- (*packet)+=3;
- return (ulong) uint2korr(pos+1);
- }
- if (*pos == 253)
- {
- (*packet)+=4;
- return (ulong) uint3korr(pos+1);
- }
- (*packet)+=9; /* Must be 254 when here */
- return (ulong) uint4korr(pos+1);
-}
-
-/* Same as above, but returns ulonglong values */
-
-static my_ulonglong
-net_field_length_ll(uchar **packet)
-{
- reg1 uchar *pos= *packet;
- if (*pos < 251)
- {
- (*packet)++;
- return (my_ulonglong) *pos;
- }
- if (*pos == 251)
- {
- (*packet)++;
- return (my_ulonglong) NULL_LENGTH;
- }
- if (*pos == 252)
- {
- (*packet)+=3;
- return (my_ulonglong) uint2korr(pos+1);
- }
- if (*pos == 253)
- {
- (*packet)+=4;
- return (my_ulonglong) uint3korr(pos+1);
- }
- (*packet)+=9; /* Must be 254 when here */
-#ifdef NO_CLIENT_LONGLONG
- return (my_ulonglong) uint4korr(pos+1);
-#else
- return (my_ulonglong) uint8korr(pos+1);
-#endif
-}
-
-
-static void free_rows(MYSQL_DATA *cur)
-{
- if (cur)
- {
- free_root(&cur->alloc,MYF(0));
- my_free((gptr) cur,MYF(0));
- }
-}
-
-
-static int
-simple_command(MYSQL *mysql,enum enum_server_command command, const char *arg,
- uint length, my_bool skipp_check)
-{
- NET *net= &mysql->net;
- int result= -1;
- init_sigpipe_variables
-
- /* Don't give sigpipe errors if the client doesn't want them */
- set_sigpipe(mysql);
- if (mysql->net.vio == 0)
- { /* Do reconnect if possible */
- if (mysql_reconnect(mysql))
- {
- net->last_errno=CR_SERVER_GONE_ERROR;
- strmov(net->last_error,ER(net->last_errno));
- goto end;
- }
- }
- if (mysql->status != MYSQL_STATUS_READY)
- {
- strmov(net->last_error,ER(mysql->net.last_errno=CR_COMMANDS_OUT_OF_SYNC));
- goto end;
- }
-
- mysql->net.last_error[0]=0;
- mysql->net.last_errno=0;
- mysql->info=0;
- mysql->affected_rows= ~(my_ulonglong) 0;
- net_clear(net); /* Clear receive buffer */
- if (!arg)
- arg="";
-
- if (net_write_command(net,(uchar) command,arg,
- length ? length : (ulong) strlen(arg)))
- {
- DBUG_PRINT("error",("Can't send command to server. Error: %d",errno));
- end_server(mysql);
- if (mysql_reconnect(mysql) ||
- net_write_command(net,(uchar) command,arg,
- length ? length : (ulong) strlen(arg)))
- {
- net->last_errno=CR_SERVER_GONE_ERROR;
- strmov(net->last_error,ER(net->last_errno));
- goto end;
- }
- }
- result=0;
- if (!skipp_check)
- result= ((mysql->packet_length=net_safe_read(mysql)) == packet_error ?
- -1 : 0);
- end:
- reset_sigpipe(mysql);
- return result;
-}
-
-
-static void free_old_query(MYSQL *mysql)
-{
- DBUG_ENTER("free_old_query");
- if (mysql->fields)
- free_root(&mysql->field_alloc,MYF(0));
- init_alloc_root(&mysql->field_alloc,8192,0); /* Assume rowlength < 8192 */
- mysql->fields=0;
- mysql->field_count=0; /* For API */
- DBUG_VOID_RETURN;
-}
-
-#if defined(HAVE_GETPWUID) && defined(NO_GETPWUID_DECL)
-struct passwd *getpwuid(uid_t);
-char* getlogin(void);
-#endif
-
-#if !defined(MSDOS) && ! defined(VMS) && !defined(__WIN__)
-static void read_user_name(char *name)
-{
- DBUG_ENTER("read_user_name");
- if (geteuid() == 0)
- (void) strmov(name,"root"); /* allow use of surun */
- else
- {
-#ifdef HAVE_GETPWUID
- struct passwd *skr;
- const char *str;
- if ((str=getlogin()) == NULL)
- {
- if ((skr=getpwuid(geteuid())) != NULL)
- str=skr->pw_name;
- else if (!(str=getenv("USER")) && !(str=getenv("LOGNAME")) &&
- !(str=getenv("LOGIN")))
- str="UNKNOWN_USER";
- }
- (void) strmake(name,str,USERNAME_LENGTH);
-#elif HAVE_CUSERID
- (void) cuserid(name);
-#else
- strmov(name,"UNKNOWN_USER");
-#endif
- }
- DBUG_VOID_RETURN;
-}
-
-#else /* If MSDOS || VMS */
-
-static void read_user_name(char *name)
-{
- char *str=getenv("USER"); /* ODBC will send user variable */
- strmake(name,str ? str : "ODBC", USERNAME_LENGTH);
-}
-
-#endif
-
-#ifdef __WIN__
-static my_bool is_NT(void)
-{
- char *os=getenv("OS");
- return (os && !strcmp(os, "Windows_NT")) ? 1 : 0;
-}
-#endif
-
-/*
-** Expand wildcard to a sql string
-*/
-
-static void
-append_wild(char *to, char *end, const char *wild)
-{
- end-=5; /* Some extra */
- if (wild && wild[0])
- {
- to=strmov(to," like '");
- while (*wild && to < end)
- {
- if (*wild == '\\' || *wild == '\'')
- *to++='\\';
- *to++= *wild++;
- }
- if (*wild) /* Too small buffer */
- *to++='%'; /* Nicer this way */
- to[0]='\'';
- to[1]=0;
- }
-}
-
-
-
-/**************************************************************************
-** Init debugging if MYSQL_DEBUG environment variable is found
-**************************************************************************/
-
-void STDCALL
-mysql_debug(const char *debug __attribute__((unused)))
-{
-#ifndef DBUG_OFF
- char *env;
- if (_db_on_)
- return; /* Already using debugging */
- if (debug)
- {
- DEBUGGER_ON;
- DBUG_PUSH(debug);
- }
- else if ((env = getenv("MYSQL_DEBUG")))
- {
- DEBUGGER_ON;
- DBUG_PUSH(env);
-#if !defined(_WINVER) && !defined(WINVER)
- puts("\n-------------------------------------------------------");
- puts("MYSQL_DEBUG found. libmysql started with the following:");
- puts(env);
- puts("-------------------------------------------------------\n");
-#else
- {
- char buff[80];
- strmov(strmov(buff,"libmysql: "),env);
- MessageBox((HWND) 0,"Debugging variable MYSQL_DEBUG used",buff,MB_OK);
- }
-#endif
- }
-#endif
-}
-
-
-/**************************************************************************
-** Close the server connection if we get a SIGPIPE
- ARGSUSED
-**************************************************************************/
-
-static sig_handler
-pipe_sig_handler(int sig __attribute__((unused)))
-{
- DBUG_PRINT("info",("Hit by signal %d",sig));
-#ifdef DONT_REMEMBER_SIGNAL
- (void) signal(SIGPIPE,pipe_sig_handler);
-#endif
-}
-
-
-/**************************************************************************
-** Shut down connection
-**************************************************************************/
-
-static void
-end_server(MYSQL *mysql)
-{
- DBUG_ENTER("end_server");
- if (mysql->net.vio != 0)
- {
- init_sigpipe_variables
- DBUG_PRINT("info",("Net: %s", vio_description(mysql->net.vio)));
- set_sigpipe(mysql);
- vio_delete(mysql->net.vio);
- reset_sigpipe(mysql);
- mysql->net.vio= 0; /* Marker */
- }
- net_end(&mysql->net);
- free_old_query(mysql);
- DBUG_VOID_RETURN;
-}
-
-
-void STDCALL
-mysql_free_result(MYSQL_RES *result)
-{
- DBUG_ENTER("mysql_free_result");
- DBUG_PRINT("enter",("mysql_res: %lx",result));
- if (result)
- {
- if (result->handle && result->handle->status == MYSQL_STATUS_USE_RESULT)
- {
- DBUG_PRINT("warning",("Not all rows in set were read; Ignoring rows"));
- for (;;)
- {
- uint pkt_len;
- if ((pkt_len=(uint) net_safe_read(result->handle)) == packet_error)
- break;
- if (pkt_len == 1 && result->handle->net.read_pos[0] == 254)
- break; /* End of data */
- }
- result->handle->status=MYSQL_STATUS_READY;
- }
- free_rows(result->data);
- if (result->fields)
- free_root(&result->field_alloc,MYF(0));
- if (result->row)
- my_free((gptr) result->row,MYF(0));
- my_free((gptr) result,MYF(0));
- }
- DBUG_VOID_RETURN;
-}
-
-
-/****************************************************************************
-** Get options from my.cnf
-****************************************************************************/
-
-static const char *default_options[]=
-{"port","socket","compress","password","pipe", "timeout", "user",
- "init-command", "host", "database", "debug", "return-found-rows",
- "ssl-key" ,"ssl-cert" ,"ssl-ca" ,"ssl-capath",
- "character-set-dir", "default-character-set", "interactive-timeout",
- "connect_timeout",
- NullS
-};
-
-static TYPELIB option_types={array_elements(default_options)-1,
- "options",default_options};
-
-static void mysql_read_default_options(struct st_mysql_options *options,
- const char *filename,const char *group)
-{
- int argc;
- char *argv_buff[1],**argv;
- const char *groups[3];
- DBUG_ENTER("mysql_read_default_options");
- DBUG_PRINT("enter",("file: %s group: %s",filename,group ? group :"NULL"));
-
- argc=1; argv=argv_buff; argv_buff[0]= (char*) "client";
- groups[0]= (char*) "client"; groups[1]= (char*) group; groups[2]=0;
-
- load_defaults(filename, groups, &argc, &argv);
- if (argc != 1) /* If some default option */
- {
- char **option=argv;
- while (*++option)
- {
- /* DBUG_PRINT("info",("option: %s",option[0])); */
- if (option[0][0] == '-' && option[0][1] == '-')
- {
- char *end=strcend(*option,'=');
- char *opt_arg=0;
- if (*end)
- {
- opt_arg=end+1;
- *end=0; /* Remove '=' */
- }
- switch (find_type(*option+2,&option_types,2)) {
- case 1: /* port */
- if (opt_arg)
- options->port=atoi(opt_arg);
- break;
- case 2: /* socket */
- if (opt_arg)
- {
- my_free(options->unix_socket,MYF(MY_ALLOW_ZERO_PTR));
- options->unix_socket=my_strdup(opt_arg,MYF(MY_WME));
- }
- break;
- case 3: /* compress */
- options->compress=1;
- break;
- case 4: /* password */
- if (opt_arg)
- {
- my_free(options->password,MYF(MY_ALLOW_ZERO_PTR));
- options->password=my_strdup(opt_arg,MYF(MY_WME));
- }
- break;
- case 5: /* pipe */
- options->named_pipe=1; /* Force named pipe */
- break;
- case 20: /* connect_timeout */
- case 6: /* timeout */
- if (opt_arg)
- options->connect_timeout=atoi(opt_arg);
- break;
- case 7: /* user */
- if (opt_arg)
- {
- my_free(options->user,MYF(MY_ALLOW_ZERO_PTR));
- options->user=my_strdup(opt_arg,MYF(MY_WME));
- }
- break;
- case 8: /* init-command */
- if (opt_arg)
- {
- my_free(options->init_command,MYF(MY_ALLOW_ZERO_PTR));
- options->init_command=my_strdup(opt_arg,MYF(MY_WME));
- }
- break;
- case 9: /* host */
- if (opt_arg)
- {
- my_free(options->host,MYF(MY_ALLOW_ZERO_PTR));
- options->host=my_strdup(opt_arg,MYF(MY_WME));
- }
- break;
- case 10: /* database */
- if (opt_arg)
- {
- my_free(options->db,MYF(MY_ALLOW_ZERO_PTR));
- options->db=my_strdup(opt_arg,MYF(MY_WME));
- }
- break;
- case 11: /* debug */
- mysql_debug(opt_arg ? opt_arg : "d:t:o,/tmp/client.trace");
- break;
- case 12: /* return-found-rows */
- options->client_flag|=CLIENT_FOUND_ROWS;
- break;
-#ifdef HAVE_OPENSSL
- case 13: /* ssl_key */
- my_free(options->ssl_key, MYF(MY_ALLOW_ZERO_PTR));
- options->ssl_key = my_strdup(opt_arg, MYF(MY_WME));
- break;
- case 14: /* ssl_cert */
- my_free(options->ssl_cert, MYF(MY_ALLOW_ZERO_PTR));
- options->ssl_cert = my_strdup(opt_arg, MYF(MY_WME));
- break;
- case 15: /* ssl_ca */
- my_free(options->ssl_ca, MYF(MY_ALLOW_ZERO_PTR));
- options->ssl_ca = my_strdup(opt_arg, MYF(MY_WME));
- break;
- case 16: /* ssl_capath */
- my_free(options->ssl_capath, MYF(MY_ALLOW_ZERO_PTR));
- options->ssl_capath = my_strdup(opt_arg, MYF(MY_WME));
- break;
-#else
- case 13: /* Ignore SSL options */
- case 14:
- case 15:
- case 16:
- break;
-#endif /* HAVE_OPENSSL */
- case 17: /* charset-lib */
- my_free(options->charset_dir,MYF(MY_ALLOW_ZERO_PTR));
- options->charset_dir = my_strdup(opt_arg, MYF(MY_WME));
- break;
- case 18:
- my_free(options->charset_name,MYF(MY_ALLOW_ZERO_PTR));
- options->charset_name = my_strdup(opt_arg, MYF(MY_WME));
- break;
- case 19: /* Interactive-timeout */
- options->client_flag|=CLIENT_INTERACTIVE;
- break;
- default:
- DBUG_PRINT("warning",("unknown option: %s",option[0]));
- }
- }
- }
- }
- free_defaults(argv);
- DBUG_VOID_RETURN;
-}
-
-
-/***************************************************************************
-** Change field rows to field structs
-***************************************************************************/
-
-static MYSQL_FIELD *
-unpack_fields(MYSQL_DATA *data,MEM_ROOT *alloc,uint fields,
- my_bool default_value, my_bool long_flag_protocol)
-{
- MYSQL_ROWS *row;
- MYSQL_FIELD *field,*result;
- DBUG_ENTER("unpack_fields");
-
- field=result=(MYSQL_FIELD*) alloc_root(alloc,sizeof(MYSQL_FIELD)*fields);
- if (!result)
- DBUG_RETURN(0);
-
- for (row=data->data; row ; row = row->next,field++)
- {
- field->table= strdup_root(alloc,(char*) row->data[0]);
- field->name= strdup_root(alloc,(char*) row->data[1]);
- field->length= (uint) uint3korr(row->data[2]);
- field->type= (enum enum_field_types) (uchar) row->data[3][0];
- if (long_flag_protocol)
- {
- field->flags= uint2korr(row->data[4]);
- field->decimals=(uint) (uchar) row->data[4][2];
- }
- else
- {
- field->flags= (uint) (uchar) row->data[4][0];
- field->decimals=(uint) (uchar) row->data[4][1];
- }
- if (INTERNAL_NUM_FIELD(field))
- field->flags|= NUM_FLAG;
- if (default_value && row->data[5])
- field->def=strdup_root(alloc,(char*) row->data[5]);
- else
- field->def=0;
- field->max_length= 0;
- }
- free_rows(data); /* Free old data */
- DBUG_RETURN(result);
-}
-
-
-/* Read all rows (fields or data) from server */
-
-static MYSQL_DATA *read_rows(MYSQL *mysql,MYSQL_FIELD *mysql_fields,
- uint fields)
-{
- uint field,pkt_len;
- ulong len;
- uchar *cp;
- char *to;
- MYSQL_DATA *result;
- MYSQL_ROWS **prev_ptr,*cur;
- NET *net = &mysql->net;
- DBUG_ENTER("read_rows");
-
- if ((pkt_len=(uint) net_safe_read(mysql)) == packet_error)
- DBUG_RETURN(0);
- if (!(result=(MYSQL_DATA*) my_malloc(sizeof(MYSQL_DATA),
- MYF(MY_WME | MY_ZEROFILL))))
- {
- net->last_errno=CR_OUT_OF_MEMORY;
- strmov(net->last_error,ER(net->last_errno));
- DBUG_RETURN(0);
- }
- init_alloc_root(&result->alloc,8192,0); /* Assume rowlength < 8192 */
- result->alloc.min_malloc=sizeof(MYSQL_ROWS);
- prev_ptr= &result->data;
- result->rows=0;
- result->fields=fields;
-
- while (*(cp=net->read_pos) != 254 || pkt_len != 1)
- {
- result->rows++;
- if (!(cur= (MYSQL_ROWS*) alloc_root(&result->alloc,
- sizeof(MYSQL_ROWS))) ||
- !(cur->data= ((MYSQL_ROW)
- alloc_root(&result->alloc,
- (fields+1)*sizeof(char *)+pkt_len))))
- {
- free_rows(result);
- net->last_errno=CR_OUT_OF_MEMORY;
- strmov(net->last_error,ER(net->last_errno));
- DBUG_RETURN(0);
- }
- *prev_ptr=cur;
- prev_ptr= &cur->next;
- to= (char*) (cur->data+fields+1);
- for (field=0 ; field < fields ; field++)
- {
- if ((len=(ulong) net_field_length(&cp)) == NULL_LENGTH)
- { /* null field */
- cur->data[field] = 0;
- }
- else
- {
- cur->data[field] = to;
- memcpy(to,(char*) cp,len); to[len]=0;
- to+=len+1;
- cp+=len;
- if (mysql_fields)
- {
- if (mysql_fields[field].max_length < len)
- mysql_fields[field].max_length=len;
- }
- }
- }
- cur->data[field]=to; /* End of last field */
- if ((pkt_len=net_safe_read(mysql)) == packet_error)
- {
- free_rows(result);
- DBUG_RETURN(0);
- }
- }
- *prev_ptr=0; /* last pointer is null */
- DBUG_PRINT("exit",("Got %d rows",result->rows));
- DBUG_RETURN(result);
-}
-
-
-/*
-** Read one row. Uses packet buffer as storage for fields.
-** When next packet is read, the previous field values are destroyed
-*/
-
-
-static int
-read_one_row(MYSQL *mysql,uint fields,MYSQL_ROW row, ulong *lengths)
-{
- uint field;
- ulong pkt_len,len;
- uchar *pos,*prev_pos;
-
- if ((pkt_len=(uint) net_safe_read(mysql)) == packet_error)
- return -1;
- if (pkt_len == 1 && mysql->net.read_pos[0] == 254)
- return 1; /* End of data */
- prev_pos= 0; /* allowed to write at packet[-1] */
- pos=mysql->net.read_pos;
- for (field=0 ; field < fields ; field++)
- {
- if ((len=(ulong) net_field_length(&pos)) == NULL_LENGTH)
- { /* null field */
- row[field] = 0;
- *lengths++=0;
- }
- else
- {
- row[field] = (char*) pos;
- pos+=len;
- *lengths++=len;
- }
- if (prev_pos)
- *prev_pos=0; /* Terminate prev field */
- prev_pos=pos;
- }
- row[field]=(char*) prev_pos+1; /* End of last field */
- *prev_pos=0; /* Terminate last field */
- return 0;
-}
-
-/****************************************************************************
-** Init MySQL structure or allocate one
-****************************************************************************/
-
-MYSQL * STDCALL
-mysql_init(MYSQL *mysql)
-{
- mysql_once_init();
- if (!mysql)
- {
- if (!(mysql=(MYSQL*) my_malloc(sizeof(*mysql),MYF(MY_WME | MY_ZEROFILL))))
- return 0;
- mysql->free_me=1;
- mysql->net.vio = 0;
- }
- else
- bzero((char*) (mysql),sizeof(*(mysql)));
- mysql->options.connect_timeout=CONNECT_TIMEOUT;
-#if defined(SIGPIPE) && defined(THREAD)
- if (!((mysql)->client_flag & CLIENT_IGNORE_SIGPIPE))
- (void) signal(SIGPIPE,pipe_sig_handler);
-#endif
- return mysql;
-}
-
-
-static void mysql_once_init()
-{
- if (!mysql_client_init)
- {
- mysql_client_init=1;
- my_init(); /* Will init threads */
- init_client_errs();
- if (!mysql_port)
- {
- mysql_port = MYSQL_PORT;
-#ifndef MSDOS
- {
- struct servent *serv_ptr;
- char *env;
- if ((serv_ptr = getservbyname("mysql", "tcp")))
- mysql_port = (uint) ntohs((ushort) serv_ptr->s_port);
- if ((env = getenv("MYSQL_TCP_PORT")))
- mysql_port =(uint) atoi(env);
- }
-#endif
- }
- if (!mysql_unix_port)
- {
- char *env;
-#ifdef __WIN__
- mysql_unix_port = (char*) MYSQL_NAMEDPIPE;
-#else
- mysql_unix_port = (char*) MYSQL_UNIX_ADDR;
-#endif
- if ((env = getenv("MYSQL_UNIX_PORT")))
- mysql_unix_port = env;
- }
- mysql_debug(NullS);
-#if defined(SIGPIPE) && !defined(THREAD)
- (void) signal(SIGPIPE,SIG_IGN);
-#endif
- }
-#ifdef THREAD
- else
- my_thread_init(); /* Init if new thread */
-#endif
-}
-
-#ifdef HAVE_OPENSSL
-/**************************************************************************
-** Fill in SSL part of MYSQL structure and set 'use_ssl' flag.
-** NB! Errors are not reported until you do mysql_real_connect.
-**************************************************************************/
-
-int STDCALL
-mysql_ssl_set(MYSQL *mysql, const char *key, const char *cert,
- const char *ca, const char *capath)
-{
- mysql->options.ssl_key = key==0 ? 0 : my_strdup(key,MYF(0));
- mysql->options.ssl_cert = cert==0 ? 0 : my_strdup(cert,MYF(0));
- mysql->options.ssl_ca = ca==0 ? 0 : my_strdup(ca,MYF(0));
- mysql->options.ssl_capath = capath==0 ? 0 : my_strdup(capath,MYF(0));
- mysql->options.use_ssl = true;
- mysql->connector_fd = new_VioSSLConnectorFd(key, cert, ca, capath);
- return 0;
-}
-
-/**************************************************************************
-**************************************************************************/
-
-char * STDCALL
-mysql_ssl_cipher(MYSQL *mysql)
-{
- return (char *)mysql->net.vio->cipher_description();
-}
-
-
-/**************************************************************************
-** Free strings in the SSL structure and clear 'use_ssl' flag.
-** NB! Errors are not reported until you do mysql_real_connect.
-**************************************************************************/
-
-int STDCALL
-mysql_ssl_clear(MYSQL *mysql)
-{
- my_free(mysql->options.ssl_key, MYF(MY_ALLOW_ZERO_PTR));
- my_free(mysql->options.ssl_cert, MYF(MY_ALLOW_ZERO_PTR));
- my_free(mysql->options.ssl_ca, MYF(MY_ALLOW_ZERO_PTR));
- my_free(mysql->options.ssl_capath, MYF(MY_ALLOW_ZERO_PTR));
- mysql->options.ssl_key = 0;
- mysql->options.ssl_cert = 0;
- mysql->options.ssl_ca = 0;
- mysql->options.ssl_capath = 0;
- mysql->options.use_ssl = false;
- mysql->connector_fd->delete();
- mysql->connector_fd = 0;
- return 0;
-}
-#endif /* HAVE_OPENSSL */
-
-/**************************************************************************
-** Connect to sql server
-** If host == 0 then use localhost
-**************************************************************************/
-
-MYSQL * STDCALL
-mysql_connect(MYSQL *mysql,const char *host,
- const char *user, const char *passwd)
-{
- MYSQL *res;
- mysql=mysql_init(mysql); /* Make it thread safe */
- {
- DBUG_ENTER("mysql_connect");
- if (!(res=mysql_real_connect(mysql,host,user,passwd,NullS,0,NullS,0)))
- {
- if (mysql->free_me)
- my_free((gptr) mysql,MYF(0));
- }
- DBUG_RETURN(res);
- }
-}
-
-
-/*
-** Note that the mysql argument must be initialized with mysql_init()
-** before calling mysql_real_connect !
-*/
-
-MYSQL * STDCALL
-mysql_real_connect(MYSQL *mysql,const char *host, const char *user,
- const char *passwd, const char *db,
- uint port, const char *unix_socket,uint client_flag)
-{
- char buff[NAME_LEN+USERNAME_LENGTH+100],charset_name_buff[16];
- char *end,*host_info,*charset_name;
- my_socket sock;
- uint32 ip_addr;
- struct sockaddr_in sock_addr;
- uint pkt_length;
- NET *net= &mysql->net;
-#ifdef __WIN__
- HANDLE hPipe=INVALID_HANDLE_VALUE;
-#endif
-#ifdef HAVE_SYS_UN_H
- struct sockaddr_un UNIXaddr;
-#endif
- init_sigpipe_variables
- DBUG_ENTER("mysql_real_connect");
-
- DBUG_PRINT("enter",("host: %s db: %s user: %s",
- host ? host : "(Null)",
- db ? db : "(Null)",
- user ? user : "(Null)"));
-
- /* Don't give sigpipe errors if the client doesn't want them */
- set_sigpipe(mysql);
- net->vio = 0; /* If something goes wrong */
- /* use default options */
- if (mysql->options.my_cnf_file || mysql->options.my_cnf_group)
- {
- mysql_read_default_options(&mysql->options,
- (mysql->options.my_cnf_file ?
- mysql->options.my_cnf_file : "my"),
- mysql->options.my_cnf_group);
- my_free(mysql->options.my_cnf_file,MYF(MY_ALLOW_ZERO_PTR));
- my_free(mysql->options.my_cnf_group,MYF(MY_ALLOW_ZERO_PTR));
- mysql->options.my_cnf_file=mysql->options.my_cnf_group=0;
- }
-
- /* Some empty-string-tests are done because of ODBC */
- if (!host || !host[0])
- host=mysql->options.host;
- if (!user || !user[0])
- user=mysql->options.user;
- if (!passwd)
- {
- passwd=mysql->options.password;
-#ifndef DONT_USE_MYSQL_PWD
- if (!passwd)
- passwd=getenv("MYSQL_PWD"); /* get it from environment (haneke) */
-#endif
- }
- if (!db || !db[0])
- db=mysql->options.db;
- if (!port)
- port=mysql->options.port;
- if (!unix_socket)
- unix_socket=mysql->options.unix_socket;
-
- mysql->reconnect=1; /* Reconnect as default */
- mysql->server_status=SERVER_STATUS_AUTOCOMMIT;
-
- /*
- ** Grab a socket and connect it to the server
- */
-
-#if defined(HAVE_SYS_UN_H)
- if ((!host || !strcmp(host,LOCAL_HOST)) && (unix_socket || mysql_unix_port))
- {
- host=LOCAL_HOST;
- if (!unix_socket)
- unix_socket=mysql_unix_port;
- host_info=(char*) ER(CR_LOCALHOST_CONNECTION);
- DBUG_PRINT("info",("Using UNIX sock '%s'",unix_socket));
- if ((sock = socket(AF_UNIX,SOCK_STREAM,0)) == SOCKET_ERROR)
- {
- net->last_errno=CR_SOCKET_CREATE_ERROR;
- sprintf(net->last_error,ER(net->last_errno),ERRNO);
- goto error;
- }
- net->vio = vio_new(sock, VIO_TYPE_SOCKET, TRUE);
- bzero((char*) &UNIXaddr,sizeof(UNIXaddr));
- UNIXaddr.sun_family = AF_UNIX;
- strmov(UNIXaddr.sun_path, unix_socket);
- if (connect2(sock,(struct sockaddr *) &UNIXaddr, sizeof(UNIXaddr),
- mysql->options.connect_timeout) <0)
- {
- DBUG_PRINT("error",("Got error %d on connect to local server",ERRNO));
- net->last_errno=CR_CONNECTION_ERROR;
- sprintf(net->last_error,ER(net->last_errno),unix_socket,ERRNO);
- goto error;
- }
- }
- else
-#elif defined(__WIN__)
- {
- if ((unix_socket ||
- !host && is_NT() ||
- host && !strcmp(host,LOCAL_HOST_NAMEDPIPE) ||
- mysql->options.named_pipe || !have_tcpip))
- {
- sock=0;
- if ((hPipe=create_named_pipe(net, mysql->options.connect_timeout,
- (char**) &host, (char**) &unix_socket)) ==
- INVALID_HANDLE_VALUE)
- {
- DBUG_PRINT("error",
- ("host: '%s' socket: '%s' named_pipe: %d have_tcpip: %d",
- host ? host : "<null>",
- unix_socket ? unix_socket : "<null>",
- (int) mysql->options.named_pipe,
- (int) have_tcpip));
- if (mysql->options.named_pipe ||
- (host && !strcmp(host,LOCAL_HOST_NAMEDPIPE)) ||
- (unix_socket && !strcmp(unix_socket,MYSQL_NAMEDPIPE)))
- goto error; /* User only requested named pipes */
- /* Try also with TCP/IP */
- }
- else
- {
- net->vio=vio_new_win32pipe(hPipe);
- sprintf(host_info=buff, ER(CR_NAMEDPIPE_CONNECTION), host,
- unix_socket);
- }
- }
- }
- if (hPipe == INVALID_HANDLE_VALUE)
-#endif
- {
- unix_socket=0; /* This is not used */
- if (!port)
- port=mysql_port;
- if (!host)
- host=LOCAL_HOST;
- sprintf(host_info=buff,ER(CR_TCP_CONNECTION),host);
- DBUG_PRINT("info",("Server name: '%s'. TCP sock: %d", host,port));
- /* _WIN64 ; Assume that the (int) range is enough for socket() */
- if ((sock = (my_socket) socket(AF_INET,SOCK_STREAM,0)) == SOCKET_ERROR)
- {
- net->last_errno=CR_IPSOCK_ERROR;
- sprintf(net->last_error,ER(net->last_errno),ERRNO);
- goto error;
- }
- net->vio = vio_new(sock,VIO_TYPE_TCPIP,FALSE);
- bzero((char*) &sock_addr,sizeof(sock_addr));
- sock_addr.sin_family = AF_INET;
-
- /*
- ** The server name may be a host name or IP address
- */
-
- if ((int) (ip_addr = inet_addr(host)) != (int) INADDR_NONE)
- {
- memcpy_fixed(&sock_addr.sin_addr,&ip_addr,sizeof(ip_addr));
- }
- else
-#if defined(HAVE_GETHOSTBYNAME_R) && defined(_REENTRANT) && defined(THREAD)
- {
- int tmp_errno;
- struct hostent tmp_hostent,*hp;
- char buff2[GETHOSTBYNAME_BUFF_SIZE];
- hp = my_gethostbyname_r(host,&tmp_hostent,buff2,sizeof(buff2),
- &tmp_errno);
- if (!hp)
- {
- net->last_errno=CR_UNKNOWN_HOST;
- sprintf(net->last_error, ER(CR_UNKNOWN_HOST), host, tmp_errno);
- goto error;
- }
- memcpy(&sock_addr.sin_addr,hp->h_addr, (size_t) hp->h_length);
- }
-#else
- {
- struct hostent *hp;
- if (!(hp=gethostbyname(host)))
- {
- net->last_errno=CR_UNKNOWN_HOST;
- sprintf(net->last_error, ER(CR_UNKNOWN_HOST), host, errno);
- goto error;
- }
- memcpy(&sock_addr.sin_addr,hp->h_addr, (size_t) hp->h_length);
- }
-#endif
- sock_addr.sin_port = (ushort) htons((ushort) port);
- if (connect2(sock,(struct sockaddr *) &sock_addr, sizeof(sock_addr),
- mysql->options.connect_timeout) <0)
- {
- DBUG_PRINT("error",("Got error %d on connect to '%s'",ERRNO,host));
- net->last_errno= CR_CONN_HOST_ERROR;
- sprintf(net->last_error ,ER(CR_CONN_HOST_ERROR), host, ERRNO);
- goto error;
- }
- }
-
- if (!net->vio || my_net_init(net, net->vio))
- {
- vio_delete(net->vio);
- net->vio = 0;
- net->last_errno=CR_OUT_OF_MEMORY;
- strmov(net->last_error,ER(net->last_errno));
- goto error;
- }
- vio_keepalive(net->vio,TRUE);
-
- /* Get version info */
- mysql->protocol_version= PROTOCOL_VERSION; /* Assume this */
- if (mysql->options.connect_timeout &&
- vio_poll_read(net->vio, mysql->options.connect_timeout))
- {
- net->last_errno= CR_SERVER_LOST;
- strmov(net->last_error,ER(net->last_errno));
- goto error;
- }
- if ((pkt_length=net_safe_read(mysql)) == packet_error)
- goto error;
-
- /* Check if version of protocoll matches current one */
-
- mysql->protocol_version= net->read_pos[0];
- DBUG_DUMP("packet",(char*) net->read_pos,10);
- DBUG_PRINT("info",("mysql protocol version %d, server=%d",
- PROTOCOL_VERSION, mysql->protocol_version));
- if (mysql->protocol_version != PROTOCOL_VERSION &&
- mysql->protocol_version != PROTOCOL_VERSION-1)
- {
- net->last_errno= CR_VERSION_ERROR;
- sprintf(net->last_error, ER(CR_VERSION_ERROR), mysql->protocol_version,
- PROTOCOL_VERSION);
- goto error;
- }
- end=strend((char*) net->read_pos+1);
- mysql->thread_id=uint4korr(end+1);
- end+=5;
- strmake(mysql->scramble_buff,end,8);
- end+=9;
- if (pkt_length >= (uint) (end+1 - (char*) net->read_pos))
- mysql->server_capabilities=uint2korr(end);
- if (pkt_length >= (uint) (end+18 - (char*) net->read_pos))
- {
- /* New protocol with 16 bytes to describe server characteristics */
- mysql->server_language=end[2];
- mysql->server_status=uint2korr(end+3);
- }
-
- /* Set character set */
- if ((charset_name=mysql->options.charset_name))
- {
- const char *save=charsets_dir;
- if (mysql->options.charset_dir)
- charsets_dir=mysql->options.charset_dir;
- mysql->charset=get_charset_by_name(mysql->options.charset_name,
- MYF(MY_WME));
- charsets_dir=save;
- }
- else if (mysql->server_language)
- {
- charset_name=charset_name_buff;
- sprintf(charset_name,"%d",mysql->server_language); /* In case of errors */
- if (!(mysql->charset =
- get_charset((uint8) mysql->server_language, MYF(MY_WME))))
- mysql->charset = default_charset_info; /* shouldn't be fatal */
-
- }
- else
- mysql->charset=default_charset_info;
-
- if (!mysql->charset)
- {
- net->last_errno=CR_CANT_READ_CHARSET;
- if (mysql->options.charset_dir)
- sprintf(net->last_error,ER(net->last_errno),
- charset_name ? charset_name : "unknown",
- mysql->options.charset_dir);
- else
- {
- char cs_dir_name[FN_REFLEN];
- get_charsets_dir(cs_dir_name);
- sprintf(net->last_error,ER(net->last_errno),
- charset_name ? charset_name : "unknown",
- cs_dir_name);
- }
- goto error;
- }
-
- /* Save connection information */
- if (!user) user="";
- if (!passwd) passwd="";
- if (!my_multi_malloc(MYF(0),
- &mysql->host_info, (uint) strlen(host_info)+1,
- &mysql->host, (uint) strlen(host)+1,
- &mysql->unix_socket,unix_socket ?
- (uint) strlen(unix_socket)+1 : (uint) 1,
- &mysql->server_version,
- (uint) (end - (char*) net->read_pos),
- NullS) ||
- !(mysql->user=my_strdup(user,MYF(0))) ||
- !(mysql->passwd=my_strdup(passwd,MYF(0))))
- {
- strmov(net->last_error, ER(net->last_errno=CR_OUT_OF_MEMORY));
- goto error;
- }
- strmov(mysql->host_info,host_info);
- strmov(mysql->host,host);
- if (unix_socket)
- strmov(mysql->unix_socket,unix_socket);
- else
- mysql->unix_socket=0;
- strmov(mysql->server_version,(char*) net->read_pos+1);
- mysql->port=port;
- client_flag|=mysql->options.client_flag;
-
- /* Send client information for access check */
- client_flag|=CLIENT_CAPABILITIES;
-
-#ifdef HAVE_OPENSSL
- if (mysql->options.use_ssl)
- client_flag|=CLIENT_SSL;
-#endif /* HAVE_OPENSSL */
-
- if (db)
- client_flag|=CLIENT_CONNECT_WITH_DB;
-#ifdef HAVE_COMPRESS
- if ((mysql->server_capabilities & CLIENT_COMPRESS) &&
- (mysql->options.compress || (client_flag & CLIENT_COMPRESS)))
- client_flag|=CLIENT_COMPRESS; /* We will use compression */
- else
-#endif
- client_flag&= ~CLIENT_COMPRESS;
-
-#ifdef HAVE_OPENSSL
- if ((mysql->server_capabilities & CLIENT_SSL) &&
- (mysql->options.use_ssl || (client_flag & CLIENT_SSL)))
- {
- DBUG_PRINT("info", ("Changing IO layer to SSL"));
- client_flag |= CLIENT_SSL;
- }
- else
- {
- if (client_flag & CLIENT_SSL)
- {
- DBUG_PRINT("info", ("Leaving IO layer intact because server doesn't support SSL"));
- }
- client_flag &= ~CLIENT_SSL;
- }
-#endif /* HAVE_OPENSSL */
-
- int2store(buff,client_flag);
- mysql->client_flag=client_flag;
-
-#ifdef HAVE_OPENSSL
- /* Oops.. are we careful enough to not send ANY information */
- /* without encryption? */
- if (client_flag & CLIENT_SSL)
- {
- if (my_net_write(net,buff,(uint) (2)) || net_flush(net))
- goto error;
- /* Do the SSL layering. */
- DBUG_PRINT("info", ("IO layer change in progress..."));
- VioSSLConnectorFd* connector_fd = (VioSSLConnectorFd*)
- (mysql->connector_fd);
- VioSocket* vio_socket = (VioSocket*)(mysql->net.vio);
- VioSSL* vio_ssl = connector_fd->connect(vio_socket);
- mysql->net.vio = (NetVio*)(vio_ssl);
- }
-#endif /* HAVE_OPENSSL */
-
- DBUG_PRINT("info",("Server version = '%s' capabilites: %ld status: %d client_flag: %d",
- mysql->server_version,mysql->server_capabilities,
- mysql->server_status, client_flag));
-
- int3store(buff+2,max_allowed_packet);
- if (user && user[0])
- strmake(buff+5,user,32); /* Max user name */
- else
- read_user_name((char*) buff+5);
-#ifdef _CUSTOMCONFIG_
-#include "_cust_libmysql.h";
-#endif
- DBUG_PRINT("info",("user: %s",buff+5));
- end=scramble(strend(buff+5)+1, mysql->scramble_buff, passwd,
- (my_bool) (mysql->protocol_version == 9));
- if (db && (mysql->server_capabilities & CLIENT_CONNECT_WITH_DB))
- {
- end=strmake(end+1,db,NAME_LEN);
- mysql->db=my_strdup(db,MYF(MY_WME));
- db=0;
- }
- if (my_net_write(net,buff,(uint) (end-buff)) || net_flush(net) ||
- net_safe_read(mysql) == packet_error)
- goto error;
- if (client_flag & CLIENT_COMPRESS) /* We will use compression */
- net->compress=1;
- if (db && mysql_select_db(mysql,db))
- goto error;
- if (mysql->options.init_command)
- {
- my_bool reconnect=mysql->reconnect;
- mysql->reconnect=0;
- if (mysql_query(mysql,mysql->options.init_command))
- goto error;
- mysql_free_result(mysql_use_result(mysql));
- mysql->reconnect=reconnect;
- }
-
- DBUG_PRINT("exit",("Mysql handler: %lx",mysql));
- reset_sigpipe(mysql);
- DBUG_RETURN(mysql);
-
-error:
- reset_sigpipe(mysql);
- DBUG_PRINT("error",("message: %u (%s)",net->last_errno,net->last_error));
- {
- /* Free alloced memory */
- my_bool free_me=mysql->free_me;
- end_server(mysql);
- mysql->free_me=0;
- mysql_close(mysql);
- mysql->free_me=free_me;
- }
- DBUG_RETURN(0);
-}
-
-
-static my_bool mysql_reconnect(MYSQL *mysql)
-{
- MYSQL tmp_mysql;
- DBUG_ENTER("mysql_reconnect");
-
- if (!mysql->reconnect ||
- (mysql->server_status & SERVER_STATUS_IN_TRANS) || !mysql->host_info)
- {
- /* Allov reconnect next time */
- mysql->server_status&= ~SERVER_STATUS_IN_TRANS;
- DBUG_RETURN(1);
- }
- mysql_init(&tmp_mysql);
- tmp_mysql.options=mysql->options;
- if (!mysql_real_connect(&tmp_mysql,mysql->host,mysql->user,mysql->passwd,
- mysql->db, mysql->port, mysql->unix_socket,
- mysql->client_flag))
- DBUG_RETURN(1);
- tmp_mysql.free_me=mysql->free_me;
- mysql->free_me=0;
- bzero((char*) &mysql->options,sizeof(mysql->options));
- mysql_close(mysql);
- *mysql=tmp_mysql;
- net_clear(&mysql->net);
- mysql->affected_rows= ~(my_ulonglong) 0;
- DBUG_RETURN(0);
-}
-
-
-/**************************************************************************
-** Change user and database
-**************************************************************************/
-
-my_bool STDCALL mysql_change_user(MYSQL *mysql, const char *user,
- const char *passwd, const char *db)
-{
- char buff[512],*pos=buff;
- DBUG_ENTER("mysql_change_user");
-
- if (!user)
- user="";
- if (!passwd)
- passwd="";
-
- pos=strmov(pos,user)+1;
- pos=scramble(pos, mysql->scramble_buff, passwd,
- (my_bool) (mysql->protocol_version == 9));
- pos=strmov(pos+1,db ? db : "");
- if (simple_command(mysql,COM_CHANGE_USER, buff,(uint) (pos-buff),0))
- DBUG_RETURN(1);
-
- my_free(mysql->user,MYF(MY_ALLOW_ZERO_PTR));
- my_free(mysql->passwd,MYF(MY_ALLOW_ZERO_PTR));
- my_free(mysql->db,MYF(MY_ALLOW_ZERO_PTR));
-
- mysql->user= my_strdup(user,MYF(MY_WME));
- mysql->passwd=my_strdup(passwd,MYF(MY_WME));
- mysql->db= db ? my_strdup(db,MYF(MY_WME)) : 0;
- DBUG_RETURN(0);
-}
-
-
-/**************************************************************************
-** Set current database
-**************************************************************************/
-
-int STDCALL
-mysql_select_db(MYSQL *mysql, const char *db)
-{
- int error;
- DBUG_ENTER("mysql_select_db");
- DBUG_PRINT("enter",("db: '%s'",db));
-
- if ((error=simple_command(mysql,COM_INIT_DB,db,(uint) strlen(db),0)))
- DBUG_RETURN(error);
- my_free(mysql->db,MYF(MY_ALLOW_ZERO_PTR));
- mysql->db=my_strdup(db,MYF(MY_WME));
- DBUG_RETURN(0);
-}
-
-
-/*************************************************************************
-** Send a QUIT to the server and close the connection
-** If handle is alloced by mysql connect free it.
-*************************************************************************/
-
-void STDCALL
-mysql_close(MYSQL *mysql)
-{
- DBUG_ENTER("mysql_close");
- if (mysql) /* Some simple safety */
- {
- if (mysql->net.vio != 0)
- {
- free_old_query(mysql);
- mysql->status=MYSQL_STATUS_READY; /* Force command */
- mysql->reconnect=0;
- simple_command(mysql,COM_QUIT,NullS,0,1);
- end_server(mysql);
- }
- my_free((gptr) mysql->host_info,MYF(MY_ALLOW_ZERO_PTR));
- my_free(mysql->user,MYF(MY_ALLOW_ZERO_PTR));
- my_free(mysql->passwd,MYF(MY_ALLOW_ZERO_PTR));
- my_free(mysql->db,MYF(MY_ALLOW_ZERO_PTR));
- my_free(mysql->options.init_command,MYF(MY_ALLOW_ZERO_PTR));
- my_free(mysql->options.user,MYF(MY_ALLOW_ZERO_PTR));
- my_free(mysql->options.host,MYF(MY_ALLOW_ZERO_PTR));
- my_free(mysql->options.password,MYF(MY_ALLOW_ZERO_PTR));
- my_free(mysql->options.unix_socket,MYF(MY_ALLOW_ZERO_PTR));
- my_free(mysql->options.db,MYF(MY_ALLOW_ZERO_PTR));
- my_free(mysql->options.my_cnf_file,MYF(MY_ALLOW_ZERO_PTR));
- my_free(mysql->options.my_cnf_group,MYF(MY_ALLOW_ZERO_PTR));
- my_free(mysql->options.charset_dir,MYF(MY_ALLOW_ZERO_PTR));
- my_free(mysql->options.charset_name,MYF(MY_ALLOW_ZERO_PTR));
- /* Clear pointers for better safety */
- mysql->host_info=mysql->user=mysql->passwd=mysql->db=0;
- bzero((char*) &mysql->options,sizeof(mysql->options));
- mysql->net.vio = 0;
-#ifdef HAVE_OPENSSL
- ((VioConnectorFd*)(mysql->connector_fd))->delete();
- mysql->connector_fd = 0;
-#endif /* HAVE_OPENSSL */
- if (mysql->free_me)
- my_free((gptr) mysql,MYF(0));
- }
- DBUG_VOID_RETURN;
-}
-
-
-/**************************************************************************
-** Do a query. If query returned rows, free old rows.
-** Read data by mysql_store_result or by repeat call of mysql_fetch_row
-**************************************************************************/
-
-int STDCALL
-mysql_query(MYSQL *mysql, const char *query)
-{
- return mysql_real_query(mysql,query, (uint) strlen(query));
-}
-
-/*
- Send the query and return so we can do something else.
- Needs to be followed by mysql_read_query_result() when we want to
- finish processing it.
-*/
-
-int STDCALL
-mysql_send_query(MYSQL* mysql, const char* query, uint length)
-{
- return simple_command(mysql, COM_QUERY, query, length, 1);
-}
-
-int STDCALL mysql_read_query_result(MYSQL *mysql)
-{
- uchar *pos;
- ulong field_count;
- MYSQL_DATA *fields;
- uint length;
- DBUG_ENTER("mysql_read_query_result");
-
- if ((length = net_safe_read(mysql)) == packet_error)
- DBUG_RETURN(-1);
- free_old_query(mysql); /* Free old result */
-get_info:
- pos=(uchar*) mysql->net.read_pos;
- if ((field_count= net_field_length(&pos)) == 0)
- {
- mysql->affected_rows= net_field_length_ll(&pos);
- mysql->insert_id= net_field_length_ll(&pos);
- if (mysql->server_capabilities & CLIENT_TRANSACTIONS)
- {
- mysql->server_status=uint2korr(pos); pos+=2;
- }
- if (pos < mysql->net.read_pos+length && net_field_length(&pos))
- mysql->info=(char*) pos;
- DBUG_RETURN(0);
- }
- if (field_count == NULL_LENGTH) /* LOAD DATA LOCAL INFILE */
- {
- int error=send_file_to_server(mysql,(char*) pos);
- if ((length=net_safe_read(mysql)) == packet_error || error)
- DBUG_RETURN(-1);
- goto get_info; /* Get info packet */
- }
- if (!(mysql->server_status & SERVER_STATUS_AUTOCOMMIT))
- mysql->server_status|= SERVER_STATUS_IN_TRANS;
-
- mysql->extra_info= net_field_length_ll(&pos); /* Maybe number of rec */
- if (!(fields=read_rows(mysql,(MYSQL_FIELD*) 0,5)))
- DBUG_RETURN(-1);
- if (!(mysql->fields=unpack_fields(fields,&mysql->field_alloc,
- (uint) field_count,0,
- (my_bool) test(mysql->server_capabilities &
- CLIENT_LONG_FLAG))))
- DBUG_RETURN(-1);
- mysql->status=MYSQL_STATUS_GET_RESULT;
- mysql->field_count=field_count;
- DBUG_RETURN(0);
-}
-
-int STDCALL
-mysql_real_query(MYSQL *mysql, const char *query, uint length)
-{
- DBUG_ENTER("mysql_real_query");
- DBUG_PRINT("enter",("handle: %lx",mysql));
- DBUG_PRINT("query",("Query = \"%s\"",query));
- if (simple_command(mysql,COM_QUERY,query,length,1))
- DBUG_RETURN(-1);
- DBUG_RETURN(mysql_read_query_result(mysql));
-}
-
-static int
-send_file_to_server(MYSQL *mysql, const char *filename)
-{
- int fd, readcount;
- char buf[IO_SIZE*15],*tmp_name;
- DBUG_ENTER("send_file_to_server");
-
- fn_format(buf,filename,"","",4); /* Convert to client format */
- if (!(tmp_name=my_strdup(buf,MYF(0))))
- {
- strmov(mysql->net.last_error, ER(mysql->net.last_errno=CR_OUT_OF_MEMORY));
- DBUG_RETURN(-1);
- }
- if ((fd = my_open(tmp_name,O_RDONLY, MYF(0))) < 0)
- {
- mysql->net.last_errno=EE_FILENOTFOUND;
- sprintf(buf,EE(mysql->net.last_errno),tmp_name,errno);
- strmake(mysql->net.last_error,buf,sizeof(mysql->net.last_error)-1);
- my_net_write(&mysql->net,"",0); net_flush(&mysql->net);
- my_free(tmp_name,MYF(0));
- DBUG_RETURN(-1);
- }
-
- while ((readcount = (int) my_read(fd,buf,sizeof(buf),MYF(0))) > 0)
- {
- if (my_net_write(&mysql->net,buf,readcount))
- {
- mysql->net.last_errno=CR_SERVER_LOST;
- strmov(mysql->net.last_error,ER(mysql->net.last_errno));
- DBUG_PRINT("error",("Lost connection to MySQL server during LOAD DATA of local file"));
- (void) my_close(fd,MYF(0));
- my_free(tmp_name,MYF(0));
- DBUG_RETURN(-1);
- }
- }
- (void) my_close(fd,MYF(0));
- /* Send empty packet to mark end of file */
- if (my_net_write(&mysql->net,"",0) || net_flush(&mysql->net))
- {
- mysql->net.last_errno=CR_SERVER_LOST;
- sprintf(mysql->net.last_error,ER(mysql->net.last_errno),errno);
- my_free(tmp_name,MYF(0));
- DBUG_RETURN(-1);
- }
- if (readcount < 0)
- {
- mysql->net.last_errno=EE_READ; /* the errmsg for not entire file read */
- sprintf(buf,EE(mysql->net.last_errno),tmp_name,errno);
- strmake(mysql->net.last_error,buf,sizeof(mysql->net.last_error)-1);
- my_free(tmp_name,MYF(0));
- DBUG_RETURN(-1);
- }
- DBUG_RETURN(0);
-}
-
-
-/**************************************************************************
-** Alloc result struct for buffered results. All rows are read to buffer.
-** mysql_data_seek may be used.
-**************************************************************************/
-
-MYSQL_RES * STDCALL
-mysql_store_result(MYSQL *mysql)
-{
- MYSQL_RES *result;
- DBUG_ENTER("mysql_store_result");
-
- if (!mysql->fields)
- DBUG_RETURN(0);
- if (mysql->status != MYSQL_STATUS_GET_RESULT)
- {
- strmov(mysql->net.last_error,
- ER(mysql->net.last_errno=CR_COMMANDS_OUT_OF_SYNC));
- DBUG_RETURN(0);
- }
- mysql->status=MYSQL_STATUS_READY; /* server is ready */
- if (!(result=(MYSQL_RES*) my_malloc(sizeof(MYSQL_RES)+
- sizeof(ulong)*mysql->field_count,
- MYF(MY_WME | MY_ZEROFILL))))
- {
- mysql->net.last_errno=CR_OUT_OF_MEMORY;
- strmov(mysql->net.last_error, ER(mysql->net.last_errno));
- DBUG_RETURN(0);
- }
- result->eof=1; /* Marker for buffered */
- result->lengths=(ulong*) (result+1);
- if (!(result->data=read_rows(mysql,mysql->fields,mysql->field_count)))
- {
- my_free((gptr) result,MYF(0));
- DBUG_RETURN(0);
- }
- mysql->affected_rows= result->row_count= result->data->rows;
- result->data_cursor= result->data->data;
- result->fields= mysql->fields;
- result->field_alloc= mysql->field_alloc;
- result->field_count= mysql->field_count;
- result->current_field=0;
- result->current_row=0; /* Must do a fetch first */
- mysql->fields=0; /* fields is now in result */
- DBUG_RETURN(result); /* Data fetched */
-}
-
-
-/**************************************************************************
-** Alloc struct for use with unbuffered reads. Data is fetched by domand
-** when calling to mysql_fetch_row.
-** mysql_data_seek is a noop.
-**
-** No other queries may be specified with the same MYSQL handle.
-** There shouldn't be much processing per row because mysql server shouldn't
-** have to wait for the client (and will not wait more than 30 sec/packet).
-**************************************************************************/
-
-MYSQL_RES * STDCALL
-mysql_use_result(MYSQL *mysql)
-{
- MYSQL_RES *result;
- DBUG_ENTER("mysql_use_result");
-
- if (!mysql->fields)
- DBUG_RETURN(0);
- if (mysql->status != MYSQL_STATUS_GET_RESULT)
- {
- strmov(mysql->net.last_error,
- ER(mysql->net.last_errno=CR_COMMANDS_OUT_OF_SYNC));
- DBUG_RETURN(0);
- }
- if (!(result=(MYSQL_RES*) my_malloc(sizeof(*result)+
- sizeof(ulong)*mysql->field_count,
- MYF(MY_WME | MY_ZEROFILL))))
- DBUG_RETURN(0);
- result->lengths=(ulong*) (result+1);
- if (!(result->row=(MYSQL_ROW)
- my_malloc(sizeof(result->row[0])*(mysql->field_count+1), MYF(MY_WME))))
- { /* Ptrs: to one row */
- my_free((gptr) result,MYF(0));
- DBUG_RETURN(0);
- }
- result->fields= mysql->fields;
- result->field_alloc= mysql->field_alloc;
- result->field_count= mysql->field_count;
- result->current_field=0;
- result->handle= mysql;
- result->current_row= 0;
- mysql->fields=0; /* fields is now in result */
- mysql->status=MYSQL_STATUS_USE_RESULT;
- DBUG_RETURN(result); /* Data is read to be fetched */
-}
-
-
-
-/**************************************************************************
-** Return next field of the query results
-**************************************************************************/
-
-MYSQL_FIELD * STDCALL
-mysql_fetch_field(MYSQL_RES *result)
-{
- if (result->current_field >= result->field_count)
- return(NULL);
- return &result->fields[result->current_field++];
-}
-
-
-/**************************************************************************
-** Return next row of the query results
-**************************************************************************/
-
-MYSQL_ROW STDCALL
-mysql_fetch_row(MYSQL_RES *res)
-{
- DBUG_ENTER("mysql_fetch_row");
- if (!res->data)
- { /* Unbufferred fetch */
- if (!res->eof)
- {
- if (!(read_one_row(res->handle,res->field_count,res->row, res->lengths)))
- {
- res->row_count++;
- DBUG_RETURN(res->current_row=res->row);
- }
- else
- {
- DBUG_PRINT("info",("end of data"));
- res->eof=1;
- res->handle->status=MYSQL_STATUS_READY;
- }
- }
- DBUG_RETURN((MYSQL_ROW) NULL);
- }
- {
- MYSQL_ROW tmp;
- if (!res->data_cursor)
- {
- DBUG_PRINT("info",("end of data"));
- DBUG_RETURN(res->current_row=(MYSQL_ROW) NULL);
- }
- tmp = res->data_cursor->data;
- res->data_cursor = res->data_cursor->next;
- DBUG_RETURN(res->current_row=tmp);
- }
-}
-
-/**************************************************************************
-** Get column lengths of the current row
-** If one uses mysql_use_result, res->lengths contains the length information,
-** else the lengths are calculated from the offset between pointers.
-**************************************************************************/
-
-ulong * STDCALL
-mysql_fetch_lengths(MYSQL_RES *res)
-{
- ulong *lengths,*prev_length;
- byte *start;
- MYSQL_ROW column,end;
-
- if (!(column=res->current_row))
- return 0; /* Something is wrong */
- if (res->data)
- {
- start=0;
- prev_length=0; /* Keep gcc happy */
- lengths=res->lengths;
- for (end=column+res->field_count+1 ; column != end ; column++,lengths++)
- {
- if (!*column)
- {
- *lengths=0; /* Null */
- continue;
- }
- if (start) /* Found end of prev string */
- *prev_length= (uint) (*column-start-1);
- start= *column;
- prev_length=lengths;
- }
- }
- return res->lengths;
-}
-
-/**************************************************************************
-** Move to a specific row and column
-**************************************************************************/
-
-void STDCALL
-mysql_data_seek(MYSQL_RES *result, my_ulonglong row)
-{
- MYSQL_ROWS *tmp=0;
- DBUG_PRINT("info",("mysql_data_seek(%ld)",(long) row));
- if (result->data)
- for (tmp=result->data->data; row-- && tmp ; tmp = tmp->next) ;
- result->current_row=0;
- result->data_cursor = tmp;
-}
-
-/*************************************************************************
-** put the row or field cursor one a position one got from mysql_row_tell()
-** This doesn't restore any data. The next mysql_fetch_row or
-** mysql_fetch_field will return the next row or field after the last used
-*************************************************************************/
-
-MYSQL_ROW_OFFSET STDCALL
-mysql_row_seek(MYSQL_RES *result, MYSQL_ROW_OFFSET row)
-{
- MYSQL_ROW_OFFSET return_value=result->data_cursor;
- result->current_row= 0;
- result->data_cursor= row;
- return return_value;
-}
-
-
-MYSQL_FIELD_OFFSET STDCALL
-mysql_field_seek(MYSQL_RES *result, MYSQL_FIELD_OFFSET field_offset)
-{
- MYSQL_FIELD_OFFSET return_value=result->current_field;
- result->current_field=field_offset;
- return return_value;
-}
-
-/*****************************************************************************
-** List all databases
-*****************************************************************************/
-
-MYSQL_RES * STDCALL
-mysql_list_dbs(MYSQL *mysql, const char *wild)
-{
- char buff[255];
- DBUG_ENTER("mysql_list_dbs");
-
- append_wild(strmov(buff,"show databases"),buff+sizeof(buff),wild);
- if (mysql_query(mysql,buff))
- DBUG_RETURN(0);
- DBUG_RETURN (mysql_store_result(mysql));
-}
-
-
-/*****************************************************************************
-** List all tables in a database
-** If wild is given then only the tables matching wild is returned
-*****************************************************************************/
-
-MYSQL_RES * STDCALL
-mysql_list_tables(MYSQL *mysql, const char *wild)
-{
- char buff[255];
- DBUG_ENTER("mysql_list_tables");
-
- append_wild(strmov(buff,"show tables"),buff+sizeof(buff),wild);
- if (mysql_query(mysql,buff))
- DBUG_RETURN(0);
- DBUG_RETURN (mysql_store_result(mysql));
-}
-
-
-/**************************************************************************
-** List all fields in a table
-** If wild is given then only the fields matching wild is returned
-** Instead of this use query:
-** show fields in 'table' like "wild"
-**************************************************************************/
-
-MYSQL_RES * STDCALL
-mysql_list_fields(MYSQL *mysql, const char *table, const char *wild)
-{
- MYSQL_RES *result;
- MYSQL_DATA *query;
- char buff[257],*end;
- DBUG_ENTER("mysql_list_fields");
- DBUG_PRINT("enter",("table: '%s' wild: '%s'",table,wild ? wild : ""));
-
- LINT_INIT(query);
-
- end=strmake(strmake(buff, table,128)+1,wild ? wild : "",128);
- if (simple_command(mysql,COM_FIELD_LIST,buff,(uint) (end-buff),1) ||
- !(query = read_rows(mysql,(MYSQL_FIELD*) 0,6)))
- DBUG_RETURN(NULL);
-
- free_old_query(mysql);
- if (!(result = (MYSQL_RES *) my_malloc(sizeof(MYSQL_RES),
- MYF(MY_WME | MY_ZEROFILL))))
- {
- free_rows(query);
- DBUG_RETURN(NULL);
- }
- result->field_alloc=mysql->field_alloc;
- mysql->fields=0;
- result->field_count = (uint) query->rows;
- result->fields= unpack_fields(query,&result->field_alloc,
- result->field_count,1,
- (my_bool) test(mysql->server_capabilities &
- CLIENT_LONG_FLAG));
- result->eof=1;
- DBUG_RETURN(result);
-}
-
-/* List all running processes (threads) in server */
-
-MYSQL_RES * STDCALL
-mysql_list_processes(MYSQL *mysql)
-{
- MYSQL_DATA *fields;
- uint field_count;
- uchar *pos;
- DBUG_ENTER("mysql_list_processes");
-
- LINT_INIT(fields);
- if (simple_command(mysql,COM_PROCESS_INFO,0,0,0))
- DBUG_RETURN(0);
- free_old_query(mysql);
- pos=(uchar*) mysql->net.read_pos;
- field_count=(uint) net_field_length(&pos);
- if (!(fields = read_rows(mysql,(MYSQL_FIELD*) 0,5)))
- DBUG_RETURN(NULL);
- if (!(mysql->fields=unpack_fields(fields,&mysql->field_alloc,field_count,0,
- (my_bool) test(mysql->server_capabilities &
- CLIENT_LONG_FLAG))))
- DBUG_RETURN(0);
- mysql->status=MYSQL_STATUS_GET_RESULT;
- mysql->field_count=field_count;
- DBUG_RETURN(mysql_store_result(mysql));
-}
-
-
-int STDCALL
-mysql_create_db(MYSQL *mysql, const char *db)
-{
- DBUG_ENTER("mysql_createdb");
- DBUG_PRINT("enter",("db: %s",db));
- DBUG_RETURN(simple_command(mysql,COM_CREATE_DB,db, (uint) strlen(db),0));
-}
-
-
-int STDCALL
-mysql_drop_db(MYSQL *mysql, const char *db)
-{
- DBUG_ENTER("mysql_drop_db");
- DBUG_PRINT("enter",("db: %s",db));
- DBUG_RETURN(simple_command(mysql,COM_DROP_DB,db,(uint) strlen(db),0));
-}
-
-
-int STDCALL
-mysql_shutdown(MYSQL *mysql)
-{
- DBUG_ENTER("mysql_shutdown");
- DBUG_RETURN(simple_command(mysql,COM_SHUTDOWN,0,0,0));
-}
-
-
-int STDCALL
-mysql_refresh(MYSQL *mysql,uint options)
-{
- uchar bits[1];
- DBUG_ENTER("mysql_refresh");
- bits[0]= (uchar) options;
- DBUG_RETURN(simple_command(mysql,COM_REFRESH,(char*) bits,1,0));
-}
-
-int STDCALL
-mysql_kill(MYSQL *mysql,ulong pid)
-{
- char buff[12];
- DBUG_ENTER("mysql_kill");
- int4store(buff,pid);
- DBUG_RETURN(simple_command(mysql,COM_PROCESS_KILL,buff,4,0));
-}
-
-
-int STDCALL
-mysql_dump_debug_info(MYSQL *mysql)
-{
- DBUG_ENTER("mysql_dump_debug_info");
- DBUG_RETURN(simple_command(mysql,COM_DEBUG,0,0,0));
-}
-
-char * STDCALL
-mysql_stat(MYSQL *mysql)
-{
- DBUG_ENTER("mysql_stat");
- if (simple_command(mysql,COM_STATISTICS,0,0,0))
- return mysql->net.last_error;
- mysql->net.read_pos[mysql->packet_length]=0; /* End of stat string */
- if (!mysql->net.read_pos[0])
- {
- mysql->net.last_errno=CR_WRONG_HOST_INFO;
- strmov(mysql->net.last_error, ER(mysql->net.last_errno));
- return mysql->net.last_error;
- }
- DBUG_RETURN((char*) mysql->net.read_pos);
-}
-
-
-int STDCALL
-mysql_ping(MYSQL *mysql)
-{
- DBUG_ENTER("mysql_ping");
- DBUG_RETURN(simple_command(mysql,COM_PING,0,0,0));
-}
-
-
-char * STDCALL
-mysql_get_server_info(MYSQL *mysql)
-{
- return((char*) mysql->server_version);
-}
-
-
-char * STDCALL
-mysql_get_host_info(MYSQL *mysql)
-{
- return(mysql->host_info);
-}
-
-
-uint STDCALL
-mysql_get_proto_info(MYSQL *mysql)
-{
- return (mysql->protocol_version);
-}
-
-char * STDCALL
-mysql_get_client_info(void)
-{
- return (char*) MYSQL_SERVER_VERSION;
-}
-
-
-int STDCALL
-mysql_options(MYSQL *mysql,enum mysql_option option, const char *arg)
-{
- DBUG_ENTER("mysql_option");
- DBUG_PRINT("enter",("option: %d",(int) option));
- switch (option) {
- case MYSQL_OPT_CONNECT_TIMEOUT:
- mysql->options.connect_timeout= *(uint*) arg;
- break;
- case MYSQL_OPT_COMPRESS:
- mysql->options.compress=1; /* Remember for connect */
- break;
- case MYSQL_OPT_NAMED_PIPE:
- mysql->options.named_pipe=1; /* Force named pipe */
- break;
- case MYSQL_INIT_COMMAND:
- my_free(mysql->options.init_command,MYF(MY_ALLOW_ZERO_PTR));
- mysql->options.init_command=my_strdup(arg,MYF(MY_WME));
- break;
- case MYSQL_READ_DEFAULT_FILE:
- my_free(mysql->options.my_cnf_file,MYF(MY_ALLOW_ZERO_PTR));
- mysql->options.my_cnf_file=my_strdup(arg,MYF(MY_WME));
- break;
- case MYSQL_READ_DEFAULT_GROUP:
- my_free(mysql->options.my_cnf_group,MYF(MY_ALLOW_ZERO_PTR));
- mysql->options.my_cnf_group=my_strdup(arg,MYF(MY_WME));
- break;
- case MYSQL_SET_CHARSET_DIR:
- my_free(mysql->options.charset_dir,MYF(MY_ALLOW_ZERO_PTR));
- mysql->options.charset_dir=my_strdup(arg,MYF(MY_WME));
- break;
- case MYSQL_SET_CHARSET_NAME:
- my_free(mysql->options.charset_name,MYF(MY_ALLOW_ZERO_PTR));
- mysql->options.charset_name=my_strdup(arg,MYF(MY_WME));
- break;
- default:
- DBUG_RETURN(-1);
- }
- DBUG_RETURN(0);
-}
-
-/****************************************************************************
-** Functions to get information from the MySQL structure
-** These are functions to make shared libraries more usable.
-****************************************************************************/
-
-/* MYSQL_RES */
-my_ulonglong STDCALL mysql_num_rows(MYSQL_RES *res)
-{
- return res->row_count;
-}
-
-unsigned int STDCALL mysql_num_fields(MYSQL_RES *res)
-{
- return res->field_count;
-}
-
-my_bool STDCALL mysql_eof(MYSQL_RES *res)
-{
- return res->eof;
-}
-
-MYSQL_FIELD * STDCALL mysql_fetch_field_direct(MYSQL_RES *res,uint fieldnr)
-{
- return &(res)->fields[fieldnr];
-}
-
-MYSQL_FIELD * STDCALL mysql_fetch_fields(MYSQL_RES *res)
-{
- return (res)->fields;
-}
-
-MYSQL_ROWS * STDCALL mysql_row_tell(MYSQL_RES *res)
-{
- return res->data_cursor;
-}
-
-uint STDCALL mysql_field_tell(MYSQL_RES *res)
-{
- return (res)->current_field;
-}
-
-/* MYSQL */
-
-unsigned int STDCALL mysql_field_count(MYSQL *mysql)
-{
- return mysql->field_count;
-}
-
-my_ulonglong STDCALL mysql_affected_rows(MYSQL *mysql)
-{
- return (mysql)->affected_rows;
-}
-
-my_ulonglong STDCALL mysql_insert_id(MYSQL *mysql)
-{
- return (mysql)->insert_id;
-}
-
-uint STDCALL mysql_errno(MYSQL *mysql)
-{
- return (mysql)->net.last_errno;
-}
-
-char * STDCALL mysql_error(MYSQL *mysql)
-{
- return (mysql)->net.last_error;
-}
-
-char *STDCALL mysql_info(MYSQL *mysql)
-{
- return (mysql)->info;
-}
-
-ulong STDCALL mysql_thread_id(MYSQL *mysql)
-{
- return (mysql)->thread_id;
-}
-
-const char * STDCALL mysql_character_set_name(MYSQL *mysql)
-{
- return mysql->charset->name;
-}
-
-
-uint STDCALL mysql_thread_safe(void)
-{
-#ifdef THREAD
- return 1;
-#else
- return 0;
-#endif
-}
-
-/****************************************************************************
-** Some support functions
-****************************************************************************/
-
-/*
-** Add escape characters to a string (blob?) to make it suitable for a insert
-** to should at least have place for length*2+1 chars
-** Returns the length of the to string
-*/
-
-ulong STDCALL
-mysql_escape_string(char *to,const char *from,ulong length)
-{
- return mysql_sub_escape_string(default_charset_info,to,from,length);
-}
-
-ulong STDCALL
-mysql_real_escape_string(MYSQL *mysql, char *to,const char *from,
- ulong length)
-{
- return mysql_sub_escape_string(mysql->charset,to,from,length);
-}
-
-
-static ulong
-mysql_sub_escape_string(CHARSET_INFO *charset_info, char *to,
- const char *from, ulong length)
-{
- const char *to_start=to;
- const char *end;
-#ifdef USE_MB
- my_bool use_mb_flag=use_mb(charset_info);
-#endif
- for (end=from+length; from != end ; from++)
- {
-#ifdef USE_MB
- int l;
- if (use_mb_flag && (l = my_ismbchar(charset_info, from, end)))
- {
- while (l--)
- *to++ = *from++;
- from--;
- continue;
- }
-#endif
- switch (*from) {
- case 0: /* Must be escaped for 'mysql' */
- *to++= '\\';
- *to++= '0';
- break;
- case '\n': /* Must be escaped for logs */
- *to++= '\\';
- *to++= 'n';
- break;
- case '\r':
- *to++= '\\';
- *to++= 'r';
- break;
- case '\\':
- *to++= '\\';
- *to++= '\\';
- break;
- case '\'':
- *to++= '\\';
- *to++= '\'';
- break;
- case '"': /* Better safe than sorry */
- *to++= '\\';
- *to++= '"';
- break;
- case '\032': /* This gives problems on Win32 */
- *to++= '\\';
- *to++= 'Z';
- break;
- default:
- *to++= *from;
- }
- }
- *to=0;
- return (ulong) (to-to_start);
-}
-
-
-char * STDCALL
-mysql_odbc_escape_string(MYSQL *mysql,
- char *to, ulong to_length,
- const char *from, ulong from_length,
- void *param,
- char * (*extend_buffer)
- (void *, char *, ulong *))
-{
- char *to_end=to+to_length-5;
- const char *end;
-#ifdef USE_MB
- my_bool use_mb_flag=use_mb(mysql->charset);
-#endif
-
- for (end=from+from_length; from != end ; from++)
- {
- if (to >= to_end)
- {
- to_length = (ulong) (end-from)+512; /* We want this much more */
- if (!(to=(*extend_buffer)(param, to, &to_length)))
- return to;
- to_end=to+to_length-5;
- }
-#ifdef USE_MB
- {
- int l;
- if (use_mb_flag && (l = my_ismbchar(mysql->charset, from, end)))
- {
- while (l--)
- *to++ = *from++;
- from--;
- continue;
- }
- }
-#endif
- switch (*from) {
- case 0: /* Must be escaped for 'mysql' */
- *to++= '\\';
- *to++= '0';
- break;
- case '\n': /* Must be escaped for logs */
- *to++= '\\';
- *to++= 'n';
- break;
- case '\r':
- *to++= '\\';
- *to++= 'r';
- break;
- case '\\':
- *to++= '\\';
- *to++= '\\';
- break;
- case '\'':
- *to++= '\\';
- *to++= '\'';
- break;
- case '"': /* Better safe than sorry */
- *to++= '\\';
- *to++= '"';
- break;
- case '\032': /* This gives problems on Win32 */
- *to++= '\\';
- *to++= 'Z';
- break;
- default:
- *to++= *from;
- }
- }
- return to;
-}
-
-void STDCALL
-myodbc_remove_escape(MYSQL *mysql,char *name)
-{
- char *to;
-#ifdef USE_MB
- my_bool use_mb_flag=use_mb(mysql->charset);
- char *end;
- LINT_INIT(end);
- if (use_mb_flag)
- for (end=name; *end ; end++) ;
-#endif
-
- for (to=name ; *name ; name++)
- {
-#ifdef USE_MB
- int l;
- if (use_mb_flag && (l = my_ismbchar( mysql->charset, name , end ) ) )
- {
- while (l--)
- *to++ = *name++;
- name--;
- continue;
- }
-#endif
- if (*name == '\\' && name[1])
- name++;
- *to++= *name;
- }
- *to=0;
-}
diff --git a/ext/mysql/libmysql/libmysql.dsp b/ext/mysql/libmysql/libmysql.dsp
deleted file mode 100644
index 4525a51ab8..0000000000
--- a/ext/mysql/libmysql/libmysql.dsp
+++ /dev/null
@@ -1,585 +0,0 @@
-# Microsoft Developer Studio Project File - Name="libmysql" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Static Library" 0x0104
-
-CFG=libmysql - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "libmysql.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "libmysql.mak" CFG="libmysql - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "libmysql - Win32 Debug_TS" (based on "Win32 (x86) Static Library")
-!MESSAGE "libmysql - Win32 Release_TS" (based on "Win32 (x86) Static Library")
-!MESSAGE "libmysql - Win32 Release_TS_inline" (based on "Win32 (x86) Static Library")
-!MESSAGE "libmysql - Win32 Debug" (based on "Win32 (x86) Static Library")
-!MESSAGE "libmysql - Win32 Release" (based on "Win32 (x86) Static Library")
-!MESSAGE "libmysql - Win32 Release_inline" (based on "Win32 (x86) Static Library")
-!MESSAGE "libmysql - Win32 Release_TSDbg" (based on "Win32 (x86) Static Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "libmysql - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /I "." /D "_DEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /D "__WIN32__" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "." /D "_DEBUG" /D "_LIB" /D "__WIN32__" /D "USE_TLS" /D "WIN32" /D "_MBCS" /YX /FD /GZ /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LIB32=link.exe -lib
-# ADD BASE LIB32 /nologo
-# ADD LIB32 /nologo
-
-!ELSEIF "$(CFG)" == "libmysql - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /I "." /D "NDEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /D "__WIN32__" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /D "NDEBUG" /D "_LIB" /D "__WIN32__" /D "USE_TLS" /D "WIN32" /D "_MBCS" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LIB32=link.exe -lib
-# ADD BASE LIB32 /nologo
-# ADD LIB32 /nologo
-
-!ELSEIF "$(CFG)" == "libmysql - Win32 Release_TS_inline"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS_inline"
-# PROP BASE Intermediate_Dir "Release_TS_inline"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS_inline"
-# PROP Intermediate_Dir "Release_TS_inline"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /I "." /D "NDEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /D "__WIN32__" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /D "NDEBUG" /D "_LIB" /D "__WIN32__" /D "USE_TLS" /D "WIN32" /D "_MBCS" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LIB32=link.exe -lib
-# ADD BASE LIB32 /nologo
-# ADD LIB32 /nologo
-
-!ELSEIF "$(CFG)" == "libmysql - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "libmysql___Win32_Debug"
-# PROP BASE Intermediate_Dir "libmysql___Win32_Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "." /D "_DEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /D "__WIN32__" /D "USE_TLS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "." /D "_DEBUG" /D "_LIB" /D "__WIN32__" /D "USE_TLS" /D "WIN32" /D "_MBCS" /YX /FD /GZ /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LIB32=link.exe -lib
-# ADD BASE LIB32 /nologo
-# ADD LIB32 /nologo
-
-!ELSEIF "$(CFG)" == "libmysql - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "libmysql___Win32_Release"
-# PROP BASE Intermediate_Dir "libmysql___Win32_Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "." /D "NDEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /D "__WIN32__" /D "USE_TLS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /D "NDEBUG" /D "_LIB" /D "__WIN32__" /D "USE_TLS" /D "WIN32" /D "_MBCS" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LIB32=link.exe -lib
-# ADD BASE LIB32 /nologo
-# ADD LIB32 /nologo
-
-!ELSEIF "$(CFG)" == "libmysql - Win32 Release_inline"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "libmysql___Win32_Release_inline"
-# PROP BASE Intermediate_Dir "libmysql___Win32_Release_inline"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_inline"
-# PROP Intermediate_Dir "Release_inline"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "." /D "NDEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /D "__WIN32__" /D "USE_TLS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /D "NDEBUG" /D "_LIB" /D "__WIN32__" /D "USE_TLS" /D "WIN32" /D "_MBCS" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LIB32=link.exe -lib
-# ADD BASE LIB32 /nologo
-# ADD LIB32 /nologo
-
-!ELSEIF "$(CFG)" == "libmysql - Win32 Release_TSDbg"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "libmysql___Win32_Release_TSDbg"
-# PROP BASE Intermediate_Dir "libmysql___Win32_Release_TSDbg"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TSDbg"
-# PROP Intermediate_Dir "Release_TSDbg"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "." /D "NDEBUG" /D "_LIB" /D "__WIN32__" /D "USE_TLS" /D "WIN32" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /Zi /Od /I "." /D "NDEBUG" /D "_LIB" /D "__WIN32__" /D "USE_TLS" /D "WIN32" /D "_MBCS" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LIB32=link.exe -lib
-# ADD BASE LIB32 /nologo
-# ADD LIB32 /nologo
-
-!ENDIF
-
-# Begin Target
-
-# Name "libmysql - Win32 Debug_TS"
-# Name "libmysql - Win32 Release_TS"
-# Name "libmysql - Win32 Release_TS_inline"
-# Name "libmysql - Win32 Debug"
-# Name "libmysql - Win32 Release"
-# Name "libmysql - Win32 Release_inline"
-# Name "libmysql - Win32 Release_TSDbg"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\array.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\bchange.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\bmove.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\bmove_upp.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\charset.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\ctype.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\dbug.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\default.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\dll.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\errmsg.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\errors.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\get_password.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\int2str.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\is_prefix.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\libmysql.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\list.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\longlong2str.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\mf_casecnv.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\mf_dirname.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\mf_fn_ext.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\mf_format.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\mf_loadpath.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\mf_pack.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\mf_path.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\mf_unixpath.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\mf_wcomp.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\mulalloc.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\my_alloc.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\my_compress.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\my_create.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\my_delete.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\my_div.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\my_error.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\my_fopen.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\my_getwd.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\my_init.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\my_lib.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\my_malloc.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\my_messnc.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\my_net.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\my_once.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\my_open.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\my_pthread.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\my_read.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\my_realloc.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\my_static.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\my_tempnam.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\my_thr_init.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\my_wincond.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\my_winthread.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\my_write.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\net.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\password.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\safemalloc.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\str2int.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\strcend.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\strcont.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\strend.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\strfill.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\string.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\strinstr.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\strmake.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\strmov.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\strnmov.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\strtoll.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\strtoull.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\strxmov.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\thr_mutex.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\typelib.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\violite.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\acconfig.h
-# End Source File
-# Begin Source File
-
-SOURCE=".\config-win.h"
-# End Source File
-# Begin Source File
-
-SOURCE=.\dbug.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\errmsg.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\global.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\m_ctype.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\m_string.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\my_alarm.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\my_dir.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\my_list.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\my_net.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\my_pthread.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\my_static.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\my_sys.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\mysql.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\mysql_com.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\mysql_version.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\mysqld_error.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\mysys_err.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\mysys_priv.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\thr_alarm.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\violite.h
-# End Source File
-# End Group
-# End Target
-# End Project
diff --git a/ext/mysql/libmysql/list.c b/ext/mysql/libmysql/list.c
deleted file mode 100644
index 79bc7da4c5..0000000000
--- a/ext/mysql/libmysql/list.c
+++ /dev/null
@@ -1,102 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-/*
- Code for handling dubble-linked lists in C
-*/
-
-#include "mysys_priv.h"
-#include <my_list.h>
-
-
-
- /* Add a element to start of list */
-
-LIST *list_add(LIST *root, LIST *element)
-{
- DBUG_ENTER("list_add");
- DBUG_PRINT("enter",("root: %lx element: %lx", root, element));
- if (root)
- {
- if (root->prev) /* If add in mid of list */
- root->prev->next= element;
- element->prev=root->prev;
- root->prev=element;
- }
- else
- element->prev=0;
- element->next=root;
- DBUG_RETURN(element); /* New root */
-}
-
-
-LIST *list_delete(LIST *root, LIST *element)
-{
- if (element->prev)
- element->prev->next=element->next;
- else
- root=element->next;
- if (element->next)
- element->next->prev=element->prev;
- return root;
-}
-
-
-void list_free(LIST *root, pbool free_data)
-{
- LIST *next;
- while (root)
- {
- next=root->next;
- if (free_data)
- my_free((gptr) root->data,MYF(0));
- my_free((gptr) root,MYF(0));
- root=next;
- }
-}
-
-
-LIST *list_cons(void *data, LIST *list)
-{
- LIST *new=(LIST*) my_malloc(sizeof(LIST),MYF(MY_FAE));
- if (!new)
- return 0;
- new->data=data;
- return list_add(list,new);
-}
-
-
-LIST *list_reverse(LIST *root)
-{
- LIST *last;
-
- last=root;
- while (root)
- {
- last=root;
- root=root->next;
- last->next=last->prev;
- last->prev=root;
- }
- return last;
-}
-
-uint list_length(LIST *list)
-{
- uint count;
- for (count=0 ; list ; list=list->next, count++) ;
- return count;
-}
-
-
-int list_walk(LIST *list, list_walk_action action, gptr argument)
-{
- int error=0;
- while (list)
- {
- if ((error = (*action)(list->data,argument)))
- return error;
- list=rest(list);
- }
- return 0;
-}
diff --git a/ext/mysql/libmysql/longlong2str.c b/ext/mysql/libmysql/longlong2str.c
deleted file mode 100644
index 1899386862..0000000000
--- a/ext/mysql/libmysql/longlong2str.c
+++ /dev/null
@@ -1,129 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-/*
- Defines: longlong2str();
-
- longlong2str(dst, radix, val)
- converts the (longlong) integer "val" to character form and moves it to
- the destination string "dst" followed by a terminating NUL. The
- result is normally a pointer to this NUL character, but if the radix
- is dud the result will be NullS and nothing will be changed.
-
- If radix is -2..-36, val is taken to be SIGNED.
- If radix is 2.. 36, val is taken to be UNSIGNED.
- That is, val is signed if and only if radix is. You will normally
- use radix -10 only through itoa and ltoa, for radix 2, 8, or 16
- unsigned is what you generally want.
-
- _dig_vec is public just in case someone has a use for it.
- The definitions of itoa and ltoa are actually macros in m_string.h,
- but this is where the code is.
-
- Note: The standard itoa() returns a pointer to the argument, when int2str
- returns the pointer to the end-null.
- itoa assumes that 10 -base numbers are allways signed and other arn't.
-*/
-
-#include <global.h>
-#include "m_string.h"
-
-#if defined(HAVE_LONG_LONG) && !defined(longlong2str) && !defined(HAVE_LONGLONG2STR)
-
-extern char NEAR _dig_vec[];
-
-/*
- This assumes that longlong multiplication is faster than longlong division.
-*/
-
-char *longlong2str(longlong val,char *dst,int radix)
-{
- char buffer[65];
- register char *p;
- long long_val;
-
- if (radix < 0)
- {
- if (radix < -36 || radix > -2) return (char*) 0;
- if (val < 0) {
- *dst++ = '-';
- val = -val;
- }
- radix = -radix;
- }
- else
- {
- if (radix > 36 || radix < 2) return (char*) 0;
- }
- if (val == 0)
- {
- *dst++='0';
- *dst='\0';
- return dst;
- }
- p = &buffer[sizeof(buffer)-1];
- *p = '\0';
-
- while ((ulonglong) val > (ulonglong) LONG_MAX)
- {
- ulonglong quo=(ulonglong) val/(uint) radix;
- uint rem= (uint) (val- quo* (uint) radix);
- *--p = _dig_vec[rem];
- val= quo;
- }
- long_val= (long) val;
- while (long_val != 0)
- {
- long quo= long_val/radix;
- *--p = _dig_vec[(uchar) (long_val - quo*radix)];
- long_val= quo;
- }
- while ((*dst++ = *p++) != 0) ;
- return dst-1;
-}
-
-#endif
-
-#ifndef longlong10_to_str
-char *longlong10_to_str(longlong val,char *dst,int radix)
-{
- char buffer[65];
- register char *p;
- long long_val;
-
- if (radix < 0)
- {
- if (val < 0)
- {
- *dst++ = '-';
- val = -val;
- }
- }
-
- if (val == 0)
- {
- *dst++='0';
- *dst='\0';
- return dst;
- }
- p = &buffer[sizeof(buffer)-1];
- *p = '\0';
-
- while ((ulonglong) val > (ulonglong) LONG_MAX)
- {
- ulonglong quo=(ulonglong) val/(uint) 10;
- uint rem= (uint) (val- quo* (uint) 10);
- *--p = _dig_vec[rem];
- val= quo;
- }
- long_val= (long) val;
- while (long_val != 0)
- {
- long quo= long_val/10;
- *--p = _dig_vec[(uchar) (long_val - quo*10)];
- long_val= quo;
- }
- while ((*dst++ = *p++) != 0) ;
- return dst-1;
-}
-#endif
diff --git a/ext/mysql/libmysql/m_ctype.h b/ext/mysql/libmysql/m_ctype.h
deleted file mode 100644
index e322ac8f1a..0000000000
--- a/ext/mysql/libmysql/m_ctype.h
+++ /dev/null
@@ -1,144 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-/*
- A better inplementation of the UNIX ctype(3) library.
- Notes: global.h should be included before ctype.h
-*/
-
-#ifndef _m_ctype_h
-#define _m_ctype_h
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define CHARSET_DIR "charsets/"
-
-typedef struct charset_info_st
-{
- uint number;
- const char *name;
- uchar *ctype;
- uchar *to_lower;
- uchar *to_upper;
- uchar *sort_order;
-
- uint strxfrm_multiply;
- int (*strcoll)(const uchar *, const uchar *);
- int (*strxfrm)(uchar *, const uchar *, int);
- int (*strnncoll)(const uchar *, int, const uchar *, int);
- int (*strnxfrm)(uchar *, const uchar *, int, int);
- my_bool (*like_range)(const char *, uint, pchar, uint,
- char *, char *, uint *, uint *);
-
- uint mbmaxlen;
- int (*ismbchar)(const char *, const char *);
- my_bool (*ismbhead)(uint);
- int (*mbcharlen)(uint);
-} CHARSET_INFO;
-
-/* strings/ctype.c */
-extern CHARSET_INFO *default_charset_info;
-extern CHARSET_INFO *find_compiled_charset(uint cs_number);
-extern CHARSET_INFO *find_compiled_charset_by_name(const char *name);
-extern CHARSET_INFO compiled_charsets[];
-
-#define MY_CHARSET_UNDEFINED 0
-#define MY_CHARSET_CURRENT (default_charset_info->number)
-
-#ifdef __WIN__
-#include <ctype.h>
-#endif
-/* Don't include std ctype.h when this is included */
-#define _CTYPE_H
-#define _CTYPE_H_
-#define _CTYPE_INCLUDED
-#define __CTYPE_INCLUDED
-#define _CTYPE_USING /* Don't put names in global namespace. */
-
-#define _U 01 /* Upper case */
-#define _L 02 /* Lower case */
-#define _N 04 /* Numeral (digit) */
-#define _S 010 /* Spacing character */
-#define _P 020 /* Punctuation */
-#define _C 040 /* Control character */
-#define _B 0100 /* Blank */
-#define _X 0200 /* heXadecimal digit */
-
-#define my_ctype (default_charset_info->ctype)
-#define my_to_upper (default_charset_info->to_upper)
-#define my_to_lower (default_charset_info->to_lower)
-#define my_sort_order (default_charset_info->sort_order)
-
-#ifndef __WIN__
-#define _toupper(c) (char) my_to_upper[(uchar) (c)]
-#define _tolower(c) (char) my_to_lower[(uchar) (c)]
-#define toupper(c) (char) my_to_upper[(uchar) (c)]
-#define tolower(c) (char) my_to_lower[(uchar) (c)]
-
-#define isalpha(c) ((my_ctype+1)[(uchar) (c)] & (_U | _L))
-#define isupper(c) ((my_ctype+1)[(uchar) (c)] & _U)
-#define islower(c) ((my_ctype+1)[(uchar) (c)] & _L)
-#define isdigit(c) ((my_ctype+1)[(uchar) (c)] & _N)
-#define isxdigit(c) ((my_ctype+1)[(uchar) (c)] & _X)
-#define isalnum(c) ((my_ctype+1)[(uchar) (c)] & (_U | _L | _N))
-#define isspace(c) ((my_ctype+1)[(uchar) (c)] & _S)
-#define ispunct(c) ((my_ctype+1)[(uchar) (c)] & _P)
-#define isprint(c) ((my_ctype+1)[(uchar) (c)] & (_P | _U | _L | _N | _B))
-#define isgraph(c) ((my_ctype+1)[(uchar) (c)] & (_P | _U | _L | _N))
-#define iscntrl(c) ((my_ctype+1)[(uchar) (c)] & _C)
-#define isascii(c) (!((c) & ~0177))
-#define toascii(c) ((c) & 0177)
-
-#ifdef ctype
-#undef ctype
-#endif /* ctype */
-
-#endif /* __WIN__ */
-
-#define my_isalpha(s, c) (((s)->ctype+1)[(uchar) (c)] & (_U | _L))
-#define my_isupper(s, c) (((s)->ctype+1)[(uchar) (c)] & _U)
-#define my_islower(s, c) (((s)->ctype+1)[(uchar) (c)] & _L)
-#define my_isdigit(s, c) (((s)->ctype+1)[(uchar) (c)] & _N)
-#define my_isxdigit(s, c) (((s)->ctype+1)[(uchar) (c)] & _X)
-#define my_isalnum(s, c) (((s)->ctype+1)[(uchar) (c)] & (_U | _L | _N))
-#define my_isspace(s, c) (((s)->ctype+1)[(uchar) (c)] & _S)
-#define my_ispunct(s, c) (((s)->ctype+1)[(uchar) (c)] & _P)
-#define my_isprint(s, c) (((s)->ctype+1)[(uchar) (c)] & (_P | _U | _L | _N | _B))
-#define my_isgraph(s, c) (((s)->ctype+1)[(uchar) (c)] & (_P | _U | _L | _N))
-#define my_iscntrl(s, c) (((s)->ctype+1)[(uchar) (c)] & _C)
-
-#define use_strcoll(s) ((s)->strcoll != NULL)
-#define MY_STRXFRM_MULTIPLY (default_charset_info->strxfrm_multiply)
-#define my_strnxfrm(s, a, b, c, d) ((s)->strnxfrm((a), (b), (c), (d)))
-#define my_strnncoll(s, a, b, c, d) ((s)->strnncoll((a), (b), (c), (d)))
-#define my_strxfrm(s, a, b, c, d) ((s)->strnxfrm((a), (b), (c)))
-#define my_strcoll(s, a, b) ((s)->strcoll((a), (b)))
-#define my_like_range(s, a, b, c, d, e, f, g, h) \
- ((s)->like_range((a), (b), (c), (d), (e), (f), (g), (h)))
-
-#define use_mb(s) ((s)->ismbchar != NULL)
-#define MBMAXLEN (default_charset_info->mbmaxlen)
-#define my_ismbchar(s, a, b) ((s)->ismbchar((a), (b)))
-#define my_ismbhead(s, a) ((s)->ismbhead((a)))
-#define my_mbcharlen(s, a) ((s)->mbcharlen((a)))
-
-/* Some macros that should be cleaned up a little */
-#define isvar(c) (isalnum(c) || (c) == '_')
-#define isvar_start(c) (isalpha(c) || (c) == '_')
-#define tocntrl(c) ((c) & 31)
-#define toprint(c) ((c) | 64)
-
-/* XXX: still need to take care of this one */
-#ifdef MY_CHARSET_TIS620
-#error The TIS620 charset is broken at the moment. Tell tim to fix it.
-#define USE_TIS620
-#include "t_ctype.h"
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _m_ctype_h */
diff --git a/ext/mysql/libmysql/m_string.h b/ext/mysql/libmysql/m_string.h
deleted file mode 100644
index 1bc3144fdb..0000000000
--- a/ext/mysql/libmysql/m_string.h
+++ /dev/null
@@ -1,227 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-/* There may be prolems include all of theese. Try to test in
- configure with ones are needed? */
-
-/* This is needed for the definitions of strchr... on solaris */
-
-#ifndef _m_string_h
-#define _m_string_h
-#ifndef __USE_GNU
-#define __USE_GNU /* We want to use stpcpy */
-#endif
-#if defined(HAVE_STRINGS_H)
-#include <strings.h>
-#endif
-#if defined(HAVE_STRING_H)
-#include <string.h>
-#endif
-
-/* Correct some things for UNIXWARE7 */
-#ifdef HAVE_UNIXWARE7_THREADS
-#undef HAVE_STRINGS_H
-#undef HAVE_MEMORY_H
-#define HAVE_MEMCPY
-#ifndef HAVE_MEMMOVE
-#define HAVE_MEMMOVE
-#endif
-#undef HAVE_BCMP
-#undef bcopy
-#undef bcmp
-#undef bzero
-#endif /* HAVE_UNIXWARE7_THREADS */
-#ifdef _AIX
-#undef HAVE_BCMP
-#endif
-
-/* This is needed for the definitions of bzero... on solaris */
-#if defined(HAVE_STRINGS_H) && !defined(HAVE_mit_thread)
-#include <strings.h>
-#endif
-
-/* This is needed for the definitions of memcpy... on solaris */
-#if defined(HAVE_MEMORY_H) && !defined(__cplusplus)
-#include <memory.h>
-#endif
-
-#if !defined(HAVE_MEMCPY) && !defined(HAVE_MEMMOVE)
-# define memcpy(d, s, n) bcopy ((s), (d), (n))
-# define memset(A,C,B) bfill((A),(B),(C))
-# define memmove(d, s, n) bmove ((d), (s), (n))
-#elif defined(HAVE_MEMMOVE)
-# define bmove(d, s, n) memmove((d), (s), (n))
-#else
-# define memmove(d, s, n) bmove((d), (s), (n)) /* our bmove */
-#endif
-
-#if defined(HAVE_STPCPY) && !defined(HAVE_mit_thread)
-#define strmov(A,B) stpcpy((A),(B))
-#endif
-
-/* Unixware 7 */
-#if !defined(HAVE_BFILL)
-# define bfill(A,B,C) memset((A),(C),(B))
-# define bmove_allign(A,B,C) memcpy((A),(B),(C))
-#endif
-
-#if !defined(HAVE_BCMP)
-# define bcopy(s, d, n) memcpy((d), (s), (n))
-# define bcmp(A,B,C) memcmp((A),(B),(C))
-# define bzero(A,B) memset((A),0,(B))
-# define bmove_allign(A,B,C) memcpy((A),(B),(C))
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-extern char NEAR _dig_vec[]; /* Declared in int2str() */
-
-#ifdef BAD_STRING_COMPILER
-#define strmov(A,B) (memccpy(A,B,0,INT_MAX)-1)
-#else
-#define strmov_overlapp(A,B) strmov(A,B)
-#define strmake_overlapp(A,B,C) strmake(A,B,C)
-#endif
-
-#ifdef BAD_MEMCPY /* Problem with gcc on Alpha */
-#define memcpy_fixed(A,B,C) bmove((A),(B),(C))
-#else
-#define memcpy_fixed(A,B,C) memcpy((A),(B),(C))
-#endif
-
-#ifdef MSDOS
-#undef bmove_allign
-#define bmove512(A,B,C) bmove_allign(A,B,C)
-#define my_itoa(A,B,C) itoa(A,B,C)
-#define my_ltoa(A,B,C) ltoa(A,B,C)
-extern void bmove_allign(gptr dst,const gptr src,uint len);
-#endif
-
-#if (!defined(USE_BMOVE512) || defined(HAVE_purify)) && !defined(bmove512)
-#define bmove512(A,B,C) memcpy(A,B,C)
-#endif
-
- /* Prototypes for string functions */
-
-#if !defined(bfill) && !defined(HAVE_BFILL)
-extern void bfill(gptr dst,uint len,pchar fill);
-#endif
-
-#if !defined(bzero) && !defined(HAVE_BZERO)
-extern void bzero(gptr dst,uint len);
-#endif
-
-#if !defined(bcmp) && !defined(HAVE_BCMP)
-extern int bcmp(const char *s1,const char *s2,uint len);
-#ifdef HAVE_purify
-extern int my_bcmp(const char *s1,const char *s2,uint len);
-#define bcmp(A,B,C) my_bcmp((A),(B),(C))
-#endif
-#endif
-
-#ifndef bmove512
-extern void bmove512(gptr dst,const gptr src,uint len);
-#endif
-
-#if !defined(HAVE_BMOVE) && !defined(bmove)
-extern void bmove(char *dst, const char *src,uint len);
-#endif
-
-extern void bmove_upp(char *dst,const char *src,uint len);
-extern void bchange(char *dst,uint old_len,const char *src,
- uint new_len,uint tot_len);
-extern void strappend(char *s,uint len,pchar fill);
-extern char *strend(const char *s);
-extern char *strcend(const char *, pchar);
-extern char *strfield(char *src,int fields,int chars,int blanks,
- int tabch);
-extern char *strfill(my_string s,uint len,pchar fill);
-extern uint strinstr(const char *str,const char *search);
-extern uint r_strinstr(reg1 my_string str,int from, reg4 my_string search);
-extern char *strkey(char *dst,char *head,char *tail,char *flags);
-extern char *strmake(char *dst,const char *src,uint length);
-#ifndef strmake_overlapp
-extern char *strmake_overlapp(char *dst,const char *src, uint length);
-#endif
-
-#ifndef strmov
-extern char *strmov(char *dst,const char *src);
-#endif
-extern char *strnmov(char *dst,const char *src,uint n);
-extern char *strsuff(const char *src,const char *suffix);
-extern char *strcont(const char *src,const char *set);
-extern char *strxcat _VARARGS((char *dst,const char *src, ...));
-extern char *strxmov _VARARGS((char *dst,const char *src, ...));
-extern char *strxcpy _VARARGS((char *dst,const char *src, ...));
-extern char *strxncat _VARARGS((char *dst,uint len, const char *src, ...));
-extern char *strxnmov _VARARGS((char *dst,uint len, const char *src, ...));
-extern char *strxncpy _VARARGS((char *dst,uint len, const char *src, ...));
-
-/* Prototypes of normal stringfunctions (with may ours) */
-
-#ifdef WANT_STRING_PROTOTYPES
-extern char *strcat(char *, const char *);
-extern char *strchr(const char *, pchar);
-extern char *strrchr(const char *, pchar);
-extern char *strcpy(char *, const char *);
-extern int strcmp(const char *, const char *);
-#ifndef __GNUC__
-extern size_t strlen(const char *);
-#endif
-#endif
-#ifndef HAVE_STRNLEN
-extern uint strnlen(const char *s, uint n);
-#endif
-
-#if !defined(__cplusplus)
-#ifndef HAVE_STRPBRK
-extern char *strpbrk(const char *, const char *);
-#endif
-#ifndef HAVE_STRSTR
-extern char *strstr(const char *, const char *);
-#endif
-#endif
-extern int is_prefix(const char *, const char *);
-
-/* Conversion rutins */
-
-#ifdef USE_MY_ITOA
-extern char *my_itoa(int val,char *dst,int radix);
-extern char *my_ltoa(long val,char *dst,int radix);
-#endif
-
-extern char *llstr(longlong value,char *buff);
-#ifndef HAVE_STRTOUL
-extern long strtol(const char *str, char **ptr, int base);
-extern ulong strtoul(const char *str, char **ptr, int base);
-#endif
-
-extern char *int2str(long val,char *dst,int radix);
-extern char *int10_to_str(long val,char *dst,int radix);
-extern char *str2int(const char *src,int radix,long lower,long upper,
- long *val);
-#if SIZEOF_LONG == SIZEOF_LONG_LONG
-#define longlong2str(A,B,C) int2str((A),(B),(C))
-#define longlong10_to_str(A,B,C) int10_to_str((A),(B),(C))
-#define strtoll(A,B,C) strtol((A),(B),(C))
-#define strtoull(A,B,C) strtoul((A),(B),(C))
-#ifndef HAVE_STRTOULL
-#define HAVE_STRTOULL
-#endif
-#else
-#ifdef HAVE_LONG_LONG
-extern char *longlong2str(longlong val,char *dst,int radix);
-extern char *longlong10_to_str(longlong val,char *dst,int radix);
-#if (!defined(HAVE_STRTOULL) || defined(HAVE_mit_thread)) || defined(NO_STRTOLL_PROTO)
-extern longlong strtoll(const char *str, char **ptr, int base);
-extern ulonglong strtoull(const char *str, char **ptr, int base);
-#endif
-#endif
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-#endif
diff --git a/ext/mysql/libmysql/mf_casecnv.c b/ext/mysql/libmysql/mf_casecnv.c
deleted file mode 100644
index 3b8e6c6a75..0000000000
--- a/ext/mysql/libmysql/mf_casecnv.c
+++ /dev/null
@@ -1,238 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-/*
- Functions to convert to lover_case and to upper_case in scandinavia.
-
- case_sort converts a character string to a representaion that can
- be compared by strcmp to find with is alfabetical bigger.
- (lower- and uppercase letters is compared as the same)
-*/
-
-#include "mysys_priv.h"
-#include <m_ctype.h>
-
- /* string to uppercase */
-
-void caseup_str(my_string str)
-{
-#ifdef USE_MB
- register uint32 l;
- register char *end=str+(uint) strlen(str);
- if (use_mb(default_charset_info))
- while (*str)
- {
- if ((l=my_ismbchar(default_charset_info, str,end))) str+=l;
- else *str=toupper(*str),++str;
- }
- else
-#endif
- while ((*str = toupper(*str)) != 0)
- str++;
-} /* caseup_str */
-
- /* string to lowercase */
-
-void casedn_str(my_string str)
-{
-#ifdef USE_MB
- register uint32 l;
- register char *end=str+(uint) strlen(str);
- if (use_mb(default_charset_info))
- while (*str)
- {
- if ((l=my_ismbchar(default_charset_info, str,end))) str+=l;
- else *str=tolower(*str),++str;
- }
- else
-#endif
- while ((*str= tolower(*str)) != 0)
- str++;
-} /* casedn_str */
-
-
- /* to uppercase */
-
-void caseup(my_string str, uint length)
-{
-#ifdef USE_MB
- register uint32 l;
- register char *end=str+length;
- if (use_mb(default_charset_info))
- while (str<end)
- {
- if ((l=my_ismbchar(default_charset_info, str,end))) str+=l;
- else *str=toupper(*str),++str;
- }
- else
-#endif
- for ( ; length>0 ; length--, str++)
- *str= toupper(*str);
-} /* caseup */
-
- /* to lowercase */
-
-void casedn(my_string str, uint length)
-{
-#ifdef USE_MB
- register uint32 l;
- register char *end=str+length;
- if (use_mb(default_charset_info))
- while (str<end)
- {
- if ((l=my_ismbchar(default_charset_info, str,end))) str+=l;
- else *str=tolower(*str),++str;
- }
- else
-#endif
- for ( ; length>0 ; length--, str++)
- *str= tolower(*str);
-} /* casedn */
-
- /* to sort-string that can be compared to get text in order */
-
-void case_sort(my_string str, uint length)
-{
- for ( ; length>0 ; length--, str++)
- *str= (char) my_sort_order[(uchar) *str];
-} /* case_sort */
-
- /* find string in another with no case_sensivity */
-
-/* ToDo: This function should be modified to support multibyte charset.
- However it is not used untill 3.23.5.
- Wei He (hewei@mail.ied.ac.cn)
-*/
-
-my_string my_strcasestr(const char *str, const char *search)
-{
- uchar *i,*j,*pos;
-
- pos=(uchar*) str;
-skipp:
- while (*pos != '\0')
- {
- if (toupper((uchar) *pos++) == toupper((uchar) *search))
- {
- i=(uchar*) pos; j=(uchar*) search+1;
- while (*j)
- if (toupper(*i++) != toupper(*j++)) goto skipp;
- return ((char*) pos-1);
- }
- }
- return ((my_string) 0);
-} /* strcstr */
-
-
- /* compare strings without regarding to case */
-
-int my_strcasecmp(const char *s, const char *t)
-{
-#ifdef USE_MB
- register uint32 l;
- register const char *end=s+(uint) strlen(s);
- if (use_mb(default_charset_info))
- {
- while (s<end)
- {
- if ((l=my_ismbchar(default_charset_info, s,end)))
- {
- while (l--)
- if (*s++ != *t++) return 1;
- }
- else if (my_ismbhead(default_charset_info, *t)) return 1;
- else if (toupper((uchar) *s++) != toupper((uchar) *t++)) return 1;
- }
- return *t;
- }
- else
-#endif
- {
- while (toupper((uchar) *s) == toupper((uchar) *t++))
- if (!*s++) return 0;
- return ((int) toupper((uchar) s[0]) - (int) toupper((uchar) t[-1]));
- }
-}
-
-
-int my_casecmp(const char *s, const char *t, uint len)
-{
-#ifdef USE_MB
- register uint32 l;
- register const char *end=s+len;
- if (use_mb(default_charset_info))
- {
- while (s<end)
- {
- if ((l=my_ismbchar(default_charset_info, s,end)))
- {
- while (l--)
- if (*s++ != *t++) return 1;
- }
- else if (my_ismbhead(default_charset_info, *t)) return 1;
- else if (toupper((uchar) *s++) != toupper((uchar) *t++)) return 1;
- }
- return 0;
- }
- else
-#endif
- {
- while (len-- != 0 && toupper(*s++) == toupper(*t++)) ;
- return (int) len+1;
- }
-}
-
-
-int my_strsortcmp(const char *s, const char *t)
-{
-#ifdef USE_STRCOLL
- if (use_strcoll(default_charset_info))
- return my_strcoll(default_charset_info, (uchar *)s, (uchar *)t);
- else
-#endif
- {
- while (my_sort_order[(uchar) *s] == my_sort_order[(uchar) *t++])
- if (!*s++) return 0;
- return ((int) my_sort_order[(uchar) s[0]] -
- (int) my_sort_order[(uchar) t[-1]]);
- }
-}
-
-int my_sortcmp(const char *s, const char *t, uint len)
-{
-#ifdef USE_STRCOLL
- if (use_strcoll(default_charset_info))
- return my_strnncoll(default_charset_info,
- (uchar *)s, len, (uchar *)t, len);
- else
-#endif
- {
- while (len--)
- {
- if (my_sort_order[(uchar) *s++] != my_sort_order[(uchar) *t++])
- return ((int) my_sort_order[(uchar) s[-1]] -
- (int) my_sort_order[(uchar) t[-1]]);
- }
- return 0;
- }
-}
-
-int my_sortncmp(const char *s, uint s_len, const char *t, uint t_len)
-{
-#ifdef USE_STRCOLL
- if (use_strcoll(default_charset_info))
- return my_strnncoll(default_charset_info,
- (uchar *)s, s_len, (uchar *)t, t_len);
- else
-#endif
- {
- uint len= min(s_len,t_len);
- while (len--)
- {
- if (my_sort_order[(uchar) *s++] != my_sort_order[(uchar) *t++])
- return ((int) my_sort_order[(uchar) s[-1]] -
- (int) my_sort_order[(uchar) t[-1]]);
- }
- return (int) (s_len - t_len);
- }
-}
diff --git a/ext/mysql/libmysql/mf_dirname.c b/ext/mysql/libmysql/mf_dirname.c
deleted file mode 100644
index f4a330ad1b..0000000000
--- a/ext/mysql/libmysql/mf_dirname.c
+++ /dev/null
@@ -1,92 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-#include "mysys_priv.h"
-#include <m_string.h>
-
- /* Functions definied in this file */
-
-uint dirname_length(const char *name)
-{
- register my_string pos,gpos;
-#ifdef FN_DEVCHAR
- if ((pos=strrchr(name,FN_DEVCHAR)) == 0)
-#endif
- pos=(char*) name-1;
-
- gpos= pos++;
- for ( ; *pos ; pos++) /* Find last FN_LIBCHAR */
- if (*pos == FN_LIBCHAR || *pos == '/'
-#ifdef FN_C_AFTER_DIR
- || *pos == FN_C_AFTER_DIR || *pos == FN_C_AFTER_DIR_2
-#endif
- )
- gpos=pos;
- return ((uint) (uint) (gpos+1-(char*) name));
-}
-
-
- /* Gives directory part of filename. Directory ends with '/' */
- /* Returns length of directory part */
-
-uint dirname_part(my_string to, const char *name)
-{
- uint length;
- DBUG_ENTER("dirname_part");
- DBUG_PRINT("enter",("'%s'",name));
-
- length=dirname_length(name);
- (void) strmake(to,(char*) name,min(length,FN_REFLEN-2));
- convert_dirname(to); /* Convert chars */
- DBUG_RETURN(length);
-} /* dirname */
-
-
- /* convert dirname to use under this system */
- /* If MSDOS converts '/' to '\' */
- /* If VMS converts '<' to '[' and '>' to ']' */
- /* Adds a '/' to end if there isn't one and the last isn't a dev_char */
- /* ARGSUSED */
-
-#ifndef FN_DEVCHAR
-#define FN_DEVCHAR '\0' /* For easier code */
-#endif
-
-char *convert_dirname(my_string to)
-{
- reg1 char *pos;
-#ifdef FN_UPPER_CASE
- caseup_str(to);
-#endif
-#ifdef FN_LOWER_CASE
- casedn_str(to);
-#endif
-#if FN_LIBCHAR != '/'
- {
- pos=to-1; /* Change from '/' */
- while ((pos=strchr(pos+1,'/')) != 0)
- *pos=FN_LIBCHAR;
- }
-#endif
-#ifdef FN_C_BEFORE_DIR_2
- {
- for (pos=to ; *pos ; pos++)
- {
- if (*pos == FN_C_BEFORE_DIR_2)
- *pos=FN_C_BEFORE_DIR;
- if (*pos == FN_C_AFTER_DIR_2)
- *pos=FN_C_AFTER_DIR;
- }
- }
-#else
- { /* Append FN_LIBCHAR if not there */
- pos=strend(to);
- if (pos != to && (pos[-1] != FN_LIBCHAR && pos[-1] != FN_DEVCHAR))
- {
- *pos++=FN_LIBCHAR;
- *pos=0;
- }
- }
-#endif
- return pos; /* Pointer to end of dir */
-} /* convert_dirname */
diff --git a/ext/mysql/libmysql/mf_fn_ext.c b/ext/mysql/libmysql/mf_fn_ext.c
deleted file mode 100644
index 71a10108b7..0000000000
--- a/ext/mysql/libmysql/mf_fn_ext.c
+++ /dev/null
@@ -1,32 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-/* Returnerar en pekare till filnamnets extension. */
-
-#include "mysys_priv.h"
-#include <m_string.h>
-
- /* Return a pointerto the extension of the filename
- The pointer points at the extension character (normally '.'))
- If there isn't any extension, the pointer points at the end
- NULL of the filename
- */
-
-my_string fn_ext(const char *name)
-{
- register my_string pos,gpos;
- DBUG_ENTER("fn_ext");
- DBUG_PRINT("mfunkt",("name: '%s'",name));
-
-#if defined(FN_DEVCHAR) || defined(FN_C_AFTER_DIR)
- {
- char buff[FN_REFLEN];
- gpos=(my_string) name+dirname_part(buff,(char*) name);
- }
-#else
- if (!(gpos=strrchr(name,FNLIBCHAR)))
- gpos=name;
-#endif
- pos=strrchr(gpos,FN_EXTCHAR);
- DBUG_RETURN (pos ? pos : strend(gpos));
-} /* fn_ext */
diff --git a/ext/mysql/libmysql/mf_format.c b/ext/mysql/libmysql/mf_format.c
deleted file mode 100644
index 21ba545797..0000000000
--- a/ext/mysql/libmysql/mf_format.c
+++ /dev/null
@@ -1,142 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-#include "mysys_priv.h"
-#include <m_string.h>
-#ifdef HAVE_REALPATH
-#include <sys/param.h>
-#include <sys/stat.h>
-#endif
-
- /* format a filename with replace of library and extension */
- /* params to and name may be identicall */
- /* function doesn't change name if name != to */
- /* Flag may be: 1 replace filenames library with 'dsk' */
- /* 2 replace extension with 'form' */
- /* 4 Unpack filename (replace ~ with home) */
- /* 8 Pack filename as short as possibly */
- /* 16 Resolve symbolic links for filename */
- /* 32 Resolve filename to full path */
- /* 64 Return NULL if too long path */
-
-#ifdef SCO
-#define BUFF_LEN 4097
-#else
-#ifdef MAXPATHLEN
-#define BUFF_LEN MAXPATHLEN
-#else
-#define BUFF_LEN FN_LEN
-#endif
-#endif
-
-my_string fn_format(my_string to, const char *name, const char *dsk,
- const char *form, int flag)
-{
- reg1 uint length;
- char dev[FN_REFLEN], buff[BUFF_LEN], *pos, *startpos;
- const char *ext;
- DBUG_ENTER("fn_format");
- DBUG_PRINT("enter",("name: %s dsk: %s form: %s flag: %d",
- name,dsk,form,flag));
-
- /* Kopiera & skippa enheten */
- name+=(length=dirname_part(dev,(startpos=(my_string) name)));
- if (length == 0 || flag & 1)
- {
- (void) strmake(dev,dsk, sizeof(dev) - 2);
- /* Use given directory */
- convert_dirname(dev); /* Fix to this OS */
- }
- if (flag & 8)
- pack_dirname(dev,dev); /* Put in ./.. and ~/.. */
- if (flag & 4)
- (void) unpack_dirname(dev,dev); /* Replace ~/.. with dir */
- if ((pos=strchr(name,FN_EXTCHAR)) != NullS)
- {
- if ((flag & 2) == 0) /* Skall vi byta extension ? */
- {
- length=strlength(name); /* Old extension */
- ext = "";
- }
- else
- {
- length=(uint) (pos-(char*) name); /* Change extension */
- ext= form;
- }
- }
- else
- {
- length=strlength(name); /* Har ingen ext- tag nya */
- ext=form;
- }
-
- if (strlen(dev)+length+strlen(ext) >= FN_REFLEN || length >= FN_LEN )
- { /* To long path, return original */
- uint tmp_length;
- if (flag & 64)
- return 0;
- tmp_length=strlength(startpos);
- DBUG_PRINT("error",("dev: '%s' ext: '%s' length: %d",dev,ext,length));
- (void) strmake(to,startpos,min(tmp_length,FN_REFLEN-1));
- }
- else
- {
- if (to == startpos)
- {
- bmove(buff,(char*) name,length); /* Save name for last copy */
- name=buff;
- }
- pos=strmake(strmov(to,dev),name,length);
-#ifdef FN_UPPER_CASE
- caseup_str(to);
-#endif
-#ifdef FN_LOWER_CASE
- casedn_str(to);
-#endif
- (void) strmov(pos,ext); /* Don't convert extension */
- }
- /* Purify gives a lot of UMR errors when using realpath */
-#if defined(HAVE_REALPATH) && !defined(HAVE_purify) && !defined(HAVE_BROKEN_REALPATH)
- if (flag & 16)
- {
- struct stat stat_buff;
- if (flag & 32 || (!lstat(to,&stat_buff) && S_ISLNK(stat_buff.st_mode)))
- {
- if (realpath(to,buff))
- strmake(to,buff,FN_REFLEN-1);
- }
- }
-#endif
- DBUG_RETURN (to);
-} /* fn_format */
-
-
- /*
- strlength(const string str)
- Return length of string with end-space:s not counted.
- */
-
-size_s strlength(const char *str)
-{
- reg1 my_string pos;
- reg2 my_string found;
- DBUG_ENTER("strlength");
-
- pos=found=(char*) str;
-
- while (*pos)
- {
- if (*pos != ' ')
- {
- while (*++pos && *pos != ' ') {};
- if (!*pos)
- {
- found=pos; /* String ends here */
- break;
- }
- }
- found=pos;
- while (*++pos == ' ') {};
- }
- DBUG_RETURN((size_s) (found-(char*) str));
-} /* strlength */
diff --git a/ext/mysql/libmysql/mf_loadpath.c b/ext/mysql/libmysql/mf_loadpath.c
deleted file mode 100644
index 4a1c250b3d..0000000000
--- a/ext/mysql/libmysql/mf_loadpath.c
+++ /dev/null
@@ -1,40 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-#include "mysys_priv.h"
-#include <m_string.h>
-
- /* Returns full load-path for a file. to may be = path */
- /* if path is a hard-path return path */
- /* if path starts with home-dir return path */
- /* if path starts with current dir or parent-dir unpack path */
- /* if there is no path, prepend with own_path_prefix if given */
- /* else unpack path according to current dir */
-
-my_string my_load_path(my_string to, const char *path,
- const char *own_path_prefix)
-{
- char buff[FN_REFLEN];
- DBUG_ENTER("my_load_path");
- DBUG_PRINT("enter",("path: %s prefix: %s",path,
- own_path_prefix ? own_path_prefix : ""));
-
- if ((path[0] == FN_HOMELIB && path[1] == FN_LIBCHAR) ||
- test_if_hard_path(path))
- VOID(strmov(buff,path));
- else if ((path[0] == FN_CURLIB && path[1] == FN_LIBCHAR) ||
- (is_prefix((gptr) path,FN_PARENTDIR) &&
- path[strlen(FN_PARENTDIR)] == FN_LIBCHAR) ||
- ! own_path_prefix)
- {
- if (! my_getwd(buff,(uint) (FN_REFLEN-strlen(path)),MYF(0)))
- VOID(strcat(buff,path));
- else
- VOID(strmov(buff,path));
- }
- else
- VOID(strxmov(buff,own_path_prefix,path,NullS));
- strmov(to,buff);
- DBUG_PRINT("exit",("to: %s",to));
- DBUG_RETURN(to);
-} /* my_load_path */
diff --git a/ext/mysql/libmysql/mf_pack.c b/ext/mysql/libmysql/mf_pack.c
deleted file mode 100644
index b6b079bdac..0000000000
--- a/ext/mysql/libmysql/mf_pack.c
+++ /dev/null
@@ -1,518 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-#include "mysys_priv.h"
-#include <m_string.h>
-#ifdef HAVE_PWD_H
-#include <pwd.h>
-#endif
-#ifdef VMS
-#include <rms.h>
-#include <iodef.h>
-#include <descrip.h>
-#endif /* VMS */
-
-static my_string NEAR_F expand_tilde(my_string *path);
-
- /* Pack a dirname ; Changes HOME to ~/ and current dev to ./ */
- /* from is a dirname (from dirname() ?) ending with FN_LIBCHAR */
- /* to may be == from */
-
-void pack_dirname(my_string to, const char *from)
-{
- int cwd_err;
- uint d_length,length,buff_length;
- my_string start;
- char buff[FN_REFLEN];
- DBUG_ENTER("pack_dirname");
-
- (void) intern_filename(to,from); /* Change to intern name */
-
-#ifdef FN_DEVCHAR
- if ((start=strrchr(to,FN_DEVCHAR)) != 0) /* Skipp device part */
- start++;
- else
-#endif
- start=to;
-
- LINT_INIT(buff_length);
- if (!(cwd_err= my_getwd(buff,FN_REFLEN,MYF(0))))
- {
- buff_length= (uint) strlen(buff);
- d_length=(uint) (start-to);
- if ((start == to ||
- (buff_length == d_length && !bcmp(buff,start,d_length))) &&
- *start != FN_LIBCHAR && *start)
- { /* Put current dir before */
- bchange(to,d_length,buff,buff_length,(uint) strlen(to)+1);
- }
- }
-
- if ((d_length= cleanup_dirname(to,to)) != 0)
- {
- length=0;
- if (home_dir)
- {
- length= (uint) strlen(home_dir);
- if (home_dir[length-1] == FN_LIBCHAR)
- length--; /* Don't test last '/' */
- }
- if (length > 1 && length < d_length)
- { /* test if /xx/yy -> ~/yy */
- if (bcmp(to,home_dir,length) == 0 && to[length] == FN_LIBCHAR)
- {
- to[0]=FN_HOMELIB; /* Filename begins with ~ */
- (void) strmov_overlapp(to+1,to+length);
- }
- }
- if (! cwd_err)
- { /* Test if cwd is ~/... */
- if (length > 1 && length < buff_length)
- {
- if (bcmp(buff,home_dir,length) == 0 && buff[length] == FN_LIBCHAR)
- {
- buff[0]=FN_HOMELIB;
- (void) strmov_overlapp(buff+1,buff+length);
- }
- }
- if (is_prefix(to,buff))
- {
- length= (uint) strlen(buff);
- if (to[length])
- (void) strmov_overlapp(to,to+length); /* Remove everything before */
- else
- {
- to[0]= FN_CURLIB; /* Put ./ instead of cwd */
- to[1]= FN_LIBCHAR;
- to[2]= '\0';
- }
- }
- }
- }
- DBUG_PRINT("exit",("to: '%s'",to));
- DBUG_VOID_RETURN;
-} /* pack_dirname */
-
-
- /* remove unwanted chars from dirname */
- /* if "/../" removes prev dir; "/~/" removes all before ~ */
- /* "//" is same as "/", except on Win32 at start of a file */
- /* "/./" is removed */
- /* Unpacks home_dir if "~/.." used */
- /* Unpacks current dir if if "./.." used */
-
-uint cleanup_dirname(register my_string to, const char *from)
- /* to may be == from */
-
-{
- reg5 uint length;
- reg2 my_string pos;
- reg3 my_string from_ptr;
- reg4 my_string start;
- char parent[5], /* for "FN_PARENTDIR" */
- buff[FN_REFLEN+1],*end_parentdir;
- DBUG_ENTER("cleanup_dirname");
- DBUG_PRINT("enter",("from: '%s'",from));
-
- start=buff;
- from_ptr=(my_string) from;
-#ifdef FN_DEVCHAR
- if ((pos=strrchr(from_ptr,FN_DEVCHAR)) != 0)
- { /* Skipp device part */
- length=(uint) (pos-from_ptr)+1;
- start=strnmov(buff,from_ptr,length); from_ptr+=length;
- }
-#endif
-
- parent[0]=FN_LIBCHAR;
- length=(uint) (strmov(parent+1,FN_PARENTDIR)-parent);
- for (pos=start ; (*pos= *from_ptr++) != 0 ; pos++)
- {
- if (*pos == '/')
- *pos = FN_LIBCHAR;
- if (*pos == FN_LIBCHAR)
- {
- if ((uint) (pos-start) > length && bcmp(pos-length,parent,length) == 0)
- { /* If .../../; skipp prev */
- pos-=length;
- if (pos != start)
- { /* not /../ */
- pos--;
- if (*pos == FN_HOMELIB && (pos == start || pos[-1] == FN_LIBCHAR))
- {
- if (!home_dir)
- {
- pos+=length+1; /* Don't unpack ~/.. */
- continue;
- }
- pos=strmov(buff,home_dir)-1; /* Unpacks ~/.. */
- if (*pos == FN_LIBCHAR)
- pos--; /* home ended with '/' */
- }
- if (*pos == FN_CURLIB && (pos == start || pos[-1] == FN_LIBCHAR))
- {
- if (my_getwd(curr_dir,FN_REFLEN,MYF(0)))
- {
- pos+=length+1; /* Don't unpack ./.. */
- continue;
- }
- pos=strmov(buff,curr_dir)-1; /* Unpacks ./.. */
- if (*pos == FN_LIBCHAR)
- pos--; /* home ended with '/' */
- }
- end_parentdir=pos;
- while (pos >= start && *pos != FN_LIBCHAR) /* remove prev dir */
- pos--;
- if (pos[1] == FN_HOMELIB || bcmp(pos,parent,length) == 0)
- { /* Don't remove ~user/ */
- pos=strmov(end_parentdir+1,parent);
- *pos=FN_LIBCHAR;
- continue;
- }
- }
- }
- else if ((uint) (pos-start) == length-1 &&
- !bcmp(start,parent+1,length-1))
- start=pos; /* Starts with "../" */
- else if (pos-start > 0 && pos[-1] == FN_LIBCHAR)
- {
-#ifdef FN_NETWORK_DRIVES
- if (pos-start != 1)
-#endif
- pos--; /* Remove dupplicate '/' */
- }
- else if (pos-start > 1 && pos[-1] == FN_CURLIB && pos[-2] == FN_LIBCHAR)
- pos-=2; /* Skipp /./ */
- else if (pos > buff+1 && pos[-1] == FN_HOMELIB && pos[-2] == FN_LIBCHAR)
- { /* Found ..../~/ */
- buff[0]=FN_HOMELIB;
- buff[1]=FN_LIBCHAR;
- start=buff; pos=buff+1;
- }
- }
- }
- (void) strmov(to,buff);
- DBUG_PRINT("exit",("to: '%s'",to));
- DBUG_RETURN((uint) (pos-buff));
-} /* cleanup_dirname */
-
-
- /*
- On system where you don't have symbolic links, the following
- code will allow you to create a file:
- directory-name.lnk that should contain the real path
- to the directory. This will be used if the directory name
- doesn't exists
- */
-
-
-my_bool my_use_symdir=0; /* Set this if you want to use symdirs */
-
-#ifdef USE_SYMDIR
-void symdirget(char *dir)
-{
- char buff[FN_REFLEN];
- char *pos=strend(dir);
- if (dir[0] && pos[-1] != FN_DEVCHAR && access(dir, F_OK))
- {
- FILE *fp;
- char temp= *(--pos); /* May be "/" or "\" */
- strmov(pos,".sym");
- fp = my_fopen(dir, O_RDONLY,MYF(0));
- *pos++=temp; *pos=0; /* Restore old filename */
- if (fp)
- {
- if (fgets(buff, sizeof(buff)-1, fp))
- {
- for (pos=strend(buff);
- pos > buff && (iscntrl(pos[-1]) || isspace(pos[-1])) ;
- pos --);
-
- /* Ensure that the symlink ends with the directory symbol */
- if (pos == buff || pos[-1] != FN_LIBCHAR)
- *pos++=FN_LIBCHAR;
-
- strmake(dir,buff, (uint) (pos-buff));
- }
- my_fclose(fp,MYF(0));
- }
- }
-}
-#endif /* USE_SYMDIR */
-
- /* Unpacks dirname to name that can be used by open... */
- /* Make that last char of to is '/' if from not empty and
- from doesn't end in FN_DEVCHAR */
- /* Uses cleanup_dirname and changes ~/.. to home_dir/.. */
- /* Returns length of new directory */
-
-uint unpack_dirname(my_string to, const char *from)
-
- /* to may be == from */
-{
- uint length,h_length;
- char buff[FN_REFLEN+1+4],*suffix,*tilde_expansion;
- DBUG_ENTER("unpack_dirname");
-
- (void) intern_filename(buff,from); /* Change to intern name */
- length= (uint) strlen(buff); /* Fix that '/' is last */
- if (length &&
-#ifdef FN_DEVCHAR
- buff[length-1] != FN_DEVCHAR &&
-#endif
- buff[length-1] != FN_LIBCHAR && buff[length-1] != '/')
- {
- buff[length]=FN_LIBCHAR;
- buff[length+1]= '\0';
- }
-
- length=cleanup_dirname(buff,buff);
- if (buff[0] == FN_HOMELIB)
- {
- suffix=buff+1; tilde_expansion=expand_tilde(&suffix);
- if (tilde_expansion)
- {
- length-=(uint) (suffix-buff)-1;
- if (length+(h_length= (uint) strlen(tilde_expansion)) <= FN_REFLEN)
- {
- if (tilde_expansion[h_length-1] == FN_LIBCHAR)
- h_length--;
- if (buff+h_length < suffix)
- bmove(buff+h_length,suffix,length);
- else
- bmove_upp(buff+h_length+length,suffix+length,length);
- bmove(buff,tilde_expansion,h_length);
- }
- }
- }
-#ifdef USE_SYMDIR
- if (my_use_symdir)
- symdirget(buff);
-#endif
- DBUG_RETURN(system_filename(to,buff)); /* Fix for open */
-} /* unpack_dirname */
-
-
- /* Expand tilde to home or user-directory */
- /* Path is reset to point at FN_LIBCHAR after ~xxx */
-
-static my_string NEAR_F expand_tilde(my_string *path)
-{
- if (path[0][0] == FN_LIBCHAR)
- return home_dir; /* ~/ expanded to home */
-#ifdef HAVE_GETPWNAM
- {
- char *str,save;
- struct passwd *user_entry;
-
- if (!(str=strchr(*path,FN_LIBCHAR)))
- str=strend(*path);
- save= *str; *str= '\0';
- user_entry=getpwnam(*path);
- *str=save;
- endpwent();
- if (user_entry)
- {
- *path=str;
- return user_entry->pw_dir;
- }
- }
-#endif
- return (my_string) 0;
-}
-
- /* fix filename so it can be used by open, create .. */
- /* to may be == from */
- /* Returns to */
-
-my_string unpack_filename(my_string to, const char *from)
-{
- uint length,n_length;
- char buff[FN_REFLEN];
- DBUG_ENTER("unpack_filename");
-
- length=dirname_part(buff,from); /* copy & convert dirname */
- n_length=unpack_dirname(buff,buff);
- if (n_length+strlen(from+length) < FN_REFLEN)
- {
- (void) strmov(buff+n_length,from+length);
- (void) system_filename(to,buff); /* Fix to usably filename */
- }
- else
- (void) system_filename(to,from); /* Fix to usably filename */
- DBUG_RETURN(to);
-} /* unpack_filename */
-
-
- /* Convert filename (unix standard) to system standard */
- /* Used before system command's like open(), create() .. */
- /* Returns to */
-
-uint system_filename(my_string to, const char *from)
-{
-#ifndef FN_C_BEFORE_DIR
- return (uint) (strmake(to,from,FN_REFLEN-1)-to);
-#else /* VMS */
-
- /* change 'dev:lib/xxx' to 'dev:[lib]xxx' */
- /* change 'dev:xxx' to 'dev:xxx' */
- /* change './xxx' to 'xxx' */
- /* change './lib/' or lib/ to '[.lib]' */
- /* change '/x/y/z to '[x.y]x' */
- /* change 'dev:/x' to 'dev:[000000]x' */
-
- int libchar_found,length;
- my_string to_pos,from_pos,pos;
- char buff[FN_REFLEN];
- DBUG_ENTER("system_filename");
-
- libchar_found=0;
- (void) strmov(buff,from); /* If to == from */
- from_pos= buff;
- if ((pos=strrchr(from_pos,FN_DEVCHAR))) /* Skipp device part */
- {
- pos++;
- to_pos=strnmov(to,from_pos,(size_s) (pos-from_pos));
- from_pos=pos;
- }
- else
- to_pos=to;
-
- if (from_pos[0] == FN_CURLIB && from_pos[1] == FN_LIBCHAR)
- from_pos+=2; /* Skipp './' */
- if (strchr(from_pos,FN_LIBCHAR))
- {
- *(to_pos++) = FN_C_BEFORE_DIR;
- if (strinstr(from_pos,FN_ROOTDIR) == 1)
- {
- from_pos+=strlen(FN_ROOTDIR); /* Actually +1 but... */
- if (! strchr(from_pos,FN_LIBCHAR))
- { /* No dir, use [000000] */
- to_pos=strmov(to_pos,FN_C_ROOT_DIR);
- libchar_found++;
- }
- }
- else
- *(to_pos++)=FN_C_DIR_SEP; /* '.' gives current dir */
-
- while ((pos=strchr(from_pos,FN_LIBCHAR)))
- {
- if (libchar_found++)
- *(to_pos++)=FN_C_DIR_SEP; /* Add '.' between dirs */
- if (strinstr(from_pos,FN_PARENTDIR) == 1 &&
- from_pos+strlen(FN_PARENTDIR) == pos)
- to_pos=strmov(to_pos,FN_C_PARENT_DIR); /* Found '../' */
- else
- to_pos=strnmov(to_pos,from_pos,(size_s) (pos-from_pos));
- from_pos=pos+1;
- }
- *(to_pos++)=FN_C_AFTER_DIR;
- }
- length=(int) (strmov(to_pos,from_pos)-to);
- DBUG_PRINT("exit",("name: '%s'",to));
- DBUG_RETURN((uint) length);
-#endif
-} /* system_filename */
-
-
- /* Fix a filename to intern (UNIX format) */
-
-my_string intern_filename(my_string to, const char *from)
-{
-#ifndef VMS
- {
- uint length;
- char buff[FN_REFLEN];
- if (from == to)
- { /* Dirname may destroy from */
- strmov(buff,from);
- from=buff;
- }
- length=dirname_part(to,from); /* Copy dirname & fix chars */
- (void) strcat(to,from+length);
- return (to);
- }
-#else /* VMS */
-
- /* change 'dev:[lib]xxx' to 'dev:lib/xxx' */
- /* change 'dev:xxx' to 'dev:xxx' */
- /* change 'dev:x/y/[.lib]' to 'dev:x/y/lib/ */
- /* change '[.lib]' to './lib/' */
- /* change '[x.y]' or '[x.][y]' or '[x][.y]' to '/x/y/' */
- /* change '[000000.x] or [x.000000]' to '/x/' */
-
- int par_length,root_length;
- my_string pos,from_pos,to_pos,end_pos;
- char buff[FN_REFLEN];
-
- (void) strmov(buff,from);
- convert_dirname(buff); /* change '<>' to '[]' */
- from_pos=buff;
- if ((pos=strrchr(from_pos,FN_DEVCHAR))) /* Skipp device part */
- {
- pos++;
- to_pos=strnmov(to,from_pos,(size_s) (pos-from_pos));
- from_pos=pos;
- }
- else
- to_pos=to;
-
- root_length=strlen(FN_C_ROOT_DIR);
- if ((pos = strchr(from_pos,FN_C_BEFORE_DIR)) &&
- (end_pos = strrchr(pos+1,FN_C_AFTER_DIR)))
- {
- to_pos=strnmov(to_pos,from_pos,(size_s) (pos-from_pos));
- /* Copy all between ':' and '[' */
- from_pos=pos+1;
- if (strinstr(from_pos,FN_C_ROOT_DIR) == 1 &&
- (from_pos[root_length] == FN_C_DIR_SEP ||
- from_pos[root_length] == FN_C_AFTER_DIR))
- {
- from_pos+=root_length+1;
- }
- else if (*from_pos == FN_C_DIR_SEP)
- *(to_pos++) = FN_CURLIB; /* Set ./ first */
- *(to_pos++) = FN_LIBCHAR;
-
- par_length=strlen(FN_C_PARENT_DIR);
- pos=to_pos;
- for (; from_pos <= end_pos ; from_pos++)
- {
- switch (*from_pos) {
- case FN_C_DIR_SEP:
- case FN_C_AFTER_DIR:
- if (pos != to_pos)
- {
- if ((int) (to_pos-pos) == root_length &&
- is_suffix(pos,FN_C_ROOT_DIR))
- to_pos=pos; /* remove root-pos */
- else
- {
- *(to_pos++)=FN_LIBCHAR; /* Find lib */
- pos=to_pos;
- }
- }
- break;
- case FN_C_BEFORE_DIR:
- break;
- case '-': /* *(FN_C_PARENT_DIR): */
- if (to_pos[-1] == FN_LIBCHAR &&
- strncmp(from_pos,FN_C_PARENT_DIR,par_length) == 0)
- { /* Change '-' to '..' */
- to_pos=strmov(to_pos,FN_PARENTDIR);
- *(to_pos++)=FN_LIBCHAR;
- pos=to_pos;
- from_pos+=par_length-1;
- break;
- }
- /* Fall through */
- default:
- *(to_pos++)= *from_pos;
- break;
- }
- }
- }
- (void) strmov(to_pos,from_pos);
- return (to);
-#endif /* VMS */
-} /* intern_filename */
diff --git a/ext/mysql/libmysql/mf_path.c b/ext/mysql/libmysql/mf_path.c
deleted file mode 100644
index c81bfaee04..0000000000
--- a/ext/mysql/libmysql/mf_path.c
+++ /dev/null
@@ -1,106 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-#include "mysys_priv.h"
-#include <m_string.h>
-
-static char *find_file_in_path(char *to,const char *name);
-
- /* Finds where program can find it's files.
- pre_pathname is found by first locking at progname (argv[0]).
- if progname contains path the path is returned.
- else if progname is found in path, return it
- else if progname is given and POSIX environment variable "_" is set
- then path is taken from "_".
- If filename doesn't contain a path append MY_BASEDIR_VERSION or
- MY_BASEDIR if defined, else append "/my/running".
- own_path_name_part is concatinated to result.
- my_path puts result in to and returns to */
-
-my_string my_path(my_string to, const char *progname,
- const char *own_pathname_part)
-{
- my_string start,end,prog;
- DBUG_ENTER("my_path");
-
- start=to; /* Return this */
- if (progname && (dirname_part(to, progname) ||
- find_file_in_path(to,progname) ||
- ((prog=getenv("_")) != 0 && dirname_part(to,prog))))
- {
- VOID(intern_filename(to,to));
- if (!test_if_hard_path(to))
- {
- if (!my_getwd(curr_dir,FN_REFLEN,MYF(0)))
- bchange(to,0,curr_dir, (uint) strlen(curr_dir), (uint) strlen(to)+1);
- }
- }
- else
- {
- if ((end = getenv("MY_BASEDIR_VERSION")) == 0 &&
- (end = getenv("MY_BASEDIR")) == 0)
- {
-#ifdef DEFAULT_BASEDIR
- end= (char*) DEFAULT_BASEDIR;
-#else
- end= (char*) "/my/";
-#endif
- }
- VOID(intern_filename(to,end));
- to=strend(to);
- if (to != start && to[-1] != FN_LIBCHAR)
- *to++ = FN_LIBCHAR;
- VOID(strmov(to,own_pathname_part));
- }
- DBUG_PRINT("exit",("to: '%s'",start));
- DBUG_RETURN(start);
-} /* my_path */
-
-
- /* test if file without filename is found in path */
- /* Returns to if found and to has dirpart if found, else NullS */
-
-#if defined(MSDOS) || defined(__WIN__) || defined(__EMX__)
-#define F_OK 0
-#define PATH_SEP ';'
-#define PROGRAM_EXTENSION ".exe"
-#else
-#define PATH_SEP ':'
-#endif
-
-static char *find_file_in_path(char *to, const char *name)
-{
- char *path,*pos,dir[2];
- const char *ext="";
-
- if (!(path=getenv("PATH")))
- return NullS;
- dir[0]=FN_LIBCHAR; dir[1]=0;
-#ifdef PROGRAM_EXTENSION
- if (!fn_ext(name)[0])
- ext=PROGRAM_EXTENSION;
-#endif
-
- for (pos=path ; (pos=strchr(pos,PATH_SEP)) ; path= ++pos)
- {
- if (path != pos)
- {
- strxmov(strnmov(to,path,(uint) (pos-path)),dir,name,ext,NullS);
- if (!access(to,F_OK))
- {
- to[(uint) (pos-path)+1]=0; /* Return path only */
- return to;
- }
- }
- }
-#ifdef __WIN__
- to[0]=FN_CURLIB;
- strxmov(to+1,dir,name,ext,NullS);
- if (!access(to,F_OK)) /* Test in current dir */
- {
- to[2]=0; /* Leave ".\" */
- return to;
- }
-#endif
- return NullS; /* File not found */
-}
diff --git a/ext/mysql/libmysql/mf_unixpath.c b/ext/mysql/libmysql/mf_unixpath.c
deleted file mode 100644
index 79a99b4323..0000000000
--- a/ext/mysql/libmysql/mf_unixpath.c
+++ /dev/null
@@ -1,19 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-#include "mysys_priv.h"
-#include <m_string.h>
-
- /* convert filename to unix style filename */
- /* If MSDOS converts '\' to '/' */
-
-void to_unix_path(my_string to __attribute__((unused)))
-{
-#if FN_LIBCHAR != '/'
- {
- to--;
- while ((to=strchr(to+1,FN_LIBCHAR)) != 0)
- *to='/';
- }
-#endif
-}
diff --git a/ext/mysql/libmysql/mf_wcomp.c b/ext/mysql/libmysql/mf_wcomp.c
deleted file mode 100644
index 73e847f1c4..0000000000
--- a/ext/mysql/libmysql/mf_wcomp.c
+++ /dev/null
@@ -1,54 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-/* Funktions for comparing with wild-cards */
-
-#include "mysys_priv.h"
-
- /* Test if a string is "comparable" to a wild-card string */
- /* returns 0 if the strings are "comparable" */
-
-char wild_many='*';
-char wild_one='?';
-char wild_prefix=0;
-
-int wild_compare(register const char *str, register const char *wildstr)
-{
- reg3 int flag;
- DBUG_ENTER("wild_compare");
-
- while (*wildstr)
- {
- while (*wildstr && *wildstr != wild_many && *wildstr != wild_one)
- {
- if (*wildstr == wild_prefix && wildstr[1])
- wildstr++;
- if (*wildstr++ != *str++) DBUG_RETURN(1);
- }
- if (! *wildstr ) DBUG_RETURN (*str != 0);
- if (*wildstr++ == wild_one)
- {
- if (! *str++) DBUG_RETURN (1); /* One char; skipp */
- }
- else
- { /* Found '*' */
- if (!*wildstr) DBUG_RETURN(0); /* '*' as last char: OK */
- flag=(*wildstr != wild_many && *wildstr != wild_one);
- do
- {
- if (flag)
- {
- char cmp;
- if ((cmp= *wildstr) == wild_prefix && wildstr[1])
- cmp=wildstr[1];
- while (*str && *str != cmp)
- str++;
- if (!*str) DBUG_RETURN (1);
- }
- if (wild_compare(str,wildstr) == 0) DBUG_RETURN (0);
- } while (*str++ && wildstr[0] != wild_many);
- DBUG_RETURN(1);
- }
- }
- DBUG_RETURN (*str != '\0');
-} /* wild_compare */
diff --git a/ext/mysql/libmysql/mulalloc.c b/ext/mysql/libmysql/mulalloc.c
deleted file mode 100644
index 793858afd4..0000000000
--- a/ext/mysql/libmysql/mulalloc.c
+++ /dev/null
@@ -1,39 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
- /* Malloc many pointers at the same time */
- /* format myFlags,ptr,length,ptr,length ... until null ptr */
-
-#include "mysys_priv.h"
-#include <stdarg.h>
-
-gptr my_multi_malloc(myf myFlags, ...)
-{
- va_list args;
- char **ptr,*start,*res;
- uint tot_length,length;
- DBUG_ENTER("my_multi_malloc");
-
- va_start(args,myFlags);
- tot_length=0;
- while ((ptr=va_arg(args, char **)))
- {
- length=va_arg(args,uint);
- tot_length+=ALIGN_SIZE(length);
- }
- va_end(args);
-
- if (!(start=(char *) my_malloc(tot_length,myFlags)))
- DBUG_RETURN(0); /* purecov: inspected */
-
- va_start(args,myFlags);
- res=start;
- while ((ptr=va_arg(args, char **)))
- {
- *ptr=res;
- length=va_arg(args,uint);
- res+=ALIGN_SIZE(length);
- }
- va_end(args);
- DBUG_RETURN((gptr) start);
-}
diff --git a/ext/mysql/libmysql/my_alarm.h b/ext/mysql/libmysql/my_alarm.h
deleted file mode 100644
index b0fc91d74f..0000000000
--- a/ext/mysql/libmysql/my_alarm.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-/*
- File to include when we want to use alarm or a loop_counter to display
- some information when a program is running
-*/
-#ifndef _my_alarm_h
-#define _my_alarm_h
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-extern int volatile my_have_got_alarm;
-extern ulong my_time_to_wait_for_lock;
-
-#if defined(HAVE_ALARM) && !defined(NO_ALARM_LOOP)
-#include <signal.h>
-#define ALARM_VARIABLES uint alarm_old=0; \
- sig_return alarm_signal=0
-#define ALARM_INIT my_have_got_alarm=0 ; \
- alarm_old=(uint) alarm(MY_HOW_OFTEN_TO_ALARM); \
- alarm_signal=signal(SIGALRM,my_set_alarm_variable);
-#define ALARM_END VOID(signal(SIGALRM,alarm_signal)); \
- VOID(alarm(alarm_old));
-#define ALARM_TEST my_have_got_alarm
-#ifdef DONT_REMEMBER_SIGNAL
-#define ALARM_REINIT VOID(alarm(MY_HOW_OFTEN_TO_ALARM)); \
- VOID(signal(SIGALRM,my_set_alarm_variable));\
- my_have_got_alarm=0;
-#else
-#define ALARM_REINIT VOID(alarm((uint) MY_HOW_OFTEN_TO_ALARM)); \
- my_have_got_alarm=0;
-#endif /* DONT_REMEMBER_SIGNAL */
-#else
-#define ALARM_VARIABLES long alarm_pos=0,alarm_end_pos=MY_HOW_OFTEN_TO_WRITE-1
-#define ALARM_INIT
-#define ALARM_END
-#define ALARM_TEST (alarm_pos++ >= alarm_end_pos)
-#define ALARM_REINIT alarm_end_pos+=MY_HOW_OFTEN_TO_WRITE
-#endif /* HAVE_ALARM */
-
-#ifdef __cplusplus
-}
-#endif
-#endif
diff --git a/ext/mysql/libmysql/my_alloc.c b/ext/mysql/libmysql/my_alloc.c
deleted file mode 100644
index a33f86fa00..0000000000
--- a/ext/mysql/libmysql/my_alloc.c
+++ /dev/null
@@ -1,140 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-/* Routines to handle mallocing of results which will be freed the same time */
-
-#include <global.h>
-#include <my_sys.h>
-#include <m_string.h>
-
-void init_alloc_root(MEM_ROOT *mem_root, uint block_size, uint pre_alloc_size)
-{
- mem_root->free=mem_root->used=0;
- mem_root->min_malloc=32;
- mem_root->block_size=block_size-MALLOC_OVERHEAD-sizeof(USED_MEM)-8;
- mem_root->error_handler=0;
-#if !(defined(HAVE_purify) && defined(EXTRA_DEBUG))
- if (pre_alloc_size)
- {
- if ((mem_root->free = mem_root->pre_alloc=
- (USED_MEM*) my_malloc(pre_alloc_size+ ALIGN_SIZE(sizeof(USED_MEM)),
- MYF(0))))
- {
- mem_root->free->size=pre_alloc_size+ALIGN_SIZE(sizeof(USED_MEM));
- mem_root->free->left=pre_alloc_size;
- mem_root->free->next=0;
- }
- }
-#endif
-}
-
-gptr alloc_root(MEM_ROOT *mem_root,unsigned int Size)
-{
-#if defined(HAVE_purify) && defined(EXTRA_DEBUG)
- reg1 USED_MEM *next;
- Size+=ALIGN_SIZE(sizeof(USED_MEM));
-
- if (!(next = (USED_MEM*) my_malloc(Size,MYF(MY_WME))))
- {
- if (mem_root->error_handler)
- (*mem_root->error_handler)();
- return((gptr) 0); /* purecov: inspected */
- }
- next->next=mem_root->used;
- mem_root->used=next;
- return (gptr) (((char*) next)+ALIGN_SIZE(sizeof(USED_MEM)));
-#else
- uint get_size,max_left;
- gptr point;
- reg1 USED_MEM *next;
- reg2 USED_MEM **prev;
-
- Size= ALIGN_SIZE(Size);
- prev= &mem_root->free;
- max_left=0;
- for (next= *prev ; next && next->left < Size ; next= next->next)
- {
- if (next->left > max_left)
- max_left=next->left;
- prev= &next->next;
- }
- if (! next)
- { /* Time to alloc new block */
- get_size= Size+ALIGN_SIZE(sizeof(USED_MEM));
- if (max_left*4 < mem_root->block_size && get_size < mem_root->block_size)
- get_size=mem_root->block_size; /* Normal alloc */
-
- if (!(next = (USED_MEM*) my_malloc(get_size,MYF(MY_WME))))
- {
- if (mem_root->error_handler)
- (*mem_root->error_handler)();
- return((gptr) 0); /* purecov: inspected */
- }
- next->next= *prev;
- next->size= get_size;
- next->left= get_size-ALIGN_SIZE(sizeof(USED_MEM));
- *prev=next;
- }
- point= (gptr) ((char*) next+ (next->size-next->left));
- if ((next->left-= Size) < mem_root->min_malloc)
- { /* Full block */
- *prev=next->next; /* Remove block from list */
- next->next=mem_root->used;
- mem_root->used=next;
- }
- return(point);
-#endif
-}
-
- /* deallocate everything used by alloc_root */
-
-void free_root(MEM_ROOT *root, myf MyFlags)
-{
- reg1 USED_MEM *next,*old;
- DBUG_ENTER("free_root");
-
- if (!root)
- DBUG_VOID_RETURN; /* purecov: inspected */
- if (!(MyFlags & MY_KEEP_PREALLOC))
- root->pre_alloc=0;
-
- for ( next=root->used; next ;)
- {
- old=next; next= next->next ;
- if (old != root->pre_alloc)
- my_free((gptr) old,MYF(0));
- }
- for (next= root->free ; next ; )
- {
- old=next; next= next->next ;
- if (old != root->pre_alloc)
- my_free((gptr) old,MYF(0));
- }
- root->used=root->free=0;
- if (root->pre_alloc)
- {
- root->free=root->pre_alloc;
- root->free->left=root->pre_alloc->size-ALIGN_SIZE(sizeof(USED_MEM));
- root->free->next=0;
- }
- DBUG_VOID_RETURN;
-}
-
-
-char *strdup_root(MEM_ROOT *root,const char *str)
-{
- uint len= (uint) strlen(str)+1;
- char *pos;
- if ((pos=alloc_root(root,len)))
- memcpy(pos,str,len);
- return pos;
-}
-
-
-char *memdup_root(MEM_ROOT *root,const char *str,uint len)
-{
- char *pos;
- if ((pos=alloc_root(root,len)))
- memcpy(pos,str,len);
- return pos;
-}
diff --git a/ext/mysql/libmysql/my_compress.c b/ext/mysql/libmysql/my_compress.c
deleted file mode 100644
index 3aa7ba9491..0000000000
--- a/ext/mysql/libmysql/my_compress.c
+++ /dev/null
@@ -1,73 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-/* Written by Sinisa Milivojevic <sinisa@coresinc.com> */
-
-#include <global.h>
-#ifdef HAVE_COMPRESS
-#include <my_sys.h>
-#include <zlib.h>
-
-/*
-** This replaces the packet with a compressed packet
-** Returns 1 on error
-** *complen is 0 if the packet wasn't compressed
-*/
-
-my_bool my_compress(byte *packet, ulong *len, ulong *complen)
-{
- if (*len < MIN_COMPRESS_LENGTH)
- *complen=0;
- else
- {
- byte *compbuf=my_compress_alloc(packet,len,complen);
- if (!compbuf)
- return *complen ? 0 : 1;
- memcpy(packet,compbuf,*len);
- my_free(compbuf,MYF(MY_WME)); }
- return 0;
-}
-
-
-byte *my_compress_alloc(const byte *packet, ulong *len, ulong *complen)
-{
- byte *compbuf;
- *complen = *len * 120 / 100 + 12;
- if (!(compbuf = (byte *) my_malloc(*complen,MYF(MY_WME))))
- return 0; /* Not enough memory */
- if (compress((Bytef*) compbuf,(ulong *) complen, (Bytef*) packet,
- (uLong) *len ) != Z_OK)
- {
- my_free(compbuf,MYF(MY_WME));
- return 0;
- }
- if (*complen >= *len)
- {
- *complen=0;
- my_free(compbuf,MYF(MY_WME));
- return 0;
- }
- swap(ulong,*len,*complen); /* *len is now packet length */
- return compbuf;
-}
-
-
-my_bool my_uncompress (byte *packet, ulong *len, ulong *complen)
-{
- if (*complen) /* If compressed */
- {
- byte *compbuf = (byte *) my_malloc (*complen,MYF(MY_WME));
- if (!compbuf)
- return 1; /* Not enough memory */
- if (uncompress((Bytef*) compbuf, complen, (Bytef*) packet, *len) != Z_OK)
- { /* Probably wrong packet */
- my_free (compbuf,MYF(MY_WME));
- return 1;
- }
- *len = *complen;
- memcpy(packet,compbuf,*len);
- my_free(compbuf,MYF(MY_WME));
- }
- return 0;
-}
-#endif /* HAVE_COMPRESS */
diff --git a/ext/mysql/libmysql/my_config.h b/ext/mysql/libmysql/my_config.h
deleted file mode 100644
index ba354523f8..0000000000
--- a/ext/mysql/libmysql/my_config.h
+++ /dev/null
@@ -1,11 +0,0 @@
-#include <php_config.h>
-
-/* PHP might define ulong, but we want to use our own typedef */
-#ifdef ulong
-#undef ulong
-#endif
-
-/* The client doesn't use multiple charsets, so only the compiled-in
- default is really needed */
-#define SHAREDIR "NONEXISTENT"
-#define DEFAULT_CHARSET_HOME SHAREDIR
diff --git a/ext/mysql/libmysql/my_create.c b/ext/mysql/libmysql/my_create.c
deleted file mode 100644
index a0a24f6ad9..0000000000
--- a/ext/mysql/libmysql/my_create.c
+++ /dev/null
@@ -1,50 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-#define USES_TYPES
-#include "mysys_priv.h"
-#include <my_dir.h>
-#include "mysys_err.h"
-#include <errno.h>
-#if defined(MSDOS) || defined(__WIN__) || defined(__EMX__)
-#include <share.h>
-#endif
-
- /*
- ** Create a new file
- ** Arguments:
- ** Path-name of file
- ** Read | write on file (umask value)
- ** Read & Write on open file
- ** Special flags
- */
-
-
-File my_create(const char *FileName, int CreateFlags, int access_flags,
- myf MyFlags)
-{
- int fd;
- DBUG_ENTER("my_create");
- DBUG_PRINT("my",("Name: '%s' CreateFlags: %d AccessFlags: %d MyFlags: %d",
- FileName, CreateFlags, access_flags, MyFlags));
-
-#if !defined(NO_OPEN_3) && !defined(__EMX__)
- fd = open((my_string) FileName, access_flags | O_CREAT,
- CreateFlags ? CreateFlags : my_umask);
-#elif defined(VMS)
- fd = open((my_string) FileName, access_flags | O_CREAT, 0,
- "ctx=stm","ctx=bin");
-#elif defined(MSDOS) || defined(__WIN__) || defined(__EMX__)
- if (access_flags & O_SHARE)
- fd = sopen((my_string) FileName, access_flags | O_CREAT | O_BINARY,
- SH_DENYNO, MY_S_IREAD | MY_S_IWRITE);
- else
- fd = open((my_string) FileName, access_flags | O_CREAT | O_BINARY,
- MY_S_IREAD | MY_S_IWRITE);
-#else
- fd = open(FileName, access_flags);
-#endif
-
- DBUG_RETURN(my_register_filename(fd, FileName, FILE_BY_CREATE,
- EE_CANTCREATEFILE, MyFlags));
-} /* my_create */
diff --git a/ext/mysql/libmysql/my_delete.c b/ext/mysql/libmysql/my_delete.c
deleted file mode 100644
index f1ffada90f..0000000000
--- a/ext/mysql/libmysql/my_delete.c
+++ /dev/null
@@ -1,22 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-#include "mysys_priv.h"
-
-#include "mysys_err.h"
-
-int my_delete(const char *name, myf MyFlags)
-{
- int err;
- DBUG_ENTER("my_delete");
- DBUG_PRINT("my",("name %s MyFlags %d", name, MyFlags));
-
- if ((err = unlink(name)) == -1)
- {
- my_errno=errno;
- if (MyFlags & (MY_FAE+MY_WME))
- my_error(EE_DELETE,MYF(ME_BELL+ME_WAITTANG+(MyFlags & ME_NOINPUT)),
- name,errno);
- }
- DBUG_RETURN(err);
-} /* my_delete */
diff --git a/ext/mysql/libmysql/my_dir.h b/ext/mysql/libmysql/my_dir.h
deleted file mode 100644
index e0c79dadfe..0000000000
--- a/ext/mysql/libmysql/my_dir.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-#ifndef _my_dir_h
-#define _my_dir_h
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifndef MY_DIR_H
-#define MY_DIR_H
-
-#include <sys/stat.h>
-
- /* Defines for my_dir and my_stat */
-
-#define MY_S_IFMT S_IFMT /* type of file */
-#define MY_S_IFDIR S_IFDIR /* directory */
-#define MY_S_IFCHR S_IFCHR /* character special */
-#define MY_S_IFBLK S_IFBLK /* block special */
-#define MY_S_IFREG S_IFREG /* regular */
-#define MY_S_IFIFO S_IFIFO /* fifo */
-#define MY_S_ISUID S_ISUID /* set user id on execution */
-#define MY_S_ISGID S_ISGID /* set group id on execution */
-#define MY_S_ISVTX S_ISVTX /* save swapped text even after use */
-#define MY_S_IREAD S_IREAD /* read permission, owner */
-#define MY_S_IWRITE S_IWRITE /* write permission, owner */
-#define MY_S_IEXEC S_IEXEC /* execute/search permission, owner */
-
-#define MY_S_ISDIR(m) (((m) & MY_S_IFMT) == MY_S_IFDIR)
-#define MY_S_ISCHR(m) (((m) & MY_S_IFMT) == MY_S_IFCHR)
-#define MY_S_ISBLK(m) (((m) & MY_S_IFMT) == MY_S_IFBLK)
-#define MY_S_ISREG(m) (((m) & MY_S_IFMT) == MY_S_IFREG)
-#define MY_S_ISFIFO(m) (((m) & MY_S_IFMT) == MY_S_IFIFO)
-
-#define MY_DONT_SORT 512 /* my_lib; Don't sort files */
-#define MY_WANT_STAT 1024 /* my_lib; stat files */
-
- /* typedefs for my_dir & my_stat */
-
-#ifdef USE_MY_STAT_STRUCT
-
-typedef struct my_stat
-{
- dev_t st_dev; /* major & minor device numbers */
- ino_t st_ino; /* inode number */
- ushort st_mode; /* file permissons (& suid sgid .. bits) */
- short st_nlink; /* number of links to file */
- ushort st_uid; /* user id */
- ushort st_gid; /* group id */
- dev_t st_rdev; /* more major & minor device numbers (???) */
- off_t st_size; /* size of file */
- time_t st_atime; /* time for last read */
- time_t st_mtime; /* time for last contens modify */
- time_t st_ctime; /* time for last inode or contents modify */
-} MY_STAT;
-
-#else
-
-#define MY_STAT struct stat /* Orginal struct have what we need */
-
-#endif /* USE_MY_STAT_STRUCT */
-
-typedef struct fileinfo /* Struct returned from my_dir & my_stat */
-{
- char *name;
- MY_STAT mystat;
-} FILEINFO;
-
-typedef struct st_my_dir /* Struct returned from my_dir */
-{
- struct fileinfo *dir_entry;
- uint number_off_files;
-} MY_DIR;
-
-extern MY_DIR *my_dir(const char *path,myf MyFlags);
-extern void my_dirend(MY_DIR *buffer);
-extern MY_STAT *my_stat(const char *path, MY_STAT *stat_area, myf my_flags);
-extern int my_fstat(int filenr, MY_STAT *stat_area, myf MyFlags);
-
-#endif /* MY_DIR_H */
-
-#ifdef __cplusplus
-}
-#endif
-#endif
diff --git a/ext/mysql/libmysql/my_div.c b/ext/mysql/libmysql/my_div.c
deleted file mode 100644
index fc3ad59b4a..0000000000
--- a/ext/mysql/libmysql/my_div.c
+++ /dev/null
@@ -1,17 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-#include "mysys_priv.h"
-
-my_string my_filename(File fd)
-{
- DBUG_ENTER("my_filename");
- if (fd >= MY_NFILE)
- DBUG_RETURN((char*) "UNKNOWN");
- if (fd >= 0 && my_file_info[fd].type != UNOPEN)
- {
- DBUG_RETURN(my_file_info[fd].name);
- }
- else
- DBUG_RETURN((char*) "UNOPENED"); /* Debug message */
-}
diff --git a/ext/mysql/libmysql/my_error.c b/ext/mysql/libmysql/my_error.c
deleted file mode 100644
index 21dc3ec268..0000000000
--- a/ext/mysql/libmysql/my_error.c
+++ /dev/null
@@ -1,110 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-#include "mysys_priv.h"
-#include "mysys_err.h"
-#include <m_string.h>
-#include <stdarg.h>
-#include <m_ctype.h>
-
-/* Define some external variables for error handling */
-
-const char ** NEAR my_errmsg[MAXMAPS]={0,0,0,0};
-char NEAR errbuff[NRERRBUFFS][ERRMSGSIZE];
-
-/* Error message to user */
-/*VARARGS2*/
-
-int my_error(int nr,myf MyFlags, ...)
-{
- va_list ap;
- uint olen, plen;
- reg1 const char *tpos;
- reg2 char *endpos;
- char * par;
- char ebuff[ERRMSGSIZE+20];
- DBUG_ENTER("my_error");
-
- va_start(ap,MyFlags);
- DBUG_PRINT("my", ("nr: %d MyFlags: %d errno: %d", nr, MyFlags, errno));
-
- if (nr / ERRMOD == GLOB && my_errmsg[GLOB] == 0)
- init_glob_errs();
-
- olen=(uint) strlen(tpos=my_errmsg[nr / ERRMOD][nr % ERRMOD]);
- endpos=ebuff;
-
- while (*tpos)
- {
- if (tpos[0] != '%')
- {
- *endpos++= *tpos++; /* Copy ordinary char */
- olen++;
- continue;
- }
- if (*++tpos == '%') /* test if %% */
- {
- olen--;
- }
- else
- {
- /* Skipp if max size is used (to be compatible with printf) */
- while (isdigit(*tpos) || *tpos == '.' || *tpos == '-')
- tpos++;
- if (*tpos == 'l') /* Skipp 'l' argument */
- tpos++;
- if (*tpos == 's') /* String parameter */
- {
- par = va_arg(ap, char *);
- plen = (uint) strlen(par);
- if (olen + plen < ERRMSGSIZE+2) /* Replace if possible */
- {
- endpos=strmov(endpos,par);
- tpos++;
- olen+=plen-2;
- continue;
- }
- }
- else if (*tpos == 'd' || *tpos == 'u') /* Integer parameter */
- {
- register int iarg;
- iarg = va_arg(ap, int);
- if (*tpos == 'd')
- plen= (uint) (int2str((long) iarg,endpos, -10) - endpos);
- else
- plen= (uint) (int2str((long) (uint) iarg,endpos,10)- endpos);
- if (olen + plen < ERRMSGSIZE+2) /* Replace parameter if possible */
- {
- endpos+=plen;
- tpos++;
- olen+=plen-2;
- continue;
- }
- }
- }
- *endpos++='%'; /* % used as % or unknown code */
- }
- *endpos='\0'; /* End of errmessage */
- va_end(ap);
- DBUG_RETURN((*error_handler_hook)(nr, ebuff, MyFlags));
-}
-
- /* Error as printf */
-
-int my_printf_error (uint error, const char *format, myf MyFlags, ...)
-{
- va_list args;
- char ebuff[ERRMSGSIZE+20];
-
- va_start(args,MyFlags);
- (void) vsprintf (ebuff,format,args);
- va_end(args);
- return (*error_handler_hook)(error, ebuff, MyFlags);
-}
-
- /* Give message using error_handler_hook */
-
-int my_message(uint error, const char *str, register myf MyFlags)
-{
- return (*error_handler_hook)(error, str, MyFlags);
-}
diff --git a/ext/mysql/libmysql/my_fopen.c b/ext/mysql/libmysql/my_fopen.c
deleted file mode 100644
index 5e6cd6682a..0000000000
--- a/ext/mysql/libmysql/my_fopen.c
+++ /dev/null
@@ -1,160 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-#include "mysys_priv.h"
-#include "my_static.h"
-#include <errno.h>
-#include "mysys_err.h"
-
-static void make_ftype(my_string to,int flag);
-
- /* Open a file as stream */
-
-FILE *my_fopen(const char *FileName, int Flags, myf MyFlags)
- /* Path-name of file */
- /* Read | write .. */
- /* Special flags */
-{
- FILE *fd;
- char type[5];
- DBUG_ENTER("my_fopen");
- DBUG_PRINT("my",("Name: '%s' Flags: %d MyFlags: %d",
- FileName, Flags, MyFlags));
-
- make_ftype(type,Flags);
- if ((fd = fopen(FileName, type)) != 0)
- {
- /*
- The test works if MY_NFILE < 128. The problem is that fileno() is char
- on some OS (SUNOS). Actually the filename save isn't that important
- so we can ignore if this doesn't work.
- */
- if ((uint) fileno(fd) >= MY_NFILE)
- {
- thread_safe_increment(my_stream_opened,&THR_LOCK_open);
- DBUG_RETURN(fd); /* safeguard */
- }
- pthread_mutex_lock(&THR_LOCK_open);
- if ((my_file_info[fileno(fd)].name = (char*)
- my_strdup(FileName,MyFlags)))
- {
- my_stream_opened++;
- my_file_info[fileno(fd)].type = STREAM_BY_FOPEN;
- pthread_mutex_unlock(&THR_LOCK_open);
- DBUG_PRINT("exit",("stream: %lx",fd));
- DBUG_RETURN(fd);
- }
- pthread_mutex_unlock(&THR_LOCK_open);
- (void) my_fclose(fd,MyFlags);
- my_errno=ENOMEM;
- }
- else
- my_errno=errno;
- DBUG_PRINT("error",("Got error %d on open",my_errno));
- if (MyFlags & (MY_FFNF | MY_FAE | MY_WME))
- my_error((Flags & O_RDONLY) || (Flags == O_RDONLY ) ? EE_FILENOTFOUND :
- EE_CANTCREATEFILE,
- MYF(ME_BELL+ME_WAITTANG), FileName,my_errno);
- DBUG_RETURN((FILE*) 0);
-} /* my_fopen */
-
-
- /* Close a stream */
-
-int my_fclose(FILE *fd, myf MyFlags)
-{
- int err,file;
- DBUG_ENTER("my_fclose");
- DBUG_PRINT("my",("stream: %lx MyFlags: %d",fd, MyFlags));
-
- pthread_mutex_lock(&THR_LOCK_open);
- file=fileno(fd);
- if ((err = fclose(fd)) < 0)
- {
- my_errno=errno;
- if (MyFlags & (MY_FAE | MY_WME))
- my_error(EE_BADCLOSE, MYF(ME_BELL+ME_WAITTANG),
- my_filename(file),errno);
- }
- else
- my_stream_opened--;
- if ((uint) file < MY_NFILE && my_file_info[file].type != UNOPEN)
- {
- my_file_info[file].type = UNOPEN;
- my_free(my_file_info[file].name, MYF(MY_ALLOW_ZERO_PTR));
- }
- pthread_mutex_unlock(&THR_LOCK_open);
- DBUG_RETURN(err);
-} /* my_fclose */
-
-
- /* Make a stream out of a file handle */
- /* Name may be 0 */
-
-FILE *my_fdopen(File Filedes, const char *name, int Flags, myf MyFlags)
-{
- FILE *fd;
- char type[5];
- DBUG_ENTER("my_fdopen");
- DBUG_PRINT("my",("Fd: %d Flags: %d MyFlags: %d",
- Filedes, Flags, MyFlags));
-
- make_ftype(type,Flags);
- if ((fd = fdopen(Filedes, type)) == 0)
- {
- my_errno=errno;
- if (MyFlags & (MY_FAE | MY_WME))
- my_error(EE_CANT_OPEN_STREAM, MYF(ME_BELL+ME_WAITTANG),errno);
- }
- else
- {
- pthread_mutex_lock(&THR_LOCK_open);
- my_stream_opened++;
- if (Filedes < MY_NFILE)
- {
- if (my_file_info[Filedes].type != UNOPEN)
- {
- my_file_opened--; /* File is opened with my_open ! */
- }
- else
- {
- my_file_info[Filedes].name= my_strdup(name,MyFlags);
- }
- my_file_info[Filedes].type = STREAM_BY_FDOPEN;
- }
- pthread_mutex_unlock(&THR_LOCK_open);
- }
-
- DBUG_PRINT("exit",("stream: %lx",fd));
- DBUG_RETURN(fd);
-} /* my_fdopen */
-
-
- /* Make a filehandler-open-typestring from ordinary inputflags */
-
-static void make_ftype(register my_string to, register int flag)
-{
-#if FILE_BINARY /* If we have binary-files */
- reg3 int org_flag=flag;
-#endif
- flag&= ~FILE_BINARY; /* remove binary bit */
- if (flag == O_RDONLY)
- *to++= 'r';
- else if (flag == O_WRONLY)
- *to++= 'w';
- else
- { /* Add '+' after theese */
- if (flag == O_RDWR)
- *to++= 'r';
- else if (flag & O_APPEND)
- *to++= 'a';
- else
- *to++= 'w'; /* Create file */
- *to++= '+';
- }
-#if FILE_BINARY /* If we have binary-files */
- if (org_flag & FILE_BINARY)
- *to++='b';
-#endif
- *to='\0';
-} /* make_ftype */
diff --git a/ext/mysql/libmysql/my_getwd.c b/ext/mysql/libmysql/my_getwd.c
deleted file mode 100644
index 9e87c4d201..0000000000
--- a/ext/mysql/libmysql/my_getwd.c
+++ /dev/null
@@ -1,172 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-/* my_setwd() and my_getwd() works with intern_filenames !! */
-
-#include "mysys_priv.h"
-#include <m_string.h>
-#include "mysys_err.h"
-#ifdef HAVE_GETWD
-#include <sys/param.h>
-#endif
-#if defined(MSDOS) || defined(__WIN__)
-#include <m_ctype.h>
-#include <dos.h>
-#include <direct.h>
-#endif
-
-#ifdef __EMX__
-// chdir2 support also drive change
-#define chdir _chdir2
-#endif
-
- /* Gets current working directory in buff. Directory is allways ended
- with FN_LIBCHAR */
- /* One must pass a buffer to my_getwd. One can allways use
- curr_dir[] */
-
-int my_getwd(my_string buf, uint size, myf MyFlags)
-{
- my_string pos;
- DBUG_ENTER("my_getwd");
- DBUG_PRINT("my",("buf: %lx size: %d MyFlags %d", buf,size,MyFlags));
-
-#if ! defined(MSDOS)
- if (curr_dir[0]) /* Current pos is saved here */
- VOID(strmake(buf,&curr_dir[0],size-1));
- else
-#endif
- {
-#if defined(HAVE_GETCWD)
- if (!getcwd(buf,size-2) && MyFlags & MY_WME)
- {
- my_errno=errno;
- my_error(EE_GETWD,MYF(ME_BELL+ME_WAITTANG),errno);
- return(-1);
- }
-#elif defined(HAVE_GETWD)
- {
- char pathname[MAXPATHLEN];
- getwd(pathname);
- strmake(buf,pathname,size-1);
- }
-#elif defined(VMS)
- if (!getcwd(buf,size-2,1) && MyFlags & MY_WME)
- {
- my_errno=errno;
- my_error(EE_GETWD,MYF(ME_BELL+ME_WAITTANG),errno);
- return(-1);
- }
- intern_filename(buf,buf);
-#else
-#error "No way to get current directory"
-#endif
- if (*((pos=strend(buf))-1) != FN_LIBCHAR) /* End with FN_LIBCHAR */
- {
- pos[0]= FN_LIBCHAR;
- pos[1]=0;
- }
- (void) strmake(&curr_dir[0],buf,(size_s) (FN_REFLEN-1));
- }
- DBUG_RETURN(0);
-} /* my_getwd */
-
-
- /* Set new working directory */
-
-int my_setwd(const char *dir, myf MyFlags)
-{
- int res;
- size_s length;
- my_string start,pos;
-#if defined(VMS) || defined(MSDOS)
- char buff[FN_REFLEN];
-#endif
- DBUG_ENTER("my_setwd");
- DBUG_PRINT("my",("dir: '%s' MyFlags %d", dir, MyFlags));
-
- start=(my_string) dir;
-#if defined(MSDOS) /* MSDOS chdir can't change drive */
-#if !defined(_DDL) && !defined(WIN32)
- if ((pos=strchr(dir,FN_DEVCHAR)) != 0)
- {
- uint drive,drives;
-
- pos++; /* Skipp FN_DEVCHAR */
- drive=(uint) (toupper(dir[0])-'A'+1); drives= (uint) -1;
- if ((pos-(byte*) dir) == 2 && drive > 0 && drive < 32)
- {
- _dos_setdrive(drive,&drives);
- _dos_getdrive(&drives);
- }
- if (drive != drives)
- {
- *pos='\0'; /* Dir is now only drive */
- my_errno=errno;
- my_error(EE_SETWD,MYF(ME_BELL+ME_WAITTANG),dir,ENOENT);
- DBUG_RETURN(-1);
- }
- dir=pos; /* drive changed, change now path */
- }
-#endif
- if (*((pos=strend(dir)-1)) == FN_LIBCHAR && pos != dir)
- {
- strmov(buff,dir)[-1]=0; /* Remove last '/' */
- dir=buff;
- }
-#endif /* MSDOS*/
- if (! dir[0] || (dir[0] == FN_LIBCHAR && dir[1] == 0))
- dir=FN_ROOTDIR;
-#ifdef VMS
- {
- pos=strmov(buff,dir);
- if (pos[-1] != FN_LIBCHAR)
- {
- pos[0]=FN_LIBCHAR; /* Mark as directory */
- pos[1]=0;
- }
- system_filename(buff,buff); /* Change to VMS format */
- dir=buff;
- }
-#endif /* VMS */
- if ((res=chdir((char*) dir)) != 0)
- {
- my_errno=errno;
- if (MyFlags & MY_WME)
- my_error(EE_SETWD,MYF(ME_BELL+ME_WAITTANG),start,errno);
- }
- else
- {
- if (test_if_hard_path(start))
- { /* Hard pathname */
- pos=strmake(&curr_dir[0],start,(size_s) FN_REFLEN-1);
- if (pos[-1] != FN_LIBCHAR)
- {
- length=(uint) (pos-(char*) curr_dir);
- curr_dir[length]=FN_LIBCHAR; /* must end with '/' */
- curr_dir[length+1]='\0';
- }
- }
- else
- curr_dir[0]='\0'; /* Don't save name */
- }
- DBUG_RETURN(res);
-} /* my_setwd */
-
-
-
- /* Test if hard pathname */
- /* Returns 1 if dirname is a hard path */
-
-int test_if_hard_path(register const char *dir_name)
-{
- if (dir_name[0] == FN_HOMELIB && dir_name[1] == FN_LIBCHAR)
- return (home_dir != NullS && test_if_hard_path(home_dir));
- if (dir_name[0] == FN_LIBCHAR)
- return (TRUE);
-#ifdef FN_DEVCHAR
- return (strchr(dir_name,FN_DEVCHAR) != 0);
-#else
- return FALSE;
-#endif
-} /* test_if_hard_path */
diff --git a/ext/mysql/libmysql/my_init.c b/ext/mysql/libmysql/my_init.c
deleted file mode 100644
index 9bccb2c652..0000000000
--- a/ext/mysql/libmysql/my_init.c
+++ /dev/null
@@ -1,312 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-#include "mysys_priv.h"
-#include "my_static.h"
-#include "mysys_err.h"
-#include "m_ctype.h"
-#include <m_string.h>
-#include <m_ctype.h>
-#ifdef THREAD
-#include <my_pthread.h>
-#endif
-#ifdef HAVE_GETRUSAGE
-#include <sys/resource.h>
-/* extern int getrusage(int, struct rusage *); */
-#endif
-#include <signal.h>
-#ifdef VMS
-#include <my_static.c>
-#include <m_ctype.h>
-#endif
-#ifdef __WIN__
-#ifdef _MSC_VER
-#include <locale.h>
-#include <crtdbg.h>
-#endif
-my_bool have_tcpip=0;
-static void my_win_init(void);
-static my_bool win32_have_tcpip(void);
-static my_bool win32_init_tcp_ip();
-#else
-#define my_win_init()
-#endif
-static my_bool my_init_done=0;
-
-
-
-static ulong atoi_octal(const char *str)
-{
- long int tmp;
- while (*str && isspace(*str))
- str++;
- str2int(str,
- (*str == '0' ? 8 : 10), /* Octalt or decimalt */
- 0, INT_MAX, &tmp);
- return (ulong) tmp;
-}
-
-
- /* Init my_sys functions and my_sys variabels */
-
-void my_init(void)
-{
- my_string str;
- if (my_init_done)
- return;
- my_init_done=1;
-#ifdef THREAD
-#if defined(HAVE_PTHREAD_INIT)
- pthread_init(); /* Must be called before DBUG_ENTER */
-#endif
- my_thread_global_init();
-#ifndef __WIN__
- sigfillset(&my_signals); /* signals blocked by mf_brkhant */
-#endif
-#endif /* THREAD */
-#ifdef UNIXWARE_7
- (void) isatty(0); /* Go around connect() bug in UW7 */
-#endif
- {
- DBUG_ENTER("my_init");
- DBUG_PROCESS(my_progname ? my_progname : (char*) "unknown");
- if (!home_dir)
- { /* Don't initialize twice */
- my_win_init();
- if ((home_dir=getenv("HOME")) != 0)
- home_dir=intern_filename(home_dir_buff,home_dir);
-#ifndef VMS
- /* Default creation of new files */
- if ((str=getenv("UMASK")) != 0)
- my_umask=(int) (atoi_octal(str) | 0600);
- /* Default creation of new dir's */
- if ((str=getenv("UMASK_DIR")) != 0)
- my_umask_dir=(int) (atoi_octal(str) | 0700);
-#endif
-#ifdef VMS
- init_ctype(); /* Stupid linker don't link _ctype.c */
-#endif
- DBUG_PRINT("exit",("home: '%s'",home_dir));
- }
-#ifdef __WIN__
- win32_init_tcp_ip();
-#endif
- DBUG_VOID_RETURN;
- }
-} /* my_init */
-
-
- /* End my_sys */
-
-void my_end(int infoflag)
-{
- FILE *info_file;
- if (!(info_file=DBUG_FILE))
- info_file=stderr;
- if (infoflag & MY_CHECK_ERROR || info_file != stderr)
- { /* Test if some file is left open */
- if (my_file_opened | my_stream_opened)
- {
- sprintf(errbuff[0],EE(EE_OPEN_WARNING),my_file_opened,my_stream_opened);
- (void) my_message_no_curses(EE_OPEN_WARNING,errbuff[0],ME_BELL);
- DBUG_PRINT("error",("%s",errbuff[0]));
- }
- }
- if (infoflag & MY_GIVE_INFO || info_file != stderr)
- {
-#ifdef HAVE_GETRUSAGE
- struct rusage rus;
- if (!getrusage(RUSAGE_SELF, &rus))
- fprintf(info_file,"\n\
-User time %.2f, System time %.2f\n\
-Maximum resident set size %ld, Integral resident set size %ld\n\
-Non-physical pagefaults %ld, Physical pagefaults %ld, Swaps %ld\n\
-Blocks in %ld out %ld, Messages in %ld out %ld, Signals %ld\n\
-Voluntary context switches %ld, Involuntary context switches %ld\n",
- (rus.ru_utime.tv_sec * SCALE_SEC +
- rus.ru_utime.tv_usec / SCALE_USEC) / 100.0,
- (rus.ru_stime.tv_sec * SCALE_SEC +
- rus.ru_stime.tv_usec / SCALE_USEC) / 100.0,
- rus.ru_maxrss, rus.ru_idrss,
- rus.ru_minflt, rus.ru_majflt,
- rus.ru_nswap, rus.ru_inblock, rus.ru_oublock,
- rus.ru_msgsnd, rus.ru_msgrcv, rus.ru_nsignals,
- rus.ru_nvcsw, rus.ru_nivcsw);
-#endif
-#if defined(MSDOS) && !defined(__WIN__)
- fprintf(info_file,"\nRun time: %.1f\n",(double) clock()/CLOCKS_PER_SEC);
-#endif
- free_charsets();
-#if defined(SAFEMALLOC)
- TERMINATE(stderr); /* Give statistic on screen */
-#elif defined(__WIN__) && defined(_MSC_VER)
- _CrtSetReportMode( _CRT_WARN, _CRTDBG_MODE_FILE );
- _CrtSetReportFile( _CRT_WARN, _CRTDBG_FILE_STDERR );
- _CrtSetReportMode( _CRT_ERROR, _CRTDBG_MODE_FILE );
- _CrtSetReportFile( _CRT_ERROR, _CRTDBG_FILE_STDERR );
- _CrtSetReportMode( _CRT_ASSERT, _CRTDBG_MODE_FILE );
- _CrtSetReportFile( _CRT_ASSERT, _CRTDBG_FILE_STDERR );
- _CrtCheckMemory();
- _CrtDumpMemoryLeaks();
-#endif
- }
-#ifdef THREAD
- pthread_mutex_destroy(&THR_LOCK_keycache);
- pthread_mutex_destroy(&THR_LOCK_malloc);
- pthread_mutex_destroy(&THR_LOCK_open);
- DBUG_POP(); /* Must be done before my_thread_end */
- my_thread_end();
- my_thread_global_end();
-#endif
-#ifdef __WIN__
- if (have_tcpip);
- WSACleanup( );
-#endif /* __WIN__ */
- my_init_done=0;
-} /* my_end */
-
-#ifdef __WIN__
-
-/*
- This code is specially for running MySQL, but it should work in
- other cases too.
-
- Inizializzazione delle variabili d'ambiente per Win a 32 bit.
-
- Vengono inserite nelle variabili d'ambiente (utilizzando cosi'
- le funzioni getenv e putenv) i valori presenti nelle chiavi
- del file di registro:
-
- HKEY_LOCAL_MACHINE\software\MySQL
-
- Se la kiave non esiste nonn inserisce nessun valore
-*/
-
-/* Crea la stringa d'ambiente */
-
-void setEnvString(char *ret, const char *name, const char *value)
-{
- DBUG_ENTER("setEnvString");
- strxmov(ret, name,"=",value,NullS);
- DBUG_VOID_RETURN ;
-}
-
-static void my_win_init(void)
-{
- HKEY hSoftMysql ;
- DWORD dimName = 256 ;
- DWORD dimData = 1024 ;
- DWORD dimNameValueBuffer = 256 ;
- DWORD dimDataValueBuffer = 1024 ;
- DWORD indexValue = 0 ;
- long retCodeEnumValue ;
- char NameValueBuffer[256] ;
- char DataValueBuffer[1024] ;
- char EnvString[1271] ;
- const char *targetKey = "Software\\MySQL" ;
- DBUG_ENTER("my_win_init");
-
- setlocale(LC_CTYPE, ""); /* To get right sortorder */
-
- /* apre la chiave HKEY_LOCAL_MACHINES\software\MySQL */
- if (RegOpenKeyEx(HKEY_LOCAL_MACHINE,(LPCTSTR)targetKey,0,
- KEY_READ,&hSoftMysql) != ERROR_SUCCESS)
- DBUG_VOID_RETURN;
-
- /*
- ** Ne legge i valori e li inserisce nell'ambiente
- ** suppone che tutti i valori letti siano di tipo stringa + '\0'
- ** Legge il valore con indice 0 e lo scarta
- */
- retCodeEnumValue = RegEnumValue(hSoftMysql, indexValue++,
- (LPTSTR)NameValueBuffer, &dimNameValueBuffer,
- NULL, NULL, (LPBYTE)DataValueBuffer,
- &dimDataValueBuffer) ;
-
- while (retCodeEnumValue != ERROR_NO_MORE_ITEMS)
- {
- char *my_env;
- /* Crea la stringa d'ambiente */
- setEnvString(EnvString, NameValueBuffer, DataValueBuffer) ;
-
- /* Inserisce i dati come variabili d'ambiente */
- my_env=strdup(EnvString); /* variable for putenv must be allocated ! */
- putenv(EnvString) ;
-
- dimNameValueBuffer = dimName ;
- dimDataValueBuffer = dimData ;
-
- retCodeEnumValue = RegEnumValue(hSoftMysql, indexValue++,
- NameValueBuffer, &dimNameValueBuffer,
- NULL, NULL, (LPBYTE)DataValueBuffer,
- &dimDataValueBuffer) ;
- }
-
- /* chiude la chiave */
- RegCloseKey(hSoftMysql) ;
- DBUG_VOID_RETURN ;
-}
-
-
-/*------------------------------------------------------------------
-** Name: CheckForTcpip| Desc: checks if tcpip has been installed on system
-** According to Microsoft Developers documentation the first registry
-** entry should be enough to check if TCP/IP is installed, but as expected
-** this doesn't work on all Win32 machines :(
-------------------------------------------------------------------*/
-
-#define TCPIPKEY "SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters"
-#define WINSOCK2KEY "SYSTEM\\CurrentControlSet\\Services\\Winsock2\\Parameters"
-#define WINSOCKKEY "SYSTEM\\CurrentControlSet\\Services\\Winsock\\Parameters"
-
-static my_bool win32_have_tcpip(void)
-{
- HKEY hTcpipRegKey;
- if (RegOpenKeyEx ( HKEY_LOCAL_MACHINE, TCPIPKEY, 0, KEY_READ,
- &hTcpipRegKey) != ERROR_SUCCESS)
- {
- if (RegOpenKeyEx ( HKEY_LOCAL_MACHINE, WINSOCK2KEY, 0, KEY_READ,
- &hTcpipRegKey) != ERROR_SUCCESS)
- {
- if (RegOpenKeyEx ( HKEY_LOCAL_MACHINE, WINSOCKKEY, 0, KEY_READ,
- &hTcpipRegKey) != ERROR_SUCCESS)
- if (!getenv("HAVE_TCPIP") || have_tcpip) /* Provide a workaround */
- return (FALSE);
- }
- }
- RegCloseKey ( hTcpipRegKey);
- return (TRUE);
-}
-
-static my_bool win32_init_tcp_ip()
-{
- if (win32_have_tcpip())
- {
- WORD wVersionRequested = MAKEWORD( 2, 0 );
- WSADATA wsaData;
- /* Be a good citizen: maybe another lib has already initialised
- sockets, so dont clobber them unless necessary */
- if (WSAStartup( wVersionRequested, &wsaData ))
- {
- /* Load failed, maybe because of previously loaded
- incompatible version; try again */
- WSACleanup( );
- if (!WSAStartup( wVersionRequested, &wsaData ))
- have_tcpip=1;
- }
- else
- {
- if (wsaData.wVersion != wVersionRequested)
- {
- /* Version is no good, try again */
- WSACleanup( );
- if (!WSAStartup( wVersionRequested, &wsaData ))
- have_tcpip=1;
- }
- else
- have_tcpip=1;
- }
- }
- return(0);
-}
-#endif
diff --git a/ext/mysql/libmysql/my_lib.c b/ext/mysql/libmysql/my_lib.c
deleted file mode 100644
index 764309d120..0000000000
--- a/ext/mysql/libmysql/my_lib.c
+++ /dev/null
@@ -1,597 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-/* TODO: check for overun of memory for names. */
-/* Convert MSDOS-TIME to standar time_t */
-
-#define USES_TYPES /* sys/types is included */
-#include "mysys_priv.h"
-#include <m_string.h>
-#include <my_dir.h> /* Structs used by my_dir,includes sys/types */
-#include "mysys_err.h"
-#if defined(HAVE_DIRENT_H)
-# include <dirent.h>
-# define NAMLEN(dirent) strlen((dirent)->d_name)
-#else
-# define dirent direct
-# define NAMLEN(dirent) (dirent)->d_namlen
-# if defined(HAVE_SYS_NDIR_H)
-# include <sys/ndir.h>
-# endif
-# if defined(HAVE_SYS_DIR_H)
-# include <sys/dir.h>
-# endif
-# if defined(HAVE_NDIR_H)
-# include <ndir.h>
-# endif
-# if defined(MSDOS) || defined(__WIN__)
-# include <dos.h>
-# ifdef __BORLANDC__
-# include <dir.h>
-# endif
-# endif
-#endif
-#ifdef VMS
-#include <rms.h>
-#include <iodef.h>
-#include <descrip.h>
-#endif
-#if defined(THREAD) && defined(HAVE_READDIR_R)
-#define READDIR(A,B,C) ((errno=readdir_r(A,B,&C)) != 0 || !C)
-#else
-#define READDIR(A,B,C) (!(C=readdir(A)))
-#endif
-
-
-#define STARTSIZE ONCE_ALLOC_INIT*8 /* some mallocmargin */
-
-static int comp_names(struct fileinfo *a,struct fileinfo *b);
-
-
- /* We need this because program don't know with malloc we used */
-
-void my_dirend(MY_DIR *buffer)
-{
- DBUG_ENTER("my_dirend");
- if (buffer)
- my_free((gptr) buffer,MYF(0));
- DBUG_VOID_RETURN;
-} /* my_dirend */
-
-
- /* Compare in sort of filenames */
-
-static int comp_names(struct fileinfo *a, struct fileinfo *b)
-{
- return (strcmp(a->name,b->name));
-} /* comp_names */
-
-
-#if !defined(MSDOS) && !defined(__WIN__)
-
-MY_DIR *my_dir(const char *path, myf MyFlags)
-{
- DIR *dirp;
- struct dirent *dp;
- struct fileinfo *fnames;
- char *buffer, *obuffer, *tempptr;
- uint fcnt,i,size,firstfcnt, maxfcnt,length;
- char tmp_path[FN_REFLEN+1],*tmp_file;
- my_ptrdiff_t diff;
- bool eof;
-#ifdef THREAD
- char dirent_tmp[sizeof(struct dirent)+_POSIX_PATH_MAX+1];
-#endif
- DBUG_ENTER("my_dir");
- DBUG_PRINT("my",("path: '%s' stat: %d MyFlags: %d",path,MyFlags));
-
-#if defined(THREAD) && !defined(HAVE_READDIR_R)
- pthread_mutex_lock(&THR_LOCK_open);
-#endif
-
- dirp = opendir(directory_file_name(tmp_path,(my_string) path));
- size = STARTSIZE;
- if (dirp == NULL || ! (buffer = (char *) my_malloc(size, MyFlags)))
- goto error;
-
- fcnt = 0;
- tmp_file=strend(tmp_path);
- firstfcnt = maxfcnt = (size - sizeof(MY_DIR)) /
- (sizeof(struct fileinfo) + FN_LEN);
- fnames= (struct fileinfo *) (buffer + sizeof(MY_DIR));
- tempptr = (char *) (fnames + maxfcnt);
-
-#ifdef THREAD
- dp= (struct dirent*) dirent_tmp;
-#else
- dp=0;
-#endif
- eof=0;
- for (;;)
- {
- while (fcnt < maxfcnt &&
- !(eof= READDIR(dirp,(struct dirent*) dirent_tmp,dp)))
- {
- bzero((gptr) (fnames+fcnt),sizeof(fnames[0])); /* for purify */
- fnames[fcnt].name = tempptr;
- tempptr = strmov(tempptr,dp->d_name) + 1;
- if (MyFlags & MY_WANT_STAT)
- {
- VOID(strmov(tmp_file,dp->d_name));
- VOID(my_stat(tmp_path, &fnames[fcnt].mystat, MyFlags));
- }
- ++fcnt;
- }
- if (eof)
- break;
- size += STARTSIZE; obuffer = buffer;
- if (!(buffer = (char *) my_realloc((gptr) buffer, size,
- MyFlags | MY_FREE_ON_ERROR)))
- goto error; /* No memory */
- length= (uint) (sizeof(struct fileinfo ) * firstfcnt);
- diff= PTR_BYTE_DIFF(buffer , obuffer) + (int) length;
- fnames= (struct fileinfo *) (buffer + sizeof(MY_DIR));
- tempptr= ADD_TO_PTR(tempptr,diff,char*);
- for (i = 0; i < maxfcnt; i++)
- fnames[i].name = ADD_TO_PTR(fnames[i].name,diff,char*);
-
- /* move filenames upp a bit */
- maxfcnt += firstfcnt;
- bmove_upp(tempptr,tempptr-length,
- (uint) (tempptr- (char*) (fnames+maxfcnt)));
- }
-
- (void) closedir(dirp);
- {
- MY_DIR * s = (MY_DIR *) buffer;
- s->number_off_files = (uint) fcnt;
- s->dir_entry = fnames;
- }
- if (!(MyFlags & MY_DONT_SORT))
- qsort((void *) fnames, (size_s) fcnt, sizeof(struct fileinfo),
- (qsort_cmp) comp_names);
-#if defined(THREAD) && !defined(HAVE_READDIR_R)
- pthread_mutex_unlock(&THR_LOCK_open);
-#endif
- DBUG_RETURN((MY_DIR *) buffer);
-
- error:
-#if defined(THREAD) && !defined(HAVE_READDIR_R)
- pthread_mutex_unlock(&THR_LOCK_open);
-#endif
- my_errno=errno;
- if (dirp)
- (void) closedir(dirp);
- if (MyFlags & (MY_FAE+MY_WME))
- my_error(EE_DIR,MYF(ME_BELL+ME_WAITTANG),path,my_errno);
- DBUG_RETURN((MY_DIR *) NULL);
-} /* my_dir */
-
-
-/*
- * Convert from directory name to filename.
- * On VMS:
- * xyzzy:[mukesh.emacs] => xyzzy:[mukesh]emacs.dir.1
- * xyzzy:[mukesh] => xyzzy:[000000]mukesh.dir.1
- * On UNIX, it's simple: just make sure there is a terminating /
-
- * Returns pointer to dst;
- */
-
-my_string directory_file_name (my_string dst, const char *src)
-{
-#ifndef VMS
-
- /* Process as Unix format: just remove test the final slash. */
-
- my_string end;
-
- if (src[0] == 0)
- src= (char*) "."; /* Use empty as current */
- end=strmov(dst, src);
- if (end[-1] != FN_LIBCHAR)
- {
- end[0]=FN_LIBCHAR; /* Add last '/' */
- end[1]='\0';
- }
- return dst;
-
-#else /* VMS */
-
- long slen;
- long rlen;
- my_string ptr, rptr;
- char bracket;
- struct FAB fab = cc$rms_fab;
- struct NAM nam = cc$rms_nam;
- char esa[NAM$C_MAXRSS];
-
- if (! src[0])
- src="[.]"; /* Empty is == current dir */
-
- slen = strlen (src) - 1;
- if (src[slen] == FN_C_AFTER_DIR || src[slen] == FN_C_AFTER_DIR_2 ||
- src[slen] == FN_DEVCHAR)
- {
- /* VMS style - convert [x.y.z] to [x.y]z, [x] to [000000]x */
- fab.fab$l_fna = src;
- fab.fab$b_fns = slen + 1;
- fab.fab$l_nam = &nam;
- fab.fab$l_fop = FAB$M_NAM;
-
- nam.nam$l_esa = esa;
- nam.nam$b_ess = sizeof esa;
- nam.nam$b_nop |= NAM$M_SYNCHK;
-
- /* We call SYS$PARSE to handle such things as [--] for us. */
- if (SYS$PARSE(&fab, 0, 0) == RMS$_NORMAL)
- {
- slen = nam.nam$b_esl - 1;
- if (esa[slen] == ';' && esa[slen - 1] == '.')
- slen -= 2;
- esa[slen + 1] = '\0';
- src = esa;
- }
- if (src[slen] != FN_C_AFTER_DIR && src[slen] != FN_C_AFTER_DIR_2)
- {
- /* what about when we have logical_name:???? */
- if (src[slen] == FN_DEVCHAR)
- { /* Xlate logical name and see what we get */
- VOID(strmov(dst,src));
- dst[slen] = 0; /* remove colon */
- if (!(src = getenv (dst)))
- return dst; /* Can't translate */
-
- /* should we jump to the beginning of this procedure?
- Good points: allows us to use logical names that xlate
- to Unix names,
- Bad points: can be a problem if we just translated to a device
- name...
- For now, I'll punt and always expect VMS names, and hope for
- the best! */
-
- slen = strlen (src) - 1;
- if (src[slen] != FN_C_AFTER_DIR && src[slen] != FN_C_AFTER_DIR_2)
- { /* no recursion here! */
- VOID(strmov(dst, src));
- return(dst);
- }
- }
- else
- { /* not a directory spec */
- VOID(strmov(dst, src));
- return(dst);
- }
- }
-
- bracket = src[slen]; /* End char */
- if (!(ptr = strchr (src, bracket - 2)))
- { /* no opening bracket */
- VOID(strmov (dst, src));
- return dst;
- }
- if (!(rptr = strrchr (src, '.')))
- rptr = ptr;
- slen = rptr - src;
- VOID(strmake (dst, src, slen));
-
- if (*rptr == '.')
- { /* Put bracket and add */
- dst[slen++] = bracket; /* (rptr+1) after this */
- }
- else
- {
- /* If we have the top-level of a rooted directory (i.e. xx:[000000]),
- then translate the device and recurse. */
-
- if (dst[slen - 1] == ':'
- && dst[slen - 2] != ':' /* skip decnet nodes */
- && strcmp(src + slen, "[000000]") == 0)
- {
- dst[slen - 1] = '\0';
- if ((ptr = getenv (dst))
- && (rlen = strlen (ptr) - 1) > 0
- && (ptr[rlen] == FN_C_AFTER_DIR || ptr[rlen] == FN_C_AFTER_DIR_2)
- && ptr[rlen - 1] == '.')
- {
- VOID(strmov(esa,ptr));
- esa[rlen - 1] = FN_C_AFTER_DIR;
- esa[rlen] = '\0';
- return (directory_file_name (dst, esa));
- }
- else
- dst[slen - 1] = ':';
- }
- VOID(strmov(dst+slen,"[000000]"));
- slen += 8;
- }
- VOID(strmov(strmov(dst+slen,rptr+1)-1,".DIR.1"));
- return dst;
- }
- VOID(strmov(dst, src));
- if (dst[slen] == '/' && slen > 1)
- dst[slen] = 0;
- return dst;
-#endif /* VMS */
-} /* directory_file_name */
-
-#elif defined(WIN32)
-
-/*
-*****************************************************************************
-** Read long filename using windows rutines
-*****************************************************************************
-*/
-
-MY_DIR *my_dir(path, MyFlags)
-const char *path;
-myf MyFlags;
-{
- struct fileinfo *fnames;
- char *buffer, *obuffer, *tempptr;
- int eof,i,fcnt,firstfcnt,length,maxfcnt;
- uint size;
-#ifdef __BORLANDC__
- struct ffblk find;
-#else
- struct _finddata_t find;
-#endif
- ushort mode;
- char tmp_path[FN_REFLEN],*tmp_file,attrib;
- my_ptrdiff_t diff;
-#ifdef _WIN64
- __int64 handle;
-#else
- long handle;
-#endif
- DBUG_ENTER("my_dir");
- DBUG_PRINT("my",("path: '%s' stat: %d MyFlags: %d",path,MyFlags));
-
- /* Put LIB-CHAR as last path-character if not there */
-
- tmp_file=tmp_path;
- if (!*path)
- *tmp_file++ ='.'; /* From current dir */
- tmp_file= strmov(tmp_file,path);
- if (tmp_file[-1] == FN_DEVCHAR)
- *tmp_file++= '.'; /* From current dev-dir */
- if (tmp_file[-1] != FN_LIBCHAR)
- *tmp_file++ =FN_LIBCHAR;
- tmp_file[0]='*'; /* MSDOS needs this !??? */
- tmp_file[1]='.';
- tmp_file[2]='*';
- tmp_file[3]='\0';
-
-#ifdef __BORLANDC__
- if ((handle= findfirst(tmp_path,&find,0)) == -1L)
- goto error;
-#else
- if ((handle=_findfirst(tmp_path,&find)) == -1L)
- goto error;
-#endif
-
- size = STARTSIZE;
- firstfcnt = maxfcnt = (size - sizeof(MY_DIR)) /
- (sizeof(struct fileinfo) + FN_LEN);
- if ((buffer = (char *) my_malloc(size, MyFlags)) == 0)
- goto error;
- fnames= (struct fileinfo *) (buffer + sizeof(MY_DIR));
- tempptr = (char *) (fnames + maxfcnt);
-
- fcnt = 0;
- for (;;)
- {
- do
- {
- fnames[fcnt].name = tempptr;
-#ifdef __BORLANDC__
- tempptr = strmov(tempptr,find.ff_name) + 1;
- fnames[fcnt].mystat.st_size=find.ff_fsize;
- fnames[fcnt].mystat.st_uid=fnames[fcnt].mystat.st_gid=0;
- mode=MY_S_IREAD; attrib=find.ff_attrib;
-#else
- tempptr = strmov(tempptr,find.name) + 1;
- fnames[fcnt].mystat.st_size=find.size;
- fnames[fcnt].mystat.st_uid=fnames[fcnt].mystat.st_gid=0;
- mode=MY_S_IREAD; attrib=find.attrib;
-#endif
- if (!(attrib & _A_RDONLY))
- mode|=MY_S_IWRITE;
- if (attrib & _A_SUBDIR)
- mode|=MY_S_IFDIR;
- fnames[fcnt].mystat.st_mode=mode;
-#ifdef __BORLANDC__
- fnames[fcnt].mystat.st_mtime=((uint32) find.ff_ftime);
-#else
- fnames[fcnt].mystat.st_mtime=((uint32) find.time_write);
-#endif
- ++fcnt;
-#ifdef __BORLANDC__
- } while ((eof= findnext(&find)) == 0 && fcnt < maxfcnt);
-#else
- } while ((eof= _findnext(handle,&find)) == 0 && fcnt < maxfcnt);
-#endif
-
- DBUG_PRINT("test",("eof: %d errno: %d",eof,errno));
- if (eof)
- break;
- size += STARTSIZE; obuffer = buffer;
- if (!(buffer = (char *) my_realloc((gptr) buffer, size,
- MyFlags | MY_FREE_ON_ERROR)))
- goto error;
- length= sizeof(struct fileinfo ) * firstfcnt;
- diff= PTR_BYTE_DIFF(buffer , obuffer) +length;
- fnames= (struct fileinfo *) (buffer + sizeof(MY_DIR));
- tempptr= ADD_TO_PTR(tempptr,diff,char*);
- for (i = 0; i < maxfcnt; i++)
- fnames[i].name = ADD_TO_PTR(fnames[i].name,diff,char*);
-
- /* move filenames upp a bit */
- maxfcnt += firstfcnt;
- bmove_upp(tempptr,ADD_TO_PTR(tempptr,-length,char*),
- (int) PTR_BYTE_DIFF(tempptr,fnames+maxfcnt));
- }
- {
- MY_DIR * s = (MY_DIR *) buffer;
- s->number_off_files = (uint) fcnt;
- s->dir_entry = fnames;
- }
- if (!(MyFlags & MY_DONT_SORT))
- qsort(fnames,fcnt,sizeof(struct fileinfo),(qsort_cmp) comp_names);
-#ifndef __BORLANDC__
- _findclose(handle);
-#endif
- DBUG_RETURN((MY_DIR *) buffer);
-
-error:
- my_errno=errno;
-#ifndef __BORLANDC__
- if (handle != -1)
- _findclose(handle);
-#endif
- if (MyFlags & MY_FAE+MY_WME)
- my_error(EE_DIR,MYF(ME_BELL+ME_WAITTANG),path,errno);
- DBUG_RETURN((MY_DIR *) NULL);
-} /* my_dir */
-
-#else /* MSDOS and not WIN32 */
-
-
-/******************************************************************************
-** At MSDOS you always get stat of files, but time is in packed MSDOS-format
-******************************************************************************/
-
-MY_DIR *my_dir(path, MyFlags)
-const char *path;
-myf MyFlags;
-{
- struct fileinfo *fnames;
- char *buffer, *obuffer, *tempptr;
- int eof,i,fcnt,firstfcnt,length,maxfcnt;
- uint size;
- struct find_t find;
- ushort mode;
- char tmp_path[FN_REFLEN],*tmp_file,attrib;
- my_ptrdiff_t diff;
- DBUG_ENTER("my_dir");
- DBUG_PRINT("my",("path: '%s' stat: %d MyFlags: %d",path,MyFlags));
-
- /* Put LIB-CHAR as last path-character if not there */
-
- tmp_file=tmp_path;
- if (!*path)
- *tmp_file++ ='.'; /* From current dir */
- tmp_file= strmov(tmp_file,path);
- if (tmp_file[-1] == FN_DEVCHAR)
- *tmp_file++= '.'; /* From current dev-dir */
- if (tmp_file[-1] != FN_LIBCHAR)
- *tmp_file++ =FN_LIBCHAR;
- tmp_file[0]='*'; /* MSDOS needs this !??? */
- tmp_file[1]='.';
- tmp_file[2]='*';
- tmp_file[3]='\0';
-
- if (_dos_findfirst(tmp_path,_A_NORMAL | _A_SUBDIR, &find))
- goto error;
-
- size = STARTSIZE;
- firstfcnt = maxfcnt = (size - sizeof(MY_DIR)) /
- (sizeof(struct fileinfo) + FN_LEN);
- if ((buffer = (char *) my_malloc(size, MyFlags)) == 0)
- goto error;
- fnames= (struct fileinfo *) (buffer + sizeof(MY_DIR));
- tempptr = (char *) (fnames + maxfcnt);
-
- fcnt = 0;
- for (;;)
- {
- do
- {
- fnames[fcnt].name = tempptr;
- tempptr = strmov(tempptr,find.name) + 1;
- fnames[fcnt].mystat.st_size=find.size;
- fnames[fcnt].mystat.st_uid=fnames[fcnt].mystat.st_gid=0;
- mode=MY_S_IREAD; attrib=find.attrib;
- if (!(attrib & _A_RDONLY))
- mode|=MY_S_IWRITE;
- if (attrib & _A_SUBDIR)
- mode|=MY_S_IFDIR;
- fnames[fcnt].mystat.st_mode=mode;
- fnames[fcnt].mystat.st_mtime=((uint32) find.wr_date << 16) +
- find.wr_time;
- ++fcnt;
- } while ((eof= _dos_findnext(&find)) == 0 && fcnt < maxfcnt);
-
- DBUG_PRINT("test",("eof: %d errno: %d",eof,errno));
- if (eof)
- break;
- size += STARTSIZE; obuffer = buffer;
- if (!(buffer = (char *) my_realloc((gptr) buffer, size,
- MyFlags | MY_FREE_ON_ERROR)))
- goto error;
- length= sizeof(struct fileinfo ) * firstfcnt;
- diff= PTR_BYTE_DIFF(buffer , obuffer) +length;
- fnames= (struct fileinfo *) (buffer + sizeof(MY_DIR));
- tempptr= ADD_TO_PTR(tempptr,diff,char*);
- for (i = 0; i < maxfcnt; i++)
- fnames[i].name = ADD_TO_PTR(fnames[i].name,diff,char*);
-
- /* move filenames upp a bit */
- maxfcnt += firstfcnt;
- bmove_upp(tempptr,ADD_TO_PTR(tempptr,-length,char*),
- (int) PTR_BYTE_DIFF(tempptr,fnames+maxfcnt));
- }
- {
- MY_DIR * s = (MY_DIR *) buffer;
- s->number_off_files = (uint) fcnt;
- s->dir_entry = fnames;
- }
- if (!(MyFlags & MY_DONT_SORT))
- qsort(fnames,fcnt,sizeof(struct fileinfo),(qsort_cmp) comp_names);
- DBUG_RETURN((MY_DIR *) buffer);
-
-error:
- if (MyFlags & MY_FAE+MY_WME)
- my_error(EE_DIR,MYF(ME_BELL+ME_WAITTANG),path,errno);
- DBUG_RETURN((MY_DIR *) NULL);
-} /* my_dir */
-
-#endif /* WIN32 && MSDOS */
-
-/****************************************************************************
-** File status
-** Note that MY_STAT is assumed to be same as struct stat
-****************************************************************************/
-
-int my_fstat(int Filedes, MY_STAT *stat_area, myf MyFlags )
-{
- DBUG_ENTER("my_fstat");
- DBUG_PRINT("my",("fd: %d MyFlags: %d",Filedes,MyFlags));
- DBUG_RETURN(fstat(Filedes, (struct stat *) stat_area));
-}
-
-MY_STAT *my_stat(const char *path, MY_STAT *stat_area, myf my_flags)
-{
- int m_used;
- DBUG_ENTER("my_stat");
- DBUG_PRINT("my", ("path: '%s', stat_area: %lx, MyFlags: %d", path,
- (byte *) stat_area, my_flags));
-
- if ((m_used= (stat_area == NULL)))
- if (!(stat_area = (MY_STAT *) my_malloc(sizeof(MY_STAT), my_flags)))
- goto error;
- if ( ! stat((my_string) path, (struct stat *) stat_area) )
- DBUG_RETURN(stat_area);
- my_errno=errno;
- if (m_used) /* Free if new area */
- my_free((gptr) stat_area,MYF(0));
-
-error:
- if (my_flags & (MY_FAE+MY_WME))
- {
- my_error(EE_STAT, MYF(ME_BELL+ME_WAITTANG),path,my_errno);
- DBUG_RETURN((MY_STAT *) NULL);
- }
- DBUG_RETURN((MY_STAT *) NULL);
-} /* my_stat */
-
diff --git a/ext/mysql/libmysql/my_list.h b/ext/mysql/libmysql/my_list.h
deleted file mode 100644
index 46a6a8f65f..0000000000
--- a/ext/mysql/libmysql/my_list.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-#ifndef _list_h_
-#define _list_h_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef struct st_list {
- struct st_list *prev,*next;
- void *data;
-} LIST;
-
-typedef int (*list_walk_action)(void *,void *);
-
-extern LIST *list_add(LIST *root,LIST *element);
-extern LIST *list_delete(LIST *root,LIST *element);
-extern LIST *list_cons(void *data,LIST *root);
-extern LIST *list_reverse(LIST *root);
-extern void list_free(LIST *root,pbool free_data);
-extern uint list_length(LIST *list);
-extern int list_walk(LIST *list,list_walk_action action,gptr argument);
-
-#define rest(a) ((a)->next)
-#define list_push(a,b) (a)=list_cons((b),(a))
-#define list_pop(A) {LIST *old=(A); (A)=list_delete(old,old) ; my_free((gptr) old,MYF(MY_FAE)); }
-
-#ifdef __cplusplus
-}
-#endif
-#endif
diff --git a/ext/mysql/libmysql/my_malloc.c b/ext/mysql/libmysql/my_malloc.c
deleted file mode 100644
index 46c874aa66..0000000000
--- a/ext/mysql/libmysql/my_malloc.c
+++ /dev/null
@@ -1,70 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-#ifdef SAFEMALLOC /* We don't need SAFEMALLOC here */
-#undef SAFEMALLOC
-#endif
-
-#include "mysys_priv.h"
-#include "mysys_err.h"
-#include <m_string.h>
-
- /* My memory allocator */
-
-gptr my_malloc(unsigned int Size, myf MyFlags)
-{
- gptr point;
- DBUG_ENTER("my_malloc");
- DBUG_PRINT("my",("Size: %u MyFlags: %d",Size, MyFlags));
-
- if (!Size)
- Size=1; /* Safety */
- if ((point = malloc(Size)) == NULL)
- {
- my_errno=errno;
- if (MyFlags & MY_FAE)
- error_handler_hook=fatal_error_handler_hook;
- if (MyFlags & (MY_FAE+MY_WME))
- my_error(EE_OUTOFMEMORY, MYF(ME_BELL+ME_WAITTANG),Size);
- if (MyFlags & MY_FAE)
- exit(1);
- }
- else if (MyFlags & MY_ZEROFILL)
- bzero(point,Size);
- DBUG_PRINT("exit",("ptr: %lx",point));
- DBUG_RETURN(point);
-} /* my_malloc */
-
-
- /* Free memory allocated with my_malloc */
- /*ARGSUSED*/
-
-void my_no_flags_free(gptr ptr)
-{
- DBUG_ENTER("my_free");
- DBUG_PRINT("my",("ptr: %lx",ptr));
- if (ptr)
- free(ptr);
- DBUG_VOID_RETURN;
-} /* my_free */
-
-
- /* malloc and copy */
-
-gptr my_memdup(const byte *from, uint length, myf MyFlags)
-{
- gptr ptr;
- if ((ptr=my_malloc(length,MyFlags)) != 0)
- memcpy((byte*) ptr, (byte*) from,(size_t) length);
- return(ptr);
-}
-
-
-my_string my_strdup(const char *from, myf MyFlags)
-{
- gptr ptr;
- uint length=(uint) strlen(from)+1;
- if ((ptr=my_malloc(length,MyFlags)) != 0)
- memcpy((byte*) ptr, (byte*) from,(size_t) length);
- return((my_string) ptr);
-}
diff --git a/ext/mysql/libmysql/my_messnc.c b/ext/mysql/libmysql/my_messnc.c
deleted file mode 100644
index 48ed852f39..0000000000
--- a/ext/mysql/libmysql/my_messnc.c
+++ /dev/null
@@ -1,22 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-#include "mysys_priv.h"
-
-int my_message_no_curses(uint error __attribute__((unused)),
- const char *str, myf MyFlags)
-{
- DBUG_ENTER("my_message_no_curses");
- DBUG_PRINT("enter",("message: %s",str));
- (void) fflush(stdout);
- if (MyFlags & ME_BELL)
- (void) fputc('\007',stderr); /* Bell */
- if (my_progname)
- {
- (void)fputs(my_progname,stderr); (void)fputs(": ",stderr);
- }
- (void)fputs(str,stderr);
- (void)fputc('\n',stderr);
- (void)fflush(stderr);
- DBUG_RETURN(0);
-}
diff --git a/ext/mysql/libmysql/my_net.c b/ext/mysql/libmysql/my_net.c
deleted file mode 100644
index 6fad295a22..0000000000
--- a/ext/mysql/libmysql/my_net.c
+++ /dev/null
@@ -1,35 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-/* thread safe version of some common functions */
-
-#include "mysys_priv.h"
-#include <m_string.h>
-
-/* for thread safe my_inet_ntoa */
-#if !defined(MSDOS) && !defined(__WIN__)
-#include <netdb.h>
-#ifdef HAVE_SYS_SOCKET_H
-#include <sys/socket.h>
-#endif
-#ifdef HAVE_NETINET_IN_H
-#include <netinet/in.h>
-#endif
-#ifdef HAVE_ARPA_INET_H
-#include <arpa/inet.h>
-#endif
-#endif /* !defined(MSDOS) && !defined(__WIN__) */
-
-#ifndef THREAD
-#define pthread_mutex_lock(A)
-#define pthread_mutex_unlock(A)
-#endif
-
-void my_inet_ntoa(struct in_addr in, char *buf)
-{
- char *ptr;
- pthread_mutex_lock(&THR_LOCK_net);
- ptr=inet_ntoa(in);
- strmov(buf,ptr);
- pthread_mutex_unlock(&THR_LOCK_net);
-}
diff --git a/ext/mysql/libmysql/my_net.h b/ext/mysql/libmysql/my_net.h
deleted file mode 100644
index 4633f3dfbd..0000000000
--- a/ext/mysql/libmysql/my_net.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-/* thread safe version of some common functions */
-
-/* for thread safe my_inet_ntoa */
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-#if !defined(MSDOS) && !defined(__WIN__) && !defined(__BEOS__)
-#ifdef HAVE_SYS_SOCKET_H
-#include <sys/socket.h>
-#endif
-#ifdef HAVE_NETINET_IN_H
-#include <netinet/in.h>
-#endif
-#ifdef HAVE_ARPA_INET_H
-#include <arpa/inet.h>
-#endif
-#endif /* !defined(MSDOS) && !defined(__WIN__) */
-
-void my_inet_ntoa(struct in_addr in, char *buf);
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/ext/mysql/libmysql/my_once.c b/ext/mysql/libmysql/my_once.c
deleted file mode 100644
index 99aad4d4e7..0000000000
--- a/ext/mysql/libmysql/my_once.c
+++ /dev/null
@@ -1,74 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-/* Not MT-SAFE */
-
-#ifdef SAFEMALLOC /* We don't need SAFEMALLOC here */
-#undef SAFEMALLOC
-#endif
-
-#include "mysys_priv.h"
-#include "my_static.h"
-#include "mysys_err.h"
-
- /* alloc for things we don't nead to free */
- /* No DBUG_ENTER... here to get smaller dbug-startup */
-
-gptr my_once_alloc(unsigned int Size, myf MyFlags)
-{
- uint get_size,max_left;
- gptr point;
- reg1 USED_MEM *next;
- reg2 USED_MEM **prev;
-
- Size= ALIGN_SIZE(Size);
- prev= &my_once_root_block;
- max_left=0;
- for (next=my_once_root_block ; next && next->left < Size ; next= next->next)
- {
- if (next->left > max_left)
- max_left=next->left;
- prev= &next->next;
- }
- if (! next)
- { /* Time to alloc new block */
- get_size= Size+ALIGN_SIZE(sizeof(USED_MEM));
- if (max_left*4 < my_once_extra && get_size < my_once_extra)
- get_size=my_once_extra; /* Normal alloc */
-
- if ((next = (USED_MEM*) malloc(get_size)) == 0)
- {
- my_errno=errno;
- if (MyFlags & (MY_FAE+MY_WME))
- my_error(EE_OUTOFMEMORY, MYF(ME_BELL+ME_WAITTANG),get_size);
- return((gptr) 0);
- }
- DBUG_PRINT("test",("my_once_malloc %u byte malloced",get_size));
- next->next= 0;
- next->size= get_size;
- next->left= get_size-ALIGN_SIZE(sizeof(USED_MEM));
- *prev=next;
- }
- point= (gptr) ((char*) next+ (next->size-next->left));
- next->left-= Size;
-
- return(point);
-} /* my_once_alloc */
-
-
- /* deallocate everything used by my_once_alloc */
-
-void my_once_free(void)
-{
- reg1 USED_MEM *next,*old;
- DBUG_ENTER("my_once_free");
-
- for (next=my_once_root_block ; next ; )
- {
- old=next; next= next->next ;
- free((gptr) old);
- }
- my_once_root_block=0;
-
- DBUG_VOID_RETURN;
-} /* my_once_free */
diff --git a/ext/mysql/libmysql/my_open.c b/ext/mysql/libmysql/my_open.c
deleted file mode 100644
index 49d7735818..0000000000
--- a/ext/mysql/libmysql/my_open.c
+++ /dev/null
@@ -1,113 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-#define USES_TYPES
-#include "mysys_priv.h"
-#include "mysys_err.h"
-#include <my_dir.h>
-#include <errno.h>
-#if defined(MSDOS) || defined(__WIN__) || defined(__EMX__)
-#include <share.h>
-#endif
-
- /* Open a file */
-
-File my_open(const char *FileName, int Flags, myf MyFlags)
- /* Path-name of file */
- /* Read | write .. */
- /* Special flags */
-{
- File fd;
- DBUG_ENTER("my_open");
- DBUG_PRINT("my",("Name: '%s' Flags: %d MyFlags: %d",
- FileName, Flags, MyFlags));
-#if defined(MSDOS) || defined(__WIN__) || defined(__EMX__)
- if (Flags & O_SHARE)
- fd = sopen((my_string) FileName, (Flags & ~O_SHARE) | O_BINARY, SH_DENYNO,
- MY_S_IREAD | MY_S_IWRITE);
- else
- fd = open((my_string) FileName, Flags | O_BINARY,
- MY_S_IREAD | MY_S_IWRITE);
-#elif !defined(NO_OPEN_3)
- fd = open(FileName, Flags, my_umask); /* Normal unix */
-#else
- fd = open((my_string) FileName, Flags);
-#endif
- DBUG_RETURN(my_register_filename(fd, FileName, FILE_BY_OPEN,
- EE_FILENOTFOUND, MyFlags));
-} /* my_open */
-
-
- /* Close a file */
-
-int my_close(File fd, myf MyFlags)
-{
- int err;
- DBUG_ENTER("my_close");
- DBUG_PRINT("my",("fd: %d MyFlags: %d",fd, MyFlags));
-
- pthread_mutex_lock(&THR_LOCK_open);
- if ((err = close(fd)))
- {
- DBUG_PRINT("error",("Got error %d on close",err));
- my_errno=errno;
- if (MyFlags & (MY_FAE | MY_WME))
- my_error(EE_BADCLOSE, MYF(ME_BELL+ME_WAITTANG),my_filename(fd),errno);
- }
- if ((uint) fd < MY_NFILE && my_file_info[fd].type != UNOPEN)
- {
- my_free(my_file_info[fd].name, MYF(0));
-#if defined(THREAD) && !defined(HAVE_PREAD)
- pthread_mutex_destroy(&my_file_info[fd].mutex);
-#endif
- my_file_info[fd].type = UNOPEN;
- my_file_opened--;
- }
- pthread_mutex_unlock(&THR_LOCK_open);
- DBUG_RETURN(err);
-} /* my_close */
-
-
-File my_register_filename(File fd, const char *FileName, enum file_type
- type_of_file, uint error_message_number, myf MyFlags)
-{
- if ((int) fd >= 0)
- {
- if ((int) fd >= MY_NFILE)
- {
-#if defined(THREAD) && !defined(HAVE_PREAD)
- (void) my_close(fd,MyFlags);
- my_errno=EMFILE;
- if (MyFlags & (MY_FFNF | MY_FAE | MY_WME))
- my_error(EE_OUT_OF_FILERESOURCES, MYF(ME_BELL+ME_WAITTANG),
- FileName, my_errno);
- return(-1);
-#else
- thread_safe_increment(my_file_opened,&THR_LOCK_open);
-#endif
- return(fd); /* safeguard */
- }
- pthread_mutex_lock(&THR_LOCK_open);
- if ((my_file_info[fd].name = (char*) my_strdup(FileName,MyFlags)))
- {
- my_file_opened++;
- my_file_info[fd].type = type_of_file;
-#if defined(THREAD) && !defined(HAVE_PREAD)
- pthread_mutex_init(&my_file_info[fd].mutex,MY_MUTEX_INIT_FAST);
-#endif
- pthread_mutex_unlock(&THR_LOCK_open);
- DBUG_PRINT("exit",("fd: %d",fd));
- return(fd);
- }
- pthread_mutex_unlock(&THR_LOCK_open);
- (void) my_close(fd, MyFlags);
- my_errno=ENOMEM;
- }
- else
- my_errno=errno;
- DBUG_PRINT("error",("Got error %d on open",my_errno));
- if (MyFlags & (MY_FFNF | MY_FAE | MY_WME))
- my_error(error_message_number, MYF(ME_BELL+ME_WAITTANG),
- FileName, my_errno);
- return(fd);
-}
diff --git a/ext/mysql/libmysql/my_pthread.c b/ext/mysql/libmysql/my_pthread.c
deleted file mode 100644
index 367542ee8d..0000000000
--- a/ext/mysql/libmysql/my_pthread.c
+++ /dev/null
@@ -1,462 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-/* Functions to get threads more portable */
-
-#include "mysys_priv.h"
-#ifdef THREAD
-#include <signal.h>
-#include <m_string.h>
-#include <thr_alarm.h>
-#include <assert.h>
-#if !defined(MSDOS) && !defined(__WIN__)
-#include <netdb.h>
-#endif
-
-#if (defined(__BSD__) || defined(_BSDI_VERSION)) && !defined(HAVE_mit_thread)
-#define SCHED_POLICY SCHED_RR
-#else
-#define SCHED_POLICY SCHED_OTHER
-#endif
-
-#ifndef my_pthread_setprio
-void my_pthread_setprio(pthread_t thread_id,int prior)
-{
-#ifdef HAVE_PTHREAD_SETSCHEDPARAM
- struct sched_param tmp_sched_param;
- bzero((char*) &tmp_sched_param,sizeof(tmp_sched_param));
- tmp_sched_param.sched_priority=prior;
- VOID(pthread_setschedparam(thread_id,SCHED_POLICY,&tmp_sched_param));
-#endif
-}
-#endif
-
-#ifndef my_pthread_getprio
-int my_pthread_getprio(pthread_t thread_id)
-{
-#ifdef HAVE_PTHREAD_SETSCHEDPARAM
- struct sched_param tmp_sched_param;
- int policy;
- if (!pthread_getschedparam(thread_id,&policy,&tmp_sched_param))
- {
- DBUG_PRINT("thread",("policy: %d priority: %d",
- policy,tmp_sched_param.sched_priority));
- return tmp_sched_param.sched_priority;
- }
-#endif
- return -1;
-}
-#endif
-
-#ifndef my_pthread_attr_setprio
-void my_pthread_attr_setprio(pthread_attr_t *attr, int priority)
-{
-#ifdef HAVE_PTHREAD_SETSCHEDPARAM
- struct sched_param tmp_sched_param;
- bzero((char*) &tmp_sched_param,sizeof(tmp_sched_param));
- tmp_sched_param.sched_priority=priority;
- VOID(pthread_attr_setschedparam(attr,&tmp_sched_param));
-#endif
-}
-#endif
-
-
-/* To allow use of pthread_getspecific with two arguments */
-
-#ifdef HAVE_NONPOSIX_PTHREAD_GETSPECIFIC
-#undef pthread_getspecific
-#ifdef HAVE_UNIXWARE7_THREADS
-#define pthread_getspecific thr_getspecific
-#endif
-
-void *my_pthread_getspecific_imp(pthread_key_t key)
-{
- void *value;
- if (pthread_getspecific(key,(void *) &value))
- return 0;
- return value;
-}
-#endif
-
-
-/* Some functions for RTS threads, AIX, Siemens Unix and UnixWare 7
- (and DEC OSF/1 3.2 too) */
-
-int my_pthread_create_detached=1;
-
-#if defined(HAVE_NONPOSIX_SIGWAIT) || defined(HAVE_DEC_3_2_THREADS)
-
-int my_sigwait(const sigset_t *set,int *sig)
-{
- int signal=sigwait((sigset_t*) set);
- if (signal < 0)
- return errno;
- *sig=signal;
- return 0;
-}
-#endif
-
-/* localtime_r for SCO 3.2V4.2 */
-
-#ifndef HAVE_LOCALTIME_R
-
-extern pthread_mutex_t LOCK_localtime_r;
-
-struct tm *localtime_r(const time_t *clock, struct tm *res)
-{
- struct tm *tmp;
- pthread_mutex_lock(&LOCK_localtime_r);
- tmp=localtime(clock);
- *res= *tmp;
- pthread_mutex_unlock(&LOCK_localtime_r);
- return res;
-}
-#endif
-
-
-/****************************************************************************
-** Replacement of sigwait if the system doesn't have one (like BSDI 3.0)
-**
-** Note:
-** This version of sigwait() is assumed to called in a loop so the signalmask
-** is permanently modified to reflect the signal set. This is done to get
-** a much faster implementation.
-**
-** This implementation isn't thread safe: It assumes that only one
-** thread is using sigwait.
-**
-** If one later supplies a different signal mask, all old signals that
-** was used before are unblocked and set to SIGDFL.
-**
-** Author: Gary Wisniewski <garyw@spidereye.com.au>, much modified by Monty
-****************************************************************************/
-
-#if !defined(HAVE_SIGWAIT) && !defined(HAVE_mit_thread) && !defined(sigwait) && !defined(__WIN__) && !defined(HAVE_rts_threads) && !defined(HAVE_NONPOSIX_SIGWAIT) && !defined(HAVE_DEC_3_2_THREADS)
-
-#if !defined(DONT_USE_SIGSUSPEND)
-
-static sigset_t sigwait_set,rev_sigwait_set,px_recd;
-
-void px_handle_sig(int sig)
-{
- sigaddset(&px_recd, sig);
-}
-
-
-void sigwait_setup(sigset_t *set)
-{
- int i;
- struct sigaction sact,sact1;
- sigset_t unblock_mask;
-
- sact.sa_flags = 0;
- sact.sa_handler = px_handle_sig;
- memcpy_fixed(&sact.sa_mask,set,sizeof(*set)); /* handler isn't thread_safe */
- sigemptyset(&unblock_mask);
- pthread_sigmask(SIG_UNBLOCK,(sigset_t*) 0,&rev_sigwait_set);
-
- for (i = 1; i <= sizeof(sigwait_set)*8; i++)
- {
- if (sigismember(set,i))
- {
- sigdelset(&rev_sigwait_set,i);
- if (!sigismember(&sigwait_set,i))
- sigaction(i, &sact, (struct sigaction*) 0);
- }
- else
- {
- sigdelset(&px_recd,i); /* Don't handle this */
- if (sigismember(&sigwait_set,i))
- { /* Remove the old handler */
- sigaddset(&unblock_mask,i);
- sigdelset(&rev_sigwait_set,i);
- sact1.sa_flags = 0;
- sact1.sa_handler = SIG_DFL;
- sigemptyset(&sact1.sa_mask);
- sigaction(i, &sact1, 0);
- }
- }
- }
- memcpy_fixed(&sigwait_set,set,sizeof(*set));
- pthread_sigmask(SIG_BLOCK,(sigset_t*) set,(sigset_t*) 0);
- pthread_sigmask(SIG_UNBLOCK,&unblock_mask,(sigset_t*) 0);
-}
-
-
-int sigwait(sigset_t *setp, int *sigp)
-{
- if (memcmp(setp,&sigwait_set,sizeof(sigwait_set)))
- sigwait_setup(setp); /* Init or change of set */
-
- for (;;)
- {
- /*
- This is a fast, not 100% portable implementation to find the signal.
- Because the handler is blocked there should be at most 1 bit set, but
- the specification on this is somewhat shady so we use a set instead a
- single variable.
- */
-
- ulong *ptr= (ulong*) &px_recd;
- ulong *end=ptr+sizeof(px_recd)/sizeof(ulong);
-
- for ( ; ptr != end ; ptr++)
- {
- if (*ptr)
- {
- ulong set= *ptr;
- int found= (int) ((char*) ptr - (char*) &px_recd)*8+1;
- while (!(set & 1))
- {
- found++;
- set>>=1;
- }
- *sigp=found;
- sigdelset(&px_recd,found);
- return 0;
- }
- }
- sigsuspend(&rev_sigwait_set);
- }
- return 0;
-}
-#else /* !DONT_USE_SIGSUSPEND */
-
-/****************************************************************************
-** Replacement of sigwait if the system doesn't have one (like BSDI 3.0)
-**
-** Note:
-** This version of sigwait() is assumed to called in a loop so the signalmask
-** is permanently modified to reflect the signal set. This is done to get
-** a much faster implementation.
-**
-** This implementation uses a extra thread to handle the signals and one
-** must always call sigwait() with the same signal mask!
-**
-** BSDI 3.0 NOTE:
-**
-** pthread_kill() doesn't work on a thread in a select() or sleep() loop?
-** After adding the sleep to sigwait_thread, all signals are checked and
-** delivered every second. This isn't that terrible performance vice, but
-** someone should report this to BSDI and ask for a fix!
-** Another problem is that when the sleep() ends, every select() in other
-** threads are interrupted!
-****************************************************************************/
-
-static sigset_t pending_set;
-static bool inited=0;
-static pthread_cond_t COND_sigwait;
-static pthread_mutex_t LOCK_sigwait;
-
-
-void sigwait_handle_sig(int sig)
-{
- pthread_mutex_lock(&LOCK_sigwait);
- sigaddset(&pending_set, sig);
- VOID(pthread_cond_signal(&COND_sigwait)); /* inform sigwait() about signal */
- pthread_mutex_unlock(&LOCK_sigwait);
-}
-
-extern pthread_t alarm_thread;
-
-void *sigwait_thread(void *set_arg)
-{
- sigset_t *set=(sigset_t*) set_arg;
-
- int i;
- struct sigaction sact;
- sact.sa_flags = 0;
- sact.sa_handler = sigwait_handle_sig;
- memcpy_fixed(&sact.sa_mask,set,sizeof(*set)); /* handler isn't thread_safe */
- sigemptyset(&pending_set);
-
- for (i = 1; i <= sizeof(pending_set)*8; i++)
- {
- if (sigismember(set,i))
- {
- sigaction(i, &sact, (struct sigaction*) 0);
- }
- }
- sigaddset(set,THR_CLIENT_ALARM);
- pthread_sigmask(SIG_UNBLOCK,(sigset_t*) set,(sigset_t*) 0);
- alarm_thread=pthread_self(); /* For thr_alarm */
-
- for (;;)
- { /* Wait for signals */
-#ifdef HAVE_NOT_BROKEN_SELECT
- fd_set fd;
- FD_ZERO(&fd);
- select(0,&fd,0,0,0);
-#else
- sleep(1); /* Because of broken BSDI */
-#endif
- }
-}
-
-
-int sigwait(sigset_t *setp, int *sigp)
-{
- if (!inited)
- {
- pthread_attr_t thr_attr;
- pthread_t sigwait_thread_id;
- inited=1;
- sigemptyset(&pending_set);
- pthread_mutex_init(&LOCK_sigwait,MY_MUTEX_INIT_FAST);
- pthread_cond_init(&COND_sigwait,NULL);
-
- pthread_attr_init(&thr_attr);
- pthread_attr_setscope(&thr_attr,PTHREAD_SCOPE_PROCESS);
- pthread_attr_setdetachstate(&thr_attr,PTHREAD_CREATE_DETACHED);
- pthread_attr_setstacksize(&thr_attr,8196);
- my_pthread_attr_setprio(&thr_attr,100); /* Very high priority */
- VOID(pthread_create(&sigwait_thread_id,&thr_attr,sigwait_thread,setp));
- VOID(pthread_attr_destroy(&thr_attr));
- }
-
- pthread_mutex_lock(&LOCK_sigwait);
- for (;;)
- {
- ulong *ptr= (ulong*) &pending_set;
- ulong *end=ptr+sizeof(pending_set)/sizeof(ulong);
-
- for ( ; ptr != end ; ptr++)
- {
- if (*ptr)
- {
- ulong set= *ptr;
- int found= (int) ((char*) ptr - (char*) &pending_set)*8+1;
- while (!(set & 1))
- {
- found++;
- set>>=1;
- }
- *sigp=found;
- sigdelset(&pending_set,found);
- pthread_mutex_unlock(&LOCK_sigwait);
- return 0;
- }
- }
- VOID(pthread_cond_wait(&COND_sigwait,&LOCK_sigwait));
- }
- return 0;
-}
-
-#endif /* DONT_USE_SIGSUSPEND */
-#endif /* HAVE_SIGWAIT */
-
-/*****************************************************************************
-** Implement pthread_signal for systems that can't use signal() with threads
-** Currently this is only used with BSDI 3.0
-*****************************************************************************/
-
-#ifdef USE_PTHREAD_SIGNAL
-
-int pthread_signal(int sig, void (*func)())
-{
- struct sigaction sact;
- sact.sa_flags= 0;
- sact.sa_handler= func;
- sigemptyset(&sact.sa_mask);
- sigaction(sig, &sact, (struct sigaction*) 0);
- return 0;
-}
-
-#endif
-
-/*****************************************************************************
-** Patches for AIX and DEC OSF/1 3.2
-*****************************************************************************/
-
-#if (defined(HAVE_NONPOSIX_PTHREAD_MUTEX_INIT) && !defined(HAVE_UNIXWARE7_THREADS)) || defined(HAVE_DEC_3_2_THREADS)
-#undef pthread_mutex_init
-#undef pthread_cond_init
-
-#include <netdb.h>
-
-int my_pthread_mutex_init(pthread_mutex_t *mp, const pthread_mutexattr_t *attr)
-{
- int error;
- if (!attr)
- error=pthread_mutex_init(mp,pthread_mutexattr_default);
- else
- error=pthread_mutex_init(mp,*attr);
- return error;
-}
-
-int my_pthread_cond_init(pthread_cond_t *mp, const pthread_condattr_t *attr)
-{
- int error;
- if (!attr)
- error=pthread_cond_init(mp,pthread_condattr_default);
- else
- error=pthread_cond_init(mp,*attr);
- return error;
-}
-
-#endif
-
-/*
-** Emulate SOLARIS style calls, not because it's better, but just to make the
-** usage of getbostbyname_r simpler.
-*/
-
-#if !defined(my_gethostbyname_r) && defined(HAVE_GETHOSTBYNAME_R)
-
-#if defined(HAVE_GETHOSTBYNAME_R_GLIBC2_STYLE)
-
-struct hostent *my_gethostbyname_r(const char *name,
- struct hostent *result, char *buffer,
- int buflen, int *h_errnop)
-{
- struct hostent *hp;
- dbug_assert((size_t) buflen >= sizeof(*result));
- if (gethostbyname_r(name,result, buffer, (size_t) buflen, &hp, h_errnop))
- return 0;
- return hp;
-}
-
-#elif defined(HAVE_GETHOSTBYNAME_R_RETURN_INT)
-
-struct hostent *my_gethostbyname_r(const char *name,
- struct hostent *result, char *buffer,
- int buflen, int *h_errnop)
-{
- dbug_assert(buflen >= sizeof(struct hostent_data));
- if (gethostbyname_r(name,result,(struct hostent_data *) buffer) == -1)
- {
- *h_errnop= errno;
- return 0;
- }
- return result;
-}
-
-#else
-
-struct hostent *my_gethostbyname_r(const char *name,
- struct hostent *result, char *buffer,
- int buflen, int *h_errnop)
-{
- struct hostent *hp;
- dbug_assert(buflen >= sizeof(struct hostent_data));
- hp= gethostbyname_r(name,result,(struct hostent_data *) buffer);
- *h_errnop= errno;
- return hp;
-}
-
-#endif /* GLIBC2_STYLE_GETHOSTBYNAME_R */
-#endif
-
-
-/* Some help functions */
-
-int pthread_no_free(void *not_used __attribute__((unused)))
-{
- return 0;
-}
-
-int pthread_dummy(int ret)
-{
- return ret;
-}
-#endif /* THREAD */
diff --git a/ext/mysql/libmysql/my_pthread.h b/ext/mysql/libmysql/my_pthread.h
deleted file mode 100644
index 3b451dca51..0000000000
--- a/ext/mysql/libmysql/my_pthread.h
+++ /dev/null
@@ -1,565 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-/* Defines to make different thread packages compatible */
-
-#ifndef _my_pthread_h
-#define _my_pthread_h
-
-#include <errno.h>
-#ifndef ETIME
-#define ETIME ETIMEDOUT /* For FreeBSD */
-#endif
-
-#if defined(__WIN__)
-
-typedef CRITICAL_SECTION pthread_mutex_t;
-typedef HANDLE pthread_t;
-typedef struct thread_attr {
- DWORD dwStackSize ;
- DWORD dwCreatingFlag ;
- int priority ;
-} pthread_attr_t ;
-
-typedef struct { int dummy; } pthread_condattr_t;
-
-/* Implementation of posix conditions */
-
-typedef struct st_pthread_link {
- DWORD thread_id;
- struct st_pthread_link *next;
-} pthread_link;
-
-typedef struct {
- uint32 waiting;
- HANDLE semaphore;
-} pthread_cond_t;
-
-
-struct timespec { /* For pthread_cond_timedwait() */
- time_t tv_sec;
- long tv_nsec;
-};
-
-typedef int pthread_mutexattr_t;
-#define win_pthread_self my_thread_var->pthread_self
-#define pthread_handler_decl(A,B) void * __cdecl A(void *B)
-typedef void * (__cdecl *pthread_handler)(void *);
-
-void win_pthread_init(void);
-int win_pthread_setspecific(void *A,void *B,uint length);
-int pthread_create(pthread_t *,pthread_attr_t *,pthread_handler,void *);
-int pthread_cond_init(pthread_cond_t *cond, const pthread_condattr_t *attr);
-int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex);
-int pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex,
- struct timespec *abstime);
-int pthread_cond_signal(pthread_cond_t *cond);
-int pthread_cond_broadcast(pthread_cond_t *cond);
-int pthread_cond_destroy(pthread_cond_t *cond);
-int pthread_attr_init(pthread_attr_t *connect_att);
-int pthread_attr_setstacksize(pthread_attr_t *connect_att,DWORD stack);
-int pthread_attr_setprio(pthread_attr_t *connect_att,int priority);
-int pthread_attr_destroy(pthread_attr_t *connect_att);
-struct tm *localtime_r(const time_t *timep,struct tm *tmp);
-
-void pthread_exit(void *a); /* was #define pthread_exit(A) ExitThread(A)*/
-
-#define ETIMEDOUT 145 /* Win32 doesn't have this */
-#define getpid() GetCurrentThreadId()
-#define pthread_self() win_pthread_self
-#define HAVE_LOCALTIME_R
-#define _REENTRANT
-#define HAVE_PTHREAD_ATTR_SETSTACKSIZE
-
-#ifdef USE_TLS /* For LIBMYSQL.DLL */
-#undef SAFE_MUTEX /* This will cause conflicts */
-#define pthread_key(T,V) DWORD V
-#define pthread_key_create(A,B) ((*A=TlsAlloc())==0xFFFFFFFF)
-#define pthread_getspecific(A) (TlsGetValue(A))
-#define my_pthread_getspecific(T,A) ((T) TlsGetValue(A))
-#define my_pthread_getspecific_ptr(T,V) ((T) TlsGetValue(V))
-#define my_pthread_setspecific_ptr(T,V) (!TlsSetValue((T),(V)))
-#define pthread_setspecific(A,B) (!TlsSetValue((A),(B)))
-#else
-#define pthread_key(T,V) __declspec(thread) T V
-#define pthread_key_create(A,B) pthread_dummy(0)
-#define pthread_getspecific(A) (&(A))
-#define my_pthread_getspecific(T,A) (&(A))
-#define my_pthread_getspecific_ptr(T,V) (V)
-#define my_pthread_setspecific_ptr(T,V) ((T)=(V),0)
-#define pthread_setspecific(A,B) win_pthread_setspecific(&(A),(B),sizeof(A))
-#endif /* USE_TLS */
-
-#define pthread_equal(A,B) ((A) == (B))
-#define pthread_mutex_init(A,B) InitializeCriticalSection(A)
-#define pthread_mutex_lock(A) (EnterCriticalSection(A),0)
-#define pthread_mutex_unlock(A) LeaveCriticalSection(A)
-#define pthread_mutex_destroy(A) DeleteCriticalSection(A)
-#define my_pthread_setprio(A,B) SetThreadPriority(GetCurrentThread(), (B))
-/* Dummy defines for easier code */
-#define pthread_kill(A,B) pthread_dummy(0)
-#define pthread_attr_setdetachstate(A,B) pthread_dummy(0)
-#define my_pthread_attr_setprio(A,B) pthread_attr_setprio(A,B)
-#define pthread_attr_setscope(A,B)
-#define pthread_detach_this_thread()
-#define pthread_condattr_init(A)
-#define pthread_condattr_destroy(A)
-
-/*Irena: compiler does not like this: */
-/*#define my_pthread_getprio(pthread_t thread_id) pthread_dummy(0) */
-#define my_pthread_getprio(thread_id) pthread_dummy(0)
-
-#elif defined(HAVE_UNIXWARE7_THREADS)
-
-#include <thread.h>
-#include <synch.h>
-
-#ifndef _REENTRANT
-#define _REENTRANT
-#endif
-
-#define HAVE_NONPOSIX_SIGWAIT
-#define pthread_t thread_t
-#define pthread_cond_t cond_t
-#define pthread_mutex_t mutex_t
-#define pthread_key_t thread_key_t
-typedef int pthread_attr_t; /* Needed by Unixware 7.0.0 */
-
-#define pthread_key_create(A,B) thr_keycreate((A),(B))
-
-#define pthread_handler_decl(A,B) void *A(void *B)
-#define pthread_key(T,V) pthread_key_t V
-
-void * my_pthread_getspecific_imp(pthread_key_t key);
-#define my_pthread_getspecific(A,B) ((A) my_pthread_getspecific_imp(B))
-#define my_pthread_getspecific_ptr(T,V) my_pthread_getspecific(T,V)
-
-#define pthread_setspecific(A,B) thr_setspecific(A,B)
-#define my_pthread_setspecific_ptr(T,V) pthread_setspecific(T,V)
-
-#define pthread_create(A,B,C,D) thr_create(NULL,65536L,(C),(D),THR_DETACHED,(A))
-#define pthread_cond_init(a,b) cond_init((a),USYNC_THREAD,NULL)
-#define pthread_cond_destroy(a) cond_destroy(a)
-#define pthread_cond_signal(a) cond_signal(a)
-#define pthread_cond_wait(a,b) cond_wait((a),(b))
-#define pthread_cond_timedwait(a,b,c) cond_timedwait((a),(b),(c))
-#define pthread_cond_broadcast(a) cond_broadcast(a)
-
-#define pthread_mutex_init(a,b) mutex_init((a),USYNC_THREAD,NULL)
-#define pthread_mutex_lock(a) mutex_lock(a)
-#define pthread_mutex_unlock(a) mutex_unlock(a)
-#define pthread_mutex_destroy(a) mutex_destroy(a)
-
-#define pthread_self() thr_self()
-#define pthread_exit(A) thr_exit(A)
-#define pthread_equal(A,B) (((A) == (B)) ? 1 : 0)
-#define pthread_kill(A,B) thr_kill((A),(B))
-#define HAVE_PTHREAD_KILL
-
-#define pthread_sigmask(A,B,C) thr_sigsetmask((A),(B),(C))
-
-extern int my_sigwait(const sigset_t *set,int *sig);
-
-#define pthread_detach_this_thread() pthread_dummy(0)
-
-#define pthread_attr_init(A) pthread_dummy(0)
-#define pthread_attr_destroy(A) pthread_dummy(0)
-#define pthread_attr_setscope(A,B) pthread_dummy(0)
-#define pthread_attr_setdetachstate(A,B) pthread_dummy(0)
-#define my_pthread_setprio(A,B) pthread_dummy (0)
-#define my_pthread_getprio(A) pthread_dummy (0)
-#define my_pthread_attr_setprio(A,B) pthread_dummy(0)
-
-#else /* Normal threads */
-
-#ifdef HAVE_rts_threads
-#define sigwait org_sigwait
-#include <signal.h>
-#undef sigwait
-#endif
-#undef _REENTRANT /* Fix if _REENTRANT is in pthread.h */
-#include <pthread.h>
-#ifndef _REENTRANT
-#define _REENTRANT
-#endif
-#ifdef HAVE_THR_SETCONCURRENCY
-#include <thread.h> /* Probably solaris */
-#endif
-#ifdef HAVE_SCHED_H
-#include <sched.h>
-#endif
-#ifdef HAVE_SYNCH_H
-#include <synch.h>
-#endif
-#if defined(__EMX__) && (!defined(EMX_PTHREAD_REV) || (EMX_PTHREAD_REV < 2))
-#error Requires at least rev 2 of EMX pthreads library.
-#endif
-
-extern int my_pthread_getprio(pthread_t thread_id);
-
-#define pthread_key(T,V) pthread_key_t V
-#define my_pthread_getspecific_ptr(T,V) my_pthread_getspecific(T,(V))
-#define my_pthread_setspecific_ptr(T,V) pthread_setspecific(T,(void*) (V))
-#define pthread_detach_this_thread()
-#define pthread_handler_decl(A,B) void *A(void *B)
-typedef void *(* pthread_handler)(void *);
-
-/* Test first for RTS or FSU threads */
-
-#if defined(PTHREAD_SCOPE_GLOBAL) && !defined(PTHREAD_SCOPE_SYSTEM)
-#define HAVE_rts_threads
-extern int my_pthread_create_detached;
-#define pthread_sigmask(A,B,C) sigprocmask((A),(B),(C))
-#define PTHREAD_CREATE_DETACHED &my_pthread_create_detached
-#define PTHREAD_SCOPE_SYSTEM PTHREAD_SCOPE_GLOBAL
-#define PTHREAD_SCOPE_PROCESS PTHREAD_SCOPE_LOCAL
-#define USE_ALARM_THREAD
-#elif defined(HAVE_mit_thread)
-#define USE_ALARM_THREAD
-#undef HAVE_LOCALTIME_R
-#define HAVE_LOCALTIME_R
-#undef HAVE_PTHREAD_ATTR_SETSCOPE
-#define HAVE_PTHREAD_ATTR_SETSCOPE
-#undef HAVE_GETHOSTBYNAME_R_GLIBC2_STYLE /* If we are running linux */
-#undef HAVE_RWLOCK_T
-#undef HAVE_RWLOCK_INIT
-#undef HAVE_PTHREAD_RWLOCK_RDLOCK
-#undef HAVE_SNPRINTF
-
-#define sigset(A,B) pthread_signal((A),(void (*)(int)) (B))
-#define signal(A,B) pthread_signal((A),(void (*)(int)) (B))
-#define my_pthread_attr_setprio(A,B)
-#endif /* defined(PTHREAD_SCOPE_GLOBAL) && !defined(PTHREAD_SCOPE_SYSTEM) */
-
-#if defined(_BSDI_VERSION) && _BSDI_VERSION < 199910
-int sigwait(sigset_t *set, int *sig);
-#endif
-
-#if defined(HAVE_UNIXWARE7_POSIX)
-#undef HAVE_NONPOSIX_SIGWAIT
-#define HAVE_NONPOSIX_SIGWAIT /* sigwait takes only 1 argument */
-#endif
-
-#ifndef HAVE_NONPOSIX_SIGWAIT
-#define my_sigwait(A,B) sigwait((A),(B))
-#else
-int my_sigwait(const sigset_t *set,int *sig);
-#endif
-
-#ifdef HAVE_NONPOSIX_PTHREAD_MUTEX_INIT
-#ifndef SAFE_MUTEX
-#define pthread_mutex_init(a,b) my_pthread_mutex_init((a),(b))
-extern int my_pthread_mutex_init(pthread_mutex_t *mp,
- const pthread_mutexattr_t *attr);
-#endif /* SAFE_MUTEX */
-#define pthread_cond_init(a,b) my_pthread_cond_init((a),(b))
-extern int my_pthread_cond_init(pthread_cond_t *mp,
- const pthread_condattr_t *attr);
-#endif /* HAVE_NONPOSIX_PTHREAD_MUTEX_INIT */
-
-#if defined(HAVE_SIGTHREADMASK) && !defined(HAVE_PTHREAD_SIGMASK)
-#define pthread_sigmask(A,B,C) sigthreadmask((A),(B),(C))
-#endif
-
-#if !defined(HAVE_SIGWAIT) && !defined(HAVE_mit_thread) && !defined(HAVE_rts_threads) && !defined(sigwait) && !defined(alpha_linux_port) && !defined(HAVE_NONPOSIX_SIGWAIT) && !defined(HAVE_DEC_3_2_THREADS) && !defined(_AIX)
-int sigwait(sigset_t *setp, int *sigp); /* Use our implemention */
-#endif
-#if !defined(HAVE_SIGSET) && !defined(HAVE_mit_thread) && !defined(sigset)
-#define sigset(A,B) do { struct sigaction s; sigset_t set; \
- sigemptyset(&set); \
- s.sa_handler = (B); \
- s.sa_mask = set; \
- s.sa_flags = 0; \
- sigaction((A), &s, (struct sigaction *) NULL); \
- } while (0)
-#endif
-
-#ifndef my_pthread_setprio
-#if defined(HAVE_PTHREAD_SETPRIO_NP) /* FSU threads */
-#define my_pthread_setprio(A,B) pthread_setprio_np((A),(B))
-#elif defined(HAVE_PTHREAD_SETPRIO)
-#define my_pthread_setprio(A,B) pthread_setprio((A),(B))
-#else
-extern void my_pthread_setprio(pthread_t thread_id,int prior);
-#endif
-#endif
-
-#ifndef my_pthread_attr_setprio
-#ifdef HAVE_PTHREAD_ATTR_SETPRIO
-#define my_pthread_attr_setprio(A,B) pthread_attr_setprio((A),(B))
-#else
-extern void my_pthread_attr_setprio(pthread_attr_t *attr, int priority);
-#endif
-#endif
-
-#if !defined(HAVE_PTHREAD_ATTR_SETSCOPE) || defined(HAVE_DEC_3_2_THREADS)
-#define pthread_attr_setscope(A,B)
-#undef HAVE_GETHOSTBYADDR_R /* No definition */
-#endif
-
-#ifndef HAVE_NONPOSIX_PTHREAD_GETSPECIFIC
-#define my_pthread_getspecific(A,B) ((A) pthread_getspecific(B))
-#else
-#define my_pthread_getspecific(A,B) ((A) my_pthread_getspecific_imp(B))
-void *my_pthread_getspecific_imp(pthread_key_t key);
-#endif
-
-#ifndef HAVE_LOCALTIME_R
-struct tm *localtime_r(const time_t *clock, struct tm *res);
-#endif
-
-#ifdef HAVE_PTHREAD_CONDATTR_CREATE
-/* DCE threads on HPUX 10.20 */
-#define pthread_condattr_init pthread_condattr_create
-#define pthread_condattr_destroy pthread_condattr_delete
-#endif
-
-#ifdef HAVE_CTHREADS_WRAPPER /* For MacOSX */
-#define pthread_cond_destroy(A) pthread_dummy(0)
-#define pthread_mutex_destroy(A) pthread_dummy(0)
-#define pthread_attr_delete(A) pthread_dummy(0)
-#define pthread_condattr_delete(A) pthread_dummy(0)
-#define pthread_attr_setstacksize(A,B) pthread_dummy(0)
-#define pthread_equal(A,B) ((A) == (B))
-#define pthread_cond_timedwait(a,b,c) pthread_cond_wait((a),(b))
-#define pthread_attr_init(A) pthread_attr_create(A)
-#define pthread_attr_destroy(A) pthread_attr_delete(A)
-#define pthread_attr_setdetachstate(A,B) pthread_dummy(0)
-#define pthread_create(A,B,C,D) pthread_create((A),*(B),(C),(D))
-#define pthread_sigmask(A,B,C) sigprocmask((A),(B),(C))
-#define pthread_kill(A,B) pthread_dummy(0)
-#undef pthread_detach_this_thread
-#define pthread_detach_this_thread() { pthread_t tmp=pthread_self() ; pthread_detach(&tmp); }
-#endif
-
-#ifdef HAVE_DARWIN_THREADS
-#define pthread_sigmask(A,B,C) sigprocmask((A),(B),(C))
-#define pthread_kill(A,B) pthread_dummy(0)
-#define pthread_condattr_init(A) pthread_dummy(0)
-#define pthread_condattr_destroy(A) pthread_dummy(0)
-#define pthread_signal(A,B) pthread_dummy(0)
-#undef pthread_detach_this_thread
-#define pthread_detach_this_thread() { pthread_t tmp=pthread_self() ; pthread_detach(tmp); }
-#undef sigset
-#define sigset(A,B) pthread_signal((A),(void (*)(int)) (B))
-#endif
-
-#if ((defined(HAVE_PTHREAD_ATTR_CREATE) && !defined(HAVE_SIGWAIT)) || defined(HAVE_DEC_3_2_THREADS)) && !defined(HAVE_CTHREADS_WRAPPER)
-/* This is set on AIX_3_2 and Siemens unix (and DEC OSF/1 3.2 too) */
-#define pthread_key_create(A,B) \
- pthread_keycreate(A,(B) ?\
- (pthread_destructor_t) (B) :\
- (pthread_destructor_t) pthread_dummy)
-#define pthread_attr_init(A) pthread_attr_create(A)
-#define pthread_attr_destroy(A) pthread_attr_delete(A)
-#define pthread_attr_setdetachstate(A,B) pthread_dummy(0)
-#define pthread_create(A,B,C,D) pthread_create((A),*(B),(C),(D))
-#ifndef pthread_sigmask
-#define pthread_sigmask(A,B,C) sigprocmask((A),(B),(C))
-#endif
-#define pthread_kill(A,B) pthread_dummy(0)
-#undef pthread_detach_this_thread
-#define pthread_detach_this_thread() { pthread_t tmp=pthread_self() ; pthread_detach(&tmp); }
-#else /* HAVE_PTHREAD_ATTR_CREATE && !HAVE_SIGWAIT */
-#define HAVE_PTHREAD_KILL
-#endif
-
-#if defined(HAVE_PTHREAD_ATTR_CREATE) || defined(_AIX) || defined(HAVE_GETHOSTBYNAME_R_GLIBC2_STYLE)
-#if !defined(HPUX)
-struct hostent;
-#endif /* HPUX */
-struct hostent *my_gethostbyname_r(const char *name,
- struct hostent *result, char *buffer,
- int buflen, int *h_errnop);
-#if defined(HAVE_GETHOSTBYNAME_R_GLIBC2_STYLE)
-#define GETHOSTBYNAME_BUFF_SIZE 2048
-#else
-#define GETHOSTBYNAME_BUFF_SIZE sizeof(struct hostent_data)
-#endif /* defined(HAVE_GETHOSTBYNAME_R_GLIBC2_STYLE) */
-
-#else
-#ifdef HAVE_GETHOSTBYNAME_R_RETURN_INT
-#define GETHOSTBYNAME_BUFF_SIZE sizeof(struct hostent_data)
-struct hostent *my_gethostbyname_r(const char *name,
- struct hostent *result, char *buffer,
- int buflen, int *h_errnop);
-#else
-#define GETHOSTBYNAME_BUFF_SIZE 2048
-#define my_gethostbyname_r(A,B,C,D,E) gethostbyname_r((A),(B),(C),(D),(E))
-#endif /* HAVE_GETHOSTBYNAME_R_RETURN_INT */
-#endif /* defined(HAVE_PTHREAD_ATTR_CREATE) || defined(_AIX) || defined(HAVE_GETHOSTBYNAME_R_GLIBC2_STYLE) */
-
-#endif /* defined(__WIN__) */
-
- /* safe_mutex adds checking to mutex for easier debugging */
-
-typedef struct st_safe_mutex_t
-{
- pthread_mutex_t global,mutex;
- char *file;
- uint line,count;
- pthread_t thread;
-} safe_mutex_t;
-
-int safe_mutex_init(safe_mutex_t *mp, const pthread_mutexattr_t *attr);
-int safe_mutex_lock(safe_mutex_t *mp,const char *file, uint line);
-int safe_mutex_unlock(safe_mutex_t *mp,const char *file, uint line);
-int safe_mutex_destroy(safe_mutex_t *mp,const char *file, uint line);
-int safe_cond_wait(pthread_cond_t *cond, safe_mutex_t *mp,const char *file,
- uint line);
-int safe_cond_timedwait(pthread_cond_t *cond, safe_mutex_t *mp,
- struct timespec *abstime, const char *file, uint line);
-
- /* Wrappers if safe mutex is actually used */
-#ifdef SAFE_MUTEX
-#undef pthread_mutex_init
-#undef pthread_mutex_lock
-#undef pthread_mutex_unlock
-#undef pthread_mutex_destroy
-#undef pthread_mutex_wait
-#undef pthread_mutex_timedwait
-#undef pthread_mutex_t
-#undef pthread_cond_wait
-#undef pthread_cond_timedwait
-#define pthread_mutex_init(A,B) safe_mutex_init((A),(B))
-#define pthread_mutex_lock(A) safe_mutex_lock((A),__FILE__,__LINE__)
-#define pthread_mutex_unlock(A) safe_mutex_unlock((A),__FILE__,__LINE__)
-#define pthread_mutex_destroy(A) safe_mutex_destroy((A),__FILE__,__LINE__)
-#define pthread_cond_wait(A,B) safe_cond_wait((A),(B),__FILE__,__LINE__)
-#define pthread_cond_timedwait(A,B,C) safe_cond_timedwait((A),(B),(C),__FILE__,__LINE__)
-#define pthread_mutex_trylock(A) pthread_mutex_lock(A)
-#define pthread_mutex_t safe_mutex_t
-#endif /* SAFE_MUTEX */
-
- /* READ-WRITE thread locking */
-
-#if defined(USE_MUTEX_INSTEAD_OF_RW_LOCKS)
-/* use these defs for simple mutex locking */
-#define rw_lock_t pthread_mutex_t
-#define my_rwlock_init(A,B) pthread_mutex_init((A),(B))
-#define rw_rdlock(A) pthread_mutex_lock((A))
-#define rw_wrlock(A) pthread_mutex_lock((A))
-#define rw_unlock(A) pthread_mutex_unlock((A))
-#define rwlock_destroy(A) pthread_mutex_destroy((A))
-#elif defined(HAVE_PTHREAD_RWLOCK_RDLOCK)
-#define rw_lock_t pthread_rwlock_t
-#define my_rwlock_init(A,B) pthread_rwlock_init((A),(B))
-#define rw_rdlock(A) pthread_rwlock_rdlock(A)
-#define rw_wrlock(A) pthread_rwlock_wrlock(A)
-#define rw_unlock(A) pthread_rwlock_unlock(A)
-#define rwlock_destroy(A) pthread_rwlock_destroy(A)
-#elif defined(HAVE_RWLOCK_INIT)
-#ifdef HAVE_RWLOCK_T /* For example Solaris 2.6-> */
-#define rw_lock_t rwlock_t
-#endif
-#define my_rwlock_init(A,B) rwlock_init((A),USYNC_THREAD,0)
-#else
-/* Use our own version of read/write locks */
-typedef struct _my_rw_lock_t {
- pthread_mutex_t lock; /* lock for structure */
- pthread_cond_t readers; /* waiting readers */
- pthread_cond_t writers; /* waiting writers */
- int state; /* -1:writer,0:free,>0:readers */
- int waiters; /* number of waiting writers */
-} my_rw_lock_t;
-
-#define rw_lock_t my_rw_lock_t
-#define rw_rdlock(A) my_rw_rdlock((A))
-#define rw_wrlock(A) my_rw_wrlock((A))
-#define rw_unlock(A) my_rw_unlock((A))
-#define rwlock_destroy(A) my_rwlock_destroy((A))
-
-extern int my_rwlock_init( my_rw_lock_t *, void * );
-extern int my_rwlock_destroy( my_rw_lock_t * );
-extern int my_rw_rdlock( my_rw_lock_t * );
-extern int my_rw_wrlock( my_rw_lock_t * );
-extern int my_rw_unlock( my_rw_lock_t * );
-#endif /* USE_MUTEX_INSTEAD_OF_RW_LOCKS */
-
-#define GETHOSTBYADDR_BUFF_SIZE 2048
-
-#ifndef HAVE_THR_SETCONCURRENCY
-#define thr_setconcurrency(A) pthread_dummy(0)
-#endif
-#if !defined(HAVE_PTHREAD_ATTR_SETSTACKSIZE) && ! defined(pthread_attr_setstacksize)
-#define pthread_attr_setstacksize(A,B) pthread_dummy(0)
-#endif
-
-/* Define mutex types */
-#define MY_MUTEX_INIT_SLOW NULL
-#define MY_MUTEX_INIT_FAST NULL
-#define MY_MUTEX_INIT_ERRCHK NULL
-#ifdef PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP
-extern pthread_mutexattr_t my_fast_mutexattr;
-#undef MY_MUTEX_INIT_FAST
-#define MY_MUTEX_INIT_FAST &my_fast_mutexattr
-#endif
-#ifdef PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP
-extern pthread_mutexattr_t my_errchk_mutexattr;
-#undef MY_INIT_MUTEX_ERRCHK
-#define MY_INIT_MUTEX_ERRCHK &my_errchk_mutexattr
-#endif
-
-extern my_bool my_thread_global_init(void);
-extern void my_thread_global_end(void);
-extern my_bool my_thread_init(void);
-extern void my_thread_end(void);
-extern const char *my_thread_name(void);
-extern long my_thread_id(void);
-extern int pthread_no_free(void *);
-extern int pthread_dummy(int);
-
-/* All thread specific variables are in the following struct */
-
-#define THREAD_NAME_SIZE 10
-#if defined(__ia64__)
-#define DEFAULT_THREAD_STACK (128*1024)
-#else
-#define DEFAULT_THREAD_STACK (64*1024)
-#endif
-
-struct st_my_thread_var
-{
- int thr_errno;
- pthread_cond_t suspend, *current_cond;
- pthread_mutex_t mutex, *current_mutex;
- pthread_t pthread_self;
- long id;
- int cmp_length;
- volatile int abort;
-#ifndef DBUG_OFF
- gptr dbug;
- char name[THREAD_NAME_SIZE+1];
-#endif
-};
-
-extern struct st_my_thread_var *_my_thread_var(void) __attribute__ ((const));
-#define my_thread_var (_my_thread_var())
-#define my_errno my_thread_var->thr_errno
-
- /* statistics_xxx functions are for not essential statistic */
-
-#ifndef thread_safe_increment
-#ifdef HAVE_ATOMIC_ADD
-#define thread_safe_increment(V,L) atomic_add(1,(atomic_t*) &V);
-#define thread_safe_add(V,C,L) atomic_add((C),(atomic_t*) &V);
-#define thread_safe_sub(V,C,L) atomic_sub((C),(atomic_t*) &V);
-#define statistic_increment(V,L) thread_safe_increment((V),(L))
-#define statistic_add(V,C,L) thread_safe_add((V),(C),(L))
-#else
-#define thread_safe_increment(V,L) \
- pthread_mutex_lock((L)); (V)++; pthread_mutex_unlock((L));
-#define thread_safe_add(V,C,L) \
- pthread_mutex_lock((L)); (V)+=(C); pthread_mutex_unlock((L));
-#define thread_safe_sub(V,C,L) \
- pthread_mutex_lock((L)); (V)-=(C); pthread_mutex_unlock((L));
-#ifdef SAFE_STATISTICS
-#define statistic_increment(V,L) thread_safe_increment((V),(L))
-#define statistic_add(V,C,L) thread_safe_add((V),(C),(L))
-#else
-#define statistic_increment(V,L) (V)++
-#define statistic_add(V,C,L) (V)+=(C)
-#endif /* SAFE_STATISTICS */
-#endif /* HAVE_ATOMIC_ADD */
-#endif /* thread_safe_increment */
-#endif /* _my_ptread_h */
diff --git a/ext/mysql/libmysql/my_read.c b/ext/mysql/libmysql/my_read.c
deleted file mode 100644
index 3ca5bfb95a..0000000000
--- a/ext/mysql/libmysql/my_read.c
+++ /dev/null
@@ -1,52 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-#include "mysys_priv.h"
-#include "mysys_err.h"
-#include <errno.h>
-
-
- /* Read a chunk of bytes from a file */
-
-uint my_read(File Filedes, byte *Buffer, uint Count, myf MyFlags)
- /* File descriptor */
- /* Buffer must be at least count bytes */
- /* Max number of bytes returnd */
- /* Flags on what to do on error */
-{
- uint readbytes;
- DBUG_ENTER("my_read");
- DBUG_PRINT("my",("Fd: %d Buffer: %lx Count: %u MyFlags: %d",
- Filedes, Buffer, Count, MyFlags));
-
- for (;;)
- {
- errno=0; /* Linux doesn't reset this */
- if ((readbytes = (uint) read(Filedes, Buffer, Count)) != Count)
- {
- my_errno=errno ? errno : -1;
- DBUG_PRINT("warning",("Read only %ld bytes off %ld from %d, errno: %d",
- readbytes,Count,Filedes,my_errno));
-#ifdef THREAD
- if (readbytes == 0 && errno == EINTR)
- continue; /* Interrupted */
-#endif
- if (MyFlags & (MY_WME | MY_FAE | MY_FNABP))
- {
- if ((int) readbytes == -1)
- my_error(EE_READ, MYF(ME_BELL+ME_WAITTANG),
- my_filename(Filedes),my_errno);
- else if (MyFlags & (MY_NABP | MY_FNABP))
- my_error(EE_EOFERR, MYF(ME_BELL+ME_WAITTANG),
- my_filename(Filedes),my_errno);
- }
- if ((int) readbytes == -1 || (MyFlags & (MY_FNABP | MY_NABP)))
- DBUG_RETURN(MY_FILE_ERROR); /* Return with error */
- }
-
- if (MyFlags & (MY_NABP | MY_FNABP))
- readbytes=0; /* Ok on read */
- break;
- }
- DBUG_RETURN(readbytes);
-} /* my_read */
diff --git a/ext/mysql/libmysql/my_realloc.c b/ext/mysql/libmysql/my_realloc.c
deleted file mode 100644
index 48df8d3651..0000000000
--- a/ext/mysql/libmysql/my_realloc.c
+++ /dev/null
@@ -1,51 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-#ifdef SAFEMALLOC /* We don't need SAFEMALLOC here */
-#undef SAFEMALLOC
-#endif
-
-#include "mysys_priv.h"
-#include "mysys_err.h"
-
- /* My memory re allocator */
-
-gptr my_realloc(gptr oldpoint, uint Size, myf MyFlags)
-{
- gptr point;
- DBUG_ENTER("my_realloc");
- DBUG_PRINT("my",("ptr: %lx Size: %u MyFlags: %d",oldpoint, Size, MyFlags));
-
- if (!oldpoint && (MyFlags & MY_ALLOW_ZERO_PTR))
- DBUG_RETURN(my_malloc(Size,MyFlags));
-#ifdef USE_HALLOC
- if (!(point = malloc(Size)))
- {
- if (MyFlags & MY_FREE_ON_ERROR)
- my_free(oldpoint,MyFlags);
- if (MyFlags & MY_HOLD_ON_ERROR)
- DBUG_RETURN(oldpoint);
- my_errno=errno;
- if (MyFlags & MY_FAE+MY_WME)
- my_error(EE_OUTOFMEMORY, MYF(ME_BELL+ME_WAITTANG),Size);
- }
- else
- {
- memcpy(point,oldpoint,Size);
- free(oldpoint);
- }
-#else
- if ((point = realloc(oldpoint,Size)) == NULL)
- {
- if (MyFlags & MY_FREE_ON_ERROR)
- my_free(oldpoint,MyFLAGS);
- if (MyFlags & MY_HOLD_ON_ERROR)
- DBUG_RETURN(oldpoint);
- my_errno=errno;
- if (MyFlags & (MY_FAE+MY_WME))
- my_error(EE_OUTOFMEMORY, MYF(ME_BELL+ME_WAITTANG), Size);
- }
-#endif
- DBUG_PRINT("exit",("ptr: %lx",point));
- DBUG_RETURN(point);
-} /* my_realloc */
diff --git a/ext/mysql/libmysql/my_static.c b/ext/mysql/libmysql/my_static.c
deleted file mode 100644
index 418345fa77..0000000000
--- a/ext/mysql/libmysql/my_static.c
+++ /dev/null
@@ -1,86 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-/*
- Static variables for mysys library. All definied here for easy making of
- a shared library
-*/
-
-#ifndef stdin
-#include "mysys_priv.h"
-#include "my_static.h"
-#include "my_alarm.h"
-#endif
-
- /* from my_init */
-my_string home_dir=0,my_progname=0;
-char NEAR curr_dir[FN_REFLEN]= {0},
- NEAR home_dir_buff[FN_REFLEN]= {0};
-ulong my_stream_opened=0,my_file_opened=0, my_tmp_file_created=0;
-int NEAR my_umask=0664, NEAR my_umask_dir=0777;
-#ifndef THREAD
-int NEAR my_errno=0;
-#endif
-struct my_file_info my_file_info[MY_NFILE]= {{0,UNOPEN}};
-
- /* From mf_brkhant */
-int NEAR my_dont_interrupt=0;
-volatile int _my_signals=0;
-struct st_remember _my_sig_remember[MAX_SIGNALS]={{0,0}};
-#ifdef THREAD
-sigset_t my_signals; /* signals blocked by mf_brkhant */
-#endif
-
- /* from mf_keycache.c */
-my_bool key_cache_inited=0;
-
- /* from mf_reccache.c */
-ulong my_default_record_cache_size=RECORD_CACHE_SIZE;
-
- /* from soundex.c */
- /* ABCDEFGHIJKLMNOPQRSTUVWXYZ */
- /* :::::::::::::::::::::::::: */
-const char *soundex_map= "01230120022455012623010202";
-
- /* from my_malloc */
-USED_MEM* my_once_root_block=0; /* pointer to first block */
-uint my_once_extra=ONCE_ALLOC_INIT; /* Memory to alloc / block */
-
- /* from my_tempnam */
-#ifndef HAVE_TEMPNAM
-int _my_tempnam_used=0;
-#endif
-
- /* from safe_malloc */
-uint sf_malloc_prehunc=0, /* If you have problem with core- */
- sf_malloc_endhunc=0, /* dump when malloc-message.... */
- /* set theese to 64 or 128 */
- sf_malloc_quick=0; /* set if no calls to sanity */
-long lCurMemory = 0L; /* Current memory usage */
-long lMaxMemory = 0L; /* Maximum memory usage */
-uint cNewCount = 0; /* Number of times NEW() was called */
-byte *sf_min_adress= (byte*) ~(unsigned long) 0L,
- *sf_max_adress= (byte*) 0L;
-
-/* Root of the linked list of remembers */
-struct remember *pRememberRoot = NULL;
-
- /* from my_alarm */
-int volatile my_have_got_alarm=0; /* declare variable to reset */
-ulong my_time_to_wait_for_lock=2; /* In seconds */
-
- /* from errors.c */
-#ifdef SHARED_LIBRARY
-char * NEAR globerrs[GLOBERRS]; /* my_error_messages is here */
-#endif
-void (*my_abort_hook)(int) = (void(*)(int)) exit;
-int (*error_handler_hook)(uint error,const char *str,myf MyFlags)=
- my_message_no_curses;
-int (*fatal_error_handler_hook)(uint error,const char *str,myf MyFlags)=
- my_message_no_curses;
-
- /* How to disable options */
-my_bool NEAR my_disable_locking=0;
-my_bool NEAR my_disable_async_io=0;
-my_bool NEAR my_disable_flush_key_blocks=0;
-my_bool NEAR mysys_uses_curses=0;
diff --git a/ext/mysql/libmysql/my_static.h b/ext/mysql/libmysql/my_static.h
deleted file mode 100644
index 29a9b74026..0000000000
--- a/ext/mysql/libmysql/my_static.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-/*
- Static variables for mysys library. All definied here for easy making of
- a shared library
-*/
-
-#include "mysys_priv.h"
-#include <signal.h>
-
-#define MAX_SIGNALS 10 /* Max signals under a dont-allow */
-#define MIN_KEYBLOCK (min(IO_SIZE,1024))
-#define MAX_KEYBLOCK 8192 /* Max keyblocklength == 8*IO_SIZE */
-#define MAX_BLOCK_TYPES MAX_KEYBLOCK/MIN_KEYBLOCK
-
-struct st_remember {
- int number;
- sig_handler (*func)(int number);
-};
-
-struct irem {
- struct remember *_pNext; /* Linked list of structures */
- struct remember *_pPrev; /* Other link */
- my_string _sFileName; /* File in which memory was new'ed */
- uint _uLineNum; /* Line number in above file */
- uint _uDataSize; /* Size requested */
- long _lSpecialValue; /* Underrun marker value */
-};
-
-struct remember {
- struct irem tInt;
- char aData[1];
-};
-
-extern char NEAR curr_dir[FN_REFLEN],NEAR home_dir_buff[FN_REFLEN];
-
-extern volatile int _my_signals;
-extern struct st_remember _my_sig_remember[MAX_SIGNALS];
-
-extern const char *soundex_map;
-
-extern USED_MEM* my_once_root_block;
-extern uint my_once_extra;
-
-#ifndef HAVE_TEMPNAM
-extern int _my_tempnam_used;
-#endif
-
-extern byte *sf_min_adress,*sf_max_adress;
-extern uint cNewCount;
-extern struct remember *pRememberRoot;
-
-#if defined(THREAD) && !defined(__WIN__)
-extern sigset_t my_signals; /* signals blocked by mf_brkhant */
-#endif
diff --git a/ext/mysql/libmysql/my_sys.h b/ext/mysql/libmysql/my_sys.h
deleted file mode 100644
index 5a2689da2a..0000000000
--- a/ext/mysql/libmysql/my_sys.h
+++ /dev/null
@@ -1,589 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-#ifndef _my_sys_h
-#define _my_sys_h
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifdef HAVE_AIOWAIT
-#include <sys/asynch.h> /* Used by record-cache */
-typedef struct my_aio_result {
- aio_result_t result;
- int pending;
-} my_aio_result;
-#endif
-
-#ifndef THREAD
-extern int NEAR my_errno; /* Last error in mysys */
-#else
-#include <my_pthread.h>
-#endif
-
-#ifndef _m_ctype_h
-#include <m_ctype.h> /* for CHARSET_INFO */
-#endif
-
-#include <stdarg.h>
-
-#define MYSYS_PROGRAM_USES_CURSES() { error_handler_hook = my_message_curses; mysys_uses_curses=1; }
-#define MYSYS_PROGRAM_DONT_USE_CURSES() { error_handler_hook = my_message_no_curses; mysys_uses_curses=0;}
-#define MY_INIT(name); { my_progname= name; my_init(); }
-
-#define MAXMAPS (4) /* Number of error message maps */
-#define ERRMOD (1000) /* Max number of errors in a map */
-#define ERRMSGSIZE (SC_MAXWIDTH) /* Max length of a error message */
-#define NRERRBUFFS (2) /* Buffers for parameters */
-#define MY_FILE_ERROR ((uint) ~0)
-
- /* General bitmaps for my_func's */
-#define MY_FFNF 1 /* Fatal if file not found */
-#define MY_FNABP 2 /* Fatal if not all bytes read/writen */
-#define MY_NABP 4 /* Error if not all bytes read/writen */
-#define MY_FAE 8 /* Fatal if any error */
-#define MY_WME 16 /* Write message on error */
-#define MY_WAIT_IF_FULL 32 /* Wait and try again if disk full error */
-#define MY_RAID 64 /* Support for RAID (not the "Johnson&Johnson"-s one ;) */
-#define MY_DONT_CHECK_FILESIZE 128 /* Option to init_io_cache() */
-#define MY_LINK_WARNING 32 /* my_redel() gives warning if links */
-#define MY_COPYTIME 64 /* my_redel() copys time */
-#define MY_DELETE_OLD 256 /* my_create_with_symlink() */
-#define MY_RESOLVE_LINK 128 /* my_realpath(); Only resolve links */
-#define MY_HOLD_ORIGINAL_MODES 128 /* my_copy() holds to file modes */
-#define MY_REDEL_MAKE_BACKUP 256
-#define MY_SEEK_NOT_DONE 32 /* my_lock may have to do a seek */
-#define MY_DONT_WAIT 64 /* my_lock() don't wait if can't lock */
-#define MY_ZEROFILL 32 /* my_malloc(), fill array with zero */
-#define MY_ALLOW_ZERO_PTR 64 /* my_realloc() ; zero ptr -> malloc */
-#define MY_FREE_ON_ERROR 128 /* my_realloc() ; Free old ptr on error */
-#define MY_HOLD_ON_ERROR 256 /* my_realloc() ; Return old ptr on error */
-#define MY_THREADSAFE 128 /* pread/pwrite: Don't allow interrupts */
-
-#define MY_CHECK_ERROR 1 /* Params to my_end; Check open-close */
-#define MY_GIVE_INFO 2 /* Give time info about process*/
-
-#define ME_HIGHBYTE 8 /* Shift for colours */
-#define ME_NOCUR 1 /* Don't use curses message */
-#define ME_OLDWIN 2 /* Use old window */
-#define ME_BELL 4 /* Ring bell then printing message */
-#define ME_HOLDTANG 8 /* Don't delete last keys */
-#define ME_WAITTOT 16 /* Wait for errtime secs of for a action */
-#define ME_WAITTANG 32 /* Wait for a user action */
-#define ME_NOREFRESH 64 /* Dont refresh screen */
-#define ME_NOINPUT 128 /* Dont use the input libary */
-#define ME_COLOUR1 ((1 << ME_HIGHBYTE)) /* Possibly error-colours */
-#define ME_COLOUR2 ((2 << ME_HIGHBYTE))
-#define ME_COLOUR3 ((3 << ME_HIGHBYTE))
-
- /* My seek flags */
-#define MY_SEEK_SET 0
-#define MY_SEEK_CUR 1
-#define MY_SEEK_END 2
-
- /* My charsets_list flags */
-#define MY_NO_SETS 0
-#define MY_COMPILED_SETS 1 /* show compiled-in sets */
-#define MY_CONFIG_SETS 2 /* sets that have a *.conf file */
-#define MY_INDEX_SETS 4 /* all sets listed in the Index file */
-#define MY_LOADED_SETS 8 /* the sets that are currently loaded */
-
- /* Some constants */
-#define MY_WAIT_FOR_USER_TO_FIX_PANIC 60 /* in seconds */
-#define MY_WAIT_GIVE_USER_A_MESSAGE 10 /* Every 10 times of prev */
-#define MIN_COMPRESS_LENGTH 50 /* Don't compress small bl. */
-#define KEYCACHE_BLOCK_SIZE 1024
-
- /* root_alloc flags */
-#define MY_KEEP_PREALLOC 1
-
- /* defines when allocating data */
-
-#ifdef SAFEMALLOC
-#define my_malloc(SZ,FLAG) _mymalloc( SZ, __FILE__, __LINE__, FLAG )
-#define my_realloc(PTR,SZ,FLAG) _myrealloc( PTR, SZ, __FILE__, __LINE__, FLAG )
-#define my_checkmalloc() _sanity( __FILE__, __LINE__ )
-#define my_free(PTR,FLAG) _myfree( PTR, __FILE__, __LINE__,FLAG)
-#define my_memdup(A,B,C) _my_memdup(A,B,__FILE__,__LINE__,C)
-#define my_strdup(A,C) _my_strdup(A,__FILE__,__LINE__,C)
-#define QUICK_SAFEMALLOC sf_malloc_quick=1
-#define NORMAL_SAFEMALLOC sf_malloc_quick=0
-extern uint sf_malloc_prehunc,sf_malloc_endhunc,sf_malloc_quick;
-extern ulonglong safemalloc_mem_limit;
-#else
-#define my_checkmalloc() (0)
-#define TERMINATE(A) {}
-#define QUICK_SAFEMALLOC
-#define NORMAL_SAFEMALLOC
-extern gptr my_malloc(uint Size,myf MyFlags);
-extern gptr my_realloc(gptr oldpoint,uint Size,myf MyFlags);
-extern void my_no_flags_free(gptr ptr);
-extern gptr my_memdup(const byte *from,uint length,myf MyFlags);
-extern my_string my_strdup(const char *from,myf MyFlags);
-#define my_free(PTR,FG) my_no_flags_free(PTR)
-#endif
-#ifdef HAVE_ALLOCA
-#define my_alloca(SZ) alloca((size_t) (SZ))
-#define my_afree(PTR) {}
-#else
-#define my_alloca(SZ) my_malloc(SZ,MYF(0))
-#define my_afree(PTR) my_free(PTR,MYF(MY_WME))
-#endif /* HAVE_ALLOCA */
-#ifdef MSDOS
-#ifdef __ZTC__
-void * __CDECL halloc(long count,size_t length);
-void __CDECL hfree(void *ptr);
-#endif
-#if defined(USE_HALLOC)
-#if defined(_VCM_) || defined(M_IC80386)
-#undef USE_HALLOC
-#endif
-#endif
-#ifdef USE_HALLOC
-#define malloc(a) halloc((long) (a),1)
-#define free(a) hfree(a)
-#endif
-#endif /* MSDOS */
-
-#ifdef HAVE_ERRNO_AS_DEFINE
-#include <errno.h> /* errno is a define */
-#else
-extern int errno; /* declare errno */
-#endif
-extern const char ** NEAR my_errmsg[];
-extern char NEAR errbuff[NRERRBUFFS][ERRMSGSIZE];
-extern char *home_dir; /* Home directory for user */
-extern char *my_progname; /* program-name (printed in errors) */
-extern char NEAR curr_dir[]; /* Current directory for user */
-extern int (*error_handler_hook)(uint my_err, const char *str,myf MyFlags);
-extern int (*fatal_error_handler_hook)(uint my_err, const char *str,
- myf MyFlags);
-
-/* charsets */
-extern uint get_charset_number(const char *cs_name);
-extern const char *get_charset_name(uint cs_number);
-extern CHARSET_INFO *get_charset(uint cs_number, myf flags);
-extern my_bool set_default_charset(uint cs, myf flags);
-extern CHARSET_INFO *get_charset_by_name(const char *cs_name, myf flags);
-extern my_bool set_default_charset_by_name(const char *cs_name, myf flags);
-extern void free_charsets(void);
-extern char *list_charsets(myf want_flags); /* my_free() this string... */
-extern char *get_charsets_dir(char *buf);
-
-
-/* statistics */
-extern ulong _my_cache_w_requests,_my_cache_write,_my_cache_r_requests,
- _my_cache_read;
-extern ulong _my_blocks_used,_my_blocks_changed;
-extern ulong my_file_opened,my_stream_opened, my_tmp_file_created;
-extern my_bool key_cache_inited;
-
- /* Point to current my_message() */
-extern void (*my_sigtstp_cleanup)(void),
- /* Executed before jump to shell */
- (*my_sigtstp_restart)(void),
- (*my_abort_hook)(int);
- /* Executed when comming from shell */
-extern int NEAR my_umask, /* Default creation mask */
- NEAR my_umask_dir,
- NEAR my_recived_signals, /* Signals we have got */
- NEAR my_safe_to_handle_signal, /* Set when allowed to SIGTSTP */
- NEAR my_dont_interrupt; /* call remember_intr when set */
-extern my_bool NEAR mysys_uses_curses, my_use_symdir;
-extern long lCurMemory,lMaxMemory; /* from safemalloc */
-
-extern ulong my_default_record_cache_size;
-extern my_bool NEAR my_disable_locking,NEAR my_disable_async_io,
- NEAR my_disable_flush_key_blocks;
-extern char wild_many,wild_one,wild_prefix;
-extern const char *charsets_dir;
-extern char *defaults_extra_file;
-
-typedef struct wild_file_pack /* Struct to hold info when selecting files */
-{
- uint wilds; /* How many wildcards */
- uint not_pos; /* Start of not-theese-files */
- my_string *wild; /* Pointer to wildcards */
-} WF_PACK;
-
-typedef struct st_typelib { /* Different types saved here */
- uint count; /* How many types */
- const char *name; /* Name of typelib */
- const char **type_names;
-} TYPELIB;
-
-enum cache_type {READ_CACHE,WRITE_CACHE,READ_FIFO,READ_NET,WRITE_NET};
-enum flush_type { FLUSH_KEEP, FLUSH_RELEASE, FLUSH_IGNORE_CHANGED,
- FLUSH_FORCE_WRITE};
-
-typedef struct st_record_cache /* Used when cacheing records */
-{
- File file;
- int rc_seek,error,inited;
- uint rc_length,read_length,reclength;
- my_off_t rc_record_pos,end_of_file;
- byte *rc_buff,*rc_buff2,*rc_pos,*rc_end,*rc_request_pos;
-#ifdef HAVE_AIOWAIT
- int use_async_io;
- my_aio_result aio_result;
-#endif
- enum cache_type type;
-} RECORD_CACHE;
-
-enum file_type { UNOPEN = 0, FILE_BY_OPEN, FILE_BY_CREATE,
- STREAM_BY_FOPEN, STREAM_BY_FDOPEN, FILE_BY_MKSTEMP };
-
-extern struct my_file_info
-{
- my_string name;
- enum file_type type;
-#if defined(THREAD) && !defined(HAVE_PREAD)
- pthread_mutex_t mutex;
-#endif
-} my_file_info[MY_NFILE];
-
-
-typedef struct st_dynamic_array {
- char *buffer;
- uint elements,max_element;
- uint alloc_increment;
- uint size_of_element;
-} DYNAMIC_ARRAY;
-
-typedef struct st_dynamic_string {
- char *str;
- uint length,max_length,alloc_increment;
-} DYNAMIC_STRING;
-
-
-typedef struct st_io_cache /* Used when cacheing files */
-{
- my_off_t pos_in_file,end_of_file;
- byte *rc_pos,*rc_end,*buffer,*rc_request_pos;
- int (*read_function)(struct st_io_cache *,byte *,uint);
- char *file_name; /* if used with 'open_cached_file' */
- char *dir,*prefix;
- File file;
- int seek_not_done,error;
- uint buffer_length,read_length;
- myf myflags; /* Flags used to my_read/my_write */
- enum cache_type type;
-#ifdef HAVE_AIOWAIT
- uint inited;
- my_off_t aio_read_pos;
- my_aio_result aio_result;
-#endif
-} IO_CACHE;
-
-typedef int (*qsort2_cmp)(const void *, const void *, const void *);
-
- /* defines for mf_iocache */
-
- /* Test if buffer is inited */
-#define my_b_clear(info) (info)->buffer=0
-#define my_b_inited(info) (info)->buffer
-#define my_b_EOF INT_MIN
-
-#define my_b_read(info,Buffer,Count) \
- ((info)->rc_pos + (Count) <= (info)->rc_end ?\
- (memcpy(Buffer,(info)->rc_pos,(size_t) (Count)), \
- ((info)->rc_pos+=(Count)),0) :\
- (*(info)->read_function)((info),Buffer,Count))
-
-#define my_b_get(info) \
- ((info)->rc_pos != (info)->rc_end ?\
- ((info)->rc_pos++, (int) (uchar) (info)->rc_pos[-1]) :\
- _my_b_get(info))
-
-#define my_b_write(info,Buffer,Count) \
- ((info)->rc_pos + (Count) <= (info)->rc_end ?\
- (memcpy((info)->rc_pos,Buffer,(size_t) (Count)), \
- ((info)->rc_pos+=(Count)),0) :\
- _my_b_write(info,Buffer,Count))
-
- /* my_b_write_byte dosn't have any err-check */
-#define my_b_write_byte(info,chr) \
- (((info)->rc_pos < (info)->rc_end) ?\
- ((*(info)->rc_pos++)=(chr)) :\
- (_my_b_write(info,0,0) , ((*(info)->rc_pos++)=(chr))))
-
-#define my_b_fill_cache(info) \
- (((info)->rc_end=(info)->rc_pos),(*(info)->read_function)(info,0,0))
-
-#define my_b_tell(info) ((info)->pos_in_file + \
- ((info)->rc_pos - (info)->rc_request_pos))
-
-#define my_b_bytes_in_cache(info) ((uint) ((info)->rc_end - (info)->rc_pos))
-
-typedef struct st_changeable_var {
- const char *name; /* Name of variable */
- long *varptr; /* Pointer to variable */
- long def_value, /* Default value */
- min_value, /* Min allowed value */
- max_value, /* Max allowed value */
- sub_size, /* Subtract this from given value */
- block_size; /* Value should be a mult. of this */
-} CHANGEABLE_VAR;
-
-
-/* structs for alloc_root */
-
-#ifndef ST_USED_MEM_DEFINED
-#define ST_USED_MEM_DEFINED
-typedef struct st_used_mem { /* struct for once_alloc */
- struct st_used_mem *next; /* Next block in use */
- unsigned int left; /* memory left in block */
- unsigned int size; /* Size of block */
-} USED_MEM;
-
-typedef struct st_mem_root {
- USED_MEM *free;
- USED_MEM *used;
- USED_MEM *pre_alloc;
- unsigned int min_malloc;
- unsigned int block_size;
-
- void (*error_handler)(void);
-} MEM_ROOT;
-#endif
-
- /* Prototypes for mysys and my_func functions */
-
-extern int my_copy(const char *from,const char *to,myf MyFlags);
-extern int my_append(const char *from,const char *to,myf MyFlags);
-extern int my_delete(const char *name,myf MyFlags);
-extern int my_getwd(my_string buf,uint size,myf MyFlags);
-extern int my_setwd(const char *dir,myf MyFlags);
-extern int my_lock(File fd,int op,my_off_t start, my_off_t length,myf MyFlags);
-extern gptr my_once_alloc(uint Size,myf MyFlags);
-extern void my_once_free(void);
-extern my_string my_tempnam(const char *dir,const char *pfx,myf MyFlags);
-extern File my_open(const char *FileName,int Flags,myf MyFlags);
-extern File my_register_filename(File fd, const char *FileName,
- enum file_type type_of_file,
- uint error_message_number, myf MyFlags);
-extern File my_create(const char *FileName,int CreateFlags,
- int AccsesFlags, myf MyFlags);
-extern int my_close(File Filedes,myf MyFlags);
-extern int my_mkdir(const char *dir, int Flags, myf MyFlags);
-extern int my_readlink(char *to, const char *filename, myf MyFlags);
-extern int my_realpath(char *to, const char *filename, myf MyFlags);
-extern File my_create_with_symlink(const char *linkname, const char *filename,
- int createflags, int access_flags,
- myf MyFlags);
-extern int my_symlink(const char *content, const char *linkname, myf MyFlags);
-extern uint my_read(File Filedes,byte *Buffer,uint Count,myf MyFlags);
-extern uint my_pread(File Filedes,byte *Buffer,uint Count,my_off_t offset,
- myf MyFlags);
-extern int my_rename(const char *from,const char *to,myf MyFlags);
-extern my_off_t my_seek(File fd,my_off_t pos,int whence,myf MyFlags);
-extern my_off_t my_tell(File fd,myf MyFlags);
-extern uint my_write(File Filedes,const byte *Buffer,uint Count,
- myf MyFlags);
-extern uint my_pwrite(File Filedes,const byte *Buffer,uint Count,
- my_off_t offset,myf MyFlags);
-extern uint my_fread(FILE *stream,byte *Buffer,uint Count,myf MyFlags);
-extern uint my_fwrite(FILE *stream,const byte *Buffer,uint Count,
- myf MyFlags);
-extern my_off_t my_fseek(FILE *stream,my_off_t pos,int whence,myf MyFlags);
-extern my_off_t my_ftell(FILE *stream,myf MyFlags);
-extern gptr _mymalloc(uint uSize,const char *sFile,
- uint uLine, myf MyFlag);
-extern gptr _myrealloc(gptr pPtr,uint uSize,const char *sFile,
- uint uLine, myf MyFlag);
-extern gptr my_multi_malloc _VARARGS((myf MyFlags, ...));
-extern void _myfree(gptr pPtr,const char *sFile,uint uLine, myf MyFlag);
-extern int _sanity(const char *sFile,unsigned int uLine);
-extern gptr _my_memdup(const byte *from,uint length,
- const char *sFile, uint uLine,myf MyFlag);
-extern my_string _my_strdup(const char *from, const char *sFile, uint uLine,
- myf MyFlag);
-#ifndef TERMINATE
-extern void TERMINATE(FILE *file);
-#endif
-extern void init_glob_errs(void);
-extern FILE *my_fopen(const char *FileName,int Flags,myf MyFlags);
-extern FILE *my_fdopen(File Filedes,const char *name, int Flags,myf MyFlags);
-extern int my_fclose(FILE *fd,myf MyFlags);
-extern int my_chsize(File fd,my_off_t newlength,myf MyFlags);
-extern int my_error _VARARGS((int nr,myf MyFlags, ...));
-extern int my_printf_error _VARARGS((uint my_err, const char *format,
- myf MyFlags, ...)
- __attribute__ ((format (printf, 2, 4))));
-extern int my_vsnprintf( char *str, size_t n,
- const char *format, va_list ap );
-extern int my_snprintf(char* to, size_t n, const char* fmt, ...);
-extern int my_message(uint my_err, const char *str,myf MyFlags);
-extern int my_message_no_curses(uint my_err, const char *str,myf MyFlags);
-extern int my_message_curses(uint my_err, const char *str,myf MyFlags);
-extern void my_init(void);
-extern void my_end(int infoflag);
-extern int my_redel(const char *from, const char *to, int MyFlags);
-extern int my_copystat(const char *from, const char *to, int MyFlags);
-extern my_string my_filename(File fd);
-
-#ifndef THREAD
-extern void dont_break(void);
-extern void allow_break(void);
-#else
-#define dont_break()
-#define allow_break()
-#endif
-
-extern void my_remember_signal(int signal_number,sig_handler (*func)(int));
-extern void caseup(my_string str,uint length);
-extern void casedn(my_string str,uint length);
-extern void caseup_str(my_string str);
-extern void casedn_str(my_string str);
-extern void case_sort(my_string str,uint length);
-extern uint dirname_part(my_string to,const char *name);
-extern uint dirname_length(const char *name);
-#define base_name(A) (A+dirname_length(A))
-extern int test_if_hard_path(const char *dir_name);
-extern char *convert_dirname(my_string name);
-extern void to_unix_path(my_string name);
-extern my_string fn_ext(const char *name);
-extern my_string fn_same(my_string toname,const char *name,int flag);
-extern my_string fn_format(my_string to,const char *name,const char *dsk,
- const char *form,int flag);
-extern size_s strlength(const char *str);
-extern void pack_dirname(my_string to,const char *from);
-extern uint unpack_dirname(my_string to,const char *from);
-extern uint cleanup_dirname(my_string to,const char *from);
-extern uint system_filename(my_string to,const char *from);
-extern my_string unpack_filename(my_string to,const char *from);
-extern my_string intern_filename(my_string to,const char *from);
-extern my_string directory_file_name(my_string dst, const char *src);
-extern int pack_filename(my_string to, const char *name, size_s max_length);
-extern my_string my_path(my_string to,const char *progname,
- const char *own_pathname_part);
-extern my_string my_load_path(my_string to, const char *path,
- const char *own_path_prefix);
-extern int wild_compare(const char *str,const char *wildstr);
-extern my_string my_strcasestr(const char *src,const char *suffix);
-extern int my_strcasecmp(const char *s,const char *t);
-extern int my_strsortcmp(const char *s,const char *t);
-extern int my_casecmp(const char *s,const char *t,uint length);
-extern int my_sortcmp(const char *s,const char *t,uint length);
-extern int my_sortncmp(const char *s,uint s_len, const char *t,uint t_len);
-extern WF_PACK *wf_comp(my_string str);
-extern int wf_test(struct wild_file_pack *wf_pack,const char *name);
-extern void wf_end(struct wild_file_pack *buffer);
-extern size_s stripp_sp(my_string str);
-extern void get_date(my_string to,int timeflag,time_t use_time);
-extern void soundex(my_string out_pntr, my_string in_pntr,pbool remove_garbage);
-extern int init_record_cache(RECORD_CACHE *info,uint cachesize,File file,
- uint reclength,enum cache_type type,
- pbool use_async_io);
-extern int read_cache_record(RECORD_CACHE *info,byte *to);
-extern int end_record_cache(RECORD_CACHE *info);
-extern int write_cache_record(RECORD_CACHE *info,my_off_t filepos,
- const byte *record,uint length);
-extern int flush_write_cache(RECORD_CACHE *info);
-extern long my_clock(void);
-extern sig_handler sigtstp_handler(int signal_number);
-extern void handle_recived_signals(void);
-extern int init_key_cache(ulong use_mem,ulong leave_this_much_mem);
-extern byte *key_cache_read(File file,my_off_t filepos,byte* buff,uint length,
- uint block_length,int return_buffer);
-extern int key_cache_write(File file,my_off_t filepos,byte* buff,uint length,
- uint block_length,int force_write);
-extern int flush_key_blocks(int file, enum flush_type type);
-extern void end_key_cache(void);
-extern sig_handler my_set_alarm_variable(int signo);
-extern void my_string_ptr_sort(void *base,uint items,size_s size);
-extern void radixsort_for_str_ptr(uchar* base[], uint number_of_elements,
- size_s size_of_element,uchar *buffer[]);
-extern qsort_t qsort2(void *base_ptr, size_t total_elems, size_t size,
- qsort2_cmp cmp, void *cmp_argument);
-extern qsort2_cmp get_ptr_compare(uint);
-extern int init_io_cache(IO_CACHE *info,File file,uint cachesize,
- enum cache_type type,my_off_t seek_offset,
- pbool use_async_io, myf cache_myflags);
-extern my_bool reinit_io_cache(IO_CACHE *info,enum cache_type type,
- my_off_t seek_offset,pbool use_async_io,
- pbool clear_cache);
-extern int _my_b_read(IO_CACHE *info,byte *Buffer,uint Count);
-extern int _my_b_net_read(IO_CACHE *info,byte *Buffer,uint Count);
-extern int _my_b_get(IO_CACHE *info);
-extern int _my_b_async_read(IO_CACHE *info,byte *Buffer,uint Count);
-extern int _my_b_write(IO_CACHE *info,const byte *Buffer,uint Count);
-extern int my_block_write(IO_CACHE *info, const byte *Buffer,
- uint Count, my_off_t pos);
-extern int flush_io_cache(IO_CACHE *info);
-extern int end_io_cache(IO_CACHE *info);
-extern uint my_b_fill(IO_CACHE *info);
-extern void my_b_seek(IO_CACHE *info,my_off_t pos);
-extern uint my_b_gets(IO_CACHE *info, char *to, uint max_length);
-extern uint my_b_printf(IO_CACHE *info, const char* fmt, ...);
-extern uint my_b_vprintf(IO_CACHE *info, const char* fmt, va_list ap);
-extern my_bool open_cached_file(IO_CACHE *cache,const char *dir,
- const char *prefix, uint cache_size,
- myf cache_myflags);
-extern my_bool real_open_cached_file(IO_CACHE *cache);
-extern void close_cached_file(IO_CACHE *cache);
-File create_temp_file(char *to, const char *dir, const char *pfx,
- int mode, myf MyFlags);
-extern my_bool init_dynamic_array(DYNAMIC_ARRAY *array,uint element_size,
- uint init_alloc,uint alloc_increment);
-extern my_bool insert_dynamic(DYNAMIC_ARRAY *array,gptr element);
-extern byte *alloc_dynamic(DYNAMIC_ARRAY *array);
-extern byte *pop_dynamic(DYNAMIC_ARRAY*);
-extern my_bool set_dynamic(DYNAMIC_ARRAY *array,gptr element,uint array_index);
-extern void get_dynamic(DYNAMIC_ARRAY *array,gptr element,uint array_index);
-extern void delete_dynamic(DYNAMIC_ARRAY *array);
-extern void delete_dynamic_element(DYNAMIC_ARRAY *array, uint array_index);
-extern void freeze_size(DYNAMIC_ARRAY *array);
-#define dynamic_array_ptr(array,array_index) ((array)->buffer+(array_index)*(array)->size_of_element)
-#define dynamic_element(array,array_index,type) ((type)((array)->buffer) +(array_index))
-#define push_dynamic(A,B) insert_dynamic(A,B)
-
-extern int find_type(my_string x,TYPELIB *typelib,uint full_name);
-extern void make_type(my_string to,uint nr,TYPELIB *typelib);
-extern const char *get_type(TYPELIB *typelib,uint nr);
-extern my_bool init_dynamic_string(DYNAMIC_STRING *str, const char *init_str,
- uint init_alloc,uint alloc_increment);
-extern my_bool dynstr_append(DYNAMIC_STRING *str, const char *append);
-my_bool dynstr_append_mem(DYNAMIC_STRING *str, const char *append,
- uint length);
-extern my_bool dynstr_set(DYNAMIC_STRING *str, const char *init_str);
-extern my_bool dynstr_realloc(DYNAMIC_STRING *str, ulong additional_size);
-extern void dynstr_free(DYNAMIC_STRING *str);
-void set_all_changeable_vars(CHANGEABLE_VAR *vars);
-my_bool set_changeable_var(my_string str,CHANGEABLE_VAR *vars);
-my_bool set_changeable_varval(const char *var, ulong val,
- CHANGEABLE_VAR *vars);
-#ifdef HAVE_MLOCK
-extern byte *my_malloc_lock(uint length,myf flags);
-extern void my_free_lock(byte *ptr,myf flags);
-#else
-#define my_malloc_lock(A,B) my_malloc((A),(B))
-#define my_free_lock(A,B) my_free((A),(B))
-#endif
-#define alloc_root_inited(A) ((A)->min_malloc != 0)
-void init_alloc_root(MEM_ROOT *mem_root, uint block_size, uint pre_alloc_size);
-gptr alloc_root(MEM_ROOT *mem_root,unsigned int Size);
-void free_root(MEM_ROOT *root, myf MyFLAGS);
-char *strdup_root(MEM_ROOT *root,const char *str);
-char *memdup_root(MEM_ROOT *root,const char *str,uint len);
-void load_defaults(const char *conf_file, const char **groups,
- int *argc, char ***argv);
-void free_defaults(char **argv);
-void print_defaults(const char *conf_file, const char **groups);
-my_bool my_compress(byte *, ulong *, ulong *);
-my_bool my_uncompress(byte *, ulong *, ulong *);
-byte *my_compress_alloc(const byte *packet, ulong *len, ulong *complen);
-ulong checksum(const byte *mem, uint count);
-
-#if defined(_MSC_VER) && !defined(__WIN__)
-extern void sleep(int sec);
-#endif
-#ifdef __WIN__
-extern my_bool have_tcpip; /* Is set if tcpip is used */
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-#include "raid.h"
-#endif /* _my_sys_h */
diff --git a/ext/mysql/libmysql/my_tempnam.c b/ext/mysql/libmysql/my_tempnam.c
deleted file mode 100644
index f6296398ee..0000000000
--- a/ext/mysql/libmysql/my_tempnam.c
+++ /dev/null
@@ -1,128 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-#include "mysys_priv.h"
-#include <m_string.h>
-#include "my_static.h"
-#include "mysys_err.h"
-
-#define TMP_EXT ".tmp" /* Extension of tempfile */
-#if ! defined(P_tmpdir)
-#define P_tmpdir ""
-#endif
-
-#ifdef HAVE_TEMPNAM
-#ifndef MSDOS
-extern char **environ;
-#endif
-#endif
-
-/* Make a uniq temp file name by using dir and adding something after
- pfx to make name uniq. Name is made by adding a uniq 8 length-string and
- TMP_EXT after pfx.
- Returns pointer to malloced area for filename. Should be freed by
- free().
- The name should be uniq, but it isn't checked if it file allready exists.
- Uses tempnam() if function exist on system.
- This function fixes that if dir is given it's used. For example
- MSDOS tempnam() uses always TMP environment-variable if it exists.
-*/
- /* ARGSUSED */
-
-my_string my_tempnam(const char *dir, const char *pfx,
- myf MyFlags __attribute__((unused)))
-{
-#ifdef _MSC_VER
- char temp[FN_REFLEN],*end,*res,**old_env,*temp_env[1];
- old_env=environ;
- if (dir)
- {
- end=strend(dir)-1;
- if (!dir[0])
- { /* Change empty string to current dir */
- temp[0]= FN_CURLIB;
- temp[1]= 0;
- dir=temp;
- }
- else if (*end == FN_DEVCHAR)
- { /* Get current dir for drive */
- _fullpath(temp,dir,FN_REFLEN);
- dir=temp;
- }
- else if (*end == FN_LIBCHAR && dir < end && end[-1] != FN_DEVCHAR)
- {
- strmake(temp,dir,(uint) (end-dir)); /* Copy and remove last '\' */
- dir=temp;
- }
- environ=temp_env; /* Force use of dir (dir not checked) */
- temp_env[0]=0;
- }
- res=tempnam((char*) dir,(my_string) pfx);
- environ=old_env;
- return res;
-#else
-#ifdef __ZTC__
- if (!dir)
- { /* If empty test first if TMP can be used */
- dir=getenv("TMP");
- }
- return tempnam((char*) dir,(my_string) pfx); /* Use stand. dir with prefix */
-#else
-#ifdef HAVE_TEMPNAM
- char temp[2],*res,**old_env,*temp_env[1];
-
- if (dir && !dir[0])
- { /* Change empty string to current dir */
- temp[0]= FN_CURLIB;
- temp[1]= 0;
- dir=temp;
- }
- old_env=environ;
- if (dir)
- { /* Don't use TMPDIR if dir is given */
- environ=temp_env;
- temp_env[0]=0;
- }
- res=tempnam((char*) dir,(my_string) pfx); /* Use stand. dir with prefix */
- environ=old_env;
- if (!res)
- DBUG_PRINT("error",("Got error: %d from tempnam",errno));
- return res;
-#else
- register long uniq;
- register int length;
- my_string pos,end_pos;
- DBUG_ENTER("my_tempnam");
- /* Make a uniq nummber */
- pthread_mutex_lock(&THR_LOCK_open);
- uniq= ((long) getpid() << 20) + (long) _my_tempnam_used++ ;
- pthread_mutex_unlock(&THR_LOCK_open);
- if (!dir && !(dir=getenv("TMPDIR"))) /* Use this if possibly */
- dir=P_tmpdir; /* Use system default */
- length=strlen(dir)+strlen(pfx)+1;
-
- DBUG_PRINT("test",("mallocing %d byte",length+8+sizeof(TMP_EXT)+1));
- if (!(pos=(char*) malloc(length+8+sizeof(TMP_EXT)+1)))
- {
- if (MyFlags & MY_FAE+MY_WME)
- my_error(EE_OUTOFMEMORY, MYF(ME_BELL+ME_WAITTANG),
- length+8+sizeof(TMP_EXT)+1);
- DBUG_RETURN(NullS);
- }
- end_pos=strmov(pos,dir);
- if (end_pos != pos && end_pos[-1] != FN_LIBCHAR)
- *end_pos++=FN_LIBCHAR;
- end_pos=strmov(end_pos,pfx);
-
- for (length=0 ; length < 8 && uniq ; length++)
- {
- *end_pos++= _dig_vec[(int) (uniq & 31)];
- uniq >>= 5;
- }
- VOID(strmov(end_pos,TMP_EXT));
- DBUG_PRINT("exit",("tempnam: '%s'",pos));
- DBUG_RETURN(pos);
-#endif /* HAVE_TEMPNAM */
-#endif /* __ZTC__ */
-#endif /* _MSC_VER */
-} /* my_tempnam */
diff --git a/ext/mysql/libmysql/my_thr_init.c b/ext/mysql/libmysql/my_thr_init.c
deleted file mode 100644
index 0d0e755bcd..0000000000
--- a/ext/mysql/libmysql/my_thr_init.c
+++ /dev/null
@@ -1,212 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-/*
-** Functions to handle initializating and allocationg of all mysys & debug
-** thread variables.
-*/
-
-#include "mysys_priv.h"
-#include <m_string.h>
-
-#ifdef THREAD
-#ifdef USE_TLS
-pthread_key(struct st_my_thread_var*, THR_KEY_mysys);
-#else
-pthread_key(struct st_my_thread_var, THR_KEY_mysys);
-#endif /* USE_TLS */
-pthread_mutex_t THR_LOCK_malloc,THR_LOCK_open,THR_LOCK_keycache,
- THR_LOCK_lock,THR_LOCK_isam,THR_LOCK_myisam,THR_LOCK_heap,
- THR_LOCK_net, THR_LOCK_charset;
-#ifndef HAVE_LOCALTIME_R
-pthread_mutex_t LOCK_localtime_r;
-#endif
-#ifdef PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP
-pthread_mutexattr_t my_fast_mutexattr;
-#endif
-#ifdef PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP
-pthread_mutexattr_t my_errchk_mutexattr;
-#endif
-
-/* FIXME Note. TlsAlloc does not set an auto destructor, so
- the function my_thread_global_free must be called from
- somewhere before final exit of the library */
-
-my_bool my_thread_global_init(void)
-{
- if (pthread_key_create(&THR_KEY_mysys,free))
- {
- fprintf(stderr,"Can't initialize threads: error %d\n",errno);
- exit(1);
- }
-#ifdef PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP
- pthread_mutexattr_init(&my_fast_mutexattr);
- pthread_mutexattr_setkind_np(&my_fast_mutexattr,PTHREAD_MUTEX_ADAPTIVE_NP);
-#endif
-#ifdef PPTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP
- pthread_mutexattr_init(&my_errchk_mutexattr);
- pthread_mutexattr_setkind_np(&my_errchk_mutexattr,
- PTHREAD_MUTEX_ERRORCHECK_NP);
-#endif
-
- pthread_mutex_init(&THR_LOCK_malloc,MY_MUTEX_INIT_FAST);
- pthread_mutex_init(&THR_LOCK_open,MY_MUTEX_INIT_FAST);
- pthread_mutex_init(&THR_LOCK_keycache,MY_MUTEX_INIT_FAST);
- pthread_mutex_init(&THR_LOCK_lock,MY_MUTEX_INIT_FAST);
- pthread_mutex_init(&THR_LOCK_isam,MY_MUTEX_INIT_SLOW);
- pthread_mutex_init(&THR_LOCK_myisam,MY_MUTEX_INIT_SLOW);
- pthread_mutex_init(&THR_LOCK_heap,MY_MUTEX_INIT_FAST);
- pthread_mutex_init(&THR_LOCK_net,MY_MUTEX_INIT_FAST);
- pthread_mutex_init(&THR_LOCK_charset,MY_MUTEX_INIT_FAST);
-#ifdef __WIN__
- win_pthread_init();
-#endif
-#ifndef HAVE_LOCALTIME_R
- pthread_mutex_init(&LOCK_localtime_r,MY_MUTEX_INIT_SLOW);
-#endif
- return my_thread_init();
-}
-
-void my_thread_global_end(void)
-{
-#if defined(USE_TLS)
- (void) TlsFree(THR_KEY_mysys);
-#endif
-#ifdef PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP
- pthread_mutexattr_destroy(&my_fast_mutexattr);
-#endif
-#ifdef PPTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP
- pthread_mutexattr_destroy(&my_errchk_mutexattr);
-#endif
-}
-
-static long thread_id=0;
-
-/*
- We can't use mutex_locks here if we are using windows as
- we may have compiled the program with SAFE_MUTEX, in which
- case the checking of mutex_locks will not work until
- the pthread_self thread specific variable is initialized.
-*/
-
-my_bool my_thread_init(void)
-{
- struct st_my_thread_var *tmp;
-#if !defined(__WIN__) || defined(USE_TLS) || ! defined(SAFE_MUTEX)
- pthread_mutex_lock(&THR_LOCK_lock);
-#endif
-#if !defined(__WIN__) || defined(USE_TLS)
- if (my_pthread_getspecific(struct st_my_thread_var *,THR_KEY_mysys))
- {
- pthread_mutex_unlock(&THR_LOCK_lock);
- return 0; /* Safequard */
- }
- /* We must have many calloc() here because these are freed on
- pthread_exit */
- if (!(tmp=(struct st_my_thread_var *)
- calloc(1,sizeof(struct st_my_thread_var))))
- {
- pthread_mutex_unlock(&THR_LOCK_lock);
- return 1;
- }
- pthread_setspecific(THR_KEY_mysys,tmp);
-
-#else
- if (THR_KEY_mysys.id) /* Already initialized */
- {
-#if !defined(__WIN__) || defined(USE_TLS) || ! defined(SAFE_MUTEX)
- pthread_mutex_unlock(&THR_LOCK_lock);
-#endif
- return 0;
- }
- tmp= &THR_KEY_mysys;
-#endif
- tmp->id= ++thread_id;
- pthread_mutex_init(&tmp->mutex,MY_MUTEX_INIT_FAST);
- pthread_cond_init(&tmp->suspend, NULL);
-#if !defined(__WIN__) || defined(USE_TLS) || ! defined(SAFE_MUTEX)
- pthread_mutex_unlock(&THR_LOCK_lock);
-#endif
- return 0;
-}
-
-void my_thread_end(void)
-{
- struct st_my_thread_var *tmp=my_thread_var;
- if (tmp)
- {
-#if !defined(DBUG_OFF)
- if (tmp->dbug)
- {
- free(tmp->dbug);
- tmp->dbug=0;
- }
-#endif
-#if !defined(__bsdi__) || defined(HAVE_mit_thread) /* bsdi dumps core here */
- pthread_cond_destroy(&tmp->suspend);
-#endif
- pthread_mutex_destroy(&tmp->mutex);
-#if !defined(__WIN__) || defined(USE_TLS)
- free(tmp);
-#endif
- }
-#if !defined(__WIN__) || defined(USE_TLS)
- pthread_setspecific(THR_KEY_mysys,0);
-#endif
-}
-
-struct st_my_thread_var *_my_thread_var(void)
-{
- struct st_my_thread_var *tmp=
- my_pthread_getspecific(struct st_my_thread_var*,THR_KEY_mysys);
-#if defined(USE_TLS)
- /* This can only happen in a .DLL */
- if (!tmp)
- {
- my_thread_init();
- tmp=my_pthread_getspecific(struct st_my_thread_var*,THR_KEY_mysys);
- }
-#endif
- return tmp;
-}
-
-/****************************************************************************
-** Get name of current thread.
-****************************************************************************/
-
-#define UNKNOWN_THREAD -1
-
-long my_thread_id()
-{
-#if defined(HAVE_PTHREAD_GETSEQUENCE_NP)
- return pthread_getsequence_np(pthread_self());
-#elif (defined(__sun) || defined(__sgi) || defined(__linux__)) && !defined(HAVE_mit_thread)
- return pthread_self();
-#else
- return my_thread_var->id;
-#endif
-}
-
-#ifdef DBUG_OFF
-const char *my_thread_name(void)
-{
- return "no_name";
-}
-
-#else
-
-const char *my_thread_name(void)
-{
- char name_buff[100];
- struct st_my_thread_var *tmp=my_thread_var;
- if (!tmp->name[0])
- {
- long id=my_thread_id();
- sprintf(name_buff,"T@%ld", id);
- strmake(tmp->name,name_buff,THREAD_NAME_SIZE);
- }
- return tmp->name;
-}
-#endif /* DBUG_OFF */
-
-#endif /* THREAD */
diff --git a/ext/mysql/libmysql/my_wincond.c b/ext/mysql/libmysql/my_wincond.c
deleted file mode 100644
index 555ab3bcf7..0000000000
--- a/ext/mysql/libmysql/my_wincond.c
+++ /dev/null
@@ -1,128 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-/*****************************************************************************
-** The following is a simple implementation of posix conditions
-*****************************************************************************/
-
-#undef SAFE_MUTEX /* Avoid safe_mutex redefinitions */
-#include "mysys_priv.h"
-#if defined(THREAD) && defined(__WIN__)
-#include <m_string.h>
-#undef getpid
-#include <process.h>
-#include <sys/timeb.h>
-
-int pthread_cond_init(pthread_cond_t *cond, const pthread_condattr_t *attr)
-{
- cond->waiting=0;
- cond->semaphore=CreateSemaphore(NULL,0,0x7FFFFFFF,NullS);
- if (!cond->semaphore)
- return ENOMEM;
- return 0;
-}
-
-int pthread_cond_destroy(pthread_cond_t *cond)
-{
- return CloseHandle(cond->semaphore) ? 0 : EINVAL;
-}
-
-
-int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex)
-{
- InterlockedIncrement(&cond->waiting);
- LeaveCriticalSection(mutex);
- WaitForSingleObject(cond->semaphore,INFINITE);
- InterlockedDecrement(&cond->waiting);
- EnterCriticalSection(mutex);
- return 0 ;
-}
-
-int pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex,
- struct timespec *abstime)
-{
- struct _timeb curtime;
- int result;
- long timeout;
- _ftime(&curtime);
- timeout= ((long) (abstime->tv_sec - curtime.time)*1000L +
- (long)((abstime->tv_nsec/1000) - curtime.millitm)/1000L);
- if (timeout < 0) /* Some safety */
- timeout = 0L;
- InterlockedIncrement(&cond->waiting);
- LeaveCriticalSection(mutex);
- result=WaitForSingleObject(cond->semaphore,timeout);
- InterlockedDecrement(&cond->waiting);
- EnterCriticalSection(mutex);
-
- return result == WAIT_TIMEOUT ? ETIMEDOUT : 0;
-}
-
-
-int pthread_cond_signal(pthread_cond_t *cond)
-{
- long prev_count;
- if (cond->waiting)
- ReleaseSemaphore(cond->semaphore,1,&prev_count);
- return 0;
-}
-
-
-int pthread_cond_broadcast(pthread_cond_t *cond)
-{
- long prev_count;
- if (cond->waiting)
- ReleaseSemaphore(cond->semaphore,cond->waiting,&prev_count);
- return 0 ;
-}
-
-
-int pthread_attr_init(pthread_attr_t *connect_att)
-{
- connect_att->dwStackSize = 0;
- connect_att->dwCreatingFlag = 0;
- connect_att->priority = 0;
- return 0;
-}
-
-int pthread_attr_setstacksize(pthread_attr_t *connect_att,DWORD stack)
-{
- connect_att->dwStackSize=stack;
- return 0;
-}
-
-int pthread_attr_setprio(pthread_attr_t *connect_att,int priority)
-{
- connect_att->priority=priority;
- return 0;
-}
-
-int pthread_attr_destroy(pthread_attr_t *connect_att)
-{
- bzero((gptr) connect_att,sizeof(*connect_att));
- return 0;
-}
-
-/****************************************************************************
-** Fix localtime_r() to be a bit safer
-****************************************************************************/
-
-struct tm *localtime_r(const time_t *timep,struct tm *tmp)
-{
- if (*timep == (time_t) -1) /* This will crash win32 */
- {
- bzero(tmp,sizeof(*tmp));
- }
- else
- {
- struct tm *res=localtime(timep);
- if (!res) /* Wrong date */
- {
- bzero(tmp,sizeof(*tmp)); /* Keep things safe */
- return 0;
- }
- *tmp= *res;
- }
- return tmp;
-}
-#endif /* __WIN__ */
diff --git a/ext/mysql/libmysql/my_winthread.c b/ext/mysql/libmysql/my_winthread.c
deleted file mode 100644
index 5d06b698ee..0000000000
--- a/ext/mysql/libmysql/my_winthread.c
+++ /dev/null
@@ -1,105 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-/*****************************************************************************
-** Simulation of posix threads calls for WIN95 and NT
-*****************************************************************************/
-
-/* SAFE_MUTEX will not work until the thread structure is up to date */
-#undef SAFE_MUTEX
-
-#include "mysys_priv.h"
-#if defined(THREAD) && defined(__WIN__)
-#include <m_string.h>
-#undef getpid
-#include <process.h>
-
-static pthread_mutex_t THR_LOCK_thread;
-
-struct pthread_map
-{
- HANDLE pthreadself;
- pthread_handler func;
- void *param;
-};
-
-void win_pthread_init(void)
-{
- pthread_mutex_init(&THR_LOCK_thread,MY_MUTEX_INIT_FAST);
-}
-
-/*
-** We have tried to use '_beginthreadex' instead of '_beginthread' here
-** but in this case the program leaks about 512 characters for each
-** created thread !
-** As we want to save the created thread handler for other threads to
-** use and to be returned by pthread_self() (instead of the Win32 pseudo
-** handler), we have to go trough pthread_start() to catch the returned handler
-** in the new thread.
-*/
-
-static pthread_handler_decl(pthread_start,param)
-{
- pthread_handler func=((struct pthread_map *) param)->func;
- void *func_param=((struct pthread_map *) param)->param;
- my_thread_init(); /* Will always succeed in windows */
- pthread_mutex_lock(&THR_LOCK_thread); /* Wait for beginthread to return */
- win_pthread_self=((struct pthread_map *) param)->pthreadself;
- pthread_mutex_unlock(&THR_LOCK_thread);
- free((char*) param); /* Free param from create */
- pthread_exit((void*) (*func)(func_param));
- return 0; /* Safety */
-}
-
-
-int pthread_create(pthread_t *thread_id, pthread_attr_t *attr,
- pthread_handler func, void *param)
-{
- HANDLE hThread;
- struct pthread_map *map;
- DBUG_ENTER("pthread_create");
-
- if (!(map=malloc(sizeof(*map))))
- DBUG_RETURN(-1);
- map->func=func;
- map->param=param;
- pthread_mutex_lock(&THR_LOCK_thread);
-#ifdef __BORLANDC__
- hThread=(HANDLE)_beginthread((void(_USERENTRY *)(void *)) pthread_start,
- attr->dwStackSize ? attr->dwStackSize :
- 65535, (void*) map);
-#else
- hThread=(HANDLE)_beginthread((void( __cdecl *)(void *)) pthread_start,
- attr->dwStackSize ? attr->dwStackSize :
- 65535, (void*) map);
-#endif
- DBUG_PRINT("info", ("hThread=%lu",(long) hThread));
- *thread_id=map->pthreadself=hThread;
- pthread_mutex_unlock(&THR_LOCK_thread);
-
- if (hThread == (HANDLE) -1)
- {
- int error=errno;
- DBUG_PRINT("error",
- ("Can't create thread to handle request (error %d)",error));
- DBUG_RETURN(error ? error : -1);
- }
- VOID(SetThreadPriority(hThread, attr->priority)) ;
- DBUG_RETURN(0);
-}
-
-
-void pthread_exit(void *a)
-{
- _endthread();
-}
-
-/* This is neaded to get the macro pthread_setspecific to work */
-
-int win_pthread_setspecific(void *a,void *b,uint length)
-{
- memcpy(a,b,length);
- return 0;
-}
-
-#endif
diff --git a/ext/mysql/libmysql/my_write.c b/ext/mysql/libmysql/my_write.c
deleted file mode 100644
index d66e1da031..0000000000
--- a/ext/mysql/libmysql/my_write.c
+++ /dev/null
@@ -1,75 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-#include "mysys_priv.h"
-#include "mysys_err.h"
-#include <errno.h>
-
- /* Write a chunk of bytes to a file */
-
-uint my_write(int Filedes, const byte *Buffer, uint Count, myf MyFlags)
-{
- uint writenbytes,errors;
- ulong written;
- DBUG_ENTER("my_write");
- DBUG_PRINT("my",("Fd: %d Buffer: %lx Count: %d MyFlags: %d",
- Filedes, Buffer, Count, MyFlags));
- errors=0; written=0L;
-
- for (;;)
- {
- if ((writenbytes = (uint) write(Filedes, Buffer, Count)) == Count)
- break;
- if ((int) writenbytes != -1)
- { /* Safeguard */
- written+=writenbytes;
- Buffer+=writenbytes;
- Count-=writenbytes;
- }
- my_errno=errno;
- DBUG_PRINT("error",("Write only %d bytes, error: %d",
- writenbytes,my_errno));
-#ifndef NO_BACKGROUND
-#ifdef THREAD
- if (my_thread_var->abort)
- MyFlags&= ~ MY_WAIT_IF_FULL; /* End if aborted by user */
-#endif
- if (my_errno == ENOSPC && (MyFlags & MY_WAIT_IF_FULL) &&
- (uint) writenbytes != (uint) -1)
- {
- if (!(errors++ % MY_WAIT_GIVE_USER_A_MESSAGE))
- my_error(EE_DISK_FULL,MYF(ME_BELL | ME_NOREFRESH),
- my_filename(Filedes));
- VOID(sleep(MY_WAIT_FOR_USER_TO_FIX_PANIC));
- continue;
- }
- if (!writenbytes)
- {
- /* We may come here on an interrupt or if the file quote is exeeded */
- if (my_errno == EINTR)
- continue;
- if (!errors++) /* Retry once */
- {
- errno=EFBIG; /* Assume this is the error */
- continue;
- }
- }
- else if ((uint) writenbytes != (uint) -1)
- continue; /* Retry */
-#endif
- if (MyFlags & (MY_NABP | MY_FNABP))
- {
- if (MyFlags & (MY_WME | MY_FAE | MY_FNABP))
- {
- my_error(EE_WRITE, MYF(ME_BELL+ME_WAITTANG),
- my_filename(Filedes),my_errno);
- }
- DBUG_RETURN(MY_FILE_ERROR); /* Error on read */
- }
- else
- break; /* Return bytes written */
- }
- if (MyFlags & (MY_NABP | MY_FNABP))
- DBUG_RETURN(0); /* Want only errors */
- DBUG_RETURN(writenbytes+written);
-} /* my_write */
diff --git a/ext/mysql/libmysql/mysql.h b/ext/mysql/libmysql/mysql.h
deleted file mode 100644
index f44252c9c7..0000000000
--- a/ext/mysql/libmysql/mysql.h
+++ /dev/null
@@ -1,294 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-/* defines for the libmysql library */
-
-#ifndef _mysql_h
-#define _mysql_h
-
-#ifdef __CYGWIN__ /* CYGWIN implements a UNIX API */
-#undef WIN
-#undef _WIN
-#undef _WIN32
-#undef _WIN64
-#undef __WIN__
-#endif
-
-#ifndef MYSQL_SERVER
-#ifdef __cplusplus
-extern "C" {
-#endif
-#endif
-
-#ifndef _global_h /* If not standard header */
-#include <sys/types.h>
-typedef char my_bool;
-#if (defined(_WIN32) || defined(_WIN64)) && !defined(__WIN__)
-#define __WIN__
-#endif
-#if !defined(__WIN__)
-#define STDCALL
-#else
-#define STDCALL __stdcall
-#endif
-typedef char * gptr;
-
-#ifndef ST_USED_MEM_DEFINED
-#define ST_USED_MEM_DEFINED
-typedef struct st_used_mem { /* struct for once_alloc */
- struct st_used_mem *next; /* Next block in use */
- unsigned int left; /* memory left in block */
- unsigned int size; /* size of block */
-} USED_MEM;
-typedef struct st_mem_root {
- USED_MEM *free;
- USED_MEM *used;
- USED_MEM *pre_alloc;
- unsigned int min_malloc;
- unsigned int block_size;
-
- void (*error_handler)(void);
-} MEM_ROOT;
-#endif
-
-#ifndef my_socket_defined
-#ifdef __WIN__
-#define my_socket SOCKET
-#else
-typedef int my_socket;
-#endif
-#endif
-#endif
-#include "mysql_com.h"
-#include "mysql_version.h"
-
-extern unsigned int mysql_port;
-extern char *mysql_unix_port;
-
-#define IS_PRI_KEY(n) ((n) & PRI_KEY_FLAG)
-#define IS_NOT_NULL(n) ((n) & NOT_NULL_FLAG)
-#define IS_BLOB(n) ((n) & BLOB_FLAG)
-#define IS_NUM(t) ((t) <= FIELD_TYPE_INT24 || (t) == FIELD_TYPE_YEAR)
-#define IS_NUM_FIELD(f) ((f)->flags & NUM_FLAG)
-#define INTERNAL_NUM_FIELD(f) (((f)->type <= FIELD_TYPE_INT24 && ((f)->type != FIELD_TYPE_TIMESTAMP || (f)->length == 14 || (f)->length == 8)) || (f)->type == FIELD_TYPE_YEAR)
-
-typedef struct st_mysql_field {
- char *name; /* Name of column */
- char *table; /* Table of column if column was a field */
- char *def; /* Default value (set by mysql_list_fields) */
- enum enum_field_types type; /* Type of field. Se mysql_com.h for types */
- unsigned int length; /* Width of column */
- unsigned int max_length; /* Max width of selected set */
- unsigned int flags; /* Div flags */
- unsigned int decimals; /* Number of decimals in field */
-} MYSQL_FIELD;
-
-typedef char **MYSQL_ROW; /* return data as array of strings */
-typedef unsigned int MYSQL_FIELD_OFFSET; /* offset to current field */
-
-#if defined(NO_CLIENT_LONG_LONG)
-typedef unsigned long my_ulonglong;
-#elif defined (__WIN__)
-typedef unsigned __int64 my_ulonglong;
-#else
-typedef unsigned long long my_ulonglong;
-#endif
-
-#define MYSQL_COUNT_ERROR (~(my_ulonglong) 0)
-
-typedef struct st_mysql_rows {
- struct st_mysql_rows *next; /* list of rows */
- MYSQL_ROW data;
-} MYSQL_ROWS;
-
-typedef MYSQL_ROWS *MYSQL_ROW_OFFSET; /* offset to current row */
-
-typedef struct st_mysql_data {
- my_ulonglong rows;
- unsigned int fields;
- MYSQL_ROWS *data;
- MEM_ROOT alloc;
-} MYSQL_DATA;
-
-struct st_mysql_options {
- unsigned int connect_timeout,client_flag;
- my_bool compress,named_pipe;
- unsigned int port;
- char *host,*init_command,*user,*password,*unix_socket,*db;
- char *my_cnf_file,*my_cnf_group, *charset_dir, *charset_name;
- my_bool use_ssl; /* if to use SSL or not */
- char *ssl_key; /* PEM key file */
- char *ssl_cert; /* PEM cert file */
- char *ssl_ca; /* PEM CA file */
- char *ssl_capath; /* PEM directory of CA-s? */
-};
-
-enum mysql_option { MYSQL_OPT_CONNECT_TIMEOUT, MYSQL_OPT_COMPRESS,
- MYSQL_OPT_NAMED_PIPE, MYSQL_INIT_COMMAND,
- MYSQL_READ_DEFAULT_FILE, MYSQL_READ_DEFAULT_GROUP,
- MYSQL_SET_CHARSET_DIR, MYSQL_SET_CHARSET_NAME};
-
-enum mysql_status { MYSQL_STATUS_READY,MYSQL_STATUS_GET_RESULT,
- MYSQL_STATUS_USE_RESULT};
-
-typedef struct st_mysql {
- NET net; /* Communication parameters */
- gptr connector_fd; /* ConnectorFd for SSL */
- char *host,*user,*passwd,*unix_socket,*server_version,*host_info,
- *info,*db;
- unsigned int port,client_flag,server_capabilities;
- unsigned int protocol_version;
- unsigned int field_count;
- unsigned int server_status;
- unsigned long thread_id; /* Id for connection in server */
- my_ulonglong affected_rows;
- my_ulonglong insert_id; /* id if insert on table with NEXTNR */
- my_ulonglong extra_info; /* Used by mysqlshow */
- unsigned long packet_length;
- enum mysql_status status;
- MYSQL_FIELD *fields;
- MEM_ROOT field_alloc;
- my_bool free_me; /* If free in mysql_close */
- my_bool reconnect; /* set to 1 if automatic reconnect */
- struct st_mysql_options options;
- char scramble_buff[9];
- struct charset_info_st *charset;
- unsigned int server_language;
-} MYSQL;
-
-
-typedef struct st_mysql_res {
- my_ulonglong row_count;
- unsigned int field_count, current_field;
- MYSQL_FIELD *fields;
- MYSQL_DATA *data;
- MYSQL_ROWS *data_cursor;
- MEM_ROOT field_alloc;
- MYSQL_ROW row; /* If unbuffered read */
- MYSQL_ROW current_row; /* buffer to current row */
- unsigned long *lengths; /* column lengths of current row */
- MYSQL *handle; /* for unbuffered reads */
- my_bool eof; /* Used my mysql_fetch_row */
-} MYSQL_RES;
-
-/* Functions to get information from the MYSQL and MYSQL_RES structures */
-/* Should definitely be used if one uses shared libraries */
-
-my_ulonglong STDCALL mysql_num_rows(MYSQL_RES *res);
-unsigned int STDCALL mysql_num_fields(MYSQL_RES *res);
-my_bool STDCALL mysql_eof(MYSQL_RES *res);
-MYSQL_FIELD *STDCALL mysql_fetch_field_direct(MYSQL_RES *res,
- unsigned int fieldnr);
-MYSQL_FIELD * STDCALL mysql_fetch_fields(MYSQL_RES *res);
-MYSQL_ROWS * STDCALL mysql_row_tell(MYSQL_RES *res);
-unsigned int STDCALL mysql_field_tell(MYSQL_RES *res);
-
-unsigned int STDCALL mysql_field_count(MYSQL *mysql);
-my_ulonglong STDCALL mysql_affected_rows(MYSQL *mysql);
-my_ulonglong STDCALL mysql_insert_id(MYSQL *mysql);
-unsigned int STDCALL mysql_errno(MYSQL *mysql);
-char * STDCALL mysql_error(MYSQL *mysql);
-char * STDCALL mysql_info(MYSQL *mysql);
-unsigned long STDCALL mysql_thread_id(MYSQL *mysql);
-const char * STDCALL mysql_character_set_name(MYSQL *mysql);
-
-MYSQL * STDCALL mysql_init(MYSQL *mysql);
-#ifdef HAVE_OPENSSL
-int STDCALL mysql_ssl_set(MYSQL *mysql, const char *key,
- const char *cert, const char *ca,
- const char *capath);
-char * STDCALL mysql_ssl_cipher(MYSQL *mysql);
-int STDCALL mysql_ssl_clear(MYSQL *mysql);
-#endif /* HAVE_OPENSSL */
-MYSQL * STDCALL mysql_connect(MYSQL *mysql, const char *host,
- const char *user, const char *passwd);
-my_bool STDCALL mysql_change_user(MYSQL *mysql, const char *user,
- const char *passwd, const char *db);
-#if MYSQL_VERSION_ID >= 32200
-MYSQL * STDCALL mysql_real_connect(MYSQL *mysql, const char *host,
- const char *user,
- const char *passwd,
- const char *db,
- unsigned int port,
- const char *unix_socket,
- unsigned int clientflag);
-#else
-MYSQL * STDCALL mysql_real_connect(MYSQL *mysql, const char *host,
- const char *user,
- const char *passwd,
- unsigned int port,
- const char *unix_socket,
- unsigned int clientflag);
-#endif
-void STDCALL mysql_close(MYSQL *sock);
-int STDCALL mysql_select_db(MYSQL *mysql, const char *db);
-int STDCALL mysql_query(MYSQL *mysql, const char *q);
-int STDCALL mysql_send_query(MYSQL *mysql, const char *q,
- unsigned int length);
-int STDCALL mysql_read_query_result(MYSQL *mysql);
-int STDCALL mysql_real_query(MYSQL *mysql, const char *q,
- unsigned int length);
-int STDCALL mysql_create_db(MYSQL *mysql, const char *DB);
-int STDCALL mysql_drop_db(MYSQL *mysql, const char *DB);
-int STDCALL mysql_shutdown(MYSQL *mysql);
-int STDCALL mysql_dump_debug_info(MYSQL *mysql);
-int STDCALL mysql_refresh(MYSQL *mysql,
- unsigned int refresh_options);
-int STDCALL mysql_kill(MYSQL *mysql,unsigned long pid);
-int STDCALL mysql_ping(MYSQL *mysql);
-char * STDCALL mysql_stat(MYSQL *mysql);
-char * STDCALL mysql_get_server_info(MYSQL *mysql);
-char * STDCALL mysql_get_client_info(void);
-char * STDCALL mysql_get_host_info(MYSQL *mysql);
-unsigned int STDCALL mysql_get_proto_info(MYSQL *mysql);
-MYSQL_RES * STDCALL mysql_list_dbs(MYSQL *mysql,const char *wild);
-MYSQL_RES * STDCALL mysql_list_tables(MYSQL *mysql,const char *wild);
-MYSQL_RES * STDCALL mysql_list_fields(MYSQL *mysql, const char *table,
- const char *wild);
-MYSQL_RES * STDCALL mysql_list_processes(MYSQL *mysql);
-MYSQL_RES * STDCALL mysql_store_result(MYSQL *mysql);
-MYSQL_RES * STDCALL mysql_use_result(MYSQL *mysql);
-int STDCALL mysql_options(MYSQL *mysql,enum mysql_option option,
- const char *arg);
-void STDCALL mysql_free_result(MYSQL_RES *result);
-void STDCALL mysql_data_seek(MYSQL_RES *result,
- my_ulonglong offset);
-MYSQL_ROW_OFFSET STDCALL mysql_row_seek(MYSQL_RES *result, MYSQL_ROW_OFFSET);
-MYSQL_FIELD_OFFSET STDCALL mysql_field_seek(MYSQL_RES *result,
- MYSQL_FIELD_OFFSET offset);
-MYSQL_ROW STDCALL mysql_fetch_row(MYSQL_RES *result);
-unsigned long * STDCALL mysql_fetch_lengths(MYSQL_RES *result);
-MYSQL_FIELD * STDCALL mysql_fetch_field(MYSQL_RES *result);
-unsigned long STDCALL mysql_escape_string(char *to,const char *from,
- unsigned long from_length);
-unsigned long STDCALL mysql_real_escape_string(MYSQL *mysql,
- char *to,const char *from,
- unsigned long length);
-void STDCALL mysql_debug(const char *debug);
-char * STDCALL mysql_odbc_escape_string(MYSQL *mysql,
- char *to,
- unsigned long to_length,
- const char *from,
- unsigned long from_length,
- void *param,
- char *
- (*extend_buffer)
- (void *, char *to,
- unsigned long *length));
-void STDCALL myodbc_remove_escape(MYSQL *mysql,char *name);
-unsigned int STDCALL mysql_thread_safe(void);
-
-
-#define mysql_reload(mysql) mysql_refresh((mysql),REFRESH_GRANT)
-
-/* new api functions */
-
-#define HAVE_MYSQL_REAL_CONNECT
-
-#ifndef MYSQL_SERVER
-#ifdef __cplusplus
-}
-#endif
-#endif
-
-#endif
diff --git a/ext/mysql/libmysql/mysql.m4 b/ext/mysql/libmysql/mysql.m4
deleted file mode 100644
index 36bba66e50..0000000000
--- a/ext/mysql/libmysql/mysql.m4
+++ /dev/null
@@ -1,18 +0,0 @@
-AC_DEFUN(MYSQL_CHECKS,[
-
-AC_REQUIRE([AC_PROG_CC])
-AC_REQUIRE([AC_PROG_LN_S])
-AC_REQUIRE([AC_PROG_RANLIB])
-
-AC_DEFINE(UNDEF_THREADS_HACK,,[ ])
-
-MYSQL_HEADER_CHECKS
-MYSQL_TYPE_CHECKS
-MYSQL_FUNCTION_CHECKS
-MYSQL_CHECK_PTHREAD_GETSPECIFIC
-MYSQL_CHECK_PTHREAD_MUTEX_INIT
-MYSQL_CHECK_READDIR_R_ARGS
-MYSQL_CHECK_SIGWAIT_STYLE
-
-PHP_FAST_OUTPUT($ext_builddir/libmysql/Makefile)
-])
diff --git a/ext/mysql/libmysql/mysql_com.h b/ext/mysql/libmysql/mysql_com.h
deleted file mode 100644
index 0f6b5928db..0000000000
--- a/ext/mysql/libmysql/mysql_com.h
+++ /dev/null
@@ -1,225 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-/*
-** Common definition between mysql server & client
-*/
-
-#ifndef _mysql_com_h
-#define _mysql_com_h
-
-
-#define NAME_LEN 64 /* Field/table name length */
-#define HOSTNAME_LENGTH 60
-#define USERNAME_LENGTH 16
-#define SERVER_VERSION_LENGTH 60
-
-#define LOCAL_HOST "localhost"
-#define LOCAL_HOST_NAMEDPIPE "."
-
-#if defined(__WIN__) && !defined( _CUSTOMCONFIG_)
-#define MYSQL_NAMEDPIPE "MySQL"
-#define MYSQL_SERVICENAME "MySql"
-#endif /* __WIN__ */
-
-enum enum_server_command {COM_SLEEP,COM_QUIT,COM_INIT_DB,COM_QUERY,
- COM_FIELD_LIST,COM_CREATE_DB,COM_DROP_DB,COM_REFRESH,
- COM_SHUTDOWN,COM_STATISTICS,
- COM_PROCESS_INFO,COM_CONNECT,COM_PROCESS_KILL,
- COM_DEBUG,COM_PING,COM_TIME,COM_DELAYED_INSERT,
- COM_CHANGE_USER, COM_BINLOG_DUMP,
- COM_TABLE_DUMP, COM_CONNECT_OUT};
-
-#define NOT_NULL_FLAG 1 /* Field can't be NULL */
-#define PRI_KEY_FLAG 2 /* Field is part of a primary key */
-#define UNIQUE_KEY_FLAG 4 /* Field is part of a unique key */
-#define MULTIPLE_KEY_FLAG 8 /* Field is part of a key */
-#define BLOB_FLAG 16 /* Field is a blob */
-#define UNSIGNED_FLAG 32 /* Field is unsigned */
-#define ZEROFILL_FLAG 64 /* Field is zerofill */
-#define BINARY_FLAG 128
-/* The following are only sent to new clients */
-#define ENUM_FLAG 256 /* field is an enum */
-#define AUTO_INCREMENT_FLAG 512 /* field is a autoincrement field */
-#define TIMESTAMP_FLAG 1024 /* Field is a timestamp */
-#define SET_FLAG 2048 /* field is a set */
-#define NUM_FLAG 32768 /* Field is num (for clients) */
-#define PART_KEY_FLAG 16384 /* Intern; Part of some key */
-#define GROUP_FLAG 32768 /* Intern: Group field */
-#define UNIQUE_FLAG 65536 /* Intern: Used by sql_yacc */
-
-#define REFRESH_GRANT 1 /* Refresh grant tables */
-#define REFRESH_LOG 2 /* Start on new log file */
-#define REFRESH_TABLES 4 /* close all tables */
-#define REFRESH_HOSTS 8 /* Flush host cache */
-#define REFRESH_STATUS 16 /* Flush status variables */
-#define REFRESH_THREADS 32 /* Flush status variables */
-#define REFRESH_SLAVE 64 /* Reset master info and restart slave
- thread */
-#define REFRESH_MASTER 128 /* Remove all bin logs in the index
- and truncate the index */
-
-/* The following can't be set with mysql_refresh() */
-#define REFRESH_READ_LOCK 16384 /* Lock tables for read */
-#define REFRESH_FAST 32768 /* Intern flag */
-
-#define CLIENT_LONG_PASSWORD 1 /* new more secure passwords */
-#define CLIENT_FOUND_ROWS 2 /* Found instead of affected rows */
-#define CLIENT_LONG_FLAG 4 /* Get all column flags */
-#define CLIENT_CONNECT_WITH_DB 8 /* One can specify db on connect */
-#define CLIENT_NO_SCHEMA 16 /* Don't allow database.table.column */
-#define CLIENT_COMPRESS 32 /* Can use compression protocol */
-#define CLIENT_ODBC 64 /* Odbc client */
-#define CLIENT_LOCAL_FILES 128 /* Can use LOAD DATA LOCAL */
-#define CLIENT_IGNORE_SPACE 256 /* Ignore spaces before '(' */
-#define CLIENT_CHANGE_USER 512 /* Support the mysql_change_user() */
-#define CLIENT_INTERACTIVE 1024 /* This is an interactive client */
-#define CLIENT_SSL 2048 /* Switch to SSL after handshake */
-#define CLIENT_IGNORE_SIGPIPE 4096 /* IGNORE sigpipes */
-#define CLIENT_TRANSACTIONS 8192 /* Client knows about transactions */
-
-#define SERVER_STATUS_IN_TRANS 1 /* Transaction has started */
-#define SERVER_STATUS_AUTOCOMMIT 2 /* Server in auto_commit mode */
-
-#define MYSQL_ERRMSG_SIZE 200
-#define NET_READ_TIMEOUT 30 /* Timeout on read */
-#define NET_WRITE_TIMEOUT 60 /* Timeout on write */
-#define NET_WAIT_TIMEOUT 8*60*60 /* Wait for new query */
-
-#ifndef Vio_defined
-#define Vio_defined
-#ifdef HAVE_VIO
-class Vio; /* Fill Vio class in C++ */
-#else
-struct st_vio; /* Only C */
-typedef struct st_vio Vio;
-#endif
-#endif
-
-typedef struct st_net {
- Vio* vio;
- my_socket fd; /* For Perl DBI/dbd */
- int fcntl;
- unsigned char *buff,*buff_end,*write_pos,*read_pos;
- char last_error[MYSQL_ERRMSG_SIZE];
- unsigned int last_errno,max_packet,timeout,pkt_nr;
- unsigned char error;
- my_bool return_errno,compress;
- my_bool no_send_ok; /* needed if we are doing several
- queries in one command ( as in LOAD TABLE ... FROM MASTER ),
- and do not want to confuse the client with OK at the wrong time
- */
- unsigned long remain_in_buf,length, buf_length, where_b;
- unsigned int *return_status;
- unsigned char reading_or_writing;
- char save_char;
-} NET;
-
-#define packet_error ((unsigned int) -1)
-
-enum enum_field_types { FIELD_TYPE_DECIMAL, FIELD_TYPE_TINY,
- FIELD_TYPE_SHORT, FIELD_TYPE_LONG,
- FIELD_TYPE_FLOAT, FIELD_TYPE_DOUBLE,
- FIELD_TYPE_NULL, FIELD_TYPE_TIMESTAMP,
- FIELD_TYPE_LONGLONG,FIELD_TYPE_INT24,
- FIELD_TYPE_DATE, FIELD_TYPE_TIME,
- FIELD_TYPE_DATETIME, FIELD_TYPE_YEAR,
- FIELD_TYPE_NEWDATE,
- FIELD_TYPE_ENUM=247,
- FIELD_TYPE_SET=248,
- FIELD_TYPE_TINY_BLOB=249,
- FIELD_TYPE_MEDIUM_BLOB=250,
- FIELD_TYPE_LONG_BLOB=251,
- FIELD_TYPE_BLOB=252,
- FIELD_TYPE_VAR_STRING=253,
- FIELD_TYPE_STRING=254
-};
-
-#define FIELD_TYPE_CHAR FIELD_TYPE_TINY /* For compability */
-#define FIELD_TYPE_INTERVAL FIELD_TYPE_ENUM /* For compability */
-
-extern unsigned long max_allowed_packet;
-extern unsigned long net_buffer_length;
-
-#define net_new_transaction(net) ((net)->pkt_nr=0)
-
-int my_net_init(NET *net, Vio* vio);
-void net_end(NET *net);
-void net_clear(NET *net);
-int net_flush(NET *net);
-int my_net_write(NET *net,const char *packet,unsigned long len);
-int net_write_command(NET *net,unsigned char command,const char *packet,
- unsigned long len);
-int net_real_write(NET *net,const char *packet,unsigned long len);
-unsigned int my_net_read(NET *net);
-
-struct rand_struct {
- unsigned long seed1,seed2,max_value;
- double max_value_dbl;
-};
-
- /* The following is for user defined functions */
-
-enum Item_result {STRING_RESULT,REAL_RESULT,INT_RESULT};
-
-typedef struct st_udf_args
-{
- unsigned int arg_count; /* Number of arguments */
- enum Item_result *arg_type; /* Pointer to item_results */
- char **args; /* Pointer to argument */
- unsigned long *lengths; /* Length of string arguments */
- char *maybe_null; /* Set to 1 for all maybe_null args */
-} UDF_ARGS;
-
- /* This holds information about the result */
-
-typedef struct st_udf_init
-{
- my_bool maybe_null; /* 1 if function can return NULL */
- unsigned int decimals; /* for real functions */
- unsigned int max_length; /* For string functions */
- char *ptr; /* free pointer for function data */
- my_bool const_item; /* 0 if result is independent of arguments */
-} UDF_INIT;
-
- /* Constants when using compression */
-#define NET_HEADER_SIZE 4 /* standard header size */
-#define COMP_HEADER_SIZE 3 /* compression header extra size */
-
- /* Prototypes to password functions */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void randominit(struct rand_struct *,unsigned long seed1,
- unsigned long seed2);
-double rnd(struct rand_struct *);
-void make_scrambled_password(char *to,const char *password);
-void get_salt_from_password(unsigned long *res,const char *password);
-void make_password_from_salt(char *to, unsigned long *hash_res);
-char *scramble(char *to,const char *message,const char *password,
- my_bool old_ver);
-my_bool check_scramble(const char *, const char *message,
- unsigned long *salt,my_bool old_ver);
-char *get_tty_password(char *opt_message);
-void hash_password(unsigned long *result, const char *password);
-#ifdef __cplusplus
-}
-#endif
-
-/* Some other useful functions */
-
-void my_init(void);
-void load_defaults(const char *conf_file, const char **groups,
- int *argc, char ***argv);
-
-#define NULL_LENGTH ((unsigned long) ~0) /* For net_store_length */
-
-#ifdef __WIN__
-#define socket_errno WSAGetLastError()
-#else
-#define socket_errno errno
-#endif
-
-#endif
diff --git a/ext/mysql/libmysql/mysql_version.h b/ext/mysql/libmysql/mysql_version.h
deleted file mode 100644
index 1587579818..0000000000
--- a/ext/mysql/libmysql/mysql_version.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-/* Version numbers for protocol & mysqld */
-
-#ifdef _CUSTOMCONFIG_
-#include <custom_conf.h>
-#else
-#define PROTOCOL_VERSION 10
-#define MYSQL_SERVER_VERSION "3.23.39"
-#define MYSQL_SERVER_SUFFIX ""
-#define FRM_VER 6
-#define MYSQL_VERSION_ID 32339
-
-#ifndef MYSQL_PORT
-#define MYSQL_PORT 3306
-#endif
-
-#ifndef MYSQL_UNIX_ADDR
-#define MYSQL_UNIX_ADDR "/tmp/mysql.sock"
-#endif
-
-/* mysqld compile time options */
-#ifndef MYSQL_CHARSET
-#define MYSQL_CHARSET "latin1"
-#endif
-#endif
diff --git a/ext/mysql/libmysql/mysqld_error.h b/ext/mysql/libmysql/mysqld_error.h
deleted file mode 100644
index e412f95a8e..0000000000
--- a/ext/mysql/libmysql/mysqld_error.h
+++ /dev/null
@@ -1,211 +0,0 @@
-/* Definefile for errormessagenumbers */
-
-#define ER_HASHCHK 1000
-#define ER_NISAMCHK 1001
-#define ER_NO 1002
-#define ER_YES 1003
-#define ER_CANT_CREATE_FILE 1004
-#define ER_CANT_CREATE_TABLE 1005
-#define ER_CANT_CREATE_DB 1006
-#define ER_DB_CREATE_EXISTS 1007
-#define ER_DB_DROP_EXISTS 1008
-#define ER_DB_DROP_DELETE 1009
-#define ER_DB_DROP_RMDIR 1010
-#define ER_CANT_DELETE_FILE 1011
-#define ER_CANT_FIND_SYSTEM_REC 1012
-#define ER_CANT_GET_STAT 1013
-#define ER_CANT_GET_WD 1014
-#define ER_CANT_LOCK 1015
-#define ER_CANT_OPEN_FILE 1016
-#define ER_FILE_NOT_FOUND 1017
-#define ER_CANT_READ_DIR 1018
-#define ER_CANT_SET_WD 1019
-#define ER_CHECKREAD 1020
-#define ER_DISK_FULL 1021
-#define ER_DUP_KEY 1022
-#define ER_ERROR_ON_CLOSE 1023
-#define ER_ERROR_ON_READ 1024
-#define ER_ERROR_ON_RENAME 1025
-#define ER_ERROR_ON_WRITE 1026
-#define ER_FILE_USED 1027
-#define ER_FILSORT_ABORT 1028
-#define ER_FORM_NOT_FOUND 1029
-#define ER_GET_ERRNO 1030
-#define ER_ILLEGAL_HA 1031
-#define ER_KEY_NOT_FOUND 1032
-#define ER_NOT_FORM_FILE 1033
-#define ER_NOT_KEYFILE 1034
-#define ER_OLD_KEYFILE 1035
-#define ER_OPEN_AS_READONLY 1036
-#define ER_OUTOFMEMORY 1037
-#define ER_OUT_OF_SORTMEMORY 1038
-#define ER_UNEXPECTED_EOF 1039
-#define ER_CON_COUNT_ERROR 1040
-#define ER_OUT_OF_RESOURCES 1041
-#define ER_BAD_HOST_ERROR 1042
-#define ER_HANDSHAKE_ERROR 1043
-#define ER_DBACCESS_DENIED_ERROR 1044
-#define ER_ACCESS_DENIED_ERROR 1045
-#define ER_NO_DB_ERROR 1046
-#define ER_UNKNOWN_COM_ERROR 1047
-#define ER_BAD_NULL_ERROR 1048
-#define ER_BAD_DB_ERROR 1049
-#define ER_TABLE_EXISTS_ERROR 1050
-#define ER_BAD_TABLE_ERROR 1051
-#define ER_NON_UNIQ_ERROR 1052
-#define ER_SERVER_SHUTDOWN 1053
-#define ER_BAD_FIELD_ERROR 1054
-#define ER_WRONG_FIELD_WITH_GROUP 1055
-#define ER_WRONG_GROUP_FIELD 1056
-#define ER_WRONG_SUM_SELECT 1057
-#define ER_WRONG_VALUE_COUNT 1058
-#define ER_TOO_LONG_IDENT 1059
-#define ER_DUP_FIELDNAME 1060
-#define ER_DUP_KEYNAME 1061
-#define ER_DUP_ENTRY 1062
-#define ER_WRONG_FIELD_SPEC 1063
-#define ER_PARSE_ERROR 1064
-#define ER_EMPTY_QUERY 1065
-#define ER_NONUNIQ_TABLE 1066
-#define ER_INVALID_DEFAULT 1067
-#define ER_MULTIPLE_PRI_KEY 1068
-#define ER_TOO_MANY_KEYS 1069
-#define ER_TOO_MANY_KEY_PARTS 1070
-#define ER_TOO_LONG_KEY 1071
-#define ER_KEY_COLUMN_DOES_NOT_EXITS 1072
-#define ER_BLOB_USED_AS_KEY 1073
-#define ER_TOO_BIG_FIELDLENGTH 1074
-#define ER_WRONG_AUTO_KEY 1075
-#define ER_READY 1076
-#define ER_NORMAL_SHUTDOWN 1077
-#define ER_GOT_SIGNAL 1078
-#define ER_SHUTDOWN_COMPLETE 1079
-#define ER_FORCING_CLOSE 1080
-#define ER_IPSOCK_ERROR 1081
-#define ER_NO_SUCH_INDEX 1082
-#define ER_WRONG_FIELD_TERMINATORS 1083
-#define ER_BLOBS_AND_NO_TERMINATED 1084
-#define ER_TEXTFILE_NOT_READABLE 1085
-#define ER_FILE_EXISTS_ERROR 1086
-#define ER_LOAD_INFO 1087
-#define ER_ALTER_INFO 1088
-#define ER_WRONG_SUB_KEY 1089
-#define ER_CANT_REMOVE_ALL_FIELDS 1090
-#define ER_CANT_DROP_FIELD_OR_KEY 1091
-#define ER_INSERT_INFO 1092
-#define ER_INSERT_TABLE_USED 1093
-#define ER_NO_SUCH_THREAD 1094
-#define ER_KILL_DENIED_ERROR 1095
-#define ER_NO_TABLES_USED 1096
-#define ER_TOO_BIG_SET 1097
-#define ER_NO_UNIQUE_LOGFILE 1098
-#define ER_TABLE_NOT_LOCKED_FOR_WRITE 1099
-#define ER_TABLE_NOT_LOCKED 1100
-#define ER_BLOB_CANT_HAVE_DEFAULT 1101
-#define ER_WRONG_DB_NAME 1102
-#define ER_WRONG_TABLE_NAME 1103
-#define ER_TOO_BIG_SELECT 1104
-#define ER_UNKNOWN_ERROR 1105
-#define ER_UNKNOWN_PROCEDURE 1106
-#define ER_WRONG_PARAMCOUNT_TO_PROCEDURE 1107
-#define ER_WRONG_PARAMETERS_TO_PROCEDURE 1108
-#define ER_UNKNOWN_TABLE 1109
-#define ER_FIELD_SPECIFIED_TWICE 1110
-#define ER_INVALID_GROUP_FUNC_USE 1111
-#define ER_UNSUPPORTED_EXTENSION 1112
-#define ER_TABLE_MUST_HAVE_COLUMNS 1113
-#define ER_RECORD_FILE_FULL 1114
-#define ER_UNKNOWN_CHARACTER_SET 1115
-#define ER_TOO_MANY_TABLES 1116
-#define ER_TOO_MANY_FIELDS 1117
-#define ER_TOO_BIG_ROWSIZE 1118
-#define ER_STACK_OVERRUN 1119
-#define ER_WRONG_OUTER_JOIN 1120
-#define ER_NULL_COLUMN_IN_INDEX 1121
-#define ER_CANT_FIND_UDF 1122
-#define ER_CANT_INITIALIZE_UDF 1123
-#define ER_UDF_NO_PATHS 1124
-#define ER_UDF_EXISTS 1125
-#define ER_CANT_OPEN_LIBRARY 1126
-#define ER_CANT_FIND_DL_ENTRY 1127
-#define ER_FUNCTION_NOT_DEFINED 1128
-#define ER_HOST_IS_BLOCKED 1129
-#define ER_HOST_NOT_PRIVILEGED 1130
-#define ER_PASSWORD_ANONYMOUS_USER 1131
-#define ER_PASSWORD_NOT_ALLOWED 1132
-#define ER_PASSWORD_NO_MATCH 1133
-#define ER_UPDATE_INFO 1134
-#define ER_CANT_CREATE_THREAD 1135
-#define ER_WRONG_VALUE_COUNT_ON_ROW 1136
-#define ER_CANT_REOPEN_TABLE 1137
-#define ER_INVALID_USE_OF_NULL 1138
-#define ER_REGEXP_ERROR 1139
-#define ER_MIX_OF_GROUP_FUNC_AND_FIELDS 1140
-#define ER_NONEXISTING_GRANT 1141
-#define ER_TABLEACCESS_DENIED_ERROR 1142
-#define ER_COLUMNACCESS_DENIED_ERROR 1143
-#define ER_ILLEGAL_GRANT_FOR_TABLE 1144
-#define ER_GRANT_WRONG_HOST_OR_USER 1145
-#define ER_NO_SUCH_TABLE 1146
-#define ER_NONEXISTING_TABLE_GRANT 1147
-#define ER_NOT_ALLOWED_COMMAND 1148
-#define ER_SYNTAX_ERROR 1149
-#define ER_DELAYED_CANT_CHANGE_LOCK 1150
-#define ER_TOO_MANY_DELAYED_THREADS 1151
-#define ER_ABORTING_CONNECTION 1152
-#define ER_NET_PACKET_TOO_LARGE 1153
-#define ER_NET_READ_ERROR_FROM_PIPE 1154
-#define ER_NET_FCNTL_ERROR 1155
-#define ER_NET_PACKETS_OUT_OF_ORDER 1156
-#define ER_NET_UNCOMPRESS_ERROR 1157
-#define ER_NET_READ_ERROR 1158
-#define ER_NET_READ_INTERRUPTED 1159
-#define ER_NET_ERROR_ON_WRITE 1160
-#define ER_NET_WRITE_INTERRUPTED 1161
-#define ER_TOO_LONG_STRING 1162
-#define ER_TABLE_CANT_HANDLE_BLOB 1163
-#define ER_TABLE_CANT_HANDLE_AUTO_INCREMENT 1164
-#define ER_DELAYED_INSERT_TABLE_LOCKED 1165
-#define ER_WRONG_COLUMN_NAME 1166
-#define ER_WRONG_KEY_COLUMN 1167
-#define ER_WRONG_MRG_TABLE 1168
-#define ER_DUP_UNIQUE 1169
-#define ER_BLOB_KEY_WITHOUT_LENGTH 1170
-#define ER_PRIMARY_CANT_HAVE_NULL 1171
-#define ER_TOO_MANY_ROWS 1172
-#define ER_REQUIRES_PRIMARY_KEY 1173
-#define ER_NO_RAID_COMPILED 1174
-#define ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE 1175
-#define ER_KEY_DOES_NOT_EXITS 1176
-#define ER_CHECK_NO_SUCH_TABLE 1177
-#define ER_CHECK_NOT_IMPLEMENTED 1178
-#define ER_CANT_DO_THIS_DURING_AN_TRANSACTION 1179
-#define ER_ERROR_DURING_COMMIT 1180
-#define ER_ERROR_DURING_ROLLBACK 1181
-#define ER_ERROR_DURING_FLUSH_LOGS 1182
-#define ER_ERROR_DURING_CHECKPOINT 1183
-#define ER_NEW_ABORTING_CONNECTION 1184
-#define ER_DUMP_NOT_IMPLEMENTED 1185
-#define ER_FLUSH_MASTER_BINLOG_CLOSED 1186
-#define ER_INDEX_REBUILD 1187
-#define ER_MASTER 1188
-#define ER_MASTER_NET_READ 1189
-#define ER_MASTER_NET_WRITE 1190
-#define ER_FT_MATCHING_KEY_NOT_FOUND 1191
-#define ER_LOCK_OR_ACTIVE_TRANSACTION 1192
-#define ER_UNKNOWN_SYSTEM_VARIABLE 1193
-#define ER_CRASHED_ON_USAGE 1194
-#define ER_CRASHED_ON_REPAIR 1195
-#define ER_WARNING_NOT_COMPLETE_ROLLBACK 1196
-#define ER_TRANS_CACHE_FULL 1197
-#define ER_SLAVE_MUST_STOP 1198
-#define ER_SLAVE_NOT_RUNNING 1199
-#define ER_BAD_SLAVE 1200
-#define ER_MASTER_INFO 1201
-#define ER_SLAVE_THREAD 1202
-#define ER_TOO_MANY_USER_CONNECTIONS 1203
-#define ER_SET_CONSTANTS_ONLY 1204
-#define ER_LOCK_WAIT_TIMEOUT 1205
-#define ER_LOCK_TABLE_FULL 1206
-#define ER_READ_ONLY_TRANSACTION 1207
-#define ER_ERROR_MESSAGES 208
diff --git a/ext/mysql/libmysql/mysys_err.h b/ext/mysql/libmysql/mysys_err.h
deleted file mode 100644
index 469d5a680e..0000000000
--- a/ext/mysql/libmysql/mysys_err.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-#ifndef _mysys_err_h
-#define _mysys_err_h
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define GLOB 0 /* Error maps */
-#define GLOBERRS 27 /* Max number of error messages in map's */
-#define EE(X) globerrs[ X ] /* Defines to add error to right map */
-
-extern const char * NEAR globerrs[]; /* my_error_messages is here */
-
-/* Error message numbers in global map */
-#define EE_FILENOTFOUND 0
-#define EE_CANTCREATEFILE 1
-#define EE_READ 2
-#define EE_WRITE 3
-#define EE_BADCLOSE 4
-#define EE_OUTOFMEMORY 5
-#define EE_DELETE 6
-#define EE_LINK 7
-#define EE_EOFERR 9
-#define EE_CANTLOCK 10
-#define EE_CANTUNLOCK 11
-#define EE_DIR 12
-#define EE_STAT 13
-#define EE_CANT_CHSIZE 14
-#define EE_CANT_OPEN_STREAM 15
-#define EE_GETWD 16
-#define EE_SETWD 17
-#define EE_LINK_WARNING 18
-#define EE_OPEN_WARNING 19
-#define EE_DISK_FULL 20
-#define EE_CANT_MKDIR 21
-#define EE_UNKNOWN_CHARSET 22
-#define EE_OUT_OF_FILERESOURCES 23
-#define EE_CANT_READLINK 24
-#define EE_CANT_SYMLINK 25
-#define EE_REALPATH 26
-
-#ifdef __cplusplus
-}
-#endif
-#endif
diff --git a/ext/mysql/libmysql/mysys_priv.h b/ext/mysql/libmysql/mysys_priv.h
deleted file mode 100644
index a0131ea77e..0000000000
--- a/ext/mysql/libmysql/mysys_priv.h
+++ /dev/null
@@ -1,18 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-#include <global.h>
-#include <my_sys.h>
-
-#ifdef USE_SYSTEM_WRAPPERS
-#include "system_wrappers.h"
-#endif
-
-#ifdef THREAD
-extern pthread_mutex_t THR_LOCK_malloc,THR_LOCK_open,THR_LOCK_keycache,
- THR_LOCK_lock,THR_LOCK_isam,THR_LOCK_net,THR_LOCK_charset;
-extern pthread_mutex_t LOCK_bitmap;
-#else /* THREAD */
-#define pthread_mutex_lock(A)
-#define pthread_mutex_unlock(A)
-#endif
diff --git a/ext/mysql/libmysql/net.c b/ext/mysql/libmysql/net.c
deleted file mode 100644
index 0dc0c06ffa..0000000000
--- a/ext/mysql/libmysql/net.c
+++ /dev/null
@@ -1,664 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-/* Write and read of logical packets to/from socket
-** Writes are cached into net_buffer_length big packets.
-** Read packets are reallocated dynamicly when reading big packets.
-** Each logical packet has the following pre-info:
-** 3 byte length & 1 byte package-number.
-*/
-
-#ifdef __WIN__
-#include <winsock.h>
-#endif
-#include <global.h>
-#include <violite.h>
-#include <my_sys.h>
-#include <m_string.h>
-#include "mysql.h"
-#include "mysqld_error.h"
-#include <signal.h>
-#include <errno.h>
-#include <sys/types.h>
-
-#ifdef MYSQL_SERVER
-ulong max_allowed_packet=65536;
-extern ulong net_read_timeout,net_write_timeout;
-extern uint test_flags;
-#else
-ulong max_allowed_packet=16*1024*1024L;
-ulong net_read_timeout= NET_READ_TIMEOUT;
-ulong net_write_timeout= NET_WRITE_TIMEOUT;
-#endif
-ulong net_buffer_length=8192; /* Default length. Enlarged if necessary */
-
-#if !defined(__WIN__) && !defined(MSDOS)
-#include <sys/socket.h>
-#else
-#undef MYSQL_SERVER /* Win32 can't handle interrupts */
-#endif
-#if !defined(MSDOS) && !defined(__WIN__) && !defined(HAVE_BROKEN_NETINET_INCLUDES) && !defined(__BEOS__)
-#include <netinet/in_systm.h>
-#include <netinet/in.h>
-#include <netinet/ip.h>
-#if !defined(alpha_linux_port)
-#include <netinet/tcp.h>
-#endif
-#endif
-#include "mysqld_error.h"
-#ifdef MYSQL_SERVER
-#include "my_pthread.h"
-#include "thr_alarm.h"
-void sql_print_error(const char *format,...);
-#define RETRY_COUNT mysqld_net_retry_count
-extern ulong mysqld_net_retry_count;
-#else
-typedef my_bool thr_alarm_t;
-typedef my_bool ALARM;
-#define thr_alarm_init(A) (*A)=0
-#define thr_alarm_in_use(A) (*(A))
-#define thr_end_alarm(A)
-#define thr_alarm(A,B,C) local_thr_alarm((A),(B),(C))
-static inline int local_thr_alarm(my_bool *A,int B __attribute__((unused)),ALARM *C __attribute__((unused)))
-{
- *A=1;
- return 0;
-}
-#define thr_got_alarm(A) 0
-#define RETRY_COUNT 1
-#endif
-
-#ifdef MYSQL_SERVER
-extern ulong bytes_sent, bytes_received;
-extern pthread_mutex_t LOCK_bytes_sent , LOCK_bytes_received;
-#else
-#undef statistic_add
-#define statistic_add(A,B,C)
-#endif
-
-/*
-** Give error if a too big packet is found
-** The server can change this with the -O switch, but because the client
-** can't normally do this the client should have a bigger max-buffer.
-*/
-
-#define TEST_BLOCKING 8
-static int net_write_buff(NET *net,const char *packet,uint len);
-
-
- /* Init with packet info */
-
-int my_net_init(NET *net, Vio* vio)
-{
- if (!(net->buff=(uchar*) my_malloc(net_buffer_length,MYF(MY_WME))))
- return 1;
- if (net_buffer_length > max_allowed_packet)
- max_allowed_packet=net_buffer_length;
- net->buff_end=net->buff+(net->max_packet=net_buffer_length);
- net->vio = vio;
- net->no_send_ok = 0;
- net->error=0; net->return_errno=0; net->return_status=0;
- net->timeout=(uint) net_read_timeout; /* Timeout for read */
- net->pkt_nr=0;
- net->write_pos=net->read_pos = net->buff;
- net->last_error[0]=0;
- net->compress=0; net->reading_or_writing=0;
- net->where_b = net->remain_in_buf=0;
- net->last_errno=0;
-
- if (vio != 0) /* If real connection */
- {
- net->fd = vio_fd(vio); /* For perl DBI/DBD */
-#if defined(MYSQL_SERVER) && !defined(___WIN__) && !defined(__EMX__)
- if (!(test_flags & TEST_BLOCKING))
- vio_blocking(vio, FALSE);
-#endif
- vio_fastsend(vio);
- }
- return 0;
-}
-
-void net_end(NET *net)
-{
- my_free((gptr) net->buff,MYF(MY_ALLOW_ZERO_PTR));
- net->buff=0;
-}
-
-/* Realloc the packet buffer */
-
-static my_bool net_realloc(NET *net, ulong length)
-{
- uchar *buff;
- ulong pkt_length;
- if (length >= max_allowed_packet)
- {
- DBUG_PRINT("error",("Packet too large (%lu)", length));
- net->error=1;
- net->last_errno=ER_NET_PACKET_TOO_LARGE;
- return 1;
- }
- pkt_length = (length+IO_SIZE-1) & ~(IO_SIZE-1);
- if (!(buff=(uchar*) my_realloc((char*) net->buff, pkt_length, MYF(MY_WME))))
- {
- net->error=1;
-#ifdef MYSQL_SERVER
- net->last_errno=ER_OUT_OF_RESOURCES;
-#endif
- return 1;
- }
- net->buff=net->write_pos=buff;
- net->buff_end=buff+(net->max_packet=pkt_length);
- return 0;
-}
-
- /* Remove unwanted characters from connection */
-
-void net_clear(NET *net)
-{
-#ifndef EXTRA_DEBUG
- int count;
- bool is_blocking=vio_is_blocking(net->vio);
- if (is_blocking)
- vio_blocking(net->vio, FALSE);
- if (!vio_is_blocking(net->vio)) /* Safety if SSL */
- {
- while ( (count = vio_read(net->vio, (char*) (net->buff),
- net->max_packet)) > 0)
- DBUG_PRINT("info",("skipped %d bytes from file: %s",
- count,vio_description(net->vio)));
- if (is_blocking)
- vio_blocking(net->vio, TRUE);
- }
-#endif /* EXTRA_DEBUG */
- net->pkt_nr=0; /* Ready for new command */
- net->write_pos=net->buff;
-}
-
- /* Flush write_buffer if not empty. */
-
-int net_flush(NET *net)
-{
- int error=0;
- DBUG_ENTER("net_flush");
- if (net->buff != net->write_pos)
- {
- error=net_real_write(net,(char*) net->buff,
- (uint) (net->write_pos - net->buff));
- net->write_pos=net->buff;
- }
- DBUG_RETURN(error);
-}
-
-
-/*****************************************************************************
-** Write something to server/client buffer
-*****************************************************************************/
-
-
-/*
-** Write a logical packet with packet header
-** Format: Packet length (3 bytes), packet number(1 byte)
-** When compression is used a 3 byte compression length is added
-** NOTE: If compression is used the original package is destroyed!
-*/
-
-int
-my_net_write(NET *net,const char *packet,ulong len)
-{
- uchar buff[NET_HEADER_SIZE];
- int3store(buff,len);
- buff[3]= (net->compress) ? 0 : (uchar) (net->pkt_nr++);
- if (net_write_buff(net,(char*) buff,NET_HEADER_SIZE))
- return 1;
- return net_write_buff(net,packet,len);
-}
-
-int
-net_write_command(NET *net,uchar command,const char *packet,ulong len)
-{
- uchar buff[NET_HEADER_SIZE+1];
- uint length=len+1; /* 1 extra byte for command */
-
- int3store(buff,length);
- buff[3]= (net->compress) ? 0 : (uchar) (net->pkt_nr++);
- buff[4]=command;
- if (net_write_buff(net,(char*) buff,5))
- return 1;
- return test(net_write_buff(net,packet,len) || net_flush(net));
-}
-
-
-static int
-net_write_buff(NET *net,const char *packet,uint len)
-{
- uint left_length=(uint) (net->buff_end - net->write_pos);
-
- while (len > left_length)
- {
- memcpy((char*) net->write_pos,packet,left_length);
- if (net_real_write(net,(char*) net->buff,net->max_packet))
- return 1;
- net->write_pos=net->buff;
- packet+=left_length;
- len-=left_length;
- left_length=net->max_packet;
- }
- memcpy((char*) net->write_pos,packet,len);
- net->write_pos+=len;
- return 0;
-}
-
-/* Read and write using timeouts */
-
-int
-net_real_write(NET *net,const char *packet,ulong len)
-{
- int length;
- char *pos,*end;
- thr_alarm_t alarmed;
-#if !defined(__WIN__) && !defined(__EMX__)
- ALARM alarm_buff;
-#endif
- uint retry_count=0;
- my_bool net_blocking = vio_is_blocking(net->vio);
- DBUG_ENTER("net_real_write");
-
- if (net->error == 2)
- DBUG_RETURN(-1); /* socket can't be used */
-
- net->reading_or_writing=2;
-#ifdef HAVE_COMPRESS
- if (net->compress)
- {
- ulong complen;
- uchar *b;
- uint header_length=NET_HEADER_SIZE+COMP_HEADER_SIZE;
- if (!(b=(uchar*) my_malloc(len + NET_HEADER_SIZE + COMP_HEADER_SIZE,
- MYF(MY_WME))))
- {
-#ifdef MYSQL_SERVER
- net->last_errno=ER_OUT_OF_RESOURCES;
- net->error=2;
-#endif
- net->reading_or_writing=0;
- DBUG_RETURN(1);
- }
- memcpy(b+header_length,packet,len);
-
- if (my_compress((byte*) b+header_length,&len,&complen))
- {
- DBUG_PRINT("warning",
- ("Compression error; Continuing without compression"));
- complen=0;
- }
- int3store(&b[NET_HEADER_SIZE],complen);
- int3store(b,len);
- b[3]=(uchar) (net->pkt_nr++);
- len+= header_length;
- packet= (char*) b;
- }
-#endif /* HAVE_COMPRESS */
-
- /* DBUG_DUMP("net",packet,len); */
-#ifdef MYSQL_SERVER
- thr_alarm_init(&alarmed);
- if (net_blocking)
- thr_alarm(&alarmed,(uint) net_write_timeout,&alarm_buff);
-#else
- alarmed=0;
-#endif /* MYSQL_SERVER */
-
- pos=(char*) packet; end=pos+len;
- while (pos != end)
- {
- if ((int) (length=vio_write(net->vio,pos,(int) (end-pos))) <= 0)
- {
- my_bool interrupted = vio_should_retry(net->vio);
-#if (!defined(__WIN__) && !defined(__EMX__))
- if ((interrupted || length==0) && !thr_alarm_in_use(&alarmed))
- {
- if (!thr_alarm(&alarmed,(uint) net_write_timeout,&alarm_buff))
- { /* Always true for client */
- if (!vio_is_blocking(net->vio))
- {
- while (vio_blocking(net->vio, TRUE) < 0)
- {
- if (vio_should_retry(net->vio) && retry_count++ < RETRY_COUNT)
- continue;
-#ifdef EXTRA_DEBUG
- fprintf(stderr,
- "%s: my_net_write: fcntl returned error %d, aborting thread\n",
- my_progname,vio_errno(net->vio));
-#endif /* EXTRA_DEBUG */
- net->error=2; /* Close socket */
- goto end;
- }
- }
- retry_count=0;
- continue;
- }
- }
- else
-#endif /* (!defined(__WIN__) && !defined(__EMX__)) */
- if (thr_alarm_in_use(&alarmed) && !thr_got_alarm(&alarmed) &&
- interrupted)
- {
- if (retry_count++ < RETRY_COUNT)
- continue;
-#ifdef EXTRA_DEBUG
- fprintf(stderr, "%s: write looped, aborting thread\n",
- my_progname);
-#endif /* EXTRA_DEBUG */
- }
-#if defined(THREAD_SAFE_CLIENT) && !defined(MYSQL_SERVER)
- if (vio_errno(net->vio) == EINTR)
- {
- DBUG_PRINT("warning",("Interrupted write. Retrying..."));
- continue;
- }
-#endif /* defined(THREAD_SAFE_CLIENT) && !defined(MYSQL_SERVER) */
- net->error=2; /* Close socket */
-#ifdef MYSQL_SERVER
- net->last_errno= (interrupted ? ER_NET_WRITE_INTERRUPTED :
- ER_NET_ERROR_ON_WRITE);
-#endif /* MYSQL_SERVER */
- break;
- }
- pos+=length;
- statistic_add(bytes_sent,length,&LOCK_bytes_sent);
- }
-#ifndef __WIN__
- end:
-#endif
-#ifdef HAVE_COMPRESS
- if (net->compress)
- my_free((char*) packet,MYF(0));
-#endif
- if (thr_alarm_in_use(&alarmed))
- {
- thr_end_alarm(&alarmed);
- vio_blocking(net->vio, net_blocking);
- }
- net->reading_or_writing=0;
- DBUG_RETURN(((int) (pos != end)));
-}
-
-
-/*****************************************************************************
-** Read something from server/clinet
-*****************************************************************************/
-
-#ifdef MYSQL_SERVER
-
-/*
- Help function to clear the commuication buffer when we get a too
- big packet
-*/
-
-static void my_net_skip_rest(NET *net, ulong remain, thr_alarm_t *alarmed)
-{
- ALARM alarm_buff;
- uint retry_count=0;
- if (!thr_alarm_in_use(&alarmed))
- {
- if (!thr_alarm(alarmed,net->timeout,&alarm_buff) ||
- (!vio_is_blocking(net->vio) && vio_blocking(net->vio,TRUE) < 0))
- return; /* Can't setup, abort */
- }
- while (remain > 0)
- {
- ulong length;
- if ((int) (length=vio_read(net->vio,(char*) net->buff,remain)) <= 0L)
- {
- my_bool interrupted = vio_should_retry(net->vio);
- if (!thr_got_alarm(&alarmed) && interrupted)
- { /* Probably in MIT threads */
- if (retry_count++ < RETRY_COUNT)
- continue;
- }
- return;
- }
- remain -=(ulong) length;
- statistic_add(bytes_received,(ulong) length,&LOCK_bytes_received);
- }
-}
-#endif /* MYSQL_SERVER */
-
-
-static uint
-my_real_read(NET *net, ulong *complen)
-{
- uchar *pos;
- long length;
- uint i,retry_count=0;
- ulong len=packet_error;
- thr_alarm_t alarmed;
-#if (!defined(__WIN__) && !defined(__EMX__)) || defined(MYSQL_SERVER)
- ALARM alarm_buff;
-#endif
- my_bool net_blocking=vio_is_blocking(net->vio);
- ulong remain= (net->compress ? NET_HEADER_SIZE+COMP_HEADER_SIZE :
- NET_HEADER_SIZE);
- *complen = 0;
-
- net->reading_or_writing=1;
- thr_alarm_init(&alarmed);
-#ifdef MYSQL_SERVER
- if (net_blocking)
- thr_alarm(&alarmed,net->timeout,&alarm_buff);
-#endif /* MYSQL_SERVER */
-
- pos = net->buff + net->where_b; /* net->packet -4 */
- for (i=0 ; i < 2 ; i++)
- {
- while (remain > 0)
- {
- /* First read is done with non blocking mode */
- if ((int) (length=vio_read(net->vio,(char*) pos,remain)) <= 0L)
- {
- my_bool interrupted = vio_should_retry(net->vio);
-
- DBUG_PRINT("info",("vio_read returned %d, errno: %d",
- length, vio_errno(net->vio)));
-#if (!defined(__WIN__) && !defined(__EMX__)) || defined(MYSQL_SERVER)
- /*
- We got an error that there was no data on the socket. We now set up
- an alarm to not 'read forever', change the socket to non blocking
- mode and try again
- */
- if ((interrupted || length == 0) && !thr_alarm_in_use(&alarmed))
- {
- if (!thr_alarm(&alarmed,net->timeout,&alarm_buff)) /* Don't wait too long */
- {
- if (!vio_is_blocking(net->vio))
- {
- while (vio_blocking(net->vio,TRUE) < 0)
- {
- if (vio_should_retry(net->vio) &&
- retry_count++ < RETRY_COUNT)
- continue;
- DBUG_PRINT("error",
- ("fcntl returned error %d, aborting thread",
- vio_errno(net->vio)));
-#ifdef EXTRA_DEBUG
- fprintf(stderr,
- "%s: read: fcntl returned error %d, aborting thread\n",
- my_progname,vio_errno(net->vio));
-#endif /* EXTRA_DEBUG */
- len= packet_error;
- net->error=2; /* Close socket */
-#ifdef MYSQL_SERVER
- net->last_errno=ER_NET_FCNTL_ERROR;
-#endif
- goto end;
- }
- }
- retry_count=0;
- continue;
- }
- }
-#endif /* (!defined(__WIN__) && !defined(__EMX__)) || defined(MYSQL_SERVER) */
- if (thr_alarm_in_use(&alarmed) && !thr_got_alarm(&alarmed) &&
- interrupted)
- { /* Probably in MIT threads */
- if (retry_count++ < RETRY_COUNT)
- continue;
-#ifdef EXTRA_DEBUG
- fprintf(stderr, "%s: read looped with error %d, aborting thread\n",
- my_progname,vio_errno(net->vio));
-#endif /* EXTRA_DEBUG */
- }
-#if defined(THREAD_SAFE_CLIENT) && !defined(MYSQL_SERVER)
- if (vio_should_retry(net->vio))
- {
- DBUG_PRINT("warning",("Interrupted read. Retrying..."));
- continue;
- }
-#endif
- DBUG_PRINT("error",("Couldn't read packet: remain: %d errno: %d length: %d alarmed: %d", remain,vio_errno(net->vio),length,alarmed));
- len= packet_error;
- net->error=2; /* Close socket */
-#ifdef MYSQL_SERVER
- net->last_errno= (interrupted ? ER_NET_READ_INTERRUPTED :
- ER_NET_READ_ERROR);
-#endif
- goto end;
- }
- remain -= (ulong) length;
- pos+= (ulong) length;
- statistic_add(bytes_received,(ulong) length,&LOCK_bytes_received);
- }
- if (i == 0)
- { /* First parts is packet length */
- ulong helping;
- if (net->buff[net->where_b + 3] != (uchar) net->pkt_nr)
- {
- if (net->buff[net->where_b] != (uchar) 255)
- {
- DBUG_PRINT("error",
- ("Packets out of order (Found: %d, expected %d)",
- (int) net->buff[net->where_b + 3],
- (uint) (uchar) net->pkt_nr));
-#ifdef EXTRA_DEBUG
- fprintf(stderr,"Packets out of order (Found: %d, expected %d)\n",
- (int) net->buff[net->where_b + 3],
- (uint) (uchar) net->pkt_nr);
-#endif
- }
- len= packet_error;
-#ifdef MYSQL_SERVER
- net->last_errno=ER_NET_PACKETS_OUT_OF_ORDER;
-#endif
- goto end;
- }
- net->pkt_nr++;
-#ifdef HAVE_COMPRESS
- if (net->compress)
- {
- /* complen is > 0 if package is really compressed */
- *complen=uint3korr(&(net->buff[net->where_b + NET_HEADER_SIZE]));
- }
-#endif
-
- len=uint3korr(net->buff+net->where_b);
- helping = max(len,*complen) + net->where_b;
- /* The necessary size of net->buff */
- if (helping >= net->max_packet)
- {
- /* We must allocate one extra byte for the end null */
- if (net_realloc(net,helping+1))
- {
-#ifdef MYSQL_SERVER
- if (i == 1)
- my_net_skip_rest(net, len, &alarmed);
-#endif
- len= packet_error; /* Return error */
- goto end;
- }
- }
- pos=net->buff + net->where_b;
- remain = len;
- }
- }
-
-end:
- if (thr_alarm_in_use(&alarmed))
- {
- thr_end_alarm(&alarmed);
- vio_blocking(net->vio, net_blocking);
- }
- net->reading_or_writing=0;
- return(len);
-}
-
-uint
-my_net_read(NET *net)
-{
- ulong len,complen;
-
-#ifdef HAVE_COMPRESS
- if (!net->compress)
- {
-#endif
- len = my_real_read (net,&complen);
- net->read_pos = net->buff + net->where_b;
- if (len != packet_error)
- net->read_pos[len]=0; /* Safeguard for mysql_use_result */
- return len;
-#ifdef HAVE_COMPRESS
- }
- if (net->remain_in_buf)
- net->buff[net->buf_length - net->remain_in_buf]=net->save_char;
- for (;;)
- {
- if (net->remain_in_buf)
- {
- uchar *pos = net->buff + net->buf_length - net->remain_in_buf;
- if (net->remain_in_buf >= 4)
- {
- net->length = uint3korr(pos);
- if (net->length <= net->remain_in_buf - 4)
- {
- /* We have a full packet */
- len=net->length;
- net->remain_in_buf -= net->length + 4;
- net->read_pos=pos + 4;
- break; /* We have a full packet */
- }
- }
- /* Move data down to read next data packet after current one */
- if (net->buf_length != net->remain_in_buf)
- {
- memmove(net->buff,pos,net->remain_in_buf);
- net->buf_length=net->remain_in_buf;
- }
- net->where_b=net->buf_length;
- }
- else
- {
- net->where_b=0;
- net->buf_length=0;
- }
-
- if ((len = my_real_read(net,&complen)) == packet_error)
- break;
- if (my_uncompress((byte*) net->buff + net->where_b, &len, &complen))
- {
- len= packet_error;
- net->error=2; /* caller will close socket */
-#ifdef MYSQL_SERVER
- net->last_errno=ER_NET_UNCOMPRESS_ERROR;
-#endif
- break;
- }
- net->buf_length+=len;
- net->remain_in_buf+=len;
- }
- if (len != packet_error)
- {
- net->save_char= net->read_pos[len]; /* Must be saved */
- net->read_pos[len]=0; /* Safeguard for mysql_use_result */
- }
- return len;
-#endif
-}
diff --git a/ext/mysql/libmysql/password.c b/ext/mysql/libmysql/password.c
deleted file mode 100644
index eb40825401..0000000000
--- a/ext/mysql/libmysql/password.c
+++ /dev/null
@@ -1,178 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-/* password checking routines */
-/*****************************************************************************
- The main idea is that no password are sent between client & server on
- connection and that no password are saved in mysql in a decodable form.
-
- On connection a random string is generated and sent to the client.
- The client generates a new string with a random generator inited with
- the hash values from the password and the sent string.
- This 'check' string is sent to the server where it is compared with
- a string generated from the stored hash_value of the password and the
- random string.
-
- The password is saved (in user.password) by using the PASSWORD() function in
- mysql.
-
- Example:
- update user set password=PASSWORD("hello") where user="test"
- This saves a hashed number as a string in the password field.
-*****************************************************************************/
-
-#include <global.h>
-#include <my_sys.h>
-#include <m_string.h>
-#include "mysql.h"
-
-
-void randominit(struct rand_struct *rand_st,ulong seed1, ulong seed2)
-{ /* For mysql 3.21.# */
-#ifdef HAVE_purify
- bzero((char*) rand_st,sizeof(*rand_st)); /* Avoid UMC varnings */
-#endif
- rand_st->max_value= 0x3FFFFFFFL;
- rand_st->max_value_dbl=(double) rand_st->max_value;
- rand_st->seed1=seed1%rand_st->max_value ;
- rand_st->seed2=seed2%rand_st->max_value;
-}
-
-static void old_randominit(struct rand_struct *rand_st,ulong seed1)
-{ /* For mysql 3.20.# */
- rand_st->max_value= 0x01FFFFFFL;
- rand_st->max_value_dbl=(double) rand_st->max_value;
- seed1%=rand_st->max_value;
- rand_st->seed1=seed1 ; rand_st->seed2=seed1/2;
-}
-
-double rnd(struct rand_struct *rand_st)
-{
- rand_st->seed1=(rand_st->seed1*3+rand_st->seed2) % rand_st->max_value;
- rand_st->seed2=(rand_st->seed1+rand_st->seed2+33) % rand_st->max_value;
- return (((double) rand_st->seed1)/rand_st->max_value_dbl);
-}
-
-void hash_password(ulong *result, const char *password)
-{
- register ulong nr=1345345333L, add=7, nr2=0x12345671L;
- ulong tmp;
- for (; *password ; password++)
- {
- if (*password == ' ' || *password == '\t')
- continue; /* skipp space in password */
- tmp= (ulong) (uchar) *password;
- nr^= (((nr & 63)+add)*tmp)+ (nr << 8);
- nr2+=(nr2 << 8) ^ nr;
- add+=tmp;
- }
- result[0]=nr & (((ulong) 1L << 31) -1L); /* Don't use sign bit (str2int) */;
- result[1]=nr2 & (((ulong) 1L << 31) -1L);
- return;
-}
-
-void make_scrambled_password(char *to,const char *password)
-{
- ulong hash_res[2];
- hash_password(hash_res,password);
- sprintf(to,"%08lx%08lx",hash_res[0],hash_res[1]);
-}
-
-static inline uint char_val(char X)
-{
- return (uint) (X >= '0' && X <= '9' ? X-'0' :
- X >= 'A' && X <= 'Z' ? X-'A'+10 :
- X-'a'+10);
-}
-
-/*
-** This code assumes that len(password) is divideable with 8 and that
-** res is big enough (2 in mysql)
-*/
-
-void get_salt_from_password(ulong *res,const char *password)
-{
- res[0]=res[1]=0;
- if (password)
- {
- while (*password)
- {
- ulong val=0;
- uint i;
- for (i=0 ; i < 8 ; i++)
- val=(val << 4)+char_val(*password++);
- *res++=val;
- }
- }
- return;
-}
-
-void make_password_from_salt(char *to, ulong *hash_res)
-{
- sprintf(to,"%08lx%08lx",hash_res[0],hash_res[1]);
-}
-
-
-/*
- * Genererate a new message based on message and password
- * The same thing is done in client and server and the results are checked.
- */
-
-char *scramble(char *to,const char *message,const char *password,
- my_bool old_ver)
-{
- struct rand_struct rand_st;
- ulong hash_pass[2],hash_message[2];
- if (password && password[0])
- {
- char *to_start=to;
- hash_password(hash_pass,password);
- hash_password(hash_message,message);
- if (old_ver)
- old_randominit(&rand_st,hash_pass[0] ^ hash_message[0]);
- else
- randominit(&rand_st,hash_pass[0] ^ hash_message[0],
- hash_pass[1] ^ hash_message[1]);
- while (*message++)
- *to++= (char) (floor(rnd(&rand_st)*31)+64);
- if (!old_ver)
- { /* Make it harder to break */
- char extra=(char) (floor(rnd(&rand_st)*31));
- while (to_start != to)
- *(to_start++)^=extra;
- }
- }
- *to=0;
- return to;
-}
-
-
-my_bool check_scramble(const char *scrambled, const char *message,
- ulong *hash_pass, my_bool old_ver)
-{
- struct rand_struct rand_st;
- ulong hash_message[2];
- char buff[16],*to,extra; /* Big enough for check */
- const char *pos;
-
- hash_password(hash_message,message);
- if (old_ver)
- old_randominit(&rand_st,hash_pass[0] ^ hash_message[0]);
- else
- randominit(&rand_st,hash_pass[0] ^ hash_message[0],
- hash_pass[1] ^ hash_message[1]);
- to=buff;
- for (pos=scrambled ; *pos ; pos++)
- *to++=(char) (floor(rnd(&rand_st)*31)+64);
- if (old_ver)
- extra=0;
- else
- extra=(char) (floor(rnd(&rand_st)*31));
- to=buff;
- while (*scrambled)
- {
- if (*scrambled++ != (char) (*to++ ^ extra))
- return 1; /* Wrong password */
- }
- return 0;
-}
diff --git a/ext/mysql/libmysql/raid.h b/ext/mysql/libmysql/raid.h
deleted file mode 100644
index f6f5306392..0000000000
--- a/ext/mysql/libmysql/raid.h
+++ /dev/null
@@ -1,147 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-/* Parser needs these defines always, even if USE_RAID is not defined */
-#define RAID_TYPE_0 1 /* Striping */
-#define RAID_TYPE_x 2 /* Some new modes */
-#define RAID_TYPE_y 3
-
-#define RAID_DEFAULT_CHUNKS 4
-#define RAID_DEFAULT_CHUNKSIZE 256*1024 /* 256kB */
-
-extern const char *raid_type_string[];
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-const char *my_raid_type(int raid_type);
-#ifdef __cplusplus
-}
-#endif
-
-#ifdef USE_RAID
-
-#ifdef __GNUC__
-#pragma interface /* gcc class implementation */
-#endif
-#include "my_dir.h"
-
-/* Trap all occurences of my_...() in source and use our wrapper around this function */
-
-#ifdef MAP_TO_USE_RAID
-#define my_read(A,B,C,D) my_raid_read(A,B,C,D)
-#define my_write(A,B,C,D) my_raid_write(A,B,C,D)
-#define my_pwrite(A,B,C,D,E) my_raid_pwrite(A,B,C,D,E)
-#define my_pread(A,B,C,D,E) my_raid_pread(A,B,C,D,E)
-#define my_chsize(A,B,C) my_raid_chsize(A,B,C)
-#define my_close(A,B) my_raid_close(A,B)
-#define my_tell(A,B) my_raid_tell(A,B)
-#define my_seek(A,B,C,D) my_raid_seek(A,B,C,D)
-#define my_lock(A,B,C,D,E) my_raid_lock(A,B,C,D,E)
-#define my_fstat(A,B,C) my_raid_fstat(A,B,C)
-#endif /* MAP_TO_USE_RAID */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
- void init_raid(void);
- void end_raid(void);
-
- bool is_raid(File fd);
- File my_raid_create(const char *FileName, int CreateFlags, int access_flags,
- uint raid_type, uint raid_chunks, ulong raid_chunksize,
- myf MyFlags);
- File my_raid_open(const char *FileName, int Flags,
- uint raid_type, uint raid_chunks, ulong raid_chunksize,
- myf MyFlags);
- int my_raid_rename(const char *from, const char *to, uint raid_chunks,
- myf MyFlags);
- int my_raid_delete(const char *from, uint raid_chunks, myf MyFlags);
- int my_raid_redel(const char *old_name, const char *new_name,
- uint raid_chunks, myf MyFlags);
-
- my_off_t my_raid_seek(File fd, my_off_t pos, int whence, myf MyFlags);
- my_off_t my_raid_tell(File fd, myf MyFlags);
-
- uint my_raid_write(File,const byte *Buffer, uint Count, myf MyFlags);
- uint my_raid_read(File Filedes, byte *Buffer, uint Count, myf MyFlags);
-
- uint my_raid_pread(File Filedes, byte *Buffer, uint Count, my_off_t offset,
- myf MyFlags);
- uint my_raid_pwrite(int Filedes, const byte *Buffer, uint Count,
- my_off_t offset, myf MyFlags);
-
- int my_raid_lock(File,int locktype, my_off_t start, my_off_t length,
- myf MyFlags);
- int my_raid_chsize(File fd, my_off_t newlength, myf MyFlags);
- int my_raid_close(File, myf MyFlags);
- int my_raid_fstat(int Filedes, struct stat *buf, myf MyFlags);
-
-#ifdef __cplusplus
-}
-
-class RaidName {
- public:
- RaidName(const char *FileName);
- ~RaidName();
- bool IsRaid();
- int Rename(const char * from, const char * to, myf MyFlags);
- private:
- uint _raid_type; /* RAID_TYPE_0 or RAID_TYPE_1 or RAID_TYPE_5 */
- uint _raid_chunks; /* 1..n */
- ulong _raid_chunksize; /* 1..n in bytes */
-};
-
-class RaidFd {
- public:
- RaidFd(uint raid_type, uint raid_chunks , ulong raid_chunksize);
- ~RaidFd();
- File Create(const char *FileName, int CreateFlags, int access_flags,
- myf MyFlags);
- File Open(const char *FileName, int Flags, myf MyFlags);
- my_off_t Seek(my_off_t pos,int whence,myf MyFlags);
- my_off_t Tell(myf MyFlags);
- int Write(const byte *Buffer, uint Count, myf MyFlags);
- int Read(const byte *Buffer, uint Count, myf MyFlags);
- int Lock(int locktype, my_off_t start, my_off_t length, myf MyFlags);
- int Chsize(File fd, my_off_t newlength, myf MyFlags);
- int Fstat(int fd, MY_STAT *stat_area, myf MyFlags );
- int Close(myf MyFlags);
- static bool IsRaid(File fd);
- static DYNAMIC_ARRAY _raid_map; /* Map of RaidFD* */
- private:
-
- uint _raid_type; /* RAID_TYPE_0 or RAID_TYPE_1 or RAID_TYPE_5 */
- uint _raid_chunks; /* 1..n */
- ulong _raid_chunksize; /* 1..n in bytes */
-
- ulong _total_block; /* We are operating with block no x (can be 0..many). */
- uint _this_block; /* can be 0.._raid_chunks */
- uint _remaining_bytes; /* Maximum bytes that can be written in this block */
-
- my_off_t _position;
- my_off_t _size; /* Cached file size for faster seek(SEEK_END) */
- File _fd;
- File *_fd_vector; /* Array of File */
- off_t *_seek_vector; /* Array of cached seek positions */
-
- inline void Calculate()
- {
- DBUG_ENTER("RaidFd::_Calculate");
- DBUG_PRINT("info",("_position: %lu _raid_chunksize: %d, _size: %lu",
- (ulong) _position, _raid_chunksize, (ulong) _size));
-
- _total_block = (ulong) (_position / _raid_chunksize);
- _this_block = _total_block % _raid_chunks; /* can be 0.._raid_chunks */
- _remaining_bytes = (uint) (_raid_chunksize -
- (_position - _total_block * _raid_chunksize));
- DBUG_PRINT("info",
- ("_total_block: %d this_block: %d _remaining_bytes:%d",
- _total_block, _this_block, _remaining_bytes));
- DBUG_VOID_RETURN;
- }
-};
-
-#endif /* __cplusplus */
-#endif /* USE_RAID */
diff --git a/ext/mysql/libmysql/safemalloc.c b/ext/mysql/libmysql/safemalloc.c
deleted file mode 100644
index 1918034c19..0000000000
--- a/ext/mysql/libmysql/safemalloc.c
+++ /dev/null
@@ -1,510 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-/*
- * [This posting refers to an article entitled "oops, corrupted memory
- * again!" in net.lang.c. I am posting it here because it is source.]
- *
- * My tool for approaching this problem is to build another level of data
- * abstraction on top of malloc() and free() that implements some checking.
- * This does a number of things for you:
- * - Checks for overruns and underruns on allocated data
- * - Keeps track of where in the program the memory was malloc'ed
- * - Reports on pieces of memory that were not free'ed
- * - Records some statistics such as maximum memory used
- * - Marks newly malloc'ed and newly free'ed memory with special values
- * You can use this scheme to:
- * - Find bugs such as overrun, underrun, etc because you know where
- * a piece of data was malloc'ed and where it was free'ed
- * - Find bugs where memory was not free'ed
- * - Find bugs where newly malloc'ed memory is used without initializing
- * - Find bugs where newly free'ed memory is still used
- * - Determine how much memory your program really uses
- * - and other things
- */
-
-/*
- * To implement my scheme you must have a C compiler that has __LINE__ and
- * __FILE__ macros. If your compiler doesn't have these then (a) buy another:
- * compilers that do are available on UNIX 4.2bsd based systems and the PC,
- * and probably on other machines; or (b) change my scheme somehow. I have
- * recomendations on both these points if you would like them (e-mail please).
- *
- * There are 4 functions in my package:
- * char *NEW( uSize ) Allocate memory of uSize bytes
- * (equivalent to malloc())
- * char *REA( pPtr, uSize) Allocate memory of uSize bytes, move data and
- * free pPtr.
- * (equivalent to realloc())
- * FREE( pPtr ) Free memory allocated by NEW
- * (equivalent to free())
- * TERMINATE(file) End system, report errors and stats on file
- * I personally use two more functions, but have not included them here:
- * char *STRSAVE( sPtr ) Save a copy of the string in dynamic memory
- * char *RENEW( pPtr, uSize )
- * (equivalent to realloc())
- */
-
-/*
- * Memory sub-system, written by Bjorn Benson
- Fixed to use my_sys scheme by Michael Widenius
- */
-
-#ifndef SAFEMALLOC
-#define SAFEMALLOC /* Get protos from my_sys */
-#endif
-
-#include "mysys_priv.h"
-#include <m_string.h>
-#include "my_static.h"
-#include "mysys_err.h"
-
-ulonglong safemalloc_mem_limit = ~(ulonglong)0;
-
-#define pNext tInt._pNext
-#define pPrev tInt._pPrev
-#define sFileName tInt._sFileName
-#define uLineNum tInt._uLineNum
-#define uDataSize tInt._uDataSize
-#define lSpecialValue tInt._lSpecialValue
-
- /* Static functions prototypes */
-
-static int check_ptr(const char *where, byte *ptr, const char *sFile,
- uint uLine);
-static int _checkchunk(struct remember *pRec, const char *sFile, uint uLine);
-
-/*
- * Note: both these refer to the NEW'ed
- * data only. They do not include
- * malloc() roundoff or the extra
- * space required by the remember
- * structures.
- */
-
-#define ALLOC_VAL (uchar) 0xA5 /* NEW'ed memory is filled with this */
- /* value so that references to it will */
- /* end up being very strange. */
-#define FREE_VAL (uchar) 0x8F /* FREE'ed memory is filled with this */
- /* value so that references to it will */
- /* also end up being strange. */
-
-#define MAGICKEY 0x14235296 /* A magic value for underrun key */
-#define MAGICEND0 0x68 /* Magic values for overrun keys */
-#define MAGICEND1 0x34 /* " */
-#define MAGICEND2 0x7A /* " */
-#define MAGICEND3 0x15 /* " */
-
- /* Warning: do not change the MAGICEND? values to */
- /* something with the high bit set. Various C */
- /* compilers (like the 4.2bsd one) do not do the */
- /* sign extension right later on in this code and */
- /* you will get erroneous errors. */
-
-
-/*
- * gptr _mymalloc( uint uSize, my_string sFile, uint uLine, MyFlags )
- * Allocate some memory.
- */
-
-gptr _mymalloc (uint uSize, const char *sFile, uint uLine, myf MyFlags)
-{
- struct remember *pTmp;
- DBUG_ENTER("_mymalloc");
- DBUG_PRINT("enter",("Size: %u",uSize));
-
-
- if (!sf_malloc_quick)
- (void) _sanity (sFile, uLine);
-
- if(uSize + lCurMemory > safemalloc_mem_limit)
- pTmp = 0;
- else
- /* Allocate the physical memory */
- pTmp = (struct remember *) malloc (
- sizeof (struct irem) /* remember data */
- + sf_malloc_prehunc
- + uSize /* size requested */
- + 4 /* overrun mark */
- + sf_malloc_endhunc
- );
-
- /* Check if there isn't anymore memory avaiable */
- if (pTmp == NULL)
- {
- if (MyFlags & MY_FAE)
- error_handler_hook=fatal_error_handler_hook;
- if (MyFlags & (MY_FAE+MY_WME))
- {
- char buff[SC_MAXWIDTH];
- my_errno=errno;
- sprintf(buff,"Out of memory at line %d, '%s'", uLine, sFile);
- my_message(EE_OUTOFMEMORY,buff,MYF(ME_BELL+ME_WAITTANG));
- sprintf(buff,"needed %d byte (%ldk), memory in use: %ld bytes (%ldk)",
- uSize, (uSize + 1023L) / 1024L,
- lMaxMemory, (lMaxMemory + 1023L) / 1024L);
- my_message(EE_OUTOFMEMORY,buff,MYF(ME_BELL+ME_WAITTANG));
- }
- DBUG_PRINT("error",("Out of memory, in use: %ld at line %d, '%s'",
- lMaxMemory,uLine, sFile));
- if (MyFlags & MY_FAE)
- exit(1);
- DBUG_RETURN ((gptr) NULL);
- }
-
- /* Fill up the structure */
- *((long*) ((char*) &pTmp -> lSpecialValue+sf_malloc_prehunc)) = MAGICKEY;
- pTmp -> aData[uSize + sf_malloc_prehunc+0] = MAGICEND0;
- pTmp -> aData[uSize + sf_malloc_prehunc+1] = MAGICEND1;
- pTmp -> aData[uSize + sf_malloc_prehunc+2] = MAGICEND2;
- pTmp -> aData[uSize + sf_malloc_prehunc+3] = MAGICEND3;
- pTmp -> sFileName = (my_string) sFile;
- pTmp -> uLineNum = uLine;
- pTmp -> uDataSize = uSize;
- pTmp -> pPrev = NULL;
-
- /* Add this remember structure to the linked list */
- pthread_mutex_lock(&THR_LOCK_malloc);
- if ((pTmp->pNext=pRememberRoot))
- {
- pRememberRoot -> pPrev = pTmp;
- }
- pRememberRoot = pTmp;
-
- /* Keep the statistics */
- lCurMemory += uSize;
- if (lCurMemory > lMaxMemory) {
- lMaxMemory = lCurMemory;
- }
- cNewCount++;
- pthread_mutex_unlock(&THR_LOCK_malloc);
-
- /* Set the memory to the aribtrary wierd value */
-#ifdef HAVE_purify
- if (MyFlags & MY_ZEROFILL)
-#endif
- bfill(&pTmp -> aData[sf_malloc_prehunc],uSize,
- (char) (MyFlags & MY_ZEROFILL ? 0 : ALLOC_VAL));
- /* Return a pointer to the real data */
- DBUG_PRINT("exit",("ptr: %lx",&(pTmp -> aData[sf_malloc_prehunc])));
- if (sf_min_adress > &(pTmp -> aData[sf_malloc_prehunc]))
- sf_min_adress = &(pTmp -> aData[sf_malloc_prehunc]);
- if (sf_max_adress < &(pTmp -> aData[sf_malloc_prehunc]))
- sf_max_adress = &(pTmp -> aData[sf_malloc_prehunc]);
- DBUG_RETURN ((gptr) &(pTmp -> aData[sf_malloc_prehunc]));
-}
-
-/*
- * Allocate some new memory and move old memoryblock there.
- * Free then old memoryblock
- */
-
-gptr _myrealloc (register gptr pPtr, register uint uSize,
- const char *sFile, uint uLine, myf MyFlags)
-{
- struct remember *pRec;
- gptr ptr;
- DBUG_ENTER("_myrealloc");
-
- if (!pPtr && (MyFlags & MY_ALLOW_ZERO_PTR))
- DBUG_RETURN(_mymalloc(uSize,sFile,uLine,MyFlags));
-
- if (!sf_malloc_quick)
- (void) _sanity (sFile, uLine);
-
- if (check_ptr("Reallocating",(byte*) pPtr,sFile,uLine))
- DBUG_RETURN((gptr) NULL);
-
- pRec = (struct remember *) ((char*) pPtr - sizeof (struct irem)-
- sf_malloc_prehunc);
- if (*((long*) ((char*) &pRec -> lSpecialValue+sf_malloc_prehunc))
- != MAGICKEY)
- {
- fprintf (stderr, "Reallocating unallocated data at line %d, '%s'\n",
- uLine, sFile);
- DBUG_PRINT("safe",("Reallocating unallocated data at line %d, '%s'",
- uLine, sFile));
- (void) fflush(stderr);
- DBUG_RETURN((gptr) NULL);
- }
-
- if ((ptr=_mymalloc(uSize,sFile,uLine,MyFlags))) /* Allocate new area */
- {
- uSize=min(uSize,pRec-> uDataSize); /* Move as much as possibly */
- memcpy((byte*) ptr,pPtr,(size_t) uSize); /* Copy old data */
- _myfree(pPtr,sFile,uLine,0); /* Free not needed area */
- }
- else
- {
- if (MyFlags & MY_HOLD_ON_ERROR)
- DBUG_RETURN(pPtr);
- if (MyFlags & MY_FREE_ON_ERROR)
- _myfree(pPtr,sFile,uLine,0);
- }
- DBUG_RETURN(ptr);
-} /* _myrealloc */
-
-
-/*
- * void _myfree( my_string pPtr, my_string sFile, uint uLine, myf myflags)
- * Deallocate some memory.
- */
-
-void _myfree (gptr pPtr, const char *sFile, uint uLine, myf myflags)
-{
- struct remember *pRec;
- DBUG_ENTER("_myfree");
- DBUG_PRINT("enter",("ptr: %lx",pPtr));
-
- if (!sf_malloc_quick)
- (void) _sanity (sFile, uLine);
-
- if ((!pPtr && (myflags & MY_ALLOW_ZERO_PTR)) ||
- check_ptr("Freeing",(byte*) pPtr,sFile,uLine))
- DBUG_VOID_RETURN;
-
- /* Calculate the address of the remember structure */
- pRec = (struct remember *) ((byte*) pPtr-sizeof(struct irem)-
- sf_malloc_prehunc);
-
- /* Check to make sure that we have a real remember structure */
- /* Note: this test could fail for four reasons: */
- /* (1) The memory was already free'ed */
- /* (2) The memory was never new'ed */
- /* (3) There was an underrun */
- /* (4) A stray pointer hit this location */
-
- if (*((long*) ((char*) &pRec -> lSpecialValue+sf_malloc_prehunc))
- != MAGICKEY)
- {
- fprintf (stderr, "Freeing unallocated data at line %d, '%s'\n",
- uLine, sFile);
- DBUG_PRINT("safe",("Unallocated data at line %d, '%s'",uLine,sFile));
- (void) fflush(stderr);
- DBUG_VOID_RETURN;
- }
-
- /* Remove this structure from the linked list */
- pthread_mutex_lock(&THR_LOCK_malloc);
- if (pRec -> pPrev) {
- pRec -> pPrev -> pNext = pRec -> pNext;
- } else {
- pRememberRoot = pRec -> pNext;
- }
- if (pRec -> pNext) {
- pRec -> pNext -> pPrev = pRec -> pPrev;
- }
- /* Handle the statistics */
- lCurMemory -= pRec -> uDataSize;
- cNewCount--;
- pthread_mutex_unlock(&THR_LOCK_malloc);
-
-#ifndef HAVE_purify
- /* Mark this data as free'ed */
- bfill(&pRec->aData[sf_malloc_prehunc],pRec->uDataSize,(pchar) FREE_VAL);
-#endif
- *((long*) ((char*) &pRec -> lSpecialValue+sf_malloc_prehunc)) = ~MAGICKEY;
-
- /* Actually free the memory */
- free ((my_string ) pRec);
- DBUG_VOID_RETURN;
-}
-
- /* Check if we have a wrong pointer */
-
-static int check_ptr(const char *where, byte *ptr, const char *sFile,
- uint uLine)
-{
- if (!ptr)
- {
- fprintf (stderr, "%s NULL pointer at line %d, '%s'\n",
- where,uLine, sFile);
- DBUG_PRINT("safe",("Null pointer at line %d '%s'", uLine, sFile));
- (void) fflush(stderr);
- return 1;
- }
-#ifndef _MSC_VER
- if ((long) ptr & (MY_ALIGN(1,sizeof(char *))-1))
- {
- fprintf (stderr, "%s wrong aligned pointer at line %d, '%s'\n",
- where,uLine, sFile);
- DBUG_PRINT("safe",("Wrong aligned pointer at line %d, '%s'",
- uLine,sFile));
- (void) fflush(stderr);
- return 1;
- }
-#endif
- if (ptr < sf_min_adress || ptr > sf_max_adress)
- {
- fprintf (stderr, "%s pointer out of range at line %d, '%s'\n",
- where,uLine, sFile);
- DBUG_PRINT("safe",("Pointer out of range at line %d '%s'",
- uLine,sFile));
- (void) fflush(stderr);
- return 1;
- }
- return 0;
-}
-
-
-/*
- * TERMINATE(FILE *file)
- * Report on all the memory pieces that have not been
- * free'ed as well as the statistics.
- */
-
-void TERMINATE (FILE *file)
-{
- struct remember *pPtr;
- DBUG_ENTER("TERMINATE");
- pthread_mutex_lock(&THR_LOCK_malloc);
-
- /* Report the difference between number of calls to */
- /* NEW and the number of calls to FREE. >0 means more */
- /* NEWs than FREEs. <0, etc. */
-
- if (cNewCount)
- {
- if (file)
- {
- fprintf (file, "cNewCount: %d\n", cNewCount);
- (void) fflush(file);
- }
- DBUG_PRINT("safe",("cNewCount: %d",cNewCount));
- }
-
- /* Report on all the memory that was allocated with NEW */
- /* but not free'ed with FREE. */
-
- if ((pPtr=pRememberRoot))
- {
- if (file)
- {
- fprintf(file, "Memory that was not free'ed (%ld bytes):\n",lCurMemory);
- (void) fflush(file);
- }
- DBUG_PRINT("safe",("Memory that was not free'ed (%ld bytes):",lCurMemory));
- while (pPtr)
- {
- if (file)
- {
- fprintf (file,
- "\t%6u bytes at 0x%09lx, allocated at line %4u in '%s'\n",
- pPtr -> uDataSize,
- (ulong) &(pPtr -> aData[sf_malloc_prehunc]),
- pPtr -> uLineNum, pPtr -> sFileName);
- (void) fflush(file);
- }
- DBUG_PRINT("safe",
- ("%6u bytes at 0x%09lx, allocated at line %4d in '%s'",
- pPtr -> uDataSize, &(pPtr -> aData[sf_malloc_prehunc]),
- pPtr -> uLineNum, pPtr -> sFileName));
- pPtr = pPtr -> pNext;
- }
- }
- /* Report the memory usage statistics */
- if (file)
- {
- fprintf (file, "Maximum memory usage: %ld bytes (%ldk)\n",
- lMaxMemory, (lMaxMemory + 1023L) / 1024L);
- (void) fflush(file);
- }
- DBUG_PRINT("safe",("Maximum memory usage: %ld bytes (%ldk)",
- lMaxMemory, (lMaxMemory + 1023L) / 1024L));
- pthread_mutex_unlock(&THR_LOCK_malloc);
- DBUG_VOID_RETURN;
-}
-
-
- /* Returns 0 if chunk is ok */
-
-static int _checkchunk (register struct remember *pRec, const char *sFile,
- uint uLine)
-{
- reg1 uint uSize;
- reg2 my_string magicp;
- reg3 int flag=0;
-
- /* Check for a possible underrun */
- if (*((long*) ((char*) &pRec -> lSpecialValue+sf_malloc_prehunc))
- != MAGICKEY)
- {
- fprintf (stderr, "Memory allocated at %s:%d was underrun,",
- pRec -> sFileName, pRec -> uLineNum);
- fprintf (stderr, " discovered at %s:%d\n", sFile, uLine);
- (void) fflush(stderr);
- DBUG_PRINT("safe",("Underrun at %lx, allocated at %s:%d",
- &(pRec -> aData[sf_malloc_prehunc]),
- pRec -> sFileName,
- pRec -> uLineNum));
- flag=1;
- }
-
- /* Check for a possible overrun */
- uSize = pRec -> uDataSize;
- magicp = &(pRec -> aData[uSize+sf_malloc_prehunc]);
- if (*magicp++ != MAGICEND0 ||
- *magicp++ != MAGICEND1 ||
- *magicp++ != MAGICEND2 ||
- *magicp++ != MAGICEND3)
- {
- fprintf (stderr, "Memory allocated at %s:%d was overrun,",
- pRec -> sFileName, pRec -> uLineNum);
- fprintf (stderr, " discovered at '%s:%d'\n", sFile, uLine);
- (void) fflush(stderr);
- DBUG_PRINT("safe",("Overrun at %lx, allocated at %s:%d",
- &(pRec -> aData[sf_malloc_prehunc]),
- pRec -> sFileName,
- pRec -> uLineNum));
- flag=1;
- }
- return(flag);
-}
-
-
- /* Returns how many wrong chunks */
-
-int _sanity (const char *sFile, uint uLine)
-{
- reg1 struct remember *pTmp;
- reg2 int flag=0;
- uint count=0;
-
- pthread_mutex_lock(&THR_LOCK_malloc);
- count=cNewCount;
- for (pTmp = pRememberRoot; pTmp != NULL && count-- ; pTmp = pTmp -> pNext)
- flag+=_checkchunk (pTmp, sFile, uLine);
- pthread_mutex_unlock(&THR_LOCK_malloc);
- if (count || pTmp)
- {
- const char *format="Safemalloc link list destroyed, discovered at '%s:%d'";
- fprintf (stderr, format, sFile, uLine); fputc('\n',stderr);
- (void) fflush(stderr);
- DBUG_PRINT("safe",(format, sFile, uLine));
- flag=1;
- }
- return flag;
-} /* _sanity */
-
-
- /* malloc and copy */
-
-gptr _my_memdup(const byte *from, uint length, const char *sFile, uint uLine,
- myf MyFlags)
-{
- gptr ptr;
- if ((ptr=_mymalloc(length,sFile,uLine,MyFlags)) != 0)
- memcpy((byte*) ptr, (byte*) from,(size_t) length);
- return(ptr);
-} /*_my_memdup */
-
-
-my_string _my_strdup(const char *from, const char *sFile, uint uLine,
- myf MyFlags)
-{
- gptr ptr;
- uint length=(uint) strlen(from)+1;
- if ((ptr=_mymalloc(length,sFile,uLine,MyFlags)) != 0)
- memcpy((byte*) ptr, (byte*) from,(size_t) length);
- return((my_string) ptr);
-} /* _my_strdup */
diff --git a/ext/mysql/libmysql/stamp-h.in b/ext/mysql/libmysql/stamp-h.in
deleted file mode 100644
index 9788f70238..0000000000
--- a/ext/mysql/libmysql/stamp-h.in
+++ /dev/null
@@ -1 +0,0 @@
-timestamp
diff --git a/ext/mysql/libmysql/str2int.c b/ext/mysql/libmysql/str2int.c
deleted file mode 100644
index a9cb9911fc..0000000000
--- a/ext/mysql/libmysql/str2int.c
+++ /dev/null
@@ -1,188 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-/*
- str2int(src, radix, lower, upper, &val)
- converts the string pointed to by src to an integer and stores it in
- val. It skips leading spaces and tabs (but not newlines, formfeeds,
- backspaces), then it accepts an optional sign and a sequence of digits
- in the specified radix. The result should satisfy lower <= *val <= upper.
- The result is a pointer to the first character after the number;
- trailing spaces will NOT be skipped.
-
- If an error is detected, the result will be NullS, the value put
- in val will be 0, and errno will be set to
- EDOM if there are no digits
- ERANGE if the result would overflow or otherwise fail to lie
- within the specified bounds.
- Check that the bounds are right for your machine.
- This looks amazingly complicated for what you probably thought was an
- easy task. Coping with integer overflow and the asymmetric range of
- twos complement machines is anything but easy.
-
- So that users of atoi and atol can check whether an error occured,
- I have taken a wholly unprecedented step: errno is CLEARED if this
- call has no problems.
-*/
-
-#include <global.h>
-#include "m_string.h"
-#include "m_ctype.h"
-#include "my_sys.h" /* defines errno */
-#include <errno.h>
-
-#define char_val(X) (X >= '0' && X <= '9' ? X-'0' :\
- X >= 'A' && X <= 'Z' ? X-'A'+10 :\
- X >= 'a' && X <= 'z' ? X-'a'+10 :\
- '\177')
-
-char *str2int(register const char *src, register int radix, long int lower, long int upper, long int *val)
-{
- int sign; /* is number negative (+1) or positive (-1) */
- int n; /* number of digits yet to be converted */
- long limit; /* "largest" possible valid input */
- long scale; /* the amount to multiply next digit by */
- long sofar; /* the running value */
- register int d; /* (negative of) next digit */
- char *start;
- int digits[32]; /* Room for numbers */
-
- /* Make sure *val is sensible in case of error */
-
- *val = 0;
-
- /* Check that the radix is in the range 2..36 */
-
-#ifndef DBUG_OFF
- if (radix < 2 || radix > 36) {
- errno=EDOM;
- return NullS;
- }
-#endif
-
- /* The basic problem is: how do we handle the conversion of
- a number without resorting to machine-specific code to
- check for overflow? Obviously, we have to ensure that
- no calculation can overflow. We are guaranteed that the
- "lower" and "upper" arguments are valid machine integers.
- On sign-and-magnitude, twos-complement, and ones-complement
- machines all, if +|n| is representable, so is -|n|, but on
- twos complement machines the converse is not true. So the
- "maximum" representable number has a negative representative.
- Limit is set to min(-|lower|,-|upper|); this is the "largest"
- number we are concerned with. */
-
- /* Calculate Limit using Scale as a scratch variable */
-
- if ((limit = lower) > 0) limit = -limit;
- if ((scale = upper) > 0) scale = -scale;
- if (scale < limit) limit = scale;
-
- /* Skip leading spaces and check for a sign.
- Note: because on a 2s complement machine MinLong is a valid
- integer but |MinLong| is not, we have to keep the current
- converted value (and the scale!) as *negative* numbers,
- so the sign is the opposite of what you might expect.
- */
- while (isspace(*src)) src++;
- sign = -1;
- if (*src == '+') src++; else
- if (*src == '-') src++, sign = 1;
-
- /* Skip leading zeros so that we never compute a power of radix
- in scale that we won't have a need for. Otherwise sticking
- enough 0s in front of a number could cause the multiplication
- to overflow when it neededn't.
- */
- start=(char*) src;
- while (*src == '0') src++;
-
- /* Move over the remaining digits. We have to convert from left
- to left in order to avoid overflow. Answer is after last digit.
- */
-
- for (n = 0; (digits[n]=char_val(*src)) < radix && n < 20; n++,src++) ;
-
- /* Check that there is at least one digit */
-
- if (start == src) {
- errno=EDOM;
- return NullS;
- }
-
- /* The invariant we want to maintain is that src is just
- to the right of n digits, we've converted k digits to
- sofar, scale = -radix**k, and scale < sofar < 0. Now
- if the final number is to be within the original
- Limit, we must have (to the left)*scale+sofar >= Limit,
- or (to the left)*scale >= Limit-sofar, i.e. the digits
- to the left of src must form an integer <= (Limit-sofar)/(scale).
- In particular, this is true of the next digit. In our
- incremental calculation of Limit,
-
- IT IS VITAL that (-|N|)/(-|D|) = |N|/|D|
- */
-
- for (sofar = 0, scale = -1; --n >= 1;)
- {
- if ((long) -(d=digits[n]) < limit) {
- errno=ERANGE;
- return NullS;
- }
- limit = (limit+d)/radix, sofar += d*scale; scale *= radix;
- }
- if (n == 0)
- {
- if ((long) -(d=digits[n]) < limit) /* get last digit */
- {
- errno=ERANGE;
- return NullS;
- }
- sofar+=d*scale;
- }
-
- /* Now it might still happen that sofar = -32768 or its equivalent,
- so we can't just multiply by the sign and check that the result
- is in the range lower..upper. All of this caution is a right
- pain in the neck. If only there were a standard routine which
- says generate thus and such a signal on integer overflow...
- But not enough machines can do it *SIGH*.
- */
- if (sign < 0)
- {
- if (sofar < -LONG_MAX || (sofar= -sofar) > upper)
- {
- errno=ERANGE;
- return NullS;
- }
- }
- else if (sofar < lower)
- {
- errno=ERANGE;
- return NullS;
- }
- *val = sofar;
- errno=0; /* indicate that all went well */
- return (char*) src;
-}
-
- /* Theese are so slow compared with ordinary, optimized atoi */
-
-#ifdef WANT_OUR_ATOI
-
-int atoi(const char *src)
-{
- long val;
- str2int(src, 10, (long) INT_MIN, (long) INT_MAX, &val);
- return (int) val;
-}
-
-
-long atol(const char *src)
-{
- long val;
- str2int(src, 10, LONG_MIN, LONG_MAX, &val);
- return val;
-}
-
-#endif /* WANT_OUR_ATOI */
diff --git a/ext/mysql/libmysql/strcend.c b/ext/mysql/libmysql/strcend.c
deleted file mode 100644
index ef4fb95d5c..0000000000
--- a/ext/mysql/libmysql/strcend.c
+++ /dev/null
@@ -1,42 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-/* File : strcend.c
- Author : Michael Widenius: ifdef MC68000
- Updated: 20 April 1984
- Defines: strcend()
-
- strcend(s, c) returns a pointer to the first place in s where c
- occurs, or a pointer to the end-null of s if c does not occur in s.
-*/
-
-#include <global.h>
-#include "m_string.h"
-
-#if defined(MC68000) && defined(DS90)
-
-char *strcend(const char *s, pchar c)
-{
-asm(" movl 4(a7),a0 ");
-asm(" movl 8(a7),d1 ");
-asm(".L2: movb (a0)+,d0 ");
-asm(" cmpb d0,d1 ");
-asm(" beq .L1 ");
-asm(" tstb d0 ");
-asm(" bne .L2 ");
-asm(".L1: movl a0,d0 ");
-asm(" subql #1,d0 ");
-}
-
-#else
-
-char *strcend(register const char *s, register pchar c)
-{
- for (;;)
- {
- if (*s == (char) c) return (char*) s;
- if (!*s++) return (char*) s-1;
- }
-}
-
-#endif
diff --git a/ext/mysql/libmysql/strcont.c b/ext/mysql/libmysql/strcont.c
deleted file mode 100644
index cc75ec450e..0000000000
--- a/ext/mysql/libmysql/strcont.c
+++ /dev/null
@@ -1,32 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-/* File : strcont.c
- Author : Monty
- Updated: 1988.07.27
- Defines: strcont()
-
- strcont(str, set) if str contanies any character in the string set.
- The result is the position of the first found character in str, or NullS
- if there isn't anything found.
-
-*/
-
-#include <global.h>
-#include "m_string.h"
-
-my_string strcont(reg1 const char *str,reg2 const char *set)
-{
- reg3 my_string start = (my_string) set;
-
- while (*str)
- {
- while (*set)
- {
- if (*set++ == *str)
- return ((char*) str);
- }
- set=start; str++;
- }
- return (NullS);
-} /* strcont */
diff --git a/ext/mysql/libmysql/strend.c b/ext/mysql/libmysql/strend.c
deleted file mode 100644
index 18b9d1fbd0..0000000000
--- a/ext/mysql/libmysql/strend.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/* File : strend.c
- Author : Richard A. O'Keefe.
- Updated: 23 April 1984
- Defines: strend()
-
- strend(s) returns a character pointer to the NUL which ends s. That
- is, strend(s)-s == strlen(s). This is useful for adding things at
- the end of strings. It is redundant, because strchr(s,'\0') could
- be used instead, but this is clearer and faster.
- Beware: the asm version works only if strlen(s) < 65535.
-*/
-
-#include <global.h>
-#include "m_string.h"
-
-#if VaxAsm
-
-char *strend(s)
-const char *s;
-{
- asm("locc $0,$65535,*4(ap)");
- asm("movl r1,r0");
-}
-
-#else /* ~VaxAsm */
-
-char *strend(register const char *s)
-{
- while (*s++);
- return (char*) (s-1);
-}
-
-#endif /* VaxAsm */
diff --git a/ext/mysql/libmysql/strfill.c b/ext/mysql/libmysql/strfill.c
deleted file mode 100644
index 2a8496b8b1..0000000000
--- a/ext/mysql/libmysql/strfill.c
+++ /dev/null
@@ -1,22 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-/* File : strfill.c
- Author : Monty
- Updated: 1987.04.16
- Defines: strfill()
-
- strfill(dest, len, fill) makes a string of fill-characters. The result
- string is of length == len. The des+len character is allways set to NULL.
- strfill() returns pointer to dest+len;
-*/
-
-#include <global.h>
-#include "m_string.h"
-
-my_string strfill(my_string s,uint len,pchar fill)
-{
- while (len--) *s++ = fill;
- *(s) = '\0';
- return(s);
-} /* strfill */
diff --git a/ext/mysql/libmysql/string.c b/ext/mysql/libmysql/string.c
deleted file mode 100644
index cbf9f2ddc3..0000000000
--- a/ext/mysql/libmysql/string.c
+++ /dev/null
@@ -1,113 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-/*
- Code for handling strings with can grow dynamicly.
- Copyright Monty Program KB.
- By monty.
-*/
-
-#include "mysys_priv.h"
-#include <m_string.h>
-
-my_bool init_dynamic_string(DYNAMIC_STRING *str, const char *init_str,
- uint init_alloc, uint alloc_increment)
-{
- uint length;
- DBUG_ENTER("init_dynamic_string");
-
- if (!alloc_increment)
- alloc_increment=128;
- length=1;
- if (init_str && (length= (uint) strlen(init_str)+1) < init_alloc)
- init_alloc=((length+alloc_increment-1)/alloc_increment)*alloc_increment;
- if (!init_alloc)
- init_alloc=alloc_increment;
-
- if (!(str->str=(char*) my_malloc(init_alloc,MYF(MY_WME))))
- DBUG_RETURN(TRUE);
- str->length=length-1;
- if (init_str)
- memcpy(str->str,init_str,length);
- str->max_length=init_alloc;
- str->alloc_increment=alloc_increment;
- DBUG_RETURN(FALSE);
-}
-
-
-my_bool dynstr_set(DYNAMIC_STRING *str, const char *init_str)
-{
- uint length;
- DBUG_ENTER("dynstr_set");
-
- if (init_str && (length= (uint) strlen(init_str)+1) > str->max_length)
- {
- str->max_length=((length+str->alloc_increment-1)/str->alloc_increment)*
- str->alloc_increment;
- if (!str->max_length)
- str->max_length=str->alloc_increment;
- if (!(str->str=(char*) my_realloc(str->str,str->max_length,MYF(MY_WME))))
- DBUG_RETURN(TRUE);
- }
- if (init_str)
- {
- str->length=length-1;
- memcpy(str->str,init_str,length);
- }
- else
- str->length=0;
- DBUG_RETURN(FALSE);
-}
-
-
-my_bool dynstr_realloc(DYNAMIC_STRING *str, ulong additional_size)
-{
- DBUG_ENTER("dynstr_realloc");
-
- if (!additional_size) DBUG_RETURN(FALSE);
- if (str->length + additional_size > str->max_length)
- {
- str->max_length=((str->length + additional_size+str->alloc_increment-1)/
- str->alloc_increment)*str->alloc_increment;
- if (!(str->str=(char*) my_realloc(str->str,str->max_length,MYF(MY_WME))))
- DBUG_RETURN(TRUE);
- }
- DBUG_RETURN(FALSE);
-}
-
-
-my_bool dynstr_append(DYNAMIC_STRING *str, const char *append)
-{
- return dynstr_append_mem(str,append,strlen(append));
-}
-
-
-my_bool dynstr_append_mem(DYNAMIC_STRING *str, const char *append,
- uint length)
-{
- char *new_ptr;
- if (str->length+length >= str->max_length)
- {
- uint new_length=(str->length+length+str->alloc_increment)/
- str->alloc_increment;
- new_length*=str->alloc_increment;
- if (!(new_ptr=(char*) my_realloc(str->str,new_length,MYF(MY_WME))))
- return TRUE;
- str->str=new_ptr;
- str->max_length=new_length;
- }
- memcpy(str->str + str->length,append,length);
- str->length+=length;
- str->str[str->length]=0; /* Safety for C programs */
- return FALSE;
-}
-
-
-void dynstr_free(DYNAMIC_STRING *str)
-{
- if (str->str)
- {
- my_free(str->str,MYF(MY_WME));
- str->str=0;
- }
-}
diff --git a/ext/mysql/libmysql/strinstr.c b/ext/mysql/libmysql/strinstr.c
deleted file mode 100644
index ed165b9ce9..0000000000
--- a/ext/mysql/libmysql/strinstr.c
+++ /dev/null
@@ -1,36 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-/* File : strinstr.c
- Author : Monty & David
- Updated: 1986.12.08
- Defines: strinstr()
-
- strinstr(src, pat) looks for an instance of pat in src. pat is not a
- regex(3) pattern, it is a literal string which must be matched exactly.
- The result 0 if the pattern was not found else it is the start char of
- the pattern counted from the beginning of the string, where the first
- char is 1.
-*/
-
-#include <global.h>
-#include "m_string.h"
-
-uint strinstr(reg1 const char *str,reg4 const char *search)
-{
- reg2 my_string i,j;
- my_string start = (my_string) str;
-
- skipp:
- while (*str != '\0')
- {
- if (*str++ == *search)
- {
- i=(my_string) str; j= (my_string) search+1;
- while (*j)
- if (*i++ != *j++) goto skipp;
- return ((uint) (str - start));
- }
- }
- return (0);
-}
diff --git a/ext/mysql/libmysql/strmake.c b/ext/mysql/libmysql/strmake.c
deleted file mode 100644
index 789b9c6be9..0000000000
--- a/ext/mysql/libmysql/strmake.c
+++ /dev/null
@@ -1,39 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-/* File : strmake.c
- Author : Michael Widenius
- Updated: 20 Jul 1984
- Defines: strmake()
-
- strmake(dst,src,length) moves length characters, or until end, of src to
- dst and appends a closing NUL to dst.
- strmake() returns pointer to closing null;
-*/
-
-#include <global.h>
-#include "m_string.h"
-
-#ifdef BAD_STRING_COMPILER
-
-char *strmake(char *dst,const char *src,uint length)
-{
- reg1 char *res;
-
- if ((res=memccpy(dst,src,0,length)))
- return res-1;
- dst[length]=0;
- return dst+length;
-}
-
-#define strmake strmake_overlapp /* Use orginal for overlapping str */
-#endif
-
-char *strmake(register char *dst, register const char *src, uint length)
-{
- while (length--)
- if (! (*dst++ = *src++))
- return dst-1;
- *dst=0;
- return dst;
-}
diff --git a/ext/mysql/libmysql/strmov.c b/ext/mysql/libmysql/strmov.c
deleted file mode 100644
index 66e90a8d6c..0000000000
--- a/ext/mysql/libmysql/strmov.c
+++ /dev/null
@@ -1,45 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-/*
- strmov(dst, src) moves all the characters of src (including the
- closing NUL) to dst, and returns a pointer to the new closing NUL in
- dst. The similar UNIX routine strcpy returns the old value of dst,
- which I have never found useful. strmov(strmov(dst,a),b) moves a//b
- into dst, which seems useful.
-*/
-
-#include <global.h>
-#include "m_string.h"
-
-#ifdef BAD_STRING_COMPILER
-#undef strmov
-#define strmov strmov_overlapp
-#endif
-
-#ifndef strmov
-
-#if !defined(MC68000) && !defined(DS90)
-
-char *strmov(register char *dst, register const char *src)
-{
- while ((*dst++ = *src++)) ;
- return dst-1;
-}
-
-#else
-
-char *strmov(dst, src)
- char *dst, *src;
-{
- asm(" movl 4(a7),a1 ");
- asm(" movl 8(a7),a0 ");
- asm(".L4: movb (a0)+,(a1)+ ");
- asm(" jne .L4 ");
- asm(" movl a1,d0 ");
- asm(" subql #1,d0 ");
-}
-
-#endif
-
-#endif /* strmov */
diff --git a/ext/mysql/libmysql/strnmov.c b/ext/mysql/libmysql/strnmov.c
deleted file mode 100644
index fd521fedea..0000000000
--- a/ext/mysql/libmysql/strnmov.c
+++ /dev/null
@@ -1,22 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-/*
- strnmov(dst,src,length) moves length characters, or until end, of src to
- dst and appends a closing NUL to dst if src is shorter than length.
- The result is a pointer to the first NUL in dst, or is dst+n if dst was
- truncated.
-*/
-
-#include <global.h>
-#include "m_string.h"
-
-char *strnmov(register char *dst, register const char *src, uint n)
-{
- while (n-- != 0) {
- if (!(*dst++ = *src++)) {
- return (char*) dst-1;
- }
- }
- return dst;
-}
diff --git a/ext/mysql/libmysql/strto.c b/ext/mysql/libmysql/strto.c
deleted file mode 100644
index 144ad2f883..0000000000
--- a/ext/mysql/libmysql/strto.c
+++ /dev/null
@@ -1,190 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-/*
- strtol,strtoul,strtoll,strtoull
- convert string to long, unsigned long, long long or unsigned long long.
- strtoxx(char *src,char **ptr,int base)
- converts the string pointed to by src to an long of appropriate long and
- returnes it. It skips leading spaces and tabs (but not newlines, formfeeds,
- backspaces), then it accepts an optional sign and a sequence of digits
- in the specified radix.
- If the value of ptr is not (char **)NULL, a pointer to the character
- terminating the scan is returned in the location pointed to by ptr.
- Trailing spaces will NOT be skipped.
-
- If an error is detected, the result will be LONG_MIN, 0 or LONG_MAX,
- (or LONGLONG..) and errno will be set to
- EDOM if there are no digits
- ERANGE if the result would overflow.
- the ptr will be set to src.
- This file is based on the strtol from the the GNU C Library.
- it can be compiled with the UNSIGNED and/or LONGLONG flag set
-*/
-
-#include <global.h>
-#include "m_string.h"
-#include "m_ctype.h"
-#include "my_sys.h" /* defines errno */
-#include <errno.h>
-
-#ifdef LONGLONG
-#define UTYPE_MAX (~(ulonglong) 0)
-#define TYPE_MIN LONGLONG_MIN
-#define TYPE_MAX LONGLONG_MAX
-#define longtype longlong
-#define ulongtype ulonglong
-#ifdef UNSIGNED
-#define function ulongtype strtoull
-#else
-#define function longtype strtoll
-#endif
-#else
-#define UTYPE_MAX (ulong) ~0L
-#define TYPE_MIN LONG_MIN
-#define TYPE_MAX LONG_MAX
-#define longtype long
-#define ulongtype unsigned long
-#ifdef UNSIGNED
-#define function ulongtype strtoul
-#else
-#define function longtype strtol
-#endif
-#endif
-
-
-/* Convert NPTR to an `unsigned long int' or `long int' in base BASE.
- If BASE is 0 the base is determined by the presence of a leading
- zero, indicating octal or a leading "0x" or "0X", indicating hexadecimal.
- If BASE is < 2 or > 36, it is reset to 10.
- If ENDPTR is not NULL, a pointer to the character after the last
- one converted is stored in *ENDPTR. */
-
-
-function (const char *nptr,char **endptr,int base)
-{
- int negative;
- register ulongtype cutoff;
- register unsigned int cutlim;
- register ulongtype i;
- register const char *s;
- register unsigned char c;
- const char *save;
- int overflow;
-
- if (base < 0 || base == 1 || base > 36)
- base = 10;
-
- s = nptr;
-
- /* Skip white space. */
- while (isspace (*s))
- ++s;
- if (*s == '\0')
- {
- goto noconv;
- }
-
- /* Check for a sign. */
- if (*s == '-')
- {
- negative = 1;
- ++s;
- }
- else if (*s == '+')
- {
- negative = 0;
- ++s;
- }
- else
- negative = 0;
-
- if (base == 16 && s[0] == '0' && toupper (s[1]) == 'X')
- s += 2;
-
- /* If BASE is zero, figure it out ourselves. */
- if (base == 0)
- {
- if (*s == '0')
- {
- if (toupper (s[1]) == 'X')
- {
- s += 2;
- base = 16;
- }
- else
- base = 8;
- }
- else
- base = 10;
- }
-
- /* Save the pointer so we can check later if anything happened. */
- save = s;
-
- cutoff = UTYPE_MAX / (unsigned long int) base;
- cutlim = (uint) (UTYPE_MAX % (unsigned long int) base);
-
- overflow = 0;
- i = 0;
- for (c = *s; c != '\0'; c = *++s)
- {
- if (isdigit (c))
- c -= '0';
- else if (isalpha (c))
- c = toupper (c) - 'A' + 10;
- else
- break;
- if (c >= base)
- break;
- /* Check for overflow. */
- if (i > cutoff || (i == cutoff && c > cutlim))
- overflow = 1;
- else
- {
- i *= (ulongtype) base;
- i += c;
- }
- }
-
- /* Check if anything actually happened. */
- if (s == save)
- goto noconv;
-
- /* Store in ENDPTR the address of one character
- past the last character we converted. */
- if (endptr != NULL)
- *endptr = (char *) s;
-
-#ifndef UNSIGNED
- /* Check for a value that is within the range of
- `unsigned long int', but outside the range of `long int'. */
- if (negative)
- {
- if (i > (ulongtype) TYPE_MIN)
- overflow = 1;
- }
- else if (i > (ulongtype) TYPE_MAX)
- overflow = 1;
-#endif
-
- if (overflow)
- {
- my_errno=ERANGE;
-#ifdef UNSIGNED
- return UTYPE_MAX;
-#else
- return negative ? TYPE_MIN : TYPE_MAX;
-#endif
- }
-
- /* Return the result of the appropriate sign. */
- return (negative ? -((longtype) i) : i);
-
-noconv:
- /* There was no number to convert. */
- my_errno=EDOM;
- if (endptr != NULL)
- *endptr = (char *) nptr;
- return 0L;
-}
diff --git a/ext/mysql/libmysql/strtoll.c b/ext/mysql/libmysql/strtoll.c
deleted file mode 100644
index 4dde6e4e87..0000000000
--- a/ext/mysql/libmysql/strtoll.c
+++ /dev/null
@@ -1,11 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-/* This is defines strtoll() if neaded */
-
-#include <global.h>
-#include <m_string.h>
-#if !defined(HAVE_STRTOULL) && defined(HAVE_LONG_LONG)
-#define LONGLONG
-#include "strto.c"
-#endif
diff --git a/ext/mysql/libmysql/strtoull.c b/ext/mysql/libmysql/strtoull.c
deleted file mode 100644
index 807449e0af..0000000000
--- a/ext/mysql/libmysql/strtoull.c
+++ /dev/null
@@ -1,12 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-/* This is defines strtoull() */
-
-#include <global.h>
-#include <m_string.h>
-#if !defined(HAVE_STRTOULL) && defined(HAVE_LONG_LONG)
-#define UNSIGNED
-#define LONGLONG
-#include "strto.c"
-#endif
diff --git a/ext/mysql/libmysql/strxmov.c b/ext/mysql/libmysql/strxmov.c
deleted file mode 100644
index 7ee1d303ee..0000000000
--- a/ext/mysql/libmysql/strxmov.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/* File : strxmov.c
- Author : Richard A. O'Keefe.
- Updated: 25 may 1984
- Defines: strxmov()
-
- strxmov(dst, src1, ..., srcn, NullS)
- moves the concatenation of src1,...,srcn to dst, terminates it
- with a NUL character, and returns a pointer to the terminating NUL.
- It is just like strmov except that it concatenates multiple sources.
- Beware: the last argument should be the null character pointer.
- Take VERY great care not to omit it! Also be careful to use NullS
- and NOT to use 0, as on some machines 0 is not the same size as a
- character pointer, or not the same bit pattern as NullS.
-*/
-
-#include <global.h>
-#include "m_string.h"
-#include <stdarg.h>
-
-char *strxmov(char *dst,const char *src, ...)
-{
- va_list pvar;
-
- va_start(pvar,src);
- while (src != NullS) {
- while ((*dst++ = *src++)) ;
- dst--;
- src = va_arg(pvar, char *);
- }
- va_end(pvar);
- *dst = 0; /* there might have been no sources! */
- return dst;
-}
diff --git a/ext/mysql/libmysql/thr_alarm.h b/ext/mysql/libmysql/thr_alarm.h
deleted file mode 100644
index b1f0b3e43b..0000000000
--- a/ext/mysql/libmysql/thr_alarm.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-/* Prototypes when using thr_alarm library functions */
-
-#ifndef _thr_alarm_h
-#define _thr_alarm_h
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifndef USE_ALARM_THREAD
-#define USE_ONE_SIGNAL_HAND /* One must call process_alarm */
-#endif
-#ifdef HAVE_LINUXTHREADS
-#define THR_CLIENT_ALARM SIGALRM
-#else
-#define THR_CLIENT_ALARM SIGUSR1
-#endif
-#ifdef HAVE_rts_threads
-#undef USE_ONE_SIGNAL_HAND
-#define USE_ALARM_THREAD
-#define THR_SERVER_ALARM SIGUSR1
-#else
-#define THR_SERVER_ALARM SIGALRM
-#endif
-
-#if defined(DONT_USE_THR_ALARM)
-
-#define USE_ALARM_THREAD
-#undef USE_ONE_SIGNAL_HAND
-
-typedef struct st_thr_alarm_entry
-{
- uint crono;
-} thr_alarm_entry;
-
-#define thr_alarm_init(A) (A)->crono=0
-#define thr_alarm_in_use(A) (A)->crono
-#define init_thr_alarm(A)
-#define thr_alarm_kill(A)
-#define end_thr_alarm()
-#define thr_alarm(A,B) (((A)->crono=1)-1)
-#define thr_got_alarm(A) (A)->crono
-#define thr_end_alarm(A)
-
-#else
-#if defined(__WIN__)
-typedef struct st_thr_alarm_entry
-{
- rf_SetTimer crono;
-} thr_alarm_entry;
-
-#elif defined(__EMX__)
-
-typedef struct st_thr_alarm_entry
-{
- uint crono;
- uint event;
-} thr_alarm_entry;
-
-#else /* System with posix threads */
-
-typedef int thr_alarm_entry;
-
-#define thr_got_alarm(thr_alarm) (**(thr_alarm))
-
-#endif /* __WIN__ */
-
-typedef thr_alarm_entry* thr_alarm_t;
-
-typedef struct st_alarm {
- ulong expire_time;
- thr_alarm_entry alarmed; /* set when alarm is due */
- pthread_t thread;
- my_bool malloced;
-} ALARM;
-
-#define thr_alarm_init(A) (*(A))=0
-#define thr_alarm_in_use(A) (*(A)!= 0)
-void init_thr_alarm(uint max_alarm);
-bool thr_alarm(thr_alarm_t *alarmed, uint sec, ALARM *buff);
-void thr_alarm_kill(pthread_t thread_id);
-void thr_end_alarm(thr_alarm_t *alarmed);
-void end_thr_alarm(void);
-sig_handler process_alarm(int);
-#ifndef thr_got_alarm
-bool thr_got_alarm(thr_alarm_t *alrm);
-#endif
-
-
-#endif /* DONT_USE_THR_ALARM */
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-#endif /* _thr_alarm_h */
-
diff --git a/ext/mysql/libmysql/thr_mutex.c b/ext/mysql/libmysql/thr_mutex.c
deleted file mode 100644
index 7ec8bfb59a..0000000000
--- a/ext/mysql/libmysql/thr_mutex.c
+++ /dev/null
@@ -1,217 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-/* This makes a wrapper for mutex handling to make it easier to debug mutex */
-
-#include <global.h>
-#if defined(HAVE_LINUXTHREADS) && !defined (__USE_UNIX98)
-#define __USE_UNIX98 /* To get rw locks under Linux */
-#endif
-#include <m_string.h>
-#if defined(THREAD) && defined(SAFE_MUTEX)
-#undef SAFE_MUTEX /* Avoid safe_mutex redefinitions */
-#include <my_pthread.h>
-
-#ifndef DO_NOT_REMOVE_THREAD_WRAPPERS
-/* Remove wrappers */
-#undef pthread_mutex_init
-#undef pthread_mutex_lock
-#undef pthread_mutex_unlock
-#undef pthread_mutex_destroy
-#undef pthread_cond_wait
-#undef pthread_cond_timedwait
-#ifdef HAVE_NONPOSIX_PTHREAD_MUTEX_INIT
-#define pthread_mutex_init(a,b) my_pthread_mutex_init((a),(b))
-#endif
-#endif /* DO_NOT_REMOVE_THREAD_WRAPPERS */
-
-int safe_mutex_init(safe_mutex_t *mp,
- const pthread_mutexattr_t *attr __attribute__((unused)))
-{
- bzero((char*) mp,sizeof(*mp));
- pthread_mutex_init(&mp->global,MY_MUTEX_INIT_ERRCHK);
- pthread_mutex_init(&mp->mutex,attr);
- return 0;
-}
-
-int safe_mutex_lock(safe_mutex_t *mp,const char *file, uint line)
-{
- int error;
- pthread_mutex_lock(&mp->global);
- if (mp->count > 0 && pthread_equal(pthread_self(),mp->thread))
- {
- fprintf(stderr,"safe_mutex: Trying to lock mutex at %s, line %d, when the mutex was already locked at %s, line %d\n",
- file,line,mp->file,mp->line);
- fflush(stderr);
- abort();
- }
- pthread_mutex_unlock(&mp->global);
- error=pthread_mutex_lock(&mp->mutex);
- if (error || (error=pthread_mutex_lock(&mp->global)))
- {
- fprintf(stderr,"Got error %d when trying to lock mutex at %s, line %d\n",
- error, file, line);
- fflush(stderr);
- abort();
- }
- if (mp->count++)
- {
- fprintf(stderr,"safe_mutex: Error in thread libray: Got mutex at %s, line %d more than 1 time\n", file,line);
- fflush(stderr);
- abort();
- }
- mp->thread=pthread_self();
- mp->file= (char*) file;
- mp->line=line;
- pthread_mutex_unlock(&mp->global);
- return error;
-}
-
-
-int safe_mutex_unlock(safe_mutex_t *mp,const char *file, uint line)
-{
- int error;
- pthread_mutex_lock(&mp->global);
- if (mp->count == 0)
- {
- fprintf(stderr,"safe_mutex: Trying to unlock mutex that wasn't locked at %s, line %d\n Last used at %s, line: %d\n",
- file,line,mp->file ? mp->file : "",mp->line);
- fflush(stderr);
- abort();
- }
- if (!pthread_equal(pthread_self(),mp->thread))
- {
- fprintf(stderr,"safe_mutex: Trying to unlock mutex at %s, line %d that was locked by another thread at: %s, line: %d\n",
- file,line,mp->file,mp->line);
- fflush(stderr);
- abort();
- }
- mp->count--;
-#ifdef __WIN__
- pthread_mutex_unlock(&mp->mutex);
- error=0;
-#else
- error=pthread_mutex_unlock(&mp->mutex);
- if (error)
- {
- fprintf(stderr,"safe_mutex: Got error: %d when trying to unlock mutex at %s, line %d\n", error, file, line);
- fflush(stderr);
- abort();
- }
-#endif /* __WIN__ */
- pthread_mutex_unlock(&mp->global);
- return error;
-}
-
-
-int safe_cond_wait(pthread_cond_t *cond, safe_mutex_t *mp, const char *file,
- uint line)
-{
- int error;
- pthread_mutex_lock(&mp->global);
- if (mp->count == 0)
- {
- fprintf(stderr,"safe_mutex: Trying to cond_wait on a unlocked mutex at %s, line %d\n",file,line);
- fflush(stderr);
- abort();
- }
- if (!pthread_equal(pthread_self(),mp->thread))
- {
- fprintf(stderr,"safe_mutex: Trying to cond_wait on a mutex at %s, line %d that was locked by another thread at: %s, line: %d\n",
- file,line,mp->file,mp->line);
- fflush(stderr);
- abort();
- }
-
- if (mp->count-- != 1)
- {
- fprintf(stderr,"safe_mutex: Count was %d on locked mutex at %s, line %d\n",
- mp->count+1, file, line);
- fflush(stderr);
- abort();
- }
- pthread_mutex_unlock(&mp->global);
- error=pthread_cond_wait(cond,&mp->mutex);
- pthread_mutex_lock(&mp->global);
- if (error)
- {
- fprintf(stderr,"safe_mutex: Got error: %d when doing a safe_mutex_wait at %s, line %d\n", error, file, line);
- fflush(stderr);
- abort();
- }
- if (mp->count++)
- {
- fprintf(stderr,
- "safe_mutex: Count was %d in thread %lx when locking mutex at %s, line %d\n",
- mp->count-1, my_thread_id(), file, line);
- fflush(stderr);
- abort();
- }
- mp->thread=pthread_self();
- mp->file= (char*) file;
- mp->line=line;
- pthread_mutex_unlock(&mp->global);
- return error;
-}
-
-
-int safe_cond_timedwait(pthread_cond_t *cond, safe_mutex_t *mp,
- struct timespec *abstime,
- const char *file, uint line)
-{
- int error;
- pthread_mutex_lock(&mp->global);
- if (mp->count != 1 || !pthread_equal(pthread_self(),mp->thread))
- {
- fprintf(stderr,"safe_mutex: Trying to cond_wait at %s, line %d on a not hold mutex\n",file,line);
- fflush(stderr);
- abort();
- }
- mp->count--; /* Mutex will be released */
- pthread_mutex_unlock(&mp->global);
- error=pthread_cond_timedwait(cond,&mp->mutex,abstime);
-#ifdef EXTRA_DEBUG
- if (error && (error != EINTR && error != ETIMEDOUT))
- {
- fprintf(stderr,"safe_mutex: Got error: %d when doing a safe_mutex_timedwait at %s, line %d\n", error, file, line);
- }
-#endif
- pthread_mutex_lock(&mp->global);
- if (mp->count++)
- {
- fprintf(stderr,
- "safe_mutex: Count was %d in thread %lx when locking mutex at %s, line %d (error: %d)\n",
- mp->count-1, my_thread_id(), file, line, error);
- fflush(stderr);
- abort();
- }
- mp->thread=pthread_self();
- mp->file= (char*) file;
- mp->line=line;
- pthread_mutex_unlock(&mp->global);
- return error;
-}
-
-int safe_mutex_destroy(safe_mutex_t *mp, const char *file, uint line)
-{
- int error=0;
- if (mp->count != 0)
- {
- fprintf(stderr,"safe_mutex: Trying to destroy a mutex that was locked at %s, line %d at %s, line %d\n",
- mp->file,mp->line, file, line);
- fflush(stderr);
- abort();
- }
-#ifdef __WIN__
- pthread_mutex_destroy(&mp->global);
- pthread_mutex_destroy(&mp->mutex);
-#else
- if (pthread_mutex_destroy(&mp->global))
- error=1;
- if (pthread_mutex_destroy(&mp->mutex))
- error=1;
-#endif
- return error;
-}
-
-#endif /* THREAD && SAFE_MUTEX */
diff --git a/ext/mysql/libmysql/typelib.c b/ext/mysql/libmysql/typelib.c
deleted file mode 100644
index 0fd4415b2c..0000000000
--- a/ext/mysql/libmysql/typelib.c
+++ /dev/null
@@ -1,92 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-/* Functions to handle typelib */
-
-#include "mysys_priv.h"
-#include <m_string.h>
-#include <m_ctype.h>
-
-/***************************************************************************
-** Search after a fieldtype. Endspace in x is not compared.
-** If part, uniq field is found and full_name == 0 then x is expanded
-** to full field.
-** full_name has the following bit values:
-** If & 1 accept only whole names
-** If & 2 don't expand if half field
-** If & 4 allow #number# as type
-****************************************************************************/
-
-int find_type(my_string x, TYPELIB *typelib, uint full_name)
-{
- int find,pos,findpos;
- reg1 my_string i;
- reg2 const char *j;
- DBUG_ENTER("find_type");
- DBUG_PRINT("enter",("x: '%s' lib: %lx",x,typelib));
-
- if (!typelib->count)
- {
- DBUG_PRINT("exit",("no count"));
- DBUG_RETURN(0);
- }
- LINT_INIT(findpos);
- find=0;
- for (pos=0 ; (j=typelib->type_names[pos]) ; pos++)
- {
- for (i=x ; *i && toupper(*i) == toupper(*j) ; i++, j++) ;
- if (! *j)
- {
- while (*i == ' ')
- i++; /* skipp_end_space */
- if (! *i)
- DBUG_RETURN(pos+1);
- }
- if (! *i && (!*j || !(full_name & 1)))
- {
- find++;
- findpos=pos;
- }
- }
- if (find == 0 && (full_name & 4) && x[0] == '#' && strend(x)[-1] == '#' &&
- (findpos=atoi(x+1)-1) >= 0 && (uint) findpos < typelib->count)
- find=1;
- else if (find == 0 || ! x[0])
- {
- DBUG_PRINT("exit",("Couldn't find type"));
- DBUG_RETURN(0);
- }
- else if (find != 1 || (full_name & 1))
- {
- DBUG_PRINT("exit",("Too many possybilities"));
- DBUG_RETURN(-1);
- }
- if (!(full_name & 2))
- (void) strmov(x,typelib->type_names[findpos]);
- DBUG_RETURN(findpos+1);
-} /* find_type */
-
-
- /* Get name of type nr 'nr' */
- /* Warning first type is 1, 0 = empty field */
-
-void make_type(register my_string to, register uint nr, register TYPELIB *typelib)
-{
- DBUG_ENTER("make_type");
- if (!nr)
- to[0]=0;
- else
- (void) strmov(to,get_type(typelib,nr-1));
- DBUG_VOID_RETURN;
-} /* make_type */
-
-
- /* Get type */
- /* Warning first type is 0 */
-
-const char *get_type(TYPELIB *typelib, uint nr)
-{
- if (nr < (uint) typelib->count && typelib->type_names)
- return(typelib->type_names[nr]);
- return "?";
-}
diff --git a/ext/mysql/libmysql/update_sources b/ext/mysql/libmysql/update_sources
deleted file mode 100755
index 87547e483e..0000000000
--- a/ext/mysql/libmysql/update_sources
+++ /dev/null
@@ -1,103 +0,0 @@
-#! /usr/bin/perl -w
-
-# Maybe I should have used PHP instead? ;)
-
-use strict;
-$| = 1;
-
--f "libmysql.c" or die "$0 must be run from the libmysql directory\n";
-
-my $command = shift || usage();
-$command =~ /^--(?:update|huh|restore)$/ or usage();
-
-my $from = shift || '/my/mysql';
-my @source_dirs = qw/dbug strings mysys libmysql include/;
-my $source_re = qr/\.(?:cc?|h)$/;
-my %skip = (
- 'ctype_autoconf.c' => 1, # PHP uses a pre-made one
- 'ctype_extra_sources.c' => 1, # same here
- 'my_config.h' => 1, # we use php_config.h
-);
-
-opendir D, "."
- or die "can't opendir .: $!\n";
-my @files = grep { /$source_re/ and !$skip{$_} } readdir D;
-closedir D;
-
-if ($command eq '--restore')
-{
- foreach (@files)
- {
- -f "$_.orig" and
- system("mv -f $_.orig $_") and die "can't restore $_: $!\n";
- }
- exit 0;
-}
-
-if ($command eq '--huh')
-{
- diff_files();
- exit 0;
-}
-
-my %sources;
-foreach my $d (@source_dirs)
-{
- opendir D, "$from/$d" or die "opendir $from/$d: $!\n";
- foreach (grep { /$source_re/ } readdir D)
- {
- $sources{$_} ||= "$d/$_";
- }
- closedir D;
-}
-
-foreach my $f (@files)
-{
- my $s = $sources{$f} or die "can't find source file for $f\n";
- unlink "$f.orig";
- system("mv $f $f.orig") and die "can't move $f: $!\n";
- #print ">> ", scalar(`ls -l $from/$s`), "\n";
- print ">> $s\n";
- system("cp $from/$s $f") and die "can't copy $from/$s: $!\n";
- #print "]] ", scalar(`ls -l $f`), "\n";
-}
-
-system("chmod u+w @files") and die "can't set perms on files: $!\n";
-system("./fix_copyright @files") and die "can't fix copyright: $!\n";
-diff_files();
-
-exit 0;
-
-
-sub usage
-{
- die <<"EOF";
-usage: $0 --update [mysql-source-dir]
- $0 --huh
- $0 --restore
-
- Typical use is:
- \$ $0 --update 2>&1 > /tmp/php-update.diff
- \$ @{[$ENV{EDITOR}||'vi']} /tmp/php-update.diff #does it look okay?
- \$ Monkey around a bit
- \$ cvs diff -u | less # does this look okay?
- \$ rm *.orig
-EOF
-}
-
-sub diff_files {
- foreach my $f (@files)
- {
- if (!-f "$f.orig" or !system("diff -u $f.orig $f"))
- {
- print STDERR "SAME: $f\n";
- unlink "$f.orig";
- }
- else
- {
- print STDERR "DIFF: $f\n";
- $f eq 'config-win.h' and
- print STDERR "/n/nDon't forget to undefine HAVE_COMPRESS in $f/n/n/n";
- }
- }
-}
diff --git a/ext/mysql/libmysql/violite.c b/ext/mysql/libmysql/violite.c
deleted file mode 100644
index e73efb7e8d..0000000000
--- a/ext/mysql/libmysql/violite.c
+++ /dev/null
@@ -1,411 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-/*
- Note that we can't have assertion on file descriptors; The reason for
- this is that during mysql shutdown, another thread can close a file
- we are working on. In this case we should just return read errors from
- the file descriptior.
-*/
-
-#include <global.h>
-
-#ifndef HAVE_VIO /* is Vio suppored by the Vio lib ? */
-
-#include <errno.h>
-#include <assert.h>
-#include <violite.h>
-#include <my_sys.h>
-#include <my_net.h>
-#include <m_string.h>
-#ifdef HAVE_POLL
-#include <sys/poll.h>
-#endif
-
-#if defined(__EMX__)
-#include <sys/ioctl.h>
-#define ioctlsocket ioctl
-#endif /* defined(__EMX__) */
-
-#if defined(MSDOS) || defined(__WIN__)
-#ifdef __WIN__
-#undef errno
-#undef EINTR
-#undef EAGAIN
-#define errno WSAGetLastError()
-#define EINTR WSAEINTR
-#define EAGAIN WSAEINPROGRESS
-#endif /* __WIN__ */
-#define O_NONBLOCK 1 /* For emulation of fcntl() */
-#endif
-#ifndef EWOULDBLOCK
-#define EWOULDBLOCK EAGAIN
-#endif
-
-#ifndef __WIN__
-#define HANDLE void *
-#endif
-
-struct st_vio
-{
- my_socket sd; /* my_socket - real or imaginary */
- HANDLE hPipe;
- my_bool localhost; /* Are we from localhost? */
- int fcntl_mode; /* Buffered fcntl(sd,F_GETFL) */
- struct sockaddr_in local; /* Local internet address */
- struct sockaddr_in remote; /* Remote internet address */
- enum enum_vio_type type; /* Type of connection */
- char desc[30]; /* String description */
-};
-
-typedef void *vio_ptr;
-typedef char *vio_cstring;
-
-/*
- * Helper to fill most of the Vio* with defaults.
- */
-
-static void vio_reset(Vio* vio, enum enum_vio_type type,
- my_socket sd, HANDLE hPipe,
- my_bool localhost)
-{
- bzero((char*) vio, sizeof(*vio));
- vio->type = type;
- vio->sd = sd;
- vio->hPipe = hPipe;
- vio->localhost= localhost;
-}
-
-/* Open the socket or TCP/IP connection and read the fnctl() status */
-
-Vio *vio_new(my_socket sd, enum enum_vio_type type, my_bool localhost)
-{
- Vio *vio;
- DBUG_ENTER("vio_new");
- DBUG_PRINT("enter", ("sd=%d", sd));
- if ((vio = (Vio*) my_malloc(sizeof(*vio),MYF(MY_WME))))
- {
- vio_reset(vio, type, sd, 0, localhost);
- sprintf(vio->desc,
- (vio->type == VIO_TYPE_SOCKET ? "socket (%d)" : "TCP/IP (%d)"),
- vio->sd);
-#if !defined(___WIN__) && !defined(__EMX__)
-#if !defined(NO_FCNTL_NONBLOCK)
- vio->fcntl_mode = fcntl(sd, F_GETFL);
-#endif
-#else /* !defined(__WIN__) && !defined(__EMX__) */
- {
- /* set to blocking mode by default */
- ulong arg=0, r;
- r = ioctlsocket(vio->sd,FIONBIO,(void*) &arg, sizeof(arg));
- }
-#endif
- }
- DBUG_RETURN(vio);
-}
-
-
-#ifdef __WIN__
-
-Vio *vio_new_win32pipe(HANDLE hPipe)
-{
- Vio *vio;
- DBUG_ENTER("vio_new_handle");
- if ((vio = (Vio*) my_malloc(sizeof(Vio),MYF(MY_WME))))
- {
- vio_reset(vio, VIO_TYPE_NAMEDPIPE, 0, hPipe, TRUE);
- strmov(vio->desc, "named pipe");
- }
- DBUG_RETURN(vio);
-}
-
-#endif
-
-void vio_delete(Vio * vio)
-{
- /* It must be safe to delete null pointers. */
- /* This matches the semantics of C++'s delete operator. */
- if (vio)
- {
- if (vio->type != VIO_CLOSED)
- vio_close(vio);
- my_free((gptr) vio,MYF(0));
- }
-}
-
-int vio_errno(Vio *vio __attribute__((unused)))
-{
- return errno; /* On Win32 this mapped to WSAGetLastError() */
-}
-
-
-int vio_read(Vio * vio, gptr buf, int size)
-{
- int r;
- DBUG_ENTER("vio_read");
- DBUG_PRINT("enter", ("sd=%d, buf=%p, size=%d", vio->sd, buf, size));
-#ifdef __WIN__
- if (vio->type == VIO_TYPE_NAMEDPIPE)
- {
- DWORD length;
- if (!ReadFile(vio->hPipe, buf, size, &length, NULL))
- DBUG_RETURN(-1);
- DBUG_RETURN(length);
- }
- r = recv(vio->sd, buf, size,0);
-#else
- errno=0; /* For linux */
- r = read(vio->sd, buf, size);
-#endif /* __WIN__ */
-#ifndef DBUG_OFF
- if (r < 0)
- {
- DBUG_PRINT("error", ("Got error %d during read",errno));
- }
-#endif /* DBUG_OFF */
- DBUG_PRINT("exit", ("%d", r));
- DBUG_RETURN(r);
-}
-
-
-int vio_write(Vio * vio, const gptr buf, int size)
-{
- int r;
- DBUG_ENTER("vio_write");
- DBUG_PRINT("enter", ("sd=%d, buf=%p, size=%d", vio->sd, buf, size));
-#ifdef __WIN__
- if ( vio->type == VIO_TYPE_NAMEDPIPE)
- {
- DWORD length;
- if (!WriteFile(vio->hPipe, (char*) buf, size, &length, NULL))
- DBUG_RETURN(-1);
- DBUG_RETURN(length);
- }
- r = send(vio->sd, buf, size,0);
-#else
- r = write(vio->sd, buf, size);
-#endif /* __WIN__ */
-#ifndef DBUG_OFF
- if (r < 0)
- {
- DBUG_PRINT("error", ("Got error on write: %d",errno));
- }
-#endif /* DBUG_OFF */
- DBUG_PRINT("exit", ("%d", r));
- DBUG_RETURN(r);
-}
-
-
-int vio_blocking(Vio * vio, my_bool set_blocking_mode)
-{
- int r=0;
- DBUG_ENTER("vio_blocking");
- DBUG_PRINT("enter", ("set_blocking_mode: %d", (int) set_blocking_mode));
-
-#if !defined(___WIN__) && !defined(__EMX__)
-#if !defined(NO_FCNTL_NONBLOCK)
-
- if (vio->sd >= 0)
- {
- int old_fcntl=vio->fcntl_mode;
- if (set_blocking_mode)
- vio->fcntl_mode &= ~O_NONBLOCK; /* clear bit */
- else
- vio->fcntl_mode |= O_NONBLOCK; /* set bit */
- if (old_fcntl != vio->fcntl_mode)
- r = fcntl(vio->sd, F_SETFL, vio->fcntl_mode);
- }
-#endif /* !defined(NO_FCNTL_NONBLOCK) */
-#else /* !defined(__WIN__) && !defined(__EMX__) */
-#ifndef __EMX__
- if (vio->type != VIO_TYPE_NAMEDPIPE)
-#endif
- {
- ulong arg;
- int old_fcntl=vio->fcntl_mode;
- if (set_blocking_mode)
- {
- arg = 0;
- vio->fcntl_mode &= ~O_NONBLOCK; /* clear bit */
- }
- else
- {
- arg = 1;
- vio->fcntl_mode |= O_NONBLOCK; /* set bit */
- }
- if (old_fcntl != vio->fcntl_mode)
- r = ioctlsocket(vio->sd,FIONBIO,(void*) &arg, sizeof(arg));
- }
-#endif /* !defined(__WIN__) && !defined(__EMX__) */
- DBUG_RETURN(r);
-}
-
-my_bool
-vio_is_blocking(Vio * vio)
-{
- my_bool r;
- DBUG_ENTER("vio_is_blocking");
- r = !(vio->fcntl_mode & O_NONBLOCK);
- DBUG_PRINT("exit", ("%d", (int) r));
- DBUG_RETURN(r);
-}
-
-
-int vio_fastsend(Vio * vio __attribute__((unused)))
-{
- int r=0;
- DBUG_ENTER("vio_fastsend");
-
-#ifdef IPTOS_THROUGHPUT
- {
-#ifndef __EMX__
- int tos = IPTOS_THROUGHPUT;
- if (!setsockopt(vio->sd, IPPROTO_IP, IP_TOS, (void *) &tos, sizeof(tos)))
-#endif /* !__EMX__ */
- {
- int nodelay = 1;
- if (setsockopt(vio->sd, IPPROTO_TCP, TCP_NODELAY, (void *) &nodelay,
- sizeof(nodelay))) {
- DBUG_PRINT("warning",
- ("Couldn't set socket option for fast send"));
- r= -1;
- }
- }
- }
-#endif /* IPTOS_THROUGHPUT */
- DBUG_PRINT("exit", ("%d", r));
- DBUG_RETURN(r);
-}
-
-int vio_keepalive(Vio* vio, my_bool set_keep_alive)
-{
- int r=0;
- uint opt = 0;
- DBUG_ENTER("vio_keepalive");
- DBUG_PRINT("enter", ("sd=%d, set_keep_alive=%d", vio->sd, (int)
- set_keep_alive));
- if (vio->type != VIO_TYPE_NAMEDPIPE)
- {
- if (set_keep_alive)
- opt = 1;
- r = setsockopt(vio->sd, SOL_SOCKET, SO_KEEPALIVE, (char *) &opt,
- sizeof(opt));
- }
- DBUG_RETURN(r);
-}
-
-
-my_bool
-vio_should_retry(Vio * vio __attribute__((unused)))
-{
- int en = errno;
- return en == EAGAIN || en == EINTR || en == EWOULDBLOCK;
-}
-
-
-int vio_close(Vio * vio)
-{
- int r;
- DBUG_ENTER("vio_close");
-#ifdef __WIN__
- if (vio->type == VIO_TYPE_NAMEDPIPE)
- {
-#if defined(__NT__) && defined(MYSQL_SERVER)
- CancelIo(vio->hPipe);
- DisconnectNamedPipe(vio->hPipe);
-#endif
- r=CloseHandle(vio->hPipe);
- }
- else if (vio->type != VIO_CLOSED)
-#endif /* __WIN__ */
- {
- r=0;
- if (shutdown(vio->sd,2))
- r= -1;
- if (closesocket(vio->sd))
- r= -1;
- }
- if (r)
- {
- DBUG_PRINT("error", ("close() failed, error: %d",errno));
- /* FIXME: error handling (not critical for MySQL) */
- }
- vio->type= VIO_CLOSED;
- vio->sd= -1;
- DBUG_RETURN(r);
-}
-
-
-const char *vio_description(Vio * vio)
-{
- return vio->desc;
-}
-
-enum enum_vio_type vio_type(Vio* vio)
-{
- return vio->type;
-}
-
-my_socket vio_fd(Vio* vio)
-{
- return vio->sd;
-}
-
-
-my_bool vio_peer_addr(Vio * vio, char *buf)
-{
- DBUG_ENTER("vio_peer_addr");
- DBUG_PRINT("enter", ("sd=%d", vio->sd));
- if (vio->localhost)
- {
- strmov(buf,"127.0.0.1");
- }
- else
- {
- size_socket addrLen = sizeof(struct sockaddr);
- if (getpeername(vio->sd, (struct sockaddr *) (& (vio->remote)),
- &addrLen) != 0)
- {
- DBUG_PRINT("exit", ("getpeername, error: %d", errno));
- DBUG_RETURN(1);
- }
- my_inet_ntoa(vio->remote.sin_addr,buf);
- }
- DBUG_PRINT("exit", ("addr=%s", buf));
- DBUG_RETURN(0);
-}
-
-
-void vio_in_addr(Vio *vio, struct in_addr *in)
-{
- DBUG_ENTER("vio_in_addr");
- if (vio->localhost)
- bzero((char*) in, sizeof(*in)); /* This should never be executed */
- else
- *in=vio->remote.sin_addr;
- DBUG_VOID_RETURN;
-}
-
-
-/* Return 0 if there is data to be read */
-
-my_bool vio_poll_read(Vio *vio,uint timeout)
-{
-#ifndef HAVE_POLL
- return 0;
-#else
- struct pollfd fds;
- int res;
- DBUG_ENTER("vio_poll");
- fds.fd=vio->sd;
- fds.events=POLLIN;
- fds.revents=0;
- if ((res=poll(&fds,1,(int) timeout*1000)) <= 0)
- {
- DBUG_RETURN(res < 0 ? 0 : 1); /* Don't return 1 on errors */
- }
- DBUG_RETURN(fds.revents & POLLIN ? 0 : 1);
-#endif
-}
-
-#endif /* HAVE_VIO */
diff --git a/ext/mysql/libmysql/violite.h b/ext/mysql/libmysql/violite.h
deleted file mode 100644
index e764ca02bd..0000000000
--- a/ext/mysql/libmysql/violite.h
+++ /dev/null
@@ -1,103 +0,0 @@
-/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-This file is public domain and comes with NO WARRANTY of any kind */
-
-/*
- * Vio Lite.
- * Purpose: include file for Vio that will work with C and C++
- */
-
-#ifndef vio_violite_h_
-#define vio_violite_h_
-
-#include "my_net.h" /* needed because of struct in_addr */
-
-#ifdef HAVE_VIO
-#include <Vio.h> /* Full VIO interface */
-#else
-
-/* Simple vio interface in C; The functions are implemented in violite.c */
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-#ifndef Vio_defined
-#define Vio_defined
-struct st_vio; /* Only C */
-typedef struct st_vio Vio;
-#endif
-
-enum enum_vio_type { VIO_CLOSED, VIO_TYPE_TCPIP, VIO_TYPE_SOCKET,
- VIO_TYPE_NAMEDPIPE, VIO_TYPE_SSL};
-
-Vio* vio_new(my_socket sd,
- enum enum_vio_type type,
- my_bool localhost);
-#ifdef __WIN__
-Vio* vio_new_win32pipe(HANDLE hPipe);
-#endif
-void vio_delete(Vio* vio);
-
-/*
- * vio_read and vio_write should have the same semantics
- * as read(2) and write(2).
- */
-int vio_read( Vio* vio,
- gptr buf, int size);
-int vio_write( Vio* vio,
- const gptr buf,
- int size);
-/*
- * Whenever the socket is set to blocking mode or not.
- */
-int vio_blocking( Vio* vio,
- my_bool onoff);
-my_bool vio_is_blocking( Vio* vio);
-/*
- * setsockopt TCP_NODELAY at IPPROTO_TCP level, when possible.
- */
- int vio_fastsend( Vio* vio);
-/*
- * setsockopt SO_KEEPALIVE at SOL_SOCKET level, when possible.
- */
-int vio_keepalive( Vio* vio,
- my_bool onoff);
-/*
- * Whenever we should retry the last read/write operation.
- */
-my_bool vio_should_retry( Vio* vio);
-/*
- * When the workday is over...
- */
-int vio_close( Vio* vio);
-/*
- * Short text description of the socket for those, who are curious..
- */
-const char* vio_description( Vio* vio);
-
-/* Return the type of the connection */
- enum enum_vio_type vio_type(Vio* vio);
-
-/* Return last error number */
-int vio_errno(Vio *vio);
-
-/* Get socket number */
-my_socket vio_fd(Vio *vio);
-
-/*
- * Remote peer's address and name in text form.
- */
-my_bool vio_peer_addr(Vio * vio, char *buf);
-
-/* Remotes in_addr */
-
-void vio_in_addr(Vio *vio, struct in_addr *in);
-
- /* Return 1 if there is data to be read */
-my_bool vio_poll_read(Vio *vio,uint timeout);
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* HAVE_VIO */
-#endif /* vio_violite_h_ */
diff --git a/ext/mysql/mysql.dsp b/ext/mysql/mysql.dsp
deleted file mode 100644
index 896de36309..0000000000
--- a/ext/mysql/mysql.dsp
+++ /dev/null
@@ -1,171 +0,0 @@
-# Microsoft Developer Studio Project File - Name="mysql" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=mysql - Win32 Debug_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "mysql.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "mysql.mak" CFG="mysql - Win32 Debug_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "mysql - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "mysql - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "mysql - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "mysql - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "mysql - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MYSQL_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\..\MySQL\include" /I "..\..\TSRM" /D "NDEBUG" /D "MYSQL_EXPORTS" /D "COMPILE_DL_MYSQL_MYSQL" /D HAVE_MYSQL=1 /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZEND_WIN32" /D "PHP_WIN32" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "NDEBUG"
-# ADD RSC /l 0x40d /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libmySQL.lib php4nts.lib /nologo /dll /machine:I386 /out:"Release/php_mysql.dll" /libpath:"..\..\..\MySQL\lib\opt" /libpath:"..\..\Release"
-
-!ELSEIF "$(CFG)" == "mysql - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MYSQL_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\..\MySQL\include" /I "..\..\TSRM" /D "_DEBUG" /D ZEND_DEBUG=1 /D "MYSQL_EXPORTS" /D "COMPILE_DL_MYSQL_MYSQL" /D HAVE_MYSQL=1 /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZEND_WIN32" /D "PHP_WIN32" /FR /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "_DEBUG"
-# ADD RSC /l 0x40d /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libmySQL.lib php4nts_debug.lib /nologo /dll /debug /machine:I386 /out:"Debug/php_mysql.dll" /pdbtype:sept /libpath:"..\..\..\MySQL\lib\Debug" /libpath:"..\..\Debug"
-
-!ELSEIF "$(CFG)" == "mysql - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\..\Zend" /I "..\..\..\bindlib_w32" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MYSQL_EXPORTS" /D "COMPILE_DL_MYSQL" /D HAVE_MYSQL=1 /FR /YX /FD /GZ /c
-# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\..\MySQL\include" /I "..\..\TSRM" /D "_DEBUG" /D ZEND_DEBUG=1 /D "ZTS" /D "MYSQL_EXPORTS" /D "COMPILE_DL_MYSQL_MYSQL" /D HAVE_MYSQL=1 /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZEND_WIN32" /D "PHP_WIN32" /FR /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "_DEBUG"
-# ADD RSC /l 0x40d /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libmySQL.lib php4ts.lib /nologo /dll /debug /machine:I386 /out:"Debug_TS/php_mysql.dll" /pdbtype:sept /libpath:"..\..\..\MySQL\lib\Debug" /libpath:"..\..\Debug_TS"
-
-!ELSEIF "$(CFG)" == "mysql - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\..\Zend" /I "..\..\..\bindlib_w32" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MYSQL_EXPORTS" /D "COMPILE_DL_MYSQL" /D HAVE_MYSQL=1 /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\..\MySQL\include" /I "..\..\TSRM" /D "NDEBUG" /D "ZTS" /D "MYSQL_EXPORTS" /D "COMPILE_DL_MYSQL_MYSQL" /D HAVE_MYSQL=1 /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZEND_WIN32" /D "PHP_WIN32" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "NDEBUG"
-# ADD RSC /l 0x40d /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libmySQL.lib php4ts.lib /nologo /dll /machine:I386 /out:"Release_TS/php_mysql.dll" /libpath:"..\..\..\MySQL\lib\opt" /libpath:"..\..\Release_TS"
-
-!ENDIF
-
-# Begin Target
-
-# Name "mysql - Win32 Release"
-# Name "mysql - Win32 Debug"
-# Name "mysql - Win32 Debug_TS"
-# Name "mysql - Win32 Release_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\php_mysql.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_mysql.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# Begin Source File
-
-SOURCE=.\Readme_w32.txt
-# End Source File
-# End Target
-# End Project
diff --git a/ext/mysql/php_mysql.c b/ext/mysql/php_mysql.c
deleted file mode 100644
index 25d4174b72..0000000000
--- a/ext/mysql/php_mysql.c
+++ /dev/null
@@ -1,2066 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-
-/* TODO:
- *
- * ? Safe mode implementation
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "php_globals.h"
-#include "php_mysql.h"
-#include "ext/standard/info.h"
-#include "ext/standard/php_string.h"
-
-#ifdef PHP_WIN32
-#include <winsock.h>
-#define signal(a, b) NULL
-#else
-#include "build-defs.h"
-#if HAVE_SIGNAL_H
-#include <signal.h>
-#endif
-
-#if HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-#include <netdb.h>
-#include <netinet/in.h>
-#endif
-
-/* True globals, no need for thread safety */
-static int le_result, le_link, le_plink;
-
-#include "php_ini.h"
-
-# if HAVE_MYSQL_MYSQL_H
-# include <mysql/mysql.h>
-# else
-# include <mysql.h>
-# endif
-#ifdef HAVE_MYSQL_REAL_CONNECT
-#ifdef HAVE_ERRMSG_H
-#include <errmsg.h>
-#endif
-
-#define SAFE_STRING(s) ((s)?(s):"")
-
-#if MYSQL_VERSION_ID > 32199
-#define mysql_row_length_type unsigned long
-#define HAVE_MYSQL_ERRNO
-#else
-#define mysql_row_length_type unsigned int
-# ifdef mysql_errno
-# define HAVE_MYSQL_ERRNO
-# endif
-#endif
-
-#if MYSQL_VERSION_ID >= 32032
-#define HAVE_GETINFO_FUNCS
-#endif
-
-#if MYSQL_VERSION_ID > 32133 || defined(FIELD_TYPE_TINY)
-#define MYSQL_HAS_TINY
-#endif
-
-#if MYSQL_VERSION_ID >= 32200
-#define MYSQL_HAS_YEAR
-#endif
-
-#define MYSQL_ASSOC 1<<0
-#define MYSQL_NUM 1<<1
-#define MYSQL_BOTH (MYSQL_ASSOC|MYSQL_NUM)
-
-#define MYSQL_USE_RESULT 0
-#define MYSQL_STORE_RESULT 1
-
-#if MYSQL_VERSION_ID < 32224
-#define PHP_MYSQL_VALID_RESULT(mysql) \
- (mysql_num_fields(mysql)>0)
-#else
-#define PHP_MYSQL_VALID_RESULT(mysql) \
- (mysql_field_count(mysql)>0)
-#endif
-
-typedef struct _php_mysql_conn {
- MYSQL conn;
- int active_result_id;
-} php_mysql_conn;
-
-
-/* {{{ mysql_functions[]
- */
-function_entry mysql_functions[] = {
- PHP_FE(mysql_connect, NULL)
- PHP_FE(mysql_pconnect, NULL)
- PHP_FE(mysql_close, NULL)
- PHP_FE(mysql_select_db, NULL)
- PHP_FE(mysql_create_db, NULL)
- PHP_FE(mysql_drop_db, NULL)
- PHP_FE(mysql_query, NULL)
- PHP_FE(mysql_unbuffered_query, NULL)
- PHP_FE(mysql_db_query, NULL)
- PHP_FE(mysql_list_dbs, NULL)
- PHP_FE(mysql_list_tables, NULL)
- PHP_FE(mysql_list_fields, NULL)
- PHP_FE(mysql_error, NULL)
-#ifdef HAVE_MYSQL_ERRNO
- PHP_FE(mysql_errno, NULL)
-#endif
- PHP_FE(mysql_affected_rows, NULL)
- PHP_FE(mysql_insert_id, NULL)
- PHP_FE(mysql_result, NULL)
- PHP_FE(mysql_num_rows, NULL)
- PHP_FE(mysql_num_fields, NULL)
- PHP_FE(mysql_fetch_row, NULL)
- PHP_FE(mysql_fetch_array, NULL)
- PHP_FE(mysql_fetch_assoc, NULL)
- PHP_FE(mysql_fetch_object, NULL)
- PHP_FE(mysql_data_seek, NULL)
- PHP_FE(mysql_fetch_lengths, NULL)
- PHP_FE(mysql_fetch_field, NULL)
- PHP_FE(mysql_field_seek, NULL)
- PHP_FE(mysql_free_result, NULL)
- PHP_FE(mysql_field_name, NULL)
- PHP_FE(mysql_field_table, NULL)
- PHP_FE(mysql_field_len, NULL)
- PHP_FE(mysql_field_type, NULL)
- PHP_FE(mysql_field_flags, NULL)
- PHP_FE(mysql_escape_string, NULL)
-#ifdef HAVE_GETINFO_FUNCS
- PHP_FE(mysql_get_client_info, NULL)
- PHP_FE(mysql_get_host_info, NULL)
- PHP_FE(mysql_get_proto_info, NULL)
- PHP_FE(mysql_get_server_info, NULL)
-#endif
-
- /* for downwards compatability */
- PHP_FALIAS(mysql, mysql_db_query, NULL)
- PHP_FALIAS(mysql_fieldname, mysql_field_name, NULL)
- PHP_FALIAS(mysql_fieldtable, mysql_field_table, NULL)
- PHP_FALIAS(mysql_fieldlen, mysql_field_len, NULL)
- PHP_FALIAS(mysql_fieldtype, mysql_field_type, NULL)
- PHP_FALIAS(mysql_fieldflags, mysql_field_flags, NULL)
- PHP_FALIAS(mysql_selectdb, mysql_select_db, NULL)
- PHP_FALIAS(mysql_createdb, mysql_create_db, NULL)
- PHP_FALIAS(mysql_dropdb, mysql_drop_db, NULL)
- PHP_FALIAS(mysql_freeresult, mysql_free_result, NULL)
- PHP_FALIAS(mysql_numfields, mysql_num_fields, NULL)
- PHP_FALIAS(mysql_numrows, mysql_num_rows, NULL)
- PHP_FALIAS(mysql_listdbs, mysql_list_dbs, NULL)
- PHP_FALIAS(mysql_listtables, mysql_list_tables, NULL)
- PHP_FALIAS(mysql_listfields, mysql_list_fields, NULL)
- PHP_FALIAS(mysql_db_name, mysql_result, NULL)
- PHP_FALIAS(mysql_dbname, mysql_result, NULL)
- PHP_FALIAS(mysql_tablename, mysql_result, NULL)
- {NULL, NULL, NULL}
-};
-/* }}} */
-
-/* {{{ mysql_module_entry
- */
-zend_module_entry mysql_module_entry = {
- "mysql", mysql_functions, PHP_MINIT(mysql), PHP_MSHUTDOWN(mysql), PHP_RINIT(mysql), PHP_RSHUTDOWN(mysql),
- PHP_MINFO(mysql), STANDARD_MODULE_PROPERTIES
-};
-/* }}} */
-
-ZEND_DECLARE_MODULE_GLOBALS(mysql)
-
-#ifdef COMPILE_DL_MYSQL
-ZEND_GET_MODULE(mysql)
-#endif
-
-void timeout(int sig);
-
-#define CHECK_LINK(link) { if (link==-1) { php_error(E_WARNING, "MySQL: A link to the server could not be established"); RETURN_FALSE; } }
-
-/* {{{ _free_mysql_result
- * This wrapper is required since mysql_free_result() returns an integer, and
- * thus, cannot be used directly
- */
-static void _free_mysql_result(zend_rsrc_list_entry *rsrc)
-{
- MYSQL_RES *mysql_result = (MYSQL_RES *)rsrc->ptr;
-
- mysql_free_result(mysql_result);
-}
-/* }}} */
-
-/* {{{ php_mysql_set_default_link
- */
-static void php_mysql_set_default_link(int id)
-{
- MySLS_FETCH();
-
- if (MySG(default_link)!=-1) {
- zend_list_delete(MySG(default_link));
- }
- MySG(default_link) = id;
- zend_list_addref(id);
-}
-/* }}} */
-
-/* {{{ _close_mysql_link
- */
-static void _close_mysql_link(zend_rsrc_list_entry *rsrc)
-{
- php_mysql_conn *link = (php_mysql_conn *)rsrc->ptr;
- void (*handler) (int);
- MySLS_FETCH();
-
- handler = signal(SIGPIPE, SIG_IGN);
- mysql_close(&link->conn);
- signal(SIGPIPE, handler);
- efree(link);
- MySG(num_links)--;
-}
-/* }}} */
-
-/* {{{ _close_mysql_plink
- */
-static void _close_mysql_plink(zend_rsrc_list_entry *rsrc)
-{
- php_mysql_conn *link = (php_mysql_conn *)rsrc->ptr;
- void (*handler) (int);
- MySLS_FETCH();
-
- handler = signal(SIGPIPE, SIG_IGN);
- mysql_close(&link->conn);
- signal(SIGPIPE, handler);
-
- free(link);
- MySG(num_persistent)--;
- MySG(num_links)--;
-}
-/* }}} */
-
-/* {{{ PHP_INI_MH
- */
-static PHP_INI_MH(OnMySQLPort)
-{
- MySLS_FETCH();
-
- if (new_value==NULL) { /* default port */
-#ifndef PHP_WIN32
- struct servent *serv_ptr;
- char *env;
-
- MySG(default_port) = MYSQL_PORT;
- if ((serv_ptr = getservbyname("mysql", "tcp"))) {
- MySG(default_port) = (uint) ntohs((ushort) serv_ptr->s_port);
- }
- if ((env = getenv("MYSQL_TCP_PORT"))) {
- MySG(default_port) = (uint) atoi(env);
- }
-#else
- MySG(default_port) = MYSQL_PORT;
-#endif
- } else {
- MySG(default_port) = atoi(new_value);
- }
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_INI */
-PHP_INI_BEGIN()
- STD_PHP_INI_BOOLEAN("mysql.allow_persistent", "1", PHP_INI_SYSTEM, OnUpdateInt, allow_persistent, zend_mysql_globals, mysql_globals)
- STD_PHP_INI_ENTRY_EX("mysql.max_persistent", "-1", PHP_INI_SYSTEM, OnUpdateInt, max_persistent, zend_mysql_globals, mysql_globals, display_link_numbers)
- STD_PHP_INI_ENTRY_EX("mysql.max_links", "-1", PHP_INI_SYSTEM, OnUpdateInt, max_links, zend_mysql_globals, mysql_globals, display_link_numbers)
- STD_PHP_INI_ENTRY("mysql.default_host", NULL, PHP_INI_ALL, OnUpdateString, default_host, zend_mysql_globals, mysql_globals)
- STD_PHP_INI_ENTRY("mysql.default_user", NULL, PHP_INI_ALL, OnUpdateString, default_user, zend_mysql_globals, mysql_globals)
- STD_PHP_INI_ENTRY("mysql.default_password", NULL, PHP_INI_ALL, OnUpdateString, default_password, zend_mysql_globals, mysql_globals)
- PHP_INI_ENTRY("mysql.default_port", NULL, PHP_INI_ALL, OnMySQLPort)
- STD_PHP_INI_ENTRY("mysql.default_socket", NULL, PHP_INI_ALL, OnUpdateStringUnempty, default_socket, zend_mysql_globals, mysql_globals)
-PHP_INI_END()
-/* }}} */
-
-/* {{{ php_mysql_init_globals
- */
-static void php_mysql_init_globals(zend_mysql_globals *mysql_globals)
-{
- mysql_globals->num_persistent = 0;
- mysql_globals->default_socket = NULL;
- mysql_globals->default_host = NULL;
- mysql_globals->default_user = NULL;
- mysql_globals->default_password = NULL;
- mysql_globals->connect_errno = 0;
- mysql_globals->connect_error = NULL;
-}
-/* }}} */
-
-/* {{{ PHP_MINIT_FUNCTION
- */
-PHP_MINIT_FUNCTION(mysql)
-{
- ZEND_INIT_MODULE_GLOBALS(mysql, php_mysql_init_globals, NULL);
-
- REGISTER_INI_ENTRIES();
- le_result = zend_register_list_destructors_ex(_free_mysql_result, NULL, "mysql result", module_number);
- le_link = zend_register_list_destructors_ex(_close_mysql_link, NULL, "mysql link", module_number);
- le_plink = zend_register_list_destructors_ex(NULL, _close_mysql_plink, "mysql link persistent", module_number);
- mysql_module_entry.type = type;
-
- REGISTER_LONG_CONSTANT("MYSQL_ASSOC", MYSQL_ASSOC, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("MYSQL_NUM", MYSQL_NUM, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("MYSQL_BOTH", MYSQL_BOTH, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("MYSQL_USE_RESULT", MYSQL_USE_RESULT, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("MYSQL_STORE_RESULT", MYSQL_STORE_RESULT, CONST_CS | CONST_PERSISTENT);
-
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_MSHUTDOWN_FUNCTION
- */
-PHP_MSHUTDOWN_FUNCTION(mysql)
-{
- UNREGISTER_INI_ENTRIES();
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_RINIT_FUNCTION
- */
-PHP_RINIT_FUNCTION(mysql)
-{
- MySLS_FETCH();
-
- MySG(default_link)=-1;
- MySG(num_links) = MySG(num_persistent);
- /* Reset connect error/errno on every request */
- MySG(connect_error) = NULL;
- MySG(connect_errno)=0;
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_RSHUTDOWN_FUNCTION
- */
-PHP_RSHUTDOWN_FUNCTION(mysql)
-{
- MySLS_FETCH();
- if (MySG(connect_error)!=NULL) {
- efree(MySG(connect_error));
- }
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_MINFO_FUNCTION
- */
-PHP_MINFO_FUNCTION(mysql)
-{
- char buf[32];
- MySLS_FETCH();
-
- php_info_print_table_start();
- php_info_print_table_header(2, "MySQL Support", "enabled");
- sprintf(buf, "%ld", MySG(num_persistent));
- php_info_print_table_row(2, "Active Persistent Links", buf);
- sprintf(buf, "%ld", MySG(num_links));
- php_info_print_table_row(2, "Active Links", buf);
- php_info_print_table_row(2, "Client API version", mysql_get_client_info());
-#ifndef PHP_WIN32
- php_info_print_table_row(2, "MYSQL_MODULE_TYPE", PHP_MYSQL_TYPE);
- php_info_print_table_row(2, "MYSQL_SOCKET", MYSQL_UNIX_ADDR);
- php_info_print_table_row(2, "MYSQL_INCLUDE", PHP_MYSQL_INCLUDE);
- php_info_print_table_row(2, "MYSQL_LIBS", PHP_MYSQL_LIBS);
-#endif
- php_info_print_table_end();
-
- DISPLAY_INI_ENTRIES();
-
-}
-/* }}} */
-
-/* {{{ php_mysql_do_connect
- */
-#define MYSQL_DO_CONNECT_CLEANUP() \
- if (free_host) { \
- efree(host); \
- }
-
-#define MYSQL_DO_CONNECT_RETURN_FALSE() \
- MYSQL_DO_CONNECT_CLEANUP(); \
- RETURN_FALSE;
-
-static void php_mysql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
-{
- char *user=NULL, *passwd=NULL, *host_and_port=NULL, *socket=NULL, *tmp=NULL, *host=NULL;
- char *hashed_details=NULL;
- int hashed_details_length, port = MYSQL_PORT;
- php_mysql_conn *mysql=NULL;
- void (*handler) (int);
- zval **z_host=NULL, **z_user=NULL, **z_passwd=NULL;
- zend_bool free_host=0;
- MySLS_FETCH();
- PLS_FETCH();
-
- socket = MySG(default_socket);
-
- if (PG(sql_safe_mode)) {
- if (ZEND_NUM_ARGS()>0) {
- php_error(E_NOTICE, "SQL safe mode in effect - ignoring host/user/password information");
- }
- host_and_port=passwd=NULL;
- user=php_get_current_user();
- hashed_details_length = strlen(user)+5+3;
- hashed_details = (char *) emalloc(hashed_details_length+1);
- sprintf(hashed_details, "mysql__%s_", user);
- } else {
- host_and_port = MySG(default_host);
- user = MySG(default_user);
- passwd = MySG(default_password);
-
- switch(ZEND_NUM_ARGS()) {
- case 0: /* defaults */
- break;
- case 1: {
- if (zend_get_parameters_ex(1, &z_host)==FAILURE) {
- MYSQL_DO_CONNECT_RETURN_FALSE();
- }
- }
- break;
- case 2: {
- if (zend_get_parameters_ex(2, &z_host, &z_user)==FAILURE) {
- MYSQL_DO_CONNECT_RETURN_FALSE();
- }
- convert_to_string_ex(z_user);
- user = (*z_user)->value.str.val;
- }
- break;
- case 3: {
- if (zend_get_parameters_ex(3, &z_host, &z_user, &z_passwd) == FAILURE) {
- MYSQL_DO_CONNECT_RETURN_FALSE();
- }
- convert_to_string_ex(z_user);
- convert_to_string_ex(z_passwd);
- user = (*z_user)->value.str.val;
- passwd = (*z_passwd)->value.str.val;
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- if (z_host) {
- SEPARATE_ZVAL(z_host); /* We may modify z_host if it contains a port, separate */
- convert_to_string_ex(z_host);
- host_and_port = Z_STRVAL_PP(z_host);
- if (z_user) {
- convert_to_string_ex(z_user);
- user = Z_STRVAL_PP(z_user);
- if (z_passwd) {
- convert_to_string_ex(z_passwd);
- passwd = Z_STRVAL_PP(z_passwd);
- }
- }
- }
-
- hashed_details_length = sizeof("mysql___")-1 + strlen(SAFE_STRING(host_and_port))+strlen(SAFE_STRING(user))+strlen(SAFE_STRING(passwd));
- hashed_details = (char *) emalloc(hashed_details_length+1);
- sprintf(hashed_details, "mysql_%s_%s_%s", SAFE_STRING(host_and_port), SAFE_STRING(user), SAFE_STRING(passwd));
- }
-
- /* We cannot use mysql_port anymore in windows, need to use
- * mysql_real_connect() to set the port.
- */
- if (host_and_port && (tmp=strchr(host_and_port, ':'))) {
- host = estrndup(host_and_port, tmp-host_and_port);
- free_host = 1;
- tmp++;
- if (tmp[0] != '/') {
- port = atoi(tmp);
- if ((tmp=strchr(tmp, ':'))) {
- tmp++;
- socket=tmp;
- }
- } else {
- socket = tmp;
- }
- } else {
- host = host_and_port;
- port = MySG(default_port);
- }
-
-#if MYSQL_VERSION_ID < 32200
- mysql_port = port;
-#endif
-
- if (!MySG(allow_persistent)) {
- persistent=0;
- }
- if (persistent) {
- list_entry *le;
-
- /* try to find if we already have this link in our persistent list */
- if (zend_hash_find(&EG(persistent_list), hashed_details, hashed_details_length+1, (void **) &le)==FAILURE) { /* we don't */
- list_entry new_le;
-
- if (MySG(max_links)!=-1 && MySG(num_links)>=MySG(max_links)) {
- php_error(E_WARNING, "MySQL: Too many open links (%d)", MySG(num_links));
- efree(hashed_details);
- MYSQL_DO_CONNECT_RETURN_FALSE();
- }
- if (MySG(max_persistent)!=-1 && MySG(num_persistent)>=MySG(max_persistent)) {
- php_error(E_WARNING, "MySQL: Too many open persistent links (%d)", MySG(num_persistent));
- efree(hashed_details);
- MYSQL_DO_CONNECT_RETURN_FALSE();
- }
- /* create the link */
- mysql = (php_mysql_conn *) malloc(sizeof(php_mysql_conn));
- mysql->active_result_id = 0;
-#if MYSQL_VERSION_ID > 32199 /* this lets us set the port number */
- mysql_init(&mysql->conn);
- if (mysql_real_connect(&mysql->conn, host, user, passwd, NULL, port, socket, 0)==NULL) {
-#else
- if (mysql_connect(&mysql->conn, host, user, passwd)==NULL) {
-#endif
- /* Populate connect error globals so that the error functions can read them */
- if (MySG(connect_error)!=NULL) efree(MySG(connect_error));
- MySG(connect_error)=estrdup(mysql_error(&mysql->conn));
- php_error(E_WARNING, "%s", MySG(connect_error));
-#if defined(HAVE_MYSQL_ERRNO)
- MySG(connect_errno)=mysql_errno(&mysql->conn);
-#endif
- free(mysql);
- efree(hashed_details);
- MYSQL_DO_CONNECT_RETURN_FALSE();
- }
-
- /* hash it up */
- new_le.type = le_plink;
- new_le.ptr = mysql;
- if (zend_hash_update(&EG(persistent_list), hashed_details, hashed_details_length+1, (void *) &new_le, sizeof(list_entry), NULL)==FAILURE) {
- free(mysql);
- efree(hashed_details);
- MYSQL_DO_CONNECT_RETURN_FALSE();
- }
- MySG(num_persistent)++;
- MySG(num_links)++;
- } else { /* we do */
- if (le->type != le_plink) {
- MYSQL_DO_CONNECT_RETURN_FALSE();
- }
- /* ensure that the link did not die */
- handler=signal(SIGPIPE, SIG_IGN);
-#if defined(HAVE_MYSQL_ERRNO) && defined(CR_SERVER_GONE_ERROR)
- mysql_stat(le->ptr);
- if (mysql_errno(&((php_mysql_conn *) le->ptr)->conn) == CR_SERVER_GONE_ERROR) {
-#else
- if (!strcasecmp(mysql_stat(le->ptr), "mysql server has gone away")) { /* the link died */
-#endif
- signal(SIGPIPE, handler);
-#if MYSQL_VERSION_ID > 32199 /* this lets us set the port number */
- if (mysql_real_connect(le->ptr, host, user, passwd, NULL, port, socket, 0)==NULL) {
-#else
- if (mysql_connect(le->ptr, host, user, passwd)==NULL) {
-#endif
- php_error(E_WARNING, "MySQL: Link to server lost, unable to reconnect");
- zend_hash_del(&EG(persistent_list), hashed_details, hashed_details_length+1);
- efree(hashed_details);
- MYSQL_DO_CONNECT_RETURN_FALSE();
- }
- }
- signal(SIGPIPE, handler);
- mysql = (php_mysql_conn *) le->ptr;
- }
- ZEND_REGISTER_RESOURCE(return_value, mysql, le_plink);
- } else { /* non persistent */
- list_entry *index_ptr, new_index_ptr;
-
- /* first we check the hash for the hashed_details key. if it exists,
- * it should point us to the right offset where the actual mysql link sits.
- * if it doesn't, open a new mysql link, add it to the resource list,
- * and add a pointer to it with hashed_details as the key.
- */
- if (zend_hash_find(&EG(regular_list), hashed_details, hashed_details_length+1,(void **) &index_ptr)==SUCCESS) {
- int type, link;
- void *ptr;
-
- if (index_ptr->type != le_index_ptr) {
- MYSQL_DO_CONNECT_RETURN_FALSE();
- }
- link = (int) index_ptr->ptr;
- ptr = zend_list_find(link,&type); /* check if the link is still there */
- if (ptr && (type==le_link || type==le_plink)) {
- zend_list_addref(link);
- return_value->value.lval = link;
- php_mysql_set_default_link(link);
- return_value->type = IS_RESOURCE;
- efree(hashed_details);
- MYSQL_DO_CONNECT_CLEANUP();
- return;
- } else {
- zend_hash_del(&EG(regular_list), hashed_details, hashed_details_length+1);
- }
- }
- if (MySG(max_links)!=-1 && MySG(num_links)>=MySG(max_links)) {
- php_error(E_WARNING, "MySQL: Too many open links (%d)", MySG(num_links));
- efree(hashed_details);
- MYSQL_DO_CONNECT_RETURN_FALSE();
- }
-
- mysql = (php_mysql_conn *) emalloc(sizeof(php_mysql_conn));
- mysql->active_result_id = 0;
-#if MYSQL_VERSION_ID > 32199 /* this lets us set the port number */
- mysql_init(&mysql->conn);
- if (mysql_real_connect(&mysql->conn, host, user, passwd, NULL, port, socket, 0)==NULL) {
-#else
- if (mysql_connect(&mysql->conn, host, user, passwd)==NULL) {
-#endif
- /* Populate connect error globals so that the error functions can read them */
- if (MySG(connect_error)!=NULL) efree(MySG(connect_error));
- MySG(connect_error)=estrdup(mysql_error(&mysql->conn));
- php_error(E_WARNING, "%s", MySG(connect_error));
-#if defined(HAVE_MYSQL_ERRNO)
- MySG(connect_errno)=mysql_errno(&mysql->conn);
-#endif
- php_error(E_WARNING, "MySQL Connection Failed: %s\n", mysql_error(&mysql->conn));
- efree(hashed_details);
- efree(mysql);
- MYSQL_DO_CONNECT_RETURN_FALSE();
- }
-
- /* add it to the list */
- ZEND_REGISTER_RESOURCE(return_value, mysql, le_link);
-
- /* add it to the hash */
- new_index_ptr.ptr = (void *) return_value->value.lval;
- new_index_ptr.type = le_index_ptr;
- if (zend_hash_update(&EG(regular_list), hashed_details, hashed_details_length+1,(void *) &new_index_ptr, sizeof(list_entry), NULL)==FAILURE) {
- efree(hashed_details);
- MYSQL_DO_CONNECT_RETURN_FALSE();
- }
- MySG(num_links)++;
- }
-
- efree(hashed_details);
- php_mysql_set_default_link(return_value->value.lval);
- MYSQL_DO_CONNECT_CLEANUP();
-}
-/* }}} */
-
-/* {{{ php_mysql_get_default_link
- */
-static int php_mysql_get_default_link(INTERNAL_FUNCTION_PARAMETERS MySLS_DC)
-{
- if (MySG(default_link)==-1) { /* no link opened yet, implicitly open one */
- ht = 0;
- php_mysql_do_connect(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
- }
- return MySG(default_link);
-}
-/* }}} */
-
-/* {{{ proto int mysql_connect([string hostname[:port][:/path/to/socket]] [, string username] [, string password])
- Open a connection to a MySQL Server */
-PHP_FUNCTION(mysql_connect)
-{
- php_mysql_do_connect(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-/* }}} */
-
-/* {{{ proto int mysql_pconnect([string hostname[:port][:/path/to/socket]] [, string username] [, string password])
- Open a persistent connection to a MySQL Server */
-PHP_FUNCTION(mysql_pconnect)
-{
- php_mysql_do_connect(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
-}
-/* }}} */
-
-/* {{{ proto int mysql_close([int link_identifier])
- Close a MySQL connection */
-PHP_FUNCTION(mysql_close)
-{
- zval **mysql_link=NULL;
- int id;
- php_mysql_conn *mysql;
- MySLS_FETCH();
-
- switch (ZEND_NUM_ARGS()) {
- case 0:
- id = MySG(default_link);
- break;
- case 1:
- if (zend_get_parameters_ex(1, &mysql_link)==FAILURE) {
- RETURN_FALSE;
- }
- id = -1;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- ZEND_FETCH_RESOURCE2(mysql, php_mysql_conn *, mysql_link, id, "MySQL-Link", le_link, le_plink);
-
- if (id==-1) { /* explicit resource number */
- zend_list_delete(Z_RESVAL_PP(mysql_link));
- }
-
- if (id!=-1
- || (mysql_link && Z_RESVAL_PP(mysql_link)==MySG(default_link))) {
- zend_list_delete(MySG(default_link));
- MySG(default_link) = -1;
- }
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int mysql_select_db(string database_name [, int link_identifier])
- Select a MySQL database */
-PHP_FUNCTION(mysql_select_db)
-{
- zval **db, **mysql_link;
- int id;
- php_mysql_conn *mysql;
- MySLS_FETCH();
-
- switch(ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &db)==FAILURE) {
- RETURN_FALSE;
- }
- id = php_mysql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU MySLS_CC);
- CHECK_LINK(id);
- break;
- case 2:
- if (zend_get_parameters_ex(2, &db, &mysql_link)==FAILURE) {
- RETURN_FALSE;
- }
- id = -1;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
-
- ZEND_FETCH_RESOURCE2(mysql, php_mysql_conn *, mysql_link, id, "MySQL-Link", le_link, le_plink);
-
- convert_to_string_ex(db);
-
- if (mysql_select_db(&mysql->conn, (*db)->value.str.val)!=0) {
- RETURN_FALSE;
- } else {
- RETURN_TRUE;
- }
-}
-/* }}} */
-
-#ifdef HAVE_GETINFO_FUNCS
-
-/* {{{ proto string mysql_get_client_info(void)
- Returns a string that represents the client library version */
-PHP_FUNCTION(mysql_get_client_info)
-{
- if (ZEND_NUM_ARGS() != 0) {
- WRONG_PARAM_COUNT;
- }
-
- RETURN_STRING(mysql_get_client_info(),1);
-}
-/* }}} */
-
-/* {{{ proto string mysql_get_host_info([int link_identifier])
- Returns a string describing the type of connection in use, including the server host name */
-PHP_FUNCTION(mysql_get_host_info)
-{
- zval **mysql_link;
- int id;
- php_mysql_conn *mysql;
- MySLS_FETCH();
-
- switch(ZEND_NUM_ARGS()) {
- case 0:
- id = php_mysql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU MySLS_CC);
- CHECK_LINK(id);
- break;
- case 1:
- if (zend_get_parameters_ex(1,&mysql_link)==FAILURE) {
- RETURN_FALSE;
- }
- id = -1;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- ZEND_FETCH_RESOURCE2(mysql, php_mysql_conn *, mysql_link, id, "MySQL-Link", le_link, le_plink);
-
- RETURN_STRING(mysql_get_host_info(&mysql->conn),1);
-}
-/* }}} */
-
-/* {{{ proto int mysql_get_proto_info([int link_identifier])
- Returns the protocol version used by current connection */
-PHP_FUNCTION(mysql_get_proto_info)
-{
- zval **mysql_link;
- int id;
- php_mysql_conn *mysql;
- MySLS_FETCH();
-
- switch(ZEND_NUM_ARGS()) {
- case 0:
- id = php_mysql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU MySLS_CC);
- CHECK_LINK(id);
- break;
- case 1:
- if (zend_get_parameters_ex(1,&mysql_link)==FAILURE) {
- RETURN_FALSE;
- }
- id = -1;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- ZEND_FETCH_RESOURCE2(mysql, php_mysql_conn *, mysql_link, id, "MySQL-Link", le_link, le_plink);
-
- RETURN_LONG(mysql_get_proto_info(&mysql->conn));
-}
-/* }}} */
-
-/* {{{ proto string mysql_get_server_info([int link_identifier])
- Returns a string that represents the server version number */
-PHP_FUNCTION(mysql_get_server_info)
-{
- zval **mysql_link;
- int id;
- php_mysql_conn *mysql;
- MySLS_FETCH();
-
- switch(ZEND_NUM_ARGS()) {
- case 0:
- id = php_mysql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU MySLS_CC);
- CHECK_LINK(id);
- break;
- case 1:
- if (zend_get_parameters_ex(1,&mysql_link)==FAILURE) {
- RETURN_FALSE;
- }
- id = -1;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- ZEND_FETCH_RESOURCE2(mysql, php_mysql_conn *, mysql_link, id, "MySQL-Link", le_link, le_plink);
-
- RETURN_STRING(mysql_get_server_info(&mysql->conn),1);
-}
-/* }}} */
-
-#endif
-
-/* {{{ proto int mysql_create_db(string database_name [, int link_identifier])
- Create a MySQL database */
-PHP_FUNCTION(mysql_create_db)
-{
- zval **db, **mysql_link;
- int id;
- php_mysql_conn *mysql;
- MySLS_FETCH();
-
- switch(ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &db)==FAILURE) {
- RETURN_FALSE;
- }
- id = php_mysql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU MySLS_CC);
- CHECK_LINK(id);
- break;
- case 2:
- if (zend_get_parameters_ex(2, &db, &mysql_link)==FAILURE) {
- RETURN_FALSE;
- }
- id = -1;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- ZEND_FETCH_RESOURCE2(mysql, php_mysql_conn *, mysql_link, id, "MySQL-Link", le_link, le_plink);
-
- convert_to_string_ex(db);
- if (mysql_create_db(&mysql->conn, (*db)->value.str.val)==0) {
- RETURN_TRUE;
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto int mysql_drop_db(string database_name [, int link_identifier])
- Drop (delete) a MySQL database */
-PHP_FUNCTION(mysql_drop_db)
-{
- zval **db, **mysql_link;
- int id;
- php_mysql_conn *mysql;
- MySLS_FETCH();
-
- switch(ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &db)==FAILURE) {
- RETURN_FALSE;
- }
- id = php_mysql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU MySLS_CC);
- CHECK_LINK(id);
- break;
- case 2:
- if (zend_get_parameters_ex(2, &db, &mysql_link)==FAILURE) {
- RETURN_FALSE;
- }
- id = -1;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
-
- ZEND_FETCH_RESOURCE2(mysql, php_mysql_conn *, mysql_link, id, "MySQL-Link", le_link, le_plink);
-
- convert_to_string_ex(db);
- if (mysql_drop_db(&mysql->conn, (*db)->value.str.val)==0) {
- RETURN_TRUE;
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ php_mysql_do_query_general
- */
-static void php_mysql_do_query_general(zval **query, zval **mysql_link, int link_id, zval **db, int use_store, zval *return_value)
-{
- php_mysql_conn *mysql;
- MYSQL_RES *mysql_result;
- MySLS_FETCH();
-
- ZEND_FETCH_RESOURCE2(mysql, php_mysql_conn *, mysql_link, link_id, "MySQL-Link", le_link, le_plink);
-
- if (db) {
- convert_to_string_ex(db);
- if (mysql_select_db(&mysql->conn, (*db)->value.str.val)!=0) {
- RETURN_FALSE;
- }
- }
-
-
- if (mysql->active_result_id) do {
- int type;
- MYSQL_RES *mysql_result;
-
- mysql_result = (MYSQL_RES *) zend_list_find(mysql->active_result_id, &type);
- if (mysql_result && type==le_result && !mysql_eof(mysql_result)) {
- php_error(E_NOTICE, "Called %s() without first fetching all rows from a previous unbuffered query",
- get_active_function_name());
- while (mysql_fetch_row(mysql_result));
- zend_list_delete(mysql->active_result_id);
- mysql->active_result_id = 0;
- }
- } while(0);
-
- convert_to_string_ex(query);
- /* mysql_query is binary unsafe, use mysql_real_query */
-#if MYSQL_VERSION_ID > 32199
- if (mysql_real_query(&mysql->conn, (*query)->value.str.val, (*query)->value.str.len)!=0) {
- RETURN_FALSE;
- }
-#else
- if (mysql_query(&mysql->conn, (*query)->value.str.val)!=0) {
- RETURN_FALSE;
- }
-#endif
- if(use_store == MYSQL_USE_RESULT) {
- mysql_result=mysql_use_result(&mysql->conn);
- } else {
- mysql_result=mysql_store_result(&mysql->conn);
- }
- if (!mysql_result) {
- if (PHP_MYSQL_VALID_RESULT(&mysql->conn)) { /* query should have returned rows */
- php_error(E_WARNING, "MySQL: Unable to save result set");
- RETURN_FALSE;
- } else {
- RETURN_TRUE;
- }
- }
- ZEND_REGISTER_RESOURCE(return_value, mysql_result, le_result);
- if (use_store == MYSQL_USE_RESULT) {
- mysql->active_result_id = Z_LVAL_P(return_value);
- }
-}
-/* }}} */
-
-/* {{{ php_mysql_do_query
- */
-static void php_mysql_do_query(INTERNAL_FUNCTION_PARAMETERS, int use_store)
-{
- zval **query, **mysql_link;
- int id;
- MySLS_FETCH();
-
- switch(ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &query)==FAILURE) {
- RETURN_FALSE;
- }
- id = php_mysql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU MySLS_CC);
- CHECK_LINK(id);
- break;
- case 2:
- if (zend_get_parameters_ex(2, &query, &mysql_link)==FAILURE) {
- RETURN_FALSE;
- }
- id = -1;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- php_mysql_do_query_general(query, mysql_link, id, NULL, use_store, return_value);
-}
-/* }}} */
-
-/* {{{ proto int mysql_query(string query [, int link_identifier] [, int result_mode])
- Send an SQL query to MySQL */
-PHP_FUNCTION(mysql_query)
-{
- php_mysql_do_query(INTERNAL_FUNCTION_PARAM_PASSTHRU, MYSQL_STORE_RESULT);
-}
-/* }}} */
-
-
-/* {{{ proto int mysql_unbuffered_query(string query [, int link_identifier] [, int result_mode])
- Send an SQL query to MySQL, without fetching and buffering the result rows */
-PHP_FUNCTION(mysql_unbuffered_query)
-{
- php_mysql_do_query(INTERNAL_FUNCTION_PARAM_PASSTHRU, MYSQL_USE_RESULT);
-}
-/* }}} */
-
-
-/* {{{ proto int mysql_db_query(string database_name, string query [, int link_identifier])
- Send an SQL query to MySQL */
-PHP_FUNCTION(mysql_db_query)
-{
- zval **db, **query, **mysql_link;
- int id;
- MySLS_FETCH();
-
- switch(ZEND_NUM_ARGS()) {
- case 2:
- if (zend_get_parameters_ex(2, &db, &query)==FAILURE) {
- RETURN_FALSE;
- }
- id = php_mysql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU MySLS_CC);
- CHECK_LINK(id);
- break;
- case 3:
- if (zend_get_parameters_ex(3, &db, &query, &mysql_link)==FAILURE) {
- RETURN_FALSE;
- }
- id = -1;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- zend_error(E_NOTICE, "%s is deprecated; use mysql_select_db() and mysql_query() instead", get_active_function_name());
-
- php_mysql_do_query_general(query, mysql_link, id, db, MYSQL_STORE_RESULT, return_value);
-}
-/* }}} */
-
-
-/* {{{ proto int mysql_list_dbs([int link_identifier])
- List databases available on a MySQL server */
-PHP_FUNCTION(mysql_list_dbs)
-{
- zval **mysql_link;
- int id;
- php_mysql_conn *mysql;
- MYSQL_RES *mysql_result;
- MySLS_FETCH();
-
- switch(ZEND_NUM_ARGS()) {
- case 0:
- id = php_mysql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU MySLS_CC);
- CHECK_LINK(id);
- break;
- case 1:
- if (zend_get_parameters_ex(1, &mysql_link)==FAILURE) {
- RETURN_FALSE;
- }
- id = -1;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- ZEND_FETCH_RESOURCE2(mysql, php_mysql_conn *, mysql_link, id, "MySQL-Link", le_link, le_plink);
-
- if ((mysql_result=mysql_list_dbs(&mysql->conn, NULL))==NULL) {
- php_error(E_WARNING, "Unable to save MySQL query result");
- RETURN_FALSE;
- }
- ZEND_REGISTER_RESOURCE(return_value, mysql_result, le_result);
-}
-/* }}} */
-
-
-/* {{{ proto int mysql_list_tables(string database_name [, int link_identifier])
- List tables in a MySQL database */
-PHP_FUNCTION(mysql_list_tables)
-{
- zval **db, **mysql_link;
- int id;
- php_mysql_conn *mysql;
- MYSQL_RES *mysql_result;
- MySLS_FETCH();
-
- switch(ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &db)==FAILURE) {
- RETURN_FALSE;
- }
- id = php_mysql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU MySLS_CC);
- CHECK_LINK(id);
- break;
- case 2:
- if (zend_get_parameters_ex(2, &db, &mysql_link)==FAILURE) {
- RETURN_FALSE;
- }
- id = -1;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- ZEND_FETCH_RESOURCE2(mysql, php_mysql_conn *, mysql_link, id, "MySQL-Link", le_link, le_plink);
-
- convert_to_string_ex(db);
- if (mysql_select_db(&mysql->conn, (*db)->value.str.val)!=0) {
- RETURN_FALSE;
- }
- if ((mysql_result=mysql_list_tables(&mysql->conn, NULL))==NULL) {
- php_error(E_WARNING, "Unable to save MySQL query result");
- RETURN_FALSE;
- }
- ZEND_REGISTER_RESOURCE(return_value, mysql_result, le_result);
-}
-/* }}} */
-
-
-/* {{{ proto int mysql_list_fields(string database_name, string table_name [, int link_identifier])
- List MySQL result fields */
-PHP_FUNCTION(mysql_list_fields)
-{
- zval **db, **table, **mysql_link;
- int id;
- php_mysql_conn *mysql;
- MYSQL_RES *mysql_result;
- MySLS_FETCH();
-
- switch(ZEND_NUM_ARGS()) {
- case 2:
- if (zend_get_parameters_ex(2, &db, &table)==FAILURE) {
- RETURN_FALSE;
- }
- id = php_mysql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU MySLS_CC);
- CHECK_LINK(id);
- break;
- case 3:
- if (zend_get_parameters_ex(3, &db, &table, &mysql_link)==FAILURE) {
- RETURN_FALSE;
- }
- id = -1;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- ZEND_FETCH_RESOURCE2(mysql, php_mysql_conn *, mysql_link, id, "MySQL-Link", le_link, le_plink);
-
- convert_to_string_ex(db);
- if (mysql_select_db(&mysql->conn, (*db)->value.str.val)!=0) {
- RETURN_FALSE;
- }
- convert_to_string_ex(table);
- if ((mysql_result=mysql_list_fields(&mysql->conn, (*table)->value.str.val, NULL))==NULL) {
- php_error(E_WARNING, "Unable to save MySQL query result");
- RETURN_FALSE;
- }
- ZEND_REGISTER_RESOURCE(return_value, mysql_result, le_result);
-}
-/* }}} */
-
-
-/* {{{ proto string mysql_error([int link_identifier])
- Returns the text of the error message from previous MySQL operation */
-PHP_FUNCTION(mysql_error)
-{
- zval **mysql_link;
- int id;
- php_mysql_conn *mysql;
- MySLS_FETCH();
-
- switch(ZEND_NUM_ARGS()) {
- case 0:
- id = MySG(default_link);
- if (id==-1) {
- if (MySG(connect_error)!=NULL){
- RETURN_STRING(MySG(connect_error),1);
- } else {
- RETURN_FALSE;
- }
- }
- break;
- case 1:
- if (zend_get_parameters_ex(1, &mysql_link)==FAILURE) {
- RETURN_FALSE;
- }
- id = -1;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- ZEND_FETCH_RESOURCE2(mysql, php_mysql_conn *, mysql_link, id, "MySQL-Link", le_link, le_plink);
-
- RETURN_STRING(mysql_error(&mysql->conn), 1);
-}
-/* }}} */
-
-
-/* {{{ proto int mysql_errno([int link_identifier])
- Returns the number of the error message from previous MySQL operation */
-#ifdef HAVE_MYSQL_ERRNO
-PHP_FUNCTION(mysql_errno)
-{
- zval **mysql_link;
- int id;
- php_mysql_conn *mysql;
- MySLS_FETCH();
-
- switch(ZEND_NUM_ARGS()) {
- case 0:
- id = MySG(default_link);
- if (id==-1) {
- if (MySG(connect_errno)!=0){
- RETURN_LONG(MySG(connect_errno));
- } else {
- RETURN_FALSE;
- }
- }
- break;
- case 1:
- if (zend_get_parameters_ex(1, &mysql_link)==FAILURE) {
- RETURN_FALSE;
- }
- id = -1;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- ZEND_FETCH_RESOURCE2(mysql, php_mysql_conn *, mysql_link, id, "MySQL-Link", le_link, le_plink);
-
- RETURN_LONG(mysql_errno(&mysql->conn));
-}
-#endif
-/* }}} */
-
-
-/* {{{ proto int mysql_affected_rows([int link_identifier])
- Get number of affected rows in previous MySQL operation */
-PHP_FUNCTION(mysql_affected_rows)
-{
- zval **mysql_link;
- int id;
- php_mysql_conn *mysql;
- MySLS_FETCH();
-
- switch(ZEND_NUM_ARGS()) {
- case 0:
- id = MySG(default_link);
- CHECK_LINK(id);
- break;
- case 1:
- if (zend_get_parameters_ex(1, &mysql_link)==FAILURE) {
- RETURN_FALSE;
- }
- id = -1;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- ZEND_FETCH_RESOURCE2(mysql, php_mysql_conn *, mysql_link, id, "MySQL-Link", le_link, le_plink);
-
- /* conversion from int64 to long happing here */
- return_value->value.lval = (long) mysql_affected_rows(&mysql->conn);
- return_value->type = IS_LONG;
-}
-/* }}} */
-
-
-/* {{{ proto char mysql_escape_string([char string])
- Escape string for mysql query */
-PHP_FUNCTION(mysql_escape_string)
-{
- zval **str;
-
- if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &str) == FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
- convert_to_string_ex(str);
- /* assume worst case situation, which is 2x of the original string.
- * we don't realloc() down to the real size since it'd most probably not
- * be worth it
- */
- Z_STRVAL_P(return_value) = (char *) emalloc(Z_STRLEN_PP(str)*2+1);
- Z_STRLEN_P(return_value) = mysql_escape_string(Z_STRVAL_P(return_value), Z_STRVAL_PP(str), Z_STRLEN_PP(str));
- return_value->type = IS_STRING;
-}
-/* }}} */
-
-
-/* {{{ proto int mysql_insert_id([int link_identifier])
- Get the id generated from the previous INSERT operation */
-PHP_FUNCTION(mysql_insert_id)
-{
- zval **mysql_link;
- int id;
- php_mysql_conn *mysql;
- MySLS_FETCH();
-
- switch(ZEND_NUM_ARGS()) {
- case 0:
- id = MySG(default_link);
- CHECK_LINK(id);
- break;
- case 1:
- if (zend_get_parameters_ex(1, &mysql_link)==FAILURE) {
- RETURN_FALSE;
- }
- id = -1;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- ZEND_FETCH_RESOURCE2(mysql, php_mysql_conn *, mysql_link, id, "MySQL-Link", le_link, le_plink);
-
- /* conversion from int64 to long happing here */
- return_value->value.lval = (long) mysql_insert_id(&mysql->conn);
- return_value->type = IS_LONG;
-}
-/* }}} */
-
-
-/* {{{ proto int mysql_result(int result, int row [, mixed field])
- Get result data */
-PHP_FUNCTION(mysql_result)
-{
- zval **result, **row, **field=NULL;
- MYSQL_RES *mysql_result;
- MYSQL_ROW sql_row;
- mysql_row_length_type *sql_row_lengths;
- int field_offset=0;
- PLS_FETCH();
-
- switch (ZEND_NUM_ARGS()) {
- case 2:
- if (zend_get_parameters_ex(2, &result, &row)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- case 3:
- if (zend_get_parameters_ex(3, &result, &row, &field)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- ZEND_FETCH_RESOURCE(mysql_result, MYSQL_RES *, result, -1, "MySQL result", le_result);
-
- convert_to_long_ex(row);
- if ((*row)->value.lval<0 || (*row)->value.lval>=(int)mysql_num_rows(mysql_result)) {
- php_error(E_WARNING, "Unable to jump to row %d on MySQL result index %d", (*row)->value.lval, (*result)->value.lval);
- RETURN_FALSE;
- }
- mysql_data_seek(mysql_result, (*row)->value.lval);
- if ((sql_row=mysql_fetch_row(mysql_result))==NULL
- || (sql_row_lengths=mysql_fetch_lengths(mysql_result))==NULL) { /* shouldn't happen? */
- RETURN_FALSE;
- }
-
- if (field) {
- switch((*field)->type) {
- case IS_STRING: {
- int i=0;
- MYSQL_FIELD *tmp_field;
- char *table_name, *field_name, *tmp;
-
- if ((tmp=strchr((*field)->value.str.val, '.'))) {
- table_name = estrndup((*field)->value.str.val, tmp-(*field)->value.str.val);
- field_name = estrdup(tmp+1);
- } else {
- table_name = NULL;
- field_name = estrndup((*field)->value.str.val,(*field)->value.str.len);
- }
- mysql_field_seek(mysql_result, 0);
- while ((tmp_field=mysql_fetch_field(mysql_result))) {
- if ((!table_name || !strcasecmp(tmp_field->table, table_name)) && !strcasecmp(tmp_field->name, field_name)) {
- field_offset = i;
- break;
- }
- i++;
- }
- if (!tmp_field) { /* no match found */
- php_error(E_WARNING, "%s%s%s not found in MySQL result index %d",
- (table_name?table_name:""), (table_name?".":""), field_name, (*result)->value.lval);
- efree(field_name);
- if (table_name) {
- efree(table_name);
- }
- RETURN_FALSE;
- }
- efree(field_name);
- if (table_name) {
- efree(table_name);
- }
- }
- break;
- default:
- convert_to_long_ex(field);
- field_offset = (*field)->value.lval;
- if (field_offset<0 || field_offset>=(int)mysql_num_fields(mysql_result)) {
- php_error(E_WARNING, "Bad column offset specified");
- RETURN_FALSE;
- }
- break;
- }
- }
-
- if (sql_row[field_offset]) {
- return_value->type = IS_STRING;
-
- if (PG(magic_quotes_runtime)) {
- return_value->value.str.val = php_addslashes(sql_row[field_offset], sql_row_lengths[field_offset],&return_value->value.str.len, 0);
- } else {
- return_value->value.str.len = sql_row_lengths[field_offset];
- return_value->value.str.val = (char *) safe_estrndup(sql_row[field_offset], return_value->value.str.len);
- }
- } else {
- return_value->type = IS_NULL;
- }
-}
-/* }}} */
-
-
-/* {{{ proto int mysql_num_rows(int result)
- Get number of rows in a result */
-PHP_FUNCTION(mysql_num_rows)
-{
- zval **result;
- MYSQL_RES *mysql_result;
-
- if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &result)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(mysql_result, MYSQL_RES *, result, -1, "MySQL result", le_result);
-
- /* conversion from int64 to long happing here */
- return_value->value.lval = (long)mysql_num_rows(mysql_result);
- return_value->type = IS_LONG;
-}
-/* }}} */
-
-/* {{{ proto int mysql_num_fields(int result)
- Get number of fields in a result */
-PHP_FUNCTION(mysql_num_fields)
-{
- zval **result;
- MYSQL_RES *mysql_result;
-
- if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &result)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(mysql_result, MYSQL_RES *, result, -1, "MySQL result", le_result);
-
- return_value->value.lval = mysql_num_fields(mysql_result);
- return_value->type = IS_LONG;
-}
-/* }}} */
-
-/* {{{ php_mysql_fetch_hash
- */
-static void php_mysql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, int result_type, int expected_args)
-{
- zval **result, **arg2;
- MYSQL_RES *mysql_result;
- MYSQL_ROW mysql_row;
- MYSQL_FIELD *mysql_field;
- mysql_row_length_type *mysql_row_lengths;
- int num_fields;
- int i;
- PLS_FETCH();
-
- if (ZEND_NUM_ARGS() > expected_args) {
- WRONG_PARAM_COUNT;
- }
-
- switch (ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &result)==FAILURE) {
- RETURN_FALSE;
- }
- if (!result_type) {
- result_type = MYSQL_BOTH;
- }
- break;
- case 2:
- if (zend_get_parameters_ex(2, &result, &arg2)==FAILURE) {
- RETURN_FALSE;
- }
- convert_to_long_ex(arg2);
- result_type = (*arg2)->value.lval;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- ZEND_FETCH_RESOURCE(mysql_result, MYSQL_RES *, result, -1, "MySQL result", le_result);
-
- if ((mysql_row=mysql_fetch_row(mysql_result))==NULL
- || (mysql_row_lengths=mysql_fetch_lengths(mysql_result))==NULL) {
- RETURN_FALSE;
- }
-
- num_fields = mysql_num_fields(mysql_result);
-
- if (array_init(return_value)==FAILURE) {
- RETURN_FALSE;
- }
-
- mysql_field_seek(mysql_result, 0);
- for (mysql_field=mysql_fetch_field(mysql_result), i=0; mysql_field; mysql_field=mysql_fetch_field(mysql_result), i++) {
- if (mysql_row[i]) {
- char *data;
- int data_len;
- int should_copy;
-
- if (PG(magic_quotes_runtime)) {
- data = php_addslashes(mysql_row[i], mysql_row_lengths[i],&data_len, 0);
- should_copy = 0;
- } else {
- data = mysql_row[i];
- data_len = mysql_row_lengths[i];
- should_copy = 1;
- }
-
- if (result_type & MYSQL_NUM) {
- add_index_stringl(return_value, i, data, data_len, should_copy);
- should_copy = 1;
- }
-
- if (result_type & MYSQL_ASSOC) {
- add_assoc_stringl(return_value, mysql_field->name, data, data_len, should_copy);
- }
- } else {
- /* NULL value. */
- if (result_type & MYSQL_NUM)
- add_index_null(return_value, i);
- else
- add_assoc_null(return_value, mysql_field->name);
- }
- }
-}
-/* }}} */
-
-/* {{{ proto array mysql_fetch_row(int result)
- Get a result row as an enumerated array */
-PHP_FUNCTION(mysql_fetch_row)
-{
- php_mysql_fetch_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU, MYSQL_NUM, 1);
-}
-/* }}} */
-
-
-/* {{{ proto object mysql_fetch_object(int result [, int result_type])
- Fetch a result row as an object */
-PHP_FUNCTION(mysql_fetch_object)
-{
- php_mysql_fetch_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU, MYSQL_ASSOC, 2);
- if (return_value->type==IS_ARRAY) {
- return_value->type=IS_OBJECT;
- return_value->value.obj.properties = return_value->value.ht;
- return_value->value.obj.ce = &zend_standard_class_def;
- }
-}
-/* }}} */
-
-
-/* {{{ proto array mysql_fetch_array(int result [, int result_type])
- Fetch a result row as an array (associative, numeric or both)*/
-PHP_FUNCTION(mysql_fetch_array)
-{
- php_mysql_fetch_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0, 2);
-}
-/* }}} */
-
-
-/* {{{ proto array mysql_fetch_assoc(int result)
- Fetch a result row as an associative array */
-PHP_FUNCTION(mysql_fetch_assoc)
-{
- php_mysql_fetch_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU, MYSQL_ASSOC, 1);
-}
-/* }}} */
-
-/* {{{ proto int mysql_data_seek(int result, int row_number)
- Move internal result pointer */
-PHP_FUNCTION(mysql_data_seek)
-{
- zval **result, **offset;
- MYSQL_RES *mysql_result;
-
- if (ZEND_NUM_ARGS()!=2 || zend_get_parameters_ex(2, &result, &offset)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(mysql_result, MYSQL_RES *, result, -1, "MySQL result", le_result);
-
- convert_to_long_ex(offset);
- if ((*offset)->value.lval<0 || (*offset)->value.lval>=(int)mysql_num_rows(mysql_result)) {
- php_error(E_WARNING, "Offset %d is invalid for MySQL result index %d", (*offset)->value.lval, (*result)->value.lval);
- RETURN_FALSE;
- }
- mysql_data_seek(mysql_result, (*offset)->value.lval);
- RETURN_TRUE;
-}
-/* }}} */
-
-
-/* {{{ proto array mysql_fetch_lengths(int result)
- Get max data size of each column in a result */
-PHP_FUNCTION(mysql_fetch_lengths)
-{
- zval **result;
- MYSQL_RES *mysql_result;
- mysql_row_length_type *lengths;
- int num_fields;
- int i;
-
-
- if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &result)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(mysql_result, MYSQL_RES *, result, -1, "MySQL result", le_result);
-
- if ((lengths=mysql_fetch_lengths(mysql_result))==NULL) {
- RETURN_FALSE;
- }
- if (array_init(return_value)==FAILURE) {
- RETURN_FALSE;
- }
- num_fields = mysql_num_fields(mysql_result);
-
- for (i=0; i<num_fields; i++) {
- add_index_long(return_value, i, lengths[i]);
- }
-}
-/* }}} */
-
-/* {{{ php_mysql_get_field_name
- */
-static char *php_mysql_get_field_name(int field_type)
-{
- switch(field_type) {
- case FIELD_TYPE_STRING:
- case FIELD_TYPE_VAR_STRING:
- return "string";
- break;
-#ifdef MYSQL_HAS_TINY
- case FIELD_TYPE_TINY:
-#endif
- case FIELD_TYPE_SHORT:
- case FIELD_TYPE_LONG:
- case FIELD_TYPE_LONGLONG:
- case FIELD_TYPE_INT24:
- return "int";
- break;
- case FIELD_TYPE_FLOAT:
- case FIELD_TYPE_DOUBLE:
- case FIELD_TYPE_DECIMAL:
- return "real";
- break;
- case FIELD_TYPE_TIMESTAMP:
- return "timestamp";
- break;
-#ifdef MYSQL_HAS_YEAR
- case FIELD_TYPE_YEAR:
- return "year";
- break;
-#endif
- case FIELD_TYPE_DATE:
- return "date";
- break;
- case FIELD_TYPE_TIME:
- return "time";
- break;
- case FIELD_TYPE_DATETIME:
- return "datetime";
- break;
- case FIELD_TYPE_TINY_BLOB:
- case FIELD_TYPE_MEDIUM_BLOB:
- case FIELD_TYPE_LONG_BLOB:
- case FIELD_TYPE_BLOB:
- return "blob";
- break;
- case FIELD_TYPE_NULL:
- return "null";
- break;
- default:
- return "unknown";
- break;
- }
-}
-/* }}} */
-
-/* {{{ proto object mysql_fetch_field(int result [, int field_offset])
- Get column information from a result and return as an object */
-PHP_FUNCTION(mysql_fetch_field)
-{
- zval **result, **field=NULL;
- MYSQL_RES *mysql_result;
- MYSQL_FIELD *mysql_field;
-
- switch (ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &result)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- case 2:
- if (zend_get_parameters_ex(2, &result, &field)==FAILURE) {
- RETURN_FALSE;
- }
- convert_to_long_ex(field);
- break;
- default:
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(mysql_result, MYSQL_RES *, result, -1, "MySQL result", le_result);
-
- if (field) {
- if ((*field)->value.lval<0 || (*field)->value.lval>=(int)mysql_num_fields(mysql_result)) {
- php_error(E_WARNING, "MySQL: Bad field offset");
- RETURN_FALSE;
- }
- mysql_field_seek(mysql_result, (*field)->value.lval);
- }
- if ((mysql_field=mysql_fetch_field(mysql_result))==NULL) {
- RETURN_FALSE;
- }
- if (object_init(return_value)==FAILURE) {
- RETURN_FALSE;
- }
-
- add_property_string(return_value, "name",(mysql_field->name?mysql_field->name:empty_string), 1);
- add_property_string(return_value, "table",(mysql_field->table?mysql_field->table:empty_string), 1);
- add_property_string(return_value, "def",(mysql_field->def?mysql_field->def:empty_string), 1);
- add_property_long(return_value, "max_length", mysql_field->max_length);
- add_property_long(return_value, "not_null", IS_NOT_NULL(mysql_field->flags)?1:0);
- add_property_long(return_value, "primary_key", IS_PRI_KEY(mysql_field->flags)?1:0);
- add_property_long(return_value, "multiple_key",(mysql_field->flags&MULTIPLE_KEY_FLAG?1:0));
- add_property_long(return_value, "unique_key",(mysql_field->flags&UNIQUE_KEY_FLAG?1:0));
- add_property_long(return_value, "numeric", IS_NUM(mysql_field->type)?1:0);
- add_property_long(return_value, "blob", IS_BLOB(mysql_field->flags)?1:0);
- add_property_string(return_value, "type", php_mysql_get_field_name(mysql_field->type), 1);
- add_property_long(return_value, "unsigned",(mysql_field->flags&UNSIGNED_FLAG?1:0));
- add_property_long(return_value, "zerofill",(mysql_field->flags&ZEROFILL_FLAG?1:0));
-}
-/* }}} */
-
-
-/* {{{ proto int mysql_field_seek(int result, int field_offset)
- Set result pointer to a specific field offset */
-PHP_FUNCTION(mysql_field_seek)
-{
- zval **result, **offset;
- MYSQL_RES *mysql_result;
-
- if (ZEND_NUM_ARGS()!=2 || zend_get_parameters_ex(2, &result, &offset)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(mysql_result, MYSQL_RES *, result, -1, "MySQL result", le_result);
-
- convert_to_long_ex(offset);
- if ((*offset)->value.lval<0 || (*offset)->value.lval>=(int)mysql_num_fields(mysql_result)) {
- php_error(E_WARNING, "Field %d is invalid for MySQL result index %d", (*offset)->value.lval, (*result)->value.lval);
- RETURN_FALSE;
- }
- mysql_field_seek(mysql_result, (*offset)->value.lval);
- RETURN_TRUE;
-}
-/* }}} */
-
-
-#define PHP_MYSQL_FIELD_NAME 1
-#define PHP_MYSQL_FIELD_TABLE 2
-#define PHP_MYSQL_FIELD_LEN 3
-#define PHP_MYSQL_FIELD_TYPE 4
-#define PHP_MYSQL_FIELD_FLAGS 5
-
-/* {{{ php_mysql_field_info
- */
-static void php_mysql_field_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type)
-{
- zval **result, **field;
- MYSQL_RES *mysql_result;
- MYSQL_FIELD *mysql_field;
- char buf[512];
- int len;
-
- if (ZEND_NUM_ARGS()!=2 || zend_get_parameters_ex(2, &result, &field)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(mysql_result, MYSQL_RES *, result, -1, "MySQL result", le_result);
-
- convert_to_long_ex(field);
- if ((*field)->value.lval<0 || (*field)->value.lval>=(int)mysql_num_fields(mysql_result)) {
- php_error(E_WARNING, "Field %d is invalid for MySQL result index %d", (*field)->value.lval, (*result)->value.lval);
- RETURN_FALSE;
- }
- mysql_field_seek(mysql_result, (*field)->value.lval);
- if ((mysql_field=mysql_fetch_field(mysql_result))==NULL) {
- RETURN_FALSE;
- }
-
- switch (entry_type) {
- case PHP_MYSQL_FIELD_NAME:
- return_value->value.str.len = strlen(mysql_field->name);
- return_value->value.str.val = estrndup(mysql_field->name, return_value->value.str.len);
- return_value->type = IS_STRING;
- break;
- case PHP_MYSQL_FIELD_TABLE:
- return_value->value.str.len = strlen(mysql_field->table);
- return_value->value.str.val = estrndup(mysql_field->table, return_value->value.str.len);
- return_value->type = IS_STRING;
- break;
- case PHP_MYSQL_FIELD_LEN:
- return_value->value.lval = mysql_field->length;
- return_value->type = IS_LONG;
- break;
- case PHP_MYSQL_FIELD_TYPE:
- return_value->value.str.val = php_mysql_get_field_name(mysql_field->type);
- return_value->value.str.len = strlen(return_value->value.str.val);
- return_value->value.str.val = estrndup(return_value->value.str.val, return_value->value.str.len);
- return_value->type = IS_STRING;
- break;
- case PHP_MYSQL_FIELD_FLAGS:
- strcpy(buf, "");
-#ifdef IS_NOT_NULL
- if (IS_NOT_NULL(mysql_field->flags)) {
- strcat(buf, "not_null ");
- }
-#endif
-#ifdef IS_PRI_KEY
- if (IS_PRI_KEY(mysql_field->flags)) {
- strcat(buf, "primary_key ");
- }
-#endif
-#ifdef UNIQUE_KEY_FLAG
- if (mysql_field->flags&UNIQUE_KEY_FLAG) {
- strcat(buf, "unique_key ");
- }
-#endif
-#ifdef MULTIPLE_KEY_FLAG
- if (mysql_field->flags&MULTIPLE_KEY_FLAG) {
- strcat(buf, "multiple_key ");
- }
-#endif
-#ifdef IS_BLOB
- if (IS_BLOB(mysql_field->flags)) {
- strcat(buf, "blob ");
- }
-#endif
-#ifdef UNSIGNED_FLAG
- if (mysql_field->flags&UNSIGNED_FLAG) {
- strcat(buf, "unsigned ");
- }
-#endif
-#ifdef ZEROFILL_FLAG
- if (mysql_field->flags&ZEROFILL_FLAG) {
- strcat(buf, "zerofill ");
- }
-#endif
-#ifdef BINARY_FLAG
- if (mysql_field->flags&BINARY_FLAG) {
- strcat(buf, "binary ");
- }
-#endif
-#ifdef ENUM_FLAG
- if (mysql_field->flags&ENUM_FLAG) {
- strcat(buf, "enum ");
- }
-#endif
-#ifdef AUTO_INCREMENT_FLAG
- if (mysql_field->flags&AUTO_INCREMENT_FLAG) {
- strcat(buf, "auto_increment ");
- }
-#endif
-#ifdef TIMESTAMP_FLAG
- if (mysql_field->flags&TIMESTAMP_FLAG) {
- strcat(buf, "timestamp ");
- }
-#endif
- len = strlen(buf);
- /* remove trailing space, if present */
- if (len && buf[len-1] == ' ') {
- buf[len-1] = 0;
- len--;
- }
-
- return_value->value.str.len = len;
- return_value->value.str.val = estrndup(buf, len);
- return_value->type = IS_STRING;
- break;
-
- default:
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto string mysql_field_name(int result, int field_index)
- Get the name of the specified field in a result */
-PHP_FUNCTION(mysql_field_name)
-{
- php_mysql_field_info(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_MYSQL_FIELD_NAME);
-}
-/* }}} */
-
-
-/* {{{ proto string mysql_field_table(int result, int field_offset)
- Get name of the table the specified field is in */
-PHP_FUNCTION(mysql_field_table)
-{
- php_mysql_field_info(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_MYSQL_FIELD_TABLE);
-}
-/* }}} */
-
-
-/* {{{ proto int mysql_field_len(int result, int field_offset)
- Returns the length of the specified field */
-PHP_FUNCTION(mysql_field_len)
-{
- php_mysql_field_info(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_MYSQL_FIELD_LEN);
-}
-/* }}} */
-
-
-/* {{{ proto string mysql_field_type(int result, int field_offset)
- Get the type of the specified field in a result */
-PHP_FUNCTION(mysql_field_type)
-{
- php_mysql_field_info(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_MYSQL_FIELD_TYPE);
-}
-/* }}} */
-
-
-/* {{{ proto string mysql_field_flags(int result, int field_offset)
- Get the flags associated with the specified field in a result */
-PHP_FUNCTION(mysql_field_flags)
-{
- php_mysql_field_info(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_MYSQL_FIELD_FLAGS);
-}
-/* }}} */
-
-
-/* {{{ proto int mysql_free_result(int result)
- Free result memory */
-PHP_FUNCTION(mysql_free_result)
-{
- zval **result;
- MYSQL_RES *mysql_result;
-
- if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &result)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if ((*result)->type==IS_RESOURCE && (*result)->value.lval==0) {
- RETURN_FALSE;
- }
-
- ZEND_FETCH_RESOURCE(mysql_result, MYSQL_RES *, result, -1, "MySQL result", le_result);
-
- zend_list_delete((*result)->value.lval);
- RETURN_TRUE;
-}
-/* }}} */
-#endif
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/mysql/php_mysql.h b/ext/mysql/php_mysql.h
deleted file mode 100644
index aa2213963b..0000000000
--- a/ext/mysql/php_mysql.h
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-
-/* $Id$ */
-
-#ifndef PHP_MYSQL_H
-#define PHP_MYSQL_H
-
-#ifdef PHP_WIN32
-#define PHP_MYSQL_API __declspec(dllexport)
-#else
-#define PHP_MYSQL_API
-#endif
-
-#if HAVE_MYSQL
-
-#ifdef ZTS
-#include "TSRM.h"
-#endif
-
-extern zend_module_entry mysql_module_entry;
-
-#define mysql_module_ptr &mysql_module_entry
-
-extern PHP_MINIT_FUNCTION(mysql);
-extern PHP_RINIT_FUNCTION(mysql);
-extern PHP_MSHUTDOWN_FUNCTION(mysql);
-extern PHP_RSHUTDOWN_FUNCTION(mysql);
-PHP_MINFO_FUNCTION(mysql);
-
-PHP_FUNCTION(mysql_connect);
-PHP_FUNCTION(mysql_pconnect);
-PHP_FUNCTION(mysql_close);
-PHP_FUNCTION(mysql_select_db);
-PHP_FUNCTION(mysql_create_db);
-PHP_FUNCTION(mysql_drop_db);
-PHP_FUNCTION(mysql_query);
-PHP_FUNCTION(mysql_unbuffered_query);
-PHP_FUNCTION(mysql_db_query);
-PHP_FUNCTION(mysql_list_dbs);
-PHP_FUNCTION(mysql_list_tables);
-PHP_FUNCTION(mysql_list_fields);
-PHP_FUNCTION(mysql_error);
-PHP_FUNCTION(mysql_errno);
-PHP_FUNCTION(mysql_affected_rows);
-PHP_FUNCTION(mysql_insert_id);
-PHP_FUNCTION(mysql_result);
-PHP_FUNCTION(mysql_num_rows);
-PHP_FUNCTION(mysql_num_fields);
-PHP_FUNCTION(mysql_fetch_row);
-PHP_FUNCTION(mysql_fetch_array);
-PHP_FUNCTION(mysql_fetch_assoc);
-PHP_FUNCTION(mysql_fetch_object);
-PHP_FUNCTION(mysql_data_seek);
-PHP_FUNCTION(mysql_fetch_lengths);
-PHP_FUNCTION(mysql_fetch_field);
-PHP_FUNCTION(mysql_field_seek);
-PHP_FUNCTION(mysql_free_result);
-PHP_FUNCTION(mysql_field_name);
-PHP_FUNCTION(mysql_field_table);
-PHP_FUNCTION(mysql_field_len);
-PHP_FUNCTION(mysql_field_type);
-PHP_FUNCTION(mysql_field_flags);
-PHP_FUNCTION(mysql_escape_string);
-PHP_FUNCTION(mysql_get_client_info);
-PHP_FUNCTION(mysql_get_host_info);
-PHP_FUNCTION(mysql_get_proto_info);
-PHP_FUNCTION(mysql_get_server_info);
-
-ZEND_BEGIN_MODULE_GLOBALS(mysql)
- long default_link;
- long num_links,num_persistent;
- long max_links,max_persistent;
- long allow_persistent;
- long default_port;
- char *default_host, *default_user, *default_password;
- char *default_socket;
- char *connect_error;
- long connect_errno;
-ZEND_END_MODULE_GLOBALS(mysql)
-
-#ifdef ZTS
-# define MySLS_D zend_mysql_globals *mysql_globals
-# define MySLS_DC , MySLS_D
-# define MySLS_C mysql_globals
-# define MySLS_CC , MySLS_C
-# define MySG(v) (mysql_globals->v)
-# define MySLS_FETCH() zend_mysql_globals *mysql_globals = ts_resource(mysql_globals_id)
-#else
-# define MySLS_D
-# define MySLS_DC
-# define MySLS_C
-# define MySLS_CC
-# define MySG(v) (mysql_globals.v)
-# define MySLS_FETCH()
-#endif
-
-
-#else
-
-#define mysql_module_ptr NULL
-
-#endif
-
-#define phpext_mysql_ptr mysql_module_ptr
-
-#endif /* PHP_MYSQL_H */
diff --git a/ext/mysql/setup.stub b/ext/mysql/setup.stub
deleted file mode 100644
index 77b560c6cd..0000000000
--- a/ext/mysql/setup.stub
+++ /dev/null
@@ -1,7 +0,0 @@
-# $Source$
-# $Id$
-
-define_option with-mysql 'MySQL support?' yesnodir \
- 'no /usr/local MySQL install' \
-' Whether to build PHP with MySQL support.\n
- More info about MySQL can be found at http://www.mysql.com/.'
diff --git a/ext/ncurses/CREDITS b/ext/ncurses/CREDITS
deleted file mode 100644
index 05679b8c8a..0000000000
--- a/ext/ncurses/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-ncurses
-Hartmut Holzgraefe
diff --git a/ext/ncurses/EXPERIMENTAL b/ext/ncurses/EXPERIMENTAL
deleted file mode 100644
index e69de29bb2..0000000000
--- a/ext/ncurses/EXPERIMENTAL
+++ /dev/null
diff --git a/ext/ncurses/Makefile.in b/ext/ncurses/Makefile.in
deleted file mode 100644
index 359ed0f423..0000000000
--- a/ext/ncurses/Makefile.in
+++ /dev/null
@@ -1,8 +0,0 @@
-# $Id$
-
-LTLIBRARY_NAME = libncurses.la
-LTLIBRARY_SOURCES = ncurses.c ncurses_fe.c ncurses_functions.c
-LTLIBRARY_SHARED_NAME = ncurses.la
-LTLIBRARY_SHARED_LIBADD = $(NCURSES_SHARED_LIBADD)
-
-include $(top_srcdir)/build/dynlib.mk
diff --git a/ext/ncurses/c-prototypes b/ext/ncurses/c-prototypes
deleted file mode 100644
index c76c8feb51..0000000000
--- a/ext/ncurses/c-prototypes
+++ /dev/null
@@ -1,263 +0,0 @@
-+ int addch(int);
-- int addchnstr(int *,int);
-- int addchstr(int *);
-- int addnstr(string,int);
-- int addstr(string);
-- int assume_default_colors (int,int);
-- int attr_get(int *,int *,void *);
-- int attr_off(int,void *);
-- int attr_on(int,void *);
-- int attr_set(int,int,void *);
-+ int attroff(int);
-+ int attron(int);
-+ int attrset(int);
-+ int baudrate(void);
-+ int beep(void);
-+ int bkgd(int);
-+ void bkgdset(int);
-- int border(int,int,int,int,int,int,int,int);
-- int box(resource,int,int);
-+ bool can_change_color(void);
-+ int cbreak(void);
-- int chgat(int,int,int,void *);
-+ int clear(void);
-- int clearok(resource,bool);
-+ int clrtobot(void);
-+ int clrtoeol(void);
-- int color_content(int,int*,int*,int*);
-+ int color_set(int,void*);
-- int copywin(resource,resource,int,int,int,int,int,int,int);
-+ int curs_set(int);
-+ int def_prog_mode(void);
-+ int def_shell_mode(void);
-- int define_key (string,int);
-+ int delay_output(int);
-+ int delch(void);
-+ int deleteln(void);
-- void delscreen(SCREEN *);
-+ int delwin(resource);
-+ int doupdate(void);
-+ int echo(void);
-+ int echochar(int);
-+ int endwin(void);
-+ int erase(void);
-+ char erasechar(void);
-+ void filter(void);
-+ int flash(void);
-+ int flushinp(void);
-- int getbkgd(resource);
-+ int getch(void);
-- int getmouse(MEVENT *);
-- int getnstr(string,int);
-- int getstr(string);
-+ int halfdelay(int);
-+ bool has_colors(void);
-+ bool has_ic(void);
-+ bool has_il(void);
-+ int has_key(int); /* do we have given key? */
-- int hline(int,int);
-- void idcok(resource,bool);
-- int idlok(resource,bool);
-- void immedok(resource,bool);
-+ int inch(void);
-- int inchnstr(int *,int);
-- int inchstr(int *);
-- int init_color(int,int,int,int);
-+ int init_pair(int,int,int);
-- int innstr(string,int);
-+ int insch(int);
-+ int insdelln(int);
-+ int insertln(void);
-- int insnstr(string,int);
-- int insstr(string);
-- int instr(string);
-- int intrflush(resource,bool);
-- bool is_linetouched(resource,int);
-- bool is_wintouched(resource);
-+ bool isendwin(void);
-- int keyok (int,bool);
-- int keypad(resource,bool);
-+ char killchar(void);
-- int leaveok(resource,bool);
-- int mcprint(string,int); /* direct data to printer */
-- int meta(resource,bool);
-+ int mouseinterval(int);
-- mmask_t mousemask(mmask_t,mmask_t *);
-+ int move(int,int);
-- int mvaddch(int,int,int);
-- int mvaddchnstr(int,int,int *,int);
-- int mvaddchstr(int,int,int *);
-- int mvaddnstr(int,int,string,int);
-- int mvaddstr(int,int,string);
-- int mvchgat(int,int,int,int,int,void *);
-- int mvcur(int,int,int,int);
-- int mvdelch(int,int);
-- int mvderwin(resource,int,int);
-- int mvgetch(int,int);
-- int mvgetnstr(int,int,string,int);
-- int mvgetstr(int,int,string);
-- int mvhline(int,int,int,int);
-- int mvinch(int,int);
-- int mvinchnstr(int,int,int *,int);
-- int mvinchstr(int,int,int *);
-- int mvinnstr(int,int,string,int);
-- int mvinsch(int,int,int);
-- int mvinsnstr(int,int,string,int);
-- int mvinsstr(int,int,string);
-- int mvinstr(int,int,string);
-- int mvprintw(int,int, string,...);
-- int mvscanw(int,int, string,...);
-- int mvwaddch(resource,int,int,int);
-- int mvwaddchnstr(resource,int,int,int *,int);
-- int mvwaddchstr(resource,int,int,int *);
-- int mvwaddnstr(resource,int,int,string,int);
-- int mvwaddstr(resource,int,int,string);
-- int mvwchgat(resource,int,int,int,int,int,void *);
-- int mvwdelch(resource,int,int);
-- int mvwgetch(resource,int,int);
-- int mvwgetnstr(resource,int,int,string,int);
-- int mvwgetstr(resource,int,int,string);
-- int mvwhline(resource,int,int,int,int);
-- int mvwin(resource,int,int);
-- int mvwinch(resource,int,int);
-- int mvwinchstr(resource,int,int,int *);
-- int mvwinnstr(resource,int,int,string,int);
-- int mvwinsch(resource,int,int,int);
-- int mvwinsnstr(resource,int,int,string,int);
-- int mvwinsstr(resource,int,int,string);
-- int mvwinstr(resource,int,int,string);
-- int mvwinchnstr(resource,int,int,int *,int);
-- int mvwprintw(resource,int,int, string,...);
-- int mvwscanw(resource,int,int, string,...);
-- int mvwvline(resource,int,int,int,int);
-+ int napms(int);
-+ int nl(void);
-+ int nocbreak(void);
-- int nodelay(resource,bool);
-+ int noecho(void);
-+ int nonl(void);
-+ void noqiflush(void);
-+ int noraw(void);
-- int notimeout(resource,bool);
-- int overlay(resource,resource);
-- int overwrite(resource,resource);
-- int pair_content(int,int*,int*);
-- int pechochar(resource,int);
-- int pnoutrefresh(resource,int,int,int,int,int,int);
-- int prefresh(resource,int,int,int,int,int,int);
-- int printw( string,...);
-- int putp(string);
-- int putwin(resource,FILE *);
-+ void qiflush(void);
-+ int raw(void);
-- int redrawwin(resource);
-+ int refresh(void);
-- int reset_prog_mode(void);
-- int reset_shell_mode(void);
-+ int resetty(void);
-- int resizeterm (int,int);
-- int ripoffline(int,int (*init)(resource,int));
-+ int savetty(void);
-- int scanw( string,...);
-- int scr_dump(string);
-- int scr_init(string);
-- int scr_restore(string);
-- int scr_set(string);
-+ int scrl(int);
-- int scroll(resource);
-- int scrollok(resource,bool);
-- int setscrreg(int,int);
-+ int slk_attroff(int);
-- int slk_attr_off(int,void *); /* generated:WIDEC */
-+ int slk_attron(int);
-- int slk_attr_on(int,void*); /* generated:WIDEC */
-+ int slk_attrset(int);
-+ int slk_attr(void);
-- int slk_attr_set(int,int,void*);
-+ int slk_clear(void);
-+ int slk_color(int);
-+ int slk_init(int);
-+ int slk_noutrefresh(void);
-- int slk_refresh(void);
-- int slk_restore(void);
-- int slk_set(int,string,int);
-- int slk_touch(void);
-+ int standend(void);
-+ int standout(void);
-+ int start_color(void);
-- int syncok(resource,bool);
-+ int termattrs(void);
-- int tigetflag( string);
-- int tigetnum( string);
-+ void timeout(int);
-+ int typeahead(int);
-+ int ungetch(int);
-- int ungetmouse(MEVENT *);
-- int untouchwin(resource);
-+ int use_default_colors (void);
-+ void use_env(bool);
-+ int use_extended_names (bool);
-+ int vidattr(int);
-- int vidputs(int,int (*)(int));
-- int vline(int,int);
-- int vw_printw(resource, string,va_list);
-- int vw_scanw(resource, string,va_list);
-- int vwprintw(resource, string,va_list);
-- int vwscanw(resource, string,va_list);
-- int waddch(resource,int);
-- int waddchnstr(resource,int *const,int);
-- int waddchstr(resource,int *);
-- int waddnstr(resource,stringconst,int);
-- int waddstr(resource,string);
-- int wattr_get(resource,int *,int *,void *);
-- int wattr_off(resource, int,void *);
-- int wattr_on(resource, int,void *);
-- int wattr_set(resource,int,int,void *);
-- int wattroff(resource,int);
-- int wattron(resource,int);
-- int wattrset(resource,int);
-- int wbkgd(resource,int);
-- void wbkgdset(resource,int);
-- int wborder(resource,int,int,int,int,int,int,int,int);
-- int wchgat(resource,int,int,int,void *);
-- int wclear(resource);
-- int wclrtobot(resource);
-- int wclrtoeol(resource);
-- int wcolor_set(resource,int,void*);
-- void wcursyncup(resource);
-- int wdelch(resource);
-- int wdeleteln(resource);
-- int wechochar(resource,int);
-- bool wenclose(resource,int,int);
-- int werase(resource);
-- int wgetch(resource);
-- int wgetnstr(resource,string,int);
-- int wgetstr(resource,string);
-- int whline(resource,int,int);
-- int winch(resource);
-- int winchnstr(resource,int *,int);
-- int winchstr(resource,int *);
-- int winnstr(resource,string,int);
-- int winsch(resource,int);
-- int winsdelln(resource,int);
-- int winsertln(resource);
-- int winsnstr(resource,string,int);
-- int winsstr(resource,string);
-- int winstr(resource,string);
-- bool wmouse_trafo(resource win,int* y,int* x,bool to_screen);
-- int wmove(resource,int,int);
-- int wnoutrefresh(resource);
-- int wprintw(resource, string,...);
-- int wredrawln(resource,int,int);
-- int wrefresh(resource);
-- int wresize (resource,int,int);
-- int wscanw(resource,string,...);
-- int wscrl(resource,int);
-- int wsetscrreg(resource,int,int);
-- int wstandend(resource);
-- int wstandout(resource);
-- void wsyncdown(resource);
-- void wsyncup(resource);
-- void wtimeout(resource,int);
-- int wtouchln(resource,int,int,int);
-- int wvline(resource,int,int);
diff --git a/ext/ncurses/config.m4 b/ext/ncurses/config.m4
deleted file mode 100644
index 8111d02f44..0000000000
--- a/ext/ncurses/config.m4
+++ /dev/null
@@ -1,44 +0,0 @@
-dnl $Id$
-dnl config.m4 for extension ncurses
-
-PHP_ARG_WITH(ncurses, for ncurses support,
-[ --with-ncurses Include ncurses support])
-
-if test "$PHP_NCURSES" != "no"; then
- # --with-ncurses -> check with-path
- SEARCH_PATH="/usr/local /usr"
- SEARCH_FOR="/include/curses.h"
- if test -r $PHP_NCURSES/; then # path given as parameter
- NCURSES_DIR=$PHP_NCURSES
- else # search default path list
- AC_MSG_CHECKING(for ncurses files in default path)
- for i in $SEARCH_PATH ; do
- if test -r $i/$SEARCH_FOR; then
- NCURSES_DIR=$i
- AC_MSG_RESULT(found in $i)
- fi
- done
- fi
-
- if test -z "$NCURSES_DIR"; then
- AC_MSG_RESULT(not found)
- AC_MSG_ERROR(Please reinstall the ncurses distribution)
- fi
-
- # --with-ncurses -> add include path
- PHP_ADD_INCLUDE($NCURSES_DIR/include)
-
- # --with-ncurses -> chech for lib and symbol presence
- LIBNAME=ncurses
- LIBSYMBOL=initscr
- old_LIBS=$LIBS
- LIBS="$LIBS -L$NCURSES_DIR/lib -lm -ldl"
- AC_CHECK_LIB($LIBNAME, $LIBSYMBOL, [AC_DEFINE(HAVE_NCURSESLIB,1,[ ])],
- [AC_MSG_ERROR(wrong ncurses lib version or lib not found)])
- LIBS=$old_LIBS
-
- PHP_SUBST(NCURSES_SHARED_LIBADD)
- PHP_ADD_LIBRARY_WITH_PATH($LIBNAME, $NCURSES_DIR/lib, SAPRFC_SHARED_LIBADD)
-
- PHP_EXTENSION(ncurses, $ext_shared)
-fi
diff --git a/ext/ncurses/example1.php b/ext/ncurses/example1.php
deleted file mode 100644
index 0dc689be39..0000000000
--- a/ext/ncurses/example1.php
+++ /dev/null
@@ -1,28 +0,0 @@
-<?php
-$n=0;
-ncurses_init();
-if(ncurses_has_colors()){
-ncurses_start_color();
- ncurses_init_pair(1,NCURSES_COLOR_RED,NCURSES_COLOR_BLACK);
- ncurses_init_pair(2,NCURSES_COLOR_GREEN,NCURSES_COLOR_BLACK);
- ncurses_init_pair(3,NCURSES_COLOR_YELLOW,NCURSES_COLOR_BLACK);
- ncurses_init_pair(4,NCURSES_COLOR_BLUE,NCURSES_COLOR_BLACK);
- ncurses_init_pair(5,NCURSES_COLOR_MAGENTA,NCURSES_COLOR_BLACK);
- ncurses_init_pair(6,NCURSES_COLOR_CYAN,NCURSES_COLOR_BLACK);
- ncurses_init_pair(7,NCURSES_COLOR_WHITE,NCURSES_COLOR_BLACK);
-}
-while(1){
-for ($x=0; $x<80; $x++) {
-for ($y=0; $y<24; $y++) {
- $n++;
- ncurses_move($y,$x);
- ncurses_addch($n+64);
- ncurses_color_set($n%8);
- ncurses_refresh();
- if($n>26)$n=0;
-}
-}
-}
-ncurses_getch();
-?>
-
diff --git a/ext/ncurses/ncurses.c b/ext/ncurses/ncurses.c
deleted file mode 100644
index 6126002398..0000000000
--- a/ext/ncurses/ncurses.c
+++ /dev/null
@@ -1,179 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997, 1998, 1999, 2000, 2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Hartmut Holzgraefe <hartmut@six.de> |
- | |
- +----------------------------------------------------------------------+
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "php_ini.h"
-#include "php_ncurses.h"
-
-/* If you declare any globals in php_ncurses.h uncomment this:
-ZEND_DECLARE_MODULE_GLOBALS(ncurses)
-*/
-
-/* True global resources - no need for thread safety here */
-int le_ncurses;
-
-
-static void ncurses_destruct(zend_rsrc_list_entry *rsrc) {
- WINDOW **pwin = (WINDOW **)rsrc->ptr;
-
- delwin(*pwin);
- efree(pwin);
-}
-
-
-/* {{{ ncurses_module_entry
- */
-zend_module_entry ncurses_module_entry = {
- "ncurses",
- ncurses_functions,
- PHP_MINIT(ncurses),
- PHP_MSHUTDOWN(ncurses),
- PHP_RINIT(ncurses), /* Replace with NULL if there's nothing to do at request start */
- PHP_RSHUTDOWN(ncurses), /* Replace with NULL if there's nothing to do at request end */
- PHP_MINFO(ncurses),
- STANDARD_MODULE_PROPERTIES
-};
-/* }}} */
-
-#ifdef COMPILE_DL_NCURSES
-ZEND_GET_MODULE(ncurses)
-#endif
-
-/* {{{ PHP_INI
- */
-/* Remove comments and fill if you need to have entries in php.ini
-PHP_INI_BEGIN()
- STD_PHP_INI_ENTRY("ncurses.value", "42", PHP_INI_ALL, OnUpdateInt, global_value, zend_ncurses_globals, ncurses_globals)
- STD_PHP_INI_ENTRY("ncurses.string", "foobar", PHP_INI_ALL, OnUpdateString, global_string, zend_ncurses_globals, ncurses_globals)
-PHP_INI_END()
-*/
-/* }}} */
-
-#define PHP_NCURSES_CONST(x) REGISTER_LONG_CONSTANT("NCURSES_"#x, x, CONST_CS | CONST_PERSISTENT)
-
-/* {{{ PHP_MINIT_FUNCTION
- */
-PHP_MINIT_FUNCTION(ncurses)
-{
-/* Remove comments if you have entries in php.ini
- REGISTER_INI_ENTRIES();
-*/
-
- PHP_NCURSES_CONST(COLOR_BLACK);
- PHP_NCURSES_CONST(COLOR_RED);
- PHP_NCURSES_CONST(COLOR_GREEN);
- PHP_NCURSES_CONST(COLOR_YELLOW);
- PHP_NCURSES_CONST(COLOR_BLUE);
- PHP_NCURSES_CONST(COLOR_MAGENTA);
- PHP_NCURSES_CONST(COLOR_CYAN);
- PHP_NCURSES_CONST(COLOR_WHITE);
-
- le_ncurses = zend_register_list_destructors_ex(ncurses_destruct, NULL, "ncurses_hanlde", module_number);
-
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_MSHUTDOWN_FUNCTION
- */
-PHP_MSHUTDOWN_FUNCTION(ncurses)
-{
-/* Remove comments if you have entries in php.ini
- UNREGISTER_INI_ENTRIES();
- endwin();
-*/
-
- return SUCCESS;
-}
-/* }}} */
-
-/* Remove if there's nothing to do at request start */
-/* {{{ PHP_RINIT_FUNCTION
- */
-PHP_RINIT_FUNCTION(ncurses)
-{
- return SUCCESS;
-}
-/* }}} */
-
-/* Remove if there's nothing to do at request end */
-/* {{{ PHP_RSHUTDOWN_FUNCTION
- */
-PHP_RSHUTDOWN_FUNCTION(ncurses)
-{
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_MINFO_FUNCTION
- */
-PHP_MINFO_FUNCTION(ncurses)
-{
- php_info_print_table_start();
- php_info_print_table_header(2, "ncurses support", "enabled");
- php_info_print_table_end();
-
- /* Remove comments if you have entries in php.ini
- DISPLAY_INI_ENTRIES();
- */
-}
-/* }}} */
-
-/* Remove the following function when you have succesfully modified config.m4
- so that your module can be compiled into PHP, it exists only for testing
- purposes. */
-
-/* Every user-visible function in PHP should document itself in the source */
-/* {{{ proto string confirm_ncurses_compiled(string arg)
- Return a string to confirm that the module is compiled in */
-PHP_FUNCTION(confirm_ncurses_compiled)
-{
- zval **arg;
- int len;
- char string[256];
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(arg);
-
- len = sprintf(string, "Congratulations! You have successfully modified ext/%.78s/config.m4. Module %.78s is now compiled into PHP.", "ncurses", Z_STRVAL_PP(arg));
- RETURN_STRINGL(string, len, 1);
-}
-/* }}} */
-/* The previous line is meant for vim and emacs, so it can correctly fold and
- unfold functions in source code. See the corresponding marks just before
- function definition, where the functions purpose is also documented. Please
- follow this convention for the convenience of others editing your code.
-*/
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/ncurses/ncurses.php b/ext/ncurses/ncurses.php
deleted file mode 100644
index 416b1087e7..0000000000
--- a/ext/ncurses/ncurses.php
+++ /dev/null
@@ -1,10 +0,0 @@
-<?
-$module = 'ncurses';
-$function = 'confirm_' . $module . '_compiled';
-if (extension_loaded($module)) {
- $str = $function($module);
-} else {
- $str = "Module $module is not compiled into PHP";
-}
-echo "$str\n";
-?>
diff --git a/ext/ncurses/ncurses_fe.c b/ext/ncurses/ncurses_fe.c
deleted file mode 100644
index a4e3db59fd..0000000000
--- a/ext/ncurses/ncurses_fe.c
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997, 1998, 1999, 2000, 2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Hartmut Holzgraefe <hartmut@six.de> |
- | |
- +----------------------------------------------------------------------+
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "php_ini.h"
-#include "php_ncurses.h"
-
-/* ncurses_functions[]
- *
- * Every user visible function must have an entry in ncurses_functions[].
- */
-function_entry ncurses_functions[] = {
- PHP_FE(confirm_ncurses_compiled, NULL) /* For testing, remove later. */
- PHP_FE(ncurses_init, NULL)
- PHP_FE(ncurses_end, NULL)
- PHP_FE(ncurses_getch, NULL)
- PHP_FE(ncurses_move, NULL)
- PHP_FE(ncurses_addch, NULL)
- PHP_FE(ncurses_refresh, NULL)
- PHP_FE(ncurses_has_colors, NULL)
- PHP_FE(ncurses_start_color, NULL)
- PHP_FE(ncurses_color_set, NULL)
- PHP_FE(ncurses_init_pair, NULL)
- PHP_FE(ncurses_newwin, NULL)
- PHP_FE(ncurses_delwin, NULL)
- PHP_FE(ncurses_standout, NULL)
- PHP_FE(ncurses_standend, NULL)
- PHP_FE(ncurses_baudrate, NULL)
- PHP_FE(ncurses_beep, NULL)
- PHP_FE(ncurses_can_change_color, NULL)
- PHP_FE(ncurses_cbreak, NULL)
- PHP_FE(ncurses_clear, NULL)
- PHP_FE(ncurses_clrtobot, NULL)
- PHP_FE(ncurses_clrtoeol, NULL)
- PHP_FE(ncurses_def_prog_mode, NULL)
- PHP_FE(ncurses_def_shell_mode, NULL)
- PHP_FE(ncurses_delch, NULL)
- PHP_FE(ncurses_deleteln, NULL)
- PHP_FE(ncurses_doupdate, NULL)
- PHP_FE(ncurses_echo, NULL)
- PHP_FE(ncurses_echochar, NULL)
- PHP_FE(ncurses_erase, NULL)
- PHP_FE(ncurses_erasechar, NULL)
- PHP_FE(ncurses_flash, NULL)
- PHP_FE(ncurses_flushinp, NULL)
- PHP_FE(ncurses_has_ic, NULL)
- PHP_FE(ncurses_has_il, NULL)
- PHP_FE(ncurses_inch, NULL)
- PHP_FE(ncurses_insertln, NULL)
- PHP_FE(ncurses_isendwin, NULL)
- PHP_FE(ncurses_killchar, NULL)
- PHP_FE(ncurses_nl, NULL)
- PHP_FE(ncurses_nocbreak, NULL)
- PHP_FE(ncurses_noecho, NULL)
- PHP_FE(ncurses_nonl, NULL)
- PHP_FE(ncurses_noraw, NULL)
- PHP_FE(ncurses_raw, NULL)
- PHP_FE(ncurses_resetty, NULL)
- PHP_FE(ncurses_savetty, NULL)
- PHP_FE(ncurses_termattrs, NULL)
- PHP_FE(ncurses_use_default_colors, NULL)
- PHP_FE(ncurses_slk_attr, NULL)
- PHP_FE(ncurses_slk_clear, NULL)
- PHP_FE(ncurses_slk_noutrefresh, NULL)
- PHP_FE(ncurses_slk_refresh, NULL)
- PHP_FE(ncurses_slk_restore, NULL)
- PHP_FE(ncurses_slk_touch, NULL)
- PHP_FE(ncurses_attroff, NULL)
- PHP_FE(ncurses_attron, NULL)
- PHP_FE(ncurses_attrset, NULL)
- PHP_FE(ncurses_bkgd, NULL)
- PHP_FE(ncurses_curs_set, NULL)
- PHP_FE(ncurses_delay_output, NULL)
- PHP_FE(ncurses_echochar, NULL)
- PHP_FE(ncurses_halfdelay, NULL)
- PHP_FE(ncurses_has_key, NULL)
- PHP_FE(ncurses_insch, NULL)
- PHP_FE(ncurses_insdelln, NULL)
- PHP_FE(ncurses_mouseinterval, NULL)
- PHP_FE(ncurses_napms, NULL)
- PHP_FE(ncurses_scrl, NULL)
- PHP_FE(ncurses_slk_attroff, NULL)
- PHP_FE(ncurses_slk_attron, NULL)
- PHP_FE(ncurses_slk_attrset, NULL)
- PHP_FE(ncurses_slk_color, NULL)
- PHP_FE(ncurses_slk_init, NULL)
- PHP_FE(ncurses_typeahead, NULL)
- PHP_FE(ncurses_ungetch, NULL)
- PHP_FE(ncurses_vidattr, NULL)
- PHP_FE(ncurses_use_extended_names, NULL)
- PHP_FE(ncurses_bkgdset, NULL)
- PHP_FE(ncurses_filter, NULL)
- PHP_FE(ncurses_noqiflush, NULL)
- PHP_FE(ncurses_qiflush, NULL)
- PHP_FE(ncurses_timeout, NULL)
- PHP_FE(ncurses_use_env, NULL)
- {NULL, NULL, NULL} /* Must be the last line in ncurses_functions[] */
-};
diff --git a/ext/ncurses/ncurses_functions.c b/ext/ncurses/ncurses_functions.c
deleted file mode 100644
index dca635a74b..0000000000
--- a/ext/ncurses/ncurses_functions.c
+++ /dev/null
@@ -1,928 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997, 1998, 1999, 2000, 2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Hartmut Holzgraefe <hartmut@six.de> |
- | |
- +----------------------------------------------------------------------+
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "php_ini.h"
-#include "php_ncurses.h"
-
-/* {{{ proto int ncurses_addch(int ch)
- */
-PHP_FUNCTION(ncurses_addch)
-{
- zval **ch;
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &ch) == FAILURE){
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(ch);
-
- RETURN_LONG(addch(_INT(ch)));
-}
-/* }}} */
-
-/* {{{ proto int ncurses_color_set(int pair)
- */
-PHP_FUNCTION(ncurses_color_set)
-{
- zval **pair;
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &pair) == FAILURE){
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(pair);
-
- RETURN_LONG(color_set(_INT(pair),NULL));
-}
-/* }}} */
-
-/* {{{ proto int ncurses_newwin(int ch)
- */
-PHP_FUNCTION(ncurses_delwin)
-{
- zval **handle;
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &handle) == FAILURE){
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(handle);
-
- /* TODO resource type check */
-
- zend_list_delete((*handle)->value.lval);
-}
-/* }}} */
-
-/* {{{ proto int ncurses_end()
- */
-PHP_FUNCTION(ncurses_end)
-{
- RETURN_LONG(endwin()); /* endialize the curses library */
-}
-/* }}} */
-
-/* {{{ proto int ncurses_getch()
- */
-PHP_FUNCTION(ncurses_getch)
-{
- RETURN_LONG(getch());
-}
-/* }}} */
-
-/* {{{ proto int ncurses_has_colors()
- */
-PHP_FUNCTION(ncurses_has_colors)
-{
- RETURN_LONG(has_colors());
-}
-/* }}} */
-
-/* {{{ proto int ncurses_init()
- */
-PHP_FUNCTION(ncurses_init)
-{
- initscr(); /* initialize the curses library */
- keypad(stdscr, TRUE); /* enable keyboard mapping */
- (void) nonl(); /* tell curses not to do NL->CR/NL on output */
- (void) cbreak(); /* take input chars one at a time, no wait for \n */}
-/* }}} */
-
-/* {{{ proto int ncurses_init_pair(int pair, int fg, int bg)
- */
-PHP_FUNCTION(ncurses_init_pair)
-{
- zval **pair, **fg, **bg;
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &pair, &fg, &bg) == FAILURE){
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(pair);
- convert_to_long_ex(fg);
- convert_to_long_ex(bg);
-
- RETURN_LONG(init_pair(_INT(pair),_INT(fg),_INT(bg)));
-}
-/* }}} */
-
-/* {{{ proto int ncurses_move(int x, int y)
- */
-PHP_FUNCTION(ncurses_move)
-{
- zval **x, **y;
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &x, &y) == FAILURE){
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(x);
- convert_to_long_ex(y);
-
- RETURN_LONG(move(_INT(x),_INT(y)));
-}
-/* }}} */
-
-/* {{{ proto int ncurses_newwin(int ch)
- */
-PHP_FUNCTION(ncurses_newwin)
-{
- zval **rows,**cols,**y,**x;
- WINDOW **pwin = (WINDOW **)emalloc(sizeof(WINDOW *));
-
- if (ZEND_NUM_ARGS() != 4 || zend_get_parameters_ex(4, &rows,&cols,&y,&x) == FAILURE){
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(rows);
- convert_to_long_ex(cols);
- convert_to_long_ex(y);
- convert_to_long_ex(x);
-
- *pwin=newwin(_INT(rows),_INT(cols),_INT(y),_INT(x));
-
- if(!*pwin) {
- efree(pwin);
- RETURN_FALSE;
- }
-
- ZEND_REGISTER_RESOURCE(return_value, pwin, le_ncurses);
-}
-/* }}} */
-
-/* {{{ proto int ncurses_refresh(int ch)
- */
-PHP_FUNCTION(ncurses_refresh)
-{
- RETURN_LONG(refresh());
-}
-/* }}} */
-
-/* {{{ proto int ncurses_start_color()
- */
-PHP_FUNCTION(ncurses_start_color)
-{
- RETURN_LONG(start_color());
-}
-/* }}} */
-
-/* ----- */
-
-/* {{{ proto int ncurses_standout()
- */
-PHP_FUNCTION(ncurses_standout)
-{
- RETURN_LONG(standout());
-}
-/* }}} */
-
-/* {{{ proto int ncurses_standend()
- */
-PHP_FUNCTION(ncurses_standend)
-{
- RETURN_LONG(standend());
-}
-/* }}} */
-
-/* {{{ proto int ncurses_baudrate()
- */
-PHP_FUNCTION(ncurses_baudrate)
-{
- RETURN_LONG(baudrate());
-}
-/* }}} */
-
-/* {{{ proto int ncurses_beep()
- */
-PHP_FUNCTION(ncurses_beep)
-{
- RETURN_LONG(beep());
-}
-/* }}} */
-
-/* {{{ proto bool ncurses_can_change_color()
- */
-PHP_FUNCTION(ncurses_can_change_color)
-{
- RETURN_LONG(can_change_color());
-}
-/* }}} */
-
-/* {{{ proto bool ncurses_cbreak()
- */
-PHP_FUNCTION(ncurses_cbreak)
-{
- RETURN_LONG(cbreak());
-}
-/* }}} */
-
-/* {{{ proto bool ncurses_clear()
- */
-PHP_FUNCTION(ncurses_clear)
-{
- RETURN_LONG(clear());
-}
-/* }}} */
-
-/* {{{ proto bool ncurses_clrtobot()
- */
-PHP_FUNCTION(ncurses_clrtobot)
-{
- RETURN_LONG(clrtobot());
-}
-/* }}} */
-
-/* {{{ proto bool ncurses_clrtoeol()
- */
-PHP_FUNCTION(ncurses_clrtoeol)
-{
- RETURN_LONG(clrtoeol());
-}
-/* }}} */
-
-/* {{{ proto bool ncurses_def_prog_mode()
- */
-PHP_FUNCTION(ncurses_def_prog_mode)
-{
- RETURN_LONG(def_prog_mode());
-}
-/* }}} */
-
-/* {{{ proto bool ncurses_def_shell_mode()
- */
-PHP_FUNCTION(ncurses_def_shell_mode)
-{
- RETURN_LONG(def_shell_mode());
-}
-/* }}} */
-
-/* {{{ proto bool ncurses_delch()
- */
-PHP_FUNCTION(ncurses_delch)
-{
- RETURN_LONG(delch());
-}
-/* }}} */
-
-/* {{{ proto bool ncurses_deleteln()
- */
-PHP_FUNCTION(ncurses_deleteln)
-{
- RETURN_LONG(deleteln());
-}
-/* }}} */
-
-/* {{{ proto bool ncurses_doupdate()
- */
-PHP_FUNCTION(ncurses_doupdate)
-{
- RETURN_LONG(doupdate());
-}
-/* }}} */
-
-/* {{{ proto bool ncurses_echo()
- */
-PHP_FUNCTION(ncurses_echo)
-{
- RETURN_LONG(echo());
-}
-/* }}} */
-
-/* {{{ proto bool ncurses_erase()
- */
-PHP_FUNCTION(ncurses_erase)
-{
- RETURN_LONG(erase());
-}
-/* }}} */
-
-/* {{{ proto bool ncurses_erasechar()
- */
-PHP_FUNCTION(ncurses_erasechar)
-{
- RETURN_LONG(erasechar());
-}
-/* }}} */
-
-/* {{{ proto bool ncurses_flash()
- */
-PHP_FUNCTION(ncurses_flash)
-{
- RETURN_LONG(flash());
-}
-/* }}} */
-
-/* {{{ proto bool ncurses_flushinp()
- */
-PHP_FUNCTION(ncurses_flushinp)
-{
- RETURN_LONG(flushinp());
-}
-/* }}} */
-
-/* {{{ proto bool ncurses_has_ic()
- */
-PHP_FUNCTION(ncurses_has_ic)
-{
- RETURN_LONG(has_ic());
-}
-/* }}} */
-
-
-/* {{{ proto bool ncurses_has_il()
- */
-PHP_FUNCTION(ncurses_has_il)
-{
- RETURN_LONG(has_il());
-}
-/* }}} */
-
-/* {{{ proto bool ncurses_inch()
- */
-PHP_FUNCTION(ncurses_inch)
-{
- RETURN_LONG(inch());
-}
-/* }}} */
-
-/* {{{ proto bool ncurses_insertln()
- */
-PHP_FUNCTION(ncurses_insertln)
-{
- RETURN_LONG(insertln());
-}
-/* }}} */
-
-/* {{{ proto bool ncurses_isendwin()
- */
-PHP_FUNCTION(ncurses_isendwin)
-{
- RETURN_LONG(isendwin());
-}
-/* }}} */
-
-/* {{{ proto bool ncurses_killchar()
- */
-PHP_FUNCTION(ncurses_killchar)
-{
- RETURN_LONG(killchar());
-}
-/* }}} */
-
-/* {{{ proto bool ncurses_nl()
- */
-PHP_FUNCTION(ncurses_nl)
-{
- RETURN_LONG(nl());
-}
-/* }}} */
-
-/* {{{ proto bool ncurses_nocbreak()
- */
-PHP_FUNCTION(ncurses_nocbreak)
-{
- RETURN_LONG(nocbreak());
-}
-/* }}} */
-
-/* {{{ proto bool ncurses_noecho()
- */
-PHP_FUNCTION(ncurses_noecho)
-{
- RETURN_LONG(noecho());
-}
-/* }}} */
-
-/* {{{ proto bool ncurses_nonl()
- */
-PHP_FUNCTION(ncurses_nonl)
-{
- RETURN_LONG(nonl());
-}
-/* }}} */
-
-/* {{{ proto bool ncurses_noraw()
- */
-PHP_FUNCTION(ncurses_noraw)
-{
- RETURN_LONG(noraw());
-}
-/* }}} */
-
-/* {{{ proto bool ncurses_raw()
- */
-PHP_FUNCTION(ncurses_raw)
-{
- RETURN_LONG(raw());
-}
-/* }}} */
-
-/* {{{ proto bool ncurses_resetty()
- */
-PHP_FUNCTION(ncurses_resetty)
-{
- RETURN_LONG(resetty());
-}
-/* }}} */
-
-/* {{{ proto bool ncurses_savetty()
- */
-PHP_FUNCTION(ncurses_savetty)
-{
- RETURN_LONG(savetty());
-}
-/* }}} */
-
-/* {{{ proto bool ncurses_termattrs()
- */
-PHP_FUNCTION(ncurses_termattrs)
-{
- RETURN_LONG(termattrs());
-}
-/* }}} */
-
-/* {{{ proto bool ncurses_use_default_colors()
- */
-PHP_FUNCTION(ncurses_use_default_colors)
-{
- RETURN_LONG(use_default_colors());
-}
-/* }}} */
-
-/* {{{ proto bool ncurses_slk_attr()
- */
-PHP_FUNCTION(ncurses_slk_attr)
-{
- RETURN_LONG(slk_attr());
-}
-/* }}} */
-
-/* {{{ proto bool ncurses_slk_clear()
- */
-PHP_FUNCTION(ncurses_slk_clear)
-{
- RETURN_LONG(slk_clear());
-}
-/* }}} */
-
-/* {{{ proto bool ncurses_slk_noutrefresh()
- */
-PHP_FUNCTION(ncurses_slk_noutrefresh)
-{
- RETURN_LONG(slk_noutrefresh());
-}
-/* }}} */
-
-/* {{{ proto bool ncurses_slk_refresh()
- */
-PHP_FUNCTION(ncurses_slk_refresh)
-{
- RETURN_LONG(slk_refresh());
-}
-/* }}} */
-
-/* {{{ proto bool ncurses_slk_restore()
- */
-PHP_FUNCTION(ncurses_slk_restore)
-{
- RETURN_LONG(slk_restore());
-}
-/* }}} */
-
-/* {{{ proto bool ncurses_slk_touch()
- */
-PHP_FUNCTION(ncurses_slk_touch)
-{
- RETURN_LONG(slk_touch());
-}
-/* }}} */
-
-/* {{{ proto int ncurses_attroff(int intarg)
- */
-PHP_FUNCTION(ncurses_attroff)
-{
- zval **intarg;
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &intarg) == FAILURE){
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(intarg);
-
- RETURN_LONG(attroff(_INT(intarg)));
-}
-/* }}} */
-
-/* {{{ proto int ncurses_attron(int intarg)
- */
-PHP_FUNCTION(ncurses_attron)
-{
- zval **intarg;
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &intarg) == FAILURE){
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(intarg);
-
- RETURN_LONG(attron(_INT(intarg)));
-}
-/* }}} */
-
-/* {{{ proto int ncurses_attrset(int intarg)
- */
-PHP_FUNCTION(ncurses_attrset)
-{
- zval **intarg;
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &intarg) == FAILURE){
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(intarg);
-
- RETURN_LONG(attrset(_INT(intarg)));
-}
-/* }}} */
-
-/* {{{ proto int ncurses_bkgd(int intarg)
- */
-PHP_FUNCTION(ncurses_bkgd)
-{
- zval **intarg;
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &intarg) == FAILURE){
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(intarg);
-
- RETURN_LONG(bkgd(_INT(intarg)));
-}
-/* }}} */
-
-/* {{{ proto int ncurses_curs_set(int intarg)
- */
-PHP_FUNCTION(ncurses_curs_set)
-{
- zval **intarg;
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &intarg) == FAILURE){
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(intarg);
-
- RETURN_LONG(curs_set(_INT(intarg)));
-}
-/* }}} */
-
-/* {{{ proto int ncurses_delay_output(int intarg)
- */
-PHP_FUNCTION(ncurses_delay_output)
-{
- zval **intarg;
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &intarg) == FAILURE){
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(intarg);
-
- RETURN_LONG(delay_output(_INT(intarg)));
-}
-/* }}} */
-
-/* {{{ proto int ncurses_echochar(int intarg)
- */
-PHP_FUNCTION(ncurses_echochar)
-{
- zval **intarg;
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &intarg) == FAILURE){
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(intarg);
-
- RETURN_LONG(echochar(_INT(intarg)));
-}
-/* }}} */
-
-/* {{{ proto int ncurses_halfdelay(int intarg)
- */
-PHP_FUNCTION(ncurses_halfdelay)
-{
- zval **intarg;
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &intarg) == FAILURE){
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(intarg);
-
- RETURN_LONG(halfdelay(_INT(intarg)));
-}
-/* }}} */
-
-/* {{{ proto int ncurses_has_key(int intarg)
- */
-PHP_FUNCTION(ncurses_has_key)
-{
- zval **intarg;
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &intarg) == FAILURE){
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(intarg);
-
- RETURN_LONG(has_key(_INT(intarg)));
-}
-/* }}} */
-
-/* {{{ proto int ncurses_insch(int intarg)
- */
-PHP_FUNCTION(ncurses_insch)
-{
- zval **intarg;
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &intarg) == FAILURE){
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(intarg);
-
- RETURN_LONG(insch(_INT(intarg)));
-}
-/* }}} */
-
-/* {{{ proto int ncurses_insdelln(int intarg)
- */
-PHP_FUNCTION(ncurses_insdelln)
-{
- zval **intarg;
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &intarg) == FAILURE){
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(intarg);
-
- RETURN_LONG(insdelln(_INT(intarg)));
-}
-/* }}} */
-
-/* {{{ proto int ncurses_mouseinterval(int intarg)
- */
-PHP_FUNCTION(ncurses_mouseinterval)
-{
- zval **intarg;
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &intarg) == FAILURE){
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(intarg);
-
- RETURN_LONG(mouseinterval(_INT(intarg)));
-}
-/* }}} */
-
-/* {{{ proto int ncurses_napms(int intarg)
- */
-PHP_FUNCTION(ncurses_napms)
-{
- zval **intarg;
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &intarg) == FAILURE){
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(intarg);
-
- RETURN_LONG(napms(_INT(intarg)));
-}
-/* }}} */
-
-/* {{{ proto int ncurses_scrl(int intarg)
- */
-PHP_FUNCTION(ncurses_scrl)
-{
- zval **intarg;
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &intarg) == FAILURE){
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(intarg);
-
- RETURN_LONG(scrl(_INT(intarg)));
-}
-/* }}} */
-
-/* {{{ proto int ncurses_slk_attroff(int intarg)
- */
-PHP_FUNCTION(ncurses_slk_attroff)
-{
- zval **intarg;
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &intarg) == FAILURE){
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(intarg);
-
- RETURN_LONG(slk_attroff(_INT(intarg)));
-}
-/* }}} */
-
-/* {{{ proto int ncurses_slk_attron(int intarg)
- */
-PHP_FUNCTION(ncurses_slk_attron)
-{
- zval **intarg;
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &intarg) == FAILURE){
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(intarg);
-
- RETURN_LONG(slk_attron(_INT(intarg)));
-}
-/* }}} */
-
-/* {{{ proto int ncurses_slk_attrset(int intarg)
- */
-PHP_FUNCTION(ncurses_slk_attrset)
-{
- zval **intarg;
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &intarg) == FAILURE){
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(intarg);
-
- RETURN_LONG(slk_attrset(_INT(intarg)));
-}
-/* }}} */
-
-/* {{{ proto int ncurses_slk_color(int intarg)
- */
-PHP_FUNCTION(ncurses_slk_color)
-{
- zval **intarg;
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &intarg) == FAILURE){
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(intarg);
-
- RETURN_LONG(slk_color(_INT(intarg)));
-}
-/* }}} */
-
-/* {{{ proto int ncurses_slk_init(int intarg)
- */
-PHP_FUNCTION(ncurses_slk_init)
-{
- zval **intarg;
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &intarg) == FAILURE){
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(intarg);
-
- RETURN_LONG(slk_init(_INT(intarg)));
-}
-/* }}} */
-
-/* {{{ proto int ncurses_typeahead(int intarg)
- */
-PHP_FUNCTION(ncurses_typeahead)
-{
- zval **intarg;
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &intarg) == FAILURE){
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(intarg);
-
- RETURN_LONG(typeahead(_INT(intarg)));
-}
-/* }}} */
-
-/* {{{ proto int ncurses_ungetch(int intarg)
- */
-PHP_FUNCTION(ncurses_ungetch)
-{
- zval **intarg;
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &intarg) == FAILURE){
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(intarg);
-
- RETURN_LONG(ungetch(_INT(intarg)));
-}
-/* }}} */
-
-/* {{{ proto int ncurses_vidattr(int intarg)
- */
-PHP_FUNCTION(ncurses_vidattr)
-{
- zval **intarg;
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &intarg) == FAILURE){
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(intarg);
-
- RETURN_LONG(vidattr(_INT(intarg)));
-}
-/* }}} */
-
-/* {{{ proto int ncurses_use_extended_names(int intarg)
- */
-PHP_FUNCTION(ncurses_use_extended_names)
-{
- zval **intarg;
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &intarg) == FAILURE){
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(intarg);
-
- RETURN_LONG(use_extended_names(_INT(intarg)));
-}
-/* }}} */
-
-/* {{{ proto int ncurses_bkgdset(int intarg)
- */
-PHP_FUNCTION(ncurses_bkgdset)
-{
- zval **intarg;
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &intarg) == FAILURE){
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(intarg);
-
- bkgdset(_INT(intarg));
-}
-/* }}} */
-
-/* {{{ proto int ncurses_filter()
- */
-PHP_FUNCTION(ncurses_filter)
-{
- filter();
-}
-/* }}} */
-
-/* {{{ proto int ncurses_noqiflush()
- */
-PHP_FUNCTION(ncurses_noqiflush)
-{
- noqiflush();
-}
-/* }}} */
-
-/* {{{ proto int ncurses_qiflush()
- */
-PHP_FUNCTION(ncurses_qiflush)
-{
- qiflush();
-}
-/* }}} */
-
-/* {{{ proto int ncurses_timeout(int intarg)
- */
-PHP_FUNCTION(ncurses_timeout)
-{
- zval **intarg;
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &intarg) == FAILURE){
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(intarg);
-
- timeout(_INT(intarg));
-}
-/* }}} */
-
-/* {{{ proto int ncurses_use_env(int intarg)
- */
-PHP_FUNCTION(ncurses_use_env)
-{
- zval **intarg;
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &intarg) == FAILURE){
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(intarg);
-
- use_env(_INT(intarg));
-}
-/* }}} */
diff --git a/ext/ncurses/php_ncurses.h b/ext/ncurses/php_ncurses.h
deleted file mode 100644
index 84cac5a7e8..0000000000
--- a/ext/ncurses/php_ncurses.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997, 1998, 1999, 2000, 2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Hartmut Holzgraefe <hartmut@six.de> |
- | |
- +----------------------------------------------------------------------+
- */
-
-#ifndef PHP_NCURSES_H
-#define PHP_NCURSES_H
-
-#include <curses.h>
-
-#define _STRING(x) ((*x)->value.str.val)
-#define _INT(x) ((*x)->value.lval)
-#define _HASH(x) ((*x)->value.ht)
-
-extern int le_ncurses;
-
-extern zend_module_entry ncurses_module_entry;
-#define phpext_ncurses_ptr &ncurses_module_entry
-
-extern function_entry ncurses_functions[];
-#include "php_ncurses_fe.h"
-
-#ifdef PHP_WIN32
-#define PHP_NCURSES_API __declspec(dllexport)
-#else
-#define PHP_NCURSES_API
-#endif
-
-PHP_MINIT_FUNCTION(ncurses);
-PHP_MSHUTDOWN_FUNCTION(ncurses);
-PHP_RINIT_FUNCTION(ncurses);
-PHP_RSHUTDOWN_FUNCTION(ncurses);
-PHP_MINFO_FUNCTION(ncurses);
-
-/*
- Declare any global variables you may need between the BEGIN
- and END macros here:
-
-ZEND_BEGIN_MODULE_GLOBALS(ncurses)
- int global_value;
- char *global_string;
-ZEND_END_MODULE_GLOBALS(ncurses)
-*/
-
-/* In every function that needs to use variables in php_ncurses_globals,
- do call NCURSES_LS_FETCH(); after declaring other variables used by
- that function, and always refer to them as NCURSES_G(variable).
- You are encouraged to rename these macros something shorter, see
- examples in any other php module directory.
-*/
-
-#ifdef ZTS
-#define NCURSES_G(v) (ncurses_globals->v)
-#define NCURSES_LS_FETCH() zend_ncurses_globals *ncurses_globals = ts_resource(ncurses_globals_id)
-#else
-#define NCURSES_G(v) (ncurses_globals.v)
-#define NCURSES_LS_FETCH()
-#endif
-
-#endif /* PHP_NCURSES_H */
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * indent-tabs-mode: t
- * End:
- */
diff --git a/ext/ncurses/php_ncurses_fe.h b/ext/ncurses/php_ncurses_fe.h
deleted file mode 100644
index 1719576dbf..0000000000
--- a/ext/ncurses/php_ncurses_fe.h
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997, 1998, 1999, 2000, 2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Hartmut Holzgraefe <hartmut@six.de> |
- | |
- +----------------------------------------------------------------------+
- */
-
-#ifndef PHP_NCURSES_FE_H
-#define PHP_NCURSES_FE_H
-
-PHP_FUNCTION(confirm_ncurses_compiled); /* For testing, remove later. */
-PHP_FUNCTION(ncurses_init);
-PHP_FUNCTION(ncurses_end);
-PHP_FUNCTION(ncurses_getch);
-PHP_FUNCTION(ncurses_move);
-PHP_FUNCTION(ncurses_addch);
-PHP_FUNCTION(ncurses_refresh);
-PHP_FUNCTION(ncurses_has_colors);
-PHP_FUNCTION(ncurses_start_color);
-PHP_FUNCTION(ncurses_color_set);
-PHP_FUNCTION(ncurses_init_pair);
-PHP_FUNCTION(ncurses_newwin);
-PHP_FUNCTION(ncurses_delwin);
-PHP_FUNCTION(ncurses_standout);
-PHP_FUNCTION(ncurses_standend);
-PHP_FUNCTION(ncurses_baudrate);
-PHP_FUNCTION(ncurses_beep);
-PHP_FUNCTION(ncurses_can_change_color);
-PHP_FUNCTION(ncurses_cbreak);
-PHP_FUNCTION(ncurses_clear);
-PHP_FUNCTION(ncurses_clrtobot);
-PHP_FUNCTION(ncurses_clrtoeol);
-PHP_FUNCTION(ncurses_def_prog_mode);
-PHP_FUNCTION(ncurses_def_shell_mode);
-PHP_FUNCTION(ncurses_delch);
-PHP_FUNCTION(ncurses_deleteln);
-PHP_FUNCTION(ncurses_doupdate);
-PHP_FUNCTION(ncurses_echo);
-PHP_FUNCTION(ncurses_echochar);
-PHP_FUNCTION(ncurses_erase);
-PHP_FUNCTION(ncurses_erasechar);
-PHP_FUNCTION(ncurses_flash);
-PHP_FUNCTION(ncurses_flushinp);
-PHP_FUNCTION(ncurses_has_ic);
-PHP_FUNCTION(ncurses_has_il);
-PHP_FUNCTION(ncurses_inch);
-PHP_FUNCTION(ncurses_insertln);
-PHP_FUNCTION(ncurses_isendwin);
-PHP_FUNCTION(ncurses_killchar);
-PHP_FUNCTION(ncurses_nl);
-PHP_FUNCTION(ncurses_nocbreak);
-PHP_FUNCTION(ncurses_noecho);
-PHP_FUNCTION(ncurses_nonl);
-PHP_FUNCTION(ncurses_noraw);
-PHP_FUNCTION(ncurses_raw);
-PHP_FUNCTION(ncurses_resetty);
-PHP_FUNCTION(ncurses_savetty);
-PHP_FUNCTION(ncurses_termattrs);
-PHP_FUNCTION(ncurses_use_default_colors);
-PHP_FUNCTION(ncurses_slk_attr);
-PHP_FUNCTION(ncurses_slk_clear);
-PHP_FUNCTION(ncurses_slk_noutrefresh);
-PHP_FUNCTION(ncurses_slk_refresh);
-PHP_FUNCTION(ncurses_slk_restore);
-PHP_FUNCTION(ncurses_slk_touch);
-PHP_FUNCTION(ncurses_attroff);
-PHP_FUNCTION(ncurses_attron);
-PHP_FUNCTION(ncurses_attrset);
-PHP_FUNCTION(ncurses_bkgd);
-PHP_FUNCTION(ncurses_curs_set);
-PHP_FUNCTION(ncurses_delay_output);
-PHP_FUNCTION(ncurses_echochar);
-PHP_FUNCTION(ncurses_halfdelay);
-PHP_FUNCTION(ncurses_has_key);
-PHP_FUNCTION(ncurses_insch);
-PHP_FUNCTION(ncurses_insdelln);
-PHP_FUNCTION(ncurses_mouseinterval);
-PHP_FUNCTION(ncurses_napms);
-PHP_FUNCTION(ncurses_scrl);
-PHP_FUNCTION(ncurses_slk_attroff);
-PHP_FUNCTION(ncurses_slk_attron);
-PHP_FUNCTION(ncurses_slk_attrset);
-PHP_FUNCTION(ncurses_slk_color);
-PHP_FUNCTION(ncurses_slk_init);
-PHP_FUNCTION(ncurses_typeahead);
-PHP_FUNCTION(ncurses_ungetch);
-PHP_FUNCTION(ncurses_vidattr);
-PHP_FUNCTION(ncurses_use_extended_names);
-PHP_FUNCTION(ncurses_bkgdset);
-PHP_FUNCTION(ncurses_filter);
-PHP_FUNCTION(ncurses_noqiflush);
-PHP_FUNCTION(ncurses_qiflush);
-PHP_FUNCTION(ncurses_timeout);
-PHP_FUNCTION(ncurses_use_env);
-#endif
diff --git a/ext/ncurses/tests/001.phpt b/ext/ncurses/tests/001.phpt
deleted file mode 100644
index 90d9c1452f..0000000000
--- a/ext/ncurses/tests/001.phpt
+++ /dev/null
@@ -1,23 +0,0 @@
---TEST--
-Check for ncurses presence
---SKIPIF--
-<?php if (!extension_loaded("ncurses")) print "skip"; ?>
---POST--
---GET--
---FILE--
-<?php
-echo "ncurses extension is available";
-/*
- you can add regression tests for your extension here
-
- the output of your test code has to be equal to the
- text in the --EXPECT-- section below for the tests
- to pass, differences between the output and the
- expected text are interpreted as failure
-
- see php4/tests/README for further information on
- writing regression tests
-*/
-?>
---EXPECT--
-ncurses extension is available \ No newline at end of file
diff --git a/ext/notes/notes.dsp b/ext/notes/notes.dsp
deleted file mode 100644
index 20a51d81ca..0000000000
--- a/ext/notes/notes.dsp
+++ /dev/null
@@ -1,202 +0,0 @@
-# Microsoft Developer Studio Project File - Name="notes" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=notes - Win32 Debug_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "notes.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "notes.mak" CFG="notes - Win32 Debug_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "notes - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "notes - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "notes - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "notes - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "notes - Win32 Release_TS_inline" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "notes - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MYSQL_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\..\MySQL\include" /I "..\..\TSRM" /D "NDEBUG" /D "MYSQL_EXPORTS" /D "COMPILE_DL_NOTES" /D HAVE_NOTES=1 /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZEND_WIN32" /D "PHP_WIN32" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "NDEBUG"
-# ADD RSC /l 0x40d /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libmySQL.lib php4nts.lib /nologo /dll /machine:I386 /out:"Release/php_notes.dll" /libpath:"..\..\..\MySQL\lib\opt" /libpath:"..\..\Release"
-
-!ELSEIF "$(CFG)" == "notes - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MYSQL_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\..\MySQL\include" /I "..\..\TSRM" /D "_DEBUG" /D ZEND_DEBUG=1 /D "MYSQL_EXPORTS" /D "COMPILE_DL_NOTES" /D HAVE_NOTES=1 /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZEND_WIN32" /D "PHP_WIN32" /FR /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "_DEBUG"
-# ADD RSC /l 0x40d /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libmySQL.lib php4nts.lib /nologo /dll /debug /machine:I386 /out:"Debug/php_notes.dll" /pdbtype:sept /libpath:"..\..\..\MySQL\lib\Debug" /libpath:"..\..\Debug"
-
-!ELSEIF "$(CFG)" == "notes - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\..\Zend" /I "..\..\..\bindlib_w32" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MYSQL_EXPORTS" /D "COMPILE_DL" /D HAVE_NOTES=1 /FR /YX /FD /GZ /c
-# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\..\MySQL\include" /I "..\..\TSRM" /D "_DEBUG" /D ZEND_DEBUG=1 /D "ZTS" /D "MYSQL_EXPORTS" /D "COMPILE_DL_NOTES" /D HAVE_NOTES=1 /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZEND_WIN32" /D "PHP_WIN32" /FR /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "_DEBUG"
-# ADD RSC /l 0x40d /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libmySQL.lib php4ts.lib /nologo /dll /debug /machine:I386 /out:"Debug_TS/php_notes.dll" /pdbtype:sept /libpath:"..\..\..\MySQL\lib\Debug" /libpath:"..\..\Debug_TS"
-
-!ELSEIF "$(CFG)" == "notes - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\..\TSRM" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MSSQL_EXPORTS" /D "COMPILE_DL_MSSQL" /D "DBNTWIN32" /D ZTS=1 /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D ZEND_DEBUG=0 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MSSQL_EXPORTS" /D "COMPILE_DL_NOTES" /D "DBNTWIN32" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_NOTES=1 /D "NT" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "NDEBUG"
-# ADD RSC /l 0x40d /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib notes.lib /nologo /dll /machine:I386 /out:"Release_TS/php_notes.dll" /libpath:"..\..\Release_TS"
-# SUBTRACT LINK32 /pdb:none
-
-!ELSEIF "$(CFG)" == "notes - Win32 Release_TS_inline"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "notes___Win32_Release_TS_inline"
-# PROP BASE Intermediate_Dir "notes___Win32_Release_TS_inline"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS_inline"
-# PROP Intermediate_Dir "Release_TS_inline"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\..\MySQL\include" /I "..\..\TSRM" /D "NDEBUG" /D "ZTS" /D "MYSQL_EXPORTS" /D "COMPILE_DL_NOTES" /D HAVE_NOTES=1 /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZEND_WIN32" /D "PHP_WIN32" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\..\MySQL\include" /I "..\..\TSRM" /D "NDEBUG" /D "ZTS" /D "MYSQL_EXPORTS" /D "COMPILE_DL_NOTES" /D HAVE_NOTES=1 /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZEND_WIN32" /D "PHP_WIN32" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "NDEBUG"
-# ADD RSC /l 0x40d /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libmySQL.lib php4ts.lib /nologo /dll /machine:I386 /out:"Release_TS/php_notes.dll" /libpath:"..\..\..\MySQL\lib\opt" /libpath:"..\..\Release_TS"
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libmySQL.lib php4ts.lib /nologo /dll /machine:I386 /out:"Release_TS_inline/php_notes.dll" /libpath:"..\..\..\MySQL\lib\opt" /libpath:"..\..\Release_TS_inline"
-
-!ENDIF
-
-# Begin Target
-
-# Name "notes - Win32 Release"
-# Name "notes - Win32 Debug"
-# Name "notes - Win32 Debug_TS"
-# Name "notes - Win32 Release_TS"
-# Name "notes - Win32 Release_TS_inline"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\php_notes.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_notes.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# Begin Source File
-
-SOURCE=.\Readme_w32.txt
-# End Source File
-# End Target
-# End Project
diff --git a/ext/notes/notes.dsw b/ext/notes/notes.dsw
deleted file mode 100644
index 372850224a..0000000000
--- a/ext/notes/notes.dsw
+++ /dev/null
@@ -1,29 +0,0 @@
-Microsoft Developer Studio Workspace File, Format Version 6.00
-# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
-
-###############################################################################
-
-Project: "notes"=".\notes.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Global:
-
-Package=<5>
-{{{
-}}}
-
-Package=<3>
-{{{
-}}}
-
-###############################################################################
-
diff --git a/ext/notes/php_notes.c b/ext/notes/php_notes.c
deleted file mode 100644
index 0c887ec03e..0000000000
--- a/ext/notes/php_notes.c
+++ /dev/null
@@ -1,2762 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.01 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_01.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Brad Atkins <brad@youreshop.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifdef COMPILE_DL_NOTES
-#define HAVE_NOTES 1
-#endif
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "php_globals.h"
-#include "php_notes.h"
-#include "ext/standard/info.h"
-
-#include <notes_global.h>
-#include <nsfdb.h>
-#include <nsfdata.h>
-#include <osmisc.h>
-#include <miscerr.h>
-#include <nif.h>
-#include <nsfnote.h>
-#include <editods.h>
-#include <osmem.h>
-#include <stdnames.h>
-#include <nsfsearc.h>
-#include <colorid.h>
-#include <names.h>
-#include <stdnames.h>
-#include <nsferr.h>
-
-/* notes_unread */
-
-#include <idtable.h>
-#include <kfm.h>
-
-/* notes_header_info, notes_body */
-
-#include <malloc.h>
-#include <io.h>
-#include <direct.h>
-#include <fcntl.h>
-
-#include <globerr.h>
-#include <notes_mail.h>
-#include <mailserv.h>
-#include <nsf.h>
-#include <osfile.h> /* OSPathNetConstruct */
-#include <osenv.h> /* OSGetEnvironmentString */
-
-/* notes_nav_create */
-#include <vmods.h>
-
-/* notes_search */
-
-#include <ft.h>
-#include <textlist.h>
-
-/* notes_list */
-
-#define STRING_LENGTH 256
-
-function_entry notes_functions[] = {
- PHP_FE(notes_create_db, NULL)
- PHP_FE(notes_drop_db, NULL)
- PHP_FE(notes_version, NULL)
- PHP_FE(notes_create_note, NULL)
- PHP_FE(notes_unread, NULL)
- PHP_FE(notes_mark_read, NULL)
- PHP_FE(notes_mark_unread, NULL)
- PHP_FE(notes_header_info, NULL)
- PHP_FE(notes_body, NULL)
- PHP_FE(notes_find_note, NULL)
- PHP_FE(notes_nav_create, NULL)
- PHP_FE(notes_search, NULL)
- PHP_FE(notes_copy_db, NULL)
- PHP_FE(notes_list_msgs, NULL)
- {NULL, NULL, NULL}
-};
-
-zend_module_entry notes_module_entry = {
- "notes",
- notes_functions,
- PHP_MINIT(notes),
- PHP_MSHUTDOWN(notes),
- PHP_RINIT(notes),
- PHP_RSHUTDOWN(notes),
- PHP_MINFO(notes),
- STANDARD_MODULE_PROPERTIES
-};
-
-#ifdef COMPILE_DL_NOTES
-ZEND_GET_MODULE(notes)
-#endif
-
-
-PHP_MINIT_FUNCTION(notes)
-{
- return SUCCESS;
-}
-
-
-PHP_MSHUTDOWN_FUNCTION(notes)
-{
- return SUCCESS;
-}
-
-PHP_RSHUTDOWN_FUNCTION(notes)
-{
- return SUCCESS;
-}
-
-
-PHP_RINIT_FUNCTION(notes)
-{
-
- return SUCCESS;
-}
-
-
-PHP_MINFO_FUNCTION(notes)
-{
-
- php_info_print_table_start();
-
- php_info_print_table_row(2, "Lotus Notes Database Support", "enabled");
- php_info_print_table_end();
-}
-
-/* {{{ proto bool notes_create_db(string database_name)
- Create a Lotus Notes database */
-PHP_FUNCTION(notes_create_db)
-{
-
- int argc;
- pval *argv[1];
- STATUS error;
- pval **db;
- char error_string[200];
-
- argc = ARG_COUNT(ht);
-
- if (getParametersArray(ht, argc, argv) == FAILURE)
- WRONG_PARAM_COUNT;
-
- if (zend_get_parameters_ex(1, &db)==FAILURE) {
- RETURN_FALSE;
- }
-
- convert_to_string_ex(db);
-
- error = NotesInitExtended( argc, (char **) argv );
-
- if( error ){
-
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Unable to initialize Lotus Notes: %s", error_string);
- RETURN_FALSE;
- }
-
- if (error = NSFDbCreate ((*db)->value.str.val, (USHORT) DBCLASS_NOTEFILE, FALSE)){
-
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Unable to create database: %s", error_string);
- NotesTerm();
- RETURN_FALSE;
- }
-
-
- NotesTerm();
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool notes_drop_db(string database_name)
- Drop a Lotus Notes database */
-PHP_FUNCTION(notes_drop_db)
-{
-
- int argc;
- pval *argv[1];
- STATUS error;
- pval **db;
- char error_string[200];
-
- argc = ARG_COUNT(ht);
-
- if (getParametersArray(ht, argc, argv) == FAILURE)
- WRONG_PARAM_COUNT;
-
- if (zend_get_parameters_ex(1, &db)==FAILURE) {
- RETURN_FALSE;
- }
-
- convert_to_string_ex(db);
-
- error = NotesInitExtended( argc, (char **) argv );
-
- if( error ){
-
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Unable to initialize Lotus Notes: %s", error_string);
- RETURN_FALSE;
- }
-
- if (error = NSFDbDelete ((*db)->value.str.val)){
-
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Unable to delete database: %s", error_string);
- NotesTerm();
- RETURN_FALSE;
- }
-
-
- NotesTerm();
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto string notes_version(string database_name)
- Get the version Lotus Notes */
-PHP_FUNCTION(notes_version)
-{
-
- int argc;
- pval *argv[1];
- STATUS error;
- DBHANDLE db_handle;
- WORD wbuild;
- char error_string[200];
- pval **db;
-
- argc = ARG_COUNT(ht);
-
- if (getParametersArray(ht, argc, argv) == FAILURE){
-
- WRONG_PARAM_COUNT;
- }
-
- if (zend_get_parameters_ex(1, &db)==FAILURE) {
- RETURN_FALSE;
- }
-
- convert_to_string_ex(db);
-
- error = NotesInitExtended( argc, (char **) argv );
-
- if( error ){
-
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Unable to initialize Lotus Notes: %s", error_string);
- RETURN_FALSE;
- }
-
- if (error = NSFDbOpen ((*db)->value.str.val, &db_handle)){
-
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Unable to open database: %s", error_string);
- NotesTerm();
- RETURN_FALSE;
- }
-
- if( error = NSFDbGetBuildVersion (db_handle, &wbuild) ){
-
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Unable to get Lotus Notes version: %s", error_string);
- NSFDbClose(db_handle);
- NotesTerm();
- RETURN_FALSE;
- }
-
- NSFDbClose(db_handle);
- NotesTerm();
-
- if( wbuild > 0 && wbuild < 82 ){
-
- RETURN_DOUBLE(1.0);
- }
- else{
-
- if( wbuild > 81 && wbuild < 94 ){
-
- RETURN_DOUBLE(2.0);
- }
- else{
-
- if(wbuild > 93 && wbuild < 119 ){
-
- RETURN_DOUBLE(3.0);
- }
- else{
-
- if( wbuild > 118 && wbuild < 137 ){
-
- RETURN_DOUBLE(4.0);
- }
- else{
-
- if( wbuild == 138 ){
-
- RETURN_DOUBLE(4.1);
- }
- else{
-
- if( wbuild > 139 && wbuild < 146 ){
-
- RETURN_DOUBLE(4.5);
- }
- else{
-
- if( wbuild == 147 ){
-
- RETURN_DOUBLE(4.6);
- }
- else{
-
- RETURN_DOUBLE(5.0);
- }
- }
- }
- }
- }
- }
- }
-}
-/* }}} */
-
-/* {{{ proto string notes_create_note(string database_name, string form_name)
- Create a note using form form_name */
-PHP_FUNCTION(notes_create_note)
-{
-
- int argc;
- pval *argv[2];
- STATUS error;
- DBHANDLE db_handle;
- NOTEHANDLE note_handle;
- char error_string[200];
- pval **db;
- pval **form_name;
-
- argc = ARG_COUNT(ht);
-
- if (getParametersArray(ht, argc, argv) == FAILURE){
-
- WRONG_PARAM_COUNT;
- }
-
- if (zend_get_parameters_ex(2, &db, &form_name)==FAILURE) {
- RETURN_FALSE;
- }
-
- convert_to_string_ex(db);
- convert_to_string_ex(form_name);
-
- error = NotesInitExtended( argc, (char **) argv );
-
- if( error ){
-
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Unable to initialize Lotus Notes: %s", error_string);
- RETURN_FALSE;
- }
-
- if (error = NSFDbOpen ((*db)->value.str.val, &db_handle)){
-
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Unable to open database: %s", error_string);
- NotesTerm();
- RETURN_FALSE;
- }
-
- if (error = NSFNoteCreate (db_handle, &note_handle)){
-
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Unable to create note: error_string");
- NSFDbClose( db_handle );
- RETURN_FALSE;
- }
-
- /* Append the form name item to the new note */
- if (error = NSFItemSetText( note_handle,
- FIELD_FORM,
- (*form_name)->value.str.val,
- MAXWORD)){
-
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Unable to use the form: %s", error_string);
- NSFNoteClose (note_handle);
- NSFDbClose( db_handle );
- RETURN_FALSE;
- }
-
- if (error = NSFNoteUpdate (note_handle, 0)) {
-
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Unable to save the note: %s", error_string);
- NSFNoteClose (note_handle);
- NSFDbClose(db_handle);
- RETURN_FALSE;
- }
-
- error = NSFNoteClose (note_handle);
-
- NSFDbClose(db_handle);
- NotesTerm();
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* Declarations for notes_mark_read and notes_mark_unread */
-
-#define ACTION_COUNT_MAX (16)
-
-
-/* Entries in the action table */
-
-typedef struct {
- BOOL AddFlag; /* TRUE: Add, FALSE: Remove */
- NOTEID NoteID;
-} ACTION_ENTRY;
-
- /* Table of actions to be performed */
-ACTION_ENTRY ActionTable [ACTION_COUNT_MAX] = {FALSE, 0L};
-
-/*
- * Forward references
- */
-
- /* Function to display unread note table */
-STATUS DisplayUnread (
- DBHANDLE db_handle,
- char NOTESPTR pName,
- WORD nameLen
-);
-
- /* Function to apply actions to unread note table */
-STATUS UpdateUnread (
- DBHANDLE db_handle,
- char NOTESPTR pName,
- WORD nameLen,
- ACTION_ENTRY *pActions,
- int actionCount,
- NOTEID *pUndoID
-);
-
- /* Function that updates a note without changing its unread status */
-STATUS UndoUnreadStatus (
- DBHANDLE db_handle,
- char NOTESPTR pName,
- WORD nameLen,
- ACTION_ENTRY *pActions,
- int actionCount,
- NOTEID UndoID);
-
-
-/* {{{ proto string notes_mark_read(string database_name, string user_name, string note_id)
- Mark a note_id as read for the User user_name
- Note: user_name must be fully distinguished user name
-*/
-PHP_FUNCTION(notes_mark_read){
-
- int argc;
- int ActionCount;
- pval *argv[3];
- STATUS error;
- DBHANDLE db_handle;
- pval **db;
- pval **note_id;
- pval **user_name;
-
-
-/* Local data declarations */
-
- WORD UserNameLen = 0;
- char *pEnd;
- int curAction;
- int curArg;
- NOTEID UndoID = 0L;
- char error_string[200];
-
- argc = ARG_COUNT(ht);
-
- if (getParametersArray(ht, argc, argv) == FAILURE){
-
- WRONG_PARAM_COUNT;
- }
-
- if (zend_get_parameters_ex(3, &db, &user_name, &note_id)==FAILURE) {
- RETURN_FALSE;
- }
-
- convert_to_string_ex(db);
- convert_to_string_ex(note_id);
- convert_to_string_ex(user_name);
-
- error = NotesInitExtended( argc, (char **) argv );
-
- if( error ){
-
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Unable to initialize Lotus Notes: %s", error_string);
- RETURN_FALSE;
- }
-
- curArg = 2;
-
- UserNameLen = strlen ((*user_name)->value.str.val);
-
- curAction = 0;
- ActionCount = 1;
-
- ActionTable[curAction].AddFlag = FALSE;
-
- ActionTable[curAction].NoteID =
- strtoul ((*note_id)->value.str.val, &pEnd, 16);
-
- if (error = NSFDbOpen ((*db)->value.str.val, &db_handle)){
-
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Unable to open database: %s", error_string);
- NotesTerm();
- RETURN_FALSE;
- }
-
- error = UpdateUnread (db_handle, (*user_name)->value.str.val, UserNameLen,
- ActionTable, ActionCount, &UndoID);
-
- if ( (error == NOERROR) && UndoID ){
-
- error = UndoUnreadStatus (db_handle, (*user_name)->value.str.val, UserNameLen, ActionTable,
- ActionCount, UndoID);
- }
-
- /* Close the database */
- error = NSFDbClose (db_handle);
-
- if (NOERROR == error){
-
- RETURN_TRUE;
- }
- else{
-
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Unable to close database: %s", error_string);
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto string notes_mark_unread(string database_name, string user_name, string note_id)
- Mark a note_id as unread for the User user_name
- Note: user_name must be fully distinguished user name
-*/
-PHP_FUNCTION(notes_mark_unread){
-
- int argc;
- int ActionCount;
- pval *argv[3];
- STATUS error;
- DBHANDLE db_handle;
- pval **db;
- pval **note_id;
- pval **user_name;
-
-
-/* Local data declarations */
-
- WORD UserNameLen = 0;
- char *pEnd;
- int curAction;
- int curArg;
- NOTEID UndoID = 0L;
- char error_string[200];
-
- argc = ARG_COUNT(ht);
-
- if (getParametersArray(ht, argc, argv) == FAILURE){
-
- WRONG_PARAM_COUNT;
- }
-
- if (zend_get_parameters_ex(3, &db, &user_name, &note_id)==FAILURE) {
- RETURN_FALSE;
- }
-
- convert_to_string_ex(db);
- convert_to_string_ex(note_id);
- convert_to_string_ex(user_name);
-
- error = NotesInitExtended( argc, (char **) argv );
-
- if( error ){
-
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Unable to initialize Lotus Notes: %s", error_string);
- RETURN_FALSE;
- }
-
- curArg = 2;
-
- UserNameLen = strlen ((*user_name)->value.str.val);
-
- curAction = 0;
- ActionCount = 1;
-
- ActionTable[curAction].AddFlag = TRUE;
-
- ActionTable[curAction].NoteID =
- strtoul ((*note_id)->value.str.val, &pEnd, 16);
-
- if (error = NSFDbOpen ((*db)->value.str.val, &db_handle)){
-
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Unable to open database: %s", error_string);
- NotesTerm();
- RETURN_FALSE;
- }
-
- error = UpdateUnread (db_handle, (*user_name)->value.str.val, UserNameLen,
- ActionTable, ActionCount, &UndoID);
-
- if ( (error == NOERROR) && UndoID ){
-
- error = UndoUnreadStatus (db_handle, (*user_name)->value.str.val, UserNameLen, ActionTable,
- ActionCount, UndoID);
- }
-
- /* Close the database */
- error = NSFDbClose (db_handle);
-
- if (NOERROR == error){
-
- RETURN_TRUE;
- }
- else{
-
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Unable to close the database: %s", error_string);
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/*
- * UpdateUnread - Update the Unread Note list
- */
-
-STATUS UpdateUnread (
- DBHANDLE db_handle,
- char *pName,
- WORD nameLen,
- ACTION_ENTRY *pActions,
- int actionCount,
- NOTEID *pUndoID)
-{
- STATUS error;
- HANDLE table_handle;
- HANDLE hOriginalTable;
- NOTEHANDLE note_handle;
- BOOL gotUndoID = FALSE;
-
- /* Get the unread list */
- error = NSFDbGetUnreadNoteTable (
- db_handle,
- pName,
- nameLen,
- TRUE, /* Create the list if it's not already there */
- &table_handle);
-
- if (NOERROR != error){
-
- return (error);
- }
-
- /* Notes requires the original unread table to merge changes */
- error = IDTableCopy (table_handle, &hOriginalTable);
-
- if (NOERROR != error){
-
- IDDestroyTable (table_handle);
- return (error);
- }
-
- /* Bring table up to date */
- error = NSFDbUpdateUnread (db_handle, table_handle);
- if (NOERROR == error){
-
- if (pActions[0].AddFlag){
-
- /* Adding a Note ID */
- /* (Marks note as Unread) */
- if (IDIsPresent (table_handle, pActions[0].NoteID)){
-
- php_error(E_WARNING,"Note %lX is already marked unread", pActions[0].NoteID);
- }
- else{
- /* make sure we check to see if this note really exists
- at all */
- error = NSFNoteOpen(db_handle, pActions[0].NoteID, OPEN_SUMMARY, &note_handle);
-
- /* if it does we'll add it to the unread list */
- if (error == NOERROR){
-
- NSFNoteClose(note_handle);
- error = IDInsert (table_handle, pActions[0].NoteID,
- (NOTESBOOL NOTESPTR) NULL);
-
- }
- }
- }
- else{
-
- /* Removing a Note ID */
- /* (Marks note as Read) */
-
- if (IDIsPresent (table_handle, pActions[0].NoteID)){
-
- error = IDDelete (table_handle, pActions[0].NoteID,
- (NOTESBOOL NOTESPTR) NULL);
-
- if (NOERROR == error){
-
- if (!gotUndoID){
- *pUndoID = pActions[0].NoteID;
- gotUndoID = TRUE;
- }
- }
- }
- else{
-
- php_error(E_WARNING,"Note %lX is already marked read", pActions[0].NoteID);
- }
- }
-
- if (NOERROR == error){
-
- error = NSFDbSetUnreadNoteTable (db_handle, pName, nameLen,
- FALSE, /* Don't force the
- write to disk */
- hOriginalTable,
- table_handle);
- }
- }
-
- error = IDDestroyTable (hOriginalTable);
- if (NOERROR == error){
-
- error = error;
- }
-
- error = IDDestroyTable (table_handle);
-
- if (NOERROR == error){
-
- error = error;
- }
-
- return (error);
-}
-
-
-/*
- * UndoUnreadStatus - Update a note in the database without
- changing its read/unread mark
- */
-
-STATUS UndoUnreadStatus (
- DBHANDLE db_handle,
- char *pName,
- WORD nameLen,
- ACTION_ENTRY *pActions,
- int actionCount,
- NOTEID UndoID)
-{
- STATUS error;
- HANDLE table_handle;
- HANDLE hOriginalTable;
- DWORD noteID = 0L;
- NOTEHANDLE note_handle;
- BOOL bWasRead = TRUE;
-
-
- /* Get the unread list */
- error = NSFDbGetUnreadNoteTable (db_handle, pName, nameLen,
- TRUE, /* Create the list if it's
- not already there */
- &table_handle);
- if (NOERROR != error){
-
- return (error);
- }
-
- /* Notes requires the original unread table to merge changes */
-
- error = IDTableCopy (table_handle, &hOriginalTable);
-
- if (NOERROR != error){
-
- IDDestroyTable (table_handle);
- return (error);
- }
-
- /* See if note to be modified is marked as read */
- bWasRead = !(IDIsPresent (table_handle, UndoID));
-
- /* Make a change to this note and update it. */
- error = NSFNoteOpen (db_handle, UndoID, 0, &note_handle);
-
- if (error){
-
- IDDestroyTable (table_handle);
- IDDestroyTable (hOriginalTable);
- return (error);
- }
-
- error = NSFItemSetText (note_handle, "plain_text", "Unread undone",
- (WORD) strlen("Unread undone"));
- if (error){
-
- NSFNoteClose (note_handle);
- IDDestroyTable (table_handle);
- IDDestroyTable (hOriginalTable);
- return (error);
- }
-
- error = NSFNoteUpdate (note_handle, 0L);
-
- if (error){
-
- NSFNoteClose (note_handle);
- IDDestroyTable (table_handle);
- IDDestroyTable (hOriginalTable);
- return (error);
- }
-
- error = NSFNoteClose (note_handle);
-
- if (error){
-
- IDDestroyTable (table_handle);
- IDDestroyTable (hOriginalTable);
- return (error);
- }
-
- /* The note just modified is now marked as unread.
- Bring table up to date */
-
- error = NSFDbUpdateUnread (db_handle, table_handle);
-
- if ( (NOERROR == error) && bWasRead ){
-
- /* Remove the Note ID that we just modified to mark it as read*/
-
- error = IDDelete (table_handle, UndoID,
- (NOTESBOOL NOTESPTR) NULL);
-
- if( error != NOERROR ){
-
- php_error(E_NOTICE,"Note %lX is already marked read.", UndoID);
- }
- }
-
- /* Save unread table to disk */
- if (NOERROR == error){
-
- error = NSFDbSetUnreadNoteTable (db_handle, pName, nameLen,
- FALSE, /* Don't force the write
- to disk */
- hOriginalTable, table_handle);
- }
-
- /* Clean up */
- IDDestroyTable (hOriginalTable);
- IDDestroyTable (table_handle);
-
- return (error);
-}
-
-/* {{{ proto string notes_unread(string database_name, string user_name)
- Returns the unread note id's for the current User user_name
- Note: user_name must be fully distinguished user name*/
-PHP_FUNCTION(notes_unread){
-
- int argc;
- pval *argv[2];
-
- STATUS error;
- DBHANDLE db_handle;
- WORD UserNameLen;
- HANDLE table_handle;
- DWORD noteID;
- BOOL FirstNote;
- char error_string[200];
-
- pval **db;
- pval **user_name;
-
- argc = ARG_COUNT(ht);
-
- if (getParametersArray(ht, argc, argv) == FAILURE){
-
- WRONG_PARAM_COUNT;
- }
-
- if (zend_get_parameters_ex(2, &db, &user_name)==FAILURE) {
- RETURN_FALSE;
- }
-
- convert_to_string_ex(db);
- convert_to_string_ex(user_name);
-
- error = NotesInitExtended( argc, (char **) argv );
-
- if( error ){
-
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Unable to initialize Lotus Notes: %s", error_string);
- RETURN_FALSE;
- }
-
- if (error = NSFDbOpen ((*db)->value.str.val, &db_handle)){
-
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Unable to open database: %s", error_string);
- NotesTerm();
- RETURN_FALSE;
- }
-
- UserNameLen = strlen((*user_name)->value.str.val);
-
- /* Get the unread list */
- if( error = NSFDbGetUnreadNoteTable (
- db_handle,
- (*user_name)->value.str.val,
- UserNameLen,
- TRUE, /* Create the list if it's not already there */
- &table_handle) ){
-
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Unable to get unread list: %s", error_string );
- NotesTerm();
- RETURN_FALSE;
- }
-
-
- error = NSFDbUpdateUnread (db_handle, table_handle);
- if (NOERROR != error)
- {
- IDDestroyTable (table_handle);
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Unable to get unread list: %s", error_string );
- NotesTerm();
- RETURN_FALSE;
- }
-
-
- FirstNote = TRUE;
-
- array_init(return_value);
-
- /* Print the entries in the unread list */
- while (IDScan (table_handle, FirstNote, &noteID)){
-
- FirstNote = FALSE;
-
- add_next_index_long(return_value, (long) noteID );
- }
-
- error = IDDestroyTable (table_handle);
-
- /* Close the database */
- error = NSFDbClose (db_handle);
-
- if( error != NOERROR ){
-
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Unable to close database: %s", error_string);
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-#define ERR_READMAIL_NOUNIQUE (PKG_ADDIN + 0)
-#define READMAIL_BODY_LINELEN 40
-
-STATUS near pascal GetUniqueFileName(char *Drive, char *Ext, char *FileName);
-
-/* {{{ proto object notes_header_info(string server, string mailbox, int msg_number)
- Open the message msg_number in the specified mailbox on the specified server (leave server
- blank for local).
-
- Elements:
-
- originator (Contains orignal message sender. Relevant only when forwarded messages)
- to
- cc
- bcc
- from
- date
- status (blank if delivered, otherwise contains failure reason)
- priority H: High N: Normal L: Low
- receipt 1: Yes 0: No
- subject*/
-PHP_FUNCTION(notes_header_info){
-
- int argc;
- pval *argv[3];
-
- pval **server;
- pval **mail_box;
- pval **msg_number;
-
- STATUS error = NOERROR;
- char szMailFilePath[MAXPATH+1];
- HANDLE hMessageFile;
- HANDLE hMessageList = NULLHANDLE, hMessage;
- DARRAY *MessageList;
- WORD MessageCount;
- char Originator[MAXRECIPIENTNAME+1];
- WORD OriginatorLength;
- char String[MAXSPRINTF+1];
- WORD StringLength;
- TIMEDATE Time;
- BOOL NonDeliveryReport;
- char error_string[200];
-
- argc = ARG_COUNT(ht);
-
- if (getParametersArray(ht, argc, argv) == FAILURE){
-
- WRONG_PARAM_COUNT;
- }
-
- if (zend_get_parameters_ex(3, &server, &mail_box, &msg_number)==FAILURE) {
- RETURN_FALSE;
- }
-
- convert_to_string_ex(server);
- convert_to_string_ex(mail_box);
- convert_to_long_ex(msg_number);
-
- error = NotesInitExtended( argc, (char **) argv );
-
- if( error ){
-
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Unable to initialize Lotus Notes: %s", error_string);
- RETURN_FALSE;
- }
-
- OSPathNetConstruct( NULL, /* port name */
- (*server)->value.str.val,
- (*mail_box)->value.str.val,
- szMailFilePath);
-
- /* Open the message file. */
-
- if (error = MailOpenMessageFile(szMailFilePath, &hMessageFile)){
-
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Error: unable to open '%s': %s", szMailFilePath, error_string);
- RETURN_FALSE;
- }
-
- /* Create message list of messages in the file - just 64K */
-
- if (error = MailCreateMessageList(hMessageFile,
- &hMessageList, &MessageList, &MessageCount)){
-
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Unable to create message list: %s", error_string);
-
- if (hMessageFile != NULLHANDLE){
-
- MailCloseMessageFile(hMessageFile);
- }
- RETURN_FALSE;
- }
-
-
- /* Print out each of the outbound messages. */
-
- object_init(return_value);
-
- if (error = MailOpenMessage (MessageList, (WORD)(*msg_number)->value.lval, &hMessage)){
-
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Unable to open message number %d: %s", (WORD)(*msg_number)->value.lval, error_string);
-
- if (hMessageList != NULLHANDLE){
-
- OSUnlockObject(hMessageList);
- OSMemFree(hMessageList);
- }
-
- if (hMessageFile != NULLHANDLE){
-
- MailCloseMessageFile(hMessageFile);
- }
- RETURN_FALSE;
- }
-
- /* Get the originator's name/address. */
-
- if (error = MailGetMessageOriginator(MessageList, (WORD)(*msg_number)->value.lval,
- Originator, sizeof(Originator), &OriginatorLength)){
-
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Unable to get message originator: %s", error_string);
-
- if (hMessageList != NULLHANDLE){
-
- OSUnlockObject(hMessageList);
- OSMemFree(hMessageList);
- }
-
- if (hMessageFile != NULLHANDLE){
-
- MailCloseMessageFile(hMessageFile);
- }
- RETURN_FALSE;
- }
-
- add_property_string(return_value,"originator",Originator, 1);
-
- /* SendTo */
- MailGetMessageItem (hMessage, MAIL_SENDTO_ITEM_NUM, String,
- MAXSPRINTF, &StringLength);
-
- add_property_string(return_value,"to",String, 1);
-
- /* PostedDate */
- MailGetMessageItemTimeDate(hMessage, MAIL_POSTEDDATE_ITEM_NUM, &Time);
- ConvertTIMEDATEToText(NULL, NULL, &Time, String,
- sizeof(String), &StringLength);
-
- add_property_string(return_value,"date",String, 1);
-
- /* BCC */
- MailGetMessageItem (hMessage, MAIL_BLINDCOPYTO_ITEM_NUM, String,
- MAXSPRINTF, &StringLength);
-
- add_property_string(return_value,"bcc", String, 1);
-
- /* CopyTo */
- MailGetMessageItem (hMessage, MAIL_COPYTO_ITEM_NUM, String,
- MAXSPRINTF, &StringLength);
-
- add_property_string(return_value,"cc", String, 1);
-
- /* From */
- MailGetMessageItem (hMessage, MAIL_FROM_ITEM_NUM, String,
- MAXSPRINTF, &StringLength);
-
- add_property_string(return_value,"from",String, 1);
-
- /* Subject */
-
- MailGetMessageItem (hMessage, MAIL_SUBJECT_ITEM_NUM, String,
- MAXSPRINTF, &StringLength);
-
- add_property_string(return_value,"subject",String, 1);
-
- /* Priority H: High N: Normal L: Low*/
-
- MailGetMessageItem (hMessage, MAIL_DELIVERYPRIORITY_ITEM_NUM, String,
- MAXSPRINTF, &StringLength);
-
- add_property_string(return_value,"priority",String, 1);
-
- /* Return Receipt 1: Yes 0: No*/
-
- MailGetMessageItem (hMessage, MAIL_RETURNRECEIPT_ITEM_NUM, String,
- MAXSPRINTF, &StringLength);
-
- add_property_string(return_value,"receipt",String, 1);
-
- NonDeliveryReport = MailIsNonDeliveryReport(hMessage);
-
- if (NonDeliveryReport)
- {
- MailGetMessageItem(hMessage, MAIL_FAILUREREASON_ITEM_NUM,
- String, sizeof(String), &StringLength);
-
- add_property_string(return_value,"status",String, 1);
- }
- else{
-
- add_property_string(return_value,"status","", 1);
- }
-
- MailCloseMessage (hMessage);
-
- /* Free the message list and close the message file */
-
- if (hMessageList != NULLHANDLE){
-
- OSUnlockObject(hMessageList);
- OSMemFree(hMessageList);
- }
-
- if (hMessageFile != NULLHANDLE){
-
- MailCloseMessageFile(hMessageFile);
- }
-}
-/* }}} */
-
-STATUS near pascal GetUniqueFileName(char *Drive, char *Ext,
- char *FileName)
-
-{
- int file;
- WORD Num;
- char Name[17];
- char cwd[MAXPATH];
- char *Dir;
-
- /* Increment through numbered file names until a non-existent one found. */
- getcwd(cwd, MAXPATH);
- Dir = (char *)&cwd;
-
- for (Num = 0; Num <= 32767; Num++)
- {
- _itoa(Num, Name, 10);
- _makepath(FileName, Drive, Dir, Name, Ext);
- if ((file = open(FileName, O_BINARY | O_RDONLY)) == -1)
- return(NOERROR);
- close(file);
- }
- FileName[0] = '\0';
- return(ERR_READMAIL_NOUNIQUE);
-}
-
-/* {{{ proto array notes_body(string server, string mailbox, int msg_number)
- Open the message msg_number in the specified mailbox on the specified server (leave server
- blank for local) and returns an array of body text lines. */
-PHP_FUNCTION(notes_body){
-
- int argc;
- pval *argv[3];
-
- pval **server;
- pval **mail_box;
- pval **msg_number;
-
- STATUS error = NOERROR;
- char szMailFilePath[MAXPATH+1];
- HANDLE hMessageFile;
- HANDLE hMessageList = NULLHANDLE, hMessage;
- DARRAY *MessageList;
- WORD MessageCount;
- char String[MAXSPRINTF+1];
- DWORD BodyFileSize;
- char BodyFileName[MAXPATH_OLE];
- FILE *BodyFile;
- char error_string[200];
-
- argc = ARG_COUNT(ht);
-
- if (getParametersArray(ht, argc, argv) == FAILURE){
-
- WRONG_PARAM_COUNT;
- }
-
- if (zend_get_parameters_ex(3, &server, &mail_box, &msg_number)==FAILURE) {
- RETURN_FALSE;
- }
-
- convert_to_string_ex(server);
- convert_to_string_ex(mail_box);
- convert_to_long_ex(msg_number);
-
- error = NotesInitExtended( argc, (char **) argv );
-
- if( error ){
-
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Unable to initialize Lotus Notes: %s", error_string);
- RETURN_FALSE;
- }
-
- OSPathNetConstruct( NULL, /* port name */
- (*server)->value.str.val,
- (*mail_box)->value.str.val,
- szMailFilePath);
-
- /* Open the message file. */
-
- if (error = MailOpenMessageFile(szMailFilePath, &hMessageFile)){
-
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Error: unable to open '%s': %s.", szMailFilePath, error_string);
- RETURN_FALSE;
- }
-
- /* Create message list of messages in the file - just 64K */
-
- if (error = MailCreateMessageList(hMessageFile,
- &hMessageList, &MessageList, &MessageCount)){
-
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Unable to create message list: %s", error_string);
-
- if (hMessageFile != NULLHANDLE){
-
- MailCloseMessageFile(hMessageFile);
- }
- RETURN_FALSE;
- }
-
- if (error = MailOpenMessage (MessageList, (WORD)(*msg_number)->value.lval, &hMessage)){
-
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Unable to open message number %d: %s", (WORD)(*msg_number)->value.lval, error_string);
-
- if (hMessageList != NULLHANDLE){
-
- OSUnlockObject(hMessageList);
- OSMemFree(hMessageList);
- }
-
- if (hMessageFile != NULLHANDLE){
-
- MailCloseMessageFile(hMessageFile);
- }
- RETURN_FALSE;
- }
-
- /* Body */
- if (error = GetUniqueFileName("", "TMP", BodyFileName)){
-
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Enable to create temporary file name: %s", error_string);
-
- if (hMessageList != NULLHANDLE){
-
- OSUnlockObject(hMessageList);
- OSMemFree(hMessageList);
- }
-
- if (hMessageFile != NULLHANDLE){
-
- MailCloseMessageFile(hMessageFile);
- }
- MailCloseMessage (hMessage);
- RETURN_FALSE;
-
- }
-
- /* Using MailGetBodyComposite instead of MailGetBody because it's not limited to 64k */
-
- if (error = MailGetMessageBodyText(hMessage,
- NULL, /* Use standard Body item */
- "\r\n", /* Newline-terminate */
- 80, /* 80 chars per line */
- TRUE, /* Convert TABs */
- BodyFileName,
- &BodyFileSize)){
-
- unlink(BodyFileName);
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Unable to get Message body into temporary file: %s", error_string);
-
- if (hMessageList != NULLHANDLE){
-
- OSUnlockObject(hMessageList);
- OSMemFree(hMessageList);
- }
-
- if (hMessageFile != NULLHANDLE){
-
- MailCloseMessageFile(hMessageFile);
- }
- MailCloseMessage (hMessage);
- RETURN_FALSE;
- }
-
- /* Print each line of body text to the screen. */
-
- if (!(BodyFile = fopen(BodyFileName, "r"))){
-
- unlink(BodyFileName);
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Unable to open temporary file: %s", error_string);
-
- if (hMessageList != NULLHANDLE){
-
- OSUnlockObject(hMessageList);
- OSMemFree(hMessageList);
- }
-
- if (hMessageFile != NULLHANDLE){
-
- MailCloseMessageFile(hMessageFile);
- }
- MailCloseMessage (hMessage);
- RETURN_FALSE;
- }
-
- array_init(return_value);
-
- /* this should probably return the body in one string, but I don't know how */
-
- while (fgets(String, READMAIL_BODY_LINELEN, BodyFile)){
-
- add_next_index_string( return_value, String, 1);
- }
- fclose(BodyFile);
- unlink(BodyFileName);
-
- MailCloseMessage (hMessage);
-
- /* Free the message list and close the message file */
-
- if (hMessageList != NULLHANDLE){
-
- OSUnlockObject(hMessageList);
- OSMemFree(hMessageList);
- }
-
- if (hMessageFile != NULLHANDLE){
-
- MailCloseMessageFile(hMessageFile);
- }
-}
-/* }}} */
-
-/* {{{ proto bool notes_find_note(string database_name, string name [, string type] )
- Returns a note id found in database_name. Specify the name of the note. Leaving type blank
- will default to all, otherwise specify:
-
- FORM
- VIEW
- FILTER
- FIELD
- */
-PHP_FUNCTION(notes_find_note){
-
- int argc;
- pval *argv[3];
-
- pval **db;
- pval **name;
- pval **type;
-
- STATUS error = NOERROR;
- DBHANDLE db_handle;
- NOTEID note_id;
-
- char error_string[200];
-
- argc = ARG_COUNT(ht);
-
- if (getParametersArray(ht, argc, argv) == FAILURE){
-
- WRONG_PARAM_COUNT;
- }
-
- if (zend_get_parameters_ex(3, &db, &name, &type)==FAILURE) {
- RETURN_FALSE;
- }
-
- convert_to_string_ex(db);
- convert_to_string_ex(name);
- convert_to_string_ex(type);
-
- error = NotesInitExtended( argc, (char **) argv );
-
- if( error ){
-
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Unable to initialize Lotus Notes: %s", error_string);
- RETURN_FALSE;
- }
-
- if (error = NSFDbOpen ((*db)->value.str.val, &db_handle)){
-
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Unable to open database: %s", error_string);
- NotesTerm();
- RETURN_FALSE;
- }
-
- if( strcmp( (*type)->value.str.val, "FORM" ) == 0 ){
-
- if ((error = NIFFindDesignNote(db_handle, (*name)->value.str.val, NOTE_CLASS_FORM, &note_id)) != ERR_NOT_FOUND) {
-
- RETVAL_LONG( (long) note_id );
- }
- } else if( strcmp( (*type)->value.str.val, "VIEW" ) == 0 ){
-
- if ((error = NIFFindDesignNote(db_handle, (*name)->value.str.val, NOTE_CLASS_VIEW, &note_id)) != ERR_NOT_FOUND) {
-
- RETVAL_LONG( (long) note_id );
- }
- } else if( strcmp( (*type)->value.str.val, "FILTER" ) == 0 ){
-
- if ((error = NIFFindDesignNote(db_handle, (*name)->value.str.val, NOTE_CLASS_FILTER, &note_id)) != ERR_NOT_FOUND) {
-
- RETVAL_LONG( (long) note_id );
- }
-
- } else if( strcmp( (*type)->value.str.val, "FIELD" ) == 0 ){
-
- if ((error = NIFFindDesignNote(db_handle, (*name)->value.str.val, NOTE_CLASS_FIELD, &note_id)) != ERR_NOT_FOUND) {
-
- RETVAL_LONG( (long) note_id );
- }
- }
- else{
-
- if ((error = NIFFindDesignNote(db_handle, (*name)->value.str.val, NOTE_CLASS_ALL, &note_id)) != ERR_NOT_FOUND) {
-
- RETVAL_LONG( (long) note_id );
- }
- }
-
- NSFDbClose(db_handle);
- NotesTerm();
-}
-/* }}} */
-
-/* {{{ proto bool notes_nav_create(string database_name, string name )
- Create a navigator name, in database_name */
-PHP_FUNCTION(notes_nav_create){
-
- int argc;
- pval *argv[2];
-
- pval **db;
- pval **name;
- char error_string[200];
-
- STATUS error = NOERROR;
- DBHANDLE db_handle;
-
- WORD ClassView = NOTE_CLASS_VIEW;
-
- NOTEHANDLE view_handle; /* sample navigator view handle */
-
- char szMainView[] = "MainView"; /* title of view to be used */
-
- VIEWMAP_HEADER_RECORD NavHeader;
-
- WORD wLayoutCount;
- WORD wNavLayoutBufLen;
- HANDLE hNavLayoutBuffer;
- char *pNavLayoutBuffer;
- char *pNLBuf;
-
- char szDFlags[3];
-
- argc = ARG_COUNT(ht);
-
- if (getParametersArray(ht, argc, argv) == FAILURE){
-
- WRONG_PARAM_COUNT;
- }
-
- if (zend_get_parameters_ex(2, &db, &name)==FAILURE) {
- RETURN_FALSE;
- }
-
- convert_to_string_ex(db);
- convert_to_string_ex(name);
-
- error = NotesInitExtended( argc, (char **) argv );
-
- if( error ){
-
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Unable to initialize Lotus Notes: %s", error_string);
- RETURN_FALSE;
- }
-
- if (error = NSFDbOpen ((*db)->value.str.val, &db_handle)){
-
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Unable to open database: %s", error_string);
- NotesTerm();
- RETURN_FALSE;
- }
-
- error = NSFNoteCreate( db_handle, &view_handle );
- if ( error ) {
-
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Unable to create note in database: %s", error_string);
- NSFDbClose( db_handle );
- NotesTerm();
- RETURN_FALSE;
- }
-
-
- NSFNoteSetInfo( view_handle, _NOTE_CLASS, &ClassView );
-
-/*
- * Set the view name.
- */
- error = NSFItemSetText( view_handle, VIEW_TITLE_ITEM,
- (*name)->value.str.val, MAXWORD );
- if ( error ){
-
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Unable to set text item '%s' in view note: %s", VIEW_TITLE_ITEM, error_string);
- NSFNoteClose( view_handle );
- NSFDbClose( db_handle );
- NotesTerm();
- RETURN_FALSE;
- }
-
-/*
- * Append Design flags for the Navigator view.
- */
- szDFlags[0] = DESIGN_FLAG_VIEWMAP;
- szDFlags[1] = DESIGN_FLAG_HIDE_FROM_V3;
- szDFlags[2] = '\0';
- error = NSFItemAppend( view_handle,
- ITEM_SUMMARY,
- DESIGN_FLAGS,
- (WORD)strlen(DESIGN_FLAGS),
- TYPE_TEXT,
- szDFlags,
- (DWORD)strlen(szDFlags ));
- if ( error ) {
-
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Unable to append item '%s' to view note: %s", DESIGN_FLAGS, error_string);
-
- NSFNoteClose( view_handle );
- NSFDbClose( db_handle );
- NotesTerm();
- RETURN_FALSE;
- }
-
- wLayoutCount = 0;
- wNavLayoutBufLen = ODSLength( _VIEWMAP_HEADER_RECORD );
-
-/*
- * Allocate and initialize the CD buffer for the entire $ViewMapLayout item.
- */
- if ( error = OSMemAlloc( 0, wNavLayoutBufLen, &hNavLayoutBuffer )){
-
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Unable to allocate %d bytes memory: %s", wNavLayoutBufLen, error_string);
-
- NSFNoteClose( view_handle );
- NSFDbClose( db_handle );
- NotesTerm();
- RETURN_FALSE;
- }
-
- pNavLayoutBuffer = (char*) OSLockObject( hNavLayoutBuffer );
- memset( pNavLayoutBuffer, 0, (size_t) wNavLayoutBufLen );
-
- /*
- * Initialize pNLBuf. pNavLayoutBuffer will remain pointing to the top
- * of the buffer. pNLBuf will move to point to the next available byte.
- */
- pNLBuf = pNavLayoutBuffer;
-
-
- NavHeader.Header.Signature = SIG_CD_VMHEADER;
- NavHeader.Header.Length = (BYTE) ODSLength(_VIEWMAP_HEADER_RECORD );
- NavHeader.Version = VIEWMAP_VERSION;
- NavHeader.NameLen = 0;
-
- ODSWriteMemory( &pNLBuf, _VIEWMAP_HEADER_RECORD, &NavHeader, 1 );
-
- error = NSFItemAppend( view_handle,
- ITEM_SUMMARY,
- VIEWMAP_LAYOUT_ITEM,
- (WORD)strlen(VIEWMAP_LAYOUT_ITEM),
- TYPE_VIEWMAP_LAYOUT,
- pNavLayoutBuffer,
- (DWORD)wNavLayoutBufLen );
-
- OSUnlockObject( hNavLayoutBuffer );
- OSMemFree( hNavLayoutBuffer );
-
- if ( error ) {
-
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Unable to append item '%s' to view note: %s", VIEWMAP_LAYOUT_ITEM, error_string);
-
- NSFNoteClose( view_handle );
- NSFDbClose( db_handle );
- NotesTerm();
- RETURN_FALSE;
- }
-
-/*
- * Done constructing the view note. Now store the view note
- * in the database.
- */
- error = NSFNoteUpdate( view_handle, 0 );
-
- if ( error) {
-
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Unable to update note: %s", error_string);
-
- NSFNoteClose( view_handle );
- NSFDbClose( db_handle );
- NotesTerm();
- RETURN_FALSE;
- }
-
- NSFNoteClose( view_handle );
- NSFDbClose( db_handle );
- NotesTerm();
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto string notes_search(string database_name, string keywords )
- Find notes that match keywords in database_name
- The note(s) that are returned must be converted to base 16
- Example base_convert( $note_id, "10", "16" ) */
-
-STATUS LNPUBLIC file_action (void *, SEARCH_MATCH *, ITEM_TABLE *);
-STATUS LNPUBLIC print_file_summary (ITEM_TABLE *);
-
-
-PHP_FUNCTION(notes_search){
-
- int argc;
- pval *argv[2];
- STATUS error;
- DBHANDLE db_handle;
- HANDLE search_handle; /* handle to a search */
- pval **db;
- pval **keywords;
- char error_string[200];
- FT_INDEX_STATS Stats; /* statistics from FTIndex */
- DWORD RetDocs; /* number of documents returned by the search */
- HANDLE SearchResults_handle; /* handle to the results of the search */
- FT_SEARCH_RESULTS *pSearchResults; /* pointer to the results of the search */
- HANDLE IDTable_handle; /* handle to id table built with found NOTEIDs */
- NOTEID *pNoteID; /* pointer to the NOTEIDs found */
- BYTE *pScores; /* pointer to the scores */
- DWORD i;
-
- argc = ARG_COUNT(ht);
-
- if (getParametersArray(ht, argc, argv) == FAILURE){
-
- WRONG_PARAM_COUNT;
- }
-
- if (zend_get_parameters_ex(2, &db, &keywords)==FAILURE) {
- RETURN_FALSE;
- }
-
- convert_to_string_ex(db);
- convert_to_string_ex(keywords);
-
- error = NotesInitExtended( argc, (char **) argv );
-
- if( error ){
-
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Unable to initialize Lotus Notes: %s", error_string);
- RETURN_FALSE;
- }
-
- if (error = NSFDbOpen ((*db)->value.str.val, &db_handle)){
-
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Unable to open database: %s", error_string);
- NotesTerm();
- RETURN_FALSE;
- }
-
- error = FTIndex(db_handle, FT_INDEX_AUTOOPTIONS, NULL, &Stats);
- if (error){
-
- NSFDbClose (db_handle);
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Unable to search database: %s", error_string);
- NotesTerm();
- RETURN_FALSE;
- }
-
- if (error = FTOpenSearch(&search_handle)){
-
- NSFDbClose (db_handle);
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Unable to open search: %s", error_string);
- NotesTerm();
- RETURN_FALSE;
- }
-
- /* do the search on the query */
- error = FTSearch (db_handle, /* database handle */
- &search_handle, /* pointer to previously
- allocated search handle */
- (HCOLLECTION) NULLHANDLE, /* no collection specified -
- query all docs */
- (*keywords)->value.str.val, /* query string */
- FT_SEARCH_SCORES | /* find relevancy scores */
- FT_SEARCH_STEM_WORDS, /* find word variants */
- 0, /* maximum number of docs to
- return; 0 = unlimited */
- NULLHANDLE, /* no refining IDTABLE */
- &RetDocs, /* returned number of docs */
- NULL, /* reserved */
- &SearchResults_handle); /* returned info */
- if (error){
-
- FTCloseSearch (search_handle);
- NSFDbClose (db_handle);
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Error during searchkkk: %s", error_string);
- NotesTerm();
- RETURN_FALSE;
- }
-
- /* return if no document in the result */
- if (RetDocs == 0 )
- {
- php_printf("\n0 documents returned \n");
- FTCloseSearch (search_handle);
- NSFDbClose (db_handle);
- NotesTerm();
- RETURN_FALSE;
- }
-
- pSearchResults = OSLock (FT_SEARCH_RESULTS, SearchResults_handle);
-
- /* Create an IDTABLE to further refine our search */
-
- if (error = IDCreateTable(sizeof(NOTEID), &IDTable_handle))
- {
- FTCloseSearch (search_handle);
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Error creating ID table: %s", error_string);
- NSFDbClose (db_handle);
- NotesTerm();
- RETURN_FALSE;
- }
-
- /* set up a pointer to the array of note id's that occur after
- the FT_SEARCH_RESULTS structure */
-
- pNoteID = (NOTEID *) (((char *) pSearchResults)
- + sizeof(FT_SEARCH_RESULTS));
-
- pScores = (BYTE *) (pNoteID + pSearchResults->NumHits);
- for (i = 0; i < pSearchResults->NumHits; i++, pNoteID++, pScores++)
- {
- /* save the note ids in the IDTABLE */
-
- if (error = IDInsert (IDTable_handle, *pNoteID, NULL))
- {
-
- OSUnlockObject(SearchResults_handle);
- OSMemFree (SearchResults_handle);
- FTCloseSearch (search_handle);
- IDDestroyTable (IDTable_handle);
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Error saving note to ID table: %s", error_string);
- NSFDbClose (db_handle);
- NotesTerm();
- RETURN_FALSE;
- }
- }
-
- OSUnlockObject(SearchResults_handle);
- OSMemFree (SearchResults_handle);
-
- if (error = FTCloseSearch(search_handle))
- {
- IDDestroyTable (IDTable_handle);
- NSFDbClose (db_handle);
- NotesTerm();
- RETURN_FALSE;
- }
-
- if (error = FTOpenSearch(&search_handle))
- {
- NSFDbClose (db_handle);
- NotesTerm();
- RETURN_FALSE;
- }
-
- /* do the refined search on the query with no word variants */
-
- error = FTSearch (db_handle, /* database handle */
- &search_handle, /* pointer to previously
- allocated search handle */
- (HCOLLECTION) NULLHANDLE, /* no collection specified -
- query all docs */
- (*keywords)->value.str.val, /* query string */
- FT_SEARCH_SCORES | /* find relevancy scores */
- FT_SEARCH_REFINE, /* refine the search - use the
- * given id table */
- 0, /* maximum number of docs to
- return; 0 = unlimited */
- IDTable_handle, /* refining IDTABLE */
- &RetDocs, /* returned number of docs */
- NULL, /* reserved */
- &SearchResults_handle); /* returned info */
- if (error)
- {
- FTCloseSearch (search_handle);
- IDDestroyTable (IDTable_handle);
- NSFDbClose (db_handle);
- NotesTerm();
- RETURN_FALSE;
- }
-
- /* return if no document in the result */
- if (RetDocs == 0 )
- {
- php_printf("\n0 documents returned \n");
- FTCloseSearch (search_handle);
- IDDestroyTable (IDTable_handle);
- NSFDbClose (db_handle);
- NotesTerm();
- RETURN_FALSE;
- }
-
- /* obtain a pointer to the search results */
- pSearchResults = OSLock (FT_SEARCH_RESULTS, SearchResults_handle);
-
- /* set up a pointer to the array of note id's that occur after
- the FT_SEARCH_RESULTS structure */
-
- pNoteID = (NOTEID *) (((char *) pSearchResults)
- + sizeof(FT_SEARCH_RESULTS));
-
- //pSearchResults->NumHits
- array_init(return_value);
-
- pScores = (BYTE *) (pNoteID + pSearchResults->NumHits);
- for (i = 0; i < pSearchResults->NumHits; i++, pNoteID++, pScores++){
-
- add_next_index_long(return_value, (long) *pNoteID );
- //RETVAL_LONG( (long) *pNoteID );
- }
-
- OSUnlockObject (SearchResults_handle);
- OSMemFree (SearchResults_handle);
- IDDestroyTable (IDTable_handle);
-
- if (error = FTCloseSearch(search_handle))
- {
- NSFDbClose (db_handle);
- NotesTerm();
- RETURN_FALSE;
- }
-
- NSFDbClose (db_handle);
- NotesTerm();
-}
-/* }}} */
-
-/* {{{ proto string notes_copy_db(string from_database_name, string to_database_name [, title])
- Create a note using form form_name */
-PHP_FUNCTION(notes_copy_db)
-{
-
- int argc;
- pval *argv[3];
- STATUS error;
- DBHANDLE input_handle;
- DBHANDLE output_handle;
- char error_string[200];
- pval **db_input;
- pval **db_output;
- pval **title;
- DBREPLICAINFO replica_info; /* replication info for the databases */
- char output_db_info[NSF_INFO_SIZE]; /* database info buffer */
- TIMEDATE start_time; /* time and date used to control what
- notes we copy */
- TIMEDATE last_time; /* returned from
- NSFDbGetModifiedNoteTable */
- DBID input_dbid; /* dbid of input database */
- DBID output_dbid; /* dbid of output database */
- HANDLE idtable_p; /* handle to id table */
- DWORD num_scanned, num_entries;
- NOTEID note_id;
- NOTEHANDLE hIconNote; /* handle to the icon note */
-
- argc = ARG_COUNT(ht);
-
- if (getParametersArray(ht, argc, argv) == FAILURE){
-
- WRONG_PARAM_COUNT;
- }
-
- if (zend_get_parameters_ex(3, &db_input, &db_output, &title)==FAILURE) {
- RETURN_FALSE;
- }
-
- convert_to_string_ex(db_input);
- convert_to_string_ex(db_output);
- convert_to_string_ex(title);
-
- error = NotesInitExtended( argc, (char **) argv );
-
- if( error ){
-
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Unable to initialize Lotus Notes: %s", error_string);
- RETURN_FALSE;
- }
-
-/* Open the input database. */
-
- if (error = NSFDbOpen ((*db_input)->value.str.val, &input_handle)){
-
- NSFDbClose (input_handle);
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Unable to open input database: %s", error_string);
- NotesTerm();
- RETURN_FALSE;
- }
-
-/* Create and open the output database. */
-
- if (error = NSFDbCreate ((*db_output)->value.str.val, DBCLASS_NOTEFILE, FALSE))
- {
- NSFDbClose (input_handle);
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Unable to create database: %s", error_string);
- NotesTerm();
- RETURN_FALSE;
- }
-
- if (error = NSFDbOpen ((*db_output)->value.str.val, &output_handle))
- {
- NSFDbClose (input_handle);
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Error opening output database: %s", error_string);
- NotesTerm();
- RETURN_FALSE;
- }
-
-
-/* Copy the replication settings (not the replication history) from
-the input database to the output database. The replication settings
-include the database replica ID. This makes the destination database
-a replica copy of the source database. */
-
- if (error = NSFDbReplicaInfoGet (input_handle, &replica_info))
- {
- NSFDbClose (input_handle);
- NSFDbClose (output_handle);
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Error copying replication information: %s", error_string);
- NotesTerm();
- RETURN_FALSE;
- }
-
-/* Copy the ACL from the input database to the output database. */
-
- if (error = NSFDbCopyACL (input_handle, output_handle))
- {
- NSFDbClose (input_handle);
- NSFDbClose (output_handle);
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Error copying ACL: %s", error_string);
- NotesTerm();
- RETURN_FALSE;
- }
-
-/* Set a time/date structure that will determine the date of the earliest
-note copied in the next call. Use TimeConstant with TIMEDATE_WILDCARD
-specified to indicate that we do not want any cutoff date. */
-
- TimeConstant (TIMEDATE_WILDCARD, &start_time);
-
-/* Do not use NSFDbCopy to copy all notes in the input database to the
- output database. Such copies are not guaranteed to be replicas of
- the original notes. Instead get an IDTABLE of all notes in the
- database, use IDScan to obtain each NOTEID, and then call
- NSFDbCopyNote to copy each note from one database to the other.
-*/
-
- NSFDbIDGet (input_handle, &input_dbid);
- NSFDbIDGet (output_handle, &output_dbid);
-
-
-/* Get the NoteID table for all notes in the input database */
- if (error = NSFDbGetModifiedNoteTable (input_handle,
- NOTE_CLASS_ALL,
- start_time, &last_time,
- &idtable_p) )
- if (error == ERR_NO_MODIFIED_NOTES){
- NSFDbClose (input_handle);
- NSFDbClose (output_handle);
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_NOTICE,"There are no documents in the Database: %s", error_string);
- NotesTerm();
- RETURN_TRUE;
- }
- else
- {
- NSFDbClose (input_handle);
- NSFDbClose (output_handle);
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Error copying replication information: %s", error_string);
- NotesTerm();
- RETURN_FALSE;
- }
- num_scanned = 0L;
- num_entries = IDEntries (idtable_p);
- if (num_entries)
- while (IDScan (idtable_p, (FLAG)(num_scanned++ == 0), &note_id) )
- if (error = NSFDbCopyNote (input_handle, &input_dbid,
- &replica_info.ID, note_id,
- output_handle, &output_dbid,
- &replica_info.ID, NULL,
- NULL) )
- {
- IDDestroyTable (idtable_p);
- NSFDbClose (input_handle);
- NSFDbClose (output_handle);
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Error copying notes: %s", error_string);
- NotesTerm();
- RETURN_FALSE;
- }
- IDDestroyTable (idtable_p);
-
-/* Now we can change the title of the output database
- by following these steps:
-
- - Get the info buffer of the database (NSFDbInfoGet);
- - Modify the title information in the buffer (NSFDbInfoModify);
- - Write the modified info buffer into the database (NSFDbInfoSet);
- - If necessary, update the ICON note with the updated database
- information buffer. This is required for databases created from
- a template.
-*/
-
-/* Clear out the database information buffer */
- output_db_info[0] = '\0';
-
-/* Get the output database information buffer. */
-
- if (error = NSFDbInfoGet (output_handle, output_db_info))
- {
- NSFDbClose (input_handle);
- NSFDbClose (output_handle);
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Error getting output database information buffer: %s", error_string);
- NotesTerm();
- RETURN_FALSE;
- }
-
-/* Add the database title to the database information buffer */
-
- NSFDbInfoModify (output_db_info, INFOPARSE_TITLE, (*title)->value.str.val);
- if (error = NSFDbInfoSet (output_handle, output_db_info))
- {
- NSFDbClose (input_handle);
- NSFDbClose (output_handle);
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Error adding the database title to the buffer: %s", error_string);
- NotesTerm();
- RETURN_FALSE;
- }
-
-/* If creating a new database from a template, in order to change
- the database title or any other component of the database information
- buffer, you also need to update this information in the ICON
- note after updating it in the database information buffer. */
-
- if (!NSFNoteOpen(output_handle, NOTE_ID_SPECIAL+NOTE_CLASS_ICON,
- 0, &hIconNote))
- {
-
- /* Update the FIELD_TITLE ("$TITLE") field if present */
- if (NSFItemIsPresent (hIconNote, FIELD_TITLE, (WORD) strlen (FIELD_TITLE)) )
- {
- NSFItemSetText(hIconNote, FIELD_TITLE, output_db_info, MAXWORD);
- NSFNoteUpdate(hIconNote, 0);
- }
- NSFNoteClose(hIconNote);
- }
-
-
-/* Close the databases. */
-
- if (error = NSFDbClose (input_handle))
- {
- NSFDbClose (output_handle);
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Error closing the input database: %s", error_string);
- NotesTerm();
- RETURN_FALSE;
- }
-
- if (error = NSFDbClose (output_handle)){
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Error closing the output database: %s", error_string);
- NotesTerm();
- RETURN_FALSE;
- }
-
- NotesTerm();
- RETURN_TRUE;
-}
-/* }}} */
-
-
-
-
-
-
-
-
-
-
-
-/* {{{ proto string notes_list(string database_name)
- Returns the notes from a selected database_name
- */
-
-STATUS LNPUBLIC ReadSummaryData ( /* called for every document */
- VOID far *,
- SEARCH_MATCH far *,
- ITEM_TABLE far *);
-STATUS PrintSummary (char *);
-STATUS ExtractTextList (char *, char *);
-
-/* Constants */
-/* Notes imposes a 32K max summary buffer total size. Therefore,
- 34K will safely store the printable text rendering of any single
- item.
-*/
-#define MAX_ITEM_LEN 34816
-
-/* The maximum number of items in the summary buffer of a single note
- is limited to the number of ITEM structures that will fit in 32K.
-*/
-#define MAX_ITEMS 32768/sizeof(ITEM)
-
-#define MAX_ITEM_NAME_LEN DESIGN_NAME_MAX
-
-/* Global variables */
-ITEM Items[MAX_ITEMS]; /* Stores the array of ITEMs */
-char ItemText[MAX_ITEM_LEN]; /* Text rendering of item value */
-char ItemName[MAX_ITEM_NAME_LEN];/* Zero terminated item name */
-
-
-PHP_FUNCTION(notes_list_msgs){
-
- int argc;
- pval *argv[1];
-
- STATUS error;
- DBHANDLE db_handle;
- char error_string[200];
-
- pval **db;
-
- argc = ARG_COUNT(ht);
-
- if (getParametersArray(ht, argc, argv) == FAILURE){
-
- WRONG_PARAM_COUNT;
- }
-
- if (zend_get_parameters_ex(1, &db)==FAILURE) {
- RETURN_FALSE;
- }
-
- convert_to_string_ex(db);
-
- error = NotesInitExtended( argc, (char **) argv );
-
- if( error ){
-
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Unable to initialize Lotus Notes: %s", error_string);
- RETURN_FALSE;
- }
-
- if (error = NSFDbOpen ((*db)->value.str.val, &db_handle)){
-
- NSFDbClose (db_handle);
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Unable to open database: %s", error_string);
- NotesTerm();
- RETURN_FALSE;
- }
-
- /* Call NSFSearch to find all data notes in the database.
- Specify search flag SEARCH_SUMMARY so that the action
- routine gets passed the summary buffer as input.
- */
-
- if (error = NSFSearch (
- db_handle, /* database handle */
- NULLHANDLE, /* selection formula */
- NULL, /* title of view in selection formula */
- SEARCH_SUMMARY, /* search flags: get summary data! */
- NOTE_CLASS_DATA, /* note class to find */
- NULL, /* starting date (unused) */
- ReadSummaryData, /* action routine for notes found */
- NULL, /* argument to action routine */
- NULL)) /* returned ending date (unused) */
-
- {
- NSFDbClose (db_handle);
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Unable to search database: %s", error_string);
- NotesTerm();
- RETURN_FALSE;
- }
-
- if (error = NSFDbClose (db_handle))
- {
- NSFDbClose (db_handle);
- OSLoadString(NULLHANDLE, ERR(error), error_string, sizeof(error_string));
- php_error(E_WARNING,"Unable to close database: %s", error_string);
- NotesTerm();
- RETURN_FALSE;
- }
-
- RETURN_TRUE
-}
-
-STATUS LNPUBLIC ReadSummaryData
- (VOID far *optional_param,
- SEARCH_MATCH far *search_info,
- ITEM_TABLE far *summary_info)
-{
- SEARCH_MATCH SearchMatch;
- STATUS error;
-
- memcpy ((char*)(&SearchMatch), (char *)search_info, sizeof(SEARCH_MATCH));
-
- if (!(SearchMatch.SERetFlags & SE_FMATCH))
- return (NOERROR);
-
- /* Print the note ID. */
-
- php_printf ("\nNote ID is: %lX.\n<br>", SearchMatch.ID.NoteID);
-
- /* Print the summary data. */
-
- if (error = PrintSummary( (char*)summary_info ))
- return (error);
-
- return (NOERROR);
-}
-
-
-/************************************************************************
-
- FUNCTION: PrintSummary
-
- PURPOSE: Print all the items in a summary buffer.
-
- INPUTS:
- pSummary - a pointer to the summary buffer for one note.
-
- DESCRIPTION:
- The information in a summary buffer consists of an ITEM_TABLE
- structure, followed by an array of ITEM structures, followed by
- a packed sequence of field names and item values.
-
- ITEM_TABLE
- ITEM 1
- ITEM 2
- ...
- ITEM N
- name of item 1
- value of item 1
- name of item 2
- value of item 2
- ...
- name of item N
- value if item N
-
- Item names are not zero terminated. Each item value starts with
- a data type word. The lengths of the item names and item values
- will vary. The NameLength member of the ITEM structure specifies
- the length of the corresponding name, and the ValueLength member
- of the ITEM structure specifies the length of the item value.
- The ValueLength includes the length of the data type word.
-
- Note that this summary buffer differs in format from the buffer
- parsed by sample program VIEWSUMM. VIEWSUMM calls NIFReadEntries
- specifying READ_MASK_SUMMARYVALUES, which yields a buffer with
- format specified by ITEM_VALUE_TABLE rather than ITEM_TABLE.
-
- This function can parse the summary buffer of any data note
- because it does not assume the note contains items with any
- particular names. If you know the item name in advance, use
- either NSFGetSummaryValue() or NSFLocateSummaryValue().
-
-*************************************************************************/
-
-
-STATUS PrintSummary (char *pSummary)
-{
- char *pSummaryPos; /* current position in pSummary */
- ITEM_TABLE ItemTable; /* header at start of pSummary */
- USHORT ItemCount; /* number of items in pSummary */
- USHORT NameLength; /* length of item name w/out terminator*/
- USHORT ValueLength; /* length of item value, incl. type */
- WORD DataType; /* item data type word */
- char *szDataType; /* printable data type name */
- USHORT TextLen; /* length of printable item text */
- NUMBER NumericItem; /* an item of type TYPE_NUMBER */
- NUMBER_PAIR NumberPair; /* part of item of TYPE_NUMBER_RANGE */
- RANGE Range; /* part of item of TYPE_NUMBER_RANGE */
- TIMEDATE TimeItem; /* a time/date item */
- TIMEDATE_PAIR TimePairItem; /* part of time/date list or range */
- WORD TimeStringLen; /* length of ASCII time/date */
- STATUS error; /* return code from API calls */
- USHORT i; /* counter for loop over items */
- USHORT j; /* " " " " multi-valued items */
-
- /* Initialize pSummaryPos to the position of the beginning of
- the summary buffer. Keep pSummary unmodified. Modify pSummaryPos.
- */
-
- pSummaryPos = pSummary;
-
- /* Copy the ITEM_TABLE header at the beginning of the summary buffer
- to a local variable. Advance pSummaryPos to point to the next
- byte in the summary buffer after the ITEM_TABLE.
- */
- memcpy ((char*)(&ItemTable), pSummaryPos, sizeof(ITEM_TABLE));
- pSummaryPos += sizeof(ItemTable);
-
- /* pSummaryPos now points to the first ITEM in an array of ITEM
- structures. Copy this array of ITEM structures into the global
- Items[] array.
- */
-
- ItemCount = ItemTable.Items;
-
- for (i=0; i < ItemCount; i++)
- {
- memcpy((char*)(&Items[i]), pSummaryPos, sizeof(ITEM));
- pSummaryPos += sizeof(ITEM);
- }
-
- /* pSummaryPos now points to the first item name. Loop over each
- item, copying the item name into the ItemName variable and
- converting the item value to printable text in ItemText.
- */
-
- for (i=0; i < ItemCount; i++)
- {
- /* zero out two global arrays that we re-use for each item */
- memset (ItemText, 0, MAX_ITEM_LEN);
- memset (ItemName, 0, MAX_ITEM_NAME_LEN);
-
- NameLength = Items[i].NameLength;
- memcpy (ItemName, pSummaryPos, NameLength);
- ItemName[NameLength] = '\0';
- pSummaryPos += NameLength;
-
- /* Handle the case of a zero length item */
-
- if (Items[i].ValueLength == 0)
- {
- strcpy(ItemName, " * ");
- ItemText[0] = '\0';
- goto PrintItem;
- }
-
- /* pSummaryPos now points to the item value. First get the
- data type. Then step over the data type word to the data
- value and convert the value to printable text. Store the
- text in ItemText.
- */
-
- memcpy ((char*)(&DataType), pSummaryPos, sizeof(WORD));
- pSummaryPos += sizeof(WORD);
-
- ValueLength = Items[i].ValueLength - sizeof(WORD);
-
- /* The way to extract an item depends on the data type. */
-
- switch (DataType)
- {
- case TYPE_TEXT:
- szDataType = "TYPE_TEXT";
- memcpy (ItemText, pSummaryPos, ValueLength);
- ItemText[ValueLength] = '\0';
- pSummaryPos += ValueLength;
- break;
-
- case TYPE_TEXT_LIST:
- szDataType = "TYPE_TEXT_LIST";
- if (error = ExtractTextList (pSummaryPos, ItemText))
- {
- printf ("Error: unable to extract text list.\n");
- ItemText[0] = '\0';
- }
- pSummaryPos += ValueLength;
- break;
-
- case TYPE_NUMBER:
- szDataType = "TYPE_NUMBER";
- memcpy ((char *)(&NumericItem), pSummaryPos, sizeof(NUMBER));
- sprintf (ItemText, "%f", NumericItem);
- pSummaryPos += sizeof(NUMBER);
- break;
-
- case TYPE_NUMBER_RANGE:
- szDataType = "TYPE_NUMBER_RANGE";
- TextLen = 0;
- memcpy ((char*)(&Range), pSummaryPos, sizeof(RANGE));
- pSummaryPos += sizeof(RANGE);
- for (j=0; j < Range.ListEntries; j++)
- {
- memcpy ((char*)(&NumericItem), pSummaryPos,
- sizeof(NUMBER));
- sprintf (ItemText+TextLen, "%f ", NumericItem);
- pSummaryPos += sizeof(NUMBER);
- TextLen = strlen(ItemText);
- }
- if ((Range.ListEntries != 0) && (Range.RangeEntries != 0))
- {
- memcpy (ItemText+TextLen, "; ", 2);
- TextLen += 2;
- }
- for (j=0; j < Range.RangeEntries; j++)
- {
- memcpy ((char*)(&NumberPair), pSummaryPos,
- sizeof(NUMBER_PAIR));
- sprintf (ItemText+TextLen, "%f - %f ", NumberPair.Lower,
- NumberPair.Upper);
- pSummaryPos += sizeof(NUMBER_PAIR);
- TextLen = strlen(ItemText);
- }
- break;
-
-#ifndef APITESTMODE
-
- case TYPE_TIME:
- szDataType = "TYPE_TIME";
- memcpy ((char*)(&TimeItem), pSummaryPos, sizeof(TIMEDATE));
- pSummaryPos += sizeof(TIMEDATE);
- if (error = ConvertTIMEDATEToText (
- NULL, NULL, &TimeItem,
- ItemText, MAXALPHATIMEDATE,
- &TimeStringLen))
- {
- printf ("Error: unable to convert TIMEDATE to text.\n");
- TimeStringLen = 0;
- }
- ItemText[TimeStringLen] = '\0';
- break;
-
- case TYPE_TIME_RANGE:
- szDataType = "TYPE_TIME_RANGE";
- TextLen = 0;
- memcpy ((char*)(&Range), pSummaryPos, sizeof(RANGE));
- pSummaryPos += sizeof(RANGE);
- for (j=0; j < Range.ListEntries; j++)
- {
- if (j != 0)
- {
- memcpy (ItemText+TextLen, ",", 1);
- TextLen++;
- }
- memcpy ((char*)(&TimeItem), pSummaryPos,
- sizeof(TIMEDATE));
- pSummaryPos += sizeof(TIMEDATE);
- if (error = ConvertTIMEDATEToText (
- NULL, NULL,
- &TimeItem,
- ItemText+TextLen,
- MAXALPHATIMEDATE, &TimeStringLen))
- {
- printf("Error: unable to convert TIMEDATE to text.\n");
- TimeStringLen = 0;
- }
- TextLen += TimeStringLen;
- }
-
- if (Range.RangeEntries == 0)
- {
- ItemText[TextLen] = '\0';
- break;
- }
-
- /* Append a space, semicolon, space to separate time/dates
- from time/date ranges.
- */
-
- memcpy (ItemText+TextLen, " ; ", 3);
- TextLen += 3;
-
- for (j=0; j < Range.RangeEntries; j++)
-
- {
- if (j != 0)
- {
- memcpy (ItemText+TextLen, ",", 1);
- TextLen++;
- }
- memcpy ((char*)&TimePairItem, pSummaryPos,
- sizeof(TIMEDATE_PAIR));
- pSummaryPos += sizeof(TIMEDATE_PAIR);
- if (error = ConvertTIMEDATEToText (
- NULL, NULL,
- &TimePairItem.Lower, ItemText+TextLen,
- MAXALPHATIMEDATE, &TimeStringLen))
- {
- printf("Error: unable to convert TIMEDATE to text.\n");
- TimeStringLen = 0;
- }
- TextLen += TimeStringLen;
- memcpy (ItemText+TextLen, "-", 1);
- TextLen++;
- if (error = ConvertTIMEDATEToText (
- NULL, NULL,
- &TimePairItem.Upper, ItemText+TextLen,
- MAXALPHATIMEDATE, &TimeStringLen))
- {
- printf("Error: unable to convert TIMEDATE to text.\n");
- TimeStringLen = 0;
- }
- TextLen += TimeStringLen;
- }
- ItemText[TextLen] = '\0'; /* zero terminate the text */
- break;
-
-#endif
- /* Item is not one of the data types this program handles. */
-
- default:
- szDataType = "Unrecognized";
- ItemText[0] = '\0';
- pSummaryPos += ValueLength;
- break;
- } /* end of switch on data type */
-
-PrintItem:
- /* Print the item name, data type, and value. */
- printf ("\tItem Name = %s\n", ItemName);
- printf ("\tData Type = %s\n", szDataType);
-
-#ifndef APITESTMODE
- printf ("\tItem Value = \"%s\"\n\n", ItemText);
-#else
- if (strcmp(ItemName,"$UpdatedBy")==0)
- printf ("\tItem Value =\n\n", ItemText);
- else
- printf ("\tItem Value = \"%s\"\n\n", ItemText);
-#endif
-
- }/* End of loop over items in the summary. */
-
- /* Print final line feed to end display for this note. */
-
- printf ("\n");
-
- return (NOERROR);
-}
-
-/************************************************************************
-
- FUNCTION: ExtractTextList
-
- PURPOSE: This function extracts an item of TYPE_TEXT_LIST from a
- pSummary buffer.
-
- INPUTS: char *pBuffer
-
- OUTPUTS: char *TextList
-
-*************************************************************************/
-
-STATUS ExtractTextList (char *pBuffer, char *TextList)
-{
- LIST List;
- char *ListEntry; /* pointer to list entry */
- WORD TextLen; /* total length of string output to TextList */
- WORD EntryLen; /* length of one entry */
- STATUS error; /* return code from API calls */
- USHORT i; /* a counter */
-
- /* Initialize the total length of the list. */
-
- TextLen = 0;
-
- /* Clear the string that we'll fill up. */
-
- TextList[0] = '\0';
-
- /* Get the list header structure with the number of entries. */
-
- memcpy ((char*)(&List), pBuffer, sizeof(LIST));
-
- /* Loop over each entry of the list. */
-
- for (i=0; i<List.ListEntries; i++)
- {
- /* Get one entry from the list. */
-
- if (error = ListGetText (
- pBuffer,
- FALSE, /* DataType not prepended to list */
- i,
- &ListEntry,
- &EntryLen))
- {
- return (ERR(error));
- }
-
- /* Copy this entry to the string we are building and move the
- pointer that keeps track of how much we have in the string.
- */
-
- memcpy (TextList+TextLen, ListEntry, EntryLen);
- TextLen += EntryLen;
-
- /* Put a comma after the entry and advance the text length. */
-
- memcpy (TextList+TextLen, ",", 1);
- TextLen++;
-
- } /* End of loop over list entries. */
-
- /* Put a null in place of the last comma */
-
- TextLen--;
- memcpy (TextList+TextLen, "\0", 1);
-
- return (NOERROR);
-}
-
-/* }}} */
-
-
-
-
diff --git a/ext/notes/php_notes.h b/ext/notes/php_notes.h
deleted file mode 100644
index e7412a63e8..0000000000
--- a/ext/notes/php_notes.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.01 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_01.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Brad Atkins <brad@youreshop.com> |
- +----------------------------------------------------------------------+
-*/
-
-
-/* $Id$ */
-
-extern zend_module_entry notes_module_entry;
-
-#define notes_module_ptr &notes_module_entry
-
-extern PHP_MINIT_FUNCTION(notes);
-extern PHP_MSHUTDOWN_FUNCTION(notes);
-extern PHP_RINIT_FUNCTION(notes);
-extern PHP_RSHUTDOWN_FUNCTION(notes);
-PHP_MINFO_FUNCTION(notes);
-
-PHP_FUNCTION(notes_create_db);
-PHP_FUNCTION(notes_drop_db);
-PHP_FUNCTION(notes_version);
-PHP_FUNCTION(notes_create_note);
-PHP_FUNCTION(notes_unread);
-PHP_FUNCTION(notes_mark_read);
-PHP_FUNCTION(notes_mark_unread);
-PHP_FUNCTION(notes_header_info);
-PHP_FUNCTION(notes_body);
-PHP_FUNCTION(notes_find_note);
-PHP_FUNCTION(notes_nav_create);
-PHP_FUNCTION(notes_search);
-PHP_FUNCTION(notes_copy_db);
-PHP_FUNCTION(notes_list_msgs);
-
-#define phpext_notes_ptr notes_module_ptr
diff --git a/ext/oci8/CREDITS b/ext/oci8/CREDITS
deleted file mode 100644
index 30c88be459..0000000000
--- a/ext/oci8/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-OCI8
-Stig Bakken, Thies C. Arntzen, Andy Sautins, David Benson
diff --git a/ext/oci8/Makefile.in b/ext/oci8/Makefile.in
deleted file mode 100644
index 4e34b2fc13..0000000000
--- a/ext/oci8/Makefile.in
+++ /dev/null
@@ -1,6 +0,0 @@
-LTLIBRARY_NAME = liboci8.la
-LTLIBRARY_SOURCES = oci8.c
-LTLIBRARY_SHARED_NAME = oci8.la
-LTLIBRARY_SHARED_LIBADD = $(OCI8_SHARED_LIBADD)
-
-include $(top_srcdir)/build/dynlib.mk
diff --git a/ext/oci8/config.m4 b/ext/oci8/config.m4
deleted file mode 100644
index 246a7ce641..0000000000
--- a/ext/oci8/config.m4
+++ /dev/null
@@ -1,90 +0,0 @@
-dnl $Id$
-
-AC_DEFUN(AC_OCI8_VERSION,[
- AC_MSG_CHECKING([Oracle version])
- if test -s "$OCI8_DIR/orainst/unix.rgs"; then
- OCI8_VERSION=`grep '"ocommon"' $OCI8_DIR/orainst/unix.rgs | sed 's/[ ][ ]*/:/g' | cut -d: -f 6 | cut -c 2-4`
- test -z "$OCI8_VERSION" && OCI8_VERSION=7.3
- elif test -f $OCI8_DIR/lib/libclntsh.s?.8.0; then
- OCI8_VERSION=8.1
- elif test -f $OCI8_DIR/lib/libclntsh.s?.1.0; then
- OCI8_VERSION=8.0
- elif test -f $OCI8_DIR/lib/libclntsh.a; then
- if test -f $OCI8_DIR/lib/libcore4.a; then
- OCI8_VERSION=8.0
- else
- OCI8_VERSION=8.1
- fi
- else
- AC_MSG_ERROR(Oracle-OCI8 needed libraries not found)
- fi
- AC_MSG_RESULT($OCI8_VERSION)
-])
-
-PHP_ARG_WITH(oci8, for Oracle-OCI8 support,
-[ --with-oci8[=DIR] Include Oracle-oci8 support. Default DIR is
- ORACLE_HOME.])
-
-if test "$PHP_OCI8" != "no"; then
- AC_MSG_CHECKING([Oracle Install-Dir])
- if test "$PHP_OCI8" = "yes"; then
- OCI8_DIR=$ORACLE_HOME
- else
- OCI8_DIR=$PHP_OCI8
- fi
- AC_MSG_RESULT($OCI8_DIR)
-
- if test "$PHP_SIGCHILD" != "yes"; then
- echo "+--------------------------------------------------------------------+"
- echo "| Notice: |"
- echo "| If you encounter <defunc> processes when using a local Oracle-DB |"
- echo "| please recompile PHP and specify --enable-sigchild when configuring|"
- echo "| (This problem has been reported un Linux using Oracle >= 8.1.5) |"
- echo "+--------------------------------------------------------------------+"
- fi
-
- if test -d "$OCI8_DIR/rdbms/public"; then
- PHP_ADD_INCLUDE($OCI8_DIR/rdbms/public)
- fi
- if test -d "$OCI8_DIR/rdbms/demo"; then
- PHP_ADD_INCLUDE($OCI8_DIR/rdbms/demo)
- fi
- if test -d "$OCI8_DIR/network/public"; then
- PHP_ADD_INCLUDE($OCI8_DIR/network/public)
- fi
- if test -d "$OCI8_DIR/plsql/public"; then
- PHP_ADD_INCLUDE($OCI8_DIR/plsql/public)
- fi
-
- if test -f "$OCI8_DIR/lib/sysliblist"; then
- PHP_EVAL_LIBLINE(`cat $OCI8_DIR/lib/sysliblist`, OCI8_SYSLIB)
- elif test -f "$OCI8_DIR/rdbms/lib/sysliblist"; then
- PHP_EVAL_LIBLINE(`cat $OCI8_DIR/rdbms/lib/sysliblist`, OCI8_SYSLIB)
- fi
-
- AC_OCI8_VERSION($OCI8_DIR)
- case $OCI8_VERSION in
- 8.0)
- PHP_ADD_LIBRARY_WITH_PATH(nlsrtl3, "", OCI8_SHARED_LIBADD)
- PHP_ADD_LIBRARY_WITH_PATH(core4, "", OCI8_SHARED_LIBADD)
- PHP_ADD_LIBRARY_WITH_PATH(psa, "", OCI8_SHARED_LIBADD)
- PHP_ADD_LIBRARY_WITH_PATH(clntsh, $OCI8_DIR/lib, OCI8_SHARED_LIBADD)
- ;;
-
- 8.1)
- PHP_ADD_LIBRARY(clntsh, 1, OCI8_SHARED_LIBADD)
- PHP_ADD_LIBPATH($OCI8_DIR/lib, OCI8_SHARED_LIBADD)
- AC_DEFINE(HAVE_OCI8_TEMP_LOB,1,[ ])
- ;;
- *)
- AC_MSG_ERROR(Unsupported Oracle version!)
- ;;
- esac
-
- PHP_EXTENSION(oci8, $ext_shared)
- AC_DEFINE(HAVE_OCI8,1,[ ])
-
- PHP_SUBST_OLD(OCI8_SHARED_LIBADD)
- PHP_SUBST_OLD(OCI8_DIR)
- PHP_SUBST_OLD(OCI8_VERSION)
-fi
diff --git a/ext/oci8/oci8.c b/ext/oci8/oci8.c
deleted file mode 100644
index 6a43f3d7e3..0000000000
--- a/ext/oci8/oci8.c
+++ /dev/null
@@ -1,4927 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Stig Sæther Bakken <ssb@fast.no> |
- | Thies C. Arntzen <thies@thieso.net> |
- | |
- | Collection support by Andy Sautins <asautins@veripost.net> |
- | Temporary LOB support by David Benson <dbenson@mancala.com> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-/* TODO list:
- *
- * - php.ini flags
- * especialliy important for things like oci_ping
- * - Change return-value for OCIFetch*() (1-row read, 0-Normal end, false-error)
- * - Error mode (print or shut up?)
- * - OCIPasswordChange()
- * - binding of arrays
- * - Character sets for NCLOBS
- * - split the module into an upper (php-callable) and lower (c-callable) layer!
- * - remove all XXXs
- * - clean up and documentation
- * - make OCIInternalDebug accept a mask of flags....
- * - add some flags to OCIFetchStatement (maxrows etc...)
- * - have one ocifree() call.
- * - make it possible to have persistent statements?
- * - implement connection pooling in ZTS mode.
- * - implement automatic commit *OR* rollback on script end
- * - failover
- * - change all the lob stuff to work without classes (optional)!
- * - make sure that the callbacks terminate the strings with \0
- * - cleanup the ociexecute semantics for refcursors
- * - make $lob->savefile use O_BINARY
- * - line 2728: ub4 length = -1; needs fixing
- * - delay OCIInitialize() as far as we can.
- * - add PHP Array <-> OCICollection conversion
- * - add Collection iterator object for INDEX BY tables
- */
-
-/* {{{ includes & stuff */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "ext/standard/info.h"
-
-/* #define HAVE_OCI8_TEMP_LOB 1 */
-#define WITH_COLLECTIONS 1
-
-#if HAVE_OCI8
-
-#include "php_oci8.h"
-
-/* True globals, no need for thread safety */
-static int le_conn;
-static int le_stmt;
-static int le_desc;
-#ifdef WITH_COLLECTIONS
-static int le_coll;
-#endif
-static int le_server;
-static int le_session;
-static zend_class_entry *oci_lob_class_entry_ptr;
-#ifdef WITH_COLLECTIONS
-static zend_class_entry *oci_coll_class_entry_ptr;
-#endif
-
-#ifndef SQLT_BFILEE
-#define SQLT_BFILEE 114
-#endif
-#ifndef SQLT_CFILEE
-#define SQLT_CFILEE 115
-#endif
-
-#define SAFE_STRING(s) ((s)?(s):"")
-
-#ifndef PHP_WIN32
-#include "build-defs.h"
-#endif
-
-#include <fcntl.h>
-
-#ifndef O_BINARY
-#define O_BINARY 0
-#endif
-
-/* }}} */
-/* {{{ thread safety stuff */
-
-#ifdef ZTS
-int oci_globals_id;
-#else
-PHP_OCI_API php_oci_globals oci_globals;
-#endif
-
-/* }}} */
-/* {{{ dynamically loadable module stuff */
-
-#ifdef COMPILE_DL_OCI8
-ZEND_GET_MODULE(oci8)
-#endif /* COMPILE_DL */
-
-/* }}} */
-/* {{{ startup/shutdown/info/internal function prototypes */
-
-PHP_MINIT_FUNCTION(oci);
-PHP_RINIT_FUNCTION(oci);
-PHP_MSHUTDOWN_FUNCTION(oci);
-PHP_RSHUTDOWN_FUNCTION(oci);
-PHP_MINFO_FUNCTION(oci);
-
-static ub4 oci_handle_error(oci_connection *connection, ub4 errcode);
-static ub4 oci_error(OCIError *err_p, char *what, sword status);
-static int oci_ping(oci_server *server);
-static void oci_debug(const char *format, ...);
-
-static void _oci_conn_list_dtor(oci_connection *connection);
-static void _oci_stmt_list_dtor(zend_rsrc_list_entry *rsrc);
-static void _oci_descriptor_list_dtor(zend_rsrc_list_entry *rsrc);
-#ifdef WITH_COLLECTIONS
-static void _oci_coll_list_dtor(zend_rsrc_list_entry *rsrc);
-#endif
-static void _oci_server_list_dtor(zend_rsrc_list_entry *rsrc);
-static void _oci_session_list_dtor(zend_rsrc_list_entry *rsrc);
-static void php_oci_free_conn_list(zend_rsrc_list_entry *rsrc);
-
-static void _oci_column_hash_dtor(void *data);
-static void _oci_define_hash_dtor(void *data);
-static void _oci_bind_hash_dtor(void *data);
-
-static oci_connection *oci_get_conn(zval **);
-static oci_statement *oci_get_stmt(zval **);
-static oci_descriptor *oci_get_desc(int);
-#ifdef WITH_COLLECTIONS
-/* Questionable name. Very close to oci_get_col */
-static oci_collection *oci_get_coll(int);
-#endif
-static oci_out_column *oci_get_col(oci_statement *, int, zval **);
-
-static int _oci_make_zval(zval *, oci_statement *, oci_out_column *, char *, int mode);
-static oci_statement *oci_parse(oci_connection *, char *, int);
-static int oci_execute(oci_statement *, char *, ub4 mode);
-static int oci_fetch(oci_statement *, ub4, char *);
-static int oci_loadlob(oci_connection *, oci_descriptor *, char **, ub4 *length);
-static int oci_setprefetch(oci_statement *statement, int size);
-
-static void oci_do_connect(INTERNAL_FUNCTION_PARAMETERS,int persistent,int exclusive);
-
-static oci_server *_oci_open_server(char *dbname,int persistent);
-static void _oci_close_server(oci_server *server);
-
-static oci_session *_oci_open_session(oci_server* server,char *username,char *password,int persistent,int exclusive);
-static void _oci_close_session(oci_session *session);
-
-static sb4 oci_bind_in_callback(dvoid *, OCIBind *, ub4, ub4, dvoid **, ub4 *, ub1 *, dvoid **);
-static sb4 oci_bind_out_callback(dvoid *, OCIBind *, ub4, ub4, dvoid **, ub4 **, ub1 *, dvoid **, ub2 **);
-
-#if 0
-static sb4 oci_failover_callback(dvoid *svchp,dvoid* envhp,dvoid *fo_ctx,ub4 fo_type, ub4 fo_event);
-#endif
-
-/* }}} */
-/* {{{ extension function prototypes */
-
-PHP_FUNCTION(ocibindbyname);
-PHP_FUNCTION(ocidefinebyname);
-PHP_FUNCTION(ocicolumnisnull);
-PHP_FUNCTION(ocicolumnname);
-PHP_FUNCTION(ocicolumnsize);
-PHP_FUNCTION(ocicolumnscale);
-PHP_FUNCTION(ocicolumnprecision);
-PHP_FUNCTION(ocicolumntype);
-PHP_FUNCTION(ocicolumntyperaw);
-PHP_FUNCTION(ociexecute);
-PHP_FUNCTION(ocifetch);
-PHP_FUNCTION(ocicancel);
-PHP_FUNCTION(ocifetchinto);
-PHP_FUNCTION(ocifetchstatement);
-PHP_FUNCTION(ocifreestatement);
-PHP_FUNCTION(ociinternaldebug);
-PHP_FUNCTION(ocilogoff);
-PHP_FUNCTION(ocilogon);
-PHP_FUNCTION(ocinlogon);
-PHP_FUNCTION(ociplogon);
-PHP_FUNCTION(ocierror);
-PHP_FUNCTION(ocifreedesc);
-PHP_FUNCTION(ocisavelob);
-PHP_FUNCTION(ocisavelobfile);
-PHP_FUNCTION(ociloadlob);
-PHP_FUNCTION(ociwritelobtofile);
-PHP_FUNCTION(ocicommit);
-PHP_FUNCTION(ocirollback);
-PHP_FUNCTION(ocinewdescriptor);
-PHP_FUNCTION(ocinumcols);
-PHP_FUNCTION(ociparse);
-PHP_FUNCTION(ocinewcursor);
-PHP_FUNCTION(ociresult);
-PHP_FUNCTION(ociserverversion);
-PHP_FUNCTION(ocistatementtype);
-PHP_FUNCTION(ocirowcount);
-PHP_FUNCTION(ocisetprefetch);
-#ifdef HAVE_OCI8_TEMP_LOB
-PHP_FUNCTION(ociwritetemporarylob);
-PHP_FUNCTION(ocicloselob);
-#endif
-#ifdef WITH_COLLECTIONS
-PHP_FUNCTION(ocinewcollection);
-PHP_FUNCTION(ocifreecollection);
-PHP_FUNCTION(ocicollappend);
-PHP_FUNCTION(ocicollgetelem);
-PHP_FUNCTION(ocicollassignelem);
-PHP_FUNCTION(ocicollassign);
-PHP_FUNCTION(ocicollsize);
-PHP_FUNCTION(ocicollmax);
-PHP_FUNCTION(ocicolltrim);
-#endif
-
-#define OCI_GET_STMT(statement,value) \
- statement = oci_get_stmt(value); \
- if (statement == NULL) { \
- RETURN_FALSE; \
- }
-
-#define OCI_GET_CONN(connection,value) \
- connection = oci_get_conn(value); \
- if (connection == NULL) { \
- RETURN_FALSE; \
- }
-
-#define OCI_GET_DESC(descriptor,index) \
- descriptor = oci_get_desc(index); \
- if (descriptor == NULL) { \
- RETURN_FALSE; \
- }
-
-#ifdef WITH_COLLECTIONS
-#define OCI_GET_COLL(collection,index) \
- collection = oci_get_coll(index); \
- if (collection == NULL) { \
- RETURN_FALSE; \
- }
-#endif
-
-/* }}} */
-/* {{{ extension definition structures */
-
-#define OCI_ASSOC 1<<0
-#define OCI_NUM 1<<1
-#define OCI_BOTH (OCI_ASSOC|OCI_NUM)
-
-#define OCI_RETURN_NULLS 1<<2
-#define OCI_RETURN_LOBS 1<<3
-
-static unsigned char a3_arg_force_ref[] = { 3, BYREF_NONE, BYREF_NONE, BYREF_FORCE };
-static unsigned char a2_arg_force_ref[] = { 2, BYREF_NONE, BYREF_FORCE };
-
-static zend_function_entry php_oci_functions[] = {
- PHP_FE(ocidefinebyname, a3_arg_force_ref)
- PHP_FE(ocibindbyname, a3_arg_force_ref)
- PHP_FE(ocicolumnisnull, NULL)
- PHP_FE(ocicolumnname, NULL)
- PHP_FE(ocicolumnsize, NULL)
- PHP_FE(ocicolumnscale, NULL)
- PHP_FE(ocicolumnprecision, NULL)
- PHP_FE(ocicolumntype, NULL)
- PHP_FE(ocicolumntyperaw, NULL)
- PHP_FE(ociexecute, NULL)
- PHP_FE(ocicancel, NULL)
- PHP_FE(ocifetch, NULL)
- PHP_FE(ocifetchinto, a2_arg_force_ref)
- PHP_FE(ocifetchstatement,a2_arg_force_ref)
- PHP_FE(ocifreestatement, NULL)
- PHP_FE(ociinternaldebug, NULL)
- PHP_FE(ocinumcols, NULL)
- PHP_FE(ociparse, NULL)
- PHP_FE(ocinewcursor, NULL)
- PHP_FE(ociresult, NULL)
- PHP_FE(ociserverversion, NULL)
- PHP_FE(ocistatementtype, NULL)
- PHP_FE(ocirowcount, NULL)
- PHP_FE(ocilogoff, NULL)
- PHP_FE(ocilogon, NULL)
- PHP_FE(ocinlogon, NULL)
- PHP_FE(ociplogon, NULL)
- PHP_FE(ocierror, NULL)
- PHP_FE(ocifreedesc, NULL)
- PHP_FE(ocisavelob, NULL)
- PHP_FE(ocisavelobfile, NULL)
- PHP_FE(ociloadlob, NULL)
- PHP_FE(ociwritelobtofile,NULL)
- PHP_FE(ocicommit, NULL)
- PHP_FE(ocirollback, NULL)
- PHP_FE(ocinewdescriptor, NULL)
- PHP_FE(ocisetprefetch, NULL)
-#ifdef WITH_COLLECTIONS
- PHP_FE(ocifreecollection,NULL)
- PHP_FE(ocicollappend, NULL)
- PHP_FE(ocicollgetelem, NULL)
- PHP_FE(ocicollassignelem,NULL)
- PHP_FE(ocicollassign, NULL)
- PHP_FE(ocicollsize, NULL)
- PHP_FE(ocicollmax, NULL)
- PHP_FE(ocicolltrim, NULL)
- PHP_FE(ocinewcollection, NULL)
-#endif
-
- PHP_FALIAS(ocifreecursor,ocifreestatement,NULL)
-
- {NULL,NULL,NULL}
-};
-
-static zend_function_entry php_oci_lob_class_functions[] = {
- PHP_FALIAS(load, ociloadlob, NULL)
- PHP_FALIAS(writetofile, ociwritelobtofile,NULL)
-#ifdef HAVE_OCI8_TEMP_LOB
- PHP_FALIAS(writetemporary, ociwritetemporarylob,NULL)
- PHP_FALIAS(close, ocicloselob, NULL)
-#endif
- PHP_FALIAS(save, ocisavelob, NULL)
- PHP_FALIAS(savefile, ocisavelobfile, NULL)
- PHP_FALIAS(free, ocifreedesc, NULL)
- {NULL,NULL,NULL}
-};
-
-#ifdef WITH_COLLECTIONS
-static zend_function_entry php_oci_coll_class_functions[] = {
- PHP_FALIAS(append, ocicollappend, NULL)
- PHP_FALIAS(getelem, ocicollgetelem, NULL)
- PHP_FALIAS(assignelem, ocicollassignelem, NULL)
- PHP_FALIAS(assign, ocicollassign, NULL)
- PHP_FALIAS(size, ocicollsize, NULL)
- PHP_FALIAS(max, ocicollmax, NULL)
- PHP_FALIAS(trim, ocicolltrim, NULL)
- PHP_FALIAS(free, ocifreecollection, NULL)
- {NULL,NULL,NULL}
-};
-#endif
-
-zend_module_entry oci8_module_entry = {
- "oci8", /* extension name */
- php_oci_functions, /* extension function list */
- PHP_MINIT(oci), /* extension-wide startup function */
- PHP_MSHUTDOWN(oci), /* extension-wide shutdown function */
- PHP_RINIT(oci), /* per-request startup function */
- PHP_RSHUTDOWN(oci), /* per-request shutdown function */
- PHP_MINFO(oci), /* information function */
- STANDARD_MODULE_PROPERTIES
-};
-
-/* }}} */
-/* {{{ debug malloc/realloc/free */
-
-#define OCI_USE_EMALLOC 0 /* set this to 1 if you want to use the php memory manager! */
-
-#if OCI_USE_EMALLOC
-CONST dvoid *ocimalloc(dvoid *ctx, size_t size)
-{
- dvoid *ret;
- ret = (dvoid *)malloc(size);
- oci_debug("ocimalloc(%d) = %08x", size,ret);
- return ret;
-}
-
-CONST dvoid *ocirealloc(dvoid *ctx, dvoid *ptr, size_t size)
-{
- dvoid *ret;
- oci_debug("ocirealloc(%08x, %d)", ptr, size);
- ret = (dvoid *)realloc(ptr, size);
- return ptr;
-}
-
-CONST void ocifree(dvoid *ctx, dvoid *ptr)
-{
- oci_debug("ocifree(%08x)", ptr);
- free(ptr);
-}
-#endif
-
-/* }}} */
-/* {{{ startup, shutdown and info functions */
-
-static void php_oci_init_globals(OCILS_D)
-{
- OCI(shutdown) = 0;
-
- OCI(user) = malloc(sizeof(HashTable));
- zend_hash_init(OCI(user), 13, NULL, NULL, 1);
-
- OCI(server) = malloc(sizeof(HashTable));
- zend_hash_init(OCI(server), 13, NULL, NULL, 1);
-
- OCIEnvInit(&OCI(pEnv), OCI_DEFAULT, 0, NULL);
- OCIHandleAlloc(OCI(pEnv),
- (dvoid **)&OCI(pError),
- OCI_HTYPE_ERROR,
- 0,
- NULL);
-}
-
-PHP_MINIT_FUNCTION(oci)
-{
- zend_class_entry oci_lob_class_entry;
-#ifdef WITH_COLLECTIONS
- zend_class_entry oci_coll_class_entry;
-#endif
-
-#ifdef WITH_COLLECTIONS
-#define PHP_OCI_INIT_MODE OCI_DEFAULT | OCI_OBJECT
-#else
-#define PHP_OCI_INIT_MODE OCI_DEFAULT
-#endif
-
-#if OCI_USE_EMALLOC
- OCIInitialize(PHP_OCI_INIT_MODE, NULL, ocimalloc, ocirealloc, ocifree);
-#else
- OCIInitialize(PHP_OCI_INIT_MODE, NULL, NULL, NULL, NULL);
-#endif
-
-#ifdef ZTS
- oci_globals_id = ts_allocate_id(sizeof(php_oci_globals), (ts_allocate_ctor) php_oci_init_globals, NULL);
-#else
- php_oci_init_globals(OCILS_C);
-#endif
-
- le_stmt = zend_register_list_destructors_ex(_oci_stmt_list_dtor, NULL, "oci8 statement", module_number);
- le_conn = zend_register_list_destructors_ex(php_oci_free_conn_list, NULL, "oci8 connection", module_number);
- le_desc = zend_register_list_destructors_ex(_oci_descriptor_list_dtor, NULL, "oci8 descriptor", module_number);
-#ifdef WITH_COLLECTIONS
- le_coll = zend_register_list_destructors_ex(_oci_coll_list_dtor, NULL, "oci8 collection", module_number);
-#endif
- le_server = zend_register_list_destructors_ex(_oci_server_list_dtor, NULL, "oci8 server", module_number);
- le_session = zend_register_list_destructors_ex(_oci_session_list_dtor, NULL, "oci8 session", module_number);
-
- INIT_CLASS_ENTRY(oci_lob_class_entry, "OCI-Lob", php_oci_lob_class_functions);
-#ifdef WITH_COLLECTIONS
- INIT_CLASS_ENTRY(oci_coll_class_entry, "OCI-Collection", php_oci_coll_class_functions);
-#endif
-
- oci_lob_class_entry_ptr = zend_register_internal_class(&oci_lob_class_entry);
-#ifdef WITH_COLLECTIONS
- oci_coll_class_entry_ptr = zend_register_internal_class(&oci_coll_class_entry);
-#endif
-
-/* thies@thieso.net 990203 i do not think that we will need all of them - just in here for completeness for now! */
- REGISTER_LONG_CONSTANT("OCI_DEFAULT",OCI_DEFAULT, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("OCI_DESCRIBE_ONLY",OCI_DESCRIBE_ONLY, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("OCI_COMMIT_ON_SUCCESS",OCI_COMMIT_ON_SUCCESS, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("OCI_EXACT_FETCH",OCI_EXACT_FETCH, CONST_CS | CONST_PERSISTENT);
-
-/* for OCIBindByName (real "oci" names + short "php" names*/
- REGISTER_LONG_CONSTANT("SQLT_BFILEE",SQLT_BFILEE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SQLT_CFILEE",SQLT_CFILEE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SQLT_CLOB",SQLT_CLOB, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SQLT_BLOB",SQLT_BLOB, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SQLT_RDD",SQLT_RDD, CONST_CS | CONST_PERSISTENT);
-
-#ifdef WITH_COLLECTIONS
- REGISTER_LONG_CONSTANT("OCI_B_SQLT_NTY",SQLT_NTY, CONST_CS | CONST_PERSISTENT);
- REGISTER_STRING_CONSTANT("OCI_SYSDATE","SYSDATE",CONST_PERSISTENT);
-#endif
-
- REGISTER_LONG_CONSTANT("OCI_B_BFILE",SQLT_BFILEE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("OCI_B_CFILEE",SQLT_CFILEE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("OCI_B_CLOB",SQLT_CLOB, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("OCI_B_BLOB",SQLT_BLOB, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("OCI_B_ROWID",SQLT_RDD, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("OCI_B_CURSOR",SQLT_RSET, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("OCI_B_BIN",SQLT_BIN, CONST_CS | CONST_PERSISTENT);
-
-/* for OCIFetchInto & OCIResult */
- REGISTER_LONG_CONSTANT("OCI_ASSOC",OCI_ASSOC, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("OCI_NUM",OCI_NUM, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("OCI_BOTH",OCI_BOTH, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("OCI_RETURN_NULLS",OCI_RETURN_NULLS, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("OCI_RETURN_LOBS",OCI_RETURN_LOBS, CONST_CS | CONST_PERSISTENT);
-
-/* for OCINewDescriptor (real "oci" names + short "php" names*/
- REGISTER_LONG_CONSTANT("OCI_DTYPE_FILE",OCI_DTYPE_FILE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("OCI_DTYPE_LOB",OCI_DTYPE_LOB, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("OCI_DTYPE_ROWID",OCI_DTYPE_ROWID, CONST_CS | CONST_PERSISTENT);
-
- REGISTER_LONG_CONSTANT("OCI_D_FILE",OCI_DTYPE_FILE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("OCI_D_LOB",OCI_DTYPE_LOB, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("OCI_D_ROWID",OCI_DTYPE_ROWID, CONST_CS | CONST_PERSISTENT);
-
- return SUCCESS;
-}
-
-/* ----------------------------------------------------------------- */
-
-
-PHP_RINIT_FUNCTION(oci)
-{
- OCILS_FETCH();
-
- /* XXX NYI
- OCI(num_links) =
- OCI(num_persistent);
- */
-
- OCI(debug_mode) = 0; /* start "fresh" */
-
- oci_debug("php_rinit_oci");
-
- return SUCCESS;
-}
-
-static int _session_pcleanup(oci_session *session)
-{
- _oci_close_session(session);
-
- return 1;
-}
-
-static int _server_pcleanup(oci_server *server)
-{
- _oci_close_server(server);
-
- return 1;
-}
-
-PHP_MSHUTDOWN_FUNCTION(oci)
-{
- OCILS_FETCH();
-
- OCI(shutdown) = 1;
-
- oci_debug("START php_mshutdown_oci");
-
- zend_hash_apply(OCI(user),(int (*)(void *))_session_pcleanup);
- zend_hash_apply(OCI(server),(int (*)(void *))_server_pcleanup);
-
- zend_hash_destroy(OCI(user));
- zend_hash_destroy(OCI(server));
-
- free(OCI(user));
- free(OCI(server));
-
- OCIHandleFree((dvoid *)OCI(pEnv), OCI_HTYPE_ENV);
-
- oci_debug("END php_mshutdown_oci");
-
- return SUCCESS;
-}
-
-PHP_RSHUTDOWN_FUNCTION(oci)
-{
- oci_debug("START php_rshutdown_oci");
-
-#if 0
- /* XXX free all statements, rollback all outstanding transactions */
-
- zend_hash_apply(OCI(user),(int (*)(void *))_session_cleanup);
- zend_hash_apply(OCI(server),(int (*)(void *))_server_cleanup);
-#endif
-
- oci_debug("END php_rshutdown_oci");
-
- return SUCCESS;
-}
-
-
-PHP_MINFO_FUNCTION(oci)
-{
-
- php_info_print_table_start();
- php_info_print_table_row(2, "OCI8 Support", "enabled");
- php_info_print_table_row(2, "Revision", "$Revision$");
-#ifndef PHP_WIN32
- php_info_print_table_row(2, "Oracle Version", PHP_OCI8_VERSION );
- php_info_print_table_row(2, "Compile-time ORACLE_HOME", PHP_OCI8_DIR );
- php_info_print_table_row(2, "Libraries Used", PHP_OCI8_SHARED_LIBADD );
-#endif
- php_info_print_table_end();
-
-}
-
-/* }}} */
-/* {{{ _oci_define_hash_dtor() */
-
-static void
-_oci_define_hash_dtor(void *data)
-{
- oci_define *define = (oci_define *) data;
-
- oci_debug("_oci_define_hash_dtor: %s",define->name);
-
- zval_ptr_dtor(&define->zval);
-
- if (define->name) {
- efree(define->name);
- define->name = 0;
- }
-}
-
-/* }}} */
-/* {{{ _oci_bind_hash_dtor() */
-
-static void
-_oci_bind_hash_dtor(void *data)
-{
- oci_bind *bind = (oci_bind *) data;
-
- oci_debug("_oci_bind_hash_dtor:");
-
- zval_ptr_dtor(&(bind->zval));
-}
-
-/* }}} */
-/* {{{ _oci_bind_pre_exec() */
-
-static int
-_oci_bind_pre_exec(void *data)
-{
- oci_bind *bind = (oci_bind *) data;
-
- /* reset all bind stuff to a normal state..-. */
-
- bind->indicator = 0;
-
- return 0;
-}
-
-/* }}} */
-/* {{{ _oci_bind_post_exec() */
-
-static int
-_oci_bind_post_exec(void *data)
-{
- oci_bind *bind = (oci_bind *) data;
-
- if (bind->indicator == -1) { /* NULL */
- zval *val = bind->zval;
- zval_dtor(val);
- ZVAL_NULL(val);
- }
-
- return 0;
-}
-
-/* }}} */
-/* {{{ _oci_column_hash_dtor() */
-
-static void
-_oci_column_hash_dtor(void *data)
-{
- oci_out_column *column = (oci_out_column *) data;
-
- oci_debug("START _oci_column_hash_dtor: %s",column->name);
-
- if (column->stmtid) {
- zend_list_delete(column->stmtid);
- }
-
- if (column->is_descr) {
- zend_list_delete(column->descid);
- } else {
- if (column->data) {
- efree(column->data);
- }
- }
-
- oci_debug("END _oci_column_hash_dtor: %s",column->name);
-
- if (column->name) {
- efree(column->name);
- }
-}
-
-/* }}} */
-/* {{{ _oci_stmt_list_dtor() */
-
-static void
-_oci_stmt_list_dtor(zend_rsrc_list_entry *rsrc)
-{
- oci_statement *statement = (oci_statement *)rsrc->ptr;
- oci_debug("START _oci_stmt_list_dtor: id=%d last_query=\"%s\"",statement->id,SAFE_STRING(statement->last_query));
-
- if (statement->pStmt) {
- OCIHandleFree(statement->pStmt, OCI_HTYPE_STMT);
- statement->pStmt = 0;
- }
-
- if (statement->pError) {
- OCIHandleFree(statement->pError, OCI_HTYPE_ERROR);
- statement->pError = 0;
- }
-
- if (statement->last_query) {
- efree(statement->last_query);
- }
-
- if (statement->columns) {
- zend_hash_destroy(statement->columns);
- efree(statement->columns);
- }
-
- if (statement->binds) {
- zend_hash_destroy(statement->binds);
- efree(statement->binds);
- }
-
- if (statement->defines) {
- zend_hash_destroy(statement->defines);
- efree(statement->defines);
- }
-
- zend_list_delete(statement->conn->id);
-
- oci_debug("END _oci_stmt_list_dtor: id=%d",statement->id);
-
- efree(statement);
-}
-
-/* }}} */
-/* {{{ _oci_conn_list_dtor() */
-
-static void
-_oci_conn_list_dtor(oci_connection *connection)
-{
- /*
- as the connection is "only" a in memory service context we do not disconnect from oracle.
- */
-
- oci_debug("START _oci_conn_list_dtor: id=%d",connection->id);
-
- if (connection->pServiceContext) {
- connection->error =
- OCITransRollback(connection->pServiceContext,
- connection->pError,
- (ub4)0);
-
- if (connection->error) {
- oci_error(connection->pError, "failed to rollback outstanding transactions!", connection->error);
- }
-
- OCIHandleFree((dvoid *) connection->pServiceContext, (ub4) OCI_HTYPE_SVCCTX);
- }
-
- if (connection->session && connection->session->exclusive) {
- /* exclusive connection created via OCINLogon() close their
- associated session when destructed */
- zend_list_delete(connection->session->num);
- }
-
- if (connection->pError) {
- OCIHandleFree((dvoid *) connection->pError, (ub4) OCI_HTYPE_ERROR);
- }
-
- oci_debug("END _oci_conn_list_dtor: id=%d",connection->id);
-
- efree(connection);
-}
-
-/* }}} */
-
-/* {{{ php_oci_free_conn_list
- */
-static void php_oci_free_conn_list(zend_rsrc_list_entry *rsrc)
-{
- oci_connection *conn = (oci_connection *)rsrc->ptr;
- _oci_conn_list_dtor(conn);
-}
-/* }}} */
-
-#ifdef WITH_COLLECTIONS
-
-/* {{{ _oci_coll_list_dtor()
- */
-
-static void
-_oci_coll_list_dtor(zend_rsrc_list_entry *rsrc)
-{
- oci_collection *coll = (oci_collection *)rsrc->ptr;
- oci_debug("START _oci_coll_list_dtor: %d",coll->id);
-
- zend_list_delete(coll->conn->id);
- /* Note sure if we need to free the object. Have an
- oracle TAR out on this one.
- OCIDescriptorFree(descr->ocidescr, descr->type); */
-
- oci_debug("END _oci_coll_list_dtor: %d",coll->id);
-
- efree(coll);
-}
-/* }}} */
-#endif
-
-/* {{{ _oci_descriptor_list_dtor()
- */
-
-static void
-_oci_descriptor_list_dtor(zend_rsrc_list_entry *rsrc)
-{
- oci_descriptor *descr = (oci_descriptor *)rsrc->ptr;
- oci_debug("START _oci_descriptor_list_dtor: %d",descr->id);
-
- zend_list_delete(descr->conn->id);
-
- OCIDescriptorFree(descr->ocidescr, descr->type);
-
- oci_debug("END _oci_descriptor_list_dtor: %d",descr->id);
-
- efree(descr);
-}
-
-/* }}} */
-/* {{{ _oci_server_list_dtor()
- */
-
-static void
-_oci_server_list_dtor(zend_rsrc_list_entry *rsrc)
-{
- oci_server *server = (oci_server *)rsrc->ptr;
- if (server->persistent)
- return;
-
- _oci_close_server(server);
-}
-
-/* }}} */
-/* {{{ _oci_session_list_dtor()
- */
-
-static void
-_oci_session_list_dtor(zend_rsrc_list_entry *rsrc)
-{
- oci_session *session = (oci_session *)rsrc->ptr;
- if (session->persistent)
- return;
-
- _oci_close_session(session);
-}
-
-/* }}} */
-
-/* {{{ oci_handle_error
- */
-static ub4
-oci_handle_error(oci_connection *connection, ub4 errcode)
-{
- switch (errcode) {
- case 22: /* ORA-00022 Invalid session id */
- case 1012: /* ORA-01012: */
- case 3113: /* ORA-03113: end-of-file on communication channel */
- connection->is_open = 0;
- connection->session->is_open = 0;
- connection->session->server->is_open = 0;
- return 1; /* fatal error */
- }
-
- return 0; /* no fatal error */
-}
-/* }}} */
-
-/* {{{ oci_error() */
-
-static ub4
-oci_error(OCIError *err_p, char *what, sword status)
-{
- text errbuf[512];
- sb4 errcode = 0;
-
- switch (status) {
- case OCI_SUCCESS:
- break;
- case OCI_SUCCESS_WITH_INFO:
- php_error(E_WARNING, "%s: OCI_SUCCESS_WITH_INFO", what);
- break;
- case OCI_NEED_DATA:
- php_error(E_WARNING, "%s: OCI_NEED_DATA", what);
- break;
- case OCI_NO_DATA:
- php_error(E_WARNING, "%s: OCI_NO_DATA", what);
- break;
- case OCI_ERROR:
- OCIErrorGet(err_p, (ub4)1, NULL, &errcode, errbuf,
- (ub4)sizeof(errbuf), (ub4)OCI_HTYPE_ERROR);
- php_error(E_WARNING, "%s: %s", what, errbuf);
- break;
- case OCI_INVALID_HANDLE:
- php_error(E_WARNING, "%s: OCI_INVALID_HANDLE", what);
- break;
- case OCI_STILL_EXECUTING:
- php_error(E_WARNING, "%s: OCI_STILL_EXECUTING", what);
- break;
- case OCI_CONTINUE:
- php_error(E_WARNING, "%s: OCI_CONTINUE", what);
- break;
- default:
- break;
- }
- return errcode;
-}
-
-/* }}} */
-/* {{{ oci_ping() */
-
-static int oci_ping(oci_server *server)
-{
- char version[256];
- OCILS_FETCH();
-
- OCI(error) =
- OCIServerVersion(server->pServer,
- OCI(pError),
- (text*)version,
- sizeof(version),
- OCI_HTYPE_SERVER);
- if (OCI(error) == OCI_SUCCESS) {
- return 1;
- }
-
- oci_error(OCI(pError), "oci_ping", OCI(error));
-
- return 0;
-}
-
-/* }}} */
-
-/************************* INTERNAL FUNCTIONS *************************/
-
-/* {{{ oci_debug() */
-
-static void oci_debug(const char *format, ...)
-{
- OCILS_FETCH();
-
- if (OCI(debug_mode)) {
- char buffer[1024];
- va_list args;
-
- va_start(args, format);
- vsnprintf(buffer, sizeof(buffer)-1, format, args);
- va_end(args);
- buffer[sizeof(buffer)-1] = '\0';
- php_printf("OCIDebug: %s<br>\n", buffer);
- }
-}
-
-/* }}} */
-/* {{{ oci_get_conn() */
-
-static oci_connection *oci_get_conn(zval **conn)
-{
- oci_connection *connection;
-
- connection = (oci_connection *) zend_fetch_resource(conn, -1, "OCI8-Connection", NULL, 1, le_conn);
-
- if (connection && connection->is_open) {
- return connection;
- } else {
- return (oci_connection *) NULL;
- }
-}
-
-/* }}} */
-/* {{{ oci_get_stmt() */
-
-static oci_statement *oci_get_stmt(zval **stmt)
-{
- oci_statement *statement;
-
- statement = (oci_statement *) zend_fetch_resource(stmt, -1, "OCI8-Statement", NULL, 1, le_stmt);
-
- if (statement && statement->conn->is_open) {
- return statement;
- } else {
- return (oci_statement *) NULL;
- }
-}
-
-/* }}} */
-/* {{{ oci_get_desc() */
-
-static oci_descriptor *oci_get_desc(int ind)
-{
- oci_descriptor *descriptor;
- int actual_resource_type;
-
- descriptor = (oci_descriptor *) zend_list_find(ind, &actual_resource_type);
-
- if (descriptor && (actual_resource_type == le_desc)) {
- return descriptor;
- } else {
- return (oci_descriptor *) NULL;
- }
-}
-
-/* }}} */
-/* {{{ oci_get_col() */
-
-static oci_out_column *
-oci_get_col(oci_statement *statement, int col, zval **value)
-{
- oci_out_column *outcol = NULL;
- int i;
-
- if (statement->columns == 0) { /* we release the columns at the end of a fetch */
- return NULL;
- }
-
- if (value) {
- if ((*value)->type == IS_STRING) {
- for (i = 0; i < statement->ncolumns; i++) {
- outcol = oci_get_col(statement, i + 1, 0);
- if (outcol == NULL) {
- continue;
- } else if (((int) outcol->name_len == (*value)->value.str.len)
- && (! strncmp(outcol->name,(*value)->value.str.val,(*value)->value.str.len))) {
- return outcol;
- }
- }
- } else {
- convert_to_long_ex(value);
- return oci_get_col(statement,(*value)->value.lval,0);
- }
- } else if (col != -1) {
- if (zend_hash_index_find(statement->columns, col, (void **)&outcol) == FAILURE) {
- php_error(E_WARNING, "Invalid column %d", col);
- return NULL;
- }
- return outcol;
- }
-
- return NULL;
-}
-
-/* }}} */
-/* {{{ oci_new_desc() */
-
-static oci_descriptor*
-oci_new_desc(int type,oci_connection *connection)
-{
- oci_descriptor *descr;
- OCILS_FETCH();
-
- descr = emalloc(sizeof(oci_descriptor));
-
- descr->type = type;
-
- switch (descr->type) {
- case OCI_DTYPE_FILE:
- case OCI_DTYPE_LOB:
- case OCI_DTYPE_ROWID:
- break;
-
- default:
- php_error(E_WARNING, "Unknown descriptor type %d.",descr->type);
- return 0;
- }
-
- OCI(error) =
- OCIDescriptorAlloc(OCI(pEnv),
- (dvoid*)&(descr->ocidescr),
- descr->type,
- (size_t) 0,
- (dvoid **) 0);
-
- if (OCI(error)) {
- ub4 error;
- error = oci_error(OCI(pError),"OCIDescriptorAlloc %d",OCI(error));
- oci_handle_error(connection, error);
- return 0;
- }
-
- descr->id = zend_list_insert(descr,le_desc);
- descr->conn = connection;
- zend_list_addref(connection->id);
-
- oci_debug("oci_new_desc %d",descr->id);
-
- return descr;
-}
-
-#ifdef WITH_COLLECTIONS
-
-/* {{{ _oci_get_ocicoll() */
-
-static int
-_oci_get_ocicoll(zval *id,oci_collection **collection)
-{
- zval **coll;
-
- if (zend_hash_find(id->value.obj.properties, "collection", sizeof("collection"), (void **)&coll) == FAILURE) {
- php_error(E_WARNING, "cannot find collection");
- return 0;
- }
- if ((*collection = oci_get_coll((*coll)->value.lval)) == NULL) {
- php_error(E_WARNING, "collection not found");
- return 0;
- }
-
- return (*coll)->value.lval;
-}
-
-/* }}} */
-
-#endif
-
-/* }}} */
-/* {{{ _oci_get_ocidesc() */
-
-static int
-_oci_get_ocidesc(zval *id,oci_descriptor **descriptor)
-{
- zval **desc;
-
- if (zend_hash_find(id->value.obj.properties, "descriptor", sizeof("descriptor"), (void **)&desc) == FAILURE) {
- php_error(E_WARNING, "cannot find descriptor");
- return 0;
- }
-
- if ((*descriptor = oci_get_desc((*desc)->value.lval)) == NULL) {
- php_error(E_WARNING, "descriptor not found");
- return 0;
- }
-
- return (*desc)->value.lval;
-}
-
-/* }}} */
-/* {{{ _oci_make_zval() */
-
-static int
-_oci_make_zval(zval *value,oci_statement *statement,oci_out_column *column, char *func, int mode)
-{
- oci_descriptor *descr;
- ub4 loblen;
- int size;
- char *buffer;
-
- if (column->indicator || column->retcode)
- if ((column->indicator != -1) && (column->retcode != 1405))
- oci_debug("_oci_make_zval: %16s,retlen = %4d,retlen4 = %d,storage_size4 = %4d,indicator %4d, retcode = %4d",
- column->name,column->retlen,column->retlen4,column->storage_size4,column->indicator,column->retcode);
-
- if (column->indicator == -1) { /* column is NULL */
- ZVAL_NULL(value);
- return 0;
- }
-
- if (column->is_cursor) { /* REFCURSOR -> simply return the statement id */
- ZVAL_RESOURCE(value,column->stmtid);
- zend_list_addref(column->stmtid);
- } else if (column->is_descr) {
- if ((column->data_type != SQLT_RDD) && (mode & OCI_RETURN_LOBS)) {
- /* OCI_RETURN_LOBS means that we want the content of the LOB back instead of the locator */
-
- descr = oci_get_desc(column->descid);
- if (! descr) {
- php_error(E_WARNING, "unable to find my descriptor %d",column->data);
- return -1;
- }
-
- if (oci_loadlob(statement->conn,descr,&buffer,&loblen)) {
- ZVAL_BOOL(value,0);
- } else {
- ZVAL_STRINGL(value,buffer,loblen,0);
- }
- } else {
- /* return the locator */
- object_init_ex(value, oci_lob_class_entry_ptr);
- add_property_resource(value, "descriptor", column->descid);
- zend_list_addref(column->descid);
- }
- } else {
- switch (column->retcode) {
- case 0:
- /* intact value */
- if (column->piecewise) {
- size = column->retlen4;
- } else {
- size = column->retlen;
- }
- break;
-
- default:
- /* XXX we SHOULD maybe have a different behaviour for unknown results! */
- ZVAL_BOOL(value,0);
- return 0;
- }
-
- ZVAL_STRINGL(value,column->data,size,1);
- }
-
- return 0;
-}
-
-/* }}} */
-/* {{{ oci_setprefetch() */
-
-static int
-oci_setprefetch(oci_statement *statement,int size)
-{
- ub4 prefetch;
-
- prefetch = size * 1024;
- statement->error =
- oci_error(statement->pError,
- "OCIAttrSet OCI_ATTR_PREFETCH_MEMORY",
- OCIAttrSet(statement->pStmt,
- OCI_HTYPE_STMT,
- &prefetch,
- 0,
- OCI_ATTR_PREFETCH_MEMORY,
- statement->pError));
- if (statement->error) {
- oci_handle_error(statement->conn, statement->error);
- }
- prefetch = size;
- statement->error =
- oci_error(statement->pError,
- "OCIAttrSet OCI_ATTR_PREFETCH_MEMORY",
- OCIAttrSet(statement->pStmt,
- OCI_HTYPE_STMT,
- &prefetch,
- 0,
- OCI_ATTR_PREFETCH_ROWS,
- statement->pError));
- if (statement->error) {
- oci_handle_error(statement->conn, statement->error);
- }
-
- return 1;
-}
-
-/* }}} */
-/* {{{ oci_parse() */
-
-static oci_statement *oci_parse(oci_connection *connection, char *query, int len)
-{
- oci_statement *statement;
- OCILS_FETCH();
-
- statement = ecalloc(1,sizeof(oci_statement));
-
- OCIHandleAlloc(OCI(pEnv),
- (dvoid **)&statement->pStmt,
- OCI_HTYPE_STMT,
- 0,
- NULL);
- OCIHandleAlloc(OCI(pEnv),
- (dvoid **)&statement->pError,
- OCI_HTYPE_ERROR,
- 0,
- NULL);
-
- if (len > 0) {
- connection->error =
- oci_error(connection->pError,
- "OCIParse",
- OCIStmtPrepare(statement->pStmt,
- connection->pError,
- (text*)query,
- len,
- OCI_NTV_SYNTAX,
- OCI_DEFAULT));
- if (connection->error) {
- OCIHandleFree(statement->pStmt, OCI_HTYPE_STMT);
- OCIHandleFree(statement->pError, OCI_HTYPE_ERROR);
- efree(statement);
- oci_handle_error(connection, connection->error);
- return 0;
- }
- }
-
- if (query) {
- statement->last_query = estrdup(query);
- }
- statement->conn = connection;
-
- statement->id = zend_list_insert(statement,le_stmt);
-
- oci_debug("oci_parse \"%s\" id=%d conn=%d",
- SAFE_STRING(query),
- statement->id,
- statement->conn->id);
-
- zend_list_addref(statement->conn->id);
-
- return statement;
-}
-
-/* }}} */
-/* {{{ oci_execute() */
-
-static int
-oci_execute(oci_statement *statement, char *func,ub4 mode)
-{
- oci_out_column *outcol;
- oci_out_column column;
- OCIParam *param = 0;
- text *colname;
- ub4 counter;
- ub2 define_type;
- ub2 stmttype;
- ub4 iters;
- ub4 colcount;
- ub2 dynamic;
- int dtype;
- dvoid *buf;
- oci_descriptor *descr;
-
- statement->error =
- oci_error(statement->pError,
- "OCIAttrGet OCI_HTYPE_STMT/OCI_ATTR_STMT_TYPE",
- OCIAttrGet((dvoid *)statement->pStmt,
- OCI_HTYPE_STMT,
- (ub2 *)&stmttype,
- (ub4 *)0,
- OCI_ATTR_STMT_TYPE,
- statement->pError));
-
- if (statement->error) {
- oci_handle_error(statement->conn, statement->error);
- return 0;
- }
-
- if (stmttype == OCI_STMT_SELECT) {
- iters = 0;
- } else {
- iters = 1;
- }
-
- if (statement->last_query) {
- /* if we execute refcursors we don't have a query and
- we don't want to execute!!! */
-
- if (statement->binds) {
- zend_hash_apply(statement->binds, (int (*)(void *)) _oci_bind_pre_exec);
- }
-
- statement->error =
- oci_error(statement->pError,
- "OCIStmtExecute",
- OCIStmtExecute(statement->conn->pServiceContext,
- statement->pStmt,
- statement->pError,
- iters,
- 0,
- NULL,
- NULL,
- mode));
- if (statement->binds) {
- zend_hash_apply(statement->binds, (int (*)(void *)) _oci_bind_post_exec);
- }
-
- oci_handle_error(statement->conn, statement->error);
-
- if (statement->error) {
- return 0;
- }
- }
-
- if (stmttype == OCI_STMT_SELECT && (statement->executed == 0)) {
- /* we only need to do the define step is this very statement is executed the first time! */
- statement->executed++;
-
- ALLOC_HASHTABLE(statement->columns);
- zend_hash_init(statement->columns, 13, NULL, _oci_column_hash_dtor, 0);
-
- counter = 1;
-
- statement->error =
- oci_error(statement->pError,
- "OCIAttrGet OCI_HTYPE_STMT/OCI_ATTR_PARAM_COUNT",
- OCIAttrGet((dvoid *)statement->pStmt,
- OCI_HTYPE_STMT,
- (dvoid *)&colcount,
- (ub4 *)0,
- OCI_ATTR_PARAM_COUNT,
- statement->pError));
- if (statement->error) {
- oci_handle_error(statement->conn, statement->error);
- return 0; /* XXX we loose memory!!! */
- }
-
- statement->ncolumns = colcount;
-
- for (counter = 1; counter <= colcount; counter++) {
- memset(&column,0,sizeof(oci_out_column));
-
- if (zend_hash_index_update(statement->columns, counter, &column,
- sizeof(oci_out_column), (void**) &outcol) == FAILURE) {
- efree(statement->columns);
- /* out of memory */
- return 0;
- }
-
- outcol->statement = statement;
-
- statement->error =
- oci_error(statement->pError,
- "OCIParamGet OCI_HTYPE_STMT",
- OCIParamGet(
- (dvoid *)statement->pStmt,
- OCI_HTYPE_STMT,
- statement->pError,
- (dvoid**)&param,
- counter));
- if (statement->error) {
- oci_handle_error(statement->conn, statement->error);
- return 0; /* XXX we loose memory!!! */
- }
-
- statement->error =
- oci_error(statement->pError,
- "OCIAttrGet OCI_DTYPE_PARAM/OCI_ATTR_DATA_TYPE",
- OCIAttrGet((dvoid *)param,
- OCI_DTYPE_PARAM,
- (dvoid *)&outcol->data_type,
- (ub4 *)0,
- OCI_ATTR_DATA_TYPE,
- statement->pError));
- if (statement->error) {
- oci_handle_error(statement->conn, statement->error);
- return 0; /* XXX we loose memory!!! */
- }
-
-
- statement->error =
- oci_error(statement->pError,
- "OCIAttrGet OCI_DTYPE_PARAM/OCI_ATTR_DATA_SIZE",
- OCIAttrGet((dvoid *)param,
- OCI_DTYPE_PARAM,
- (dvoid *)&outcol->data_size,
- (dvoid *)0,
- OCI_ATTR_DATA_SIZE,
- statement->pError));
- if (statement->error) {
- oci_handle_error(statement->conn, statement->error);
- return 0; /* XXX we loose memory!!! */
- }
-
- outcol->storage_size4 = outcol->data_size;
- outcol->retlen = outcol->data_size;
-
- statement->error =
- oci_error(statement->pError,
- "OCIAttrGet OCI_DTYPE_PARAM/OCI_ATTR_SCALE",
- OCIAttrGet((dvoid *)param,
- OCI_DTYPE_PARAM,
- (dvoid *)&outcol->scale,
- (dvoid *)0,
- OCI_ATTR_SCALE,
- statement->pError));
- if (statement->error) {
- oci_handle_error(statement->conn, statement->error);
- return 0; /* XXX we lose memory!!! */
- }
-
- statement->error =
- oci_error(statement->pError,
- "OCIAttrGet OCI_DTYPE_PARAM/OCI_ATTR_PRECISION",
- OCIAttrGet((dvoid *)param,
- OCI_DTYPE_PARAM,
- (dvoid *)&outcol->precision,
- (dvoid *)0,
- OCI_ATTR_PRECISION,
- statement->pError));
- if (statement->error) {
- oci_handle_error(statement->conn, statement->error);
- return 0; /* XXX we lose memory!!! */
- }
-
- statement->error =
- oci_error(statement->pError,
- "OCIAttrGet OCI_DTYPE_PARAM/OCI_ATTR_NAME",
- OCIAttrGet((dvoid *)param,
- OCI_DTYPE_PARAM,
- (dvoid **)&colname, /* XXX this string is NOT zero terminated!!!! */
- (ub4 *)&outcol->name_len,
- (ub4)OCI_ATTR_NAME,
- statement->pError));
- if (statement->error) {
- oci_handle_error(statement->conn, statement->error);
- return 0; /* XXX we loose memory!!! */
- }
-
- outcol->name = estrndup((char*) colname,outcol->name_len);
-
- /* find a user-setted define */
- if (statement->defines) {
- zend_hash_find(statement->defines,outcol->name,outcol->name_len,(void **) &outcol->define);
- }
-
- buf = 0;
- switch (outcol->data_type) {
- case SQLT_RSET:
- outcol->pstmt = oci_parse(statement->conn,0,0);
- outcol->stmtid = outcol->pstmt->id;
-
- define_type = SQLT_RSET;
- outcol->is_cursor = 1;
- outcol->storage_size4 = -1;
- outcol->retlen = -1;
- dynamic = OCI_DEFAULT;
- buf = &(outcol->pstmt->pStmt);
- break;
-
- case SQLT_RDD: /* ROWID */
- case SQLT_BLOB: /* binary LOB */
- case SQLT_CLOB: /* character LOB */
- case SQLT_BFILE: /* binary file LOB */
- define_type = outcol->data_type;
- outcol->is_descr = 1;
- outcol->storage_size4 = -1;
- dynamic = OCI_DEFAULT;
-
- if (outcol->data_type == SQLT_BFILE) {
- dtype = OCI_DTYPE_FILE;
- } else if (outcol->data_type == SQLT_RDD ) {
- dtype = OCI_DTYPE_ROWID;
- } else {
- dtype = OCI_DTYPE_LOB;
- }
-
- descr = oci_new_desc(dtype,statement->conn);
- outcol->descid = descr->id;
- buf = &(descr->ocidescr);
- break;
-
- case SQLT_LNG:
- case SQLT_LBI:
- if (outcol->data_type == SQLT_LBI) {
- define_type = SQLT_BIN;
- } else {
- define_type = SQLT_CHR;
- }
- outcol->storage_size4 = OCI_MAX_DATA_SIZE;
- outcol->piecewise = 1;
- dynamic = OCI_DYNAMIC_FETCH;
- break;
-
- case SQLT_BIN:
- default:
- define_type = SQLT_CHR;
- if ((outcol->data_type == SQLT_DAT) || (outcol->data_type == SQLT_NUM)) {
- outcol->storage_size4 = 512; /* XXX this should fit "most" NLS date-formats and Numbers */
- } else {
- outcol->storage_size4++; /* add one for string terminator */
- }
- if (outcol->data_type == SQLT_BIN) {
- outcol->storage_size4 *= 3;
- }
- dynamic = OCI_DEFAULT;
- buf = outcol->data = (text *) emalloc(outcol->storage_size4);
- break;
- }
-
- if (dynamic == OCI_DYNAMIC_FETCH) {
- statement->error =
- oci_error(statement->pError,
- "OCIDefineByPos",
- OCIDefineByPos(statement->pStmt, /* IN/OUT handle to the requested SQL query */
- (OCIDefine **)&outcol->pDefine,/* IN/OUT pointer to a pointer to a define handle */
- statement->pError, /* IN/OUT An error handle */
- counter, /* IN position in the select list */
- (dvoid *)NULL, /* IN/OUT pointer to a buffer */
- outcol->storage_size4, /* IN The size of each valuep buffer in bytes */
- define_type, /* IN The data type */
- (dvoid *)&outcol->indicator, /* IN pointer to an indicator variable or arr */
- (ub2 *)NULL, /* IN/OUT Pointer to array of length of data fetched */
- (ub2 *)NULL, /* OUT Pointer to array of column-level return codes */
- OCI_DYNAMIC_FETCH)); /* IN mode (OCI_DEFAULT, OCI_DYNAMIC_FETCH) */
- } else {
- statement->error =
- oci_error(statement->pError,
- "OCIDefineByPos",
- OCIDefineByPos(statement->pStmt, /* IN/OUT handle to the requested SQL query */
- (OCIDefine **)&outcol->pDefine,/* IN/OUT pointer to a pointer to a define handle */
- statement->pError, /* IN/OUT An error handle */
- counter, /* IN position in the select list */
- (dvoid *)buf, /* IN/OUT pointer to a buffer */
- outcol->storage_size4, /* IN The size of each valuep buffer in bytes */
- define_type, /* IN The data type */
- (dvoid *)&outcol->indicator, /* IN pointer to an indicator variable or arr */
- (ub2 *)&outcol->retlen, /* IN/OUT Pointer to array of length of data fetched */
- (ub2 *)&outcol->retcode, /* OUT Pointer to array of column-level return codes */
- OCI_DEFAULT)); /* IN mode (OCI_DEFAULT, OCI_DYNAMIC_FETCH) */
- }
- if (statement->error) {
- oci_handle_error(statement->conn, statement->error);
- return 0; /* XXX we loose memory!!! */
- }
- }
- }
-
- return 1;
-}
-
-/* }}} */
-/* {{{ oci_fetch() */
-
-static int
-_oci_column_pre_fetch(void *data)
-{
- oci_out_column *col = (oci_out_column *) data;
-
- if (col->piecewise) {
- col->retlen4 = 0;
- }
-
- return 0;
-}
-
-
-static int
-oci_fetch(oci_statement *statement, ub4 nrows, char *func)
-{
- int i;
- oci_out_column *column;
-
- if (statement->columns) {
- zend_hash_apply(statement->columns, (int (*)(void *)) _oci_column_pre_fetch);
- }
-
- statement->error =
- OCIStmtFetch(statement->pStmt,
- statement->pError, nrows,
- OCI_FETCH_NEXT,
- OCI_DEFAULT);
-
- if ((statement->error == OCI_NO_DATA) || (nrows == 0)) {
- /* XXX this is needed for REFCURSORS! */
- if (statement->columns) {
- zend_hash_destroy(statement->columns);
- efree(statement->columns);
- statement->columns = 0;
- statement->ncolumns = 0;
- }
- statement->executed = 0;
-
- statement->error = 0; /* OCI_NO_DATA is NO error for us!!! */
-
- return 0;
- }
-
- while (statement->error == OCI_NEED_DATA) {
- for (i = 0; i < statement->ncolumns; i++) {
- column = oci_get_col(statement, i + 1, 0);
- if (column->piecewise) {
- if (! column->data) {
- column->data = (text *) emalloc(OCI_PIECE_SIZE);
- } else {
- column->data = erealloc(column->data,column->retlen4 + OCI_PIECE_SIZE);
- }
-
- column->cb_retlen = OCI_PIECE_SIZE;
-
- OCIStmtSetPieceInfo((void *) column->pDefine,
- OCI_HTYPE_DEFINE,
- statement->pError,
- ((char*)column->data) + column->retlen4,
- &(column->cb_retlen),
- OCI_NEXT_PIECE,
- &column->indicator,
- &column->retcode);
- }
- }
-
- statement->error =
- OCIStmtFetch(statement->pStmt,
- statement->pError, nrows,
- OCI_FETCH_NEXT,
- OCI_DEFAULT);
-
- for (i = 0; i < statement->ncolumns; i++) {
- column = oci_get_col(statement, i + 1, 0);
- if (column->piecewise) {
- column->retlen4 += column->cb_retlen;
- }
- }
- }
-
- if (statement->error == OCI_SUCCESS_WITH_INFO || statement->error == OCI_SUCCESS) {
- /* do the stuff needed for OCIDefineByName */
- for (i = 0; i < statement->ncolumns; i++) {
- column = oci_get_col(statement, i + 1, 0);
- if (column == NULL) {
- continue;
- }
-
- if (! column->define) {
- continue;
- }
-
- zval_dtor(column->define->zval);
- _oci_make_zval(column->define->zval,statement,column,"OCIFetch",0);
- }
-
- return 1;
- }
-
- oci_error(statement->pError, func, statement->error);
- oci_handle_error(statement->conn, statement->error);
-
- return 0;
-}
-
-/* }}} */
-/* {{{ oci_loadlob() */
-
-#define LOBREADSIZE 1048576l /* 1MB */
-
-static int
-oci_loadlob(oci_connection *connection, oci_descriptor *mydescr, char **buffer,ub4 *loblen)
-{
- ub4 siz = 0;
- ub4 readlen = 0;
- char *buf;
-
- *loblen = 0;
-
- if (mydescr->type == OCI_DTYPE_FILE) {
- connection->error =
- OCILobFileOpen(connection->pServiceContext,
- connection->pError,
- mydescr->ocidescr,
- OCI_FILE_READONLY);
- if (connection->error) {
- oci_error(connection->pError, "OCILobFileOpen",connection->error);
- oci_handle_error(connection, connection->error);
- return -1;
- }
- }
-
- connection->error =
- OCILobGetLength(connection->pServiceContext,
- connection->pError,
- mydescr->ocidescr,
- &readlen);
-
- if (connection->error) {
- oci_error(connection->pError, "OCILobGetLength",connection->error);
- oci_handle_error(connection, connection->error);
- return -1;
- }
-
- buf = emalloc(readlen + 1);
-
- while (readlen > 0) { /* thies loop should not be entered on readlen == 0 */
- connection->error =
- OCILobRead(connection->pServiceContext,
- connection->pError,
- mydescr->ocidescr,
- &readlen, /* IN/OUT bytes toread/read */
- siz + 1, /* offset (starts with 1) */
- (dvoid *) ((char *) buf + siz),
- readlen, /* size of buffer */
- (dvoid *)0,
- (OCICallbackLobRead) 0, /* callback... */
- (ub2) 0, /* The character set ID of the buffer data. */
- (ub1) SQLCS_IMPLICIT); /* The character set form of the buffer data. */
-
- siz += readlen;
- readlen = LOBREADSIZE;
-
- if (connection->error == OCI_NEED_DATA) {
- buf = erealloc(buf,siz + LOBREADSIZE + 1);
- continue;
- } else {
- break;
- }
- }
-
- if (connection->error) {
- oci_error(connection->pError, "OCILobRead", connection->error);
- oci_handle_error(connection, connection->error);
- efree(buf);
- return -1;
- }
-
- if (mydescr->type == OCI_DTYPE_FILE) {
- connection->error =
- OCILobFileClose(connection->pServiceContext,
- connection->pError,
- mydescr->ocidescr);
- if (connection->error) {
- oci_error(connection->pError, "OCILobFileClose", connection->error);
- oci_handle_error(connection, connection->error);
- efree(buf);
- return -1;
- }
- }
-
- buf = erealloc(buf,siz+1);
- buf[ siz ] = 0;
-
- *buffer = buf;
- *loblen = siz;
-
- oci_debug("OCIloadlob: size=%d",siz);
-
- return 0;
-}
-/* }}} */
-/* {{{ oci_failover_callback() */
-#if 0 /* not needed yet ! */
-static sb4
-oci_failover_callback(dvoid *svchp,
- dvoid* envhp,
- dvoid *fo_ctx,
- ub4 fo_type,
- ub4 fo_event)
-{
- /*
- this stuff is from an oci sample - it will get cleaned up as soon as i understand it!!! (thies@thieso.net 990420)
- right now i cant get oracle to even call it;-(((((((((((
- */
-
- switch (fo_event)
- {
- case OCI_FO_BEGIN:
- {
- printf(" Failing Over ... Please stand by \n");
- printf(" Failover type was found to be %s \n",
- ((fo_type==OCI_FO_NONE) ? "NONE"
- :(fo_type==OCI_FO_SESSION) ? "SESSION"
- :(fo_type==OCI_FO_SELECT) ? "SELECT"
- : "UNKNOWN!"));
- printf(" Failover Context is :%s\n",
- (fo_ctx?(char *)fo_ctx:"NULL POINTER!"));
- break;
- }
-
- case OCI_FO_ABORT:
- {
- printf(" Failover aborted. Failover will not take place.\n");
- break;
- }
-
- case OCI_FO_END:
- {
- printf(" Failover ended ...resuming services\n");
- break;
- }
-
- case OCI_FO_REAUTH:
- {
- printf(" Failed over user. Resuming services\n");
-
- /* Application can check the OCI_ATTR_SESSION attribute of
- the service handle to find out the user being
- re-authenticated.
-
- After this, the application can replay any ALTER SESSION
- commands associated with this session. These must have
- been saved by the application in the fo_ctx
- */
- break;
- }
-
-
- case OCI_FO_ERROR:
- {
- printf(" Failover error gotten. Sleeping...\n");
- php_sleep(3);
- /* cannot find this blody define !!! return OCI_FO_RETRY; */
- break;
- }
-
- default:
- {
- printf("Bad Failover Event: %ld.\n", fo_event);
- break;
- }
- }
-
- return 0;
-}
-#endif
-/* }}} */
-/* {{{ oci_bind_in_callback() */
-
-static sb4
-oci_bind_in_callback(dvoid *ictxp, /* context pointer */
- OCIBind *bindp, /* bind handle */
- ub4 iter, /* 0-based execute iteration value */
- ub4 index, /* index of current array for PL/SQL or row index for SQL */
- dvoid **bufpp, /* pointer to data */
- ub4 *alenp, /* size after value/piece has been read */
- ub1 *piecep, /* which piece */
- dvoid **indpp) /* indicator value */
-{
- oci_bind *phpbind;
- zval *val;
-
- if (!(phpbind=(oci_bind *)ictxp) || !(val = phpbind->zval)) {
- php_error(E_WARNING, "!phpbind || !phpbind->val");
- return OCI_ERROR;
- }
-
- if (ZVAL_IS_NULL(val)) {
- /* we're going to insert a NULL column */
- phpbind->indicator = -1;
- *bufpp = 0;
- *alenp = -1;
- *indpp = (dvoid *)&phpbind->indicator;
- } else if ((phpbind->descr == 0) && (phpbind->pStmt == 0)) {
- /* "normal string bind */
- convert_to_string(val);
-
- *bufpp = val->value.str.val;
- *alenp = val->value.str.len;
- *indpp = (dvoid *)&phpbind->indicator;
- } else if (phpbind->pStmt != 0) {
- /* RSET */
- *bufpp = phpbind->pStmt;
- *alenp = -1; /* seems to be allright */
- *indpp = (dvoid *)&phpbind->indicator;
- } else {
- /* descriptor bind */
- *bufpp = phpbind->descr;
- *alenp = -1; /* seems to be allright */
- *indpp = (dvoid *)&phpbind->indicator;
- }
-
- *piecep = OCI_ONE_PIECE; /* pass all data in one go */
-
- return OCI_CONTINUE;
-}
-
-/* }}} */
-/* {{{ oci_bind_out_callback() */
-
-static sb4
-oci_bind_out_callback(dvoid *octxp, /* context pointer */
- OCIBind *bindp, /* bind handle */
- ub4 iter, /* 0-based execute iteration value */
- ub4 index, /* index of current array for PL/SQL or row index for SQL */
- dvoid **bufpp, /* pointer to data */
- ub4 **alenpp, /* size after value/piece has been read */
- ub1 *piecep, /* which piece */
- dvoid **indpp, /* indicator value */
- ub2 **rcodepp) /* return code */
-{
- oci_bind *phpbind;
- zval *val;
- sb4 retval = OCI_ERROR;
-
- if (!(phpbind=(oci_bind *)octxp) || !(val = phpbind->zval)) {
- php_error(E_WARNING, "!phpbind || !phpbind->val");
- return retval;
- }
-
- if ((val->type == IS_OBJECT) || (val->type == IS_RESOURCE)) {
- retval = OCI_CONTINUE;
- } else {
- convert_to_string(val);
- zval_dtor(val);
-
- val->value.str.len = OCI_PIECE_SIZE; /* 64K-1 is max XXX */
- val->value.str.val = emalloc(phpbind->zval->value.str.len);
-
- /* XXX we assume that zend-zval len has 4 bytes */
- *alenpp = (ub4*) &phpbind->zval->value.str.len;
- *bufpp = phpbind->zval->value.str.val;
- *piecep = OCI_ONE_PIECE;
- *rcodepp = &phpbind->retcode;
- *indpp = &phpbind->indicator;
- retval = OCI_CONTINUE;
- }
-
- return retval;
-}
-
-/* }}} */
-/* {{{ _oci_open_session()
-
- */
-
-static oci_session *_oci_open_session(oci_server* server,char *username,char *password,int persistent,int exclusive)
-{
- oci_session *session = 0, *psession = 0;
- OCISvcCtx *svchp = 0;
- char *hashed_details;
- OCILS_FETCH();
-
- /*
- check if we already have this user authenticated
-
- we will reuse authenticated users within a request no matter if the user requested a persistent
- connections or not!
-
- but only as pesistent requested connections will be kept between requests!
- */
-
- hashed_details = (char *) malloc(strlen(SAFE_STRING(username))+
- strlen(SAFE_STRING(password))+
- strlen(SAFE_STRING(server->dbname))+1);
-
- sprintf(hashed_details,"%s%s%s",
- SAFE_STRING(username),
- SAFE_STRING(password),
- SAFE_STRING(server->dbname));
-
- if (! exclusive) {
- zend_hash_find(OCI(user), hashed_details, strlen(hashed_details)+1, (void **) &session);
-
- if (session) {
- if (session->is_open) {
- if (persistent) {
- session->persistent = 1;
- }
- free(hashed_details);
- return session;
- } else {
- _oci_close_session(session);
- /* breakthru to open */
- }
- }
- }
-
- session = calloc(1,sizeof(oci_session));
-
- if (! session) {
- goto CLEANUP;
- }
-
- session->persistent = persistent;
- session->hashed_details = hashed_details;
- session->server = server;
- session->exclusive = exclusive;
-
- /* allocate temporary Service Context */
- OCI(error) =
- OCIHandleAlloc(OCI(pEnv),
- (dvoid **)&svchp,
- OCI_HTYPE_SVCCTX,
- 0,
- NULL);
- if (OCI(error) != OCI_SUCCESS) {
- oci_error(OCI(pError), "_oci_open_session: OCIHandleAlloc OCI_HTYPE_SVCCTX", OCI(error));
- goto CLEANUP;
- }
-
- /* allocate private session-handle */
- OCI(error) =
- OCIHandleAlloc(OCI(pEnv),
- (dvoid **)&session->pSession,
- OCI_HTYPE_SESSION,
- 0,
- NULL);
- if (OCI(error) != OCI_SUCCESS) {
- oci_error(OCI(pError), "_oci_open_session: OCIHandleAlloc OCI_HTYPE_SESSION", OCI(error));
- goto CLEANUP;
- }
-
- /* Set the server handle in service handle */
- OCI(error) =
- OCIAttrSet(svchp,
- OCI_HTYPE_SVCCTX,
- server->pServer,
- 0,
- OCI_ATTR_SERVER,
- OCI(pError));
- if (OCI(error) != OCI_SUCCESS) {
- oci_error(OCI(pError), "_oci_open_session: OCIAttrSet OCI_ATTR_SERVER", OCI(error));
- goto CLEANUP;
- }
-
- /* set the username in user handle */
- OCI(error) =
- OCIAttrSet((dvoid *) session->pSession,
- (ub4) OCI_HTYPE_SESSION,
- (dvoid *) username,
- (ub4) strlen(username),
- (ub4) OCI_ATTR_USERNAME,
- OCI(pError));
- if (OCI(error) != OCI_SUCCESS) {
- oci_error(OCI(pError), "OCIAttrSet OCI_ATTR_USERNAME", OCI(error));
- goto CLEANUP;
- }
-
- /* set the password in user handle */
- OCI(error) =
- OCIAttrSet((dvoid *) session->pSession,
- (ub4) OCI_HTYPE_SESSION,
- (dvoid *) password,
- (ub4) strlen(password),
- (ub4) OCI_ATTR_PASSWORD,
- OCI(pError));
- if (OCI(error) != OCI_SUCCESS) {
- oci_error(OCI(pError), "OCIAttrSet OCI_ATTR_PASSWORD", OCI(error));
- goto CLEANUP;
- }
-
- OCI(error) =
- OCISessionBegin(svchp,
- OCI(pError),
- session->pSession,
- (ub4) OCI_CRED_RDBMS,
- (ub4) OCI_DEFAULT);
- if (OCI(error) != OCI_SUCCESS) {
- oci_error(OCI(pError), "OCISessionBegin", OCI(error));
- goto CLEANUP;
- }
-
- /* Free Temporary Service Context */
- OCIHandleFree((dvoid *) svchp, (ub4) OCI_HTYPE_SVCCTX);
-
- if (exclusive) {
- psession = session;
- } else {
- zend_hash_update(OCI(user),
- session->hashed_details,
- strlen(session->hashed_details)+1,
- (void *)session,
- sizeof(oci_session),
- (void**)&psession);
- }
-
- psession->num = zend_list_insert(psession,le_session);
- psession->is_open = 1;
-
- oci_debug("_oci_open_session new sess=%d user=%s",psession->num,username);
-
- if (! exclusive) free(session);
-
- return psession;
-
- CLEANUP:
- oci_debug("_oci_open_session: FAILURE -> CLEANUP called");
-
- _oci_close_session(session);
-
- return 0;
-}
-
-/* }}} */
-/* {{{ _oci_close_session()
- */
-
-static void
-_oci_close_session(oci_session *session)
-{
- OCISvcCtx *svchp;
- char *hashed_details;
- OCILS_FETCH();
-
- if (! session) {
- return;
- }
-
- oci_debug("START _oci_close_session: logging-off sess=%d",session->num);
-
- if (session->is_open) {
- /* Temporary Service Context */
- OCI(error) =
- OCIHandleAlloc(OCI(pEnv),
- (dvoid **) &svchp,
- (ub4) OCI_HTYPE_SVCCTX,
- (size_t) 0,
- (dvoid **) 0);
-
- if (OCI(error) != OCI_SUCCESS) {
- oci_error(OCI(pError), "_oci_close_session OCIHandleAlloc OCI_HTYPE_SVCCTX", OCI(error));
- }
-
- /* Set the server handle in service handle */
- OCI(error) =
- OCIAttrSet(svchp,
- OCI_HTYPE_SVCCTX,
- session->server->pServer,
- 0,
- OCI_ATTR_SERVER,
- OCI(pError));
- if (OCI(error) != OCI_SUCCESS) {
- oci_error(OCI(pError), "_oci_close_session: OCIAttrSet OCI_ATTR_SERVER", OCI(error));
- }
-
- /* Set the Authentication handle in the service handle */
- OCI(error) =
- OCIAttrSet(svchp,
- OCI_HTYPE_SVCCTX,
- session->pSession,
- 0,
- OCI_ATTR_SESSION,
- OCI(pError));
- if (OCI(error) != OCI_SUCCESS) {
- oci_error(OCI(pError), "_oci_close_session: OCIAttrSet OCI_ATTR_SESSION", OCI(error));
- }
-
- OCI(error) =
- OCISessionEnd(svchp,
- OCI(pError),
- session->pSession,
- (ub4) 0);
- if (OCI(error) != OCI_SUCCESS) {
- oci_error(OCI(pError), "_oci_close_session: OCISessionEnd", OCI(error));
- }
-
- OCIHandleFree((dvoid *) svchp, (ub4) OCI_HTYPE_SVCCTX);
-
- } else {
- oci_debug("_oci_close_session: logging-off DEAD session");
- }
-
- if (session->pSession) {
- OCIHandleFree((dvoid *) session->pSession, (ub4) OCI_HTYPE_SESSION);
- }
-
- hashed_details = session->hashed_details;
-
- if (! OCI(shutdown)) {
- zend_hash_del(OCI(user), hashed_details, strlen(hashed_details)+1);
- }
-
- free(hashed_details);
-}
-
-/* }}} */
-/* {{{ _oci_open_server()
- */
-
-static oci_server *_oci_open_server(char *dbname,int persistent)
-{
- oci_server *server, *pserver = 0;
- OCILS_FETCH();
-
- /*
- check if we already have this server open
-
- we will reuse servers within a request no matter if the user requested persistent
- connections or not!
-
- but only as pesistent requested connections will be kept between requests!
- */
-
- zend_hash_find(OCI(server), dbname, strlen(dbname)+1, (void **) &pserver);
-
- if (pserver) {
- /* XXX ini-flag */
- /*
- if (! oci_ping(pserver)) {
- pserver->is_open = 0;
- }
- */
- if (pserver->is_open) {
- /* if our new users uses this connection persistent, we're keeping it! */
- if (persistent) {
- pserver->persistent = persistent;
- }
-
- return pserver;
- } else { /* server "died" in the meantime - try to reconnect! */
- _oci_close_server(pserver);
- /* breakthru to open */
- }
- }
-
- server = calloc(1,sizeof(oci_server));
-
- server->persistent = persistent;
- server->dbname = strdup(SAFE_STRING(dbname));
-
- OCIHandleAlloc(OCI(pEnv),
- (dvoid **)&server->pServer,
- OCI_HTYPE_SERVER,
- 0,
- NULL);
-
- OCI(error) =
- OCIServerAttach(server->pServer,
- OCI(pError),
- (text*)server->dbname,
- strlen(server->dbname),
- (ub4) OCI_DEFAULT);
-
- if (OCI(error)) {
- oci_error(OCI(pError), "_oci_open_server", OCI(error));
- goto CLEANUP;
- }
-
- zend_hash_update(OCI(server),
- server->dbname,
- strlen(server->dbname)+1,
- (void *)server,
- sizeof(oci_server),
- (void**)&pserver);
-
- pserver->num = zend_list_insert(pserver,le_server);
- pserver->is_open = 1;
-
- oci_debug("_oci_open_server new conn=%d dname=%s",server->num,server->dbname);
-
- free(server);
-
- return pserver;
-
- CLEANUP:
- oci_debug("_oci_open_server: FAILURE -> CLEANUP called");
-
- _oci_close_server(server);
-
- return 0;
-}
-
-#if 0
- server->failover.fo_ctx = (dvoid *) server;
- server->failover.callback_function = oci_failover_callback;
-
- error = OCIAttrSet((dvoid *)server->pServer,
- (ub4) OCI_HTYPE_SERVER,
- (dvoid *) &server->failover,
- (ub4) 0,
- (ub4) OCI_ATTR_FOCBK,
- OCI(pError));
-
- if (error) {
- oci_error(OCI(pError), "_oci_open_server OCIAttrSet OCI_ATTR_FOCBK", error);
- goto CLEANUP;
- }
-#endif
-
-
-/* }}} */
-/* {{{ _oci_close_server()
- */
-
-static int _oci_session_cleanup(void *data)
-{
- list_entry *le = (list_entry *) data;
- if (le->type == le_session) {
- oci_server *server = ((oci_session*) le->ptr)->server;
- if (server->is_open == 2)
- return 1;
- }
- return 0;
-}
-
-
-static void
-_oci_close_server(oci_server *server)
-{
- char *dbname;
- int oldopen;
- OCILS_FETCH();
- ELS_FETCH();
-
- oldopen = server->is_open;
- server->is_open = 2;
- if (! OCI(shutdown)) {
- zend_hash_apply(&EG(regular_list),_oci_session_cleanup);
- }
- server->is_open = oldopen;
-
- oci_debug("START _oci_close_server: detaching conn=%d dbname=%s",server->num,server->dbname);
-
- /* XXX close server here */
-
- if (server->is_open) {
- if (server->pServer && OCI(pError)) {
- OCI(error) =
- OCIServerDetach(server->pServer,
- OCI(pError),
- OCI_DEFAULT);
-
- if (OCI(error)) {
- oci_error(OCI(pError), "oci_close_server OCIServerDetach", OCI(error));
- }
- }
- } else {
- oci_debug("_oci_close_server: closing DEAD server");
- }
-
- if (server->pServer) {
- OCIHandleFree((dvoid *) server->pServer, (ub4) OCI_HTYPE_SERVER);
- }
-
- dbname = server->dbname;
-
- if (! OCI(shutdown)) {
- zend_hash_del(OCI(server),dbname,strlen(dbname)+1);
- }
-
- free(dbname);
-}
-
-/* }}} */
-/* {{{ oci_do_connect()
- Connect to an Oracle database and log on. returns a new session.
- */
-static void oci_do_connect(INTERNAL_FUNCTION_PARAMETERS,int persistent,int exclusive)
-{
- char *username, *password, *dbname;
- zval **userParam, **passParam, **dbParam;
- oci_server *server = 0;
- oci_session *session = 0;
- oci_connection *connection = 0;
- OCILS_FETCH();
-
- if (zend_get_parameters_ex(3, &userParam, &passParam, &dbParam) == SUCCESS) {
- convert_to_string_ex(userParam);
- convert_to_string_ex(passParam);
- convert_to_string_ex(dbParam);
-
- username = (*userParam)->value.str.val;
- password = (*passParam)->value.str.val;
- dbname = (*dbParam)->value.str.val;
- } else if (zend_get_parameters_ex(2, &userParam, &passParam) == SUCCESS) {
- convert_to_string_ex(userParam);
- convert_to_string_ex(passParam);
-
- username = (*userParam)->value.str.val;
- password = (*passParam)->value.str.val;
- dbname = "";
- } else {
- WRONG_PARAM_COUNT;
- }
-
- connection = (oci_connection *) ecalloc(1,sizeof(oci_connection));
-
- if (! connection) {
- goto CLEANUP;
- }
-
- server = _oci_open_server(dbname,persistent);
-
- if (! server) {
- goto CLEANUP;
- }
-
- persistent = server->persistent; /* if our server-context is not persistent we can't */
-
- session = _oci_open_session(server,username,password,persistent,exclusive);
-
- if (! session) {
- goto CLEANUP;
- }
-
- /* set our session */
- connection->session = session;
-
- /* allocate our private error-handle */
- OCI(error) =
- OCIHandleAlloc(OCI(pEnv),
- (dvoid **)&connection->pError,
- OCI_HTYPE_ERROR,
- 0,
- NULL);
- if (OCI(error) != OCI_SUCCESS) {
- oci_error(OCI(pError), "oci_do_connect: OCIHandleAlloc OCI_HTYPE_ERROR",OCI(error));
- goto CLEANUP;
- }
-
- /* allocate our service-context */
- OCI(error) =
- OCIHandleAlloc(OCI(pEnv),
- (dvoid **)&connection->pServiceContext,
- OCI_HTYPE_SVCCTX,
- 0,
- NULL);
- if (OCI(error) != OCI_SUCCESS) {
- oci_error(OCI(pError), "oci_do_connect: OCIHandleAlloc OCI_HTYPE_SVCCTX",OCI(error));
- goto CLEANUP;
- }
-
- /* Set the server handle in service handle */
- connection->error =
- OCIAttrSet(connection->pServiceContext,
- OCI_HTYPE_SVCCTX,
- server->pServer,
- 0,
- OCI_ATTR_SERVER,
- connection->pError);
- if (connection->error != OCI_SUCCESS) {
- oci_error(connection->pError, "oci_do_connect: OCIAttrSet OCI_ATTR_SERVER", connection->error);
- goto CLEANUP;
- }
-
- /* Set the Authentication handle in the service handle */
- connection->error =
- OCIAttrSet(connection->pServiceContext,
- OCI_HTYPE_SVCCTX,
- session->pSession,
- 0,
- OCI_ATTR_SESSION,
- connection->pError);
- if (connection->error != OCI_SUCCESS) {
- oci_error(connection->pError, "oci_do_connect: OCIAttrSet OCI_ATTR_SESSION", connection->error);
- goto CLEANUP;
- }
-
- /*
- OCIAttrSet((dvoid *)session->server->pServer,
- OCI_HTYPE_SERVER,
- (dvoid *) "demo",
- 0,
- OCI_ATTR_EXTERNAL_NAME,
- connection->pError);
-
- OCIAttrSet((dvoid *)session->server->pServer,
- OCI_HTYPE_SERVER,
- (dvoid *) "txn demo2",
- 0,
- OCI_ATTR_INTERNAL_NAME,
- connection->pError);
- */
-
- connection->id = zend_list_insert(connection, le_conn);
-
- connection->is_open = 1;
-
- oci_debug("oci_do_connect: id=%d",connection->id);
-
- RETURN_RESOURCE(connection->id);
-
- CLEANUP:
- oci_debug("oci_do_connect: FAILURE -> CLEANUP called");
-
- if (connection->id) {
- zend_list_delete(connection->id);
- } else {
- _oci_conn_list_dtor(connection);
- }
-
- RETURN_FALSE;
-}
-
-/* }}} */
-
-/************************* EXTENSION FUNCTIONS *************************/
-
-/* {{{ proto int ocidefinebyname(int stmt, string name, mixed &var [, int type])
- Define a PHP variable to an Oracle column by name */
-/* if you want to define a LOB/CLOB etc make sure you allocate it via OCINewDescriptor BEFORE defining!!!
- */
-
-PHP_FUNCTION(ocidefinebyname)
-{
- zval **stmt, **name, **var, **type;
- oci_statement *statement;
- oci_define *define, *tmp_define;
- ub2 ocitype = SQLT_CHR; /* zero terminated string */
- int ac = ZEND_NUM_ARGS();
-
- if (ac < 3 || ac > 4 || zend_get_parameters_ex(ac, &stmt, &name, &var, &type) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- switch (ac) {
- case 4:
- convert_to_long_ex(type);
- ocitype = (ub2) (*type)->value.lval;
- /* possible breakthru */
- }
-
- OCI_GET_STMT(statement,stmt);
-
- convert_to_string_ex(name);
-
- if (statement->defines == NULL) {
- ALLOC_HASHTABLE(statement->defines);
- zend_hash_init(statement->defines, 13, NULL, _oci_define_hash_dtor, 0);
- }
-
- define = ecalloc(1,sizeof(oci_define));
-
- if (zend_hash_add(statement->defines,
- (*name)->value.str.val,
- (*name)->value.str.len,
- define,
- sizeof(oci_define),
- (void **)&tmp_define) == SUCCESS) {
- efree(define);
- define = tmp_define;
- } else {
- efree(define);
- RETURN_FALSE;
- }
-
- define->name = (text*) estrndup((*name)->value.str.val,(*name)->value.str.len);
- define->name_len = (*name)->value.str.len;
- define->type = ocitype;
- define->zval = *var;
- zval_add_ref(var);
-
- RETURN_TRUE;
-}
-
-/* }}} */
-
-/* {{{ proto int ocibindbyname(int stmt, string name, mixed &var, int maxlength [, int type])
- Bind a PHP variable to an Oracle placeholder by name */
-/* if you want to bind a LOB/CLOB etc make sure you allocate it via OCINewDescriptor BEFORE binding!!!
- */
-
-PHP_FUNCTION(ocibindbyname)
-{
- zval **stmt, **name, **var, **maxlen, **type;
- oci_statement *statement;
- oci_statement *bindstmt;
- oci_bind bind, *bindp;
- oci_descriptor *descr;
-#ifdef WITH_COLLECTIONS
- oci_collection *coll;
- int mode = OCI_DATA_AT_EXEC;
- dvoid *mycoll = 0;
-#endif
- ub2 ocitype = SQLT_CHR; /* unterminated string */
- OCIStmt *mystmt = 0;
- dvoid *mydescr = 0;
- sb4 value_sz = -1;
- int ac = ZEND_NUM_ARGS(), inx;
-
- if (ac < 3 || ac > 5 || zend_get_parameters_ex(ac, &stmt, &name, &var, &maxlen, &type) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- switch (ac) {
- case 5:
- convert_to_long_ex(type);
- ocitype = (ub2) (*type)->value.lval;
- /* possible breakthru */
- case 4:
- convert_to_long_ex(maxlen);
- value_sz = (*maxlen)->value.lval;
- /* possible breakthru */
- }
-
- OCI_GET_STMT(statement,stmt);
-
- switch (ocitype) {
-#ifdef WITH_COLLECTIONS
- case SQLT_NTY:
- if((*var)->type != IS_OBJECT) {
- php_error(E_WARNING,"Variable must be allocated using OCINewCollection()");
- RETURN_FALSE;
- }
- if ((inx = _oci_get_ocicoll(*var,&coll)) == 0) {
- php_error(E_WARNING,"Variable must be allocated using OCINewCollection()");
- RETURN_FALSE;
- }
- if (! (mycoll = (dvoid *) coll->coll)) {
- php_error(E_WARNING,"Collection empty");
- RETURN_FALSE;
- }
- value_sz = sizeof(void*);
- mode = OCI_DEFAULT;
- break;
-#endif
- case SQLT_BFILEE:
- case SQLT_CFILEE:
- case SQLT_CLOB:
- case SQLT_BLOB:
- case SQLT_RDD:
- if ((*var)->type != IS_OBJECT) {
- php_error(E_WARNING,"Variable must be allocated using OCINewDescriptor()");
- RETURN_FALSE;
- }
-
- if ((inx = _oci_get_ocidesc(*var,&descr)) == 0) {
- php_error(E_WARNING,"Variable must be allocated using OCINewDescriptor()");
- RETURN_FALSE;
- }
-
- if (! (mydescr = (dvoid *) descr->ocidescr)) {
- php_error(E_WARNING,"Descriptor empty");
- RETURN_FALSE;
- }
- value_sz = sizeof(void*);
- break;
-
- case SQLT_RSET:
- OCI_GET_STMT(bindstmt,var);
-
- if (! (mystmt = bindstmt->pStmt)) {
- RETURN_FALSE;
- }
- value_sz = sizeof(void*);
- break;
- }
-
- if ((ocitype == SQLT_CHR) && (value_sz == -1)) {
- convert_to_string_ex(var);
- value_sz = (*var)->value.str.len;
- }
-
- if (value_sz == 0) {
- value_sz = 1;
- }
-
- convert_to_string_ex(name);
-
- if (! statement->binds) {
- ALLOC_HASHTABLE(statement->binds);
- zend_hash_init(statement->binds, 13, NULL, _oci_bind_hash_dtor, 0);
- }
-
- memset((void*)&bind,0,sizeof(oci_bind));
- zend_hash_next_index_insert(statement->binds,&bind,sizeof(oci_bind),(void **)&bindp);
-
- bindp->descr = mydescr;
- bindp->pStmt = mystmt;
- bindp->zval = *var;
- zval_add_ref(var);
-
- statement->error =
- OCIBindByName(statement->pStmt, /* statement handle */
- (OCIBind **)&bindp->pBind, /* bind hdl (will alloc) */
- statement->pError, /* error handle */
- (text*) (*name)->value.str.val, /* placeholder name */
- (*name)->value.str.len, /* placeholder length */
- (dvoid *)0, /* in/out data */
- value_sz, /* OCI_MAX_DATA_SIZE, */ /* max size of input/output data */
- (ub2)ocitype, /* in/out data type */
- (dvoid *)&bindp->indicator, /* indicator (ignored) */
- (ub2 *)0, /* size array (ignored) */
- (ub2 *)&bindp->retcode, /* return code (ignored) */
- (ub4)0, /* maxarr_len (PL/SQL only?) */
- (ub4 *)0, /* actual array size (PL/SQL only?) */
-#ifdef WITH_COLLECTIONS
- mode /* mode */);
-#else
- OCI_DATA_AT_EXEC /* mode */);
-#endif
-
- if (statement->error != OCI_SUCCESS) {
- oci_error(statement->pError, "OCIBindByName", statement->error);
- oci_handle_error(statement->conn, statement->error);
- RETURN_FALSE;
- }
-
-#ifdef WITH_COLLECTIONS
- if(mode == OCI_DATA_AT_EXEC) {
-#endif
- statement->error =
- OCIBindDynamic(bindp->pBind,
- statement->pError,
- (dvoid *)bindp,
- oci_bind_in_callback,
- (dvoid *)bindp,
- oci_bind_out_callback);
-
- if (statement->error != OCI_SUCCESS) {
- oci_error(statement->pError, "OCIBindDynamic", statement->error);
- oci_handle_error(statement->conn, statement->error);
- RETURN_FALSE;
- }
-#ifdef WITH_COLLECTIONS
- }
-#endif
-
-#ifdef WITH_COLLECTIONS
- if(ocitype == SQLT_NTY) {
- /* Bind object */
- statement->error = OCIBindObject(bindp->pBind,
- statement->pError,
- coll->tdo,
- (dvoid **) &(coll->coll),
- (ub4 *) 0, (dvoid **) 0, (ub4 *) 0);
- if (statement->error) {
- oci_error(statement->pError, "OCIBindObject", statement->error);
- RETURN_FALSE;
- }
- }
-#endif
-
- RETURN_TRUE;
-}
-
-/* }}} */
-
-/* {{{ proto string ocifreedesc(object lob)
- Deletes large object description */
-
-PHP_FUNCTION(ocifreedesc)
-{
- zval *id;
- int inx;
- oci_descriptor *descriptor;
-
- if ((id = getThis()) != 0) {
- inx = _oci_get_ocidesc(id,&descriptor);
- if (inx) {
- oci_debug("OCIfreedesc: descr=%d",inx);
- zend_list_delete(inx);
- RETURN_TRUE;
- }
- }
-
- php_error(E_NOTICE, "OCIFreeDesc() should not be called like this. Use $somelob->free() to free a LOB");
-
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto string ocisavelob(object lob)
- Saves a large object */
-
-PHP_FUNCTION(ocisavelob)
-{
- zval *id, **arg,**oarg;
- OCILobLocator *mylob;
- oci_connection *connection;
- oci_descriptor *descr;
- int offparam,inx;
- ub4 loblen;
- ub4 curloblen;
- ub4 offset;
-
- if ((id = getThis()) != 0) {
- if ((inx = _oci_get_ocidesc(id,&descr)) == 0) {
- RETURN_FALSE;
- }
-
- mylob = (OCILobLocator *) descr->ocidescr;
-
- if (! mylob) {
- RETURN_FALSE;
- }
-
- connection = descr->conn;
-
- offset = 0;
- if (zend_get_parameters_ex(2, &arg, &oarg) == SUCCESS) {
- convert_to_long_ex(oarg);
- offparam = (*oarg)->value.lval;
-
- connection->error =
- OCILobGetLength(connection->pServiceContext,
- connection->pError,
- mylob,
- &curloblen);
-
- oci_debug("OCIsavedesc: curloblen=%d",curloblen);
-
- if (offparam == -1) {
- offset = curloblen;
- } else if ((ub4) offparam >= curloblen) {
- php_error(E_WARNING, "Offset smaller than current LOB-Size - appending");
- offset = curloblen;
- } else {
- offset = offparam;
- }
- } else if (zend_get_parameters_ex(1, &arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- offset++;
- convert_to_string_ex(arg);
- loblen = (*arg)->value.str.len;
-
- if (loblen < 1) {
- php_error(E_WARNING, "Cannot save a lob wich size is less than 1 byte");
- RETURN_FALSE;
- }
-
- connection->error =
- OCILobWrite(connection->pServiceContext,
- connection->pError,
- mylob,
- &loblen,
- (ub4) offset,
- (dvoid *) (*arg)->value.str.val,
- (ub4) loblen,
- OCI_ONE_PIECE,
- (dvoid *)0,
- (OCICallbackLobWrite) 0,
- (ub2) 0,
- (ub1) SQLCS_IMPLICIT );
-
- oci_debug("OCIsavedesc: size=%d offset=%d",loblen,offset);
-
- if (connection->error) {
- oci_error(connection->pError, "OCILobWrite", connection->error);
- oci_handle_error(connection, connection->error);
- RETURN_FALSE;
- }
-
- RETURN_TRUE;
- }
-
- RETURN_FALSE;
-}
-
-/* }}} */
-
-/* {{{ proto string ocisavelobfile(object lob)
- Saves a large object file */
-
-PHP_FUNCTION(ocisavelobfile)
-{
- zval *id, **arg;
- OCILobLocator *mylob;
- oci_connection *connection;
- oci_descriptor *descr;
- char *filename;
- int fp,inx;
- char buf[8192];
- ub4 offset = 1;
- ub4 loblen;
-
- if ((id = getThis()) != 0) {
- if ((inx = _oci_get_ocidesc(id,&descr)) == 0) {
- RETURN_FALSE;
- }
-
- mylob = (OCILobLocator *) descr->ocidescr;
-
- if (! mylob) {
- RETURN_FALSE;
- }
-
- connection = descr->conn;
-
- if (zend_get_parameters_ex(1, &arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(arg);
-
- if (php_check_open_basedir((*arg)->value.str.val)) {
- RETURN_FALSE;
- }
-
- filename = (*arg)->value.str.val;
-
- if ((fp = VCWD_OPEN((filename, O_RDONLY|O_BINARY))) == -1) {
- php_error(E_WARNING, "Can't open file %s", filename);
- RETURN_FALSE;
- }
-
- while ((loblen = read(fp, &buf, sizeof(buf))) > 0) {
- connection->error =
- OCILobWrite(connection->pServiceContext,
- connection->pError,
- mylob,
- &loblen,
- (ub4) offset,
- (dvoid *) &buf,
- (ub4) loblen,
- OCI_ONE_PIECE,
- (dvoid *)0,
- (OCICallbackLobWrite) 0,
- (ub2) 0,
- (ub1) SQLCS_IMPLICIT);
-
- oci_debug("OCIsavelob: size=%d",loblen);
-
- if (connection->error) {
- oci_error(connection->pError, "OCILobWrite", connection->error);
- oci_handle_error(connection, connection->error);
- close(fp);
- RETURN_FALSE;
- }
-
- offset += loblen;
- }
- close(fp);
-
- RETURN_TRUE;
- }
-
- RETURN_FALSE;
-}
-
-/* }}} */
-
-/* {{{ proto string ociloadlob(object lob)
- Loads a large object */
-
-PHP_FUNCTION(ociloadlob)
-{
- zval *id;
- oci_descriptor *descr;
- char *buffer;
- int inx;
- ub4 loblen;
-
- if ((id = getThis()) != 0) {
- if ((inx = _oci_get_ocidesc(id,&descr)) == 0) {
- RETURN_FALSE;
- }
-
- if (!oci_loadlob(descr->conn,descr,&buffer,&loblen)) {
- RETURN_STRINGL(buffer,loblen,0);
- }
- }
-
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto void ociwritelobtofile(object lob [, string filename] [, int start] [, int length])
- Writes a large object into a file */
-
-PHP_FUNCTION(ociwritelobtofile)
-{
- zval *id, **zfilename, **zstart, **zlength;
- char *filename = NULL;
- int start = -1;
- ub4 length = -1;
- oci_connection *connection;
- oci_descriptor *descr;
- char *buffer=0;
- ub4 loblen;
- int ac = ZEND_NUM_ARGS();
- int fp = -1,inx;
- OCILobLocator *mylob;
- int coffs;
-
- if ((id = getThis()) != 0) {
- if ((inx = _oci_get_ocidesc(id,&descr)) == 0) {
- RETURN_FALSE;
- }
-
- mylob = (OCILobLocator *) descr->ocidescr;
-
- if (! mylob) {
- RETURN_FALSE;
- }
-
- connection = descr->conn;
-
- if (ac < 0 || ac > 3 || zend_get_parameters_ex(ac, &zfilename, &zstart, &zlength) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- switch (ac) {
- case 3:
- convert_to_long_ex(zlength);
- length = (*zlength)->value.lval;
- case 2:
- convert_to_long_ex(zstart);
- start = (*zstart)->value.lval;
- case 1:
- convert_to_string_ex(zfilename);
- filename = (*zfilename)->value.str.val;
- }
-
- if (filename && *filename) {
- if (php_check_open_basedir(filename)) {
- goto bail;
- }
-
- if ((fp = VCWD_OPEN((filename,O_CREAT | O_RDWR | O_BINARY | O_TRUNC, 0600))) == -1) {
- php_error(E_WARNING, "Can't create file %s", filename);
- goto bail;
- }
- }
-
- connection->error =
- OCILobGetLength(connection->pServiceContext,
- connection->pError,
- descr->ocidescr,
- &loblen);
-
- if (connection->error) {
- oci_error(connection->pError, "OCILobGetLength", connection->error);
- oci_handle_error(connection, connection->error);
- goto bail;
- }
-
- if (descr->type == OCI_DTYPE_FILE) {
- connection->error =
- OCILobFileOpen(connection->pServiceContext,
- connection->pError,
- descr->ocidescr,
- OCI_FILE_READONLY);
- if (connection->error) {
- oci_error(connection->pError, "OCILobFileOpen",connection->error);
- oci_handle_error(connection, connection->error);
- goto bail;
- }
- }
-
- if (start == -1) {
- start = 0;
- }
-
- if (length == -1) {
- length = loblen - start;
- }
-
- if ((start + length) > loblen) {
- length = loblen - start;
- }
-
-#define OCI_LOB_READ_BUFFER 128*1024
-
- buffer = emalloc(OCI_LOB_READ_BUFFER);
-
- coffs = start;
-
- oci_debug("ociwritelobtofile(start = %d, length = %d, loblen = %d",start,length,loblen);
-
- while (length > 0) {
- ub4 toread;
-
- if (length > OCI_LOB_READ_BUFFER) {
- toread = OCI_LOB_READ_BUFFER;
- } else {
- toread = length;
- }
-
- oci_debug("OCILobRead(coffs = %d, toread = %d",coffs,toread);
-
- connection->error =
- OCILobRead(connection->pServiceContext,
- connection->pError,
- descr->ocidescr,
- &toread, /* IN/OUT bytes toread/read */
- coffs+1, /* offset (starts with 1) */
- (dvoid *) buffer,
- toread, /* size of buffer */
- (dvoid *)0,
- (OCICallbackLobRead) 0, /* callback... */
- (ub2) 0, /* The character set ID of the buffer data. */
- (ub1) SQLCS_IMPLICIT); /* The character set form of the buffer data. */
-
- oci_debug("OCILobRead(read - %d",toread);
-
- if (connection->error) {
- oci_error(connection->pError, "OCILobRead", connection->error);
- oci_handle_error(connection, connection->error);
- goto bail;
- }
-
- if (fp != -1) {
- if ((ub4) write(fp,buffer,toread) != toread) {
- php_error(E_WARNING, "cannot write file!");
- goto bail;
- }
- } else {
- PHPWRITE(buffer,toread);
- }
-
- length -= toread;
- coffs += toread;
- }
-
- efree(buffer);
- buffer = 0;
-
- if (fp != -1) {
- close(fp);
- fp = 0;
- }
-
- if (descr->type == OCI_DTYPE_FILE) {
- connection->error =
- OCILobFileClose(connection->pServiceContext,
- connection->pError,
- descr->ocidescr);
- if (connection->error) {
- oci_error(connection->pError, "OCILobFileClose", connection->error);
- oci_handle_error(connection, connection->error);
- goto bail;
- }
- }
- RETURN_TRUE;
- }
-
- bail:
- if (fp != -1) {
- close(fp);
- }
-
- if (buffer) {
- efree(buffer);
- }
-
- RETURN_FALSE;
-}
-/* }}} */
-
-#ifdef HAVE_OCI8_TEMP_LOB
-/* {{{ proto int ociwritetemporarylob(int stmt, int loc, string var)
- Return the row count of an OCI statement */
-
-PHP_FUNCTION(ociwritetemporarylob)
-{
- zval *id, **var;
- OCILobLocator *mylob;
- oci_connection *connection;
- oci_descriptor *descr;
- ub4 offset = 1;
- ub4 loblen;
-
- oci_debug ("oci_write_temporary_lob");
-
- if ((id = getThis()) == 0) {
- RETURN_FALSE;
- }
-
- if (_oci_get_ocidesc(id,&descr) == 0) {
- RETURN_FALSE;
- }
-
- mylob = (OCILobLocator *) descr->ocidescr;
-
- if (! mylob) {
- RETURN_FALSE;
- }
-
- connection = descr->conn;
-
- if (zend_get_parameters_ex(1, &var) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(var);
-
- connection->error =
- OCILobCreateTemporary(connection->pServiceContext,
- connection->pError,
- mylob,
- OCI_DEFAULT,
- OCI_DEFAULT,
- OCI_TEMP_CLOB,
- TRUE,
- OCI_DURATION_SESSION);
-
- if (connection->error) {
- oci_error(connection->pError, "OCILobCreateTemporary", connection->error);
- oci_handle_error(connection, connection->error);
- RETURN_FALSE;
- }
-
- connection->error =
- OCILobOpen(connection->pServiceContext,
- connection->pError,
- mylob,
- OCI_LOB_READWRITE);
-
- if (connection->error) {
- oci_error(connection->pError, "OCILobOpen", connection->error);
- oci_handle_error(connection, connection->error);
- RETURN_FALSE;
- }
-
- convert_to_string_ex(var);
- loblen = (*var)->value.str.len;
-
- if (loblen < 1) {
- php_error(E_WARNING, "Cannot save a lob wich size is less than 1 byte");
- RETURN_FALSE;
- }
-
- connection->error =
- OCILobWrite(connection->pServiceContext,
- connection->pError,
- mylob,
- (ub4 *) &loblen,
- (ub4) offset,
- (dvoid *) (*var)->value.str.val,
- (ub4) loblen,
- OCI_ONE_PIECE,
- (dvoid *)0,
- (sb4 (*)(dvoid *, dvoid *, ub4 *, ub1 *)) 0,
- (ub2) 0,
- (ub1) SQLCS_IMPLICIT );
-
- if (connection->error) {
- oci_error(connection->pError, "OCILobWrite", connection->error);
- oci_handle_error(connection, connection->error);
- RETURN_FALSE;
- }
-
- RETURN_TRUE;
-}
-
-/* }}} */
-
-/* {{{ proto string ocicloselob(object lob)
- Closes lob descriptor */
-
-PHP_FUNCTION(ocicloselob)
-{
- zval *id;
- int inx;
- OCILobLocator *mylob;
- oci_connection *connection;
- oci_descriptor *descriptor;
-
- if ((id = getThis()) != 0) {
- inx = _oci_get_ocidesc(id,&descriptor);
- if (inx) {
-
- mylob = (OCILobLocator *) descriptor->ocidescr;
-
- if (! mylob) {
- RETURN_FALSE;
- }
-
- connection = descriptor->conn;
-
- connection->error = OCILobClose (connection->pServiceContext,
- connection->pError,
- mylob);
-
- if (connection->error) {
- oci_error(connection->pError, "OCILobClose", connection->error);
- oci_handle_error(connection, connection->error);
- RETURN_FALSE;
- }
-
- oci_debug("oci_close_lob: descr=%d",inx);
- RETURN_TRUE;
- }
- }
-
- php_error(E_NOTICE, "OCICloselob() should not be called like this. Use $somelob->close() to close a LOB");
-
- RETURN_FALSE;
-}
-
-/* }}} */
-#endif
-
-/* {{{ proto string ocinewdescriptor(int connection [, int type])
- Initialize a new empty descriptor LOB/FILE (LOB is default) */
-
-PHP_FUNCTION(ocinewdescriptor)
-{
- zval **conn, **type;
- oci_connection *connection;
- oci_descriptor *descr;
- int dtype;
-
- dtype = OCI_DTYPE_LOB;
-
- if (zend_get_parameters_ex(2, &conn, &type) == SUCCESS) {
- convert_to_long_ex(type);
- dtype = (*type)->value.lval;
- } else if (zend_get_parameters_ex(1, &conn) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- OCI_GET_CONN(connection,conn);
-
- descr = oci_new_desc(dtype,connection);
-
- object_init_ex(return_value, oci_lob_class_entry_ptr);
- add_property_resource(return_value, "descriptor", descr->id);
-}
-
-/* }}} */
-
-/* {{{ proto string ocirollback(int conn)
- Rollback the current context */
-
-PHP_FUNCTION(ocirollback)
-{
- zval **conn;
- oci_connection *connection;
-
- if (zend_get_parameters_ex(1, &conn) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- OCI_GET_CONN(connection,conn);
-
- connection->error =
- OCITransRollback(connection->pServiceContext,
- connection->pError,
- (ub4)0);
-
- if (connection->error) {
- oci_error(connection->pError, "OCIRollback", connection->error);
- oci_handle_error(connection, connection->error);
- RETURN_FALSE;
- }
-
- RETURN_TRUE;
-}
-
-/* }}} */
-
-/* {{{ proto string ocicommit(int conn)
- Commit the current context */
-
-PHP_FUNCTION(ocicommit)
-{
- zval **conn;
- oci_connection *connection;
-
- if (zend_get_parameters_ex(1, &conn) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- OCI_GET_CONN(connection,conn);
-
- oci_debug("<OCITransCommit");
-
- connection->error =
- OCITransCommit(connection->pServiceContext,
- connection->pError,
- (ub4)0);
-
- oci_debug(">OCITransCommit");
-
- if (connection->error) {
- oci_error(connection->pError, "OCICommit", connection->error);
- oci_handle_error(connection, connection->error);
- RETURN_FALSE;
- }
-
- RETURN_TRUE;
-}
-
-/* }}} */
-
-/* {{{ proto string ocicolumnname(int stmt, int col)
- Tell the name of a column */
-
-PHP_FUNCTION(ocicolumnname)
-{
- zval **stmt, **col;
- oci_statement *statement;
- oci_out_column *outcol;
-
- if (zend_get_parameters_ex(2, &stmt, &col) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- OCI_GET_STMT(statement,stmt);
-
- outcol = oci_get_col(statement, -1, col);
- if (outcol == NULL) {
- RETURN_FALSE;
- }
-
- RETURN_STRINGL(outcol->name, outcol->name_len, 1);
-}
-
-/* }}} */
-
-/* {{{ proto int ocicolumnsize(int stmt, int col)
- Tell the maximum data size of a column */
-
-PHP_FUNCTION(ocicolumnsize)
-{
- zval **stmt, **col;
- oci_statement *statement;
- oci_out_column *outcol;
-
- if (zend_get_parameters_ex(2, &stmt, &col) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- OCI_GET_STMT(statement,stmt);
-
- outcol = oci_get_col(statement, -1, col);
- if (outcol == NULL) {
- RETURN_FALSE;
- }
-
- oci_debug("ocicolumnsize: %16s, retlen = %4d, retlen4 = %d, data_size = %4d, storage_size4 = %4d, indicator %4d, retcode = %4d",
- outcol->name,outcol->retlen,outcol->retlen4,outcol->data_size,outcol->storage_size4,outcol->indicator,outcol->retcode);
-
- /* Handle data type of LONG */
- if(outcol->data_type == SQLT_LNG){
- RETURN_LONG(outcol->storage_size4);
- }else{
- RETURN_LONG(outcol->data_size);
- }
-}
-
-/* }}} */
-
-/* {{{ proto int ocicolumnscale(int stmt, int col)
- Tell the scale of a column */
-
-PHP_FUNCTION(ocicolumnscale)
-{
- zval **stmt, **col;
- oci_statement *statement;
- oci_out_column *outcol;
-
- if (zend_get_parameters_ex(2, &stmt, &col) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- OCI_GET_STMT(statement,stmt);
-
- outcol = oci_get_col(statement, -1, col);
- if (outcol == NULL) {
- RETURN_FALSE;
- }
- RETURN_LONG(outcol->scale);
-}
-
-/* }}} */
-
-/* {{{ proto int ocicolumnprecision(int stmt, int col)
- Tell the precision of a column */
-
-PHP_FUNCTION(ocicolumnprecision)
-{
- zval **stmt, **col;
- oci_statement *statement;
- oci_out_column *outcol;
-
- if (zend_get_parameters_ex(2, &stmt, &col) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- OCI_GET_STMT(statement,stmt);
-
- outcol = oci_get_col(statement, -1, col);
- if (outcol == NULL) {
- RETURN_FALSE;
- }
- RETURN_LONG(outcol->precision);
-}
-
-/* }}} */
-
-/* {{{ proto mixed ocicolumntype(int stmt, int col)
- Tell the data type of a column */
-
-PHP_FUNCTION(ocicolumntype)
-{
- zval **stmt, **col;
- oci_statement *statement;
- oci_out_column *outcol;
-
- if (zend_get_parameters_ex(2, &stmt, &col) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- OCI_GET_STMT(statement,stmt);
-
- outcol = oci_get_col(statement, -1, col);
- if (outcol == NULL) {
- RETURN_FALSE;
- }
- switch (outcol->data_type) {
- case SQLT_DAT:
- RETVAL_STRING("DATE",1);
- break;
- case SQLT_NUM:
- RETVAL_STRING("NUMBER",1);
- break;
- case SQLT_LNG:
- RETVAL_STRING("LONG",1);
- break;
- case SQLT_BIN:
- RETVAL_STRING("RAW",1);
- break;
- case SQLT_LBI:
- RETVAL_STRING("LONG RAW",1);
- break;
- case SQLT_CHR:
- RETVAL_STRING("VARCHAR",1);
- break;
- case SQLT_RSET:
- RETVAL_STRING("REFCURSOR",1);
- break;
- case SQLT_AFC:
- RETVAL_STRING("CHAR",1);
- break;
- case SQLT_BLOB:
- RETVAL_STRING("BLOB",1);
- break;
- case SQLT_CLOB:
- RETVAL_STRING("CLOB",1);
- break;
- case SQLT_BFILE:
- RETVAL_STRING("BFILE",1);
- break;
- case SQLT_RDD:
- RETVAL_STRING("ROWID",1);
- break;
- default:
- RETVAL_LONG(outcol->data_type);
- }
-}
-
-/* }}} */
-
-/* {{{ proto mixed ocicolumntyperaw(int stmt, int col)
- Tell the raw oracle data type of a column */
-
-PHP_FUNCTION(ocicolumntyperaw)
-{
- zval **stmt, **col;
- oci_statement *statement;
- oci_out_column *outcol;
-
- if (zend_get_parameters_ex(2, &stmt, &col) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- OCI_GET_STMT(statement,stmt);
-
- outcol = oci_get_col(statement, -1, col);
- if (outcol == NULL) {
- RETURN_FALSE;
- }
- RETVAL_LONG(outcol->data_type);
-}
-
-/* }}} */
-
-/* {{{ proto int ocicolumnisnull(int stmt, int col)
- Tell whether a column is NULL */
-
-PHP_FUNCTION(ocicolumnisnull)
-{
- zval **stmt, **col;
- oci_statement *statement;
- oci_out_column *outcol;
-
- if (zend_get_parameters_ex(2, &stmt, &col) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- OCI_GET_STMT(statement,stmt);
-
- outcol = oci_get_col(statement, -1, col);
- if (outcol == NULL) {
- RETURN_FALSE;
- }
- if (outcol->indicator == -1) {
- RETURN_TRUE;
- } else {
- RETURN_FALSE;
- }
-}
-
-/* }}} */
-
-/* {{{ proto void ociinternaldebug(int onoff)
- Toggle internal debugging output for the OCI extension */
-/* Disables or enables the internal debug output.
- * By default it is disabled.
- */
-PHP_FUNCTION(ociinternaldebug)
-{
- zval **arg;
- OCILS_FETCH();
-
- if (zend_get_parameters_ex(1, &arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(arg);
- OCI(debug_mode) = (*arg)->value.lval;
-}
-
-
-/* }}} */
-
-/* {{{ proto int ociexecute(int stmt [, int mode])
- Execute a parsed statement */
-
-PHP_FUNCTION(ociexecute)
-{
- zval **stmt,**mode;
- oci_statement *statement;
- ub4 execmode;
-
- if (zend_get_parameters_ex(2, &stmt, &mode) == SUCCESS) {
- convert_to_long_ex(mode);
- execmode = (*mode)->value.lval;
- } else if (zend_get_parameters_ex(1, &stmt) == SUCCESS) {
- execmode = OCI_COMMIT_ON_SUCCESS;
- } else {
- WRONG_PARAM_COUNT;
- }
-
- OCI_GET_STMT(statement,stmt);
-
- if (oci_execute(statement, "OCIExecute",execmode)) {
- RETURN_TRUE;
- } else {
- RETURN_FALSE;
- }
-}
-
-/* }}} */
-
-/* {{{ proto int ocicancel(int stmt)
- Prepare a new row of data for reading */
-
-PHP_FUNCTION(ocicancel)
-{
- zval **stmt;
- oci_statement *statement;
-
- if (zend_get_parameters_ex(1, &stmt) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- OCI_GET_STMT(statement,stmt);
-
- if (oci_fetch(statement, 0, "OCICancel")) {
- RETURN_TRUE;
- } else {
- RETURN_FALSE;
- }
-}
-
-/* }}} */
-
-/* {{{ proto int ocifetch(int stmt)
- Prepare a new row of data for reading */
-
-PHP_FUNCTION(ocifetch)
-{
- zval **stmt;
- oci_statement *statement;
- ub4 nrows = 1; /* only one row at a time is supported for now */
-
- if (zend_get_parameters_ex(1, &stmt) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- OCI_GET_STMT(statement,stmt);
-
- if (oci_fetch(statement, nrows, "OCIFetch")) {
- RETURN_TRUE;
- } else {
- RETURN_FALSE;
- }
-}
-
-/* }}} */
-
-/* {{{ proto int ocifetchinto(int stmt, array &output [, int mode])
- Fetch a row of result data into an array */
-
-PHP_FUNCTION(ocifetchinto)
-{
- zval **stmt, **array, *element, **fmode;
- oci_statement *statement;
- oci_out_column *column;
- ub4 nrows = 1;
- int i, used;
- int mode = OCI_NUM;
- int ac = ZEND_NUM_ARGS();
-
- if (ac < 2 || ac > 3 || zend_get_parameters_ex(ac, &stmt, &array, &fmode) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- switch (ac) {
- case 3:
- convert_to_long_ex(fmode);
- mode = (*fmode)->value.lval;
- /* possible breakthru */
- }
-
- OCI_GET_STMT(statement,stmt);
-
- if (!oci_fetch(statement, nrows, "OCIFetchInto")) {
- RETURN_FALSE;
- }
-
- zval_dtor(*array);
- if (array_init(*array) == FAILURE) {
- php_error(E_WARNING, "OCIFetchInto: unable to convert arg 2 to array");
- RETURN_FALSE;
- }
-
- for (i = 0; i < statement->ncolumns; i++) {
- column = oci_get_col(statement, i + 1, 0);
- if (column == NULL) {
- continue;
- }
-
- if ((column->indicator == -1) && ((mode & OCI_RETURN_NULLS) == 0)) {
- continue;
- }
-
- used = 0;
- MAKE_STD_ZVAL(element);
- _oci_make_zval(element,statement,column,"OCIFetchInto",mode);
-
- if ((mode & OCI_NUM) || (! (mode & OCI_ASSOC))) {
- zend_hash_index_update((*array)->value.ht,i,(void *)&element,sizeof(zval*),NULL);
- used=1;
- }
-
- if (mode & OCI_ASSOC) {
- if (used) {
- element->refcount++;
- }
- zend_hash_update((*array)->value.ht,column->name,column->name_len+1,(void *)&element,sizeof(zval*),NULL);
- }
- }
-
- RETURN_LONG(statement->ncolumns);
-}
-
-/* }}} */
-
-/* {{{ proto int ocifetchstatement(int stmt, array &output)
- Fetch all rows of result data into an array */
-
-PHP_FUNCTION(ocifetchstatement)
-{
- zval **stmt, **array, *element, **fmode, *tmp;
- oci_statement *statement;
- oci_out_column **columns;
- zval ***outarrs;
- ub4 nrows = 1;
- int i;
- int mode = OCI_NUM;
- int rows = 0;
- char *namebuf;
- int ac = ZEND_NUM_ARGS();
-
- if (ac < 2 || ac > 3 || zend_get_parameters_ex(ac, &stmt, &array, &fmode) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- switch (ac) {
- case 3:
- convert_to_long_ex(fmode);
- mode = (*fmode)->value.lval;
- /* possible breakthru */
- }
-
- OCI_GET_STMT(statement,stmt);
-
- zval_dtor(*array);
- array_init(*array);
-
- columns = emalloc(statement->ncolumns * sizeof(oci_out_column *));
- outarrs = emalloc(statement->ncolumns * sizeof(zval*));
-
- for (i = 0; i < statement->ncolumns; i++) {
- columns[ i ] = oci_get_col(statement, i + 1, 0);
-
- MAKE_STD_ZVAL(tmp);
- array_init(tmp);
-
- namebuf = estrndup(columns[ i ]->name,columns[ i ]->name_len);
-
- zend_hash_update((*array)->value.ht, namebuf, columns[ i ]->name_len+1, (void *) &tmp, sizeof(zval*), (void **) &(outarrs[ i ]));
- efree(namebuf);
- }
-
- while (oci_fetch(statement, nrows, "OCIFetchStatement")) {
- for (i = 0; i < statement->ncolumns; i++) {
- MAKE_STD_ZVAL(element);
-
- _oci_make_zval(element,statement,columns[ i ], "OCIFetchStatement",OCI_RETURN_LOBS);
-
- zend_hash_index_update((*(outarrs[ i ]))->value.ht, rows, (void *)&element, sizeof(zval*), NULL);
- }
- rows++;
- }
-
- efree(columns);
- efree(outarrs);
-
- RETURN_LONG(rows);
-}
-
-/* }}} */
-
-/* {{{ proto int ocifreestatement(int stmt)
- Free all resources associated with a statement */
-
-PHP_FUNCTION(ocifreestatement)
-{
- zval **stmt;
- oci_statement *statement;
-
- if (zend_get_parameters_ex(1, &stmt) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- OCI_GET_STMT(statement,stmt);
-
- zend_list_delete(statement->id);
-
- RETURN_TRUE;
-}
-
-/* }}} */
-
-/* {{{ proto int ocilogoff(int conn)
- Disconnect from database */
-
-PHP_FUNCTION(ocilogoff)
-{
-#if 0
- this function does nothing any more. server-connections get automagiclly closed on
- request-end. connection handles will "dissappear" as soon as they are no longer
- referenced. as this module makes heavy use of zends reference-counting mechanism
- this is the desired behavior. it has always been a bad idea to close a connection that
- has outstanding transactions. this way we have a nice-clean approach.
- (thies@thieso.net 20000110)
-
- oci_connection *connection;
- zval **conn;
-
- if (zend_get_parameters_ex(1, &conn) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- OCI_GET_CONN(connection,conn);
-
- connection->is_open = 0;
-
- zend_hash_apply(list,(int (*)(void *))_stmt_cleanup);
-
- if (zend_list_delete(connection->id) == SUCCESS) {
- RETURN_TRUE;
- } else {
- RETURN_FALSE;
- }
-#endif
-}
-
-/* }}} */
-
-/* {{{ proto int ocinlogon(string user, string pass [, string db])
- Connect to an Oracle database and log on. returns a new session */
-
-/* Connects to an Oracle 8 database and logs on. If the
- * optional third parameter is not specified, PHP uses the environment
- * variable ORACLE_SID to determine which database to connect to.
- */
-PHP_FUNCTION(ocinlogon)
-{
- oci_do_connect(INTERNAL_FUNCTION_PARAM_PASSTHRU,0,1);
-}
-
-/* }}} */
-
-/* {{{ proto int ocilogon(string user, string pass [, string db])
- Connect to an Oracle database and log on. Returns a new session.
- */
-
-/* Connects to an Oracle 8 database and logs on. If the
- * optional third parameter is not specified, PHP uses the environment
- * variable ORACLE_SID to determine which database to connect to.
- */
-PHP_FUNCTION(ocilogon)
-{
- oci_do_connect(INTERNAL_FUNCTION_PARAM_PASSTHRU,0,0);
-}
-
-/* }}} */
-
-/* {{{ proto int ociplogon(string user, string pass [, string db])
- Connect to an Oracle database using a persistent connection and log on. Returns a new session. */
-
-/* Connects to an Oracle 8 database and logs on. If the
- * optional third parameter is not specified, PHP uses the environment
- * variable ORACLE_SID to determine which database to connect to.
- */
-PHP_FUNCTION(ociplogon)
-{
- oci_do_connect(INTERNAL_FUNCTION_PARAM_PASSTHRU,1,0);
-}
-
-/* }}} */
-
-/* {{{ proto array ocierror([int stmt|conn|global])
- Return the last error of stmt|conn|global. If no error happened returns false. */
-
-PHP_FUNCTION(ocierror)
-{
- zval **arg;
- oci_statement *statement;
- oci_connection *connection;
- text errbuf[512];
- sb4 errcode = 0;
- sword error = 0;
- dvoid *errh = NULL;
-
- OCILS_FETCH();
-
- if (zend_get_parameters_ex(1, &arg) == SUCCESS) {
- statement = (oci_statement *) zend_fetch_resource(arg, -1, NULL, NULL, 1, le_stmt);
- if (statement) {
- errh = statement->pError;
- error = statement->error;
- } else {
- connection = (oci_connection *) zend_fetch_resource(arg, -1, NULL, NULL, 1, le_conn);
- if (connection) {
- errh = connection->pError;
- error = connection->error;
- }
- }
- } else {
- errh = OCI(pError);
- error = OCI(error);
- }
-
- if (! error) { /* no error set in the handle */
- RETURN_FALSE;
- }
-
- if (! errh) {
- php_error(E_WARNING, "OCIError: unable to find Error handle");
- RETURN_FALSE;
- }
-
- OCIErrorGet(errh,1,NULL,&errcode,errbuf,(ub4)sizeof(errbuf),(ub4)OCI_HTYPE_ERROR);
-
- if (errcode) {
- array_init(return_value);
- add_assoc_long(return_value, "code", errcode);
- add_assoc_string(return_value, "message", (char*) errbuf, 1);
- } else {
- RETURN_FALSE;
- }
-}
-
-/* }}} */
-
-/* {{{ proto int ocinumcols(int stmt)
- Return the number of result columns in a statement */
-
-PHP_FUNCTION(ocinumcols)
-{
- zval **stmt;
- oci_statement *statement;
-
- if (zend_get_parameters_ex(1, &stmt) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- OCI_GET_STMT(statement,stmt);
-
- RETURN_LONG(statement->ncolumns);
-}
-
-/* }}} */
-
-/* {{{ proto int ociparse(int conn, string query)
- Parse a query and return a statement */
-
-PHP_FUNCTION(ociparse)
-{
- zval **conn, **query;
- oci_connection *connection;
- oci_statement *statement;
-
- if (zend_get_parameters_ex(2, &conn, &query) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- OCI_GET_CONN(connection,conn);
-
- convert_to_string_ex(query);
-
- statement = oci_parse(connection,(*query)->value.str.val,(*query)->value.str.len);
-
- if (statement) {
- RETURN_RESOURCE(statement->id);
- } else {
- RETURN_FALSE;
- }
-}
-
-/* }}} */
-
-/* {{{ proto int ocisetprefetch(int conn, string query)
- Set a prefetch query??? */
-
-PHP_FUNCTION(ocisetprefetch)
-{
- zval **stmt, **size;
- oci_statement *statement;
-
- if (zend_get_parameters_ex(2, &stmt, &size) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(size);
-
- OCI_GET_STMT(statement,stmt);
-
- oci_setprefetch(statement,(*size)->value.lval);
-
- RETURN_TRUE;
-}
-
-/* }}} */
-
-/* {{{ proto int ocinewcursor(int conn)
- Return a new cursor (Statement-Handle) - use this to bind ref-cursors! */
-
-PHP_FUNCTION(ocinewcursor)
-{
- zval **conn;
- oci_connection *connection;
- oci_statement *statement;
-
- if (zend_get_parameters_ex(1, &conn) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- OCI_GET_CONN(connection,conn);
-
- statement = oci_parse(connection,0,0);
-
- RETURN_RESOURCE(statement->id);
-}
-
-/* }}} */
-
-/* {{{ proto string ociresult(int stmt, mixed column)
- Return a single column of result data */
-
-PHP_FUNCTION(ociresult)
-{
- zval **stmt, **col;
- oci_statement *statement;
- oci_out_column *outcol = NULL;
-
- if (zend_get_parameters_ex(2, &stmt, &col) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- OCI_GET_STMT(statement,stmt);
-
- outcol = oci_get_col(statement, -1, col);
-
- if (outcol == NULL) {
- RETURN_FALSE;
- }
-
- _oci_make_zval(return_value,statement,outcol, "OCIResult",0);
-}
-
-/* }}} */
-
-/* {{{ proto string ociserverversion(int conn)
- Return a string containing server version information */
-
-PHP_FUNCTION(ociserverversion)
-{
- oci_connection *connection;
- zval **conn;
- char version[256];
-
- if (zend_get_parameters_ex(1, &conn) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- OCI_GET_CONN(connection,conn);
-
- connection->error =
- OCIServerVersion(connection->pServiceContext,
- connection->pError,
- (text*)version,
- sizeof(version),
- OCI_HTYPE_SVCCTX);
-
- if (connection->error != OCI_SUCCESS) {
- oci_error(connection->pError, "OCIServerVersion", connection->error);
- oci_handle_error(connection, connection->error);
- RETURN_FALSE;
- }
-
- RETURN_STRING(version,1);
-}
-
-/* }}} */
-
-/* {{{ proto int ocistatementtype(int stmt)
- Return the query type of an OCI statement */
-
-/* XXX it would be better with a general interface to OCIAttrGet() */
-
-PHP_FUNCTION(ocistatementtype)
-{
- zval **stmt;
- oci_statement *statement;
- ub2 stmttype;
-
- if (zend_get_parameters_ex(1, &stmt) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- OCI_GET_STMT(statement,stmt);
-
- statement->error =
- OCIAttrGet((dvoid *)statement->pStmt,
- OCI_HTYPE_STMT,
- (ub2 *)&stmttype,
- (ub4 *)0,
- OCI_ATTR_STMT_TYPE,
- statement->pError);
- if (statement->error != OCI_SUCCESS) {
- oci_error(statement->pError, "OCIStatementType", statement->error);
- oci_handle_error(statement->conn, statement->error);
- RETURN_FALSE;
- }
-
- switch (stmttype) {
- case OCI_STMT_SELECT:
- RETVAL_STRING("SELECT",1);
- break;
- case OCI_STMT_UPDATE:
- RETVAL_STRING("UPDATE",1);
- break;
- case OCI_STMT_DELETE:
- RETVAL_STRING("DELETE",1);
- break;
- case OCI_STMT_INSERT:
- RETVAL_STRING("INSERT",1);
- break;
- case OCI_STMT_CREATE:
- RETVAL_STRING("CREATE",1);
- break;
- case OCI_STMT_DROP:
- RETVAL_STRING("DROP",1);
- break;
- case OCI_STMT_ALTER:
- RETVAL_STRING("ALTER",1);
- break;
- case OCI_STMT_BEGIN:
- RETVAL_STRING("BEGIN",1);
- break;
- case OCI_STMT_DECLARE:
- RETVAL_STRING("DECLARE",1);
- break;
- default:
- RETVAL_STRING("UNKNOWN",1);
- }
-}
-/* }}} */
-
-/* {{{ proto int ocirowcount(int stmt)
- Return the row count of an OCI statement */
-
-PHP_FUNCTION(ocirowcount)
-{
- zval **stmt;
- oci_statement *statement;
- ub4 rowcount;
-
- if (zend_get_parameters_ex(1, &stmt) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- OCI_GET_STMT(statement,stmt);
-
- statement->error =
- OCIAttrGet((dvoid *)statement->pStmt,
- OCI_HTYPE_STMT,
- (ub2 *)&rowcount,
- (ub4 *)0,
- OCI_ATTR_ROW_COUNT,
- statement->pError);
-
- if (statement->error != OCI_SUCCESS) {
- oci_error(statement->pError, "OCIRowCount", statement->error);
- oci_handle_error(statement->conn, statement->error);
- RETURN_FALSE;
- }
-
- RETURN_LONG(rowcount);
-}
-
-/* }}} */
-
-#ifdef WITH_COLLECTIONS
-/* {{{ oci_get_coll() */
-
-static oci_collection *oci_get_coll(int ind)
-{
- oci_collection *collection;
- int actual_resource_type;
-
- collection = (oci_collection *) zend_list_find(ind, &actual_resource_type);
-
- if (collection && (actual_resource_type == le_coll)) {
- return collection;
- } else {
- return (oci_collection *) NULL;
- }
-}
-/* }}} */
-
-/* {{{ proto string ocifreecollection(object lob)
- Deletes collection object*/
-
-PHP_FUNCTION(ocifreecollection)
-{
- zval *id;
- int inx;
- oci_collection *coll;
- oci_connection *connection;
- OCILS_FETCH();
-
- if ((id = getThis()) != 0) {
- inx = _oci_get_ocicoll(id,&coll);
- if (inx) {
- /*
- * Do we need to free the object?
- *
- */
- connection = coll->conn;
- oci_debug("OCIfreecollection: coll=%d",inx);
- connection->error = OCIObjectFree(OCI(pEnv),
- connection->pError,
- (dvoid *)coll->coll,
- (ub2)(OCI_OBJECTFREE_FORCE));
- if (connection->error) {
- oci_error(connection->pError, "OCIObjectFree", connection->error);
- RETURN_FALSE;
- }
-
- zend_list_delete(inx);
- RETURN_TRUE;
- }
- }
-
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto string ocicollappend(object collection,value)
- Append an object to the collection */
-
-PHP_FUNCTION(ocicollappend)
-{
- zval *id, **arg;
- oci_connection *connection;
- oci_collection *coll;
- OCINumber num;
- OCIString *ocistr = (OCIString *)0;
- OCIInd new_ind = OCI_IND_NOTNULL;
- OCIDate dt;
- int inx;
- double ndx;
-
- OCILS_FETCH();
-
- if ((id = getThis()) != 0) {
- if ((inx = _oci_get_ocicoll(id,&coll)) == 0) {
- RETURN_FALSE;
- }
-
- connection = coll->conn;
- if (zend_get_parameters_ex(1, &arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- switch(coll->element_typecode) {
- case OCI_TYPECODE_DATE:
- convert_to_string_ex(arg);
- connection->error = OCIDateFromText(connection->pError,
- (*arg)->value.str.val,
- (*arg)->value.str.len,
- 0,0,0,0,&dt);
- if (connection->error) {
- oci_error(connection->pError, "OCIDateFromText", connection->error);
- RETURN_FALSE;
- }
- connection->error = OCICollAppend(OCI(pEnv),
- connection->pError,
- (dvoid *) &dt,
- (dvoid *) &new_ind,
- (OCIColl *) coll->coll);
- if (connection->error) {
- oci_error(connection->pError, "OCICollAppend", connection->error);
- RETURN_FALSE;
- }
- RETURN_TRUE;
- break;
- case OCI_TYPECODE_VARCHAR2 :
- convert_to_string_ex(arg);
- connection->error = OCIStringAssignText(OCI(pEnv),
- connection->pError,
- (*arg)->value.str.val,
- (*arg)->value.str.len,
- &ocistr);
- if (connection->error) {
- oci_error(connection->pError, "OCIStringAssignText", connection->error);
- RETURN_FALSE;
- }
- connection->error = OCICollAppend(OCI(pEnv),
- connection->pError,
- (dvoid *) ocistr,
- (dvoid *) &new_ind,
- (OCIColl *) coll->coll);
- if (connection->error) {
- oci_error(connection->pError, "OCICollAppend", connection->error);
- RETURN_FALSE;
- }
- RETURN_TRUE;
- break;
- case OCI_TYPECODE_UNSIGNED16 : /* UNSIGNED SHORT */
- case OCI_TYPECODE_UNSIGNED32 : /* UNSIGNED LONG */
- case OCI_TYPECODE_REAL : /* REAL */
- case OCI_TYPECODE_DOUBLE : /* DOUBLE */
- case OCI_TYPECODE_INTEGER : /* INT */
- case OCI_TYPECODE_SIGNED16 : /* SHORT */
- case OCI_TYPECODE_SIGNED32 : /* LONG */
- case OCI_TYPECODE_DECIMAL : /* DECIMAL */
- case OCI_TYPECODE_FLOAT : /* FLOAT */
- case OCI_TYPECODE_NUMBER : /* NUMBER */
- case OCI_TYPECODE_SMALLINT : /* SMALLINT */
- convert_to_double_ex(arg);
- ndx = (double)(*arg)->value.dval;
- connection->error = OCINumberFromReal(connection->pError,&ndx,
- sizeof(double),&num);
- if (connection->error) {
- oci_error(connection->pError, "OCINumberFromReal", connection->error);
- RETURN_FALSE;
- }
-
- connection->error = OCICollAppend(OCI(pEnv),
- connection->pError,
- (dvoid *) &num,
- (dvoid *) &new_ind,
- (OCIColl *) coll->coll);
- RETURN_TRUE;
- break;
- }
- }
-
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto string ocicollgetelem(object collection,ndx)
- Retrieve the value at collection index ndx */
-
-PHP_FUNCTION(ocicollgetelem)
-{
- zval *id,**arg;
- oci_connection *connection;
- oci_collection *coll;
- ub4 ndx;
- int inx;
- dvoid *elem;
- dvoid *elemind;
- boolean exists;
- OCIString *ocistr = (OCIString *)0;
- text *str;
- char buff[1024];
- int len;
- double dnum;
-
- OCILS_FETCH();
-
- if ((id = getThis()) != 0) {
- if ((inx = _oci_get_ocicoll(id,&coll)) == 0) {
- RETURN_FALSE;
- }
- if (zend_get_parameters_ex(1, &arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(arg);
- ndx = (*arg)->value.lval;
-
- connection = coll->conn;
-
- connection->error = OCICollGetElem(OCI(pEnv),
- connection->pError,
- coll->coll,
- ndx,
- &exists,
- &elem,
- &elemind);
- if (connection->error) {
- oci_error(connection->pError, "OCICollGetElem", connection->error);
- RETURN_FALSE;
- }
- switch(coll->element_typecode) {
- case OCI_TYPECODE_DATE:
- len = 1024;
- OCIDateToText(connection->pError,
- elem,
- 0, /* fmt */
- 0, /* fmt_length */
- 0, /* lang_name */
- 0, /* lang_length */
- &len,buff);
- RETURN_STRINGL(buff,len,1);
- case OCI_TYPECODE_VARCHAR2 :
- ocistr = *(OCIString **)elem;
- str = OCIStringPtr(OCI(pEnv),ocistr);
- RETURN_STRINGL(str,strlen(str),1);
- break;
- case OCI_TYPECODE_UNSIGNED16 : /* UNSIGNED SHORT */
- case OCI_TYPECODE_UNSIGNED32 : /* UNSIGNED LONG */
- case OCI_TYPECODE_REAL : /* REAL */
- case OCI_TYPECODE_DOUBLE : /* DOUBLE */
- case OCI_TYPECODE_INTEGER : /* INT */
- case OCI_TYPECODE_SIGNED16 : /* SHORT */
- case OCI_TYPECODE_SIGNED32 : /* LONG */
- case OCI_TYPECODE_DECIMAL : /* DECIMAL */
- case OCI_TYPECODE_FLOAT : /* FLOAT */
- case OCI_TYPECODE_NUMBER : /* NUMBER */
- case OCI_TYPECODE_SMALLINT : /* SMALLINT */
- connection->error = OCINumberToReal(connection->pError,
- (CONST OCINumber *) elem,
- (uword) sizeof(dnum), (dvoid *) &dnum);
- if (connection->error) {
- oci_error(connection->pError, "OCINumberToReal", connection->error);
- RETURN_FALSE;
- }
- RETURN_DOUBLE(dnum);
- break;
- }
- }
-
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto string ocicollassign(object collection,object)
- Assign a collection from another existing collection */
-
-PHP_FUNCTION(ocicollassign)
-{
- zval *id,**from;
- oci_connection *connection;
- oci_collection *coll,*from_coll;
- int inx;
-
- OCILS_FETCH();
-
- if ((id = getThis()) != 0) {
- if ((inx = _oci_get_ocicoll(id,&coll)) == 0) {
- RETURN_FALSE;
- }
-
- if (zend_get_parameters_ex(1, &from) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if ((inx = _oci_get_ocicoll(*from,&from_coll)) == 0) {
- RETURN_FALSE;
- }
-
- connection = coll->conn;
-
- connection->error = OCICollAssign(OCI(pEnv),connection->pError,
- from_coll->coll,coll->coll);
- if (connection->error) {
- oci_error(connection->pError, "OCICollAssignElem", connection->error);
- RETURN_FALSE;
- }
- RETURN_TRUE;
- }
-
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto string ocicollassignelem(object collection,ndx,val)
- Assign element val to collection at index ndx */
-
-PHP_FUNCTION(ocicollassignelem)
-{
- zval *id,**index,**val;
- oci_connection *connection;
- oci_collection *coll;
- OCINumber num;
- OCIInd new_ind = OCI_IND_NOTNULL;
- ub4 ndx;
- int inx;
- OCIString *ocistr = (OCIString *)0;
- OCIDate dt;
- double dnum;
-
- OCILS_FETCH();
-
- if ((id = getThis()) != 0) {
- if ((inx = _oci_get_ocicoll(id,&coll)) == 0) {
- RETURN_FALSE;
- }
-
- if (zend_get_parameters_ex(2, &index,&val) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(index);
- ndx = (*index)->value.lval;
-
- connection = coll->conn;
-
- if (connection->error) {
- oci_error(connection->pError, "OCICollAssignElem", connection->error);
- RETURN_FALSE;
- }
- switch(coll->element_typecode) {
- case OCI_TYPECODE_DATE:
- convert_to_string_ex(val);
- connection->error = OCIDateFromText(connection->pError,
- (*val)->value.str.val,
- (*val)->value.str.len,
- 0,0,0,0,&dt);
- if (connection->error) {
- oci_error(connection->pError, "OCIDateFromText", connection->error);
- RETURN_FALSE;
- }
- connection->error = OCICollAssignElem(OCI(pEnv),
- connection->pError,
- ndx,
- (dword *)&dt,
- &new_ind,
- coll->coll);
- if (connection->error) {
- oci_error(connection->pError, "OCICollAssignElem", connection->error);
- RETURN_FALSE;
- }
- break;
- case OCI_TYPECODE_VARCHAR2 :
- convert_to_string_ex(val);
- connection->error = OCIStringAssignText(OCI(pEnv),
- connection->pError,
- (*val)->value.str.val,
- (*val)->value.str.len,
- &ocistr);
- if (connection->error) {
- oci_error(connection->pError, "OCIStringAssignText", connection->error);
- RETURN_FALSE;
- }
- connection->error = OCICollAssignElem(OCI(pEnv),
- connection->pError,
- ndx,
- (dword *)ocistr,
- &new_ind,
- coll->coll);
- if (connection->error) {
- oci_error(connection->pError, "OCICollAssignElem", connection->error);
- RETURN_FALSE;
- }
- RETURN_TRUE;
- break;
- case OCI_TYPECODE_UNSIGNED16 : /* UNSIGNED SHORT */
- case OCI_TYPECODE_UNSIGNED32 : /* UNSIGNED LONG */
- case OCI_TYPECODE_REAL : /* REAL */
- case OCI_TYPECODE_DOUBLE : /* DOUBLE */
- case OCI_TYPECODE_INTEGER : /* INT */
- case OCI_TYPECODE_SIGNED16 : /* SHORT */
- case OCI_TYPECODE_SIGNED32 : /* LONG */
- case OCI_TYPECODE_DECIMAL : /* DECIMAL */
- case OCI_TYPECODE_FLOAT : /* FLOAT */
- case OCI_TYPECODE_NUMBER : /* NUMBER */
- case OCI_TYPECODE_SMALLINT : /* SMALLINT */
- convert_to_double_ex(val);
- dnum = (double)(*val)->value.dval;
- connection->error = OCINumberFromReal(connection->pError,&dnum,
- sizeof(double),&num);
- if (connection->error) {
- oci_error(connection->pError, "OCINumberFromReal", connection->error);
- RETURN_FALSE;
- }
- connection->error = OCICollAssignElem(OCI(pEnv),
- connection->pError,
- ndx,
- (dword *)&num,
- &new_ind,
- coll->coll);
- if (connection->error) {
- oci_error(connection->pError, "OCICollAssignElem", connection->error);
- RETURN_FALSE;
- }
- RETURN_TRUE;
- break;
- }
- }
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto string ocicollsize(object collection)
- Return the size of a collection */
-
-PHP_FUNCTION(ocicollsize)
-{
- zval *id;
- oci_connection *connection;
- oci_collection *coll;
- sb4 sz;
- int inx;
-
- OCILS_FETCH();
-
- if ((id = getThis()) != 0) {
- if ((inx = _oci_get_ocicoll(id,&coll)) == 0) {
- RETURN_FALSE;
- }
- connection = coll->conn;
- connection->error = OCICollSize(OCI(pEnv),coll->conn->pError,coll->coll,&sz);
- if (connection->error) {
- oci_error(connection->pError, "OCICollSize", connection->error);
- RETURN_FALSE;
- }
- RETURN_LONG(sz);
- }
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto string ocicollmax(object collection)
- Return the max value of a collection. For a
- varray this is the maximum length of the array */
-
-PHP_FUNCTION(ocicollmax)
-{
- zval *id;
- oci_collection *coll;
- sb4 sz;
- int inx;
- OCILS_FETCH();
-
- if ((id = getThis()) != 0) {
- if ((inx = _oci_get_ocicoll(id,&coll)) == 0) {
- RETURN_FALSE;
- }
- sz = OCICollMax(OCI(pEnv),coll->coll);
- RETURN_LONG(sz);
- }
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto string ocicolltrim(object collection,num)
- Trim num elements from the end of a collection */
-
-PHP_FUNCTION(ocicolltrim)
-{
- zval *id,**arg;
- oci_collection *coll;
- int inx;
-
- OCILS_FETCH();
-
- if ((id = getThis()) != 0) {
- if ((inx = _oci_get_ocicoll(id,&coll)) == 0) {
- RETURN_FALSE;
- }
- if (zend_get_parameters_ex(1, &arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(arg);
- coll->conn->error = OCICollTrim(OCI(pEnv),coll->conn->pError,(*arg)->value.lval,coll->coll);
- if (coll->conn->error) {
- oci_error(coll->conn->pError, "OCICollTrim", coll->conn->error);
- RETURN_FALSE;
- }
- RETURN_TRUE;
- }
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto string ocinewcollection(int connection, string tdo,[string schema])
- Initialize a new collection */
-
-PHP_FUNCTION(ocinewcollection)
-{
- dvoid *dschp1;
- dvoid *parmp1;
- dvoid *parmp2;
- zval **conn, **tdo, **schema;
- oci_connection *connection;
- oci_collection *coll;
- int ac = ZEND_NUM_ARGS();
-
- OCILS_FETCH();
-
-
-
- if (ac < 2 || ac > 3 || zend_get_parameters_ex(ac, &conn, &tdo, &schema) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(tdo);
-
- if(ac == 3) {
- convert_to_string_ex(schema);
- }
-
- coll = emalloc(sizeof(oci_collection));
-
- OCI_GET_CONN(connection,conn);
-
- coll->conn = connection;
- coll->id = zend_list_insert(coll,le_coll);
- zend_list_addref(connection->id);
-
- connection->error = OCITypeByName(OCI(pEnv),
- connection->pError,
- connection->pServiceContext,
- ac==3?(text *)(*schema)->value.str.val:(text *)0,
- ac==3?(ub4)(*schema)->value.str.len: (ub4)0,
- (text *) (*tdo)->value.str.val,
- (ub4) (*tdo)->value.str.len,
- (CONST text *) 0, (ub4) 0,
- OCI_DURATION_SESSION,
- OCI_TYPEGET_ALL,
- &(coll->tdo));
- if (connection->error) {
- oci_error(connection->pError, "OCITypeByName", connection->error);
- RETURN_FALSE;
- }
-
- connection->error = OCIHandleAlloc(OCI(pEnv), (dvoid **) &dschp1,
- (ub4) OCI_HTYPE_DESCRIBE,
- (size_t) 0, (dvoid **) 0);
-
- if (connection->error) {
- oci_error(connection->pError, "OCI_HTYPE_DESCRIBE", connection->error);
- RETURN_FALSE;
- }
- connection->error = OCIDescribeAny(connection->pServiceContext, connection->pError, (dvoid *) coll->tdo,
- (ub4) 0, OCI_OTYPE_PTR, (ub1)1,
- (ub1) OCI_PTYPE_TYPE, dschp1);
- if (connection->error) {
- oci_error(connection->pError, "OCI_OTYPE_PTR", connection->error);
- RETURN_FALSE;
- }
-
- connection->error = OCIAttrGet((dvoid *) dschp1,
- (ub4) OCI_HTYPE_DESCRIBE,
- (dvoid *)&parmp1, (ub4 *)0, (ub4)OCI_ATTR_PARAM,connection->pError);
- if (connection->error) {
- oci_error(connection->pError, "OCI_ATTR_PARAM", connection->error);
- RETURN_FALSE;
- }
-
- /* get the collection type code of the attribute */
- connection->error = OCIAttrGet((dvoid*) parmp1, (ub4) OCI_DTYPE_PARAM,
- (dvoid*) &(coll->coll_typecode), (ub4 *) 0,
- (ub4) OCI_ATTR_COLLECTION_TYPECODE,
- connection->pError);
- if (connection->error) {
- oci_error(connection->pError, "OCI_ATTR_COLLECTION_TYPECODE", connection->error);
- RETURN_FALSE;
- }
-
- switch(coll->coll_typecode) {
- case OCI_TYPECODE_VARRAY:
- case OCI_TYPECODE_TABLE:
- connection->error = OCIAttrGet((dvoid*) parmp1,
- (ub4) OCI_DTYPE_PARAM,
- (dvoid*) &parmp2, (ub4 *) 0,
- (ub4) OCI_ATTR_COLLECTION_ELEMENT,
- connection->pError);
- if (connection->error) {
- oci_error(connection->pError, "OCI_ATTR_COLLECTION_ELEMENT", connection->error);
- RETURN_FALSE;
- }
- connection->error = OCIAttrGet((dvoid*) parmp2,
- (ub4) OCI_DTYPE_PARAM,
- (dvoid*) &(coll->elem_ref), (ub4 *) 0,
- (ub4) OCI_ATTR_REF_TDO,
- connection->pError);
- if (connection->error) {
- oci_error(connection->pError, "OCI_ATTR_REF_TDO", connection->error);
- RETURN_FALSE;
- }
- connection->error = OCITypeByRef(OCI(pEnv), connection->pError, coll->elem_ref,
- OCI_DURATION_SESSION,
- OCI_TYPEGET_HEADER, &(coll->element_type));
- if (connection->error) {
- oci_error(connection->pError, "OCI_TYPEGET_HEADER", connection->error);
- RETURN_FALSE;
- }
-
- connection->error = OCIAttrGet((dvoid*) parmp2,
- (ub4) OCI_DTYPE_PARAM,
- (dvoid*) &(coll->element_typecode), (ub4 *) 0,
- (ub4) OCI_ATTR_TYPECODE,
- connection->pError);
- if (connection->error) {
- oci_error(connection->pError, "OCI_ATTR_TYPECODE", connection->error);
- RETURN_FALSE;
- }
- break;
- default:
- php_error(E_WARNING, "OCINewCollection - Unknown Type %d", coll->coll_typecode);
- }
-
- /* Create object to hold return table */
- connection->error = OCIObjectNew(OCI(pEnv),
- connection->pError,
- connection->pServiceContext,
- OCI_TYPECODE_TABLE,
- coll->tdo,
- (dvoid *)0,
- OCI_DURATION_DEFAULT,
- TRUE,
- (dvoid **) &(coll->coll));
- if (connection->error) {
- oci_error(connection->pError, "OCIObjectNew", connection->error);
- RETURN_FALSE;
- }
-
- object_init_ex(return_value, oci_coll_class_entry_ptr);
- add_property_resource(return_value, "collection",coll->id);
-}
-
-/* }}} */
-
-#endif
-
-#endif /* HAVE_OCI8 */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/oci8/oci8.dsp b/ext/oci8/oci8.dsp
deleted file mode 100644
index 46d071c405..0000000000
--- a/ext/oci8/oci8.dsp
+++ /dev/null
@@ -1,113 +0,0 @@
-# Microsoft Developer Studio Project File - Name="oci8" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=oci8 - Win32 Release_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "oci8.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "oci8.mak" CFG="oci8 - Win32 Release_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "oci8 - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "oci8 - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "oci8 - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\..\TSRM" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D ZTS=1 /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\\" /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /I "..\..\..\php_build\oci805\include" /D ZEND_DEBUG=0 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_OCI8=1 /D HAVE_OCI8_TEMP_LOB=1 /D COMPILE_DL_OCI8=1 /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x406 /d "NDEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib /nologo /dll /machine:I386
-# ADD LINK32 php4ts.lib oci.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_oci8.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\..\php_build\oci805\lib" /libpath:"..\..\Release_TS_Inline"
-
-!ELSEIF "$(CFG)" == "oci8 - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D ZTS=1 /YX /FD /c
-# ADD CPP /nologo /MDd /W3 /GX /ZI /Od /I "..\..\\" /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /I "..\..\..\php_build\include\oci805" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "FTP_EXPORTS" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_OCI8=1 /D HAVE_OCI8_TEMP_LOB=1 /D COMPILE_DL_OCI8=1 /FR /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x406 /d "NDEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib /nologo /dll /machine:I386
-# ADD LINK32 php4ts_debug.lib oci.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\Debug_TS/php_oci8.dll" /libpath:"..\..\Debug_TS" /libpath:"..\..\..\php_build\lib\oci805"
-
-!ENDIF
-
-# Begin Target
-
-# Name "oci8 - Win32 Release_TS"
-# Name "oci8 - Win32 Debug_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\oci8.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_oci8.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/ext/oci8/oci8.dsw b/ext/oci8/oci8.dsw
deleted file mode 100644
index fc18fae34a..0000000000
--- a/ext/oci8/oci8.dsw
+++ /dev/null
@@ -1,29 +0,0 @@
-Microsoft Developer Studio Workspace File, Format Version 6.00
-# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
-
-###############################################################################
-
-Project: "oci8"=.\oci8.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Global:
-
-Package=<5>
-{{{
-}}}
-
-Package=<3>
-{{{
-}}}
-
-###############################################################################
-
diff --git a/ext/oci8/php_oci8.h b/ext/oci8/php_oci8.h
deleted file mode 100644
index a9f59db556..0000000000
--- a/ext/oci8/php_oci8.h
+++ /dev/null
@@ -1,220 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Stig Sæther Bakken <ssb@fast.no> |
- | Thies C. Arntzen <thies@thieso.net> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#if HAVE_OCI8
-# ifndef PHP_OCI8_H
-# define PHP_OCI8_H
-# endif
-
-# if (defined(__osf__) && defined(__alpha))
-# ifndef A_OSF
-# define A_OSF
-# endif
-# ifndef OSF1
-# define OSF1
-# endif
-# ifndef _INTRINSICS
-# define _INTRINSICS
-# endif
-# endif /* osf alpha */
-
-#ifdef PHP_WIN32
-#define PHP_OCI_API __declspec(dllexport)
-#else
-#define PHP_OCI_API
-#endif
-
-#if defined(min)
-#undef min
-#endif
-#if defined(max)
-#undef max
-#endif
-
-#include <oci.h>
-
-typedef struct {
- int num;
- int persistent;
- int is_open;
- char *dbname;
- OCIServer *pServer;
-#if 0
- OCIFocbkStruct failover;
-#endif
-} oci_server;
-
-typedef struct {
- int num;
- int persistent;
- int is_open;
- int exclusive;
- char *hashed_details;
- oci_server *server;
- OCISession *pSession;
-} oci_session;
-
-typedef struct {
- int id;
- int is_open;
- oci_session *session;
- OCISvcCtx *pServiceContext;
- sword error;
- OCIError *pError;
-} oci_connection;
-
-typedef struct {
- int id;
- oci_connection *conn;
- dvoid *ocidescr;
- ub4 type;
-} oci_descriptor;
-
-typedef struct {
- int id;
- oci_connection *conn;
- OCIType *tdo;
- OCITypeCode coll_typecode;
- OCIRef *elem_ref;
- OCIType *element_type;
- OCITypeCode element_typecode;
- OCIColl *coll;
-} oci_collection;
-
-typedef struct {
- zval *zval;
- text *name;
- ub4 name_len;
- ub4 type;
-} oci_define;
-
-typedef struct {
- int id;
- oci_connection *conn;
- sword error;
- OCIError *pError;
- OCIStmt *pStmt;
- char *last_query;
- HashTable *columns;
- HashTable *binds;
- HashTable *defines;
- int ncolumns;
- int executed;
-} oci_statement;
-
-typedef struct {
- OCIBind *pBind;
- zval *zval;
- dvoid *descr; /* used for binding of LOBS etc */
- OCIStmt *pStmt; /* used for binding REFCURSORs */
- sb2 indicator;
- ub2 retcode;
-} oci_bind;
-
-typedef struct {
- oci_statement *statement;
- OCIDefine *pDefine;
- char *name;
- ub4 name_len;
- ub2 data_type;
- ub2 data_size;
- ub4 storage_size4;
- sb2 indicator;
- ub2 retcode;
- ub2 retlen;
- ub4 retlen4;
- ub2 is_descr;
- ub2 is_cursor;
- int descr;
- oci_statement *pstmt;
- int stmtid;
- int descid;
- void *data;
- oci_define *define;
- int piecewise;
- ub4 cb_retlen;
- ub2 scale;
- ub2 precision;
-} oci_out_column;
-
-typedef struct {
- sword error;
- OCIError *pError;
-
- /*
- char *default_username;
- char *default_password;
- char *default_dbname;
- */
-
- long debug_mode;
-
- int shutdown;
-
- /* XXX NYI
- long allow_persistent;
- long max_persistent;
- long max_links;
- long num_persistent;
- long num_links;
- */
-
- HashTable *server;
- HashTable *user;
-
- OCIEnv *pEnv;
-} php_oci_globals;
-
-extern zend_module_entry oci8_module_entry;
-#define phpext_oci8_ptr &oci8_module_entry
-
-#define OCI_MAX_NAME_LEN 64
-#define OCI_MAX_DATA_SIZE INT_MAX
-#define OCI_PIECE_SIZE (64*1024)-1
-
-#ifdef ZTS
-#define OCILS_D php_oci_globals *oci_globals
-#define OCILS_DC , OCILS_D
-#define OCILS_C oci_globals
-#define OCILS_CC , OCILS_C
-#define OCI(v) (oci_globals->v)
-#define OCILS_FETCH() php_oci_globals *oci_globals = ts_resource(oci_globals_id)
-#else
-#define OCILS_D
-#define OCILS_DC
-#define OCILS_C
-#define OCILS_CC
-#define OCI(v) (oci_globals.v)
-#define OCILS_FETCH()
-#endif
-
-#else /* !HAVE_OCI8 */
-
-# define oci8_module_ptr NULL
-
-#endif /* HAVE_OCI8 */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/oci8/setup.stub b/ext/oci8/setup.stub
deleted file mode 100644
index ee29b02f43..0000000000
--- a/ext/oci8/setup.stub
+++ /dev/null
@@ -1,6 +0,0 @@
-# $Source$
-# $Id$
-
-define_option with-oci8 'oci8 support?' yesnodir no \
-' Whether to build the oci8 extension.'
-
diff --git a/ext/odbc/CREDITS b/ext/odbc/CREDITS
deleted file mode 100644
index 238bfb40a1..0000000000
--- a/ext/odbc/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-ODBC
-Stig Bakken, Andreas Karajannis, Frank M. Kromann, Daniel R. Kalowsky
diff --git a/ext/odbc/Makefile.in b/ext/odbc/Makefile.in
deleted file mode 100644
index c50b30b099..0000000000
--- a/ext/odbc/Makefile.in
+++ /dev/null
@@ -1,7 +0,0 @@
-
-LTLIBRARY_NAME = libodbc.la
-LTLIBRARY_SOURCES = php_odbc.c
-LTLIBRARY_SHARED_NAME = odbc.la
-LTLIBRARY_SHARED_LIBADD = $(ODBC_LFLAGS) $(ODBC_LIBS)
-
-include $(top_srcdir)/build/dynlib.mk
diff --git a/ext/odbc/config.m4 b/ext/odbc/config.m4
deleted file mode 100644
index cb85553a3a..0000000000
--- a/ext/odbc/config.m4
+++ /dev/null
@@ -1,547 +0,0 @@
-dnl $Id$
-
-dnl
-dnl Figure out which library file to link with for the Solid support.
-dnl
-AC_DEFUN(AC_FIND_SOLID_LIBS,[
- AC_MSG_CHECKING([Solid library file])
- ac_solid_uname_r=`uname -r 2>/dev/null`
- ac_solid_uname_s=`uname -s 2>/dev/null`
- case $ac_solid_uname_s in
- AIX) ac_solid_os=a3x;; # a4x for AIX4/ Solid 2.3/3.0 only
- HP-UX) ac_solid_os=h9x;; # h1x for hpux11, h0x for hpux10
- IRIX) ac_solid_os=irx;; # Solid 2.3(?)/ 3.0 only
- Linux) if ldd -v /bin/sh | grep GLIBC > /dev/null; then
- AC_DEFINE(SS_LINUX,1,[Needed in sqlunix.h ])
- ac_solid_os=l2x
- else
- AC_DEFINE(SS_LINUX,1,[Needed in sqlunix.h ])
- ac_solid_os=lux
- fi;;
- SunOS) ac_solid_os=ssx;; # should we deal with SunOS 4?
- FreeBSD) if test `expr $ac_solid_uname_r : '\(.\)'` -gt "2"; then
- AC_DEFINE(SS_FBX,1,[Needed in sqlunix.h for wchar defs ])
- ac_solid_os=fex
- else
- AC_DEFINE(SS_FBX,1,[Needed in sqlunix.h for wchar defs ])
- ac_solid_os=fbx
- fi
- esac
-
- if test -f $1/soc${ac_solid_os}35.a; then
- ac_solid_version=35
- ac_solid_prefix=soc
- elif test -f $1/scl${ac_solid_os}30.a; then
- ac_solid_version=30
- ac_solid_prefix=scl
- elif test -f $1/scl${ac_solid_os}23.a; then
- ac_solid_version=23
- ac_solid_prefix=scl
- fi
-
-#
-# Check for the library files, and setup the ODBC_LIBS path...
-#
-if test ! -f $1/lib${ac_solid_prefix}${ac_solid_os}${ac_solid_version}.so -a \
- ! -f $1/lib${ac_solid_prefix}${ac_solid_os}${ac_solid_version}.a; then
- #
- # we have an error and should bail out, as we can't find the libs!
- #
- echo ""
- echo "*********************************************************************"
- echo "* Unable to locate $1/lib${ac_solid_prefix}${ac_solid_os}${ac_solid_version}.so or $1/lib${ac_solid_prefix}${ac_solid_os}${ac_solid_version}.a"
- echo "* Please correct this by creating the following links and reconfiguring:"
- echo "* $1/lib${ac_solid_prefix}${ac_solid_os}${ac_solid_version}.a -> $1/lib${ac_solid_prefix}${ac_solid_os}${ac_solid_version}.a"
- echo "* $1/${ac_solid_prefix}${ac_solid_os}${ac_solid_version}.so -> $1/lib${ac_solid_prefix}${ac_solid_os}${ac_solid_version}.so"
- echo "*********************************************************************"
-else
- ODBC_LFLAGS=-L$1
- ODBC_LIBS=-l${ac_solid_prefix}${ac_solid_os}${ac_solid_version}
-fi
-
-
- AC_MSG_RESULT(`echo $ODBC_LIBS | sed -e 's!.*/!!'`)
-])
-
-
-
-
-dnl
-dnl Figure out which library file to link with for the Empress support.
-dnl
-AC_DEFUN(AC_FIND_EMPRESS_LIBS,[
- AC_MSG_CHECKING([Empress library file])
- ODBC_LIBS=`echo $1/libempodbccl.so | cut -d' ' -f1`
- if test ! -f $ODBC_LIBS; then
- ODBC_LIBS=`echo $1/libempodbccl.so | cut -d' ' -f1`
- fi
- AC_MSG_RESULT(`echo $ODBC_LIBS | sed -e 's!.*/!!'`)
-])
-
-AC_DEFUN(AC_FIND_EMPRESS_BCS_LIBS,[
- AC_MSG_CHECKING([Empress local access library file])
- ODBCBCS_LIBS=`echo $1/libempodbcbcs.a | cut -d' ' -f1`
- if test ! -f $ODBCBCS_LIBS; then
- ODBCBCS_LIBS=`echo $1/libempodbcbcs.a | cut -d' ' -f1`
- fi
- AC_MSG_RESULT(`echo $ODBCBCS_LIBS | sed -e 's!.*/!!'`)
-])
-
-if test -z "$ODBC_TYPE"; then
-AC_MSG_CHECKING(for Adabas support)
-AC_ARG_WITH(adabas,
-[ --with-adabas[=DIR] Include Adabas D support. DIR is the Adabas base
- install directory, defaults to /usr/local.],
-[
- PHP_WITH_SHARED
- if test "$withval" = "yes"; then
- withval=/usr/local
- fi
- if test "$withval" != "no"; then
- PHP_ADD_INCLUDE($withval/incl)
- PHP_ADD_LIBPATH($withval/lib)
- ODBC_OBJS="$withval/lib/odbclib.a"
- ODBC_LIB="$abs_builddir/ext/odbc/libodbc_adabas.a"
- $srcdir/build/shtool mkdir -f -p ext/odbc
- rm -f "$ODBC_LIB"
- cp "$ODBC_OBJS" "$ODBC_LIB"
- PHP_ADD_LIBRARY(sqlptc)
- PHP_ADD_LIBRARY(sqlrte)
- PHP_ADD_LIBRARY_WITH_PATH(odbc_adabas, $abs_builddir/ext/odbc)
- ODBC_TYPE=adabas
- AC_DEFINE(HAVE_ADABAS,1,[ ])
- AC_MSG_RESULT(yes)
- else
- AC_MSG_RESULT(no)
- fi
-],[
- AC_MSG_RESULT(no)
-])
-fi
-
-if test -z "$ODBC_TYPE"; then
-AC_MSG_CHECKING(for SAP DB support)
-AC_ARG_WITH(sapdb,
-[ --with-sapdb[=DIR] Include SAP DB support. DIR is SAP DB base
- install directory, defaults to /usr/local.],
-[
- PHP_WITH_SHARED
- if test "$withval" = "yes"; then
- withval=/usr/local
- fi
- if test "$withval" != "no"; then
- PHP_ADD_INCLUDE($withval/incl)
- PHP_ADD_LIBPATH($withval/lib)
- PHP_ADD_LIBRARY(sqlod)
- PHP_ADD_LIBRARY(sqlrte)
- ODBC_TYPE=sapdb
- AC_DEFINE(HAVE_SAPDB,1,[ ])
- AC_MSG_RESULT(yes)
- else
- AC_MSG_RESULT(no)
- fi
-],[
- AC_MSG_RESULT(no)
-])
-fi
-
-
-if test -z "$ODBC_TYPE"; then
-AC_MSG_CHECKING(for Solid support)
-AC_ARG_WITH(solid,
-[ --with-solid[=DIR] Include Solid support. DIR is the Solid base
- install directory, defaults to /usr/local/solid],
-[
- PHP_WITH_SHARED
- if test "$withval" = "yes"; then
- withval=/usr/local/solid
- fi
- if test "$withval" != "no"; then
- ODBC_INCDIR=$withval/include
- ODBC_LIBDIR=$withval/lib
- ODBC_INCLUDE=-I$ODBC_INCDIR
- ODBC_TYPE=solid
- if test -f $ODBC_LIBDIR/soc*35.a; then
- AC_DEFINE(HAVE_SOLID_35,1,[ ])
- elif test -f $ODBC_LIBDIR/scl*30.a; then
- AC_DEFINE(HAVE_SOLID_30,1,[ ])
- elif test -f $ODBC_LIBDIR/scl*23.a; then
- AC_DEFINE(HAVE_SOLID,1,[ ])
- fi
- AC_MSG_RESULT(yes)
- AC_FIND_SOLID_LIBS($ODBC_LIBDIR)
- else
- AC_MSG_RESULT(no)
- fi
-],[
- AC_MSG_RESULT(no)
-])
-fi
-
-if test -z "$ODBC_TYPE"; then
-AC_MSG_CHECKING(for IBM DB2 support)
-AC_ARG_WITH(ibm-db2,
-[ --with-ibm-db2[=DIR] Include IBM DB2 support. DIR is the DB2 base
- install directory, defaults to /home/db2inst1/sqllib],
-[
- PHP_WITH_SHARED
- if test "$withval" != "no"; then
- if test "$withval" = "yes"; then
- ODBC_INCDIR=/home/db2inst1/sqllib/include
- ODBC_LIBDIR=/home/db2inst1/sqllib/lib
- else
- ODBC_INCDIR=$withval/include
- ODBC_LIBDIR=$withval/lib
- fi
- ODBC_INCLUDE=-I$ODBC_INCDIR
- ODBC_LFLAGS=-L$ODBC_LIBDIR
- ODBC_TYPE=db2
- ODBC_LIBS="-ldb2"
- AC_DEFINE(HAVE_IBMDB2,1,[ ])
-
- AC_MSG_RESULT(yes)
- else
- AC_MSG_RESULT(no)
- fi
-],[
- AC_MSG_RESULT(no)
-])
-fi
-
-if test -z "$ODBC_TYPE"; then
-AC_MSG_CHECKING(for Empress support)
-AC_ARG_WITH(empress,
-[ --with-empress[=DIR] Include Empress support. DIR is the Empress base
- install directory, defaults to \$EMPRESSPATH.
- From PHP4, this option only supports Empress Version
- 8.60 and above],
-[
- PHP_WITH_SHARED
- if test "$withval" != "no"; then
- if test "$withval" = "yes"; then
- ODBC_INCDIR=$EMPRESSPATH/include/odbc
- ODBC_LIBDIR=$EMPRESSPATH/shlib
- else
- ODBC_INCDIR=$withval/include/odbc
- ODBC_LIBDIR=$withval/shlib
- fi
- ODBC_INCLUDE=-I$ODBC_INCDIR
- ODBC_LFLAGS=-L$ODBC_LIBDIR
- ODBC_TYPE=empress
- AC_DEFINE(HAVE_EMPRESS,1,[ ])
- AC_MSG_RESULT(yes)
- AC_FIND_EMPRESS_LIBS($ODBC_LIBDIR)
- else
- AC_MSG_RESULT(no)
- fi
-],[
- AC_MSG_RESULT(no)
-])
-fi
-
-if test -z "$ODBC_TYPE"; then
-AC_MSG_CHECKING(for Empress local access support)
-AC_ARG_WITH(empress-bcs,
-[ --with-empress-bcs[=DIR]
- Include Empress Local Access support. DIR is the
- Empress base install directory, defaults to
- \$EMPRESSPATH. From PHP4, this option only supports
- Empress Version 8.60 and above.],
-[
- PHP_WITH_SHARED
- if test "$withval" != "no"; then
- if test "$withval" = "yes"; then
- ODBC_INCDIR=$EMPRESSPATH/include/odbc
- ODBC_LIBDIR=$EMPRESSPATH/shlib
- else
- ODBC_INCDIR=$withval/include/odbc
- ODBC_LIBDIR=$withval/shlib
- fi
- CC="empocc -bcs";export CC;
- LD="empocc -bcs";export LD;
- ODBC_INCLUDE=-I$ODBC_INCDIR
- ODBC_LFLAGS=-L$ODBC_LIBDIR
- LIST=`empocc -listlines -bcs -o a a.c`
-
- NEWLIST=
- for I in $LIST
- do
- case $I in
- $EMPRESSPATH/odbccl/lib/* | \
- $EMPRESSPATH/rdbms/lib/* | \
- $EMPRESSPATH/common/lib/*)
- NEWLIST="$NEWLIST $I"
- ;;
- esac
- done
- ODBC_LIBS="-lempphpbcs -lms -lmscfg -lbasic -lbasic_os -lnlscstab -lnlsmsgtab -lm -ldl -lcrypt"
- ODBC_TYPE=empress
- AC_DEFINE(HAVE_EMPRESS,1,[ ])
- AC_MSG_RESULT(yes)
- AC_FIND_EMPRESS_BCS_LIBS($ODBC_LIBDIR)
- else
- AC_MSG_RESULT(no)
- fi
-],[
- AC_MSG_RESULT(no)
-])
-fi
-
-if test -z "$ODBC_TYPE"; then
-AC_MSG_CHECKING(for Velocis support)
-AC_ARG_WITH(velocis,
-[ --with-velocis[=DIR] Include Velocis support. DIR is the Velocis base
- install directory, defaults to /usr/local/velocis.],
-[
- PHP_WITH_SHARED
-
- if test "$withval" != "no"; then
- if test "$withval" = "yes"; then
- ODBC_INCDIR=/usr/local/velocis/include
- ODBC_LIBDIR=/usr/local/velocis/lib
- else
- ODBC_INCDIR=$withval/include
- ODBC_LIBDIR=$withval/lib
- fi
- ODBC_INCLUDE=-I$ODBC_INCDIR
- ODBC_TYPE=velocis
- ODBC_LFLAGS=-L$ODBC_LIBDIR
- ODBC_LIBS="-lCadm -lCdict -lCenc -lCrdm -lCrpc -lCrdbc -lCrm -lCuapi -lutil"
- AC_DEFINE(HAVE_VELOCIS,1,[ ])
-
- AC_MSG_RESULT(yes)
- else
- AC_MSG_RESULT(no)
- fi
-],[
- AC_MSG_RESULT(no)
-])
-fi
-
-if test -z "$ODBC_TYPE"; then
-AC_MSG_CHECKING(for a custom ODBC support)
-AC_ARG_WITH(custom-odbc,
-[ --with-custom-odbc[=DIR]
- Include a user defined ODBC support.
- The DIR is ODBC install base directory,
- which defaults to /usr/local.
- Make sure to define CUSTOM_ODBC_LIBS and
- have some odbc.h in your include dirs.
- E.g., you should define following for
- Sybase SQL Anywhere 5.5.00 on QNX, prior to
- run configure script:
- CPPFLAGS=\"-DODBC_QNX -DSQLANY_BUG\"
- LDFLAGS=-lunix
- CUSTOM_ODBC_LIBS=\"-ldblib -lodbc\".],
-[
- if test "$withval" = "yes"; then
- withval=/usr/local
- fi
- if test "$withval" != "no"; then
- ODBC_INCDIR=$withval/include
- ODBC_LIBDIR=$withval/lib
- ODBC_LFLAGS=-L$ODBC_LIBDIR
- ODBC_INCLUDE=-I$ODBC_INCDIR
- ODBC_LIBS=$CUSTOM_ODBC_LIBS
- ODBC_TYPE=custom
- AC_DEFINE(HAVE_CODBC,1,[ ])
- AC_MSG_RESULT(yes)
- else
- AC_MSG_RESULT(no)
- fi
-],[
- AC_MSG_RESULT(no)
-])
-fi
-
-if test -z "$ODBC_TYPE"; then
-AC_MSG_CHECKING(for iODBC support)
-AC_ARG_WITH(iodbc,
-[ --with-iodbc[=DIR] Include iODBC support. DIR is the iODBC base
- install directory, defaults to /usr/local.],
-[
- PHP_WITH_SHARED
- if test "$withval" = "yes"; then
- withval=/usr/local
- fi
- if test "$withval" != "no"; then
- PHP_ADD_LIBRARY_WITH_PATH(iodbc, $withval/lib)
- PHP_ADD_INCLUDE($withval/include, 1)
- ODBC_TYPE=iodbc
- ODBC_INCLUDE=-I$withval/include
- ODBC_LFLAGS=-L$withval/lib
- ODBC_LIBS=-liodbc
- AC_DEFINE(HAVE_IODBC,1,[ ])
- AC_MSG_RESULT(yes)
- else
- AC_MSG_RESULT(no)
- fi
-],[
- AC_MSG_RESULT(no)
-])
-fi
-
-if test -z "$ODBC_TYPE"; then
-AC_MSG_CHECKING(for Easysoft ODBC-ODBC Bridge support)
-AC_ARG_WITH(esoob,
-[ --with-esoob[=DIR] Include Easysoft OOB support. DIR is the OOB base
- install directory,
- defaults to /usr/local/easysoft/oob/client.],
-[
- PHP_WITH_SHARED
- if test "$withval" = "yes"; then
- withval=/usr/local/easysoft/oob/client
- fi
- if test "$withval" != "no"; then
- ODBC_INCDIR=$withval/include
- ODBC_LIBDIR=$withval/lib
- ODBC_LFLAGS=-L$ODBC_LIBDIR
- ODBC_INCLUDE=-I$ODBC_INCDIR
- ODBC_LIBS=-lesoobclient
- ODBC_TYPE=ESOOB
- AC_DEFINE(HAVE_ESOOB,1,[ ])
- AC_MSG_RESULT(yes)
- else
- AC_MSG_RESULT(no)
- fi
-],[
- AC_MSG_RESULT(no)
-])
-fi
-
-if test -z "$ODBC_TYPE"; then
-AC_MSG_CHECKING(for unixODBC support)
-AC_ARG_WITH(unixODBC,
-[ --with-unixODBC[=DIR] Include unixODBC support. DIR is the unixODBC base
- install directory, defaults to /usr/local.],
-[
- PHP_WITH_SHARED
- if test "$withval" = "yes"; then
- withval=/usr/local
- fi
- if test "$withval" != "no"; then
- ODBC_INCDIR=$withval/include
- ODBC_LIBDIR=$withval/lib
- ODBC_LFLAGS=-L$ODBC_LIBDIR
- ODBC_INCLUDE=-I$ODBC_INCDIR
- ODBC_LIBS=-lodbc
- ODBC_TYPE=unixODBC
- AC_DEFINE(HAVE_UNIXODBC,1,[ ])
- AC_MSG_RESULT(yes)
- else
- AC_MSG_RESULT(no)
- fi
-],[
- AC_MSG_RESULT(no)
-])
-fi
-
-if test -z "$ODBC_TYPE"; then
-AC_MSG_CHECKING(for OpenLink ODBC support)
-AC_ARG_WITH(openlink,
-[ --with-openlink[=DIR] Include OpenLink ODBC support. DIR is the
- OpenLink base install directory, defaults to
- /usr/local/openlink.],
-[
- PHP_WITH_SHARED
- if test "$withval" = "yes"; then
- withval=/usr/local/openlink
- fi
- if test "$withval" != "no"; then
- ODBC_INCDIR=$withval/odbcsdk/include
- ODBC_LIBDIR=$withval/odbcsdk/lib
- ODBC_LFLAGS=-L$ODBC_LIBDIR
- ODBC_INCLUDE=-I$ODBC_INCDIR
- ODBC_LIBS=-liodbc
- ODBC_TYPE=openlink
- AC_DEFINE(HAVE_OPENLINK,1,[ ])
- AC_MSG_RESULT(yes)
- else
- AC_MSG_RESULT(no)
- fi
-],[
- AC_MSG_RESULT(no)
-])
-fi
-
-if test -z "$ODBC_TYPE"; then
-AC_MSG_CHECKING(for DBMaker support)
-AC_ARG_WITH(dbmaker,
-[ --with-dbmaker[=DIR] Include DBMaker support. DIR is the DBMaker base
- install directory, defaults to where the latest
- version of DBMaker is installed (such as
- /home/dbmaker/3.6).],
-[
- PHP_WITH_SHARED
- if test "$withval" = "yes"; then
- # find dbmaker's home directory
- DBMAKER_HOME=`grep "^dbmaker:" /etc/passwd | awk -F: '{print $6}'`
-
- # check DBMaker version (from 5.0 to 2.0)
- DBMAKER_VERSION=5.0
-
- while test test ! -d $DBMAKER_HOME/$DBMAKER_VERSION -a \
- "$DBMAKER_VERSION" != "2.9"; do
- DM_VER=`echo $DBMAKER_VERSION | sed -e 's/\.//' | awk '{ print $1-1;}'`
- MAJOR_V=`echo $DM_VER | awk '{ print $1/10; }' \
- | awk -F. '{ print $1; }'`
- MINOR_V=`echo $DM_VER | awk '{ print $1%10; }'`
- DBMAKER_VERSION=$MAJOR_V.$MINOR_V
- done
-
- if test "$DBMAKER_VERSION" = "2.9"; then
- withval=$DBMAKER_HOME
- else
- DBMAKER_PATH=$DBMAKER_HOME/$DBMAKER_VERSION
- fi
-
- withval=$DBMAKER_PATH
- fi
-
- if test "$withval" != "no"; then
- ODBC_INCDIR=$withval/include
- ODBC_LIBDIR=$withval/lib
- ODBC_INCLUDE=-I$ODBC_INCDIR
- ODBC_LFLAGS=-L$ODBC_LIBDIR
- ODBC_INCLUDE=-I$ODBC_INCDIR
- ODBC_LIBS="-ldmapic -lc"
- ODBC_TYPE=dbmaker
-
- AC_DEFINE(HAVE_DBMAKER,1,[Whether you want DBMaker])
-
- if test "$shared" = "yes"; then
- AC_MSG_RESULT(yes (shared))
- ODBC_LIBS="-ldmapic -lc -lm"
- ODBC_SHARED="odbc.la"
- else
- AC_MSG_RESULT(yes (static))
- PHP_ADD_LIBRARY_WITH_PATH(dmapic, $ODBC_LIBDIR)
- PHP_ADD_INCLUDE($ODBC_INCDIR)
- ODBC_STATIC="libphpext_odbc.la"
- fi
-
- AC_MSG_RESULT(yes)
- else
- AC_MSG_RESULT(no)
- fi
-],[
- AC_MSG_RESULT(no)
-])
-fi
-
-if test -n "$ODBC_TYPE"; then
- INCLUDES="$INCLUDES $ODBC_INCLUDE"
- if test "$ODBC_TYPE" != "dbmaker"; then
- if test $shared != "yes"; then
- EXTRA_LIBS="$EXTRA_LIBS $ODBC_LFLAGS $ODBC_LIBS"
- fi
- fi
- AC_DEFINE(HAVE_UODBC,1,[ ])
- PHP_SUBST(ODBC_INCDIR)
- PHP_SUBST(ODBC_LIBDIR)
- PHP_SUBST_OLD(ODBC_INCLUDE)
- PHP_SUBST_OLD(ODBC_LIBS)
- PHP_SUBST_OLD(ODBC_LFLAGS)
- PHP_SUBST_OLD(ODBC_TYPE)
- PHP_EXTENSION(odbc, $shared)
-fi
diff --git a/ext/odbc/php_odbc.c b/ext/odbc/php_odbc.c
deleted file mode 100644
index a4d24ed27a..0000000000
--- a/ext/odbc/php_odbc.c
+++ /dev/null
@@ -1,3545 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Stig Sæther Bakken <ssb@fast.no> |
- | Andreas Karajannis <Andreas.Karajannis@gmd.de> |
- | Frank M. Kromann <frank@frontbase.com> Support for DB/2 CLI |
- | Kevin N. Shallow <kshallow@tampabay.rr.com> Velocis Support |
- | Daniel R. Kalowsky <kalowsky@php.net> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "php_globals.h"
-
-#include "ext/standard/info.h"
-
-#include "ext/standard/php_string.h"
-#include "ext/standard/php_standard.h"
-
-#include "php_odbc.h"
-#include "php_globals.h"
-
-
-#if HAVE_UODBC
-
-#include <fcntl.h>
-#include "ext/standard/head.h"
-#include "php_ini.h"
-
-#ifdef PHP_WIN32
-#include <winsock.h>
-
-#define ODBC_TYPE "Win32"
-#define PHP_ODBC_TYPE ODBC_TYPE
-
-#else
-#include "build-defs.h"
-#endif
-
-/*
- * not defined elsewhere
- */
-
-#ifndef TRUE
-#define TRUE 1
-#define FALSE 0
-#endif
-
-void odbc_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent);
-
-static int le_result, le_conn, le_pconn;
-
-#define SAFE_SQL_NTS(n) ((SWORD) ((n)?(SQL_NTS):0))
-
-static unsigned char a3_arg3_and_3_force_ref[] = { 3, BYREF_NONE, BYREF_FORCE, BYREF_FORCE };
-
-/* {{{ odbc_functions[]
- */
-function_entry odbc_functions[] = {
- PHP_FE(odbc_error, NULL)
- PHP_FE(odbc_errormsg, NULL)
- PHP_FE(odbc_setoption, NULL)
- PHP_FE(odbc_autocommit, NULL)
- PHP_FE(odbc_close, NULL)
- PHP_FE(odbc_close_all, NULL)
- PHP_FE(odbc_commit, NULL)
- PHP_FE(odbc_connect, NULL)
- PHP_FE(odbc_pconnect, NULL)
- PHP_FE(odbc_cursor, NULL)
-#ifdef HAVE_DBMAKER
- PHP_FE(odbc_fetch_array, NULL)
- PHP_FE(odbc_fetch_object, NULL)
-#endif
- PHP_FE(odbc_exec, NULL)
- PHP_FE(odbc_prepare, NULL)
- PHP_FE(odbc_execute, NULL)
- PHP_FE(odbc_fetch_row, NULL)
- PHP_FE(odbc_fetch_into, a3_arg3_and_3_force_ref)
- PHP_FE(odbc_field_len, NULL)
- PHP_FE(odbc_field_scale, NULL)
- PHP_FE(odbc_field_name, NULL)
- PHP_FE(odbc_field_type, NULL)
- PHP_FE(odbc_field_num, NULL)
- PHP_FE(odbc_free_result, NULL)
-#if !defined(HAVE_SOLID) && !defined(HAVE_SOLID_30)
- PHP_FE(odbc_next_result, NULL)
-#endif
- PHP_FE(odbc_num_fields, NULL)
- PHP_FE(odbc_num_rows, NULL)
- PHP_FE(odbc_result, NULL)
- PHP_FE(odbc_result_all, NULL)
- PHP_FE(odbc_rollback, NULL)
- PHP_FE(odbc_binmode, NULL)
- PHP_FE(odbc_longreadlen, NULL)
- PHP_FE(odbc_tables, NULL)
- PHP_FE(odbc_columns, NULL)
- PHP_FE(odbc_gettypeinfo, NULL)
- PHP_FE(odbc_primarykeys, NULL)
-#if !defined(HAVE_DBMAKER) && !defined(HAVE_SOLID) && !defined(HAVE_SOLID_30) &&!defined(HAVE_SOLID_35) && !defined(HAVE_VELOCIS) /* not supported now */
- PHP_FE(odbc_columnprivileges, NULL)
- PHP_FE(odbc_tableprivileges, NULL)
-#endif
-#if !defined(HAVE_SOLID) && !defined(HAVE_SOLID_30) && !defined(HAVE_SOLID_35) /* not supported */
- PHP_FE(odbc_foreignkeys, NULL)
- PHP_FE(odbc_procedures, NULL)
-#if !defined(HAVE_VELOCIS)
- PHP_FE(odbc_procedurecolumns, NULL)
-#endif
-#endif
- PHP_FE(odbc_specialcolumns, NULL)
- PHP_FE(odbc_statistics, NULL)
- PHP_FALIAS(odbc_do, odbc_exec, NULL)
- PHP_FALIAS(odbc_field_precision, odbc_field_len, NULL)
- { NULL, NULL, NULL }
-};
-/* }}} */
-
-/* {{{ odbc_module_entry
- */
-zend_module_entry odbc_module_entry = {
- "odbc",
- odbc_functions,
- PHP_MINIT(odbc),
- PHP_MSHUTDOWN(odbc),
- PHP_RINIT(odbc),
- PHP_RSHUTDOWN(odbc),
- PHP_MINFO(odbc),
- STANDARD_MODULE_PROPERTIES
-};
-/* }}} */
-
-#ifdef ZTS
-int odbc_globals_id;
-#else
-ZEND_API php_odbc_globals odbc_globals;
-#endif
-
-#ifdef COMPILE_DL_ODBC
-ZEND_GET_MODULE(odbc)
-#endif
-
-/* {{{ _free_odbc_result
- */
-static void _free_odbc_result(zend_rsrc_list_entry *rsrc)
-{
- odbc_result *res = (odbc_result *)rsrc->ptr;
- int i;
-
- if (res) {
- if (res->values) {
- for(i = 0; i < res->numcols; i++) {
- if (res->values[i].value)
- efree(res->values[i].value);
- }
- efree(res->values);
- res->values = NULL;
- }
- if (res->stmt) {
-#if defined(HAVE_SOLID) || defined(HAVE_SOLID_30) || defined(HAVE_SOLID_35)
- SQLTransact(res->conn_ptr->henv, res->conn_ptr->hdbc,
- (UWORD)SQL_COMMIT);
-#endif
- SQLFreeStmt(res->stmt,SQL_DROP);
- /* We don't want the connection to be closed after the last statment has been closed
- * Connections will be closed on shutdown
- * zend_list_delete(res->conn_ptr->id);
- */
- }
- efree(res);
- }
-}
-/* }}} */
-
-/* {{{ safe_odbc_disconnect
- * disconnect, and if it fails, then issue a rollback for any pending transaction (lurcher)
- */
-static void safe_odbc_disconnect( void *handle )
-{
- int ret;
-
- ret = SQLDisconnect( handle );
- if ( ret == SQL_ERROR )
- {
- SQLTransact( NULL, handle, SQL_ROLLBACK );
- SQLDisconnect( handle );
- }
-}
-/* }}} */
-
-/* {{{ _close_odbc_conn
- */
-static void _close_odbc_conn(zend_rsrc_list_entry *rsrc)
-{
- odbc_connection *conn = (odbc_connection *)rsrc->ptr;
-
- ODBCLS_FETCH();
-
- safe_odbc_disconnect(conn->hdbc);
- SQLFreeConnect(conn->hdbc);
- SQLFreeEnv(conn->henv);
- efree(conn);
- ODBCG(num_links)--;
-}
-/* }}} */
-
-static void _close_odbc_pconn(zend_rsrc_list_entry *rsrc)
-{
- odbc_connection *conn = (odbc_connection *)rsrc->ptr;
- ODBCLS_FETCH();
-
- safe_odbc_disconnect(conn->hdbc);
- SQLFreeConnect(conn->hdbc);
- SQLFreeEnv(conn->henv);
- free(conn);
-
- ODBCG(num_links)--;
- ODBCG(num_persistent)--;
-}
-
-static PHP_INI_DISP(display_link_nums)
-{
- char *value;
-
- if (type == PHP_INI_DISPLAY_ORIG && ini_entry->modified) {
- value = ini_entry->orig_value;
- } else if (ini_entry->value) {
- value = ini_entry->value;
- } else {
- value = NULL;
- }
-
- if (value) {
- if (atoi(value) == -1) {
- PUTS("Unlimited");
- } else {
- php_printf("%s", value);
- }
- }
-}
-
-static PHP_INI_DISP(display_defPW)
-{
- char *value;
-
- if (type == PHP_INI_DISPLAY_ORIG && ini_entry->modified) {
- value = ini_entry->orig_value;
- } else if (ini_entry->value) {
- value = ini_entry->value;
- } else {
- value = NULL;
- }
-
- if (value) {
-#if PHP_DEBUG
- php_printf("%s", value);
-#else
- PUTS("********");
-#endif
- } else {
- PUTS("<i>no value</i>");
- }
-}
-
-static PHP_INI_DISP(display_binmode)
-{
- char *value;
-
- if (type == PHP_INI_DISPLAY_ORIG && ini_entry->modified) {
- value = ini_entry->orig_value;
- } else if (ini_entry->value) {
- value = ini_entry->value;
- } else {
- value = NULL;
- }
-
- if (value) {
- switch(atoi(value)) {
- case 0:
- PUTS("passthru");
- break;
- case 1:
- PUTS("return as is");
- break;
- case 2:
- PUTS("return as char");
- break;
- }
- }
-}
-
-static PHP_INI_DISP(display_lrl)
-{
- char *value;
-
- if (type == PHP_INI_DISPLAY_ORIG && ini_entry->modified) {
- value = ini_entry->orig_value;
- } else if (ini_entry->value) {
- value = ini_entry->value;
- } else {
- value = NULL;
- }
-
- if (value) {
- if (atoi(value) <= 0) {
- PUTS("Passthru");
- } else {
- php_printf("return up to %s bytes", value);
- }
- }
-}
-
-PHP_INI_BEGIN()
- STD_PHP_INI_BOOLEAN("odbc.allow_persistent", "1", PHP_INI_SYSTEM, OnUpdateInt,
- allow_persistent, php_odbc_globals, odbc_globals)
- STD_PHP_INI_ENTRY_EX("odbc.max_persistent", "-1", PHP_INI_SYSTEM, OnUpdateInt,
- max_persistent, php_odbc_globals, odbc_globals, display_link_nums)
- STD_PHP_INI_ENTRY_EX("odbc.max_links", "-1", PHP_INI_SYSTEM, OnUpdateInt,
- max_links, php_odbc_globals, odbc_globals, display_link_nums)
- STD_PHP_INI_ENTRY("odbc.default_db", NULL, PHP_INI_ALL, OnUpdateString,
- defDB, php_odbc_globals, odbc_globals)
- STD_PHP_INI_ENTRY("odbc.default_user", NULL, PHP_INI_ALL, OnUpdateString,
- defUser, php_odbc_globals, odbc_globals)
- STD_PHP_INI_ENTRY_EX("odbc.default_pw", NULL, PHP_INI_ALL, OnUpdateString,
- defPW, php_odbc_globals, odbc_globals, display_defPW)
- STD_PHP_INI_ENTRY_EX("odbc.defaultlrl", "4096", PHP_INI_ALL, OnUpdateInt,
- defaultlrl, php_odbc_globals, odbc_globals, display_lrl)
- STD_PHP_INI_ENTRY_EX("odbc.defaultbinmode", "1", PHP_INI_ALL, OnUpdateInt,
- defaultbinmode, php_odbc_globals, odbc_globals, display_binmode)
- STD_PHP_INI_BOOLEAN("odbc.check_persistent", "1", PHP_INI_SYSTEM, OnUpdateInt,
- check_persistent, php_odbc_globals, odbc_globals)
-PHP_INI_END()
-
-#ifdef ZTS
-static void php_odbc_init_globals(php_odbc_globals *odbc_globals)
-{
- ODBCG(num_persistent) = 0;
-}
-#endif
-
-PHP_MINIT_FUNCTION(odbc)
-{
- ODBCLS_D;
-#ifdef SQLANY_BUG
- ODBC_SQL_CONN_T foobar;
- RETCODE rc;
-#endif
-
-#ifdef ZTS
- odbc_globals_id = ts_allocate_id(sizeof(php_odbc_globals), php_odbc_init_globals, NULL);
- odbc_globals = ts_resource(odbc_globals_id);
-#else
- ODBCG(num_persistent) = 0;
-#endif
-
- REGISTER_INI_ENTRIES();
- le_result = zend_register_list_destructors_ex(_free_odbc_result, NULL, "odbc result", module_number);
- le_conn = zend_register_list_destructors_ex(_close_odbc_conn, NULL, "odbc link", module_number);
- le_pconn = zend_register_list_destructors_ex(NULL, _close_odbc_pconn, "odbc link persistent", module_number);
- odbc_module_entry.type = type;
-
- REGISTER_STRING_CONSTANT("ODBC_TYPE", PHP_ODBC_TYPE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("ODBC_BINMODE_PASSTHRU", 0, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("ODBC_BINMODE_RETURN", 1, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("ODBC_BINMODE_CONVERT", 2, CONST_CS | CONST_PERSISTENT);
- /* Define Constants for options
- these Constants are defined in <sqlext.h>
- */
- REGISTER_LONG_CONSTANT("SQL_ODBC_CURSORS", SQL_ODBC_CURSORS, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("SQL_CUR_USE_DRIVER", SQL_CUR_USE_DRIVER, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("SQL_CUR_USE_IF_NEEDED", SQL_CUR_USE_IF_NEEDED, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("SQL_CUR_USE_ODBC", SQL_CUR_USE_ODBC, CONST_PERSISTENT | CONST_CS);
-
-
- REGISTER_LONG_CONSTANT("SQL_CONCURRENCY", SQL_CONCURRENCY, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("SQL_CONCUR_READ_ONLY", SQL_CONCUR_READ_ONLY, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("SQL_CONCUR_LOCK", SQL_CONCUR_LOCK, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("SQL_CONCUR_ROWVER", SQL_CONCUR_ROWVER, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("SQL_CONCUR_VALUES", SQL_CONCUR_VALUES, CONST_PERSISTENT | CONST_CS);
-
- REGISTER_LONG_CONSTANT("SQL_CURSOR_TYPE", SQL_CURSOR_TYPE, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("SQL_CURSOR_FORWARD_ONLY", SQL_CURSOR_FORWARD_ONLY, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("SQL_CURSOR_KEYSET_DRIVEN", SQL_CURSOR_KEYSET_DRIVEN, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("SQL_CURSOR_DYNAMIC", SQL_CURSOR_DYNAMIC, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("SQL_CURSOR_STATIC", SQL_CURSOR_STATIC, CONST_PERSISTENT | CONST_CS);
-
- REGISTER_LONG_CONSTANT("SQL_KEYSET_SIZE", SQL_KEYSET_SIZE, CONST_PERSISTENT | CONST_CS);
-
- /*
- * register the standard data types
- */
- REGISTER_LONG_CONSTANT("SQL_CHAR", SQL_CHAR, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("SQL_VARCHAR", SQL_VARCHAR, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("SQL_LONGVARCHAR", SQL_LONGVARCHAR, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("SQL_DECIMAL", SQL_DECIMAL, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("SQL_NUMERIC", SQL_NUMERIC, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("SQL_BIT", SQL_BIT, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("SQL_TINYINT", SQL_TINYINT, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("SQL_SMALLINT", SQL_SMALLINT, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("SQL_INTEGER", SQL_INTEGER, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("SQL_BIGINT", SQL_BIGINT, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("SQL_REAL", SQL_REAL, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("SQL_FLOAT", SQL_FLOAT, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("SQL_DOUBLE", SQL_DOUBLE, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("SQL_BINARY", SQL_BINARY, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("SQL_VARBINARY", SQL_VARBINARY, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("SQL_LONGVARBINARY", SQL_LONGVARBINARY, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("SQL_DATE", SQL_DATE, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("SQL_TIME", SQL_TIME, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("SQL_TIMESTAMP", SQL_TIMESTAMP, CONST_PERSISTENT | CONST_CS);
-#if defined(ODBCVER) && (ODBCVER >= 0x0300)
- REGISTER_LONG_CONSTANT("SQL_TYPE_DATE", SQL_TYPE_DATE, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("SQL_TYPE_TIME", SQL_TYPE_TIME, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("SQL_TYPE_TIMESTAMP", SQL_TYPE_TIMESTAMP, CONST_PERSISTENT | CONST_CS);
-
- /*
- * SQLSpecialColumns values
- */
- REGISTER_LONG_CONSTANT("SQL_BEST_ROWID", SQL_BEST_ROWID, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("SQL_ROWVER", SQL_ROWVER, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("SQL_SCOPE_CURROW", SQL_SCOPE_CURROW, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("SQL_SCOPE_TRANSACTION", SQL_SCOPE_TRANSACTION, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("SQL_SCOPE_SESSION", SQL_SCOPE_SESSION, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("SQL_NO_NULLS", SQL_NO_NULLS, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("SQL_NULLABLE", SQL_NULLABLE, CONST_PERSISTENT | CONST_CS);
-
- /*
- * SQLStatistics values
- */
- REGISTER_LONG_CONSTANT("SQL_INDEX_UNIQUE", SQL_INDEX_UNIQUE, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("SQL_INDEX_ALL", SQL_INDEX_ALL, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("SQL_ENSURE", SQL_ENSURE, CONST_PERSISTENT | CONST_CS);
- REGISTER_LONG_CONSTANT("SQL_QUICK", SQL_QUICK, CONST_PERSISTENT | CONST_CS);
-#endif
-
- return SUCCESS;
-}
-
-
-PHP_RINIT_FUNCTION(odbc)
-{
- ODBCLS_FETCH();
-
- ODBCG(defConn) = -1;
- ODBCG(num_links) = ODBCG(num_persistent);
- memset(ODBCG(laststate), '\0', 6);
- memset(ODBCG(lasterrormsg), '\0', SQL_MAX_MESSAGE_LENGTH);
- return SUCCESS;
-}
-
-PHP_RSHUTDOWN_FUNCTION(odbc)
-{
- return SUCCESS;
-}
-
-PHP_MSHUTDOWN_FUNCTION(odbc)
-{
- ODBCLS_FETCH();
-
- UNREGISTER_INI_ENTRIES();
- return SUCCESS;
-}
-
-PHP_MINFO_FUNCTION(odbc)
-{
- char buf[32];
- ODBCLS_FETCH();
-
- php_info_print_table_start();
- php_info_print_table_header(2, "ODBC Support", "enabled");
- sprintf(buf, "%ld", ODBCG(num_persistent));
- php_info_print_table_row(2, "Active Persistent Links", buf);
- sprintf(buf, "%ld", ODBCG(num_links));
- php_info_print_table_row(2, "Active Links", buf);
- php_info_print_table_row(2, "ODBC library", PHP_ODBC_TYPE);
-#ifndef PHP_WIN32
- php_info_print_table_row(2, "ODBC_INCLUDE", PHP_ODBC_INCLUDE);
- php_info_print_table_row(2, "ODBC_LFLAGS", PHP_ODBC_LFLAGS);
- php_info_print_table_row(2, "ODBC_LIBS", PHP_ODBC_LIBS);
-#endif
- php_info_print_table_end();
-
- DISPLAY_INI_ENTRIES();
-
-}
-
-void odbc_sql_error(ODBC_SQL_ERROR_PARAMS)
-{
- char state[6];
- SDWORD error; /* Not used */
- char errormsg[SQL_MAX_MESSAGE_LENGTH];
- SWORD errormsgsize; /* Not used */
- RETCODE rc;
- ODBC_SQL_ENV_T henv;
- ODBC_SQL_CONN_T conn;
- ODBCLS_FETCH();
-
- if (conn_resource) {
- henv = conn_resource->henv;
- conn = conn_resource->hdbc;
- } else {
- henv = SQL_NULL_HENV;
- conn = SQL_NULL_HDBC;
- }
-
- /* This leads to an endless loop in many drivers!
- *
- while(henv != SQL_NULL_HENV){
- do {
- */
- rc = SQLError(henv, conn, stmt, state,
- &error, errormsg, sizeof(errormsg)-1, &errormsgsize);
- if (conn_resource) {
- memcpy(conn_resource->laststate, state, sizeof(state));
- memcpy(conn_resource->lasterrormsg, errormsg, sizeof(errormsg));
- }
- memcpy(ODBCG(laststate), state, sizeof(state));
- memcpy(ODBCG(lasterrormsg), errormsg, sizeof(errormsg));
- if (func) {
- php_error(E_WARNING, "SQL error: %s, SQL state %s in %s",
- errormsg, state, func);
- } else {
- php_error(E_WARNING, "SQL error: %s, SQL state %s",
- errormsg, state);
- }
- /*
- } while (SQL_SUCCEEDED(rc));
- }
- */
-}
-
-void php_odbc_fetch_attribs(INTERNAL_FUNCTION_PARAMETERS, int mode)
-{
- odbc_result *result;
- pval **pv_res, **pv_flag;
- ODBCLS_FETCH();
- PLS_FETCH();
-
- if (zend_get_parameters_ex(2, &pv_res, &pv_flag) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_long_ex(pv_flag);
-
- if ((*pv_res)->value.lval) {
- ZEND_FETCH_RESOURCE(result, odbc_result *, pv_res, -1, "ODBC result", le_result);
- if (mode)
- result->longreadlen = (*pv_flag)->value.lval;
- else
- result->binmode = (*pv_flag)->value.lval;
- } else {
- if (mode)
- ODBCG(defaultlrl) = (*pv_flag)->value.lval;
- else
- ODBCG(defaultbinmode) = (*pv_flag)->value.lval;
- }
- RETURN_TRUE;
-}
-
-
-int odbc_bindcols(odbc_result *result)
-{
- RETCODE rc;
- int i;
- SWORD colnamelen; /* Not used */
- SDWORD displaysize;
- ODBCLS_FETCH();
-
- result->values = (odbc_result_value *)
- emalloc(sizeof(odbc_result_value)*result->numcols);
-
- if (result->values == NULL) {
- php_error(E_WARNING, "Out of memory");
- SQLFreeStmt(result->stmt, SQL_DROP);
- return 0;
- }
-
- result->longreadlen = ODBCG(defaultlrl);
- result->binmode = ODBCG(defaultbinmode);
-
- for(i = 0; i < result->numcols; i++) {
- rc = SQLColAttributes(result->stmt, (UWORD)(i+1), SQL_COLUMN_NAME,
- result->values[i].name,
- sizeof(result->values[i].name),
- &colnamelen,
- 0);
- rc = SQLColAttributes(result->stmt, (UWORD)(i+1), SQL_COLUMN_TYPE,
- NULL, 0, NULL, &result->values[i].coltype);
-
- /* Don't bind LONG / BINARY columns, so that fetch behaviour can
- be controlled by odbc_binmode() / odbc_longreadlen()
- */
-
- switch(result->values[i].coltype) {
- case SQL_BINARY:
- case SQL_VARBINARY:
- case SQL_LONGVARBINARY:
- case SQL_LONGVARCHAR:
- result->values[i].value = NULL;
- break;
-
-#ifdef HAVE_ADABAS
- case SQL_TIMESTAMP:
- result->values[i].value = (char *)emalloc(27);
- SQLBindCol(result->stmt, (UWORD)(i+1), SQL_C_CHAR, result->values[i].value,
- 27, &result->values[i].vallen);
- break;
-#endif /* HAVE_ADABAS */
- default:
- rc = SQLColAttributes(result->stmt, (UWORD)(i+1), SQL_COLUMN_DISPLAY_SIZE,
- NULL, 0, NULL, &displaysize);
- result->values[i].value = (char *)emalloc(displaysize + 1);
- rc = SQLBindCol(result->stmt, (UWORD)(i+1), SQL_C_CHAR, result->values[i].value,
- displaysize + 1, &result->values[i].vallen);
- break;
- }
- }
- return 1;
-}
-
-void odbc_transact(INTERNAL_FUNCTION_PARAMETERS, int type)
-{
- odbc_connection *conn;
- RETCODE rc;
- pval **pv_conn;
- ODBCLS_FETCH();
-
- if (zend_get_parameters_ex(1, &pv_conn) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE2(conn, odbc_connection *, pv_conn, -1, "ODBC-Link", le_conn, le_pconn);
-
- rc = SQLTransact(conn->henv, conn->hdbc, (UWORD)((type)?SQL_COMMIT:SQL_ROLLBACK));
- if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) {
- odbc_sql_error(conn, SQL_NULL_HSTMT, "SQLTransact");
- RETURN_FALSE;
- }
-
- RETURN_TRUE;
-}
-
-static int _close_pconn_with_id(list_entry *le, int *id)
-{
-
- if(le->type == le_pconn && (((odbc_connection *)(le->ptr))->id == *id)){
- return 1;
- }else{
- return 0;
- }
-}
-
-void odbc_column_lengths(INTERNAL_FUNCTION_PARAMETERS, int type)
-{
- odbc_result *result;
-#if defined(HAVE_SOLID) || defined(HAVE_SOLID_30) || defined(HAVE_OPENLINK)
- /* this seems to be necessary for Solid2.3 ( tested by
- * tammy@synchronis.com) and Solid 3.0 (tested by eric@terra.telemediair.nl)
- * Solid does not seem to declare a SQLINTEGER, but it does declare a
- * SQL_INTEGER which does not work (despite being the same type as a SDWORD.
- * Solid 3.5 does not have this issue.
- */
- SDWORD len;
-#else
- SQLINTEGER len;
-#endif
- pval **pv_res, **pv_num;
-
- if (zend_get_parameters_ex(2, &pv_res, &pv_num) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(pv_num);
-
- ZEND_FETCH_RESOURCE(result, odbc_result *, pv_res, -1, "ODBC result", le_result);
-
- if (result->numcols == 0) {
- php_error(E_WARNING, "No tuples available at this result index");
- RETURN_FALSE;
- }
-
- if ((*pv_num)->value.lval > result->numcols) {
- php_error(E_WARNING, "Field index larger than number of fields");
- RETURN_FALSE;
- }
-
- if ((*pv_num)->value.lval < 1) {
- php_error(E_WARNING, "Field numbering starts at 1");
- RETURN_FALSE;
- }
-
- SQLColAttributes(result->stmt, (UWORD)(*pv_num)->value.lval,
- (SQLUSMALLINT) (type?SQL_COLUMN_SCALE:SQL_COLUMN_PRECISION),
- NULL, 0, NULL, &len);
-
- RETURN_LONG(len);
-}
-
-/* Main User Functions */
-
-/* {{{ proto void odbc_close_all(void)
- Close all ODBC connections */
-PHP_FUNCTION(odbc_close_all)
-{
- void *ptr;
- int type;
- int i;
- int nument;
-
- nument = zend_hash_next_free_element(&EG(regular_list));
-
- /* Loop through list and close all statements */
- for(i = 1; i < nument; i++) {
- ptr = zend_list_find(i, &type);
- if (ptr && (type == le_result)){
- zend_list_delete(i);
- }
- }
-
- /* Second loop through list, now close all connections */
- nument = zend_hash_next_free_element(&EG(regular_list));
-
- for(i = 1; i < nument; i++) {
- ptr = zend_list_find(i, &type);
- if (ptr){
- if(type == le_conn){
- zend_list_delete(i);
- }else if(type == le_pconn){
- zend_list_delete(i);
- /* Delete the persistent connection */
- zend_hash_apply_with_argument(&EG(persistent_list),
- (int (*)(void *, void *)) _close_pconn_with_id, (void *) &i);
- }
- }
- }
-}
-/* }}} */
-
-/* {{{ proto int odbc_binmode(int result_id, int mode)
- Handle binary column data */
-PHP_FUNCTION(odbc_binmode)
-{
- php_odbc_fetch_attribs(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-/* }}} */
-
-/* {{{ proto int odbc_longreadlen(int result_id, int length)
- Handle LONG columns */
-PHP_FUNCTION(odbc_longreadlen)
-{
- php_odbc_fetch_attribs(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
-}
-/* }}} */
-
-
-/* {{{ proto int odbc_prepare(int connection_id, string query)
- Prepares a statement for execution */
-PHP_FUNCTION(odbc_prepare)
-{
- pval **pv_conn, **pv_query;
- char *query;
- odbc_result *result = NULL;
- odbc_connection *conn;
- RETCODE rc;
-#ifdef HAVE_SQL_EXTENDED_FETCH
- UDWORD scrollopts;
-#endif
- ODBCLS_FETCH();
-
- if (zend_get_parameters_ex(2, &pv_conn, &pv_query) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE2(conn, odbc_connection *, pv_conn, -1, "ODBC-Link", le_conn, le_pconn);
-
- convert_to_string_ex(pv_query);
- query = (*pv_query)->value.str.val;
-
- result = (odbc_result *)emalloc(sizeof(odbc_result));
- if (result == NULL) {
- php_error(E_WARNING, "Out of memory");
- RETURN_FALSE;
- }
-
- result->numparams = 0;
-
- rc = SQLAllocStmt(conn->hdbc, &(result->stmt));
- if (rc == SQL_INVALID_HANDLE) {
- efree(result);
- php_error(E_WARNING, "SQLAllocStmt error 'Invalid Handle' in odbc_prepare");
- RETURN_FALSE;
- }
-
- if (rc == SQL_ERROR) {
- odbc_sql_error(conn, SQL_NULL_HSTMT, "SQLAllocStmt");
- efree(result);
- RETURN_FALSE;
- }
-
-#ifdef HAVE_SQL_EXTENDED_FETCH
- /* Solid doesn't have ExtendedFetch, if DriverManager is used, get Info,
- whether Driver supports ExtendedFetch */
- rc = SQLGetInfo(conn->hdbc, SQL_FETCH_DIRECTION, (void *) &scrollopts, sizeof(scrollopts), NULL);
- if (rc == SQL_SUCCESS) {
- if ((result->fetch_abs = (scrollopts & SQL_FD_FETCH_ABSOLUTE))) {
- /* Try to set CURSOR_TYPE to dynamic. Driver will replace this with other
- type if not possible.
- */
- if (SQLSetStmtOption(result->stmt, SQL_CURSOR_TYPE, SQL_CURSOR_DYNAMIC)
- == SQL_ERROR) {
- odbc_sql_error(conn, result->stmt, " SQLSetStmtOption");
- SQLFreeStmt(result->stmt, SQL_DROP);
- efree(result);
- RETURN_FALSE;
- }
- }
- } else {
- result->fetch_abs = 0;
- }
-#endif
-
- rc = SQLPrepare(result->stmt, query, SQL_NTS);
- switch (rc) {
- case SQL_SUCCESS:
- break;
- case SQL_SUCCESS_WITH_INFO:
- odbc_sql_error(conn, result->stmt, "SQLPrepare");
- break;
- default:
- odbc_sql_error(conn, result->stmt, "SQLPrepare");
- RETURN_FALSE;
- }
-
- SQLNumParams(result->stmt, &(result->numparams));
- SQLNumResultCols(result->stmt, &(result->numcols));
-
- if (result->numcols > 0) {
- if (!odbc_bindcols(result)) {
- efree(result);
- RETURN_FALSE;
- }
- } else {
- result->values = NULL;
- }
- result->id = zend_list_insert(result, le_result);
- zend_list_addref(conn->id);
- result->conn_ptr = conn;
- result->fetched = 0;
- RETURN_RESOURCE(result->id);
-}
-/* }}} */
-
-/*
- * Execute prepared SQL statement. Supports only input parameters.
- */
-/* {{{ proto int odbc_execute(int result_id [, array parameters_array])
- Execute a prepared statement */
-PHP_FUNCTION(odbc_execute)
-{
- pval **pv_res, **pv_param_arr, **tmp;
- typedef struct params_t {
- SDWORD vallen;
- int fp;
- } params_t;
- params_t *params = NULL;
- char *filename;
- SWORD sqltype, ctype, scale;
- SWORD nullable;
- UDWORD precision;
- odbc_result *result;
- int numArgs, i, ne;
- RETCODE rc;
- ODBCLS_FETCH();
-
- numArgs = ZEND_NUM_ARGS();
- switch(numArgs) {
- case 1:
- if (zend_get_parameters_ex(1, &pv_res) == FAILURE)
- WRONG_PARAM_COUNT;
- break;
- case 2:
- if (zend_get_parameters_ex(2, &pv_res, &pv_param_arr) == FAILURE)
- WRONG_PARAM_COUNT;
- if ((*pv_param_arr)->type != IS_ARRAY) {
- php_error(E_WARNING, "No array passed to odbc_execute()");
- return;
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(result, odbc_result *, pv_res, -1, "ODBC result", le_result);
-
- /* XXX check for already bound parameters*/
- if (result->numparams > 0 && numArgs == 1) {
- php_error(E_WARNING, "No parameters to SQL statement given");
- RETURN_FALSE;
- }
-
- if (result->numparams > 0) {
- if ((ne = zend_hash_num_elements((*pv_param_arr)->value.ht)) < result->numparams) {
- php_error(E_WARNING,"Not enough parameters (%d should be %d) given",
- ne, result->numparams);
- RETURN_FALSE;
- }
-
- zend_hash_internal_pointer_reset((*pv_param_arr)->value.ht);
- params = (params_t *)emalloc(sizeof(params_t) * result->numparams);
-
- for(i = 1; i <= result->numparams; i++) {
- if (zend_hash_get_current_data((*pv_param_arr)->value.ht, (void **) &tmp) == FAILURE) {
- php_error(E_WARNING,"Error getting parameter");
- SQLFreeStmt(result->stmt,SQL_RESET_PARAMS);
- efree(params);
- RETURN_FALSE;
- }
- convert_to_string(*tmp);
- if ((*tmp)->type != IS_STRING) {
- php_error(E_WARNING,"Error converting parameter");
- SQLFreeStmt(result->stmt, SQL_RESET_PARAMS);
- efree(params);
- RETURN_FALSE;
- }
-
- SQLDescribeParam(result->stmt, (UWORD)i, &sqltype, &precision,
- &scale, &nullable);
- params[i-1].vallen = (*tmp)->value.str.len;
- params[i-1].fp = -1;
-
- if (IS_SQL_BINARY(sqltype))
- ctype = SQL_C_BINARY;
- else
- ctype = SQL_C_CHAR;
-
- if ((*tmp)->value.str.val[0] == '\'' &&
- (*tmp)->value.str.val[(*tmp)->value.str.len - 1] == '\'') {
- filename = &(*tmp)->value.str.val[1];
- filename[(*tmp)->value.str.len - 2] = '\0';
-
- if ((params[i-1].fp = open(filename,O_RDONLY)) == -1) {
- php_error(E_WARNING,"Can't open file %s", filename);
- SQLFreeStmt(result->stmt, SQL_RESET_PARAMS);
- for(i = 0; i < result->numparams; i++) {
- if (params[i].fp != -1) {
- close(params[i].fp);
- }
- }
- efree(params);
- RETURN_FALSE;
- }
-
- params[i-1].vallen = SQL_LEN_DATA_AT_EXEC(0);
-
- rc = SQLBindParameter(result->stmt, (UWORD)i, SQL_PARAM_INPUT,
- ctype, sqltype, precision, scale,
- (void *)params[i-1].fp, 0,
- &params[i-1].vallen);
- } else {
-#ifdef HAVE_DBMAKER
- precision = params[i-1].vallen;
-#endif
- rc = SQLBindParameter(result->stmt, (UWORD)i, SQL_PARAM_INPUT,
- ctype, sqltype, precision, scale,
- (*tmp)->value.str.val, 0,
- &params[i-1].vallen);
- }
- zend_hash_move_forward((*pv_param_arr)->value.ht);
- }
- }
- /* Close cursor, needed for doing multiple selects */
- rc = SQLFreeStmt(result->stmt, SQL_CLOSE);
-
- if (rc == SQL_ERROR) {
- odbc_sql_error(result->conn_ptr, result->stmt, "SQLFreeStmt");
- }
-
- rc = SQLExecute(result->stmt);
-
- result->fetched = 0;
- if (rc == SQL_NEED_DATA) {
- char buf[4096];
- int fp, nbytes;
- while(rc == SQL_NEED_DATA) {
- rc = SQLParamData(result->stmt, (void*)&fp);
- if (rc == SQL_NEED_DATA) {
- while((nbytes = read(fp, &buf, 4096)) > 0)
- SQLPutData(result->stmt, (void*)&buf, nbytes);
- }
- }
- } else {
- switch (rc) {
- case SQL_SUCCESS:
- break;
- case SQL_NO_DATA_FOUND:
- case SQL_SUCCESS_WITH_INFO:
- odbc_sql_error(result->conn_ptr, result->stmt, "SQLExecute");
- break;
- default:
- RETVAL_FALSE;
- }
- }
-
- if (result->numparams > 0) {
- SQLFreeStmt(result->stmt, SQL_RESET_PARAMS);
- for(i = 0; i < result->numparams; i++) {
- if (params[i].fp != -1)
- close(params[i].fp);
- }
- efree(params);
- }
-
- if (rc == SQL_SUCCESS || rc == SQL_SUCCESS_WITH_INFO
- || rc == SQL_NO_DATA_FOUND) {
- RETVAL_TRUE;
- }
-
- if (result->numcols == 0) {
- SQLNumResultCols(result->stmt, &(result->numcols));
-
- if (result->numcols > 0) {
- if (!odbc_bindcols(result)) {
- efree(result);
- RETVAL_FALSE;
- }
- } else {
- result->values = NULL;
- }
- }
-}
-/* }}} */
-
-/* {{{ proto string odbc_cursor(int result_id)
- Get cursor name */
-PHP_FUNCTION(odbc_cursor)
-{
- pval **pv_res;
- SWORD len, max_len;
- char *cursorname;
- odbc_result *result;
- RETCODE rc;
- ODBCLS_FETCH();
-
- if (zend_get_parameters_ex(1, &pv_res) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(result, odbc_result *, pv_res, -1, "ODBC result", le_result);
-
- rc = SQLGetInfo(result->conn_ptr->hdbc,SQL_MAX_CURSOR_NAME_LEN,
- (void *)&max_len,0,&len);
- if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) {
- RETURN_FALSE;
- }
-
- if (max_len > 0) {
- cursorname = emalloc(max_len + 1);
- if (cursorname == NULL) {
- php_error(E_WARNING,"Out of memory");
- RETURN_FALSE;
- }
- rc = SQLGetCursorName(result->stmt,cursorname,(SWORD)max_len,&len);
- if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) {
- char state[6]; /* Not used */
- SDWORD error; /* Not used */
- char errormsg[255];
- SWORD errormsgsize; /* Not used */
- ODBCLS_FETCH();
-
- SQLError( result->conn_ptr->henv, result->conn_ptr->hdbc,
- result->stmt, state, &error, errormsg,
- sizeof(errormsg)-1, &errormsgsize);
- if (!strncmp(state,"S1015",5)) {
- sprintf(cursorname,"php_curs_%d", (int)result->stmt);
- if (SQLSetCursorName(result->stmt,cursorname,SQL_NTS) != SQL_SUCCESS) {
- odbc_sql_error(result->conn_ptr, result->stmt, "SQLSetCursorName");
- RETVAL_FALSE;
- } else {
- RETVAL_STRING(cursorname,1);
- }
- } else {
- php_error(E_WARNING, "SQL error: %s, SQL state %s", errormsg, state);
- RETVAL_FALSE;
- }
- } else {
- RETVAL_STRING(cursorname,1);
- }
- efree(cursorname);
- } else {
- RETVAL_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto int odbc_exec(int connection_id, string query [, int flags])
- Prepare and execute an SQL statement */
-/* XXX Use flags */
-PHP_FUNCTION(odbc_exec)
-{
- pval **pv_conn, **pv_query, **pv_flags;
- int numArgs;
- char *query;
- odbc_result *result = NULL;
- odbc_connection *conn;
- RETCODE rc;
-#ifdef HAVE_SQL_EXTENDED_FETCH
- UDWORD scrollopts;
-#endif
-
- numArgs = ZEND_NUM_ARGS();
- if (numArgs > 2) {
- if (zend_get_parameters_ex(3, &pv_conn, &pv_query, &pv_flags) == FAILURE)
- WRONG_PARAM_COUNT;
- convert_to_long_ex(pv_flags);
- } else {
- if (zend_get_parameters_ex(2, &pv_conn, &pv_query) == FAILURE)
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE2(conn, odbc_connection *, pv_conn, -1, "ODBC-Link", le_conn, le_pconn);
-
- convert_to_string_ex(pv_query);
- query = (*pv_query)->value.str.val;
-
- result = (odbc_result *)emalloc(sizeof(odbc_result));
- if (result == NULL) {
- php_error(E_WARNING, "Out of memory");
- RETURN_FALSE;
- }
-
- rc = SQLAllocStmt(conn->hdbc, &(result->stmt));
- if (rc == SQL_INVALID_HANDLE) {
- php_error(E_WARNING, "SQLAllocStmt error 'Invalid Handle'");
- efree(result);
- RETURN_FALSE;
- }
-
- if (rc == SQL_ERROR) {
- odbc_sql_error(conn, SQL_NULL_HSTMT, "SQLAllocStmt");
- efree(result);
- RETURN_FALSE;
- }
-
-#ifdef HAVE_SQL_EXTENDED_FETCH
- /* Solid doesn't have ExtendedFetch, if DriverManager is used, get Info,
- whether Driver supports ExtendedFetch */
- rc = SQLGetInfo(conn->hdbc, SQL_FETCH_DIRECTION, (void *) &scrollopts, sizeof(scrollopts), NULL);
- if (rc == SQL_SUCCESS) {
- if ((result->fetch_abs = (scrollopts & SQL_FD_FETCH_ABSOLUTE))) {
- /* Try to set CURSOR_TYPE to dynamic. Driver will replace this with other
- type if not possible.
- */
- if (SQLSetStmtOption(result->stmt, SQL_CURSOR_TYPE, SQL_CURSOR_DYNAMIC)
- == SQL_ERROR) {
- odbc_sql_error(conn, result->stmt, " SQLSetStmtOption");
- SQLFreeStmt(result->stmt, SQL_DROP);
- efree(result);
- RETURN_FALSE;
- }
- }
- } else {
- result->fetch_abs = 0;
- }
-#endif
-
- rc = SQLExecDirect(result->stmt, query, SQL_NTS);
- if (rc != SQL_SUCCESS
- && rc != SQL_SUCCESS_WITH_INFO
- && rc != SQL_NO_DATA_FOUND) {
- /* XXX FIXME we should really check out SQLSTATE with SQLError
- * in case rc is SQL_SUCCESS_WITH_INFO here.
- */
- odbc_sql_error(conn, result->stmt, "SQLExecDirect");
- SQLFreeStmt(result->stmt, SQL_DROP);
- efree(result);
- RETURN_FALSE;
- }
-
- SQLNumResultCols(result->stmt, &(result->numcols));
-
- /* For insert, update etc. cols == 0 */
- if (result->numcols > 0) {
- if (!odbc_bindcols(result)) {
- efree(result);
- RETURN_FALSE;
- }
- } else {
- result->values = NULL;
- }
- result->id = zend_list_insert(result, le_result);
- zend_list_addref(conn->id);
- result->conn_ptr = conn;
- result->fetched = 0;
-
- RETURN_RESOURCE(result->id);
-}
-/* }}} */
-
-#ifdef HAVE_DBMAKER
-#define ODBC_NUM 1
-#define ODBC_OBJECT 2
-
-static void php_odbc_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, int result_type)
-{
- int i;
- odbc_result *result;
- RETCODE rc;
- SWORD sql_c_type;
- char *buf = NULL;
-#ifdef HAVE_SQL_EXTENDED_FETCH
- UDWORD crow;
- UWORD RowStatus[1];
- SDWORD rownum = -1;
- pval **pv_res, **pv_row, *tmp;
-
- switch(ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &pv_res) == FAILURE)
- WRONG_PARAM_COUNT;
- break;
- case 2:
- if (zend_get_parameters_ex(2, &pv_res, &pv_row) == FAILURE)
- WRONG_PARAM_COUNT;
- convert_to_long_ex(pv_row);
- rownum = (*pv_row)->value.lval;
- break;
- default:
- WRONG_PARAM_COUNT;
- }
-
-#else
- pval **pv_res, *tmp;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &pv_res) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-#endif
-
- ZEND_FETCH_RESOURCE(result, odbc_result *, pv_res, -1, "ODBC result", le_result);
-
- if (result->numcols == 0) {
- php_error(E_WARNING, "No tuples available at this result index");
- RETURN_FALSE;
- }
-
- if (array_init(return_value)==FAILURE) {
- RETURN_FALSE;
- }
-
-#ifdef HAVE_SQL_EXTENDED_FETCH
- if (result->fetch_abs) {
- if (rownum > 0)
- rc = SQLExtendedFetch(result->stmt,SQL_FETCH_ABSOLUTE,rownum,&crow,RowStatus);
- else
- rc = SQLExtendedFetch(result->stmt,SQL_FETCH_NEXT,1,&crow,RowStatus);
- } else
-#endif
- rc = SQLFetch(result->stmt);
-
- if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO)
- RETURN_FALSE;
-
-#ifdef HAVE_SQL_EXTENDED_FETCH
- if (rownum > 0 && result->fetch_abs)
- result->fetched = rownum;
- else
-#endif
- result->fetched++;
-
- for(i = 0; i < result->numcols; i++) {
- ALLOC_ZVAL(tmp);
- tmp->refcount = 1;
- tmp->type = IS_STRING;
- tmp->value.str.len = 0;
- sql_c_type = SQL_C_CHAR;
-
- switch(result->values[i].coltype) {
- case SQL_BINARY:
- case SQL_VARBINARY:
- case SQL_LONGVARBINARY:
- if (result->binmode <= 0) {
- tmp->value.str.val = empty_string;
- break;
- }
- if (result->binmode == 1) sql_c_type = SQL_C_BINARY;
- case SQL_LONGVARCHAR:
- if (IS_SQL_LONG(result->values[i].coltype) &&
- result->longreadlen <= 0) {
- tmp->value.str.val = empty_string;
- break;
- }
-
- if (buf == NULL) buf = emalloc(result->longreadlen + 1);
- rc = SQLGetData(result->stmt, (UWORD)(i + 1),sql_c_type,
- buf, result->longreadlen + 1, &result->values[i].vallen);
-
- if (rc == SQL_ERROR) {
- odbc_sql_error(result->conn_ptr, result->stmt, "SQLGetData");
- efree(buf);
- RETURN_FALSE;
- }
- if (rc == SQL_SUCCESS_WITH_INFO) {
- tmp->value.str.len = result->longreadlen;
- } else if (result->values[i].vallen == SQL_NULL_DATA) {
- tmp->value.str.val = empty_string;
- break;
- } else {
- tmp->value.str.len = result->values[i].vallen;
- }
- tmp->value.str.val = estrndup(buf, tmp->value.str.len);
- break;
-
- default:
- if (result->values[i].vallen == SQL_NULL_DATA) {
- tmp->value.str.val = empty_string;
- break;
- }
- tmp->value.str.len = result->values[i].vallen;
- tmp->value.str.val = estrndup(result->values[i].value,tmp->value.str.len);
- break;
- }
- if (result_type & ODBC_NUM) {
- zend_hash_index_update(return_value->value.ht, i, &tmp, sizeof(pval *), NULL);
- } else {
- zend_hash_update(return_value->value.ht, result->values[i].name, strlen(result->values[i].name)+1, &tmp, sizeof(pval *), NULL);
- }
- }
- if (buf) efree(buf);
-}
-
-
-/* {{{ proto object odbc_fetch_object(int result [, int rownumber])
- Fetch a result row as an object */
-PHP_FUNCTION(odbc_fetch_object)
-{
- php_odbc_fetch_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU, ODBC_OBJECT);
- if (return_value->type==IS_ARRAY) {
- return_value->type=IS_OBJECT;
- return_value->value.obj.properties = return_value->value.ht;
- return_value->value.obj.ce = &zend_standard_class_def;
- }
-}
-/* }}} */
-
-/* {{{ proto array odbc_fetch_array(int result [, int rownumber])
- Fetch a result row as an associative array */
-PHP_FUNCTION(odbc_fetch_array)
-{
- php_odbc_fetch_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU, ODBC_OBJECT);
-}
-/* }}} */
-#endif
-
-/* {{{ proto int odbc_fetch_into(int result_id [, int rownumber], array result_array)
- Fetch one result row into an array */
-PHP_FUNCTION(odbc_fetch_into)
-{
- int numArgs, i;
- odbc_result *result;
- RETCODE rc;
- SWORD sql_c_type;
- char *buf = NULL;
-#ifdef HAVE_SQL_EXTENDED_FETCH
- UDWORD crow;
- UWORD RowStatus[1];
- SDWORD rownum = -1;
- pval **pv_res, **pv_row, **pv_res_arr, *tmp;
-
- numArgs = ZEND_NUM_ARGS();
-
- switch(numArgs) {
- case 2:
- if (zend_get_parameters_ex(2, &pv_res, &pv_res_arr) == FAILURE)
- WRONG_PARAM_COUNT;
- break;
- case 3:
- if (zend_get_parameters_ex(3, &pv_res, &pv_row, &pv_res_arr) == FAILURE)
- WRONG_PARAM_COUNT;
- SEPARATE_ZVAL(pv_row);
- convert_to_long_ex(pv_row);
- rownum = (*pv_row)->value.lval;
- break;
- default:
- WRONG_PARAM_COUNT;
- }
-
-#else
- pval **pv_res, **pv_res_arr, *tmp;
-
- numArgs = ZEND_NUM_ARGS();
-
- if (numArgs != 2 || zend_get_parameters_ex(2, &pv_res, &pv_res_arr) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-#endif
-
- ZEND_FETCH_RESOURCE(result, odbc_result *, pv_res, -1, "ODBC result", le_result);
-
- if (result->numcols == 0) {
- php_error(E_WARNING, "No tuples available at this result index");
- RETURN_FALSE;
- }
-
- if ((*pv_res_arr)->type != IS_ARRAY) {
- if (array_init(*pv_res_arr) == FAILURE) {
- php_error(E_WARNING, "Can't convert to type Array");
- RETURN_FALSE;
- }
- }
-
-#ifdef HAVE_SQL_EXTENDED_FETCH
- if (result->fetch_abs) {
- if (rownum > 0)
- rc = SQLExtendedFetch(result->stmt,SQL_FETCH_ABSOLUTE,rownum,&crow,RowStatus);
- else
- rc = SQLExtendedFetch(result->stmt,SQL_FETCH_NEXT,1,&crow,RowStatus);
- } else
-#endif
- rc = SQLFetch(result->stmt);
-
- if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO)
- RETURN_FALSE;
-
-#ifdef HAVE_SQL_EXTENDED_FETCH
- if (rownum > 0 && result->fetch_abs)
- result->fetched = rownum;
- else
-#endif
- result->fetched++;
-
- for(i = 0; i < result->numcols; i++) {
- ALLOC_ZVAL(tmp);
- tmp->refcount = 1;
- tmp->type = IS_STRING;
- tmp->value.str.len = 0;
- sql_c_type = SQL_C_CHAR;
-
- switch(result->values[i].coltype) {
- case SQL_BINARY:
- case SQL_VARBINARY:
- case SQL_LONGVARBINARY:
- if (result->binmode <= 0) {
- tmp->value.str.val = empty_string;
- break;
- }
- if (result->binmode == 1) sql_c_type = SQL_C_BINARY;
- case SQL_LONGVARCHAR:
- if (IS_SQL_LONG(result->values[i].coltype) &&
- result->longreadlen <= 0) {
- tmp->value.str.val = empty_string;
- break;
- }
-
- if (buf == NULL) buf = emalloc(result->longreadlen + 1);
- rc = SQLGetData(result->stmt, (UWORD)(i + 1),sql_c_type,
- buf, result->longreadlen + 1, &result->values[i].vallen);
-
- if (rc == SQL_ERROR) {
- odbc_sql_error(result->conn_ptr, result->stmt, "SQLGetData");
- efree(buf);
- RETURN_FALSE;
- }
- if (rc == SQL_SUCCESS_WITH_INFO) {
- tmp->value.str.len = result->longreadlen;
- } else if (result->values[i].vallen == SQL_NULL_DATA) {
- tmp->value.str.val = empty_string;
- break;
- } else {
- tmp->value.str.len = result->values[i].vallen;
- }
- tmp->value.str.val = estrndup(buf, tmp->value.str.len);
- break;
-
- default:
- if (result->values[i].vallen == SQL_NULL_DATA) {
- tmp->value.str.val = empty_string;
- break;
- }
- tmp->value.str.len = result->values[i].vallen;
- tmp->value.str.val = estrndup(result->values[i].value,tmp->value.str.len);
- break;
- }
- zend_hash_index_update((*pv_res_arr)->value.ht, i, &tmp, sizeof(pval *), NULL);
- }
- if (buf) efree(buf);
- RETURN_LONG(result->numcols);
-}
-/* }}} */
-
-#if defined(HAVE_SOLID) || defined(HAVE_SOLID_30) || defined(HAVE_SOLID_35)
-PHP_FUNCTION(solid_fetch_prev)
-{
- odbc_result *result;
- RETCODE rc;
- pval **pv_res;
-
- if (zend_get_parameters_ex(1, &pv_res) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(result, odbc_result *, pv_res, -1, "ODBC result", le_result);
- if (result->numcols == 0) {
- php_error(E_WARNING, "No tuples available at this result index");
- RETURN_FALSE;
- }
- rc = SQLFetchPrev(result->stmt);
-
- if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) {
- RETURN_FALSE;
- }
-
- if (result->fetched > 1) result->fetched--;
-
- RETURN_TRUE;
-}
-#endif
-
-/* {{{ proto int odbc_fetch_row(int result_id [, int row_number])
- Fetch a row */
-PHP_FUNCTION(odbc_fetch_row)
-{
- int numArgs;
- SDWORD rownum = 1;
- odbc_result *result;
- RETCODE rc;
- pval **pv_res, **pv_row;
-#ifdef HAVE_SQL_EXTENDED_FETCH
- UDWORD crow;
- UWORD RowStatus[1];
-#endif
-
- numArgs = ZEND_NUM_ARGS();
- if (numArgs == 1) {
- if (zend_get_parameters_ex(1, &pv_res) == FAILURE)
- WRONG_PARAM_COUNT;
- } else {
- if (zend_get_parameters_ex(2, &pv_res, &pv_row) == FAILURE)
- WRONG_PARAM_COUNT;
- convert_to_long_ex(pv_row);
- rownum = (*pv_row)->value.lval;
- }
-
- ZEND_FETCH_RESOURCE(result, odbc_result *, pv_res, -1, "ODBC result", le_result);
-
- if (result->numcols == 0) {
- php_error(E_WARNING, "No tuples available at this result index");
- RETURN_FALSE;
- }
-
-#ifdef HAVE_SQL_EXTENDED_FETCH
- if (result->fetch_abs) {
- if (numArgs > 1)
- rc = SQLExtendedFetch(result->stmt,SQL_FETCH_ABSOLUTE,rownum,&crow,RowStatus);
- else
- rc = SQLExtendedFetch(result->stmt,SQL_FETCH_NEXT,1,&crow,RowStatus);
- } else
-#endif
- rc = SQLFetch(result->stmt);
-
- if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) {
- RETURN_FALSE;
- }
-
- if (numArgs > 1) {
- result->fetched = rownum;
- } else {
- result->fetched++;
- }
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto string odbc_result(int result_id, mixed field)
- Get result data */
-PHP_FUNCTION(odbc_result)
-{
- char *field;
- int field_ind;
- SWORD sql_c_type = SQL_C_CHAR;
- odbc_result *result;
- int i = 0;
- RETCODE rc;
- SDWORD fieldsize;
- pval **pv_res, **pv_field;
-#ifdef HAVE_SQL_EXTENDED_FETCH
- UDWORD crow;
- UWORD RowStatus[1];
-#endif
-
- field_ind = -1;
- field = NULL;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2 , &pv_res, &pv_field) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if ((*pv_field)->type == IS_STRING) {
- field = (*pv_field)->value.str.val;
- } else {
- convert_to_long_ex(pv_field);
- field_ind = (*pv_field)->value.lval - 1;
- }
-
- ZEND_FETCH_RESOURCE(result, odbc_result *, pv_res, -1, "ODBC result", le_result);
-
- if ((result->numcols == 0)) {
- php_error(E_WARNING, "No tuples available at this result index");
- RETURN_FALSE;
- }
-
- /* get field index if the field parameter was a string */
- if (field != NULL) {
- for(i = 0; i < result->numcols; i++) {
- if (!strcasecmp(result->values[i].name, field)) {
- field_ind = i;
- break;
- }
- }
-
- if (field_ind < 0) {
- php_error(E_WARNING, "Field %s not found", field);
- RETURN_FALSE;
- }
- } else {
- /* check for limits of field_ind if the field parameter was an int */
- if (field_ind >= result->numcols || field_ind < 0) {
- php_error(E_WARNING, "Field index is larger than the number of fields");
- RETURN_FALSE;
- }
- }
-
- if (result->fetched == 0) {
- /* User forgot to call odbc_fetchrow(), let's do it here */
-#ifdef HAVE_SQL_EXTENDED_FETCH
- if (result->fetch_abs)
- rc = SQLExtendedFetch(result->stmt, SQL_FETCH_NEXT, 1, &crow,RowStatus);
- else
-#endif
- rc = SQLFetch(result->stmt);
-
- if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO)
- RETURN_FALSE;
-
- result->fetched++;
- }
-
- switch(result->values[field_ind].coltype) {
- case SQL_BINARY:
- case SQL_VARBINARY:
- case SQL_LONGVARBINARY:
- if (result->binmode <= 1) sql_c_type = SQL_C_BINARY;
- if (result->binmode <= 0) break;
- case SQL_LONGVARCHAR:
- if (IS_SQL_LONG(result->values[field_ind].coltype)) {
- if (result->longreadlen <= 0)
- break;
- else
- fieldsize = result->longreadlen;
- } else {
- SQLColAttributes(result->stmt, (UWORD)(field_ind + 1),
- (UWORD)((sql_c_type == SQL_C_BINARY) ? SQL_COLUMN_LENGTH :
- SQL_COLUMN_DISPLAY_SIZE),
- NULL, 0, NULL, &fieldsize);
- }
- /* For char data, the length of the returned string will be longreadlen - 1 */
- fieldsize = (result->longreadlen <= 0) ? 4096 : result->longreadlen;
- field = emalloc(fieldsize);
- if (!field) {
- php_error(E_WARNING, "Out of memory");
- RETURN_FALSE;
- }
- /* SQLGetData will truncate CHAR data to fieldsize - 1 bytes and append \0.
- For binary data it is truncated to fieldsize bytes.
- */
- rc = SQLGetData(result->stmt, (UWORD)(field_ind + 1), sql_c_type,
- field, fieldsize, &result->values[field_ind].vallen);
-
- if (rc == SQL_ERROR) {
- odbc_sql_error(result->conn_ptr, result->stmt, "SQLGetData");
- efree(field);
- RETURN_FALSE;
- }
-
- if (result->values[field_ind].vallen == SQL_NULL_DATA || rc == SQL_NO_DATA_FOUND) {
- efree(field);
- RETURN_FALSE;
- }
- /* Reduce fieldlen by 1 if we have char data. One day we might
- have binary strings... */
- if (result->values[field_ind].coltype == SQL_LONGVARCHAR) fieldsize -= 1;
- /* Don't duplicate result, saves one emalloc.
- For SQL_SUCCESS, the length is in vallen.
- */
- RETURN_STRINGL(field, (rc == SQL_SUCCESS_WITH_INFO) ? fieldsize :
- result->values[field_ind].vallen, 0);
- break;
-
- default:
- if (result->values[field_ind].vallen == SQL_NULL_DATA) {
- RETURN_FALSE;
- } else {
- RETURN_STRINGL(result->values[field_ind].value, result->values[field_ind].vallen, 1);
- }
- break;
- }
-
-/* If we come here, output unbound LONG and/or BINARY column data to the client */
-
- /* We emalloc 1 byte more for SQL_C_CHAR (trailing \0) */
- fieldsize = (sql_c_type == SQL_C_CHAR) ? 4096 : 4095;
- if ((field = emalloc(fieldsize)) == NULL) {
- php_error(E_WARNING,"Out of memory");
- RETURN_FALSE;
- }
-
- /* Call SQLGetData() until SQL_SUCCESS is returned */
- while(1) {
- rc = SQLGetData(result->stmt, (UWORD)(field_ind + 1),sql_c_type,
- field, fieldsize, &result->values[field_ind].vallen);
-
- if (rc == SQL_ERROR) {
- odbc_sql_error(result->conn_ptr, result->stmt, "SQLGetData");
- efree(field);
- RETURN_FALSE;
- }
-
- if (result->values[field_ind].vallen == SQL_NULL_DATA) {
- efree(field);
- RETURN_FALSE;
- }
- /* chop the trailing \0 by outputing only 4095 bytes */
- PHPWRITE(field,(rc == SQL_SUCCESS_WITH_INFO) ? 4095 :
- result->values[field_ind].vallen);
-
- if (rc == SQL_SUCCESS) { /* no more data avail */
- efree(field);
- RETURN_TRUE;
- }
- }
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int odbc_result_all(int result_id [, string format])
- Print result as HTML table */
-PHP_FUNCTION(odbc_result_all)
-{
- char *buf = NULL;
- int i, numArgs;
- odbc_result *result;
- RETCODE rc;
- pval **pv_res, **pv_format;
- SWORD sql_c_type;
-#ifdef HAVE_SQL_EXTENDED_FETCH
- UDWORD crow;
- UWORD RowStatus[1];
-#endif
-
- numArgs = ZEND_NUM_ARGS();
- if (numArgs == 1) {
- if (zend_get_parameters_ex(1, &pv_res) == FAILURE)
- WRONG_PARAM_COUNT;
- } else {
- if (zend_get_parameters_ex(2, &pv_res, &pv_format) == FAILURE)
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(result, odbc_result *, pv_res, -1, "ODBC result", le_result);
-
- if (result->numcols == 0) {
- php_error(E_WARNING, "No tuples available at this result index");
- RETURN_FALSE;
- }
-#ifdef HAVE_SQL_EXTENDED_FETCH
- if (result->fetch_abs)
- rc = SQLExtendedFetch(result->stmt,SQL_FETCH_NEXT,1,&crow,RowStatus);
- else
-#endif
- rc = SQLFetch(result->stmt);
-
- if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) {
- php_printf("<h2>No rows found</h2>\n");
- RETURN_LONG(0);
- }
-
- /* Start table tag */
- if (numArgs == 1) {
- php_printf("<table><tr>");
- } else {
- convert_to_string_ex(pv_format);
- php_printf("<table %s ><tr>",(*pv_format)->value.str.val);
- }
-
- for(i = 0; i < result->numcols; i++)
- php_printf("<th>%s</th>", result->values[i].name);
-
- php_printf("</tr>\n");
-
- while(rc == SQL_SUCCESS || rc == SQL_SUCCESS_WITH_INFO) {
- result->fetched++;
- php_printf("<tr>");
- for(i = 0; i < result->numcols; i++) {
- sql_c_type = SQL_C_CHAR;
- switch(result->values[i].coltype) {
- case SQL_BINARY:
- case SQL_VARBINARY:
- case SQL_LONGVARBINARY:
- if (result->binmode <= 0) {
- php_printf("<td>Not printable</td>");
- break;
- }
- if (result->binmode <= 1) sql_c_type = SQL_C_BINARY;
- case SQL_LONGVARCHAR:
- if (IS_SQL_LONG(result->values[i].coltype) &&
- result->longreadlen <= 0) {
- php_printf("<td>Not printable</td>");
- break;
- }
-
- if (buf == NULL) buf = emalloc(result->longreadlen);
-
- rc = SQLGetData(result->stmt, (UWORD)(i + 1),sql_c_type,
- buf, result->longreadlen, &result->values[i].vallen);
-
- php_printf("<td>");
-
- if (rc == SQL_ERROR) {
- odbc_sql_error(result->conn_ptr, result->stmt, "SQLGetData");
- php_printf("</td></tr></table>");
- efree(buf);
- RETURN_FALSE;
- }
- if (rc == SQL_SUCCESS_WITH_INFO)
- php_printf(buf,result->longreadlen);
- else if (result->values[i].vallen == SQL_NULL_DATA) {
- php_printf("&nbsp;</td>");
- break;
- } else {
- php_printf(buf, result->values[i].vallen);
- }
- php_printf("</td>");
- break;
- default:
- if (result->values[i].vallen == SQL_NULL_DATA) {
- php_printf("<td>&nbsp;</td>");
- } else {
- php_printf("<td>%s</td>", result->values[i].value);
- }
- break;
- }
- }
- php_printf("</tr>\n");
-
-#ifdef HAVE_SQL_EXTENDED_FETCH
- if (result->fetch_abs)
- rc = SQLExtendedFetch(result->stmt,SQL_FETCH_NEXT,1,&crow,RowStatus);
- else
-#endif
- rc = SQLFetch(result->stmt);
- }
- php_printf("</table>\n");
- if (buf) efree(buf);
- RETURN_LONG(result->fetched);
-}
-/* }}} */
-
-/* {{{ proto int odbc_free_result(int result_id)
- Free resources associated with a result */
-PHP_FUNCTION(odbc_free_result)
-{
- pval **pv_res;
- odbc_result *result;
- int i;
-
- if (zend_get_parameters_ex(1, &pv_res) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(result, odbc_result *, pv_res, -1, "ODBC result", le_result);
- if (result->values) {
- for (i = 0; i < result->numcols; i++) {
- if (result->values[i].value) {
- efree(result->values[i].value);
- }
- }
- efree(result->values);
- result->values = NULL;
- }
-
- zend_list_delete(result->id);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int odbc_connect(string DSN, string user, string password [, int cursor_option])
- Connect to a datasource */
-PHP_FUNCTION(odbc_connect)
-{
- odbc_do_connect(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-/* }}} */
-
-/* {{{ proto int odbc_pconnect(string DSN, string user, string password [, int cursor_option])
- Establish a persistent connection to a datasource */
-PHP_FUNCTION(odbc_pconnect)
-{
- odbc_do_connect(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
-}
-/* }}} */
-
-int odbc_sqlconnect(odbc_connection **conn, char *db, char *uid, char *pwd, int cur_opt, int persistent ODBCLS_DC)
-{
- RETCODE rc;
-
- *conn = (odbc_connection *)pemalloc(sizeof(odbc_connection), persistent);
- (*conn)->persistent = persistent;
- SQLAllocEnv(&((*conn)->henv));
- SQLAllocConnect((*conn)->henv, &((*conn)->hdbc));
-
-#if defined(HAVE_SOLID) || defined(HAVE_SOLID_30)
- SQLSetConnectOption((*conn)->hdbc, SQL_TRANSLATE_OPTION,
- SQL_SOLID_XLATOPT_NOCNV);
-#endif
-#ifdef HAVE_OPENLINK
- {
- char dsnbuf[300];
- short dsnbuflen;
-
- rc = SQLDriverConnect((*conn)->hdbc, NULL, db, SQL_NTS,
- dsnbuf, sizeof(dsnbuf) - 1, &dsnbuflen,
- SQL_DRIVER_NOPROMPT);
- }
-#else
- if (cur_opt != SQL_CUR_DEFAULT) {
- rc = SQLSetConnectOption((*conn)->hdbc, SQL_ODBC_CURSORS, cur_opt);
- if (rc != SQL_SUCCESS) { /* && rc != SQL_SUCCESS_WITH_INFO ? */
- odbc_sql_error(*conn, SQL_NULL_HSTMT, "SQLSetConnectOption");
- SQLFreeConnect((*conn)->hdbc);
- pefree(*conn, persistent);
- return FALSE;
- }
- }
-/* Possible fix for bug #10250
- * Needs testing on UnixODBC < 2.0.5 though. */
- #if defined(HAVE_EMPRESS) || defined(HAVE_UNIXODBC)
-/* * Uncomment the line above, and comment line below to fully test
- * #ifdef HAVE_EMPRESS */
- {
- int direct = 0;
- char dsnbuf[300];
- short dsnbuflen;
- char *ldb = 0;
- int ldb_len = 0;
-
- if (strstr((char*)db, ";")) {
- direct = 1;
- if (uid && !strstr ((char*)db, "uid") && !strstr((char*)db, "UID")) {
- ldb = (char*) emalloc(strlen(db) + strlen(uid) + strlen(pwd) + 12);
- sprintf(ldb, "%s;UID=%s;PWD=%s", db, uid, pwd);
- } else {
- ldb_len = strlen(db)+1;
- ldb = (char*) emalloc(ldb_len);
- memcpy(ldb, db, ldb_len);
- }
- }
-
- if (direct)
- rc = SQLDriverConnect((*conn)->hdbc, NULL, ldb, strlen(ldb), dsnbuf, 300,
- &dsnbuflen, SQL_DRIVER_NOPROMPT);
- else
- rc = SQLConnect((*conn)->hdbc, db, SQL_NTS, uid, SQL_NTS, pwd, SQL_NTS);
- if (ldb)
- efree(ldb);
- }
-#else
- rc = SQLConnect((*conn)->hdbc, db, SQL_NTS, uid, SQL_NTS, pwd, SQL_NTS);
-#endif
-#endif
- if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) {
- odbc_sql_error(*conn, SQL_NULL_HSTMT, "SQLConnect");
- SQLFreeConnect((*conn)->hdbc);
- pefree((*conn), persistent);
- return FALSE;
- }
-/* (*conn)->open = 1;*/
- return TRUE;
-}
-/* Persistent connections: two list-types le_pconn, le_conn and a plist
- * where hashed connection info is stored together with index pointer to
- * the actual link of type le_pconn in the list. Only persistent
- * connections get hashed up. Normal connections use existing pconnections.
- * Maybe this has to change with regard to transactions on pconnections?
- * Possibly set autocommit to on on request shutdown.
- *
- * We do have to hash non-persistent connections, and reuse connections.
- * In the case where two connects were being made, without closing the first
- * connect, access violations were occuring. This is because some of the
- * "globals" in this module should actualy be per-connection variables. I
- * simply fixed things to get them working for now. Shane
- */
-void odbc_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
-{
- char *db = NULL;
- char *uid = NULL;
- char *pwd = NULL;
- pval **pv_db, **pv_uid, **pv_pwd, **pv_opt;
- odbc_connection *db_conn;
- char *hashed_details;
- int hashed_len, len, cur_opt;
- ODBCLS_FETCH();
- PLS_FETCH();
-
- /* Now an optional 4th parameter specifying the cursor type
- * defaulting to the cursors default
- */
- switch(ZEND_NUM_ARGS()) {
- case 3:
- if (zend_get_parameters_ex(3, &pv_db, &pv_uid, &pv_pwd) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- /* Use Default: Probably a better way to do this */
- cur_opt = SQL_CUR_DEFAULT;
- break;
- case 4:
- if (zend_get_parameters_ex(4, &pv_db, &pv_uid, &pv_pwd, &pv_opt) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(pv_opt);
- cur_opt = (*pv_opt)->value.lval;
-
- /* Confirm the cur_opt range */
- if (! (cur_opt == SQL_CUR_USE_IF_NEEDED ||
- cur_opt == SQL_CUR_USE_ODBC ||
- cur_opt == SQL_CUR_USE_DRIVER ||
- cur_opt == SQL_CUR_DEFAULT) ) {
- php_error(E_WARNING, "odbc: Invalid Cursor type (%d)", cur_opt);
- RETURN_FALSE;
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- convert_to_string_ex(pv_db);
- convert_to_string_ex(pv_uid);
- convert_to_string_ex(pv_pwd);
-
- db = (*pv_db)->value.str.val;
- uid = (*pv_uid)->value.str.val;
- pwd = (*pv_pwd)->value.str.val;
-
- if (ODBCG(allow_persistent) <= 0) {
- persistent = 0;
- }
-
- len = strlen(db) + strlen(uid) + strlen(pwd) + sizeof(ODBC_TYPE) + 5;
- hashed_details = emalloc(len);
-
- if (hashed_details == NULL) {
- php_error(E_WARNING, "Out of memory");
- RETURN_FALSE;
- }
-
- hashed_len = sprintf(hashed_details, "%s_%s_%s_%s_%d", ODBC_TYPE, db, uid, pwd, cur_opt);
-
- /* FIXME the idea of checking to see if our connection is already persistent
- is good, but it adds a lot of overhead to non-persistent connections. We
- should look and see if we can fix that somehow */
- /* try to find if we already have this link in our persistent list,
- * no matter if it is to be persistent or not
- */
-
-try_and_get_another_connection:
-
- if (persistent) {
- list_entry *le;
-
- if (zend_hash_find(&EG(persistent_list), hashed_details, hashed_len + 1, (void **) &le)
- == FAILURE) { /* the link is not in the persistent list */
- list_entry new_le;
-
- if (ODBCG(max_links) != -1 && ODBCG(num_links) >= ODBCG(max_links)) {
- php_error(E_WARNING, "odbc: Too many open links (%d)", ODBCG(num_links));
- efree(hashed_details);
- RETURN_FALSE;
- }
- if (ODBCG(max_persistent) != -1 && ODBCG(num_persistent) >= ODBCG(max_persistent)) {
- php_error(E_WARNING,"odbc: Too many open persistent links (%d)", ODBCG(num_persistent));
- efree(hashed_details);
- RETURN_FALSE;
- }
-
- if (!odbc_sqlconnect(&db_conn, db, uid, pwd, cur_opt, 1 ODBCLS_CC)) {
- efree(hashed_details);
- RETURN_FALSE;
- }
-
- new_le.type = le_pconn;
- new_le.ptr = db_conn;
- if (zend_hash_update(&EG(persistent_list), hashed_details, hashed_len + 1, &new_le,
- sizeof(list_entry), NULL) == FAILURE) {
- free(db_conn);
- efree(hashed_details);
- RETURN_FALSE;
- }
- ODBCG(num_persistent)++;
- ODBCG(num_links)++;
- db_conn->id = ZEND_REGISTER_RESOURCE(return_value, db_conn, le_pconn);
- } else { /* found connection */
- if (le->type != le_pconn) {
- RETURN_FALSE;
- }
- /*
- * check to see if the connection is still valid
- */
- db_conn = (odbc_connection *)le->ptr;
-
- /*
- * check to see if the connection is still in place (lurcher)
- */
- if(ODBCG(check_persistent)){
- RETCODE ret;
- UCHAR d_name[32];
- SWORD len;
-
- ret = SQLGetInfo(db_conn->hdbc,
- SQL_DATA_SOURCE_READ_ONLY,
- d_name, sizeof(d_name), &len);
-
- if(ret != SQL_SUCCESS || len == 0) {
- zend_hash_del(&EG(persistent_list), hashed_details, hashed_len + 1);
- safe_odbc_disconnect(db_conn->hdbc);
- SQLFreeConnect(db_conn->hdbc);
- goto try_and_get_another_connection;
- }
- }
- }
- db_conn->id = ZEND_REGISTER_RESOURCE(return_value, db_conn, le_pconn);
- } else { /* non persistent */
- list_entry *index_ptr, new_index_ptr;
-
- if (zend_hash_find(&EG(regular_list), hashed_details, hashed_len + 1,
- (void **) &index_ptr) == SUCCESS) {
- int type, conn_id;
- void *ptr;
- if (index_ptr->type != le_index_ptr) {
- RETURN_FALSE;
- }
- conn_id = (int)index_ptr->ptr;
- ptr = zend_list_find(conn_id, &type); /* check if the connection is still there */
- if (ptr && (type == le_conn || type == le_pconn)) {
- zend_list_addref(conn_id);
- return_value->value.lval = conn_id;
- return_value->type = IS_RESOURCE;
- efree(hashed_details);
- return;
- } else {
- zend_hash_del(&EG(regular_list), hashed_details, hashed_len + 1);
- }
- }
- if (ODBCG(max_links) != -1 && ODBCG(num_links) >= ODBCG(max_links)) {
- php_error(E_WARNING,"ODBC: Too many open connections (%d)",ODBCG(num_links));
- efree(hashed_details);
- RETURN_FALSE;
- }
-
- if (!odbc_sqlconnect(&db_conn, db, uid, pwd, cur_opt, 0 ODBCLS_CC)) {
- efree(hashed_details);
- RETURN_FALSE;
- }
- db_conn->id = ZEND_REGISTER_RESOURCE(return_value, db_conn, le_conn);
- new_index_ptr.ptr = (void *) return_value->value.lval;
- new_index_ptr.type = le_index_ptr;
- if (zend_hash_update(&EG(regular_list), hashed_details, hashed_len + 1, (void *) &new_index_ptr,
- sizeof(list_entry), NULL) == FAILURE) {
- efree(hashed_details);
- RETURN_FALSE;
- /* XXX Free Connection */
- }
- ODBCG(num_links)++;
- }
- efree(hashed_details);
-}
-
-/* {{{ proto void odbc_close(int connection_id)
- Close an ODBC connection */
-PHP_FUNCTION(odbc_close)
-{
- pval **pv_conn;
- void *ptr;
- odbc_connection *conn;
- odbc_result *res;
- int nument;
- int i;
- int type;
- int is_pconn = 0;
- int found_resource_type = le_conn;
- ODBCLS_FETCH();
-
- if (zend_get_parameters_ex(1, &pv_conn) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- conn = (odbc_connection *) zend_fetch_resource(pv_conn, -1, "ODBC-Link", &found_resource_type, 2, le_conn, le_pconn);
- if (found_resource_type==le_pconn) {
- is_pconn = 1;
- }
-
- nument = zend_hash_next_free_element(&EG(regular_list));
-
- for(i = 1; i < nument; i++){
- ptr = zend_list_find(i, &type);
- if(ptr && (type == le_result)){
- res = (odbc_result *)ptr;
- if(res->conn_ptr == conn){
- zend_list_delete(i);
- }
- }
- }
-
- zend_list_delete((*pv_conn)->value.lval);
-
- if(is_pconn){
- zend_hash_apply_with_argument(&EG(persistent_list),
- (int (*)(void *, void *)) _close_pconn_with_id, (void *) &((*pv_conn)->value.lval));
- }
-}
-/* }}} */
-
-/* {{{ proto int odbc_num_rows(int result_id)
- Get number of rows in a result */
-PHP_FUNCTION(odbc_num_rows)
-{
- odbc_result *result;
- SDWORD rows;
- pval **pv_res;
-
- if (zend_get_parameters_ex(1, &pv_res) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(result, odbc_result *, pv_res, -1, "ODBC result", le_result);
- SQLRowCount(result->stmt, &rows);
- RETURN_LONG(rows);
-}
-/* }}} */
-
-#if !defined(HAVE_SOLID) && !defined(HAVE_SOLID_30)
-/* {{{ proto bool odbc_next_result(int result_id)
- Checks if multiple results are avaiable */
-PHP_FUNCTION(odbc_next_result)
-{
- odbc_result *result;
- pval **pv_res;
- int rc, i;
-
- if (zend_get_parameters_ex(1, &pv_res) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- ZEND_FETCH_RESOURCE(result, odbc_result *, pv_res, -1, "ODBC result", le_result);
-
- if (result->values) {
- for(i = 0; i < result->numcols; i++) {
- if (result->values[i].value)
- efree(result->values[i].value);
- }
- efree(result->values);
- result->values = NULL;
- }
-
- result->fetched = 0;
- rc = SQLMoreResults(result->stmt);
- if (rc == SQL_SUCCESS) {
- RETURN_TRUE;
- }
- else if (rc == SQL_SUCCESS_WITH_INFO) {
- rc = SQLFreeStmt(result->stmt, SQL_UNBIND);
- SQLNumParams(result->stmt, &(result->numparams));
- SQLNumResultCols(result->stmt, &(result->numcols));
-
- if (result->numcols > 0) {
- if (!odbc_bindcols(result)) {
- efree(result);
- RETVAL_FALSE;
- }
- } else {
- result->values = NULL;
- }
- RETURN_TRUE;
- }
- else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-#endif
-
-/* {{{ proto int odbc_num_fields(int result_id)
- Get number of columns in a result */
-PHP_FUNCTION(odbc_num_fields)
-{
- odbc_result *result;
- pval **pv_res;
-
- if (zend_get_parameters_ex(1, &pv_res) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- ZEND_FETCH_RESOURCE(result, odbc_result *, pv_res, -1, "ODBC result", le_result);
- RETURN_LONG(result->numcols);
-}
-/* }}} */
-
-/* {{{ proto string odbc_field_name(int result_id, int field_number)
- Get a column name */
-PHP_FUNCTION(odbc_field_name)
-{
- odbc_result *result;
- pval **pv_res, **pv_num;
-
- if (zend_get_parameters_ex(2, &pv_res, &pv_num) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(pv_num);
-
- ZEND_FETCH_RESOURCE(result, odbc_result *, pv_res, -1, "ODBC result", le_result);
-
- if (result->numcols == 0) {
- php_error(E_WARNING, "No tuples available at this result index");
- RETURN_FALSE;
- }
-
- if ((*pv_num)->value.lval > result->numcols) {
- php_error(E_WARNING, "Field index larger than number of fields");
- RETURN_FALSE;
- }
-
- if ((*pv_num)->value.lval < 1) {
- php_error(E_WARNING, "Field numbering starts at 1");
- RETURN_FALSE;
- }
-
- RETURN_STRING(result->values[(*pv_num)->value.lval - 1].name, 1)
-}
-/* }}} */
-
-/* {{{ proto string odbc_field_type(int result_id, int field_number)
- Get the datatype of a column */
-PHP_FUNCTION(odbc_field_type)
-{
- odbc_result *result;
- char tmp[32];
- SWORD tmplen;
- pval **pv_res, **pv_num;
-
- if (zend_get_parameters_ex(2, &pv_res, &pv_num) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(pv_num);
-
- ZEND_FETCH_RESOURCE(result, odbc_result *, pv_res, -1, "ODBC result", le_result);
-
- if (result->numcols == 0) {
- php_error(E_WARNING, "No tuples available at this result index");
- RETURN_FALSE;
- }
-
- if ((*pv_num)->value.lval > result->numcols) {
- php_error(E_WARNING, "Field index larger than number of fields");
- RETURN_FALSE;
- }
-
- if ((*pv_num)->value.lval < 1) {
- php_error(E_WARNING, "Field numbering starts at 1");
- RETURN_FALSE;
- }
-
- SQLColAttributes(result->stmt, (UWORD)(*pv_num)->value.lval,
- SQL_COLUMN_TYPE_NAME, tmp, 31, &tmplen, NULL);
- RETURN_STRING(tmp,1)
-}
-/* }}} */
-
-/* {{{ proto int odbc_field_len(int result_id, int field_number)
- Get the length (precision) of a column */
-PHP_FUNCTION(odbc_field_len)
-{
- odbc_column_lengths(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-/* }}} */
-
-/* {{{ proto int odbc_field_scale(int result_id, int field_number)
- Get the scale of a column */
-PHP_FUNCTION(odbc_field_scale)
-{
- odbc_column_lengths(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
-}
-/* }}} */
-
-/* {{{ proto int odbc_field_num(int result_id, string field_name)
- Return column number */
-PHP_FUNCTION(odbc_field_num)
-{
- int field_ind;
- char *fname;
- odbc_result *result;
- int i;
- pval **pv_res, **pv_name;
-
- if (zend_get_parameters_ex(2, &pv_res, &pv_name) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(result, odbc_result *, pv_res, -1, "ODBC result", le_result);
-
- if (result->numcols == 0) {
- php_error(E_WARNING, "No tuples available at this result index");
- RETURN_FALSE;
- }
-
- convert_to_string_ex(pv_name);
- fname = (*pv_name)->value.str.val;
-
- field_ind = -1;
- for(i = 0; i < result->numcols; i++) {
- if (strcasecmp(result->values[i].name, fname) == 0)
- field_ind = i + 1;
- }
-
- if (field_ind == -1)
- RETURN_FALSE;
- RETURN_LONG(field_ind);
-}
-/* }}} */
-
-/* {{{ proto int odbc_autocommit(int connection_id [, int OnOff])
- Toggle autocommit mode or get status */
-/* There can be problems with pconnections!*/
-PHP_FUNCTION(odbc_autocommit)
-{
- odbc_connection *conn;
- RETCODE rc;
- pval **pv_conn, **pv_onoff = NULL;
- int argc;
-
- argc = ZEND_NUM_ARGS();
- if (argc == 2) {
- if (zend_get_parameters_ex(2, &pv_conn, &pv_onoff) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- } else if (argc == 1) {
- if (zend_get_parameters_ex(1, &pv_conn) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- } else {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE2(conn, odbc_connection *, pv_conn, -1, "ODBC-Link", le_conn, le_pconn);
-
- if (pv_onoff && (*pv_onoff)) {
- convert_to_long_ex(pv_onoff);
- rc = SQLSetConnectOption(conn->hdbc, SQL_AUTOCOMMIT,
- ((*pv_onoff)->value.lval) ?
- SQL_AUTOCOMMIT_ON : SQL_AUTOCOMMIT_OFF);
- if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) {
- odbc_sql_error(conn, SQL_NULL_HSTMT, "Set autocommit");
- RETURN_FALSE;
- }
- RETVAL_TRUE;
- } else {
- SDWORD status;
-
- rc = SQLGetConnectOption(conn->hdbc, SQL_AUTOCOMMIT, (PTR)&status);
- if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) {
- odbc_sql_error(conn, SQL_NULL_HSTMT, "Get commit status");
- RETURN_FALSE;
- }
- RETVAL_LONG((long)status);
- }
-}
-/* }}} */
-
-/* {{{ proto int odbc_commit(int connection_id)
- Commit an ODBC transaction */
-PHP_FUNCTION(odbc_commit)
-{
- odbc_transact(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
-}
-/* }}} */
-
-/* {{{ proto int odbc_rollback(int connection_id)
- Rollback a transaction */
-PHP_FUNCTION(odbc_rollback)
-{
- odbc_transact(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-/* }}} */
-
-static void php_odbc_lasterror(INTERNAL_FUNCTION_PARAMETERS, int mode)
-{
- odbc_connection *conn;
- pval **pv_handle;
- char *ptr;
- int argc, len;
-
- argc = ZEND_NUM_ARGS();
-
- if (argc > 1 || zend_get_parameters_ex(argc, &pv_handle)) {
- WRONG_PARAM_COUNT;
- }
-
- if (mode == 0) { /* last state */
- len = 6;
- } else { /* last error message */
- len = SQL_MAX_MESSAGE_LENGTH;
- }
- ptr = ecalloc(len + 1, 1);
- if (argc == 1) {
- ZEND_FETCH_RESOURCE2(conn, odbc_connection *, pv_handle, -1, "ODBC-Link", le_conn, le_pconn);
- if (mode == 0) {
- strlcpy(ptr, conn->laststate, len+1);
- } else {
- strlcpy(ptr, conn->lasterrormsg, len+1);
- }
- } else {
- ODBCLS_FETCH();
-
- if (mode == 0) {
- strlcpy(ptr, ODBCG(laststate), len+1);
- } else {
- strlcpy(ptr, ODBCG(lasterrormsg), len+1);
- }
- }
- RETVAL_STRING(ptr, 0);
-}
-
-/* {{{ proto string odbc_error([int connection_id])
- Get the last error code */
-PHP_FUNCTION(odbc_error)
-{
- php_odbc_lasterror(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-/* }}} */
-
-/* {{{ proto string odbc_errormsg([int connection_id])
- Get the last error message */
-PHP_FUNCTION(odbc_errormsg)
-{
- php_odbc_lasterror(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
-}
-/* }}} */
-
-/* {{{ proto int odbc_setoption(int conn_id|result_id, int which, int option, int value)
- Sets connection or statement options */
-/* This one has to be used carefully. We can't allow to set connection options for
- persistent connections. I think that SetStmtOption is of little use, since most
- of those can only be specified before preparing/executing statements.
- On the other hand, they can be made connection wide default through SetConnectOption
- - but will be overidden by calls to SetStmtOption() in odbc_prepare/odbc_do
-*/
-PHP_FUNCTION(odbc_setoption)
-{
- odbc_connection *conn;
- odbc_result *result;
- RETCODE rc;
- pval **pv_handle, **pv_which, **pv_opt, **pv_val;
-
- if ( zend_get_parameters_ex(4, &pv_handle, &pv_which, &pv_opt, &pv_val) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(pv_which);
- convert_to_long_ex(pv_opt);
- convert_to_long_ex(pv_val);
-
- switch ((*pv_which)->value.lval) {
- case 1: /* SQLSetConnectOption */
- ZEND_FETCH_RESOURCE2(conn, odbc_connection *, pv_handle, -1, "ODBC-Link", le_conn, le_pconn);
- if (conn->persistent) {
- php_error(E_WARNING, "Can't set option for persistent connection");
- RETURN_FALSE;
- }
- rc = SQLSetConnectOption(conn->hdbc, (unsigned short)((*pv_opt)->value.lval), (*pv_val)->value.lval);
- if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) {
- odbc_sql_error(conn, SQL_NULL_HSTMT, "SetConnectOption");
- RETURN_FALSE;
- }
- break;
- case 2: /* SQLSetStmtOption */
- ZEND_FETCH_RESOURCE(result, odbc_result *, pv_handle, -1, "ODBC result", le_result);
-
- rc = SQLSetStmtOption(result->stmt, (unsigned short)((*pv_opt)->value.lval), ((*pv_val)->value.lval));
-
- if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) {
- odbc_sql_error(result->conn_ptr, result->stmt, "SetStmtOption");
- RETURN_FALSE;
- }
- break;
- default:
- php_error(E_WARNING, "Unknown option type");
- RETURN_FALSE;
- break;
- }
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/*
- * metadata functions
- */
-
-/* {{{ proto int odbc_tables(int connection_id [, string qualifier, string owner, string name, string table_types])
- Call the SQLTables function */
-PHP_FUNCTION(odbc_tables)
-{
- pval **pv_conn, **pv_cat, **pv_schema, **pv_table, **pv_type;
- odbc_result *result = NULL;
- odbc_connection *conn;
- char *cat = NULL, *schema = NULL, *table = NULL, *type = NULL;
- RETCODE rc;
- int argc;
-
- argc = ZEND_NUM_ARGS();
- if (argc < 1 || argc > 5 || zend_get_parameters_ex(argc, &pv_conn, &pv_cat, &pv_schema, &pv_table, &pv_type) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- switch (argc) {
- case 5:
- convert_to_string_ex(pv_type);
- type = (*pv_type)->value.str.val;
- case 4:
- convert_to_string_ex(pv_table);
- table = (*pv_table)->value.str.val;
- case 3:
- convert_to_string_ex(pv_schema);
- schema = (*pv_schema)->value.str.val;
- case 2:
- convert_to_string_ex(pv_cat);
- cat = (*pv_cat)->value.str.val;
- }
-
- ZEND_FETCH_RESOURCE2(conn, odbc_connection *, pv_conn, -1, "ODBC-Link", le_conn, le_pconn);
-
- result = (odbc_result *)emalloc(sizeof(odbc_result));
- if (result == NULL) {
- php_error(E_WARNING, "Out of memory");
- RETURN_FALSE;
- }
-
- rc = SQLAllocStmt(conn->hdbc, &(result->stmt));
- if (rc == SQL_INVALID_HANDLE) {
- efree(result);
- php_error(E_WARNING, "SQLAllocStmt error 'Invalid Handle' in odbc_tables");
- RETURN_FALSE;
- }
-
- if (rc == SQL_ERROR) {
- odbc_sql_error(conn, SQL_NULL_HSTMT, "SQLAllocStmt");
- efree(result);
- RETURN_FALSE;
- }
-
- /* This hack is needed to access table information in Access databases (fmk) */
- if (table && strlen(table) && schema && !strlen(schema)) schema = NULL;
-
- rc = SQLTables(result->stmt,
- cat, SAFE_SQL_NTS(cat),
- schema, SAFE_SQL_NTS(schema),
- table, SAFE_SQL_NTS(table),
- type, SAFE_SQL_NTS(type));
-
- if (rc == SQL_ERROR) {
- odbc_sql_error(conn, SQL_NULL_HSTMT, "SQLTables");
- efree(result);
- RETURN_FALSE;
- }
-
- result->numparams = 0;
- SQLNumResultCols(result->stmt, &(result->numcols));
-
- if (result->numcols > 0) {
- if (!odbc_bindcols(result)) {
- efree(result);
- RETURN_FALSE;
- }
- } else {
- result->values = NULL;
- }
- result->conn_ptr = conn;
- result->fetched = 0;
- ZEND_REGISTER_RESOURCE(return_value, result, le_result);
-}
-/* }}} */
-
-/* {{{ proto int odbc_columns(int connection_id, string qualifier, string owner, string table_name, string column_name)
- Returns a result identifier that can be used to fetch a list of column names in specified tables */
-PHP_FUNCTION(odbc_columns)
-{
- pval **pv_conn, **pv_cat, **pv_schema, **pv_table, **pv_column;
- odbc_result *result = NULL;
- odbc_connection *conn;
- char *cat = NULL, *schema = NULL, *table = NULL, *column = NULL;
- RETCODE rc;
- int argc;
-
- argc = ZEND_NUM_ARGS();
- if (argc < 1 || argc > 5 || zend_get_parameters_ex(argc, &pv_conn, &pv_cat, &pv_schema, &pv_table, &pv_column) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- switch (argc) {
- case 5:
- convert_to_string_ex(pv_column);
- column = (*pv_column)->value.str.val;
- case 4:
- convert_to_string_ex(pv_table);
- table = (*pv_table)->value.str.val;
- case 3:
- convert_to_string_ex(pv_schema);
- schema = (*pv_schema)->value.str.val;
- case 2:
- convert_to_string_ex(pv_cat);
- cat = (*pv_cat)->value.str.val;
- }
-
- ZEND_FETCH_RESOURCE2(conn, odbc_connection *, pv_conn, -1, "ODBC-Link", le_conn, le_pconn);
-
- result = (odbc_result *)emalloc(sizeof(odbc_result));
- if (result == NULL) {
- php_error(E_WARNING, "Out of memory");
- RETURN_FALSE;
- }
-
- rc = SQLAllocStmt(conn->hdbc, &(result->stmt));
- if (rc == SQL_INVALID_HANDLE) {
- efree(result);
- php_error(E_WARNING, "SQLAllocStmt error 'Invalid Handle' in odbc_columns");
- RETURN_FALSE;
- }
-
- if (rc == SQL_ERROR) {
- odbc_sql_error(conn, SQL_NULL_HSTMT, "SQLAllocStmt");
- efree(result);
- RETURN_FALSE;
- }
-
- rc = SQLColumns(result->stmt,
- cat, SAFE_SQL_NTS(cat),
- schema, SAFE_SQL_NTS(schema),
- table, SAFE_SQL_NTS(table),
- column, SAFE_SQL_NTS(column));
-
- if (rc == SQL_ERROR) {
- odbc_sql_error(conn, SQL_NULL_HSTMT, "SQLColumns");
- efree(result);
- RETURN_FALSE;
- }
-
- result->numparams = 0;
- SQLNumResultCols(result->stmt, &(result->numcols));
-
- if (result->numcols > 0) {
- if (!odbc_bindcols(result)) {
- efree(result);
- RETURN_FALSE;
- }
- } else {
- result->values = NULL;
- }
- result->conn_ptr = conn;
- result->fetched = 0;
- ZEND_REGISTER_RESOURCE(return_value, result, le_result);
-}
-/* }}} */
-
-#if !defined(HAVE_DBMAKER) && !defined(HAVE_SOLID) && !defined(HAVE_SOLID_30) && !defined(HAVE_SOLID_35) && !defined(HAVE_VELOCIS)
-/* {{{ proto int odbc_columnprivileges(int connection_id, string catalog, string schema, string table, string column)
- Returns a result identifier that can be used to fetch a list of columns and associated privileges for the specified table */
-PHP_FUNCTION(odbc_columnprivileges)
-{
- pval **pv_conn, **pv_cat, **pv_schema, **pv_table, **pv_column;
- odbc_result *result = NULL;
- odbc_connection *conn;
- char *cat = NULL, *schema = NULL, *table = NULL, *column = NULL;
- RETCODE rc;
- int argc;
-
- argc = ZEND_NUM_ARGS();
- if (argc == 5) {
- if (zend_get_parameters_ex(5, &pv_conn, &pv_cat, &pv_schema, &pv_table, &pv_column) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(pv_cat);
- cat = (*pv_cat)->value.str.val;
- convert_to_string_ex(pv_schema);
- schema = (*pv_schema)->value.str.val;
- convert_to_string_ex(pv_table);
- table = (*pv_table)->value.str.val;
- convert_to_string_ex(pv_column);
- column = (*pv_column)->value.str.val;
- } else {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE2(conn, odbc_connection *, pv_conn, -1, "ODBC-Link", le_conn, le_pconn);
-
- result = (odbc_result *)emalloc(sizeof(odbc_result));
- if (result == NULL) {
- php_error(E_WARNING, "Out of memory");
- RETURN_FALSE;
- }
-
- rc = SQLAllocStmt(conn->hdbc, &(result->stmt));
- if (rc == SQL_INVALID_HANDLE) {
- efree(result);
- php_error(E_WARNING, "SQLAllocStmt error 'Invalid Handle' in odbc_columnprivileges");
- RETURN_FALSE;
- }
-
- if (rc == SQL_ERROR) {
- odbc_sql_error(conn, SQL_NULL_HSTMT, "SQLAllocStmt");
- efree(result);
- RETURN_FALSE;
- }
-
- rc = SQLColumnPrivileges(result->stmt,
- cat, SAFE_SQL_NTS(cat),
- schema, SAFE_SQL_NTS(schema),
- table, SAFE_SQL_NTS(table),
- column, SAFE_SQL_NTS(column));
-
- if (rc == SQL_ERROR) {
- odbc_sql_error(conn, SQL_NULL_HSTMT, "SQLColumnPrivileges");
- efree(result);
- RETURN_FALSE;
- }
-
- result->numparams = 0;
- SQLNumResultCols(result->stmt, &(result->numcols));
-
- if (result->numcols > 0) {
- if (!odbc_bindcols(result)) {
- efree(result);
- RETURN_FALSE;
- }
- } else {
- result->values = NULL;
- }
- result->conn_ptr = conn;
- result->fetched = 0;
- ZEND_REGISTER_RESOURCE(return_value, result, le_result);
-}
-/* }}} */
-#endif /* HAVE_DBMAKER || HAVE_SOLID*/
-
-#if !defined(HAVE_SOLID) && !defined(HAVE_SOLID_30) && !defined(HAVE_SOLID_35)
-/* {{{ proto int odbc_foreignkeys(int connection_id, string pk_qualifier, string pk_owner, string pk_table, string fk_qualifier, string fk_owner, string fk_table)
- Returns a result identifier to either a list of foreign keys in the specified table or a list of foreign keys in other tables that refer to the primary key in the specified table */
-PHP_FUNCTION(odbc_foreignkeys)
-{
- pval **pv_conn, **pv_pcat, **pv_pschema, **pv_ptable;
- pval **pv_fcat, **pv_fschema, **pv_ftable;
- odbc_result *result = NULL;
- odbc_connection *conn;
- char *pcat = NULL, *pschema = NULL, *ptable = NULL;
- char *fcat = NULL, *fschema = NULL, *ftable = NULL;
- RETCODE rc;
- int argc;
-
- argc = ZEND_NUM_ARGS();
- if (argc == 7) {
- if (zend_get_parameters_ex(7, &pv_conn, &pv_pcat, &pv_pschema, &pv_ptable,
- &pv_fcat, &pv_fschema, &pv_ftable) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(pv_pcat);
- pcat = (*pv_pcat)->value.str.val;
- convert_to_string_ex(pv_pschema);
- pschema = (*pv_pschema)->value.str.val;
- convert_to_string_ex(pv_ptable);
- ptable = (*pv_ptable)->value.str.val;
- convert_to_string_ex(pv_fcat);
- fcat = (*pv_fcat)->value.str.val;
- convert_to_string_ex(pv_fschema);
- fschema = (*pv_fschema)->value.str.val;
- convert_to_string_ex(pv_ftable);
- ftable = (*pv_ftable)->value.str.val;
-#ifdef HAVE_DBMAKER
-#define EMPTY_TO_NULL(xstr) \
- if ((int)strlen((xstr)) == 0) (xstr) = NULL
-
- EMPTY_TO_NULL(pcat);
- EMPTY_TO_NULL(pschema);
- EMPTY_TO_NULL(ptable);
- EMPTY_TO_NULL(fcat);
- EMPTY_TO_NULL(fschema);
- EMPTY_TO_NULL(ftable);
-#endif
- } else {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE2(conn, odbc_connection *, pv_conn, -1, "ODBC-Link", le_conn, le_pconn);
-
- result = (odbc_result *)emalloc(sizeof(odbc_result));
- if (result == NULL) {
- php_error(E_WARNING, "Out of memory");
- RETURN_FALSE;
- }
-
- rc = SQLAllocStmt(conn->hdbc, &(result->stmt));
- if (rc == SQL_INVALID_HANDLE) {
- efree(result);
- php_error(E_WARNING, "SQLAllocStmt error 'Invalid Handle' in odbc_foreignkeys");
- RETURN_FALSE;
- }
-
- if (rc == SQL_ERROR) {
- odbc_sql_error(conn, SQL_NULL_HSTMT, "SQLAllocStmt");
- efree(result);
- RETURN_FALSE;
- }
-
- rc = SQLForeignKeys(result->stmt,
- pcat, SAFE_SQL_NTS(pcat),
- pschema, SAFE_SQL_NTS(pschema),
- ptable, SAFE_SQL_NTS(ptable),
- fcat, SAFE_SQL_NTS(fcat),
- fschema, SAFE_SQL_NTS(fschema),
- ftable, SAFE_SQL_NTS(ftable) );
-
- if (rc == SQL_ERROR) {
- odbc_sql_error(conn, SQL_NULL_HSTMT, "SQLForeignKeys");
- efree(result);
- RETURN_FALSE;
- }
-
- result->numparams = 0;
- SQLNumResultCols(result->stmt, &(result->numcols));
-
- if (result->numcols > 0) {
- if (!odbc_bindcols(result)) {
- efree(result);
- RETURN_FALSE;
- }
- } else {
- result->values = NULL;
- }
- result->conn_ptr = conn;
- result->fetched = 0;
- ZEND_REGISTER_RESOURCE(return_value, result, le_result);
-}
-/* }}} */
-#endif /* HAVE_SOLID */
-
-/* {{{ proto int odbc_gettypeinfo(int connection_id [, int data_type])
- Returns a result identifier containing information about data types supported by the data source */
-PHP_FUNCTION(odbc_gettypeinfo)
-{
- pval **pv_conn, **pv_data_type;
- odbc_result *result = NULL;
- odbc_connection *conn;
- RETCODE rc;
- int argc;
- SWORD data_type = SQL_ALL_TYPES;
-
- argc = ZEND_NUM_ARGS();
- if (argc == 1) {
- if (zend_get_parameters_ex(1, &pv_conn) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- } else if (argc == 2) {
- if (zend_get_parameters_ex(2, &pv_conn, &pv_data_type) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(pv_data_type);
- data_type = (SWORD) (*pv_data_type)->value.lval;
- } else {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE2(conn, odbc_connection *, pv_conn, -1, "ODBC-Link", le_conn, le_pconn);
-
- result = (odbc_result *)emalloc(sizeof(odbc_result));
- if (result == NULL) {
- php_error(E_WARNING, "Out of memory");
- RETURN_FALSE;
- }
-
- rc = SQLAllocStmt(conn->hdbc, &(result->stmt));
- if (rc == SQL_INVALID_HANDLE) {
- efree(result);
- php_error(E_WARNING, "SQLAllocStmt error 'Invalid Handle' in odbc_gettypeinfo");
- RETURN_FALSE;
- }
-
- if (rc == SQL_ERROR) {
- odbc_sql_error(conn, SQL_NULL_HSTMT, "SQLAllocStmt");
- efree(result);
- RETURN_FALSE;
- }
-
- rc = SQLGetTypeInfo(result->stmt, data_type );
-
- if (rc == SQL_ERROR) {
- odbc_sql_error(conn, SQL_NULL_HSTMT, "SQLGetTypeInfo");
- efree(result);
- RETURN_FALSE;
- }
-
- result->numparams = 0;
- SQLNumResultCols(result->stmt, &(result->numcols));
-
- if (result->numcols > 0) {
- if (!odbc_bindcols(result)) {
- efree(result);
- RETURN_FALSE;
- }
- } else {
- result->values = NULL;
- }
- result->conn_ptr = conn;
- result->fetched = 0;
- ZEND_REGISTER_RESOURCE(return_value, result, le_result);
-}
-/* }}} */
-
-/* {{{ proto int odbc_primarykeys(int connection_id, string qualifier, string owner, string table)
- Returns a result identifier listing the column names that comprise the primary key for a table */
-PHP_FUNCTION(odbc_primarykeys)
-{
- pval **pv_conn, **pv_cat, **pv_schema, **pv_table;
- odbc_result *result = NULL;
- odbc_connection *conn;
- char *cat = NULL, *schema = NULL, *table = NULL;
- RETCODE rc;
- int argc;
-
- argc = ZEND_NUM_ARGS();
- if (argc == 4) {
- if (zend_get_parameters_ex(4, &pv_conn, &pv_cat, &pv_schema, &pv_table) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(pv_cat);
- cat = (*pv_cat)->value.str.val;
- convert_to_string_ex(pv_schema);
- schema = (*pv_schema)->value.str.val;
- convert_to_string_ex(pv_table);
- table = (*pv_table)->value.str.val;
- } else {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE2(conn, odbc_connection *, pv_conn, -1, "ODBC-Link", le_conn, le_pconn);
-
- result = (odbc_result *)emalloc(sizeof(odbc_result));
- if (result == NULL) {
- php_error(E_WARNING, "Out of memory");
- RETURN_FALSE;
- }
-
- rc = SQLAllocStmt(conn->hdbc, &(result->stmt));
- if (rc == SQL_INVALID_HANDLE) {
- efree(result);
- php_error(E_WARNING, "SQLAllocStmt error 'Invalid Handle' in odbc_primarykeys");
- RETURN_FALSE;
- }
-
- if (rc == SQL_ERROR) {
- odbc_sql_error(conn, SQL_NULL_HSTMT, "SQLAllocStmt");
- efree(result);
- RETURN_FALSE;
- }
-
- rc = SQLPrimaryKeys(result->stmt,
- cat, SAFE_SQL_NTS(cat),
- schema, SAFE_SQL_NTS(schema),
- table, SAFE_SQL_NTS(table) );
-
- if (rc == SQL_ERROR) {
- odbc_sql_error(conn, SQL_NULL_HSTMT, "SQLPrimaryKeys");
- efree(result);
- RETURN_FALSE;
- }
-
- result->numparams = 0;
- SQLNumResultCols(result->stmt, &(result->numcols));
-
- if (result->numcols > 0) {
- if (!odbc_bindcols(result)) {
- efree(result);
- RETURN_FALSE;
- }
- } else {
- result->values = NULL;
- }
- result->conn_ptr = conn;
- result->fetched = 0;
- ZEND_REGISTER_RESOURCE(return_value, result, le_result);
-}
-/* }}} */
-
-#if !defined(HAVE_SOLID) && !defined(HAVE_SOLID_30) && !defined(HAVE_SOLID_35) && !defined(HAVE_VELOCIS)
-/* {{{ proto int odbc_procedurecolumns(int connection_id [, string qualifier, string owner, string proc, string column])
- Returns a result identifier containing the list of input and output parameters, as well as the columns that make up the result set for the specified procedures */
-PHP_FUNCTION(odbc_procedurecolumns)
-{
- pval **pv_conn, **pv_cat, **pv_schema, **pv_proc, **pv_col;
- odbc_result *result = NULL;
- odbc_connection *conn;
- char *cat = NULL, *schema = NULL, *proc = NULL, *col = NULL;
- RETCODE rc;
- int argc;
-
- argc = ZEND_NUM_ARGS();
- if (argc == 1) {
- if (zend_get_parameters_ex(1, &pv_conn) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- } else if (argc == 5) {
- if (zend_get_parameters_ex(5, &pv_conn, &pv_cat, &pv_schema, &pv_proc, &pv_col) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(pv_cat);
- cat = (*pv_cat)->value.str.val;
- convert_to_string_ex(pv_schema);
- schema = (*pv_schema)->value.str.val;
- convert_to_string_ex(pv_proc);
- proc = (*pv_proc)->value.str.val;
- convert_to_string_ex(pv_col);
- col = (*pv_col)->value.str.val;
- } else {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE2(conn, odbc_connection *, pv_conn, -1, "ODBC-Link", le_conn, le_pconn);
-
- result = (odbc_result *)emalloc(sizeof(odbc_result));
- if (result == NULL) {
- php_error(E_WARNING, "Out of memory");
- RETURN_FALSE;
- }
-
- rc = SQLAllocStmt(conn->hdbc, &(result->stmt));
- if (rc == SQL_INVALID_HANDLE) {
- efree(result);
- php_error(E_WARNING, "SQLAllocStmt error 'Invalid Handle' in odbc_procedurecolumns");
- RETURN_FALSE;
- }
-
- if (rc == SQL_ERROR) {
- odbc_sql_error(conn, SQL_NULL_HSTMT, "SQLAllocStmt");
- efree(result);
- RETURN_FALSE;
- }
-
- rc = SQLProcedureColumns(result->stmt,
- cat, SAFE_SQL_NTS(cat),
- schema, SAFE_SQL_NTS(schema),
- proc, SAFE_SQL_NTS(proc),
- col, SAFE_SQL_NTS(col) );
-
- if (rc == SQL_ERROR) {
- odbc_sql_error(conn, SQL_NULL_HSTMT, "SQLProcedureColumns");
- efree(result);
- RETURN_FALSE;
- }
-
- result->numparams = 0;
- SQLNumResultCols(result->stmt, &(result->numcols));
-
- if (result->numcols > 0) {
- if (!odbc_bindcols(result)) {
- efree(result);
- RETURN_FALSE;
- }
- } else {
- result->values = NULL;
- }
- result->conn_ptr = conn;
- result->fetched = 0;
- ZEND_REGISTER_RESOURCE(return_value, result, le_result);
-}
-/* }}} */
-#endif /* HAVE_SOLID */
-
-#if !defined(HAVE_SOLID) && !defined(HAVE_SOLID_30) && !defined(HAVE_SOLID_35)
-/* {{{ proto int odbc_procedures(int connection_id [, string qualifier, string owner, string name])
- Returns a result identifier containg the list of procedure names in a datasource */
-PHP_FUNCTION(odbc_procedures)
-{
- pval **pv_conn, **pv_cat, **pv_schema, **pv_proc;
- odbc_result *result = NULL;
- odbc_connection *conn;
- char *cat = NULL, *schema = NULL, *proc = NULL;
- RETCODE rc;
- int argc;
-
- argc = ZEND_NUM_ARGS();
- if (argc == 1) {
- if (zend_get_parameters_ex(1, &pv_conn) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- } else if (argc == 4) {
- if (zend_get_parameters_ex(4, &pv_conn, &pv_cat, &pv_schema, &pv_proc) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(pv_cat);
- cat = (*pv_cat)->value.str.val;
- convert_to_string_ex(pv_schema);
- schema = (*pv_schema)->value.str.val;
- convert_to_string_ex(pv_proc);
- proc = (*pv_proc)->value.str.val;
- } else {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE2(conn, odbc_connection *, pv_conn, -1, "ODBC-Link", le_conn, le_pconn);
-
- result = (odbc_result *)emalloc(sizeof(odbc_result));
- if (result == NULL) {
- php_error(E_WARNING, "Out of memory");
- RETURN_FALSE;
- }
-
- rc = SQLAllocStmt(conn->hdbc, &(result->stmt));
- if (rc == SQL_INVALID_HANDLE) {
- efree(result);
- php_error(E_WARNING, "SQLAllocStmt error 'Invalid Handle' in odbc_procedures");
- RETURN_FALSE;
- }
-
- if (rc == SQL_ERROR) {
- odbc_sql_error(conn, SQL_NULL_HSTMT, "SQLAllocStmt");
- efree(result);
- RETURN_FALSE;
- }
-
- rc = SQLProcedures(result->stmt,
- cat, SAFE_SQL_NTS(cat),
- schema, SAFE_SQL_NTS(schema),
- proc, SAFE_SQL_NTS(proc) );
-
- if (rc == SQL_ERROR) {
- odbc_sql_error(conn, SQL_NULL_HSTMT, "SQLProcedures");
- efree(result);
- RETURN_FALSE;
- }
-
- result->numparams = 0;
- SQLNumResultCols(result->stmt, &(result->numcols));
-
- if (result->numcols > 0) {
- if (!odbc_bindcols(result)) {
- efree(result);
- RETURN_FALSE;
- }
- } else {
- result->values = NULL;
- }
- result->conn_ptr = conn;
- result->fetched = 0;
- ZEND_REGISTER_RESOURCE(return_value, result, le_result);
-}
-/* }}} */
-#endif /* HAVE_SOLID */
-
-/* {{{ proto int odbc_specialcolumns(int connection_id, int type, string qualifier, string owner, string table, int scope, int nullable)
- Returns a result identifier containing either the optimal set of columns that uniquely identifies a row in the table or columns that are automatically updated when any value in the row is updated by a transaction */
-PHP_FUNCTION(odbc_specialcolumns)
-{
- pval **pv_conn, **pv_type, **pv_cat, **pv_schema, **pv_name;
- pval **pv_scope, **pv_nullable;
- odbc_result *result = NULL;
- odbc_connection *conn;
- char *cat = NULL, *schema = NULL, *name = NULL;
- UWORD type;
- UWORD scope, nullable;
- RETCODE rc;
- int argc;
-
- argc = ZEND_NUM_ARGS();
- if (argc == 7) {
- if (zend_get_parameters_ex(7, &pv_conn, &pv_type, &pv_cat, &pv_schema,
- &pv_name, &pv_scope, &pv_nullable) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(pv_type);
- type = (UWORD) (*pv_type)->value.lval;
- convert_to_string_ex(pv_cat);
- cat = (*pv_cat)->value.str.val;
- convert_to_string_ex(pv_schema);
- schema = (*pv_schema)->value.str.val;
- convert_to_string_ex(pv_name);
- name = (*pv_name)->value.str.val;
- convert_to_long_ex(pv_scope);
- scope = (UWORD) (*pv_scope)->value.lval;
- convert_to_long_ex(pv_nullable);
- nullable = (UWORD) (*pv_nullable)->value.lval;
- } else {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE2(conn, odbc_connection *, pv_conn, -1, "ODBC-Link", le_conn, le_pconn);
-
- result = (odbc_result *)emalloc(sizeof(odbc_result));
- if (result == NULL) {
- php_error(E_WARNING, "Out of memory");
- RETURN_FALSE;
- }
-
- rc = SQLAllocStmt(conn->hdbc, &(result->stmt));
- if (rc == SQL_INVALID_HANDLE) {
- efree(result);
- php_error(E_WARNING, "SQLAllocStmt error 'Invalid Handle' in odbc_specialcolumns");
- RETURN_FALSE;
- }
-
- if (rc == SQL_ERROR) {
- odbc_sql_error(conn, SQL_NULL_HSTMT, "SQLAllocStmt");
- efree(result);
- RETURN_FALSE;
- }
-
- rc = SQLSpecialColumns(result->stmt,
- type,
- cat, SAFE_SQL_NTS(cat),
- schema, SAFE_SQL_NTS(schema),
- name, SAFE_SQL_NTS(name),
- scope,
- nullable);
-
- if (rc == SQL_ERROR) {
- odbc_sql_error(conn, SQL_NULL_HSTMT, "SQLSpecialColumns");
- efree(result);
- RETURN_FALSE;
- }
-
- result->numparams = 0;
- SQLNumResultCols(result->stmt, &(result->numcols));
-
- if (result->numcols > 0) {
- if (!odbc_bindcols(result)) {
- efree(result);
- RETURN_FALSE;
- }
- } else {
- result->values = NULL;
- }
- result->conn_ptr = conn;
- result->fetched = 0;
- ZEND_REGISTER_RESOURCE(return_value, result, le_result);
-}
-/* }}} */
-
-/* {{{ proto int odbc_statistics(int connection_id, string qualifier, string owner, string name, int unique, int accuracy)
- Returns a result identifier that contains statistics about a single table and the indexes associated with the table */
-PHP_FUNCTION(odbc_statistics)
-{
- pval **pv_conn, **pv_cat, **pv_schema, **pv_name;
- pval **pv_unique, **pv_reserved;
- odbc_result *result = NULL;
- odbc_connection *conn;
- char *cat = NULL, *schema = NULL, *name = NULL;
- UWORD unique, reserved;
- RETCODE rc;
- int argc;
-
- argc = ZEND_NUM_ARGS();
- if (argc == 6) {
- if (zend_get_parameters_ex(6, &pv_conn, &pv_cat, &pv_schema,
- &pv_name, &pv_unique, &pv_reserved) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(pv_cat);
- cat = (*pv_cat)->value.str.val;
- convert_to_string_ex(pv_schema);
- schema = (*pv_schema)->value.str.val;
- convert_to_string_ex(pv_name);
- name = (*pv_name)->value.str.val;
- convert_to_long_ex(pv_unique);
- unique = (UWORD) (*pv_unique)->value.lval;
- convert_to_long_ex(pv_reserved);
- reserved = (UWORD) (*pv_reserved)->value.lval;
- } else {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE2(conn, odbc_connection *, pv_conn, -1, "ODBC-Link", le_conn, le_pconn);
-
- result = (odbc_result *)emalloc(sizeof(odbc_result));
- if (result == NULL) {
- php_error(E_WARNING, "Out of memory");
- RETURN_FALSE;
- }
-
- rc = SQLAllocStmt(conn->hdbc, &(result->stmt));
- if (rc == SQL_INVALID_HANDLE) {
- efree(result);
- php_error(E_WARNING, "SQLAllocStmt error 'Invalid Handle' in odbc_statistics");
- RETURN_FALSE;
- }
-
- if (rc == SQL_ERROR) {
- odbc_sql_error(conn, SQL_NULL_HSTMT, "SQLAllocStmt");
- efree(result);
- RETURN_FALSE;
- }
-
- rc = SQLStatistics(result->stmt,
- cat, SAFE_SQL_NTS(cat),
- schema, SAFE_SQL_NTS(schema),
- name, SAFE_SQL_NTS(name),
- unique,
- reserved);
-
- if (rc == SQL_ERROR) {
- odbc_sql_error(conn, SQL_NULL_HSTMT, "SQLStatistics");
- efree(result);
- RETURN_FALSE;
- }
-
- result->numparams = 0;
- SQLNumResultCols(result->stmt, &(result->numcols));
-
- if (result->numcols > 0) {
- if (!odbc_bindcols(result)) {
- efree(result);
- RETURN_FALSE;
- }
- } else {
- result->values = NULL;
- }
- result->conn_ptr = conn;
- result->fetched = 0;
- ZEND_REGISTER_RESOURCE(return_value, result, le_result);
-}
-/* }}} */
-
-#if !defined(HAVE_DBMAKER) && !defined(HAVE_SOLID) && !defined(HAVE_SOLID_30) && !defined(HAVE_SOLID_35) && !defined(HAVE_VELOCIS)
-/* {{{ proto int odbc_tableprivileges(int connection_id, string qualifier, string owner, string name)
- Returns a result identifier containing a list of tables and the privileges associated with each table */
-PHP_FUNCTION(odbc_tableprivileges)
-{
- pval **pv_conn, **pv_cat, **pv_schema, **pv_table;
- odbc_result *result = NULL;
- odbc_connection *conn;
- char *cat = NULL, *schema = NULL, *table = NULL;
- RETCODE rc;
- int argc;
-
- argc = ZEND_NUM_ARGS();
- if (argc == 4) {
- if (zend_get_parameters_ex(4, &pv_conn, &pv_cat, &pv_schema, &pv_table) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(pv_cat);
- cat = (*pv_cat)->value.str.val;
- convert_to_string_ex(pv_schema);
- schema = (*pv_schema)->value.str.val;
- convert_to_string_ex(pv_table);
- table = (*pv_table)->value.str.val;
- } else {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE2(conn, odbc_connection *, pv_conn, -1, "ODBC-Link", le_conn, le_pconn);
-
- result = (odbc_result *)emalloc(sizeof(odbc_result));
- if (result == NULL) {
- php_error(E_WARNING, "Out of memory");
- RETURN_FALSE;
- }
-
- rc = SQLAllocStmt(conn->hdbc, &(result->stmt));
- if (rc == SQL_INVALID_HANDLE) {
- efree(result);
- php_error(E_WARNING, "SQLAllocStmt error 'Invalid Handle' in odbc_tableprivileges");
- RETURN_FALSE;
- }
-
- if (rc == SQL_ERROR) {
- odbc_sql_error(conn, SQL_NULL_HSTMT, "SQLAllocStmt");
- efree(result);
- RETURN_FALSE;
- }
-
- rc = SQLTablePrivileges(result->stmt,
- cat, SAFE_SQL_NTS(cat),
- schema, SAFE_SQL_NTS(schema),
- table, SAFE_SQL_NTS(table));
-
- if (rc == SQL_ERROR) {
- odbc_sql_error(conn, SQL_NULL_HSTMT, "SQLTablePrivileges");
- efree(result);
- RETURN_FALSE;
- }
-
- result->numparams = 0;
- SQLNumResultCols(result->stmt, &(result->numcols));
-
- if (result->numcols > 0) {
- if (!odbc_bindcols(result)) {
- efree(result);
- RETURN_FALSE;
- }
- } else {
- result->values = NULL;
- }
- result->conn_ptr = conn;
- result->fetched = 0;
- ZEND_REGISTER_RESOURCE(return_value, result, le_result);
-}
-/* }}} */
-#endif /* HAVE_DBMAKER */
-
-#endif /* HAVE_UODBC */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/odbc/php_odbc.h b/ext/odbc/php_odbc.h
deleted file mode 100644
index 9aa48bcfec..0000000000
--- a/ext/odbc/php_odbc.h
+++ /dev/null
@@ -1,358 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Stig Sæther Bakken <ssb@guardian.no> |
- | Andreas Karajannis <Andreas.Karajannis@gmd.de> |
- | Kevin N. Shallow <kshallow@tampabay.rr.com> Velocis Support |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef PHP_ODBC_H
-#define PHP_ODBC_H
-
-#if HAVE_UODBC
-#define ODBCVER 0x0250
-/*#ifndef MSVC5
-#define FAR
-#endif
-*/
-#ifdef ZTS
-#include "TSRM.h"
-#endif
-
-/* checking in the same order as in configure.in */
-
-#if defined(HAVE_SOLID) || defined(HAVE_SOLID_30) || defined(HAVE_SOLID_35) /* Solid Server */
-
-#define ODBC_TYPE "Solid"
-#if defined(HAVE_SOLID)
- #include <cli0core.h>
- #include <cli0ext1.h>
- #include <cli0env.h>
-#elif defined(HAVE_SOLID_30)
- #include <cli0cli.h>
- #include <cli0defs.h>
- #include <cli0env.h>
-#elif defined(HAVE_SOLID_35)
- #if !defined(PHP_WIN32)
- #include <sqlunix.h>
- #endif /* end: #if !defined(PHP_WIN32) */
- #include <sqltypes.h>
- #include <sqlucode.h>
- #include <sqlext.h>
- #include <sql.h>
-#endif /* end: #if defined(HAVE_SOLID) */
-#undef HAVE_SQL_EXTENDED_FETCH
-PHP_FUNCTION(solid_fetch_prev);
-#define SQLSMALLINT SWORD
-#define SQLUSMALLINT UWORD
-#ifndef SQL_SUCCEEDED
-#define SQL_SUCCEEDED(rc) (((rc)&(~1))==0)
-#endif
-
-#elif defined(HAVE_EMPRESS) /* Empress */
-
-#define ODBC_TYPE "Empress"
-#include <sql.h>
-#include <sqlext.h>
-#undef HAVE_SQL_EXTENDED_FETCH
-
-#elif defined(HAVE_ADABAS) /* Adabas D */
-
-#define ODBC_TYPE "Adabas D"
-#include <WINDOWS.H>
-#include <sql.h>
-#include <sqlext.h>
-#define HAVE_SQL_EXTENDED_FETCH 1
-#define SQL_SUCCEEDED(rc) (((rc)&(~1))==0)
-#define SQLINTEGER ULONG
-#define SQLUSMALLINT USHORT
-
-#elif defined(HAVE_SAPDB) /* SAP DB */
-
-#define ODBC_TYPE "SAP DB"
-#include <WINDOWS.H>
-#include <sql.h>
-#include <sqlext.h>
-#define HAVE_SQL_EXTENDED_FETCH 1
-#define SQL_SUCCEEDED(rc) (((rc)&(~1))==0)
-
-#elif defined(HAVE_IODBC) /* iODBC library */
-
-#define ODBC_TYPE "iODBC"
-#include <isql.h>
-#include <isqlext.h>
-#define HAVE_SQL_EXTENDED_FETCH 1
-#define SQL_FD_FETCH_ABSOLUTE 0x00000010L
-#define SQL_CURSOR_DYNAMIC 2UL
-#define SQL_NO_TOTAL (-4)
-#define SQL_SO_DYNAMIC 0x00000004L
-#define SQL_LEN_DATA_AT_EXEC_OFFSET (-100)
-#define SQL_LEN_DATA_AT_EXEC(length) (-(length)+SQL_LEN_DATA_AT_EXEC_OFFSET)
-#ifndef SQL_SUCCEEDED
-#define SQL_SUCCEEDED(rc) (((rc)&(~1))==0)
-#endif
-
-#elif defined(HAVE_UNIXODBC) /* unixODBC library */
-
-#define ODBC_TYPE "unixODBC"
-#include <sql.h>
-#include <sqlext.h>
-#define HAVE_SQL_EXTENDED_FETCH 1
-
-#elif defined(HAVE_ESOOB) /* Easysoft ODBC-ODBC Bridge library */
-
-#define ODBC_TYPE "ESOOB"
-#include <sql.h>
-#include <sqlext.h>
-#define HAVE_SQL_EXTENDED_FETCH 1
-
-#elif defined(HAVE_OPENLINK) /* OpenLink ODBC drivers */
-
-#define ODBC_TYPE "Openlink"
-#include <iodbc.h>
-#include <isql.h>
-#include <isqlext.h>
-#include <udbcext.h>
-#define HAVE_SQL_EXTENDED_FETCH 1
-#define SQLSMALLINT SWORD
-#define SQLUSMALLINT UWORD
-
-#elif defined(HAVE_VELOCIS) /* Raima Velocis */
-
-#define ODBC_TYPE "Velocis"
-#define UNIX
-/*
- * Extended Fetch in the Velocis ODBC API is incapable of returning long varchar (memo) fields.
- * So the following line has been commented-out to accomadate. - KNS
- *
- * #define HAVE_SQL_EXTENDED_FETCH 1
- */
-#include <sql.h>
-#include <sqlext.h>
-#define SQLINTEGER SDWORD
-#define SQLSMALLINT SWORD
-#define SQLUSMALLINT UWORD
-
-
-#elif defined(HAVE_DBMAKER) /* DBMaker */
-
-#define ODBC_TYPE "DBMaker"
-#undef ODBCVER
-#define ODBCVER 0x0300
-#define HAVE_SQL_EXTENDED_FETCH 1
-#include <odbc.h>
-
-
-#elif defined(HAVE_CODBC) /* Custom ODBC */
-
-#define ODBC_TYPE "Custom ODBC"
-#define HAVE_SQL_EXTENDED_FETCH 1
-#include <odbc.h>
-
-#elif defined(HAVE_IBMDB2) /* DB2 CLI */
-
-#define ODBC_TYPE "IBM DB2 CLI"
-#define HAVE_SQL_EXTENDED_FETCH 1
-#include <sqlcli1.h>
-#ifdef DB268K
-/* Need to include ASLM for 68K applications */
-#include <LibraryManager.h>
-#endif
-
-#else /* MS ODBC */
-
-#define HAVE_SQL_EXTENDED_FETCH 1
-#include <WINDOWS.H>
-#include <sql.h>
-#include <sqlext.h>
-#endif
-
-extern zend_module_entry odbc_module_entry;
-#define odbc_module_ptr &odbc_module_entry
-
-
-/* user functions */
-extern PHP_MINIT_FUNCTION(odbc);
-extern PHP_MSHUTDOWN_FUNCTION(odbc);
-extern PHP_RINIT_FUNCTION(odbc);
-extern PHP_RSHUTDOWN_FUNCTION(odbc);
-PHP_MINFO_FUNCTION(odbc);
-
-PHP_FUNCTION(odbc_error);
-PHP_FUNCTION(odbc_errormsg);
-PHP_FUNCTION(odbc_setoption);
-PHP_FUNCTION(odbc_autocommit);
-PHP_FUNCTION(odbc_close);
-PHP_FUNCTION(odbc_close_all);
-PHP_FUNCTION(odbc_commit);
-PHP_FUNCTION(odbc_connect);
-PHP_FUNCTION(odbc_pconnect);
-PHP_FUNCTION(odbc_cursor);
-PHP_FUNCTION(odbc_exec);
-PHP_FUNCTION(odbc_do);
-PHP_FUNCTION(odbc_execute);
-#ifdef HAVE_DBMAKER
-PHP_FUNCTION(odbc_fetch_array);
-PHP_FUNCTION(odbc_fetch_object);
-#endif
-PHP_FUNCTION(odbc_fetch_into);
-PHP_FUNCTION(odbc_fetch_row);
-PHP_FUNCTION(odbc_field_len);
-PHP_FUNCTION(odbc_field_scale);
-PHP_FUNCTION(odbc_field_name);
-PHP_FUNCTION(odbc_field_type);
-PHP_FUNCTION(odbc_field_num);
-PHP_FUNCTION(odbc_free_result);
-#if !defined(HAVE_SOLID) && !defined(HAVE_SOLID_30)
-PHP_FUNCTION(odbc_next_result);
-#endif
-PHP_FUNCTION(odbc_num_fields);
-PHP_FUNCTION(odbc_num_rows);
-PHP_FUNCTION(odbc_prepare);
-PHP_FUNCTION(odbc_result);
-PHP_FUNCTION(odbc_result_all);
-PHP_FUNCTION(odbc_rollback);
-PHP_FUNCTION(odbc_binmode);
-PHP_FUNCTION(odbc_longreadlen);
-PHP_FUNCTION(odbc_tables);
-PHP_FUNCTION(odbc_columns);
-#if !defined(HAVE_DBMAKER) && !defined(HAVE_SOLID) && !defined(HAVE_SOLID_35) /* not supported now */
-PHP_FUNCTION(odbc_columnprivileges);
-PHP_FUNCTION(odbc_tableprivileges);
-#endif
-#if !defined(HAVE_SOLID) || !defined(HAVE_SOLID_35) /* not supported */
-PHP_FUNCTION(odbc_foreignkeys);
-PHP_FUNCTION(odbc_procedures);
-PHP_FUNCTION(odbc_procedurecolumns);
-#endif
-PHP_FUNCTION(odbc_gettypeinfo);
-PHP_FUNCTION(odbc_primarykeys);
-PHP_FUNCTION(odbc_specialcolumns);
-PHP_FUNCTION(odbc_statistics);
-
-#if defined( HAVE_IBMDB2 ) || defined( HAVE_UNIXODBC )
-#define ODBC_SQL_ENV_T SQLHANDLE
-#define ODBC_SQL_CONN_T SQLHANDLE
-#define ODBC_SQL_STMT_T SQLHANDLE
-#elif defined( HAVE_SOLID_35 ) || defined( HAVE_SAPDB ) || defined ( HAVE_EMPRESS )
-#define ODBC_SQL_ENV_T SQLHENV
-#define ODBC_SQL_CONN_T SQLHDBC
-#define ODBC_SQL_STMT_T SQLHSTMT
-#else
-#define ODBC_SQL_ENV_T HENV
-#define ODBC_SQL_CONN_T HDBC
-#define ODBC_SQL_STMT_T HSTMT
-#endif
-
-typedef struct odbc_connection {
- ODBC_SQL_ENV_T henv;
- ODBC_SQL_CONN_T hdbc;
- char laststate[6];
- char lasterrormsg[SQL_MAX_MESSAGE_LENGTH];
- int id;
- int persistent;
-} odbc_connection;
-
-typedef struct odbc_result_value {
- char name[32];
- char *value;
- long int vallen;
- SDWORD coltype;
-} odbc_result_value;
-
-typedef struct odbc_result {
- ODBC_SQL_STMT_T stmt;
- int id;
- odbc_result_value *values;
- SWORD numcols;
- SWORD numparams;
-# if HAVE_SQL_EXTENDED_FETCH
- int fetch_abs;
-# endif
- long longreadlen;
- int binmode;
- int fetched;
- odbc_connection *conn_ptr;
-} odbc_result;
-
-typedef struct {
- char *defDB;
- char *defUser;
- char *defPW;
- long allow_persistent;
- long check_persistent;
- long max_persistent;
- long max_links;
- long num_persistent;
- long num_links;
- int defConn;
- long defaultlrl;
- long defaultbinmode;
- char laststate[6];
- char lasterrormsg[SQL_MAX_MESSAGE_LENGTH];
- HashTable *resource_list;
- HashTable *resource_plist;
-} php_odbc_globals;
-
-int odbc_add_result(HashTable *list, odbc_result *result);
-odbc_result *odbc_get_result(HashTable *list, int count);
-void odbc_del_result(HashTable *list, int count);
-int odbc_add_conn(HashTable *list, HDBC conn);
-odbc_connection *odbc_get_conn(HashTable *list, int count);
-void odbc_del_conn(HashTable *list, int ind);
-int odbc_bindcols(odbc_result *result);
-
-#define ODBC_SQL_ERROR_PARAMS odbc_connection *conn_resource, ODBC_SQL_STMT_T stmt, char *func
-
-void odbc_sql_error(ODBC_SQL_ERROR_PARAMS);
-
-#define IS_SQL_LONG(x) (x == SQL_LONGVARBINARY || x == SQL_LONGVARCHAR)
-#define IS_SQL_BINARY(x) (x == SQL_BINARY || x == SQL_VARBINARY || x == SQL_LONGVARBINARY)
-
-#ifdef ZTS
-# define ODBCLS_D php_odbc_globals *odbc_globals
-# define ODBCLS_DC , ODBCLS_D
-# define ODBCLS_C odbc_globals
-# define ODBCLS_CC , ODBCLS_C
-# define ODBCG(v) (odbc_globals->v)
-# define ODBCLS_FETCH() php_odbc_globals *odbc_globals = ts_resource(odbc_globals_id)
-#else
-# define ODBCLS_D
-# define ODBCLS_DC
-# define ODBCLS_C
-# define ODBCLS_CC
-# define ODBCG(v) (odbc_globals.v)
-# define ODBCLS_FETCH()
-extern ZEND_API php_odbc_globals odbc_globals;
-#endif
-
-#else
-
-# define odbc_module_ptr NULL
-
-#endif /* HAVE_UODBC */
-
-#define phpext_odbc_ptr odbc_module_ptr
-
-#endif /* PHP_ODBC_H */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/odbc/php_velocis.h b/ext/odbc/php_velocis.h
deleted file mode 100644
index 0ac48f43d5..0000000000
--- a/ext/odbc/php_velocis.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Nikolay P. Romanyuk <mag@redcom.ru> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef PHP_VELOCIS_H
-#define PHP_VELOCIS_H
-
-#if defined(HAVE_VELOCIS) && !HAVE_UODBC
-#define UNIX
-#include <sql.h>
-#include <sqlext.h>
-
-typedef struct VConn {
- HDBC hdbc;
- long index;
-} VConn;
-
-typedef struct {
- char name[32];
- char *value;
- long vallen;
- SDWORD valtype;
-} VResVal;
-
-typedef struct Vresult {
- HSTMT hstmt;
- VConn *conn;
- long index;
- VResVal *values;
- long numcols;
- int fetched;
-} Vresult;
-
-typedef struct {
- long num_links;
- long max_links;
- int le_link,le_result;
-} velocis_module;
-
-extern zend_module_entry velocis_module_entry;
-#define velocis_module_ptr &velocis_module_entry
-
-/* velocis.c functions */
-extern PHP_MINIT_FUNCTION(velocis);
-extern PHP_RINIT_FUNCTION(velocis);
-PHP_MINFO_FUNCTION(velocis);
-extern PHP_MSHUTDOWN_FUNCTION(velocis);
-
-PHP_FUNCTION(velocis_connect);
-PHP_FUNCTION(velocis_close);
-PHP_FUNCTION(velocis_exec);
-PHP_FUNCTION(velocis_fetch);
-PHP_FUNCTION(velocis_result);
-PHP_FUNCTION(velocis_freeresult);
-PHP_FUNCTION(velocis_autocommit);
-PHP_FUNCTION(velocis_off_autocommit);
-PHP_FUNCTION(velocis_commit);
-PHP_FUNCTION(velocis_rollback);
-PHP_FUNCTION(velocis_fieldnum);
-PHP_FUNCTION(velocis_fieldname);
-
-extern velocis_module php_velocis_module;
-
-#else
-
-#define velocis_module_ptr NULL
-
-#endif /* HAVE_VELOCIS */
-#endif /* PHP_VELOCIS_H */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/odbc/setup.stub b/ext/odbc/setup.stub
deleted file mode 100644
index 62693a67b1..0000000000
--- a/ext/odbc/setup.stub
+++ /dev/null
@@ -1,154 +0,0 @@
-# $Id$ -*- sh -*-
-
-# Solid
-define_option with-solid 'Solid support?' yesnodir \
- 'no /usr/local/solid Solid install' \
-' Whether to build PHP with Solid support.\n
- More information about Solid can be found at http://www.solidtech.com/.'
-
-# Empress
-if test "$option_value_with_solid" = "no"; then
-define_option with-empress 'Empress support?' yesnodir \
- "no $EMPRESSPATH Empress home" \
-' Whether to build PHP with Empress support. Has been confirmed to
- work with Empress Version 8.60. If you have not set up your
- Empress environment, enter what $EMPRESSPATH is usually set to here.
- More info about Empress can be found at http://www.empress.com/.'
-fi
-
-# Empress
-if test "$option_value_with_solid" = "no"; then
-define_option with-empress-bcs 'Empress support?' yesnodir \
- "no $EMPRESSPATH Empress home" \
-' Whether to build PHP with Empress support. Has been confirmed to
- work with Empress Version 8.60. If you have not set up your
- Empress environment, enter what $EMPRESSPATH is usually set to here.
- More info about Empress can be found at http://www.empress.com/.'
-fi
-
-# iODBC
-if test "$option_value_with_solid" = "no" -a \
- "$option_value_with_empress" = "no"; then
-define_option with-iodbc 'iODBC support?' yesnodir \
- 'no /usr/local iODBC install' \
-' Whether to build PHP with iODBC support. This feature was first\n
- developed for iODBC Driver Manager, a freely redistributable ODBC\n
- driver manager which runs under many flavors of UNIX.\n
- More info about iODBC can be found on the iODBC page at \n
- http://www.iodbc.org'
-fi
-
-# unixODBC
-if test "$option_value_with_solid" = "no" -a \
- "$option_value_with_empress" = "no" -a \
- "$option_value_with_iodbc" = "no"; then
-define_option with-unixODBC 'unixODBC support?' yesnodir \
- 'no /usr/local unixODBC install' \
-' Whether to build PHP with unixODBC support. This feature was first\n
- developed for unixODBC Driver Manager, a freely redistributable ODBC\n
- driver manager which runs under many flavors of UNIX and conforms to\n
- the ODBC 3.5 specification.\n
- More info about unixODBC can be found on the unixODBC home page at \n
- http://www.unixodbc.org'
-fi
-
-# ESOOB
-if test "$option_value_with_solid" = "no" -a \
- "$option_value_with_empress" = "no" -a \
- "$option_value_with_iodbc" = "no" -a \
- "$option_value_with_unixODBC" = "no"; then
-define_option with-esoob 'Easysoft ODBC-ODBC Bridge support?' yesnodir \
- 'no /usr/local/easysoft/oob/client ESOOB install' \
-' Whether to build PHP with Easysoft ODBC-ODBC Bridge support.\n
- More info about the Easysoft ODBC-ODBC Bridge can be found on the\n
- Easysoft home page at http://www.easysoft.com'
-fi
-
-# OpenLink
-if test "$option_value_with_solid" = "no" -a \
- "$option_value_with_empress" = "no" -a \
- "$option_value_with_iodbc"" = "no" -a \
- "$option_value_with_unixODBC" = "no" -a \
- "$option_value_with_esoob" = "no"; then
-define_option with-openlink 'OpenLink ODBC support?' yesnodir \
- 'no /usr/local/openlink OpenLink install' \
-' Whether to build PHP with OpenLink ODBC support. See
- http://www.openlinksw.com/ for more information.'
-fi
-
-# Adabas D
-if test "$option_value_with_solid" = "no" -a \
- "$option_value_with_empress" = "no" -a \
- "$option_value_with_iodbc" = "no" -a \
- "$option_value_with_unixODBC" = "no" -a \
- "$option_value_with_esoob" = "no" -a \
- "$option_value_with_openlink" = "no"; then
-define_option with-adabas 'Adabas D support?' yesnodir \
- 'no /usr/local Adabas D install root' \
-' Whether to build with Adabas D support.\n
- More info about Adabas D can be found at http://www.adabas.com/.'
-fi
-
-# Velocis
-if test "$option_value_with_solid" = "no" -a \
- "$option_value_with_empress" = "no" -a \
- "$option_value_with_iodbc" = "no" -a \
- "$option_value_with_unixODBC" = "no" -a \
- "$option_value_with_esoob" = "no" -a \
- "$option_value_with_openlink" = "no" -a \
- "$option_value_with_adabas" = "no"; then
-define_option with-velocis 'Velocis support?' yesnodir \
- 'no /usr/local/velocis Velocis install' \
-' Whether to build PHP with Velocis support.\n
- More information about Velocis can be found at http://www.raima.com/.'
-fi
-
-# DBMaker
-if test "$option_value_with_solid" = "no" -a \
- "$option_value_with_empress" = "no" -a \
- "$option_value_with_iodbc" = "no" -a \
- "$option_value_with_unixODBC" = "no" -a \
- "$option_value_with_esoob" = "no" -a \
- "$option_value_with_openlink" = "no" -a \
- "$option_value_with_adabas" = "no" -a \
- "$option_value_with_velocis" = "no"; then
-define_option with-dbmaker 'DBMaker support?' yesnodir \
- 'no /home/dbmaker DBMaker install' \
-' Whether to build PHP with DBMaker support. \n
- More information about DBMaker can be found at http://www.casemaker.com/.'
-fi
-
-# SAP DB
-if test "$option_value_with_solid" = "no" -a \
- "$option_value_with_empress" = "no" -a \
- "$option_value_with_iodbc" = "no" -a \
- "$option_value_with_unixODBC" = "no" -a \
- "$option_value_with_esoob" = "no" -a \
- "$option_value_with_openlink" = "no" -a \
- "$option_value_with_adabas" = "no" -a \
- "$option_value_with_velocis" = "no" -a \
- "$option_value_with_dbmaker" = "no"; then
-define_option with-sapdb 'SAP DB support?' yesnodir \
- 'no /usr/local SAP DB install' \
-' Whether to build PHP with SAP DB support. \n
- More information about SAP DB can be found at http://www.sapdb.org.'
-fi
-
-# Custom ODBC
-if test "$option_value_with_solid" = "no" -a \
- "$option_value_with_empress" = "no" -a \
- "$option_value_with_iodbc" = "no" -a \
- "$option_value_with_unixODBC" = "no" -a \
- "$option_value_with_esoob" = "no" -a \
- "$option_value_with_openlink" = "no" -a \
- "$option_value_with_adabas" = "no" -a \
- "$option_value_with_velocis" = "no" -a \
- "$option_value_with_dbmaker" = "no" -a \
- "$option_value_with_sapdb" = "no"; then
-define_option with-custom-odbc 'custom ODBC support?' yesnodir \
- 'no /usr/local CODBC install' \
-' Whether to build PHP with CODBC support. This feature was first
- developed for Sybase SQL Anywhere 5.5 on QNX, but may be used for
- any unknown ODBC driver on all flavors of UNIX.'
-fi
-
diff --git a/ext/odbc/velocis.c b/ext/odbc/velocis.c
deleted file mode 100644
index 1491cb0239..0000000000
--- a/ext/odbc/velocis.c
+++ /dev/null
@@ -1,657 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Nikolay P. Romanyuk <mag@redcom.ru> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-/*
- * TODO:
- * velocis_fetch_into(),
- * Check all on real life apps.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-
-#if WIN32
-# include "config.w32.h"
-# include "win95nt.h"
-# ifdef PHP_EXPORTS
-# define PHPAPI __declspec(dllexport)
-# else
-# define PHPAPI __declspec(dllimport)
-# endif
-#else
-# include "php_config.h"
-# define PHPAPI
-# define THREAD_LS
-#endif
-
-#ifdef HAVE_VELOCIS
-#include "php_velocis.h"
-#include "ext/standard/info.h"
-
-function_entry velocis_functions[] = {
- PHP_FE(velocis_connect, NULL)
- PHP_FE(velocis_close, NULL)
- PHP_FE(velocis_exec, NULL)
- PHP_FE(velocis_fetch, NULL)
- PHP_FE(velocis_result, NULL)
- PHP_FE(velocis_freeresult, NULL)
- PHP_FE(velocis_autocommit, NULL)
- PHP_FE(velocis_off_autocommit, NULL)
- PHP_FE(velocis_commit, NULL)
- PHP_FE(velocis_rollback, NULL)
- PHP_FE(velocis_fieldnum, NULL)
- PHP_FE(velocis_fieldname, NULL)
- {NULL, NULL, NULL}
-};
-
-zend_module_entry velocis_module_entry = {
- "velocis", velocis_functions, PHP_MINIT(velocis), PHP_MSHUTDOWN(velocis),
- PHP_RINIT(velocis), NULL, PHP_MINFO(velocis), STANDARD_MODULE_PROPERTIES
-};
-
-
-#ifdef COMPILE_DL_ODBC
-ZEND_GET_MODULE(velocis)
-#endif
-
-THREAD_LS velocis_module php_velocis_module;
-THREAD_LS static HENV henv;
-
-static void _close_velocis_link(zend_rsrc_list_entry *rsrc)
-{
- VConn *conn = (VConn *)rsrc->ptr;
- if ( conn ) {
- efree(conn);
- }
-}
-
-static void _free_velocis_result(zend_rsrc_list_entry *rsrc)
-{
- Vresult *res = (Vresult *)rsrc->ptr;
- if ( res && res->values ) {
- register int i;
- for ( i=0; i < res->numcols; i++ ) {
- if ( res->values[i].value )
- efree(res->values[i].value);
- }
- efree(res->values);
- }
- if ( res ) {
- efree(res);
- }
-}
-
-PHP_MINIT_FUNCTION(velocis)
-{
- SQLAllocEnv(&henv);
- if ( cfg_get_long("velocis.max_links",&php_velocis_module.max_links) == FAILURE ) {
- php_velocis_module.max_links = -1;
- }
- php_velocis_module.num_links = 0;
- php_velocis_module.le_link = zend_register_list_destructors_ex(_close_velocis_link, NULL, "velocis link", module_number);
- php_velocis_module.le_result = zend_register_list_destructors_ex(_free_velocis_result, NULL, "velocis result", module_number);
-
- return SUCCESS;
-}
-
-PHP_RINIT_FUNCTION(velocis)
-{
- return SUCCESS;
-}
-
-
-PHP_MINFO_FUNCTION(velocis)
-{
- php_info_print_table_start();
- php_info_print_table_row(2, "RAIMA Velocis Support", "enabled" );
- php_info_print_table_end();
-}
-
-PHP_MSHUTDOWN_FUNCTION(velocis)
-{
- SQLFreeEnv(henv);
- return SUCCESS;
-}
-
-/* Some internal functions. Connections and result manupulate */
-
-static int
-velocis_add_conn(HashTable *list,VConn *conn,HDBC hdbc)
-{
- int ind;
-
- ind = zend_list_insert(conn,php_velocis_module.le_link);
- conn->hdbc = hdbc;
- conn->index = ind;
-
- return(ind);
-}
-
-static VConn *
-velocis_find_conn(HashTable *list,int ind)
-{
- VConn *conn;
- int type;
-
- conn = zend_list_find(ind,&type);
- if ( !conn || type != php_velocis_module.le_link ) {
- return(NULL);
- }
- return(conn);
-}
-
-static void
-velocis_del_conn(HashTable *list,int ind)
-{
- zend_list_delete(ind);
-}
-
-static int
-velocis_add_result(HashTable *list,Vresult *res,VConn *conn)
-{
- int ind;
-
- ind = zend_list_insert(res,php_velocis_module.le_result);
- res->conn = conn;
- res->index = ind;
-
- return(ind);
-}
-
-static Vresult *
-velocis_find_result(HashTable *list,int ind)
-{
- Vresult *res;
- int type;
-
- res = zend_list_find(ind,&type);
- if ( !res || type != php_velocis_module.le_result ) {
- return(NULL);
- }
- return(res);
-}
-
-static void
-velocis_del_result(HashTable *list,int ind)
-{
- zend_list_delete(ind);
-}
-
-/* Users functions */
-
-PHP_FUNCTION(velocis_connect)
-{
- pval *serv,*user,*pass;
- char *Serv = NULL;
- char *User = NULL;
- char *Pass = NULL;
- RETCODE stat;
- HDBC hdbc;
- VConn *new;
- long ind;
-
- if ( php_velocis_module.max_links != -1 && php_velocis_module.num_links == php_velocis_module.max_links ) {
- php_error(E_WARNING,"Velocis: Too many open connections (%d)",php_velocis_module.num_links);
- RETURN_FALSE;
- }
- if ( ZEND_NUM_ARGS() != 3 ||
- getParameters(ht,3,&serv,&user,&pass) == FAILURE ) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string(serv);
- convert_to_string(user);
- convert_to_string(pass);
- Serv = serv->value.str.val;
- User = user->value.str.val;
- Pass = pass->value.str.val;
- stat = SQLAllocConnect(henv,&hdbc);
- if ( stat != SQL_SUCCESS ) {
- php_error(E_WARNING,"Velocis: Could not allocate connection handle");
- RETURN_FALSE;
- }
- stat = SQLConnect(hdbc,Serv,SQL_NTS,User,SQL_NTS,Pass,SQL_NTS);
- if ( stat != SQL_SUCCESS && stat != SQL_SUCCESS_WITH_INFO ) {
- php_error(E_WARNING,"Velocis: Could not connect to server \"%s\" for %s",Serv,User);
- SQLFreeConnect(hdbc);
- RETURN_FALSE;
- }
- new = (VConn *)emalloc(sizeof(VConn));
- if ( new == NULL ) {
- php_error(E_WARNING,"Velocis: Out of memory for store connection");
- SQLFreeConnect(hdbc);
- RETURN_FALSE;
- }
- ind = velocis_add_conn(list,new,hdbc);
- php_velocis_module.num_links++;
- RETURN_LONG(ind);
-}
-
-PHP_FUNCTION(velocis_close)
-{
- pval *id;
- VConn *conn;
-
- if ( ZEND_NUM_ARGS() != 1 || getParameters(ht,1,&id) == FAILURE ) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long(id);
- conn = velocis_find_conn(list,id->value.lval);
- if ( !conn ) {
- php_error(E_WARNING,"Velocis: Not connection index (%d)",id->value.lval);
- RETURN_FALSE;
- }
- SQLDisconnect(conn->hdbc);
- SQLFreeConnect(conn->hdbc);
- velocis_del_conn(list,id->value.lval);
- php_velocis_module.num_links--;
- RETURN_TRUE;
-}
-
-PHP_FUNCTION(velocis_exec)
-{
- pval *ind,*exec_str;
- char *query = NULL;
- int indx;
- VConn *conn;
- Vresult *res;
- RETCODE stat;
- SWORD cols,i,colnamelen;
- SDWORD rows,coldesc;
-
- if ( ZEND_NUM_ARGS() != 2 || getParameters(ht,2,&ind,&exec_str) == FAILURE ) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long(ind);
- conn = velocis_find_conn(list,ind->value.lval);
- if ( !conn ) {
- php_error(E_WARNING,"Velocis: Not connection index (%d)",ind->value.lval);
- RETURN_FALSE;
- }
- convert_to_string(exec_str);
- query = exec_str->value.str.val;
-
- res = (Vresult *)emalloc(sizeof(Vresult));
- if ( res == NULL ) {
- php_error(E_WARNING,"Velocis: Out of memory for result");
- RETURN_FALSE;
- }
- stat = SQLAllocStmt(conn->hdbc,&res->hstmt);
- if ( stat != SQL_SUCCESS && stat != SQL_SUCCESS_WITH_INFO ) {
- php_error(E_WARNING,"Velocis: SQLAllocStmt return %d",stat);
- efree(res);
- RETURN_FALSE;
- }
- stat = SQLExecDirect(res->hstmt,query,SQL_NTS);
- if ( stat != SQL_SUCCESS && stat != SQL_SUCCESS_WITH_INFO ) {
- php_error(E_WARNING,"Velocis: Can not execute \"%s\" query",query);
- SQLFreeStmt(res->hstmt,SQL_DROP);
- efree(res);
- RETURN_FALSE;
- }
- /* Success query */
- stat = SQLNumResultCols(res->hstmt,&cols);
- if ( stat != SQL_SUCCESS ) {
- php_error(E_WARNING,"Velocis: SQLNumResultCols return %d",stat);
- SQLFreeStmt(res->hstmt,SQL_DROP);
- efree(res);
- RETURN_FALSE;
- }
- if ( !cols ) { /* Was INSERT, UPDATE, DELETE, etc. query */
- stat = SQLRowCount(res->hstmt,&rows);
- if ( stat != SQL_SUCCESS ) {
- php_error(E_WARNING,"Velocis: SQLNumResultCols return %d",stat);
- SQLFreeStmt(res->hstmt,SQL_DROP);
- efree(res);
- RETURN_FALSE;
- }
- SQLFreeStmt(res->hstmt,SQL_DROP);
- efree(res);
- RETURN_LONG(rows);
- } else { /* Was SELECT query */
- res->values = (VResVal *)emalloc(sizeof(VResVal)*cols);
- if ( res->values == NULL ) {
- php_error(E_WARNING,"Velocis: Out of memory for result columns");
- SQLFreeStmt(res->hstmt,SQL_DROP);
- efree(res);
- RETURN_FALSE;
- }
- res->numcols = cols;
- for ( i = 0; i < cols; i++ ) {
- SQLColAttributes(res->hstmt,i+1,SQL_COLUMN_NAME,
- res->values[i].name,sizeof(res->values[i].name),
- &colnamelen,NULL);
- SQLColAttributes(res->hstmt,i+1,SQL_COLUMN_TYPE,
- NULL,0,NULL,&res->values[i].valtype);
- switch ( res->values[i].valtype ) {
- case SQL_LONGVARBINARY:
- case SQL_LONGVARCHAR:
- res->values[i].value = NULL;
- continue;
- default:
- break;
- }
- SQLColAttributes(res->hstmt,i+1,SQL_COLUMN_DISPLAY_SIZE,
- NULL,0,NULL,&coldesc);
- res->values[i].value = (char *)emalloc(coldesc+1);
- if ( res->values[i].value != NULL ) {
- SQLBindCol(res->hstmt,i+1,SQL_C_CHAR,
- res->values[i].value,coldesc+1,
- &res->values[i].vallen);
- }
- }
- }
- res->fetched = 0;
- indx = velocis_add_result(list,res,conn);
- RETURN_LONG(indx);
-}
-
-PHP_FUNCTION(velocis_fetch)
-{
- pval *ind;
- Vresult *res;
- RETCODE stat;
- UDWORD row;
- UWORD RowStat[1];
-
- if ( ZEND_NUM_ARGS() != 1 || getParameters(ht,1,&ind) == FAILURE ) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long(ind);
- res = velocis_find_result(list,ind->value.lval);
- if ( !res ) {
- php_error(E_WARNING,"Velocis: Not result index (%d)",ind->value.lval);
- RETURN_FALSE;
- }
- stat = SQLExtendedFetch(res->hstmt,SQL_FETCH_NEXT,1,&row,RowStat);
- if ( stat == SQL_NO_DATA_FOUND ) {
- SQLFreeStmt(res->hstmt,SQL_DROP);
- velocis_del_result(list,ind->value.lval);
- RETURN_FALSE;
- }
- if ( stat != SQL_SUCCESS && stat != SQL_SUCCESS_WITH_INFO ) {
- php_error(E_WARNING,"Velocis: SQLFetch return error");
- SQLFreeStmt(res->hstmt,SQL_DROP);
- velocis_del_result(list,ind->value.lval);
- RETURN_FALSE;
- }
- res->fetched = 1;
- RETURN_TRUE;
-}
-
-PHP_FUNCTION(velocis_result)
-{
- pval *ind,*col;
- Vresult *res;
- RETCODE stat;
- int i,sql_c_type;
- UDWORD row;
- UWORD RowStat[1];
- SWORD indx = -1;
- char *field = NULL;
-
- if ( ZEND_NUM_ARGS() != 2 || getParameters(ht,2,&ind,&col) == FAILURE ) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long(ind);
- res = velocis_find_result(list,ind->value.lval);
- if ( !res ) {
- php_error(E_WARNING,"Velocis: Not result index (%d),ind->value.lval");
- RETURN_FALSE;
- }
- if ( col->type == IS_STRING ) {
- field = col->value.str.val;
- } else {
- convert_to_long(col);
- indx = col->value.lval;
- }
- if ( field ) {
- for ( i = 0; i < res->numcols; i++ ) {
- if ( !strcasecmp(res->values[i].name,field)) {
- indx = i;
- break;
- }
- }
- if ( indx < 0 ) {
- php_error(E_WARNING, "Field %s not found",field);
- RETURN_FALSE;
- }
- } else {
- if ( indx < 0 || indx >= res->numcols ) {
- php_error(E_WARNING,"Velocis: Field index not in range");
- RETURN_FALSE;
- }
- }
- if ( !res->fetched ) {
- stat = SQLExtendedFetch(res->hstmt,SQL_FETCH_NEXT,1,&row,RowStat);
- if ( stat == SQL_NO_DATA_FOUND ) {
- SQLFreeStmt(res->hstmt,SQL_DROP);
- velocis_del_result(list,ind->value.lval);
- RETURN_FALSE;
- }
- if ( stat != SQL_SUCCESS && stat != SQL_SUCCESS_WITH_INFO ) {
- php_error(E_WARNING,"Velocis: SQLFetch return error");
- SQLFreeStmt(res->hstmt,SQL_DROP);
- velocis_del_result(list,ind->value.lval);
- RETURN_FALSE;
- }
- res->fetched = 1;
- }
- switch ( res->values[indx].valtype ) {
- case SQL_LONGVARBINARY:
- sql_c_type = SQL_C_BINARY;
- goto l1;
- case SQL_LONGVARCHAR:
- sql_c_type = SQL_C_CHAR;
-l1:
- if ( !res->values[indx].value ) {
- res->values[indx].value = emalloc(4096);
- if ( !res->values[indx].value ) {
- php_error(E_WARNING,"Out of memory");
- RETURN_FALSE;
- }
- }
- stat = SQLGetData(res->hstmt,indx+1,sql_c_type,
- res->values[indx].value,4095,&res->values[indx].vallen);
- if ( stat == SQL_NO_DATA_FOUND ) {
- SQLFreeStmt(res->hstmt,SQL_DROP);
- velocis_del_result(list,ind->value.lval);
- RETURN_FALSE;
- }
- if ( stat != SQL_SUCCESS && stat != SQL_SUCCESS_WITH_INFO ) {
- php_error(E_WARNING,"Velocis: SQLGetData return error");
- SQLFreeStmt(res->hstmt,SQL_DROP);
- velocis_del_result(list,ind->value.lval);
- RETURN_FALSE;
- }
- if ( res->values[indx].valtype == SQL_LONGVARCHAR ) {
- RETURN_STRING(res->values[indx].value,TRUE);
- } else {
- RETURN_LONG((long)res->values[indx].value);
- }
- default:
- if ( res->values[indx].value != NULL ) {
- RETURN_STRING(res->values[indx].value,TRUE);
- }
- }
-}
-
-PHP_FUNCTION(velocis_freeresult)
-{
- pval *ind;
- Vresult *res;
-
- if ( ZEND_NUM_ARGS() != 1 || getParameters(ht,1,&ind) == FAILURE ) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long(ind);
- res = velocis_find_result(list,ind->value.lval);
- if ( !res ) {
- php_error(E_WARNING,"Velocis: Not result index (%d)",ind->value.lval);
- RETURN_FALSE;
- }
- SQLFreeStmt(res->hstmt,SQL_DROP);
- velocis_del_result(list,ind->value.lval);
- RETURN_TRUE;
-}
-
-PHP_FUNCTION(velocis_autocommit)
-{
- pval *id;
- RETCODE stat;
- VConn *conn;
-
- if ( ZEND_NUM_ARGS() != 1 || getParameters(ht,1,&id) == FAILURE ) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long(id);
- conn = velocis_find_conn(list,id->value.lval);
- if ( !conn ) {
- php_error(E_WARNING,"Velocis: Not connection index (%d)",id->value.lval);
- RETURN_FALSE;
- }
- stat = SQLSetConnectOption(conn->hdbc,SQL_AUTOCOMMIT,SQL_AUTOCOMMIT_ON);
- if ( stat != SQL_SUCCESS && stat != SQL_SUCCESS_WITH_INFO ) {
- php_error(E_WARNING,"Velocis: Set autocommit_on option failure");
- RETURN_FALSE;
- }
- RETURN_TRUE;
-}
-
-PHP_FUNCTION(velocis_off_autocommit)
-{
- pval *id;
- RETCODE stat;
- VConn *conn;
-
- if ( ZEND_NUM_ARGS() != 1 || getParameters(ht,1,&id) == FAILURE ) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long(id);
- conn = velocis_find_conn(list,id->value.lval);
- if ( !conn ) {
- php_error(E_WARNING,"Velocis: Not connection index (%d)",id->value.lval);
- RETURN_FALSE;
- }
- stat = SQLSetConnectOption(conn->hdbc,SQL_AUTOCOMMIT,SQL_AUTOCOMMIT_OFF);
- if ( stat != SQL_SUCCESS && stat != SQL_SUCCESS_WITH_INFO ) {
- php_error(E_WARNING,"Velocis: Set autocommit_off option failure");
- RETURN_FALSE;
- }
- RETURN_TRUE;
-}
-
-PHP_FUNCTION(velocis_commit)
-{
- pval *id;
- RETCODE stat;
- VConn *conn;
-
- if ( ZEND_NUM_ARGS() != 1 || getParameters(ht,1,&id) == FAILURE ) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long(id);
- conn = velocis_find_conn(list,id->value.lval);
- if ( !conn ) {
- php_error(E_WARNING,"Velocis: Not connection index (%d)",id->value.lval);
- RETURN_FALSE;
- }
- stat = SQLTransact(NULL,conn->hdbc,SQL_COMMIT);
- if ( stat != SQL_SUCCESS ) {
- php_error(E_WARNING,"Velocis: Commit failure");
- RETURN_FALSE;
- }
- RETURN_TRUE;
-}
-
-PHP_FUNCTION(velocis_rollback)
-{
- pval *id;
- RETCODE stat;
- VConn *conn;
-
- if ( ZEND_NUM_ARGS() != 1 || getParameters(ht,1,&id) == FAILURE ) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long(id);
- conn = velocis_find_conn(list,id->value.lval);
- if ( !conn ) {
- php_error(E_WARNING,"Velocis: Not connection index (%d)",id->value.lval);
- RETURN_FALSE;
- }
- stat = SQLTransact(NULL,conn->hdbc,SQL_ROLLBACK);
- if ( stat != SQL_SUCCESS ) {
- php_error(E_WARNING,"Velocis: Rollback failure");
- RETURN_FALSE;
- }
- RETURN_TRUE;
-}
-
-PHP_FUNCTION(velocis_fieldname)
-{
- pval *ind,*col;
- Vresult *res;
- SWORD indx;
-
- if ( ZEND_NUM_ARGS() != 2 || getParameters(ht,2,&ind,&col) == FAILURE ) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long(ind);
- res = velocis_find_result(list,ind->value.lval);
- if ( !res ) {
- php_error(E_WARNING,"Velocis: Not result index (%d),ind->value.lval");
- RETURN_FALSE;
- }
- convert_to_long(col);
- indx = col->value.lval;
- if ( indx < 0 || indx >= res->numcols ) {
- php_error(E_WARNING,"Velocis: Field index not in range");
- RETURN_FALSE;
- }
- RETURN_STRING(res->values[indx].name,TRUE);
-}
-
-PHP_FUNCTION(velocis_fieldnum)
-{
- pval *ind;
- Vresult *res;
-
- if ( ZEND_NUM_ARGS() != 1 || getParameters(ht,1,&ind) == FAILURE ) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long(ind);
- res = velocis_find_result(list,ind->value.lval);
- if ( !res ) {
- php_error(E_WARNING,"Velocis: Not result index (%d),ind->value.lval");
- RETURN_FALSE;
- }
- RETURN_LONG(res->numcols);
-}
-
-#endif /* HAVE_VELOCIS */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/openssl/CREDITS b/ext/openssl/CREDITS
deleted file mode 100644
index c2f50d6308..0000000000
--- a/ext/openssl/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-OpenSSL
-Stig Venaas, Wez Furlong, Sascha Kettler
diff --git a/ext/openssl/EXPERIMENTAL b/ext/openssl/EXPERIMENTAL
deleted file mode 100644
index 6443e99646..0000000000
--- a/ext/openssl/EXPERIMENTAL
+++ /dev/null
@@ -1,5 +0,0 @@
-this extension is experimental,
-its functions may change their names
-or move to extension all together
-so do not rely to much on them
-you have been warned!
diff --git a/ext/openssl/Makefile.in b/ext/openssl/Makefile.in
deleted file mode 100644
index 306e6c6890..0000000000
--- a/ext/openssl/Makefile.in
+++ /dev/null
@@ -1,7 +0,0 @@
-# $Id$
-
-LTLIBRARY_NAME = libopenssl.la
-LTLIBRARY_SOURCES = openssl.c
-LTLIBRARY_SHARED_NAME = openssl.la
-
-include $(top_srcdir)/build/dynlib.mk
diff --git a/ext/openssl/README b/ext/openssl/README
deleted file mode 100644
index 66d79267fd..0000000000
--- a/ext/openssl/README
+++ /dev/null
@@ -1,321 +0,0 @@
-OpenSSL extension for PHP4
-$Id$
-
-The functions implemented so far make it possible to seal and open data, and
-also create and verify signatures.
-
-NEW: support for S/MIME encrypt/decrypt/sign/verify, as well as more
-flexibility for specifying certificates/keys.
-
-To enable the extension, configure PHP with --with-openssl.
-
-Specifying keys/certificates
-----------------------------
-
-Most of the functions require a key or a certificate as a parameter; to make
-things easy for you to use openssl, this extension allows you
-to specify certificates in the following way:
-
-1. As an X.509 resource returned from openssl_x509_read
-2. As a string in the format file://filename, where filename is the path to the
- certificate file (it will be opened and read automatically)
-3. As a string containing the data from the certificate file
-
-Similarly, you can use the following methods of specifying a public key:
-
-1. As a key resource returned from openssl_get_publickey
-2. An X509 resource - public key only
-3. As a string in the format file://filename
-4. As a string containing the data from the key file
-
-Additionally, for a private key, when the openssl extension function does not
-allow you to enter the passphrase as a parameter you may use the syntax
-array($key, "passphrase") where $key can be a key specified using one of the
-methods listed above.
-
-Certificate Verification
-------------------------
-When calling a function that will verify a signature/certificate, the cainfo
-parameter is an array containing file and directory names that specifiy the
-locations of trusted CA files. If a directory is specified, then it must be a
-correctly hashed directory.
-
-Misc:
------
-
-mixed openssl_error_string()
-
-returns the message from the last error that the OpenSSL library encountered
-and moves it's internal error pointer to the next message. If there are no
-more error messages, returns false.
-
-General Key/Cert Functions:
----------------------------
-
-resource openssl_get_privatekey(mixed key [, string passphrase])
-
-Parses the key data and returns a key resource identifier. If the key is
-encrypted a passphrase is needed. This can be supplied as second argument.
-
-
-resource openssl_get_publickey(mixed cert)
-
-Extracts the public key from the given certificate and returns a key
-resource identifier.
-
-
-void openssl_free_key(resource key)
-
-Frees the resource given by the key resource identifier.
-Note that this function does not accept the extended key specification
-syntax mentioned above, as it doesn't make sense in this case!
-
-array openssl_x509_parse(mixed x509[, bool shortnames=true])
-
-Parses the certificate data and returns an array containing information
-about the certificate, it's intended purposes, subject, issuer, validity
-etc. etc. If shortnames is true (the default) then the fields will be
-keyed by the shortname forms eg: CN as opposed to commonName (shortnames
-= false).
-
-
-bool openssl_x509_checkpurpose(mixed x509cert, int purpose,
- array cainfo[, string untrustedfile])
-
-Verifies if the certificate can be used for a specific purpose.
-Purpose can be one of the following values:
- X509_PURPOSE_SSL_CLIENT
- X509_PURPOSE_SSL_SERVER
- X509_PURPOSE_NS_SSL_SERVER
- X509_PURPOSE_SMIME_SIGN
- X509_PURPOSE_SMIME_ENCRYPT
- X509_PURPOSE_CRL_SIGN
- X509_PURPOSE_ANY
-
-cainfo is an array of CA information (as mentioned above).
-untrusted file specifies a file containing a bunch of certs that
-are not trusted but may be useful in validating the certificate.
-
-
-resource openssl_read_x509(mixed cert)
-
-Parses the cert and returns a resource that can be used with the
-other openssl functions
-
-
-void openssl_free_x509(resource x509)
-
-Frees the resource given by the x509 resource identifier.
-Note that this function does not accept the extended cert specification
-syntax mentioned above, as it doesn't make sense in this case!
-
-
-PKCS7 (S/MIME) Sign/Verify/Encrypt/Decrypt Functions:
------------------------------------------------------
-
-These functions allow you to manipulate S/MIME messages!
-
-They are based on apps/smime.c from the openssl dist, so for information,
-see the documentation for openssl.
-
-You may pass in some flags that affect how these functions work using
-and array containing the following values:
-"detached", "nodetached", "text", "nointern", "noverify", "nochain",
-"nocerts", "noattr", "binary", "nosigs".
-The options correspond to the options of the same name for the
-"openssl smime" command (smime(1)).
-
-
-bool openssl_pkcs7_verify(string filename, array flags[, string signerscerts][,
- array cainfo])
-
-Verifies that the signature on the MIME message contained in the file
-named by filename is valid. If signerscerts is passed in, it holds the
-name of a file into which the certificates of those that signed the
-message will be stored.
-cainfo and flags are CA information and flag information as described
-above.
-
-
-bool openssl_pkcs7_encrypt(string infile, string outfile, array recipcerts,
- array headers[, array flags])
-
-Encrypts the MIME message contained in the file named by infile using
-the certificates held in recipcerts. The result is place in the file
-named outfile.
-recipcerts is an array of certificate identifiers representing the certs
-of the intended recipients of the message.
-headers is an array of headers to prepend to the message: they will
-not be included in the encoded section.
-flags is flag information as described above.
-Hint: you will want to put "To", "From", and "Subject" headers in headers.
-Headers can be either an assoc array keyed by header named, or can be
-and indexed array containing a single header line per value.
-The message will be encoded using a RC2-40 bit cipher.
-TODO: allow user to specify cipher.
-
-bool openssl_pkcs7_sign(string infile, string outfile, mixed signcert, mixed
- signkey, array headers[, array flags][, string extracertsfilename])
-
-Signs the MIME message contained in the file named by infile using the
-certificate and key pair identified by signcert/signkey.
-Signkey must be the private key corresponding to signcert.
-The result is placed in the file named by outfile.
-Headers and flags have the same effects as mentioned above.
-extracertsfilename names a file containing a bunch of additional certificates
-to include in the signature, in order to aid the recipient in verifying the
-message.
-
-
-bool openssl_pkcs7_decrypt(string infilename, string outfilename, mixed
- recipcert, mixed recipkey)
-
-Decrypts the MIME message contained in the file named by infilename
-using the certificate and private key pair recipcert/recipkey.
-The descrypted result is placed in outfilename.
-TODO: add flags parameter, if needed?
-
-
-EVP Sign/Verify/Encrypt/Decrypt Functions:
-------------------------------------------
-
-bool openssl_sign(string data, &string signature, mixed key)
-
-Uses key to create signature for data, returns true on success and false
-on failure. signature is passed by reference and contains the newly created
-signature on success.
-
-
-int openssl_verify(string data, string signature, mixed key)
-
-Uses key to verify that the signature is correct for the given data.
-Returns 1 if correct, 0 if incorrect, and -1 on error.
-
-
-int openssl_seal(string data, &string sealdata, &array ekeys, array pubkeys)
-
-Encrypts data using pubkeys, so that only owners of the respective private
-keys and ekeys can decrypt and read the data. Returns the length of the
-sealed data on success, else false. On success, sealdata and ekeys hold
-the sealed data and envelope keys.
-
-
-bool openssl_open(string data, &string opendata, string ekey, int privkey)
-
-Opens (decrypts) sealed data using a private key and the corresponding
-envelope key. Returns true on success and false on failure. On success,
-opendata will hold the descypted data.
-
-
-See below for more details on usage. Also feel free to mail me at
-venaas@php.net if you have questions. The OpenSSL documentation,
-especially the EVP documentation at
-http://www.openssl.org/docs/crypto/evp.html, might also be of help.
-
-
-HOWTO:
-
-To do anything you need a private key and a certificate containing the
-corresponding public key. This is similar to what you have using say an
-Apache webserver with OpenSSL. For testing you could try keys that come
-with OpenSSL, that's what the sample scripts below do. You can also get
-keys from some CA, or you can create them yourself.
-
-
-Creating private key
-
-To generate an unprotected 1024 bit RSA private key you can do
-
- openssl genrsa -out /tmp/test.key 1024
-
-Private keys should be protected by a passphrase though.
-
-
-Creating a self signed certificate
-
-To generate a self signed certificate from the key that is valid for
-365 days, do
-
- openssl req -new -key /tmp/test.key -out /tmp/test.crt -days 365 -x509
-
-
-Example usage
-
-These examples use keys that come with OpenSSL, you should perhaps test with
-those first.
-
-
-Seal and open
-
- <?php
- $data = "Follow the white rabbit";
-
- // Get certificate into a string
- // this file comes with OpenSSL 0.9.6
- $fp = fopen("/src/openssl-0.9.6/demos/maurice/cert.pem", "r");
- $cert = fread($fp, 8192);
- fclose($fp);
- // get public key from certificate
- $pk1 = openssl_get_publickey($cert);
- // $pk1 is an encryption key resource id if success, else false
- // Repeat if want public keys for multiple parties
-
- $fp = fopen("/src/openssl-0.9.6/demos/sign/cert.pem", "r");
- $cert = fread($fp, 8192);
- fclose($fp);
- $pk2 = openssl_get_publickey($cert);
-
- // seal data, only owners of $pk1 and $pk2 can decrypt $sealed with keys
- // $ekeys[0] and $ekeys[1] respectively.
- openssl_seal($data, $sealed, $ekeys, array($pk1,$pk2));
- openssl_free_key($pk1);
- openssl_free_key($pk2);
-
- // now we try to decrypt data for one of the recipients
- $fp = fopen("/src/openssl-0.9.6/demos/sign/key.pem", "r");
- // Get PEM coded key into $pkey
- $pkey = fread($fp, 8192);
- fclose($fp);
- // $key will be resource id for unpacked $pkey
- $key = openssl_get_privatekey($pkey);
-
- openssl_open($sealed, $open, $ekeys[1], $key);
- openssl_free_key($key);
- echo "$open\n";
- ?>
-
-
-Sign and verify
-
- <?php
- $data = "Follow the white rabbit";
-
- // First we need to have a string containing the private key in PEM format
- // this file comes with OpenSSL 0.9.6
- $fp = fopen("/src/openssl-0.9.6/demos/sign/key.pem", "r");
- $pkey = fread($fp, 8192);
- fclose($fp);
-
- // get private key from the PEM format
- // $key is an encr key resource id if success, else false
- $key = openssl_get_privatekey($pkey);
-
- // calculate signature
- openssl_sign($data, $signature, $key);
- openssl_free_key($key);
-
- // recipient verifies signature
- // read certificate
- $fp = fopen("/src/openssl-0.9.6/demos/sign/cert.pem", "r");
- $cert = fread($fp, 8192);
- fclose($fp);
-
- // Get public key from the certificate
- $pubkey = openssl_get_publickey($cert);
-
- // state whether signature is okay or not
- echo openssl_verify($data, $signature, $pubkey) == 1 ? "ok\n" : "bad\n";
-
- // free key
- openssl_free_key($pubkey);
- ?>
diff --git a/ext/openssl/config.m4 b/ext/openssl/config.m4
deleted file mode 100644
index cc8421111c..0000000000
--- a/ext/openssl/config.m4
+++ /dev/null
@@ -1,7 +0,0 @@
-dnl $Id$
-dnl config.m4 for extension OpenSSL
-
-if test "$OPENSSL_DIR"; then
- PHP_EXTENSION(openssl, $ext_shared)
- AC_DEFINE(HAVE_OPENSSL_EXT,1,[ ])
-fi
diff --git a/ext/openssl/openssl.c b/ext/openssl/openssl.c
deleted file mode 100644
index 67b12389f0..0000000000
--- a/ext/openssl/openssl.c
+++ /dev/null
@@ -1,1879 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Stig Venaas <venaas@php.net> |
- | Wez Furlong <wez@thebrainroom.com> |
- | Assymetric en/decryption code by Sascha Kettler <kettler@gmx.net> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "php_openssl.h"
-
-/* PHP Includes */
-#include "ext/standard/file.h"
-#include "ext/standard/info.h"
-
-/* OpenSSL includes */
-#include <openssl/evp.h>
-#include <openssl/x509.h>
-#include <openssl/x509v3.h>
-#include <openssl/crypto.h>
-#include <openssl/pem.h>
-#include <openssl/err.h>
-
-static unsigned char arg2of3_force_ref[] =
- { 3, BYREF_NONE, BYREF_FORCE, BYREF_NONE };
-static unsigned char arg2of4_force_ref[] =
- { 4, BYREF_NONE, BYREF_FORCE, BYREF_NONE, BYREF_NONE };
-static unsigned char arg2and3of4_force_ref[] =
- { 4, BYREF_NONE, BYREF_FORCE, BYREF_FORCE, BYREF_NONE };
-
-/* {{{ openssl_functions[]
- */
-function_entry openssl_functions[] = {
- PHP_FE(openssl_get_privatekey, NULL)
- PHP_FE(openssl_get_publickey, NULL)
- PHP_FE(openssl_free_key, NULL)
-
- PHP_FE(openssl_x509_read, NULL)
- PHP_FE(openssl_x509_free, NULL)
-
- PHP_FE(openssl_x509_parse, NULL)
- PHP_FE(openssl_x509_checkpurpose, NULL)
-
- PHP_FE(openssl_sign, arg2of3_force_ref)
- PHP_FE(openssl_verify, NULL)
- PHP_FE(openssl_seal, arg2and3of4_force_ref)
- PHP_FE(openssl_open, arg2of4_force_ref)
-/* for S/MIME handling */
- PHP_FE(openssl_pkcs7_verify, NULL)
- PHP_FE(openssl_pkcs7_decrypt, NULL)
- PHP_FE(openssl_pkcs7_sign, NULL)
- PHP_FE(openssl_pkcs7_encrypt, NULL)
-
- PHP_FE(openssl_private_encrypt, arg2of3_force_ref)
- PHP_FE(openssl_private_decrypt, arg2of3_force_ref)
- PHP_FE(openssl_public_encrypt, arg2of3_force_ref)
- PHP_FE(openssl_public_decrypt, arg2of3_force_ref)
-
- PHP_FE(openssl_error_string, NULL)
- {NULL, NULL, NULL}
-};
-/* }}} */
-
-/* {{{ openssl_module_entry
- */
-zend_module_entry openssl_module_entry = {
- "openssl",
- openssl_functions,
- PHP_MINIT(openssl),
- NULL,
- NULL,
- NULL,
- PHP_MINFO(openssl),
- STANDARD_MODULE_PROPERTIES
-};
-/* }}} */
-
-#ifdef COMPILE_DL_OPENSSL
-ZEND_GET_MODULE(openssl)
-#endif
-
-static void _php_pkey_free(zend_rsrc_list_entry *rsrc);
-static int le_key;
-
-static void _php_x509_free(zend_rsrc_list_entry *rsrc);
-static int le_x509;
-
-static X509 * php_openssl_x509_from_zval(zval ** val, int makeresource, long * resourceval);
-static EVP_PKEY * php_openssl_evp_from_zval(zval ** val, int public_key, char * passphrase, int makeresource, long * resourceval);
-static X509_STORE * setup_verify(zval * calist);
-static STACK_OF(X509) * load_all_certs_from_file(char *certfile);
-
-/* {{{ PHP_MINIT_FUNCTION
- */
-PHP_MINIT_FUNCTION(openssl)
-{
- le_key = zend_register_list_destructors_ex(_php_pkey_free, NULL, "OpenSSL key", module_number);
- le_x509 = zend_register_list_destructors_ex(_php_x509_free, NULL, "OpenSSL X.509", module_number);
-
- OpenSSL_add_all_ciphers();
-
-/*
- SSL_load_error_strings();
-*/
- ERR_load_ERR_strings();
- ERR_load_crypto_strings();
- ERR_load_EVP_strings();
-
- /* purposes for cert purpose checking */
- REGISTER_LONG_CONSTANT("X509_PURPOSE_SSL_CLIENT", X509_PURPOSE_SSL_CLIENT, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("X509_PURPOSE_SSL_SERVER", X509_PURPOSE_SSL_SERVER, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("X509_PURPOSE_NS_SSL_SERVER", X509_PURPOSE_NS_SSL_SERVER, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("X509_PURPOSE_SMIME_SIGN", X509_PURPOSE_SMIME_SIGN, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("X509_PURPOSE_SMIME_ENCRYPT", X509_PURPOSE_SMIME_ENCRYPT, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("X509_PURPOSE_CRL_SIGN", X509_PURPOSE_CRL_SIGN, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("X509_PURPOSE_ANY", X509_PURPOSE_ANY, CONST_CS|CONST_PERSISTENT);
-
- /* flags for S/MIME */
- REGISTER_LONG_CONSTANT("PKCS7_DETACHED", PKCS7_DETACHED, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("PKCS7_TEXT", PKCS7_TEXT, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("PKCS7_NOINTERN", PKCS7_NOINTERN, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("PKCS7_NOVERIFY", PKCS7_NOVERIFY, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("PKCS7_NOCHAIN", PKCS7_NOCHAIN, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("PKCS7_NOCERTS", PKCS7_NOCERTS, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("PKCS7_NOATTR", PKCS7_NOATTR, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("PKCS7_BINARY", PKCS7_BINARY, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("PKCS7_NOSIGS", PKCS7_NOSIGS, CONST_CS|CONST_PERSISTENT);
-
- REGISTER_LONG_CONSTANT("OPENSSL_PKCS1_PADDING",
- RSA_PKCS1_PADDING,
- CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("OPENSSL_SSLV23_PADDING",
- RSA_SSLV23_PADDING,
- CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("OPENSSL_NO_PADDING",
- RSA_NO_PADDING,
- CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("OPENSSL_PKCS1_OAEP_PADDING",
- RSA_PKCS1_OAEP_PADDING,
- CONST_CS|CONST_PERSISTENT);
-
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_MINFO_FUNCTION
- */
-PHP_MINFO_FUNCTION(openssl)
-{
- php_info_print_table_start();
- php_info_print_table_row(2, "OpenSSL support", "enabled");
- php_info_print_table_row(2, "OpenSSL Version", OPENSSL_VERSION_TEXT);
- php_info_print_table_end();
-}
-/* }}} */
-
-/* {{{ PHP_MSHUTDOWN_FUNCTION
- */
-PHP_MSHUTDOWN_FUNCTION(openssl)
-{
- EVP_cleanup();
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ php_openssl_x509_from_zval
- Given a zval, coerce it into an X509 object.
- The zval can be:
- . X509 resource created using openssl_read_x509()
- . if it starts with file:// then it will be interpreted as the path to that cert
- . it will be interpreted as the cert data
- If you supply makeresource, the result will be registered as an x509 resource and
- it's value returned in makeresource.
-*/
-static X509 * php_openssl_x509_from_zval(zval ** val, int makeresource, long * resourceval)
-{
- X509 *cert = NULL;
-
- if (resourceval)
- *resourceval = -1;
-
- if (Z_TYPE_PP(val) == IS_RESOURCE) {
- /* is it an x509 resource ? */
- void * what;
- int type;
-
- what = zend_fetch_resource(val, -1, "OpenSSL X.509", &type, 1, le_x509);
- if (!what)
- return NULL;
-
- /* this is so callers can decide if they should free the X509 */
- if (resourceval)
- *resourceval = Z_LVAL_PP(val);
-
- if (type == le_x509)
- return (X509*)what;
-
- /* other types could be used here - eg: file pointers and read in the data from them */
-
- return NULL;
- }
- /* force it to be a string and check if it refers to a file */
- convert_to_string_ex(val);
-
- if (Z_STRLEN_PP(val) > 7 && memcmp(Z_STRVAL_PP(val), "file://", 7) == 0) {
- /* read cert from the named file */
- BIO *in;
-
- in = BIO_new_file(Z_STRVAL_PP(val) + 7, "r");
- if (in == NULL)
- return NULL;
- cert = PEM_read_bio_X509(in, NULL, NULL, NULL);
- BIO_free(in);
-
- }
- else {
- BIO *in;
-
- in = BIO_new_mem_buf(Z_STRVAL_PP(val), Z_STRLEN_PP(val));
- if (in == NULL)
- return NULL;
-
- cert = (X509 *) PEM_ASN1_read_bio((char *(*)())d2i_X509,
- PEM_STRING_X509, in,
- NULL, NULL, NULL);
- BIO_free(in);
- }
-
- if (cert && makeresource && resourceval) {
- *resourceval = zend_list_insert(cert, le_x509);
- }
- return cert;
-}
-/* }}} */
-
-/* {{{ php_openssl_evp_from_zval
- Given a zval, coerce it into a EVP_PKEY object.
- It can be:
- 1. private key resource from openssl_get_privatekey()
- 2. X509 resource -> public key will be extracted from it
- 3. if it starts with file:// interpreted as path to key file
- 4. interpreted as the data from the cert/key file and interpreted in same way as openssl_get_privatekey()
- 5. an array(0 => [items 2..4], 1 => passphrase)
- NOTE: If you are requesting a private key but have not specified a passphrase, you should use an
- empty string rather than NULL for the passphrase - NULL causes a passphrase prompt to be emitted in
- the Apache error log!
-*/
-static EVP_PKEY * php_openssl_evp_from_zval(zval ** val, int public_key, char * passphrase, int makeresource, long * resourceval)
-{
- EVP_PKEY * key = NULL;
- X509 * cert = NULL;
- int free_cert = 0;
- long cert_res = -1;
- char * filename = NULL;
-
- if (resourceval)
- *resourceval = -1;
-
- if (Z_TYPE_PP(val) == IS_ARRAY) {
- zval ** zphrase;
-
- /* get passphrase */
-
- if (zend_hash_index_find(HASH_OF(*val), 1, (void **)&zphrase) == FAILURE) {
- zend_error(E_ERROR, "%s(): key array must be of the form array(0 => key, 1 => phrase)", get_active_function_name());
- return NULL;
- }
- convert_to_string_ex(zphrase);
- passphrase = Z_STRVAL_PP(zphrase);
-
- /* now set val to be the key param and continue */
- if (zend_hash_index_find(HASH_OF(*val), 0, (void **)&val) == FAILURE) {
- zend_error(E_ERROR, "%s(): key array must be of the form array(0 => key, 1 => phrase)", get_active_function_name());
- return NULL;
- }
- }
-
- if (Z_TYPE_PP(val) == IS_RESOURCE) {
- void * what;
- int type;
-
- what = zend_fetch_resource(val, -1, "OpenSSL X.509/key", &type, 2, le_x509, le_key);
- if (!what)
- return NULL;
-
- if (resourceval)
- *resourceval = Z_LVAL_PP(val);
-
- if (type == le_x509) {
- /* extract key from cert, depending on public_key param */
- cert = (X509*)what;
- free_cert = 0;
- }
- else if (type == le_key) {
- /* got the key - return it */
- return (EVP_PKEY*)what;
- }
-
- /* other types could be used here - eg: file pointers and read in the data from them */
-
- return NULL;
- }
- else {
- /* force it to be a string and check if it refers to a file */
- convert_to_string_ex(val);
-
- if (Z_STRLEN_PP(val) > 7 && memcmp(Z_STRVAL_PP(val), "file://", 7) == 0)
- filename = Z_STRVAL_PP(val) + 7;
-
- /* it's an X509 file/cert of some kind, and we need to extract the data from that */
- if (public_key) {
- cert = php_openssl_x509_from_zval(val, 0, &cert_res);
- free_cert = (cert_res == -1);
- /* actual extraction done later */
- }
- else {
- /* we want the private key */
- if (filename) {
- BIO *in = BIO_new_file(filename, "r");
- if (in == NULL)
- return NULL;
- key = PEM_read_bio_PrivateKey(in, NULL,NULL, passphrase);
- BIO_free(in);
- }
- else {
- BIO * b = BIO_new_mem_buf(Z_STRVAL_PP(val), Z_STRLEN_PP(val));
- if (b == NULL)
- return NULL;
-
- key = (EVP_PKEY *) PEM_ASN1_read_bio((char *(*)())d2i_PrivateKey,
- PEM_STRING_EVP_PKEY, b,
- NULL, NULL, passphrase);
- BIO_free(b);
- }
- }
- }
-
- if (public_key && cert && key == NULL) {
- /* extract public key from X509 cert */
- key = (EVP_PKEY *) X509_get_pubkey(cert);
- }
-
- if (free_cert && cert)
- X509_free(cert);
-
- if (key && makeresource && resourceval) {
- *resourceval = zend_list_insert(key, le_key);
- }
- return key;
-}
-/* }}} */
-
-/* {{{ proto bool openssl_private_encrypt(string data, string crypted, mixed key [, int padding])
- Encrypt data with private key */
-PHP_FUNCTION(openssl_private_encrypt)
-{
- zval **key, **data, **crypted, **pad;
- EVP_PKEY *pkey;
- int cryptedlen;
- unsigned char *cryptedbuf = NULL;
- int successful = 0;
- int padding;
- long keyresource = -1;
-
- switch (ZEND_NUM_ARGS()) {
- case 3:
- if (zend_get_parameters_ex(3, &data, &crypted, &key) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- padding = RSA_PKCS1_PADDING;
- break;
- case 4:
- if (zend_get_parameters_ex(4, &data, &crypted, &key, &pad) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(pad);
- padding = Z_LVAL_PP(pad);
- break;
- default:
- WRONG_PARAM_COUNT;
- }
-
- RETVAL_FALSE;
-
- convert_to_string_ex(data);
-
- pkey = php_openssl_evp_from_zval(key, 0, "", 0, &keyresource);
-
- if (pkey == NULL) {
- zend_error(E_WARNING, "%s(): key param is not a valid private key", get_active_function_name());
- RETURN_FALSE;
- }
-
- cryptedlen = EVP_PKEY_size(pkey);
- cryptedbuf = emalloc(cryptedlen + 1);
-
- switch (pkey->type) {
- case EVP_PKEY_RSA:
- case EVP_PKEY_RSA2:
- successful = (RSA_private_encrypt(Z_STRLEN_PP(data),
- Z_STRVAL_PP(data),
- cryptedbuf,
- pkey->pkey.rsa,
- padding) == cryptedlen);
- break;
- default:
- zend_error(E_WARNING, "%s(): key type not supported in this PHP build!");
- }
-
- if (successful) {
- zval_dtor(*crypted);
- cryptedbuf[cryptedlen] = '\0';
- ZVAL_STRINGL(*crypted, cryptedbuf, cryptedlen, 0);
- cryptedbuf = NULL;
- RETVAL_TRUE;
- }
- if (cryptedbuf)
- efree(cryptedbuf);
- if (keyresource == -1)
- EVP_PKEY_free(pkey);
-}
-/* }}} */
-
-/* {{{ proto bool openssl_private_decrypt(string data, string crypted, mixed key [, int padding])
- Decrypt data with private key */
-PHP_FUNCTION(openssl_private_decrypt)
-{
- zval **key, **data, **crypted, **pad;
- EVP_PKEY *pkey;
- int cryptedlen;
- unsigned char *cryptedbuf;
- unsigned char *crypttemp;
- int successful = 0;
- int padding;
- long keyresource = -1;
-
- switch (ZEND_NUM_ARGS()) {
- case 3:
- if (zend_get_parameters_ex(3, &data, &crypted, &key) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- padding = RSA_PKCS1_PADDING;
- break;
- case 4:
- if (zend_get_parameters_ex(4, &data, &crypted, &key, &pad) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(pad);
- padding = Z_LVAL_PP(pad);
- break;
- default:
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(data);
-
- RETVAL_FALSE;
-
- pkey = php_openssl_evp_from_zval(key, 0, "", 0, &keyresource);
- if (pkey == NULL) {
- zend_error(E_WARNING, "%s(): key param is not a valid private key", get_active_function_name());
- RETURN_FALSE;
- }
-
- cryptedlen = EVP_PKEY_size(pkey);
- crypttemp = emalloc(cryptedlen + 1);
-
- switch (pkey->type) {
- case EVP_PKEY_RSA:
- case EVP_PKEY_RSA2:
- cryptedlen = RSA_private_decrypt(Z_STRLEN_PP(data),
- Z_STRVAL_PP(data),
- crypttemp,
- pkey->pkey.rsa,
- padding);
- if (cryptedlen != -1) {
- cryptedbuf = emalloc(cryptedlen + 1);
- memcpy(cryptedbuf, crypttemp, cryptedlen);
- successful = 1;
- }
- break;
- default:
- zend_error(E_WARNING, "%s(): key type not supported in this PHP build!");
- }
-
- efree(crypttemp);
-
- if (successful) {
- zval_dtor(*crypted);
- cryptedbuf[cryptedlen] = '\0';
- ZVAL_STRINGL(*crypted, cryptedbuf, cryptedlen, 0);
- cryptedbuf = NULL;
- RETVAL_TRUE;
- }
-
- if (keyresource == -1)
- EVP_PKEY_free(pkey);
- if (cryptedbuf)
- efree(cryptedbuf);
-}
-/* }}} */
-
-/* {{{ proto bool openssl_public_encrypt(string data, string crypted, mixed key [, int padding])
- Encrypt data with public key */
-PHP_FUNCTION(openssl_public_encrypt)
-{
- zval **key, **data, **crypted, **pad;
- EVP_PKEY *pkey;
- int cryptedlen;
- unsigned char *cryptedbuf;
- int successful = 0;
- long keyresource = -1;
- int padding;
-
- switch (ZEND_NUM_ARGS()) {
- case 3:
- if (zend_get_parameters_ex(3, &data, &crypted, &key) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- padding = RSA_PKCS1_PADDING;
- break;
- case 4:
- if (zend_get_parameters_ex(4, &data, &crypted, &key, &pad) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(pad);
- padding = Z_LVAL_PP(pad);
- break;
- default:
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(data);
-
- RETVAL_FALSE;
-
- pkey = php_openssl_evp_from_zval(key, 1, NULL, 0, &keyresource);
- if (pkey == NULL) {
- zend_error(E_WARNING, "%s(): key param is not a valid public key", get_active_function_name());
- RETURN_FALSE;
- }
-
- cryptedlen = EVP_PKEY_size(pkey);
- cryptedbuf = emalloc(cryptedlen + 1);
-
- switch (pkey->type) {
- case EVP_PKEY_RSA:
- case EVP_PKEY_RSA2:
- successful = (RSA_public_encrypt(Z_STRLEN_PP(data),
- Z_STRVAL_PP(data),
- cryptedbuf,
- pkey->pkey.rsa,
- padding) == cryptedlen);
- break;
- default:
- zend_error(E_WARNING, "%s(): key type not supported in this PHP build!");
-
- }
-
- if (successful) {
- zval_dtor(*crypted);
- cryptedbuf[cryptedlen] = '\0';
- ZVAL_STRINGL(*crypted, cryptedbuf, cryptedlen, 0);
- cryptedbuf = NULL;
- RETVAL_TRUE;
- }
- if (keyresource == -1)
- EVP_PKEY_free(pkey);
- if (cryptedbuf)
- efree(cryptedbuf);
-}
-/* }}} */
-
-/* {{{ proto bool openssl_public_decrypt(string data, string crypted, resource key [, int padding])
- Decrypt data with public key */
-PHP_FUNCTION(openssl_public_decrypt)
-{
- zval **key, **data, **crypted, **pad;
- EVP_PKEY *pkey;
- int cryptedlen;
- unsigned char *cryptedbuf;
- unsigned char *crypttemp;
- int successful = 0;
- long keyresource = -1;
- int padding;
-
- switch (ZEND_NUM_ARGS()) {
- case 3:
- if (zend_get_parameters_ex(3, &data, &crypted, &key) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- padding = RSA_PKCS1_PADDING;
- break;
- case 4:
- if (zend_get_parameters_ex(4, &data, &crypted, &key, &pad) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(pad);
- padding = Z_LVAL_PP(pad);
- break;
- default:
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(data);
- RETVAL_FALSE;
-
- pkey = php_openssl_evp_from_zval(key, 1, NULL, 0, &keyresource);
- if (pkey == NULL) {
- zend_error(E_WARNING, "%s(): key param is not a valid public key", get_active_function_name());
- RETURN_FALSE;
- }
-
- cryptedlen = EVP_PKEY_size(pkey);
- crypttemp = emalloc(cryptedlen + 1);
-
- switch (pkey->type) {
- case EVP_PKEY_RSA:
- case EVP_PKEY_RSA2:
- cryptedlen = RSA_public_decrypt(Z_STRLEN_PP(data),
- Z_STRVAL_PP(data),
- crypttemp,
- pkey->pkey.rsa,
- padding);
- if (cryptedlen != -1) {
- cryptedbuf = emalloc(cryptedlen + 1);
- memcpy(cryptedbuf, crypttemp, cryptedlen);
- successful = 1;
- }
- break;
-
- default:
- zend_error(E_WARNING, "%s(): key type not supported in this PHP build!");
-
- }
-
- efree(crypttemp);
-
- if (successful) {
- zval_dtor(*crypted);
- cryptedbuf[cryptedlen] = '\0';
- ZVAL_STRINGL(*crypted, cryptedbuf, cryptedlen, 0);
- cryptedbuf = NULL;
- RETVAL_TRUE;
- }
-
- if (cryptedbuf)
- efree(cryptedbuf);
- if (keyresource == -1)
- EVP_PKEY_free(pkey);
-}
-/* }}} */
-
-/* {{{ proto int openssl_get_privatekey(string key [, string passphrase])
- Get private key */
-PHP_FUNCTION(openssl_get_privatekey)
-{
- zval **key, **passphrase;
- EVP_PKEY *pkey;
- int argc;
-
- argc = ZEND_NUM_ARGS();
- if (argc < 1 || argc > 2 ||
- zend_get_parameters_ex(argc, &key, &passphrase) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(key);
- if (argc == 2) {
- convert_to_string_ex(passphrase);
- }
-
- return_value->type = IS_RESOURCE;
- pkey = php_openssl_evp_from_zval(key, 0, argc == 2 ? Z_STRVAL_PP(passphrase) : "", 1, &(return_value->value.lval));
-
- if (pkey == NULL) {
- zend_error(E_ERROR, "%s(): unable to coerce arg to a private key", get_active_function_name());
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ openssl -> PHP "bridging" */
-
-static void add_assoc_name_entry(zval * val, char * key, X509_NAME * name, int shortname)
-{
- zval * subitem;
- int i;
- char * sn, * ln;
- int nid;
- X509_NAME_ENTRY * ne;
- ASN1_STRING * str;
- ASN1_OBJECT * obj;
-
- MAKE_STD_ZVAL(subitem);
- array_init(subitem);
-
- for (i = 0; i < X509_NAME_entry_count(name); i++) {
- ne = X509_NAME_get_entry(name, i);
- obj = X509_NAME_ENTRY_get_object(ne);
- str = X509_NAME_ENTRY_get_data(ne);
- nid = OBJ_obj2nid(obj);
- if (shortname) {
- sn = (char*)OBJ_nid2sn(nid);
- add_assoc_stringl(subitem, sn, str->data, str->length, 1);
- }
- else {
- ln = (char*)OBJ_nid2ln(nid);
- add_assoc_stringl(subitem, ln, str->data, str->length, 1);
- }
- }
- zend_hash_update(HASH_OF(val), key, strlen(key) + 1, (void *)&subitem, sizeof(subitem), NULL);
-}
-
-static void add_assoc_asn1_string(zval * val, char * key, ASN1_STRING * str)
-{
- add_assoc_stringl(val, key, str->data, str->length, 1);
-}
-
-static time_t asn1_time_to_time_t(ASN1_UTCTIME * timestr)
-{
-/*
- This is how the time string is formatted:
-
- sprintf(p,"%02d%02d%02d%02d%02d%02dZ",ts->tm_year%100,
- ts->tm_mon+1,ts->tm_mday,ts->tm_hour,ts->tm_min,ts->tm_sec);
-*/
-
- time_t ret;
- struct tm thetime;
- char * strbuf;
- char * thestr;
- long gmadjust = 0;
-
- if (timestr->length < 13) {
- zend_error(E_WARNING, "%s(): extension author too lazy to parse %s correctly", get_active_function_name(), timestr->data);
- return (time_t)-1;
- }
-
- strbuf = estrdup(timestr->data);
-
-
- memset(&thetime, 0, sizeof(thetime));
-
- /* we work backwards so that we can use atoi more easily */
-
- thestr = strbuf + timestr->length - 3;
-
- thetime.tm_sec = atoi(thestr);
- *thestr = '\0';
- thestr -= 2;
- thetime.tm_min = atoi(thestr);
- *thestr = '\0';
- thestr -= 2;
- thetime.tm_hour = atoi(thestr);
- *thestr = '\0';
- thestr -= 2;
- thetime.tm_mday = atoi(thestr);
- *thestr = '\0';
- thestr -= 2;
- thetime.tm_mon = atoi(thestr)-1;
- *thestr = '\0';
- thestr -= 2;
- thetime.tm_year = atoi(thestr);
-
- if (thetime.tm_year < 68)
- thetime.tm_year += 100;
-
- thetime.tm_isdst = -1;
- ret = mktime(&thetime);
-
-#if HAVE_TM_GMTOFF
- gmadjust = thetime.tm_gmtoff;
-#else
- /*
- ** If correcting for daylight savings time, we set the adjustment to
- ** the value of timezone - 3600 seconds. Otherwise, we need to overcorrect and
- ** set the adjustment to the main timezone + 3600 seconds.
- */
- gmadjust = -(thetime.tm_isdst ? timezone - 3600 : timezone + 3600);
-#endif
- ret += gmadjust;
-
- efree(strbuf);
-
- return ret;
-}
-/* }}} */
-
-/* {{{ proto array openssl_x509_parse(mixed x509[, bool shortnames=true])
- returns an array of the fields/values of the cert */
-PHP_FUNCTION(openssl_x509_parse)
-{
- zval ** zcert, ** zshort = NULL;
- X509 * cert = NULL;
- long certresource = -1;
- int i;
- int argc = ZEND_NUM_ARGS();
- int useshortnames = 1;
- char * tmpstr;
- zval * subitem;
-
- if (argc < 1 || argc > 2 || zend_get_parameters_ex(argc, &zcert, &zshort) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- if (argc == 2) {
- convert_to_boolean_ex(zshort);
- if (!Z_LVAL_PP(zshort))
- useshortnames = 0;
- }
- cert = php_openssl_x509_from_zval(zcert, 0, &certresource);
- if (cert == NULL)
- RETURN_FALSE;
-
- array_init(return_value);
-
- if (cert->name)
- add_assoc_string(return_value, "name", cert->name, 1);
-/* add_assoc_bool(return_value, "valid", cert->valid); */
-
- add_assoc_name_entry(return_value, "subject", X509_get_subject_name(cert), useshortnames);
- add_assoc_name_entry(return_value, "issuer", X509_get_issuer_name(cert), useshortnames);
- add_assoc_long(return_value, "version", X509_get_version(cert));
- add_assoc_long(return_value, "serialNumber", ASN1_INTEGER_get(X509_get_serialNumber(cert)));
-
- add_assoc_asn1_string(return_value, "validFrom", X509_get_notBefore(cert));
- add_assoc_asn1_string(return_value, "validTo", X509_get_notAfter(cert));
-
- add_assoc_long(return_value, "validFrom_time_t", asn1_time_to_time_t(X509_get_notBefore(cert)));
- add_assoc_long(return_value, "validTo_time_t", asn1_time_to_time_t(X509_get_notAfter(cert)));
-
- tmpstr = X509_alias_get0(cert, NULL);
- if (tmpstr)
- add_assoc_string(return_value, "alias", tmpstr, 1);
-
-/*
- add_assoc_long(return_value, "signaturetypeLONG", X509_get_signature_type(cert));
- add_assoc_string(return_value, "signaturetype", OBJ_nid2sn(X509_get_signature_type(cert)), 1);
- add_assoc_string(return_value, "signaturetypeLN", OBJ_nid2ln(X509_get_signature_type(cert)), 1);
-*/
- MAKE_STD_ZVAL(subitem);
- array_init(subitem);
-
- /* NOTE: the purposes are added as integer keys - the keys match up to the X509_PURPOSE_SSL_XXX defines
- in x509v3.h */
- for (i = 0; i < X509_PURPOSE_get_count(); i++) {
- int id, purpset;
- char * pname;
- X509_PURPOSE * purp;
- zval * subsub;
-
- MAKE_STD_ZVAL(subsub);
- array_init(subsub);
-
- purp = X509_PURPOSE_get0(i);
- id = X509_PURPOSE_get_id(purp);
-
- purpset = X509_check_purpose(cert, id, 0);
- add_index_bool(subsub, 0, purpset);
-
- purpset = X509_check_purpose(cert, id, 1);
- add_index_bool(subsub, 1, purpset);
-
- pname = useshortnames ? X509_PURPOSE_get0_sname(purp) : X509_PURPOSE_get0_name(purp);
- add_index_string(subsub, 2, pname, 1);
-
- /* NOTE: if purpset > 1 then it's a warning - we should mention it ? */
-
- zend_hash_index_update(HASH_OF(subitem), id, (void *)&subsub, sizeof(subsub), NULL);
- }
- zend_hash_update(HASH_OF(return_value), "purposes", strlen("purposes")+1, (void*)&subitem, sizeof(subitem), NULL);
-
- if (certresource == -1 && cert)
- X509_free(cert);
-
-}
-/* }}} */
-
-/* {{{ load_all_certs_from_file */
-static STACK_OF(X509) * load_all_certs_from_file(char *certfile)
-{
- STACK_OF(X509_INFO) *sk=NULL;
- STACK_OF(X509) *stack=NULL, *ret=NULL;
- BIO *in=NULL;
- X509_INFO *xi;
-
- if(!(stack = sk_X509_new_null())) {
- zend_error(E_ERROR, "%s(): memory allocation failure", get_active_function_name());
- goto end;
- }
-
- if(!(in=BIO_new_file(certfile, "r"))) {
- zend_error(E_ERROR, "%s(): error opening the file, %s", get_active_function_name(), certfile);
- goto end;
- }
-
- /* This loads from a file, a stack of x509/crl/pkey sets */
- if(!(sk=PEM_X509_INFO_read_bio(in, NULL, NULL, NULL))) {
- zend_error(E_ERROR, "%s(): error reading the file, %s", get_active_function_name(), certfile);
- goto end;
- }
-
- /* scan over it and pull out the certs */
- while (sk_X509_INFO_num(sk))
- {
- xi=sk_X509_INFO_shift(sk);
- if (xi->x509 != NULL)
- {
- sk_X509_push(stack,xi->x509);
- xi->x509=NULL;
- }
- X509_INFO_free(xi);
- }
- if(!sk_X509_num(stack)) {
- zend_error(E_ERROR, "%s(): no certificates in file, %s", get_active_function_name(), certfile);
- sk_X509_free(stack);
- goto end;
- }
- ret=stack;
-end:
- BIO_free(in);
- sk_X509_INFO_free(sk);
-
- return ret;
-}
-/* }}} */
-
-/* {{{ check_cert */
-static int check_cert(X509_STORE *ctx, X509 *x, STACK_OF(X509) *untrustedchain, int purpose)
-{
- int ret=0;
- X509_STORE_CTX *csc;
-
- csc = X509_STORE_CTX_new();
- if (csc == NULL)
- {
- zend_error(E_ERROR, "%s(): memory allocation failure", get_active_function_name());
- return 0;
- }
- X509_STORE_CTX_init(csc, ctx, x, untrustedchain);
-
- if(purpose >= 0)
- X509_STORE_CTX_set_purpose(csc, purpose);
-
- ret = X509_verify_cert(csc);
- X509_STORE_CTX_free(csc);
-
- return ret;
-}
-/* }}} */
-
-/* {{{ proto int openssl_x509_checkpurpose(mixed x509cert, int purpose, array cainfo[, string untrustedfile])
- check the cert to see if it can be used for the purpose in purpose. cainfo holds information about trusted CAs */
-PHP_FUNCTION(openssl_x509_checkpurpose)
-{
- zval ** zcert, ** zpurpose, ** zcainfo, ** zuntrusted;
- X509_STORE * cainfo = NULL;
- X509 * cert = NULL;
- long certresource = -1;
- STACK_OF(X509) * untrustedchain = NULL;
- int argc;
-
- argc = ZEND_NUM_ARGS();
-
- if (argc < 3 || argc > 4 || zend_get_parameters_ex(argc, &zcert, &zpurpose, &zcainfo, &zuntrusted) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- RETVAL_LONG(-1);
-
- if (argc == 4) {
- convert_to_string_ex(zuntrusted);
- untrustedchain = load_all_certs_from_file(Z_STRVAL_PP(zuntrusted));
- if (untrustedchain == NULL)
- goto clean_exit;
- }
- convert_to_long_ex(zpurpose);
-
- cainfo = setup_verify(*zcainfo);
- if (cainfo == NULL)
- goto clean_exit;
-
- cert = php_openssl_x509_from_zval(zcert, 0, &certresource);
- if (cert == NULL)
- goto clean_exit;
-
- RETVAL_BOOL(check_cert(cainfo, cert, untrustedchain, Z_LVAL_PP(zpurpose)));
-
-clean_exit:
- if (certresource == 1 && cert)
- X509_free(cert);
- if (cainfo)
- X509_STORE_free(cainfo);
- if (untrustedchain)
- sk_X509_pop_free(untrustedchain, X509_free);
-}
-/* }}} */
-
-/* {{{ proto int openssl_get_publickey(mixed cert)
- Get public key from X.509 certificate */
-PHP_FUNCTION(openssl_get_publickey)
-{
- zval **cert;
- EVP_PKEY *pkey;
-
- if (ZEND_NUM_ARGS() != 1 ||
- zend_get_parameters_ex(1, &cert) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- return_value->type = IS_RESOURCE;
- pkey = php_openssl_evp_from_zval(cert, 1, NULL, 1, &(return_value->value.lval));
-
- if (pkey == NULL) {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto void openssl_free_key(int key)
- Free key */
-PHP_FUNCTION(openssl_free_key)
-{
- zval **key;
- EVP_PKEY *pkey;
-
- if (ZEND_NUM_ARGS() != 1 ||
- zend_get_parameters_ex(1, &key) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pkey, EVP_PKEY *, key, -1, "OpenSSL key", le_key);
- zend_list_delete(Z_LVAL_PP(key));
-}
-/* }}} */
-
-/* {{{ proto resource openssl_x509_read(mixed cert)
- Read X.509 certificate */
-PHP_FUNCTION(openssl_x509_read)
-{
- zval **cert;
- X509 *x509;
-
- if (ZEND_NUM_ARGS() != 1 ||
- zend_get_parameters_ex(1, &cert) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- return_value->type = IS_RESOURCE;
- x509 = php_openssl_x509_from_zval(cert, 1, &(return_value->value.lval));
-
- if (x509 == NULL) {
- zend_error(E_ERROR, "%s() supplied parameter cannot be coerced into an X509 certificate!", get_active_function_name());
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto void openssl_free_x509(resource x509)
- Free X.509 certificate */
-PHP_FUNCTION(openssl_x509_free)
-{
- zval **x509;
- X509 *cert;
-
- if (ZEND_NUM_ARGS() != 1 ||
- zend_get_parameters_ex(1, &x509) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- ZEND_FETCH_RESOURCE(cert, X509 *, x509, -1, "OpenSSL X.509", le_x509);
- zend_list_delete(Z_LVAL_PP(x509));
-}
-/* }}} */
-
-/* {{{ setup_verify
- * calist is an array containing file and directory names. create a
- * certificate store and add those certs to it for use in verification.
-*/
-static X509_STORE * setup_verify(zval * calist)
-{
- X509_STORE *store;
- X509_LOOKUP * dir_lookup, * file_lookup;
- HashPosition pos;
- int ndirs = 0, nfiles = 0;
-
- store = X509_STORE_new();
-
- if (store == NULL)
- return NULL;
-
- if (calist && (calist->type == IS_ARRAY)) {
- zend_hash_internal_pointer_reset_ex(HASH_OF(calist), &pos);
- for (;; zend_hash_move_forward_ex(HASH_OF(calist), &pos)) {
- zval ** item;
- struct stat sb;
-
- if (zend_hash_get_current_data_ex(HASH_OF(calist), (void**)&item, &pos) == FAILURE)
- break;
-
- convert_to_string_ex(item);
-
- if (VCWD_STAT(Z_STRVAL_PP(item), &sb) == -1) {
- zend_error(E_WARNING, "%s() unable to stat %s", get_active_function_name(), Z_STRVAL_PP(item));
- continue;
- }
-
- if ((sb.st_mode & S_IFREG) == S_IFREG) {
- file_lookup = X509_STORE_add_lookup(store, X509_LOOKUP_file());
- if (file_lookup == NULL || !X509_LOOKUP_load_file(file_lookup, Z_STRVAL_PP(item), X509_FILETYPE_PEM))
- zend_error(E_WARNING, "%s() error loading file %s", get_active_function_name(), Z_STRVAL_PP(item));
- else
- nfiles++;
- file_lookup = NULL;
- }
- else {
- dir_lookup = X509_STORE_add_lookup(store, X509_LOOKUP_hash_dir());
- if (dir_lookup == NULL || !X509_LOOKUP_add_dir(dir_lookup, Z_STRVAL_PP(item), X509_FILETYPE_PEM))
- zend_error(E_WARNING, "%s() error loading directory %s", get_active_function_name(), Z_STRVAL_PP(item));
- else
- ndirs++;
- dir_lookup = NULL;
- }
- }
- }
- if (nfiles == 0) {
- file_lookup = X509_STORE_add_lookup(store, X509_LOOKUP_file());
- if (file_lookup)
- X509_LOOKUP_load_file(file_lookup, NULL, X509_FILETYPE_DEFAULT);
- }
- if (ndirs == 0) {
- dir_lookup = X509_STORE_add_lookup(store, X509_LOOKUP_hash_dir());
- if (dir_lookup)
- X509_LOOKUP_add_dir(dir_lookup, NULL, X509_FILETYPE_DEFAULT);
- }
- return store;
-}
-/* }}} */
-
-/* {{{ proto mixed openssl_error_string()
- returns a description of the last error, and alters the index of the error messages. returns false when the are no more messages. */
-PHP_FUNCTION(openssl_error_string)
-{
- char buf[512];
- unsigned long val;
-
- if (ZEND_NUM_ARGS() != 0) {
- WRONG_PARAM_COUNT;
- }
-
- val = ERR_get_error();
- if (val)
- {
- RETURN_STRING(ERR_error_string(val, buf), 1);
- }
- else
- {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto bool openssl_pkcs7_verify(string filename, long flags[, string signerscerts][, array cainfo][, string extracerts])
- verify that the data block is intact, the signer is who they say they are, and return the certs of the signers
-*/
-PHP_FUNCTION(openssl_pkcs7_verify)
-{
- X509_STORE * store;
- int argc = ZEND_NUM_ARGS();
- zval ** data, ** zflags, ** signerscerts, ** cainfo = NULL, ** zextracerts;
- char * signersfilename = NULL;
- STACK_OF(X509) *signers= NULL;
- STACK_OF(X509) *others = NULL;
- PKCS7 * p7 = NULL;
- BIO * in = NULL, * datain = NULL;
- int flags = 0;
-
- RETVAL_LONG(-1);
-
- if (argc > 5 || argc < 1) {
- WRONG_PARAM_COUNT;
- }
-
- if (zend_get_parameters_ex(argc, &data, &zflags, &signerscerts, &cainfo, &zextracerts) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if (argc >= 5) {
- convert_to_string_ex(zextracerts);
- others = load_all_certs_from_file(Z_STRVAL_PP(zextracerts));
- if (others == NULL)
- goto clean_exit;
- }
-
- if (argc >= 4) {
- if (Z_TYPE_PP(cainfo) != IS_ARRAY) {
- zend_error(E_ERROR, "%s(): 4th parameter must be an array", get_active_function_name());
- goto clean_exit;
- }
- }
- if (argc >= 3) {
- convert_to_string_ex(signerscerts);
- signersfilename = Z_STRVAL_PP(signerscerts);
- }
-
- convert_to_string_ex(data);
-
- convert_to_long_ex(zflags);
- flags = Z_LVAL_PP(zflags);
-
- store = setup_verify(cainfo ? *cainfo : NULL);
-
- if (!store)
- goto clean_exit;
-
- in = BIO_new_file(Z_STRVAL_PP(data), "r");
- if (in == NULL)
- goto clean_exit;
- p7 = SMIME_read_PKCS7(in, &datain);
- if (p7 == NULL)
- goto clean_exit;
-
- if (PKCS7_verify(p7, others, store, datain, NULL, flags)) {
-
- RETVAL_TRUE;
-
- if (signersfilename) {
- BIO * certout = BIO_new_file(signersfilename, "w");
- if (certout) {
- int i;
- signers = PKCS7_get0_signers(p7, NULL, flags);
-
- for(i = 0; i < sk_X509_num(signers); i++)
- PEM_write_bio_X509(certout, sk_X509_value(signers, i));
-
- BIO_free(certout);
- sk_X509_free(signers);
- }
- else {
- zend_error(E_ERROR, "%s(): signature OK, but cannot open %s for writing",
- get_active_function_name(), signersfilename);
- RETVAL_LONG(-1);
- }
- }
- goto clean_exit;
- }
- else
- RETVAL_FALSE;
-clean_exit:
- X509_STORE_free(store);
- BIO_free(datain);
- BIO_free(in);
- PKCS7_free(p7);
- sk_X509_free(others);
-}
-/* }}} */
-
-/* {{{ proto bool openssl_pkcs7_encrypt(string infile, string outfile, mixed recipcerts, array headers[, long flags])
- encrypt the message in the file named infile with the certificates in recipcerts and output the result to the file named outfile */
-PHP_FUNCTION(openssl_pkcs7_encrypt)
-{
- zval ** zinfilename, ** zoutfilename, ** zrecipcerts, ** zheaders, ** zflags = NULL;
- STACK_OF(X509) * recipcerts = NULL;
- BIO * infile = NULL, * outfile = NULL;
- int flags = 0;
- PKCS7 * p7 = NULL;
- HashPosition hpos;
- zval ** zcertval;
- X509 * cert;
- int argc;
- EVP_CIPHER *cipher = NULL;
- ulong strindexlen, intindex;
- char * strindex;
-
- argc = ZEND_NUM_ARGS();
-
- RETVAL_FALSE;
-
- if (argc < 3 || argc > 5 || zend_get_parameters_ex(argc, &zinfilename, &zoutfilename, &zrecipcerts, &zheaders, &zflags) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(zinfilename);
- convert_to_string_ex(zoutfilename);
-
- if (argc >= 4) {
- if ((*zheaders)->type == IS_NULL)
- zheaders = NULL;
- else if ((*zheaders)->type != IS_ARRAY) {
- zend_error(E_ERROR, "%s(): 4th param must be an array/null value!", get_active_function_name());
- goto clean_exit;
- }
- }
-
-
- if (argc >= 5) {
- convert_to_long_ex(zflags);
- flags = Z_LVAL_PP(zflags);
- }
-
- infile = BIO_new_file(Z_STRVAL_PP(zinfilename), "r");
- if (infile == NULL)
- goto clean_exit;
-
- outfile = BIO_new_file(Z_STRVAL_PP(zoutfilename), "w");
- if (outfile == NULL)
- goto clean_exit;
-
- recipcerts = sk_X509_new_null();
-
- /* get certs */
- if (Z_TYPE_PP(zrecipcerts) == IS_ARRAY) {
- zend_hash_internal_pointer_reset_ex(HASH_OF(*zrecipcerts), &hpos);
- while(zend_hash_get_current_data_ex(HASH_OF(*zrecipcerts), (void**)&zcertval, &hpos) == SUCCESS) {
- long certresource;
-
- cert = php_openssl_x509_from_zval(zcertval, 0, &certresource);
- if (cert == NULL)
- goto clean_exit;
-
- if (certresource != -1) {
- /* we shouldn't free this particular cert, as it is a resource.
- make a copy and push that on the stack instead */
- cert = X509_dup(cert);
- if (cert == NULL)
- goto clean_exit;
- }
- sk_X509_push(recipcerts, cert);
-
- zend_hash_move_forward_ex(HASH_OF(*zrecipcerts), &hpos);
- }
- }
- else {
- /* a single certificate */
- long certresource;
-
- cert = php_openssl_x509_from_zval(zrecipcerts, 0, &certresource);
- if (cert == NULL)
- goto clean_exit;
-
- if (certresource != -1) {
- /* we shouldn't free this particular cert, as it is a resource.
- make a copy and push that on the stack instead */
- cert = X509_dup(cert);
- if (cert == NULL)
- goto clean_exit;
- }
- sk_X509_push(recipcerts, cert);
- }
-
- /* TODO: allow user to choose a different cipher */
- cipher = EVP_rc2_40_cbc();
- if (cipher == NULL)
- goto clean_exit;
-
- p7 = PKCS7_encrypt(recipcerts, infile, cipher, flags);
-
- if (p7 == NULL)
- goto clean_exit;
-
- /* tack on extra headers */
- zend_hash_internal_pointer_reset_ex(HASH_OF(*zheaders), &hpos);
- while(zend_hash_get_current_data_ex(HASH_OF(*zheaders), (void**)&zcertval, &hpos) == SUCCESS) {
- zend_hash_get_current_key_ex(HASH_OF(*zheaders), &strindex, &strindexlen, &intindex, 0, &hpos);
-
- convert_to_string_ex(zcertval);
-
- if (strindex)
- BIO_printf(outfile, "%s: %s\n", strindex, Z_STRVAL_PP(zcertval));
- else
- BIO_printf(outfile, "%s\n", Z_STRVAL_PP(zcertval));
-
- zend_hash_move_forward_ex(HASH_OF(*zheaders), &hpos);
- }
-
- BIO_reset(infile);
-
- /* write the encrypted data */
- SMIME_write_PKCS7(outfile, p7, infile, flags);
-
- RETVAL_TRUE;
-
-
-clean_exit:
- PKCS7_free(p7);
- BIO_free(infile);
- BIO_free(outfile);
- if (recipcerts)
- sk_X509_pop_free(recipcerts, X509_free);
-
-}
-/* }}} */
-
-/* {{{ proto bool openssl_pkcs7_sign(string infile, string outfile, mixed signcert, mixed signkey, array headers[, long flags][, string extracertsfilename])
- sign the MIME message in the file named infile with signcert/signkey and output the result to file name outfile. headers lists plain text headers to exclude from the signed portion of the message, and should include to, from and subject as a minimum */
-
-PHP_FUNCTION(openssl_pkcs7_sign)
-{
- zval ** zinfilename, ** zoutfilename, ** zcert, ** zprivkey, ** zheaders, ** zflags = NULL, ** zextracerts;
- zval ** hval;
- X509 * cert = NULL;
- EVP_PKEY * privkey = NULL;
- int flags = PKCS7_DETACHED, argc;
- PKCS7 * p7 = NULL;
- BIO * infile = NULL, * outfile = NULL;
- STACK_OF(X509) *others = NULL;
- long certresource = -1, keyresource = -1;
- ulong strindexlen, intindex;
- HashPosition hpos;
- char * strindex;
-
- argc = ZEND_NUM_ARGS();
-
- RETVAL_FALSE;
-
- if (argc < 5 || argc > 7 || zend_get_parameters_ex(argc, &zinfilename, &zoutfilename, &zcert, &zprivkey, &zheaders, &zflags, &zextracerts) == FAILURE)
- {
- WRONG_PARAM_COUNT;
- }
-
- if (argc >= 7) {
- convert_to_string_ex(zextracerts);
- others = load_all_certs_from_file(Z_STRVAL_PP(zextracerts));
- if (others == NULL)
- goto clean_exit;
- }
-
- if (argc >= 6) {
- convert_to_long_ex(zflags);
- flags = Z_LVAL_PP(zflags);
- }
- if (argc >= 5) {
- if ((*zheaders)->type == IS_NULL)
- zheaders = NULL;
- else if ((*zheaders)->type != IS_ARRAY) {
- zend_error(E_ERROR, "%s(): 5th param must be an array/null value!", get_active_function_name());
- goto clean_exit;
- }
- }
-
- convert_to_string_ex(zinfilename);
- convert_to_string_ex(zoutfilename);
-
- privkey = php_openssl_evp_from_zval(zprivkey, 0, "", 0, &keyresource);
- if (privkey == NULL) {
- zend_error(E_ERROR, "%s(): error getting private key", get_active_function_name());
- goto clean_exit;
- }
-
- cert = php_openssl_x509_from_zval(zcert, 0, &certresource);
- if (cert == NULL) {
- zend_error(E_ERROR, "%s(): error getting cert", get_active_function_name());
- goto clean_exit;
- }
-
- infile = BIO_new_file(Z_STRVAL_PP(zinfilename), "r");
- if (infile == NULL) {
- zend_error(E_ERROR, "%s(): error opening input file %s!", get_active_function_name(), Z_STRVAL_PP(zinfilename));
- goto clean_exit;
- }
-
- outfile = BIO_new_file(Z_STRVAL_PP(zoutfilename), "w");
- if (outfile == NULL) {
- zend_error(E_ERROR, "%s(): error opening output file %s!", get_active_function_name(), Z_STRVAL_PP(zoutfilename));
- goto clean_exit;
- }
-
- p7 = PKCS7_sign(cert, privkey, others, infile, flags);
- if (p7 == NULL) {
- zend_error(E_ERROR, "%s(): error creating PKCS7 structure!", get_active_function_name());
- goto clean_exit;
- }
-
- BIO_reset(infile);
-
- /* tack on extra headers */
- zend_hash_internal_pointer_reset_ex(HASH_OF(*zheaders), &hpos);
- while(zend_hash_get_current_data_ex(HASH_OF(*zheaders), (void**)&hval, &hpos) == SUCCESS) {
- zend_hash_get_current_key_ex(HASH_OF(*zheaders), &strindex, &strindexlen, &intindex, 0, &hpos);
-
- convert_to_string_ex(hval);
-
- if (strindex)
- BIO_printf(outfile, "%s: %s\n", strindex, Z_STRVAL_PP(hval));
- else
- BIO_printf(outfile, "%s\n", Z_STRVAL_PP(hval));
-
- zend_hash_move_forward_ex(HASH_OF(*zheaders), &hpos);
- }
-
- /* write the signed data */
- SMIME_write_PKCS7(outfile, p7, infile, flags);
-
- RETVAL_TRUE;
-
-clean_exit:
- PKCS7_free(p7);
- BIO_free(infile);
- BIO_free(outfile);
- if (others)
- sk_X509_pop_free(others, X509_free);
- if (privkey && keyresource == -1)
- EVP_PKEY_free(privkey);
- if (cert && certresource == -1)
- X509_free(cert);
-}
-/* }}} */
-
-/* {{{ proto bool openssl_pkcs7_decrypt(string infilename, string outfilename, mixed recipcert[, mixed recipkey])
- decrypt the S/MIME message in the file name infilename and output the results to the file name outfilename. recipcert is a cert for one of the recipients. recipkey specifies the private key matching recipcert, if recipcert does not include the key */
-
-PHP_FUNCTION(openssl_pkcs7_decrypt)
-{
- zval ** infilename, ** outfilename, ** recipcert, ** recipkey;
- int argc = ZEND_NUM_ARGS();
- X509 * cert = NULL;
- EVP_PKEY * key = NULL;
- long certresval, keyresval;
- BIO * in = NULL, * out = NULL, * datain = NULL;
- PKCS7 * p7 = NULL;
-
- if (argc > 4 || argc < 3 || zend_get_parameters_ex(argc, &infilename, &outfilename, &recipcert, &recipkey) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- RETVAL_FALSE;
-
- cert = php_openssl_x509_from_zval(recipcert, 0, &certresval);
- if (cert == NULL) {
- zend_error(E_ERROR, "%s(): unable to coerce param 3 to x509 cert", get_active_function_name());
- goto clean_exit;
- }
-
- key = php_openssl_evp_from_zval(argc == 3 ? recipcert : recipkey, 0, "", 0, &keyresval);
- if (key == NULL) {
- zend_error(E_ERROR, "%s(): unable to coerce param %d to a private key", get_active_function_name(), argc);
- goto clean_exit;
- }
-
- convert_to_string_ex(outfilename);
- convert_to_string_ex(infilename);
-
- in = BIO_new_file(Z_STRVAL_PP(infilename), "r");
- if (in == NULL) {
- goto clean_exit;
- }
- out = BIO_new_file(Z_STRVAL_PP(outfilename), "w");
- if (out == NULL) {
- goto clean_exit;
- }
-
- p7 = SMIME_read_PKCS7(in, &datain);
-
- if (p7 == NULL)
- goto clean_exit;
-
- if (PKCS7_decrypt(p7, key, cert, out, PKCS7_DETACHED))
- RETVAL_TRUE;
-
-clean_exit:
- PKCS7_free(p7);
- BIO_free(datain);
- BIO_free(in);
- BIO_free(out);
- if (cert && certresval == -1)
- X509_free(cert);
- if (key && keyresval == -1)
- EVP_PKEY_free(key);
-}
-/* }}} */
-
-/* {{{ proto bool openssl_sign(string data, &string signature, mixed key)
- Sign data */
-PHP_FUNCTION(openssl_sign)
-{
- zval **key, **data, **signature;
- EVP_PKEY *pkey;
- int siglen;
- unsigned char *sigbuf;
- long keyresource = -1;
- EVP_MD_CTX md_ctx;
-
- if (ZEND_NUM_ARGS() != 3 ||
- zend_get_parameters_ex(3, &data, &signature, &key) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(data);
-
- pkey = php_openssl_evp_from_zval(key, 0, "", 0, &keyresource);
- if (pkey == NULL) {
- zend_error(E_ERROR, "%s(): supplied key param cannot be coerced into a private key", get_active_function_name());
- RETURN_FALSE;
- }
-
- siglen = EVP_PKEY_size(pkey);
- sigbuf = emalloc(siglen + 1);
-
- EVP_SignInit(&md_ctx, EVP_sha1());
- EVP_SignUpdate(&md_ctx, Z_STRVAL_PP(data), Z_STRLEN_PP(data));
- if (EVP_SignFinal (&md_ctx, sigbuf, &siglen, pkey)) {
- zval_dtor(*signature);
- sigbuf[siglen] = '\0';
- ZVAL_STRINGL(*signature, sigbuf, siglen, 0);
- RETVAL_TRUE;
- } else {
- efree(sigbuf);
- RETVAL_FALSE;
- }
- if (keyresource == -1)
- EVP_PKEY_free(pkey);
-}
-/* }}} */
-
-/* {{{ proto int openssl_verify(string data, string signature, mixed key)
- Verify data */
-PHP_FUNCTION(openssl_verify)
-{
- zval **key, **data, **signature;
- EVP_PKEY *pkey;
- int err;
- EVP_MD_CTX md_ctx;
- long keyresource = -1;
-
- if (ZEND_NUM_ARGS() != 3 ||
- zend_get_parameters_ex(3, &data, &signature, &key) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(data);
- convert_to_string_ex(signature);
-
- pkey = php_openssl_evp_from_zval(key, 1, NULL, 0, &keyresource);
- if (pkey == NULL) {
- zend_error(E_ERROR, "%s(): supplied key param cannot be coerced into a public key", get_active_function_name());
- RETURN_FALSE;
- }
-
- EVP_VerifyInit (&md_ctx, EVP_sha1());
- EVP_VerifyUpdate (&md_ctx, Z_STRVAL_PP(data), Z_STRLEN_PP(data));
- err = EVP_VerifyFinal (&md_ctx, Z_STRVAL_PP(signature),
- Z_STRLEN_PP(signature), pkey);
-
- if (keyresource == -1)
- EVP_PKEY_free(pkey);
-
- RETURN_LONG(err);
-}
-/* }}} */
-
-/* {{{ proto int openssl_seal(string data, &string sealdata, &array ekeys, array pubkeys)
- Seal data */
-PHP_FUNCTION(openssl_seal)
-{
- zval **pubkeys, **pubkey, **data, **sealdata, **ekeys;
- HashTable *pubkeysht;
- HashPosition pos;
- EVP_PKEY **pkeys;
- long * key_resources; /* so we know what to cleanup */
- int i, len1, len2, *eksl, nkeys;
- unsigned char *buf = NULL, **eks;
-
- EVP_CIPHER_CTX ctx;
-
- if (ZEND_NUM_ARGS() != 4 ||
- zend_get_parameters_ex(4, &data, &sealdata, &ekeys,
- &pubkeys) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- SEPARATE_ZVAL(pubkeys);
- pubkeysht = HASH_OF(*pubkeys);
- nkeys = pubkeysht ? zend_hash_num_elements(pubkeysht) : 0;
- if (!nkeys) {
- php_error(E_WARNING,
- "Fourth argument to openssl_seal() must be a non-empty array");
- RETURN_FALSE;
- }
-
- pkeys = emalloc(nkeys * sizeof(*pkeys));
- eksl = emalloc(nkeys * sizeof(*eksl));
- eks = emalloc(nkeys * sizeof(*eks));
- key_resources = emalloc(nkeys * sizeof(long));
-
- convert_to_string_ex(data);
-
- /* get the public keys we are using to seal this data */
- zend_hash_internal_pointer_reset_ex(pubkeysht, &pos);
- i = 0;
- while (zend_hash_get_current_data_ex(pubkeysht, (void **) &pubkey,
- &pos) == SUCCESS) {
- pkeys[i] = php_openssl_evp_from_zval(pubkey, 1, NULL, 0, &key_resources[i]);
- if (pkeys[i] == NULL) {
- zend_error(E_ERROR, "%s(): not a public key (%dth member of pubkeys)", get_active_function_name(), i);
- RETVAL_FALSE;
- goto clean_exit;
- }
- eks[i] = emalloc(EVP_PKEY_size(pkeys[i]) + 1);
- zend_hash_move_forward_ex(pubkeysht, &pos);
- i++;
- }
-
-#if OPENSSL_VERSION_NUMBER >= 0x0090600fL
- if (!EVP_EncryptInit(&ctx,EVP_rc4(),NULL,NULL)) {
- RETVAL_FALSE;
- goto clean_exit;
- }
-#else
- EVP_EncryptInit(&ctx,EVP_rc4(),NULL,NULL);
-#endif
-
-#if 0
- /* Need this if allow ciphers that require initialization vector */
- ivlen = EVP_CIPHER_CTX_iv_length(&ctx);
- iv = ivlen ? emalloc(ivlen + 1) : NULL;
-#endif
- /* allocate one byte extra to make room for \0 */
- buf = emalloc(Z_STRLEN_PP(data) + EVP_CIPHER_CTX_block_size(&ctx));
-
- if (!EVP_SealInit(&ctx, EVP_rc4(), eks, eksl, NULL, pkeys, nkeys)
-#if OPENSSL_VERSION_NUMBER >= 0x0090600fL
- || !EVP_SealUpdate(&ctx, buf, &len1, Z_STRVAL_PP(data),
- Z_STRLEN_PP(data))
-#endif
- ) {
- RETVAL_FALSE;
- efree(buf);
- goto clean_exit;
-
- }
-
-#if OPENSSL_VERSION_NUMBER < 0x0090600fL
- EVP_SealUpdate(&ctx, buf, &len1, Z_STRVAL_PP(data), Z_STRLEN_PP(data));
-#endif
- EVP_SealFinal(&ctx, buf + len1, &len2);
-
- if (len1 + len2 > 0) {
- zval_dtor(*sealdata);
- buf[len1 + len2] = '\0';
- buf = erealloc(buf, len1 + len2 + 1);
- ZVAL_STRINGL(*sealdata, buf, len1 + len2, 0);
-
- zval_dtor(*ekeys);
- if (array_init(*ekeys) == FAILURE) {
- php_error(E_ERROR, "Cannot initialize return value");
- RETVAL_FALSE;
- efree(buf);
- goto clean_exit;
- }
- for (i=0; i<nkeys; i++) {
- eks[i][eksl[i]] = '\0';
- add_next_index_stringl(*ekeys, erealloc(eks[i], eksl[i] + 1), eksl[i], 0);
- eks[i] = NULL;
- }
-#if 0
- /* If allow ciphers that need IV, we need this */
- zval_dtor(*ivec);
- if (ivlen) {
- iv[ivlen] = '\0';
- ZVAL_STRINGL(*ivec, erealloc(iv, ivlen + 1), ivlen, 0);
- } else {
- ZVAL_EMPTY_STRING(*ivec);
- }
-#endif
- }
- else
- efree(buf);
-
- RETVAL_LONG(len1 + len2);
-
-clean_exit:
- for (i=0; i<nkeys; i++) {
- if (key_resources[i] == -1)
- EVP_PKEY_free(pkeys[i]);
- if (eks[i])
- efree(eks[i]);
- }
- efree(eks);
- efree(eksl);
- efree(pkeys);
- efree(key_resources);
-}
-/* }}} */
-
-/* {{{ proto bool openssl_open(string data, &string opendata, string ekey, mixed privkey)
- Open data */
-PHP_FUNCTION(openssl_open)
-{
- zval **privkey, **data, **opendata, **ekey;
- EVP_PKEY *pkey;
- int len1, len2;
- unsigned char *buf;
- long keyresource = -1;
- EVP_CIPHER_CTX ctx;
-
- if (ZEND_NUM_ARGS() != 4 ||
- zend_get_parameters_ex(4, &data, &opendata, &ekey,
- &privkey) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(data);
- convert_to_string_ex(ekey);
-
- pkey = php_openssl_evp_from_zval(privkey, 0, "", 0, &keyresource);
- if (pkey == NULL) {
- zend_error(E_ERROR, "%s(): unable to coerce param 4 into a private key", get_active_function_name());
- RETURN_FALSE;
- }
- buf = emalloc(Z_STRLEN_PP(data) + 1);
-
- if (EVP_OpenInit(&ctx, EVP_rc4(), Z_STRVAL_PP(ekey),
- Z_STRLEN_PP(ekey), NULL, pkey)
-#if OPENSSL_VERSION_NUMBER >= 0x0090600fL
- && EVP_OpenUpdate(&ctx, buf, &len1, Z_STRVAL_PP(data),
- Z_STRLEN_PP(data))
-#endif
- ) {
-#if OPENSSL_VERSION_NUMBER < 0x0090600fL
- EVP_OpenUpdate(&ctx, buf, &len1, Z_STRVAL_PP(data),
- Z_STRLEN_PP(data));
-#endif
- if (!EVP_OpenFinal(&ctx, buf + len1, &len2) ||
- (len1 + len2 == 0)) {
- efree(buf);
- if (keyresource == -1)
- EVP_PKEY_free(pkey);
- RETURN_FALSE;
- }
- } else {
- efree(buf);
- if (keyresource == -1)
- EVP_PKEY_free(pkey);
-
- RETURN_FALSE;
- }
- if (keyresource == -1)
- EVP_PKEY_free(pkey);
-
- zval_dtor(*opendata);
- buf[len1 + len2] = '\0';
- ZVAL_STRINGL(*opendata, erealloc(buf, len1 + len2 + 1), len1 + len2, 0);
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ _php_pkey_free() */
-static void _php_pkey_free(zend_rsrc_list_entry *rsrc)
-{
- EVP_PKEY *pkey = (EVP_PKEY *)rsrc->ptr;
- EVP_PKEY_free(pkey);
-}
-/* }}} */
-
-/* {{{ _php_x509_free() */
-static void _php_x509_free(zend_rsrc_list_entry *rsrc)
-{
- X509 *x509 = (X509 *)rsrc->ptr;
- X509_free(x509);
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 8
- * c-basic-offset: 8
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/openssl/openssl.dsp b/ext/openssl/openssl.dsp
deleted file mode 100644
index 5212a27a70..0000000000
--- a/ext/openssl/openssl.dsp
+++ /dev/null
@@ -1,107 +0,0 @@
-# Microsoft Developer Studio Project File - Name="openssl" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=openssl - Win32 Debug_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "openssl.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "openssl.mak" CFG="openssl - Win32 Debug_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "openssl - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "openssl - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "openssl - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "OPENSSL_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\TSRM" /D ZEND_DEBUG=0 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "PHP_EXPORTS" /D "COMPILE_DL_OPENSSL" /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_OPENSSL_EXT=1 /D ZTS=1 /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x407 /d "NDEBUG"
-# ADD RSC /l 0x407 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 php4ts.lib ssleay32.lib libeay32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_openssl.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
-
-!ELSEIF "$(CFG)" == "openssl - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "OPENSSL_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\TSRM" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "PHP_EXPORTS" /D "COMPILE_DL_OPENSSL" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_OPENSSL_EXT=1 /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x407 /d "_DEBUG"
-# ADD RSC /l 0x407 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 php4ts_debug.lib ssleay32.lib libeay32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"..\..\Debug_TS/php_openssl.dll" /pdbtype:sept /libpath:"..\..\Debug_TS"
-
-!ENDIF
-
-# Begin Target
-
-# Name "openssl - Win32 Release_TS"
-# Name "openssl - Win32 Debug_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\openssl.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_openssl.h
-# End Source File
-# End Group
-# End Target
-# End Project
diff --git a/ext/openssl/php_openssl.h b/ext/openssl/php_openssl.h
deleted file mode 100644
index 65955f9509..0000000000
--- a/ext/openssl/php_openssl.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Stig Venaas <venaas@php.net> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifndef PHP_OPENSSL_H
-#define PHP_OPENSSL_H
-/* HAVE_OPENSSL would include SSL MySQL stuff */
-#if HAVE_OPENSSL_EXT
-extern zend_module_entry openssl_module_entry;
-#define phpext_openssl_ptr &openssl_module_entry
-
-PHP_MINIT_FUNCTION(openssl);
-PHP_MSHUTDOWN_FUNCTION(openssl);
-PHP_MINFO_FUNCTION(openssl);
-PHP_FUNCTION(openssl_get_privatekey);
-PHP_FUNCTION(openssl_get_publickey);
-PHP_FUNCTION(openssl_free_key);
-PHP_FUNCTION(openssl_x509_read);
-PHP_FUNCTION(openssl_x509_free);
-PHP_FUNCTION(openssl_sign);
-PHP_FUNCTION(openssl_verify);
-PHP_FUNCTION(openssl_seal);
-PHP_FUNCTION(openssl_open);
-PHP_FUNCTION(openssl_private_encrypt);
-PHP_FUNCTION(openssl_private_decrypt);
-PHP_FUNCTION(openssl_public_encrypt);
-PHP_FUNCTION(openssl_public_decrypt);
-
-PHP_FUNCTION(openssl_pkcs7_verify);
-PHP_FUNCTION(openssl_pkcs7_decrypt);
-PHP_FUNCTION(openssl_pkcs7_sign);
-PHP_FUNCTION(openssl_pkcs7_encrypt);
-
-PHP_FUNCTION(openssl_error_string);
-PHP_FUNCTION(openssl_x509_parse);
-PHP_FUNCTION(openssl_x509_checkpurpose);
-
-#else
-
-#define phpext_openssl_ptr NULL
-
-#endif
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/oracle/CREDITS b/ext/oracle/CREDITS
deleted file mode 100644
index f06045fdcb..0000000000
--- a/ext/oracle/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-Oracle
-Stig Bakken, Mitch Golden, Rasmus Lerdorf, Andreas Karajannis, Thies C. Arntzen
diff --git a/ext/oracle/Makefile.in b/ext/oracle/Makefile.in
deleted file mode 100644
index dc9cb9a0bc..0000000000
--- a/ext/oracle/Makefile.in
+++ /dev/null
@@ -1,6 +0,0 @@
-LTLIBRARY_NAME = liboracle.la
-LTLIBRARY_SOURCES = oracle.c
-LTLIBRARY_SHARED_NAME = oracle.la
-LTLIBRARY_SHARED_LIBADD = $(ORACLE_SHARED_LIBADD)
-
-include $(top_srcdir)/build/dynlib.mk
diff --git a/ext/oracle/config.m4 b/ext/oracle/config.m4
deleted file mode 100644
index 7dc8722936..0000000000
--- a/ext/oracle/config.m4
+++ /dev/null
@@ -1,165 +0,0 @@
-dnl $Id$
-
-AC_DEFUN(AC_ORACLE_VERSION,[
- AC_MSG_CHECKING([Oracle version])
- if test -s "$ORACLE_DIR/orainst/unix.rgs"; then
- ORACLE_VERSION=`grep '"ocommon"' $ORACLE_DIR/orainst/unix.rgs | sed 's/[ ][ ]*/:/g' | cut -d: -f 6 | cut -c 2-4`
- test -z "$ORACLE_VERSION" && ORACLE_VERSION=7.3
- elif test -f $ORACLE_DIR/lib/libclntsh.s?.8.0; then
- ORACLE_VERSION=8.1
- elif test -f $ORACLE_DIR/lib/libclntsh.s?.1.0; then
- ORACLE_VERSION=8.0
- elif test -f $ORACLE_DIR/lib/libclntsh.a; then
- if test -f $ORACLE_DIR/lib/libcore4.a; then
- ORACLE_VERSION=8.0
- else
- ORACLE_VERSION=8.1
- fi
- else
- AC_MSG_ERROR(Oracle needed libraries not found)
- fi
- AC_MSG_RESULT($ORACLE_VERSION)
-])
-
-PHP_ARG_WITH(oracle, for Oracle-ORACLE support,
-[ --with-oracle[=DIR] Include Oracle-oci7 support. Default DIR is
- ORACLE_HOME.])
-
-if test "$PHP_ORACLE" != "no"; then
- AC_MSG_CHECKING([Oracle Install-Dir])
- if test "$PHP_ORACLE" = "yes"; then
- ORACLE_DIR=$ORACLE_HOME
- else
- ORACLE_DIR=$PHP_ORACLE
- fi
- AC_MSG_RESULT($ORACLE_DIR)
-
- if test "$PHP_SIGCHILD" != "yes"; then
- echo "+--------------------------------------------------------------------+"
- echo "| Notice: |"
- echo "| If you encounter <defunc> processes when using a local Oracle-DB |"
- echo "| please recompile PHP and specify --enable-sigchild when configuring|"
- echo "| (This problem has been reported un Linux using Oracle >= 8.1.5) |"
- echo "+--------------------------------------------------------------------+"
- fi
-
- if test -d "$ORACLE_DIR/rdbms/public"; then
- PHP_ADD_INCLUDE($ORACLE_DIR/rdbms/public)
- fi
- if test -d "$ORACLE_DIR/rdbms/demo"; then
- PHP_ADD_INCLUDE($ORACLE_DIR/rdbms/demo)
- fi
- if test -d "$ORACLE_DIR/network/public"; then
- PHP_ADD_INCLUDE($ORACLE_DIR/network/public)
- fi
- if test -d "$ORACLE_DIR/plsql/public"; then
- PHP_ADD_INCLUDE($ORACLE_DIR/plsql/public)
- fi
-
- if test -f "$ORACLE_DIR/lib/sysliblist"; then
- PHP_EVAL_LIBLINE(`cat $ORACLE_DIR/lib/sysliblist`, ORACLE_SHARED_LIBADD)
- elif test -f "$ORACLE_DIR/rdbms/lib/sysliblist"; then
- PHP_EVAL_LIBLINE(`cat $ORACLE_DIR/rdbms/lib/sysliblist`, ORACLE_SHARED_LIBADD)
- fi
-
- AC_ORACLE_VERSION($ORACLE_DIR)
- case $ORACLE_VERSION in
- 7.0|7.1)
- if test -f $ORACLE_DIR/lib/liboracle.s?; then
- PHP_ADD_LIBRARY_WITH_PATH(oracle, $ORACLE_DIR/lib, ORACLE_SHARED_LIBADD)
- else
- PHP_ADD_LIBRARY_WITH_PATH(core, $ORACLE_DIR/lib, ORACLE_SHARED_LIBADD)
- PHP_ADD_LIBRARY_WITH_PATH(cv6, $ORACLE_DIR/lib, ORACLE_SHARED_LIBADD)
- PHP_ADD_LIBRARY_WITH_PATH(nlsrtl, $ORACLE_DIR/lib, ORACLE_SHARED_LIBADD)
- PHP_ADD_LIBRARY_WITH_PATH(core, $ORACLE_DIR/lib, ORACLE_SHARED_LIBADD)
- PHP_ADD_LIBRARY_WITH_PATH(cv6, $ORACLE_DIR/lib, ORACLE_SHARED_LIBADD)
- PHP_ADD_LIBRARY_WITH_PATH(nlsrtl, $ORACLE_DIR/lib, ORACLE_SHARED_LIBADD)
- PHP_ADD_LIBRARY_WITH_PATH(sqlnet, $ORACLE_DIR/lib, ORACLE_SHARED_LIBADD)
- PHP_ADD_LIBRARY_WITH_PATH(ora, $ORACLE_DIR/lib, ORACLE_SHARED_LIBADD)
- PHP_ADD_LIBRARY_WITH_PATH(sqlnet, $ORACLE_DIR/lib, ORACLE_SHARED_LIBADD)
- if test "$ext_shared" = "yes"; then
- ORACLE_SHARED_LIBADD="$ORACLE_DIR/lib/osntab.o $ORACLE_SHARED_LIBADD";
- else
- LIBS="$ORACLE_DIR/lib/osntab.o $LIBS";
- fi
- PHP_ADD_LIBRARY_WITH_PATH(ocic, $ORACLE_DIR/lib, ORACLE_SHARED_LIBADD)
- if test "`uname -s 2>/dev/null`" = "AIX"; then
- if test "$ext_shared" = "yes"; then
- ORACLE_SHARED_LIBADD="$ORACLE_SHARED_LIBADD -bI:$ORACLE_DIR/lib/mili.exp"
- else
- LIBS="$LIBS -bI:$ORACLE_DIR/lib/mili.exp"
- fi
- fi
- fi
- ;;
-
- 7.2)
- if test -f $ORACLE_DIR/lib/libclntsh.s?; then
- PHP_ADD_LIBRARY_WITH_PATH(clntsh, $ORACLE_DIR/lib, ORACLE_SHARED_LIBADD)
- else
- PHP_ADD_LIBRARY_WITH_PATH(core3, $ORACLE_DIR/lib, ORACLE_SHARED_LIBADD)
- PHP_ADD_LIBRARY_WITH_PATH(nlsrtl3, $ORACLE_DIR/lib, ORACLE_SHARED_LIBADD)
- PHP_ADD_LIBRARY_WITH_PATH(c3v6, $ORACLE_DIR/lib, ORACLE_SHARED_LIBADD)
- PHP_ADD_LIBRARY_WITH_PATH(nlsrtl3, $ORACLE_DIR/lib, ORACLE_SHARED_LIBADD)
- PHP_ADD_LIBRARY_WITH_PATH(ora, $ORACLE_DIR/lib, ORACLE_SHARED_LIBADD)
- PHP_ADD_LIBRARY_WITH_PATH(sqlnet, $ORACLE_DIR/lib, ORACLE_SHARED_LIBADD)
- PHP_ADD_LIBRARY_WITH_PATH(ora, $ORACLE_DIR/lib, ORACLE_SHARED_LIBADD)
- PHP_ADD_LIBRARY_WITH_PATH(sqlnet, $ORACLE_DIR/lib, ORACLE_SHARED_LIBADD)
- if test "$ext_shared" = "yes"; then
- ORACLE_SHARED_LIBADD="$ORACLE_DIR/lib/osntab.o $ORACLE_SHARED_LIBADD";
- else
- LIBS="$ORACLE_DIR/lib/osntab.o $LIBS";
- fi
- PHP_ADD_LIBRARY_WITH_PATH(ocic, $ORACLE_DIR/lib, ORACLE_SHARED_LIBADD)
- fi
- ;;
-
- 7.3)
- if test -f $ORACLE_DIR/lib/libclntsh.s?; then
- PHP_ADD_LIBRARY_WITH_PATH(clntsh, $ORACLE_DIR/lib, ORACLE_SHARED_LIBADD)
- else
- PHP_ADD_LIBRARY_WITH_PATH(core3, $ORACLE_DIR/lib, ORACLE_SHARED_LIBADD)
- PHP_ADD_LIBRARY_WITH_PATH(nlsrtl3, $ORACLE_DIR/lib, ORACLE_SHARED_LIBADD)
- PHP_ADD_LIBRARY_WITH_PATH(core3, $ORACLE_DIR/lib, ORACLE_SHARED_LIBADD)
- PHP_ADD_LIBRARY_WITH_PATH(c3v6, $ORACLE_DIR/lib, ORACLE_SHARED_LIBADD)
- PHP_ADD_LIBRARY_WITH_PATH(nlsrtl3, $ORACLE_DIR/lib, ORACLE_SHARED_LIBADD)
- PHP_ADD_LIBRARY_WITH_PATH(epc, $ORACLE_DIR/lib, ORACLE_SHARED_LIBADD)
- PHP_ADD_LIBRARY_WITH_PATH(generic, $ORACLE_DIR/lib, ORACLE_SHARED_LIBADD)
- PHP_ADD_LIBRARY_WITH_PATH(common, $ORACLE_DIR/lib, ORACLE_SHARED_LIBADD)
- PHP_ADD_LIBRARY_WITH_PATH(client, $ORACLE_DIR/lib, ORACLE_SHARED_LIBADD)
- PHP_ADD_LIBRARY_WITH_PATH(sqlnet, $ORACLE_DIR/lib, ORACLE_SHARED_LIBADD)
- PHP_ADD_LIBRARY_WITH_PATH(ncr, $ORACLE_DIR/lib, ORACLE_SHARED_LIBADD)
- PHP_ADD_LIBRARY_WITH_PATH(sqlnet, $ORACLE_DIR/lib, ORACLE_SHARED_LIBADD)
- PHP_ADD_LIBRARY_WITH_PATH(generic, $ORACLE_DIR/lib, ORACLE_SHARED_LIBADD)
- PHP_ADD_LIBRARY_WITH_PATH(common, $ORACLE_DIR/lib, ORACLE_SHARED_LIBADD)
- PHP_ADD_LIBRARY_WITH_PATH(client, $ORACLE_DIR/lib, ORACLE_SHARED_LIBADD)
- PHP_ADD_LIBRARY_WITH_PATH(sqlnet, $ORACLE_DIR/lib, ORACLE_SHARED_LIBADD)
- PHP_ADD_LIBRARY_WITH_PATH(ncr, $ORACLE_DIR/lib, ORACLE_SHARED_LIBADD)
- PHP_ADD_LIBRARY_WITH_PATH(sqlnet, $ORACLE_DIR/lib, ORACLE_SHARED_LIBADD)
- PHP_ADD_LIBRARY_WITH_PATH(client, $ORACLE_DIR/lib, ORACLE_SHARED_LIBADD)
- fi
- ;;
-
- 8.0)
- PHP_ADD_LIBRARY_WITH_PATH(nlsrtl3, "", ORACLE_SHARED_LIBADD)
- PHP_ADD_LIBRARY_WITH_PATH(core4, "", ORACLE_SHARED_LIBADD)
- PHP_ADD_LIBRARY_WITH_PATH(psa, "", ORACLE_SHARED_LIBADD)
- PHP_ADD_LIBRARY_WITH_PATH(clntsh, $ORACLE_DIR/lib, ORACLE_SHARED_LIBADD)
- ;;
-
- 8.1)
- PHP_ADD_LIBRARY(clntsh, 1, ORACLE_SHARED_LIBADD)
- PHP_ADD_LIBPATH($ORACLE_DIR/lib, ORACLE_SHARED_LIBADD)
- ;;
- *)
- AC_MSG_ERROR(Unsupported Oracle version!)
- ;;
- esac
-
- PHP_EXTENSION(oracle, $ext_shared)
- AC_DEFINE(HAVE_ORACLE,1,[ ])
-
- PHP_SUBST_OLD(ORACLE_SHARED_LIBADD)
- PHP_SUBST_OLD(ORACLE_DIR)
- PHP_SUBST_OLD(ORACLE_VERSION)
-fi
diff --git a/ext/oracle/oracle.c b/ext/oracle/oracle.c
deleted file mode 100644
index 3ea87d3dc8..0000000000
--- a/ext/oracle/oracle.c
+++ /dev/null
@@ -1,1803 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Stig Sæther Bakken <ssb@fast.no> |
- | Mitch Golden <mgolden@interport.net> |
- | Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
- | Andreas Karajannis <Andreas.Karajannis@gmd.de> |
- | Thies C. Arntzen <thies@thieso.net> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-/* comment out the next line if you're on Oracle 7.x and don't have the olog
- call. */
-
-#define HAS_OLOG 1
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-
-#include "zend_globals.h"
-
-#if HAVE_ORACLE
-
-#include "php_oracle.h"
-#define HASH_DTOR (void (*)(void *))
-
-#include "ext/standard/info.h"
-
-
-#ifndef min
-#define min(a, b) ((a) > (b) ? (b) : (a))
-#endif
-
-#ifdef PHP_WIN32
-#define PHP_ORA_API __declspec(dllexport)
-#else
-#define PHP_ORA_API
-#endif
-
-#ifndef PHP_WIN32
-#include "build-defs.h"
-#endif
-
-#ifdef ZTS
-int ora_globals_id;
-#else
-PHP_ORA_API php_ora_globals ora_globals;
-#endif
-
-#define DB_SIZE 65536
-
-#define ORA_FETCHINTO_ASSOC (1<<0)
-#define ORA_FETCHINTO_NULLS (1<<1)
-
-static oraCursor *ora_get_cursor(HashTable *, pval **);
-static char *ora_error(Cda_Def *);
-static int ora_describe_define(oraCursor *);
-static int _close_oraconn(zend_rsrc_list_entry *rsrc);
-static int _close_oracur(oraCursor *cur);
-static int _ora_ping(oraConnection *conn);
-int ora_set_param_values(oraCursor *cursor, int isout);
-
-void ora_do_logon(INTERNAL_FUNCTION_PARAMETERS, int persistent);
-
-static int le_conn, le_pconn, le_cursor;
-
-/* {{{ prototypes
- */
-PHP_FUNCTION(ora_bind);
-PHP_FUNCTION(ora_close);
-PHP_FUNCTION(ora_commit);
-PHP_FUNCTION(ora_commitoff);
-PHP_FUNCTION(ora_commiton);
-PHP_FUNCTION(ora_do);
-PHP_FUNCTION(ora_error);
-PHP_FUNCTION(ora_errorcode);
-PHP_FUNCTION(ora_exec);
-PHP_FUNCTION(ora_fetch);
-PHP_FUNCTION(ora_fetch_into);
-PHP_FUNCTION(ora_columntype);
-PHP_FUNCTION(ora_columnname);
-PHP_FUNCTION(ora_columnsize);
-PHP_FUNCTION(ora_getcolumn);
-PHP_FUNCTION(ora_numcols);
-PHP_FUNCTION(ora_numrows);
-PHP_FUNCTION(ora_logoff);
-PHP_FUNCTION(ora_logon);
-PHP_FUNCTION(ora_plogon);
-PHP_FUNCTION(ora_open);
-PHP_FUNCTION(ora_parse);
-PHP_FUNCTION(ora_rollback);
-
-PHP_MINIT_FUNCTION(oracle);
-PHP_RINIT_FUNCTION(oracle);
-PHP_MSHUTDOWN_FUNCTION(oracle);
-PHP_RSHUTDOWN_FUNCTION(oracle);
-PHP_MINFO_FUNCTION(oracle);
-/* }}} */
-
-/* {{{ oracle_functions[]
- */
-function_entry oracle_functions[] = {
- PHP_FE(ora_bind, NULL)
- PHP_FE(ora_close, NULL)
- PHP_FE(ora_commit, NULL)
- PHP_FE(ora_commitoff, NULL)
- PHP_FE(ora_commiton, NULL)
- PHP_FE(ora_do, NULL)
- PHP_FE(ora_error, NULL)
- PHP_FE(ora_errorcode, NULL)
- PHP_FE(ora_exec, NULL)
- PHP_FE(ora_fetch, NULL)
- PHP_FE(ora_fetch_into, second_arg_force_ref)
- PHP_FE(ora_columntype, NULL)
- PHP_FE(ora_columnname, NULL)
- PHP_FE(ora_columnsize, NULL)
- PHP_FE(ora_getcolumn, NULL)
- PHP_FE(ora_numcols, NULL)
- PHP_FE(ora_numrows, NULL)
- PHP_FE(ora_logoff, NULL)
- PHP_FE(ora_logon, NULL)
- PHP_FE(ora_plogon, NULL)
- PHP_FE(ora_open, NULL)
- PHP_FE(ora_parse, NULL)
- PHP_FE(ora_rollback, NULL)
- {NULL, NULL, NULL}
-};
-/* }}} */
-
-/* {{{ oracle_module_entry
- */
-zend_module_entry oracle_module_entry = {
- "oracle",
- oracle_functions,
- PHP_MINIT(oracle), /* extension-wide startup function */
- PHP_MSHUTDOWN(oracle), /* extension-wide shutdown function */
- PHP_RINIT(oracle), /* per-request startup function */
- PHP_RSHUTDOWN(oracle), /* per-request shutdown function */
- PHP_MINFO(oracle),
- STANDARD_MODULE_PROPERTIES
-};
-/* }}} */
-
-/* {{{ ora_func_tab[]
- */
-static const text *ora_func_tab[] =
-{(text *) "unused",
-/* 1, 2 */ (text *) "unused", (text *) "OSQL",
-/* 3, 4 */ (text *) "unused", (text *) "OEXEC/OEXN",
-/* 5, 6 */ (text *) "unused", (text *) "OBIND",
-/* 7, 8 */ (text *) "unused", (text *) "ODEFIN",
-/* 9, 10 */ (text *) "unused", (text *) "ODSRBN",
-/* 11, 12 */ (text *) "unused", (text *) "OFETCH/OFEN",
-/* 13, 14 */ (text *) "unused", (text *) "OOPEN",
-/* 15, 16 */ (text *) "unused", (text *) "OCLOSE",
-/* 17, 18 */ (text *) "unused", (text *) "unused",
-/* 19, 20 */ (text *) "unused", (text *) "unused",
-/* 21, 22 */ (text *) "unused", (text *) "ODSC",
-/* 23, 24 */ (text *) "unused", (text *) "ONAME",
-/* 25, 26 */ (text *) "unused", (text *) "OSQL3",
-/* 27, 28 */ (text *) "unused", (text *) "OBNDRV",
-/* 29, 30 */ (text *) "unused", (text *) "OBNDRN",
-/* 31, 32 */ (text *) "unused", (text *) "unused",
-/* 33, 34 */ (text *) "unused", (text *) "OOPT",
-/* 35, 36 */ (text *) "unused", (text *) "unused",
-/* 37, 38 */ (text *) "unused", (text *) "unused",
-/* 39, 40 */ (text *) "unused", (text *) "unused",
-/* 41, 42 */ (text *) "unused", (text *) "unused",
-/* 43, 44 */ (text *) "unused", (text *) "unused",
-/* 45, 46 */ (text *) "unused", (text *) "unused",
-/* 47, 48 */ (text *) "unused", (text *) "unused",
-/* 49, 50 */ (text *) "unused", (text *) "unused",
-/* 51, 52 */ (text *) "unused", (text *) "OCAN",
-/* 53, 54 */ (text *) "unused", (text *) "OPARSE",
-/* 55, 56 */ (text *) "unused", (text *) "OEXFET",
-/* 57, 58 */ (text *) "unused", (text *) "OFLNG",
-/* 59, 60 */ (text *) "unused", (text *) "ODESCR",
-/* 61, 62 */ (text *) "unused", (text *) "OBNDRA"
-};
-/* }}} */
-
-#ifdef COMPILE_DL_ORACLE
-ZEND_GET_MODULE(oracle)
-#endif
-
-/* {{{ _close_oraconn
- */
-static int _close_oraconn(zend_rsrc_list_entry *rsrc)
-{
- oraConnection *conn = (oraConnection *)rsrc->ptr;
- ORALS_FETCH();
-
- conn->open = 0;
-
- ologof(&conn->lda);
- ORA(num_links)--;
-
- zend_hash_del(ORA(conns),(void*)&conn,sizeof(void*));
-
- if (conn->persistent) {
- ORA(num_persistent)--;
- free(conn);
- } else {
- efree(conn);
- }
-
- return 1;
-}
-/* }}} */
-
-/* {{{ pval_ora_param_destructor
- */
-static void
-pval_ora_param_destructor(oraParam *param)
-{
- if (param->progv) {
- efree(param->progv);
- }
-}
-/* }}} */
-
-/* {{{ _close_oracur
- */
-static int _close_oracur(oraCursor *cur)
-{
- int i;
- ORALS_FETCH();
-
- if (cur){
- if (cur->query){
- efree(cur->query);
- }
- if (cur->params){
- zend_hash_destroy(cur->params);
- efree(cur->params);
- cur->params = NULL;
- }
- if (cur->columns){
- for(i = 0; i < cur->ncols; i++){
- if (cur->columns[i].buf)
- efree(cur->columns[i].buf);
- }
- efree(cur->columns);
- cur->columns = NULL;
- }
-
- if (cur->open){
- oraConnection *db_conn;
-
- if (zend_hash_find(ORA(conns),(void*)&(cur->conn_ptr),sizeof(void*),(void **)&db_conn) == SUCCESS) {
- oclose(&cur->cda);
- }
- }
-
- efree(cur);
- }
-
- return 1;
-}
-/* }}} */
-
-/* {{{ php_close_ora_cursor
- */
-static void php_close_ora_cursor(zend_rsrc_list_entry *rsrc)
-{
- oraCursor *cur = (oraCursor *)rsrc->ptr;
- _close_oracur(cur);
-}
-/* }}} */
-
-/* {{{ php_ora_init_globals
- */
-static void php_ora_init_globals(ORALS_D)
-{
- if (cfg_get_long("oracle.allow_persistent",
- &ORA(allow_persistent))
- == FAILURE) {
- ORA(allow_persistent) = -1;
- }
- if (cfg_get_long("oracle.max_persistent",
- &ORA(max_persistent))
- == FAILURE) {
- ORA(max_persistent) = -1;
- }
- if (cfg_get_long("oracle.max_links",
- &ORA(max_links))
- == FAILURE) {
- ORA(max_links) = -1;
- }
-
- ORA(num_persistent) = 0;
-
- ORA(conns) = malloc(sizeof(HashTable));
- zend_hash_init(ORA(conns), 13, NULL, NULL, 1);
-
- memset((void*) &ORA(db_err_conn),0,sizeof(ORA(db_err_conn)));
-}
-/* }}} */
-
-/* {{{ PHP_MINIT_FUNCTION
- */
-PHP_MINIT_FUNCTION(oracle)
-{
-
-#ifdef ZTS
- ora_globals_id = ts_allocate_id(sizeof(php_ora_globals), (ts_allocate_ctor) php_ora_init_globals, NULL);
-#else
- php_ora_init_globals(ORALS_C);
-#endif
-
- le_cursor = zend_register_list_destructors_ex(php_close_ora_cursor, NULL, "oracle cursor", module_number);
- le_conn = zend_register_list_destructors_ex(_close_oraconn, NULL, "oracle link", module_number);
- le_pconn = zend_register_list_destructors_ex(NULL, _close_oraconn, "oracle link persistent", module_number);
-
- REGISTER_LONG_CONSTANT("ORA_BIND_INOUT", 0, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("ORA_BIND_IN", 1, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("ORA_BIND_OUT", 2, CONST_CS | CONST_PERSISTENT);
-
- REGISTER_LONG_CONSTANT("ORA_FETCHINTO_ASSOC",ORA_FETCHINTO_ASSOC, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("ORA_FETCHINTO_NULLS",ORA_FETCHINTO_NULLS, CONST_CS | CONST_PERSISTENT);
-
-#ifdef ZTS
- opinit(OCI_EV_TSF);
-#endif
-
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_RINIT_FUNCTION
- */
-PHP_RINIT_FUNCTION(oracle)
-{
- ORALS_FETCH();
-
- ORA(num_links) =
- ORA(num_persistent);
- /*
- ORA(defaultlrl) = 0;
- ORA(defaultbinmode) = 0;
- ORA(defaultconn) = 0;
- */
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_MSHUTDOWN_FUNCTION
- */
-PHP_MSHUTDOWN_FUNCTION(oracle)
-{
- ORALS_FETCH();
-
- zend_hash_destroy(ORA(conns));
- free(ORA(conns));
-
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_RSHUTDOWN_FUNCTION
- */
-PHP_RSHUTDOWN_FUNCTION(oracle)
-{
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ _ora_ping
- */
-static int _ora_ping(oraConnection *conn)
-{
- Cda_Def cda;
-
- if (oopen(&cda, &conn->lda, (text *) 0, -1, -1, (text *) 0, -1)) {
- return 0;
- }
-
- if (oparse(&cda, "select sysdate from dual", (sb4) - 1, 0, VERSION_7)) {
- oclose(&cda);
- return 0;
- }
-
- oclose(&cda);
- return 1;
-
-}
-/* }}} */
-
-/*
- ** PHP functions
-*/
-
-/* {{{ proto int ora_logon(string user, string password)
- Open an Oracle connection */
-PHP_FUNCTION(ora_logon)
-{
- ora_do_logon(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-/* }}} */
-
-/* {{{ proto int ora_plogon(string user, string password)
- Open a persistent Oracle connection */
-PHP_FUNCTION(ora_plogon)
-{
- ora_do_logon(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
-}
-/* }}} */
-
-/* {{{ ora_do_logon
- */
-void ora_do_logon(INTERNAL_FUNCTION_PARAMETERS, int persistent)
-{
- char *user,*passwd;
- pval **arg1, **arg2;
- char *hashed_details;
- int hashed_details_length;
- oraConnection *db_conn;
- ORALS_FETCH();
-
- if (zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(arg1);
- convert_to_string_ex(arg2);
-
- user = (*arg1)->value.str.val;
- passwd = (*arg2)->value.str.val;
-
- hashed_details_length = sizeof("oracle__")-1+strlen(user)+strlen(passwd);
- hashed_details = (char *) emalloc(hashed_details_length+1);
- sprintf(hashed_details,"oracle_%s_%s",user,passwd);
-
- if (!ORA(allow_persistent)) {
- persistent=0;
- }
- if (persistent) {
- list_entry *le;
-
- /* try to find if we already have this link in our persistent list */
- if (zend_hash_find(&EG(persistent_list), hashed_details, hashed_details_length+1, (void **) &le)==FAILURE) { /* we don't */
- list_entry new_le;
-
- if (ORA(max_links)!=-1 && ORA(num_links)>=ORA(max_links)) {
- php_error(E_WARNING,"Oracle: Too many open links (%d)",ORA(num_links));
- efree(hashed_details);
- RETURN_FALSE;
- }
- if (ORA(max_persistent)!=-1 && ORA(num_persistent)>=ORA(max_persistent)) {
- php_error(E_WARNING,"Oracle: Too many open persistent links (%d)",ORA(num_persistent));
- efree(hashed_details);
- RETURN_FALSE;
- }
- /* create the link */
- db_conn = (oraConnection *)malloc(sizeof(oraConnection));
- memset((void *) db_conn,0,sizeof(oraConnection));
- db_conn->persistent = 1;
-
- if (
-#if HAS_OLOG
- olog(&db_conn->lda, db_conn->hda, user,strlen(user), passwd, strlen(passwd), 0, -1, OCI_LM_DEF)
-#else
- orlon(&db_conn->lda, db_conn->hda, user,strlen(user), passwd, strlen(passwd), 0)
-#endif
- ) {
- ORA(db_err_conn) = *db_conn;
- php_error(E_WARNING, "Unable to connect to ORACLE (%s)",ora_error(&db_conn->lda));
-
- if (persistent) {
- free(db_conn);
- } else {
- efree(db_conn);
- }
-
- efree(hashed_details);
- RETURN_FALSE;
- }
-
- /* hash it up */
- new_le.type = le_pconn;
- new_le.ptr = db_conn;
- if (zend_hash_update(&EG(persistent_list), hashed_details, hashed_details_length+1, (void *) &new_le, sizeof(list_entry), NULL)==FAILURE) {
- free(db_conn);
- efree(hashed_details);
- RETURN_FALSE;
- }
- ORA(num_persistent)++;
- ORA(num_links)++;
- zend_hash_add(ORA(conns),(void*)&db_conn,sizeof(void*),(void*)&db_conn,sizeof(void*),NULL);
- } else { /* we do */
- if (le->type != le_pconn) {
- RETURN_FALSE;
- }
-
- db_conn = (oraConnection *) le->ptr;
-
- /* ensure that the link did not die */
-
- if (!_ora_ping(db_conn)) {
- if (
-#if HAS_OLOG
- olog(&db_conn->lda, db_conn->hda, user,strlen(user), passwd, strlen(passwd), 0, -1, OCI_LM_DEF)
-#else
- orlon(&db_conn->lda, db_conn->hda, user,strlen(user), passwd, strlen(passwd), 0)
-#endif
- ) {
- ORA(db_err_conn) = *db_conn;
- php_error(E_WARNING, "Oracle: Link to server lost, unable to reconnect",ora_error(&db_conn->lda));
- zend_hash_del(&EG(persistent_list), hashed_details, hashed_details_length+1);
- efree(hashed_details);
- RETURN_FALSE;
- }
- }
- }
- ZEND_REGISTER_RESOURCE(return_value, db_conn, le_pconn);
- } else { /* non persistent */
- list_entry *index_ptr,new_index_ptr;
-
- /* first we check the hash for the hashed_details key. if it exists,
- * it should point us to the right offset where the actual Oracle link sits.
- * if it doesn't, open a new Oracle link, add it to the resource list,
- * and add a pointer to it with hashed_details as the key.
- */
- if (zend_hash_find(&EG(regular_list),hashed_details,hashed_details_length+1,(void **) &index_ptr)==SUCCESS) {
- int type,link;
- void *ptr;
-
- if (index_ptr->type != le_index_ptr) {
- RETURN_FALSE;
- }
- link = (int) index_ptr->ptr;
- ptr = zend_list_find(link,&type); /* check if the link is still there */
- if (ptr && (type==le_conn || type==le_pconn)) {
- zend_list_addref(link);
- return_value->value.lval = link;
- return_value->type = IS_RESOURCE;
- efree(hashed_details);
- return;
- } else {
- zend_hash_del(&EG(regular_list),hashed_details,hashed_details_length+1);
- }
- }
- if (ORA(max_links)!=-1 && ORA(num_links)>=ORA(max_links)) {
- php_error(E_WARNING,"Oracle: Too many open links (%d)",ORA(num_links));
- efree(hashed_details);
- RETURN_FALSE;
- }
-
- db_conn = (oraConnection *) emalloc(sizeof(oraConnection));
- memset((void *) db_conn,0,sizeof(oraConnection));
- db_conn->persistent = 0;
-
- if (
-#if HAS_OLOG
- olog(&db_conn->lda, db_conn->hda, user,strlen(user), passwd, strlen(passwd), 0, -1, OCI_LM_DEF)
-#else
- orlon(&db_conn->lda, db_conn->hda, user,strlen(user), passwd, strlen(passwd), 0)
-#endif
- ) {
- ORA(db_err_conn) = *db_conn;
- php_error(E_WARNING,"Oracle: Connection Failed: %s\n",ora_error(&db_conn->lda));
- efree(hashed_details);
- efree(db_conn);
- RETURN_FALSE;
- }
-
- /* add it to the list */
- ZEND_REGISTER_RESOURCE(return_value, db_conn, le_conn);
-
- /* add it to the hash */
- new_index_ptr.ptr = (void *) return_value->value.lval;
- new_index_ptr.type = le_index_ptr;
- if (zend_hash_update(&EG(regular_list),hashed_details,hashed_details_length+1,(void *) &new_index_ptr, sizeof(list_entry), NULL)==FAILURE) {
- efree(hashed_details);
- RETURN_FALSE;
- }
- zend_hash_add(ORA(conns),(void*)&db_conn,sizeof(void*),(void*)&db_conn,sizeof(void*),NULL);
- ORA(num_links)++;
- }
-
- efree(hashed_details);
-}
-/* }}} */
-
-/* {{{ proto int ora_logoff(int connection)
- Close an Oracle connection */
-PHP_FUNCTION(ora_logoff)
-{ /* conn_index */
- oraConnection *conn;
- pval **arg;
-
- if (zend_get_parameters_ex(1, &arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- ZEND_FETCH_RESOURCE2(conn, oraConnection *, arg, -1, "Oracle-Connection", le_conn, le_pconn);
-
- zend_list_delete((*arg)->value.lval);
-}
-/* }}} */
-
-/* {{{ proto int ora_open(int connection)
- Open an Oracle cursor */
-PHP_FUNCTION(ora_open)
-{ /* conn_index */
- pval **arg;
- oraConnection *conn = NULL;
- oraCursor *cursor = NULL;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- ZEND_FETCH_RESOURCE2(conn, oraConnection *, arg, -1, "Oracle-Connection", le_conn, le_pconn);
-
- if ((cursor = (oraCursor *)emalloc(sizeof(oraCursor))) == NULL){
- php_error(E_WARNING, "Out of memory");
- RETURN_FALSE;
- }
- memset(cursor, 0, sizeof(oraCursor));
- if (oopen(&cursor->cda, &conn->lda, (text *) 0, -1, -1, (text *) 0, -1)) {
- php_error(E_WARNING, "Unable to open new cursor (%s)",
- ora_error(&cursor->cda));
- efree(cursor);
- RETURN_FALSE;
- }
- cursor->open = 1;
- cursor->conn_ptr = conn;
- ZEND_REGISTER_RESOURCE(return_value, cursor, le_cursor);
- cursor->conn_id = return_value->value.lval;
-}
-
-/* }}} */
-
-/* {{{ proto int ora_close(int cursor)
- Close an Oracle cursor */
-PHP_FUNCTION(ora_close)
-{ /* conn_index */
- pval **arg;
- oraCursor *cursor;
-
- if (zend_get_parameters_ex(1, &arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- ZEND_FETCH_RESOURCE(cursor, oraCursor *, arg, -1, "Oracle-Cursor", le_cursor);
-
- zend_list_delete((*arg)->value.lval);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int ora_commitoff(int connection)
- Disable automatic commit */
-PHP_FUNCTION(ora_commitoff)
-{ /* conn_index */
- pval **arg;
- oraConnection *conn;
-
- if (zend_get_parameters_ex(1, &arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- ZEND_FETCH_RESOURCE2(conn, oraConnection *, arg, -1, "Oracle-Connection", le_conn, le_pconn);
-
- if (ocof(&conn->lda)) {
- php_error(E_WARNING, "Unable to turn off auto-commit (%s)",
- ora_error(&conn->lda));
- RETURN_FALSE;
- }
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int ora_commiton(int connection)
- Enable automatic commit */
-PHP_FUNCTION(ora_commiton)
-{ /* conn_index */
- pval **arg;
- oraConnection *conn;
-
- if (zend_get_parameters_ex(1, &arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- ZEND_FETCH_RESOURCE2(conn, oraConnection *, arg, -1, "Oracle-Connection", le_conn, le_pconn);
-
- if (ocon(&conn->lda)) {
- php_error(E_WARNING, "Unable to turn on auto-commit (%s)",
- ora_error(&conn->lda));
- RETURN_FALSE;
- }
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int ora_commit(int connection)
- Commit an Oracle transaction */
-PHP_FUNCTION(ora_commit)
-{ /* conn_index */
- pval **arg;
- oraConnection *conn;
-
- if (zend_get_parameters_ex(1, &arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- ZEND_FETCH_RESOURCE2(conn, oraConnection *, arg, -1, "Oracle-Connection", le_conn, le_pconn);
-
- if (ocom(&conn->lda)) {
- php_error(E_WARNING, "Unable to commit transaction (%s)",
- ora_error(&conn->lda));
- RETURN_FALSE;
- }
- RETVAL_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int ora_rollback(int connection)
- Roll back an Oracle transaction */
-PHP_FUNCTION(ora_rollback)
-{ /* conn_index */
- pval **arg;
- oraConnection *conn;
-
- if (zend_get_parameters_ex(1, &arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- ZEND_FETCH_RESOURCE2(conn, oraConnection *, arg, -1, "Oracle-Connection", le_conn, le_pconn);
-
- if (orol(&conn->lda)) {
- php_error(E_WARNING, "Unable to roll back transaction (%s)",
- ora_error(&conn->lda));
- RETURN_FALSE;
- }
- RETVAL_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int ora_parse(int cursor, string sql_statement [, int defer])
- Parse an Oracle SQL statement */
-PHP_FUNCTION(ora_parse)
-{
- pval **curs, **sql, **def;
- oraCursor *cursor;
- sword defer = 0;
- text *query;
-
- switch (ZEND_NUM_ARGS()) {
- case 3:
- zend_get_parameters_ex(3,&curs,&sql,&def);
- convert_to_long_ex(def);
- if ((*def)->value.lval) {
- defer = DEFER_PARSE;
- }
- break;
- case 2:
- zend_get_parameters_ex(2,&curs,&sql);
- break;
- default:
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(sql);
- query = (text *) estrndup((*sql)->value.str.val,(*sql)->value.str.len);
-
- if (query == NULL) {
- php_error(E_WARNING, "Invalid query");
- RETURN_FALSE;
- }
-
- if (!(cursor = ora_get_cursor(&EG(regular_list),curs))){
- efree(query);
- RETURN_FALSE;
- }
-
- if (cursor->query) {
- efree(cursor->query);
- }
-
- cursor->query = query;
- cursor->fetched = 0;
-
- if (cursor->params && cursor->nparams > 0){
- zend_hash_destroy(cursor->params);
- efree(cursor->params);
- cursor->params = NULL;
- cursor->nparams = 0;
- }
-
- if (oparse(&cursor->cda, query, (sb4) - 1, defer, VERSION_7)) {
- php_error(E_WARNING, "Ora_Parse failed (%s)",ora_error(&cursor->cda));
- RETURN_FALSE;
- }
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int ora_bind(int cursor, string php_variable_name, string sql_parameter_name, int length [, int type])
- Bind a PHP variable to an Oracle parameter */
-PHP_FUNCTION(ora_bind)
-{
- pval **curs, **pvar, **svar, **plen, **ptyp;
- int inout = 0;
- oraParam *newparam, *paramptr;
- oraCursor *cursor;
- char *paramname;
-
- switch (ZEND_NUM_ARGS()) {
- case 5:
- zend_get_parameters_ex(5,&curs,&pvar,&svar,&plen,&ptyp);
- convert_to_long_ex(ptyp);
- inout = (*ptyp)->value.lval;
- break;
- case 4:
- zend_get_parameters_ex(4,&curs,&pvar,&svar,&plen);
- break;
- default:
- WRONG_PARAM_COUNT;
- }
-
- cursor = ora_get_cursor(&EG(regular_list), curs);
- if (cursor == NULL) {
- RETURN_FALSE;
- }
-
- convert_to_string_ex(pvar);
- convert_to_string_ex(svar);
- convert_to_long_ex(plen);
-
- if (cursor->params == NULL) {
- ALLOC_HASHTABLE(cursor->params);
- if (!cursor->params ||
- zend_hash_init(cursor->params, 19, NULL,
- HASH_DTOR pval_ora_param_destructor, 0) == FAILURE) {
- php_error(E_ERROR, "Unable to initialize parameter list");
- RETURN_FALSE;
- }
- }
- if ((newparam = (oraParam *)emalloc(sizeof(oraParam))) == NULL) {
- php_error(E_WARNING, "Out of memory for parameter");
- RETURN_FALSE;
- }
-
- if ((paramname = estrndup((*pvar)->value.str.val, (*pvar)->value.str.len)) == NULL) {
- php_error(E_WARNING, "Out of memory for parametername");
- efree(newparam);
- RETURN_FALSE;
- }
-
- if (zend_hash_add(cursor->params, paramname, (*pvar)->value.str.len + 1,
- newparam, sizeof(oraParam), (void **)&paramptr) == FAILURE) {
- /* XXX zend_hash_destroy */
- efree(paramname);
- efree(newparam);
- php_error(E_ERROR, "Could not make parameter placeholder");
- RETURN_FALSE;
- }
-
- efree(newparam);
- efree(paramname);
-
- paramptr->progvl = (*plen)->value.lval + 1;
- paramptr->inout = inout;
-
- if ((paramptr->progv = (text *)emalloc(paramptr->progvl)) == NULL) {
- php_error(E_WARNING, "Out of memory for parameter value");
- RETURN_FALSE;
- }
-
-/* XXX Maximum for progvl */
- paramptr->alen = paramptr->progvl;
-
- if (obndra(&cursor->cda,
- (*svar)->value.str.val,
- -1,
- (ub1 *)paramptr->progv,
- paramptr->progvl,
- SQLT_STR, /* ftype */
- -1, /* scale */
- 0/*&paramptr->ind*/, /* ind */
- &paramptr->alen, /* alen */
- 0 /*&paramptr->arcode*/,
- 0, /* maxsize */
- 0,
- 0,
- -1,
- -1)) {
- php_error(E_WARNING, "Ora_Bind failed (%s)",
- ora_error(&cursor->cda));
- RETURN_FALSE;
- }
-
- cursor->nparams++;
- RETURN_TRUE;
-}
-/* }}} */
-
-/*
- XXX Make return values compatible with old module ?
- */
-/* {{{ proto int ora_exec(int cursor)
- Execute a parsed statement */
-PHP_FUNCTION(ora_exec)
-{ /* cursor_index */
- pval **arg;
- oraCursor *cursor = NULL;
-
- if (zend_get_parameters_ex(1, &arg) == FAILURE)
- WRONG_PARAM_COUNT;
-
- if ((cursor = ora_get_cursor(&EG(regular_list), arg)) == NULL) {
- RETURN_FALSE;
- }
-
- if (cursor->cda.ft == FT_SELECT) {
- if (ora_describe_define(cursor) < 0) {
- /* error message is given by ora_describe_define() */
- RETURN_FALSE;
- }
- }
-
- if(cursor->nparams > 0){
- if(!ora_set_param_values(cursor, 0)){
- RETURN_FALSE;
- }
- }
-
- if (oexec(&cursor->cda)) {
- php_error(E_WARNING, "Ora_Exec failed (%s)",
- ora_error(&cursor->cda));
- RETURN_FALSE;
- }
-
- if(cursor->nparams > 0){
- if(!ora_set_param_values(cursor, 1)){
- RETURN_FALSE;
- }
- }
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int ora_numcols(int cursor)
- Returns the numbers of columns in a result */
-PHP_FUNCTION(ora_numcols)
-{ /* cursor_index */
- pval **arg;
- oraCursor *cursor = NULL;
-
- if (zend_get_parameters_ex(1, &arg) == FAILURE)
- WRONG_PARAM_COUNT;
-
- if ((cursor = ora_get_cursor(&EG(regular_list), arg)) == NULL) {
- RETURN_FALSE;
- }
-
- RETURN_LONG(cursor->ncols);
-}
-/* }}} */
-
-/* {{{ proto int ora_numrows(int cursor)
- Returns the number of rows in a result */
-PHP_FUNCTION(ora_numrows)
-{ /* cursor_index */
- pval **arg;
- oraCursor *cursor = NULL;
-
- if(zend_get_parameters_ex(1, &arg) == FAILURE)
- WRONG_PARAM_COUNT;
-
- if((cursor = ora_get_cursor(&EG(regular_list), arg)) == NULL) {
- RETURN_FALSE;
- }
-
- RETURN_LONG(cursor->cda.rpc);
-}
-/* }}} */
-
-/* prepares/executes/fetches 1st row if avail*/
-/* {{{ proto int ora_do(int connection, int cursor)
- Parse and execute a statement and fetch first result row */
-PHP_FUNCTION(ora_do)
-{
- pval **con,**sql;
- oraConnection *conn = NULL;
- oraCursor *cursor = NULL;
- text *query;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &con,&sql) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- ZEND_FETCH_RESOURCE2(conn, oraConnection *, con, -1, "Oracle-Connection", le_conn, le_pconn);
-
- convert_to_string_ex(sql);
-
- if ((cursor = (oraCursor *)emalloc(sizeof(oraCursor))) == NULL){
- php_error(E_WARNING, "Out of memory");
- RETURN_FALSE;
- }
-
- memset(cursor, 0, sizeof(oraCursor));
-
- query = (text *) estrndup((*sql)->value.str.val,(*sql)->value.str.len);
-
- if (query == NULL) {
- php_error(E_WARNING, "Invalid query in Ora_Do");
- RETURN_FALSE;
- }
-
- cursor->query = query;
-
- if (oopen(&cursor->cda, &conn->lda, (text *) 0, -1, -1, (text *) 0, -1)) {
- php_error(E_WARNING, "Unable to open new cursor (%s)",
- ora_error(&cursor->cda));
- efree(cursor);
- RETURN_FALSE;
- }
- cursor->open = 1;
- cursor->conn_ptr = conn;
- cursor->conn_id = (*con)->value.lval;
-
- /* Prepare stmt */
-
- if (oparse(&cursor->cda, query, (sb4) - 1, 1, VERSION_7)){
- php_error(E_WARNING, "Ora_Do failed (%s)",
- ora_error(&cursor->cda));
- _close_oracur(cursor);
- RETURN_FALSE;
- }
-
- /* Execute stmt (and fetch 1st row for selects) */
- if (cursor->cda.ft == FT_SELECT) {
- if (ora_describe_define(cursor) < 0){
- /* error message is given by ora_describe_define() */
- _close_oracur(cursor);
- RETURN_FALSE;
- }
- if (oexfet(&cursor->cda, 1, 0, 0)) {
- php_error(E_WARNING, "Ora_Do failed (%s)",
- ora_error(&cursor->cda));
- _close_oracur(cursor);
- RETURN_FALSE;
- }
- cursor->fetched = 1;
- } else {
- if (oexec(&cursor->cda)) {
- php_error(E_WARNING, "Ora_Do failed (%s)",
- ora_error(&cursor->cda));
- _close_oracur(cursor);
- RETURN_FALSE;
- }
- }
-
- ZEND_REGISTER_RESOURCE(return_value, cursor, le_cursor);
-}
-/* }}} */
-
-/* {{{ proto int ora_fetch(int cursor)
- Fetch a row of result data from a cursor */
-PHP_FUNCTION(ora_fetch)
-{ /* cursor_index */
- pval **arg;
- oraCursor *cursor;
-
- if (zend_get_parameters_ex(1, &arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if ((cursor = ora_get_cursor(&EG(regular_list), arg)) == NULL) {
- RETURN_FALSE;
- }
-
- if (cursor->ncols == 0){
- php_error(E_WARNING, "No tuples available on this cursor");
- RETURN_FALSE;
- }
-
- /* Get data from Oracle */
- if (ofetch(&cursor->cda)) {
- if (cursor->cda.rc != NO_DATA_FOUND) {
- php_error(E_WARNING, "Ora_Fetch failed (%s)",
- ora_error(&cursor->cda));
- }
- RETURN_FALSE;
- }
- cursor->fetched++;
- RETVAL_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int ora_fetch_into(int cursor, array result [, int flags])
- Fetch a row into the specified result array */
-PHP_FUNCTION(ora_fetch_into)
-{
- pval **curs, **arr, **flg, *tmp;
- oraCursor *cursor;
- int i;
- int flags = 0;
-
- switch(ZEND_NUM_ARGS()){
- case 2:
- zend_get_parameters_ex(2, &curs, &arr);
- break;
-
- case 3:
- zend_get_parameters_ex(3, &curs, &arr, &flg);
- convert_to_long_ex(flg);
- flags = (*flg)->value.lval;
- break;
-
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- /* Find the cursor */
- if ((cursor = ora_get_cursor(&EG(regular_list), curs)) == NULL) {
- RETURN_FALSE;
- }
-
- if (cursor->ncols == 0){
- php_error(E_WARNING, "No tuples available on this cursor");
- RETURN_FALSE;
- }
-
- if (ofetch(&cursor->cda)) {
- if (cursor->cda.rc != NO_DATA_FOUND) {
- php_error(E_WARNING, "Ora_Fetch_Into failed (%s)",ora_error(&cursor->cda));
- }
- RETURN_FALSE;
- }
- cursor->fetched++;
-
- if ((*arr)->type != IS_ARRAY){
- pval_destructor(*arr);
- if (array_init(*arr) == FAILURE){
- php_error(E_WARNING, "Can't convert to type Array");
- RETURN_FALSE;
- }
- }
- zend_hash_internal_pointer_reset((*arr)->value.ht);
-
- for (i = 0; i < cursor->ncols; i++) {
- if (cursor->columns[i].col_retcode == 1405) {
- if (!(flags&ORA_FETCHINTO_NULLS)){
- continue; /* don't add anything for NULL columns, unless the calles wants it */
- } else {
- MAKE_STD_ZVAL(tmp);
- ZVAL_NULL(tmp);
- }
- } else if (cursor->columns[i].col_retcode != 0 &&
- cursor->columns[i].col_retcode != 1406) {
- /* So error fetching column. The most common is 1405, a NULL */
- /* was retreived. 1406 is ASCII or string buffer data was */
- /* truncated. The converted data from the database did not fit */
- /* into the buffer. Since we allocated the buffer to be large */
- /* enough, this should not occur. Anyway, we probably want to */
- /* return what we did get, in that case */
- RETURN_FALSE;
- } else {
- MAKE_STD_ZVAL(tmp);
-
- tmp->type = IS_STRING;
- tmp->value.str.len = 0;
-
- switch(cursor->columns[i].dbtype) {
- case SQLT_LNG:
- case SQLT_LBI:
- {
- ub4 ret_len;
- int offset = cursor->columns[i].col_retlen;
- sb2 result;
-
- if (cursor->columns[i].col_retcode == 1406) { /* truncation -> get the rest! */
- while (1) {
- cursor->columns[i].buf = erealloc(cursor->columns[i].buf,offset + DB_SIZE + 1);
-
- if (! cursor->columns[i].buf) {
- offset = 0;
- break;
- }
-
- result = oflng(&cursor->cda,
- (sword)(i + 1),
- cursor->columns[i].buf + offset,
- DB_SIZE,
- 1,
- &ret_len,
- offset);
- if (result) {
- break;
- }
-
- if (ret_len <= 0) {
- break;
- }
-
- offset += ret_len;
- }
- }
- if (cursor->columns[i].buf && offset) {
- tmp->value.str.len = offset;
- } else {
- tmp->value.str.len = 0;
- }
- }
- break;
- default:
- tmp->value.str.len = min(cursor->columns[i].col_retlen,
- cursor->columns[i].dsize);
- break;
- }
- tmp->value.str.val = estrndup(cursor->columns[i].buf,tmp->value.str.len);
- }
-
- if (flags&ORA_FETCHINTO_ASSOC){
- zend_hash_update((*arr)->value.ht, cursor->columns[i].cbuf, cursor->columns[i].cbufl+1, (void *) &tmp, sizeof(pval*), NULL);
- } else {
- zend_hash_index_update((*arr)->value.ht, i, (void *) &tmp, sizeof(pval*), NULL);
- }
-
- }
-
- RETURN_LONG(cursor->ncols);
-}
-/* }}} */
-
-/* {{{ proto string ora_columnname(int cursor, int column)
- Get the name of an Oracle result column */
-PHP_FUNCTION(ora_columnname)
-{ /* cursor_index, column_index */
- pval **curs, **col;
- oraCursor *cursor = NULL;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &curs, &col) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if ((cursor = ora_get_cursor(&EG(regular_list), curs)) == NULL) {
- RETURN_FALSE;
- }
-
- convert_to_long_ex(col);
-
- if (cursor->ncols == 0){
- php_error(E_WARNING, "No tuples available at this cursor index");
- RETURN_FALSE;
- }
-
- if ((*col)->value.lval >= cursor->ncols){
- php_error(E_WARNING, "Column index larger than number of columns");
- RETURN_FALSE;
- }
-
- if ((*col)->value.lval < 0){
- php_error(E_WARNING, "Column numbering starts at 0");
- RETURN_FALSE;
- }
-
- RETURN_STRINGL(cursor->columns[(*col)->value.lval].cbuf,
- cursor->columns[(*col)->value.lval].cbufl,1);
-}
-/* }}} */
-
-/* {{{ proto string ora_columntype(int cursor, int column)
- Get the type of an Oracle result column */
-PHP_FUNCTION(ora_columntype)
-{ /* cursor_index, column_index */
- pval **curs, **col;
- int colno;
- oraCursor *cursor = NULL;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &curs, &col) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if ((cursor = ora_get_cursor(&EG(regular_list), curs)) == NULL) {
- RETURN_FALSE;
- }
-
- convert_to_long_ex(col);
- colno = (*col)->value.lval;
-
- if (cursor->ncols == 0){
- php_error(E_WARNING, "No tuples available at this cursor index");
- RETURN_FALSE;
- }
-
- if (colno >= cursor->ncols){
- php_error(E_WARNING, "Column index larger than number of columns");
- RETURN_FALSE;
- }
-
- if (colno < 0){
- php_error(E_WARNING, "Column numbering starts at 0");
- RETURN_FALSE;
- }
-
- switch (cursor->columns[colno].dbtype) {
- case SQLT_CHR:
- RETURN_STRINGL("VARCHAR2", 8, 1);
- case SQLT_VCS:
- case SQLT_AVC:
- RETURN_STRINGL("VARCHAR", 7, 1);
- case SQLT_STR:
- case SQLT_AFC:
- RETURN_STRINGL("CHAR", 4, 1);
- case SQLT_NUM: case SQLT_INT:
- case SQLT_FLT: case SQLT_UIN:
- RETURN_STRINGL("NUMBER", 6, 1);
- case SQLT_LNG:
- RETURN_STRINGL("LONG", 4, 1);
- case SQLT_LBI:
- RETURN_STRINGL("LONG RAW", 8, 1);
- case SQLT_RID:
- RETURN_STRINGL("ROWID", 5, 1);
- case SQLT_DAT:
- RETURN_STRINGL("DATE", 4, 1);
-#ifdef SQLT_CUR
- case SQLT_CUR:
- RETURN_STRINGL("CURSOR", 6, 1);
-#endif
- default:
- {
- char numbuf[21];
- snprintf(numbuf, 20, "UNKNOWN(%d)", cursor->columns[colno].dbtype);
- numbuf[20] = '\0';
- RETVAL_STRING(numbuf,1);
- }
- }
-}
-/* }}} */
-
-/* {{{ proto int ora_columnsize(int cursor, int column)
- Return the size of the column */
-PHP_FUNCTION(ora_columnsize)
-{ /* cursor_index, column_index */
- pval **curs, **col;
- oraCursor *cursor = NULL;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &curs, &col) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- /* Find the cursor */
- if ((cursor = ora_get_cursor(&EG(regular_list), curs)) == NULL) {
- RETURN_FALSE;
- }
-
- convert_to_long_ex(col);
-
- if (cursor->ncols == 0){
- php_error(E_WARNING, "No tuples available at this cursor index");
- RETURN_FALSE;
- }
-
- if ((*col)->value.lval >= cursor->ncols){
- php_error(E_WARNING, "Column index larger than number of columns");
- RETURN_FALSE;
- }
-
- if ((*col)->value.lval < 0){
- php_error(E_WARNING, "Column numbering starts at 0");
- RETURN_FALSE;
- }
-
- RETURN_LONG(cursor->columns[(*col)->value.lval].dbsize);
-}
-/* }}} */
-
-/* {{{ proto mixed ora_getcolumn(int cursor, int column)
- Get data from a fetched row */
-PHP_FUNCTION(ora_getcolumn)
-{ /* cursor_index, column_index */
- pval **curs,**col;
- int colno;
- oraCursor *cursor = NULL;
- oraColumn *column = NULL;
- int len;
- sb2 type;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &curs, &col) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if ((cursor = ora_get_cursor(&EG(regular_list), curs)) == NULL) {
- RETURN_FALSE;
- }
-
- if (cursor->ncols == 0){
- php_error(E_WARNING, "No tuples available at this cursor index");
- RETURN_FALSE;
- }
-
- convert_to_long_ex(col);
- colno = (*col)->value.lval;
-
- if (colno >= cursor->ncols){
- php_error(E_WARNING, "Column index larger than number of columns");
- RETURN_FALSE;
- }
-
- if (colno < 0){
- php_error(E_WARNING, "Column numbering starts at 0");
- RETURN_FALSE;
- }
-
- if (cursor->fetched == 0){
- if (ofetch(&cursor->cda)) {
- if (cursor->cda.rc != NO_DATA_FOUND) {
- php_error(E_WARNING, "Ora_Fetch failed (%s)",
- ora_error(&cursor->cda));
- }
- RETURN_FALSE;
- }
- cursor->fetched++;
- }
-
- column = &cursor->columns[colno];
-
- type = column->dbtype;
-
- if (column->col_retcode == 1405) {
- RETURN_NULL();
- }
-
- if (column->col_retcode != 0 && column->col_retcode != 1406) {
- /* So error fetching column. The most common is 1405, a NULL
- * was retreived. 1406 is ASCII or string buffer data was
- * truncated. The converted data from the database did not fit
- * into the buffer. Since we allocated the buffer to be large
- * enough, this should not occur. Anyway, we probably want to
- * return what we did get, in that case
- */
- RETURN_FALSE;
- } else {
- switch(type) {
- case SQLT_CHR:
- case SQLT_NUM:
- case SQLT_INT:
- case SQLT_FLT:
- case SQLT_STR:
- case SQLT_UIN:
- case SQLT_AFC:
- case SQLT_AVC:
- case SQLT_DAT:
- len = min(column->col_retlen, column->dsize);
- RETURN_STRINGL(column->buf,len,1);
-
- case SQLT_LNG:
- case SQLT_LBI:
- {
- ub4 ret_len;
- int offset = column->col_retlen;
- sb2 result;
-
- if (column->col_retcode == 1406) { /* truncation -> get the rest! */
- while (1) {
- column->buf = erealloc(column->buf,offset + DB_SIZE + 1);
-
- if (! column->buf) {
- offset = 0;
- break;
- }
-
- result = oflng(&cursor->cda,
- (sword)(colno + 1),
- column->buf + offset,
- DB_SIZE,
- 1,
- &ret_len,
- offset);
- if (result) {
- break;
- }
-
- if (ret_len <= 0) {
- break;
- }
-
- offset += ret_len;
- }
- }
- if (column->buf && offset) {
- RETURN_STRINGL(column->buf, offset, 1);
- } else {
- RETURN_FALSE;
- }
- }
- default:
- php_error(E_WARNING,"Ora_GetColumn found invalid type (%d)", type);
- RETURN_FALSE;
- }
- }
-}
-/* }}} */
-
-/* {{{ proto string ora_error(int cursor_or_connection)
- Get an Oracle error message */
-PHP_FUNCTION(ora_error)
-{
- pval **arg;
- oraCursor *cursor;
- oraConnection *conn;
- void *res;
- int what;
- int argc = ZEND_NUM_ARGS();
- ORALS_FETCH();
-
- if (argc < 0 || argc >> 1 || zend_get_parameters_ex(argc, &arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if (argc == 1) {
- res = zend_fetch_resource(arg, -1,"Oracle-Connection/Cursor",&what,3,le_conn, le_pconn, le_cursor);
- ZEND_VERIFY_RESOURCE(res);
-
- if (what == le_cursor) {
- cursor = (oraCursor *) res;
- RETURN_STRING(ora_error(&cursor->cda),1);
- } else {
- conn = (oraConnection *) res;
- RETURN_STRING(ora_error(&conn->lda),1);
- }
- } else {
- RETURN_STRING(ora_error(&ORA(db_err_conn).lda),1);
- }
-}
-/* }}} */
-
-/* {{{ proto int ora_errorcode(int cursor_or_connection)
- Get an Oracle error code */
-PHP_FUNCTION(ora_errorcode)
-{
- pval **arg;
- oraCursor *cursor;
- oraConnection *conn;
- void *res;
- int what;
- int argc = ZEND_NUM_ARGS();
- ORALS_FETCH();
-
- if (argc < 0 || argc >> 1 || zend_get_parameters_ex(argc, &arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if (argc == 1) {
- res = zend_fetch_resource(arg, -1,"Oracle-Connection/Cursor",&what,3,le_conn, le_pconn, le_cursor);
- ZEND_VERIFY_RESOURCE(res);
-
- if (what == le_cursor) {
- cursor = (oraCursor *) res;
- RETURN_LONG(cursor->cda.rc);
- } else {
- conn = (oraConnection *) res;
- RETURN_LONG(conn->lda.rc);
- }
- } else {
- RETURN_LONG(ORA(db_err_conn).lda.rc);
- }
-}
-/* }}} */
-
-/* {{{ PHP_MINFO_FUNCTION
- */
-PHP_MINFO_FUNCTION(oracle)
-{
-
- php_info_print_table_start();
- php_info_print_table_row(2, "Oracle Support", "enabled");
-#ifndef PHP_WIN32
- php_info_print_table_row(2, "Oracle Version", PHP_ORACLE_VERSION );
- php_info_print_table_row(2, "Compile-time ORACLE_HOME", PHP_ORACLE_DIR );
- php_info_print_table_row(2, "Libraries Used", PHP_ORACLE_SHARED_LIBADD );
-#endif
- php_info_print_table_end();
-}
-/* }}} */
-
-/*
-** Functions internal to this module.
-*/
-
-/* {{{ ora_get_cursor
- */
-static oraCursor *
-ora_get_cursor(HashTable *list, pval **ind)
-{
- oraCursor *cursor;
- oraConnection *db_conn;
- ORALS_FETCH();
-
- cursor = (oraCursor *) zend_fetch_resource(ind, -1, "Oracle-Cursor", NULL, 1, le_cursor);
- if (! cursor) {
- return NULL;
- }
-
- if (zend_hash_find(ORA(conns),(void*)&(cursor->conn_ptr),sizeof(void*),(void **)&db_conn) == FAILURE) {
- php_error(E_WARNING, "Connection already closed for cursor index %d", ind);
- return NULL;
- }
-
- return cursor;
-}
-/* }}} */
-
-/* {{{ ora_error
- */
-static char *
-ora_error(Cda_Def * cda)
-{
- sword n, l;
- static text errmsg[ 512 ];
-
- n = oerhms(cda, cda->rc, errmsg, 400);
-
- /* remove the last newline */
- l = strlen(errmsg);
- if (l < 400 && errmsg[l - 1] == '\n') {
- errmsg[l - 1] = '\0';
- l--;
- }
- if (cda->fc > 0) {
- strcat(errmsg, " -- while processing OCI function ");
- strncat(errmsg, ora_func_tab[cda->fc], 75); /* 512 - 400 - 36 */
- }
- return (char *) errmsg;
-}
-/* }}} */
-
-/* {{{ ora_describe_define
- */
-static sword
-ora_describe_define(oraCursor * cursor)
-{
- long col = 0;
- int i;
- sb2 type;
- sb4 dbsize;
-
- if (cursor == NULL) {
- return -1;
- }
-
- if (cursor->columns) {
- for(i = 0; i < cursor->ncols; i++){
- if (cursor->columns[i].buf)
- efree(cursor->columns[i].buf);
- }
- efree(cursor->columns);
- }
-
- cursor->ncols = 0;
-
- while(1){
- if (odescr(&cursor->cda, (sword) cursor->ncols + 1, &dbsize, (sb2 *)0, (sb1 *)0,
- (sb4 *)0, (sb4 *)0, (sb2 *)0, (sb2 *)0, (sb2 *)0)){
- if (cursor->cda.rc == VAR_NOT_IN_LIST) {
- break;
- } else {
- php_error(E_WARNING, "%s", ora_error(&cursor->cda));
- cursor->ncols = 0;
- return -1;
- }
- }
- cursor->ncols++;
- }
-
- if (cursor->ncols > 0){
- cursor->columns = (oraColumn *) emalloc(sizeof(oraColumn) * cursor->ncols);
- if (cursor->columns == NULL){
- php_error(E_WARNING, "Out of memory");
- return -1;
- }
- memset(cursor->columns,0,sizeof(oraColumn) * cursor->ncols);
- }
-
- for(col = 0; col < cursor->ncols; col++){
- cursor->columns[col].cbufl = ORANAMELEN;
-
- if (odescr(&cursor->cda, (sword)col + 1, &cursor->columns[col].dbsize,
- &cursor->columns[col].dbtype, &cursor->columns[col].cbuf[0],
- &cursor->columns[col].cbufl, &cursor->columns[col].dsize,
- &cursor->columns[col].prec, &cursor->columns[col].scale,
- &cursor->columns[col].nullok)) {
- if (cursor->cda.rc == VAR_NOT_IN_LIST) {
- break;
- } else {
- php_error(E_WARNING, "%s", ora_error(&cursor->cda));
- return -1;
- }
- }
-
- cursor->columns[col].cbuf[cursor->columns[col].cbufl] = '\0';
-
- switch (cursor->columns[col].dbtype) {
- case SQLT_LBI:
- cursor->columns[col].dsize = DB_SIZE;
- type = SQLT_LBI;
- break;
- case SQLT_LNG:
- cursor->columns[col].dsize = DB_SIZE;
- default:
- type = SQLT_STR;
- break;
- }
-
- if ((cursor->columns[col].buf = (ub1 *) emalloc(cursor->columns[col].dsize + 1)) == NULL){
- php_error(E_WARNING, "Out of memory");
- return -1;
- }
- /* Define an output variable for the column */
- if (odefin(&cursor->cda, (sword)col + 1, cursor->columns[col].buf,
- cursor->columns[col].dsize + 1, type, -1, &cursor->columns[col].indp,
- (text *) 0, -1, -1, &cursor->columns[col].col_retlen,
- &cursor->columns[col].col_retcode)) {
- php_error(E_WARNING, "%s", ora_error(&cursor->cda));
- return -1;
- }
- }
- return 1;
-}
-/* }}} */
-
-/* {{{ ora_set_param_values
- */
-int ora_set_param_values(oraCursor *cursor, int isout)
-{
- char *paramname;
- oraParam *param;
- pval **pdata;
- int i, len, plen;
-
- ELS_FETCH();
-
- zend_hash_internal_pointer_reset(cursor->params);
-
- if(zend_hash_num_elements(cursor->params) != cursor->nparams){
- php_error(E_WARNING, "Mismatch in number of parameters");
- return 0;
- }
-
- for(i = 0; i < cursor->nparams; i++, zend_hash_move_forward(cursor->params)){
- if(zend_hash_get_current_key(cursor->params, &paramname, NULL, 0) != HASH_KEY_IS_STRING){
- php_error(E_WARNING, "Can't get parameter name");
- return 0;
- }
-
- if(zend_hash_get_current_data(cursor->params, (void **)&param) == FAILURE){
- php_error(E_WARNING, "Can't get parameter data");
- return 0;
- }
-
- if(isout){
- SET_VAR_STRINGL(paramname, estrdup(param->progv), strlen(param->progv));
- continue;
- }
-
- /* doing the in-loop */
-
- if (zend_hash_find(&EG(symbol_table), paramname, strlen(paramname) + 1, (void **)&pdata) == FAILURE){
- php_error(E_WARNING, "Can't find variable for parameter");
- return 0;
- }
-
- convert_to_string(*pdata);
- plen = (*pdata)->value.str.len;
-
- if (param->progvl <= plen){
- php_error(E_NOTICE, "Input value will be truncated");
- }
-
- len = min(param->progvl - 1, plen);
-
- strncpy(param->progv, (*pdata)->value.str.val, len);
- param->progv[len] = '\0';
- }
-
- return 1;
-}
-/* }}} */
-
-#endif /* HAVE_ORACLE */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/oracle/oracle.dsp b/ext/oracle/oracle.dsp
deleted file mode 100644
index 1791bf877c..0000000000
--- a/ext/oracle/oracle.dsp
+++ /dev/null
@@ -1,113 +0,0 @@
-# Microsoft Developer Studio Project File - Name="oracle" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=oracle - Win32 Release_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "oracle.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "oracle.mak" CFG="oracle - Win32 Release_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "oracle - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "oracle - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "oracle - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\..\TSRM" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_ORACLE" /D ZTS=1 /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\\" /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /I "..\..\..\php_build\oci73\include" /D ZEND_DEBUG=0 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_ORACLE=1 /D COMPILE_DL_ORACLE=1 /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x406 /d "NDEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib /nologo /dll /machine:I386
-# ADD LINK32 php4ts.lib ociw32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_oracle.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\..\php_build\oci73\lib" /libpath:"..\..\Release_TS_Inline"
-
-!ELSEIF "$(CFG)" == "oracle - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D ZTS=1 /YX /FD /c
-# ADD CPP /nologo /MDd /W3 /GX /O2 /I "..\..\\" /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /I "..\..\..\php_build\oci73\include" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_ORACLE" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_ORACLE=1 /D COMPILE_DL_ORACLE=1 /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x406 /d "NDEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts-debug.lib /nologo /dll /machine:I386
-# ADD LINK32 php4ts_debug.lib ociw32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\Debug_TS/php_oracle.dll" /libpath:"..\..\Debug_TS" /libpath:"..\..\..\php_build\oci73\lib"
-
-!ENDIF
-
-# Begin Target
-
-# Name "oracle - Win32 Release_TS"
-# Name "oracle - Win32 Debug_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\oracle.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_oracle.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/ext/oracle/php_oracle.h b/ext/oracle/php_oracle.h
deleted file mode 100644
index 6b16e520a9..0000000000
--- a/ext/oracle/php_oracle.h
+++ /dev/null
@@ -1,147 +0,0 @@
-/* $Id$ */
-
-/* synced with oracle.h,v 1.40 1999/06/01 08:11:04 thies Exp $ */
-
-#ifndef PHP_ORACLE_H
-#define PHP_ORACLE_H
-
-#if HAVE_ORACLE
-
-#if (defined(__osf__) && defined(__alpha))
-# ifndef A_OSF
-# define A_OSF
-# endif
-# ifndef OSF1
-# define OSF1
-# endif
-# ifndef _INTRINSICS
-# define _INTRINSICS
-# endif
-#endif /* osf alpha */
-
-#include "oratypes.h"
-#include "ocidfn.h"
-#include "ociapr.h"
-
-extern zend_module_entry oracle_module_entry;
-#define phpext_oracle_ptr &oracle_module_entry
-
-#ifdef ZTS
-#define ORALS_D php_ora_globals *ora_globals
-#define ORALS_DC , ORACLE_D
-#define ORALS_C ora_globals
-#define ORALS_CC , ORALS_C
-#define ORA(v) (ora_globals->v)
-#define ORALS_FETCH() php_ora_globals *ora_globals = ts_resource(ora_globals_id)
-#else
-#define ORALS_D
-#define ORALS_DC
-#define ORALS_C
-#define ORALS_CC
-#define ORA(v) (ora_globals.v)
-#define ORALS_FETCH()
-#endif
-
-/* oparse flags */
-#define DEFER_PARSE 1
-#define NATIVE 1
-#define VERSION_7 2
-
-#define ORANUMWIDTH 38
-
-#if (defined(__osf__) && defined(__alpha)) || defined(CRAY) || defined(KSR)
-#define HDA_SIZE 512
-#else
-#define HDA_SIZE 256
-#endif
-
-#define ORAUIDLEN 32
-#define ORAPWLEN 32
-#define ORANAMELEN 32
-#define ORABUFLEN 2000
-
-/* Some Oracle error codes */
-#define VAR_NOT_IN_LIST 1007
-#define NO_DATA_FOUND 1403
-#define NULL_VALUE_RETURNED 1405
-
-/* Some SQL and ORA function codes */
-#define FT_INSERT 3
-#define FT_SELECT 4
-#define FT_UPDATE 5
-#define FT_DELETE 9
-
-#define FC_OOPEN 14
-
-typedef struct {
- int open;
- int persistent;
- Lda_Def lda;
- ub1 hda[HDA_SIZE];
-} oraConnection;
-
-typedef struct oraColumn {
- sb4 dbsize;
- sb2 dbtype;
- text cbuf[ORANAMELEN+1];
- sb4 cbufl;
- sb4 dsize;
- sb2 prec;
- sb2 scale;
- sb2 nullok;
- ub1 *buf;
- sb2 indp;
- ub2 col_retlen, col_retcode;
-} oraColumn;
-
-typedef struct oraParam {
- text *progv;
- sword progvl;
- sb2 inout;
- ub2 alen;
-} oraParam;
-
-typedef struct oraCursor {
- int open;
- Cda_Def cda;
- text *query;
- HashTable *params;
- int nparams;
- oraColumn *columns;
- int ncols;
- int fetched;
- oraConnection *conn_ptr;
- int conn_id;
-} oraCursor;
-
-typedef struct {
- char *defDB;
- char *defUser;
- char *defPW;
- long allow_persistent;
- long max_persistent;
- long max_links;
- long num_persistent;
- long num_links;
- HashTable *conns;
- oraConnection db_err_conn;
-} php_ora_globals;
-
-#else
-
-#define phpext_oracle_ptr NULL
-
-#endif /* HAVE_ORACLE */
-
-#endif /* PHP_ORACLE_H */
-
-/*
- * Local Variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
-
-
-
-
diff --git a/ext/oracle/setup.stub b/ext/oracle/setup.stub
deleted file mode 100644
index d49e64d13a..0000000000
--- a/ext/oracle/setup.stub
+++ /dev/null
@@ -1,9 +0,0 @@
-# $Source$
-# $Id$
-
-define_option with-oracle 'Oracle support?' yesnodir \
- "no $oradir Oracle home" \
-' Whether to build PHP with Oracle support. Has been confirmed to\n
- work with Oracle versions 7.0 to 7.3. If you have not set up your\n
- Oracle environment, enter what $ORACLE_HOME is usually set to here.\n
- More info about Oracle can be found at http://www.oracle.com/.'
diff --git a/ext/ovrimos/CREDITS b/ext/ovrimos/CREDITS
deleted file mode 100644
index b8c4b75630..0000000000
--- a/ext/ovrimos/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-Ovrimos
-Nikos Mavroyanopoulos
diff --git a/ext/ovrimos/Makefile.in b/ext/ovrimos/Makefile.in
deleted file mode 100644
index 31f5829165..0000000000
--- a/ext/ovrimos/Makefile.in
+++ /dev/null
@@ -1,7 +0,0 @@
-
-LTLIBRARY_NAME = libovrimos.la
-LTLIBRARY_SOURCES = ovrimos.c
-LTLIBRARY_SHARED_NAME = ovrimos.la
-LTLIBRARY_SHARED_LIBADD = $(OVRIMOS_SHARED_LIBADD)
-
-include $(top_srcdir)/build/dynlib.mk
diff --git a/ext/ovrimos/config.m4 b/ext/ovrimos/config.m4
deleted file mode 100644
index f495e14a5f..0000000000
--- a/ext/ovrimos/config.m4
+++ /dev/null
@@ -1,28 +0,0 @@
-dnl $Id$
-dnl config.m4 for extension ovrimos
-dnl don't forget to call PHP_EXTENSION(ovrimos)
-
-PHP_ARG_WITH(ovrimos, for Ovrimos SQL Server support,
-[ --with-ovrimos[=DIR] Include Ovrimos SQL Server support. DIR is the
- Ovrimos' libsqlcli install directory.])
-
-if test "$PHP_OVRIMOS" != "no"; then
- for i in /usr/local /usr $PHP_OVRIMOS; do
- if test -f $i/include/sqlcli.h; then
- OVRIMOS_DIR=$i
- fi
- done
-
- if test -z "$OVRIMOS_DIR"; then
- AC_MSG_ERROR(Please reinstall Ovrimos' libsqlcli - I cannot find sqlcli.h)
- fi
-
- PHP_ADD_INCLUDE($OVRIMOS_DIR/include)
- PHP_SUBST(OVRIMOS_SHARED_LIBADD)
- LDFLAGS="$LDFLAGS $ld_runpath_switch$OVRIMOS_DIR/lib -L$OVRIMOS_DIR/lib"
- AC_CHECK_LIB(sqlcli, main)
- PHP_ADD_LIBRARY_WITH_PATH(sqlcli, $OVRIMOS_DIR/lib, OVRIMOS_SHARED_LIBADD)
- AC_DEFINE(HAVE_LIBSQLCLI,1,[ ])
-
- PHP_EXTENSION(ovrimos, $ext_shared)
-fi
diff --git a/ext/ovrimos/ovrimos.c b/ext/ovrimos/ovrimos.c
deleted file mode 100644
index 08bb341872..0000000000
--- a/ext/ovrimos/ovrimos.c
+++ /dev/null
@@ -1,1101 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Dimitris Souflis <dsouflis@acm.org>, <dsouflis@ovrimos.com> |
- | integrated to php by Nikos Mavroyanopoulos <nmav@altera.gr> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#include <php.h>
-#include <php_globals.h>
-#include <zend_API.h>
-#include "ext/standard/php_standard.h"
-#include "ext/standard/info.h"
-#include <sqlcli.h>
-#if !defined(WIN32)
-# define stricmp strcasecmp
-#endif
-static longreadlen = 0;
-static void column_to_string(SQLS stmt, int i, char *buffer, int *len);
-
-PHP_MINFO_FUNCTION(ovrimos)
-{
- php_printf("&quot;Ovrimos&quot; module<br>\n");
-}
-
-/* Main User Functions */
-/* {{{ proto int ovrimos_connect(string host, string db, string user, string password)
- Connect to an Ovrimos database */
-PHP_FUNCTION(ovrimos_connect)
-{
- pval *arg1, *arg2, *arg3, *arg4;
- SQLH conn = 0;
- if (ARG_COUNT(ht) != 4
- || getParameters(ht, 4, &arg1, &arg2, &arg3, &arg4) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string(arg1);
- convert_to_string(arg2);
- convert_to_string(arg3);
- convert_to_string(arg4);
- if (!sqlConnect
- (arg1->value.str.val, arg2->value.str.val, arg3->value.str.val,
- arg4->value.str.val, &conn, 0)) {
- RETURN_LONG(0);
- }
- RETURN_LONG((int) conn + 1);
-}
-
-/* }}} */
-
-/* {{{ proto void ovrimos_close(int connection)
- Close a connection */
-PHP_FUNCTION(ovrimos_close)
-{
- pval *arg1;
- SQLH conn;
- if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg1) == FAILURE
- || arg1->type != IS_LONG) {
- WRONG_PARAM_COUNT;
- }
- conn = (SQLH) (arg1->value.lval - 1);
- (void) sqlDisConnect(conn);
-}
-
-/* }}} */
-
-/* {{{ proto void ovrimos_close_all()
- Close all connections */
-PHP_FUNCTION(ovrimos_close_all)
-{
- pval *arg1;
- SQLH conn;
- (void) sqlDisconnectAll();
-}
-
-/* }}} */
-
-/* {{{ proto int ovrimos_longreadlen(int result_id, int length)
- Handle LONG columns */
-PHP_FUNCTION(ovrimos_longreadlen)
-{
- pval *arg1, *arg2;
- if (getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long(arg1);
- convert_to_long(arg2);
- longreadlen = arg2->value.lval;
- RETURN_TRUE;
-}
-
-/* }}} */
-
-/* {{{ proto int ovrimos_prepare(int connection_id, string query)
- Prepares a statement for execution */
-PHP_FUNCTION(ovrimos_prepare)
-{
- pval *arg1, *arg2;
- SQLH conn;
- char *query;
- SQLS stmt;
-
- if (getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long(arg1);
- convert_to_string(arg2);
- conn = (SQLH) (arg1->value.lval - 1);
- query = arg2->value.str.val;
-
- if (!sqlAllocStmt(conn, &stmt)) {
- RETURN_FALSE;
- }
- if (!sqlPrepare(stmt, query)) {
- sqlFreeStmt(stmt);
- RETURN_FALSE;
- }
- if (!sqlGetOutputColDescr(stmt)) {
- sqlFreeStmt(stmt);
- RETURN_FALSE;
- }
- if (!sqlGetParamDescr(stmt)) {
- sqlFreeStmt(stmt);
- RETURN_FALSE;
- }
- RETURN_LONG((int) stmt + 1);
-}
-
-/* }}} */
-
-/*
- * Execute prepared SQL statement. Supports only input parameters.
- */
-/* {{{ proto int ovrimos_execute(int result_id [, array parameters_array])
- Execute a prepared statement */
-PHP_FUNCTION(ovrimos_execute)
-{
- pval *arg1, *arg2;
- SQLS stmt;
- int numArgs;
- int icol, colnb;
- numArgs = ARG_COUNT(ht);
-
- if (getParameters(ht, numArgs, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(arg1);
- stmt = (SQLS) (arg1->value.lval - 1);
- colnb = sqlGetParamNb(stmt);
-
- if (colnb != 0) {
- pval **tmp;
- int arr_elem;
-
- if (arg2->type != IS_ARRAY) {
- php_error(E_WARNING,
- "Not an array in call to ovrimos_execute()");
- RETURN_FALSE;
- }
- arr_elem = zend_hash_num_elements(arg2->value.ht);
- if (arr_elem < colnb) {
- php_error(E_WARNING,
- "Not enough parameters in call to ovrimos_execute(): %d instead of %d",
- arr_elem, colnb);
- RETURN_FALSE;
- }
-
- zend_hash_internal_pointer_reset(arg2->value.ht);
-
- for (icol = 0; icol < colnb; icol++) {
- int len;
- cvt_error err;
- bool ret;
- char *msg;
- char buffer[10240];
- sql_type to_type = sqlGetParamSQLType(stmt, icol);
- sql_type from_type;
-
- if (zend_hash_get_current_data
- (arg2->value.ht, (void **) &tmp) == FAILURE) {
- php_error(E_WARNING,
- "Error getting parameter %d in call to ovrimos_execute()",
- icol);
- RETURN_FALSE;
- }
- convert_to_string(*tmp);
- if ((*tmp)->type != IS_STRING) {
- php_error(E_WARNING,
- "Error converting parameter %d to string in call to ovrimos_execute()",
- icol);
- RETURN_FALSE;
- }
-
- /* PHP data to param type */
- from_type.type = T_VARCHAR;
- from_type.u.length = (*tmp)->value.str.len;
-
- *buffer = 0;
- memcpy(buffer + 1, (*tmp)->value.str.val,
- from_type.u.length);
- buffer[from_type.u.length + 1] = 0;
-
- ret =
- type_convert(buffer, &from_type, &to_type, 0,
- &err);
- switch (err) {
- case cvt_trunc:
- msg = "Data truncated";
- break;
- case cvt_range:
- msg = "Numeric value out of range";
- break;
- case cvt_prec:
- msg = "Precision lost";
- break;
- case cvt_incomp:
- msg =
- "Restricted data type attribute violation";
- break;
- case cvt_no:
- msg = "Conversion failed";
- break;
- }
- if (!ret) {
- php_error(E_WARNING,
- "Error converting parameter %d: %s in call to ovrimos_execute()",
- icol, msg);
- RETURN_FALSE;
- }
-
- len = sql_type_size(to_type) - 1;
- if (!sqlPutParam(stmt, icol, buffer + 1, len)) {
- php_error(E_WARNING,
- "Could send parameter %d (%d bytes) in call to ovrimos_execute()",
- icol, len);
- RETURN_FALSE;
- }
- }
- }
-
- if (!sqlExec(stmt)) {
- RETURN_FALSE;
- }
-
- RETURN_TRUE;
-}
-
-/* }}} */
-
-/* {{{ proto string ovrimos_cursor(int result_id)
- Get cursor name */
-PHP_FUNCTION(ovrimos_cursor)
-{
- char cname[126];
- pval *arg1;
- SQLS stmt;
-
- if (getParameters(ht, 1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long(arg1);
- stmt = (SQLS) (arg1->value.lval - 1);
- if (!sqlGetCursorName(stmt, cname)) {
- RETURN_FALSE;
- }
- RETURN_STRING(cname, 1);
-}
-
-/* }}} */
-
-/* {{{ proto int ovrimos_exec(int connection_id, string query)
- Prepare and execute an SQL statement */
-PHP_FUNCTION(ovrimos_exec)
-{
- pval *arg1, *arg2;
- SQLH conn;
- SQLS stmt;
- int numArgs;
- char *query;
- numArgs = ARG_COUNT(ht);
- if (getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(arg1);
- convert_to_string(arg2);
- conn = (SQLH) (arg1->value.lval - 1);
- query = arg2->value.str.val;
-
- if (!sqlAllocStmt(conn, &stmt)) {
- RETURN_FALSE;
- }
- if (!sqlExecDirect(stmt, query)) {
- sqlFreeStmt(stmt);
- RETURN_FALSE;
- }
- if (!sqlGetOutputColDescr(stmt)) {
- sqlFreeStmt(stmt);
- RETURN_FALSE;
- }
- if (!sqlGetParamDescr(stmt)) {
- sqlFreeStmt(stmt);
- RETURN_FALSE;
- }
- RETURN_LONG((int) stmt + 1);
-}
-
-/* }}} */
-
-/* {{{ column_to_string
- */
-static void column_to_string(SQLS stmt, int i, char *buffer, int *len)
-{
- const char *bf = sqlColValue(stmt, i, 0);
- switch (sqlGetOutputColType(stmt, i)) {
- case T_BIGINT:
- case T_UBIGINT:{
- switch (sqlGetOutputColType(stmt, i)) {
- case T_BIGINT:
- printsint64(Read(sint64, bf), buffer);
- break;
- case T_UBIGINT:
- printuint64(Read(uint64, bf), buffer);
- break;
- }
- *len = strlen(buffer);
- }
- break;
- case T_INTEGER:
- sprintf(buffer, "%11ld", Read(sint32, bf));
- *len = strlen(buffer);
- break;
- case T_UINTEGER:
- sprintf(buffer, "%10lu", Read(uint32, bf));
- *len = strlen(buffer);
- break;
- case T_SMALLINT:
- sprintf(buffer, "%6hd", Read(sint16, bf));
- *len = strlen(buffer);
- break;
- case T_USMALLINT:
- sprintf(buffer, "%5hu", Read(uint16, bf));
- *len = strlen(buffer);
- break;
- case T_TINYINT:
- sprintf(buffer, "%4hd", (sint16) Read(sint8, bf));
- *len = strlen(buffer);
- break;
- case T_UTINYINT:
- sprintf(buffer, "%3hu", (uint16) Read(uint8, bf));
- *len = strlen(buffer);
- break;
- case T_BIT:
- sprintf(buffer, "%s",
- (Read(uint8, bf) == 0) ? "off" : "on");
- *len = strlen(buffer);
- break;
- case T_REAL:
- sprintf(buffer, "%9.7g", (double) Read(float, bf));
- *len = strlen(buffer);
- break;
-
- case T_FLOAT:
- case T_DOUBLE:
- sprintf(buffer, "%19.17g", Read(double, bf));
- *len = strlen(buffer);
- break;
- case T_DECIMAL:
- case T_NUMERIC:{
- int prec = sqlGetOutputColPrecision(stmt, i);
- int scale = sqlGetOutputColScale(stmt, i);
- sprintf(buffer, "%*.*f", prec + 2, scale,
- Read(double, bf));
- *len = strlen(buffer);
- } break;
- case T_CHAR:
- case T_VARCHAR:
- strcpy(buffer, bf);
- *len = strlen(buffer);
- break;
- case T_UNI_CHAR:
- case T_UNI_VARCHAR:
- uni_strcpy((uni_char *) buffer, (uni_char *) bf);
- *len = uni_strlen((uni_char *) buffer);
- break;
- case T_BINARY:{
- int sz = sqlGetOutputColLength(stmt, i);
- memcpy(buffer, bf, sz);
- *len = sz;
- } break;
-
- case T_VARBINARY:{
- int sz = Read(uint16, bf);
- memcpy(buffer, bf + 2, sz);
- *len = sz;
- } break;
-
- case T_DATE:{
- char db[11];
- if (!sql_date_to_str((uint32 *) bf, buffer)) {
- strcpy(buffer, "Error!");
- }
- }
- break;
-
- case T_TIME:{
- int prec = sqlGetOutputColPrecision(stmt, i);
- if (!sql_time_to_str
- ((uint32 *) bf, prec, 0, buffer)) {
- strcpy(buffer, "Error!");
- }
- }
- break;
-
- case T_TIMESTAMP:{
- int prec = sqlGetOutputColPrecision(stmt, i);
- if (!sql_timestamp_to_str
- ((uint32 *) bf, prec, 0, buffer)) {
- strcpy(buffer, "Error!");
- }
-
- }
- break;
-
- case T_LONGVARCHAR:
- case T_LONGVARBINARY:{
- if (longreadlen == 0) {
- *buffer = 0;
- *len = 0;
- } else
- if (!sqlColValueLong
- (stmt, i, 0, 0, longreadlen, buffer, len)) {
- strcpy(buffer, "Error!");
- }
- }
- break;
- }
-}
-/* }}} */
-
-/* {{{ proto int ovrimos_fetch_into(int result_id, array result_array [, string how, [int rownumber]])
- Fetch one result row into an array
- how: 'Next' (default), 'Prev', 'First', 'Last', 'Absolute'
- */
-PHP_FUNCTION(ovrimos_fetch_into)
-{
- int numArgs;
- char *s_how;
- typedef enum { h_next = 0, h_prev, h_first, h_last, h_absolute
- } h_type;
- h_type how = h_next; /* default */
- sint32 rownum = 0;
- pval *arg_id, *arg_how = 0, *arg_row = 0, *arr, *tmp;
- SQLS stmt;
- int icol, colnb;
- bool ret;
- numArgs = ARG_COUNT(ht);
-
- switch (numArgs) {
- case 2:
- if (getParameters(ht, 2, &arg_id, &arr) == FAILURE)
- WRONG_PARAM_COUNT;
- break;
- case 3:
- if (getParameters(ht, 3, &arg_id, &arr, &arg_how) ==
- FAILURE) WRONG_PARAM_COUNT;
- break;
- case 4:
- if (getParameters(ht, 4, &arg_id, &arr, &arg_how, &arg_row)
- == FAILURE)
- WRONG_PARAM_COUNT;
- break;
- default:
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(arg_id);
- stmt = (SQLS) (arg_id->value.lval - 1);
-
- if (arg_how != 0) {
- if (arg_how->type != IS_STRING) {
- php_error(E_WARNING,
- "Third argument not string in ovrimos_fetch_into()");
- RETURN_FALSE;
- }
- s_how = arg_how->value.str.val;
- if (stricmp(s_how, "next") == 0) {
- how = h_next;
- } else if (stricmp(s_how, "prev") == 0) {
- how = h_prev;
- } else if (stricmp(s_how, "first") == 0) {
- how = h_first;
- } else if (stricmp(s_how, "last") == 0) {
- how = h_last;
- } else if (stricmp(s_how, "absolute") == 0) {
- how = h_absolute;
- } else {
- php_error(E_WARNING,
- "Third argument not valid in ovrimos_fetch_into()");
- RETURN_FALSE;
- }
- if (arg_row == 0 && how == h_absolute) {
- php_error(E_WARNING,
- "Fourth argument is required for ABSOLUTE in ovrimos_fetch_into()");
- RETURN_FALSE;
- }
- if (arg_row != 0) {
- convert_to_long(arg_row);
- rownum = arg_row->value.lval;
- switch (how) {
- case h_next:
- case h_prev:
- rownum--; /* Next 1 should send FUNC_CURSOR_NEXT(0) */
- break;
- }
- }
- }
-
- if (!ParameterPassedByReference(ht, 2)) { /* 1-based?... */
- php_error(E_WARNING,
- "Array not passed by reference in call to ovrimos_fetch_into()");
- RETURN_FALSE;
- }
-
- if (arr->type != IS_ARRAY) {
- if (array_init(arr) == FAILURE) {
- php_error(E_WARNING,
- "Can't convert to type Array");
- RETURN_FALSE;
- }
- }
- switch (how) {
- case h_absolute:
- case h_first:
- ret = sqlCursorFirst(stmt, rownum);
- break;
- case h_last:
- ret = sqlCursorLast(stmt, rownum);
- break;
- case h_next:
- ret = sqlCursorNext(stmt, rownum);
- break;
- case h_prev:
- ret = sqlCursorPrev(stmt, rownum);
- break;
- }
- if (!ret) {
- RETURN_FALSE;
- }
- colnb = sqlGetOutputColNb(stmt);
- for (icol = 0; icol < colnb; icol++) {
- int len;
- char buffer[10240];
- tmp = (pval *) emalloc(sizeof(pval));
- tmp->refcount = 1;
- tmp->type = IS_STRING;
- tmp->value.str.len = 0;
-
- /* Produce column value in 'tmp' ... */
- column_to_string(stmt, icol, buffer, &len);
- tmp->value.str.len = len;
- tmp->value.str.val = estrndup(buffer, len);
-
- zend_hash_index_update(arr->value.ht, icol, &tmp,
- sizeof(pval *), NULL);
- }
- RETURN_TRUE;
-}
-
-/* }}} */
-
-/* {{{ proto int ovrimos_fetch_row(int result_id [, int how, [int row_number]])
- how: 'Next' (default), 'Prev', 'First', 'Last', 'Absolute'
- Fetch a row */
-PHP_FUNCTION(ovrimos_fetch_row)
-{
- int numArgs, i;
- char *s_how;
- typedef enum { h_next = 0, h_prev, h_first, h_last, h_absolute
- } h_type;
- h_type how = h_next; /* default */
- sint32 rownum = 0;
- pval *arg_id, *arg_how = 0, *arg_row = 0;
- SQLS stmt;
- bool ret;
- numArgs = ARG_COUNT(ht);
-
- switch (numArgs) {
- case 1:
- if (getParameters(ht, 1, &arg_id) == FAILURE)
- WRONG_PARAM_COUNT;
- break;
- case 2:
- if (getParameters(ht, 2, &arg_id, &arg_how) == FAILURE)
- WRONG_PARAM_COUNT;
- break;
- case 3:
- if (getParameters(ht, 3, &arg_id, &arg_how, &arg_row) ==
- FAILURE) WRONG_PARAM_COUNT;
- break;
- default:
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(arg_id);
- stmt = (SQLS) (arg_id->value.lval - 1);
-
- if (arg_how != 0) {
- if (arg_how->type != IS_STRING) {
- php_error(E_WARNING,
- "Second argument not string in ovrimos_fetch_row()");
- RETURN_FALSE;
- }
- s_how = arg_how->value.str.val;
- if (stricmp(s_how, "next") == 0) {
- how = h_next;
- } else if (stricmp(s_how, "prev") == 0) {
- how = h_prev;
- } else if (stricmp(s_how, "first") == 0) {
- how = h_first;
- } else if (stricmp(s_how, "last") == 0) {
- how = h_last;
- } else if (stricmp(s_how, "absolute") == 0) {
- how = h_absolute;
- } else {
- php_error(E_WARNING,
- "Second argument not valid in ovrimos_fetch_row()");
- RETURN_FALSE;
- }
- if (arg_row == 0 && how == 4) {
- php_error(E_WARNING,
- "Third argument is required for ABSOLUTE in ovrimos_fetch_row()");
- RETURN_FALSE;
- }
- if (arg_row != 0) {
- convert_to_long(arg_row);
- rownum = arg_row->value.lval;
- switch (how) {
- case h_next:
- case h_prev:
- rownum--; /* Next 1 should send FUNC_CURSOR_NEXT(0) */
- break;
- }
- }
- }
-
- switch (how) {
- case h_absolute:
- case h_first:
- ret = sqlCursorFirst(stmt, rownum);
- break;
- case h_last:
- ret = sqlCursorLast(stmt, rownum);
- break;
- case h_next:
- ret = sqlCursorNext(stmt, rownum);
- break;
- case h_prev:
- ret = sqlCursorPrev(stmt, rownum);
- break;
- }
- if (!ret) {
- RETURN_FALSE;
- }
- RETURN_TRUE;
-}
-
-/* }}} */
-
-/* {{{ proto string ovrimos_result(int result_id, mixed field)
- Get result data */
-PHP_FUNCTION(ovrimos_result)
-{
- int numArgs = ARG_COUNT(ht);
- pval *arg_id, *arg_field;
- int icol, colnb;
- SQLS stmt;
- int len;
- char buffer[1024];
-
- if (numArgs != 2
- || getParameters(ht, 2, &arg_id,
- &arg_field) == FAILURE) WRONG_PARAM_COUNT;
-
- convert_to_long(arg_id);
- stmt = (SQLS) (arg_id->value.lval - 1);
-
- colnb = sqlGetOutputColNb(stmt);
-
- if (arg_field->type == IS_STRING) {
- int i;
- for (i = 0; i < colnb; i++) {
- if (!stricmp
- (arg_field->value.str.val,
- sqlGetOutputColName(stmt, i))) {
- icol = i;
- break;
- }
- }
- } else if (arg_field->type == IS_LONG) {
- icol = arg_field->value.lval - 1;
- } else {
- php_error(E_WARNING,
- "Second argument neither number nor string in ovrimos_result()");
- RETURN_FALSE;
- }
- if (icol < 0 || icol > colnb) {
- php_error(E_WARNING, "Unknown column in ovrimos_result()");
- RETURN_FALSE;
- }
- column_to_string(stmt, icol, buffer, &len);
-
- RETURN_STRINGL(buffer, len, 1);
-}
-
-/* }}} */
-
-/* {{{ proto int ovrimos_result_all(int result_id [, string format])
- Print result as HTML table */
-PHP_FUNCTION(ovrimos_result_all)
-{
- long fetched = 0;
- pval *arg1, *arg2;
- int numArgs;
- SQLS stmt;
- int icol, colnb;
- char buffer[1024];
- int len;
-
- numArgs = ARG_COUNT(ht);
- if (numArgs == 1) {
- if (getParameters(ht, 1, &arg1) == FAILURE)
- WRONG_PARAM_COUNT;
- } else {
- if (getParameters(ht, 2, &arg1, &arg2) == FAILURE)
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(arg1);
- stmt = (SQLS) (arg1->value.lval - 1);
-
- colnb = sqlGetOutputColNb(stmt);
-
- /* Start table tag */
- if (numArgs == 1) {
- php_printf("<table><tr>");
- } else {
- convert_to_string(arg2);
- php_printf("<table %s ><tr>", arg2->value.str.val);
- }
-
- for (icol = 0; icol < colnb; icol++) {
- php_printf("<th>%s</th>", sqlGetOutputColName(stmt, icol));
- }
-
- php_printf("</tr>\n");
-
- if (sqlCursorFirst(stmt, 0)) {
- do {
- fetched++;
- php_printf("<tr>");
- for (icol = 0; icol < colnb; icol++) {
- column_to_string(stmt, icol, buffer, &len);
- php_printf("<td>%s</td>", buffer);
- }
- php_printf("</tr>\n");
- } while (sqlCursorNext(stmt, 0));
- }
- php_printf("</table>\n");
-
- RETURN_LONG(fetched);
-}
-
-/* }}} */
-
-/* {{{ proto int ovrimos_free_result(int result_id)
- Free resources associated with a result */
-PHP_FUNCTION(ovrimos_free_result)
-{
- pval *arg1;
- SQLS stmt;
-
- if (getParameters(ht, 1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long(arg1);
- stmt = (SQLS) (arg1->value.lval - 1);
- sqlCloseCursor(stmt);
- RETURN_TRUE;
-}
-
-/* }}} */
-
-/* {{{ proto int ovrimos_num_rows(int result_id)
- Get number of rows in a result */
-PHP_FUNCTION(ovrimos_num_rows)
-{
- uint32 rows;
- pval *arg1;
- SQLS stmt;
-
- if (getParameters(ht, 1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(arg1);
- stmt = (SQLS) (arg1->value.lval - 1);
-
- sqlGetRowCount(stmt, &rows);
- RETURN_LONG(rows);
-}
-
-/* }}} */
-
-/* {{{ proto int ovrimos_num_fields(int result_id)
- Get number of columns in a result */
-PHP_FUNCTION(ovrimos_num_fields)
-{
- pval *arg1;
- SQLS stmt;
-
- if (getParameters(ht, 1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(arg1);
- stmt = (SQLS) (arg1->value.lval - 1);
-
- RETURN_LONG(sqlGetOutputColNb(stmt));
-}
-
-/* }}} */
-
-/* {{{ proto string ovrimos_field_name(int result_id, int field_number)
- Get a column name */
-PHP_FUNCTION(ovrimos_field_name)
-{
- pval *arg1, *arg2;
- SQLS stmt;
- int field;
-
- if (getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(arg1);
- convert_to_long(arg2);
- stmt = (SQLS) (arg1->value.lval - 1);
-
- if (arg2->value.lval < 1) {
- php_error(E_WARNING,
- "Field numbering starts at 1! in call to ovrimos_field_name()");
- RETURN_FALSE;
- }
-
- field = arg2->value.lval - 1;
-
- if (field >= sqlGetOutputColNb(stmt)) {
- php_error(E_WARNING,
- "No field at this index (%d) in call to ovrimos_field_name()",
- field);
- RETURN_FALSE;
- }
-
- RETURN_STRING((char *) sqlGetOutputColName(stmt, field), 1);
-}
-
-/* }}} */
-
-/* {{{ proto string ovrimos_field_type(int result_id, int field_number)
- Get the datatype of a column */
-PHP_FUNCTION(ovrimos_field_type)
-{
- pval *arg1, *arg2;
- SQLS stmt;
- int field;
-
- if (getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(arg1);
- convert_to_long(arg2);
- stmt = (SQLS) (arg1->value.lval - 1);
-
- if (arg2->value.lval < 1) {
- php_error(E_WARNING,
- "Field numbering starts at 1! in call to ovrimos_field_type()");
- RETURN_FALSE;
- }
-
- field = arg2->value.lval - 1;
-
- if (field >= sqlGetOutputColNb(stmt)) {
- php_error(E_WARNING,
- "No field at this index (%d) in call to ovrimos_field_type()",
- field);
- RETURN_FALSE;
- }
-
- RETURN_LONG(sqlGetOutputColType(stmt, field));
-}
-
-/* }}} */
-
-/* {{{ proto int ovrimos_field_len(int result_id, int field_number)
- Get the length of a column */
-PHP_FUNCTION(ovrimos_field_len)
-{
- pval *arg1, *arg2;
- SQLS stmt;
- int field;
-
- if (getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(arg1);
- convert_to_long(arg2);
- stmt = (SQLS) (arg1->value.lval - 1);
-
- if (arg2->value.lval < 1) {
- php_error(E_WARNING,
- "Field numbering starts at 1! in call to ovrimos_field_len()");
- RETURN_FALSE;
- }
-
- field = arg2->value.lval - 1;
-
- if (field >= sqlGetOutputColNb(stmt)) {
- php_error(E_WARNING,
- "No field at this index (%d) in call to ovrimos_field_len()",
- field);
- RETURN_FALSE;
- }
-
- switch (sqlGetOutputColType(stmt, field)) {
- case T_LONGVARCHAR:
- case T_LONGVARBINARY:
- RETURN_LONG(longreadlen);
- default:
- RETURN_LONG(sqlGetOutputColLength(stmt, field));
- }
-}
-
-/* }}} */
-
-/* {{{ proto int ovrimos_field_num(int result_id, string field_name)
- Return column number */
-PHP_FUNCTION(ovrimos_field_num)
-{
- pval *arg1, *arg2;
- SQLS stmt;
- int i, n;
-
- if (getParameters(ht, 2, &arg1, &arg2) == FAILURE
- || arg2->type != IS_STRING) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long(arg1);
- stmt = (SQLS) (arg1->value.lval - 1);
- n = sqlGetOutputColNb(stmt);
- for (i = 0; i < n; i++) {
- if (!strcmp
- (arg2->value.str.val, sqlGetOutputColName(stmt, i))) {
- RETURN_LONG(i + 1);
- }
- }
- RETURN_FALSE;
-}
-
-/* }}} */
-
-#if 0
-/* {{{ proto int ovrimos_autocommit(int connection_id, int OnOff)
- Toggle autocommit mode
- There can be problems with pconnections!*/
-PHP_FUNCTION(ovrimos_autocommit)
-{
-}
-
-/* }}} */
-#endif
-
-/* {{{ proto int ovrimos_commit(int connection_id)
- Commit an ovrimos transaction */
-PHP_FUNCTION(ovrimos_commit)
-{
- pval *arg1;
- SQLH conn;
- if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg1) == FAILURE
- || arg1->type != IS_LONG) {
- WRONG_PARAM_COUNT;
- }
- conn = (SQLH) (arg1->value.lval - 1);
- if (!sqlTransactCommit(conn)) {
- RETURN_FALSE;
- }
- RETURN_TRUE;
-}
-
-/* }}} */
-
-/* {{{ proto int ovrimos_rollback(int connection_id)
- Rollback a transaction */
-PHP_FUNCTION(ovrimos_rollback)
-{
- pval *arg1;
- SQLH conn;
- if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg1) == FAILURE
- || arg1->type != IS_LONG) {
- WRONG_PARAM_COUNT;
- }
- conn = (SQLH) (arg1->value.lval - 1);
- if (!sqlTransactRollback(conn)) {
- RETURN_FALSE;
- }
- RETURN_TRUE;
-}
-
-/* }}} */
-
-#if 0
-/* {{{ proto int ovrimos_setoption(int conn_id|result_id, int which, int option, int value)
- Sets connection or statement options */
-PHP_FUNCTION(ovrimos_setoption)
-{
-}
-
-/* }}} */
-#endif
-
-/* {{{ ovrimos_functions[]
- */
-function_entry ovrimos_functions[] = {
-/* PHP_FE(ovrimos_setoption, NULL)*/
-/* PHP_FE(ovrimos_autocommit, NULL)*/
- PHP_FE(ovrimos_close, NULL)
- PHP_FE(ovrimos_close_all, NULL)
- PHP_FE(ovrimos_commit, NULL)
- PHP_FE(ovrimos_connect, NULL)
- PHP_FE(ovrimos_cursor, NULL)
- PHP_FE(ovrimos_exec, NULL)
- PHP_FE(ovrimos_prepare, NULL)
- PHP_FE(ovrimos_execute, NULL)
- PHP_FE(ovrimos_fetch_row, NULL)
- PHP_FE(ovrimos_fetch_into, NULL)
- PHP_FE(ovrimos_field_len, NULL)
- PHP_FE(ovrimos_field_name, NULL)
- PHP_FE(ovrimos_field_type, NULL)
- PHP_FE(ovrimos_field_num, NULL)
- PHP_FE(ovrimos_free_result, NULL)
- PHP_FE(ovrimos_num_fields, NULL)
- PHP_FE(ovrimos_num_rows, NULL)
- PHP_FE(ovrimos_result, NULL)
- PHP_FE(ovrimos_result_all, NULL)
- PHP_FE(ovrimos_rollback, NULL)
-/* PHP_FE(ovrimos_binmode, NULL)*/
- PHP_FE(ovrimos_longreadlen, NULL)
- PHP_FALIAS(ovrimos_do, ovrimos_exec, NULL) {NULL, NULL, NULL}
-};
-/* }}} */
-
-zend_module_entry ovrimos_module_entry = {
- "Ovrimos",
- ovrimos_functions,
- NULL,
- NULL,
- NULL,
- NULL,
- PHP_MINFO(ovrimos),
- STANDARD_MODULE_PROPERTIES
-};
-
-DLEXPORT zend_module_entry *get_module()
-{
- return &ovrimos_module_entry;
-};
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/ovrimos/php_ovrimos.h b/ext/ovrimos/php_ovrimos.h
deleted file mode 100644
index 9ec97669e2..0000000000
--- a/ext/ovrimos/php_ovrimos.h
+++ /dev/null
@@ -1,45 +0,0 @@
-#ifndef PHP_OVRIMOS_H
-#define PHP_OVRIMOS_H
-
-#if HAVE_LIBSQLCLI
-
-#if PHP_API_VERSION < 19990421
-#define zend_module_entry zend_module_entry
-#include "zend_modules.h"
-#include "internal_functions.h"
-#endif
-
-extern zend_module_entry ovrimos_module_entry;
-#define ovrimos_module_ptr &ovrimos_module_entry
-
-PHP_FUNCTION(ovrimos_connect);
-PHP_FUNCTION(ovrimos_close);
-PHP_FUNCTION(ovrimos_close_all);
-PHP_FUNCTION(ovrimos_longreadlen);
-PHP_FUNCTION(ovrimos_prepare);
-PHP_FUNCTION(ovrimos_execute);
-PHP_FUNCTION(ovrimos_cursor);
-PHP_FUNCTION(ovrimos_exec);
-PHP_FUNCTION(ovrimos_fetch_into);
-PHP_FUNCTION(ovrimos_fetch_row);
-PHP_FUNCTION(ovrimos_result);
-PHP_FUNCTION(ovrimos_result_all);
-PHP_FUNCTION(ovrimos_free_result);
-PHP_FUNCTION(ovrimos_num_rows);
-PHP_FUNCTION(ovrimos_num_fields);
-PHP_FUNCTION(ovrimos_field_name);
-PHP_FUNCTION(ovrimos_field_type);
-PHP_FUNCTION(ovrimos_field_len);
-PHP_FUNCTION(ovrimos_field_num);
-PHP_FUNCTION(ovrimos_autocommit);
-PHP_FUNCTION(ovrimos_commit);
-PHP_FUNCTION(ovrimos_rollback);
-PHP_FUNCTION(ovrimos_setoption);
-
-#else
-#define ovrimos_module_ptr NULL
-#endif
-
-#define phpext_ovrimos_ptr ovrimos_module_ptr
-
-#endif
diff --git a/ext/ovrimos/setup.stub b/ext/ovrimos/setup.stub
deleted file mode 100644
index 5e7778e9be..0000000000
--- a/ext/ovrimos/setup.stub
+++ /dev/null
@@ -1,6 +0,0 @@
-# $Source$
-# $Id$
-
-define_option with-ovrimos 'ovrimos support?' yesnodir no \
-' Whether to build the ovrimos extension.'
-
diff --git a/ext/pcntl/CREDITS b/ext/pcntl/CREDITS
deleted file mode 100644
index 1d629d7adf..0000000000
--- a/ext/pcntl/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-pcntl
-Jason Greene
diff --git a/ext/pcntl/EXPERIMENTAL b/ext/pcntl/EXPERIMENTAL
deleted file mode 100644
index 6443e99646..0000000000
--- a/ext/pcntl/EXPERIMENTAL
+++ /dev/null
@@ -1,5 +0,0 @@
-this extension is experimental,
-its functions may change their names
-or move to extension all together
-so do not rely to much on them
-you have been warned!
diff --git a/ext/pcntl/Makefile.in b/ext/pcntl/Makefile.in
deleted file mode 100644
index d778a61943..0000000000
--- a/ext/pcntl/Makefile.in
+++ /dev/null
@@ -1,8 +0,0 @@
-# $Id$
-
-LTLIBRARY_NAME = libpcntl.la
-LTLIBRARY_SOURCES = pcntl.c php_signal.c
-LTLIBRARY_SHARED_NAME = pcntl.la
-LTLIBRARY_SHARED_LIBADD = $(PCNTL_SHARED_LIBADD)
-
-include $(top_srcdir)/build/dynlib.mk
diff --git a/ext/pcntl/README b/ext/pcntl/README
deleted file mode 100644
index 05f957d7e0..0000000000
--- a/ext/pcntl/README
+++ /dev/null
@@ -1,24 +0,0 @@
-Process Control Module for PHP (pcntl)
-
-This module will attempt to implement all features related to process spawning and
-control (fork(), waitpid(), signal(), WIF's, etc). This is extremly experimental,
-with hope to become stable on most UNIX's. I greatly apreciate any feedback, fixes,
-and or suggestions on how to improve/better implement
-this functionality.
-
-Thanks,
-
-Jason Greeme < jason@inetgurus.net / jason@php.net >
-
-
-TODO Complete
-------------------------------------------------
-Make Async Safe X
-Implement wait.h macros as functions
-Implement setsid, setuid, etc.
-Platform Checks in config.m4
-
-
-
-
-
diff --git a/ext/pcntl/config.m4 b/ext/pcntl/config.m4
deleted file mode 100644
index 865b831f49..0000000000
--- a/ext/pcntl/config.m4
+++ /dev/null
@@ -1,15 +0,0 @@
-dnl $Id$
-dnl config.m4 for extension pcntl
-
-dnl Process Control (pcntl) extentsion --EXPERIMENTAL--
-dnl TODO - Add platform checks
-PHP_ARG_ENABLE(pcntl, whether to enable pcntl support,
-[ --enable-pcntl Enable experimental pcntl support (CGI ONLY!)])
-
-if test "$PHP_PCNTL" != "no"; then
- if test "$PHP_SAPI" != "cgi"; then
- AC_MSG_ERROR(pcntl currently only accepts the CGI SAPI, this will save you from harming your webserver.)
- else
- PHP_EXTENSION(pcntl, $ext_shared)
- fi
-fi
diff --git a/ext/pcntl/pcntl.c b/ext/pcntl/pcntl.c
deleted file mode 100755
index 6c14fd81c8..0000000000
--- a/ext/pcntl/pcntl.c
+++ /dev/null
@@ -1,394 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997, 1998, 1999, 2000, 2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Jason Greene <jason@inetgurus.net> |
- +----------------------------------------------------------------------+
- */
-
-#define PCNTL_DEBUG 0
-
-#if PCNTL_DEBUG
-#define DEBUG_OUT printf("DEBUG: ");printf
-#else
-#define DEBUG_OUT
-#endif
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "php_ini.h"
-#include "php_pcntl.h"
-#include "zend_extensions.h"
-
-ZEND_DECLARE_MODULE_GLOBALS(pcntl)
-
-static int le_pcntl;
-static int pcntl_zend_extension_active;
-
-function_entry pcntl_functions[] = {
- PHP_FE(pcntl_fork, NULL)
- PHP_FE(pcntl_waitpid, NULL)
- PHP_FE(pcntl_signal, NULL)
- {NULL, NULL, NULL}
-};
-
-zend_module_entry pcntl_module_entry = {
- "pcntl", pcntl_functions,
- PHP_MINIT(pcntl),
- PHP_MSHUTDOWN(pcntl),
- NULL,
- NULL,
- PHP_MINFO(pcntl),
- STANDARD_MODULE_PROPERTIES
-};
-
-#ifdef COMPILE_DL_PCNTL
-ZEND_GET_MODULE(pcntl)
-#define PCNTL_ZEND_EXT ZEND_DLEXPORT
-#else
-#define PCNTL_ZEND_EXT
-#endif
-
-PCNTL_ZEND_EXT zend_extension pcntl_extension_entry = {
- "pcntl",
- "1.0",
- "Jason Greene",
- "http://www.php.net",
- "2001",
- pcntl_zend_extension_startup,
- pcntl_zend_extension_shutdown,
- pcntl_zend_extension_activate,
- pcntl_zend_extension_deactivate,
- NULL,
- NULL,
- pcntl_zend_extension_statement_handler,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL
-};
-
-
-
-void php_register_signal_constants(INIT_FUNC_ARGS)
-{
- REGISTER_LONG_CONSTANT("SIG_IGN", (long) SIG_IGN, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SIG_DFL", (long) SIG_DFL, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SIG_ERR", (long) SIG_ERR, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SIGHUP", (long) SIGHUP, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SIGINT", (long) SIGINT, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SIGQUIT", (long) SIGQUIT, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SIGILL", (long) SIGILL, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SIGTRAP", (long) SIGTRAP, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SIGABRT", (long) SIGABRT, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SIGIOT", (long) SIGIOT, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SIGBUS", (long) SIGBUS, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SIGFPE", (long) SIGFPE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SIGKILL", (long) SIGKILL, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SIGUSR1", (long) SIGUSR1, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SIGSEGV", (long) SIGSEGV, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SIGUSR2", (long) SIGUSR2, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SIGPIPE", (long) SIGPIPE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SIGALRM", (long) SIGALRM, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SIGTERM", (long) SIGTERM, CONST_CS | CONST_PERSISTENT);
-#ifdef SIGSTKFLT
- REGISTER_LONG_CONSTANT("SIGSTKFLT",(long) SIGSTKFLT, CONST_CS | CONST_PERSISTENT);
-#endif
-#ifdef SIGCLD
- REGISTER_LONG_CONSTANT("SIGCLD", (long) SIGCLD, CONST_CS | CONST_PERSISTENT);
-#endif
-#ifdef SIGCHLD
- REGISTER_LONG_CONSTANT("SIGCHLD", (long) SIGCHLD, CONST_CS | CONST_PERSISTENT);
-#endif
- REGISTER_LONG_CONSTANT("SIGCONT", (long) SIGCONT, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SIGSTOP", (long) SIGSTOP, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SIGTSTP", (long) SIGTSTP, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SIGTTIN", (long) SIGTTIN, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SIGTTOU", (long) SIGTTOU, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SIGURG", (long) SIGURG , CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SIGXCPU", (long) SIGXCPU, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SIGXFSZ", (long) SIGXFSZ, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SIGVTALRM",(long) SIGVTALRM, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SIGPROF", (long) SIGPROF, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SIGWINCH", (long) SIGWINCH, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SIGPOLL", (long) SIGPOLL, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SIGIO", (long) SIGIO, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SIGPWR", (long) SIGPWR, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SIGSYS", (long) SIGSYS, CONST_CS | CONST_PERSISTENT);
-}
-
-PHP_MINIT_FUNCTION(pcntl)
-{
- PCNTL_LS_FETCH();
-
- php_register_signal_constants(INIT_FUNC_ARGS_PASSTHRU);
- zend_hash_init(&PCNTL_G(php_signal_table), 16, NULL, NULL, 1);
-
- /* Just in case ... */
- memset(&PCNTL_G(php_signal_queue),0,sizeof(PCNTL_G(php_signal_queue)));
-
- zend_llist_init(&PCNTL_G(php_signal_queue), sizeof (long), NULL, 1);
- PCNTL_G(signal_queue_ready)=0;
- PCNTL_G(processing_signal_queue)=0;
- if (zend_register_extension(&pcntl_extension_entry, 0)==FAILURE)
- return FAILURE;
- return SUCCESS;
-}
-PHP_MSHUTDOWN_FUNCTION(pcntl)
-{
- PCNTL_LS_FETCH();
-
- zend_hash_destroy(&PCNTL_G(php_signal_table));
- zend_llist_destroy(&PCNTL_G(php_signal_queue));
- return SUCCESS;
-}
-
-PHP_MINFO_FUNCTION(pcntl)
-{
- php_info_print_table_start();
- php_info_print_table_header(2, "pcntl support", "enabled");
- php_info_print_table_end();
-}
-/* {{{ proto long pcntl_fork()
- Forks the currently running process following the same behavior as the UNIX fork() system call*/
-PHP_FUNCTION(pcntl_fork)
-{
- pid_t id;
-
- id=fork();
- if (id == -1) {
- php_error(E_ERROR, "Error %d in %s", errno, get_active_function_name());
- }
-
- RETURN_LONG((long) id);
-}
-/* }}} */
-
-/* {{{ proto long pcntl_waitpid(long pid, long status, long options)
- Waits on or returns the status of a forked child as defined by the waitpid() system call */
-PHP_FUNCTION(pcntl_waitpid)
-{
- zval **pid, **status, **options;
- int temp_options, temp_status=0;
- pid_t temp_id;
-
- if (ZEND_NUM_ARGS() > 3 || ZEND_NUM_ARGS() < 2 || zend_get_parameters_ex(ZEND_NUM_ARGS(), &pid, &status, &options) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(pid);
- convert_to_long_ex(options);
-
- SEPARATE_ZVAL(status);
- convert_to_long_ex(status);
-
- if (ZEND_NUM_ARGS()==2) temp_options=0;
- else temp_options=Z_LVAL_PP(options);
-
- temp_id = waitpid((pid_t) Z_LVAL_PP(pid), &temp_status, temp_options);
- Z_LVAL_PP(status)=temp_status;
- RETURN_LONG((long) temp_id);
-}
-/* }}} */
-
-/* {{{ proto bool pcntl_signal(long signo, mixed handle)
- Assigns a system signal handler to a php function */
-PHP_FUNCTION(pcntl_signal)
-{
- zval **signo, **handle;
- char *func_name;
- PCNTL_LS_FETCH();
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &signo, &handle) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(signo);
-
- /* Special long value case for SIG_DFL and SIG_IGN */
- if (Z_TYPE_PP(handle)==IS_LONG) {
- if (Z_LVAL_PP(handle)!= (long) SIG_DFL && Z_LVAL_PP(handle) != (long) SIG_IGN) {
- php_error(E_WARNING, "Invalid value for handle argument specifEied in %s", get_active_function_name());
- }
- if (php_signal(Z_LVAL_PP(signo), (Sigfunc *) Z_LVAL_PP(handle))==SIG_ERR) {
- php_error(E_WARNING, "Error assigning singal in %s", get_active_function_name());
- RETURN_FALSE;
- }
- RETURN_TRUE;
- }
-
- if (Z_TYPE_PP(handle)!=IS_STRING) {
- php_error(E_WARNING, "Invalid type specified for handle argument in %s", get_active_function_name());
- RETURN_FALSE;
- }
-
- convert_to_string_ex(handle); /* Just in case */
- if (!zend_is_callable(*handle, 0, &func_name)) {
- php_error(E_WARNING, "%s: %s is not a callable function name error", get_active_function_name(), func_name);
- efree(func_name);
- RETURN_FALSE;
- }
- efree(func_name);
-
- /* Add the function name to our signal table */
- zend_hash_index_update(&PCNTL_G(php_signal_table), Z_LVAL_PP(signo), Z_STRVAL_PP(handle), (Z_STRLEN_PP(handle) + 1) * sizeof(char), NULL);
-
- if (php_signal(Z_LVAL_PP(signo), pcntl_signal_handler)==SIG_ERR) {
- php_error(E_WARNING, "Error assigning singal in %s", get_active_function_name());
- RETURN_FALSE;
- }
- RETURN_TRUE;
-}
-/* }}} */
-
-/* Note Old */
-/* Our custom signal handler that calls the appropriate php_function */
-static void old_pcntl_signal_handler(int signo)
-{
- char *func_name;
- zval *param, *call_name, *retval;
-
- PCNTL_LS_FETCH();
- DEBUG_OUT("Caught signal: %d\n", signo);
- if (zend_hash_index_find(&PCNTL_G(php_signal_table), (long) signo, (void *) &func_name)==FAILURE) {
- DEBUG_OUT("Signl handler not fount");
- return;
- }
- /* DEBUG_OUT("Signal handler found, Calling %s\n", func_name); */
- MAKE_STD_ZVAL(param);
- MAKE_STD_ZVAL(call_name);
- MAKE_STD_ZVAL(retval);
- ZVAL_LONG(param, signo);
- ZVAL_STRING(call_name, func_name, 1);
-
- /* Call php singal handler - Note that we do not report errors, and we ignore the return value */
- call_user_function(EG(function_table), NULL, call_name, retval, 1, &param);
-
- zval_dtor(call_name);
- efree(call_name);
- efree(param);
- efree(retval);
-
- return;
-}
-
-
-static void pcntl_signal_handler(int signo)
-{
- long signal_num=signo;
- PCNTL_LS_FETCH();
-
- DEBUG_OUT("Caught signo %d\n", signo);
- if (! PCNTL_G(processing_signal_queue) && pcntl_zend_extension_active ) {
- zend_llist_add_element(&PCNTL_G(php_signal_queue), &signal_num);
- PCNTL_G(signal_queue_ready)=1;
- DEBUG_OUT("Added queue entry\n");
- }
- return;
-}
-
-
-/* Pcntl Zend Extension Hooks */
-
-int pcntl_zend_extension_startup(zend_extension *extension)
-{
- DEBUG_OUT("Statup Called\n");
- pcntl_zend_extension_active=1;
- CG(extended_info) = 1;
- return SUCCESS;
-}
-
-void pcntl_zend_extension_shutdown(zend_extension *extension)
-{
- DEBUG_OUT("Shutdown Called\n");
- return;
-}
-
-void pcntl_zend_extension_activate(void)
-{
- DEBUG_OUT("Activate Called\n");
- pcntl_zend_extension_active=1;
- CG(extended_info) = 1;
- return;
-}
-
-void pcntl_zend_extension_deactivate(void)
-{
- DEBUG_OUT("Deactivate Called\n");
- pcntl_zend_extension_active=0;
- return;
-}
-
-/* Custom hook to ensure signals only get called at a safe poing in Zend's execute process */
-void pcntl_zend_extension_statement_handler(zend_op_array *op_array) {
- zend_llist_element *element;
- zval *param, *call_name, *retval;
- char *func_name;
- PCNTL_LS_FETCH();
-
- /* Bail if the queue is empty or if we are already playing the queue*/
- if (! PCNTL_G(signal_queue_ready) || PCNTL_G(processing_signal_queue))
- return;
-
- /* Mark our queue empty */
- PCNTL_G(signal_queue_ready)=0;
-
- /* If for some reason our signal queue is empty then return */
- if (zend_llist_count(&PCNTL_G(php_signal_queue)) <= 0) {
- return;
- }
-
- /* Disable queue so this function is not infinate */
- PCNTL_G(processing_signal_queue)=1;
-
- /* Allocate */
- MAKE_STD_ZVAL(param);
- MAKE_STD_ZVAL(call_name);
- MAKE_STD_ZVAL(retval);
-
- /* Traverse through our signal queue and call the appropriate php functions */
- for (element=(&PCNTL_G(php_signal_queue))->head; element; element=element->next) {
- if (zend_hash_index_find(&PCNTL_G(php_signal_table), (long) *element->data, (void *) &func_name)==FAILURE) {
- continue;
- }
- convert_to_long_ex(&param);
- convert_to_string_ex(&call_name);
- ZVAL_LONG(param, (long) *element->data);
- ZVAL_STRING(call_name, func_name, 0);
-
- /* Call php singal handler - Note that we do not report errors, and we ignore the return value */
- call_user_function(EG(function_table), NULL, call_name, retval, 1, &param);
- }
- /* Clear */
- zend_llist_clean(&PCNTL_G(php_signal_queue));
-
- /* Re-enable queue */
- PCNTL_G(processing_signal_queue)=0;
-
- /* Clean up */
- efree(param);
- efree(call_name);
- efree(retval);
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * indent-tabs-mode: t
- * End:
- */
diff --git a/ext/pcntl/php_pcntl.h b/ext/pcntl/php_pcntl.h
deleted file mode 100644
index be570ea110..0000000000
--- a/ext/pcntl/php_pcntl.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997, 1998, 1999, 2000, 2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Jason Greene <jason@inetgurus.net> |
- +----------------------------------------------------------------------+
- */
-
-#ifndef PHP_PCNTL_H
-#define PHP_PCNTL_H
-
-#include "php_signal.h"
-#include "zend_extensions.h"
-extern zend_module_entry pcntl_module_entry;
-#define phpext_pcntl_ptr &pcntl_module_entry
-
-#ifdef PHP_WIN32
-#define PHP_PCNTL_API __declspec(dllexport)
-#else
-#define PHP_PCNTL_API
-#endif
-
-PHP_MINIT_FUNCTION(pcntl);
-PHP_MSHUTDOWN_FUNCTION(pcntl);
-PHP_RINIT_FUNCTION(pcntl);
-PHP_RSHUTDOWN_FUNCTION(pcntl);
-PHP_MINFO_FUNCTION(pcntl);
-
-PHP_FUNCTION(pcntl_fork);
-PHP_FUNCTION(pcntl_waitpid);
-PHP_FUNCTION(pcntl_signal);
-
-static void pcntl_signal_handler(int);
-
-/* Zend extension prototypes */
-int pcntl_zend_extension_startup(zend_extension *extension);
-void pcntl_zend_extension_shutdown(zend_extension *extension);
-void pcntl_zend_extension_activate(void);
-void pcntl_zend_extension_deactivate(void);
-void pcntl_zend_extension_statement_handler(zend_op_array *op_array);
-
-
-ZEND_BEGIN_MODULE_GLOBALS(pcntl)
- HashTable php_signal_table;
- zend_llist php_signal_queue;
- int signal_queue_ready;
- int processing_signal_queue;
-ZEND_END_MODULE_GLOBALS(pcntl)
-
-#ifdef ZTS
-#define PCNTL_G(v) (pcntl_globals->v)
-#define PCNTL_LS_FETCH() zend_pcntl_globals *pcntl_globals = ts_resource(pcntl_globals_id)
-#else
-#define PCNTL_G(v) (pcntl_globals.v)
-#define PCNTL_LS_FETCH()
-#endif
-
-#endif /* PHP_PCNTL_H */
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * indent-tabs-mode: t
- * End:
- */
diff --git a/ext/pcntl/php_signal.c b/ext/pcntl/php_signal.c
deleted file mode 100644
index a47c39bd77..0000000000
--- a/ext/pcntl/php_signal.c
+++ /dev/null
@@ -1,45 +0,0 @@
-
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997, 1998, 1999, 2000, 2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Jason Greene <jason@inetgurus.net> |
- +----------------------------------------------------------------------+
-*/
-
-#include "php_signal.h"
-
-/* php_signal using sigaction is taken verbatim from Advanced Programing
- * in the Unix Environment by W. Richard Stevens p 298. */
-Sigfunc *php_signal(int signo, Sigfunc *func)
-{
-
- struct sigaction act,oact;
- act.sa_handler = func;
- sigemptyset(&act.sa_mask);
- act.sa_flags = 0;
- if (signo == SIGALRM) {
-#ifdef SA_INTERRUPT
- act.sa_flags |= SA_INTERRUPT; /* SunOS */
-#endif
- } else {
-#ifdef SA_RESTART
- act.sa_flags |= SA_RESTART; /* SVR4, 4.3+BSD */
-#endif
- }
- if (sigaction(signo, &act, &oact) < 0)
- return SIG_ERR;
-
- return oact.sa_handler;
-}
-
diff --git a/ext/pcntl/php_signal.h b/ext/pcntl/php_signal.h
deleted file mode 100644
index 3f763a55f3..0000000000
--- a/ext/pcntl/php_signal.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997, 1998, 1999, 2000, 2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Jason Greene <jason@inetgurus.net> |
- +----------------------------------------------------------------------+
-*/
-
-#include <signal.h>
-#ifndef PHP_SIGNAL_H
-#define PHP_SIGNAL_H
-
-typedef void Sigfunc(int);
-Sigfunc *php_signal(int signo, Sigfunc *func);
-
-#endif
diff --git a/ext/pcntl/test-pcntl.php b/ext/pcntl/test-pcntl.php
deleted file mode 100755
index c611bfe504..0000000000
--- a/ext/pcntl/test-pcntl.php
+++ /dev/null
@@ -1,35 +0,0 @@
-#!/opt/devel/php4/php -q
-<?
-function alarm_handle($signal){
- if ($signal==SIGALRM) print "Caught SIGALRM!!!\n";
-}
-function usr1_handle($signal){
- if ($signal==SIGUSR1) print "Caught SIGUSR1!!!\n";
-}
-
-print "This test will demonstrate a fork followed by ipc via signals.\n";
-
-$pid=pcntl_fork();
-if ($pid==0) {
- pcntl_signal(SIGUSR1, "usr1_handle");
- pcntl_signal(SIGALRM, "alarm_handle");
- print "Child: Waiting for alarm.....\n";
- sleep(100);
- print "Child: Waiting for usr1......\n";
- sleep(100);
- print "Child: Resetting Alarm handler to Ignore....\n";
- pcntl_signal(SIGALRM, SIG_IGN);
- sleep(10);
- print "Done\n";
-} else {
- print "Parent: Waiting 10 seconds....\n";
- sleep(10);
- print "Parent: Sending SIGALRM to Child\n";
- posix_kill($pid,SIGALRM);
- sleep(1);
- print "Parent: Senging SIGUSR1 to Child\n";
- posix_kill($pid,SIGUSR1);
- sleep(1);
- print "Parent: Sending SIGALRM to Child\n";
- pcntl_waitpid($pid, $status, $options);
-}
diff --git a/ext/pcntl/tests/001.exp b/ext/pcntl/tests/001.exp
deleted file mode 100755
index e69de29bb2..0000000000
--- a/ext/pcntl/tests/001.exp
+++ /dev/null
diff --git a/ext/pcntl/tests/001.out b/ext/pcntl/tests/001.out
deleted file mode 100755
index efbc584688..0000000000
--- a/ext/pcntl/tests/001.out
+++ /dev/null
@@ -1 +0,0 @@
-pcntl extension is available \ No newline at end of file
diff --git a/ext/pcntl/tests/001.php b/ext/pcntl/tests/001.php
deleted file mode 100755
index d3be528a2a..0000000000
--- a/ext/pcntl/tests/001.php
+++ /dev/null
@@ -1,14 +0,0 @@
-<?php
-echo "pcntl extension is available";
-/*
- you can add regression tests for your extension here
-
- the output of your test code has to be equal to the
- text in the --EXPECT-- section below for the tests
- to pass, differences between the output and the
- expected text are interpreted as failure
-
- see php4/tests/README for further information on
- writing regression tests
-*/
-?>
diff --git a/ext/pcntl/tests/001.phpt b/ext/pcntl/tests/001.phpt
deleted file mode 100644
index af214d0f62..0000000000
--- a/ext/pcntl/tests/001.phpt
+++ /dev/null
@@ -1,22 +0,0 @@
---TEST--
-Check for pcntl presence
---SKIPIF--
-<?php if (!extension_loaded("pcntl")) print "skip"; ?>
---POST--
---GET--
---FILE--
-<?php
-echo "pcntl extension is available";
-/*
- you can add regression tests for your extension here
-
- the output of your test code has to be equal to the
- text in the --EXPECT-- section below for the tests
- to pass, differences between the output and the
- expected text are interpreted as failure
-
- see php4/tests/README for further information on
- writing regression tests
-*/
-?>
---EXPECT--
diff --git a/ext/pcre/CREDITS b/ext/pcre/CREDITS
deleted file mode 100644
index ae0fba35d4..0000000000
--- a/ext/pcre/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-Perl Compatible Regexps
-Andrei Zmievski
diff --git a/ext/pcre/Makefile.in b/ext/pcre/Makefile.in
deleted file mode 100644
index 9316a48720..0000000000
--- a/ext/pcre/Makefile.in
+++ /dev/null
@@ -1,10 +0,0 @@
-
-LTLIBRARY_NAME = libpcre.la
-LTLIBRARY_SOURCES = php_pcre.c
-LTLIBRARY_LIBADD = $(PCRE_LIBADD)
-LTLIBRARY_SHARED_NAME = pcre.la
-LTLIBRARY_SHARED_LIBADD = $(PCRE_SHARED_LIBADD)
-
-SUBDIRS = $(PCRE_SUBDIRS)
-
-include $(top_srcdir)/build/dynlib.mk
diff --git a/ext/pcre/config.m4 b/ext/pcre/config.m4
deleted file mode 100644
index b903b19c42..0000000000
--- a/ext/pcre/config.m4
+++ /dev/null
@@ -1,61 +0,0 @@
-dnl $Id$
-dnl config.m4 for extension pcre
-
-dnl By default we'll compile and link against the bundled PCRE library
-dnl if DIR is supplied, we'll use that for linking
-
-PHP_ARG_WITH(pcre-regex,whether to include PCRE support,
-[ --without-pcre-regex Do not include Perl Compatible Regular Expressions
- support. Use --with-pcre-regex=DIR to specify DIR
- where PCRE's include and library files are located,
- if not using bundled library.],yes)
-
-if test "$PHP_PCRE_REGEX" != "no"; then
- PHP_EXTENSION(pcre, $ext_shared)
- if test "$PHP_PCRE_REGEX" = "yes"; then
- PCRE_LIBADD=pcrelib/libpcre.la
- PCRE_SHARED_LIBADD=pcrelib/libpcre.la
- PCRE_SUBDIRS=pcrelib
- PHP_SUBST(PCRE_LIBADD)
- PHP_SUBST(PCRE_SUBDIRS)
- AC_DEFINE(HAVE_BUNDLED_PCRE, 1, [ ])
- PHP_FAST_OUTPUT($ext_builddir/pcrelib/Makefile)
- LIB_BUILD($ext_builddir/pcrelib,$ext_shared,yes)
- else
- test -f $PHP_PCRE_REGEX/pcre.h && PCRE_INCDIR=$PHP_PCRE_REGEX
- test -f $PHP_PCRE_REGEX/include/pcre.h && PCRE_INCDIR=$PHP_PCRE_REGEX/include
-
- if test -z "$PCRE_INCDIR"; then
- AC_MSG_RESULT(Could not find pcre.h in $PHP_PCRE_REGEX)
- fi
-
- changequote({,})
- pcre_major=`grep PCRE_MAJOR $PCRE_INCDIR/pcre.h | sed -e 's/[^0-9]//g'`
- pcre_minor=`grep PCRE_MINOR $PCRE_INCDIR/pcre.h | sed -e 's/[^0-9]//g'`
- changequote([,])
- pcre_minor_length=`echo "$pcre_minor" | wc -c | sed -e 's/[^0-9]//g'`
- if test "$pcre_minor_length" -eq 2 ; then
- pcre_minor="$pcre_minor"0
- fi
- pcre_version=$pcre_major$pcre_minor
- if test "$pcre_version" -lt 208; then
- AC_MSG_ERROR(The PCRE extension requires PCRE library version >= 2.08)
- fi
-
- test -f $PHP_PCRE_REGEX/libpcre.a && PCRE_LIBDIR=$PHP_PCRE_REGEX
- test -f $PHP_PCRE_REGEX/lib/libpcre.a && PCRE_LIBDIR=$PHP_PCRE_REGEX/lib
-
- if test -z "$PCRE_LIBDIR" ; then
- AC_MSG_ERROR(Could not find libpcre.a in $PHP_PCRE_REGEX)
- fi
-
- PHP_ADD_LIBRARY_WITH_PATH(pcre, $PCRE_LIBDIR, PCRE_SHARED_LIBADD)
-
- PHP_ADD_INCLUDE($PCRE_INCDIR)
- AC_DEFINE(HAVE_PCRE, 1, [ ])
- fi
-fi
-PHP_SUBST(PCRE_SHARED_LIBADD)
-
-
-AC_CHECK_FUNC(memmove, [], [AC_DEFINE(USE_BCOPY, 1, [ ])])
diff --git a/ext/pcre/config0.m4 b/ext/pcre/config0.m4
deleted file mode 100644
index b903b19c42..0000000000
--- a/ext/pcre/config0.m4
+++ /dev/null
@@ -1,61 +0,0 @@
-dnl $Id$
-dnl config.m4 for extension pcre
-
-dnl By default we'll compile and link against the bundled PCRE library
-dnl if DIR is supplied, we'll use that for linking
-
-PHP_ARG_WITH(pcre-regex,whether to include PCRE support,
-[ --without-pcre-regex Do not include Perl Compatible Regular Expressions
- support. Use --with-pcre-regex=DIR to specify DIR
- where PCRE's include and library files are located,
- if not using bundled library.],yes)
-
-if test "$PHP_PCRE_REGEX" != "no"; then
- PHP_EXTENSION(pcre, $ext_shared)
- if test "$PHP_PCRE_REGEX" = "yes"; then
- PCRE_LIBADD=pcrelib/libpcre.la
- PCRE_SHARED_LIBADD=pcrelib/libpcre.la
- PCRE_SUBDIRS=pcrelib
- PHP_SUBST(PCRE_LIBADD)
- PHP_SUBST(PCRE_SUBDIRS)
- AC_DEFINE(HAVE_BUNDLED_PCRE, 1, [ ])
- PHP_FAST_OUTPUT($ext_builddir/pcrelib/Makefile)
- LIB_BUILD($ext_builddir/pcrelib,$ext_shared,yes)
- else
- test -f $PHP_PCRE_REGEX/pcre.h && PCRE_INCDIR=$PHP_PCRE_REGEX
- test -f $PHP_PCRE_REGEX/include/pcre.h && PCRE_INCDIR=$PHP_PCRE_REGEX/include
-
- if test -z "$PCRE_INCDIR"; then
- AC_MSG_RESULT(Could not find pcre.h in $PHP_PCRE_REGEX)
- fi
-
- changequote({,})
- pcre_major=`grep PCRE_MAJOR $PCRE_INCDIR/pcre.h | sed -e 's/[^0-9]//g'`
- pcre_minor=`grep PCRE_MINOR $PCRE_INCDIR/pcre.h | sed -e 's/[^0-9]//g'`
- changequote([,])
- pcre_minor_length=`echo "$pcre_minor" | wc -c | sed -e 's/[^0-9]//g'`
- if test "$pcre_minor_length" -eq 2 ; then
- pcre_minor="$pcre_minor"0
- fi
- pcre_version=$pcre_major$pcre_minor
- if test "$pcre_version" -lt 208; then
- AC_MSG_ERROR(The PCRE extension requires PCRE library version >= 2.08)
- fi
-
- test -f $PHP_PCRE_REGEX/libpcre.a && PCRE_LIBDIR=$PHP_PCRE_REGEX
- test -f $PHP_PCRE_REGEX/lib/libpcre.a && PCRE_LIBDIR=$PHP_PCRE_REGEX/lib
-
- if test -z "$PCRE_LIBDIR" ; then
- AC_MSG_ERROR(Could not find libpcre.a in $PHP_PCRE_REGEX)
- fi
-
- PHP_ADD_LIBRARY_WITH_PATH(pcre, $PCRE_LIBDIR, PCRE_SHARED_LIBADD)
-
- PHP_ADD_INCLUDE($PCRE_INCDIR)
- AC_DEFINE(HAVE_PCRE, 1, [ ])
- fi
-fi
-PHP_SUBST(PCRE_SHARED_LIBADD)
-
-
-AC_CHECK_FUNC(memmove, [], [AC_DEFINE(USE_BCOPY, 1, [ ])])
diff --git a/ext/pcre/pcrelib/AUTHORS b/ext/pcre/pcrelib/AUTHORS
deleted file mode 100644
index bfe1b5d8a4..0000000000
--- a/ext/pcre/pcrelib/AUTHORS
+++ /dev/null
@@ -1,6 +0,0 @@
-Written by: Philip Hazel <ph10@cam.ac.uk>
-
-University of Cambridge Computing Service,
-Cambridge, England. Phone: +44 1223 334714.
-
-Copyright (c) 1997-2000 University of Cambridge
diff --git a/ext/pcre/pcrelib/COPYING b/ext/pcre/pcrelib/COPYING
deleted file mode 100644
index 34d20db928..0000000000
--- a/ext/pcre/pcrelib/COPYING
+++ /dev/null
@@ -1,46 +0,0 @@
-PCRE LICENCE
-------------
-
-PCRE is a library of functions to support regular expressions whose syntax
-and semantics are as close as possible to those of the Perl 5 language.
-
-Written by: Philip Hazel <ph10@cam.ac.uk>
-
-University of Cambridge Computing Service,
-Cambridge, England. Phone: +44 1223 334714.
-
-Copyright (c) 1997-2000 University of Cambridge
-
-Permission is granted to anyone to use this software for any purpose on any
-computer system, and to redistribute it freely, subject to the following
-restrictions:
-
-1. This software is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-
-2. The origin of this software must not be misrepresented, either by
- explicit claim or by omission. In practice, this means that if you use
- PCRE in software which you distribute to others, commercially or
- otherwise, you must put a sentence like this
-
- Regular expression support is provided by the PCRE library package,
- which is open source software, written by Philip Hazel, and copyright
- by the University of Cambridge, England.
-
- somewhere reasonably visible in your documentation and in any relevant
- files or online help data or similar. A reference to the ftp site for
- the source, that is, to
-
- ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/
-
- should also be given in the documentation.
-
-3. Altered versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
-
-4. If PCRE is embedded in any software that is released under the GNU
- General Purpose Licence (GPL), then the terms of that licence shall
- supersede any condition above with which it is incompatible.
-
-End
diff --git a/ext/pcre/pcrelib/ChangeLog b/ext/pcre/pcrelib/ChangeLog
deleted file mode 100644
index 2133dd7612..0000000000
--- a/ext/pcre/pcrelib/ChangeLog
+++ /dev/null
@@ -1,655 +0,0 @@
-ChangeLog for PCRE
-------------------
-
-
-Version 3.4 22-Aug-00
----------------------
-
-1. Fixed typo in pcre.h: unsigned const char * changed to const unsigned char *.
-
-2. Diagnose condition (?(0) as an error instead of crashing on matching.
-
-
-Version 3.3 01-Aug-00
----------------------
-
-1. If an octal character was given, but the value was greater than \377, it
-was not getting masked to the least significant bits, as documented. This could
-lead to crashes in some systems.
-
-2. Perl 5.6 (if not earlier versions) accepts classes like [a-\d] and treats
-the hyphen as a literal. PCRE used to give an error; it now behaves like Perl.
-
-3. Added the functions pcre_free_substring() and pcre_free_substring_list().
-These just pass their arguments on to (pcre_free)(), but they are provided
-because some uses of PCRE bind it to non-C systems that can call its functions,
-but cannot call free() or pcre_free() directly.
-
-4. Add "make test" as a synonym for "make check". Corrected some comments in
-the Makefile.
-
-5. Add $(DESTDIR)/ in front of all the paths in the "install" target in the
-Makefile.
-
-6. Changed the name of pgrep to pcregrep, because Solaris has introduced a
-command called pgrep for grepping around the active processes.
-
-7. Added the beginnings of support for UTF-8 character strings.
-
-8. Arranged for the Makefile to pass over the settings of CC, CFLAGS, and
-RANLIB to ./ltconfig so that they are used by libtool. I think these are all
-the relevant ones. (AR is not passed because ./ltconfig does its own figuring
-out for the ar command.)
-
-
-Version 3.2 12-May-00
----------------------
-
-This is purely a bug fixing release.
-
-1. If the pattern /((Z)+|A)*/ was matched agained ZABCDEFG it matched Z instead
-of ZA. This was just one example of several cases that could provoke this bug,
-which was introduced by change 9 of version 2.00. The code for breaking
-infinite loops after an iteration that matches an empty string was't working
-correctly.
-
-2. The pcretest program was not imitating Perl correctly for the pattern /a*/g
-when matched against abbab (for example). After matching an empty string, it
-wasn't forcing anchoring when setting PCRE_NOTEMPTY for the next attempt; this
-caused it to match further down the string than it should.
-
-3. The code contained an inclusion of sys/types.h. It isn't clear why this
-was there because it doesn't seem to be needed, and it causes trouble on some
-systems, as it is not a Standard C header. It has been removed.
-
-4. Made 4 silly changes to the source to avoid stupid compiler warnings that
-were reported on the Macintosh. The changes were from
-
- while ((c = *(++ptr)) != 0 && c != '\n');
-to
- while ((c = *(++ptr)) != 0 && c != '\n') ;
-
-Totally extraordinary, but if that's what it takes...
-
-5. PCRE is being used in one environment where neither memmove() nor bcopy() is
-available. Added HAVE_BCOPY and an autoconf test for it; if neither
-HAVE_MEMMOVE nor HAVE_BCOPY is set, use a built-in emulation function which
-assumes the way PCRE uses memmove() (always moving upwards).
-
-6. PCRE is being used in one environment where strchr() is not available. There
-was only one use in pcre.c, and writing it out to avoid strchr() probably gives
-faster code anyway.
-
-
-Version 3.1 09-Feb-00
----------------------
-
-The only change in this release is the fixing of some bugs in Makefile.in for
-the "install" target:
-
-(1) It was failing to install pcreposix.h.
-
-(2) It was overwriting the pcre.3 man page with the pcreposix.3 man page.
-
-
-Version 3.0 01-Feb-00
----------------------
-
-1. Add support for the /+ modifier to perltest (to output $` like it does in
-pcretest).
-
-2. Add support for the /g modifier to perltest.
-
-3. Fix pcretest so that it behaves even more like Perl for /g when the pattern
-matches null strings.
-
-4. Fix perltest so that it doesn't do unwanted things when fed an empty
-pattern. Perl treats empty patterns specially - it reuses the most recent
-pattern, which is not what we want. Replace // by /(?#)/ in order to avoid this
-effect.
-
-5. The POSIX interface was broken in that it was just handing over the POSIX
-captured string vector to pcre_exec(), but (since release 2.00) PCRE has
-required a bigger vector, with some working space on the end. This means that
-the POSIX wrapper now has to get and free some memory, and copy the results.
-
-6. Added some simple autoconf support, placing the test data and the
-documentation in separate directories, re-organizing some of the
-information files, and making it build pcre-config (a GNU standard). Also added
-libtool support for building PCRE as a shared library, which is now the
-default.
-
-7. Got rid of the leading zero in the definition of PCRE_MINOR because 08 and
-09 are not valid octal constants. Single digits will be used for minor values
-less than 10.
-
-8. Defined REG_EXTENDED and REG_NOSUB as zero in the POSIX header, so that
-existing programs that set these in the POSIX interface can use PCRE without
-modification.
-
-9. Added a new function, pcre_fullinfo() with an extensible interface. It can
-return all that pcre_info() returns, plus additional data. The pcre_info()
-function is retained for compatibility, but is considered to be obsolete.
-
-10. Added experimental recursion feature (?R) to handle one common case that
-Perl 5.6 will be able to do with (?p{...}).
-
-11. Added support for POSIX character classes like [:alpha:], which Perl is
-adopting.
-
-
-Version 2.08 31-Aug-99
-----------------------
-
-1. When startoffset was not zero and the pattern began with ".*", PCRE was not
-trying to match at the startoffset position, but instead was moving forward to
-the next newline as if a previous match had failed.
-
-2. pcretest was not making use of PCRE_NOTEMPTY when repeating for /g and /G,
-and could get into a loop if a null string was matched other than at the start
-of the subject.
-
-3. Added definitions of PCRE_MAJOR and PCRE_MINOR to pcre.h so the version can
-be distinguished at compile time, and for completeness also added PCRE_DATE.
-
-5. Added Paul Sokolovsky's minor changes to make it easy to compile a Win32 DLL
-in GnuWin32 environments.
-
-
-Version 2.07 29-Jul-99
-----------------------
-
-1. The documentation is now supplied in plain text form and HTML as well as in
-the form of man page sources.
-
-2. C++ compilers don't like assigning (void *) values to other pointer types.
-In particular this affects malloc(). Although there is no problem in Standard
-C, I've put in casts to keep C++ compilers happy.
-
-3. Typo on pcretest.c; a cast of (unsigned char *) in the POSIX regexec() call
-should be (const char *).
-
-4. If NOPOSIX is defined, pcretest.c compiles without POSIX support. This may
-be useful for non-Unix systems who don't want to bother with the POSIX stuff.
-However, I haven't made this a standard facility. The documentation doesn't
-mention it, and the Makefile doesn't support it.
-
-5. The Makefile now contains an "install" target, with editable destinations at
-the top of the file. The pcretest program is not installed.
-
-6. pgrep -V now gives the PCRE version number and date.
-
-7. Fixed bug: a zero repetition after a literal string (e.g. /abcde{0}/) was
-causing the entire string to be ignored, instead of just the last character.
-
-8. If a pattern like /"([^\\"]+|\\.)*"/ is applied in the normal way to a
-non-matching string, it can take a very, very long time, even for strings of
-quite modest length, because of the nested recursion. PCRE now does better in
-some of these cases. It does this by remembering the last required literal
-character in the pattern, and pre-searching the subject to ensure it is present
-before running the real match. In other words, it applies a heuristic to detect
-some types of certain failure quickly, and in the above example, if presented
-with a string that has no trailing " it gives "no match" very quickly.
-
-9. A new runtime option PCRE_NOTEMPTY causes null string matches to be ignored;
-other alternatives are tried instead.
-
-
-Version 2.06 09-Jun-99
-----------------------
-
-1. Change pcretest's output for amount of store used to show just the code
-space, because the remainder (the data block) varies in size between 32-bit and
-64-bit systems.
-
-2. Added an extra argument to pcre_exec() to supply an offset in the subject to
-start matching at. This allows lookbehinds to work when searching for multiple
-occurrences in a string.
-
-3. Added additional options to pcretest for testing multiple occurrences:
-
- /+ outputs the rest of the string that follows a match
- /g loops for multiple occurrences, using the new startoffset argument
- /G loops for multiple occurrences by passing an incremented pointer
-
-4. PCRE wasn't doing the "first character" optimization for patterns starting
-with \b or \B, though it was doing it for other lookbehind assertions. That is,
-it wasn't noticing that a match for a pattern such as /\bxyz/ has to start with
-the letter 'x'. On long subject strings, this gives a significant speed-up.
-
-
-Version 2.05 21-Apr-99
-----------------------
-
-1. Changed the type of magic_number from int to long int so that it works
-properly on 16-bit systems.
-
-2. Fixed a bug which caused patterns starting with .* not to work correctly
-when the subject string contained newline characters. PCRE was assuming
-anchoring for such patterns in all cases, which is not correct because .* will
-not pass a newline unless PCRE_DOTALL is set. It now assumes anchoring only if
-DOTALL is set at top level; otherwise it knows that patterns starting with .*
-must be retried after every newline in the subject.
-
-
-Version 2.04 18-Feb-99
-----------------------
-
-1. For parenthesized subpatterns with repeats whose minimum was zero, the
-computation of the store needed to hold the pattern was incorrect (too large).
-If such patterns were nested a few deep, this could multiply and become a real
-problem.
-
-2. Added /M option to pcretest to show the memory requirement of a specific
-pattern. Made -m a synonym of -s (which does this globally) for compatibility.
-
-3. Subpatterns of the form (regex){n,m} (i.e. limited maximum) were being
-compiled in such a way that the backtracking after subsequent failure was
-pessimal. Something like (a){0,3} was compiled as (a)?(a)?(a)? instead of
-((a)((a)(a)?)?)? with disastrous performance if the maximum was of any size.
-
-
-Version 2.03 02-Feb-99
-----------------------
-
-1. Fixed typo and small mistake in man page.
-
-2. Added 4th condition (GPL supersedes if conflict) and created separate
-LICENCE file containing the conditions.
-
-3. Updated pcretest so that patterns such as /abc\/def/ work like they do in
-Perl, that is the internal \ allows the delimiter to be included in the
-pattern. Locked out the use of \ as a delimiter. If \ immediately follows
-the final delimiter, add \ to the end of the pattern (to test the error).
-
-4. Added the convenience functions for extracting substrings after a successful
-match. Updated pcretest to make it able to test these functions.
-
-
-Version 2.02 14-Jan-99
-----------------------
-
-1. Initialized the working variables associated with each extraction so that
-their saving and restoring doesn't refer to uninitialized store.
-
-2. Put dummy code into study.c in order to trick the optimizer of the IBM C
-compiler for OS/2 into generating correct code. Apparently IBM isn't going to
-fix the problem.
-
-3. Pcretest: the timing code wasn't using LOOPREPEAT for timing execution
-calls, and wasn't printing the correct value for compiling calls. Increased the
-default value of LOOPREPEAT, and the number of significant figures in the
-times.
-
-4. Changed "/bin/rm" in the Makefile to "-rm" so it works on Windows NT.
-
-5. Renamed "deftables" as "dftables" to get it down to 8 characters, to avoid
-a building problem on Windows NT with a FAT file system.
-
-
-Version 2.01 21-Oct-98
-----------------------
-
-1. Changed the API for pcre_compile() to allow for the provision of a pointer
-to character tables built by pcre_maketables() in the current locale. If NULL
-is passed, the default tables are used.
-
-
-Version 2.00 24-Sep-98
-----------------------
-
-1. Since the (>?) facility is in Perl 5.005, don't require PCRE_EXTRA to enable
-it any more.
-
-2. Allow quantification of (?>) groups, and make it work correctly.
-
-3. The first character computation wasn't working for (?>) groups.
-
-4. Correct the implementation of \Z (it is permitted to match on the \n at the
-end of the subject) and add 5.005's \z, which really does match only at the
-very end of the subject.
-
-5. Remove the \X "cut" facility; Perl doesn't have it, and (?> is neater.
-
-6. Remove the ability to specify CASELESS, MULTILINE, DOTALL, and
-DOLLAR_END_ONLY at runtime, to make it possible to implement the Perl 5.005
-localized options. All options to pcre_study() were also removed.
-
-7. Add other new features from 5.005:
-
- $(?<= positive lookbehind
- $(?<! negative lookbehind
- (?imsx-imsx) added the unsetting capability
- such a setting is global if at outer level; local otherwise
- (?imsx-imsx:) non-capturing groups with option setting
- (?(cond)re|re) conditional pattern matching
-
- A backreference to itself in a repeated group matches the previous
- captured string.
-
-8. General tidying up of studying (both automatic and via "study")
-consequential on the addition of new assertions.
-
-9. As in 5.005, unlimited repeated groups that could match an empty substring
-are no longer faulted at compile time. Instead, the loop is forcibly broken at
-runtime if any iteration does actually match an empty substring.
-
-10. Include the RunTest script in the distribution.
-
-11. Added tests from the Perl 5.005_02 distribution. This showed up a few
-discrepancies, some of which were old and were also with respect to 5.004. They
-have now been fixed.
-
-
-Version 1.09 28-Apr-98
-----------------------
-
-1. A negated single character class followed by a quantifier with a minimum
-value of one (e.g. [^x]{1,6} ) was not compiled correctly. This could lead to
-program crashes, or just wrong answers. This did not apply to negated classes
-containing more than one character, or to minima other than one.
-
-
-Version 1.08 27-Mar-98
-----------------------
-
-1. Add PCRE_UNGREEDY to invert the greediness of quantifiers.
-
-2. Add (?U) and (?X) to set PCRE_UNGREEDY and PCRE_EXTRA respectively. The
-latter must appear before anything that relies on it in the pattern.
-
-
-Version 1.07 16-Feb-98
-----------------------
-
-1. A pattern such as /((a)*)*/ was not being diagnosed as in error (unlimited
-repeat of a potentially empty string).
-
-
-Version 1.06 23-Jan-98
-----------------------
-
-1. Added Markus Oberhumer's little patches for C++.
-
-2. Literal strings longer than 255 characters were broken.
-
-
-Version 1.05 23-Dec-97
-----------------------
-
-1. Negated character classes containing more than one character were failing if
-PCRE_CASELESS was set at run time.
-
-
-Version 1.04 19-Dec-97
-----------------------
-
-1. Corrected the man page, where some "const" qualifiers had been omitted.
-
-2. Made debugging output print "{0,xxx}" instead of just "{,xxx}" to agree with
-input syntax.
-
-3. Fixed memory leak which occurred when a regex with back references was
-matched with an offsets vector that wasn't big enough. The temporary memory
-that is used in this case wasn't being freed if the match failed.
-
-4. Tidied pcretest to ensure it frees memory that it gets.
-
-5. Temporary memory was being obtained in the case where the passed offsets
-vector was exactly big enough.
-
-6. Corrected definition of offsetof() from change 5 below.
-
-7. I had screwed up change 6 below and broken the rules for the use of
-setjmp(). Now fixed.
-
-
-Version 1.03 18-Dec-97
-----------------------
-
-1. A erroneous regex with a missing opening parenthesis was correctly
-diagnosed, but PCRE attempted to access brastack[-1], which could cause crashes
-on some systems.
-
-2. Replaced offsetof(real_pcre, code) by offsetof(real_pcre, code[0]) because
-it was reported that one broken compiler failed on the former because "code" is
-also an independent variable.
-
-3. The erroneous regex a[]b caused an array overrun reference.
-
-4. A regex ending with a one-character negative class (e.g. /[^k]$/) did not
-fail on data ending with that character. (It was going on too far, and checking
-the next character, typically a binary zero.) This was specific to the
-optimized code for single-character negative classes.
-
-5. Added a contributed patch from the TIN world which does the following:
-
- + Add an undef for memmove, in case the the system defines a macro for it.
-
- + Add a definition of offsetof(), in case there isn't one. (I don't know
- the reason behind this - offsetof() is part of the ANSI standard - but
- it does no harm).
-
- + Reduce the ifdef's in pcre.c using macro DPRINTF, thereby eliminating
- most of the places where whitespace preceded '#'. I have given up and
- allowed the remaining 2 cases to be at the margin.
-
- + Rename some variables in pcre to eliminate shadowing. This seems very
- pedantic, but does no harm, of course.
-
-6. Moved the call to setjmp() into its own function, to get rid of warnings
-from gcc -Wall, and avoided calling it at all unless PCRE_EXTRA is used.
-
-7. Constructs such as \d{8,} were compiling into the equivalent of
-\d{8}\d{0,65527} instead of \d{8}\d* which didn't make much difference to the
-outcome, but in this particular case used more store than had been allocated,
-which caused the bug to be discovered because it threw up an internal error.
-
-8. The debugging code in both pcre and pcretest for outputting the compiled
-form of a regex was going wrong in the case of back references followed by
-curly-bracketed repeats.
-
-
-Version 1.02 12-Dec-97
-----------------------
-
-1. Typos in pcre.3 and comments in the source fixed.
-
-2. Applied a contributed patch to get rid of places where it used to remove
-'const' from variables, and fixed some signed/unsigned and uninitialized
-variable warnings.
-
-3. Added the "runtest" target to Makefile.
-
-4. Set default compiler flag to -O2 rather than just -O.
-
-
-Version 1.01 19-Nov-97
-----------------------
-
-1. PCRE was failing to diagnose unlimited repeat of empty string for patterns
-like /([ab]*)*/, that is, for classes with more than one character in them.
-
-2. Likewise, it wasn't diagnosing patterns with "once-only" subpatterns, such
-as /((?>a*))*/ (a PCRE_EXTRA facility).
-
-
-Version 1.00 18-Nov-97
-----------------------
-
-1. Added compile-time macros to support systems such as SunOS4 which don't have
-memmove() or strerror() but have other things that can be used instead.
-
-2. Arranged that "make clean" removes the executables.
-
-
-Version 0.99 27-Oct-97
-----------------------
-
-1. Fixed bug in code for optimizing classes with only one character. It was
-initializing a 32-byte map regardless, which could cause it to run off the end
-of the memory it had got.
-
-2. Added, conditional on PCRE_EXTRA, the proposed (?>REGEX) construction.
-
-
-Version 0.98 22-Oct-97
-----------------------
-
-1. Fixed bug in code for handling temporary memory usage when there are more
-back references than supplied space in the ovector. This could cause segfaults.
-
-
-Version 0.97 21-Oct-97
-----------------------
-
-1. Added the \X "cut" facility, conditional on PCRE_EXTRA.
-
-2. Optimized negated single characters not to use a bit map.
-
-3. Brought error texts together as macro definitions; clarified some of them;
-fixed one that was wrong - it said "range out of order" when it meant "invalid
-escape sequence".
-
-4. Changed some char * arguments to const char *.
-
-5. Added PCRE_NOTBOL and PCRE_NOTEOL (from POSIX).
-
-6. Added the POSIX-style API wrapper in pcreposix.a and testing facilities in
-pcretest.
-
-
-Version 0.96 16-Oct-97
-----------------------
-
-1. Added a simple "pgrep" utility to the distribution.
-
-2. Fixed an incompatibility with Perl: "{" is now treated as a normal character
-unless it appears in one of the precise forms "{ddd}", "{ddd,}", or "{ddd,ddd}"
-where "ddd" means "one or more decimal digits".
-
-3. Fixed serious bug. If a pattern had a back reference, but the call to
-pcre_exec() didn't supply a large enough ovector to record the related
-identifying subpattern, the match always failed. PCRE now remembers the number
-of the largest back reference, and gets some temporary memory in which to save
-the offsets during matching if necessary, in order to ensure that
-backreferences always work.
-
-4. Increased the compatibility with Perl in a number of ways:
-
- (a) . no longer matches \n by default; an option PCRE_DOTALL is provided
- to request this handling. The option can be set at compile or exec time.
-
- (b) $ matches before a terminating newline by default; an option
- PCRE_DOLLAR_ENDONLY is provided to override this (but not in multiline
- mode). The option can be set at compile or exec time.
-
- (c) The handling of \ followed by a digit other than 0 is now supposed to be
- the same as Perl's. If the decimal number it represents is less than 10
- or there aren't that many previous left capturing parentheses, an octal
- escape is read. Inside a character class, it's always an octal escape,
- even if it is a single digit.
-
- (d) An escaped but undefined alphabetic character is taken as a literal,
- unless PCRE_EXTRA is set. Currently this just reserves the remaining
- escapes.
-
- (e) {0} is now permitted. (The previous item is removed from the compiled
- pattern).
-
-5. Changed all the names of code files so that the basic parts are no longer
-than 10 characters, and abolished the teeny "globals.c" file.
-
-6. Changed the handling of character classes; they are now done with a 32-byte
-bit map always.
-
-7. Added the -d and /D options to pcretest to make it possible to look at the
-internals of compilation without having to recompile pcre.
-
-
-Version 0.95 23-Sep-97
-----------------------
-
-1. Fixed bug in pre-pass concerning escaped "normal" characters such as \x5c or
-\x20 at the start of a run of normal characters. These were being treated as
-real characters, instead of the source characters being re-checked.
-
-
-Version 0.94 18-Sep-97
-----------------------
-
-1. The functions are now thread-safe, with the caveat that the global variables
-containing pointers to malloc() and free() or alternative functions are the
-same for all threads.
-
-2. Get pcre_study() to generate a bitmap of initial characters for non-
-anchored patterns when this is possible, and use it if passed to pcre_exec().
-
-
-Version 0.93 15-Sep-97
-----------------------
-
-1. /(b)|(:+)/ was computing an incorrect first character.
-
-2. Add pcre_study() to the API and the passing of pcre_extra to pcre_exec(),
-but not actually doing anything yet.
-
-3. Treat "-" characters in classes that cannot be part of ranges as literals,
-as Perl does (e.g. [-az] or [az-]).
-
-4. Set the anchored flag if a branch starts with .* or .*? because that tests
-all possible positions.
-
-5. Split up into different modules to avoid including unneeded functions in a
-compiled binary. However, compile and exec are still in one module. The "study"
-function is split off.
-
-6. The character tables are now in a separate module whose source is generated
-by an auxiliary program - but can then be edited by hand if required. There are
-now no calls to isalnum(), isspace(), isdigit(), isxdigit(), tolower() or
-toupper() in the code.
-
-7. Turn the malloc/free funtions variables into pcre_malloc and pcre_free and
-make them global. Abolish the function for setting them, as the caller can now
-set them directly.
-
-
-Version 0.92 11-Sep-97
-----------------------
-
-1. A repeat with a fixed maximum and a minimum of 1 for an ordinary character
-(e.g. /a{1,3}/) was broken (I mis-optimized it).
-
-2. Caseless matching was not working in character classes if the characters in
-the pattern were in upper case.
-
-3. Make ranges like [W-c] work in the same way as Perl for caseless matching.
-
-4. Make PCRE_ANCHORED public and accept as a compile option.
-
-5. Add an options word to pcre_exec() and accept PCRE_ANCHORED and
-PCRE_CASELESS at run time. Add escapes \A and \I to pcretest to cause it to
-pass them.
-
-6. Give an error if bad option bits passed at compile or run time.
-
-7. Add PCRE_MULTILINE at compile and exec time, and (?m) as well. Add \M to
-pcretest to cause it to pass that flag.
-
-8. Add pcre_info(), to get the number of identifying subpatterns, the stored
-options, and the first character, if set.
-
-9. Recognize C+ or C{n,m} where n >= 1 as providing a fixed starting character.
-
-
-Version 0.91 10-Sep-97
-----------------------
-
-1. PCRE was failing to diagnose unlimited repeats of subpatterns that could
-match the empty string as in /(a*)*/. It was looping and ultimately crashing.
-
-2. PCRE was looping on encountering an indefinitely repeated back reference to
-a subpattern that had matched an empty string, e.g. /(a|)\1*/. It now does what
-Perl does - treats the match as successful.
-
-****
diff --git a/ext/pcre/pcrelib/INSTALL b/ext/pcre/pcrelib/INSTALL
deleted file mode 100644
index 08802812de..0000000000
--- a/ext/pcre/pcrelib/INSTALL
+++ /dev/null
@@ -1,185 +0,0 @@
-Basic Installation
-==================
-
- These are generic installation instructions that apply to systems that
-can run the `configure' shell script - Unix systems and any that imitate
-it. They are not specific to PCRE. There are PCRE-specific instructions
-for non-Unix systems in the file NON-UNIX-USE.
-
- The `configure' shell script attempts to guess correct values for
-various system-dependent variables used during compilation. It uses
-those values to create a `Makefile' in each directory of the package.
-It may also create one or more `.h' files containing system-dependent
-definitions. Finally, it creates a shell script `config.status' that
-you can run in the future to recreate the current configuration, a file
-`config.cache' that saves the results of its tests to speed up
-reconfiguring, and a file `config.log' containing compiler output
-(useful mainly for debugging `configure').
-
- If you need to do unusual things to compile the package, please try
-to figure out how `configure' could check whether to do them, and mail
-diffs or instructions to the address given in the `README' so they can
-be considered for the next release. If at some point `config.cache'
-contains results you don't want to keep, you may remove or edit it.
-
- The file `configure.in' is used to create `configure' by a program
-called `autoconf'. You only need `configure.in' if you want to change
-it or regenerate `configure' using a newer version of `autoconf'.
-
-The simplest way to compile this package is:
-
- 1. `cd' to the directory containing the package's source code and type
- `./configure' to configure the package for your system. If you're
- using `csh' on an old version of System V, you might need to type
- `sh ./configure' instead to prevent `csh' from trying to execute
- `configure' itself.
-
- Running `configure' takes awhile. While running, it prints some
- messages telling which features it is checking for.
-
- 2. Type `make' to compile the package.
-
- 3. Optionally, type `make check' to run any self-tests that come with
- the package.
-
- 4. Type `make install' to install the programs and any data files and
- documentation.
-
- 5. You can remove the program binaries and object files from the
- source code directory by typing `make clean'. To also remove the
- files that `configure' created (so you can compile the package for
- a different kind of computer), type `make distclean'. There is
- also a `make maintainer-clean' target, but that is intended mainly
- for the package's developers. If you use it, you may have to get
- all sorts of other programs in order to regenerate files that came
- with the distribution.
-
-Compilers and Options
-=====================
-
- Some systems require unusual options for compilation or linking that
-the `configure' script does not know about. You can give `configure'
-initial values for variables by setting them in the environment. Using
-a Bourne-compatible shell, you can do that on the command line like
-this:
- CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure
-
-Or on systems that have the `env' program, you can do it like this:
- env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure
-
-Compiling For Multiple Architectures
-====================================
-
- You can compile the package for more than one kind of computer at the
-same time, by placing the object files for each architecture in their
-own directory. To do this, you must use a version of `make' that
-supports the `VPATH' variable, such as GNU `make'. `cd' to the
-directory where you want the object files and executables to go and run
-the `configure' script. `configure' automatically checks for the
-source code in the directory that `configure' is in and in `..'.
-
- If you have to use a `make' that does not supports the `VPATH'
-variable, you have to compile the package for one architecture at a time
-in the source code directory. After you have installed the package for
-one architecture, use `make distclean' before reconfiguring for another
-architecture.
-
-Installation Names
-==================
-
- By default, `make install' will install the package's files in
-`/usr/local/bin', `/usr/local/man', etc. You can specify an
-installation prefix other than `/usr/local' by giving `configure' the
-option `--prefix=PATH'.
-
- You can specify separate installation prefixes for
-architecture-specific files and architecture-independent files. If you
-give `configure' the option `--exec-prefix=PATH', the package will use
-PATH as the prefix for installing programs and libraries.
-Documentation and other data files will still use the regular prefix.
-
- In addition, if you use an unusual directory layout you can give
-options like `--bindir=PATH' to specify different values for particular
-kinds of files. Run `configure --help' for a list of the directories
-you can set and what kinds of files go in them.
-
- If the package supports it, you can cause programs to be installed
-with an extra prefix or suffix on their names by giving `configure' the
-option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
-
-Optional Features
-=================
-
- Some packages pay attention to `--enable-FEATURE' options to
-`configure', where FEATURE indicates an optional part of the package.
-They may also pay attention to `--with-PACKAGE' options, where PACKAGE
-is something like `gnu-as' or `x' (for the X Window System). The
-`README' should mention any `--enable-' and `--with-' options that the
-package recognizes.
-
- For packages that use the X Window System, `configure' can usually
-find the X include and library files automatically, but if it doesn't,
-you can use the `configure' options `--x-includes=DIR' and
-`--x-libraries=DIR' to specify their locations.
-
-Specifying the System Type
-==========================
-
- There may be some features `configure' can not figure out
-automatically, but needs to determine by the type of host the package
-will run on. Usually `configure' can figure that out, but if it prints
-a message saying it can not guess the host type, give it the
-`--host=TYPE' option. TYPE can either be a short name for the system
-type, such as `sun4', or a canonical name with three fields:
- CPU-COMPANY-SYSTEM
-
-See the file `config.sub' for the possible values of each field. If
-`config.sub' isn't included in this package, then this package doesn't
-need to know the host type.
-
- If you are building compiler tools for cross-compiling, you can also
-use the `--target=TYPE' option to select the type of system they will
-produce code for and the `--build=TYPE' option to select the type of
-system on which you are compiling the package.
-
-Sharing Defaults
-================
-
- If you want to set default values for `configure' scripts to share,
-you can create a site shell script called `config.site' that gives
-default values for variables like `CC', `cache_file', and `prefix'.
-`configure' looks for `PREFIX/share/config.site' if it exists, then
-`PREFIX/etc/config.site' if it exists. Or, you can set the
-`CONFIG_SITE' environment variable to the location of the site script.
-A warning: not all `configure' scripts look for a site script.
-
-Operation Controls
-==================
-
- `configure' recognizes the following options to control how it
-operates.
-
-`--cache-file=FILE'
- Use and save the results of the tests in FILE instead of
- `./config.cache'. Set FILE to `/dev/null' to disable caching, for
- debugging `configure'.
-
-`--help'
- Print a summary of the options to `configure', and exit.
-
-`--quiet'
-`--silent'
-`-q'
- Do not print messages saying which checks are being made. To
- suppress all normal output, redirect it to `/dev/null' (any error
- messages will still be shown).
-
-`--srcdir=DIR'
- Look for the package's source code in directory DIR. Usually
- `configure' can determine that directory automatically.
-
-`--version'
- Print the version of Autoconf used to generate the `configure'
- script, and exit.
-
-`configure' also accepts some other, not widely useful, options.
diff --git a/ext/pcre/pcrelib/LICENCE b/ext/pcre/pcrelib/LICENCE
deleted file mode 100644
index 34d20db928..0000000000
--- a/ext/pcre/pcrelib/LICENCE
+++ /dev/null
@@ -1,46 +0,0 @@
-PCRE LICENCE
-------------
-
-PCRE is a library of functions to support regular expressions whose syntax
-and semantics are as close as possible to those of the Perl 5 language.
-
-Written by: Philip Hazel <ph10@cam.ac.uk>
-
-University of Cambridge Computing Service,
-Cambridge, England. Phone: +44 1223 334714.
-
-Copyright (c) 1997-2000 University of Cambridge
-
-Permission is granted to anyone to use this software for any purpose on any
-computer system, and to redistribute it freely, subject to the following
-restrictions:
-
-1. This software is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-
-2. The origin of this software must not be misrepresented, either by
- explicit claim or by omission. In practice, this means that if you use
- PCRE in software which you distribute to others, commercially or
- otherwise, you must put a sentence like this
-
- Regular expression support is provided by the PCRE library package,
- which is open source software, written by Philip Hazel, and copyright
- by the University of Cambridge, England.
-
- somewhere reasonably visible in your documentation and in any relevant
- files or online help data or similar. A reference to the ftp site for
- the source, that is, to
-
- ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/
-
- should also be given in the documentation.
-
-3. Altered versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
-
-4. If PCRE is embedded in any software that is released under the GNU
- General Purpose Licence (GPL), then the terms of that licence shall
- supersede any condition above with which it is incompatible.
-
-End
diff --git a/ext/pcre/pcrelib/Makefile.in b/ext/pcre/pcrelib/Makefile.in
deleted file mode 100644
index 6f7bb73cf0..0000000000
--- a/ext/pcre/pcrelib/Makefile.in
+++ /dev/null
@@ -1,7 +0,0 @@
-
-LTLIBRARY_NAME = libpcre.la
-LTLIBRARY_SOURCES = maketables.c get.c study.c pcre.c
-
-EXTRA_INCLUDES = -DSUPPORT_UTF8
-
-include $(top_srcdir)/build/dynlib.mk
diff --git a/ext/pcre/pcrelib/NEWS b/ext/pcre/pcrelib/NEWS
deleted file mode 100644
index 56fccdfad3..0000000000
--- a/ext/pcre/pcrelib/NEWS
+++ /dev/null
@@ -1,54 +0,0 @@
-News about PCRE releases
-------------------------
-
-Release 3.3 01-Aug-00
----------------------
-
-There is some support for UTF-8 character strings. This is incomplete and
-experimental. The documentation describes what is and what is not implemented.
-Otherwise, this is just a bug-fixing release.
-
-
-Release 3.0 01-Feb-00
----------------------
-
-1. A "configure" script is now used to configure PCRE for Unix systems. It
-builds a Makefile, a config.h file, and the pcre-config script.
-
-2. PCRE is built as a shared library by default.
-
-3. There is support for POSIX classes such as [:alpha:].
-
-5. There is an experimental recursion feature.
-
-----------------------------------------------------------------------------
- IMPORTANT FOR THOSE UPGRADING FROM VERSIONS BEFORE 2.00
-
-Please note that there has been a change in the API such that a larger
-ovector is required at matching time, to provide some additional workspace.
-The new man page has details. This change was necessary in order to support
-some of the new functionality in Perl 5.005.
-
- IMPORTANT FOR THOSE UPGRADING FROM VERSION 2.00
-
-Another (I hope this is the last!) change has been made to the API for the
-pcre_compile() function. An additional argument has been added to make it
-possible to pass over a pointer to character tables built in the current
-locale by pcre_maketables(). To use the default tables, this new arguement
-should be passed as NULL.
-
- IMPORTANT FOR THOSE UPGRADING FROM VERSION 2.05
-
-Yet another (and again I hope this really is the last) change has been made
-to the API for the pcre_exec() function. An additional argument has been
-added to make it possible to start the match other than at the start of the
-subject string. This is important if there are lookbehinds. The new man
-page has the details, but you just want to convert existing programs, all
-you need to do is to stick in a new fifth argument to pcre_exec(), with a
-value of zero. For example, change
-
- pcre_exec(pattern, extra, subject, length, options, ovec, ovecsize)
-to
- pcre_exec(pattern, extra, subject, length, 0, options, ovec, ovecsize)
-
-****
diff --git a/ext/pcre/pcrelib/NON-UNIX-USE b/ext/pcre/pcrelib/NON-UNIX-USE
deleted file mode 100644
index 09a743245b..0000000000
--- a/ext/pcre/pcrelib/NON-UNIX-USE
+++ /dev/null
@@ -1,50 +0,0 @@
-Compiling PCRE on non-Unix systems
-----------------------------------
-
-If you want to compile PCRE for a non-Unix system, note that it consists
-entirely of code written in Standard C, and so should compile successfully
-on any machine with a Standard C compiler and library, using normal compiling
-commands to do the following:
-
-(1) Copy or rename the file config.in as config.h, and change the macros that
-define HAVE_STRERROR and HAVE_MEMMOVE to define them as 1 rather than 0.
-Unfortunately, because of the way Unix autoconf works, the default setting has
-to be 0.
-
-(2) Copy or rename the file pcre.in as pcre.h, and change the macro definitions
-for PCRE_MAJOR, PCRE_MINOR, and PCRE_DATE near its start to the values set in
-configure.in.
-
-(3) Compile dftables.c as a stand-alone program, and then run it with
-the standard output sent to chartables.c. This generates a set of standard
-character tables.
-
-(4) Compile maketables.c, get.c, study.c and pcre.c and link them all
-together into an object library in whichever form your system keeps such
-libraries. This is the pcre library (chartables.c gets included by means of an
-#include directive).
-
-(5) Similarly, compile pcreposix.c and link it as the pcreposix library.
-
-(6) Compile the test program pcretest.c. This needs the functions in the
-pcre and pcreposix libraries when linking.
-
-(7) Run pcretest on the testinput files in the testdata directory, and check
-that the output matches the corresponding testoutput files. You must use the
--i option when checking testinput2.
-
-If you have a system without "configure" but where you can use a Makefile, edit
-Makefile.in to create Makefile, substituting suitable values for the variables
-at the head of the file.
-
-Some help in building a Win32 DLL of PCRE in GnuWin32 environments was
-contributed by Paul.Sokolovsky@technologist.com. These environments are
-Mingw32 (http://www.xraylith.wisc.edu/~khan/software/gnu-win32/) and
-CygWin (http://sourceware.cygnus.com/cygwin/). Paul comments:
-
- For CygWin, set CFLAGS=-mno-cygwin, and do 'make dll'. You'll get
- pcre.dll (containing pcreposix also), libpcre.dll.a, and dynamically
- linked pgrep and pcretest. If you have /bin/sh, run RunTest (three
- main test go ok, locale not supported).
-
-****
diff --git a/ext/pcre/pcrelib/README b/ext/pcre/pcrelib/README
deleted file mode 100644
index d124ee014c..0000000000
--- a/ext/pcre/pcrelib/README
+++ /dev/null
@@ -1,270 +0,0 @@
-README file for PCRE (Perl-compatible regular expression library)
------------------------------------------------------------------
-
-The latest release of PCRE is always available from
-
- ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-xxx.tar.gz
-
-Please read the NEWS file if you are upgrading from a previous release.
-
-PCRE has its own native API, but a set of "wrapper" functions that are based on
-the POSIX API are also supplied in the library libpcreposix. Note that this
-just provides a POSIX calling interface to PCRE: the regular expressions
-themselves still follow Perl syntax and semantics. The header file
-for the POSIX-style functions is called pcreposix.h. The official POSIX name is
-regex.h, but I didn't want to risk possible problems with existing files of
-that name by distributing it that way. To use it with an existing program that
-uses the POSIX API, it will have to be renamed or pointed at by a link.
-
-
-Building PCRE on a Unix system
-------------------------------
-
-To build PCRE on a Unix system, run the "configure" command in the PCRE
-distribution directory. This is a standard GNU "autoconf" configuration script,
-for which generic instructions are supplied in INSTALL. On many systems just
-running "./configure" is sufficient, but the usual methods of changing standard
-defaults are available. For example,
-
-CFLAGS='-O2 -Wall' ./configure --prefix=/opt/local
-
-specifies that the C compiler should be run with the flags '-O2 -Wall' instead
-of the default, and that "make install" should install PCRE under /opt/local
-instead of the default /usr/local.
-
-If you want to make use of the experimential, incomplete support for UTF-8
-character strings in PCRE, you must add --enable-utf8 to the "configure"
-command. Without it, the code for handling UTF-8 is not included in the
-library. (Even when included, it still has to be enabled by an option at run
-time.)
-
-The "configure" script builds four files:
-
-. Makefile is built by copying Makefile.in and making substitutions.
-. config.h is built by copying config.in and making substitutions.
-. pcre-config is built by copying pcre-config.in and making substitutions.
-. RunTest is a script for running tests
-
-Once "configure" has run, you can run "make". It builds two libraries called
-libpcre and libpcreposix, a test program called pcretest, and the pcregrep
-command. You can use "make install" to copy these, and the public header file
-pcre.h, to appropriate live directories on your system, in the normal way.
-
-Running "make install" also installs the command pcre-config, which can be used
-to recall information about the PCRE configuration and installation. For
-example,
-
- pcre-config --version
-
-prints the version number, and
-
- pcre-config --libs
-
-outputs information about where the library is installed. This command can be
-included in makefiles for programs that use PCRE, saving the programmer from
-having to remember too many details.
-
-
-Shared libraries on Unix systems
---------------------------------
-
-The default distribution builds PCRE as two shared libraries. This support is
-new and experimental and may not work on all systems. It relies on the
-"libtool" scripts - these are distributed with PCRE. It should build a
-"libtool" script and use this to compile and link shared libraries, which are
-placed in a subdirectory called .libs. The programs pcretest and pcregrep are
-built to use these uninstalled libraries by means of wrapper scripts. When you
-use "make install" to install shared libraries, pcregrep and pcretest are
-automatically re-built to use the newly installed libraries. However, only
-pcregrep is installed, as pcretest is really just a test program.
-
-To build PCRE using static libraries you must use --disable-shared when
-configuring it. For example
-
-./configure --prefix=/usr/gnu --disable-shared
-
-Then run "make" in the usual way.
-
-
-Building on non-Unix systems
-----------------------------
-
-For a non-Unix system, read the comments in the file NON-UNIX-USE. PCRE has
-been compiled on Windows systems and on Macintoshes, but I don't know the
-details because I don't use those systems. It should be straightforward to
-build PCRE on any system that has a Standard C compiler, because it uses only
-Standard C functions.
-
-
-Testing PCRE
-------------
-
-To test PCRE on a Unix system, run the RunTest script in the pcre directory.
-(This can also be run by "make runtest", "make check", or "make test".) For
-other systems, see the instruction in NON-UNIX-USE.
-
-The script runs the pcretest test program (which is documented in
-doc/pcretest.txt) on each of the testinput files (in the testdata directory) in
-turn, and compares the output with the contents of the corresponding testoutput
-file. A file called testtry is used to hold the output from pcretest. To run
-pcretest on just one of the test files, give its number as an argument to
-RunTest, for example:
-
- RunTest 3
-
-The first and third test files can also be fed directly into the perltest
-script to check that Perl gives the same results. The third file requires the
-additional features of release 5.005, which is why it is kept separate from the
-main test input, which needs only Perl 5.004. In the long run, when 5.005 (or
-higher) is widespread, these two test files may get amalgamated.
-
-The second set of tests check pcre_fullinfo(), pcre_info(), pcre_study(),
-pcre_copy_substring(), pcre_get_substring(), pcre_get_substring_list(), error
-detection, and run-time flags that are specific to PCRE, as well as the POSIX
-wrapper API. It also uses the debugging flag to check some of the internals of
-pcre_compile().
-
-If you build PCRE with a locale setting that is not the standard C locale, the
-character tables may be different (see next paragraph). In some cases, this may
-cause failures in the second set of tests. For example, in a locale where the
-isprint() function yields TRUE for characters in the range 128-255, the use of
-[:isascii:] inside a character class defines a different set of characters, and
-this shows up in this test as a difference in the compiled code, which is being
-listed for checking. Where the comparison test output contains [\x00-\x7f] the
-test will contain [\x00-\xff], and similarly in some other cases. This is not a
-bug in PCRE.
-
-The fourth set of tests checks pcre_maketables(), the facility for building a
-set of character tables for a specific locale and using them instead of the
-default tables. The tests make use of the "fr" (French) locale. Before running
-the test, the script checks for the presence of this locale by running the
-"locale" command. If that command fails, or if it doesn't include "fr" in the
-list of available locales, the fourth test cannot be run, and a comment is
-output to say why. If running this test produces instances of the error
-
- ** Failed to set locale "fr"
-
-in the comparison output, it means that locale is not available on your system,
-despite being listed by "locale". This does not mean that PCRE is broken.
-
-The fifth test checks the experimental, incomplete UTF-8 support. It is not run
-automatically unless PCRE is built with UTF-8 support. This file can be fed
-directly to the perltest8 script, which requires Perl 5.6 or higher. The sixth
-file tests internal UTF-8 features of PCRE that are not relevant to Perl.
-
-
-Character tables
-----------------
-
-PCRE uses four tables for manipulating and identifying characters. The final
-argument of the pcre_compile() function is a pointer to a block of memory
-containing the concatenated tables. A call to pcre_maketables() can be used to
-generate a set of tables in the current locale. If the final argument for
-pcre_compile() is passed as NULL, a set of default tables that is built into
-the binary is used.
-
-The source file called chartables.c contains the default set of tables. This is
-not supplied in the distribution, but is built by the program dftables
-(compiled from dftables.c), which uses the ANSI C character handling functions
-such as isalnum(), isalpha(), isupper(), islower(), etc. to build the table
-sources. This means that the default C locale which is set for your system will
-control the contents of these default tables. You can change the default tables
-by editing chartables.c and then re-building PCRE. If you do this, you should
-probably also edit Makefile to ensure that the file doesn't ever get
-re-generated.
-
-The first two 256-byte tables provide lower casing and case flipping functions,
-respectively. The next table consists of three 32-byte bit maps which identify
-digits, "word" characters, and white space, respectively. These are used when
-building 32-byte bit maps that represent character classes.
-
-The final 256-byte table has bits indicating various character types, as
-follows:
-
- 1 white space character
- 2 letter
- 4 decimal digit
- 8 hexadecimal digit
- 16 alphanumeric or '_'
- 128 regular expression metacharacter or binary zero
-
-You should not alter the set of characters that contain the 128 bit, as that
-will cause PCRE to malfunction.
-
-
-Manifest
---------
-
-The distribution should contain the following files:
-
-(A) The actual source files of the PCRE library functions and their
- headers:
-
- dftables.c auxiliary program for building chartables.c
- get.c )
- maketables.c )
- study.c ) source of
- pcre.c ) the functions
- pcreposix.c )
- pcre.in "source" for the header for the external API; pcre.h
- is built from this by "configure"
- pcreposix.h header for the external POSIX wrapper API
- internal.h header for internal use
- config.in template for config.h, which is built by configure
-
-(B) Auxiliary files:
-
- AUTHORS information about the author of PCRE
- ChangeLog log of changes to the code
- INSTALL generic installation instructions
- LICENCE conditions for the use of PCRE
- COPYING the same, using GNU's standard name
- Makefile.in template for Unix Makefile, which is built by configure
- NEWS important changes in this release
- NON-UNIX-USE notes on building PCRE on non-Unix systems
- README this file
- RunTest.in template for a Unix shell script for running tests
- config.guess ) files used by libtool,
- config.sub ) used only when building a shared library
- configure a configuring shell script (built by autoconf)
- configure.in the autoconf input used to build configure
- doc/Tech.Notes notes on the encoding
- doc/pcre.3 man page source for the PCRE functions
- doc/pcre.html HTML version
- doc/pcre.txt plain text version
- doc/pcreposix.3 man page source for the POSIX wrapper API
- doc/pcreposix.html HTML version
- doc/pcreposix.txt plain text version
- doc/pcretest.txt documentation of test program
- doc/perltest.txt documentation of Perl test program
- doc/pcregrep.1 man page source for the pcregrep utility
- doc/pcregrep.html HTML version
- doc/pcregrep.txt plain text version
- install-sh a shell script for installing files
- ltconfig ) files used to build "libtool",
- ltmain.sh ) used only when building a shared library
- pcretest.c test program
- perltest Perl test program
- perltest8 Perl test program for UTF-8 tests
- pcregrep.c source of a grep utility that uses PCRE
- pcre-config.in source of script which retains PCRE information
- testdata/testinput1 test data, compatible with Perl 5.004 and 5.005
- testdata/testinput2 test data for error messages and non-Perl things
- testdata/testinput3 test data, compatible with Perl 5.005
- testdata/testinput4 test data for locale-specific tests
- testdata/testinput5 test data for UTF-8 tests compatible with Perl 5.6
- testdata/testinput6 test data for other UTF-8 tests
- testdata/testoutput1 test results corresponding to testinput1
- testdata/testoutput2 test results corresponding to testinput2
- testdata/testoutput3 test results corresponding to testinput3
- testdata/testoutput4 test results corresponding to testinput4
- testdata/testoutput5 test results corresponding to testinput5
- testdata/testoutput6 test results corresponding to testinput6
-
-(C) Auxiliary files for Win32 DLL
-
- dll.mk
- pcre.def
-
-Philip Hazel <ph10@cam.ac.uk>
-August 2000
diff --git a/ext/pcre/pcrelib/RunTest b/ext/pcre/pcrelib/RunTest
deleted file mode 100755
index d82097d4ae..0000000000
--- a/ext/pcre/pcrelib/RunTest
+++ /dev/null
@@ -1,148 +0,0 @@
-#! /bin/sh
-
-# This file is generated by configure from RunTest.in. Make any changes
-# to that file.
-
-# Run PCRE tests
-
-cf=diff
-
-# Select which tests to run; if no selection, run all
-
-do1=no
-do2=no
-do3=no
-do4=no
-do5=no
-do6=no
-
-while [ $# -gt 0 ] ; do
- case $1 in
- 1) do1=yes;;
- 2) do2=yes;;
- 3) do3=yes;;
- 4) do4=yes;;
- 5) do5=yes;;
- 6) do6=yes;;
- *) echo "Unknown test number $1"; exit 1;;
- esac
- shift
-done
-
-if [ "" = "" ] ; then
- if [ $do5 = yes ] ; then
- echo "Can't run test 5 because UFT8 support is not configured"
- exit 1
- fi
- if [ $do6 = yes ] ; then
- echo "Can't run test 6 because UFT8 support is not configured"
- exit 1
- fi
-fi
-
-if [ $do1 = no -a $do2 = no -a $do3 = no -a $do4 = no -a\
- $do5 = no -a $do6 = no ] ; then
- do1=yes
- do2=yes
- do3=yes
- do4=yes
- if [ "" != "" ] ; then do5=yes; fi
- if [ "" != "" ] ; then do6=yes; fi
-fi
-
-# Primary test, Perl-compatible
-
-if [ $do1 = yes ] ; then
- echo "Testing main functionality (Perl compatible)"
- ./pcretest testdata/testinput1 testtry
- if [ $? = 0 ] ; then
- $cf testtry testdata/testoutput1
- if [ $? != 0 ] ; then exit 1; fi
- else exit 1
- fi
-fi
-
-# PCRE tests that are not Perl-compatible - API & error tests, mostly
-
-if [ $do2 = yes ] ; then
- echo "Testing API and error handling (not Perl compatible)"
- ./pcretest -i testdata/testinput2 testtry
- if [ $? = 0 ] ; then
- $cf testtry testdata/testoutput2
- if [ $? != 0 ] ; then exit 1; fi
- else exit 1
- fi
-fi
-
-# Additional Perl-compatible tests for Perl 5.005's new features
-
-if [ $do3 = yes ] ; then
- echo "Testing Perl 5.005 features (Perl 5.005 compatible)"
- ./pcretest testdata/testinput3 testtry
- if [ $? = 0 ] ; then
- $cf testtry testdata/testoutput3
- if [ $? != 0 ] ; then exit 1; fi
- else exit 1
- fi
-fi
-
-if [ $do1 = yes -a $do2 = yes -a $do3 = yes ] ; then
- echo " "
- echo "The three main tests all ran OK"
- echo " "
-fi
-
-# Locale-specific tests, provided the "fr" locale is available
-
-if [ $do4 = yes ] ; then
- locale -a | grep '^fr$' >/dev/null
- if [ $? -eq 0 ] ; then
- echo "Testing locale-specific features (using 'fr' locale)"
- ./pcretest testdata/testinput4 testtry
- if [ $? = 0 ] ; then
- $cf testtry testdata/testoutput4
- if [ $? != 0 ] ; then
- echo " "
- echo "Locale test did not run entirely successfully."
- echo "This usually means that there is a problem with the locale"
- echo "settings rather than a bug in PCRE."
- else
- echo "Locale test ran OK"
- fi
- echo " "
- else exit 1
- fi
- else
- echo "Cannot test locale-specific features - 'fr' locale not found,"
- echo "or the \"locale\" command is not available to check for it."
- echo " "
- fi
-fi
-
-# Additional tests for UTF8 support
-
-if [ $do5 = yes ] ; then
- echo "Testing experimental, incomplete UTF8 support (Perl compatible)"
- ./pcretest testdata/testinput5 testtry
- if [ $? = 0 ] ; then
- $cf testtry testdata/testoutput5
- if [ $? != 0 ] ; then exit 1; fi
- else exit 1
- fi
- echo "UTF8 test ran OK"
- echo " "
-fi
-
-if [ $do6 = yes ] ; then
- echo "Testing API and internals for UTF8 support (not Perl compatible)"
- ./pcretest testdata/testinput6 testtry
- if [ $? = 0 ] ; then
- $cf testtry testdata/testoutput6
- if [ $? != 0 ] ; then exit 1; fi
- else exit 1
- fi
- echo "UTF8 internals test ran OK"
- echo " "
-fi
-
-# End
diff --git a/ext/pcre/pcrelib/chartables.c b/ext/pcre/pcrelib/chartables.c
deleted file mode 100644
index 9055da2d2d..0000000000
--- a/ext/pcre/pcrelib/chartables.c
+++ /dev/null
@@ -1,183 +0,0 @@
-/*************************************************
-* Perl-Compatible Regular Expressions *
-*************************************************/
-
-/* This file is automatically written by the dftables auxiliary
-program. If you edit it by hand, you might like to edit the Makefile to
-prevent its ever being regenerated.
-
-This file is #included in the compilation of pcre.c to build the default
-character tables which are used when no tables are passed to the compile
-function. */
-
-static unsigned char pcre_default_tables[] = {
-
-/* This table is a lower casing table. */
-
- 0, 1, 2, 3, 4, 5, 6, 7,
- 8, 9, 10, 11, 12, 13, 14, 15,
- 16, 17, 18, 19, 20, 21, 22, 23,
- 24, 25, 26, 27, 28, 29, 30, 31,
- 32, 33, 34, 35, 36, 37, 38, 39,
- 40, 41, 42, 43, 44, 45, 46, 47,
- 48, 49, 50, 51, 52, 53, 54, 55,
- 56, 57, 58, 59, 60, 61, 62, 63,
- 64, 97, 98, 99,100,101,102,103,
- 104,105,106,107,108,109,110,111,
- 112,113,114,115,116,117,118,119,
- 120,121,122, 91, 92, 93, 94, 95,
- 96, 97, 98, 99,100,101,102,103,
- 104,105,106,107,108,109,110,111,
- 112,113,114,115,116,117,118,119,
- 120,121,122,123,124,125,126,127,
- 128,129,130,131,132,133,134,135,
- 136,137,138,139,140,141,142,143,
- 144,145,146,147,148,149,150,151,
- 152,153,154,155,156,157,158,159,
- 160,161,162,163,164,165,166,167,
- 168,169,170,171,172,173,174,175,
- 176,177,178,179,180,181,182,183,
- 184,185,186,187,188,189,190,191,
- 192,193,194,195,196,197,198,199,
- 200,201,202,203,204,205,206,207,
- 208,209,210,211,212,213,214,215,
- 216,217,218,219,220,221,222,223,
- 224,225,226,227,228,229,230,231,
- 232,233,234,235,236,237,238,239,
- 240,241,242,243,244,245,246,247,
- 248,249,250,251,252,253,254,255,
-
-/* This table is a case flipping table. */
-
- 0, 1, 2, 3, 4, 5, 6, 7,
- 8, 9, 10, 11, 12, 13, 14, 15,
- 16, 17, 18, 19, 20, 21, 22, 23,
- 24, 25, 26, 27, 28, 29, 30, 31,
- 32, 33, 34, 35, 36, 37, 38, 39,
- 40, 41, 42, 43, 44, 45, 46, 47,
- 48, 49, 50, 51, 52, 53, 54, 55,
- 56, 57, 58, 59, 60, 61, 62, 63,
- 64, 97, 98, 99,100,101,102,103,
- 104,105,106,107,108,109,110,111,
- 112,113,114,115,116,117,118,119,
- 120,121,122, 91, 92, 93, 94, 95,
- 96, 65, 66, 67, 68, 69, 70, 71,
- 72, 73, 74, 75, 76, 77, 78, 79,
- 80, 81, 82, 83, 84, 85, 86, 87,
- 88, 89, 90,123,124,125,126,127,
- 128,129,130,131,132,133,134,135,
- 136,137,138,139,140,141,142,143,
- 144,145,146,147,148,149,150,151,
- 152,153,154,155,156,157,158,159,
- 160,161,162,163,164,165,166,167,
- 168,169,170,171,172,173,174,175,
- 176,177,178,179,180,181,182,183,
- 184,185,186,187,188,189,190,191,
- 192,193,194,195,196,197,198,199,
- 200,201,202,203,204,205,206,207,
- 208,209,210,211,212,213,214,215,
- 216,217,218,219,220,221,222,223,
- 224,225,226,227,228,229,230,231,
- 232,233,234,235,236,237,238,239,
- 240,241,242,243,244,245,246,247,
- 248,249,250,251,252,253,254,255,
-
-/* This table contains bit maps for various character classes.
-Each map is 32 bytes long and the bits run from the least
-significant end of each byte. The classes that have their own
-maps are: space, xdigit, digit, upper, lower, word, graph
-print, punct, and cntrl. Other classes are built from combinations. */
-
- 0x00,0x3e,0x00,0x00,0x01,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-
- 0x00,0x00,0x00,0x00,0x00,0x00,0xff,0x03,
- 0x7e,0x00,0x00,0x00,0x7e,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-
- 0x00,0x00,0x00,0x00,0x00,0x00,0xff,0x03,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0xfe,0xff,0xff,0x07,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0xfe,0xff,0xff,0x07,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-
- 0x00,0x00,0x00,0x00,0x00,0x00,0xff,0x03,
- 0xfe,0xff,0xff,0x87,0xfe,0xff,0xff,0x07,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-
- 0x00,0x00,0x00,0x00,0xfe,0xff,0xff,0xff,
- 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-
- 0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xff,
- 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-
- 0x00,0x00,0x00,0x00,0xfe,0xff,0x00,0xfc,
- 0x01,0x00,0x00,0xf8,0x01,0x00,0x00,0x78,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-
- 0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-
-/* This table identifies various classes of character by individual bits:
- 0x01 white space character
- 0x02 letter
- 0x04 decimal digit
- 0x08 hexadecimal digit
- 0x10 alphanumeric or '_'
- 0x80 regular expression metacharacter or binary zero
-*/
-
- 0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 0- 7 */
- 0x00,0x01,0x01,0x01,0x01,0x01,0x00,0x00, /* 8- 15 */
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 16- 23 */
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 24- 31 */
- 0x01,0x00,0x00,0x00,0x80,0x00,0x00,0x00, /* - ' */
- 0x80,0x80,0x80,0x80,0x00,0x00,0x80,0x00, /* ( - / */
- 0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c, /* 0 - 7 */
- 0x1c,0x1c,0x00,0x00,0x00,0x00,0x00,0x80, /* 8 - ? */
- 0x00,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x12, /* @ - G */
- 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, /* H - O */
- 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, /* P - W */
- 0x12,0x12,0x12,0x80,0x00,0x00,0x80,0x10, /* X - _ */
- 0x00,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x12, /* ` - g */
- 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, /* h - o */
- 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, /* p - w */
- 0x12,0x12,0x12,0x80,0x80,0x00,0x00,0x00, /* x -127 */
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 128-135 */
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 136-143 */
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 144-151 */
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 152-159 */
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 160-167 */
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 168-175 */
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 176-183 */
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 184-191 */
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 192-199 */
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 200-207 */
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 208-215 */
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 216-223 */
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 224-231 */
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 232-239 */
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 240-247 */
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};/* 248-255 */
-
-/* End of chartables.c */
diff --git a/ext/pcre/pcrelib/dftables.c b/ext/pcre/pcrelib/dftables.c
deleted file mode 100644
index d572dfd3e6..0000000000
--- a/ext/pcre/pcrelib/dftables.c
+++ /dev/null
@@ -1,148 +0,0 @@
-/*************************************************
-* Perl-Compatible Regular Expressions *
-*************************************************/
-
-/*
-PCRE is a library of functions to support regular expressions whose syntax
-and semantics are as close as possible to those of the Perl 5 language.
-
-Written by: Philip Hazel <ph10@cam.ac.uk>
-
- Copyright (c) 1997-2000 University of Cambridge
-
------------------------------------------------------------------------------
-Permission is granted to anyone to use this software for any purpose on any
-computer system, and to redistribute it freely, subject to the following
-restrictions:
-
-1. This software is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-
-2. The origin of this software must not be misrepresented, either by
- explicit claim or by omission.
-
-3. Altered versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
-
-4. If PCRE is embedded in any software that is released under the GNU
- General Purpose Licence (GPL), then the terms of that licence shall
- supersede any condition above with which it is incompatible.
------------------------------------------------------------------------------
-
-See the file Tech.Notes for some information on the internals.
-*/
-
-
-/* This is a support program to generate the file chartables.c, containing
-character tables of various kinds. They are built according to the default C
-locale and used as the default tables by PCRE. Now that pcre_maketables is
-a function visible to the outside world, we make use of its code from here in
-order to be consistent. */
-
-#include <ctype.h>
-#include <stdio.h>
-#include <string.h>
-
-#include "internal.h"
-
-#define DFTABLES /* maketables.c notices this */
-#include "maketables.c"
-
-
-int main(void)
-{
-int i;
-unsigned const char *tables = pcre_maketables();
-
-printf(
- "/*************************************************\n"
- "* Perl-Compatible Regular Expressions *\n"
- "*************************************************/\n\n"
- "/* This file is automatically written by the dftables auxiliary \n"
- "program. If you edit it by hand, you might like to edit the Makefile to \n"
- "prevent its ever being regenerated.\n\n"
- "This file is #included in the compilation of pcre.c to build the default\n"
- "character tables which are used when no tables are passed to the compile\n"
- "function. */\n\n"
- "static unsigned char pcre_default_tables[] = {\n\n"
- "/* This table is a lower casing table. */\n\n");
-
-printf(" ");
-for (i = 0; i < 256; i++)
- {
- if ((i & 7) == 0 && i != 0) printf("\n ");
- printf("%3d", *tables++);
- if (i != 255) printf(",");
- }
-printf(",\n\n");
-
-printf("/* This table is a case flipping table. */\n\n");
-
-printf(" ");
-for (i = 0; i < 256; i++)
- {
- if ((i & 7) == 0 && i != 0) printf("\n ");
- printf("%3d", *tables++);
- if (i != 255) printf(",");
- }
-printf(",\n\n");
-
-printf(
- "/* This table contains bit maps for various character classes.\n"
- "Each map is 32 bytes long and the bits run from the least\n"
- "significant end of each byte. The classes that have their own\n"
- "maps are: space, xdigit, digit, upper, lower, word, graph\n"
- "print, punct, and cntrl. Other classes are built from combinations. */\n\n");
-
-printf(" ");
-for (i = 0; i < cbit_length; i++)
- {
- if ((i & 7) == 0 && i != 0)
- {
- if ((i & 31) == 0) printf("\n");
- printf("\n ");
- }
- printf("0x%02x", *tables++);
- if (i != cbit_length - 1) printf(",");
- }
-printf(",\n\n");
-
-printf(
- "/* This table identifies various classes of character by individual bits:\n"
- " 0x%02x white space character\n"
- " 0x%02x letter\n"
- " 0x%02x decimal digit\n"
- " 0x%02x hexadecimal digit\n"
- " 0x%02x alphanumeric or '_'\n"
- " 0x%02x regular expression metacharacter or binary zero\n*/\n\n",
- ctype_space, ctype_letter, ctype_digit, ctype_xdigit, ctype_word,
- ctype_meta);
-
-printf(" ");
-for (i = 0; i < 256; i++)
- {
- if ((i & 7) == 0 && i != 0)
- {
- printf(" /* ");
- if (isprint(i-8)) printf(" %c -", i-8);
- else printf("%3d-", i-8);
- if (isprint(i-1)) printf(" %c ", i-1);
- else printf("%3d", i-1);
- printf(" */\n ");
- }
- printf("0x%02x", *tables++);
- if (i != 255) printf(",");
- }
-
-printf("};/* ");
-if (isprint(i-8)) printf(" %c -", i-8);
- else printf("%3d-", i-8);
-if (isprint(i-1)) printf(" %c ", i-1);
- else printf("%3d", i-1);
-printf(" */\n\n/* End of chartables.c */\n");
-
-return 0;
-}
-
-/* End of dftables.c */
diff --git a/ext/pcre/pcrelib/dll.mk b/ext/pcre/pcrelib/dll.mk
deleted file mode 100644
index d8b728e57e..0000000000
--- a/ext/pcre/pcrelib/dll.mk
+++ /dev/null
@@ -1,60 +0,0 @@
-# dll.mk - auxilary Makefile to easy build dll's for mingw32 target
-# ver. 0.6 of 1999-03-25
-#
-# Homepage of this makefile - http://www.is.lg.ua/~paul/devel/
-# Homepage of original mingw32 project -
-# http://www.fu.is.saga-u.ac.jp/~colin/gcc.html
-#
-# How to use:
-# This makefile can:
-# 1. Create automatical .def file from list of objects
-# 2. Create .dll from objects and .def file, either automatical, or your
-# hand-written (maybe) file, which must have same basename as dll
-# WARNING! There MUST be object, which name match dll's name. Make sux.
-# 3. Create import library from .def (as for .dll, only its name required,
-# not dll itself)
-# By convention implibs for dll have .dll.a suffix, e.g. libstuff.dll.a
-# Why not just libstuff.a? 'Cos that's name for static lib, ok?
-# Process divided into 3 phases because:
-# 1. Pre-existent .def possible
-# 2. Generating implib is enough time-consuming
-#
-# Variables:
-# DLL_LDLIBS - libs for linking dll
-# DLL_LDFLAGS - flags for linking dll
-#
-# By using $(DLL_SUFFIX) instead of 'dll', e.g. stuff.$(DLL_SUFFIX)
-# you may help porting makefiles to other platforms
-#
-# Put this file in your make's include path (e.g. main include dir, for
-# more information see include section in make doc). Put in the beginning
-# of your own Makefile line "include dll.mk". Specify dependences, e.g.:
-#
-# Do all stuff in one step
-# libstuff.dll.a: $(OBJECTS) stuff.def
-# stuff.def: $(OBJECTS)
-#
-# Steps separated, pre-provided .def, link with user32
-#
-# DLL_LDLIBS=-luser32
-# stuff.dll: $(OBJECTS)
-# libstuff.dll.a: $(OBJECTS)
-
-
-DLLWRAP=dllwrap
-DLLTOOL=dlltool
-
-DLL_SUFFIX=dll
-
-.SUFFIXES: .o .$(DLL_SUFFIX)
-
-_%.def: %.o
- $(DLLTOOL) --export-all --output-def $@ $^
-
-%.$(DLL_SUFFIX): %.o
- $(DLLWRAP) --dllname $(notdir $@) --driver-name $(CC) --def $*.def -o $@ $(filter %.o,$^) $(DLL_LDFLAGS) $(DLL_LDLIBS)
-
-lib%.$(DLL_SUFFIX).a:%.def
- $(DLLTOOL) --dllname $(notdir $*.dll) --def $< --output-lib $@
-
-# End
diff --git a/ext/pcre/pcrelib/doc/Tech.Notes b/ext/pcre/pcrelib/doc/Tech.Notes
deleted file mode 100644
index 7b96e5b60e..0000000000
--- a/ext/pcre/pcrelib/doc/Tech.Notes
+++ /dev/null
@@ -1,243 +0,0 @@
-Technical Notes about PCRE
---------------------------
-
-Many years ago I implemented some regular expression functions to an algorithm
-suggested by Martin Richards. These were not Unix-like in form, and were quite
-restricted in what they could do by comparison with Perl. The interesting part
-about the algorithm was that the amount of space required to hold the compiled
-form of an expression was known in advance. The code to apply an expression did
-not operate by backtracking, as the Henry Spencer and Perl code does, but
-instead checked all possibilities simultaneously by keeping a list of current
-states and checking all of them as it advanced through the subject string. (In
-the terminology of Jeffrey Friedl's book, it was a "DFA algorithm".) When the
-pattern was all used up, all remaining states were possible matches, and the
-one matching the longest subset of the subject string was chosen. This did not
-necessarily maximize the individual wild portions of the pattern, as is
-expected in Unix and Perl-style regular expressions.
-
-By contrast, the code originally written by Henry Spencer and subsequently
-heavily modified for Perl actually compiles the expression twice: once in a
-dummy mode in order to find out how much store will be needed, and then for
-real. The execution function operates by backtracking and maximizing (or,
-optionally, minimizing in Perl) the amount of the subject that matches
-individual wild portions of the pattern. This is an "NFA algorithm" in Friedl's
-terminology.
-
-For the set of functions that forms PCRE (which are unrelated to those
-mentioned above), I tried at first to invent an algorithm that used an amount
-of store bounded by a multiple of the number of characters in the pattern, to
-save on compiling time. However, because of the greater complexity in Perl
-regular expressions, I couldn't do this. In any case, a first pass through the
-pattern is needed, in order to find internal flag settings like (?i) at top
-level. So PCRE works by running a very degenerate first pass to calculate a
-maximum store size, and then a second pass to do the real compile - which may
-use a bit less than the predicted amount of store. The idea is that this is
-going to turn out faster because the first pass is degenerate and the second
-pass can just store stuff straight into the vector. It does make the compiling
-functions bigger, of course, but they have got quite big anyway to handle all
-the Perl stuff.
-
-The compiled form of a pattern is a vector of bytes, containing items of
-variable length. The first byte in an item is an opcode, and the length of the
-item is either implicit in the opcode or contained in the data bytes which
-follow it. A list of all the opcodes follows:
-
-Opcodes with no following data
-------------------------------
-
-These items are all just one byte long
-
- OP_END end of pattern
- OP_ANY match any character
- OP_SOD match start of data: \A
- OP_CIRC ^ (start of data, or after \n in multiline)
- OP_NOT_WORD_BOUNDARY \W
- OP_WORD_BOUNDARY \w
- OP_NOT_DIGIT \D
- OP_DIGIT \d
- OP_NOT_WHITESPACE \S
- OP_WHITESPACE \s
- OP_NOT_WORDCHAR \W
- OP_WORDCHAR \w
- OP_EODN match end of data or \n at end: \Z
- OP_EOD match end of data: \z
- OP_DOLL $ (end of data, or before \n in multiline)
- OP_RECURSE match the pattern recursively
-
-
-Repeating single characters
----------------------------
-
-The common repeats (*, +, ?) when applied to a single character appear as
-two-byte items using the following opcodes:
-
- OP_STAR
- OP_MINSTAR
- OP_PLUS
- OP_MINPLUS
- OP_QUERY
- OP_MINQUERY
-
-Those with "MIN" in their name are the minimizing versions. Each is followed by
-the character that is to be repeated. Other repeats make use of
-
- OP_UPTO
- OP_MINUPTO
- OP_EXACT
-
-which are followed by a two-byte count (most significant first) and the
-repeated character. OP_UPTO matches from 0 to the given number. A repeat with a
-non-zero minimum and a fixed maximum is coded as an OP_EXACT followed by an
-OP_UPTO (or OP_MINUPTO).
-
-
-Repeating character types
--------------------------
-
-Repeats of things like \d are done exactly as for single characters, except
-that instead of a character, the opcode for the type is stored in the data
-byte. The opcodes are:
-
- OP_TYPESTAR
- OP_TYPEMINSTAR
- OP_TYPEPLUS
- OP_TYPEMINPLUS
- OP_TYPEQUERY
- OP_TYPEMINQUERY
- OP_TYPEUPTO
- OP_TYPEMINUPTO
- OP_TYPEEXACT
-
-
-Matching a character string
----------------------------
-
-The OP_CHARS opcode is followed by a one-byte count and then that number of
-characters. If there are more than 255 characters in sequence, successive
-instances of OP_CHARS are used.
-
-
-Character classes
------------------
-
-OP_CLASS is used for a character class, provided there are at least two
-characters in the class. If there is only one character, OP_CHARS is used for a
-positive class, and OP_NOT for a negative one (that is, for something like
-[^a]). Another set of repeating opcodes (OP_NOTSTAR etc.) are used for a
-repeated, negated, single-character class. The normal ones (OP_STAR etc.) are
-used for a repeated positive single-character class.
-
-OP_CLASS is followed by a 32-byte bit map containing a 1 bit for every
-character that is acceptable. The bits are counted from the least significant
-end of each byte.
-
-
-Back references
----------------
-
-OP_REF is followed by a single byte containing the reference number.
-
-
-Repeating character classes and back references
------------------------------------------------
-
-Single-character classes are handled specially (see above). This applies to
-OP_CLASS and OP_REF. In both cases, the repeat information follows the base
-item. The matching code looks at the following opcode to see if it is one of
-
- OP_CRSTAR
- OP_CRMINSTAR
- OP_CRPLUS
- OP_CRMINPLUS
- OP_CRQUERY
- OP_CRMINQUERY
- OP_CRRANGE
- OP_CRMINRANGE
-
-All but the last two are just single-byte items. The others are followed by
-four bytes of data, comprising the minimum and maximum repeat counts.
-
-
-Brackets and alternation
-------------------------
-
-A pair of non-capturing (round) brackets is wrapped round each expression at
-compile time, so alternation always happens in the context of brackets.
-Non-capturing brackets use the opcode OP_BRA, while capturing brackets use
-OP_BRA+1, OP_BRA+2, etc. [Note for North Americans: "bracket" to some English
-speakers, including myself, can be round, square, curly, or pointy. Hence this
-usage.]
-
-A bracket opcode is followed by two bytes which give the offset to the next
-alternative OP_ALT or, if there aren't any branches, to the matching KET
-opcode. Each OP_ALT is followed by two bytes giving the offset to the next one,
-or to the KET opcode.
-
-OP_KET is used for subpatterns that do not repeat indefinitely, while
-OP_KETRMIN and OP_KETRMAX are used for indefinite repetitions, minimally or
-maximally respectively. All three are followed by two bytes giving (as a
-positive number) the offset back to the matching BRA opcode.
-
-If a subpattern is quantified such that it is permitted to match zero times, it
-is preceded by one of OP_BRAZERO or OP_BRAMINZERO. These are single-byte
-opcodes which tell the matcher that skipping this subpattern entirely is a
-valid branch.
-
-A subpattern with an indefinite maximum repetition is replicated in the
-compiled data its minimum number of times (or once with a BRAZERO if the
-minimum is zero), with the final copy terminating with a KETRMIN or KETRMAX as
-appropriate.
-
-A subpattern with a bounded maximum repetition is replicated in a nested
-fashion up to the maximum number of times, with BRAZERO or BRAMINZERO before
-each replication after the minimum, so that, for example, (abc){2,5} is
-compiled as (abc)(abc)((abc)((abc)(abc)?)?)?. The 200-bracket limit does not
-apply to these internally generated brackets.
-
-
-Assertions
-----------
-
-Forward assertions are just like other subpatterns, but starting with one of
-the opcodes OP_ASSERT or OP_ASSERT_NOT. Backward assertions use the opcodes
-OP_ASSERTBACK and OP_ASSERTBACK_NOT, and the first opcode inside the assertion
-is OP_REVERSE, followed by a two byte count of the number of characters to move
-back the pointer in the subject string. When operating in UTF-8 mode, the count
-is a character count rather than a byte count. A separate count is present in
-each alternative of a lookbehind assertion, allowing them to have different
-fixed lengths.
-
-
-Once-only subpatterns
----------------------
-
-These are also just like other subpatterns, but they start with the opcode
-OP_ONCE.
-
-
-Conditional subpatterns
------------------------
-
-These are like other subpatterns, but they start with the opcode OP_COND. If
-the condition is a back reference, this is stored at the start of the
-subpattern using the opcode OP_CREF followed by one byte containing the
-reference number. Otherwise, a conditional subpattern will always start with
-one of the assertions.
-
-
-Changing options
-----------------
-
-If any of the /i, /m, or /s options are changed within a parenthesized group,
-an OP_OPT opcode is compiled, followed by one byte containing the new settings
-of these flags. If there are several alternatives in a group, there is an
-occurrence of OP_OPT at the start of all those following the first options
-change, to set appropriate options for the start of the alternative.
-Immediately after the end of the group there is another such item to reset the
-flags to their previous values. Other changes of flag within the pattern can be
-handled entirely at compile time, and so do not cause anything to be put into
-the compiled data.
-
-
-Philip Hazel
-August 2000
diff --git a/ext/pcre/pcrelib/doc/pcre.3 b/ext/pcre/pcrelib/doc/pcre.3
deleted file mode 100644
index fc204453c7..0000000000
--- a/ext/pcre/pcrelib/doc/pcre.3
+++ /dev/null
@@ -1,1810 +0,0 @@
-.TH PCRE 3
-.SH NAME
-pcre - Perl-compatible regular expressions.
-.SH SYNOPSIS
-.B #include <pcre.h>
-.PP
-.SM
-.br
-.B pcre *pcre_compile(const char *\fIpattern\fR, int \fIoptions\fR,
-.ti +5n
-.B const char **\fIerrptr\fR, int *\fIerroffset\fR,
-.ti +5n
-.B const unsigned char *\fItableptr\fR);
-.PP
-.br
-.B pcre_extra *pcre_study(const pcre *\fIcode\fR, int \fIoptions\fR,
-.ti +5n
-.B const char **\fIerrptr\fR);
-.PP
-.br
-.B int pcre_exec(const pcre *\fIcode\fR, "const pcre_extra *\fIextra\fR,"
-.ti +5n
-.B "const char *\fIsubject\fR," int \fIlength\fR, int \fIstartoffset\fR,
-.ti +5n
-.B int \fIoptions\fR, int *\fIovector\fR, int \fIovecsize\fR);
-.PP
-.br
-.B int pcre_copy_substring(const char *\fIsubject\fR, int *\fIovector\fR,
-.ti +5n
-.B int \fIstringcount\fR, int \fIstringnumber\fR, char *\fIbuffer\fR,
-.ti +5n
-.B int \fIbuffersize\fR);
-.PP
-.br
-.B int pcre_get_substring(const char *\fIsubject\fR, int *\fIovector\fR,
-.ti +5n
-.B int \fIstringcount\fR, int \fIstringnumber\fR,
-.ti +5n
-.B const char **\fIstringptr\fR);
-.PP
-.br
-.B int pcre_get_substring_list(const char *\fIsubject\fR,
-.ti +5n
-.B int *\fIovector\fR, int \fIstringcount\fR, "const char ***\fIlistptr\fR);"
-.PP
-.br
-.B void pcre_free_substring(const char *\fIstringptr\fR);
-.PP
-.br
-.B void pcre_free_substring_list(const char **\fIstringptr\fR);
-.PP
-.br
-.B const unsigned char *pcre_maketables(void);
-.PP
-.br
-.B int pcre_fullinfo(const pcre *\fIcode\fR, "const pcre_extra *\fIextra\fR,"
-.ti +5n
-.B int \fIwhat\fR, void *\fIwhere\fR);
-.PP
-.br
-.B int pcre_info(const pcre *\fIcode\fR, int *\fIoptptr\fR, int
-.B *\fIfirstcharptr\fR);
-.PP
-.br
-.B char *pcre_version(void);
-.PP
-.br
-.B void *(*pcre_malloc)(size_t);
-.PP
-.br
-.B void (*pcre_free)(void *);
-
-
-
-.SH DESCRIPTION
-The PCRE library is a set of functions that implement regular expression
-pattern matching using the same syntax and semantics as Perl 5, with just a few
-differences (see below). The current implementation corresponds to Perl 5.005,
-with some additional features from later versions. This includes some
-experimental, incomplete support for UTF-8 encoded strings. Details of exactly
-what is and what is not supported are given below.
-
-PCRE has its own native API, which is described in this document. There is also
-a set of wrapper functions that correspond to the POSIX regular expression API.
-These are described in the \fBpcreposix\fR documentation.
-
-The native API function prototypes are defined in the header file \fBpcre.h\fR,
-and on Unix systems the library itself is called \fBlibpcre.a\fR, so can be
-accessed by adding \fB-lpcre\fR to the command for linking an application which
-calls it. The header file defines the macros PCRE_MAJOR and PCRE_MINOR to
-contain the major and minor release numbers for the library. Applications can
-use these to include support for different releases.
-
-The functions \fBpcre_compile()\fR, \fBpcre_study()\fR, and \fBpcre_exec()\fR
-are used for compiling and matching regular expressions.
-
-The functions \fBpcre_copy_substring()\fR, \fBpcre_get_substring()\fR, and
-\fBpcre_get_substring_list()\fR are convenience functions for extracting
-captured substrings from a matched subject string; \fBpcre_free_substring()\fR
-and \fBpcre_free_substring_list()\fR are also provided, to free the memory used
-for extracted strings.
-
-The function \fBpcre_maketables()\fR is used (optionally) to build a set of
-character tables in the current locale for passing to \fBpcre_compile()\fR.
-
-The function \fBpcre_fullinfo()\fR is used to find out information about a
-compiled pattern; \fBpcre_info()\fR is an obsolete version which returns only
-some of the available information, but is retained for backwards compatibility.
-The function \fBpcre_version()\fR returns a pointer to a string containing the
-version of PCRE and its date of release.
-
-The global variables \fBpcre_malloc\fR and \fBpcre_free\fR initially contain
-the entry points of the standard \fBmalloc()\fR and \fBfree()\fR functions
-respectively. PCRE calls the memory management functions via these variables,
-so a calling program can replace them if it wishes to intercept the calls. This
-should be done before calling any PCRE functions.
-
-
-.SH MULTI-THREADING
-The PCRE functions can be used in multi-threading applications, with the
-proviso that the memory management functions pointed to by \fBpcre_malloc\fR
-and \fBpcre_free\fR are shared by all threads.
-
-The compiled form of a regular expression is not altered during matching, so
-the same compiled pattern can safely be used by several threads at once.
-
-
-.SH COMPILING A PATTERN
-The function \fBpcre_compile()\fR is called to compile a pattern into an
-internal form. The pattern is a C string terminated by a binary zero, and
-is passed in the argument \fIpattern\fR. A pointer to a single block of memory
-that is obtained via \fBpcre_malloc\fR is returned. This contains the
-compiled code and related data. The \fBpcre\fR type is defined for this for
-convenience, but in fact \fBpcre\fR is just a typedef for \fBvoid\fR, since the
-contents of the block are not externally defined. It is up to the caller to
-free the memory when it is no longer required.
-.PP
-The size of a compiled pattern is roughly proportional to the length of the
-pattern string, except that each character class (other than those containing
-just a single character, negated or not) requires 33 bytes, and repeat
-quantifiers with a minimum greater than one or a bounded maximum cause the
-relevant portions of the compiled pattern to be replicated.
-.PP
-The \fIoptions\fR argument contains independent bits that affect the
-compilation. It should be zero if no options are required. Some of the options,
-in particular, those that are compatible with Perl, can also be set and unset
-from within the pattern (see the detailed description of regular expressions
-below). For these options, the contents of the \fIoptions\fR argument specifies
-their initial settings at the start of compilation and execution. The
-PCRE_ANCHORED option can be set at the time of matching as well as at compile
-time.
-.PP
-If \fIerrptr\fR is NULL, \fBpcre_compile()\fR returns NULL immediately.
-Otherwise, if compilation of a pattern fails, \fBpcre_compile()\fR returns
-NULL, and sets the variable pointed to by \fIerrptr\fR to point to a textual
-error message. The offset from the start of the pattern to the character where
-the error was discovered is placed in the variable pointed to by
-\fIerroffset\fR, which must not be NULL. If it is, an immediate error is given.
-.PP
-If the final argument, \fItableptr\fR, is NULL, PCRE uses a default set of
-character tables which are built when it is compiled, using the default C
-locale. Otherwise, \fItableptr\fR must be the result of a call to
-\fBpcre_maketables()\fR. See the section on locale support below.
-.PP
-The following option bits are defined in the header file:
-
- PCRE_ANCHORED
-
-If this bit is set, the pattern is forced to be "anchored", that is, it is
-constrained to match only at the start of the string which is being searched
-(the "subject string"). This effect can also be achieved by appropriate
-constructs in the pattern itself, which is the only way to do it in Perl.
-
- PCRE_CASELESS
-
-If this bit is set, letters in the pattern match both upper and lower case
-letters. It is equivalent to Perl's /i option.
-
- PCRE_DOLLAR_ENDONLY
-
-If this bit is set, a dollar metacharacter in the pattern matches only at the
-end of the subject string. Without this option, a dollar also matches
-immediately before the final character if it is a newline (but not before any
-other newlines). The PCRE_DOLLAR_ENDONLY option is ignored if PCRE_MULTILINE is
-set. There is no equivalent to this option in Perl.
-
- PCRE_DOTALL
-
-If this bit is set, a dot metacharater in the pattern matches all characters,
-including newlines. Without it, newlines are excluded. This option is
-equivalent to Perl's /s option. A negative class such as [^a] always matches a
-newline character, independent of the setting of this option.
-
- PCRE_EXTENDED
-
-If this bit is set, whitespace data characters in the pattern are totally
-ignored except when escaped or inside a character class, and characters between
-an unescaped # outside a character class and the next newline character,
-inclusive, are also ignored. This is equivalent to Perl's /x option, and makes
-it possible to include comments inside complicated patterns. Note, however,
-that this applies only to data characters. Whitespace characters may never
-appear within special character sequences in a pattern, for example within the
-sequence (?( which introduces a conditional subpattern.
-
- PCRE_EXTRA
-
-This option was invented in order to turn on additional functionality of PCRE
-that is incompatible with Perl, but it is currently of very little use. When
-set, any backslash in a pattern that is followed by a letter that has no
-special meaning causes an error, thus reserving these combinations for future
-expansion. By default, as in Perl, a backslash followed by a letter with no
-special meaning is treated as a literal. There are at present no other features
-controlled by this option. It can also be set by a (?X) option setting within a
-pattern.
-
- PCRE_MULTILINE
-
-By default, PCRE treats the subject string as consisting of a single "line" of
-characters (even if it actually contains several newlines). The "start of line"
-metacharacter (^) matches only at the start of the string, while the "end of
-line" metacharacter ($) matches only at the end of the string, or before a
-terminating newline (unless PCRE_DOLLAR_ENDONLY is set). This is the same as
-Perl.
-
-When PCRE_MULTILINE it is set, the "start of line" and "end of line" constructs
-match immediately following or immediately before any newline in the subject
-string, respectively, as well as at the very start and end. This is equivalent
-to Perl's /m option. If there are no "\\n" characters in a subject string, or
-no occurrences of ^ or $ in a pattern, setting PCRE_MULTILINE has no
-effect.
-
- PCRE_UNGREEDY
-
-This option inverts the "greediness" of the quantifiers so that they are not
-greedy by default, but become greedy if followed by "?". It is not compatible
-with Perl. It can also be set by a (?U) option setting within the pattern.
-
- PCRE_UTF8
-
-This option causes PCRE to regard both the pattern and the subject as strings
-of UTF-8 characters instead of just byte strings. However, it is available only
-if PCRE has been built to include UTF-8 support. If not, the use of this option
-provokes an error. Support for UTF-8 is new, experimental, and incomplete.
-Details of exactly what it entails are given below.
-
-
-.SH STUDYING A PATTERN
-When a pattern is going to be used several times, it is worth spending more
-time analyzing it in order to speed up the time taken for matching. The
-function \fBpcre_study()\fR takes a pointer to a compiled pattern as its first
-argument, and returns a pointer to a \fBpcre_extra\fR block (another \fBvoid\fR
-typedef) containing additional information about the pattern; this can be
-passed to \fBpcre_exec()\fR. If no additional information is available, NULL
-is returned.
-
-The second argument contains option bits. At present, no options are defined
-for \fBpcre_study()\fR, and this argument should always be zero.
-
-The third argument for \fBpcre_study()\fR is a pointer to an error message. If
-studying succeeds (even if no data is returned), the variable it points to is
-set to NULL. Otherwise it points to a textual error message.
-
-At present, studying a pattern is useful only for non-anchored patterns that do
-not have a single fixed starting character. A bitmap of possible starting
-characters is created.
-
-
-.SH LOCALE SUPPORT
-PCRE handles caseless matching, and determines whether characters are letters,
-digits, or whatever, by reference to a set of tables. The library contains a
-default set of tables which is created in the default C locale when PCRE is
-compiled. This is used when the final argument of \fBpcre_compile()\fR is NULL,
-and is sufficient for many applications.
-
-An alternative set of tables can, however, be supplied. Such tables are built
-by calling the \fBpcre_maketables()\fR function, which has no arguments, in the
-relevant locale. The result can then be passed to \fBpcre_compile()\fR as often
-as necessary. For example, to build and use tables that are appropriate for the
-French locale (where accented characters with codes greater than 128 are
-treated as letters), the following code could be used:
-
- setlocale(LC_CTYPE, "fr");
- tables = pcre_maketables();
- re = pcre_compile(..., tables);
-
-The tables are built in memory that is obtained via \fBpcre_malloc\fR. The
-pointer that is passed to \fBpcre_compile\fR is saved with the compiled
-pattern, and the same tables are used via this pointer by \fBpcre_study()\fR
-and \fBpcre_exec()\fR. Thus for any single pattern, compilation, studying and
-matching all happen in the same locale, but different patterns can be compiled
-in different locales. It is the caller's responsibility to ensure that the
-memory containing the tables remains available for as long as it is needed.
-
-
-.SH INFORMATION ABOUT A PATTERN
-The \fBpcre_fullinfo()\fR function returns information about a compiled
-pattern. It replaces the obsolete \fBpcre_info()\fR function, which is
-nevertheless retained for backwards compability (and is documented below).
-
-The first argument for \fBpcre_fullinfo()\fR is a pointer to the compiled
-pattern. The second argument is the result of \fBpcre_study()\fR, or NULL if
-the pattern was not studied. The third argument specifies which piece of
-information is required, while the fourth argument is a pointer to a variable
-to receive the data. The yield of the function is zero for success, or one of
-the following negative numbers:
-
- PCRE_ERROR_NULL the argument \fIcode\fR was NULL
- the argument \fIwhere\fR was NULL
- PCRE_ERROR_BADMAGIC the "magic number" was not found
- PCRE_ERROR_BADOPTION the value of \fIwhat\fR was invalid
-
-The possible values for the third argument are defined in \fBpcre.h\fR, and are
-as follows:
-
- PCRE_INFO_OPTIONS
-
-Return a copy of the options with which the pattern was compiled. The fourth
-argument should point to au \fBunsigned long int\fR variable. These option bits
-are those specified in the call to \fBpcre_compile()\fR, modified by any
-top-level option settings within the pattern itself, and with the PCRE_ANCHORED
-bit forcibly set if the form of the pattern implies that it can match only at
-the start of a subject string.
-
- PCRE_INFO_SIZE
-
-Return the size of the compiled pattern, that is, the value that was passed as
-the argument to \fBpcre_malloc()\fR when PCRE was getting memory in which to
-place the compiled data. The fourth argument should point to a \fBsize_t\fR
-variable.
-
- PCRE_INFO_CAPTURECOUNT
-
-Return the number of capturing subpatterns in the pattern. The fourth argument
-should point to an \fbint\fR variable.
-
- PCRE_INFO_BACKREFMAX
-
-Return the number of the highest back reference in the pattern. The fourth
-argument should point to an \fBint\fR variable. Zero is returned if there are
-no back references.
-
- PCRE_INFO_FIRSTCHAR
-
-Return information about the first character of any matched string, for a
-non-anchored pattern. If there is a fixed first character, e.g. from a pattern
-such as (cat|cow|coyote), it is returned in the integer pointed to by
-\fIwhere\fR. Otherwise, if either
-
-(a) the pattern was compiled with the PCRE_MULTILINE option, and every branch
-starts with "^", or
-
-(b) every branch of the pattern starts with ".*" and PCRE_DOTALL is not set
-(if it were set, the pattern would be anchored),
-
--1 is returned, indicating that the pattern matches only at the start of a
-subject string or after any "\\n" within the string. Otherwise -2 is returned.
-For anchored patterns, -2 is returned.
-
- PCRE_INFO_FIRSTTABLE
-
-If the pattern was studied, and this resulted in the construction of a 256-bit
-table indicating a fixed set of characters for the first character in any
-matching string, a pointer to the table is returned. Otherwise NULL is
-returned. The fourth argument should point to an \fBunsigned char *\fR
-variable.
-
- PCRE_INFO_LASTLITERAL
-
-For a non-anchored pattern, return the value of the rightmost literal character
-which must exist in any matched string, other than at its start. The fourth
-argument should point to an \fBint\fR variable. If there is no such character,
-or if the pattern is anchored, -1 is returned. For example, for the pattern
-/a\\d+z\\d+/ the returned value is 'z'.
-
-The \fBpcre_info()\fR function is now obsolete because its interface is too
-restrictive to return all the available data about a compiled pattern. New
-programs should use \fBpcre_fullinfo()\fR instead. The yield of
-\fBpcre_info()\fR is the number of capturing subpatterns, or one of the
-following negative numbers:
-
- PCRE_ERROR_NULL the argument \fIcode\fR was NULL
- PCRE_ERROR_BADMAGIC the "magic number" was not found
-
-If the \fIoptptr\fR argument is not NULL, a copy of the options with which the
-pattern was compiled is placed in the integer it points to (see
-PCRE_INFO_OPTIONS above).
-
-If the pattern is not anchored and the \fIfirstcharptr\fR argument is not NULL,
-it is used to pass back information about the first character of any matched
-string (see PCRE_INFO_FIRSTCHAR above).
-
-
-.SH MATCHING A PATTERN
-The function \fBpcre_exec()\fR is called to match a subject string against a
-pre-compiled pattern, which is passed in the \fIcode\fR argument. If the
-pattern has been studied, the result of the study should be passed in the
-\fIextra\fR argument. Otherwise this must be NULL.
-
-The PCRE_ANCHORED option can be passed in the \fIoptions\fR argument, whose
-unused bits must be zero. However, if a pattern was compiled with
-PCRE_ANCHORED, or turned out to be anchored by virtue of its contents, it
-cannot be made unachored at matching time.
-
-There are also three further options that can be set only at matching time:
-
- PCRE_NOTBOL
-
-The first character of the string is not the beginning of a line, so the
-circumflex metacharacter should not match before it. Setting this without
-PCRE_MULTILINE (at compile time) causes circumflex never to match.
-
- PCRE_NOTEOL
-
-The end of the string is not the end of a line, so the dollar metacharacter
-should not match it nor (except in multiline mode) a newline immediately before
-it. Setting this without PCRE_MULTILINE (at compile time) causes dollar never
-to match.
-
- PCRE_NOTEMPTY
-
-An empty string is not considered to be a valid match if this option is set. If
-there are alternatives in the pattern, they are tried. If all the alternatives
-match the empty string, the entire match fails. For example, if the pattern
-
- a?b?
-
-is applied to a string not beginning with "a" or "b", it matches the empty
-string at the start of the subject. With PCRE_NOTEMPTY set, this match is not
-valid, so PCRE searches further into the string for occurrences of "a" or "b".
-
-Perl has no direct equivalent of PCRE_NOTEMPTY, but it does make a special case
-of a pattern match of the empty string within its \fBsplit()\fR function, and
-when using the /g modifier. It is possible to emulate Perl's behaviour after
-matching a null string by first trying the match again at the same offset with
-PCRE_NOTEMPTY set, and then if that fails by advancing the starting offset (see
-below) and trying an ordinary match again.
-
-The subject string is passed as a pointer in \fIsubject\fR, a length in
-\fIlength\fR, and a starting offset in \fIstartoffset\fR. Unlike the pattern
-string, it may contain binary zero characters. When the starting offset is
-zero, the search for a match starts at the beginning of the subject, and this
-is by far the most common case.
-
-A non-zero starting offset is useful when searching for another match in the
-same subject by calling \fBpcre_exec()\fR again after a previous success.
-Setting \fIstartoffset\fR differs from just passing over a shortened string and
-setting PCRE_NOTBOL in the case of a pattern that begins with any kind of
-lookbehind. For example, consider the pattern
-
- \\Biss\\B
-
-which finds occurrences of "iss" in the middle of words. (\\B matches only if
-the current position in the subject is not a word boundary.) When applied to
-the string "Mississipi" the first call to \fBpcre_exec()\fR finds the first
-occurrence. If \fBpcre_exec()\fR is called again with just the remainder of the
-subject, namely "issipi", it does not match, because \\B is always false at the
-start of the subject, which is deemed to be a word boundary. However, if
-\fBpcre_exec()\fR is passed the entire string again, but with \fIstartoffset\fR
-set to 4, it finds the second occurrence of "iss" because it is able to look
-behind the starting point to discover that it is preceded by a letter.
-
-If a non-zero starting offset is passed when the pattern is anchored, one
-attempt to match at the given offset is tried. This can only succeed if the
-pattern does not require the match to be at the start of the subject.
-
-In general, a pattern matches a certain portion of the subject, and in
-addition, further substrings from the subject may be picked out by parts of the
-pattern. Following the usage in Jeffrey Friedl's book, this is called
-"capturing" in what follows, and the phrase "capturing subpattern" is used for
-a fragment of a pattern that picks out a substring. PCRE supports several other
-kinds of parenthesized subpattern that do not cause substrings to be captured.
-
-Captured substrings are returned to the caller via a vector of integer offsets
-whose address is passed in \fIovector\fR. The number of elements in the vector
-is passed in \fIovecsize\fR. The first two-thirds of the vector is used to pass
-back captured substrings, each substring using a pair of integers. The
-remaining third of the vector is used as workspace by \fBpcre_exec()\fR while
-matching capturing subpatterns, and is not available for passing back
-information. The length passed in \fIovecsize\fR should always be a multiple of
-three. If it is not, it is rounded down.
-
-When a match has been successful, information about captured substrings is
-returned in pairs of integers, starting at the beginning of \fIovector\fR, and
-continuing up to two-thirds of its length at the most. The first element of a
-pair is set to the offset of the first character in a substring, and the second
-is set to the offset of the first character after the end of a substring. The
-first pair, \fIovector[0]\fR and \fIovector[1]\fR, identify the portion of the
-subject string matched by the entire pattern. The next pair is used for the
-first capturing subpattern, and so on. The value returned by \fBpcre_exec()\fR
-is the number of pairs that have been set. If there are no capturing
-subpatterns, the return value from a successful match is 1, indicating that
-just the first pair of offsets has been set.
-
-Some convenience functions are provided for extracting the captured substrings
-as separate strings. These are described in the following section.
-
-It is possible for an capturing subpattern number \fIn+1\fR to match some
-part of the subject when subpattern \fIn\fR has not been used at all. For
-example, if the string "abc" is matched against the pattern (a|(z))(bc)
-subpatterns 1 and 3 are matched, but 2 is not. When this happens, both offset
-values corresponding to the unused subpattern are set to -1.
-
-If a capturing subpattern is matched repeatedly, it is the last portion of the
-string that it matched that gets returned.
-
-If the vector is too small to hold all the captured substrings, it is used as
-far as possible (up to two-thirds of its length), and the function returns a
-value of zero. In particular, if the substring offsets are not of interest,
-\fBpcre_exec()\fR may be called with \fIovector\fR passed as NULL and
-\fIovecsize\fR as zero. However, if the pattern contains back references and
-the \fIovector\fR isn't big enough to remember the related substrings, PCRE has
-to get additional memory for use during matching. Thus it is usually advisable
-to supply an \fIovector\fR.
-
-Note that \fBpcre_info()\fR can be used to find out how many capturing
-subpatterns there are in a compiled pattern. The smallest size for
-\fIovector\fR that will allow for \fIn\fR captured substrings in addition to
-the offsets of the substring matched by the whole pattern is (\fIn\fR+1)*3.
-
-If \fBpcre_exec()\fR fails, it returns a negative number. The following are
-defined in the header file:
-
- PCRE_ERROR_NOMATCH (-1)
-
-The subject string did not match the pattern.
-
- PCRE_ERROR_NULL (-2)
-
-Either \fIcode\fR or \fIsubject\fR was passed as NULL, or \fIovector\fR was
-NULL and \fIovecsize\fR was not zero.
-
- PCRE_ERROR_BADOPTION (-3)
-
-An unrecognized bit was set in the \fIoptions\fR argument.
-
- PCRE_ERROR_BADMAGIC (-4)
-
-PCRE stores a 4-byte "magic number" at the start of the compiled code, to catch
-the case when it is passed a junk pointer. This is the error it gives when the
-magic number isn't present.
-
- PCRE_ERROR_UNKNOWN_NODE (-5)
-
-While running the pattern match, an unknown item was encountered in the
-compiled pattern. This error could be caused by a bug in PCRE or by overwriting
-of the compiled pattern.
-
- PCRE_ERROR_NOMEMORY (-6)
-
-If a pattern contains back references, but the \fIovector\fR that is passed to
-\fBpcre_exec()\fR is not big enough to remember the referenced substrings, PCRE
-gets a block of memory at the start of matching to use for this purpose. If the
-call via \fBpcre_malloc()\fR fails, this error is given. The memory is freed at
-the end of matching.
-
-
-.SH EXTRACTING CAPTURED SUBSTRINGS
-Captured substrings can be accessed directly by using the offsets returned by
-\fBpcre_exec()\fR in \fIovector\fR. For convenience, the functions
-\fBpcre_copy_substring()\fR, \fBpcre_get_substring()\fR, and
-\fBpcre_get_substring_list()\fR are provided for extracting captured substrings
-as new, separate, zero-terminated strings. A substring that contains a binary
-zero is correctly extracted and has a further zero added on the end, but the
-result does not, of course, function as a C string.
-
-The first three arguments are the same for all three functions: \fIsubject\fR
-is the subject string which has just been successfully matched, \fIovector\fR
-is a pointer to the vector of integer offsets that was passed to
-\fBpcre_exec()\fR, and \fIstringcount\fR is the number of substrings that
-were captured by the match, including the substring that matched the entire
-regular expression. This is the value returned by \fBpcre_exec\fR if it
-is greater than zero. If \fBpcre_exec()\fR returned zero, indicating that it
-ran out of space in \fIovector\fR, the value passed as \fIstringcount\fR should
-be the size of the vector divided by three.
-
-The functions \fBpcre_copy_substring()\fR and \fBpcre_get_substring()\fR
-extract a single substring, whose number is given as \fIstringnumber\fR. A
-value of zero extracts the substring that matched the entire pattern, while
-higher values extract the captured substrings. For \fBpcre_copy_substring()\fR,
-the string is placed in \fIbuffer\fR, whose length is given by
-\fIbuffersize\fR, while for \fBpcre_get_substring()\fR a new block of memory is
-obtained via \fBpcre_malloc\fR, and its address is returned via
-\fIstringptr\fR. The yield of the function is the length of the string, not
-including the terminating zero, or one of
-
- PCRE_ERROR_NOMEMORY (-6)
-
-The buffer was too small for \fBpcre_copy_substring()\fR, or the attempt to get
-memory failed for \fBpcre_get_substring()\fR.
-
- PCRE_ERROR_NOSUBSTRING (-7)
-
-There is no substring whose number is \fIstringnumber\fR.
-
-The \fBpcre_get_substring_list()\fR function extracts all available substrings
-and builds a list of pointers to them. All this is done in a single block of
-memory which is obtained via \fBpcre_malloc\fR. The address of the memory block
-is returned via \fIlistptr\fR, which is also the start of the list of string
-pointers. The end of the list is marked by a NULL pointer. The yield of the
-function is zero if all went well, or
-
- PCRE_ERROR_NOMEMORY (-6)
-
-if the attempt to get the memory block failed.
-
-When any of these functions encounter a substring that is unset, which can
-happen when capturing subpattern number \fIn+1\fR matches some part of the
-subject, but subpattern \fIn\fR has not been used at all, they return an empty
-string. This can be distinguished from a genuine zero-length substring by
-inspecting the appropriate offset in \fIovector\fR, which is negative for unset
-substrings.
-
-The two convenience functions \fBpcre_free_substring()\fR and
-\fBpcre_free_substring_list()\fR can be used to free the memory returned by
-a previous call of \fBpcre_get_substring()\fR or
-\fBpcre_get_substring_list()\fR, respectively. They do nothing more than call
-the function pointed to by \fBpcre_free\fR, which of course could be called
-directly from a C program. However, PCRE is used in some situations where it is
-linked via a special interface to another programming language which cannot use
-\fBpcre_free\fR directly; it is for these cases that the functions are
-provided.
-
-
-.SH LIMITATIONS
-There are some size limitations in PCRE but it is hoped that they will never in
-practice be relevant.
-The maximum length of a compiled pattern is 65539 (sic) bytes.
-All values in repeating quantifiers must be less than 65536.
-The maximum number of capturing subpatterns is 99.
-The maximum number of all parenthesized subpatterns, including capturing
-subpatterns, assertions, and other types of subpattern, is 200.
-
-The maximum length of a subject string is the largest positive number that an
-integer variable can hold. However, PCRE uses recursion to handle subpatterns
-and indefinite repetition. This means that the available stack space may limit
-the size of a subject string that can be processed by certain patterns.
-
-
-.SH DIFFERENCES FROM PERL
-The differences described here are with respect to Perl 5.005.
-
-1. By default, a whitespace character is any character that the C library
-function \fBisspace()\fR recognizes, though it is possible to compile PCRE with
-alternative character type tables. Normally \fBisspace()\fR matches space,
-formfeed, newline, carriage return, horizontal tab, and vertical tab. Perl 5
-no longer includes vertical tab in its set of whitespace characters. The \\v
-escape that was in the Perl documentation for a long time was never in fact
-recognized. However, the character itself was treated as whitespace at least
-up to 5.002. In 5.004 and 5.005 it does not match \\s.
-
-2. PCRE does not allow repeat quantifiers on lookahead assertions. Perl permits
-them, but they do not mean what you might think. For example, (?!a){3} does
-not assert that the next three characters are not "a". It just asserts that the
-next character is not "a" three times.
-
-3. Capturing subpatterns that occur inside negative lookahead assertions are
-counted, but their entries in the offsets vector are never set. Perl sets its
-numerical variables from any such patterns that are matched before the
-assertion fails to match something (thereby succeeding), but only if the
-negative lookahead assertion contains just one branch.
-
-4. Though binary zero characters are supported in the subject string, they are
-not allowed in a pattern string because it is passed as a normal C string,
-terminated by zero. The escape sequence "\\0" can be used in the pattern to
-represent a binary zero.
-
-5. The following Perl escape sequences are not supported: \\l, \\u, \\L, \\U,
-\\E, \\Q. In fact these are implemented by Perl's general string-handling and
-are not part of its pattern matching engine.
-
-6. The Perl \\G assertion is not supported as it is not relevant to single
-pattern matches.
-
-7. Fairly obviously, PCRE does not support the (?{code}) and (?p{code})
-constructions. However, there is some experimental support for recursive
-patterns using the non-Perl item (?R).
-
-8. There are at the time of writing some oddities in Perl 5.005_02 concerned
-with the settings of captured strings when part of a pattern is repeated. For
-example, matching "aba" against the pattern /^(a(b)?)+$/ sets $2 to the value
-"b", but matching "aabbaa" against /^(aa(bb)?)+$/ leaves $2 unset. However, if
-the pattern is changed to /^(aa(b(b))?)+$/ then $2 (and $3) are set.
-
-In Perl 5.004 $2 is set in both cases, and that is also true of PCRE. If in the
-future Perl changes to a consistent state that is different, PCRE may change to
-follow.
-
-9. Another as yet unresolved discrepancy is that in Perl 5.005_02 the pattern
-/^(a)?(?(1)a|b)+$/ matches the string "a", whereas in PCRE it does not.
-However, in both Perl and PCRE /^(a)?a/ matched against "a" leaves $1 unset.
-
-10. PCRE provides some extensions to the Perl regular expression facilities:
-
-(a) Although lookbehind assertions must match fixed length strings, each
-alternative branch of a lookbehind assertion can match a different length of
-string. Perl 5.005 requires them all to have the same length.
-
-(b) If PCRE_DOLLAR_ENDONLY is set and PCRE_MULTILINE is not set, the $ meta-
-character matches only at the very end of the string.
-
-(c) If PCRE_EXTRA is set, a backslash followed by a letter with no special
-meaning is faulted.
-
-(d) If PCRE_UNGREEDY is set, the greediness of the repetition quantifiers is
-inverted, that is, by default they are not greedy, but if followed by a
-question mark they are.
-
-(e) PCRE_ANCHORED can be used to force a pattern to be tried only at the start
-of the subject.
-
-(f) The PCRE_NOTBOL, PCRE_NOTEOL, and PCRE_NOTEMPTY options for
-\fBpcre_exec()\fR have no Perl equivalents.
-
-(g) The (?R) construct allows for recursive pattern matching (Perl 5.6 can do
-this using the (?p{code}) construct, which PCRE cannot of course support.)
-
-
-.SH REGULAR EXPRESSION DETAILS
-The syntax and semantics of the regular expressions supported by PCRE are
-described below. Regular expressions are also described in the Perl
-documentation and in a number of other books, some of which have copious
-examples. Jeffrey Friedl's "Mastering Regular Expressions", published by
-O'Reilly (ISBN 1-56592-257), covers them in great detail.
-
-The description here is intended as reference documentation. The basic
-operation of PCRE is on strings of bytes. However, there is the beginnings of
-some support for UTF-8 character strings. To use this support you must
-configure PCRE to include it, and then call \fBpcre_compile()\fR with the
-PCRE_UTF8 option. How this affects the pattern matching is described in the
-final section of this document.
-
-A regular expression is a pattern that is matched against a subject string from
-left to right. Most characters stand for themselves in a pattern, and match the
-corresponding characters in the subject. As a trivial example, the pattern
-
- The quick brown fox
-
-matches a portion of a subject string that is identical to itself. The power of
-regular expressions comes from the ability to include alternatives and
-repetitions in the pattern. These are encoded in the pattern by the use of
-\fImeta-characters\fR, which do not stand for themselves but instead are
-interpreted in some special way.
-
-There are two different sets of meta-characters: those that are recognized
-anywhere in the pattern except within square brackets, and those that are
-recognized in square brackets. Outside square brackets, the meta-characters are
-as follows:
-
- \\ general escape character with several uses
- ^ assert start of subject (or line, in multiline mode)
- $ assert end of subject (or line, in multiline mode)
- . match any character except newline (by default)
- [ start character class definition
- | start of alternative branch
- ( start subpattern
- ) end subpattern
- ? extends the meaning of (
- also 0 or 1 quantifier
- also quantifier minimizer
- * 0 or more quantifier
- + 1 or more quantifier
- { start min/max quantifier
-
-Part of a pattern that is in square brackets is called a "character class". In
-a character class the only meta-characters are:
-
- \\ general escape character
- ^ negate the class, but only if the first character
- - indicates character range
- ] terminates the character class
-
-The following sections describe the use of each of the meta-characters.
-
-
-.SH BACKSLASH
-The backslash character has several uses. Firstly, if it is followed by a
-non-alphameric character, it takes away any special meaning that character may
-have. This use of backslash as an escape character applies both inside and
-outside character classes.
-
-For example, if you want to match a "*" character, you write "\\*" in the
-pattern. This applies whether or not the following character would otherwise be
-interpreted as a meta-character, so it is always safe to precede a
-non-alphameric with "\\" to specify that it stands for itself. In particular,
-if you want to match a backslash, you write "\\\\".
-
-If a pattern is compiled with the PCRE_EXTENDED option, whitespace in the
-pattern (other than in a character class) and characters between a "#" outside
-a character class and the next newline character are ignored. An escaping
-backslash can be used to include a whitespace or "#" character as part of the
-pattern.
-
-A second use of backslash provides a way of encoding non-printing characters
-in patterns in a visible manner. There is no restriction on the appearance of
-non-printing characters, apart from the binary zero that terminates a pattern,
-but when a pattern is being prepared by text editing, it is usually easier to
-use one of the following escape sequences than the binary character it
-represents:
-
- \\a alarm, that is, the BEL character (hex 07)
- \\cx "control-x", where x is any character
- \\e escape (hex 1B)
- \\f formfeed (hex 0C)
- \\n newline (hex 0A)
- \\r carriage return (hex 0D)
- \\t tab (hex 09)
- \\xhh character with hex code hh
- \\ddd character with octal code ddd, or backreference
-
-The precise effect of "\\cx" is as follows: if "x" is a lower case letter, it
-is converted to upper case. Then bit 6 of the character (hex 40) is inverted.
-Thus "\\cz" becomes hex 1A, but "\\c{" becomes hex 3B, while "\\c;" becomes hex
-7B.
-
-After "\\x", up to two hexadecimal digits are read (letters can be in upper or
-lower case).
-
-After "\\0" up to two further octal digits are read. In both cases, if there
-are fewer than two digits, just those that are present are used. Thus the
-sequence "\\0\\x\\07" specifies two binary zeros followed by a BEL character.
-Make sure you supply two digits after the initial zero if the character that
-follows is itself an octal digit.
-
-The handling of a backslash followed by a digit other than 0 is complicated.
-Outside a character class, PCRE reads it and any following digits as a decimal
-number. If the number is less than 10, or if there have been at least that many
-previous capturing left parentheses in the expression, the entire sequence is
-taken as a \fIback reference\fR. A description of how this works is given
-later, following the discussion of parenthesized subpatterns.
-
-Inside a character class, or if the decimal number is greater than 9 and there
-have not been that many capturing subpatterns, PCRE re-reads up to three octal
-digits following the backslash, and generates a single byte from the least
-significant 8 bits of the value. Any subsequent digits stand for themselves.
-For example:
-
- \\040 is another way of writing a space
- \\40 is the same, provided there are fewer than 40
- previous capturing subpatterns
- \\7 is always a back reference
- \\11 might be a back reference, or another way of
- writing a tab
- \\011 is always a tab
- \\0113 is a tab followed by the character "3"
- \\113 is the character with octal code 113 (since there
- can be no more than 99 back references)
- \\377 is a byte consisting entirely of 1 bits
- \\81 is either a back reference, or a binary zero
- followed by the two characters "8" and "1"
-
-Note that octal values of 100 or greater must not be introduced by a leading
-zero, because no more than three octal digits are ever read.
-
-All the sequences that define a single byte value can be used both inside and
-outside character classes. In addition, inside a character class, the sequence
-"\\b" is interpreted as the backspace character (hex 08). Outside a character
-class it has a different meaning (see below).
-
-The third use of backslash is for specifying generic character types:
-
- \\d any decimal digit
- \\D any character that is not a decimal digit
- \\s any whitespace character
- \\S any character that is not a whitespace character
- \\w any "word" character
- \\W any "non-word" character
-
-Each pair of escape sequences partitions the complete set of characters into
-two disjoint sets. Any given character matches one, and only one, of each pair.
-
-A "word" character is any letter or digit or the underscore character, that is,
-any character which can be part of a Perl "word". The definition of letters and
-digits is controlled by PCRE's character tables, and may vary if locale-
-specific matching is taking place (see "Locale support" above). For example, in
-the "fr" (French) locale, some character codes greater than 128 are used for
-accented letters, and these are matched by \\w.
-
-These character type sequences can appear both inside and outside character
-classes. They each match one character of the appropriate type. If the current
-matching point is at the end of the subject string, all of them fail, since
-there is no character to match.
-
-The fourth use of backslash is for certain simple assertions. An assertion
-specifies a condition that has to be met at a particular point in a match,
-without consuming any characters from the subject string. The use of
-subpatterns for more complicated assertions is described below. The backslashed
-assertions are
-
- \\b word boundary
- \\B not a word boundary
- \\A start of subject (independent of multiline mode)
- \\Z end of subject or newline at end (independent of multiline mode)
- \\z end of subject (independent of multiline mode)
-
-These assertions may not appear in character classes (but note that "\\b" has a
-different meaning, namely the backspace character, inside a character class).
-
-A word boundary is a position in the subject string where the current character
-and the previous character do not both match \\w or \\W (i.e. one matches
-\\w and the other matches \\W), or the start or end of the string if the
-first or last character matches \\w, respectively.
-
-The \\A, \\Z, and \\z assertions differ from the traditional circumflex and
-dollar (described below) in that they only ever match at the very start and end
-of the subject string, whatever options are set. They are not affected by the
-PCRE_NOTBOL or PCRE_NOTEOL options. If the \fIstartoffset\fR argument of
-\fBpcre_exec()\fR is non-zero, \\A can never match. The difference between \\Z
-and \\z is that \\Z matches before a newline that is the last character of the
-string as well as at the end of the string, whereas \\z matches only at the
-end.
-
-
-.SH CIRCUMFLEX AND DOLLAR
-Outside a character class, in the default matching mode, the circumflex
-character is an assertion which is true only if the current matching point is
-at the start of the subject string. If the \fIstartoffset\fR argument of
-\fBpcre_exec()\fR is non-zero, circumflex can never match. Inside a character
-class, circumflex has an entirely different meaning (see below).
-
-Circumflex need not be the first character of the pattern if a number of
-alternatives are involved, but it should be the first thing in each alternative
-in which it appears if the pattern is ever to match that branch. If all
-possible alternatives start with a circumflex, that is, if the pattern is
-constrained to match only at the start of the subject, it is said to be an
-"anchored" pattern. (There are also other constructs that can cause a pattern
-to be anchored.)
-
-A dollar character is an assertion which is true only if the current matching
-point is at the end of the subject string, or immediately before a newline
-character that is the last character in the string (by default). Dollar need
-not be the last character of the pattern if a number of alternatives are
-involved, but it should be the last item in any branch in which it appears.
-Dollar has no special meaning in a character class.
-
-The meaning of dollar can be changed so that it matches only at the very end of
-the string, by setting the PCRE_DOLLAR_ENDONLY option at compile or matching
-time. This does not affect the \\Z assertion.
-
-The meanings of the circumflex and dollar characters are changed if the
-PCRE_MULTILINE option is set. When this is the case, they match immediately
-after and immediately before an internal "\\n" character, respectively, in
-addition to matching at the start and end of the subject string. For example,
-the pattern /^abc$/ matches the subject string "def\\nabc" in multiline mode,
-but not otherwise. Consequently, patterns that are anchored in single line mode
-because all branches start with "^" are not anchored in multiline mode, and a
-match for circumflex is possible when the \fIstartoffset\fR argument of
-\fBpcre_exec()\fR is non-zero. The PCRE_DOLLAR_ENDONLY option is ignored if
-PCRE_MULTILINE is set.
-
-Note that the sequences \\A, \\Z, and \\z can be used to match the start and
-end of the subject in both modes, and if all branches of a pattern start with
-\\A is it always anchored, whether PCRE_MULTILINE is set or not.
-
-
-.SH FULL STOP (PERIOD, DOT)
-Outside a character class, a dot in the pattern matches any one character in
-the subject, including a non-printing character, but not (by default) newline.
-If the PCRE_DOTALL option is set, dots match newlines as well. The handling of
-dot is entirely independent of the handling of circumflex and dollar, the only
-relationship being that they both involve newline characters. Dot has no
-special meaning in a character class.
-
-
-.SH SQUARE BRACKETS
-An opening square bracket introduces a character class, terminated by a closing
-square bracket. A closing square bracket on its own is not special. If a
-closing square bracket is required as a member of the class, it should be the
-first data character in the class (after an initial circumflex, if present) or
-escaped with a backslash.
-
-A character class matches a single character in the subject; the character must
-be in the set of characters defined by the class, unless the first character in
-the class is a circumflex, in which case the subject character must not be in
-the set defined by the class. If a circumflex is actually required as a member
-of the class, ensure it is not the first character, or escape it with a
-backslash.
-
-For example, the character class [aeiou] matches any lower case vowel, while
-[^aeiou] matches any character that is not a lower case vowel. Note that a
-circumflex is just a convenient notation for specifying the characters which
-are in the class by enumerating those that are not. It is not an assertion: it
-still consumes a character from the subject string, and fails if the current
-pointer is at the end of the string.
-
-When caseless matching is set, any letters in a class represent both their
-upper case and lower case versions, so for example, a caseless [aeiou] matches
-"A" as well as "a", and a caseless [^aeiou] does not match "A", whereas a
-caseful version would.
-
-The newline character is never treated in any special way in character classes,
-whatever the setting of the PCRE_DOTALL or PCRE_MULTILINE options is. A class
-such as [^a] will always match a newline.
-
-The minus (hyphen) character can be used to specify a range of characters in a
-character class. For example, [d-m] matches any letter between d and m,
-inclusive. If a minus character is required in a class, it must be escaped with
-a backslash or appear in a position where it cannot be interpreted as
-indicating a range, typically as the first or last character in the class.
-
-It is not possible to have the literal character "]" as the end character of a
-range. A pattern such as [W-]46] is interpreted as a class of two characters
-("W" and "-") followed by a literal string "46]", so it would match "W46]" or
-"-46]". However, if the "]" is escaped with a backslash it is interpreted as
-the end of range, so [W-\\]46] is interpreted as a single class containing a
-range followed by two separate characters. The octal or hexadecimal
-representation of "]" can also be used to end a range.
-
-Ranges operate in ASCII collating sequence. They can also be used for
-characters specified numerically, for example [\\000-\\037]. If a range that
-includes letters is used when caseless matching is set, it matches the letters
-in either case. For example, [W-c] is equivalent to [][\\^_`wxyzabc], matched
-caselessly, and if character tables for the "fr" locale are in use,
-[\\xc8-\\xcb] matches accented E characters in both cases.
-
-The character types \\d, \\D, \\s, \\S, \\w, and \\W may also appear in a
-character class, and add the characters that they match to the class. For
-example, [\\dABCDEF] matches any hexadecimal digit. A circumflex can
-conveniently be used with the upper case character types to specify a more
-restricted set of characters than the matching lower case type. For example,
-the class [^\\W_] matches any letter or digit, but not underscore.
-
-All non-alphameric characters other than \\, -, ^ (at the start) and the
-terminating ] are non-special in character classes, but it does no harm if they
-are escaped.
-
-
-.SH POSIX CHARACTER CLASSES
-Perl 5.6 (not yet released at the time of writing) is going to support the
-POSIX notation for character classes, which uses names enclosed by [: and :]
-within the enclosing square brackets. PCRE supports this notation. For example,
-
- [01[:alpha:]%]
-
-matches "0", "1", any alphabetic character, or "%". The supported class names
-are
-
- alnum letters and digits
- alpha letters
- ascii character codes 0 - 127
- cntrl control characters
- digit decimal digits (same as \\d)
- graph printing characters, excluding space
- lower lower case letters
- print printing characters, including space
- punct printing characters, excluding letters and digits
- space white space (same as \\s)
- upper upper case letters
- word "word" characters (same as \\w)
- xdigit hexadecimal digits
-
-The names "ascii" and "word" are Perl extensions. Another Perl extension is
-negation, which is indicated by a ^ character after the colon. For example,
-
- [12[:^digit:]]
-
-matches "1", "2", or any non-digit. PCRE (and Perl) also recogize the POSIX
-syntax [.ch.] and [=ch=] where "ch" is a "collating element", but these are not
-supported, and an error is given if they are encountered.
-
-
-.SH VERTICAL BAR
-Vertical bar characters are used to separate alternative patterns. For example,
-the pattern
-
- gilbert|sullivan
-
-matches either "gilbert" or "sullivan". Any number of alternatives may appear,
-and an empty alternative is permitted (matching the empty string).
-The matching process tries each alternative in turn, from left to right,
-and the first one that succeeds is used. If the alternatives are within a
-subpattern (defined below), "succeeds" means matching the rest of the main
-pattern as well as the alternative in the subpattern.
-
-
-.SH INTERNAL OPTION SETTING
-The settings of PCRE_CASELESS, PCRE_MULTILINE, PCRE_DOTALL, and PCRE_EXTENDED
-can be changed from within the pattern by a sequence of Perl option letters
-enclosed between "(?" and ")". The option letters are
-
- i for PCRE_CASELESS
- m for PCRE_MULTILINE
- s for PCRE_DOTALL
- x for PCRE_EXTENDED
-
-For example, (?im) sets caseless, multiline matching. It is also possible to
-unset these options by preceding the letter with a hyphen, and a combined
-setting and unsetting such as (?im-sx), which sets PCRE_CASELESS and
-PCRE_MULTILINE while unsetting PCRE_DOTALL and PCRE_EXTENDED, is also
-permitted. If a letter appears both before and after the hyphen, the option is
-unset.
-
-The scope of these option changes depends on where in the pattern the setting
-occurs. For settings that are outside any subpattern (defined below), the
-effect is the same as if the options were set or unset at the start of
-matching. The following patterns all behave in exactly the same way:
-
- (?i)abc
- a(?i)bc
- ab(?i)c
- abc(?i)
-
-which in turn is the same as compiling the pattern abc with PCRE_CASELESS set.
-In other words, such "top level" settings apply to the whole pattern (unless
-there are other changes inside subpatterns). If there is more than one setting
-of the same option at top level, the rightmost setting is used.
-
-If an option change occurs inside a subpattern, the effect is different. This
-is a change of behaviour in Perl 5.005. An option change inside a subpattern
-affects only that part of the subpattern that follows it, so
-
- (a(?i)b)c
-
-matches abc and aBc and no other strings (assuming PCRE_CASELESS is not used).
-By this means, options can be made to have different settings in different
-parts of the pattern. Any changes made in one alternative do carry on
-into subsequent branches within the same subpattern. For example,
-
- (a(?i)b|c)
-
-matches "ab", "aB", "c", and "C", even though when matching "C" the first
-branch is abandoned before the option setting. This is because the effects of
-option settings happen at compile time. There would be some very weird
-behaviour otherwise.
-
-The PCRE-specific options PCRE_UNGREEDY and PCRE_EXTRA can be changed in the
-same way as the Perl-compatible options by using the characters U and X
-respectively. The (?X) flag setting is special in that it must always occur
-earlier in the pattern than any of the additional features it turns on, even
-when it is at top level. It is best put at the start.
-
-
-.SH SUBPATTERNS
-Subpatterns are delimited by parentheses (round brackets), which can be nested.
-Marking part of a pattern as a subpattern does two things:
-
-1. It localizes a set of alternatives. For example, the pattern
-
- cat(aract|erpillar|)
-
-matches one of the words "cat", "cataract", or "caterpillar". Without the
-parentheses, it would match "cataract", "erpillar" or the empty string.
-
-2. It sets up the subpattern as a capturing subpattern (as defined above).
-When the whole pattern matches, that portion of the subject string that matched
-the subpattern is passed back to the caller via the \fIovector\fR argument of
-\fBpcre_exec()\fR. Opening parentheses are counted from left to right (starting
-from 1) to obtain the numbers of the capturing subpatterns.
-
-For example, if the string "the red king" is matched against the pattern
-
- the ((red|white) (king|queen))
-
-the captured substrings are "red king", "red", and "king", and are numbered 1,
-2, and 3.
-
-The fact that plain parentheses fulfil two functions is not always helpful.
-There are often times when a grouping subpattern is required without a
-capturing requirement. If an opening parenthesis is followed by "?:", the
-subpattern does not do any capturing, and is not counted when computing the
-number of any subsequent capturing subpatterns. For example, if the string "the
-white queen" is matched against the pattern
-
- the ((?:red|white) (king|queen))
-
-the captured substrings are "white queen" and "queen", and are numbered 1 and
-2. The maximum number of captured substrings is 99, and the maximum number of
-all subpatterns, both capturing and non-capturing, is 200.
-
-As a convenient shorthand, if any option settings are required at the start of
-a non-capturing subpattern, the option letters may appear between the "?" and
-the ":". Thus the two patterns
-
- (?i:saturday|sunday)
- (?:(?i)saturday|sunday)
-
-match exactly the same set of strings. Because alternative branches are tried
-from left to right, and options are not reset until the end of the subpattern
-is reached, an option setting in one branch does affect subsequent branches, so
-the above patterns match "SUNDAY" as well as "Saturday".
-
-
-.SH REPETITION
-Repetition is specified by quantifiers, which can follow any of the following
-items:
-
- a single character, possibly escaped
- the . metacharacter
- a character class
- a back reference (see next section)
- a parenthesized subpattern (unless it is an assertion - see below)
-
-The general repetition quantifier specifies a minimum and maximum number of
-permitted matches, by giving the two numbers in curly brackets (braces),
-separated by a comma. The numbers must be less than 65536, and the first must
-be less than or equal to the second. For example:
-
- z{2,4}
-
-matches "zz", "zzz", or "zzzz". A closing brace on its own is not a special
-character. If the second number is omitted, but the comma is present, there is
-no upper limit; if the second number and the comma are both omitted, the
-quantifier specifies an exact number of required matches. Thus
-
- [aeiou]{3,}
-
-matches at least 3 successive vowels, but may match many more, while
-
- \\d{8}
-
-matches exactly 8 digits. An opening curly bracket that appears in a position
-where a quantifier is not allowed, or one that does not match the syntax of a
-quantifier, is taken as a literal character. For example, {,6} is not a
-quantifier, but a literal string of four characters.
-
-The quantifier {0} is permitted, causing the expression to behave as if the
-previous item and the quantifier were not present.
-
-For convenience (and historical compatibility) the three most common
-quantifiers have single-character abbreviations:
-
- * is equivalent to {0,}
- + is equivalent to {1,}
- ? is equivalent to {0,1}
-
-It is possible to construct infinite loops by following a subpattern that can
-match no characters with a quantifier that has no upper limit, for example:
-
- (a?)*
-
-Earlier versions of Perl and PCRE used to give an error at compile time for
-such patterns. However, because there are cases where this can be useful, such
-patterns are now accepted, but if any repetition of the subpattern does in fact
-match no characters, the loop is forcibly broken.
-
-By default, the quantifiers are "greedy", that is, they match as much as
-possible (up to the maximum number of permitted times), without causing the
-rest of the pattern to fail. The classic example of where this gives problems
-is in trying to match comments in C programs. These appear between the
-sequences /* and */ and within the sequence, individual * and / characters may
-appear. An attempt to match C comments by applying the pattern
-
- /\\*.*\\*/
-
-to the string
-
- /* first command */ not comment /* second comment */
-
-fails, because it matches the entire string owing to the greediness of the .*
-item.
-
-However, if a quantifier is followed by a question mark, it ceases to be
-greedy, and instead matches the minimum number of times possible, so the
-pattern
-
- /\\*.*?\\*/
-
-does the right thing with the C comments. The meaning of the various
-quantifiers is not otherwise changed, just the preferred number of matches.
-Do not confuse this use of question mark with its use as a quantifier in its
-own right. Because it has two uses, it can sometimes appear doubled, as in
-
- \\d??\\d
-
-which matches one digit by preference, but can match two if that is the only
-way the rest of the pattern matches.
-
-If the PCRE_UNGREEDY option is set (an option which is not available in Perl),
-the quantifiers are not greedy by default, but individual ones can be made
-greedy by following them with a question mark. In other words, it inverts the
-default behaviour.
-
-When a parenthesized subpattern is quantified with a minimum repeat count that
-is greater than 1 or with a limited maximum, more store is required for the
-compiled pattern, in proportion to the size of the minimum or maximum.
-
-If a pattern starts with .* or .{0,} and the PCRE_DOTALL option (equivalent
-to Perl's /s) is set, thus allowing the . to match newlines, the pattern is
-implicitly anchored, because whatever follows will be tried against every
-character position in the subject string, so there is no point in retrying the
-overall match at any position after the first. PCRE treats such a pattern as
-though it were preceded by \\A. In cases where it is known that the subject
-string contains no newlines, it is worth setting PCRE_DOTALL when the pattern
-begins with .* in order to obtain this optimization, or alternatively using ^
-to indicate anchoring explicitly.
-
-When a capturing subpattern is repeated, the value captured is the substring
-that matched the final iteration. For example, after
-
- (tweedle[dume]{3}\\s*)+
-
-has matched "tweedledum tweedledee" the value of the captured substring is
-"tweedledee". However, if there are nested capturing subpatterns, the
-corresponding captured values may have been set in previous iterations. For
-example, after
-
- /(a|(b))+/
-
-matches "aba" the value of the second captured substring is "b".
-
-
-.SH BACK REFERENCES
-Outside a character class, a backslash followed by a digit greater than 0 (and
-possibly further digits) is a back reference to a capturing subpattern earlier
-(i.e. to its left) in the pattern, provided there have been that many previous
-capturing left parentheses.
-
-However, if the decimal number following the backslash is less than 10, it is
-always taken as a back reference, and causes an error only if there are not
-that many capturing left parentheses in the entire pattern. In other words, the
-parentheses that are referenced need not be to the left of the reference for
-numbers less than 10. See the section entitled "Backslash" above for further
-details of the handling of digits following a backslash.
-
-A back reference matches whatever actually matched the capturing subpattern in
-the current subject string, rather than anything matching the subpattern
-itself. So the pattern
-
- (sens|respons)e and \\1ibility
-
-matches "sense and sensibility" and "response and responsibility", but not
-"sense and responsibility". If caseful matching is in force at the time of the
-back reference, the case of letters is relevant. For example,
-
- ((?i)rah)\\s+\\1
-
-matches "rah rah" and "RAH RAH", but not "RAH rah", even though the original
-capturing subpattern is matched caselessly.
-
-There may be more than one back reference to the same subpattern. If a
-subpattern has not actually been used in a particular match, any back
-references to it always fail. For example, the pattern
-
- (a|(bc))\\2
-
-always fails if it starts to match "a" rather than "bc". Because there may be
-up to 99 back references, all digits following the backslash are taken
-as part of a potential back reference number. If the pattern continues with a
-digit character, some delimiter must be used to terminate the back reference.
-If the PCRE_EXTENDED option is set, this can be whitespace. Otherwise an empty
-comment can be used.
-
-A back reference that occurs inside the parentheses to which it refers fails
-when the subpattern is first used, so, for example, (a\\1) never matches.
-However, such references can be useful inside repeated subpatterns. For
-example, the pattern
-
- (a|b\\1)+
-
-matches any number of "a"s and also "aba", "ababbaa" etc. At each iteration of
-the subpattern, the back reference matches the character string corresponding
-to the previous iteration. In order for this to work, the pattern must be such
-that the first iteration does not need to match the back reference. This can be
-done using alternation, as in the example above, or by a quantifier with a
-minimum of zero.
-
-
-.SH ASSERTIONS
-An assertion is a test on the characters following or preceding the current
-matching point that does not actually consume any characters. The simple
-assertions coded as \\b, \\B, \\A, \\Z, \\z, ^ and $ are described above. More
-complicated assertions are coded as subpatterns. There are two kinds: those
-that look ahead of the current position in the subject string, and those that
-look behind it.
-
-An assertion subpattern is matched in the normal way, except that it does not
-cause the current matching position to be changed. Lookahead assertions start
-with (?= for positive assertions and (?! for negative assertions. For example,
-
- \\w+(?=;)
-
-matches a word followed by a semicolon, but does not include the semicolon in
-the match, and
-
- foo(?!bar)
-
-matches any occurrence of "foo" that is not followed by "bar". Note that the
-apparently similar pattern
-
- (?!foo)bar
-
-does not find an occurrence of "bar" that is preceded by something other than
-"foo"; it finds any occurrence of "bar" whatsoever, because the assertion
-(?!foo) is always true when the next three characters are "bar". A
-lookbehind assertion is needed to achieve this effect.
-
-Lookbehind assertions start with (?<= for positive assertions and (?<! for
-negative assertions. For example,
-
- (?<!foo)bar
-
-does find an occurrence of "bar" that is not preceded by "foo". The contents of
-a lookbehind assertion are restricted such that all the strings it matches must
-have a fixed length. However, if there are several alternatives, they do not
-all have to have the same fixed length. Thus
-
- (?<=bullock|donkey)
-
-is permitted, but
-
- (?<!dogs?|cats?)
-
-causes an error at compile time. Branches that match different length strings
-are permitted only at the top level of a lookbehind assertion. This is an
-extension compared with Perl 5.005, which requires all branches to match the
-same length of string. An assertion such as
-
- (?<=ab(c|de))
-
-is not permitted, because its single top-level branch can match two different
-lengths, but it is acceptable if rewritten to use two top-level branches:
-
- (?<=abc|abde)
-
-The implementation of lookbehind assertions is, for each alternative, to
-temporarily move the current position back by the fixed width and then try to
-match. If there are insufficient characters before the current position, the
-match is deemed to fail. Lookbehinds in conjunction with once-only subpatterns
-can be particularly useful for matching at the ends of strings; an example is
-given at the end of the section on once-only subpatterns.
-
-Several assertions (of any sort) may occur in succession. For example,
-
- (?<=\\d{3})(?<!999)foo
-
-matches "foo" preceded by three digits that are not "999". Notice that each of
-the assertions is applied independently at the same point in the subject
-string. First there is a check that the previous three characters are all
-digits, and then there is a check that the same three characters are not "999".
-This pattern does \fInot\fR match "foo" preceded by six characters, the first
-of which are digits and the last three of which are not "999". For example, it
-doesn't match "123abcfoo". A pattern to do that is
-
- (?<=\\d{3}...)(?<!999)foo
-
-This time the first assertion looks at the preceding six characters, checking
-that the first three are digits, and then the second assertion checks that the
-preceding three characters are not "999".
-
-Assertions can be nested in any combination. For example,
-
- (?<=(?<!foo)bar)baz
-
-matches an occurrence of "baz" that is preceded by "bar" which in turn is not
-preceded by "foo", while
-
- (?<=\\d{3}(?!999)...)foo
-
-is another pattern which matches "foo" preceded by three digits and any three
-characters that are not "999".
-
-Assertion subpatterns are not capturing subpatterns, and may not be repeated,
-because it makes no sense to assert the same thing several times. If any kind
-of assertion contains capturing subpatterns within it, these are counted for
-the purposes of numbering the capturing subpatterns in the whole pattern.
-However, substring capturing is carried out only for positive assertions,
-because it does not make sense for negative assertions.
-
-Assertions count towards the maximum of 200 parenthesized subpatterns.
-
-
-.SH ONCE-ONLY SUBPATTERNS
-With both maximizing and minimizing repetition, failure of what follows
-normally causes the repeated item to be re-evaluated to see if a different
-number of repeats allows the rest of the pattern to match. Sometimes it is
-useful to prevent this, either to change the nature of the match, or to cause
-it fail earlier than it otherwise might, when the author of the pattern knows
-there is no point in carrying on.
-
-Consider, for example, the pattern \\d+foo when applied to the subject line
-
- 123456bar
-
-After matching all 6 digits and then failing to match "foo", the normal
-action of the matcher is to try again with only 5 digits matching the \\d+
-item, and then with 4, and so on, before ultimately failing. Once-only
-subpatterns provide the means for specifying that once a portion of the pattern
-has matched, it is not to be re-evaluated in this way, so the matcher would
-give up immediately on failing to match "foo" the first time. The notation is
-another kind of special parenthesis, starting with (?> as in this example:
-
- (?>\\d+)bar
-
-This kind of parenthesis "locks up" the part of the pattern it contains once
-it has matched, and a failure further into the pattern is prevented from
-backtracking into it. Backtracking past it to previous items, however, works as
-normal.
-
-An alternative description is that a subpattern of this type matches the string
-of characters that an identical standalone pattern would match, if anchored at
-the current point in the subject string.
-
-Once-only subpatterns are not capturing subpatterns. Simple cases such as the
-above example can be thought of as a maximizing repeat that must swallow
-everything it can. So, while both \\d+ and \\d+? are prepared to adjust the
-number of digits they match in order to make the rest of the pattern match,
-(?>\\d+) can only match an entire sequence of digits.
-
-This construction can of course contain arbitrarily complicated subpatterns,
-and it can be nested.
-
-Once-only subpatterns can be used in conjunction with lookbehind assertions to
-specify efficient matching at the end of the subject string. Consider a simple
-pattern such as
-
- abcd$
-
-when applied to a long string which does not match. Because matching proceeds
-from left to right, PCRE will look for each "a" in the subject and then see if
-what follows matches the rest of the pattern. If the pattern is specified as
-
- ^.*abcd$
-
-the initial .* matches the entire string at first, but when this fails (because
-there is no following "a"), it backtracks to match all but the last character,
-then all but the last two characters, and so on. Once again the search for "a"
-covers the entire string, from right to left, so we are no better off. However,
-if the pattern is written as
-
- ^(?>.*)(?<=abcd)
-
-there can be no backtracking for the .* item; it can match only the entire
-string. The subsequent lookbehind assertion does a single test on the last four
-characters. If it fails, the match fails immediately. For long strings, this
-approach makes a significant difference to the processing time.
-
-When a pattern contains an unlimited repeat inside a subpattern that can itself
-be repeated an unlimited number of times, the use of a once-only subpattern is
-the only way to avoid some failing matches taking a very long time indeed.
-The pattern
-
- (\\D+|<\\d+>)*[!?]
-
-matches an unlimited number of substrings that either consist of non-digits, or
-digits enclosed in <>, followed by either ! or ?. When it matches, it runs
-quickly. However, if it is applied to
-
- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
-
-it takes a long time before reporting failure. This is because the string can
-be divided between the two repeats in a large number of ways, and all have to
-be tried. (The example used [!?] rather than a single character at the end,
-because both PCRE and Perl have an optimization that allows for fast failure
-when a single character is used. They remember the last single character that
-is required for a match, and fail early if it is not present in the string.)
-If the pattern is changed to
-
- ((?>\\D+)|<\\d+>)*[!?]
-
-sequences of non-digits cannot be broken, and failure happens quickly.
-
-
-.SH CONDITIONAL SUBPATTERNS
-It is possible to cause the matching process to obey a subpattern
-conditionally or to choose between two alternative subpatterns, depending on
-the result of an assertion, or whether a previous capturing subpattern matched
-or not. The two possible forms of conditional subpattern are
-
- (?(condition)yes-pattern)
- (?(condition)yes-pattern|no-pattern)
-
-If the condition is satisfied, the yes-pattern is used; otherwise the
-no-pattern (if present) is used. If there are more than two alternatives in the
-subpattern, a compile-time error occurs.
-
-There are two kinds of condition. If the text between the parentheses consists
-of a sequence of digits, the condition is satisfied if the capturing subpattern
-of that number has previously matched. The number must be greater than zero.
-Consider the following pattern, which contains non-significant white space to
-make it more readable (assume the PCRE_EXTENDED option) and to divide it into
-three parts for ease of discussion:
-
- ( \\( )? [^()]+ (?(1) \\) )
-
-The first part matches an optional opening parenthesis, and if that
-character is present, sets it as the first captured substring. The second part
-matches one or more characters that are not parentheses. The third part is a
-conditional subpattern that tests whether the first set of parentheses matched
-or not. If they did, that is, if subject started with an opening parenthesis,
-the condition is true, and so the yes-pattern is executed and a closing
-parenthesis is required. Otherwise, since no-pattern is not present, the
-subpattern matches nothing. In other words, this pattern matches a sequence of
-non-parentheses, optionally enclosed in parentheses.
-
-If the condition is not a sequence of digits, it must be an assertion. This may
-be a positive or negative lookahead or lookbehind assertion. Consider this
-pattern, again containing non-significant white space, and with the two
-alternatives on the second line:
-
- (?(?=[^a-z]*[a-z])
- \\d{2}-[a-z]{3}-\\d{2} | \\d{2}-\\d{2}-\\d{2} )
-
-The condition is a positive lookahead assertion that matches an optional
-sequence of non-letters followed by a letter. In other words, it tests for the
-presence of at least one letter in the subject. If a letter is found, the
-subject is matched against the first alternative; otherwise it is matched
-against the second. This pattern matches strings in one of the two forms
-dd-aaa-dd or dd-dd-dd, where aaa are letters and dd are digits.
-
-
-.SH COMMENTS
-The sequence (?# marks the start of a comment which continues up to the next
-closing parenthesis. Nested parentheses are not permitted. The characters
-that make up a comment play no part in the pattern matching at all.
-
-If the PCRE_EXTENDED option is set, an unescaped # character outside a
-character class introduces a comment that continues up to the next newline
-character in the pattern.
-
-
-.SH RECURSIVE PATTERNS
-Consider the problem of matching a string in parentheses, allowing for
-unlimited nested parentheses. Without the use of recursion, the best that can
-be done is to use a pattern that matches up to some fixed depth of nesting. It
-is not possible to handle an arbitrary nesting depth. Perl 5.6 has provided an
-experimental facility that allows regular expressions to recurse (amongst other
-things). It does this by interpolating Perl code in the expression at run time,
-and the code can refer to the expression itself. A Perl pattern to solve the
-parentheses problem can be created like this:
-
- $re = qr{\\( (?: (?>[^()]+) | (?p{$re}) )* \\)}x;
-
-The (?p{...}) item interpolates Perl code at run time, and in this case refers
-recursively to the pattern in which it appears. Obviously, PCRE cannot support
-the interpolation of Perl code. Instead, the special item (?R) is provided for
-the specific case of recursion. This PCRE pattern solves the parentheses
-problem (assume the PCRE_EXTENDED option is set so that white space is
-ignored):
-
- \\( ( (?>[^()]+) | (?R) )* \\)
-
-First it matches an opening parenthesis. Then it matches any number of
-substrings which can either be a sequence of non-parentheses, or a recursive
-match of the pattern itself (i.e. a correctly parenthesized substring). Finally
-there is a closing parenthesis.
-
-This particular example pattern contains nested unlimited repeats, and so the
-use of a once-only subpattern for matching strings of non-parentheses is
-important when applying the pattern to strings that do not match. For example,
-when it is applied to
-
- (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa()
-
-it yields "no match" quickly. However, if a once-only subpattern is not used,
-the match runs for a very long time indeed because there are so many different
-ways the + and * repeats can carve up the subject, and all have to be tested
-before failure can be reported.
-
-The values set for any capturing subpatterns are those from the outermost level
-of the recursion at which the subpattern value is set. If the pattern above is
-matched against
-
- (ab(cd)ef)
-
-the value for the capturing parentheses is "ef", which is the last value taken
-on at the top level. If additional parentheses are added, giving
-
- \\( ( ( (?>[^()]+) | (?R) )* ) \\)
- ^ ^
- ^ ^
-the string they capture is "ab(cd)ef", the contents of the top level
-parentheses. If there are more than 15 capturing parentheses in a pattern, PCRE
-has to obtain extra memory to store data during a recursion, which it does by
-using \fBpcre_malloc\fR, freeing it via \fBpcre_free\fR afterwards. If no
-memory can be obtained, it saves data for the first 15 capturing parentheses
-only, as there is no way to give an out-of-memory error from within a
-recursion.
-
-
-.SH PERFORMANCE
-Certain items that may appear in patterns are more efficient than others. It is
-more efficient to use a character class like [aeiou] than a set of alternatives
-such as (a|e|i|o|u). In general, the simplest construction that provides the
-required behaviour is usually the most efficient. Jeffrey Friedl's book
-contains a lot of discussion about optimizing regular expressions for efficient
-performance.
-
-When a pattern begins with .* and the PCRE_DOTALL option is set, the pattern is
-implicitly anchored by PCRE, since it can match only at the start of a subject
-string. However, if PCRE_DOTALL is not set, PCRE cannot make this optimization,
-because the . metacharacter does not then match a newline, and if the subject
-string contains newlines, the pattern may match from the character immediately
-following one of them instead of from the very start. For example, the pattern
-
- (.*) second
-
-matches the subject "first\\nand second" (where \\n stands for a newline
-character) with the first captured substring being "and". In order to do this,
-PCRE has to retry the match starting after every newline in the subject.
-
-If you are using such a pattern with subject strings that do not contain
-newlines, the best performance is obtained by setting PCRE_DOTALL, or starting
-the pattern with ^.* to indicate explicit anchoring. That saves PCRE from
-having to scan along the subject looking for a newline to restart at.
-
-Beware of patterns that contain nested indefinite repeats. These can take a
-long time to run when applied to a string that does not match. Consider the
-pattern fragment
-
- (a+)*
-
-This can match "aaaa" in 33 different ways, and this number increases very
-rapidly as the string gets longer. (The * repeat can match 0, 1, 2, 3, or 4
-times, and for each of those cases other than 0, the + repeats can match
-different numbers of times.) When the remainder of the pattern is such that the
-entire match is going to fail, PCRE has in principle to try every possible
-variation, and this can take an extremely long time.
-
-An optimization catches some of the more simple cases such as
-
- (a+)*b
-
-where a literal character follows. Before embarking on the standard matching
-procedure, PCRE checks that there is a "b" later in the subject string, and if
-there is not, it fails the match immediately. However, when there is no
-following literal this optimization cannot be used. You can see the difference
-by comparing the behaviour of
-
- (a+)*\\d
-
-with the pattern above. The former gives a failure almost instantly when
-applied to a whole line of "a" characters, whereas the latter takes an
-appreciable time with strings longer than about 20 characters.
-
-
-.SH UTF-8 SUPPORT
-Starting at release 3.3, PCRE has some support for character strings encoded
-in the UTF-8 format. This is incomplete, and is regarded as experimental. In
-order to use it, you must configure PCRE to include UTF-8 support in the code,
-and, in addition, you must call \fBpcre_compile()\fR with the PCRE_UTF8 option
-flag. When you do this, both the pattern and any subject strings that are
-matched against it are treated as UTF-8 strings instead of just strings of
-bytes, but only in the cases that are mentioned below.
-
-If you compile PCRE with UTF-8 support, but do not use it at run time, the
-library will be a bit bigger, but the additional run time overhead is limited
-to testing the PCRE_UTF8 flag in several places, so should not be very large.
-
-PCRE assumes that the strings it is given contain valid UTF-8 codes. It does
-not diagnose invalid UTF-8 strings. If you pass invalid UTF-8 strings to PCRE,
-the results are undefined.
-
-Running with PCRE_UTF8 set causes these changes in the way PCRE works:
-
-1. In a pattern, the escape sequence \\x{...}, where the contents of the braces
-is a string of hexadecimal digits, is interpreted as a UTF-8 character whose
-code number is the given hexadecimal number, for example: \\x{1234}. This
-inserts from one to six literal bytes into the pattern, using the UTF-8
-encoding. If a non-hexadecimal digit appears between the braces, the item is
-not recognized.
-
-2. The original hexadecimal escape sequence, \\xhh, generates a two-byte UTF-8
-character if its value is greater than 127.
-
-3. Repeat quantifiers are NOT correctly handled if they follow a multibyte
-character. For example, \\x{100}* and \\xc3+ do not work. If you want to
-repeat such characters, you must enclose them in non-capturing parentheses,
-for example (?:\\x{100}), at present.
-
-4. The dot metacharacter matches one UTF-8 character instead of a single byte.
-
-5. Unlike literal UTF-8 characters, the dot metacharacter followed by a
-repeat quantifier does operate correctly on UTF-8 characters instead of
-single bytes.
-
-4. Although the \\x{...} escape is permitted in a character class, characters
-whose values are greater than 255 cannot be included in a class.
-
-5. A class is matched against a UTF-8 character instead of just a single byte,
-but it can match only characters whose values are less than 256. Characters
-with greater values always fail to match a class.
-
-6. Repeated classes work correctly on multiple characters.
-
-7. Classes containing just a single character whose value is greater than 127
-(but less than 256), for example, [\\x80] or [^\\x{93}], do not work because
-these are optimized into single byte matches. In the first case, of course,
-the class brackets are just redundant.
-
-8. Lookbehind assertions move backwards in the subject by a fixed number of
-characters instead of a fixed number of bytes. Simple cases have been tested
-to work correctly, but there may be hidden gotchas herein.
-
-9. The character types such as \\d and \\w do not work correctly with UTF-8
-characters. They continue to test a single byte.
-
-10. Anything not explicitly mentioned here continues to work in bytes rather
-than in characters.
-
-The following UTF-8 features of Perl 5.6 are not implemented:
-
-1. The escape sequence \\C to match a single byte.
-
-2. The use of Unicode tables and properties and escapes \\p, \\P, and \\X.
-
-.SH AUTHOR
-Philip Hazel <ph10@cam.ac.uk>
-.br
-University Computing Service,
-.br
-New Museums Site,
-.br
-Cambridge CB2 3QG, England.
-.br
-Phone: +44 1223 334714
-
-Last updated: 28 August 2000,
-.br
- the 250th anniversary of the death of J.S. Bach.
-.br
-Copyright (c) 1997-2000 University of Cambridge.
diff --git a/ext/pcre/pcrelib/doc/pcre.html b/ext/pcre/pcrelib/doc/pcre.html
deleted file mode 100644
index 01770975e2..0000000000
--- a/ext/pcre/pcrelib/doc/pcre.html
+++ /dev/null
@@ -1,2397 +0,0 @@
-<HTML>
-<HEAD>
-<TITLE>pcre specification</TITLE>
-</HEAD>
-<body bgcolor="#FFFFFF" text="#00005A">
-<H1>pcre specification</H1>
-This HTML document has been generated automatically from the original man page.
-If there is any nonsense in it, please consult the man page in case the
-conversion went wrong.
-<UL>
-<LI><A NAME="TOC1" HREF="#SEC1">NAME</A>
-<LI><A NAME="TOC2" HREF="#SEC2">SYNOPSIS</A>
-<LI><A NAME="TOC3" HREF="#SEC3">DESCRIPTION</A>
-<LI><A NAME="TOC4" HREF="#SEC4">MULTI-THREADING</A>
-<LI><A NAME="TOC5" HREF="#SEC5">COMPILING A PATTERN</A>
-<LI><A NAME="TOC6" HREF="#SEC6">STUDYING A PATTERN</A>
-<LI><A NAME="TOC7" HREF="#SEC7">LOCALE SUPPORT</A>
-<LI><A NAME="TOC8" HREF="#SEC8">INFORMATION ABOUT A PATTERN</A>
-<LI><A NAME="TOC9" HREF="#SEC9">MATCHING A PATTERN</A>
-<LI><A NAME="TOC10" HREF="#SEC10">EXTRACTING CAPTURED SUBSTRINGS</A>
-<LI><A NAME="TOC11" HREF="#SEC11">LIMITATIONS</A>
-<LI><A NAME="TOC12" HREF="#SEC12">DIFFERENCES FROM PERL</A>
-<LI><A NAME="TOC13" HREF="#SEC13">REGULAR EXPRESSION DETAILS</A>
-<LI><A NAME="TOC14" HREF="#SEC14">BACKSLASH</A>
-<LI><A NAME="TOC15" HREF="#SEC15">CIRCUMFLEX AND DOLLAR</A>
-<LI><A NAME="TOC16" HREF="#SEC16">FULL STOP (PERIOD, DOT)</A>
-<LI><A NAME="TOC17" HREF="#SEC17">SQUARE BRACKETS</A>
-<LI><A NAME="TOC18" HREF="#SEC18">POSIX CHARACTER CLASSES</A>
-<LI><A NAME="TOC19" HREF="#SEC19">VERTICAL BAR</A>
-<LI><A NAME="TOC20" HREF="#SEC20">INTERNAL OPTION SETTING</A>
-<LI><A NAME="TOC21" HREF="#SEC21">SUBPATTERNS</A>
-<LI><A NAME="TOC22" HREF="#SEC22">REPETITION</A>
-<LI><A NAME="TOC23" HREF="#SEC23">BACK REFERENCES</A>
-<LI><A NAME="TOC24" HREF="#SEC24">ASSERTIONS</A>
-<LI><A NAME="TOC25" HREF="#SEC25">ONCE-ONLY SUBPATTERNS</A>
-<LI><A NAME="TOC26" HREF="#SEC26">CONDITIONAL SUBPATTERNS</A>
-<LI><A NAME="TOC27" HREF="#SEC27">COMMENTS</A>
-<LI><A NAME="TOC28" HREF="#SEC28">RECURSIVE PATTERNS</A>
-<LI><A NAME="TOC29" HREF="#SEC29">PERFORMANCE</A>
-<LI><A NAME="TOC30" HREF="#SEC30">UTF-8 SUPPORT</A>
-<LI><A NAME="TOC31" HREF="#SEC31">AUTHOR</A>
-</UL>
-<LI><A NAME="SEC1" HREF="#TOC1">NAME</A>
-<P>
-pcre - Perl-compatible regular expressions.
-</P>
-<LI><A NAME="SEC2" HREF="#TOC1">SYNOPSIS</A>
-<P>
-<B>#include &#60;pcre.h&#62;</B>
-</P>
-<P>
-<B>pcre *pcre_compile(const char *<I>pattern</I>, int <I>options</I>,</B>
-<B>const char **<I>errptr</I>, int *<I>erroffset</I>,</B>
-<B>const unsigned char *<I>tableptr</I>);</B>
-</P>
-<P>
-<B>pcre_extra *pcre_study(const pcre *<I>code</I>, int <I>options</I>,</B>
-<B>const char **<I>errptr</I>);</B>
-</P>
-<P>
-<B>int pcre_exec(const pcre *<I>code</I>, const pcre_extra *<I>extra</I>,</B>
-<B>const char *<I>subject</I>, int <I>length</I>, int <I>startoffset</I>,</B>
-<B>int <I>options</I>, int *<I>ovector</I>, int <I>ovecsize</I>);</B>
-</P>
-<P>
-<B>int pcre_copy_substring(const char *<I>subject</I>, int *<I>ovector</I>,</B>
-<B>int <I>stringcount</I>, int <I>stringnumber</I>, char *<I>buffer</I>,</B>
-<B>int <I>buffersize</I>);</B>
-</P>
-<P>
-<B>int pcre_get_substring(const char *<I>subject</I>, int *<I>ovector</I>,</B>
-<B>int <I>stringcount</I>, int <I>stringnumber</I>,</B>
-<B>const char **<I>stringptr</I>);</B>
-</P>
-<P>
-<B>int pcre_get_substring_list(const char *<I>subject</I>,</B>
-<B>int *<I>ovector</I>, int <I>stringcount</I>, const char ***<I>listptr</I>);</B>
-</P>
-<P>
-<B>void pcre_free_substring(const char *<I>stringptr</I>);</B>
-</P>
-<P>
-<B>void pcre_free_substring_list(const char **<I>stringptr</I>);</B>
-</P>
-<P>
-<B>const unsigned char *pcre_maketables(void);</B>
-</P>
-<P>
-<B>int pcre_fullinfo(const pcre *<I>code</I>, const pcre_extra *<I>extra</I>,</B>
-<B>int <I>what</I>, void *<I>where</I>);</B>
-</P>
-<P>
-<B>int pcre_info(const pcre *<I>code</I>, int *<I>optptr</I>, int</B>
-<B>*<I>firstcharptr</I>);</B>
-</P>
-<P>
-<B>char *pcre_version(void);</B>
-</P>
-<P>
-<B>void *(*pcre_malloc)(size_t);</B>
-</P>
-<P>
-<B>void (*pcre_free)(void *);</B>
-</P>
-<LI><A NAME="SEC3" HREF="#TOC1">DESCRIPTION</A>
-<P>
-The PCRE library is a set of functions that implement regular expression
-pattern matching using the same syntax and semantics as Perl 5, with just a few
-differences (see below). The current implementation corresponds to Perl 5.005,
-with some additional features from later versions. This includes some
-experimental, incomplete support for UTF-8 encoded strings. Details of exactly
-what is and what is not supported are given below.
-</P>
-<P>
-PCRE has its own native API, which is described in this document. There is also
-a set of wrapper functions that correspond to the POSIX regular expression API.
-These are described in the <B>pcreposix</B> documentation.
-</P>
-<P>
-The native API function prototypes are defined in the header file <B>pcre.h</B>,
-and on Unix systems the library itself is called <B>libpcre.a</B>, so can be
-accessed by adding <B>-lpcre</B> to the command for linking an application which
-calls it. The header file defines the macros PCRE_MAJOR and PCRE_MINOR to
-contain the major and minor release numbers for the library. Applications can
-use these to include support for different releases.
-</P>
-<P>
-The functions <B>pcre_compile()</B>, <B>pcre_study()</B>, and <B>pcre_exec()</B>
-are used for compiling and matching regular expressions.
-</P>
-<P>
-The functions <B>pcre_copy_substring()</B>, <B>pcre_get_substring()</B>, and
-<B>pcre_get_substring_list()</B> are convenience functions for extracting
-captured substrings from a matched subject string; <B>pcre_free_substring()</B>
-and <B>pcre_free_substring_list()</B> are also provided, to free the memory used
-for extracted strings.
-</P>
-<P>
-The function <B>pcre_maketables()</B> is used (optionally) to build a set of
-character tables in the current locale for passing to <B>pcre_compile()</B>.
-</P>
-<P>
-The function <B>pcre_fullinfo()</B> is used to find out information about a
-compiled pattern; <B>pcre_info()</B> is an obsolete version which returns only
-some of the available information, but is retained for backwards compatibility.
-The function <B>pcre_version()</B> returns a pointer to a string containing the
-version of PCRE and its date of release.
-</P>
-<P>
-The global variables <B>pcre_malloc</B> and <B>pcre_free</B> initially contain
-the entry points of the standard <B>malloc()</B> and <B>free()</B> functions
-respectively. PCRE calls the memory management functions via these variables,
-so a calling program can replace them if it wishes to intercept the calls. This
-should be done before calling any PCRE functions.
-</P>
-<LI><A NAME="SEC4" HREF="#TOC1">MULTI-THREADING</A>
-<P>
-The PCRE functions can be used in multi-threading applications, with the
-proviso that the memory management functions pointed to by <B>pcre_malloc</B>
-and <B>pcre_free</B> are shared by all threads.
-</P>
-<P>
-The compiled form of a regular expression is not altered during matching, so
-the same compiled pattern can safely be used by several threads at once.
-</P>
-<LI><A NAME="SEC5" HREF="#TOC1">COMPILING A PATTERN</A>
-<P>
-The function <B>pcre_compile()</B> is called to compile a pattern into an
-internal form. The pattern is a C string terminated by a binary zero, and
-is passed in the argument <I>pattern</I>. A pointer to a single block of memory
-that is obtained via <B>pcre_malloc</B> is returned. This contains the
-compiled code and related data. The <B>pcre</B> type is defined for this for
-convenience, but in fact <B>pcre</B> is just a typedef for <B>void</B>, since the
-contents of the block are not externally defined. It is up to the caller to
-free the memory when it is no longer required.
-</P>
-<P>
-The size of a compiled pattern is roughly proportional to the length of the
-pattern string, except that each character class (other than those containing
-just a single character, negated or not) requires 33 bytes, and repeat
-quantifiers with a minimum greater than one or a bounded maximum cause the
-relevant portions of the compiled pattern to be replicated.
-</P>
-<P>
-The <I>options</I> argument contains independent bits that affect the
-compilation. It should be zero if no options are required. Some of the options,
-in particular, those that are compatible with Perl, can also be set and unset
-from within the pattern (see the detailed description of regular expressions
-below). For these options, the contents of the <I>options</I> argument specifies
-their initial settings at the start of compilation and execution. The
-PCRE_ANCHORED option can be set at the time of matching as well as at compile
-time.
-</P>
-<P>
-If <I>errptr</I> is NULL, <B>pcre_compile()</B> returns NULL immediately.
-Otherwise, if compilation of a pattern fails, <B>pcre_compile()</B> returns
-NULL, and sets the variable pointed to by <I>errptr</I> to point to a textual
-error message. The offset from the start of the pattern to the character where
-the error was discovered is placed in the variable pointed to by
-<I>erroffset</I>, which must not be NULL. If it is, an immediate error is given.
-</P>
-<P>
-If the final argument, <I>tableptr</I>, is NULL, PCRE uses a default set of
-character tables which are built when it is compiled, using the default C
-locale. Otherwise, <I>tableptr</I> must be the result of a call to
-<B>pcre_maketables()</B>. See the section on locale support below.
-</P>
-<P>
-The following option bits are defined in the header file:
-</P>
-<P>
-<PRE>
- PCRE_ANCHORED
-</PRE>
-</P>
-<P>
-If this bit is set, the pattern is forced to be "anchored", that is, it is
-constrained to match only at the start of the string which is being searched
-(the "subject string"). This effect can also be achieved by appropriate
-constructs in the pattern itself, which is the only way to do it in Perl.
-</P>
-<P>
-<PRE>
- PCRE_CASELESS
-</PRE>
-</P>
-<P>
-If this bit is set, letters in the pattern match both upper and lower case
-letters. It is equivalent to Perl's /i option.
-</P>
-<P>
-<PRE>
- PCRE_DOLLAR_ENDONLY
-</PRE>
-</P>
-<P>
-If this bit is set, a dollar metacharacter in the pattern matches only at the
-end of the subject string. Without this option, a dollar also matches
-immediately before the final character if it is a newline (but not before any
-other newlines). The PCRE_DOLLAR_ENDONLY option is ignored if PCRE_MULTILINE is
-set. There is no equivalent to this option in Perl.
-</P>
-<P>
-<PRE>
- PCRE_DOTALL
-</PRE>
-</P>
-<P>
-If this bit is set, a dot metacharater in the pattern matches all characters,
-including newlines. Without it, newlines are excluded. This option is
-equivalent to Perl's /s option. A negative class such as [^a] always matches a
-newline character, independent of the setting of this option.
-</P>
-<P>
-<PRE>
- PCRE_EXTENDED
-</PRE>
-</P>
-<P>
-If this bit is set, whitespace data characters in the pattern are totally
-ignored except when escaped or inside a character class, and characters between
-an unescaped # outside a character class and the next newline character,
-inclusive, are also ignored. This is equivalent to Perl's /x option, and makes
-it possible to include comments inside complicated patterns. Note, however,
-that this applies only to data characters. Whitespace characters may never
-appear within special character sequences in a pattern, for example within the
-sequence (?( which introduces a conditional subpattern.
-</P>
-<P>
-<PRE>
- PCRE_EXTRA
-</PRE>
-</P>
-<P>
-This option was invented in order to turn on additional functionality of PCRE
-that is incompatible with Perl, but it is currently of very little use. When
-set, any backslash in a pattern that is followed by a letter that has no
-special meaning causes an error, thus reserving these combinations for future
-expansion. By default, as in Perl, a backslash followed by a letter with no
-special meaning is treated as a literal. There are at present no other features
-controlled by this option. It can also be set by a (?X) option setting within a
-pattern.
-</P>
-<P>
-<PRE>
- PCRE_MULTILINE
-</PRE>
-</P>
-<P>
-By default, PCRE treats the subject string as consisting of a single "line" of
-characters (even if it actually contains several newlines). The "start of line"
-metacharacter (^) matches only at the start of the string, while the "end of
-line" metacharacter ($) matches only at the end of the string, or before a
-terminating newline (unless PCRE_DOLLAR_ENDONLY is set). This is the same as
-Perl.
-</P>
-<P>
-When PCRE_MULTILINE it is set, the "start of line" and "end of line" constructs
-match immediately following or immediately before any newline in the subject
-string, respectively, as well as at the very start and end. This is equivalent
-to Perl's /m option. If there are no "\n" characters in a subject string, or
-no occurrences of ^ or $ in a pattern, setting PCRE_MULTILINE has no
-effect.
-</P>
-<P>
-<PRE>
- PCRE_UNGREEDY
-</PRE>
-</P>
-<P>
-This option inverts the "greediness" of the quantifiers so that they are not
-greedy by default, but become greedy if followed by "?". It is not compatible
-with Perl. It can also be set by a (?U) option setting within the pattern.
-</P>
-<P>
-<PRE>
- PCRE_UTF8
-</PRE>
-</P>
-<P>
-This option causes PCRE to regard both the pattern and the subject as strings
-of UTF-8 characters instead of just byte strings. However, it is available only
-if PCRE has been built to include UTF-8 support. If not, the use of this option
-provokes an error. Support for UTF-8 is new, experimental, and incomplete.
-Details of exactly what it entails are given below.
-</P>
-<LI><A NAME="SEC6" HREF="#TOC1">STUDYING A PATTERN</A>
-<P>
-When a pattern is going to be used several times, it is worth spending more
-time analyzing it in order to speed up the time taken for matching. The
-function <B>pcre_study()</B> takes a pointer to a compiled pattern as its first
-argument, and returns a pointer to a <B>pcre_extra</B> block (another <B>void</B>
-typedef) containing additional information about the pattern; this can be
-passed to <B>pcre_exec()</B>. If no additional information is available, NULL
-is returned.
-</P>
-<P>
-The second argument contains option bits. At present, no options are defined
-for <B>pcre_study()</B>, and this argument should always be zero.
-</P>
-<P>
-The third argument for <B>pcre_study()</B> is a pointer to an error message. If
-studying succeeds (even if no data is returned), the variable it points to is
-set to NULL. Otherwise it points to a textual error message.
-</P>
-<P>
-At present, studying a pattern is useful only for non-anchored patterns that do
-not have a single fixed starting character. A bitmap of possible starting
-characters is created.
-</P>
-<LI><A NAME="SEC7" HREF="#TOC1">LOCALE SUPPORT</A>
-<P>
-PCRE handles caseless matching, and determines whether characters are letters,
-digits, or whatever, by reference to a set of tables. The library contains a
-default set of tables which is created in the default C locale when PCRE is
-compiled. This is used when the final argument of <B>pcre_compile()</B> is NULL,
-and is sufficient for many applications.
-</P>
-<P>
-An alternative set of tables can, however, be supplied. Such tables are built
-by calling the <B>pcre_maketables()</B> function, which has no arguments, in the
-relevant locale. The result can then be passed to <B>pcre_compile()</B> as often
-as necessary. For example, to build and use tables that are appropriate for the
-French locale (where accented characters with codes greater than 128 are
-treated as letters), the following code could be used:
-</P>
-<P>
-<PRE>
- setlocale(LC_CTYPE, "fr");
- tables = pcre_maketables();
- re = pcre_compile(..., tables);
-</PRE>
-</P>
-<P>
-The tables are built in memory that is obtained via <B>pcre_malloc</B>. The
-pointer that is passed to <B>pcre_compile</B> is saved with the compiled
-pattern, and the same tables are used via this pointer by <B>pcre_study()</B>
-and <B>pcre_exec()</B>. Thus for any single pattern, compilation, studying and
-matching all happen in the same locale, but different patterns can be compiled
-in different locales. It is the caller's responsibility to ensure that the
-memory containing the tables remains available for as long as it is needed.
-</P>
-<LI><A NAME="SEC8" HREF="#TOC1">INFORMATION ABOUT A PATTERN</A>
-<P>
-The <B>pcre_fullinfo()</B> function returns information about a compiled
-pattern. It replaces the obsolete <B>pcre_info()</B> function, which is
-nevertheless retained for backwards compability (and is documented below).
-</P>
-<P>
-The first argument for <B>pcre_fullinfo()</B> is a pointer to the compiled
-pattern. The second argument is the result of <B>pcre_study()</B>, or NULL if
-the pattern was not studied. The third argument specifies which piece of
-information is required, while the fourth argument is a pointer to a variable
-to receive the data. The yield of the function is zero for success, or one of
-the following negative numbers:
-</P>
-<P>
-<PRE>
- PCRE_ERROR_NULL the argument <I>code</I> was NULL
- the argument <I>where</I> was NULL
- PCRE_ERROR_BADMAGIC the "magic number" was not found
- PCRE_ERROR_BADOPTION the value of <I>what</I> was invalid
-</PRE>
-</P>
-<P>
-The possible values for the third argument are defined in <B>pcre.h</B>, and are
-as follows:
-</P>
-<P>
-<PRE>
- PCRE_INFO_OPTIONS
-</PRE>
-</P>
-<P>
-Return a copy of the options with which the pattern was compiled. The fourth
-argument should point to au <B>unsigned long int</B> variable. These option bits
-are those specified in the call to <B>pcre_compile()</B>, modified by any
-top-level option settings within the pattern itself, and with the PCRE_ANCHORED
-bit forcibly set if the form of the pattern implies that it can match only at
-the start of a subject string.
-</P>
-<P>
-<PRE>
- PCRE_INFO_SIZE
-</PRE>
-</P>
-<P>
-Return the size of the compiled pattern, that is, the value that was passed as
-the argument to <B>pcre_malloc()</B> when PCRE was getting memory in which to
-place the compiled data. The fourth argument should point to a <B>size_t</B>
-variable.
-</P>
-<P>
-<PRE>
- PCRE_INFO_CAPTURECOUNT
-</PRE>
-</P>
-<P>
-Return the number of capturing subpatterns in the pattern. The fourth argument
-should point to an \fbint\fR variable.
-</P>
-<P>
-<PRE>
- PCRE_INFO_BACKREFMAX
-</PRE>
-</P>
-<P>
-Return the number of the highest back reference in the pattern. The fourth
-argument should point to an <B>int</B> variable. Zero is returned if there are
-no back references.
-</P>
-<P>
-<PRE>
- PCRE_INFO_FIRSTCHAR
-</PRE>
-</P>
-<P>
-Return information about the first character of any matched string, for a
-non-anchored pattern. If there is a fixed first character, e.g. from a pattern
-such as (cat|cow|coyote), it is returned in the integer pointed to by
-<I>where</I>. Otherwise, if either
-</P>
-<P>
-(a) the pattern was compiled with the PCRE_MULTILINE option, and every branch
-starts with "^", or
-</P>
-<P>
-(b) every branch of the pattern starts with ".*" and PCRE_DOTALL is not set
-(if it were set, the pattern would be anchored),
-</P>
-<P>
--1 is returned, indicating that the pattern matches only at the start of a
-subject string or after any "\n" within the string. Otherwise -2 is returned.
-For anchored patterns, -2 is returned.
-</P>
-<P>
-<PRE>
- PCRE_INFO_FIRSTTABLE
-</PRE>
-</P>
-<P>
-If the pattern was studied, and this resulted in the construction of a 256-bit
-table indicating a fixed set of characters for the first character in any
-matching string, a pointer to the table is returned. Otherwise NULL is
-returned. The fourth argument should point to an <B>unsigned char *</B>
-variable.
-</P>
-<P>
-<PRE>
- PCRE_INFO_LASTLITERAL
-</PRE>
-</P>
-<P>
-For a non-anchored pattern, return the value of the rightmost literal character
-which must exist in any matched string, other than at its start. The fourth
-argument should point to an <B>int</B> variable. If there is no such character,
-or if the pattern is anchored, -1 is returned. For example, for the pattern
-/a\d+z\d+/ the returned value is 'z'.
-</P>
-<P>
-The <B>pcre_info()</B> function is now obsolete because its interface is too
-restrictive to return all the available data about a compiled pattern. New
-programs should use <B>pcre_fullinfo()</B> instead. The yield of
-<B>pcre_info()</B> is the number of capturing subpatterns, or one of the
-following negative numbers:
-</P>
-<P>
-<PRE>
- PCRE_ERROR_NULL the argument <I>code</I> was NULL
- PCRE_ERROR_BADMAGIC the "magic number" was not found
-</PRE>
-</P>
-<P>
-If the <I>optptr</I> argument is not NULL, a copy of the options with which the
-pattern was compiled is placed in the integer it points to (see
-PCRE_INFO_OPTIONS above).
-</P>
-<P>
-If the pattern is not anchored and the <I>firstcharptr</I> argument is not NULL,
-it is used to pass back information about the first character of any matched
-string (see PCRE_INFO_FIRSTCHAR above).
-</P>
-<LI><A NAME="SEC9" HREF="#TOC1">MATCHING A PATTERN</A>
-<P>
-The function <B>pcre_exec()</B> is called to match a subject string against a
-pre-compiled pattern, which is passed in the <I>code</I> argument. If the
-pattern has been studied, the result of the study should be passed in the
-<I>extra</I> argument. Otherwise this must be NULL.
-</P>
-<P>
-The PCRE_ANCHORED option can be passed in the <I>options</I> argument, whose
-unused bits must be zero. However, if a pattern was compiled with
-PCRE_ANCHORED, or turned out to be anchored by virtue of its contents, it
-cannot be made unachored at matching time.
-</P>
-<P>
-There are also three further options that can be set only at matching time:
-</P>
-<P>
-<PRE>
- PCRE_NOTBOL
-</PRE>
-</P>
-<P>
-The first character of the string is not the beginning of a line, so the
-circumflex metacharacter should not match before it. Setting this without
-PCRE_MULTILINE (at compile time) causes circumflex never to match.
-</P>
-<P>
-<PRE>
- PCRE_NOTEOL
-</PRE>
-</P>
-<P>
-The end of the string is not the end of a line, so the dollar metacharacter
-should not match it nor (except in multiline mode) a newline immediately before
-it. Setting this without PCRE_MULTILINE (at compile time) causes dollar never
-to match.
-</P>
-<P>
-<PRE>
- PCRE_NOTEMPTY
-</PRE>
-</P>
-<P>
-An empty string is not considered to be a valid match if this option is set. If
-there are alternatives in the pattern, they are tried. If all the alternatives
-match the empty string, the entire match fails. For example, if the pattern
-</P>
-<P>
-<PRE>
- a?b?
-</PRE>
-</P>
-<P>
-is applied to a string not beginning with "a" or "b", it matches the empty
-string at the start of the subject. With PCRE_NOTEMPTY set, this match is not
-valid, so PCRE searches further into the string for occurrences of "a" or "b".
-</P>
-<P>
-Perl has no direct equivalent of PCRE_NOTEMPTY, but it does make a special case
-of a pattern match of the empty string within its <B>split()</B> function, and
-when using the /g modifier. It is possible to emulate Perl's behaviour after
-matching a null string by first trying the match again at the same offset with
-PCRE_NOTEMPTY set, and then if that fails by advancing the starting offset (see
-below) and trying an ordinary match again.
-</P>
-<P>
-The subject string is passed as a pointer in <I>subject</I>, a length in
-<I>length</I>, and a starting offset in <I>startoffset</I>. Unlike the pattern
-string, it may contain binary zero characters. When the starting offset is
-zero, the search for a match starts at the beginning of the subject, and this
-is by far the most common case.
-</P>
-<P>
-A non-zero starting offset is useful when searching for another match in the
-same subject by calling <B>pcre_exec()</B> again after a previous success.
-Setting <I>startoffset</I> differs from just passing over a shortened string and
-setting PCRE_NOTBOL in the case of a pattern that begins with any kind of
-lookbehind. For example, consider the pattern
-</P>
-<P>
-<PRE>
- \Biss\B
-</PRE>
-</P>
-<P>
-which finds occurrences of "iss" in the middle of words. (\B matches only if
-the current position in the subject is not a word boundary.) When applied to
-the string "Mississipi" the first call to <B>pcre_exec()</B> finds the first
-occurrence. If <B>pcre_exec()</B> is called again with just the remainder of the
-subject, namely "issipi", it does not match, because \B is always false at the
-start of the subject, which is deemed to be a word boundary. However, if
-<B>pcre_exec()</B> is passed the entire string again, but with <I>startoffset</I>
-set to 4, it finds the second occurrence of "iss" because it is able to look
-behind the starting point to discover that it is preceded by a letter.
-</P>
-<P>
-If a non-zero starting offset is passed when the pattern is anchored, one
-attempt to match at the given offset is tried. This can only succeed if the
-pattern does not require the match to be at the start of the subject.
-</P>
-<P>
-In general, a pattern matches a certain portion of the subject, and in
-addition, further substrings from the subject may be picked out by parts of the
-pattern. Following the usage in Jeffrey Friedl's book, this is called
-"capturing" in what follows, and the phrase "capturing subpattern" is used for
-a fragment of a pattern that picks out a substring. PCRE supports several other
-kinds of parenthesized subpattern that do not cause substrings to be captured.
-</P>
-<P>
-Captured substrings are returned to the caller via a vector of integer offsets
-whose address is passed in <I>ovector</I>. The number of elements in the vector
-is passed in <I>ovecsize</I>. The first two-thirds of the vector is used to pass
-back captured substrings, each substring using a pair of integers. The
-remaining third of the vector is used as workspace by <B>pcre_exec()</B> while
-matching capturing subpatterns, and is not available for passing back
-information. The length passed in <I>ovecsize</I> should always be a multiple of
-three. If it is not, it is rounded down.
-</P>
-<P>
-When a match has been successful, information about captured substrings is
-returned in pairs of integers, starting at the beginning of <I>ovector</I>, and
-continuing up to two-thirds of its length at the most. The first element of a
-pair is set to the offset of the first character in a substring, and the second
-is set to the offset of the first character after the end of a substring. The
-first pair, <I>ovector[0]</I> and <I>ovector[1]</I>, identify the portion of the
-subject string matched by the entire pattern. The next pair is used for the
-first capturing subpattern, and so on. The value returned by <B>pcre_exec()</B>
-is the number of pairs that have been set. If there are no capturing
-subpatterns, the return value from a successful match is 1, indicating that
-just the first pair of offsets has been set.
-</P>
-<P>
-Some convenience functions are provided for extracting the captured substrings
-as separate strings. These are described in the following section.
-</P>
-<P>
-It is possible for an capturing subpattern number <I>n+1</I> to match some
-part of the subject when subpattern <I>n</I> has not been used at all. For
-example, if the string "abc" is matched against the pattern (a|(z))(bc)
-subpatterns 1 and 3 are matched, but 2 is not. When this happens, both offset
-values corresponding to the unused subpattern are set to -1.
-</P>
-<P>
-If a capturing subpattern is matched repeatedly, it is the last portion of the
-string that it matched that gets returned.
-</P>
-<P>
-If the vector is too small to hold all the captured substrings, it is used as
-far as possible (up to two-thirds of its length), and the function returns a
-value of zero. In particular, if the substring offsets are not of interest,
-<B>pcre_exec()</B> may be called with <I>ovector</I> passed as NULL and
-<I>ovecsize</I> as zero. However, if the pattern contains back references and
-the <I>ovector</I> isn't big enough to remember the related substrings, PCRE has
-to get additional memory for use during matching. Thus it is usually advisable
-to supply an <I>ovector</I>.
-</P>
-<P>
-Note that <B>pcre_info()</B> can be used to find out how many capturing
-subpatterns there are in a compiled pattern. The smallest size for
-<I>ovector</I> that will allow for <I>n</I> captured substrings in addition to
-the offsets of the substring matched by the whole pattern is (<I>n</I>+1)*3.
-</P>
-<P>
-If <B>pcre_exec()</B> fails, it returns a negative number. The following are
-defined in the header file:
-</P>
-<P>
-<PRE>
- PCRE_ERROR_NOMATCH (-1)
-</PRE>
-</P>
-<P>
-The subject string did not match the pattern.
-</P>
-<P>
-<PRE>
- PCRE_ERROR_NULL (-2)
-</PRE>
-</P>
-<P>
-Either <I>code</I> or <I>subject</I> was passed as NULL, or <I>ovector</I> was
-NULL and <I>ovecsize</I> was not zero.
-</P>
-<P>
-<PRE>
- PCRE_ERROR_BADOPTION (-3)
-</PRE>
-</P>
-<P>
-An unrecognized bit was set in the <I>options</I> argument.
-</P>
-<P>
-<PRE>
- PCRE_ERROR_BADMAGIC (-4)
-</PRE>
-</P>
-<P>
-PCRE stores a 4-byte "magic number" at the start of the compiled code, to catch
-the case when it is passed a junk pointer. This is the error it gives when the
-magic number isn't present.
-</P>
-<P>
-<PRE>
- PCRE_ERROR_UNKNOWN_NODE (-5)
-</PRE>
-</P>
-<P>
-While running the pattern match, an unknown item was encountered in the
-compiled pattern. This error could be caused by a bug in PCRE or by overwriting
-of the compiled pattern.
-</P>
-<P>
-<PRE>
- PCRE_ERROR_NOMEMORY (-6)
-</PRE>
-</P>
-<P>
-If a pattern contains back references, but the <I>ovector</I> that is passed to
-<B>pcre_exec()</B> is not big enough to remember the referenced substrings, PCRE
-gets a block of memory at the start of matching to use for this purpose. If the
-call via <B>pcre_malloc()</B> fails, this error is given. The memory is freed at
-the end of matching.
-</P>
-<LI><A NAME="SEC10" HREF="#TOC1">EXTRACTING CAPTURED SUBSTRINGS</A>
-<P>
-Captured substrings can be accessed directly by using the offsets returned by
-<B>pcre_exec()</B> in <I>ovector</I>. For convenience, the functions
-<B>pcre_copy_substring()</B>, <B>pcre_get_substring()</B>, and
-<B>pcre_get_substring_list()</B> are provided for extracting captured substrings
-as new, separate, zero-terminated strings. A substring that contains a binary
-zero is correctly extracted and has a further zero added on the end, but the
-result does not, of course, function as a C string.
-</P>
-<P>
-The first three arguments are the same for all three functions: <I>subject</I>
-is the subject string which has just been successfully matched, <I>ovector</I>
-is a pointer to the vector of integer offsets that was passed to
-<B>pcre_exec()</B>, and <I>stringcount</I> is the number of substrings that
-were captured by the match, including the substring that matched the entire
-regular expression. This is the value returned by <B>pcre_exec</B> if it
-is greater than zero. If <B>pcre_exec()</B> returned zero, indicating that it
-ran out of space in <I>ovector</I>, the value passed as <I>stringcount</I> should
-be the size of the vector divided by three.
-</P>
-<P>
-The functions <B>pcre_copy_substring()</B> and <B>pcre_get_substring()</B>
-extract a single substring, whose number is given as <I>stringnumber</I>. A
-value of zero extracts the substring that matched the entire pattern, while
-higher values extract the captured substrings. For <B>pcre_copy_substring()</B>,
-the string is placed in <I>buffer</I>, whose length is given by
-<I>buffersize</I>, while for <B>pcre_get_substring()</B> a new block of memory is
-obtained via <B>pcre_malloc</B>, and its address is returned via
-<I>stringptr</I>. The yield of the function is the length of the string, not
-including the terminating zero, or one of
-</P>
-<P>
-<PRE>
- PCRE_ERROR_NOMEMORY (-6)
-</PRE>
-</P>
-<P>
-The buffer was too small for <B>pcre_copy_substring()</B>, or the attempt to get
-memory failed for <B>pcre_get_substring()</B>.
-</P>
-<P>
-<PRE>
- PCRE_ERROR_NOSUBSTRING (-7)
-</PRE>
-</P>
-<P>
-There is no substring whose number is <I>stringnumber</I>.
-</P>
-<P>
-The <B>pcre_get_substring_list()</B> function extracts all available substrings
-and builds a list of pointers to them. All this is done in a single block of
-memory which is obtained via <B>pcre_malloc</B>. The address of the memory block
-is returned via <I>listptr</I>, which is also the start of the list of string
-pointers. The end of the list is marked by a NULL pointer. The yield of the
-function is zero if all went well, or
-</P>
-<P>
-<PRE>
- PCRE_ERROR_NOMEMORY (-6)
-</PRE>
-</P>
-<P>
-if the attempt to get the memory block failed.
-</P>
-<P>
-When any of these functions encounter a substring that is unset, which can
-happen when capturing subpattern number <I>n+1</I> matches some part of the
-subject, but subpattern <I>n</I> has not been used at all, they return an empty
-string. This can be distinguished from a genuine zero-length substring by
-inspecting the appropriate offset in <I>ovector</I>, which is negative for unset
-substrings.
-</P>
-<P>
-The two convenience functions <B>pcre_free_substring()</B> and
-<B>pcre_free_substring_list()</B> can be used to free the memory returned by
-a previous call of <B>pcre_get_substring()</B> or
-<B>pcre_get_substring_list()</B>, respectively. They do nothing more than call
-the function pointed to by <B>pcre_free</B>, which of course could be called
-directly from a C program. However, PCRE is used in some situations where it is
-linked via a special interface to another programming language which cannot use
-<B>pcre_free</B> directly; it is for these cases that the functions are
-provided.
-</P>
-<LI><A NAME="SEC11" HREF="#TOC1">LIMITATIONS</A>
-<P>
-There are some size limitations in PCRE but it is hoped that they will never in
-practice be relevant.
-The maximum length of a compiled pattern is 65539 (sic) bytes.
-All values in repeating quantifiers must be less than 65536.
-The maximum number of capturing subpatterns is 99.
-The maximum number of all parenthesized subpatterns, including capturing
-subpatterns, assertions, and other types of subpattern, is 200.
-</P>
-<P>
-The maximum length of a subject string is the largest positive number that an
-integer variable can hold. However, PCRE uses recursion to handle subpatterns
-and indefinite repetition. This means that the available stack space may limit
-the size of a subject string that can be processed by certain patterns.
-</P>
-<LI><A NAME="SEC12" HREF="#TOC1">DIFFERENCES FROM PERL</A>
-<P>
-The differences described here are with respect to Perl 5.005.
-</P>
-<P>
-1. By default, a whitespace character is any character that the C library
-function <B>isspace()</B> recognizes, though it is possible to compile PCRE with
-alternative character type tables. Normally <B>isspace()</B> matches space,
-formfeed, newline, carriage return, horizontal tab, and vertical tab. Perl 5
-no longer includes vertical tab in its set of whitespace characters. The \v
-escape that was in the Perl documentation for a long time was never in fact
-recognized. However, the character itself was treated as whitespace at least
-up to 5.002. In 5.004 and 5.005 it does not match \s.
-</P>
-<P>
-2. PCRE does not allow repeat quantifiers on lookahead assertions. Perl permits
-them, but they do not mean what you might think. For example, (?!a){3} does
-not assert that the next three characters are not "a". It just asserts that the
-next character is not "a" three times.
-</P>
-<P>
-3. Capturing subpatterns that occur inside negative lookahead assertions are
-counted, but their entries in the offsets vector are never set. Perl sets its
-numerical variables from any such patterns that are matched before the
-assertion fails to match something (thereby succeeding), but only if the
-negative lookahead assertion contains just one branch.
-</P>
-<P>
-4. Though binary zero characters are supported in the subject string, they are
-not allowed in a pattern string because it is passed as a normal C string,
-terminated by zero. The escape sequence "\0" can be used in the pattern to
-represent a binary zero.
-</P>
-<P>
-5. The following Perl escape sequences are not supported: \l, \u, \L, \U,
-\E, \Q. In fact these are implemented by Perl's general string-handling and
-are not part of its pattern matching engine.
-</P>
-<P>
-6. The Perl \G assertion is not supported as it is not relevant to single
-pattern matches.
-</P>
-<P>
-7. Fairly obviously, PCRE does not support the (?{code}) and (?p{code})
-constructions. However, there is some experimental support for recursive
-patterns using the non-Perl item (?R).
-</P>
-<P>
-8. There are at the time of writing some oddities in Perl 5.005_02 concerned
-with the settings of captured strings when part of a pattern is repeated. For
-example, matching "aba" against the pattern /^(a(b)?)+$/ sets $2 to the value
-"b", but matching "aabbaa" against /^(aa(bb)?)+$/ leaves $2 unset. However, if
-the pattern is changed to /^(aa(b(b))?)+$/ then $2 (and $3) are set.
-</P>
-<P>
-In Perl 5.004 $2 is set in both cases, and that is also true of PCRE. If in the
-future Perl changes to a consistent state that is different, PCRE may change to
-follow.
-</P>
-<P>
-9. Another as yet unresolved discrepancy is that in Perl 5.005_02 the pattern
-/^(a)?(?(1)a|b)+$/ matches the string "a", whereas in PCRE it does not.
-However, in both Perl and PCRE /^(a)?a/ matched against "a" leaves $1 unset.
-</P>
-<P>
-10. PCRE provides some extensions to the Perl regular expression facilities:
-</P>
-<P>
-(a) Although lookbehind assertions must match fixed length strings, each
-alternative branch of a lookbehind assertion can match a different length of
-string. Perl 5.005 requires them all to have the same length.
-</P>
-<P>
-(b) If PCRE_DOLLAR_ENDONLY is set and PCRE_MULTILINE is not set, the $ meta-
-character matches only at the very end of the string.
-</P>
-<P>
-(c) If PCRE_EXTRA is set, a backslash followed by a letter with no special
-meaning is faulted.
-</P>
-<P>
-(d) If PCRE_UNGREEDY is set, the greediness of the repetition quantifiers is
-inverted, that is, by default they are not greedy, but if followed by a
-question mark they are.
-</P>
-<P>
-(e) PCRE_ANCHORED can be used to force a pattern to be tried only at the start
-of the subject.
-</P>
-<P>
-(f) The PCRE_NOTBOL, PCRE_NOTEOL, and PCRE_NOTEMPTY options for
-<B>pcre_exec()</B> have no Perl equivalents.
-</P>
-<P>
-(g) The (?R) construct allows for recursive pattern matching (Perl 5.6 can do
-this using the (?p{code}) construct, which PCRE cannot of course support.)
-</P>
-<LI><A NAME="SEC13" HREF="#TOC1">REGULAR EXPRESSION DETAILS</A>
-<P>
-The syntax and semantics of the regular expressions supported by PCRE are
-described below. Regular expressions are also described in the Perl
-documentation and in a number of other books, some of which have copious
-examples. Jeffrey Friedl's "Mastering Regular Expressions", published by
-O'Reilly (ISBN 1-56592-257), covers them in great detail.
-</P>
-<P>
-The description here is intended as reference documentation. The basic
-operation of PCRE is on strings of bytes. However, there is the beginnings of
-some support for UTF-8 character strings. To use this support you must
-configure PCRE to include it, and then call <B>pcre_compile()</B> with the
-PCRE_UTF8 option. How this affects the pattern matching is described in the
-final section of this document.
-</P>
-<P>
-A regular expression is a pattern that is matched against a subject string from
-left to right. Most characters stand for themselves in a pattern, and match the
-corresponding characters in the subject. As a trivial example, the pattern
-</P>
-<P>
-<PRE>
- The quick brown fox
-</PRE>
-</P>
-<P>
-matches a portion of a subject string that is identical to itself. The power of
-regular expressions comes from the ability to include alternatives and
-repetitions in the pattern. These are encoded in the pattern by the use of
-<I>meta-characters</I>, which do not stand for themselves but instead are
-interpreted in some special way.
-</P>
-<P>
-There are two different sets of meta-characters: those that are recognized
-anywhere in the pattern except within square brackets, and those that are
-recognized in square brackets. Outside square brackets, the meta-characters are
-as follows:
-</P>
-<P>
-<PRE>
- \ general escape character with several uses
- ^ assert start of subject (or line, in multiline mode)
- $ assert end of subject (or line, in multiline mode)
- . match any character except newline (by default)
- [ start character class definition
- | start of alternative branch
- ( start subpattern
- ) end subpattern
- ? extends the meaning of (
- also 0 or 1 quantifier
- also quantifier minimizer
- * 0 or more quantifier
- + 1 or more quantifier
- { start min/max quantifier
-</PRE>
-</P>
-<P>
-Part of a pattern that is in square brackets is called a "character class". In
-a character class the only meta-characters are:
-</P>
-<P>
-<PRE>
- \ general escape character
- ^ negate the class, but only if the first character
- - indicates character range
- ] terminates the character class
-</PRE>
-</P>
-<P>
-The following sections describe the use of each of the meta-characters.
-</P>
-<LI><A NAME="SEC14" HREF="#TOC1">BACKSLASH</A>
-<P>
-The backslash character has several uses. Firstly, if it is followed by a
-non-alphameric character, it takes away any special meaning that character may
-have. This use of backslash as an escape character applies both inside and
-outside character classes.
-</P>
-<P>
-For example, if you want to match a "*" character, you write "\*" in the
-pattern. This applies whether or not the following character would otherwise be
-interpreted as a meta-character, so it is always safe to precede a
-non-alphameric with "\" to specify that it stands for itself. In particular,
-if you want to match a backslash, you write "\\".
-</P>
-<P>
-If a pattern is compiled with the PCRE_EXTENDED option, whitespace in the
-pattern (other than in a character class) and characters between a "#" outside
-a character class and the next newline character are ignored. An escaping
-backslash can be used to include a whitespace or "#" character as part of the
-pattern.
-</P>
-<P>
-A second use of backslash provides a way of encoding non-printing characters
-in patterns in a visible manner. There is no restriction on the appearance of
-non-printing characters, apart from the binary zero that terminates a pattern,
-but when a pattern is being prepared by text editing, it is usually easier to
-use one of the following escape sequences than the binary character it
-represents:
-</P>
-<P>
-<PRE>
- \a alarm, that is, the BEL character (hex 07)
- \cx "control-x", where x is any character
- \e escape (hex 1B)
- \f formfeed (hex 0C)
- \n newline (hex 0A)
- \r carriage return (hex 0D)
- \t tab (hex 09)
- \xhh character with hex code hh
- \ddd character with octal code ddd, or backreference
-</PRE>
-</P>
-<P>
-The precise effect of "\cx" is as follows: if "x" is a lower case letter, it
-is converted to upper case. Then bit 6 of the character (hex 40) is inverted.
-Thus "\cz" becomes hex 1A, but "\c{" becomes hex 3B, while "\c;" becomes hex
-7B.
-</P>
-<P>
-After "\x", up to two hexadecimal digits are read (letters can be in upper or
-lower case).
-</P>
-<P>
-After "\0" up to two further octal digits are read. In both cases, if there
-are fewer than two digits, just those that are present are used. Thus the
-sequence "\0\x\07" specifies two binary zeros followed by a BEL character.
-Make sure you supply two digits after the initial zero if the character that
-follows is itself an octal digit.
-</P>
-<P>
-The handling of a backslash followed by a digit other than 0 is complicated.
-Outside a character class, PCRE reads it and any following digits as a decimal
-number. If the number is less than 10, or if there have been at least that many
-previous capturing left parentheses in the expression, the entire sequence is
-taken as a <I>back reference</I>. A description of how this works is given
-later, following the discussion of parenthesized subpatterns.
-</P>
-<P>
-Inside a character class, or if the decimal number is greater than 9 and there
-have not been that many capturing subpatterns, PCRE re-reads up to three octal
-digits following the backslash, and generates a single byte from the least
-significant 8 bits of the value. Any subsequent digits stand for themselves.
-For example:
-</P>
-<P>
-<PRE>
- \040 is another way of writing a space
- \40 is the same, provided there are fewer than 40
- previous capturing subpatterns
- \7 is always a back reference
- \11 might be a back reference, or another way of
- writing a tab
- \011 is always a tab
- \0113 is a tab followed by the character "3"
- \113 is the character with octal code 113 (since there
- can be no more than 99 back references)
- \377 is a byte consisting entirely of 1 bits
- \81 is either a back reference, or a binary zero
- followed by the two characters "8" and "1"
-</PRE>
-</P>
-<P>
-Note that octal values of 100 or greater must not be introduced by a leading
-zero, because no more than three octal digits are ever read.
-</P>
-<P>
-All the sequences that define a single byte value can be used both inside and
-outside character classes. In addition, inside a character class, the sequence
-"\b" is interpreted as the backspace character (hex 08). Outside a character
-class it has a different meaning (see below).
-</P>
-<P>
-The third use of backslash is for specifying generic character types:
-</P>
-<P>
-<PRE>
- \d any decimal digit
- \D any character that is not a decimal digit
- \s any whitespace character
- \S any character that is not a whitespace character
- \w any "word" character
- \W any "non-word" character
-</PRE>
-</P>
-<P>
-Each pair of escape sequences partitions the complete set of characters into
-two disjoint sets. Any given character matches one, and only one, of each pair.
-</P>
-<P>
-A "word" character is any letter or digit or the underscore character, that is,
-any character which can be part of a Perl "word". The definition of letters and
-digits is controlled by PCRE's character tables, and may vary if locale-
-specific matching is taking place (see "Locale support" above). For example, in
-the "fr" (French) locale, some character codes greater than 128 are used for
-accented letters, and these are matched by \w.
-</P>
-<P>
-These character type sequences can appear both inside and outside character
-classes. They each match one character of the appropriate type. If the current
-matching point is at the end of the subject string, all of them fail, since
-there is no character to match.
-</P>
-<P>
-The fourth use of backslash is for certain simple assertions. An assertion
-specifies a condition that has to be met at a particular point in a match,
-without consuming any characters from the subject string. The use of
-subpatterns for more complicated assertions is described below. The backslashed
-assertions are
-</P>
-<P>
-<PRE>
- \b word boundary
- \B not a word boundary
- \A start of subject (independent of multiline mode)
- \Z end of subject or newline at end (independent of multiline mode)
- \z end of subject (independent of multiline mode)
-</PRE>
-</P>
-<P>
-These assertions may not appear in character classes (but note that "\b" has a
-different meaning, namely the backspace character, inside a character class).
-</P>
-<P>
-A word boundary is a position in the subject string where the current character
-and the previous character do not both match \w or \W (i.e. one matches
-\w and the other matches \W), or the start or end of the string if the
-first or last character matches \w, respectively.
-</P>
-<P>
-The \A, \Z, and \z assertions differ from the traditional circumflex and
-dollar (described below) in that they only ever match at the very start and end
-of the subject string, whatever options are set. They are not affected by the
-PCRE_NOTBOL or PCRE_NOTEOL options. If the <I>startoffset</I> argument of
-<B>pcre_exec()</B> is non-zero, \A can never match. The difference between \Z
-and \z is that \Z matches before a newline that is the last character of the
-string as well as at the end of the string, whereas \z matches only at the
-end.
-</P>
-<LI><A NAME="SEC15" HREF="#TOC1">CIRCUMFLEX AND DOLLAR</A>
-<P>
-Outside a character class, in the default matching mode, the circumflex
-character is an assertion which is true only if the current matching point is
-at the start of the subject string. If the <I>startoffset</I> argument of
-<B>pcre_exec()</B> is non-zero, circumflex can never match. Inside a character
-class, circumflex has an entirely different meaning (see below).
-</P>
-<P>
-Circumflex need not be the first character of the pattern if a number of
-alternatives are involved, but it should be the first thing in each alternative
-in which it appears if the pattern is ever to match that branch. If all
-possible alternatives start with a circumflex, that is, if the pattern is
-constrained to match only at the start of the subject, it is said to be an
-"anchored" pattern. (There are also other constructs that can cause a pattern
-to be anchored.)
-</P>
-<P>
-A dollar character is an assertion which is true only if the current matching
-point is at the end of the subject string, or immediately before a newline
-character that is the last character in the string (by default). Dollar need
-not be the last character of the pattern if a number of alternatives are
-involved, but it should be the last item in any branch in which it appears.
-Dollar has no special meaning in a character class.
-</P>
-<P>
-The meaning of dollar can be changed so that it matches only at the very end of
-the string, by setting the PCRE_DOLLAR_ENDONLY option at compile or matching
-time. This does not affect the \Z assertion.
-</P>
-<P>
-The meanings of the circumflex and dollar characters are changed if the
-PCRE_MULTILINE option is set. When this is the case, they match immediately
-after and immediately before an internal "\n" character, respectively, in
-addition to matching at the start and end of the subject string. For example,
-the pattern /^abc$/ matches the subject string "def\nabc" in multiline mode,
-but not otherwise. Consequently, patterns that are anchored in single line mode
-because all branches start with "^" are not anchored in multiline mode, and a
-match for circumflex is possible when the <I>startoffset</I> argument of
-<B>pcre_exec()</B> is non-zero. The PCRE_DOLLAR_ENDONLY option is ignored if
-PCRE_MULTILINE is set.
-</P>
-<P>
-Note that the sequences \A, \Z, and \z can be used to match the start and
-end of the subject in both modes, and if all branches of a pattern start with
-\A is it always anchored, whether PCRE_MULTILINE is set or not.
-</P>
-<LI><A NAME="SEC16" HREF="#TOC1">FULL STOP (PERIOD, DOT)</A>
-<P>
-Outside a character class, a dot in the pattern matches any one character in
-the subject, including a non-printing character, but not (by default) newline.
-If the PCRE_DOTALL option is set, dots match newlines as well. The handling of
-dot is entirely independent of the handling of circumflex and dollar, the only
-relationship being that they both involve newline characters. Dot has no
-special meaning in a character class.
-</P>
-<LI><A NAME="SEC17" HREF="#TOC1">SQUARE BRACKETS</A>
-<P>
-An opening square bracket introduces a character class, terminated by a closing
-square bracket. A closing square bracket on its own is not special. If a
-closing square bracket is required as a member of the class, it should be the
-first data character in the class (after an initial circumflex, if present) or
-escaped with a backslash.
-</P>
-<P>
-A character class matches a single character in the subject; the character must
-be in the set of characters defined by the class, unless the first character in
-the class is a circumflex, in which case the subject character must not be in
-the set defined by the class. If a circumflex is actually required as a member
-of the class, ensure it is not the first character, or escape it with a
-backslash.
-</P>
-<P>
-For example, the character class [aeiou] matches any lower case vowel, while
-[^aeiou] matches any character that is not a lower case vowel. Note that a
-circumflex is just a convenient notation for specifying the characters which
-are in the class by enumerating those that are not. It is not an assertion: it
-still consumes a character from the subject string, and fails if the current
-pointer is at the end of the string.
-</P>
-<P>
-When caseless matching is set, any letters in a class represent both their
-upper case and lower case versions, so for example, a caseless [aeiou] matches
-"A" as well as "a", and a caseless [^aeiou] does not match "A", whereas a
-caseful version would.
-</P>
-<P>
-The newline character is never treated in any special way in character classes,
-whatever the setting of the PCRE_DOTALL or PCRE_MULTILINE options is. A class
-such as [^a] will always match a newline.
-</P>
-<P>
-The minus (hyphen) character can be used to specify a range of characters in a
-character class. For example, [d-m] matches any letter between d and m,
-inclusive. If a minus character is required in a class, it must be escaped with
-a backslash or appear in a position where it cannot be interpreted as
-indicating a range, typically as the first or last character in the class.
-</P>
-<P>
-It is not possible to have the literal character "]" as the end character of a
-range. A pattern such as [W-]46] is interpreted as a class of two characters
-("W" and "-") followed by a literal string "46]", so it would match "W46]" or
-"-46]". However, if the "]" is escaped with a backslash it is interpreted as
-the end of range, so [W-\]46] is interpreted as a single class containing a
-range followed by two separate characters. The octal or hexadecimal
-representation of "]" can also be used to end a range.
-</P>
-<P>
-Ranges operate in ASCII collating sequence. They can also be used for
-characters specified numerically, for example [\000-\037]. If a range that
-includes letters is used when caseless matching is set, it matches the letters
-in either case. For example, [W-c] is equivalent to [][\^_`wxyzabc], matched
-caselessly, and if character tables for the "fr" locale are in use,
-[\xc8-\xcb] matches accented E characters in both cases.
-</P>
-<P>
-The character types \d, \D, \s, \S, \w, and \W may also appear in a
-character class, and add the characters that they match to the class. For
-example, [\dABCDEF] matches any hexadecimal digit. A circumflex can
-conveniently be used with the upper case character types to specify a more
-restricted set of characters than the matching lower case type. For example,
-the class [^\W_] matches any letter or digit, but not underscore.
-</P>
-<P>
-All non-alphameric characters other than \, -, ^ (at the start) and the
-terminating ] are non-special in character classes, but it does no harm if they
-are escaped.
-</P>
-<LI><A NAME="SEC18" HREF="#TOC1">POSIX CHARACTER CLASSES</A>
-<P>
-Perl 5.6 (not yet released at the time of writing) is going to support the
-POSIX notation for character classes, which uses names enclosed by [: and :]
-within the enclosing square brackets. PCRE supports this notation. For example,
-</P>
-<P>
-<PRE>
- [01[:alpha:]%]
-</PRE>
-</P>
-<P>
-matches "0", "1", any alphabetic character, or "%". The supported class names
-are
-</P>
-<P>
-<PRE>
- alnum letters and digits
- alpha letters
- ascii character codes 0 - 127
- cntrl control characters
- digit decimal digits (same as \d)
- graph printing characters, excluding space
- lower lower case letters
- print printing characters, including space
- punct printing characters, excluding letters and digits
- space white space (same as \s)
- upper upper case letters
- word "word" characters (same as \w)
- xdigit hexadecimal digits
-</PRE>
-</P>
-<P>
-The names "ascii" and "word" are Perl extensions. Another Perl extension is
-negation, which is indicated by a ^ character after the colon. For example,
-</P>
-<P>
-<PRE>
- [12[:^digit:]]
-</PRE>
-</P>
-<P>
-matches "1", "2", or any non-digit. PCRE (and Perl) also recogize the POSIX
-syntax [.ch.] and [=ch=] where "ch" is a "collating element", but these are not
-supported, and an error is given if they are encountered.
-</P>
-<LI><A NAME="SEC19" HREF="#TOC1">VERTICAL BAR</A>
-<P>
-Vertical bar characters are used to separate alternative patterns. For example,
-the pattern
-</P>
-<P>
-<PRE>
- gilbert|sullivan
-</PRE>
-</P>
-<P>
-matches either "gilbert" or "sullivan". Any number of alternatives may appear,
-and an empty alternative is permitted (matching the empty string).
-The matching process tries each alternative in turn, from left to right,
-and the first one that succeeds is used. If the alternatives are within a
-subpattern (defined below), "succeeds" means matching the rest of the main
-pattern as well as the alternative in the subpattern.
-</P>
-<LI><A NAME="SEC20" HREF="#TOC1">INTERNAL OPTION SETTING</A>
-<P>
-The settings of PCRE_CASELESS, PCRE_MULTILINE, PCRE_DOTALL, and PCRE_EXTENDED
-can be changed from within the pattern by a sequence of Perl option letters
-enclosed between "(?" and ")". The option letters are
-</P>
-<P>
-<PRE>
- i for PCRE_CASELESS
- m for PCRE_MULTILINE
- s for PCRE_DOTALL
- x for PCRE_EXTENDED
-</PRE>
-</P>
-<P>
-For example, (?im) sets caseless, multiline matching. It is also possible to
-unset these options by preceding the letter with a hyphen, and a combined
-setting and unsetting such as (?im-sx), which sets PCRE_CASELESS and
-PCRE_MULTILINE while unsetting PCRE_DOTALL and PCRE_EXTENDED, is also
-permitted. If a letter appears both before and after the hyphen, the option is
-unset.
-</P>
-<P>
-The scope of these option changes depends on where in the pattern the setting
-occurs. For settings that are outside any subpattern (defined below), the
-effect is the same as if the options were set or unset at the start of
-matching. The following patterns all behave in exactly the same way:
-</P>
-<P>
-<PRE>
- (?i)abc
- a(?i)bc
- ab(?i)c
- abc(?i)
-</PRE>
-</P>
-<P>
-which in turn is the same as compiling the pattern abc with PCRE_CASELESS set.
-In other words, such "top level" settings apply to the whole pattern (unless
-there are other changes inside subpatterns). If there is more than one setting
-of the same option at top level, the rightmost setting is used.
-</P>
-<P>
-If an option change occurs inside a subpattern, the effect is different. This
-is a change of behaviour in Perl 5.005. An option change inside a subpattern
-affects only that part of the subpattern that follows it, so
-</P>
-<P>
-<PRE>
- (a(?i)b)c
-</PRE>
-</P>
-<P>
-matches abc and aBc and no other strings (assuming PCRE_CASELESS is not used).
-By this means, options can be made to have different settings in different
-parts of the pattern. Any changes made in one alternative do carry on
-into subsequent branches within the same subpattern. For example,
-</P>
-<P>
-<PRE>
- (a(?i)b|c)
-</PRE>
-</P>
-<P>
-matches "ab", "aB", "c", and "C", even though when matching "C" the first
-branch is abandoned before the option setting. This is because the effects of
-option settings happen at compile time. There would be some very weird
-behaviour otherwise.
-</P>
-<P>
-The PCRE-specific options PCRE_UNGREEDY and PCRE_EXTRA can be changed in the
-same way as the Perl-compatible options by using the characters U and X
-respectively. The (?X) flag setting is special in that it must always occur
-earlier in the pattern than any of the additional features it turns on, even
-when it is at top level. It is best put at the start.
-</P>
-<LI><A NAME="SEC21" HREF="#TOC1">SUBPATTERNS</A>
-<P>
-Subpatterns are delimited by parentheses (round brackets), which can be nested.
-Marking part of a pattern as a subpattern does two things:
-</P>
-<P>
-1. It localizes a set of alternatives. For example, the pattern
-</P>
-<P>
-<PRE>
- cat(aract|erpillar|)
-</PRE>
-</P>
-<P>
-matches one of the words "cat", "cataract", or "caterpillar". Without the
-parentheses, it would match "cataract", "erpillar" or the empty string.
-</P>
-<P>
-2. It sets up the subpattern as a capturing subpattern (as defined above).
-When the whole pattern matches, that portion of the subject string that matched
-the subpattern is passed back to the caller via the <I>ovector</I> argument of
-<B>pcre_exec()</B>. Opening parentheses are counted from left to right (starting
-from 1) to obtain the numbers of the capturing subpatterns.
-</P>
-<P>
-For example, if the string "the red king" is matched against the pattern
-</P>
-<P>
-<PRE>
- the ((red|white) (king|queen))
-</PRE>
-</P>
-<P>
-the captured substrings are "red king", "red", and "king", and are numbered 1,
-2, and 3.
-</P>
-<P>
-The fact that plain parentheses fulfil two functions is not always helpful.
-There are often times when a grouping subpattern is required without a
-capturing requirement. If an opening parenthesis is followed by "?:", the
-subpattern does not do any capturing, and is not counted when computing the
-number of any subsequent capturing subpatterns. For example, if the string "the
-white queen" is matched against the pattern
-</P>
-<P>
-<PRE>
- the ((?:red|white) (king|queen))
-</PRE>
-</P>
-<P>
-the captured substrings are "white queen" and "queen", and are numbered 1 and
-2. The maximum number of captured substrings is 99, and the maximum number of
-all subpatterns, both capturing and non-capturing, is 200.
-</P>
-<P>
-As a convenient shorthand, if any option settings are required at the start of
-a non-capturing subpattern, the option letters may appear between the "?" and
-the ":". Thus the two patterns
-</P>
-<P>
-<PRE>
- (?i:saturday|sunday)
- (?:(?i)saturday|sunday)
-</PRE>
-</P>
-<P>
-match exactly the same set of strings. Because alternative branches are tried
-from left to right, and options are not reset until the end of the subpattern
-is reached, an option setting in one branch does affect subsequent branches, so
-the above patterns match "SUNDAY" as well as "Saturday".
-</P>
-<LI><A NAME="SEC22" HREF="#TOC1">REPETITION</A>
-<P>
-Repetition is specified by quantifiers, which can follow any of the following
-items:
-</P>
-<P>
-<PRE>
- a single character, possibly escaped
- the . metacharacter
- a character class
- a back reference (see next section)
- a parenthesized subpattern (unless it is an assertion - see below)
-</PRE>
-</P>
-<P>
-The general repetition quantifier specifies a minimum and maximum number of
-permitted matches, by giving the two numbers in curly brackets (braces),
-separated by a comma. The numbers must be less than 65536, and the first must
-be less than or equal to the second. For example:
-</P>
-<P>
-<PRE>
- z{2,4}
-</PRE>
-</P>
-<P>
-matches "zz", "zzz", or "zzzz". A closing brace on its own is not a special
-character. If the second number is omitted, but the comma is present, there is
-no upper limit; if the second number and the comma are both omitted, the
-quantifier specifies an exact number of required matches. Thus
-</P>
-<P>
-<PRE>
- [aeiou]{3,}
-</PRE>
-</P>
-<P>
-matches at least 3 successive vowels, but may match many more, while
-</P>
-<P>
-<PRE>
- \d{8}
-</PRE>
-</P>
-<P>
-matches exactly 8 digits. An opening curly bracket that appears in a position
-where a quantifier is not allowed, or one that does not match the syntax of a
-quantifier, is taken as a literal character. For example, {,6} is not a
-quantifier, but a literal string of four characters.
-</P>
-<P>
-The quantifier {0} is permitted, causing the expression to behave as if the
-previous item and the quantifier were not present.
-</P>
-<P>
-For convenience (and historical compatibility) the three most common
-quantifiers have single-character abbreviations:
-</P>
-<P>
-<PRE>
- * is equivalent to {0,}
- + is equivalent to {1,}
- ? is equivalent to {0,1}
-</PRE>
-</P>
-<P>
-It is possible to construct infinite loops by following a subpattern that can
-match no characters with a quantifier that has no upper limit, for example:
-</P>
-<P>
-<PRE>
- (a?)*
-</PRE>
-</P>
-<P>
-Earlier versions of Perl and PCRE used to give an error at compile time for
-such patterns. However, because there are cases where this can be useful, such
-patterns are now accepted, but if any repetition of the subpattern does in fact
-match no characters, the loop is forcibly broken.
-</P>
-<P>
-By default, the quantifiers are "greedy", that is, they match as much as
-possible (up to the maximum number of permitted times), without causing the
-rest of the pattern to fail. The classic example of where this gives problems
-is in trying to match comments in C programs. These appear between the
-sequences /* and */ and within the sequence, individual * and / characters may
-appear. An attempt to match C comments by applying the pattern
-</P>
-<P>
-<PRE>
- /\*.*\*/
-</PRE>
-</P>
-<P>
-to the string
-</P>
-<P>
-<PRE>
- /* first command */ not comment /* second comment */
-</PRE>
-</P>
-<P>
-fails, because it matches the entire string owing to the greediness of the .*
-item.
-</P>
-<P>
-However, if a quantifier is followed by a question mark, it ceases to be
-greedy, and instead matches the minimum number of times possible, so the
-pattern
-</P>
-<P>
-<PRE>
- /\*.*?\*/
-</PRE>
-</P>
-<P>
-does the right thing with the C comments. The meaning of the various
-quantifiers is not otherwise changed, just the preferred number of matches.
-Do not confuse this use of question mark with its use as a quantifier in its
-own right. Because it has two uses, it can sometimes appear doubled, as in
-</P>
-<P>
-<PRE>
- \d??\d
-</PRE>
-</P>
-<P>
-which matches one digit by preference, but can match two if that is the only
-way the rest of the pattern matches.
-</P>
-<P>
-If the PCRE_UNGREEDY option is set (an option which is not available in Perl),
-the quantifiers are not greedy by default, but individual ones can be made
-greedy by following them with a question mark. In other words, it inverts the
-default behaviour.
-</P>
-<P>
-When a parenthesized subpattern is quantified with a minimum repeat count that
-is greater than 1 or with a limited maximum, more store is required for the
-compiled pattern, in proportion to the size of the minimum or maximum.
-</P>
-<P>
-If a pattern starts with .* or .{0,} and the PCRE_DOTALL option (equivalent
-to Perl's /s) is set, thus allowing the . to match newlines, the pattern is
-implicitly anchored, because whatever follows will be tried against every
-character position in the subject string, so there is no point in retrying the
-overall match at any position after the first. PCRE treats such a pattern as
-though it were preceded by \A. In cases where it is known that the subject
-string contains no newlines, it is worth setting PCRE_DOTALL when the pattern
-begins with .* in order to obtain this optimization, or alternatively using ^
-to indicate anchoring explicitly.
-</P>
-<P>
-When a capturing subpattern is repeated, the value captured is the substring
-that matched the final iteration. For example, after
-</P>
-<P>
-<PRE>
- (tweedle[dume]{3}\s*)+
-</PRE>
-</P>
-<P>
-has matched "tweedledum tweedledee" the value of the captured substring is
-"tweedledee". However, if there are nested capturing subpatterns, the
-corresponding captured values may have been set in previous iterations. For
-example, after
-</P>
-<P>
-<PRE>
- /(a|(b))+/
-</PRE>
-</P>
-<P>
-matches "aba" the value of the second captured substring is "b".
-</P>
-<LI><A NAME="SEC23" HREF="#TOC1">BACK REFERENCES</A>
-<P>
-Outside a character class, a backslash followed by a digit greater than 0 (and
-possibly further digits) is a back reference to a capturing subpattern earlier
-(i.e. to its left) in the pattern, provided there have been that many previous
-capturing left parentheses.
-</P>
-<P>
-However, if the decimal number following the backslash is less than 10, it is
-always taken as a back reference, and causes an error only if there are not
-that many capturing left parentheses in the entire pattern. In other words, the
-parentheses that are referenced need not be to the left of the reference for
-numbers less than 10. See the section entitled "Backslash" above for further
-details of the handling of digits following a backslash.
-</P>
-<P>
-A back reference matches whatever actually matched the capturing subpattern in
-the current subject string, rather than anything matching the subpattern
-itself. So the pattern
-</P>
-<P>
-<PRE>
- (sens|respons)e and \1ibility
-</PRE>
-</P>
-<P>
-matches "sense and sensibility" and "response and responsibility", but not
-"sense and responsibility". If caseful matching is in force at the time of the
-back reference, the case of letters is relevant. For example,
-</P>
-<P>
-<PRE>
- ((?i)rah)\s+\1
-</PRE>
-</P>
-<P>
-matches "rah rah" and "RAH RAH", but not "RAH rah", even though the original
-capturing subpattern is matched caselessly.
-</P>
-<P>
-There may be more than one back reference to the same subpattern. If a
-subpattern has not actually been used in a particular match, any back
-references to it always fail. For example, the pattern
-</P>
-<P>
-<PRE>
- (a|(bc))\2
-</PRE>
-</P>
-<P>
-always fails if it starts to match "a" rather than "bc". Because there may be
-up to 99 back references, all digits following the backslash are taken
-as part of a potential back reference number. If the pattern continues with a
-digit character, some delimiter must be used to terminate the back reference.
-If the PCRE_EXTENDED option is set, this can be whitespace. Otherwise an empty
-comment can be used.
-</P>
-<P>
-A back reference that occurs inside the parentheses to which it refers fails
-when the subpattern is first used, so, for example, (a\1) never matches.
-However, such references can be useful inside repeated subpatterns. For
-example, the pattern
-</P>
-<P>
-<PRE>
- (a|b\1)+
-</PRE>
-</P>
-<P>
-matches any number of "a"s and also "aba", "ababbaa" etc. At each iteration of
-the subpattern, the back reference matches the character string corresponding
-to the previous iteration. In order for this to work, the pattern must be such
-that the first iteration does not need to match the back reference. This can be
-done using alternation, as in the example above, or by a quantifier with a
-minimum of zero.
-</P>
-<LI><A NAME="SEC24" HREF="#TOC1">ASSERTIONS</A>
-<P>
-An assertion is a test on the characters following or preceding the current
-matching point that does not actually consume any characters. The simple
-assertions coded as \b, \B, \A, \Z, \z, ^ and $ are described above. More
-complicated assertions are coded as subpatterns. There are two kinds: those
-that look ahead of the current position in the subject string, and those that
-look behind it.
-</P>
-<P>
-An assertion subpattern is matched in the normal way, except that it does not
-cause the current matching position to be changed. Lookahead assertions start
-with (?= for positive assertions and (?! for negative assertions. For example,
-</P>
-<P>
-<PRE>
- \w+(?=;)
-</PRE>
-</P>
-<P>
-matches a word followed by a semicolon, but does not include the semicolon in
-the match, and
-</P>
-<P>
-<PRE>
- foo(?!bar)
-</PRE>
-</P>
-<P>
-matches any occurrence of "foo" that is not followed by "bar". Note that the
-apparently similar pattern
-</P>
-<P>
-<PRE>
- (?!foo)bar
-</PRE>
-</P>
-<P>
-does not find an occurrence of "bar" that is preceded by something other than
-"foo"; it finds any occurrence of "bar" whatsoever, because the assertion
-(?!foo) is always true when the next three characters are "bar". A
-lookbehind assertion is needed to achieve this effect.
-</P>
-<P>
-Lookbehind assertions start with (?&#60;= for positive assertions and (?&#60;! for
-negative assertions. For example,
-</P>
-<P>
-<PRE>
- (?&#60;!foo)bar
-</PRE>
-</P>
-<P>
-does find an occurrence of "bar" that is not preceded by "foo". The contents of
-a lookbehind assertion are restricted such that all the strings it matches must
-have a fixed length. However, if there are several alternatives, they do not
-all have to have the same fixed length. Thus
-</P>
-<P>
-<PRE>
- (?&#60;=bullock|donkey)
-</PRE>
-</P>
-<P>
-is permitted, but
-</P>
-<P>
-<PRE>
- (?&#60;!dogs?|cats?)
-</PRE>
-</P>
-<P>
-causes an error at compile time. Branches that match different length strings
-are permitted only at the top level of a lookbehind assertion. This is an
-extension compared with Perl 5.005, which requires all branches to match the
-same length of string. An assertion such as
-</P>
-<P>
-<PRE>
- (?&#60;=ab(c|de))
-</PRE>
-</P>
-<P>
-is not permitted, because its single top-level branch can match two different
-lengths, but it is acceptable if rewritten to use two top-level branches:
-</P>
-<P>
-<PRE>
- (?&#60;=abc|abde)
-</PRE>
-</P>
-<P>
-The implementation of lookbehind assertions is, for each alternative, to
-temporarily move the current position back by the fixed width and then try to
-match. If there are insufficient characters before the current position, the
-match is deemed to fail. Lookbehinds in conjunction with once-only subpatterns
-can be particularly useful for matching at the ends of strings; an example is
-given at the end of the section on once-only subpatterns.
-</P>
-<P>
-Several assertions (of any sort) may occur in succession. For example,
-</P>
-<P>
-<PRE>
- (?&#60;=\d{3})(?&#60;!999)foo
-</PRE>
-</P>
-<P>
-matches "foo" preceded by three digits that are not "999". Notice that each of
-the assertions is applied independently at the same point in the subject
-string. First there is a check that the previous three characters are all
-digits, and then there is a check that the same three characters are not "999".
-This pattern does <I>not</I> match "foo" preceded by six characters, the first
-of which are digits and the last three of which are not "999". For example, it
-doesn't match "123abcfoo". A pattern to do that is
-</P>
-<P>
-<PRE>
- (?&#60;=\d{3}...)(?&#60;!999)foo
-</PRE>
-</P>
-<P>
-This time the first assertion looks at the preceding six characters, checking
-that the first three are digits, and then the second assertion checks that the
-preceding three characters are not "999".
-</P>
-<P>
-Assertions can be nested in any combination. For example,
-</P>
-<P>
-<PRE>
- (?&#60;=(?&#60;!foo)bar)baz
-</PRE>
-</P>
-<P>
-matches an occurrence of "baz" that is preceded by "bar" which in turn is not
-preceded by "foo", while
-</P>
-<P>
-<PRE>
- (?&#60;=\d{3}(?!999)...)foo
-</PRE>
-</P>
-<P>
-is another pattern which matches "foo" preceded by three digits and any three
-characters that are not "999".
-</P>
-<P>
-Assertion subpatterns are not capturing subpatterns, and may not be repeated,
-because it makes no sense to assert the same thing several times. If any kind
-of assertion contains capturing subpatterns within it, these are counted for
-the purposes of numbering the capturing subpatterns in the whole pattern.
-However, substring capturing is carried out only for positive assertions,
-because it does not make sense for negative assertions.
-</P>
-<P>
-Assertions count towards the maximum of 200 parenthesized subpatterns.
-</P>
-<LI><A NAME="SEC25" HREF="#TOC1">ONCE-ONLY SUBPATTERNS</A>
-<P>
-With both maximizing and minimizing repetition, failure of what follows
-normally causes the repeated item to be re-evaluated to see if a different
-number of repeats allows the rest of the pattern to match. Sometimes it is
-useful to prevent this, either to change the nature of the match, or to cause
-it fail earlier than it otherwise might, when the author of the pattern knows
-there is no point in carrying on.
-</P>
-<P>
-Consider, for example, the pattern \d+foo when applied to the subject line
-</P>
-<P>
-<PRE>
- 123456bar
-</PRE>
-</P>
-<P>
-After matching all 6 digits and then failing to match "foo", the normal
-action of the matcher is to try again with only 5 digits matching the \d+
-item, and then with 4, and so on, before ultimately failing. Once-only
-subpatterns provide the means for specifying that once a portion of the pattern
-has matched, it is not to be re-evaluated in this way, so the matcher would
-give up immediately on failing to match "foo" the first time. The notation is
-another kind of special parenthesis, starting with (?&#62; as in this example:
-</P>
-<P>
-<PRE>
- (?&#62;\d+)bar
-</PRE>
-</P>
-<P>
-This kind of parenthesis "locks up" the part of the pattern it contains once
-it has matched, and a failure further into the pattern is prevented from
-backtracking into it. Backtracking past it to previous items, however, works as
-normal.
-</P>
-<P>
-An alternative description is that a subpattern of this type matches the string
-of characters that an identical standalone pattern would match, if anchored at
-the current point in the subject string.
-</P>
-<P>
-Once-only subpatterns are not capturing subpatterns. Simple cases such as the
-above example can be thought of as a maximizing repeat that must swallow
-everything it can. So, while both \d+ and \d+? are prepared to adjust the
-number of digits they match in order to make the rest of the pattern match,
-(?&#62;\d+) can only match an entire sequence of digits.
-</P>
-<P>
-This construction can of course contain arbitrarily complicated subpatterns,
-and it can be nested.
-</P>
-<P>
-Once-only subpatterns can be used in conjunction with lookbehind assertions to
-specify efficient matching at the end of the subject string. Consider a simple
-pattern such as
-</P>
-<P>
-<PRE>
- abcd$
-</PRE>
-</P>
-<P>
-when applied to a long string which does not match. Because matching proceeds
-from left to right, PCRE will look for each "a" in the subject and then see if
-what follows matches the rest of the pattern. If the pattern is specified as
-</P>
-<P>
-<PRE>
- ^.*abcd$
-</PRE>
-</P>
-<P>
-the initial .* matches the entire string at first, but when this fails (because
-there is no following "a"), it backtracks to match all but the last character,
-then all but the last two characters, and so on. Once again the search for "a"
-covers the entire string, from right to left, so we are no better off. However,
-if the pattern is written as
-</P>
-<P>
-<PRE>
- ^(?&#62;.*)(?&#60;=abcd)
-</PRE>
-</P>
-<P>
-there can be no backtracking for the .* item; it can match only the entire
-string. The subsequent lookbehind assertion does a single test on the last four
-characters. If it fails, the match fails immediately. For long strings, this
-approach makes a significant difference to the processing time.
-</P>
-<P>
-When a pattern contains an unlimited repeat inside a subpattern that can itself
-be repeated an unlimited number of times, the use of a once-only subpattern is
-the only way to avoid some failing matches taking a very long time indeed.
-The pattern
-</P>
-<P>
-<PRE>
- (\D+|&#60;\d+&#62;)*[!?]
-</PRE>
-</P>
-<P>
-matches an unlimited number of substrings that either consist of non-digits, or
-digits enclosed in &#60;&#62;, followed by either ! or ?. When it matches, it runs
-quickly. However, if it is applied to
-</P>
-<P>
-<PRE>
- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
-</PRE>
-</P>
-<P>
-it takes a long time before reporting failure. This is because the string can
-be divided between the two repeats in a large number of ways, and all have to
-be tried. (The example used [!?] rather than a single character at the end,
-because both PCRE and Perl have an optimization that allows for fast failure
-when a single character is used. They remember the last single character that
-is required for a match, and fail early if it is not present in the string.)
-If the pattern is changed to
-</P>
-<P>
-<PRE>
- ((?&#62;\D+)|&#60;\d+&#62;)*[!?]
-</PRE>
-</P>
-<P>
-sequences of non-digits cannot be broken, and failure happens quickly.
-</P>
-<LI><A NAME="SEC26" HREF="#TOC1">CONDITIONAL SUBPATTERNS</A>
-<P>
-It is possible to cause the matching process to obey a subpattern
-conditionally or to choose between two alternative subpatterns, depending on
-the result of an assertion, or whether a previous capturing subpattern matched
-or not. The two possible forms of conditional subpattern are
-</P>
-<P>
-<PRE>
- (?(condition)yes-pattern)
- (?(condition)yes-pattern|no-pattern)
-</PRE>
-</P>
-<P>
-If the condition is satisfied, the yes-pattern is used; otherwise the
-no-pattern (if present) is used. If there are more than two alternatives in the
-subpattern, a compile-time error occurs.
-</P>
-<P>
-There are two kinds of condition. If the text between the parentheses consists
-of a sequence of digits, the condition is satisfied if the capturing subpattern
-of that number has previously matched. The number must be greater than zero.
-Consider the following pattern, which contains non-significant white space to
-make it more readable (assume the PCRE_EXTENDED option) and to divide it into
-three parts for ease of discussion:
-</P>
-<P>
-<PRE>
- ( \( )? [^()]+ (?(1) \) )
-</PRE>
-</P>
-<P>
-The first part matches an optional opening parenthesis, and if that
-character is present, sets it as the first captured substring. The second part
-matches one or more characters that are not parentheses. The third part is a
-conditional subpattern that tests whether the first set of parentheses matched
-or not. If they did, that is, if subject started with an opening parenthesis,
-the condition is true, and so the yes-pattern is executed and a closing
-parenthesis is required. Otherwise, since no-pattern is not present, the
-subpattern matches nothing. In other words, this pattern matches a sequence of
-non-parentheses, optionally enclosed in parentheses.
-</P>
-<P>
-If the condition is not a sequence of digits, it must be an assertion. This may
-be a positive or negative lookahead or lookbehind assertion. Consider this
-pattern, again containing non-significant white space, and with the two
-alternatives on the second line:
-</P>
-<P>
-<PRE>
- (?(?=[^a-z]*[a-z])
- \d{2}-[a-z]{3}-\d{2} | \d{2}-\d{2}-\d{2} )
-</PRE>
-</P>
-<P>
-The condition is a positive lookahead assertion that matches an optional
-sequence of non-letters followed by a letter. In other words, it tests for the
-presence of at least one letter in the subject. If a letter is found, the
-subject is matched against the first alternative; otherwise it is matched
-against the second. This pattern matches strings in one of the two forms
-dd-aaa-dd or dd-dd-dd, where aaa are letters and dd are digits.
-</P>
-<LI><A NAME="SEC27" HREF="#TOC1">COMMENTS</A>
-<P>
-The sequence (?# marks the start of a comment which continues up to the next
-closing parenthesis. Nested parentheses are not permitted. The characters
-that make up a comment play no part in the pattern matching at all.
-</P>
-<P>
-If the PCRE_EXTENDED option is set, an unescaped # character outside a
-character class introduces a comment that continues up to the next newline
-character in the pattern.
-</P>
-<LI><A NAME="SEC28" HREF="#TOC1">RECURSIVE PATTERNS</A>
-<P>
-Consider the problem of matching a string in parentheses, allowing for
-unlimited nested parentheses. Without the use of recursion, the best that can
-be done is to use a pattern that matches up to some fixed depth of nesting. It
-is not possible to handle an arbitrary nesting depth. Perl 5.6 has provided an
-experimental facility that allows regular expressions to recurse (amongst other
-things). It does this by interpolating Perl code in the expression at run time,
-and the code can refer to the expression itself. A Perl pattern to solve the
-parentheses problem can be created like this:
-</P>
-<P>
-<PRE>
- $re = qr{\( (?: (?&#62;[^()]+) | (?p{$re}) )* \)}x;
-</PRE>
-</P>
-<P>
-The (?p{...}) item interpolates Perl code at run time, and in this case refers
-recursively to the pattern in which it appears. Obviously, PCRE cannot support
-the interpolation of Perl code. Instead, the special item (?R) is provided for
-the specific case of recursion. This PCRE pattern solves the parentheses
-problem (assume the PCRE_EXTENDED option is set so that white space is
-ignored):
-</P>
-<P>
-<PRE>
- \( ( (?&#62;[^()]+) | (?R) )* \)
-</PRE>
-</P>
-<P>
-First it matches an opening parenthesis. Then it matches any number of
-substrings which can either be a sequence of non-parentheses, or a recursive
-match of the pattern itself (i.e. a correctly parenthesized substring). Finally
-there is a closing parenthesis.
-</P>
-<P>
-This particular example pattern contains nested unlimited repeats, and so the
-use of a once-only subpattern for matching strings of non-parentheses is
-important when applying the pattern to strings that do not match. For example,
-when it is applied to
-</P>
-<P>
-<PRE>
- (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa()
-</PRE>
-</P>
-<P>
-it yields "no match" quickly. However, if a once-only subpattern is not used,
-the match runs for a very long time indeed because there are so many different
-ways the + and * repeats can carve up the subject, and all have to be tested
-before failure can be reported.
-</P>
-<P>
-The values set for any capturing subpatterns are those from the outermost level
-of the recursion at which the subpattern value is set. If the pattern above is
-matched against
-</P>
-<P>
-<PRE>
- (ab(cd)ef)
-</PRE>
-</P>
-<P>
-the value for the capturing parentheses is "ef", which is the last value taken
-on at the top level. If additional parentheses are added, giving
-</P>
-<P>
-<PRE>
- \( ( ( (?&#62;[^()]+) | (?R) )* ) \)
- ^ ^
- ^ ^
-</PRE>
-the string they capture is "ab(cd)ef", the contents of the top level
-parentheses. If there are more than 15 capturing parentheses in a pattern, PCRE
-has to obtain extra memory to store data during a recursion, which it does by
-using <B>pcre_malloc</B>, freeing it via <B>pcre_free</B> afterwards. If no
-memory can be obtained, it saves data for the first 15 capturing parentheses
-only, as there is no way to give an out-of-memory error from within a
-recursion.
-</P>
-<LI><A NAME="SEC29" HREF="#TOC1">PERFORMANCE</A>
-<P>
-Certain items that may appear in patterns are more efficient than others. It is
-more efficient to use a character class like [aeiou] than a set of alternatives
-such as (a|e|i|o|u). In general, the simplest construction that provides the
-required behaviour is usually the most efficient. Jeffrey Friedl's book
-contains a lot of discussion about optimizing regular expressions for efficient
-performance.
-</P>
-<P>
-When a pattern begins with .* and the PCRE_DOTALL option is set, the pattern is
-implicitly anchored by PCRE, since it can match only at the start of a subject
-string. However, if PCRE_DOTALL is not set, PCRE cannot make this optimization,
-because the . metacharacter does not then match a newline, and if the subject
-string contains newlines, the pattern may match from the character immediately
-following one of them instead of from the very start. For example, the pattern
-</P>
-<P>
-<PRE>
- (.*) second
-</PRE>
-</P>
-<P>
-matches the subject "first\nand second" (where \n stands for a newline
-character) with the first captured substring being "and". In order to do this,
-PCRE has to retry the match starting after every newline in the subject.
-</P>
-<P>
-If you are using such a pattern with subject strings that do not contain
-newlines, the best performance is obtained by setting PCRE_DOTALL, or starting
-the pattern with ^.* to indicate explicit anchoring. That saves PCRE from
-having to scan along the subject looking for a newline to restart at.
-</P>
-<P>
-Beware of patterns that contain nested indefinite repeats. These can take a
-long time to run when applied to a string that does not match. Consider the
-pattern fragment
-</P>
-<P>
-<PRE>
- (a+)*
-</PRE>
-</P>
-<P>
-This can match "aaaa" in 33 different ways, and this number increases very
-rapidly as the string gets longer. (The * repeat can match 0, 1, 2, 3, or 4
-times, and for each of those cases other than 0, the + repeats can match
-different numbers of times.) When the remainder of the pattern is such that the
-entire match is going to fail, PCRE has in principle to try every possible
-variation, and this can take an extremely long time.
-</P>
-<P>
-An optimization catches some of the more simple cases such as
-</P>
-<P>
-<PRE>
- (a+)*b
-</PRE>
-</P>
-<P>
-where a literal character follows. Before embarking on the standard matching
-procedure, PCRE checks that there is a "b" later in the subject string, and if
-there is not, it fails the match immediately. However, when there is no
-following literal this optimization cannot be used. You can see the difference
-by comparing the behaviour of
-</P>
-<P>
-<PRE>
- (a+)*\d
-</PRE>
-</P>
-<P>
-with the pattern above. The former gives a failure almost instantly when
-applied to a whole line of "a" characters, whereas the latter takes an
-appreciable time with strings longer than about 20 characters.
-</P>
-<LI><A NAME="SEC30" HREF="#TOC1">UTF-8 SUPPORT</A>
-<P>
-Starting at release 3.3, PCRE has some support for character strings encoded
-in the UTF-8 format. This is incomplete, and is regarded as experimental. In
-order to use it, you must configure PCRE to include UTF-8 support in the code,
-and, in addition, you must call <B>pcre_compile()</B> with the PCRE_UTF8 option
-flag. When you do this, both the pattern and any subject strings that are
-matched against it are treated as UTF-8 strings instead of just strings of
-bytes, but only in the cases that are mentioned below.
-</P>
-<P>
-If you compile PCRE with UTF-8 support, but do not use it at run time, the
-library will be a bit bigger, but the additional run time overhead is limited
-to testing the PCRE_UTF8 flag in several places, so should not be very large.
-</P>
-<P>
-PCRE assumes that the strings it is given contain valid UTF-8 codes. It does
-not diagnose invalid UTF-8 strings. If you pass invalid UTF-8 strings to PCRE,
-the results are undefined.
-</P>
-<P>
-Running with PCRE_UTF8 set causes these changes in the way PCRE works:
-</P>
-<P>
-1. In a pattern, the escape sequence \x{...}, where the contents of the braces
-is a string of hexadecimal digits, is interpreted as a UTF-8 character whose
-code number is the given hexadecimal number, for example: \x{1234}. This
-inserts from one to six literal bytes into the pattern, using the UTF-8
-encoding. If a non-hexadecimal digit appears between the braces, the item is
-not recognized.
-</P>
-<P>
-2. The original hexadecimal escape sequence, \xhh, generates a two-byte UTF-8
-character if its value is greater than 127.
-</P>
-<P>
-3. Repeat quantifiers are NOT correctly handled if they follow a multibyte
-character. For example, \x{100}* and \xc3+ do not work. If you want to
-repeat such characters, you must enclose them in non-capturing parentheses,
-for example (?:\x{100}), at present.
-</P>
-<P>
-4. The dot metacharacter matches one UTF-8 character instead of a single byte.
-</P>
-<P>
-5. Unlike literal UTF-8 characters, the dot metacharacter followed by a
-repeat quantifier does operate correctly on UTF-8 characters instead of
-single bytes.
-</P>
-<P>
-4. Although the \x{...} escape is permitted in a character class, characters
-whose values are greater than 255 cannot be included in a class.
-</P>
-<P>
-5. A class is matched against a UTF-8 character instead of just a single byte,
-but it can match only characters whose values are less than 256. Characters
-with greater values always fail to match a class.
-</P>
-<P>
-6. Repeated classes work correctly on multiple characters.
-</P>
-<P>
-7. Classes containing just a single character whose value is greater than 127
-(but less than 256), for example, [\x80] or [^\x{93}], do not work because
-these are optimized into single byte matches. In the first case, of course,
-the class brackets are just redundant.
-</P>
-<P>
-8. Lookbehind assertions move backwards in the subject by a fixed number of
-characters instead of a fixed number of bytes. Simple cases have been tested
-to work correctly, but there may be hidden gotchas herein.
-</P>
-<P>
-9. The character types such as \d and \w do not work correctly with UTF-8
-characters. They continue to test a single byte.
-</P>
-<P>
-10. Anything not explicitly mentioned here continues to work in bytes rather
-than in characters.
-</P>
-<P>
-The following UTF-8 features of Perl 5.6 are not implemented:
-</P>
-<P>
-1. The escape sequence \C to match a single byte.
-</P>
-<P>
-2. The use of Unicode tables and properties and escapes \p, \P, and \X.
-</P>
-<LI><A NAME="SEC31" HREF="#TOC1">AUTHOR</A>
-<P>
-Philip Hazel &#60;ph10@cam.ac.uk&#62;
-<BR>
-University Computing Service,
-<BR>
-New Museums Site,
-<BR>
-Cambridge CB2 3QG, England.
-<BR>
-Phone: +44 1223 334714
-</P>
-<P>
-Last updated: 28 August 2000,
-<BR>
-<PRE>
- the 250th anniversary of the death of J.S. Bach.
-<BR>
-</PRE>
-Copyright (c) 1997-2000 University of Cambridge.
diff --git a/ext/pcre/pcrelib/doc/pcre.txt b/ext/pcre/pcrelib/doc/pcre.txt
deleted file mode 100644
index 1db4b537b7..0000000000
--- a/ext/pcre/pcrelib/doc/pcre.txt
+++ /dev/null
@@ -1,2125 +0,0 @@
-NAME
- pcre - Perl-compatible regular expressions.
-
-
-
-SYNOPSIS
- #include <pcre.h>
-
- pcre *pcre_compile(const char *pattern, int options,
- const char **errptr, int *erroffset,
- const unsigned char *tableptr);
-
- pcre_extra *pcre_study(const pcre *code, int options,
- const char **errptr);
-
- int pcre_exec(const pcre *code, const pcre_extra *extra,
- const char *subject, int length, int startoffset,
- int options, int *ovector, int ovecsize);
-
- int pcre_copy_substring(const char *subject, int *ovector,
- int stringcount, int stringnumber, char *buffer,
- int buffersize);
-
- int pcre_get_substring(const char *subject, int *ovector,
- int stringcount, int stringnumber,
- const char **stringptr);
-
- int pcre_get_substring_list(const char *subject,
- int *ovector, int stringcount, const char ***listptr);
-
- void pcre_free_substring(const char *stringptr);
-
- void pcre_free_substring_list(const char **stringptr);
-
- const unsigned char *pcre_maketables(void);
-
- int pcre_fullinfo(const pcre *code, const pcre_extra *extra,
- int what, void *where);
-
- int pcre_info(const pcre *code, int *optptr, *firstcharptr);
-
- char *pcre_version(void);
-
- void *(*pcre_malloc)(size_t);
-
- void (*pcre_free)(void *);
-
-
-
-
-DESCRIPTION
- The PCRE library is a set of functions that implement regu-
- lar expression pattern matching using the same syntax and
- semantics as Perl 5, with just a few differences (see
-
- below). The current implementation corresponds to Perl
- 5.005, with some additional features from later versions.
- This includes some experimental, incomplete support for
- UTF-8 encoded strings. Details of exactly what is and what
- is not supported are given below.
-
- PCRE has its own native API, which is described in this
- document. There is also a set of wrapper functions that
- correspond to the POSIX regular expression API. These are
- described in the pcreposix documentation.
-
- The native API function prototypes are defined in the header
- file pcre.h, and on Unix systems the library itself is
- called libpcre.a, so can be accessed by adding -lpcre to the
- command for linking an application which calls it. The
- header file defines the macros PCRE_MAJOR and PCRE_MINOR to
- contain the major and minor release numbers for the library.
- Applications can use these to include support for different
- releases.
-
- The functions pcre_compile(), pcre_study(), and pcre_exec()
- are used for compiling and matching regular expressions.
-
- The functions pcre_copy_substring(), pcre_get_substring(),
- and pcre_get_substring_list() are convenience functions for
- extracting captured substrings from a matched subject
- string; pcre_free_substring() and pcre_free_substring_list()
- are also provided, to free the memory used for extracted
- strings.
-
- The function pcre_maketables() is used (optionally) to build
- a set of character tables in the current locale for passing
- to pcre_compile().
-
- The function pcre_fullinfo() is used to find out information
- about a compiled pattern; pcre_info() is an obsolete version
- which returns only some of the available information, but is
- retained for backwards compatibility. The function
- pcre_version() returns a pointer to a string containing the
- version of PCRE and its date of release.
-
- The global variables pcre_malloc and pcre_free initially
- contain the entry points of the standard malloc() and free()
- functions respectively. PCRE calls the memory management
- functions via these variables, so a calling program can
- replace them if it wishes to intercept the calls. This
- should be done before calling any PCRE functions.
-
-
-
-MULTI-THREADING
- The PCRE functions can be used in multi-threading
-
-
-
-
-
-SunOS 5.8 Last change: 2
-
-
-
- applications, with the proviso that the memory management
- functions pointed to by pcre_malloc and pcre_free are shared
- by all threads.
-
- The compiled form of a regular expression is not altered
- during matching, so the same compiled pattern can safely be
- used by several threads at once.
-
-
-
-COMPILING A PATTERN
- The function pcre_compile() is called to compile a pattern
- into an internal form. The pattern is a C string terminated
- by a binary zero, and is passed in the argument pattern. A
- pointer to a single block of memory that is obtained via
- pcre_malloc is returned. This contains the compiled code and
- related data. The pcre type is defined for this for conveni-
- ence, but in fact pcre is just a typedef for void, since the
- contents of the block are not externally defined. It is up
- to the caller to free the memory when it is no longer
- required.
-
- The size of a compiled pattern is roughly proportional to
- the length of the pattern string, except that each character
- class (other than those containing just a single character,
- negated or not) requires 33 bytes, and repeat quantifiers
- with a minimum greater than one or a bounded maximum cause
- the relevant portions of the compiled pattern to be repli-
- cated.
-
- The options argument contains independent bits that affect
- the compilation. It should be zero if no options are
- required. Some of the options, in particular, those that are
- compatible with Perl, can also be set and unset from within
- the pattern (see the detailed description of regular expres-
- sions below). For these options, the contents of the options
- argument specifies their initial settings at the start of
- compilation and execution. The PCRE_ANCHORED option can be
- set at the time of matching as well as at compile time.
-
- If errptr is NULL, pcre_compile() returns NULL immediately.
- Otherwise, if compilation of a pattern fails, pcre_compile()
- returns NULL, and sets the variable pointed to by errptr to
- point to a textual error message. The offset from the start
- of the pattern to the character where the error was
- discovered is placed in the variable pointed to by
- erroffset, which must not be NULL. If it is, an immediate
- error is given.
-
- If the final argument, tableptr, is NULL, PCRE uses a
- default set of character tables which are built when it is
- compiled, using the default C locale. Otherwise, tableptr
- must be the result of a call to pcre_maketables(). See the
- section on locale support below.
-
- The following option bits are defined in the header file:
-
- PCRE_ANCHORED
-
- If this bit is set, the pattern is forced to be "anchored",
- that is, it is constrained to match only at the start of the
- string which is being searched (the "subject string"). This
- effect can also be achieved by appropriate constructs in the
- pattern itself, which is the only way to do it in Perl.
-
- PCRE_CASELESS
-
- If this bit is set, letters in the pattern match both upper
- and lower case letters. It is equivalent to Perl's /i
- option.
-
- PCRE_DOLLAR_ENDONLY
-
- If this bit is set, a dollar metacharacter in the pattern
- matches only at the end of the subject string. Without this
- option, a dollar also matches immediately before the final
- character if it is a newline (but not before any other new-
- lines). The PCRE_DOLLAR_ENDONLY option is ignored if
- PCRE_MULTILINE is set. There is no equivalent to this option
- in Perl.
-
- PCRE_DOTALL
-
- If this bit is set, a dot metacharater in the pattern
- matches all characters, including newlines. Without it, new-
- lines are excluded. This option is equivalent to Perl's /s
- option. A negative class such as [^a] always matches a new-
- line character, independent of the setting of this option.
-
- PCRE_EXTENDED
-
- If this bit is set, whitespace data characters in the pat-
- tern are totally ignored except when escaped or inside a
- character class, and characters between an unescaped # out-
- side a character class and the next newline character,
- inclusive, are also ignored. This is equivalent to Perl's /x
- option, and makes it possible to include comments inside
- complicated patterns. Note, however, that this applies only
- to data characters. Whitespace characters may never appear
- within special character sequences in a pattern, for example
- within the sequence (?( which introduces a conditional sub-
- pattern.
-
- PCRE_EXTRA
-
- This option was invented in order to turn on additional
- functionality of PCRE that is incompatible with Perl, but it
- is currently of very little use. When set, any backslash in
- a pattern that is followed by a letter that has no special
- meaning causes an error, thus reserving these combinations
- for future expansion. By default, as in Perl, a backslash
- followed by a letter with no special meaning is treated as a
- literal. There are at present no other features controlled
- by this option. It can also be set by a (?X) option setting
- within a pattern.
-
- PCRE_MULTILINE
-
- By default, PCRE treats the subject string as consisting of
- a single "line" of characters (even if it actually contains
- several newlines). The "start of line" metacharacter (^)
- matches only at the start of the string, while the "end of
- line" metacharacter ($) matches only at the end of the
- string, or before a terminating newline (unless
- PCRE_DOLLAR_ENDONLY is set). This is the same as Perl.
-
- When PCRE_MULTILINE it is set, the "start of line" and "end
- of line" constructs match immediately following or immedi-
- ately before any newline in the subject string, respec-
- tively, as well as at the very start and end. This is
- equivalent to Perl's /m option. If there are no "\n" charac-
- ters in a subject string, or no occurrences of ^ or $ in a
- pattern, setting PCRE_MULTILINE has no effect.
-
- PCRE_UNGREEDY
-
- This option inverts the "greediness" of the quantifiers so
- that they are not greedy by default, but become greedy if
- followed by "?". It is not compatible with Perl. It can also
- be set by a (?U) option setting within the pattern.
-
- PCRE_UTF8
-
- This option causes PCRE to regard both the pattern and the
- subject as strings of UTF-8 characters instead of just byte
- strings. However, it is available only if PCRE has been
- built to include UTF-8 support. If not, the use of this
- option provokes an error. Support for UTF-8 is new, experi-
- mental, and incomplete. Details of exactly what it entails
- are given below.
-
-
-
-STUDYING A PATTERN
- When a pattern is going to be used several times, it is
- worth spending more time analyzing it in order to speed up
- the time taken for matching. The function pcre_study() takes
-
- a pointer to a compiled pattern as its first argument, and
- returns a pointer to a pcre_extra block (another void
- typedef) containing additional information about the pat-
- tern; this can be passed to pcre_exec(). If no additional
- information is available, NULL is returned.
-
- The second argument contains option bits. At present, no
- options are defined for pcre_study(), and this argument
- should always be zero.
-
- The third argument for pcre_study() is a pointer to an error
- message. If studying succeeds (even if no data is returned),
- the variable it points to is set to NULL. Otherwise it
- points to a textual error message.
-
- At present, studying a pattern is useful only for non-
- anchored patterns that do not have a single fixed starting
- character. A bitmap of possible starting characters is
- created.
-
-
-
-LOCALE SUPPORT
- PCRE handles caseless matching, and determines whether char-
- acters are letters, digits, or whatever, by reference to a
- set of tables. The library contains a default set of tables
- which is created in the default C locale when PCRE is com-
- piled. This is used when the final argument of
- pcre_compile() is NULL, and is sufficient for many applica-
- tions.
-
- An alternative set of tables can, however, be supplied. Such
- tables are built by calling the pcre_maketables() function,
- which has no arguments, in the relevant locale. The result
- can then be passed to pcre_compile() as often as necessary.
- For example, to build and use tables that are appropriate
- for the French locale (where accented characters with codes
- greater than 128 are treated as letters), the following code
- could be used:
-
- setlocale(LC_CTYPE, "fr");
- tables = pcre_maketables();
- re = pcre_compile(..., tables);
-
- The tables are built in memory that is obtained via
- pcre_malloc. The pointer that is passed to pcre_compile is
- saved with the compiled pattern, and the same tables are
- used via this pointer by pcre_study() and pcre_exec(). Thus
- for any single pattern, compilation, studying and matching
- all happen in the same locale, but different patterns can be
- compiled in different locales. It is the caller's responsi-
- bility to ensure that the memory containing the tables
- remains available for as long as it is needed.
-
-
-
-INFORMATION ABOUT A PATTERN
- The pcre_fullinfo() function returns information about a
- compiled pattern. It replaces the obsolete pcre_info() func-
- tion, which is nevertheless retained for backwards compabil-
- ity (and is documented below).
-
- The first argument for pcre_fullinfo() is a pointer to the
- compiled pattern. The second argument is the result of
- pcre_study(), or NULL if the pattern was not studied. The
- third argument specifies which piece of information is
- required, while the fourth argument is a pointer to a vari-
- able to receive the data. The yield of the function is zero
- for success, or one of the following negative numbers:
-
- PCRE_ERROR_NULL the argument code was NULL
- the argument where was NULL
- PCRE_ERROR_BADMAGIC the "magic number" was not found
- PCRE_ERROR_BADOPTION the value of what was invalid
-
- The possible values for the third argument are defined in
- pcre.h, and are as follows:
-
- PCRE_INFO_OPTIONS
-
- Return a copy of the options with which the pattern was com-
- piled. The fourth argument should point to au unsigned long
- int variable. These option bits are those specified in the
- call to pcre_compile(), modified by any top-level option
- settings within the pattern itself, and with the
- PCRE_ANCHORED bit forcibly set if the form of the pattern
- implies that it can match only at the start of a subject
- string.
-
- PCRE_INFO_SIZE
-
- Return the size of the compiled pattern, that is, the value
- that was passed as the argument to pcre_malloc() when PCRE
- was getting memory in which to place the compiled data. The
- fourth argument should point to a size_t variable.
-
- PCRE_INFO_CAPTURECOUNT
-
- Return the number of capturing subpatterns in the pattern.
- The fourth argument should point to an int variable.
-
- PCRE_INFO_BACKREFMAX
-
- Return the number of the highest back reference in the
- pattern. The fourth argument should point to an int vari-
- able. Zero is returned if there are no back references.
-
- PCRE_INFO_FIRSTCHAR
-
- Return information about the first character of any matched
- string, for a non-anchored pattern. If there is a fixed
- first character, e.g. from a pattern such as
- (cat|cow|coyote), it is returned in the integer pointed to
- by where. Otherwise, if either
-
- (a) the pattern was compiled with the PCRE_MULTILINE option,
- and every branch starts with "^", or
-
- (b) every branch of the pattern starts with ".*" and
- PCRE_DOTALL is not set (if it were set, the pattern would be
- anchored),
-
- -1 is returned, indicating that the pattern matches only at
- the start of a subject string or after any "\n" within the
- string. Otherwise -2 is returned. For anchored patterns, -2
- is returned.
-
- PCRE_INFO_FIRSTTABLE
-
- If the pattern was studied, and this resulted in the con-
- struction of a 256-bit table indicating a fixed set of char-
- acters for the first character in any matching string, a
- pointer to the table is returned. Otherwise NULL is
- returned. The fourth argument should point to an unsigned
- char * variable.
-
- PCRE_INFO_LASTLITERAL
-
- For a non-anchored pattern, return the value of the right-
- most literal character which must exist in any matched
- string, other than at its start. The fourth argument should
- point to an int variable. If there is no such character, or
- if the pattern is anchored, -1 is returned. For example, for
- the pattern /a\d+z\d+/ the returned value is 'z'.
-
- The pcre_info() function is now obsolete because its inter-
- face is too restrictive to return all the available data
- about a compiled pattern. New programs should use
- pcre_fullinfo() instead. The yield of pcre_info() is the
- number of capturing subpatterns, or one of the following
- negative numbers:
-
- PCRE_ERROR_NULL the argument code was NULL
- PCRE_ERROR_BADMAGIC the "magic number" was not found
-
- If the optptr argument is not NULL, a copy of the options
- with which the pattern was compiled is placed in the integer
- it points to (see PCRE_INFO_OPTIONS above).
-
- If the pattern is not anchored and the firstcharptr argument
- is not NULL, it is used to pass back information about the
- first character of any matched string (see
- PCRE_INFO_FIRSTCHAR above).
-
-
-
-MATCHING A PATTERN
- The function pcre_exec() is called to match a subject string
- against a pre-compiled pattern, which is passed in the code
- argument. If the pattern has been studied, the result of the
- study should be passed in the extra argument. Otherwise this
- must be NULL.
-
- The PCRE_ANCHORED option can be passed in the options argu-
- ment, whose unused bits must be zero. However, if a pattern
- was compiled with PCRE_ANCHORED, or turned out to be
- anchored by virtue of its contents, it cannot be made
- unachored at matching time.
-
- There are also three further options that can be set only at
- matching time:
-
- PCRE_NOTBOL
-
- The first character of the string is not the beginning of a
- line, so the circumflex metacharacter should not match
- before it. Setting this without PCRE_MULTILINE (at compile
- time) causes circumflex never to match.
-
- PCRE_NOTEOL
-
- The end of the string is not the end of a line, so the dol-
- lar metacharacter should not match it nor (except in multi-
- line mode) a newline immediately before it. Setting this
- without PCRE_MULTILINE (at compile time) causes dollar never
- to match.
-
- PCRE_NOTEMPTY
-
- An empty string is not considered to be a valid match if
- this option is set. If there are alternatives in the pat-
- tern, they are tried. If all the alternatives match the
- empty string, the entire match fails. For example, if the
- pattern
-
- a?b?
-
- is applied to a string not beginning with "a" or "b", it
- matches the empty string at the start of the subject. With
- PCRE_NOTEMPTY set, this match is not valid, so PCRE searches
- further into the string for occurrences of "a" or "b".
-
- Perl has no direct equivalent of PCRE_NOTEMPTY, but it does
- make a special case of a pattern match of the empty string
- within its split() function, and when using the /g modifier.
- It is possible to emulate Perl's behaviour after matching a
- null string by first trying the match again at the same
- offset with PCRE_NOTEMPTY set, and then if that fails by
- advancing the starting offset (see below) and trying an
- ordinary match again.
-
- The subject string is passed as a pointer in subject, a
- length in length, and a starting offset in startoffset.
- Unlike the pattern string, it may contain binary zero char-
- acters. When the starting offset is zero, the search for a
- match starts at the beginning of the subject, and this is by
- far the most common case.
-
- A non-zero starting offset is useful when searching for
- another match in the same subject by calling pcre_exec()
- again after a previous success. Setting startoffset differs
- from just passing over a shortened string and setting
- PCRE_NOTBOL in the case of a pattern that begins with any
- kind of lookbehind. For example, consider the pattern
-
- \Biss\B
-
- which finds occurrences of "iss" in the middle of words. (\B
- matches only if the current position in the subject is not a
- word boundary.) When applied to the string "Mississipi" the
- first call to pcre_exec() finds the first occurrence. If
- pcre_exec() is called again with just the remainder of the
- subject, namely "issipi", it does not match, because \B is
- always false at the start of the subject, which is deemed to
- be a word boundary. However, if pcre_exec() is passed the
- entire string again, but with startoffset set to 4, it finds
- the second occurrence of "iss" because it is able to look
- behind the starting point to discover that it is preceded by
- a letter.
-
- If a non-zero starting offset is passed when the pattern is
- anchored, one attempt to match at the given offset is tried.
- This can only succeed if the pattern does not require the
- match to be at the start of the subject.
-
- In general, a pattern matches a certain portion of the sub-
- ject, and in addition, further substrings from the subject
- may be picked out by parts of the pattern. Following the
- usage in Jeffrey Friedl's book, this is called "capturing"
- in what follows, and the phrase "capturing subpattern" is
- used for a fragment of a pattern that picks out a substring.
- PCRE supports several other kinds of parenthesized subpat-
- tern that do not cause substrings to be captured.
-
- Captured substrings are returned to the caller via a vector
- of integer offsets whose address is passed in ovector. The
- number of elements in the vector is passed in ovecsize. The
- first two-thirds of the vector is used to pass back captured
- substrings, each substring using a pair of integers. The
- remaining third of the vector is used as workspace by
- pcre_exec() while matching capturing subpatterns, and is not
- available for passing back information. The length passed in
- ovecsize should always be a multiple of three. If it is not,
- it is rounded down.
-
- When a match has been successful, information about captured
- substrings is returned in pairs of integers, starting at the
- beginning of ovector, and continuing up to two-thirds of its
- length at the most. The first element of a pair is set to
- the offset of the first character in a substring, and the
- second is set to the offset of the first character after the
- end of a substring. The first pair, ovector[0] and ovec-
- tor[1], identify the portion of the subject string matched
- by the entire pattern. The next pair is used for the first
- capturing subpattern, and so on. The value returned by
- pcre_exec() is the number of pairs that have been set. If
- there are no capturing subpatterns, the return value from a
- successful match is 1, indicating that just the first pair
- of offsets has been set.
-
- Some convenience functions are provided for extracting the
- captured substrings as separate strings. These are described
- in the following section.
-
- It is possible for an capturing subpattern number n+1 to
- match some part of the subject when subpattern n has not
- been used at all. For example, if the string "abc" is
- matched against the pattern (a|(z))(bc) subpatterns 1 and 3
- are matched, but 2 is not. When this happens, both offset
- values corresponding to the unused subpattern are set to -1.
-
- If a capturing subpattern is matched repeatedly, it is the
- last portion of the string that it matched that gets
- returned.
-
- If the vector is too small to hold all the captured sub-
- strings, it is used as far as possible (up to two-thirds of
- its length), and the function returns a value of zero. In
- particular, if the substring offsets are not of interest,
- pcre_exec() may be called with ovector passed as NULL and
- ovecsize as zero. However, if the pattern contains back
- references and the ovector isn't big enough to remember the
- related substrings, PCRE has to get additional memory for
- use during matching. Thus it is usually advisable to supply
- an ovector.
-
- Note that pcre_info() can be used to find out how many cap-
- turing subpatterns there are in a compiled pattern. The
- smallest size for ovector that will allow for n captured
- substrings in addition to the offsets of the substring
- matched by the whole pattern is (n+1)*3.
-
- If pcre_exec() fails, it returns a negative number. The fol-
- lowing are defined in the header file:
-
- PCRE_ERROR_NOMATCH (-1)
-
- The subject string did not match the pattern.
-
- PCRE_ERROR_NULL (-2)
-
- Either code or subject was passed as NULL, or ovector was
- NULL and ovecsize was not zero.
-
- PCRE_ERROR_BADOPTION (-3)
-
- An unrecognized bit was set in the options argument.
-
- PCRE_ERROR_BADMAGIC (-4)
-
- PCRE stores a 4-byte "magic number" at the start of the com-
- piled code, to catch the case when it is passed a junk
- pointer. This is the error it gives when the magic number
- isn't present.
-
- PCRE_ERROR_UNKNOWN_NODE (-5)
-
- While running the pattern match, an unknown item was encoun-
- tered in the compiled pattern. This error could be caused by
- a bug in PCRE or by overwriting of the compiled pattern.
-
- PCRE_ERROR_NOMEMORY (-6)
-
- If a pattern contains back references, but the ovector that
- is passed to pcre_exec() is not big enough to remember the
- referenced substrings, PCRE gets a block of memory at the
- start of matching to use for this purpose. If the call via
- pcre_malloc() fails, this error is given. The memory is
- freed at the end of matching.
-
-
-
-EXTRACTING CAPTURED SUBSTRINGS
- Captured substrings can be accessed directly by using the
-
-
-
-
-
-SunOS 5.8 Last change: 12
-
-
-
- offsets returned by pcre_exec() in ovector. For convenience,
- the functions pcre_copy_substring(), pcre_get_substring(),
- and pcre_get_substring_list() are provided for extracting
- captured substrings as new, separate, zero-terminated
- strings. A substring that contains a binary zero is
- correctly extracted and has a further zero added on the end,
- but the result does not, of course, function as a C string.
-
- The first three arguments are the same for all three func-
- tions: subject is the subject string which has just been
- successfully matched, ovector is a pointer to the vector of
- integer offsets that was passed to pcre_exec(), and
- stringcount is the number of substrings that were captured
- by the match, including the substring that matched the
- entire regular expression. This is the value returned by
- pcre_exec if it is greater than zero. If pcre_exec()
- returned zero, indicating that it ran out of space in ovec-
- tor, the value passed as stringcount should be the size of
- the vector divided by three.
-
- The functions pcre_copy_substring() and pcre_get_substring()
- extract a single substring, whose number is given as string-
- number. A value of zero extracts the substring that matched
- the entire pattern, while higher values extract the captured
- substrings. For pcre_copy_substring(), the string is placed
- in buffer, whose length is given by buffersize, while for
- pcre_get_substring() a new block of memory is obtained via
- pcre_malloc, and its address is returned via stringptr. The
- yield of the function is the length of the string, not
- including the terminating zero, or one of
-
- PCRE_ERROR_NOMEMORY (-6)
-
- The buffer was too small for pcre_copy_substring(), or the
- attempt to get memory failed for pcre_get_substring().
-
- PCRE_ERROR_NOSUBSTRING (-7)
-
- There is no substring whose number is stringnumber.
-
- The pcre_get_substring_list() function extracts all avail-
- able substrings and builds a list of pointers to them. All
- this is done in a single block of memory which is obtained
- via pcre_malloc. The address of the memory block is returned
- via listptr, which is also the start of the list of string
- pointers. The end of the list is marked by a NULL pointer.
- The yield of the function is zero if all went well, or
-
- PCRE_ERROR_NOMEMORY (-6)
-
- if the attempt to get the memory block failed.
-
- When any of these functions encounter a substring that is
- unset, which can happen when capturing subpattern number n+1
- matches some part of the subject, but subpattern n has not
- been used at all, they return an empty string. This can be
- distinguished from a genuine zero-length substring by
- inspecting the appropriate offset in ovector, which is nega-
- tive for unset substrings.
-
- The two convenience functions pcre_free_substring() and
- pcre_free_substring_list() can be used to free the memory
- returned by a previous call of pcre_get_substring() or
- pcre_get_substring_list(), respectively. They do nothing
- more than call the function pointed to by pcre_free, which
- of course could be called directly from a C program. How-
- ever, PCRE is used in some situations where it is linked via
- a special interface to another programming language which
- cannot use pcre_free directly; it is for these cases that
- the functions are provided.
-
-
-
-LIMITATIONS
- There are some size limitations in PCRE but it is hoped that
- they will never in practice be relevant. The maximum length
- of a compiled pattern is 65539 (sic) bytes. All values in
- repeating quantifiers must be less than 65536. The maximum
- number of capturing subpatterns is 99. The maximum number
- of all parenthesized subpatterns, including capturing sub-
- patterns, assertions, and other types of subpattern, is 200.
-
- The maximum length of a subject string is the largest posi-
- tive number that an integer variable can hold. However, PCRE
- uses recursion to handle subpatterns and indefinite repeti-
- tion. This means that the available stack space may limit
- the size of a subject string that can be processed by cer-
- tain patterns.
-
-
-
-DIFFERENCES FROM PERL
- The differences described here are with respect to Perl
- 5.005.
-
- 1. By default, a whitespace character is any character that
- the C library function isspace() recognizes, though it is
- possible to compile PCRE with alternative character type
- tables. Normally isspace() matches space, formfeed, newline,
- carriage return, horizontal tab, and vertical tab. Perl 5 no
- longer includes vertical tab in its set of whitespace char-
- acters. The \v escape that was in the Perl documentation for
- a long time was never in fact recognized. However, the char-
- acter itself was treated as whitespace at least up to 5.002.
- In 5.004 and 5.005 it does not match \s.
-
- 2. PCRE does not allow repeat quantifiers on lookahead
- assertions. Perl permits them, but they do not mean what you
- might think. For example, (?!a){3} does not assert that the
- next three characters are not "a". It just asserts that the
- next character is not "a" three times.
-
- 3. Capturing subpatterns that occur inside negative looka-
- head assertions are counted, but their entries in the
- offsets vector are never set. Perl sets its numerical vari-
- ables from any such patterns that are matched before the
- assertion fails to match something (thereby succeeding), but
- only if the negative lookahead assertion contains just one
- branch.
-
- 4. Though binary zero characters are supported in the sub-
- ject string, they are not allowed in a pattern string
- because it is passed as a normal C string, terminated by
- zero. The escape sequence "\0" can be used in the pattern to
- represent a binary zero.
-
- 5. The following Perl escape sequences are not supported:
- \l, \u, \L, \U, \E, \Q. In fact these are implemented by
- Perl's general string-handling and are not part of its pat-
- tern matching engine.
-
- 6. The Perl \G assertion is not supported as it is not
- relevant to single pattern matches.
-
- 7. Fairly obviously, PCRE does not support the (?{code}) and
- (?p{code}) constructions. However, there is some experimen-
- tal support for recursive patterns using the non-Perl item
- (?R).
-
- 8. There are at the time of writing some oddities in Perl
- 5.005_02 concerned with the settings of captured strings
- when part of a pattern is repeated. For example, matching
- "aba" against the pattern /^(a(b)?)+$/ sets $2 to the value
- "b", but matching "aabbaa" against /^(aa(bb)?)+$/ leaves $2
- unset. However, if the pattern is changed to
- /^(aa(b(b))?)+$/ then $2 (and $3) are set.
-
- In Perl 5.004 $2 is set in both cases, and that is also true
- of PCRE. If in the future Perl changes to a consistent state
- that is different, PCRE may change to follow.
-
- 9. Another as yet unresolved discrepancy is that in Perl
- 5.005_02 the pattern /^(a)?(?(1)a|b)+$/ matches the string
- "a", whereas in PCRE it does not. However, in both Perl and
- PCRE /^(a)?a/ matched against "a" leaves $1 unset.
-
- 10. PCRE provides some extensions to the Perl regular
- expression facilities:
-
- (a) Although lookbehind assertions must match fixed length
- strings, each alternative branch of a lookbehind assertion
- can match a different length of string. Perl 5.005 requires
- them all to have the same length.
-
- (b) If PCRE_DOLLAR_ENDONLY is set and PCRE_MULTILINE is not
- set, the $ meta- character matches only at the very end of
- the string.
-
- (c) If PCRE_EXTRA is set, a backslash followed by a letter
- with no special meaning is faulted.
-
- (d) If PCRE_UNGREEDY is set, the greediness of the repeti-
- tion quantifiers is inverted, that is, by default they are
- not greedy, but if followed by a question mark they are.
-
- (e) PCRE_ANCHORED can be used to force a pattern to be tried
- only at the start of the subject.
-
- (f) The PCRE_NOTBOL, PCRE_NOTEOL, and PCRE_NOTEMPTY options
- for pcre_exec() have no Perl equivalents.
-
- (g) The (?R) construct allows for recursive pattern matching
- (Perl 5.6 can do this using the (?p{code}) construct, which
- PCRE cannot of course support.)
-
-
-
-REGULAR EXPRESSION DETAILS
- The syntax and semantics of the regular expressions sup-
- ported by PCRE are described below. Regular expressions are
- also described in the Perl documentation and in a number of
- other books, some of which have copious examples. Jeffrey
- Friedl's "Mastering Regular Expressions", published by
- O'Reilly (ISBN 1-56592-257), covers them in great detail.
-
- The description here is intended as reference documentation.
- The basic operation of PCRE is on strings of bytes. However,
- there is the beginnings of some support for UTF-8 character
- strings. To use this support you must configure PCRE to
- include it, and then call pcre_compile() with the PCRE_UTF8
- option. How this affects the pattern matching is described
- in the final section of this document.
-
- A regular expression is a pattern that is matched against a
- subject string from left to right. Most characters stand for
- themselves in a pattern, and match the corresponding charac-
- ters in the subject. As a trivial example, the pattern
-
- The quick brown fox
-
- matches a portion of a subject string that is identical to
- itself. The power of regular expressions comes from the
- ability to include alternatives and repetitions in the pat-
- tern. These are encoded in the pattern by the use of meta-
- characters, which do not stand for themselves but instead
- are interpreted in some special way.
-
- There are two different sets of meta-characters: those that
- are recognized anywhere in the pattern except within square
- brackets, and those that are recognized in square brackets.
- Outside square brackets, the meta-characters are as follows:
-
- \ general escape character with several uses
- ^ assert start of subject (or line, in multiline
- mode)
- $ assert end of subject (or line, in multiline mode)
- . match any character except newline (by default)
- [ start character class definition
- | start of alternative branch
- ( start subpattern
- ) end subpattern
- ? extends the meaning of (
- also 0 or 1 quantifier
- also quantifier minimizer
- * 0 or more quantifier
- + 1 or more quantifier
- { start min/max quantifier
-
- Part of a pattern that is in square brackets is called a
- "character class". In a character class the only meta-
- characters are:
-
- \ general escape character
- ^ negate the class, but only if the first character
- - indicates character range
- ] terminates the character class
-
- The following sections describe the use of each of the
- meta-characters.
-
-
-
-BACKSLASH
- The backslash character has several uses. Firstly, if it is
- followed by a non-alphameric character, it takes away any
- special meaning that character may have. This use of
- backslash as an escape character applies both inside and
- outside character classes.
-
- For example, if you want to match a "*" character, you write
- "\*" in the pattern. This applies whether or not the follow-
- ing character would otherwise be interpreted as a meta-
- character, so it is always safe to precede a non-alphameric
- with "\" to specify that it stands for itself. In particu-
- lar, if you want to match a backslash, you write "\\".
-
- If a pattern is compiled with the PCRE_EXTENDED option, whi-
- tespace in the pattern (other than in a character class) and
- characters between a "#" outside a character class and the
- next newline character are ignored. An escaping backslash
- can be used to include a whitespace or "#" character as part
- of the pattern.
-
- A second use of backslash provides a way of encoding non-
- printing characters in patterns in a visible manner. There
- is no restriction on the appearance of non-printing charac-
- ters, apart from the binary zero that terminates a pattern,
- but when a pattern is being prepared by text editing, it is
- usually easier to use one of the following escape sequences
- than the binary character it represents:
-
- \a alarm, that is, the BEL character (hex 07)
- \cx "control-x", where x is any character
- \e escape (hex 1B)
- \f formfeed (hex 0C)
- \n newline (hex 0A)
- \r carriage return (hex 0D)
- \t tab (hex 09)
- \xhh character with hex code hh
- \ddd character with octal code ddd, or backreference
-
- The precise effect of "\cx" is as follows: if "x" is a lower
- case letter, it is converted to upper case. Then bit 6 of
- the character (hex 40) is inverted. Thus "\cz" becomes hex
- 1A, but "\c{" becomes hex 3B, while "\c;" becomes hex 7B.
-
- After "\x", up to two hexadecimal digits are read (letters
- can be in upper or lower case).
-
- After "\0" up to two further octal digits are read. In both
- cases, if there are fewer than two digits, just those that
- are present are used. Thus the sequence "\0\x\07" specifies
- two binary zeros followed by a BEL character. Make sure you
- supply two digits after the initial zero if the character
- that follows is itself an octal digit.
-
- The handling of a backslash followed by a digit other than 0
- is complicated. Outside a character class, PCRE reads it
- and any following digits as a decimal number. If the number
- is less than 10, or if there have been at least that many
- previous capturing left parentheses in the expression, the
- entire sequence is taken as a back reference. A description
- of how this works is given later, following the discussion
- of parenthesized subpatterns.
-
- Inside a character class, or if the decimal number is
- greater than 9 and there have not been that many capturing
- subpatterns, PCRE re-reads up to three octal digits follow-
- ing the backslash, and generates a single byte from the
- least significant 8 bits of the value. Any subsequent digits
- stand for themselves. For example:
-
- \040 is another way of writing a space
- \40 is the same, provided there are fewer than 40
- previous capturing subpatterns
- \7 is always a back reference
- \11 might be a back reference, or another way of
- writing a tab
- \011 is always a tab
- \0113 is a tab followed by the character "3"
- \113 is the character with octal code 113 (since there
- can be no more than 99 back references)
- \377 is a byte consisting entirely of 1 bits
- \81 is either a back reference, or a binary zero
- followed by the two characters "8" and "1"
-
- Note that octal values of 100 or greater must not be intro-
- duced by a leading zero, because no more than three octal
- digits are ever read.
-
- All the sequences that define a single byte value can be
- used both inside and outside character classes. In addition,
- inside a character class, the sequence "\b" is interpreted
- as the backspace character (hex 08). Outside a character
- class it has a different meaning (see below).
-
- The third use of backslash is for specifying generic charac-
- ter types:
-
- \d any decimal digit
- \D any character that is not a decimal digit
- \s any whitespace character
- \S any character that is not a whitespace character
- \w any "word" character
- \W any "non-word" character
-
- Each pair of escape sequences partitions the complete set of
- characters into two disjoint sets. Any given character
- matches one, and only one, of each pair.
-
- A "word" character is any letter or digit or the underscore
- character, that is, any character which can be part of a
- Perl "word". The definition of letters and digits is con-
- trolled by PCRE's character tables, and may vary if locale-
- specific matching is taking place (see "Locale support"
- above). For example, in the "fr" (French) locale, some char-
- acter codes greater than 128 are used for accented letters,
- and these are matched by \w.
-
- These character type sequences can appear both inside and
- outside character classes. They each match one character of
- the appropriate type. If the current matching point is at
- the end of the subject string, all of them fail, since there
- is no character to match.
-
- The fourth use of backslash is for certain simple asser-
- tions. An assertion specifies a condition that has to be met
- at a particular point in a match, without consuming any
- characters from the subject string. The use of subpatterns
- for more complicated assertions is described below. The
- backslashed assertions are
-
- \b word boundary
- \B not a word boundary
- \A start of subject (independent of multiline mode)
- \Z end of subject or newline at end (independent of
- multiline mode)
- \z end of subject (independent of multiline mode)
-
- These assertions may not appear in character classes (but
- note that "\b" has a different meaning, namely the backspace
- character, inside a character class).
-
- A word boundary is a position in the subject string where
- the current character and the previous character do not both
- match \w or \W (i.e. one matches \w and the other matches
- \W), or the start or end of the string if the first or last
- character matches \w, respectively.
-
- The \A, \Z, and \z assertions differ from the traditional
- circumflex and dollar (described below) in that they only
- ever match at the very start and end of the subject string,
- whatever options are set. They are not affected by the
- PCRE_NOTBOL or PCRE_NOTEOL options. If the startoffset argu-
- ment of pcre_exec() is non-zero, \A can never match. The
- difference between \Z and \z is that \Z matches before a
- newline that is the last character of the string as well as
- at the end of the string, whereas \z matches only at the
- end.
-
-
-
-CIRCUMFLEX AND DOLLAR
- Outside a character class, in the default matching mode, the
- circumflex character is an assertion which is true only if
- the current matching point is at the start of the subject
-
- string. If the startoffset argument of pcre_exec() is non-
- zero, circumflex can never match. Inside a character class,
- circumflex has an entirely different meaning (see below).
-
- Circumflex need not be the first character of the pattern if
- a number of alternatives are involved, but it should be the
- first thing in each alternative in which it appears if the
- pattern is ever to match that branch. If all possible alter-
- natives start with a circumflex, that is, if the pattern is
- constrained to match only at the start of the subject, it is
- said to be an "anchored" pattern. (There are also other con-
- structs that can cause a pattern to be anchored.)
-
- A dollar character is an assertion which is true only if the
- current matching point is at the end of the subject string,
- or immediately before a newline character that is the last
- character in the string (by default). Dollar need not be the
- last character of the pattern if a number of alternatives
- are involved, but it should be the last item in any branch
- in which it appears. Dollar has no special meaning in a
- character class.
-
- The meaning of dollar can be changed so that it matches only
- at the very end of the string, by setting the
- PCRE_DOLLAR_ENDONLY option at compile or matching time. This
- does not affect the \Z assertion.
-
- The meanings of the circumflex and dollar characters are
- changed if the PCRE_MULTILINE option is set. When this is
- the case, they match immediately after and immediately
- before an internal "\n" character, respectively, in addition
- to matching at the start and end of the subject string. For
- example, the pattern /^abc$/ matches the subject string
- "def\nabc" in multiline mode, but not otherwise. Conse-
- quently, patterns that are anchored in single line mode
- because all branches start with "^" are not anchored in mul-
- tiline mode, and a match for circumflex is possible when the
- startoffset argument of pcre_exec() is non-zero. The
- PCRE_DOLLAR_ENDONLY option is ignored if PCRE_MULTILINE is
- set.
-
- Note that the sequences \A, \Z, and \z can be used to match
- the start and end of the subject in both modes, and if all
- branches of a pattern start with \A is it always anchored,
- whether PCRE_MULTILINE is set or not.
-
-
-
-FULL STOP (PERIOD, DOT)
- Outside a character class, a dot in the pattern matches any
- one character in the subject, including a non-printing char-
- acter, but not (by default) newline. If the PCRE_DOTALL
-
- option is set, dots match newlines as well. The handling of
- dot is entirely independent of the handling of circumflex
- and dollar, the only relationship being that they both
- involve newline characters. Dot has no special meaning in a
- character class.
-
-
-
-SQUARE BRACKETS
- An opening square bracket introduces a character class, ter-
- minated by a closing square bracket. A closing square
- bracket on its own is not special. If a closing square
- bracket is required as a member of the class, it should be
- the first data character in the class (after an initial cir-
- cumflex, if present) or escaped with a backslash.
-
- A character class matches a single character in the subject;
- the character must be in the set of characters defined by
- the class, unless the first character in the class is a cir-
- cumflex, in which case the subject character must not be in
- the set defined by the class. If a circumflex is actually
- required as a member of the class, ensure it is not the
- first character, or escape it with a backslash.
-
- For example, the character class [aeiou] matches any lower
- case vowel, while [^aeiou] matches any character that is not
- a lower case vowel. Note that a circumflex is just a con-
- venient notation for specifying the characters which are in
- the class by enumerating those that are not. It is not an
- assertion: it still consumes a character from the subject
- string, and fails if the current pointer is at the end of
- the string.
-
- When caseless matching is set, any letters in a class
- represent both their upper case and lower case versions, so
- for example, a caseless [aeiou] matches "A" as well as "a",
- and a caseless [^aeiou] does not match "A", whereas a case-
- ful version would.
-
- The newline character is never treated in any special way in
- character classes, whatever the setting of the PCRE_DOTALL
- or PCRE_MULTILINE options is. A class such as [^a] will
- always match a newline.
-
- The minus (hyphen) character can be used to specify a range
- of characters in a character class. For example, [d-m]
- matches any letter between d and m, inclusive. If a minus
- character is required in a class, it must be escaped with a
- backslash or appear in a position where it cannot be inter-
- preted as indicating a range, typically as the first or last
- character in the class.
-
- It is not possible to have the literal character "]" as the
- end character of a range. A pattern such as [W-]46] is
- interpreted as a class of two characters ("W" and "-") fol-
- lowed by a literal string "46]", so it would match "W46]" or
- "-46]". However, if the "]" is escaped with a backslash it
- is interpreted as the end of range, so [W-\]46] is inter-
- preted as a single class containing a range followed by two
- separate characters. The octal or hexadecimal representation
- of "]" can also be used to end a range.
-
- Ranges operate in ASCII collating sequence. They can also be
- used for characters specified numerically, for example
- [\000-\037]. If a range that includes letters is used when
- caseless matching is set, it matches the letters in either
- case. For example, [W-c] is equivalent to [][\^_`wxyzabc],
- matched caselessly, and if character tables for the "fr"
- locale are in use, [\xc8-\xcb] matches accented E characters
- in both cases.
-
- The character types \d, \D, \s, \S, \w, and \W may also
- appear in a character class, and add the characters that
- they match to the class. For example, [\dABCDEF] matches any
- hexadecimal digit. A circumflex can conveniently be used
- with the upper case character types to specify a more res-
- tricted set of characters than the matching lower case type.
- For example, the class [^\W_] matches any letter or digit,
- but not underscore.
-
- All non-alphameric characters other than \, -, ^ (at the
- start) and the terminating ] are non-special in character
- classes, but it does no harm if they are escaped.
-
-
-
-POSIX CHARACTER CLASSES
- Perl 5.6 (not yet released at the time of writing) is going
- to support the POSIX notation for character classes, which
- uses names enclosed by [: and :] within the enclosing
- square brackets. PCRE supports this notation. For example,
-
- [01[:alpha:]%]
-
- matches "0", "1", any alphabetic character, or "%". The sup-
- ported class names are
-
- alnum letters and digits
- alpha letters
- ascii character codes 0 - 127
- cntrl control characters
- digit decimal digits (same as \d)
- graph printing characters, excluding space
- lower lower case letters
- print printing characters, including space
- punct printing characters, excluding letters and digits
- space white space (same as \s)
- upper upper case letters
- word "word" characters (same as \w)
- xdigit hexadecimal digits
-
- The names "ascii" and "word" are Perl extensions. Another
- Perl extension is negation, which is indicated by a ^ char-
- acter after the colon. For example,
-
- [12[:^digit:]]
-
- matches "1", "2", or any non-digit. PCRE (and Perl) also
- recogize the POSIX syntax [.ch.] and [=ch=] where "ch" is a
- "collating element", but these are not supported, and an
- error is given if they are encountered.
-
-
-
-VERTICAL BAR
- Vertical bar characters are used to separate alternative
- patterns. For example, the pattern
-
- gilbert|sullivan
-
- matches either "gilbert" or "sullivan". Any number of alter-
- natives may appear, and an empty alternative is permitted
- (matching the empty string). The matching process tries
- each alternative in turn, from left to right, and the first
- one that succeeds is used. If the alternatives are within a
- subpattern (defined below), "succeeds" means matching the
- rest of the main pattern as well as the alternative in the
- subpattern.
-
-
-
-INTERNAL OPTION SETTING
- The settings of PCRE_CASELESS, PCRE_MULTILINE, PCRE_DOTALL,
- and PCRE_EXTENDED can be changed from within the pattern by
- a sequence of Perl option letters enclosed between "(?" and
- ")". The option letters are
-
- i for PCRE_CASELESS
- m for PCRE_MULTILINE
- s for PCRE_DOTALL
- x for PCRE_EXTENDED
-
- For example, (?im) sets caseless, multiline matching. It is
- also possible to unset these options by preceding the letter
- with a hyphen, and a combined setting and unsetting such as
- (?im-sx), which sets PCRE_CASELESS and PCRE_MULTILINE while
- unsetting PCRE_DOTALL and PCRE_EXTENDED, is also permitted.
- If a letter appears both before and after the hyphen, the
- option is unset.
-
- The scope of these option changes depends on where in the
- pattern the setting occurs. For settings that are outside
- any subpattern (defined below), the effect is the same as if
- the options were set or unset at the start of matching. The
- following patterns all behave in exactly the same way:
-
- (?i)abc
- a(?i)bc
- ab(?i)c
- abc(?i)
-
- which in turn is the same as compiling the pattern abc with
- PCRE_CASELESS set. In other words, such "top level" set-
- tings apply to the whole pattern (unless there are other
- changes inside subpatterns). If there is more than one set-
- ting of the same option at top level, the rightmost setting
- is used.
-
- If an option change occurs inside a subpattern, the effect
- is different. This is a change of behaviour in Perl 5.005.
- An option change inside a subpattern affects only that part
- of the subpattern that follows it, so
-
- (a(?i)b)c
-
- matches abc and aBc and no other strings (assuming
- PCRE_CASELESS is not used). By this means, options can be
- made to have different settings in different parts of the
- pattern. Any changes made in one alternative do carry on
- into subsequent branches within the same subpattern. For
- example,
-
- (a(?i)b|c)
-
- matches "ab", "aB", "c", and "C", even though when matching
- "C" the first branch is abandoned before the option setting.
- This is because the effects of option settings happen at
- compile time. There would be some very weird behaviour oth-
- erwise.
-
- The PCRE-specific options PCRE_UNGREEDY and PCRE_EXTRA can
- be changed in the same way as the Perl-compatible options by
- using the characters U and X respectively. The (?X) flag
- setting is special in that it must always occur earlier in
- the pattern than any of the additional features it turns on,
- even when it is at top level. It is best put at the start.
-
-
-
-SUBPATTERNS
- Subpatterns are delimited by parentheses (round brackets),
- which can be nested. Marking part of a pattern as a subpat-
- tern does two things:
-
- 1. It localizes a set of alternatives. For example, the pat-
- tern
-
- cat(aract|erpillar|)
-
- matches one of the words "cat", "cataract", or "caterpil-
- lar". Without the parentheses, it would match "cataract",
- "erpillar" or the empty string.
-
- 2. It sets up the subpattern as a capturing subpattern (as
- defined above). When the whole pattern matches, that por-
- tion of the subject string that matched the subpattern is
- passed back to the caller via the ovector argument of
- pcre_exec(). Opening parentheses are counted from left to
- right (starting from 1) to obtain the numbers of the captur-
- ing subpatterns.
-
- For example, if the string "the red king" is matched against
- the pattern
-
- the ((red|white) (king|queen))
-
- the captured substrings are "red king", "red", and "king",
- and are numbered 1, 2, and 3.
-
- The fact that plain parentheses fulfil two functions is not
- always helpful. There are often times when a grouping sub-
- pattern is required without a capturing requirement. If an
- opening parenthesis is followed by "?:", the subpattern does
- not do any capturing, and is not counted when computing the
- number of any subsequent capturing subpatterns. For example,
- if the string "the white queen" is matched against the pat-
- tern
-
- the ((?:red|white) (king|queen))
-
- the captured substrings are "white queen" and "queen", and
- are numbered 1 and 2. The maximum number of captured sub-
- strings is 99, and the maximum number of all subpatterns,
- both capturing and non-capturing, is 200.
-
- As a convenient shorthand, if any option settings are
- required at the start of a non-capturing subpattern, the
- option letters may appear between the "?" and the ":". Thus
- the two patterns
-
- (?i:saturday|sunday)
- (?:(?i)saturday|sunday)
-
- match exactly the same set of strings. Because alternative
- branches are tried from left to right, and options are not
- reset until the end of the subpattern is reached, an option
- setting in one branch does affect subsequent branches, so
- the above patterns match "SUNDAY" as well as "Saturday".
-
-
-
-REPETITION
- Repetition is specified by quantifiers, which can follow any
- of the following items:
-
- a single character, possibly escaped
- the . metacharacter
- a character class
- a back reference (see next section)
- a parenthesized subpattern (unless it is an assertion -
- see below)
-
- The general repetition quantifier specifies a minimum and
- maximum number of permitted matches, by giving the two
- numbers in curly brackets (braces), separated by a comma.
- The numbers must be less than 65536, and the first must be
- less than or equal to the second. For example:
-
- z{2,4}
-
- matches "zz", "zzz", or "zzzz". A closing brace on its own
- is not a special character. If the second number is omitted,
- but the comma is present, there is no upper limit; if the
- second number and the comma are both omitted, the quantifier
- specifies an exact number of required matches. Thus
-
- [aeiou]{3,}
-
- matches at least 3 successive vowels, but may match many
- more, while
-
- \d{8}
-
- matches exactly 8 digits. An opening curly bracket that
- appears in a position where a quantifier is not allowed, or
- one that does not match the syntax of a quantifier, is taken
- as a literal character. For example, {,6} is not a quantif-
- ier, but a literal string of four characters.
-
- The quantifier {0} is permitted, causing the expression to
- behave as if the previous item and the quantifier were not
- present.
-
- For convenience (and historical compatibility) the three
- most common quantifiers have single-character abbreviations:
-
- * is equivalent to {0,}
- + is equivalent to {1,}
- ? is equivalent to {0,1}
-
- It is possible to construct infinite loops by following a
- subpattern that can match no characters with a quantifier
- that has no upper limit, for example:
-
- (a?)*
-
- Earlier versions of Perl and PCRE used to give an error at
- compile time for such patterns. However, because there are
- cases where this can be useful, such patterns are now
- accepted, but if any repetition of the subpattern does in
- fact match no characters, the loop is forcibly broken.
-
- By default, the quantifiers are "greedy", that is, they
- match as much as possible (up to the maximum number of per-
- mitted times), without causing the rest of the pattern to
- fail. The classic example of where this gives problems is in
- trying to match comments in C programs. These appear between
- the sequences /* and */ and within the sequence, individual
- * and / characters may appear. An attempt to match C com-
- ments by applying the pattern
-
- /\*.*\*/
-
- to the string
-
- /* first command */ not comment /* second comment */
-
- fails, because it matches the entire string owing to the
- greediness of the .* item.
-
- However, if a quantifier is followed by a question mark, it
- ceases to be greedy, and instead matches the minimum number
- of times possible, so the pattern
-
- /\*.*?\*/
-
- does the right thing with the C comments. The meaning of the
- various quantifiers is not otherwise changed, just the pre-
- ferred number of matches. Do not confuse this use of ques-
- tion mark with its use as a quantifier in its own right.
- Because it has two uses, it can sometimes appear doubled, as
- in
-
- \d??\d
-
- which matches one digit by preference, but can match two if
- that is the only way the rest of the pattern matches.
-
- If the PCRE_UNGREEDY option is set (an option which is not
- available in Perl), the quantifiers are not greedy by
- default, but individual ones can be made greedy by following
- them with a question mark. In other words, it inverts the
- default behaviour.
-
- When a parenthesized subpattern is quantified with a minimum
- repeat count that is greater than 1 or with a limited max-
- imum, more store is required for the compiled pattern, in
- proportion to the size of the minimum or maximum.
-
- If a pattern starts with .* or .{0,} and the PCRE_DOTALL
- option (equivalent to Perl's /s) is set, thus allowing the .
- to match newlines, the pattern is implicitly anchored,
- because whatever follows will be tried against every charac-
- ter position in the subject string, so there is no point in
- retrying the overall match at any position after the first.
- PCRE treats such a pattern as though it were preceded by \A.
- In cases where it is known that the subject string contains
- no newlines, it is worth setting PCRE_DOTALL when the pat-
- tern begins with .* in order to obtain this optimization, or
- alternatively using ^ to indicate anchoring explicitly.
-
- When a capturing subpattern is repeated, the value captured
- is the substring that matched the final iteration. For exam-
- ple, after
-
- (tweedle[dume]{3}\s*)+
-
- has matched "tweedledum tweedledee" the value of the cap-
- tured substring is "tweedledee". However, if there are
- nested capturing subpatterns, the corresponding captured
- values may have been set in previous iterations. For exam-
- ple, after
-
- /(a|(b))+/
-
- matches "aba" the value of the second captured substring is
- "b".
-
-
-
-BACK REFERENCES
- Outside a character class, a backslash followed by a digit
- greater than 0 (and possibly further digits) is a back
- reference to a capturing subpattern earlier (i.e. to its
- left) in the pattern, provided there have been that many
- previous capturing left parentheses.
-
- However, if the decimal number following the backslash is
- less than 10, it is always taken as a back reference, and
- causes an error only if there are not that many capturing
- left parentheses in the entire pattern. In other words, the
- parentheses that are referenced need not be to the left of
- the reference for numbers less than 10. See the section
- entitled "Backslash" above for further details of the han-
- dling of digits following a backslash.
-
- A back reference matches whatever actually matched the cap-
- turing subpattern in the current subject string, rather than
- anything matching the subpattern itself. So the pattern
-
- (sens|respons)e and \1ibility
-
- matches "sense and sensibility" and "response and responsi-
- bility", but not "sense and responsibility". If caseful
- matching is in force at the time of the back reference, the
- case of letters is relevant. For example,
-
- ((?i)rah)\s+\1
-
- matches "rah rah" and "RAH RAH", but not "RAH rah", even
- though the original capturing subpattern is matched case-
- lessly.
-
- There may be more than one back reference to the same sub-
- pattern. If a subpattern has not actually been used in a
- particular match, any back references to it always fail. For
- example, the pattern
-
- (a|(bc))\2
-
- always fails if it starts to match "a" rather than "bc".
- Because there may be up to 99 back references, all digits
- following the backslash are taken as part of a potential
- back reference number. If the pattern continues with a digit
- character, some delimiter must be used to terminate the back
- reference. If the PCRE_EXTENDED option is set, this can be
- whitespace. Otherwise an empty comment can be used.
-
- A back reference that occurs inside the parentheses to which
- it refers fails when the subpattern is first used, so, for
- example, (a\1) never matches. However, such references can
- be useful inside repeated subpatterns. For example, the pat-
- tern
-
- (a|b\1)+
-
- matches any number of "a"s and also "aba", "ababbaa" etc. At
- each iteration of the subpattern, the back reference matches
- the character string corresponding to the previous
- iteration. In order for this to work, the pattern must be
- such that the first iteration does not need to match the
- back reference. This can be done using alternation, as in
- the example above, or by a quantifier with a minimum of
- zero.
-
-
-
-ASSERTIONS
- An assertion is a test on the characters following or
- preceding the current matching point that does not actually
- consume any characters. The simple assertions coded as \b,
- \B, \A, \Z, \z, ^ and $ are described above. More compli-
- cated assertions are coded as subpatterns. There are two
- kinds: those that look ahead of the current position in the
- subject string, and those that look behind it.
-
- An assertion subpattern is matched in the normal way, except
- that it does not cause the current matching position to be
- changed. Lookahead assertions start with (?= for positive
- assertions and (?! for negative assertions. For example,
-
- \w+(?=;)
-
- matches a word followed by a semicolon, but does not include
- the semicolon in the match, and
-
- foo(?!bar)
-
- matches any occurrence of "foo" that is not followed by
- "bar". Note that the apparently similar pattern
-
- (?!foo)bar
-
- does not find an occurrence of "bar" that is preceded by
- something other than "foo"; it finds any occurrence of "bar"
- whatsoever, because the assertion (?!foo) is always true
- when the next three characters are "bar". A lookbehind
- assertion is needed to achieve this effect.
-
- Lookbehind assertions start with (?<= for positive asser-
- tions and (?<! for negative assertions. For example,
-
- (?<!foo)bar
-
- does find an occurrence of "bar" that is not preceded by
- "foo". The contents of a lookbehind assertion are restricted
- such that all the strings it matches must have a fixed
- length. However, if there are several alternatives, they do
- not all have to have the same fixed length. Thus
-
- (?<=bullock|donkey)
-
- is permitted, but
-
- (?<!dogs?|cats?)
-
- causes an error at compile time. Branches that match dif-
- ferent length strings are permitted only at the top level of
- a lookbehind assertion. This is an extension compared with
- Perl 5.005, which requires all branches to match the same
- length of string. An assertion such as
-
- (?<=ab(c|de))
-
- is not permitted, because its single top-level branch can
- match two different lengths, but it is acceptable if rewrit-
- ten to use two top-level branches:
-
- (?<=abc|abde)
-
- The implementation of lookbehind assertions is, for each
- alternative, to temporarily move the current position back
- by the fixed width and then try to match. If there are
- insufficient characters before the current position, the
- match is deemed to fail. Lookbehinds in conjunction with
- once-only subpatterns can be particularly useful for match-
- ing at the ends of strings; an example is given at the end
- of the section on once-only subpatterns.
-
- Several assertions (of any sort) may occur in succession.
- For example,
-
- (?<=\d{3})(?<!999)foo
-
- matches "foo" preceded by three digits that are not "999".
- Notice that each of the assertions is applied independently
- at the same point in the subject string. First there is a
- check that the previous three characters are all digits, and
- then there is a check that the same three characters are not
- "999". This pattern does not match "foo" preceded by six
- characters, the first of which are digits and the last three
- of which are not "999". For example, it doesn't match
- "123abcfoo". A pattern to do that is
-
- (?<=\d{3}...)(?<!999)foo
-
- This time the first assertion looks at the preceding six
- characters, checking that the first three are digits, and
- then the second assertion checks that the preceding three
- characters are not "999".
-
- Assertions can be nested in any combination. For example,
-
- (?<=(?<!foo)bar)baz
-
- matches an occurrence of "baz" that is preceded by "bar"
- which in turn is not preceded by "foo", while
-
- (?<=\d{3}(?!999)...)foo
-
- is another pattern which matches "foo" preceded by three
- digits and any three characters that are not "999".
-
- Assertion subpatterns are not capturing subpatterns, and may
- not be repeated, because it makes no sense to assert the
- same thing several times. If any kind of assertion contains
- capturing subpatterns within it, these are counted for the
- purposes of numbering the capturing subpatterns in the whole
- pattern. However, substring capturing is carried out only
- for positive assertions, because it does not make sense for
- negative assertions.
-
- Assertions count towards the maximum of 200 parenthesized
- subpatterns.
-
-
-
-ONCE-ONLY SUBPATTERNS
- With both maximizing and minimizing repetition, failure of
- what follows normally causes the repeated item to be re-
- evaluated to see if a different number of repeats allows the
- rest of the pattern to match. Sometimes it is useful to
- prevent this, either to change the nature of the match, or
- to cause it fail earlier than it otherwise might, when the
- author of the pattern knows there is no point in carrying
- on.
-
- Consider, for example, the pattern \d+foo when applied to
- the subject line
-
- 123456bar
-
- After matching all 6 digits and then failing to match "foo",
- the normal action of the matcher is to try again with only 5
- digits matching the \d+ item, and then with 4, and so on,
- before ultimately failing. Once-only subpatterns provide the
- means for specifying that once a portion of the pattern has
- matched, it is not to be re-evaluated in this way, so the
- matcher would give up immediately on failing to match "foo"
- the first time. The notation is another kind of special
- parenthesis, starting with (?> as in this example:
-
- (?>\d+)bar
-
- This kind of parenthesis "locks up" the part of the pattern
- it contains once it has matched, and a failure further into
- the pattern is prevented from backtracking into it.
- Backtracking past it to previous items, however, works as
- normal.
-
- An alternative description is that a subpattern of this type
- matches the string of characters that an identical stan-
- dalone pattern would match, if anchored at the current point
- in the subject string.
-
- Once-only subpatterns are not capturing subpatterns. Simple
- cases such as the above example can be thought of as a max-
- imizing repeat that must swallow everything it can. So,
- while both \d+ and \d+? are prepared to adjust the number of
- digits they match in order to make the rest of the pattern
- match, (?>\d+) can only match an entire sequence of digits.
-
- This construction can of course contain arbitrarily compli-
- cated subpatterns, and it can be nested.
-
- Once-only subpatterns can be used in conjunction with look-
- behind assertions to specify efficient matching at the end
- of the subject string. Consider a simple pattern such as
-
- abcd$
-
- when applied to a long string which does not match. Because
- matching proceeds from left to right, PCRE will look for
- each "a" in the subject and then see if what follows matches
- the rest of the pattern. If the pattern is specified as
-
- ^.*abcd$
-
- the initial .* matches the entire string at first, but when
- this fails (because there is no following "a"), it back-
- tracks to match all but the last character, then all but the
- last two characters, and so on. Once again the search for
- "a" covers the entire string, from right to left, so we are
- no better off. However, if the pattern is written as
-
- ^(?>.*)(?<=abcd)
-
- there can be no backtracking for the .* item; it can match
- only the entire string. The subsequent lookbehind assertion
- does a single test on the last four characters. If it fails,
- the match fails immediately. For long strings, this approach
- makes a significant difference to the processing time.
-
- When a pattern contains an unlimited repeat inside a subpat-
- tern that can itself be repeated an unlimited number of
- times, the use of a once-only subpattern is the only way to
- avoid some failing matches taking a very long time indeed.
- The pattern
-
- (\D+|<\d+>)*[!?]
-
- matches an unlimited number of substrings that either con-
- sist of non-digits, or digits enclosed in <>, followed by
- either ! or ?. When it matches, it runs quickly. However, if
- it is applied to
-
- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
-
- it takes a long time before reporting failure. This is
- because the string can be divided between the two repeats in
- a large number of ways, and all have to be tried. (The exam-
- ple used [!?] rather than a single character at the end,
- because both PCRE and Perl have an optimization that allows
- for fast failure when a single character is used. They
- remember the last single character that is required for a
- match, and fail early if it is not present in the string.)
- If the pattern is changed to
-
- ((?>\D+)|<\d+>)*[!?]
-
- sequences of non-digits cannot be broken, and failure hap-
- pens quickly.
-
-
-
-CONDITIONAL SUBPATTERNS
- It is possible to cause the matching process to obey a sub-
- pattern conditionally or to choose between two alternative
- subpatterns, depending on the result of an assertion, or
- whether a previous capturing subpattern matched or not. The
- two possible forms of conditional subpattern are
-
- (?(condition)yes-pattern)
- (?(condition)yes-pattern|no-pattern)
-
- If the condition is satisfied, the yes-pattern is used; oth-
- erwise the no-pattern (if present) is used. If there are
- more than two alternatives in the subpattern, a compile-time
- error occurs.
-
- There are two kinds of condition. If the text between the
- parentheses consists of a sequence of digits, the condition
- is satisfied if the capturing subpattern of that number has
- previously matched. The number must be greater than zero.
- Consider the following pattern, which contains non-
- significant white space to make it more readable (assume the
- PCRE_EXTENDED option) and to divide it into three parts for
- ease of discussion:
-
- ( \( )? [^()]+ (?(1) \) )
-
- The first part matches an optional opening parenthesis, and
- if that character is present, sets it as the first captured
- substring. The second part matches one or more characters
- that are not parentheses. The third part is a conditional
- subpattern that tests whether the first set of parentheses
- matched or not. If they did, that is, if subject started
- with an opening parenthesis, the condition is true, and so
- the yes-pattern is executed and a closing parenthesis is
- required. Otherwise, since no-pattern is not present, the
- subpattern matches nothing. In other words, this pattern
- matches a sequence of non-parentheses, optionally enclosed
- in parentheses.
-
- If the condition is not a sequence of digits, it must be an
- assertion. This may be a positive or negative lookahead or
- lookbehind assertion. Consider this pattern, again contain-
- ing non-significant white space, and with the two alterna-
- tives on the second line:
-
- (?(?=[^a-z]*[a-z])
- \d{2}-[a-z]{3}-\d{2} | \d{2}-\d{2}-\d{2} )
-
- The condition is a positive lookahead assertion that matches
- an optional sequence of non-letters followed by a letter. In
- other words, it tests for the presence of at least one
- letter in the subject. If a letter is found, the subject is
- matched against the first alternative; otherwise it is
- matched against the second. This pattern matches strings in
- one of the two forms dd-aaa-dd or dd-dd-dd, where aaa are
- letters and dd are digits.
-
-
-
-COMMENTS
- The sequence (?# marks the start of a comment which contin-
- ues up to the next closing parenthesis. Nested parentheses
- are not permitted. The characters that make up a comment
- play no part in the pattern matching at all.
-
- If the PCRE_EXTENDED option is set, an unescaped # character
- outside a character class introduces a comment that contin-
- ues up to the next newline character in the pattern.
-
-
-
-RECURSIVE PATTERNS
- Consider the problem of matching a string in parentheses,
- allowing for unlimited nested parentheses. Without the use
- of recursion, the best that can be done is to use a pattern
- that matches up to some fixed depth of nesting. It is not
- possible to handle an arbitrary nesting depth. Perl 5.6 has
- provided an experimental facility that allows regular
- expressions to recurse (amongst other things). It does this
- by interpolating Perl code in the expression at run time,
- and the code can refer to the expression itself. A Perl pat-
- tern to solve the parentheses problem can be created like
- this:
-
- $re = qr{\( (?: (?>[^()]+) | (?p{$re}) )* \)}x;
-
- The (?p{...}) item interpolates Perl code at run time, and
- in this case refers recursively to the pattern in which it
- appears. Obviously, PCRE cannot support the interpolation of
- Perl code. Instead, the special item (?R) is provided for
- the specific case of recursion. This PCRE pattern solves the
- parentheses problem (assume the PCRE_EXTENDED option is set
- so that white space is ignored):
-
- \( ( (?>[^()]+) | (?R) )* \)
-
- First it matches an opening parenthesis. Then it matches any
- number of substrings which can either be a sequence of non-
- parentheses, or a recursive match of the pattern itself
- (i.e. a correctly parenthesized substring). Finally there is
- a closing parenthesis.
-
- This particular example pattern contains nested unlimited
- repeats, and so the use of a once-only subpattern for match-
- ing strings of non-parentheses is important when applying
- the pattern to strings that do not match. For example, when
- it is applied to
-
- (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa()
-
- it yields "no match" quickly. However, if a once-only sub-
- pattern is not used, the match runs for a very long time
- indeed because there are so many different ways the + and *
- repeats can carve up the subject, and all have to be tested
- before failure can be reported.
-
- The values set for any capturing subpatterns are those from
- the outermost level of the recursion at which the subpattern
- value is set. If the pattern above is matched against
-
- (ab(cd)ef)
-
- the value for the capturing parentheses is "ef", which is
- the last value taken on at the top level. If additional
- parentheses are added, giving
-
- \( ( ( (?>[^()]+) | (?R) )* ) \)
- ^ ^
- ^ ^ the string they capture is
- "ab(cd)ef", the contents of the top level parentheses. If
- there are more than 15 capturing parentheses in a pattern,
- PCRE has to obtain extra memory to store data during a
- recursion, which it does by using pcre_malloc, freeing it
- via pcre_free afterwards. If no memory can be obtained, it
- saves data for the first 15 capturing parentheses only, as
- there is no way to give an out-of-memory error from within a
- recursion.
-
-
-
-PERFORMANCE
- Certain items that may appear in patterns are more efficient
- than others. It is more efficient to use a character class
- like [aeiou] than a set of alternatives such as (a|e|i|o|u).
- In general, the simplest construction that provides the
- required behaviour is usually the most efficient. Jeffrey
- Friedl's book contains a lot of discussion about optimizing
- regular expressions for efficient performance.
-
- When a pattern begins with .* and the PCRE_DOTALL option is
- set, the pattern is implicitly anchored by PCRE, since it
- can match only at the start of a subject string. However, if
- PCRE_DOTALL is not set, PCRE cannot make this optimization,
- because the . metacharacter does not then match a newline,
- and if the subject string contains newlines, the pattern may
- match from the character immediately following one of them
- instead of from the very start. For example, the pattern
-
- (.*) second
-
- matches the subject "first\nand second" (where \n stands for
- a newline character) with the first captured substring being
- "and". In order to do this, PCRE has to retry the match
- starting after every newline in the subject.
-
- If you are using such a pattern with subject strings that do
- not contain newlines, the best performance is obtained by
- setting PCRE_DOTALL, or starting the pattern with ^.* to
- indicate explicit anchoring. That saves PCRE from having to
- scan along the subject looking for a newline to restart at.
-
- Beware of patterns that contain nested indefinite repeats.
- These can take a long time to run when applied to a string
- that does not match. Consider the pattern fragment
-
- (a+)*
-
- This can match "aaaa" in 33 different ways, and this number
- increases very rapidly as the string gets longer. (The *
- repeat can match 0, 1, 2, 3, or 4 times, and for each of
- those cases other than 0, the + repeats can match different
- numbers of times.) When the remainder of the pattern is such
- that the entire match is going to fail, PCRE has in princi-
- ple to try every possible variation, and this can take an
- extremely long time.
-
- An optimization catches some of the more simple cases such
- as
-
- (a+)*b
-
- where a literal character follows. Before embarking on the
- standard matching procedure, PCRE checks that there is a "b"
- later in the subject string, and if there is not, it fails
- the match immediately. However, when there is no following
- literal this optimization cannot be used. You can see the
- difference by comparing the behaviour of
-
- (a+)*\d
-
- with the pattern above. The former gives a failure almost
- instantly when applied to a whole line of "a" characters,
- whereas the latter takes an appreciable time with strings
- longer than about 20 characters.
-
-
-
-UTF-8 SUPPORT
- Starting at release 3.3, PCRE has some support for character
- strings encoded in the UTF-8 format. This is incomplete, and
- is regarded as experimental. In order to use it, you must
- configure PCRE to include UTF-8 support in the code, and, in
- addition, you must call pcre_compile() with the PCRE_UTF8
- option flag. When you do this, both the pattern and any sub-
- ject strings that are matched against it are treated as
- UTF-8 strings instead of just strings of bytes, but only in
- the cases that are mentioned below.
-
- If you compile PCRE with UTF-8 support, but do not use it at
- run time, the library will be a bit bigger, but the addi-
- tional run time overhead is limited to testing the PCRE_UTF8
- flag in several places, so should not be very large.
-
- PCRE assumes that the strings it is given contain valid
- UTF-8 codes. It does not diagnose invalid UTF-8 strings. If
- you pass invalid UTF-8 strings to PCRE, the results are
- undefined.
-
- Running with PCRE_UTF8 set causes these changes in the way
- PCRE works:
-
- 1. In a pattern, the escape sequence \x{...}, where the con-
- tents of the braces is a string of hexadecimal digits, is
- interpreted as a UTF-8 character whose code number is the
- given hexadecimal number, for example: \x{1234}. This
- inserts from one to six literal bytes into the pattern,
- using the UTF-8 encoding. If a non-hexadecimal digit appears
- between the braces, the item is not recognized.
-
- 2. The original hexadecimal escape sequence, \xhh, generates
- a two-byte UTF-8 character if its value is greater than 127.
-
- 3. Repeat quantifiers are NOT correctly handled if they fol-
- low a multibyte character. For example, \x{100}* and \xc3+
- do not work. If you want to repeat such characters, you must
- enclose them in non-capturing parentheses, for example
- (?:\x{100}), at present.
-
- 4. The dot metacharacter matches one UTF-8 character instead
- of a single byte.
-
- 5. Unlike literal UTF-8 characters, the dot metacharacter
- followed by a repeat quantifier does operate correctly on
- UTF-8 characters instead of single bytes.
-
- 4. Although the \x{...} escape is permitted in a character
- class, characters whose values are greater than 255 cannot
- be included in a class.
-
- 5. A class is matched against a UTF-8 character instead of
- just a single byte, but it can match only characters whose
- values are less than 256. Characters with greater values
- always fail to match a class.
-
- 6. Repeated classes work correctly on multiple characters.
-
- 7. Classes containing just a single character whose value is
- greater than 127 (but less than 256), for example, [\x80] or
- [^\x{93}], do not work because these are optimized into sin-
- gle byte matches. In the first case, of course, the class
- brackets are just redundant.
-
- 8. Lookbehind assertions move backwards in the subject by a
- fixed number of characters instead of a fixed number of
- bytes. Simple cases have been tested to work correctly, but
- there may be hidden gotchas herein.
-
- 9. The character types such as \d and \w do not work
- correctly with UTF-8 characters. They continue to test a
- single byte.
-
- 10. Anything not explicitly mentioned here continues to work
- in bytes rather than in characters.
-
- The following UTF-8 features of Perl 5.6 are not imple-
- mented:
- 1. The escape sequence \C to match a single byte.
-
- 2. The use of Unicode tables and properties and escapes \p,
- \P, and \X.
-
-
-
-AUTHOR
- Philip Hazel <ph10@cam.ac.uk>
- University Computing Service,
- New Museums Site,
- Cambridge CB2 3QG, England.
- Phone: +44 1223 334714
-
- Last updated: 28 August 2000,
- the 250th anniversary of the death of J.S. Bach.
- Copyright (c) 1997-2000 University of Cambridge.
diff --git a/ext/pcre/pcrelib/doc/pcregrep.1 b/ext/pcre/pcrelib/doc/pcregrep.1
deleted file mode 100644
index 41b9051037..0000000000
--- a/ext/pcre/pcrelib/doc/pcregrep.1
+++ /dev/null
@@ -1,76 +0,0 @@
-.TH PCREGREP 1
-.SH NAME
-pcregrep - a grep with Perl-compatible regular expressions.
-.SH SYNOPSIS
-.B pcregrep [-Vchilnsvx] pattern [file] ...
-
-
-.SH DESCRIPTION
-\fBpcregrep\fR searches files for character patterns, in the same way as other
-grep commands do, but it uses the PCRE regular expression library to support
-patterns that are compatible with the regular expressions of Perl 5. See
-\fBpcre(3)\fR for a full description of syntax and semantics.
-
-If no files are specified, \fBpcregrep\fR reads the standard input. By default,
-each line that matches the pattern is copied to the standard output, and if
-there is more than one file, the file name is printed before each line of
-output. However, there are options that can change how \fBpcregrep\fR behaves.
-
-Lines are limited to BUFSIZ characters. BUFSIZ is defined in \fB<stdio.h>\fR.
-The newline character is removed from the end of each line before it is matched
-against the pattern.
-
-
-.SH OPTIONS
-.TP 10
-\fB-V\fR
-Write the version number of the PCRE library being used to the standard error
-stream.
-.TP
-\fB-c\fR
-Do not print individual lines; instead just print a count of the number of
-lines that would otherwise have been printed. If several files are given, a
-count is printed for each of them.
-.TP
-\fB-h\fR
-Suppress printing of filenames when searching multiple files.
-.TP
-\fB-i\fR
-Ignore upper/lower case distinctions during comparisons.
-.TP
-\fB-l\fR
-Instead of printing lines from the files, just print the names of the files
-containing lines that would have been printed. Each file name is printed
-once, on a separate line.
-.TP
-\fB-n\fR
-Precede each line by its line number in the file.
-.TP
-\fB-s\fR
-Work silently, that is, display nothing except error messages.
-The exit status indicates whether any matches were found.
-.TP
-\fB-v\fR
-Invert the sense of the match, so that lines which do \fInot\fR match the
-pattern are now the ones that are found.
-.TP
-\fB-x\fR
-Force the pattern to be anchored (it must start matching at the beginning of
-the line) and in addition, require it to match the entire line. This is
-equivalent to having ^ and $ characters at the start and end of each
-alternative branch in the regular expression.
-
-
-.SH SEE ALSO
-\fBpcre(3)\fR, Perl 5 documentation
-
-
-.SH DIAGNOSTICS
-Exit status is 0 if any matches were found, 1 if no matches were found, and 2
-for syntax errors or inacessible files (even if matches were found).
-
-
-.SH AUTHOR
-Philip Hazel <ph10@cam.ac.uk>
-.br
-Copyright (c) 1997-2000 University of Cambridge.
diff --git a/ext/pcre/pcrelib/doc/pcregrep.html b/ext/pcre/pcrelib/doc/pcregrep.html
deleted file mode 100644
index 77da7c426c..0000000000
--- a/ext/pcre/pcrelib/doc/pcregrep.html
+++ /dev/null
@@ -1,105 +0,0 @@
-<HTML>
-<HEAD>
-<TITLE>pcregrep specification</TITLE>
-</HEAD>
-<body bgcolor="#FFFFFF" text="#00005A">
-<H1>pcregrep specification</H1>
-This HTML document has been generated automatically from the original man page.
-If there is any nonsense in it, please consult the man page in case the
-conversion went wrong.
-<UL>
-<LI><A NAME="TOC1" HREF="#SEC1">NAME</A>
-<LI><A NAME="TOC2" HREF="#SEC2">SYNOPSIS</A>
-<LI><A NAME="TOC3" HREF="#SEC3">DESCRIPTION</A>
-<LI><A NAME="TOC4" HREF="#SEC4">OPTIONS</A>
-<LI><A NAME="TOC5" HREF="#SEC5">SEE ALSO</A>
-<LI><A NAME="TOC6" HREF="#SEC6">DIAGNOSTICS</A>
-<LI><A NAME="TOC7" HREF="#SEC7">AUTHOR</A>
-</UL>
-<LI><A NAME="SEC1" HREF="#TOC1">NAME</A>
-<P>
-pcregrep - a grep with Perl-compatible regular expressions.
-</P>
-<LI><A NAME="SEC2" HREF="#TOC1">SYNOPSIS</A>
-<P>
-<B>pcregrep [-Vchilnsvx] pattern [file] ...</B>
-</P>
-<LI><A NAME="SEC3" HREF="#TOC1">DESCRIPTION</A>
-<P>
-<B>pcregrep</B> searches files for character patterns, in the same way as other
-grep commands do, but it uses the PCRE regular expression library to support
-patterns that are compatible with the regular expressions of Perl 5. See
-<B>pcre(3)</B> for a full description of syntax and semantics.
-</P>
-<P>
-If no files are specified, <B>pcregrep</B> reads the standard input. By default,
-each line that matches the pattern is copied to the standard output, and if
-there is more than one file, the file name is printed before each line of
-output. However, there are options that can change how <B>pcregrep</B> behaves.
-</P>
-<P>
-Lines are limited to BUFSIZ characters. BUFSIZ is defined in <B>&#60;stdio.h&#62;</B>.
-The newline character is removed from the end of each line before it is matched
-against the pattern.
-</P>
-<LI><A NAME="SEC4" HREF="#TOC1">OPTIONS</A>
-<P>
-<B>-V</B>
-Write the version number of the PCRE library being used to the standard error
-stream.
-</P>
-<P>
-<B>-c</B>
-Do not print individual lines; instead just print a count of the number of
-lines that would otherwise have been printed. If several files are given, a
-count is printed for each of them.
-</P>
-<P>
-<B>-h</B>
-Suppress printing of filenames when searching multiple files.
-</P>
-<P>
-<B>-i</B>
-Ignore upper/lower case distinctions during comparisons.
-</P>
-<P>
-<B>-l</B>
-Instead of printing lines from the files, just print the names of the files
-containing lines that would have been printed. Each file name is printed
-once, on a separate line.
-</P>
-<P>
-<B>-n</B>
-Precede each line by its line number in the file.
-</P>
-<P>
-<B>-s</B>
-Work silently, that is, display nothing except error messages.
-The exit status indicates whether any matches were found.
-</P>
-<P>
-<B>-v</B>
-Invert the sense of the match, so that lines which do <I>not</I> match the
-pattern are now the ones that are found.
-</P>
-<P>
-<B>-x</B>
-Force the pattern to be anchored (it must start matching at the beginning of
-the line) and in addition, require it to match the entire line. This is
-equivalent to having ^ and $ characters at the start and end of each
-alternative branch in the regular expression.
-</P>
-<LI><A NAME="SEC5" HREF="#TOC1">SEE ALSO</A>
-<P>
-<B>pcre(3)</B>, Perl 5 documentation
-</P>
-<LI><A NAME="SEC6" HREF="#TOC1">DIAGNOSTICS</A>
-<P>
-Exit status is 0 if any matches were found, 1 if no matches were found, and 2
-for syntax errors or inacessible files (even if matches were found).
-</P>
-<LI><A NAME="SEC7" HREF="#TOC1">AUTHOR</A>
-<P>
-Philip Hazel &#60;ph10@cam.ac.uk&#62;
-<BR>
-Copyright (c) 1997-2000 University of Cambridge.
diff --git a/ext/pcre/pcrelib/doc/pcregrep.txt b/ext/pcre/pcrelib/doc/pcregrep.txt
deleted file mode 100644
index 3483f9e158..0000000000
--- a/ext/pcre/pcrelib/doc/pcregrep.txt
+++ /dev/null
@@ -1,87 +0,0 @@
-NAME
- pcregrep - a grep with Perl-compatible regular expressions.
-
-
-
-SYNOPSIS
- pcregrep [-Vchilnsvx] pattern [file] ...
-
-
-
-DESCRIPTION
- pcregrep searches files for character patterns, in the same
- way as other grep commands do, but it uses the PCRE regular
- expression library to support patterns that are compatible
- with the regular expressions of Perl 5. See pcre(3) for a
- full description of syntax and semantics.
-
- If no files are specified, pcregrep reads the standard
- input. By default, each line that matches the pattern is
- copied to the standard output, and if there is more than one
- file, the file name is printed before each line of output.
- However, there are options that can change how pcregrep
- behaves.
-
- Lines are limited to BUFSIZ characters. BUFSIZ is defined in
- <stdio.h>. The newline character is removed from the end of
- each line before it is matched against the pattern.
-
-
-
-OPTIONS
- -V Write the version number of the PCRE library being
- used to the standard error stream.
-
- -c Do not print individual lines; instead just print
- a count of the number of lines that would other-
- wise have been printed. If several files are
- given, a count is printed for each of them.
-
- -h Suppress printing of filenames when searching mul-
- tiple files.
-
- -i Ignore upper/lower case distinctions during com-
- parisons.
-
- -l Instead of printing lines from the files, just
- print the names of the files containing lines that
- would have been printed. Each file name is printed
- once, on a separate line.
-
- -n Precede each line by its line number in the file.
-
- -s Work silently, that is, display nothing except
- error messages. The exit status indicates whether
- any matches were found.
-
- -v Invert the sense of the match, so that lines which
- do not match the pattern are now the ones that are
- found.
-
- -x Force the pattern to be anchored (it must start
- matching at the beginning of the line) and in
- addition, require it to match the entire line.
- This is equivalent to having ^ and $ characters at
- the start and end of each alternative branch in
- the regular expression.
-
-
-
-SEE ALSO
- pcre(3), Perl 5 documentation
-
-
-
-
-
-DIAGNOSTICS
- Exit status is 0 if any matches were found, 1 if no matches
- were found, and 2 for syntax errors or inacessible files
- (even if matches were found).
-
-
-
-AUTHOR
- Philip Hazel <ph10@cam.ac.uk>
- Copyright (c) 1997-2000 University of Cambridge.
-
diff --git a/ext/pcre/pcrelib/doc/pcreposix.3 b/ext/pcre/pcrelib/doc/pcreposix.3
deleted file mode 100644
index 41716ead91..0000000000
--- a/ext/pcre/pcrelib/doc/pcreposix.3
+++ /dev/null
@@ -1,149 +0,0 @@
-.TH PCRE 3
-.SH NAME
-pcreposix - POSIX API for Perl-compatible regular expressions.
-.SH SYNOPSIS
-.B #include <pcreposix.h>
-.PP
-.SM
-.br
-.B int regcomp(regex_t *\fIpreg\fR, const char *\fIpattern\fR,
-.ti +5n
-.B int \fIcflags\fR);
-.PP
-.br
-.B int regexec(regex_t *\fIpreg\fR, const char *\fIstring\fR,
-.ti +5n
-.B size_t \fInmatch\fR, regmatch_t \fIpmatch\fR[], int \fIeflags\fR);
-.PP
-.br
-.B size_t regerror(int \fIerrcode\fR, const regex_t *\fIpreg\fR,
-.ti +5n
-.B char *\fIerrbuf\fR, size_t \fIerrbuf_size\fR);
-.PP
-.br
-.B void regfree(regex_t *\fIpreg\fR);
-
-
-.SH DESCRIPTION
-This set of functions provides a POSIX-style API to the PCRE regular expression
-package. See the \fBpcre\fR documentation for a description of the native API,
-which contains additional functionality.
-
-The functions described here are just wrapper functions that ultimately call
-the native API. Their prototypes are defined in the \fBpcreposix.h\fR header
-file, and on Unix systems the library itself is called \fBpcreposix.a\fR, so
-can be accessed by adding \fB-lpcreposix\fR to the command for linking an
-application which uses them. Because the POSIX functions call the native ones,
-it is also necessary to add \fR-lpcre\fR.
-
-I have implemented only those option bits that can be reasonably mapped to PCRE
-native options. In addition, the options REG_EXTENDED and REG_NOSUB are defined
-with the value zero. They have no effect, but since programs that are written
-to the POSIX interface often use them, this makes it easier to slot in PCRE as
-a replacement library. Other POSIX options are not even defined.
-
-When PCRE is called via these functions, it is only the API that is POSIX-like
-in style. The syntax and semantics of the regular expressions themselves are
-still those of Perl, subject to the setting of various PCRE options, as
-described below.
-
-The header for these functions is supplied as \fBpcreposix.h\fR to avoid any
-potential clash with other POSIX libraries. It can, of course, be renamed or
-aliased as \fBregex.h\fR, which is the "correct" name. It provides two
-structure types, \fIregex_t\fR for compiled internal forms, and
-\fIregmatch_t\fR for returning captured substrings. It also defines some
-constants whose names start with "REG_"; these are used for setting options and
-identifying error codes.
-
-
-.SH COMPILING A PATTERN
-
-The function \fBregcomp()\fR is called to compile a pattern into an
-internal form. The pattern is a C string terminated by a binary zero, and
-is passed in the argument \fIpattern\fR. The \fIpreg\fR argument is a pointer
-to a regex_t structure which is used as a base for storing information about
-the compiled expression.
-
-The argument \fIcflags\fR is either zero, or contains one or more of the bits
-defined by the following macros:
-
- REG_ICASE
-
-The PCRE_CASELESS option is set when the expression is passed for compilation
-to the native function.
-
- REG_NEWLINE
-
-The PCRE_MULTILINE option is set when the expression is passed for compilation
-to the native function.
-
-In the absence of these flags, no options are passed to the native function.
-This means the the regex is compiled with PCRE default semantics. In
-particular, the way it handles newline characters in the subject string is the
-Perl way, not the POSIX way. Note that setting PCRE_MULTILINE has only
-\fIsome\fR of the effects specified for REG_NEWLINE. It does not affect the way
-newlines are matched by . (they aren't) or a negative class such as [^a] (they
-are).
-
-The yield of \fBregcomp()\fR is zero on success, and non-zero otherwise. The
-\fIpreg\fR structure is filled in on success, and one member of the structure
-is publicized: \fIre_nsub\fR contains the number of capturing subpatterns in
-the regular expression. Various error codes are defined in the header file.
-
-
-.SH MATCHING A PATTERN
-The function \fBregexec()\fR is called to match a pre-compiled pattern
-\fIpreg\fR against a given \fIstring\fR, which is terminated by a zero byte,
-subject to the options in \fIeflags\fR. These can be:
-
- REG_NOTBOL
-
-The PCRE_NOTBOL option is set when calling the underlying PCRE matching
-function.
-
- REG_NOTEOL
-
-The PCRE_NOTEOL option is set when calling the underlying PCRE matching
-function.
-
-The portion of the string that was matched, and also any captured substrings,
-are returned via the \fIpmatch\fR argument, which points to an array of
-\fInmatch\fR structures of type \fIregmatch_t\fR, containing the members
-\fIrm_so\fR and \fIrm_eo\fR. These contain the offset to the first character of
-each substring and the offset to the first character after the end of each
-substring, respectively. The 0th element of the vector relates to the entire
-portion of \fIstring\fR that was matched; subsequent elements relate to the
-capturing subpatterns of the regular expression. Unused entries in the array
-have both structure members set to -1.
-
-A successful match yields a zero return; various error codes are defined in the
-header file, of which REG_NOMATCH is the "expected" failure code.
-
-
-.SH ERROR MESSAGES
-The \fBregerror()\fR function maps a non-zero errorcode from either
-\fBregcomp\fR or \fBregexec\fR to a printable message. If \fIpreg\fR is not
-NULL, the error should have arisen from the use of that structure. A message
-terminated by a binary zero is placed in \fIerrbuf\fR. The length of the
-message, including the zero, is limited to \fIerrbuf_size\fR. The yield of the
-function is the size of buffer needed to hold the whole message.
-
-
-.SH STORAGE
-Compiling a regular expression causes memory to be allocated and associated
-with the \fIpreg\fR structure. The function \fBregfree()\fR frees all such
-memory, after which \fIpreg\fR may no longer be used as a compiled expression.
-
-
-.SH AUTHOR
-Philip Hazel <ph10@cam.ac.uk>
-.br
-University Computing Service,
-.br
-New Museums Site,
-.br
-Cambridge CB2 3QG, England.
-.br
-Phone: +44 1223 334714
-
-Copyright (c) 1997-2000 University of Cambridge.
diff --git a/ext/pcre/pcrelib/doc/pcreposix.html b/ext/pcre/pcrelib/doc/pcreposix.html
deleted file mode 100644
index 9c89478420..0000000000
--- a/ext/pcre/pcrelib/doc/pcreposix.html
+++ /dev/null
@@ -1,191 +0,0 @@
-<HTML>
-<HEAD>
-<TITLE>pcreposix specification</TITLE>
-</HEAD>
-<body bgcolor="#FFFFFF" text="#00005A">
-<H1>pcreposix specification</H1>
-This HTML document has been generated automatically from the original man page.
-If there is any nonsense in it, please consult the man page in case the
-conversion went wrong.
-<UL>
-<LI><A NAME="TOC1" HREF="#SEC1">NAME</A>
-<LI><A NAME="TOC2" HREF="#SEC2">SYNOPSIS</A>
-<LI><A NAME="TOC3" HREF="#SEC3">DESCRIPTION</A>
-<LI><A NAME="TOC4" HREF="#SEC4">COMPILING A PATTERN</A>
-<LI><A NAME="TOC5" HREF="#SEC5">MATCHING A PATTERN</A>
-<LI><A NAME="TOC6" HREF="#SEC6">ERROR MESSAGES</A>
-<LI><A NAME="TOC7" HREF="#SEC7">STORAGE</A>
-<LI><A NAME="TOC8" HREF="#SEC8">AUTHOR</A>
-</UL>
-<LI><A NAME="SEC1" HREF="#TOC1">NAME</A>
-<P>
-pcreposix - POSIX API for Perl-compatible regular expressions.
-</P>
-<LI><A NAME="SEC2" HREF="#TOC1">SYNOPSIS</A>
-<P>
-<B>#include &#60;pcreposix.h&#62;</B>
-</P>
-<P>
-<B>int regcomp(regex_t *<I>preg</I>, const char *<I>pattern</I>,</B>
-<B>int <I>cflags</I>);</B>
-</P>
-<P>
-<B>int regexec(regex_t *<I>preg</I>, const char *<I>string</I>,</B>
-<B>size_t <I>nmatch</I>, regmatch_t <I>pmatch</I>[], int <I>eflags</I>);</B>
-</P>
-<P>
-<B>size_t regerror(int <I>errcode</I>, const regex_t *<I>preg</I>,</B>
-<B>char *<I>errbuf</I>, size_t <I>errbuf_size</I>);</B>
-</P>
-<P>
-<B>void regfree(regex_t *<I>preg</I>);</B>
-</P>
-<LI><A NAME="SEC3" HREF="#TOC1">DESCRIPTION</A>
-<P>
-This set of functions provides a POSIX-style API to the PCRE regular expression
-package. See the <B>pcre</B> documentation for a description of the native API,
-which contains additional functionality.
-</P>
-<P>
-The functions described here are just wrapper functions that ultimately call
-the native API. Their prototypes are defined in the <B>pcreposix.h</B> header
-file, and on Unix systems the library itself is called <B>pcreposix.a</B>, so
-can be accessed by adding <B>-lpcreposix</B> to the command for linking an
-application which uses them. Because the POSIX functions call the native ones,
-it is also necessary to add \fR-lpcre\fR.
-</P>
-<P>
-I have implemented only those option bits that can be reasonably mapped to PCRE
-native options. In addition, the options REG_EXTENDED and REG_NOSUB are defined
-with the value zero. They have no effect, but since programs that are written
-to the POSIX interface often use them, this makes it easier to slot in PCRE as
-a replacement library. Other POSIX options are not even defined.
-</P>
-<P>
-When PCRE is called via these functions, it is only the API that is POSIX-like
-in style. The syntax and semantics of the regular expressions themselves are
-still those of Perl, subject to the setting of various PCRE options, as
-described below.
-</P>
-<P>
-The header for these functions is supplied as <B>pcreposix.h</B> to avoid any
-potential clash with other POSIX libraries. It can, of course, be renamed or
-aliased as <B>regex.h</B>, which is the "correct" name. It provides two
-structure types, <I>regex_t</I> for compiled internal forms, and
-<I>regmatch_t</I> for returning captured substrings. It also defines some
-constants whose names start with "REG_"; these are used for setting options and
-identifying error codes.
-</P>
-<LI><A NAME="SEC4" HREF="#TOC1">COMPILING A PATTERN</A>
-<P>
-The function <B>regcomp()</B> is called to compile a pattern into an
-internal form. The pattern is a C string terminated by a binary zero, and
-is passed in the argument <I>pattern</I>. The <I>preg</I> argument is a pointer
-to a regex_t structure which is used as a base for storing information about
-the compiled expression.
-</P>
-<P>
-The argument <I>cflags</I> is either zero, or contains one or more of the bits
-defined by the following macros:
-</P>
-<P>
-<PRE>
- REG_ICASE
-</PRE>
-</P>
-<P>
-The PCRE_CASELESS option is set when the expression is passed for compilation
-to the native function.
-</P>
-<P>
-<PRE>
- REG_NEWLINE
-</PRE>
-</P>
-<P>
-The PCRE_MULTILINE option is set when the expression is passed for compilation
-to the native function.
-</P>
-<P>
-In the absence of these flags, no options are passed to the native function.
-This means the the regex is compiled with PCRE default semantics. In
-particular, the way it handles newline characters in the subject string is the
-Perl way, not the POSIX way. Note that setting PCRE_MULTILINE has only
-<I>some</I> of the effects specified for REG_NEWLINE. It does not affect the way
-newlines are matched by . (they aren't) or a negative class such as [^a] (they
-are).
-</P>
-<P>
-The yield of <B>regcomp()</B> is zero on success, and non-zero otherwise. The
-<I>preg</I> structure is filled in on success, and one member of the structure
-is publicized: <I>re_nsub</I> contains the number of capturing subpatterns in
-the regular expression. Various error codes are defined in the header file.
-</P>
-<LI><A NAME="SEC5" HREF="#TOC1">MATCHING A PATTERN</A>
-<P>
-The function <B>regexec()</B> is called to match a pre-compiled pattern
-<I>preg</I> against a given <I>string</I>, which is terminated by a zero byte,
-subject to the options in <I>eflags</I>. These can be:
-</P>
-<P>
-<PRE>
- REG_NOTBOL
-</PRE>
-</P>
-<P>
-The PCRE_NOTBOL option is set when calling the underlying PCRE matching
-function.
-</P>
-<P>
-<PRE>
- REG_NOTEOL
-</PRE>
-</P>
-<P>
-The PCRE_NOTEOL option is set when calling the underlying PCRE matching
-function.
-</P>
-<P>
-The portion of the string that was matched, and also any captured substrings,
-are returned via the <I>pmatch</I> argument, which points to an array of
-<I>nmatch</I> structures of type <I>regmatch_t</I>, containing the members
-<I>rm_so</I> and <I>rm_eo</I>. These contain the offset to the first character of
-each substring and the offset to the first character after the end of each
-substring, respectively. The 0th element of the vector relates to the entire
-portion of <I>string</I> that was matched; subsequent elements relate to the
-capturing subpatterns of the regular expression. Unused entries in the array
-have both structure members set to -1.
-</P>
-<P>
-A successful match yields a zero return; various error codes are defined in the
-header file, of which REG_NOMATCH is the "expected" failure code.
-</P>
-<LI><A NAME="SEC6" HREF="#TOC1">ERROR MESSAGES</A>
-<P>
-The <B>regerror()</B> function maps a non-zero errorcode from either
-<B>regcomp</B> or <B>regexec</B> to a printable message. If <I>preg</I> is not
-NULL, the error should have arisen from the use of that structure. A message
-terminated by a binary zero is placed in <I>errbuf</I>. The length of the
-message, including the zero, is limited to <I>errbuf_size</I>. The yield of the
-function is the size of buffer needed to hold the whole message.
-</P>
-<LI><A NAME="SEC7" HREF="#TOC1">STORAGE</A>
-<P>
-Compiling a regular expression causes memory to be allocated and associated
-with the <I>preg</I> structure. The function <B>regfree()</B> frees all such
-memory, after which <I>preg</I> may no longer be used as a compiled expression.
-</P>
-<LI><A NAME="SEC8" HREF="#TOC1">AUTHOR</A>
-<P>
-Philip Hazel &#60;ph10@cam.ac.uk&#62;
-<BR>
-University Computing Service,
-<BR>
-New Museums Site,
-<BR>
-Cambridge CB2 3QG, England.
-<BR>
-Phone: +44 1223 334714
-</P>
-<P>
-Copyright (c) 1997-2000 University of Cambridge.
diff --git a/ext/pcre/pcrelib/doc/pcreposix.txt b/ext/pcre/pcrelib/doc/pcreposix.txt
deleted file mode 100644
index 2d76f7cdcc..0000000000
--- a/ext/pcre/pcrelib/doc/pcreposix.txt
+++ /dev/null
@@ -1,159 +0,0 @@
-NAME
- pcreposix - POSIX API for Perl-compatible regular expres-
- sions.
-
-
-
-SYNOPSIS
- #include <pcreposix.h>
-
- int regcomp(regex_t *preg, const char *pattern,
- int cflags);
-
- int regexec(regex_t *preg, const char *string,
- size_t nmatch, regmatch_t pmatch[], int eflags);
-
- size_t regerror(int errcode, const regex_t *preg,
- char *errbuf, size_t errbuf_size);
-
- void regfree(regex_t *preg);
-
-
-
-DESCRIPTION
- This set of functions provides a POSIX-style API to the PCRE
- regular expression package. See the pcre documentation for a
- description of the native API, which contains additional
- functionality.
-
- The functions described here are just wrapper functions that
- ultimately call the native API. Their prototypes are defined
- in the pcreposix.h header file, and on Unix systems the
- library itself is called pcreposix.a, so can be accessed by
- adding -lpcreposix to the command for linking an application
- which uses them. Because the POSIX functions call the native
- ones, it is also necessary to add -lpcre.
-
- I have implemented only those option bits that can be rea-
- sonably mapped to PCRE native options. In addition, the
- options REG_EXTENDED and REG_NOSUB are defined with the
- value zero. They have no effect, but since programs that are
- written to the POSIX interface often use them, this makes it
- easier to slot in PCRE as a replacement library. Other POSIX
- options are not even defined.
-
- When PCRE is called via these functions, it is only the API
- that is POSIX-like in style. The syntax and semantics of the
- regular expressions themselves are still those of Perl, sub-
- ject to the setting of various PCRE options, as described
- below.
-
- The header for these functions is supplied as pcreposix.h to
- avoid any potential clash with other POSIX libraries. It
- can, of course, be renamed or aliased as regex.h, which is
- the "correct" name. It provides two structure types, regex_t
- for compiled internal forms, and regmatch_t for returning
- captured substrings. It also defines some constants whose
- names start with "REG_"; these are used for setting options
- and identifying error codes.
-
-
-
-COMPILING A PATTERN
- The function regcomp() is called to compile a pattern into
- an internal form. The pattern is a C string terminated by a
- binary zero, and is passed in the argument pattern. The preg
- argument is a pointer to a regex_t structure which is used
- as a base for storing information about the compiled expres-
- sion.
-
- The argument cflags is either zero, or contains one or more
- of the bits defined by the following macros:
-
- REG_ICASE
-
- The PCRE_CASELESS option is set when the expression is
- passed for compilation to the native function.
-
- REG_NEWLINE
-
- The PCRE_MULTILINE option is set when the expression is
- passed for compilation to the native function.
-
- In the absence of these flags, no options are passed to the
- native function. This means the the regex is compiled with
- PCRE default semantics. In particular, the way it handles
- newline characters in the subject string is the Perl way,
- not the POSIX way. Note that setting PCRE_MULTILINE has only
- some of the effects specified for REG_NEWLINE. It does not
- affect the way newlines are matched by . (they aren't) or a
- negative class such as [^a] (they are).
-
- The yield of regcomp() is zero on success, and non-zero oth-
- erwise. The preg structure is filled in on success, and one
- member of the structure is publicized: re_nsub contains the
- number of capturing subpatterns in the regular expression.
- Various error codes are defined in the header file.
-
-
-
-MATCHING A PATTERN
- The function regexec() is called to match a pre-compiled
- pattern preg against a given string, which is terminated by
- a zero byte, subject to the options in eflags. These can be:
-
- REG_NOTBOL
-
- The PCRE_NOTBOL option is set when calling the underlying
- PCRE matching function.
-
- REG_NOTEOL
-
- The PCRE_NOTEOL option is set when calling the underlying
- PCRE matching function.
-
- The portion of the string that was matched, and also any
- captured substrings, are returned via the pmatch argument,
- which points to an array of nmatch structures of type
- regmatch_t, containing the members rm_so and rm_eo. These
- contain the offset to the first character of each substring
- and the offset to the first character after the end of each
- substring, respectively. The 0th element of the vector
- relates to the entire portion of string that was matched;
- subsequent elements relate to the capturing subpatterns of
- the regular expression. Unused entries in the array have
- both structure members set to -1.
-
- A successful match yields a zero return; various error codes
- are defined in the header file, of which REG_NOMATCH is the
- "expected" failure code.
-
-
-
-ERROR MESSAGES
- The regerror() function maps a non-zero errorcode from
- either regcomp or regexec to a printable message. If preg is
- not NULL, the error should have arisen from the use of that
- structure. A message terminated by a binary zero is placed
- in errbuf. The length of the message, including the zero, is
- limited to errbuf_size. The yield of the function is the
- size of buffer needed to hold the whole message.
-
-
-
-STORAGE
- Compiling a regular expression causes memory to be allocated
- and associated with the preg structure. The function reg-
- free() frees all such memory, after which preg may no longer
- be used as a compiled expression.
-
-
-
-AUTHOR
- Philip Hazel <ph10@cam.ac.uk>
- University Computing Service,
- New Museums Site,
- Cambridge CB2 3QG, England.
- Phone: +44 1223 334714
-
- Copyright (c) 1997-2000 University of Cambridge.
diff --git a/ext/pcre/pcrelib/doc/pcretest.txt b/ext/pcre/pcrelib/doc/pcretest.txt
deleted file mode 100644
index add2979f14..0000000000
--- a/ext/pcre/pcrelib/doc/pcretest.txt
+++ /dev/null
@@ -1,246 +0,0 @@
-The pcretest program
---------------------
-
-This program is intended for testing PCRE, but it can also be used for
-experimenting with regular expressions.
-
-If it is given two filename arguments, it reads from the first and writes to
-the second. If it is given only one filename argument, it reads from that file
-and writes to stdout. Otherwise, it reads from stdin and writes to stdout, and
-prompts for each line of input, using "re>" to prompt for regular expressions,
-and "data>" to prompt for data lines.
-
-The program handles any number of sets of input on a single input file. Each
-set starts with a regular expression, and continues with any number of data
-lines to be matched against the pattern. An empty line signals the end of the
-data lines, at which point a new regular expression is read. The regular
-expressions are given enclosed in any non-alphameric delimiters other than
-backslash, for example
-
- /(a|bc)x+yz/
-
-White space before the initial delimiter is ignored. A regular expression may
-be continued over several input lines, in which case the newline characters are
-included within it. See the test input files in the testdata directory for many
-examples. It is possible to include the delimiter within the pattern by
-escaping it, for example
-
- /abc\/def/
-
-If you do so, the escape and the delimiter form part of the pattern, but since
-delimiters are always non-alphameric, this does not affect its interpretation.
-If the terminating delimiter is immediately followed by a backslash, for
-example,
-
- /abc/\
-
-then a backslash is added to the end of the pattern. This is done to provide a
-way of testing the error condition that arises if a pattern finishes with a
-backslash, because
-
- /abc\/
-
-is interpreted as the first line of a pattern that starts with "abc/", causing
-pcretest to read the next line as a continuation of the regular expression.
-
-
-PATTERN MODIFIERS
------------------
-
-The pattern may be followed by i, m, s, or x to set the PCRE_CASELESS,
-PCRE_MULTILINE, PCRE_DOTALL, or PCRE_EXTENDED options, respectively. For
-example:
-
- /caseless/i
-
-These modifier letters have the same effect as they do in Perl. There are
-others which set PCRE options that do not correspond to anything in Perl: /A,
-/E, and /X set PCRE_ANCHORED, PCRE_DOLLAR_ENDONLY, and PCRE_EXTRA respectively.
-
-Searching for all possible matches within each subject string can be requested
-by the /g or /G modifier. After finding a match, PCRE is called again to search
-the remainder of the subject string. The difference between /g and /G is that
-the former uses the startoffset argument to pcre_exec() to start searching at
-a new point within the entire string (which is in effect what Perl does),
-whereas the latter passes over a shortened substring. This makes a difference
-to the matching process if the pattern begins with a lookbehind assertion
-(including \b or \B).
-
-If any call to pcre_exec() in a /g or /G sequence matches an empty string, the
-next call is done with the PCRE_NOTEMPTY and PCRE_ANCHORED flags set in order
-to search for another, non-empty, match at the same point. If this second match
-fails, the start offset is advanced by one, and the normal match is retried.
-This imitates the way Perl handles such cases when using the /g modifier or the
-split() function.
-
-There are a number of other modifiers for controlling the way pcretest
-operates.
-
-The /+ modifier requests that as well as outputting the substring that matched
-the entire pattern, pcretest should in addition output the remainder of the
-subject string. This is useful for tests where the subject contains multiple
-copies of the same substring.
-
-The /L modifier must be followed directly by the name of a locale, for example,
-
- /pattern/Lfr
-
-For this reason, it must be the last modifier letter. The given locale is set,
-pcre_maketables() is called to build a set of character tables for the locale,
-and this is then passed to pcre_compile() when compiling the regular
-expression. Without an /L modifier, NULL is passed as the tables pointer; that
-is, /L applies only to the expression on which it appears.
-
-The /I modifier requests that pcretest output information about the compiled
-expression (whether it is anchored, has a fixed first character, and so on). It
-does this by calling pcre_fullinfo() after compiling an expression, and
-outputting the information it gets back. If the pattern is studied, the results
-of that are also output.
-
-The /D modifier is a PCRE debugging feature, which also assumes /I. It causes
-the internal form of compiled regular expressions to be output after
-compilation.
-
-The /S modifier causes pcre_study() to be called after the expression has been
-compiled, and the results used when the expression is matched.
-
-The /M modifier causes the size of memory block used to hold the compiled
-pattern to be output.
-
-The /P modifier causes pcretest to call PCRE via the POSIX wrapper API rather
-than its native API. When this is done, all other modifiers except /i, /m, and
-/+ are ignored. REG_ICASE is set if /i is present, and REG_NEWLINE is set if /m
-is present. The wrapper functions force PCRE_DOLLAR_ENDONLY always, and
-PCRE_DOTALL unless REG_NEWLINE is set.
-
-The /8 modifier causes pcretest to call PCRE with the PCRE_UTF8 option set.
-This turns on the (currently incomplete) support for UTF-8 character handling
-in PCRE, provided that it was compiled with this support enabled. This modifier
-also causes any non-printing characters in output strings to be printed using
-the \x{hh...} notation if they are valid UTF-8 sequences.
-
-
-DATA LINES
-----------
-
-Before each data line is passed to pcre_exec(), leading and trailing whitespace
-is removed, and it is then scanned for \ escapes. The following are recognized:
-
- \a alarm (= BEL)
- \b backspace
- \e escape
- \f formfeed
- \n newline
- \r carriage return
- \t tab
- \v vertical tab
- \nnn octal character (up to 3 octal digits)
- \xhh hexadecimal character (up to 2 hex digits)
- \x{hh...} hexadecimal UTF-8 character
-
- \A pass the PCRE_ANCHORED option to pcre_exec()
- \B pass the PCRE_NOTBOL option to pcre_exec()
- \Cdd call pcre_copy_substring() for substring dd after a successful
- match (any decimal number less than 32)
- \Gdd call pcre_get_substring() for substring dd after a successful
- match (any decimal number less than 32)
- \L call pcre_get_substringlist() after a successful match
- \N pass the PCRE_NOTEMPTY option to pcre_exec()
- \Odd set the size of the output vector passed to pcre_exec() to dd
- (any number of decimal digits)
- \Z pass the PCRE_NOTEOL option to pcre_exec()
-
-A backslash followed by anything else just escapes the anything else. If the
-very last character is a backslash, it is ignored. This gives a way of passing
-an empty line as data, since a real empty line terminates the data input.
-
-If /P was present on the regex, causing the POSIX wrapper API to be used, only
-\B, and \Z have any effect, causing REG_NOTBOL and REG_NOTEOL to be passed to
-regexec() respectively.
-
-The use of \x{hh...} to represent UTF-8 characters is not dependent on the use
-of the /8 modifier on the pattern. It is recognized always. There may be any
-number of hexadecimal digits inside the braces. The result is from one to six
-bytes, encoded according to the UTF-8 rules.
-
-
-OUTPUT FROM PCRETEST
---------------------
-
-When a match succeeds, pcretest outputs the list of captured substrings that
-pcre_exec() returns, starting with number 0 for the string that matched the
-whole pattern. Here is an example of an interactive pcretest run.
-
- $ pcretest
- PCRE version 2.06 08-Jun-1999
-
- re> /^abc(\d+)/
- data> abc123
- 0: abc123
- 1: 123
- data> xyz
- No match
-
-If the strings contain any non-printing characters, they are output as \0x
-escapes, or as \x{...} escapes if the /8 modifier was present on the pattern.
-If the pattern has the /+ modifier, then the output for substring 0 is followed
-by the the rest of the subject string, identified by "0+" like this:
-
- re> /cat/+
- data> cataract
- 0: cat
- 0+ aract
-
-If the pattern has the /g or /G modifier, the results of successive matching
-attempts are output in sequence, like this:
-
- re> /\Bi(\w\w)/g
- data> Mississippi
- 0: iss
- 1: ss
- 0: iss
- 1: ss
- 0: ipp
- 1: pp
-
-"No match" is output only if the first match attempt fails.
-
-If any of \C, \G, or \L are present in a data line that is successfully
-matched, the substrings extracted by the convenience functions are output with
-C, G, or L after the string number instead of a colon. This is in addition to
-the normal full list. The string length (that is, the return from the
-extraction function) is given in parentheses after each string for \C and \G.
-
-Note that while patterns can be continued over several lines (a plain ">"
-prompt is used for continuations), data lines may not. However newlines can be
-included in data by means of the \n escape.
-
-
-COMMAND LINE OPTIONS
---------------------
-
-If the -p option is given to pcretest, it is equivalent to adding /P to each
-regular expression: the POSIX wrapper API is used to call PCRE. None of the
-following flags has any effect in this case.
-
-If the option -d is given to pcretest, it is equivalent to adding /D to each
-regular expression: the internal form is output after compilation.
-
-If the option -i is given to pcretest, it is equivalent to adding /I to each
-regular expression: information about the compiled pattern is given after
-compilation.
-
-If the option -m is given to pcretest, it outputs the size of each compiled
-pattern after it has been compiled. It is equivalent to adding /M to each
-regular expression. For compatibility with earlier versions of pcretest, -s is
-a synonym for -m.
-
-If the -t option is given, each compile, study, and match is run 20000 times
-while being timed, and the resulting time per compile or match is output in
-milliseconds. Do not set -t with -m, because you will then get the size output
-20000 times and the timing will be distorted. If you want to change the number
-of repetitions used for timing, edit the definition of LOOPREPEAT at the top of
-pcretest.c
-
-Philip Hazel <ph10@cam.ac.uk>
-August 2000
diff --git a/ext/pcre/pcrelib/doc/perltest.txt b/ext/pcre/pcrelib/doc/perltest.txt
deleted file mode 100644
index 5a404016b5..0000000000
--- a/ext/pcre/pcrelib/doc/perltest.txt
+++ /dev/null
@@ -1,29 +0,0 @@
-The perltest program
---------------------
-
-The perltest program tests Perl's regular expressions; it has the same
-specification as pcretest, and so can be given identical input, except that
-input patterns can be followed only by Perl's lower case modifiers and /+ (as
-used by pcretest), which is recognized and handled by the program.
-
-The data lines are processed as Perl double-quoted strings, so if they contain
-" \ $ or @ characters, these have to be escaped. For this reason, all such
-characters in testinput1 and testinput3 are escaped so that they can be used
-for perltest as well as for pcretest, and the special upper case modifiers such
-as /A that pcretest recognizes are not used in these files. The output should
-be identical, apart from the initial identifying banner.
-
-For testing UTF-8 features, an alternative form of perltest, called perltest8,
-is supplied. This requires Perl 5.6 or higher. It recognizes the special
-modifier /8 that pcretest uses to invoke UTF-8 functionality. The testinput5
-file can be fed to perltest8.
-
-The testinput2 and testinput4 files are not suitable for feeding to perltest,
-since they do make use of the special upper case modifiers and escapes that
-pcretest uses to test some features of PCRE. The first of these files also
-contains malformed regular expressions, in order to check that PCRE diagnoses
-them correctly. Similarly, testinput6 tests UTF-8 features that do not relate
-to Perl.
-
-Philip Hazel <ph10@cam.ac.uk>
-August 2000
diff --git a/ext/pcre/pcrelib/get.c b/ext/pcre/pcrelib/get.c
deleted file mode 100644
index 42e9bd4933..0000000000
--- a/ext/pcre/pcrelib/get.c
+++ /dev/null
@@ -1,227 +0,0 @@
-/*************************************************
-* Perl-Compatible Regular Expressions *
-*************************************************/
-
-/*
-This is a library of functions to support regular expressions whose syntax
-and semantics are as close as possible to those of the Perl 5 language. See
-the file Tech.Notes for some information on the internals.
-
-Written by: Philip Hazel <ph10@cam.ac.uk>
-
- Copyright (c) 1997-2000 University of Cambridge
-
------------------------------------------------------------------------------
-Permission is granted to anyone to use this software for any purpose on any
-computer system, and to redistribute it freely, subject to the following
-restrictions:
-
-1. This software is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-
-2. The origin of this software must not be misrepresented, either by
- explicit claim or by omission.
-
-3. Altered versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
-
-4. If PCRE is embedded in any software that is released under the GNU
- General Purpose Licence (GPL), then the terms of that licence shall
- supersede any condition above with which it is incompatible.
------------------------------------------------------------------------------
-*/
-
-/* This module contains some convenience functions for extracting substrings
-from the subject string after a regex match has succeeded. The original idea
-for these functions came from Scott Wimer <scottw@cgibuilder.com>. */
-
-
-/* Include the internals header, which itself includes Standard C headers plus
-the external pcre header. */
-
-#include "internal.h"
-
-
-
-/*************************************************
-* Copy captured string to given buffer *
-*************************************************/
-
-/* This function copies a single captured substring into a given buffer.
-Note that we use memcpy() rather than strncpy() in case there are binary zeros
-in the string.
-
-Arguments:
- subject the subject string that was matched
- ovector pointer to the offsets table
- stringcount the number of substrings that were captured
- (i.e. the yield of the pcre_exec call, unless
- that was zero, in which case it should be 1/3
- of the offset table size)
- stringnumber the number of the required substring
- buffer where to put the substring
- size the size of the buffer
-
-Returns: if successful:
- the length of the copied string, not including the zero
- that is put on the end; can be zero
- if not successful:
- PCRE_ERROR_NOMEMORY (-6) buffer too small
- PCRE_ERROR_NOSUBSTRING (-7) no such captured substring
-*/
-
-int
-pcre_copy_substring(const char *subject, int *ovector, int stringcount,
- int stringnumber, char *buffer, int size)
-{
-int yield;
-if (stringnumber < 0 || stringnumber >= stringcount)
- return PCRE_ERROR_NOSUBSTRING;
-stringnumber *= 2;
-yield = ovector[stringnumber+1] - ovector[stringnumber];
-if (size < yield + 1) return PCRE_ERROR_NOMEMORY;
-memcpy(buffer, subject + ovector[stringnumber], yield);
-buffer[yield] = 0;
-return yield;
-}
-
-
-
-/*************************************************
-* Copy all captured strings to new store *
-*************************************************/
-
-/* This function gets one chunk of store and builds a list of pointers and all
-of the captured substrings in it. A NULL pointer is put on the end of the list.
-
-Arguments:
- subject the subject string that was matched
- ovector pointer to the offsets table
- stringcount the number of substrings that were captured
- (i.e. the yield of the pcre_exec call, unless
- that was zero, in which case it should be 1/3
- of the offset table size)
- listptr set to point to the list of pointers
-
-Returns: if successful: 0
- if not successful:
- PCRE_ERROR_NOMEMORY (-6) failed to get store
-*/
-
-int
-pcre_get_substring_list(const char *subject, int *ovector, int stringcount,
- const char ***listptr)
-{
-int i;
-int size = sizeof(char *);
-int double_count = stringcount * 2;
-char **stringlist;
-char *p;
-
-for (i = 0; i < double_count; i += 2)
- size += sizeof(char *) + ovector[i+1] - ovector[i] + 1;
-
-stringlist = (char **)(pcre_malloc)(size);
-if (stringlist == NULL) return PCRE_ERROR_NOMEMORY;
-
-*listptr = (const char **)stringlist;
-p = (char *)(stringlist + stringcount + 1);
-
-for (i = 0; i < double_count; i += 2)
- {
- int len = ovector[i+1] - ovector[i];
- memcpy(p, subject + ovector[i], len);
- *stringlist++ = p;
- p += len;
- *p++ = 0;
- }
-
-*stringlist = NULL;
-return 0;
-}
-
-
-
-/*************************************************
-* Free store obtained by get_substring_list *
-*************************************************/
-
-/* This function exists for the benefit of people calling PCRE from non-C
-programs that can call its functions, but not free() or (pcre_free)() directly.
-
-Argument: the result of a previous pcre_get_substring_list()
-Returns: nothing
-*/
-
-void
-pcre_free_substring_list(const char **pointer)
-{
-(pcre_free)((void *)pointer);
-}
-
-
-
-/*************************************************
-* Copy captured string to new store *
-*************************************************/
-
-/* This function copies a single captured substring into a piece of new
-store
-
-Arguments:
- subject the subject string that was matched
- ovector pointer to the offsets table
- stringcount the number of substrings that were captured
- (i.e. the yield of the pcre_exec call, unless
- that was zero, in which case it should be 1/3
- of the offset table size)
- stringnumber the number of the required substring
- stringptr where to put a pointer to the substring
-
-Returns: if successful:
- the length of the string, not including the zero that
- is put on the end; can be zero
- if not successful:
- PCRE_ERROR_NOMEMORY (-6) failed to get store
- PCRE_ERROR_NOSUBSTRING (-7) substring not present
-*/
-
-int
-pcre_get_substring(const char *subject, int *ovector, int stringcount,
- int stringnumber, const char **stringptr)
-{
-int yield;
-char *substring;
-if (stringnumber < 0 || stringnumber >= stringcount)
- return PCRE_ERROR_NOSUBSTRING;
-stringnumber *= 2;
-yield = ovector[stringnumber+1] - ovector[stringnumber];
-substring = (char *)(pcre_malloc)(yield + 1);
-if (substring == NULL) return PCRE_ERROR_NOMEMORY;
-memcpy(substring, subject + ovector[stringnumber], yield);
-substring[yield] = 0;
-*stringptr = substring;
-return yield;
-}
-
-
-
-/*************************************************
-* Free store obtained by get_substring *
-*************************************************/
-
-/* This function exists for the benefit of people calling PCRE from non-C
-programs that can call its functions, but not free() or (pcre_free)() directly.
-
-Argument: the result of a previous pcre_get_substring()
-Returns: nothing
-*/
-
-void
-pcre_free_substring(const char *pointer)
-{
-(pcre_free)((void *)pointer);
-}
-
-/* End of get.c */
diff --git a/ext/pcre/pcrelib/internal.h b/ext/pcre/pcrelib/internal.h
deleted file mode 100644
index bd992f0dd2..0000000000
--- a/ext/pcre/pcrelib/internal.h
+++ /dev/null
@@ -1,385 +0,0 @@
-/*************************************************
-* Perl-Compatible Regular Expressions *
-*************************************************/
-
-
-/* This is a library of functions to support regular expressions whose syntax
-and semantics are as close as possible to those of the Perl 5 language. See
-the file Tech.Notes for some information on the internals.
-
-Written by: Philip Hazel <ph10@cam.ac.uk>
-
- Copyright (c) 1997-2000 University of Cambridge
-
------------------------------------------------------------------------------
-Permission is granted to anyone to use this software for any purpose on any
-computer system, and to redistribute it freely, subject to the following
-restrictions:
-
-1. This software is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-
-2. The origin of this software must not be misrepresented, either by
- explicit claim or by omission.
-
-3. Altered versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
-
-4. If PCRE is embedded in any software that is released under the GNU
- General Purpose Licence (GPL), then the terms of that licence shall
- supersede any condition above with which it is incompatible.
------------------------------------------------------------------------------
-*/
-
-/* This header contains definitions that are shared between the different
-modules, but which are not relevant to the outside. */
-
-/* Get the definitions provided by running "configure" */
-
-#ifdef PHP_WIN32
-#include "config.w32.h"
-#else
-#include "php_config.h"
-#endif
-
-/* To cope with SunOS4 and other systems that lack memmove() but have bcopy(),
-define a macro for memmove() if HAVE_MEMMOVE is false, provided that HAVE_BCOPY
-is set. Otherwise, include an emulating function for those systems that have
-neither (there some non-Unix environments where this is the case). This assumes
-that all calls to memmove are moving strings upwards in store, which is the
-case in PCRE. */
-
-#if ! HAVE_MEMMOVE
-#undef memmove /* some systems may have a macro */
-#if HAVE_BCOPY
-#define memmove(a, b, c) bcopy(b, a, c)
-#else
-void *
-pcre_memmove(unsigned char *dest, const unsigned char *src, size_t n)
-{
-int i;
-dest += n;
-src += n;
-for (i = 0; i < n; ++i) *(--dest) = *(--src);
-}
-#define memmove(a, b, c) pcre_memmove(a, b, c)
-#endif
-#endif
-
-/* Standard C headers plus the external interface definition */
-
-#include <ctype.h>
-#include <limits.h>
-#include <stddef.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include "pcre.h"
-
-/* In case there is no definition of offsetof() provided - though any proper
-Standard C system should have one. */
-
-#ifndef offsetof
-#define offsetof(p_type,field) ((size_t)&(((p_type *)0)->field))
-#endif
-
-/* These are the public options that can change during matching. */
-
-#define PCRE_IMS (PCRE_CASELESS|PCRE_MULTILINE|PCRE_DOTALL)
-
-/* Private options flags start at the most significant end of the four bytes,
-but skip the top bit so we can use ints for convenience without getting tangled
-with negative values. The public options defined in pcre.h start at the least
-significant end. Make sure they don't overlap, though now that we have expanded
-to four bytes there is plenty of space. */
-
-#define PCRE_FIRSTSET 0x40000000 /* first_char is set */
-#define PCRE_REQCHSET 0x20000000 /* req_char is set */
-#define PCRE_STARTLINE 0x10000000 /* start after \n for multiline */
-#define PCRE_INGROUP 0x08000000 /* compiling inside a group */
-#define PCRE_ICHANGED 0x04000000 /* i option changes within regex */
-
-/* Options for the "extra" block produced by pcre_study(). */
-
-#define PCRE_STUDY_MAPPED 0x01 /* a map of starting chars exists */
-
-/* Masks for identifying the public options which are permitted at compile
-time, run time or study time, respectively. */
-
-#define PUBLIC_OPTIONS \
- (PCRE_CASELESS|PCRE_EXTENDED|PCRE_ANCHORED|PCRE_MULTILINE| \
- PCRE_DOTALL|PCRE_DOLLAR_ENDONLY|PCRE_EXTRA|PCRE_UNGREEDY|PCRE_UTF8)
-
-#define PUBLIC_EXEC_OPTIONS \
- (PCRE_ANCHORED|PCRE_NOTBOL|PCRE_NOTEOL|PCRE_NOTEMPTY)
-
-#define PUBLIC_STUDY_OPTIONS 0 /* None defined */
-
-/* Magic number to provide a small check against being handed junk. */
-
-#define MAGIC_NUMBER 0x50435245UL /* 'PCRE' */
-
-/* Miscellaneous definitions */
-
-typedef int BOOL;
-
-#define FALSE 0
-#define TRUE 1
-
-/* These are escaped items that aren't just an encoding of a particular data
-value such as \n. They must have non-zero values, as check_escape() returns
-their negation. Also, they must appear in the same order as in the opcode
-definitions below, up to ESC_z. The final one must be ESC_REF as subsequent
-values are used for \1, \2, \3, etc. There is a test in the code for an escape
-greater than ESC_b and less than ESC_X to detect the types that may be
-repeated. If any new escapes are put in-between that don't consume a character,
-that code will have to change. */
-
-enum { ESC_A = 1, ESC_B, ESC_b, ESC_D, ESC_d, ESC_S, ESC_s, ESC_W, ESC_w,
- ESC_Z, ESC_z, ESC_REF };
-
-/* Opcode table: OP_BRA must be last, as all values >= it are used for brackets
-that extract substrings. Starting from 1 (i.e. after OP_END), the values up to
-OP_EOD must correspond in order to the list of escapes immediately above. */
-
-enum {
- OP_END, /* End of pattern */
-
- /* Values corresponding to backslashed metacharacters */
-
- OP_SOD, /* Start of data: \A */
- OP_NOT_WORD_BOUNDARY, /* \B */
- OP_WORD_BOUNDARY, /* \b */
- OP_NOT_DIGIT, /* \D */
- OP_DIGIT, /* \d */
- OP_NOT_WHITESPACE, /* \S */
- OP_WHITESPACE, /* \s */
- OP_NOT_WORDCHAR, /* \W */
- OP_WORDCHAR, /* \w */
- OP_EODN, /* End of data or \n at end of data: \Z. */
- OP_EOD, /* End of data: \z */
-
- OP_OPT, /* Set runtime options */
- OP_CIRC, /* Start of line - varies with multiline switch */
- OP_DOLL, /* End of line - varies with multiline switch */
- OP_ANY, /* Match any character */
- OP_CHARS, /* Match string of characters */
- OP_NOT, /* Match anything but the following char */
-
- OP_STAR, /* The maximizing and minimizing versions of */
- OP_MINSTAR, /* all these opcodes must come in pairs, with */
- OP_PLUS, /* the minimizing one second. */
- OP_MINPLUS, /* This first set applies to single characters */
- OP_QUERY,
- OP_MINQUERY,
- OP_UPTO, /* From 0 to n matches */
- OP_MINUPTO,
- OP_EXACT, /* Exactly n matches */
-
- OP_NOTSTAR, /* The maximizing and minimizing versions of */
- OP_NOTMINSTAR, /* all these opcodes must come in pairs, with */
- OP_NOTPLUS, /* the minimizing one second. */
- OP_NOTMINPLUS, /* This first set applies to "not" single characters */
- OP_NOTQUERY,
- OP_NOTMINQUERY,
- OP_NOTUPTO, /* From 0 to n matches */
- OP_NOTMINUPTO,
- OP_NOTEXACT, /* Exactly n matches */
-
- OP_TYPESTAR, /* The maximizing and minimizing versions of */
- OP_TYPEMINSTAR, /* all these opcodes must come in pairs, with */
- OP_TYPEPLUS, /* the minimizing one second. These codes must */
- OP_TYPEMINPLUS, /* be in exactly the same order as those above. */
- OP_TYPEQUERY, /* This set applies to character types such as \d */
- OP_TYPEMINQUERY,
- OP_TYPEUPTO, /* From 0 to n matches */
- OP_TYPEMINUPTO,
- OP_TYPEEXACT, /* Exactly n matches */
-
- OP_CRSTAR, /* The maximizing and minimizing versions of */
- OP_CRMINSTAR, /* all these opcodes must come in pairs, with */
- OP_CRPLUS, /* the minimizing one second. These codes must */
- OP_CRMINPLUS, /* be in exactly the same order as those above. */
- OP_CRQUERY, /* These are for character classes and back refs */
- OP_CRMINQUERY,
- OP_CRRANGE, /* These are different to the three seta above. */
- OP_CRMINRANGE,
-
- OP_CLASS, /* Match a character class */
- OP_REF, /* Match a back reference */
- OP_RECURSE, /* Match this pattern recursively */
-
- OP_ALT, /* Start of alternation */
- OP_KET, /* End of group that doesn't have an unbounded repeat */
- OP_KETRMAX, /* These two must remain together and in this */
- OP_KETRMIN, /* order. They are for groups the repeat for ever. */
-
- /* The assertions must come before ONCE and COND */
-
- OP_ASSERT, /* Positive lookahead */
- OP_ASSERT_NOT, /* Negative lookahead */
- OP_ASSERTBACK, /* Positive lookbehind */
- OP_ASSERTBACK_NOT, /* Negative lookbehind */
- OP_REVERSE, /* Move pointer back - used in lookbehind assertions */
-
- /* ONCE and COND must come after the assertions, with ONCE first, as there's
- a test for >= ONCE for a subpattern that isn't an assertion. */
-
- OP_ONCE, /* Once matched, don't back up into the subpattern */
- OP_COND, /* Conditional group */
- OP_CREF, /* Used to hold an extraction string number */
-
- OP_BRAZERO, /* These two must remain together and in this */
- OP_BRAMINZERO, /* order. */
-
- OP_BRA /* This and greater values are used for brackets that
- extract substrings. */
-};
-
-/* The highest extraction number. This is limited by the number of opcodes
-left after OP_BRA, i.e. 255 - OP_BRA. We actually set it somewhat lower. */
-
-#define EXTRACT_MAX 99
-
-/* The texts of compile-time error messages are defined as macros here so that
-they can be accessed by the POSIX wrapper and converted into error codes. Yes,
-I could have used error codes in the first place, but didn't feel like changing
-just to accommodate the POSIX wrapper. */
-
-#define ERR1 "\\ at end of pattern"
-#define ERR2 "\\c at end of pattern"
-#define ERR3 "unrecognized character follows \\"
-#define ERR4 "numbers out of order in {} quantifier"
-#define ERR5 "number too big in {} quantifier"
-#define ERR6 "missing terminating ] for character class"
-#define ERR7 "invalid escape sequence in character class"
-#define ERR8 "range out of order in character class"
-#define ERR9 "nothing to repeat"
-#define ERR10 "operand of unlimited repeat could match the empty string"
-#define ERR11 "internal error: unexpected repeat"
-#define ERR12 "unrecognized character after (?"
-#define ERR13 "too many capturing parenthesized sub-patterns"
-#define ERR14 "missing )"
-#define ERR15 "back reference to non-existent subpattern"
-#define ERR16 "erroffset passed as NULL"
-#define ERR17 "unknown option bit(s) set"
-#define ERR18 "missing ) after comment"
-#define ERR19 "too many sets of parentheses"
-#define ERR20 "regular expression too large"
-#define ERR21 "failed to get memory"
-#define ERR22 "unmatched parentheses"
-#define ERR23 "internal error: code overflow"
-#define ERR24 "unrecognized character after (?<"
-#define ERR25 "lookbehind assertion is not fixed length"
-#define ERR26 "malformed number after (?("
-#define ERR27 "conditional group contains more than two branches"
-#define ERR28 "assertion expected after (?("
-#define ERR29 "(?p must be followed by )"
-#define ERR30 "unknown POSIX class name"
-#define ERR31 "POSIX collating elements are not supported"
-#define ERR32 "this version of PCRE is not compiled with PCRE_UTF8 support"
-#define ERR33 "characters with values > 255 are not yet supported in classes"
-#define ERR34 "character value in \\x{...} sequence is too large"
-#define ERR35 "invalid condition (?(0)"
-
-/* All character handling must be done as unsigned characters. Otherwise there
-are problems with top-bit-set characters and functions such as isspace().
-However, we leave the interface to the outside world as char *, because that
-should make things easier for callers. We define a short type for unsigned char
-to save lots of typing. I tried "uchar", but it causes problems on Digital
-Unix, where it is defined in sys/types, so use "uschar" instead. */
-
-typedef unsigned char uschar;
-
-/* The real format of the start of the pcre block; the actual code vector
-runs on as long as necessary after the end. */
-
-typedef struct real_pcre {
- unsigned long int magic_number;
- size_t size;
- const unsigned char *tables;
- unsigned long int options;
- uschar top_bracket;
- uschar top_backref;
- uschar first_char;
- uschar req_char;
- uschar code[1];
-} real_pcre;
-
-/* The real format of the extra block returned by pcre_study(). */
-
-typedef struct real_pcre_extra {
- uschar options;
- uschar start_bits[32];
-} real_pcre_extra;
-
-
-/* Structure for passing "static" information around between the functions
-doing the compiling, so that they are thread-safe. */
-
-typedef struct compile_data {
- const uschar *lcc; /* Points to lower casing table */
- const uschar *fcc; /* Points to case-flipping table */
- const uschar *cbits; /* Points to character type table */
- const uschar *ctypes; /* Points to table of type maps */
-} compile_data;
-
-/* Structure for passing "static" information around between the functions
-doing the matching, so that they are thread-safe. */
-
-typedef struct match_data {
- int errorcode; /* As it says */
- int *offset_vector; /* Offset vector */
- int offset_end; /* One past the end */
- int offset_max; /* The maximum usable for return data */
- const uschar *lcc; /* Points to lower casing table */
- const uschar *ctypes; /* Points to table of type maps */
- BOOL offset_overflow; /* Set if too many extractions */
- BOOL notbol; /* NOTBOL flag */
- BOOL noteol; /* NOTEOL flag */
- BOOL utf8; /* UTF8 flag */
- BOOL endonly; /* Dollar not before final \n */
- BOOL notempty; /* Empty string match not wanted */
- const uschar *start_pattern; /* For use when recursing */
- const uschar *start_subject; /* Start of the subject string */
- const uschar *end_subject; /* End of the subject string */
- const uschar *start_match; /* Start of this match attempt */
- const uschar *end_match_ptr; /* Subject position at end match */
- int end_offset_top; /* Highwater mark at end of match */
-} match_data;
-
-/* Bit definitions for entries in the pcre_ctypes table. */
-
-#define ctype_space 0x01
-#define ctype_letter 0x02
-#define ctype_digit 0x04
-#define ctype_xdigit 0x08
-#define ctype_word 0x10 /* alphameric or '_' */
-#define ctype_meta 0x80 /* regexp meta char or zero (end pattern) */
-
-/* Offsets for the bitmap tables in pcre_cbits. Each table contains a set
-of bits for a class map. Some classes are built by combining these tables. */
-
-#define cbit_space 0 /* [:space:] or \s */
-#define cbit_xdigit 32 /* [:xdigit:] */
-#define cbit_digit 64 /* [:digit:] or \d */
-#define cbit_upper 96 /* [:upper:] */
-#define cbit_lower 128 /* [:lower:] */
-#define cbit_word 160 /* [:word:] or \w */
-#define cbit_graph 192 /* [:graph:] */
-#define cbit_print 224 /* [:print:] */
-#define cbit_punct 256 /* [:punct:] */
-#define cbit_cntrl 288 /* [:cntrl:] */
-#define cbit_length 320 /* Length of the cbits table */
-
-/* Offsets of the various tables from the base tables pointer, and
-total length. */
-
-#define lcc_offset 0
-#define fcc_offset 256
-#define cbits_offset 512
-#define ctypes_offset (cbits_offset + cbit_length)
-#define tables_length (ctypes_offset + 256)
-
-/* End of internal.h */
diff --git a/ext/pcre/pcrelib/maketables.c b/ext/pcre/pcrelib/maketables.c
deleted file mode 100644
index c0f06c0375..0000000000
--- a/ext/pcre/pcrelib/maketables.c
+++ /dev/null
@@ -1,132 +0,0 @@
-/*************************************************
-* Perl-Compatible Regular Expressions *
-*************************************************/
-
-/*
-PCRE is a library of functions to support regular expressions whose syntax
-and semantics are as close as possible to those of the Perl 5 language.
-
-Written by: Philip Hazel <ph10@cam.ac.uk>
-
- Copyright (c) 1997-2000 University of Cambridge
-
------------------------------------------------------------------------------
-Permission is granted to anyone to use this software for any purpose on any
-computer system, and to redistribute it freely, subject to the following
-restrictions:
-
-1. This software is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-
-2. The origin of this software must not be misrepresented, either by
- explicit claim or by omission.
-
-3. Altered versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
-
-4. If PCRE is embedded in any software that is released under the GNU
- General Purpose Licence (GPL), then the terms of that licence shall
- supersede any condition above with which it is incompatible.
------------------------------------------------------------------------------
-
-See the file Tech.Notes for some information on the internals.
-*/
-
-
-/* This file is compiled on its own as part of the PCRE library. However,
-it is also included in the compilation of dftables.c, in which case the macro
-DFTABLES is defined. */
-
-#ifndef DFTABLES
-#include "internal.h"
-#endif
-
-
-
-/*************************************************
-* Create PCRE character tables *
-*************************************************/
-
-/* This function builds a set of character tables for use by PCRE and returns
-a pointer to them. They are build using the ctype functions, and consequently
-their contents will depend upon the current locale setting. When compiled as
-part of the library, the store is obtained via pcre_malloc(), but when compiled
-inside dftables, use malloc().
-
-Arguments: none
-Returns: pointer to the contiguous block of data
-*/
-
-unsigned const char *
-pcre_maketables(void)
-{
-unsigned char *yield, *p;
-int i;
-
-#ifndef DFTABLES
-yield = (unsigned char*)(pcre_malloc)(tables_length);
-#else
-yield = (unsigned char*)malloc(tables_length);
-#endif
-
-if (yield == NULL) return NULL;
-p = yield;
-
-/* First comes the lower casing table */
-
-for (i = 0; i < 256; i++) *p++ = tolower(i);
-
-/* Next the case-flipping table */
-
-for (i = 0; i < 256; i++) *p++ = islower(i)? toupper(i) : tolower(i);
-
-/* Then the character class tables. Don't try to be clever and save effort
-on exclusive ones - in some locales things may be different. */
-
-memset(p, 0, cbit_length);
-for (i = 0; i < 256; i++)
- {
- if (isdigit(i))
- {
- p[cbit_digit + i/8] |= 1 << (i&7);
- p[cbit_word + i/8] |= 1 << (i&7);
- }
- if (isupper(i))
- {
- p[cbit_upper + i/8] |= 1 << (i&7);
- p[cbit_word + i/8] |= 1 << (i&7);
- }
- if (islower(i))
- {
- p[cbit_lower + i/8] |= 1 << (i&7);
- p[cbit_word + i/8] |= 1 << (i&7);
- }
- if (i == '_') p[cbit_word + i/8] |= 1 << (i&7);
- if (isspace(i)) p[cbit_space + i/8] |= 1 << (i&7);
- if (isxdigit(i))p[cbit_xdigit + i/8] |= 1 << (i&7);
- if (isgraph(i)) p[cbit_graph + i/8] |= 1 << (i&7);
- if (isprint(i)) p[cbit_print + i/8] |= 1 << (i&7);
- if (ispunct(i)) p[cbit_punct + i/8] |= 1 << (i&7);
- if (iscntrl(i)) p[cbit_cntrl + i/8] |= 1 << (i&7);
- }
-p += cbit_length;
-
-/* Finally, the character type table */
-
-for (i = 0; i < 256; i++)
- {
- int x = 0;
- if (isspace(i)) x += ctype_space;
- if (isalpha(i)) x += ctype_letter;
- if (isdigit(i)) x += ctype_digit;
- if (isxdigit(i)) x += ctype_xdigit;
- if (isalnum(i) || i == '_') x += ctype_word;
- if (strchr("*+?{^.$|()[", i) != 0) x += ctype_meta;
- *p++ = x;
- }
-
-return yield;
-}
-
-/* End of maketables.c */
diff --git a/ext/pcre/pcrelib/pcre-config.in b/ext/pcre/pcrelib/pcre-config.in
deleted file mode 100644
index 8daded9fe1..0000000000
--- a/ext/pcre/pcrelib/pcre-config.in
+++ /dev/null
@@ -1,59 +0,0 @@
-#!/bin/sh
-
-prefix=@prefix@
-exec_prefix=@exec_prefix@
-exec_prefix_set=no
-
-usage="\
-Usage: pcre-config [--prefix] [--exec-prefix] [--version] [--libs] [--libs-posix] [--cflags] [--cflags-posix]"
-
-if test $# -eq 0; then
- echo "${usage}" 1>&2
- exit 1
-fi
-
-while test $# -gt 0; do
- case "$1" in
- -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
- *) optarg= ;;
- esac
-
- case $1 in
- --prefix=*)
- prefix=$optarg
- if test $exec_prefix_set = no ; then
- exec_prefix=$optarg
- fi
- ;;
- --prefix)
- echo $prefix
- ;;
- --exec-prefix=*)
- exec_prefix=$optarg
- exec_prefix_set=yes
- ;;
- --exec-prefix)
- echo $exec_prefix
- ;;
- --version)
- echo @PCRE_VERSION@
- ;;
- --cflags | --cflags-posix)
- if test @includedir@ != /usr/include ; then
- includes=-I@includedir@
- fi
- echo $includes
- ;;
- --libs-posix)
- echo -L@libdir@ -lpcreposix -lpcre
- ;;
- --libs)
- echo -L@libdir@ -lpcre
- ;;
- *)
- echo "${usage}" 1>&2
- exit 1
- ;;
- esac
- shift
-done
diff --git a/ext/pcre/pcrelib/pcre.c b/ext/pcre/pcrelib/pcre.c
deleted file mode 100644
index 5149f8dad7..0000000000
--- a/ext/pcre/pcrelib/pcre.c
+++ /dev/null
@@ -1,5151 +0,0 @@
-/*************************************************
-* Perl-Compatible Regular Expressions *
-*************************************************/
-
-/*
-This is a library of functions to support regular expressions whose syntax
-and semantics are as close as possible to those of the Perl 5 language. See
-the file Tech.Notes for some information on the internals.
-
-Written by: Philip Hazel <ph10@cam.ac.uk>
-
- Copyright (c) 1997-2000 University of Cambridge
-
------------------------------------------------------------------------------
-Permission is granted to anyone to use this software for any purpose on any
-computer system, and to redistribute it freely, subject to the following
-restrictions:
-
-1. This software is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-
-2. The origin of this software must not be misrepresented, either by
- explicit claim or by omission.
-
-3. Altered versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
-
-4. If PCRE is embedded in any software that is released under the GNU
- General Purpose Licence (GPL), then the terms of that licence shall
- supersede any condition above with which it is incompatible.
------------------------------------------------------------------------------
-*/
-
-
-/* Define DEBUG to get debugging output on stdout. */
-
-/* #define DEBUG */
-
-/* Use a macro for debugging printing, 'cause that eliminates the use of #ifdef
-inline, and there are *still* stupid compilers about that don't like indented
-pre-processor statements. I suppose it's only been 10 years... */
-
-#ifdef DEBUG
-#define DPRINTF(p) printf p
-#else
-#define DPRINTF(p) /*nothing*/
-#endif
-
-/* Include the internals header, which itself includes Standard C headers plus
-the external pcre header. */
-
-#include "internal.h"
-
-
-/* Allow compilation as C++ source code, should anybody want to do that. */
-
-#ifdef __cplusplus
-#define class pcre_class
-#endif
-
-
-/* Number of items on the nested bracket stacks at compile time. This should
-not be set greater than 200. */
-
-#define BRASTACK_SIZE 200
-
-
-/* The number of bytes in a literal character string above which we can't add
-any more is different when UTF-8 characters may be encountered. */
-
-#ifdef SUPPORT_UTF8
-#define MAXLIT 250
-#else
-#define MAXLIT 255
-#endif
-
-
-/* Min and max values for the common repeats; for the maxima, 0 => infinity */
-
-static const char rep_min[] = { 0, 0, 1, 1, 0, 0 };
-static const char rep_max[] = { 0, 0, 0, 0, 1, 1 };
-
-/* Text forms of OP_ values and things, for debugging (not all used) */
-
-#ifdef DEBUG
-static const char *OP_names[] = {
- "End", "\\A", "\\B", "\\b", "\\D", "\\d",
- "\\S", "\\s", "\\W", "\\w", "\\Z", "\\z",
- "Opt", "^", "$", "Any", "chars", "not",
- "*", "*?", "+", "+?", "?", "??", "{", "{", "{",
- "*", "*?", "+", "+?", "?", "??", "{", "{", "{",
- "*", "*?", "+", "+?", "?", "??", "{", "{", "{",
- "*", "*?", "+", "+?", "?", "??", "{", "{",
- "class", "Ref", "Recurse",
- "Alt", "Ket", "KetRmax", "KetRmin", "Assert", "Assert not",
- "AssertB", "AssertB not", "Reverse", "Once", "Cond", "Cref",
- "Brazero", "Braminzero", "Bra"
-};
-#endif
-
-/* Table for handling escaped characters in the range '0'-'z'. Positive returns
-are simple data values; negative values are for special things like \d and so
-on. Zero means further processing is needed (for things like \x), or the escape
-is invalid. */
-
-static const short int escapes[] = {
- 0, 0, 0, 0, 0, 0, 0, 0, /* 0 - 7 */
- 0, 0, ':', ';', '<', '=', '>', '?', /* 8 - ? */
- '@', -ESC_A, -ESC_B, 0, -ESC_D, 0, 0, 0, /* @ - G */
- 0, 0, 0, 0, 0, 0, 0, 0, /* H - O */
- 0, 0, 0, -ESC_S, 0, 0, 0, -ESC_W, /* P - W */
- 0, 0, -ESC_Z, '[', '\\', ']', '^', '_', /* X - _ */
- '`', 7, -ESC_b, 0, -ESC_d, 27, '\f', 0, /* ` - g */
- 0, 0, 0, 0, 0, 0, '\n', 0, /* h - o */
- 0, 0, '\r', -ESC_s, '\t', 0, 0, -ESC_w, /* p - w */
- 0, 0, -ESC_z /* x - z */
-};
-
-/* Tables of names of POSIX character classes and their lengths. The list is
-terminated by a zero length entry. The first three must be alpha, upper, lower,
-as this is assumed for handling case independence. */
-
-static const char *posix_names[] = {
- "alpha", "lower", "upper",
- "alnum", "ascii", "cntrl", "digit", "graph",
- "print", "punct", "space", "word", "xdigit" };
-
-static const uschar posix_name_lengths[] = {
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 4, 6, 0 };
-
-/* Table of class bit maps for each POSIX class; up to three may be combined
-to form the class. */
-
-static const int posix_class_maps[] = {
- cbit_lower, cbit_upper, -1, /* alpha */
- cbit_lower, -1, -1, /* lower */
- cbit_upper, -1, -1, /* upper */
- cbit_digit, cbit_lower, cbit_upper, /* alnum */
- cbit_print, cbit_cntrl, -1, /* ascii */
- cbit_cntrl, -1, -1, /* cntrl */
- cbit_digit, -1, -1, /* digit */
- cbit_graph, -1, -1, /* graph */
- cbit_print, -1, -1, /* print */
- cbit_punct, -1, -1, /* punct */
- cbit_space, -1, -1, /* space */
- cbit_word, -1, -1, /* word */
- cbit_xdigit,-1, -1 /* xdigit */
-};
-
-
-/* Definition to allow mutual recursion */
-
-static BOOL
- compile_regex(int, int, int *, uschar **, const uschar **, const char **,
- BOOL, int, int *, int *, compile_data *);
-
-/* Structure for building a chain of data that actually lives on the
-stack, for holding the values of the subject pointer at the start of each
-subpattern, so as to detect when an empty string has been matched by a
-subpattern - to break infinite loops. */
-
-typedef struct eptrblock {
- struct eptrblock *prev;
- const uschar *saved_eptr;
-} eptrblock;
-
-/* Flag bits for the match() function */
-
-#define match_condassert 0x01 /* Called to check a condition assertion */
-#define match_isgroup 0x02 /* Set if start of bracketed group */
-
-
-
-/*************************************************
-* Global variables *
-*************************************************/
-
-/* PCRE is thread-clean and doesn't use any global variables in the normal
-sense. However, it calls memory allocation and free functions via the two
-indirections below, which are can be changed by the caller, but are shared
-between all threads. */
-
-void *(*pcre_malloc)(size_t) = malloc;
-void (*pcre_free)(void *) = free;
-
-
-
-/*************************************************
-* Macros and tables for character handling *
-*************************************************/
-
-/* When UTF-8 encoding is being used, a character is no longer just a single
-byte. The macros for character handling generate simple sequences when used in
-byte-mode, and more complicated ones for UTF-8 characters. */
-
-#ifndef SUPPORT_UTF8
-#define GETCHARINC(c, eptr) c = *eptr++;
-#define GETCHARLEN(c, eptr, len) c = *eptr;
-#define BACKCHAR(eptr)
-
-#else /* SUPPORT_UTF8 */
-
-/* Get the next UTF-8 character, advancing the pointer */
-
-#define GETCHARINC(c, eptr) \
- c = *eptr++; \
- if (md->utf8 && (c & 0xc0) == 0xc0) \
- { \
- int a = utf8_table4[c & 0x3f]; /* Number of additional bytes */ \
- int s = 6 - a; /* Amount to shift next byte */ \
- c &= utf8_table3[a]; /* Low order bits from first byte */ \
- while (a-- > 0) \
- { \
- c |= (*eptr++ & 0x3f) << s; \
- s += 6; \
- } \
- }
-
-/* Get the next UTF-8 character, not advancing the pointer, setting length */
-
-#define GETCHARLEN(c, eptr, len) \
- c = *eptr; \
- len = 1; \
- if (md->utf8 && (c & 0xc0) == 0xc0) \
- { \
- int i; \
- int a = utf8_table4[c & 0x3f]; /* Number of additional bytes */ \
- int s = 6 - a; /* Amount to shift next byte */ \
- c &= utf8_table3[a]; /* Low order bits from first byte */ \
- for (i = 1; i <= a; i++) \
- { \
- c |= (eptr[i] & 0x3f) << s; \
- s += 6; \
- } \
- len += a; \
- }
-
-/* If the pointer is not at the start of a character, move it back until
-it is. */
-
-#define BACKCHAR(eptr) while((*eptr & 0xc0) == 0x80) eptr--;
-
-#endif
-
-
-
-/*************************************************
-* Default character tables *
-*************************************************/
-
-/* A default set of character tables is included in the PCRE binary. Its source
-is built by the maketables auxiliary program, which uses the default C ctypes
-functions, and put in the file chartables.c. These tables are used by PCRE
-whenever the caller of pcre_compile() does not provide an alternate set of
-tables. */
-
-#include "chartables.c"
-
-
-
-#ifdef SUPPORT_UTF8
-/*************************************************
-* Tables for UTF-8 support *
-*************************************************/
-
-/* These are the breakpoints for different numbers of bytes in a UTF-8
-character. */
-
-static int utf8_table1[] = { 0x7f, 0x7ff, 0xffff, 0x1fffff, 0x3ffffff, 0x7fffffff};
-
-/* These are the indicator bits and the mask for the data bits to set in the
-first byte of a character, indexed by the number of additional bytes. */
-
-static int utf8_table2[] = { 0, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc};
-static int utf8_table3[] = { 0xff, 0x1f, 0x0f, 0x07, 0x03, 0x01};
-
-/* Table of the number of extra characters, indexed by the first character
-masked with 0x3f. The highest number for a valid UTF-8 character is in fact
-0x3d. */
-
-static uschar utf8_table4[] = {
- 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
- 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
- 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
- 3,3,3,3,3,3,3,3,4,4,4,4,5,5,5,5 };
-
-
-/*************************************************
-* Convert character value to UTF-8 *
-*************************************************/
-
-/* This function takes an integer value in the range 0 - 0x7fffffff
-and encodes it as a UTF-8 character in 0 to 6 bytes.
-
-Arguments:
- cvalue the character value
- buffer pointer to buffer for result - at least 6 bytes long
-
-Returns: number of characters placed in the buffer
-*/
-
-static int
-ord2utf8(int cvalue, uschar *buffer)
-{
-register int i, j;
-for (i = 0; i < sizeof(utf8_table1)/sizeof(int); i++)
- if (cvalue <= utf8_table1[i]) break;
-*buffer++ = utf8_table2[i] | (cvalue & utf8_table3[i]);
-cvalue >>= 6 - i;
-for (j = 0; j < i; j++)
- {
- *buffer++ = 0x80 | (cvalue & 0x3f);
- cvalue >>= 6;
- }
-return i + 1;
-}
-#endif
-
-
-
-/*************************************************
-* Return version string *
-*************************************************/
-
-#define STRING(a) # a
-#define XSTRING(s) STRING(s)
-
-const char *
-pcre_version(void)
-{
-return XSTRING(PCRE_MAJOR) "." XSTRING(PCRE_MINOR) " " XSTRING(PCRE_DATE);
-}
-
-
-
-
-/*************************************************
-* (Obsolete) Return info about compiled pattern *
-*************************************************/
-
-/* This is the original "info" function. It picks potentially useful data out
-of the private structure, but its interface was too rigid. It remains for
-backwards compatibility. The public options are passed back in an int - though
-the re->options field has been expanded to a long int, all the public options
-at the low end of it, and so even on 16-bit systems this will still be OK.
-Therefore, I haven't changed the API for pcre_info().
-
-Arguments:
- external_re points to compiled code
- optptr where to pass back the options
- first_char where to pass back the first character,
- or -1 if multiline and all branches start ^,
- or -2 otherwise
-
-Returns: number of capturing subpatterns
- or negative values on error
-*/
-
-int
-pcre_info(const pcre *external_re, int *optptr, int *first_char)
-{
-const real_pcre *re = (const real_pcre *)external_re;
-if (re == NULL) return PCRE_ERROR_NULL;
-if (re->magic_number != MAGIC_NUMBER) return PCRE_ERROR_BADMAGIC;
-if (optptr != NULL) *optptr = (int)(re->options & PUBLIC_OPTIONS);
-if (first_char != NULL)
- *first_char = ((re->options & PCRE_FIRSTSET) != 0)? re->first_char :
- ((re->options & PCRE_STARTLINE) != 0)? -1 : -2;
-return re->top_bracket;
-}
-
-
-
-/*************************************************
-* Return info about compiled pattern *
-*************************************************/
-
-/* This is a newer "info" function which has an extensible interface so
-that additional items can be added compatibly.
-
-Arguments:
- external_re points to compiled code
- external_study points to study data, or NULL
- what what information is required
- where where to put the information
-
-Returns: 0 if data returned, negative on error
-*/
-
-int
-pcre_fullinfo(const pcre *external_re, const pcre_extra *study_data, int what,
- void *where)
-{
-const real_pcre *re = (const real_pcre *)external_re;
-const real_pcre_extra *study = (const real_pcre_extra *)study_data;
-
-if (re == NULL || where == NULL) return PCRE_ERROR_NULL;
-if (re->magic_number != MAGIC_NUMBER) return PCRE_ERROR_BADMAGIC;
-
-switch (what)
- {
- case PCRE_INFO_OPTIONS:
- *((unsigned long int *)where) = re->options & PUBLIC_OPTIONS;
- break;
-
- case PCRE_INFO_SIZE:
- *((size_t *)where) = re->size;
- break;
-
- case PCRE_INFO_CAPTURECOUNT:
- *((int *)where) = re->top_bracket;
- break;
-
- case PCRE_INFO_BACKREFMAX:
- *((int *)where) = re->top_backref;
- break;
-
- case PCRE_INFO_FIRSTCHAR:
- *((int *)where) =
- ((re->options & PCRE_FIRSTSET) != 0)? re->first_char :
- ((re->options & PCRE_STARTLINE) != 0)? -1 : -2;
- break;
-
- case PCRE_INFO_FIRSTTABLE:
- *((const uschar **)where) =
- (study != NULL && (study->options & PCRE_STUDY_MAPPED) != 0)?
- study->start_bits : NULL;
- break;
-
- case PCRE_INFO_LASTLITERAL:
- *((int *)where) =
- ((re->options & PCRE_REQCHSET) != 0)? re->req_char : -1;
- break;
-
- default: return PCRE_ERROR_BADOPTION;
- }
-
-return 0;
-}
-
-
-
-#ifdef DEBUG
-/*************************************************
-* Debugging function to print chars *
-*************************************************/
-
-/* Print a sequence of chars in printable format, stopping at the end of the
-subject if the requested.
-
-Arguments:
- p points to characters
- length number to print
- is_subject TRUE if printing from within md->start_subject
- md pointer to matching data block, if is_subject is TRUE
-
-Returns: nothing
-*/
-
-static void
-pchars(const uschar *p, int length, BOOL is_subject, match_data *md)
-{
-int c;
-if (is_subject && length > md->end_subject - p) length = md->end_subject - p;
-while (length-- > 0)
- if (isprint(c = *(p++))) printf("%c", c); else printf("\\x%02x", c);
-}
-#endif
-
-
-
-
-/*************************************************
-* Handle escapes *
-*************************************************/
-
-/* This function is called when a \ has been encountered. It either returns a
-positive value for a simple escape such as \n, or a negative value which
-encodes one of the more complicated things such as \d. When UTF-8 is enabled,
-a positive value greater than 255 may be returned. On entry, ptr is pointing at
-the \. On exit, it is on the final character of the escape sequence.
-
-Arguments:
- ptrptr points to the pattern position pointer
- errorptr points to the pointer to the error message
- bracount number of previous extracting brackets
- options the options bits
- isclass TRUE if inside a character class
- cd pointer to char tables block
-
-Returns: zero or positive => a data character
- negative => a special escape sequence
- on error, errorptr is set
-*/
-
-static int
-check_escape(const uschar **ptrptr, const char **errorptr, int bracount,
- int options, BOOL isclass, compile_data *cd)
-{
-const uschar *ptr = *ptrptr;
-int c, i;
-
-/* If backslash is at the end of the pattern, it's an error. */
-
-c = *(++ptr);
-if (c == 0) *errorptr = ERR1;
-
-/* Digits or letters may have special meaning; all others are literals. */
-
-else if (c < '0' || c > 'z') {}
-
-/* Do an initial lookup in a table. A non-zero result is something that can be
-returned immediately. Otherwise further processing may be required. */
-
-else if ((i = escapes[c - '0']) != 0) c = i;
-
-/* Escapes that need further processing, or are illegal. */
-
-else
- {
- const uschar *oldptr;
- switch (c)
- {
- /* The handling of escape sequences consisting of a string of digits
- starting with one that is not zero is not straightforward. By experiment,
- the way Perl works seems to be as follows:
-
- Outside a character class, the digits are read as a decimal number. If the
- number is less than 10, or if there are that many previous extracting
- left brackets, then it is a back reference. Otherwise, up to three octal
- digits are read to form an escaped byte. Thus \123 is likely to be octal
- 123 (cf \0123, which is octal 012 followed by the literal 3). If the octal
- value is greater than 377, the least significant 8 bits are taken. Inside a
- character class, \ followed by a digit is always an octal number. */
-
- case '1': case '2': case '3': case '4': case '5':
- case '6': case '7': case '8': case '9':
-
- if (!isclass)
- {
- oldptr = ptr;
- c -= '0';
- while ((cd->ctypes[ptr[1]] & ctype_digit) != 0)
- c = c * 10 + *(++ptr) - '0';
- if (c < 10 || c <= bracount)
- {
- c = -(ESC_REF + c);
- break;
- }
- ptr = oldptr; /* Put the pointer back and fall through */
- }
-
- /* Handle an octal number following \. If the first digit is 8 or 9, Perl
- generates a binary zero byte and treats the digit as a following literal.
- Thus we have to pull back the pointer by one. */
-
- if ((c = *ptr) >= '8')
- {
- ptr--;
- c = 0;
- break;
- }
-
- /* \0 always starts an octal number, but we may drop through to here with a
- larger first octal digit. */
-
- case '0':
- c -= '0';
- while(i++ < 2 && (cd->ctypes[ptr[1]] & ctype_digit) != 0 &&
- ptr[1] != '8' && ptr[1] != '9')
- c = c * 8 + *(++ptr) - '0';
- c &= 255; /* Take least significant 8 bits */
- break;
-
- /* \x is complicated when UTF-8 is enabled. \x{ddd} is a character number
- which can be greater than 0xff, but only if the ddd are hex digits. */
-
- case 'x':
-#ifdef SUPPORT_UTF8
- if (ptr[1] == '{' && (options & PCRE_UTF8) != 0)
- {
- const uschar *pt = ptr + 2;
- register int count = 0;
- c = 0;
- while ((cd->ctypes[*pt] & ctype_xdigit) != 0)
- {
- count++;
- c = c * 16 + cd->lcc[*pt] -
- (((cd->ctypes[*pt] & ctype_digit) != 0)? '0' : 'W');
- pt++;
- }
- if (*pt == '}')
- {
- if (c < 0 || count > 8) *errorptr = ERR34;
- ptr = pt;
- break;
- }
- /* If the sequence of hex digits does not end with '}', then we don't
- recognize this construct; fall through to the normal \x handling. */
- }
-#endif
-
- /* Read just a single hex char */
-
- c = 0;
- while (i++ < 2 && (cd->ctypes[ptr[1]] & ctype_xdigit) != 0)
- {
- ptr++;
- c = c * 16 + cd->lcc[*ptr] -
- (((cd->ctypes[*ptr] & ctype_digit) != 0)? '0' : 'W');
- }
- break;
-
- /* Other special escapes not starting with a digit are straightforward */
-
- case 'c':
- c = *(++ptr);
- if (c == 0)
- {
- *errorptr = ERR2;
- return 0;
- }
-
- /* A letter is upper-cased; then the 0x40 bit is flipped */
-
- if (c >= 'a' && c <= 'z') c = cd->fcc[c];
- c ^= 0x40;
- break;
-
- /* PCRE_EXTRA enables extensions to Perl in the matter of escapes. Any
- other alphameric following \ is an error if PCRE_EXTRA was set; otherwise,
- for Perl compatibility, it is a literal. This code looks a bit odd, but
- there used to be some cases other than the default, and there may be again
- in future, so I haven't "optimized" it. */
-
- default:
- if ((options & PCRE_EXTRA) != 0) switch(c)
- {
- default:
- *errorptr = ERR3;
- break;
- }
- break;
- }
- }
-
-*ptrptr = ptr;
-return c;
-}
-
-
-
-/*************************************************
-* Check for counted repeat *
-*************************************************/
-
-/* This function is called when a '{' is encountered in a place where it might
-start a quantifier. It looks ahead to see if it really is a quantifier or not.
-It is only a quantifier if it is one of the forms {ddd} {ddd,} or {ddd,ddd}
-where the ddds are digits.
-
-Arguments:
- p pointer to the first char after '{'
- cd pointer to char tables block
-
-Returns: TRUE or FALSE
-*/
-
-static BOOL
-is_counted_repeat(const uschar *p, compile_data *cd)
-{
-if ((cd->ctypes[*p++] & ctype_digit) == 0) return FALSE;
-while ((cd->ctypes[*p] & ctype_digit) != 0) p++;
-if (*p == '}') return TRUE;
-
-if (*p++ != ',') return FALSE;
-if (*p == '}') return TRUE;
-
-if ((cd->ctypes[*p++] & ctype_digit) == 0) return FALSE;
-while ((cd->ctypes[*p] & ctype_digit) != 0) p++;
-return (*p == '}');
-}
-
-
-
-/*************************************************
-* Read repeat counts *
-*************************************************/
-
-/* Read an item of the form {n,m} and return the values. This is called only
-after is_counted_repeat() has confirmed that a repeat-count quantifier exists,
-so the syntax is guaranteed to be correct, but we need to check the values.
-
-Arguments:
- p pointer to first char after '{'
- minp pointer to int for min
- maxp pointer to int for max
- returned as -1 if no max
- errorptr points to pointer to error message
- cd pointer to character tables clock
-
-Returns: pointer to '}' on success;
- current ptr on error, with errorptr set
-*/
-
-static const uschar *
-read_repeat_counts(const uschar *p, int *minp, int *maxp,
- const char **errorptr, compile_data *cd)
-{
-int min = 0;
-int max = -1;
-
-while ((cd->ctypes[*p] & ctype_digit) != 0) min = min * 10 + *p++ - '0';
-
-if (*p == '}') max = min; else
- {
- if (*(++p) != '}')
- {
- max = 0;
- while((cd->ctypes[*p] & ctype_digit) != 0) max = max * 10 + *p++ - '0';
- if (max < min)
- {
- *errorptr = ERR4;
- return p;
- }
- }
- }
-
-/* Do paranoid checks, then fill in the required variables, and pass back the
-pointer to the terminating '}'. */
-
-if (min > 65535 || max > 65535)
- *errorptr = ERR5;
-else
- {
- *minp = min;
- *maxp = max;
- }
-return p;
-}
-
-
-
-/*************************************************
-* Find the fixed length of a pattern *
-*************************************************/
-
-/* Scan a pattern and compute the fixed length of subject that will match it,
-if the length is fixed. This is needed for dealing with backward assertions.
-
-Arguments:
- code points to the start of the pattern (the bracket)
- options the compiling options
-
-Returns: the fixed length, or -1 if there is no fixed length
-*/
-
-static int
-find_fixedlength(uschar *code, int options)
-{
-int length = -1;
-
-register int branchlength = 0;
-register uschar *cc = code + 3;
-
-/* Scan along the opcodes for this branch. If we get to the end of the
-branch, check the length against that of the other branches. */
-
-for (;;)
- {
- int d;
- register int op = *cc;
- if (op >= OP_BRA) op = OP_BRA;
-
- switch (op)
- {
- case OP_BRA:
- case OP_ONCE:
- case OP_COND:
- d = find_fixedlength(cc, options);
- if (d < 0) return -1;
- branchlength += d;
- do cc += (cc[1] << 8) + cc[2]; while (*cc == OP_ALT);
- cc += 3;
- break;
-
- /* Reached end of a branch; if it's a ket it is the end of a nested
- call. If it's ALT it is an alternation in a nested call. If it is
- END it's the end of the outer call. All can be handled by the same code. */
-
- case OP_ALT:
- case OP_KET:
- case OP_KETRMAX:
- case OP_KETRMIN:
- case OP_END:
- if (length < 0) length = branchlength;
- else if (length != branchlength) return -1;
- if (*cc != OP_ALT) return length;
- cc += 3;
- branchlength = 0;
- break;
-
- /* Skip over assertive subpatterns */
-
- case OP_ASSERT:
- case OP_ASSERT_NOT:
- case OP_ASSERTBACK:
- case OP_ASSERTBACK_NOT:
- do cc += (cc[1] << 8) + cc[2]; while (*cc == OP_ALT);
- cc += 3;
- break;
-
- /* Skip over things that don't match chars */
-
- case OP_REVERSE:
- cc++;
- /* Fall through */
-
- case OP_CREF:
- case OP_OPT:
- cc++;
- /* Fall through */
-
- case OP_SOD:
- case OP_EOD:
- case OP_EODN:
- case OP_CIRC:
- case OP_DOLL:
- case OP_NOT_WORD_BOUNDARY:
- case OP_WORD_BOUNDARY:
- cc++;
- break;
-
- /* Handle char strings. In UTF-8 mode we must count characters, not bytes.
- This requires a scan of the string, unfortunately. We assume valid UTF-8
- strings, so all we do is reduce the length by one for byte whose bits are
- 10xxxxxx. */
-
- case OP_CHARS:
- branchlength += *(++cc);
-#ifdef SUPPORT_UTF8
- for (d = 1; d <= *cc; d++)
- if ((cc[d] & 0xc0) == 0x80) branchlength--;
-#endif
- cc += *cc + 1;
- break;
-
- /* Handle exact repetitions */
-
- case OP_EXACT:
- case OP_TYPEEXACT:
- branchlength += (cc[1] << 8) + cc[2];
- cc += 4;
- break;
-
- /* Handle single-char matchers */
-
- case OP_NOT_DIGIT:
- case OP_DIGIT:
- case OP_NOT_WHITESPACE:
- case OP_WHITESPACE:
- case OP_NOT_WORDCHAR:
- case OP_WORDCHAR:
- case OP_ANY:
- branchlength++;
- cc++;
- break;
-
-
- /* Check a class for variable quantification */
-
- case OP_CLASS:
- cc += (*cc == OP_REF)? 2 : 33;
-
- switch (*cc)
- {
- case OP_CRSTAR:
- case OP_CRMINSTAR:
- case OP_CRQUERY:
- case OP_CRMINQUERY:
- return -1;
-
- case OP_CRRANGE:
- case OP_CRMINRANGE:
- if ((cc[1] << 8) + cc[2] != (cc[3] << 8) + cc[4]) return -1;
- branchlength += (cc[1] << 8) + cc[2];
- cc += 5;
- break;
-
- default:
- branchlength++;
- }
- break;
-
- /* Anything else is variable length */
-
- default:
- return -1;
- }
- }
-/* Control never gets here */
-}
-
-
-
-
-/*************************************************
-* Check for POSIX class syntax *
-*************************************************/
-
-/* This function is called when the sequence "[:" or "[." or "[=" is
-encountered in a character class. It checks whether this is followed by an
-optional ^ and then a sequence of letters, terminated by a matching ":]" or
-".]" or "=]".
-
-Argument:
- ptr pointer to the initial [
- endptr where to return the end pointer
- cd pointer to compile data
-
-Returns: TRUE or FALSE
-*/
-
-static BOOL
-check_posix_syntax(const uschar *ptr, const uschar **endptr, compile_data *cd)
-{
-int terminator; /* Don't combine these lines; the Solaris cc */
-terminator = *(++ptr); /* compiler warns about "non-constant" initializer. */
-if (*(++ptr) == '^') ptr++;
-while ((cd->ctypes[*ptr] & ctype_letter) != 0) ptr++;
-if (*ptr == terminator && ptr[1] == ']')
- {
- *endptr = ptr;
- return TRUE;
- }
-return FALSE;
-}
-
-
-
-
-/*************************************************
-* Check POSIX class name *
-*************************************************/
-
-/* This function is called to check the name given in a POSIX-style class entry
-such as [:alnum:].
-
-Arguments:
- ptr points to the first letter
- len the length of the name
-
-Returns: a value representing the name, or -1 if unknown
-*/
-
-static int
-check_posix_name(const uschar *ptr, int len)
-{
-register int yield = 0;
-while (posix_name_lengths[yield] != 0)
- {
- if (len == posix_name_lengths[yield] &&
- strncmp((const char *)ptr, posix_names[yield], len) == 0) return yield;
- yield++;
- }
-return -1;
-}
-
-
-
-
-/*************************************************
-* Compile one branch *
-*************************************************/
-
-/* Scan the pattern, compiling it into the code vector.
-
-Arguments:
- options the option bits
- brackets points to number of brackets used
- code points to the pointer to the current code point
- ptrptr points to the current pattern pointer
- errorptr points to pointer to error message
- optchanged set to the value of the last OP_OPT item compiled
- reqchar set to the last literal character required, else -1
- countlits set to count of mandatory literal characters
- cd contains pointers to tables
-
-Returns: TRUE on success
- FALSE, with *errorptr set on error
-*/
-
-static BOOL
-compile_branch(int options, int *brackets, uschar **codeptr,
- const uschar **ptrptr, const char **errorptr, int *optchanged,
- int *reqchar, int *countlits, compile_data *cd)
-{
-int repeat_type, op_type;
-int repeat_min, repeat_max;
-int bravalue, length;
-int greedy_default, greedy_non_default;
-int prevreqchar;
-int condcount = 0;
-int subcountlits = 0;
-register int c;
-register uschar *code = *codeptr;
-uschar *tempcode;
-const uschar *ptr = *ptrptr;
-const uschar *tempptr;
-uschar *previous = NULL;
-uschar class[32];
-
-/* Set up the default and non-default settings for greediness */
-
-greedy_default = ((options & PCRE_UNGREEDY) != 0);
-greedy_non_default = greedy_default ^ 1;
-
-/* Initialize no required char, and count of literals */
-
-*reqchar = prevreqchar = -1;
-*countlits = 0;
-
-/* Switch on next character until the end of the branch */
-
-for (;; ptr++)
- {
- BOOL negate_class;
- int class_charcount;
- int class_lastchar;
- int newoptions;
- int condref;
- int subreqchar;
-
- c = *ptr;
- if ((options & PCRE_EXTENDED) != 0)
- {
- if ((cd->ctypes[c] & ctype_space) != 0) continue;
- if (c == '#')
- {
- /* The space before the ; is to avoid a warning on a silly compiler
- on the Macintosh. */
- while ((c = *(++ptr)) != 0 && c != '\n') ;
- continue;
- }
- }
-
- switch(c)
- {
- /* The branch terminates at end of string, |, or ). */
-
- case 0:
- case '|':
- case ')':
- *codeptr = code;
- *ptrptr = ptr;
- return TRUE;
-
- /* Handle single-character metacharacters */
-
- case '^':
- previous = NULL;
- *code++ = OP_CIRC;
- break;
-
- case '$':
- previous = NULL;
- *code++ = OP_DOLL;
- break;
-
- case '.':
- previous = code;
- *code++ = OP_ANY;
- break;
-
- /* Character classes. These always build a 32-byte bitmap of the permitted
- characters, except in the special case where there is only one character.
- For negated classes, we build the map as usual, then invert it at the end.
- */
-
- case '[':
- previous = code;
- *code++ = OP_CLASS;
-
- /* If the first character is '^', set the negation flag and skip it. */
-
- if ((c = *(++ptr)) == '^')
- {
- negate_class = TRUE;
- c = *(++ptr);
- }
- else negate_class = FALSE;
-
- /* Keep a count of chars so that we can optimize the case of just a single
- character. */
-
- class_charcount = 0;
- class_lastchar = -1;
-
- /* Initialize the 32-char bit map to all zeros. We have to build the
- map in a temporary bit of store, in case the class contains only 1
- character, because in that case the compiled code doesn't use the
- bit map. */
-
- memset(class, 0, 32 * sizeof(uschar));
-
- /* Process characters until ] is reached. By writing this as a "do" it
- means that an initial ] is taken as a data character. */
-
- do
- {
- if (c == 0)
- {
- *errorptr = ERR6;
- goto FAILED;
- }
-
- /* Handle POSIX class names. Perl allows a negation extension of the
- form [:^name]. A square bracket that doesn't match the syntax is
- treated as a literal. We also recognize the POSIX constructions
- [.ch.] and [=ch=] ("collating elements") and fault them, as Perl
- 5.6 does. */
-
- if (c == '[' &&
- (ptr[1] == ':' || ptr[1] == '.' || ptr[1] == '=') &&
- check_posix_syntax(ptr, &tempptr, cd))
- {
- BOOL local_negate = FALSE;
- int posix_class, i;
- register const uschar *cbits = cd->cbits;
-
- if (ptr[1] != ':')
- {
- *errorptr = ERR31;
- goto FAILED;
- }
-
- ptr += 2;
- if (*ptr == '^')
- {
- local_negate = TRUE;
- ptr++;
- }
-
- posix_class = check_posix_name(ptr, tempptr - ptr);
- if (posix_class < 0)
- {
- *errorptr = ERR30;
- goto FAILED;
- }
-
- /* If matching is caseless, upper and lower are converted to
- alpha. This relies on the fact that the class table starts with
- alpha, lower, upper as the first 3 entries. */
-
- if ((options & PCRE_CASELESS) != 0 && posix_class <= 2)
- posix_class = 0;
-
- /* Or into the map we are building up to 3 of the static class
- tables, or their negations. */
-
- posix_class *= 3;
- for (i = 0; i < 3; i++)
- {
- int taboffset = posix_class_maps[posix_class + i];
- if (taboffset < 0) break;
- if (local_negate)
- for (c = 0; c < 32; c++) class[c] |= ~cbits[c+taboffset];
- else
- for (c = 0; c < 32; c++) class[c] |= cbits[c+taboffset];
- }
-
- ptr = tempptr + 1;
- class_charcount = 10; /* Set > 1; assumes more than 1 per class */
- continue;
- }
-
- /* Backslash may introduce a single character, or it may introduce one
- of the specials, which just set a flag. Escaped items are checked for
- validity in the pre-compiling pass. The sequence \b is a special case.
- Inside a class (and only there) it is treated as backspace. Elsewhere
- it marks a word boundary. Other escapes have preset maps ready to
- or into the one we are building. We assume they have more than one
- character in them, so set class_count bigger than one. */
-
- if (c == '\\')
- {
- c = check_escape(&ptr, errorptr, *brackets, options, TRUE, cd);
- if (-c == ESC_b) c = '\b';
- else if (c < 0)
- {
- register const uschar *cbits = cd->cbits;
- class_charcount = 10;
- switch (-c)
- {
- case ESC_d:
- for (c = 0; c < 32; c++) class[c] |= cbits[c+cbit_digit];
- continue;
-
- case ESC_D:
- for (c = 0; c < 32; c++) class[c] |= ~cbits[c+cbit_digit];
- continue;
-
- case ESC_w:
- for (c = 0; c < 32; c++) class[c] |= cbits[c+cbit_word];
- continue;
-
- case ESC_W:
- for (c = 0; c < 32; c++) class[c] |= ~cbits[c+cbit_word];
- continue;
-
- case ESC_s:
- for (c = 0; c < 32; c++) class[c] |= cbits[c+cbit_space];
- continue;
-
- case ESC_S:
- for (c = 0; c < 32; c++) class[c] |= ~cbits[c+cbit_space];
- continue;
-
- default:
- *errorptr = ERR7;
- goto FAILED;
- }
- }
-
- /* Fall through if single character, but don't at present allow
- chars > 255 in UTF-8 mode. */
-
-#ifdef SUPPORT_UTF8
- if (c > 255)
- {
- *errorptr = ERR33;
- goto FAILED;
- }
-#endif
- }
-
- /* A single character may be followed by '-' to form a range. However,
- Perl does not permit ']' to be the end of the range. A '-' character
- here is treated as a literal. */
-
- if (ptr[1] == '-' && ptr[2] != ']')
- {
- int d;
- ptr += 2;
- d = *ptr;
-
- if (d == 0)
- {
- *errorptr = ERR6;
- goto FAILED;
- }
-
- /* The second part of a range can be a single-character escape, but
- not any of the other escapes. Perl 5.6 treats a hyphen as a literal
- in such circumstances. */
-
- if (d == '\\')
- {
- const uschar *oldptr = ptr;
- d = check_escape(&ptr, errorptr, *brackets, options, TRUE, cd);
-
-#ifdef SUPPORT_UTF8
- if (d > 255)
- {
- *errorptr = ERR33;
- goto FAILED;
- }
-#endif
- /* \b is backslash; any other special means the '-' was literal */
-
- if (d < 0)
- {
- if (d == -ESC_b) d = '\b'; else
- {
- ptr = oldptr - 2;
- goto SINGLE_CHARACTER; /* A few lines below */
- }
- }
- }
-
- if (d < c)
- {
- *errorptr = ERR8;
- goto FAILED;
- }
-
- for (; c <= d; c++)
- {
- class[c/8] |= (1 << (c&7));
- if ((options & PCRE_CASELESS) != 0)
- {
- int uc = cd->fcc[c]; /* flip case */
- class[uc/8] |= (1 << (uc&7));
- }
- class_charcount++; /* in case a one-char range */
- class_lastchar = c;
- }
- continue; /* Go get the next char in the class */
- }
-
- /* Handle a lone single character - we can get here for a normal
- non-escape char, or after \ that introduces a single character. */
-
- SINGLE_CHARACTER:
-
- class [c/8] |= (1 << (c&7));
- if ((options & PCRE_CASELESS) != 0)
- {
- c = cd->fcc[c]; /* flip case */
- class[c/8] |= (1 << (c&7));
- }
- class_charcount++;
- class_lastchar = c;
- }
-
- /* Loop until ']' reached; the check for end of string happens inside the
- loop. This "while" is the end of the "do" above. */
-
- while ((c = *(++ptr)) != ']');
-
- /* If class_charcount is 1 and class_lastchar is not negative, we saw
- precisely one character. This doesn't need the whole 32-byte bit map.
- We turn it into a 1-character OP_CHAR if it's positive, or OP_NOT if
- it's negative. */
-
- if (class_charcount == 1 && class_lastchar >= 0)
- {
- if (negate_class)
- {
- code[-1] = OP_NOT;
- }
- else
- {
- code[-1] = OP_CHARS;
- *code++ = 1;
- }
- *code++ = class_lastchar;
- }
-
- /* Otherwise, negate the 32-byte map if necessary, and copy it into
- the code vector. */
-
- else
- {
- if (negate_class)
- for (c = 0; c < 32; c++) code[c] = ~class[c];
- else
- memcpy(code, class, 32);
- code += 32;
- }
- break;
-
- /* Various kinds of repeat */
-
- case '{':
- if (!is_counted_repeat(ptr+1, cd)) goto NORMAL_CHAR;
- ptr = read_repeat_counts(ptr+1, &repeat_min, &repeat_max, errorptr, cd);
- if (*errorptr != NULL) goto FAILED;
- goto REPEAT;
-
- case '*':
- repeat_min = 0;
- repeat_max = -1;
- goto REPEAT;
-
- case '+':
- repeat_min = 1;
- repeat_max = -1;
- goto REPEAT;
-
- case '?':
- repeat_min = 0;
- repeat_max = 1;
-
- REPEAT:
- if (previous == NULL)
- {
- *errorptr = ERR9;
- goto FAILED;
- }
-
- /* If the next character is '?' this is a minimizing repeat, by default,
- but if PCRE_UNGREEDY is set, it works the other way round. Advance to the
- next character. */
-
- if (ptr[1] == '?')
- { repeat_type = greedy_non_default; ptr++; }
- else repeat_type = greedy_default;
-
- /* If previous was a string of characters, chop off the last one and use it
- as the subject of the repeat. If there was only one character, we can
- abolish the previous item altogether. A repeat with a zero minimum wipes
- out any reqchar setting, backing up to the previous value. We must also
- adjust the countlits value. */
-
- if (*previous == OP_CHARS)
- {
- int len = previous[1];
-
- if (repeat_min == 0) *reqchar = prevreqchar;
- *countlits += repeat_min - 1;
-
- if (len == 1)
- {
- c = previous[2];
- code = previous;
- }
- else
- {
- c = previous[len+1];
- previous[1]--;
- code--;
- }
- op_type = 0; /* Use single-char op codes */
- goto OUTPUT_SINGLE_REPEAT; /* Code shared with single character types */
- }
-
- /* If previous was a single negated character ([^a] or similar), we use
- one of the special opcodes, replacing it. The code is shared with single-
- character repeats by adding a suitable offset into repeat_type. */
-
- else if ((int)*previous == OP_NOT)
- {
- op_type = OP_NOTSTAR - OP_STAR; /* Use "not" opcodes */
- c = previous[1];
- code = previous;
- goto OUTPUT_SINGLE_REPEAT;
- }
-
- /* If previous was a character type match (\d or similar), abolish it and
- create a suitable repeat item. The code is shared with single-character
- repeats by adding a suitable offset into repeat_type. */
-
- else if ((int)*previous < OP_EODN || *previous == OP_ANY)
- {
- op_type = OP_TYPESTAR - OP_STAR; /* Use type opcodes */
- c = *previous;
- code = previous;
-
- OUTPUT_SINGLE_REPEAT:
-
- /* If the maximum is zero then the minimum must also be zero; Perl allows
- this case, so we do too - by simply omitting the item altogether. */
-
- if (repeat_max == 0) goto END_REPEAT;
-
- /* Combine the op_type with the repeat_type */
-
- repeat_type += op_type;
-
- /* A minimum of zero is handled either as the special case * or ?, or as
- an UPTO, with the maximum given. */
-
- if (repeat_min == 0)
- {
- if (repeat_max == -1) *code++ = OP_STAR + repeat_type;
- else if (repeat_max == 1) *code++ = OP_QUERY + repeat_type;
- else
- {
- *code++ = OP_UPTO + repeat_type;
- *code++ = repeat_max >> 8;
- *code++ = (repeat_max & 255);
- }
- }
-
- /* The case {1,} is handled as the special case + */
-
- else if (repeat_min == 1 && repeat_max == -1)
- *code++ = OP_PLUS + repeat_type;
-
- /* The case {n,n} is just an EXACT, while the general case {n,m} is
- handled as an EXACT followed by an UPTO. An EXACT of 1 is optimized. */
-
- else
- {
- if (repeat_min != 1)
- {
- *code++ = OP_EXACT + op_type; /* NB EXACT doesn't have repeat_type */
- *code++ = repeat_min >> 8;
- *code++ = (repeat_min & 255);
- }
-
- /* If the mininum is 1 and the previous item was a character string,
- we either have to put back the item that got cancelled if the string
- length was 1, or add the character back onto the end of a longer
- string. For a character type nothing need be done; it will just get
- put back naturally. Note that the final character is always going to
- get added below. */
-
- else if (*previous == OP_CHARS)
- {
- if (code == previous) code += 2; else previous[1]++;
- }
-
- /* For a single negated character we also have to put back the
- item that got cancelled. */
-
- else if (*previous == OP_NOT) code++;
-
- /* If the maximum is unlimited, insert an OP_STAR. */
-
- if (repeat_max < 0)
- {
- *code++ = c;
- *code++ = OP_STAR + repeat_type;
- }
-
- /* Else insert an UPTO if the max is greater than the min. */
-
- else if (repeat_max != repeat_min)
- {
- *code++ = c;
- repeat_max -= repeat_min;
- *code++ = OP_UPTO + repeat_type;
- *code++ = repeat_max >> 8;
- *code++ = (repeat_max & 255);
- }
- }
-
- /* The character or character type itself comes last in all cases. */
-
- *code++ = c;
- }
-
- /* If previous was a character class or a back reference, we put the repeat
- stuff after it, but just skip the item if the repeat was {0,0}. */
-
- else if (*previous == OP_CLASS || *previous == OP_REF)
- {
- if (repeat_max == 0)
- {
- code = previous;
- goto END_REPEAT;
- }
- if (repeat_min == 0 && repeat_max == -1)
- *code++ = OP_CRSTAR + repeat_type;
- else if (repeat_min == 1 && repeat_max == -1)
- *code++ = OP_CRPLUS + repeat_type;
- else if (repeat_min == 0 && repeat_max == 1)
- *code++ = OP_CRQUERY + repeat_type;
- else
- {
- *code++ = OP_CRRANGE + repeat_type;
- *code++ = repeat_min >> 8;
- *code++ = repeat_min & 255;
- if (repeat_max == -1) repeat_max = 0; /* 2-byte encoding for max */
- *code++ = repeat_max >> 8;
- *code++ = repeat_max & 255;
- }
- }
-
- /* If previous was a bracket group, we may have to replicate it in certain
- cases. */
-
- else if ((int)*previous >= OP_BRA || (int)*previous == OP_ONCE ||
- (int)*previous == OP_COND)
- {
- register int i;
- int ketoffset = 0;
- int len = code - previous;
- uschar *bralink = NULL;
-
- /* If the maximum repeat count is unlimited, find the end of the bracket
- by scanning through from the start, and compute the offset back to it
- from the current code pointer. There may be an OP_OPT setting following
- the final KET, so we can't find the end just by going back from the code
- pointer. */
-
- if (repeat_max == -1)
- {
- register uschar *ket = previous;
- do ket += (ket[1] << 8) + ket[2]; while (*ket != OP_KET);
- ketoffset = code - ket;
- }
-
- /* The case of a zero minimum is special because of the need to stick
- OP_BRAZERO in front of it, and because the group appears once in the
- data, whereas in other cases it appears the minimum number of times. For
- this reason, it is simplest to treat this case separately, as otherwise
- the code gets far too mess. There are several special subcases when the
- minimum is zero. */
-
- if (repeat_min == 0)
- {
- /* If we set up a required char from the bracket, we must back off
- to the previous value and reset the countlits value too. */
-
- if (subcountlits > 0)
- {
- *reqchar = prevreqchar;
- *countlits -= subcountlits;
- }
-
- /* If the maximum is also zero, we just omit the group from the output
- altogether. */
-
- if (repeat_max == 0)
- {
- code = previous;
- goto END_REPEAT;
- }
-
- /* If the maximum is 1 or unlimited, we just have to stick in the
- BRAZERO and do no more at this point. */
-
- if (repeat_max <= 1)
- {
- memmove(previous+1, previous, len);
- code++;
- *previous++ = OP_BRAZERO + repeat_type;
- }
-
- /* If the maximum is greater than 1 and limited, we have to replicate
- in a nested fashion, sticking OP_BRAZERO before each set of brackets.
- The first one has to be handled carefully because it's the original
- copy, which has to be moved up. The remainder can be handled by code
- that is common with the non-zero minimum case below. We just have to
- adjust the value or repeat_max, since one less copy is required. */
-
- else
- {
- int offset;
- memmove(previous+4, previous, len);
- code += 4;
- *previous++ = OP_BRAZERO + repeat_type;
- *previous++ = OP_BRA;
-
- /* We chain together the bracket offset fields that have to be
- filled in later when the ends of the brackets are reached. */
-
- offset = (bralink == NULL)? 0 : previous - bralink;
- bralink = previous;
- *previous++ = offset >> 8;
- *previous++ = offset & 255;
- }
-
- repeat_max--;
- }
-
- /* If the minimum is greater than zero, replicate the group as many
- times as necessary, and adjust the maximum to the number of subsequent
- copies that we need. */
-
- else
- {
- for (i = 1; i < repeat_min; i++)
- {
- memcpy(code, previous, len);
- code += len;
- }
- if (repeat_max > 0) repeat_max -= repeat_min;
- }
-
- /* This code is common to both the zero and non-zero minimum cases. If
- the maximum is limited, it replicates the group in a nested fashion,
- remembering the bracket starts on a stack. In the case of a zero minimum,
- the first one was set up above. In all cases the repeat_max now specifies
- the number of additional copies needed. */
-
- if (repeat_max >= 0)
- {
- for (i = repeat_max - 1; i >= 0; i--)
- {
- *code++ = OP_BRAZERO + repeat_type;
-
- /* All but the final copy start a new nesting, maintaining the
- chain of brackets outstanding. */
-
- if (i != 0)
- {
- int offset;
- *code++ = OP_BRA;
- offset = (bralink == NULL)? 0 : code - bralink;
- bralink = code;
- *code++ = offset >> 8;
- *code++ = offset & 255;
- }
-
- memcpy(code, previous, len);
- code += len;
- }
-
- /* Now chain through the pending brackets, and fill in their length
- fields (which are holding the chain links pro tem). */
-
- while (bralink != NULL)
- {
- int oldlinkoffset;
- int offset = code - bralink + 1;
- uschar *bra = code - offset;
- oldlinkoffset = (bra[1] << 8) + bra[2];
- bralink = (oldlinkoffset == 0)? NULL : bralink - oldlinkoffset;
- *code++ = OP_KET;
- *code++ = bra[1] = offset >> 8;
- *code++ = bra[2] = (offset & 255);
- }
- }
-
- /* If the maximum is unlimited, set a repeater in the final copy. We
- can't just offset backwards from the current code point, because we
- don't know if there's been an options resetting after the ket. The
- correct offset was computed above. */
-
- else code[-ketoffset] = OP_KETRMAX + repeat_type;
- }
-
- /* Else there's some kind of shambles */
-
- else
- {
- *errorptr = ERR11;
- goto FAILED;
- }
-
- /* In all case we no longer have a previous item. */
-
- END_REPEAT:
- previous = NULL;
- break;
-
-
- /* Start of nested bracket sub-expression, or comment or lookahead or
- lookbehind or option setting or condition. First deal with special things
- that can come after a bracket; all are introduced by ?, and the appearance
- of any of them means that this is not a referencing group. They were
- checked for validity in the first pass over the string, so we don't have to
- check for syntax errors here. */
-
- case '(':
- newoptions = options;
- condref = -1;
-
- if (*(++ptr) == '?')
- {
- int set, unset;
- int *optset;
-
- switch (*(++ptr))
- {
- case '#': /* Comment; skip to ket */
- ptr++;
- while (*ptr != ')') ptr++;
- continue;
-
- case ':': /* Non-extracting bracket */
- bravalue = OP_BRA;
- ptr++;
- break;
-
- case '(':
- bravalue = OP_COND; /* Conditional group */
- if ((cd->ctypes[*(++ptr)] & ctype_digit) != 0)
- {
- condref = *ptr - '0';
- while (*(++ptr) != ')') condref = condref*10 + *ptr - '0';
- if (condref == 0)
- {
- *errorptr = ERR35;
- goto FAILED;
- }
- ptr++;
- }
- else ptr--;
- break;
-
- case '=': /* Positive lookahead */
- bravalue = OP_ASSERT;
- ptr++;
- break;
-
- case '!': /* Negative lookahead */
- bravalue = OP_ASSERT_NOT;
- ptr++;
- break;
-
- case '<': /* Lookbehinds */
- switch (*(++ptr))
- {
- case '=': /* Positive lookbehind */
- bravalue = OP_ASSERTBACK;
- ptr++;
- break;
-
- case '!': /* Negative lookbehind */
- bravalue = OP_ASSERTBACK_NOT;
- ptr++;
- break;
-
- default: /* Syntax error */
- *errorptr = ERR24;
- goto FAILED;
- }
- break;
-
- case '>': /* One-time brackets */
- bravalue = OP_ONCE;
- ptr++;
- break;
-
- case 'R': /* Pattern recursion */
- *code++ = OP_RECURSE;
- ptr++;
- continue;
-
- default: /* Option setting */
- set = unset = 0;
- optset = &set;
-
- while (*ptr != ')' && *ptr != ':')
- {
- switch (*ptr++)
- {
- case '-': optset = &unset; break;
-
- case 'i': *optset |= PCRE_CASELESS; break;
- case 'm': *optset |= PCRE_MULTILINE; break;
- case 's': *optset |= PCRE_DOTALL; break;
- case 'x': *optset |= PCRE_EXTENDED; break;
- case 'U': *optset |= PCRE_UNGREEDY; break;
- case 'X': *optset |= PCRE_EXTRA; break;
-
- default:
- *errorptr = ERR12;
- goto FAILED;
- }
- }
-
- /* Set up the changed option bits, but don't change anything yet. */
-
- newoptions = (options | set) & (~unset);
-
- /* If the options ended with ')' this is not the start of a nested
- group with option changes, so the options change at this level. At top
- level there is nothing else to be done (the options will in fact have
- been set from the start of compiling as a result of the first pass) but
- at an inner level we must compile code to change the ims options if
- necessary, and pass the new setting back so that it can be put at the
- start of any following branches, and when this group ends, a resetting
- item can be compiled. */
-
- if (*ptr == ')')
- {
- if ((options & PCRE_INGROUP) != 0 &&
- (options & PCRE_IMS) != (newoptions & PCRE_IMS))
- {
- *code++ = OP_OPT;
- *code++ = *optchanged = newoptions & PCRE_IMS;
- }
- options = newoptions; /* Change options at this level */
- previous = NULL; /* This item can't be repeated */
- continue; /* It is complete */
- }
-
- /* If the options ended with ':' we are heading into a nested group
- with possible change of options. Such groups are non-capturing and are
- not assertions of any kind. All we need to do is skip over the ':';
- the newoptions value is handled below. */
-
- bravalue = OP_BRA;
- ptr++;
- }
- }
-
- /* Else we have a referencing group; adjust the opcode. */
-
- else
- {
- if (++(*brackets) > EXTRACT_MAX)
- {
- *errorptr = ERR13;
- goto FAILED;
- }
- bravalue = OP_BRA + *brackets;
- }
-
- /* Process nested bracketed re. Assertions may not be repeated, but other
- kinds can be. We copy code into a non-register variable in order to be able
- to pass its address because some compilers complain otherwise. Pass in a
- new setting for the ims options if they have changed. */
-
- previous = (bravalue >= OP_ONCE)? code : NULL;
- *code = bravalue;
- tempcode = code;
-
- if (!compile_regex(
- options | PCRE_INGROUP, /* Set for all nested groups */
- ((options & PCRE_IMS) != (newoptions & PCRE_IMS))?
- newoptions & PCRE_IMS : -1, /* Pass ims options if changed */
- brackets, /* Bracket level */
- &tempcode, /* Where to put code (updated) */
- &ptr, /* Input pointer (updated) */
- errorptr, /* Where to put an error message */
- (bravalue == OP_ASSERTBACK ||
- bravalue == OP_ASSERTBACK_NOT), /* TRUE if back assert */
- condref, /* Condition reference number */
- &subreqchar, /* For possible last char */
- &subcountlits, /* For literal count */
- cd)) /* Tables block */
- goto FAILED;
-
- /* At the end of compiling, code is still pointing to the start of the
- group, while tempcode has been updated to point past the end of the group
- and any option resetting that may follow it. The pattern pointer (ptr)
- is on the bracket. */
-
- /* If this is a conditional bracket, check that there are no more than
- two branches in the group. */
-
- if (bravalue == OP_COND)
- {
- uschar *tc = code;
- condcount = 0;
-
- do {
- condcount++;
- tc += (tc[1] << 8) | tc[2];
- }
- while (*tc != OP_KET);
-
- if (condcount > 2)
- {
- *errorptr = ERR27;
- goto FAILED;
- }
- }
-
- /* Handle updating of the required character. If the subpattern didn't
- set one, leave it as it was. Otherwise, update it for normal brackets of
- all kinds, forward assertions, and conditions with two branches. Don't
- update the literal count for forward assertions, however. If the bracket
- is followed by a quantifier with zero repeat, we have to back off. Hence
- the definition of prevreqchar and subcountlits outside the main loop so
- that they can be accessed for the back off. */
-
- if (subreqchar > 0 &&
- (bravalue >= OP_BRA || bravalue == OP_ONCE || bravalue == OP_ASSERT ||
- (bravalue == OP_COND && condcount == 2)))
- {
- prevreqchar = *reqchar;
- *reqchar = subreqchar;
- if (bravalue != OP_ASSERT) *countlits += subcountlits;
- }
-
- /* Now update the main code pointer to the end of the group. */
-
- code = tempcode;
-
- /* Error if hit end of pattern */
-
- if (*ptr != ')')
- {
- *errorptr = ERR14;
- goto FAILED;
- }
- break;
-
- /* Check \ for being a real metacharacter; if not, fall through and handle
- it as a data character at the start of a string. Escape items are checked
- for validity in the pre-compiling pass. */
-
- case '\\':
- tempptr = ptr;
- c = check_escape(&ptr, errorptr, *brackets, options, FALSE, cd);
-
- /* Handle metacharacters introduced by \. For ones like \d, the ESC_ values
- are arranged to be the negation of the corresponding OP_values. For the
- back references, the values are ESC_REF plus the reference number. Only
- back references and those types that consume a character may be repeated.
- We can test for values between ESC_b and ESC_Z for the latter; this may
- have to change if any new ones are ever created. */
-
- if (c < 0)
- {
- if (-c >= ESC_REF)
- {
- previous = code;
- *code++ = OP_REF;
- *code++ = -c - ESC_REF;
- }
- else
- {
- previous = (-c > ESC_b && -c < ESC_Z)? code : NULL;
- *code++ = -c;
- }
- continue;
- }
-
- /* Data character: reset and fall through */
-
- ptr = tempptr;
- c = '\\';
-
- /* Handle a run of data characters until a metacharacter is encountered.
- The first character is guaranteed not to be whitespace or # when the
- extended flag is set. */
-
- NORMAL_CHAR:
- default:
- previous = code;
- *code = OP_CHARS;
- code += 2;
- length = 0;
-
- do
- {
- if ((options & PCRE_EXTENDED) != 0)
- {
- if ((cd->ctypes[c] & ctype_space) != 0) continue;
- if (c == '#')
- {
- /* The space before the ; is to avoid a warning on a silly compiler
- on the Macintosh. */
- while ((c = *(++ptr)) != 0 && c != '\n') ;
- if (c == 0) break;
- continue;
- }
- }
-
- /* Backslash may introduce a data char or a metacharacter. Escaped items
- are checked for validity in the pre-compiling pass. Stop the string
- before a metaitem. */
-
- if (c == '\\')
- {
- tempptr = ptr;
- c = check_escape(&ptr, errorptr, *brackets, options, FALSE, cd);
- if (c < 0) { ptr = tempptr; break; }
-
- /* If a character is > 127 in UTF-8 mode, we have to turn it into
- two or more characters in the UTF-8 encoding. */
-
-#ifdef SUPPORT_UTF8
- if (c > 127 && (options & PCRE_UTF8) != 0)
- {
- uschar buffer[8];
- int len = ord2utf8(c, buffer);
- for (c = 0; c < len; c++) *code++ = buffer[c];
- length += len;
- continue;
- }
-#endif
- }
-
- /* Ordinary character or single-char escape */
-
- *code++ = c;
- length++;
- }
-
- /* This "while" is the end of the "do" above. */
-
- while (length < MAXLIT && (cd->ctypes[c = *(++ptr)] & ctype_meta) == 0);
-
- /* Update the last character and the count of literals */
-
- prevreqchar = (length > 1)? code[-2] : *reqchar;
- *reqchar = code[-1];
- *countlits += length;
-
- /* Compute the length and set it in the data vector, and advance to
- the next state. */
-
- previous[1] = length;
- if (length < MAXLIT) ptr--;
- break;
- }
- } /* end of big loop */
-
-/* Control never reaches here by falling through, only by a goto for all the
-error states. Pass back the position in the pattern so that it can be displayed
-to the user for diagnosing the error. */
-
-FAILED:
-*ptrptr = ptr;
-return FALSE;
-}
-
-
-
-
-/*************************************************
-* Compile sequence of alternatives *
-*************************************************/
-
-/* On entry, ptr is pointing past the bracket character, but on return
-it points to the closing bracket, or vertical bar, or end of string.
-The code variable is pointing at the byte into which the BRA operator has been
-stored. If the ims options are changed at the start (for a (?ims: group) or
-during any branch, we need to insert an OP_OPT item at the start of every
-following branch to ensure they get set correctly at run time, and also pass
-the new options into every subsequent branch compile.
-
-Argument:
- options the option bits
- optchanged new ims options to set as if (?ims) were at the start, or -1
- for no change
- brackets -> int containing the number of extracting brackets used
- codeptr -> the address of the current code pointer
- ptrptr -> the address of the current pattern pointer
- errorptr -> pointer to error message
- lookbehind TRUE if this is a lookbehind assertion
- condref >= 0 for OPT_CREF setting at start of conditional group
- reqchar -> place to put the last required character, or a negative number
- countlits -> place to put the shortest literal count of any branch
- cd points to the data block with tables pointers
-
-Returns: TRUE on success
-*/
-
-static BOOL
-compile_regex(int options, int optchanged, int *brackets, uschar **codeptr,
- const uschar **ptrptr, const char **errorptr, BOOL lookbehind, int condref,
- int *reqchar, int *countlits, compile_data *cd)
-{
-const uschar *ptr = *ptrptr;
-uschar *code = *codeptr;
-uschar *last_branch = code;
-uschar *start_bracket = code;
-uschar *reverse_count = NULL;
-int oldoptions = options & PCRE_IMS;
-int branchreqchar, branchcountlits;
-
-*reqchar = -1;
-*countlits = INT_MAX;
-code += 3;
-
-/* At the start of a reference-based conditional group, insert the reference
-number as an OP_CREF item. */
-
-if (condref >= 0)
- {
- *code++ = OP_CREF;
- *code++ = condref;
- }
-
-/* Loop for each alternative branch */
-
-for (;;)
- {
- int length;
-
- /* Handle change of options */
-
- if (optchanged >= 0)
- {
- *code++ = OP_OPT;
- *code++ = optchanged;
- options = (options & ~PCRE_IMS) | optchanged;
- }
-
- /* Set up dummy OP_REVERSE if lookbehind assertion */
-
- if (lookbehind)
- {
- *code++ = OP_REVERSE;
- reverse_count = code;
- *code++ = 0;
- *code++ = 0;
- }
-
- /* Now compile the branch */
-
- if (!compile_branch(options, brackets, &code, &ptr, errorptr, &optchanged,
- &branchreqchar, &branchcountlits, cd))
- {
- *ptrptr = ptr;
- return FALSE;
- }
-
- /* Fill in the length of the last branch */
-
- length = code - last_branch;
- last_branch[1] = length >> 8;
- last_branch[2] = length & 255;
-
- /* Save the last required character if all branches have the same; a current
- value of -1 means unset, while -2 means "previous branch had no last required
- char". */
-
- if (*reqchar != -2)
- {
- if (branchreqchar >= 0)
- {
- if (*reqchar == -1) *reqchar = branchreqchar;
- else if (*reqchar != branchreqchar) *reqchar = -2;
- }
- else *reqchar = -2;
- }
-
- /* Keep the shortest literal count */
-
- if (branchcountlits < *countlits) *countlits = branchcountlits;
- DPRINTF(("literal count = %d min=%d\n", branchcountlits, *countlits));
-
- /* If lookbehind, check that this branch matches a fixed-length string,
- and put the length into the OP_REVERSE item. Temporarily mark the end of
- the branch with OP_END. */
-
- if (lookbehind)
- {
- *code = OP_END;
- length = find_fixedlength(last_branch, options);
- DPRINTF(("fixed length = %d\n", length));
- if (length < 0)
- {
- *errorptr = ERR25;
- *ptrptr = ptr;
- return FALSE;
- }
- reverse_count[0] = (length >> 8);
- reverse_count[1] = length & 255;
- }
-
- /* Reached end of expression, either ')' or end of pattern. Insert a
- terminating ket and the length of the whole bracketed item, and return,
- leaving the pointer at the terminating char. If any of the ims options
- were changed inside the group, compile a resetting op-code following. */
-
- if (*ptr != '|')
- {
- length = code - start_bracket;
- *code++ = OP_KET;
- *code++ = length >> 8;
- *code++ = length & 255;
- if (optchanged >= 0)
- {
- *code++ = OP_OPT;
- *code++ = oldoptions;
- }
- *codeptr = code;
- *ptrptr = ptr;
- return TRUE;
- }
-
- /* Another branch follows; insert an "or" node and advance the pointer. */
-
- *code = OP_ALT;
- last_branch = code;
- code += 3;
- ptr++;
- }
-/* Control never reaches here */
-}
-
-
-
-
-/*************************************************
-* Find first significant op code *
-*************************************************/
-
-/* This is called by several functions that scan a compiled expression looking
-for a fixed first character, or an anchoring op code etc. It skips over things
-that do not influence this. For one application, a change of caseless option is
-important.
-
-Arguments:
- code pointer to the start of the group
- options pointer to external options
- optbit the option bit whose changing is significant, or
- zero if none are
- optstop TRUE to return on option change, otherwise change the options
- value and continue
-
-Returns: pointer to the first significant opcode
-*/
-
-static const uschar*
-first_significant_code(const uschar *code, int *options, int optbit,
- BOOL optstop)
-{
-for (;;)
- {
- switch ((int)*code)
- {
- case OP_OPT:
- if (optbit > 0 && ((int)code[1] & optbit) != (*options & optbit))
- {
- if (optstop) return code;
- *options = (int)code[1];
- }
- code += 2;
- break;
-
- case OP_CREF:
- code += 2;
- break;
-
- case OP_WORD_BOUNDARY:
- case OP_NOT_WORD_BOUNDARY:
- code++;
- break;
-
- case OP_ASSERT_NOT:
- case OP_ASSERTBACK:
- case OP_ASSERTBACK_NOT:
- do code += (code[1] << 8) + code[2]; while (*code == OP_ALT);
- code += 3;
- break;
-
- default:
- return code;
- }
- }
-/* Control never reaches here */
-}
-
-
-
-
-/*************************************************
-* Check for anchored expression *
-*************************************************/
-
-/* Try to find out if this is an anchored regular expression. Consider each
-alternative branch. If they all start with OP_SOD or OP_CIRC, or with a bracket
-all of whose alternatives start with OP_SOD or OP_CIRC (recurse ad lib), then
-it's anchored. However, if this is a multiline pattern, then only OP_SOD
-counts, since OP_CIRC can match in the middle.
-
-A branch is also implicitly anchored if it starts with .* and DOTALL is set,
-because that will try the rest of the pattern at all possible matching points,
-so there is no point trying them again.
-
-Arguments:
- code points to start of expression (the bracket)
- options points to the options setting
-
-Returns: TRUE or FALSE
-*/
-
-static BOOL
-is_anchored(register const uschar *code, int *options)
-{
-do {
- const uschar *scode = first_significant_code(code + 3, options,
- PCRE_MULTILINE, FALSE);
- register int op = *scode;
- if (op >= OP_BRA || op == OP_ASSERT || op == OP_ONCE || op == OP_COND)
- { if (!is_anchored(scode, options)) return FALSE; }
- else if ((op == OP_TYPESTAR || op == OP_TYPEMINSTAR) &&
- (*options & PCRE_DOTALL) != 0)
- { if (scode[1] != OP_ANY) return FALSE; }
- else if (op != OP_SOD &&
- ((*options & PCRE_MULTILINE) != 0 || op != OP_CIRC))
- return FALSE;
- code += (code[1] << 8) + code[2];
- }
-while (*code == OP_ALT);
-return TRUE;
-}
-
-
-
-/*************************************************
-* Check for starting with ^ or .* *
-*************************************************/
-
-/* This is called to find out if every branch starts with ^ or .* so that
-"first char" processing can be done to speed things up in multiline
-matching and for non-DOTALL patterns that start with .* (which must start at
-the beginning or after \n).
-
-Argument: points to start of expression (the bracket)
-Returns: TRUE or FALSE
-*/
-
-static BOOL
-is_startline(const uschar *code)
-{
-do {
- const uschar *scode = first_significant_code(code + 3, NULL, 0, FALSE);
- register int op = *scode;
- if (op >= OP_BRA || op == OP_ASSERT || op == OP_ONCE || op == OP_COND)
- { if (!is_startline(scode)) return FALSE; }
- else if (op == OP_TYPESTAR || op == OP_TYPEMINSTAR)
- { if (scode[1] != OP_ANY) return FALSE; }
- else if (op != OP_CIRC) return FALSE;
- code += (code[1] << 8) + code[2];
- }
-while (*code == OP_ALT);
-return TRUE;
-}
-
-
-
-/*************************************************
-* Check for fixed first char *
-*************************************************/
-
-/* Try to find out if there is a fixed first character. This is called for
-unanchored expressions, as it speeds up their processing quite considerably.
-Consider each alternative branch. If they all start with the same char, or with
-a bracket all of whose alternatives start with the same char (recurse ad lib),
-then we return that char, otherwise -1.
-
-Arguments:
- code points to start of expression (the bracket)
- options pointer to the options (used to check casing changes)
-
-Returns: -1 or the fixed first char
-*/
-
-static int
-find_firstchar(const uschar *code, int *options)
-{
-register int c = -1;
-do {
- int d;
- const uschar *scode = first_significant_code(code + 3, options,
- PCRE_CASELESS, TRUE);
- register int op = *scode;
-
- if (op >= OP_BRA) op = OP_BRA;
-
- switch(op)
- {
- default:
- return -1;
-
- case OP_BRA:
- case OP_ASSERT:
- case OP_ONCE:
- case OP_COND:
- if ((d = find_firstchar(scode, options)) < 0) return -1;
- if (c < 0) c = d; else if (c != d) return -1;
- break;
-
- case OP_EXACT: /* Fall through */
- scode++;
-
- case OP_CHARS: /* Fall through */
- scode++;
-
- case OP_PLUS:
- case OP_MINPLUS:
- if (c < 0) c = scode[1]; else if (c != scode[1]) return -1;
- break;
- }
-
- code += (code[1] << 8) + code[2];
- }
-while (*code == OP_ALT);
-return c;
-}
-
-
-
-
-
-/*************************************************
-* Compile a Regular Expression *
-*************************************************/
-
-/* This function takes a string and returns a pointer to a block of store
-holding a compiled version of the expression.
-
-Arguments:
- pattern the regular expression
- options various option bits
- errorptr pointer to pointer to error text
- erroroffset ptr offset in pattern where error was detected
- tables pointer to character tables or NULL
-
-Returns: pointer to compiled data block, or NULL on error,
- with errorptr and erroroffset set
-*/
-
-pcre *
-pcre_compile(const char *pattern, int options, const char **errorptr,
- int *erroroffset, const unsigned char *tables)
-{
-real_pcre *re;
-int length = 3; /* For initial BRA plus length */
-int runlength;
-int c, reqchar, countlits;
-int bracount = 0;
-int top_backref = 0;
-int branch_extra = 0;
-int branch_newextra;
-unsigned int brastackptr = 0;
-size_t size;
-uschar *code;
-const uschar *ptr;
-compile_data compile_block;
-int brastack[BRASTACK_SIZE];
-uschar bralenstack[BRASTACK_SIZE];
-
-#ifdef DEBUG
-uschar *code_base, *code_end;
-#endif
-
-/* Can't support UTF8 unless PCRE has been compiled to include the code. */
-
-#ifndef SUPPORT_UTF8
-if ((options & PCRE_UTF8) != 0)
- {
- *errorptr = ERR32;
- return NULL;
- }
-#endif
-
-/* We can't pass back an error message if errorptr is NULL; I guess the best we
-can do is just return NULL. */
-
-if (errorptr == NULL) return NULL;
-*errorptr = NULL;
-
-/* However, we can give a message for this error */
-
-if (erroroffset == NULL)
- {
- *errorptr = ERR16;
- return NULL;
- }
-*erroroffset = 0;
-
-if ((options & ~PUBLIC_OPTIONS) != 0)
- {
- *errorptr = ERR17;
- return NULL;
- }
-
-/* Set up pointers to the individual character tables */
-
-if (tables == NULL) tables = pcre_default_tables;
-compile_block.lcc = tables + lcc_offset;
-compile_block.fcc = tables + fcc_offset;
-compile_block.cbits = tables + cbits_offset;
-compile_block.ctypes = tables + ctypes_offset;
-
-/* Reflect pattern for debugging output */
-
-DPRINTF(("------------------------------------------------------------------\n"));
-DPRINTF(("%s\n", pattern));
-
-/* The first thing to do is to make a pass over the pattern to compute the
-amount of store required to hold the compiled code. This does not have to be
-perfect as long as errors are overestimates. At the same time we can detect any
-internal flag settings. Make an attempt to correct for any counted white space
-if an "extended" flag setting appears late in the pattern. We can't be so
-clever for #-comments. */
-
-ptr = (const uschar *)(pattern - 1);
-while ((c = *(++ptr)) != 0)
- {
- int min, max;
- int class_charcount;
-
- if ((options & PCRE_EXTENDED) != 0)
- {
- if ((compile_block.ctypes[c] & ctype_space) != 0) continue;
- if (c == '#')
- {
- /* The space before the ; is to avoid a warning on a silly compiler
- on the Macintosh. */
- while ((c = *(++ptr)) != 0 && c != '\n') ;
- continue;
- }
- }
-
- switch(c)
- {
- /* A backslashed item may be an escaped "normal" character or a
- character type. For a "normal" character, put the pointers and
- character back so that tests for whitespace etc. in the input
- are done correctly. */
-
- case '\\':
- {
- const uschar *save_ptr = ptr;
- c = check_escape(&ptr, errorptr, bracount, options, FALSE, &compile_block);
- if (*errorptr != NULL) goto PCRE_ERROR_RETURN;
- if (c >= 0)
- {
- ptr = save_ptr;
- c = '\\';
- goto NORMAL_CHAR;
- }
- }
- length++;
-
- /* A back reference needs an additional char, plus either one or 5
- bytes for a repeat. We also need to keep the value of the highest
- back reference. */
-
- if (c <= -ESC_REF)
- {
- int refnum = -c - ESC_REF;
- if (refnum > top_backref) top_backref = refnum;
- length++; /* For single back reference */
- if (ptr[1] == '{' && is_counted_repeat(ptr+2, &compile_block))
- {
- ptr = read_repeat_counts(ptr+2, &min, &max, errorptr, &compile_block);
- if (*errorptr != NULL) goto PCRE_ERROR_RETURN;
- if ((min == 0 && (max == 1 || max == -1)) ||
- (min == 1 && max == -1))
- length++;
- else length += 5;
- if (ptr[1] == '?') ptr++;
- }
- }
- continue;
-
- case '^':
- case '.':
- case '$':
- case '*': /* These repeats won't be after brackets; */
- case '+': /* those are handled separately */
- case '?':
- length++;
- continue;
-
- /* This covers the cases of repeats after a single char, metachar, class,
- or back reference. */
-
- case '{':
- if (!is_counted_repeat(ptr+1, &compile_block)) goto NORMAL_CHAR;
- ptr = read_repeat_counts(ptr+1, &min, &max, errorptr, &compile_block);
- if (*errorptr != NULL) goto PCRE_ERROR_RETURN;
- if ((min == 0 && (max == 1 || max == -1)) ||
- (min == 1 && max == -1))
- length++;
- else
- {
- length--; /* Uncount the original char or metachar */
- if (min == 1) length++; else if (min > 0) length += 4;
- if (max > 0) length += 4; else length += 2;
- }
- if (ptr[1] == '?') ptr++;
- continue;
-
- /* An alternation contains an offset to the next branch or ket. If any ims
- options changed in the previous branch(es), and/or if we are in a
- lookbehind assertion, extra space will be needed at the start of the
- branch. This is handled by branch_extra. */
-
- case '|':
- length += 3 + branch_extra;
- continue;
-
- /* A character class uses 33 characters. Don't worry about character types
- that aren't allowed in classes - they'll get picked up during the compile.
- A character class that contains only one character uses 2 or 3 bytes,
- depending on whether it is negated or not. Notice this where we can. */
-
- case '[':
- class_charcount = 0;
- if (*(++ptr) == '^') ptr++;
- do
- {
- if (*ptr == '\\')
- {
- int ch = check_escape(&ptr, errorptr, bracount, options, TRUE,
- &compile_block);
- if (*errorptr != NULL) goto PCRE_ERROR_RETURN;
- if (-ch == ESC_b) class_charcount++; else class_charcount = 10;
- }
- else class_charcount++;
- ptr++;
- }
- while (*ptr != 0 && *ptr != ']');
-
- /* Repeats for negated single chars are handled by the general code */
-
- if (class_charcount == 1) length += 3; else
- {
- length += 33;
-
- /* A repeat needs either 1 or 5 bytes. */
-
- if (*ptr != 0 && ptr[1] == '{' && is_counted_repeat(ptr+2, &compile_block))
- {
- ptr = read_repeat_counts(ptr+2, &min, &max, errorptr, &compile_block);
- if (*errorptr != NULL) goto PCRE_ERROR_RETURN;
- if ((min == 0 && (max == 1 || max == -1)) ||
- (min == 1 && max == -1))
- length++;
- else length += 5;
- if (ptr[1] == '?') ptr++;
- }
- }
- continue;
-
- /* Brackets may be genuine groups or special things */
-
- case '(':
- branch_newextra = 0;
-
- /* Handle special forms of bracket, which all start (? */
-
- if (ptr[1] == '?')
- {
- int set, unset;
- int *optset;
-
- switch (c = ptr[2])
- {
- /* Skip over comments entirely */
- case '#':
- ptr += 3;
- while (*ptr != 0 && *ptr != ')') ptr++;
- if (*ptr == 0)
- {
- *errorptr = ERR18;
- goto PCRE_ERROR_RETURN;
- }
- continue;
-
- /* Non-referencing groups and lookaheads just move the pointer on, and
- then behave like a non-special bracket, except that they don't increment
- the count of extracting brackets. Ditto for the "once only" bracket,
- which is in Perl from version 5.005. */
-
- case ':':
- case '=':
- case '!':
- case '>':
- ptr += 2;
- break;
-
- /* A recursive call to the regex is an extension, to provide the
- facility which can be obtained by $(?p{perl-code}) in Perl 5.6. */
-
- case 'R':
- if (ptr[3] != ')')
- {
- *errorptr = ERR29;
- goto PCRE_ERROR_RETURN;
- }
- ptr += 3;
- length += 1;
- break;
-
- /* Lookbehinds are in Perl from version 5.005 */
-
- case '<':
- if (ptr[3] == '=' || ptr[3] == '!')
- {
- ptr += 3;
- branch_newextra = 3;
- length += 3; /* For the first branch */
- break;
- }
- *errorptr = ERR24;
- goto PCRE_ERROR_RETURN;
-
- /* Conditionals are in Perl from version 5.005. The bracket must either
- be followed by a number (for bracket reference) or by an assertion
- group. */
-
- case '(':
- if ((compile_block.ctypes[ptr[3]] & ctype_digit) != 0)
- {
- ptr += 4;
- length += 2;
- while ((compile_block.ctypes[*ptr] & ctype_digit) != 0) ptr++;
- if (*ptr != ')')
- {
- *errorptr = ERR26;
- goto PCRE_ERROR_RETURN;
- }
- }
- else /* An assertion must follow */
- {
- ptr++; /* Can treat like ':' as far as spacing is concerned */
- if (ptr[2] != '?' ||
- (ptr[3] != '=' && ptr[3] != '!' && ptr[3] != '<') )
- {
- ptr += 2; /* To get right offset in message */
- *errorptr = ERR28;
- goto PCRE_ERROR_RETURN;
- }
- }
- break;
-
- /* Else loop checking valid options until ) is met. Anything else is an
- error. If we are without any brackets, i.e. at top level, the settings
- act as if specified in the options, so massage the options immediately.
- This is for backward compatibility with Perl 5.004. */
-
- default:
- set = unset = 0;
- optset = &set;
- ptr += 2;
-
- for (;; ptr++)
- {
- c = *ptr;
- switch (c)
- {
- case 'i':
- *optset |= PCRE_CASELESS;
- continue;
-
- case 'm':
- *optset |= PCRE_MULTILINE;
- continue;
-
- case 's':
- *optset |= PCRE_DOTALL;
- continue;
-
- case 'x':
- *optset |= PCRE_EXTENDED;
- continue;
-
- case 'X':
- *optset |= PCRE_EXTRA;
- continue;
-
- case 'U':
- *optset |= PCRE_UNGREEDY;
- continue;
-
- case '-':
- optset = &unset;
- continue;
-
- /* A termination by ')' indicates an options-setting-only item;
- this is global at top level; otherwise nothing is done here and
- it is handled during the compiling process on a per-bracket-group
- basis. */
-
- case ')':
- if (brastackptr == 0)
- {
- options = (options | set) & (~unset);
- set = unset = 0; /* To save length */
- }
- /* Fall through */
-
- /* A termination by ':' indicates the start of a nested group with
- the given options set. This is again handled at compile time, but
- we must allow for compiled space if any of the ims options are
- set. We also have to allow for resetting space at the end of
- the group, which is why 4 is added to the length and not just 2.
- If there are several changes of options within the same group, this
- will lead to an over-estimate on the length, but this shouldn't
- matter very much. We also have to allow for resetting options at
- the start of any alternations, which we do by setting
- branch_newextra to 2. Finally, we record whether the case-dependent
- flag ever changes within the regex. This is used by the "required
- character" code. */
-
- case ':':
- if (((set|unset) & PCRE_IMS) != 0)
- {
- length += 4;
- branch_newextra = 2;
- if (((set|unset) & PCRE_CASELESS) != 0) options |= PCRE_ICHANGED;
- }
- goto END_OPTIONS;
-
- /* Unrecognized option character */
-
- default:
- *errorptr = ERR12;
- goto PCRE_ERROR_RETURN;
- }
- }
-
- /* If we hit a closing bracket, that's it - this is a freestanding
- option-setting. We need to ensure that branch_extra is updated if
- necessary. The only values branch_newextra can have here are 0 or 2.
- If the value is 2, then branch_extra must either be 2 or 5, depending
- on whether this is a lookbehind group or not. */
-
- END_OPTIONS:
- if (c == ')')
- {
- if (branch_newextra == 2 && (branch_extra == 0 || branch_extra == 3))
- branch_extra += branch_newextra;
- continue;
- }
-
- /* If options were terminated by ':' control comes here. Fall through
- to handle the group below. */
- }
- }
-
- /* Extracting brackets must be counted so we can process escapes in a
- Perlish way. */
-
- else bracount++;
-
- /* Non-special forms of bracket. Save length for computing whole length
- at end if there's a repeat that requires duplication of the group. Also
- save the current value of branch_extra, and start the new group with
- the new value. If non-zero, this will either be 2 for a (?imsx: group, or 3
- for a lookbehind assertion. */
-
- if (brastackptr >= sizeof(brastack)/sizeof(int))
- {
- *errorptr = ERR19;
- goto PCRE_ERROR_RETURN;
- }
-
- bralenstack[brastackptr] = branch_extra;
- branch_extra = branch_newextra;
-
- brastack[brastackptr++] = length;
- length += 3;
- continue;
-
- /* Handle ket. Look for subsequent max/min; for certain sets of values we
- have to replicate this bracket up to that many times. If brastackptr is
- 0 this is an unmatched bracket which will generate an error, but take care
- not to try to access brastack[-1] when computing the length and restoring
- the branch_extra value. */
-
- case ')':
- length += 3;
- {
- int minval = 1;
- int maxval = 1;
- int duplength;
-
- if (brastackptr > 0)
- {
- duplength = length - brastack[--brastackptr];
- branch_extra = bralenstack[brastackptr];
- }
- else duplength = 0;
-
- /* Leave ptr at the final char; for read_repeat_counts this happens
- automatically; for the others we need an increment. */
-
- if ((c = ptr[1]) == '{' && is_counted_repeat(ptr+2, &compile_block))
- {
- ptr = read_repeat_counts(ptr+2, &minval, &maxval, errorptr,
- &compile_block);
- if (*errorptr != NULL) goto PCRE_ERROR_RETURN;
- }
- else if (c == '*') { minval = 0; maxval = -1; ptr++; }
- else if (c == '+') { maxval = -1; ptr++; }
- else if (c == '?') { minval = 0; ptr++; }
-
- /* If the minimum is zero, we have to allow for an OP_BRAZERO before the
- group, and if the maximum is greater than zero, we have to replicate
- maxval-1 times; each replication acquires an OP_BRAZERO plus a nesting
- bracket set - hence the 7. */
-
- if (minval == 0)
- {
- length++;
- if (maxval > 0) length += (maxval - 1) * (duplength + 7);
- }
-
- /* When the minimum is greater than zero, 1 we have to replicate up to
- minval-1 times, with no additions required in the copies. Then, if
- there is a limited maximum we have to replicate up to maxval-1 times
- allowing for a BRAZERO item before each optional copy and nesting
- brackets for all but one of the optional copies. */
-
- else
- {
- length += (minval - 1) * duplength;
- if (maxval > minval) /* Need this test as maxval=-1 means no limit */
- length += (maxval - minval) * (duplength + 7) - 6;
- }
- }
- continue;
-
- /* Non-special character. For a run of such characters the length required
- is the number of characters + 2, except that the maximum run length is 255.
- We won't get a skipped space or a non-data escape or the start of a #
- comment as the first character, so the length can't be zero. */
-
- NORMAL_CHAR:
- default:
- length += 2;
- runlength = 0;
- do
- {
- if ((options & PCRE_EXTENDED) != 0)
- {
- if ((compile_block.ctypes[c] & ctype_space) != 0) continue;
- if (c == '#')
- {
- /* The space before the ; is to avoid a warning on a silly compiler
- on the Macintosh. */
- while ((c = *(++ptr)) != 0 && c != '\n') ;
- continue;
- }
- }
-
- /* Backslash may introduce a data char or a metacharacter; stop the
- string before the latter. */
-
- if (c == '\\')
- {
- const uschar *saveptr = ptr;
- c = check_escape(&ptr, errorptr, bracount, options, FALSE,
- &compile_block);
- if (*errorptr != NULL) goto PCRE_ERROR_RETURN;
- if (c < 0) { ptr = saveptr; break; }
-
-#ifdef SUPPORT_UTF8
- if (c > 127 && (options & PCRE_UTF8) != 0)
- {
- int i;
- for (i = 0; i < sizeof(utf8_table1)/sizeof(int); i++)
- if (c <= utf8_table1[i]) break;
- runlength += i;
- }
-#endif
- }
-
- /* Ordinary character or single-char escape */
-
- runlength++;
- }
-
- /* This "while" is the end of the "do" above. */
-
- while (runlength < MAXLIT &&
- (compile_block.ctypes[c = *(++ptr)] & ctype_meta) == 0);
-
- ptr--;
- length += runlength;
- continue;
- }
- }
-
-length += 4; /* For final KET and END */
-
-if (length > 65539)
- {
- *errorptr = ERR20;
- return NULL;
- }
-
-/* Compute the size of data block needed and get it, either from malloc or
-externally provided function. We specify "code[0]" in the offsetof() expression
-rather than just "code", because it has been reported that one broken compiler
-fails on "code" because it is also an independent variable. It should make no
-difference to the value of the offsetof(). */
-
-size = length + offsetof(real_pcre, code[0]);
-re = (real_pcre *)(pcre_malloc)(size);
-
-if (re == NULL)
- {
- *errorptr = ERR21;
- return NULL;
- }
-
-/* Put in the magic number, and save the size, options, and table pointer */
-
-re->magic_number = MAGIC_NUMBER;
-re->size = size;
-re->options = options;
-re->tables = tables;
-
-/* Set up a starting, non-extracting bracket, then compile the expression. On
-error, *errorptr will be set non-NULL, so we don't need to look at the result
-of the function here. */
-
-ptr = (const uschar *)pattern;
-code = re->code;
-*code = OP_BRA;
-bracount = 0;
-(void)compile_regex(options, -1, &bracount, &code, &ptr, errorptr, FALSE, -1,
- &reqchar, &countlits, &compile_block);
-re->top_bracket = bracount;
-re->top_backref = top_backref;
-
-/* If not reached end of pattern on success, there's an excess bracket. */
-
-if (*errorptr == NULL && *ptr != 0) *errorptr = ERR22;
-
-/* Fill in the terminating state and check for disastrous overflow, but
-if debugging, leave the test till after things are printed out. */
-
-*code++ = OP_END;
-
-#ifndef DEBUG
-if (code - re->code > length) *errorptr = ERR23;
-#endif
-
-/* Give an error if there's back reference to a non-existent capturing
-subpattern. */
-
-if (top_backref > re->top_bracket) *errorptr = ERR15;
-
-/* Failed to compile */
-
-if (*errorptr != NULL)
- {
- (pcre_free)(re);
- PCRE_ERROR_RETURN:
- *erroroffset = ptr - (const uschar *)pattern;
- return NULL;
- }
-
-/* If the anchored option was not passed, set flag if we can determine that the
-pattern is anchored by virtue of ^ characters or \A or anything else (such as
-starting with .* when DOTALL is set).
-
-Otherwise, see if we can determine what the first character has to be, because
-that speeds up unanchored matches no end. If not, see if we can set the
-PCRE_STARTLINE flag. This is helpful for multiline matches when all branches
-start with ^. and also when all branches start with .* for non-DOTALL matches.
-*/
-
-if ((options & PCRE_ANCHORED) == 0)
- {
- int temp_options = options;
- if (is_anchored(re->code, &temp_options))
- re->options |= PCRE_ANCHORED;
- else
- {
- int ch = find_firstchar(re->code, &temp_options);
- if (ch >= 0)
- {
- re->first_char = ch;
- re->options |= PCRE_FIRSTSET;
- }
- else if (is_startline(re->code))
- re->options |= PCRE_STARTLINE;
- }
- }
-
-/* Save the last required character if there are at least two literal
-characters on all paths, or if there is no first character setting. */
-
-if (reqchar >= 0 && (countlits > 1 || (re->options & PCRE_FIRSTSET) == 0))
- {
- re->req_char = reqchar;
- re->options |= PCRE_REQCHSET;
- }
-
-/* Print out the compiled data for debugging */
-
-#ifdef DEBUG
-
-printf("Length = %d top_bracket = %d top_backref = %d\n",
- length, re->top_bracket, re->top_backref);
-
-if (re->options != 0)
- {
- printf("%s%s%s%s%s%s%s%s%s\n",
- ((re->options & PCRE_ANCHORED) != 0)? "anchored " : "",
- ((re->options & PCRE_CASELESS) != 0)? "caseless " : "",
- ((re->options & PCRE_ICHANGED) != 0)? "case state changed " : "",
- ((re->options & PCRE_EXTENDED) != 0)? "extended " : "",
- ((re->options & PCRE_MULTILINE) != 0)? "multiline " : "",
- ((re->options & PCRE_DOTALL) != 0)? "dotall " : "",
- ((re->options & PCRE_DOLLAR_ENDONLY) != 0)? "endonly " : "",
- ((re->options & PCRE_EXTRA) != 0)? "extra " : "",
- ((re->options & PCRE_UNGREEDY) != 0)? "ungreedy " : "");
- }
-
-if ((re->options & PCRE_FIRSTSET) != 0)
- {
- if (isprint(re->first_char)) printf("First char = %c\n", re->first_char);
- else printf("First char = \\x%02x\n", re->first_char);
- }
-
-if ((re->options & PCRE_REQCHSET) != 0)
- {
- if (isprint(re->req_char)) printf("Req char = %c\n", re->req_char);
- else printf("Req char = \\x%02x\n", re->req_char);
- }
-
-code_end = code;
-code_base = code = re->code;
-
-while (code < code_end)
- {
- int charlength;
-
- printf("%3d ", code - code_base);
-
- if (*code >= OP_BRA)
- {
- printf("%3d Bra %d", (code[1] << 8) + code[2], *code - OP_BRA);
- code += 2;
- }
-
- else switch(*code)
- {
- case OP_OPT:
- printf(" %.2x %s", code[1], OP_names[*code]);
- code++;
- break;
-
- case OP_COND:
- printf("%3d Cond", (code[1] << 8) + code[2]);
- code += 2;
- break;
-
- case OP_CREF:
- printf(" %.2d %s", code[1], OP_names[*code]);
- code++;
- break;
-
- case OP_CHARS:
- charlength = *(++code);
- printf("%3d ", charlength);
- while (charlength-- > 0)
- if (isprint(c = *(++code))) printf("%c", c); else printf("\\x%02x", c);
- break;
-
- case OP_KETRMAX:
- case OP_KETRMIN:
- case OP_ALT:
- case OP_KET:
- case OP_ASSERT:
- case OP_ASSERT_NOT:
- case OP_ASSERTBACK:
- case OP_ASSERTBACK_NOT:
- case OP_ONCE:
- printf("%3d %s", (code[1] << 8) + code[2], OP_names[*code]);
- code += 2;
- break;
-
- case OP_REVERSE:
- printf("%3d %s", (code[1] << 8) + code[2], OP_names[*code]);
- code += 2;
- break;
-
- case OP_STAR:
- case OP_MINSTAR:
- case OP_PLUS:
- case OP_MINPLUS:
- case OP_QUERY:
- case OP_MINQUERY:
- case OP_TYPESTAR:
- case OP_TYPEMINSTAR:
- case OP_TYPEPLUS:
- case OP_TYPEMINPLUS:
- case OP_TYPEQUERY:
- case OP_TYPEMINQUERY:
- if (*code >= OP_TYPESTAR)
- printf(" %s", OP_names[code[1]]);
- else if (isprint(c = code[1])) printf(" %c", c);
- else printf(" \\x%02x", c);
- printf("%s", OP_names[*code++]);
- break;
-
- case OP_EXACT:
- case OP_UPTO:
- case OP_MINUPTO:
- if (isprint(c = code[3])) printf(" %c{", c);
- else printf(" \\x%02x{", c);
- if (*code != OP_EXACT) printf("0,");
- printf("%d}", (code[1] << 8) + code[2]);
- if (*code == OP_MINUPTO) printf("?");
- code += 3;
- break;
-
- case OP_TYPEEXACT:
- case OP_TYPEUPTO:
- case OP_TYPEMINUPTO:
- printf(" %s{", OP_names[code[3]]);
- if (*code != OP_TYPEEXACT) printf(",");
- printf("%d}", (code[1] << 8) + code[2]);
- if (*code == OP_TYPEMINUPTO) printf("?");
- code += 3;
- break;
-
- case OP_NOT:
- if (isprint(c = *(++code))) printf(" [^%c]", c);
- else printf(" [^\\x%02x]", c);
- break;
-
- case OP_NOTSTAR:
- case OP_NOTMINSTAR:
- case OP_NOTPLUS:
- case OP_NOTMINPLUS:
- case OP_NOTQUERY:
- case OP_NOTMINQUERY:
- if (isprint(c = code[1])) printf(" [^%c]", c);
- else printf(" [^\\x%02x]", c);
- printf("%s", OP_names[*code++]);
- break;
-
- case OP_NOTEXACT:
- case OP_NOTUPTO:
- case OP_NOTMINUPTO:
- if (isprint(c = code[3])) printf(" [^%c]{", c);
- else printf(" [^\\x%02x]{", c);
- if (*code != OP_NOTEXACT) printf(",");
- printf("%d}", (code[1] << 8) + code[2]);
- if (*code == OP_NOTMINUPTO) printf("?");
- code += 3;
- break;
-
- case OP_REF:
- printf(" \\%d", *(++code));
- code ++;
- goto CLASS_REF_REPEAT;
-
- case OP_CLASS:
- {
- int i, min, max;
- code++;
- printf(" [");
-
- for (i = 0; i < 256; i++)
- {
- if ((code[i/8] & (1 << (i&7))) != 0)
- {
- int j;
- for (j = i+1; j < 256; j++)
- if ((code[j/8] & (1 << (j&7))) == 0) break;
- if (i == '-' || i == ']') printf("\\");
- if (isprint(i)) printf("%c", i); else printf("\\x%02x", i);
- if (--j > i)
- {
- printf("-");
- if (j == '-' || j == ']') printf("\\");
- if (isprint(j)) printf("%c", j); else printf("\\x%02x", j);
- }
- i = j;
- }
- }
- printf("]");
- code += 32;
-
- CLASS_REF_REPEAT:
-
- switch(*code)
- {
- case OP_CRSTAR:
- case OP_CRMINSTAR:
- case OP_CRPLUS:
- case OP_CRMINPLUS:
- case OP_CRQUERY:
- case OP_CRMINQUERY:
- printf("%s", OP_names[*code]);
- break;
-
- case OP_CRRANGE:
- case OP_CRMINRANGE:
- min = (code[1] << 8) + code[2];
- max = (code[3] << 8) + code[4];
- if (max == 0) printf("{%d,}", min);
- else printf("{%d,%d}", min, max);
- if (*code == OP_CRMINRANGE) printf("?");
- code += 4;
- break;
-
- default:
- code--;
- }
- }
- break;
-
- /* Anything else is just a one-node item */
-
- default:
- printf(" %s", OP_names[*code]);
- break;
- }
-
- code++;
- printf("\n");
- }
-printf("------------------------------------------------------------------\n");
-
-/* This check is done here in the debugging case so that the code that
-was compiled can be seen. */
-
-if (code - re->code > length)
- {
- *errorptr = ERR23;
- (pcre_free)(re);
- *erroroffset = ptr - (uschar *)pattern;
- return NULL;
- }
-#endif
-
-return (pcre *)re;
-}
-
-
-
-/*************************************************
-* Match a back-reference *
-*************************************************/
-
-/* If a back reference hasn't been set, the length that is passed is greater
-than the number of characters left in the string, so the match fails.
-
-Arguments:
- offset index into the offset vector
- eptr points into the subject
- length length to be matched
- md points to match data block
- ims the ims flags
-
-Returns: TRUE if matched
-*/
-
-static BOOL
-match_ref(int offset, register const uschar *eptr, int length, match_data *md,
- unsigned long int ims)
-{
-const uschar *p = md->start_subject + md->offset_vector[offset];
-
-#ifdef DEBUG
-if (eptr >= md->end_subject)
- printf("matching subject <null>");
-else
- {
- printf("matching subject ");
- pchars(eptr, length, TRUE, md);
- }
-printf(" against backref ");
-pchars(p, length, FALSE, md);
-printf("\n");
-#endif
-
-/* Always fail if not enough characters left */
-
-if (length > md->end_subject - eptr) return FALSE;
-
-/* Separate the caselesss case for speed */
-
-if ((ims & PCRE_CASELESS) != 0)
- {
- while (length-- > 0)
- if (md->lcc[*p++] != md->lcc[*eptr++]) return FALSE;
- }
-else
- { while (length-- > 0) if (*p++ != *eptr++) return FALSE; }
-
-return TRUE;
-}
-
-
-
-/*************************************************
-* Match from current position *
-*************************************************/
-
-/* On entry ecode points to the first opcode, and eptr to the first character
-in the subject string, while eptrb holds the value of eptr at the start of the
-last bracketed group - used for breaking infinite loops matching zero-length
-strings.
-
-Arguments:
- eptr pointer in subject
- ecode position in code
- offset_top current top pointer
- md pointer to "static" info for the match
- ims current /i, /m, and /s options
- eptrb pointer to chain of blocks containing eptr at start of
- brackets - for testing for empty matches
- flags can contain
- match_condassert - this is an assertion condition
- match_isgroup - this is the start of a bracketed group
-
-Returns: TRUE if matched
-*/
-
-static BOOL
-match(register const uschar *eptr, register const uschar *ecode,
- int offset_top, match_data *md, unsigned long int ims, eptrblock *eptrb,
- int flags)
-{
-unsigned long int original_ims = ims; /* Save for resetting on ')' */
-eptrblock newptrb;
-
-/* At the start of a bracketed group, add the current subject pointer to the
-stack of such pointers, to be re-instated at the end of the group when we hit
-the closing ket. When match() is called in other circumstances, we don't add to
-the stack. */
-
-if ((flags & match_isgroup) != 0)
- {
- newptrb.prev = eptrb;
- newptrb.saved_eptr = eptr;
- eptrb = &newptrb;
- }
-
-/* Now start processing the operations. */
-
-for (;;)
- {
- int op = (int)*ecode;
- int min, max, ctype;
- register int i;
- register int c;
- BOOL minimize = FALSE;
-
- /* Opening capturing bracket. If there is space in the offset vector, save
- the current subject position in the working slot at the top of the vector. We
- mustn't change the current values of the data slot, because they may be set
- from a previous iteration of this group, and be referred to by a reference
- inside the group.
-
- If the bracket fails to match, we need to restore this value and also the
- values of the final offsets, in case they were set by a previous iteration of
- the same bracket.
-
- If there isn't enough space in the offset vector, treat this as if it were a
- non-capturing bracket. Don't worry about setting the flag for the error case
- here; that is handled in the code for KET. */
-
- if (op > OP_BRA)
- {
- int number = op - OP_BRA;
- int offset = number << 1;
-
-#ifdef DEBUG
- printf("start bracket %d subject=", number);
- pchars(eptr, 16, TRUE, md);
- printf("\n");
-#endif
-
- if (offset < md->offset_max)
- {
- int save_offset1 = md->offset_vector[offset];
- int save_offset2 = md->offset_vector[offset+1];
- int save_offset3 = md->offset_vector[md->offset_end - number];
-
- DPRINTF(("saving %d %d %d\n", save_offset1, save_offset2, save_offset3));
- md->offset_vector[md->offset_end - number] = eptr - md->start_subject;
-
- do
- {
- if (match(eptr, ecode+3, offset_top, md, ims, eptrb, match_isgroup))
- return TRUE;
- ecode += (ecode[1] << 8) + ecode[2];
- }
- while (*ecode == OP_ALT);
-
- DPRINTF(("bracket %d failed\n", number));
-
- md->offset_vector[offset] = save_offset1;
- md->offset_vector[offset+1] = save_offset2;
- md->offset_vector[md->offset_end - number] = save_offset3;
- return FALSE;
- }
-
- /* Insufficient room for saving captured contents */
-
- else op = OP_BRA;
- }
-
- /* Other types of node can be handled by a switch */
-
- switch(op)
- {
- case OP_BRA: /* Non-capturing bracket: optimized */
- DPRINTF(("start bracket 0\n"));
- do
- {
- if (match(eptr, ecode+3, offset_top, md, ims, eptrb, match_isgroup))
- return TRUE;
- ecode += (ecode[1] << 8) + ecode[2];
- }
- while (*ecode == OP_ALT);
- DPRINTF(("bracket 0 failed\n"));
- return FALSE;
-
- /* Conditional group: compilation checked that there are no more than
- two branches. If the condition is false, skipping the first branch takes us
- past the end if there is only one branch, but that's OK because that is
- exactly what going to the ket would do. */
-
- case OP_COND:
- if (ecode[3] == OP_CREF) /* Condition is extraction test */
- {
- int offset = ecode[4] << 1; /* Doubled reference number */
- return match(eptr,
- ecode + ((offset < offset_top && md->offset_vector[offset] >= 0)?
- 5 : 3 + (ecode[1] << 8) + ecode[2]),
- offset_top, md, ims, eptrb, match_isgroup);
- }
-
- /* The condition is an assertion. Call match() to evaluate it - setting
- the final argument TRUE causes it to stop at the end of an assertion. */
-
- else
- {
- if (match(eptr, ecode+3, offset_top, md, ims, NULL,
- match_condassert | match_isgroup))
- {
- ecode += 3 + (ecode[4] << 8) + ecode[5];
- while (*ecode == OP_ALT) ecode += (ecode[1] << 8) + ecode[2];
- }
- else ecode += (ecode[1] << 8) + ecode[2];
- return match(eptr, ecode+3, offset_top, md, ims, eptrb, match_isgroup);
- }
- /* Control never reaches here */
-
- /* Skip over conditional reference data if encountered (should not be) */
-
- case OP_CREF:
- ecode += 2;
- break;
-
- /* End of the pattern. If PCRE_NOTEMPTY is set, fail if we have matched
- an empty string - recursion will then try other alternatives, if any. */
-
- case OP_END:
- if (md->notempty && eptr == md->start_match) return FALSE;
- md->end_match_ptr = eptr; /* Record where we ended */
- md->end_offset_top = offset_top; /* and how many extracts were taken */
- return TRUE;
-
- /* Change option settings */
-
- case OP_OPT:
- ims = ecode[1];
- ecode += 2;
- DPRINTF(("ims set to %02lx\n", ims));
- break;
-
- /* Assertion brackets. Check the alternative branches in turn - the
- matching won't pass the KET for an assertion. If any one branch matches,
- the assertion is true. Lookbehind assertions have an OP_REVERSE item at the
- start of each branch to move the current point backwards, so the code at
- this level is identical to the lookahead case. */
-
- case OP_ASSERT:
- case OP_ASSERTBACK:
- do
- {
- if (match(eptr, ecode+3, offset_top, md, ims, NULL, match_isgroup)) break;
- ecode += (ecode[1] << 8) + ecode[2];
- }
- while (*ecode == OP_ALT);
- if (*ecode == OP_KET) return FALSE;
-
- /* If checking an assertion for a condition, return TRUE. */
-
- if ((flags & match_condassert) != 0) return TRUE;
-
- /* Continue from after the assertion, updating the offsets high water
- mark, since extracts may have been taken during the assertion. */
-
- do ecode += (ecode[1] << 8) + ecode[2]; while (*ecode == OP_ALT);
- ecode += 3;
- offset_top = md->end_offset_top;
- continue;
-
- /* Negative assertion: all branches must fail to match */
-
- case OP_ASSERT_NOT:
- case OP_ASSERTBACK_NOT:
- do
- {
- if (match(eptr, ecode+3, offset_top, md, ims, NULL, match_isgroup))
- return FALSE;
- ecode += (ecode[1] << 8) + ecode[2];
- }
- while (*ecode == OP_ALT);
-
- if ((flags & match_condassert) != 0) return TRUE;
-
- ecode += 3;
- continue;
-
- /* Move the subject pointer back. This occurs only at the start of
- each branch of a lookbehind assertion. If we are too close to the start to
- move back, this match function fails. When working with UTF-8 we move
- back a number of characters, not bytes. */
-
- case OP_REVERSE:
-#ifdef SUPPORT_UTF8
- c = (ecode[1] << 8) + ecode[2];
- for (i = 0; i < c; i++)
- {
- eptr--;
- BACKCHAR(eptr)
- }
-#else
- eptr -= (ecode[1] << 8) + ecode[2];
-#endif
-
- if (eptr < md->start_subject) return FALSE;
- ecode += 3;
- break;
-
- /* Recursion matches the current regex, nested. If there are any capturing
- brackets started but not finished, we have to save their starting points
- and reinstate them after the recursion. However, we don't know how many
- such there are (offset_top records the completed total) so we just have
- to save all the potential data. There may be up to 99 such values, which
- is a bit large to put on the stack, but using malloc for small numbers
- seems expensive. As a compromise, the stack is used when there are fewer
- than 16 values to store; otherwise malloc is used. A problem is what to do
- if the malloc fails ... there is no way of returning to the top level with
- an error. Save the top 15 values on the stack, and accept that the rest
- may be wrong. */
-
- case OP_RECURSE:
- {
- BOOL rc;
- int *save;
- int stacksave[15];
-
- c = md->offset_max;
-
- if (c < 16) save = stacksave; else
- {
- save = (int *)(pcre_malloc)((c+1) * sizeof(int));
- if (save == NULL)
- {
- save = stacksave;
- c = 15;
- }
- }
-
- for (i = 1; i <= c; i++)
- save[i] = md->offset_vector[md->offset_end - i];
- rc = match(eptr, md->start_pattern, offset_top, md, ims, eptrb,
- match_isgroup);
- for (i = 1; i <= c; i++)
- md->offset_vector[md->offset_end - i] = save[i];
- if (save != stacksave) (pcre_free)(save);
- if (!rc) return FALSE;
-
- /* In case the recursion has set more capturing values, save the final
- number, then move along the subject till after the recursive match,
- and advance one byte in the pattern code. */
-
- offset_top = md->end_offset_top;
- eptr = md->end_match_ptr;
- ecode++;
- }
- break;
-
- /* "Once" brackets are like assertion brackets except that after a match,
- the point in the subject string is not moved back. Thus there can never be
- a move back into the brackets. Check the alternative branches in turn - the
- matching won't pass the KET for this kind of subpattern. If any one branch
- matches, we carry on as at the end of a normal bracket, leaving the subject
- pointer. */
-
- case OP_ONCE:
- {
- const uschar *prev = ecode;
- const uschar *saved_eptr = eptr;
-
- do
- {
- if (match(eptr, ecode+3, offset_top, md, ims, eptrb, match_isgroup))
- break;
- ecode += (ecode[1] << 8) + ecode[2];
- }
- while (*ecode == OP_ALT);
-
- /* If hit the end of the group (which could be repeated), fail */
-
- if (*ecode != OP_ONCE && *ecode != OP_ALT) return FALSE;
-
- /* Continue as from after the assertion, updating the offsets high water
- mark, since extracts may have been taken. */
-
- do ecode += (ecode[1] << 8) + ecode[2]; while (*ecode == OP_ALT);
-
- offset_top = md->end_offset_top;
- eptr = md->end_match_ptr;
-
- /* For a non-repeating ket, just continue at this level. This also
- happens for a repeating ket if no characters were matched in the group.
- This is the forcible breaking of infinite loops as implemented in Perl
- 5.005. If there is an options reset, it will get obeyed in the normal
- course of events. */
-
- if (*ecode == OP_KET || eptr == saved_eptr)
- {
- ecode += 3;
- break;
- }
-
- /* The repeating kets try the rest of the pattern or restart from the
- preceding bracket, in the appropriate order. We need to reset any options
- that changed within the bracket before re-running it, so check the next
- opcode. */
-
- if (ecode[3] == OP_OPT)
- {
- ims = (ims & ~PCRE_IMS) | ecode[4];
- DPRINTF(("ims set to %02lx at group repeat\n", ims));
- }
-
- if (*ecode == OP_KETRMIN)
- {
- if (match(eptr, ecode+3, offset_top, md, ims, eptrb, 0) ||
- match(eptr, prev, offset_top, md, ims, eptrb, match_isgroup))
- return TRUE;
- }
- else /* OP_KETRMAX */
- {
- if (match(eptr, prev, offset_top, md, ims, eptrb, match_isgroup) ||
- match(eptr, ecode+3, offset_top, md, ims, eptrb, 0)) return TRUE;
- }
- }
- return FALSE;
-
- /* An alternation is the end of a branch; scan along to find the end of the
- bracketed group and go to there. */
-
- case OP_ALT:
- do ecode += (ecode[1] << 8) + ecode[2]; while (*ecode == OP_ALT);
- break;
-
- /* BRAZERO and BRAMINZERO occur just before a bracket group, indicating
- that it may occur zero times. It may repeat infinitely, or not at all -
- i.e. it could be ()* or ()? in the pattern. Brackets with fixed upper
- repeat limits are compiled as a number of copies, with the optional ones
- preceded by BRAZERO or BRAMINZERO. */
-
- case OP_BRAZERO:
- {
- const uschar *next = ecode+1;
- if (match(eptr, next, offset_top, md, ims, eptrb, match_isgroup))
- return TRUE;
- do next += (next[1] << 8) + next[2]; while (*next == OP_ALT);
- ecode = next + 3;
- }
- break;
-
- case OP_BRAMINZERO:
- {
- const uschar *next = ecode+1;
- do next += (next[1] << 8) + next[2]; while (*next == OP_ALT);
- if (match(eptr, next+3, offset_top, md, ims, eptrb, match_isgroup))
- return TRUE;
- ecode++;
- }
- break;
-
- /* End of a group, repeated or non-repeating. If we are at the end of
- an assertion "group", stop matching and return TRUE, but record the
- current high water mark for use by positive assertions. Do this also
- for the "once" (not-backup up) groups. */
-
- case OP_KET:
- case OP_KETRMIN:
- case OP_KETRMAX:
- {
- const uschar *prev = ecode - (ecode[1] << 8) - ecode[2];
- const uschar *saved_eptr = eptrb->saved_eptr;
-
- eptrb = eptrb->prev; /* Back up the stack of bracket start pointers */
-
- if (*prev == OP_ASSERT || *prev == OP_ASSERT_NOT ||
- *prev == OP_ASSERTBACK || *prev == OP_ASSERTBACK_NOT ||
- *prev == OP_ONCE)
- {
- md->end_match_ptr = eptr; /* For ONCE */
- md->end_offset_top = offset_top;
- return TRUE;
- }
-
- /* In all other cases except a conditional group we have to check the
- group number back at the start and if necessary complete handling an
- extraction by setting the offsets and bumping the high water mark. */
-
- if (*prev != OP_COND)
- {
- int number = *prev - OP_BRA;
- int offset = number << 1;
-
-#ifdef DEBUG
- printf("end bracket %d", number);
- printf("\n");
-#endif
-
- if (number > 0)
- {
- if (offset >= md->offset_max) md->offset_overflow = TRUE; else
- {
- md->offset_vector[offset] =
- md->offset_vector[md->offset_end - number];
- md->offset_vector[offset+1] = eptr - md->start_subject;
- if (offset_top <= offset) offset_top = offset + 2;
- }
- }
- }
-
- /* Reset the value of the ims flags, in case they got changed during
- the group. */
-
- ims = original_ims;
- DPRINTF(("ims reset to %02lx\n", ims));
-
- /* For a non-repeating ket, just continue at this level. This also
- happens for a repeating ket if no characters were matched in the group.
- This is the forcible breaking of infinite loops as implemented in Perl
- 5.005. If there is an options reset, it will get obeyed in the normal
- course of events. */
-
- if (*ecode == OP_KET || eptr == saved_eptr)
- {
- ecode += 3;
- break;
- }
-
- /* The repeating kets try the rest of the pattern or restart from the
- preceding bracket, in the appropriate order. */
-
- if (*ecode == OP_KETRMIN)
- {
- if (match(eptr, ecode+3, offset_top, md, ims, eptrb, 0) ||
- match(eptr, prev, offset_top, md, ims, eptrb, match_isgroup))
- return TRUE;
- }
- else /* OP_KETRMAX */
- {
- if (match(eptr, prev, offset_top, md, ims, eptrb, match_isgroup) ||
- match(eptr, ecode+3, offset_top, md, ims, eptrb, 0)) return TRUE;
- }
- }
- return FALSE;
-
- /* Start of subject unless notbol, or after internal newline if multiline */
-
- case OP_CIRC:
- if (md->notbol && eptr == md->start_subject) return FALSE;
- if ((ims & PCRE_MULTILINE) != 0)
- {
- if (eptr != md->start_subject && eptr[-1] != '\n') return FALSE;
- ecode++;
- break;
- }
- /* ... else fall through */
-
- /* Start of subject assertion */
-
- case OP_SOD:
- if (eptr != md->start_subject) return FALSE;
- ecode++;
- break;
-
- /* Assert before internal newline if multiline, or before a terminating
- newline unless endonly is set, else end of subject unless noteol is set. */
-
- case OP_DOLL:
- if ((ims & PCRE_MULTILINE) != 0)
- {
- if (eptr < md->end_subject) { if (*eptr != '\n') return FALSE; }
- else { if (md->noteol) return FALSE; }
- ecode++;
- break;
- }
- else
- {
- if (md->noteol) return FALSE;
- if (!md->endonly)
- {
- if (eptr < md->end_subject - 1 ||
- (eptr == md->end_subject - 1 && *eptr != '\n')) return FALSE;
-
- ecode++;
- break;
- }
- }
- /* ... else fall through */
-
- /* End of subject assertion (\z) */
-
- case OP_EOD:
- if (eptr < md->end_subject) return FALSE;
- ecode++;
- break;
-
- /* End of subject or ending \n assertion (\Z) */
-
- case OP_EODN:
- if (eptr < md->end_subject - 1 ||
- (eptr == md->end_subject - 1 && *eptr != '\n')) return FALSE;
- ecode++;
- break;
-
- /* Word boundary assertions */
-
- case OP_NOT_WORD_BOUNDARY:
- case OP_WORD_BOUNDARY:
- {
- BOOL prev_is_word = (eptr != md->start_subject) &&
- ((md->ctypes[eptr[-1]] & ctype_word) != 0);
- BOOL cur_is_word = (eptr < md->end_subject) &&
- ((md->ctypes[*eptr] & ctype_word) != 0);
- if ((*ecode++ == OP_WORD_BOUNDARY)?
- cur_is_word == prev_is_word : cur_is_word != prev_is_word)
- return FALSE;
- }
- break;
-
- /* Match a single character type; inline for speed */
-
- case OP_ANY:
- if ((ims & PCRE_DOTALL) == 0 && eptr < md->end_subject && *eptr == '\n')
- return FALSE;
- if (eptr++ >= md->end_subject) return FALSE;
-#ifdef SUPPORT_UTF8
- if (md->utf8)
- while (eptr < md->end_subject && (*eptr & 0xc0) == 0x80) eptr++;
-#endif
- ecode++;
- break;
-
- case OP_NOT_DIGIT:
- if (eptr >= md->end_subject ||
- (md->ctypes[*eptr++] & ctype_digit) != 0)
- return FALSE;
- ecode++;
- break;
-
- case OP_DIGIT:
- if (eptr >= md->end_subject ||
- (md->ctypes[*eptr++] & ctype_digit) == 0)
- return FALSE;
- ecode++;
- break;
-
- case OP_NOT_WHITESPACE:
- if (eptr >= md->end_subject ||
- (md->ctypes[*eptr++] & ctype_space) != 0)
- return FALSE;
- ecode++;
- break;
-
- case OP_WHITESPACE:
- if (eptr >= md->end_subject ||
- (md->ctypes[*eptr++] & ctype_space) == 0)
- return FALSE;
- ecode++;
- break;
-
- case OP_NOT_WORDCHAR:
- if (eptr >= md->end_subject ||
- (md->ctypes[*eptr++] & ctype_word) != 0)
- return FALSE;
- ecode++;
- break;
-
- case OP_WORDCHAR:
- if (eptr >= md->end_subject ||
- (md->ctypes[*eptr++] & ctype_word) == 0)
- return FALSE;
- ecode++;
- break;
-
- /* Match a back reference, possibly repeatedly. Look past the end of the
- item to see if there is repeat information following. The code is similar
- to that for character classes, but repeated for efficiency. Then obey
- similar code to character type repeats - written out again for speed.
- However, if the referenced string is the empty string, always treat
- it as matched, any number of times (otherwise there could be infinite
- loops). */
-
- case OP_REF:
- {
- int length;
- int offset = ecode[1] << 1; /* Doubled reference number */
- ecode += 2; /* Advance past the item */
-
- /* If the reference is unset, set the length to be longer than the amount
- of subject left; this ensures that every attempt at a match fails. We
- can't just fail here, because of the possibility of quantifiers with zero
- minima. */
-
- length = (offset >= offset_top || md->offset_vector[offset] < 0)?
- md->end_subject - eptr + 1 :
- md->offset_vector[offset+1] - md->offset_vector[offset];
-
- /* Set up for repetition, or handle the non-repeated case */
-
- switch (*ecode)
- {
- case OP_CRSTAR:
- case OP_CRMINSTAR:
- case OP_CRPLUS:
- case OP_CRMINPLUS:
- case OP_CRQUERY:
- case OP_CRMINQUERY:
- c = *ecode++ - OP_CRSTAR;
- minimize = (c & 1) != 0;
- min = rep_min[c]; /* Pick up values from tables; */
- max = rep_max[c]; /* zero for max => infinity */
- if (max == 0) max = INT_MAX;
- break;
-
- case OP_CRRANGE:
- case OP_CRMINRANGE:
- minimize = (*ecode == OP_CRMINRANGE);
- min = (ecode[1] << 8) + ecode[2];
- max = (ecode[3] << 8) + ecode[4];
- if (max == 0) max = INT_MAX;
- ecode += 5;
- break;
-
- default: /* No repeat follows */
- if (!match_ref(offset, eptr, length, md, ims)) return FALSE;
- eptr += length;
- continue; /* With the main loop */
- }
-
- /* If the length of the reference is zero, just continue with the
- main loop. */
-
- if (length == 0) continue;
-
- /* First, ensure the minimum number of matches are present. We get back
- the length of the reference string explicitly rather than passing the
- address of eptr, so that eptr can be a register variable. */
-
- for (i = 1; i <= min; i++)
- {
- if (!match_ref(offset, eptr, length, md, ims)) return FALSE;
- eptr += length;
- }
-
- /* If min = max, continue at the same level without recursion.
- They are not both allowed to be zero. */
-
- if (min == max) continue;
-
- /* If minimizing, keep trying and advancing the pointer */
-
- if (minimize)
- {
- for (i = min;; i++)
- {
- if (match(eptr, ecode, offset_top, md, ims, eptrb, 0))
- return TRUE;
- if (i >= max || !match_ref(offset, eptr, length, md, ims))
- return FALSE;
- eptr += length;
- }
- /* Control never gets here */
- }
-
- /* If maximizing, find the longest string and work backwards */
-
- else
- {
- const uschar *pp = eptr;
- for (i = min; i < max; i++)
- {
- if (!match_ref(offset, eptr, length, md, ims)) break;
- eptr += length;
- }
- while (eptr >= pp)
- {
- if (match(eptr, ecode, offset_top, md, ims, eptrb, 0))
- return TRUE;
- eptr -= length;
- }
- return FALSE;
- }
- }
- /* Control never gets here */
-
-
-
- /* Match a character class, possibly repeatedly. Look past the end of the
- item to see if there is repeat information following. Then obey similar
- code to character type repeats - written out again for speed. */
-
- case OP_CLASS:
- {
- const uschar *data = ecode + 1; /* Save for matching */
- ecode += 33; /* Advance past the item */
-
- switch (*ecode)
- {
- case OP_CRSTAR:
- case OP_CRMINSTAR:
- case OP_CRPLUS:
- case OP_CRMINPLUS:
- case OP_CRQUERY:
- case OP_CRMINQUERY:
- c = *ecode++ - OP_CRSTAR;
- minimize = (c & 1) != 0;
- min = rep_min[c]; /* Pick up values from tables; */
- max = rep_max[c]; /* zero for max => infinity */
- if (max == 0) max = INT_MAX;
- break;
-
- case OP_CRRANGE:
- case OP_CRMINRANGE:
- minimize = (*ecode == OP_CRMINRANGE);
- min = (ecode[1] << 8) + ecode[2];
- max = (ecode[3] << 8) + ecode[4];
- if (max == 0) max = INT_MAX;
- ecode += 5;
- break;
-
- default: /* No repeat follows */
- min = max = 1;
- break;
- }
-
- /* First, ensure the minimum number of matches are present. */
-
- for (i = 1; i <= min; i++)
- {
- if (eptr >= md->end_subject) return FALSE;
- GETCHARINC(c, eptr) /* Get character; increment eptr */
-
-#ifdef SUPPORT_UTF8
- /* We do not yet support class members > 255 */
- if (c > 255) return FALSE;
-#endif
-
- if ((data[c/8] & (1 << (c&7))) != 0) continue;
- return FALSE;
- }
-
- /* If max == min we can continue with the main loop without the
- need to recurse. */
-
- if (min == max) continue;
-
- /* If minimizing, keep testing the rest of the expression and advancing
- the pointer while it matches the class. */
-
- if (minimize)
- {
- for (i = min;; i++)
- {
- if (match(eptr, ecode, offset_top, md, ims, eptrb, 0))
- return TRUE;
- if (i >= max || eptr >= md->end_subject) return FALSE;
- GETCHARINC(c, eptr) /* Get character; increment eptr */
-
-#ifdef SUPPORT_UTF8
- /* We do not yet support class members > 255 */
- if (c > 255) return FALSE;
-#endif
- if ((data[c/8] & (1 << (c&7))) != 0) continue;
- return FALSE;
- }
- /* Control never gets here */
- }
-
- /* If maximizing, find the longest possible run, then work backwards. */
-
- else
- {
- const uschar *pp = eptr;
- int len = 1;
- for (i = min; i < max; i++)
- {
- if (eptr >= md->end_subject) break;
- GETCHARLEN(c, eptr, len) /* Get character, set length if UTF-8 */
-
-#ifdef SUPPORT_UTF8
- /* We do not yet support class members > 255 */
- if (c > 255) break;
-#endif
- if ((data[c/8] & (1 << (c&7))) == 0) break;
- eptr += len;
- }
-
- while (eptr >= pp)
- {
- if (match(eptr--, ecode, offset_top, md, ims, eptrb, 0))
- return TRUE;
-
-#ifdef SUPPORT_UTF8
- BACKCHAR(eptr)
-#endif
- }
- return FALSE;
- }
- }
- /* Control never gets here */
-
- /* Match a run of characters */
-
- case OP_CHARS:
- {
- register int length = ecode[1];
- ecode += 2;
-
-#ifdef DEBUG /* Sigh. Some compilers never learn. */
- if (eptr >= md->end_subject)
- printf("matching subject <null> against pattern ");
- else
- {
- printf("matching subject ");
- pchars(eptr, length, TRUE, md);
- printf(" against pattern ");
- }
- pchars(ecode, length, FALSE, md);
- printf("\n");
-#endif
-
- if (length > md->end_subject - eptr) return FALSE;
- if ((ims & PCRE_CASELESS) != 0)
- {
- while (length-- > 0)
- if (md->lcc[*ecode++] != md->lcc[*eptr++])
- return FALSE;
- }
- else
- {
- while (length-- > 0) if (*ecode++ != *eptr++) return FALSE;
- }
- }
- break;
-
- /* Match a single character repeatedly; different opcodes share code. */
-
- case OP_EXACT:
- min = max = (ecode[1] << 8) + ecode[2];
- ecode += 3;
- goto REPEATCHAR;
-
- case OP_UPTO:
- case OP_MINUPTO:
- min = 0;
- max = (ecode[1] << 8) + ecode[2];
- minimize = *ecode == OP_MINUPTO;
- ecode += 3;
- goto REPEATCHAR;
-
- case OP_STAR:
- case OP_MINSTAR:
- case OP_PLUS:
- case OP_MINPLUS:
- case OP_QUERY:
- case OP_MINQUERY:
- c = *ecode++ - OP_STAR;
- minimize = (c & 1) != 0;
- min = rep_min[c]; /* Pick up values from tables; */
- max = rep_max[c]; /* zero for max => infinity */
- if (max == 0) max = INT_MAX;
-
- /* Common code for all repeated single-character matches. We can give
- up quickly if there are fewer than the minimum number of characters left in
- the subject. */
-
- REPEATCHAR:
- if (min > md->end_subject - eptr) return FALSE;
- c = *ecode++;
-
- /* The code is duplicated for the caseless and caseful cases, for speed,
- since matching characters is likely to be quite common. First, ensure the
- minimum number of matches are present. If min = max, continue at the same
- level without recursing. Otherwise, if minimizing, keep trying the rest of
- the expression and advancing one matching character if failing, up to the
- maximum. Alternatively, if maximizing, find the maximum number of
- characters and work backwards. */
-
- DPRINTF(("matching %c{%d,%d} against subject %.*s\n", c, min, max,
- max, eptr));
-
- if ((ims & PCRE_CASELESS) != 0)
- {
- c = md->lcc[c];
- for (i = 1; i <= min; i++)
- if (c != md->lcc[*eptr++]) return FALSE;
- if (min == max) continue;
- if (minimize)
- {
- for (i = min;; i++)
- {
- if (match(eptr, ecode, offset_top, md, ims, eptrb, 0))
- return TRUE;
- if (i >= max || eptr >= md->end_subject ||
- c != md->lcc[*eptr++])
- return FALSE;
- }
- /* Control never gets here */
- }
- else
- {
- const uschar *pp = eptr;
- for (i = min; i < max; i++)
- {
- if (eptr >= md->end_subject || c != md->lcc[*eptr]) break;
- eptr++;
- }
- while (eptr >= pp)
- if (match(eptr--, ecode, offset_top, md, ims, eptrb, 0))
- return TRUE;
- return FALSE;
- }
- /* Control never gets here */
- }
-
- /* Caseful comparisons */
-
- else
- {
- for (i = 1; i <= min; i++) if (c != *eptr++) return FALSE;
- if (min == max) continue;
- if (minimize)
- {
- for (i = min;; i++)
- {
- if (match(eptr, ecode, offset_top, md, ims, eptrb, 0))
- return TRUE;
- if (i >= max || eptr >= md->end_subject || c != *eptr++) return FALSE;
- }
- /* Control never gets here */
- }
- else
- {
- const uschar *pp = eptr;
- for (i = min; i < max; i++)
- {
- if (eptr >= md->end_subject || c != *eptr) break;
- eptr++;
- }
- while (eptr >= pp)
- if (match(eptr--, ecode, offset_top, md, ims, eptrb, 0))
- return TRUE;
- return FALSE;
- }
- }
- /* Control never gets here */
-
- /* Match a negated single character */
-
- case OP_NOT:
- if (eptr >= md->end_subject) return FALSE;
- ecode++;
- if ((ims & PCRE_CASELESS) != 0)
- {
- if (md->lcc[*ecode++] == md->lcc[*eptr++]) return FALSE;
- }
- else
- {
- if (*ecode++ == *eptr++) return FALSE;
- }
- break;
-
- /* Match a negated single character repeatedly. This is almost a repeat of
- the code for a repeated single character, but I haven't found a nice way of
- commoning these up that doesn't require a test of the positive/negative
- option for each character match. Maybe that wouldn't add very much to the
- time taken, but character matching *is* what this is all about... */
-
- case OP_NOTEXACT:
- min = max = (ecode[1] << 8) + ecode[2];
- ecode += 3;
- goto REPEATNOTCHAR;
-
- case OP_NOTUPTO:
- case OP_NOTMINUPTO:
- min = 0;
- max = (ecode[1] << 8) + ecode[2];
- minimize = *ecode == OP_NOTMINUPTO;
- ecode += 3;
- goto REPEATNOTCHAR;
-
- case OP_NOTSTAR:
- case OP_NOTMINSTAR:
- case OP_NOTPLUS:
- case OP_NOTMINPLUS:
- case OP_NOTQUERY:
- case OP_NOTMINQUERY:
- c = *ecode++ - OP_NOTSTAR;
- minimize = (c & 1) != 0;
- min = rep_min[c]; /* Pick up values from tables; */
- max = rep_max[c]; /* zero for max => infinity */
- if (max == 0) max = INT_MAX;
-
- /* Common code for all repeated single-character matches. We can give
- up quickly if there are fewer than the minimum number of characters left in
- the subject. */
-
- REPEATNOTCHAR:
- if (min > md->end_subject - eptr) return FALSE;
- c = *ecode++;
-
- /* The code is duplicated for the caseless and caseful cases, for speed,
- since matching characters is likely to be quite common. First, ensure the
- minimum number of matches are present. If min = max, continue at the same
- level without recursing. Otherwise, if minimizing, keep trying the rest of
- the expression and advancing one matching character if failing, up to the
- maximum. Alternatively, if maximizing, find the maximum number of
- characters and work backwards. */
-
- DPRINTF(("negative matching %c{%d,%d} against subject %.*s\n", c, min, max,
- max, eptr));
-
- if ((ims & PCRE_CASELESS) != 0)
- {
- c = md->lcc[c];
- for (i = 1; i <= min; i++)
- if (c == md->lcc[*eptr++]) return FALSE;
- if (min == max) continue;
- if (minimize)
- {
- for (i = min;; i++)
- {
- if (match(eptr, ecode, offset_top, md, ims, eptrb, 0))
- return TRUE;
- if (i >= max || eptr >= md->end_subject ||
- c == md->lcc[*eptr++])
- return FALSE;
- }
- /* Control never gets here */
- }
- else
- {
- const uschar *pp = eptr;
- for (i = min; i < max; i++)
- {
- if (eptr >= md->end_subject || c == md->lcc[*eptr]) break;
- eptr++;
- }
- while (eptr >= pp)
- if (match(eptr--, ecode, offset_top, md, ims, eptrb, 0))
- return TRUE;
- return FALSE;
- }
- /* Control never gets here */
- }
-
- /* Caseful comparisons */
-
- else
- {
- for (i = 1; i <= min; i++) if (c == *eptr++) return FALSE;
- if (min == max) continue;
- if (minimize)
- {
- for (i = min;; i++)
- {
- if (match(eptr, ecode, offset_top, md, ims, eptrb, 0))
- return TRUE;
- if (i >= max || eptr >= md->end_subject || c == *eptr++) return FALSE;
- }
- /* Control never gets here */
- }
- else
- {
- const uschar *pp = eptr;
- for (i = min; i < max; i++)
- {
- if (eptr >= md->end_subject || c == *eptr) break;
- eptr++;
- }
- while (eptr >= pp)
- if (match(eptr--, ecode, offset_top, md, ims, eptrb, 0))
- return TRUE;
- return FALSE;
- }
- }
- /* Control never gets here */
-
- /* Match a single character type repeatedly; several different opcodes
- share code. This is very similar to the code for single characters, but we
- repeat it in the interests of efficiency. */
-
- case OP_TYPEEXACT:
- min = max = (ecode[1] << 8) + ecode[2];
- minimize = TRUE;
- ecode += 3;
- goto REPEATTYPE;
-
- case OP_TYPEUPTO:
- case OP_TYPEMINUPTO:
- min = 0;
- max = (ecode[1] << 8) + ecode[2];
- minimize = *ecode == OP_TYPEMINUPTO;
- ecode += 3;
- goto REPEATTYPE;
-
- case OP_TYPESTAR:
- case OP_TYPEMINSTAR:
- case OP_TYPEPLUS:
- case OP_TYPEMINPLUS:
- case OP_TYPEQUERY:
- case OP_TYPEMINQUERY:
- c = *ecode++ - OP_TYPESTAR;
- minimize = (c & 1) != 0;
- min = rep_min[c]; /* Pick up values from tables; */
- max = rep_max[c]; /* zero for max => infinity */
- if (max == 0) max = INT_MAX;
-
- /* Common code for all repeated single character type matches */
-
- REPEATTYPE:
- ctype = *ecode++; /* Code for the character type */
-
- /* First, ensure the minimum number of matches are present. Use inline
- code for maximizing the speed, and do the type test once at the start
- (i.e. keep it out of the loop). Also we can test that there are at least
- the minimum number of bytes before we start, except when doing '.' in
- UTF8 mode. Leave the test in in all cases; in the special case we have
- to test after each character. */
-
- if (min > md->end_subject - eptr) return FALSE;
- if (min > 0) switch(ctype)
- {
- case OP_ANY:
-#ifdef SUPPORT_UTF8
- if (md->utf8)
- {
- for (i = 1; i <= min; i++)
- {
- if (eptr >= md->end_subject ||
- (*eptr++ == '\n' && (ims & PCRE_DOTALL) == 0))
- return FALSE;
- while (eptr < md->end_subject && (*eptr & 0xc0) == 0x80) eptr++;
- }
- break;
- }
-#endif
- /* Non-UTF8 can be faster */
- if ((ims & PCRE_DOTALL) == 0)
- { for (i = 1; i <= min; i++) if (*eptr++ == '\n') return FALSE; }
- else eptr += min;
- break;
-
- case OP_NOT_DIGIT:
- for (i = 1; i <= min; i++)
- if ((md->ctypes[*eptr++] & ctype_digit) != 0) return FALSE;
- break;
-
- case OP_DIGIT:
- for (i = 1; i <= min; i++)
- if ((md->ctypes[*eptr++] & ctype_digit) == 0) return FALSE;
- break;
-
- case OP_NOT_WHITESPACE:
- for (i = 1; i <= min; i++)
- if ((md->ctypes[*eptr++] & ctype_space) != 0) return FALSE;
- break;
-
- case OP_WHITESPACE:
- for (i = 1; i <= min; i++)
- if ((md->ctypes[*eptr++] & ctype_space) == 0) return FALSE;
- break;
-
- case OP_NOT_WORDCHAR:
- for (i = 1; i <= min; i++)
- if ((md->ctypes[*eptr++] & ctype_word) != 0)
- return FALSE;
- break;
-
- case OP_WORDCHAR:
- for (i = 1; i <= min; i++)
- if ((md->ctypes[*eptr++] & ctype_word) == 0)
- return FALSE;
- break;
- }
-
- /* If min = max, continue at the same level without recursing */
-
- if (min == max) continue;
-
- /* If minimizing, we have to test the rest of the pattern before each
- subsequent match. */
-
- if (minimize)
- {
- for (i = min;; i++)
- {
- if (match(eptr, ecode, offset_top, md, ims, eptrb, 0)) return TRUE;
- if (i >= max || eptr >= md->end_subject) return FALSE;
-
- c = *eptr++;
- switch(ctype)
- {
- case OP_ANY:
- if ((ims & PCRE_DOTALL) == 0 && c == '\n') return FALSE;
-#ifdef SUPPORT_UTF8
- if (md->utf8)
- while (eptr < md->end_subject && (*eptr & 0xc0) == 0x80) eptr++;
-#endif
- break;
-
- case OP_NOT_DIGIT:
- if ((md->ctypes[c] & ctype_digit) != 0) return FALSE;
- break;
-
- case OP_DIGIT:
- if ((md->ctypes[c] & ctype_digit) == 0) return FALSE;
- break;
-
- case OP_NOT_WHITESPACE:
- if ((md->ctypes[c] & ctype_space) != 0) return FALSE;
- break;
-
- case OP_WHITESPACE:
- if ((md->ctypes[c] & ctype_space) == 0) return FALSE;
- break;
-
- case OP_NOT_WORDCHAR:
- if ((md->ctypes[c] & ctype_word) != 0) return FALSE;
- break;
-
- case OP_WORDCHAR:
- if ((md->ctypes[c] & ctype_word) == 0) return FALSE;
- break;
- }
- }
- /* Control never gets here */
- }
-
- /* If maximizing it is worth using inline code for speed, doing the type
- test once at the start (i.e. keep it out of the loop). */
-
- else
- {
- const uschar *pp = eptr;
- switch(ctype)
- {
- case OP_ANY:
-
- /* Special code is required for UTF8, but when the maximum is unlimited
- we don't need it. */
-
-#ifdef SUPPORT_UTF8
- if (md->utf8 && max < INT_MAX)
- {
- if ((ims & PCRE_DOTALL) == 0)
- {
- for (i = min; i < max; i++)
- {
- if (eptr >= md->end_subject || *eptr++ == '\n') break;
- while (eptr < md->end_subject && (*eptr & 0xc0) == 0x80) eptr++;
- }
- }
- else
- {
- for (i = min; i < max; i++)
- {
- eptr++;
- while (eptr < md->end_subject && (*eptr & 0xc0) == 0x80) eptr++;
- }
- }
- break;
- }
-#endif
- /* Non-UTF8 can be faster */
- if ((ims & PCRE_DOTALL) == 0)
- {
- for (i = min; i < max; i++)
- {
- if (eptr >= md->end_subject || *eptr == '\n') break;
- eptr++;
- }
- }
- else
- {
- c = max - min;
- if (c > md->end_subject - eptr) c = md->end_subject - eptr;
- eptr += c;
- }
- break;
-
- case OP_NOT_DIGIT:
- for (i = min; i < max; i++)
- {
- if (eptr >= md->end_subject || (md->ctypes[*eptr] & ctype_digit) != 0)
- break;
- eptr++;
- }
- break;
-
- case OP_DIGIT:
- for (i = min; i < max; i++)
- {
- if (eptr >= md->end_subject || (md->ctypes[*eptr] & ctype_digit) == 0)
- break;
- eptr++;
- }
- break;
-
- case OP_NOT_WHITESPACE:
- for (i = min; i < max; i++)
- {
- if (eptr >= md->end_subject || (md->ctypes[*eptr] & ctype_space) != 0)
- break;
- eptr++;
- }
- break;
-
- case OP_WHITESPACE:
- for (i = min; i < max; i++)
- {
- if (eptr >= md->end_subject || (md->ctypes[*eptr] & ctype_space) == 0)
- break;
- eptr++;
- }
- break;
-
- case OP_NOT_WORDCHAR:
- for (i = min; i < max; i++)
- {
- if (eptr >= md->end_subject || (md->ctypes[*eptr] & ctype_word) != 0)
- break;
- eptr++;
- }
- break;
-
- case OP_WORDCHAR:
- for (i = min; i < max; i++)
- {
- if (eptr >= md->end_subject || (md->ctypes[*eptr] & ctype_word) == 0)
- break;
- eptr++;
- }
- break;
- }
-
- while (eptr >= pp)
- {
- if (match(eptr--, ecode, offset_top, md, ims, eptrb, 0))
- return TRUE;
-#ifdef SUPPORT_UTF8
- if (md->utf8)
- while (eptr > pp && (*eptr & 0xc0) == 0x80) eptr--;
-#endif
- }
- return FALSE;
- }
- /* Control never gets here */
-
- /* There's been some horrible disaster. */
-
- default:
- DPRINTF(("Unknown opcode %d\n", *ecode));
- md->errorcode = PCRE_ERROR_UNKNOWN_NODE;
- return FALSE;
- }
-
- /* Do not stick any code in here without much thought; it is assumed
- that "continue" in the code above comes out to here to repeat the main
- loop. */
-
- } /* End of main loop */
-/* Control never reaches here */
-}
-
-
-
-
-/*************************************************
-* Execute a Regular Expression *
-*************************************************/
-
-/* This function applies a compiled re to a subject string and picks out
-portions of the string if it matches. Two elements in the vector are set for
-each substring: the offsets to the start and end of the substring.
-
-Arguments:
- external_re points to the compiled expression
- external_extra points to "hints" from pcre_study() or is NULL
- subject points to the subject string
- length length of subject string (may contain binary zeros)
- start_offset where to start in the subject string
- options option bits
- offsets points to a vector of ints to be filled in with offsets
- offsetcount the number of elements in the vector
-
-Returns: > 0 => success; value is the number of elements filled in
- = 0 => success, but offsets is not big enough
- -1 => failed to match
- < -1 => some kind of unexpected problem
-*/
-
-int
-pcre_exec(const pcre *external_re, const pcre_extra *external_extra,
- const char *subject, int length, int start_offset, int options, int *offsets,
- int offsetcount)
-{
-int resetcount, ocount;
-int first_char = -1;
-int req_char = -1;
-int req_char2 = -1;
-unsigned long int ims = 0;
-match_data match_block;
-const uschar *start_bits = NULL;
-const uschar *start_match = (const uschar *)subject + start_offset;
-const uschar *end_subject;
-const uschar *req_char_ptr = start_match - 1;
-const real_pcre *re = (const real_pcre *)external_re;
-const real_pcre_extra *extra = (const real_pcre_extra *)external_extra;
-BOOL using_temporary_offsets = FALSE;
-BOOL anchored = ((re->options | options) & PCRE_ANCHORED) != 0;
-BOOL startline = (re->options & PCRE_STARTLINE) != 0;
-
-if ((options & ~PUBLIC_EXEC_OPTIONS) != 0) return PCRE_ERROR_BADOPTION;
-
-if (re == NULL || subject == NULL ||
- (offsets == NULL && offsetcount > 0)) return PCRE_ERROR_NULL;
-if (re->magic_number != MAGIC_NUMBER) return PCRE_ERROR_BADMAGIC;
-
-match_block.start_pattern = re->code;
-match_block.start_subject = (const uschar *)subject;
-match_block.end_subject = match_block.start_subject + length;
-end_subject = match_block.end_subject;
-
-match_block.endonly = (re->options & PCRE_DOLLAR_ENDONLY) != 0;
-match_block.utf8 = (re->options & PCRE_UTF8) != 0;
-
-match_block.notbol = (options & PCRE_NOTBOL) != 0;
-match_block.noteol = (options & PCRE_NOTEOL) != 0;
-match_block.notempty = (options & PCRE_NOTEMPTY) != 0;
-
-match_block.errorcode = PCRE_ERROR_NOMATCH; /* Default error */
-
-match_block.lcc = re->tables + lcc_offset;
-match_block.ctypes = re->tables + ctypes_offset;
-
-/* The ims options can vary during the matching as a result of the presence
-of (?ims) items in the pattern. They are kept in a local variable so that
-restoring at the exit of a group is easy. */
-
-ims = re->options & (PCRE_CASELESS|PCRE_MULTILINE|PCRE_DOTALL);
-
-/* If the expression has got more back references than the offsets supplied can
-hold, we get a temporary bit of working store to use during the matching.
-Otherwise, we can use the vector supplied, rounding down its size to a multiple
-of 3. */
-
-ocount = offsetcount - (offsetcount % 3);
-
-if (re->top_backref > 0 && re->top_backref >= ocount/3)
- {
- ocount = re->top_backref * 3 + 3;
- match_block.offset_vector = (int *)(pcre_malloc)(ocount * sizeof(int));
- if (match_block.offset_vector == NULL) return PCRE_ERROR_NOMEMORY;
- using_temporary_offsets = TRUE;
- DPRINTF(("Got memory to hold back references\n"));
- }
-else match_block.offset_vector = offsets;
-
-match_block.offset_end = ocount;
-match_block.offset_max = (2*ocount)/3;
-match_block.offset_overflow = FALSE;
-
-/* Compute the minimum number of offsets that we need to reset each time. Doing
-this makes a huge difference to execution time when there aren't many brackets
-in the pattern. */
-
-resetcount = 2 + re->top_bracket * 2;
-if (resetcount > offsetcount) resetcount = ocount;
-
-/* Reset the working variable associated with each extraction. These should
-never be used unless previously set, but they get saved and restored, and so we
-initialize them to avoid reading uninitialized locations. */
-
-if (match_block.offset_vector != NULL)
- {
- register int *iptr = match_block.offset_vector + ocount;
- register int *iend = iptr - resetcount/2 + 1;
- while (--iptr >= iend) *iptr = -1;
- }
-
-/* Set up the first character to match, if available. The first_char value is
-never set for an anchored regular expression, but the anchoring may be forced
-at run time, so we have to test for anchoring. The first char may be unset for
-an unanchored pattern, of course. If there's no first char and the pattern was
-studied, there may be a bitmap of possible first characters. */
-
-if (!anchored)
- {
- if ((re->options & PCRE_FIRSTSET) != 0)
- {
- first_char = re->first_char;
- if ((ims & PCRE_CASELESS) != 0) first_char = match_block.lcc[first_char];
- }
- else
- if (!startline && extra != NULL &&
- (extra->options & PCRE_STUDY_MAPPED) != 0)
- start_bits = extra->start_bits;
- }
-
-/* For anchored or unanchored matches, there may be a "last known required
-character" set. If the PCRE_CASELESS is set, implying that the match starts
-caselessly, or if there are any changes of this flag within the regex, set up
-both cases of the character. Otherwise set the two values the same, which will
-avoid duplicate testing (which takes significant time). This covers the vast
-majority of cases. It will be suboptimal when the case flag changes in a regex
-and the required character in fact is caseful. */
-
-if ((re->options & PCRE_REQCHSET) != 0)
- {
- req_char = re->req_char;
- req_char2 = ((re->options & (PCRE_CASELESS | PCRE_ICHANGED)) != 0)?
- (re->tables + fcc_offset)[req_char] : req_char;
- }
-
-/* Loop for handling unanchored repeated matching attempts; for anchored regexs
-the loop runs just once. */
-
-do
- {
- int rc;
- register int *iptr = match_block.offset_vector;
- register int *iend = iptr + resetcount;
-
- /* Reset the maximum number of extractions we might see. */
-
- while (iptr < iend) *iptr++ = -1;
-
- /* Advance to a unique first char if possible */
-
- if (first_char >= 0)
- {
- if ((ims & PCRE_CASELESS) != 0)
- while (start_match < end_subject &&
- match_block.lcc[*start_match] != first_char)
- start_match++;
- else
- while (start_match < end_subject && *start_match != first_char)
- start_match++;
- }
-
- /* Or to just after \n for a multiline match if possible */
-
- else if (startline)
- {
- if (start_match > match_block.start_subject + start_offset)
- {
- while (start_match < end_subject && start_match[-1] != '\n')
- start_match++;
- }
- }
-
- /* Or to a non-unique first char after study */
-
- else if (start_bits != NULL)
- {
- while (start_match < end_subject)
- {
- register int c = *start_match;
- if ((start_bits[c/8] & (1 << (c&7))) == 0) start_match++; else break;
- }
- }
-
-#ifdef DEBUG /* Sigh. Some compilers never learn. */
- printf(">>>> Match against: ");
- pchars(start_match, end_subject - start_match, TRUE, &match_block);
- printf("\n");
-#endif
-
- /* If req_char is set, we know that that character must appear in the subject
- for the match to succeed. If the first character is set, req_char must be
- later in the subject; otherwise the test starts at the match point. This
- optimization can save a huge amount of backtracking in patterns with nested
- unlimited repeats that aren't going to match. We don't know what the state of
- case matching may be when this character is hit, so test for it in both its
- cases if necessary. However, the different cased versions will not be set up
- unless PCRE_CASELESS was given or the casing state changes within the regex.
- Writing separate code makes it go faster, as does using an autoincrement and
- backing off on a match. */
-
- if (req_char >= 0)
- {
- register const uschar *p = start_match + ((first_char >= 0)? 1 : 0);
-
- /* We don't need to repeat the search if we haven't yet reached the
- place we found it at last time. */
-
- if (p > req_char_ptr)
- {
- /* Do a single test if no case difference is set up */
-
- if (req_char == req_char2)
- {
- while (p < end_subject)
- {
- if (*p++ == req_char) { p--; break; }
- }
- }
-
- /* Otherwise test for either case */
-
- else
- {
- while (p < end_subject)
- {
- register int pp = *p++;
- if (pp == req_char || pp == req_char2) { p--; break; }
- }
- }
-
- /* If we can't find the required character, break the matching loop */
-
- if (p >= end_subject) break;
-
- /* If we have found the required character, save the point where we
- found it, so that we don't search again next time round the loop if
- the start hasn't passed this character yet. */
-
- req_char_ptr = p;
- }
- }
-
- /* When a match occurs, substrings will be set for all internal extractions;
- we just need to set up the whole thing as substring 0 before returning. If
- there were too many extractions, set the return code to zero. In the case
- where we had to get some local store to hold offsets for backreferences, copy
- those back references that we can. In this case there need not be overflow
- if certain parts of the pattern were not used. */
-
- match_block.start_match = start_match;
- if (!match(start_match, re->code, 2, &match_block, ims, NULL, match_isgroup))
- continue;
-
- /* Copy the offset information from temporary store if necessary */
-
- if (using_temporary_offsets)
- {
- if (offsetcount >= 4)
- {
- memcpy(offsets + 2, match_block.offset_vector + 2,
- (offsetcount - 2) * sizeof(int));
- DPRINTF(("Copied offsets from temporary memory\n"));
- }
- if (match_block.end_offset_top > offsetcount)
- match_block.offset_overflow = TRUE;
-
- DPRINTF(("Freeing temporary memory\n"));
- (pcre_free)(match_block.offset_vector);
- }
-
- rc = match_block.offset_overflow? 0 : match_block.end_offset_top/2;
-
- if (match_block.offset_end < 2) rc = 0; else
- {
- offsets[0] = start_match - match_block.start_subject;
- offsets[1] = match_block.end_match_ptr - match_block.start_subject;
- }
-
- DPRINTF((">>>> returning %d\n", rc));
- return rc;
- }
-
-/* This "while" is the end of the "do" above */
-
-while (!anchored &&
- match_block.errorcode == PCRE_ERROR_NOMATCH &&
- start_match++ < end_subject);
-
-if (using_temporary_offsets)
- {
- DPRINTF(("Freeing temporary memory\n"));
- (pcre_free)(match_block.offset_vector);
- }
-
-DPRINTF((">>>> returning %d\n", match_block.errorcode));
-
-return match_block.errorcode;
-}
-
-/* End of pcre.c */
diff --git a/ext/pcre/pcrelib/pcre.def b/ext/pcre/pcrelib/pcre.def
deleted file mode 100644
index 0e8cf3f442..0000000000
--- a/ext/pcre/pcrelib/pcre.def
+++ /dev/null
@@ -1,19 +0,0 @@
-EXPORTS
-
-pcre_malloc DATA
-pcre_free DATA
-
-pcre_compile
-pcre_copy_substring
-pcre_exec
-pcre_get_substring
-pcre_get_substring_list
-pcre_info
-pcre_maketables
-pcre_study
-pcre_version
-
-regcomp
-regexec
-regerror
-regfree
diff --git a/ext/pcre/pcrelib/pcre.h b/ext/pcre/pcrelib/pcre.h
deleted file mode 100644
index 0d0599e948..0000000000
--- a/ext/pcre/pcrelib/pcre.h
+++ /dev/null
@@ -1,111 +0,0 @@
-/*************************************************
-* Perl-Compatible Regular Expressions *
-*************************************************/
-
-/* Copyright (c) 1997-2000 University of Cambridge */
-
-#ifndef _PCRE_H
-#define _PCRE_H
-
-/* The file pcre.h is build by "configure". Do not edit it; instead
-make changes to pcre.in. */
-
-#include "php_compat.h"
-#define PCRE_MAJOR 3
-#define PCRE_MINOR 4
-#define PCRE_DATE 22-Aug-2000
-
-/* Win32 uses DLL by default */
-
-#ifdef _WIN32
-# ifdef STATIC
-# define PCRE_DL_IMPORT
-# else
-# define PCRE_DL_IMPORT __declspec(dllimport)
-# endif
-#else
-# define PCRE_DL_IMPORT
-#endif
-
-/* Have to include stdlib.h in order to ensure that size_t is defined;
-it is needed here for malloc. */
-
-#include <stdlib.h>
-
-/* Allow for C++ users */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Options */
-
-#define PCRE_CASELESS 0x0001
-#define PCRE_MULTILINE 0x0002
-#define PCRE_DOTALL 0x0004
-#define PCRE_EXTENDED 0x0008
-#define PCRE_ANCHORED 0x0010
-#define PCRE_DOLLAR_ENDONLY 0x0020
-#define PCRE_EXTRA 0x0040
-#define PCRE_NOTBOL 0x0080
-#define PCRE_NOTEOL 0x0100
-#define PCRE_UNGREEDY 0x0200
-#define PCRE_NOTEMPTY 0x0400
-#define PCRE_UTF8 0x0800
-
-/* Exec-time and get-time error codes */
-
-#define PCRE_ERROR_NOMATCH (-1)
-#define PCRE_ERROR_NULL (-2)
-#define PCRE_ERROR_BADOPTION (-3)
-#define PCRE_ERROR_BADMAGIC (-4)
-#define PCRE_ERROR_UNKNOWN_NODE (-5)
-#define PCRE_ERROR_NOMEMORY (-6)
-#define PCRE_ERROR_NOSUBSTRING (-7)
-
-/* Request types for pcre_fullinfo() */
-
-#define PCRE_INFO_OPTIONS 0
-#define PCRE_INFO_SIZE 1
-#define PCRE_INFO_CAPTURECOUNT 2
-#define PCRE_INFO_BACKREFMAX 3
-#define PCRE_INFO_FIRSTCHAR 4
-#define PCRE_INFO_FIRSTTABLE 5
-#define PCRE_INFO_LASTLITERAL 6
-
-/* Types */
-
-typedef void pcre;
-typedef void pcre_extra;
-
-/* Store get and free functions. These can be set to alternative malloc/free
-functions if required. Some magic is required for Win32 DLL; it is null on
-other OS. */
-
-PCRE_DL_IMPORT extern void *(*pcre_malloc)(size_t);
-PCRE_DL_IMPORT extern void (*pcre_free)(void *);
-
-#undef PCRE_DL_IMPORT
-
-/* Functions */
-
-extern pcre *pcre_compile(const char *, int, const char **, int *,
- const unsigned char *);
-extern int pcre_copy_substring(const char *, int *, int, int, char *, int);
-extern int pcre_exec(const pcre *, const pcre_extra *, const char *,
- int, int, int, int *, int);
-extern void pcre_free_substring(const char *);
-extern void pcre_free_substring_list(const char **);
-extern int pcre_get_substring(const char *, int *, int, int, const char **);
-extern int pcre_get_substring_list(const char *, int *, int, const char ***);
-extern int pcre_info(const pcre *, int *, int *);
-extern int pcre_fullinfo(const pcre *, const pcre_extra *, int, void *);
-extern unsigned const char *pcre_maketables(void);
-extern pcre_extra *pcre_study(const pcre *, int, const char **);
-extern const char *pcre_version(void);
-
-#ifdef __cplusplus
-} /* extern "C" */
-#endif
-
-#endif /* End of pcre.h */
diff --git a/ext/pcre/pcrelib/pcregrep.c b/ext/pcre/pcrelib/pcregrep.c
deleted file mode 100644
index e8c934ef59..0000000000
--- a/ext/pcre/pcrelib/pcregrep.c
+++ /dev/null
@@ -1,228 +0,0 @@
-/*************************************************
-* pcregrep program *
-*************************************************/
-
-/* This is a grep program that uses the PCRE regular expression library to do
-its pattern matching. */
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <errno.h>
-#include "config.h"
-#include "pcre.h"
-
-#define FALSE 0
-#define TRUE 1
-
-typedef int BOOL;
-
-
-
-/*************************************************
-* Global variables *
-*************************************************/
-
-static pcre *pattern;
-static pcre_extra *hints;
-
-static BOOL count_only = FALSE;
-static BOOL filenames_only = FALSE;
-static BOOL invert = FALSE;
-static BOOL number = FALSE;
-static BOOL silent = FALSE;
-static BOOL whole_lines = FALSE;
-
-
-
-#if ! HAVE_STRERROR
-/*************************************************
-* Provide strerror() for non-ANSI libraries *
-*************************************************/
-
-/* Some old-fashioned systems still around (e.g. SunOS4) don't have strerror()
-in their libraries, but can provide the same facility by this simple
-alternative function. */
-
-extern int sys_nerr;
-extern char *sys_errlist[];
-
-char *
-strerror(int n)
-{
-if (n < 0 || n >= sys_nerr) return "unknown error number";
-return sys_errlist[n];
-}
-#endif /* HAVE_STRERROR */
-
-
-
-/*************************************************
-* Grep an individual file *
-*************************************************/
-
-static int
-pcregrep(FILE *in, char *name)
-{
-int rc = 1;
-int linenumber = 0;
-int count = 0;
-int offsets[99];
-char buffer[BUFSIZ];
-
-while (fgets(buffer, sizeof(buffer), in) != NULL)
- {
- BOOL match;
- int length = (int)strlen(buffer);
- if (length > 0 && buffer[length-1] == '\n') buffer[--length] = 0;
- linenumber++;
-
- match = pcre_exec(pattern, hints, buffer, length, 0, 0, offsets, 99) >= 0;
- if (match && whole_lines && offsets[1] != length) match = FALSE;
-
- if (match != invert)
- {
- if (count_only) count++;
-
- else if (filenames_only)
- {
- fprintf(stdout, "%s\n", (name == NULL)? "<stdin>" : name);
- return 0;
- }
-
- else if (silent) return 0;
-
- else
- {
- if (name != NULL) fprintf(stdout, "%s:", name);
- if (number) fprintf(stdout, "%d:", linenumber);
- fprintf(stdout, "%s\n", buffer);
- }
-
- rc = 0;
- }
- }
-
-if (count_only)
- {
- if (name != NULL) fprintf(stdout, "%s:", name);
- fprintf(stdout, "%d\n", count);
- }
-
-return rc;
-}
-
-
-
-
-/*************************************************
-* Usage function *
-*************************************************/
-
-static int
-usage(int rc)
-{
-fprintf(stderr, "Usage: pcregrep [-Vchilnsvx] pattern [file] ...\n");
-return rc;
-}
-
-
-
-
-/*************************************************
-* Main program *
-*************************************************/
-
-int
-main(int argc, char **argv)
-{
-int i;
-int rc = 1;
-int options = 0;
-int errptr;
-const char *error;
-BOOL filenames = TRUE;
-
-/* Process the options */
-
-for (i = 1; i < argc; i++)
- {
- char *s;
- if (argv[i][0] != '-') break;
- s = argv[i] + 1;
- while (*s != 0)
- {
- switch (*s++)
- {
- case 'c': count_only = TRUE; break;
- case 'h': filenames = FALSE; break;
- case 'i': options |= PCRE_CASELESS; break;
- case 'l': filenames_only = TRUE;
- case 'n': number = TRUE; break;
- case 's': silent = TRUE; break;
- case 'v': invert = TRUE; break;
- case 'x': whole_lines = TRUE; options |= PCRE_ANCHORED; break;
-
- case 'V':
- fprintf(stderr, "PCRE version %s\n", pcre_version());
- break;
-
- default:
- fprintf(stderr, "pcregrep: unknown option %c\n", s[-1]);
- return usage(2);
- }
- }
- }
-
-/* There must be at least a regexp argument */
-
-if (i >= argc) return usage(0);
-
-/* Compile the regular expression. */
-
-pattern = pcre_compile(argv[i++], options, &error, &errptr, NULL);
-if (pattern == NULL)
- {
- fprintf(stderr, "pcregrep: error in regex at offset %d: %s\n", errptr, error);
- return 2;
- }
-
-/* Study the regular expression, as we will be running it may times */
-
-hints = pcre_study(pattern, 0, &error);
-if (error != NULL)
- {
- fprintf(stderr, "pcregrep: error while studing regex: %s\n", error);
- return 2;
- }
-
-/* If there are no further arguments, do the business on stdin and exit */
-
-if (i >= argc) return pcregrep(stdin, NULL);
-
-/* Otherwise, work through the remaining arguments as files. If there is only
-one, don't give its name on the output. */
-
-if (i == argc - 1) filenames = FALSE;
-if (filenames_only) filenames = TRUE;
-
-for (; i < argc; i++)
- {
- FILE *in = fopen(argv[i], "r");
- if (in == NULL)
- {
- fprintf(stderr, "%s: failed to open: %s\n", argv[i], strerror(errno));
- rc = 2;
- }
- else
- {
- int frc = pcregrep(in, filenames? argv[i] : NULL);
- if (frc == 0 && rc == 1) rc = 0;
- fclose(in);
- }
- }
-
-return rc;
-}
-
-/* End */
diff --git a/ext/pcre/pcrelib/pcreposix.c b/ext/pcre/pcrelib/pcreposix.c
deleted file mode 100644
index 6aeb88282d..0000000000
--- a/ext/pcre/pcrelib/pcreposix.c
+++ /dev/null
@@ -1,280 +0,0 @@
-/*************************************************
-* Perl-Compatible Regular Expressions *
-*************************************************/
-
-/*
-This is a library of functions to support regular expressions whose syntax
-and semantics are as close as possible to those of the Perl 5 language. See
-the file Tech.Notes for some information on the internals.
-
-This module is a wrapper that provides a POSIX API to the underlying PCRE
-functions.
-
-Written by: Philip Hazel <ph10@cam.ac.uk>
-
- Copyright (c) 1997-2000 University of Cambridge
-
------------------------------------------------------------------------------
-Permission is granted to anyone to use this software for any purpose on any
-computer system, and to redistribute it freely, subject to the following
-restrictions:
-
-1. This software is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-
-2. The origin of this software must not be misrepresented, either by
- explicit claim or by omission.
-
-3. Altered versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
-
-4. If PCRE is embedded in any software that is released under the GNU
- General Purpose Licence (GPL), then the terms of that licence shall
- supersede any condition above with which it is incompatible.
------------------------------------------------------------------------------
-*/
-
-#include "internal.h"
-#include "pcreposix.h"
-#include "stdlib.h"
-
-
-
-/* Corresponding tables of PCRE error messages and POSIX error codes. */
-
-static const char *estring[] = {
- ERR1, ERR2, ERR3, ERR4, ERR5, ERR6, ERR7, ERR8, ERR9, ERR10,
- ERR11, ERR12, ERR13, ERR14, ERR15, ERR16, ERR17, ERR18, ERR19, ERR20,
- ERR21, ERR22, ERR23, ERR24, ERR25, ERR26, ERR27, ERR29, ERR29, ERR30,
- ERR31 };
-
-static int eint[] = {
- REG_EESCAPE, /* "\\ at end of pattern" */
- REG_EESCAPE, /* "\\c at end of pattern" */
- REG_EESCAPE, /* "unrecognized character follows \\" */
- REG_BADBR, /* "numbers out of order in {} quantifier" */
- REG_BADBR, /* "number too big in {} quantifier" */
- REG_EBRACK, /* "missing terminating ] for character class" */
- REG_ECTYPE, /* "invalid escape sequence in character class" */
- REG_ERANGE, /* "range out of order in character class" */
- REG_BADRPT, /* "nothing to repeat" */
- REG_BADRPT, /* "operand of unlimited repeat could match the empty string" */
- REG_ASSERT, /* "internal error: unexpected repeat" */
- REG_BADPAT, /* "unrecognized character after (?" */
- REG_ESIZE, /* "too many capturing parenthesized sub-patterns" */
- REG_EPAREN, /* "missing )" */
- REG_ESUBREG, /* "back reference to non-existent subpattern" */
- REG_INVARG, /* "erroffset passed as NULL" */
- REG_INVARG, /* "unknown option bit(s) set" */
- REG_EPAREN, /* "missing ) after comment" */
- REG_ESIZE, /* "too many sets of parentheses" */
- REG_ESIZE, /* "regular expression too large" */
- REG_ESPACE, /* "failed to get memory" */
- REG_EPAREN, /* "unmatched brackets" */
- REG_ASSERT, /* "internal error: code overflow" */
- REG_BADPAT, /* "unrecognized character after (?<" */
- REG_BADPAT, /* "lookbehind assertion is not fixed length" */
- REG_BADPAT, /* "malformed number after (?(" */
- REG_BADPAT, /* "conditional group containe more than two branches" */
- REG_BADPAT, /* "assertion expected after (?(" */
- REG_BADPAT, /* "(?p must be followed by )" */
- REG_ECTYPE, /* "unknown POSIX class name" */
- REG_BADPAT, /* "POSIX collating elements are not supported" */
- REG_INVARG, /* "this version of PCRE is not compiled with PCRE_UTF8 support" */
- REG_BADPAT, /* "characters with values > 255 are not yet supported in classes" */
- REG_BADPAT, /* "character value in \x{...} sequence is too large" */
- REG_BADPAT /* "invalid condition (?(0)" */
-};
-
-/* Table of texts corresponding to POSIX error codes */
-
-static const char *pstring[] = {
- "", /* Dummy for value 0 */
- "internal error", /* REG_ASSERT */
- "invalid repeat counts in {}", /* BADBR */
- "pattern error", /* BADPAT */
- "? * + invalid", /* BADRPT */
- "unbalanced {}", /* EBRACE */
- "unbalanced []", /* EBRACK */
- "collation error - not relevant", /* ECOLLATE */
- "bad class", /* ECTYPE */
- "bad escape sequence", /* EESCAPE */
- "empty expression", /* EMPTY */
- "unbalanced ()", /* EPAREN */
- "bad range inside []", /* ERANGE */
- "expression too big", /* ESIZE */
- "failed to get memory", /* ESPACE */
- "bad back reference", /* ESUBREG */
- "bad argument", /* INVARG */
- "match failed" /* NOMATCH */
-};
-
-
-
-
-/*************************************************
-* Translate PCRE text code to int *
-*************************************************/
-
-/* PCRE compile-time errors are given as strings defined as macros. We can just
-look them up in a table to turn them into POSIX-style error codes. */
-
-static int
-pcre_posix_error_code(const char *s)
-{
-size_t i;
-for (i = 0; i < sizeof(estring)/sizeof(char *); i++)
- if (strcmp(s, estring[i]) == 0) return eint[i];
-return REG_ASSERT;
-}
-
-
-
-/*************************************************
-* Translate error code to string *
-*************************************************/
-
-size_t
-regerror(int errcode, const regex_t *preg, char *errbuf, size_t errbuf_size)
-{
-const char *message, *addmessage;
-size_t length, addlength;
-
-message = (errcode >= (int)(sizeof(pstring)/sizeof(char *)))?
- "unknown error code" : pstring[errcode];
-length = strlen(message) + 1;
-
-addmessage = " at offset ";
-addlength = (preg != NULL && (int)preg->re_erroffset != -1)?
- strlen(addmessage) + 6 : 0;
-
-if (errbuf_size > 0)
- {
- if (addlength > 0 && errbuf_size >= length + addlength)
- sprintf(errbuf, "%s%s%-6d", message, addmessage, (int)preg->re_erroffset);
- else
- {
- strncpy(errbuf, message, errbuf_size - 1);
- errbuf[errbuf_size-1] = 0;
- }
- }
-
-return length + addlength;
-}
-
-
-
-
-/*************************************************
-* Free store held by a regex *
-*************************************************/
-
-void
-regfree(regex_t *preg)
-{
-(pcre_free)(preg->re_pcre);
-}
-
-
-
-
-/*************************************************
-* Compile a regular expression *
-*************************************************/
-
-/*
-Arguments:
- preg points to a structure for recording the compiled expression
- pattern the pattern to compile
- cflags compilation flags
-
-Returns: 0 on success
- various non-zero codes on failure
-*/
-
-int
-regcomp(regex_t *preg, const char *pattern, int cflags)
-{
-const char *errorptr;
-int erroffset;
-int options = 0;
-
-if ((cflags & REG_ICASE) != 0) options |= PCRE_CASELESS;
-if ((cflags & REG_NEWLINE) != 0) options |= PCRE_MULTILINE;
-
-preg->re_pcre = pcre_compile(pattern, options, &errorptr, &erroffset, NULL);
-preg->re_erroffset = erroffset;
-
-if (preg->re_pcre == NULL) return pcre_posix_error_code(errorptr);
-
-preg->re_nsub = pcre_info(preg->re_pcre, NULL, NULL);
-return 0;
-}
-
-
-
-
-/*************************************************
-* Match a regular expression *
-*************************************************/
-
-/* Unfortunately, PCRE requires 3 ints of working space for each captured
-substring, so we have to get and release working store instead of just using
-the POSIX structures as was done in earlier releases when PCRE needed only 2
-ints. */
-
-int
-regexec(regex_t *preg, const char *string, size_t nmatch,
- regmatch_t pmatch[], int eflags)
-{
-int rc;
-int options = 0;
-int *ovector = NULL;
-
-if ((eflags & REG_NOTBOL) != 0) options |= PCRE_NOTBOL;
-if ((eflags & REG_NOTEOL) != 0) options |= PCRE_NOTEOL;
-
-preg->re_erroffset = (size_t)(-1); /* Only has meaning after compile */
-
-if (nmatch > 0)
- {
- ovector = (int *)malloc(sizeof(int) * nmatch * 3);
- if (ovector == NULL) return REG_ESPACE;
- }
-
-rc = pcre_exec(preg->re_pcre, NULL, string, (int)strlen(string), 0, options,
- ovector, nmatch * 3);
-
-if (rc == 0) rc = nmatch; /* All captured slots were filled in */
-
-if (rc >= 0)
- {
- size_t i;
- for (i = 0; i < rc; i++)
- {
- pmatch[i].rm_so = ovector[i*2];
- pmatch[i].rm_eo = ovector[i*2+1];
- }
- if (ovector != NULL) free(ovector);
- for (; i < nmatch; i++) pmatch[i].rm_so = pmatch[i].rm_eo = -1;
- return 0;
- }
-
-else
- {
- if (ovector != NULL) free(ovector);
- switch(rc)
- {
- case PCRE_ERROR_NOMATCH: return REG_NOMATCH;
- case PCRE_ERROR_NULL: return REG_INVARG;
- case PCRE_ERROR_BADOPTION: return REG_INVARG;
- case PCRE_ERROR_BADMAGIC: return REG_INVARG;
- case PCRE_ERROR_UNKNOWN_NODE: return REG_ASSERT;
- case PCRE_ERROR_NOMEMORY: return REG_ESPACE;
- default: return REG_ASSERT;
- }
- }
-}
-
-/* End of pcreposix.c */
diff --git a/ext/pcre/pcrelib/pcreposix.h b/ext/pcre/pcrelib/pcreposix.h
deleted file mode 100644
index 7660acbd55..0000000000
--- a/ext/pcre/pcrelib/pcreposix.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/*************************************************
-* Perl-Compatible Regular Expressions *
-*************************************************/
-
-/* Copyright (c) 1997-2000 University of Cambridge */
-
-#ifndef _PCREPOSIX_H
-#define _PCREPOSIX_H
-
-/* This is the header for the POSIX wrapper interface to the PCRE Perl-
-Compatible Regular Expression library. It defines the things POSIX says should
-be there. I hope. */
-
-/* Have to include stdlib.h in order to ensure that size_t is defined. */
-
-#include <stdlib.h>
-
-/* Allow for C++ users */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Options defined by POSIX. */
-
-#define REG_ICASE 0x01
-#define REG_NEWLINE 0x02
-#define REG_NOTBOL 0x04
-#define REG_NOTEOL 0x08
-
-/* These are not used by PCRE, but by defining them we make it easier
-to slot PCRE into existing programs that make POSIX calls. */
-
-#define REG_EXTENDED 0
-#define REG_NOSUB 0
-
-/* Error values. Not all these are relevant or used by the wrapper. */
-
-enum {
- REG_ASSERT = 1, /* internal error ? */
- REG_BADBR, /* invalid repeat counts in {} */
- REG_BADPAT, /* pattern error */
- REG_BADRPT, /* ? * + invalid */
- REG_EBRACE, /* unbalanced {} */
- REG_EBRACK, /* unbalanced [] */
- REG_ECOLLATE, /* collation error - not relevant */
- REG_ECTYPE, /* bad class */
- REG_EESCAPE, /* bad escape sequence */
- REG_EMPTY, /* empty expression */
- REG_EPAREN, /* unbalanced () */
- REG_ERANGE, /* bad range inside [] */
- REG_ESIZE, /* expression too big */
- REG_ESPACE, /* failed to get memory */
- REG_ESUBREG, /* bad back reference */
- REG_INVARG, /* bad argument */
- REG_NOMATCH /* match failed */
-};
-
-
-/* The structure representing a compiled regular expression. */
-
-typedef struct {
- void *re_pcre;
- size_t re_nsub;
- size_t re_erroffset;
-} regex_t;
-
-/* The structure in which a captured offset is returned. */
-
-typedef int regoff_t;
-
-typedef struct {
- regoff_t rm_so;
- regoff_t rm_eo;
-} regmatch_t;
-
-/* The functions */
-
-extern int regcomp(regex_t *, const char *, int);
-extern int regexec(regex_t *, const char *, size_t, regmatch_t *, int);
-extern size_t regerror(int, const regex_t *, char *, size_t);
-extern void regfree(regex_t *);
-
-#ifdef __cplusplus
-} /* extern "C" */
-#endif
-
-#endif /* End of pcreposix.h */
diff --git a/ext/pcre/pcrelib/pcretest.c b/ext/pcre/pcrelib/pcretest.c
deleted file mode 100644
index ee5df5f0c7..0000000000
--- a/ext/pcre/pcrelib/pcretest.c
+++ /dev/null
@@ -1,1225 +0,0 @@
-/*************************************************
-* PCRE testing program *
-*************************************************/
-
-#include <ctype.h>
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <time.h>
-#include <locale.h>
-
-/* Use the internal info for displaying the results of pcre_study(). */
-
-#include "internal.h"
-
-/* It is possible to compile this test program without including support for
-testing the POSIX interface, though this is not available via the standard
-Makefile. */
-
-#if !defined NOPOSIX
-#include "pcreposix.h"
-#endif
-
-#ifndef CLOCKS_PER_SEC
-#ifdef CLK_TCK
-#define CLOCKS_PER_SEC CLK_TCK
-#else
-#define CLOCKS_PER_SEC 100
-#endif
-#endif
-
-#define LOOPREPEAT 20000
-
-
-static FILE *outfile;
-static int log_store = 0;
-static size_t gotten_store;
-
-
-
-static int utf8_table1[] = {
- 0x0000007f, 0x000007ff, 0x0000ffff, 0x001fffff, 0x03ffffff, 0x7fffffff};
-
-static int utf8_table2[] = {
- 0, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc};
-
-static int utf8_table3[] = {
- 0xff, 0x1f, 0x0f, 0x07, 0x03, 0x01};
-
-
-/*************************************************
-* Convert character value to UTF-8 *
-*************************************************/
-
-/* This function takes an integer value in the range 0 - 0x7fffffff
-and encodes it as a UTF-8 character in 0 to 6 bytes.
-
-Arguments:
- cvalue the character value
- buffer pointer to buffer for result - at least 6 bytes long
-
-Returns: number of characters placed in the buffer
- -1 if input character is negative
- 0 if input character is positive but too big (only when
- int is longer than 32 bits)
-*/
-
-static int
-ord2utf8(int cvalue, unsigned char *buffer)
-{
-register int i, j;
-for (i = 0; i < sizeof(utf8_table1)/sizeof(int); i++)
- if (cvalue <= utf8_table1[i]) break;
-if (i >= sizeof(utf8_table1)/sizeof(int)) return 0;
-if (cvalue < 0) return -1;
-*buffer++ = utf8_table2[i] | (cvalue & utf8_table3[i]);
-cvalue >>= 6 - i;
-for (j = 0; j < i; j++)
- {
- *buffer++ = 0x80 | (cvalue & 0x3f);
- cvalue >>= 6;
- }
-return i + 1;
-}
-
-
-/*************************************************
-* Convert UTF-8 string to value *
-*************************************************/
-
-/* This function takes one or more bytes that represents a UTF-8 character,
-and returns the value of the character.
-
-Argument:
- buffer a pointer to the byte vector
- vptr a pointer to an int to receive the value
-
-Returns: > 0 => the number of bytes consumed
- -6 to 0 => malformed UTF-8 character at offset = (-return)
-*/
-
-int
-utf82ord(unsigned char *buffer, int *vptr)
-{
-int c = *buffer++;
-int d = c;
-int i, j, s;
-
-for (i = -1; i < 6; i++) /* i is number of additional bytes */
- {
- if ((d & 0x80) == 0) break;
- d <<= 1;
- }
-
-if (i == -1) { *vptr = c; return 1; } /* ascii character */
-if (i == 0 || i == 6) return 0; /* invalid UTF-8 */
-
-/* i now has a value in the range 1-5 */
-
-d = c & utf8_table3[i];
-s = 6 - i;
-
-for (j = 0; j < i; j++)
- {
- c = *buffer++;
- if ((c & 0xc0) != 0x80) return -(j+1);
- d |= (c & 0x3f) << s;
- s += 6;
- }
-
-/* Check that encoding was the correct unique one */
-
-for (j = 0; j < sizeof(utf8_table1)/sizeof(int); j++)
- if (d <= utf8_table1[j]) break;
-if (j != i) return -(i+1);
-
-/* Valid value */
-
-*vptr = d;
-return i+1;
-}
-
-
-
-
-
-
-/* Debugging function to print the internal form of the regex. This is the same
-code as contained in pcre.c under the DEBUG macro. */
-
-static const char *OP_names[] = {
- "End", "\\A", "\\B", "\\b", "\\D", "\\d",
- "\\S", "\\s", "\\W", "\\w", "\\Z", "\\z",
- "Opt", "^", "$", "Any", "chars", "not",
- "*", "*?", "+", "+?", "?", "??", "{", "{", "{",
- "*", "*?", "+", "+?", "?", "??", "{", "{", "{",
- "*", "*?", "+", "+?", "?", "??", "{", "{", "{",
- "*", "*?", "+", "+?", "?", "??", "{", "{",
- "class", "Ref", "Recurse",
- "Alt", "Ket", "KetRmax", "KetRmin", "Assert", "Assert not",
- "AssertB", "AssertB not", "Reverse", "Once", "Cond", "Cref",
- "Brazero", "Braminzero", "Bra"
-};
-
-
-static void print_internals(pcre *re)
-{
-unsigned char *code = ((real_pcre *)re)->code;
-
-fprintf(outfile, "------------------------------------------------------------------\n");
-
-for(;;)
- {
- int c;
- int charlength;
-
- fprintf(outfile, "%3d ", (int)(code - ((real_pcre *)re)->code));
-
- if (*code >= OP_BRA)
- {
- fprintf(outfile, "%3d Bra %d", (code[1] << 8) + code[2], *code - OP_BRA);
- code += 2;
- }
-
- else switch(*code)
- {
- case OP_END:
- fprintf(outfile, " %s\n", OP_names[*code]);
- fprintf(outfile, "------------------------------------------------------------------\n");
- return;
-
- case OP_OPT:
- fprintf(outfile, " %.2x %s", code[1], OP_names[*code]);
- code++;
- break;
-
- case OP_COND:
- fprintf(outfile, "%3d Cond", (code[1] << 8) + code[2]);
- code += 2;
- break;
-
- case OP_CREF:
- fprintf(outfile, " %.2d %s", code[1], OP_names[*code]);
- code++;
- break;
-
- case OP_CHARS:
- charlength = *(++code);
- fprintf(outfile, "%3d ", charlength);
- while (charlength-- > 0)
- if (isprint(c = *(++code))) fprintf(outfile, "%c", c);
- else fprintf(outfile, "\\x%02x", c);
- break;
-
- case OP_KETRMAX:
- case OP_KETRMIN:
- case OP_ALT:
- case OP_KET:
- case OP_ASSERT:
- case OP_ASSERT_NOT:
- case OP_ASSERTBACK:
- case OP_ASSERTBACK_NOT:
- case OP_ONCE:
- fprintf(outfile, "%3d %s", (code[1] << 8) + code[2], OP_names[*code]);
- code += 2;
- break;
-
- case OP_REVERSE:
- fprintf(outfile, "%3d %s", (code[1] << 8) + code[2], OP_names[*code]);
- code += 2;
- break;
-
- case OP_STAR:
- case OP_MINSTAR:
- case OP_PLUS:
- case OP_MINPLUS:
- case OP_QUERY:
- case OP_MINQUERY:
- case OP_TYPESTAR:
- case OP_TYPEMINSTAR:
- case OP_TYPEPLUS:
- case OP_TYPEMINPLUS:
- case OP_TYPEQUERY:
- case OP_TYPEMINQUERY:
- if (*code >= OP_TYPESTAR)
- fprintf(outfile, " %s", OP_names[code[1]]);
- else if (isprint(c = code[1])) fprintf(outfile, " %c", c);
- else fprintf(outfile, " \\x%02x", c);
- fprintf(outfile, "%s", OP_names[*code++]);
- break;
-
- case OP_EXACT:
- case OP_UPTO:
- case OP_MINUPTO:
- if (isprint(c = code[3])) fprintf(outfile, " %c{", c);
- else fprintf(outfile, " \\x%02x{", c);
- if (*code != OP_EXACT) fprintf(outfile, ",");
- fprintf(outfile, "%d}", (code[1] << 8) + code[2]);
- if (*code == OP_MINUPTO) fprintf(outfile, "?");
- code += 3;
- break;
-
- case OP_TYPEEXACT:
- case OP_TYPEUPTO:
- case OP_TYPEMINUPTO:
- fprintf(outfile, " %s{", OP_names[code[3]]);
- if (*code != OP_TYPEEXACT) fprintf(outfile, "0,");
- fprintf(outfile, "%d}", (code[1] << 8) + code[2]);
- if (*code == OP_TYPEMINUPTO) fprintf(outfile, "?");
- code += 3;
- break;
-
- case OP_NOT:
- if (isprint(c = *(++code))) fprintf(outfile, " [^%c]", c);
- else fprintf(outfile, " [^\\x%02x]", c);
- break;
-
- case OP_NOTSTAR:
- case OP_NOTMINSTAR:
- case OP_NOTPLUS:
- case OP_NOTMINPLUS:
- case OP_NOTQUERY:
- case OP_NOTMINQUERY:
- if (isprint(c = code[1])) fprintf(outfile, " [^%c]", c);
- else fprintf(outfile, " [^\\x%02x]", c);
- fprintf(outfile, "%s", OP_names[*code++]);
- break;
-
- case OP_NOTEXACT:
- case OP_NOTUPTO:
- case OP_NOTMINUPTO:
- if (isprint(c = code[3])) fprintf(outfile, " [^%c]{", c);
- else fprintf(outfile, " [^\\x%02x]{", c);
- if (*code != OP_NOTEXACT) fprintf(outfile, ",");
- fprintf(outfile, "%d}", (code[1] << 8) + code[2]);
- if (*code == OP_NOTMINUPTO) fprintf(outfile, "?");
- code += 3;
- break;
-
- case OP_REF:
- fprintf(outfile, " \\%d", *(++code));
- code++;
- goto CLASS_REF_REPEAT;
-
- case OP_CLASS:
- {
- int i, min, max;
- code++;
- fprintf(outfile, " [");
-
- for (i = 0; i < 256; i++)
- {
- if ((code[i/8] & (1 << (i&7))) != 0)
- {
- int j;
- for (j = i+1; j < 256; j++)
- if ((code[j/8] & (1 << (j&7))) == 0) break;
- if (i == '-' || i == ']') fprintf(outfile, "\\");
- if (isprint(i)) fprintf(outfile, "%c", i); else fprintf(outfile, "\\x%02x", i);
- if (--j > i)
- {
- fprintf(outfile, "-");
- if (j == '-' || j == ']') fprintf(outfile, "\\");
- if (isprint(j)) fprintf(outfile, "%c", j); else fprintf(outfile, "\\x%02x", j);
- }
- i = j;
- }
- }
- fprintf(outfile, "]");
- code += 32;
-
- CLASS_REF_REPEAT:
-
- switch(*code)
- {
- case OP_CRSTAR:
- case OP_CRMINSTAR:
- case OP_CRPLUS:
- case OP_CRMINPLUS:
- case OP_CRQUERY:
- case OP_CRMINQUERY:
- fprintf(outfile, "%s", OP_names[*code]);
- break;
-
- case OP_CRRANGE:
- case OP_CRMINRANGE:
- min = (code[1] << 8) + code[2];
- max = (code[3] << 8) + code[4];
- if (max == 0) fprintf(outfile, "{%d,}", min);
- else fprintf(outfile, "{%d,%d}", min, max);
- if (*code == OP_CRMINRANGE) fprintf(outfile, "?");
- code += 4;
- break;
-
- default:
- code--;
- }
- }
- break;
-
- /* Anything else is just a one-node item */
-
- default:
- fprintf(outfile, " %s", OP_names[*code]);
- break;
- }
-
- code++;
- fprintf(outfile, "\n");
- }
-}
-
-
-
-/* Character string printing function. A "normal" and a UTF-8 version. */
-
-static void pchars(unsigned char *p, int length, int utf8)
-{
-int c;
-while (length-- > 0)
- {
- if (utf8)
- {
- int rc = utf82ord(p, &c);
- if (rc > 0)
- {
- length -= rc - 1;
- p += rc;
- if (c < 256 && isprint(c)) fprintf(outfile, "%c", c);
- else fprintf(outfile, "\\x{%02x}", c);
- continue;
- }
- }
-
- /* Not UTF-8, or malformed UTF-8 */
-
- if (isprint(c = *(p++))) fprintf(outfile, "%c", c);
- else fprintf(outfile, "\\x%02x", c);
- }
-}
-
-
-
-/* Alternative malloc function, to test functionality and show the size of the
-compiled re. */
-
-static void *new_malloc(size_t size)
-{
-gotten_store = size;
-if (log_store)
- fprintf(outfile, "Memory allocation (code space): %d\n",
- (int)((int)size - offsetof(real_pcre, code[0])));
-return malloc(size);
-}
-
-
-
-
-/* Get one piece of information from the pcre_fullinfo() function */
-
-static void new_info(pcre *re, pcre_extra *study, int option, void *ptr)
-{
-int rc;
-if ((rc = pcre_fullinfo(re, study, option, ptr)) < 0)
- fprintf(outfile, "Error %d from pcre_fullinfo(%d)\n", rc, option);
-}
-
-
-
-
-/* Read lines from named file or stdin and write to named file or stdout; lines
-consist of a regular expression, in delimiters and optionally followed by
-options, followed by a set of test data, terminated by an empty line. */
-
-int main(int argc, char **argv)
-{
-FILE *infile = stdin;
-int options = 0;
-int study_options = 0;
-int op = 1;
-int timeit = 0;
-int showinfo = 0;
-int showstore = 0;
-int posix = 0;
-int debug = 0;
-int done = 0;
-unsigned char buffer[30000];
-unsigned char dbuffer[1024];
-
-/* Static so that new_malloc can use it. */
-
-outfile = stdout;
-
-/* Scan options */
-
-while (argc > 1 && argv[op][0] == '-')
- {
- if (strcmp(argv[op], "-s") == 0 || strcmp(argv[op], "-m") == 0)
- showstore = 1;
- else if (strcmp(argv[op], "-t") == 0) timeit = 1;
- else if (strcmp(argv[op], "-i") == 0) showinfo = 1;
- else if (strcmp(argv[op], "-d") == 0) showinfo = debug = 1;
- else if (strcmp(argv[op], "-p") == 0) posix = 1;
- else
- {
- printf("*** Unknown option %s\n", argv[op]);
- printf("Usage: pcretest [-d] [-i] [-p] [-s] [-t] [<input> [<output>]]\n");
- printf(" -d debug: show compiled code; implies -i\n"
- " -i show information about compiled pattern\n"
- " -p use POSIX interface\n"
- " -s output store information\n"
- " -t time compilation and execution\n");
- return 1;
- }
- op++;
- argc--;
- }
-
-/* Sort out the input and output files */
-
-if (argc > 1)
- {
- infile = fopen(argv[op], "r");
- if (infile == NULL)
- {
- printf("** Failed to open %s\n", argv[op]);
- return 1;
- }
- }
-
-if (argc > 2)
- {
- outfile = fopen(argv[op+1], "w");
- if (outfile == NULL)
- {
- printf("** Failed to open %s\n", argv[op+1]);
- return 1;
- }
- }
-
-/* Set alternative malloc function */
-
-pcre_malloc = new_malloc;
-
-/* Heading line, then prompt for first regex if stdin */
-
-fprintf(outfile, "PCRE version %s\n\n", pcre_version());
-
-/* Main loop */
-
-while (!done)
- {
- pcre *re = NULL;
- pcre_extra *extra = NULL;
-
-#if !defined NOPOSIX /* There are still compilers that require no indent */
- regex_t preg;
- int do_posix = 0;
-#endif
-
- const char *error;
- unsigned char *p, *pp, *ppp;
- unsigned const char *tables = NULL;
- int do_study = 0;
- int do_debug = debug;
- int do_G = 0;
- int do_g = 0;
- int do_showinfo = showinfo;
- int do_showrest = 0;
- int utf8 = 0;
- int erroroffset, len, delimiter;
-
- if (infile == stdin) printf(" re> ");
- if (fgets((char *)buffer, sizeof(buffer), infile) == NULL) break;
- if (infile != stdin) fprintf(outfile, "%s", (char *)buffer);
-
- p = buffer;
- while (isspace(*p)) p++;
- if (*p == 0) continue;
-
- /* Get the delimiter and seek the end of the pattern; if is isn't
- complete, read more. */
-
- delimiter = *p++;
-
- if (isalnum(delimiter) || delimiter == '\\')
- {
- fprintf(outfile, "** Delimiter must not be alphameric or \\\n");
- goto SKIP_DATA;
- }
-
- pp = p;
-
- for(;;)
- {
- while (*pp != 0)
- {
- if (*pp == '\\' && pp[1] != 0) pp++;
- else if (*pp == delimiter) break;
- pp++;
- }
- if (*pp != 0) break;
-
- len = sizeof(buffer) - (pp - buffer);
- if (len < 256)
- {
- fprintf(outfile, "** Expression too long - missing delimiter?\n");
- goto SKIP_DATA;
- }
-
- if (infile == stdin) printf(" > ");
- if (fgets((char *)pp, len, infile) == NULL)
- {
- fprintf(outfile, "** Unexpected EOF\n");
- done = 1;
- goto CONTINUE;
- }
- if (infile != stdin) fprintf(outfile, "%s", (char *)pp);
- }
-
- /* If the first character after the delimiter is backslash, make
- the pattern end with backslash. This is purely to provide a way
- of testing for the error message when a pattern ends with backslash. */
-
- if (pp[1] == '\\') *pp++ = '\\';
-
- /* Terminate the pattern at the delimiter */
-
- *pp++ = 0;
-
- /* Look for options after final delimiter */
-
- options = 0;
- study_options = 0;
- log_store = showstore; /* default from command line */
-
- while (*pp != 0)
- {
- switch (*pp++)
- {
- case 'g': do_g = 1; break;
- case 'i': options |= PCRE_CASELESS; break;
- case 'm': options |= PCRE_MULTILINE; break;
- case 's': options |= PCRE_DOTALL; break;
- case 'x': options |= PCRE_EXTENDED; break;
-
- case '+': do_showrest = 1; break;
- case 'A': options |= PCRE_ANCHORED; break;
- case 'D': do_debug = do_showinfo = 1; break;
- case 'E': options |= PCRE_DOLLAR_ENDONLY; break;
- case 'G': do_G = 1; break;
- case 'I': do_showinfo = 1; break;
- case 'M': log_store = 1; break;
-
-#if !defined NOPOSIX
- case 'P': do_posix = 1; break;
-#endif
-
- case 'S': do_study = 1; break;
- case 'U': options |= PCRE_UNGREEDY; break;
- case 'X': options |= PCRE_EXTRA; break;
- case '8': options |= PCRE_UTF8; utf8 = 1; break;
-
- case 'L':
- ppp = pp;
- while (*ppp != '\n' && *ppp != ' ') ppp++;
- *ppp = 0;
- if (setlocale(LC_CTYPE, (const char *)pp) == NULL)
- {
- fprintf(outfile, "** Failed to set locale \"%s\"\n", pp);
- goto SKIP_DATA;
- }
- tables = pcre_maketables();
- pp = ppp;
- break;
-
- case '\n': case ' ': break;
- default:
- fprintf(outfile, "** Unknown option '%c'\n", pp[-1]);
- goto SKIP_DATA;
- }
- }
-
- /* Handle compiling via the POSIX interface, which doesn't support the
- timing, showing, or debugging options, nor the ability to pass over
- local character tables. */
-
-#if !defined NOPOSIX
- if (posix || do_posix)
- {
- int rc;
- int cflags = 0;
- if ((options & PCRE_CASELESS) != 0) cflags |= REG_ICASE;
- if ((options & PCRE_MULTILINE) != 0) cflags |= REG_NEWLINE;
- rc = regcomp(&preg, (char *)p, cflags);
-
- /* Compilation failed; go back for another re, skipping to blank line
- if non-interactive. */
-
- if (rc != 0)
- {
- (void)regerror(rc, &preg, (char *)buffer, sizeof(buffer));
- fprintf(outfile, "Failed: POSIX code %d: %s\n", rc, buffer);
- goto SKIP_DATA;
- }
- }
-
- /* Handle compiling via the native interface */
-
- else
-#endif /* !defined NOPOSIX */
-
- {
- if (timeit)
- {
- register int i;
- clock_t time_taken;
- clock_t start_time = clock();
- for (i = 0; i < LOOPREPEAT; i++)
- {
- re = pcre_compile((char *)p, options, &error, &erroroffset, tables);
- if (re != NULL) free(re);
- }
- time_taken = clock() - start_time;
- fprintf(outfile, "Compile time %.3f milliseconds\n",
- ((double)time_taken * 1000.0) /
- ((double)LOOPREPEAT * (double)CLOCKS_PER_SEC));
- }
-
- re = pcre_compile((char *)p, options, &error, &erroroffset, tables);
-
- /* Compilation failed; go back for another re, skipping to blank line
- if non-interactive. */
-
- if (re == NULL)
- {
- fprintf(outfile, "Failed: %s at offset %d\n", error, erroroffset);
- SKIP_DATA:
- if (infile != stdin)
- {
- for (;;)
- {
- if (fgets((char *)buffer, sizeof(buffer), infile) == NULL)
- {
- done = 1;
- goto CONTINUE;
- }
- len = (int)strlen((char *)buffer);
- while (len > 0 && isspace(buffer[len-1])) len--;
- if (len == 0) break;
- }
- fprintf(outfile, "\n");
- }
- goto CONTINUE;
- }
-
- /* Compilation succeeded; print data if required. There are now two
- info-returning functions. The old one has a limited interface and
- returns only limited data. Check that it agrees with the newer one. */
-
- if (do_showinfo)
- {
- int old_first_char, old_options, old_count;
- int count, backrefmax, first_char, need_char;
- size_t size;
-
- if (do_debug) print_internals(re);
-
- new_info(re, NULL, PCRE_INFO_OPTIONS, &options);
- new_info(re, NULL, PCRE_INFO_SIZE, &size);
- new_info(re, NULL, PCRE_INFO_CAPTURECOUNT, &count);
- new_info(re, NULL, PCRE_INFO_BACKREFMAX, &backrefmax);
- new_info(re, NULL, PCRE_INFO_FIRSTCHAR, &first_char);
- new_info(re, NULL, PCRE_INFO_LASTLITERAL, &need_char);
-
- old_count = pcre_info(re, &old_options, &old_first_char);
- if (count < 0) fprintf(outfile,
- "Error %d from pcre_info()\n", count);
- else
- {
- if (old_count != count) fprintf(outfile,
- "Count disagreement: pcre_fullinfo=%d pcre_info=%d\n", count,
- old_count);
-
- if (old_first_char != first_char) fprintf(outfile,
- "First char disagreement: pcre_fullinfo=%d pcre_info=%d\n",
- first_char, old_first_char);
-
- if (old_options != options) fprintf(outfile,
- "Options disagreement: pcre_fullinfo=%d pcre_info=%d\n", options,
- old_options);
- }
-
- if (size != gotten_store) fprintf(outfile,
- "Size disagreement: pcre_fullinfo=%d call to malloc for %d\n",
- size, gotten_store);
-
- fprintf(outfile, "Capturing subpattern count = %d\n", count);
- if (backrefmax > 0)
- fprintf(outfile, "Max back reference = %d\n", backrefmax);
- if (options == 0) fprintf(outfile, "No options\n");
- else fprintf(outfile, "Options:%s%s%s%s%s%s%s%s%s\n",
- ((options & PCRE_ANCHORED) != 0)? " anchored" : "",
- ((options & PCRE_CASELESS) != 0)? " caseless" : "",
- ((options & PCRE_EXTENDED) != 0)? " extended" : "",
- ((options & PCRE_MULTILINE) != 0)? " multiline" : "",
- ((options & PCRE_DOTALL) != 0)? " dotall" : "",
- ((options & PCRE_DOLLAR_ENDONLY) != 0)? " dollar_endonly" : "",
- ((options & PCRE_EXTRA) != 0)? " extra" : "",
- ((options & PCRE_UNGREEDY) != 0)? " ungreedy" : "",
- ((options & PCRE_UTF8) != 0)? " utf8" : "");
-
- if (((((real_pcre *)re)->options) & PCRE_ICHANGED) != 0)
- fprintf(outfile, "Case state changes\n");
-
- if (first_char == -1)
- {
- fprintf(outfile, "First char at start or follows \\n\n");
- }
- else if (first_char < 0)
- {
- fprintf(outfile, "No first char\n");
- }
- else
- {
- if (isprint(first_char))
- fprintf(outfile, "First char = \'%c\'\n", first_char);
- else
- fprintf(outfile, "First char = %d\n", first_char);
- }
-
- if (need_char < 0)
- {
- fprintf(outfile, "No need char\n");
- }
- else
- {
- if (isprint(need_char))
- fprintf(outfile, "Need char = \'%c\'\n", need_char);
- else
- fprintf(outfile, "Need char = %d\n", need_char);
- }
- }
-
- /* If /S was present, study the regexp to generate additional info to
- help with the matching. */
-
- if (do_study)
- {
- if (timeit)
- {
- register int i;
- clock_t time_taken;
- clock_t start_time = clock();
- for (i = 0; i < LOOPREPEAT; i++)
- extra = pcre_study(re, study_options, &error);
- time_taken = clock() - start_time;
- if (extra != NULL) free(extra);
- fprintf(outfile, " Study time %.3f milliseconds\n",
- ((double)time_taken * 1000.0)/
- ((double)LOOPREPEAT * (double)CLOCKS_PER_SEC));
- }
-
- extra = pcre_study(re, study_options, &error);
- if (error != NULL)
- fprintf(outfile, "Failed to study: %s\n", error);
- else if (extra == NULL)
- fprintf(outfile, "Study returned NULL\n");
-
- else if (do_showinfo)
- {
- uschar *start_bits = NULL;
- new_info(re, extra, PCRE_INFO_FIRSTTABLE, &start_bits);
- if (start_bits == NULL)
- fprintf(outfile, "No starting character set\n");
- else
- {
- int i;
- int c = 24;
- fprintf(outfile, "Starting character set: ");
- for (i = 0; i < 256; i++)
- {
- if ((start_bits[i/8] & (1<<(i%8))) != 0)
- {
- if (c > 75)
- {
- fprintf(outfile, "\n ");
- c = 2;
- }
- if (isprint(i) && i != ' ')
- {
- fprintf(outfile, "%c ", i);
- c += 2;
- }
- else
- {
- fprintf(outfile, "\\x%02x ", i);
- c += 5;
- }
- }
- }
- fprintf(outfile, "\n");
- }
- }
- }
- }
-
- /* Read data lines and test them */
-
- for (;;)
- {
- unsigned char *q;
- unsigned char *bptr = dbuffer;
- int count, c;
- int copystrings = 0;
- int getstrings = 0;
- int getlist = 0;
- int gmatched = 0;
- int start_offset = 0;
- int g_notempty = 0;
- int offsets[45];
- int size_offsets = sizeof(offsets)/sizeof(int);
-
- options = 0;
-
- if (infile == stdin) printf("data> ");
- if (fgets((char *)buffer, sizeof(buffer), infile) == NULL)
- {
- done = 1;
- goto CONTINUE;
- }
- if (infile != stdin) fprintf(outfile, "%s", (char *)buffer);
-
- len = (int)strlen((char *)buffer);
- while (len > 0 && isspace(buffer[len-1])) len--;
- buffer[len] = 0;
- if (len == 0) break;
-
- p = buffer;
- while (isspace(*p)) p++;
-
- q = dbuffer;
- while ((c = *p++) != 0)
- {
- int i = 0;
- int n = 0;
- if (c == '\\') switch ((c = *p++))
- {
- case 'a': c = 7; break;
- case 'b': c = '\b'; break;
- case 'e': c = 27; break;
- case 'f': c = '\f'; break;
- case 'n': c = '\n'; break;
- case 'r': c = '\r'; break;
- case 't': c = '\t'; break;
- case 'v': c = '\v'; break;
-
- case '0': case '1': case '2': case '3':
- case '4': case '5': case '6': case '7':
- c -= '0';
- while (i++ < 2 && isdigit(*p) && *p != '8' && *p != '9')
- c = c * 8 + *p++ - '0';
- break;
-
- case 'x':
-
- /* Handle \x{..} specially - new Perl thing for utf8 */
-
- if (*p == '{')
- {
- unsigned char *pt = p;
- c = 0;
- while (isxdigit(*(++pt)))
- c = c * 16 + tolower(*pt) - ((isdigit(*pt))? '0' : 'W');
- if (*pt == '}')
- {
- unsigned char buffer[8];
- int ii, utn;
- utn = ord2utf8(c, buffer);
- for (ii = 0; ii < utn - 1; ii++) *q++ = buffer[ii];
- c = buffer[ii]; /* Last byte */
- p = pt + 1;
- break;
- }
- /* Not correct form; fall through */
- }
-
- /* Ordinary \x */
-
- c = 0;
- while (i++ < 2 && isxdigit(*p))
- {
- c = c * 16 + tolower(*p) - ((isdigit(*p))? '0' : 'W');
- p++;
- }
- break;
-
- case 0: /* Allows for an empty line */
- p--;
- continue;
-
- case 'A': /* Option setting */
- options |= PCRE_ANCHORED;
- continue;
-
- case 'B':
- options |= PCRE_NOTBOL;
- continue;
-
- case 'C':
- while(isdigit(*p)) n = n * 10 + *p++ - '0';
- copystrings |= 1 << n;
- continue;
-
- case 'G':
- while(isdigit(*p)) n = n * 10 + *p++ - '0';
- getstrings |= 1 << n;
- continue;
-
- case 'L':
- getlist = 1;
- continue;
-
- case 'N':
- options |= PCRE_NOTEMPTY;
- continue;
-
- case 'O':
- while(isdigit(*p)) n = n * 10 + *p++ - '0';
- if (n <= (int)(sizeof(offsets)/sizeof(int))) size_offsets = n;
- continue;
-
- case 'Z':
- options |= PCRE_NOTEOL;
- continue;
- }
- *q++ = c;
- }
- *q = 0;
- len = q - dbuffer;
-
- /* Handle matching via the POSIX interface, which does not
- support timing. */
-
-#if !defined NOPOSIX
- if (posix || do_posix)
- {
- int rc;
- int eflags = 0;
- regmatch_t pmatch[sizeof(offsets)/sizeof(int)];
- if ((options & PCRE_NOTBOL) != 0) eflags |= REG_NOTBOL;
- if ((options & PCRE_NOTEOL) != 0) eflags |= REG_NOTEOL;
-
- rc = regexec(&preg, (const char *)bptr, size_offsets, pmatch, eflags);
-
- if (rc != 0)
- {
- (void)regerror(rc, &preg, (char *)buffer, sizeof(buffer));
- fprintf(outfile, "No match: POSIX code %d: %s\n", rc, buffer);
- }
- else
- {
- size_t i;
- for (i = 0; i < size_offsets; i++)
- {
- if (pmatch[i].rm_so >= 0)
- {
- fprintf(outfile, "%2d: ", (int)i);
- pchars(dbuffer + pmatch[i].rm_so,
- pmatch[i].rm_eo - pmatch[i].rm_so, utf8);
- fprintf(outfile, "\n");
- if (i == 0 && do_showrest)
- {
- fprintf(outfile, " 0+ ");
- pchars(dbuffer + pmatch[i].rm_eo, len - pmatch[i].rm_eo, utf8);
- fprintf(outfile, "\n");
- }
- }
- }
- }
- }
-
- /* Handle matching via the native interface - repeats for /g and /G */
-
- else
-#endif /* !defined NOPOSIX */
-
- for (;; gmatched++) /* Loop for /g or /G */
- {
- if (timeit)
- {
- register int i;
- clock_t time_taken;
- clock_t start_time = clock();
- for (i = 0; i < LOOPREPEAT; i++)
- count = pcre_exec(re, extra, (char *)bptr, len,
- start_offset, options | g_notempty, offsets, size_offsets);
- time_taken = clock() - start_time;
- fprintf(outfile, "Execute time %.3f milliseconds\n",
- ((double)time_taken * 1000.0)/
- ((double)LOOPREPEAT * (double)CLOCKS_PER_SEC));
- }
-
- count = pcre_exec(re, extra, (char *)bptr, len,
- start_offset, options | g_notempty, offsets, size_offsets);
-
- if (count == 0)
- {
- fprintf(outfile, "Matched, but too many substrings\n");
- count = size_offsets/3;
- }
-
- /* Matched */
-
- if (count >= 0)
- {
- int i;
- for (i = 0; i < count * 2; i += 2)
- {
- if (offsets[i] < 0)
- fprintf(outfile, "%2d: <unset>\n", i/2);
- else
- {
- fprintf(outfile, "%2d: ", i/2);
- pchars(bptr + offsets[i], offsets[i+1] - offsets[i], utf8);
- fprintf(outfile, "\n");
- if (i == 0)
- {
- if (do_showrest)
- {
- fprintf(outfile, " 0+ ");
- pchars(bptr + offsets[i+1], len - offsets[i+1], utf8);
- fprintf(outfile, "\n");
- }
- }
- }
- }
-
- for (i = 0; i < 32; i++)
- {
- if ((copystrings & (1 << i)) != 0)
- {
- char copybuffer[16];
- int rc = pcre_copy_substring((char *)bptr, offsets, count,
- i, copybuffer, sizeof(copybuffer));
- if (rc < 0)
- fprintf(outfile, "copy substring %d failed %d\n", i, rc);
- else
- fprintf(outfile, "%2dC %s (%d)\n", i, copybuffer, rc);
- }
- }
-
- for (i = 0; i < 32; i++)
- {
- if ((getstrings & (1 << i)) != 0)
- {
- const char *substring;
- int rc = pcre_get_substring((char *)bptr, offsets, count,
- i, &substring);
- if (rc < 0)
- fprintf(outfile, "get substring %d failed %d\n", i, rc);
- else
- {
- fprintf(outfile, "%2dG %s (%d)\n", i, substring, rc);
- /* free((void *)substring); */
- pcre_free_substring(substring);
- }
- }
- }
-
- if (getlist)
- {
- const char **stringlist;
- int rc = pcre_get_substring_list((char *)bptr, offsets, count,
- &stringlist);
- if (rc < 0)
- fprintf(outfile, "get substring list failed %d\n", rc);
- else
- {
- for (i = 0; i < count; i++)
- fprintf(outfile, "%2dL %s\n", i, stringlist[i]);
- if (stringlist[i] != NULL)
- fprintf(outfile, "string list not terminated by NULL\n");
- /* free((void *)stringlist); */
- pcre_free_substring_list(stringlist);
- }
- }
- }
-
- /* Failed to match. If this is a /g or /G loop and we previously set
- g_notempty after a null match, this is not necessarily the end.
- We want to advance the start offset, and continue. Fudge the offset
- values to achieve this. We won't be at the end of the string - that
- was checked before setting g_notempty. */
-
- else
- {
- if (g_notempty != 0)
- {
- offsets[0] = start_offset;
- offsets[1] = start_offset + 1;
- }
- else
- {
- if (gmatched == 0) /* Error if no previous matches */
- {
- if (count == -1) fprintf(outfile, "No match\n");
- else fprintf(outfile, "Error %d\n", count);
- }
- break; /* Out of the /g loop */
- }
- }
-
- /* If not /g or /G we are done */
-
- if (!do_g && !do_G) break;
-
- /* If we have matched an empty string, first check to see if we are at
- the end of the subject. If so, the /g loop is over. Otherwise, mimic
- what Perl's /g options does. This turns out to be rather cunning. First
- we set PCRE_NOTEMPTY and PCRE_ANCHORED and try the match again at the
- same point. If this fails (picked up above) we advance to the next
- character. */
-
- g_notempty = 0;
- if (offsets[0] == offsets[1])
- {
- if (offsets[0] == len) break;
- g_notempty = PCRE_NOTEMPTY | PCRE_ANCHORED;
- }
-
- /* For /g, update the start offset, leaving the rest alone */
-
- if (do_g) start_offset = offsets[1];
-
- /* For /G, update the pointer and length */
-
- else
- {
- bptr += offsets[1];
- len -= offsets[1];
- }
- } /* End of loop for /g and /G */
- } /* End of loop for data lines */
-
- CONTINUE:
-
-#if !defined NOPOSIX
- if (posix || do_posix) regfree(&preg);
-#endif
-
- if (re != NULL) free(re);
- if (extra != NULL) free(extra);
- if (tables != NULL)
- {
- free((void *)tables);
- setlocale(LC_CTYPE, "C");
- }
- }
-
-fprintf(outfile, "\n");
-return 0;
-}
-
-/* End */
diff --git a/ext/pcre/pcrelib/perltest b/ext/pcre/pcrelib/perltest
deleted file mode 100755
index e6f797498c..0000000000
--- a/ext/pcre/pcrelib/perltest
+++ /dev/null
@@ -1,169 +0,0 @@
-#! /usr/bin/perl
-
-# Program for testing regular expressions with perl to check that PCRE handles
-# them the same.
-
-
-# Function for turning a string into a string of printing chars
-
-sub pchars {
-my($t) = "";
-
-foreach $c (split(//, $_[0]))
- {
- if (ord $c >= 32 && ord $c < 127) { $t .= $c; }
- else { $t .= sprintf("\\x%02x", ord $c); }
- }
-$t;
-}
-
-
-
-# Read lines from named file or stdin and write to named file or stdout; lines
-# consist of a regular expression, in delimiters and optionally followed by
-# options, followed by a set of test data, terminated by an empty line.
-
-# Sort out the input and output files
-
-if (@ARGV > 0)
- {
- open(INFILE, "<$ARGV[0]") || die "Failed to open $ARGV[0]\n";
- $infile = "INFILE";
- }
-else { $infile = "STDIN"; }
-
-if (@ARGV > 1)
- {
- open(OUTFILE, ">$ARGV[1]") || die "Failed to open $ARGV[1]\n";
- $outfile = "OUTFILE";
- }
-else { $outfile = "STDOUT"; }
-
-printf($outfile "Perl $] Regular Expressions\n\n");
-
-# Main loop
-
-NEXT_RE:
-for (;;)
- {
- printf " re> " if $infile eq "STDIN";
- last if ! ($_ = <$infile>);
- printf $outfile "$_" if $infile ne "STDIN";
- next if ($_ eq "");
-
- $pattern = $_;
-
- while ($pattern !~ /^\s*(.).*\1/s)
- {
- printf " > " if $infile eq "STDIN";
- last if ! ($_ = <$infile>);
- printf $outfile "$_" if $infile ne "STDIN";
- $pattern .= $_;
- }
-
- chomp($pattern);
- $pattern =~ s/\s+$//;
-
- # The private /+ modifier means "print $' afterwards". We use it
- # only on the end of patterns to make it easy to chop off here.
-
- $showrest = ($pattern =~ s/\+(?=[a-z]*$)//);
-
- # Check that the pattern is valid
-
- eval "\$_ =~ ${pattern}";
- if ($@)
- {
- printf $outfile "Error: $@";
- next NEXT_RE;
- }
-
- # If the /g modifier is present, we want to put a loop round the matching;
- # otherwise just a single "if".
-
- $cmd = ($pattern =~ /g[a-z]*$/)? "while" : "if";
-
- # If the pattern is actually the null string, Perl uses the most recently
- # executed (and successfully compiled) regex is used instead. This is a
- # nasty trap for the unwary! The PCRE test suite does contain null strings
- # in places - if they are allowed through here all sorts of weird and
- # unexpected effects happen. To avoid this, we replace such patterns with
- # a non-null pattern that has the same effect.
-
- $pattern = "/(?#)/$2" if ($pattern =~ /^(.)\1(.*)$/);
-
- # Read data lines and test them
-
- for (;;)
- {
- printf "data> " if $infile eq "STDIN";
- last NEXT_RE if ! ($_ = <$infile>);
- chomp;
- printf $outfile "$_\n" if $infile ne "STDIN";
-
- s/\s+$//;
- s/^\s+//;
-
- last if ($_ eq "");
-
- $x = eval "\"$_\""; # To get escapes processed
-
- # Empty array for holding results, then do the matching.
-
- @subs = ();
-
- eval "${cmd} (\$x =~ ${pattern}) {" .
- "push \@subs,\$&;" .
- "push \@subs,\$1;" .
- "push \@subs,\$2;" .
- "push \@subs,\$3;" .
- "push \@subs,\$4;" .
- "push \@subs,\$5;" .
- "push \@subs,\$6;" .
- "push \@subs,\$7;" .
- "push \@subs,\$8;" .
- "push \@subs,\$9;" .
- "push \@subs,\$10;" .
- "push \@subs,\$11;" .
- "push \@subs,\$12;" .
- "push \@subs,\$13;" .
- "push \@subs,\$14;" .
- "push \@subs,\$15;" .
- "push \@subs,\$16;" .
- "push \@subs,\$'; }";
-
- if ($@)
- {
- printf $outfile "Error: $@\n";
- next NEXT_RE;
- }
- elsif (scalar(@subs) == 0)
- {
- printf $outfile "No match\n";
- }
- else
- {
- while (scalar(@subs) != 0)
- {
- printf $outfile (" 0: %s\n", &pchars($subs[0]));
- printf $outfile (" 0+ %s\n", &pchars($subs[17])) if $showrest;
- $last_printed = 0;
- for ($i = 1; $i <= 16; $i++)
- {
- if (defined $subs[$i])
- {
- while ($last_printed++ < $i-1)
- { printf $outfile ("%2d: <unset>\n", $last_printed); }
- printf $outfile ("%2d: %s\n", $i, &pchars($subs[$i]));
- $last_printed = $i;
- }
- }
- splice(@subs, 0, 18);
- }
- }
- }
- }
-
-printf $outfile "\n";
-
-# End
diff --git a/ext/pcre/pcrelib/perltest8 b/ext/pcre/pcrelib/perltest8
deleted file mode 100755
index 2fe522d60d..0000000000
--- a/ext/pcre/pcrelib/perltest8
+++ /dev/null
@@ -1,208 +0,0 @@
-#! /usr/bin/perl
-
-# Program for testing regular expressions with perl to check that PCRE handles
-# them the same. This is the version that supports /8 for UTF-8 testing. It
-# requires at least Perl 5.6.
-
-
-# Function for turning a string into a string of printing chars. There are
-# currently problems with UTF-8 strings; this fudges round them.
-
-sub pchars {
-my($t) = "";
-
-if ($utf8)
- {
- use utf8;
- @p = unpack('U*', $_[0]);
- foreach $c (@p)
- {
- if ($c >= 32 && $c < 127) { $t .= chr $c; }
- else { $t .= sprintf("\\x{%02x}", $c); }
- }
- }
-
-else
- {
- foreach $c (split(//, $_[0]))
- {
- if (ord $c >= 32 && ord $c < 127) { $t .= $c; }
- else { $t .= sprintf("\\x%02x", ord $c); }
- }
- }
-
-$t;
-}
-
-
-
-# Read lines from named file or stdin and write to named file or stdout; lines
-# consist of a regular expression, in delimiters and optionally followed by
-# options, followed by a set of test data, terminated by an empty line.
-
-# Sort out the input and output files
-
-if (@ARGV > 0)
- {
- open(INFILE, "<$ARGV[0]") || die "Failed to open $ARGV[0]\n";
- $infile = "INFILE";
- }
-else { $infile = "STDIN"; }
-
-if (@ARGV > 1)
- {
- open(OUTFILE, ">$ARGV[1]") || die "Failed to open $ARGV[1]\n";
- $outfile = "OUTFILE";
- }
-else { $outfile = "STDOUT"; }
-
-printf($outfile "Perl $] Regular Expressions\n\n");
-
-# Main loop
-
-NEXT_RE:
-for (;;)
- {
- printf " re> " if $infile eq "STDIN";
- last if ! ($_ = <$infile>);
- printf $outfile "$_" if $infile ne "STDIN";
- next if ($_ eq "");
-
- $pattern = $_;
-
- while ($pattern !~ /^\s*(.).*\1/s)
- {
- printf " > " if $infile eq "STDIN";
- last if ! ($_ = <$infile>);
- printf $outfile "$_" if $infile ne "STDIN";
- $pattern .= $_;
- }
-
- chomp($pattern);
- $pattern =~ s/\s+$//;
-
- # The private /+ modifier means "print $' afterwards".
-
- $showrest = ($pattern =~ s/\+(?=[a-z]*$)//);
-
- # The private /8 modifier means "operate in UTF-8". Currently, Perl
- # has bugs that we try to work around using this flag.
-
- $utf8 = ($pattern =~ s/8(?=[a-z]*$)//);
-
- # Check that the pattern is valid
-
- if ($utf8)
- {
- use utf8;
- eval "\$_ =~ ${pattern}";
- }
- else
- {
- eval "\$_ =~ ${pattern}";
- }
-
- if ($@)
- {
- printf $outfile "Error: $@";
- next NEXT_RE;
- }
-
- # If the /g modifier is present, we want to put a loop round the matching;
- # otherwise just a single "if".
-
- $cmd = ($pattern =~ /g[a-z]*$/)? "while" : "if";
-
- # If the pattern is actually the null string, Perl uses the most recently
- # executed (and successfully compiled) regex is used instead. This is a
- # nasty trap for the unwary! The PCRE test suite does contain null strings
- # in places - if they are allowed through here all sorts of weird and
- # unexpected effects happen. To avoid this, we replace such patterns with
- # a non-null pattern that has the same effect.
-
- $pattern = "/(?#)/$2" if ($pattern =~ /^(.)\1(.*)$/);
-
- # Read data lines and test them
-
- for (;;)
- {
- printf "data> " if $infile eq "STDIN";
- last NEXT_RE if ! ($_ = <$infile>);
- chomp;
- printf $outfile "$_\n" if $infile ne "STDIN";
-
- s/\s+$//;
- s/^\s+//;
-
- last if ($_ eq "");
-
- $x = eval "\"$_\""; # To get escapes processed
-
- # Empty array for holding results, then do the matching.
-
- @subs = ();
-
- $pushes = "push \@subs,\$&;" .
- "push \@subs,\$1;" .
- "push \@subs,\$2;" .
- "push \@subs,\$3;" .
- "push \@subs,\$4;" .
- "push \@subs,\$5;" .
- "push \@subs,\$6;" .
- "push \@subs,\$7;" .
- "push \@subs,\$8;" .
- "push \@subs,\$9;" .
- "push \@subs,\$10;" .
- "push \@subs,\$11;" .
- "push \@subs,\$12;" .
- "push \@subs,\$13;" .
- "push \@subs,\$14;" .
- "push \@subs,\$15;" .
- "push \@subs,\$16;" .
- "push \@subs,\$'; }";
-
- if ($utf8)
- {
- use utf8;
- eval "${cmd} (\$x =~ ${pattern}) {" . $pushes;
- }
- else
- {
- eval "${cmd} (\$x =~ ${pattern}) {" . $pushes;
- }
-
- if ($@)
- {
- printf $outfile "Error: $@\n";
- next NEXT_RE;
- }
- elsif (scalar(@subs) == 0)
- {
- printf $outfile "No match\n";
- }
- else
- {
- while (scalar(@subs) != 0)
- {
- printf $outfile (" 0: %s\n", &pchars($subs[0]));
- printf $outfile (" 0+ %s\n", &pchars($subs[17])) if $showrest;
- $last_printed = 0;
- for ($i = 1; $i <= 16; $i++)
- {
- if (defined $subs[$i])
- {
- while ($last_printed++ < $i-1)
- { printf $outfile ("%2d: <unset>\n", $last_printed); }
- printf $outfile ("%2d: %s\n", $i, &pchars($subs[$i]));
- $last_printed = $i;
- }
- }
- splice(@subs, 0, 18);
- }
- }
- }
- }
-
-printf $outfile "\n";
-
-# End
diff --git a/ext/pcre/pcrelib/study.c b/ext/pcre/pcrelib/study.c
deleted file mode 100644
index 676db94665..0000000000
--- a/ext/pcre/pcrelib/study.c
+++ /dev/null
@@ -1,397 +0,0 @@
-/*************************************************
-* Perl-Compatible Regular Expressions *
-*************************************************/
-
-/*
-This is a library of functions to support regular expressions whose syntax
-and semantics are as close as possible to those of the Perl 5 language. See
-the file Tech.Notes for some information on the internals.
-
-Written by: Philip Hazel <ph10@cam.ac.uk>
-
- Copyright (c) 1997-2000 University of Cambridge
-
------------------------------------------------------------------------------
-Permission is granted to anyone to use this software for any purpose on any
-computer system, and to redistribute it freely, subject to the following
-restrictions:
-
-1. This software is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-
-2. The origin of this software must not be misrepresented, either by
- explicit claim or by omission.
-
-3. Altered versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
-
-4. If PCRE is embedded in any software that is released under the GNU
- General Purpose Licence (GPL), then the terms of that licence shall
- supersede any condition above with which it is incompatible.
------------------------------------------------------------------------------
-*/
-
-
-/* Include the internals header, which itself includes Standard C headers plus
-the external pcre header. */
-
-#include "internal.h"
-
-
-
-/*************************************************
-* Set a bit and maybe its alternate case *
-*************************************************/
-
-/* Given a character, set its bit in the table, and also the bit for the other
-version of a letter if we are caseless.
-
-Arguments:
- start_bits points to the bit map
- c is the character
- caseless the caseless flag
- cd the block with char table pointers
-
-Returns: nothing
-*/
-
-static void
-set_bit(uschar *start_bits, int c, BOOL caseless, compile_data *cd)
-{
-start_bits[c/8] |= (1 << (c&7));
-if (caseless && (cd->ctypes[c] & ctype_letter) != 0)
- start_bits[cd->fcc[c]/8] |= (1 << (cd->fcc[c]&7));
-}
-
-
-
-/*************************************************
-* Create bitmap of starting chars *
-*************************************************/
-
-/* This function scans a compiled unanchored expression and attempts to build a
-bitmap of the set of initial characters. If it can't, it returns FALSE. As time
-goes by, we may be able to get more clever at doing this.
-
-Arguments:
- code points to an expression
- start_bits points to a 32-byte table, initialized to 0
- caseless the current state of the caseless flag
- cd the block with char table pointers
-
-Returns: TRUE if table built, FALSE otherwise
-*/
-
-static BOOL
-set_start_bits(const uschar *code, uschar *start_bits, BOOL caseless,
- compile_data *cd)
-{
-register int c;
-
-/* This next statement and the later reference to dummy are here in order to
-trick the optimizer of the IBM C compiler for OS/2 into generating correct
-code. Apparently IBM isn't going to fix the problem, and we would rather not
-disable optimization (in this module it actually makes a big difference, and
-the pcre module can use all the optimization it can get). */
-
-volatile int dummy;
-
-do
- {
- const uschar *tcode = code + 3;
- BOOL try_next = TRUE;
-
- while (try_next)
- {
- try_next = FALSE;
-
- /* If a branch starts with a bracket or a positive lookahead assertion,
- recurse to set bits from within them. That's all for this branch. */
-
- if ((int)*tcode >= OP_BRA || *tcode == OP_ASSERT)
- {
- if (!set_start_bits(tcode, start_bits, caseless, cd))
- return FALSE;
- }
-
- else switch(*tcode)
- {
- default:
- return FALSE;
-
- /* Skip over lookbehind and negative lookahead assertions */
-
- case OP_ASSERT_NOT:
- case OP_ASSERTBACK:
- case OP_ASSERTBACK_NOT:
- try_next = TRUE;
- do tcode += (tcode[1] << 8) + tcode[2]; while (*tcode == OP_ALT);
- tcode += 3;
- break;
-
- /* Skip over an option setting, changing the caseless flag */
-
- case OP_OPT:
- caseless = (tcode[1] & PCRE_CASELESS) != 0;
- tcode += 2;
- try_next = TRUE;
- break;
-
- /* BRAZERO does the bracket, but carries on. */
-
- case OP_BRAZERO:
- case OP_BRAMINZERO:
- if (!set_start_bits(++tcode, start_bits, caseless, cd))
- return FALSE;
- dummy = 1;
- do tcode += (tcode[1] << 8) + tcode[2]; while (*tcode == OP_ALT);
- tcode += 3;
- try_next = TRUE;
- break;
-
- /* Single-char * or ? sets the bit and tries the next item */
-
- case OP_STAR:
- case OP_MINSTAR:
- case OP_QUERY:
- case OP_MINQUERY:
- set_bit(start_bits, tcode[1], caseless, cd);
- tcode += 2;
- try_next = TRUE;
- break;
-
- /* Single-char upto sets the bit and tries the next */
-
- case OP_UPTO:
- case OP_MINUPTO:
- set_bit(start_bits, tcode[3], caseless, cd);
- tcode += 4;
- try_next = TRUE;
- break;
-
- /* At least one single char sets the bit and stops */
-
- case OP_EXACT: /* Fall through */
- tcode++;
-
- case OP_CHARS: /* Fall through */
- tcode++;
-
- case OP_PLUS:
- case OP_MINPLUS:
- set_bit(start_bits, tcode[1], caseless, cd);
- break;
-
- /* Single character type sets the bits and stops */
-
- case OP_NOT_DIGIT:
- for (c = 0; c < 32; c++)
- start_bits[c] |= ~cd->cbits[c+cbit_digit];
- break;
-
- case OP_DIGIT:
- for (c = 0; c < 32; c++)
- start_bits[c] |= cd->cbits[c+cbit_digit];
- break;
-
- case OP_NOT_WHITESPACE:
- for (c = 0; c < 32; c++)
- start_bits[c] |= ~cd->cbits[c+cbit_space];
- break;
-
- case OP_WHITESPACE:
- for (c = 0; c < 32; c++)
- start_bits[c] |= cd->cbits[c+cbit_space];
- break;
-
- case OP_NOT_WORDCHAR:
- for (c = 0; c < 32; c++)
- start_bits[c] |= ~cd->cbits[c+cbit_word];
- break;
-
- case OP_WORDCHAR:
- for (c = 0; c < 32; c++)
- start_bits[c] |= cd->cbits[c+cbit_word];
- break;
-
- /* One or more character type fudges the pointer and restarts, knowing
- it will hit a single character type and stop there. */
-
- case OP_TYPEPLUS:
- case OP_TYPEMINPLUS:
- tcode++;
- try_next = TRUE;
- break;
-
- case OP_TYPEEXACT:
- tcode += 3;
- try_next = TRUE;
- break;
-
- /* Zero or more repeats of character types set the bits and then
- try again. */
-
- case OP_TYPEUPTO:
- case OP_TYPEMINUPTO:
- tcode += 2; /* Fall through */
-
- case OP_TYPESTAR:
- case OP_TYPEMINSTAR:
- case OP_TYPEQUERY:
- case OP_TYPEMINQUERY:
- switch(tcode[1])
- {
- case OP_NOT_DIGIT:
- for (c = 0; c < 32; c++)
- start_bits[c] |= ~cd->cbits[c+cbit_digit];
- break;
-
- case OP_DIGIT:
- for (c = 0; c < 32; c++)
- start_bits[c] |= cd->cbits[c+cbit_digit];
- break;
-
- case OP_NOT_WHITESPACE:
- for (c = 0; c < 32; c++)
- start_bits[c] |= ~cd->cbits[c+cbit_space];
- break;
-
- case OP_WHITESPACE:
- for (c = 0; c < 32; c++)
- start_bits[c] |= cd->cbits[c+cbit_space];
- break;
-
- case OP_NOT_WORDCHAR:
- for (c = 0; c < 32; c++)
- start_bits[c] |= ~cd->cbits[c+cbit_word];
- break;
-
- case OP_WORDCHAR:
- for (c = 0; c < 32; c++)
- start_bits[c] |= cd->cbits[c+cbit_word];
- break;
- }
-
- tcode += 2;
- try_next = TRUE;
- break;
-
- /* Character class: set the bits and either carry on or not,
- according to the repeat count. */
-
- case OP_CLASS:
- {
- tcode++;
- for (c = 0; c < 32; c++) start_bits[c] |= tcode[c];
- tcode += 32;
- switch (*tcode)
- {
- case OP_CRSTAR:
- case OP_CRMINSTAR:
- case OP_CRQUERY:
- case OP_CRMINQUERY:
- tcode++;
- try_next = TRUE;
- break;
-
- case OP_CRRANGE:
- case OP_CRMINRANGE:
- if (((tcode[1] << 8) + tcode[2]) == 0)
- {
- tcode += 5;
- try_next = TRUE;
- }
- break;
- }
- }
- break; /* End of class handling */
-
- } /* End of switch */
- } /* End of try_next loop */
-
- code += (code[1] << 8) + code[2]; /* Advance to next branch */
- }
-while (*code == OP_ALT);
-return TRUE;
-}
-
-
-
-/*************************************************
-* Study a compiled expression *
-*************************************************/
-
-/* This function is handed a compiled expression that it must study to produce
-information that will speed up the matching. It returns a pcre_extra block
-which then gets handed back to pcre_exec().
-
-Arguments:
- re points to the compiled expression
- options contains option bits
- errorptr points to where to place error messages;
- set NULL unless error
-
-Returns: pointer to a pcre_extra block,
- NULL on error or if no optimization possible
-*/
-
-pcre_extra *
-pcre_study(const pcre *external_re, int options, const char **errorptr)
-{
-uschar start_bits[32];
-real_pcre_extra *extra;
-const real_pcre *re = (const real_pcre *)external_re;
-compile_data compile_block;
-
-*errorptr = NULL;
-
-if (re == NULL || re->magic_number != MAGIC_NUMBER)
- {
- *errorptr = "argument is not a compiled regular expression";
- return NULL;
- }
-
-if ((options & ~PUBLIC_STUDY_OPTIONS) != 0)
- {
- *errorptr = "unknown or incorrect option bit(s) set";
- return NULL;
- }
-
-/* For an anchored pattern, or an unchored pattern that has a first char, or a
-multiline pattern that matches only at "line starts", no further processing at
-present. */
-
-if ((re->options & (PCRE_ANCHORED|PCRE_FIRSTSET|PCRE_STARTLINE)) != 0)
- return NULL;
-
-/* Set the character tables in the block which is passed around */
-
-compile_block.lcc = re->tables + lcc_offset;
-compile_block.fcc = re->tables + fcc_offset;
-compile_block.cbits = re->tables + cbits_offset;
-compile_block.ctypes = re->tables + ctypes_offset;
-
-/* See if we can find a fixed set of initial characters for the pattern. */
-
-memset(start_bits, 0, 32 * sizeof(uschar));
-if (!set_start_bits(re->code, start_bits, (re->options & PCRE_CASELESS) != 0,
- &compile_block)) return NULL;
-
-/* Get an "extra" block and put the information therein. */
-
-extra = (real_pcre_extra *)(pcre_malloc)(sizeof(real_pcre_extra));
-
-if (extra == NULL)
- {
- *errorptr = "failed to get memory";
- return NULL;
- }
-
-extra->options = PCRE_STUDY_MAPPED;
-memcpy(extra->start_bits, start_bits, sizeof(start_bits));
-
-return (pcre_extra *)extra;
-}
-
-/* End of study.c */
diff --git a/ext/pcre/pcrelib/testdata/testinput1 b/ext/pcre/pcrelib/testdata/testinput1
deleted file mode 100644
index 3a5c2cebaf..0000000000
--- a/ext/pcre/pcrelib/testdata/testinput1
+++ /dev/null
@@ -1,1922 +0,0 @@
-/the quick brown fox/
- the quick brown fox
- The quick brown FOX
- What do you know about the quick brown fox?
- What do you know about THE QUICK BROWN FOX?
-
-/The quick brown fox/i
- the quick brown fox
- The quick brown FOX
- What do you know about the quick brown fox?
- What do you know about THE QUICK BROWN FOX?
-
-/abcd\t\n\r\f\a\e\071\x3b\$\\\?caxyz/
- abcd\t\n\r\f\a\e9;\$\\?caxyz
-
-/a*abc?xyz+pqr{3}ab{2,}xy{4,5}pq{0,6}AB{0,}zz/
- abxyzpqrrrabbxyyyypqAzz
- abxyzpqrrrabbxyyyypqAzz
- aabxyzpqrrrabbxyyyypqAzz
- aaabxyzpqrrrabbxyyyypqAzz
- aaaabxyzpqrrrabbxyyyypqAzz
- abcxyzpqrrrabbxyyyypqAzz
- aabcxyzpqrrrabbxyyyypqAzz
- aaabcxyzpqrrrabbxyyyypAzz
- aaabcxyzpqrrrabbxyyyypqAzz
- aaabcxyzpqrrrabbxyyyypqqAzz
- aaabcxyzpqrrrabbxyyyypqqqAzz
- aaabcxyzpqrrrabbxyyyypqqqqAzz
- aaabcxyzpqrrrabbxyyyypqqqqqAzz
- aaabcxyzpqrrrabbxyyyypqqqqqqAzz
- aaaabcxyzpqrrrabbxyyyypqAzz
- abxyzzpqrrrabbxyyyypqAzz
- aabxyzzzpqrrrabbxyyyypqAzz
- aaabxyzzzzpqrrrabbxyyyypqAzz
- aaaabxyzzzzpqrrrabbxyyyypqAzz
- abcxyzzpqrrrabbxyyyypqAzz
- aabcxyzzzpqrrrabbxyyyypqAzz
- aaabcxyzzzzpqrrrabbxyyyypqAzz
- aaaabcxyzzzzpqrrrabbxyyyypqAzz
- aaaabcxyzzzzpqrrrabbbxyyyypqAzz
- aaaabcxyzzzzpqrrrabbbxyyyyypqAzz
- aaabcxyzpqrrrabbxyyyypABzz
- aaabcxyzpqrrrabbxyyyypABBzz
- >>>aaabxyzpqrrrabbxyyyypqAzz
- >aaaabxyzpqrrrabbxyyyypqAzz
- >>>>abcxyzpqrrrabbxyyyypqAzz
- *** Failers
- abxyzpqrrabbxyyyypqAzz
- abxyzpqrrrrabbxyyyypqAzz
- abxyzpqrrrabxyyyypqAzz
- aaaabcxyzzzzpqrrrabbbxyyyyyypqAzz
- aaaabcxyzzzzpqrrrabbbxyyypqAzz
- aaabcxyzpqrrrabbxyyyypqqqqqqqAzz
-
-/^(abc){1,2}zz/
- abczz
- abcabczz
- *** Failers
- zz
- abcabcabczz
- >>abczz
-
-/^(b+?|a){1,2}?c/
- bc
- bbc
- bbbc
- bac
- bbac
- aac
- abbbbbbbbbbbc
- bbbbbbbbbbbac
- *** Failers
- aaac
- abbbbbbbbbbbac
-
-/^(b+|a){1,2}c/
- bc
- bbc
- bbbc
- bac
- bbac
- aac
- abbbbbbbbbbbc
- bbbbbbbbbbbac
- *** Failers
- aaac
- abbbbbbbbbbbac
-
-/^(b+|a){1,2}?bc/
- bbc
-
-/^(b*|ba){1,2}?bc/
- babc
- bbabc
- bababc
- *** Failers
- bababbc
- babababc
-
-/^(ba|b*){1,2}?bc/
- babc
- bbabc
- bababc
- *** Failers
- bababbc
- babababc
-
-/^\ca\cA\c[\c{\c:/
- \x01\x01\e;z
-
-/^[ab\]cde]/
- athing
- bthing
- ]thing
- cthing
- dthing
- ething
- *** Failers
- fthing
- [thing
- \\thing
-
-/^[]cde]/
- ]thing
- cthing
- dthing
- ething
- *** Failers
- athing
- fthing
-
-/^[^ab\]cde]/
- fthing
- [thing
- \\thing
- *** Failers
- athing
- bthing
- ]thing
- cthing
- dthing
- ething
-
-/^[^]cde]/
- athing
- fthing
- *** Failers
- ]thing
- cthing
- dthing
- ething
-
-/^\/
-
-
-/^ÿ/
- ÿ
-
-/^[0-9]+$/
- 0
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 100
- *** Failers
- abc
-
-/^.*nter/
- enter
- inter
- uponter
-
-/^xxx[0-9]+$/
- xxx0
- xxx1234
- *** Failers
- xxx
-
-/^.+[0-9][0-9][0-9]$/
- x123
- xx123
- 123456
- *** Failers
- 123
- x1234
-
-/^.+?[0-9][0-9][0-9]$/
- x123
- xx123
- 123456
- *** Failers
- 123
- x1234
-
-/^([^!]+)!(.+)=apquxz\.ixr\.zzz\.ac\.uk$/
- abc!pqr=apquxz.ixr.zzz.ac.uk
- *** Failers
- !pqr=apquxz.ixr.zzz.ac.uk
- abc!=apquxz.ixr.zzz.ac.uk
- abc!pqr=apquxz:ixr.zzz.ac.uk
- abc!pqr=apquxz.ixr.zzz.ac.ukk
-
-/:/
- Well, we need a colon: somewhere
- *** Fail if we don't
-
-/([\da-f:]+)$/i
- 0abc
- abc
- fed
- E
- ::
- 5f03:12C0::932e
- fed def
- Any old stuff
- *** Failers
- 0zzz
- gzzz
- fed\x20
- Any old rubbish
-
-/^.*\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/
- .1.2.3
- A.12.123.0
- *** Failers
- .1.2.3333
- 1.2.3
- 1234.2.3
-
-/^(\d+)\s+IN\s+SOA\s+(\S+)\s+(\S+)\s*\(\s*$/
- 1 IN SOA non-sp1 non-sp2(
- 1 IN SOA non-sp1 non-sp2 (
- *** Failers
- 1IN SOA non-sp1 non-sp2(
-
-/^[a-zA-Z\d][a-zA-Z\d\-]*(\.[a-zA-Z\d][a-zA-z\d\-]*)*\.$/
- a.
- Z.
- 2.
- ab-c.pq-r.
- sxk.zzz.ac.uk.
- x-.y-.
- *** Failers
- -abc.peq.
-
-/^\*\.[a-z]([a-z\-\d]*[a-z\d]+)?(\.[a-z]([a-z\-\d]*[a-z\d]+)?)*$/
- *.a
- *.b0-a
- *.c3-b.c
- *.c-a.b-c
- *** Failers
- *.0
- *.a-
- *.a-b.c-
- *.c-a.0-c
-
-/^(?=ab(de))(abd)(e)/
- abde
-
-/^(?!(ab)de|x)(abd)(f)/
- abdf
-
-/^(?=(ab(cd)))(ab)/
- abcd
-
-/^[\da-f](\.[\da-f])*$/i
- a.b.c.d
- A.B.C.D
- a.b.c.1.2.3.C
-
-/^\".*\"\s*(;.*)?$/
- \"1234\"
- \"abcd\" ;
- \"\" ; rhubarb
- *** Failers
- \"1234\" : things
-
-/^$/
- \
- *** Failers
-
-/ ^ a (?# begins with a) b\sc (?# then b c) $ (?# then end)/x
- ab c
- *** Failers
- abc
- ab cde
-
-/(?x) ^ a (?# begins with a) b\sc (?# then b c) $ (?# then end)/
- ab c
- *** Failers
- abc
- ab cde
-
-/^ a\ b[c ]d $/x
- a bcd
- a b d
- *** Failers
- abcd
- ab d
-
-/^(a(b(c)))(d(e(f)))(h(i(j)))(k(l(m)))$/
- abcdefhijklm
-
-/^(?:a(b(c)))(?:d(e(f)))(?:h(i(j)))(?:k(l(m)))$/
- abcdefhijklm
-
-/^[\w][\W][\s][\S][\d][\D][\b][\n][\c]][\022]/
- a+ Z0+\x08\n\x1d\x12
-
-/^[.^$|()*+?{,}]+/
- .^\$(*+)|{?,?}
-
-/^a*\w/
- z
- az
- aaaz
- a
- aa
- aaaa
- a+
- aa+
-
-/^a*?\w/
- z
- az
- aaaz
- a
- aa
- aaaa
- a+
- aa+
-
-/^a+\w/
- az
- aaaz
- aa
- aaaa
- aa+
-
-/^a+?\w/
- az
- aaaz
- aa
- aaaa
- aa+
-
-/^\d{8}\w{2,}/
- 1234567890
- 12345678ab
- 12345678__
- *** Failers
- 1234567
-
-/^[aeiou\d]{4,5}$/
- uoie
- 1234
- 12345
- aaaaa
- *** Failers
- 123456
-
-/^[aeiou\d]{4,5}?/
- uoie
- 1234
- 12345
- aaaaa
- 123456
-
-/\A(abc|def)=(\1){2,3}\Z/
- abc=abcabc
- def=defdefdef
- *** Failers
- abc=defdef
-
-/^(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)\11*(\3\4)\1(?#)2$/
- abcdefghijkcda2
- abcdefghijkkkkcda2
-
-/(cat(a(ract|tonic)|erpillar)) \1()2(3)/
- cataract cataract23
- catatonic catatonic23
- caterpillar caterpillar23
-
-
-/^From +([^ ]+) +[a-zA-Z][a-zA-Z][a-zA-Z] +[a-zA-Z][a-zA-Z][a-zA-Z] +[0-9]?[0-9] +[0-9][0-9]:[0-9][0-9]/
- From abcd Mon Sep 01 12:33:02 1997
-
-/^From\s+\S+\s+([a-zA-Z]{3}\s+){2}\d{1,2}\s+\d\d:\d\d/
- From abcd Mon Sep 01 12:33:02 1997
- From abcd Mon Sep 1 12:33:02 1997
- *** Failers
- From abcd Sep 01 12:33:02 1997
-
-/^12.34/s
- 12\n34
- 12\r34
-
-/\w+(?=\t)/
- the quick brown\t fox
-
-/foo(?!bar)(.*)/
- foobar is foolish see?
-
-/(?:(?!foo)...|^.{0,2})bar(.*)/
- foobar crowbar etc
- barrel
- 2barrel
- A barrel
-
-/^(\D*)(?=\d)(?!123)/
- abc456
- *** Failers
- abc123
-
-/^1234(?# test newlines
- inside)/
- 1234
-
-/^1234 #comment in extended re
- /x
- 1234
-
-/#rhubarb
- abcd/x
- abcd
-
-/^abcd#rhubarb/x
- abcd
-
-/^(a)\1{2,3}(.)/
- aaab
- aaaab
- aaaaab
- aaaaaab
-
-/(?!^)abc/
- the abc
- *** Failers
- abc
-
-/(?=^)abc/
- abc
- *** Failers
- the abc
-
-/^[ab]{1,3}(ab*|b)/
- aabbbbb
-
-/^[ab]{1,3}?(ab*|b)/
- aabbbbb
-
-/^[ab]{1,3}?(ab*?|b)/
- aabbbbb
-
-/^[ab]{1,3}(ab*?|b)/
- aabbbbb
-
-/ (?: [\040\t] | \(
-(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
-\) )* # optional leading comment
-(?: (?:
-[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
-(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
-|
-" (?: # opening quote...
-[^\\\x80-\xff\n\015"] # Anything except backslash and quote
-| # or
-\\ [^\x80-\xff] # Escaped something (something != CR)
-)* " # closing quote
-) # initial word
-(?: (?: [\040\t] | \(
-(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
-\) )* \. (?: [\040\t] | \(
-(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
-\) )* (?:
-[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
-(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
-|
-" (?: # opening quote...
-[^\\\x80-\xff\n\015"] # Anything except backslash and quote
-| # or
-\\ [^\x80-\xff] # Escaped something (something != CR)
-)* " # closing quote
-) )* # further okay, if led by a period
-(?: [\040\t] | \(
-(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
-\) )* @ (?: [\040\t] | \(
-(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
-\) )* (?:
-[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
-(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
-| \[ # [
-(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
-\] # ]
-) # initial subdomain
-(?: #
-(?: [\040\t] | \(
-(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
-\) )* \. # if led by a period...
-(?: [\040\t] | \(
-(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
-\) )* (?:
-[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
-(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
-| \[ # [
-(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
-\] # ]
-) # ...further okay
-)*
-# address
-| # or
-(?:
-[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
-(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
-|
-" (?: # opening quote...
-[^\\\x80-\xff\n\015"] # Anything except backslash and quote
-| # or
-\\ [^\x80-\xff] # Escaped something (something != CR)
-)* " # closing quote
-) # one word, optionally followed by....
-(?:
-[^()<>@,;:".\\\[\]\x80-\xff\000-\010\012-\037] | # atom and space parts, or...
-\(
-(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
-\) | # comments, or...
-
-" (?: # opening quote...
-[^\\\x80-\xff\n\015"] # Anything except backslash and quote
-| # or
-\\ [^\x80-\xff] # Escaped something (something != CR)
-)* " # closing quote
-# quoted strings
-)*
-< (?: [\040\t] | \(
-(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
-\) )* # leading <
-(?: @ (?: [\040\t] | \(
-(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
-\) )* (?:
-[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
-(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
-| \[ # [
-(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
-\] # ]
-) # initial subdomain
-(?: #
-(?: [\040\t] | \(
-(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
-\) )* \. # if led by a period...
-(?: [\040\t] | \(
-(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
-\) )* (?:
-[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
-(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
-| \[ # [
-(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
-\] # ]
-) # ...further okay
-)*
-
-(?: (?: [\040\t] | \(
-(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
-\) )* , (?: [\040\t] | \(
-(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
-\) )* @ (?: [\040\t] | \(
-(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
-\) )* (?:
-[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
-(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
-| \[ # [
-(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
-\] # ]
-) # initial subdomain
-(?: #
-(?: [\040\t] | \(
-(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
-\) )* \. # if led by a period...
-(?: [\040\t] | \(
-(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
-\) )* (?:
-[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
-(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
-| \[ # [
-(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
-\] # ]
-) # ...further okay
-)*
-)* # further okay, if led by comma
-: # closing colon
-(?: [\040\t] | \(
-(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
-\) )* )? # optional route
-(?:
-[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
-(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
-|
-" (?: # opening quote...
-[^\\\x80-\xff\n\015"] # Anything except backslash and quote
-| # or
-\\ [^\x80-\xff] # Escaped something (something != CR)
-)* " # closing quote
-) # initial word
-(?: (?: [\040\t] | \(
-(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
-\) )* \. (?: [\040\t] | \(
-(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
-\) )* (?:
-[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
-(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
-|
-" (?: # opening quote...
-[^\\\x80-\xff\n\015"] # Anything except backslash and quote
-| # or
-\\ [^\x80-\xff] # Escaped something (something != CR)
-)* " # closing quote
-) )* # further okay, if led by a period
-(?: [\040\t] | \(
-(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
-\) )* @ (?: [\040\t] | \(
-(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
-\) )* (?:
-[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
-(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
-| \[ # [
-(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
-\] # ]
-) # initial subdomain
-(?: #
-(?: [\040\t] | \(
-(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
-\) )* \. # if led by a period...
-(?: [\040\t] | \(
-(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
-\) )* (?:
-[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
-(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
-| \[ # [
-(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
-\] # ]
-) # ...further okay
-)*
-# address spec
-(?: [\040\t] | \(
-(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
-\) )* > # trailing >
-# name and address
-) (?: [\040\t] | \(
-(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
-\) )* # optional trailing comment
-/x
- Alan Other <user\@dom.ain>
- <user\@dom.ain>
- user\@dom.ain
- \"A. Other\" <user.1234\@dom.ain> (a comment)
- A. Other <user.1234\@dom.ain> (a comment)
- \"/s=user/ou=host/o=place/prmd=uu.yy/admd= /c=gb/\"\@x400-re.lay
- A missing angle <user\@some.where
- *** Failers
- The quick brown fox
-
-/[\040\t]* # Nab whitespace.
-(?:
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: # (
-(?: \\ [^\x80-\xff] |
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
-\) # )
-) # special
-[^\\\x80-\xff\n\015()] * # normal*
-)* # )*
-\) # )
-[\040\t]* )* # If comment found, allow more spaces.
-# optional leading comment
-(?:
-(?:
-[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
-(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
-# Atom
-| # or
-" # "
-[^\\\x80-\xff\n\015"] * # normal
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015"] * )* # ( special normal* )*
-" # "
-# Quoted string
-)
-[\040\t]* # Nab whitespace.
-(?:
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: # (
-(?: \\ [^\x80-\xff] |
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
-\) # )
-) # special
-[^\\\x80-\xff\n\015()] * # normal*
-)* # )*
-\) # )
-[\040\t]* )* # If comment found, allow more spaces.
-(?:
-\.
-[\040\t]* # Nab whitespace.
-(?:
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: # (
-(?: \\ [^\x80-\xff] |
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
-\) # )
-) # special
-[^\\\x80-\xff\n\015()] * # normal*
-)* # )*
-\) # )
-[\040\t]* )* # If comment found, allow more spaces.
-(?:
-[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
-(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
-# Atom
-| # or
-" # "
-[^\\\x80-\xff\n\015"] * # normal
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015"] * )* # ( special normal* )*
-" # "
-# Quoted string
-)
-[\040\t]* # Nab whitespace.
-(?:
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: # (
-(?: \\ [^\x80-\xff] |
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
-\) # )
-) # special
-[^\\\x80-\xff\n\015()] * # normal*
-)* # )*
-\) # )
-[\040\t]* )* # If comment found, allow more spaces.
-# additional words
-)*
-@
-[\040\t]* # Nab whitespace.
-(?:
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: # (
-(?: \\ [^\x80-\xff] |
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
-\) # )
-) # special
-[^\\\x80-\xff\n\015()] * # normal*
-)* # )*
-\) # )
-[\040\t]* )* # If comment found, allow more spaces.
-(?:
-[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
-(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
-|
-\[ # [
-(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
-\] # ]
-)
-[\040\t]* # Nab whitespace.
-(?:
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: # (
-(?: \\ [^\x80-\xff] |
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
-\) # )
-) # special
-[^\\\x80-\xff\n\015()] * # normal*
-)* # )*
-\) # )
-[\040\t]* )* # If comment found, allow more spaces.
-# optional trailing comments
-(?:
-\.
-[\040\t]* # Nab whitespace.
-(?:
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: # (
-(?: \\ [^\x80-\xff] |
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
-\) # )
-) # special
-[^\\\x80-\xff\n\015()] * # normal*
-)* # )*
-\) # )
-[\040\t]* )* # If comment found, allow more spaces.
-(?:
-[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
-(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
-|
-\[ # [
-(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
-\] # ]
-)
-[\040\t]* # Nab whitespace.
-(?:
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: # (
-(?: \\ [^\x80-\xff] |
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
-\) # )
-) # special
-[^\\\x80-\xff\n\015()] * # normal*
-)* # )*
-\) # )
-[\040\t]* )* # If comment found, allow more spaces.
-# optional trailing comments
-)*
-# address
-| # or
-(?:
-[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
-(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
-# Atom
-| # or
-" # "
-[^\\\x80-\xff\n\015"] * # normal
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015"] * )* # ( special normal* )*
-" # "
-# Quoted string
-)
-# leading word
-[^()<>@,;:".\\\[\]\x80-\xff\000-\010\012-\037] * # "normal" atoms and or spaces
-(?:
-(?:
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: # (
-(?: \\ [^\x80-\xff] |
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
-\) # )
-) # special
-[^\\\x80-\xff\n\015()] * # normal*
-)* # )*
-\) # )
-|
-" # "
-[^\\\x80-\xff\n\015"] * # normal
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015"] * )* # ( special normal* )*
-" # "
-) # "special" comment or quoted string
-[^()<>@,;:".\\\[\]\x80-\xff\000-\010\012-\037] * # more "normal"
-)*
-<
-[\040\t]* # Nab whitespace.
-(?:
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: # (
-(?: \\ [^\x80-\xff] |
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
-\) # )
-) # special
-[^\\\x80-\xff\n\015()] * # normal*
-)* # )*
-\) # )
-[\040\t]* )* # If comment found, allow more spaces.
-# <
-(?:
-@
-[\040\t]* # Nab whitespace.
-(?:
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: # (
-(?: \\ [^\x80-\xff] |
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
-\) # )
-) # special
-[^\\\x80-\xff\n\015()] * # normal*
-)* # )*
-\) # )
-[\040\t]* )* # If comment found, allow more spaces.
-(?:
-[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
-(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
-|
-\[ # [
-(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
-\] # ]
-)
-[\040\t]* # Nab whitespace.
-(?:
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: # (
-(?: \\ [^\x80-\xff] |
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
-\) # )
-) # special
-[^\\\x80-\xff\n\015()] * # normal*
-)* # )*
-\) # )
-[\040\t]* )* # If comment found, allow more spaces.
-# optional trailing comments
-(?:
-\.
-[\040\t]* # Nab whitespace.
-(?:
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: # (
-(?: \\ [^\x80-\xff] |
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
-\) # )
-) # special
-[^\\\x80-\xff\n\015()] * # normal*
-)* # )*
-\) # )
-[\040\t]* )* # If comment found, allow more spaces.
-(?:
-[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
-(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
-|
-\[ # [
-(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
-\] # ]
-)
-[\040\t]* # Nab whitespace.
-(?:
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: # (
-(?: \\ [^\x80-\xff] |
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
-\) # )
-) # special
-[^\\\x80-\xff\n\015()] * # normal*
-)* # )*
-\) # )
-[\040\t]* )* # If comment found, allow more spaces.
-# optional trailing comments
-)*
-(?: ,
-[\040\t]* # Nab whitespace.
-(?:
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: # (
-(?: \\ [^\x80-\xff] |
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
-\) # )
-) # special
-[^\\\x80-\xff\n\015()] * # normal*
-)* # )*
-\) # )
-[\040\t]* )* # If comment found, allow more spaces.
-@
-[\040\t]* # Nab whitespace.
-(?:
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: # (
-(?: \\ [^\x80-\xff] |
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
-\) # )
-) # special
-[^\\\x80-\xff\n\015()] * # normal*
-)* # )*
-\) # )
-[\040\t]* )* # If comment found, allow more spaces.
-(?:
-[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
-(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
-|
-\[ # [
-(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
-\] # ]
-)
-[\040\t]* # Nab whitespace.
-(?:
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: # (
-(?: \\ [^\x80-\xff] |
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
-\) # )
-) # special
-[^\\\x80-\xff\n\015()] * # normal*
-)* # )*
-\) # )
-[\040\t]* )* # If comment found, allow more spaces.
-# optional trailing comments
-(?:
-\.
-[\040\t]* # Nab whitespace.
-(?:
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: # (
-(?: \\ [^\x80-\xff] |
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
-\) # )
-) # special
-[^\\\x80-\xff\n\015()] * # normal*
-)* # )*
-\) # )
-[\040\t]* )* # If comment found, allow more spaces.
-(?:
-[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
-(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
-|
-\[ # [
-(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
-\] # ]
-)
-[\040\t]* # Nab whitespace.
-(?:
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: # (
-(?: \\ [^\x80-\xff] |
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
-\) # )
-) # special
-[^\\\x80-\xff\n\015()] * # normal*
-)* # )*
-\) # )
-[\040\t]* )* # If comment found, allow more spaces.
-# optional trailing comments
-)*
-)* # additional domains
-:
-[\040\t]* # Nab whitespace.
-(?:
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: # (
-(?: \\ [^\x80-\xff] |
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
-\) # )
-) # special
-[^\\\x80-\xff\n\015()] * # normal*
-)* # )*
-\) # )
-[\040\t]* )* # If comment found, allow more spaces.
-# optional trailing comments
-)? # optional route
-(?:
-[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
-(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
-# Atom
-| # or
-" # "
-[^\\\x80-\xff\n\015"] * # normal
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015"] * )* # ( special normal* )*
-" # "
-# Quoted string
-)
-[\040\t]* # Nab whitespace.
-(?:
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: # (
-(?: \\ [^\x80-\xff] |
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
-\) # )
-) # special
-[^\\\x80-\xff\n\015()] * # normal*
-)* # )*
-\) # )
-[\040\t]* )* # If comment found, allow more spaces.
-(?:
-\.
-[\040\t]* # Nab whitespace.
-(?:
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: # (
-(?: \\ [^\x80-\xff] |
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
-\) # )
-) # special
-[^\\\x80-\xff\n\015()] * # normal*
-)* # )*
-\) # )
-[\040\t]* )* # If comment found, allow more spaces.
-(?:
-[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
-(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
-# Atom
-| # or
-" # "
-[^\\\x80-\xff\n\015"] * # normal
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015"] * )* # ( special normal* )*
-" # "
-# Quoted string
-)
-[\040\t]* # Nab whitespace.
-(?:
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: # (
-(?: \\ [^\x80-\xff] |
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
-\) # )
-) # special
-[^\\\x80-\xff\n\015()] * # normal*
-)* # )*
-\) # )
-[\040\t]* )* # If comment found, allow more spaces.
-# additional words
-)*
-@
-[\040\t]* # Nab whitespace.
-(?:
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: # (
-(?: \\ [^\x80-\xff] |
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
-\) # )
-) # special
-[^\\\x80-\xff\n\015()] * # normal*
-)* # )*
-\) # )
-[\040\t]* )* # If comment found, allow more spaces.
-(?:
-[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
-(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
-|
-\[ # [
-(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
-\] # ]
-)
-[\040\t]* # Nab whitespace.
-(?:
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: # (
-(?: \\ [^\x80-\xff] |
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
-\) # )
-) # special
-[^\\\x80-\xff\n\015()] * # normal*
-)* # )*
-\) # )
-[\040\t]* )* # If comment found, allow more spaces.
-# optional trailing comments
-(?:
-\.
-[\040\t]* # Nab whitespace.
-(?:
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: # (
-(?: \\ [^\x80-\xff] |
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
-\) # )
-) # special
-[^\\\x80-\xff\n\015()] * # normal*
-)* # )*
-\) # )
-[\040\t]* )* # If comment found, allow more spaces.
-(?:
-[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
-(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
-|
-\[ # [
-(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
-\] # ]
-)
-[\040\t]* # Nab whitespace.
-(?:
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: # (
-(?: \\ [^\x80-\xff] |
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
-\) # )
-) # special
-[^\\\x80-\xff\n\015()] * # normal*
-)* # )*
-\) # )
-[\040\t]* )* # If comment found, allow more spaces.
-# optional trailing comments
-)*
-# address spec
-> # >
-# name and address
-)
-/x
- Alan Other <user\@dom.ain>
- <user\@dom.ain>
- user\@dom.ain
- \"A. Other\" <user.1234\@dom.ain> (a comment)
- A. Other <user.1234\@dom.ain> (a comment)
- \"/s=user/ou=host/o=place/prmd=uu.yy/admd= /c=gb/\"\@x400-re.lay
- A missing angle <user\@some.where
- *** Failers
- The quick brown fox
-
-/abc\0def\00pqr\000xyz\0000AB/
- abc\0def\00pqr\000xyz\0000AB
- abc456 abc\0def\00pqr\000xyz\0000ABCDE
-
-/abc\x0def\x00pqr\x000xyz\x0000AB/
- abc\x0def\x00pqr\x000xyz\x0000AB
- abc456 abc\x0def\x00pqr\x000xyz\x0000ABCDE
-
-/^[\000-\037]/
- \0A
- \01B
- \037C
-
-/\0*/
- \0\0\0\0
-
-/A\x0{2,3}Z/
- The A\x0\x0Z
- An A\0\x0\0Z
- *** Failers
- A\0Z
- A\0\x0\0\x0Z
-
-/^(cow|)\1(bell)/
- cowcowbell
- bell
- *** Failers
- cowbell
-
-/^\s/
- \040abc
- \x0cabc
- \nabc
- \rabc
- \tabc
- *** Failers
- abc
-
-/^a b
-
- c/x
- abc
-
-/^(a|)\1*b/
- ab
- aaaab
- b
- *** Failers
- acb
-
-/^(a|)\1+b/
- aab
- aaaab
- b
- *** Failers
- ab
-
-/^(a|)\1?b/
- ab
- aab
- b
- *** Failers
- acb
-
-/^(a|)\1{2}b/
- aaab
- b
- *** Failers
- ab
- aab
- aaaab
-
-/^(a|)\1{2,3}b/
- aaab
- aaaab
- b
- *** Failers
- ab
- aab
- aaaaab
-
-/ab{1,3}bc/
- abbbbc
- abbbc
- abbc
- *** Failers
- abc
- abbbbbc
-
-/([^.]*)\.([^:]*):[T ]+(.*)/
- track1.title:TBlah blah blah
-
-/([^.]*)\.([^:]*):[T ]+(.*)/i
- track1.title:TBlah blah blah
-
-/([^.]*)\.([^:]*):[t ]+(.*)/i
- track1.title:TBlah blah blah
-
-/^[W-c]+$/
- WXY_^abc
- ***Failers
- wxy
-
-/^[W-c]+$/i
- WXY_^abc
- wxy_^ABC
-
-/^[\x3f-\x5F]+$/i
- WXY_^abc
- wxy_^ABC
-
-/^abc$/m
- abc
- qqq\nabc
- abc\nzzz
- qqq\nabc\nzzz
-
-/^abc$/
- abc
- *** Failers
- qqq\nabc
- abc\nzzz
- qqq\nabc\nzzz
-
-/\Aabc\Z/m
- abc
- abc\n
- *** Failers
- qqq\nabc
- abc\nzzz
- qqq\nabc\nzzz
-
-/\A(.)*\Z/s
- abc\ndef
-
-/\A(.)*\Z/m
- *** Failers
- abc\ndef
-
-/(?:b)|(?::+)/
- b::c
- c::b
-
-/[-az]+/
- az-
- *** Failers
- b
-
-/[az-]+/
- za-
- *** Failers
- b
-
-/[a\-z]+/
- a-z
- *** Failers
- b
-
-/[a-z]+/
- abcdxyz
-
-/[\d-]+/
- 12-34
- *** Failers
- aaa
-
-/[\d-z]+/
- 12-34z
- *** Failers
- aaa
-
-/\x5c/
- \\
-
-/\x20Z/
- the Zoo
- *** Failers
- Zulu
-
-/(abc)\1/i
- abcabc
- ABCabc
- abcABC
-
-/(main(O)?)+/
- mainmain
- mainOmain
-
-/ab{3cd/
- ab{3cd
-
-/ab{3,cd/
- ab{3,cd
-
-/ab{3,4a}cd/
- ab{3,4a}cd
-
-/{4,5a}bc/
- {4,5a}bc
-
-/^a.b/
- a\rb
- *** Failers
- a\nb
-
-/abc$/
- abc
- abc\n
- *** Failers
- abc\ndef
-
-/(abc)\123/
- abc\x53
-
-/(abc)\223/
- abc\x93
-
-/(abc)\323/
- abc\xd3
-
-/(abc)\500/
- abc\x40
- abc\100
-
-/(abc)\5000/
- abc\x400
- abc\x40\x30
- abc\1000
- abc\100\x30
- abc\100\060
- abc\100\60
-
-/abc\81/
- abc\081
- abc\0\x38\x31
-
-/abc\91/
- abc\091
- abc\0\x39\x31
-
-/(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)(l)\12\123/
- abcdefghijkllS
-
-/(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)\12\123/
- abcdefghijk\12S
-
-/ab\gdef/
- abgdef
-
-/a{0}bc/
- bc
-
-/(a|(bc)){0,0}?xyz/
- xyz
-
-/abc[\10]de/
- abc\010de
-
-/abc[\1]de/
- abc\1de
-
-/(abc)[\1]de/
- abc\1de
-
-/a.b(?s)/
- a\nb
-
-/^([^a])([^\b])([^c]*)([^d]{3,4})/
- baNOTccccd
- baNOTcccd
- baNOTccd
- bacccd
- *** Failers
- anything
- b\bc
- baccd
-
-/[^a]/
- Abc
-
-/[^a]/i
- Abc
-
-/[^a]+/
- AAAaAbc
-
-/[^a]+/i
- AAAaAbc
-
-/[^a]+/
- bbb\nccc
-
-/[^k]$/
- abc
- *** Failers
- abk
-
-/[^k]{2,3}$/
- abc
- kbc
- kabc
- *** Failers
- abk
- akb
- akk
-
-/^\d{8,}\@.+[^k]$/
- 12345678\@a.b.c.d
- 123456789\@x.y.z
- *** Failers
- 12345678\@x.y.uk
- 1234567\@a.b.c.d
-
-/(a)\1{8,}/
- aaaaaaaaa
- aaaaaaaaaa
- *** Failers
- aaaaaaa
-
-/[^a]/
- aaaabcd
- aaAabcd
-
-/[^a]/i
- aaaabcd
- aaAabcd
-
-/[^az]/
- aaaabcd
- aaAabcd
-
-/[^az]/i
- aaaabcd
- aaAabcd
-
-/\000\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037\040\041\042\043\044\045\046\047\050\051\052\053\054\055\056\057\060\061\062\063\064\065\066\067\070\071\072\073\074\075\076\077\100\101\102\103\104\105\106\107\110\111\112\113\114\115\116\117\120\121\122\123\124\125\126\127\130\131\132\133\134\135\136\137\140\141\142\143\144\145\146\147\150\151\152\153\154\155\156\157\160\161\162\163\164\165\166\167\170\171\172\173\174\175\176\177\200\201\202\203\204\205\206\207\210\211\212\213\214\215\216\217\220\221\222\223\224\225\226\227\230\231\232\233\234\235\236\237\240\241\242\243\244\245\246\247\250\251\252\253\254\255\256\257\260\261\262\263\264\265\266\267\270\271\272\273\274\275\276\277\300\301\302\303\304\305\306\307\310\311\312\313\314\315\316\317\320\321\322\323\324\325\326\327\330\331\332\333\334\335\336\337\340\341\342\343\344\345\346\347\350\351\352\353\354\355\356\357\360\361\362\363\364\365\366\367\370\371\372\373\374\375\376\377/
- \000\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037\040\041\042\043\044\045\046\047\050\051\052\053\054\055\056\057\060\061\062\063\064\065\066\067\070\071\072\073\074\075\076\077\100\101\102\103\104\105\106\107\110\111\112\113\114\115\116\117\120\121\122\123\124\125\126\127\130\131\132\133\134\135\136\137\140\141\142\143\144\145\146\147\150\151\152\153\154\155\156\157\160\161\162\163\164\165\166\167\170\171\172\173\174\175\176\177\200\201\202\203\204\205\206\207\210\211\212\213\214\215\216\217\220\221\222\223\224\225\226\227\230\231\232\233\234\235\236\237\240\241\242\243\244\245\246\247\250\251\252\253\254\255\256\257\260\261\262\263\264\265\266\267\270\271\272\273\274\275\276\277\300\301\302\303\304\305\306\307\310\311\312\313\314\315\316\317\320\321\322\323\324\325\326\327\330\331\332\333\334\335\336\337\340\341\342\343\344\345\346\347\350\351\352\353\354\355\356\357\360\361\362\363\364\365\366\367\370\371\372\373\374\375\376\377
-
-/P[^*]TAIRE[^*]{1,6}?LL/
- xxxxxxxxxxxPSTAIREISLLxxxxxxxxx
-
-/P[^*]TAIRE[^*]{1,}?LL/
- xxxxxxxxxxxPSTAIREISLLxxxxxxxxx
-
-/(\.\d\d[1-9]?)\d+/
- 1.230003938
- 1.875000282
- 1.235
-
-/(\.\d\d((?=0)|\d(?=\d)))/
- 1.230003938
- 1.875000282
- *** Failers
- 1.235
-
-/a(?)b/
- ab
-
-/\b(foo)\s+(\w+)/i
- Food is on the foo table
-
-/foo(.*)bar/
- The food is under the bar in the barn.
-
-/foo(.*?)bar/
- The food is under the bar in the barn.
-
-/(.*)(\d*)/
- I have 2 numbers: 53147
-
-/(.*)(\d+)/
- I have 2 numbers: 53147
-
-/(.*?)(\d*)/
- I have 2 numbers: 53147
-
-/(.*?)(\d+)/
- I have 2 numbers: 53147
-
-/(.*)(\d+)$/
- I have 2 numbers: 53147
-
-/(.*?)(\d+)$/
- I have 2 numbers: 53147
-
-/(.*)\b(\d+)$/
- I have 2 numbers: 53147
-
-/(.*\D)(\d+)$/
- I have 2 numbers: 53147
-
-/^\D*(?!123)/
- ABC123
-
-/^(\D*)(?=\d)(?!123)/
- ABC445
- *** Failers
- ABC123
-
-/^[W-]46]/
- W46]789
- -46]789
- *** Failers
- Wall
- Zebra
- 42
- [abcd]
- ]abcd[
-
-/^[W-\]46]/
- W46]789
- Wall
- Zebra
- Xylophone
- 42
- [abcd]
- ]abcd[
- \\backslash
- *** Failers
- -46]789
- well
-
-/\d\d\/\d\d\/\d\d\d\d/
- 01/01/2000
-
-/word (?:[a-zA-Z0-9]+ ){0,10}otherword/
- word cat dog elephant mussel cow horse canary baboon snake shark otherword
- word cat dog elephant mussel cow horse canary baboon snake shark
-
-/word (?:[a-zA-Z0-9]+ ){0,300}otherword/
- word cat dog elephant mussel cow horse canary baboon snake shark the quick brown fox and the lazy dog and several other words getting close to thirty by now I hope
-
-/^(a){0,0}/
- bcd
- abc
- aab
-
-/^(a){0,1}/
- bcd
- abc
- aab
-
-/^(a){0,2}/
- bcd
- abc
- aab
-
-/^(a){0,3}/
- bcd
- abc
- aab
- aaa
-
-/^(a){0,}/
- bcd
- abc
- aab
- aaa
- aaaaaaaa
-
-/^(a){1,1}/
- bcd
- abc
- aab
-
-/^(a){1,2}/
- bcd
- abc
- aab
-
-/^(a){1,3}/
- bcd
- abc
- aab
- aaa
-
-/^(a){1,}/
- bcd
- abc
- aab
- aaa
- aaaaaaaa
-
-/.*\.gif/
- borfle\nbib.gif\nno
-
-/.{0,}\.gif/
- borfle\nbib.gif\nno
-
-/.*\.gif/m
- borfle\nbib.gif\nno
-
-/.*\.gif/s
- borfle\nbib.gif\nno
-
-/.*\.gif/ms
- borfle\nbib.gif\nno
-
-/.*$/
- borfle\nbib.gif\nno
-
-/.*$/m
- borfle\nbib.gif\nno
-
-/.*$/s
- borfle\nbib.gif\nno
-
-/.*$/ms
- borfle\nbib.gif\nno
-
-/.*$/
- borfle\nbib.gif\nno\n
-
-/.*$/m
- borfle\nbib.gif\nno\n
-
-/.*$/s
- borfle\nbib.gif\nno\n
-
-/.*$/ms
- borfle\nbib.gif\nno\n
-
-/(.*X|^B)/
- abcde\n1234Xyz
- BarFoo
- *** Failers
- abcde\nBar
-
-/(.*X|^B)/m
- abcde\n1234Xyz
- BarFoo
- abcde\nBar
-
-/(.*X|^B)/s
- abcde\n1234Xyz
- BarFoo
- *** Failers
- abcde\nBar
-
-/(.*X|^B)/ms
- abcde\n1234Xyz
- BarFoo
- abcde\nBar
-
-/(?s)(.*X|^B)/
- abcde\n1234Xyz
- BarFoo
- *** Failers
- abcde\nBar
-
-/(?s:.*X|^B)/
- abcde\n1234Xyz
- BarFoo
- *** Failers
- abcde\nBar
-
-/^.*B/
- **** Failers
- abc\nB
-
-/(?s)^.*B/
- abc\nB
-
-/(?m)^.*B/
- abc\nB
-
-/(?ms)^.*B/
- abc\nB
-
-/(?ms)^B/
- abc\nB
-
-/(?s)B$/
- B\n
-
-/^[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]/
- 123456654321
-
-/^\d\d\d\d\d\d\d\d\d\d\d\d/
- 123456654321
-
-/^[\d][\d][\d][\d][\d][\d][\d][\d][\d][\d][\d][\d]/
- 123456654321
-
-/^[abc]{12}/
- abcabcabcabc
-
-/^[a-c]{12}/
- abcabcabcabc
-
-/^(a|b|c){12}/
- abcabcabcabc
-
-/^[abcdefghijklmnopqrstuvwxy0123456789]/
- n
- *** Failers
- z
-
-/abcde{0,0}/
- abcd
- *** Failers
- abce
-
-/ab[cd]{0,0}e/
- abe
- *** Failers
- abcde
-
-/ab(c){0,0}d/
- abd
- *** Failers
- abcd
-
-/a(b*)/
- a
- ab
- abbbb
- *** Failers
- bbbbb
-
-/ab\d{0}e/
- abe
- *** Failers
- ab1e
-
-/"([^\\"]+|\\.)*"/
- the \"quick\" brown fox
- \"the \\\"quick\\\" brown fox\"
-
-/.*?/g+
- abc
-
-/\b/g+
- abc
-
-/\b/+g
- abc
-
-//g
- abc
-
-/<tr([\w\W\s\d][^<>]{0,})><TD([\w\W\s\d][^<>]{0,})>([\d]{0,}\.)(.*)((<BR>([\w\W\s\d][^<>]{0,})|[\s]{0,}))<\/a><\/TD><TD([\w\W\s\d][^<>]{0,})>([\w\W\s\d][^<>]{0,})<\/TD><TD([\w\W\s\d][^<>]{0,})>([\w\W\s\d][^<>]{0,})<\/TD><\/TR>/is
- <TR BGCOLOR='#DBE9E9'><TD align=left valign=top>43.<a href='joblist.cfm?JobID=94 6735&Keyword='>Word Processor<BR>(N-1286)</a></TD><TD align=left valign=top>Lega lstaff.com</TD><TD align=left valign=top>CA - Statewide</TD></TR>
-
-/a[^a]b/
- acb
- a\nb
-
-/a.b/
- acb
- *** Failers
- a\nb
-
-/a[^a]b/s
- acb
- a\nb
-
-/a.b/s
- acb
- a\nb
-
-/ End of testinput1 /
diff --git a/ext/pcre/pcrelib/testdata/testinput2 b/ext/pcre/pcrelib/testdata/testinput2
deleted file mode 100644
index ad116ef75a..0000000000
--- a/ext/pcre/pcrelib/testdata/testinput2
+++ /dev/null
@@ -1,712 +0,0 @@
-/(a)b|/
-
-/abc/
- abc
- defabc
- \Aabc
- *** Failers
- \Adefabc
- ABC
-
-/^abc/
- abc
- \Aabc
- *** Failers
- defabc
- \Adefabc
-
-/a+bc/
-
-/a*bc/
-
-/a{3}bc/
-
-/(abc|a+z)/
-
-/^abc$/
- abc
- *** Failers
- def\nabc
-
-/ab\gdef/X
-
-/(?X)ab\gdef/X
-
-/x{5,4}/
-
-/z{65536}/
-
-/[abcd/
-
-/[\B]/
-
-/[z-a]/
-
-/^*/
-
-/(abc/
-
-/(?# abc/
-
-/(?z)abc/
-
-/.*b/
-
-/.*?b/
-
-/cat|dog|elephant/
- this sentence eventually mentions a cat
- this sentences rambles on and on for a while and then reaches elephant
-
-/cat|dog|elephant/S
- this sentence eventually mentions a cat
- this sentences rambles on and on for a while and then reaches elephant
-
-/cat|dog|elephant/iS
- this sentence eventually mentions a CAT cat
- this sentences rambles on and on for a while to elephant ElePhant
-
-/a|[bcd]/S
-
-/(a|[^\dZ])/S
-
-/(a|b)*[\s]/S
-
-/(ab\2)/
-
-/{4,5}abc/
-
-/(a)(b)(c)\2/
- abcb
- \O0abcb
- \O3abcb
- \O6abcb
- \O9abcb
- \O12abcb
-
-/(a)bc|(a)(b)\2/
- abc
- \O0abc
- \O3abc
- \O6abc
- aba
- \O0aba
- \O3aba
- \O6aba
- \O9aba
- \O12aba
-
-/abc$/E
- abc
- *** Failers
- abc\n
- abc\ndef
-
-/(a)(b)(c)(d)(e)\6/
-
-/the quick brown fox/
- the quick brown fox
- this is a line with the quick brown fox
-
-/the quick brown fox/A
- the quick brown fox
- *** Failers
- this is a line with the quick brown fox
-
-/ab(?z)cd/
-
-/^abc|def/
- abcdef
- abcdef\B
-
-/.*((abc)$|(def))/
- defabc
- \Zdefabc
-
-/abc/P
- abc
- *** Failers
-
-/^abc|def/P
- abcdef
- abcdef\B
-
-/.*((abc)$|(def))/P
- defabc
- \Zdefabc
-
-/the quick brown fox/P
- the quick brown fox
- *** Failers
- The Quick Brown Fox
-
-/the quick brown fox/Pi
- the quick brown fox
- The Quick Brown Fox
-
-/abc.def/P
- *** Failers
- abc\ndef
-
-/abc$/P
- abc
- abc\n
-
-/(abc)\2/P
-
-/(abc\1)/P
- abc
-
-/)/
-
-/a[]b/
-
-/[^aeiou ]{3,}/
- co-processors, and for
-
-/<.*>/
- abc<def>ghi<klm>nop
-
-/<.*?>/
- abc<def>ghi<klm>nop
-
-/<.*>/U
- abc<def>ghi<klm>nop
-
-/<.*>(?U)/
- abc<def>ghi<klm>nop
-
-/<.*?>/U
- abc<def>ghi<klm>nop
-
-/={3,}/U
- abc========def
-
-/(?U)={3,}?/
- abc========def
-
-/(?<!bar|cattle)foo/
- foo
- catfoo
- *** Failers
- the barfoo
- and cattlefoo
-
-/(?<=a+)b/
-
-/(?<=aaa|b{0,3})b/
-
-/(?<!(foo)a\1)bar/
-
-/(?i)abc/
-
-/(a|(?m)a)/
-
-/(?i)^1234/
-
-/(^b|(?i)^d)/
-
-/(?s).*/
-
-/[abcd]/S
-
-/(?i)[abcd]/S
-
-/(?m)[xy]|(b|c)/S
-
-/(^a|^b)/m
-
-/(?i)(^a|^b)/m
-
-/(a)(?(1)a|b|c)/
-
-/(?(?=a)a|b|c)/
-
-/(?(1a)/
-
-/(?(?i))/
-
-/(?(abc))/
-
-/(?(?<ab))/
-
-/((?s)blah)\s+\1/
-
-/((?i)blah)\s+\1/
-
-/((?i)b)/DS
-
-/(a*b|(?i:c*(?-i)d))/S
-
-/a$/
- a
- a\n
- *** Failers
- \Za
- \Za\n
-
-/a$/m
- a
- a\n
- \Za\n
- *** Failers
- \Za
-
-/\Aabc/m
-
-/^abc/m
-
-/^((a+)(?U)([ab]+)(?-U)([bc]+)(\w*))/
- aaaaabbbbbcccccdef
-
-/(?<=foo)[ab]/S
-
-/(?<!foo)(alpha|omega)/S
-
-/(?!alphabet)[ab]/S
-
-/(?<=foo\n)^bar/m
-
-/(?>^abc)/m
- abc
- def\nabc
- *** Failers
- defabc
-
-/(?<=ab(c+)d)ef/
-
-/(?<=ab(?<=c+)d)ef/
-
-/(?<=ab(c|de)f)g/
-
-/The next three are in testinput2 because they have variable length branches/
-
-/(?<=bullock|donkey)-cart/
- the bullock-cart
- a donkey-cart race
- *** Failers
- cart
- horse-and-cart
-
-/(?<=ab(?i)x|y|z)/
-
-/(?>.*)(?<=(abcd)|(xyz))/
- alphabetabcd
- endingxyz
-
-/(?<=ab(?i)x(?-i)y|(?i)z|b)ZZ/
- abxyZZ
- abXyZZ
- ZZZ
- zZZ
- bZZ
- BZZ
- *** Failers
- ZZ
- abXYZZ
- zzz
- bzz
-
-/(?<!(foo)a)bar/
- bar
- foobbar
- *** Failers
- fooabar
-
-/This one is here because Perl 5.005_02 doesn't fail it/
-
-/^(a)?(?(1)a|b)+$/
- *** Failers
- a
-
-/This one is here because I think Perl 5.005_02 gets the setting of $1 wrong/
-
-/^(a\1?){4}$/
- aaaaaa
-
-/These are syntax tests from Perl 5.005/
-
-/a[b-a]/
-
-/a[]b/
-
-/a[/
-
-/*a/
-
-/(*)b/
-
-/abc)/
-
-/(abc/
-
-/a**/
-
-/)(/
-
-/\1/
-
-/\2/
-
-/(a)|\2/
-
-/a[b-a]/i
-
-/a[]b/i
-
-/a[/i
-
-/*a/i
-
-/(*)b/i
-
-/abc)/i
-
-/(abc/i
-
-/a**/i
-
-/)(/i
-
-/:(?:/
-
-/(?<%)b/
-
-/a(?{)b/
-
-/a(?{{})b/
-
-/a(?{}})b/
-
-/a(?{"{"})b/
-
-/a(?{"{"}})b/
-
-/(?(1?)a|b)/
-
-/(?(1)a|b|c)/
-
-/[a[:xyz:/
-
-/(?<=x+)y/
-
-/a{37,17}/
-
-/abc/\
-
-/abc/\P
-
-/abc/\i
-
-/(a)bc(d)/
- abcd
- abcd\C2
- abcd\C5
-
-/(.{20})/
- abcdefghijklmnopqrstuvwxyz
- abcdefghijklmnopqrstuvwxyz\C1
- abcdefghijklmnopqrstuvwxyz\G1
-
-/(.{15})/
- abcdefghijklmnopqrstuvwxyz
- abcdefghijklmnopqrstuvwxyz\C1\G1
-
-/(.{16})/
- abcdefghijklmnopqrstuvwxyz
- abcdefghijklmnopqrstuvwxyz\C1\G1\L
-
-/^(a|(bc))de(f)/
- adef\G1\G2\G3\G4\L
- bcdef\G1\G2\G3\G4\L
- adefghijk\C0
-
-/^abc\00def/
- abc\00def\L\C0
-
-/word ((?:[a-zA-Z0-9]+ )((?:[a-zA-Z0-9]+ )((?:[a-zA-Z0-9]+ )((?:[a-zA-Z0-9]+
-)((?:[a-zA-Z0-9]+ )((?:[a-zA-Z0-9]+ )((?:[a-zA-Z0-9]+ )((?:[a-zA-Z0-9]+
-)?)?)?)?)?)?)?)?)?otherword/M
-
-/.*X/D
-
-/.*X/Ds
-
-/(.*X|^B)/D
-
-/(.*X|^B)/Ds
-
-/(?s)(.*X|^B)/D
-
-/(?s:.*X|^B)/D
-
-/\Biss\B/+
- Mississippi
-
-/\Biss\B/+P
- Mississippi
-
-/iss/G+
- Mississippi
-
-/\Biss\B/G+
- Mississippi
-
-/\Biss\B/g+
- Mississippi
- *** Failers
- Mississippi\A
-
-/(?<=[Ms])iss/g+
- Mississippi
-
-/(?<=[Ms])iss/G+
- Mississippi
-
-/^iss/g+
- ississippi
-
-/.*iss/g+
- abciss\nxyzisspqr
-
-/.i./+g
- Mississippi
- Mississippi\A
- Missouri river
- Missouri river\A
-
-/^.is/+g
- Mississippi
-
-/^ab\n/g+
- ab\nab\ncd
-
-/^ab\n/mg+
- ab\nab\ncd
-
-/abc/
-
-/abc|bac/
-
-/(abc|bac)/
-
-/(abc|(c|dc))/
-
-/(abc|(d|de)c)/
-
-/a*/
-
-/a+/
-
-/(baa|a+)/
-
-/a{0,3}/
-
-/baa{3,}/
-
-/"([^\\"]+|\\.)*"/
-
-/(abc|ab[cd])/
-
-/(a|.)/
-
-/a|ba|\w/
-
-/abc(?=pqr)/
-
-/...(?<=abc)/
-
-/abc(?!pqr)/
-
-/ab./
-
-/ab[xyz]/
-
-/abc*/
-
-/ab.c*/
-
-/a.c*/
-
-/.c*/
-
-/ac*/
-
-/(a.c*|b.c*)/
-
-/a.c*|aba/
-
-/.+a/
-
-/(?=abcda)a.*/
-
-/(?=a)a.*/
-
-/a(b)*/
-
-/a\d*/
-
-/ab\d*/
-
-/a(\d)*/
-
-/abcde{0,0}/
-
-/ab\d+/
-
-/a(?(1)b)/
-
-/a(?(1)bag|big)/
-
-/a(?(1)bag|big)*/
-
-/a(?(1)bag|big)+/
-
-/a(?(1)b..|b..)/
-
-/ab\d{0}e/
-
-/a?b?/
- a
- b
- ab
- \
- *** Failers
- \N
-
-/|-/
- abcd
- -abc
- \Nab-c
- *** Failers
- \Nabc
-
-/a*(b+)(z)(z)/P
- aaaabbbbzzzz
- aaaabbbbzzzz\O0
- aaaabbbbzzzz\O1
- aaaabbbbzzzz\O2
- aaaabbbbzzzz\O3
- aaaabbbbzzzz\O4
- aaaabbbbzzzz\O5
-
-/^.?abcd/S
-
-/\( # ( at start
- (?: # Non-capturing bracket
- (?>[^()]+) # Either a sequence of non-brackets (no backtracking)
- | # Or
- (?R) # Recurse - i.e. nested bracketed string
- )* # Zero or more contents
- \) # Closing )
- /x
- (abcd)
- (abcd)xyz
- xyz(abcd)
- (ab(xy)cd)pqr
- (ab(xycd)pqr
- () abc ()
- 12(abcde(fsh)xyz(foo(bar))lmno)89
- *** Failers
- abcd
- abcd)
- (abcd
-
-/\( ( (?>[^()]+) | (?R) )* \) /xg
- (ab(xy)cd)pqr
- 1(abcd)(x(y)z)pqr
-
-/\( (?: (?>[^()]+) | (?R) ) \) /x
- (abcd)
- (ab(xy)cd)
- (a(b(c)d)e)
- ((ab))
- *** Failers
- ()
-
-/\( (?: (?>[^()]+) | (?R) )? \) /x
- ()
- 12(abcde(fsh)xyz(foo(bar))lmno)89
-
-/\( ( (?>[^()]+) | (?R) )* \) /x
- (ab(xy)cd)
-
-/\( ( ( (?>[^()]+) | (?R) )* ) \) /x
- (ab(xy)cd)
-
-/\( (123)? ( ( (?>[^()]+) | (?R) )* ) \) /x
- (ab(xy)cd)
- (123ab(xy)cd)
-
-/\( ( (123)? ( (?>[^()]+) | (?R) )* ) \) /x
- (ab(xy)cd)
- (123ab(xy)cd)
-
-/\( (((((((((( ( (?>[^()]+) | (?R) )* )))))))))) \) /x
- (ab(xy)cd)
-
-/\( ( ( (?>[^()<>]+) | ((?>[^()]+)) | (?R) )* ) \) /x
- (abcd(xyz<p>qrs)123)
-
-/\( ( ( (?>[^()]+) | ((?R)) )* ) \) /x
- (ab(cd)ef)
- (ab(cd(ef)gh)ij)
-
-/^[[:alnum:]]/D
-
-/^[[:alpha:]]/D
-
-/^[[:ascii:]]/D
-
-/^[[:cntrl:]]/D
-
-/^[[:digit:]]/D
-
-/^[[:graph:]]/D
-
-/^[[:lower:]]/D
-
-/^[[:print:]]/D
-
-/^[[:punct:]]/D
-
-/^[[:space:]]/D
-
-/^[[:upper:]]/D
-
-/^[[:xdigit:]]/D
-
-/^[[:word:]]/D
-
-/^[[:^cntrl:]]/D
-
-/^[12[:^digit:]]/D
-
-/[01[:alpha:]%]/D
-
-/[[.ch.]]/
-
-/[[=ch=]]/
-
-/[[:rhubarb:]]/
-
-/[[:upper:]]/i
- A
- a
-
-/[[:lower:]]/i
- A
- a
-
-/((?-i)[[:lower:]])[[:lower:]]/i
- ab
- aB
- *** Failers
- Ab
- AB
-
-/[\200-\410]/
-
-/^(?(0)f|b)oo/
-
-/ End of testinput2 /
diff --git a/ext/pcre/pcrelib/testdata/testinput3 b/ext/pcre/pcrelib/testdata/testinput3
deleted file mode 100644
index d3bd74fdd3..0000000000
--- a/ext/pcre/pcrelib/testdata/testinput3
+++ /dev/null
@@ -1,1724 +0,0 @@
-/(?<!bar)foo/
- foo
- catfood
- arfootle
- rfoosh
- *** Failers
- barfoo
- towbarfoo
-
-/\w{3}(?<!bar)foo/
- catfood
- *** Failers
- foo
- barfoo
- towbarfoo
-
-/(?<=(foo)a)bar/
- fooabar
- *** Failers
- bar
- foobbar
-
-/\Aabc\z/m
- abc
- *** Failers
- abc\n
- qqq\nabc
- abc\nzzz
- qqq\nabc\nzzz
-
-"(?>.*/)foo"
- /this/is/a/very/long/line/in/deed/with/very/many/slashes/in/it/you/see/
-
-"(?>.*/)foo"
- /this/is/a/very/long/line/in/deed/with/very/many/slashes/in/and/foo
-
-/(?>(\.\d\d[1-9]?))\d+/
- 1.230003938
- 1.875000282
- *** Failers
- 1.235
-
-/^((?>\w+)|(?>\s+))*$/
- now is the time for all good men to come to the aid of the party
- *** Failers
- this is not a line with only words and spaces!
-
-/(\d+)(\w)/
- 12345a
- 12345+
-
-/((?>\d+))(\w)/
- 12345a
- *** Failers
- 12345+
-
-/(?>a+)b/
- aaab
-
-/((?>a+)b)/
- aaab
-
-/(?>(a+))b/
- aaab
-
-/(?>b)+/
- aaabbbccc
-
-/(?>a+|b+|c+)*c/
- aaabbbbccccd
-
-/((?>[^()]+)|\([^()]*\))+/
- ((abc(ade)ufh()()x
-
-/\(((?>[^()]+)|\([^()]+\))+\)/
- (abc)
- (abc(def)xyz)
- *** Failers
- ((()aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
-
-/a(?-i)b/i
- ab
- *** Failers
- Ab
- aB
- AB
-
-/(a (?x)b c)d e/
- a bcd e
- *** Failers
- a b cd e
- abcd e
- a bcde
-
-/(a b(?x)c d (?-x)e f)/
- a bcde f
- *** Failers
- abcdef
-
-/(a(?i)b)c/
- abc
- aBc
- *** Failers
- abC
- aBC
- Abc
- ABc
- ABC
- AbC
-
-/a(?i:b)c/
- abc
- aBc
- *** Failers
- ABC
- abC
- aBC
-
-/a(?i:b)*c/
- aBc
- aBBc
- *** Failers
- aBC
- aBBC
-
-/a(?=b(?i)c)\w\wd/
- abcd
- abCd
- *** Failers
- aBCd
- abcD
-
-/(?s-i:more.*than).*million/i
- more than million
- more than MILLION
- more \n than Million
- *** Failers
- MORE THAN MILLION
- more \n than \n million
-
-/(?:(?s-i)more.*than).*million/i
- more than million
- more than MILLION
- more \n than Million
- *** Failers
- MORE THAN MILLION
- more \n than \n million
-
-/(?>a(?i)b+)+c/
- abc
- aBbc
- aBBc
- *** Failers
- Abc
- abAb
- abbC
-
-/(?=a(?i)b)\w\wc/
- abc
- aBc
- *** Failers
- Ab
- abC
- aBC
-
-/(?<=a(?i)b)(\w\w)c/
- abxxc
- aBxxc
- *** Failers
- Abxxc
- ABxxc
- abxxC
-
-/(?:(a)|b)(?(1)A|B)/
- aA
- bB
- *** Failers
- aB
- bA
-
-/^(a)?(?(1)a|b)+$/
- aa
- b
- bb
- *** Failers
- ab
-
-/^(?(?=abc)\w{3}:|\d\d)$/
- abc:
- 12
- *** Failers
- 123
- xyz
-
-/^(?(?!abc)\d\d|\w{3}:)$/
- abc:
- 12
- *** Failers
- 123
- xyz
-
-/(?(?<=foo)bar|cat)/
- foobar
- cat
- fcat
- focat
- *** Failers
- foocat
-
-/(?(?<!foo)cat|bar)/
- foobar
- cat
- fcat
- focat
- *** Failers
- foocat
-
-/( \( )? [^()]+ (?(1) \) |) /x
- abcd
- (abcd)
- the quick (abcd) fox
- (abcd
-
-/( \( )? [^()]+ (?(1) \) ) /x
- abcd
- (abcd)
- the quick (abcd) fox
- (abcd
-
-/^(?(2)a|(1)(2))+$/
- 12
- 12a
- 12aa
- *** Failers
- 1234
-
-/((?i)blah)\s+\1/
- blah blah
- BLAH BLAH
- Blah Blah
- blaH blaH
- *** Failers
- blah BLAH
- Blah blah
- blaH blah
-
-/((?i)blah)\s+(?i:\1)/
- blah blah
- BLAH BLAH
- Blah Blah
- blaH blaH
- blah BLAH
- Blah blah
- blaH blah
-
-/(?>a*)*/
- a
- aa
- aaaa
-
-/(abc|)+/
- abc
- abcabc
- abcabcabc
- xyz
-
-/([a]*)*/
- a
- aaaaa
-
-/([ab]*)*/
- a
- b
- ababab
- aaaabcde
- bbbb
-
-/([^a]*)*/
- b
- bbbb
- aaa
-
-/([^ab]*)*/
- cccc
- abab
-
-/([a]*?)*/
- a
- aaaa
-
-/([ab]*?)*/
- a
- b
- abab
- baba
-
-/([^a]*?)*/
- b
- bbbb
- aaa
-
-/([^ab]*?)*/
- c
- cccc
- baba
-
-/(?>a*)*/
- a
- aaabcde
-
-/((?>a*))*/
- aaaaa
- aabbaa
-
-/((?>a*?))*/
- aaaaa
- aabbaa
-
-/(?(?=[^a-z]+[a-z]) \d{2}-[a-z]{3}-\d{2} | \d{2}-\d{2}-\d{2} ) /x
- 12-sep-98
- 12-09-98
- *** Failers
- sep-12-98
-
-/(?<=(foo))bar\1/
- foobarfoo
- foobarfootling
- *** Failers
- foobar
- barfoo
-
-/(?i:saturday|sunday)/
- saturday
- sunday
- Saturday
- Sunday
- SATURDAY
- SUNDAY
- SunDay
-
-/(a(?i)bc|BB)x/
- abcx
- aBCx
- bbx
- BBx
- *** Failers
- abcX
- aBCX
- bbX
- BBX
-
-/^([ab](?i)[cd]|[ef])/
- ac
- aC
- bD
- elephant
- Europe
- frog
- France
- *** Failers
- Africa
-
-/^(ab|a(?i)[b-c](?m-i)d|x(?i)y|z)/
- ab
- aBd
- xy
- xY
- zebra
- Zambesi
- *** Failers
- aCD
- XY
-
-/(?<=foo\n)^bar/m
- foo\nbar
- *** Failers
- bar
- baz\nbar
-
-/(?<=(?<!foo)bar)baz/
- barbaz
- barbarbaz
- koobarbaz
- *** Failers
- baz
- foobarbaz
-
-/The case of aaaaaa is missed out below because I think Perl 5.005_02 gets/
-/it wrong; it sets $1 to aaa rather than aa. Compare the following test,/
-/where it does set $1 to aa when matching aaaaaa./
-
-/^(a\1?){4}$/
- a
- aa
- aaa
- aaaa
- aaaaa
- aaaaaaa
- aaaaaaaa
- aaaaaaaaa
- aaaaaaaaaa
- aaaaaaaaaaa
- aaaaaaaaaaaa
- aaaaaaaaaaaaa
- aaaaaaaaaaaaaa
- aaaaaaaaaaaaaaa
- aaaaaaaaaaaaaaaa
-
-/^(a\1?)(a\1?)(a\2?)(a\3?)$/
- a
- aa
- aaa
- aaaa
- aaaaa
- aaaaaa
- aaaaaaa
- aaaaaaaa
- aaaaaaaaa
- aaaaaaaaaa
- aaaaaaaaaaa
- aaaaaaaaaaaa
- aaaaaaaaaaaaa
- aaaaaaaaaaaaaa
- aaaaaaaaaaaaaaa
- aaaaaaaaaaaaaaaa
-
-/The following tests are taken from the Perl 5.005 test suite; some of them/
-/are compatible with 5.004, but I'd rather not have to sort them out./
-
-/abc/
- abc
- xabcy
- ababc
- *** Failers
- xbc
- axc
- abx
-
-/ab*c/
- abc
-
-/ab*bc/
- abc
- abbc
- abbbbc
-
-/.{1}/
- abbbbc
-
-/.{3,4}/
- abbbbc
-
-/ab{0,}bc/
- abbbbc
-
-/ab+bc/
- abbc
- *** Failers
- abc
- abq
-
-/ab{1,}bc/
-
-/ab+bc/
- abbbbc
-
-/ab{1,}bc/
- abbbbc
-
-/ab{1,3}bc/
- abbbbc
-
-/ab{3,4}bc/
- abbbbc
-
-/ab{4,5}bc/
- *** Failers
- abq
- abbbbc
-
-/ab?bc/
- abbc
- abc
-
-/ab{0,1}bc/
- abc
-
-/ab?bc/
-
-/ab?c/
- abc
-
-/ab{0,1}c/
- abc
-
-/^abc$/
- abc
- *** Failers
- abbbbc
- abcc
-
-/^abc/
- abcc
-
-/^abc$/
-
-/abc$/
- aabc
- *** Failers
- aabc
- aabcd
-
-/^/
- abc
-
-/$/
- abc
-
-/a.c/
- abc
- axc
-
-/a.*c/
- axyzc
-
-/a[bc]d/
- abd
- *** Failers
- axyzd
- abc
-
-/a[b-d]e/
- ace
-
-/a[b-d]/
- aac
-
-/a[-b]/
- a-
-
-/a[b-]/
- a-
-
-/a]/
- a]
-
-/a[]]b/
- a]b
-
-/a[^bc]d/
- aed
- *** Failers
- abd
- abd
-
-/a[^-b]c/
- adc
-
-/a[^]b]c/
- adc
- *** Failers
- a-c
- a]c
-
-/\ba\b/
- a-
- -a
- -a-
-
-/\by\b/
- *** Failers
- xy
- yz
- xyz
-
-/\Ba\B/
- *** Failers
- a-
- -a
- -a-
-
-/\By\b/
- xy
-
-/\by\B/
- yz
-
-/\By\B/
- xyz
-
-/\w/
- a
-
-/\W/
- -
- *** Failers
- -
- a
-
-/a\sb/
- a b
-
-/a\Sb/
- a-b
- *** Failers
- a-b
- a b
-
-/\d/
- 1
-
-/\D/
- -
- *** Failers
- -
- 1
-
-/[\w]/
- a
-
-/[\W]/
- -
- *** Failers
- -
- a
-
-/a[\s]b/
- a b
-
-/a[\S]b/
- a-b
- *** Failers
- a-b
- a b
-
-/[\d]/
- 1
-
-/[\D]/
- -
- *** Failers
- -
- 1
-
-/ab|cd/
- abc
- abcd
-
-/()ef/
- def
-
-/$b/
-
-/a\(b/
- a(b
-
-/a\(*b/
- ab
- a((b
-
-/a\\b/
- a\b
-
-/((a))/
- abc
-
-/(a)b(c)/
- abc
-
-/a+b+c/
- aabbabc
-
-/a{1,}b{1,}c/
- aabbabc
-
-/a.+?c/
- abcabc
-
-/(a+|b)*/
- ab
-
-/(a+|b){0,}/
- ab
-
-/(a+|b)+/
- ab
-
-/(a+|b){1,}/
- ab
-
-/(a+|b)?/
- ab
-
-/(a+|b){0,1}/
- ab
-
-/[^ab]*/
- cde
-
-/abc/
- *** Failers
- b
-
-
-/a*/
-
-
-/([abc])*d/
- abbbcd
-
-/([abc])*bcd/
- abcd
-
-/a|b|c|d|e/
- e
-
-/(a|b|c|d|e)f/
- ef
-
-/abcd*efg/
- abcdefg
-
-/ab*/
- xabyabbbz
- xayabbbz
-
-/(ab|cd)e/
- abcde
-
-/[abhgefdc]ij/
- hij
-
-/^(ab|cd)e/
-
-/(abc|)ef/
- abcdef
-
-/(a|b)c*d/
- abcd
-
-/(ab|ab*)bc/
- abc
-
-/a([bc]*)c*/
- abc
-
-/a([bc]*)(c*d)/
- abcd
-
-/a([bc]+)(c*d)/
- abcd
-
-/a([bc]*)(c+d)/
- abcd
-
-/a[bcd]*dcdcde/
- adcdcde
-
-/a[bcd]+dcdcde/
- *** Failers
- abcde
- adcdcde
-
-/(ab|a)b*c/
- abc
-
-/((a)(b)c)(d)/
- abcd
-
-/[a-zA-Z_][a-zA-Z0-9_]*/
- alpha
-
-/^a(bc+|b[eh])g|.h$/
- abh
-
-/(bc+d$|ef*g.|h?i(j|k))/
- effgz
- ij
- reffgz
- *** Failers
- effg
- bcdd
-
-/((((((((((a))))))))))/
- a
-
-/((((((((((a))))))))))\10/
- aa
-
-/(((((((((a)))))))))/
- a
-
-/multiple words of text/
- *** Failers
- aa
- uh-uh
-
-/multiple words/
- multiple words, yeah
-
-/(.*)c(.*)/
- abcde
-
-/\((.*), (.*)\)/
- (a, b)
-
-/[k]/
-
-/abcd/
- abcd
-
-/a(bc)d/
- abcd
-
-/a[-]?c/
- ac
-
-/(abc)\1/
- abcabc
-
-/([a-c]*)\1/
- abcabc
-
-/(a)|\1/
- a
- *** Failers
- ab
- x
-
-/(([a-c])b*?\2)*/
- ababbbcbc
-
-/(([a-c])b*?\2){3}/
- ababbbcbc
-
-/((\3|b)\2(a)x)+/
- aaaxabaxbaaxbbax
-
-/((\3|b)\2(a)){2,}/
- bbaababbabaaaaabbaaaabba
-
-/abc/i
- ABC
- XABCY
- ABABC
- *** Failers
- aaxabxbaxbbx
- XBC
- AXC
- ABX
-
-/ab*c/i
- ABC
-
-/ab*bc/i
- ABC
- ABBC
-
-/ab*?bc/i
- ABBBBC
-
-/ab{0,}?bc/i
- ABBBBC
-
-/ab+?bc/i
- ABBC
-
-/ab+bc/i
- *** Failers
- ABC
- ABQ
-
-/ab{1,}bc/i
-
-/ab+bc/i
- ABBBBC
-
-/ab{1,}?bc/i
- ABBBBC
-
-/ab{1,3}?bc/i
- ABBBBC
-
-/ab{3,4}?bc/i
- ABBBBC
-
-/ab{4,5}?bc/i
- *** Failers
- ABQ
- ABBBBC
-
-/ab??bc/i
- ABBC
- ABC
-
-/ab{0,1}?bc/i
- ABC
-
-/ab??bc/i
-
-/ab??c/i
- ABC
-
-/ab{0,1}?c/i
- ABC
-
-/^abc$/i
- ABC
- *** Failers
- ABBBBC
- ABCC
-
-/^abc/i
- ABCC
-
-/^abc$/i
-
-/abc$/i
- AABC
-
-/^/i
- ABC
-
-/$/i
- ABC
-
-/a.c/i
- ABC
- AXC
-
-/a.*?c/i
- AXYZC
-
-/a.*c/i
- *** Failers
- AABC
- AXYZD
-
-/a[bc]d/i
- ABD
-
-/a[b-d]e/i
- ACE
- *** Failers
- ABC
- ABD
-
-/a[b-d]/i
- AAC
-
-/a[-b]/i
- A-
-
-/a[b-]/i
- A-
-
-/a]/i
- A]
-
-/a[]]b/i
- A]B
-
-/a[^bc]d/i
- AED
-
-/a[^-b]c/i
- ADC
- *** Failers
- ABD
- A-C
-
-/a[^]b]c/i
- ADC
-
-/ab|cd/i
- ABC
- ABCD
-
-/()ef/i
- DEF
-
-/$b/i
- *** Failers
- A]C
- B
-
-/a\(b/i
- A(B
-
-/a\(*b/i
- AB
- A((B
-
-/a\\b/i
- A\B
-
-/((a))/i
- ABC
-
-/(a)b(c)/i
- ABC
-
-/a+b+c/i
- AABBABC
-
-/a{1,}b{1,}c/i
- AABBABC
-
-/a.+?c/i
- ABCABC
-
-/a.*?c/i
- ABCABC
-
-/a.{0,5}?c/i
- ABCABC
-
-/(a+|b)*/i
- AB
-
-/(a+|b){0,}/i
- AB
-
-/(a+|b)+/i
- AB
-
-/(a+|b){1,}/i
- AB
-
-/(a+|b)?/i
- AB
-
-/(a+|b){0,1}/i
- AB
-
-/(a+|b){0,1}?/i
- AB
-
-/[^ab]*/i
- CDE
-
-/abc/i
-
-/a*/i
-
-
-/([abc])*d/i
- ABBBCD
-
-/([abc])*bcd/i
- ABCD
-
-/a|b|c|d|e/i
- E
-
-/(a|b|c|d|e)f/i
- EF
-
-/abcd*efg/i
- ABCDEFG
-
-/ab*/i
- XABYABBBZ
- XAYABBBZ
-
-/(ab|cd)e/i
- ABCDE
-
-/[abhgefdc]ij/i
- HIJ
-
-/^(ab|cd)e/i
- ABCDE
-
-/(abc|)ef/i
- ABCDEF
-
-/(a|b)c*d/i
- ABCD
-
-/(ab|ab*)bc/i
- ABC
-
-/a([bc]*)c*/i
- ABC
-
-/a([bc]*)(c*d)/i
- ABCD
-
-/a([bc]+)(c*d)/i
- ABCD
-
-/a([bc]*)(c+d)/i
- ABCD
-
-/a[bcd]*dcdcde/i
- ADCDCDE
-
-/a[bcd]+dcdcde/i
-
-/(ab|a)b*c/i
- ABC
-
-/((a)(b)c)(d)/i
- ABCD
-
-/[a-zA-Z_][a-zA-Z0-9_]*/i
- ALPHA
-
-/^a(bc+|b[eh])g|.h$/i
- ABH
-
-/(bc+d$|ef*g.|h?i(j|k))/i
- EFFGZ
- IJ
- REFFGZ
- *** Failers
- ADCDCDE
- EFFG
- BCDD
-
-/((((((((((a))))))))))/i
- A
-
-/((((((((((a))))))))))\10/i
- AA
-
-/(((((((((a)))))))))/i
- A
-
-/(?:(?:(?:(?:(?:(?:(?:(?:(?:(a))))))))))/i
- A
-
-/(?:(?:(?:(?:(?:(?:(?:(?:(?:(a|b|c))))))))))/i
- C
-
-/multiple words of text/i
- *** Failers
- AA
- UH-UH
-
-/multiple words/i
- MULTIPLE WORDS, YEAH
-
-/(.*)c(.*)/i
- ABCDE
-
-/\((.*), (.*)\)/i
- (A, B)
-
-/[k]/i
-
-/abcd/i
- ABCD
-
-/a(bc)d/i
- ABCD
-
-/a[-]?c/i
- AC
-
-/(abc)\1/i
- ABCABC
-
-/([a-c]*)\1/i
- ABCABC
-
-/a(?!b)./
- abad
-
-/a(?=d)./
- abad
-
-/a(?=c|d)./
- abad
-
-/a(?:b|c|d)(.)/
- ace
-
-/a(?:b|c|d)*(.)/
- ace
-
-/a(?:b|c|d)+?(.)/
- ace
- acdbcdbe
-
-/a(?:b|c|d)+(.)/
- acdbcdbe
-
-/a(?:b|c|d){2}(.)/
- acdbcdbe
-
-/a(?:b|c|d){4,5}(.)/
- acdbcdbe
-
-/a(?:b|c|d){4,5}?(.)/
- acdbcdbe
-
-/((foo)|(bar))*/
- foobar
-
-/a(?:b|c|d){6,7}(.)/
- acdbcdbe
-
-/a(?:b|c|d){6,7}?(.)/
- acdbcdbe
-
-/a(?:b|c|d){5,6}(.)/
- acdbcdbe
-
-/a(?:b|c|d){5,6}?(.)/
- acdbcdbe
-
-/a(?:b|c|d){5,7}(.)/
- acdbcdbe
-
-/a(?:b|c|d){5,7}?(.)/
- acdbcdbe
-
-/a(?:b|(c|e){1,2}?|d)+?(.)/
- ace
-
-/^(.+)?B/
- AB
-
-/^([^a-z])|(\^)$/
- .
-
-/^[<>]&/
- <&OUT
-
-/^(a\1?){4}$/
- aaaaaaaaaa
- *** Failers
- AB
- aaaaaaaaa
- aaaaaaaaaaa
-
-/^(a(?(1)\1)){4}$/
- aaaaaaaaaa
- *** Failers
- aaaaaaaaa
- aaaaaaaaaaa
-
-/(?:(f)(o)(o)|(b)(a)(r))*/
- foobar
-
-/(?<=a)b/
- ab
- *** Failers
- cb
- b
-
-/(?<!c)b/
- ab
- b
- b
-
-/(?:..)*a/
- aba
-
-/(?:..)*?a/
- aba
-
-/^(?:b|a(?=(.)))*\1/
- abc
-
-/^(){3,5}/
- abc
-
-/^(a+)*ax/
- aax
-
-/^((a|b)+)*ax/
- aax
-
-/^((a|bc)+)*ax/
- aax
-
-/(a|x)*ab/
- cab
-
-/(a)*ab/
- cab
-
-/(?:(?i)a)b/
- ab
-
-/((?i)a)b/
- ab
-
-/(?:(?i)a)b/
- Ab
-
-/((?i)a)b/
- Ab
-
-/(?:(?i)a)b/
- *** Failers
- cb
- aB
-
-/((?i)a)b/
-
-/(?i:a)b/
- ab
-
-/((?i:a))b/
- ab
-
-/(?i:a)b/
- Ab
-
-/((?i:a))b/
- Ab
-
-/(?i:a)b/
- *** Failers
- aB
- aB
-
-/((?i:a))b/
-
-/(?:(?-i)a)b/i
- ab
-
-/((?-i)a)b/i
- ab
-
-/(?:(?-i)a)b/i
- aB
-
-/((?-i)a)b/i
- aB
-
-/(?:(?-i)a)b/i
- *** Failers
- aB
- Ab
-
-/((?-i)a)b/i
-
-/(?:(?-i)a)b/i
- aB
-
-/((?-i)a)b/i
- aB
-
-/(?:(?-i)a)b/i
- *** Failers
- Ab
- AB
-
-/((?-i)a)b/i
-
-/(?-i:a)b/i
- ab
-
-/((?-i:a))b/i
- ab
-
-/(?-i:a)b/i
- aB
-
-/((?-i:a))b/i
- aB
-
-/(?-i:a)b/i
- *** Failers
- AB
- Ab
-
-/((?-i:a))b/i
-
-/(?-i:a)b/i
- aB
-
-/((?-i:a))b/i
- aB
-
-/(?-i:a)b/i
- *** Failers
- Ab
- AB
-
-/((?-i:a))b/i
-
-/((?-i:a.))b/i
- *** Failers
- AB
- a\nB
-
-/((?s-i:a.))b/i
- a\nB
-
-/(?:c|d)(?:)(?:a(?:)(?:b)(?:b(?:))(?:b(?:)(?:b)))/
- cabbbb
-
-/(?:c|d)(?:)(?:aaaaaaaa(?:)(?:bbbbbbbb)(?:bbbbbbbb(?:))(?:bbbbbbbb(?:)(?:bbbbbbbb)))/
- caaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
-
-/(ab)\d\1/i
- Ab4ab
- ab4Ab
-
-/foo\w*\d{4}baz/
- foobar1234baz
-
-/x(~~)*(?:(?:F)?)?/
- x~~
-
-/^a(?#xxx){3}c/
- aaac
-
-/^a (?#xxx) (?#yyy) {3}c/x
- aaac
-
-/(?<![cd])b/
- *** Failers
- B\nB
- dbcb
-
-/(?<![cd])[ab]/
- dbaacb
-
-/(?<!(c|d))b/
-
-/(?<!(c|d))[ab]/
- dbaacb
-
-/(?<!cd)[ab]/
- cdaccb
-
-/^(?:a?b?)*$/
- *** Failers
- dbcb
- a--
-
-/((?s)^a(.))((?m)^b$)/
- a\nb\nc\n
-
-/((?m)^b$)/
- a\nb\nc\n
-
-/(?m)^b/
- a\nb\n
-
-/(?m)^(b)/
- a\nb\n
-
-/((?m)^b)/
- a\nb\n
-
-/\n((?m)^b)/
- a\nb\n
-
-/((?s).)c(?!.)/
- a\nb\nc\n
- a\nb\nc\n
-
-/((?s)b.)c(?!.)/
- a\nb\nc\n
- a\nb\nc\n
-
-/^b/
-
-/()^b/
- *** Failers
- a\nb\nc\n
- a\nb\nc\n
-
-/((?m)^b)/
- a\nb\nc\n
-
-/(?(1)a|b)/
-
-/(?(1)b|a)/
- a
-
-/(x)?(?(1)a|b)/
- *** Failers
- a
- a
-
-/(x)?(?(1)b|a)/
- a
-
-/()?(?(1)b|a)/
- a
-
-/()(?(1)b|a)/
-
-/()?(?(1)a|b)/
- a
-
-/^(\()?blah(?(1)(\)))$/
- (blah)
- blah
- *** Failers
- a
- blah)
- (blah
-
-/^(\(+)?blah(?(1)(\)))$/
- (blah)
- blah
- *** Failers
- blah)
- (blah
-
-/(?(?!a)a|b)/
-
-/(?(?!a)b|a)/
- a
-
-/(?(?=a)b|a)/
- *** Failers
- a
- a
-
-/(?(?=a)a|b)/
- a
-
-/(?=(a+?))(\1ab)/
- aaab
-
-/^(?=(a+?))\1ab/
-
-/(\w+:)+/
- one:
-
-/$(?<=^(a))/
- a
-
-/(?=(a+?))(\1ab)/
- aaab
-
-/^(?=(a+?))\1ab/
- *** Failers
- aaab
- aaab
-
-/([\w:]+::)?(\w+)$/
- abcd
- xy:z:::abcd
-
-/^[^bcd]*(c+)/
- aexycd
-
-/(a*)b+/
- caab
-
-/([\w:]+::)?(\w+)$/
- abcd
- xy:z:::abcd
- *** Failers
- abcd:
- abcd:
-
-/^[^bcd]*(c+)/
- aexycd
-
-/(>a+)ab/
-
-/(?>a+)b/
- aaab
-
-/([[:]+)/
- a:[b]:
-
-/([[=]+)/
- a=[b]=
-
-/([[.]+)/
- a.[b].
-
-/((?>a+)b)/
- aaab
-
-/(?>(a+))b/
- aaab
-
-/((?>[^()]+)|\([^()]*\))+/
- ((abc(ade)ufh()()x
-
-/a\Z/
- *** Failers
- aaab
- a\nb\n
-
-/b\Z/
- a\nb\n
-
-/b\z/
-
-/b\Z/
- a\nb
-
-/b\z/
- a\nb
- *** Failers
-
-/^(?>(?(1)\.|())[^\W_](?>[a-z0-9-]*[^\W_])?)+$/
- a
- abc
- a-b
- 0-9
- a.b
- 5.6.7
- the.quick.brown.fox
- a100.b200.300c
- 12-ab.1245
- ***Failers
- \
- .a
- -a
- a-
- a.
- a_b
- a.-
- a..
- ab..bc
- the.quick.brown.fox-
- the.quick.brown.fox.
- the.quick.brown.fox_
- the.quick.brown.fox+
-
-/(?>.*)(?<=(abcd|wxyz))/
- alphabetabcd
- endingwxyz
- *** Failers
- a rather long string that doesn't end with one of them
-
-/word (?>(?:(?!otherword)[a-zA-Z0-9]+ ){0,30})otherword/
- word cat dog elephant mussel cow horse canary baboon snake shark otherword
- word cat dog elephant mussel cow horse canary baboon snake shark
-
-/word (?>[a-zA-Z0-9]+ ){0,30}otherword/
- word cat dog elephant mussel cow horse canary baboon snake shark the quick brown fox and the lazy dog and several other words getting close to thirty by now I hope
-
-/(?<=\d{3}(?!999))foo/
- 999foo
- 123999foo
- *** Failers
- 123abcfoo
-
-/(?<=(?!...999)\d{3})foo/
- 999foo
- 123999foo
- *** Failers
- 123abcfoo
-
-/(?<=\d{3}(?!999)...)foo/
- 123abcfoo
- 123456foo
- *** Failers
- 123999foo
-
-/(?<=\d{3}...)(?<!999)foo/
- 123abcfoo
- 123456foo
- *** Failers
- 123999foo
-
-/<a[\s]+href[\s]*=[\s]* # find <a href=
- ([\"\'])? # find single or double quote
- (?(1) (.*?)\1 | ([^\s]+)) # if quote found, match up to next matching
- # quote, otherwise match up to next space
-/isx
- <a href=abcd xyz
- <a href=\"abcd xyz pqr\" cats
- <a href=\'abcd xyz pqr\' cats
-
-/<a\s+href\s*=\s* # find <a href=
- (["'])? # find single or double quote
- (?(1) (.*?)\1 | (\S+)) # if quote found, match up to next matching
- # quote, otherwise match up to next space
-/isx
- <a href=abcd xyz
- <a href=\"abcd xyz pqr\" cats
- <a href = \'abcd xyz pqr\' cats
-
-/<a\s+href(?>\s*)=(?>\s*) # find <a href=
- (["'])? # find single or double quote
- (?(1) (.*?)\1 | (\S+)) # if quote found, match up to next matching
- # quote, otherwise match up to next space
-/isx
- <a href=abcd xyz
- <a href=\"abcd xyz pqr\" cats
- <a href = \'abcd xyz pqr\' cats
-
-/((Z)+|A)*/
- ZABCDEFG
-
-/(Z()|A)*/
- ZABCDEFG
-
-/(Z(())|A)*/
- ZABCDEFG
-
-/((?>Z)+|A)*/
- ZABCDEFG
-
-/((?>)+|A)*/
- ZABCDEFG
-
-/a*/g
- abbab
-
-/^[a-\d]/
- abcde
- -things
- 0digit
- *** Failers
- bcdef
-
-/^[\d-a]/
- abcde
- -things
- 0digit
- *** Failers
- bcdef
-
-/ End of testinput3 /
diff --git a/ext/pcre/pcrelib/testdata/testinput4 b/ext/pcre/pcrelib/testdata/testinput4
deleted file mode 100644
index f2878965f6..0000000000
--- a/ext/pcre/pcrelib/testdata/testinput4
+++ /dev/null
@@ -1,65 +0,0 @@
-/^[\w]+/
- *** Failers
- École
-
-/^[\w]+/Lfr
- École
-
-/^[\w]+/
- *** Failers
- École
-
-/^[\W]+/
- École
-
-/^[\W]+/Lfr
- *** Failers
- École
-
-/[\b]/
- \b
- *** Failers
- a
-
-/[\b]/Lfr
- \b
- *** Failers
- a
-
-/^\w+/
- *** Failers
- École
-
-/^\w+/Lfr
- École
-
-/(.+)\b(.+)/
- École
-
-/(.+)\b(.+)/Lfr
- *** Failers
- École
-
-/École/i
- École
- *** Failers
- école
-
-/École/iLfr
- École
- école
-
-/\w/IS
-
-/\w/ISLfr
-
-/^[\xc8-\xc9]/iLfr
- École
- école
-
-/^[\xc8-\xc9]/Lfr
- École
- *** Failers
- école
-
-/ End of testinput4 /
diff --git a/ext/pcre/pcrelib/testdata/testinput5 b/ext/pcre/pcrelib/testdata/testinput5
deleted file mode 100644
index d66cfbddf3..0000000000
--- a/ext/pcre/pcrelib/testdata/testinput5
+++ /dev/null
@@ -1,118 +0,0 @@
-/-- Because of problems with Perl 5.6 in handling UTF-8 vs non UTF-8 --/
-/-- strings automatically, do not use the \x{} construct except with --/
-/-- patterns that have the /8 option set, and don't use them without! --/
-
-/a.b/8
- acb
- a\x7fb
- a\x{100}b
- *** Failers
- a\nb
-
-/a(.{3})b/8
- a\x{4000}xyb
- a\x{4000}\x7fyb
- a\x{4000}\x{100}yb
- *** Failers
- a\x{4000}b
- ac\ncb
-
-/a(.*?)(.)/
- a\xc0\x88b
-
-/a(.*?)(.)/8
- a\x{100}b
-
-/a(.*)(.)/
- a\xc0\x88b
-
-/a(.*)(.)/8
- a\x{100}b
-
-/a(.)(.)/
- a\xc0\x92bcd
-
-/a(.)(.)/8
- a\x{240}bcd
-
-/a(.?)(.)/
- a\xc0\x92bcd
-
-/a(.?)(.)/8
- a\x{240}bcd
-
-/a(.??)(.)/
- a\xc0\x92bcd
-
-/a(.??)(.)/8
- a\x{240}bcd
-
-/a(.{3})b/8
- a\x{1234}xyb
- a\x{1234}\x{4321}yb
- a\x{1234}\x{4321}\x{3412}b
- *** Failers
- a\x{1234}b
- ac\ncb
-
-/a(.{3,})b/8
- a\x{1234}xyb
- a\x{1234}\x{4321}yb
- a\x{1234}\x{4321}\x{3412}b
- axxxxbcdefghijb
- a\x{1234}\x{4321}\x{3412}\x{3421}b
- *** Failers
- a\x{1234}b
-
-/a(.{3,}?)b/8
- a\x{1234}xyb
- a\x{1234}\x{4321}yb
- a\x{1234}\x{4321}\x{3412}b
- axxxxbcdefghijb
- a\x{1234}\x{4321}\x{3412}\x{3421}b
- *** Failers
- a\x{1234}b
-
-/a(.{3,5})b/8
- a\x{1234}xyb
- a\x{1234}\x{4321}yb
- a\x{1234}\x{4321}\x{3412}b
- axxxxbcdefghijb
- a\x{1234}\x{4321}\x{3412}\x{3421}b
- axbxxbcdefghijb
- axxxxxbcdefghijb
- *** Failers
- a\x{1234}b
- axxxxxxbcdefghijb
-
-/a(.{3,5}?)b/8
- a\x{1234}xyb
- a\x{1234}\x{4321}yb
- a\x{1234}\x{4321}\x{3412}b
- axxxxbcdefghijb
- a\x{1234}\x{4321}\x{3412}\x{3421}b
- axbxxbcdefghijb
- axxxxxbcdefghijb
- *** Failers
- a\x{1234}b
- axxxxxxbcdefghijb
-
-/^[a\x{c0}]/8
- *** Failers
- \x{100}
-
-/(?<=aXb)cd/8
- aXbcd
-
-/(?<=a\x{100}b)cd/8
- a\x{100}bcd
-
-/(?<=a\x{100000}b)cd/8
- a\x{100000}bcd
-
-/(?:\x{100}){3}b/8
- \x{100}\x{100}\x{100}b
- *** Failers
- \x{100}\x{100}b
-
-/ End of testinput5 /
diff --git a/ext/pcre/pcrelib/testdata/testinput6 b/ext/pcre/pcrelib/testdata/testinput6
deleted file mode 100644
index 1ccaa0dbc1..0000000000
--- a/ext/pcre/pcrelib/testdata/testinput6
+++ /dev/null
@@ -1,52 +0,0 @@
-/\x{100}/8DM
-
-/\x{1000}/8DM
-
-/\x{10000}/8DM
-
-/\x{100000}/8DM
-
-/\x{1000000}/8DM
-
-/\x{4000000}/8DM
-
-/\x{7fffFFFF}/8DM
-
-/[\x{ff}]/8DM
-
-/[\x{100}]/8DM
-
-/\x{ffffffff}/8
-
-/\x{100000000}/8
-
-/^\x{100}a\x{1234}/8
- \x{100}a\x{1234}bcd
-
-/\x80/8D
-
-/\xff/8D
-
-/-- These tests are here rather than in testinput5 because Perl 5.6 has --/
-/-- some problems with UTF-8 support, in the area of \x{..} where the --/
-/-- value is < 255. It grumbles about invalid UTF-8 strings. --/
-
-/^[a\x{c0}]b/8
- \x{c0}b
-
-/^([a\x{c0}]*?)aa/8
- a\x{c0}aaaa/
-
-/^([a\x{c0}]*?)aa/8
- a\x{c0}aaaa/
- a\x{c0}a\x{c0}aaa/
-
-/^([a\x{c0}]*)aa/8
- a\x{c0}aaaa/
- a\x{c0}a\x{c0}aaa/
-
-/^([a\x{c0}]*)a\x{c0}/8
- a\x{c0}aaaa/
- a\x{c0}a\x{c0}aaa/
-
-/ End of testinput6 /
diff --git a/ext/pcre/pcrelib/testdata/testoutput1 b/ext/pcre/pcrelib/testdata/testoutput1
deleted file mode 100644
index a6930bc9f1..0000000000
--- a/ext/pcre/pcrelib/testdata/testoutput1
+++ /dev/null
@@ -1,2966 +0,0 @@
-PCRE version 3.4 22-Aug-2000
-
-/the quick brown fox/
- the quick brown fox
- 0: the quick brown fox
- The quick brown FOX
-No match
- What do you know about the quick brown fox?
- 0: the quick brown fox
- What do you know about THE QUICK BROWN FOX?
-No match
-
-/The quick brown fox/i
- the quick brown fox
- 0: the quick brown fox
- The quick brown FOX
- 0: The quick brown FOX
- What do you know about the quick brown fox?
- 0: the quick brown fox
- What do you know about THE QUICK BROWN FOX?
- 0: THE QUICK BROWN FOX
-
-/abcd\t\n\r\f\a\e\071\x3b\$\\\?caxyz/
- abcd\t\n\r\f\a\e9;\$\\?caxyz
- 0: abcd\x09\x0a\x0d\x0c\x07\x1b9;$\?caxyz
-
-/a*abc?xyz+pqr{3}ab{2,}xy{4,5}pq{0,6}AB{0,}zz/
- abxyzpqrrrabbxyyyypqAzz
- 0: abxyzpqrrrabbxyyyypqAzz
- abxyzpqrrrabbxyyyypqAzz
- 0: abxyzpqrrrabbxyyyypqAzz
- aabxyzpqrrrabbxyyyypqAzz
- 0: aabxyzpqrrrabbxyyyypqAzz
- aaabxyzpqrrrabbxyyyypqAzz
- 0: aaabxyzpqrrrabbxyyyypqAzz
- aaaabxyzpqrrrabbxyyyypqAzz
- 0: aaaabxyzpqrrrabbxyyyypqAzz
- abcxyzpqrrrabbxyyyypqAzz
- 0: abcxyzpqrrrabbxyyyypqAzz
- aabcxyzpqrrrabbxyyyypqAzz
- 0: aabcxyzpqrrrabbxyyyypqAzz
- aaabcxyzpqrrrabbxyyyypAzz
- 0: aaabcxyzpqrrrabbxyyyypAzz
- aaabcxyzpqrrrabbxyyyypqAzz
- 0: aaabcxyzpqrrrabbxyyyypqAzz
- aaabcxyzpqrrrabbxyyyypqqAzz
- 0: aaabcxyzpqrrrabbxyyyypqqAzz
- aaabcxyzpqrrrabbxyyyypqqqAzz
- 0: aaabcxyzpqrrrabbxyyyypqqqAzz
- aaabcxyzpqrrrabbxyyyypqqqqAzz
- 0: aaabcxyzpqrrrabbxyyyypqqqqAzz
- aaabcxyzpqrrrabbxyyyypqqqqqAzz
- 0: aaabcxyzpqrrrabbxyyyypqqqqqAzz
- aaabcxyzpqrrrabbxyyyypqqqqqqAzz
- 0: aaabcxyzpqrrrabbxyyyypqqqqqqAzz
- aaaabcxyzpqrrrabbxyyyypqAzz
- 0: aaaabcxyzpqrrrabbxyyyypqAzz
- abxyzzpqrrrabbxyyyypqAzz
- 0: abxyzzpqrrrabbxyyyypqAzz
- aabxyzzzpqrrrabbxyyyypqAzz
- 0: aabxyzzzpqrrrabbxyyyypqAzz
- aaabxyzzzzpqrrrabbxyyyypqAzz
- 0: aaabxyzzzzpqrrrabbxyyyypqAzz
- aaaabxyzzzzpqrrrabbxyyyypqAzz
- 0: aaaabxyzzzzpqrrrabbxyyyypqAzz
- abcxyzzpqrrrabbxyyyypqAzz
- 0: abcxyzzpqrrrabbxyyyypqAzz
- aabcxyzzzpqrrrabbxyyyypqAzz
- 0: aabcxyzzzpqrrrabbxyyyypqAzz
- aaabcxyzzzzpqrrrabbxyyyypqAzz
- 0: aaabcxyzzzzpqrrrabbxyyyypqAzz
- aaaabcxyzzzzpqrrrabbxyyyypqAzz
- 0: aaaabcxyzzzzpqrrrabbxyyyypqAzz
- aaaabcxyzzzzpqrrrabbbxyyyypqAzz
- 0: aaaabcxyzzzzpqrrrabbbxyyyypqAzz
- aaaabcxyzzzzpqrrrabbbxyyyyypqAzz
- 0: aaaabcxyzzzzpqrrrabbbxyyyyypqAzz
- aaabcxyzpqrrrabbxyyyypABzz
- 0: aaabcxyzpqrrrabbxyyyypABzz
- aaabcxyzpqrrrabbxyyyypABBzz
- 0: aaabcxyzpqrrrabbxyyyypABBzz
- >>>aaabxyzpqrrrabbxyyyypqAzz
- 0: aaabxyzpqrrrabbxyyyypqAzz
- >aaaabxyzpqrrrabbxyyyypqAzz
- 0: aaaabxyzpqrrrabbxyyyypqAzz
- >>>>abcxyzpqrrrabbxyyyypqAzz
- 0: abcxyzpqrrrabbxyyyypqAzz
- *** Failers
-No match
- abxyzpqrrabbxyyyypqAzz
-No match
- abxyzpqrrrrabbxyyyypqAzz
-No match
- abxyzpqrrrabxyyyypqAzz
-No match
- aaaabcxyzzzzpqrrrabbbxyyyyyypqAzz
-No match
- aaaabcxyzzzzpqrrrabbbxyyypqAzz
-No match
- aaabcxyzpqrrrabbxyyyypqqqqqqqAzz
-No match
-
-/^(abc){1,2}zz/
- abczz
- 0: abczz
- 1: abc
- abcabczz
- 0: abcabczz
- 1: abc
- *** Failers
-No match
- zz
-No match
- abcabcabczz
-No match
- >>abczz
-No match
-
-/^(b+?|a){1,2}?c/
- bc
- 0: bc
- 1: b
- bbc
- 0: bbc
- 1: b
- bbbc
- 0: bbbc
- 1: bb
- bac
- 0: bac
- 1: a
- bbac
- 0: bbac
- 1: a
- aac
- 0: aac
- 1: a
- abbbbbbbbbbbc
- 0: abbbbbbbbbbbc
- 1: bbbbbbbbbbb
- bbbbbbbbbbbac
- 0: bbbbbbbbbbbac
- 1: a
- *** Failers
-No match
- aaac
-No match
- abbbbbbbbbbbac
-No match
-
-/^(b+|a){1,2}c/
- bc
- 0: bc
- 1: b
- bbc
- 0: bbc
- 1: bb
- bbbc
- 0: bbbc
- 1: bbb
- bac
- 0: bac
- 1: a
- bbac
- 0: bbac
- 1: a
- aac
- 0: aac
- 1: a
- abbbbbbbbbbbc
- 0: abbbbbbbbbbbc
- 1: bbbbbbbbbbb
- bbbbbbbbbbbac
- 0: bbbbbbbbbbbac
- 1: a
- *** Failers
-No match
- aaac
-No match
- abbbbbbbbbbbac
-No match
-
-/^(b+|a){1,2}?bc/
- bbc
- 0: bbc
- 1: b
-
-/^(b*|ba){1,2}?bc/
- babc
- 0: babc
- 1: ba
- bbabc
- 0: bbabc
- 1: ba
- bababc
- 0: bababc
- 1: ba
- *** Failers
-No match
- bababbc
-No match
- babababc
-No match
-
-/^(ba|b*){1,2}?bc/
- babc
- 0: babc
- 1: ba
- bbabc
- 0: bbabc
- 1: ba
- bababc
- 0: bababc
- 1: ba
- *** Failers
-No match
- bababbc
-No match
- babababc
-No match
-
-/^\ca\cA\c[\c{\c:/
- \x01\x01\e;z
- 0: \x01\x01\x1b;z
-
-/^[ab\]cde]/
- athing
- 0: a
- bthing
- 0: b
- ]thing
- 0: ]
- cthing
- 0: c
- dthing
- 0: d
- ething
- 0: e
- *** Failers
-No match
- fthing
-No match
- [thing
-No match
- \\thing
-No match
-
-/^[]cde]/
- ]thing
- 0: ]
- cthing
- 0: c
- dthing
- 0: d
- ething
- 0: e
- *** Failers
-No match
- athing
-No match
- fthing
-No match
-
-/^[^ab\]cde]/
- fthing
- 0: f
- [thing
- 0: [
- \\thing
- 0: \
- *** Failers
- 0: *
- athing
-No match
- bthing
-No match
- ]thing
-No match
- cthing
-No match
- dthing
-No match
- ething
-No match
-
-/^[^]cde]/
- athing
- 0: a
- fthing
- 0: f
- *** Failers
- 0: *
- ]thing
-No match
- cthing
-No match
- dthing
-No match
- ething
-No match
-
-/^\/
-
- 0: \x81
-
-/^ÿ/
- ÿ
- 0: \xff
-
-/^[0-9]+$/
- 0
- 0: 0
- 1
- 0: 1
- 2
- 0: 2
- 3
- 0: 3
- 4
- 0: 4
- 5
- 0: 5
- 6
- 0: 6
- 7
- 0: 7
- 8
- 0: 8
- 9
- 0: 9
- 10
- 0: 10
- 100
- 0: 100
- *** Failers
-No match
- abc
-No match
-
-/^.*nter/
- enter
- 0: enter
- inter
- 0: inter
- uponter
- 0: uponter
-
-/^xxx[0-9]+$/
- xxx0
- 0: xxx0
- xxx1234
- 0: xxx1234
- *** Failers
-No match
- xxx
-No match
-
-/^.+[0-9][0-9][0-9]$/
- x123
- 0: x123
- xx123
- 0: xx123
- 123456
- 0: 123456
- *** Failers
-No match
- 123
-No match
- x1234
- 0: x1234
-
-/^.+?[0-9][0-9][0-9]$/
- x123
- 0: x123
- xx123
- 0: xx123
- 123456
- 0: 123456
- *** Failers
-No match
- 123
-No match
- x1234
- 0: x1234
-
-/^([^!]+)!(.+)=apquxz\.ixr\.zzz\.ac\.uk$/
- abc!pqr=apquxz.ixr.zzz.ac.uk
- 0: abc!pqr=apquxz.ixr.zzz.ac.uk
- 1: abc
- 2: pqr
- *** Failers
-No match
- !pqr=apquxz.ixr.zzz.ac.uk
-No match
- abc!=apquxz.ixr.zzz.ac.uk
-No match
- abc!pqr=apquxz:ixr.zzz.ac.uk
-No match
- abc!pqr=apquxz.ixr.zzz.ac.ukk
-No match
-
-/:/
- Well, we need a colon: somewhere
- 0: :
- *** Fail if we don't
-No match
-
-/([\da-f:]+)$/i
- 0abc
- 0: 0abc
- 1: 0abc
- abc
- 0: abc
- 1: abc
- fed
- 0: fed
- 1: fed
- E
- 0: E
- 1: E
- ::
- 0: ::
- 1: ::
- 5f03:12C0::932e
- 0: 5f03:12C0::932e
- 1: 5f03:12C0::932e
- fed def
- 0: def
- 1: def
- Any old stuff
- 0: ff
- 1: ff
- *** Failers
-No match
- 0zzz
-No match
- gzzz
-No match
- fed\x20
-No match
- Any old rubbish
-No match
-
-/^.*\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/
- .1.2.3
- 0: .1.2.3
- 1: 1
- 2: 2
- 3: 3
- A.12.123.0
- 0: A.12.123.0
- 1: 12
- 2: 123
- 3: 0
- *** Failers
-No match
- .1.2.3333
-No match
- 1.2.3
-No match
- 1234.2.3
-No match
-
-/^(\d+)\s+IN\s+SOA\s+(\S+)\s+(\S+)\s*\(\s*$/
- 1 IN SOA non-sp1 non-sp2(
- 0: 1 IN SOA non-sp1 non-sp2(
- 1: 1
- 2: non-sp1
- 3: non-sp2
- 1 IN SOA non-sp1 non-sp2 (
- 0: 1 IN SOA non-sp1 non-sp2 (
- 1: 1
- 2: non-sp1
- 3: non-sp2
- *** Failers
-No match
- 1IN SOA non-sp1 non-sp2(
-No match
-
-/^[a-zA-Z\d][a-zA-Z\d\-]*(\.[a-zA-Z\d][a-zA-z\d\-]*)*\.$/
- a.
- 0: a.
- Z.
- 0: Z.
- 2.
- 0: 2.
- ab-c.pq-r.
- 0: ab-c.pq-r.
- 1: .pq-r
- sxk.zzz.ac.uk.
- 0: sxk.zzz.ac.uk.
- 1: .uk
- x-.y-.
- 0: x-.y-.
- 1: .y-
- *** Failers
-No match
- -abc.peq.
-No match
-
-/^\*\.[a-z]([a-z\-\d]*[a-z\d]+)?(\.[a-z]([a-z\-\d]*[a-z\d]+)?)*$/
- *.a
- 0: *.a
- *.b0-a
- 0: *.b0-a
- 1: 0-a
- *.c3-b.c
- 0: *.c3-b.c
- 1: 3-b
- 2: .c
- *.c-a.b-c
- 0: *.c-a.b-c
- 1: -a
- 2: .b-c
- 3: -c
- *** Failers
-No match
- *.0
-No match
- *.a-
-No match
- *.a-b.c-
-No match
- *.c-a.0-c
-No match
-
-/^(?=ab(de))(abd)(e)/
- abde
- 0: abde
- 1: de
- 2: abd
- 3: e
-
-/^(?!(ab)de|x)(abd)(f)/
- abdf
- 0: abdf
- 1: <unset>
- 2: abd
- 3: f
-
-/^(?=(ab(cd)))(ab)/
- abcd
- 0: ab
- 1: abcd
- 2: cd
- 3: ab
-
-/^[\da-f](\.[\da-f])*$/i
- a.b.c.d
- 0: a.b.c.d
- 1: .d
- A.B.C.D
- 0: A.B.C.D
- 1: .D
- a.b.c.1.2.3.C
- 0: a.b.c.1.2.3.C
- 1: .C
-
-/^\".*\"\s*(;.*)?$/
- \"1234\"
- 0: "1234"
- \"abcd\" ;
- 0: "abcd" ;
- 1: ;
- \"\" ; rhubarb
- 0: "" ; rhubarb
- 1: ; rhubarb
- *** Failers
-No match
- \"1234\" : things
-No match
-
-/^$/
- \
- 0:
- *** Failers
-No match
-
-/ ^ a (?# begins with a) b\sc (?# then b c) $ (?# then end)/x
- ab c
- 0: ab c
- *** Failers
-No match
- abc
-No match
- ab cde
-No match
-
-/(?x) ^ a (?# begins with a) b\sc (?# then b c) $ (?# then end)/
- ab c
- 0: ab c
- *** Failers
-No match
- abc
-No match
- ab cde
-No match
-
-/^ a\ b[c ]d $/x
- a bcd
- 0: a bcd
- a b d
- 0: a b d
- *** Failers
-No match
- abcd
-No match
- ab d
-No match
-
-/^(a(b(c)))(d(e(f)))(h(i(j)))(k(l(m)))$/
- abcdefhijklm
- 0: abcdefhijklm
- 1: abc
- 2: bc
- 3: c
- 4: def
- 5: ef
- 6: f
- 7: hij
- 8: ij
- 9: j
-10: klm
-11: lm
-12: m
-
-/^(?:a(b(c)))(?:d(e(f)))(?:h(i(j)))(?:k(l(m)))$/
- abcdefhijklm
- 0: abcdefhijklm
- 1: bc
- 2: c
- 3: ef
- 4: f
- 5: ij
- 6: j
- 7: lm
- 8: m
-
-/^[\w][\W][\s][\S][\d][\D][\b][\n][\c]][\022]/
- a+ Z0+\x08\n\x1d\x12
- 0: a+ Z0+\x08\x0a\x1d\x12
-
-/^[.^$|()*+?{,}]+/
- .^\$(*+)|{?,?}
- 0: .^$(*+)|{?,?}
-
-/^a*\w/
- z
- 0: z
- az
- 0: az
- aaaz
- 0: aaaz
- a
- 0: a
- aa
- 0: aa
- aaaa
- 0: aaaa
- a+
- 0: a
- aa+
- 0: aa
-
-/^a*?\w/
- z
- 0: z
- az
- 0: a
- aaaz
- 0: a
- a
- 0: a
- aa
- 0: a
- aaaa
- 0: a
- a+
- 0: a
- aa+
- 0: a
-
-/^a+\w/
- az
- 0: az
- aaaz
- 0: aaaz
- aa
- 0: aa
- aaaa
- 0: aaaa
- aa+
- 0: aa
-
-/^a+?\w/
- az
- 0: az
- aaaz
- 0: aa
- aa
- 0: aa
- aaaa
- 0: aa
- aa+
- 0: aa
-
-/^\d{8}\w{2,}/
- 1234567890
- 0: 1234567890
- 12345678ab
- 0: 12345678ab
- 12345678__
- 0: 12345678__
- *** Failers
-No match
- 1234567
-No match
-
-/^[aeiou\d]{4,5}$/
- uoie
- 0: uoie
- 1234
- 0: 1234
- 12345
- 0: 12345
- aaaaa
- 0: aaaaa
- *** Failers
-No match
- 123456
-No match
-
-/^[aeiou\d]{4,5}?/
- uoie
- 0: uoie
- 1234
- 0: 1234
- 12345
- 0: 1234
- aaaaa
- 0: aaaa
- 123456
- 0: 1234
-
-/\A(abc|def)=(\1){2,3}\Z/
- abc=abcabc
- 0: abc=abcabc
- 1: abc
- 2: abc
- def=defdefdef
- 0: def=defdefdef
- 1: def
- 2: def
- *** Failers
-No match
- abc=defdef
-No match
-
-/^(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)\11*(\3\4)\1(?#)2$/
- abcdefghijkcda2
- 0: abcdefghijkcda2
- 1: a
- 2: b
- 3: c
- 4: d
- 5: e
- 6: f
- 7: g
- 8: h
- 9: i
-10: j
-11: k
-12: cd
- abcdefghijkkkkcda2
- 0: abcdefghijkkkkcda2
- 1: a
- 2: b
- 3: c
- 4: d
- 5: e
- 6: f
- 7: g
- 8: h
- 9: i
-10: j
-11: k
-12: cd
-
-/(cat(a(ract|tonic)|erpillar)) \1()2(3)/
- cataract cataract23
- 0: cataract cataract23
- 1: cataract
- 2: aract
- 3: ract
- 4:
- 5: 3
- catatonic catatonic23
- 0: catatonic catatonic23
- 1: catatonic
- 2: atonic
- 3: tonic
- 4:
- 5: 3
- caterpillar caterpillar23
- 0: caterpillar caterpillar23
- 1: caterpillar
- 2: erpillar
- 3: <unset>
- 4:
- 5: 3
-
-
-/^From +([^ ]+) +[a-zA-Z][a-zA-Z][a-zA-Z] +[a-zA-Z][a-zA-Z][a-zA-Z] +[0-9]?[0-9] +[0-9][0-9]:[0-9][0-9]/
- From abcd Mon Sep 01 12:33:02 1997
- 0: From abcd Mon Sep 01 12:33
- 1: abcd
-
-/^From\s+\S+\s+([a-zA-Z]{3}\s+){2}\d{1,2}\s+\d\d:\d\d/
- From abcd Mon Sep 01 12:33:02 1997
- 0: From abcd Mon Sep 01 12:33
- 1: Sep
- From abcd Mon Sep 1 12:33:02 1997
- 0: From abcd Mon Sep 1 12:33
- 1: Sep
- *** Failers
-No match
- From abcd Sep 01 12:33:02 1997
-No match
-
-/^12.34/s
- 12\n34
- 0: 12\x0a34
- 12\r34
- 0: 12\x0d34
-
-/\w+(?=\t)/
- the quick brown\t fox
- 0: brown
-
-/foo(?!bar)(.*)/
- foobar is foolish see?
- 0: foolish see?
- 1: lish see?
-
-/(?:(?!foo)...|^.{0,2})bar(.*)/
- foobar crowbar etc
- 0: rowbar etc
- 1: etc
- barrel
- 0: barrel
- 1: rel
- 2barrel
- 0: 2barrel
- 1: rel
- A barrel
- 0: A barrel
- 1: rel
-
-/^(\D*)(?=\d)(?!123)/
- abc456
- 0: abc
- 1: abc
- *** Failers
-No match
- abc123
-No match
-
-/^1234(?# test newlines
- inside)/
- 1234
- 0: 1234
-
-/^1234 #comment in extended re
- /x
- 1234
- 0: 1234
-
-/#rhubarb
- abcd/x
- abcd
- 0: abcd
-
-/^abcd#rhubarb/x
- abcd
- 0: abcd
-
-/^(a)\1{2,3}(.)/
- aaab
- 0: aaab
- 1: a
- 2: b
- aaaab
- 0: aaaab
- 1: a
- 2: b
- aaaaab
- 0: aaaaa
- 1: a
- 2: a
- aaaaaab
- 0: aaaaa
- 1: a
- 2: a
-
-/(?!^)abc/
- the abc
- 0: abc
- *** Failers
-No match
- abc
-No match
-
-/(?=^)abc/
- abc
- 0: abc
- *** Failers
-No match
- the abc
-No match
-
-/^[ab]{1,3}(ab*|b)/
- aabbbbb
- 0: aabb
- 1: b
-
-/^[ab]{1,3}?(ab*|b)/
- aabbbbb
- 0: aabbbbb
- 1: abbbbb
-
-/^[ab]{1,3}?(ab*?|b)/
- aabbbbb
- 0: aa
- 1: a
-
-/^[ab]{1,3}(ab*?|b)/
- aabbbbb
- 0: aabb
- 1: b
-
-/ (?: [\040\t] | \(
-(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
-\) )* # optional leading comment
-(?: (?:
-[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
-(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
-|
-" (?: # opening quote...
-[^\\\x80-\xff\n\015"] # Anything except backslash and quote
-| # or
-\\ [^\x80-\xff] # Escaped something (something != CR)
-)* " # closing quote
-) # initial word
-(?: (?: [\040\t] | \(
-(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
-\) )* \. (?: [\040\t] | \(
-(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
-\) )* (?:
-[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
-(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
-|
-" (?: # opening quote...
-[^\\\x80-\xff\n\015"] # Anything except backslash and quote
-| # or
-\\ [^\x80-\xff] # Escaped something (something != CR)
-)* " # closing quote
-) )* # further okay, if led by a period
-(?: [\040\t] | \(
-(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
-\) )* @ (?: [\040\t] | \(
-(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
-\) )* (?:
-[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
-(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
-| \[ # [
-(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
-\] # ]
-) # initial subdomain
-(?: #
-(?: [\040\t] | \(
-(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
-\) )* \. # if led by a period...
-(?: [\040\t] | \(
-(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
-\) )* (?:
-[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
-(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
-| \[ # [
-(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
-\] # ]
-) # ...further okay
-)*
-# address
-| # or
-(?:
-[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
-(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
-|
-" (?: # opening quote...
-[^\\\x80-\xff\n\015"] # Anything except backslash and quote
-| # or
-\\ [^\x80-\xff] # Escaped something (something != CR)
-)* " # closing quote
-) # one word, optionally followed by....
-(?:
-[^()<>@,;:".\\\[\]\x80-\xff\000-\010\012-\037] | # atom and space parts, or...
-\(
-(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
-\) | # comments, or...
-
-" (?: # opening quote...
-[^\\\x80-\xff\n\015"] # Anything except backslash and quote
-| # or
-\\ [^\x80-\xff] # Escaped something (something != CR)
-)* " # closing quote
-# quoted strings
-)*
-< (?: [\040\t] | \(
-(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
-\) )* # leading <
-(?: @ (?: [\040\t] | \(
-(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
-\) )* (?:
-[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
-(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
-| \[ # [
-(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
-\] # ]
-) # initial subdomain
-(?: #
-(?: [\040\t] | \(
-(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
-\) )* \. # if led by a period...
-(?: [\040\t] | \(
-(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
-\) )* (?:
-[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
-(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
-| \[ # [
-(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
-\] # ]
-) # ...further okay
-)*
-
-(?: (?: [\040\t] | \(
-(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
-\) )* , (?: [\040\t] | \(
-(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
-\) )* @ (?: [\040\t] | \(
-(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
-\) )* (?:
-[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
-(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
-| \[ # [
-(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
-\] # ]
-) # initial subdomain
-(?: #
-(?: [\040\t] | \(
-(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
-\) )* \. # if led by a period...
-(?: [\040\t] | \(
-(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
-\) )* (?:
-[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
-(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
-| \[ # [
-(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
-\] # ]
-) # ...further okay
-)*
-)* # further okay, if led by comma
-: # closing colon
-(?: [\040\t] | \(
-(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
-\) )* )? # optional route
-(?:
-[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
-(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
-|
-" (?: # opening quote...
-[^\\\x80-\xff\n\015"] # Anything except backslash and quote
-| # or
-\\ [^\x80-\xff] # Escaped something (something != CR)
-)* " # closing quote
-) # initial word
-(?: (?: [\040\t] | \(
-(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
-\) )* \. (?: [\040\t] | \(
-(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
-\) )* (?:
-[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
-(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
-|
-" (?: # opening quote...
-[^\\\x80-\xff\n\015"] # Anything except backslash and quote
-| # or
-\\ [^\x80-\xff] # Escaped something (something != CR)
-)* " # closing quote
-) )* # further okay, if led by a period
-(?: [\040\t] | \(
-(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
-\) )* @ (?: [\040\t] | \(
-(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
-\) )* (?:
-[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
-(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
-| \[ # [
-(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
-\] # ]
-) # initial subdomain
-(?: #
-(?: [\040\t] | \(
-(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
-\) )* \. # if led by a period...
-(?: [\040\t] | \(
-(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
-\) )* (?:
-[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
-(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
-| \[ # [
-(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
-\] # ]
-) # ...further okay
-)*
-# address spec
-(?: [\040\t] | \(
-(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
-\) )* > # trailing >
-# name and address
-) (?: [\040\t] | \(
-(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
-\) )* # optional trailing comment
-/x
- Alan Other <user\@dom.ain>
- 0: Alan Other <user@dom.ain>
- <user\@dom.ain>
- 0: user@dom.ain
- user\@dom.ain
- 0: user@dom.ain
- \"A. Other\" <user.1234\@dom.ain> (a comment)
- 0: "A. Other" <user.1234@dom.ain> (a comment)
- A. Other <user.1234\@dom.ain> (a comment)
- 0: Other <user.1234@dom.ain> (a comment)
- \"/s=user/ou=host/o=place/prmd=uu.yy/admd= /c=gb/\"\@x400-re.lay
- 0: "/s=user/ou=host/o=place/prmd=uu.yy/admd= /c=gb/"@x400-re.lay
- A missing angle <user\@some.where
- 0: user@some.where
- *** Failers
-No match
- The quick brown fox
-No match
-
-/[\040\t]* # Nab whitespace.
-(?:
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: # (
-(?: \\ [^\x80-\xff] |
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
-\) # )
-) # special
-[^\\\x80-\xff\n\015()] * # normal*
-)* # )*
-\) # )
-[\040\t]* )* # If comment found, allow more spaces.
-# optional leading comment
-(?:
-(?:
-[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
-(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
-# Atom
-| # or
-" # "
-[^\\\x80-\xff\n\015"] * # normal
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015"] * )* # ( special normal* )*
-" # "
-# Quoted string
-)
-[\040\t]* # Nab whitespace.
-(?:
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: # (
-(?: \\ [^\x80-\xff] |
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
-\) # )
-) # special
-[^\\\x80-\xff\n\015()] * # normal*
-)* # )*
-\) # )
-[\040\t]* )* # If comment found, allow more spaces.
-(?:
-\.
-[\040\t]* # Nab whitespace.
-(?:
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: # (
-(?: \\ [^\x80-\xff] |
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
-\) # )
-) # special
-[^\\\x80-\xff\n\015()] * # normal*
-)* # )*
-\) # )
-[\040\t]* )* # If comment found, allow more spaces.
-(?:
-[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
-(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
-# Atom
-| # or
-" # "
-[^\\\x80-\xff\n\015"] * # normal
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015"] * )* # ( special normal* )*
-" # "
-# Quoted string
-)
-[\040\t]* # Nab whitespace.
-(?:
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: # (
-(?: \\ [^\x80-\xff] |
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
-\) # )
-) # special
-[^\\\x80-\xff\n\015()] * # normal*
-)* # )*
-\) # )
-[\040\t]* )* # If comment found, allow more spaces.
-# additional words
-)*
-@
-[\040\t]* # Nab whitespace.
-(?:
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: # (
-(?: \\ [^\x80-\xff] |
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
-\) # )
-) # special
-[^\\\x80-\xff\n\015()] * # normal*
-)* # )*
-\) # )
-[\040\t]* )* # If comment found, allow more spaces.
-(?:
-[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
-(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
-|
-\[ # [
-(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
-\] # ]
-)
-[\040\t]* # Nab whitespace.
-(?:
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: # (
-(?: \\ [^\x80-\xff] |
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
-\) # )
-) # special
-[^\\\x80-\xff\n\015()] * # normal*
-)* # )*
-\) # )
-[\040\t]* )* # If comment found, allow more spaces.
-# optional trailing comments
-(?:
-\.
-[\040\t]* # Nab whitespace.
-(?:
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: # (
-(?: \\ [^\x80-\xff] |
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
-\) # )
-) # special
-[^\\\x80-\xff\n\015()] * # normal*
-)* # )*
-\) # )
-[\040\t]* )* # If comment found, allow more spaces.
-(?:
-[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
-(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
-|
-\[ # [
-(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
-\] # ]
-)
-[\040\t]* # Nab whitespace.
-(?:
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: # (
-(?: \\ [^\x80-\xff] |
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
-\) # )
-) # special
-[^\\\x80-\xff\n\015()] * # normal*
-)* # )*
-\) # )
-[\040\t]* )* # If comment found, allow more spaces.
-# optional trailing comments
-)*
-# address
-| # or
-(?:
-[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
-(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
-# Atom
-| # or
-" # "
-[^\\\x80-\xff\n\015"] * # normal
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015"] * )* # ( special normal* )*
-" # "
-# Quoted string
-)
-# leading word
-[^()<>@,;:".\\\[\]\x80-\xff\000-\010\012-\037] * # "normal" atoms and or spaces
-(?:
-(?:
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: # (
-(?: \\ [^\x80-\xff] |
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
-\) # )
-) # special
-[^\\\x80-\xff\n\015()] * # normal*
-)* # )*
-\) # )
-|
-" # "
-[^\\\x80-\xff\n\015"] * # normal
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015"] * )* # ( special normal* )*
-" # "
-) # "special" comment or quoted string
-[^()<>@,;:".\\\[\]\x80-\xff\000-\010\012-\037] * # more "normal"
-)*
-<
-[\040\t]* # Nab whitespace.
-(?:
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: # (
-(?: \\ [^\x80-\xff] |
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
-\) # )
-) # special
-[^\\\x80-\xff\n\015()] * # normal*
-)* # )*
-\) # )
-[\040\t]* )* # If comment found, allow more spaces.
-# <
-(?:
-@
-[\040\t]* # Nab whitespace.
-(?:
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: # (
-(?: \\ [^\x80-\xff] |
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
-\) # )
-) # special
-[^\\\x80-\xff\n\015()] * # normal*
-)* # )*
-\) # )
-[\040\t]* )* # If comment found, allow more spaces.
-(?:
-[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
-(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
-|
-\[ # [
-(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
-\] # ]
-)
-[\040\t]* # Nab whitespace.
-(?:
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: # (
-(?: \\ [^\x80-\xff] |
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
-\) # )
-) # special
-[^\\\x80-\xff\n\015()] * # normal*
-)* # )*
-\) # )
-[\040\t]* )* # If comment found, allow more spaces.
-# optional trailing comments
-(?:
-\.
-[\040\t]* # Nab whitespace.
-(?:
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: # (
-(?: \\ [^\x80-\xff] |
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
-\) # )
-) # special
-[^\\\x80-\xff\n\015()] * # normal*
-)* # )*
-\) # )
-[\040\t]* )* # If comment found, allow more spaces.
-(?:
-[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
-(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
-|
-\[ # [
-(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
-\] # ]
-)
-[\040\t]* # Nab whitespace.
-(?:
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: # (
-(?: \\ [^\x80-\xff] |
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
-\) # )
-) # special
-[^\\\x80-\xff\n\015()] * # normal*
-)* # )*
-\) # )
-[\040\t]* )* # If comment found, allow more spaces.
-# optional trailing comments
-)*
-(?: ,
-[\040\t]* # Nab whitespace.
-(?:
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: # (
-(?: \\ [^\x80-\xff] |
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
-\) # )
-) # special
-[^\\\x80-\xff\n\015()] * # normal*
-)* # )*
-\) # )
-[\040\t]* )* # If comment found, allow more spaces.
-@
-[\040\t]* # Nab whitespace.
-(?:
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: # (
-(?: \\ [^\x80-\xff] |
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
-\) # )
-) # special
-[^\\\x80-\xff\n\015()] * # normal*
-)* # )*
-\) # )
-[\040\t]* )* # If comment found, allow more spaces.
-(?:
-[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
-(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
-|
-\[ # [
-(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
-\] # ]
-)
-[\040\t]* # Nab whitespace.
-(?:
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: # (
-(?: \\ [^\x80-\xff] |
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
-\) # )
-) # special
-[^\\\x80-\xff\n\015()] * # normal*
-)* # )*
-\) # )
-[\040\t]* )* # If comment found, allow more spaces.
-# optional trailing comments
-(?:
-\.
-[\040\t]* # Nab whitespace.
-(?:
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: # (
-(?: \\ [^\x80-\xff] |
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
-\) # )
-) # special
-[^\\\x80-\xff\n\015()] * # normal*
-)* # )*
-\) # )
-[\040\t]* )* # If comment found, allow more spaces.
-(?:
-[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
-(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
-|
-\[ # [
-(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
-\] # ]
-)
-[\040\t]* # Nab whitespace.
-(?:
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: # (
-(?: \\ [^\x80-\xff] |
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
-\) # )
-) # special
-[^\\\x80-\xff\n\015()] * # normal*
-)* # )*
-\) # )
-[\040\t]* )* # If comment found, allow more spaces.
-# optional trailing comments
-)*
-)* # additional domains
-:
-[\040\t]* # Nab whitespace.
-(?:
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: # (
-(?: \\ [^\x80-\xff] |
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
-\) # )
-) # special
-[^\\\x80-\xff\n\015()] * # normal*
-)* # )*
-\) # )
-[\040\t]* )* # If comment found, allow more spaces.
-# optional trailing comments
-)? # optional route
-(?:
-[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
-(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
-# Atom
-| # or
-" # "
-[^\\\x80-\xff\n\015"] * # normal
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015"] * )* # ( special normal* )*
-" # "
-# Quoted string
-)
-[\040\t]* # Nab whitespace.
-(?:
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: # (
-(?: \\ [^\x80-\xff] |
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
-\) # )
-) # special
-[^\\\x80-\xff\n\015()] * # normal*
-)* # )*
-\) # )
-[\040\t]* )* # If comment found, allow more spaces.
-(?:
-\.
-[\040\t]* # Nab whitespace.
-(?:
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: # (
-(?: \\ [^\x80-\xff] |
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
-\) # )
-) # special
-[^\\\x80-\xff\n\015()] * # normal*
-)* # )*
-\) # )
-[\040\t]* )* # If comment found, allow more spaces.
-(?:
-[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
-(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
-# Atom
-| # or
-" # "
-[^\\\x80-\xff\n\015"] * # normal
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015"] * )* # ( special normal* )*
-" # "
-# Quoted string
-)
-[\040\t]* # Nab whitespace.
-(?:
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: # (
-(?: \\ [^\x80-\xff] |
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
-\) # )
-) # special
-[^\\\x80-\xff\n\015()] * # normal*
-)* # )*
-\) # )
-[\040\t]* )* # If comment found, allow more spaces.
-# additional words
-)*
-@
-[\040\t]* # Nab whitespace.
-(?:
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: # (
-(?: \\ [^\x80-\xff] |
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
-\) # )
-) # special
-[^\\\x80-\xff\n\015()] * # normal*
-)* # )*
-\) # )
-[\040\t]* )* # If comment found, allow more spaces.
-(?:
-[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
-(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
-|
-\[ # [
-(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
-\] # ]
-)
-[\040\t]* # Nab whitespace.
-(?:
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: # (
-(?: \\ [^\x80-\xff] |
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
-\) # )
-) # special
-[^\\\x80-\xff\n\015()] * # normal*
-)* # )*
-\) # )
-[\040\t]* )* # If comment found, allow more spaces.
-# optional trailing comments
-(?:
-\.
-[\040\t]* # Nab whitespace.
-(?:
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: # (
-(?: \\ [^\x80-\xff] |
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
-\) # )
-) # special
-[^\\\x80-\xff\n\015()] * # normal*
-)* # )*
-\) # )
-[\040\t]* )* # If comment found, allow more spaces.
-(?:
-[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
-(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
-|
-\[ # [
-(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
-\] # ]
-)
-[\040\t]* # Nab whitespace.
-(?:
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: # (
-(?: \\ [^\x80-\xff] |
-\( # (
-[^\\\x80-\xff\n\015()] * # normal*
-(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
-\) # )
-) # special
-[^\\\x80-\xff\n\015()] * # normal*
-)* # )*
-\) # )
-[\040\t]* )* # If comment found, allow more spaces.
-# optional trailing comments
-)*
-# address spec
-> # >
-# name and address
-)
-/x
- Alan Other <user\@dom.ain>
- 0: Alan Other <user@dom.ain>
- <user\@dom.ain>
- 0: user@dom.ain
- user\@dom.ain
- 0: user@dom.ain
- \"A. Other\" <user.1234\@dom.ain> (a comment)
- 0: "A. Other" <user.1234@dom.ain>
- A. Other <user.1234\@dom.ain> (a comment)
- 0: Other <user.1234@dom.ain>
- \"/s=user/ou=host/o=place/prmd=uu.yy/admd= /c=gb/\"\@x400-re.lay
- 0: "/s=user/ou=host/o=place/prmd=uu.yy/admd= /c=gb/"@x400-re.lay
- A missing angle <user\@some.where
- 0: user@some.where
- *** Failers
-No match
- The quick brown fox
-No match
-
-/abc\0def\00pqr\000xyz\0000AB/
- abc\0def\00pqr\000xyz\0000AB
- 0: abc\x00def\x00pqr\x00xyz\x000AB
- abc456 abc\0def\00pqr\000xyz\0000ABCDE
- 0: abc\x00def\x00pqr\x00xyz\x000AB
-
-/abc\x0def\x00pqr\x000xyz\x0000AB/
- abc\x0def\x00pqr\x000xyz\x0000AB
- 0: abc\x0def\x00pqr\x000xyz\x0000AB
- abc456 abc\x0def\x00pqr\x000xyz\x0000ABCDE
- 0: abc\x0def\x00pqr\x000xyz\x0000AB
-
-/^[\000-\037]/
- \0A
- 0: \x00
- \01B
- 0: \x01
- \037C
- 0: \x1f
-
-/\0*/
- \0\0\0\0
- 0: \x00\x00\x00\x00
-
-/A\x0{2,3}Z/
- The A\x0\x0Z
- 0: A\x00\x00Z
- An A\0\x0\0Z
- 0: A\x00\x00\x00Z
- *** Failers
-No match
- A\0Z
-No match
- A\0\x0\0\x0Z
-No match
-
-/^(cow|)\1(bell)/
- cowcowbell
- 0: cowcowbell
- 1: cow
- 2: bell
- bell
- 0: bell
- 1:
- 2: bell
- *** Failers
-No match
- cowbell
-No match
-
-/^\s/
- \040abc
- 0:
- \x0cabc
- 0: \x0c
- \nabc
- 0: \x0a
- \rabc
- 0: \x0d
- \tabc
- 0: \x09
- *** Failers
-No match
- abc
-No match
-
-/^a b
-
- c/x
- abc
- 0: abc
-
-/^(a|)\1*b/
- ab
- 0: ab
- 1: a
- aaaab
- 0: aaaab
- 1: a
- b
- 0: b
- 1:
- *** Failers
-No match
- acb
-No match
-
-/^(a|)\1+b/
- aab
- 0: aab
- 1: a
- aaaab
- 0: aaaab
- 1: a
- b
- 0: b
- 1:
- *** Failers
-No match
- ab
-No match
-
-/^(a|)\1?b/
- ab
- 0: ab
- 1: a
- aab
- 0: aab
- 1: a
- b
- 0: b
- 1:
- *** Failers
-No match
- acb
-No match
-
-/^(a|)\1{2}b/
- aaab
- 0: aaab
- 1: a
- b
- 0: b
- 1:
- *** Failers
-No match
- ab
-No match
- aab
-No match
- aaaab
-No match
-
-/^(a|)\1{2,3}b/
- aaab
- 0: aaab
- 1: a
- aaaab
- 0: aaaab
- 1: a
- b
- 0: b
- 1:
- *** Failers
-No match
- ab
-No match
- aab
-No match
- aaaaab
-No match
-
-/ab{1,3}bc/
- abbbbc
- 0: abbbbc
- abbbc
- 0: abbbc
- abbc
- 0: abbc
- *** Failers
-No match
- abc
-No match
- abbbbbc
-No match
-
-/([^.]*)\.([^:]*):[T ]+(.*)/
- track1.title:TBlah blah blah
- 0: track1.title:TBlah blah blah
- 1: track1
- 2: title
- 3: Blah blah blah
-
-/([^.]*)\.([^:]*):[T ]+(.*)/i
- track1.title:TBlah blah blah
- 0: track1.title:TBlah blah blah
- 1: track1
- 2: title
- 3: Blah blah blah
-
-/([^.]*)\.([^:]*):[t ]+(.*)/i
- track1.title:TBlah blah blah
- 0: track1.title:TBlah blah blah
- 1: track1
- 2: title
- 3: Blah blah blah
-
-/^[W-c]+$/
- WXY_^abc
- 0: WXY_^abc
- ***Failers
-No match
- wxy
-No match
-
-/^[W-c]+$/i
- WXY_^abc
- 0: WXY_^abc
- wxy_^ABC
- 0: wxy_^ABC
-
-/^[\x3f-\x5F]+$/i
- WXY_^abc
- 0: WXY_^abc
- wxy_^ABC
- 0: wxy_^ABC
-
-/^abc$/m
- abc
- 0: abc
- qqq\nabc
- 0: abc
- abc\nzzz
- 0: abc
- qqq\nabc\nzzz
- 0: abc
-
-/^abc$/
- abc
- 0: abc
- *** Failers
-No match
- qqq\nabc
-No match
- abc\nzzz
-No match
- qqq\nabc\nzzz
-No match
-
-/\Aabc\Z/m
- abc
- 0: abc
- abc\n
- 0: abc
- *** Failers
-No match
- qqq\nabc
-No match
- abc\nzzz
-No match
- qqq\nabc\nzzz
-No match
-
-/\A(.)*\Z/s
- abc\ndef
- 0: abc\x0adef
- 1: f
-
-/\A(.)*\Z/m
- *** Failers
- 0: *** Failers
- 1: s
- abc\ndef
-No match
-
-/(?:b)|(?::+)/
- b::c
- 0: b
- c::b
- 0: ::
-
-/[-az]+/
- az-
- 0: az-
- *** Failers
- 0: a
- b
-No match
-
-/[az-]+/
- za-
- 0: za-
- *** Failers
- 0: a
- b
-No match
-
-/[a\-z]+/
- a-z
- 0: a-z
- *** Failers
- 0: a
- b
-No match
-
-/[a-z]+/
- abcdxyz
- 0: abcdxyz
-
-/[\d-]+/
- 12-34
- 0: 12-34
- *** Failers
-No match
- aaa
-No match
-
-/[\d-z]+/
- 12-34z
- 0: 12-34z
- *** Failers
-No match
- aaa
-No match
-
-/\x5c/
- \\
- 0: \
-
-/\x20Z/
- the Zoo
- 0: Z
- *** Failers
-No match
- Zulu
-No match
-
-/(abc)\1/i
- abcabc
- 0: abcabc
- 1: abc
- ABCabc
- 0: ABCabc
- 1: ABC
- abcABC
- 0: abcABC
- 1: abc
-
-/(main(O)?)+/
- mainmain
- 0: mainmain
- 1: main
- mainOmain
- 0: mainOmain
- 1: main
- 2: O
-
-/ab{3cd/
- ab{3cd
- 0: ab{3cd
-
-/ab{3,cd/
- ab{3,cd
- 0: ab{3,cd
-
-/ab{3,4a}cd/
- ab{3,4a}cd
- 0: ab{3,4a}cd
-
-/{4,5a}bc/
- {4,5a}bc
- 0: {4,5a}bc
-
-/^a.b/
- a\rb
- 0: a\x0db
- *** Failers
-No match
- a\nb
-No match
-
-/abc$/
- abc
- 0: abc
- abc\n
- 0: abc
- *** Failers
-No match
- abc\ndef
-No match
-
-/(abc)\123/
- abc\x53
- 0: abcS
- 1: abc
-
-/(abc)\223/
- abc\x93
- 0: abc\x93
- 1: abc
-
-/(abc)\323/
- abc\xd3
- 0: abc\xd3
- 1: abc
-
-/(abc)\500/
- abc\x40
- 0: abc@
- 1: abc
- abc\100
- 0: abc@
- 1: abc
-
-/(abc)\5000/
- abc\x400
- 0: abc@0
- 1: abc
- abc\x40\x30
- 0: abc@0
- 1: abc
- abc\1000
- 0: abc@0
- 1: abc
- abc\100\x30
- 0: abc@0
- 1: abc
- abc\100\060
- 0: abc@0
- 1: abc
- abc\100\60
- 0: abc@0
- 1: abc
-
-/abc\81/
- abc\081
- 0: abc\x0081
- abc\0\x38\x31
- 0: abc\x0081
-
-/abc\91/
- abc\091
- 0: abc\x0091
- abc\0\x39\x31
- 0: abc\x0091
-
-/(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)(l)\12\123/
- abcdefghijkllS
- 0: abcdefghijkllS
- 1: a
- 2: b
- 3: c
- 4: d
- 5: e
- 6: f
- 7: g
- 8: h
- 9: i
-10: j
-11: k
-12: l
-
-/(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)\12\123/
- abcdefghijk\12S
- 0: abcdefghijk\x0aS
- 1: a
- 2: b
- 3: c
- 4: d
- 5: e
- 6: f
- 7: g
- 8: h
- 9: i
-10: j
-11: k
-
-/ab\gdef/
- abgdef
- 0: abgdef
-
-/a{0}bc/
- bc
- 0: bc
-
-/(a|(bc)){0,0}?xyz/
- xyz
- 0: xyz
-
-/abc[\10]de/
- abc\010de
- 0: abc\x08de
-
-/abc[\1]de/
- abc\1de
- 0: abc\x01de
-
-/(abc)[\1]de/
- abc\1de
- 0: abc\x01de
- 1: abc
-
-/a.b(?s)/
- a\nb
- 0: a\x0ab
-
-/^([^a])([^\b])([^c]*)([^d]{3,4})/
- baNOTccccd
- 0: baNOTcccc
- 1: b
- 2: a
- 3: NOT
- 4: cccc
- baNOTcccd
- 0: baNOTccc
- 1: b
- 2: a
- 3: NOT
- 4: ccc
- baNOTccd
- 0: baNOTcc
- 1: b
- 2: a
- 3: NO
- 4: Tcc
- bacccd
- 0: baccc
- 1: b
- 2: a
- 3:
- 4: ccc
- *** Failers
- 0: *** Failers
- 1: *
- 2: *
- 3: * Fail
- 4: ers
- anything
-No match
- b\bc
-No match
- baccd
-No match
-
-/[^a]/
- Abc
- 0: A
-
-/[^a]/i
- Abc
- 0: b
-
-/[^a]+/
- AAAaAbc
- 0: AAA
-
-/[^a]+/i
- AAAaAbc
- 0: bc
-
-/[^a]+/
- bbb\nccc
- 0: bbb\x0accc
-
-/[^k]$/
- abc
- 0: c
- *** Failers
- 0: s
- abk
-No match
-
-/[^k]{2,3}$/
- abc
- 0: abc
- kbc
- 0: bc
- kabc
- 0: abc
- *** Failers
- 0: ers
- abk
-No match
- akb
-No match
- akk
-No match
-
-/^\d{8,}\@.+[^k]$/
- 12345678\@a.b.c.d
- 0: 12345678@a.b.c.d
- 123456789\@x.y.z
- 0: 123456789@x.y.z
- *** Failers
-No match
- 12345678\@x.y.uk
-No match
- 1234567\@a.b.c.d
-No match
-
-/(a)\1{8,}/
- aaaaaaaaa
- 0: aaaaaaaaa
- 1: a
- aaaaaaaaaa
- 0: aaaaaaaaaa
- 1: a
- *** Failers
-No match
- aaaaaaa
-No match
-
-/[^a]/
- aaaabcd
- 0: b
- aaAabcd
- 0: A
-
-/[^a]/i
- aaaabcd
- 0: b
- aaAabcd
- 0: b
-
-/[^az]/
- aaaabcd
- 0: b
- aaAabcd
- 0: A
-
-/[^az]/i
- aaaabcd
- 0: b
- aaAabcd
- 0: b
-
-/\000\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037\040\041\042\043\044\045\046\047\050\051\052\053\054\055\056\057\060\061\062\063\064\065\066\067\070\071\072\073\074\075\076\077\100\101\102\103\104\105\106\107\110\111\112\113\114\115\116\117\120\121\122\123\124\125\126\127\130\131\132\133\134\135\136\137\140\141\142\143\144\145\146\147\150\151\152\153\154\155\156\157\160\161\162\163\164\165\166\167\170\171\172\173\174\175\176\177\200\201\202\203\204\205\206\207\210\211\212\213\214\215\216\217\220\221\222\223\224\225\226\227\230\231\232\233\234\235\236\237\240\241\242\243\244\245\246\247\250\251\252\253\254\255\256\257\260\261\262\263\264\265\266\267\270\271\272\273\274\275\276\277\300\301\302\303\304\305\306\307\310\311\312\313\314\315\316\317\320\321\322\323\324\325\326\327\330\331\332\333\334\335\336\337\340\341\342\343\344\345\346\347\350\351\352\353\354\355\356\357\360\361\362\363\364\365\366\367\370\371\372\373\374\375\376\377/
- \000\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037\040\041\042\043\044\045\046\047\050\051\052\053\054\055\056\057\060\061\062\063\064\065\066\067\070\071\072\073\074\075\076\077\100\101\102\103\104\105\106\107\110\111\112\113\114\115\116\117\120\121\122\123\124\125\126\127\130\131\132\133\134\135\136\137\140\141\142\143\144\145\146\147\150\151\152\153\154\155\156\157\160\161\162\163\164\165\166\167\170\171\172\173\174\175\176\177\200\201\202\203\204\205\206\207\210\211\212\213\214\215\216\217\220\221\222\223\224\225\226\227\230\231\232\233\234\235\236\237\240\241\242\243\244\245\246\247\250\251\252\253\254\255\256\257\260\261\262\263\264\265\266\267\270\271\272\273\274\275\276\277\300\301\302\303\304\305\306\307\310\311\312\313\314\315\316\317\320\321\322\323\324\325\326\327\330\331\332\333\334\335\336\337\340\341\342\343\344\345\346\347\350\351\352\353\354\355\356\357\360\361\362\363\364\365\366\367\370\371\372\373\374\375\376\377
- 0: \x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~\x7f\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff
-
-/P[^*]TAIRE[^*]{1,6}?LL/
- xxxxxxxxxxxPSTAIREISLLxxxxxxxxx
- 0: PSTAIREISLL
-
-/P[^*]TAIRE[^*]{1,}?LL/
- xxxxxxxxxxxPSTAIREISLLxxxxxxxxx
- 0: PSTAIREISLL
-
-/(\.\d\d[1-9]?)\d+/
- 1.230003938
- 0: .230003938
- 1: .23
- 1.875000282
- 0: .875000282
- 1: .875
- 1.235
- 0: .235
- 1: .23
-
-/(\.\d\d((?=0)|\d(?=\d)))/
- 1.230003938
- 0: .23
- 1: .23
- 2:
- 1.875000282
- 0: .875
- 1: .875
- 2: 5
- *** Failers
-No match
- 1.235
-No match
-
-/a(?)b/
- ab
- 0: ab
-
-/\b(foo)\s+(\w+)/i
- Food is on the foo table
- 0: foo table
- 1: foo
- 2: table
-
-/foo(.*)bar/
- The food is under the bar in the barn.
- 0: food is under the bar in the bar
- 1: d is under the bar in the
-
-/foo(.*?)bar/
- The food is under the bar in the barn.
- 0: food is under the bar
- 1: d is under the
-
-/(.*)(\d*)/
- I have 2 numbers: 53147
- 0: I have 2 numbers: 53147
- 1: I have 2 numbers: 53147
- 2:
-
-/(.*)(\d+)/
- I have 2 numbers: 53147
- 0: I have 2 numbers: 53147
- 1: I have 2 numbers: 5314
- 2: 7
-
-/(.*?)(\d*)/
- I have 2 numbers: 53147
- 0:
- 1:
- 2:
-
-/(.*?)(\d+)/
- I have 2 numbers: 53147
- 0: I have 2
- 1: I have
- 2: 2
-
-/(.*)(\d+)$/
- I have 2 numbers: 53147
- 0: I have 2 numbers: 53147
- 1: I have 2 numbers: 5314
- 2: 7
-
-/(.*?)(\d+)$/
- I have 2 numbers: 53147
- 0: I have 2 numbers: 53147
- 1: I have 2 numbers:
- 2: 53147
-
-/(.*)\b(\d+)$/
- I have 2 numbers: 53147
- 0: I have 2 numbers: 53147
- 1: I have 2 numbers:
- 2: 53147
-
-/(.*\D)(\d+)$/
- I have 2 numbers: 53147
- 0: I have 2 numbers: 53147
- 1: I have 2 numbers:
- 2: 53147
-
-/^\D*(?!123)/
- ABC123
- 0: AB
-
-/^(\D*)(?=\d)(?!123)/
- ABC445
- 0: ABC
- 1: ABC
- *** Failers
-No match
- ABC123
-No match
-
-/^[W-]46]/
- W46]789
- 0: W46]
- -46]789
- 0: -46]
- *** Failers
-No match
- Wall
-No match
- Zebra
-No match
- 42
-No match
- [abcd]
-No match
- ]abcd[
-No match
-
-/^[W-\]46]/
- W46]789
- 0: W
- Wall
- 0: W
- Zebra
- 0: Z
- Xylophone
- 0: X
- 42
- 0: 4
- [abcd]
- 0: [
- ]abcd[
- 0: ]
- \\backslash
- 0: \
- *** Failers
-No match
- -46]789
-No match
- well
-No match
-
-/\d\d\/\d\d\/\d\d\d\d/
- 01/01/2000
- 0: 01/01/2000
-
-/word (?:[a-zA-Z0-9]+ ){0,10}otherword/
- word cat dog elephant mussel cow horse canary baboon snake shark otherword
- 0: word cat dog elephant mussel cow horse canary baboon snake shark otherword
- word cat dog elephant mussel cow horse canary baboon snake shark
-No match
-
-/word (?:[a-zA-Z0-9]+ ){0,300}otherword/
- word cat dog elephant mussel cow horse canary baboon snake shark the quick brown fox and the lazy dog and several other words getting close to thirty by now I hope
-No match
-
-/^(a){0,0}/
- bcd
- 0:
- abc
- 0:
- aab
- 0:
-
-/^(a){0,1}/
- bcd
- 0:
- abc
- 0: a
- 1: a
- aab
- 0: a
- 1: a
-
-/^(a){0,2}/
- bcd
- 0:
- abc
- 0: a
- 1: a
- aab
- 0: aa
- 1: a
-
-/^(a){0,3}/
- bcd
- 0:
- abc
- 0: a
- 1: a
- aab
- 0: aa
- 1: a
- aaa
- 0: aaa
- 1: a
-
-/^(a){0,}/
- bcd
- 0:
- abc
- 0: a
- 1: a
- aab
- 0: aa
- 1: a
- aaa
- 0: aaa
- 1: a
- aaaaaaaa
- 0: aaaaaaaa
- 1: a
-
-/^(a){1,1}/
- bcd
-No match
- abc
- 0: a
- 1: a
- aab
- 0: a
- 1: a
-
-/^(a){1,2}/
- bcd
-No match
- abc
- 0: a
- 1: a
- aab
- 0: aa
- 1: a
-
-/^(a){1,3}/
- bcd
-No match
- abc
- 0: a
- 1: a
- aab
- 0: aa
- 1: a
- aaa
- 0: aaa
- 1: a
-
-/^(a){1,}/
- bcd
-No match
- abc
- 0: a
- 1: a
- aab
- 0: aa
- 1: a
- aaa
- 0: aaa
- 1: a
- aaaaaaaa
- 0: aaaaaaaa
- 1: a
-
-/.*\.gif/
- borfle\nbib.gif\nno
- 0: bib.gif
-
-/.{0,}\.gif/
- borfle\nbib.gif\nno
- 0: bib.gif
-
-/.*\.gif/m
- borfle\nbib.gif\nno
- 0: bib.gif
-
-/.*\.gif/s
- borfle\nbib.gif\nno
- 0: borfle\x0abib.gif
-
-/.*\.gif/ms
- borfle\nbib.gif\nno
- 0: borfle\x0abib.gif
-
-/.*$/
- borfle\nbib.gif\nno
- 0: no
-
-/.*$/m
- borfle\nbib.gif\nno
- 0: borfle
-
-/.*$/s
- borfle\nbib.gif\nno
- 0: borfle\x0abib.gif\x0ano
-
-/.*$/ms
- borfle\nbib.gif\nno
- 0: borfle\x0abib.gif\x0ano
-
-/.*$/
- borfle\nbib.gif\nno\n
- 0: no
-
-/.*$/m
- borfle\nbib.gif\nno\n
- 0: borfle
-
-/.*$/s
- borfle\nbib.gif\nno\n
- 0: borfle\x0abib.gif\x0ano\x0a
-
-/.*$/ms
- borfle\nbib.gif\nno\n
- 0: borfle\x0abib.gif\x0ano\x0a
-
-/(.*X|^B)/
- abcde\n1234Xyz
- 0: 1234X
- 1: 1234X
- BarFoo
- 0: B
- 1: B
- *** Failers
-No match
- abcde\nBar
-No match
-
-/(.*X|^B)/m
- abcde\n1234Xyz
- 0: 1234X
- 1: 1234X
- BarFoo
- 0: B
- 1: B
- abcde\nBar
- 0: B
- 1: B
-
-/(.*X|^B)/s
- abcde\n1234Xyz
- 0: abcde\x0a1234X
- 1: abcde\x0a1234X
- BarFoo
- 0: B
- 1: B
- *** Failers
-No match
- abcde\nBar
-No match
-
-/(.*X|^B)/ms
- abcde\n1234Xyz
- 0: abcde\x0a1234X
- 1: abcde\x0a1234X
- BarFoo
- 0: B
- 1: B
- abcde\nBar
- 0: B
- 1: B
-
-/(?s)(.*X|^B)/
- abcde\n1234Xyz
- 0: abcde\x0a1234X
- 1: abcde\x0a1234X
- BarFoo
- 0: B
- 1: B
- *** Failers
-No match
- abcde\nBar
-No match
-
-/(?s:.*X|^B)/
- abcde\n1234Xyz
- 0: abcde\x0a1234X
- BarFoo
- 0: B
- *** Failers
-No match
- abcde\nBar
-No match
-
-/^.*B/
- **** Failers
-No match
- abc\nB
-No match
-
-/(?s)^.*B/
- abc\nB
- 0: abc\x0aB
-
-/(?m)^.*B/
- abc\nB
- 0: B
-
-/(?ms)^.*B/
- abc\nB
- 0: abc\x0aB
-
-/(?ms)^B/
- abc\nB
- 0: B
-
-/(?s)B$/
- B\n
- 0: B
-
-/^[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]/
- 123456654321
- 0: 123456654321
-
-/^\d\d\d\d\d\d\d\d\d\d\d\d/
- 123456654321
- 0: 123456654321
-
-/^[\d][\d][\d][\d][\d][\d][\d][\d][\d][\d][\d][\d]/
- 123456654321
- 0: 123456654321
-
-/^[abc]{12}/
- abcabcabcabc
- 0: abcabcabcabc
-
-/^[a-c]{12}/
- abcabcabcabc
- 0: abcabcabcabc
-
-/^(a|b|c){12}/
- abcabcabcabc
- 0: abcabcabcabc
- 1: c
-
-/^[abcdefghijklmnopqrstuvwxy0123456789]/
- n
- 0: n
- *** Failers
-No match
- z
-No match
-
-/abcde{0,0}/
- abcd
- 0: abcd
- *** Failers
-No match
- abce
-No match
-
-/ab[cd]{0,0}e/
- abe
- 0: abe
- *** Failers
-No match
- abcde
-No match
-
-/ab(c){0,0}d/
- abd
- 0: abd
- *** Failers
-No match
- abcd
-No match
-
-/a(b*)/
- a
- 0: a
- 1:
- ab
- 0: ab
- 1: b
- abbbb
- 0: abbbb
- 1: bbbb
- *** Failers
- 0: a
- 1:
- bbbbb
-No match
-
-/ab\d{0}e/
- abe
- 0: abe
- *** Failers
-No match
- ab1e
-No match
-
-/"([^\\"]+|\\.)*"/
- the \"quick\" brown fox
- 0: "quick"
- 1: quick
- \"the \\\"quick\\\" brown fox\"
- 0: "the \"quick\" brown fox"
- 1: brown fox
-
-/.*?/g+
- abc
- 0:
- 0+ abc
- 0: a
- 0+ bc
- 0:
- 0+ bc
- 0: b
- 0+ c
- 0:
- 0+ c
- 0: c
- 0+
- 0:
- 0+
-
-/\b/g+
- abc
- 0:
- 0+ abc
- 0:
- 0+
-
-/\b/+g
- abc
- 0:
- 0+ abc
- 0:
- 0+
-
-//g
- abc
- 0:
- 0:
- 0:
- 0:
-
-/<tr([\w\W\s\d][^<>]{0,})><TD([\w\W\s\d][^<>]{0,})>([\d]{0,}\.)(.*)((<BR>([\w\W\s\d][^<>]{0,})|[\s]{0,}))<\/a><\/TD><TD([\w\W\s\d][^<>]{0,})>([\w\W\s\d][^<>]{0,})<\/TD><TD([\w\W\s\d][^<>]{0,})>([\w\W\s\d][^<>]{0,})<\/TD><\/TR>/is
- <TR BGCOLOR='#DBE9E9'><TD align=left valign=top>43.<a href='joblist.cfm?JobID=94 6735&Keyword='>Word Processor<BR>(N-1286)</a></TD><TD align=left valign=top>Lega lstaff.com</TD><TD align=left valign=top>CA - Statewide</TD></TR>
- 0: <TR BGCOLOR='#DBE9E9'><TD align=left valign=top>43.<a href='joblist.cfm?JobID=94 6735&Keyword='>Word Processor<BR>(N-1286)</a></TD><TD align=left valign=top>Lega lstaff.com</TD><TD align=left valign=top>CA - Statewide</TD></TR>
- 1: BGCOLOR='#DBE9E9'
- 2: align=left valign=top
- 3: 43.
- 4: <a href='joblist.cfm?JobID=94 6735&Keyword='>Word Processor<BR>(N-1286)
- 5:
- 6:
- 7: <unset>
- 8: align=left valign=top
- 9: Lega lstaff.com
-10: align=left valign=top
-11: CA - Statewide
-
-/a[^a]b/
- acb
- 0: acb
- a\nb
- 0: a\x0ab
-
-/a.b/
- acb
- 0: acb
- *** Failers
-No match
- a\nb
-No match
-
-/a[^a]b/s
- acb
- 0: acb
- a\nb
- 0: a\x0ab
-
-/a.b/s
- acb
- 0: acb
- a\nb
- 0: a\x0ab
-
-/ End of testinput1 /
-
diff --git a/ext/pcre/pcrelib/testdata/testoutput2 b/ext/pcre/pcrelib/testdata/testoutput2
deleted file mode 100644
index 5de4a6ebb8..0000000000
--- a/ext/pcre/pcrelib/testdata/testoutput2
+++ /dev/null
@@ -1,2075 +0,0 @@
-PCRE version 3.4 22-Aug-2000
-
-/(a)b|/
-Capturing subpattern count = 1
-No options
-No first char
-No need char
-
-/abc/
-Capturing subpattern count = 0
-No options
-First char = 'a'
-Need char = 'c'
- abc
- 0: abc
- defabc
- 0: abc
- \Aabc
- 0: abc
- *** Failers
-No match
- \Adefabc
-No match
- ABC
-No match
-
-/^abc/
-Capturing subpattern count = 0
-Options: anchored
-No first char
-Need char = 'c'
- abc
- 0: abc
- \Aabc
- 0: abc
- *** Failers
-No match
- defabc
-No match
- \Adefabc
-No match
-
-/a+bc/
-Capturing subpattern count = 0
-No options
-First char = 'a'
-Need char = 'c'
-
-/a*bc/
-Capturing subpattern count = 0
-No options
-No first char
-Need char = 'c'
-
-/a{3}bc/
-Capturing subpattern count = 0
-No options
-First char = 'a'
-Need char = 'c'
-
-/(abc|a+z)/
-Capturing subpattern count = 1
-No options
-First char = 'a'
-No need char
-
-/^abc$/
-Capturing subpattern count = 0
-Options: anchored
-No first char
-Need char = 'c'
- abc
- 0: abc
- *** Failers
-No match
- def\nabc
-No match
-
-/ab\gdef/X
-Failed: unrecognized character follows \ at offset 3
-
-/(?X)ab\gdef/X
-Failed: unrecognized character follows \ at offset 7
-
-/x{5,4}/
-Failed: numbers out of order in {} quantifier at offset 5
-
-/z{65536}/
-Failed: number too big in {} quantifier at offset 7
-
-/[abcd/
-Failed: missing terminating ] for character class at offset 5
-
-/[\B]/
-Failed: invalid escape sequence in character class at offset 2
-
-/[z-a]/
-Failed: range out of order in character class at offset 3
-
-/^*/
-Failed: nothing to repeat at offset 1
-
-/(abc/
-Failed: missing ) at offset 4
-
-/(?# abc/
-Failed: missing ) after comment at offset 7
-
-/(?z)abc/
-Failed: unrecognized character after (? at offset 2
-
-/.*b/
-Capturing subpattern count = 0
-No options
-First char at start or follows \n
-Need char = 'b'
-
-/.*?b/
-Capturing subpattern count = 0
-No options
-First char at start or follows \n
-Need char = 'b'
-
-/cat|dog|elephant/
-Capturing subpattern count = 0
-No options
-No first char
-No need char
- this sentence eventually mentions a cat
- 0: cat
- this sentences rambles on and on for a while and then reaches elephant
- 0: elephant
-
-/cat|dog|elephant/S
-Capturing subpattern count = 0
-No options
-No first char
-No need char
-Starting character set: c d e
- this sentence eventually mentions a cat
- 0: cat
- this sentences rambles on and on for a while and then reaches elephant
- 0: elephant
-
-/cat|dog|elephant/iS
-Capturing subpattern count = 0
-Options: caseless
-No first char
-No need char
-Starting character set: C D E c d e
- this sentence eventually mentions a CAT cat
- 0: CAT
- this sentences rambles on and on for a while to elephant ElePhant
- 0: elephant
-
-/a|[bcd]/S
-Capturing subpattern count = 0
-No options
-No first char
-No need char
-Starting character set: a b c d
-
-/(a|[^\dZ])/S
-Capturing subpattern count = 1
-No options
-No first char
-No need char
-Starting character set: \x00 \x01 \x02 \x03 \x04 \x05 \x06 \x07 \x08 \x09 \x0a
- \x0b \x0c \x0d \x0e \x0f \x10 \x11 \x12 \x13 \x14 \x15 \x16 \x17 \x18 \x19
- \x1a \x1b \x1c \x1d \x1e \x1f \x20 ! " # $ % & ' ( ) * + , - . / : ; < = >
- ? @ A B C D E F G H I J K L M N O P Q R S T U V W X Y [ \ ] ^ _ ` a b c d
- e f g h i j k l m n o p q r s t u v w x y z { | } ~ \x7f \x80 \x81 \x82 \x83
- \x84 \x85 \x86 \x87 \x88 \x89 \x8a \x8b \x8c \x8d \x8e \x8f \x90 \x91 \x92
- \x93 \x94 \x95 \x96 \x97 \x98 \x99 \x9a \x9b \x9c \x9d \x9e \x9f \xa0 \xa1
- \xa2 \xa3 \xa4 \xa5 \xa6 \xa7 \xa8 \xa9 \xaa \xab \xac \xad \xae \xaf \xb0
- \xb1 \xb2 \xb3 \xb4 \xb5 \xb6 \xb7 \xb8 \xb9 \xba \xbb \xbc \xbd \xbe \xbf
- \xc0 \xc1 \xc2 \xc3 \xc4 \xc5 \xc6 \xc7 \xc8 \xc9 \xca \xcb \xcc \xcd \xce
- \xcf \xd0 \xd1 \xd2 \xd3 \xd4 \xd5 \xd6 \xd7 \xd8 \xd9 \xda \xdb \xdc \xdd
- \xde \xdf \xe0 \xe1 \xe2 \xe3 \xe4 \xe5 \xe6 \xe7 \xe8 \xe9 \xea \xeb \xec
- \xed \xee \xef \xf0 \xf1 \xf2 \xf3 \xf4 \xf5 \xf6 \xf7 \xf8 \xf9 \xfa \xfb
- \xfc \xfd \xfe \xff
-
-/(a|b)*[\s]/S
-Capturing subpattern count = 1
-No options
-No first char
-No need char
-Starting character set: \x09 \x0a \x0b \x0c \x0d \x20 a b
-
-/(ab\2)/
-Failed: back reference to non-existent subpattern at offset 6
-
-/{4,5}abc/
-Failed: nothing to repeat at offset 4
-
-/(a)(b)(c)\2/
-Capturing subpattern count = 3
-Max back reference = 2
-No options
-First char = 'a'
-Need char = 'c'
- abcb
- 0: abcb
- 1: a
- 2: b
- 3: c
- \O0abcb
-Matched, but too many substrings
- \O3abcb
-Matched, but too many substrings
- 0: abcb
- \O6abcb
-Matched, but too many substrings
- 0: abcb
- 1: a
- \O9abcb
-Matched, but too many substrings
- 0: abcb
- 1: a
- 2: b
- \O12abcb
- 0: abcb
- 1: a
- 2: b
- 3: c
-
-/(a)bc|(a)(b)\2/
-Capturing subpattern count = 3
-Max back reference = 2
-No options
-First char = 'a'
-No need char
- abc
- 0: abc
- 1: a
- \O0abc
-Matched, but too many substrings
- \O3abc
-Matched, but too many substrings
- 0: abc
- \O6abc
- 0: abc
- 1: a
- aba
- 0: aba
- 1: <unset>
- 2: a
- 3: b
- \O0aba
-Matched, but too many substrings
- \O3aba
-Matched, but too many substrings
- 0: aba
- \O6aba
-Matched, but too many substrings
- 0: aba
- 1: <unset>
- \O9aba
-Matched, but too many substrings
- 0: aba
- 1: <unset>
- 2: a
- \O12aba
- 0: aba
- 1: <unset>
- 2: a
- 3: b
-
-/abc$/E
-Capturing subpattern count = 0
-Options: dollar_endonly
-First char = 'a'
-Need char = 'c'
- abc
- 0: abc
- *** Failers
-No match
- abc\n
-No match
- abc\ndef
-No match
-
-/(a)(b)(c)(d)(e)\6/
-Failed: back reference to non-existent subpattern at offset 17
-
-/the quick brown fox/
-Capturing subpattern count = 0
-No options
-First char = 't'
-Need char = 'x'
- the quick brown fox
- 0: the quick brown fox
- this is a line with the quick brown fox
- 0: the quick brown fox
-
-/the quick brown fox/A
-Capturing subpattern count = 0
-Options: anchored
-No first char
-Need char = 'x'
- the quick brown fox
- 0: the quick brown fox
- *** Failers
-No match
- this is a line with the quick brown fox
-No match
-
-/ab(?z)cd/
-Failed: unrecognized character after (? at offset 4
-
-/^abc|def/
-Capturing subpattern count = 0
-No options
-No first char
-No need char
- abcdef
- 0: abc
- abcdef\B
- 0: def
-
-/.*((abc)$|(def))/
-Capturing subpattern count = 3
-No options
-First char at start or follows \n
-No need char
- defabc
- 0: defabc
- 1: abc
- 2: abc
- \Zdefabc
- 0: def
- 1: def
- 2: <unset>
- 3: def
-
-/abc/P
- abc
- 0: abc
- *** Failers
-No match: POSIX code 17: match failed
-
-/^abc|def/P
- abcdef
- 0: abc
- abcdef\B
- 0: def
-
-/.*((abc)$|(def))/P
- defabc
- 0: defabc
- 1: abc
- 2: abc
- \Zdefabc
- 0: def
- 1: def
- 3: def
-
-/the quick brown fox/P
- the quick brown fox
- 0: the quick brown fox
- *** Failers
-No match: POSIX code 17: match failed
- The Quick Brown Fox
-No match: POSIX code 17: match failed
-
-/the quick brown fox/Pi
- the quick brown fox
- 0: the quick brown fox
- The Quick Brown Fox
- 0: The Quick Brown Fox
-
-/abc.def/P
- *** Failers
-No match: POSIX code 17: match failed
- abc\ndef
-No match: POSIX code 17: match failed
-
-/abc$/P
- abc
- 0: abc
- abc\n
- 0: abc
-
-/(abc)\2/P
-Failed: POSIX code 15: bad back reference at offset 7
-
-/(abc\1)/P
- abc
-No match: POSIX code 17: match failed
-
-/)/
-Failed: unmatched parentheses at offset 0
-
-/a[]b/
-Failed: missing terminating ] for character class at offset 4
-
-/[^aeiou ]{3,}/
-Capturing subpattern count = 0
-No options
-No first char
-No need char
- co-processors, and for
- 0: -pr
-
-/<.*>/
-Capturing subpattern count = 0
-No options
-First char = '<'
-Need char = '>'
- abc<def>ghi<klm>nop
- 0: <def>ghi<klm>
-
-/<.*?>/
-Capturing subpattern count = 0
-No options
-First char = '<'
-Need char = '>'
- abc<def>ghi<klm>nop
- 0: <def>
-
-/<.*>/U
-Capturing subpattern count = 0
-Options: ungreedy
-First char = '<'
-Need char = '>'
- abc<def>ghi<klm>nop
- 0: <def>
-
-/<.*>(?U)/
-Capturing subpattern count = 0
-Options: ungreedy
-First char = '<'
-Need char = '>'
- abc<def>ghi<klm>nop
- 0: <def>
-
-/<.*?>/U
-Capturing subpattern count = 0
-Options: ungreedy
-First char = '<'
-Need char = '>'
- abc<def>ghi<klm>nop
- 0: <def>ghi<klm>
-
-/={3,}/U
-Capturing subpattern count = 0
-Options: ungreedy
-First char = '='
-Need char = '='
- abc========def
- 0: ===
-
-/(?U)={3,}?/
-Capturing subpattern count = 0
-Options: ungreedy
-First char = '='
-Need char = '='
- abc========def
- 0: ========
-
-/(?<!bar|cattle)foo/
-Capturing subpattern count = 0
-No options
-First char = 'f'
-Need char = 'o'
- foo
- 0: foo
- catfoo
- 0: foo
- *** Failers
-No match
- the barfoo
-No match
- and cattlefoo
-No match
-
-/(?<=a+)b/
-Failed: lookbehind assertion is not fixed length at offset 6
-
-/(?<=aaa|b{0,3})b/
-Failed: lookbehind assertion is not fixed length at offset 14
-
-/(?<!(foo)a\1)bar/
-Failed: lookbehind assertion is not fixed length at offset 12
-
-/(?i)abc/
-Capturing subpattern count = 0
-Options: caseless
-First char = 'a'
-Need char = 'c'
-
-/(a|(?m)a)/
-Capturing subpattern count = 1
-No options
-First char = 'a'
-No need char
-
-/(?i)^1234/
-Capturing subpattern count = 0
-Options: anchored caseless
-No first char
-Need char = '4'
-
-/(^b|(?i)^d)/
-Capturing subpattern count = 1
-Options: anchored
-Case state changes
-No first char
-No need char
-
-/(?s).*/
-Capturing subpattern count = 0
-Options: anchored dotall
-No first char
-No need char
-
-/[abcd]/S
-Capturing subpattern count = 0
-No options
-No first char
-No need char
-Starting character set: a b c d
-
-/(?i)[abcd]/S
-Capturing subpattern count = 0
-Options: caseless
-No first char
-No need char
-Starting character set: A B C D a b c d
-
-/(?m)[xy]|(b|c)/S
-Capturing subpattern count = 1
-Options: multiline
-No first char
-No need char
-Starting character set: b c x y
-
-/(^a|^b)/m
-Capturing subpattern count = 1
-Options: multiline
-First char at start or follows \n
-No need char
-
-/(?i)(^a|^b)/m
-Capturing subpattern count = 1
-Options: caseless multiline
-First char at start or follows \n
-No need char
-
-/(a)(?(1)a|b|c)/
-Failed: conditional group contains more than two branches at offset 13
-
-/(?(?=a)a|b|c)/
-Failed: conditional group contains more than two branches at offset 12
-
-/(?(1a)/
-Failed: malformed number after (?( at offset 4
-
-/(?(?i))/
-Failed: assertion expected after (?( at offset 3
-
-/(?(abc))/
-Failed: assertion expected after (?( at offset 3
-
-/(?(?<ab))/
-Failed: unrecognized character after (?< at offset 2
-
-/((?s)blah)\s+\1/
-Capturing subpattern count = 1
-Max back reference = 1
-No options
-First char = 'b'
-Need char = 'h'
-
-/((?i)blah)\s+\1/
-Capturing subpattern count = 1
-Max back reference = 1
-No options
-Case state changes
-No first char
-Need char = 'h'
-
-/((?i)b)/DS
-------------------------------------------------------------------
- 0 16 Bra 0
- 3 8 Bra 1
- 6 01 Opt
- 8 1 b
- 11 8 Ket
- 14 00 Opt
- 16 16 Ket
- 19 End
-------------------------------------------------------------------
-Capturing subpattern count = 1
-No options
-Case state changes
-No first char
-Need char = 'b'
-Starting character set: B b
-
-/(a*b|(?i:c*(?-i)d))/S
-Capturing subpattern count = 1
-No options
-Case state changes
-No first char
-No need char
-Starting character set: C a b c d
-
-/a$/
-Capturing subpattern count = 0
-No options
-First char = 'a'
-No need char
- a
- 0: a
- a\n
- 0: a
- *** Failers
-No match
- \Za
-No match
- \Za\n
-No match
-
-/a$/m
-Capturing subpattern count = 0
-Options: multiline
-First char = 'a'
-No need char
- a
- 0: a
- a\n
- 0: a
- \Za\n
- 0: a
- *** Failers
-No match
- \Za
-No match
-
-/\Aabc/m
-Capturing subpattern count = 0
-Options: anchored multiline
-No first char
-Need char = 'c'
-
-/^abc/m
-Capturing subpattern count = 0
-Options: multiline
-First char at start or follows \n
-Need char = 'c'
-
-/^((a+)(?U)([ab]+)(?-U)([bc]+)(\w*))/
-Capturing subpattern count = 5
-Options: anchored
-No first char
-Need char = 'a'
- aaaaabbbbbcccccdef
- 0: aaaaabbbbbcccccdef
- 1: aaaaabbbbbcccccdef
- 2: aaaaa
- 3: b
- 4: bbbbccccc
- 5: def
-
-/(?<=foo)[ab]/S
-Capturing subpattern count = 0
-No options
-No first char
-No need char
-Starting character set: a b
-
-/(?<!foo)(alpha|omega)/S
-Capturing subpattern count = 1
-No options
-No first char
-Need char = 'a'
-Starting character set: a o
-
-/(?!alphabet)[ab]/S
-Capturing subpattern count = 0
-No options
-No first char
-No need char
-Starting character set: a b
-
-/(?<=foo\n)^bar/m
-Capturing subpattern count = 0
-Options: multiline
-First char at start or follows \n
-Need char = 'r'
-
-/(?>^abc)/m
-Capturing subpattern count = 0
-Options: multiline
-First char at start or follows \n
-Need char = 'c'
- abc
- 0: abc
- def\nabc
- 0: abc
- *** Failers
-No match
- defabc
-No match
-
-/(?<=ab(c+)d)ef/
-Failed: lookbehind assertion is not fixed length at offset 11
-
-/(?<=ab(?<=c+)d)ef/
-Failed: lookbehind assertion is not fixed length at offset 12
-
-/(?<=ab(c|de)f)g/
-Failed: lookbehind assertion is not fixed length at offset 13
-
-/The next three are in testinput2 because they have variable length branches/
-Capturing subpattern count = 0
-No options
-First char = 'T'
-Need char = 's'
-
-/(?<=bullock|donkey)-cart/
-Capturing subpattern count = 0
-No options
-First char = '-'
-Need char = 't'
- the bullock-cart
- 0: -cart
- a donkey-cart race
- 0: -cart
- *** Failers
-No match
- cart
-No match
- horse-and-cart
-No match
-
-/(?<=ab(?i)x|y|z)/
-Capturing subpattern count = 0
-No options
-Case state changes
-No first char
-No need char
-
-/(?>.*)(?<=(abcd)|(xyz))/
-Capturing subpattern count = 2
-No options
-First char at start or follows \n
-No need char
- alphabetabcd
- 0: alphabetabcd
- 1: abcd
- endingxyz
- 0: endingxyz
- 1: <unset>
- 2: xyz
-
-/(?<=ab(?i)x(?-i)y|(?i)z|b)ZZ/
-Capturing subpattern count = 0
-No options
-Case state changes
-First char = 'Z'
-Need char = 'Z'
- abxyZZ
- 0: ZZ
- abXyZZ
- 0: ZZ
- ZZZ
- 0: ZZ
- zZZ
- 0: ZZ
- bZZ
- 0: ZZ
- BZZ
- 0: ZZ
- *** Failers
-No match
- ZZ
-No match
- abXYZZ
-No match
- zzz
-No match
- bzz
-No match
-
-/(?<!(foo)a)bar/
-Capturing subpattern count = 1
-No options
-First char = 'b'
-Need char = 'r'
- bar
- 0: bar
- foobbar
- 0: bar
- *** Failers
-No match
- fooabar
-No match
-
-/This one is here because Perl 5.005_02 doesn't fail it/
-Capturing subpattern count = 0
-No options
-First char = 'T'
-Need char = 't'
-
-/^(a)?(?(1)a|b)+$/
-Capturing subpattern count = 1
-Options: anchored
-No first char
-No need char
- *** Failers
-No match
- a
-No match
-
-/This one is here because I think Perl 5.005_02 gets the setting of $1 wrong/
-Capturing subpattern count = 0
-No options
-First char = 'T'
-Need char = 'g'
-
-/^(a\1?){4}$/
-Capturing subpattern count = 1
-Max back reference = 1
-Options: anchored
-No first char
-Need char = 'a'
- aaaaaa
- 0: aaaaaa
- 1: aa
-
-/These are syntax tests from Perl 5.005/
-Capturing subpattern count = 0
-No options
-First char = 'T'
-Need char = '5'
-
-/a[b-a]/
-Failed: range out of order in character class at offset 4
-
-/a[]b/
-Failed: missing terminating ] for character class at offset 4
-
-/a[/
-Failed: missing terminating ] for character class at offset 2
-
-/*a/
-Failed: nothing to repeat at offset 0
-
-/(*)b/
-Failed: nothing to repeat at offset 1
-
-/abc)/
-Failed: unmatched parentheses at offset 3
-
-/(abc/
-Failed: missing ) at offset 4
-
-/a**/
-Failed: nothing to repeat at offset 2
-
-/)(/
-Failed: unmatched parentheses at offset 0
-
-/\1/
-Failed: back reference to non-existent subpattern at offset 2
-
-/\2/
-Failed: back reference to non-existent subpattern at offset 2
-
-/(a)|\2/
-Failed: back reference to non-existent subpattern at offset 6
-
-/a[b-a]/i
-Failed: range out of order in character class at offset 4
-
-/a[]b/i
-Failed: missing terminating ] for character class at offset 4
-
-/a[/i
-Failed: missing terminating ] for character class at offset 2
-
-/*a/i
-Failed: nothing to repeat at offset 0
-
-/(*)b/i
-Failed: nothing to repeat at offset 1
-
-/abc)/i
-Failed: unmatched parentheses at offset 3
-
-/(abc/i
-Failed: missing ) at offset 4
-
-/a**/i
-Failed: nothing to repeat at offset 2
-
-/)(/i
-Failed: unmatched parentheses at offset 0
-
-/:(?:/
-Failed: missing ) at offset 4
-
-/(?<%)b/
-Failed: unrecognized character after (?< at offset 0
-
-/a(?{)b/
-Failed: unrecognized character after (? at offset 3
-
-/a(?{{})b/
-Failed: unrecognized character after (? at offset 3
-
-/a(?{}})b/
-Failed: unrecognized character after (? at offset 3
-
-/a(?{"{"})b/
-Failed: unrecognized character after (? at offset 3
-
-/a(?{"{"}})b/
-Failed: unrecognized character after (? at offset 3
-
-/(?(1?)a|b)/
-Failed: malformed number after (?( at offset 4
-
-/(?(1)a|b|c)/
-Failed: conditional group contains more than two branches at offset 10
-
-/[a[:xyz:/
-Failed: missing terminating ] for character class at offset 8
-
-/(?<=x+)y/
-Failed: lookbehind assertion is not fixed length at offset 6
-
-/a{37,17}/
-Failed: numbers out of order in {} quantifier at offset 7
-
-/abc/\
-Failed: \ at end of pattern at offset 4
-
-/abc/\P
-Failed: POSIX code 9: bad escape sequence at offset 4
-
-/abc/\i
-Failed: \ at end of pattern at offset 4
-
-/(a)bc(d)/
-Capturing subpattern count = 2
-No options
-First char = 'a'
-Need char = 'd'
- abcd
- 0: abcd
- 1: a
- 2: d
- abcd\C2
- 0: abcd
- 1: a
- 2: d
- 2C d (1)
- abcd\C5
- 0: abcd
- 1: a
- 2: d
-copy substring 5 failed -7
-
-/(.{20})/
-Capturing subpattern count = 1
-No options
-No first char
-No need char
- abcdefghijklmnopqrstuvwxyz
- 0: abcdefghijklmnopqrst
- 1: abcdefghijklmnopqrst
- abcdefghijklmnopqrstuvwxyz\C1
- 0: abcdefghijklmnopqrst
- 1: abcdefghijklmnopqrst
-copy substring 1 failed -6
- abcdefghijklmnopqrstuvwxyz\G1
- 0: abcdefghijklmnopqrst
- 1: abcdefghijklmnopqrst
- 1G abcdefghijklmnopqrst (20)
-
-/(.{15})/
-Capturing subpattern count = 1
-No options
-No first char
-No need char
- abcdefghijklmnopqrstuvwxyz
- 0: abcdefghijklmno
- 1: abcdefghijklmno
- abcdefghijklmnopqrstuvwxyz\C1\G1
- 0: abcdefghijklmno
- 1: abcdefghijklmno
- 1C abcdefghijklmno (15)
- 1G abcdefghijklmno (15)
-
-/(.{16})/
-Capturing subpattern count = 1
-No options
-No first char
-No need char
- abcdefghijklmnopqrstuvwxyz
- 0: abcdefghijklmnop
- 1: abcdefghijklmnop
- abcdefghijklmnopqrstuvwxyz\C1\G1\L
- 0: abcdefghijklmnop
- 1: abcdefghijklmnop
-copy substring 1 failed -6
- 1G abcdefghijklmnop (16)
- 0L abcdefghijklmnop
- 1L abcdefghijklmnop
-
-/^(a|(bc))de(f)/
-Capturing subpattern count = 3
-Options: anchored
-No first char
-Need char = 'f'
- adef\G1\G2\G3\G4\L
- 0: adef
- 1: a
- 2: <unset>
- 3: f
- 1G a (1)
- 2G (0)
- 3G f (1)
-get substring 4 failed -7
- 0L adef
- 1L a
- 2L
- 3L f
- bcdef\G1\G2\G3\G4\L
- 0: bcdef
- 1: bc
- 2: bc
- 3: f
- 1G bc (2)
- 2G bc (2)
- 3G f (1)
-get substring 4 failed -7
- 0L bcdef
- 1L bc
- 2L bc
- 3L f
- adefghijk\C0
- 0: adef
- 1: a
- 2: <unset>
- 3: f
- 0C adef (4)
-
-/^abc\00def/
-Capturing subpattern count = 0
-Options: anchored
-No first char
-Need char = 'f'
- abc\00def\L\C0
- 0: abc\x00def
- 0C abc (7)
- 0L abc
-
-/word ((?:[a-zA-Z0-9]+ )((?:[a-zA-Z0-9]+ )((?:[a-zA-Z0-9]+ )((?:[a-zA-Z0-9]+
-)((?:[a-zA-Z0-9]+ )((?:[a-zA-Z0-9]+ )((?:[a-zA-Z0-9]+ )((?:[a-zA-Z0-9]+
-)?)?)?)?)?)?)?)?)?otherword/M
-Memory allocation (code space): 428
-Capturing subpattern count = 8
-No options
-First char = 'w'
-Need char = 'd'
-
-/.*X/D
-------------------------------------------------------------------
- 0 8 Bra 0
- 3 Any*
- 5 1 X
- 8 8 Ket
- 11 End
-------------------------------------------------------------------
-Capturing subpattern count = 0
-No options
-First char at start or follows \n
-Need char = 'X'
-
-/.*X/Ds
-------------------------------------------------------------------
- 0 8 Bra 0
- 3 Any*
- 5 1 X
- 8 8 Ket
- 11 End
-------------------------------------------------------------------
-Capturing subpattern count = 0
-Options: anchored dotall
-No first char
-Need char = 'X'
-
-/(.*X|^B)/D
-------------------------------------------------------------------
- 0 21 Bra 0
- 3 8 Bra 1
- 6 Any*
- 8 1 X
- 11 7 Alt
- 14 ^
- 15 1 B
- 18 15 Ket
- 21 21 Ket
- 24 End
-------------------------------------------------------------------
-Capturing subpattern count = 1
-No options
-First char at start or follows \n
-No need char
-
-/(.*X|^B)/Ds
-------------------------------------------------------------------
- 0 21 Bra 0
- 3 8 Bra 1
- 6 Any*
- 8 1 X
- 11 7 Alt
- 14 ^
- 15 1 B
- 18 15 Ket
- 21 21 Ket
- 24 End
-------------------------------------------------------------------
-Capturing subpattern count = 1
-Options: anchored dotall
-No first char
-No need char
-
-/(?s)(.*X|^B)/D
-------------------------------------------------------------------
- 0 21 Bra 0
- 3 8 Bra 1
- 6 Any*
- 8 1 X
- 11 7 Alt
- 14 ^
- 15 1 B
- 18 15 Ket
- 21 21 Ket
- 24 End
-------------------------------------------------------------------
-Capturing subpattern count = 1
-Options: anchored dotall
-No first char
-No need char
-
-/(?s:.*X|^B)/D
-------------------------------------------------------------------
- 0 27 Bra 0
- 3 10 Bra 0
- 6 04 Opt
- 8 Any*
- 10 1 X
- 13 9 Alt
- 16 04 Opt
- 18 ^
- 19 1 B
- 22 19 Ket
- 25 00 Opt
- 27 27 Ket
- 30 End
-------------------------------------------------------------------
-Capturing subpattern count = 0
-No options
-First char at start or follows \n
-No need char
-
-/\Biss\B/+
-Capturing subpattern count = 0
-No options
-First char = 'i'
-Need char = 's'
- Mississippi
- 0: iss
- 0+ issippi
-
-/\Biss\B/+P
- Mississippi
- 0: iss
- 0+ issippi
-
-/iss/G+
-Capturing subpattern count = 0
-No options
-First char = 'i'
-Need char = 's'
- Mississippi
- 0: iss
- 0+ issippi
- 0: iss
- 0+ ippi
-
-/\Biss\B/G+
-Capturing subpattern count = 0
-No options
-First char = 'i'
-Need char = 's'
- Mississippi
- 0: iss
- 0+ issippi
-
-/\Biss\B/g+
-Capturing subpattern count = 0
-No options
-First char = 'i'
-Need char = 's'
- Mississippi
- 0: iss
- 0+ issippi
- 0: iss
- 0+ ippi
- *** Failers
-No match
- Mississippi\A
-No match
-
-/(?<=[Ms])iss/g+
-Capturing subpattern count = 0
-No options
-First char = 'i'
-Need char = 's'
- Mississippi
- 0: iss
- 0+ issippi
- 0: iss
- 0+ ippi
-
-/(?<=[Ms])iss/G+
-Capturing subpattern count = 0
-No options
-First char = 'i'
-Need char = 's'
- Mississippi
- 0: iss
- 0+ issippi
-
-/^iss/g+
-Capturing subpattern count = 0
-Options: anchored
-No first char
-Need char = 's'
- ississippi
- 0: iss
- 0+ issippi
-
-/.*iss/g+
-Capturing subpattern count = 0
-No options
-First char at start or follows \n
-Need char = 's'
- abciss\nxyzisspqr
- 0: abciss
- 0+ \x0axyzisspqr
- 0: xyziss
- 0+ pqr
-
-/.i./+g
-Capturing subpattern count = 0
-No options
-No first char
-Need char = 'i'
- Mississippi
- 0: Mis
- 0+ sissippi
- 0: sis
- 0+ sippi
- 0: sip
- 0+ pi
- Mississippi\A
- 0: Mis
- 0+ sissippi
- 0: sis
- 0+ sippi
- 0: sip
- 0+ pi
- Missouri river
- 0: Mis
- 0+ souri river
- 0: ri
- 0+ river
- 0: riv
- 0+ er
- Missouri river\A
- 0: Mis
- 0+ souri river
-
-/^.is/+g
-Capturing subpattern count = 0
-Options: anchored
-No first char
-Need char = 's'
- Mississippi
- 0: Mis
- 0+ sissippi
-
-/^ab\n/g+
-Capturing subpattern count = 0
-Options: anchored
-No first char
-Need char = 10
- ab\nab\ncd
- 0: ab\x0a
- 0+ ab\x0acd
-
-/^ab\n/mg+
-Capturing subpattern count = 0
-Options: multiline
-First char at start or follows \n
-Need char = 10
- ab\nab\ncd
- 0: ab\x0a
- 0+ ab\x0acd
- 0: ab\x0a
- 0+ cd
-
-/abc/
-Capturing subpattern count = 0
-No options
-First char = 'a'
-Need char = 'c'
-
-/abc|bac/
-Capturing subpattern count = 0
-No options
-No first char
-Need char = 'c'
-
-/(abc|bac)/
-Capturing subpattern count = 1
-No options
-No first char
-Need char = 'c'
-
-/(abc|(c|dc))/
-Capturing subpattern count = 2
-No options
-No first char
-Need char = 'c'
-
-/(abc|(d|de)c)/
-Capturing subpattern count = 2
-No options
-No first char
-Need char = 'c'
-
-/a*/
-Capturing subpattern count = 0
-No options
-No first char
-No need char
-
-/a+/
-Capturing subpattern count = 0
-No options
-First char = 'a'
-No need char
-
-/(baa|a+)/
-Capturing subpattern count = 1
-No options
-No first char
-Need char = 'a'
-
-/a{0,3}/
-Capturing subpattern count = 0
-No options
-No first char
-No need char
-
-/baa{3,}/
-Capturing subpattern count = 0
-No options
-First char = 'b'
-Need char = 'a'
-
-/"([^\\"]+|\\.)*"/
-Capturing subpattern count = 1
-No options
-First char = '"'
-Need char = '"'
-
-/(abc|ab[cd])/
-Capturing subpattern count = 1
-No options
-First char = 'a'
-No need char
-
-/(a|.)/
-Capturing subpattern count = 1
-No options
-No first char
-No need char
-
-/a|ba|\w/
-Capturing subpattern count = 0
-No options
-No first char
-No need char
-
-/abc(?=pqr)/
-Capturing subpattern count = 0
-No options
-First char = 'a'
-Need char = 'r'
-
-/...(?<=abc)/
-Capturing subpattern count = 0
-No options
-No first char
-No need char
-
-/abc(?!pqr)/
-Capturing subpattern count = 0
-No options
-First char = 'a'
-Need char = 'c'
-
-/ab./
-Capturing subpattern count = 0
-No options
-First char = 'a'
-Need char = 'b'
-
-/ab[xyz]/
-Capturing subpattern count = 0
-No options
-First char = 'a'
-Need char = 'b'
-
-/abc*/
-Capturing subpattern count = 0
-No options
-First char = 'a'
-Need char = 'b'
-
-/ab.c*/
-Capturing subpattern count = 0
-No options
-First char = 'a'
-Need char = 'b'
-
-/a.c*/
-Capturing subpattern count = 0
-No options
-First char = 'a'
-No need char
-
-/.c*/
-Capturing subpattern count = 0
-No options
-No first char
-No need char
-
-/ac*/
-Capturing subpattern count = 0
-No options
-First char = 'a'
-No need char
-
-/(a.c*|b.c*)/
-Capturing subpattern count = 1
-No options
-No first char
-No need char
-
-/a.c*|aba/
-Capturing subpattern count = 0
-No options
-First char = 'a'
-No need char
-
-/.+a/
-Capturing subpattern count = 0
-No options
-No first char
-Need char = 'a'
-
-/(?=abcda)a.*/
-Capturing subpattern count = 0
-No options
-First char = 'a'
-No need char
-
-/(?=a)a.*/
-Capturing subpattern count = 0
-No options
-First char = 'a'
-No need char
-
-/a(b)*/
-Capturing subpattern count = 1
-No options
-First char = 'a'
-No need char
-
-/a\d*/
-Capturing subpattern count = 0
-No options
-First char = 'a'
-No need char
-
-/ab\d*/
-Capturing subpattern count = 0
-No options
-First char = 'a'
-Need char = 'b'
-
-/a(\d)*/
-Capturing subpattern count = 1
-No options
-First char = 'a'
-No need char
-
-/abcde{0,0}/
-Capturing subpattern count = 0
-No options
-First char = 'a'
-Need char = 'd'
-
-/ab\d+/
-Capturing subpattern count = 0
-No options
-First char = 'a'
-Need char = 'b'
-
-/a(?(1)b)/
-Capturing subpattern count = 0
-No options
-First char = 'a'
-No need char
-
-/a(?(1)bag|big)/
-Capturing subpattern count = 0
-No options
-First char = 'a'
-Need char = 'g'
-
-/a(?(1)bag|big)*/
-Capturing subpattern count = 0
-No options
-First char = 'a'
-No need char
-
-/a(?(1)bag|big)+/
-Capturing subpattern count = 0
-No options
-First char = 'a'
-Need char = 'g'
-
-/a(?(1)b..|b..)/
-Capturing subpattern count = 0
-No options
-First char = 'a'
-Need char = 'b'
-
-/ab\d{0}e/
-Capturing subpattern count = 0
-No options
-First char = 'a'
-Need char = 'e'
-
-/a?b?/
-Capturing subpattern count = 0
-No options
-No first char
-No need char
- a
- 0: a
- b
- 0: b
- ab
- 0: ab
- \
- 0:
- *** Failers
- 0:
- \N
-No match
-
-/|-/
-Capturing subpattern count = 0
-No options
-No first char
-No need char
- abcd
- 0:
- -abc
- 0:
- \Nab-c
- 0: -
- *** Failers
- 0:
- \Nabc
-No match
-
-/a*(b+)(z)(z)/P
- aaaabbbbzzzz
- 0: aaaabbbbzz
- 1: bbbb
- 2: z
- 3: z
- aaaabbbbzzzz\O0
- aaaabbbbzzzz\O1
- 0: aaaabbbbzz
- aaaabbbbzzzz\O2
- 0: aaaabbbbzz
- 1: bbbb
- aaaabbbbzzzz\O3
- 0: aaaabbbbzz
- 1: bbbb
- 2: z
- aaaabbbbzzzz\O4
- 0: aaaabbbbzz
- 1: bbbb
- 2: z
- 3: z
- aaaabbbbzzzz\O5
- 0: aaaabbbbzz
- 1: bbbb
- 2: z
- 3: z
-
-/^.?abcd/S
-Capturing subpattern count = 0
-Options: anchored
-No first char
-Need char = 'd'
-Study returned NULL
-
-/\( # ( at start
- (?: # Non-capturing bracket
- (?>[^()]+) # Either a sequence of non-brackets (no backtracking)
- | # Or
- (?R) # Recurse - i.e. nested bracketed string
- )* # Zero or more contents
- \) # Closing )
- /x
-Capturing subpattern count = 0
-Options: extended
-First char = '('
-Need char = ')'
- (abcd)
- 0: (abcd)
- (abcd)xyz
- 0: (abcd)
- xyz(abcd)
- 0: (abcd)
- (ab(xy)cd)pqr
- 0: (ab(xy)cd)
- (ab(xycd)pqr
- 0: (xycd)
- () abc ()
- 0: ()
- 12(abcde(fsh)xyz(foo(bar))lmno)89
- 0: (abcde(fsh)xyz(foo(bar))lmno)
- *** Failers
-No match
- abcd
-No match
- abcd)
-No match
- (abcd
-No match
-
-/\( ( (?>[^()]+) | (?R) )* \) /xg
-Capturing subpattern count = 1
-Options: extended
-First char = '('
-Need char = ')'
- (ab(xy)cd)pqr
- 0: (ab(xy)cd)
- 1: cd
- 1(abcd)(x(y)z)pqr
- 0: (abcd)
- 1: abcd
- 0: (x(y)z)
- 1: z
-
-/\( (?: (?>[^()]+) | (?R) ) \) /x
-Capturing subpattern count = 0
-Options: extended
-First char = '('
-Need char = ')'
- (abcd)
- 0: (abcd)
- (ab(xy)cd)
- 0: (xy)
- (a(b(c)d)e)
- 0: (c)
- ((ab))
- 0: ((ab))
- *** Failers
-No match
- ()
-No match
-
-/\( (?: (?>[^()]+) | (?R) )? \) /x
-Capturing subpattern count = 0
-Options: extended
-First char = '('
-Need char = ')'
- ()
- 0: ()
- 12(abcde(fsh)xyz(foo(bar))lmno)89
- 0: (fsh)
-
-/\( ( (?>[^()]+) | (?R) )* \) /x
-Capturing subpattern count = 1
-Options: extended
-First char = '('
-Need char = ')'
- (ab(xy)cd)
- 0: (ab(xy)cd)
- 1: cd
-
-/\( ( ( (?>[^()]+) | (?R) )* ) \) /x
-Capturing subpattern count = 2
-Options: extended
-First char = '('
-Need char = ')'
- (ab(xy)cd)
- 0: (ab(xy)cd)
- 1: ab(xy)cd
- 2: cd
-
-/\( (123)? ( ( (?>[^()]+) | (?R) )* ) \) /x
-Capturing subpattern count = 3
-Options: extended
-First char = '('
-Need char = ')'
- (ab(xy)cd)
- 0: (ab(xy)cd)
- 1: <unset>
- 2: ab(xy)cd
- 3: cd
- (123ab(xy)cd)
- 0: (123ab(xy)cd)
- 1: 123
- 2: ab(xy)cd
- 3: cd
-
-/\( ( (123)? ( (?>[^()]+) | (?R) )* ) \) /x
-Capturing subpattern count = 3
-Options: extended
-First char = '('
-Need char = ')'
- (ab(xy)cd)
- 0: (ab(xy)cd)
- 1: ab(xy)cd
- 2: <unset>
- 3: cd
- (123ab(xy)cd)
- 0: (123ab(xy)cd)
- 1: 123ab(xy)cd
- 2: 123
- 3: cd
-
-/\( (((((((((( ( (?>[^()]+) | (?R) )* )))))))))) \) /x
-Capturing subpattern count = 11
-Options: extended
-First char = '('
-Need char = ')'
- (ab(xy)cd)
- 0: (ab(xy)cd)
- 1: ab(xy)cd
- 2: ab(xy)cd
- 3: ab(xy)cd
- 4: ab(xy)cd
- 5: ab(xy)cd
- 6: ab(xy)cd
- 7: ab(xy)cd
- 8: ab(xy)cd
- 9: ab(xy)cd
-10: ab(xy)cd
-11: cd
-
-/\( ( ( (?>[^()<>]+) | ((?>[^()]+)) | (?R) )* ) \) /x
-Capturing subpattern count = 3
-Options: extended
-First char = '('
-Need char = ')'
- (abcd(xyz<p>qrs)123)
- 0: (abcd(xyz<p>qrs)123)
- 1: abcd(xyz<p>qrs)123
- 2: 123
- 3: <p>qrs
-
-/\( ( ( (?>[^()]+) | ((?R)) )* ) \) /x
-Capturing subpattern count = 3
-Options: extended
-First char = '('
-Need char = ')'
- (ab(cd)ef)
- 0: (ab(cd)ef)
- 1: ab(cd)ef
- 2: ef
- 3: (cd)
- (ab(cd(ef)gh)ij)
- 0: (ab(cd(ef)gh)ij)
- 1: ab(cd(ef)gh)ij
- 2: ij
- 3: (cd(ef)gh)
-
-/^[[:alnum:]]/D
-------------------------------------------------------------------
- 0 37 Bra 0
- 3 ^
- 4 [0-9A-Za-z]
- 37 37 Ket
- 40 End
-------------------------------------------------------------------
-Capturing subpattern count = 0
-Options: anchored
-No first char
-No need char
-
-/^[[:alpha:]]/D
-------------------------------------------------------------------
- 0 37 Bra 0
- 3 ^
- 4 [A-Za-z]
- 37 37 Ket
- 40 End
-------------------------------------------------------------------
-Capturing subpattern count = 0
-Options: anchored
-No first char
-No need char
-
-/^[[:ascii:]]/D
-------------------------------------------------------------------
- 0 37 Bra 0
- 3 ^
- 4 [\x00-\x7f]
- 37 37 Ket
- 40 End
-------------------------------------------------------------------
-Capturing subpattern count = 0
-Options: anchored
-No first char
-No need char
-
-/^[[:cntrl:]]/D
-------------------------------------------------------------------
- 0 37 Bra 0
- 3 ^
- 4 [\x00-\x1f\x7f]
- 37 37 Ket
- 40 End
-------------------------------------------------------------------
-Capturing subpattern count = 0
-Options: anchored
-No first char
-No need char
-
-/^[[:digit:]]/D
-------------------------------------------------------------------
- 0 37 Bra 0
- 3 ^
- 4 [0-9]
- 37 37 Ket
- 40 End
-------------------------------------------------------------------
-Capturing subpattern count = 0
-Options: anchored
-No first char
-No need char
-
-/^[[:graph:]]/D
-------------------------------------------------------------------
- 0 37 Bra 0
- 3 ^
- 4 [!-~]
- 37 37 Ket
- 40 End
-------------------------------------------------------------------
-Capturing subpattern count = 0
-Options: anchored
-No first char
-No need char
-
-/^[[:lower:]]/D
-------------------------------------------------------------------
- 0 37 Bra 0
- 3 ^
- 4 [a-z]
- 37 37 Ket
- 40 End
-------------------------------------------------------------------
-Capturing subpattern count = 0
-Options: anchored
-No first char
-No need char
-
-/^[[:print:]]/D
-------------------------------------------------------------------
- 0 37 Bra 0
- 3 ^
- 4 [ -~]
- 37 37 Ket
- 40 End
-------------------------------------------------------------------
-Capturing subpattern count = 0
-Options: anchored
-No first char
-No need char
-
-/^[[:punct:]]/D
-------------------------------------------------------------------
- 0 37 Bra 0
- 3 ^
- 4 [!-/:-@[-`{-~]
- 37 37 Ket
- 40 End
-------------------------------------------------------------------
-Capturing subpattern count = 0
-Options: anchored
-No first char
-No need char
-
-/^[[:space:]]/D
-------------------------------------------------------------------
- 0 37 Bra 0
- 3 ^
- 4 [\x09-\x0d ]
- 37 37 Ket
- 40 End
-------------------------------------------------------------------
-Capturing subpattern count = 0
-Options: anchored
-No first char
-No need char
-
-/^[[:upper:]]/D
-------------------------------------------------------------------
- 0 37 Bra 0
- 3 ^
- 4 [A-Z]
- 37 37 Ket
- 40 End
-------------------------------------------------------------------
-Capturing subpattern count = 0
-Options: anchored
-No first char
-No need char
-
-/^[[:xdigit:]]/D
-------------------------------------------------------------------
- 0 37 Bra 0
- 3 ^
- 4 [0-9A-Fa-f]
- 37 37 Ket
- 40 End
-------------------------------------------------------------------
-Capturing subpattern count = 0
-Options: anchored
-No first char
-No need char
-
-/^[[:word:]]/D
-------------------------------------------------------------------
- 0 37 Bra 0
- 3 ^
- 4 [0-9A-Z_a-z]
- 37 37 Ket
- 40 End
-------------------------------------------------------------------
-Capturing subpattern count = 0
-Options: anchored
-No first char
-No need char
-
-/^[[:^cntrl:]]/D
-------------------------------------------------------------------
- 0 37 Bra 0
- 3 ^
- 4 [ -~\x80-\xff]
- 37 37 Ket
- 40 End
-------------------------------------------------------------------
-Capturing subpattern count = 0
-Options: anchored
-No first char
-No need char
-
-/^[12[:^digit:]]/D
-------------------------------------------------------------------
- 0 37 Bra 0
- 3 ^
- 4 [\x00-/1-2:-\xff]
- 37 37 Ket
- 40 End
-------------------------------------------------------------------
-Capturing subpattern count = 0
-Options: anchored
-No first char
-No need char
-
-/[01[:alpha:]%]/D
-------------------------------------------------------------------
- 0 36 Bra 0
- 3 [%0-1A-Za-z]
- 36 36 Ket
- 39 End
-------------------------------------------------------------------
-Capturing subpattern count = 0
-No options
-No first char
-No need char
-
-/[[.ch.]]/
-Failed: POSIX collating elements are not supported at offset 1
-
-/[[=ch=]]/
-Failed: POSIX collating elements are not supported at offset 1
-
-/[[:rhubarb:]]/
-Failed: unknown POSIX class name at offset 3
-
-/[[:upper:]]/i
-Capturing subpattern count = 0
-Options: caseless
-No first char
-No need char
- A
- 0: A
- a
- 0: a
-
-/[[:lower:]]/i
-Capturing subpattern count = 0
-Options: caseless
-No first char
-No need char
- A
- 0: A
- a
- 0: a
-
-/((?-i)[[:lower:]])[[:lower:]]/i
-Capturing subpattern count = 1
-Options: caseless
-Case state changes
-No first char
-No need char
- ab
- 0: ab
- 1: a
- aB
- 0: aB
- 1: a
- *** Failers
- 0: ai
- 1: a
- Ab
-No match
- AB
-No match
-
-/[\200-\410]/
-Failed: range out of order in character class at offset 9
-
-/^(?(0)f|b)oo/
-Failed: invalid condition (?(0) at offset 5
-
-/ End of testinput2 /
-Capturing subpattern count = 0
-No options
-First char = ' '
-Need char = ' '
-
diff --git a/ext/pcre/pcrelib/testdata/testoutput3 b/ext/pcre/pcrelib/testdata/testoutput3
deleted file mode 100644
index 1568e4dfb1..0000000000
--- a/ext/pcre/pcrelib/testdata/testoutput3
+++ /dev/null
@@ -1,2991 +0,0 @@
-PCRE version 3.4 22-Aug-2000
-
-/(?<!bar)foo/
- foo
- 0: foo
- catfood
- 0: foo
- arfootle
- 0: foo
- rfoosh
- 0: foo
- *** Failers
-No match
- barfoo
-No match
- towbarfoo
-No match
-
-/\w{3}(?<!bar)foo/
- catfood
- 0: catfoo
- *** Failers
-No match
- foo
-No match
- barfoo
-No match
- towbarfoo
-No match
-
-/(?<=(foo)a)bar/
- fooabar
- 0: bar
- 1: foo
- *** Failers
-No match
- bar
-No match
- foobbar
-No match
-
-/\Aabc\z/m
- abc
- 0: abc
- *** Failers
-No match
- abc\n
-No match
- qqq\nabc
-No match
- abc\nzzz
-No match
- qqq\nabc\nzzz
-No match
-
-"(?>.*/)foo"
- /this/is/a/very/long/line/in/deed/with/very/many/slashes/in/it/you/see/
-No match
-
-"(?>.*/)foo"
- /this/is/a/very/long/line/in/deed/with/very/many/slashes/in/and/foo
- 0: /this/is/a/very/long/line/in/deed/with/very/many/slashes/in/and/foo
-
-/(?>(\.\d\d[1-9]?))\d+/
- 1.230003938
- 0: .230003938
- 1: .23
- 1.875000282
- 0: .875000282
- 1: .875
- *** Failers
-No match
- 1.235
-No match
-
-/^((?>\w+)|(?>\s+))*$/
- now is the time for all good men to come to the aid of the party
- 0: now is the time for all good men to come to the aid of the party
- 1: party
- *** Failers
-No match
- this is not a line with only words and spaces!
-No match
-
-/(\d+)(\w)/
- 12345a
- 0: 12345a
- 1: 12345
- 2: a
- 12345+
- 0: 12345
- 1: 1234
- 2: 5
-
-/((?>\d+))(\w)/
- 12345a
- 0: 12345a
- 1: 12345
- 2: a
- *** Failers
-No match
- 12345+
-No match
-
-/(?>a+)b/
- aaab
- 0: aaab
-
-/((?>a+)b)/
- aaab
- 0: aaab
- 1: aaab
-
-/(?>(a+))b/
- aaab
- 0: aaab
- 1: aaa
-
-/(?>b)+/
- aaabbbccc
- 0: bbb
-
-/(?>a+|b+|c+)*c/
- aaabbbbccccd
- 0: aaabbbbc
-
-/((?>[^()]+)|\([^()]*\))+/
- ((abc(ade)ufh()()x
- 0: abc(ade)ufh()()x
- 1: x
-
-/\(((?>[^()]+)|\([^()]+\))+\)/
- (abc)
- 0: (abc)
- 1: abc
- (abc(def)xyz)
- 0: (abc(def)xyz)
- 1: xyz
- *** Failers
-No match
- ((()aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
-No match
-
-/a(?-i)b/i
- ab
- 0: ab
- *** Failers
-No match
- Ab
-No match
- aB
-No match
- AB
-No match
-
-/(a (?x)b c)d e/
- a bcd e
- 0: a bcd e
- 1: a bc
- *** Failers
-No match
- a b cd e
-No match
- abcd e
-No match
- a bcde
-No match
-
-/(a b(?x)c d (?-x)e f)/
- a bcde f
- 0: a bcde f
- 1: a bcde f
- *** Failers
-No match
- abcdef
-No match
-
-/(a(?i)b)c/
- abc
- 0: abc
- 1: ab
- aBc
- 0: aBc
- 1: aB
- *** Failers
-No match
- abC
-No match
- aBC
-No match
- Abc
-No match
- ABc
-No match
- ABC
-No match
- AbC
-No match
-
-/a(?i:b)c/
- abc
- 0: abc
- aBc
- 0: aBc
- *** Failers
-No match
- ABC
-No match
- abC
-No match
- aBC
-No match
-
-/a(?i:b)*c/
- aBc
- 0: aBc
- aBBc
- 0: aBBc
- *** Failers
-No match
- aBC
-No match
- aBBC
-No match
-
-/a(?=b(?i)c)\w\wd/
- abcd
- 0: abcd
- abCd
- 0: abCd
- *** Failers
-No match
- aBCd
-No match
- abcD
-No match
-
-/(?s-i:more.*than).*million/i
- more than million
- 0: more than million
- more than MILLION
- 0: more than MILLION
- more \n than Million
- 0: more \x0a than Million
- *** Failers
-No match
- MORE THAN MILLION
-No match
- more \n than \n million
-No match
-
-/(?:(?s-i)more.*than).*million/i
- more than million
- 0: more than million
- more than MILLION
- 0: more than MILLION
- more \n than Million
- 0: more \x0a than Million
- *** Failers
-No match
- MORE THAN MILLION
-No match
- more \n than \n million
-No match
-
-/(?>a(?i)b+)+c/
- abc
- 0: abc
- aBbc
- 0: aBbc
- aBBc
- 0: aBBc
- *** Failers
-No match
- Abc
-No match
- abAb
-No match
- abbC
-No match
-
-/(?=a(?i)b)\w\wc/
- abc
- 0: abc
- aBc
- 0: aBc
- *** Failers
-No match
- Ab
-No match
- abC
-No match
- aBC
-No match
-
-/(?<=a(?i)b)(\w\w)c/
- abxxc
- 0: xxc
- 1: xx
- aBxxc
- 0: xxc
- 1: xx
- *** Failers
-No match
- Abxxc
-No match
- ABxxc
-No match
- abxxC
-No match
-
-/(?:(a)|b)(?(1)A|B)/
- aA
- 0: aA
- 1: a
- bB
- 0: bB
- *** Failers
-No match
- aB
-No match
- bA
-No match
-
-/^(a)?(?(1)a|b)+$/
- aa
- 0: aa
- 1: a
- b
- 0: b
- bb
- 0: bb
- *** Failers
-No match
- ab
-No match
-
-/^(?(?=abc)\w{3}:|\d\d)$/
- abc:
- 0: abc:
- 12
- 0: 12
- *** Failers
-No match
- 123
-No match
- xyz
-No match
-
-/^(?(?!abc)\d\d|\w{3}:)$/
- abc:
- 0: abc:
- 12
- 0: 12
- *** Failers
-No match
- 123
-No match
- xyz
-No match
-
-/(?(?<=foo)bar|cat)/
- foobar
- 0: bar
- cat
- 0: cat
- fcat
- 0: cat
- focat
- 0: cat
- *** Failers
-No match
- foocat
-No match
-
-/(?(?<!foo)cat|bar)/
- foobar
- 0: bar
- cat
- 0: cat
- fcat
- 0: cat
- focat
- 0: cat
- *** Failers
-No match
- foocat
-No match
-
-/( \( )? [^()]+ (?(1) \) |) /x
- abcd
- 0: abcd
- (abcd)
- 0: (abcd)
- 1: (
- the quick (abcd) fox
- 0: the quick
- (abcd
- 0: abcd
-
-/( \( )? [^()]+ (?(1) \) ) /x
- abcd
- 0: abcd
- (abcd)
- 0: (abcd)
- 1: (
- the quick (abcd) fox
- 0: the quick
- (abcd
- 0: abcd
-
-/^(?(2)a|(1)(2))+$/
- 12
- 0: 12
- 1: 1
- 2: 2
- 12a
- 0: 12a
- 1: 1
- 2: 2
- 12aa
- 0: 12aa
- 1: 1
- 2: 2
- *** Failers
-No match
- 1234
-No match
-
-/((?i)blah)\s+\1/
- blah blah
- 0: blah blah
- 1: blah
- BLAH BLAH
- 0: BLAH BLAH
- 1: BLAH
- Blah Blah
- 0: Blah Blah
- 1: Blah
- blaH blaH
- 0: blaH blaH
- 1: blaH
- *** Failers
-No match
- blah BLAH
-No match
- Blah blah
-No match
- blaH blah
-No match
-
-/((?i)blah)\s+(?i:\1)/
- blah blah
- 0: blah blah
- 1: blah
- BLAH BLAH
- 0: BLAH BLAH
- 1: BLAH
- Blah Blah
- 0: Blah Blah
- 1: Blah
- blaH blaH
- 0: blaH blaH
- 1: blaH
- blah BLAH
- 0: blah BLAH
- 1: blah
- Blah blah
- 0: Blah blah
- 1: Blah
- blaH blah
- 0: blaH blah
- 1: blaH
-
-/(?>a*)*/
- a
- 0: a
- aa
- 0: aa
- aaaa
- 0: aaaa
-
-/(abc|)+/
- abc
- 0: abc
- 1:
- abcabc
- 0: abcabc
- 1:
- abcabcabc
- 0: abcabcabc
- 1:
- xyz
- 0:
- 1:
-
-/([a]*)*/
- a
- 0: a
- 1:
- aaaaa
- 0: aaaaa
- 1:
-
-/([ab]*)*/
- a
- 0: a
- 1:
- b
- 0: b
- 1:
- ababab
- 0: ababab
- 1:
- aaaabcde
- 0: aaaab
- 1:
- bbbb
- 0: bbbb
- 1:
-
-/([^a]*)*/
- b
- 0: b
- 1:
- bbbb
- 0: bbbb
- 1:
- aaa
- 0:
- 1:
-
-/([^ab]*)*/
- cccc
- 0: cccc
- 1:
- abab
- 0:
- 1:
-
-/([a]*?)*/
- a
- 0:
- 1:
- aaaa
- 0:
- 1:
-
-/([ab]*?)*/
- a
- 0:
- 1:
- b
- 0:
- 1:
- abab
- 0:
- 1:
- baba
- 0:
- 1:
-
-/([^a]*?)*/
- b
- 0:
- 1:
- bbbb
- 0:
- 1:
- aaa
- 0:
- 1:
-
-/([^ab]*?)*/
- c
- 0:
- 1:
- cccc
- 0:
- 1:
- baba
- 0:
- 1:
-
-/(?>a*)*/
- a
- 0: a
- aaabcde
- 0: aaa
-
-/((?>a*))*/
- aaaaa
- 0: aaaaa
- 1:
- aabbaa
- 0: aa
- 1:
-
-/((?>a*?))*/
- aaaaa
- 0:
- 1:
- aabbaa
- 0:
- 1:
-
-/(?(?=[^a-z]+[a-z]) \d{2}-[a-z]{3}-\d{2} | \d{2}-\d{2}-\d{2} ) /x
- 12-sep-98
- 0: 12-sep-98
- 12-09-98
- 0: 12-09-98
- *** Failers
-No match
- sep-12-98
-No match
-
-/(?<=(foo))bar\1/
- foobarfoo
- 0: barfoo
- 1: foo
- foobarfootling
- 0: barfoo
- 1: foo
- *** Failers
-No match
- foobar
-No match
- barfoo
-No match
-
-/(?i:saturday|sunday)/
- saturday
- 0: saturday
- sunday
- 0: sunday
- Saturday
- 0: Saturday
- Sunday
- 0: Sunday
- SATURDAY
- 0: SATURDAY
- SUNDAY
- 0: SUNDAY
- SunDay
- 0: SunDay
-
-/(a(?i)bc|BB)x/
- abcx
- 0: abcx
- 1: abc
- aBCx
- 0: aBCx
- 1: aBC
- bbx
- 0: bbx
- 1: bb
- BBx
- 0: BBx
- 1: BB
- *** Failers
-No match
- abcX
-No match
- aBCX
-No match
- bbX
-No match
- BBX
-No match
-
-/^([ab](?i)[cd]|[ef])/
- ac
- 0: ac
- 1: ac
- aC
- 0: aC
- 1: aC
- bD
- 0: bD
- 1: bD
- elephant
- 0: e
- 1: e
- Europe
- 0: E
- 1: E
- frog
- 0: f
- 1: f
- France
- 0: F
- 1: F
- *** Failers
-No match
- Africa
-No match
-
-/^(ab|a(?i)[b-c](?m-i)d|x(?i)y|z)/
- ab
- 0: ab
- 1: ab
- aBd
- 0: aBd
- 1: aBd
- xy
- 0: xy
- 1: xy
- xY
- 0: xY
- 1: xY
- zebra
- 0: z
- 1: z
- Zambesi
- 0: Z
- 1: Z
- *** Failers
-No match
- aCD
-No match
- XY
-No match
-
-/(?<=foo\n)^bar/m
- foo\nbar
- 0: bar
- *** Failers
-No match
- bar
-No match
- baz\nbar
-No match
-
-/(?<=(?<!foo)bar)baz/
- barbaz
- 0: baz
- barbarbaz
- 0: baz
- koobarbaz
- 0: baz
- *** Failers
-No match
- baz
-No match
- foobarbaz
-No match
-
-/The case of aaaaaa is missed out below because I think Perl 5.005_02 gets/
-/it wrong; it sets $1 to aaa rather than aa. Compare the following test,/
-No match
-/where it does set $1 to aa when matching aaaaaa./
-No match
-
-/^(a\1?){4}$/
- a
-No match
- aa
-No match
- aaa
-No match
- aaaa
- 0: aaaa
- 1: a
- aaaaa
- 0: aaaaa
- 1: a
- aaaaaaa
- 0: aaaaaaa
- 1: a
- aaaaaaaa
-No match
- aaaaaaaaa
-No match
- aaaaaaaaaa
- 0: aaaaaaaaaa
- 1: aaaa
- aaaaaaaaaaa
-No match
- aaaaaaaaaaaa
-No match
- aaaaaaaaaaaaa
-No match
- aaaaaaaaaaaaaa
-No match
- aaaaaaaaaaaaaaa
-No match
- aaaaaaaaaaaaaaaa
-No match
-
-/^(a\1?)(a\1?)(a\2?)(a\3?)$/
- a
-No match
- aa
-No match
- aaa
-No match
- aaaa
- 0: aaaa
- 1: a
- 2: a
- 3: a
- 4: a
- aaaaa
- 0: aaaaa
- 1: a
- 2: aa
- 3: a
- 4: a
- aaaaaa
- 0: aaaaaa
- 1: a
- 2: aa
- 3: a
- 4: aa
- aaaaaaa
- 0: aaaaaaa
- 1: a
- 2: aa
- 3: aaa
- 4: a
- aaaaaaaa
-No match
- aaaaaaaaa
-No match
- aaaaaaaaaa
- 0: aaaaaaaaaa
- 1: a
- 2: aa
- 3: aaa
- 4: aaaa
- aaaaaaaaaaa
-No match
- aaaaaaaaaaaa
-No match
- aaaaaaaaaaaaa
-No match
- aaaaaaaaaaaaaa
-No match
- aaaaaaaaaaaaaaa
-No match
- aaaaaaaaaaaaaaaa
-No match
-
-/The following tests are taken from the Perl 5.005 test suite; some of them/
-/are compatible with 5.004, but I'd rather not have to sort them out./
-No match
-
-/abc/
- abc
- 0: abc
- xabcy
- 0: abc
- ababc
- 0: abc
- *** Failers
-No match
- xbc
-No match
- axc
-No match
- abx
-No match
-
-/ab*c/
- abc
- 0: abc
-
-/ab*bc/
- abc
- 0: abc
- abbc
- 0: abbc
- abbbbc
- 0: abbbbc
-
-/.{1}/
- abbbbc
- 0: a
-
-/.{3,4}/
- abbbbc
- 0: abbb
-
-/ab{0,}bc/
- abbbbc
- 0: abbbbc
-
-/ab+bc/
- abbc
- 0: abbc
- *** Failers
-No match
- abc
-No match
- abq
-No match
-
-/ab{1,}bc/
-
-/ab+bc/
- abbbbc
- 0: abbbbc
-
-/ab{1,}bc/
- abbbbc
- 0: abbbbc
-
-/ab{1,3}bc/
- abbbbc
- 0: abbbbc
-
-/ab{3,4}bc/
- abbbbc
- 0: abbbbc
-
-/ab{4,5}bc/
- *** Failers
-No match
- abq
-No match
- abbbbc
-No match
-
-/ab?bc/
- abbc
- 0: abbc
- abc
- 0: abc
-
-/ab{0,1}bc/
- abc
- 0: abc
-
-/ab?bc/
-
-/ab?c/
- abc
- 0: abc
-
-/ab{0,1}c/
- abc
- 0: abc
-
-/^abc$/
- abc
- 0: abc
- *** Failers
-No match
- abbbbc
-No match
- abcc
-No match
-
-/^abc/
- abcc
- 0: abc
-
-/^abc$/
-
-/abc$/
- aabc
- 0: abc
- *** Failers
-No match
- aabc
- 0: abc
- aabcd
-No match
-
-/^/
- abc
- 0:
-
-/$/
- abc
- 0:
-
-/a.c/
- abc
- 0: abc
- axc
- 0: axc
-
-/a.*c/
- axyzc
- 0: axyzc
-
-/a[bc]d/
- abd
- 0: abd
- *** Failers
-No match
- axyzd
-No match
- abc
-No match
-
-/a[b-d]e/
- ace
- 0: ace
-
-/a[b-d]/
- aac
- 0: ac
-
-/a[-b]/
- a-
- 0: a-
-
-/a[b-]/
- a-
- 0: a-
-
-/a]/
- a]
- 0: a]
-
-/a[]]b/
- a]b
- 0: a]b
-
-/a[^bc]d/
- aed
- 0: aed
- *** Failers
-No match
- abd
-No match
- abd
-No match
-
-/a[^-b]c/
- adc
- 0: adc
-
-/a[^]b]c/
- adc
- 0: adc
- *** Failers
-No match
- a-c
- 0: a-c
- a]c
-No match
-
-/\ba\b/
- a-
- 0: a
- -a
- 0: a
- -a-
- 0: a
-
-/\by\b/
- *** Failers
-No match
- xy
-No match
- yz
-No match
- xyz
-No match
-
-/\Ba\B/
- *** Failers
- 0: a
- a-
-No match
- -a
-No match
- -a-
-No match
-
-/\By\b/
- xy
- 0: y
-
-/\by\B/
- yz
- 0: y
-
-/\By\B/
- xyz
- 0: y
-
-/\w/
- a
- 0: a
-
-/\W/
- -
- 0: -
- *** Failers
- 0: *
- -
- 0: -
- a
-No match
-
-/a\sb/
- a b
- 0: a b
-
-/a\Sb/
- a-b
- 0: a-b
- *** Failers
-No match
- a-b
- 0: a-b
- a b
-No match
-
-/\d/
- 1
- 0: 1
-
-/\D/
- -
- 0: -
- *** Failers
- 0: *
- -
- 0: -
- 1
-No match
-
-/[\w]/
- a
- 0: a
-
-/[\W]/
- -
- 0: -
- *** Failers
- 0: *
- -
- 0: -
- a
-No match
-
-/a[\s]b/
- a b
- 0: a b
-
-/a[\S]b/
- a-b
- 0: a-b
- *** Failers
-No match
- a-b
- 0: a-b
- a b
-No match
-
-/[\d]/
- 1
- 0: 1
-
-/[\D]/
- -
- 0: -
- *** Failers
- 0: *
- -
- 0: -
- 1
-No match
-
-/ab|cd/
- abc
- 0: ab
- abcd
- 0: ab
-
-/()ef/
- def
- 0: ef
- 1:
-
-/$b/
-
-/a\(b/
- a(b
- 0: a(b
-
-/a\(*b/
- ab
- 0: ab
- a((b
- 0: a((b
-
-/a\\b/
- a\b
-No match
-
-/((a))/
- abc
- 0: a
- 1: a
- 2: a
-
-/(a)b(c)/
- abc
- 0: abc
- 1: a
- 2: c
-
-/a+b+c/
- aabbabc
- 0: abc
-
-/a{1,}b{1,}c/
- aabbabc
- 0: abc
-
-/a.+?c/
- abcabc
- 0: abc
-
-/(a+|b)*/
- ab
- 0: ab
- 1: b
-
-/(a+|b){0,}/
- ab
- 0: ab
- 1: b
-
-/(a+|b)+/
- ab
- 0: ab
- 1: b
-
-/(a+|b){1,}/
- ab
- 0: ab
- 1: b
-
-/(a+|b)?/
- ab
- 0: a
- 1: a
-
-/(a+|b){0,1}/
- ab
- 0: a
- 1: a
-
-/[^ab]*/
- cde
- 0: cde
-
-/abc/
- *** Failers
-No match
- b
-No match
-
-
-/a*/
-
-
-/([abc])*d/
- abbbcd
- 0: abbbcd
- 1: c
-
-/([abc])*bcd/
- abcd
- 0: abcd
- 1: a
-
-/a|b|c|d|e/
- e
- 0: e
-
-/(a|b|c|d|e)f/
- ef
- 0: ef
- 1: e
-
-/abcd*efg/
- abcdefg
- 0: abcdefg
-
-/ab*/
- xabyabbbz
- 0: ab
- xayabbbz
- 0: a
-
-/(ab|cd)e/
- abcde
- 0: cde
- 1: cd
-
-/[abhgefdc]ij/
- hij
- 0: hij
-
-/^(ab|cd)e/
-
-/(abc|)ef/
- abcdef
- 0: ef
- 1:
-
-/(a|b)c*d/
- abcd
- 0: bcd
- 1: b
-
-/(ab|ab*)bc/
- abc
- 0: abc
- 1: a
-
-/a([bc]*)c*/
- abc
- 0: abc
- 1: bc
-
-/a([bc]*)(c*d)/
- abcd
- 0: abcd
- 1: bc
- 2: d
-
-/a([bc]+)(c*d)/
- abcd
- 0: abcd
- 1: bc
- 2: d
-
-/a([bc]*)(c+d)/
- abcd
- 0: abcd
- 1: b
- 2: cd
-
-/a[bcd]*dcdcde/
- adcdcde
- 0: adcdcde
-
-/a[bcd]+dcdcde/
- *** Failers
-No match
- abcde
-No match
- adcdcde
-No match
-
-/(ab|a)b*c/
- abc
- 0: abc
- 1: ab
-
-/((a)(b)c)(d)/
- abcd
- 0: abcd
- 1: abc
- 2: a
- 3: b
- 4: d
-
-/[a-zA-Z_][a-zA-Z0-9_]*/
- alpha
- 0: alpha
-
-/^a(bc+|b[eh])g|.h$/
- abh
- 0: bh
-
-/(bc+d$|ef*g.|h?i(j|k))/
- effgz
- 0: effgz
- 1: effgz
- ij
- 0: ij
- 1: ij
- 2: j
- reffgz
- 0: effgz
- 1: effgz
- *** Failers
-No match
- effg
-No match
- bcdd
-No match
-
-/((((((((((a))))))))))/
- a
- 0: a
- 1: a
- 2: a
- 3: a
- 4: a
- 5: a
- 6: a
- 7: a
- 8: a
- 9: a
-10: a
-
-/((((((((((a))))))))))\10/
- aa
- 0: aa
- 1: a
- 2: a
- 3: a
- 4: a
- 5: a
- 6: a
- 7: a
- 8: a
- 9: a
-10: a
-
-/(((((((((a)))))))))/
- a
- 0: a
- 1: a
- 2: a
- 3: a
- 4: a
- 5: a
- 6: a
- 7: a
- 8: a
- 9: a
-
-/multiple words of text/
- *** Failers
-No match
- aa
-No match
- uh-uh
-No match
-
-/multiple words/
- multiple words, yeah
- 0: multiple words
-
-/(.*)c(.*)/
- abcde
- 0: abcde
- 1: ab
- 2: de
-
-/\((.*), (.*)\)/
- (a, b)
- 0: (a, b)
- 1: a
- 2: b
-
-/[k]/
-
-/abcd/
- abcd
- 0: abcd
-
-/a(bc)d/
- abcd
- 0: abcd
- 1: bc
-
-/a[-]?c/
- ac
- 0: ac
-
-/(abc)\1/
- abcabc
- 0: abcabc
- 1: abc
-
-/([a-c]*)\1/
- abcabc
- 0: abcabc
- 1: abc
-
-/(a)|\1/
- a
- 0: a
- 1: a
- *** Failers
- 0: a
- 1: a
- ab
- 0: a
- 1: a
- x
-No match
-
-/(([a-c])b*?\2)*/
- ababbbcbc
- 0: ababb
- 1: bb
- 2: b
-
-/(([a-c])b*?\2){3}/
- ababbbcbc
- 0: ababbbcbc
- 1: cbc
- 2: c
-
-/((\3|b)\2(a)x)+/
- aaaxabaxbaaxbbax
- 0: bbax
- 1: bbax
- 2: b
- 3: a
-
-/((\3|b)\2(a)){2,}/
- bbaababbabaaaaabbaaaabba
- 0: bbaaaabba
- 1: bba
- 2: b
- 3: a
-
-/abc/i
- ABC
- 0: ABC
- XABCY
- 0: ABC
- ABABC
- 0: ABC
- *** Failers
-No match
- aaxabxbaxbbx
-No match
- XBC
-No match
- AXC
-No match
- ABX
-No match
-
-/ab*c/i
- ABC
- 0: ABC
-
-/ab*bc/i
- ABC
- 0: ABC
- ABBC
- 0: ABBC
-
-/ab*?bc/i
- ABBBBC
- 0: ABBBBC
-
-/ab{0,}?bc/i
- ABBBBC
- 0: ABBBBC
-
-/ab+?bc/i
- ABBC
- 0: ABBC
-
-/ab+bc/i
- *** Failers
-No match
- ABC
-No match
- ABQ
-No match
-
-/ab{1,}bc/i
-
-/ab+bc/i
- ABBBBC
- 0: ABBBBC
-
-/ab{1,}?bc/i
- ABBBBC
- 0: ABBBBC
-
-/ab{1,3}?bc/i
- ABBBBC
- 0: ABBBBC
-
-/ab{3,4}?bc/i
- ABBBBC
- 0: ABBBBC
-
-/ab{4,5}?bc/i
- *** Failers
-No match
- ABQ
-No match
- ABBBBC
-No match
-
-/ab??bc/i
- ABBC
- 0: ABBC
- ABC
- 0: ABC
-
-/ab{0,1}?bc/i
- ABC
- 0: ABC
-
-/ab??bc/i
-
-/ab??c/i
- ABC
- 0: ABC
-
-/ab{0,1}?c/i
- ABC
- 0: ABC
-
-/^abc$/i
- ABC
- 0: ABC
- *** Failers
-No match
- ABBBBC
-No match
- ABCC
-No match
-
-/^abc/i
- ABCC
- 0: ABC
-
-/^abc$/i
-
-/abc$/i
- AABC
- 0: ABC
-
-/^/i
- ABC
- 0:
-
-/$/i
- ABC
- 0:
-
-/a.c/i
- ABC
- 0: ABC
- AXC
- 0: AXC
-
-/a.*?c/i
- AXYZC
- 0: AXYZC
-
-/a.*c/i
- *** Failers
-No match
- AABC
- 0: AABC
- AXYZD
-No match
-
-/a[bc]d/i
- ABD
- 0: ABD
-
-/a[b-d]e/i
- ACE
- 0: ACE
- *** Failers
-No match
- ABC
-No match
- ABD
-No match
-
-/a[b-d]/i
- AAC
- 0: AC
-
-/a[-b]/i
- A-
- 0: A-
-
-/a[b-]/i
- A-
- 0: A-
-
-/a]/i
- A]
- 0: A]
-
-/a[]]b/i
- A]B
- 0: A]B
-
-/a[^bc]d/i
- AED
- 0: AED
-
-/a[^-b]c/i
- ADC
- 0: ADC
- *** Failers
-No match
- ABD
-No match
- A-C
-No match
-
-/a[^]b]c/i
- ADC
- 0: ADC
-
-/ab|cd/i
- ABC
- 0: AB
- ABCD
- 0: AB
-
-/()ef/i
- DEF
- 0: EF
- 1:
-
-/$b/i
- *** Failers
-No match
- A]C
-No match
- B
-No match
-
-/a\(b/i
- A(B
- 0: A(B
-
-/a\(*b/i
- AB
- 0: AB
- A((B
- 0: A((B
-
-/a\\b/i
- A\B
-No match
-
-/((a))/i
- ABC
- 0: A
- 1: A
- 2: A
-
-/(a)b(c)/i
- ABC
- 0: ABC
- 1: A
- 2: C
-
-/a+b+c/i
- AABBABC
- 0: ABC
-
-/a{1,}b{1,}c/i
- AABBABC
- 0: ABC
-
-/a.+?c/i
- ABCABC
- 0: ABC
-
-/a.*?c/i
- ABCABC
- 0: ABC
-
-/a.{0,5}?c/i
- ABCABC
- 0: ABC
-
-/(a+|b)*/i
- AB
- 0: AB
- 1: B
-
-/(a+|b){0,}/i
- AB
- 0: AB
- 1: B
-
-/(a+|b)+/i
- AB
- 0: AB
- 1: B
-
-/(a+|b){1,}/i
- AB
- 0: AB
- 1: B
-
-/(a+|b)?/i
- AB
- 0: A
- 1: A
-
-/(a+|b){0,1}/i
- AB
- 0: A
- 1: A
-
-/(a+|b){0,1}?/i
- AB
- 0:
-
-/[^ab]*/i
- CDE
- 0: CDE
-
-/abc/i
-
-/a*/i
-
-
-/([abc])*d/i
- ABBBCD
- 0: ABBBCD
- 1: C
-
-/([abc])*bcd/i
- ABCD
- 0: ABCD
- 1: A
-
-/a|b|c|d|e/i
- E
- 0: E
-
-/(a|b|c|d|e)f/i
- EF
- 0: EF
- 1: E
-
-/abcd*efg/i
- ABCDEFG
- 0: ABCDEFG
-
-/ab*/i
- XABYABBBZ
- 0: AB
- XAYABBBZ
- 0: A
-
-/(ab|cd)e/i
- ABCDE
- 0: CDE
- 1: CD
-
-/[abhgefdc]ij/i
- HIJ
- 0: HIJ
-
-/^(ab|cd)e/i
- ABCDE
-No match
-
-/(abc|)ef/i
- ABCDEF
- 0: EF
- 1:
-
-/(a|b)c*d/i
- ABCD
- 0: BCD
- 1: B
-
-/(ab|ab*)bc/i
- ABC
- 0: ABC
- 1: A
-
-/a([bc]*)c*/i
- ABC
- 0: ABC
- 1: BC
-
-/a([bc]*)(c*d)/i
- ABCD
- 0: ABCD
- 1: BC
- 2: D
-
-/a([bc]+)(c*d)/i
- ABCD
- 0: ABCD
- 1: BC
- 2: D
-
-/a([bc]*)(c+d)/i
- ABCD
- 0: ABCD
- 1: B
- 2: CD
-
-/a[bcd]*dcdcde/i
- ADCDCDE
- 0: ADCDCDE
-
-/a[bcd]+dcdcde/i
-
-/(ab|a)b*c/i
- ABC
- 0: ABC
- 1: AB
-
-/((a)(b)c)(d)/i
- ABCD
- 0: ABCD
- 1: ABC
- 2: A
- 3: B
- 4: D
-
-/[a-zA-Z_][a-zA-Z0-9_]*/i
- ALPHA
- 0: ALPHA
-
-/^a(bc+|b[eh])g|.h$/i
- ABH
- 0: BH
-
-/(bc+d$|ef*g.|h?i(j|k))/i
- EFFGZ
- 0: EFFGZ
- 1: EFFGZ
- IJ
- 0: IJ
- 1: IJ
- 2: J
- REFFGZ
- 0: EFFGZ
- 1: EFFGZ
- *** Failers
-No match
- ADCDCDE
-No match
- EFFG
-No match
- BCDD
-No match
-
-/((((((((((a))))))))))/i
- A
- 0: A
- 1: A
- 2: A
- 3: A
- 4: A
- 5: A
- 6: A
- 7: A
- 8: A
- 9: A
-10: A
-
-/((((((((((a))))))))))\10/i
- AA
- 0: AA
- 1: A
- 2: A
- 3: A
- 4: A
- 5: A
- 6: A
- 7: A
- 8: A
- 9: A
-10: A
-
-/(((((((((a)))))))))/i
- A
- 0: A
- 1: A
- 2: A
- 3: A
- 4: A
- 5: A
- 6: A
- 7: A
- 8: A
- 9: A
-
-/(?:(?:(?:(?:(?:(?:(?:(?:(?:(a))))))))))/i
- A
- 0: A
- 1: A
-
-/(?:(?:(?:(?:(?:(?:(?:(?:(?:(a|b|c))))))))))/i
- C
- 0: C
- 1: C
-
-/multiple words of text/i
- *** Failers
-No match
- AA
-No match
- UH-UH
-No match
-
-/multiple words/i
- MULTIPLE WORDS, YEAH
- 0: MULTIPLE WORDS
-
-/(.*)c(.*)/i
- ABCDE
- 0: ABCDE
- 1: AB
- 2: DE
-
-/\((.*), (.*)\)/i
- (A, B)
- 0: (A, B)
- 1: A
- 2: B
-
-/[k]/i
-
-/abcd/i
- ABCD
- 0: ABCD
-
-/a(bc)d/i
- ABCD
- 0: ABCD
- 1: BC
-
-/a[-]?c/i
- AC
- 0: AC
-
-/(abc)\1/i
- ABCABC
- 0: ABCABC
- 1: ABC
-
-/([a-c]*)\1/i
- ABCABC
- 0: ABCABC
- 1: ABC
-
-/a(?!b)./
- abad
- 0: ad
-
-/a(?=d)./
- abad
- 0: ad
-
-/a(?=c|d)./
- abad
- 0: ad
-
-/a(?:b|c|d)(.)/
- ace
- 0: ace
- 1: e
-
-/a(?:b|c|d)*(.)/
- ace
- 0: ace
- 1: e
-
-/a(?:b|c|d)+?(.)/
- ace
- 0: ace
- 1: e
- acdbcdbe
- 0: acd
- 1: d
-
-/a(?:b|c|d)+(.)/
- acdbcdbe
- 0: acdbcdbe
- 1: e
-
-/a(?:b|c|d){2}(.)/
- acdbcdbe
- 0: acdb
- 1: b
-
-/a(?:b|c|d){4,5}(.)/
- acdbcdbe
- 0: acdbcdb
- 1: b
-
-/a(?:b|c|d){4,5}?(.)/
- acdbcdbe
- 0: acdbcd
- 1: d
-
-/((foo)|(bar))*/
- foobar
- 0: foobar
- 1: bar
- 2: foo
- 3: bar
-
-/a(?:b|c|d){6,7}(.)/
- acdbcdbe
- 0: acdbcdbe
- 1: e
-
-/a(?:b|c|d){6,7}?(.)/
- acdbcdbe
- 0: acdbcdbe
- 1: e
-
-/a(?:b|c|d){5,6}(.)/
- acdbcdbe
- 0: acdbcdbe
- 1: e
-
-/a(?:b|c|d){5,6}?(.)/
- acdbcdbe
- 0: acdbcdb
- 1: b
-
-/a(?:b|c|d){5,7}(.)/
- acdbcdbe
- 0: acdbcdbe
- 1: e
-
-/a(?:b|c|d){5,7}?(.)/
- acdbcdbe
- 0: acdbcdb
- 1: b
-
-/a(?:b|(c|e){1,2}?|d)+?(.)/
- ace
- 0: ace
- 1: c
- 2: e
-
-/^(.+)?B/
- AB
- 0: AB
- 1: A
-
-/^([^a-z])|(\^)$/
- .
- 0: .
- 1: .
-
-/^[<>]&/
- <&OUT
- 0: <&
-
-/^(a\1?){4}$/
- aaaaaaaaaa
- 0: aaaaaaaaaa
- 1: aaaa
- *** Failers
-No match
- AB
-No match
- aaaaaaaaa
-No match
- aaaaaaaaaaa
-No match
-
-/^(a(?(1)\1)){4}$/
- aaaaaaaaaa
- 0: aaaaaaaaaa
- 1: aaaa
- *** Failers
-No match
- aaaaaaaaa
-No match
- aaaaaaaaaaa
-No match
-
-/(?:(f)(o)(o)|(b)(a)(r))*/
- foobar
- 0: foobar
- 1: f
- 2: o
- 3: o
- 4: b
- 5: a
- 6: r
-
-/(?<=a)b/
- ab
- 0: b
- *** Failers
-No match
- cb
-No match
- b
-No match
-
-/(?<!c)b/
- ab
- 0: b
- b
- 0: b
- b
- 0: b
-
-/(?:..)*a/
- aba
- 0: aba
-
-/(?:..)*?a/
- aba
- 0: a
-
-/^(?:b|a(?=(.)))*\1/
- abc
- 0: ab
- 1: b
-
-/^(){3,5}/
- abc
- 0:
- 1:
-
-/^(a+)*ax/
- aax
- 0: aax
- 1: a
-
-/^((a|b)+)*ax/
- aax
- 0: aax
- 1: a
- 2: a
-
-/^((a|bc)+)*ax/
- aax
- 0: aax
- 1: a
- 2: a
-
-/(a|x)*ab/
- cab
- 0: ab
-
-/(a)*ab/
- cab
- 0: ab
-
-/(?:(?i)a)b/
- ab
- 0: ab
-
-/((?i)a)b/
- ab
- 0: ab
- 1: a
-
-/(?:(?i)a)b/
- Ab
- 0: Ab
-
-/((?i)a)b/
- Ab
- 0: Ab
- 1: A
-
-/(?:(?i)a)b/
- *** Failers
-No match
- cb
-No match
- aB
-No match
-
-/((?i)a)b/
-
-/(?i:a)b/
- ab
- 0: ab
-
-/((?i:a))b/
- ab
- 0: ab
- 1: a
-
-/(?i:a)b/
- Ab
- 0: Ab
-
-/((?i:a))b/
- Ab
- 0: Ab
- 1: A
-
-/(?i:a)b/
- *** Failers
-No match
- aB
-No match
- aB
-No match
-
-/((?i:a))b/
-
-/(?:(?-i)a)b/i
- ab
- 0: ab
-
-/((?-i)a)b/i
- ab
- 0: ab
- 1: a
-
-/(?:(?-i)a)b/i
- aB
- 0: aB
-
-/((?-i)a)b/i
- aB
- 0: aB
- 1: a
-
-/(?:(?-i)a)b/i
- *** Failers
-No match
- aB
- 0: aB
- Ab
-No match
-
-/((?-i)a)b/i
-
-/(?:(?-i)a)b/i
- aB
- 0: aB
-
-/((?-i)a)b/i
- aB
- 0: aB
- 1: a
-
-/(?:(?-i)a)b/i
- *** Failers
-No match
- Ab
-No match
- AB
-No match
-
-/((?-i)a)b/i
-
-/(?-i:a)b/i
- ab
- 0: ab
-
-/((?-i:a))b/i
- ab
- 0: ab
- 1: a
-
-/(?-i:a)b/i
- aB
- 0: aB
-
-/((?-i:a))b/i
- aB
- 0: aB
- 1: a
-
-/(?-i:a)b/i
- *** Failers
-No match
- AB
-No match
- Ab
-No match
-
-/((?-i:a))b/i
-
-/(?-i:a)b/i
- aB
- 0: aB
-
-/((?-i:a))b/i
- aB
- 0: aB
- 1: a
-
-/(?-i:a)b/i
- *** Failers
-No match
- Ab
-No match
- AB
-No match
-
-/((?-i:a))b/i
-
-/((?-i:a.))b/i
- *** Failers
-No match
- AB
-No match
- a\nB
-No match
-
-/((?s-i:a.))b/i
- a\nB
- 0: a\x0aB
- 1: a\x0a
-
-/(?:c|d)(?:)(?:a(?:)(?:b)(?:b(?:))(?:b(?:)(?:b)))/
- cabbbb
- 0: cabbbb
-
-/(?:c|d)(?:)(?:aaaaaaaa(?:)(?:bbbbbbbb)(?:bbbbbbbb(?:))(?:bbbbbbbb(?:)(?:bbbbbbbb)))/
- caaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
- 0: caaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
-
-/(ab)\d\1/i
- Ab4ab
- 0: Ab4ab
- 1: Ab
- ab4Ab
- 0: ab4Ab
- 1: ab
-
-/foo\w*\d{4}baz/
- foobar1234baz
- 0: foobar1234baz
-
-/x(~~)*(?:(?:F)?)?/
- x~~
- 0: x~~
- 1: ~~
-
-/^a(?#xxx){3}c/
- aaac
- 0: aaac
-
-/^a (?#xxx) (?#yyy) {3}c/x
- aaac
- 0: aaac
-
-/(?<![cd])b/
- *** Failers
-No match
- B\nB
-No match
- dbcb
-No match
-
-/(?<![cd])[ab]/
- dbaacb
- 0: a
-
-/(?<!(c|d))b/
-
-/(?<!(c|d))[ab]/
- dbaacb
- 0: a
-
-/(?<!cd)[ab]/
- cdaccb
- 0: b
-
-/^(?:a?b?)*$/
- *** Failers
-No match
- dbcb
-No match
- a--
-No match
-
-/((?s)^a(.))((?m)^b$)/
- a\nb\nc\n
- 0: a\x0ab
- 1: a\x0a
- 2: \x0a
- 3: b
-
-/((?m)^b$)/
- a\nb\nc\n
- 0: b
- 1: b
-
-/(?m)^b/
- a\nb\n
- 0: b
-
-/(?m)^(b)/
- a\nb\n
- 0: b
- 1: b
-
-/((?m)^b)/
- a\nb\n
- 0: b
- 1: b
-
-/\n((?m)^b)/
- a\nb\n
- 0: \x0ab
- 1: b
-
-/((?s).)c(?!.)/
- a\nb\nc\n
- 0: \x0ac
- 1: \x0a
- a\nb\nc\n
- 0: \x0ac
- 1: \x0a
-
-/((?s)b.)c(?!.)/
- a\nb\nc\n
- 0: b\x0ac
- 1: b\x0a
- a\nb\nc\n
- 0: b\x0ac
- 1: b\x0a
-
-/^b/
-
-/()^b/
- *** Failers
-No match
- a\nb\nc\n
-No match
- a\nb\nc\n
-No match
-
-/((?m)^b)/
- a\nb\nc\n
- 0: b
- 1: b
-
-/(?(1)a|b)/
-
-/(?(1)b|a)/
- a
- 0: a
-
-/(x)?(?(1)a|b)/
- *** Failers
-No match
- a
-No match
- a
-No match
-
-/(x)?(?(1)b|a)/
- a
- 0: a
-
-/()?(?(1)b|a)/
- a
- 0: a
-
-/()(?(1)b|a)/
-
-/()?(?(1)a|b)/
- a
- 0: a
- 1:
-
-/^(\()?blah(?(1)(\)))$/
- (blah)
- 0: (blah)
- 1: (
- 2: )
- blah
- 0: blah
- *** Failers
-No match
- a
-No match
- blah)
-No match
- (blah
-No match
-
-/^(\(+)?blah(?(1)(\)))$/
- (blah)
- 0: (blah)
- 1: (
- 2: )
- blah
- 0: blah
- *** Failers
-No match
- blah)
-No match
- (blah
-No match
-
-/(?(?!a)a|b)/
-
-/(?(?!a)b|a)/
- a
- 0: a
-
-/(?(?=a)b|a)/
- *** Failers
-No match
- a
-No match
- a
-No match
-
-/(?(?=a)a|b)/
- a
- 0: a
-
-/(?=(a+?))(\1ab)/
- aaab
- 0: aab
- 1: a
- 2: aab
-
-/^(?=(a+?))\1ab/
-
-/(\w+:)+/
- one:
- 0: one:
- 1: one:
-
-/$(?<=^(a))/
- a
- 0:
- 1: a
-
-/(?=(a+?))(\1ab)/
- aaab
- 0: aab
- 1: a
- 2: aab
-
-/^(?=(a+?))\1ab/
- *** Failers
-No match
- aaab
-No match
- aaab
-No match
-
-/([\w:]+::)?(\w+)$/
- abcd
- 0: abcd
- 1: <unset>
- 2: abcd
- xy:z:::abcd
- 0: xy:z:::abcd
- 1: xy:z:::
- 2: abcd
-
-/^[^bcd]*(c+)/
- aexycd
- 0: aexyc
- 1: c
-
-/(a*)b+/
- caab
- 0: aab
- 1: aa
-
-/([\w:]+::)?(\w+)$/
- abcd
- 0: abcd
- 1: <unset>
- 2: abcd
- xy:z:::abcd
- 0: xy:z:::abcd
- 1: xy:z:::
- 2: abcd
- *** Failers
- 0: Failers
- 1: <unset>
- 2: Failers
- abcd:
-No match
- abcd:
-No match
-
-/^[^bcd]*(c+)/
- aexycd
- 0: aexyc
- 1: c
-
-/(>a+)ab/
-
-/(?>a+)b/
- aaab
- 0: aaab
-
-/([[:]+)/
- a:[b]:
- 0: :[
- 1: :[
-
-/([[=]+)/
- a=[b]=
- 0: =[
- 1: =[
-
-/([[.]+)/
- a.[b].
- 0: .[
- 1: .[
-
-/((?>a+)b)/
- aaab
- 0: aaab
- 1: aaab
-
-/(?>(a+))b/
- aaab
- 0: aaab
- 1: aaa
-
-/((?>[^()]+)|\([^()]*\))+/
- ((abc(ade)ufh()()x
- 0: abc(ade)ufh()()x
- 1: x
-
-/a\Z/
- *** Failers
-No match
- aaab
-No match
- a\nb\n
-No match
-
-/b\Z/
- a\nb\n
- 0: b
-
-/b\z/
-
-/b\Z/
- a\nb
- 0: b
-
-/b\z/
- a\nb
- 0: b
- *** Failers
-No match
-
-/^(?>(?(1)\.|())[^\W_](?>[a-z0-9-]*[^\W_])?)+$/
- a
- 0: a
- 1:
- abc
- 0: abc
- 1:
- a-b
- 0: a-b
- 1:
- 0-9
- 0: 0-9
- 1:
- a.b
- 0: a.b
- 1:
- 5.6.7
- 0: 5.6.7
- 1:
- the.quick.brown.fox
- 0: the.quick.brown.fox
- 1:
- a100.b200.300c
- 0: a100.b200.300c
- 1:
- 12-ab.1245
- 0: 12-ab.1245
- 1:
- ***Failers
-No match
- \
-No match
- .a
-No match
- -a
-No match
- a-
-No match
- a.
-No match
- a_b
-No match
- a.-
-No match
- a..
-No match
- ab..bc
-No match
- the.quick.brown.fox-
-No match
- the.quick.brown.fox.
-No match
- the.quick.brown.fox_
-No match
- the.quick.brown.fox+
-No match
-
-/(?>.*)(?<=(abcd|wxyz))/
- alphabetabcd
- 0: alphabetabcd
- 1: abcd
- endingwxyz
- 0: endingwxyz
- 1: wxyz
- *** Failers
-No match
- a rather long string that doesn't end with one of them
-No match
-
-/word (?>(?:(?!otherword)[a-zA-Z0-9]+ ){0,30})otherword/
- word cat dog elephant mussel cow horse canary baboon snake shark otherword
- 0: word cat dog elephant mussel cow horse canary baboon snake shark otherword
- word cat dog elephant mussel cow horse canary baboon snake shark
-No match
-
-/word (?>[a-zA-Z0-9]+ ){0,30}otherword/
- word cat dog elephant mussel cow horse canary baboon snake shark the quick brown fox and the lazy dog and several other words getting close to thirty by now I hope
-No match
-
-/(?<=\d{3}(?!999))foo/
- 999foo
- 0: foo
- 123999foo
- 0: foo
- *** Failers
-No match
- 123abcfoo
-No match
-
-/(?<=(?!...999)\d{3})foo/
- 999foo
- 0: foo
- 123999foo
- 0: foo
- *** Failers
-No match
- 123abcfoo
-No match
-
-/(?<=\d{3}(?!999)...)foo/
- 123abcfoo
- 0: foo
- 123456foo
- 0: foo
- *** Failers
-No match
- 123999foo
-No match
-
-/(?<=\d{3}...)(?<!999)foo/
- 123abcfoo
- 0: foo
- 123456foo
- 0: foo
- *** Failers
-No match
- 123999foo
-No match
-
-/<a[\s]+href[\s]*=[\s]* # find <a href=
- ([\"\'])? # find single or double quote
- (?(1) (.*?)\1 | ([^\s]+)) # if quote found, match up to next matching
- # quote, otherwise match up to next space
-/isx
- <a href=abcd xyz
- 0: <a href=abcd
- 1: <unset>
- 2: <unset>
- 3: abcd
- <a href=\"abcd xyz pqr\" cats
- 0: <a href="abcd xyz pqr"
- 1: "
- 2: abcd xyz pqr
- <a href=\'abcd xyz pqr\' cats
- 0: <a href='abcd xyz pqr'
- 1: '
- 2: abcd xyz pqr
-
-/<a\s+href\s*=\s* # find <a href=
- (["'])? # find single or double quote
- (?(1) (.*?)\1 | (\S+)) # if quote found, match up to next matching
- # quote, otherwise match up to next space
-/isx
- <a href=abcd xyz
- 0: <a href=abcd
- 1: <unset>
- 2: <unset>
- 3: abcd
- <a href=\"abcd xyz pqr\" cats
- 0: <a href="abcd xyz pqr"
- 1: "
- 2: abcd xyz pqr
- <a href = \'abcd xyz pqr\' cats
- 0: <a href = 'abcd xyz pqr'
- 1: '
- 2: abcd xyz pqr
-
-/<a\s+href(?>\s*)=(?>\s*) # find <a href=
- (["'])? # find single or double quote
- (?(1) (.*?)\1 | (\S+)) # if quote found, match up to next matching
- # quote, otherwise match up to next space
-/isx
- <a href=abcd xyz
- 0: <a href=abcd
- 1: <unset>
- 2: <unset>
- 3: abcd
- <a href=\"abcd xyz pqr\" cats
- 0: <a href="abcd xyz pqr"
- 1: "
- 2: abcd xyz pqr
- <a href = \'abcd xyz pqr\' cats
- 0: <a href = 'abcd xyz pqr'
- 1: '
- 2: abcd xyz pqr
-
-/((Z)+|A)*/
- ZABCDEFG
- 0: ZA
- 1: A
- 2: Z
-
-/(Z()|A)*/
- ZABCDEFG
- 0: ZA
- 1: A
- 2:
-
-/(Z(())|A)*/
- ZABCDEFG
- 0: ZA
- 1: A
- 2:
- 3:
-
-/((?>Z)+|A)*/
- ZABCDEFG
- 0: ZA
- 1: A
-
-/((?>)+|A)*/
- ZABCDEFG
- 0:
- 1:
-
-/a*/g
- abbab
- 0: a
- 0:
- 0:
- 0: a
- 0:
- 0:
-
-/^[a-\d]/
- abcde
- 0: a
- -things
- 0: -
- 0digit
- 0: 0
- *** Failers
-No match
- bcdef
-No match
-
-/^[\d-a]/
- abcde
- 0: a
- -things
- 0: -
- 0digit
- 0: 0
- *** Failers
-No match
- bcdef
-No match
-
-/ End of testinput3 /
-
diff --git a/ext/pcre/pcrelib/testdata/testoutput4 b/ext/pcre/pcrelib/testdata/testoutput4
deleted file mode 100644
index f1fbb564b5..0000000000
--- a/ext/pcre/pcrelib/testdata/testoutput4
+++ /dev/null
@@ -1,116 +0,0 @@
-PCRE version 3.4 22-Aug-2000
-
-/^[\w]+/
- *** Failers
-No match
- École
-No match
-
-/^[\w]+/Lfr
- École
- 0: École
-
-/^[\w]+/
- *** Failers
-No match
- École
-No match
-
-/^[\W]+/
- École
- 0: \xc9
-
-/^[\W]+/Lfr
- *** Failers
- 0: ***
- École
-No match
-
-/[\b]/
- \b
- 0: \x08
- *** Failers
-No match
- a
-No match
-
-/[\b]/Lfr
- \b
- 0: \x08
- *** Failers
-No match
- a
-No match
-
-/^\w+/
- *** Failers
-No match
- École
-No match
-
-/^\w+/Lfr
- École
- 0: École
-
-/(.+)\b(.+)/
- École
- 0: \xc9cole
- 1: \xc9
- 2: cole
-
-/(.+)\b(.+)/Lfr
- *** Failers
- 0: *** Failers
- 1: ***
- 2: Failers
- École
-No match
-
-/École/i
- École
- 0: \xc9cole
- *** Failers
-No match
- école
-No match
-
-/École/iLfr
- École
- 0: École
- école
- 0: école
-
-/\w/IS
-Capturing subpattern count = 0
-No options
-No first char
-No need char
-Starting character set: 0 1 2 3 4 5 6 7 8 9 A B C D E F G H I J K L M N O P
- Q R S T U V W X Y Z _ a b c d e f g h i j k l m n o p q r s t u v w x y z
-
-/\w/ISLfr
-Capturing subpattern count = 0
-No options
-No first char
-No need char
-Starting character set: 0 1 2 3 4 5 6 7 8 9 A B C D E F G H I J K L M N O P
- Q R S T U V W X Y Z _ a b c d e f g h i j k l m n o p q r s t u v w x y z
- À Á Â Ã Ä Å Æ Ç È É Ê Ë Ì Í Î Ï Ð Ñ Ò Ó Ô Õ Ö Ø Ù Ú Û Ü Ý Þ ß à á â ã ä å
- æ ç è é ê ë ì í î ï ð ñ ò ó ô õ ö ø ù ú û ü ý þ ÿ
-
-/^[\xc8-\xc9]/iLfr
- École
- 0: É
- école
- 0: é
-
-/^[\xc8-\xc9]/Lfr
- École
- 0: É
- *** Failers
-No match
- école
-No match
-
-/ End of testinput4 /
-
diff --git a/ext/pcre/pcrelib/testdata/testoutput5 b/ext/pcre/pcrelib/testdata/testoutput5
deleted file mode 100644
index 4b81ae39f4..0000000000
--- a/ext/pcre/pcrelib/testdata/testoutput5
+++ /dev/null
@@ -1,242 +0,0 @@
-PCRE version 3.4 22-Aug-2000
-
-/-- Because of problems with Perl 5.6 in handling UTF-8 vs non UTF-8 --/
-/-- strings automatically, do not use the \x{} construct except with --/
-No match
-/-- patterns that have the /8 option set, and don't use them without! --/
-No match
-
-/a.b/8
- acb
- 0: acb
- a\x7fb
- 0: a\x{7f}b
- a\x{100}b
- 0: a\x{100}b
- *** Failers
-No match
- a\nb
-No match
-
-/a(.{3})b/8
- a\x{4000}xyb
- 0: a\x{4000}xyb
- 1: \x{4000}xy
- a\x{4000}\x7fyb
- 0: a\x{4000}\x{7f}yb
- 1: \x{4000}\x{7f}y
- a\x{4000}\x{100}yb
- 0: a\x{4000}\x{100}yb
- 1: \x{4000}\x{100}y
- *** Failers
-No match
- a\x{4000}b
-No match
- ac\ncb
-No match
-
-/a(.*?)(.)/
- a\xc0\x88b
- 0: a\xc0
- 1:
- 2: \xc0
-
-/a(.*?)(.)/8
- a\x{100}b
- 0: a\x{100}
- 1:
- 2: \x{100}
-
-/a(.*)(.)/
- a\xc0\x88b
- 0: a\xc0\x88b
- 1: \xc0\x88
- 2: b
-
-/a(.*)(.)/8
- a\x{100}b
- 0: a\x{100}b
- 1: \x{100}
- 2: b
-
-/a(.)(.)/
- a\xc0\x92bcd
- 0: a\xc0\x92
- 1: \xc0
- 2: \x92
-
-/a(.)(.)/8
- a\x{240}bcd
- 0: a\x{240}b
- 1: \x{240}
- 2: b
-
-/a(.?)(.)/
- a\xc0\x92bcd
- 0: a\xc0\x92
- 1: \xc0
- 2: \x92
-
-/a(.?)(.)/8
- a\x{240}bcd
- 0: a\x{240}b
- 1: \x{240}
- 2: b
-
-/a(.??)(.)/
- a\xc0\x92bcd
- 0: a\xc0
- 1:
- 2: \xc0
-
-/a(.??)(.)/8
- a\x{240}bcd
- 0: a\x{240}
- 1:
- 2: \x{240}
-
-/a(.{3})b/8
- a\x{1234}xyb
- 0: a\x{1234}xyb
- 1: \x{1234}xy
- a\x{1234}\x{4321}yb
- 0: a\x{1234}\x{4321}yb
- 1: \x{1234}\x{4321}y
- a\x{1234}\x{4321}\x{3412}b
- 0: a\x{1234}\x{4321}\x{3412}b
- 1: \x{1234}\x{4321}\x{3412}
- *** Failers
-No match
- a\x{1234}b
-No match
- ac\ncb
-No match
-
-/a(.{3,})b/8
- a\x{1234}xyb
- 0: a\x{1234}xyb
- 1: \x{1234}xy
- a\x{1234}\x{4321}yb
- 0: a\x{1234}\x{4321}yb
- 1: \x{1234}\x{4321}y
- a\x{1234}\x{4321}\x{3412}b
- 0: a\x{1234}\x{4321}\x{3412}b
- 1: \x{1234}\x{4321}\x{3412}
- axxxxbcdefghijb
- 0: axxxxbcdefghijb
- 1: xxxxbcdefghij
- a\x{1234}\x{4321}\x{3412}\x{3421}b
- 0: a\x{1234}\x{4321}\x{3412}\x{3421}b
- 1: \x{1234}\x{4321}\x{3412}\x{3421}
- *** Failers
-No match
- a\x{1234}b
-No match
-
-/a(.{3,}?)b/8
- a\x{1234}xyb
- 0: a\x{1234}xyb
- 1: \x{1234}xy
- a\x{1234}\x{4321}yb
- 0: a\x{1234}\x{4321}yb
- 1: \x{1234}\x{4321}y
- a\x{1234}\x{4321}\x{3412}b
- 0: a\x{1234}\x{4321}\x{3412}b
- 1: \x{1234}\x{4321}\x{3412}
- axxxxbcdefghijb
- 0: axxxxb
- 1: xxxx
- a\x{1234}\x{4321}\x{3412}\x{3421}b
- 0: a\x{1234}\x{4321}\x{3412}\x{3421}b
- 1: \x{1234}\x{4321}\x{3412}\x{3421}
- *** Failers
-No match
- a\x{1234}b
-No match
-
-/a(.{3,5})b/8
- a\x{1234}xyb
- 0: a\x{1234}xyb
- 1: \x{1234}xy
- a\x{1234}\x{4321}yb
- 0: a\x{1234}\x{4321}yb
- 1: \x{1234}\x{4321}y
- a\x{1234}\x{4321}\x{3412}b
- 0: a\x{1234}\x{4321}\x{3412}b
- 1: \x{1234}\x{4321}\x{3412}
- axxxxbcdefghijb
- 0: axxxxb
- 1: xxxx
- a\x{1234}\x{4321}\x{3412}\x{3421}b
- 0: a\x{1234}\x{4321}\x{3412}\x{3421}b
- 1: \x{1234}\x{4321}\x{3412}\x{3421}
- axbxxbcdefghijb
- 0: axbxxb
- 1: xbxx
- axxxxxbcdefghijb
- 0: axxxxxb
- 1: xxxxx
- *** Failers
-No match
- a\x{1234}b
-No match
- axxxxxxbcdefghijb
-No match
-
-/a(.{3,5}?)b/8
- a\x{1234}xyb
- 0: a\x{1234}xyb
- 1: \x{1234}xy
- a\x{1234}\x{4321}yb
- 0: a\x{1234}\x{4321}yb
- 1: \x{1234}\x{4321}y
- a\x{1234}\x{4321}\x{3412}b
- 0: a\x{1234}\x{4321}\x{3412}b
- 1: \x{1234}\x{4321}\x{3412}
- axxxxbcdefghijb
- 0: axxxxb
- 1: xxxx
- a\x{1234}\x{4321}\x{3412}\x{3421}b
- 0: a\x{1234}\x{4321}\x{3412}\x{3421}b
- 1: \x{1234}\x{4321}\x{3412}\x{3421}
- axbxxbcdefghijb
- 0: axbxxb
- 1: xbxx
- axxxxxbcdefghijb
- 0: axxxxxb
- 1: xxxxx
- *** Failers
-No match
- a\x{1234}b
-No match
- axxxxxxbcdefghijb
-No match
-
-/^[a\x{c0}]/8
- *** Failers
-No match
- \x{100}
-No match
-
-/(?<=aXb)cd/8
- aXbcd
- 0: cd
-
-/(?<=a\x{100}b)cd/8
- a\x{100}bcd
- 0: cd
-
-/(?<=a\x{100000}b)cd/8
- a\x{100000}bcd
- 0: cd
-
-/(?:\x{100}){3}b/8
- \x{100}\x{100}\x{100}b
- 0: \x{100}\x{100}\x{100}b
- *** Failers
-No match
- \x{100}\x{100}b
-No match
-
-/ End of testinput5 /
-
diff --git a/ext/pcre/pcrelib/testdata/testoutput6 b/ext/pcre/pcrelib/testdata/testoutput6
deleted file mode 100644
index a805609a35..0000000000
--- a/ext/pcre/pcrelib/testdata/testoutput6
+++ /dev/null
@@ -1,185 +0,0 @@
-PCRE version 3.4 22-Aug-2000
-
-/\x{100}/8DM
-Memory allocation (code space): 11
-------------------------------------------------------------------
- 0 7 Bra 0
- 3 2 \xc0\x88
- 7 7 Ket
- 10 End
-------------------------------------------------------------------
-Capturing subpattern count = 0
-Options: utf8
-First char = 192
-Need char = 136
-
-/\x{1000}/8DM
-Memory allocation (code space): 12
-------------------------------------------------------------------
- 0 8 Bra 0
- 3 3 \xe0\x80\x84
- 8 8 Ket
- 11 End
-------------------------------------------------------------------
-Capturing subpattern count = 0
-Options: utf8
-First char = 224
-Need char = 132
-
-/\x{10000}/8DM
-Memory allocation (code space): 13
-------------------------------------------------------------------
- 0 9 Bra 0
- 3 4 \xf0\x80\x80\x82
- 9 9 Ket
- 12 End
-------------------------------------------------------------------
-Capturing subpattern count = 0
-Options: utf8
-First char = 240
-Need char = 130
-
-/\x{100000}/8DM
-Memory allocation (code space): 13
-------------------------------------------------------------------
- 0 9 Bra 0
- 3 4 \xf0\x80\x80\xa0
- 9 9 Ket
- 12 End
-------------------------------------------------------------------
-Capturing subpattern count = 0
-Options: utf8
-First char = 240
-Need char = 160
-
-/\x{1000000}/8DM
-Memory allocation (code space): 14
-------------------------------------------------------------------
- 0 10 Bra 0
- 3 5 \xf8\x80\x80\x80\x90
- 10 10 Ket
- 13 End
-------------------------------------------------------------------
-Capturing subpattern count = 0
-Options: utf8
-First char = 248
-Need char = 144
-
-/\x{4000000}/8DM
-Memory allocation (code space): 15
-------------------------------------------------------------------
- 0 11 Bra 0
- 3 6 \xfc\x80\x80\x80\x80\x82
- 11 11 Ket
- 14 End
-------------------------------------------------------------------
-Capturing subpattern count = 0
-Options: utf8
-First char = 252
-Need char = 130
-
-/\x{7fffFFFF}/8DM
-Memory allocation (code space): 15
-------------------------------------------------------------------
- 0 11 Bra 0
- 3 6 \xfd\xbf\xbf\xbf\xbf\xbf
- 11 11 Ket
- 14 End
-------------------------------------------------------------------
-Capturing subpattern count = 0
-Options: utf8
-First char = 253
-Need char = 191
-
-/[\x{ff}]/8DM
-Memory allocation (code space): 40
-------------------------------------------------------------------
- 0 6 Bra 0
- 3 1 \xff
- 6 6 Ket
- 9 End
-------------------------------------------------------------------
-Capturing subpattern count = 0
-Options: utf8
-First char = 255
-No need char
-
-/[\x{100}]/8DM
-Memory allocation (code space): 40
-Failed: characters with values > 255 are not yet supported in classes at offset 7
-
-/\x{ffffffff}/8
-Failed: character value in \x{...} sequence is too large at offset 11
-
-/\x{100000000}/8
-Failed: character value in \x{...} sequence is too large at offset 12
-
-/^\x{100}a\x{1234}/8
- \x{100}a\x{1234}bcd
- 0: \x{100}a\x{1234}
-
-/\x80/8D
-------------------------------------------------------------------
- 0 7 Bra 0
- 3 2 \xc0\x84
- 7 7 Ket
- 10 End
-------------------------------------------------------------------
-Capturing subpattern count = 0
-Options: utf8
-First char = 192
-Need char = 132
-
-/\xff/8D
-------------------------------------------------------------------
- 0 7 Bra 0
- 3 2 \xdf\x87
- 7 7 Ket
- 10 End
-------------------------------------------------------------------
-Capturing subpattern count = 0
-Options: utf8
-First char = 223
-Need char = 135
-
-/-- These tests are here rather than in testinput5 because Perl 5.6 has --/
-/-- some problems with UTF-8 support, in the area of \x{..} where the --/
-No match
-/-- value is < 255. It grumbles about invalid UTF-8 strings. --/
-No match
-
-/^[a\x{c0}]b/8
- \x{c0}b
- 0: \x{c0}b
-
-/^([a\x{c0}]*?)aa/8
- a\x{c0}aaaa/
- 0: a\x{c0}aa
- 1: a\x{c0}
-
-/^([a\x{c0}]*?)aa/8
- a\x{c0}aaaa/
- 0: a\x{c0}aa
- 1: a\x{c0}
- a\x{c0}a\x{c0}aaa/
- 0: a\x{c0}a\x{c0}aa
- 1: a\x{c0}a\x{c0}
-
-/^([a\x{c0}]*)aa/8
- a\x{c0}aaaa/
- 0: a\x{c0}aaaa
- 1: a\x{c0}aa
- a\x{c0}a\x{c0}aaa/
- 0: a\x{c0}a\x{c0}aaa
- 1: a\x{c0}a\x{c0}a
-
-/^([a\x{c0}]*)a\x{c0}/8
- a\x{c0}aaaa/
- 0: a\x{c0}
- 1:
- a\x{c0}a\x{c0}aaa/
- 0: a\x{c0}a\x{c0}
- 1: a\x{c0}
-
-/ End of testinput6 /
-
diff --git a/ext/pcre/php_pcre.c b/ext/pcre/php_pcre.c
deleted file mode 100644
index 749c34f5e5..0000000000
--- a/ext/pcre/php_pcre.c
+++ /dev/null
@@ -1,1418 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andrei Zmievski <andrei@ispi.net> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "php_globals.h"
-#include "php_pcre.h"
-#include "ext/standard/info.h"
-#include "ext/standard/php_smart_str.h"
-
-#if HAVE_PCRE || HAVE_BUNDLED_PCRE
-
-#include "ext/standard/php_string.h"
-
-#define PREG_PATTERN_ORDER 0
-#define PREG_SET_ORDER 1
-
-#define PREG_SPLIT_NO_EMPTY (1<<0)
-#define PREG_SPLIT_DELIM_CAPTURE (1<<1)
-
-#define PREG_REPLACE_EVAL (1<<0)
-
-#ifdef ZTS
-int pcre_globals_id;
-#else
-php_pcre_globals pcre_globals;
-#endif
-
-
-static void *php_pcre_malloc(size_t size)
-{
- return pemalloc(size, 1);
-}
-
-
-static void php_pcre_free(void *ptr)
-{
- pefree(ptr, 1);
-}
-
-
-static void php_free_pcre_cache(void *data)
-{
- pcre_cache_entry *pce = (pcre_cache_entry *) data;
- pefree(pce->re, 1);
-#if HAVE_SETLOCALE
- if ((void*)pce->tables) pefree((void*)pce->tables, 1);
-#endif
-}
-
-
-#ifdef ZTS
-static void php_pcre_init_globals(php_pcre_globals *pcre_globals)
-{
- zend_hash_init(&PCRE_G(pcre_cache), 0, NULL, php_free_pcre_cache, 1);
-}
-
-
-static void php_pcre_shutdown_globals(php_pcre_globals *pcre_globals)
-{
- zend_hash_destroy(&PCRE_G(pcre_cache));
-}
-#endif
-
-
-static /* {{{ PHP_MINFO_FUNCTION(pcre) */
-PHP_MINFO_FUNCTION(pcre)
-{
- php_info_print_table_start();
- php_info_print_table_row(2, "PCRE (Perl Compatible Regular Expressions) Support", "enabled" );
- php_info_print_table_row(2, "PCRE Library Version", pcre_version() );
- php_info_print_table_end();
-}
-/* }}} */
-
-/* {{{ PHP_MINIT_FUNCTION(pcre) */
-static PHP_MINIT_FUNCTION(pcre)
-{
-#ifdef ZTS
- pcre_globals_id = ts_allocate_id(
- sizeof(php_pcre_globals),
- (ts_allocate_ctor) php_pcre_init_globals,
- (ts_allocate_dtor) php_pcre_shutdown_globals);
-#else
- zend_hash_init(&PCRE_G(pcre_cache), 0, NULL, php_free_pcre_cache, 1);
-#endif
-
- REGISTER_LONG_CONSTANT("PREG_PATTERN_ORDER", PREG_PATTERN_ORDER, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("PREG_SET_ORDER", PREG_SET_ORDER, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("PREG_SPLIT_NO_EMPTY", PREG_SPLIT_NO_EMPTY, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("PREG_SPLIT_DELIM_CAPTURE", PREG_SPLIT_DELIM_CAPTURE, CONST_CS | CONST_PERSISTENT);
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_MSHUTDOWN_FUNCTION(pcre) */
-static PHP_MSHUTDOWN_FUNCTION(pcre)
-{
-#ifndef ZTS
- zend_hash_destroy(&PCRE_G(pcre_cache));
-#else
- ts_free_id(pcre_globals_id);
-#endif
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_RINIT_FUNCTION(pcre) */
-static PHP_RINIT_FUNCTION(pcre)
-{
- pcre_malloc = php_pcre_malloc;
- pcre_free = php_pcre_free;
-
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ pcre_get_compiled_regex
- */
-static pcre* pcre_get_compiled_regex(char *regex, pcre_extra *extra, int *preg_options) {
- pcre *re = NULL;
- int coptions = 0;
- int soptions = 0;
- const char *error;
- int erroffset;
- char delimiter;
- char start_delimiter;
- char end_delimiter;
- char *p, *pp;
- char *pattern;
- int regex_len;
- int do_study = 0;
- int poptions = 0;
- unsigned const char *tables = NULL;
-#if HAVE_SETLOCALE
- char *locale = setlocale(LC_CTYPE, NULL);
-#endif
- pcre_cache_entry *pce;
- pcre_cache_entry new_entry;
- PCRE_LS_FETCH();
-
- /* Try to lookup the cached regex entry, and if successful, just pass
- back the compiled pattern, otherwise go on and compile it. */
- regex_len = strlen(regex);
- if (zend_hash_find(&PCRE_G(pcre_cache), regex, regex_len+1, (void **)&pce) == SUCCESS) {
-#if HAVE_SETLOCALE
- if (!strcmp(pce->locale, locale)) {
-#endif
- extra = pce->extra;
- *preg_options = pce->preg_options;
- return pce->re;
-#if HAVE_SETLOCALE
- }
-#endif
- }
-
- p = regex;
-
- /* Parse through the leading whitespace, and display a warning if we
- get to the end without encountering a delimiter. */
- while (isspace((int)*p)) p++;
- if (*p == 0) {
- zend_error(E_WARNING, "Empty regular expression");
- return NULL;
- }
-
- /* Get the delimiter and display a warning if it is alphanumeric
- or a backslash. */
- delimiter = *p++;
- if (isalnum((int)delimiter) || delimiter == '\\') {
- zend_error(E_WARNING, "Delimiter must not be alphanumeric or backslash");
- return NULL;
- }
-
- start_delimiter = delimiter;
- if ((pp = strchr("([{< )]}> )]}>", delimiter)))
- delimiter = pp[5];
- end_delimiter = delimiter;
-
- if (start_delimiter == end_delimiter) {
- /* We need to iterate through the pattern, searching for the ending delimiter,
- but skipping the backslashed delimiters. If the ending delimiter is not
- found, display a warning. */
- pp = p;
- while (*pp != 0) {
- if (*pp == '\\' && pp[1] != 0) pp++;
- else if (*pp == delimiter)
- break;
- pp++;
- }
- if (*pp == 0) {
- zend_error(E_WARNING, "No ending delimiter '%c' found", delimiter);
- return NULL;
- }
- } else {
- /* We iterate through the pattern, searching for the matching ending
- * delimiter. For each matching starting delimiter, we increment nesting
- * level, and decrement it for each matching ending delimiter. If we
- * reach the end of the pattern without matching, display a warning.
- */
- int brackets = 1; /* brackets nesting level */
- pp = p;
- while (*pp != 0) {
- if (*pp == '\\' && pp[1] != 0) pp++;
- else if (*pp == end_delimiter && --brackets <= 0)
- break;
- else if (*pp == start_delimiter)
- brackets++;
- pp++;
- }
- if (*pp == 0) {
- zend_error(E_WARNING, "No ending matching delimiter '%c' found", end_delimiter);
- return NULL;
- }
- }
-
- /* Make a copy of the actual pattern. */
- pattern = estrndup(p, pp-p);
-
- /* Move on to the options */
- pp++;
-
- /* Clear out preg options */
- *preg_options = 0;
-
- /* Parse through the options, setting appropriate flags. Display
- a warning if we encounter an unknown modifier. */
- while (*pp != 0) {
- switch (*pp++) {
- /* Perl compatible options */
- case 'i': coptions |= PCRE_CASELESS; break;
- case 'm': coptions |= PCRE_MULTILINE; break;
- case 's': coptions |= PCRE_DOTALL; break;
- case 'x': coptions |= PCRE_EXTENDED; break;
-
- /* PCRE specific options */
- case 'A': coptions |= PCRE_ANCHORED; break;
- case 'D': coptions |= PCRE_DOLLAR_ENDONLY;break;
- case 'S': do_study = 1; break;
- case 'U': coptions |= PCRE_UNGREEDY; break;
- case 'X': coptions |= PCRE_EXTRA; break;
-
- /* Custom preg options */
- case 'e': poptions |= PREG_REPLACE_EVAL; break;
-
- case ' ':
- case '\n':
- break;
-
- default:
- zend_error(E_WARNING, "Unknown modifier '%c'", pp[-1]);
- efree(pattern);
- return NULL;
- }
- }
-
-#if HAVE_SETLOCALE
- if (strcmp(locale, "C"))
- tables = pcre_maketables();
-#endif
-
- /* Compile pattern and display a warning if compilation failed. */
- re = pcre_compile(pattern,
- coptions,
- &error,
- &erroffset,
- tables);
-
- if (re == NULL) {
- zend_error(E_WARNING, "Compilation failed: %s at offset %d\n", error, erroffset);
- efree(pattern);
- return NULL;
- }
-
- /* If study option was specified, study the pattern and
- store the result in extra for passing to pcre_exec. */
- if (do_study) {
- extra = pcre_study(re, soptions, &error);
- if (error != NULL) {
- zend_error(E_WARNING, "Error while studying pattern");
- }
- }
-
- *preg_options = poptions;
-
- efree(pattern);
-
- /* Store the compiled pattern and extra info in the cache. */
- new_entry.re = re;
- new_entry.extra = extra;
- new_entry.preg_options = poptions;
-#if HAVE_SETLOCALE
- new_entry.locale = locale;
- new_entry.tables = tables;
-#endif
- zend_hash_update(&PCRE_G(pcre_cache), regex, regex_len+1, (void *)&new_entry,
- sizeof(pcre_cache_entry), NULL);
-
- return re;
-}
-/* }}} */
-
-/* {{{ php_pcre_match
- */
-static void php_pcre_match(INTERNAL_FUNCTION_PARAMETERS, int global)
-{
- zval **regex, /* Regular expression */
- **subject, /* String to match against */
- **subpats = NULL, /* Array for subpatterns */
- **subpats_order, /* Order of the results in the subpatterns
- array for global match */
- *result_set, /* Holds a set of subpatterns after
- a global match */
- **match_sets = NULL; /* An array of sets of matches for each
- subpattern after a global match */
- pcre *re = NULL; /* Compiled regular expression */
- pcre_extra *extra = NULL; /* Holds results of studying */
- int exoptions = 0; /* Execution options */
- int preg_options = 0; /* Custom preg options */
- int count = 0; /* Count of matched subpatterns */
- int *offsets; /* Array of subpattern offsets */
- int num_subpats; /* Number of captured subpatterns */
- int size_offsets; /* Size of the offsets array */
- int start_offset; /* Where the new search starts */
- int matched; /* Has anything matched */
- int i;
- int subpats_order_val = 0; /* Integer value of subpats_order */
- int g_notempty = 0; /* If the match should not be empty */
- const char **stringlist; /* Used to hold list of subpatterns */
- char *match; /* The current match */
-
-
- /* Get function parameters and do error-checking. */
- switch(ZEND_NUM_ARGS()) {
- case 2:
- if (global || zend_get_parameters_ex(2, &regex, &subject) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- break;
-
- case 3:
- if (zend_get_parameters_ex(3, &regex, &subject, &subpats) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- if (global)
- subpats_order_val = PREG_PATTERN_ORDER;
- if (!ParameterPassedByReference(ht, 3)) {
- zend_error(E_WARNING, "Array to be filled with matches must be passed by reference.");
- RETURN_FALSE;
- }
- break;
-
- case 4:
- if (zend_get_parameters_ex(4, &regex, &subject, &subpats, &subpats_order) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- if (!ParameterPassedByReference(ht, 3)) {
- zend_error(E_WARNING, "Array to be filled with matches must be passed by reference.");
- RETURN_FALSE;
- }
-
- /* Make sure subpats_order is a number */
- convert_to_long_ex(subpats_order);
- subpats_order_val = Z_LVAL_PP(subpats_order);
- if (subpats_order_val < PREG_PATTERN_ORDER ||
- subpats_order_val > PREG_SET_ORDER) {
- zend_error(E_WARNING, "Wrong value for parameter 4 in call to preg_match_all()");
- }
- break;
-
- default:
- WRONG_PARAM_COUNT;
- }
-
- /* Make sure we're dealing with strings. */
- convert_to_string_ex(regex);
- convert_to_string_ex(subject);
-
- /* Make sure to clean up the passed array and initialize it. */
- if (subpats != NULL) {
- zval_dtor(*subpats);
- array_init(*subpats);
- }
-
- /* Compile regex or get it from cache. */
- if ((re = pcre_get_compiled_regex(Z_STRVAL_PP(regex), extra, &preg_options)) == NULL) {
- RETURN_FALSE;
- }
-
- /* Calculate the size of the offsets array, and allocate memory for it. */
- num_subpats = pcre_info(re, NULL, NULL) + 1;
- size_offsets = num_subpats * 3;
- offsets = (int *)emalloc(size_offsets * sizeof(int));
-
- /* Allocate match sets array and initialize the values */
- if (global && subpats_order_val == PREG_PATTERN_ORDER) {
- match_sets = (zval **)emalloc(num_subpats * sizeof(zval *));
- for (i=0; i<num_subpats; i++) {
- ALLOC_ZVAL(match_sets[i]);
- array_init(match_sets[i]);
- INIT_PZVAL(match_sets[i]);
- }
- }
-
- /* Start from the beginning of the string */
- start_offset = 0;
- match = NULL;
- matched = 0;
-
- do {
- /* Execute the regular expression. */
- count = pcre_exec(re, extra, Z_STRVAL_PP(subject),
- Z_STRLEN_PP(subject), start_offset,
- exoptions|g_notempty, offsets, size_offsets);
-
- /* Check for too many substrings condition. */
- if (count == 0) {
- zend_error(E_NOTICE, "Matched, but too many substrings\n");
- count = size_offsets/3;
- }
-
- /* If something has matched */
- if (count >= 0) {
- matched++;
- match = Z_STRVAL_PP(subject) + offsets[0];
-
- /* If subpatterns array has been passed, fill it in with values. */
- if (subpats != NULL) {
- /* Try to get the list of substrings and display a warning if failed. */
- if (pcre_get_substring_list(Z_STRVAL_PP(subject),
- offsets, count, &stringlist) < 0) {
- efree(offsets);
- efree(re);
- zend_error(E_WARNING, "Get subpatterns list failed");
- return;
- }
-
- if (global) { /* global pattern matching */
- if (subpats_order_val == PREG_PATTERN_ORDER) {
- /* For each subpattern, insert it into the appropriate array */
- for (i=0; i<count; i++) {
- add_next_index_string(match_sets[i], (char *)stringlist[i], 1);
- }
- }
- else {
- /* Allocate the result set array */
- ALLOC_ZVAL(result_set);
- array_init(result_set);
- INIT_PZVAL(result_set);
-
- /* Add all the subpatterns to it */
- for (i=0; i<count; i++) {
- add_next_index_string(result_set, (char *)stringlist[i], 1);
- }
- /* And add it to the output array */
- zend_hash_next_index_insert(Z_ARRVAL_PP(subpats), &result_set,
- sizeof(zval *), NULL);
- }
- }
- else { /* single pattern matching */
- /* For each subpattern, insert it into the subpatterns array. */
- for (i=0; i<count; i++) {
- add_next_index_string((*subpats), (char *)stringlist[i], 1);
- }
- }
-
- php_pcre_free((void *) stringlist);
- }
- }
- else { /* Failed to match */
- /* If we previously set PCRE_NOTEMPTY after a null match,
- this is not necessarily the end. We need to advance
- the start offset, and continue. Fudge the offset values
- to achieve this, unless we're already at the end of the string. */
- if (g_notempty != 0 && start_offset < Z_STRLEN_PP(subject)) {
- offsets[0] = start_offset;
- offsets[1] = start_offset + 1;
- } else
- break;
- }
-
- /* If we have matched an empty string, mimic what Perl's /g options does.
- This turns out to be rather cunning. First we set PCRE_NOTEMPTY and try
- the match again at the same point. If this fails (picked up above) we
- advance to the next character. */
- g_notempty = (offsets[1] == offsets[0])? PCRE_NOTEMPTY | PCRE_ANCHORED : 0;
-
- /* Advance to the position right after the last full match */
- start_offset = offsets[1];
- } while (global);
-
- /* Add the match sets to the output array and clean up */
- if (global && subpats_order_val == PREG_PATTERN_ORDER) {
- for (i=0; i<num_subpats; i++) {
- zend_hash_next_index_insert(Z_ARRVAL_PP(subpats), &match_sets[i], sizeof(zval *), NULL);
- }
- efree(match_sets);
- }
-
- efree(offsets);
-
- RETVAL_LONG(matched);
-}
-/* }}} */
-
-/* {{{ proto int preg_match(string pattern, string subject [, array subpatterns])
- Perform a Perl-style regular expression match */
-PHP_FUNCTION(preg_match)
-{
- php_pcre_match(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-/* }}} */
-
-/* {{{ proto int preg_match_all(string pattern, string subject, array subpatterns [, int order])
- Perform a Perl-style global regular expression match */
-PHP_FUNCTION(preg_match_all)
-{
- php_pcre_match(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
-}
-/* }}} */
-
-/* {{{ preg_get_backref
- */
-static inline int preg_get_backref(const char *walk, int *backref)
-{
- if (*walk && *walk >= '0' && *walk <= '9')
- *backref = *walk - '0';
- else
- return 0;
-
- if (walk[1] && walk[1] >= '0' && walk[1] <= '9')
- *backref = *backref * 10 + walk[1] - '0';
-
- return 1;
-}
-/* }}} */
-
-/* {{{ preg_do_repl_func
- */
-static int preg_do_repl_func(zval *function, char *subject, int *offsets, int count, char **result)
-{
- zval *retval_ptr; /* Function return value */
- zval **args[1]; /* Argument to pass to function */
- zval *subpats; /* Captured subpatterns */
- int result_len; /* Return value length */
- int i;
- ELS_FETCH();
-
- MAKE_STD_ZVAL(subpats);
- array_init(subpats);
- for (i = 0; i < count; i++)
- add_next_index_stringl(subpats, &subject[offsets[i<<1]], offsets[(i<<1)+1] - offsets[i<<1], 1);
- args[0] = &subpats;
-
- if (call_user_function_ex(EG(function_table), NULL, function, &retval_ptr, 1, args, 0, NULL) == SUCCESS && retval_ptr) {
- convert_to_string_ex(&retval_ptr);
- *result = estrndup(Z_STRVAL_P(retval_ptr), Z_STRLEN_P(retval_ptr));
- result_len = Z_STRLEN_P(retval_ptr);
- zval_ptr_dtor(&retval_ptr);
- } else {
- php_error(E_WARNING, "Unable to call custom replacement function");
- result_len = offsets[1] - offsets[0];
- *result = estrndup(&subject[offsets[0]], result_len);
- }
- zval_dtor(subpats);
- FREE_ZVAL(subpats);
-
- return result_len;
-}
-/* }}} */
-
-/* {{{ preg_do_eval
- */
-static int preg_do_eval(char *eval_str, int eval_str_len, char *subject,
- int *offsets, int count, char **result)
-{
- zval retval; /* Return value from evaluation */
- char *eval_str_end, /* End of eval string */
- *match, /* Current match for a backref */
- *esc_match, /* Quote-escaped match */
- *walk, /* Used to walk the code string */
- *segment, /* Start of segment to append while walking */
- walk_last; /* Last walked character */
- int match_len; /* Length of the match */
- int esc_match_len; /* Length of the quote-escaped match */
- int result_len; /* Length of the result of the evaluation */
- int backref; /* Current backref */
- char *compiled_string_description;
- smart_str code = {0};
- CLS_FETCH();
- ELS_FETCH();
-
- eval_str_end = eval_str + eval_str_len;
- walk = segment = eval_str;
- walk_last = 0;
-
- while (walk < eval_str_end) {
- /* If found a backreference.. */
- if ('\\' == *walk || '$' == *walk) {
- smart_str_appendl(&code, segment, walk - segment);
- if (walk_last == '\\') {
- code.c[code.len-1] = *walk++;
- segment = walk;
- walk_last = 0;
- continue;
- }
- segment = walk;
- if (preg_get_backref(walk+1, &backref)) {
- if (backref < count) {
- /* Find the corresponding string match and substitute it
- in instead of the backref */
- match = subject + offsets[backref<<1];
- match_len = offsets[(backref<<1)+1] - offsets[backref<<1];
- if (match_len)
- esc_match = php_addslashes(match, match_len, &esc_match_len, 0);
- else {
- esc_match = match;
- esc_match_len = 0;
- }
- } else {
- esc_match = empty_string;
- esc_match_len = 0;
- match_len = 0;
- }
- smart_str_appendl(&code, esc_match, esc_match_len);
-
- /* Adjust the walk pointer */
- walk += (backref > 9 ? 3 : 2);
- segment = walk;
-
- /* Clean up and reassign */
- if (esc_match_len)
- efree(esc_match);
- continue;
- }
- }
- walk++;
- walk_last = walk[-1];
- }
- smart_str_appendl(&code, segment, walk - segment);
- smart_str_0(&code);
-
- compiled_string_description = zend_make_compiled_string_description("regexp code");
- /* Run the code */
- if (zend_eval_string(code.c, &retval, compiled_string_description CLS_CC ELS_CC) == FAILURE) {
- efree(compiled_string_description);
- zend_error(E_ERROR, "Failed evaluating code:\n%s\n", code);
- /* zend_error() does not return in this case */
- }
- efree(compiled_string_description);
- convert_to_string(&retval);
-
- /* Save the return value and its length */
- *result = estrndup(Z_STRVAL(retval), Z_STRLEN(retval));
- result_len = Z_STRLEN(retval);
-
- /* Clean up */
- zval_dtor(&retval);
- smart_str_free(&code);
-
- return result_len;
-}
-/* }}} */
-
-/* {{{ php_pcre_replace
- */
-char *php_pcre_replace(char *regex, int regex_len,
- char *subject, int subject_len,
- zval *replace_val, int is_callable_replace,
- int *result_len, int limit)
-{
- pcre *re = NULL; /* Compiled regular expression */
- pcre_extra *extra = NULL; /* Holds results of studying */
- int exoptions = 0; /* Execution options */
- int preg_options = 0; /* Custom preg options */
- int count = 0; /* Count of matched subpatterns */
- int *offsets; /* Array of subpattern offsets */
- int size_offsets; /* Size of the offsets array */
- int new_len; /* Length of needed storage */
- int alloc_len; /* Actual allocated length */
- int eval_result_len=0; /* Length of the eval'ed or
- function-returned string */
- int match_len; /* Length of the current match */
- int backref; /* Backreference number */
- int eval; /* If the replacement string should be eval'ed */
- int start_offset; /* Where the new search starts */
- int g_notempty = 0; /* If the match should not be empty */
- int replace_len; /* Length of replacement string */
- char *result, /* Result of replacement */
- *replace, /* Replacement string */
- *new_buf, /* Temporary buffer for re-allocation */
- *walkbuf, /* Location of current replacement in the result */
- *walk, /* Used to walk the replacement string */
- *match, /* The current match */
- *piece, /* The current piece of subject */
- *replace_end, /* End of replacement string */
- *eval_result, /* Result of eval or custom function */
- walk_last; /* Last walked character */
-
- /* Compile regex or get it from cache. */
- if ((re = pcre_get_compiled_regex(regex, extra, &preg_options)) == NULL) {
- return NULL;
- }
-
- eval = preg_options & PREG_REPLACE_EVAL;
- if (is_callable_replace) {
- if (eval) {
- php_error(E_WARNING, "/e modifier cannot be used with replacement callback");
- return NULL;
- }
- } else {
- convert_to_string(replace_val);
- replace = Z_STRVAL_P(replace_val);
- replace_len = Z_STRLEN_P(replace_val);
- replace_end = replace + replace_len;
- }
-
- /* Calculate the size of the offsets array, and allocate memory for it. */
- size_offsets = (pcre_info(re, NULL, NULL) + 1) * 3;
- offsets = (int *)emalloc(size_offsets * sizeof(int));
-
- alloc_len = 2 * subject_len + 1;
- result = emalloc(alloc_len * sizeof(char));
-
- /* Initialize */
- match = NULL;
- *result_len = 0;
- start_offset = 0;
-
- while (1) {
- /* Execute the regular expression. */
- count = pcre_exec(re, extra, subject, subject_len, start_offset,
- exoptions|g_notempty, offsets, size_offsets);
-
- /* Check for too many substrings condition. */
- if (count == 0) {
- zend_error(E_NOTICE, "Matched, but too many substrings\n");
- count = size_offsets/3;
- }
-
- piece = subject + start_offset;
-
- if (count > 0 && (limit == -1 || limit > 0)) {
- /* Set the match location in subject */
- match = subject + offsets[0];
-
- new_len = *result_len + offsets[0] - start_offset; /* part before the match */
-
- /* If evaluating, do it and add the return string's length */
- if (eval) {
- eval_result_len = preg_do_eval(replace, replace_len, subject,
- offsets, count, &eval_result);
- new_len += eval_result_len;
- } else if (is_callable_replace) {
- /* Use custom function to get replacement string and its length. */
- eval_result_len = preg_do_repl_func(replace_val, subject, offsets,
- count, &eval_result);
- new_len += eval_result_len;
- } else { /* do regular substitution */
- walk = replace;
- walk_last = 0;
- while (walk < replace_end) {
- if ('\\' == *walk || '$' == *walk) {
- if (walk_last == '\\') {
- walk++;
- walk_last = 0;
- continue;
- }
- if (preg_get_backref(walk+1, &backref)) {
- if (backref < count)
- new_len += offsets[(backref<<1)+1] - offsets[backref<<1];
- walk += (backref > 9) ? 3 : 2;
- continue;
- }
- }
- new_len++;
- walk++;
- walk_last = walk[-1];
- }
- }
-
- if (new_len + 1 > alloc_len) {
- alloc_len = 1 + alloc_len + 2 * new_len;
- new_buf = emalloc(alloc_len);
- memcpy(new_buf, result, *result_len);
- efree(result);
- result = new_buf;
- }
- /* copy the part of the string before the match */
- memcpy(&result[*result_len], piece, match-piece);
- *result_len += match-piece;
-
- /* copy replacement and backrefs */
- walkbuf = result + *result_len;
-
- /* If evaluating or using custom function, copy result to the buffer
- * and clean up. */
- if (eval || is_callable_replace) {
- memcpy(walkbuf, eval_result, eval_result_len);
- *result_len += eval_result_len;
- STR_FREE(eval_result);
- } else { /* do regular backreference copying */
- walk = replace;
- walk_last = 0;
- while (walk < replace_end) {
- if ('\\' == *walk || '$' == *walk) {
- if (walk_last == '\\') {
- *(walkbuf-1) = *walk++;
- walk_last = 0;
- continue;
- }
- if (preg_get_backref(walk+1, &backref)) {
- if (backref < count) {
- match_len = offsets[(backref<<1)+1] - offsets[backref<<1];
- memcpy(walkbuf, subject + offsets[backref<<1], match_len);
- walkbuf += match_len;
- }
- walk += (backref > 9) ? 3 : 2;
- continue;
- }
- }
- *walkbuf++ = *walk++;
- walk_last = walk[-1];
- }
- *walkbuf = '\0';
- /* increment the result length by how much we've added to the string */
- *result_len += walkbuf - (result + *result_len);
- }
-
- if (limit != -1)
- limit--;
-
- } else { /* Failed to match */
- /* If we previously set PCRE_NOTEMPTY after a null match,
- this is not necessarily the end. We need to advance
- the start offset, and continue. Fudge the offset values
- to achieve this, unless we're already at the end of the string. */
- if (g_notempty != 0 && start_offset < subject_len) {
- offsets[0] = start_offset;
- offsets[1] = start_offset + 1;
- memcpy(&result[*result_len], piece, 1);
- (*result_len)++;
- } else {
- new_len = *result_len + subject_len - start_offset;
- if (new_len + 1 > alloc_len) {
- alloc_len = new_len + 1; /* now we know exactly how long it is */
- new_buf = emalloc(alloc_len * sizeof(char));
- memcpy(new_buf, result, *result_len);
- efree(result);
- result = new_buf;
- }
- /* stick that last bit of string on our output */
- memcpy(&result[*result_len], piece, subject_len - start_offset);
- *result_len += subject_len - start_offset;
- result[*result_len] = '\0';
- break;
- }
- }
-
- /* If we have matched an empty string, mimic what Perl's /g options does.
- This turns out to be rather cunning. First we set PCRE_NOTEMPTY and try
- the match again at the same point. If this fails (picked up above) we
- advance to the next character. */
- g_notempty = (offsets[1] == offsets[0])? PCRE_NOTEMPTY | PCRE_ANCHORED : 0;
-
- /* Advance to the next piece. */
- start_offset = offsets[1];
- }
-
- efree(offsets);
-
- return result;
-}
-/* }}} */
-
-/* {{{ php_replace_in_subject
- */
-static char *php_replace_in_subject(zval *regex, zval *replace, zval **subject, int *result_len, int limit, zend_bool is_callable_replace)
-{
- zval **regex_entry,
- **replace_entry = NULL,
- *replace_value,
- empty_replace;
- char *subject_value,
- *result;
- int subject_len;
-
- /* Make sure we're dealing with strings. */
- convert_to_string_ex(subject);
- ZVAL_STRINGL(&empty_replace, empty_string, 0, 0);
-
- /* If regex is an array */
- if (Z_TYPE_P(regex) == IS_ARRAY) {
- /* Duplicate subject string for repeated replacement */
- subject_value = estrndup(Z_STRVAL_PP(subject), Z_STRLEN_PP(subject));
- subject_len = Z_STRLEN_PP(subject);
- *result_len = subject_len;
-
- zend_hash_internal_pointer_reset(Z_ARRVAL_P(regex));
-
- replace_value = replace;
- if (Z_TYPE_P(replace) == IS_ARRAY && !is_callable_replace)
- zend_hash_internal_pointer_reset(Z_ARRVAL_P(replace));
-
- /* For each entry in the regex array, get the entry */
- while (zend_hash_get_current_data(Z_ARRVAL_P(regex), (void **)&regex_entry) == SUCCESS) {
- /* Make sure we're dealing with strings. */
- convert_to_string_ex(regex_entry);
-
- /* If replace is an array and not a callable construct */
- if (Z_TYPE_P(replace) == IS_ARRAY && !is_callable_replace) {
- /* Get current entry */
- if (zend_hash_get_current_data(Z_ARRVAL_P(replace), (void **)&replace_entry) == SUCCESS) {
- replace_value = *replace_entry;
- zend_hash_move_forward(Z_ARRVAL_P(replace));
- } else {
- /* We've run out of replacement strings, so use an empty one */
- replace_value = &empty_replace;
- }
- }
-
- /* Do the actual replacement and put the result back into subject_value
- for further replacements. */
- if ((result = php_pcre_replace(Z_STRVAL_PP(regex_entry),
- Z_STRLEN_PP(regex_entry),
- subject_value,
- subject_len,
- replace_value,
- is_callable_replace,
- result_len,
- limit)) != NULL) {
- efree(subject_value);
- subject_value = result;
- subject_len = *result_len;
- }
-
- zend_hash_move_forward(Z_ARRVAL_P(regex));
- }
-
- return subject_value;
- } else {
- result = php_pcre_replace(Z_STRVAL_P(regex),
- Z_STRLEN_P(regex),
- Z_STRVAL_PP(subject),
- Z_STRLEN_PP(subject),
- replace,
- is_callable_replace,
- result_len,
- limit);
- return result;
- }
-}
-/* }}} */
-
-/* {{{ preg_replace_impl
- */
-static void preg_replace_impl(INTERNAL_FUNCTION_PARAMETERS, zend_bool is_callable_replace)
-{
- zval **regex,
- **replace,
- **subject,
- **limit,
- **subject_entry;
- char *result;
- int result_len;
- int limit_val = -1;
- char *string_key;
- ulong num_key;
- char *callback_name = NULL;
-
- /* Get function parameters and do error-checking. */
- if (ZEND_NUM_ARGS() < 3 || ZEND_NUM_ARGS() > 4 ||
- zend_get_parameters_ex(ZEND_NUM_ARGS(), &regex, &replace, &subject, &limit) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- SEPARATE_ZVAL(replace);
- if (Z_TYPE_PP(replace) != IS_ARRAY)
- convert_to_string_ex(replace);
- if (is_callable_replace) {
- if (!zend_is_callable(*replace, 0, &callback_name)) {
- php_error(E_WARNING, "%s() requires argument 2, '%s', to be a valid callback",
- get_active_function_name(), callback_name);
- efree(callback_name);
- *return_value = **subject;
- zval_copy_ctor(return_value);
- return;
- }
- efree(callback_name);
- }
-
- SEPARATE_ZVAL(regex);
- SEPARATE_ZVAL(subject);
-
- if (ZEND_NUM_ARGS() > 3) {
- convert_to_long_ex(limit);
- limit_val = Z_LVAL_PP(limit);
- }
-
- if (Z_TYPE_PP(regex) != IS_ARRAY)
- convert_to_string_ex(regex);
-
- /* if subject is an array */
- if (Z_TYPE_PP(subject) == IS_ARRAY) {
- array_init(return_value);
- zend_hash_internal_pointer_reset(Z_ARRVAL_PP(subject));
-
- /* For each subject entry, convert it to string, then perform replacement
- and add the result to the return_value array. */
- while (zend_hash_get_current_data(Z_ARRVAL_PP(subject), (void **)&subject_entry) == SUCCESS) {
- if ((result = php_replace_in_subject(*regex, *replace, subject_entry, &result_len, limit_val, is_callable_replace)) != NULL) {
- /* Add to return array */
- switch(zend_hash_get_current_key(Z_ARRVAL_PP(subject), &string_key, &num_key, 0))
- {
- case HASH_KEY_IS_STRING:
- add_assoc_stringl(return_value, string_key, result, result_len, 0);
- break;
-
- case HASH_KEY_IS_LONG:
- add_index_stringl(return_value, num_key, result, result_len, 0);
- break;
- }
- }
-
- zend_hash_move_forward(Z_ARRVAL_PP(subject));
- }
- }
- else { /* if subject is not an array */
- if ((result = php_replace_in_subject(*regex, *replace, subject, &result_len, limit_val, is_callable_replace)) != NULL) {
- RETVAL_STRINGL(result, result_len, 0);
- }
- }
-}
-/* }}} */
-
-/* {{{ proto string preg_replace(mixed regex, mixed replace, mixed subject [, int limit])
- Perform Perl-style regular expression replacement. */
-PHP_FUNCTION(preg_replace)
-{
- preg_replace_impl(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-/* }}} */
-
-/* {{{ proto string preg_replace_callback(mixed regex, mixed callback, mixed subject [, int limit])
- Perform Perl-style regular expression replacement using replacement callback. */
-PHP_FUNCTION(preg_replace_callback)
-{
- preg_replace_impl(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
-}
-/* }}} */
-
-/* {{{ proto array preg_split(string pattern, string subject [, int limit [, int flags]])
- Split string into an array using a perl-style regular expression as a delimiter */
-PHP_FUNCTION(preg_split)
-{
- zval **regex, /* Regular expression to split by */
- **subject, /* Subject string to split */
- **limit, /* Number of pieces to return */
- **flags;
- pcre *re = NULL; /* Compiled regular expression */
- pcre_extra *extra = NULL; /* Holds results of studying */
- int *offsets; /* Array of subpattern offsets */
- int size_offsets; /* Size of the offsets array */
- int exoptions = 0; /* Execution options */
- int preg_options = 0; /* Custom preg options */
- int argc; /* Argument count */
- int limit_val = -1; /* Integer value of limit */
- int no_empty = 0; /* If NO_EMPTY flag is set */
- int delim_capture = 0; /* If delimiters should be captured */
- int count = 0; /* Count of matched subpatterns */
- int start_offset; /* Where the new search starts */
- int g_notempty = 0; /* If the match should not be empty */
- char *match, /* The current match */
- *last_match; /* Location of last match */
-
- /* Get function parameters and do error checking */
- argc = ZEND_NUM_ARGS();
- if (argc < 2 || argc > 4 || zend_get_parameters_ex(argc, &regex, &subject, &limit, &flags) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if (argc > 2) {
- convert_to_long_ex(limit);
- limit_val = Z_LVAL_PP(limit);
- if (limit_val == 0)
- limit_val = -1;
-
- if (argc > 3) {
- convert_to_long_ex(flags);
- no_empty = Z_LVAL_PP(flags) & PREG_SPLIT_NO_EMPTY;
- delim_capture = Z_LVAL_PP(flags) & PREG_SPLIT_DELIM_CAPTURE;
- }
- }
-
- /* Make sure we're dealing with strings */
- convert_to_string_ex(regex);
- convert_to_string_ex(subject);
-
- /* Compile regex or get it from cache. */
- if ((re = pcre_get_compiled_regex(Z_STRVAL_PP(regex), extra, &preg_options)) == NULL) {
- RETURN_FALSE;
- }
-
- /* Initialize return value */
- array_init(return_value);
-
- /* Calculate the size of the offsets array, and allocate memory for it. */
- size_offsets = (pcre_info(re, NULL, NULL) + 1) * 3;
- offsets = (int *)emalloc(size_offsets * sizeof(int));
-
- /* Start at the beginning of the string */
- start_offset = 0;
- last_match = Z_STRVAL_PP(subject);
- match = NULL;
-
- /* Get next piece if no limit or limit not yet reached and something matched*/
- while ((limit_val == -1 || limit_val > 1)) {
- count = pcre_exec(re, extra, Z_STRVAL_PP(subject),
- Z_STRLEN_PP(subject), start_offset,
- exoptions|g_notempty, offsets, size_offsets);
-
- /* Check for too many substrings condition. */
- if (count == 0) {
- zend_error(E_NOTICE, "Matched, but too many substrings\n");
- count = size_offsets/3;
- }
-
- /* If something matched */
- if (count > 0) {
- match = Z_STRVAL_PP(subject) + offsets[0];
-
- if (!no_empty || &Z_STRVAL_PP(subject)[offsets[0]] != last_match) {
- /* Add the piece to the return value */
- add_next_index_stringl(return_value, last_match,
- &Z_STRVAL_PP(subject)[offsets[0]]-last_match, 1);
-
- /* One less left to do */
- if (limit_val != -1)
- limit_val--;
- }
-
- last_match = &Z_STRVAL_PP(subject)[offsets[1]];
-
- if (delim_capture) {
- int i, match_len;
- for (i = 1; i < count; i++) {
- match_len = offsets[(i<<1)+1] - offsets[i<<1];
- if (!no_empty || match_len > 0)
- add_next_index_stringl(return_value,
- &Z_STRVAL_PP(subject)[offsets[i<<1]],
- match_len, 1);
- }
- }
- } else { /* Failed to match */
- /* If we previously set PCRE_NOTEMPTY after a null match,
- this is not necessarily the end. We need to advance
- the start offset, and continue. Fudge the offset values
- to achieve this, unless we're already at the end of the string. */
- if (g_notempty != 0 && start_offset < Z_STRLEN_PP(subject)) {
- offsets[0] = start_offset;
- offsets[1] = start_offset + 1;
- } else
- break;
- }
-
- /* If we have matched an empty string, mimic what Perl's /g options does.
- This turns out to be rather cunning. First we set PCRE_NOTEMPTY and try
- the match again at the same point. If this fails (picked up above) we
- advance to the next character. */
- g_notempty = (offsets[1] == offsets[0])? PCRE_NOTEMPTY | PCRE_ANCHORED : 0;
-
- /* Advance to the position right after the last full match */
- start_offset = offsets[1];
- }
-
- if (!no_empty || start_offset != Z_STRLEN_PP(subject))
- /* Add the last piece to the return value */
- add_next_index_string(return_value,
- &Z_STRVAL_PP(subject)[start_offset], 1);
-
- /* Clean up */
- efree(offsets);
-}
-/* }}} */
-
-/* {{{ proto string preg_quote(string str, string delim_char)
- Quote regular expression characters plus an optional character */
-PHP_FUNCTION(preg_quote)
-{
- zval **in_str_arg; /* Input string argument */
- zval **delim; /* Additional delimiter argument */
- char *in_str, /* Input string */
- *in_str_end, /* End of the input string */
- *out_str, /* Output string with quoted characters */
- *p, /* Iterator for input string */
- *q, /* Iterator for output string */
- delim_char=0, /* Delimiter character to be quoted */
- c; /* Current character */
- zend_bool quote_delim = 0; /* Whether to quote additional delim char */
-
- /* Get the arguments and check for errors */
- if (ZEND_NUM_ARGS() < 1 || ZEND_NUM_ARGS() > 2 ||
- zend_get_parameters_ex(ZEND_NUM_ARGS(), &in_str_arg, &delim) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- /* Make sure we're working with strings */
- convert_to_string_ex(in_str_arg);
- in_str = Z_STRVAL_PP(in_str_arg);
- in_str_end = Z_STRVAL_PP(in_str_arg) + Z_STRLEN_PP(in_str_arg);
-
- /* Nothing to do if we got an empty string */
- if (in_str == in_str_end) {
- RETVAL_STRINGL(empty_string, 0, 0);
- }
-
- if (ZEND_NUM_ARGS() == 2) {
- convert_to_string_ex(delim);
- if (Z_STRLEN_PP(delim) > 0) {
- delim_char = Z_STRVAL_PP(delim)[0];
- quote_delim = 1;
- }
- }
-
- /* Allocate enough memory so that even if each character
- is quoted, we won't run out of room */
- out_str = emalloc(2 * Z_STRLEN_PP(in_str_arg) + 1);
-
- /* Go through the string and quote necessary characters */
- for(p = in_str, q = out_str; p != in_str_end; p++) {
- c = *p;
- switch(c) {
- case '.':
- case '\\':
- case '+':
- case '*':
- case '?':
- case '[':
- case '^':
- case ']':
- case '$':
- case '(':
- case ')':
- case '{':
- case '}':
- case '=':
- case '!':
- case '>':
- case '<':
- case '|':
- case ':':
- *q++ = '\\';
- *q++ = c;
- break;
-
- default:
- if (quote_delim && c == delim_char)
- *q++ = '\\';
- *q++ = c;
- break;
- }
- }
- *q = '\0';
-
- /* Reallocate string and return it */
- RETVAL_STRINGL(erealloc(out_str, q - out_str + 1), q - out_str, 0);
-}
-/* }}} */
-
-/* {{{ proto array preg_grep(string regex, array input)
- Searches array and returns entries which match regex */
-PHP_FUNCTION(preg_grep)
-{
- zval **regex, /* Regular expression */
- **input, /* Input array */
- **entry; /* An entry in the input array */
- pcre *re = NULL; /* Compiled regular expression */
- pcre_extra *extra = NULL; /* Holds results of studying */
- int preg_options = 0; /* Custom preg options */
- int *offsets; /* Array of subpattern offsets */
- int size_offsets; /* Size of the offsets array */
- int count = 0; /* Count of matched subpatterns */
- char *string_key;
- ulong num_key;
-
- /* Get arguments and do error checking */
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(ZEND_NUM_ARGS(), &regex, &input) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if (Z_TYPE_PP(input) != IS_ARRAY) {
- zend_error(E_WARNING, "Secong argument to preg_grep() should be an array");
- return;
- }
-
- SEPARATE_ZVAL(input);
-
- /* Make sure regex is a string */
- convert_to_string_ex(regex);
-
- /* Compile regex or get it from cache. */
- if ((re = pcre_get_compiled_regex(Z_STRVAL_PP(regex), extra, &preg_options)) == NULL) {
- RETURN_FALSE;
- }
-
- /* Calculate the size of the offsets array, and allocate memory for it. */
- size_offsets = (pcre_info(re, NULL, NULL) + 1) * 3;
- offsets = (int *)emalloc(size_offsets * sizeof(int));
-
- /* Initialize return array */
- array_init(return_value);
-
- /* Go through the input array */
- zend_hash_internal_pointer_reset(Z_ARRVAL_PP(input));
- while(zend_hash_get_current_data(Z_ARRVAL_PP(input), (void **)&entry) == SUCCESS) {
-
- convert_to_string_ex(entry);
-
- /* Perform the match */
- count = pcre_exec(re, extra, Z_STRVAL_PP(entry),
- Z_STRLEN_PP(entry), 0,
- 0, offsets, size_offsets);
-
- /* Check for too many substrings condition. */
- if (count == 0) {
- zend_error(E_NOTICE, "Matched, but too many substrings\n");
- count = size_offsets/3;
- }
-
- /* If something matched */
- if (count > 0) {
- (*entry)->refcount++;
-
- /* Add to return array */
- switch(zend_hash_get_current_key(Z_ARRVAL_PP(input), &string_key, &num_key, 0))
- {
- case HASH_KEY_IS_STRING:
- zend_hash_update(Z_ARRVAL_P(return_value), string_key,
- strlen(string_key)+1, entry, sizeof(zval *), NULL);
- break;
-
- case HASH_KEY_IS_LONG:
- zend_hash_index_update(Z_ARRVAL_P(return_value), num_key, entry,
- sizeof(zval *), NULL);
- break;
- }
- }
-
- zend_hash_move_forward(Z_ARRVAL_PP(input));
- }
-
- /* Clean up */
- efree(offsets);
-}
-/* }}} */
-
-/* {{{ module definition structures */
-
-unsigned char third_arg_force_ref[] = { 3, BYREF_NONE, BYREF_NONE, BYREF_FORCE };
-
-function_entry pcre_functions[] = {
- PHP_FE(preg_match, third_arg_force_ref)
- PHP_FE(preg_match_all, third_arg_force_ref)
- PHP_FE(preg_replace, NULL)
- PHP_FE(preg_replace_callback, NULL)
- PHP_FE(preg_split, NULL)
- PHP_FE(preg_quote, NULL)
- PHP_FE(preg_grep, NULL)
- {NULL, NULL, NULL}
-};
-
-zend_module_entry pcre_module_entry = {
- "pcre", pcre_functions,
- PHP_MINIT(pcre),
- PHP_MSHUTDOWN(pcre),
- PHP_RINIT(pcre),
- NULL,
- PHP_MINFO(pcre),
- STANDARD_MODULE_PROPERTIES
-};
-
-#ifdef COMPILE_DL_PCRE
-ZEND_GET_MODULE(pcre)
-#endif
-
-/* }}} */
-
-#endif /* HAVE_PCRE || HAVE_BUNDLED_PCRE */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/pcre/php_pcre.h b/ext/pcre/php_pcre.h
deleted file mode 100644
index 0d00d09854..0000000000
--- a/ext/pcre/php_pcre.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andrei Zmievski <andrei@ispi.net> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifndef PHP_PCRE_H
-#define PHP_PCRE_H
-
-#if HAVE_PCRE || HAVE_BUNDLED_PCRE
-
-#if HAVE_BUNDLED_PCRE
-#include "pcrelib/pcre.h"
-#else
-#include "pcre.h"
-#endif
-
-#if HAVE_LOCALE_H
-#include <locale.h>
-#endif
-
-PHP_FUNCTION(preg_match);
-PHP_FUNCTION(preg_match_all);
-PHP_FUNCTION(preg_replace);
-PHP_FUNCTION(preg_replace_callback);
-PHP_FUNCTION(preg_split);
-PHP_FUNCTION(preg_quote);
-PHP_FUNCTION(preg_grep);
-
-extern zend_module_entry pcre_module_entry;
-#define pcre_module_ptr &pcre_module_entry
-
-typedef struct {
- pcre *re;
- pcre_extra *extra;
- int preg_options;
-#if HAVE_SETLOCALE
- char *locale;
- unsigned const char *tables;
-#endif
-} pcre_cache_entry;
-
-typedef struct {
- HashTable pcre_cache;
-} php_pcre_globals;
-
-#ifdef ZTS
-# define PCRE_LS_D php_pcre_globals *pcre_globals
-# define PCRE_LS_DC , PCRE_LS_D
-# define PCRE_LS_C pcre_globals
-# define PCRE_LS_CC , PCRE_LS_C
-# define PCRE_G(v) (pcre_globals->v)
-# define PCRE_LS_FETCH() php_pcre_globals *pcre_globals = ts_resource(pcre_globals_id);
-#else
-# define PCRE_LS_D
-# define PCRE_LS_DC
-# define PCRE_LS_C
-# define PCRE_LS_CC
-# define PCRE_G(v) (pcre_globals.v)
-# define PCRE_LS_FETCH()
-extern ZEND_API php_pcre_globals pcre_globals;
-#endif
-
-#else
-
-#define pcre_module_ptr NULL
-
-#endif /* HAVE_PCRE || HAVE_BUNDLED_PCRE */
-
-#define phpext_pcre_ptr pcre_module_ptr
-
-#endif /* PHP_PCRE_H */
diff --git a/ext/pcre/setup.stub b/ext/pcre/setup.stub
deleted file mode 100644
index 67d4fd7a1c..0000000000
--- a/ext/pcre/setup.stub
+++ /dev/null
@@ -1,6 +0,0 @@
-# $Source$
-# $Id$
-
-define_option with-pcre-regex 'pcre support?' yesnodir no \
-' Whether to build the pcre extension.'
-
diff --git a/ext/pdf/CREDITS b/ext/pdf/CREDITS
deleted file mode 100644
index 1a5867bb9f..0000000000
--- a/ext/pdf/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-PDF
-Uwe Steinmann
diff --git a/ext/pdf/Makefile.in b/ext/pdf/Makefile.in
deleted file mode 100644
index 6e05e279b2..0000000000
--- a/ext/pdf/Makefile.in
+++ /dev/null
@@ -1,8 +0,0 @@
-
-LTLIBRARY_NAME = libpdf.la
-LTLIBRARY_SOURCES = pdf.c
-LTLIBRARY_SHARED_NAME = libpdf_php.la
-PDFLIB_SHARED_LIBBADD = -lpdf
-LTLIBRARY_SHARED_LIBADD = $(PDFLIB_SHARED_LIBBADD)
-
-include $(top_srcdir)/build/dynlib.mk
diff --git a/ext/pdf/config.m4 b/ext/pdf/config.m4
deleted file mode 100644
index 9936bff519..0000000000
--- a/ext/pdf/config.m4
+++ /dev/null
@@ -1,121 +0,0 @@
-dnl
-dnl $Id$
-dnl
-
-PHP_ARG_WITH(pdflib,whether to include PDFlib support,
-[ --with-pdflib[=DIR] Include PDFlib support. DIR is the pdflib
- base install directory, defaults to /usr/local
- Set DIR to "shared" to build as dl, or "shared,DIR"
- to build as dl and still specify DIR.])
-
-if test "$PHP_PDFLIB" != "no"; then
-
- PHP_SUBST(PDFLIB_SHARED_LIBADD)
- PHP_EXTENSION(pdf, $ext_shared)
-
- case $PHP_PDFLIB in
- yes)
- AC_CHECK_LIB(pdf, PDF_show_boxed, [
- AC_DEFINE(HAVE_PDFLIB,1,[ ])
- ],[
- AC_MSG_ERROR(pdflib extension requires at least pdflib 3.x. You may also need libtiff and libjpeg. If so, use the options --with-tiff-dir=<DIR> and --with-jpeg-dir=<DIR>)
- ],[
- -ltiff -ljpeg -lpng -lz
- ])
-
- PHP_ADD_LIBRARY(pdf,, PDFLIB_SHARED_LIBADD)
- PHP_ADD_LIBRARY(tiff,, PDFLIB_SHARED_LIBADD)
- PHP_ADD_LIBRARY(png,, PDFLIB_SHARED_LIBADD)
- PHP_ADD_LIBRARY(jpeg,, PDFLIB_SHARED_LIBADD)
- PHP_ADD_LIBRARY(z,, PDFLIB_SHARED_LIBADD)
- ;;
- *)
- test -f $PHP_PDFLIB/include/pdflib.h && PDFLIB_INCLUDE=$PHP_PDFLIB/include
- if test -n "$PDFLIB_INCLUDE" ; then
-
- if test "$PHP_ZLIB_DIR" = "no"; then
- AC_MSG_ERROR(PDF extension requires ZLIB. Use --with-zlib-dir=<DIR>)
- fi
-
- PHP_ADD_LIBRARY_WITH_PATH(z, $PHP_ZLIB_DIR/lib, PDFLIB_SHARED_LIBADD)
-
- PHP_ARG_WITH(jpeg-dir, for the location of libjpeg,
- [ --with-jpeg-dir[=DIR] PDFLIB: define libjpeg install directory])
-
- if test "$PHP_JPEG_DIR" != "no"; then
- AC_CHECK_LIB(jpeg,jpeg_read_header,
- [
- PHP_ADD_LIBRARY_WITH_PATH(jpeg, $PHP_JPEG_DIR/lib, PDFLIB_SHARED_LIBADD)
- ],[
- AC_MSG_ERROR(libjpeg not found!)
- ],[
- -L$PHP_JPEG_DIR/lib
- ])
- else
- AC_CHECK_LIB(jpeg,jpeg_read_header,
- [
- PHP_ADD_LIBRARY(jpeg,, PDFLIB_SHARED_LIBADD)
- ],[
- AC_MSG_RESULT(no, try --with-jpeg-dir=<DIR>)
- ])
- fi
-
-
- PHP_ARG_WITH(png-dir, for the location of libpng,
- [ --with-png-dir[=DIR] PDFLIB: define libpng install directory])
-
- if test "$PHP_PNG_DIR" != "no"; then
- AC_CHECK_LIB(png,png_create_info_struct,
- [
- PHP_ADD_LIBRARY_WITH_PATH(png, $PHP_PNG_DIR/lib, PDFLIB_SHARED_LIBADD)
- ],[
- AC_MSG_ERROR(libpng not found!)
- ],[
- -L$PHP_PNG_DIR/lib
- ])
- else
- AC_CHECK_LIB(png,png_create_info_struct,
- [
- PHP_ADD_LIBRARY(png,, PDFLIB_SHARED_LIBADD)
- ],[
- AC_MSG_RESULT(no, try --with-png-dir=<DIR>)
- ])
- fi
-
-
- PHP_ARG_WITH(tiff-dir, for the location of libtiff,
- [ --with-tiff-dir[=DIR] PDFLIB: define libtiff install directory])
-
- if test "$PHP_TIFF_DIR" != "no"; then
- AC_CHECK_LIB(tiff,TIFFOpen,
- [
- PHP_ADD_LIBRARY_WITH_PATH(tiff, $PHP_TIFF_DIR/lib, PDFLIB_SHARED_LIBADD)
- ],[
- AC_MSG_ERROR(libtiff not found!)
- ],[
- -L$PHP_TIFF_DIR/lib
- ])
- else
- AC_CHECK_LIB(tiff,TIFFOpen,
- [
- PHP_ADD_LIBRARY(tiff,, PDFLIB_SHARED_LIBADD)
- ],[
- AC_MSG_RESULT(no, Try --with-tiff-dir=<DIR>)
- ])
- fi
-
-
- AC_CHECK_LIB(pdf, PDF_show_boxed,
- [
- AC_DEFINE(HAVE_PDFLIB,1,[ ])
- PHP_ADD_LIBRARY_WITH_PATH(pdf, $PHP_PDFLIB/lib, PDFLIB_SHARED_LIBADD)
- PHP_ADD_INCLUDE($PDFLIB_INCLUDE)
- ],[
- AC_MSG_ERROR(pdflib extension requires at least pdflib 3.x.)
- ],[
- -L$PHP_PDFLIB/lib
- ])
- fi
- ;;
- esac
-fi
diff --git a/ext/pdf/pdf.c b/ext/pdf/pdf.c
deleted file mode 100644
index d76baacd37..0000000000
--- a/ext/pdf/pdf.c
+++ /dev/null
@@ -1,3161 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Uwe Steinmann <Uwe.Steinmann@fernuni-hagen.de> |
- | Rainer Schaaf <rjs@pdflib.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-/* pdflib 2.02 ... 3.0x is subject to the ALADDIN FREE PUBLIC LICENSE.
- Copyright (C) 1997-1999 Thomas Merz. 2000-2001 PDFlib GmbH */
-/* Note that there is no code from the pdflib package in this file */
-
-/* {{{ includes
- */
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "php_ini.h"
-#include "php_globals.h"
-#include "zend_list.h"
-#include "ext/standard/head.h"
-#include "ext/standard/info.h"
-#include "ext/standard/file.h"
-
-#if HAVE_LIBGD13
-#include "ext/gd/php_gd.h"
-#include "gd.h"
-static int le_gd;
-#endif
-
-#ifdef HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-#ifdef PHP_WIN32
-# include <io.h>
-# include <fcntl.h>
-#endif
-/* }}} */
-
-#if HAVE_PDFLIB
-
-#include "php_pdf.h"
-
-static int le_pdf;
-
-/* {{{ constants
- * to adopt the php way of error handling to PDFlib
- * The image related functions in PDFlib return -1 on error
- * but they may return 0 (FALSE) in normal cases
- * so this offset will repair this
- */
-#define PDFLIB_IMAGE_OFFSET 1
-#define PDFLIB_FONT_OFFSET 1
-#define PDFLIB_PDI_OFFSET 1
-#define PDFLIB_PATTERN_OFFSET 1
-#define PDFLIB_SPOT_OFFSET 1
-/* }}} */
-
-/* {{{ pdf_functions[]
- */
-function_entry pdf_functions[] = {
- /* sorry for sorting this stuff like the pdflib manual,
- but this helps me to see what is done :) RJS
- I'll try to avoid rearanging the sources below that => new functions to the end */
- PHP_FE(pdf_new, NULL) /* new function */
- PHP_FE(pdf_delete, NULL) /* new function */
- PHP_FE(pdf_open_file, NULL) /* new function */
- PHP_FE(pdf_get_buffer, NULL) /* new function */
- PHP_FE(pdf_close, NULL)
- PHP_FE(pdf_begin_page, NULL)
- PHP_FE(pdf_end_page, NULL)
- PHP_FE(pdf_get_value, NULL)
- PHP_FE(pdf_set_value, NULL)
- PHP_FE(pdf_get_parameter, NULL)
- PHP_FE(pdf_set_parameter, NULL)
- PHP_FE(pdf_findfont, NULL) /* new function */
- PHP_FE(pdf_setfont, NULL) /* new function */
- PHP_FE(pdf_show, NULL)
- PHP_FE(pdf_show_xy, NULL)
- PHP_FE(pdf_continue_text, NULL)
- PHP_FE(pdf_show_boxed, NULL)
- PHP_FE(pdf_stringwidth, NULL) /* new parameters: [int font, float size] */
- PHP_FE(pdf_set_text_pos, NULL)
- PHP_FE(pdf_setdash, NULL)
- PHP_FE(pdf_setpolydash, NULL) /* new function: not yet finished */
- PHP_FE(pdf_setflat, NULL)
- PHP_FE(pdf_setlinejoin, NULL)
- PHP_FE(pdf_setlinecap, NULL)
- PHP_FE(pdf_setmiterlimit, NULL)
- PHP_FE(pdf_setlinewidth, NULL)
- PHP_FE(pdf_save, NULL)
- PHP_FE(pdf_restore, NULL)
- PHP_FE(pdf_translate, NULL)
- PHP_FE(pdf_scale, NULL)
- PHP_FE(pdf_rotate, NULL)
- PHP_FE(pdf_skew, NULL)
- PHP_FE(pdf_concat, NULL) /* new function */
- PHP_FE(pdf_moveto, NULL)
- PHP_FE(pdf_lineto, NULL)
- PHP_FE(pdf_curveto, NULL)
- PHP_FE(pdf_circle, NULL)
- PHP_FE(pdf_arc, NULL)
- PHP_FE(pdf_rect, NULL)
- PHP_FE(pdf_closepath, NULL)
- PHP_FE(pdf_stroke, NULL)
- PHP_FE(pdf_closepath_stroke, NULL)
- PHP_FE(pdf_fill, NULL)
- PHP_FE(pdf_fill_stroke, NULL)
- PHP_FE(pdf_closepath_fill_stroke, NULL)
- PHP_FE(pdf_clip, NULL)
- PHP_FE(pdf_endpath, NULL)
- PHP_FE(pdf_open_image_file, NULL) /* new parameters: [char *stringpram, int intparam] */
- PHP_FE(pdf_open_ccitt, NULL) /* new function */
- PHP_FE(pdf_open_image, NULL) /* new function */
- PHP_FE(pdf_close_image, NULL)
- PHP_FE(pdf_place_image, NULL)
- PHP_FE(pdf_add_bookmark, NULL)
- PHP_FE(pdf_set_info, NULL)
- PHP_FE(pdf_attach_file, NULL) /* new function */
- PHP_FE(pdf_add_note, NULL) /* new function */
- PHP_FE(pdf_add_pdflink, NULL)
- PHP_FE(pdf_add_locallink, NULL) /* new function */
- PHP_FE(pdf_add_launchlink, NULL)/* new function */
- PHP_FE(pdf_add_weblink, NULL)
- PHP_FE(pdf_set_border_style, NULL)
- PHP_FE(pdf_set_border_color, NULL)
- PHP_FE(pdf_set_border_dash, NULL)
-
- /* End of the official PDFLIB V3.x API */
-
- /* aliases for compatibility reasons */
- PHP_FALIAS(pdf_add_outline, pdf_add_bookmark, NULL)
-
- /* old font handling */
- PHP_FE(pdf_set_font, NULL) /* deprecated */
- PHP_FE(pdf_get_font, NULL) /* deprecated */
- PHP_FE(pdf_get_fontname, NULL) /* deprecated */
- PHP_FE(pdf_get_fontsize, NULL) /* deprecated */
-
- /* old way of starting a PDF document */
- PHP_FE(pdf_open, NULL) /* deprecated */
-
- /* old stuff for setting infos */
- PHP_FE(pdf_set_info_creator, NULL) /* deprecated */
- PHP_FE(pdf_set_info_title, NULL) /* deprecated */
- PHP_FE(pdf_set_info_subject, NULL) /* deprecated */
- PHP_FE(pdf_set_info_author, NULL) /* deprecated */
- PHP_FE(pdf_set_info_keywords, NULL) /* deprecated */
- PHP_FE(pdf_set_leading, NULL) /* deprecated */
- PHP_FE(pdf_set_text_rendering, NULL) /* deprecated */
- PHP_FE(pdf_set_horiz_scaling, NULL) /* deprecated */
- PHP_FE(pdf_set_text_rise, NULL) /* deprecated */
- PHP_FE(pdf_set_char_spacing, NULL) /* deprecated */
- PHP_FE(pdf_set_word_spacing, NULL) /* deprecated */
- PHP_FE(pdf_set_transition, NULL) /* deprecated */
- PHP_FE(pdf_set_duration, NULL) /* deprecated */
- PHP_FE(pdf_get_image_height, NULL) /* deprecated */
- PHP_FE(pdf_get_image_width, NULL) /* deprecated */
-
- /* old stuff for opening images */
- PHP_FE(pdf_open_jpeg, NULL) /* deprecated */
- PHP_FE(pdf_open_tiff, NULL) /* deprecated */
- PHP_FE(pdf_open_png, NULL) /* deprecated */
- PHP_FE(pdf_open_gif, NULL) /* deprecated */
-
- /* some more stuff for compatibility */
- PHP_FE(pdf_add_annotation, NULL)
-#if HAVE_LIBGD13
- PHP_FE(pdf_open_memory_image, NULL)
-#else
- PHP_FALIAS(pdf_open_memory_image, warn_not_available, NULL)
-#endif
- /* depreciatet after V4.0 of PDFlib */
- PHP_FE(pdf_setgray_fill, NULL)
- PHP_FE(pdf_setgray_stroke, NULL)
- PHP_FE(pdf_setgray, NULL)
- PHP_FE(pdf_setrgbcolor_fill, NULL)
- PHP_FE(pdf_setrgbcolor_stroke, NULL)
- PHP_FE(pdf_setrgbcolor, NULL)
-
-#if (PDFLIB_MAJORVERSION >= 4)
-/* support for new functions in PDFlib V4.0 */
- PHP_FE(pdf_open_pdi, NULL)
- PHP_FE(pdf_close_pdi, NULL)
- PHP_FE(pdf_open_pdi_page, NULL)
- PHP_FE(pdf_place_pdi_page, NULL)
- PHP_FE(pdf_close_pdi_page, NULL)
- PHP_FE(pdf_get_pdi_parameter, NULL)
- PHP_FE(pdf_get_pdi_value, NULL)
- PHP_FE(pdf_begin_pattern, NULL)
- PHP_FE(pdf_end_pattern, NULL)
- PHP_FE(pdf_begin_template, NULL)
- PHP_FE(pdf_end_template, NULL)
- PHP_FE(pdf_setcolor, NULL)
- PHP_FE(pdf_makespotcolor, NULL)
- PHP_FE(pdf_arcn, NULL)
- PHP_FE(pdf_add_thumbnail, NULL)
- PHP_FE(pdf_initgraphics, NULL)
- PHP_FE(pdf_setmatrix, NULL)
-#else
- PHP_FALIAS(pdf_open_pdi, warn_not_available, NULL)
- PHP_FALIAS(pdf_close_pdi, warn_not_available, NULL)
- PHP_FALIAS(pdf_open_pdi_page, warn_not_available, NULL)
- PHP_FALIAS(pdf_place_pdi_page, warn_not_available, NULL)
- PHP_FALIAS(pdf_close_pdi_page, warn_not_available, NULL)
- PHP_FALIAS(pdf_get_pdi_parameter, warn_not_available, NULL)
- PHP_FALIAS(pdf_get_pdi_value, warn_not_available, NULL)
- PHP_FALIAS(pdf_begin_pattern, warn_not_available, NULL)
- PHP_FALIAS(pdf_end_pattern, warn_not_available, NULL)
- PHP_FALIAS(pdf_begin_template, warn_not_available, NULL)
- PHP_FALIAS(pdf_end_template, warn_not_available, NULL)
- PHP_FALIAS(pdf_setcolor, warn_not_available, NULL)
- PHP_FALIAS(pdf_makespotcolor, warn_not_available, NULL)
- PHP_FALIAS(pdf_arcn, warn_not_available, NULL)
- PHP_FALIAS(pdf_add_thumbnail, warn_not_available, NULL)
- PHP_FALIAS(pdf_initgraphics, warn_not_available, NULL)
- PHP_FALIAS(pdf_setmatrix, warn_not_available, NULL)
-#endif /* PDFlib >= V4 */
-
- {NULL, NULL, NULL}
-};
-/* }}} */
-
-/* {{{ pdf_module_entry
- */
-zend_module_entry pdf_module_entry = {
- "pdf",
- pdf_functions,
- PHP_MINIT(pdf),
- PHP_MSHUTDOWN(pdf),
- NULL,
- NULL,
- PHP_MINFO(pdf),
- STANDARD_MODULE_PROPERTIES
-};
-/* }}} */
-
-#ifdef COMPILE_DL_PDF
-ZEND_GET_MODULE(pdf)
-#endif
-
-/* {{{ _free_pdf_doc
- */
-static void _free_pdf_doc(zend_rsrc_list_entry *rsrc)
-{
- /* RJS: TODO:
- PDF *pdf = (PDF *)rsrc->ptr;
- check whether pdf-Pointer is still valid, before pdf_delete()
- + remove php-resource */
- /* PDF_delete(pdf);
-*/
-}
-/* }}} */
-
-/* {{{ custom_errorhandler
- */
-static void custom_errorhandler(PDF *p, int type, const char *shortmsg)
-{
- switch (type){
- case PDF_NonfatalError:
- /*
- * PDFlib warings should be visible to the user
- * If he decides to live with PDFlib warnings
- * he may user the PDFlib function
- * pdf_set_parameter($p, "warning" 0) to switch off
- * the warnings inside PDFlib
- */
- php_error(E_WARNING,"Internal PDFlib warning: %s", shortmsg);
- return;
- case PDF_MemoryError: /* give up in all other cases */
- case PDF_IOError:
- case PDF_RuntimeError:
- case PDF_IndexError:
- case PDF_TypeError:
- case PDF_DivisionByZero:
- case PDF_OverflowError:
- case PDF_SyntaxError:
- case PDF_ValueError:
- case PDF_SystemError:
- case PDF_UnknownError:
- default:
- if (p !=NULL) PDF_delete(p); /* clean up PDFlib */
- php_error(E_ERROR,"PDFlib error: %s", shortmsg);
- }
-}
-/* }}} */
-
-/* {{{ pdf_emalloc
- */
-static void *pdf_emalloc(PDF *p, size_t size, const char *caller)
-{
- return(emalloc(size));
-}
-/* }}} */
-
-/* {{{ pdf_realloc
- */
-static void *pdf_realloc(PDF *p, void *mem, size_t size, const char *caller)
-{
- return(erealloc(mem, size));
-}
-/* }}} */
-
-/* {{{ pdf_efree
- */
-static void pdf_efree(PDF *p, void *mem)
-{
- efree(mem);
-}
-/* }}} */
-
-/* {{{ pdf_flushwrite
- */
-static size_t pdf_flushwrite(PDF *p, void *data, size_t size)
-{
- return(php_write(data, size));
- return 0;
-}
-/* }}} */
-
-/* {{{ PHP_MINFO_FUNCTION
- */
-PHP_MINFO_FUNCTION(pdf)
-{
- char tmp[32];
-
- snprintf(tmp, 31, "%d.%02d", PDF_get_majorversion(), PDF_get_minorversion() );
- tmp[31]=0;
-
- php_info_print_table_start();
- php_info_print_table_row(2, "PDF Support", "enabled" );
-#if (PDFLIB_MAJORVERSION >= 4)
- php_info_print_table_row(2, "PDFlib GmbH Version", PDFLIB_VERSIONSTRING );
-#else
- php_info_print_table_row(2, "PDFlib GmbH Version", tmp );
-#endif
- php_info_print_table_row(2, "Revision", "$Revision$" );
- php_info_print_table_end();
-
-}
-/* }}} */
-
-/* {{{ PHP_MINIT_FUNCTION
- */
-PHP_MINIT_FUNCTION(pdf)
-{
- if ((PDF_get_majorversion() != PDFLIB_MAJORVERSION) ||
- (PDF_get_minorversion() != PDFLIB_MINORVERSION)) {
- php_error(E_ERROR,"PDFlib error: Version mismatch in wrapper code");
- }
- le_pdf = zend_register_list_destructors_ex(_free_pdf_doc, NULL, "pdf object", module_number);
-
- /* this does something like setlocale("C", ...) in PDFlib 3.x */
- PDF_boot();
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_MSHUTDOWN_FUNCTION
- */
-PHP_MSHUTDOWN_FUNCTION(pdf)
-{
- PDF_shutdown();
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ _php_pdf_set_info
- */
-static void _php_pdf_set_info(INTERNAL_FUNCTION_PARAMETERS, char *field)
-{
- zval **arg1, **arg2;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_string_ex(arg2);
- PDF_set_info(pdf, field, Z_STRVAL_PP(arg2));
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool pdf_set_info(int pdfdoc, string fieldname, string value)
- Fills an info field of the document */
-PHP_FUNCTION(pdf_set_info)
-{
- zval **arg1, **arg2, **arg3;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &arg1, &arg2, &arg3) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_string_ex(arg2);
- convert_to_string_ex(arg3);
- PDF_set_info(pdf, Z_STRVAL_PP(arg2), Z_STRVAL_PP(arg3));
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool pdf_set_info_creator(int pdfdoc, string creator)
- Fills the creator field of the document */
-PHP_FUNCTION(pdf_set_info_creator)
-{
- _php_pdf_set_info(INTERNAL_FUNCTION_PARAM_PASSTHRU, "Creator");
-}
-/* }}} */
-
-/* {{{ proto bool pdf_set_info_title(int pdfdoc, string title)
- Fills the title field of the document */
-PHP_FUNCTION(pdf_set_info_title)
-{
- _php_pdf_set_info(INTERNAL_FUNCTION_PARAM_PASSTHRU, "Title");
-}
-/* }}} */
-
-/* {{{ proto bool pdf_set_info_subject(int pdfdoc, string subject)
- Fills the subject field of the document */
-PHP_FUNCTION(pdf_set_info_subject)
-{
- _php_pdf_set_info(INTERNAL_FUNCTION_PARAM_PASSTHRU, "Subject");
-}
-/* }}} */
-
-/* {{{ proto bool pdf_set_info_author(int pdfdoc, string author)
- Fills the author field of the document */
-PHP_FUNCTION(pdf_set_info_author)
-{
- _php_pdf_set_info(INTERNAL_FUNCTION_PARAM_PASSTHRU, "Author");
-}
-/* }}} */
-
-/* {{{ proto bool pdf_set_info_keywords(int pdfdoc, string keywords)
- Fills the keywords field of the document */
-PHP_FUNCTION(pdf_set_info_keywords) {
- _php_pdf_set_info(INTERNAL_FUNCTION_PARAM_PASSTHRU, "Keywords");
-}
-/* }}} */
-
-/* {{{ proto int pdf_open([int filedesc])
- Opens a new pdf document. If filedesc is NULL, document is created in memory. This is the old interface, only for compatibility use pdf_new + pdf_open_file instead */
-PHP_FUNCTION(pdf_open)
-{
- zval **file;
- FILE *fp;
- PDF *pdf;
- int argc = ZEND_NUM_ARGS();
-
- if(argc > 1)
- WRONG_PARAM_COUNT;
- if (argc != 1 || zend_get_parameters_ex(1, &file) == FAILURE) {
- fp = NULL;
- } else {
- ZEND_FETCH_RESOURCE(fp, FILE *, file, -1, "File-Handle", php_file_le_fopen());
- /* XXX should do a zend_list_addref for <fp> here! */
- }
-
- pdf = PDF_new2(custom_errorhandler, pdf_emalloc, pdf_realloc, pdf_efree, NULL);
-
- if(fp) {
- if (PDF_open_fp(pdf, fp) < 0) RETURN_FALSE;
- } else {
- PDF_open_mem(pdf, pdf_flushwrite);
- }
-#if (PDFLIB_MAJORVERSION >= 4)
- PDF_set_parameter(pdf, "imagewarning", "true");
-#endif
- PDF_set_parameter(pdf, "binding", "PHP");
-
- ZEND_REGISTER_RESOURCE(return_value, pdf, le_pdf);
-}
-
-/* }}} */
-
-/* {{{ proto void pdf_close(int pdfdoc)
- Closes the pdf document */
-PHP_FUNCTION(pdf_close)
-{
- zval **arg1;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- PDF_close(pdf);
-
- RETURN_TRUE;
-}
-
-/* }}} */
-
-/* {{{ proto void pdf_begin_page(int pdfdoc, double width, double height)
- Starts page */
-PHP_FUNCTION(pdf_begin_page)
-{
- zval **arg1, **arg2, **arg3;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &arg1, &arg2, &arg3) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_double_ex(arg2);
- convert_to_double_ex(arg3);
- PDF_begin_page(pdf, (float) Z_DVAL_PP(arg2), (float) Z_DVAL_PP(arg3));
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void pdf_end_page(int pdfdoc)
- Ends page */
-PHP_FUNCTION(pdf_end_page)
-{
- zval **arg1;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- PDF_end_page(pdf);
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void pdf_show(int pdfdoc, string text)
- Output text at current position */
-PHP_FUNCTION(pdf_show)
-{
- zval **arg1, **arg2;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_string_ex(arg2);
- PDF_show2(pdf, Z_STRVAL_PP(arg2), Z_STRLEN_PP(arg2));
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void pdf_show_xy(int pdfdoc, string text, double x-koor, double y-koor)
- Output text at position */
-PHP_FUNCTION(pdf_show_xy)
-{
- zval **arg1, **arg2, **arg3, **arg4;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 4 || zend_get_parameters_ex(4, &arg1, &arg2, &arg3, &arg4) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_string_ex(arg2);
- convert_to_double_ex(arg3);
- convert_to_double_ex(arg4);
- PDF_show_xy2(pdf, Z_STRVAL_PP(arg2), Z_STRLEN_PP(arg2), (float) Z_DVAL_PP(arg3), (float) Z_DVAL_PP(arg4));
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int pdf_show_boxed(int pdfdoc, string text, double x-koor, double y-koor, double width, double height, string mode [, string feature])
- Output text formated in a boxed */
-PHP_FUNCTION(pdf_show_boxed)
-{
- zval **argv[8];
- int argc = ZEND_NUM_ARGS();
- int nr;
- char *feature;
- PDF *pdf;
-
- if (((argc < 7) || (argc > 8)) || zend_get_parameters_array_ex(argc, argv) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, argv[0], -1, "pdf object", le_pdf);
-
- convert_to_string_ex(argv[1]);
- convert_to_double_ex(argv[2]);
- convert_to_double_ex(argv[3]);
- convert_to_double_ex(argv[4]);
- convert_to_double_ex(argv[5]);
- convert_to_string_ex(argv[6]);
-
- if(argc == 8) {
- convert_to_string_ex(argv[7]);
- feature = Z_STRVAL_PP(argv[7]);
- } else {
- feature = NULL;
- }
-
- nr = PDF_show_boxed(pdf, Z_STRVAL_PP(argv[1]),
- (float) Z_DVAL_PP(argv[2]),
- (float) Z_DVAL_PP(argv[3]),
- (float) Z_DVAL_PP(argv[4]),
- (float) Z_DVAL_PP(argv[5]),
- Z_STRVAL_PP(argv[6]),
- feature);
-
- RETURN_LONG(nr);
-}
-/* }}} */
-
-/* {{{ proto void pdf_set_font(int pdfdoc, string font, double size, string encoding [, int embed])
- Select the current font face, size and encoding */
-PHP_FUNCTION(pdf_set_font)
-{
- zval **arg1, **arg2, **arg3, **arg4, **arg5;
- int font, embed;
- PDF *pdf;
-
- switch (ZEND_NUM_ARGS()) {
- case 4:
- if (zend_get_parameters_ex(4, &arg1, &arg2, &arg3, &arg4) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- embed = 0;
- break;
- case 5:
- if (zend_get_parameters_ex(5, &arg1, &arg2, &arg3, &arg4, &arg5) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(arg5);
- embed = Z_LVAL_PP(arg5);
- break;
- default:
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_string_ex(arg2);
- convert_to_double_ex(arg3);
- convert_to_string_ex(arg4);
-
- font = PDF_findfont(pdf, Z_STRVAL_PP(arg2), Z_STRVAL_PP(arg4), embed);
- if (font == -1) {
- php_error(E_WARNING,"Font %s not found", Z_STRVAL_PP(arg2));
- RETURN_FALSE;
- }
-
- PDF_setfont(pdf, font, (float) Z_DVAL_PP(arg3));
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ _php_pdf_set_value
- */
-static void _php_pdf_set_value(INTERNAL_FUNCTION_PARAMETERS, char *field)
-{
- zval **arg1, **arg2;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_double_ex(arg2);
- PDF_set_value(pdf, field, (float)Z_DVAL_PP(arg2));
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void pdf_set_value(int pdfdoc, string key, double value)
- Sets arbitrary value */
-PHP_FUNCTION(pdf_set_value)
-{
- zval **arg1, **arg2, **arg3;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &arg1, &arg2, &arg3) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_string_ex(arg2);
- convert_to_double_ex(arg3);
- PDF_set_value(pdf, Z_STRVAL_PP(arg2), (float)Z_DVAL_PP(arg3));
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto double pdf_get_value(int pdfdoc, string key, double modifier)
- Gets arbitrary value */
-PHP_FUNCTION(pdf_get_value)
-{
- zval **argv[3];
- int argc = ZEND_NUM_ARGS();
- PDF *pdf;
- double value;
-
- if(((argc < 2) || (argc > 3)) || zend_get_parameters_array_ex(argc, argv) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, argv[0], -1, "pdf object", le_pdf);
-
- convert_to_string_ex(argv[1]);
- if(argc == 3)
- convert_to_double_ex(argv[2]);
-
- if(0 == (strcmp(Z_STRVAL_PP(argv[1]), "imagewidth"))) {
- if(argc < 3) WRONG_PARAM_COUNT;
- value = PDF_get_value(pdf, Z_STRVAL_PP(argv[1]), (float)Z_DVAL_PP(argv[2])-PDFLIB_IMAGE_OFFSET);
- } else if(0 == (strcmp(Z_STRVAL_PP(argv[1]), "imageheight"))) {
- if(argc < 3) WRONG_PARAM_COUNT;
- value = PDF_get_value(pdf, Z_STRVAL_PP(argv[1]), (float)Z_DVAL_PP(argv[2])-PDFLIB_IMAGE_OFFSET);
- } else if(0 == (strcmp(Z_STRVAL_PP(argv[1]), "resx"))) {
- if(argc < 3) WRONG_PARAM_COUNT;
- value = PDF_get_value(pdf, Z_STRVAL_PP(argv[1]), (float)Z_DVAL_PP(argv[2])-PDFLIB_IMAGE_OFFSET);
- } else if(0 == (strcmp(Z_STRVAL_PP(argv[1]), "resy"))) {
- if(argc < 3) WRONG_PARAM_COUNT;
- value = PDF_get_value(pdf, Z_STRVAL_PP(argv[1]), (float)Z_DVAL_PP(argv[2])-PDFLIB_IMAGE_OFFSET);
- } else if(0 == (strcmp(Z_STRVAL_PP(argv[1]), "font"))) {
- value = PDF_get_value(pdf, Z_STRVAL_PP(argv[1]), 0.0)+PDFLIB_IMAGE_OFFSET;
- } else {
- if(argc < 3) {
- value = PDF_get_value(pdf, Z_STRVAL_PP(argv[1]), 0.0);
- } else {
- value = PDF_get_value(pdf, Z_STRVAL_PP(argv[1]), (float)Z_DVAL_PP(argv[2]));
- }
- }
-
- RETURN_DOUBLE(value);
-}
-/* }}} */
-
-/* {{{ proto int pdf_get_font(int pdfdoc)
- Gets the current font */
-PHP_FUNCTION(pdf_get_font)
-{
- zval **arg1;
- int font;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- font = (int) PDF_get_value(pdf, "font", 0);
- RETURN_LONG(font+PDFLIB_FONT_OFFSET);
-}
-/* }}} */
-
-/* {{{ proto string pdf_get_fontname(int pdfdoc)
- Gets the current font name */
-PHP_FUNCTION(pdf_get_fontname)
-{
- zval **arg1;
- char *fontname;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- fontname = (char *) PDF_get_parameter(pdf, "fontname", 0);
- RETURN_STRING(fontname, 1);
-}
-/* }}} */
-
-/* {{{ proto double pdf_get_fontsize(int pdfdoc)
- Gets the current font size */
-PHP_FUNCTION(pdf_get_fontsize)
-{
- zval **arg1;
- float fontsize;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- fontsize = PDF_get_value(pdf, "fontsize", 0);
- RETURN_DOUBLE(fontsize);
-}
-/* }}} */
-
-/* {{{ proto void pdf_set_leading(int pdfdoc, double distance)
- Sets distance between text lines */
-PHP_FUNCTION(pdf_set_leading)
-{
- _php_pdf_set_value(INTERNAL_FUNCTION_PARAM_PASSTHRU, "leading");
-}
-/* }}} */
-
-/* {{{ proto void pdf_set_text_rendering(int pdfdoc, int mode)
- Determines how text is rendered */
-PHP_FUNCTION(pdf_set_text_rendering)
-{
- _php_pdf_set_value(INTERNAL_FUNCTION_PARAM_PASSTHRU, "textrendering");
-}
-/* }}} */
-
-/* {{{ proto void pdf_set_horiz_scaling(int pdfdoc, double scale)
- Sets horizontal scaling of text */
-PHP_FUNCTION(pdf_set_horiz_scaling)
-{
- _php_pdf_set_value(INTERNAL_FUNCTION_PARAM_PASSTHRU, "horizscaling");
-}
-/* }}} */
-
-/* {{{ proto void pdf_set_text_rise(int pdfdoc, double value)
- Sets the text rise */
-PHP_FUNCTION(pdf_set_text_rise)
-{
- _php_pdf_set_value(INTERNAL_FUNCTION_PARAM_PASSTHRU, "textrise");
-}
-/* }}} */
-
-/* {{{ proto void pdf_set_char_spacing(int pdfdoc, double space)
- Sets character spacing */
-PHP_FUNCTION(pdf_set_char_spacing)
-{
- _php_pdf_set_value(INTERNAL_FUNCTION_PARAM_PASSTHRU, "charspacing");
-}
-/* }}} */
-
-/* {{{ proto void pdf_set_word_spacing(int pdfdoc, double space)
- Sets spacing between words */
-PHP_FUNCTION(pdf_set_word_spacing)
-{
- _php_pdf_set_value(INTERNAL_FUNCTION_PARAM_PASSTHRU, "wordspacing");
-}
-/* }}} */
-
-/* {{{ proto void pdf_set_text_pos(int pdfdoc, double x, double y)
- Sets the position of text for the next pdf_show call */
-PHP_FUNCTION(pdf_set_text_pos)
-{
- zval **arg1, **arg2, **arg3;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &arg1, &arg2, &arg3) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_double_ex(arg2);
- convert_to_double_ex(arg3);
- PDF_set_text_pos(pdf, (float) Z_DVAL_PP(arg2), (float) Z_DVAL_PP(arg3));
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void pdf_continue_text(int pdfdoc, string text)
- Output text in next line */
-PHP_FUNCTION(pdf_continue_text)
-{
- zval **arg1, **arg2;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_string_ex(arg2);
- PDF_continue_text2(pdf, Z_STRVAL_PP(arg2), Z_STRLEN_PP(arg2));
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto double pdf_stringwidth(int pdfdoc, string text [, int font, double size])
- Returns width of text in current font */
-PHP_FUNCTION(pdf_stringwidth)
-{
- zval **arg1, **arg2, **arg3, **arg4;
- int font;
- double width, size;
- PDF *pdf;
-
- switch (ZEND_NUM_ARGS()) {
- case 2:
- if (zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE)
- WRONG_PARAM_COUNT;
- break;
- case 4:
- if (zend_get_parameters_ex(4, &arg1, &arg2, &arg3, &arg4) == FAILURE)
- WRONG_PARAM_COUNT;
- convert_to_long_ex(arg3);
- break;
- default:
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_string_ex(arg2);
- if (ZEND_NUM_ARGS() == 2) {
- font = (int)PDF_get_value(pdf, "font", 0)+PDFLIB_FONT_OFFSET;
- size = PDF_get_value(pdf, "fontsize", 0);
- } else {
- convert_to_long_ex(arg3);
- font = Z_LVAL_PP(arg3);
- convert_to_double_ex(arg4);
- size = Z_DVAL_PP(arg4);
- }
- width = (double) PDF_stringwidth2(pdf,
- Z_STRVAL_PP(arg2),
- Z_STRLEN_PP(arg2),
- font-PDFLIB_FONT_OFFSET,
- (float)size);
-
- RETURN_DOUBLE((double) width);
-}
-/* }}} */
-
-/* {{{ proto void pdf_save(int pdfdoc)
- Saves current enviroment */
-PHP_FUNCTION(pdf_save)
-{
- zval **arg1;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- PDF_save(pdf);
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void pdf_restore(int pdfdoc)
- Restores formerly saved enviroment */
-PHP_FUNCTION(pdf_restore)
-{
- zval **arg1;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- PDF_restore(pdf);
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void pdf_translate(int pdfdoc, double x, double y)
- Sets origin of coordinate system */
-PHP_FUNCTION(pdf_translate)
-{
- zval **arg1, **arg2, **arg3;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &arg1, &arg2, &arg3) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_double_ex(arg2);
- convert_to_double_ex(arg3);
- PDF_translate(pdf, (float) Z_DVAL_PP(arg2), (float) Z_DVAL_PP(arg3));
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void pdf_scale(int pdfdoc, double x-scale, double y-scale)
- Sets scaling */
-PHP_FUNCTION(pdf_scale)
-{
- zval **arg1, **arg2, **arg3;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &arg1, &arg2, &arg3) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_double_ex(arg2);
- convert_to_double_ex(arg3);
- PDF_scale(pdf, (float) Z_DVAL_PP(arg2), (float) Z_DVAL_PP(arg3));
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void pdf_rotate(int pdfdoc, double angle)
- Sets rotation */
-PHP_FUNCTION(pdf_rotate)
-{
- zval **arg1, **arg2;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_double_ex(arg2);
- PDF_rotate(pdf, (float) Z_DVAL_PP(arg2));
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void pdf_skew(int pdfdoc, double xangle, double yangle)
- Skew the coordinate system */
-PHP_FUNCTION(pdf_skew)
-{
- zval **arg1, **arg2, **arg3;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &arg1, &arg2, &arg3) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_double_ex(arg2);
- convert_to_double_ex(arg3);
- PDF_skew(pdf, (float) Z_DVAL_PP(arg2), (float) Z_DVAL_PP(arg3));
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void pdf_setflat(int pdfdoc, double value)
- Sets flatness */
-PHP_FUNCTION(pdf_setflat)
-{
- zval **arg1, **arg2;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_double_ex(arg2);
- /* pdflib will do this for you, will throw some exception
- if((Z_LVAL_PP(arg2) > 100) && (Z_LVAL_PP(arg2) < 0)) {
- php_error(E_WARNING,"Parameter of pdf_setflat() has to between 0 and 100");
- RETURN_FALSE;
- }
- */
-
- PDF_setflat(pdf, (float) Z_DVAL_PP(arg2));
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void pdf_setlinejoin(int pdfdoc, int value)
- Sets linejoin parameter */
-PHP_FUNCTION(pdf_setlinejoin)
-{
- zval **arg1, **arg2;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_long_ex(arg2);
- /* pdflib will do this for you, will throw some exception
- if((Z_LVAL_PP(arg2) > 2) && (Z_LVAL_PP(arg2) < 0)) {
- php_error(E_WARNING,"Parameter of pdf_setlinejoin() must be between 0 and 2");
- RETURN_FALSE;
- }
- */
-
- PDF_setlinejoin(pdf, Z_LVAL_PP(arg2));
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void pdf_setlinecap(int pdfdoc, int value)
- Sets linecap parameter */
-PHP_FUNCTION(pdf_setlinecap)
-{
- zval **arg1, **arg2;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_long_ex(arg2);
- /* pdflib will do this for you, will throw some exception
- if((Z_LVAL_PP(arg2) > 2) && (Z_LVAL_PP(arg2) < 0)) {
- php_error(E_WARNING,"Parameter of pdf_setlinecap() must be > 0 and <= 2");
- RETURN_FALSE;
- }
- */
-
- PDF_setlinecap(pdf, Z_LVAL_PP(arg2));
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void pdf_setmiterlimit(int pdfdoc, double value)
- Sets miter limit */
-PHP_FUNCTION(pdf_setmiterlimit)
-{
- zval **arg1, **arg2;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_double_ex(arg2);
- /* pdflib will do this for you, will throw some exception
- if(Z_DVAL_PP(arg2) < 1) {
- php_error(E_WARNING,"Parameter of pdf_setmiterlimit() must be >= 1");
- RETURN_FALSE;
- }
- */
-
- PDF_setmiterlimit(pdf, (float) Z_DVAL_PP(arg2));
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void pdf_setlinewidth(int pdfdoc, double width)
- Sets line width */
-PHP_FUNCTION(pdf_setlinewidth)
-{
- zval **arg1, **arg2;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_double_ex(arg2);
- PDF_setlinewidth(pdf, (float) Z_DVAL_PP(arg2));
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void pdf_setdash(int pdfdoc, double black, double white)
- Sets dash pattern */
-PHP_FUNCTION(pdf_setdash)
-{
- zval **arg1, **arg2, **arg3;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &arg1, &arg2, &arg3) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_double_ex(arg2);
- convert_to_double_ex(arg3);
- PDF_setdash(pdf, (float) Z_DVAL_PP(arg2), (float) Z_DVAL_PP(arg3));
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void pdf_moveto(int pdfdoc, double x, double y)
- Sets current point */
-PHP_FUNCTION(pdf_moveto)
-{
- zval **arg1, **arg2, **arg3;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &arg1, &arg2, &arg3) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_double_ex(arg2);
- convert_to_double_ex(arg3);
- PDF_moveto(pdf, (float) Z_DVAL_PP(arg2), (float) Z_DVAL_PP(arg3));
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void pdf_curveto(int pdfdoc, double x1, double y1, double x2, double y2, double x3, double y3)
- Draws a curve */
-PHP_FUNCTION(pdf_curveto)
-{
- zval **arg1, **arg2, **arg3, **arg4, **arg5, **arg6, **arg7;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 7 || zend_get_parameters_ex(7, &arg1, &arg2, &arg3, &arg4, &arg5, &arg6, &arg7) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_double_ex(arg2);
- convert_to_double_ex(arg3);
- convert_to_double_ex(arg4);
- convert_to_double_ex(arg5);
- convert_to_double_ex(arg6);
- convert_to_double_ex(arg7);
-
- PDF_curveto(pdf, (float) Z_DVAL_PP(arg2),
- (float) Z_DVAL_PP(arg3),
- (float) Z_DVAL_PP(arg4),
- (float) Z_DVAL_PP(arg5),
- (float) Z_DVAL_PP(arg6),
- (float) Z_DVAL_PP(arg7));
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void pdf_lineto(int pdfdoc, double x, double y)
- Draws a line */
-PHP_FUNCTION(pdf_lineto)
-{
- zval **arg1, **arg2, **arg3;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &arg1, &arg2, &arg3) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_double_ex(arg2);
- convert_to_double_ex(arg3);
- PDF_lineto(pdf, (float) Z_DVAL_PP(arg2), (float) Z_DVAL_PP(arg3));
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void pdf_circle(int pdfdoc, double x, double y, double radius)
- Draws a circle */
-PHP_FUNCTION(pdf_circle)
-{
- zval **arg1, **arg2, **arg3, **arg4;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 4 || zend_get_parameters_ex(4, &arg1, &arg2, &arg3, &arg4) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_double_ex(arg2);
- convert_to_double_ex(arg3);
- convert_to_double_ex(arg4);
- PDF_circle(pdf, (float) Z_DVAL_PP(arg2), (float) Z_DVAL_PP(arg3), (float) Z_DVAL_PP(arg4));
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void pdf_arc(int pdfdoc, double x, double y, double radius, double start, double end)
- Draws an arc */
-PHP_FUNCTION(pdf_arc)
-{
- zval **arg1, **arg2, **arg3, **arg4, **arg5, **arg6;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 6 || zend_get_parameters_ex(6, &arg1, &arg2, &arg3, &arg4, &arg5, &arg6) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_double_ex(arg2);
- convert_to_double_ex(arg3);
- convert_to_double_ex(arg4);
- convert_to_double_ex(arg5);
- convert_to_double_ex(arg6);
-
- PDF_arc(pdf, (float) Z_DVAL_PP(arg2),
- (float) Z_DVAL_PP(arg3),
- (float) Z_DVAL_PP(arg4),
- (float) Z_DVAL_PP(arg5),
- (float) Z_DVAL_PP(arg6));
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void pdf_rect(int pdfdoc, double x, double y, double width, double height)
- Draws a rectangle */
-PHP_FUNCTION(pdf_rect)
-{
- zval **arg1, **arg2, **arg3, **arg4, **arg5;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 5 || zend_get_parameters_ex(5, &arg1, &arg2, &arg3, &arg4, &arg5) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_double_ex(arg2);
- convert_to_double_ex(arg3);
- convert_to_double_ex(arg4);
- convert_to_double_ex(arg5);
-
- PDF_rect(pdf, (float) Z_DVAL_PP(arg2),
- (float) Z_DVAL_PP(arg3),
- (float) Z_DVAL_PP(arg4),
- (float) Z_DVAL_PP(arg5));
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void pdf_closepath(int pdfdoc)
- Close path */
-PHP_FUNCTION(pdf_closepath)
-{
- zval **arg1;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- PDF_closepath(pdf);
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void pdf_closepath_stroke(int pdfdoc)
- Close path and draw line along path */
-PHP_FUNCTION(pdf_closepath_stroke)
-{
- zval **arg1;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- PDF_closepath_stroke(pdf);
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void pdf_stroke(int pdfdoc)
- Draw line along path path */
-PHP_FUNCTION(pdf_stroke)
-{
- zval **arg1;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- PDF_stroke(pdf);
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void pdf_fill(int pdfdoc)
- Fill current path */
-PHP_FUNCTION(pdf_fill)
-{
- zval **arg1;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- PDF_fill(pdf);
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void pdf_fill_stroke(int pdfdoc)
- Fill and stroke current path */
-PHP_FUNCTION(pdf_fill_stroke)
-{
- zval **arg1;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- PDF_fill_stroke(pdf);
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void pdf_closepath_fill_stroke(int pdfdoc)
- Close, fill and stroke current path */
-PHP_FUNCTION(pdf_closepath_fill_stroke)
-{
- zval **arg1;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- PDF_closepath_fill_stroke(pdf);
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void pdf_endpath(int pdfdoc)
- Ends current path */
-PHP_FUNCTION(pdf_endpath)
-{
- zval **arg1;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- PDF_endpath(pdf);
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void pdf_clip(int pdfdoc)
- Clips to current path */
-PHP_FUNCTION(pdf_clip)
-{
- zval **arg1;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- PDF_clip(pdf);
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void pdf_set_parameter(int pdfdoc, string key, string value)
- Sets arbitrary parameters */
-PHP_FUNCTION(pdf_set_parameter)
-{
- zval **arg1, **arg2, **arg3;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &arg1, &arg2, &arg3) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_string_ex(arg2);
- convert_to_string_ex(arg3);
-
- PDF_set_parameter(pdf, Z_STRVAL_PP(arg2), Z_STRVAL_PP(arg3));
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto string pdf_get_parameter(int pdfdoc, string key, mixed modifier)
- Gets arbitrary parameters */
-PHP_FUNCTION(pdf_get_parameter)
-{
- zval **argv[3];
- int argc = ZEND_NUM_ARGS();
- PDF *pdf;
- char *value;
-
- if(((argc < 2) || (argc > 3)) || zend_get_parameters_array_ex(argc, argv) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, argv[0], -1, "pdf object", le_pdf);
-
- convert_to_string_ex(argv[1]);
- if(argc == 3) {
- convert_to_double_ex(argv[2]);
- value = (char *) PDF_get_parameter(pdf, Z_STRVAL_PP(argv[1]), (float) Z_DVAL_PP(argv[2]));
- } else {
- value = (char *) PDF_get_parameter(pdf, Z_STRVAL_PP(argv[1]), 0.0);
- }
-
- RETURN_STRING(value, 1);
-}
-/* }}} */
-
-/* {{{ proto void pdf_setgray_fill(int pdfdoc, double value)
- Sets filling color to gray value */
-PHP_FUNCTION(pdf_setgray_fill)
-{
- zval **arg1, **arg2;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_double_ex(arg2);
-#if (PDFLIB_MAJORVERSION >= 4)
- PDF_setcolor(pdf, "fill", "gray", (float) Z_DVAL_PP(arg2), 0, 0, 0);
-#else
- PDF_setgray_fill(pdf, (float) Z_DVAL_PP(arg2));
-#endif
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void pdf_setgray_stroke(int pdfdoc, double value)
- Sets drawing color to gray value */
-PHP_FUNCTION(pdf_setgray_stroke)
-{
- zval **arg1, **arg2;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_double_ex(arg2);
-#if (PDFLIB_MAJORVERSION >= 4)
- PDF_setcolor(pdf, "stroke", "gray", (float) Z_DVAL_PP(arg2), 0, 0, 0);
-#else
- PDF_setgray_stroke(pdf, (float) Z_DVAL_PP(arg2));
-#endif
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void pdf_setgray(int pdfdoc, double value)
- Sets drawing and filling color to gray value */
-PHP_FUNCTION(pdf_setgray)
-{
- zval **arg1, **arg2;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_double_ex(arg2);
-#if (PDFLIB_MAJORVERSION >= 4)
- PDF_setcolor(pdf, "both", "gray", (float) Z_DVAL_PP(arg2), 0, 0, 0);
-#else
- PDF_setgray(pdf, (float) Z_DVAL_PP(arg2));
-#endif
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void pdf_setrgbcolor_fill(int pdfdoc, double red, double green, double blue)
- Sets filling color to RGB color value */
-PHP_FUNCTION(pdf_setrgbcolor_fill)
-{
- zval **arg1, **arg2, **arg3, **arg4;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 4 || zend_get_parameters_ex(4, &arg1, &arg2, &arg3, &arg4) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_double_ex(arg2);
- convert_to_double_ex(arg3);
- convert_to_double_ex(arg4);
-#if (PDFLIB_MAJORVERSION >= 4)
- PDF_setcolor(pdf, "fill", "rgb", (float) Z_DVAL_PP(arg2), (float) Z_DVAL_PP(arg3), (float) Z_DVAL_PP(arg4), 0);
-#else
- PDF_setrgbcolor_fill(pdf, (float) Z_DVAL_PP(arg2), (float) Z_DVAL_PP(arg3), (float) Z_DVAL_PP(arg4));
-#endif
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void pdf_setrgbcolor_stroke(int pdfdoc, double red, double green, double blue)
- Sets drawing color to RGB color value */
-PHP_FUNCTION(pdf_setrgbcolor_stroke)
-{
- zval **arg1, **arg2, **arg3, **arg4;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 4 || zend_get_parameters_ex(4, &arg1, &arg2, &arg3, &arg4) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_double_ex(arg2);
- convert_to_double_ex(arg3);
- convert_to_double_ex(arg4);
-#if (PDFLIB_MAJORVERSION >= 4)
- PDF_setcolor(pdf, "stroke", "rgb", (float) Z_DVAL_PP(arg2), (float) Z_DVAL_PP(arg3), (float) Z_DVAL_PP(arg4), 0);
-#else
- PDF_setrgbcolor_stroke(pdf, (float) Z_DVAL_PP(arg2), (float) Z_DVAL_PP(arg3), (float) Z_DVAL_PP(arg4));
-#endif
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void pdf_setrgbcolor(int pdfdoc, double red, double green, double blue)
- Sets drawing and filling color to RGB color value */
-PHP_FUNCTION(pdf_setrgbcolor)
-{
- zval **arg1, **arg2, **arg3, **arg4;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 4 || zend_get_parameters_ex(4, &arg1, &arg2, &arg3, &arg4) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_double_ex(arg2);
- convert_to_double_ex(arg3);
- convert_to_double_ex(arg4);
-#if (PDFLIB_MAJORVERSION >= 4)
- PDF_setcolor(pdf, "both", "rgb", (float) Z_DVAL_PP(arg2), (float) Z_DVAL_PP(arg3), (float) Z_DVAL_PP(arg4), 0);
-#else
- PDF_setrgbcolor(pdf, (float) Z_DVAL_PP(arg2), (float) Z_DVAL_PP(arg3), (float) Z_DVAL_PP(arg4));
-#endif
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int pdf_add_bookmark(int pdfdoc, string text [, int parent, int open])
- Adds bookmark for current page */
-PHP_FUNCTION(pdf_add_bookmark)
-{
- zval **arg1, **arg2, **arg3, **arg4;
- int parentid, open, id;
- PDF *pdf;
-
- switch (ZEND_NUM_ARGS()) {
- case 2:
- if (zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- break;
- case 3:
- if (zend_get_parameters_ex(3, &arg1, &arg2, &arg3) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- break;
- case 4:
- if (zend_get_parameters_ex(4, &arg1, &arg2, &arg3, &arg4) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_string_ex(arg2);
-
- if (ZEND_NUM_ARGS() > 2) {
- convert_to_long_ex(arg3);
- parentid = Z_LVAL_PP(arg3);
-
- if (ZEND_NUM_ARGS() > 3) {
- convert_to_long_ex(arg4);
- open = Z_LVAL_PP(arg4);
- } else {
- open = 0;
- }
- } else {
- parentid = 0;
- open = 0;
- }
-
- /* will never return 0 */
- id = PDF_add_bookmark(pdf, Z_STRVAL_PP(arg2), parentid, open);
-
- RETURN_LONG(id);
-}
-/* }}} */
-
-/* {{{ proto void pdf_set_transition(int pdfdoc, int transition)
- Sets transition between pages */
-PHP_FUNCTION(pdf_set_transition)
-{
- zval **arg1, **arg2;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_long_ex(arg2);
-
- switch(Z_LVAL_PP(arg2)) {
- case 0:
- PDF_set_parameter(pdf, "transition", "none");
- break;
- case 1:
- PDF_set_parameter(pdf, "transition", "split");
- break;
- case 2:
- PDF_set_parameter(pdf, "transition", "blinds");
- break;
- case 3:
- PDF_set_parameter(pdf, "transition", "box");
- break;
- case 4:
- PDF_set_parameter(pdf, "transition", "wipe");
- break;
- case 5:
- PDF_set_parameter(pdf, "transition", "dissolve");
- break;
- case 6:
- PDF_set_parameter(pdf, "transition", "glitter");
- break;
- case 7:
- PDF_set_parameter(pdf, "transition", "replace");
- break;
- default:
- PDF_set_parameter(pdf, "transition", "none");
- }
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void pdf_set_duration(int pdfdoc, double duration)
- Sets duration between pages */
-PHP_FUNCTION(pdf_set_duration)
-{
- zval **arg1, **arg2;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_double_ex(arg2);
- PDF_set_value(pdf, "duration", (float) Z_DVAL_PP(arg2));
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ _php_pdf_open_image
- */
-static void _php_pdf_open_image(INTERNAL_FUNCTION_PARAMETERS, char *type)
-{
- zval **arg1, **arg2;
- PDF *pdf;
- int pdf_image;
- char *image;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_string_ex(arg2);
-
-#ifdef VIRTUAL_DIR
- virtual_filepath(Z_STRVAL_PP(arg2), &image);
-#else
- image = Z_STRVAL_PP(arg2);
-#endif
-
- pdf_image = PDF_open_image_file(pdf, type, image, "", 0);
-
- RETURN_LONG(pdf_image+PDFLIB_IMAGE_OFFSET);
-}
-/* }}} */
-
-/* {{{ proto int pdf_open_gif(int pdf, string giffile)
- Opens a GIF file and returns an image for placement in a pdf object */
-PHP_FUNCTION(pdf_open_gif)
-{
- _php_pdf_open_image(INTERNAL_FUNCTION_PARAM_PASSTHRU,"gif");
-}
-/* }}} */
-
-/* {{{ proto int pdf_open_jpeg(int pdf, string jpegfile)
- Opens a JPEG file and returns an image for placement in a PDF document */
-PHP_FUNCTION(pdf_open_jpeg)
-{
- _php_pdf_open_image(INTERNAL_FUNCTION_PARAM_PASSTHRU,"jpeg");
-}
-/* }}} */
-
-/* {{{ proto int pdf_open_png(int pdf, string pngfile)
- Opens a PNG file and returns an image for placement in a PDF document */
-PHP_FUNCTION(pdf_open_png)
-{
- _php_pdf_open_image(INTERNAL_FUNCTION_PARAM_PASSTHRU,"png");
-}
-/* }}} */
-
-/* {{{ proto int pdf_open_tiff(int pdf, string tifffile)
- Opens a TIFF file and returns an image for placement in a PDF document */
-PHP_FUNCTION(pdf_open_tiff)
-{
- _php_pdf_open_image(INTERNAL_FUNCTION_PARAM_PASSTHRU,"tiff");
-}
-/* }}} */
-
-/* {{{ proto int pdf_open_image_file(int pdf, string type, string file, string stringparam, int intparam)
- Opens an image file of the given type and returns an image for placement in a PDF document */
-PHP_FUNCTION(pdf_open_image_file)
-{
- zval **arg1, **arg2, **arg3, **arg4, **arg5;
- PDF *pdf;
- int pdf_image, argc;
- char *image;
-
- switch ((argc = ZEND_NUM_ARGS())) {
- case 3:
- if (zend_get_parameters_ex(3, &arg1, &arg2, &arg3) == FAILURE)
- WRONG_PARAM_COUNT;
- break;
- case 5:
- if (zend_get_parameters_ex(5, &arg1, &arg2, &arg3, &arg4, &arg5) == FAILURE)
- WRONG_PARAM_COUNT;
- break;
- default:
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_string_ex(arg2);
- convert_to_string_ex(arg3);
-
-#ifdef VIRTUAL_DIR
- virtual_filepath(Z_STRVAL_PP(arg3), &image);
-#else
- image = Z_STRVAL_PP(arg3);
-#endif
-
- if (argc == 3) {
- pdf_image = PDF_open_image_file(pdf, Z_STRVAL_PP(arg2), image, "", 0);
- } else {
- convert_to_string_ex(arg4);
- convert_to_long_ex(arg5);
- pdf_image = PDF_open_image_file(pdf, Z_STRVAL_PP(arg2), image, Z_STRVAL_PP(arg4), Z_LVAL_PP(arg5));
- }
-
- if (pdf_image == -1) {
- /* pdflib will do this for you, will throw some exception
- php_error(E_WARNING, "Could not open image: %s", image);
- */
- RETURN_FALSE;
- }
- RETURN_LONG(pdf_image+PDFLIB_IMAGE_OFFSET);
-
-}
-/* }}} */
-
-#if HAVE_LIBGD13
-/* {{{ proto int pdf_open_memory_image(int pdf, int image)
- Takes an GD image and returns an image for placement in a PDF document */
-PHP_FUNCTION(pdf_open_memory_image)
-{
- zval **arg1, **arg2;
- int i, j, color, count;
- int pdf_image;
- gdImagePtr im;
- unsigned char *buffer, *ptr;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
- ZEND_GET_RESOURCE_TYPE_ID(le_gd,"gd");
- if(!le_gd)
- {
- php_error(E_ERROR, "Unable to find handle for GD image stream. Please check the GD extension is loaded.");
- }
- ZEND_FETCH_RESOURCE(im, gdImagePtr, arg2, -1, "Image", le_gd);
-
- count = 3 * im->sx * im->sy;
- if(NULL == (buffer = (unsigned char *) emalloc(count))) {
- RETURN_FALSE;
- }
-
- ptr = buffer;
- for(i=0; i<im->sy; i++) {
- for(j=0; j<im->sx; j++) {
- color = im->pixels[i][j];
- *ptr++ = im->red[color];
- *ptr++ = im->green[color];
- *ptr++ = im->blue[color];
- }
- }
-
- pdf_image = PDF_open_image(pdf, "raw", "memory", buffer, im->sx*im->sy*3, im->sx, im->sy, 3, 8, NULL);
- efree(buffer);
-
- if(pdf_image == -1) {
- /* pdflib will do this for you, will throw some exception
- php_error(E_WARNING, "Could not open image");
- */
- efree(buffer);
- RETURN_FALSE;
- }
-
- RETURN_LONG(pdf_image+PDFLIB_IMAGE_OFFSET);
-}
-/* }}} */
-#endif /* HAVE_LIBGD13 */
-
-/* {{{ proto void pdf_close_image(int pdf, int pdfimage)
- Closes the PDF image */
-PHP_FUNCTION(pdf_close_image)
-{
- zval **arg1, **arg2;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
- convert_to_long_ex(arg2);
-
- PDF_close_image(pdf, Z_LVAL_PP(arg2)-PDFLIB_IMAGE_OFFSET);
-}
-/* }}} */
-
-/* {{{ proto void pdf_place_image(int pdf, int pdfimage, double x, double y, double scale)
- Places image in the PDF document */
-PHP_FUNCTION(pdf_place_image)
-{
- zval **arg1, **arg2, **arg3, **arg4, **arg5;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 5 || zend_get_parameters_ex(5, &arg1, &arg2, &arg3, &arg4, &arg5) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_long_ex(arg2);
- convert_to_double_ex(arg3);
- convert_to_double_ex(arg4);
- convert_to_double_ex(arg5);
-
- PDF_place_image(pdf, Z_LVAL_PP(arg2)-PDFLIB_IMAGE_OFFSET, (float) Z_DVAL_PP(arg3), (float) Z_DVAL_PP(arg4), (float) Z_DVAL_PP(arg5));
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int pdf_get_image_width(int pdf, int pdfimage)
- Returns the width of an image */
-PHP_FUNCTION(pdf_get_image_width)
-{
- zval **arg1, **arg2;
- PDF *pdf;
- int width;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
- convert_to_long_ex(arg2);
-
- width = (int) PDF_get_value(pdf, "imagewidth", (float)Z_LVAL_PP(arg2)-PDFLIB_IMAGE_OFFSET);
- RETURN_LONG(width);
-}
-/* }}} */
-
-/* {{{ proto int pdf_get_image_height(int pdf, int pdfimage)
- Returns the height of an image */
-PHP_FUNCTION(pdf_get_image_height)
-{
- zval **arg1, **arg2;
- PDF *pdf;
- int height;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
- convert_to_long_ex(arg2);
-
- height = (int) PDF_get_value(pdf, "imageheight", (float)Z_LVAL_PP(arg2)-PDFLIB_IMAGE_OFFSET);
- RETURN_LONG(height);
-}
-/* }}} */
-
-/* {{{ proto void pdf_add_weblink(int pdfdoc, double llx, double lly, double urx, double ury, string url)
- Adds link to web resource */
-PHP_FUNCTION(pdf_add_weblink)
-{
- zval **arg1, **arg2, **arg3, **arg4, **arg5, **arg6;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 6 || zend_get_parameters_ex(6, &arg1, &arg2, &arg3, &arg4, &arg5, &arg6) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_double_ex(arg2);
- convert_to_double_ex(arg3);
- convert_to_double_ex(arg4);
- convert_to_double_ex(arg5);
- convert_to_string_ex(arg6);
- PDF_add_weblink(pdf, (float) Z_DVAL_PP(arg2),
- (float) Z_DVAL_PP(arg3),
- (float) Z_DVAL_PP(arg4),
- (float) Z_DVAL_PP(arg5),
- Z_STRVAL_PP(arg6));
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void pdf_add_pdflink(int pdfdoc, double llx, double lly, double urx, double ury, string filename, int page, string dest)
- Adds link to PDF document */
-PHP_FUNCTION(pdf_add_pdflink)
-{
- zval **arg1, **arg2, **arg3, **arg4, **arg5, **arg6, **arg7, **arg8;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 8 || zend_get_parameters_ex(8, &arg1, &arg2, &arg3, &arg4, &arg5, &arg6, &arg7, &arg8) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_double_ex(arg2);
- convert_to_double_ex(arg3);
- convert_to_double_ex(arg4);
- convert_to_double_ex(arg5);
- convert_to_string_ex(arg6);
- convert_to_long_ex(arg7);
- convert_to_string_ex(arg8);
- PDF_add_pdflink(pdf, (float) Z_DVAL_PP(arg2),
- (float) Z_DVAL_PP(arg3),
- (float) Z_DVAL_PP(arg4),
- (float) Z_DVAL_PP(arg5),
- Z_STRVAL_PP(arg6),
- Z_LVAL_PP(arg7),
- Z_STRVAL_PP(arg8));
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void pdf_set_border_style(int pdfdoc, string style, double width)
- Sets style of box surounding all kinds of annotations and link */
-PHP_FUNCTION(pdf_set_border_style)
-{
- zval **arg1, **arg2, **arg3;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &arg1, &arg2, &arg3) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_string_ex(arg2);
- convert_to_double_ex(arg3);
- PDF_set_border_style(pdf, Z_STRVAL_PP(arg2), (float) Z_DVAL_PP(arg3));
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void pdf_set_border_color(int pdfdoc, double red, double green, double blue)
- Sets color of box surounded all kinds of annotations and links */
-PHP_FUNCTION(pdf_set_border_color)
-{
- zval **arg1, **arg2, **arg3, **arg4;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 4 || zend_get_parameters_ex(4, &arg1, &arg2, &arg3, &arg4) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_double_ex(arg2);
- convert_to_double_ex(arg3);
- convert_to_double_ex(arg4);
- PDF_set_border_color(pdf, (float) Z_DVAL_PP(arg2), (float) Z_DVAL_PP(arg3), (float) Z_DVAL_PP(arg4));
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void pdf_set_border_dash(int pdfdoc, double black, double white)
- Sets the border dash style of all kinds of annotations and links */
-PHP_FUNCTION(pdf_set_border_dash)
-{
- zval **arg1, **arg2, **arg3;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &arg1, &arg2, &arg3) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_double_ex(arg2);
- convert_to_double_ex(arg3);
- PDF_set_border_dash(pdf, (float) Z_DVAL_PP(arg2), (float) Z_DVAL_PP(arg3));
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void pdf_add_annotation(int pdfdoc, double xll, double yll, double xur, double xur, string title, string text)
- Sets annotation (depreciated use pdf_add_note instead) */
-PHP_FUNCTION(pdf_add_annotation)
-{
- zval **argv[7];
- PDF *pdf;
-
- if(ZEND_NUM_ARGS() != 7 || zend_get_parameters_array_ex(7, argv) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, argv[0], -1, "pdf object", le_pdf);
-
- convert_to_double_ex(argv[1]);
- convert_to_double_ex(argv[2]);
- convert_to_double_ex(argv[3]);
- convert_to_double_ex(argv[4]);
- convert_to_string_ex(argv[5]);
- convert_to_string_ex(argv[6]);
-
- PDF_add_note(pdf, (float) Z_DVAL_PP(argv[1]),
- (float) Z_DVAL_PP(argv[2]),
- (float) Z_DVAL_PP(argv[3]),
- (float) Z_DVAL_PP(argv[4]),
- Z_STRVAL_PP(argv[6]),
- Z_STRVAL_PP(argv[5]),
- "note", 1);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* RJS: START OF NEW CODE */
-
-/* {{{ proto int pdf_new()
- Creates a new PDF object */
-PHP_FUNCTION(pdf_new) {
- PDF *pdf;
-
- pdf = PDF_new2(custom_errorhandler, pdf_emalloc, pdf_realloc, pdf_efree, NULL);
-#if (PDFLIB_MAJORVERSION >= 4)
- PDF_set_parameter(pdf, "imagewarning", "true");
-#endif
- PDF_set_parameter(pdf, "binding", "PHP");
-
- ZEND_REGISTER_RESOURCE(return_value, pdf, le_pdf);
-}
-
-/* }}} */
-
-/* {{{ proto void pdf_delete(int pdfdoc)
- Deletes the PDF object */
-PHP_FUNCTION(pdf_delete) {
- zval **arg1;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- PDF_delete(pdf);
- zend_list_delete(Z_LVAL_PP(arg1));
-
- RETURN_TRUE;
-}
-
-/* }}} */
-
-/* {{{ proto int pdf_open_file(int pdfdoc [, char filename])
- Opens a new PDF document. If filename is NULL, document is created in memory. This is not yet fully supported */
-
-PHP_FUNCTION(pdf_open_file) {
- zval **arg1, **arg2;
- int pdf_file;
- char *filename;
- int argc;
- PDF *pdf;
-
- if((argc = ZEND_NUM_ARGS()) > 2)
- WRONG_PARAM_COUNT;
-
- if (argc == 1) {
- if (zend_get_parameters_ex(1, &arg1) == FAILURE)
- WRONG_PARAM_COUNT;
- } else {
- if (zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE)
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- if (argc == 2) {
- convert_to_string_ex(arg2);
- filename = Z_STRVAL_PP(arg2);
- pdf_file = PDF_open_file(pdf, filename);
- } else {
- /* open in memory */
- pdf_file = PDF_open_file(pdf, "");
- }
-
- if (pdf_file == -1)
- RETURN_FALSE;
-
- RETURN_TRUE;
-}
-
-/* }}} */
-
-/* {{{ proto int pdf_get_buffer(int pdfdoc)
- Fetches the full buffer containig the generated PDF data */
-PHP_FUNCTION(pdf_get_buffer) {
- zval **arg1;
- long size;
- PDF *pdf;
- const char *buffer;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- buffer = PDF_get_buffer(pdf, &size);
-
- RETURN_STRINGL((char *)buffer, size, 1);
-}
-
-/* }}} */
-
-/* {{{ proto int pdf_findfont(int pdfdoc, string fontname, string encoding [, int embed])
- Prepares the font fontname for later use with pdf_setfont() */
-PHP_FUNCTION(pdf_findfont) {
- zval **arg1, **arg2, **arg3, **arg4;
- int embed, font;
- const char *fontname, *encoding;
- PDF *pdf;
-
- switch (ZEND_NUM_ARGS()) {
- case 3:
- if (zend_get_parameters_ex(3, &arg1, &arg2, &arg3) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- embed = 0;
- break;
- case 4:
- if (zend_get_parameters_ex(4, &arg1, &arg2, &arg3, &arg4) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(arg4);
- embed = Z_LVAL_PP(arg4);
- break;
- default:
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_string_ex(arg2);
- fontname = Z_STRVAL_PP(arg2);
-
- convert_to_string_ex(arg3);
- encoding = Z_STRVAL_PP(arg3);
-
- font = PDF_findfont(pdf, fontname, encoding, embed);
- if (font == -1) {
- /* pdflib will do this for you, will throw some exception
- php_error(E_WARNING,"Font %s not found", fontname);
- */
- RETURN_FALSE;
- }
-
- RETURN_LONG(font+PDFLIB_FONT_OFFSET);
-}
-/* }}} */
-
-/* {{{ proto void pdf_setfont(int pdfdoc, int font, float fontsize)
- Sets the current font in the fiven fontsize */
-PHP_FUNCTION(pdf_setfont) {
- zval **arg1, **arg2, **arg3;
- int font;
- float fontsize;
- PDF *pdf;
-
- if(ZEND_NUM_ARGS() != 3)
- WRONG_PARAM_COUNT;
- if (zend_get_parameters_ex(3, &arg1, &arg2, &arg3) == FAILURE)
- WRONG_PARAM_COUNT;
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_long_ex(arg2);
- font = Z_LVAL_PP(arg2);
-
- convert_to_double_ex(arg3);
- fontsize = (float)Z_DVAL_PP(arg3);
-
- PDF_setfont(pdf, font-PDFLIB_FONT_OFFSET, fontsize);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void pdf_setpolydash(int pdfdoc, double darray)
- Sets more complicated dash pattern */
-
-PHP_FUNCTION(pdf_setpolydash) {
- zval **arg1, **arg2;
- HashTable *array;
- int len, i;
- float *darray;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_array_ex(arg2);
- array = Z_ARRVAL_PP(arg2);
- len = zend_hash_num_elements(array);
-
- if (NULL == (darray = emalloc(len * sizeof(double)))) {
- RETURN_FALSE;
- }
- zend_hash_internal_pointer_reset(array);
- for (i=0; i<len; i++) {
- zval *keydata, **keydataptr;
-
- zend_hash_get_current_data(array, (void **) &keydataptr);
- keydata = *keydataptr;
- if (keydata->type == IS_DOUBLE) {
- darray[i] = (float) keydata->value.dval;
- } else if (keydata->type == IS_LONG) {
- darray[i] = (float) keydata->value.lval;
- } else {
- php_error(E_WARNING,"PDFlib set_polydash: illegal darray value");
- }
- zend_hash_move_forward(array);
- }
-
- PDF_setpolydash(pdf, darray, len);
-
- efree(darray);
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void pdf_concat(int pdf, double a, double b, double c, double d, double e, double f)
- Concatenates a matrix to the current transformation matrix for text and graphics */
-PHP_FUNCTION(pdf_concat) {
- zval **arg1, **arg2, **arg3, **arg4, **arg5, **arg6, **arg7;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 7 || zend_get_parameters_ex(7, &arg1, &arg2, &arg3, &arg4, &arg5, &arg6, &arg7) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_double_ex(arg2);
- convert_to_double_ex(arg3);
- convert_to_double_ex(arg4);
- convert_to_double_ex(arg5);
- convert_to_double_ex(arg6);
- convert_to_double_ex(arg7);
-
- PDF_concat(pdf,
- (float) Z_DVAL_PP(arg2),
- (float) Z_DVAL_PP(arg3),
- (float) Z_DVAL_PP(arg4),
- (float) Z_DVAL_PP(arg5),
- (float) Z_DVAL_PP(arg6),
- (float) Z_DVAL_PP(arg7));
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int pdf_open_ccitt(int pdf, string filename, int width, int height, int bitreverse, int k, int blackls1)
- Opens an image file with raw CCITT G3 or G4 compresed bitmap data */
-PHP_FUNCTION(pdf_open_ccitt) {
- zval **arg1, **arg2, **arg3, **arg4, **arg5, **arg6, **arg7;
- PDF *pdf;
- int pdf_image;
- char *image;
-
- if (ZEND_NUM_ARGS() != 7 || zend_get_parameters_ex(7, &arg1, &arg2, &arg3, &arg4, &arg5, &arg6, &arg7) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_string_ex(arg2);
-#ifdef VIRTUAL_DIR
- virtual_filepath(Z_STRVAL_PP(arg2), &image);
-#else
- image = Z_STRVAL_PP(arg2);
-#endif
-
- convert_to_long_ex(arg3);
- convert_to_long_ex(arg4);
- convert_to_long_ex(arg5);
- convert_to_long_ex(arg6);
- convert_to_long_ex(arg7);
-
- pdf_image = PDF_open_CCITT(pdf,
- image,
- Z_LVAL_PP(arg3),
- Z_LVAL_PP(arg4),
- Z_LVAL_PP(arg5),
- Z_LVAL_PP(arg6),
- Z_LVAL_PP(arg7));
-
- RETURN_LONG(pdf_image+PDFLIB_IMAGE_OFFSET);
-}
-/* }}} */
-
-/* {{{ proto int pdf_open_image(int pdf, string type, string source, string data, long length, int width, int height, int components, int bpc, string params)
- Opens an image of the given type and returns an image for placement in a PDF document */
-PHP_FUNCTION(pdf_open_image) {
- zval **arg1, **arg2, **arg3, **arg4, **arg5, **arg6, **arg7, **arg8, **arg9, **arg10;
- PDF *pdf;
- int pdf_image;
- char *image;
-
- if (ZEND_NUM_ARGS() != 10 || zend_get_parameters_ex(10, &arg1, &arg2, &arg3, &arg4, &arg5, &arg6, &arg7, &arg8, &arg9, &arg10) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_string_ex(arg2);
- convert_to_string_ex(arg3);
- convert_to_string_ex(arg4);
- convert_to_long_ex(arg5);
- convert_to_long_ex(arg6);
- convert_to_long_ex(arg7);
- convert_to_long_ex(arg8);
- convert_to_long_ex(arg9);
- convert_to_string_ex(arg10);
-
-#ifdef VIRTUAL_DIR
- virtual_filepath(Z_STRVAL_PP(arg4), &image);
-#else
- image = Z_STRVAL_PP(arg4);
-#endif
-
- pdf_image = PDF_open_image(pdf,
- Z_STRVAL_PP(arg2),
- Z_STRVAL_PP(arg3),
- image,
- Z_LVAL_PP(arg5),
- Z_LVAL_PP(arg6),
- Z_LVAL_PP(arg7),
- Z_LVAL_PP(arg8),
- Z_LVAL_PP(arg9),
- Z_STRVAL_PP(arg10));
-
- RETURN_LONG(pdf_image+PDFLIB_IMAGE_OFFSET);
-}
-/* }}} */
-
-/* {{{ proto void pdf_attach_file(int pdf, double lly, double lly, double urx, double ury, string filename, string description, string author, string mimetype, string icon)
- Adds a file attachment annotation at the rectangle specified by his lower left and upper right corners */
-PHP_FUNCTION(pdf_attach_file) {
- zval **arg1, **arg2, **arg3, **arg4, **arg5, **arg6, **arg7, **arg8, **arg9, **arg10;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 10 || zend_get_parameters_ex(10, &arg1, &arg2, &arg3, &arg4, &arg5, &arg6, &arg7, &arg8, &arg9, &arg10) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_long_ex(arg2);
- convert_to_long_ex(arg3);
- convert_to_long_ex(arg4);
- convert_to_long_ex(arg5);
- convert_to_string_ex(arg6);
- convert_to_string_ex(arg7);
- convert_to_string_ex(arg8);
- convert_to_string_ex(arg9);
- convert_to_string_ex(arg10);
-
- PDF_attach_file(pdf,
- (float) Z_DVAL_PP(arg2),
- (float) Z_DVAL_PP(arg3),
- (float) Z_DVAL_PP(arg4),
- (float) Z_DVAL_PP(arg5),
- Z_STRVAL_PP(arg6),
- Z_STRVAL_PP(arg7),
- Z_STRVAL_PP(arg8),
- Z_STRVAL_PP(arg9),
- Z_STRVAL_PP(arg10));
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void pdf_add_note(int pdfdoc, double llx, double lly, double urx, double ury, string contents, string title, string icon, int open)
- Sets annotation */
-PHP_FUNCTION(pdf_add_note) {
- zval **arg1, **arg2, **arg3, **arg4, **arg5, **arg6, **arg7, **arg8, **arg9;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 9 || zend_get_parameters_ex(9, &arg1, &arg2, &arg3, &arg4, &arg5, &arg6, &arg7, &arg8, &arg9) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_double_ex(arg2);
- convert_to_double_ex(arg3);
- convert_to_double_ex(arg4);
- convert_to_double_ex(arg5);
- convert_to_string_ex(arg6);
- convert_to_string_ex(arg7);
- convert_to_string_ex(arg8);
- convert_to_long_ex(arg9);
-
- PDF_add_note(pdf,
- (float) Z_DVAL_PP(arg2),
- (float) Z_DVAL_PP(arg3),
- (float) Z_DVAL_PP(arg4),
- (float) Z_DVAL_PP(arg5),
- Z_STRVAL_PP(arg6),
- Z_STRVAL_PP(arg7),
- Z_STRVAL_PP(arg8),
- Z_LVAL_PP(arg9));
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void pdf_add_locallink(int pdfdoc, double llx, double lly, double urx, double ury, int page, string dest)
- Adds link to web resource */
-PHP_FUNCTION(pdf_add_locallink) {
- zval **arg1, **arg2, **arg3, **arg4, **arg5, **arg6, **arg7;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 7 || zend_get_parameters_ex(7, &arg1, &arg2, &arg3, &arg4, &arg5, &arg6, &arg7) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_double_ex(arg2);
- convert_to_double_ex(arg3);
- convert_to_double_ex(arg4);
- convert_to_double_ex(arg5);
- convert_to_long_ex(arg6);
- convert_to_string_ex(arg7);
-
- PDF_add_locallink(pdf,
- (float) Z_DVAL_PP(arg2),
- (float) Z_DVAL_PP(arg3),
- (float) Z_DVAL_PP(arg4),
- (float) Z_DVAL_PP(arg5),
- Z_LVAL_PP(arg6),
- Z_STRVAL_PP(arg7));
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void pdf_add_launchlink(int pdfdoc, double llx, double lly, double urx, double ury, string filename)
- Adds link to web resource */
-PHP_FUNCTION(pdf_add_launchlink) {
- zval **arg1, **arg2, **arg3, **arg4, **arg5, **arg6;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 6 || zend_get_parameters_ex(6, &arg1, &arg2, &arg3, &arg4, &arg5, &arg6) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_double_ex(arg2);
- convert_to_double_ex(arg3);
- convert_to_double_ex(arg4);
- convert_to_double_ex(arg5);
- convert_to_string_ex(arg6);
-
- PDF_add_launchlink(pdf,
- (float) Z_DVAL_PP(arg2),
- (float) Z_DVAL_PP(arg3),
- (float) Z_DVAL_PP(arg4),
- (float) Z_DVAL_PP(arg5),
- Z_STRVAL_PP(arg6));
-
- RETURN_TRUE;
-}
-/* }}} */
-
-#if (PDFLIB_MAJORVERSION >= 4)
-
-/* {{{ proto int pdf_open_pdi(int pdf, string filename, string stringparam, int intparam);
- * Open an existing PDF document and prepare it for later use. */
-PHP_FUNCTION(pdf_open_pdi) {
- zval **arg1, **arg2, **arg3, **arg4;
- PDF *pdf;
- int pdi_handle;
- char *file;
-
- if (ZEND_NUM_ARGS() != 4 || zend_get_parameters_ex(4, &arg1, &arg2, &arg3, &arg4) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_string_ex(arg2);
- convert_to_string_ex(arg3);
- convert_to_long_ex(arg4);
-
-#ifdef VIRTUAL_DIR
- virtual_filepath(Z_STRVAL_PP(arg2), &file);
-#else
- file = Z_STRVAL_PP(arg2);
-#endif
-
- pdi_handle = PDF_open_pdi(pdf,
- file,
- Z_STRVAL_PP(arg3),
- Z_LVAL_PP(arg4));
-
- RETURN_LONG(pdi_handle+PDFLIB_PDI_OFFSET);
-}
-/* }}} */
-
-/* {{{ proto void pdf_close_pdi(int pdf, int doc);
- * Close all open page handles, and close the input PDF document. */
-PHP_FUNCTION(pdf_close_pdi) {
- zval **arg1, **arg2;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_long_ex(arg2);
-
- PDF_close_pdi(pdf,
- Z_LVAL_PP(arg2)-PDFLIB_PDI_OFFSET);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int pdf_open_pdi_page(int pdf, int doc, int page, string label);
- * Prepare a page for later use with PDF_place_image(). */
-PHP_FUNCTION(pdf_open_pdi_page) {
- zval **arg1, **arg2, **arg3, **arg4;
- PDF *pdf;
- int pdi_image;
-
- if (ZEND_NUM_ARGS() != 4 || zend_get_parameters_ex(4, &arg1, &arg2, &arg3, &arg4) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_long_ex(arg2);
- convert_to_long_ex(arg3);
- convert_to_string_ex(arg4);
-
- pdi_image = PDF_open_pdi_page(pdf,
- Z_LVAL_PP(arg2)-PDFLIB_PDI_OFFSET,
- Z_LVAL_PP(arg3),
- Z_STRVAL_PP(arg4));
-
- RETURN_LONG(pdi_image+PDFLIB_IMAGE_OFFSET);
-}
-/* }}} */
-
-/* {{{ proto void pdf_place_pdi_page(int pdf, int page, double x, double y, double sx, double sy)
- * Place a PDF page with the lower left corner at (x, y), and scale it. */
-PHP_FUNCTION(pdf_place_pdi_page) {
- zval **arg1, **arg2, **arg3, **arg4, **arg5, **arg6;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 6 || zend_get_parameters_ex(6, &arg1, &arg2, &arg3, &arg4, &arg5, &arg6) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_long_ex(arg2);
- convert_to_double_ex(arg3);
- convert_to_double_ex(arg4);
- convert_to_double_ex(arg5);
- convert_to_double_ex(arg6);
-
- PDF_place_pdi_page(pdf,
- Z_LVAL_PP(arg2)-PDFLIB_IMAGE_OFFSET,
- (float) Z_DVAL_PP(arg3),
- (float) Z_DVAL_PP(arg4),
- (float) Z_DVAL_PP(arg5),
- (float) Z_DVAL_PP(arg6));
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void pdf_close_pdi_page(int pdf, int page);
- * Close the page handle, and free all page-related resources. */
-PHP_FUNCTION(pdf_close_pdi_page) {
- zval **arg1, **arg2;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_long_ex(arg2);
-
- PDF_close_pdi_page(pdf,
- Z_LVAL_PP(arg2)-PDFLIB_IMAGE_OFFSET);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto string pdf_get_pdi_parameter(int pdf, string key, int doc, int page, int index);
- * Get the contents of some PDI document parameter with string type. */
-PHP_FUNCTION(pdf_get_pdi_parameter) {
- zval **arg1, **arg2, **arg3, **arg4, **arg5;
- PDF *pdf;
- const char *buffer;
- int size;
-
- if (ZEND_NUM_ARGS() != 5 || zend_get_parameters_ex(5, &arg1, &arg2, &arg3, &arg4, &arg5) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_string_ex(arg2);
- convert_to_long_ex(arg3);
- convert_to_long_ex(arg4);
- convert_to_long_ex(arg5);
-
- buffer = PDF_get_pdi_parameter(pdf,
- Z_STRVAL_PP(arg2),
- Z_LVAL_PP(arg3)-PDFLIB_PDI_OFFSET,
- Z_LVAL_PP(arg4)-PDFLIB_IMAGE_OFFSET,
- Z_LVAL_PP(arg5),
- &size);
-
- RETURN_STRINGL((char *)buffer, size, 1);
-}
-/* }}} */
-
-/* {{{ proto double pdf_get_pdi_value(int pdf, string key, int doc, int page, int index);
- * Get the contents of some PDI document parameter with numerical type. */
-PHP_FUNCTION(pdf_get_pdi_value) {
- zval **arg1, **arg2, **arg3, **arg4, **arg5;
- PDF *pdf;
- double value;
-
- if (ZEND_NUM_ARGS() != 5 || zend_get_parameters_ex(5, &arg1, &arg2, &arg3, &arg4, &arg5) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_string_ex(arg2);
- convert_to_long_ex(arg3);
- convert_to_long_ex(arg4);
- convert_to_long_ex(arg5);
-
- value = (double)PDF_get_pdi_value(pdf,
- Z_STRVAL_PP(arg2),
- Z_LVAL_PP(arg3)-PDFLIB_PDI_OFFSET,
- Z_LVAL_PP(arg4)-PDFLIB_IMAGE_OFFSET,
- Z_LVAL_PP(arg5));
-
- RETURN_DOUBLE(value);
-}
-/* }}} */
-
-/* {{{ proto int pdf_begin_pattern(int pdf, double width, double height, double xstep, double ystep, int painttype);
- * Start a new pattern definition. */
-PHP_FUNCTION(pdf_begin_pattern) {
- zval **arg1, **arg2, **arg3, **arg4, **arg5, **arg6;
- PDF *pdf;
- int pattern_image;
-
- if (ZEND_NUM_ARGS() != 6 || zend_get_parameters_ex(6, &arg1, &arg2, &arg3, &arg4, &arg5, &arg6) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_double_ex(arg2);
- convert_to_double_ex(arg3);
- convert_to_double_ex(arg4);
- convert_to_double_ex(arg5);
- convert_to_long_ex(arg6);
-
- pattern_image = PDF_begin_pattern(pdf,
- (float) Z_DVAL_PP(arg2),
- (float) Z_DVAL_PP(arg3),
- (float) Z_DVAL_PP(arg4),
- (float) Z_DVAL_PP(arg5),
- Z_LVAL_PP(arg6));
-
- RETURN_LONG(pattern_image+PDFLIB_PATTERN_OFFSET);
-}
-/* }}} */
-
-/* {{{ proto void pdf_end_pattern(int pdf);
- * Finish the pattern definition. */
-PHP_FUNCTION(pdf_end_pattern) {
- zval **arg1;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- PDF_end_pattern(pdf);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int pdf_begin_template(int pdf, double width, double height);
- * Start a new template definition. */
-PHP_FUNCTION(pdf_begin_template) {
- zval **arg1, **arg2, **arg3;
- PDF *pdf;
- int tmpl_image;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &arg1, &arg2, &arg3) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_double_ex(arg2);
- convert_to_double_ex(arg3);
-
- tmpl_image = PDF_begin_template(pdf,
- (float) Z_DVAL_PP(arg2),
- (float) Z_DVAL_PP(arg3));
-
- RETURN_LONG(tmpl_image+PDFLIB_IMAGE_OFFSET);
-}
-/* }}} */
-
-/* {{{ proto void pdf_end_template(int pdf);
- * Finish the template definition. */
-PHP_FUNCTION(pdf_end_template) {
- zval **arg1;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
-
- PDF_end_template(pdf);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void pdf_setcolor(int pdf, string type, string colorspace, double c1 [, double c2 [, double c3 [, double c4]]]);
- * Set the current color space and color. */
-PHP_FUNCTION(pdf_setcolor) {
- zval **arg1, **arg2, **arg3, **arg4, **arg5, **arg6, **arg7;
- PDF *pdf;
- double c1;
- int argc = ZEND_NUM_ARGS();
-
- if(argc < 4 || argc > 7) {
- WRONG_PARAM_COUNT;
- }
- switch(argc) {
- case 4:
- if(zend_get_parameters_ex(4, &arg1, &arg2, &arg3, &arg4) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- break;
- case 5:
- if(zend_get_parameters_ex(5, &arg1, &arg2, &arg3, &arg4, &arg5) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- break;
- case 6:
- if(zend_get_parameters_ex(6, &arg1, &arg2, &arg3, &arg4, &arg5, &arg6) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- break;
- case 7:
- if(zend_get_parameters_ex(7, &arg1, &arg2, &arg3, &arg4, &arg5, &arg6, &arg7) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- break;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_string_ex(arg2);
- convert_to_string_ex(arg3);
- convert_to_double_ex(arg4);
- if(argc > 4) convert_to_double_ex(arg5);
- if(argc > 5) convert_to_double_ex(arg6);
- if(argc > 6) convert_to_double_ex(arg7);
-
- if (0 == (strcmp(Z_STRVAL_PP(arg3), "spot"))) {
- c1 = Z_DVAL_PP(arg4)-PDFLIB_SPOT_OFFSET;
- } else if(0 == (strcmp(Z_STRVAL_PP(arg3), "pattern"))) {
- c1 = Z_DVAL_PP(arg4)-PDFLIB_PATTERN_OFFSET;
- } else {
- c1 = Z_DVAL_PP(arg4);
- }
-
- PDF_setcolor(pdf,
- Z_STRVAL_PP(arg2),
- Z_STRVAL_PP(arg3),
- (float) c1,
- (float) ((argc>4) ? Z_DVAL_PP(arg5):0),
- (float) ((argc>5) ? Z_DVAL_PP(arg6):0),
- (float) ((argc>6) ? Z_DVAL_PP(arg7):0));
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int pdf_makespotcolor(int pdf, string spotname);
- * Make a named spot color from the current color. */
-PHP_FUNCTION(pdf_makespotcolor) {
- zval **arg1, **arg2;
- PDF *pdf;
- int spotcolor;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_string_ex(arg2);
-
- spotcolor = PDF_makespotcolor(pdf,
- Z_STRVAL_PP(arg2),
- Z_STRLEN_PP(arg2));
-
- RETURN_LONG(spotcolor+PDFLIB_SPOT_OFFSET);
-}
-/* }}} */
-
-/* {{{ proto void pdf_arcn(int pdf, double x, double y, double r, double alpha, double beta);
- * Draw a clockwise circular arc from alpha to beta degrees. */
-PHP_FUNCTION(pdf_arcn) {
- zval **arg1, **arg2, **arg3, **arg4, **arg5, **arg6;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 6 || zend_get_parameters_ex(6, &arg1, &arg2, &arg3, &arg4, &arg5, &arg6) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_double_ex(arg2);
- convert_to_double_ex(arg3);
- convert_to_double_ex(arg4);
- convert_to_double_ex(arg5);
- convert_to_double_ex(arg6);
-
- PDF_arcn(pdf,
- (float) Z_DVAL_PP(arg2),
- (float) Z_DVAL_PP(arg3),
- (float) Z_DVAL_PP(arg4),
- (float) Z_DVAL_PP(arg5),
- (float) Z_DVAL_PP(arg6));
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void pdf_initgraphics(int pdf);
- * Reset all implicit color and graphics state parameters to their defaults. */
-PHP_FUNCTION(pdf_initgraphics) {
- zval **arg1;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- PDF_initgraphics(pdf);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void pdf_add_thumbnail(int pdf, int image);
- * Add an existing image as thumbnail for the current page. */
-PHP_FUNCTION(pdf_add_thumbnail) {
- zval **arg1, **arg2;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_long_ex(arg2);
-
- PDF_add_thumbnail(pdf,
- Z_LVAL_PP(arg2)-PDFLIB_IMAGE_OFFSET);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void pdf_setmatrix(int pdf, double a, double b, double c, double d, double e, double f)
- Explicitly set the current transformation matrix. */
-PHP_FUNCTION(pdf_setmatrix) {
- zval **arg1, **arg2, **arg3, **arg4, **arg5, **arg6, **arg7;
- PDF *pdf;
-
- if (ZEND_NUM_ARGS() != 7 || zend_get_parameters_ex(7, &arg1, &arg2, &arg3, &arg4, &arg5, &arg6, &arg7) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
-
- convert_to_double_ex(arg2);
- convert_to_double_ex(arg3);
- convert_to_double_ex(arg4);
- convert_to_double_ex(arg5);
- convert_to_double_ex(arg6);
- convert_to_double_ex(arg7);
-
- PDF_setmatrix(pdf,
- (float) Z_DVAL_PP(arg2),
- (float) Z_DVAL_PP(arg3),
- (float) Z_DVAL_PP(arg4),
- (float) Z_DVAL_PP(arg5),
- (float) Z_DVAL_PP(arg6),
- (float) Z_DVAL_PP(arg7));
-
- RETURN_TRUE;
-}
-/* }}} */
-#endif /* PDFlib >= V4 */
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/pdf/pdf.dsp b/ext/pdf/pdf.dsp
deleted file mode 100644
index 654fe55421..0000000000
--- a/ext/pdf/pdf.dsp
+++ /dev/null
@@ -1,114 +0,0 @@
-# Microsoft Developer Studio Project File - Name="pdf" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=pdf - Win32 Release_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "pdf.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "pdf.mak" CFG="pdf - Win32 Release_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "pdf - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "pdf - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "pdf - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\..\Zend" /I "..\..\..\TSRM" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_PDF" /D ZTS=1 /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\TSRM" /D ZEND_DEBUG=0 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PDF_EXPORTS" /D "COMPILE_DL_PDF" /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_PDFLIB=1 /D ZTS=1 /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x406 /d "NDEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib /nologo /dll /machine:I386
-# ADD LINK32 php4ts.lib pdflib.lib zlib.lib libpng.lib libtiff.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_pdf.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
-# SUBTRACT LINK32 /pdb:none
-
-!ELSEIF "$(CFG)" == "pdf - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_PDF" /D ZTS=1 /YX /FD /c
-# ADD CPP /nologo /MDd /W3 /GX /ZI /Od /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\TSRM" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PDF_EXPORTS" /D "COMPILE_DL_PDF" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_PDFLIB=1 /FR /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x406 /d "NDEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts_debug.lib /nologo /dll /machine:I386
-# ADD LINK32 php4ts_debug.lib pdflib.lib zlib.lib libpng.lib libtiff.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"..\..\Debug_TS/php_pdf.dll" /libpath:"..\..\Debug_TS"
-
-!ENDIF
-
-# Begin Target
-
-# Name "pdf - Win32 Release_TS"
-# Name "pdf - Win32 Debug_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\pdf.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_pdf.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/ext/pdf/php_pdf.h b/ext/pdf/php_pdf.h
deleted file mode 100644
index f04431a5e2..0000000000
--- a/ext/pdf/php_pdf.h
+++ /dev/null
@@ -1,183 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Uwe Steinmann <Uwe.Steinmann@fernuni-hagen.de> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef PHP_PDF_H
-#define PHP_PDF_H
-
-#if HAVE_PDFLIB
-
-/* with version 2.20 of pdflib PDF_open_mem isn't available unless
- the following define isn't there.
-*/
-#define PDF_OPEN_MEM_SUPPORTED
-#include <pdflib.h>
-
-extern zend_module_entry pdf_module_entry;
-#define pdf_module_ptr &pdf_module_entry
-
-extern PHP_MINFO_FUNCTION(pdf);
-extern PHP_MINIT_FUNCTION(pdf);
-extern PHP_MSHUTDOWN_FUNCTION(pdf);
-PHP_FUNCTION(pdf_new); /* new function */
-PHP_FUNCTION(pdf_delete); /* new function */
-PHP_FUNCTION(pdf_open_file);
-PHP_FUNCTION(pdf_get_buffer); /* new function */
-PHP_FUNCTION(pdf_close);
-PHP_FUNCTION(pdf_begin_page);
-PHP_FUNCTION(pdf_end_page);
-PHP_FUNCTION(pdf_get_value);
-PHP_FUNCTION(pdf_set_value);
-PHP_FUNCTION(pdf_get_parameter);
-PHP_FUNCTION(pdf_set_parameter);
-PHP_FUNCTION(pdf_findfont); /* new function */
-PHP_FUNCTION(pdf_setfont); /* new function */
-PHP_FUNCTION(pdf_show);
-PHP_FUNCTION(pdf_show_xy);
-PHP_FUNCTION(pdf_continue_text);
-PHP_FUNCTION(pdf_show_boxed);
-PHP_FUNCTION(pdf_stringwidth); /* new parameters: [int font, float size] */
-PHP_FUNCTION(pdf_set_text_pos);
-PHP_FUNCTION(pdf_setdash);
-PHP_FUNCTION(pdf_setpolydash); /* new function: not yet finished */
-PHP_FUNCTION(pdf_setflat);
-PHP_FUNCTION(pdf_setlinejoin);
-PHP_FUNCTION(pdf_setlinecap);
-PHP_FUNCTION(pdf_setmiterlimit);
-PHP_FUNCTION(pdf_setlinewidth);
-PHP_FUNCTION(pdf_save);
-PHP_FUNCTION(pdf_restore);
-PHP_FUNCTION(pdf_translate);
-PHP_FUNCTION(pdf_scale);
-PHP_FUNCTION(pdf_rotate);
-PHP_FUNCTION(pdf_skew);
-PHP_FUNCTION(pdf_concat); /* new function */
-PHP_FUNCTION(pdf_moveto);
-PHP_FUNCTION(pdf_lineto);
-PHP_FUNCTION(pdf_curveto);
-PHP_FUNCTION(pdf_circle);
-PHP_FUNCTION(pdf_arc);
-PHP_FUNCTION(pdf_rect);
-PHP_FUNCTION(pdf_closepath);
-PHP_FUNCTION(pdf_stroke);
-PHP_FUNCTION(pdf_closepath_stroke);
-PHP_FUNCTION(pdf_fill);
-PHP_FUNCTION(pdf_fill_stroke);
-PHP_FUNCTION(pdf_closepath_fill_stroke);
-PHP_FUNCTION(pdf_clip);
-PHP_FUNCTION(pdf_endpath);
-PHP_FUNCTION(pdf_setgray_fill);
-PHP_FUNCTION(pdf_setgray_stroke);
-PHP_FUNCTION(pdf_setgray);
-PHP_FUNCTION(pdf_setrgbcolor_fill);
-PHP_FUNCTION(pdf_setrgbcolor_stroke);
-PHP_FUNCTION(pdf_setrgbcolor);
-PHP_FUNCTION(pdf_open_image_file); /* new parameters: [char *stringpram, int intparam] */
-PHP_FUNCTION(pdf_open_ccitt); /* new function */
-PHP_FUNCTION(pdf_open_image); /* new function: checkit not yet completeted :( */
-PHP_FUNCTION(pdf_close_image);
-PHP_FUNCTION(pdf_place_image);
-PHP_FUNCTION(pdf_add_bookmark);
-PHP_FUNCTION(pdf_set_info);
-PHP_FUNCTION(pdf_attach_file); /* new function */
-PHP_FUNCTION(pdf_add_note); /* new function */
-PHP_FUNCTION(pdf_add_pdflink);
-PHP_FUNCTION(pdf_add_locallink); /* new function */
-PHP_FUNCTION(pdf_add_launchlink); /* new function */
-PHP_FUNCTION(pdf_add_weblink);
-PHP_FUNCTION(pdf_set_border_style);
-PHP_FUNCTION(pdf_set_border_color);
-PHP_FUNCTION(pdf_set_border_dash);
-
-/* RJS:
- End of the official PDFLIB V3.x API */
-
-/* old font handling */
-PHP_FUNCTION(pdf_set_font); /* deprecated */
-PHP_FUNCTION(pdf_get_font); /* deprecated */
-PHP_FUNCTION(pdf_get_fontname); /* deprecated */
-PHP_FUNCTION(pdf_get_fontsize); /* deprecated */
-
-/* old way of starting a PDF document */
-PHP_FUNCTION(pdf_open); /* deprecated */
-
-/* old stuff for setting infos */
-PHP_FUNCTION(pdf_set_info_creator); /* deprecated */
-PHP_FUNCTION(pdf_set_info_title); /* deprecated */
-PHP_FUNCTION(pdf_set_info_subject); /* deprecated */
-PHP_FUNCTION(pdf_set_info_author); /* deprecated */
-PHP_FUNCTION(pdf_set_info_keywords); /* deprecated */
-PHP_FUNCTION(pdf_set_leading); /* deprecated */
-PHP_FUNCTION(pdf_set_text_rendering); /* deprecated */
-PHP_FUNCTION(pdf_set_horiz_scaling); /* deprecated */
-PHP_FUNCTION(pdf_set_text_rise); /* deprecated */
-PHP_FUNCTION(pdf_set_char_spacing); /* deprecated */
-PHP_FUNCTION(pdf_set_word_spacing); /* deprecated */
-PHP_FUNCTION(pdf_set_transition); /* deprecated */
-PHP_FUNCTION(pdf_set_duration); /* deprecated */
-PHP_FUNCTION(pdf_get_image_height); /* deprecated */
-PHP_FUNCTION(pdf_get_image_width); /* deprecated */
-
-/* old stuff for opening images */
-PHP_FUNCTION(pdf_open_jpeg); /* deprecated */
-PHP_FUNCTION(pdf_open_tiff); /* deprecated */
-PHP_FUNCTION(pdf_open_png); /* deprecated */
-PHP_FUNCTION(pdf_open_gif); /* deprecated */
-
-/* some more stuff for compatibility */
-PHP_FUNCTION(pdf_add_annotation);
-#if HAVE_LIBGD13
-PHP_FUNCTION(pdf_open_memory_image);
-#endif
-
-#if (PDFLIB_MAJORVERSION >= 4)
-/* support for new functions in PDFlib V4.0 */
-PHP_FUNCTION(pdf_open_pdi);
-PHP_FUNCTION(pdf_close_pdi);
-PHP_FUNCTION(pdf_open_pdi_page);
-PHP_FUNCTION(pdf_place_pdi_page);
-PHP_FUNCTION(pdf_close_pdi_page);
-PHP_FUNCTION(pdf_get_pdi_parameter);
-PHP_FUNCTION(pdf_get_pdi_value);
-PHP_FUNCTION(pdf_begin_pattern);
-PHP_FUNCTION(pdf_end_pattern);
-PHP_FUNCTION(pdf_setcolor);
-PHP_FUNCTION(pdf_makespotcolor);
-PHP_FUNCTION(pdf_begin_template);
-PHP_FUNCTION(pdf_end_template);
-PHP_FUNCTION(pdf_arcn);
-PHP_FUNCTION(pdf_add_thumbnail);
-PHP_FUNCTION(pdf_initgraphics);
-PHP_FUNCTION(pdf_setmatrix);
-#endif /* PDFlib >= V4 */
-
-#ifdef ZTS
-#define PDFG(v) (pdf_globals->v)
-#define PDFLS_FETCH() php_pdf_globals *pdf_globals = ts_resource(pdf_globals_id)
-#else
-#define PDFG(v) (pdf_globals.v)
-#define PDFLS_FETCH()
-#endif
-
-
-#else
-#define pdf_module_ptr NULL
-#endif
-#define phpext_pdf_ptr pdf_module_ptr
-#endif /* PHP_PDF_H */
diff --git a/ext/pdf/setup.stub b/ext/pdf/setup.stub
deleted file mode 100644
index a6df9c669c..0000000000
--- a/ext/pdf/setup.stub
+++ /dev/null
@@ -1,7 +0,0 @@
-# $Source$
-# $Id$
-
-define_option with-pdflib 'pdflib 0.6 support? ' yesnodir \
- 'no /usr/local pdflib install' \
-' Whether to use the pdflib support to write .pdf-files.\n
- Tested for version 0.6!'
diff --git a/ext/pfpro/CREDITS b/ext/pfpro/CREDITS
deleted file mode 100644
index 1b57a7f25b..0000000000
--- a/ext/pfpro/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-Verisign Payflow Pro
-John Donagher, David Croft
diff --git a/ext/pfpro/Makefile.in b/ext/pfpro/Makefile.in
deleted file mode 100644
index cbe71b99dc..0000000000
--- a/ext/pfpro/Makefile.in
+++ /dev/null
@@ -1,8 +0,0 @@
-# $Id$
-
-LTLIBRARY_NAME = libpfpro.la
-LTLIBRARY_SOURCES = pfpro.c
-LTLIBRARY_SHARED_NAME = pfpro.la
-LTLIBRARY_SHARED_LIBADD = $(PFPRO_SHARED_LIBADD)
-
-include $(top_srcdir)/build/dynlib.mk
diff --git a/ext/pfpro/TODO b/ext/pfpro/TODO
deleted file mode 100644
index a10a191e80..0000000000
--- a/ext/pfpro/TODO
+++ /dev/null
@@ -1,12 +0,0 @@
-John Donagher <jdonagher@php.net> - 20010501
-############################################
-- XMLPay support??
-- Add test cases
-
-pfpro_process[_raw]:
-- Expose API-level context control optionally to user
-- Figure out what Verisign's pfproCompleteTransaction() purpose is and why it
- corrupts the response data
-
-pfpro_process:
-- Fix response parsing to ignore delimiters [&=] in response data values
diff --git a/ext/pfpro/config.m4 b/ext/pfpro/config.m4
deleted file mode 100644
index 27853d9954..0000000000
--- a/ext/pfpro/config.m4
+++ /dev/null
@@ -1,63 +0,0 @@
-dnl $Id$
-dnl config.m4 for extension pfpro
-
-PHP_ARG_WITH(pfpro, whether to include Verisign Payflow Pro support,
-[ --with-pfpro[=DIR] Include Verisign Payflow Pro support])
-
-if test "$PHP_PFPRO" != "no"; then
- PFPRO_LIB=libpfpro.so
- PFPRO_HDR=pfpro.h
-
- for i in /usr/local /usr $PHP_PFPRO; do
- if test -r $i/$PFPRO_HDR; then
- PFPRO_INC_DIR=$i
- elif test -r $i/include/$PFPRO_HDR; then
- PFPRO_INC_DIR=$i/include
- elif test -r $i/lib/$PFPRO_HDR; then
- PFPRO_INC_DIR=$i/lib
- elif test -r $i/bin/$PFPRO_HDR; then
- PFPRO_INC_DIR=$i/bin
- fi
-
- if test -r $i/$PFPRO_LIB; then
- PFPRO_LIB_DIR=$i
- elif test -r $i/lib/$PFPRO_LIB; then
- PFPRO_LIB_DIR=$i/lib
- fi
- done
-
- if test -z "$PFPRO_INC_DIR"; then
- AC_MSG_ERROR(Could not find pfpro.h. Please make sure you have the
- Verisign Payflow Pro SDK installed. Use
- ./configure --with-pfpro=<pfpro-dir> if necessary)
- fi
-
- if test -z "$PFPRO_LIB_DIR"; then
- AC_MSG_ERROR(Could not find libpfpro.so. Please make sure you have the
- Verisign Payflow Pro SDK installed. Use
- ./configure --with-pfpro=<pfpro-dir> if necessary)
- fi
-
- PFPRO_VERSION3=`nm $PFPRO_LIB_DIR/$PFPRO_LIB | awk '{print $3}' | grep ^pfpro > /dev/null && echo 1 || echo 0`
- PFPRO_VERSION2=`nm $PFPRO_LIB_DIR/$PFPRO_LIB | awk '{print $3}' | grep ^PN > /dev/null && echo 1 || echo 0`
-
- if test "$PFPRO_VERSION3" -eq 1 ; then
- PFPRO_VERSION=3
- elif test "$PFPRO_VERSION2" -eq 1 ; then
- PFPRO_VERSION=2
- else
- AC_MSG_ERROR(The pfpro extension requires version 2 or 3 of the SDK)
- fi
-
- AC_DEFINE_UNQUOTED(PFPRO_VERSION, $PFPRO_VERSION, [Version of SDK])
- dnl AC_MSG_RESULT(found in $PFPRO_LIB_DIR)
-
- PHP_ADD_INCLUDE($PFPRO_INC_DIR)
-
- PHP_SUBST(PFPRO_SHARED_LIBADD)
- PHP_ADD_LIBRARY_WITH_PATH(pfpro, $PFPRO_LIB_DIR, PFPRO_SHARED_LIBADD)
-
- AC_DEFINE(HAVE_PFPRO, 1, [ ])
-
- PHP_EXTENSION(pfpro, $ext_shared)
-fi
diff --git a/ext/pfpro/pfpro.c b/ext/pfpro/pfpro.c
deleted file mode 100644
index b861af0a17..0000000000
--- a/ext/pfpro/pfpro.c
+++ /dev/null
@@ -1,604 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: David Croft <david@infotrek.co.uk>, |
- | John Donagher <john@webmeta.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-/* {{{ includes */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "php_ini.h"
-#include "php_pfpro.h"
-
-#include "pfpro.h"
-
-#if HAVE_PFPRO
-
-#include "ext/standard/php_string.h"
-/* }}} */
-
-/* {{{ zts */
-#ifdef ZTS
-int pfpro_globals_id;
-#else
-php_pfpro_globals pfpro_globals;
-#endif
-/* }}} */
-
-/* {{{ Function table */
-function_entry pfpro_functions[] = {
- PHP_FE(pfpro_version, NULL)
- PHP_FE(pfpro_init, NULL)
- PHP_FE(pfpro_cleanup, NULL)
- PHP_FE(pfpro_process_raw, NULL)
- PHP_FE(pfpro_process, NULL)
- {NULL, NULL, NULL}
-};
-/* }}} */
-
-/* {{{ Zend module entry */
-zend_module_entry pfpro_module_entry = {
- "pfpro",
- pfpro_functions,
- PHP_MINIT(pfpro),
- PHP_MSHUTDOWN(pfpro),
- PHP_RINIT(pfpro), /* request start */
- PHP_RSHUTDOWN(pfpro), /* request end */
- PHP_MINFO(pfpro),
- STANDARD_MODULE_PROPERTIES
-};
-/* }}} */
-
-/* {{{ dl() stuff */
-#ifdef COMPILE_DL_PFPRO
-ZEND_GET_MODULE(pfpro)
-#endif
-/* }}} */
-
-/* {{{ initialization defaults */
-PHP_INI_BEGIN()
- STD_PHP_INI_ENTRY("pfpro.defaulthost", "test.signio.com", PHP_INI_ALL, OnUpdateString, defaulthost, php_pfpro_globals, pfpro_globals)
- STD_PHP_INI_ENTRY("pfpro.defaultport", "443", PHP_INI_ALL, OnUpdateInt, defaultport, php_pfpro_globals, pfpro_globals)
- STD_PHP_INI_ENTRY("pfpro.defaulttimeout", "30", PHP_INI_ALL, OnUpdateInt, defaulttimeout, php_pfpro_globals, pfpro_globals)
- STD_PHP_INI_ENTRY("pfpro.proxyaddress", "", PHP_INI_ALL, OnUpdateString, proxyaddress, php_pfpro_globals, pfpro_globals)
- STD_PHP_INI_ENTRY("pfpro.proxyport", "", PHP_INI_ALL, OnUpdateInt, proxyport, php_pfpro_globals, pfpro_globals)
- STD_PHP_INI_ENTRY("pfpro.proxylogon", "", PHP_INI_ALL, OnUpdateString, proxylogon, php_pfpro_globals, pfpro_globals)
- STD_PHP_INI_ENTRY("pfpro.proxypassword", "", PHP_INI_ALL, OnUpdateString, proxypassword, php_pfpro_globals, pfpro_globals)
-PHP_INI_END()
-
-
-PHP_MINIT_FUNCTION(pfpro)
-{
- REGISTER_INI_ENTRIES();
- return SUCCESS;
-}
-
-PHP_MSHUTDOWN_FUNCTION(pfpro)
-{
- UNREGISTER_INI_ENTRIES();
- return SUCCESS;
-}
-
-PHP_RINIT_FUNCTION(pfpro)
-{
- PFPROLS_FETCH();
-
- PFPROG(initialized) = 0;
-
- return SUCCESS;
-}
-
-PHP_RSHUTDOWN_FUNCTION(pfpro)
-{
- PFPROLS_FETCH();
-
- if (PFPROG(initialized) == 1) {
- pfproCleanup();
- }
-
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ minfo registration */
-PHP_MINFO_FUNCTION(pfpro)
-{
- php_info_print_table_start();
- php_info_print_table_header(2, "Verisign Payflow Pro support", "enabled");
- php_info_print_table_row(2, "libpfpro version", pfproVersion());
- php_info_print_table_end();
-
- DISPLAY_INI_ENTRIES();
-}
-/* }}} */
-
-/* {{{ proto string pfpro_version()
- Returns the version of the Payflow Pro library */
-PHP_FUNCTION(pfpro_version)
-{
- if (ZEND_NUM_ARGS() != 0) {
- WRONG_PARAM_COUNT;
- }
-
- RETURN_STRING((char *)pfproVersion(), 1);
-}
-/* }}} */
-
-/* {{{ proto void pfpro_init()
- Initializes the Payflow Pro library */
-PHP_FUNCTION(pfpro_init)
-{
- PFPROLS_FETCH();
-
- if (ZEND_NUM_ARGS() != 0) {
- WRONG_PARAM_COUNT;
- }
-
- pfproInit();
-
- PFPROG(initialized) = 1;
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void pfpro_cleanup()
- Shuts down the Payflow Pro library */
-PHP_FUNCTION(pfpro_cleanup)
-{
- PFPROLS_FETCH();
-
- if (ZEND_NUM_ARGS() != 0) {
- WRONG_PARAM_COUNT;
- }
-
- pfproCleanup();
-
- PFPROG(initialized) = 0;
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto string pfpro_process_raw(string parmlist [, string hostaddress [, int port, [, int timeout [, string proxyAddress [, int proxyPort [, string proxyLogon [, string proxyPassword]]]]]]])
- Raw Payflow Pro transaction processing */
-PHP_FUNCTION(pfpro_process_raw)
-{
- zval ***args;
-
- char *parmlist = NULL;
- char *address = NULL;
- int port = PFPROG(defaultport);
- int timeout = PFPROG(defaulttimeout);
- char *proxyAddress = PFPROG(proxyaddress);
- int proxyPort = PFPROG(proxyport);
- char *proxyLogon = PFPROG(proxylogon);
- char *proxyPassword = PFPROG(proxypassword);
-
- int freeaddress = 0;
-
-#if PFPRO_VERSION < 3
- char response[512] = "";
-#else
- int context;
- char *response;
-#endif
-
- PFPROLS_FETCH();
-
- if (ZEND_NUM_ARGS() < 1 || ZEND_NUM_ARGS() > 8) {
- WRONG_PARAM_COUNT;
- }
-
- args = (zval ***) emalloc(sizeof(zval **) * ZEND_NUM_ARGS());
-
- if (zend_get_parameters_array_ex(ZEND_NUM_ARGS(), args) == FAILURE) {
- php_error(E_WARNING, "Unable to read parameters in pfpro_process_raw()");
- efree(args);
- RETURN_FALSE;
- }
-
- switch (ZEND_NUM_ARGS()) {
- case 8:
- convert_to_string_ex(args[7]);
- proxyPassword = (*args[7])->value.str.val;
- /* fall through */
-
- case 7:
- convert_to_string_ex(args[6]);
- proxyLogon = (*args[6])->value.str.val;
- /* fall through */
-
- case 6:
- convert_to_long_ex(args[5]);
- proxyPort = (*args[5])->value.lval;
- /* fall through */
-
- case 5:
- convert_to_string_ex(args[4]);
- proxyAddress = (*args[4])->value.str.val;
- /* fall through */
-
- case 4:
- convert_to_long_ex(args[3]);
- timeout = (*args[3])->value.lval;
- /* fall through */
-
- case 3:
- convert_to_long_ex(args[2]);
- port = (*args[2])->value.lval;
- /* fall through */
-
- case 2:
- convert_to_string_ex(args[1]);
- address = (*args[1])->value.str.val;
- }
-
- convert_to_string_ex(args[0]);
- parmlist = (*args[0])->value.str.val;
-
- efree(args);
-
- /* Default to signio's test server */
-
- if (address == NULL) {
- address = estrdup(PFPROG(defaulthost));
- freeaddress = 1;
- }
-
-#if PFPRO_VERSION < 3
- /* Blank the response buffer */
- memset(response, 0, sizeof(response));
-#endif
-
- /* Initialize the library if needed */
-
- if (PFPROG(initialized) == 0) {
- pfproInit();
- PFPROG(initialized) = 1;
- }
-
- /* Perform the transaction */
-
-#if PFPRO_VERSION < 3
- ProcessPNTransaction(address, port, proxyAddress, proxyPort, proxyLogon, proxyPassword, parmlist, strlen(parmlist), timeout, response);
-#else
- pfproCreateContext(&context, address, port, timeout, proxyAddress, proxyPort, proxyLogon, proxyPassword);
- pfproSubmitTransaction(context, parmlist, strlen(parmlist), &response);
- pfproDestroyContext(context);
-#endif
-
- if (freeaddress) {
- efree(address);
- }
-
- RETURN_STRING(response, 1);
-}
-/* }}} */
-
-/* {{{ proto array pfpro_process(array parmlist [, string hostaddress [, int port, [, int timeout [, string proxyAddress [, int proxyPort [, string proxyLogon [, string proxyPassword]]]]]]])
- Payflow Pro transaction processing using arrays */
-PHP_FUNCTION(pfpro_process)
-{
- zval ***args;
-
- HashTable *target_hash;
- ulong num_key;
- char *string_key;
- zval **entry;
- int pass;
-
- char *parmlist = NULL;
- char *address = NULL;
- int port = PFPROG(defaultport);
- int timeout = PFPROG(defaulttimeout);
- char *proxyAddress = PFPROG(proxyaddress);
- int proxyPort = PFPROG(proxyport);
- char *proxyLogon = PFPROG(proxylogon);
- char *proxyPassword = PFPROG(proxypassword);
-
- int parmlength = 0;
- int freeaddress = 0;
-
-#if PFPRO_VERSION < 3
- char response[512] = "";
-#else
- int context;
- char *response;
-#endif
-
- char tmpbuf[128];
-
- char buf[128], sbuf[128];
- char *p1, *p2, *p_end, /* Pointers for string manipulation */
- *sp1, *sp2,
- *pdelim1="&", *pdelim2="=";
-
- PFPROLS_FETCH();
-
- if (ZEND_NUM_ARGS() < 1 || ZEND_NUM_ARGS() > 8) {
- WRONG_PARAM_COUNT;
- }
-
- args = (zval ***) emalloc(sizeof(zval **) * ZEND_NUM_ARGS());
-
- if (zend_get_parameters_array_ex(ZEND_NUM_ARGS(), args) == FAILURE) {
- php_error(E_ERROR, "Unable to read parameters in pfpro_process()");
- efree(args);
- RETURN_FALSE;
- }
-
- if ((*args[0])->type != IS_ARRAY) {
- php_error(E_ERROR, "First parameter to pfpro_process() must be an array");
- efree(args);
- RETURN_FALSE;
- }
-
- switch (ZEND_NUM_ARGS()) {
- case 8:
- convert_to_string_ex(args[7]);
- proxyPassword = (*args[7])->value.str.val;
- /* fall through */
-
- case 7:
- convert_to_string_ex(args[6]);
- proxyLogon = (*args[6])->value.str.val;
- /* fall through */
-
- case 6:
- convert_to_long_ex(args[5]);
- proxyPort = (*args[5])->value.lval;
- /* fall through */
-
- case 5:
- convert_to_string_ex(args[4]);
- proxyAddress = (*args[4])->value.str.val;
- /* fall through */
-
- case 4:
- convert_to_long_ex(args[3]);
- timeout = (*args[3])->value.lval;
- /* fall through */
-
- case 3:
- convert_to_long_ex(args[2]);
- port = (*args[2])->value.lval;
- /* fall through */
-
- case 2:
- convert_to_string_ex(args[1]);
- address = (*args[1])->value.str.val;
- }
-
- /* Concatenate the passed array as specified by Verisign.
- Basically it's all key=value&key=value, the only exception
- being if the value contains = or &, in which case we also
- encode the length, e.g. key[5]=bl&ah */
-
- target_hash = HASH_OF(*args[0]);
-
- for (pass = 0; pass <= 1; pass ++) {
-
- parmlength = 0;
- /* we go around the array twice. the first time to calculate
- the string length, the second time to actually store it */
-
- zend_hash_internal_pointer_reset(target_hash);
-
- while (zend_hash_get_current_data(target_hash, (void **)&entry) == SUCCESS) {
-
- if (parmlength > 0) {
- if (pass == 1)
- strcpy(parmlist + parmlength, "&");
- parmlength += 1;
- }
-
- switch (zend_hash_get_current_key(target_hash, &string_key, &num_key, 0)) {
-
- case HASH_KEY_IS_STRING:
-
- if (pass == 1)
- strcpy(parmlist + parmlength, string_key);
- parmlength += strlen(string_key);
-
- break;
-
- case HASH_KEY_IS_LONG:
-
- sprintf(tmpbuf, "%d", num_key);
- if (pass == 1)
- strcpy(parmlist + parmlength, tmpbuf);
- parmlength += strlen(tmpbuf);
-
- break;
-
- default:
- php_error(E_ERROR, "pfpro_process() array keys must be strings or integers");
- efree(args);
- RETURN_FALSE;
- }
-
-
- switch ((*entry)->type) {
- case IS_STRING:
- if (strchr((*entry)->value.str.val, '&')
- || strchr((*entry)->value.str.val, '=')) {
- sprintf(tmpbuf, "[%d]=", (*entry)->value.str.len);
- if (pass == 1)
- strcpy(parmlist + parmlength, tmpbuf);
- parmlength += strlen(tmpbuf);
- }
- else {
- if (pass == 1)
- strcpy(parmlist + parmlength, "=");
- parmlength += 1;
- }
-
- if (pass == 1)
- strcpy(parmlist + parmlength, (*entry)->value.str.val);
- parmlength += (*entry)->value.str.len;
-
- break;
-
- case IS_LONG:
- sprintf(tmpbuf, "=%d", (*entry)->value.lval);
- if (pass == 1)
- strcpy(parmlist + parmlength, tmpbuf);
- parmlength += strlen(tmpbuf);
-
- break;
-
- case IS_DOUBLE:
- sprintf(tmpbuf, "=%.2f", (*entry)->value.dval);
- if (pass == 1)
- strcpy(parmlist + parmlength, tmpbuf);
- parmlength += strlen(tmpbuf);
-
- break;
-
- default:
- php_error(E_ERROR, "pfpro_process() array values must be strings, ints or floats");
- efree(args);
- RETURN_FALSE;
- }
- zend_hash_move_forward(target_hash);
- }
-
- if (pass == 0) {
- parmlist = emalloc(parmlength + 1);
- }
- }
-
- efree(args);
-
- /* Default to signio's test server */
-
- if (address == NULL) {
- /* is it safe to just do address = "test.signio.com"; here? */
- address = estrdup(PFPROG(defaulthost));
- freeaddress = 1;
- }
-
- /* Allocate the array for the response now - so we catch any errors
- from this BEFORE we knock it off to the bank */
-
- if (array_init(return_value) == FAILURE) {
- php_error(E_ERROR, "pfpro_process() unable to create array");
- RETURN_FALSE;
- }
-
-#if PFPRO_VERSION < 3
- /* Blank the response buffer */
- memset(response, 0, sizeof(response));
-#endif
-
- /* Initialize the library if needed */
-
- if (PFPROG(initialized) == 0) {
- pfproInit();
- PFPROG(initialized) = 1;
- }
-
- /* Perform the transaction */
-
-#if PFPRO_VERSION < 3
- ProcessPNTransaction(address, port, proxyAddress, proxyPort, proxyLogon, proxyPassword, parmlist, strlen(parmlist), timeout, response);
-#else
- pfproCreateContext(&context, address, port, timeout, proxyAddress, proxyPort, proxyLogon, proxyPassword);
- pfproSubmitTransaction(context, parmlist, strlen(parmlist), &response);
- pfproDestroyContext(context);
-#endif
-
- if (freeaddress) {
- efree(address);
- }
-
-
- /* This final chunk of code is to walk the string returned by Signio
- and build a string array to return to the user */
-
- /* John, I suspect this code will fall over if there are less than
- 3 items in the response string -- david */
-
- /* Clean our str[n]cpy buffers */
- memset(buf, 0, sizeof(buf));
- memset(sbuf, 0, sizeof(sbuf));
-
- p_end = response + strlen(response);
- p1 = response;
- p2 = (char*)php_memnstr(response, pdelim1, 1, p_end);
-
- sp1 = (char*)php_memnstr(response, pdelim2, 1, p2);
- strncpy(buf, p1, sp1-p1);
-
- sp1++;
- strncpy(sbuf, sp1, p2-sp1);
-
- add_assoc_string(return_value, &buf[0], &sbuf[0], 1);
-
- do {
- memset(buf, 0, sizeof(buf));
- memset(sbuf, 0, sizeof(sbuf));
-
- p1 = p2+1;
-
- if ((sp2 = (char*)php_memnstr(p1, pdelim1, 1, p_end)) != NULL) {
- sp1 = (char*)php_memnstr(p1, pdelim2, 1, sp2);
- strncpy(buf, p1, sp1-p1);
-
- sp1++;
-
- strncpy(sbuf, sp1, sp2-sp1);
-
- add_assoc_string(return_value, &buf[0], &sbuf[0], 1);
- }
-
-
- } while ((p2 = (char*)php_memnstr(p1, pdelim1, 1, p_end)) != NULL);
-
- if (p1 <= p_end) {
- memset(buf, 0, sizeof(buf));
- memset(sbuf, 0, sizeof(sbuf));
-
- sp1 = (char*)php_memnstr(p1, pdelim2, 1, p_end);
- strncpy(buf, p1, sp1-p1);
-
- sp1++;
- strncpy(sbuf, sp1, p_end-sp1);
-
- add_assoc_string(return_value, &buf[0], &sbuf[0], 1);
- }
-
-
-}
-/* }}} */
-
-#endif /* HAVE_PFPRO */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/pfpro/php_pfpro.h b/ext/pfpro/php_pfpro.h
deleted file mode 100644
index 1f97100fd0..0000000000
--- a/ext/pfpro/php_pfpro.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: David Croft <david@infotrek.co.uk> |
- | John Donagher <john@webmeta.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef PHP_PFPRO_H
-#define PHP_PFPRO_H
-
-#if HAVE_PFPRO
-
-extern zend_module_entry pfpro_module_entry;
-#define phpext_pfpro_ptr &pfpro_module_entry
-
-#ifdef PHP_WIN32
-#define PHP_PFPRO_API __declspec(dllexport)
-#else
-#define PHP_PFPRO_API
-#endif
-
-#if PFPRO_VERSION < 3
-#define pfproVersion() PNVersion()
-#define pfproInit() PNInit()
-#define pfproCleanup() PNCleanup()
-#endif
-
-PHP_MINIT_FUNCTION(pfpro);
-PHP_MSHUTDOWN_FUNCTION(pfpro);
-PHP_RINIT_FUNCTION(pfpro);
-PHP_RSHUTDOWN_FUNCTION(pfpro);
-PHP_MINFO_FUNCTION(pfpro);
-
-PHP_FUNCTION(pfpro_version); /* Return library version */
-PHP_FUNCTION(pfpro_init); /* Initialise pfpro gateway */
-PHP_FUNCTION(pfpro_cleanup); /* Shut down cleanly */
-PHP_FUNCTION(pfpro_process_raw); /* Raw transaction processing */
-PHP_FUNCTION(pfpro_process); /* Transaction processing */
-
-typedef struct {
- int le_pfpro;
- int initialized;
- char *defaulthost;
- int defaultport;
- int defaulttimeout;
- char *proxyaddress;
- int proxyport;
- char *proxylogon;
- char *proxypassword;
-} php_pfpro_globals;
-
-#ifdef ZTS
-#define PFPROG(v) (pfpro_globals->v)
-#define PFPROLS_FETCH() php_pfpro_globals *pfpro_globals = ts_resource(gd_pfpro_id)
-#else
-#define PFPROG(v) (pfpro_globals.v)
-#define PFPROLS_FETCH()
-#endif
-
-#else
-
-#define phpext_pfpro_ptr NULL
-
-#endif
-
-#endif /* PHP_PFPRO_H */
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/pgsql/CREDITS b/ext/pgsql/CREDITS
deleted file mode 100644
index 5a051bdcf0..0000000000
--- a/ext/pgsql/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-PostgreSQL
-Jouni Ahto, Zeev Suraski
diff --git a/ext/pgsql/Makefile.in b/ext/pgsql/Makefile.in
deleted file mode 100644
index 58324d5d3c..0000000000
--- a/ext/pgsql/Makefile.in
+++ /dev/null
@@ -1,9 +0,0 @@
-
-LTLIBRARY_NAME = libpgsql.la
-LTLIBRARY_SOURCES = pgsql.c
-LTLIBRARY_SHARED_NAME = pgsql.la
-LTLIBRARY_SHARED_LIBADD = $(PGSQL_SHARED_LIBADD)
-
-EXTRA_INCLUDES = $(PGSQL_INCLUDE)
-
-include $(top_srcdir)/build/dynlib.mk
diff --git a/ext/pgsql/config.m4 b/ext/pgsql/config.m4
deleted file mode 100644
index 90f1ecf6cc..0000000000
--- a/ext/pgsql/config.m4
+++ /dev/null
@@ -1,46 +0,0 @@
-dnl $Id$
-
-AC_DEFUN(PGSQL_INC_CHK,[if test -r $i$1/libpq-fe.h; then PGSQL_DIR=$i; PGSQL_INCDIR=$i$1])
-
-PHP_ARG_WITH(pgsql,for PostgreSQL support,
-[ --with-pgsql[=DIR] Include PostgreSQL support. DIR is the PostgreSQL
- base install directory, defaults to /usr/local/pgsql.
- Set DIR to "shared" to build as a dl, or "shared,DIR"
- to build as a dl and still specify DIR.])
-
-if test "$PHP_PGSQL" != "no"; then
- PHP_EXPAND_PATH($PHP_PGSQL, PHP_PGSQL)
- for i in /usr /usr/local /usr/local/pgsql $PHP_PGSQL; do
- PGSQL_INC_CHK(/include)
- el[]PGSQL_INC_CHK(/include/pgsql)
- el[]PGSQL_INC_CHK(/include/postgresql)
- fi
- done
-
- if test -z "$PGSQL_DIR"; then
- AC_MSG_RESULT(Cannot find libpq-fe.h. Please specify the installation path of PostgreSQL)
- fi
-
- PGSQL_INCLUDE=-I$PGSQL_INCDIR
- PGSQL_LIBDIR=$PGSQL_DIR/lib
- test -d $PGSQL_DIR/lib/pgsql && PGSQL_LIBDIR=$PGSQL_DIR/lib/pgsql
-
- old_LIBS=$LIBS
- old_LDFLAGS=$LDFLAGS
- LDFLAGS="$LDFLAGS -L$PGSQL_LIBDIR"
- AC_CHECK_LIB(pq, PQcmdTuples,AC_DEFINE(HAVE_PQCMDTUPLES,1,[ ]))
- AC_CHECK_LIB(pq, PQoidValue,AC_DEFINE(HAVE_PQOIDVALUE,1,[ ]))
- AC_CHECK_LIB(pq, PQclientEncoding,AC_DEFINE(HAVE_PQCLIENTENCODING,1,[ ]))
- AC_CHECK_LIB(pq, pg_encoding_to_char,AC_DEFINE(HAVE_PGSQL_WITH_MULTIBYTE_SUPPORT,1,[ ]))
- LIBS=$old_LIBS
- LDFLAGS=$old_LDFLAGS
-
- AC_DEFINE(HAVE_PGSQL,1,[ ])
-
- PHP_ADD_LIBRARY_WITH_PATH(pq, $PGSQL_LIBDIR, PGSQL_SHARED_LIBADD)
-
- PHP_EXTENSION(pgsql,$ext_shared)
-fi
-
-PHP_SUBST(PGSQL_INCLUDE)
-PHP_SUBST(PGSQL_SHARED_LIBADD)
diff --git a/ext/pgsql/pgsql.c b/ext/pgsql/pgsql.c
deleted file mode 100644
index c1bb10e486..0000000000
--- a/ext/pgsql/pgsql.c
+++ /dev/null
@@ -1,2002 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Zeev Suraski <zeev@zend.com> |
- | Jouni Ahto <jouni.ahto@exdec.fi> (large object interface) |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#include <stdlib.h>
-
-#define PHP_PGSQL_PRIVATE 1
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "php_ini.h"
-#include "ext/standard/php_standard.h"
-#include "php_pgsql.h"
-#include "php_globals.h"
-
-#if HAVE_PGSQL
-
-#ifndef InvalidOid
-#define InvalidOid ((Oid) 0)
-#endif
-
-#define PGSQL_ASSOC 1<<0
-#define PGSQL_NUM 1<<1
-#define PGSQL_BOTH (PGSQL_ASSOC|PGSQL_NUM)
-
-#define CHECK_DEFAULT_LINK(x) if (x == -1) { php_error(E_WARNING, "%s: no PostgreSQL link opened yet", get_active_function_name()); }
-
-/* {{{ pgsql_functions[]
- */
-function_entry pgsql_functions[] = {
- PHP_FE(pg_connect, NULL)
- PHP_FE(pg_pconnect, NULL)
- PHP_FE(pg_close, NULL)
- PHP_FE(pg_cmdtuples, NULL)
- PHP_FE(pg_last_notice, NULL)
- PHP_FE(pg_dbname, NULL)
- PHP_FE(pg_errormessage, NULL)
- PHP_FE(pg_trace, NULL)
- PHP_FE(pg_untrace, NULL)
- PHP_FE(pg_options, NULL)
- PHP_FE(pg_port, NULL)
- PHP_FE(pg_tty, NULL)
- PHP_FE(pg_host, NULL)
- PHP_FE(pg_exec, NULL)
- PHP_FE(pg_numrows, NULL)
- PHP_FE(pg_numfields, NULL)
- PHP_FE(pg_fieldname, NULL)
- PHP_FE(pg_fieldsize, NULL)
- PHP_FE(pg_fieldtype, NULL)
- PHP_FE(pg_fieldnum, NULL)
- PHP_FE(pg_result, NULL)
- PHP_FE(pg_fetch_row, NULL)
- PHP_FE(pg_fetch_array, NULL)
- PHP_FE(pg_fetch_object, NULL)
- PHP_FE(pg_fieldprtlen, NULL)
- PHP_FE(pg_fieldisnull, NULL)
- PHP_FE(pg_freeresult, NULL)
- PHP_FE(pg_getlastoid, NULL)
- PHP_FE(pg_locreate, NULL)
- PHP_FE(pg_lounlink, NULL)
- PHP_FE(pg_loopen, NULL)
- PHP_FE(pg_loclose, NULL)
- PHP_FE(pg_loread, NULL)
- PHP_FE(pg_lowrite, NULL)
- PHP_FE(pg_loreadall, NULL)
- PHP_FE(pg_loimport, NULL)
- PHP_FE(pg_loexport, NULL)
- PHP_FE(pg_put_line, NULL)
- PHP_FE(pg_end_copy, NULL)
-#if HAVE_PQCLIENTENCODING
- PHP_FE(pg_client_encoding, NULL)
- PHP_FE(pg_set_client_encoding, NULL)
- /* for downwards compatibility */
- PHP_FALIAS(pg_clientencoding, pg_client_encoding, NULL)
- PHP_FALIAS(pg_setclientencoding, pg_set_client_encoding, NULL)
-#endif
- {NULL, NULL, NULL}
-};
-/* }}} */
-
-/* {{{ pgsql_module_entry
- */
-zend_module_entry pgsql_module_entry = {
- "pgsql",
- pgsql_functions,
- PHP_MINIT(pgsql),
- PHP_MSHUTDOWN(pgsql),
- PHP_RINIT(pgsql),
- PHP_RSHUTDOWN(pgsql),
- PHP_MINFO(pgsql),
- STANDARD_MODULE_PROPERTIES
-};
-/* }}} */
-
-#ifdef COMPILE_DL_PGSQL
-ZEND_GET_MODULE(pgsql)
-#endif
-
-static int le_link, le_plink, le_result, le_lofp, le_string;
-
-#ifdef ZTS
-int pgsql_globals_id;
-#else
-PHP_PGSQL_API php_pgsql_globals pgsql_globals;
-#endif
-
-/* {{{ php_pgsql_set_default_link
- */
-static void php_pgsql_set_default_link(int id)
-{
- PGLS_FETCH();
-
- zend_list_addref(id);
-
- if (PGG(default_link) != -1) {
- zend_list_delete(PGG(default_link));
- }
-
- PGG(default_link) = id;
-}
-/* }}} */
-
-/* {{{ _close_pgsql_link
- */
-static void _close_pgsql_link(zend_rsrc_list_entry *rsrc)
-{
- PGconn *link = (PGconn *)rsrc->ptr;
- PGLS_FETCH();
-
- PQfinish(link);
- PGG(num_links)--;
-}
-/* }}} */
-
-/* {{{ _close_pgsql_plink
- */
-static void _close_pgsql_plink(zend_rsrc_list_entry *rsrc)
-{
- PGconn *link = (PGconn *)rsrc->ptr;
- PGLS_FETCH();
-
- PQfinish(link);
- PGG(num_persistent)--;
- PGG(num_links)--;
- if(PGG(last_notice) != NULL) {
- efree(PGG(last_notice));
- }
-}
-/* }}} */
-
-/* {{{ _notice_handler
- */
-static void
-_notice_handler(void *arg, const char *message)
-{
- PGLS_FETCH();
-
- if (! PGG(ignore_notices)) {
- php_log_err((char *) message);
- if (PGG(last_notice) != NULL) {
- efree(PGG(last_notice));
- }
- PGG(last_notice) = estrdup(message);
- }
-}
-/* }}} */
-
-/* {{{ _rollback_transactions
- */
-static int _rollback_transactions(zend_rsrc_list_entry *rsrc)
-{
- PGconn *link;
- PGLS_FETCH();
-
- if (rsrc->type != le_plink)
- return 0;
-
- link = (PGconn *) rsrc->ptr;
-
- PGG(ignore_notices) = 1;
- PQexec(link,"BEGIN;ROLLBACK;");
- PGG(ignore_notices) = 0;
-
- return 0;
-}
-/* }}} */
-
-/* {{{ _free_ptr
- */
-static void _free_ptr(zend_rsrc_list_entry *rsrc)
-{
- pgLofp *lofp = (pgLofp *)rsrc->ptr;
- efree(lofp);
-}
-/* }}} */
-
-/* {{{ _free_result
- */
-static void _free_result(zend_rsrc_list_entry *rsrc)
-{
- pgsql_result_handle *pg_result = (pgsql_result_handle *)rsrc->ptr;
- PQclear(pg_result->result);
- efree(pg_result);
-}
-/* }}} */
-
-/* {{{ PHP_INI
- */
-PHP_INI_BEGIN()
- STD_PHP_INI_BOOLEAN("pgsql.allow_persistent", "1", PHP_INI_SYSTEM, OnUpdateInt, allow_persistent, php_pgsql_globals, pgsql_globals)
- STD_PHP_INI_ENTRY_EX("pgsql.max_persistent", "-1", PHP_INI_SYSTEM, OnUpdateInt, max_persistent, php_pgsql_globals, pgsql_globals, display_link_numbers)
- STD_PHP_INI_ENTRY_EX("pgsql.max_links", "-1", PHP_INI_SYSTEM, OnUpdateInt, max_links, php_pgsql_globals, pgsql_globals, display_link_numbers)
-PHP_INI_END()
-/* }}} */
-
-/* {{{ php_pgsql_init_globals
- */
-static void php_pgsql_init_globals(PGLS_D)
-{
- PGG(num_persistent) = 0;
- PGG(ignore_notices) = 0;
- PGG(last_notice) = NULL;
-}
-/* }}} */
-
-/* {{{ PHP_MINIT_FUNCTION
- */
-PHP_MINIT_FUNCTION(pgsql)
-{
-#ifdef ZTS
- pgsql_globals_id = ts_allocate_id(sizeof(php_pgsql_globals), (ts_allocate_ctor) php_pgsql_init_globals, NULL);
-#else
- php_pgsql_init_globals(PGLS_C);
-#endif
-
- REGISTER_INI_ENTRIES();
-
- le_link = zend_register_list_destructors_ex(_close_pgsql_link, NULL, "pgsql link", module_number);
- le_plink = zend_register_list_destructors_ex(NULL, _close_pgsql_plink, "pgsql link persistent", module_number);
- /* PGG(le_result = register_list_destructors(PQclear,NULL); */
- le_result = zend_register_list_destructors_ex(_free_result, NULL, "pgsql result", module_number);
- le_lofp = zend_register_list_destructors_ex(_free_ptr, NULL, "pgsql large object", module_number);
- le_string = zend_register_list_destructors_ex(_free_ptr, NULL, "pgsql string", module_number);
-
- REGISTER_LONG_CONSTANT("PGSQL_ASSOC", PGSQL_ASSOC, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("PGSQL_NUM", PGSQL_NUM, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("PGSQL_BOTH", PGSQL_BOTH, CONST_CS | CONST_PERSISTENT);
-
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_MSHUTDOWN_FUNCTION
- */
-PHP_MSHUTDOWN_FUNCTION(pgsql)
-{
- UNREGISTER_INI_ENTRIES();
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_RINIT_FUNCTION
- */
-PHP_RINIT_FUNCTION(pgsql)
-{
- PGLS_FETCH();
-
- PGG(default_link)=-1;
- PGG(num_links) = PGG(num_persistent);
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_RSHUTDOWN_FUNCTION
- */
-PHP_RSHUTDOWN_FUNCTION(pgsql)
-{
- ELS_FETCH();
- zend_hash_apply(&EG(persistent_list), (apply_func_t) _rollback_transactions);
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_MINFO_FUNCTION
- */
-PHP_MINFO_FUNCTION(pgsql)
-{
- char buf[32];
- PGLS_FETCH();
-
- php_info_print_table_start();
- php_info_print_table_header(2, "PostgreSQL Support", "enabled");
- sprintf(buf, "%ld", PGG(num_persistent));
- php_info_print_table_row(2, "Active Persistent Links", buf);
- sprintf(buf, "%ld", PGG(num_links));
- php_info_print_table_row(2, "Active Links", buf);
- php_info_print_table_end();
-
- DISPLAY_INI_ENTRIES();
-
-}
-/* }}} */
-
-
-/* {{{ php_pgsql_do_connect
- */
-void php_pgsql_do_connect(INTERNAL_FUNCTION_PARAMETERS,int persistent)
-{
- char *host=NULL,*port=NULL,*options=NULL,*tty=NULL,*dbname=NULL,*connstring=NULL;
- char *hashed_details;
- int hashed_details_length;
- PGconn *pgsql;
- PGLS_FETCH();
-
- switch(ZEND_NUM_ARGS()) {
- case 1: { /* new style, using connection string */
- zval **yyconnstring;
- if (zend_get_parameters_ex(1, &yyconnstring) == FAILURE) {
- RETURN_FALSE;
- }
- convert_to_string_ex(yyconnstring);
- connstring = Z_STRVAL_PP(yyconnstring);
- hashed_details_length = Z_STRLEN_PP(yyconnstring)+5+1;
- hashed_details = (char *) emalloc(hashed_details_length+1);
- sprintf(hashed_details, "pgsql_%s", connstring); /* SAFE */
- }
- break;
- case 3: { /* host, port, dbname */
- zval **yyhost, **yyport, **yydbname;
-
- if (zend_get_parameters_ex(3, &yyhost, &yyport, &yydbname) == FAILURE) {
- RETURN_FALSE;
- }
- convert_to_string_ex(yyhost);
- convert_to_string_ex(yyport);
- convert_to_string_ex(yydbname);
- host = Z_STRVAL_PP(yyhost);
- port = Z_STRVAL_PP(yyport);
- dbname = Z_STRVAL_PP(yydbname);
- options=tty=NULL;
- hashed_details_length = Z_STRLEN_PP(yyhost) + Z_STRLEN_PP(yyport) + Z_STRLEN_PP(yydbname) + 5 + 5;
- hashed_details = (char *) emalloc(hashed_details_length+1);
- sprintf(hashed_details, "pgsql_%s_%s___%s", host, port, dbname); /* SAFE */
- }
- break;
- case 4: { /* host, port, options, dbname */
- zval **yyhost, **yyport, **yyoptions, **yydbname;
-
- if (zend_get_parameters_ex(4, &yyhost, &yyport, &yyoptions, &yydbname) == FAILURE) {
- RETURN_FALSE;
- }
- convert_to_string_ex(yyhost);
- convert_to_string_ex(yyport);
- convert_to_string_ex(yyoptions);
- convert_to_string_ex(yydbname);
- host = Z_STRVAL_PP(yyhost);
- port = Z_STRVAL_PP(yyport);
- options = Z_STRVAL_PP(yyoptions);
- dbname = Z_STRVAL_PP(yydbname);
- tty=NULL;
- hashed_details_length = Z_STRLEN_PP(yyhost) + Z_STRLEN_PP(yyport) + Z_STRLEN_PP(yyoptions) + Z_STRLEN_PP(yydbname) + 5 + 5;
- hashed_details = (char *) emalloc(hashed_details_length+1);
- sprintf(hashed_details, "pgsql_%s_%s_%s__%s", host, port, options, dbname); /* SAFE */
- }
- break;
- case 5: { /* host, port, options, tty, dbname */
- zval **yyhost, **yyport, **yyoptions, **yytty, **yydbname;
-
- if (zend_get_parameters_ex(5, &yyhost, &yyport, &yyoptions, &yytty, &yydbname) == FAILURE) {
- RETURN_FALSE;
- }
- convert_to_string_ex(yyhost);
- convert_to_string_ex(yyport);
- convert_to_string_ex(yyoptions);
- convert_to_string_ex(yytty);
- convert_to_string_ex(yydbname);
- host = Z_STRVAL_PP(yyhost);
- port = Z_STRVAL_PP(yyport);
- options = Z_STRVAL_PP(yyoptions);
- tty = Z_STRVAL_PP(yytty);
- dbname = Z_STRVAL_PP(yydbname);
- hashed_details_length = Z_STRLEN_PP(yyhost) + Z_STRLEN_PP(yyport) + Z_STRLEN_PP(yyoptions) + Z_STRLEN_PP(yytty) + Z_STRLEN_PP(yydbname) + 5 + 5;
- hashed_details = (char *) emalloc(hashed_details_length+1);
- sprintf(hashed_details, "pgsql_%s_%s_%s_%s_%s", host, port, options, tty, dbname); /* SAFE */
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- if (persistent) {
- list_entry *le;
-
- /* try to find if we already have this link in our persistent list */
- if (zend_hash_find(&EG(persistent_list), hashed_details, hashed_details_length+1, (void **) &le)==FAILURE) { /* we don't */
- list_entry new_le;
-
- if (PGG(max_links)!=-1 && PGG(num_links)>=PGG(max_links)) {
- php_error(E_WARNING,"PostgreSQL: Too many open links (%d)",PGG(num_links));
- efree(hashed_details);
- RETURN_FALSE;
- }
- if (PGG(max_persistent)!=-1 && PGG(num_persistent)>=PGG(max_persistent)) {
- php_error(E_WARNING,"PostgreSQL: Too many open persistent links (%d)",PGG(num_persistent));
- efree(hashed_details);
- RETURN_FALSE;
- }
-
- /* create the link */
- if (connstring) {
- pgsql=PQconnectdb(connstring);
- } else {
- pgsql=PQsetdb(host,port,options,tty,dbname);
- }
- if (pgsql==NULL || PQstatus(pgsql)==CONNECTION_BAD) {
- if (pgsql) {
- PQfinish(pgsql);
- }
- php_error(E_WARNING,"Unable to connect to PostgreSQL server: %s",PQerrorMessage(pgsql));
- efree(hashed_details);
- RETURN_FALSE;
- }
-
- PQsetNoticeProcessor(pgsql, _notice_handler, NULL);
-
- /* hash it up */
- new_le.type = le_plink;
- new_le.ptr = pgsql;
- if (zend_hash_update(&EG(persistent_list), hashed_details, hashed_details_length+1, (void *) &new_le, sizeof(list_entry), NULL)==FAILURE) {
- efree(hashed_details);
- RETURN_FALSE;
- }
- PGG(num_links)++;
- PGG(num_persistent)++;
- } else { /* we do */
- if (le->type != le_plink) {
- RETURN_FALSE;
- }
- /* ensure that the link did not die */
- if (PQstatus(le->ptr)==CONNECTION_BAD) { /* the link died */
- if (connstring) {
- le->ptr=PQconnectdb(connstring);
- } else {
- le->ptr=PQsetdb(host,port,options,tty,dbname);
- }
- if (le->ptr==NULL || PQstatus(le->ptr)==CONNECTION_BAD) {
- php_error(E_WARNING,"PostgreSQL link lost, unable to reconnect");
- zend_hash_del(&EG(persistent_list),hashed_details,hashed_details_length+1);
- efree(hashed_details);
- RETURN_FALSE;
- }
- }
- pgsql = (PGconn *) le->ptr;
-
- PQsetNoticeProcessor(pgsql, _notice_handler, NULL);
- }
- ZEND_REGISTER_RESOURCE(return_value, pgsql, le_plink);
- } else {
- list_entry *index_ptr,new_index_ptr;
-
- /* first we check the hash for the hashed_details key. if it exists,
- * it should point us to the right offset where the actual pgsql link sits.
- * if it doesn't, open a new pgsql link, add it to the resource list,
- * and add a pointer to it with hashed_details as the key.
- */
- if (zend_hash_find(&EG(regular_list),hashed_details,hashed_details_length+1,(void **) &index_ptr)==SUCCESS) {
- int type,link;
- void *ptr;
-
- if (index_ptr->type != le_index_ptr) {
- RETURN_FALSE;
- }
- link = (int) (long) index_ptr->ptr;
- ptr = zend_list_find(link,&type); /* check if the link is still there */
- if (ptr && (type==le_link || type==le_plink)) {
- return_value->value.lval = link;
- zend_list_addref(link);
- php_pgsql_set_default_link(link);
- return_value->type = IS_RESOURCE;
- efree(hashed_details);
- return;
- } else {
- zend_hash_del(&EG(regular_list),hashed_details,hashed_details_length+1);
- }
- }
- if (PGG(max_links)!=-1 && PGG(num_links)>=PGG(max_links)) {
- php_error(E_WARNING,"PostgreSQL: Too many open links (%d)",PGG(num_links));
- efree(hashed_details);
- RETURN_FALSE;
- }
- if (connstring) {
- pgsql = PQconnectdb(connstring);
- } else {
- pgsql = PQsetdb(host,port,options,tty,dbname);
- }
- if (pgsql==NULL || PQstatus(pgsql)==CONNECTION_BAD) {
- php_error(E_WARNING,"Unable to connect to PostgreSQL server: %s",PQerrorMessage(pgsql));
- efree(hashed_details);
- RETURN_FALSE;
- }
-
- PQsetNoticeProcessor(pgsql, _notice_handler, NULL);
-
- /* add it to the list */
- ZEND_REGISTER_RESOURCE(return_value, pgsql, le_link);
-
- /* add it to the hash */
- new_index_ptr.ptr = (void *) return_value->value.lval;
- new_index_ptr.type = le_index_ptr;
- if (zend_hash_update(&EG(regular_list),hashed_details,hashed_details_length+1,(void *) &new_index_ptr, sizeof(list_entry), NULL)==FAILURE) {
- efree(hashed_details);
- RETURN_FALSE;
- }
- PGG(num_links)++;
- }
- efree(hashed_details);
- php_pgsql_set_default_link(return_value->value.lval);
-}
-/* }}} */
-
-/* {{{ php_pgsql_get_default_link
- */
-int php_pgsql_get_default_link(INTERNAL_FUNCTION_PARAMETERS)
-{
- PGLS_FETCH();
-
- if (PGG(default_link)==-1) { /* no link opened yet, implicitly open one */
- ht = 0;
- php_pgsql_do_connect(INTERNAL_FUNCTION_PARAM_PASSTHRU,0);
- }
- return PGG(default_link);
-}
-/* }}} */
-
-/* {{{ proto int pg_connect([string connection_string] | [string host, string port [, string options [, string tty,]] string database)
- Open a PostgreSQL connection */
-PHP_FUNCTION(pg_connect)
-{
- php_pgsql_do_connect(INTERNAL_FUNCTION_PARAM_PASSTHRU,0);
-}
-/* }}} */
-
-/* {{{ proto int pg_pconnect([string connection_string] | [string host, string port [, string options [, string tty,]] string database)
- Open a persistent PostgreSQL connection */
-PHP_FUNCTION(pg_pconnect)
-{
- php_pgsql_do_connect(INTERNAL_FUNCTION_PARAM_PASSTHRU,1);
-}
-/* }}} */
-
-/* {{{ proto bool pg_close([int connection])
- Close a PostgreSQL connection */
-PHP_FUNCTION(pg_close)
-{
- zval **pgsql_link = NULL;
- int id;
- PGconn *pgsql;
- PGLS_FETCH();
-
- switch (ZEND_NUM_ARGS()) {
- case 0:
- id = PGG(default_link);
- CHECK_DEFAULT_LINK(id);
- break;
- case 1:
- if (zend_get_parameters_ex(1, &pgsql_link)==FAILURE) {
- RETURN_FALSE;
- }
- id = -1;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- ZEND_FETCH_RESOURCE2(pgsql, PGconn *, pgsql_link, id, "PostgreSQL link", le_link, le_plink);
-
- if (id==-1) { /* explicit resource number */
- zend_list_delete(Z_RESVAL_PP(pgsql_link));
- }
-
- if (id!=-1
- || (pgsql_link && Z_RESVAL_PP(pgsql_link)==PGG(default_link))) {
- zend_list_delete(PGG(default_link));
- PGG(default_link) = -1;
- }
-
- RETURN_TRUE;
-}
-/* }}} */
-
-
-#define PHP_PG_DBNAME 1
-#define PHP_PG_ERROR_MESSAGE 2
-#define PHP_PG_OPTIONS 3
-#define PHP_PG_PORT 4
-#define PHP_PG_TTY 5
-#define PHP_PG_HOST 6
-
-/* {{{ php_pgsql_get_link_info
- */
-void php_pgsql_get_link_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type)
-{
- zval **pgsql_link = NULL;
- int id = -1;
- PGconn *pgsql;
- PGLS_FETCH();
-
- switch(ZEND_NUM_ARGS()) {
- case 0:
- id = PGG(default_link);
- CHECK_DEFAULT_LINK(id);
- break;
- case 1:
- if (zend_get_parameters_ex(1, &pgsql_link)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- ZEND_FETCH_RESOURCE2(pgsql, PGconn *, pgsql_link, id, "PostgreSQL link", le_link, le_plink);
-
- switch(entry_type) {
- case PHP_PG_DBNAME:
- return_value->value.str.val = PQdb(pgsql);
- break;
- case PHP_PG_ERROR_MESSAGE:
- return_value->value.str.val = PQerrorMessage(pgsql);
- break;
- case PHP_PG_OPTIONS:
- return_value->value.str.val = PQoptions(pgsql);
- break;
- case PHP_PG_PORT:
- return_value->value.str.val = PQport(pgsql);
- break;
- case PHP_PG_TTY:
- return_value->value.str.val = PQtty(pgsql);
- break;
- case PHP_PG_HOST:
- return_value->value.str.val = PQhost(pgsql);
- break;
- default:
- RETURN_FALSE;
- }
- return_value->value.str.len = strlen(return_value->value.str.val);
- return_value->value.str.val = (char *) estrdup(return_value->value.str.val);
- return_value->type = IS_STRING;
-}
-/* }}} */
-
-/* {{{ proto string pg_dbname([int connection])
- Get the database name */
-PHP_FUNCTION(pg_dbname)
-{
- php_pgsql_get_link_info(INTERNAL_FUNCTION_PARAM_PASSTHRU,PHP_PG_DBNAME);
-}
-/* }}} */
-
-/* {{{ proto string pg_errormessage([int connection])
- Get the error message string */
-PHP_FUNCTION(pg_errormessage)
-{
- php_pgsql_get_link_info(INTERNAL_FUNCTION_PARAM_PASSTHRU,PHP_PG_ERROR_MESSAGE);
-}
-/* }}} */
-
-/* {{{ proto string pg_options([int connection])
- Get the options associated with the connection */
-PHP_FUNCTION(pg_options)
-{
- php_pgsql_get_link_info(INTERNAL_FUNCTION_PARAM_PASSTHRU,PHP_PG_OPTIONS);
-}
-/* }}} */
-
-/* {{{ proto int pg_port([int connection])
- Return the port number associated with the connection */
-PHP_FUNCTION(pg_port)
-{
- php_pgsql_get_link_info(INTERNAL_FUNCTION_PARAM_PASSTHRU,PHP_PG_PORT);
-}
-/* }}} */
-
-/* {{{ proto string pg_tty([int connection])
- Return the tty name associated with the connection */
-PHP_FUNCTION(pg_tty)
-{
- php_pgsql_get_link_info(INTERNAL_FUNCTION_PARAM_PASSTHRU,PHP_PG_TTY);
-}
-/* }}} */
-
-/* {{{ proto string pg_host([int connection])
- Returns the host name associated with the connection */
-PHP_FUNCTION(pg_host)
-{
- php_pgsql_get_link_info(INTERNAL_FUNCTION_PARAM_PASSTHRU,PHP_PG_HOST);
-}
-/* }}} */
-
-/* {{{ proto int pg_exec([int connection,] string query)
- Execute a query */
-PHP_FUNCTION(pg_exec)
-{
- zval **query, **pgsql_link = NULL;
- int id = -1;
- PGconn *pgsql;
- PGresult *pgsql_result;
- ExecStatusType status;
- pgsql_result_handle *pg_result;
- PGLS_FETCH();
-
- switch(ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &query)==FAILURE) {
- RETURN_FALSE;
- }
- id = PGG(default_link);
- CHECK_DEFAULT_LINK(id);
- break;
- case 2:
- if (zend_get_parameters_ex(2, &pgsql_link, &query)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- ZEND_FETCH_RESOURCE2(pgsql, PGconn *, pgsql_link, id, "PostgreSQL link", le_link, le_plink);
-
- convert_to_string_ex(query);
- pgsql_result = PQexec(pgsql, Z_STRVAL_PP(query));
-
- if (pgsql_result) {
- status = PQresultStatus(pgsql_result);
- } else {
- status = (ExecStatusType) PQstatus(pgsql);
- }
-
-
- switch (status) {
- case PGRES_EMPTY_QUERY:
- case PGRES_BAD_RESPONSE:
- case PGRES_NONFATAL_ERROR:
- case PGRES_FATAL_ERROR:
- php_error(E_WARNING, "PostgreSQL query failed: %s", PQerrorMessage(pgsql));
- RETURN_FALSE;
- break;
- case PGRES_COMMAND_OK: /* successful command that did not return rows */
- default:
- if (pgsql_result) {
- pg_result = (pgsql_result_handle *) emalloc(sizeof(pgsql_result_handle));
- pg_result->conn = pgsql;
- pg_result->result = pgsql_result;
- pg_result->row = -1;
- ZEND_REGISTER_RESOURCE(return_value, pg_result, le_result);
- /*
- return_value->value.lval = zend_list_insert(pg_result,le_result);
- return_value->type = IS_LONG;
- */
- } else {
- RETURN_FALSE;
- }
- break;
- }
-}
-/* }}} */
-
-/* {{{ proto int pg_end_copy([int connection])
- Sync with backend. Completes the Copy command */
-PHP_FUNCTION(pg_end_copy)
-{
- zval **pgsql_link = NULL;
- int id = -1;
- PGconn *pgsql;
- int result = 0;
- PGLS_FETCH();
-
- switch(ZEND_NUM_ARGS()) {
- case 0:
- id = PGG(default_link);
- CHECK_DEFAULT_LINK(id);
- break;
- case 1:
- if (zend_get_parameters_ex(1, &pgsql_link)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- ZEND_FETCH_RESOURCE2(pgsql, PGconn *, pgsql_link, id, "PostgreSQL link", le_link, le_plink);
-
- result = PQendcopy(pgsql);
-
- if (result!=0) {
- php_error(E_WARNING, "PostgreSQL query failed: %s", PQerrorMessage(pgsql));
- RETURN_FALSE;
- }
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int pg_put_line([int connection,] string query)
- Send null-terminated string to backend server*/
-PHP_FUNCTION(pg_put_line)
-{
- zval **query, **pgsql_link = NULL;
- int id = -1;
- PGconn *pgsql;
- int result = 0;
- PGLS_FETCH();
-
- switch(ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &query)==FAILURE) {
- RETURN_FALSE;
- }
- id = PGG(default_link);
- CHECK_DEFAULT_LINK(id);
- break;
- case 2:
- if (zend_get_parameters_ex(2, &pgsql_link, &query)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- ZEND_FETCH_RESOURCE2(pgsql, PGconn *, pgsql_link, id, "PostgreSQL link", le_link, le_plink);
-
- convert_to_string_ex(query);
- result = PQputline(pgsql, Z_STRVAL_PP(query));
-
- if (result==EOF) {
- php_error(E_WARNING, "PostgreSQL query failed: %s", PQerrorMessage(pgsql));
- RETURN_FALSE;
- }
- RETURN_TRUE;
-}
-/* }}} */
-#define PHP_PG_NUM_ROWS 1
-#define PHP_PG_NUM_FIELDS 2
-#define PHP_PG_CMD_TUPLES 3
-
-/* {{{ php_pgsql_get_result_info
- */
-void php_pgsql_get_result_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type)
-{
- zval **result;
- PGresult *pgsql_result;
- pgsql_result_handle *pg_result;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &result)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pg_result, pgsql_result_handle *, result, -1, "PostgreSQL result", le_result);
-
- pgsql_result = pg_result->result;
-
- switch (entry_type) {
- case PHP_PG_NUM_ROWS:
- return_value->value.lval = PQntuples(pgsql_result);
- break;
- case PHP_PG_NUM_FIELDS:
- return_value->value.lval = PQnfields(pgsql_result);
- break;
- case PHP_PG_CMD_TUPLES:
-#if HAVE_PQCMDTUPLES
- return_value->value.lval = atoi(PQcmdTuples(pgsql_result));
-#else
- php_error(E_WARNING,"This compilation does not support pg_cmdtuples()");
- return_value->value.lval = 0;
-#endif
- break;
- default:
- RETURN_FALSE;
- }
- return_value->type = IS_LONG;
-}
-/* }}} */
-
-/* {{{ proto int pg_numrows(int result)
- Return the number of rows in the result */
-PHP_FUNCTION(pg_numrows)
-{
- php_pgsql_get_result_info(INTERNAL_FUNCTION_PARAM_PASSTHRU,PHP_PG_NUM_ROWS);
-}
-/* }}} */
-
-/* {{{ proto int pg_numfields(int result)
- Return the number of fields in the result */
-PHP_FUNCTION(pg_numfields)
-{
- php_pgsql_get_result_info(INTERNAL_FUNCTION_PARAM_PASSTHRU,PHP_PG_NUM_FIELDS);
-}
-/* }}} */
-
-/* {{{ proto int pg_cmdtuples(int result)
- Returns the number of affected tuples */
-PHP_FUNCTION(pg_cmdtuples)
-{
- php_pgsql_get_result_info(INTERNAL_FUNCTION_PARAM_PASSTHRU,PHP_PG_CMD_TUPLES);
-}
-/* }}} */
-
-/* {{{ proto int pg_last_notice(int connection)
- Returns the last notice set by the backend */
-PHP_FUNCTION(pg_last_notice)
-{
- PGLS_FETCH();
-
- if (PGG(last_notice) == NULL) {
- RETURN_FALSE;
- } else {
- RETURN_STRING(PGG(last_notice),0);
- }
-}
-/* }}} */
-
-/* {{{ get_field_name
- */
-char *get_field_name(PGconn *pgsql, Oid oid, HashTable *list)
-{
- PGresult *result;
- char hashed_oid_key[32];
- list_entry *field_type;
- char *ret=NULL;
-
- /* try to lookup the type in the resource list */
- snprintf(hashed_oid_key,31,"pgsql_oid_%d",(int) oid);
- hashed_oid_key[31]=0;
-
- if (zend_hash_find(list,hashed_oid_key,strlen(hashed_oid_key)+1,(void **) &field_type)==SUCCESS) {
- ret = estrdup((char *)field_type->ptr);
- } else { /* hash all oid's */
- int i,num_rows;
- int oid_offset,name_offset;
- char *tmp_oid, *tmp_name;
- list_entry new_oid_entry;
-
- if ((result = PQexec(pgsql,"select oid,typname from pg_type")) == NULL) {
- return empty_string;
- }
- num_rows = PQntuples(result);
- oid_offset = PQfnumber(result,"oid");
- name_offset = PQfnumber(result,"typname");
-
- for (i=0; i<num_rows; i++) {
- if ((tmp_oid = PQgetvalue(result,i,oid_offset))==NULL) {
- continue;
- }
- snprintf(hashed_oid_key,31,"pgsql_oid_%s",tmp_oid);
- if ((tmp_name = PQgetvalue(result,i,name_offset))==NULL) {
- continue;
- }
- new_oid_entry.type = le_string;
- new_oid_entry.ptr = estrdup(tmp_name);
- zend_hash_update(list,hashed_oid_key,strlen(hashed_oid_key)+1,(void *) &new_oid_entry, sizeof(list_entry), NULL);
- if (!ret && atoi(tmp_oid)==oid) {
- ret = estrdup(tmp_name);
- }
- }
- }
- return ret;
-}
-/* }}} */
-
-#define PHP_PG_FIELD_NAME 1
-#define PHP_PG_FIELD_SIZE 2
-#define PHP_PG_FIELD_TYPE 3
-
-/* {{{ php_pgsql_get_field_info
- */
-void php_pgsql_get_field_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type)
-{
- zval **result, **field;
- PGresult *pgsql_result;
- pgsql_result_handle *pg_result;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &result, &field)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pg_result, pgsql_result_handle *, result, -1, "PostgreSQL result", le_result);
-
- pgsql_result = pg_result->result;
- convert_to_long_ex(field);
-
- if (Z_LVAL_PP(field) < 0 || Z_LVAL_PP(field) >= PQnfields(pgsql_result)) {
- php_error(E_WARNING,"Bad field offset specified");
- RETURN_FALSE;
- }
-
- switch (entry_type) {
- case PHP_PG_FIELD_NAME:
- return_value->value.str.val = PQfname(pgsql_result, Z_LVAL_PP(field));
- return_value->value.str.len = strlen(return_value->value.str.val);
- return_value->value.str.val = estrndup(return_value->value.str.val,return_value->value.str.len);
- return_value->type = IS_STRING;
- break;
- case PHP_PG_FIELD_SIZE:
- return_value->value.lval = PQfsize(pgsql_result, Z_LVAL_PP(field));
- return_value->type = IS_LONG;
- break;
- case PHP_PG_FIELD_TYPE:
- return_value->value.str.val = get_field_name(pg_result->conn, PQftype(pgsql_result, Z_LVAL_PP(field)), &EG(regular_list));
- return_value->value.str.len = strlen(return_value->value.str.val);
- return_value->type = IS_STRING;
- break;
- default:
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto string pg_fieldname(int result, int field_number)
- Returns the name of the field */
-PHP_FUNCTION(pg_fieldname)
-{
- php_pgsql_get_field_info(INTERNAL_FUNCTION_PARAM_PASSTHRU,PHP_PG_FIELD_NAME);
-}
-/* }}} */
-
-/* {{{ proto int pg_fieldsize(int result, int field_number)
- Returns the internal size of the field */
-PHP_FUNCTION(pg_fieldsize)
-{
- php_pgsql_get_field_info(INTERNAL_FUNCTION_PARAM_PASSTHRU,PHP_PG_FIELD_SIZE);
-}
-/* }}} */
-
-/* {{{ proto string pg_fieldtype(int result, int field_number)
- Returns the type name for the given field */
-PHP_FUNCTION(pg_fieldtype)
-{
- php_pgsql_get_field_info(INTERNAL_FUNCTION_PARAM_PASSTHRU,PHP_PG_FIELD_TYPE);
-}
-/* }}} */
-
-/* {{{ proto int pg_fieldnum(int result, string field_name)
- Returns the field number of the named field */
-PHP_FUNCTION(pg_fieldnum)
-{
- zval **result, **field;
- PGresult *pgsql_result;
- pgsql_result_handle *pg_result;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &result, &field)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pg_result, pgsql_result_handle *, result, -1, "PostgreSQL result", le_result);
-
- pgsql_result = pg_result->result;
-
- convert_to_string_ex(field);
- return_value->value.lval = PQfnumber(pgsql_result, Z_STRVAL_PP(field));
- return_value->type = IS_LONG;
-}
-/* }}} */
-
-/* {{{ proto mixed pg_result(int result, [int row_number,] mixed field_name)
- Returns values from a result identifier */
-PHP_FUNCTION(pg_result)
-{
- zval **result, **row, **field=NULL;
- PGresult *pgsql_result;
- pgsql_result_handle *pg_result;
- int field_offset, pgsql_row;
-
- if ((ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &result, &row, &field)==FAILURE) &&
- (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &result, &field)==FAILURE)) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pg_result, pgsql_result_handle *, result, -1, "PostgreSQL result", le_result);
-
- pgsql_result = pg_result->result;
- if (ZEND_NUM_ARGS() == 2) {
- if (pg_result->row < 0)
- pg_result->row = 0;
- pgsql_row = pg_result->row;
- if (pgsql_row >= PQntuples(pgsql_result)) {
- RETURN_FALSE;
- }
- } else {
- convert_to_long_ex(row);
- pgsql_row = Z_LVAL_PP(row);
- if (pgsql_row < 0 || pgsql_row >= PQntuples(pgsql_result)) {
- php_error(E_WARNING,"Unable to jump to row %d on PostgreSQL result index %d", Z_LVAL_PP(row), Z_LVAL_PP(result));
- RETURN_FALSE;
- }
- }
- switch(Z_TYPE_PP(field)) {
- case IS_STRING:
- field_offset = PQfnumber(pgsql_result, Z_STRVAL_PP(field));
- break;
- default:
- convert_to_long_ex(field);
- field_offset = Z_LVAL_PP(field);
- break;
- }
- if (field_offset<0 || field_offset>=PQnfields(pgsql_result)) {
- php_error(E_WARNING,"Bad column offset specified");
- RETURN_FALSE;
- }
-
- if (PQgetisnull(pgsql_result, pgsql_row, field_offset)) {
- return_value->type = IS_NULL;
- } else {
- return_value->value.str.val = PQgetvalue(pgsql_result, pgsql_row, field_offset);
- return_value->value.str.len = (return_value->value.str.val ? strlen(return_value->value.str.val) : 0);
- return_value->value.str.val = safe_estrndup(return_value->value.str.val,return_value->value.str.len);
- return_value->type = IS_STRING;
- }
-}
-/* }}} */
-
-/* {{{ void php_pgsql_fetch_hash
- */
-static void php_pgsql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, int result_type)
-{
- zval **result, **row, **arg3;
- PGresult *pgsql_result;
- pgsql_result_handle *pg_result;
- int i, num_fields, pgsql_row;
- char *element, *field_name;
- uint element_len;
- PLS_FETCH();
-
- switch (ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &result)==FAILURE) {
- RETURN_FALSE;
- }
- if (!result_type) {
- result_type = PGSQL_BOTH;
- }
- break;
- case 2:
- if (zend_get_parameters_ex(2, &result, &row)==FAILURE) {
- RETURN_FALSE;
- }
- if (!result_type) {
- result_type = PGSQL_BOTH;
- }
- break;
- case 3:
- if (zend_get_parameters_ex(3, &result, &row, &arg3)==FAILURE) {
- RETURN_FALSE;
- }
- convert_to_long_ex(arg3);
- result_type = Z_LVAL_PP(arg3);
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- ZEND_FETCH_RESOURCE(pg_result, pgsql_result_handle *, result, -1, "PostgreSQL result", le_result);
-
- pgsql_result = pg_result->result;
-
- if (ZEND_NUM_ARGS() == 1) {
- pg_result->row++;
- pgsql_row = pg_result->row;
- if (pgsql_row < 0 || pgsql_row >= PQntuples(pgsql_result)) {
- RETURN_FALSE;
- }
- } else {
- convert_to_long_ex(row);
- pgsql_row = Z_LVAL_PP(row);
- pg_result->row = pgsql_row;
- if (pgsql_row < 0 || pgsql_row >= PQntuples(pgsql_result)) {
- php_error(E_WARNING,"Unable to jump to row %d on PostgreSQL result index %d", Z_LVAL_PP(row), Z_LVAL_PP(result));
- RETURN_FALSE;
- }
- }
- array_init(return_value);
- for (i = 0, num_fields = PQnfields(pgsql_result); i<num_fields; i++) {
- if (PQgetisnull(pgsql_result, pgsql_row, i)) {
- if (result_type & PGSQL_NUM) {
- add_index_null(return_value, i);
- }
- if (result_type & PGSQL_ASSOC) {
- field_name = PQfname(pgsql_result, i);
- add_assoc_null(return_value, field_name);
- }
- } else {
- element = PQgetvalue(pgsql_result, pgsql_row, i);
- element_len = (element ? strlen(element) : 0);
- if (element) {
- char *data;
- int data_len;
- int should_copy=0;
-
- if (PG(magic_quotes_runtime)) {
- data = php_addslashes(element, element_len, &data_len, 0);
- } else {
- data = safe_estrndup(element, element_len);
- data_len = element_len;
- }
-
- if (result_type & PGSQL_NUM) {
- add_index_stringl(return_value, i, data, data_len, should_copy);
- should_copy=1;
- }
-
- if (result_type & PGSQL_ASSOC) {
- field_name = PQfname(pgsql_result, i);
- add_assoc_stringl(return_value, field_name, data, data_len, should_copy);
- }
- }
- }
- }
-}
-/* }}} */
-
-/* {{{ proto array pg_fetch_row(int result, [int row])
- Get a row as an enumerated array */
-PHP_FUNCTION(pg_fetch_row)
-{
- php_pgsql_fetch_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU, PGSQL_NUM);
-}
-/* }}} */
-
-/* ?? This is a rather odd function - why not just point pg_fetcharray() directly at fetch_hash ? -RL */
-/* {{{ proto array pg_fetch_array(int result, [int row [, int result_type]])
- Fetch a row as an array */
-PHP_FUNCTION(pg_fetch_array)
-{
- php_pgsql_fetch_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-/* }}} */
-
-/* {{{ proto object pg_fetch_object(int result, [int row [, int result_type]])
- Fetch a row as an object */
-PHP_FUNCTION(pg_fetch_object)
-{
- php_pgsql_fetch_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
- if (return_value->type==IS_ARRAY) {
- return_value->type=IS_OBJECT;
- return_value->value.obj.properties = return_value->value.ht;
- return_value->value.obj.ce = &zend_standard_class_def;
- }
-}
-/* }}} */
-
-#define PHP_PG_DATA_LENGTH 1
-#define PHP_PG_DATA_ISNULL 2
-
-/* {{{ php_pgsql_data_info
- */
-void php_pgsql_data_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type)
-{
- zval **result, **row, **field;
- PGresult *pgsql_result;
- pgsql_result_handle *pg_result;
- int field_offset, pgsql_row;
-
- if ((ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &result, &row, &field)==FAILURE) &&
- (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &result, &field)==FAILURE)) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pg_result, pgsql_result_handle *, result, -1, "PostgreSQL result", le_result);
-
- pgsql_result = pg_result->result;
- if (ZEND_NUM_ARGS() == 2) {
- if (pg_result->row < 0)
- pg_result->row = 0;
- pgsql_row = pg_result->row;
- if (pgsql_row < 0 || pgsql_row >= PQntuples(pgsql_result)) {
- RETURN_FALSE;
- }
- } else {
- convert_to_long_ex(row);
- pgsql_row = Z_LVAL_PP(row);
- if (pgsql_row < 0 || pgsql_row >= PQntuples(pgsql_result)) {
- php_error(E_WARNING,"Unable to jump to row %d on PostgreSQL result index %d", Z_LVAL_PP(row), Z_LVAL_PP(result));
- RETURN_FALSE;
- }
- }
-
- switch(Z_TYPE_PP(field)) {
- case IS_STRING:
- convert_to_string_ex(field);
- field_offset = PQfnumber(pgsql_result, Z_STRVAL_PP(field));
- break;
- default:
- convert_to_long_ex(field);
- field_offset = Z_LVAL_PP(field);
- break;
- }
- if (field_offset < 0 || field_offset >= PQnfields(pgsql_result)) {
- php_error(E_WARNING, "Bad column offset specified");
- RETURN_FALSE;
- }
-
- switch (entry_type) {
- case PHP_PG_DATA_LENGTH:
- return_value->value.lval = PQgetlength(pgsql_result, pgsql_row, field_offset);
- break;
- case PHP_PG_DATA_ISNULL:
- return_value->value.lval = PQgetisnull(pgsql_result, pgsql_row, field_offset);
- break;
- }
- return_value->type = IS_LONG;
-}
-/* }}} */
-
-/* {{{ proto int pg_fieldprtlen(int result, [int row,] mixed field_name_or_number)
- Returns the printed length */
-PHP_FUNCTION(pg_fieldprtlen)
-{
- php_pgsql_data_info(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_PG_DATA_LENGTH);
-}
-/* }}} */
-
-/* {{{ proto int pg_fieldisnull(int result, [int row,] mixed field_name_or_number)
- Test if a field is NULL */
-PHP_FUNCTION(pg_fieldisnull)
-{
- php_pgsql_data_info(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_PG_DATA_ISNULL);
-}
-/* }}} */
-
-/* {{{ proto int pg_freeresult(int result)
- Free result memory */
-PHP_FUNCTION(pg_freeresult)
-{
- zval **result;
- pgsql_result_handle *pg_result;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &result)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pg_result, pgsql_result_handle *, result, -1, "PostgreSQL result", le_result);
- if (Z_LVAL_PP(result) == 0) {
- RETURN_FALSE;
- }
- zend_list_delete(Z_LVAL_PP(result));
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int pg_getlastoid(int result)
- Returns the last object identifier */
-PHP_FUNCTION(pg_getlastoid)
-{
- zval **result;
- PGresult *pgsql_result;
- pgsql_result_handle *pg_result;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &result)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pg_result, pgsql_result_handle *, result, -1, "PostgreSQL result", le_result);
- pgsql_result = pg_result->result;
-#ifndef HAVE_PQOIDVALUE
- return_value->value.str.val = (char *) PQoidStatus(pgsql_result);
- if (return_value->value.str.val) {
- return_value->value.str.len = strlen(return_value->value.str.val);
- return_value->value.str.val = estrndup(return_value->value.str.val, return_value->value.str.len);
- return_value->type = IS_STRING;
- } else {
- return_value->value.str.val = empty_string;
- }
-#else
- return_value->value.lval = (int) PQoidValue(pgsql_result);
- if (return_value->value.lval == InvalidOid) {
- RETURN_FALSE;
- } else {
- return_value->type = IS_LONG;
- }
-#endif
-}
-/* }}} */
-
-/* {{{ proto bool pg_trace(string filename [, string mode [, resource connection]])
- Enable tracing a PostgreSQL connection */
-PHP_FUNCTION(pg_trace)
-{
- zval **z_filename, **z_mode, **z_pgsql_link = NULL;
- int id = -1;
- PGconn *pgsql;
- char *mode = "w";
- int issock, socketd;
- FILE *fp;
- PGLS_FETCH();
-
- id = PGG(default_link);
-
- switch (ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &z_filename)==FAILURE) {
- RETURN_FALSE;
- }
- CHECK_DEFAULT_LINK(id);
- break;
- case 2:
- if (zend_get_parameters_ex(2, &z_filename, &z_mode)==FAILURE) {
- RETURN_FALSE;
- }
- CHECK_DEFAULT_LINK(id);
- convert_to_string_ex(z_mode);
- mode = Z_STRVAL_PP(z_mode);
- break;
- case 3:
- if (zend_get_parameters_ex(3, &z_filename, &z_mode, &z_pgsql_link)==FAILURE) {
- RETURN_FALSE;
- }
- convert_to_string_ex(z_mode);
- mode = Z_STRVAL_PP(z_mode);
- break;
- default:
- ZEND_WRONG_PARAM_COUNT();
- break;
- }
-
- ZEND_FETCH_RESOURCE2(pgsql, PGconn *, z_pgsql_link, id, "PostgreSQL link", le_link, le_plink);
- convert_to_string_ex(z_filename);
-
- fp = php_fopen_wrapper(Z_STRVAL_PP(z_filename), mode, ENFORCE_SAFE_MODE, &issock, &socketd, NULL);
-
- if (!fp) {
- php_error(E_WARNING, "Unable to open %s for logging", Z_STRVAL_PP(z_filename));
- RETURN_FALSE;
- }
-
- PQtrace(pgsql, fp);
- ZEND_REGISTER_RESOURCE(NULL, fp, php_file_le_fopen());
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool pg_untrace([int connection])
- Disable tracing of a PostgreSQL connection */
-PHP_FUNCTION(pg_untrace)
-{
- zval **pgsql_link = NULL;
- int id = -1;
- PGconn *pgsql;
- PGLS_FETCH();
-
- switch (ZEND_NUM_ARGS()) {
- case 0:
- id = PGG(default_link);
- CHECK_DEFAULT_LINK(id);
- break;
- case 1:
- if (zend_get_parameters_ex(1, &pgsql_link)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- default:
- ZEND_WRONG_PARAM_COUNT();
- break;
- }
-
- ZEND_FETCH_RESOURCE2(pgsql, PGconn *, pgsql_link, id, "PostgreSQL link", le_link, le_plink);
- PQuntrace(pgsql);
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int pg_locreate(int connection)
- Create a large object */
-PHP_FUNCTION(pg_locreate)
-{
- zval **pgsql_link = NULL;
- PGconn *pgsql;
- Oid pgsql_oid;
- int id = -1;
- PGLS_FETCH();
-
- switch(ZEND_NUM_ARGS()) {
- case 0:
- id = PGG(default_link);
- CHECK_DEFAULT_LINK(id);
- break;
- case 1:
- if (zend_get_parameters_ex(1, &pgsql_link)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- ZEND_FETCH_RESOURCE2(pgsql, PGconn *, pgsql_link, id, "PostgreSQL link", le_link, le_plink);
-
- /* XXX: Archive modes not supported until I get some more data. Don't think anybody's
- using it anyway. I believe it's also somehow related to the 'time travel' feature of
- PostgreSQL, that's on the list of features to be removed... Create modes not supported.
- What's the use of an object that can be only written to, but not read from, and vice
- versa? Beats me... And the access type (r/w) must be specified again when opening
- the object, probably (?) overrides this. (Jouni)
- */
-
- if ((pgsql_oid = lo_creat(pgsql, INV_READ|INV_WRITE))==0) {
- php_error(E_WARNING,"Unable to create PostgreSQL large object");
- RETURN_FALSE;
- }
-
- return_value->value.lval = pgsql_oid;
- return_value->type = IS_LONG;
-}
-/* }}} */
-
-/* {{{ proto void pg_lounlink([int connection,] int large_obj_id)
- Delete a large object */
-PHP_FUNCTION(pg_lounlink)
-{
- zval **pgsql_link = NULL, **oid;
- PGconn *pgsql;
- Oid pgsql_oid;
- int id = -1;
- PGLS_FETCH();
-
- switch(ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &oid)==FAILURE) {
- RETURN_FALSE;
- }
- convert_to_long_ex(oid);
- pgsql_oid = Z_LVAL_PP(oid);
- id = PGG(default_link);
- CHECK_DEFAULT_LINK(id);
- break;
- case 2:
- if (zend_get_parameters_ex(2, &pgsql_link, &oid)==FAILURE) {
- RETURN_FALSE;
- }
- convert_to_long_ex(oid);
- pgsql_oid = Z_LVAL_PP(oid);
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- ZEND_FETCH_RESOURCE2(pgsql, PGconn *, pgsql_link, id, "PostgreSQL link", le_link, le_plink);
-
- if (lo_unlink(pgsql, pgsql_oid) == -1) {
- php_error(E_WARNING, "Unable to delete PostgreSQL large object %d", (int) pgsql_oid);
- RETURN_FALSE;
- }
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int pg_loopen([int connection,] int objoid, string mode)
- Open a large object and return fd */
-PHP_FUNCTION(pg_loopen)
-{
- zval **pgsql_link = NULL, **oid, **mode;
- PGconn *pgsql;
- Oid pgsql_oid;
- int id = -1, pgsql_mode=0, pgsql_lofd;
- int create=0;
- char *mode_string=NULL;
- pgLofp *pgsql_lofp;
- PGLS_FETCH();
-
- switch(ZEND_NUM_ARGS()) {
- case 2:
- if (zend_get_parameters_ex(2, &oid, &mode)==FAILURE) {
- RETURN_FALSE;
- }
- convert_to_long_ex(oid);
- pgsql_oid = Z_LVAL_PP(oid);
- convert_to_string_ex(mode);
- mode_string = Z_STRVAL_PP(mode);
- id = PGG(default_link);
- CHECK_DEFAULT_LINK(id);
- break;
- case 3:
- if (zend_get_parameters_ex(3, &pgsql_link, &oid, &mode)==FAILURE) {
- RETURN_FALSE;
- }
- convert_to_long_ex(oid);
- pgsql_oid = Z_LVAL_PP(oid);
- convert_to_string_ex(mode);
- mode_string = Z_STRVAL_PP(mode);
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- ZEND_FETCH_RESOURCE2(pgsql, PGconn *, pgsql_link, id, "PostgreSQL link", le_link, le_plink);
-
- /* r/w/+ is little bit more PHP-like than INV_READ/INV_WRITE and a lot of
- faster to type. Unfortunately, doesn't behave the same way as fopen()...
- (Jouni)
- */
-
- if (strchr(mode_string, 'r') == mode_string) {
- pgsql_mode |= INV_READ;
- if (strchr(mode_string, '+') == mode_string+1) {
- pgsql_mode |= INV_WRITE;
- }
- }
- if (strchr(mode_string, 'w') == mode_string) {
- pgsql_mode |= INV_WRITE;
- create = 1;
- if (strchr(mode_string, '+') == mode_string+1) {
- pgsql_mode |= INV_READ;
- }
- }
-
-
- pgsql_lofp = (pgLofp *) emalloc(sizeof(pgLofp));
-
- if ((pgsql_lofd = lo_open(pgsql, pgsql_oid, pgsql_mode)) == -1) {
- if (create) {
- if ((pgsql_oid = lo_creat(pgsql, INV_READ|INV_WRITE)) == 0) {
- efree(pgsql_lofp);
- php_error(E_WARNING,"Unable to create PostgreSQL large object");
- RETURN_FALSE;
- } else {
- if ((pgsql_lofd = lo_open(pgsql, pgsql_oid, pgsql_mode)) == -1) {
- if (lo_unlink(pgsql, pgsql_oid) == -1) {
- efree(pgsql_lofp);
- php_error(E_WARNING,"Something's really messed up!!! Your database is badly corrupted in a way NOT related to PHP.");
- RETURN_FALSE;
- }
- efree(pgsql_lofp);
- php_error(E_WARNING,"Unable to open PostgreSQL large object");
- RETURN_FALSE;
- } else {
- pgsql_lofp->conn = pgsql;
- pgsql_lofp->lofd = pgsql_lofd;
- return_value->value.lval = zend_list_insert(pgsql_lofp, le_lofp);
- return_value->type = IS_LONG;
- }
- }
- } else {
- efree(pgsql_lofp);
- php_error(E_WARNING,"Unable to open PostgreSQL large object");
- RETURN_FALSE;
- }
- } else {
- pgsql_lofp->conn = pgsql;
- pgsql_lofp->lofd = pgsql_lofd;
- ZEND_REGISTER_RESOURCE(return_value, pgsql_lofp, le_lofp);
- /*
- return_value->value.lval = zend_list_insert(pgsql_lofp, le_lofp);
- return_value->type = IS_LONG;
- */
- }
-}
-/* }}} */
-
-/* {{{ proto void pg_loclose(int fd)
- Close a large object */
-PHP_FUNCTION(pg_loclose)
-{
- zval **pgsql_lofp;
- pgLofp *pgsql;
-
- switch(ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &pgsql_lofp)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- ZEND_FETCH_RESOURCE(pgsql, pgLofp *, pgsql_lofp, -1, "PostgreSQL large object", le_lofp);
-
- if (lo_close((PGconn *)pgsql->conn, pgsql->lofd) < 0) {
- php_error(E_WARNING,"Unable to close PostgreSQL large object descriptor %d", pgsql->lofd);
- RETVAL_FALSE;
- } else {
- RETVAL_TRUE;
- }
-
- zend_list_delete(Z_LVAL_PP(pgsql_lofp));
- return;
-}
-/* }}} */
-
-/* {{{ proto string pg_loread(int fd [, int len])
- Read a large object */
-PHP_FUNCTION(pg_loread)
-{
- zval **pgsql_id, **len;
- int buf_len = 1024, nbytes;
- char *buf;
- pgLofp *pgsql;
-
- if (ZEND_NUM_ARGS() < 1 || ZEND_NUM_ARGS() > 2 ||
- zend_get_parameters_ex(ZEND_NUM_ARGS(), &pgsql_id, &len) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(pgsql, pgLofp *, pgsql_id, -1, "PostgreSQL large object", le_lofp);
-
- if (ZEND_NUM_ARGS() > 1) {
- convert_to_long_ex(len);
- buf_len = Z_LVAL_PP(len);
- }
-
- buf = (char *) emalloc(sizeof(char)*(buf_len+1));
- if ((nbytes = lo_read((PGconn *)pgsql->conn, pgsql->lofd, buf, buf_len))<0) {
- efree(buf);
- RETURN_FALSE;
- }
-
- buf[nbytes] = 0;
- RETURN_STRINGL(buf, nbytes, 0);
-}
-/* }}} */
-
-/* {{{ proto int pg_lowrite(int fd, string buf [, int len])
- Write a large object */
-PHP_FUNCTION(pg_lowrite)
-{
- zval **pgsql_id, **str, **z_len;
- int nbytes;
- int len;
- pgLofp *pgsql;
- int argc = ZEND_NUM_ARGS();
-
- if (argc < 2 || argc > 3 ||
- zend_get_parameters_ex(argc, &pgsql_id, &str, &z_len) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(str);
-
- if (argc > 2) {
- convert_to_long_ex(z_len);
- len = Z_LVAL_PP(z_len);
- }
- else {
- len = Z_STRLEN_PP(str);
- }
-
- ZEND_FETCH_RESOURCE(pgsql, pgLofp *, pgsql_id, -1, "PostgreSQL large object", le_lofp);
-
- if ((nbytes = lo_write((PGconn *)pgsql->conn, pgsql->lofd, Z_STRVAL_PP(str), len)) == -1) {
- RETURN_FALSE;
- }
-
- RETURN_LONG(nbytes);
-}
-/* }}} */
-
-/* {{{ proto void pg_loreadall(int fd)
- Read a large object and send straight to browser */
-PHP_FUNCTION(pg_loreadall)
-{
- zval **pgsql_id;
- int i, tbytes;
- volatile int nbytes;
- char buf[8192];
- pgLofp *pgsql;
- int output=1;
-
- switch(ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &pgsql_id)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- ZEND_FETCH_RESOURCE(pgsql, pgLofp *, pgsql_id, -1, "PostgreSQL large object", le_lofp);
-
- tbytes = 0;
- while ((nbytes = lo_read((PGconn *)pgsql->conn, pgsql->lofd, buf, 8192))>0) {
- for(i=0; i<nbytes; i++) {
- if (output) { (void) PUTC(buf[i]); }
- }
- tbytes += i;
- }
- return_value->value.lval = tbytes;
- return_value->type = IS_LONG;
-}
-/* }}} */
-
-/* {{{ proto int pg_loimport(string filename [, resource connection])
- Import large object direct from filesystem */
-PHP_FUNCTION(pg_loimport)
-{
- zval **pgsql_link = NULL, **file_in;
- int id = -1;
- PGconn *pgsql;
- Oid oid;
- PLS_FETCH();
- PGLS_FETCH();
-
- switch (ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &file_in) == FAILURE) {
- RETURN_FALSE;
- }
- id = PGG(default_link);
- CHECK_DEFAULT_LINK(id);
- break;
- case 2:
- if (zend_get_parameters_ex(2, &file_in, &pgsql_link) == FAILURE) {
- RETURN_FALSE;
- }
- convert_to_string_ex(file_in);
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- if (PG(safe_mode) &&(!php_checkuid(Z_STRVAL_PP(file_in), NULL, CHECKUID_CHECK_FILE_AND_DIR))) {
- RETURN_FALSE;
- }
-
- ZEND_FETCH_RESOURCE2(pgsql, PGconn *, pgsql_link, id, "PostgreSQL link", le_link, le_plink);
-
- oid = lo_import(pgsql, Z_STRVAL_PP(file_in));
-
- if (oid > 0) {
- RETURN_LONG((int)oid);
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto bool pg_loexport(int objoid, string filename [, resource connection])
- Export large object direct to filesystem */
-PHP_FUNCTION(pg_loexport)
-{
- zval **pgsql_link = NULL, **oid_id, **file_out;
- int id = -1;
- Oid oid;
- PGconn *pgsql;
- PGLS_FETCH();
-
- switch (ZEND_NUM_ARGS()) {
- case 2:
- if (zend_get_parameters_ex(2, &oid_id, &file_out) == FAILURE) {
- RETURN_FALSE;
- }
- convert_to_long_ex(oid_id);
- convert_to_string_ex(file_out);
- id = PGG(default_link);
- CHECK_DEFAULT_LINK(id);
- break;
- case 3:
- if (zend_get_parameters_ex(3, &oid_id, &file_out, &pgsql_link) == FAILURE) {
- RETURN_FALSE;
- }
- convert_to_long_ex(oid_id);
- convert_to_string_ex(file_out);
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- ZEND_FETCH_RESOURCE2(pgsql, PGconn *, pgsql_link, id, "PostgreSQL link", le_link, le_plink);
-
- oid = (Oid) Z_LVAL_PP(oid_id);
-
- if (lo_export(pgsql, oid, Z_STRVAL_PP(file_out))) {
- RETURN_TRUE;
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-#if HAVE_PQCLIENTENCODING
-
-/* {{{ proto int pg_set_client_encoding([int connection,] string encoding)
- Set client encoding */
-PHP_FUNCTION(pg_set_client_encoding)
-{
- zval **encoding, **pgsql_link = NULL;
- int id = -1;
- PGconn *pgsql;
- PGLS_FETCH();
-
- switch(ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &encoding)==FAILURE) {
- RETURN_FALSE;
- }
- id = PGG(default_link);
- CHECK_DEFAULT_LINK(id);
- break;
- case 2:
- if (zend_get_parameters_ex(2, &pgsql_link, &encoding)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- ZEND_FETCH_RESOURCE2(pgsql, PGconn *, pgsql_link, id, "PostgreSQL link", le_link, le_plink);
-
- convert_to_string_ex(encoding);
- return_value->value.lval = PQsetClientEncoding(pgsql, Z_STRVAL_PP(encoding));
- return_value->type = IS_LONG;
-
-}
-/* }}} */
-
-/* {{{ proto string pg_client_encoding([int connection])
- Get the current client encoding */
-PHP_FUNCTION(pg_client_encoding)
-{
- zval **pgsql_link = NULL;
- int id = -1;
- PGconn *pgsql;
- PGLS_FETCH();
-
- switch(ZEND_NUM_ARGS()) {
- case 0:
- id = PGG(default_link);
- CHECK_DEFAULT_LINK(id);
- break;
- case 1:
- if (zend_get_parameters_ex(1, &pgsql_link)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- ZEND_FETCH_RESOURCE2(pgsql, PGconn *, pgsql_link, id, "PostgreSQL link", le_link, le_plink);
-
- /* Just do the same as found in PostgreSQL sources... */
-
-#ifndef HAVE_PGSQL_WITH_MULTIBYTE_SUPPORT
-#define pg_encoding_to_char(x) "SQL_ASCII"
-#endif
-
- return_value->value.str.val
- = (char *) pg_encoding_to_char(PQclientEncoding(pgsql));
- return_value->value.str.len = strlen(return_value->value.str.val);
- return_value->value.str.val = (char *) estrdup(return_value->value.str.val);
- return_value->type = IS_STRING;
-}
-/* }}} */
-#endif
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/pgsql/pgsql.dsp b/ext/pgsql/pgsql.dsp
deleted file mode 100644
index fd84f95258..0000000000
--- a/ext/pgsql/pgsql.dsp
+++ /dev/null
@@ -1,167 +0,0 @@
-# Microsoft Developer Studio Project File - Name="pgsql" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=pgsql - Win32 Debug_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "pgsql.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "pgsql.mak" CFG="pgsql - Win32 Debug_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "pgsql - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "pgsql - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "pgsql - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "pgsql - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "pgsql - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PGSQL_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "D:\Projects\php_build\postgresql\src\interfaces\libpq" /I "..\..\..\php_build\PostgreSQL\src\include" /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\php_build\postgresql\src\interfaces\libpq" /I "..\..\..\bindlib_w32" /D "NDEBUG" /D "PGSQL_EXPORTS" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZEND_WIN32" /D "PHP_WIN32" /D "COMPILE_DL_PGSQL" /D HAVE_PGSQL=1 /D ZEND_DEBUG=0 /D "HAVE_PQCMDTUPLES" /FD /c
-# SUBTRACT CPP /YX
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ws2_32.lib libpqdll.lib php4ts.lib /nologo /dll /machine:I386 /nodefaultlib:"msvcrt.lib" /out:"../../Release/pgsql.dll" /libpath:"..\..\..\PostgreSQL\lib" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
-
-!ELSEIF "$(CFG)" == "pgsql - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PGSQL_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "D:\Projects\php_build\postgresql\src\interfaces\libpq" /I "..\..\..\php_build\PostgreSQL\src\include" /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\php_build\postgresql\src\interfaces\libpq" /I "..\..\..\bindlib_w32" /D "_DEBUG" /D "PGSQL_EXPORTS" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZEND_WIN32" /D "PHP_WIN32" /D "COMPILE_DL_PGSQL" /D HAVE_PGSQL=1 /D ZEND_DEBUG=1 /D "HAVE_PQCMDTUPLES" /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /nodefaultlib:"msvcrtd.lib" /out:"../../Debug/pgsql.dll" /pdbtype:sept
-
-!ELSEIF "$(CFG)" == "pgsql - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\..\PostgreSQL\include" /I "..\..\..\bindlib_w32" /D "NDEBUG" /D "ZTS" /D "PGSQL_EXPORTS" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZEND_WIN32" /D "PHP_WIN32" /D "COMPILE_DL_PGSQL" /D HAVE_PGSQL=1 /D ZTS=1 /FD /c
-# SUBTRACT BASE CPP /YX
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\..\php_build\postgresql\src\interfaces\libpq" /I "..\..\..\php_build\PostgreSQL\src\include" /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D "NDEBUG" /D "ZTS" /D "PGSQL_EXPORTS" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZEND_WIN32" /D "PHP_WIN32" /D "COMPILE_DL_PGSQL" /D HAVE_PGSQL=1 /D ZEND_DEBUG=0 /D "HAVE_PQCMDTUPLES" /FR /FD /c
-# SUBTRACT CPP /YX
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ws2_32.lib libpqdll.lib php4ts.lib /nologo /dll /machine:I386 /libpath:"..\..\..\PostgreSQL\lib" /libpath:"..\..\Release_TS"
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ws2_32.lib libpq.lib php4ts.lib /nologo /dll /machine:I386 /out:"../../Release_TS/php_pgsql.dll" /libpath:"..\..\..\php_build\postgresql\src\interfaces\libpq\Release" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
-
-!ELSEIF "$(CFG)" == "pgsql - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "_DEBUG" /D "PGSQL_EXPORTS" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZEND_WIN32" /D "PHP_WIN32" /D "COMPILE_DL_PGSQL" /D HAVE_PGSQL=1 /D ZTS=1 /YX /FD /GZ /c
-# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "D:\Projects\php_build\postgresql\src\interfaces\libpq" /I "..\..\..\php_build\PostgreSQL\src\include" /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\php_build\postgresql\src\interfaces\libpq" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D "_DEBUG" /D "PGSQL_EXPORTS" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZEND_WIN32" /D "PHP_WIN32" /D "COMPILE_DL_PGSQL" /D HAVE_PGSQL=1 /D "ZTS" /D ZEND_DEBUG=1 /D "HAVE_PQCMDTUPLES" /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libpq.lib /nologo /dll /debug /machine:I386 /out:"../../Debug_TS/pgsql.dll" /pdbtype:sept
-
-!ENDIF
-
-# Begin Target
-
-# Name "pgsql - Win32 Release"
-# Name "pgsql - Win32 Debug"
-# Name "pgsql - Win32 Release_TS"
-# Name "pgsql - Win32 Debug_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\pgsql.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_pgsql.h
-# End Source File
-# End Group
-# End Target
-# End Project
diff --git a/ext/pgsql/php_pgsql.h b/ext/pgsql/php_pgsql.h
deleted file mode 100644
index 09d47dfcf6..0000000000
--- a/ext/pgsql/php_pgsql.h
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Zeev Suraski <zeev@zend.com> |
- | Jouni Ahto <jouni.ahto@exdec.fi> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifndef PHP_PGSQL_H
-#define PHP_PGSQL_H
-
-#if HAVE_PGSQL
-
-extern zend_module_entry pgsql_module_entry;
-#define pgsql_module_ptr &pgsql_module_entry
-
-#ifdef PHP_PGSQL_PRIVATE
-#undef SOCKET_SIZE_TYPE
-#include <libpq-fe.h>
-
-#ifdef PHP_WIN32
-#define INV_WRITE 0x00020000
-#define INV_READ 0x00040000
-#else
-#include <libpq/libpq-fs.h>
-#endif
-
-#ifdef PHP_WIN32
-#define PHP_PGSQL_API __declspec(dllexport)
-#else
-#define PHP_PGSQL_API
-#endif
-
-PHP_MINIT_FUNCTION(pgsql);
-PHP_MSHUTDOWN_FUNCTION(pgsql);
-PHP_RINIT_FUNCTION(pgsql);
-PHP_RSHUTDOWN_FUNCTION(pgsql);
-PHP_MINFO_FUNCTION(pgsql);
-PHP_FUNCTION(pg_connect);
-PHP_FUNCTION(pg_pconnect);
-PHP_FUNCTION(pg_close);
-PHP_FUNCTION(pg_dbname);
-PHP_FUNCTION(pg_errormessage);
-PHP_FUNCTION(pg_trace);
-PHP_FUNCTION(pg_untrace);
-PHP_FUNCTION(pg_options);
-PHP_FUNCTION(pg_port);
-PHP_FUNCTION(pg_tty);
-PHP_FUNCTION(pg_host);
-PHP_FUNCTION(pg_exec);
-PHP_FUNCTION(pg_numrows);
-PHP_FUNCTION(pg_numfields);
-PHP_FUNCTION(pg_cmdtuples);
-PHP_FUNCTION(pg_last_notice);
-PHP_FUNCTION(pg_fieldname);
-PHP_FUNCTION(pg_fieldsize);
-PHP_FUNCTION(pg_fieldtype);
-PHP_FUNCTION(pg_fieldnum);
-PHP_FUNCTION(pg_result);
-PHP_FUNCTION(pg_fetch_row);
-PHP_FUNCTION(pg_fetch_array);
-PHP_FUNCTION(pg_fetch_object);
-PHP_FUNCTION(pg_fieldprtlen);
-PHP_FUNCTION(pg_fieldisnull);
-PHP_FUNCTION(pg_freeresult);
-PHP_FUNCTION(pg_getlastoid);
-PHP_FUNCTION(pg_locreate);
-PHP_FUNCTION(pg_lounlink);
-PHP_FUNCTION(pg_loopen);
-PHP_FUNCTION(pg_loclose);
-PHP_FUNCTION(pg_loread);
-PHP_FUNCTION(pg_lowrite);
-PHP_FUNCTION(pg_loreadall);
-PHP_FUNCTION(pg_loimport);
-PHP_FUNCTION(pg_loexport);
-PHP_FUNCTION(pg_lolseek);
-PHP_FUNCTION(pg_lotell);
-PHP_FUNCTION(pg_put_line);
-PHP_FUNCTION(pg_end_copy);
-#if HAVE_PQCLIENTENCODING
-PHP_FUNCTION(pg_client_encoding);
-PHP_FUNCTION(pg_set_client_encoding);
-#endif
-
-void php_pgsql_do_connect(INTERNAL_FUNCTION_PARAMETERS,int persistent);
-int php_pgsql_get_default_link(INTERNAL_FUNCTION_PARAMETERS);
-void php_pgsql_get_link_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type);
-void php_pgsql_get_result_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type);
-char *get_field_name(PGconn *pgsql, Oid oid, HashTable *list);
-void php_pgsql_get_field_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type);
-void php_pgsql_data_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type);
-
-
-typedef struct pgLofp {
- PGconn *conn;
- int lofd;
-} pgLofp;
-
-typedef struct _php_pgsql_result_handle {
- PGconn *conn;
- PGresult *result;
- int row;
-} pgsql_result_handle;
-
-typedef struct {
- long default_link;
- long num_links,num_persistent;
- long max_links,max_persistent;
- long allow_persistent;
- int le_lofp,le_string;
- int ignore_notices;
- char *last_notice;
-} php_pgsql_globals;
-
-
-#ifdef ZTS
-# define PGLS_D php_pgsql_globals *pgsql_globals
-# define PGLS_DC , PGLS_D
-# define PGLS_C pgsql_globals
-# define PGLS_CC , PGLS_C
-# define PGG(v) (pgsql_globals->v)
-# define PGLS_FETCH() php_pgsql_globals *pgsql_globals = ts_resource(pgsql_globals_id)
-#else
-# define PGLS_D
-# define PGLS_DC
-# define PGLS_C
-# define PGLS_CC
-# define PGG(v) (pgsql_globals.v)
-# define PGLS_FETCH()
-extern PHP_PGSQL_API php_pgsql_globals pgsql_globals;
-#endif
-#endif
-
-#else
-
-#define pgsql_module_ptr NULL
-
-#endif
-
-#define phpext_pgsql_ptr pgsql_module_ptr
-
-#endif /* PHP_PGSQL_H */
diff --git a/ext/pgsql/setup.stub b/ext/pgsql/setup.stub
deleted file mode 100644
index e4019461bc..0000000000
--- a/ext/pgsql/setup.stub
+++ /dev/null
@@ -1,8 +0,0 @@
-# $Source$
-# $Id$
-
-define_option with-pgsql 'PostgreSQL support?' yesnodir \
- 'no /usr/local/pgsql PostgreSQL base install' \
-' Whether to build PHP with PostgreSQL support.\n
- More info about PostgreSQL can be found at\n
- http://www.postgreSQL.org/.'
diff --git a/ext/posix/CREDITS b/ext/posix/CREDITS
deleted file mode 100644
index c769635d91..0000000000
--- a/ext/posix/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-Posix
-Kristian Köhntopp
diff --git a/ext/posix/Makefile.in b/ext/posix/Makefile.in
deleted file mode 100644
index df96646962..0000000000
--- a/ext/posix/Makefile.in
+++ /dev/null
@@ -1,6 +0,0 @@
-
-LTLIBRARY_NAME = libposix.la
-LTLIBRARY_SOURCES = posix.c
-LTLIBRARY_SHARED_NAME = posix.la
-
-include $(top_srcdir)/build/dynlib.mk
diff --git a/ext/posix/config.m4 b/ext/posix/config.m4
deleted file mode 100644
index 6ee4ba5b36..0000000000
--- a/ext/posix/config.m4
+++ /dev/null
@@ -1,13 +0,0 @@
-dnl $Id$
-dnl config.m4 for extension posix
-dnl don't forget to call PHP_EXTENSION(posix)
-
-PHP_ARG_ENABLE(posix,whether to include POSIX-like functions,
-[ --disable-posix Disable POSIX-like functions], yes)
-
-if test "$PHP_POSIX" = "yes"; then
- AC_DEFINE(HAVE_POSIX, 1, [whether to include POSIX-like functions])
- PHP_EXTENSION(posix, $ext_shared)
-
- AC_CHECK_FUNCS(seteuid setegid setsid getsid setpgid ctermid mkfifo getrlimit)
-fi
diff --git a/ext/posix/php_posix.h b/ext/posix/php_posix.h
deleted file mode 100644
index 20992ac8ec..0000000000
--- a/ext/posix/php_posix.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Kristian Koehntopp <kris@koehntopp.de> |
- +----------------------------------------------------------------------+
- */
-
-
-/* $Id$ */
-
-#ifndef PHP_POSIX_H
-#define PHP_POSIX_H
-
-#if HAVE_POSIX
-#ifndef DLEXPORT
-#define DLEXPORT
-#endif
-
-extern zend_module_entry posix_module_entry;
-#define posix_module_ptr &posix_module_entry
-
-PHP_FUNCTION(posix_kill);
-
-PHP_FUNCTION(posix_getpid);
-PHP_FUNCTION(posix_getppid);
-
-PHP_FUNCTION(posix_getuid);
-PHP_FUNCTION(posix_getgid);
-PHP_FUNCTION(posix_geteuid);
-PHP_FUNCTION(posix_getegid);
-PHP_FUNCTION(posix_setuid);
-PHP_FUNCTION(posix_setgid);
-PHP_FUNCTION(posix_seteuid);
-PHP_FUNCTION(posix_setegid);
-
-PHP_FUNCTION(posix_getgroups);
-PHP_FUNCTION(posix_getlogin);
-
-PHP_FUNCTION(posix_getpgrp);
-PHP_FUNCTION(posix_setsid);
-PHP_FUNCTION(posix_setpgid);
-PHP_FUNCTION(posix_getpgid);
-PHP_FUNCTION(posix_getsid);
-
-PHP_FUNCTION(posix_uname);
-PHP_FUNCTION(posix_times);
-
-PHP_FUNCTION(posix_ctermid);
-PHP_FUNCTION(posix_ttyname);
-PHP_FUNCTION(posix_isatty);
-
-PHP_FUNCTION(posix_getcwd);
-
-PHP_FUNCTION(posix_mkfifo);
-PHP_FUNCTION(posix_getgrnam);
-PHP_FUNCTION(posix_getgrgid);
-PHP_FUNCTION(posix_getpwnam);
-PHP_FUNCTION(posix_getpwuid);
-
-PHP_FUNCTION(posix_getrlimit);
-
-typedef struct {
- int dummy;
-} posix_module;
-
-#else
-
-#define posix_module_ptr NULL
-
-#endif
-
-#define phpext_posix_ptr posix_module_ptr
-
-#endif /* PHP_POSIX_H */
diff --git a/ext/posix/posix.c b/ext/posix/posix.c
deleted file mode 100644
index 3ecc6eca06..0000000000
--- a/ext/posix/posix.c
+++ /dev/null
@@ -1,962 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Kristian Koehntopp <kris@koehntopp.de> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "ext/standard/info.h"
-#if !defined(PHP_API_VERSION) || PHP_API_VERSION < 19990421
-#include "internal_functions.h"
-#endif
-#if PHP_31 || PHP_API_VERSION >= 19990421
-# include "ext/standard/php_string.h"
-#else
-# include "php_string.h"
-#endif
-#include "php_posix.h"
-
-#if HAVE_POSIX
-#ifdef HAVE_SYS_TIME_H
-#include <sys/time.h>
-#endif
-#include <unistd.h>
-#include <sys/resource.h>
-#include <sys/utsname.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <signal.h>
-#include <sys/times.h>
-#include <errno.h>
-#include <grp.h>
-#include <pwd.h>
-#if !defined(PHP_API_VERSION) || PHP_API_VERSION < 19990421
-#include "php3_list.h"
-#endif
-
-#define SAFE_STRING(s) ((s)?(s):"")
-
-/* {{{ posix_functions[]
- */
-function_entry posix_functions[] = {
- /* POSIX.1, 3.3 */
- PHP_FE(posix_kill, NULL)
-
- /* POSIX.1, 4.1 */
- PHP_FE(posix_getpid, NULL)
- PHP_FE(posix_getppid, NULL)
-
- /* POSIX.1, 4.2 */
- PHP_FE(posix_getuid, NULL)
- PHP_FE(posix_setuid, NULL)
- PHP_FE(posix_geteuid, NULL)
- PHP_FE(posix_seteuid, NULL)
- PHP_FE(posix_getgid, NULL)
- PHP_FE(posix_setgid, NULL)
- PHP_FE(posix_getegid, NULL)
- PHP_FE(posix_setegid, NULL)
- PHP_FE(posix_getgroups, NULL)
- PHP_FE(posix_getlogin, NULL)
-
- /* POSIX.1, 4.3 */
- PHP_FE(posix_getpgrp, NULL)
- PHP_FE(posix_setsid, NULL)
- PHP_FE(posix_setpgid, NULL)
- /* Non-Posix functions which are common */
- PHP_FE(posix_getpgid, NULL)
- PHP_FE(posix_getsid, NULL)
-
- /* POSIX.1, 4.4 */
- PHP_FE(posix_uname, NULL)
-
- /* POSIX.1, 4.5 */
- PHP_FE(posix_times, NULL)
-
- /* POSIX.1, 4.7 */
- PHP_FE(posix_ctermid, NULL)
- PHP_FE(posix_ttyname, NULL)
- PHP_FE(posix_isatty, NULL)
-
- /* POSIX.1, 5.2 */
- PHP_FE(posix_getcwd, NULL)
-
- /* POSIX.1, 5.4 */
- PHP_FE(posix_mkfifo, NULL)
-
- /* POSIX.1, 9.2 */
- PHP_FE(posix_getgrnam, NULL)
- PHP_FE(posix_getgrgid, NULL)
- PHP_FE(posix_getpwnam, NULL)
- PHP_FE(posix_getpwuid, NULL)
-
- PHP_FE(posix_getrlimit, NULL)
-
- {NULL, NULL, NULL}
-};
-/* }}} */
-
-static PHP_MINFO_FUNCTION(posix);
-
-/* {{{ posix_module_entry
- */
-zend_module_entry posix_module_entry = {
- "posix",
- posix_functions,
- NULL,
- NULL,
- NULL,
- NULL,
- PHP_MINFO(posix),
- STANDARD_MODULE_PROPERTIES
-};
-/* }}} */
-
-#ifdef COMPILE_DL_POSIX
-ZEND_GET_MODULE(posix)
-#endif
-
-/* {{{ PHP_MINFO_FUNCTION
- */
-static PHP_MINFO_FUNCTION(posix)
-{
- php_info_print_table_start();
- php_info_print_table_row(2, "Revision", "$Revision$");
- php_info_print_table_end();
-}
-/* }}} */
-
-/* {{{ proto int posix_kill(int pid, int sig)
- Send a signal to a process (POSIX.1, 3.3.2) */
-
-PHP_FUNCTION(posix_kill)
-{
- pval *pid;
- pval *sig;
- int result;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters(ht, 2, &pid, &sig)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(pid);
- convert_to_long(sig);
-
- result = kill(pid->value.lval, sig->value.lval);
- if (result< 0) {
- php_error(E_WARNING, "posix_kill(%d, %d) failed with '%s'",
- pid->value.lval,
- sig->value.lval,
- strerror(errno));
- RETURN_FALSE;
- }
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto long posix_getpid(void)
- Get the current process id (POSIX.1, 4.1.1) */
-PHP_FUNCTION(posix_getpid)
-{
- pid_t pid;
-
- pid = getpid();
- RETURN_LONG(pid);
-}
-/* }}} */
-
-/* {{{ proto long posix_getppid(void)
- Get the parent process id (POSIX.1, 4.1.1) */
-PHP_FUNCTION(posix_getppid)
-{
- pid_t ppid;
-
- ppid = getppid();
- RETURN_LONG(ppid);
-}
-/* }}} */
-
-/* {{{ proto long posix_getuid(void)
- Get the current user id (POSIX.1, 4.2.1) */
-PHP_FUNCTION(posix_getuid)
-{
- uid_t uid;
-
- uid = getuid();
- RETURN_LONG(uid);
-}
-/* }}} */
-
-/* {{{ proto long posix_getgid(void)
- Get the current group id (POSIX.1, 4.2.1) */
-PHP_FUNCTION(posix_getgid)
-{
- gid_t gid;
-
- gid = getgid();
- RETURN_LONG(gid);
-}
-/* }}} */
-
-/* {{{ proto long posix_geteuid(void)
- Get the current effective user id (POSIX.1, 4.2.1) */
-PHP_FUNCTION(posix_geteuid)
-{
- uid_t uid;
-
- uid = geteuid();
- RETURN_LONG(uid);
-}
-/* }}} */
-
-/* {{{ proto long posix_getegid(void)
- Get the current effective group id (POSIX.1, 4.2.1) */
-PHP_FUNCTION(posix_getegid)
-{
- gid_t gid;
-
- gid = getegid();
- RETURN_LONG(gid);
-}
-/* }}} */
-
-/* {{{ proto long posix_setuid(long uid)
- Set user id (POSIX.1, 4.2.2) */
-PHP_FUNCTION(posix_setuid)
-{
- pval *uid;
- int result;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters(ht, 1, &uid)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(uid);
-
- result = setuid(uid->value.lval);
- if (result < 0) {
- php_error(E_WARNING, "posix_setuid(%d) failed with '%s'. Must be root",
- uid->value.lval,
- strerror(errno));
- RETURN_FALSE;
- }
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto long posix_setgid(long uid)
- Set group id (POSIX.1, 4.2.2) */
-PHP_FUNCTION(posix_setgid)
-{
- pval *gid;
- int result;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters(ht, 1, &gid)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(gid);
-
- result = setgid(gid->value.lval);
- if (result < 0) {
- php_error(E_WARNING, "posix_setgid(%d) failed with '%s'. Must be root",
- gid->value.lval,
- strerror(errno));
- RETURN_FALSE;
- }
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto long posix_seteuid(long uid)
- Set effective user id */
-PHP_FUNCTION(posix_seteuid)
-{
-#ifdef HAVE_SETEUID
- pval *uid;
- int result;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters(ht, 1, &uid)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(uid);
-
- result = seteuid(uid->value.lval);
- if (result < 0) {
- php_error(E_WARNING, "posix_setuid(%d) failed with '%s'.",
- uid->value.lval,
- strerror(errno));
- RETURN_FALSE;
- }
-
- RETURN_TRUE;
-#else
- RETURN_FALSE;
-#endif
-}
-/* }}} */
-
-/* {{{ proto long posix_setegid(long uid)
- Set effective group id */
-PHP_FUNCTION(posix_setegid)
-{
-#ifdef HAVE_SETEGID
- pval *gid;
- int result;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters(ht, 1, &gid)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(gid);
-
- result = setegid(gid->value.lval);
- if (result < 0) {
- php_error(E_WARNING, "posix_setgid(%d) failed with '%s'.",
- gid->value.lval,
- strerror(errno));
- RETURN_FALSE;
- }
-
- RETURN_TRUE;
-#else
- RETURN_FALSE;
-#endif
-}
-/* }}} */
-
-/* {{{ proto long posix_getgroups(void)
- Get supplementary group id's (POSIX.1, 4.2.3) */
-PHP_FUNCTION(posix_getgroups)
-{
- gid_t gidlist[NGROUPS_MAX];
- int result;
- int i;
-
- result = getgroups(NGROUPS_MAX, gidlist);
- if (result < 0) {
- php_error(E_WARNING, "posix_getgroups() failed with '%s'",
- strerror(errno));
- RETURN_FALSE;
- }
-
- if (array_init(return_value) == FAILURE) {
- RETURN_FALSE;
- }
-
- for (i=0; i<result; i++) {
- add_next_index_long(return_value,gidlist[i]);
- }
-}
-/* }}} */
-
-/* {{{ proto string posix_getlogin(void)
- Get user name (POSIX.1, 4.2.4) */
-PHP_FUNCTION(posix_getlogin)
-{
- char *p;
-
- p = getlogin();
- if (p == NULL) {
- php_error(E_WARNING, "Cannot determine your login name. Something is really wrong here.");
- RETURN_FALSE;
- }
-
- RETURN_STRING(p, 1);
-}
-/* }}} */
-
-/* {{{ proto long posix_getpgrp(void)
- Get current process group id (POSIX.1, 4.3.1) */
-PHP_FUNCTION(posix_getpgrp)
-{
- pid_t pgrp;
-
- pgrp = getpgrp();
- RETURN_LONG(pgrp);
-}
-/* }}} */
-
-/* {{{ proto long posix_setsid(void)
- Create session and set process group id (POSIX.1, 4.3.2) */
-PHP_FUNCTION(posix_setsid)
-{
-#ifdef HAVE_SETSID
- pid_t sid;
-
- sid = setsid();
- RETURN_LONG(sid);
-#else
- RETURN_FALSE;
-#endif
-}
-/* }}} */
-
-/* {{{ proto long posix_setpgid(long pid, long pgid)
- Set process group id for job control (POSIX.1, 4.3.3) */
-PHP_FUNCTION(posix_setpgid)
-{
- pval *pid;
- pval *pgid;
- int result;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters(ht, 2, &pid, &pgid)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(pid);
- convert_to_long(pgid);
-
- result = setpgid(pid->value.lval, pgid->value.lval);
- if (result< 0) {
- php_error(E_WARNING, "posix_setpgid(%d, %d) failed with '%s'",
- pid->value.lval,
- pgid->value.lval,
- strerror(errno));
- RETURN_FALSE;
- }
-
- RETURN_LONG(result);
-}
-/* }}} */
-
-/* {{{ proto long posix_getpgid(void)
- Get the process group id of the specified process (This is not a POSIX function, but a SVR4ism, so we compile conditionally) */
-PHP_FUNCTION(posix_getpgid)
-{
-#ifdef HAVE_GETPGID
- pid_t pgid;
- pval *pid;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters(ht, 1, &pid)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(pid);
- pgid = getpgid(pid->value.lval);
- if (pgid < 0) {
- php_error(E_WARNING, "posix_getpgid(%d) failed with '%s'",
- pid->value.lval,
- strerror(errno));
- RETURN_FALSE;
- }
-
- return_value->type= IS_LONG;
- return_value->value.lval = pgid;
-#else
- RETURN_FALSE;
-#endif
-}
-/* }}} */
-
-/* {{{ proto long posix_getsid(void)
- Get process group id of session leader (This is not a POSIX function, but a SVR4ism, so be compile conditionally) */
-PHP_FUNCTION(posix_getsid)
-{
-#ifdef HAVE_GETSID
- pid_t sid;
- pval *pid;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters(ht, 1, &pid)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(pid);
- sid = getsid(pid->value.lval);
- if (sid < 0) {
- php_error(E_WARNING, "posix_getsid(%d) failed with '%s'",
- pid->value.lval,
- strerror(errno));
- RETURN_FALSE;
- }
-
- return_value->type= IS_LONG;
- return_value->value.lval = sid;
-#else
- RETURN_FALSE;
-#endif
-}
-/* }}} */
-
-/* {{{ proto array posix_uname(void)
- Get system name (POSIX.1, 4.4.1) */
-PHP_FUNCTION(posix_uname)
-{
- struct utsname u;
-
- uname(&u);
-
- if (array_init(return_value) == FAILURE) {
- RETURN_FALSE;
- }
- add_assoc_string(return_value, "sysname", u.sysname, 1);
- add_assoc_string(return_value, "nodename", u.nodename, 1);
- add_assoc_string(return_value, "release", u.release, 1);
- add_assoc_string(return_value, "version", u.version, 1);
- add_assoc_string(return_value, "machine", u.machine, 1);
-}
-/* }}} */
-
-/* POSIX.1, 4.5.1 time() - Get System Time
- already covered by PHP
- */
-
-/* {{{ proto array posix_times(void)
- Get process times (POSIX.1, 4.5.2) */
-PHP_FUNCTION(posix_times)
-{
- struct tms t;
- clock_t ticks;
-
- ticks = times(&t);
- if (ticks < 0) {
- php_error(E_WARNING, "posix_times failed with '%s'",
- strerror(errno));
- }
-
- if (array_init(return_value) == FAILURE) {
- RETURN_FALSE;
- }
- add_assoc_long(return_value, "ticks", ticks);
- add_assoc_long(return_value, "utime", t.tms_utime);
- add_assoc_long(return_value, "stime", t.tms_stime);
- add_assoc_long(return_value, "cutime", t.tms_cutime);
- add_assoc_long(return_value, "cstime", t.tms_cstime);
-}
-/* }}} */
-
-/* POSIX.1, 4.6.1 getenv() - Environment Access
- already covered by PHP
-*/
-
-/* {{{ proto string posix_ctermid(void)
- Generate terminal path name (POSIX.1, 4.7.1) */
-PHP_FUNCTION(posix_ctermid)
-{
-#ifdef HAVE_CTERMID
- char buffer[L_ctermid];
- char *p;
-
- p = ctermid(buffer);
- if (p == NULL) {
- php_error(E_WARNING, "posix_ctermid() failed with '%s'",
- strerror(errno));
- RETURN_FALSE;
- }
-
- RETURN_STRING(buffer, 1);
-#else
- RETURN_FALSE;
-#endif
-}
-/* }}} */
-
-/* {{{ proto string posix_ttyname(int fd)
- Determine terminal device name (POSIX.1, 4.7.2) */
-PHP_FUNCTION(posix_ttyname)
-{
- pval *fd;
- char *p;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters(ht, 1, &fd)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long(fd);
-
- p = ttyname(fd->value.lval);
- if (p == NULL) {
- php_error(E_WARNING, "posix_ttyname(%d) failed with '%s'",
- fd->value.lval,
- strerror(errno));
- RETURN_FALSE;
- }
-
- RETURN_STRING(p, 1);
-}
-/* }}} */
-
-/* {{{ proto bool posix_isatty(int fd)
- Determine if filedesc is a tty (POSIX.1, 4.7.1) */
-PHP_FUNCTION(posix_isatty)
-{
- pval *fd;
- int result;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters(ht, 1, &fd)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long(fd);
-
- result = isatty(fd->value.lval);
- if (!result)
- RETURN_FALSE;
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/*
- POSIX.1, 4.8.1 sysconf() - TODO
- POSIX.1, 5.7.1 pathconf(), fpathconf() - TODO
-
- POSIX.1, 5.1.2 opendir(), readdir(), rewinddir(), closedir()
- POSIX.1, 5.2.1 chdir()
- already supported by PHP
- */
-
-/* {{{ proto string posix_getcwd(void)
- Get working directory pathname (POSIX.1, 5.2.2) */
-PHP_FUNCTION(posix_getcwd)
-{
- char buffer[MAXPATHLEN];
- char *p;
-
- p = VCWD_GETCWD(buffer, MAXPATHLEN);
- if (!p) {
- php_error(E_WARNING, "posix_getcwd() failed with '%s'",
- strerror(errno));
- RETURN_FALSE;
- }
-
- RETURN_STRING(buffer, 1);
-}
-/* }}} */
-
-/*
- POSIX.1, 5.3.x open(), creat(), umask()
- POSIX.1, 5.4.1 link()
- already supported by PHP.
- */
-
-/* {{{ proto string posix_mkfifo(void)
- Make a FIFO special file (POSIX.1, 5.4.2) */
-PHP_FUNCTION(posix_mkfifo)
-{
-#ifdef HAVE_MKFIFO
- pval *path;
- pval *mode;
- int result;
- PLS_FETCH();
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters(ht, 2, &path, &mode) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string(path);
- convert_to_long(mode);
-
- if (PG(safe_mode) && (!php_checkuid(path->value.str.val, NULL, CHECKUID_ALLOW_ONLY_DIR))) {
- RETURN_FALSE;
- }
- result = mkfifo(path->value.str.val, mode->value.lval);
- if (result < 0) {
- php_error(E_WARNING, "posix_mkfifo(%s) failed with '%s'",
- path->value.str.val,
- strerror(errno));
- RETURN_FALSE;
- }
-
- RETURN_TRUE;
-#else
- RETURN_FALSE;
-#endif
-}
-/* }}} */
-
-/*
- POSIX.1, 5.5.1 unlink()
- POSIX.1, 5.5.2 rmdir()
- POSIX.1, 5.5.3 rename()
- POSIX.1, 5.6.x stat(), access(), chmod(), utime()
- already supported by PHP (access() not supported, because it is
- braindead and dangerous and gives outdated results).
-
- POSIX.1, 6.x most I/O functions already supported by PHP.
- POSIX.1, 7.x tty functions, TODO
- POSIX.1, 8.x interactions with other C language functions
- POSIX.1, 9.x system database access
- */
-
-/* {{{ proto array posix_getgrnam(string groupname)
- Group database access (POSIX.1, 9.2.1) */
-PHP_FUNCTION(posix_getgrnam)
-{
- pval *name;
- char buffer[10];
- struct group *g;
- char **p;
- int count;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters(ht, 1, &name)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string(name);
-
- g = getgrnam(name->value.str.val);
- if (!g) {
- php_error(E_WARNING, "posix_getgrnam(%s) failed with '%s'",
- name->value.str.val,
- strerror(errno));
- RETURN_FALSE;
- }
- if (array_init(return_value) == FAILURE) {
- RETURN_FALSE;
- }
- add_assoc_string(return_value, "name", g->gr_name, 1);
- add_assoc_long (return_value, "gid", g->gr_gid);
- for (count=0, p=g->gr_mem; p[count] != NULL; count++) {
- snprintf(buffer, 10, "%d", count);
- add_assoc_string(return_value, buffer, p[count], 1);
- }
- add_assoc_long(return_value, "members", count);
-}
-/* }}} */
-
-/* {{{ proto array posix_getgrgid(long gid)
- Group database access (POSIX.1, 9.2.1) */
-PHP_FUNCTION(posix_getgrgid)
-{
- pval *gid;
- char buffer[10];
- struct group *g;
- char **p;
- int count;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters(ht, 1, &gid)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long(gid);
-
- g = getgrgid(gid->value.lval);
- if (!g) {
- php_error(E_WARNING, "posix_getgrgid(%d) failed with '%s'",
- gid->value.lval,
- strerror(errno));
- RETURN_FALSE;
- }
- if (array_init(return_value) == FAILURE) {
- RETURN_FALSE;
- }
- add_assoc_string(return_value, "name", g->gr_name, 1);
- add_assoc_long (return_value, "gid", g->gr_gid);
- for (count=0, p=g->gr_mem; p[count] != NULL; count++) {
- snprintf(buffer, 10, "%d", count);
- add_assoc_string(return_value, buffer, p[count], 1);
- }
- add_assoc_long(return_value, "members", count);
-}
-/* }}} */
-
-/* {{{ proto array posix_getpwnam(string groupname)
- User database access (POSIX.1, 9.2.2) */
-PHP_FUNCTION(posix_getpwnam)
-{
- pval *name;
- struct passwd *pw;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters(ht, 1, &name)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string(name);
-
- pw = getpwnam(name->value.str.val);
- if (!pw) {
- php_error(E_WARNING, "posix_getpwnam(%s) failed with '%s'",
- name->value.str.val,
- strerror(errno));
- RETURN_FALSE;
- }
- if (array_init(return_value) == FAILURE) {
- RETURN_FALSE;
- }
- add_assoc_string(return_value, "name", pw->pw_name, 1);
- add_assoc_string(return_value, "passwd", pw->pw_passwd, 1);
- add_assoc_long (return_value, "uid", pw->pw_uid);
- add_assoc_long (return_value, "gid", pw->pw_gid);
- add_assoc_string(return_value, "gecos", pw->pw_gecos, 1);
- add_assoc_string(return_value, "dir", pw->pw_dir, 1);
- add_assoc_string(return_value, "shell", pw->pw_shell, 1);
-}
-/* }}} */
-
-/* {{{ proto array posix_getpwuid(long uid)
- User database access (POSIX.1, 9.2.2) */
-PHP_FUNCTION(posix_getpwuid)
-{
- pval *uid;
- struct passwd *pw;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters(ht, 1, &uid)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long(uid);
-
- pw = getpwuid(uid->value.lval);
- if (!pw) {
- php_error(E_WARNING, "posix_getpwuid(%d) failed with '%s'",
- uid->value.lval,
- strerror(errno));
- RETURN_FALSE;
- }
- if (array_init(return_value) == FAILURE) {
- RETURN_FALSE;
- }
- add_assoc_string(return_value, "name", pw->pw_name, 1);
- add_assoc_string(return_value, "passwd", pw->pw_passwd, 1);
- add_assoc_long (return_value, "uid", pw->pw_uid);
- add_assoc_long (return_value, "gid", pw->pw_gid);
- add_assoc_string(return_value, "gecos", pw->pw_gecos, 1);
- add_assoc_string(return_value, "dir", pw->pw_dir, 1);
- add_assoc_string(return_value, "shell", pw->pw_shell, 1);
-}
-/* }}} */
-
-
-#ifdef HAVE_GETRLIMIT
-
-#define UNLIMITED_STRING "unlimited"
-
-/* {{{ posix_addlimit
- */
-static int posix_addlimit(int limit, char *name, pval *return_value) {
- int result;
- struct rlimit rl;
- char hard[80];
- char soft[80];
-
- snprintf(hard, 80, "hard %s", name);
- snprintf(soft, 80, "soft %s", name);
-
- result = getrlimit(limit, &rl);
- if (result < 0) {
- php_error(E_WARNING, "posix_getrlimit failed to getrlimit(RLIMIT_CORE with '%s'", strerror(errno));
- return FAILURE;
- }
-
- if (rl.rlim_cur == RLIM_INFINITY) {
- add_assoc_stringl(return_value, soft, UNLIMITED_STRING, sizeof(UNLIMITED_STRING)-1, 1);
- } else {
- add_assoc_long(return_value, soft, rl.rlim_cur);
- }
-
- if (rl.rlim_max == RLIM_INFINITY) {
- add_assoc_stringl(return_value, hard, UNLIMITED_STRING, sizeof(UNLIMITED_STRING)-1, 1);
- } else {
- add_assoc_long(return_value, hard, rl.rlim_max);
- }
-
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ limits[]
- */
-struct limitlist {
- int limit;
- char *name;
-} limits[] = {
-#ifdef RLIMIT_CORE
- { RLIMIT_CORE, "core" },
-#endif
-
-#ifdef RLIMIT_DATA
- { RLIMIT_DATA, "data" },
-#endif
-
-#ifdef RLIMIT_STACK
- { RLIMIT_STACK, "stack" },
-#endif
-
-#ifdef RLIMIT_VMEM
- { RLIMIT_VMEM, "virtualmem" },
-#endif
-
-#ifdef RLIMIT_AS
- { RLIMIT_AS, "totalmem" },
-#endif
-
-#ifdef RLIMIT_RSS
- { RLIMIT_RSS, "rss" },
-#endif
-
-#ifdef RLIMIT_NPROC
- { RLIMIT_NPROC, "maxproc" },
-#endif
-
-#ifdef RLIMIT_MEMLOCK
- { RLIMIT_MEMLOCK, "memlock" },
-#endif
-
-#ifdef RLIMIT_CPU
- { RLIMIT_CPU, "cpu" },
-#endif
-
-#ifdef RLIMIT_FSIZE
- { RLIMIT_FSIZE, "filesize" },
-#endif
-
-#ifdef RLIMIT_NOFILE
- { RLIMIT_NOFILE, "openfiles" },
-#endif
-
-#ifdef RLIMIT_OFILE
- { RLIMIT_OFILE, "openfiles" },
-#endif
-
- { 0, NULL }
-};
-/* }}} */
-
-#endif /* HAVE_GETRLIMIT */
-
-/* {{{ proto long posix_getrlimit(void)
- Get system resource consumption limits (This is not a POSIX function, but a BSDism and a SVR4ism. We compile conditionally) */
-PHP_FUNCTION(posix_getrlimit)
-{
-#ifdef HAVE_GETRLIMIT
- struct limitlist *l = NULL;
-
- if (array_init(return_value) == FAILURE) {
- RETURN_FALSE;
- }
-
- for (l=limits; l->name; l++) {
- if (posix_addlimit(l->limit, l->name, return_value) == FAILURE)
- RETURN_FALSE;
- }
-#else
- RETURN_FALSE;
-#endif
-}
-/* }}} */
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/pspell/CREDITS b/ext/pspell/CREDITS
deleted file mode 100644
index a7919d4b7c..0000000000
--- a/ext/pspell/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-Pspell
-Vlad Krupin
diff --git a/ext/pspell/Makefile.in b/ext/pspell/Makefile.in
deleted file mode 100644
index 769b2f5e84..0000000000
--- a/ext/pspell/Makefile.in
+++ /dev/null
@@ -1,7 +0,0 @@
-
-LTLIBRARY_NAME = libpspell.la
-LTLIBRARY_SOURCES = pspell.c
-LTLIBRARY_SHARED_NAME = pspell.la
-LTLIBRARY_SHARED_LIBADD = $(PSPELL_SHARED_LIBADD)
-
-include $(top_srcdir)/build/dynlib.mk
diff --git a/ext/pspell/README b/ext/pspell/README
deleted file mode 100644
index b7d3adf198..0000000000
--- a/ext/pspell/README
+++ /dev/null
@@ -1,51 +0,0 @@
-README file for pspell (spellchecker) module for PHP4
------------------------------------------------------
-
-The latest release of pspell is always available from
-
- http://pspell.sourceforge.net/
-
-This module was developed and tested with aspell-.31.1 and pspell-.11.0.2,
-although slightly earlier (and hopefully later) versions of those libraries
-should work as well.
-
-General notes
--------------
-
-Please, note that somewhere around version .27.x (I believe) aspell stopped
-working with the aspell module for php. This is due to the fact that the
-author changed things around a bit, and suggested that people link to pspell
-in the future rather than to aspell. That's exactly what this module is for.
-It has the same basic functionality as aspell (and more features are being
-added). I did not want to modify existing aspell module, because it would
-break things for those who are using older aspell, or result in very ugly code.
-Rather, I wrote a new module - pspell.
-
-
-Building pspell on a Unix system
---------------------------------
-
-In order to use pspell, you need to have *both* aspell and pspell libraries
-installed, and they have to be compatible with each other. Get the latest
-release of both at the URL given above.
-
-I expect the libraries to be in /usr/local (that's the default when you
-cofigure pspell and aspell with their 'configure' scripts woth no parameters).
-If that location is different, please specify it in --with-pspell=PATH, where
-PATH is the path you specified for pspell libraries.
-
-Notes on personalized dictionaries
-----------------------------------
-
-It is now possible to have personalized dictionaries with pspell. This is
-achieved by opening a dictionary with pspell_new_personal() rather than
-pspell_new() and specifying the custom dictionary as the first parameter.
-The parameter probably should begin with '/' because otherwise it will
-be relative to $HOME, which is probably set to "/root". This is probably not
-what you want because you need write access for nobody to be able to write
-to a dictionary. Once the dictionary is open, you can use
-pspell_add_to_personal() to add words to the wordlist and finally
-pspell_save_wordlist() to save it.
-
-Note that at this moment pspell_save_wordlist() will return TRUE, even if
-there was an error. This will be changed once pspell library is fixed. \ No newline at end of file
diff --git a/ext/pspell/config.m4 b/ext/pspell/config.m4
deleted file mode 100644
index af3d2abe0b..0000000000
--- a/ext/pspell/config.m4
+++ /dev/null
@@ -1,33 +0,0 @@
-dnl $Id$
-
-PHP_ARG_WITH(pspell,whether to include pspell support,
-[ --with-pspell[=DIR] Include PSPELL support.])
-
-if test "$PHP_PSPELL" != "no"; then
- PHP_EXTENSION(pspell, $ext_shared)
- if test "$PHP_PSPELL" != "yes"; then
- PSPELL_SEARCH_DIRS=$PHP_PSPELL
- else
- PSPELL_SEARCH_DIRS="/usr/local /usr"
- fi
- for i in $PSPELL_SEARCH_DIRS; do
- if test -f $i/include/pspell/pspell.h; then
- PSPELL_DIR=$i
- PSPELL_INCDIR=$i/include/pspell
- elif test -f $i/include/pspell.h; then
- PSPELL_DIR=$i
- PSPELL_INCDIR=$i/include
- fi
- done
-
- if test -z "$PSPELL_DIR"; then
- AC_MSG_ERROR(Cannot find pspell)
- fi
-
- PSPELL_LIBDIR=$PSPELL_DIR/lib
-
- AC_DEFINE(HAVE_PSPELL,1,[ ])
- PHP_SUBST(PSPELL_SHARED_LIBADD)
- PHP_ADD_LIBRARY_WITH_PATH(pspell, $PSPELL_LIBDIR, PSPELL_SHARED_LIBADD)
- PHP_ADD_INCLUDE($PSPELL_INCDIR)
-fi
diff --git a/ext/pspell/php_pspell.h b/ext/pspell/php_pspell.h
deleted file mode 100644
index 9e14f3b74f..0000000000
--- a/ext/pspell/php_pspell.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Vlad Krupin <phpdevel@echospace.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef _PSPELL_H
-#define _PSPELL_H
-#if HAVE_PSPELL
-extern zend_module_entry pspell_module_entry;
-#define pspell_module_ptr &pspell_module_entry
-
-PHP_MINIT_FUNCTION(pspell);
-PHP_MINFO_FUNCTION(pspell);
-PHP_FUNCTION(pspell_new);
-PHP_FUNCTION(pspell_new_personal);
-PHP_FUNCTION(pspell_new_config);
-PHP_FUNCTION(pspell_check);
-PHP_FUNCTION(pspell_suggest);
-PHP_FUNCTION(pspell_store_replacement);
-PHP_FUNCTION(pspell_add_to_personal);
-PHP_FUNCTION(pspell_add_to_session);
-PHP_FUNCTION(pspell_clear_session);
-PHP_FUNCTION(pspell_save_wordlist);
-PHP_FUNCTION(pspell_config_create);
-PHP_FUNCTION(pspell_config_runtogether);
-PHP_FUNCTION(pspell_config_mode);
-PHP_FUNCTION(pspell_config_ignore);
-PHP_FUNCTION(pspell_config_personal);
-PHP_FUNCTION(pspell_config_repl);
-PHP_FUNCTION(pspell_config_save_repl);
-#else
-#define pspell_module_ptr NULL
-#endif
-
-#define phpext_pspell_ptr pspell_module_ptr
-
-#endif /* _PSPELL_H */
diff --git a/ext/pspell/pspell.c b/ext/pspell/pspell.c
deleted file mode 100644
index 76534e5710..0000000000
--- a/ext/pspell/pspell.c
+++ /dev/null
@@ -1,805 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Vlad Krupin <phpdevel@echospace.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#define IS_EXT_MODULE
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-
-#include <stdlib.h>
-#include <ctype.h>
-#include <stdio.h>
-
-#if HAVE_PSPELL
-
-/* this will enforce compatibility in .12 version (broken after .11.2) */
-#define USE_ORIGINAL_MANAGER_FUNCS
-
-#include "php_pspell.h"
-#include <pspell/pspell.h>
-#include "ext/standard/info.h"
-
-#define PSPELL_FAST 1L
-#define PSPELL_NORMAL 2L
-#define PSPELL_BAD_SPELLERS 3L
-#define PSPELL_SPEED_MASK_INTERNAL 3L
-#define PSPELL_RUN_TOGETHER 8L
-
-/* {{{ pspell_functions[]
- */
-function_entry pspell_functions[] = {
- PHP_FE(pspell_new, NULL)
- PHP_FE(pspell_new_personal, NULL)
- PHP_FE(pspell_new_config, NULL)
- PHP_FE(pspell_check, NULL)
- PHP_FE(pspell_suggest, NULL)
- PHP_FE(pspell_store_replacement, NULL)
- PHP_FE(pspell_add_to_personal, NULL)
- PHP_FE(pspell_add_to_session, NULL)
- PHP_FE(pspell_clear_session, NULL)
- PHP_FE(pspell_save_wordlist, NULL)
- PHP_FE(pspell_config_create, NULL)
- PHP_FE(pspell_config_runtogether, NULL)
- PHP_FE(pspell_config_mode, NULL)
- PHP_FE(pspell_config_ignore, NULL)
- PHP_FE(pspell_config_personal, NULL)
- PHP_FE(pspell_config_repl, NULL)
- PHP_FE(pspell_config_save_repl, NULL)
-};
-/* }}} */
-
-static int le_pspell, le_pspell_config;
-
-zend_module_entry pspell_module_entry = {
- "pspell", pspell_functions, PHP_MINIT(pspell), NULL, NULL, NULL, PHP_MINFO(pspell), STANDARD_MODULE_PROPERTIES
-};
-
-#ifdef COMPILE_DL_PSPELL
-ZEND_GET_MODULE(pspell)
-#endif
-
-static void php_pspell_close(zend_rsrc_list_entry *rsrc)
-{
- PspellManager *manager = (PspellManager *)rsrc->ptr;
- delete_pspell_manager(manager);
-}
-
-static void php_pspell_close_config(zend_rsrc_list_entry *rsrc)
-{
- PspellConfig *config = (PspellConfig *)rsrc->ptr;
- delete_pspell_config(config);
-}
-
-/* {{{ PHP_MINIT_FUNCTION
- */
-PHP_MINIT_FUNCTION(pspell){
- REGISTER_MAIN_LONG_CONSTANT("PSPELL_FAST", PSPELL_FAST, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_LONG_CONSTANT("PSPELL_NORMAL", PSPELL_NORMAL, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_LONG_CONSTANT("PSPELL_BAD_SPELLERS", PSPELL_BAD_SPELLERS, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_LONG_CONSTANT("PSPELL_RUN_TOGETHER", PSPELL_RUN_TOGETHER, CONST_PERSISTENT | CONST_CS);
- le_pspell = zend_register_list_destructors_ex(php_pspell_close, NULL, "pspell", module_number);
- le_pspell_config = zend_register_list_destructors_ex(php_pspell_close_config, NULL, "pspell config", module_number);
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ proto int pspell_new(string language [, string spelling [, string jargon [, string encoding [, int mode]]]])
- Load a dictionary */
-PHP_FUNCTION(pspell_new){
- zval **language,**spelling,**jargon,**encoding,**pmode;
- long mode = 0L, speed = 0L;
- int argc;
- int ind;
-
- PspellCanHaveError *ret;
- PspellManager *manager;
- PspellConfig *config;
-
- argc = ZEND_NUM_ARGS();
- if (argc < 1 || argc > 5 || zend_get_parameters_ex(argc,&language,&spelling,&jargon,&encoding,&pmode) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- config = new_pspell_config();
- convert_to_string_ex(language);
- pspell_config_replace(config, "language-tag", (*language)->value.str.val);
-
- if(argc > 1){
- convert_to_string_ex(spelling);
- if((*spelling)->value.str.len > 0){
- pspell_config_replace(config, "spelling", (*spelling)->value.str.val);
- }
- }
-
- if(argc > 2){
- convert_to_string_ex(jargon);
- if((*jargon)->value.str.len > 0){
- pspell_config_replace(config, "jargon", (*jargon)->value.str.val);
- }
- }
-
- if(argc > 3){
- convert_to_string_ex(encoding);
- if((*encoding)->value.str.len > 0){
- pspell_config_replace(config, "encoding", (*encoding)->value.str.val);
- }
- }
-
- if(argc > 4){
- convert_to_long_ex(pmode);
- mode = Z_LVAL_PP(pmode);
- speed = mode & PSPELL_SPEED_MASK_INTERNAL;
-
- /* First check what mode we want (how many suggestions) */
- if(speed == PSPELL_FAST){
- pspell_config_replace(config, "sug-mode", "fast");
- }else if(speed == PSPELL_NORMAL){
- pspell_config_replace(config, "sug-mode", "normal");
- }else if(speed == PSPELL_BAD_SPELLERS){
- pspell_config_replace(config, "sug-mode", "bad-spellers");
- }
-
- /* Then we see if run-together words should be treated as valid components */
- if(mode & PSPELL_RUN_TOGETHER){
- pspell_config_replace(config, "run-together", "true");
- }
- }
-
- ret = new_pspell_manager(config);
- delete_pspell_config(config);
-
- if(pspell_error_number(ret) != 0){
- php_error(E_WARNING, "PSPELL couldn't open the dictionary. reason: %s ", pspell_error_message(ret));
- RETURN_FALSE;
- }
-
- manager = to_pspell_manager(ret);
- ind = zend_list_insert(manager, le_pspell);
- RETURN_LONG(ind);
-}
-/* }}} */
-
-/* {{{ proto int pspell_new_personal(string personal, string language [, string spelling [, string jargon [, string encoding [, int mode]]]])
- Load a dictionary with a personal wordlist*/
-PHP_FUNCTION(pspell_new_personal){
- zval **personal, **language,**spelling,**jargon,**encoding,**pmode;
- long mode = 0L, speed = 0L;
- int argc;
- int ind;
-
- PspellCanHaveError *ret;
- PspellManager *manager;
- PspellConfig *config;
-
- argc = ZEND_NUM_ARGS();
- if (argc < 2 || argc > 6 || zend_get_parameters_ex(argc,&personal,&language,&spelling,&jargon,&encoding,&pmode) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- config = new_pspell_config();
-
- convert_to_string_ex(personal);
- pspell_config_replace(config, "personal", (*personal)->value.str.val);
- pspell_config_replace(config, "save-repl", "false");
-
- convert_to_string_ex(language);
- pspell_config_replace(config, "language-tag", (*language)->value.str.val);
-
- if(argc > 2){
- convert_to_string_ex(spelling);
- if((*spelling)->value.str.len > 0){
- pspell_config_replace(config, "spelling", (*spelling)->value.str.val);
- }
- }
-
- if(argc > 3){
- convert_to_string_ex(jargon);
- if((*jargon)->value.str.len > 0){
- pspell_config_replace(config, "jargon", (*jargon)->value.str.val);
- }
- }
-
- if(argc > 4){
- convert_to_string_ex(encoding);
- if((*encoding)->value.str.len > 0){
- pspell_config_replace(config, "encoding", (*encoding)->value.str.val);
- }
- }
-
- if(argc > 5){
- convert_to_long_ex(pmode);
- mode = Z_LVAL_PP(pmode);
- speed = mode & PSPELL_SPEED_MASK_INTERNAL;
-
- /* First check what mode we want (how many suggestions) */
- if(speed == PSPELL_FAST){
- pspell_config_replace(config, "sug-mode", "fast");
- }else if(speed == PSPELL_NORMAL){
- pspell_config_replace(config, "sug-mode", "normal");
- }else if(speed == PSPELL_BAD_SPELLERS){
- pspell_config_replace(config, "sug-mode", "bad-spellers");
- }
-
- /* Then we see if run-together words should be treated as valid components */
- if(mode & PSPELL_RUN_TOGETHER){
- pspell_config_replace(config, "run-together", "true");
- }
- }
-
- ret = new_pspell_manager(config);
- delete_pspell_config(config);
-
- if(pspell_error_number(ret) != 0){
- php_error(E_WARNING, "PSPELL couldn't open the dictionary. reason: %s ", pspell_error_message(ret));
- RETURN_FALSE;
- }
-
- manager = to_pspell_manager(ret);
- ind = zend_list_insert(manager, le_pspell);
-
- RETURN_LONG(ind);
-}
-/* }}} */
-
-/* {{{ proto int pspell_new_config(int config)
- Load a dictionary based on the given config */
-PHP_FUNCTION(pspell_new_config){
- int type;
- zval **conf;
- int argc;
- int ind;
-
- PspellCanHaveError *ret;
- PspellManager *manager;
- PspellConfig *config;
-
- argc = ZEND_NUM_ARGS();
- if (argc != 1 || zend_get_parameters_ex(argc,&conf) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(conf);
- config = (PspellConfig *) zend_list_find((*conf)->value.lval, &type);
- ret = new_pspell_manager(config);
-
- if(pspell_error_number(ret) != 0){
- php_error(E_WARNING, "PSPELL couldn't open the dictionary. reason: %s ", pspell_error_message(ret));
- RETURN_FALSE;
- }
-
- manager = to_pspell_manager(ret);
- ind = zend_list_insert(manager, le_pspell);
- RETURN_LONG(ind);
-}
-/* }}} */
-
-/* {{{ proto int pspell_check(int pspell, string word)
- Returns true if word is valid */
-PHP_FUNCTION(pspell_check){
- int type;
- zval **scin,**word;
- PspellManager *manager;
-
- int argc;
- argc = ZEND_NUM_ARGS();
- if (argc != 2 || zend_get_parameters_ex(argc, &scin,&word) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(scin);
- convert_to_string_ex(word);
- manager = (PspellManager *) zend_list_find((*scin)->value.lval, &type);
- if(!manager){
- php_error(E_WARNING, "%d is not an PSPELL result index",(*scin)->value.lval);
- RETURN_FALSE;
- }
-
- if(pspell_manager_check(manager, (*word)->value.str.val)){
- RETURN_TRUE;
- }else{
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto array pspell_suggest(int pspell, string word)
- Returns array of suggestions */
-PHP_FUNCTION(pspell_suggest)
-{
- zval **scin, **word;
- int argc;
- PspellManager *manager;
- int type;
- const PspellWordList *wl;
- const char *sug;
-
- argc = ZEND_NUM_ARGS();
- if(argc != 2 || zend_get_parameters_ex(argc, &scin,&word) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(scin);
- convert_to_string_ex(word);
- manager = (PspellManager *) zend_list_find((*scin)->value.lval, &type);
- if(!manager){
- php_error(E_WARNING, "%d is not an PSPELL result index",(*scin)->value.lval);
- RETURN_FALSE;
- }
-
- if (array_init(return_value) == FAILURE){
- RETURN_FALSE;
- }
-
- wl = pspell_manager_suggest(manager, (*word)->value.str.val);
- if(wl){
- PspellStringEmulation *els = pspell_word_list_elements(wl);
- while((sug = pspell_string_emulation_next(els)) != 0){
- add_next_index_string(return_value,(char *)sug,1);
- }
- delete_pspell_string_emulation(els);
- }else{
- php_error(E_WARNING, "PSPELL had a problem. details: %s ", pspell_manager_error_message(manager));
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto int pspell_store_replacement(int pspell, string misspell, string correct)
- Notify the dictionary of a user-selected replacement */
-PHP_FUNCTION(pspell_store_replacement)
-{
- int type;
- zval **scin,**miss,**corr;
- PspellManager *manager;
-
- int argc;
- argc = ZEND_NUM_ARGS();
- if (argc != 3 || zend_get_parameters_ex(argc, &scin,&miss,&corr) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(scin);
- convert_to_string_ex(miss);
- convert_to_string_ex(corr);
- manager = (PspellManager *) zend_list_find((*scin)->value.lval, &type);
- if(!manager){
- php_error(E_WARNING, "%d is not an PSPELL result index",(*scin)->value.lval);
- RETURN_FALSE;
- }
-
- pspell_manager_store_replacement(manager, (*miss)->value.str.val, (*corr)->value.str.val);
- if(pspell_manager_error_number(manager) == 0){
- RETURN_TRUE;
- }else{
- php_error(E_WARNING, "pspell_store_replacement() gave error: %s", pspell_manager_error_message(manager));
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto int pspell_add_to_personal(int pspell, string word)
- Adds a word to a personal list */
-PHP_FUNCTION(pspell_add_to_personal)
-{
- int type;
- zval **scin,**word;
- PspellManager *manager;
-
- int argc;
- argc = ZEND_NUM_ARGS();
- if (argc != 2 || zend_get_parameters_ex(argc, &scin,&word) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(scin);
- convert_to_string_ex(word);
- manager = (PspellManager *) zend_list_find((*scin)->value.lval, &type);
- if(!manager){
- php_error(E_WARNING, "%d is not an PSPELL result index",(*scin)->value.lval);
- RETURN_FALSE;
- }
-
- /*If the word is empty, we have to return; otherwise we'll segfault! ouch!*/
- if((*word)->value.str.len == 0){
- RETURN_FALSE;
- }
-
- pspell_manager_add_to_personal(manager, (*word)->value.str.val);
- if(pspell_manager_error_number(manager) == 0){
- RETURN_TRUE;
- }else{
- php_error(E_WARNING, "pspell_add_to_personal() gave error: %s", pspell_manager_error_message(manager));
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto int pspell_add_to_session(int pspell, string word)
- Adds a word to the current session */
-PHP_FUNCTION(pspell_add_to_session)
-{
- int type;
- zval **scin,**word;
- PspellManager *manager;
-
- int argc;
- argc = ZEND_NUM_ARGS();
- if (argc != 2 || zend_get_parameters_ex(argc, &scin,&word) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(scin);
- convert_to_string_ex(word);
- manager = (PspellManager *) zend_list_find((*scin)->value.lval, &type);
- if(!manager){
- php_error(E_WARNING, "%d is not an PSPELL result index",(*scin)->value.lval);
- RETURN_FALSE;
- }
-
- /*If the word is empty, we have to return; otherwise we'll segfault! ouch!*/
- if((*word)->value.str.len == 0){
- RETURN_FALSE;
- }
-
- pspell_manager_add_to_session(manager, (*word)->value.str.val);
- if(pspell_manager_error_number(manager) == 0){
- RETURN_TRUE;
- }else{
- php_error(E_WARNING, "pspell_add_to_session() gave error: %s", pspell_manager_error_message(manager));
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto int pspell_clear_session(int pspell)
- Clears the current session */
-PHP_FUNCTION(pspell_clear_session)
-{
- int type;
- zval **scin;
- PspellManager *manager;
-
- int argc;
- argc = ZEND_NUM_ARGS();
- if (argc != 1 || zend_get_parameters_ex(argc, &scin) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(scin);
- manager = (PspellManager *) zend_list_find((*scin)->value.lval, &type);
- if(!manager){
- php_error(E_WARNING, "%d is not an PSPELL result index",(*scin)->value.lval);
- RETURN_FALSE;
- }
-
- pspell_manager_clear_session(manager);
- if(pspell_manager_error_number(manager) == 0){
- RETURN_TRUE;
- }else{
- php_error(E_WARNING, "pspell_clear_session() gave error: %s", pspell_manager_error_message(manager));
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto int pspell_save_wordlist(int pspell)
- Saves the current (personal) wordlist */
-PHP_FUNCTION(pspell_save_wordlist)
-{
- int type;
- zval **scin;
- PspellManager *manager;
-
- int argc;
- argc = ZEND_NUM_ARGS();
- if (argc != 1 || zend_get_parameters_ex(argc, &scin) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(scin);
- manager = (PspellManager *) zend_list_find((*scin)->value.lval, &type);
- if(!manager){
- php_error(E_WARNING, "%d is not an PSPELL result index",(*scin)->value.lval);
- RETURN_FALSE;
- }
-
- pspell_manager_save_all_word_lists(manager);
-
- if(pspell_manager_error_number(manager) == 0){
- RETURN_TRUE;
- }else{
- php_error(E_WARNING, "pspell_save_wordlist() gave error: %s", pspell_manager_error_message(manager));
- RETURN_FALSE;
- }
-
-}
-/* }}} */
-
-/* {{{ proto int pspell_config_create(string language [, string spelling [, string jargon [, string encoding]]])
- Create a new config to be used later to create a manager */
-PHP_FUNCTION(pspell_config_create){
- zval **language,**spelling,**jargon,**encoding;
- int argc;
- int ind;
-
- PspellConfig *config;
-
- argc = ZEND_NUM_ARGS();
- if (argc < 1 || argc > 4 || zend_get_parameters_ex(argc,&language,&spelling,&jargon,&encoding) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- config = new_pspell_config();
- convert_to_string_ex(language);
- pspell_config_replace(config, "language-tag", (*language)->value.str.val);
-
- if(argc > 1){
- convert_to_string_ex(spelling);
- if((*spelling)->value.str.len > 0){
- pspell_config_replace(config, "spelling", (*spelling)->value.str.val);
- }
- }
-
- if(argc > 2){
- convert_to_string_ex(jargon);
- if((*jargon)->value.str.len > 0){
- pspell_config_replace(config, "jargon", (*jargon)->value.str.val);
- }
- }
-
- if(argc > 3){
- convert_to_string_ex(encoding);
- if((*encoding)->value.str.len > 0){
- pspell_config_replace(config, "encoding", (*encoding)->value.str.val);
- }
- }
-
- /* By default I do not want to write anything anywhere because it'll try to write to $HOME
- which is not what we want */
- pspell_config_replace(config, "save-repl", "false");
-
- ind = zend_list_insert(config, le_pspell_config);
- RETURN_LONG(ind);
-}
-/* }}} */
-
-/* {{{ proto int pspell_config_runtogether(int conf, bool runtogether)
- Consider run-together words as valid components */
-PHP_FUNCTION(pspell_config_runtogether){
- int type;
- zval **sccin, **runtogether;
- int argc;
-
- PspellConfig *config;
-
- argc = ZEND_NUM_ARGS();
- if (argc != 2 || zend_get_parameters_ex(argc,&sccin,&runtogether) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(sccin);
- config = (PspellConfig *) zend_list_find((*sccin)->value.lval, &type);
- if(!config){
- php_error(E_WARNING, "%d is not an PSPELL config index",(*sccin)->value.lval);
- RETURN_FALSE;
- }
-
- convert_to_boolean_ex(runtogether);
- pspell_config_replace(config, "run-together", (*runtogether)->value.lval ? "true" : "false");
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int pspell_config_mode(int conf, long mode)
- Select mode for config (PSPELL_FAST, PSPELL_NORMAL or PSPELL_BAD_SPELLERS) */
-PHP_FUNCTION(pspell_config_mode){
- int type;
- zval **sccin, **mode;
- int argc;
-
- PspellConfig *config;
-
- argc = ZEND_NUM_ARGS();
- if (argc != 2 || zend_get_parameters_ex(argc,&sccin,&mode) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(sccin);
- config = (PspellConfig *) zend_list_find((*sccin)->value.lval, &type);
- if(!config){
- php_error(E_WARNING, "%d is not an PSPELL config index",(*sccin)->value.lval);
- RETURN_FALSE;
- }
-
- convert_to_long_ex(mode);
-
- /* First check what mode we want (how many suggestions) */
- if((*mode)->value.lval == PSPELL_FAST){
- pspell_config_replace(config, "sug-mode", "fast");
- }else if((*mode)->value.lval == PSPELL_NORMAL){
- pspell_config_replace(config, "sug-mode", "normal");
- }else if((*mode)->value.lval == PSPELL_BAD_SPELLERS){
- pspell_config_replace(config, "sug-mode", "bad-spellers");
- }
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int pspell_config_ignore(int conf, int ignore)
- Ignore words <= n chars */
-PHP_FUNCTION(pspell_config_ignore){
- int type;
- zval **sccin, **pignore;
- int argc;
-
- /* Hack. But I cannot imagine any word being more than 999 characters long */
- int loc = 3;
- char ignore_str[loc + 1];
- long ignore = 0L;
-
- PspellConfig *config;
-
- argc = ZEND_NUM_ARGS();
- if (argc != 2 || zend_get_parameters_ex(argc,&sccin,&pignore) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(sccin);
- config = (PspellConfig *) zend_list_find((*sccin)->value.lval, &type);
- if(!config){
- php_error(E_WARNING, "%d is not an PSPELL config index",(*sccin)->value.lval);
- RETURN_FALSE;
- }
-
- convert_to_long_ex(pignore);
- ignore = Z_LVAL_PP(pignore);
-
- /* The following is a very hackish way to convert a long to a string
- (actually only the numbers 0-999 will get converted properly, but that should
- be sufficient). If anyone knows of a better way to convert an integer to a string,
- please, fix it.*/
- ignore_str[loc] = '\0';
- while(ignore > 0){
- if(loc == 0){
- break;
- }
- ignore_str[--loc] = '0' + (ignore % 10);
- ignore /= 10;
- }
- if(ignore_str[loc] == '\0'){
- ignore_str[--loc] = '0';
- }
-
- pspell_config_replace(config, "ignore", &ignore_str[loc]);
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int pspell_config_personal(int conf, string personal)
- Use a personal dictionary for this config */
-PHP_FUNCTION(pspell_config_personal){
- int type;
- zval **sccin, **personal;
- int argc;
-
- PspellConfig *config;
-
- argc = ZEND_NUM_ARGS();
- if (argc != 2 || zend_get_parameters_ex(argc,&sccin,&personal) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(sccin);
- config = (PspellConfig *) zend_list_find((*sccin)->value.lval, &type);
- if(!config){
- php_error(E_WARNING, "%d is not an PSPELL config index",(*sccin)->value.lval);
- RETURN_FALSE;
- }
-
- convert_to_string_ex(personal);
- pspell_config_replace(config, "personal", (*personal)->value.str.val);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int pspell_config_repl(int conf, string repl)
- Use a personal dictionary with replacement pairs for this config */
-PHP_FUNCTION(pspell_config_repl){
- int type;
- zval **sccin, **repl;
- int argc;
-
- PspellConfig *config;
-
- argc = ZEND_NUM_ARGS();
- if (argc != 2 || zend_get_parameters_ex(argc,&sccin,&repl) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(sccin);
- config = (PspellConfig *) zend_list_find((*sccin)->value.lval, &type);
- if(!config){
- php_error(E_WARNING, "%d is not an PSPELL config index",(*sccin)->value.lval);
- RETURN_FALSE;
- }
-
- pspell_config_replace(config, "save-repl", "true");
-
- convert_to_string_ex(repl);
- pspell_config_replace(config, "repl", (*repl)->value.str.val);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int pspell_config_save_repl(int conf, bool save)
- Save replacement pairs when personal list is saved for this config */
-PHP_FUNCTION(pspell_config_save_repl){
- int type;
- zval **sccin, **save;
- int argc;
-
- PspellConfig *config;
-
- argc = ZEND_NUM_ARGS();
- if (argc != 2 || zend_get_parameters_ex(argc,&sccin,&save) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(sccin);
- config = (PspellConfig *) zend_list_find((*sccin)->value.lval, &type);
- if(!config){
- php_error(E_WARNING, "%d is not an PSPELL config index",(*sccin)->value.lval);
- RETURN_FALSE;
- }
-
- convert_to_boolean_ex(save);
- pspell_config_replace(config, "save-repl", (*save)->value.lval ? "true" : "false");
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ PHP_MINFO_FUNCTION
- */
-PHP_MINFO_FUNCTION(pspell)
-{
- php_info_print_table_start();
- php_info_print_table_row(2, "PSpell Support", "enabled");
- php_info_print_table_end();
-}
-/* }}} */
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/qtdom/CREDITS b/ext/qtdom/CREDITS
deleted file mode 100644
index efeff5dbf9..0000000000
--- a/ext/qtdom/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-qtdom
-Jan Borsodi
diff --git a/ext/qtdom/EXPERIMENTAL b/ext/qtdom/EXPERIMENTAL
deleted file mode 100644
index 6443e99646..0000000000
--- a/ext/qtdom/EXPERIMENTAL
+++ /dev/null
@@ -1,5 +0,0 @@
-this extension is experimental,
-its functions may change their names
-or move to extension all together
-so do not rely to much on them
-you have been warned!
diff --git a/ext/qtdom/Makefile.in b/ext/qtdom/Makefile.in
deleted file mode 100644
index 1bbab4ad29..0000000000
--- a/ext/qtdom/Makefile.in
+++ /dev/null
@@ -1,10 +0,0 @@
-# $Id$
-
-LTLIBRARY_NAME = libqtdom.la
-LTLIBRARY_SOURCES = qtdom.c
-LTLIBRARY_SOURCES_CPP = qtdom_qt.cpp
-LTLIBRARY_SHARED_NAME = qtdom.la
-LTLIBRARY_SHARED_LIBADD = $(QTDOM_SHARED_LIBADD)
-LTLIBRARY_OBJECTS_X = $(LTLIBRARY_SOURCES_CPP:.cpp=.lo)
-
-include $(top_srcdir)/build/dynlib.mk
diff --git a/ext/qtdom/config.m4 b/ext/qtdom/config.m4
deleted file mode 100644
index af54cc1176..0000000000
--- a/ext/qtdom/config.m4
+++ /dev/null
@@ -1,34 +0,0 @@
-dnl $Id$
-dnl config.m4 for extension qtdom
-dnl don't forget to call PHP_EXTENSION(qtdom)
-
-AC_MSG_CHECKING(whether to include QDOM support)
-AC_ARG_WITH(qtdom,
-[ --with-qtdom Include QtDOM support (requires Qt >= 2.2.0).],
-[
-case $withval in
- no)
- AC_MSG_RESULT(no) ;;
- yes)
- if test -f $QTDIR/include/qdom.h; then
- AC_MSG_RESULT(yes)
- PHP_ADD_LIBRARY_WITH_PATH(qt, $QTDIR/lib)
- PHP_ADD_INCLUDE($QTDIR/include)
- AC_DEFINE(HAVE_QTDOM, 1, [Wheter you have qtdom])
- PHP_EXTENSION(qtdom, $ext_shared)
- PHP_REQUIRE_CXX
- elif test -f /usr/lib/qt2/include/qdom.h; then
- AC_MSG_RESULT(yes)
- PHP_ADD_LIBRARY(qt)
- PHP_ADD_INCLUDE(/usr/lib/qt2/include)
- AC_DEFINE(HAVE_QTDOM, 1, [Wheter you have qtdom])
- PHP_EXTENSION(qtdom, $ext_shared)
- PHP_REQUIRE_CXX
- else
- AC_MSG_RESULT(no)
- fi
- ;;
- esac
-],[
- AC_MSG_RESULT(no)
-])
diff --git a/ext/qtdom/qtdom.c b/ext/qtdom/qtdom.c
deleted file mode 100644
index 9d4ea7d059..0000000000
--- a/ext/qtdom/qtdom.c
+++ /dev/null
@@ -1,279 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "php_ini.h"
-#include "qtdom.h"
-#include "qtdom_qt.h"
-
-#if HAVE_QTDOM
-
-static zend_function_entry qdomdoc_class_functions[] = {
- {NULL, NULL, NULL}
-};
-
-static zend_function_entry qdomnode_class_functions[] = {
- {NULL, NULL, NULL}
-};
-
-/* If you declare any globals in php_qtdom.h uncomment this:
-ZEND_DECLARE_MODULE_GLOBALS(qtdom)
-*/
-
-/* True global resources - no need for thread safety here */
-static int le_qtdom;
-
-/* Every user visible function must have an entry in qtdom_functions[].
-*/
-function_entry qtdom_functions[] = {
- PHP_FE(qdom_tree, NULL)
- PHP_FE(qdom_error, NULL)
- {NULL, NULL, NULL} /* Must be the last line in qtdom_functions[] */
-};
-
-zend_module_entry qtdom_module_entry = {
- "qtdom",
- qtdom_functions,
- PHP_MINIT(qtdom),
- PHP_MSHUTDOWN(qtdom),
- NULL,
- NULL,
- PHP_MINFO(qtdom),
- STANDARD_MODULE_PROPERTIES
-};
-
-#ifdef COMPILE_DL_QTDOM
-ZEND_GET_MODULE(qtdom)
-#endif
-
-/* {{{ PHP_MINIT_FUNCTION
- */
-PHP_MINIT_FUNCTION(qtdom)
-{
-/* Remove comments if you have entries in php.ini
- REGISTER_INI_ENTRIES();
-*/
- zend_class_entry qdomdoc_class_entry;
- zend_class_entry qdomnode_class_entry;
-
- INIT_CLASS_ENTRY(qdomdoc_class_entry, "QDomDocument", qdomdoc_class_functions);
- INIT_CLASS_ENTRY(qdomnode_class_entry, "QDomNode", qdomnode_class_functions);
-
- qdomdoc_class_entry_ptr = zend_register_internal_class(&qdomdoc_class_entry);
- qdomnode_class_entry_ptr = zend_register_internal_class(&qdomnode_class_entry);
-
- qdom_init();
-
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_MSHUTDOWN_FUNCTION
- */
-PHP_MSHUTDOWN_FUNCTION(qtdom)
-{
- qdom_shutdown();
-
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_MINFO_FUNCTION
- */
-PHP_MINFO_FUNCTION(qtdom)
-{
- php_info_print_table_start();
- php_info_print_table_header(2, "qtdom support", "enabled");
- php_info_print_table_end();
-}
-/* }}} */
-
-/* {{{ qdom_find_attributes
- * Helper function for creating the attributes, returns the number
- * of attributes found or -1 if an error occured */
-int qdom_find_attributes( zval **children, struct qdom_attribute *attr )
-{
- zval *child;
- struct qdom_node *node;
- int count;
- int i;
- count = 0;
-
- MAKE_STD_ZVAL(*children);
- if (array_init(*children) == FAILURE)
- return -1;
- for ( i = 0; i < attr->Count; ++i )
- {
- node = qdom_do_attribute_at( attr, i );
-
- MAKE_STD_ZVAL(child);
- object_init_ex(child, qdomnode_class_entry_ptr);
- zend_hash_next_index_insert((*children)->value.ht, &child, sizeof(zval *), NULL);
- add_property_stringl(child, "name", (char *) node->Name, strlen(node->Name), 1);
- add_property_long(child, "type", node->Type);
- add_property_stringl(child, "content", (char *) node->Content, strlen(node->Content), 1);
-
- qdom_do_node_free( node );
- ++count;
- }
-
- return count;
-}
-/* }}} */
-
-/* {{{ qdom_find_children
- Helper function for recursively going trough the QDomNode tree and creating
- the same in PHP objects. Returns the number of children or -1 if an error
- occured. */
-int qdom_find_children( zval **children, struct qdom_node *orig_node )
-{
- zval *child;
- struct qdom_node *node, *tmp_node, *child_node;
- int count;
-
- zval *n_children, *a_children;
- count = 0;
-
- node = qdom_do_copy_node( orig_node );
- tmp_node = node;
-/* node = orig_node; */
-
- MAKE_STD_ZVAL(*children);
- if (array_init(*children) == FAILURE)
- return -1;
- while( node )
- {
- int num_childs, num_attrs;
-
- MAKE_STD_ZVAL(child);
- object_init_ex(child, qdomnode_class_entry_ptr);
- zend_hash_next_index_insert((*children)->value.ht, &child, sizeof(zval *), NULL);
- add_property_stringl(child, "name", (char *) node->Name, strlen(node->Name), 1);
- add_property_long(child, "type", node->Type);
- if ( node->Type == 2 || node->Type == 3 || node->Type == 4 )
- add_property_stringl(child, "content", (char *) node->Content, strlen(node->Content), 1);
-
- num_attrs = qdom_do_node_attribute_count( node );
- if ( num_attrs > 0 )
- {
- struct qdom_attribute *attr = qdom_do_node_attributes( node );
- if ( qdom_find_attributes( &a_children, attr ) > 0 )
- {
- zend_hash_update(child->value.obj.properties,
- "attributes", sizeof("attributes"),
- (void *) &a_children, sizeof(zval *),
- NULL);
- }
- qdom_do_attributes_free( attr );
-/* add_property_long(child, "attributes", num_attrs ); */
- }
-
- num_childs = qdom_do_node_children_count( node );
- if ( num_childs > 0 )
- {
- child_node = qdom_do_copy_node( node );
- child_node = qdom_do_first_child( child_node );
- if ( qdom_find_children( &n_children, child_node ) > 0 )
- {
- zend_hash_update(child->value.obj.properties,
- "children", sizeof("children"),
- (void *) &n_children, sizeof(zval *),
- NULL);
- }
- qdom_do_node_free( child_node );
- }
-
- node = qdom_do_next_node( node );
- ++count;
- }
- qdom_do_node_free( tmp_node );
- return count;
-}
-/* }}} */
-
-/* {{{ proto object qdom_tree( string )
- creates a tree of an xml string */
-PHP_FUNCTION(qdom_tree)
-{
- zval *arg;
- char qt_ver1[200];
- char *qt_ver = qt_ver1;
- char *qdom_type_name;
- struct qdom_doc *doc;
- struct qdom_node *node;
- zval *children;
-
- if (ZEND_NUM_ARGS() != 1 || getParameters(ht, 1, &arg) == FAILURE)
- {
- WRONG_PARAM_COUNT;
- }
- convert_to_string(arg);
-
- qdom_do_install_message_handler();
-
- qdom_do_version( &qt_ver );
-
- object_init_ex(return_value, qdomdoc_class_entry_ptr);
- add_property_stringl(return_value, "version", (char *) qt_ver, strlen(qt_ver), 1);
-
- doc = qdom_do_init( arg->value.str.val );
-
- qdom_do_doc_type( doc, &qdom_type_name );
-
- if ( qdom_type_name )
- add_property_stringl(return_value, "doctype", (char *) qdom_type_name, strlen(qdom_type_name), 1);
-
- node = doc->Children;
- if ( qdom_find_children( &children, node ) > 0 )
- {
- add_property_long(return_value, "type", node->Type);
- zend_hash_update(return_value->value.obj.properties, "children", sizeof("children"), (void *) &children, sizeof(zval *), NULL);
- }
-
- qdom_do_free( doc );
- qdom_do_free_message_handler();
-}
-/* }}} */
-
-/* {{{ proto string qdom_error()
- Returns the error string from the last QDOM operation or FALSE if no errors occured.*/
-PHP_FUNCTION(qdom_error)
-{
- char *error = qdom_error_log();
- if ( error == 0 )
- RETURN_FALSE;
- RETURN_STRING( error, 1 );
-}
-/* }}} */
-
-#endif /* HAVE_QTDOM */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/qtdom/qtdom.h b/ext/qtdom/qtdom.h
deleted file mode 100644
index a9dd1a5f02..0000000000
--- a/ext/qtdom/qtdom.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: |
- | |
- +----------------------------------------------------------------------+
- */
-
-#ifndef PHP_QTDOM_H
-#define PHP_QTDOM_H
-
-/* You should tweak config.m4 so this symbol (or some else suitable)
- gets defined.
-*/
-#if HAVE_QTDOM
-
-extern zend_module_entry qtdom_module_entry;
-#define phpext_qtdom_ptr &qtdom_module_entry
-
-#ifdef PHP_WIN32
-#define PHP_QTDOM_API __declspec(dllexport)
-#else
-#define PHP_QTDOM_API
-#endif
-
-static zend_class_entry *qdomdoc_class_entry_ptr;
-static zend_class_entry *qdomnode_class_entry_ptr;
-
-PHP_MINIT_FUNCTION(qtdom);
-PHP_MSHUTDOWN_FUNCTION(qtdom);
-PHP_RINIT_FUNCTION(qtdom);
-PHP_RSHUTDOWN_FUNCTION(qtdom);
-PHP_MINFO_FUNCTION(qtdom);
-
-PHP_FUNCTION(qdom_tree);
-PHP_FUNCTION(qdom_error);
-
-/*
- Declare any global variables you may need between the BEGIN
- and END macros here:
-
-ZEND_BEGIN_MODULE_GLOBALS(qtdom)
- int global_variable;
-ZEND_END_MODULE_GLOBALS(qtdom)
-*/
-
-/* In every function that needs to use variables in php_qtdom_globals,
- do call QTDOMLS_FETCH(); after declaring other variables used by
- that function, and always refer to them as QTDOMG(variable).
- You are encouraged to rename these macros something shorter, see
- examples in any other php module directory.
-*/
-
-#ifdef ZTS
-#define QTDOMG(v) (qtdom_globals->v)
-#define QTDOMLS_FETCH() php_qtdom_globals *qtdom_globals = ts_resource(qtdom_globals_id)
-#else
-#define QTDOMG(v) (qtdom_globals.v)
-#define QTDOMLS_FETCH()
-#endif
-
-#else
-
-#define phpext_qtdom_ptr NULL
-
-#endif
-
-#endif /* PHP_QTDOM_H */
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/qtdom/qtdom.php b/ext/qtdom/qtdom.php
deleted file mode 100644
index 8db4e649b3..0000000000
--- a/ext/qtdom/qtdom.php
+++ /dev/null
@@ -1,10 +0,0 @@
-<?
-$module = 'qtdom';
-$function = 'confirm_' . $module . '_compiled';
-if (extension_loaded($module)) {
- $str = $function($module);
-} else {
- $str = "Module $module is not compiled into PHP";
-}
-echo "$str\n";
-?>
diff --git a/ext/qtdom/qtdom_qt.cpp b/ext/qtdom/qtdom_qt.cpp
deleted file mode 100644
index 6cc5050e49..0000000000
--- a/ext/qtdom/qtdom_qt.cpp
+++ /dev/null
@@ -1,371 +0,0 @@
-//
-// $Id$
-//
-// Jan Borsodi <jb@ez.no>
-// Created on: <09-Nov-2000 11:18:46 root>
-//
-
-
-extern "C"
-{
-//#include "php.h"
-//#include "php_ini.h"
-//#include "php_qtdom.h"
-#include "qtdom_qt.h"
-}
-
-
-//#if HAVE_QTDOM
-
-#include <qdom.h>
-#include <qstring.h>
-#include <qglobal.h>
-
-struct qdom_node *qdom_to_node( QDomNode *node );
-
-/*!
- Initialises certain global variables, they are:
- g_qdom_message_log : A global variable for handling error logs and message handler function.
-*/
-
-extern "C" void qdom_init()
-{
- g_qdom_message_log = new qdom_message;
- g_qdom_message_log->Log = 0;
- g_qdom_message_log->OldHandler = 0;
-}
-
-/*!
- Frees global variables initialised in the init function.
-*/
-
-extern "C" void qdom_shutdown()
-{
- if ( g_qdom_message_log->Log )
- delete []g_qdom_message_log->Log;
- delete g_qdom_message_log;
- g_qdom_message_log = 0;
-}
-
-/*!
- Copies the version number for Qt into the \c ver variable,
- the variable must be allocated by user and must have enough characters (20 should suffice).
-*/
-
-extern "C" void qdom_do_version( char **ver )
-{
- strcpy( *ver, QT_VERSION_STR );
-}
-
-/*!
- Moves the DOM node to the next sibling if any and returns the node.
-*/
-
-extern "C" struct qdom_node *qdom_do_next_node( struct qdom_node *node )
-{
- QDomNode *q_node = (QDomNode *)node->Q_Node;
- if ( !q_node )
- return 0;
-
- if ( q_node->isNull() )
- return 0;
- *q_node = q_node->nextSibling();
- if ( q_node->isNull() )
- return 0;
-
- node->Type = q_node->nodeType();
- const char *name = q_node->nodeName().latin1();
- node->Name = new char[q_node->nodeName().length()+1];
- strcpy( node->Name, name );
- const char *content = q_node->nodeValue().latin1();
- node->Content = new char[q_node->nodeValue().length()+1];
- strcpy( node->Content, content );
-
- return node;
-}
-
-/*!
- Finds the first child of the current node and returns it if any.
-*/
-
-extern "C" struct qdom_node *qdom_do_first_child( struct qdom_node *node )
-{
- QDomNode *q_node = (QDomNode *)node->Q_Node;
- if ( !q_node )
- return 0;
-
- if ( q_node->isNull() )
- return 0;
- *q_node = q_node->firstChild();
- if ( q_node->isNull() )
- return 0;
-
- node->Type = q_node->nodeType();
- const char *name = q_node->nodeName().latin1();
- node->Name = new char[q_node->nodeName().length()+1];
- strcpy( node->Name, name );
- const char *content = q_node->nodeValue().latin1();
- node->Content = new char[q_node->nodeValue().length()+1];
- strcpy( node->Content, content );
-
- return node;
-}
-
-/*!
- Returns the number of the children for the current node.
-*/
-
-extern "C" int qdom_do_node_children_count( struct qdom_node *node )
-{
- if ( !node )
- return 0;
- QDomNode *q_node = (QDomNode *)node->Q_Node;
- if ( !q_node )
- return 0;
- return q_node->childNodes().count();
-}
-
-/*!
- Returns the number of attributes for the current node.
-*/
-
-extern "C" int qdom_do_node_attribute_count( struct qdom_node *node )
-{
- if ( !node )
- return 0;
- QDomNode *q_node = (QDomNode *)node->Q_Node;
- if ( !q_node )
- return 0;
- return q_node->attributes().length();
-}
-
-/*!
- Returns the attribute map for the current node.
-*/
-
-extern "C" struct qdom_attribute *qdom_do_node_attributes( struct qdom_node *node )
-{
- struct qdom_attribute *attr = new struct qdom_attribute;
- QDomNode *q_node = (QDomNode *)node->Q_Node;
- QDomNamedNodeMap *map = new QDomNamedNodeMap( q_node->attributes() );
- attr->Q_Node = map;
- attr->Count = map->length();
- return attr;
-}
-
-/*!
- Returns the node at a given index taken from the attribute list if any.
-*/
-
-extern "C" struct qdom_node *qdom_do_attribute_at( struct qdom_attribute *attr, int index )
-{
- if ( !attr )
- return 0;
- QDomNamedNodeMap *map = (QDomNamedNodeMap *)attr->Q_Node;
- if ( index < 0 || index >= map->length() )
- return 0;
- QDomNode node = map->item( index );
- return qdom_to_node( &node );
-}
-
-/*!
- Frees an attribute map.
-*/
-
-extern "C" void qdom_do_attributes_free( struct qdom_attribute *attr )
-{
- if ( !attr )
- return;
- QDomNamedNodeMap *map = (QDomNamedNodeMap *)attr->Q_Node;
- delete map;
- delete attr;
-}
-
-/*!
- Makes a copy of a node.
-*/
-
-extern "C" struct qdom_node *qdom_do_copy_node( struct qdom_node *node )
-{
- if ( !node )
- return 0;
- struct qdom_node *tmp = new struct qdom_node;
- if ( node->Name )
- {
- tmp->Name = new char[strlen(node->Name)+1];
- strcpy( tmp->Name, node->Name );
- }
- else
- tmp->Name = 0;
- if ( node->Content )
- {
- tmp->Content = new char[strlen(node->Content)+1];
- strcpy( tmp->Content, node->Content );
- }
- else
- tmp->Content = 0;
- if ( node->Q_Node )
- {
- QDomNode *q_node = (QDomNode *)node->Q_Node;
- tmp->Q_Node = new QDomNode( *q_node );
- }
- else
- tmp->Q_Node = 0;
- tmp->Type = node->Type;
- return tmp;
-}
-
-/*!
- Frees a node.
-*/
-
-extern "C" void qdom_do_node_free( struct qdom_node *node )
-{
- if ( !node )
- return;
- delete []node->Name;
- delete []node->Content;
- QDomNode *q_node = (QDomNode *)node->Q_Node;
- delete q_node;
- delete node;
-}
-
-/*!
- Wraps a qdom_node struct around a QDomNode object which can be used by the C code.
-*/
-
-struct qdom_node *qdom_to_node( QDomNode *node )
-{
- if ( !node )
- return 0;
- qdom_node *q_node = new struct qdom_node;
- q_node->Type = node->nodeType();
- const char *name = node->nodeName().latin1();
- q_node->Name = new char[node->nodeName().length()+1];
- strcpy( q_node->Name, name );
- const char *content = node->nodeValue().latin1();
- q_node->Content = new char[node->nodeValue().length()+1];
- strcpy( q_node->Content, content );
- q_node->Q_Node = new QDomNode( *node );
- return q_node;
-}
-
-/*!
- Copies the doctype name taken from the the qdom_doc object to the
- \c name variable, the variable is initialised by the function.
-*/
-
-extern "C" void qdom_do_doc_type( struct qdom_doc *doc, char **name )
-{
- if ( !doc )
- {
- *name = 0;
- return;
- }
- QDomDocument *document = (QDomDocument *)doc->Document;
- QString str = document->doctype().name();
- const char *q_name = str.latin1();
- if ( q_name )
- {
- *name = new char[strlen(q_name)+1];
- strcpy( *name, q_name );
- }
- else
- {
- *name = 0;
- }
-}
-
-/*!
- Initialises a qdom_doc struct with the string taken from \c arg.
-*/
-
-extern "C" struct qdom_doc *qdom_do_init( const char *arg )
-{
- struct qdom_doc *doc = new struct qdom_doc;
- QDomDocument *document = new QDomDocument();
- document->setContent( QString( arg ) );
- QDomNode *node = new QDomNode;
- *node = document->documentElement();
- doc->Document = document;
- doc->CurrentNode = node;
- doc->Children = qdom_to_node( node );
- return doc;
-}
-
-/*!
- Frees a qdom_doc struct.
-*/
-
-extern "C" void qdom_do_free( struct qdom_doc *doc )
-{
- QDomNode *node = (QDomNode *)doc->CurrentNode;
- QDomDocument *document = (QDomDocument *)doc->Document;
- delete document;
- delete node;
- delete doc->Children;
- delete doc;
-}
-
-/*!
- The custom message output used for catching Qt error messages when parsing with QDOM.
-*/
-
-void qdom_messageOutput( QtMsgType , const char *msg )
-{
- if ( !g_qdom_message_log )
- return;
- int msg_len = strlen( msg );
- int log_len = 0;
- if ( g_qdom_message_log->Log )
- log_len = strlen( g_qdom_message_log->Log );
- int total_len = log_len+msg_len+2;
- char *log = new char[total_len];
- if ( g_qdom_message_log->Log )
- strncpy( log, g_qdom_message_log->Log, log_len );
- strncpy( log+log_len, msg, msg_len );
- log[log_len+msg_len] = '\n';
- log[total_len - 1] = '\0';
- if ( g_qdom_message_log->Log )
- delete []g_qdom_message_log->Log;
- g_qdom_message_log->Log = log;
-}
-
-/*!
- Installs the custom message handler and clears the log entries.
-*/
-
-extern "C" void qdom_do_install_message_handler()
-{
- if ( !g_qdom_message_log )
- g_qdom_message_log = new qdom_message;
- msg_handler *old_handler = new msg_handler;
- g_qdom_message_log->OldHandler = (void *)old_handler;
- if ( g_qdom_message_log->Log )
- delete []g_qdom_message_log->Log;
- g_qdom_message_log->Log = 0;
- *old_handler = qInstallMsgHandler( qdom_messageOutput );
-}
-
-/*!
- Frees the custom message handler.
-*/
-
-extern "C" void qdom_do_free_message_handler()
-{
- msg_handler *old_handler = (msg_handler *)g_qdom_message_log->OldHandler;
- qInstallMsgHandler( *old_handler );
-}
-
-/*!
- Returns the string containg the error log, or 0 if no log is available.
-*/
-
-extern "C" char *qdom_error_log()
-{
- if ( !g_qdom_message_log )
- return 0;
- return g_qdom_message_log->Log;
-}
-
-//#endif // HAVE_QTDOM
diff --git a/ext/qtdom/qtdom_qt.h b/ext/qtdom/qtdom_qt.h
deleted file mode 100644
index 97d83acea1..0000000000
--- a/ext/qtdom/qtdom_qt.h
+++ /dev/null
@@ -1,67 +0,0 @@
-// -*- Mode: C++ -*-
-//
-// $Id$
-//
-// Created on: <09-Nov-2000 12:00:24 root>
-//
-
-#ifndef QDOM_QT_H
-#define QDOM_QT_H
-
-struct qdom_node
-{
- int Type;
- char *Name;
- char *Content;
- void *Q_Node;
-};
-
-struct qdom_attribute
-{
- int Count;
- void *Q_Node;
-};
-
-struct qdom_doc
-{
- void *Document;
- void *CurrentNode;
- struct qdom_node *Children;
-};
-
-struct qdom_message
-{
- char *Log;
- void *OldHandler;
-};
-
-void qdom_init();
-void qdom_shutdown();
-
-void qdom_do_install_message_handler();
-void qdom_do_free_message_handler();
-
-char *qdom_error_log();
-
-void qdom_do_version( char **ver );
-
-struct qdom_node *qdom_do_next_node( struct qdom_node *node );
-struct qdom_node *qdom_do_first_child( struct qdom_node *node );
-
-struct qdom_attribute *qdom_do_node_attributes( struct qdom_node *node );
-struct qdom_node *qdom_do_attribute_at( struct qdom_attribute *attr, int index );
-void qdom_do_attributes_free( struct qdom_attribute *node );
-
-int qdom_do_node_children_count( struct qdom_node *node );
-int qdom_do_node_attribute_count( struct qdom_node *node );
-
-struct qdom_node *qdom_do_copy_node( struct qdom_node *node );
-void qdom_do_node_free( struct qdom_node *node );
-
-void qdom_do_doc_type( struct qdom_doc *doc, char **name );
-struct qdom_doc *qdom_do_init( const char *arg );
-void qdom_do_free( struct qdom_doc *doc );
-
-struct qdom_message *g_qdom_message_log;
-
-#endif // QDOM_QT_H
diff --git a/ext/readline/CREDITS b/ext/readline/CREDITS
deleted file mode 100644
index 02e44a44d4..0000000000
--- a/ext/readline/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-Readline
-Thies C. Arntzen
diff --git a/ext/readline/Makefile.in b/ext/readline/Makefile.in
deleted file mode 100644
index 6af732d792..0000000000
--- a/ext/readline/Makefile.in
+++ /dev/null
@@ -1,7 +0,0 @@
-
-LTLIBRARY_NAME = libreadline.la
-LTLIBRARY_SOURCES = readline.c
-LTLIBRARY_SHARED_NAME = readline.la
-LTLIBRARY_SHARED_LIBADD = $(READLINE_SHARED_LIBADD)
-
-include $(top_srcdir)/build/dynlib.mk
diff --git a/ext/readline/README.libedit b/ext/readline/README.libedit
deleted file mode 100644
index a19371056e..0000000000
--- a/ext/readline/README.libedit
+++ /dev/null
@@ -1,4 +0,0 @@
-This library can be built with libedit - non-GPL drop-in readline replacement.
-Libedit can be obtained from http://sourceforge.net/projects/libedit/
-It is taken from NetBSD (http://www.netbsd.org/) CVS repository and modified
-to work as stand-alone library.
diff --git a/ext/readline/config.m4 b/ext/readline/config.m4
deleted file mode 100644
index b17ed05552..0000000000
--- a/ext/readline/config.m4
+++ /dev/null
@@ -1,61 +0,0 @@
-dnl $Id$
-dnl config.m4 for extension readline
-dnl don't forget to call PHP_EXTENSION(readline)
-
-PHP_ARG_WITH(libedit,for libedit readline replacement,
-[ --with-libedit[=DIR] Include libedit readline replacement.])
-
-PHP_ARG_WITH(readline,for readline support,
-[ --with-readline[=DIR] Include readline support. DIR is the readline
- install directory.])
-
-if test "$PHP_READLINE" != "no"; then
- for i in /usr/local /usr $PHP_READLINE; do
- if test -f $i/include/readline/readline.h; then
- READLINE_DIR=$i
- fi
- done
-
- if test -z "$READLINE_DIR"; then
- AC_MSG_ERROR(Please reinstall readline - I cannot find readline.h)
- fi
- PHP_ADD_INCLUDE($READLINE_DIR/include)
-
- AC_CHECK_LIB(ncurses, tgetent, [
- PHP_ADD_LIBRARY_WITH_PATH(ncurses,,READLINE_SHARED_LIBADD)],[
- AC_CHECK_LIB(termcap, tgetent, [
- PHP_ADD_LIBRARY_WITH_PATH(termcap,,READLINE_SHARED_LIBADD)])
- ])
-
- PHP_ADD_LIBRARY_WITH_PATH(history, $READLINE_DIR/lib, READLINE_SHARED_LIBADD)
- PHP_ADD_LIBRARY_WITH_PATH(readline, $READLINE_DIR/lib, READLINE_SHARED_LIBADD)
- PHP_SUBST(READLINE_SHARED_LIBADD)
-
- AC_DEFINE(HAVE_LIBREADLINE, 1, [ ])
- PHP_EXTENSION(readline, $ext_shared)
-fi
-
-if test "$PHP_LIBEDIT" != "no"; then
- for i in /usr/local /usr $PHP_LIBEDIT; do
- if test -f $i/include/readline/readline.h; then
- LIBEDIT_DIR=$i
- fi
- done
-
- if test -z "$LIBEDIT_DIR"; then
- AC_MSG_ERROR(Please reinstall libedit - I cannot find readline.h)
- fi
- PHP_ADD_INCLUDE($LIBEDIT_DIR/include)
-
- AC_CHECK_LIB(ncurses, tgetent, [
- PHP_ADD_LIBRARY_WITH_PATH(ncurses,,READLINE__SHARED_LIBADD)],[
- AC_CHECK_LIB(termcap, tgetent, [
- PHP_ADD_LIBRARY_WITH_PATH(termcap,,READLINE_SHARED_LIBADD)])
- ])
-
- PHP_ADD_LIBRARY_WITH_PATH(edit, $LIBEDIT_DIR/lib, READLINE_SHARED_LIBADD)
- PHP_SUBST(READLINE_SHARED_LIBADD)
-
- AC_DEFINE(HAVE_LIBEDIT, 1, [ ])
- PHP_EXTENSION(readline, $ext_shared)
-fi \ No newline at end of file
diff --git a/ext/readline/php_readline.h b/ext/readline/php_readline.h
deleted file mode 100644
index 72913200fc..0000000000
--- a/ext/readline/php_readline.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Thies C. Arntzen (thies@thieso.net) |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef PHP_READLINE_H
-#define PHP_READLINE_H
-
-#if HAVE_LIBREADLINE || HAVE_LIBEDIT
-#ifdef ZTS
-#warning Readline module will *NEVER* be thread-safe
-#endif
-
-#ifndef CGI_BINARY
-#error Readline module only useable in standalone-binary
-#endif
-
-extern zend_module_entry readline_module_entry;
-#define phpext_readline_ptr &readline_module_entry
-
-#else
-
-#define phpext_readline_ptr NULL
-
-#endif /* HAVE_LIBREADLINE */
-
-#endif /* PHP_READLINE_H */
-
diff --git a/ext/readline/readline.c b/ext/readline/readline.c
deleted file mode 100644
index 3548fe7b9b..0000000000
--- a/ext/readline/readline.c
+++ /dev/null
@@ -1,442 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Thies C. Arntzen (thies@thieso.net) |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-/* {{{ includes & prototypes */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "php_readline.h"
-
-#if HAVE_LIBREADLINE || HAVE_LIBEDIT
-
-#include <readline/readline.h>
-#ifndef HAVE_LIBEDIT
-#include <readline/history.h>
-#endif
-
-PHP_FUNCTION(readline);
-PHP_FUNCTION(readline_add_history);
-PHP_FUNCTION(readline_info);
-PHP_FUNCTION(readline_clear_history);
-PHP_FUNCTION(readline_list_history);
-PHP_FUNCTION(readline_read_history);
-PHP_FUNCTION(readline_write_history);
-PHP_FUNCTION(readline_completion_function);
-
-static char *_readline_completion = NULL;
-static zval _readline_array;
-
-PHP_MINIT_FUNCTION(readline);
-PHP_RSHUTDOWN_FUNCTION(readline);
-
-/* }}} */
-/* {{{ module stuff */
-
-static zend_function_entry php_readline_functions[] = {
- PHP_FE(readline, NULL)
- PHP_FE(readline_info, NULL)
- PHP_FE(readline_add_history, NULL)
- PHP_FE(readline_clear_history, NULL)
-#ifdef HAVE_READLINE
- PHP_FE(readline_list_history, NULL)
-#else
- PHP_FALIAS(readline_list_history, warn_not_available, NULL)
-#endif
- PHP_FE(readline_read_history, NULL)
- PHP_FE(readline_write_history, NULL)
- PHP_FE(readline_completion_function,NULL)
- {NULL, NULL, NULL}
-};
-
-zend_module_entry readline_module_entry = {
- "readline",
- php_readline_functions,
- PHP_MINIT(readline),
- NULL,
- NULL,
- PHP_RSHUTDOWN(readline),
- NULL,
- STANDARD_MODULE_PROPERTIES
-};
-
-#ifdef COMPILE_DL_READLINE
-ZEND_GET_MODULE(readline)
-#endif
-
-PHP_MINIT_FUNCTION(readline)
-{
- using_history();
- return SUCCESS;
-}
-
-PHP_RSHUTDOWN_FUNCTION(readline)
-{
- if (_readline_completion)
- efree(_readline_completion);
-
- return SUCCESS;
-}
-
-/* }}} */
-/* {{{ proto string readline([string prompt])
- Reads a line */
-PHP_FUNCTION(readline)
-{
- char *result;
- pval **arg;
- int ac = ZEND_NUM_ARGS();
-
- if (ac < 0 || ac > 1 || zend_get_parameters_ex(ac, &arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if (ac == 1) {
- convert_to_string_ex(arg);
- }
-
- result = readline(ac?(*arg)->value.str.val:NULL);
-
- if (! result) {
- RETURN_FALSE;
- } else {
- RETVAL_STRING(result,1);
- free(result);
- }
-}
-
-/* }}} */
-/* {{{ proto mixed readline_info([string varname] [, string newvalue])
- Gets/sets various internal readline variables. */
-
-#define SAFE_STRING(s) ((s)?(s):"")
-
-PHP_FUNCTION(readline_info)
-{
- zval **what;
- zval **value;
- int oldval;
- char *oldstr;
- int ac = ZEND_NUM_ARGS();
-
- if (ac < 0 || ac > 2 || zend_get_parameters_ex(ac, &what, &value) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if (ac == 0) {
- array_init(return_value);
- add_assoc_string(return_value,"line_buffer",SAFE_STRING(rl_line_buffer),1);
- add_assoc_long(return_value,"point",rl_point);
- add_assoc_long(return_value,"end",rl_end);
-#ifdef HAVE_READLINE
- add_assoc_long(return_value,"mark",rl_mark);
- add_assoc_long(return_value,"done",rl_done);
- add_assoc_long(return_value,"pending_input",rl_pending_input);
- add_assoc_string(return_value,"prompt",SAFE_STRING(rl_prompt),1);
- add_assoc_string(return_value,"terminal_name",SAFE_STRING(rl_terminal_name),1);
-#endif
-#if HAVE_ERASE_EMPTY_LINE
- add_assoc_long(return_value,"erase_empty_line",rl_erase_empty_line);
-#endif
- add_assoc_string(return_value,"library_version",SAFE_STRING(rl_library_version),1);
- add_assoc_string(return_value,"readline_name",SAFE_STRING(rl_readline_name),1);
- } else {
- convert_to_string_ex(what);
-
- if (! strcasecmp((*what)->value.str.val,"line_buffer")) {
- oldstr = rl_line_buffer;
- if (ac == 2) {
- /* XXX if (rl_line_buffer) free(rl_line_buffer); */
- convert_to_string_ex(value);
- rl_line_buffer = strdup((*value)->value.str.val);
- }
- RETVAL_STRING(SAFE_STRING(oldstr),1);
- } else if (! strcasecmp((*what)->value.str.val,"point")) {
- RETVAL_LONG(rl_point);
- } else if (! strcasecmp((*what)->value.str.val,"end")) {
- RETVAL_LONG(rl_end);
-#ifdef HAVE_READLINE
- } else if (! strcasecmp((*what)->value.str.val,"mark")) {
- RETVAL_LONG(rl_mark);
- } else if (! strcasecmp((*what)->value.str.val,"done")) {
- oldval = rl_done;
- if (ac == 2) {
- convert_to_long_ex(value);
- rl_done = (*value)->value.lval;
- }
- RETVAL_LONG(oldval);
- } else if (! strcasecmp((*what)->value.str.val,"pending_input")) {
- oldval = rl_pending_input;
- if (ac == 2) {
- convert_to_string_ex(value);
- rl_pending_input = (*value)->value.str.val[0];
- }
- RETVAL_LONG(oldval);
- } else if (! strcasecmp((*what)->value.str.val,"prompt")) {
- RETVAL_STRING(SAFE_STRING(rl_prompt),1);
- } else if (! strcasecmp((*what)->value.str.val,"terminal_name")) {
- RETVAL_STRING(SAFE_STRING(rl_terminal_name),1);
-#endif
-#if HAVE_ERASE_EMPTY_LINE
- } else if (! strcasecmp((*what)->value.str.val,"erase_empty_line")) {
- oldval = rl_erase_empty_line;
- if (ac == 2) {
- convert_to_long_ex(value);
- rl_erase_empty_line = (*value)->value.lval;
- }
- RETVAL_LONG(oldval);
-#endif
- } else if (! strcasecmp((*what)->value.str.val,"library_version")) {
- RETVAL_STRING(SAFE_STRING(rl_library_version),1);
- } else if (! strcasecmp((*what)->value.str.val,"readline_name")) {
- oldstr = rl_readline_name;
- if (ac == 2) {
- /* XXX if (rl_readline_name) free(rl_readline_name); */
- convert_to_string_ex(value);
- rl_readline_name = strdup((*value)->value.str.val);;
- }
- RETVAL_STRING(SAFE_STRING(oldstr),1);
- }
- }
-}
-
-/* }}} */
-/* {{{ proto void readline_add_history([string prompt])
- Adds a line to the history */
-PHP_FUNCTION(readline_add_history)
-{
- pval **arg;
- int ac = ZEND_NUM_ARGS();
-
- if (ac < 1 || ac > 1 || zend_get_parameters_ex(ac, &arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(arg);
-
- add_history((*arg)->value.str.val);
-
- RETURN_TRUE;
-}
-
-/* }}} */
-/* {{{ proto void readline_clear_history(void)
- Clears the history */
-PHP_FUNCTION(readline_clear_history)
-{
- int ac = ZEND_NUM_ARGS();
-
- if (ac < 0 || ac > 0) {
- WRONG_PARAM_COUNT;
- }
-
- clear_history();
-
- RETURN_TRUE;
-}
-
-/* }}} */
-/* {{{ proto array readline_list_history(void)
- Lists the history */
-#ifdef HAVE_READLINE
-PHP_FUNCTION(readline_list_history)
-{
- HIST_ENTRY **history;
- int ac = ZEND_NUM_ARGS();
-
- if (ac) {
- WRONG_PARAM_COUNT;
- }
-
- history = history_list();
-
- array_init(return_value);
-
- if (history) {
- int i;
- for (i = 0; history[i]; i++) {
- add_next_index_string(return_value,history[i]->line,1);
- }
- }
-}
-#endif
-/* }}} */
-/* {{{ proto int readline_read_history([string filename] [, int from] [,int to])
- Reads the history */
-PHP_FUNCTION(readline_read_history)
-{
- pval **arg;
- char *filename = NULL;
- int ac = ZEND_NUM_ARGS();
-
- if (ac < 0 || ac > 1 || zend_get_parameters_ex(ac, &arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- /* XXX from & to NYI */
-
- if (ac == 1) {
- convert_to_string_ex(arg);
- filename = (*arg)->value.str.val;
- }
-
- if (read_history(filename)) {
- RETURN_FALSE;
- } else {
- RETURN_TRUE;
- }
-}
-
-/* }}} */
-/* {{{ proto int readline_write_history([string filename])
- Writes the history */
-PHP_FUNCTION(readline_write_history)
-{
- pval **arg;
- char *filename = NULL;
- int ac = ZEND_NUM_ARGS();
-
- if (ac < 0 || ac > 1 || zend_get_parameters_ex(ac, &arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if (ac == 1) {
- convert_to_string_ex(arg);
- filename = (*arg)->value.str.val;
- }
-
- if (write_history(filename)) {
- RETURN_FALSE;
- } else {
- RETURN_TRUE;
- }
-}
-
-/* }}} */
-/* {{{ proto void readline_completion_function(string funcname)
- Readline completion function? */
-char *test[] = { "bleibt", "da", "helfen", "keine", "pillen", "und" , "heissen", "umschlaege","hallo", "pallo", "egon", "thies", "ist", "doof", "tubu", "tata", 0 };
-
-static char *_readline_command_generator(char *text,int state)
-{
- HashTable *myht = _readline_array.value.ht;
- zval **entry;
-
- /*
- printf("\n_readline_command_generator(\"%s\",%d)\n",text,state);
- */
-
- if (! state) {
- zend_hash_internal_pointer_reset(myht);
- }
-
- while (zend_hash_get_current_data(myht, (void **)&entry) == SUCCESS) {
- zend_hash_move_forward(myht);
-
- convert_to_string_ex(entry);
- if (strncmp ((*entry)->value.str.val, text, strlen(text)) == 0) {
- return (strdup((*entry)->value.str.val));
- }
- }
-
- return NULL;
-}
-
-static zval *_readline_string_zval(const char *str)
-{
- zval *ret;
- int len = strlen(str);
- MAKE_STD_ZVAL(ret);
-
- ret->type = IS_STRING;
- ret->value.str.len = len;
- ret->value.str.val = estrndup(str, len);
- return ret;
-}
-
-static zval *_readline_long_zval(long l)
-{
- zval *ret;
- MAKE_STD_ZVAL(ret);
-
- ret->type = IS_LONG;
- ret->value.lval = l;
- return ret;
-}
-
-static char **_readline_completion_cb(char *text, int start, int end)
-{
- zval *params[4];
- int i;
- char **matches = NULL;
- CLS_FETCH();
-
- params[0]=_readline_string_zval(_readline_completion);
- params[1]=_readline_string_zval(text);
- params[2]=_readline_long_zval(start);
- params[3]=_readline_long_zval(end);
-
- if (call_user_function(CG(function_table), NULL, params[0], &_readline_array, 3, params+1) == SUCCESS) {
- if (_readline_array.type == IS_ARRAY) {
- matches = completion_matches(text,_readline_command_generator);
- }
- }
-
- for (i = 0; i < 4; i++) {
- zval_ptr_dtor(&params[i]);
- }
- zval_dtor(&_readline_array);
-
- return matches;
-}
-
-PHP_FUNCTION(readline_completion_function)
-{
- pval **arg;
- int ac = ZEND_NUM_ARGS();
-
- if (ac < 0 || ac > 1 || zend_get_parameters_ex(ac, &arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if (ac == 1) {
- convert_to_string_ex(arg);
-
- if (_readline_completion)
- efree(_readline_completion);
-
- _readline_completion = estrdup((*arg)->value.str.val);
- rl_attempted_completion_function = _readline_completion_cb;
- }
-
- RETURN_TRUE;
-}
-
-/* }}} */
-
-#endif /* HAVE_LIBREADLINE */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/readline/setup.stub b/ext/readline/setup.stub
deleted file mode 100644
index a335af80ed..0000000000
--- a/ext/readline/setup.stub
+++ /dev/null
@@ -1,3 +0,0 @@
-define_option with-readline 'GNU-Readline support?' yesnodir no \
-' Whether to build the readline extension.'
-
diff --git a/ext/recode/CREDITS b/ext/recode/CREDITS
deleted file mode 100644
index 2b07813086..0000000000
--- a/ext/recode/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-Recode
-Kristian Köhntopp
diff --git a/ext/recode/Makefile.in b/ext/recode/Makefile.in
deleted file mode 100644
index fcf63e9e2a..0000000000
--- a/ext/recode/Makefile.in
+++ /dev/null
@@ -1,7 +0,0 @@
-
-LTLIBRARY_NAME = librecode.la
-LTLIBRARY_SOURCES = recode.c
-LTLIBRARY_SHARED_NAME = recode.la
-LTLIBRARY_SHARED_LIBADD = $(RECODE_SHARED_LIBADD)
-
-include $(top_srcdir)/build/dynlib.mk
diff --git a/ext/recode/config.m4 b/ext/recode/config.m4
deleted file mode 100644
index 848762338d..0000000000
--- a/ext/recode/config.m4
+++ /dev/null
@@ -1,65 +0,0 @@
-dnl $Id$
-dnl config.m4 for extension recode
-dnl don't forget to call PHP_EXTENSION(recode)
-
-
-PHP_ARG_WITH(recode,for recode support,
-[ --with-recode[=DIR] Include recode support. DIR is the recode install
- directory.])
-
- if test "$PHP_RECODE" != "no"; then
- RECODE_LIST="$PHP_RECODE /usr /usr/local /opt"
-
- for i in $RECODE_LIST; do
- if test -f $i/include/recode.h; then
- RECODE_DIR=$i
- RECODE_INC=include
- RECODE_LIB=lib
- fi
- if test -f $i/include/recode/recode.h; then
- RECODE_DIR=$i
- RECODE_INC=include/recode
- RECODE_LIB=lib/recode
- fi
- if test -f $i/recode/include/recode.h; then
- RECODE_DIR=$i/recode
- RECODE_INC=include
- RECODE_LIB=lib
- fi
- done
- if test "$RECODE_DIR" = ""; then
- AC_MSG_ERROR(I cannot find recode.h anywhere below $RECODE_LIST. Is it installed?)
- fi
-
- old_LDFLAGS=$LDFLAGS
- old_LIBS=$LIBS
- LDFLAGS="$LDFLAGS -L$RECODE_DIR/$RECODE_LIB"
- LIBS="$LIBS -lrecode"
- AC_TRY_LINK([
-char *program_name;
-],[
-recode_format_table();
-],[],[
- AC_MSG_ERROR(I cannot link librecode (-L$RECODE_DIR/$RECODE_LIB -lrecode). Is it installed?)
-])
- LIBS=$old_LIBS
- LDFLAGS=$old_LDFLAGS
-
- if test "$RECODE_LIB" = ""; then
- AC_MSG_ERROR(Please reinstall recode - I cannot find librecode.a)
- fi
-
- PHP_ADD_INCLUDE($RECODE_DIR/$RECODE_INC)
- if test "$ext_shared" = "yes"; then
- PHP_ADD_LIBRARY_WITH_PATH(recode, $RECODE_DIR/$RECODE_LIB, RECODE_SHARED_LIBADD)
- PHP_SUBST(RECODE_SHARED_LIBADD)
- else
- PHP_ADD_LIBRARY_DEFER_WITH_PATH(recode, $RECODE_DIR/$RECODE_LIB)
- fi
-
- AC_DEFINE(HAVE_LIBRECODE, 1, [Whether we have librecode 3.5 or higher])
-
- AC_CHECK_HEADERS(stdbool.h)
-
- PHP_EXTENSION(recode,$ext_shared)
- fi
diff --git a/ext/recode/php_recode.h b/ext/recode/php_recode.h
deleted file mode 100644
index 3a6a8d0580..0000000000
--- a/ext/recode/php_recode.h
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Kristian Koehntopp <kris@koehntopp.de> |
- +----------------------------------------------------------------------+
- */
-
-
-/* $Id$ */
-
-#ifndef PHP_RECODE_H
-#define PHP_RECODE_H
-
-#ifdef PHP_WIN32
-#define PHP_MYSQL_API __declspec(dllexport)
-#else
-#define PHP_MYSQL_API
-#endif
-
-#if HAVE_LIBRECODE
-
-/* Checking for thread safety and issue warning if necessary. */
-#ifdef ZTS
-#warning Recode module has not been tested for thread-safety.
-#endif
-
-/* Recode 3.5 is broken in the sense that it requires the definition
- * of a symbol "program_name" in order to link.
- */
-#define HAVE_BROKEN_RECODE
-
-#ifdef HAVE_STDBOOL_H
-# include <stdbool.h>
-#else
- typedef enum {false = 0, true = 1} bool;
-#endif
-
-#include <sys/types.h>
-#include <stdio.h>
-#include <recode.h>
-#include <unistd.h>
-
-extern zend_module_entry recode_module_entry;
-#define phpext_recode_ptr &recode_module_entry
-
-extern PHP_MINIT_FUNCTION(recode);
-extern PHP_MSHUTDOWN_FUNCTION(recode);
-extern PHP_MINFO_FUNCTION(recode);
-
-extern PHP_FUNCTION(recode_string);
-extern PHP_FUNCTION(recode_file);
-
-typedef struct {
- RECODE_OUTER outer;
-} php_recode_globals;
-
-#ifdef ZTS
-# define ReSLS_D php_recode_globals *recode_globals
-# define ReSLS_DC , ReSLS_D
-# define ReSLS_C recode_globals
-# define ReSLS_CC , ReSLS_C
-# define ReSG(v) (recode_globals->v)
-# define ReSLS_FETCH() php_recode_globals *recode_globals = ts_resource(recode_globals_id)
-#else
-# define ReSLS_D
-# define ReSLS_DC
-# define ReSLS_C
-# define ReSLS_CC
-# define ReSG(v) (recode_globals.v)
-# define ReSLS_FETCH()
-extern PHP_MYSQL_API php_recode_globals recode_globals;
-#endif
-
-#else
-#define phpext_recode_ptr NULL
-#endif
-
-#endif /* PHP_RECODE_H */
diff --git a/ext/recode/recode.c b/ext/recode/recode.c
deleted file mode 100644
index da4bcb1ba3..0000000000
--- a/ext/recode/recode.c
+++ /dev/null
@@ -1,231 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997, 1998, 1999, 2000 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Kristian Koehntopp <kris@koehntopp.de> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-/* {{{ includes & prototypes */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "php_recode.h"
-
-#if HAVE_LIBRECODE
-#include "ext/standard/info.h"
-#include "ext/standard/file.h"
-#include "ext/standard/php_string.h"
-#include "zend_list.h"
-
-
-#ifdef HAVE_BROKEN_RECODE
-extern char *program_name;
-char *program_name = "php";
-#endif
-/* }}} */
-
-#define SAFE_STRING(s) ((s)?(s):"")
-
-php_recode_globals recode_globals;
-extern int le_fp,le_pp;
-
-/* {{{ module stuff */
-static zend_function_entry php_recode_functions[] = {
- PHP_FE(recode_string, NULL)
- PHP_FE(recode_file, NULL)
- PHP_FALIAS(recode, recode_string, NULL)
- {NULL, NULL, NULL}
-};
-
-zend_module_entry recode_module_entry = {
- "Recode",
- php_recode_functions,
- PHP_MINIT(recode),
- PHP_MSHUTDOWN(recode),
- NULL,
- NULL,
- PHP_MINFO(recode),
- STANDARD_MODULE_PROPERTIES
-};
-
-#if APACHE
-extern void timeout(int sig);
-#endif
-
-#ifdef COMPILE_DL_RECODE
-ZEND_GET_MODULE(recode)
-#endif
-
-PHP_MINIT_FUNCTION(recode)
-{
- ReSLS_FETCH();
- ReSG(outer) = recode_new_outer(true);
- if (ReSG(outer) == NULL)
- return FAILURE;
-
- return SUCCESS;
-}
-
-
-PHP_MSHUTDOWN_FUNCTION(recode)
-{
- ReSLS_FETCH();
-
- if (ReSG(outer))
- recode_delete_outer(ReSG(outer));
-
- return SUCCESS;
-}
-
-
-PHP_MINFO_FUNCTION(recode)
-{
- ReSLS_FETCH();
-
- php_info_print_table_start();
- php_info_print_table_row(2, "Recode Support", "enabled");
- php_info_print_table_row(2, "Revision", "$Revision$");
- php_info_print_table_end();
-
-}
-
-/* {{{ proto string recode_string(string request, string str)
- Recode string str according to request string */
-
-PHP_FUNCTION(recode_string)
-{
- RECODE_REQUEST request = NULL;
- char *r = NULL;
- pval **str;
- pval **req;
- bool success;
- int r_len=0, r_alen =0;
-
- ReSLS_FETCH();
- if (ZEND_NUM_ARGS() != 2
- || zend_get_parameters_ex(2, &req, &str) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(str);
- convert_to_string_ex(req);
-
- request = recode_new_request(ReSG(outer));
- if (request == NULL) {
- php_error(E_WARNING, "Cannot allocate request structure");
- RETURN_FALSE;
- }
-
- success = recode_scan_request(request, (*req)->value.str.val);
- if (!success) {
- php_error(E_WARNING, "Illegal recode request '%s'", (*req)->value.str.val);
- goto error_exit;
- }
-
- recode_buffer_to_buffer(request, Z_STRVAL_PP(str), Z_STRLEN_PP(str), &r, &r_len, &r_alen);
- if (!r) {
- php_error(E_WARNING, "Recoding failed.");
- goto error_exit;
- }
-
- RETVAL_STRINGL(r, r_len, 1);
- free(r);
- /* FALLTHROUGH */
-
-error_exit:
- if (request)
- recode_delete_request(request);
-
- if (!r)
- RETURN_FALSE;
-
- return;
-}
-/* }}} */
-
-/* {{{ proto bool recode_file(string request, resource input, resource output)
- Recode file input into file output according to request */
-PHP_FUNCTION(recode_file)
-{
- RECODE_REQUEST request = NULL;
- int success;
- pval **req;
- pval **input, **output;
- FILE *in_fp, *out_fp;
- int in_type, out_type;
-
- ReSLS_FETCH();
- if (ZEND_NUM_ARGS() != 3
- || zend_get_parameters_ex(3, &req, &input, &output) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- in_fp = zend_fetch_resource(input,-1, "File-Handle", &in_type,
- 2, php_file_le_fopen(), php_file_le_popen());
- if (!in_fp) {
- php_error(E_WARNING,"Unable to find input file identifier");
- RETURN_FALSE;
- }
-
- out_fp = zend_fetch_resource(output,-1, "File-Handle", &out_type,
- 2, php_file_le_fopen(), php_file_le_popen());
- if (!out_fp) {
- php_error(E_WARNING,"Unable to find output file identifier");
- RETURN_FALSE;
- }
-
- convert_to_string_ex(req);
-
- request = recode_new_request(ReSG(outer));
- if (request == NULL) {
- php_error(E_WARNING, "Cannot allocate request structure");
- RETURN_FALSE;
- }
-
- success = recode_scan_request(request, (*req)->value.str.val);
- if (!success) {
- php_error(E_WARNING, "Illegal recode request '%s'", (*req)->value.str.val);
- goto error_exit;
- }
-
- success = recode_file_to_file(request, in_fp, out_fp);
- if (!success) {
- php_error(E_WARNING, "Recoding failed.");
- goto error_exit;
- }
-
- if (request)
- recode_delete_request(request);
- RETURN_TRUE;
-
-error_exit:
- if (request)
- recode_delete_request(request);
-
- RETURN_FALSE;
-}
-/* }}} */
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/recode/setup.stub b/ext/recode/setup.stub
deleted file mode 100644
index 07bf5d9f39..0000000000
--- a/ext/recode/setup.stub
+++ /dev/null
@@ -1,3 +0,0 @@
-define_option with-recode 'GNU-Recode support?' yesnodir no \
-' Whether to build the recode extension.'
-
diff --git a/ext/rpc/CREDITS b/ext/rpc/CREDITS
deleted file mode 100644
index f49489bcf8..0000000000
--- a/ext/rpc/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-Java
-Sam Ruby
diff --git a/ext/rpc/Makefile.in b/ext/rpc/Makefile.in
deleted file mode 100644
index 2a980157d2..0000000000
--- a/ext/rpc/Makefile.in
+++ /dev/null
@@ -1,25 +0,0 @@
-
-LTLIBRARY_SHARED_NAME = libphp_java.la
-LTLIBRARY_SOURCES = java.c
-LTLIBRARY_DEPENDENCIES = php_java.jar
-
-LTLIBRARY_LDFLAGS = $(EXTRA_LDFLAGS) $(LDFLAGS) $(PHP_RPATHS)
-LTLIBRARY_SHARED_LIBADD = $(LTLIBRARY_DEPENDENCIES) $(EXTRA_LIBS)
-
-EXTRA_CFLAGS = $(JAVA_CFLAGS)
-EXTRA_INCLUDES = $(JAVA_INCLUDE)
-
-make_shared = yes
-
-include $(top_srcdir)/build/dynlib.mk
-
-php_java.jar : reflect.java
- $(mkinstalldirs) net/php
- @cp $(srcdir)/reflect.java net/php
- @echo library=php_java>net/php/reflect.properties
- javac net/php/reflect.java
- @test ! -f reflect.class || mv reflect.class net/php # bug in KJC javac
- $(JAVA_JAR) php_java.jar net/php/*.class net/php/*.properties
- @rm net/php/reflect.*
- @rmdir net/php
- @rmdir net
diff --git a/ext/rpc/com/CREDITS b/ext/rpc/com/CREDITS
deleted file mode 100644
index 27bb7a0b21..0000000000
--- a/ext/rpc/com/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-Win32 COM
-Zeev Suraski, Harald Radi, Alan Brown \ No newline at end of file
diff --git a/ext/rpc/com/com_wrapper.c b/ext/rpc/com/com_wrapper.c
deleted file mode 100644
index ce9201e144..0000000000
--- a/ext/rpc/com/com_wrapper.c
+++ /dev/null
@@ -1,1743 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Zeev Suraski <zeev@zend.com> |
- | Harald Radi <h.radi@nme.at> |
- +----------------------------------------------------------------------+
- */
-
-/*
- * This module implements support for COM components that support the IDispatch
- * interface. Both local (COM) and remote (DCOM) components can be accessed.
- *
- * Type libraries can be loaded (in order for PHP to recognize automation constants)
- * by specifying a typelib_file in the PHP .ini file. That file should contain
- * paths to type libraries, one in every line. By default, constants are registered
- * as case-sensitive. If you want them to be defined as case-insensitive, add
- * #case_insensitive or #cis at the end of the type library path.
- *
- * This is also the first module to demonstrate Zend's OO syntax overloading
- * capabilities. CORBA coders are invited to write a CORBA module as well!
- *
- * Zeev
- */
-
-/*
- * 28.12.2000
- * unicode conversion fixed by Harald Radi <h.radi@nme.at>
- *
- * now all these strange '?'s should be disapeared
- */
-
-/*
- * 28.1.2001
- * VARIANT datatype and pass_by_reference support
- */
-
-/*
- * 03.6.2001
- * Enhanced Typelib support to include a search by name
- */
-
-#ifdef PHP_WIN32
-
-#define _WIN32_DCOM
-
-#include <iostream.h>
-#include <math.h>
-
-#include "php.h"
-#include "php_ini.h"
-#include "com.h"
-
-#include "conversion.h"
-
-zend_class_entry com_class_entry;
-
-PHP_FUNCTION(com_load);
-PHP_FUNCTION(com_invoke);
-PHP_FUNCTION(com_addref);
-PHP_FUNCTION(com_release);
-PHP_FUNCTION(com_propget);
-PHP_FUNCTION(com_propput);
-PHP_FUNCTION(com_load_typelib);
-PHP_FUNCTION(com_isenum);
-
-PHPAPI int php_COM_get_le_idispatch();
-static ITypeLib *php_COM_find_typelib(char *search_string, int mode);
-static int php_COM_load_typelib(ITypeLib *TypeLib, int mode);
-
-static int le_idispatch;
-static int codepage;
-
-function_entry COM_functions[] = {
- PHP_FE(com_load, NULL)
- PHP_FE(com_invoke, NULL)
- PHP_FE(com_addref, NULL)
- PHP_FE(com_release, NULL)
- PHP_FE(com_propget, NULL)
- PHP_FE(com_propput, NULL)
- PHP_FE(com_load_typelib, NULL)
- PHP_FE(com_isenum, NULL)
-
- PHP_FALIAS(com_get, com_propget, NULL)
- PHP_FALIAS(com_propset, com_propput, NULL)
- PHP_FALIAS(com_set, com_propput, NULL)
-
-
- {
- NULL, NULL, NULL
- }
-};
-
-static PHP_MINFO_FUNCTION(COM)
-{
- DISPLAY_INI_ENTRIES();
-}
-
-PHPAPI HRESULT php_COM_invoke(comval *obj, DISPID dispIdMember, WORD wFlags, DISPPARAMS FAR* pDispParams, VARIANT FAR* pVarResult)
-{
- HRESULT hr;
- int failed = FALSE;
-
- if(C_ISREFD(obj))
- {
- if(C_HASTLIB(obj))
- {
- hr = C_TYPEINFO_VT(obj)->Invoke(C_TYPEINFO(obj), C_DISPATCH(obj), dispIdMember, wFlags, pDispParams, pVarResult, NULL, NULL);
- if(FAILED(hr))
- {
- hr = C_DISPATCH_VT(obj)->Invoke(C_DISPATCH(obj), dispIdMember, &IID_NULL, LOCALE_SYSTEM_DEFAULT, wFlags, pDispParams, pVarResult, NULL, NULL);
- if(SUCCEEDED(hr))
- {
- /*
- * ITypLib doesn't work
- * Release ITypeLib and fall back to IDispatch
- */
-
- C_TYPEINFO_VT(obj)->Release(C_TYPEINFO(obj));
- C_HASTLIB(obj) = FALSE;
- }
- }
- }
- else
- {
- hr = C_DISPATCH_VT(obj)->Invoke(C_DISPATCH(obj), dispIdMember, &IID_NULL, LOCALE_SYSTEM_DEFAULT, wFlags, pDispParams, pVarResult, NULL, NULL);
- }
-
- return hr;
- }
- else
- {
- return DISP_E_UNKNOWNINTERFACE;
- }
-}
-
-PHPAPI HRESULT php_COM_get_ids_of_names(comval *obj, OLECHAR FAR* FAR* rgszNames, DISPID FAR* rgDispId)
-{
- HRESULT hr;
-
- if(C_ISREFD(obj))
- {
- if(C_HASTLIB(obj))
- {
- hr = C_TYPEINFO_VT(obj)->GetIDsOfNames(C_TYPEINFO(obj), rgszNames, 1, rgDispId);
-
- if(FAILED(hr))
- {
- hr = C_DISPATCH_VT(obj)->GetIDsOfNames(C_DISPATCH(obj), &IID_NULL, rgszNames, 1, LOCALE_SYSTEM_DEFAULT, rgDispId);
-
- if(SUCCEEDED(hr))
- {
- /*
- * ITypLib doesn't work
- * Release ITypeLib and fall back to IDispatch
- */
-
- C_TYPEINFO_VT(obj)->Release(C_TYPEINFO(obj));
- C_HASTLIB(obj) = FALSE;
- }
- }
- }
- else
- {
- hr = C_DISPATCH_VT(obj)->GetIDsOfNames(C_DISPATCH(obj), &IID_NULL, rgszNames, 1, LOCALE_SYSTEM_DEFAULT, rgDispId);
- }
-
- return hr;
- }
- else
- {
- return DISP_E_UNKNOWNINTERFACE;
- }
-}
-
-PHPAPI HRESULT php_COM_release(comval *obj)
-{
- if(obj->refcount > 1)
- {
- C_RELEASE(obj);
- }
- else if(obj->refcount == 1)
- {
- if(C_HASTLIB(obj))
- {
- C_TYPEINFO_VT(obj)->Release(C_TYPEINFO(obj));
- }
- if(C_HASENUM(obj))
- {
- C_ENUMVARIANT_VT(obj)->Release(C_ENUMVARIANT(obj));
- }
- C_DISPATCH_VT(obj)->Release(C_DISPATCH(obj));
- C_RELEASE(obj);
- }
-
- return obj->refcount;
-}
-
-PHPAPI HRESULT php_COM_addref(comval *obj)
-{
- if(C_ISREFD(obj))
- {
- C_ADDREF(obj);
- }
-
- return obj->refcount;
-}
-
-PHPAPI HRESULT php_COM_set(comval *obj, IDispatch FAR* pDisp, int cleanup)
-{
- HRESULT hr = 1;
- DISPPARAMS dispparams;
- VARIANT var_result;
-
- C_DISPATCH(obj) = pDisp;
- obj->refcount = 1;
- C_HASTLIB(obj) = SUCCEEDED(C_DISPATCH_VT(obj)->GetTypeInfo(C_DISPATCH(obj), 0, LANG_NEUTRAL, &C_TYPEINFO(obj)));
-
- dispparams.rgvarg = NULL;
- dispparams.rgdispidNamedArgs = NULL;
- dispparams.cArgs = 0;
- dispparams.cNamedArgs = 0;
-
- if(C_HASENUM(obj) = SUCCEEDED(C_DISPATCH_VT(obj)->Invoke(C_DISPATCH(obj), DISPID_NEWENUM, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
- DISPATCH_METHOD|DISPATCH_PROPERTYGET, &dispparams, &var_result, NULL, NULL)))
- {
- if (V_VT(&var_result) == VT_UNKNOWN)
- {
- C_HASENUM(obj) = SUCCEEDED(V_UNKNOWN(&var_result)->lpVtbl->QueryInterface(V_UNKNOWN(&var_result), &IID_IEnumVARIANT,
- (void**)&C_ENUMVARIANT(obj)));
- }
- else if (V_VT(&var_result) == VT_DISPATCH)
- {
- C_HASENUM(obj) = SUCCEEDED(V_DISPATCH(&var_result)->lpVtbl->QueryInterface(V_DISPATCH(&var_result), &IID_IEnumVARIANT,
- (void**)&C_ENUMVARIANT(obj)));
- }
-
- }
-
- if(!cleanup)
- {
- hr = C_DISPATCH_VT(obj)->AddRef(C_DISPATCH(obj));
- }
-
- return hr;
-}
-
-PHPAPI HRESULT php_COM_clone(comval *obj, comval *clone, int cleanup)
-{
- HRESULT hr;
-
- C_HASTLIB(obj) = C_HASTLIB(clone);
- C_HASENUM(obj) = C_HASENUM(obj);
- C_DISPATCH(obj) = C_DISPATCH(clone);
- C_TYPEINFO(obj) = C_TYPEINFO(clone);
-
- if(cleanup || !C_ISREFD(obj))
- {
- obj->refcount = clone->refcount;
- C_ISREFD(clone) = FALSE;
- }
- else
- {
- if(C_HASTLIB(obj))
- {
- C_TYPEINFO_VT(obj)->AddRef(C_TYPEINFO(obj));
- }
- if(C_HASENUM(obj))
- {
- C_ENUMVARIANT_VT(obj)->AddRef(C_ENUMVARIANT(obj));
- }
- hr = C_DISPATCH_VT(obj)->AddRef(C_DISPATCH(obj));
- obj->refcount = 1;
- }
-
- return hr;
-}
-
-PHPAPI char *php_COM_error_message(HRESULT hr)
-{
- void *pMsgBuf;
-
- if(!FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, NULL,
- hr, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR) &pMsgBuf, 0, NULL))
- {
- char error_string[] = "No description available";
-
- pMsgBuf = LocalAlloc(LMEM_FIXED, sizeof(error_string));
- memcpy(pMsgBuf, error_string, sizeof(error_string));
- }
-
- return pMsgBuf;
-}
-
-static char *php_string_from_clsid(const CLSID *clsid)
-{
- LPOLESTR ole_clsid;
- char *clsid_str;
-
- StringFromCLSID(clsid, &ole_clsid);
- clsid_str = php_OLECHAR_to_char(ole_clsid, NULL, 0, codepage);
- LocalFree(ole_clsid);
-
- return clsid_str;
-}
-
-static void php_idispatch_destructor(zend_rsrc_list_entry *rsrc)
-{
- comval *obj = (comval *)rsrc->ptr;
- while(C_ISREFD(obj))
- {
- php_COM_release(obj);
- }
- efree(obj);
-}
-
-static PHP_INI_MH(OnTypelibFileChange)
-{
- FILE *typelib_file;
- char *typelib_name_buffer;
- char *strtok_buf = NULL;
-#if SUPPORT_INTERACTIVE
- int interactive;
- ELS_FETCH();
-
- interactive = EG(interactive);
-#endif
-
-
- if(!new_value || (typelib_file=VCWD_FOPEN(new_value, "r"))==NULL)
- {
- return FAILURE;
- }
-
-#if SUPPORT_INTERACTIVE
- if(interactive)
- {
- printf("Loading type libraries...");
- fflush(stdout);
- }
-#endif
-
- typelib_name_buffer = (char *) emalloc(sizeof(char)*1024);
-
- while(fgets(typelib_name_buffer, 1024, typelib_file))
- {
- ITypeLib *pTL;
- char *typelib_name;
- char *modifier, *ptr;
- int mode = CONST_PERSISTENT|CONST_CS;
-
- if(typelib_name_buffer[0]==';')
- {
- continue;
- }
- typelib_name = php_strtok_r(typelib_name_buffer, "\r\n", &strtok_buf); /* get rid of newlines */
- if(typelib_name == NULL)
- {
- continue;
- }
- typelib_name = php_strtok_r(typelib_name, "#", &strtok_buf);
- modifier = php_strtok_r(NULL, "#", &strtok_buf);
- if(modifier != NULL)
- {
- if(!strcmp(modifier, "cis") || !strcmp(modifier, "case_insensitive"))
- {
- mode &= ~CONST_CS;
- }
- }
-
- /* Remove leading/training white spaces on search_string */
- while(isspace(*typelib_name)) /* Ends on '\0' in worst case */
- {
- typelib_name ++;
- }
- ptr = typelib_name + strlen(typelib_name) - 1;
- while((ptr != typelib_name) && isspace(*ptr))
- {
- *ptr = '\0';
- ptr--;
- }
-
-
-#if SUPPORT_INTERACTIVE
- if(interactive)
- {
- printf("\rLoading %-60s\r", typelib_name);
- }
-#endif
- if((pTL = php_COM_find_typelib(typelib_name, mode)) != NULL)
- {
- php_COM_load_typelib(pTL, mode);
- pTL->lpVtbl->Release(pTL);
- }
- }
-
- efree(typelib_name_buffer);
- fclose(typelib_file);
-
-#if SUPPORT_INTERACTIVE
- if(interactive)
- {
- printf("\r%70s\r", "");
- }
-#endif
-
- return SUCCESS;
-}
-
-
-PHP_INI_BEGIN()
-PHP_INI_ENTRY_EX("com.allow_dcom", "0", PHP_INI_SYSTEM, NULL, php_ini_boolean_displayer_cb)
-PHP_INI_ENTRY_EX("com.autoregister_typelib", "0", PHP_INI_SYSTEM, NULL, php_ini_boolean_displayer_cb)
-PHP_INI_ENTRY_EX("com.autoregister_casesensitive", "1", PHP_INI_SYSTEM, NULL, php_ini_boolean_displayer_cb)
-PHP_INI_ENTRY("com.typelib_file", "", PHP_INI_SYSTEM, OnTypelibFileChange)
-PHP_INI_END()
-
-
-/* {{{ proto int com_load(string module_name [, string remote_host [, int codepage[, string typelib]]])
- Loads a COM module */
-PHP_FUNCTION(com_load)
-{
- pval *module_name, *code_page, *typelib = NULL, *server_name = NULL;
- CLSID clsid;
- HRESULT hr;
- OLECHAR *ProgID;
- comval *obj;
- char *error_message;
- char *clsid_str;
- int mode = CONST_PERSISTENT;
- ITypeLib *pTL;
-
-
- codepage = CP_ACP;
-
- switch(ZEND_NUM_ARGS())
- {
- case 1:
- getParameters(ht, 1, &module_name);
- break;
-
- case 2:
- getParameters(ht, 2, &module_name, &server_name);
- break;
-
- case 3:
- getParameters(ht, 3, &module_name, &server_name, &code_page);
-
- convert_to_long_ex(&code_page);
- codepage = code_page->value.lval;
- break;
-
- case 4:
- getParameters(ht, 4, &module_name, &server_name, &code_page, &typelib);
-
- convert_to_string_ex(&typelib);
- convert_to_long_ex(&code_page);
- codepage = Z_LVAL_P(code_page);
-
- break;
-
- default:
- WRONG_PARAM_COUNT;
- }
-
- if(server_name != NULL)
- {
- if(Z_TYPE_P(server_name) == IS_NULL)
- {
- server_name = NULL;
- }
- else
- {
- if(!INI_INT("com.allow_dcom"))
- {
- php_error(E_WARNING, "DCOM is disabled");
- RETURN_FALSE;
- }
- else
- {
- convert_to_string_ex(&server_name);
- }
- }
- }
-
- convert_to_string_ex(&module_name);
- ProgID = php_char_to_OLECHAR(Z_STRVAL_P(module_name), Z_STRLEN_P(module_name), codepage);
- obj = (comval *) emalloc(sizeof(comval));
-
- /* obtain CLSID */
- if(FAILED(CLSIDFromProgID(ProgID, &clsid)))
- {
- /* Perhaps this is a Moniker? */
- IBindCtx *pBindCtx;
- IMoniker *pMoniker;
- ULONG ulEaten;
-
- /* TODO: if(server_name) */
-
- if(!server_name)
- {
- if(SUCCEEDED(hr = CreateBindCtx(0, &pBindCtx)))
- {
- if(SUCCEEDED(hr = MkParseDisplayName(pBindCtx, ProgID, &ulEaten, &pMoniker)))
- {
- hr = pMoniker->lpVtbl->BindToObject(pMoniker, pBindCtx, NULL, &IID_IDispatch, (LPVOID *) &C_DISPATCH(obj));
- pMoniker->lpVtbl->Release(pMoniker);
- }
- pBindCtx->lpVtbl->Release(pBindCtx);
- }
- }
- else
- {
- hr = MK_E_SYNTAX;
- }
-
- efree(ProgID);
-
- if(FAILED(hr))
- {
- efree(obj);
- error_message = php_COM_error_message(hr);
- php_error(E_WARNING,"Invalid ProgID or Moniker: %s\n", error_message);
- LocalFree(error_message);
- RETURN_FALSE;
- }
- }
- else
- {
- efree(ProgID);
- /* obtain IDispatch */
- if(!server_name)
- {
- hr = CoCreateInstance(&clsid, NULL, CLSCTX_SERVER, &IID_IDispatch, (LPVOID *) &C_DISPATCH(obj));
- }
- else
- {
- COSERVERINFO server_info;
- MULTI_QI pResults;
-
- server_info.dwReserved1=0;
- server_info.dwReserved2=0;
- server_info.pwszName = php_char_to_OLECHAR(Z_STRVAL_P(server_name), Z_STRLEN_P(server_name), codepage);
- server_info.pAuthInfo=NULL;
-
- pResults.pIID = &IID_IDispatch;
- pResults.pItf = NULL;
- pResults.hr = S_OK;
- hr=CoCreateInstanceEx(&clsid, NULL, CLSCTX_SERVER, &server_info, 1, &pResults);
- if(SUCCEEDED(hr))
- {
- hr = pResults.hr;
- C_DISPATCH(obj) = (IDispatch *) pResults.pItf;
- }
- efree(server_info.pwszName);
- }
-
- if(FAILED(hr))
- {
- error_message = php_COM_error_message(hr);
- clsid_str = php_string_from_clsid(&clsid);
- php_error(E_WARNING,"Unable to obtain IDispatch interface for CLSID %s: %s",clsid_str,error_message);
- LocalFree(error_message);
- efree(clsid_str);
- efree(obj);
- RETURN_FALSE;
- }
- }
-
- php_COM_set(obj, C_DISPATCH(obj), TRUE);
-
- if(INI_INT("com.autoregister_casesensitive"))
- {
- mode |= CONST_CS;
- }
-
- if(C_HASTLIB(obj))
- {
- if(INI_INT("com.autoregister_typelib"))
- {
- unsigned int idx;
-
- if(C_TYPEINFO_VT(obj)->GetContainingTypeLib(C_TYPEINFO(obj), &pTL, &idx) == S_OK)
- {
- php_COM_load_typelib(pTL, mode);
- pTL->lpVtbl->Release(pTL);
- }
- }
- }
- else
- {
- if(typelib != NULL)
- {
- ITypeLib *pTL;
-
- if((pTL = php_COM_find_typelib(Z_STRVAL_P(typelib), mode)) != NULL)
- {
- C_HASTLIB(obj) = SUCCEEDED(pTL->lpVtbl->GetTypeInfo(pTL, 0, &C_TYPEINFO(obj)));
- /* idx 0 should deliver the ITypeInfo for the IDispatch Interface */
- if(INI_INT("com.autoregister_typelib"))
- {
- php_COM_load_typelib(pTL, mode);
- }
- pTL->lpVtbl->Release(pTL);
- }
- }
- }
-
- RETURN_LONG(zend_list_insert(obj, le_idispatch));
-}
-/* }}} */
-
-
-int do_COM_invoke(comval *obj, pval *function_name, VARIANT *var_result, pval **arguments, int arg_count)
-{
- DISPID dispid;
- HRESULT hr;
- OLECHAR *funcname;
- char *error_message;
- VARIANT *variant_args;
- int current_arg, current_variant;
- DISPPARAMS dispparams;
- SAFEARRAY *pSA;
-
- if(C_HASENUM(obj) && strstr(Z_STRVAL_P(function_name), "next"))
- {
- // Grab one argument off the stack, allocate enough
- // VARIANTs
- // Get the IEnumVariant interface and call ->Next();
- SAFEARRAYBOUND rgsabound[1];
- unsigned long count;
-
- switch(arg_count)
- {
- case 0:
- count = 1;
- break;
-
- case 1:
- convert_to_long_ex(&arguments[0]);
- count = Z_LVAL_P(arguments[0]);
- break;
-
- default:
- /* TODO: complain about wrong arg count */
- php_error(E_WARNING,"Wrong argument count to IEnumVariant::Next()\n");
-
- return FAILURE;
- }
-
- rgsabound[0].lLbound = 0;
- rgsabound[0].cElements = count;
-
- if((pSA = SafeArrayCreate(VT_VARIANT, 1, rgsabound)) == NULL)
- {
- VariantInit(var_result);
- return FAILURE;
- }
- else
- {
- V_ARRAY(var_result) = pSA;
- V_VT(var_result) = VT_VARIANT|VT_ARRAY;
- }
-
- if(FAILED(hr = C_ENUMVARIANT_VT(obj)->Next(C_ENUMVARIANT(obj), count, pSA->pvData, &count)))
- {
- char *error_message = php_COM_error_message(hr);
- php_error(E_WARNING,"IEnumVariant::Next() failed: %s\n", error_message);
- efree(error_message);
- SafeArrayDestroy(pSA);
- VariantInit(var_result);
- return FAILURE;
- }
-
- if(count != rgsabound[0].cElements)
- {
- rgsabound[0].cElements = count;
- if(FAILED(SafeArrayRedim(pSA, rgsabound)))
- {
- char *error_message = php_COM_error_message(hr);
- php_error(E_WARNING,"IEnumVariant::Next() failed: %s\n", error_message);
- efree(error_message);
- SafeArrayDestroy(pSA);
- VariantInit(var_result);
- return FAILURE;
- }
- }
-
- return SUCCESS;
- }
- else if(C_HASENUM(obj) && strstr(Z_STRVAL_P(function_name), "reset"))
- {
- if(FAILED(hr = C_ENUMVARIANT_VT(obj)->Reset(C_ENUMVARIANT(obj))))
- {
- char *error_message = php_COM_error_message(hr);
- php_error(E_WARNING,"IEnumVariant::Next() failed: %s\n", error_message);
- efree(error_message);
- return FAILURE;
- }
- return SUCCESS;
- }
- else if(C_HASENUM(obj) && strstr(Z_STRVAL_P(function_name), "skip"))
- {
- unsigned long count;
-
- switch(arg_count)
- {
- case 0:
- count = 1;
- break;
-
- case 1:
- convert_to_long_ex(&arguments[0]);
- count = Z_LVAL_P(arguments[0]);
- break;
-
- default:
- php_error(E_WARNING,"Wrong argument count to IEnumVariant::Skip()\n");
- return FAILURE;
- }
- if(FAILED(hr = C_ENUMVARIANT_VT(obj)->Skip(C_ENUMVARIANT(obj), count)))
- {
- char *error_message = php_COM_error_message(hr);
- php_error(E_WARNING,"IEnumVariant::Next() failed: %s\n", error_message);
- efree(error_message);
- return FAILURE;
- }
- return SUCCESS;
-
- }
- else
- {
- funcname = php_char_to_OLECHAR(Z_STRVAL_P(function_name), Z_STRLEN_P(function_name), codepage);
-
- hr = php_COM_get_ids_of_names(obj, &funcname, &dispid);
-
- if(FAILED(hr))
- {
- error_message = php_COM_error_message(hr);
- php_error(E_WARNING,"Unable to lookup %s: %s\n", Z_STRVAL_P(function_name), error_message);
- LocalFree(error_message);
- efree(funcname);
- return FAILURE;
- }
-
- variant_args = (VARIANT*) emalloc(sizeof(VARIANT)*arg_count);
-
- for(current_arg=0; current_arg<arg_count; current_arg++)
- {
- current_variant = arg_count - current_arg - 1;
- php_pval_to_variant(arguments[current_arg], &variant_args[current_variant], codepage);
- }
-
- dispparams.rgvarg = variant_args;
- dispparams.rgdispidNamedArgs = NULL;
- dispparams.cArgs = arg_count;
- dispparams.cNamedArgs = 0;
-
- hr = php_COM_invoke(obj, dispid, DISPATCH_METHOD|DISPATCH_PROPERTYGET, &dispparams, var_result);
-
- if(FAILED(hr))
- {
- error_message = php_COM_error_message(hr);
- php_error(E_WARNING,"Invoke() failed: %s\n", error_message);
- LocalFree(error_message);
- efree(funcname);
- efree(variant_args);
- return FAILURE;
- }
-
- efree(variant_args);
- efree(funcname);
- }
- return SUCCESS;
-}
-
-
-/* {{{ proto mixed com_invoke(int module, string handler_name [, mixed arg [, ...]])
- Invokes a COM module */
-PHP_FUNCTION(com_invoke)
-{
- pval **arguments;
- pval *object, *function_name;
- comval *obj;
- int type;
- int arg_count = ZEND_NUM_ARGS();
- VARIANT var_result;
-
- if(arg_count<2)
- {
- WRONG_PARAM_COUNT;
- }
- arguments = (pval **) emalloc(sizeof(pval *)*arg_count);
- if(getParametersArray(ht, arg_count, arguments)==FAILURE)
- {
- RETURN_FALSE;
- }
-
- object = arguments[0];
- function_name = arguments[1];
-
- /* obtain IDispatch interface */
- convert_to_long(object);
- obj = (comval *)zend_list_find(Z_LVAL_P(object), &type);
- if(!obj || (type!=le_idispatch))
- {
- php_error(E_WARNING,"%d is not a COM object handler", Z_STRVAL_P(function_name));
- RETURN_FALSE;
- }
-
- /* obtain property/method handler */
- convert_to_string_ex(&function_name);
-
- if(do_COM_invoke(obj, function_name, &var_result, arguments+2, arg_count-2)==FAILURE)
- {
- RETURN_FALSE;
- }
- efree(arguments);
-
- php_variant_to_pval(&var_result, return_value, 0, codepage);
-}
-/* }}} */
-
-/* {{{ proto mixed com_invoke(int module)
- Releases a COM object */
-PHP_FUNCTION(com_release)
-{
- pval *object;
- comval *obj;
- int type;
- int arg_count = ZEND_NUM_ARGS();
-
- if(arg_count != 1)
- {
- WRONG_PARAM_COUNT;
- }
-
- if(getParameters(ht, 1, &object)==FAILURE)
- {
- RETURN_FALSE;
- }
-
- /* obtain IDispatch interface */
- convert_to_long_ex(&object);
- obj = (comval *)zend_list_find(Z_LVAL_P(object), &type);
- if(!obj || (type != le_idispatch))
- {
- php_error(E_WARNING,"%d is not a COM object handler");
- RETURN_FALSE;
- }
-
- RETURN_LONG(php_COM_release(obj))
-}
-/* }}} */
-
-/* {{{ proto mixed com_addref(int module)
- Increases the reference counter on a COM object */
-PHP_FUNCTION(com_addref)
-{
- pval *object;
- comval *obj;
- int type;
- int arg_count = ZEND_NUM_ARGS();
-
- if(arg_count != 1)
- {
- WRONG_PARAM_COUNT;
- }
-
- if(getParameters(ht, 1, &object)==FAILURE)
- {
- RETURN_FALSE;
- }
-
- /* obtain IDispatch interface */
- convert_to_long_ex(&object);
- obj = (comval *)zend_list_find(Z_LVAL_P(object), &type);
- if(!obj || (type != le_idispatch))
- {
- php_error(E_WARNING,"%d is not a COM object handler");
- RETURN_FALSE;
- }
-
- RETURN_LONG(php_COM_addref(obj));
-}
-/* }}} */
-
-static int do_COM_offget(VARIANT *result, comval *array, pval *property, int cleanup)
-{
- pval function_name;
- int retval;
-
- ZVAL_STRINGL(&function_name, "Item", 4, 0);
- retval = do_COM_invoke(array, &function_name, result, &property, 1);
- if(cleanup)
- {
- php_COM_release(array);
- efree(array);
- }
-
- return retval;
-}
-
-static int do_COM_propget(VARIANT *var_result, comval *obj, pval *arg_property, int cleanup)
-{
- DISPID dispid;
- HRESULT hr;
- OLECHAR *propname;
- char *error_message;
- DISPPARAMS dispparams;
-
-
- /* obtain property handler */
- propname = php_char_to_OLECHAR(Z_STRVAL_P(arg_property), Z_STRLEN_P(arg_property), codepage);
-
- hr = php_COM_get_ids_of_names(obj, &propname, &dispid);
-
- if(FAILED(hr))
- {
- error_message = php_COM_error_message(hr);
- php_error(E_WARNING,"Unable to lookup %s: %s\n", Z_STRVAL_P(arg_property), error_message);
- LocalFree(error_message);
- efree(propname);
- if(cleanup)
- {
- php_COM_release(obj);
- }
- return FAILURE;
- }
-
- dispparams.cArgs = 0;
- dispparams.cNamedArgs = 0;
-
- hr = php_COM_invoke(obj, dispid, DISPATCH_PROPERTYGET, &dispparams, var_result);
-
- if(FAILED(hr))
- {
- error_message = php_COM_error_message(hr);
- php_error(E_WARNING,"PropGet() failed: %s\n", error_message);
- LocalFree(error_message);
- efree(propname);
- if(cleanup)
- {
- php_COM_release(obj);
- }
- return FAILURE;
- }
-
- efree(propname);
- if(cleanup)
- {
- php_COM_release(obj);
- }
- return SUCCESS;
-}
-
-
-static void do_COM_propput(pval *return_value, comval *obj, pval *arg_property, pval *value)
-{
- DISPID dispid;
- HRESULT hr;
- OLECHAR *propname;
- char *error_message;
- VARIANT *var_result;
- DISPPARAMS dispparams;
- VARIANT new_value;
- DISPID mydispid = DISPID_PROPERTYPUT;
-
-
- var_result = emalloc(sizeof(VARIANT));
-
- /* obtain property handler */
- propname = php_char_to_OLECHAR(Z_STRVAL_P(arg_property), Z_STRLEN_P(arg_property), codepage);
-
- hr = php_COM_get_ids_of_names(obj, &propname, &dispid);
-
- if(FAILED(hr))
- {
- error_message = php_COM_error_message(hr);
- php_error(E_WARNING,"Unable to lookup %s: %s\n", Z_STRVAL_P(arg_property), error_message);
- LocalFree(error_message);
- efree(propname);
- RETURN_FALSE;
- }
-
- php_pval_to_variant(value, &new_value, codepage);
- dispparams.rgvarg = &new_value;
- dispparams.rgdispidNamedArgs = &mydispid;
- dispparams.cArgs = 1;
- dispparams.cNamedArgs = 1;
-
- hr = php_COM_invoke(obj, dispid, DISPATCH_PROPERTYPUT, &dispparams, NULL);
-
- if(FAILED(hr))
- {
- error_message = php_COM_error_message(hr);
- php_error(E_WARNING,"PropPut() failed: %s\n", error_message);
- LocalFree(error_message);
- efree(propname);
- RETURN_FALSE;
- }
-
- dispparams.cArgs = 0;
- dispparams.cNamedArgs = 0;
-
- hr = php_COM_invoke(obj, dispid, DISPATCH_PROPERTYGET, &dispparams, var_result);
-
- if(SUCCEEDED(hr))
- {
- php_variant_to_pval(var_result, return_value, 0, codepage);
- }
- else
- {
- *return_value = *value;
- zval_copy_ctor(return_value);
- }
-
- efree(var_result);
- efree(propname);
-}
-
-
-/* {{{ proto mixed com_propget(int module, string property_name)
- Gets properties from a COM module */
-PHP_FUNCTION(com_propget)
-{
- pval *arg_idispatch, *arg_property;
- int type;
- comval *obj;
- VARIANT var_result;
-
- if(ZEND_NUM_ARGS()!=2 || getParameters(ht, 2, &arg_idispatch, &arg_property)==FAILURE)
- {
- WRONG_PARAM_COUNT;
- }
-
- /* obtain IDispatch interface */
- convert_to_long(arg_idispatch);
- obj = (comval *)zend_list_find(Z_LVAL_P(arg_idispatch), &type);
- if(!obj || (type != le_idispatch))
- {
- php_error(E_WARNING,"%d is not a COM object handler", Z_LVAL_P(arg_idispatch));
- }
- convert_to_string_ex(&arg_property);
-
- if(do_COM_propget(&var_result, obj, arg_property, 0)==FAILURE)
- {
- RETURN_FALSE;
- }
- php_variant_to_pval(&var_result, return_value, 0, codepage);
-}
-/* }}} */
-
-
-/* {{{ proto bool com_propput(int module, string property_name, mixed value)
- Puts the properties for a module */
-PHP_FUNCTION(com_propput)
-{
- pval *arg_idispatch, *arg_property, *arg_value;
- int type;
- comval *obj;
-
- if(ZEND_NUM_ARGS()!=3 || getParameters(ht, 3, &arg_idispatch, &arg_property, &arg_value)==FAILURE)
- {
- WRONG_PARAM_COUNT;
- }
-
- /* obtain comval interface */
- convert_to_long(arg_idispatch);
- /* obtain comval interface */
- obj = (comval *)zend_list_find(Z_LVAL_P(arg_idispatch), &type);
- if(!obj || (type != le_idispatch))
- {
- php_error(E_WARNING,"%d is not a COM object handler", Z_LVAL_P(arg_idispatch));
- }
- convert_to_string_ex(&arg_property);
-
- do_COM_propput(return_value, obj, arg_property, arg_value);
-}
-/* }}} */
-
-/* {{{ proto bool com_load_typelib(string typelib_name[, int case_insensitiv]) */
-PHP_FUNCTION(com_load_typelib)
-{
- pval *arg_typelib, *arg_cis;
- ITypeLib *pTL;
- int mode;
-
- switch(ZEND_NUM_ARGS())
- {
- case 1:
- getParameters(ht, 1, &arg_typelib);
- mode = CONST_PERSISTENT|CONST_CS;
- break;
- case 2:
- getParameters(ht, 2, &arg_typelib, &arg_cis);
- convert_to_boolean_ex(&arg_cis);
- if(arg_cis->value.lval)
- {
- mode &= ~CONST_CS;
- }
- default:
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(&arg_typelib);
- pTL = php_COM_find_typelib(Z_STRVAL_P(arg_typelib), mode);
- if(php_COM_load_typelib(pTL, mode) == SUCCESS)
- {
- pTL->lpVtbl->Release(pTL);
- RETURN_TRUE;
- }
- else
- {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-PHPAPI pval php_COM_get_property_handler(zend_property_reference *property_reference)
-{
- zend_overloaded_element *overloaded_property;
- zend_llist_element *element;
- pval return_value;
- pval **idispatch_handle;
- pval *object = property_reference->object;
- int type;
- comval *obj, *obj_prop;
- VARIANT *var_result;
-
- INIT_ZVAL(return_value);
- ZVAL_NULL(&return_value);
-
- /* fetch the IDispatch interface */
- zend_hash_index_find(object->value.obj.properties, 0, (void **) &idispatch_handle);
- obj = (comval *) zend_list_find(Z_LVAL_P(*idispatch_handle), &type);
- if(!obj || (type != le_idispatch))
- {
- return return_value;
- }
-
- obj_prop = (comval *) emalloc(sizeof(comval));
- var_result = (VARIANT *) emalloc(sizeof(VARIANT));
-
- for(element=property_reference->elements_list->head; element; element=element->next)
- {
- overloaded_property = (zend_overloaded_element *) element->data;
- VariantInit(var_result);
- switch(overloaded_property->type)
- {
- case OE_IS_ARRAY:
- if(do_COM_offget(var_result, obj, &overloaded_property->element, FALSE) == FAILURE)
- {
- efree(var_result);
- efree(obj_prop);
- return return_value;
- }
- break;
-
- case OE_IS_OBJECT:
- if(do_COM_propget(var_result, obj, &overloaded_property->element, FALSE) == FAILURE)
- {
- efree(var_result);
- efree(obj_prop);
- return return_value;
- }
- break;
-
- case OE_IS_METHOD:
- {
- if(obj == obj_prop)
- {
- pval *handle;
-
- return_value.type = IS_OBJECT;
- return_value.value.obj.ce = &com_class_entry;
- ALLOC_HASHTABLE(return_value.value.obj.properties);
- zend_hash_init(return_value.value.obj.properties, 0, NULL, ZVAL_PTR_DTOR, 0);
-
- ALLOC_ZVAL(handle);
- INIT_PZVAL(handle);
- ZVAL_LONG(handle, zend_list_insert(obj, php_COM_get_le_idispatch()));
-
- pval_copy_constructor(handle);
- zend_hash_index_update(return_value.value.obj.properties, 0, &handle, sizeof(pval *), NULL);
- }
- else
- {
- efree(obj_prop);
- return_value = *object;
- ZVAL_ADDREF(&return_value);
- }
-
- efree(var_result);
-
- return return_value;
- }
- break;
- }
-
- if(V_VT(var_result) == VT_DISPATCH)
- {
- pval *handle;
-
- if(V_DISPATCH(var_result) == NULL)
- {
- efree(var_result);
- efree(obj_prop);
- return return_value;
- }
-
- obj = obj_prop;
-
- php_COM_set(obj_prop, V_DISPATCH(var_result), TRUE);
-
- return_value.type = IS_OBJECT;
- return_value.value.obj.ce = &com_class_entry;
- ALLOC_HASHTABLE(return_value.value.obj.properties);
- zend_hash_init(return_value.value.obj.properties, 0, NULL, ZVAL_PTR_DTOR, 0);
-
- ALLOC_ZVAL(handle);
- INIT_PZVAL(handle);
- ZVAL_LONG(handle, zend_list_insert(obj, php_COM_get_le_idispatch()));
-
- pval_copy_constructor(handle);
- zend_hash_index_update(return_value.value.obj.properties, 0, &handle, sizeof(pval *), NULL);
- }
- else
- {
- efree(obj_prop);
- obj_prop = NULL;
- php_variant_to_pval(var_result, &return_value, FALSE, codepage);
- }
-
- pval_destructor(&overloaded_property->element);
- }
- efree(var_result);
-
- return return_value;
-}
-
-PHPAPI int php_COM_set_property_handler(zend_property_reference *property_reference, pval *value)
-{
- pval result;
- zend_overloaded_element *overloaded_property;
- zend_llist_element *element;
- pval **idispatch_handle;
- pval *object = property_reference->object;
- comval *obj;
- int type;
- VARIANT var_result;
-
-
- /* fetch the IDispatch interface */
- zend_hash_index_find(object->value.obj.properties, 0, (void **) &idispatch_handle);
- obj = (comval *)zend_list_find(Z_LVAL_P(*idispatch_handle), &type);
- if(!obj || (type != le_idispatch))
- {
- return FAILURE;
- }
- var_result.vt = VT_DISPATCH;
- var_result.pdispVal = C_DISPATCH(obj);
-
- for(element=property_reference->elements_list->head; element && element!=property_reference->elements_list->tail; element=element->next)
- {
- overloaded_property = (zend_overloaded_element *) element->data;
- switch(overloaded_property->type)
- {
- case OE_IS_ARRAY:
- break;
- case OE_IS_OBJECT:
- if(V_VT(&var_result) != VT_DISPATCH)
- {
- return FAILURE;
- }
- else
- {
- do_COM_propget(&var_result, obj, &overloaded_property->element, element!=property_reference->elements_list->head);
- }
- break;
- case OE_IS_METHOD:
- /* this shouldn't happen */
- return FAILURE;
- }
-
- pval_destructor(&overloaded_property->element);
- }
-
- if(V_VT(&var_result) != VT_DISPATCH)
- {
- return FAILURE;
- }
- obj = (comval *) emalloc(sizeof(comval));
- C_HASTLIB(obj) = FALSE;
- C_DISPATCH(obj) = V_DISPATCH(&var_result);
-
- overloaded_property = (zend_overloaded_element *) element->data;
- do_COM_propput(&result, obj, &overloaded_property->element, value);
- pval_destructor(&overloaded_property->element);
- efree(obj);
-
- return SUCCESS;
-}
-
-PHPAPI void php_COM_call_function_handler(INTERNAL_FUNCTION_PARAMETERS, zend_property_reference *property_reference)
-{
- pval property, **handle;
- pval *object = property_reference->object;
- zend_overloaded_element *function_name = (zend_overloaded_element *) property_reference->elements_list->tail->data;
- comval *obj;
- int type;
-
- if(zend_llist_count(property_reference->elements_list)==1
- && !strcmp(function_name->element.value.str.val, "com"))
- { /* constructor */
- pval *object_handle;
-
- PHP_FN(com_load)(INTERNAL_FUNCTION_PARAM_PASSTHRU);
- if(!zend_is_true(return_value))
- {
- var_reset(object);
- return;
- }
- ALLOC_ZVAL(object_handle);
- *object_handle = *return_value;
- pval_copy_constructor(object_handle);
- INIT_PZVAL(object_handle);
- zend_hash_index_update(object->value.obj.properties, 0, &object_handle, sizeof(pval *), NULL);
- pval_destructor(&function_name->element);
-
- return;
- }
-
- property = php_COM_get_property_handler(property_reference);
- if(property.type == IS_NULL)
- {
- if(property.refcount == 1)
- {
- pval_destructor(&property);
- }
- pval_destructor(&function_name->element);
- return;
- }
- zend_hash_index_find(property.value.obj.properties, 0, (void **) &handle);
- obj = (comval *)zend_list_find((*handle)->value.lval,&type);
-
- if(!obj || (type!=le_idispatch))
- {
- pval_destructor(&property);
- pval_destructor(&function_name->element);
- return;
- }
-
- if(zend_llist_count(property_reference->elements_list)==1
- && !strcmp(Z_STRVAL_P(&function_name->element), "release"))
- {
- RETVAL_LONG(php_COM_release(obj));
- }
- else if(zend_llist_count(property_reference->elements_list)==1
- && !strcmp(Z_STRVAL_P(&function_name->element), "addref"))
- {
- RETVAL_LONG(php_COM_addref(obj));
- }
- else
- {
- pval **arguments;
- VARIANT *var_result;
- int arg_count = ZEND_NUM_ARGS();
-
- var_result = (VARIANT *) emalloc(sizeof(VARIANT));
-
- VariantInit(var_result);
-
- arguments = (pval **) emalloc(sizeof(pval *)*arg_count);
- getParametersArray(ht, arg_count, arguments);
-
- if(do_COM_invoke(obj , &function_name->element, var_result, arguments, arg_count)==FAILURE)
- {
- RETVAL_FALSE;
- }
- else
- {
- php_variant_to_pval(var_result, return_value, 0, codepage);
- }
-
- efree(arguments);
- efree(var_result);
- }
-
- if(property.refcount == 1)
- {
- pval_destructor(&property);
- }
- pval_destructor(&function_name->element);
-}
-
-static ITypeLib *php_COM_find_typelib(char *search_string, int mode)
-{
- ITypeLib *TypeLib = NULL;
- char *strtok_buf, *major, *minor;
- CLSID clsid;
- OLECHAR *p;
-
- /* Type Libraries:
- * The string we have is either:
- * a) a file name
- * b) a CLSID, major, minor e.g. "{00000200-0000-0010-8000-00AA006D2EA4},2,0"
- * c) a Type Library name e.g. "Microsoft OLE DB ActiveX Data Objects 1.0 Library"
- * Searching for the name will be more expensive that the
- * other two, so we will do that when both other attempts
- * fail.
- */
-
- search_string = php_strtok_r(search_string, ",", &strtok_buf);
- major = php_strtok_r(NULL, ",", &strtok_buf);
- minor = php_strtok_r(NULL, ",", &strtok_buf);
-
- p = php_char_to_OLECHAR(search_string, strlen(search_string), codepage);
- /* Is the string a GUID ? */
-
- if(!FAILED(CLSIDFromString(p, &clsid)))
- {
- HRESULT hr;
- WORD major_i = 1;
- WORD minor_i = 0;
-
- /* We have a valid GUID, check to see if a major/minor */
- /* version was specified otherwise assume 1,0 */
- if((major != NULL) && (minor != NULL))
- {
- major_i = (WORD) atoi(major);
- minor_i = (WORD) atoi(minor);
- }
-
- /* The GUID will either be a typelibrary or a CLSID */
- hr = LoadRegTypeLib((REFGUID) &clsid, major_i, minor_i, LANG_NEUTRAL, &TypeLib);
-
- /* If the LoadRegTypeLib fails, let's try to instantiate */
- /* the class itself and then QI for the TypeInfo and */
- /* retrieve the type info from that interface */
- if(FAILED(hr) && (!major || !minor))
- {
- IDispatch *Dispatch;
- ITypeInfo *TypeInfo;
- int idx;
-
- if(FAILED(CoCreateInstance(&clsid, NULL, CLSCTX_SERVER, &IID_IDispatch, (LPVOID *) &Dispatch)))
- {
- efree(p);
- return NULL;
- }
- if(FAILED(Dispatch->lpVtbl->GetTypeInfo(Dispatch, 0, LANG_NEUTRAL, &TypeInfo)))
- {
- Dispatch->lpVtbl->Release(Dispatch);
- efree(p);
- return NULL;
- }
- Dispatch->lpVtbl->Release(Dispatch);
- if(FAILED(TypeInfo->lpVtbl->GetContainingTypeLib(TypeInfo, &TypeLib, &idx)))
- {
- TypeInfo->lpVtbl->Release(TypeInfo);
- efree(p);
- return NULL;
- }
- TypeInfo->lpVtbl->Release(TypeInfo);
- }
- }
- else
- {
- if(FAILED(LoadTypeLib(p, &TypeLib)))
- {
- /* Walk HKCR/TypeLib looking for the string */
- /* If that succeeds, call ourself recursively */
- /* using the CLSID found, else give up and bail */
- HKEY hkey, hsubkey;
- DWORD SubKeys, MaxSubKeyLength;
- char *keyname;
- register unsigned int ii, jj;
- DWORD VersionCount;
- char version[20]; /* All the version keys are 1.0, 4.6, ... */
- char *libname;
- DWORD libnamelen;
-
- /* No Need for Unicode version any more */
- efree(p);
-
- /* Starting at HKEY_CLASSES_ROOT/TypeLib */
- /* Walk all subkeys (Typelib GUIDs) looking */
- /* at each version for a string match to the */
- /* supplied argument */
-
- if(ERROR_SUCCESS != RegOpenKey(HKEY_CLASSES_ROOT, "TypeLib",&hkey))
- {
- /* This is pretty bad - better bail */
- return NULL;
- }
- if(ERROR_SUCCESS != RegQueryInfoKey(hkey, NULL, NULL, NULL, &SubKeys, &MaxSubKeyLength, NULL, NULL, NULL, NULL, NULL, NULL))
- {
- RegCloseKey(hkey);
- return NULL;
- }
- MaxSubKeyLength++; /* \0 is not counted */
- keyname = emalloc(MaxSubKeyLength);
- libname = emalloc(strlen(search_string)+1);
- for(ii=0;ii<SubKeys;ii++)
- {
- if(ERROR_SUCCESS != RegEnumKey(hkey, ii, keyname, MaxSubKeyLength))
- {
- /* Failed - who cares */
- continue;
- }
- if(ERROR_SUCCESS != RegOpenKey(hkey, keyname, &hsubkey))
- {
- /* Failed - who cares */
- continue;
- }
- if(ERROR_SUCCESS != RegQueryInfoKey(hsubkey, NULL, NULL, NULL, &VersionCount, NULL, NULL, NULL, NULL, NULL, NULL, NULL))
- {
- /* Failed - who cares */
- RegCloseKey(hsubkey);
- continue;
- }
- for(jj=0;jj<VersionCount;jj++)
- {
- if(ERROR_SUCCESS != RegEnumKey(hsubkey, jj, version, sizeof(version)))
- {
- /* Failed - who cares */
- continue;
- }
- /* OK we just need to retrieve the default */
- /* value for this key and see if it matches */
- libnamelen = strlen(search_string)+1;
- if(ERROR_SUCCESS == RegQueryValue(hsubkey, version, libname, &libnamelen))
- {
- if((mode & CONST_CS) ? (strcmp(libname, search_string) == 0) : (stricmp(libname, search_string) == 0))
- {
- char *str;
- int major, minor;
-
- /* Found it */
- RegCloseKey(hkey);
- RegCloseKey(hsubkey);
-
- efree(libname);
- /* We can either open up the "win32" key and find the DLL name */
- /* Or just parse the version string and pass that in */
- /* The version string seems like a more portable solution */
- /* Given that there is a COM on Unix */
- if(2 != sscanf(version, "%d.%d", &major, &minor))
- {
- major = 1;
- minor = 0;
- }
- str = emalloc(strlen(keyname)+strlen(version)+20); /* 18 == safety, 2 == extra comma and \0 */
- sprintf(str, "%s,%d,%d", keyname, major, minor);
- efree(keyname);
- TypeLib = php_COM_find_typelib(str, mode);
- efree(str);
- /* This is probbaly much harder to read and follow */
- /* But it is MUCH more effiecient than trying to */
- /* test for errors and leave through a single "return" */
- return TypeLib;
- }
- }
- else
- {
- /* Failed - perhaps too small abuffer */
- /* But if too small, then the name does not match */
- }
- }
- RegCloseKey(hsubkey);
- }
- efree(keyname);
- efree(libname);
- return NULL;
- }
- }
- efree(p);
- return TypeLib;
-}
-
-static int php_COM_load_typelib(ITypeLib *TypeLib, int mode)
-{
- ITypeComp *TypeComp;
- int i;
- int interfaces;
- ELS_FETCH();
-
- if(NULL == TypeLib)
- {
- return FAILURE;
- }
-
- interfaces = TypeLib->lpVtbl->GetTypeInfoCount(TypeLib);
-
- TypeLib->lpVtbl->GetTypeComp(TypeLib, &TypeComp);
- for(i=0; i<interfaces; i++)
- {
- TYPEKIND pTKind;
-
- TypeLib->lpVtbl->GetTypeInfoType(TypeLib, i, &pTKind);
- if(pTKind==TKIND_ENUM)
- {
- ITypeInfo *TypeInfo;
- VARDESC *pVarDesc;
- UINT NameCount;
- int j;
-#if 0
- BSTR bstr_EnumId;
- char *EnumId;
-
- TypeLib->lpVtbl->GetDocumentation(TypeLib, i, &bstr_EnumId, NULL, NULL, NULL);
- EnumId = php_OLECHAR_to_char(bstr_EnumId, NULL, 0, codepage);
- printf("Enumeration %d - %s:\n", i, EnumId);
- efree(EnumId);
-#endif
-
- TypeLib->lpVtbl->GetTypeInfo(TypeLib, i, &TypeInfo);
-
- j=0;
- while(TypeInfo->lpVtbl->GetVarDesc(TypeInfo, j, &pVarDesc)==S_OK)
- {
- BSTR bstr_ids;
- char *ids;
- zend_constant c;
- zval exists, results;
-
- TypeInfo->lpVtbl->GetNames(TypeInfo, pVarDesc->memid, &bstr_ids, 1, &NameCount);
- if(NameCount!=1)
- {
- j++;
- continue;
- }
- ids = php_OLECHAR_to_char(bstr_ids, NULL, 1, codepage);
- SysFreeString(bstr_ids);
- c.name_len = strlen(ids)+1;
- c.name = ids;
- if (zend_get_constant(c.name, c.name_len-1, &exists))
- {
- /* Oops, it already exists. No problem if it is defined as the same value */
- /* Check to see if they are the same */
- if (!compare_function(&results, &c.value, &exists))
- {
- php_error(E_WARNING,"Type library value %s is already defined and has a different value", c.name);
- }
- free(ids);
- j++;
- continue;
- }
-
- php_variant_to_pval(pVarDesc->lpvarValue, &c.value, FALSE, codepage);
- c.flags = mode;
-
- /* Before registering the contsnt, let's see if we can find it */
- {
- zend_register_constant(&c ELS_CC);
- }
- j++;
- }
- TypeInfo->lpVtbl->Release(TypeInfo);
- }
- }
-
- return SUCCESS;
-}
-
-/* {{{ proto bool com_isenum(com_module obj)
- Grabs an IEnumVariant */
-PHP_FUNCTION(com_isenum)
-{
- pval *object;
- pval **idispatch_handle;
- comval *obj;
- int type;
-
- if(ZEND_NUM_ARGS() != 1)
- {
- WRONG_PARAM_COUNT;
- }
-
- getParameters(ht, 1, &object);
-
- /* obtain IDispatch interface */
- zend_hash_index_find(object->value.obj.properties, 0, (void **) &idispatch_handle);
- obj = (comval *) zend_list_find((*idispatch_handle)->value.lval, &type);
- if(!obj || (type!=le_idispatch))
- {
- php_error(E_WARNING,"%s is not a COM object handler", "");
- RETURN_FALSE;
- }
-
- RETURN_BOOL(C_HASENUM(obj));
-}
-/* }}} */
-
-void php_register_COM_class()
-{
- INIT_OVERLOADED_CLASS_ENTRY(com_class_entry, "COM", NULL,
- php_COM_call_function_handler,
- php_COM_get_property_handler,
- php_COM_set_property_handler);
-
- zend_register_internal_class(&com_class_entry);
-}
-
-PHP_MINIT_FUNCTION(COM)
-{
- CoInitialize(NULL);
- le_idispatch = zend_register_list_destructors_ex(php_idispatch_destructor, NULL, "COM", module_number);
- php_register_COM_class();
- REGISTER_INI_ENTRIES();
- return SUCCESS;
-}
-
-PHP_MSHUTDOWN_FUNCTION(COM)
-{
- CoUninitialize();
- UNREGISTER_INI_ENTRIES();
- return SUCCESS;
-}
-
-// exports for external object creation
-
-zend_module_entry COM_module_entry = {
- "com", COM_functions, PHP_MINIT(COM), PHP_MSHUTDOWN(COM), NULL, NULL, PHP_MINFO(COM), STANDARD_MODULE_PROPERTIES
-};
-
-PHPAPI int php_COM_get_le_idispatch()
-{
- return le_idispatch;
-}
-
-#endif
diff --git a/ext/rpc/com/com_wrapper.h b/ext/rpc/com/com_wrapper.h
deleted file mode 100644
index 0679cd162b..0000000000
--- a/ext/rpc/com/com_wrapper.h
+++ /dev/null
@@ -1,43 +0,0 @@
-#ifndef COM_H
-#define COM_H
-
-#if PHP_WIN32
-
-#include "oleauto.h"
-
-typedef struct comval_ {
- BOOL typelib;
- BOOL enumeration;
- int refcount;
- struct {
- IDispatch *dispatch;
- ITypeInfo *typeinfo;
- IEnumVARIANT *enumvariant;
- } i;
-} comval;
-
-PHPAPI HRESULT php_COM_invoke(comval *obj, DISPID dispIdMember, WORD wFlags, DISPPARAMS FAR* pDispParams, VARIANT FAR* pVarResult);
-PHPAPI HRESULT php_COM_get_ids_of_names(comval *obj, OLECHAR FAR* FAR* rgszNames, DISPID FAR* rgDispId);
-PHPAPI HRESULT php_COM_release(comval *obj);
-PHPAPI HRESULT php_COM_addref(comval *obj);
-PHPAPI HRESULT php_COM_set(comval *obj, IDispatch FAR* pDisp, int cleanup);
-PHPAPI HRESULT php_COM_clone(comval *obj, comval *clone, int cleanup);
-
-#define C_HASTLIB(x) ((x)->typelib)
-#define C_HASENUM(x) ((x)->enumeration)
-#define C_ISREFD(x) ((x)->refcount)
-
-#define C_DISPATCH(x) ((x)->i.dispatch)
-#define C_TYPEINFO(x) ((x)->i.typeinfo)
-#define C_ENUMVARIANT(x) ((x)->i.enumvariant)
-
-#define C_DISPATCH_VT(x) (C_DISPATCH(x)->lpVtbl)
-#define C_TYPEINFO_VT(x) (C_TYPEINFO(x)->lpVtbl)
-#define C_ENUMVARIANT_VT(x) (C_ENUMVARIANT(x)->lpVtbl)
-
-#define C_ADDREF(x) (++((x)->refcount))
-#define C_RELEASE(x) (--((x)->refcount))
-
-#endif /* PHP_WIN32 */
-
-#endif /* COM_H */
diff --git a/ext/rpc/com/conversion.c b/ext/rpc/com/conversion.c
deleted file mode 100644
index d6eb0d286e..0000000000
--- a/ext/rpc/com/conversion.c
+++ /dev/null
@@ -1,889 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Harald Radi <h.radi@nme.at> |
- | Alan Brown <abrown@pobox.com> |
- | Paul Shortis <pshortis@dataworx.com.au> |
- +----------------------------------------------------------------------+
- */
-
-/*
- * 03.6.2001
- * Added SafeArray ==> Hash support
- */
-
-/*
- * Paul Shortis June 7, 2001 <pshortis@dataworx.com.au> - Added code to support SafeArray passing
- * to COM objects. Support includes passing arrays of variants as well
- * as typed arrays.
- */
-
-#ifdef PHP_WIN32
-
-#include "php.h"
-#include "php_COM.h"
-#include "unknwn.h"
-
-// prototypes
-
-PHPAPI void php_pval_to_variant(pval *pval_arg, VARIANT *var_arg, int codepage);
-PHPAPI void php_pval_to_variant_ex(pval *pval_arg, VARIANT *var_arg, pval *pval_type, int codepage);
-PHPAPI int php_variant_to_pval(VARIANT *var_arg, pval *pval_arg, int persistent, int codepage);
-PHPAPI OLECHAR *php_char_to_OLECHAR(char *C_str, uint strlen, int codepage);
-PHPAPI char *php_OLECHAR_to_char(OLECHAR *unicode_str, uint *out_length, int persistent, int codepage);
-
-// implementations
-
-PHPAPI void php_pval_to_variant(pval *pval_arg, VARIANT *var_arg, int codepage)
-{
- OLECHAR *unicode_str;
-
- VariantInit(var_arg);
-
- switch(Z_TYPE_P(pval_arg))
- {
- case IS_NULL:
- V_VT(var_arg) = VT_NULL;
- break;
-
- case IS_BOOL:
- V_VT(var_arg) = VT_BOOL;
- V_BOOL(var_arg) = (short) Z_LVAL_P(pval_arg);
- break;
-
- case IS_OBJECT:
- if(!strcmp(pval_arg->value.obj.ce->name, "VARIANT"))
- {
- int type;
- pval **var_handle;
-
- /* fetch the VARIANT structure */
- zend_hash_index_find(pval_arg->value.obj.properties, 0, (void **) &var_handle);
-
- V_VT(var_arg) = VT_VARIANT|VT_BYREF;
- V_VARIANTREF(var_arg) = (VARIANT FAR*) zend_list_find(Z_LVAL_P(*var_handle), &type);
- }
- else if(!strcmp(pval_arg->value.obj.ce->name, "COM"))
- {
- pval **idispatch_handle;
- comval *obj;
- int type;
-
- /* fetch the IDispatch interface */
- zend_hash_index_find(pval_arg->value.obj.properties, 0, (void **) &idispatch_handle);
- obj = (comval *)zend_list_find(Z_LVAL_P(*idispatch_handle), &type);
- if(!obj || (type != php_COM_get_le_idispatch()) || !C_ISREFD(obj))
- {
- VariantInit(var_arg);
- }
- else
- {
- V_VT(var_arg) = VT_DISPATCH;
- V_DISPATCH(var_arg) = C_DISPATCH(obj);
- }
- }
- else
- {
- VariantInit(var_arg);
- }
- break;
-
- case IS_ARRAY:
- {
- /* For now we'll just handle single dimension arrays, we'll use the data type of the first element for the
- output data type */
- HashTable *ht = Z_ARRVAL(*pval_arg);
- int numberOfElements = zend_hash_num_elements(ht);
- SAFEARRAY *safeArray;
- SAFEARRAYBOUND bounds[1];
- VARIANT *v;
- zval **entry; /* An entry in the input array */
-
- VariantInit(var_arg);
-
- if(pval_arg->is_ref)
- {
- V_VT(var_arg) = VT_VARIANT|VT_BYREF; /* Create a VARIANT to reference */
- V_VARIANTREF(var_arg) = emalloc(sizeof(VARIANT));
- var_arg = V_VARIANTREF(var_arg); /* & put the array in that VARIANT */
- }
-
- bounds[0].lLbound = 0;
- bounds[0].cElements = numberOfElements;
- V_VT(var_arg) = VT_EMPTY; /* until array is created */
- safeArray = SafeArrayCreate(VT_VARIANT, 1, bounds);
-
- if(NULL == safeArray)
- {
- php_error( E_WARNING,"Unable to convert php array to VARIANT array - %s", numberOfElements ? "" : "(Empty input array)");
- var_reset(pval_arg);
- }
- else
- {
- V_ARRAY(var_arg) = safeArray;
- V_VT(var_arg) = VT_ARRAY|VT_VARIANT; /* Now have a valid safe array allocated */
- if(SUCCEEDED(SafeArrayLock( safeArray)))
- {
- ulong i;
-
- zend_hash_internal_pointer_reset(ht);
- for( i = 0; i < (ulong)numberOfElements; ++i)
- {
- if((zend_hash_get_current_data(ht, (void **)&entry) == SUCCESS) && (entry != NULL)) /* Get a pointer to the php array element */
- {
- /* Add another value to the safe array */
- if(SUCCEEDED(SafeArrayPtrOfIndex( safeArray, &i, &v)))/* Pointer to output element entry retrieved successfully */
- {
- php_pval_to_variant(*entry, v, codepage); /* Do the required conversion */
- }
- else
- {
- php_error( E_WARNING,"phpArrayToSafeArray() - Unable to retrieve pointer to output element number (%d)", i);
- }
- }
- zend_hash_move_forward(ht);
- }
- SafeArrayUnlock( safeArray);
- }
- else
- {
- php_error( E_WARNING,"phpArrayToSafeArray() - Unable to lock safeArray");
- }
- }
- }
- break;
-
- case IS_RESOURCE:
- case IS_CONSTANT:
- case IS_CONSTANT_ARRAY:
- VariantInit(var_arg);
- break;
-
- case IS_LONG:
- V_VT(var_arg) = VT_I4; /* assuming 32-bit platform */
- V_I4(var_arg) = Z_LVAL_P(pval_arg);
- break;
-
- case IS_DOUBLE:
- V_VT(var_arg) = VT_R8; /* assuming 64-bit double precision */
- V_R8(var_arg) = Z_DVAL_P(pval_arg);
- break;
-
- case IS_STRING:
- V_VT(var_arg) = VT_BSTR;
- unicode_str = php_char_to_OLECHAR(Z_STRVAL_P(pval_arg), Z_STRLEN_P(pval_arg), codepage);
- V_BSTR(var_arg) = SysAllocString(unicode_str);
- efree(unicode_str);
- }
-}
-
-PHPAPI void php_pval_to_variant_ex(pval *pval_arg, VARIANT *var_arg, pval *pval_type, int codepage)
-{
- OLECHAR *unicode_str;
-
- V_VT(var_arg) = (short)Z_LVAL_P(pval_type);
-
- switch(V_VT(var_arg))
- {
- case VT_UI1:
- convert_to_long_ex(&pval_arg);
- V_UI1(var_arg) = (unsigned char)Z_LVAL_P(pval_arg);
- break;
-
- case VT_I2:
- convert_to_long_ex(&pval_arg);
- V_I2(var_arg) = (short)Z_LVAL_P(pval_arg);
- break;
-
- case VT_I4:
- convert_to_long_ex(&pval_arg);
- V_I4(var_arg) = Z_LVAL_P(pval_arg);
- break;
-
- case VT_R4:
- convert_to_double_ex(&pval_arg);
- V_R4(var_arg) = (float)Z_DVAL_P(pval_arg);
- break;
-
- case VT_R8:
- convert_to_double_ex(&pval_arg);
- V_R8(var_arg) = Z_DVAL_P(pval_arg);
- break;
-
- case VT_BOOL:
- convert_to_boolean_ex(&pval_arg);
- V_BOOL(var_arg) = (short)Z_LVAL_P(pval_arg);
- break;
-
- case VT_ERROR:
- convert_to_long_ex(&pval_arg);
- V_ERROR(var_arg) = Z_LVAL_P(pval_arg);
- break;
-
- case VT_CY:
- convert_to_double_ex(&pval_arg);
- VarCyFromR8(Z_DVAL_P(pval_arg), &V_CY(var_arg));
- break;
-
- case VT_DATE:
- {
- SYSTEMTIME wintime;
- struct tm *phptime;
-
- phptime = gmtime(&(pval_arg->value.lval));
-
- wintime.wYear = phptime->tm_year + 1900;
- wintime.wMonth = phptime->tm_mon + 1;
- wintime.wDay = phptime->tm_mday;
- wintime.wHour = phptime->tm_hour;
- wintime.wMinute = phptime->tm_min;
- wintime.wSecond = phptime->tm_sec;
-
- SystemTimeToVariantTime(&wintime, &V_DATE(var_arg));
- }
-
- case VT_BSTR:
- convert_to_string_ex(&pval_arg);
- unicode_str = php_char_to_OLECHAR(Z_STRVAL_P(pval_arg), Z_STRLEN_P(pval_arg), codepage);
- V_BSTR(var_arg) = SysAllocString(unicode_str);
- efree(unicode_str);
- break;
-
- case VT_DECIMAL:
- convert_to_string_ex(&pval_arg);
- unicode_str = php_char_to_OLECHAR(Z_STRVAL_P(pval_arg), Z_STRLEN_P(pval_arg), codepage);
- VarDecFromStr(unicode_str, LOCALE_SYSTEM_DEFAULT, 0, &V_DECIMAL(var_arg));
- break;
-
- case VT_DECIMAL|VT_BYREF:
- convert_to_string_ex(&pval_arg);
- unicode_str = php_char_to_OLECHAR(Z_STRVAL_P(pval_arg), Z_STRLEN_P(pval_arg), codepage);
- VarDecFromStr(unicode_str, LOCALE_SYSTEM_DEFAULT, 0, V_DECIMALREF(var_arg));
- break;
-
- case VT_UNKNOWN:
- php_pval_to_variant(pval_arg, var_arg, codepage);
- if(V_VT(var_arg) != VT_DISPATCH)
- {
- VariantInit(var_arg);
- }
- else
- {
- V_VT(var_arg) = VT_UNKNOWN;
- V_UNKNOWN(var_arg) = (IUnknown *) V_DISPATCH(var_arg);
- }
- break;
-
- case VT_DISPATCH:
- php_pval_to_variant(pval_arg, var_arg, codepage);
- if(V_VT(var_arg) != VT_DISPATCH)
- {
- VariantInit(var_arg);
- }
- break;
-
- case VT_UI1|VT_BYREF:
- convert_to_long(pval_arg);
- V_UI1REF(var_arg) = (unsigned char FAR*) &Z_LVAL_P(pval_arg);
- break;
-
- case VT_I2|VT_BYREF:
- convert_to_long(pval_arg);
- V_I2REF(var_arg) = (short FAR*) &Z_LVAL_P(pval_arg);
- break;
-
- case VT_I4|VT_BYREF:
- convert_to_long(pval_arg);
- V_I4REF(var_arg) = (long FAR*) &Z_LVAL_P(pval_arg);
- break;
-
- case VT_R4|VT_BYREF:
- convert_to_double(pval_arg);
- V_R4REF(var_arg) = (float FAR*) &Z_LVAL_P(pval_arg);
- break;
-
- case VT_R8|VT_BYREF:
- convert_to_double(pval_arg);
- V_R8REF(var_arg) = (double FAR*) &Z_LVAL_P(pval_arg);
- break;
-
- case VT_BOOL|VT_BYREF:
- convert_to_boolean(pval_arg);
- V_BOOLREF(var_arg) = (short FAR*) &Z_LVAL_P(pval_arg);
- break;
-
- case VT_ERROR|VT_BYREF:
- convert_to_long(pval_arg);
- V_ERRORREF(var_arg) = (long FAR*) &Z_LVAL_P(pval_arg);
- break;
-
- case VT_CY|VT_BYREF:
- convert_to_double_ex(&pval_arg);
- VarCyFromR8(pval_arg->value.dval, var_arg->pcyVal);
- break;
-
- case VT_DATE|VT_BYREF:
- {
- SYSTEMTIME wintime;
- struct tm *phptime;
-
- phptime = gmtime(&(pval_arg->value.lval));
-
- wintime.wYear = phptime->tm_year + 1900;
- wintime.wMonth = phptime->tm_mon + 1;
- wintime.wDay = phptime->tm_mday;
- wintime.wHour = phptime->tm_hour;
- wintime.wMinute = phptime->tm_min;
- wintime.wSecond = phptime->tm_sec;
-
- SystemTimeToVariantTime(&wintime, var_arg->pdate);
- }
-
- case VT_BSTR|VT_BYREF:
- convert_to_string(pval_arg);
- V_BSTRREF(var_arg) = (BSTR FAR*) emalloc(sizeof(BSTR FAR*));
- unicode_str = php_char_to_OLECHAR(Z_STRVAL_P(pval_arg), Z_STRLEN_P(pval_arg), codepage);
- *V_BSTRREF(var_arg) = SysAllocString(unicode_str);
- efree(unicode_str);
- break;
-
- case VT_UNKNOWN|VT_BYREF:
- php_pval_to_variant(pval_arg, var_arg, codepage);
- if(V_VT(var_arg) != VT_DISPATCH)
- {
- VariantInit(var_arg);
- }
- else
- {
- V_VT(var_arg) = VT_UNKNOWN|VT_BYREF;
- *V_UNKNOWNREF(var_arg) = (IUnknown *) *V_DISPATCHREF(var_arg);
- }
- break;
-
- case VT_DISPATCH|VT_BYREF:
- php_pval_to_variant(pval_arg, var_arg, codepage);
- if(V_VT(var_arg) != VT_DISPATCH)
- {
- VariantInit(var_arg);
- }
- else
- {
- V_VT(var_arg) |= VT_BYREF;
- }
- break;
-
- case VT_VARIANT|VT_BYREF:
- php_pval_to_variant(pval_arg, var_arg, codepage);
- if(V_VT(var_arg) != (VT_VARIANT|VT_BYREF)) /* TODO: i don't believe that this works */
- {
- VariantInit(var_arg);
- }
- break;
-
- case VT_I1:
- convert_to_long_ex(&pval_arg);
- V_I1(var_arg) = (char)Z_LVAL_P(pval_arg);
- break;
-
- case VT_UI2:
- convert_to_long_ex(&pval_arg);
- V_UI2(var_arg) = (unsigned short)Z_LVAL_P(pval_arg);
- break;
-
- case VT_UI4:
- convert_to_long_ex(&pval_arg);
- V_UI4(var_arg) = (unsigned long)Z_LVAL_P(pval_arg);
- break;
-
- case VT_INT:
- convert_to_long_ex(&pval_arg);
- V_INT(var_arg) = (int)Z_LVAL_P(pval_arg);
- break;
-
- case VT_UINT:
- convert_to_long_ex(&pval_arg);
- V_UINT(var_arg) = (unsigned int)Z_LVAL_P(pval_arg);
- break;
-
- case VT_I1|VT_BYREF:
- convert_to_long(pval_arg);
- V_I1REF(var_arg) = (char FAR*) &Z_LVAL_P(pval_arg);
- break;
-
- case VT_UI2|VT_BYREF:
- convert_to_long(pval_arg);
- V_UI2REF(var_arg) = (unsigned short FAR*) &Z_LVAL_P(pval_arg);
- break;
-
- case VT_UI4|VT_BYREF:
- convert_to_long(pval_arg);
- V_UI4REF(var_arg) = (unsigned long FAR*) &Z_LVAL_P(pval_arg);
- break;
-
- case VT_INT|VT_BYREF:
- convert_to_long(pval_arg);
- V_INTREF(var_arg) = (int FAR*) &Z_LVAL_P(pval_arg);
- break;
-
- case VT_UINT|VT_BYREF:
- convert_to_long(pval_arg);
- V_UINTREF(var_arg) = (unsigned int FAR*) &Z_LVAL_P(pval_arg);
- break;
-
- default:
- php_error(E_WARNING, "Type not supportet or not yet implemented.");
- }
-}
-
-PHPAPI int php_variant_to_pval(VARIANT *var_arg, pval *pval_arg, int persistent, int codepage)
-{
- /* Changed the function to return a value for recursive error testing */
- /* Existing calls will be unaffected by the change - so it */
- /* seemed like the smallest impact on unfamiliar code */
- int ret = SUCCESS;
-
- INIT_PZVAL(pval_arg);
-
- /* Add SafeArray support */
- if (V_ISARRAY(var_arg))
- {
- SAFEARRAY *array = V_ARRAY(var_arg);
- LONG indices[1];
- LONG lbound=0, ubound;
- VARTYPE vartype;
- register int ii;
- UINT Dims;
- VARIANT vv;
- pval *element;
- HRESULT hr;
-
- /* TODO: Add support for multi-dimensional SafeArrays */
- /* For now just validate that the SafeArray has one dimension */
- if (1 != (Dims = SafeArrayGetDim(array)))
- {
- php_error(E_WARNING,"Unsupported: multi-dimensional (%d) SafeArrays", Dims);
- var_reset(pval_arg);
- return FAILURE;
- }
- SafeArrayLock( array);
-
- /* This call has failed for everything I have tried */
- /* But best leave it to be on the safe side */
- if (FAILED(SafeArrayGetVartype(array, &vartype)))
- {
- /* Fall back to what we do know */
- /* Mask off the array bit and assume */
- /* what is left is the type of the array */
- /* elements */
- vartype = V_VT(var_arg) & ~VT_ARRAY;
- }
- SafeArrayGetUBound(array, 1, &ubound);
- SafeArrayGetLBound(array, 1, &lbound);
-
- /* Since COM returned an array we set up the php */
- /* return value to be an array */
- array_init(pval_arg);
-
- /* Walk the safe array */
- for (ii=lbound;ii<=ubound;ii++)
- {
- indices[0] = ii;
- VariantInit(&vv); /* Docs say this just set the vt field, but you never know */
- /* Set up a variant to pass to a recursive call */
- /* So that we do not need to have two copies */
- /* of the code */
- if (VT_VARIANT == vartype)
- {
- hr = SafeArrayGetElement(array, indices, (VOID *) &(vv));
- }
- else
- {
- V_VT(&vv) = vartype;
- hr = SafeArrayGetElement(array, indices, (VOID *) &(vv.lVal));
- }
- if (FAILED(hr))
- {
- /* Failure to retieve an element probably means the array is sparse */
- /* So leave the php array sparse too */
- continue;
- }
- /* Create an element to be added to the array */
- ALLOC_ZVAL(element);
- /* Call ourself again to handle the base type conversion */
- /* If SafeArrayGetElement proclaims to allocate */
- /* memory for a BSTR, so the recursive call frees */
- /* the string correctly */
- if (FAILURE == php_variant_to_pval(&vv, element, persistent, codepage))
- {
- /* Error occurred setting up array element */
- /* Error was displayed by the recursive call */
- FREE_ZVAL(element);
- /* TODO: Do we stop here, or go on and */
- /* try to make sense of the rest of the array */
- /* Going on leads to multiple errors displayed */
- /* for the same conversion. For large arrays that */
- /* could be very annoying */
- /* And if we don't go on - what to do about */
- /* the parts of the array that are OK? */
- /* break; */
- }
- else
- {
- /* Just insert the element into our return array */
- add_index_zval(pval_arg, ii, element);
- }
- }
- SafeArrayUnlock(array);
- /* Clean up the SafeArray since that is our responsibility */
- SafeArrayDestroyData(array);
- SafeArrayDestroyDescriptor(array);
- }
- else switch(var_arg->vt & ~VT_BYREF)
- {
- case VT_EMPTY:
- var_uninit(pval_arg);
- break;
-
- case VT_UI1:
- if(V_ISBYREF(var_arg))
- {
- ZVAL_LONG(pval_arg, (long)*V_UI4REF(var_arg));
- }
- else
- {
- ZVAL_LONG(pval_arg, (long)V_UI4(var_arg));
- }
- break;
-
- case VT_I2:
- if(V_ISBYREF(var_arg))
- {
- ZVAL_LONG(pval_arg, (long )*V_I2REF(var_arg));
- }
- else
- {
- ZVAL_LONG(pval_arg, (long)V_I2(var_arg));
- }
- break;
-
- case VT_I4:
- if(V_ISBYREF(var_arg))
- {
- ZVAL_LONG(pval_arg, *V_I4REF(var_arg));
- }
- else
- {
- ZVAL_LONG(pval_arg, V_I4(var_arg));
- }
- break;
-
- case VT_R4:
- if(V_ISBYREF(var_arg))
- {
- ZVAL_DOUBLE(pval_arg, (double)*V_R4REF(var_arg));
- }
- else
- {
- ZVAL_DOUBLE(pval_arg, (double)V_R4(var_arg));
- }
- break;
-
- case VT_R8:
- if(V_ISBYREF(var_arg))
- {
- ZVAL_DOUBLE(pval_arg, *V_R8REF(var_arg));
- }
- else
- {
- ZVAL_DOUBLE(pval_arg, V_R8(var_arg));
- }
- break;
-
- /* 96bit uint */
- case VT_DECIMAL:
- {
- OLECHAR *unicode_str;
- switch(VarBstrFromDec(&V_DECIMAL(var_arg), LOCALE_SYSTEM_DEFAULT, 0, &unicode_str))
- {
- case S_OK:
- Z_STRVAL_P(pval_arg) = php_OLECHAR_to_char(unicode_str, &Z_STRLEN_P(pval_arg), persistent, codepage);
- Z_TYPE_P(pval_arg) = IS_STRING;
- break;
-
- default:
- ZVAL_NULL(pval_arg);
- ret = FAILURE;
- php_error(E_WARNING, "Error converting DECIMAL value to PHP string");
- break;
- }
- }
- break;
-
- /* Currency */
- case VT_CY:
- if(V_ISBYREF(var_arg))
- {
- VarR8FromCy(*V_CYREF(var_arg), &Z_DVAL_P(pval_arg));
- }
- else
- {
- VarR8FromCy(V_CY(var_arg), &Z_DVAL_P(pval_arg));
- }
- Z_TYPE_P(pval_arg) = IS_DOUBLE;
- break;
-
- case VT_BOOL:
- if(V_ISBYREF(var_arg))
- {
- ZVAL_BOOL(pval_arg, *V_BOOLREF(var_arg));
- }
- else
- {
- ZVAL_BOOL(pval_arg, V_BOOL(var_arg));
- }
- break;
-
- case VT_NULL:
- case VT_VOID:
- ZVAL_NULL(pval_arg);
- break;
-
- case VT_VARIANT:
- php_variant_to_pval(V_VARIANTREF(var_arg), pval_arg, persistent, codepage);
- break;
-
- case VT_BSTR:
- if(V_ISBYREF(var_arg))
- {
- Z_STRVAL_P(pval_arg) = php_OLECHAR_to_char(*V_BSTRREF(var_arg), &Z_STRLEN_P(pval_arg), persistent, codepage);
- SysFreeString(*V_BSTRREF(var_arg));
- efree(V_BSTRREF(var_arg));
- }
- else
- {
- Z_STRVAL_P(pval_arg) = php_OLECHAR_to_char(V_BSTR(var_arg), &Z_STRLEN_P(pval_arg), persistent, codepage);
- SysFreeString(V_BSTR(var_arg));
- }
-
- Z_TYPE_P(pval_arg) = IS_STRING;
- break;
-
- case VT_DATE:
- {
- SYSTEMTIME wintime;
- struct tm phptime;
-
- if(V_ISBYREF(var_arg))
- {
- VariantTimeToSystemTime(*V_DATEREF(var_arg), &wintime);
- }
- else
- {
- VariantTimeToSystemTime(V_DATE(var_arg), &wintime);
- }
-
- phptime.tm_year = wintime.wYear - 1900;
- phptime.tm_mon = wintime.wMonth - 1;
- phptime.tm_mday = wintime.wDay;
- phptime.tm_hour = wintime.wHour;
- phptime.tm_min = wintime.wMinute;
- phptime.tm_sec = wintime.wSecond;
- phptime.tm_isdst = -1;
-
- tzset();
- ZVAL_LONG(pval_arg, mktime(&phptime));
- }
- break;
-
- case VT_UNKNOWN:
- if(V_UNKNOWN(var_arg) == NULL)
- {
- V_DISPATCH(var_arg) = NULL;
- }
- else
- {
- HRESULT hr;
-
- hr = V_UNKNOWN(var_arg)->lpVtbl->QueryInterface(var_arg->punkVal, &IID_IDispatch, &V_DISPATCH(var_arg));
-
- if(FAILED(hr))
- {
- char *error_message;
-
- error_message = php_COM_error_message(hr);
- php_error(E_WARNING,"Unable to obtain IDispatch interface: %s", error_message);
- LocalFree(error_message);
-
- V_DISPATCH(var_arg) = NULL;
- }
- }
- /* break missing intentionaly */
- case VT_DISPATCH:
- {
- pval *handle;
- comval *obj;
-
- if(V_DISPATCH(var_arg) == NULL)
- {
- ret = FAILURE;
- ZVAL_NULL(pval_arg);
- }
- else
- {
- obj = emalloc(sizeof(comval));
- php_COM_set(obj, V_DISPATCH(var_arg), TRUE);
-
- Z_TYPE_P(pval_arg) = IS_OBJECT;
- pval_arg->value.obj.ce = &com_class_entry;
- ALLOC_HASHTABLE(pval_arg->value.obj.properties);
- zend_hash_init(pval_arg->value.obj.properties, 0, NULL, ZVAL_PTR_DTOR, 0);
-
- ALLOC_ZVAL(handle);
- INIT_PZVAL(handle);
- ZVAL_LONG(handle, zend_list_insert(obj, php_COM_get_le_idispatch()));
-
- pval_copy_constructor(handle);
- zend_hash_index_update(pval_arg->value.obj.properties, 0, &handle, sizeof(pval *), NULL);
- }
- }
- break;
-
- case VT_I1:
- if(V_ISBYREF(var_arg))
- {
- ZVAL_LONG(pval_arg, (long)*V_I1REF(var_arg));
- }
- else
- {
- ZVAL_LONG(pval_arg, (long)V_I1(var_arg));
- }
- break;
-
- case VT_UI2:
- if(V_ISBYREF(var_arg))
- {
- ZVAL_LONG(pval_arg, (long)*V_UI2REF(var_arg));
- }
- else
- {
- ZVAL_LONG(pval_arg, (long)V_UI2(var_arg));
- }
- break;
-
- case VT_UI4:
- if(V_ISBYREF(var_arg))
- {
- ZVAL_LONG(pval_arg, (long)*V_UI4REF(var_arg));
- }
- else
- {
- ZVAL_LONG(pval_arg, (long)V_UI4(var_arg));
- }
- break;
-
- case VT_INT:
- if(V_ISBYREF(var_arg))
- {
- ZVAL_LONG(pval_arg, (long)*V_INTREF(var_arg));
- }
- else
- {
- ZVAL_LONG(pval_arg, (long)V_INT(var_arg));
- }
- break;
-
- case VT_UINT:
- if(V_ISBYREF(var_arg))
- {
- ZVAL_LONG(pval_arg, (long)*V_UINTREF(var_arg));
- }
- else
- {
- ZVAL_LONG(pval_arg, (long)V_UINT(var_arg));
- }
- break;
-
- default:
- php_error(E_WARNING,"Unsupported variant type: %d (0x%X)", V_VT(var_arg), V_VT(var_arg));
- ZVAL_NULL(pval_arg);
- ret = FAILURE;
- break;
- }
- return ret;
-}
-
-PHPAPI OLECHAR *php_char_to_OLECHAR(char *C_str, uint strlen, int codepage)
-{
- OLECHAR *unicode_str;
-
- //request needed buffersize
- uint reqSize = MultiByteToWideChar(codepage, MB_PRECOMPOSED | MB_ERR_INVALID_CHARS, C_str, -1, NULL, 0);
-
- if(reqSize)
- {
- unicode_str = (OLECHAR *) emalloc(sizeof(OLECHAR) * reqSize);
-
- //convert string
- MultiByteToWideChar(codepage, MB_PRECOMPOSED | MB_ERR_INVALID_CHARS, C_str, -1, unicode_str, reqSize);
- }
- else
- {
- unicode_str = (OLECHAR *) emalloc(sizeof(OLECHAR));
- *unicode_str = 0;
-
- switch(GetLastError())
- {
- case ERROR_NO_UNICODE_TRANSLATION:
- php_error(E_WARNING,"No unicode translation available for the specified string");
- break;
- default:
- php_error(E_WARNING,"Error in php_char_to_OLECHAR()");
- }
- }
-
- return unicode_str;
-}
-
-PHPAPI char *php_OLECHAR_to_char(OLECHAR *unicode_str, uint *out_length, int persistent, int codepage)
-{
- char *C_str;
- uint length = 0;
-
- //request needed buffersize
- uint reqSize = WideCharToMultiByte(codepage, WC_COMPOSITECHECK, unicode_str, -1, NULL, 0, NULL, NULL);
-
- if(reqSize)
- {
- C_str = (char *) pemalloc(sizeof(char) * reqSize, persistent);
-
- //convert string
- length = WideCharToMultiByte(codepage, WC_COMPOSITECHECK, unicode_str, -1, C_str, reqSize, NULL, NULL) - 1;
- }
- else
- {
- C_str = (char *) pemalloc(sizeof(char), persistent);
- *C_str = 0;
-
- php_error(E_WARNING,"Error in php_OLECHAR_to_char()");
- }
-
- if(out_length)
- {
- *out_length = length;
- }
-
- return C_str;
-}
-
-#endif /* PHP_WIN32 */
diff --git a/ext/rpc/com/conversion.h b/ext/rpc/com/conversion.h
deleted file mode 100644
index 53d19a21de..0000000000
--- a/ext/rpc/com/conversion.h
+++ /dev/null
@@ -1,14 +0,0 @@
-#ifndef CONVERSION_H
-#define CONVERSION_H
-
-BEGIN_EXTERN_C()
-
-extern void php_pval_to_variant(pval *pval_arg, VARIANT *var_arg, int codepage);
-extern void php_pval_to_variant_ex(pval *pval_arg, VARIANT *var_arg, pval *pval_type, int codepage);
-extern int php_variant_to_pval(VARIANT *var_arg, pval *pval_arg, int persistent, int codepage);
-extern OLECHAR *php_char_to_OLECHAR(char *C_str, uint strlen, int codepage);
-extern char *php_OLECHAR_to_char(OLECHAR *unicode_str, uint *out_length, int persistent, int codepage);
-
-END_EXTERN_C()
-
-#endif \ No newline at end of file
diff --git a/ext/rpc/com/php_com.h b/ext/rpc/com/php_com.h
deleted file mode 100644
index 5a3d1a01bb..0000000000
--- a/ext/rpc/com/php_com.h
+++ /dev/null
@@ -1,33 +0,0 @@
-#ifndef PHP_COM_H
-#define PHP_COM_H
-
-#if PHP_WIN32
-
-BEGIN_EXTERN_C()
-
-#include "com.h"
-
-extern PHP_MINIT_FUNCTION(COM);
-extern PHP_MSHUTDOWN_FUNCTION(COM);
-
-extern int php_COM_get_le_idispatch();
-
-extern zend_module_entry COM_module_entry;
-extern zend_class_entry com_class_entry;
-
-extern pval php_COM_get_property_handler(zend_property_reference *property_reference);
-extern int php_COM_set_property_handler(zend_property_reference *property_reference, pval *value);
-extern char *php_COM_error_message(HRESULT hr);
-extern void php_COM_call_function_handler(INTERNAL_FUNCTION_PARAMETERS, zend_property_reference *property_reference);
-
-END_EXTERN_C()
-
-#define COM_module_ptr &COM_module_entry
-
-#else
-
-#define COM_module_ptr NULL
-
-#endif /* PHP_WIN32 */
-
-#endif /* PHP_COM_H */
diff --git a/ext/rpc/com/php_variant.h b/ext/rpc/com/php_variant.h
deleted file mode 100644
index 0382b88a64..0000000000
--- a/ext/rpc/com/php_variant.h
+++ /dev/null
@@ -1,21 +0,0 @@
-#ifndef PHP_TYPEDEF_VARIANT_H
-#define PHP_TYPEDEF_VARIANT_H
-
-#if PHP_WIN32
-
-extern PHP_MINIT_FUNCTION(VARIANT);
-extern PHP_MSHUTDOWN_FUNCTION(VARIANT);
-
-extern zend_module_entry VARIANT_module_entry;
-
-#define VARIANT_module_ptr &VARIANT_module_entry
-
-#else
-
-#define VARIANT_module_ptr NULL
-
-#endif /* PHP_WIN32 */
-
-#define phpext_VARIANT_ptr VARIANT_module_ptr
-
-#endif /* PHP_TYPEDEF_VARIANT_H */
diff --git a/ext/rpc/com/variant.c b/ext/rpc/com/variant.c
deleted file mode 100644
index 0b64388c7f..0000000000
--- a/ext/rpc/com/variant.c
+++ /dev/null
@@ -1,432 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Harald Radi <h.radi@nme.at> |
- +----------------------------------------------------------------------+
- */
-
-
-/*
- * This module maps the VARIANT datastructure into PHP so that it can be used to
- * pass values to COM and DOTNET Objects by reference and not only by value.
- *
- * harald
- */
-
-#ifdef PHP_WIN32
-
-#include "php.h"
-#include "php_ini.h"
-#include "php_VARIANT.h"
-#include "conversion.h"
-#include "ext/standard/info.h"
-
-#include <unknwn.h>
-
-void php_VARIANT_call_function_handler(INTERNAL_FUNCTION_PARAMETERS, zend_property_reference *property_reference);
-pval php_VARIANT_get_property_handler(zend_property_reference *property_reference);
-static int do_VARIANT_propset(VARIANT *var_arg, pval *arg_property, pval *value);
-void php_register_VARIANT_class();
-static void php_variant_destructor(zend_rsrc_list_entry *rsrc);
-void php_register_VARIANT_class();
-
-static int le_variant;
-static int codepage;
-
-static zend_class_entry VARIANT_class_entry;
-
-function_entry VARIANT_functions[] = {
- {NULL, NULL, NULL}
-};
-
-static PHP_MINFO_FUNCTION(VARIANT)
-{
- php_info_print_table_start();
- php_info_print_table_row(2, "VARIANT support", "enabled");
- php_info_print_table_end();
-}
-
-zend_module_entry VARIANT_module_entry = {
- "variant", VARIANT_functions, PHP_MINIT(VARIANT), PHP_MSHUTDOWN(VARIANT), NULL, NULL, PHP_MINFO(VARIANT), STANDARD_MODULE_PROPERTIES
-};
-
-PHP_MINIT_FUNCTION(VARIANT)
-{
- le_variant = zend_register_list_destructors_ex(php_variant_destructor, NULL, "VARIANT", module_number);
-
- /* variant datatypes */
- REGISTER_LONG_CONSTANT("VT_NULL", VT_NULL, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("VT_EMPTY", VT_EMPTY, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("VT_UI1", VT_UI1, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("VT_I2", VT_I2, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("VT_I4", VT_I4, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("VT_R4", VT_R4, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("VT_R8", VT_R8, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("VT_BOOL", VT_BOOL, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("VT_ERROR", VT_ERROR, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("VT_CY", VT_CY, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("VT_DATE", VT_CY, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("VT_BSTR", VT_BSTR, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("VT_DECIMAL", VT_DECIMAL, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("VT_UNKNOWN", VT_UNKNOWN, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("VT_DISPATCH", VT_DISPATCH, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("VT_VARIANT", VT_VARIANT, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("VT_I1", VT_I1, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("VT_UI2", VT_UI2, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("VT_UI4", VT_UI4, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("VT_INT", VT_INT, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("VT_UINT", VT_UINT, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("VT_ARRAY", VT_ARRAY, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("VT_BYREF", VT_BYREF, CONST_CS | CONST_PERSISTENT);
-
- /* codepages */
- REGISTER_LONG_CONSTANT("CP_ACP", CP_ACP, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("CP_MACCP", CP_MACCP, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("CP_OEMCP", CP_OEMCP, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("CP_SYMBOL", CP_SYMBOL, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("CP_THREAD_ACP", CP_THREAD_ACP, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("CP_UTF7", CP_UTF7, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("CP_UTF8", CP_UTF8, CONST_CS | CONST_PERSISTENT);
-
- php_register_VARIANT_class();
- return SUCCESS;
-}
-
-PHP_MSHUTDOWN_FUNCTION(VARIANT)
-{
- return SUCCESS;
-}
-
-void php_VARIANT_call_function_handler(INTERNAL_FUNCTION_PARAMETERS, zend_property_reference *property_reference)
-{
- pval *object = property_reference->object;
- zend_overloaded_element *function_name = (zend_overloaded_element *) property_reference->elements_list->tail->data;
- VARIANT *pVar;
-
- if((zend_llist_count(property_reference->elements_list)==1) && !strcmp(function_name->element.value.str.val, "variant"))
- {
- /* constructor */
- pval *object_handle, *data, *type, *code_page;
-
- pVar = emalloc(sizeof(VARIANT));
- VariantInit(pVar);
-
- switch(ZEND_NUM_ARGS())
- {
- case 0:
- /* nothing to do */
- break;
- case 1:
- getParameters(ht, 1, &data);
- php_pval_to_variant(data, pVar, codepage);
- codepage = CP_ACP;
- break;
- case 2:
- getParameters(ht, 2, &data, &type);
- php_pval_to_variant_ex(data, pVar, type, codepage);
- codepage = CP_ACP;
- break;
- case 3:
- getParameters(ht, 3, &data, &type, &code_page);
- php_pval_to_variant_ex(data, pVar, type, codepage);
- convert_to_long(code_page);
- codepage = code_page->value.lval;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- return_value->type = IS_LONG;
- return_value->value.lval = zend_list_insert(pVar, le_variant);
-
- if(!zend_is_true(return_value))
- {
- var_reset(object);
- return;
- }
-
- ALLOC_ZVAL(object_handle);
- *object_handle = *return_value;
- pval_copy_constructor(object_handle);
- INIT_PZVAL(object_handle);
- zend_hash_index_update(object->value.obj.properties, 0, &object_handle, sizeof(pval *), NULL);
- pval_destructor(&function_name->element);
- }
-}
-
-
-pval php_VARIANT_get_property_handler(zend_property_reference *property_reference)
-{
- zend_overloaded_element *overloaded_property;
- int type;
-
- pval result, **var_handle, *object = property_reference->object;
- VARIANT *var_arg;
-
- /* fetch the VARIANT structure */
- zend_hash_index_find(object->value.obj.properties, 0, (void **) &var_handle);
- var_arg = zend_list_find((*var_handle)->value.lval, &type);
-
- if(!var_arg || (type != le_variant))
- {
- var_reset(&result);
- }
- else
- {
- overloaded_property = (zend_overloaded_element *) property_reference->elements_list->head->data;
- switch(overloaded_property->type)
- {
- case OE_IS_ARRAY:
- var_reset(&result);
- break;
-
- case OE_IS_OBJECT:
- if(!strcmp(overloaded_property->element.value.str.val, "value"))
- {
- php_variant_to_pval(var_arg, &result, 0, codepage);
- }
- else if(!strcmp(overloaded_property->element.value.str.val, "type"))
- {
- result.value.lval = var_arg->vt;
- result.type = IS_LONG;
- }
- else
- {
- var_reset(&result);
- php_error(E_WARNING, "Unknown member.");
- }
- break;
- case OE_IS_METHOD:
- var_reset(&result);
- php_error(E_WARNING, "Unknown method.");
- break;
-
- pval_destructor(&overloaded_property->element);
- }
- }
-
- return result;
-}
-
-int php_VARIANT_set_property_handler(zend_property_reference *property_reference, pval *value)
-{
- zend_overloaded_element *overloaded_property;
- int type;
-
- pval **var_handle, *object = property_reference->object;
- VARIANT *var_arg;
-
- /* fetch the VARIANT structure */
- zend_hash_index_find(object->value.obj.properties, 0, (void **) &var_handle);
- var_arg = zend_list_find((*var_handle)->value.lval, &type);
-
- if(!var_arg || (type != le_variant))
- return FAILURE;
-
- overloaded_property = (zend_overloaded_element *) property_reference->elements_list->head->data;
- do_VARIANT_propset(var_arg, &overloaded_property->element, value);
- pval_destructor(&overloaded_property->element);
- return SUCCESS;
-}
-
-static int do_VARIANT_propset(VARIANT *var_arg, pval *arg_property, pval *value)
-{
- pval type;
-
- type.type = IS_STRING;
-
- if(!strcmp(arg_property->value.str.val, "bVal"))
- {
- type.value.lval = VT_UI1;
- }
- else if(!strcmp(arg_property->value.str.val, "iVal"))
- {
- type.value.lval = VT_I2;
- }
- else if(!strcmp(arg_property->value.str.val, "lVal"))
- {
- type.value.lval = VT_I4;
- }
- else if(!strcmp(arg_property->value.str.val, "fltVal"))
- {
- type.value.lval = VT_R4;
- }
- else if(!strcmp(arg_property->value.str.val, "dblVal"))
- {
- type.value.lval = VT_R8;
- }
- else if(!strcmp(arg_property->value.str.val, "boolVal"))
- {
- type.value.lval = VT_BOOL;
- }
- else if(!strcmp(arg_property->value.str.val, "scode"))
- {
- type.value.lval = VT_ERROR;
- }
- else if(!strcmp(arg_property->value.str.val, "cyVal"))
- {
- type.value.lval = VT_CY;
- }
- else if(!strcmp(arg_property->value.str.val, "date"))
- {
- type.value.lval = VT_DATE;
- }
- else if(!strcmp(arg_property->value.str.val, "bstrVal"))
- {
- type.value.lval = VT_BSTR;
- }
- else if(!strcmp(arg_property->value.str.val, "pdecVal"))
- {
- type.value.lval = VT_DECIMAL|VT_BYREF;
- }
- else if(!strcmp(arg_property->value.str.val, "punkVal"))
- {
- type.value.lval = VT_UNKNOWN;
- }
- else if(!strcmp(arg_property->value.str.val, "pdispVal"))
- {
- type.value.lval = VT_DISPATCH;
- }
- else if(!strcmp(arg_property->value.str.val, "parray"))
- {
- type.value.lval = VT_ARRAY;
- }
- else if(!strcmp(arg_property->value.str.val, "pbVal"))
- {
- type.value.lval = VT_UI1|VT_BYREF;
- }
- else if(!strcmp(arg_property->value.str.val, "piVal"))
- {
- type.value.lval = VT_I2|VT_BYREF;
- }
- else if(!strcmp(arg_property->value.str.val, "plVal"))
- {
- type.value.lval = VT_I4|VT_BYREF;
- }
- else if(!strcmp(arg_property->value.str.val, "pfltVal"))
- {
- type.value.lval = VT_R4|VT_BYREF;
- }
- else if(!strcmp(arg_property->value.str.val, "pdblVal"))
- {
- type.value.lval = VT_R8|VT_BYREF;
- }
- else if(!strcmp(arg_property->value.str.val, "pboolVal"))
- {
- type.value.lval = VT_BOOL|VT_BYREF;
- }
- else if(!strcmp(arg_property->value.str.val, "pscode"))
- {
- type.value.lval = VT_ERROR|VT_BYREF;
- }
- else if(!strcmp(arg_property->value.str.val, "pcyVal"))
- {
- type.value.lval = VT_CY|VT_BYREF;
- }
- else if(!strcmp(arg_property->value.str.val, "pdate"))
- {
- type.value.lval = VT_DATE|VT_BYREF;
- }
- else if(!strcmp(arg_property->value.str.val, "pbstrVal"))
- {
- type.value.lval = VT_BSTR|VT_BYREF;
- }
- else if(!strcmp(arg_property->value.str.val, "ppunkVal"))
- {
- type.value.lval = VT_UNKNOWN|VT_BYREF;
- }
- else if(!strcmp(arg_property->value.str.val, "ppdispVal"))
- {
- type.value.lval = VT_DISPATCH|VT_BYREF;
- }
- else if(!strcmp(arg_property->value.str.val, "pparray"))
- {
- type.value.lval = VT_ARRAY|VT_BYREF;
- }
- else if(!strcmp(arg_property->value.str.val, "pvarVal"))
- {
- type.value.lval = VT_VARIANT|VT_BYREF;
- }
- else if(!strcmp(arg_property->value.str.val, "byref"))
- {
- type.value.lval = VT_BYREF;
- }
- else if(!strcmp(arg_property->value.str.val, "cVal"))
- {
- type.value.lval = VT_I1;
- }
- else if(!strcmp(arg_property->value.str.val, "uiVal"))
- {
- type.value.lval = VT_UI2;
- }
- else if(!strcmp(arg_property->value.str.val, "ulVal"))
- {
- type.value.lval = VT_UI4;
- }
- else if(!strcmp(arg_property->value.str.val, "intVal"))
- {
- type.value.lval = VT_INT;
- }
- else if(!strcmp(arg_property->value.str.val, "uintVal"))
- {
- type.value.lval = VT_UINT|VT_BYREF;
- }
- else if(!strcmp(arg_property->value.str.val, "pcVal"))
- {
- type.value.lval = VT_I1|VT_BYREF;
- }
- else if(!strcmp(arg_property->value.str.val, "puiVal"))
- {
- type.value.lval = VT_UI2|VT_BYREF;
- }
- else if(!strcmp(arg_property->value.str.val, "pulVal"))
- {
- type.value.lval = VT_UI4|VT_BYREF;
- }
- else if(!strcmp(arg_property->value.str.val, "pintVal"))
- {
- type.value.lval = VT_INT|VT_BYREF;
- }
- else if(!strcmp(arg_property->value.str.val, "puintVal"))
- {
- type.value.lval = VT_UINT|VT_BYREF;
- }
- else
- {
- php_error(E_WARNING, "Unknown member.");
- return FAILURE;
- }
-
- php_pval_to_variant_ex(value, var_arg, &type, codepage);
-
- return SUCCESS;
-}
-
-static void php_variant_destructor(zend_rsrc_list_entry *rsrc)
-{
- efree(rsrc);
-}
-
-void php_register_VARIANT_class()
-{
- INIT_OVERLOADED_CLASS_ENTRY(VARIANT_class_entry, "VARIANT", NULL,
- php_VARIANT_call_function_handler,
- php_VARIANT_get_property_handler,
- php_VARIANT_set_property_handler);
-
- zend_register_internal_class(&VARIANT_class_entry);
-}
-
-#endif /* PHP_WIN32 */
diff --git a/ext/rpc/dotnet/CREDITS b/ext/rpc/dotnet/CREDITS
deleted file mode 100644
index 154522c6f8..0000000000
--- a/ext/rpc/dotnet/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-dotnet
-Sam Ruby
diff --git a/ext/rpc/dotnet/EXPERIMENTAL b/ext/rpc/dotnet/EXPERIMENTAL
deleted file mode 100644
index 6443e99646..0000000000
--- a/ext/rpc/dotnet/EXPERIMENTAL
+++ /dev/null
@@ -1,5 +0,0 @@
-this extension is experimental,
-its functions may change their names
-or move to extension all together
-so do not rely to much on them
-you have been warned!
diff --git a/ext/rpc/dotnet/README b/ext/rpc/dotnet/README
deleted file mode 100644
index 8cad7bab8f..0000000000
--- a/ext/rpc/dotnet/README
+++ /dev/null
@@ -1,32 +0,0 @@
-Warning
-=======
-
-This support is EXPERIMENTAL. In fact, it integrates code that
-Microsoft labels as pre-beta. Use at your own risk.
-
-Build instructions
-==================
-
-Download and install the .NET Framework SDK Technology Preview from
-http://msdn.microsoft.com/net/#sdk. Once installed, copy Mscoree.h
-(typically found in C:\Program Files\NGWSSDK\Include to ext\dotnet).
-Do not simply add the NGWSSDK\Include directory to the include path
-as this will cause compilation failures.
-
-Download and unzip the source to the dm.net COM Moniker from
-http://staff.develop.com/jasonw/clr/readme.htm. Copy mscorlib.h
-to ext\dotnet. There is no need to register the clrmonsrv.dll as
-it is not used.
-
-At this point, the dotnet project can be built like any other
-project, from either VisualStudio 6's GUI or from the command line.
-Example command line invocation:
-
- msdev dotnet.dsp /MAKE "dotnet - Win32 Debug_TS"
-
-Execution instructions:
-=======================
-
-Add "extension=php_dotnet.dll" into php.ini.
-
-Sample program can be found at dotnet.php
diff --git a/ext/rpc/dotnet/dotnet.cpp b/ext/rpc/dotnet/dotnet.cpp
deleted file mode 100644
index f99b6935ad..0000000000
--- a/ext/rpc/dotnet/dotnet.cpp
+++ /dev/null
@@ -1,237 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Sam Ruby <rubys@us.ibm.com> |
- | Harald Radi <h.radi@nme.at> |
- +----------------------------------------------------------------------+
- */
-
-/*
- * This module implements support for Microsoft .Net components.
- */
-
-/*
- * 28.1.2001
- * use external unicode conversion functions
- *
- * harald radi <h.radi@nme.at>
- */
-
-#ifdef PHP_WIN32
-
-#include <iostream.h>
-#include <math.h>
-#include <comdef.h>
-
-extern "C" { /* this should be included in the includes itself !! */
-
-#include "php.h"
-#include "ext/standard/info.h"
-
-}
-
-#include "../com/conversion.h"
-#include "../com/php_COM.h"
-#include "Mscoree.h"
-#include "mscorlib.h"
-
-using namespace mscorlib;
-
-static ICorRuntimeHost *pHost;
-static mscorlib::_AppDomain *pDomain;
-
-static zend_class_entry dotnet_class_entry;
-static int codepage;
-
-HRESULT dotnet_init() {
- HRESULT hr;
-
- hr = CoCreateInstance(CLSID_CorRuntimeHost, NULL, CLSCTX_ALL,
- IID_ICorRuntimeHost, (void **)&pHost);
- if (FAILED(hr)) return hr;
-
- hr = pHost->Start();
- if (FAILED(hr)) return hr;
-
- IUnknown *uDomain;
- hr = pHost->GetDefaultDomain(&uDomain);
- if (FAILED(hr)) return hr;
-
- hr = uDomain->QueryInterface(__uuidof(_AppDomain), (void**) &pDomain);
- if (FAILED(hr)) return -1;
-
- uDomain->Release();
-
- return ERROR_SUCCESS;
-}
-
-HRESULT dotnet_create(OLECHAR *assembly, OLECHAR *datatype, i_dispatch *object) {
- HRESULT hr;
-
- _ObjectHandle *pHandle;
- hr = pDomain->CreateInstance(_bstr_t(assembly), _bstr_t(datatype), &pHandle);
- if (FAILED(hr)) return hr;
- if (!pHandle) return hr;
-
- _variant_t unwrapped;
- hr = pHandle->Unwrap(&unwrapped);
- pHandle->Release();
- if (FAILED(hr)) return hr;
-
- php_COM_set(object, unwrapped.pdispVal, TRUE);
- return ERROR_SUCCESS;
-}
-
-void dotnet_term() {
- if (pHost) pHost->Stop();
- if (pHost) pHost->Release();
- if (pDomain) pDomain->Release();
-
- pHost = 0;
- pDomain = 0;
-}
-
-/* {{{ proto int dotnet_load(string assembly_name [, string datatype_name, int codepage])
- Loads a DOTNET module */
-PHP_FUNCTION(dotnet_load)
-{
- HRESULT hr;
- pval *assembly_name, *datatype_name, *code_page;
- OLECHAR *assembly, *datatype;
- i_dispatch *obj;
-
- switch(ZEND_NUM_ARGS())
- {
- case 2:
- getParameters(ht, 2, &assembly_name, &datatype_name);
- codepage = CP_ACP;
- break;
- case 3:
- getParameters(ht, 3, &assembly_name, &datatype_name, &code_page);
-
- convert_to_long(code_page);
- codepage = code_page->value.lval;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- convert_to_string(assembly_name);
- assembly = php_char_to_OLECHAR(assembly_name->value.str.val, assembly_name->value.str.len, codepage);
-
- convert_to_string(datatype_name);
- datatype = php_char_to_OLECHAR(datatype_name->value.str.val, datatype_name->value.str.len, codepage);
-
- obj = (i_dispatch *) emalloc(sizeof(i_dispatch));
-
- /* obtain IDispatch */
- hr=dotnet_create(assembly, datatype, obj);
- efree(assembly);
- efree(datatype);
- if (FAILED(hr)) {
- char *error_message;
- error_message = php_COM_error_message(hr);
- php_error(E_WARNING,"Error obtaining .Net class for %s in assembly %s: %s",datatype_name->value.str.val,assembly_name->value.str.val,error_message);
- LocalFree(error_message);
- efree(obj);
- RETURN_FALSE;
- }
- if (!obj->i.dispatch) {
- php_error(E_WARNING,"Unable to locate %s in assembly %s",datatype_name->value.str.val,assembly_name->value.str.val);
- efree(obj);
- RETURN_FALSE;
- }
-
- RETURN_LONG(zend_list_insert(obj, php_COM_get_le_idispatch()));
-}
-/* }}} */
-
-
-void php_DOTNET_call_function_handler(INTERNAL_FUNCTION_PARAMETERS, zend_property_reference *property_reference)
-{
- pval *object = property_reference->object;
- zend_overloaded_element *function_name = (zend_overloaded_element *) property_reference->elements_list->tail->data;
-
- if (zend_llist_count(property_reference->elements_list)==1
- && !strcmp(function_name->element.value.str.val, "dotnet")) { /* constructor */
- pval *object_handle;
-
- PHP_FN(dotnet_load)(INTERNAL_FUNCTION_PARAM_PASSTHRU);
- if (!zend_is_true(return_value)) {
- var_reset(object);
- return;
- }
- ALLOC_ZVAL(object_handle);
- *object_handle = *return_value;
- pval_copy_constructor(object_handle);
- INIT_PZVAL(object_handle);
- zend_hash_index_update(object->value.obj.properties, 0, &object_handle, sizeof(pval *), NULL);
- pval_destructor(&function_name->element);
- } else {
- php_COM_call_function_handler(INTERNAL_FUNCTION_PARAM_PASSTHRU, property_reference);
- }
-}
-
-void php_register_DOTNET_class()
-{
- INIT_OVERLOADED_CLASS_ENTRY(dotnet_class_entry, "DOTNET", NULL,
- php_DOTNET_call_function_handler,
- php_COM_get_property_handler,
- php_COM_set_property_handler);
-
- zend_register_internal_class(&dotnet_class_entry);
-}
-
-function_entry DOTNET_functions[] = {
- {NULL, NULL, NULL}
-};
-
-static PHP_MINFO_FUNCTION(DOTNET)
-{
- php_info_print_table_start();
- php_info_print_table_row(2, ".NET support", "enabled");
- php_info_print_table_end();
-}
-
-PHP_MINIT_FUNCTION(DOTNET)
-{
-
- HRESULT hr;
- CoInitialize(0);
- hr = dotnet_init();
- if (FAILED(hr)) return hr;
-
- php_register_DOTNET_class();
- return SUCCESS;
-}
-
-
-PHP_MSHUTDOWN_FUNCTION(DOTNET)
-{
- dotnet_term();
- CoUninitialize();
- return SUCCESS;
-}
-
-
-zend_module_entry dotnet_module_entry = {
- "dotnet", DOTNET_functions, PHP_MINIT(DOTNET), PHP_MSHUTDOWN(DOTNET), NULL, NULL, PHP_MINFO(DOTNET), STANDARD_MODULE_PROPERTIES
-};
-
-BEGIN_EXTERN_C()
-ZEND_GET_MODULE(dotnet)
-END_EXTERN_C()
-
-#endif
diff --git a/ext/rpc/dotnet/dotnet.dsp b/ext/rpc/dotnet/dotnet.dsp
deleted file mode 100644
index a0b151f68a..0000000000
--- a/ext/rpc/dotnet/dotnet.dsp
+++ /dev/null
@@ -1,171 +0,0 @@
-# Microsoft Developer Studio Project File - Name="dotnet" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=dotnet - Win32 Debug_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "dotnet.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "dotnet.mak" CFG="dotnet - Win32 Debug_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "dotnet - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "dotnet - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "dotnet - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "dotnet - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "dotnet - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "..\..\Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "PHP_WIN32" /D "ZEND_WIN32" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D "NDEBUG" /D ZEND_DEBUG=0 /D "PHP_WIN32" /D "ZEND_WIN32" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_JAVA" /D HAVE_JAVA=1 /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "NDEBUG"
-# ADD RSC /l 0x40d /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\Release/php_dotnet.dll" /libpath:"$(JAVA_HOME)\lib" /libpath:"..\..\Release"
-
-!ELSEIF "$(CFG)" == "dotnet - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "..\..\Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "PHP_WIN32" /D "ZEND_WIN32" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D "_DEBUG" /D ZEND_DEBUG=1 /D "PHP_WIN32" /D "ZEND_WIN32" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_JAVA" /D HAVE_JAVA=1 /FR /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "_DEBUG"
-# ADD RSC /l 0x40d /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"..\..\Debug/php_dotnet.dll" /pdbtype:sept /libpath:"$(JAVA_HOME)\lib" /libpath:"..\..\Debug"
-
-!ELSEIF "$(CFG)" == "dotnet - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "..\..\Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\..\Zend" /I "$(JAVA_HOME)\include\win32" /I "$(JAVA_HOME)\include" /I "..\..\..\bindlib_w32" /D "_DEBUG" /D "PHP_WIN32" /D "ZEND_WIN32" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_JAVA" /FR /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\..\\" /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D "_DEBUG" /D ZEND_DEBUG=1 /D "ZTS" /D "PHP_WIN32" /D "ZEND_WIN32" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /FR /YX /FD /D /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "_DEBUG"
-# ADD RSC /l 0x40d /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts_debug.lib /nologo /dll /debug /machine:I386 /out:"..\..\Debug_TS/php_dotnet.dll" /pdbtype:sept /libpath:"..\..\Debug_TS"
-
-!ELSEIF "$(CFG)" == "dotnet - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "..\..\Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\..\Zend" /I "$(JAVA_HOME)\include\win32" /I "$(JAVA_HOME)\include" /I "..\..\..\bindlib_w32" /D "NDEBUG" /D "PHP_WIN32" /D "ZEND_WIN32" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_JAVA" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\\" /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D "NDEBUG" /D ZEND_DEBUG=0 /D "ZTS" /D "PHP_WIN32" /D "ZEND_WIN32" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "NDEBUG"
-# ADD RSC /l 0x40d /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_dotnet.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
-
-!ENDIF
-
-# Begin Target
-
-# Name "dotnet - Win32 Release"
-# Name "dotnet - Win32 Debug"
-# Name "dotnet - Win32 Debug_TS"
-# Name "dotnet - Win32 Release_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\dotnet.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\..\..\win32\winutil.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_dotnet.h
-# End Source File
-# End Group
-# Begin Source File
-
-SOURCE=.\README
-# End Source File
-# End Target
-# End Project
diff --git a/ext/rpc/dotnet/dotnet.php b/ext/rpc/dotnet/dotnet.php
deleted file mode 100644
index 3b0b67c02f..0000000000
--- a/ext/rpc/dotnet/dotnet.php
+++ /dev/null
@@ -1,8 +0,0 @@
-<?
- $stack = new DOTNET("mscorlib","System.Collections.Stack");
-
- $stack->Push(".Net");
- $stack->Push("Hello ");
-
- echo $stack->Pop() . $stack->Pop();
-?>
diff --git a/ext/rpc/dotnet/php_dotnet.h b/ext/rpc/dotnet/php_dotnet.h
deleted file mode 100644
index 570f4bdc7f..0000000000
--- a/ext/rpc/dotnet/php_dotnet.h
+++ /dev/null
@@ -1,21 +0,0 @@
-#ifndef PHP_DOTNET_H
-#define PHP_DOTNET_H
-
-#if WIN32|WINNT
-
-extern PHP_MINIT_FUNCTION(DOTNET);
-extern PHP_MSHUTDOWN_FUNCTION(DOTNET);
-PHP_FUNCTION(DOTNET_load);
-
-extern zend_module_entry DOTNET_module_entry;
-#define DOTNET_module_ptr &DOTNET_module_entry
-
-#else
-
-#define DOTNET_module_ptr NULL
-
-#endif /* Win32|WINNT */
-
-#define phpext_DOTNET_ptr DOTNET_module_ptr
-
-#endif /* PHP_DOTNET_H */
diff --git a/ext/rpc/java/CREDITS b/ext/rpc/java/CREDITS
deleted file mode 100644
index f49489bcf8..0000000000
--- a/ext/rpc/java/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-Java
-Sam Ruby
diff --git a/ext/rpc/java/Makefile.in b/ext/rpc/java/Makefile.in
deleted file mode 100644
index 2a980157d2..0000000000
--- a/ext/rpc/java/Makefile.in
+++ /dev/null
@@ -1,25 +0,0 @@
-
-LTLIBRARY_SHARED_NAME = libphp_java.la
-LTLIBRARY_SOURCES = java.c
-LTLIBRARY_DEPENDENCIES = php_java.jar
-
-LTLIBRARY_LDFLAGS = $(EXTRA_LDFLAGS) $(LDFLAGS) $(PHP_RPATHS)
-LTLIBRARY_SHARED_LIBADD = $(LTLIBRARY_DEPENDENCIES) $(EXTRA_LIBS)
-
-EXTRA_CFLAGS = $(JAVA_CFLAGS)
-EXTRA_INCLUDES = $(JAVA_INCLUDE)
-
-make_shared = yes
-
-include $(top_srcdir)/build/dynlib.mk
-
-php_java.jar : reflect.java
- $(mkinstalldirs) net/php
- @cp $(srcdir)/reflect.java net/php
- @echo library=php_java>net/php/reflect.properties
- javac net/php/reflect.java
- @test ! -f reflect.class || mv reflect.class net/php # bug in KJC javac
- $(JAVA_JAR) php_java.jar net/php/*.class net/php/*.properties
- @rm net/php/reflect.*
- @rmdir net/php
- @rmdir net
diff --git a/ext/rpc/java/README b/ext/rpc/java/README
deleted file mode 100644
index 1cfdc113eb..0000000000
--- a/ext/rpc/java/README
+++ /dev/null
@@ -1,243 +0,0 @@
-What is PHP4 ext/java?
-
- PHP4 ext/java provides a simple and effective means for creating and
- invoking methods on Java objects from PHP. The JVM is created using JNI,
- and everything runs in-process.
-
- Two examples are provided, jver and jawt, to illustrate usage of this
- extension. A few things to note:
-
- 1) new Java() will create an instance of a class if a suitable constructor
- is available. If no parameters are passed and the default constructor
- is useful as it provides access to classes like "java.lang.System"
- which expose most of their functionallity through static methods.
-
- 2) Accessing a member of an instance will first look for bean properties
- then public fields. In other words, "print $date.time" will first
- attempt to be resolved as "$date.getTime()", then as "$date.time";
-
- 3) Both static and instance members can be accessed on an object with
- the same syntax. Furthermore, if the java object is of type
- "java.lang.Class", then static members of the class (fields and
- methods) can be accessed.
-
- 4) Exceptions raised result in PHP warnings, and null results. The
- warnings may be eliminated by prefixing the method call with an
- "@" sign. The following APIs may be used to retrieve and reset
- the last error:
-
- java_last_exception_get()
- java_last_exception_clear()
-
- 5) Overload resolution is in general a hard problem given the
- differences in types between the two languages. The PHP Java
- extension employs a simple, but fairly effective, metric for
- determining which overload is the best match.
-
- Additionally, method names in PHP are not case sensitive, potentially
- increasing the number of overloads to select from.
-
- Once a method is selected, the parameters are cooerced if necessary,
- possibly with a loss of data (example: double precision floating point
- numbers will be converted to boolean).
-
- 6) In the tradition of PHP, arrays and hashtables may pretty much
- be used interchangably. Note that hashtables in PHP may only be
- indexed by integers or strings; and that arrays of primitive types
- in Java can not be sparse. Also note that these constructs are
- passed by value, so may be expensive in terms of memory and time.
-
-Build and execution instructions:
-
- Given the number of platforms and providers of JVMs, no single set of
- instructions will be able to cover all cases. So in place of hard and
- fast instructions, below are a working examples for a number of free and
- commercial implementations and platforms. Please adjust the paths to
- suit your installation. Also, if you happen to get this to work on
- another JVM/platform combination, please let me know, particularly if
- a unique build or execution setup was required.
-
- Note for Windows users: semi-colons (";") mark the beginning of
- comments in php.ini files, so if you wish to add to the classpath,
- make sure that the entire string is in quotes. See the JDK 1.1.8
- instructions below for an example.
-
- This function has been tested in both CGI and Apache (apxs) modes. As
- the current design requires shared libraries, this support can not be
- linked statically into Apache.
-
- With ext/java, no Java Virtual Machines are created until the first
- Java call is made. This not only eliminates unnecessary overhead if
- the extension is never used, it also provides error messages directly
- back to the user instead of being burried in a log some place.
-
- For people interested in robustness, performance, and more complete
- integration with Java, consider using the sapi/servlet interface which
- is built upon the Java extension. Running PHP as a servlet enables PHP
- to utilize the existing JVM and threads from the servlet engine, and
- provides direct access to the servlet request and response objects.
-
- Finally, the bottom of this readme contains some guidance for how to
- approach situations in which these instructions don't work on your
- machine.
-
-========================================================================
-=== JVM=Kaffe 1.0.4 (as delivered with OS), OS=Redhat Linux 6.1 ===
-========================================================================
-
-build instructions:
-
- ./configure --with-java
-
-php.ini:
-
- [java]
- java.library.path=/usr/lib/kaffe:/home/rubys/php4/modules
- java.class.path=/usr/share/kaffe/Klasses.jar:/home/rubys/php4/modules/php_java.jar
- extension_dir=/home/rubys/php4/modules
- extension=libphp_java.so
-
-========================================================================
-=== JVM=Kaffe 1.0.5 (built from source), OS=Redhat Linux 6.1 ===
-========================================================================
-
-build instructions:
-
- ./configure --with-java
-
-php.ini:
-
- [java]
- java.library.path=/usr/local/lib/kaffe:/home/rubys/php4/modules
- java.class.path=/usr/local/share/kaffe/Klasses.jar:/home/rubys/php4/modules/php_java.jar
- extension_dir=/home/rubys/php4/modules
- extension=libphp_java.so
-
-========================================================================
-=== JVM=IBM 1.1.8, OS=Redhat Linux 6.1 ===
-========================================================================
-
-build instructions:
-
- ./configure --with-java
-
-php.ini:
-
- [java]
- java.class.path=/home/jdk118/lib/classes.zip:/home/rubys/php4/modules/php_java.jar
- extension_dir=/home/rubys/php4/modules
- extension=libphp_java.so
-
-========================================================================
-=== JVM=Blackdown 1.2.2 RC4, OS=Redhat Linux 6.1 ===
-========================================================================
-
-build instructions:
-
- ./configure --with-java
-
-php.ini:
-
- [java]
- java.class.path=/home/rubys/php4/lib/php_java.jar
- extension_dir=/home/rubys/php4/modules
- extension=libphp_java.so
-
-========================================================================
-=== JVM=Sun JDK 1.2.2, OS=Linux ===
-========================================================================
-
-build instructions:
-
- ./configure --with-java
-
-php.ini:
-
- [java]
- java.class.path=/home/rubys/php4/lib/php_java.jar
- java.library.path=/home/rubys/php4/modules
- extension_dir=/home/rubys/php4/modules
- extension=libphp_java.so
-
-========================================================================
-=== JVM=Sun JDK 1.1.8, OS=Windows NT 4 ===
-========================================================================
-
-build instructions:
-
- SET JAVA_HOME=D:\jdk1.1.8
- msdev ext\java\java.dsp /MAKE "java - Win32 Debug_TS"
-
-php.ini:
-
- [java]
- java.class.path="D:\jdk1.1.8\lib\classes.zip;F:\PHP4\Debug_TS\php_java.jar"
- extension=php_java.dll
-
-========================================================================
-=== JVM=Sun JDK 1.2.2, OS=Windows NT 4 ===
-========================================================================
-
-build instructions:
-
- SET JAVA_HOME=D:\jdk1.2.2
- msdev ext\java\java.dsp /MAKE "java - Win32 Debug_TS"
-
-php.ini:
-
- [java]
- java.class.path=F:\PHP4\Debug_TS\php_java.jar
- extension=php_java.dll
-
-=========================================================================
-
-Guidance for when these instructions don't work.
-
- JDK vendors don't typically document their internal workings, and are
- typically very reliant on code inside of the JAVA main program and the
- installation directory structure. For this reason, running PHP as a
- servlet is typically much easier to get working. But if for some reason
- this is not appropriate for you, and the instructions above don't work,
- then read on.
-
- The first thing to realize is that the directory structure of the JDK is
- very important. Some users (particularly on Windows) get a message about
- a DLL or shared library not being available and proceed to find that file
- and copy it into a system directory. This typically just gets you to the
- next problem - for example, it appears that many JDKs attempt to locate
- the runtime Java classes (rt.jar) in a directory relative to these system
- libraries. So unless you are inclined to copy your entire Java
- installation, you are much better adjusting your PATHs.
-
- Not documented above, but useful for many JDK's is ability to specify the
- library path via java.library.path in the php.ini. On many Unix machines,
- determining the initial value for this can be done by changing directory
- to where you find a shared library that can't be loaded (example:
- libjava.so), and executing "ld libjava.so". If you see some modules
- listed as "not found", add the necessary directories to LD_LIBRARY_PATH
- and repeat until successful. On my system, I require the following
- two directories.
-
- /home/jdk1.2.2/jre/lib/i386/native_threads
- /home/jdk1.2.2/jre/lib/i386/classic
-
- Note: this only determines the statically loaded libraries. Additional
- libraries (such as libzip.so) may be loaded dynamically. On my system,
- libzip.so is located in
-
- /home/jdk1.2.2/jre/lib/i386
-
- Another php.ini variable which may be helpful is java.home.
-
- If java.library.path doesn't work for you (it won't on any JDK 1.1
- implementations, for example), then try setting the system PATH or the
- LD_LIBRARY_PATH before starting your web server. For Apache on Linux
- systems, this can be accomplished by editing the Root's .bashrc and
- adding the necessary export LD_LIBRARY_PATH statement.
-
- If that doesn't work, try dividing an (hopefully) conquering by temporarily
- eliminating items such as Apache from the process by adjusting the
- arguments passed to the ./configure command (i.e., removing --with-apxs).
-
- If all else fails, "man dlopen" on Unix systems will give more insight on
- what the system is trying to do internally.
diff --git a/ext/rpc/java/config.m4 b/ext/rpc/java/config.m4
deleted file mode 100644
index 34aa68a27f..0000000000
--- a/ext/rpc/java/config.m4
+++ /dev/null
@@ -1,118 +0,0 @@
-# $Id$
-# config.m4 for extension java
-
-AC_MSG_CHECKING(for Java support)
-AC_ARG_WITH(java,
-[ --with-java[=DIR] Include Java support. DIR is the base install
- directory for the JDK. This extension can only
- be built as a shared dl.],
-[
- if test "$withval" != "no"; then
- JAVA_SHARED=libphp_java.la
-
- pltform=`uname -s 2>/dev/null`
- java_libext=libjava.so
- case $pltform in
- AIX) java_libext=libjava.a ;;
- HP-UX) java_libext=libjava.sl ;;
- esac
- # substitute zip for systems which don't have jar in the PATH
- if JAVA_JAR=`which jar 2>/dev/null`; then
- JAVA_JAR="$JAVA_JAR cf"
- else
- JAVA_JAR='zip -q0'
- fi
-
- if test "$withval" = "yes"; then
- withval=`cd \`dirname \\\`which javac\\\`\`/..;pwd`
- fi
-
- if test -d $withval/lib/kaffe; then
- PHP_ADD_LIBPATH($withval/lib)
- PHP_ADD_LIBPATH($withval/lib/kaffe)
-
- JAVA_CFLAGS=-DKAFFE
- JAVA_INCLUDE=-I$withval/include/kaffe
- JAVA_CLASSPATH=$withval/share/kaffe/Klasses.jar
- JAVA_LIB=kaffevm
- java_libext=kaffevm
-
- test -f $withval/lib/$JAVA_LIB && JAVA_LIBPATH=$withval/lib
- test -f $withval/lib/kaffe/$JAVA_LIB && JAVA_LIBPATH=$withval/lib/kaffe
-
- # accomodate old versions of kaffe which don't support jar
- if kaffe -version 2>&1 | grep 1.0b > /dev/null; then
- JAVA_JAR='zip -q0'
- fi
-
- elif test -f $withval/lib/$java_libext; then
- JAVA_LIB=java
- JAVA_LIBPATH=$withval/lib
- JAVA_INCLUDE=-I$withval/include
- test -f $withval/lib/classes.zip && JAVA_CFLAGS=-DJNI_11
- test -f $withval/lib/jvm.jar && JAVA_CFLAGS=-DJNI_12
- test -f $withval/lib/classes.zip && JAVA_CLASSPATH=$withval/lib/classes.zip
- test -f $withval/lib/jvm.jar && JAVA_CLASSPATH=$withval/lib/jvm.jar
- for i in $JAVA_INCLUDE/*; do
- test -f $i/jni_md.h && JAVA_INCLUDE="$JAVA_INCLUDE $i"
- done
-
- else
-
- for i in `find $withval/include -type d`; do
- test -f $i/jni.h && JAVA_INCLUDE=-I$i
- test -f $i/jni_md.h && JAVA_INCLUDE="$JAVA_INCLUDE -I$i"
- done
-
- for i in `find $withval -type d`; do
- test -f $i/classes.zip && JAVA_CFLAGS=-DJNI_11
- test -f $i/rt.jar && JAVA_CFLAGS=-DJNI_12
- test -f $i/classes.zip && JAVA_CLASSPATH=$i/classes.zip
- test -f $i/rt.jar && JAVA_CLASSPATH=$i/rt.jar
-
- if test -f $i/$java_libext; then
- JAVA_LIB=java
- JAVA_LIBPATH=$i
- test -d $i/hotspot && PHP_ADD_LIBPATH($i/hotspot)
- test -d $i/classic && PHP_ADD_LIBPATH($i/classic)
- test -d $i/server && PHP_ADD_LIBPATH($i/server)
- test -d $i/native_threads && PHP_ADD_LIBPATH($i/native_threads)
- fi
- done
-
- if test -z "$JAVA_INCLUDE"; then
- AC_MSG_RESULT(no)
- AC_MSG_ERROR(unable to find Java VM libraries)
- fi
-
- JAVA_CFLAGS="$JAVA_CFLAGS -D_REENTRANT"
- fi
-
- AC_DEFINE(HAVE_JAVA,1,[ ])
- PHP_ADD_LIBPATH($JAVA_LIBPATH)
- JAVA_CFLAGS="$JAVA_CFLAGS '-DJAVALIB=\"$JAVA_LIBPATH/$java_libext\"'"
-
- if test "$PHP_SAPI" != "servlet"; then
- PHP_EXTENSION(java, shared)
-
- if test "$PHP_SAPI" = "cgi"; then
- PHP_ADD_LIBRARY($JAVA_LIB)
- fi
-
- INSTALL_IT="$INSTALL_IT; \$(srcdir)/build/shtool mkdir -p -f -m 0755 \$(INSTALL_ROOT)\$(libdir)"
- INSTALL_IT="$INSTALL_IT; \$(INSTALL) -m 0755 \$(srcdir)/ext/java/php_java.jar \$(INSTALL_ROOT)\$(libdir)"
- fi
-
- AC_MSG_RESULT(yes)
- else
- AC_MSG_RESULT(no)
- fi
-],[
- AC_MSG_RESULT(no)
-])
-
-PHP_SUBST(JAVA_CFLAGS)
-PHP_SUBST(JAVA_CLASSPATH)
-PHP_SUBST(JAVA_INCLUDE)
-PHP_SUBST(JAVA_SHARED)
-PHP_SUBST(JAVA_JAR)
diff --git a/ext/rpc/java/except.php b/ext/rpc/java/except.php
deleted file mode 100644
index a7e6a79c08..0000000000
--- a/ext/rpc/java/except.php
+++ /dev/null
@@ -1,23 +0,0 @@
-<?
- $stack=new Java("java.util.Stack");
- $stack->push(1);
-
- #
- # Should succeed and print out "1"
- #
- $result = $stack->pop();
- $ex = java_last_exception_get();
- if (!$ex) print "$result\n";
-
- #
- # Should fail - note the "@" eliminates the warning
- #
- $result=@$stack->pop();
- $ex=java_last_exception_get();
- if ($ex) print $ex->toString();
-
- #
- # Reset last exception
- #
- java_last_exception_clear();
-?>
diff --git a/ext/rpc/java/java.c b/ext/rpc/java/java.c
deleted file mode 100644
index 27bfc1e14c..0000000000
--- a/ext/rpc/java/java.c
+++ /dev/null
@@ -1,795 +0,0 @@
- /*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Sam Ruby (rubys@us.ibm.com) |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-/*
- * This module implements Zend OO syntax overloading support for Java
- * components using JNI and reflection.
- */
-
-
-#include "php.h"
-#include "zend_compile.h"
-#include "php_ini.h"
-#include "php_globals.h"
-
-#ifdef PHP_WIN32
- #include "win32/winutil.h"
- #define DL_ERROR php_win_err()
-#else
- #define DL_ERROR dlerror()
-#endif
-
-#include <jni.h>
-
-#include <stdio.h>
-
-#define IS_EXCEPTION 86
-
-/***************************************************************************/
-
-#ifndef KAFFE
-#ifndef JNI_11
-#ifndef JNI_12
-
-#ifdef JNI_VERSION_1_2
-#define JNI_12
-#else
-#define JNI_11
-#endif
-
-#endif
-#endif
-#endif
-
-#ifdef PHP_WIN32
-#ifdef JNI_12
-#define JAVALIB "jvm.dll"
-#else
-#define JAVALIB "javai.dll"
-#endif
-#else
-#endif
-
-/***************************************************************************/
-
-static int le_jobject = 0;
-
-static char *classpath = 0;
-static char *libpath = 0;
-static char *javahome = 0;
-static char *javalib = 0;
-
-static int iniUpdated = 0;
-static void *dl_handle = 0;
-
-typedef struct {
- JavaVM *jvm;
- JNIEnv *jenv;
- jobject php_reflect;
- jclass reflect_class;
-} php_java_globals;
-
-#ifdef ZTS
-#define JG(v) (java_globals->v)
-#define JG_FETCH() php_java_globals *java_globals = ts_resource(java_globals_id)
-#define JG_D php_java_globals *java_globals
-#define JG_DC , JG_D
-#define JG_C java_globals
-#define JG_CC , JG_C
-int java_globals_id;
-#else
-#define JG(v) (java_globals.v)
-#define JG_FETCH()
-#define JG_D
-#define JG_DC
-#define JG_C
-#define JG_CC
-php_java_globals java_globals;
-#endif
-
-static zend_class_entry java_class_entry;
-
-static PHP_INI_MH(OnIniUpdate) {
- if (new_value) *(char**)mh_arg1 = new_value;
- iniUpdated=1;
- return SUCCESS;
-}
-
-PHP_INI_BEGIN()
- PHP_INI_ENTRY1("java.class.path",
- NULL, PHP_INI_ALL, OnIniUpdate, &classpath)
-#ifndef JNI_11
- PHP_INI_ENTRY1("java.home",
- NULL, PHP_INI_ALL, OnIniUpdate, &javahome)
- PHP_INI_ENTRY1("java.library.path",
- NULL, PHP_INI_ALL, OnIniUpdate, &libpath)
-#endif
-#ifdef JAVALIB
- PHP_INI_ENTRY1("java.library",
- JAVALIB, PHP_INI_ALL, OnIniUpdate, &javalib)
-#else
- PHP_INI_ENTRY1("java.library",
- NULL, PHP_INI_ALL, OnIniUpdate, &javalib)
-#endif
-PHP_INI_END()
-
-/***************************************************************************/
-
-/*
- * Destroy a Java Virtual Machine.
- */
-void jvm_destroy() {
- JG_FETCH();
-
- if (JG(php_reflect)) (*JG(jenv))->DeleteGlobalRef(JG(jenv), JG(php_reflect));
- if (JG(jvm)) {
- (*JG(jvm))->DetachCurrentThread(JG(jvm));
- (*JG(jvm))->DestroyJavaVM(JG(jvm));
- JG(jvm) = 0;
- }
- if (dl_handle) DL_UNLOAD(dl_handle);
- JG(php_reflect) = 0;
- JG(jenv) = 0;
-}
-
-/*
- * Create a Java Virtual Machine.
- * - class.path, home, and library.path are read out of the INI file
- * - appropriate (pre 1.1, JDK 1.1, and JDK 1.2) initialization is performed
- * - net.php.reflect class file is located
- */
-
-#ifdef JNI_12
-static void addJVMOption(JavaVMInitArgs *vm_args, char *name, char *value) {
- char *option = (char*) malloc(strlen(name) + strlen(value) + 1);
- strcpy(option, name);
- strcat(option, value);
- vm_args->options[vm_args->nOptions++].optionString = option;
-}
-#endif
-
-static int jvm_create() {
- int rc;
- jobject local_php_reflect;
- jthrowable error;
-
- jint (JNICALL *JNI_CreateVM)(const void*,const void*,void*);
-#ifndef JNI_12
- jint (JNICALL *JNI_DefaultArgs)(void*);
-#endif
-
-#ifdef JNI_11
- JDK1_1InitArgs vm_args;
-#else
- JavaVMInitArgs vm_args;
-#ifdef JNI_12
- JavaVMOption options[3];
-#endif
-#endif
-
- JG_FETCH();
-
- iniUpdated=0;
-
- if (javalib) {
- dl_handle = DL_LOAD(javalib);
-
- if (!dl_handle) {
- php_error(E_ERROR, "Unable to load Java Library %s, error: %s",
- javalib, DL_ERROR);
- return -1;
- }
- }
-
-#ifndef JAVALIB
- if (!dl_handle)
- JNI_CreateVM = &JNI_CreateJavaVM;
- else
-#endif
-
- JNI_CreateVM = (jint (JNICALL *)(const void*,const void*,void*))
- DL_FETCH_SYMBOL(dl_handle, "JNI_CreateJavaVM");
-
- if (!JNI_CreateVM) {
- php_error(E_ERROR, "Unable to locate CreateJavaVM function");
- return -1;
- }
-
-#ifdef JNI_12
-
- vm_args.version = JNI_VERSION_1_2;
- vm_args.ignoreUnrecognized = JNI_FALSE;
- vm_args.options = options;
- vm_args.nOptions = 0;
-
- if (classpath) addJVMOption(&vm_args, "-Djava.class.path=", classpath);
- if (javahome) addJVMOption(&vm_args, "-Djava.home=", javahome);
- if (libpath) addJVMOption(&vm_args, "-Djava.library.path=", libpath);
-
-#else
-
-#ifndef JAVALIB
- if (!dl_handle)
- JNI_DefaultArgs = &JNI_GetDefaultJavaVMInitArgs;
- else
-#endif
-
- JNI_DefaultArgs = (jint (JNICALL *)(void*))
- DL_FETCH_SYMBOL(dl_handle, "JNI_GetDefaultJavaVMInitArgs");
-
- if (!JNI_DefaultArgs) {
- php_error(E_ERROR, "Unable to locate GetDefaultJavaVMInitArgs function");
- return -1;
- }
-
- vm_args.version=0x00010001;
- (*JNI_DefaultArgs)(&vm_args);
-
- if (!classpath) classpath = "";
- vm_args.classpath = classpath;
-#ifdef KAFFE
- vm_args.classhome = javahome;
- vm_args.libraryhome = libpath;
-#endif
-
-#endif
-
- rc = (*JNI_CreateVM)(&JG(jvm), &JG(jenv), &vm_args);
-
- if (rc) {
- php_error(E_ERROR, "Unable to create Java Virtual Machine");
- return rc;
- }
-
- JG(reflect_class) = (*JG(jenv))->FindClass(JG(jenv), "net/php/reflect");
- error = (*JG(jenv))->ExceptionOccurred(JG(jenv));
- if (error) {
- jclass errClass;
- jmethodID toString;
- jobject errString;
- const char *errAsUTF;
- jboolean isCopy;
- JNIEnv *jenv = JG(jenv);
- (*jenv)->ExceptionClear(jenv);
- errClass = (*jenv)->GetObjectClass(jenv, error);
- toString = (*jenv)->GetMethodID(jenv, errClass, "toString",
- "()Ljava/lang/String;");
- errString = (*jenv)->CallObjectMethod(jenv, error, toString);
- errAsUTF = (*jenv)->GetStringUTFChars(jenv, errString, &isCopy);
- php_error(E_ERROR, "%s", errAsUTF);
- if (isCopy) (*jenv)->ReleaseStringUTFChars(jenv, error, errAsUTF);
- jvm_destroy();
- return -1;
- }
-
- local_php_reflect = (*JG(jenv))->AllocObject(JG(jenv), JG(reflect_class));
- JG(php_reflect) = (*JG(jenv))->NewGlobalRef(JG(jenv), local_php_reflect);
- return rc;
-}
-
-/***************************************************************************/
-
-static jobject _java_makeObject(pval* arg JG_DC) {
- JNIEnv *jenv = JG(jenv);
- jobject result;
- pval **handle;
- int type;
- jmethodID makeArg;
- jclass hashClass;
-
- switch (arg->type) {
- case IS_STRING:
- result=(*jenv)->NewByteArray(jenv,arg->value.str.len);
- (*jenv)->SetByteArrayRegion(jenv,(jbyteArray)result,0,
- arg->value.str.len, arg->value.str.val);
- break;
-
- case IS_OBJECT:
- zend_hash_index_find(arg->value.obj.properties, 0, (void*)&handle);
- result = zend_list_find((*handle)->value.lval, &type);
- break;
-
- case IS_BOOL:
- makeArg = (*jenv)->GetMethodID(jenv, JG(reflect_class), "MakeArg",
- "(Z)Ljava/lang/Object;");
- result = (*jenv)->CallObjectMethod(jenv, JG(php_reflect), makeArg,
- (jboolean)(arg->value.lval));
- break;
-
- case IS_LONG:
- makeArg = (*jenv)->GetMethodID(jenv, JG(reflect_class), "MakeArg",
- "(J)Ljava/lang/Object;");
- result = (*jenv)->CallObjectMethod(jenv, JG(php_reflect), makeArg,
- (jlong)(arg->value.lval));
- break;
-
- case IS_DOUBLE:
- makeArg = (*jenv)->GetMethodID(jenv, JG(reflect_class), "MakeArg",
- "(D)Ljava/lang/Object;");
- result = (*jenv)->CallObjectMethod(jenv, JG(php_reflect), makeArg,
- (jdouble)(arg->value.dval));
- break;
-
- case IS_ARRAY:
- {
- jobject jkey, jval;
- zval **value;
- zval key;
- char *string_key;
- ulong num_key;
- jobject jold;
- jmethodID put, init;
-
- hashClass = (*jenv)->FindClass(jenv, "java/util/Hashtable");
- init = (*jenv)->GetMethodID(jenv, hashClass, "<init>", "()V");
- result = (*jenv)->NewObject(jenv, hashClass, init);
-
- put = (*jenv)->GetMethodID(jenv, hashClass, "put",
- "(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;");
-
- /* Iterate through hash */
- zend_hash_internal_pointer_reset(arg->value.ht);
- while(zend_hash_get_current_data(arg->value.ht, (void**)&value) == SUCCESS) {
- jval = _java_makeObject(*value JG_CC);
-
- switch (zend_hash_get_current_key(arg->value.ht, &string_key, &num_key, 0)) {
- case HASH_KEY_IS_STRING:
- key.type = IS_STRING;
- key.value.str.val = string_key;
- key.value.str.len = strlen(string_key);
- jkey = _java_makeObject(&key JG_CC);
- break;
- case HASH_KEY_IS_LONG:
- key.type = IS_LONG;
- key.value.lval = num_key;
- jkey = _java_makeObject(&key JG_CC);
- break;
- default: /* HASH_KEY_NON_EXISTANT */
- jkey = 0;
- }
- jold = (*jenv)->CallObjectMethod(jenv, result, put, jkey, jval);
- if ((*value)->type != IS_OBJECT) (*jenv)->DeleteLocalRef(jenv, jval);
- zend_hash_move_forward(arg->value.ht);
- }
-
- break;
- }
-
- default:
- result=0;
- }
-
- return result;
-}
-
-/***************************************************************************/
-
-static jobjectArray _java_makeArray(int argc, pval** argv JG_DC) {
- JNIEnv *jenv = JG(jenv);
-
- jclass objectClass = (*jenv)->FindClass(jenv, "java/lang/Object");
- jobjectArray result = (*jenv)->NewObjectArray(jenv, argc, objectClass, 0);
- jobject arg;
- int i;
-
- for (i=0; i<argc; i++) {
- arg = _java_makeObject(argv[i] JG_CC);
- (*jenv)->SetObjectArrayElement(jenv, result, i, arg);
- if (argv[i]->type != IS_OBJECT) (*jenv)->DeleteLocalRef(jenv, arg);
- }
- return result;
-}
-
-static int checkError(pval *value) {
- if (value->type == IS_EXCEPTION) {
- php_error(E_WARNING, "%s", value->value.str.val);
- efree(value->value.str.val);
- var_reset(value);
- return 1;
- };
- return 0;
-}
-
-
-/***************************************************************************/
-
-/*
- * Invoke a method on an object. If method name is "java", create a new
- * object instead.
- */
-void java_call_function_handler
- (INTERNAL_FUNCTION_PARAMETERS, zend_property_reference *property_reference)
-{
- JNIEnv *jenv;
-
- pval *object = property_reference->object;
- zend_overloaded_element *function_name = (zend_overloaded_element *)
- property_reference->elements_list->tail->data;
-
- int arg_count = ZEND_NUM_ARGS();
- jlong result = 0;
- pval **arguments = (pval **) emalloc(sizeof(pval *)*arg_count);
-
- JG_FETCH();
-
- getParametersArray(ht, arg_count, arguments);
-
- if (iniUpdated && JG(jenv)) jvm_destroy();
- if (!JG(jenv)) jvm_create();
- if (!JG(jenv)) return;
- jenv = JG(jenv);
-
- if (!strcmp("java",function_name->element.value.str.val)) {
-
- /* construct a Java object:
- First argument is the class name. Any additional arguments will
- be treated as constructor parameters. */
-
- jmethodID co = (*jenv)->GetMethodID(jenv, JG(reflect_class), "CreateObject",
- "(Ljava/lang/String;[Ljava/lang/Object;J)V");
- jstring className;
- result = (jlong)(long)object;
-
- if (ZEND_NUM_ARGS() < 1) {
- php_error(E_ERROR, "Missing classname in new Java() call");
- return;
- }
-
- className=(*jenv)->NewStringUTF(jenv, arguments[0]->value.str.val);
- (*jenv)->CallVoidMethod(jenv, JG(php_reflect), co,
- className, _java_makeArray(arg_count-1, arguments+1 JG_CC), result);
-
- (*jenv)->DeleteLocalRef(jenv, className);
-
- } else {
-
- pval **handle;
- int type;
- jobject obj;
- jstring method;
-
- /* invoke a method on the given object */
-
- jmethodID invoke = (*jenv)->GetMethodID(jenv, JG(reflect_class), "Invoke",
- "(Ljava/lang/Object;Ljava/lang/String;[Ljava/lang/Object;J)V");
- zend_hash_index_find(object->value.obj.properties, 0, (void**) &handle);
- obj = zend_list_find((*handle)->value.lval, &type);
- method = (*jenv)->NewStringUTF(jenv, function_name->element.value.str.val);
- result = (jlong)(long)return_value;
-
- (*jenv)->CallVoidMethod(jenv, JG(php_reflect), invoke,
- obj, method, _java_makeArray(arg_count, arguments JG_CC), result);
-
- (*jenv)->DeleteLocalRef(jenv, method);
-
- }
-
- efree(arguments);
- pval_destructor(&function_name->element);
-
- checkError((pval*)(long)result);
-}
-
-/***************************************************************************/
-
-PHP_FUNCTION(java_last_exception_get)
-{
- jlong result = 0;
- jmethodID lastEx;
-
- JG_FETCH();
-
- if (ZEND_NUM_ARGS()!=0) WRONG_PARAM_COUNT;
-
- result = (jlong)(long)return_value;
-
- lastEx = (*JG(jenv))->GetMethodID(JG(jenv), JG(reflect_class),
- "lastException", "(J)V");
-
- (*JG(jenv))->CallVoidMethod(JG(jenv), JG(php_reflect), lastEx, result);
-}
-
-/***************************************************************************/
-
-PHP_FUNCTION(java_last_exception_clear)
-{
- jlong result = 0;
- jmethodID clearEx;
-
- JG_FETCH();
-
- if (ZEND_NUM_ARGS()!=0) WRONG_PARAM_COUNT;
-
- result = (jlong)(long)return_value;
-
- clearEx = (*JG(jenv))->GetMethodID(JG(jenv), JG(reflect_class),
- "clearException", "()V");
-
- (*JG(jenv))->CallVoidMethod(JG(jenv), JG(php_reflect), clearEx);
-}
-
-/***************************************************************************/
-
-static pval _java_getset_property
- (zend_property_reference *property_reference, jobjectArray value)
-{
- pval presult;
- jlong result = 0;
- pval **pobject;
- jobject obj;
- int type;
-
- /* get the property name */
- zend_llist_element *element = property_reference->elements_list->head;
- zend_overloaded_element *property=(zend_overloaded_element *)element->data;
- jstring propName;
-
- JNIEnv *jenv;
- JG_FETCH();
- jenv = JG(jenv);
-
- propName = (*jenv)->NewStringUTF(jenv, property->element.value.str.val);
-
- /* get the object */
- zend_hash_index_find(property_reference->object->value.obj.properties,
- 0, (void **) &pobject);
- obj = zend_list_find((*pobject)->value.lval,&type);
- result = (jlong)(long) &presult;
- var_uninit(&presult);
-
- if (!obj || (type!=le_jobject)) {
- php_error(E_ERROR,
- "Attempt to access a Java property on a non-Java object");
- } else {
- /* invoke the method */
- jmethodID gsp = (*jenv)->GetMethodID(jenv, JG(reflect_class), "GetSetProp",
- "(Ljava/lang/Object;Ljava/lang/String;[Ljava/lang/Object;J)V");
- (*jenv)->CallVoidMethod
- (jenv, JG(php_reflect), gsp, obj, propName, value, result);
- }
-
- (*jenv)->DeleteLocalRef(jenv, propName);
- pval_destructor(&property->element);
- return presult;
-}
-
-pval java_get_property_handler
- (zend_property_reference *property_reference)
-{
- pval presult = _java_getset_property(property_reference, 0);
- checkError(&presult);
- return presult;
-}
-
-
-int java_set_property_handler
- (zend_property_reference *property_reference, pval *value)
-{
- pval presult;
- JG_FETCH();
- presult = _java_getset_property
- (property_reference, _java_makeArray(1, &value JG_CC));
- return checkError(&presult) ? FAILURE : SUCCESS;
-}
-
-/***************************************************************************/
-
-static void _php_java_destructor(zend_rsrc_list_entry *rsrc)
-{
- void *jobject = (void *)rsrc->ptr;
- JG_FETCH();
- if (JG(jenv)) (*JG(jenv))->DeleteGlobalRef(JG(jenv), jobject);
-}
-
-#ifdef ZTS
-static void alloc_java_globals_ctor(php_java_globals *java_globals) {
- memset(java_globals, 0, sizeof(php_java_globals));
-}
-#endif
-
-PHP_MINIT_FUNCTION(java) {
- INIT_OVERLOADED_CLASS_ENTRY(java_class_entry, "java", NULL,
- java_call_function_handler,
- java_get_property_handler,
- java_set_property_handler);
-
- zend_register_internal_class(&java_class_entry);
-
- le_jobject = zend_register_list_destructors_ex(_php_java_destructor, NULL, "java", module_number);
-
- REGISTER_INI_ENTRIES();
-
- if (!classpath) classpath = getenv("CLASSPATH");
-
- if (!libpath) {
- PLS_FETCH();
- libpath=PG(extension_dir);
- }
-
-#ifdef ZTS
- java_globals_id = ts_allocate_id(sizeof(php_java_globals),
- (ts_allocate_ctor)alloc_java_globals_ctor, NULL);
-#endif
-
- return SUCCESS;
-}
-
-
-PHP_MSHUTDOWN_FUNCTION(java) {
- JG_FETCH();
- UNREGISTER_INI_ENTRIES();
- if (JG(jvm)) jvm_destroy();
- return SUCCESS;
-}
-
-function_entry java_functions[] = {
- PHP_FE(java_last_exception_get, NULL)
- PHP_FE(java_last_exception_clear, NULL)
- {NULL, NULL, NULL}
-};
-
-
-static PHP_MINFO_FUNCTION(java) {
- DISPLAY_INI_ENTRIES();
-}
-
-zend_module_entry java_module_entry = {
- "java",
- java_functions,
- PHP_MINIT(java),
- PHP_MSHUTDOWN(java),
- NULL,
- NULL,
- PHP_MINFO(java),
- STANDARD_MODULE_PROPERTIES
-};
-
-ZEND_GET_MODULE(java)
-
-/***************************************************************************/
-
-JNIEXPORT void JNICALL Java_net_php_reflect_setResultFromString
- (JNIEnv *jenv, jclass self, jlong result, jbyteArray jvalue)
-{
- jboolean isCopy;
- jbyte *value = (*jenv)->GetByteArrayElements(jenv, jvalue, &isCopy);
- pval *presult = (pval*)(long)result;
- presult->type=IS_STRING;
- presult->value.str.len=(*jenv)->GetArrayLength(jenv, jvalue);
- presult->value.str.val=emalloc(presult->value.str.len+1);
- memcpy(presult->value.str.val, value, presult->value.str.len);
- presult->value.str.val[presult->value.str.len]=0;
- if (isCopy) (*jenv)->ReleaseByteArrayElements(jenv, jvalue, value, 0);
-}
-
-JNIEXPORT void JNICALL Java_net_php_reflect_setResultFromLong
- (JNIEnv *jenv, jclass self, jlong result, jlong value)
-{
- pval *presult = (pval*)(long)result;
- presult->type=IS_LONG;
- presult->value.lval=(long)value;
-}
-
-JNIEXPORT void JNICALL Java_net_php_reflect_setResultFromDouble
- (JNIEnv *jenv, jclass self, jlong result, jdouble value)
-{
- pval *presult = (pval*)(long)result;
- presult->type=IS_DOUBLE;
- presult->value.dval=value;
-}
-
-JNIEXPORT void JNICALL Java_net_php_reflect_setResultFromBoolean
- (JNIEnv *jenv, jclass self, jlong result, jboolean value)
-{
- pval *presult = (pval*)(long)result;
- presult->type=IS_BOOL;
- presult->value.lval=value;
-}
-
-JNIEXPORT void JNICALL Java_net_php_reflect_setResultFromObject
- (JNIEnv *jenv, jclass self, jlong result, jobject value)
-{
- /* wrapper the java object in a pval object */
- pval *presult = (pval*)(long)result;
- pval *handle;
-
- if (presult->type != IS_OBJECT) {
- presult->type=IS_OBJECT;
- presult->value.obj.ce=&java_class_entry;
- ALLOC_HASHTABLE(presult->value.obj.properties);
- presult->is_ref=1;
- presult->refcount=1;
- zend_hash_init(presult->value.obj.properties, 0, NULL, ZVAL_PTR_DTOR, 0);
- };
-
- ALLOC_ZVAL(handle);
- handle->type = IS_LONG;
- handle->value.lval =
- zend_list_insert((*jenv)->NewGlobalRef(jenv,value), le_jobject);
- pval_copy_constructor(handle);
- INIT_PZVAL(handle);
- zend_hash_index_update(presult->value.obj.properties, 0,
- &handle, sizeof(pval *), NULL);
-}
-
-JNIEXPORT void JNICALL Java_net_php_reflect_setResultFromArray
- (JNIEnv *jenv, jclass self, jlong result)
-{
- array_init( (pval*)(long)result );
-}
-
-JNIEXPORT jlong JNICALL Java_net_php_reflect_nextElement
- (JNIEnv *jenv, jclass self, jlong array)
-{
- pval *result;
- pval *handle = (pval*)(long)array;
- ALLOC_ZVAL(result);
- zend_hash_next_index_insert(handle->value.ht, &result, sizeof(zval *), NULL);
- return (jlong)(long)result;
-}
-
-JNIEXPORT jlong JNICALL Java_net_php_reflect_hashIndexUpdate
- (JNIEnv *jenv, jclass self, jlong array, jlong key)
-{
- pval *result;
- pval *handle = (pval*)(long)array;
- ALLOC_ZVAL(result);
- zend_hash_index_update(handle->value.ht, (unsigned long)key,
- &result, sizeof(zval *), NULL);
- return (jlong)(long)result;
-}
-
-JNIEXPORT jlong JNICALL Java_net_php_reflect_hashUpdate
- (JNIEnv *jenv, jclass self, jlong array, jbyteArray key)
-{
- pval *result;
- pval pkey;
- pval *handle = (pval*)(long)array;
- ALLOC_ZVAL(result);
- Java_net_php_reflect_setResultFromString(jenv, self, (jlong)(long)&pkey, key);
- zend_hash_update(handle->value.ht, pkey.value.str.val, pkey.value.str.len+1,
- &result, sizeof(zval *), NULL);
- return (jlong)(long)result;
-}
-
-JNIEXPORT void JNICALL Java_net_php_reflect_setException
- (JNIEnv *jenv, jclass self, jlong result, jbyteArray value)
-{
- pval *presult = (pval*)(long)result;
- Java_net_php_reflect_setResultFromString(jenv, self, result, value);
- presult->type=IS_EXCEPTION;
-}
-
-JNIEXPORT void JNICALL Java_net_php_reflect_setEnv
- (JNIEnv *newJenv, jclass self)
-{
- jobject local_php_reflect;
- JG_FETCH();
-
- iniUpdated=0;
- JG(jenv)=newJenv;
-
- if (!self) self = (*JG(jenv))->FindClass(JG(jenv), "net/php/reflect");
- JG(reflect_class) = self;
-
- if (JG(php_reflect)) (*JG(jenv))->DeleteGlobalRef(JG(jenv), JG(php_reflect));
- local_php_reflect = (*JG(jenv))->AllocObject(JG(jenv), JG(reflect_class));
- JG(php_reflect) = (*JG(jenv))->NewGlobalRef(JG(jenv), local_php_reflect);
-}
diff --git a/ext/rpc/java/java.dsp b/ext/rpc/java/java.dsp
deleted file mode 100644
index 603f685439..0000000000
--- a/ext/rpc/java/java.dsp
+++ /dev/null
@@ -1,258 +0,0 @@
-# Microsoft Developer Studio Project File - Name="java" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=java - Win32 Debug_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "java.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "java.mak" CFG="java - Win32 Debug_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "java - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "java - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "java - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "java - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "java - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "..\..\Release"
-# PROP BASE Intermediate_Dir "..\..\Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "..\..\Release"
-# PROP Intermediate_Dir "..\..\Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "PHP_WIN32" /D "ZEND_WIN32" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "$(JAVA_HOME)\include\win32" /I "$(JAVA_HOME)\include" /I "..\..\..\bindlib_w32" /D "NDEBUG" /D ZEND_DEBUG=0 /D "PHP_WIN32" /D "ZEND_WIN32" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_JAVA" /D HAVE_JAVA=1 /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "NDEBUG"
-# ADD RSC /l 0x40d /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\Release/php_java.dll" /libpath:"$(JAVA_HOME)\lib" /libpath:"..\..\Release"
-
-!ELSEIF "$(CFG)" == "java - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "..\..\Debug"
-# PROP BASE Intermediate_Dir "..\..\Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "..\..\Debug"
-# PROP Intermediate_Dir "..\..\Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "PHP_WIN32" /D "ZEND_WIN32" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\Zend" /I "$(JAVA_HOME)\include\win32" /I "$(JAVA_HOME)\include" /I "..\..\..\bindlib_w32" /D "_DEBUG" /D ZEND_DEBUG=1 /D "PHP_WIN32" /D "ZEND_WIN32" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_JAVA" /D HAVE_JAVA=1 /FR /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "_DEBUG"
-# ADD RSC /l 0x40d /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"..\..\Debug/php_java.dll" /pdbtype:sept /libpath:"$(JAVA_HOME)\lib" /libpath:"..\..\Debug"
-
-!ELSEIF "$(CFG)" == "java - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "..\..\Debug_TS"
-# PROP BASE Intermediate_Dir "..\..\Debug_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "..\..\Debug_TS"
-# PROP Intermediate_Dir "..\..\Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\..\Zend" /I "$(JAVA_HOME)\include\win32" /I "$(JAVA_HOME)\include" /I "..\..\..\bindlib_w32" /D "_DEBUG" /D "PHP_WIN32" /D "ZEND_WIN32" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_JAVA" /FR /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\..\\" /I "..\..\main" /I "..\..\TSRM" /I "..\..\Zend" /I "$(JAVA_HOME)\include\win32" /I "$(JAVA_HOME)\include" /I "..\..\..\bindlib_w32" /D "_DEBUG" /D ZEND_DEBUG=1 /D "ZTS" /D "PHP_WIN32" /D "ZEND_WIN32" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_JAVA" /D HAVE_JAVA=1 /FR /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "_DEBUG"
-# ADD RSC /l 0x40d /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts_debug.lib /nologo /dll /debug /machine:I386 /out:"..\..\Debug_TS/php_java.dll" /pdbtype:sept /libpath:"$(JAVA_HOME)\lib" /libpath:"..\..\Debug_TS"
-
-!ELSEIF "$(CFG)" == "java - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "..\..\Release_TS"
-# PROP BASE Intermediate_Dir "..\..\Release_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "..\..\Release_TS"
-# PROP Intermediate_Dir "..\..\Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\..\Zend" /I "$(JAVA_HOME)\include\win32" /I "$(JAVA_HOME)\include" /I "..\..\..\bindlib_w32" /D "NDEBUG" /D "PHP_WIN32" /D "ZEND_WIN32" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_JAVA" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\\" /I "..\..\main" /I "..\..\TSRM" /I "..\..\Zend" /I "$(JAVA_HOME)\include\win32" /I "$(JAVA_HOME)\include" /I "..\..\..\bindlib_w32" /D "NDEBUG" /D ZEND_DEBUG=0 /D "ZTS" /D "PHP_WIN32" /D "ZEND_WIN32" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_JAVA" /D HAVE_JAVA=1 /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "NDEBUG"
-# ADD RSC /l 0x40d /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_java.dll" /libpath:"$(JAVA_HOME)\lib" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
-
-!ENDIF
-
-# Begin Target
-
-# Name "java - Win32 Release"
-# Name "java - Win32 Debug"
-# Name "java - Win32 Debug_TS"
-# Name "java - Win32 Release_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\java.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\..\..\win32\winutil.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_java.h
-# End Source File
-# End Group
-# Begin Group "Java Files"
-
-# PROP Default_Filter "java"
-# Begin Source File
-
-SOURCE=.\reflect.java
-
-!IF "$(CFG)" == "java - Win32 Release"
-
-# Begin Custom Build
-OutDir=.\..\..\Release
-InputPath=.\reflect.java
-
-"$(OutDir)\php_java.jar" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- if not exist net mkdir net
- if not exist net\php mkdir net\php
- copy $(InputPath) net\php > nul
- echo library=php_java>net\php\reflect.properties
- $(JAVA_HOME)\bin\javac net\php\reflect.java
- $(JAVA_HOME)\bin\jar c0f $(OutDir)\php_java.jar net\php\*.class net\php\*.properties
- erase net\php\reflect.*
- rmdir net\php
- rmdir net
-
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "java - Win32 Debug"
-
-# Begin Custom Build
-OutDir=.\..\..\Debug
-InputPath=.\reflect.java
-
-"$(OutDir)\php_java.jar" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- if not exist net mkdir net
- if not exist net\php mkdir net\php
- copy $(InputPath) net\php > nul
- echo library=php_java>net\php\reflect.properties
- $(JAVA_HOME)\bin\javac -g net\php\reflect.java
- $(JAVA_HOME)\bin\jar c0f $(OutDir)\php_java.jar net\php\*.class net\php\*.properties
- erase net\php\reflect.*
- rmdir net\php
- rmdir net
-
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "java - Win32 Debug_TS"
-
-# Begin Custom Build
-OutDir=.\..\..\Debug_TS
-InputPath=.\reflect.java
-
-"$(OutDir)\php_java.jar" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- if not exist net mkdir net
- if not exist net\php mkdir net\php
- copy $(InputPath) net\php > nul
- echo library=php_java>net\php\reflect.properties
- $(JAVA_HOME)\bin\javac -g net\php\reflect.java
- $(JAVA_HOME)\bin\jar c0f $(OutDir)\php_java.jar net\php\*.class net\php\*.properties
- erase net\php\reflect.*
- rmdir net\php
- rmdir net
-
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "java - Win32 Release_TS"
-
-# Begin Custom Build
-OutDir=.\..\..\Release_TS
-InputPath=.\reflect.java
-
-"$(OutDir)\php_java.jar" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- if not exist net mkdir net
- if not exist net\php mkdir net\php
- copy $(InputPath) net\php > nul
- echo library=php_java>net\php\reflect.properties
- $(JAVA_HOME)\bin\javac net\php\reflect.java
- $(JAVA_HOME)\bin\jar c0f $(OutDir)\php_java.jar net\php\*.class net\php\*.properties
- erase net\php\reflect.*
- rmdir net\php
- rmdir net
-
-# End Custom Build
-
-!ENDIF
-
-# End Source File
-# End Group
-# Begin Source File
-
-SOURCE=.\jtest.php
-# End Source File
-# End Target
-# End Project
diff --git a/ext/rpc/java/jawt.php b/ext/rpc/java/jawt.php
deleted file mode 100644
index 30f2235611..0000000000
--- a/ext/rpc/java/jawt.php
+++ /dev/null
@@ -1,27 +0,0 @@
-<?
-
- // This example is only intented to be run as a CGI.
-
- $frame = new Java("java.awt.Frame", "Zend");
- $button = new Java("java.awt.Button", "Hello Java world!");
- $frame->add("North", $button);
- $frame->validate();
- $frame->pack();
- $frame->visible = True;
-
- $thread = new Java("java.lang.Thread");
- $thread->sleep(10000);
-
- $frame->dispose();
-
- // Odd behavior noted with Sun JVMs:
- //
- // 1) $thread->destroy() will fail with a NoSuchMethodError exception.
- // 2) The call to (*jvm)->DestroyJVM(jvm) made when PHP terminates
- // will hang, unless _BOTH_ the calls to pack and setVisible above
- // are removed.
- //
- // Even more odd: both effects are seen with a 100% Java implementation
- // of the above!
-
-?>
diff --git a/ext/rpc/java/jver.php b/ext/rpc/java/jver.php
deleted file mode 100644
index 7015944101..0000000000
--- a/ext/rpc/java/jver.php
+++ /dev/null
@@ -1,17 +0,0 @@
-<html>
-<?
-
- $system = new Java("java.lang.System");
- print "Java version=".$system->getProperty("java.version")." <br>\n";
- print "Java vendor=".$system->getProperty("java.vendor")." <p>\n\n";
- print "OS=".$system->getProperty("os.name")." ".
- $system->getProperty("os.version")." on ".
- $system->getProperty("os.arch")." <br>\n";
-
- $formatter = new Java("java.text.SimpleDateFormat",
- "EEEE, MMMM dd, yyyy 'at' h:mm:ss a zzzz");
-
- print $formatter->format(new Java("java.util.Date"))."\n";
-
-?>
-</html>
diff --git a/ext/rpc/java/reflect.java b/ext/rpc/java/reflect.java
deleted file mode 100644
index 3e924d975b..0000000000
--- a/ext/rpc/java/reflect.java
+++ /dev/null
@@ -1,419 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Sam Ruby (rubys@us.ibm.com) |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-package net.php;
-
-import java.lang.reflect.*;
-import java.util.*;
-import java.beans.*;
-
-public class reflect {
-
- static { loadLibrary("reflect"); }
-
- protected static void loadLibrary(String property) {
- try {
- ResourceBundle bundle = ResourceBundle.getBundle("net.php."+property);
- System.loadLibrary(bundle.getString("library"));
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- //
- // Native methods
- //
- private static native void setResultFromString(long result, byte value[]);
- private static native void setResultFromLong(long result, long value);
- private static native void setResultFromDouble(long result, double value);
- private static native void setResultFromBoolean(long result, boolean value);
- private static native void setResultFromObject(long result, Object value);
- private static native void setResultFromArray(long result);
- private static native long nextElement(long array);
- private static native long hashUpdate(long array, byte key[]);
- private static native long hashIndexUpdate(long array, long key);
- private static native void setException(long result, byte value[]);
- public static native void setEnv();
-
- //
- // Helper routines which encapsulate the native methods
- //
- public static void setResult(long result, Object value) {
- if (value == null) return;
-
- if (value instanceof java.lang.String) {
-
- setResultFromString(result, ((String)value).getBytes());
-
- } else if (value instanceof java.lang.Number) {
-
- if (value instanceof java.lang.Integer ||
- value instanceof java.lang.Short ||
- value instanceof java.lang.Byte) {
- setResultFromLong(result, ((Number)value).longValue());
- } else {
- /* Float, Double, BigDecimal, BigInteger, Double, Long, ... */
- setResultFromDouble(result, ((Number)value).doubleValue());
- }
-
- } else if (value instanceof java.lang.Boolean) {
-
- setResultFromBoolean(result, ((Boolean)value).booleanValue());
-
- } else if (value.getClass().isArray()) {
-
- long length = Array.getLength(value);
- setResultFromArray(result);
- for (int i=0; i<length; i++) {
- setResult(nextElement(result), Array.get(value, i));
- }
-
- } else if (value instanceof java.util.Hashtable) {
-
- Hashtable ht = (Hashtable) value;
- setResultFromArray(result);
- for (Enumeration e = ht.keys(); e.hasMoreElements(); ) {
- Object key = e.nextElement();
- long slot;
- if (key instanceof Number &&
- !(key instanceof Double || key instanceof Float))
- slot = hashIndexUpdate(result, ((Number)key).longValue());
- else
- slot = hashUpdate(result, key.toString().getBytes());
- setResult(slot, ht.get(key));
- }
-
- } else {
-
- setResultFromObject(result, value);
-
- }
- }
-
- Throwable lastException = null;
-
- void lastException(long result) {
- setResult(result, lastException);
- }
-
- void clearException() {
- lastException = null;
- }
-
- void setException(long result, Throwable e) {
- if (e instanceof InvocationTargetException) {
- Throwable t = ((InvocationTargetException)e).getTargetException();
- if (t!=null) e=t;
- }
-
- lastException = e;
- setException(result, e.toString().getBytes());
- }
-
- //
- // Create an new instance of a given class
- //
- public void CreateObject(String name, Object args[], long result) {
- try {
- Vector matches = new Vector();
-
- Constructor cons[] = Class.forName(name).getConstructors();
- for (int i=0; i<cons.length; i++) {
- if (cons[i].getParameterTypes().length == args.length) {
- matches.addElement(cons[i]);
- }
- }
-
- Constructor selected = (Constructor)select(matches, args);
-
- if (selected == null) {
- if (args.length > 0) {
- throw new InstantiationException("No matching constructor found");
- } else {
- // for classes which have no visible constructor, return the class
- // useful for classes like java.lang.System and java.util.Calendar.
- setResult(result, Class.forName(name));
- return;
- }
- }
-
- Object coercedArgs[] = coerce(selected.getParameterTypes(), args);
- setResultFromObject(result, selected.newInstance(coercedArgs));
-
- } catch (Exception e) {
- setException(result, e);
- }
- }
-
- //
- // Select the best match from a list of methods
- //
- private static Object select(Vector methods, Object args[]) {
- if (methods.size() == 1) return methods.firstElement();
-
- Object selected = null;
- int best = Integer.MAX_VALUE;
-
- for (Enumeration e = methods.elements(); e.hasMoreElements(); ) {
- Object element = e.nextElement();
- int weight=0;
-
- Class parms[] = (element instanceof Method) ?
- ((Method)element).getParameterTypes() :
- ((Constructor)element).getParameterTypes();
-
- for (int i=0; i<parms.length; i++) {
- if (parms[i].isInstance(args[i])) {
- for (Class c=parms[i]; (c=c.getSuperclass()) != null; ) {
- if (!c.isInstance(args[i])) break;
- weight++;
- }
- } else if (parms[i].isAssignableFrom(java.lang.String.class)) {
- if (!(args[i] instanceof byte[]) && !(args[i] instanceof String))
- weight+=9999;
- } else if (parms[i].isArray()) {
- if (args[i] instanceof java.util.Hashtable)
- weight+=256;
- else
- weight+=9999;
- } else if (parms[i].isPrimitive()) {
- Class c=parms[i];
- if (args[i] instanceof Number) {
- if (c==Boolean.TYPE) weight+=5;
- if (c==Character.TYPE) weight+=4;
- if (c==Byte.TYPE) weight+=3;
- if (c==Short.TYPE) weight+=2;
- if (c==Integer.TYPE) weight++;
- if (c==Float.TYPE) weight++;
- } else if (args[i] instanceof Boolean) {
- if (c!=Boolean.TYPE) weight+=9999;
- } else if (args[i] instanceof String) {
- if (c== Character.TYPE || ((String)args[i]).length()>0)
- weight+=((String)args[i]).length();
- else
- weight+=64;
- } else {
- weight+=9999;
- }
- } else {
- weight+=9999;
- }
- }
-
- if (weight < best) {
- if (weight == 0) return element;
- best = weight;
- selected = element;
- }
- }
-
- return selected;
- }
-
- //
- // Coerce arguments when possible to conform to the argument list.
- // Java's reflection will automatically do widening conversions,
- // unfortunately PHP only supports wide formats, so to be practical
- // some (possibly lossy) conversions are required.
- //
- private static Object[] coerce(Class parms[], Object args[]) {
- Object result[] = args;
- for (int i=0; i<args.length; i++) {
- if (args[i] instanceof byte[] && !parms[i].isArray()) {
- Class c = parms[i];
- String s = new String((byte[])args[i]);
- result[i] = s;
- try {
- if (c == Boolean.TYPE) result[i]=new Boolean(s);
- if (c == Byte.TYPE) result[i]=new Byte(s);
- if (c == Short.TYPE) result[i]=new Short(s);
- if (c == Integer.TYPE) result[i]=new Integer(s);
- if (c == Float.TYPE) result[i]=new Float(s);
- if (c == Long.TYPE) result[i]=new Long(s);
- if (c == Character.TYPE && s.length()>0)
- result[i]=new Character(s.charAt(0));
- } catch (NumberFormatException n) {
- // oh well, we tried!
- }
- } else if (args[i] instanceof Number && parms[i].isPrimitive()) {
- if (result==args) result=(Object[])result.clone();
- Class c = parms[i];
- Number n = (Number)args[i];
- if (c == Boolean.TYPE) result[i]=new Boolean(0.0!=n.floatValue());
- if (c == Byte.TYPE) result[i]=new Byte(n.byteValue());
- if (c == Short.TYPE) result[i]=new Short(n.shortValue());
- if (c == Integer.TYPE) result[i]=new Integer(n.intValue());
- if (c == Float.TYPE) result[i]=new Float(n.floatValue());
- if (c == Long.TYPE && !(n instanceof Long))
- result[i]=new Long(n.longValue());
- } else if (args[i] instanceof Hashtable && parms[i].isArray()) {
- try {
- Hashtable ht = (Hashtable)args[i];
- int size = ht.size();
-
- // Verify that the keys are Long, and determine maximum
- for (Enumeration e = ht.keys(); e.hasMoreElements(); ) {
- int index = ((Long)e.nextElement()).intValue();
- if (index >= size) size = index+1;
- }
-
- Object tempArray[] = new Object[size];
- Class tempTarget[] = new Class[size];
- Class targetType = parms[i].getComponentType();
-
- // flatten the hash table into an array
- for (int j=0; j<size; j++) {
- tempArray[j] = ht.get(new Long(j));
- if (tempArray[j] == null && targetType.isPrimitive())
- throw new Exception("bail");
- tempTarget[j] = targetType;
- }
-
- // coerce individual elements into the target type
- Object coercedArray[] = coerce(tempTarget, tempArray);
-
- // copy the results into the desired array type
- Object array = Array.newInstance(targetType,size);
- for (int j=0; j<size; j++) {
- Array.set(array, j, coercedArray[j]);
- }
-
- result[i]=array;
- } catch (Exception e) {
- // leave result[i] alone...
- }
- }
- }
- return result;
- }
-
- //
- // Invoke a method on a given object
- //
- public void Invoke
- (Object object, String method, Object args[], long result)
- {
- try {
- Vector matches = new Vector();
-
- // gather
- for (Class jclass = object.getClass();;jclass=(Class)object) {
- while (!Modifier.isPublic(jclass.getModifiers())) {
- // OK, some joker gave us an instance of a non-public class
- // This often occurs in the case of enumerators
- // Substitute the first public interface in its place,
- // and barring that, try the superclass
- Class interfaces[] = jclass.getInterfaces();
- jclass=jclass.getSuperclass();
- for (int i=interfaces.length; i-->0;) {
- if (Modifier.isPublic(interfaces[i].getModifiers())) {
- jclass=interfaces[i];
- }
- }
- }
- Method methods[] = jclass.getMethods();
- for (int i=0; i<methods.length; i++) {
- if (methods[i].getName().equalsIgnoreCase(method) &&
- methods[i].getParameterTypes().length == args.length) {
- matches.addElement(methods[i]);
- }
- }
-
- // try a second time with the object itself, if it is of type Class
- if (!(object instanceof Class) || (jclass==object)) break;
- }
-
- Method selected = (Method)select(matches, args);
- if (selected == null) throw new NoSuchMethodException(method);
-
- Object coercedArgs[] = coerce(selected.getParameterTypes(), args);
- setResult(result, selected.invoke(object, coercedArgs));
-
- } catch (Exception e) {
- setException(result, e);
- }
- }
-
- //
- // Get or Set a property
- //
- public void GetSetProp
- (Object object, String prop, Object args[], long result)
- {
- try {
-
- for (Class jclass = object.getClass();;jclass=(Class)object) {
- while (!Modifier.isPublic(jclass.getModifiers())) {
- // OK, some joker gave us an instance of a non-public class
- // Substitute the first public interface in its place,
- // and barring that, try the superclass
- Class interfaces[] = jclass.getInterfaces();
- jclass=jclass.getSuperclass();
- for (int i=interfaces.length; i-->0;) {
- if (Modifier.isPublic(interfaces[i].getModifiers())) {
- jclass=interfaces[i];
- }
- }
- }
- BeanInfo beanInfo = Introspector.getBeanInfo(jclass);
- PropertyDescriptor props[] = beanInfo.getPropertyDescriptors();
- for (int i=0; i<props.length; i++) {
- if (props[i].getName().equalsIgnoreCase(prop)) {
- Method method;
- if (args!=null && args.length>0) {
- method=props[i].getWriteMethod();
- args = coerce(method.getParameterTypes(), args);
- } else {
- method=props[i].getReadMethod();
- }
- setResult(result, method.invoke(object, args));
- return;
- }
- }
-
- Field jfields[] = jclass.getFields();
- for (int i=0; i<jfields.length; i++) {
- if (jfields[i].getName().equalsIgnoreCase(prop)) {
- if (args!=null && args.length>0) {
- args = coerce(new Class[] {jfields[i].getType()}, args);
- jfields[i].set(object, args[0]);
- } else {
- setResult(result, jfields[i].get(object));
- }
- return;
- }
- }
-
- // try a second time with the object itself, if it is of type Class
- if (!(object instanceof Class) || (jclass==object)) break;
- }
-
- } catch (Exception e) {
- setException(result, e);
- }
- }
-
- //
- // Helper routines for the C implementation
- //
- public Object MakeArg(boolean b) { return new Boolean(b); }
- public Object MakeArg(long l) { return new Long(l); }
- public Object MakeArg(double d) { return new Double(d); }
-}
diff --git a/ext/sablot/CREDITS b/ext/sablot/CREDITS
deleted file mode 100644
index 27a16ce0d9..0000000000
--- a/ext/sablot/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-Sablotron XSLT
-Sterling Hughes
diff --git a/ext/sablot/EXPERIMENTAL b/ext/sablot/EXPERIMENTAL
deleted file mode 100644
index 6443e99646..0000000000
--- a/ext/sablot/EXPERIMENTAL
+++ /dev/null
@@ -1,5 +0,0 @@
-this extension is experimental,
-its functions may change their names
-or move to extension all together
-so do not rely to much on them
-you have been warned!
diff --git a/ext/sablot/Makefile.in b/ext/sablot/Makefile.in
deleted file mode 100644
index d6cc91eb60..0000000000
--- a/ext/sablot/Makefile.in
+++ /dev/null
@@ -1,8 +0,0 @@
-# $Id $
-
-LTLIBRARY_NAME = libsablot.la
-LTLIBRARY_SOURCES = sablot.c
-LTLIBRARY_SHARED_NAME = sablot.la
-LTLIBRARY_SHARED_LIBADD = $(SABLOT_SHARED_LIBADD)
-
-include $(top_srcdir)/build/dynlib.mk
diff --git a/ext/sablot/config.m4 b/ext/sablot/config.m4
deleted file mode 100644
index 1710e13d5d..0000000000
--- a/ext/sablot/config.m4
+++ /dev/null
@@ -1,69 +0,0 @@
-dnl $Id$
-dnl config.m4 for extension Sablot
-
-PHP_ARG_WITH(sablot, for Sablotron XSL support,
-[ --with-sablot[=DIR] Include Sablotron support])
-
-PHP_ARG_WITH(expat-dir, libexpat dir for Sablotron 0.50,
-[ --with-expat-dir=DIR Sablotron: libexpat dir for Sablotron 0.50])
-
-if test "$PHP_SABLOT" != "no"; then
-
- PHP_EXTENSION(sablot, $ext_shared)
- PHP_SUBST(SABLOT_SHARED_LIBADD)
-
- if test -r $PHP_SABLOT/include/sablot.h; then
- SABLOT_DIR=$PHP_SABLOT
- else
- AC_MSG_CHECKING(for Sablotron in default path)
- for i in /usr/local /usr; do
- if test -r $i/include/sablot.h; then
- SABLOT_DIR=$i
- AC_MSG_RESULT(found in $i)
- fi
- done
- fi
-
- if test -z "$SABLOT_DIR"; then
- AC_MSG_RESULT(not found)
- AC_MSG_ERROR(Please reinstall the Sablotron distribution)
- fi
-
- PHP_ADD_INCLUDE($SABLOT_DIR/include)
- PHP_ADD_LIBRARY_WITH_PATH(sablot, $SABLOT_DIR/lib, SABLOT_SHARED_LIBADD)
-
- testval=no
- for i in $PHP_EXPAT_DIR $SABLOT_DIR; do
- if test -f $i/lib/libexpat.a -o -f $i/lib/libexpat.s?; then
- AC_DEFINE(HAVE_LIBEXPAT2,1,[ ])
- PHP_ADD_LIBRARY_WITH_PATH(expat, $i/lib)
- PHP_ADD_INCLUDE($i/include)
- AC_CHECK_LIB(sablot, SablotSetEncoding, AC_DEFINE(HAVE_SABLOT_SET_ENCODING,1,[ ]))
- testval=yes
- fi
- done
-
- if test "$testval" = "no"; then
- PHP_ADD_LIBRARY(xmlparse)
- PHP_ADD_LIBRARY(xmltok)
- fi
-
- found_iconv=no
- AC_CHECK_LIB(c, iconv_open, found_iconv=yes)
- if test "$found_iconv" = "no"; then
- if test "$PHP_ICONV" = "no"; then
- for i in /usr /usr/local; do
- if test -f $i/lib/libconv.a -o -f $i/lib/libiconv.s?; then
- PHP_ADD_LIBRARY_WITH_PATH(iconv, $i/lib)
- found_iconv=yes
- fi
- done
- fi
- fi
-
- if test "$found_iconv" = "no"; then
- AC_MSG_ERROR(iconv not found, in order to build sablotron you need the iconv library)
- fi
-
- AC_DEFINE(HAVE_SABLOT,1,[ ])
-fi
diff --git a/ext/sablot/php_sablot.h b/ext/sablot/php_sablot.h
deleted file mode 100644
index b6c55962d8..0000000000
--- a/ext/sablot/php_sablot.h
+++ /dev/null
@@ -1,150 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Sterling Hughes <sterling@php.net> |
- +----------------------------------------------------------------------+
- */
-
-#ifndef PHP_SABLOT_H
-#define PHP_SABLOT_H
-
-#if HAVE_SABLOT
-
-#include <sablot.h>
-
-extern zend_module_entry sablot_module_entry;
-#define phpext_sablot_ptr &sablot_module_entry
-
-#ifdef PHP_WIN32
-#define PHP_SABLOT_API __declspec(dllexport)
-#else
-#define PHP_SABLOT_API
-#endif
-
-/* Module functions */
-PHP_MINIT_FUNCTION(sablot);
-PHP_MINFO_FUNCTION(sablot);
-PHP_MSHUTDOWN_FUNCTION(sablot);
-
-/* Request functions */
-PHP_RSHUTDOWN_FUNCTION(sablot);
-
-/* Output transformation functions */
-PHP_FUNCTION(xslt_output_begintransform);
-PHP_FUNCTION(xslt_output_endtransform);
-
-/* Basic transformation functions */
-PHP_FUNCTION(xslt_transform);
-PHP_FUNCTION(xslt_process);
-
-/* Advanced API transformation functions */
-PHP_FUNCTION(xslt_create);
-PHP_FUNCTION(xslt_run);
-PHP_FUNCTION(xslt_set_sax_handler);
-PHP_FUNCTION(xslt_set_scheme_handler);
-PHP_FUNCTION(xslt_set_error_handler);
-#ifdef HAVE_SABLOT_SET_ENCODING
-PHP_FUNCTION(xslt_set_encoding);
-#endif
-PHP_FUNCTION(xslt_set_base);
-PHP_FUNCTION(xslt_fetch_result);
-PHP_FUNCTION(xslt_free);
-
-/* Error Handling functions */
-PHP_FUNCTION(xslt_error);
-PHP_FUNCTION(xslt_errno);
-PHP_FUNCTION(xslt_openlog);
-PHP_FUNCTION(xslt_closelog);
-
-/* Sablotron error structure */
-struct _php_sablot_error {
- char *key;
- char *value;
- struct _php_sablot_error *next;
-};
-
-typedef struct _php_sablot_error php_sablot_error;
-
-
-/* Sablotron Handle */
-typedef struct {
-
- /* Error Handling */
- zval *errorHandler;
- php_sablot_error *errors;
- php_sablot_error errors_start;
- int last_errno;
-
- /* SAX Handling */
- long index;
- zval *startDocHandler;
- zval *startElementHandler;
- zval *endElementHandler;
- zval *startNamespaceHandler;
- zval *endNamespaceHandler;
- zval *commentHandler;
- zval *PIHandler;
- zval *charactersHandler;
- zval *endDocHandler;
-
- /* Scheme Handling */
- zval *getAllHandler;
-
- /* Sablotron Related */
- SablotHandle p;
-
-} php_sablot;
-
-
-/* Sablotron Globals */
-typedef struct {
- zval *errorHandler;
- php_sablot_error *errors;
- php_sablot_error errors_start;
- char *output_transform_file; /* For output transformations */
- int last_errno; /* Global last_errno, if no handle is found */
- SablotHandle processor;
-} php_sablot_globals;
-
-
-#ifdef ZTS
-#define SABLOTG(v) (sablot_globals->v)
-#define SABLOTLS_FETCH() php_sablot_globals *sablot_globals = ts_resource(sablot_globals_id)
-#define SABLOTG_HANDLE (*sablot_globals)
-#define SABLOTLS_C sablot_globals
-#define SABLOTLS_CC , SABLOTLS_C
-#define SABLOTLS_D php_sablot_globals *sablot_globals
-#define SABLOTLS_DC , SABLOTLS_D
-#else
-#define SABLOTG(v) (sablot_globals.v)
-#define SABLOTG_HANDLE sablot_globals
-#define SABLOTLS_FETCH()
-#define SABLOTLS_C
-#define SABLOTLS_CC
-#define SABLOTLS_D
-#define SABLOTLS_DC
-#endif
-
-#else
-#define phpext_sablot_ptr NULL
-#endif
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/sablot/sablot.c b/ext/sablot/sablot.c
deleted file mode 100644
index dbe3fcc873..0000000000
--- a/ext/sablot/sablot.c
+++ /dev/null
@@ -1,1698 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Sterling Hughes <sterling@php.net> |
- +----------------------------------------------------------------------+
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-
-#if HAVE_SABLOT
-
-/* Sablotron Includes */
-#include <sablot.h>
-
-/* Standard Includes */
-#include <string.h>
-
-/* PHP Includes */
-#include "ext/standard/info.h"
-#include "ext/standard/php_output.h"
-#include "php_sablot.h"
-
-static int le_sablot;
-
-/* Functions related to PHP's list handling */
-static void _php_sablot_free_processor(zend_rsrc_list_entry *rsrc);
-
-/* SAX Handlers */
-static void _php_sablot_handler_pair(php_sablot *, zval **, zval **, zval **);
-static void _php_sablot_call_handler_function(zval *, int, zval **, char *);
-static SAX_RETURN _php_sablot_sax_startDoc(void *);
-static SAX_RETURN _php_sablot_sax_startElement(void *, const char *, const char **);
-static SAX_RETURN _php_sablot_sax_endElement(void *, const char *);
-static SAX_RETURN _php_sablot_sax_startNamespace(void *, const char *, const char *);
-static SAX_RETURN _php_sablot_sax_endNamespace(void *, const char *);
-static SAX_RETURN _php_sablot_sax_comment(void *, const char *);
-static SAX_RETURN _php_sablot_sax_PI(void *, const char *, const char *);
-static SAX_RETURN _php_sablot_sax_characters(void *, const char *, int);
-static SAX_RETURN _php_sablot_sax_endDoc(void *);
-
-/* Error Handling Functions */
-static MH_ERROR _php_sablot_make_code(void *, SablotHandle, int, unsigned short, unsigned short);
-static MH_ERROR _php_sablot_error(void *, SablotHandle, MH_ERROR, MH_LEVEL, char **);
-static void _php_sablot_standard_error(php_sablot_error *, php_sablot_error, int, int);
-
-/* Scheme Handling Functions */
-static int _php_sablot_sh_getAll(void *userData, SablotHandle p, const char *scheme, const char *rest, char **buffer, int *byteCount);
-static int _php_sablot_sh_freeMemory(void *userData, SablotHandle p, char *buffer);
-static int _php_sablot_sh_open(void *userData, SablotHandle p, const char *scheme, const char *rest, int *handle);
-static int _php_sablot_sh_get(void *userData, SablotHandle p, int handle, char *buffer, int *byteCount);
-static int _php_sablot_sh_put(void *userData, SablotHandle p, int handle, const char *buffer, int *byteCount);
-static int _php_sablot_sh_close(void *userData, SablotHandle p, int handle);
-
-/* PHP Utility Functions */
-static void _php_sablot_ht_char(HashTable *, char **);
-static zval *_php_sablot_string_zval(const char *);
-static zval *_php_sablot_resource_zval(long);
-
-/* Macro's */
-
-/* Free macros */
-#define S_FREE(__var) if (__var) { efree(__var); __var = NULL; }
-#define FUNCH_FREE(__var) if (__var) zval_ptr_dtor(&(__var));
-
-/* ERROR Macros */
-
-#define SABLOT_FREE_ERROR_HANDLE(__handle) \
- if ((__handle).errors) { \
- (__handle).errors = (__handle).errors_start.next; \
- while ((__handle).errors) { \
- S_FREE((__handle).errors->key); \
- S_FREE((__handle).errors->value); \
- (__handle).errors = (__handle).errors->next; \
- } \
- S_FREE((__handle).errors); \
- }
-
-
-/* Sablotron Basic Api macro's */
-#define SABLOT_BASIC_CREATE_PROCESSOR() \
- if (SABLOTG(processor) == NULL) { \
- int ret = 0; \
- \
- ret = SablotCreateProcessor(&SABLOTG(processor)); \
- if (ret) { \
- SABLOTG(last_errno) = (int) ret; \
- return; \
- } \
- \
- ret = SablotRegHandler(SABLOTG(processor), HLR_MESSAGE, (void *)&mh, (void *)NULL); \
- if (ret) { \
- SABLOTG(last_errno) = (int) ret; \
- return; \
- } \
- }
-
-#define SABLOT_BASIC_HANDLE SABLOTG(processor)
-
-#define SABLOT_SET_ERROR(handle, error) \
- if (error != 0) { \
- if (handle) { \
- handle->last_errno = error; \
- } \
- \
- SABLOTG(last_errno) = error; \
- }
-
-/**
- * SAX Handler structure, this defines the different functions to be
- * called when Sablotron's internal expat parser reaches the
- * different callbacks. These are the same as the functions which are
- * defined for expat.
- */
-static SAXHandler sax = {
- _php_sablot_sax_startDoc,
- _php_sablot_sax_startElement,
- _php_sablot_sax_endElement,
- _php_sablot_sax_startNamespace,
- _php_sablot_sax_endNamespace,
- _php_sablot_sax_comment,
- _php_sablot_sax_PI,
- _php_sablot_sax_characters,
- _php_sablot_sax_endDoc
-};
-
-
-/**
- * Message Handler structure for use when Sablotron
- * reports that something has gone wrong.
- */
-static MessageHandler mh = {
- _php_sablot_make_code,
- _php_sablot_error,
- _php_sablot_error
-};
-
-/**
- * Scheme Handler structure for use when Sablotron
- * call rhe document Xpath function.
- */
-static SchemeHandler sh = {
- _php_sablot_sh_getAll,
- _php_sablot_sh_freeMemory,
- _php_sablot_sh_open,
- _php_sablot_sh_get,
- _php_sablot_sh_put,
- _php_sablot_sh_close
-};
-
-#ifdef ZTS
-int sablot_globals_id;
-#else
-php_sablot_globals sablot_globals;
-#endif
-
-
-static unsigned char sixth_arg_force_ref[] = { 6, BYREF_NONE, BYREF_NONE, BYREF_NONE, BYREF_NONE, BYREF_NONE, BYREF_FORCE };
-static unsigned char third_arg_force_ref[] = { 4, BYREF_NONE, BYREF_NONE, BYREF_FORCE, BYREF_NONE };
-
-function_entry sablot_functions[] = {
- PHP_FE(xslt_output_begintransform, NULL)
- PHP_FE(xslt_output_endtransform, NULL)
- PHP_FE(xslt_transform, sixth_arg_force_ref)
- PHP_FE(xslt_process, third_arg_force_ref)
- PHP_FE(xslt_create, NULL)
- PHP_FE(xslt_run, NULL)
- PHP_FE(xslt_fetch_result, NULL)
- PHP_FE(xslt_openlog, NULL)
- PHP_FE(xslt_closelog, NULL)
- PHP_FE(xslt_set_sax_handler, NULL)
- PHP_FE(xslt_set_scheme_handler, NULL)
- PHP_FE(xslt_set_error_handler, NULL)
- PHP_FE(xslt_set_base, NULL)
-#ifdef HAVE_SABLOT_SET_ENCODING
- PHP_FE(xslt_set_encoding, NULL)
-#endif
- PHP_FE(xslt_free, NULL)
- PHP_FE(xslt_error, NULL)
- PHP_FE(xslt_errno, NULL)
- {NULL, NULL, NULL}
-};
-
-zend_module_entry sablot_module_entry = {
- "sablot",
- sablot_functions,
- PHP_MINIT(sablot),
- PHP_MSHUTDOWN(sablot),
- NULL,
- PHP_RSHUTDOWN(sablot),
- PHP_MINFO(sablot),
- STANDARD_MODULE_PROPERTIES
-};
-
-#ifdef COMPILE_DL_SABLOT
-ZEND_GET_MODULE(sablot)
-#endif
-
-static void php_sablot_init_globals(SABLOTLS_D)
-{
- SABLOTG(processor) = NULL;
- SABLOTG(errors) = NULL;
- SABLOTG(errorHandler) = NULL;
- SABLOTG(output_transform_file) = NULL;
-}
-
-
-/* MINIT and MINFO Functions */
-PHP_MINIT_FUNCTION(sablot)
-{
-#ifdef ZTS
- sablot_globals_id = ts_allocate_id(sizeof(php_sablot_globals), (ts_allocate_ctor)php_sablot_init_globals, NULL);
-#else
- php_sablot_init_globals(SABLOTLS_C);
-#endif
-
- le_sablot = zend_register_list_destructors_ex(_php_sablot_free_processor, NULL, "Sablotron XSLT", module_number);
-
- return SUCCESS;
-}
-
-PHP_MSHUTDOWN_FUNCTION(sablot)
-{
- SABLOTLS_FETCH();
- if (SABLOTG(processor)) {
- SablotUnregHandler(SABLOTG(processor), HLR_MESSAGE, NULL, NULL);
- SablotDestroyProcessor(SABLOTG(processor));
- }
-
- return SUCCESS;
-}
-
-PHP_RSHUTDOWN_FUNCTION(sablot)
-{
- SABLOTLS_FETCH();
-
- SABLOT_FREE_ERROR_HANDLE(SABLOTG_HANDLE);
-
- return SUCCESS;
-}
-
-PHP_MINFO_FUNCTION(sablot)
-{
- php_info_print_table_start();
- php_info_print_table_row(2, "Sablotron XSLT support", "enabled");
- php_info_print_table_end();
-
-}
-
-/* {{{ proto void xslt_output_begintransform(string file)
- Begin filtering of all data that is being printed out through the XSL file given by the file parameter. */
-PHP_FUNCTION(xslt_output_begintransform)
-{
- /* The name of the file to pass the output through */
- zval **file;
-
- /* needed for the output transformation file name */
- SABLOTLS_FETCH();
-
- if (ZEND_NUM_ARGS() != 1 ||
- zend_get_parameters_ex(1, &file) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(file);
-
- /* If the buffer exists, free it */
- S_FREE(SABLOTG(output_transform_file));
-
- SABLOTG(output_transform_file) = estrndup(Z_STRVAL_PP(file), Z_STRLEN_PP(file));
-
- /**
- * Start output buffering, NULL signifies that no "user-space" output function
- * will be used. The 0 disables chunking
- */
- php_start_ob_buffer(NULL, 0);
-}
-/* }}} */
-
-/* {{{ proto void xslt_output_endtranform(void)
- End filtering that data through the XSL file set by xslt_output_transform() and output the data */
-PHP_FUNCTION(xslt_output_endtransform)
-{
- char *tRes = NULL,
- *buffer = NULL;
- int ret = 0;
-
- /* Fetch both the output globals and the sablotron globals */
- OLS_FETCH();
- SABLOTLS_FETCH();
-
- /**
- * Make sure that we don't have more than one output buffer going on
- * at the same time.
- */
- if (OG(nesting_level) == 0) {
- RETURN_NULL();
- }
-
- buffer = estrndup(OG(active_ob_buffer).buffer, OG(active_ob_buffer).text_length);
-
- /* Nake sure there is data to send */
- if (OG(active_ob_buffer).text_length) {
- char *args[] = {"/_xmlinput", buffer,
- "/_output", NULL};
-
- SABLOT_BASIC_CREATE_PROCESSOR();
-
- ret = SablotRunProcessor(SABLOT_BASIC_HANDLE, SABLOTG(output_transform_file),
- "arg:/_xmlinput", "arg:/_output", NULL, args);
-
- if (ret) {
- SABLOTG(last_errno) = ret;
- S_FREE(SABLOTG(output_transform_file));
- RETURN_NULL();
- }
-
- ret = SablotGetResultArg(SABLOT_BASIC_HANDLE, "arg:/_output", &tRes);
-
- if (ret) {
- SABLOTG(last_errno) = ret;
- S_FREE(SABLOTG(output_transform_file));
- RETURN_NULL();
- }
- }
-
- /**
- * A non-zero return means error, save this error in the global
- * errno (for xslt_errno() and xslt_error()) free the output
- * transformation file and null.
- */
- if (ret) {
- SABLOTG(last_errno) = ret;
- S_FREE(SABLOTG(output_transform_file));
- RETURN_NULL();
- }
-
- /**
- * If there is a buffer, end output buffering and clear the
- * current output buffer (so we don't send data twice)
- */
- if (tRes)
- php_end_ob_buffer(0, 0);
-
- PUTS(tRes);
-
- S_FREE(SABLOTG(output_transform_file));
- S_FREE(buffer);
-
- /**
- * If there exists a result, free that result
- * otherwise just end output buffering and send the
- * data.
- */
- if (tRes)
- SablotFree(tRes);
- else
- php_end_ob_buffer(1, 0);
-}
-/* }}} */
-
-/* {{{ proto bool xslt_transform(string xslt_uri, string transform_uri, string result_uri[, array xslt_params[, array xslt_args[, string &result]]])
- Transform an XML document, transform_uri, with an XSL stylesheet, xslt_uri with parameters, xslt_params, into the Result buffer, result_uri, xslt_args defines the variables in xslt_uri, transform_uri and result_uri. */
-PHP_FUNCTION(xslt_transform)
-{
- zval **xslt_uri,
- **transform_uri,
- **result_uri,
- **xslt_params,
- **xslt_args,
- **result;
-
- char **args = NULL,
- **params = NULL,
- *tResult = NULL;
-
- int argc = ZEND_NUM_ARGS(),
- ret = 0;
-
- SABLOTLS_FETCH();
-
- if (argc < 3 || argc > 6 ||
- zend_get_parameters_ex(argc, &xslt_uri, &transform_uri, &result_uri, &xslt_params, &xslt_args, &result) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- multi_convert_to_string_ex(3, xslt_uri, transform_uri, result_uri);
-
- /**
- * if there are more than 3 function arguments, inspect the value of
- * the third argument and decide whether or not there are Sablotron
- * parameters.
- */
- if (argc > 3) {
- HashTable *ar = HASH_OF(*xslt_params);
- if (ar) {
- int numelems,
- size;
-
- /**
- * Allocate 2 times the number of elements in
- * the array, since with associative arrays in PHP
- * keys are not counted.
- */
-
- numelems = zend_hash_num_elements(ar);
- size = (numelems * 2 + 1) * sizeof(char *);
-
- params = (char **)emalloc(size+1);
- memset((char *)params, 0, size);
-
- /**
- * Translate a PHP array (HashTable *) into a
- * Sablotron array (char **).
- */
- _php_sablot_ht_char(ar, params);
- }
- }
-
- /**
- * If there are more than 4 function arguments, inspect the value
- * of the 4 argument and decide whether or not there are Sablotron
- * arguments.
- */
- if (argc > 4) {
- HashTable *ar = HASH_OF(*xslt_args);
- if (ar) {
- int numelems,
- size;
-
- numelems = zend_hash_num_elements(ar);
- size = (numelems * 2 + 1) * sizeof(char *);
-
- args = (char **)emalloc(size+1);
- memset((char *)args, 0, size);
-
- _php_sablot_ht_char(ar, args);
- }
- }
-
- SABLOT_BASIC_CREATE_PROCESSOR();
- ret = SablotRunProcessor(SABLOT_BASIC_HANDLE, Z_STRVAL_PP(xslt_uri),
- Z_STRVAL_PP(transform_uri), Z_STRVAL_PP(result_uri),
- params, args);
-
- if (ret) {
- SABLOTG(last_errno) = ret;
-
- S_FREE(params);
- S_FREE(args);
-
- RETURN_FALSE;
- }
-
- ret = SablotGetResultArg(SABLOT_BASIC_HANDLE, Z_STRVAL_PP(result_uri), &tResult);
-
- if (ret) {
- SABLOTG(last_errno) = ret;
-
- S_FREE(params);
- S_FREE(args);
-
- if (tResult)
- SablotFree(tResult);
-
- RETURN_FALSE;
- } else { RETVAL_TRUE; }
-
- if (tResult &&
- argc == 6) {
- ZVAL_STRING(*result, tResult, 1);
- }
-
- S_FREE(params);
- S_FREE(args);
-
- if (tResult)
- SablotFree(tResult);
-}
-/* }}} */
-
-/* {{{ proto bool xslt_process(string xslt, string input_str, string &result[, string base])
- Process data given by input_str through xslt and place the results in the string result. If base is supplied, it will be used as the base URI. */
-PHP_FUNCTION(xslt_process)
-{
- zval **xslt,
- **input,
- **result,
- **base;
- char *tRes = NULL;
- int ret = 0,
- argc = ZEND_NUM_ARGS();
- SABLOTLS_FETCH();
-
- if (argc < 3 || argc > 4 ||
- zend_get_parameters_ex(argc, &xslt, &input, &result, &base) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- multi_convert_to_string_ex(2, xslt, input);
-
- SABLOT_BASIC_CREATE_PROCESSOR();
-
- /**
- * If we have more than three arguments that means we have
- * a base!
- */
- if (argc > 3) {
- convert_to_string_ex(base);
-
- SablotSetBase(SABLOT_BASIC_HANDLE, Z_STRVAL_PP(base));
- }
-
- /**
- * Need to declare args here (to lazy to actually allocate
- * it with emalloc() ;)
- */
- {
- char *args[] = {"/_stylesheet", Z_STRVAL_PP(xslt),
- "/_xmlinput", Z_STRVAL_PP(input),
- "/_output", NULL,
- NULL};
-
- ret = SablotRunProcessor(SABLOT_BASIC_HANDLE, "arg:/_stylesheet",
- "arg:/_xmlinput", "arg:/_output",
- NULL, args);
- }
-
- if (ret) {
- SABLOTG(last_errno) = ret;
- RETURN_FALSE;
- }
-
- SablotGetResultArg(SABLOT_BASIC_HANDLE, "arg:/_output", &tRes);
- if (ret) {
- SABLOTG(last_errno) = ret;
- RETURN_FALSE;
-
- if (tRes)
- SablotFree(tRes);
- }
-
- if (tRes) {
- ZVAL_STRING(*result, tRes, 1);
- SablotFree(tRes);
- }
- RETURN_TRUE;
-}
-/* }}} */
-
-
-/* {{{ proto resource xslt_create(void)
- Create a new XSL processor and return a resource identifier. */
-PHP_FUNCTION(xslt_create)
-{
- php_sablot *handle;
- SablotHandle p;
- int ret;
- SABLOTLS_FETCH();
-
- ret = SablotCreateProcessor(&p);
-
- if (ret) {
- SABLOTG(last_errno) = ret;
- RETURN_FALSE;
- }
-
- handle = (php_sablot *)emalloc(sizeof(php_sablot));
- if (!handle) {
- php_error(E_WARNING, "Couldn't allocate PHP-Sablotron Handle");
- RETURN_FALSE;
- }
- memset(handle, 0, sizeof(php_sablot));
-
- handle->p = p;
- ret = SablotRegHandler(handle->p, HLR_SAX, (void *)&sax, (void *)handle);
-
- if (ret) {
- SABLOTG(last_errno) = ret;
- RETURN_FALSE;
- }
-
- ret = SablotRegHandler(handle->p, HLR_MESSAGE, (void *)&mh, (void *)handle);
-
- if (ret) {
- SABLOTG(last_errno) = ret;
- RETURN_FALSE;
- }
-
- ret = SablotRegHandler(handle->p, HLR_SCHEME, (void *)&sh, (void *)handle);
-
- if (ret) {
- SABLOTG(last_errno) = ret;
- RETURN_FALSE;
- }
-
- ZEND_REGISTER_RESOURCE(return_value, handle, le_sablot);
- handle->index = Z_LVAL_P(return_value);
-}
-/* }}} */
-
-/* {{{ proto bool xslt_run(resource xh, string xslt_file, string data_file[, string result[, array xslt_params[, array xslt_args]]])
- Process the file data_file with the XSL stylesheet xslt_file and parameters xslt_parameters place the results in the buffer pointed to by the result parameter (defaults to "/_result"), args contains the values of the variables in the other parameters. */
-PHP_FUNCTION(xslt_run)
-{
- zval **xh,
- **xslt_file,
- **data_file,
- **xslt_result,
- **xslt_params,
- **xslt_args;
- php_sablot *handle;
- char **args = NULL,
- **params = NULL,
- *result = NULL;
- int argc = ZEND_NUM_ARGS(),
- ret = 0;
- SABLOTLS_FETCH();
-
- if (argc < 3 || argc > 6 ||
- zend_get_parameters_ex(argc, &xh, &xslt_file, &data_file, &xslt_result, &xslt_params, &xslt_args) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- ZEND_FETCH_RESOURCE(handle, php_sablot *, xh, -1, "PHP-Sablotron handle", le_sablot);
- multi_convert_to_string_ex(2, xslt_file, data_file);
-
- if (argc == 3) {
- result = estrdup("arg:/_result");
- }
-
- if (argc > 3) {
- convert_to_string_ex(xslt_result);
- result = estrndup(Z_STRVAL_PP(xslt_result), Z_STRLEN_PP(xslt_result));
- }
-
- if (argc > 4) {
- HashTable *ar = HASH_OF(*xslt_params);
- if (ar) {
- int numelems,
- size;
-
- numelems = zend_hash_num_elements(ar);
- size = (numelems * 2 + 1) * sizeof(char *);
-
- params = (char **)emalloc(size+1);
- memset((char *)params, 0, size);
-
- _php_sablot_ht_char(ar, params);
- }
- }
-
- if (argc > 5) {
- HashTable *ar = HASH_OF(*xslt_args);
- if (ar) {
- int numelems,
- size;
-
- numelems = zend_hash_num_elements(ar);
- size = (numelems * 2 + 1) * sizeof(char *);
-
- args = (char **)emalloc(size+1);
- memset((char *)args, 0, size);
-
- _php_sablot_ht_char(ar, args);
- }
- }
-
- ret = SablotRunProcessor(handle->p, Z_STRVAL_PP(xslt_file), Z_STRVAL_PP(data_file), result, params, args);
-
- if (ret) {
- handle->last_errno = ret;
- SABLOTG(last_errno) = ret;
- S_FREE(params);
- S_FREE(args);
- S_FREE(result);
- RETURN_FALSE;
- }
-
- S_FREE(params);
- S_FREE(args);
- S_FREE(result);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool xslt_openlog(resource xh, string logfile[, int loglevel])
- Sets a logfile for Sablotron to place all of its error messages */
-PHP_FUNCTION(xslt_openlog)
-{
- zval **xh,
- **logfile,
- **opt_loglevel;
- php_sablot *handle;
- int ret = 0,
- loglevel = 0,
- argc = ZEND_NUM_ARGS();
- SABLOTLS_FETCH();
-
- if (argc < 2 || argc > 3 ||
- zend_get_parameters_ex(argc, &xh, &logfile, &opt_loglevel) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- ZEND_FETCH_RESOURCE(handle, php_sablot *, xh, -1, "PHP-Sablotron", le_sablot);
- convert_to_string_ex(logfile);
-
- if (argc > 2) {
- convert_to_long_ex(opt_loglevel);
- loglevel = Z_LVAL_PP(opt_loglevel);
- }
-
- ret = SablotSetLog(handle->p, (const char *)Z_STRVAL_PP(logfile), loglevel);
-
- if (ret) {
- handle->last_errno = ret;
- SABLOTG(last_errno) = ret;
- RETURN_FALSE;
- } else {
- RETURN_TRUE;
- }
-}
-/* }}} */
-
-/* {{{ proto bool xslt_closelog(resource xh)
- Clear the logfile for a given instance Sablotron */
-PHP_FUNCTION(xslt_closelog)
-{
- zval **xh;
- php_sablot *handle;
- int ret;
- SABLOTLS_FETCH();
-
- if (ZEND_NUM_ARGS() != 1 ||
- zend_get_parameters_ex(1, &xh) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- ZEND_FETCH_RESOURCE(handle, php_sablot *, xh, -1, "PHP-Sablotron", le_sablot);
-
- ret = SablotSetLog(handle->p, (const char *)NULL, 1);
-
- if (ret) {
- RETURN_FALSE;
- }
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto string xslt_fetch_result(resource xh[, string result_name])
- Fetch a result buffer on process handle, xh, with name, result_name, if name is not given than the "/_result" buffer is fetched. */
-PHP_FUNCTION(xslt_fetch_result)
-{
- zval **xh,
- **result_name;
- php_sablot *handle;
- char *value = NULL,
- *rname = NULL;
- int argc = ZEND_NUM_ARGS(),
- ret = 0;
- SABLOTLS_FETCH();
-
- if (argc < 1 || argc > 2 ||
- zend_get_parameters_ex(argc, &xh, &result_name) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- ZEND_FETCH_RESOURCE(handle, php_sablot *, xh, -1, "PHP-Sablotron Handle", le_sablot);
-
- if (argc > 1) {
- convert_to_string_ex(result_name);
- rname = estrndup(Z_STRVAL_PP(result_name), Z_STRLEN_PP(result_name));
- } else {
- rname = estrdup("/_result");
- }
-
- ret = SablotGetResultArg(handle->p, rname, &value);
-
- S_FREE(rname);
-
- if (ret) {
- handle->last_errno = ret;
- SABLOTG(last_errno) = ret;
- if (value) {
- SablotFree(value);
- }
- RETURN_FALSE;
- }
-
- if (value) {
- RETVAL_STRING(value, 1);
- SablotFree(value);
- }
-}
-/* }}} */
-
-/* {{{ proto void xslt_free(resource xh)
- Free resources associated with a xslt handle. */
-PHP_FUNCTION(xslt_free)
-{
- zval **xh;
- php_sablot *handle;
- SABLOTLS_FETCH();
-
- if (ZEND_NUM_ARGS() != 1 ||
- zend_get_parameters_ex(1, &xh) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(handle, php_sablot *, xh, -1, "PHP-Sablotron Handle", le_sablot);
- zend_list_delete(Z_LVAL_PP(xh));
-}
-/* }}} */
-
-/* {{{ proto void xslt_set_sax_handler(resource xh, array handlers)
- Set SAX Handlers on the resource handle given by xh. */
-PHP_FUNCTION(xslt_set_sax_handler)
-{
- zval **xh,
- **handlers,
- **indiv_handlers;
- php_sablot *handle;
- HashTable *handlers_list;
- char *string_key = NULL;
- ulong num_key;
- SABLOTLS_FETCH();
-
-
- if (ZEND_NUM_ARGS() != 2 ||
- zend_get_parameters_ex(2, &xh, &handlers) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if ((*handlers)->type != IS_ARRAY) {
- php_error(E_ERROR, "The second parameter must be an array");
- }
-
- ZEND_FETCH_RESOURCE(handle, php_sablot *, xh, -1, "PHP-Sablotron Handle", le_sablot);
-
- handlers_list = HASH_OF(*handlers);
-
- for (zend_hash_internal_pointer_reset(handlers_list);
- zend_hash_get_current_data(handlers_list, (void **)&indiv_handlers) == SUCCESS;
- zend_hash_move_forward(handlers_list)) {
-
- SEPARATE_ZVAL(indiv_handlers);
-
- if (zend_hash_get_current_key(handlers_list, &string_key, &num_key, 0) == HASH_KEY_IS_LONG) {
- php_error(E_WARNING, "The Keys of the first dimension of your array must be strings");
- RETURN_FALSE;
- }
-
- if (!strcasecmp("document", string_key)) {
- _php_sablot_handler_pair(handle,
- &handle->startDocHandler, &handle->endDocHandler,
- indiv_handlers);
- } else if (!strcasecmp("element", string_key)) {
- _php_sablot_handler_pair(handle,
- &handle->startElementHandler, &handle->endElementHandler,
- indiv_handlers);
- } else if (!strcasecmp("namespace", string_key)) {
- _php_sablot_handler_pair(handle,
- &handle->startNamespaceHandler, &handle->endNamespaceHandler,
- indiv_handlers);
- } else if (!strcasecmp("comment", string_key)) {
- zval_add_ref(indiv_handlers);
- handle->commentHandler = *indiv_handlers;
- } else if (!strcasecmp("pi", string_key)) {
- zval_add_ref(indiv_handlers);
- handle->PIHandler = *indiv_handlers;
- } else if (!strcasecmp("characters", string_key)) {
- zval_add_ref(indiv_handlers);
- handle->charactersHandler = *indiv_handlers;
- } else {
- php_error(E_WARNING, "Invalid option: %s", string_key);
- }
- }
-}
-/* }}} */
-
-
-/* {{{ proto void xslt_set_scheme_handler(resource xh, array handlers)
- Set SAX Handlers on the resource handle given by xh. */
-PHP_FUNCTION(xslt_set_scheme_handler)
-{
- zval **xh,
- **handlers,
- **indiv_handlers;
- php_sablot *handle;
- HashTable *handlers_list;
- char *string_key = NULL;
- ulong num_key;
- SABLOTLS_FETCH();
-
- if (ZEND_NUM_ARGS() != 2 ||
- zend_get_parameters_ex(2, &xh, &handlers) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if ((*handlers)->type != IS_ARRAY) {
- php_error(E_ERROR, "The second parameter must be an array");
- }
-
- ZEND_FETCH_RESOURCE(handle, php_sablot *, xh, -1, "PHP-Sablotron Handle", le_sablot);
-
- handlers_list = HASH_OF(*handlers);
-
- for (zend_hash_internal_pointer_reset(handlers_list);
- zend_hash_get_current_data(handlers_list, (void **)&indiv_handlers) == SUCCESS;
- zend_hash_move_forward(handlers_list)) {
-
- SEPARATE_ZVAL(indiv_handlers);
-
- if (zend_hash_get_current_key(handlers_list, &string_key, &num_key, 0) == HASH_KEY_IS_LONG) {
- php_error(E_WARNING, "The Keys of the first dimension of your array must be strings");
- RETURN_FALSE;
- }
-
- if (!strcasecmp("getall", string_key)) {
- zval_add_ref(indiv_handlers);
- handle->getAllHandler = *indiv_handlers;
- } else {
- php_error(E_WARNING, "Invalid option: %s", string_key);
- }
-
- }
-}
-/* }}} */
-
-#ifdef HAVE_SABLOT_SET_ENCODING
-
-/* {{{ proto void xslt_set_encoding(resource xh, string encoding)
- Sets output encoding to be used for Sablotron regardless of the encoding specified by the stylesheet. To unset, call with encoding_ NULL. */
-PHP_FUNCTION(xslt_set_encoding)
-{
- zval **xh, **encoding;
- php_sablot *handle;
- int ret = 0,
- loglevel = 0,
- argc = ZEND_NUM_ARGS();
- SABLOTLS_FETCH();
-
- if (argc != 2 ||
- zend_get_parameters_ex(argc, &xh, &encoding) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- ZEND_FETCH_RESOURCE(handle, php_sablot *, xh, -1, "PHP-Sablotron", le_sablot);
- convert_to_string_ex(encoding);
-
- SablotSetEncoding(handle->p, (char *) Z_STRVAL_PP(encoding));
-
-}
-/* }}} */
-
-#endif
-
-/* {{{ proto bool xslt_set_base(resource xh, string scheme, string base)
- Overrides the default base for a resource. If scheme is non-null, it only affects the uri given by scheme */
-PHP_FUNCTION(xslt_set_base)
-{
- zval **xh, **scheme, **base;
- php_sablot *handle;
- int argc = ZEND_NUM_ARGS(),
- ret = 0;
- SABLOTLS_FETCH();
-
- if (argc < 2 || argc > 3 ||
- zend_get_parameters_ex(argc, &xh, &scheme, &base) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if (argc > 2) {
- ZEND_FETCH_RESOURCE(handle, php_sablot *, xh, -1, "PHP-Sablotron handle", le_sablot);
-
- if (Z_TYPE_PP(scheme) != IS_STRING) {
- ret = SablotSetBase(handle->p, Z_STRVAL_PP(base));
- } else {
- ret = SablotSetBaseForScheme((void *) handle->p,
- Z_STRVAL_PP(scheme),
- Z_STRVAL_PP(base));
- }
- } else {
- if (Z_TYPE_PP(scheme) != IS_STRING) {
- ret = SablotSetBase(SABLOTG(processor), Z_STRVAL_PP(base));
- } else {
- ret = SablotSetBaseForScheme((void *) SABLOTG(processor),
- Z_STRVAL_PP(scheme),
- Z_STRVAL_PP(base));
- }
- }
-
- SABLOT_SET_ERROR(handle, ret);
-
- if (ret != 0) {
- RETURN_FALSE;
- } else {
- RETURN_TRUE;
- }
-}
-/* }}} */
-
-/* }}} */
-
-/* {{{ Begin Error Handling functions */
-
-/* {{{ proto mixed xslt_error([int xh])
- Return the error string related to a given error handle. If no handle is given the last error that occurred anywhere is returned. */
-PHP_FUNCTION(xslt_error)
-{
- zval **xh;
- php_sablot *handle;
- int serrno = 0,
- argc = ZEND_NUM_ARGS();
- SABLOTLS_FETCH();
-
- if (argc < 0 || argc > 1 ||
- zend_get_parameters_ex(argc, &xh) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if (argc) {
- ZEND_FETCH_RESOURCE(handle, php_sablot *, xh, -1, "PHP-Sablotron Handle", le_sablot);
-
- if (handle->errors) {
- if (array_init(return_value) == FAILURE) {
- php_error(E_WARNING, "Cannot initialize return array from xslt_error()");
- RETURN_FALSE;
- }
-
- handle->errors = handle->errors_start.next;
- while (handle->errors) {
- add_assoc_string(return_value, handle->errors->key, handle->errors->value, 0);
- handle->errors = handle->errors->next;
- }
- add_assoc_string(return_value, "errstr", (char *)SablotGetMsgText(handle->last_errno), 1);
- add_assoc_long(return_value, "errno", handle->last_errno);
- return;
- }
-
- serrno = handle->last_errno;
- } else {
- serrno = SABLOTG(last_errno);
- }
-
- RETURN_STRING((char *)SablotGetMsgText(serrno), 1);
-}
-/* }}} */
-
-/* {{{ proto int xslt_errno([int xh])
- Return the error number related to a given error handle. If no handle is given the last error number that occurred anywhere is returned. */
-PHP_FUNCTION(xslt_errno)
-{
- zval **xh;
- php_sablot *handle;
- int argc = ZEND_NUM_ARGS();
-
- SABLOTLS_FETCH();
-
- if (argc < 0 || argc > 1 ||
- zend_get_parameters_ex(argc, &xh) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if (argc) {
- ZEND_FETCH_RESOURCE(handle, php_sablot *, xh, -1, "PHP-Sablotron Handle", le_sablot);
- RETURN_LONG(handle->last_errno);
- } else {
- RETURN_LONG(SABLOTG(last_errno));
- }
-}
-/* }}} */
-
-/* {{{ proto void xslt_set_error_handler([int xh, ] string error_handler_name)
- Set a error handler (either per handle or global) */
-PHP_FUNCTION(xslt_set_error_handler)
-{
- zval **arg1, **arg2;
- php_sablot *handle;
- int argc = ZEND_NUM_ARGS();
-
- SABLOTLS_FETCH();
-
- if (argc > 2 || argc < 1 ||
- zend_get_parameters_ex(argc, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if (argc > 1) {
- convert_to_string_ex(arg2);
- ZEND_FETCH_RESOURCE(handle, php_sablot *, arg1, -1, "PHP-Sablotron Handle", le_sablot);
-
- if (!handle->errorHandler)
- MAKE_STD_ZVAL(handle->errorHandler);
-
- *handle->errorHandler = **arg2;
- zval_copy_ctor(handle->errorHandler);
- } else {
- convert_to_string_ex(arg1);
-
- if (!SABLOTG(errorHandler))
- MAKE_STD_ZVAL(SABLOTG(errorHandler));
-
- *SABLOTG(errorHandler) = **arg1;
- zval_copy_ctor(SABLOTG(errorHandler));
- }
-}
-/* }}} */
-
-
-/* {{{ _php_sablot_handler_pair()
- Set the handler functions from a two item array */
-static void _php_sablot_handler_pair(php_sablot *handle, zval **first_func, zval **second_func, zval **indiv_handlers)
-{
- HashTable *second_level = HASH_OF(*indiv_handlers);
- zval **handler;
- int item = 0;
-
- for (zend_hash_internal_pointer_reset(second_level);
- zend_hash_get_current_data(second_level, (void **)&handler) == SUCCESS;
- zend_hash_move_forward(second_level)) {
-
- SEPARATE_ZVAL(handler);
- zval_add_ref(handler);
-
- switch (item)
- {
- case 0:
- *first_func = *handler;
- break;
- case 1:
- *second_func = *handler;
- break;
- default:
- convert_to_string_ex(handler);
- php_error(E_WARNING, "Sorry, too many elements, %s discarded", Z_STRVAL_PP(handler));
- zval_ptr_dtor(handler);
- break;
- }
- item++;
- }
-}
-/* }}} */
-
-/* {{{ _php_sablot_call_handler_function()
- Call a sablot call handler function, wrapper for call_user_function() */
-static void _php_sablot_call_handler_function(zval *handlerName, int argc, zval **args, char *function_name)
-{
- zval *retval;
- int i;
- ELS_FETCH();
- MAKE_STD_ZVAL(retval);
-
- if (call_user_function(EG(function_table), NULL, handlerName, retval, argc, args) == FAILURE) {
- php_error(E_WARNING, "Sorry, couldn't call %s handler", function_name);
- }
-
- zval_dtor(retval);
- efree(retval);
-
- for (i=0; i<argc; i++) {
- zval_ptr_dtor(&(args[i]));
- }
-}
-/* }}} */
-
-/* {{{ _php_sablot_startDoc()
- Start document handler */
-static SAX_RETURN _php_sablot_sax_startDoc(void *userData)
-{
- php_sablot *handle = (php_sablot *)userData;
-
- if (handle->startDocHandler) {
- zval *args[1];
- args[0] = _php_sablot_resource_zval(handle->index);
-
- _php_sablot_call_handler_function(handle->startDocHandler, 1, args, "start document");
- }
-}
-/* }}} */
-
-/* {{{ _php_sablot_sax_startElement()
- Start Element handler */
-static SAX_RETURN _php_sablot_sax_startElement(void *userData, const char *name, const char **attributes)
-{
- php_sablot *handle = (php_sablot *)userData;
-
- if (handle->startElementHandler) {
- zval *args[3];
-
- args[0] = _php_sablot_resource_zval(handle->index);
- args[1] = _php_sablot_string_zval(name);
-
- MAKE_STD_ZVAL(args[2]);
- if (array_init(args[2]) == FAILURE) {
- php_error(E_WARNING, "Couldn't initialize array to be passed to start element handler");
- return;
- }
-
- while (attributes && *attributes) {
- char *key = (char *)attributes[0];
- zval *value = _php_sablot_string_zval(attributes[1]);
-
- add_assoc_string(args[2], key, Z_STRVAL_P(value), 0);
- attributes += 2;
- }
-
- _php_sablot_call_handler_function(handle->startElementHandler, 3, args, "start element");
- }
-}
-/* }}} */
-
-/* {{{ _php_sablot_sax_endElement()
- End element handler */
-static SAX_RETURN _php_sablot_sax_endElement(void *userData, const char *name)
-{
- php_sablot *handle = (php_sablot *)userData;
-
- if (handle->endElementHandler) {
- zval *args[2];
-
- args[0] = _php_sablot_resource_zval(handle->index);
- args[1] = _php_sablot_string_zval(name);
-
- _php_sablot_call_handler_function(handle->endElementHandler, 2, args, "end element");
- }
-}
-/* }}} */
-
-/* {{{ _php_sablot_sax_startNamespace()
- Start Namespace handler */
-static SAX_RETURN _php_sablot_sax_startNamespace(void *userData, const char *prefix, const char *uri)
-{
- php_sablot *handle = (php_sablot *)userData;
-
- if (handle->startNamespaceHandler) {
- zval *args[3];
-
- args[0] = _php_sablot_resource_zval(handle->index);
- args[1] = _php_sablot_string_zval(prefix);
- args[2] = _php_sablot_string_zval(uri);
-
- _php_sablot_call_handler_function(handle->startNamespaceHandler, 3, args, "start namespace");
- }
-}
-/* }}} */
-
-/* {{{ _php_sablot_sax_endNamespace()
- End Namespace Handler */
-static SAX_RETURN _php_sablot_sax_endNamespace(void *userData, const char *prefix)
-{
- php_sablot *handle = (php_sablot *)userData;
-
- if (handle->endNamespaceHandler) {
- zval *args[2];
-
- args[0] = _php_sablot_resource_zval(handle->index);
- args[1] = _php_sablot_string_zval(prefix);
-
- _php_sablot_call_handler_function(handle->endNamespaceHandler, 2, args, "end namespace");
- }
-}
-/* }}} */
-
-/* {{{ _php_sablot_sax_comment()
- Comment Handler */
-static SAX_RETURN _php_sablot_sax_comment(void *userData, const char *contents)
-{
- php_sablot *handle = (php_sablot *)userData;
-
- if (handle->commentHandler) {
- zval *args[2];
-
- args[0] = _php_sablot_resource_zval(handle->index);
- args[1] = _php_sablot_string_zval(contents);
-
- _php_sablot_call_handler_function(handle->commentHandler, 2, args, "comment");
- }
-}
-/* }}} */
-
-/* {{{ _php_sablot_sax_PI()
- Processing Instruction Handler */
-static SAX_RETURN _php_sablot_sax_PI(void *userData, const char *target, const char *contents)
-{
- php_sablot *handle = (php_sablot *)userData;
-
- if (handle->PIHandler) {
- zval *args[3];
-
- args[0] = _php_sablot_resource_zval(handle->index);
- args[1] = _php_sablot_string_zval(target);
- args[2] = _php_sablot_string_zval(contents);
-
- _php_sablot_call_handler_function(handle->PIHandler, 3, args, "PI Handler");
- }
-}
-/* }}} */
-
-/* {{{ _php_sablot_sax_characters()
- Character handler */
-static SAX_RETURN _php_sablot_sax_characters(void *userData, const char *contents, int length)
-{
- php_sablot *handle = (php_sablot *)userData;
-
- if (handle->charactersHandler) {
- zval *args[2];
-
- args[0] = _php_sablot_resource_zval(handle->index);
- args[1] = _php_sablot_string_zval(contents);
-
- _php_sablot_call_handler_function(handle->charactersHandler, 2, args, "characters");
- }
-}
-/* }}} */
-
-/* {{{ _php_sablot_sax_endDoc()
- End document handler */
-static SAX_RETURN _php_sablot_sax_endDoc(void *userData)
-{
- php_sablot *handle = (php_sablot *)userData;
-
- if (handle->endDocHandler) {
- zval *args[1];
-
- args[0] = _php_sablot_resource_zval(handle->index);
-
- _php_sablot_call_handler_function(handle->endDocHandler, 1, args, "end document");
- }
-}
-/* }}} */
-
-
-/* }}} */
-
-/* {{{ Sablotron Error Handling */
-
-/* {{{ _php_sablot_make_code()
- Makes an error code, currently does nothing */
-static MH_ERROR _php_sablot_make_code(void *userData, SablotHandle p, int severity, unsigned short facility, unsigned short code)
-{
- return(code);
-}
-/* }}} */
-
-/* {{{ _php_sablot_error()
- Handle Sablotron errors */
-static MH_ERROR _php_sablot_error(void *userData, SablotHandle p, MH_ERROR code, MH_LEVEL level, char **fields)
-{
- zval **argv = NULL,
- *errorHandler;
-
- php_sablot_error *errors;
- php_sablot *handle = NULL;
-
- char *sep = NULL;
-
- int isAdvanced = 0,
- argc = 0,
- i,
- idx,
- len;
-
- SABLOTLS_FETCH();
-
- if (userData == NULL) {
- SABLOT_FREE_ERROR_HANDLE(SABLOTG_HANDLE);
-
- SABLOTG(errors_start).next = NULL;
- SABLOTG(errors) = &SABLOTG(errors_start);
-
- errors = SABLOTG(errors);
- errorHandler = SABLOTG(errorHandler);
- } else {
- handle = (php_sablot *)userData;
-
- SABLOT_FREE_ERROR_HANDLE(*handle);
-
- handle->errors_start.next = NULL;
- handle->errors = &handle->errors_start;
-
- errors = handle->errors;
- errorHandler = handle->errorHandler;
-
- isAdvanced = 1;
- }
-
-
- while (fields && *fields) {
- errors->next = (php_sablot_error *)emalloc(sizeof(php_sablot_error));
- errors = errors->next;
-
- sep = strchr(fields[0], ':');
-
- idx = sep - fields[0];
- len = strlen(fields[0]);
-
- errors->key = emalloc(idx+1);
- errors->value = emalloc((len - idx) + 1);
-
- memcpy(errors->key, fields[0], idx);
- memcpy(errors->value, fields[0] + idx + 1, len - idx - 1);
- errors->key[idx] = '\0';
- errors->value[len - idx - 1] = '\0';
-
- errors->next = NULL;
- fields++;
- }
-
- if (isAdvanced)
- handle->last_errno = (int) code;
- else
- SABLOTG(last_errno) = (int) code;
-
- if (errorHandler) {
- zval *retval;
- ELS_FETCH();
-
- MAKE_STD_ZVAL(retval);
-
- argc = isAdvanced ? 4 : 3;
- argv = emalloc(argc * sizeof(zval *));
-
- MAKE_STD_ZVAL(argv[0]);
- MAKE_STD_ZVAL(argv[1]);
- MAKE_STD_ZVAL(argv[2]);
-
- if (isAdvanced) {
- MAKE_STD_ZVAL(argv[3]);
-
- ZVAL_RESOURCE(argv[0], handle->index);
- ZVAL_LONG(argv[1], code);
- ZVAL_LONG(argv[2], level);
-
- array_init(argv[3]);
- errors = handle->errors_start.next;
- while (errors) {
- add_assoc_string(argv[3], errors->key, errors->value, 1);
- errors = errors->next;
- }
- } else {
- ZVAL_LONG(argv[0], code);
- ZVAL_LONG(argv[1], level);
-
- array_init(argv[2]);
- errors = SABLOTG(errors_start).next;
- while (errors) {
- add_assoc_string(argv[2], errors->key, errors->value, 1);
- errors = errors->next;
- }
- }
-
- if (call_user_function(EG(function_table), NULL, errorHandler, retval, argc, argv) == FAILURE) {
- php_error(E_WARNING, "Sorry, couldn't call %s error handler", Z_STRVAL_P(errorHandler));
- }
-
- zval_dtor(retval);
- efree(retval);
-
- for (i = 1; i < argc; i++) {
- zval_ptr_dtor(&argv[i]);
- }
- } else {
- if (level == MH_LEVEL_CRITICAL ||
- level == MH_LEVEL_ERROR ||
- level == MH_LEVEL_WARN) {
- _php_sablot_standard_error(errors, isAdvanced ? handle->errors_start : SABLOTG(errors_start), code, level);
- }
- }
-
- return(0);
-}
-/* }}} */
-
-static void _php_sablot_standard_error(php_sablot_error *errors, php_sablot_error errors_start, int code, int level)
-{
- char *errstr = NULL;
- SABLOTLS_FETCH();
-
- errors = errors_start.next;
- while (errors) {
- if (strcmp(errors->key, "msg") == 0) {
- errstr = estrdup(errors->value);
- break;
- }
-
- errors = errors->next;
- }
-
- switch (level) {
- case MH_LEVEL_CRITICAL:
- case MH_LEVEL_ERROR:
- php_error(E_ERROR, errstr);
- break;
- case MH_LEVEL_WARN:
- php_error(E_WARNING, errstr);
- break;
- }
-
- efree(errstr);
-}
-
-/* }}} */
-
-/* {{{ Sablotron Scheme Handler functions */
-
-static int _php_sablot_sh_getAll(void *userData, SablotHandle p, const char *scheme, const char *rest, char **buffer, int *byteCount)
-{
- php_sablot *handle = (php_sablot *) userData;
- ELS_FETCH();
-
- if (handle->getAllHandler) {
- zval *retval,
- *argv[4];
- int idx,
- argc = 4;
-
- MAKE_STD_ZVAL(retval);
-
- argv[0] = _php_sablot_resource_zval(handle->index);
- argv[1] = _php_sablot_string_zval(scheme);
- argv[2] = _php_sablot_string_zval(rest);
- argv[3] = _php_sablot_string_zval("");
-
- if (call_user_function(EG(function_table),
- NULL,
- handle->getAllHandler,
- retval,
- argc,
- argv) == FAILURE) {
- php_error(E_WARNING, "Sorry couldn't call function, %s, with handler of type %s",
- handle->getAllHandler->value.str.val, "Scheme GetALL");
- }
-
- zval_dtor(retval);
- efree(retval);
-
- *buffer = Z_STRVAL_P(argv[3]);
- *byteCount = Z_STRLEN_P(argv[3]);
-
- for (idx = 1; idx < 3; idx++) {
- zval_ptr_dtor(&(argv[idx]));
- }
- }
-
-
- return(0);
-}
-
-static int _php_sablot_sh_freeMemory(void *userData, SablotHandle p, char *buffer)
-{
- /** Not implemented **/
-}
-
-static int _php_sablot_sh_open(void *userData, SablotHandle p, const char *scheme, const char *rest, int *handle)
-{
- /**
- * Not implemented
- */
-}
-
-static int _php_sablot_sh_get(void *userData, SablotHandle p, int handle, char *buffer, int *byteCount)
-{
- /**
- * Not implemented
- */
-}
-
-static int _php_sablot_sh_put(void *userData, SablotHandle p, int handle, const char *buffer, int *byteCount)
-{
- /**
- * Not implemented
- */
-}
-
-static int _php_sablot_sh_close(void *userData, SablotHandle p, int handle)
-{
- /**
- * Not implemented
- */
-}
-
-/* }}} */
-
-/* {{{ List Handling functions */
-
-/* {{{ _php_sablot_free_processor()
- Free a Sablot handle */
-static void _php_sablot_free_processor(zend_rsrc_list_entry *rsrc)
-{
- php_sablot *handle = (php_sablot *)rsrc->ptr;
- if (handle->p) {
- SablotUnregHandler(handle->p, HLR_MESSAGE, NULL, NULL);
- SablotUnregHandler(handle->p, HLR_SAX, NULL, NULL);
- SablotUnregHandler(handle->p, HLR_SCHEME, NULL, NULL);
- SablotDestroyProcessor(handle->p);
- }
-
- FUNCH_FREE(handle->startDocHandler);
- FUNCH_FREE(handle->startElementHandler);
- FUNCH_FREE(handle->endElementHandler);
- FUNCH_FREE(handle->startNamespaceHandler);
- FUNCH_FREE(handle->endNamespaceHandler);
- FUNCH_FREE(handle->commentHandler);
- FUNCH_FREE(handle->PIHandler);
- FUNCH_FREE(handle->charactersHandler);
- FUNCH_FREE(handle->endDocHandler);
- FUNCH_FREE(handle->getAllHandler);
-
- SABLOT_FREE_ERROR_HANDLE(*handle);
- efree(handle);
-}
-/* }}} */
-
-/* }}} */
-
-/* {{{ Conversion Helper functions */
-
-/* {{{ _php_sablot_zval_char()
- Translates a PHP array to a Sablotron character array */
-static void _php_sablot_ht_char(HashTable *php, char **sablot)
-{
- zval **value;
- char *string_key = NULL;
- ulong num_key;
- int i = 0;
-
- for (zend_hash_internal_pointer_reset(php);
- zend_hash_get_current_data(php, (void **)&value) == SUCCESS;
- zend_hash_move_forward(php)) {
- SEPARATE_ZVAL(value);
- convert_to_string_ex(value);
-
- switch (zend_hash_get_current_key(php, &string_key, &num_key, 1)) {
- case HASH_KEY_IS_LONG:
- sablot[i++] = Z_STRVAL_PP(value);
- break;
- case HASH_KEY_IS_STRING:
- sablot[i++] = string_key;
- sablot[i++] = Z_STRVAL_PP(value);
- break;
- }
- }
- sablot[i++] = NULL;
-}
-
-/* {{{ _php_sablot_string_zval()
- Converts a Sablotron string to a zval */
-static zval *_php_sablot_string_zval(const char *str)
-{
- zval *ret;
- int len = strlen(str);
-
- MAKE_STD_ZVAL(ret);
-
- Z_TYPE_P(ret) = IS_STRING;
- Z_STRLEN_P(ret) = len;
- Z_STRVAL_P(ret) = estrndup(str, len);
-
- return(ret);
-}
-/* }}} */
-
-/* {{{ _php_sablot_resource_zval()
- Converts a long identifier to a resource id */
-static zval *_php_sablot_resource_zval(long value)
-{
- zval *ret;
- MAKE_STD_ZVAL(ret);
-
- Z_TYPE_P(ret) = IS_RESOURCE;
- Z_LVAL_P(ret) = value;
-
- zend_list_addref(value);
-
- return(ret);
-}
-/* }}} */
-
-/* }}} */
-
-/* }}} */
-#endif
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/sablot/sablot.dsp b/ext/sablot/sablot.dsp
deleted file mode 100644
index c375ed89f2..0000000000
--- a/ext/sablot/sablot.dsp
+++ /dev/null
@@ -1,107 +0,0 @@
-# Microsoft Developer Studio Project File - Name="sablot" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=sablot - Win32 Debug_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "sablot.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "sablot.mak" CFG="sablot - Win32 Debug_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "sablot - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "sablot - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "sablot - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SABLOT_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\..\\" /I "..\..\main" /I "..\..\TSRM" /I "..\..\ZEND" /D ZEND_WIN32=1 /D PHP_WIN32=1 /D "NDEBUG" /D "PHP_EXPORTS" /D "HAVE_SABLOT" /D COMPILE_DL_SABLOT=1 /D ZEND_DEBUG=0 /D "ZTS" /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x407 /d "_DEBUG"
-# ADD RSC /l 0x407 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 php4ts_debug.lib sablot.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"..\..\Debug_TS/php_sablot.dll" /pdbtype:sept /libpath:"..\..\Debug_TS"
-
-!ELSEIF "$(CFG)" == "sablot - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SABLOT_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\..\\" /I "..\..\main" /I "..\..\TSRM" /I "..\..\ZEND" /D ZEND_WIN32=1 /D PHP_WIN32=1 /D "NDEBUG" /D "PHP_EXPORTS" /D "HAVE_SABLOT" /D COMPILE_DL_SABLOT=1 /D ZEND_DEBUG=0 /D "ZTS" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x407 /d "NDEBUG"
-# ADD RSC /l 0x407 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 php4ts.lib sablot.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_sablot.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
-
-!ENDIF
-
-# Begin Target
-
-# Name "sablot - Win32 Debug_TS"
-# Name "sablot - Win32 Release_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\sablot.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_sablot.h
-# End Source File
-# End Group
-# End Target
-# End Project
diff --git a/ext/satellite/CREDITS b/ext/satellite/CREDITS
deleted file mode 100644
index 766ed2e151..0000000000
--- a/ext/satellite/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-Satellite (CORBA)
-David Eriksson
diff --git a/ext/satellite/EXPERIMENTAL b/ext/satellite/EXPERIMENTAL
deleted file mode 100644
index 6443e99646..0000000000
--- a/ext/satellite/EXPERIMENTAL
+++ /dev/null
@@ -1,5 +0,0 @@
-this extension is experimental,
-its functions may change their names
-or move to extension all together
-so do not rely to much on them
-you have been warned!
diff --git a/ext/satellite/Makefile.in b/ext/satellite/Makefile.in
deleted file mode 100644
index fe927ac834..0000000000
--- a/ext/satellite/Makefile.in
+++ /dev/null
@@ -1,54 +0,0 @@
-#
-# +----------------------------------------------------------------------+
-# | PHP version 4.0 |
-# +----------------------------------------------------------------------+
-# | Copyright (c) 1997-2001 The PHP Group |
-# +----------------------------------------------------------------------+
-# | This source file is subject to version 2.02 of the PHP license, |
-# | that is bundled with this package in the file LICENSE, and is |
-# | available at through the world-wide-web at |
-# | http://www.php.net/license/2_02.txt. |
-# | If you did not receive a copy of the PHP license and are unable to |
-# | obtain it through the world-wide-web, please send a note to |
-# | license@php.net so we can mail you a copy immediately. |
-# +----------------------------------------------------------------------+
-# | Author: David Eriksson <david@2good.com> |
-# +----------------------------------------------------------------------+
-#
-
-#
-# $Id$
-# vim: tabstop=2 shiftwidth=2
-#
-
-# -----------------------------------------------------------------------
-#
-# Makefile for satellite
-#
-# TODO: specify dependencies properly!
-#
-# -----------------------------------------------------------------------
-
-LTLIBRARY_NAME = libsatellite.la
-LTLIBRARY_SOURCES = \
- class.c \
- common.c \
- corba.c \
- enum.c \
- findtype.c \
- hashtable.c \
- namedvalue_to_zval.c \
- object.c \
- php_orbit.c \
- struct.c \
- typecode.c \
- typemanager.c \
- zval_to_namedvalue.c
-LTLIBRARY_SHARED_NAME = satellite.la
-
-#LTLIBRARY_SHARED_LIBADD = `orbit-config --libs client` `libIDL-config --libs`
-LTLIBRARY_LDFLAGS=`orbit-config --libs client` `libIDL-config --libs`
-
-EXTRA_CFLAGS = -Wall -Wunused -Wmissing-prototypes -Wmissing-declarations `orbit-config --cflags client` `libIDL-config --cflags`
-
-include $(top_srcdir)/build/dynlib.mk
diff --git a/ext/satellite/README b/ext/satellite/README
deleted file mode 100644
index d40fff2424..0000000000
--- a/ext/satellite/README
+++ /dev/null
@@ -1,89 +0,0 @@
-$Id$
-
-About Satellite
----------------
-Satellite is CORBA support for PHP using ORBit.
-
-The original version was made by David Eriksson <david@2good.com>
-during the summer 2000.
-
-
-Installation
-------------
-Read below about installing ORBit.
-
-Then create a directory on your server for your IDL files, and add
-an entry to your php.ini like this:
-
- idl_directory = /var/idl
-
-Note: If you compile Satellite as a dynamic PHP extension you must have the
- above line located before the extension=satellite.so line in php.ini!
-
-PHP as an Apache static module
-------------------------------
-Before linking Apache you must do either of these things:
-
- a) Before running Apache's configure you set the environment variable
- LIBS like this:
-
- export LIBS="`orbit-config --libs client` `libIDL-config --libs`"
-
- b) You edit apache/src/modules/php4/libphp4.module and
- add `orbit-config --libs client` `libIDL-config --libs`
- within the quotes on the line beginning with LIBS=
-
-
-What version of ORBit is required?
-----------------------------------
-You need a CVS version of ORBit to use Satellite!
-
-This does NOT work with ORBit 0.5.5 or earlier.
-
-The latest CVS version of ORBit in CVS requires glib-2.0 and has not been
-tested. Because of this we checkout a CVS version from a known safe date.
-
-How to install ORBit from CVS
------------------------------
-
-(1) Get it from CVS
-
- CVS root: :pserver:anonymous@anoncvs.gnome.org:/cvs/gnome
- Password: Empty string
- Directory: ORBit
- Safe date: 2000-09-02 (yyyy-mm-dd)
-
- More about GNOME:s CVS on http://www.gnome.org/start/source.html
-
- Sample session at command line to checkout:
-
- $ export CVSROOT=":pserver:anonymous@anoncvs.gnome.org:/cvs/gnome"
-
- $ cvs login
- (Logging in to anonymous@anoncvs.gnome.org)
- CVS password:
-
- $ cvs checkout -D "2000-09-02" ORBit
- cvs server: Updating ORBit
- .
- .
- .
-
-(2) Set the environment variable CERTIFIED_GNOMIE to whatever you like.
-
-(3) Run ./autogen.sh, gmake och gmake install
-
-
-How to install ORBit from snapshot
-----------------------------------
-
-(1) Download snapshot from one of these addresses:
-
- http://download.2good.nu/satellite/ORBit-20000902.tgz
- http://www.2good.com/satellite/ORBit-20000902.tgz
-
-(2) Set the environment variable CERTIFIED_GNOMIE to whatever you like.
-
-(3) Run ./configure, gmake and gmake install
-
-
diff --git a/ext/satellite/class.c b/ext/satellite/class.c
deleted file mode 100644
index 46419199d7..0000000000
--- a/ext/satellite/class.c
+++ /dev/null
@@ -1,180 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: David Eriksson <david@2good.com> |
- +----------------------------------------------------------------------+
- */
-
-/*
- * $Id$
- * vim: syntax=c tabstop=2 shiftwidth=2
- */
-
-
-/*
- * Helper function for making PHP classes
- */
-
-#include <php.h>
-#include "common.h"
-#include "class.h"
-
-void orbit_class_function_call(
- zend_class_entry * pClass,
- int dataType,
- zend_property_reference *pPropertyReference,
- Class_Constructor pConstructor,
- Class_CallFunction pCallFunction,
- INTERNAL_FUNCTION_PARAMETERS)
-{
- /* get object */
- zval * object = pPropertyReference->object;
-
- /* get function name */
- zend_overloaded_element * function_name =
- (zend_overloaded_element *)pPropertyReference->elements_list->tail->data;
-
- /* handle parameters */
- zval ** arguments = orbit_new_n(zval *, ZEND_NUM_ARGS());
- /*(zval **)emalloc(sizeof(zval *) * ZEND_NUM_ARGS());*/
- if (getParametersArray(ht, ZEND_NUM_ARGS(), arguments) == FAILURE)
- {
- /* TODO: handle error */
- }
-
- /* constructor or normal function? */
- if (zend_llist_count(pPropertyReference->elements_list) == 1
- && !strcasecmp(function_name->element.value.str.val, pClass->name))
- {
- /* constructor */
- if (pConstructor)
- {
- void * p_data = NULL;
- zend_bool success = (*pConstructor)(&p_data, ZEND_NUM_ARGS(), arguments);
-
- if (success)
- orbit_save_data(object, dataType, p_data);
- }
- else
- {
- zend_error(E_WARNING, "(Satellite) This class has no constructor");\
- }
- }
- else
- {
- /* normal function */
- if (pCallFunction)
- {
- void * p_data = orbit_retrieve_data(object, dataType);
-
- if (p_data == NULL)
- {
- /*
- * this means that the constructor has failed earlier!
- * -- or should NULL be allowed here?
- */
- php_error(E_WARNING, "(Satellite) Class has no data!");
- RETVAL_NULL();
- goto orbit_class_function_call_exit;
- }
-
- /* pval * return_value is a part of INTERNAL_FUNCTION_PARAMETERS */
- (*pCallFunction)(p_data, function_name->element.value.str.val,
- ZEND_NUM_ARGS(), arguments, return_value);
- }
- else
- {
- zend_error(E_WARNING, "(Satellite) Can't call functions in this class");\
- }
- }
-
-orbit_class_function_call_exit:
- satellite_delete(arguments);
-
- /* seems to be required! */
- zval_dtor(&function_name->element);
-}
-
-/*
- * save a corba object to a php object
- */
-void orbit_save_data(zval * php_object, int type, void * data)
-{
- pval * orbit_data_handle = NULL;
- long id = zend_list_insert(
- data, /* data */
- type /* type */
- );
-
-
- /*
- * do it like they do in php_COM_call_function_handler
- * (insert into some magic hash index)
- */
- ALLOC_ZVAL(orbit_data_handle); /* allocate memory for value */
-
- orbit_data_handle->type = IS_LONG;
- orbit_data_handle->value.lval = id;
-
- pval_copy_constructor(orbit_data_handle); /* why? */
-
- INIT_PZVAL(orbit_data_handle); /* set reference count */
-
- zend_hash_index_update(
- php_object->value.obj.properties, /* hashtable */
- 0, /* hash??? */
- &orbit_data_handle, /* data */
- sizeof(pval *), /* data size */
- NULL /* destination */
- );
-}
-
-/*
- * retrieve a corba object from a php object
- */
-void * orbit_retrieve_data(const zval * php_object, int wanted_type)
-{
- void * data = NULL;
- pval ** orbit_data_handle = NULL;
- int type = 0;
-
- /* get handle to corba data */
- zend_hash_index_find(
- php_object->value.obj.properties, /* hash table */
- 0, /* hash??? */
- (void **)&orbit_data_handle /* data */
- );
-
- if (orbit_data_handle == NULL || *orbit_data_handle == NULL)
- {
- return NULL;
- }
-
- /* get corba data */
- data = zend_list_find(
- (*orbit_data_handle)->value.lval, /* id */
- &type /* type */
- );
-
- /* verify corba object */
- if (!data || (type != wanted_type))
- {
- /* TODO: handle error */
- return NULL;
- }
-
- return data;
-}
-
-
diff --git a/ext/satellite/class.h b/ext/satellite/class.h
deleted file mode 100644
index 189362c744..0000000000
--- a/ext/satellite/class.h
+++ /dev/null
@@ -1,219 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: David Eriksson <david@2good.com> |
- +----------------------------------------------------------------------+
- */
-
-/*
- * $Id$
- * vim: syntax=c tabstop=2 shiftwidth=2
- */
-
-/* -----------------------------------------------------------------------
- *
- * Macros and things to simplify making PHP classes
- *
- * -----------------------------------------------------------------------
- */
-#ifndef __orbit_class_h__
-#define __orbit_class_h__
-
-#include <zend.h>
-#include <zend_API.h>
-
-#define CONSTRUCTOR 1
-#define DESTRUCTOR 2
-#define CALL_FUNCTION 4
-#define PUT_PROPERTY 8
-#define GET_PROPERTY 16
-#define NO_FUNCTIONS (CONSTRUCTOR|DESTRUCTOR|PUT_PROPERTY|GET_PROPERTY)
-#define NO_PROPERTIES (CONSTRUCTOR|DESTRUCTOR|CALL_FUNCTION)
-
-/*
- * sorry everyone but the constructor itself has to allocate the data
- * structure for member variables!
- *
- * it also has to deallocate this in the destructor...
- */
-typedef zend_bool (*Class_Constructor)
- (void ** ppObject, int parameterCount, zval ** ppParameters);
-typedef zend_bool (*Class_Destructor)
- (void * pObject);
-typedef zend_bool (*Class_CallFunction)
- (void * pObject, const char * pFunctionName, int parameterCount, zval ** ppParameters, zval * pReturnValue);
-typedef zend_bool (*Class_PutProperty)
- (void * pObject, const char * pPropertyName, const zval * pValue);
-typedef zend_bool (*Class_GetProperty)
- (void * pObject, const char * pPropertyName, zval * pReturnValue);
-
- /* put/get data connected to php object */
-void orbit_save_data(zval * pPhpObject, int type, void * pData);
-void * orbit_retrieve_data(const zval * pPhpObject, int type);
-
-void orbit_class_function_call(
- zend_class_entry * pClass,
- int dataType,
- zend_property_reference *pPropertyReference,
- Class_Constructor pConstructor,
- Class_CallFunction pCallFunction,
- INTERNAL_FUNCTION_PARAMETERS);
-
-/*
- * use this macro in the header file
- */
-#define DECLARE_CLASS(name) \
-typedef struct _##name name##; \
-zend_bool name##_Init(int module_number); \
-void name##_SaveData(zval * pPhpObject, ##name * pData);\
-##name * name##_RetrieveData(const zval * pPhpObject);\
-zend_bool name##_PutProperty(##name * pObject, const char * pPropertyName, const zval * pValue);\
-zend_bool name##_GetProperty(##name * pObject, const char * pPropertyName, zval * pReturnValue);\
-/* end small macro */
-
-/*
- * Wrapper for a function call
- */
-#define IMPLEMENT_FUNCTION_CALL(name, flags)\
-static void _##name##_FunctionCall(INTERNAL_FUNCTION_PARAMETERS, zend_property_reference * pPropertyReference) \
-{ \
- orbit_class_function_call( \
- &name##_class_entry, \
- name##_data_type, \
- pPropertyReference, \
- ((flags) & CONSTRUCTOR) ? (Class_Constructor)name##_Constructor : NULL, \
- ((flags) & CALL_FUNCTION) ? (Class_CallFunction)name##_CallFunction : NULL, \
- INTERNAL_FUNCTION_PARAM_PASSTHRU\
- );\
-}
-
-/*
- * wrapper for PutProperty
- */
-#define IMPLEMENT_PUT_PROPERTY(name, flags)\
-static int _##name##_PutProperty(zend_property_reference * pPropertyReference, zval * pValue)\
-{\
- int result = 0;\
- if ((flags) & PUT_PROPERTY)\
- {\
- ##name * p_data = (##name *)orbit_retrieve_data(pPropertyReference->object, name##_data_type);\
- /* get variable name element */\
- zend_overloaded_element * p_attribute_element = \
- (zend_overloaded_element *)pPropertyReference->elements_list->tail->data;\
- /* get variable name */\
- char * p_attribute_name = p_attribute_element->element.value.str.val;\
- if (p_data)\
- result = ##name##_PutProperty(p_data, p_attribute_name, pValue) ? SUCCESS : FAILURE;\
- else\
- result = FAILURE;\
- }\
- else\
- {\
- zend_error(E_WARNING, "(Satellite) Can't set members in class");\
- }\
- return result;\
-}
-
-/*
- * wrapper for GetProperty
- */
-#define IMPLEMENT_GET_PROPERTY(name, flags)\
-static zval _##name##_GetProperty(zend_property_reference * pPropertyReference)\
-{\
- zval value;\
- ZVAL_NULL(&value);\
- if ((flags) & GET_PROPERTY)\
- {\
- ##name * p_data = (##name *)orbit_retrieve_data(pPropertyReference->object, name##_data_type);\
- /* get variable name element */\
- zend_overloaded_element * p_attribute_element = \
- (zend_overloaded_element *)pPropertyReference->elements_list->tail->data;\
- /* get variable name */\
- char * p_attribute_name = p_attribute_element->element.value.str.val;\
- if (p_data)\
- ##name##_GetProperty(p_data, p_attribute_name, &value);\
- }\
- else\
- {\
- zend_error(E_WARNING, "(Satellite) Can't get members in class");\
- }\
- return value;\
-}
-
-
-#define IMPLEMENT_INIT_EX(name, flags, functions, functioncall, getproperty, putproperty)\
-zend_bool name##_Init(int module_number) \
-{ \
- /* register data type */ \
- name##_data_type = register_list_destructors(name##_Destructor, NULL); \
-\
- /* register class */ \
- INIT_OVERLOADED_CLASS_ENTRY( \
- name##_class_entry, \
- #name, \
- functions, \
- functioncall, \
- getproperty, \
- putproperty \
- ); \
-\
- zend_register_internal_class(&name##_class_entry);\
- return TRUE;\
-}
-
-/*
- * initialize object, must be called from PHP_MINIT_FUNCTION etc
- */
-#define IMPLEMENT_INIT(name, flags) \
-IMPLEMENT_INIT_EX(name, flags, NULL, _##name##_FunctionCall, _##name##_GetProperty, _##name##_PutProperty)
-
-
-/*
- * functions to save and retrieve data for the object
- */
-#define IMPLEMENT_DATA_HELPERS(name, flags)\
-void name##_SaveData(zval * pPhpObject, ##name * pData)\
-{\
- orbit_save_data(pPhpObject, name##_data_type, pData);\
-}\
-##name * name##_RetrieveData(const zval * pPhpObject)\
-{\
- return (##name *)orbit_retrieve_data(pPhpObject, name##_data_type);\
-}
-
-/*
- * static declarations for class
- */
-#define IMPLEMENT_DECLARATIONS(name, flags)\
-static zend_bool name##_Constructor(##name ** ppObject, int parameterCount, const zval ** ppParameters);\
-static zend_bool name##_Destructor(##name * pObject);\
-static zend_bool name##_CallFunction(##name * pObject, const char * pFunctionName, int parameterCount, const zval ** ppParameters, zval * pResult); \
-\
-static int name##_data_type = 0; \
-static zend_class_entry name##_class_entry;
-
-/*
- * use this macro in the source file
- */
-#define IMPLEMENT_CLASS(name, flags) \
-IMPLEMENT_DECLARATIONS(name, flags) \
-IMPLEMENT_FUNCTION_CALL(name, flags) \
-IMPLEMENT_PUT_PROPERTY(name, flags) \
-IMPLEMENT_GET_PROPERTY(name, flags) \
-IMPLEMENT_INIT(name, flags) \
-IMPLEMENT_DATA_HELPERS(name, flags)
-
-
-#endif /* __orbit_class_h__ */
-
diff --git a/ext/satellite/common.c b/ext/satellite/common.c
deleted file mode 100644
index f2d1d34b18..0000000000
--- a/ext/satellite/common.c
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: David Eriksson <david@2good.com> |
- +----------------------------------------------------------------------+
- */
-
-/*
- * $Id$
- * vim: syntax=c tabstop=2 shiftwidth=2
- */
-
-/* -----------------------------------------------------------------------
- *
- * Some common stuff, now only memory allocation macros
- *
- * -----------------------------------------------------------------------
- */
-#include "common.h"
-
diff --git a/ext/satellite/common.h b/ext/satellite/common.h
deleted file mode 100644
index 95582ba468..0000000000
--- a/ext/satellite/common.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: David Eriksson <david@2good.com> |
- +----------------------------------------------------------------------+
- */
-
-/*
- * $Id$
- * vim: syntax=c tabstop=2 shiftwidth=2
- */
-
-/* -----------------------------------------------------------------------
- *
- * Some common stuff, now only memory allocation macros
- *
- * -----------------------------------------------------------------------
- */
-#ifndef __common_h__
-#define __common_h__
-
-#include <zend.h>
-
-#define DEBUG_MEMORY 0
-
-#if DEBUG_MEMORY
-
-void * satellite_debug_calloc(int count, int length);
-void satellite_debug_free(void * pBuffer);
-char * satellite_debug_strdup(const char * pString);
-
-/* default memory allocation */
-#define satellite_new_n(type,n) (type*)satellite_debug_calloc((n), sizeof(type))
-#define satellite_delete(p) satellite_debug_free(p)
-#define satellite_strdup(s) satellite_debug_strdup(s)
-
-#else
-
-/* default memory allocation */
-#define satellite_new_n(type,n) (type*)ecalloc((n), sizeof(type))
-#define satellite_delete(p) if(p)efree(p)
-#define satellite_strdup(s) estrdup(s)
-
-#endif
-
-#define satellite_new_1(type) satellite_new_n(type, 1)
-#define satellite_new(type) satellite_new_1(type)
-
-
-/* macros for old prefix "orbit_" */
-
-#define orbit_new_n(type,n) satellite_new_n(type,n)
-#define orbit_delete(p) satellite_delete(p)
-#define orbit_strdup(s) satellite_strdup(s)
-#define orbit_new_1(type) satellite_new_1(type)
-#define orbit_new(type) satellite_new(type)
-
-#endif /* __common_h__ */
-
diff --git a/ext/satellite/config.m4 b/ext/satellite/config.m4
deleted file mode 100644
index d9eb2ce69f..0000000000
--- a/ext/satellite/config.m4
+++ /dev/null
@@ -1,40 +0,0 @@
-dnl $Id$
-
-dnl My first config.m4 - be nice to me... :-)
-
-PHP_ARG_ENABLE(satellite, whether to enable CORBA support via Satellite,
-dnl Make sure that the comment is aligned:
-[ --enable-satellite Enable CORBA support via Satellite (Requires ORBit)])
-
-if test "$PHP_SATELLITE" != "no"; then
-
- dnl check for orbit-config
- AC_PATH_PROG(orbit_config, "orbit-config")
-
- if test -z "$orbit_config"; then
- AC_MSG_ERROR(Cannot find orbit-config, install ORBit!)
- fi
-
- dnl check for symbol giop_skip_atexit in libIIOP
- AC_CHECK_LIB(IIOP, giop_skip_atexit, [true], [
- AC_MSG_ERROR([You need a CVS version of ORBit, please read ext/satellite/README])
- ], `$orbit_config --libs client`)
-
- dnl ORBIT_CFLAGS=`$orbit_config --cflags client`
- dnl ORBIT_LIBS=`$orbit_config --libs client`
-
- dnl check for libIDL-config
- AC_PATH_PROG(libidl_config, "libIDL-config")
-
- if test -z "libidl_config"; then
- AC_MSG_ERROR(Cannot find libIDL-config, install libIDL!)
- fi
-
- dnl LIBIDL_CFLAGS=`$libidl_config --cflags`
- dnl LIBIDL_LIBS=`$libidl_config --libs`
-
- dnl CFLAGS="$CFLAGS $ORBIT_CFLAGS $LIBIDL_CFLAGS"
-
- AC_DEFINE(HAVE_SATELLITE, 1, [CORBA support enabled via Satellite])
- PHP_EXTENSION(satellite, $ext_shared)
-fi
diff --git a/ext/satellite/corba.c b/ext/satellite/corba.c
deleted file mode 100644
index 267c26a835..0000000000
--- a/ext/satellite/corba.c
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: David Eriksson <david@2good.com> |
- +----------------------------------------------------------------------+
- */
-
-/*
- * $Id$
- * vim: syntax=c tabstop=2 shiftwidth=2
- */
-
-/* -----------------------------------------------------------------------
- *
- * Control access to CORBA_ORB and CORBA_Environment objects
- * Adjust these functions to get thread safety!
- *
- * -----------------------------------------------------------------------
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "corba.h"
-
-#include "php_config.h" /* for COMPILE_DL_ORBIT */
-
-/* ZTS = thread-safe Zend */
-#ifdef ZTS
-#error ORBit support not thread-safe, you should at least modify corba.c
-#endif
-
-static CORBA_ORB corba_orb = NULL;
-static CORBA_Environment corba_environment;
-static CORBA_boolean corba_initialized = FALSE;
-
-CORBA_boolean orbit_corba_init()
-{
- int argc = 1;
- char * argv[2] = { "dummy", NULL };
-
-
-#if COMPILE_DL_SATELLITE
- /*
- IIOP normally registers a function with atexit, but that's pretty stupid
- when it is called from a dynamic module that is unloaded before exit()
- is called...
-
- "In addition, for David Eriksson (I think), added:
- int giop_skip_atexit;
- to IIOP. Applications may set this TRUE prior to invoking any
- CORBA_ORB_init() calls, and it will not invoke atexit. This is
- perhaps an ugly way of doing this, but I'm assuming this feature
- will only be used from within specialized sharedlib applications
- that know what they are doing...
-
- Kennard"
- */
-
- giop_skip_atexit = TRUE;
-#endif
-
- CORBA_exception_init(&corba_environment);
- corba_orb = CORBA_ORB_init(
- &argc, argv, "orbit-local-orb", &corba_environment);
-
- /* check return value */
- if (corba_orb == NULL || orbit_caught_exception())
- {
-/* printf("orbit_corba_init failed\n");*/
- return FALSE;
- }
-
- corba_initialized = TRUE;
-
- return TRUE;
-}
-
-CORBA_boolean orbit_corba_shutdown()
-{
- if (corba_initialized)
- {
- /* the orb's reference count is two.. what to do? */
- CORBA_Object_release((CORBA_Object)corba_orb, &corba_environment);
- CORBA_Object_release((CORBA_Object)corba_orb, &corba_environment);
- /*CORBA_ORB_destroy(corba_orb, &corba_environment); */
-
- CORBA_exception_free(orbit_get_environment());
-
- corba_initialized = FALSE;
- corba_orb = NULL;
- return TRUE;
- }
- else
- return FALSE;
-}
-
-CORBA_ORB orbit_get_orb()
-{
- return corba_orb;
-}
-
-CORBA_Environment * orbit_get_environment()
-{
- return &corba_environment;
-}
-
-CORBA_boolean orbit_caught_exception()
-{
-#if 0 /*debug*/
- if (orbit_get_environment()->_major != CORBA_NO_EXCEPTION)
- {
- printf("Caught exception %s\n",
- CORBA_exception_id(orbit_get_environment()));
- }
-#endif
- return orbit_get_environment()->_major != CORBA_NO_EXCEPTION;
-}
-
diff --git a/ext/satellite/corba.h b/ext/satellite/corba.h
deleted file mode 100644
index 9080a660fb..0000000000
--- a/ext/satellite/corba.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: David Eriksson <david@2good.com> |
- +----------------------------------------------------------------------+
- */
-
-/*
- * $Id$
- * vim: syntax=c tabstop=2 shiftwidth=2
- */
-
-/*
- * Control access to CORBA_ORB and CORBA_Environment objects
- */
-#ifndef __corba_h__
-#define __corba_h__
-
-#include <orb/orbit.h>
-
-/* corba handling */
-CORBA_boolean orbit_corba_init();
-CORBA_boolean orbit_corba_shutdown();
-CORBA_ORB orbit_get_orb();
-CORBA_Environment * orbit_get_environment();
-
-/* exception handling */
-CORBA_boolean orbit_caught_exception();
-#define orbit_error_test(info) orbit_caught_exception()
-
-#endif /* __corba_h__ */
-
diff --git a/ext/satellite/enum.c b/ext/satellite/enum.c
deleted file mode 100644
index 9f2f330679..0000000000
--- a/ext/satellite/enum.c
+++ /dev/null
@@ -1,174 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: David Eriksson <david@2good.com> |
- +----------------------------------------------------------------------+
- */
-
-/*
- * $Id$
- * vim: syntax=c tabstop=2 shiftwidth=2
- */
-
-/* -----------------------------------------------------------------------
- *
- * OrbitEnum class
- *
- * -----------------------------------------------------------------------
- */
-#include "enum.h"
-#include "typemanager.h"
-#include "common.h"
-#include "hashtable.h"
-
-struct _OrbitEnum
-{
- EnumType * mpEnumType;
- HashTable mMembers;
-};
-
-IMPLEMENT_CLASS(OrbitEnum, CONSTRUCTOR|DESTRUCTOR|GET_PROPERTY)
-
-
-static zend_bool OrbitEnum_InitializeMembers(OrbitEnum * pEnum)
-{
- int enum_value = 0;
- EnumMemberType * p_member = NULL;
-
- p_member = EnumType_GetFirstMember(pEnum->mpEnumType);
-
- zend_hash_init(
- &pEnum->mMembers, /* hash table */
- 0, /* size */
- NULL, /* hash function */
- ZVAL_DESTRUCTOR, /* destructor */
- 0); /* persistent */
-
- if (!EnumMemberType_IsValid(p_member))
- return TRUE; /* no members */
-
- do
- {
- zval * p_value = NULL;
- char * p_name = EnumMemberType_GetName(p_member);
-
- ALLOC_ZVAL(p_value);
- ZVAL_LONG(p_value, enum_value);
-
- zend_hash_add(
- &pEnum->mMembers,
- p_name,
- strlen(p_name)+1,
- p_value,
- sizeof(zval),
- NULL
- );
-
- /* set value for next member */
- enum_value++;
-
- } while (EnumMemberType_GetNext(p_member));
-
- return TRUE;
-}
-
-zend_bool OrbitEnum_Constructor(OrbitEnum ** ppEnum, int parameterCount,
- const zval ** ppParameters)
-{
- OrbitEnum * p_enum = orbit_new(OrbitEnum);
-
- /* check parameter count */
- if (parameterCount != 1)
- {
- wrong_param_count();
- goto error;
- }
-
- /* validate parameter types */
- if (ppParameters[0]->type != IS_STRING)
- goto error;
-
- /* find type information */
- p_enum->mpEnumType = TypeManager_FindEnum(ppParameters[0]->value.str.val);
- if (p_enum->mpEnumType == NULL)
- {
- zend_error(E_WARNING, "(Satellite) unknown enum '%s'", ppParameters[0]->value.str.val);
- goto error;
- }
-
- /* initialize members */
- if (!OrbitEnum_InitializeMembers(p_enum))
- goto error;
-
- *ppEnum = p_enum;
- return TRUE;
-
-error:
-/* printf("OrbitEnum_Constructor failed\n");*/
- OrbitEnum_Destructor(p_enum);
- *ppEnum = NULL;
- return FALSE;
-}
-
-zend_bool OrbitEnum_Destructor(OrbitEnum * pEnum)
-{
-/* printf("OrbitEnum_Destructor\n");*/
-
- if (pEnum != NULL)
- {
- orbit_delete(pEnum->mpEnumType);
- }
-
- zend_hash_destroy(&pEnum->mMembers);
- orbit_delete(pEnum);
-
- return TRUE;
-}
-
-/* not used */
-zend_bool OrbitEnum_CallFunction(OrbitEnum * pEnum,
- const char * pFunctionName, int parameterCount, const zval ** ppParameters, zval * pResult)
-{
- return FALSE;
-}
-
-/* not used */
-zend_bool OrbitEnum_PutProperty(OrbitEnum * pEnum,
- const char * pPropertyName, const zval * pValue)
-{
- return FALSE;
-}
-
-zend_bool OrbitEnum_GetProperty(OrbitEnum * pEnum,
- const char * pPropertyName, zval * pReturnValue)
-{
- zval * p_value = orbit_find_by_key(&pEnum->mMembers, pPropertyName);
-
- if (p_value == NULL)
- {
- zend_error(E_WARNING, "(Satellite) unknown member '%s' in enum '%s'",
- pPropertyName, EnumType_GetRepositoryId(pEnum->mpEnumType));
-
- ZVAL_NULL(pReturnValue);
- return FALSE;
- }
- else
- {
- memcpy(pReturnValue, p_value, sizeof(zval)); /* raw data copy */
- zval_copy_ctor(pReturnValue); /* smart data copy */
- INIT_PZVAL(pReturnValue); /* set reference count */
- return TRUE;
- }
-}
-
diff --git a/ext/satellite/enum.h b/ext/satellite/enum.h
deleted file mode 100644
index 9034765bcf..0000000000
--- a/ext/satellite/enum.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: David Eriksson <david@2good.com> |
- +----------------------------------------------------------------------+
- */
-
-/*
- * $Id$
- * vim: syntax=c tabstop=2 shiftwidth=2
- */
-
-/*
- * OrbitEnum class
- */
-#ifndef __enum_h__
-#define __enum_h__
-
-#include "class.h"
-
-DECLARE_CLASS(OrbitEnum);
-
-#endif /* __enum_h__ */
diff --git a/ext/satellite/findtype.c b/ext/satellite/findtype.c
deleted file mode 100644
index 7f48cd750a..0000000000
--- a/ext/satellite/findtype.c
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: David Eriksson <david@2good.com> |
- +----------------------------------------------------------------------+
- */
-
-/*
- * $Id$
- * vim: syntax=c tabstop=2 shiftwidth=2
- */
-
-/*
- * Used by typemanager.c and typecode.c
- */
-#include <orb/orbit.h>
-#include "findtype.h"
-
-typedef struct
-{
- const char * mpWantedId;
- IDL_tree_type mWantedType;
- IdlInfo mIdlInfo;
- CORBA_boolean mSuccess;
-} FindTypeData;
-
-static CORBA_boolean orbit_find_type_compare(
- FindTypeData * pData, IDL_tree ident, IDL_tree type)
-{
- if (pData == NULL || ident == NULL || type == NULL)
- return TRUE; /* continue */
-
- /* compare ids */
- if (strcmp(pData->mpWantedId, IDL_IDENT(ident).repo_id) == 0 ||
- strcasecmp(pData->mpWantedId, IDL_IDENT(ident).str) == 0)
- {
- pData->mIdlInfo.mIdent = ident;
- pData->mIdlInfo.mType = type;
- pData->mSuccess = TRUE;
- return FALSE; /* stop */
- }
-
- return TRUE;
-}
-
-static CORBA_boolean orbit_find_type_helper(IDL_tree_func_data *tnfd, FindTypeData *pData)
-{
- IDL_tree tree = tnfd->tree;
-/* IDL_tree real_tree = tree; */
- IDL_tree ident = NULL;
-
- /* must be any type or right type */
- if (pData->mWantedType != IDLN_ANY && pData->mWantedType != IDL_NODE_TYPE(tree))
- {
- return TRUE; /* continue */
- }
-
- switch(IDL_NODE_TYPE(tree))
- {
- case IDLN_ATTR_DCL:
- /* attributes */
- /* real_tree = IDL_ATTR_DCL(tree).param_type_spec; */
-
- /*
- * XXX: this will only handle the FIRST
- * ident connected to the attribute!
- */
- ident = IDL_LIST(IDL_ATTR_DCL(tree).simple_declarations).data;
- break;
-
- case IDLN_EXCEPT_DCL:
- ident = IDL_EXCEPT_DCL(tree).ident;
-
- case IDLN_INTERFACE:
- ident = IDL_INTERFACE(tree).ident;
- break;
-
- case IDLN_OP_DCL:
- ident = IDL_OP_DCL(tree).ident;
- break;
-
- case IDLN_TYPE_DCL:
- /* typedefs */
- /* real_tree = IDL_TYPE_DCL(tree).type_spec; */
-
- /*
- * XXX: this will only handle the FIRST
- * ident connected to the type!
- */
- ident = IDL_LIST(IDL_TYPE_DCL(tree).dcls).data;
- break;
-
- case IDLN_TYPE_ENUM:
- ident = IDL_TYPE_ENUM(tree).ident;
- break;
-
- case IDLN_TYPE_STRUCT:
- ident = IDL_TYPE_STRUCT(tree).ident;
- break;
-
- /* TODO: handle more types! */
-
- default:
- }
-
- return orbit_find_type_compare(pData, ident, /*real_*/tree);
-}
-
-CORBA_boolean orbit_find_type(
- IDL_tree tree, const char * pWantedId, IDL_tree_type wantedType, IdlInfo * pIdlInfo)
-{
- FindTypeData data;
-
- memset(&data, 0, sizeof(data));
- data.mpWantedId = pWantedId;
- data.mWantedType = wantedType;
-
- IDL_tree_walk_in_order(
- tree,
- (IDL_tree_func)orbit_find_type_helper,
- &data);
-
- *pIdlInfo = data.mIdlInfo;
-
- return data.mSuccess;
-}
-
-IDL_tree orbit_find_type_simple(IDL_tree tree, const char * pWantedId)
-{
- IdlInfo info;
- CORBA_boolean success = orbit_find_type(tree, pWantedId, IDLN_ANY, &info);
- return success ? info.mType : NULL;
-}
-
diff --git a/ext/satellite/findtype.h b/ext/satellite/findtype.h
deleted file mode 100644
index f8bc49d437..0000000000
--- a/ext/satellite/findtype.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: David Eriksson <david@2good.com> |
- +----------------------------------------------------------------------+
- */
-
-/*
- * $Id$
- * vim: syntax=c tabstop=2 shiftwidth=2
- */
-
-/*
- * Used by typemanager.c and typecode.c
- */
-#ifndef __findtype_h__
-#define __findtype_h__
-
-#include <libIDL/IDL.h>
-
-typedef struct
-{
- IDL_tree mIdent;
- IDL_tree mType;
-} IdlInfo;
-
-CORBA_boolean orbit_find_type(
- IDL_tree tree, const char * pWantedId, IDL_tree_type wantedType,IdlInfo * pIdlInfo);
-IDL_tree orbit_find_type_simple(IDL_tree tree, const char * pWantedId);
-
-#endif /* __findtype_h__ */
-
diff --git a/ext/satellite/hashtable.c b/ext/satellite/hashtable.c
deleted file mode 100644
index 235356d3bc..0000000000
--- a/ext/satellite/hashtable.c
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: David Eriksson <david@2good.com> |
- +----------------------------------------------------------------------+
- */
-
-/*
- * $Id$
- * vim: syntax=c tabstop=2 shiftwidth=2
- */
-
-/*
- * HashTable helpers
- */
-#include "hashtable.h"
-#include "zend_API.h"
-
-#ifndef FALSE
-#define FALSE 0
-#endif
-
-/*
- * duplicate a zval
- */
-static zval * orbit_duplicate_zval(const zval * pValue)
-{
- zval * p_new_value = NULL;
-
- if (pValue == NULL)
- return NULL;
-
- ALLOC_ZVAL(p_new_value); /* allocate */
- memcpy(p_new_value, pValue, sizeof(zval)); /* raw data copy */
- zval_copy_ctor(p_new_value); /* smart data copy */
- INIT_PZVAL(p_new_value); /* set reference count */
-
- return p_new_value;
-}
-
-/*
- * store a zval in a hashtable with a key
- */
-zend_bool orbit_store_by_key(HashTable * pHashTable, const char * pKey, const zval * pValue)
-{
- int result = FAILURE;
- void * p_destination = NULL;
- zval * p_new_value = NULL;
-
- if (pHashTable == NULL || pKey == NULL || pValue == NULL)
- return FALSE;
-
- p_new_value = orbit_duplicate_zval(pValue);
-
- result = zend_hash_update(
- pHashTable,
- (char *)pKey, /* discard const */
- strlen(pKey)+1,
- p_new_value,
- sizeof(zval),
- &p_destination
- );
-
- return result == SUCCESS;
-}
-
-/*
- * find a zval in a hashtable with a key
- */
-zval * orbit_find_by_key(HashTable * pHashTable, const char * pKey)
-{
- int result = FAILURE;
- zval * p_value = NULL;
-
- result = zend_hash_find(
- pHashTable,
- (char *)pKey, /* discard const */
- strlen(pKey)+1,
- (void**)&p_value
- );
-
- if (result != SUCCESS)
- {
- p_value = NULL;
- }
-
- return p_value;
-}
-
-
diff --git a/ext/satellite/hashtable.h b/ext/satellite/hashtable.h
deleted file mode 100644
index f434a7f44b..0000000000
--- a/ext/satellite/hashtable.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: David Eriksson <david@2good.com> |
- +----------------------------------------------------------------------+
- */
-
-/*
- * $Id$
- * vim: syntax=c tabstop=2 shiftwidth=2
- */
-
-/*
- * HashTable helpers
- */
-#ifndef __hashtable_h__
-#define __hashtable_h__
-
-#include <zend.h>
-
-zval * orbit_find_by_key(HashTable * pHashTable, const char * pKey);
-zend_bool orbit_store_by_key(HashTable * pHashTable, const char * pKey, const zval * pValue);
-
-#endif /* __hashtable_h__ */
diff --git a/ext/satellite/namedvalue_to_zval.c b/ext/satellite/namedvalue_to_zval.c
deleted file mode 100644
index 86fb2cb247..0000000000
--- a/ext/satellite/namedvalue_to_zval.c
+++ /dev/null
@@ -1,315 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: David Eriksson <david@2good.com> |
- +----------------------------------------------------------------------+
- */
-
-/*
- * $Id$
- * vim: syntax=c tabstop=2 shiftwidth=2
- */
-
-/* -----------------------------------------------------------------------
- *
- * Functions to convert a CORBA_NamedValue to a zval
- *
- * -----------------------------------------------------------------------
- */
-#include <zend_API.h>
-#include "namedvalue_to_zval.h"
-#include "common.h"
-#include "object.h"
-#include "struct.h"
-#include "corba.h"
-
-#include <ORBitutil/util.h> /* for ALIGN_ADDRESS() */
-
-static zend_bool satellite_any_to_zval_boolean(
- const CORBA_any * pSource, zval * pDestination)
-{
- CORBA_boolean * p_value = (CORBA_boolean *)pSource->_value;
- ZVAL_BOOL(pDestination, *p_value != 0);
- return TRUE;
-}
-
-static zend_bool satellite_any_to_zval_double(
- const CORBA_any * pSource, zval * pDestination)
-{
- CORBA_double * p_value = (CORBA_double *)pSource->_value;
- ZVAL_DOUBLE(pDestination, *p_value);
- return TRUE;
-}
-
-static zend_bool satellite_any_to_zval_long(
- const CORBA_any * pSource, zval * pDestination)
-{
- CORBA_long * p_value = (CORBA_long *)pSource->_value;
- ZVAL_LONG(pDestination, *p_value);
- return TRUE;
-}
-
-static zend_bool satellite_any_to_zval_short(
- const CORBA_any * pSource, zval * pDestination)
-{
- CORBA_short * p_value = (CORBA_short *)pSource->_value;
- ZVAL_LONG(pDestination, *p_value);
- return TRUE;
-}
-
-
-static zend_bool satellite_any_to_zval_objref(
- const CORBA_any * pSource, zval * pDestination)
-{
- CORBA_Object * p_value = (CORBA_Object *)pSource->_value;
- CORBA_Object dup =
- CORBA_Object_duplicate(*p_value, orbit_get_environment());
-
- return OrbitObject_Create(dup, pDestination);
-}
-
-static zend_bool satellite_any_to_zval_sequence(
- const CORBA_any * pSource, zval * pDestination)
-{
- int i;
- int length = 0, step;
- void ** pp_members = NULL;
- zend_bool success = FALSE;
- CORBA_NamedValue source_item;
- zval * p_destination_item = NULL;
- CORBA_TypeCode content_type = NULL;
- CORBA_sequence_octet * p_value =
- (CORBA_sequence_octet *)pSource->_value;
-
- /* get array to items */
- pp_members = (void **)p_value->_buffer;
-
- /* get number of members */
- length = p_value->_length;
-
- /* get type of items */
- content_type = CORBA_TypeCode_content_type(
- pSource->_type, orbit_get_environment());
- if (content_type == NULL)
- goto error;
-
- /* set zval members */
-#if 0
- pDestination->type = IS_ARRAY;
- pDestination->refcount = 1;
-
- pDestination->value.ht = orbit_new(HashTable);
-
- zend_hash_init(
- pDestination->value.ht, /* hash table */
- 0, /* size */
- NULL, /* hash function */
- ZVAL_PTR_DTOR, /* destructor */
- 0); /* persistent */
-#else
- array_init(pDestination);
-#endif
-
- step = content_type->length ? content_type->length : 1;
-
- for (i = 0; i < length; i++)
- {
- p_destination_item = NULL;
- memset(&source_item, 0, sizeof(CORBA_NamedValue));
-
- source_item.argument._type = content_type;
- source_item.argument._value = pp_members;
-
- pp_members += step;
-
- ALLOC_ZVAL(p_destination_item);
-
- /* convert item */
- success = orbit_namedvalue_to_zval(
- &source_item,
- p_destination_item);
-
- if (!success)
- goto error;
-
- /* add to hashtable */
- INIT_PZVAL(p_destination_item); /* testing! */
- zend_hash_next_index_insert(
- pDestination->value.ht,
- &p_destination_item,
- sizeof(zval *),
- NULL);
-
-/* FREE_ZVAL(p_destination_item);*/
- }
-
- return TRUE;
-
-error:
- return FALSE;
-}
-
-static zend_bool satellite_any_to_zval_string(
- const CORBA_any * pSource, zval * pDestination)
-{
- char ** pp_value = (char **)pSource->_value;
- ZVAL_STRING(pDestination, (*pp_value), TRUE);
- return TRUE;
-}
-
-static zend_bool satellite_any_to_zval_struct(
- const CORBA_any * pSource, zval * pDestination)
-{
- int member_count = 0;
- CORBA_TypeCode type = NULL;
- char * p_repository_id = NULL;
- OrbitStruct * p_struct = NULL;
-
- /* make type a shortcut to the typecode */
- type = pSource->_type;
-
- /* find out the repository id */
- p_repository_id = CORBA_TypeCode_id(type, orbit_get_environment());
- /* do not check for exception because we may be converting one! */
- if (p_repository_id == NULL)
- goto error;
-
- if (!OrbitStruct_Create(p_repository_id, pDestination))
- goto error;
-
- p_struct = OrbitStruct_RetrieveData(pDestination);
- if (p_struct == NULL)
- goto error;
-
- /* now we know the source and destination matches! */
- member_count = CORBA_TypeCode_member_count(type, orbit_get_environment());
- /* do not check for exception because we may be converting one! */
-
- if (member_count > 0)
- {
- int i;
- zend_bool success;
- zval destination_item;
- CORBA_NamedValue source_item;
- char * p_buffer = (char *)pSource->_value;
-
- for (i = 0; i < member_count; i++)
- {
- int alignment;
- char * p_name =
- CORBA_TypeCode_member_name(type, i, orbit_get_environment());
- if (p_name == NULL)
- goto error;
-
- /* prepare destination item */
- ZVAL_NULL(&destination_item);
-
- /* prepare source item */
- memset(&source_item, 0, sizeof(CORBA_NamedValue));
- source_item.argument._type =
- CORBA_TypeCode_member_type(type, i, orbit_get_environment());
- if (source_item.argument._type == NULL)
- goto error;
-
- /* align pointer and set value */
- alignment = ORBit_find_alignment(source_item.argument._type);
- p_buffer = ALIGN_ADDRESS(p_buffer, alignment);
- source_item.argument._value = p_buffer;
-
- /* convert item */
- if (!orbit_namedvalue_to_zval(&source_item, &destination_item))
- goto error;
-
- /* set attribute */
- success = OrbitStruct_PutProperty(p_struct, p_name, &destination_item);
- if (!success) goto error;
-
- /* advance buffer */
- p_buffer += ORBit_gather_alloc_info(source_item.argument._type);
- }
- }
-
- return TRUE;
-
-error:
- return FALSE;
-}
-
-zend_bool satellite_any_to_zval(
- const CORBA_any * pSource, zval * pDestination)
-{
- zend_bool success = FALSE;
- CORBA_TCKind kind;
-
- if (pSource->_type == NULL || pDestination == NULL)
- return FALSE;
-
- kind = CORBA_TypeCode_kind(
- pSource->_type,
- orbit_get_environment()); /* does not throw exceptions */
-
- switch (kind)
- {
- case CORBA_tk_boolean:
- success = satellite_any_to_zval_boolean(pSource, pDestination);
- break;
-
- case CORBA_tk_double:
- success = satellite_any_to_zval_double(pSource, pDestination);
- break;
-
- case CORBA_tk_enum:
- case CORBA_tk_long:
- success = satellite_any_to_zval_long(pSource, pDestination);
- break;
-
- case CORBA_tk_objref:
- success = satellite_any_to_zval_objref(pSource, pDestination);
- break;
-
- case CORBA_tk_sequence:
- success = satellite_any_to_zval_sequence(pSource, pDestination);
- break;
-
- case CORBA_tk_short:
- success = satellite_any_to_zval_short(pSource, pDestination);
- break;
-
- case CORBA_tk_string:
- success = satellite_any_to_zval_string(pSource, pDestination);
- break;
-
- case CORBA_tk_struct: /* 15 */
- case CORBA_tk_except: /* 22 */
- success = satellite_any_to_zval_struct(pSource, pDestination);
- break;
-
- default:
-/* printf("unsupported corba TCKind %i\n", kind);*/
- zend_error(E_WARNING, "(satellite) unsupported corba TCKind %i", kind);
- }
-
- return success;
-}
-
-zend_bool orbit_namedvalue_to_zval(
- const CORBA_NamedValue * pSource, zval * pDestination)
-{
- if (pSource == NULL)
- return FALSE;
-
- return satellite_any_to_zval(&pSource->argument, pDestination);
-}
-
-
diff --git a/ext/satellite/namedvalue_to_zval.h b/ext/satellite/namedvalue_to_zval.h
deleted file mode 100644
index 1c6413d5e0..0000000000
--- a/ext/satellite/namedvalue_to_zval.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: David Eriksson <david@2good.com> |
- +----------------------------------------------------------------------+
- */
-
-/*
- * $Id$
- * vim: syntax=c tabstop=2 shiftwidth=2
- */
-
-#ifndef __namedvalue_to_zval_h__
-#define __namedvalue_to_zval_h__
-
-#include <zend.h>
-#include <orb/orbit.h>
-
-zend_bool orbit_namedvalue_to_zval(
- const CORBA_NamedValue * pSource, zval * pDestination);
-
-zend_bool satellite_any_to_zval(
- const CORBA_any * pSource, zval * pDestination);
-
-#endif /* __namedvalue_to_zval_h__ */
diff --git a/ext/satellite/object.c b/ext/satellite/object.c
deleted file mode 100644
index 7eb9a3dcad..0000000000
--- a/ext/satellite/object.c
+++ /dev/null
@@ -1,865 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: David Eriksson <david@2good.com> |
- +----------------------------------------------------------------------+
- */
-
-/*
- * $Id$
- * vim: syntax=c tabstop=2 shiftwidth=2
- */
-
-/* -----------------------------------------------------------------------
- *
- * OrbitObject class
- *
- * There are three ways to create an object
- *
- * (1) OrbitObject_Constructor, for new OrbitObject(...) in PHP
- * (2) OrbitObject_Create, used when a CORBA method returns an object
- * (3) OrbitObject_Wakeup, used on "unserialization"
- *
- * -----------------------------------------------------------------------
- */
-#include "class.h"
-#include "corba.h"
-#include "common.h"
-#include "object.h"
-#include "typemanager.h"
-#include "namedvalue_to_zval.h"
-#include "zval_to_namedvalue.h"
-#include "typecode.h" /* for satellite_release_typecode */
-
-#define PROFILE 0
-
-#if PROFILE
-#include <sys/time.h>
-#include <unistd.h>
-#endif
-
-struct _OrbitObject
-{
- CORBA_Object mCorbaObject;
- InterfaceType * mpInterface;
-};
-
-static void OrbitObject_Wakeup(INTERNAL_FUNCTION_PARAMETERS);
-static void OrbitObject_Sleep(INTERNAL_FUNCTION_PARAMETERS);
-
-static zend_function_entry OrbitObject_class_functions[] =
-{
- {"__sleep", OrbitObject_Sleep},
- {"__wakeup", OrbitObject_Wakeup},
- {NULL, NULL}
-};
-
-#define MY_IMPLEMENT_CLASS(name, flags)\
-IMPLEMENT_DECLARATIONS(name, flags) \
-IMPLEMENT_FUNCTION_CALL(name, flags) \
-IMPLEMENT_PUT_PROPERTY(name, flags) \
-IMPLEMENT_GET_PROPERTY(name, flags) \
-IMPLEMENT_INIT_EX(name, flags, ##name##_class_functions, _##name##_FunctionCall, _##name##_GetProperty, _##name##_PutProperty)\
-IMPLEMENT_DATA_HELPERS(name, flags)
-
-MY_IMPLEMENT_CLASS(OrbitObject, ~0);
-
-CORBA_Object OrbitObject_GetCorbaObject(OrbitObject * pObject)
-{
- if (pObject == NULL)
- return FALSE;
- else
- return pObject->mCorbaObject;
-}
-#define IOR_PROPERTY_KEY "IOR"
-
-/*
- * prepare for serialization
- *
- * this means creating a property containing the object IOR and returning an
- * array containing the names of properties we want serialized
- *
- * TODO: save environment as property?!
- *
- */
-static void OrbitObject_Sleep(INTERNAL_FUNCTION_PARAMETERS)
-{
- CORBA_char * p_ior = NULL;
- /* get object data */
- OrbitObject * p_object = OrbitObject_RetrieveData(this_ptr);
-
- /* validate data */
- if (p_object == NULL)
- {
- goto error;
- }
-
- /* get IOR from object */
- p_ior = CORBA_ORB_object_to_string(
- orbit_get_orb(), p_object->mCorbaObject, orbit_get_environment());
- if (p_ior == NULL || orbit_caught_exception())
- goto error;
-
- /* add property to zval */
- add_property_string(this_ptr, IOR_PROPERTY_KEY, p_ior, TRUE);
-
- /* create array */
- array_init(return_value);
-
- /* add name of property IOR to array */
- add_next_index_string(return_value, IOR_PROPERTY_KEY, TRUE);
-
- return;
-
-error:
- RETURN_NULL();
-}
-
-/*
- * initialize OrbitObject structure
- */
-static zend_bool OrbitObject_InitializeData(OrbitObject * pObject, const char * pIor)
-{
- /* get object */
- pObject->mCorbaObject = CORBA_ORB_string_to_object(
- orbit_get_orb(),
- pIor,
- orbit_get_environment());
-
- if (pObject->mCorbaObject == NULL || orbit_caught_exception())
- {
- zend_error(E_WARNING, "(Satellite) Unable to resolve IOR");
- goto error;
- }
-
- /* find type info */
- pObject->mpInterface =
- TypeManager_FindInterface(pObject->mCorbaObject->type_id);
-
- if (pObject->mpInterface == NULL)
- {
- zend_error(E_WARNING, "(Satellite) unknown interface '%s'",
- pObject->mCorbaObject->type_id);
- /* TODO: set exception */
- goto error;
- }
-
- return TRUE;
-
-error:
- return FALSE;
-}
-
-/*
- * recover from serialization
- *
- * this means reading the property IOR and reconstructing the object!
- *
- */
-static void OrbitObject_Wakeup(INTERNAL_FUNCTION_PARAMETERS)
-{
- zval ** pp_ior = NULL;
-
- /* create data object */
- OrbitObject * p_object = orbit_new(OrbitObject);
-
- /* find IOR property */
- if (zend_hash_find(
- this_ptr->value.obj.properties,
- IOR_PROPERTY_KEY,
- sizeof(IOR_PROPERTY_KEY),
- (void**)&pp_ior) != SUCCESS)
- {
- /* TODO: set exception */
- goto error;
- }
-
- if ((*pp_ior)->type != IS_STRING)
- {
- /* TODO: set exception */
- goto error;
- }
-
- /* initialize data */
- if (!OrbitObject_InitializeData(
- p_object,
- (*pp_ior)->value.str.val))
- {
- goto error;
- }
-
- /* save data to zval */
- OrbitObject_SaveData(this_ptr, p_object);
-
- return;
-
-error:
- zend_error(E_WARNING, "(Satellite) Invalid serialized object");
- OrbitObject_Destructor(p_object);
-}
-
-
-/* instansiate a class */
-zend_bool OrbitObject_Create(CORBA_Object source, zval * pDestination)
-{
- OrbitObject * p_object = NULL;
-
- /* source might be NULL */
- if (source == NULL)
- {
- ZVAL_NULL(pDestination);
- return TRUE;
- }
-
- /* allocate object */
- p_object = orbit_new(OrbitObject);
-
- /* save corba object */
- p_object->mCorbaObject = source;
-
- /* find type info */
- p_object->mpInterface =
- TypeManager_FindInterface(p_object->mCorbaObject->type_id);
-
- if (p_object->mpInterface == NULL)
- {
- zend_error(E_WARNING, "(Satellite) unknown interface '%s'",
- p_object->mCorbaObject->type_id);
- goto error;
- }
-
- /* set zval members */
- pDestination->type = IS_OBJECT;
- pDestination->is_ref = 1;
- pDestination->refcount = 1;
-
- pDestination->value.obj.ce = &OrbitObject_class_entry;
- pDestination->value.obj.properties = orbit_new(HashTable);
-
- zend_hash_init(
- pDestination->value.obj.properties, /* hash table */
- 0, /* size */
- NULL, /* hash function */
- ZVAL_PTR_DTOR, /* destructor */
- 0); /* persistent */
-
- /* save orbit data */
- OrbitObject_SaveData(pDestination, p_object);
-
- return TRUE;
-
-error:
- OrbitObject_Destructor(p_object);
- return FALSE;
-}
-
-
-
-/*
- * constructor
- *
- * parameters: IOR, OrbitEnvironment
- */
-zend_bool OrbitObject_Constructor(OrbitObject ** ppObject,
- int parameterCount, const zval ** ppParameters)
-{
- OrbitObject * p_object = NULL;
-
- /* allocate object */
- p_object = orbit_new(OrbitObject);
-
- /* check parameter count */
- if (parameterCount != 1)
- {
- wrong_param_count();
- goto error;
- }
-
- /* validate parameter types */
- if (ppParameters[0]->type != IS_STRING)
- {
- zend_error(E_WARNING, "(Satellite) IOR is not a string");
- goto error;
- }
-
- /* initialize data object */
- if ( !OrbitObject_InitializeData(
- p_object,
- ppParameters[0]->value.str.val) )
- {
- goto error;
- }
-
- *ppObject = p_object;
- return TRUE;
-
-error:
- OrbitObject_Destructor(p_object);
- *ppObject = NULL;
-
- /* TODO: all errors above should set exceptions! */
-
- return FALSE;
-}
-
-/*
- * destructor
- */
-zend_bool OrbitObject_Destructor(OrbitObject * pObject)
-{
- InterfaceType_release(pObject->mpInterface);
-
- if (pObject->mCorbaObject != NULL)
- CORBA_Object_release((CORBA_Object)pObject->mCorbaObject, NULL);
-
- orbit_delete(pObject);
-
- return TRUE;
-}
-
-/*
- * prepare a function call result
- */
-static CORBA_NamedValue * OrbitObject_PrepareResult(OrbitObject * pObject,
- OperationType * pOperation)
-{
- CORBA_NamedValue * p_result = orbit_new(CORBA_NamedValue);
-
- p_result->argument._type = OperationType_GetReturnType(pOperation);
-
- if (p_result->argument._type == NULL)
- {
- orbit_delete(p_result);
- p_result = NULL;
- }
- else
- {
- orbit_zval_to_namedvalue(NULL, p_result);
- }
-
- return p_result;
-}
-
-/*
- * add an argument to a function call
- */
-static zend_bool OrbitObject_AddSingleArgument(OrbitObject * pObject,
- CORBA_Request request, ParameterType * pParameter, const zval * pSource, CORBA_NamedValue * pDestination)
-{
- pDestination->argument._type = ParameterType_GetType(pParameter);
- pDestination->arg_modes = ParameterType_GetPassingMode(pParameter);
-
- /* if the argument is output only, don't care about input value */
- if (pDestination->arg_modes == CORBA_ARG_OUT)
- pSource = NULL;
-
- if (!orbit_zval_to_namedvalue(pSource, pDestination))
- return FALSE;
-
- /* add parameter to request */
- CORBA_Request_add_arg(
- request, /* request */
- NULL, /* arg_name */
- pDestination->argument._type, /* type */
- pDestination->argument._value, /* value */
- pDestination->len, /* length */
- pDestination->arg_modes, /* flags */
- orbit_get_environment()
- );
-
- if (orbit_caught_exception())
- return FALSE;
-
- return TRUE;
-}
-
-/*
- * add the function call arguments
- */
-static zend_bool OrbitObject_AddArguments(OrbitObject * pObject,
- CORBA_Request request, OperationType * pOperation, int argumentCount,
- const zval ** ppArguments, CORBA_NamedValue ** ppNamedValue)
-{
- ParameterType * p_parameter = NULL;
- int i = 0;
- zend_bool success = FALSE;
-
- if (argumentCount < 1)
- return TRUE; /* nothing to do */
-
- p_parameter = OperationType_GetFirstParameter(pOperation);
-
- if (NULL == p_parameter)
- return FALSE; /* oups! */
-
- do
- {
- ppNamedValue[i] = satellite_new(CORBA_NamedValue);
- success = OrbitObject_AddSingleArgument( pObject,
- request, p_parameter, ppArguments[i], ppNamedValue[i]);
-
- if (!success)
- goto error;
-
- i++;
- } while (i < argumentCount && ParameterType_GetNext(p_parameter));
-
- /* i should equal argument count and there should be no more parameters */
- if (i != argumentCount || ParameterType_GetNext(p_parameter))
- {
-/* printf("%i, %i, %i\n", i, argumentCount, ParameterType_IsValid(p_parameter));*/
-
- /* bad number of arguments */
- wrong_param_count();
- goto error;
- }
-
- success = TRUE;
- goto exit;
-
-error:
- success = FALSE;
-
-exit:
- orbit_delete(p_parameter);
- return success;
-
-}
-
-/*
- * release a namedvalue that we have allocated
- *
- * (move to another file?)
- */
-static void satellite_release_namedvalue(CORBA_NamedValue * pNamedValue)
-{
- if (pNamedValue == NULL)
- return;
-
- /* clear value */
- if (pNamedValue->argument._value != NULL)
- {
- /* allocated with ORBit_alloc_tcval */
- CORBA_free(pNamedValue->argument._value);
- }
-
- /* clear typecode */
- satellite_release_typecode(pNamedValue->argument._type);
-
- /* allocated with satellite_new */
- satellite_delete(pNamedValue);
-}
-
-static void satellite_release_namedvalue_list(
- CORBA_NamedValue ** ppNamedValue, int length)
-{
- int i;
-
- if (ppNamedValue == NULL)
- return;
-
- for (i = 0; i < length; i++)
- {
- /* release named values */
- satellite_release_namedvalue(ppNamedValue[i]);
- ppNamedValue[i] = NULL;
- }
-
- satellite_delete(ppNamedValue);
-}
-
-/*
- * post-process arguments (take care of output parameters, release memory)
- */
-static zend_bool OrbitObject_ReleaseArguments(OrbitObject * pObject,
- CORBA_Request request, OperationType * pOperation, int argumentCount,
- const zval ** ppArguments, CORBA_NamedValue ** ppNamedValue)
-{
- /* TODO: handle output parameters */
-
- return TRUE;
-}
-
-
-
-/*
- * call a function
- */
-zend_bool OrbitObject_CallFunction(OrbitObject * pObject,
- const char * pFunctionName, int parameterCount, const zval ** ppParameters, zval * pReturnValue)
-{
- zend_bool success;
- CORBA_Request request = NULL;
- OperationType * p_operation = NULL;
- CORBA_NamedValue ** pp_arguments = NULL;
- CORBA_NamedValue * p_result = NULL;
- CORBA_TypeCode * p_exception_list = NULL;
-
-#if PROFILE
- int i;
- struct timeval tv[4];
- gettimeofday(&tv[0], NULL);
-#endif
-
- /* clear exception */
- CORBA_exception_free(orbit_get_environment());
-
- p_operation = InterfaceType_FindOperation(pObject->mpInterface, pFunctionName);
-
- if (p_operation == NULL)
- {
- /* no such operation */
- zend_error(E_WARNING, "(Satellite) unknown operation name '%s' in interface '%s'",
- pFunctionName, pObject->mCorbaObject->type_id);
- goto error;
- }
-
- p_exception_list = OperationType_GetExceptionList(p_operation);
-
- /* XXX: it's ok if this returns NULL, because the operation may be void! */
- p_result = OrbitObject_PrepareResult(pObject, p_operation);
-
- /* create the request */
- CORBA_Object_create_request2(
- pObject->mCorbaObject, /* object */
- NULL, /* context */
- OperationType_GetName(p_operation), /* name */
- NULL, /* arg_list */
- p_result, /* result */
- p_exception_list, /* user exception list */
- &request, /* request */
- CORBA_OUT_LIST_MEMORY, /* flags */
- orbit_get_environment() /* environment */
- );
-
- /* check for exception */
- if (orbit_caught_exception())
- goto error;
-
- /* add parameters */
- pp_arguments = satellite_new_n(CORBA_NamedValue*, parameterCount);
- success = OrbitObject_AddArguments(pObject,
- request, p_operation, parameterCount, ppParameters, pp_arguments);
-
- if (!success)
- {
- /* bad arguments */
- goto error;
- }
-
-#if PROFILE
- gettimeofday(&tv[1], NULL);
-#endif
-
- /* send request and get response */
- CORBA_Request_invoke(request, 0, orbit_get_environment());
-
-#if PROFILE
- gettimeofday(&tv[2], NULL);
-#endif
-
- if (orbit_caught_exception())
- goto error;
-
- /* release arguments */
- success = OrbitObject_ReleaseArguments(pObject,
- request, p_operation, parameterCount, ppParameters, pp_arguments);
- if (!success)
- goto error;
-
- /* take care of return value */
- if (p_result != NULL)
- {
- orbit_namedvalue_to_zval(p_result, pReturnValue);
- }
-
-#if PROFILE
- gettimeofday(&tv[3], NULL);
- printf("%s\n", OperationType_GetName(p_operation));
- for(i = 0; i < 4; i++)
- printf("%i:%i\n", tv[i].tv_sec, tv[i].tv_usec);
-#endif
-
- success = TRUE;
- goto exit;
-
-error:
- /* TODO: all errors above should set exceptions! */
- success = FALSE;
-
-exit:
- CORBA_Object_release((CORBA_Object)request, orbit_get_environment());
- satellite_release_namedvalue(p_result);
- satellite_release_namedvalue_list(pp_arguments, parameterCount);
- orbit_delete(p_operation);
- TypeCodeList_release(p_exception_list);
-
- return success;
-}
-
-#define GET_PREFIX "_get_"
-#define SET_PREFIX "_set_"
-#define GET_PREFIX_LENGTH (sizeof(GET_PREFIX)-1)
-#define SET_PREFIX_LENGTH (sizeof(SET_PREFIX)-1)
-
-
-/*
- * add an argument to a function call
- */
-static zend_bool OrbitObject_AddAttributeArgument(OrbitObject * pObject,
- CORBA_Request request, AttributeType * pAttribute, const zval * pSource)
-{
- CORBA_NamedValue destination;
- memset(&destination, 0, sizeof(CORBA_NamedValue));
-
- destination.argument._type = AttributeType_GetType(pAttribute);
- destination.arg_modes = CORBA_ARG_IN;
-
- if (!orbit_zval_to_namedvalue(pSource, &destination))
- return FALSE;
-
- /* add parameter to request */
- CORBA_Request_add_arg(
- request, /* request */
- NULL, /* arg_name */
- destination.argument._type, /* type */
- destination.argument._value, /* value */
- destination.len, /* length */
- destination.arg_modes, /* flags */
- orbit_get_environment()
- );
-
- if (orbit_caught_exception())
- return FALSE;
-
- return TRUE;
-}
-
-
-
-/*
- * set a php property, or rather a corba attribute
- */
-zend_bool OrbitObject_PutProperty(OrbitObject * pObject,
- const char * pPropertyName, const zval * pValue)
-{
- zend_bool success;
- char * p_name = NULL;
- CORBA_Request request = NULL;
- AttributeType * p_attribute = NULL;
-
- /* clear exception */
- CORBA_exception_free(orbit_get_environment());
-
- /* find attribute type */
- p_attribute = InterfaceType_FindAttribute(pObject->mpInterface, pPropertyName);
-
- if (p_attribute == NULL)
- {
- /*printf("InterfaceType_FindAttribute failed for property %s\n", pPropertyName);*/
- /* no such atttribute */
- zend_error(E_WARNING, "(Satellite) unknown attribute name '%s' in interface '%s'",
- pPropertyName, pObject->mCorbaObject->type_id);
- goto OrbitObject_PutProperty_error;
- }
-
- if (AttributeType_IsReadonly(p_attribute))
- {
- /* can't set a readonly attribute! */
- goto OrbitObject_PutProperty_error;
- }
-
- /* create operation name */
- p_name = orbit_new_n(char, strlen(pPropertyName) + SET_PREFIX_LENGTH + 1);
- strcpy(p_name, SET_PREFIX);
- strcat(p_name, AttributeType_GetName(p_attribute));
-
- /* create the request */
- CORBA_Object_create_request(
- pObject->mCorbaObject, /* object */
- NULL, /* context */
- p_name, /* name */
- NULL, /* arg_list */
- NULL, /* result */
- &request, /* request */
- CORBA_OUT_LIST_MEMORY, /* flags */
- orbit_get_environment() /* environment */
- );
-
- /* check for exception */
- if (orbit_caught_exception())
- goto OrbitObject_PutProperty_error;
-
- if (request == NULL)
- goto OrbitObject_PutProperty_error;
-
- success = OrbitObject_AddAttributeArgument(
- pObject, request, p_attribute, pValue);
-
- if (!success)
- goto OrbitObject_PutProperty_error;
-
- /* send request and get response */
- CORBA_Request_invoke(request, 0, orbit_get_environment());
-
- if (orbit_caught_exception())
- goto OrbitObject_PutProperty_error;
-
- success = TRUE;
- goto OrbitObject_PutProperty_exit;
-
-OrbitObject_PutProperty_error:
- /* TODO: all errors above should set exceptions! */
- success = FALSE;
-
-OrbitObject_PutProperty_exit:
- CORBA_Object_release((CORBA_Object)request, orbit_get_environment());
- orbit_delete(p_attribute);
- orbit_delete(p_name);
-
- return success;
-}
-
-/*
- * prepare a function call result
- */
-static CORBA_NamedValue * OrbitObject_PrepareAttributeResult(OrbitObject * pObject,
- AttributeType * pAttribute)
-{
- CORBA_NamedValue * p_result = orbit_new(CORBA_NamedValue);
-
- p_result->argument._type = AttributeType_GetType(pAttribute);
-
- if (p_result->argument._type == NULL)
- {
-/* printf("AttributeType_GetType failed for attribute %s\n",
- AttributeType_GetName(pAttribute));*/
- orbit_delete(p_result);
- p_result = NULL;
- }
- else
- {
- orbit_zval_to_namedvalue(NULL, p_result);
- }
-
- return p_result;
-}
-
-
-/*
- * get a php property, equal to a corba attribute
- */
-zend_bool OrbitObject_GetProperty(OrbitObject * pObject,
- const char * pPropertyName, zval * pReturnValue)
-{
- zend_bool success;
- char * p_name = NULL;
- CORBA_Request request = NULL;
- AttributeType * p_attribute = NULL;
- CORBA_NamedValue * p_result = NULL;
-
-#if PROFILE
- int i;
- struct timeval tv[4];
- gettimeofday(&tv[0], NULL);
-#endif
-
- /* clear exception */
- CORBA_exception_free(orbit_get_environment());
-
- /* find attribute type */
- p_attribute = InterfaceType_FindAttribute(pObject->mpInterface, pPropertyName);
-
- if (p_attribute == NULL)
- {
- /*printf("InterfaceType_FindAttribute failed for property %s\n", pPropertyName);*/
- /* no such atttribute */
- zend_error(E_WARNING, "(Satellite) unknown attribute name '%s' in interface '%s'",
- pPropertyName, pObject->mCorbaObject->type_id);
- goto OrbitObject_GetProperty_error;
- }
-
- /* prepare result */
- p_result = OrbitObject_PrepareAttributeResult(pObject, p_attribute);
-
- if (p_result == NULL)
- {
- /* probably bad return type */
- goto OrbitObject_GetProperty_error;
- }
-
- /* create operation name */
- p_name = orbit_new_n(char, strlen(pPropertyName) + GET_PREFIX_LENGTH + 1);
- strcpy(p_name, GET_PREFIX);
- strcat(p_name, AttributeType_GetName(p_attribute));
-
- /* create the request */
- CORBA_Object_create_request(
- pObject->mCorbaObject, /* object */
- NULL, /* context */
- p_name, /* name */
- NULL, /* arg_list */
- p_result, /* result */
- &request, /* request */
- CORBA_OUT_LIST_MEMORY, /* flags */
- orbit_get_environment() /* environment */
- );
-
- /* check for exception */
- if (orbit_caught_exception())
- goto OrbitObject_GetProperty_error;
-
- if (request == NULL)
- goto OrbitObject_GetProperty_error;
-
-#if PROFILE
- gettimeofday(&tv[1], NULL);
-#endif
-
- /* send request and get response */
- CORBA_Request_invoke(request, 0, orbit_get_environment());
-
-#if PROFILE
- gettimeofday(&tv[2], NULL);
-#endif
-
- if (orbit_caught_exception())
- goto OrbitObject_GetProperty_error;
-
- /* take care of return value */
- orbit_namedvalue_to_zval(p_result, pReturnValue);
-
-#if 0 /* PROFILE */
- gettimeofday(&tv[3], NULL);
- printf("%s\n", p_name);
- for(i = 0; i < 4; i++)
- printf("%i:%i\n", tv[i].tv_sec, tv[i].tv_usec);
-#endif
-
- success = TRUE;
- goto OrbitObject_GetProperty_exit;
-
-OrbitObject_GetProperty_error:
- /* TODO: all errors above should set exceptions! */
- success = FALSE;
-
-OrbitObject_GetProperty_exit:
- CORBA_Object_release((CORBA_Object)request, orbit_get_environment());
- orbit_delete(p_attribute);
- orbit_delete(p_name);
- satellite_release_namedvalue(p_result);
-
- return success;
-}
-
diff --git a/ext/satellite/object.h b/ext/satellite/object.h
deleted file mode 100644
index 279bc35e57..0000000000
--- a/ext/satellite/object.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: David Eriksson <david@2good.com> |
- +----------------------------------------------------------------------+
- */
-
-/*
- * $Id$
- * vim: syntax=c tabstop=2 shiftwidth=2
- */
-
-#ifndef __orbit_object_h__
-#define __orbit_object_h__
-
-#include <orb/orbit.h>
-#include "class.h"
-
-DECLARE_CLASS(OrbitObject);
-
-CORBA_Object OrbitObject_GetCorbaObject(OrbitObject * pObject);
-zend_bool OrbitObject_Create(CORBA_Object source, zval * pDestination);
-
-
-#endif /* __orbit_object_h__ */
-
diff --git a/ext/satellite/php_orbit.c b/ext/satellite/php_orbit.c
deleted file mode 100644
index 6b740b9f82..0000000000
--- a/ext/satellite/php_orbit.c
+++ /dev/null
@@ -1,200 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: David Eriksson <david@2good.com> |
- +----------------------------------------------------------------------+
- */
-
-/*
- * $Id$
- * vim: syntax=c tabstop=2 shiftwidth=2
- */
-
-/*
- * Interface to PHP
- */
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <php.h>
-#include <php_ini.h> /* for DISPLAY_INI_ENTRIES() */
-#include <ext/standard/info.h> /* for php_info_print_table_*() */
-#include "php_orbit.h"
-#include "corba.h"
-#include "typemanager.h"
-#include "namedvalue_to_zval.h"
-
-/* classes */
-#include "enum.h"
-#include "object.h"
-#include "struct.h"
-
-
-#include "php_config.h" /* for COMPILE_DL_ORBIT */
-
-/* see php4/README.SELF-CONTAINED-EXTENSIONS */
-#if COMPILE_DL_SATELLITE
-ZEND_GET_MODULE(satellite)
-#endif
-
-PHP_MINFO_FUNCTION(satellite);
-
-PHP_INI_BEGIN()
- PHP_INI_ENTRY1("idl_directory", NULL, 0, NULL, NULL)
-PHP_INI_END()
-
-/*
- * functions in module
- */
-static function_entry satellite_functions[] = {
- PHP_FE(satellite_load_idl, NULL)
- PHP_FE(satellite_get_repository_id, NULL)
- PHP_FE(satellite_caught_exception, NULL)
- PHP_FE(satellite_exception_id, NULL)
- PHP_FE(satellite_exception_value, NULL)
-
- /* support the old prefix orbit_ */
- PHP_FALIAS(orbit_load_idl, satellite_load_idl, NULL)
- PHP_FALIAS(orbit_get_repository_id, satellite_get_repository_id, NULL)
- PHP_FALIAS(orbit_caught_exception, satellite_caught_exception, NULL)
- PHP_FALIAS(orbit_exception_id, satellite_exception_id, NULL)
- PHP_FALIAS(orbit_exception_value, satellite_exception_value, NULL)
-
- {NULL, NULL, NULL}
-};
-
-
-/*
- * module entry
- */
-zend_module_entry satellite_module_entry = {
- "satellite",
- satellite_functions,
- PHP_MINIT(satellite), /* module startup */
- PHP_MSHUTDOWN(satellite), /* module shutdown */
- NULL, /* request startup */
- NULL, /* request shutdown */
- PHP_MINFO(satellite), /* module info */
- STANDARD_MODULE_PROPERTIES
-};
-
-/*
- * module initialization
- */
-PHP_MINIT_FUNCTION(satellite)
-{
- zend_bool success;
-
- REGISTER_INI_ENTRIES();
-
- success =
- orbit_corba_init() &&
- TypeManager_Init(INI_STR("idl_directory")) &&
- OrbitEnum_Init(module_number) &&
- OrbitObject_Init(module_number) &&
- OrbitStruct_Init(module_number);
-
- return success ? SUCCESS : FAILURE;
-}
-
-/*
- * shutdown module!
-*/
-PHP_MSHUTDOWN_FUNCTION(satellite)
-{
- TypeManager_Shutdown();
- orbit_corba_shutdown();
-
- UNREGISTER_INI_ENTRIES();
-
- return SUCCESS;
-}
-
-/*
- * some function
- */
-PHP_MINFO_FUNCTION(satellite)
-{
-
- php_info_print_table_start();
- php_info_print_table_header(2, "CORBA support via Satellite", "enabled");
- php_info_print_table_end();
-
- DISPLAY_INI_ENTRIES();
-}
-
-/* instruct the type manager to load an IDL file if not already loaded */
-PHP_FUNCTION(satellite_load_idl)
-{
- zval * p_parameter;
-
- if (ZEND_NUM_ARGS() != 1)
- {
- WRONG_PARAM_COUNT;
- RETURN_NULL();
- }
-
- getParameters(ht, 1, &p_parameter);
-
- if (p_parameter->type != IS_STRING)
- {
- RETURN_NULL();
- }
-
- RETURN_BOOL(TypeManager_LoadFile(p_parameter->value.str.val));
-}
-
-/*
- * NOT IMPLEMENTED
- *
- * get the repository id for an Orbit* object (nice for debugging...)
- */
-PHP_FUNCTION(satellite_get_repository_id)
-{
-}
-
-PHP_FUNCTION(satellite_caught_exception)
-{
- RETURN_BOOL(orbit_caught_exception());
-}
-
-PHP_FUNCTION(satellite_exception_id)
-{
- CORBA_char * p_id = CORBA_exception_id(orbit_get_environment());
-
- RETURN_STRING(p_id, TRUE);
-}
-
-/* real name: php_if_orbit_exception_value */
-PHP_FUNCTION(satellite_exception_value)
-{
- CORBA_NamedValue source;
- ExceptionType * p_exception = NULL;
-
- memset(&source, 0, sizeof(CORBA_NamedValue));
-
- /* get exception type info */
- p_exception = TypeManager_FindException(
- CORBA_exception_id(orbit_get_environment()));
-
- /* get exception typecode */
- source.argument._type = ExceptionType_GetTypeCode(p_exception);
- /* get exception value */
- source.argument._value = CORBA_exception_value(orbit_get_environment());
-
- /* create structure with exception data */
- orbit_namedvalue_to_zval(&source, return_value);
-}
-
diff --git a/ext/satellite/php_orbit.h b/ext/satellite/php_orbit.h
deleted file mode 100644
index 8ede372e5d..0000000000
--- a/ext/satellite/php_orbit.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: David Eriksson <david@2good.com> |
- +----------------------------------------------------------------------+
- */
-
-/*
- * $Id$
- * vim: syntax=c tabstop=2 shiftwidth=2
- */
-
-#ifndef _PHP_ORBIT_H
-#define _PHP_ORBIT_H
-
-extern PHP_MINIT_FUNCTION(satellite);
-extern PHP_MSHUTDOWN_FUNCTION(satellite);
-extern zend_module_entry satellite_module_entry;
-
-#define satellite_module_ptr &satellite_module_entry
-#define phpext_satellite_ptr satellite_module_ptr
-
-extern PHP_FUNCTION(satellite_load_idl);
-extern PHP_FUNCTION(satellite_get_repository_id);
-
-/* exception handling */
-extern PHP_FUNCTION(satellite_caught_exception);
-extern PHP_FUNCTION(satellite_exception_id);
-extern PHP_FUNCTION(satellite_exception_value);
-
-#endif /* _PHP_ORBIT_H */
diff --git a/ext/satellite/struct.c b/ext/satellite/struct.c
deleted file mode 100644
index 9e37e5314a..0000000000
--- a/ext/satellite/struct.c
+++ /dev/null
@@ -1,330 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: David Eriksson <david@2good.com> |
- +----------------------------------------------------------------------+
- */
-
-/*
- * $Id$
- * vim: syntax=c tabstop=2 shiftwidth=2
- */
-
-/* -----------------------------------------------------------------------
- *
- * OrbitStruct class
- *
- * There are three ways to create a structure
- *
- * (1) OrbitStruct_Constructor, for new OrbitStruct(...) in PHP
- * (2) OrbitStruct_Create, used when a CORBA method returns a struct
- * (3) OrbitStruct_Wakeup, used on "unserialization"
- * -----------------------------------------------------------------------
- */
-#include "struct.h"
-#include "common.h"
-#include "typemanager.h"
-#include "hashtable.h"
-
-/*
- * enable/disable incomplete serialization support
- */
-#define SERIALIZABLE_STRUCT 0
-
-struct _OrbitStruct
-{
- HashTable mMembers;
- zend_bool mIsException; /* otherwise normal struct */
- union
- {
- StructType * mpStructType;
- ExceptionType * mpExceptionType;
- } u;
-};
-
-#if SERIALIZABLE_STRUCT
-
-static void OrbitStruct_Wakeup(INTERNAL_FUNCTION_PARAMETERS);
-static void OrbitStruct_Sleep(INTERNAL_FUNCTION_PARAMETERS);
-
-static zend_function_entry OrbitStruct_class_functions[] =
-{
- {"__sleep", OrbitStruct_Sleep},
- {"__wakeup", OrbitStruct_Wakeup},
- {NULL, NULL}
-};
-
-#define MY_IMPLEMENT_CLASS(name, flags)\
-IMPLEMENT_DECLARATIONS(name, flags) \
-IMPLEMENT_FUNCTION_CALL(name, flags) \
-IMPLEMENT_PUT_PROPERTY(name, flags) \
-IMPLEMENT_GET_PROPERTY(name, flags) \
-IMPLEMENT_INIT_EX(name, flags, ##name##_class_functions, _##name##_FunctionCall, _##name##_GetProperty, _##name##_PutProperty)\
-IMPLEMENT_DATA_HELPERS(name, flags)
-
-MY_IMPLEMENT_CLASS(OrbitStruct, NO_FUNCTIONS);
-
-#else /* !SERIALIZABLE_STRUCT */
-
-IMPLEMENT_CLASS(OrbitStruct, NO_FUNCTIONS);
-
-#endif /* SERIALIZABLE_STRUCT */
-
-#if SERIALIZABLE_STRUCT
-
-/*
- * prepare for serialization
- */
-static void OrbitStruct_Sleep(INTERNAL_FUNCTION_PARAMETERS)
-{
- /* get struct data */
- OrbitStruct * p_struct = OrbitStruct_RetrieveData(this_ptr);
-
- /* validate data */
- if (p_struct == NULL)
- {
- goto error;
- }
-
-#if 0
- /* add property to zval */
- add_property_string(this_ptr, IOR_PROPERTY_KEY, p_ior, TRUE);
-
- /* create array */
- array_init(return_value);
-
- /* add name of property IOR to array */
- add_next_index_string(return_value, IOR_PROPERTY_KEY, TRUE);
-#endif
-
- return;
-
-error:
- RETURN_NULL();
-}
-
-static void OrbitStruct_Wakeup(INTERNAL_FUNCTION_PARAMETERS)
-{
-}
-
-#endif /* SERIALIZABLE_STRUCT */
-
-char * OrbitStruct_GetRepositoryId(OrbitStruct * pStruct)
-{
- if (pStruct->mIsException)
- return ExceptionType_GetRepositoryId(pStruct->u.mpExceptionType);
- else
- return StructType_GetRepositoryId(pStruct->u.mpStructType);
-}
-
-static zend_bool OrbitStruct_InitializeMembers(OrbitStruct * pStruct)
-{
- MemberType * p_member = NULL;
-
- if (pStruct->mIsException)
- p_member = ExceptionType_GetFirstMember(pStruct->u.mpExceptionType);
- else
- p_member = StructType_GetFirstMember(pStruct->u.mpStructType);
-
- zend_hash_init(
- &pStruct->mMembers, /* hash table */
- 0, /* size */
- NULL, /* hash function */
- ZVAL_DESTRUCTOR, /* destructor */
- 0); /* persistent */
-
- if (!MemberType_IsValid(p_member))
- return TRUE; /* no members */
-
- do
- {
- zval * p_value = NULL;
- char * p_name = MemberType_GetName(p_member);
-
- ALLOC_ZVAL(p_value);
- ZVAL_NULL(p_value);
-
- zend_hash_add(
- &pStruct->mMembers,
- p_name,
- strlen(p_name)+1, /* important: include terminating zero byte */
- p_value,
- sizeof(zval),
- NULL
- );
- } while (MemberType_GetNext(p_member));
-
- return TRUE;
-}
-
-static zend_bool OrbitStruct_Initialize(const char * pId, OrbitStruct * pStruct)
-{
- /* find type info */
- pStruct->u.mpStructType = TypeManager_FindStruct(pId);
-
- if (pStruct->u.mpStructType == NULL)
- {
- /* not a struct -- maybe an exception? */
- pStruct->u.mpExceptionType = TypeManager_FindException(pId);
- if (pStruct->u.mpExceptionType == NULL)
- {
- zend_error(E_WARNING, "(Satellite) unknown struct or exception '%s'", pId);
-
- goto error;
- }
-
- pStruct->mIsException = TRUE;
- }
-
- /* initialize members */
- if (!OrbitStruct_InitializeMembers(pStruct))
- goto error;
-
- return TRUE;
-
-error:
- return FALSE;
-}
-
-/*
- * used by orbit_namedvalue_to_zval_struct(...)
- */
-zend_bool OrbitStruct_Create(const char * pId, zval * pDestination)
-{
- /* allocate buffer */
- OrbitStruct * p_struct = orbit_new(OrbitStruct);
-
- /* initialize struct */
- if (!OrbitStruct_Initialize(pId, p_struct))
- goto error;
-
- /* set zval members */
- pDestination->type = IS_OBJECT;
- pDestination->is_ref = 1;
- pDestination->refcount = 1;
-
- pDestination->value.obj.ce = &OrbitStruct_class_entry;
- pDestination->value.obj.properties = orbit_new(HashTable);
-
- zend_hash_init(
- pDestination->value.obj.properties, /* hash table */
- 0, /* size */
- NULL, /* hash function */
- ZVAL_PTR_DTOR, /* destructor */
- 0); /* persistent */
-
- /* save orbit data */
- OrbitStruct_SaveData(pDestination, p_struct);
-
- return TRUE;
-
-error:
- orbit_delete(p_struct);
- return FALSE;
-}
-
-/*
- * Constructor
- *
- * Parameters: Repository ID of struct
- */
-zend_bool OrbitStruct_Constructor(OrbitStruct ** ppStruct,
- int parameterCount, const zval ** ppParameters)
-{
- /* allocate buffer */
- OrbitStruct * p_struct = orbit_new(OrbitStruct);
-
- /* check parameter count */
- if (parameterCount != 1)
- {
- wrong_param_count();
- goto error;
- }
-
- /* validate parameter types */
- if (ppParameters[0]->type != IS_STRING)
- goto error;
-
- /* initialize struct */
- if (!OrbitStruct_Initialize(ppParameters[0]->value.str.val, p_struct))
- goto error;
-
- *ppStruct = p_struct;
- return TRUE;
-
-error:
- OrbitStruct_Destructor(p_struct);
- *ppStruct = NULL;
- return FALSE;
-}
-
-zend_bool OrbitStruct_Destructor(OrbitStruct * pStruct)
-{
- if (pStruct->mIsException)
- ExceptionType_release(pStruct->u.mpExceptionType);
- else
- StructType_release(pStruct->u.mpStructType);
-
- /* will crash on uninitialized members structure :-( */
- zend_hash_destroy(&pStruct->mMembers);
- orbit_delete(pStruct);
-
- return TRUE;
-}
-
-/* not used */
-zend_bool OrbitStruct_CallFunction(OrbitStruct * pStruct,
- const char * pFunctionName, int parameterCount, const zval ** ppParameters, zval * pResult)
-{
- return FALSE;
-}
-
-zend_bool OrbitStruct_PutProperty(OrbitStruct * pStruct,
- const char * pPropertyName, const zval * pValue)
-{
- zend_bool result;
-
- result = orbit_store_by_key(&pStruct->mMembers, pPropertyName, pValue);
-
- if (!result)
- {
- zend_error(E_WARNING, "(Satellite) unknown member '%s' in struct '%s'",
- pPropertyName, OrbitStruct_GetRepositoryId(pStruct));
- }
-
- return result;
-}
-
-zend_bool OrbitStruct_GetProperty(OrbitStruct * pStruct,
- const char * pPropertyName, zval * pReturnValue)
-{
- zval * p_value = orbit_find_by_key(&pStruct->mMembers, pPropertyName);
-
- if (p_value == NULL)
- {
- zend_error(E_WARNING, "(Satellite) unknown member '%s' in struct '%s'",
- pPropertyName, OrbitStruct_GetRepositoryId(pStruct));
-
- ZVAL_NULL(pReturnValue);
- return FALSE;
- }
- else
- {
- memcpy(pReturnValue, p_value, sizeof(zval)); /* raw data copy */
- zval_copy_ctor(pReturnValue); /* smart data copy */
- INIT_PZVAL(pReturnValue); /* set reference count */
- return TRUE;
- }
-}
-
diff --git a/ext/satellite/struct.h b/ext/satellite/struct.h
deleted file mode 100644
index 9e563508e6..0000000000
--- a/ext/satellite/struct.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: David Eriksson <david@2good.com> |
- +----------------------------------------------------------------------+
- */
-
-/*
- * $Id$
- * vim: syntax=c tabstop=2 shiftwidth=2
- */
-
-#ifndef __struct_h__
-#define __struct_h__
-
-#include "class.h"
-
-DECLARE_CLASS(OrbitStruct);
-
-char * OrbitStruct_GetRepositoryId(OrbitStruct * pStruct);
-zend_bool OrbitStruct_Create(const char * pId, zval * pDestination);
-
-
-#endif /* __struct_h__ */
diff --git a/ext/satellite/typecode.c b/ext/satellite/typecode.c
deleted file mode 100644
index 7a3544e567..0000000000
--- a/ext/satellite/typecode.c
+++ /dev/null
@@ -1,436 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: David Eriksson <david@2good.com> |
- +----------------------------------------------------------------------+
- */
-
-/*
- * $Id$
- * vim: syntax=c tabstop=2 shiftwidth=2
- */
-
-/* -----------------------------------------------------------------------
- *
- * functions to convert IDL_tree info to CORBA_TypeCodes
- *
- * ought to be cleaned up...
- *
- * -----------------------------------------------------------------------
- */
-#include "corba.h"
-#include "common.h"
-#include "findtype.h"
-#include "typecode.h"
-
-void satellite_release_typecode(CORBA_TypeCode typecode)
-{
- CORBA_Object_release((CORBA_Object)typecode, orbit_get_environment());
-}
-
-static CORBA_TypeCode orbit_idl_tree_type_to_typecode_enum(IDL_tree type)
-{
- CORBA_TypeCode type_code;
- CORBA_EnumMemberSeq * p_members = NULL;
-
- p_members = CORBA_EnumMemberSeq__alloc();
- p_members->_maximum = p_members->_length = 1;
- p_members->_buffer = CORBA_sequence_CORBA_Identifier_allocbuf(p_members->_length);
-
- p_members->_buffer[0] = "dummy";
-
- /*
- * TODO: initialize p_members with members...
- * look at orbit_idl_tree_type_to_typecode_struct
- */
-
- type_code = CORBA_ORB_create_enum_tc(
- orbit_get_orb(),
- IDL_IDENT(IDL_TYPE_ENUM(type).ident).repo_id,
- IDL_IDENT(IDL_TYPE_ENUM(type).ident).str,
- p_members,
- orbit_get_environment());
-
- if (orbit_error_test("CORBA_ORB_create_enum_tc"))
- {
- goto error;
- }
-
- if (type_code == NULL)
- {
-/* printf("unable to create enum typecode for type %s\n",
- IDL_IDENT(IDL_TYPE_ENUM(type).ident).str);*/
- }
-
- goto exit;
-
-error:
- type_code = NULL;
-
-exit:
- CORBA_free(p_members);
- return type_code;
-}
-
-/*
- * create a member sequence for a struct or exception
- */
-static CORBA_StructMemberSeq * orbit_create_member_sequence(IDL_tree member_list)
-{
- int i = 0;
- CORBA_StructMemberSeq * p_members = NULL;
- IDL_tree first_member = member_list;
-
- p_members = CORBA_sequence_CORBA_StructMember__alloc();
- /* this is initially set to false, why? */
- p_members->_release = CORBA_TRUE;
-
- /* ok with empty list */
- if (member_list == NULL)
- return p_members;
-
- /* first iteration, find out member count */
- do
- {
- IDL_tree declaration = IDL_MEMBER(IDL_LIST(member_list).data).dcls;
- if (declaration == NULL) /* very unlikely! */
- continue;
-
- do
- {
- p_members->_length++;
- } while ((declaration = IDL_LIST(declaration).next));
- } while ((member_list = IDL_LIST(member_list).next));
-
- p_members->_maximum = p_members->_length;
- p_members->_buffer =
- CORBA_sequence_CORBA_StructMember_allocbuf(p_members->_length);
-
- /* second iteration, set member data */
- member_list = first_member;
- do
- {
- IDL_tree declaration = IDL_MEMBER(IDL_LIST(member_list).data).dcls;
- CORBA_TypeCode type_code = NULL;
-
- if (declaration == NULL) /* very unlikely! */
- continue;
-
- type_code = orbit_idl_tree_type_to_typecode(
- IDL_MEMBER(IDL_LIST(member_list).data).type_spec);
-
- if (type_code == NULL)
- {
- zend_error(E_WARNING, "(Satellite) unknown type for member %s", IDL_IDENT(IDL_LIST(declaration).data).str);
- goto error;
- }
-
- do
- {
- char * p_name = IDL_IDENT(IDL_LIST(declaration).data).str;
-
- p_members->_buffer[i].name = CORBA_string_dup(p_name);
- p_members->_buffer[i].type = (CORBA_TypeCode)
- CORBA_Object_duplicate((CORBA_Object)type_code, orbit_get_environment());
- p_members->_buffer[i].type_def = NULL; /* XXX */
-
- i++;
- } while ((declaration = IDL_LIST(declaration).next));
-
- satellite_release_typecode(type_code);
-
- } while ((member_list = IDL_LIST(member_list).next));
-
- goto exit;
-
-error:
- /* TODO: error clean up */
- CORBA_free(p_members);
- p_members = NULL;
-
-exit:
- return p_members;
-}
-
-/*
- * create a CORBA_TypeCode for a struct
- */
-static CORBA_TypeCode orbit_idl_tree_type_to_typecode_struct(IDL_tree type)
-{
- CORBA_TypeCode type_code = NULL;
- CORBA_StructMemberSeq * p_members = NULL;
-
-#if 0
- if (IDL_TYPE_STRUCT(type).member_list == NULL)
- {
- printf("no struct members\n");
- goto error;
- }
-#endif
-
- p_members = orbit_create_member_sequence(IDL_TYPE_STRUCT(type).member_list);
- if (p_members == NULL)
- goto error;
-
- type_code = CORBA_ORB_create_struct_tc(
- orbit_get_orb(),
- IDL_IDENT(IDL_TYPE_STRUCT(type).ident).repo_id,
- IDL_IDENT(IDL_TYPE_STRUCT(type).ident).str,
- p_members,
- orbit_get_environment());
-
- if (type_code == NULL)
- goto error;
-
- goto exit;
-
-error:
- satellite_release_typecode(type_code);
-
-exit:
- CORBA_free(p_members);
- return type_code;
-}
-
-
-static CORBA_TypeCode orbit_idl_tree_type_to_typecode_float(IDL_tree type)
-{
- enum IDL_float_type float_type = IDL_TYPE_FLOAT(type).f_type;
-
- switch (float_type)
- {
- case IDL_FLOAT_TYPE_DOUBLE: return TC_CORBA_double;
-
- default:
- /* php_error(E_WARNING, "only double floats supported at the moment at the moment");*/
- return NULL;
- }
-}
-
-
-static CORBA_TypeCode orbit_idl_tree_type_to_typecode_integer(IDL_tree type)
-{
- enum IDL_integer_type integer_type = IDL_TYPE_INTEGER(type).f_type;
-
- switch (integer_type)
- {
- case IDL_INTEGER_TYPE_SHORT: return TC_CORBA_short;
- case IDL_INTEGER_TYPE_LONG: return TC_CORBA_long;
-
- default:
-/* php_error(E_WARNING, "unsupported integer type %i", integer_type);*/
- return NULL;
- }
-}
-
-static CORBA_TypeCode orbit_idl_tree_type_to_typecode_sequence(IDL_tree type)
-{
- CORBA_TypeCode simple_typecode = orbit_idl_tree_type_to_typecode(
- IDL_TYPE_SEQUENCE(type).simple_type_spec);
-
- CORBA_TypeCode typecode = CORBA_ORB_create_sequence_tc(
- orbit_get_orb(),
- 0, /* bound */
- simple_typecode,
- orbit_get_environment() );
-
-#if 0
- if (typecode != NULL)
- {
- typecode->parent.interface = 0;
- typecode->parent.refs = ORBIT_REFCNT_STATIC; /* correct? */
- }
-#endif
-
- satellite_release_typecode(simple_typecode);
-
- return typecode;
-}
-
-/*
- * get real type when we have an object/structure/union/enum ident
- */
-static CORBA_TypeCode orbit_idl_tree_type_to_typecode_ident(IDL_tree type)
-{
- IDL_tree real_type = NULL;
- IDL_tree whole_tree = type;
-
- /* go back to to top of tree (ugly code of the day!) */
- while (whole_tree->up)
- whole_tree = whole_tree->up;
-
- /* find the real type! */
- real_type = orbit_find_type_simple(whole_tree, IDL_IDENT_REPO_ID(type));
-
- /* check return value */
- if (real_type == NULL)
- {
-/* php_error(E_WARNING,
- "unknown repository id %s",
- IDL_IDENT_REPO_ID(type));*/
- return FALSE;
- }
-
- /* call our generic function again... (hehehe) */
- return orbit_idl_tree_type_to_typecode(real_type);
-}
-
-/*
- * make exception typecode
- */
-static CORBA_TypeCode orbit_idl_tree_type_to_typecode_exception(IDL_tree type)
-{
- CORBA_TypeCode type_code = NULL;
- CORBA_StructMemberSeq * p_members = NULL;
-
-#if 0
- if (IDL_EXCEPT_DCL(type).members == NULL)
- {
- printf("no members\n");
- goto error;
- }
-#endif
-
- p_members = orbit_create_member_sequence(IDL_EXCEPT_DCL(type).members);
- if (p_members == NULL)
- goto error;
-
- type_code = CORBA_ORB_create_exception_tc(
- orbit_get_orb(),
- IDL_IDENT(IDL_EXCEPT_DCL(type).ident).repo_id,
- IDL_IDENT(IDL_EXCEPT_DCL(type).ident).str,
- p_members,
- orbit_get_environment());
-
- goto exit;
-
-error:
- satellite_release_typecode(type_code);
-
-exit:
- CORBA_free(p_members);
- return type_code;
-
-}
-
-static CORBA_TypeCode orbit_idl_tree_type_to_typecode_interface(IDL_tree type)
-{
- CORBA_TypeCode typecode = CORBA_ORB_create_interface_tc(
- orbit_get_orb(),
- IDL_IDENT(IDL_INTERFACE(type).ident).repo_id,
- IDL_IDENT(IDL_INTERFACE(type).ident).str,
- orbit_get_environment());
-
-#if 0
- if (typecode != NULL)
- {
- typecode->parent.interface = 0;
- typecode->parent.refs = ORBIT_REFCNT_STATIC; /* correct? */
- }
-#endif
-
- return typecode;
-}
-
-static CORBA_TypeCode orbit_idl_tree_type_to_typecode_string(IDL_tree type)
-{
- CORBA_TypeCode typecode = CORBA_ORB_create_string_tc(
- orbit_get_orb(),
- 0, /* bound */
- orbit_get_environment());
-
-#if 0
- if (typecode != NULL)
- {
- typecode->parent.interface = 0;
- typecode->parent.refs = ORBIT_REFCNT_STATIC; /* correct? */
- }
-#endif
-
- return typecode;
-}
-
-/*
- * get a CORBA_TypeCode from a IDL_tree node type
- */
-CORBA_TypeCode orbit_idl_tree_type_to_typecode(IDL_tree type)
-{
- CORBA_TypeCode type_code = NULL;
-
- if (type == NULL)
- {
- /* not good! */
- return FALSE;
- }
-
- switch (IDL_NODE_TYPE(type))
- {
- case IDLN_EXCEPT_DCL:
- type_code = orbit_idl_tree_type_to_typecode_exception(type);
- break;
-
- case IDLN_IDENT:
- type_code = orbit_idl_tree_type_to_typecode_ident(type);
- break;
-
- case IDLN_INTERFACE:
- /*type_code = TC_CORBA_Object; */
- type_code = orbit_idl_tree_type_to_typecode_interface(type);
- break;
-
- case IDLN_TYPE_BOOLEAN:
- type_code = TC_CORBA_boolean;
- break;
-
- case IDLN_TYPE_DCL:
- type_code =
- orbit_idl_tree_type_to_typecode(IDL_TYPE_DCL(type).type_spec);
- break;
-
- case IDLN_TYPE_ENUM:
- type_code = orbit_idl_tree_type_to_typecode_enum(type);
- break;
-
- case IDLN_TYPE_FLOAT:
- type_code = orbit_idl_tree_type_to_typecode_float(type);
- break;
-
- case IDLN_TYPE_INTEGER:
- type_code = orbit_idl_tree_type_to_typecode_integer(type);
- break;
-
- case IDLN_TYPE_SEQUENCE:
- type_code = orbit_idl_tree_type_to_typecode_sequence(type);
- break;
-
- case IDLN_TYPE_STRING:
- /*type_code = TC_CORBA_string; */
- type_code = orbit_idl_tree_type_to_typecode_string(type);
- break;
-
- case IDLN_TYPE_STRUCT:
- type_code = orbit_idl_tree_type_to_typecode_struct(type);
- break;
-
- /* TODO: handle more types */
-
- default:
-/* printf("orbit_idl_tree_type_to_typecode can't handle type %s\n",
- IDL_NODE_TYPE_NAME(type));*/
- }
-
- return type_code;
-}
-
-
diff --git a/ext/satellite/typecode.h b/ext/satellite/typecode.h
deleted file mode 100644
index ef96acac43..0000000000
--- a/ext/satellite/typecode.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: David Eriksson <david@2good.com> |
- +----------------------------------------------------------------------+
- */
-
-/*
- * $Id$
- * vim: syntax=c tabstop=2 shiftwidth=2
- */
-
-#ifndef __typecode_h__
-#define __typecode_h__
-
-#include <libIDL/IDL.h>
-#include <orb/orbit.h>
-CORBA_TypeCode orbit_idl_tree_type_to_typecode(IDL_tree type);
-
-void satellite_release_typecode(CORBA_TypeCode typecode);
-
-#endif /* __typecode_h__ */
-
diff --git a/ext/satellite/typemanager.c b/ext/satellite/typemanager.c
deleted file mode 100644
index 5d2f44e92c..0000000000
--- a/ext/satellite/typemanager.c
+++ /dev/null
@@ -1,596 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: David Eriksson <david@2good.com> |
- +----------------------------------------------------------------------+
- */
-
-/*
- * $Id$
- * vim: syntax=c tabstop=2 shiftwidth=2
- */
-
-/*
- * Type manager
- */
-#include <string.h>
-#include <orb/orbit.h>
-#include "common.h"
-#include "typemanager.h"
-#include "typecode.h"
-#include "findtype.h"
-#include <glob.h>
-
-struct _TypeManager
-{
-/* IDL_ns mNamespace;*/
- IDL_tree mRoot;
-};
-
-static TypeManager gTypeManager;
-
-struct _InterfaceType
-{
- IdlInfo mIdlInfo;
-};
-
-struct _StructType
-{
- IdlInfo mIdlInfo;
-};
-
-struct _EnumType
-{
- IdlInfo mIdlInfo;
-};
-
-struct _ExceptionType
-{
- IdlInfo mIdlInfo;
-};
-
-struct _OperationType
-{
- IdlInfo mIdlInfo;
-};
-
-struct _AttributeType
-{
- IdlInfo mIdlInfo;
-};
-
-struct _MemberType
-{
- IDL_tree mOuterList;
- IDL_tree mInnerList;
-};
-
-struct _ParameterType
-{
- IDL_tree mList;
-};
-
-struct _EnumMemberType
-{
- IDL_tree mList;
-};
-
-#define PATTERN "/*.idl"
-#define PATTERN_LENGTH (sizeof(PATTERN)-1)
-
-CORBA_boolean TypeManager_Init(const char * pIdlDirectory)
-{
- if (pIdlDirectory != NULL)
- {
- glob_t result;
- char * p_pattern =
- orbit_new_n(char, strlen(pIdlDirectory) + PATTERN_LENGTH + 1);
- strcpy(p_pattern, pIdlDirectory);
- strcat(p_pattern, PATTERN);
-
- if (glob(p_pattern, 0, NULL, &result) == 0)
- {
- /* success... */
- int i;
- for (i = 0; i < result.gl_pathc; i++)
- {
- TypeManager_LoadFile(result.gl_pathv[i]);
- }
-
- globfree(&result);
- }
-
- orbit_delete(p_pattern);
- }
-
- return TRUE;
-}
-
-CORBA_boolean TypeManager_Shutdown()
-{
- IDL_tree_free(gTypeManager.mRoot);
- return TRUE;
-}
-
-CORBA_boolean TypeManager_LoadFile(const char * pFilename)
-{
- int x;
- IDL_tree root;
- IDL_ns namespace;
- IDL_tree list;
-
- x = IDL_parse_filename(
- pFilename,
- "",
- NULL,
- &root, &namespace,
- IDLF_TYPECODES|IDLF_CODEFRAGS,
- IDL_WARNING1);
-
- if(IDL_SUCCESS != x)
- {
-/* php_error(E_WARNING, "IDL_parse_filename returned %i");*/
- return FALSE;
- }
-
- list = IDL_list_new(root);
-
- if (gTypeManager.mRoot == NULL)
- gTypeManager.mRoot = list;
- else
- IDL_list_concat(gTypeManager.mRoot,list);
-
- /* get rid of this immediatly? */
- IDL_ns_free(namespace);
-
- return TRUE;
-}
-
-
-/* type manager functions */
-InterfaceType * TypeManager_FindInterface(/*TypeManager * pTypeManager, */
- const char * pRepositoryId)
-{
- InterfaceType * pInterface = orbit_new(InterfaceType);
- CORBA_boolean success = orbit_find_type(
- gTypeManager.mRoot, pRepositoryId, IDLN_INTERFACE, &pInterface->mIdlInfo);
-
- if (!success)
- {
- orbit_delete(pInterface);
- return NULL;
- }
-
- return pInterface;
-}
-
-StructType * TypeManager_FindStruct(/*TypeManager * pTypeManager, */
- const char * pRepositoryId)
-{
- StructType * pStruct = orbit_new(StructType);
- CORBA_boolean success = orbit_find_type(
- gTypeManager.mRoot, pRepositoryId, IDLN_TYPE_STRUCT, &pStruct->mIdlInfo);
-
- if (!success)
- {
- orbit_delete(pStruct);
- pStruct = NULL;
- }
-
- return pStruct;
-}
-
-EnumType * TypeManager_FindEnum(/*TypeManager * pTypeManager, */
- const char * pRepositoryId)
-{
- EnumType * pEnum = orbit_new(EnumType);
- CORBA_boolean success = orbit_find_type(
- gTypeManager.mRoot, pRepositoryId, IDLN_TYPE_ENUM, &pEnum->mIdlInfo);
- if (!success)
- {
- orbit_delete(pEnum);
- pEnum = NULL;
- }
- return pEnum;
-}
-
-ExceptionType * TypeManager_FindException(/*TypeManager * pTypeManager, */
- const char * pRepositoryId)
-{
- ExceptionType * pException = orbit_new(ExceptionType);
- CORBA_boolean success = orbit_find_type(
- gTypeManager.mRoot, pRepositoryId, IDLN_EXCEPT_DCL, &pException->mIdlInfo);
- if (!success)
- {
- orbit_delete(pException);
- pException = NULL;
- }
- return pException;
-}
-
-
-
-/*
- find an operation in an interface tree,
- recursing into inherited interfaces
-*/
-static CORBA_boolean
-findoperation_recurse( IDL_tree tree, const char *name,
- IdlInfo *pIdlInfo )
-{
- IDL_tree inherited;
- CORBA_boolean success;
-
- success = orbit_find_type( IDL_INTERFACE(tree).body,
- name, IDLN_OP_DCL,
- pIdlInfo );
- if ( success )
- return CORBA_TRUE;
-
- for ( inherited = IDL_INTERFACE(tree).inheritance_spec;
- inherited != NULL;
- inherited = IDL_LIST(inherited).next ) {
- IDL_tree ident = IDL_LIST(inherited).data;
- InterfaceType *iface;
-
- iface = TypeManager_FindInterface( IDL_IDENT(ident).repo_id );
- success = findoperation_recurse( iface->mIdlInfo.mType,
- name,
- pIdlInfo );
- orbit_delete( iface );
-
- if ( success )
- return CORBA_TRUE;
-
- zend_error( E_WARNING, "operation %s not found in iface %s\n",
- name, IDL_IDENT(ident).repo_id );
- }
-
- return CORBA_FALSE;
-}
-
-/* find an operation in an interface based on case-insensitive name */
-OperationType * InterfaceType_FindOperation( InterfaceType * pInterface,
- const char * name )
-{
- OperationType *pOperation = orbit_new(OperationType);
- IDL_tree tree = pInterface->mIdlInfo.mType;
- CORBA_boolean success;
-
- success = findoperation_recurse( tree, name,
- &pOperation->mIdlInfo );
-
- if ( success )
- return pOperation;
-
- orbit_delete(pOperation);
- return NULL;
-}
-
-/* find an attribute in an interface based on case-insensitive name */
-AttributeType * InterfaceType_FindAttribute(InterfaceType * pInterface,
- const char * name)
-{
- AttributeType * pAttribute = orbit_new(AttributeType);
- CORBA_boolean success = orbit_find_type(
- pInterface->mIdlInfo.mType, name, IDLN_ATTR_DCL, &pAttribute->mIdlInfo);
- if (!success)
- {
- orbit_delete(pAttribute);
- pAttribute = NULL;
- }
- return pAttribute;
-}
-
-/* return type */
-CORBA_TypeCode OperationType_GetReturnType(OperationType * pOperation)
-{
- return orbit_idl_tree_type_to_typecode(
- IDL_OP_DCL(pOperation->mIdlInfo.mType).op_type_spec);
-}
-
-/* walk parameter list */
-ParameterType * OperationType_GetFirstParameter(OperationType * pOperation)
-{
- ParameterType * pParameter = orbit_new(ParameterType);
- pParameter->mList =
- IDL_OP_DCL(pOperation->mIdlInfo.mType).parameter_dcls;
- return pParameter;
-}
-
-char * OperationType_GetName(OperationType * pOperation)
-{
- if (pOperation && pOperation->mIdlInfo.mIdent)
- return IDL_IDENT(pOperation->mIdlInfo.mIdent).str;
- else
- return NULL;
-}
-
-void TypeCodeList_release(CORBA_TypeCode * p_typecodes)
-{
- CORBA_TypeCode * p_item = p_typecodes;
-
- if (p_typecodes == NULL)
- return;
-
- /* delete each typecode */
- while (*p_item)
- {
- satellite_release_typecode(*p_item);
- p_item++;
- }
-
- satellite_delete(p_typecodes);
-}
-
-/*
- * the caller is responsible for calling TypeCodeList_release()
- * on the return value!
- */
-CORBA_TypeCode * OperationType_GetExceptionList(OperationType * pOperation)
-{
- int i;
- IDL_tree exception_list = IDL_OP_DCL(pOperation->mIdlInfo.mType).raises_expr;
- CORBA_TypeCode * p_typecodes = NULL;
-
- p_typecodes = orbit_new_n(CORBA_TypeCode,
- IDL_list_length(exception_list) + 1);
-
- /* the list data is of type IDL_IDENT */
- for (i = 0; exception_list != NULL; i++)
- {
- /* get typecode for exception */
- p_typecodes[i] =
- orbit_idl_tree_type_to_typecode(IDL_LIST(exception_list).data);
-
- exception_list = IDL_LIST(exception_list).next;
- }
-
- /* set typecode for last element */
- p_typecodes[i] = CORBA_OBJECT_NIL;
-
- return p_typecodes;
-
-#if 0
-error:
- TypeCodeList_release(p_typecodes);
- return NULL;
-#endif
-}
-
-
-
-CORBA_boolean ParameterType_GetNext(ParameterType * pParameter)
-{
- if (ParameterType_IsValid(pParameter))
- {
- pParameter->mList = IDL_LIST(pParameter->mList).next;
- return pParameter->mList != NULL;
- }
- else
- return FALSE;
-}
-
-CORBA_boolean ParameterType_IsValid(ParameterType * pParameter)
-{
- return pParameter && pParameter->mList;
-}
-
-/* get typecode for parameter */
-CORBA_TypeCode ParameterType_GetType(ParameterType * pParameter)
-{
- return orbit_idl_tree_type_to_typecode(
- IDL_PARAM_DCL(IDL_LIST(pParameter->mList).data).param_type_spec);
-}
-
-/* return CORBA_ARG_IN, CORBA_ARG_OUT or CORBA_ARG_INOUT */
-int ParameterType_GetPassingMode(ParameterType * pParameter)
-{
- int flags = 0;
- enum IDL_param_attr attr;
-
- if (pParameter == NULL || pParameter->mList == NULL)
- return flags;
-
- attr = IDL_PARAM_DCL(IDL_LIST(pParameter->mList).data).attr;
-
- /* check parameter passing mode */
- switch (attr)
- {
- case IDL_PARAM_IN: flags = CORBA_ARG_IN; break;
- case IDL_PARAM_OUT: flags = CORBA_ARG_OUT; break;
- case IDL_PARAM_INOUT: flags = CORBA_ARG_INOUT; break;
- default:
- /* should not get here! */
- }
-
- return flags;
-
-}
-
-CORBA_boolean AttributeType_IsValid(AttributeType * pAttribute)
-{
- return
- pAttribute != NULL &&
- pAttribute->mIdlInfo.mType != NULL &&
- pAttribute->mIdlInfo.mIdent != NULL;
-}
-
-/* is readonly? */
-CORBA_boolean AttributeType_IsReadonly(AttributeType * pAttribute)
-{
- if (AttributeType_IsValid(pAttribute))
- return IDL_ATTR_DCL(pAttribute->mIdlInfo.mType).f_readonly;
- else
- return FALSE;
-}
-
-
-/* get typecode for attribute */
-CORBA_TypeCode AttributeType_GetType(AttributeType * pAttribute)
-{
- if (AttributeType_IsValid(pAttribute))
- return orbit_idl_tree_type_to_typecode(
- IDL_ATTR_DCL(pAttribute->mIdlInfo.mType).param_type_spec);
- else
- return NULL;
-}
-
-/* get name of Attribute in true case */
-char * AttributeType_GetName(AttributeType * pAttribute)
-{
- if (AttributeType_IsValid(pAttribute))
- return IDL_IDENT(pAttribute->mIdlInfo.mIdent).str;
- else
- return NULL;
-}
-
-/* structure handling */
-MemberType * StructType_GetFirstMember(StructType * pStruct)
-{
- /* very similar to ExceptionType_GetFirstMember */
- MemberType * pMember = orbit_new(MemberType);
- pMember->mOuterList =
- IDL_TYPE_STRUCT(pStruct->mIdlInfo.mType).member_list;
- pMember->mInnerList =
- IDL_MEMBER(IDL_LIST(pMember->mOuterList).data).dcls;
- return pMember;
-}
-
-char * StructType_GetRepositoryId(StructType * pStruct)
-{
- return IDL_IDENT(IDL_TYPE_STRUCT(pStruct->mIdlInfo.mType).ident).repo_id;
-}
-
-/* exception handling */
-MemberType * ExceptionType_GetFirstMember(ExceptionType * pException)
-{
- /* very similar to StructType_GetFirstMember */
- MemberType * pMember = orbit_new(MemberType);
- pMember->mOuterList =
- IDL_EXCEPT_DCL(pException->mIdlInfo.mType).members;
- pMember->mInnerList =
- IDL_MEMBER(IDL_LIST(pMember->mOuterList).data).dcls;
- return pMember;
-}
-
-char * ExceptionType_GetRepositoryId(ExceptionType * pException)
-{
- return IDL_IDENT(IDL_EXCEPT_DCL(pException->mIdlInfo.mType).ident).repo_id;
-}
-
-/* get a typecode for this exception (used by orbit_exception_value) */
-CORBA_TypeCode ExceptionType_GetTypeCode(ExceptionType * pException)
-{
- return orbit_idl_tree_type_to_typecode(pException->mIdlInfo.mType);
-}
-
-/*
- * Structure and exception members
- */
-CORBA_boolean MemberType_IsValid(MemberType * pMember)
-{
- return pMember && pMember->mOuterList && pMember->mInnerList;
-}
-
-CORBA_boolean MemberType_GetNext(MemberType * pMember)
-{
- if (pMember == NULL || pMember->mOuterList == NULL || pMember->mInnerList == NULL)
- return FALSE;
-
- pMember->mInnerList = IDL_LIST(pMember->mInnerList).next;
-
- /* if we're at the end of the inner list, advance the outer list */
- if (pMember->mInnerList == NULL)
- {
- pMember->mOuterList = IDL_LIST(pMember->mOuterList).next;
- if (pMember->mOuterList == NULL)
- return FALSE;
-
- /* initialize inner list */
- pMember->mInnerList =
- IDL_MEMBER(IDL_LIST(pMember->mOuterList).data).dcls;
- }
-
- return TRUE;
-}
-
-char * MemberType_GetName(MemberType * pMember)
-{
- if (pMember == NULL || pMember->mInnerList == NULL)
- return NULL;
- else
- return IDL_IDENT(IDL_LIST(pMember->mInnerList).data).str;
-}
-
-/* for struct/exception */
-CORBA_TypeCode MemberType_GetType(MemberType * pMember);
-/* not used because this is only cared for in typecode.c */
-
-
-/*
- * Enumeration
- */
-
-char * EnumType_GetRepositoryId(EnumType * pEnum)
-{
- return IDL_IDENT(IDL_TYPE_ENUM(pEnum->mIdlInfo.mType).ident).repo_id;
-}
-
-
-EnumMemberType * EnumType_GetFirstMember(EnumType * pEnum)
-{
- if (pEnum != NULL)
- {
- EnumMemberType * pEnumMember = orbit_new(EnumMemberType);
-
- pEnumMember->mList =
- IDL_TYPE_ENUM(pEnum->mIdlInfo.mType).enumerator_list;
-
- return pEnumMember;
- }
- else
- return NULL;
-}
-
-CORBA_boolean EnumMemberType_IsValid(EnumMemberType * pEnumMember)
-{
- return pEnumMember && pEnumMember->mList;
-}
-
-CORBA_boolean EnumMemberType_GetNext(EnumMemberType * pEnumMember)
-{
- /* reuse object! */
- pEnumMember->mList = IDL_LIST(pEnumMember->mList).next;
-
- return pEnumMember->mList != NULL;
-}
-
-char * EnumMemberType_GetName(EnumMemberType * pEnumMember)
-{
- return IDL_IDENT(IDL_LIST(pEnumMember->mList).data).str;
-}
-
-
-/* release types */
-void AttributeType_release(AttributeType * pMember) { orbit_delete(pMember); }
-void EnumMemberType_release(EnumMemberType * pMember) { orbit_delete(pMember); }
-void ExceptionType_release(ExceptionType * pException) { orbit_delete(pException); }
-void InterfaceType_release(InterfaceType * pInterface) { orbit_delete(pInterface); }
-void MemberType_release(MemberType * pMember) { orbit_delete(pMember); }
-void OperationType_release(OperationType * pOperation) { orbit_delete(pOperation); }
-void ParameterType_release(ParameterType * pParameter) { orbit_delete(pParameter); }
-void StructType_release(StructType * pStruct) { orbit_delete(pStruct); }
-
-
diff --git a/ext/satellite/typemanager.h b/ext/satellite/typemanager.h
deleted file mode 100644
index 1d7827ccd0..0000000000
--- a/ext/satellite/typemanager.h
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: David Eriksson <david@2good.com> |
- +----------------------------------------------------------------------+
- */
-
-/*
- * $Id$
- * vim: syntax=c tabstop=2 shiftwidth=2
- */
-
-#ifndef __typemanager_h__
-#define __typemanager_h__
-
-#include <orb/orbit.h>
-
-typedef struct _TypeManager TypeManager;
-typedef struct _InterfaceType InterfaceType;
-typedef struct _StructType StructType;
-typedef struct _EnumType EnumType;
-typedef struct _ExceptionType ExceptionType;
-typedef struct _OperationType OperationType;
-typedef struct _AttributeType AttributeType;
-typedef struct _MemberType MemberType;
-typedef struct _ParameterType ParameterType;
-typedef struct _EnumMemberType EnumMemberType;
-
-/* type manager */
-CORBA_boolean TypeManager_Init(const char * pIdlDirectory);
-CORBA_boolean TypeManager_Shutdown();
-
-CORBA_boolean TypeManager_LoadFile(const char * pFilename);
-InterfaceType * TypeManager_FindInterface(/*TypeManager * pTypeManager, */
- const char * pRepositoryId);
-StructType * TypeManager_FindStruct(/*TypeManager * pTypeManager, */
- const char * pRepositoryId);
-EnumType * TypeManager_FindEnum(/*TypeManager * pTypeManager, */
- const char * pRepositoryId);
-ExceptionType * TypeManager_FindException(/*TypeManager * pTypeManager, */
- const char * pRepositoryId);
-
-/* interface */
-OperationType * InterfaceType_FindOperation(InterfaceType * pInterface,
- const char * name);
-AttributeType * InterfaceType_FindAttribute(InterfaceType * pInterface,
- const char * name);
-
-/* operation */
-ParameterType * OperationType_GetFirstParameter(OperationType * pOperation);
-CORBA_TypeCode OperationType_GetReturnType(OperationType * pOperation);
-char * OperationType_GetName(OperationType * pOperation);
-CORBA_TypeCode * OperationType_GetExceptionList(OperationType * pOperation);
-
-/* parameter */
-CORBA_boolean ParameterType_GetNext(ParameterType * pParameter);
-int ParameterType_GetPassingMode(ParameterType * pParameter);
-CORBA_TypeCode ParameterType_GetType(ParameterType * pParameter);
-CORBA_boolean ParameterType_IsValid(ParameterType * pParameter);
-
-/* attribute */
-char * AttributeType_GetName(AttributeType * pAttribute);
-CORBA_TypeCode AttributeType_GetType(AttributeType * pAttribute);
-CORBA_boolean AttributeType_IsReadonly(AttributeType * pAttribute);
-CORBA_boolean AttributeType_IsValid(AttributeType * pAttribute);
-
-/* struct */
-MemberType * StructType_GetFirstMember(StructType * pStruct);
-char * StructType_GetRepositoryId(StructType * pStruct);
-
-/* exception */
-MemberType * ExceptionType_GetFirstMember(ExceptionType * pException);
-char * ExceptionType_GetRepositoryId(ExceptionType * pException);
-CORBA_TypeCode ExceptionType_GetTypeCode(ExceptionType * pException);
-
-/* member */
-CORBA_boolean MemberType_GetNext(MemberType * pMember);
-char * MemberType_GetName(MemberType * pMember);
-CORBA_TypeCode MemberType_GetType(MemberType * pMember);
-CORBA_boolean MemberType_IsValid(MemberType * pMember);
-
-/* enum */
-EnumMemberType * EnumType_GetFirstMember(EnumType * pEnum);
-CORBA_boolean EnumMemberType_GetNext(EnumMemberType * pEnumMember);
-CORBA_boolean EnumMemberType_IsValid(EnumMemberType * pEnumMember);
-char * EnumMemberType_GetName(EnumMemberType * pEnumMember);
-char * EnumType_GetRepositoryId(EnumType * pEnum);
-
-/* release types */
-void AttributeType_release(AttributeType * pMember);
-void EnumMemberType_release(EnumMemberType * pMember);
-void ExceptionType_release(ExceptionType * pException);
-void InterfaceType_release(InterfaceType * pInterface);
-void MemberType_release(MemberType * pMember);
-void OperationType_release(OperationType * pOperation);
-void ParameterType_release(ParameterType * pParameter);
-void StructType_release(StructType * pStruct);
-void TypeCodeList_release(CORBA_TypeCode * p_typecodes);
-
-#endif /* __typemanager_h__ */
-
diff --git a/ext/satellite/zval_to_namedvalue.c b/ext/satellite/zval_to_namedvalue.c
deleted file mode 100644
index 1d0a3dbff3..0000000000
--- a/ext/satellite/zval_to_namedvalue.c
+++ /dev/null
@@ -1,480 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: David Eriksson <david@2good.com> |
- +----------------------------------------------------------------------+
- */
-
-/*
- * $Id$
- * vim: syntax=c tabstop=2 shiftwidth=2
- */
-
-/* -----------------------------------------------------------------------
- *
- * Functions to convert a zval to a CORBA_NamedValue
- *
- * -----------------------------------------------------------------------
- */
-#include <zend_API.h>
-#include "zval_to_namedvalue.h"
-#include "object.h"
-#include "struct.h"
-#include "common.h"
-#include "corba.h"
-
-#include <ORBitutil/util.h> /* for ALIGN_ADDRESS() */
-
-/*
- * value should be a CORBA_boolean *
- */
-static zend_bool satellite_zval_to_namedvalue_boolean(const zval * pSource,
- CORBA_NamedValue * pDestination)
-{
- CORBA_boolean * p_value = (CORBA_boolean *)pDestination->argument._value;
-
- pDestination->len = sizeof(CORBA_boolean);
-
- if (pSource == NULL)
- return TRUE;
-
- if (pSource->type != IS_BOOL && pSource->type != IS_LONG)
- return FALSE;
-
- *p_value = pSource->value.lval != 0;
-
- return TRUE;
-}
-
-
-/*
- * value should be a double *
- */
-static zend_bool satellite_zval_to_namedvalue_double(const zval * pSource,
- CORBA_NamedValue * pDestination)
-{
- CORBA_double * p_value = (CORBA_double *)pDestination->argument._value;
-
- pDestination->len = sizeof(CORBA_double);
-
- if (pSource == NULL)
- return TRUE;
-
- /*convert_to_double(pSource);*/
- if (pSource->type != IS_DOUBLE)
- return FALSE;
-
- *p_value = pSource->value.dval;
-
- return TRUE;
-}
-
-/*
- * value should be a long *
- */
-static zend_bool satellite_zval_to_namedvalue_long(const zval * pSource,
- CORBA_NamedValue * pDestination)
-{
- CORBA_long * p_value = (CORBA_long *)pDestination->argument._value;
- pDestination->len = sizeof(CORBA_long);
-
- if (pSource == NULL)
- return TRUE;
-
- /*convert_to_long(pSource);*/
- if (pSource->type != IS_LONG)
- return FALSE;
-
- *p_value = pSource->value.lval;
-
- return TRUE;
-}
-
-/*
- * value should be a short *
- */
-static zend_bool satellite_zval_to_namedvalue_short(const zval * pSource,
- CORBA_NamedValue * pDestination)
-{
- CORBA_short * p_value = (CORBA_short *)pDestination->argument._value;
- pDestination->len = sizeof(CORBA_short);
-
- if (pSource == NULL)
- return TRUE;
-
-/* convert_to_long((zval *)pSource);*/ /* discard const */;
- if (pSource->type != IS_LONG)
- {
-/* printf("source value type is %i in satellite_zval_to_namedvalue_short\n", pSource->type);*/
- return FALSE;
- }
-
- *p_value = pSource->value.lval;
-
- return TRUE;
-}
-
-/*
- * convert an OrbitObject to a CORBA object
- *
- * value should just be a CORBA_Object
- */
-static zend_bool satellite_zval_to_namedvalue_objref(const zval * pSource,
- CORBA_NamedValue * pDestination)
-{
- OrbitObject * pObject = NULL;
- CORBA_Object * p_value = (CORBA_Object*)&pDestination->argument._value;
-
- pDestination->len = 1;
-
- if (pSource == NULL)
- return TRUE; /* nothing else to do */
-
- if (pSource->type != IS_OBJECT)
- goto error;
-
- /* see that it's a corba object */
- if (strcmp(pSource->value.obj.ce->name, "OrbitObject") != 0)
- goto error; /* bad class type */
-
- pObject = OrbitObject_RetrieveData(pSource);
- if (pObject == NULL)
- goto error; /* unexpected error */
-
- *p_value = OrbitObject_GetCorbaObject(pObject);
-
- /* debug */
-/* (CORBA_Object)pDestination->argument._value = OrbitObject_GetCorbaObject(pObject);*/
-
- if (*p_value == NULL)
- {
-/* printf("NULL object in satellite_zval_to_namedvalue_objref\n");*/
- goto error;
- }
-
-/* printf("satellite_zval_to_namedvalue_objref: %s\n", (*p_value)->type_id);*/
-
- return TRUE;
-
-error:
- return FALSE;
-}
-
-/*
- * convert a PHP array to a CORBA sequence
- *
- * value should be a CORBA_sequence_octet *
- */
-static zend_bool satellite_zval_to_namedvalue_sequence(const zval * pSource,
- CORBA_NamedValue * pDestination)
-{
- CORBA_sequence_octet * p_sequence_octet =
- (CORBA_sequence_octet *)pDestination->argument._value;
- HashTable * p_hashtable = NULL;
- int member_count = 0;
-
- if (pSource == NULL)
- return TRUE; /* nothing to do */
-
- if (pSource->type != IS_ARRAY)
- goto error; /* bad source type */
-
- p_hashtable = pSource->value.ht;
- member_count = zend_hash_num_elements(p_hashtable);
-
- /* prepare sequence octet */
- ORBit_sequence_octet_init(p_sequence_octet, member_count);
-
- /*
- * XXX: potential bug nest follows
- */
- if (member_count > 0)
- {
- CORBA_NamedValue destination_value;
- zval * p_source_value;
- HashPosition position = NULL;
- int i;
- void ** p_members = (void **)p_sequence_octet->_buffer;
-
- /* prepare to start walking the hash table */
- zend_hash_internal_pointer_reset_ex(p_hashtable, &position);
-
- for(i = 0; i < member_count; i++)
- {
- if (position == NULL)
- goto error;
-
-#if 0
- /* the function call gets messed up */
- if (zend_hash_get_current_data_ex(
- p_hashtable, /* XXX */, &position) == FAILURE)
- goto error;
-#else
- p_source_value = *(zval**)position->pData;
-#endif
-
- memset(&destination_value, 0, sizeof(destination_value));
-
- destination_value.argument._type = CORBA_TypeCode_content_type(
- pDestination->argument._type, orbit_get_environment());
-
- if (orbit_caught_exception())
- goto error;
-
- /* now get a NamedValue for this element */
- if (!orbit_zval_to_namedvalue(p_source_value, &destination_value))
- goto error;
-
- /* put values in our value */
- p_members[i] = *(void**)destination_value.argument._value;
-
- /* get next in hashtable */
- if (zend_hash_move_forward_ex(p_hashtable, &position) == FAILURE)
- goto error;
- }
- }
-
-/* pDestination->argument._value = p_sequence_octet;*/
- return TRUE;
-
-error:
- ORBit_sequence_octet_fini(p_sequence_octet); /* appropriate destruction? */
- return FALSE;
-}
-
-/*
- * convert a PHP string to a CORBA string
- *
- * value should be a char **
- */
-static zend_bool satellite_zval_to_namedvalue_string(const zval * pSource,
- CORBA_NamedValue * pDestination)
-{
- char ** p_value = (char **)pDestination->argument._value;
-
- if (pSource == NULL)
- return TRUE; /* do nothing */
-
-#if 0
- convert_to_string((zval *)pSource); /* discard const */
- if (pSource->type == IS_NULL)
- return TRUE; /* do nothing */
-#endif
-
- if (pSource->type != IS_STRING)
- goto error;
-
- *p_value = CORBA_string_dup(pSource->value.str.val);
- pDestination->len = strlen(*p_value);
-
- return TRUE;
-
-error:
- return FALSE;
-}
-
-/*
- * convert an OrbitStruct object to a CORBA structure
- *
- * XXX: this is trouble!
- *
- */
-static zend_bool satellite_zval_to_namedvalue_struct(const zval * pSource,
- CORBA_NamedValue * pDestination)
-{
- OrbitStruct * p_struct = NULL;
- int member_count = 0;
- CORBA_TypeCode type = NULL;
-
- pDestination->len = 1;
-
- /* nothing else to do if we have no source object */
- if (pSource == NULL)
- return TRUE;
-
- /* see that it's an object */
- if (pSource->type != IS_OBJECT)
- goto error; /* bad source type */
-
- /* see that it's a structure object */
- if (strcmp(pSource->value.obj.ce->name, "OrbitStruct") != 0)
- goto error; /* bad class type */
-
- /* get struct info */
- p_struct = OrbitStruct_RetrieveData(pSource);
- if (p_struct == NULL)
- goto error; /* unexpected error */
-
- /* make type a shortcut to the typecode */
- type = pDestination->argument._type;
-
- /* check respository ids */
- {
- char * p_source_repository_id = OrbitStruct_GetRepositoryId(p_struct);
- char * p_destination_repository_id = CORBA_TypeCode_id(type, orbit_get_environment());
-
- if (orbit_caught_exception())
- goto error;
-
- if (strcmp(p_destination_repository_id, p_source_repository_id) != 0)
- goto error; /* bad struct */
- }
-
- /* now we know the source and destination matches! */
- member_count = CORBA_TypeCode_member_count(type, orbit_get_environment());
- if (orbit_caught_exception())
- goto error;
-
- if (member_count > 0)
- {
- int i;
- CORBA_NamedValue destination_value;
- zval source_value;
- zend_bool success;
- char * p_buffer = (char *)pDestination->argument._value;
- int element_size = 0;
-
- for (i = 0; i < member_count; i++)
- {
- int alignment;
- /* get member name */
- char * p_name =
- CORBA_TypeCode_member_name(type, i, orbit_get_environment());
- if (orbit_caught_exception())
- goto error;
-
- /* get source value */
- success = OrbitStruct_GetProperty(p_struct, p_name, &source_value);
- if (!success)
- {
- goto error;
- }
-
- /* prepare destination value */
- memset(&destination_value, 0, sizeof(CORBA_NamedValue));
- destination_value.argument._type =
- CORBA_TypeCode_member_type(type, i, orbit_get_environment());
- if (destination_value.argument._type == NULL)
- goto error;
-
- /* convert member */
- success = orbit_zval_to_namedvalue(&source_value, &destination_value);
- if (!success)
- goto error;
-
- element_size = ORBit_gather_alloc_info(destination_value.argument._type);
-
- /* align pointer and set value */
- alignment = ORBit_find_alignment(destination_value.argument._type);
- p_buffer = ALIGN_ADDRESS(p_buffer, alignment);
-
- /* copy value to struct */
- memcpy(p_buffer, destination_value.argument._value, element_size);
- p_buffer += element_size;
- }
- }
-
- return TRUE;
-
-error:
- return FALSE;
-}
-
-/*
- * public function to convert form a zval to CORBA_NamedValue
- *
- * The data type specific functions does not own
- * pDestination->argument._value!!!
- */
-zend_bool orbit_zval_to_namedvalue(const zval * pSource,
- CORBA_NamedValue * pDestination)
-{
- zend_bool success = FALSE;
- CORBA_TCKind kind;
-
- if (pDestination->argument._type == NULL)
- {
-/* printf("pDestination->argument._type is NULL in orbit_zval_to_namedvalue\n");*/
- return FALSE;
- }
-
- kind = CORBA_TypeCode_kind(
- pDestination->argument._type,
- orbit_get_environment());
-
- if (orbit_caught_exception())
- return FALSE;
-
- /* allocate memory for value */
- if (pSource != NULL)
- {
- /* use special function to allocate value -- good or bad idea? */
- pDestination->argument._value =
- ORBit_alloc_tcval(pDestination->argument._type, 1);
- }
-
- switch (kind)
- {
- case CORBA_tk_boolean:
- success = satellite_zval_to_namedvalue_boolean(pSource, pDestination);
- break;
-
- case CORBA_tk_double:
- success = satellite_zval_to_namedvalue_double(pSource, pDestination);
- break;
-
- case CORBA_tk_enum:
- case CORBA_tk_long:
- success = satellite_zval_to_namedvalue_long(pSource, pDestination);
- break;
-
- case CORBA_tk_objref:
- success = satellite_zval_to_namedvalue_objref(pSource, pDestination);
- break;
-
- case CORBA_tk_sequence:
- success = satellite_zval_to_namedvalue_sequence(pSource, pDestination);
- break;
-
- case CORBA_tk_short:
- success = satellite_zval_to_namedvalue_short(pSource, pDestination);
- break;
-
- case CORBA_tk_string: /* 18 */
- success = satellite_zval_to_namedvalue_string(pSource, pDestination);
- break;
-
- case CORBA_tk_struct: /* 15 */
- success = satellite_zval_to_namedvalue_struct(pSource, pDestination);
- break;
-
- default:
-/* printf("unsupported corba TCKind %i\n", kind);*/
-/* php_error(E_WARNING, "unsupported corba TCKind %i", kind);*/
- }
-
- if (!success)
- {
-/* printf("orbit_zval_to_namedvalue failed for TCKind %i\n", kind);*/
- /*
- * does this always crash? then we better look for another way of
- * freeing the data!
- */
-/* CORBA_free(pDestination->argument._value); */
- pDestination->argument._value = NULL;
- }
-
- return success;
-}
-
diff --git a/ext/satellite/zval_to_namedvalue.h b/ext/satellite/zval_to_namedvalue.h
deleted file mode 100644
index c4f12ad462..0000000000
--- a/ext/satellite/zval_to_namedvalue.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: David Eriksson <david@2good.com> |
- +----------------------------------------------------------------------+
- */
-
-/*
- * $Id$
- * vim: syntax=c tabstop=2 shiftwidth=2
- */
-
-#ifndef __zval_to_namedvalue_h__
-#define __zval_to_namedvalue_h__
-
-#include <zend.h>
-#include <orb/orbit.h>
-
-zend_bool orbit_zval_to_namedvalue(const zval * pSource, CORBA_NamedValue * pDestination);
-
-#endif /* __zval_to_namedvalue_h__ */
-
diff --git a/ext/session/CREDITS b/ext/session/CREDITS
deleted file mode 100644
index 79659c7035..0000000000
--- a/ext/session/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-Sessions
-Sascha Schumann, Andrei Zmievski
diff --git a/ext/session/Makefile.in b/ext/session/Makefile.in
deleted file mode 100644
index 2e1d76edb0..0000000000
--- a/ext/session/Makefile.in
+++ /dev/null
@@ -1,7 +0,0 @@
-
-LTLIBRARY_NAME = libsession.la
-LTLIBRARY_SOURCES = session.c mod_files.c mod_mm.c mod_user.c
-LTLIBRARY_SHARED_NAME = session.la
-LTLIBRARY_SHARED_LIBADD = $(SESSION_SHARED_LIBADD)
-
-include $(top_srcdir)/build/dynlib.mk
diff --git a/ext/session/config.m4 b/ext/session/config.m4
deleted file mode 100644
index 74c77414f7..0000000000
--- a/ext/session/config.m4
+++ /dev/null
@@ -1,39 +0,0 @@
-dnl $Id$
-
-PHP_ARG_WITH(mm,for mm support,
-[ --with-mm[=DIR] Include mm support for session storage])
-
-PHP_ARG_ENABLE(trans-sid,whether to enable transparent session id propagation,
-[ --enable-trans-sid Enable transparent session id propagation])
-
-PHP_ARG_ENABLE(session, whether to enable session support,
-[ --disable-session Disable session support], yes)
-
-if test "$PHP_MM" != "no"; then
- for i in /usr/local /usr $PHP_MM; do
- if test -f "$i/include/mm.h"; then
- MM_DIR=$i
- fi
- done
-
- if test -z "$MM_DIR" ; then
- AC_MSG_ERROR(cannot find mm library)
- fi
-
- PHP_ADD_LIBRARY_WITH_PATH(mm, $MM_DIR/lib, SESSION_SHARED_LIBADD)
- PHP_ADD_INCLUDE($MM_DIR/include)
- AC_DEFINE(HAVE_LIBMM, 1, [Whether you have libmm])
- PHP_MODULE_PTR(phpext_ps_mm_ptr)
-fi
-
-if test "$PHP_TRANS_SID" = "yes"; then
- AC_DEFINE(TRANS_SID, 1, [Whether you want transparent session id propagation])
-fi
-
-if test "$PHP_SESSION" != "no"; then
- AC_CHECK_FUNCS(pread pwrite)
- PHP_MISSING_PWRITE_DECL
- PHP_MISSING_PREAD_DECL
- PHP_EXTENSION(session,$ext_shared)
- PHP_SUBST(SESSION_SHARED_LIBADD)
-fi
diff --git a/ext/session/mod_files.c b/ext/session/mod_files.c
deleted file mode 100644
index 5ed3e0aa4d..0000000000
--- a/ext/session/mod_files.c
+++ /dev/null
@@ -1,349 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Sascha Schumann <sascha@schumann.cx> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#include "php.h"
-
-#include <sys/stat.h>
-#include <sys/types.h>
-
-#if HAVE_SYS_FILE_H
-#include <sys/file.h>
-#endif
-
-#if HAVE_DIRENT_H
-#include <dirent.h>
-#endif
-
-#ifdef PHP_WIN32
-#include "win32/readdir.h"
-#endif
-#include <time.h>
-
-#include <fcntl.h>
-#include <errno.h>
-
-#include "php_session.h"
-#include "mod_files.h"
-#include "ext/standard/flock_compat.h"
-
-#define FILE_PREFIX "sess_"
-
-typedef struct {
- int fd;
- char *lastkey;
- char *basedir;
- size_t basedir_len;
- size_t dirdepth;
- size_t st_size;
-} ps_files;
-
-ps_module ps_mod_files = {
- PS_MOD(files)
-};
-
-static int ps_files_valid_key(const char *key)
-{
- size_t len;
- const char *p;
- char c;
- int ret = 1;
-
- for (p = key; (c = *p); p++) {
- /* valid characters are a..z,A..Z,0..9 */
- if (!((c >= 'a' && c <= 'z') ||
- (c >= 'A' && c <= 'Z') ||
- (c >= '0' && c <= '9'))) {
- ret = 0;
- break;
- }
- }
-
- len = p - key;
-
- if (len == 0)
- ret = 0;
-
- return ret;
-}
-
-static char *ps_files_path_create(char *buf, size_t buflen, ps_files *data, const char *key)
-{
- size_t key_len;
- const char *p;
- int i;
- int n;
-
- key_len = strlen(key);
- if (key_len <= data->dirdepth || buflen <
- (strlen(data->basedir) + 2 * data->dirdepth + key_len + 5 + sizeof(FILE_PREFIX)))
- return NULL;
- p = key;
- memcpy(buf, data->basedir, data->basedir_len);
- n = data->basedir_len;
- buf[n++] = PHP_DIR_SEPARATOR;
- for (i = 0; i < (int)data->dirdepth; i++) {
- buf[n++] = *p++;
- buf[n++] = PHP_DIR_SEPARATOR;
- }
- memcpy(buf + n, FILE_PREFIX, sizeof(FILE_PREFIX) - 1);
- n += sizeof(FILE_PREFIX) - 1;
- memcpy(buf + n, key, key_len);
- n += key_len;
- buf[n] = '\0';
-
- return buf;
-}
-
-#ifndef O_BINARY
-#define O_BINARY 0
-#endif
-
-static void ps_files_close(ps_files *data)
-{
- if (data->fd != -1) {
- close(data->fd);
- data->fd = -1;
- }
-}
-
-static void ps_files_open(ps_files *data, const char *key)
-{
- char buf[MAXPATHLEN];
-
- if (data->fd < 0 || !data->lastkey || strcmp(key, data->lastkey)) {
- if (data->lastkey) {
- efree(data->lastkey);
- data->lastkey = NULL;
- }
-
- ps_files_close(data);
-
- if (!ps_files_valid_key(key) ||
- !ps_files_path_create(buf, sizeof(buf), data, key))
- return;
-
- data->lastkey = estrdup(key);
-
-#ifdef O_EXCL
- data->fd = VCWD_OPEN((buf, O_RDWR | O_BINARY));
-
- if (data->fd == -1 && errno == ENOENT)
- data->fd = VCWD_OPEN((buf, O_EXCL | O_RDWR | O_CREAT | O_BINARY, 0600));
-#else
- data->fd = VCWD_OPEN((buf, O_CREAT | O_RDWR | O_BINARY, 0600));
-#endif
- if (data->fd != -1)
- flock(data->fd, LOCK_EX);
-
- if (data->fd == -1)
- php_error(E_WARNING, "open(%s, O_RDWR) failed: %s (%d)", buf,
- strerror(errno), errno);
- }
-}
-
-static int ps_files_cleanup_dir(const char *dirname, int maxlifetime)
-{
- DIR *dir;
- char dentry[sizeof(struct dirent) + MAXPATHLEN];
- struct dirent *entry = (struct dirent *) &dentry;
- struct stat sbuf;
- char buf[MAXPATHLEN];
- time_t now;
- int nrdels = 0;
- size_t dirname_len;
-
- dir = opendir(dirname);
- if (!dir) {
- php_error(E_NOTICE, "ps_files_cleanup_dir: opendir(%s) failed: %s (%d)\n", dirname, strerror(errno), errno);
- return (0);
- }
-
- time(&now);
-
- dirname_len = strlen(dirname);
-
- /* Prepare buffer (dirname never changes) */
- memcpy(buf, dirname, dirname_len);
- buf[dirname_len] = PHP_DIR_SEPARATOR;
-
- while (php_readdir_r(dir, (struct dirent *) dentry, &entry) == 0 && entry) {
- /* does the file start with our prefix? */
- if (!strncmp(entry->d_name, FILE_PREFIX, sizeof(FILE_PREFIX) - 1)) {
- size_t entry_len;
-
- entry_len = strlen(entry->d_name);
- /* does it fit into our buffer? */
- if (entry_len + dirname_len + 2 < MAXPATHLEN) {
- /* create the full path.. */
- memcpy(buf + dirname_len + 1, entry->d_name, entry_len);
- /* NUL terminate it and */
- buf[dirname_len + entry_len + 1] = '\0';
- /* check whether its last access was more than maxlifet ago */
- if (VCWD_STAT(buf, &sbuf) == 0 &&
- (now - sbuf.st_atime) > maxlifetime) {
- VCWD_UNLINK(buf);
- nrdels++;
- }
- }
- }
- }
-
- closedir(dir);
-
- return (nrdels);
-}
-
-#define PS_FILES_DATA ps_files *data = PS_GET_MOD_DATA()
-
-PS_OPEN_FUNC(files)
-{
- ps_files *data;
- char *p;
-
- data = ecalloc(sizeof(*data), 1);
- PS_SET_MOD_DATA(data);
-
- data->fd = -1;
- if ((p = strchr(save_path, ';'))) {
- data->dirdepth = (size_t) strtol(save_path, NULL, 10);
- save_path = p + 1;
- }
- data->basedir_len = strlen(save_path);
- data->basedir = estrndup(save_path, data->basedir_len);
-
- return SUCCESS;
-}
-
-PS_CLOSE_FUNC(files)
-{
- PS_FILES_DATA;
-
- ps_files_close(data);
-
- if (data->lastkey)
- efree(data->lastkey);
- efree(data->basedir);
- efree(data);
- *mod_data = NULL;
-
- return SUCCESS;
-}
-
-PS_READ_FUNC(files)
-{
- long n;
- struct stat sbuf;
- PS_FILES_DATA;
-
- ps_files_open(data, key);
- if (data->fd < 0)
- return FAILURE;
-
- if (fstat(data->fd, &sbuf))
- return FAILURE;
-
- data->st_size = *vallen = sbuf.st_size;
- *val = emalloc(sbuf.st_size);
-
-#ifdef HAVE_PREAD
- n = pread(data->fd, *val, sbuf.st_size, 0);
-#else
- lseek(data->fd, 0, SEEK_SET);
- n = read(data->fd, *val, sbuf.st_size);
-#endif
- if (n != sbuf.st_size) {
- efree(*val);
- return FAILURE;
- }
-
- return SUCCESS;
-}
-
-PS_WRITE_FUNC(files)
-{
- long n;
- PS_FILES_DATA;
-
- ps_files_open(data, key);
- if (data->fd < 0)
- return FAILURE;
-
- /*
- * truncate file, if the amount of new data is smaller than
- * the existing data set.
- */
-
- if (vallen < (int)data->st_size)
- ftruncate(data->fd, 0);
-
-#ifdef HAVE_PWRITE
- n = pwrite(data->fd, val, vallen, 0);
-#else
- lseek(data->fd, 0, SEEK_SET);
- n = write(data->fd, val, vallen);
-#endif
-
- if (n != vallen) {
- php_error(E_WARNING, "write failed: %s (%d)", strerror(errno), errno);
- return FAILURE;
- }
-
- return SUCCESS;
-}
-
-PS_DESTROY_FUNC(files)
-{
- char buf[MAXPATHLEN];
- PS_FILES_DATA;
-
- if (!ps_files_path_create(buf, sizeof(buf), data, key))
- return FAILURE;
-
- ps_files_close(data);
-
- if (VCWD_UNLINK(buf) == -1) {
- return FAILURE;
- }
-
- return SUCCESS;
-}
-
-PS_GC_FUNC(files)
-{
- PS_FILES_DATA;
-
- /* we don't perform any cleanup, if dirdepth is larger than 0.
- we return SUCCESS, since all cleanup should be handled by
- an external entity (i.e. find -ctime x | xargs rm) */
-
- if (data->dirdepth == 0)
- *nrdels = ps_files_cleanup_dir(data->basedir, maxlifetime);
-
- return SUCCESS;
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/session/mod_files.h b/ext/session/mod_files.h
deleted file mode 100644
index bab104e9c8..0000000000
--- a/ext/session/mod_files.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Sascha Schumann <sascha@schumann.cx> |
- +----------------------------------------------------------------------+
- */
-
-#ifndef MOD_FILES_H
-#define MOD_FILES_H
-
-extern ps_module ps_mod_files;
-#define ps_files_ptr &ps_mod_files
-
-PS_FUNCS(files);
-
-#endif
diff --git a/ext/session/mod_files.sh b/ext/session/mod_files.sh
deleted file mode 100644
index 4d6a681d9c..0000000000
--- a/ext/session/mod_files.sh
+++ /dev/null
@@ -1,16 +0,0 @@
-#! /bin/sh
-
-if test "$2" = ""; then
- echo "usage: $0 basedir depth"
- exit 1
-fi
-
-if test "$2" = "0"; then
- exit 0
-fi
-
-for i in a b c d e f 0 1 2 3 4 5 6 7 8 9; do
- newpath="$1/$i"
- mkdir $newpath || exit 1
- sh $0 $newpath `expr $2 - 1`
-done
diff --git a/ext/session/mod_mm.c b/ext/session/mod_mm.c
deleted file mode 100644
index b6f4b52465..0000000000
--- a/ext/session/mod_mm.c
+++ /dev/null
@@ -1,365 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Sascha Schumann <sascha@schumann.cx> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#include "php.h"
-
-#ifdef HAVE_LIBMM
-
-#include <mm.h>
-#include <time.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <fcntl.h>
-
-#include "php_session.h"
-#include "mod_mm.h"
-
-#define PS_MM_PATH "/tmp/session_mm"
-
-/*
- * this list holds all data associated with one session
- */
-
-typedef struct ps_sd {
- struct ps_sd *next, *prev;
- time_t ctime;
- char *key;
- void *data;
- size_t datalen;
-} ps_sd;
-
-typedef struct {
- MM *mm;
- ps_sd **hash;
-} ps_mm;
-
-static ps_mm *ps_mm_instance = NULL;
-
-/* should be a prime */
-#define HASH_SIZE 577
-
-#if 0
-#define ps_mm_debug(a...) fprintf(stderr, a)
-#else
-#define ps_mm_debug
-#endif
-
-#define BITS_IN_int (sizeof(int) * CHAR_BIT)
-#define THREE_QUARTERS ((int) ((BITS_IN_int * 3) / 4))
-#define ONE_EIGTH ((int) (BITS_IN_int / 8))
-#define HIGH_BITS (~((unsigned int)(~0) >> ONE_EIGTH))
-
-/*
- * Weinberger's generic hash algorithm, adapted by Holub
- * (published in [Holub 1990])
- */
-
-static unsigned int ps_sd_hash(const char *data)
-{
- unsigned int val, i;
-
- for (val = 0; *data; data++) {
- val = (val << ONE_EIGTH) + *data;
- if ((i = val & HIGH_BITS) != 0)
- val = (val ^ (i >> THREE_QUARTERS)) & ~HIGH_BITS;
- }
-
- return val;
-}
-
-
-static ps_sd *ps_sd_new(ps_mm *data, const char *key, const void *sdata, size_t sdatalen)
-{
- unsigned int h;
- ps_sd *sd;
-
- h = ps_sd_hash(key) % HASH_SIZE;
-
- sd = mm_malloc(data->mm, sizeof(*sd));
- if (!sd)
- return NULL;
- sd->ctime = 0;
-
- sd->data = mm_malloc(data->mm, sdatalen);
- if (!sd->data) {
- mm_free(data->mm, sd);
- return NULL;
- }
-
- sd->datalen = sdatalen;
-
- sd->key = mm_strdup(data->mm, key);
- if (!sd->key) {
- mm_free(data->mm, sd->data);
- mm_free(data->mm, sd);
- return NULL;
- }
-
- memcpy(sd->data, sdata, sdatalen);
-
- if ((sd->next = data->hash[h]))
- sd->next->prev = sd;
- sd->prev = NULL;
-
- ps_mm_debug("inserting %s(%p) into %d\n", key, sd, h);
-
- data->hash[h] = sd;
-
- return sd;
-}
-
-static void ps_sd_destroy(ps_mm *data, ps_sd *sd)
-{
- unsigned int h;
-
- h = ps_sd_hash(sd->key) % HASH_SIZE;
-
- if (sd->next)
- sd->next->prev = sd->prev;
- if (sd->prev)
- sd->prev->next = sd->next;
-
- if (data->hash[h] == sd)
- data->hash[h] = sd->next;
-
- mm_free(data->mm, sd->key);
- if (sd->data)
- mm_free(data->mm, sd->data);
- mm_free(data->mm, sd);
-}
-
-static ps_sd *ps_sd_lookup(ps_mm *data, const char *key, int rw)
-{
- unsigned int h;
- ps_sd *ret;
-
- h = ps_sd_hash(key) % HASH_SIZE;
-
- for (ret = data->hash[h]; ret; ret = ret->next)
- if (!strcmp(ret->key, key))
- break;
-
- if (ret && rw && ret != data->hash[h]) {
- data->hash[h]->prev = ret;
- ret->next = data->hash[h];
- data->hash[h] = ret;
- ps_mm_debug("optimizing\n");
- }
-
- ps_mm_debug("lookup(%s): ret=%p,h=%d\n", key, ret, h);
-
- return ret;
-}
-
-ps_module ps_mod_mm = {
- PS_MOD(mm)
-};
-
-#define PS_MM_DATA ps_mm *data = PS_GET_MOD_DATA()
-
-static int ps_mm_initialize(ps_mm *data, const char *path)
-{
- data->mm = mm_create(0, path);
- if (!data->mm) {
- return FAILURE;
- }
-
- data->hash = mm_calloc(data->mm, HASH_SIZE, sizeof(*data->hash));
- if (!data->hash) {
- mm_destroy(data->mm);
- return FAILURE;
- }
-
- return SUCCESS;
-}
-
-static void ps_mm_destroy(ps_mm *data)
-{
- int h;
- ps_sd *sd, *next;
-
- for (h = 0; h < HASH_SIZE; h++)
- for (sd = data->hash[h]; sd; sd = next) {
- next = sd->next;
- ps_sd_destroy(data, sd);
- }
-
- mm_free(data->mm, data->hash);
- mm_destroy(data->mm);
-}
-
-PHP_MINIT_FUNCTION(ps_mm)
-{
- ps_mm_instance = calloc(sizeof(*ps_mm_instance), 1);
- if (ps_mm_initialize(ps_mm_instance, PS_MM_PATH) != SUCCESS) {
- ps_mm_instance = NULL;
- return FAILURE;
- }
- php_session_register_module(&ps_mod_mm);
- return SUCCESS;
-}
-
-PHP_MSHUTDOWN_FUNCTION(ps_mm)
-{
- if (ps_mm_instance) {
- ps_mm_destroy(ps_mm_instance);
- free(ps_mm_instance);
- return SUCCESS;
- }
- return FAILURE;
-}
-
-PS_OPEN_FUNC(mm)
-{
- ps_mm_debug("open: ps_mm_instance=%p\n", ps_mm_instance);
-
- if (!ps_mm_instance)
- return FAILURE;
-
- PS_SET_MOD_DATA(ps_mm_instance);
-
- return SUCCESS;
-}
-
-PS_CLOSE_FUNC(mm)
-{
- PS_SET_MOD_DATA(NULL);
-
- return SUCCESS;
-}
-
-PS_READ_FUNC(mm)
-{
- PS_MM_DATA;
- ps_sd *sd;
- int ret = FAILURE;
-
- mm_lock(data->mm, MM_LOCK_RD);
-
- sd = ps_sd_lookup(data, key, 0);
- if (sd) {
- *vallen = sd->datalen;
- *val = emalloc(sd->datalen);
- memcpy(*val, sd->data, sd->datalen);
- ret = SUCCESS;
- }
-
- mm_unlock(data->mm);
-
- return ret;
-}
-
-PS_WRITE_FUNC(mm)
-{
- PS_MM_DATA;
- ps_sd *sd;
-
- if (vallen == 0) return SUCCESS;
-
- mm_lock(data->mm, MM_LOCK_RW);
-
- sd = ps_sd_lookup(data, key, 1);
- if (!sd) {
- sd = ps_sd_new(data, key, val, vallen);
- ps_mm_debug("new one for %s\n", key);
- } else {
- ps_mm_debug("found existing one for %s\n", key);
- mm_free(data->mm, sd->data);
- sd->datalen = vallen;
- sd->data = mm_malloc(data->mm, vallen);
- if (!sd->data) {
- ps_sd_destroy(data, sd);
- sd = NULL;
- } else
- memcpy(sd->data, val, vallen);
- }
-
- if (sd)
- time(&sd->ctime);
-
- mm_unlock(data->mm);
-
- return sd ? SUCCESS : FAILURE;
-}
-
-PS_DESTROY_FUNC(mm)
-{
- PS_MM_DATA;
- ps_sd *sd;
-
- mm_lock(data->mm, MM_LOCK_RW);
-
- sd = ps_sd_lookup(data, key, 0);
- if (sd)
- ps_sd_destroy(data, sd);
-
- mm_unlock(data->mm);
-
- return SUCCESS;
-}
-
-PS_GC_FUNC(mm)
-{
- PS_MM_DATA;
- int h;
- time_t now;
- ps_sd *sd, *next;
-
- *nrdels = 0;
- ps_mm_debug("gc\n");
-
- mm_lock(data->mm, MM_LOCK_RW);
-
- time(&now);
-
- for (h = 0; h < HASH_SIZE; h++)
- for (sd = data->hash[h]; sd; sd = next) {
- next = sd->next;
- ps_mm_debug("looking at %s\n", sd->key);
- if ((now - sd->ctime) > maxlifetime) {
- ps_sd_destroy(data, sd);
- *nrdels++;
- }
- }
-
- mm_unlock(data->mm);
-
- return SUCCESS;
-}
-
-zend_module_entry php_session_mm_module = {
- "Session MM",
- NULL,
- PHP_MINIT(ps_mm), PHP_MSHUTDOWN(ps_mm),
- NULL, NULL,
- NULL,
- STANDARD_MODULE_PROPERTIES
-};
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/session/mod_mm.h b/ext/session/mod_mm.h
deleted file mode 100644
index 01b390c0f8..0000000000
--- a/ext/session/mod_mm.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Sascha Schumann <sascha@schumann.cx> |
- +----------------------------------------------------------------------+
- */
-
-#ifndef MOD_MM_H
-#define MOD_MM_H
-
-#ifdef HAVE_LIBMM
-
-#include "php_session.h"
-
-extern ps_module ps_mod_mm;
-#define ps_mm_ptr &ps_mod_mm
-
-extern zend_module_entry php_session_mm_module;
-#define phpext_ps_mm_ptr &php_session_mm_module
-
-PS_FUNCS(mm);
-
-#else
-
-#define ps_mm_ptr NULL
-#define phpext_ps_mm_ptr NULL
-
-#endif
-
-#endif
diff --git a/ext/session/mod_user.c b/ext/session/mod_user.c
deleted file mode 100644
index be4e89d50e..0000000000
--- a/ext/session/mod_user.c
+++ /dev/null
@@ -1,185 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Sascha Schumann <sascha@schumann.cx> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#include "php.h"
-#include "php_session.h"
-#include "mod_user.h"
-
-ps_module ps_mod_user = {
- PS_MOD(user)
-};
-
-#define SESS_ZVAL_LONG(val, a) \
-{ \
- MAKE_STD_ZVAL(a); \
- a->type = IS_LONG; \
- a->value.lval = val; \
-}
-
-#define SESS_ZVAL_STRING(vl, a) \
-{ \
- int len = strlen(vl); \
- MAKE_STD_ZVAL(a); \
- a->type = IS_STRING; \
- a->value.str.len = len; \
- a->value.str.val = estrndup(vl, len); \
-}
-
-#define SESS_ZVAL_STRINGN(vl, ln, a) \
-{ \
- MAKE_STD_ZVAL(a); \
- a->type = IS_STRING; \
- a->value.str.len = ln; \
- a->value.str.val = estrndup(vl, ln); \
-}
-
-
-static zval *ps_call_handler(zval *func, int argc, zval **argv)
-{
- int i;
- zval *retval = NULL;
- ELS_FETCH();
-
- MAKE_STD_ZVAL(retval);
- if (call_user_function(EG(function_table), NULL, func, retval,
- argc, argv) == FAILURE) {
- zval_ptr_dtor(&retval);
- retval = NULL;
- }
-
- for (i = 0; i < argc; i++) {
- zval_ptr_dtor(&argv[i]);
- }
-
- return retval;
-}
-
-#define STDVARS \
- zval *retval; \
- int ret = FAILURE; \
- ps_user *mdata = PS_GET_MOD_DATA(); \
- if (!mdata) \
- return FAILURE
-
-#define PSF(a) mdata->name.ps_##a
-
-#define FINISH \
- if (retval) { \
- convert_to_long(retval); \
- ret = retval->value.lval; \
- zval_ptr_dtor(&retval); \
- } \
- return ret
-
-PS_OPEN_FUNC(user)
-{
- zval *args[2];
- STDVARS;
-
- SESS_ZVAL_STRING(save_path, args[0]);
- SESS_ZVAL_STRING(session_name, args[1]);
-
- retval = ps_call_handler(PSF(open), 2, args);
-
- FINISH;
-}
-
-PS_CLOSE_FUNC(user)
-{
- int i;
- STDVARS;
-
- retval = ps_call_handler(PSF(close), 0, NULL);
-
- for (i = 0; i < 6; i++)
- zval_ptr_dtor(&mdata->names[i]);
- efree(mdata);
-
- PS_SET_MOD_DATA(NULL);
-
- FINISH;
-}
-
-PS_READ_FUNC(user)
-{
- zval *args[1];
- STDVARS;
-
- SESS_ZVAL_STRING(key, args[0]);
-
- retval = ps_call_handler(PSF(read), 1, args);
-
- if (retval) {
- if (retval->type == IS_STRING) {
- *val = estrndup(retval->value.str.val, retval->value.str.len);
- *vallen = retval->value.str.len;
- ret = SUCCESS;
- }
- zval_ptr_dtor(&retval);
- }
-
- return ret;
-}
-
-PS_WRITE_FUNC(user)
-{
- zval *args[2];
- STDVARS;
-
- SESS_ZVAL_STRING(key, args[0]);
- SESS_ZVAL_STRINGN(val, vallen, args[1]);
-
- retval = ps_call_handler(PSF(write), 2, args);
-
- FINISH;
-}
-
-PS_DESTROY_FUNC(user)
-{
- zval *args[1];
- STDVARS;
-
- SESS_ZVAL_STRING(key, args[0]);
-
- retval = ps_call_handler(PSF(destroy), 1, args);
-
- FINISH;
-}
-
-PS_GC_FUNC(user)
-{
- zval *args[1];
- STDVARS;
-
- SESS_ZVAL_LONG(maxlifetime, args[0]);
-
- retval = ps_call_handler(PSF(gc), 1, args);
-
- FINISH;
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/session/mod_user.h b/ext/session/mod_user.h
deleted file mode 100644
index c2123a8c15..0000000000
--- a/ext/session/mod_user.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Sascha Schumann <sascha@schumann.cx> |
- +----------------------------------------------------------------------+
- */
-
-#ifndef MOD_USER_H
-#define MOD_USER_H
-
-typedef union {
- zval *names[6];
- struct {
- zval *ps_open;
- zval *ps_close;
- zval *ps_read;
- zval *ps_write;
- zval *ps_destroy;
- zval *ps_gc;
- } name;
-} ps_user;
-
-extern ps_module ps_mod_user;
-#define ps_user_ptr &ps_mod_user
-
-PS_FUNCS(user);
-
-#endif
diff --git a/ext/session/php_session.h b/ext/session/php_session.h
deleted file mode 100644
index 97623915b5..0000000000
--- a/ext/session/php_session.h
+++ /dev/null
@@ -1,205 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Sascha Schumann <sascha@schumann.cx> |
- +----------------------------------------------------------------------+
- */
-
-#ifndef PHP_SESSION_H
-#define PHP_SESSION_H
-
-#define PS_OPEN_ARGS void **mod_data, const char *save_path, const char *session_name
-#define PS_CLOSE_ARGS void **mod_data
-#define PS_READ_ARGS void **mod_data, const char *key, char **val, int *vallen
-#define PS_WRITE_ARGS void **mod_data, const char *key, const char *val, const int vallen
-#define PS_DESTROY_ARGS void **mod_data, const char *key
-#define PS_GC_ARGS void **mod_data, int maxlifetime, int *nrdels
-
-typedef struct ps_module_struct {
- const char *name;
- int (*open)(PS_OPEN_ARGS);
- int (*close)(PS_CLOSE_ARGS);
- int (*read)(PS_READ_ARGS);
- int (*write)(PS_WRITE_ARGS);
- int (*destroy)(PS_DESTROY_ARGS);
- int (*gc)(PS_GC_ARGS);
-} ps_module;
-
-#define PS_GET_MOD_DATA() *mod_data
-#define PS_SET_MOD_DATA(a) *mod_data = (a)
-
-#define PS_OPEN_FUNC(x) int ps_open_##x(PS_OPEN_ARGS)
-#define PS_CLOSE_FUNC(x) int ps_close_##x(PS_CLOSE_ARGS)
-#define PS_READ_FUNC(x) int ps_read_##x(PS_READ_ARGS)
-#define PS_WRITE_FUNC(x) int ps_write_##x(PS_WRITE_ARGS)
-#define PS_DESTROY_FUNC(x) int ps_delete_##x(PS_DESTROY_ARGS)
-#define PS_GC_FUNC(x) int ps_gc_##x(PS_GC_ARGS)
-
-#define PS_FUNCS(x) \
- PS_OPEN_FUNC(x); \
- PS_CLOSE_FUNC(x); \
- PS_READ_FUNC(x); \
- PS_WRITE_FUNC(x); \
- PS_DESTROY_FUNC(x); \
- PS_GC_FUNC(x)
-
-
-#define PS_MOD(x) \
- #x, ps_open_##x, ps_close_##x, ps_read_##x, ps_write_##x, \
- ps_delete_##x, ps_gc_##x
-
-typedef struct {
- char *save_path;
- char *session_name;
- char *id;
- char *extern_referer_chk;
- char *entropy_file;
- char *cache_limiter;
- long entropy_length;
- long cookie_lifetime;
- char *cookie_path;
- char *cookie_domain;
- zend_bool cookie_secure;
- ps_module *mod;
- void *mod_data;
- HashTable vars;
- int nr_open_sessions;
- long gc_probability;
- long gc_maxlifetime;
- int module_number;
- long cache_expire;
- const struct ps_serializer_struct *serializer;
- zval *http_session_vars;
- zend_bool auto_start;
- zend_bool define_sid;
- zend_bool use_cookies;
-} php_ps_globals;
-
-extern zend_module_entry session_module_entry;
-#define phpext_session_ptr &session_module_entry
-
-PHP_FUNCTION(session_name);
-PHP_FUNCTION(session_module_name);
-PHP_FUNCTION(session_save_path);
-PHP_FUNCTION(session_id);
-PHP_FUNCTION(session_decode);
-PHP_FUNCTION(session_register);
-PHP_FUNCTION(session_unregister);
-PHP_FUNCTION(session_is_registered);
-PHP_FUNCTION(session_encode);
-PHP_FUNCTION(session_start);
-PHP_FUNCTION(session_destroy);
-PHP_FUNCTION(session_unset);
-PHP_FUNCTION(session_set_save_handler);
-PHP_FUNCTION(session_cache_limiter);
-PHP_FUNCTION(session_set_cookie_params);
-PHP_FUNCTION(session_get_cookie_params);
-PHP_FUNCTION(session_write_close);
-
-#ifdef ZTS
-#define PSLS_D php_ps_globals *ps_globals
-#define PSLS_DC , PSLS_D
-#define PSLS_C ps_globals
-#define PSLS_CC , PSLS_C
-#define PS(v) (ps_globals->v)
-#define PSLS_FETCH() php_ps_globals *ps_globals = ts_resource(ps_globals_id)
-#else
-#define PSLS_D void
-#define PSLS_DC
-#define PSLS_C
-#define PSLS_CC
-#define PS(v) (ps_globals.v)
-#define PSLS_FETCH()
-#endif
-
-#define PS_SERIALIZER_ENCODE_ARGS char **newstr, int *newlen PSLS_DC
-#define PS_SERIALIZER_DECODE_ARGS const char *val, int vallen PSLS_DC
-
-typedef struct ps_serializer_struct {
- const char *name;
- int (*encode)(PS_SERIALIZER_ENCODE_ARGS);
- int (*decode)(PS_SERIALIZER_DECODE_ARGS);
-} ps_serializer;
-
-#define PS_SERIALIZER_ENCODE_NAME(x) ps_srlzr_encode_##x
-#define PS_SERIALIZER_DECODE_NAME(x) ps_srlzr_decode_##x
-
-#define PS_SERIALIZER_ENCODE_FUNC(x) \
- int PS_SERIALIZER_ENCODE_NAME(x)(PS_SERIALIZER_ENCODE_ARGS)
-#define PS_SERIALIZER_DECODE_FUNC(x) \
- int PS_SERIALIZER_DECODE_NAME(x)(PS_SERIALIZER_DECODE_ARGS)
-
-#define PS_SERIALIZER_FUNCS(x) \
- PS_SERIALIZER_ENCODE_FUNC(x); \
- PS_SERIALIZER_DECODE_FUNC(x)
-
-#define PS_SERIALIZER_ENTRY(x) \
- { #x, PS_SERIALIZER_ENCODE_NAME(x), PS_SERIALIZER_DECODE_NAME(x) }
-
-#ifdef TRANS_SID
-void session_adapt_uris(const char *, size_t, char **, size_t *);
-void session_adapt_url(const char *, size_t, char **, size_t *);
-#else
-#define session_adapt_uris(a,b,c,d)
-#define session_adapt_url(a,b,c,d)
-#endif
-
-void php_set_session_var(char *name, size_t namelen, zval *state_val,HashTable *var_hash PSLS_DC);
-int php_get_session_var(char *name, size_t namelen, zval ***state_var PLS_DC PSLS_DC ELS_DC);
-
-int php_session_register_module(ps_module *);
-
-int php_session_register_serializer(const char *name,
- int (*encode)(PS_SERIALIZER_ENCODE_ARGS),
- int (*decode)(PS_SERIALIZER_DECODE_ARGS));
-
-#define PS_ADD_VARL(name,namelen) \
- zend_hash_add_empty_element(&PS(vars), name, namelen + 1)
-
-#define PS_ADD_VAR(name) PS_ADD_VARL(name, strlen(name))
-
-#define PS_DEL_VARL(name,namelen) \
- zend_hash_del(&PS(vars), name, namelen + 1);
-
-#define PS_DEL_VAR(name) PS_DEL_VARL(name, strlen(name))
-
-#define PS_ENCODE_VARS \
- char *key; \
- ulong key_length; \
- ulong num_key; \
- zval **struc; \
- ELS_FETCH(); \
- PLS_FETCH()
-
-#define PS_ENCODE_LOOP(code) \
- for (zend_hash_internal_pointer_reset(&PS(vars)); \
- zend_hash_get_current_key_ex(&PS(vars), &key, &key_length, &num_key, 0, NULL) == HASH_KEY_IS_STRING; \
- zend_hash_move_forward(&PS(vars))) { \
- key_length--; \
- if (php_get_session_var(key, key_length, &struc PLS_CC PSLS_CC ELS_CC) == SUCCESS) { \
- code; \
- } \
- }
-
-#ifdef ZTS
-extern int ps_globals_id;
-#else
-extern php_ps_globals ps_globals;
-#endif
-
-
-void php_session_auto_start(void *data);
-void php_session_shutdown(void *data);
-
-#endif
diff --git a/ext/session/session.c b/ext/session/session.c
deleted file mode 100644
index d373b5a757..0000000000
--- a/ext/session/session.c
+++ /dev/null
@@ -1,1464 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Sascha Schumann <sascha@schumann.cx> |
- | Andrei Zmievski <andrei@ispi.net> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-
-#ifdef PHP_WIN32
-#include "win32/time.h"
-#else
-#include <sys/time.h>
-#endif
-
-#include <sys/stat.h>
-#include <fcntl.h>
-
-#include "php_ini.h"
-#include "SAPI.h"
-#include "php_session.h"
-#include "ext/standard/md5.h"
-#include "ext/standard/php_var.h"
-#include "ext/standard/datetime.h"
-#include "ext/standard/php_lcg.h"
-#include "ext/standard/url_scanner_ex.h"
-#include "ext/standard/php_output.h"
-#include "ext/standard/php_rand.h" /* for RAND_MAX */
-#include "ext/standard/info.h"
-
-#include "ext/standard/php_smart_str.h"
-
-#include "mod_files.h"
-#include "mod_user.h"
-
-/* {{{ session_functions[]
- */
-function_entry session_functions[] = {
- PHP_FE(session_name, NULL)
- PHP_FE(session_module_name, NULL)
- PHP_FE(session_save_path, NULL)
- PHP_FE(session_id, NULL)
- PHP_FE(session_decode, NULL)
- PHP_FE(session_register, NULL)
- PHP_FE(session_unregister, NULL)
- PHP_FE(session_is_registered, NULL)
- PHP_FE(session_encode, NULL)
- PHP_FE(session_start, NULL)
- PHP_FE(session_destroy, NULL)
- PHP_FE(session_unset, NULL)
- PHP_FE(session_set_save_handler, NULL)
- PHP_FE(session_cache_limiter, NULL)
- PHP_FE(session_set_cookie_params, NULL)
- PHP_FE(session_get_cookie_params, NULL)
- PHP_FE(session_write_close, NULL)
- {0}
-};
-/* }}} */
-
-#ifdef ZTS
-int ps_globals_id;
-#else
-php_ps_globals ps_globals;
-#endif
-
-static ps_module *_php_find_ps_module(char *name PSLS_DC);
-static const ps_serializer *_php_find_ps_serializer(char *name PSLS_DC);
-
-static PHP_INI_MH(OnUpdateSaveHandler)
-{
- PSLS_FETCH();
-
- PS(mod) = _php_find_ps_module(new_value PSLS_CC);
- if(!PS(mod)) {
- php_error(E_ERROR,"Cannot find save handler %s",new_value);
- }
- return SUCCESS;
-}
-
-
-static PHP_INI_MH(OnUpdateSerializer)
-{
- PSLS_FETCH();
-
- PS(serializer) = _php_find_ps_serializer(new_value PSLS_CC);
- if(!PS(serializer)) {
- php_error(E_ERROR,"Cannot find serialization handler %s",new_value);
- }
- return SUCCESS;
-}
-
-
-/* {{{ PHP_INI
- */
-PHP_INI_BEGIN()
- STD_PHP_INI_ENTRY("session.save_path", "/tmp", PHP_INI_ALL, OnUpdateString, save_path, php_ps_globals, ps_globals)
- STD_PHP_INI_ENTRY("session.name", "PHPSESSID", PHP_INI_ALL, OnUpdateString, session_name, php_ps_globals, ps_globals)
- PHP_INI_ENTRY("session.save_handler", "files", PHP_INI_ALL, OnUpdateSaveHandler)
- STD_PHP_INI_BOOLEAN("session.auto_start", "0", PHP_INI_ALL, OnUpdateBool, auto_start, php_ps_globals, ps_globals)
- STD_PHP_INI_ENTRY("session.gc_probability", "1", PHP_INI_ALL, OnUpdateInt, gc_probability, php_ps_globals, ps_globals)
- STD_PHP_INI_ENTRY("session.gc_maxlifetime", "1440", PHP_INI_ALL, OnUpdateInt, gc_maxlifetime, php_ps_globals, ps_globals)
- PHP_INI_ENTRY("session.serialize_handler", "php", PHP_INI_ALL, OnUpdateSerializer)
- STD_PHP_INI_ENTRY("session.cookie_lifetime", "0", PHP_INI_ALL, OnUpdateInt, cookie_lifetime, php_ps_globals, ps_globals)
- STD_PHP_INI_ENTRY("session.cookie_path", "/", PHP_INI_ALL, OnUpdateString, cookie_path, php_ps_globals, ps_globals)
- STD_PHP_INI_ENTRY("session.cookie_domain", "", PHP_INI_ALL, OnUpdateString, cookie_domain, php_ps_globals, ps_globals)
- STD_PHP_INI_BOOLEAN("session.cookie_secure", "", PHP_INI_ALL, OnUpdateBool, cookie_secure, php_ps_globals, ps_globals)
- STD_PHP_INI_BOOLEAN("session.use_cookies", "1", PHP_INI_ALL, OnUpdateBool, use_cookies, php_ps_globals, ps_globals)
- STD_PHP_INI_ENTRY("session.referer_check", "", PHP_INI_ALL, OnUpdateString, extern_referer_chk, php_ps_globals, ps_globals)
- STD_PHP_INI_ENTRY("session.entropy_file", "", PHP_INI_ALL, OnUpdateString, entropy_file, php_ps_globals, ps_globals)
- STD_PHP_INI_ENTRY("session.entropy_length", "0", PHP_INI_ALL, OnUpdateInt, entropy_length, php_ps_globals, ps_globals)
- STD_PHP_INI_ENTRY("session.cache_limiter", "nocache", PHP_INI_ALL, OnUpdateString, cache_limiter, php_ps_globals, ps_globals)
- STD_PHP_INI_ENTRY("session.cache_expire", "180", PHP_INI_ALL, OnUpdateInt, cache_expire, php_ps_globals, ps_globals)
- /* Commented out until future discussion */
- /* PHP_INI_ENTRY("session.encode_sources", "globals,track", PHP_INI_ALL, NULL) */
-PHP_INI_END()
-/* }}} */
-
-PS_SERIALIZER_FUNCS(php);
-PS_SERIALIZER_FUNCS(php_binary);
-
-#define MAX_SERIALIZERS 10
-
-static ps_serializer ps_serializers[MAX_SERIALIZERS + 1] = {
- PS_SERIALIZER_ENTRY(php),
- PS_SERIALIZER_ENTRY(php_binary)
-};
-
-#define MAX_MODULES 10
-
-static ps_module *ps_modules[MAX_MODULES + 1] = {
- ps_files_ptr,
- ps_user_ptr
-};
-
-int php_session_register_serializer(const char *name,
- int (*encode)(PS_SERIALIZER_ENCODE_ARGS),
- int (*decode)(PS_SERIALIZER_DECODE_ARGS))
-{
- int ret = -1;
- int i;
-
- for (i = 0; i < MAX_SERIALIZERS; i++) {
- if (ps_serializers[i].name == NULL) {
- ps_serializers[i].name = name;
- ps_serializers[i].encode = encode;
- ps_serializers[i].decode = decode;
- ps_serializers[i + 1].name = NULL;
- ret = 0;
- break;
- }
- }
-
- return ret;
-}
-
-int php_session_register_module(ps_module *ptr)
-{
- int ret = -1;
- int i;
-
- for (i = 0; i < MAX_MODULES; i++) {
- if (!ps_modules[i]) {
- ps_modules[i] = ptr;
- ret = 0;
- break;
- }
- }
-
- return ret;
-}
-
-PHP_MINIT_FUNCTION(session);
-PHP_RINIT_FUNCTION(session);
-PHP_MSHUTDOWN_FUNCTION(session);
-PHP_RSHUTDOWN_FUNCTION(session);
-PHP_MINFO_FUNCTION(session);
-
-static void php_rinit_session_globals(PSLS_D);
-static void php_rshutdown_session_globals(PSLS_D);
-static zend_bool php_session_destroy(PSLS_D);
-
-zend_module_entry session_module_entry = {
- "session",
- session_functions,
- PHP_MINIT(session), PHP_MSHUTDOWN(session),
- PHP_RINIT(session), PHP_RSHUTDOWN(session),
- PHP_MINFO(session),
- STANDARD_MODULE_PROPERTIES
-};
-
-#ifdef COMPILE_DL_SESSION
-ZEND_GET_MODULE(session)
-#endif
-
-typedef struct {
- char *name;
- void (*func)(PSLS_D);
-} php_session_cache_limiter_t;
-
-#define CACHE_LIMITER_FUNC(name) static void _php_cache_limiter_##name(PSLS_D)
-#define CACHE_LIMITER(name) { #name, _php_cache_limiter_##name },
-
-#define ADD_COOKIE(a) sapi_add_header(a, strlen(a), 1);
-
-#define STR_CAT(P,S,I) {\
- pval *__p = (P);\
- size_t __l = (I);\
- ulong __i = Z_STRLEN_P(__p);\
- Z_STRLEN_P(__p) += __l;\
- Z_STRVAL_P(__p) = (char *)erealloc(Z_STRVAL_P(__p), Z_STRLEN_P(__p) + 1);\
- memcpy(Z_STRVAL_P(__p) + __i, (S), __l); \
- Z_STRVAL_P(__p)[Z_STRLEN_P(__p)] = '\0'; \
-}
-
-#define MAX_STR 512
-
-void php_set_session_var(char *name, size_t namelen, zval *state_val,HashTable *var_hash PSLS_DC)
-{
- PLS_FETCH();
- ELS_FETCH();
-
- if (PG(register_globals)) {
- zval **old_symbol;
- if (zend_hash_find(&EG(symbol_table),name,namelen+1,(void *)&old_symbol) == SUCCESS) {
- /*
- There where old one, we need to replace it accurately.
- hash_update in zend_set_hash_symbol is not good, because
- it will leave referenced variables (such as local instances
- of a global variable) dangling.
-
- BTW: if you use register_globals references between
- session-vars won't work because of this very reason!
- */
-
-
- REPLACE_ZVAL_VALUE(old_symbol,state_val,1);
-
- /* the following line will muck with the reference-table used for
- * unserialisation
- */
-
- PHP_VAR_UNSERIALIZE_ZVAL_CHANGED(var_hash,state_val,*old_symbol);
-
- zend_set_hash_symbol(*old_symbol, name, namelen, 1, 1, Z_ARRVAL_P(PS(http_session_vars)));
- } else {
- zend_set_hash_symbol(state_val, name, namelen, 1, 2, Z_ARRVAL_P(PS(http_session_vars)), &EG(symbol_table));
- }
- } else {
- zend_set_hash_symbol(state_val, name, namelen, 0, 1, Z_ARRVAL_P(PS(http_session_vars)));
- }
-}
-
-int php_get_session_var(char *name, size_t namelen, zval ***state_var PLS_DC PSLS_DC ELS_DC)
-{
- HashTable *ht = &EG(symbol_table);
-
- if (!PG(register_globals))
- ht = PS(http_session_vars) ? Z_ARRVAL_P(PS(http_session_vars)) : NULL;
-
- if (!ht) return HASH_KEY_NON_EXISTANT;
-
- return zend_hash_find(ht, name, namelen + 1, (void **)state_var);
-}
-
-#define PS_BIN_NR_OF_BITS 8
-#define PS_BIN_UNDEF (1<<(PS_BIN_NR_OF_BITS-1))
-#define PS_BIN_MAX (PS_BIN_UNDEF-1)
-
-PS_SERIALIZER_ENCODE_FUNC(php_binary)
-{
- zval *buf;
- unsigned char strbuf[MAX_STR + 1];
- php_serialize_data_t var_hash;
- PS_ENCODE_VARS;
-
- buf = ecalloc(sizeof(*buf), 1);
- Z_TYPE_P(buf) = IS_STRING;
- buf->refcount++;
-
- PHP_VAR_SERIALIZE_INIT(var_hash);
-
- PS_ENCODE_LOOP(
- if (key_length > PS_BIN_MAX) continue;
- strbuf[0] = (unsigned char) key_length;
- memcpy(strbuf + 1, key, key_length);
-
- STR_CAT(buf, strbuf, key_length + 1);
- php_var_serialize(buf, struc, &var_hash);
- } else {
- if (key_length > PS_BIN_MAX) continue;
- strbuf[0] = (unsigned char) (key_length & PS_BIN_UNDEF);
- memcpy(strbuf + 1, key, key_length);
-
- STR_CAT(buf, strbuf, key_length + 1);
- );
-
- if (newlen) *newlen = Z_STRLEN_P(buf);
- *newstr = Z_STRVAL_P(buf);
- efree(buf);
- PHP_VAR_SERIALIZE_DESTROY(var_hash);
-
- return SUCCESS;
-}
-
-PS_SERIALIZER_DECODE_FUNC(php_binary)
-{
- const char *p;
- char *name;
- const char *endptr = val + vallen;
- zval *current;
- int namelen;
- int has_value;
- php_serialize_data_t var_hash;
-
- PHP_VAR_UNSERIALIZE_INIT(var_hash);
-
- for (p = val; p < endptr; ) {
- namelen = *p & (~PS_BIN_UNDEF);
- has_value = *p & PS_BIN_UNDEF ? 0 : 1;
-
- name = estrndup(p + 1, namelen);
-
- p += namelen + 1;
-
- if (has_value) {
- MAKE_STD_ZVAL(current);
- if (php_var_unserialize(&current, &p, endptr, &var_hash)) {
- php_set_session_var(name, namelen, current, &var_hash PSLS_CC);
- }
- zval_ptr_dtor(&current);
- }
- PS_ADD_VARL(name, namelen);
- efree(name);
- }
-
- PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
-
- return SUCCESS;
-}
-
-#define PS_DELIMITER '|'
-#define PS_UNDEF_MARKER '!'
-
-PS_SERIALIZER_ENCODE_FUNC(php)
-{
- zval *buf;
- char strbuf[MAX_STR + 1];
- php_serialize_data_t var_hash;
- PS_ENCODE_VARS;
-
- buf = ecalloc(sizeof(*buf), 1);
- Z_TYPE_P(buf) = IS_STRING;
- buf->refcount++;
-
- PHP_VAR_SERIALIZE_INIT(var_hash);
-
- PS_ENCODE_LOOP(
- if (key_length + 1 > MAX_STR) continue;
- memcpy(strbuf, key, key_length);
- strbuf[key_length] = PS_DELIMITER;
- STR_CAT(buf, strbuf, key_length + 1);
-
- php_var_serialize(buf, struc, &var_hash);
- } else {
- if (key_length + 2 > MAX_STR) continue;
- strbuf[0] = PS_UNDEF_MARKER;
- memcpy(strbuf + 1, key, key_length);
- strbuf[key_length + 1] = PS_DELIMITER;
-
- STR_CAT(buf, strbuf, key_length + 2);
- );
-
- if (newlen) *newlen = Z_STRLEN_P(buf);
- *newstr = Z_STRVAL_P(buf);
- efree(buf);
-
- PHP_VAR_SERIALIZE_DESTROY(var_hash);
- return SUCCESS;
-}
-
-PS_SERIALIZER_DECODE_FUNC(php)
-{
- const char *p, *q;
- char *name;
- const char *endptr = val + vallen;
- zval *current;
- int namelen;
- int has_value;
- php_serialize_data_t var_hash;
-
- PHP_VAR_UNSERIALIZE_INIT(var_hash);
-
- for (p = q = val; (p < endptr) && (q = memchr(p, PS_DELIMITER, endptr - p)); p = q) {
- if (p[0] == PS_UNDEF_MARKER) {
- p++;
- has_value = 0;
- } else {
- has_value = 1;
- }
-
- namelen = q - p;
- name = estrndup(p, namelen);
- q++;
-
- if (has_value) {
- MAKE_STD_ZVAL(current);
- if (php_var_unserialize(&current, &q, endptr, &var_hash)) {
- php_set_session_var(name, namelen, current, &var_hash PSLS_CC);
- }
- zval_ptr_dtor(&current);
- }
- PS_ADD_VARL(name, namelen);
- efree(name);
- }
-
- PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
-
- return SUCCESS;
-}
-
-static void php_session_track_init(void)
-{
- zval **old_vars = NULL;
- PSLS_FETCH();
- ELS_FETCH();
-
- if (zend_hash_find(&EG(symbol_table), "HTTP_SESSION_VARS", sizeof("HTTP_SESSION_VARS"), (void **)&old_vars) == SUCCESS && Z_TYPE_PP(old_vars) == IS_ARRAY) {
- PS(http_session_vars) = *old_vars;
- zend_hash_clean(Z_ARRVAL_P(PS(http_session_vars)));
- } else {
- if(old_vars) {
- zend_hash_del(&EG(symbol_table), "HTTP_SESSION_VARS", sizeof("HTTP_SESSION_VARS"));
- }
- MAKE_STD_ZVAL(PS(http_session_vars));
- array_init(PS(http_session_vars));
- ZEND_SET_GLOBAL_VAR_WITH_LENGTH("HTTP_SESSION_VARS", sizeof("HTTP_SESSION_VARS"), PS(http_session_vars), 1, 0);
- }
-}
-
-static char *php_session_encode(int *newlen PSLS_DC)
-{
- char *ret = NULL;
-
- if (PS(serializer)->encode(&ret, newlen PSLS_CC) == FAILURE)
- ret = NULL;
-
- return ret;
-}
-
-static void php_session_decode(const char *val, int vallen PSLS_DC)
-{
- php_session_track_init();
- if (PS(serializer)->decode(val, vallen PSLS_CC) == FAILURE) {
- php_session_destroy(PSLS_C);
- php_error(E_WARNING, "Failed to decode session object. Session has been destroyed.");
- }
-}
-
-static char hexconvtab[] = "0123456789abcdef";
-
-static char *_php_create_id(int *newlen PSLS_DC)
-{
- PHP_MD5_CTX context;
- unsigned char digest[16];
- char buf[256];
- struct timeval tv;
- int i;
- int j = 0;
- unsigned char c;
-
- gettimeofday(&tv, NULL);
- PHP_MD5Init(&context);
-
- sprintf(buf, "%ld%ld%0.8f", tv.tv_sec, tv.tv_usec, php_combined_lcg() * 10);
- PHP_MD5Update(&context, buf, strlen(buf));
-
- if (PS(entropy_length) > 0) {
- int fd;
-
- fd = VCWD_OPEN((PS(entropy_file), O_RDONLY));
- if (fd >= 0) {
- char buf[2048];
- int n;
- int to_read = PS(entropy_length);
-
- while (to_read > 0) {
- n = read(fd, buf, MIN(to_read, sizeof(buf)));
- if (n <= 0) break;
- PHP_MD5Update(&context, buf, n);
- to_read -= n;
- }
- close(fd);
- }
- }
-
- PHP_MD5Final(digest, &context);
-
- for (i = 0; i < 16; i++) {
- c = digest[i];
- buf[j++] = hexconvtab[c >> 4];
- buf[j++] = hexconvtab[c & 15];
- }
- buf[j] = '\0';
-
- if (newlen)
- *newlen = j;
- return estrdup(buf);
-}
-
-static void php_session_initialize(PSLS_D)
-{
- char *val;
- int vallen;
-
- if (PS(mod)->open(&PS(mod_data), PS(save_path), PS(session_name)) == FAILURE) {
- php_error(E_ERROR, "Failed to initialize session module");
- return;
- }
- if (PS(mod)->read(&PS(mod_data), PS(id), &val, &vallen) == SUCCESS) {
- php_session_decode(val, vallen PSLS_CC);
- efree(val);
- }
-}
-
-static void php_session_save_current_state(PSLS_D)
-{
- char *val;
- int vallen;
- int ret = FAILURE;
- char *variable;
- ulong variable_len;
- ulong num_key;
- HashPosition pos;
- PLS_FETCH();
-
- if (!PG(register_globals)) {
- if (!PS(http_session_vars)) {
- return;
- }
-
- for (zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(PS(http_session_vars)), &pos);
- zend_hash_get_current_key_ex(Z_ARRVAL_P(PS(http_session_vars)), &variable, &variable_len, &num_key, 0, &pos) == HASH_KEY_IS_STRING;
- zend_hash_move_forward_ex(Z_ARRVAL_P(PS(http_session_vars)),&pos)) {
- PS_ADD_VARL(variable,variable_len-1);
- }
- }
-
- if (PS(mod_data)) {
- val = php_session_encode(&vallen PSLS_CC);
- if (val) {
- ret = PS(mod)->write(&PS(mod_data), PS(id), val, vallen);
- efree(val);
- } else {
- ret = PS(mod)->write(&PS(mod_data), PS(id), "", 0);
- }
- }
-
- if (ret == FAILURE)
- php_error(E_WARNING, "Failed to write session data (%s). Please "
- "verify that the current setting of session.save_path "
- "is correct (%s)",
- PS(mod)->name,
- PS(save_path));
-
-
- if (PS(mod_data))
- PS(mod)->close(&PS(mod_data));
-}
-
-static char *month_names[] = {
- "Jan", "Feb", "Mar", "Apr", "May", "Jun",
- "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
-};
-
-static char *week_days[] = {
- "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"
-};
-
-static void strcpy_gmt(char *ubuf, time_t *when)
-{
- char buf[MAX_STR];
- struct tm tm;
- int n;
-
- php_gmtime_r(when, &tm);
-
- /* we know all components, thus it is safe to use sprintf */
- n = sprintf(buf, "%s, %d %s %d %02d:%02d:%02d GMT", week_days[tm.tm_wday], tm.tm_mday, month_names[tm.tm_mon], tm.tm_year + 1900, tm.tm_hour, tm.tm_min, tm.tm_sec);
- memcpy(ubuf, buf, n);
- ubuf[n] = '\0';
-}
-
-static void last_modified(void)
-{
- const char *path;
- struct stat sb;
- char buf[MAX_STR + 1];
- SLS_FETCH();
-
- path = SG(request_info).path_translated;
- if (path) {
- if (VCWD_STAT(path, &sb) == -1) {
- return;
- }
-
-#define LAST_MODIFIED "Last-Modified: "
- memcpy(buf, LAST_MODIFIED, sizeof(LAST_MODIFIED) - 1);
- strcpy_gmt(buf + sizeof(LAST_MODIFIED) - 1, &sb.st_mtime);
- ADD_COOKIE(buf);
- }
-}
-
-CACHE_LIMITER_FUNC(public)
-{
- char buf[MAX_STR + 1];
- time_t now;
-
- time(&now);
- now += PS(cache_expire) * 60;
-#define EXPIRES "Expires: "
- memcpy(buf, EXPIRES, sizeof(EXPIRES) - 1);
- strcpy_gmt(buf + sizeof(EXPIRES) - 1, &now);
- ADD_COOKIE(buf);
-
- sprintf(buf, "Cache-Control: public, max-age=%ld", PS(cache_expire) * 60);
- ADD_COOKIE(buf);
-
- last_modified();
-}
-
-CACHE_LIMITER_FUNC(private)
-{
- char buf[MAX_STR + 1];
-
- ADD_COOKIE("Expires: Thu, 19 Nov 1981 08:52:00 GMT");
- sprintf(buf, "Cache-Control: private, max-age=%ld, pre-check=%ld", PS(cache_expire) * 60, PS(cache_expire) * 60);
- ADD_COOKIE(buf);
-
- last_modified();
-}
-
-CACHE_LIMITER_FUNC(nocache)
-{
- ADD_COOKIE("Expires: Thu, 19 Nov 1981 08:52:00 GMT");
- /* For HTTP/1.1 conforming clients and the rest (MSIE 5) */
- ADD_COOKIE("Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0");
- /* For HTTP/1.0 conforming clients */
- ADD_COOKIE("Pragma: no-cache");
-}
-
-static php_session_cache_limiter_t php_session_cache_limiters[] = {
- CACHE_LIMITER(public)
- CACHE_LIMITER(private)
- CACHE_LIMITER(nocache)
- {0}
-};
-
-static int php_session_cache_limiter(PSLS_D)
-{
- php_session_cache_limiter_t *lim;
- SLS_FETCH();
-
- if (SG(headers_sent)) {
- char *output_start_filename = php_get_output_start_filename();
- int output_start_lineno = php_get_output_start_lineno();
-
- if (output_start_filename) {
- php_error(E_WARNING, "Cannot send session cache limiter - headers already sent (output started at %s:%d)",
- output_start_filename, output_start_lineno);
- } else {
- php_error(E_WARNING, "Cannot send session cache limiter - headers already sent");
- }
- return (-2);
- }
-
- for (lim = php_session_cache_limiters; lim->name; lim++) {
- if (!strcasecmp(lim->name, PS(cache_limiter))) {
- lim->func(PSLS_C);
- return (0);
- }
- }
-
- return (-1);
-}
-
-#define COOKIE_SET_COOKIE "Set-Cookie: "
-#define COOKIE_EXPIRES "; expires="
-#define COOKIE_PATH "; path="
-#define COOKIE_DOMAIN "; domain="
-#define COOKIE_SECURE "; secure"
-
-static void php_session_send_cookie(PSLS_D)
-{
- smart_str ncookie = {0};
- char *date_fmt = NULL;
- SLS_FETCH();
-
- if (SG(headers_sent)) {
- char *output_start_filename = php_get_output_start_filename();
- int output_start_lineno = php_get_output_start_lineno();
-
- if (output_start_filename) {
- php_error(E_WARNING, "Cannot send session cookie - headers already sent by (output started at %s:%d)",
- output_start_filename, output_start_lineno);
- } else {
- php_error(E_WARNING, "Cannot send session cookie - headers already sent");
- }
- return;
- }
-
- smart_str_appends(&ncookie, COOKIE_SET_COOKIE);
- smart_str_appends(&ncookie, PS(session_name));
- smart_str_appendc(&ncookie, '=');
- smart_str_appends(&ncookie, PS(id));
-
- if (PS(cookie_lifetime) > 0) {
- date_fmt = php_std_date(time(NULL) + PS(cookie_lifetime));
-
- smart_str_appends(&ncookie, COOKIE_EXPIRES);
- smart_str_appends(&ncookie, date_fmt);
- efree(date_fmt);
- }
-
- if (PS(cookie_path)[0]) {
- smart_str_appends(&ncookie, COOKIE_PATH);
- smart_str_appends(&ncookie, PS(cookie_path));
- }
-
- if (PS(cookie_domain)[0]) {
- smart_str_appends(&ncookie, COOKIE_DOMAIN);
- smart_str_appends(&ncookie, PS(cookie_domain));
- }
-
- if (PS(cookie_secure)) {
- smart_str_appends(&ncookie, COOKIE_SECURE);
- }
-
- smart_str_0(&ncookie);
-
- sapi_add_header(ncookie.c, ncookie.len, 0);
-}
-
-static ps_module *_php_find_ps_module(char *name PSLS_DC)
-{
- ps_module *ret = NULL;
- ps_module **mod;
- int i;
-
- for (i = 0, mod = ps_modules; i < MAX_MODULES; i++, mod++)
- if (*mod && !strcasecmp(name, (*mod)->name)) {
- ret = *mod;
- break;
- }
-
- return ret;
-}
-
-static const ps_serializer *_php_find_ps_serializer(char *name PSLS_DC)
-{
- const ps_serializer *ret = NULL;
- const ps_serializer *mod;
-
- for (mod = ps_serializers; mod->name; mod++)
- if (!strcasecmp(name, mod->name)) {
- ret = mod;
- break;
- }
-
- return ret;
-}
-
-#define PPID2SID \
- convert_to_string((*ppid)); \
- PS(id) = estrndup(Z_STRVAL_PP(ppid), Z_STRLEN_PP(ppid))
-
-static void php_session_start(PSLS_D)
-{
- pval **ppid;
- pval **data;
- char *p;
- int send_cookie = 1;
- int define_sid = 1;
- int module_number = PS(module_number);
- int nrand;
- int lensess;
- ELS_FETCH();
-
- if (PS(nr_open_sessions) != 0)
- return;
-
- lensess = strlen(PS(session_name));
-
-
- /*
- * Cookies are preferred, because initially
- * cookie and get variables will be available.
- */
-
- if (!PS(id)) {
- if (zend_hash_find(&EG(symbol_table), "HTTP_COOKIE_VARS",
- sizeof("HTTP_COOKIE_VARS"), (void **) &data) == SUCCESS &&
- Z_TYPE_PP(data) == IS_ARRAY &&
- zend_hash_find(Z_ARRVAL_PP(data), PS(session_name),
- lensess + 1, (void **) &ppid) == SUCCESS) {
- PPID2SID;
- define_sid = 0;
- send_cookie = 0;
- }
-
- if (!PS(id) &&
- zend_hash_find(&EG(symbol_table), "HTTP_GET_VARS",
- sizeof("HTTP_GET_VARS"), (void **) &data) == SUCCESS &&
- Z_TYPE_PP(data) == IS_ARRAY &&
- zend_hash_find(Z_ARRVAL_PP(data), PS(session_name),
- lensess + 1, (void **) &ppid) == SUCCESS) {
- PPID2SID;
- }
-
- if (!PS(id) &&
- zend_hash_find(&EG(symbol_table), "HTTP_POST_VARS",
- sizeof("HTTP_POST_VARS"), (void **) &data) == SUCCESS &&
- Z_TYPE_PP(data) == IS_ARRAY &&
- zend_hash_find(Z_ARRVAL_PP(data), PS(session_name),
- lensess + 1, (void **) &ppid) == SUCCESS) {
- PPID2SID;
- }
- }
-
- /* check the REQUEST_URI symbol for a string of the form
- '<session-name>=<session-id>' to allow URLs of the form
- http://yoursite/<session-name>=<session-id>/script.php */
-
- if (!PS(id) &&
- zend_hash_find(&EG(symbol_table), "REQUEST_URI",
- sizeof("REQUEST_URI"), (void **) &data) == SUCCESS &&
- Z_TYPE_PP(data) == IS_STRING &&
- (p = strstr(Z_STRVAL_PP(data), PS(session_name))) &&
- p[lensess] == '=') {
- char *q;
-
- p += lensess + 1;
- if ((q = strpbrk(p, "/?\\")))
- PS(id) = estrndup(p, q - p);
- }
-
- /* check whether the current request was referred to by
- an external site which invalidates the previously found id */
-
- if (PS(id) &&
- PS(extern_referer_chk)[0] != '\0' &&
- zend_hash_find(&EG(symbol_table), "HTTP_REFERER",
- sizeof("HTTP_REFERER"), (void **) &data) == SUCCESS &&
- Z_TYPE_PP(data) == IS_STRING &&
- Z_STRLEN_PP(data) != 0 &&
- strstr(Z_STRVAL_PP(data), PS(extern_referer_chk)) == NULL) {
- efree(PS(id));
- PS(id) = NULL;
- send_cookie = 1;
- define_sid = 1;
- }
-
- if (!PS(id))
- PS(id) = _php_create_id(NULL PSLS_CC);
-
- if (!PS(use_cookies) && send_cookie) {
- define_sid = 1;
- send_cookie = 0;
- }
-
- if (send_cookie)
- php_session_send_cookie(PSLS_C);
-
- if (define_sid) {
- smart_str var = {0};
-
- smart_str_appends(&var, PS(session_name));
- smart_str_appendc(&var, '=');
- smart_str_appends(&var, PS(id));
- smart_str_0(&var);
- REGISTER_STRING_CONSTANT("SID", var.c, 0);
- } else
- REGISTER_STRING_CONSTANT("SID", empty_string, 0);
- PS(define_sid) = define_sid;
-
- PS(nr_open_sessions)++;
-
- php_session_cache_limiter(PSLS_C);
- php_session_initialize(PSLS_C);
-
- if (PS(mod_data) && PS(gc_probability) > 0) {
- int nrdels = -1;
-
- srand(time(NULL));
- nrand = (int) (100.0*rand()/RAND_MAX);
- if (nrand < PS(gc_probability)) {
- PS(mod)->gc(&PS(mod_data), PS(gc_maxlifetime), &nrdels);
-#if 0
- if (nrdels != -1)
- php_error(E_NOTICE, "purged %d expired session objects\n", nrdels);
-#endif
- }
- }
-}
-
-static zend_bool php_session_destroy(PSLS_D)
-{
- zend_bool retval = SUCCESS;
-
- if (PS(nr_open_sessions) == 0) {
- php_error(E_WARNING, "Trying to destroy uninitialized session");
- return FAILURE;
- }
-
- if (PS(mod)->destroy(&PS(mod_data), PS(id)) == FAILURE) {
- retval = FAILURE;
- php_error(E_WARNING, "Session object destruction failed");
- }
-
- php_rshutdown_session_globals(PSLS_C);
- php_rinit_session_globals(PSLS_C);
-
- return retval;
-}
-
-
-/* {{{ proto void session_set_cookie_params(int lifetime [, string path [, string domain [, bool secure]]])
- Set session cookie parameters */
-PHP_FUNCTION(session_set_cookie_params)
-{
- zval **lifetime, **path, **domain, **secure;
- PSLS_FETCH();
-
- if (!PS(use_cookies))
- return;
-
- if (ZEND_NUM_ARGS() < 1 || ZEND_NUM_ARGS() > 4 ||
- zend_get_parameters_ex(ZEND_NUM_ARGS(), &lifetime, &path, &domain, &secure) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_long_ex(lifetime);
- PS(cookie_lifetime) = Z_LVAL_PP(lifetime);
-
- if (ZEND_NUM_ARGS() > 1) {
- convert_to_string_ex(path);
- zend_alter_ini_entry("session.cookie_path", sizeof("session.cookie_path"), Z_STRVAL_PP(path), Z_STRLEN_PP(path), PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
-
- if (ZEND_NUM_ARGS() > 2) {
- convert_to_string_ex(domain);
- zend_alter_ini_entry("session.cookie_domain", sizeof("session.cookie_domain"), Z_STRVAL_PP(domain), Z_STRLEN_PP(domain), PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
- if (ZEND_NUM_ARGS() > 3) {
- convert_to_long_ex(secure);
- zend_alter_ini_entry("session.cookie_secure", sizeof("session.cookie_secure"), Z_BVAL_PP(secure)?"1":"0", 1, PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
- }
- }
- }
-}
-/* }}} */
-
-/* {{{ proto array session_get_cookie_params(void)
- Return the session cookie parameters */
-PHP_FUNCTION(session_get_cookie_params)
-{
- PSLS_FETCH();
-
- if (ZEND_NUM_ARGS() != 0) {
- WRONG_PARAM_COUNT;
- }
-
- if (array_init(return_value) == FAILURE) {
- php_error(E_ERROR, "Cannot initialize return value from session_get_cookie_parameters");
- RETURN_FALSE;
- }
-
- add_assoc_long(return_value, "lifetime", PS(cookie_lifetime));
- add_assoc_string(return_value, "path", PS(cookie_path), 1);
- add_assoc_string(return_value, "domain", PS(cookie_domain), 1);
- add_assoc_bool(return_value, "secure", PS(cookie_secure));
-}
-/* }}} */
-
-/* {{{ proto string session_name([string newname])
- Return the current session name. If newname is given, the session name is replaced with newname */
-PHP_FUNCTION(session_name)
-{
- pval **p_name;
- int ac = ZEND_NUM_ARGS();
- char *old;
- PSLS_FETCH();
-
- old = estrdup(PS(session_name));
-
- if (ac < 0 || ac > 1 || zend_get_parameters_ex(ac, &p_name) == FAILURE)
- WRONG_PARAM_COUNT;
-
- if (ac == 1) {
- convert_to_string_ex(p_name);
- zend_alter_ini_entry("session.name", sizeof("session.name"), Z_STRVAL_PP(p_name), Z_STRLEN_PP(p_name), PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
- }
-
- RETVAL_STRING(old, 0);
-}
-/* }}} */
-
-/* {{{ proto string session_module_name([string newname])
- Return the current module name used for accessing session data. If newname is given, the module name is replaced with newname */
-PHP_FUNCTION(session_module_name)
-{
- pval **p_name;
- int ac = ZEND_NUM_ARGS();
- char *old;
- PSLS_FETCH();
-
- old = estrdup(PS(mod)->name);
-
- if (ac < 0 || ac > 1 || zend_get_parameters_ex(ac, &p_name) == FAILURE)
- WRONG_PARAM_COUNT;
-
- if (ac == 1) {
- ps_module *tempmod;
-
- convert_to_string_ex(p_name);
- tempmod = _php_find_ps_module(Z_STRVAL_PP(p_name) PSLS_CC);
- if (tempmod) {
- if (PS(mod_data))
- PS(mod)->close(&PS(mod_data));
- PS(mod) = tempmod;
- PS(mod_data) = NULL;
- } else {
- efree(old);
- php_error(E_ERROR, "Cannot find named PHP session module (%s)",
- Z_STRVAL_PP(p_name));
- RETURN_FALSE;
- }
- }
-
- RETVAL_STRING(old, 0);
-}
-/* }}} */
-
-/* {{{ proto void session_set_save_handler(string open, string close, string read, string write, string destroy, string gc)
- Sets user-level functions */
-PHP_FUNCTION(session_set_save_handler)
-{
- zval **args[6];
- int i;
- ps_user *mdata;
- PSLS_FETCH();
-
- if (ZEND_NUM_ARGS() != 6 || zend_get_parameters_array_ex(6, args) == FAILURE)
- WRONG_PARAM_COUNT;
-
- if (PS(nr_open_sessions) > 0)
- RETURN_FALSE;
-
- zend_alter_ini_entry("session.save_handler", sizeof("session.save_handler"), "user", sizeof("user")-1, PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
-
- mdata = emalloc(sizeof(*mdata));
-
- for (i = 0; i < 6; i++) {
- ZVAL_ADDREF(*args[i]);
- mdata->names[i] = *args[i];
- }
-
- PS(mod_data) = (void *) mdata;
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto string session_save_path([string newname])
- Return the current save path passed to module_name. If newname is given, the save path is replaced with newname */
-PHP_FUNCTION(session_save_path)
-{
- pval **p_name;
- int ac = ZEND_NUM_ARGS();
- char *old;
- PSLS_FETCH();
-
- old = estrdup(PS(save_path));
-
- if (ac < 0 || ac > 1 || zend_get_parameters_ex(ac, &p_name) == FAILURE)
- WRONG_PARAM_COUNT;
-
- if (ac == 1) {
- convert_to_string_ex(p_name);
- zend_alter_ini_entry("session.save_path", sizeof("session.save_path"), Z_STRVAL_PP(p_name), Z_STRLEN_PP(p_name), PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
- }
-
- RETVAL_STRING(old, 0);
-}
-/* }}} */
-
-/* {{{ proto string session_id([string newid])
- Return the current session id. If newid is given, the session id is replaced with newid */
-PHP_FUNCTION(session_id)
-{
- pval **p_name;
- int ac = ZEND_NUM_ARGS();
- char *old = empty_string;
- PSLS_FETCH();
-
- if (PS(id))
- old = estrdup(PS(id));
-
- if (ac < 0 || ac > 1 || zend_get_parameters_ex(ac, &p_name) == FAILURE)
- WRONG_PARAM_COUNT;
-
- if (ac == 1) {
- convert_to_string_ex(p_name);
- if (PS(id)) efree(PS(id));
- PS(id) = estrndup(Z_STRVAL_PP(p_name), Z_STRLEN_PP(p_name));
- }
-
- RETVAL_STRING(old, 0);
-}
-/* }}} */
-
-/* {{{ proto string session_cache_limiter([string new_cache_limiter])
- Return the current cache limiter. If new_cache_limited is given, the current cache_limiter is replaced with new_cache_limiter */
-PHP_FUNCTION(session_cache_limiter)
-{
- pval **p_cache_limiter;
- int ac = ZEND_NUM_ARGS();
- char *old;
- PSLS_FETCH();
-
- old = estrdup(PS(cache_limiter));
-
- if (ac < 0 || ac > 1 || zend_get_parameters_ex(ac, &p_cache_limiter) == FAILURE)
- WRONG_PARAM_COUNT;
-
- if (ac == 1) {
- convert_to_string_ex(p_cache_limiter);
- zend_alter_ini_entry("session.cache_limiter", sizeof("session.cache_limiter"), Z_STRVAL_PP(p_cache_limiter), Z_STRLEN_PP(p_cache_limiter), PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
- }
-
- RETVAL_STRING(old, 0);
-}
-/* }}} */
-
-/* {{{ static void php_register_var(zval** entry PSLS_DC PLS_DC) */
-static void php_register_var(zval** entry PSLS_DC PLS_DC)
-{
- zval **value;
-
- if (Z_TYPE_PP(entry) == IS_ARRAY) {
- zend_hash_internal_pointer_reset(Z_ARRVAL_PP(entry));
-
- while (zend_hash_get_current_data(Z_ARRVAL_PP(entry), (void**)&value) == SUCCESS) {
- php_register_var(value PSLS_CC PLS_CC);
- zend_hash_move_forward(Z_ARRVAL_PP(entry));
- }
- } else {
- convert_to_string_ex(entry);
-
- if (strcmp(Z_STRVAL_PP(entry), "HTTP_SESSION_VARS") != 0)
- PS_ADD_VARL(Z_STRVAL_PP(entry), Z_STRLEN_PP(entry));
- }
-}
-/* }}} */
-
-/* {{{ proto bool session_register(mixed var_names [, mixed ...])
- Adds varname(s) to the list of variables which are freezed at the session end */
-PHP_FUNCTION(session_register)
-{
- zval ***args;
- int argc = ZEND_NUM_ARGS();
- int i;
- PSLS_FETCH();
- PLS_FETCH();
-
- if (argc <= 0)
- RETURN_FALSE
- else
- args = (zval ***)emalloc(argc * sizeof(zval **));
-
- if (zend_get_parameters_array_ex(argc, args) == FAILURE) {
- efree(args);
- WRONG_PARAM_COUNT;
- }
-
- if (PS(nr_open_sessions) == 0)
- php_session_start(PSLS_C);
-
- for (i = 0; i < argc; i++) {
- if (Z_TYPE_PP(args[i]) == IS_ARRAY)
- SEPARATE_ZVAL(args[i]);
- php_register_var(args[i] PSLS_CC PLS_CC);
- }
-
- efree(args);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool session_unregister(string varname)
- Removes varname from the list of variables which are freezed at the session end */
-PHP_FUNCTION(session_unregister)
-{
- pval **p_name;
- int ac = ZEND_NUM_ARGS();
- PSLS_FETCH();
-
- if (ac != 1 || zend_get_parameters_ex(ac, &p_name) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_string_ex(p_name);
-
- PS_DEL_VAR(Z_STRVAL_PP(p_name));
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool session_is_registered(string varname)
- Checks if a variable is registered in session */
-PHP_FUNCTION(session_is_registered)
-{
- pval **p_name;
- pval *p_var;
- int ac = ZEND_NUM_ARGS();
- PSLS_FETCH();
-
- if (ac != 1 || zend_get_parameters_ex(ac, &p_name) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_string_ex(p_name);
-
- if (zend_hash_find(&PS(vars), Z_STRVAL_PP(p_name),
- Z_STRLEN_PP(p_name)+1, (void **)&p_var) == SUCCESS)
- RETURN_TRUE
- else
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto string session_encode(void)
- Serializes the current setup and returns the serialized representation */
-PHP_FUNCTION(session_encode)
-{
- int len;
- char *enc;
- PSLS_FETCH();
-
- enc = php_session_encode(&len PSLS_CC);
- RETVAL_STRINGL(enc, len, 0);
-}
-/* }}} */
-
-/* {{{ proto bool session_decode(string data)
- Deserializes data and reinitializes the variables */
-PHP_FUNCTION(session_decode)
-{
- pval **str;
- PSLS_FETCH();
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &str) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_string_ex(str);
-
- php_session_decode(Z_STRVAL_PP(str), Z_STRLEN_PP(str) PSLS_CC);
-}
-/* }}} */
-
-/* {{{ proto bool session_start(void)
- Begin session - reinitializes freezed variables, registers browsers etc */
-PHP_FUNCTION(session_start)
-{
- PSLS_FETCH();
-
- php_session_start(PSLS_C);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool session_destroy(void)
- Destroy the current session and all data associated with it */
-PHP_FUNCTION(session_destroy)
-{
- PSLS_FETCH();
-
- if (php_session_destroy(PSLS_C) == SUCCESS) {
- RETURN_TRUE;
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-#ifdef TRANS_SID
-void session_adapt_uris(const char *src, size_t srclen, char **new, size_t *newlen)
-{
- PSLS_FETCH();
-
- if (PS(define_sid) && PS(nr_open_sessions) > 0)
- *new = url_adapt_ext_ex(src, srclen, PS(session_name), PS(id), newlen);
-}
-
-void session_adapt_url(const char *url, size_t urllen, char **new, size_t *newlen)
-{
- PSLS_FETCH();
-
- if (PS(define_sid) && PS(nr_open_sessions) > 0)
- *new = url_adapt_single_url(url, urllen, PS(session_name), PS(id), newlen);
-}
-#endif
-
-/* {{{ proto void session_unset(void)
- Unset all registered variables */
-PHP_FUNCTION(session_unset)
-{
- zval **tmp;
- char *variable;
- ulong num_key;
- PSLS_FETCH();
-
- if (PS(nr_open_sessions) == 0)
- RETURN_FALSE;
-
- for (zend_hash_internal_pointer_reset(&PS(vars));
- zend_hash_get_current_key(&PS(vars), &variable, &num_key, 0) == HASH_KEY_IS_STRING;
- zend_hash_move_forward(&PS(vars))) {
- if (zend_hash_find(&EG(symbol_table), variable, strlen(variable) + 1, (void **) &tmp)
- == SUCCESS)
- zend_hash_del(&EG(symbol_table), variable, strlen(variable) + 1);
- }
-
- /* Clean $HTTP_SESSION_VARS. */
- zend_hash_clean(Z_ARRVAL_P(PS(http_session_vars)));
-}
-/* }}} */
-
-static void php_rinit_session_globals(PSLS_D)
-{
- zend_hash_init(&PS(vars), 0, NULL, NULL, 0);
- PS(define_sid) = 0;
- PS(id) = NULL;
- PS(nr_open_sessions) = 0;
- PS(mod_data) = NULL;
-}
-
-static void php_rshutdown_session_globals(PSLS_D)
-{
- if (PS(mod_data))
- PS(mod)->close(&PS(mod_data));
- if (PS(id))
- efree(PS(id));
- zend_hash_destroy(&PS(vars));
-}
-
-
-PHP_RINIT_FUNCTION(session)
-{
- PSLS_FETCH();
-
- php_rinit_session_globals(PSLS_C);
-
- if (PS(mod) == NULL) {
- char *value;
-
- value = zend_ini_string("session.save_handler", sizeof("session.save_handler"), 0);
- if (value) {
- PS(mod) = _php_find_ps_module(value PSLS_CC);
- }
-
- if (!PS(mod)) {
- /* current status is unusable */
- PS(nr_open_sessions) = -1;
- return SUCCESS;
- }
- }
-
- if (PS(auto_start)) {
- php_session_start(PSLS_C);
- }
-
- return SUCCESS;
-}
-
-static void php_session_flush(PSLS_D)
-{
- if (PS(nr_open_sessions) > 0) {
- php_session_save_current_state(PSLS_C);
- PS(nr_open_sessions)--;
- }
-}
-
-PHP_FUNCTION(session_write_close)
-{
- PSLS_FETCH();
- php_session_flush(PSLS_C);
-}
-
-PHP_RSHUTDOWN_FUNCTION(session)
-{
- PSLS_FETCH();
-
- php_session_flush(PSLS_C);
- php_rshutdown_session_globals(PSLS_C);
- return SUCCESS;
-}
-
-
-
-PHP_MINIT_FUNCTION(session)
-{
-#ifdef ZTS
- php_ps_globals *ps_globals;
-
- ps_globals_id = ts_allocate_id(sizeof(php_ps_globals), NULL, NULL);
- ps_globals = ts_resource(ps_globals_id);
-#endif
-
- PS(module_number) = module_number;
- REGISTER_INI_ENTRIES();
- return SUCCESS;
-}
-
-PHP_MSHUTDOWN_FUNCTION(session)
-{
- UNREGISTER_INI_ENTRIES();
- return SUCCESS;
-}
-
-
-PHP_MINFO_FUNCTION(session)
-{
-
- php_info_print_table_start();
- php_info_print_table_row(2, "Session Support", "enabled" );
- php_info_print_table_end();
-
- DISPLAY_INI_ENTRIES();
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/session/setup.stub b/ext/session/setup.stub
deleted file mode 100644
index 33ca6e8664..0000000000
--- a/ext/session/setup.stub
+++ /dev/null
@@ -1,6 +0,0 @@
-# $Source$
-# $Id$
-
-define_option with-session 'session support?' yesnodir no \
-' Whether to build the session extension.'
-
diff --git a/ext/session/tests/001.phpt b/ext/session/tests/001.phpt
deleted file mode 100644
index aac17cb3d5..0000000000
--- a/ext/session/tests/001.phpt
+++ /dev/null
@@ -1,27 +0,0 @@
---TEST--
-Session Object Serialization
---FILE--
-<?
-
-class foo {
- var $bar = "ok";
-
- function method() { $this->yes = "done"; }
-}
-
-$baz = new foo;
-$baz->method();
-
-$arr[3] = new foo;
-$arr[3]->method();
-
-session_register("baz");
-session_register("arr");
-
-print session_encode()."\n";
-
-session_destroy();
---GET--
---POST--
---EXPECT--
-baz|O:3:"foo":2:{s:3:"bar";s:2:"ok";s:3:"yes";s:4:"done";}arr|a:1:{i:3;O:3:"foo":2:{s:3:"bar";s:2:"ok";s:3:"yes";s:4:"done";}}
diff --git a/ext/session/tests/002.phpt b/ext/session/tests/002.phpt
deleted file mode 100644
index 60ece0dc96..0000000000
--- a/ext/session/tests/002.phpt
+++ /dev/null
@@ -1,10 +0,0 @@
---TEST--
-session_unset() without any session
---FILE--
-<?
-session_unset();
-print "ok\n";
---GET--
---POST--
---EXPECT--
-ok
diff --git a/ext/session/tests/003.phpt b/ext/session/tests/003.phpt
deleted file mode 100644
index 5401a2d0ba..0000000000
--- a/ext/session/tests/003.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Session Object Deserialization
---FILE--
-<?
-
-class foo {
- var $bar = "ok";
- function method() { $this->yes++; }
-}
-
-session_id("test");
-session_start();
-session_decode('baz|O:3:"foo":2:{s:3:"bar";s:2:"ok";s:3:"yes";i:1;}arr|a:1:{i:3;O:3:"foo":2:{s:3:"bar";s:2:"ok";s:3:"yes";i:1;}}');
-
-$baz->method();
-$arr[3]->method();
-
-var_dump($baz);
-var_dump($arr);
-session_destroy();
---EXPECT--
-object(foo)(2) {
- ["bar"]=>
- string(2) "ok"
- ["yes"]=>
- int(2)
-}
-array(1) {
- [3]=>
- &object(foo)(2) {
- ["bar"]=>
- string(2) "ok"
- ["yes"]=>
- int(2)
- }
-}
diff --git a/ext/session/tests/004.phpt b/ext/session/tests/004.phpt
deleted file mode 100644
index 8e6ec4e8d3..0000000000
--- a/ext/session/tests/004.phpt
+++ /dev/null
@@ -1,103 +0,0 @@
---TEST--
-session_set_save_handler test
---FILE--
-<?
-
-class handler {
- var $data = 'baz|O:3:"foo":2:{s:3:"bar";s:2:"ok";s:3:"yes";i:1;}arr|a:1:{i:3;O:3:"foo":2:{s:3:"bar";s:2:"ok";s:3:"yes";i:1;}}';
- function open($save_path, $session_name)
- {
- print "OPEN: $save_path, $session_name\n";
- return true;
- }
- function close()
- {
- return true;
- }
- function read($key)
- {
- print "READ: $key\n";
- return $GLOBALS["hnd"]->data;
- }
-
- function write($key, $val)
- {
- print "WRITE: $key, $val\n";
- $GLOBALS["hnd"]->data = $val;
- return true;
- }
-
- function destroy($key)
- {
- print "DESTROY: $key\n";
- return true;
- }
-
- function gc() { return true; }
-}
-
-$hnd = new handler;
-
-class foo {
- var $bar = "ok";
- function method() { $this->yes++; }
-}
-
-ob_start();
-
-session_set_save_handler(array($hnd, "open"), array($hnd, "close"), array($hnd, "read"), array($hnd, "write"), array($hnd, "destroy"), array($hnd, "gc"));
-
-session_id("test");
-session_start();
-$baz->method();
-$arr[3]->method();
-
-var_dump($baz);
-var_dump($arr);
-
-session_write_close();
-
-session_set_save_handler(array($hnd, "open"), array($hnd, "close"), array($hnd, "read"), array($hnd, "write"), array($hnd, "destroy"), array($hnd, "gc"));
-session_start();
-
-var_dump($baz);
-var_dump($arr);
-
-session_destroy();
---EXPECT--
-OPEN: /tmp, PHPSESSID
-READ: test
-object(foo)(2) {
- ["bar"]=>
- string(2) "ok"
- ["yes"]=>
- int(2)
-}
-array(1) {
- [3]=>
- &object(foo)(2) {
- ["bar"]=>
- string(2) "ok"
- ["yes"]=>
- int(2)
- }
-}
-WRITE: test, baz|O:3:"foo":2:{s:3:"bar";s:2:"ok";s:3:"yes";i:2;}arr|a:1:{i:3;O:3:"foo":2:{s:3:"bar";s:2:"ok";s:3:"yes";i:2;}}
-OPEN: /tmp, PHPSESSID
-READ: test
-object(foo)(2) {
- ["bar"]=>
- string(2) "ok"
- ["yes"]=>
- int(2)
-}
-array(1) {
- [3]=>
- object(foo)(2) {
- ["bar"]=>
- string(2) "ok"
- ["yes"]=>
- int(2)
- }
-}
-DESTROY: test
diff --git a/ext/session/tests/005.phpt b/ext/session/tests/005.phpt
deleted file mode 100644
index 38e660b100..0000000000
--- a/ext/session/tests/005.phpt
+++ /dev/null
@@ -1,138 +0,0 @@
---TEST--
-Custom save handler, multiple session_start()s, complex data structure test.
---FILE--
-<?php
-
-class handler {
- var $data = 'baz|O:3:"foo":2:{s:3:"bar";s:2:"ok";s:3:"yes";i:1;}arr|a:1:{i:3;O:3:"foo":2:{s:3:"bar";s:2:"ok";s:3:"yes";i:1;}}';
- function open($save_path, $session_name)
- {
- print "OPEN: $save_path, $session_name\n";
- return true;
- }
- function close()
- {
- print "CLOSE\n";
- return true;
- }
- function read($key)
- {
- print "READ: $key\n";
- return $GLOBALS["hnd"]->data;
- }
-
- function write($key, $val)
- {
- print "WRITE: $key, $val\n";
- $GLOBALS["hnd"]->data = $val;
- return true;
- }
-
- function destroy($key)
- {
- print "DESTROY: $key\n";
- return true;
- }
-
- function gc() { return true; }
-}
-
-$hnd = new handler;
-
-class foo {
- var $bar = "ok";
- function method() { $this->yes++; }
-}
-
-ob_start();
-
-session_set_save_handler(array($hnd, "open"), array($hnd, "close"), array($hnd, "read"), array($hnd, "write"), array($hnd, "destroy"), array($hnd, "gc"));
-
-session_id("test");
-session_start();
-$baz->method();
-$arr[3]->method();
-
-var_dump($baz);
-var_dump($arr);
-
-session_write_close();
-
-session_set_save_handler(array($hnd, "open"), array($hnd, "close"), array($hnd, "read"), array($hnd, "write"), array($hnd, "destroy"), array($hnd, "gc"));
-session_start();
-$baz->method();
-$arr[3]->method();
-
-
-$c = 123;
-session_register("c");
-var_dump($baz); var_dump($arr); var_dump($c);
-
-session_write_close();
-
-session_set_save_handler(array($hnd, "open"), array($hnd, "close"), array($hnd, "read"), array($hnd, "write"), array($hnd, "destroy"), array($hnd, "gc"));
-session_start();
-var_dump($baz); var_dump($arr); var_dump($c);
-
-session_destroy();
-?>
---EXPECT--
-OPEN: /tmp, PHPSESSID
-READ: test
-object(foo)(2) {
- ["bar"]=>
- string(2) "ok"
- ["yes"]=>
- int(2)
-}
-array(1) {
- [3]=>
- &object(foo)(2) {
- ["bar"]=>
- string(2) "ok"
- ["yes"]=>
- int(2)
- }
-}
-WRITE: test, baz|O:3:"foo":2:{s:3:"bar";s:2:"ok";s:3:"yes";i:2;}arr|a:1:{i:3;O:3:"foo":2:{s:3:"bar";s:2:"ok";s:3:"yes";i:2;}}
-CLOSE
-OPEN: /tmp, PHPSESSID
-READ: test
-object(foo)(2) {
- ["bar"]=>
- string(2) "ok"
- ["yes"]=>
- int(3)
-}
-array(1) {
- [3]=>
- &object(foo)(2) {
- ["bar"]=>
- string(2) "ok"
- ["yes"]=>
- int(3)
- }
-}
-int(123)
-WRITE: test, baz|O:3:"foo":2:{s:3:"bar";s:2:"ok";s:3:"yes";i:3;}arr|a:1:{i:3;O:3:"foo":2:{s:3:"bar";s:2:"ok";s:3:"yes";i:3;}}c|i:123;
-CLOSE
-OPEN: /tmp, PHPSESSID
-READ: test
-object(foo)(2) {
- ["bar"]=>
- string(2) "ok"
- ["yes"]=>
- int(3)
-}
-array(1) {
- [3]=>
- object(foo)(2) {
- ["bar"]=>
- string(2) "ok"
- ["yes"]=>
- int(3)
- }
-}
-int(123)
-DESTROY: test
-CLOSE
diff --git a/ext/session/tests/006.phpt b/ext/session/tests/006.phpt
deleted file mode 100644
index 91f1cb949d..0000000000
--- a/ext/session/tests/006.phpt
+++ /dev/null
@@ -1,62 +0,0 @@
---TEST--
-References between variables in sessions
---FILE--
-<?php
-ob_start();
-session_id("test");
-session_start();
-
-class a {
- var $test = "hallo";
-}
-
-class b {
- var $a;
- function b(&$a) {
- $this->a = &$a;
- }
-}
-
-$a = new a();
-$b = new b($a);
-
-echo "original values:\n";
-var_dump($a,$b);
-
-session_register("a");
-session_register("b");
-session_write_close();
-
-session_unregister("a");
-session_unregister("b");
-
-session_start();
-
-echo "values after session:\n";
-var_dump($a,$b);
-?>
---EXPECT--
-original values:
-object(a)(1) {
- ["test"]=>
- string(5) "hallo"
-}
-object(b)(1) {
- ["a"]=>
- &object(a)(1) {
- ["test"]=>
- string(5) "hallo"
- }
-}
-values after session:
-object(a)(1) {
- ["test"]=>
- string(5) "hallo"
-}
-object(b)(1) {
- ["a"]=>
- &object(a)(1) {
- ["test"]=>
- string(5) "hallo"
- }
-}
diff --git a/ext/shmop/CREDITS b/ext/shmop/CREDITS
deleted file mode 100644
index caab89e208..0000000000
--- a/ext/shmop/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-Shared Memory Operations
-Slava Poliakov, Ilia Alshanetsky
diff --git a/ext/shmop/Makefile.in b/ext/shmop/Makefile.in
deleted file mode 100644
index 0748ec799f..0000000000
--- a/ext/shmop/Makefile.in
+++ /dev/null
@@ -1,8 +0,0 @@
-# $Id$
-
-LTLIBRARY_NAME = libshmop.la
-LTLIBRARY_SOURCES = shmop.c
-LTLIBRARY_SHARED_NAME = shmop.la
-LTLIBRARY_SHARED_LIBADD = $(SHMOP_SHARED_LIBADD)
-
-include $(top_srcdir)/build/dynlib.mk
diff --git a/ext/shmop/README b/ext/shmop/README
deleted file mode 100644
index 381ad9cbc3..0000000000
--- a/ext/shmop/README
+++ /dev/null
@@ -1,65 +0,0 @@
-last update sept 3, 2000 (slavapl@mailandnews.com/iliaa@home.com)
-
-Shared Memory Operations Extension to PHP4
-
- While developing a search deamon we needed the php based front end
- to communicate the deamon via SHM. Now, PHP already had a shared memory
- extention (sysvshm) written by Christian Cartus <cartus@atrior.de>,
- unfortunatly this extention was designed with PHP only in mind, and
- offers high level features which are extremly bothersome for basic SHM
- we had in mind. After spending a day trying to reverse engeener figure
- out the format of sysvshm we decided that it would be much easier to
- add our own extention to php for simple SHM operations, we were right :)).
-
-the functions are:
-
-int shm_open(int key, string flags, int mode, int size)
-
- key - the key of/for the shared memory block
- flags - 2 flags are avalible
- a for access (sets IPC_EXCL)
- c for create (sets IPC_CREATE)
- mode - acsess mode same as for a file (0644) for example
- size - size of the block in bytes
-
- returns an indentifier
-
-
-char shm_read(int shmid, int start, int count)
-
- shmid - shmid from which to read
- start - offset from which to start reading
- count - how many bytes to read
-
- returns the data read
-
-int shm_write(int shmid, string data, int offset)
-
- shmid - shmid from which to read
- data - string to put into shared memory
- offset - offset in shm to write from
-
- returns bytes written
-
-int shm_size(int shmid)
-
- shmid - shmid for which to return the size
-
- returns the size in bytes of the shm segment
-
-
-int shm_delete(int shmid)
-
- marks the segment for deletion, the segment will be deleted when all processes mapping it will detach
-
- shmid - shmid which to mark for deletion
-
- returns 1 if all ok, zero on failure
-
-int shm_close(int shmid)
-
- shmid - shmid which to close
-
- returns zero
-
-
diff --git a/ext/shmop/config.m4 b/ext/shmop/config.m4
deleted file mode 100644
index 1a9ca6adad..0000000000
--- a/ext/shmop/config.m4
+++ /dev/null
@@ -1,8 +0,0 @@
-dnl $Id$
-PHP_ARG_ENABLE(shmop, whether to enable shmop support,
-[ --enable-shmop Enable shmop support])
-
-if test "$PHP_SHMOP" != "no"; then
- AC_DEFINE(HAVE_SHMOP, 1, [ ])
- PHP_EXTENSION(shmop, $ext_shared)
-fi
diff --git a/ext/shmop/php_shmop.h b/ext/shmop/php_shmop.h
deleted file mode 100644
index 2045afdebd..0000000000
--- a/ext/shmop/php_shmop.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Slava Poliakov (slavapl@mailandnews.com) |
- | Ilia Alshanetsky (iliaa@home.com) |
- +----------------------------------------------------------------------+
- */
-#ifndef PHP_SHMOP_H
-#define PHP_SHMOP_H
-
-#if HAVE_SHMOP
-
-extern zend_module_entry shmop_module_entry;
-#define phpext_shmop_ptr &shmop_module_entry
-
-#ifdef PHP_WIN32
-#define PHP_SHMOP_API __declspec(dllexport)
-#else
-#define PHP_SHMOP_API
-#endif
-
-PHP_MINIT_FUNCTION(shmop);
-PHP_MSHUTDOWN_FUNCTION(shmop);
-PHP_RINIT_FUNCTION(shmop);
-PHP_RSHUTDOWN_FUNCTION(shmop);
-PHP_MINFO_FUNCTION(shmop);
-
-PHP_FUNCTION(shmop_open);
-PHP_FUNCTION(shmop_read);
-PHP_FUNCTION(shmop_close);
-PHP_FUNCTION(shmop_size);
-PHP_FUNCTION(shmop_write);
-PHP_FUNCTION(shmop_delete);
-
-struct php_shmop
-{
- int shmid;
- key_t key;
- int shmflg;
- char *addr;
- int size;
-};
-
-typedef struct {
- int le_shmop;
-} php_shmop_globals;
-
-#ifdef ZTS
-#define SHMOPG(v) (shmop_globals->v)
-#define SHMOPLS_FETCH() php_shmop_globals *shmop_globals = ts_resource(gd_shmop_id)
-#else
-#define SHMOPG(v) (shmop_globals.v)
-#define SHMOPLS_FETCH()
-#endif
-
-#else
-
-#define phpext_shmop_ptr NULL
-
-#endif
-
-#endif /* PHP_SHMOP_H */
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/shmop/setup.stub b/ext/shmop/setup.stub
deleted file mode 100644
index e35c532988..0000000000
--- a/ext/shmop/setup.stub
+++ /dev/null
@@ -1,5 +0,0 @@
-# $Source$
-# $Id$
-
-define_option enable-shmop 'System V shmop suppport? ' yesno no \
-' Whether to use the System V shmop (currently only Solaris and Linux).'
diff --git a/ext/shmop/shmop.c b/ext/shmop/shmop.c
deleted file mode 100644
index 60e9dcd0ce..0000000000
--- a/ext/shmop/shmop.c
+++ /dev/null
@@ -1,353 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Slava Poliakov (slavapl@mailandnews.com) |
- | Ilia Alshanetsky (iliaa@home.com) |
- +----------------------------------------------------------------------+
- */
-/* $Id$ */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "php_ini.h"
-#include "php_shmop.h"
-#include <sys/ipc.h>
-#include <sys/shm.h>
-
-#if HAVE_SHMOP
-
-#include "ext/standard/info.h"
-
-#ifdef ZTS
-int shmop_globals_id;
-#else
-php_shmop_globals shmop_globals;
-#endif
-
-int shm_type;
-
-/* {{{ shmop_functions[]
- */
-function_entry shmop_functions[] = {
- PHP_FE(shmop_open, NULL)
- PHP_FE(shmop_read, NULL)
- PHP_FE(shmop_close, NULL)
- PHP_FE(shmop_size, NULL)
- PHP_FE(shmop_write, NULL)
- PHP_FE(shmop_delete, NULL)
- {NULL, NULL, NULL} /* Must be the last line in shmop_functions[] */
-};
-/* }}} */
-
-/* {{{ shmop_module_entry
- */
-zend_module_entry shmop_module_entry = {
- "shmop",
- shmop_functions,
- PHP_MINIT(shmop),
- PHP_MSHUTDOWN(shmop),
- NULL,
- NULL,
- PHP_MINFO(shmop),
- STANDARD_MODULE_PROPERTIES
-};
-/* }}} */
-
-#ifdef COMPILE_DL_SHMOP
-ZEND_GET_MODULE(shmop)
-#endif
-
-/* {{{ rsclean
- */
-static void rsclean(zend_rsrc_list_entry *rsrc)
-{
- struct php_shmop *shmop = (struct php_shmop *)rsrc->ptr;
- shmdt(shmop->addr);
- efree(shmop);
-}
-/* }}} */
-
-/* {{{ PHP_MINIT_FUNCTION
- */
-PHP_MINIT_FUNCTION(shmop)
-{
- shm_type = zend_register_list_destructors_ex(rsclean, NULL, "shmop", module_number);
-
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_MSHUTDOWN_FUNCTION
- */
-PHP_MSHUTDOWN_FUNCTION(shmop)
-{
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_MINFO_FUNCTION
- */
-PHP_MINFO_FUNCTION(shmop)
-{
- php_info_print_table_start();
- php_info_print_table_row(2, "shmop support", "enabled");
- php_info_print_table_end();
-}
-/* }}} */
-
-/* {{{ proto int shmop_open (int key, int flags, int mode, int size)
- gets and attaches a shared memory segment */
-PHP_FUNCTION(shmop_open)
-{
- zval **key, **flags, **mode, **size;
- struct php_shmop *shmop;
- struct shmid_ds shm;
- int rsid;
- int shmflg=0;
-
- if (ZEND_NUM_ARGS() != 4 || zend_get_parameters_ex(4, &key, &flags, &mode, &size) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(key);
- convert_to_string_ex(flags);
- convert_to_long_ex(mode);
- convert_to_long_ex(size);
-
- shmop = emalloc(sizeof(struct php_shmop));
- memset(shmop, 0, sizeof(struct php_shmop));
-
- shmop->key = (*key)->value.lval;
- shmop->shmflg |= (*mode)->value.lval;
-
- if (memchr((*flags)->value.str.val, 'a', (*flags)->value.str.len)) {
- shmflg = SHM_RDONLY;
- shmop->shmflg |= IPC_EXCL;
- }
- else if (memchr((*flags)->value.str.val, 'c', (*flags)->value.str.len)) {
- shmop->shmflg |= IPC_CREAT;
- shmop->size = (*size)->value.lval;
- }
- else {
- php_error(E_WARNING, "shmopen: access mode invalid");
- efree(shmop);
- RETURN_FALSE;
- }
-
- shmop->shmid = shmget(shmop->key, shmop->size, shmop->shmflg);
- if (shmop->shmid == -1) {
- php_error(E_WARNING, "shmopen: can't get the block");
- efree(shmop);
- RETURN_FALSE;
- }
-
- if (shmctl(shmop->shmid, IPC_STAT, &shm)) {
- efree(shmop);
- php_error(E_WARNING, "shmopen: can't get information on the block");
- RETURN_FALSE;
- }
-
- shmop->addr = shmat(shmop->shmid, 0, shmflg);
- if (shmop->addr == (char*) -1) {
- efree(shmop);
- php_error(E_WARNING, "shmopen: can't attach the memory block");
- RETURN_FALSE;
- }
-
- shmop->size = shm.shm_segsz;
-
- rsid = zend_list_insert(shmop, shm_type);
- RETURN_LONG(rsid);
-}
-/* }}} */
-
-/* {{{ proto string shmop_read (int shmid, int start, int count)
- reads from a shm segment */
-PHP_FUNCTION(shmop_read)
-{
- zval **shmid, **start, **count;
- struct php_shmop *shmop;
- int type;
- char *startaddr;
- int bytes;
- char *return_string;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &shmid, &start, &count) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(shmid);
- convert_to_long_ex(start);
- convert_to_long_ex(count);
-
- shmop = zend_list_find((*shmid)->value.lval, &type);
-
- if (!shmop) {
- php_error(E_WARNING, "shmread: can't find this segment");
- RETURN_FALSE;
- }
-
- if ((*start)->value.lval < 0 || (*start)->value.lval > shmop->size) {
- php_error(E_WARNING, "shmread: start is out of range");
- RETURN_FALSE;
- }
-
- if (((*start)->value.lval+(*count)->value.lval) > shmop->size) {
- php_error(E_WARNING, "shmread: count is out of range");
- RETURN_FALSE;
- }
-
- if ((*count)->value.lval < 0 ){
- php_error(E_WARNING, "shmread: count is out of range");
- RETURN_FALSE;
- }
-
- startaddr = shmop->addr + (*start)->value.lval;
- bytes = (*count)->value.lval ? (*count)->value.lval : shmop->size-(*start)->value.lval;
-
- return_string = emalloc(bytes);
- memcpy(return_string, startaddr, bytes);
-
- RETURN_STRINGL(return_string, bytes, 0);
-}
-/* }}} */
-
-/* {{{ proto void shmop_close (int shmid)
- closes a shared memory segment */
-PHP_FUNCTION(shmop_close)
-{
- zval **shmid;
- struct php_shmop *shmop;
- int type;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &shmid) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- shmop = zend_list_find((*shmid)->value.lval, &type);
-
- if (!shmop) {
- php_error(E_WARNING, "shmclose: no such shmid");
- RETURN_FALSE;
- }
- zend_list_delete((*shmid)->value.lval);
-
- RETURN_LONG(0);
-}
-/* }}} */
-
-/* {{{ proto int shmop_size (int shmid)
- returns the shm size */
-PHP_FUNCTION(shmop_size)
-{
- zval **shmid;
- struct php_shmop *shmop;
- int type;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &shmid) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(shmid);
-
- shmop = zend_list_find((*shmid)->value.lval, &type);
-
- if (!shmop) {
- php_error(E_WARNING, "shmsize: no such segment");
- RETURN_FALSE;
- }
-
- RETURN_LONG(shmop->size);
-}
-/* }}} */
-
-/* {{{ proto int shmop_write (int shmid, string data, int offset)
- writes to a shared memory segment */
-PHP_FUNCTION(shmop_write)
-{
- zval **shmid, **data, **offset;
- struct php_shmop *shmop;
- int type;
- int writesize;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &shmid, &data, &offset) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(shmid);
- convert_to_string_ex(data);
- convert_to_long_ex(offset);
-
- shmop = zend_list_find((*shmid)->value.lval, &type);
-
- if (!shmop) {
- php_error(E_WARNING, "shmwrite: error no such segment");
- RETURN_FALSE;
- }
-
- if ( (*offset)->value.lval > shmop->size ) {
- php_error(E_WARNING, "shmwrite: offset out of range");
- RETURN_FALSE;
- }
-
- writesize = ((*data)->value.str.len<shmop->size-(*offset)->value.lval) ? (*data)->value.str.len : shmop->size-(*offset)->value.lval;
- memcpy(shmop->addr+(*offset)->value.lval, (*data)->value.str.val, writesize);
-
- RETURN_LONG(writesize);
-}
-/* }}} */
-
-/* {{{ proto bool shmop_delete (int shmid)
- mark segment for deletion */
-PHP_FUNCTION(shmop_delete)
-{
- zval **shmid;
- struct php_shmop *shmop;
- int type;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &shmid) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(shmid);
-
- shmop = zend_list_find((*shmid)->value.lval, &type);
-
- if (!shmop) {
- php_error(E_WARNING, "shmdelete: error no such segment");
- RETURN_FALSE;
- }
-
- if (shmctl(shmop->shmid, IPC_RMID, NULL)) {
- php_error(E_WARNING, "shmdelete: can't mark segment for deletion (are you the owner?)");
- RETURN_FALSE;
- }
-
- RETURN_TRUE;
-}
-/* }}} */
-
-#endif /* HAVE_SHMOP */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/skeleton/CREDITS b/ext/skeleton/CREDITS
deleted file mode 100644
index 58fc71019a..0000000000
--- a/ext/skeleton/CREDITS
+++ /dev/null
@@ -1 +0,0 @@
-extname \ No newline at end of file
diff --git a/ext/skeleton/EXPERIMENTAL b/ext/skeleton/EXPERIMENTAL
deleted file mode 100644
index e69de29bb2..0000000000
--- a/ext/skeleton/EXPERIMENTAL
+++ /dev/null
diff --git a/ext/skeleton/create_stubs b/ext/skeleton/create_stubs
deleted file mode 100755
index d740027ab0..0000000000
--- a/ext/skeleton/create_stubs
+++ /dev/null
@@ -1,335 +0,0 @@
-#!/usr/bin/awk -f
-
-function gobble(s, x)
-{
- sub(/^ /, "", line)
- match(line, "^" "(" s ")")
- x = substr(line, 1, RLENGTH)
- line = substr(line, RLENGTH+1)
- return x
-}
-
-function convert(i, j, t)
-{
- type = argtypes[i,j]
- name = argnames[i,j]
- opt = optionals[i,j]
- tabs = x = ""
-
- for (i = 0; i < t; i++) { tabs = tabs "\t" }
-
- if (type == "int") {
- x = tabs "convert_to_long_ex(" name ext ");\n" \
- (ext? tabs name " = Z_LVAL_PP(" name ext ");\n": "")
- ints = ints "\tint " name ";\n"
- } else if (type == "bool") {
- x = tabs "convert_to_long_ex(" name ext ");\n" \
- (ext? tabs name " = Z_LVAL_PP(" name ext ");\n": "")
- ints = ints "\tint " name ";\n"
- } else if (type == "double") {
- x = tabs "convert_to_double_ex(" name ext ");\n" \
- (ext? tabs name " = Z_DVAL_PP(" name ext ");\n": "")
- doubles = doubles "\tdouble " name ";\n"
- } else if (type == "float") {
- x = tabs "convert_to_double_ex(" name ext ");\n" \
- (ext? tabs name " = (float) Z_DVAL_PP(" name ext ");\n": "")
- floats = floats "\tfloat " name ";\n"
- } else if (type == "string") {
- x = tabs "convert_to_string_ex(" name ext ");\n" \
- (ext? tabs name " = Z_STRVAL_PP(" name ext ");\n": "")
- (ext ? strings = strings "\tchar *" name " = NULL;\n" : 0)
- if (string_lens) {
- x = x tabs name "_len = Z_STRLEN_PP(" name ext ");\n"
- ints = ints "\tint " name "_len;\n"
- }
- } else if (type == "array") {
- x = "convert_to_array_ex(" name ext ");\n"
- } else if (type == "resource") {
- if (opt && i > -1) {
- resources = resources "\tif (argc < " j+1 ") {\n" \
- comment("\t\t/* Argument not given, do something before\n\t\t trying to fetch resource " name ". */\n") \
- "\t}\n\tZEND_FETCH_RESOURCE(???, ???, " name ext ", " name "_id, \"???\", ???G());\n"
- } else {
- resources = resources "\tZEND_FETCH_RESOURCE(???, ???, " name ext ", " name "_id, \"???\", ???G());\n"
- }
- funcvals = funcvals "\tint " name "_id = -1;\n"
- } else {
- x = comment(tabs "/* Write your own code here to handle argument " name ". */\n")
- }
-
- if (x) return x
-}
-
-function comment(s)
-{
- if (i_know_what_to_do_shut_up_i_dont_need_your_help_mode) {
- return
- } else {
- return s
- }
-}
-
-BEGIN {
- name = "[_A-Za-z][_A-Za-z0-9]*"
- type = "int|double|float|string|bool|array|object|resource|mixed|void"
- num_funcs = 0
-
- if (assign_params) ext = "_arg"
-
- if (xml && xml != "yes") {
- xmldoc = xml
- } else {
- xmldoc = extname "/" extname ".xml"
- }
-
-
- xmlhead = " <reference id=\"ref." extname "\">\n" \
- " <title> functions</title>\n" \
- " <titleabbrev></titleabbrev>\n\n" \
- " <partintro>\n" \
- " <para>\n" \
- " </para\n" \
- " </partintro>\n\n";
-
- xmlfoot = " </reference>\n\n" \
- "<!-- Keep this comment at the end of the file\n" \
- "Local variables:\n" \
- "mode: sgml\n" \
- "sgml-omittag:t\n" \
- "sgml-shorttag:t\n" \
- "sgml-minimize-attributes:nil\n" \
- "sgml-always-quote-attributes:t\n" \
- "sgml-indent-step:1\n" \
- "sgml-indent-data:t\n" \
- "sgml-parent-document:nil\n" \
- "sgml-default-dtd-file:\"../../manual.ced\"\n" \
- "sgml-exposed-tags:nil\n" \
- "sgml-local-catalogs:nil\n" \
- "sgml-local-ecat-files:nil\n" \
- "End:\n" \
- "-->\n"
-}
-
-{
- args_max = args_min = optional = i = 0
- line = $0
-
- func_type = gobble(type);
- func_name = gobble(name);
-
- if (gobble("\\(")) {
- if (gobble("\\[")) optional = 1
- while (arg_type = gobble(type)) {
- arg_name = gobble(name)
- argtypes[num_funcs,args_max] = arg_type
- argnames[num_funcs,args_max] = arg_name
-
- args_max++
- if (optional) {
- optionals[num_funcs,i] = optional
- if (arg_type != "resource") {
- useswitch[num_funcs] = 1
- }
- } else {
- args_min++
- }
-
- if (x = gobble("\\[")) {
- optional++
- }
-
- y = gobble(",")
- if (!x && y && optional) {
- check_argc_in_switch[num_funcs] = 1
- grouped_optional_param[num_funcs,i] = 1
- }
- i++
- }
- }
-
- if (x = gobble("\\)")) {
- sub(/^[ \t]+/, "", line)
- fcomments[num_funcs] = line
- }
-
- funcs[num_funcs] = func_name
- types[num_funcs] = func_type
- maxargs[num_funcs] = args_max
- minargs[num_funcs] = args_min
-
- num_funcs++
-}
-
-END {
- if (xml) print xmlhead > xmldoc
- for (i = 0; i < num_funcs; i++) {
-
- compareargc = maxargs[i] - minargs[i]
- closefetch = xmlparams = funcvals = resources = handleargs = closeopts = ""
- ints = doubles = floats = strings = arrays = ""
-
- proto = "/* {{{ proto " types[i] " " funcs[i] "("
-
-
- refid = funcs[i]
- gsub(/_/, "-", refid)
- xmlstr = " <refentry id=\"function." refid "\">\n" \
- " <refnamediv>\n" \
- " <refname>" funcs[i] "</refname>\n" \
- " <refpurpose>" fcomments[i] "</refpurpose>\n" \
- " </refnamediv>\n" \
- " <refsect1>\n" \
- " <title>Description</title>\n" \
- " <funcsynopsis>\n" \
- " <funcprototype>\n" \
- " <funcdef>" types[i] " <function>" funcs[i] "</function></funcdef>\n"
-
- if (maxargs[i]) {
- zvals = "\tzval "
- if (compareargc) {
- funcvals = "\tint argc;\n"
- if (minargs[i]) {
- fetchargs = "\targc = ZEND_NUM_ARGS();\n\tif (argc < " \
- minargs[i] " || argc > " maxargs[i] \
- " || zend_get_parameters_ex(argc, "
- } else {
- fetchargs = "\targc = ZEND_NUM_ARGS();\n\tif (argc > " \
- maxargs[i] " || (argc && zend_get_parameters_ex(argc, "
- closefetch = ")"
- }
- } else {
- fetchargs = "\tif (ZEND_NUM_ARGS() != " maxargs[i] \
- " || zend_get_parameters_ex(" maxargs[i] ", "
- }
- }
-
- for (j = 0; j < maxargs[i]; j++) {
-
- if (j) {
- zvals = zvals ", "
- fetchargs = fetchargs ", "
- }
-
- zvals = zvals "**" argnames[i,j] ext
- fetchargs = fetchargs "&" argnames[i,j] ext
-
- xmlparams = xmlparams " <paramdef>" argtypes[i,j]
- if (j > minargs[i]-1) {
- if (!grouped_optional_param[i,j-1]) {
- if (j > 0) proto = proto " "
- proto = proto "["
- closeopts = closeopts "]"
- }
- xmlparams = xmlparams "\n <parameter><optional>" \
- argnames[i,j] \
- "</optional></parameter>\n </paramdef>\n"
- } else {
- xmlparams = xmlparams \
- " <parameter>" \
- argnames[i,j] \
- "</parameter></paramdef>\n"
- }
-
- if (j > 0) proto = proto ", "
- proto = proto argtypes[i,j] " " argnames[i,j]
-
- # Clean up this mess...
-
- if (useswitch[i]) {
- if (grouped_optional_param[i,j] && code) {
- handleargs = convert(i, j, 3) \
- ((grouped_optional_param[i,j-1]) ? "" : comment("\t\t\t/* Fall-through. */\n")) \
- handleargs
- } else {
- if (j > minargs[i]-1) {
- if (code = convert(i, j, 3)) {
- handleargs = "\t\tcase " j+1 ":\n" code \
- ((grouped_optional_param[i,j-1]) ? "" : comment("\t\t\t/* Fall-through. */\n")) \
- handleargs
- } else {
- handleargs = "\t\tcase " j+1 ":" \
- comment("\t/* Fall-through. */") \
- "\n" handleargs
- }
- } else if (j >= minargs[i]-1) {
- if (code = convert(i, j, 3)) {
- handleargs = "\t\tcase " j+1 ":\n" code handleargs
- } else {
- handleargs = "\t\tcase " j+1 ":\n" handleargs
- }
- } else {
- if (code = convert(i, j, 3)) handleargs = code handleargs
- }
- }
- } else {
- if (code = convert(i, j, 1)) handleargs = handleargs code
- }
- }
-
- proto = proto closeopts ")\n " fcomments[i] " */\nPHP_FUNCTION(" funcs[i] ")\n{"
- if (maxargs[i]) {
- zvals = zvals ";"
- fetchargs = fetchargs ") == FAILURE)" closefetch "{\n\t\tWRONG_PARAM_COUNT;\n\t}\n"
- }
- if (assign_params) funcvals = ints doubles floats strings
- if (resources) funcvals = funcvals "\t???LS_FETCH();\n"
- if (useswitch[i]) {
- if (check_argc_in_switch[i]) {
- check_argc = "\t\tdefault:\n\t\t\tWRONG_PARAM_COUNT;\n"
- } else {
- check_argc = ""
- }
- handleargs = "\tswitch (argc) {\n" \
- handleargs \
- (minargs[i] ? "" : "\t\tcase 0:\n") \
- "\t\t\tbreak;\n" check_argc "\t}"
- }
- xmlstr = xmlstr xmlparams \
- " </funcprototype>\n" \
- " </funcsynopsis>\n" \
- " <para>\n" \
- " </para>\n" \
- " </refsect1>\n" \
- " </refentry>\n"
-
- print proto > stubfile
- if (zvals) print zvals > stubfile
- if (funcvals) print funcvals > stubfile
- if (fetchargs) print fetchargs > stubfile
- if (resources) {
- print resources > stubfile
- if (!stubs) print "" > extname "/function_warning"
- }
- if (handleargs) print handleargs > stubfile
- if (!i_know_what_to_do_shut_up_i_dont_need_your_help_mode) {
- print "\n\tphp_error(E_WARNING, \"" funcs[i] ": not yet implemented\");" > stubfile
- }
- print "}\n/* }}} */\n" > stubfile
-
- if (stubs) {
- h_stubs = h_stubs "PHP_FUNCTION(" funcs[i] ");\n"
- c_stubs = c_stubs "\tPHP_FE(" funcs[i] ",\tNULL)\n"
- } else {
- print "PHP_FUNCTION(" funcs[i] ");" > extname "/function_declarations"
- print "\tPHP_FE(" funcs[i] ",\tNULL)" > extname "/function_entries"
- }
-
- if (xml) print xmlstr > xmldoc
- }
-
- if (stubs) {
- print "\n/* ----------------------------------------------------------- */\n" > stubfile
- print c_stubs > stubfile
- print "\n/* ----------------------------------------------------------- */\n" > stubfile
- print h_stubs > stubfile
- }
-
- if (xml) print xmlfoot > xmldoc
-}
-
-#
-# Local variables:
-# tab-width: 2
-# c-basic-offset: 2
-# End:
-
diff --git a/ext/skeleton/php_skeleton.h b/ext/skeleton/php_skeleton.h
deleted file mode 100644
index 69b09e0604..0000000000
--- a/ext/skeleton/php_skeleton.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/* __header_here__ */
-
-#ifndef PHP_EXTNAME_H
-#define PHP_EXTNAME_H
-
-extern zend_module_entry extname_module_entry;
-#define phpext_extname_ptr &extname_module_entry
-
-#ifdef PHP_WIN32
-#define PHP_EXTNAME_API __declspec(dllexport)
-#else
-#define PHP_EXTNAME_API
-#endif
-
-PHP_MINIT_FUNCTION(extname);
-PHP_MSHUTDOWN_FUNCTION(extname);
-PHP_RINIT_FUNCTION(extname);
-PHP_RSHUTDOWN_FUNCTION(extname);
-PHP_MINFO_FUNCTION(extname);
-
-PHP_FUNCTION(confirm_extname_compiled); /* For testing, remove later. */
-/* __function_declarations_here__ */
-
-/*
- Declare any global variables you may need between the BEGIN
- and END macros here:
-
-ZEND_BEGIN_MODULE_GLOBALS(extname)
- int global_value;
- char *global_string;
-ZEND_END_MODULE_GLOBALS(extname)
-*/
-
-/* In every function that needs to use variables in php_extname_globals,
- do call EXTNAME_LS_FETCH(); after declaring other variables used by
- that function, and always refer to them as EXTNAME_G(variable).
- You are encouraged to rename these macros something shorter, see
- examples in any other php module directory.
-*/
-
-#ifdef ZTS
-#define EXTNAME_G(v) (extname_globals->v)
-#define EXTNAME_LS_FETCH() zend_extname_globals *extname_globals = ts_resource(extname_globals_id)
-#else
-#define EXTNAME_G(v) (extname_globals.v)
-#define EXTNAME_LS_FETCH()
-#endif
-
-#endif /* PHP_EXTNAME_H */
-
-/* __footer_here__ */
diff --git a/ext/skeleton/skeleton.c b/ext/skeleton/skeleton.c
deleted file mode 100644
index 2fbc52c749..0000000000
--- a/ext/skeleton/skeleton.c
+++ /dev/null
@@ -1,148 +0,0 @@
-/* __header_here__ */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "php_ini.h"
-#include "php_extname.h"
-
-/* If you declare any globals in php_extname.h uncomment this:
-ZEND_DECLARE_MODULE_GLOBALS(extname)
-*/
-
-/* True global resources - no need for thread safety here */
-static int le_extname;
-
-/* {{{ extname_functions[]
- *
- * Every user visible function must have an entry in extname_functions[].
- */
-function_entry extname_functions[] = {
- PHP_FE(confirm_extname_compiled, NULL) /* For testing, remove later. */
- /* __function_entries_here__ */
- {NULL, NULL, NULL} /* Must be the last line in extname_functions[] */
-};
-
-/* {{{ extname_module_entry
- */
-zend_module_entry extname_module_entry = {
- "extname",
- extname_functions,
- PHP_MINIT(extname),
- PHP_MSHUTDOWN(extname),
- PHP_RINIT(extname), /* Replace with NULL if there's nothing to do at request start */
- PHP_RSHUTDOWN(extname), /* Replace with NULL if there's nothing to do at request end */
- PHP_MINFO(extname),
- STANDARD_MODULE_PROPERTIES
-};
-/* }}} */
-
-#ifdef COMPILE_DL_EXTNAME
-ZEND_GET_MODULE(extname)
-#endif
-
-/* {{{ PHP_INI
- */
-/* Remove comments and fill if you need to have entries in php.ini
-PHP_INI_BEGIN()
- STD_PHP_INI_ENTRY("extname.value", "42", PHP_INI_ALL, OnUpdateInt, global_value, zend_extname_globals, extname_globals)
- STD_PHP_INI_ENTRY("extname.string", "foobar", PHP_INI_ALL, OnUpdateString, global_string, zend_extname_globals, extname_globals)
-PHP_INI_END()
-*/
-/* }}} */
-
-/* {{{ PHP_MINIT_FUNCTION
- */
-PHP_MINIT_FUNCTION(extname)
-{
-/* Remove comments if you have entries in php.ini
- REGISTER_INI_ENTRIES();
-*/
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_MSHUTDOWN_FUNCTION
- */
-PHP_MSHUTDOWN_FUNCTION(extname)
-{
-/* Remove comments if you have entries in php.ini
- UNREGISTER_INI_ENTRIES();
-*/
- return SUCCESS;
-}
-/* }}} */
-
-/* Remove if there's nothing to do at request start */
-/* {{{ PHP_RINIT_FUNCTION
- */
-PHP_RINIT_FUNCTION(extname)
-{
- return SUCCESS;
-}
-/* }}} */
-
-/* Remove if there's nothing to do at request end */
-/* {{{ PHP_RSHUTDOWN_FUNCTION
- */
-PHP_RSHUTDOWN_FUNCTION(extname)
-{
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_MINFO_FUNCTION
- */
-PHP_MINFO_FUNCTION(extname)
-{
- php_info_print_table_start();
- php_info_print_table_header(2, "extname support", "enabled");
- php_info_print_table_end();
-
- /* Remove comments if you have entries in php.ini
- DISPLAY_INI_ENTRIES();
- */
-}
-/* }}} */
-
-/* Remove the following function when you have succesfully modified config.m4
- so that your module can be compiled into PHP, it exists only for testing
- purposes. */
-
-/* Every user-visible function in PHP should document itself in the source */
-/* {{{ proto string confirm_extname_compiled(string arg)
- Return a string to confirm that the module is compiled in */
-PHP_FUNCTION(confirm_extname_compiled)
-{
- zval **arg;
- int len;
- char string[256];
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(arg);
-
- len = sprintf(string, "Congratulations! You have successfully modified ext/%.78s/config.m4. Module %.78s is now compiled into PHP.", "extname", Z_STRVAL_PP(arg));
- RETURN_STRINGL(string, len, 1);
-}
-/* }}} */
-/* The previous line is meant for vim and emacs, so it can correctly fold and
- unfold functions in source code. See the corresponding marks just before
- function definition, where the functions purpose is also documented. Please
- follow this convention for the convenience of others editing your code.
-*/
-
-/* __function_stubs_here__ */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/skeleton/skeleton.php b/ext/skeleton/skeleton.php
deleted file mode 100644
index 744edb00e7..0000000000
--- a/ext/skeleton/skeleton.php
+++ /dev/null
@@ -1,10 +0,0 @@
-<?
-$module = 'extname';
-$function = 'confirm_' . $module . '_compiled';
-if (extension_loaded($module)) {
- $str = $function($module);
-} else {
- $str = "Module $module is not compiled into PHP";
-}
-echo "$str\n";
-?>
diff --git a/ext/skeleton/tests/001.phpt b/ext/skeleton/tests/001.phpt
deleted file mode 100644
index cf40e4e1a5..0000000000
--- a/ext/skeleton/tests/001.phpt
+++ /dev/null
@@ -1,23 +0,0 @@
---TEST--
-Check for extname presence
---SKIPIF--
-<?php if (!extension_loaded("extname")) print "skip"; ?>
---POST--
---GET--
---FILE--
-<?php
-echo "extname extension is available";
-/*
- you can add regression tests for your extension here
-
- the output of your test code has to be equal to the
- text in the --EXPECT-- section below for the tests
- to pass, differences between the output and the
- expected text are interpreted as failure
-
- see php4/tests/README for further information on
- writing regression tests
-*/
-?>
---EXPECT--
-extname extension is available \ No newline at end of file
diff --git a/ext/snmp/CREDITS b/ext/snmp/CREDITS
deleted file mode 100644
index 2c90dc12ab..0000000000
--- a/ext/snmp/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-SNMP
-Rasmus Lerdorf
diff --git a/ext/snmp/Makefile.in b/ext/snmp/Makefile.in
deleted file mode 100644
index ef21e5e3e9..0000000000
--- a/ext/snmp/Makefile.in
+++ /dev/null
@@ -1,9 +0,0 @@
-
-LTLIBRARY_NAME = libsnmp.la
-LTLIBRARY_SOURCES = snmp.c
-LTLIBRARY_SHARED_NAME = snmp.la
-LTLIBRARY_SHARED_LIBADD = $(SNMP_SHARED_LIBADD)
-
-EXTRA_INCLUDES = $(SNMP_INCLUDE)
-
-include $(top_srcdir)/build/dynlib.mk
diff --git a/ext/snmp/config.m4 b/ext/snmp/config.m4
deleted file mode 100644
index 533e2aad0d..0000000000
--- a/ext/snmp/config.m4
+++ /dev/null
@@ -1,74 +0,0 @@
-
-
-PHP_ARG_WITH(snmp,for SNMP support,
-[ --with-snmp[=DIR] Include SNMP support. DIR is the SNMP base
- install directory, defaults to searching through
- a number of common locations for the snmp install.
- Set DIR to "shared" to build as a dl, or "shared,DIR"
- to build as a dl and still specify DIR.])
-
- if test "$PHP_SNMP" != "no"; then
- if test "$PHP_SNMP" = "yes"; then
- SNMP_INCDIR=/usr/local/include
- SNMP_LIBDIR=/usr/local/lib
- test -f /usr/local/include/ucd-snmp/snmp.h && SNMP_INCDIR=/usr/local/include/ucd-snmp
- test -f /usr/include/ucd-snmp/snmp.h && SNMP_INCDIR=/usr/include/ucd-snmp
- test -f /usr/include/snmp/snmp.h && SNMP_INCDIR=/usr/include/snmp
- test -f /usr/include/snmp/include/ucd-snmp/snmp.h && SNMP_INCDIR=/usr/include/snmp/include/ucd-snmp
- test -f /usr/lib/libsnmp.a && SNMP_LIBDIR=/usr/lib
- test -f /usr/lib/libsnmp.so && SNMP_LIBDIR=/usr/lib
- test -f /usr/local/lib/libsnmp.a && SNMP_LIBDIR=/usr/local/lib
- test -f /usr/local/lib/libsnmp.so && SNMP_LIBDIR=/usr/local/lib
- test -f /usr/local/snmp/lib/libsnmp.a && SNMP_LIBDIR=/usr/local/snmp/lib
- test -f /usr/local/snmp/lib/libsnmp.so && SNMP_LIBDIR=/usr/local/snmp/lib
- else
- SNMP_INCDIR=$PHP_SNMP/include
- test -d $PHP_SNMP/include/ucd-snmp && SNMP_INCDIR=$withval/include/ucd-snmp
- SNMP_LIBDIR=$PHP_SNMP/lib
- fi
- AC_DEFINE(HAVE_SNMP,1,[ ])
- PHP_ADD_INCLUDE($SNMP_INCDIR)
- PHP_ADD_LIBRARY_WITH_PATH(snmp, $SNMP_LIBDIR, SNMP_SHARED_LIBADD)
- old_CPPFLAGS=$CPPFLAGS
- CPPFLAGS="$INCLUDES $CPPFLAGS"
- AC_CHECK_HEADERS(default_store.h)
- if test "$ac_cv_header_default_store_h" = "yes"; then
- dnl UCD SNMP 4.1.x
- AC_TRY_RUN([
-#include <ucd-snmp-config.h>
-main() { exit(USE_OPENSSL != 1); }
- ],[
- SNMP_SSL=yes
- ],[
- SNMP_SSL=no
- ],[
- SNMP_SSL=no
- ])
- if test "$SNMP_SSL" = "yes"; then
- PHP_SETUP_OPENSSL
- fi
- fi
- CPPFLAGS=$old_CPPFLAGS
- PHP_EXTENSION(snmp,$ext_shared)
- PHP_SUBST(SNMP_SHARED_LIBADD)
- AC_CHECK_LIB(kstat, kstat_read, [
- PHP_ADD_LIBRARY(kstat,,SNMP_SHARED_LIBADD)
- ])
- SNMP_INCLUDE=-I$SNMP_INCDIR
- fi
-PHP_SUBST(SNMP_LIBDIR)
-PHP_SUBST(SNMP_INCLUDE)
-PHP_SUBST(KSTAT_LIBS)
-
-AC_MSG_CHECKING(whether to enable UCD SNMP hack)
-AC_ARG_ENABLE(ucd-snmp-hack,
-[ --enable-ucd-snmp-hack Enable UCD SNMP hack],[
- if test "$enableval" = "yes" ; then
- AC_DEFINE(UCD_SNMP_HACK, 1, [ ])
- AC_MSG_RESULT(yes)
- else
- AC_MSG_RESULT(no)
- fi
-],[
- AC_MSG_RESULT(no)
-])
diff --git a/ext/snmp/php_snmp.h b/ext/snmp/php_snmp.h
deleted file mode 100644
index 4f7d5f243c..0000000000
--- a/ext/snmp/php_snmp.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
-+----------------------------------------------------------------------+
-| PHP version 4.0 |
-+----------------------------------------------------------------------+
-| Copyright (c) 1997-2001 The PHP Group |
-+----------------------------------------------------------------------+
-| This source file is subject to version 2.02 of the PHP license, |
-| that is bundled with this package in the file LICENSE, and is |
-| available at through the world-wide-web at |
-| http://www.php.net/license/2_02.txt. |
-| If you did not receive a copy of the PHP license and are unable to |
-| obtain it through the world-wide-web, please send a note to |
-| license@php.net so we can mail you a copy immediately. |
-+----------------------------------------------------------------------+
-| Authors: Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
-| Mike Jackson <mhjack@tscnet.com> |
-| Steven Lawrance <slawrance@technologist.com> |
-+----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-#ifndef PHP_SNMP_H
-#define PHP_SNMP_H
-
-#if HAVE_SNMP
-#ifndef DLEXPORT
-#define DLEXPORT
-#endif
-
-extern zend_module_entry snmp_module_entry;
-#define snmp_module_ptr &snmp_module_entry
-
-PHP_MINIT_FUNCTION(snmp);
-PHP_FUNCTION(snmpget);
-PHP_FUNCTION(snmpwalk);
-PHP_FUNCTION(snmprealwalk);
-PHP_FUNCTION(snmp_get_quick_print);
-PHP_FUNCTION(snmp_set_quick_print);
-PHP_FUNCTION(snmpset);
-PHP_MINFO_FUNCTION(snmp);
-#else
-
-#define snmp_module_ptr NULL
-
-#endif /* HAVE_SNMP */
-
-#define phpext_snmp_ptr snmp_module_ptr
-
-#endif /* PHP_SNMP_H */
diff --git a/ext/snmp/snmp.c b/ext/snmp/snmp.c
deleted file mode 100644
index 2a59a92277..0000000000
--- a/ext/snmp/snmp.c
+++ /dev/null
@@ -1,415 +0,0 @@
-/*
-+----------------------------------------------------------------------+
-| PHP version 4.0 |
-+----------------------------------------------------------------------+
-| Copyright (c) 1997-2001 The PHP Group |
-+----------------------------------------------------------------------+
-| This source file is subject to version 2.02 of the PHP license, |
-| that is bundled with this package in the file LICENSE, and is |
-| available at through the world-wide-web at |
-| http://www.php.net/license/2_02.txt. |
-| If you did not receive a copy of the PHP license and are unable to |
-| obtain it through the world-wide-web, please send a note to |
-| license@php.net so we can mail you a copy immediately. |
-+----------------------------------------------------------------------+
-| Authors: Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
-| Mike Jackson <mhjack@tscnet.com> |
-| Steven Lawrance <slawrance@technologist.com> |
-+----------------------------------------------------------------------+
-*/
-/* $Id$ */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "ext/standard/info.h"
-#include "php_snmp.h"
-#include <sys/types.h>
-#ifdef PHP_WIN32
-#include <winsock.h>
-#include <errno.h>
-#include <process.h>
-#include "win32/time.h"
-#else
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#ifndef _OSD_POSIX
-#include <sys/errno.h>
-#else
-#include <errno.h> /* BS2000/OSD uses <errno.h>, not <sys/errno.h> */
-#endif
-#include <netdb.h>
-#endif
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#if HAVE_SNMP
-
-#ifndef __P
-#ifdef __GNUC__
-#define __P(args) args
-#else
-#define __P(args) ()
-#endif
-#endif
-
-#ifdef HAVE_DEFAULT_STORE_H
-#include "default_store.h"
-#endif
-#include "asn1.h"
-#include "snmp_api.h"
-#include "snmp_client.h"
-#include "snmp_impl.h"
-#include "snmp.h"
-#include "parse.h"
-#include "mib.h"
-#include "version.h"
-
-/* ucd-snmp 3.3.1 changed the name of a few #defines... They've been changed back to the original ones in 3.5.3! */
-#ifndef SNMP_MSG_GET
-#define SNMP_MSG_GET GET_REQ_MSG
-#define SNMP_MSG_GETNEXT GETNEXT_REQ_MSG
-#endif
-
-void php_snmp(INTERNAL_FUNCTION_PARAMETERS, int st);
-
-/* constant - can be shared among threads */
-static oid objid_mib[] = {1, 3, 6, 1, 2, 1};
-
-/* {{{ snmp_functions[]
- */
-function_entry snmp_functions[] = {
- PHP_FE(snmpget, NULL)
- PHP_FE(snmpwalk, NULL)
- PHP_FE(snmprealwalk, NULL)
- PHP_FALIAS(snmpwalkoid, snmprealwalk, NULL)
- PHP_FE(snmp_get_quick_print, NULL)
- PHP_FE(snmp_set_quick_print, NULL)
- PHP_FE(snmpset, NULL)
- {NULL,NULL,NULL}
-};
-/* }}} */
-
-/* {{{ snmp_module_entry
- */
-zend_module_entry snmp_module_entry = {
- "snmp",
- snmp_functions,
- PHP_MINIT(snmp),
- NULL,
- NULL,
- NULL,
- PHP_MINFO(snmp),
- STANDARD_MODULE_PROPERTIES
-};
-/* }}} */
-
-#ifdef COMPILE_DL_SNMP
-ZEND_GET_MODULE(snmp)
-#endif
-
-/* THREAD_LS snmp_module php_snmp_module; - may need one of these at some point */
-
-/* {{{ PHP_MINIT_FUNCTION
- */
-PHP_MINIT_FUNCTION(snmp)
-{
- init_mib();
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_MINFO_FUNCTION
- */
-PHP_MINFO_FUNCTION(snmp)
-{
- php_info_print_table_start();
- php_info_print_table_row(2, "UCD-SNMP Support", "enabled");
- php_info_print_table_row(2, "UCD-SNMP Version", VersionInfo);
- php_info_print_table_end();
-}
-/* }}} */
-
-/* {{{ php_snmp
-*
-* Generic SNMP object fetcher
-*
-* st=1 snmpget() - query an agent and return a single value.
-* st=2 snmpwalk() - walk the mib and return a single dimensional array
-* containing the values.
-* st=3 snmprealwalk() and snmpwalkoid() - walk the mib and return an
-* array of oid,value pairs.
-* st=5-8 ** Reserved **
-* st=11 snmpset() - query an agent and set a single value
-*
-*/
-void php_snmp(INTERNAL_FUNCTION_PARAMETERS, int st) {
- zval **a1, **a2, **a3, **a4, **a5, **a6, **a7;
- struct snmp_session session, *ss;
- struct snmp_pdu *pdu=NULL, *response;
- struct variable_list *vars;
- char *objid;
- oid name[MAX_NAME_LEN];
- int name_length;
- int status, count,rootlen=0,gotroot=0;
- oid root[MAX_NAME_LEN];
- char buf[2048];
- char buf2[2048];
- int keepwalking=1;
- long timeout=SNMP_DEFAULT_TIMEOUT;
- long retries=SNMP_DEFAULT_RETRIES;
- int myargc = ZEND_NUM_ARGS();
- char type = (char) 0;
- char *value = (char *) 0;
-
- if (myargc < 3 || myargc > 7 ||
- zend_get_parameters_ex(myargc, &a1, &a2, &a3, &a4, &a5, &a6, &a7) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(a1);
- convert_to_string_ex(a2);
- convert_to_string_ex(a3);
-
- if (st == 11) {
- if (myargc < 5) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(a4);
- convert_to_string_ex(a5);
-
- if(myargc > 5) {
- convert_to_long_ex(a6);
- timeout = (*a6)->value.lval;
- }
-
- if(myargc > 6) {
- convert_to_long_ex(a7);
- retries = (*a7)->value.lval;
- }
-
- type = (*a4)->value.str.val[0];
- value = (*a5)->value.str.val;
- } else {
- if(myargc > 3) {
- convert_to_long_ex(a4);
- timeout = (*a4)->value.lval;
- }
-
- if(myargc > 4) {
- convert_to_long_ex(a5);
- retries = (*a5)->value.lval;
- }
- }
-
- objid = (*a3)->value.str.val;
-
- if (st >= 2) { /* walk */
- rootlen = MAX_NAME_LEN;
- if ( strlen(objid) ) { /* on a walk, an empty string means top of tree - no error */
- if ( read_objid(objid, root, &rootlen) ) {
- gotroot = 1;
- } else {
- php_error(E_WARNING,"Invalid object identifier: %s\n", objid);
- }
- }
- if (gotroot == 0) {
- memmove((char *)root, (char *)objid_mib, sizeof(objid_mib));
- rootlen = sizeof(objid_mib) / sizeof(oid);
- gotroot = 1;
- }
- }
-
- memset(&session, 0, sizeof(struct snmp_session));
-
- session.peername = (*a1)->value.str.val;
- session.version = SNMP_VERSION_1;
- /*
- * FIXME: potential memory leak
- * This is a workaround for an "artifact" (Mike Slifcak)
- * in (at least) ucd-snmp 3.6.1 which frees
- * memory it did not allocate
- */
-#ifdef UCD_SNMP_HACK
- session.community = (u_char *)strdup((*a2)->value.str.val); /* memory freed by SNMP library, strdup NOT estrdup */
-#else
- session.community = (u_char *)(*a2)->value.str.val;
-#endif
- session.community_len = (*a2)->value.str.len;
- session.retries = retries;
- session.timeout = timeout;
-
- session.authenticator = NULL;
- snmp_synch_setup(&session);
-
- if ((ss = snmp_open(&session)) == NULL) {
- php_error(E_WARNING,"Could not open snmp\n");
- RETURN_FALSE;
- }
-
- if (st >= 2) {
- memmove((char *)name, (char *)root, rootlen * sizeof(oid));
- name_length = rootlen;
- if (array_init(return_value) == FAILURE) {
- php_error(E_WARNING, "Cannot prepare result array");
- RETURN_FALSE;
- }
- }
-
- while(keepwalking) {
- keepwalking=0;
- if (st == 1) {
- pdu = snmp_pdu_create(SNMP_MSG_GET);
- name_length = MAX_NAME_LEN;
- if ( !read_objid(objid, name, &name_length) ) {
- php_error(E_WARNING,"Invalid object identifier: %s\n", objid);
- RETURN_FALSE;
- }
- snmp_add_null_var(pdu, name, name_length);
- } else if (st == 11) {
- pdu = snmp_pdu_create(SNMP_MSG_SET);
- if (snmp_add_var(pdu, name, name_length, type, value)) {
- php_error(E_WARNING,"Could not add variable: %s\n", name);
- RETURN_FALSE;
- }
- } else if (st >= 2) {
- pdu = snmp_pdu_create(SNMP_MSG_GETNEXT);
- snmp_add_null_var(pdu, name, name_length);
- }
-
-retry:
- status = snmp_synch_response(ss, pdu, &response);
- if (status == STAT_SUCCESS) {
- if (response->errstat == SNMP_ERR_NOERROR) {
- for (vars = response->variables; vars; vars = vars->next_variable) {
- if (st >= 2 && st != 11 &&
- (vars->name_length < rootlen || memcmp(root, vars->name, rootlen * sizeof(oid)))) {
- continue; /* not part of this subtree */
- }
-
- if (st != 11) {
- sprint_value(buf,vars->name, vars->name_length, vars);
- }
-#if 0
- Debug("snmp response is: %s\n",buf);
-#endif
- if (st == 1) {
- RETVAL_STRING(buf,1);
- } else if (st == 2) {
- add_next_index_string(return_value,buf,1); /* Add to returned array */
- } else if (st == 3) {
- sprint_objid(buf2, vars->name, vars->name_length);
- add_assoc_string(return_value,buf2,buf,1);
- }
- if (st >= 2 && st != 11) {
- if (vars->type != SNMP_ENDOFMIBVIEW &&
- vars->type != SNMP_NOSUCHOBJECT && vars->type != SNMP_NOSUCHINSTANCE) {
- memmove((char *)name, (char *)vars->name,vars->name_length * sizeof(oid));
- name_length = vars->name_length;
- keepwalking = 1;
- }
- }
- }
- } else {
- if (st != 2 || response->errstat != SNMP_ERR_NOSUCHNAME) {
- php_error(E_WARNING,"Error in packet.\nReason: %s\n", snmp_errstring(response->errstat));
- if (response->errstat == SNMP_ERR_NOSUCHNAME) {
- for (count=1, vars = response->variables; vars && count != response->errindex;
- vars = vars->next_variable, count++);
- if (vars) {
- sprint_objid(buf,vars->name, vars->name_length);
- }
- php_error(E_WARNING,"This name does not exist: %s\n",buf);
- }
- if (st == 1) {
- if ((pdu = snmp_fix_pdu(response, SNMP_MSG_GET)) != NULL) {
- goto retry;
- }
- } else if (st == 11) {
- if ((pdu = snmp_fix_pdu(response, SNMP_MSG_SET)) != NULL) {
- goto retry;
- }
- } else if (st >= 2) {
- if ((pdu = snmp_fix_pdu(response, SNMP_MSG_GETNEXT)) != NULL) {
- goto retry;
- }
- }
- RETURN_FALSE;
- }
- }
- } else if (status == STAT_TIMEOUT) {
- php_error(E_WARNING,"No Response from %s\n", (*a1)->value.str.val);
- RETURN_FALSE;
- } else { /* status == STAT_ERROR */
- php_error(E_WARNING,"An error occurred, Quitting...\n");
- RETURN_FALSE;
- }
- if (response) {
- snmp_free_pdu(response);
- }
- } /* keepwalking */
- snmp_close(ss);
-}
-/* }}} */
-
-/* {{{ proto string snmpget(string host, string community, string object_id [, int timeout [, int retries]])
- Fetch a SNMP object */
-PHP_FUNCTION(snmpget) {
- php_snmp(INTERNAL_FUNCTION_PARAM_PASSTHRU,1);
-}
-/* }}} */
-
-/* {{{ proto array snmpwalk(string host, string community, string object_id [, int timeout [, int retries]])
- Return all objects under the specified object id */
-PHP_FUNCTION(snmpwalk) {
- php_snmp(INTERNAL_FUNCTION_PARAM_PASSTHRU,2);
-}
-/* }}} */
-
-/* {{{ proto array snmprealwalk(string host, string community, string object_id [, int timeout [, int retries]])
- Return all objects including their respective object id withing the specified one */
-PHP_FUNCTION(snmprealwalk) {
- php_snmp(INTERNAL_FUNCTION_PARAM_PASSTHRU,3);
-}
-/* }}} */
-
-/* {{{ proto bool snmp_get_quick_print(void)
- Return the current status of quick_print */
-PHP_FUNCTION(snmp_get_quick_print) {
- RETURN_LONG(snmp_get_quick_print() ? 1 : 0);
-}
-/* }}} */
-
-/* {{{ proto void snmp_set_quick_print(int quick_print)
- Return all objects including their respective object id withing the specified one */
-PHP_FUNCTION(snmp_set_quick_print) {
- zval **a1;
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &a1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(a1);
- snmp_set_quick_print((int)(*a1)->value.lval);
-}
-/* }}} */
-
-/* {{{ proto int snmpset(string host, string community, string object_id, string type, mixed value [, int timeout [, int retries]])
- Set the value of a SNMP object */
-PHP_FUNCTION(snmpset) {
- php_snmp(INTERNAL_FUNCTION_PARAM_PASSTHRU,11);
-}
-/* }}} */
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/snmp/snmp.dsp b/ext/snmp/snmp.dsp
deleted file mode 100644
index ed016a4257..0000000000
--- a/ext/snmp/snmp.dsp
+++ /dev/null
@@ -1,109 +0,0 @@
-# Microsoft Developer Studio Project File - Name="snmp" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=snmp - Win32 Release_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "snmp.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "snmp.mak" CFG="snmp - Win32 Release_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "snmp - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "snmp - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "snmp - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\..\TSRM" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_SNMP" /D ZTS=1 /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D ZEND_DEBUG=0 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SNMP_EXPORTS" /D "COMPILE_DL_SNMP" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_SNMP=1 /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x406 /d "NDEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib /nologo /dll /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib libsnmp.lib wsock32.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_snmp.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
-
-!ELSEIF "$(CFG)" == "snmp - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_SNMP" /D ZTS=1 /YX /FD /c
-# ADD CPP /nologo /MDd /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SNMP_EXPORTS" /D "COMPILE_DL_SNMP" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_SNMP=1 /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x406 /d "NDEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib /nologo /dll /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts_debug.lib libsnmp.lib wsock32.lib /nologo /dll /machine:I386 /out:"..\..\Debug_TS/php_snmp.dll" /libpath:"..\..\Debug_TS"
-
-!ENDIF
-
-# Begin Target
-
-# Name "snmp - Win32 Release_TS"
-# Name "snmp - Win32 Debug_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\snmp.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_snmp.h
-# End Source File
-# End Group
-# End Target
-# End Project
diff --git a/ext/snmp/winsnmp.c b/ext/snmp/winsnmp.c
deleted file mode 100644
index ad590e47c7..0000000000
--- a/ext/snmp/winsnmp.c
+++ /dev/null
@@ -1,243 +0,0 @@
-/*
-Created from the snmputil sample in the Microsoft SDK for NT
-*/
-
-#include "php.h"
-#if COMPILE_DL
-#include "../phpdl.h"
-#include "functions/dl.h"
-#endif
-#include "php_snmp.h"
-#include <sys/types.h>
-
-#include <windows.h>
-
-#include <stdio.h>
-#include <string.h>
-#include <malloc.h>
-
-#if HAVE_SNMP
-
-#include <snmp.h>
-#include <mgmtapi.h>
-
-/* {{{ snmp_functions[]
- */
-function_entry snmp_functions[] = {
- {"snmpget", php3_snmpget, NULL},
- {"snmpwalk", php3_snmpwalk, NULL},
- {NULL,NULL,NULL}
-};
-/* }}} */
-
-/* {{{ snmp_module_entry
- */
-zend_module_entry snmp_module_entry = {
- "SNMP",snmp_functions,NULL,NULL,NULL,NULL,NULL,0,0,0,NULL
-};
-/* }}} */
-
-#if COMPILE_DL
-DLEXPORT zend_module_entry *get_module() { return &snmp_module_entry; }
-#endif
-
-#define GET 1
-#define WALK 2
-#define GETNEXT 3
-
-#define TIMEOUT 6000 /* milliseconds */
-#define RETRIES 3
-
-/* {{{ _php_snmp
- */
-void _php_snmp(INTERNAL_FUNCTION_PARAMETERS, int st) {
- pval *a1, *a2, *a3;
- INT operation;
- LPSTR agent;
- LPSTR community;
- RFC1157VarBindList variableBindings;
- LPSNMP_MGR_SESSION session;
-
- INT timeout = TIMEOUT;
- INT retries = RETRIES;
-
- BYTE requestType;
- AsnInteger errorStatus;
- AsnInteger errorIndex;
- AsnObjectIdentifier oid;
- char *chkPtr = NULL;
-
- if (getParameters(ht, 3, &a1, &a2, &a3) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string(a1);
- convert_to_string(a2);
- convert_to_string(a3);
-
- agent=a1->value.str.val;
- community=a2->value.str.val;
- operation=st;
- SnmpMgrStrToOid(a3->value.str.val, &oid);
-
-/*
- I've limited this to only one oid, but we can create a
- list of oid's here, and expand the function to take multiple
- oid's
-*/
- variableBindings.list->name = oid;
- variableBindings.list->value.asnType = ASN_NULL;
- variableBindings.len = 1;
-
-/* Establish a SNMP session to communicate with the remote agent. The
- community, communications timeout, and communications retry count
- for the session are also required.
-*/
- if ((session = SnmpMgrOpen(agent, community, timeout, retries)) == NULL){
- php_error(E_WARNING,"error on SnmpMgrOpen %d\n", GetLastError());
- }
-
- /* Determine and perform the requested operation.*/
- if (operation == GET || operation == GETNEXT){
- /* Get and GetNext are relatively simple operations to perform.
- Simply initiate the request and process the result and/or
- possible error conditions. */
-
- if (operation == GET){
- requestType = ASN_RFC1157_GETREQUEST;
- } else {
- requestType = ASN_RFC1157_GETNEXTREQUEST;
- }
-
- /* Request that the API carry out the desired operation.*/
- if (!SnmpMgrRequest(session, requestType, &variableBindings,
- &errorStatus, &errorIndex)){
- /* The API is indicating an error. */
- php_error(E_WARNING,"error on SnmpMgrRequest %d\n", GetLastError());
- } else {
- /* The API succeeded, errors may be indicated from the remote
- agent. */
- if (errorStatus > 0){
- php_error(E_WARNING,"Error: errorStatus=%d, errorIndex=%d\n",
- errorStatus, errorIndex);
- } else {
- /* Display the resulting variable bindings.*/
- UINT i;
- char *str = NULL;
-
- for(i=0; i < variableBindings.len; i++)
- {
- SnmpMgrOidToStr(&variableBindings.list[i].name, &str);
- php_printf("Variable = %s\n", str);
- if (str) SNMP_free(str);
-
- php_printf("Value = ");
- SnmpUtilPrintAsnAny(&variableBindings.list[i].value);
-
- php_printf("\n");
- } /* end for() */
- }
- }
-
- /* Free the variable bindings that have been allocated.*/
- SnmpUtilVarBindListFree(&variableBindings);
- }
- else if (operation == WALK)
- {
- /* Walk is a common term used to indicate that all MIB variables
- under a given OID are to be traversed and displayed. This is
- a more complex operation requiring tests and looping in addition
- to the steps for get/getnext above. */
- AsnObjectIdentifier root;
- AsnObjectIdentifier tempOid;
-
- SnmpUtilOidCpy(&root, &variableBindings.list[0].name);
- requestType = ASN_RFC1157_GETNEXTREQUEST;
-
- while(1)
- {
- if (!SnmpMgrRequest(session, requestType, &variableBindings,
- &errorStatus, &errorIndex)){
- /* The API is indicating an error.*/
- php_error(E_WARNING,"error on SnmpMgrRequest %d\n", GetLastError());
- break;
- }
- else
- {
- /* The API succeeded, errors may be indicated from the remote
- agent.
- Test for end of subtree or end of MIB. */
- if (errorStatus == SNMP_ERRORSTATUS_NOSUCHNAME ||
- SnmpUtilOidNCmp(&variableBindings.list[0].name,
- &root, root.idLength))
- {
- PUTS("End of MIB subtree.\n\n");
- break;
- }
-
- /* Test for general error conditions or sucesss. */
- if (errorStatus > 0){
- php_error(E_ERROR,"Error: errorStatus=%d, errorIndex=%d \n",
- errorStatus, errorIndex);
- break;
- }
- else
- {
- /* Display resulting variable binding for this iteration. */
- char *str = NULL;
-
- SnmpMgrOidToStr(&variableBindings.list[0].name, &str);
- php_printf("Variable = %s\n", str);
- if (str) SNMP_free(str);
-
- php_printf("Value = ");
- SnmpUtilPrintAsnAny(&variableBindings.list[0].value);
-
- php_printf("\n");
- }
- } /* end if () */
- /* Prepare for the next iteration. Make sure returned oid is
- preserved and the returned value is freed.
- */
- SnmpUtilOidCpy(&tempOid, &variableBindings.list[0].name);
- SnmpUtilVarBindFree(&variableBindings.list[0]);
- SnmpUtilOidCpy(&variableBindings.list[0].name, &tempOid);
- variableBindings.list[0].value.asnType = ASN_NULL;
- SnmpUtilOidFree(&tempOid);
- } /* end while() */
- /* Free the variable bindings that have been allocated.*/
- SnmpUtilVarBindListFree(&variableBindings);
- SnmpUtilOidFree(&root);
- } /* end if (operation) */
-
-
- /* Close SNMP session with the remote agent.*/
- if (!SnmpMgrClose(session)){
- php_error(E_WARNING,"error on SnmpMgrClose %d\n", GetLastError());
- }
-}
-/* }}} */
-
-/* {{{ php3_snmpget
- */
-DLEXPORT void php3_snmpget(INTERNAL_FUNCTION_PARAMETERS) {
- _php_snmp(INTERNAL_FUNCTION_PARAM_PASSTHRU,1);
-}
-/* }}} */
-
-/* {{{ php3_snmpwalk
- */
-DLEXPORT void php3_snmpwalk(INTERNAL_FUNCTION_PARAMETERS) {
- _php_snmp(INTERNAL_FUNCTION_PARAM_PASSTHRU,2);
-}
-/* }}} */
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/sockets/CREDITS b/ext/sockets/CREDITS
deleted file mode 100644
index cd36000982..0000000000
--- a/ext/sockets/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-Sockets
-Chris Vandomelen, Sterling Hughes, Daniel Beulshausen
diff --git a/ext/sockets/EXPERIMENTAL b/ext/sockets/EXPERIMENTAL
deleted file mode 100644
index 6443e99646..0000000000
--- a/ext/sockets/EXPERIMENTAL
+++ /dev/null
@@ -1,5 +0,0 @@
-this extension is experimental,
-its functions may change their names
-or move to extension all together
-so do not rely to much on them
-you have been warned!
diff --git a/ext/sockets/Makefile.in b/ext/sockets/Makefile.in
deleted file mode 100644
index acfca2cd39..0000000000
--- a/ext/sockets/Makefile.in
+++ /dev/null
@@ -1,7 +0,0 @@
-# $Id$
-
-LTLIBRARY_NAME = libsockets.la
-LTLIBRARY_SOURCES = sockets.c
-LTLIBRARY_SHARED_NAME = sockets.la
-
-include $(top_srcdir)/build/dynlib.mk
diff --git a/ext/sockets/config.m4 b/ext/sockets/config.m4
deleted file mode 100644
index af99809231..0000000000
--- a/ext/sockets/config.m4
+++ /dev/null
@@ -1,14 +0,0 @@
-dnl $Id$
-dnl config.m4 for extension sockets
-
-PHP_ARG_ENABLE(sockets, whether to enable sockets support,
-[ --enable-sockets Enable sockets support])
-
-if test "$PHP_SOCKETS" != "no"; then
-
- AC_CHECK_FUNCS(hstrerror)
- AC_CHECK_HEADERS(netdb.h netinet/tcp.h sys/un.h errno.h)
- AC_DEFINE(HAVE_SOCKETS, 1, [ ])
-
- PHP_EXTENSION(sockets, $ext_shared)
-fi
diff --git a/ext/sockets/php_sockets.h b/ext/sockets/php_sockets.h
deleted file mode 100644
index 03f435e9b3..0000000000
--- a/ext/sockets/php_sockets.h
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Chris Vandomelen <chrisv@b0rked.dhs.org> |
- | Sterling Hughes <sterling@php.net> |
- | |
- | WinSock: Daniel Beulshausen <daniel@php4win.de> |
- +----------------------------------------------------------------------+
- */
-
-#ifndef PHP_SOCKETS_H
-#define PHP_SOCKETS_H
-
-/* $Id$ */
-
-#if HAVE_SOCKETS
-
-extern zend_module_entry sockets_module_entry;
-#define phpext_sockets_ptr &sockets_module_entry
-
-#ifdef PHP_WIN32
-#define PHP_SOCKETS_API __declspec(dllexport)
-#else
-#define PHP_SOCKETS_API
-#endif
-
-PHP_MINIT_FUNCTION(sockets);
-PHP_MINFO_FUNCTION(sockets);
-
-PHP_FUNCTION(socket_fd_alloc);
-PHP_FUNCTION(socket_fd_free);
-PHP_FUNCTION(socket_fd_set);
-PHP_FUNCTION(socket_fd_isset);
-PHP_FUNCTION(socket_fd_clear);
-PHP_FUNCTION(socket_fd_zero);
-PHP_FUNCTION(socket_iovec_alloc);
-PHP_FUNCTION(socket_iovec_free);
-PHP_FUNCTION(socket_iovec_set);
-PHP_FUNCTION(socket_iovec_fetch);
-PHP_FUNCTION(socket_iovec_add);
-PHP_FUNCTION(socket_iovec_delete);
-PHP_FUNCTION(socket_select);
-PHP_FUNCTION(socket_create_listen);
-PHP_FUNCTION(socket_create_pair);
-PHP_FUNCTION(socket_accept);
-PHP_FUNCTION(socket_set_nonblock);
-PHP_FUNCTION(socket_listen);
-PHP_FUNCTION(socket_close);
-PHP_FUNCTION(socket_write);
-PHP_FUNCTION(socket_read);
-PHP_FUNCTION(socket_getsockname);
-PHP_FUNCTION(socket_getpeername);
-PHP_FUNCTION(socket_create);
-PHP_FUNCTION(socket_connect);
-PHP_FUNCTION(socket_strerror);
-PHP_FUNCTION(socket_bind);
-PHP_FUNCTION(socket_recv);
-PHP_FUNCTION(socket_send);
-PHP_FUNCTION(socket_recvfrom);
-PHP_FUNCTION(socket_sendto);
-PHP_FUNCTION(socket_recvmsg);
-PHP_FUNCTION(socket_sendmsg);
-PHP_FUNCTION(socket_readv);
-PHP_FUNCTION(socket_writev);
-PHP_FUNCTION(socket_getopt);
-PHP_FUNCTION(socket_setopt);
-PHP_FUNCTION(socket_shutdown);
-
-typedef struct php_iovec {
- struct iovec *iov_array;
- unsigned int count;
-} php_iovec_t;
-
-typedef struct {
-#ifdef PHP_WIN32
- SOCKET socket;
-#else
- int socket;
-#endif
- int type;
-} php_socket;
-
-typedef struct {
- zend_bool use_system_read;
-} php_sockets_globals;
-
-
-#ifdef ZTS
-#define SOCKETSG(v) (sockets_globals->v)
-#define SOCKETSLS_FETCH() php_sockets_globals *sockets_globals = ts_resource(sockets_globals_id)
-#else
-#define SOCKETSG(v) (sockets_globals.v)
-#define SOCKETSLS_FETCH()
-#endif
-
-#else
-#define phpext_sockets_ptr NULL
-#endif
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
-
diff --git a/ext/sockets/php_sockets_win.c b/ext/sockets/php_sockets_win.c
deleted file mode 100644
index 5956781310..0000000000
--- a/ext/sockets/php_sockets_win.c
+++ /dev/null
@@ -1,175 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997, 1998, 1999, 2000 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Chris Vandomelen <chrisv@b0rked.dhs.org> |
- | Sterling Hughes <sterling@php.net> |
- | |
- | WinSock: Daniel Beulshausen <daniel@php4win.de> |
- +----------------------------------------------------------------------+
- */
-
-#ifdef PHP_WIN32
-
-#include <stdio.h>
-#include <fcntl.h>
-
-#include "php.h"
-#include "php_sockets.h"
-#include "php_sockets_win.h"
-
-ssize_t readv(SOCKET sock, const struct iovec *iov, int iovcnt) {
- size_t bytes, remain, len, pos = 0;
- ssize_t retval;
- int i;
- char *buffer = NULL;
-
- for(bytes=0, i=0; i<iovcnt; i++) {
- bytes += iov[i].iov_len;
- }
-
- buffer = (char*)emalloc(bytes);
- if (buffer == NULL) {
- return -1;
- }
-
- retval = recv(sock, buffer, bytes, 0);
- if(retval < 0) {
- efree(buffer);
- return retval;
- }
-
- remain = bytes = (size_t) retval;
-
- for(i=0; i<iovcnt; i++) {
- len = (iov[i].iov_len < remain) ? iov[i].iov_len : remain;
- memcpy(iov[i].iov_base, buffer+pos, len);
- pos += len;
- remain -= len;
- }
-
- efree(buffer);
- return bytes;
-}
-
-ssize_t writev(SOCKET sock, const struct iovec *iov, int iovcnt) {
- size_t bytes, pos = 0;
- ssize_t retval;
- int i;
- char *buffer = NULL;
-
- for(bytes=0, i=0; i<iovcnt; i++) {
- bytes += iov[i].iov_len;
- }
-
- buffer = (char*)emalloc(bytes);
-
- if(buffer == NULL) {
- return -1;
- }
-
- for(i=0; i<iovcnt; i++) {
- memcpy(buffer+pos, iov[i].iov_base, iov[i].iov_len);
- pos += iov[i].iov_len;
- }
-
- retval = send(sock, buffer, bytes, 0);
- efree(buffer);
-
- return retval;
-}
-
-ssize_t recvmsg(SOCKET sock, struct msghdr *msg, int flags) {
- set_errno(WSAEOPNOTSUPP);
- return -1;
-}
-
-ssize_t sendmsg(SOCKET sock, struct msghdr *msg, int flags) {
- set_errno(WSAEOPNOTSUPP);
- return -1;
-}
-
-int socketpair(int domain, int type, int protocol, SOCKET sock[2]) {
- struct sockaddr_in address;
- SOCKET redirect;
- int size = sizeof(address);
-
- if(domain != AF_INET) {
- set_errno(WSAENOPROTOOPT);
- return -1;
- }
-
-
- sock[0] = socket(domain, type, protocol);
- address.sin_addr.s_addr = INADDR_ANY;
- address.sin_family = AF_INET;
- address.sin_port = 0;
-
- bind(sock[0], (struct sockaddr*)&address, sizeof(address));
- if(getsockname(sock[0], (struct sockaddr *)&address, &size) != 0) {
-
- }
-
- listen(sock[0], 2);
- sock[1] = socket(domain, type, protocol);
- address.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
-
- connect(sock[1], (struct sockaddr*)&address, sizeof(address));
- redirect = accept(sock[0],(struct sockaddr*)&address, &size);
-
- close(sock[0]);
- sock[0] = redirect;
-
- if(sock[0] == INVALID_SOCKET ) {
- close(sock[0]);
- close(sock[1]);
- set_errno(WSAECONNABORTED);
- return -1;
- }
-
- return 0;
-}
-
-int inet_aton(const char *cp, struct in_addr *inp) {
- inp->s_addr = inet_addr(cp);
-
- if (inp->s_addr == INADDR_NONE) {
- return 0;
- }
-
- return 1;
-}
-
-int fcntl(int fd, int cmd, ...) {
- va_list va;
- int retval;
-
- va_start(va, cmd);
-
- switch(cmd) {
- case F_GETFL:
- case F_SETFD:
- case F_GETFD:
- default:
- retval = -1;
- break;
-
- case F_SETFL:
- retval = ioctlsocket(fd, cmd, va_arg(va, int*));
- break;
- }
-
- va_end(va);
- return retval;
-}
-#endif \ No newline at end of file
diff --git a/ext/sockets/php_sockets_win.h b/ext/sockets/php_sockets_win.h
deleted file mode 100644
index cbb225b911..0000000000
--- a/ext/sockets/php_sockets_win.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997, 1998, 1999, 2000 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Chris Vandomelen <chrisv@b0rked.dhs.org> |
- | Sterling Hughes <sterling@php.net> |
- | |
- | WinSock: Daniel Beulshausen <daniel@php4win.de> |
- +----------------------------------------------------------------------+
- */
-
-#ifdef PHP_WIN32
-
-#define F_SETFL 0
-#define F_GETFL 1
-#define F_SETFD 2
-#define F_GETFD 3
-
-#define O_NONBLOCK FIONBIO
-
-#define EPROTONOSUPPORT WSAEPROTONOSUPPORT
-#define ECONNRESET WSAECONNRESET
-
-#ifdef errno
-#undef errno
-#endif
-
-#define errno WSAGetLastError()
-#define h_errno WSAGetLastError()
-#define set_errno(a) WSASetLastError(a)
-#define set_h_errno(a) WSASetLastError(a)
-#define close(a) closesocket(a)
-#define CMSG_DATA(cmsg) ((cmsg)->cmsg_data)
-#define IS_INVALID_SOCKET(a) (a->socket == INVALID_SOCKET)
-
-typedef long ssize_t;
-
-struct sockaddr_un {
- short sun_family;
- char sun_path[108];
-};
-
-struct iovec {
- char * iov_base;
- int iov_len;
-};
-
-struct msghdr {
- void* msg_name;
- socklen_t msg_namelen;
- struct iovec* msg_iov;
- int msg_iovlen;
- void* msg_control;
- socklen_t msg_controllen;
- int msg_flags;
-};
-
-struct cmsghdr {
- socklen_t cmsg_len;
- int cmsg_level;
- int cmsg_type;
- unsigned char cmsg_data[];
-};
-
-ssize_t readv(SOCKET sock, const struct iovec *iov, int iovcnt);
-ssize_t writev(SOCKET sock, const struct iovec *iov, int iovcnt);
-ssize_t recvmsg(SOCKET sock, struct msghdr *msg, int flags);
-ssize_t sendmsg(SOCKET sock, struct msghdr *msg, int flags);
-int socketpair(int domain, int type, int protocol, SOCKET sock[2]);
-int inet_aton(const char *cp, struct in_addr *inp);
-int fcntl(int fd, int cmd, ...);
-
-#endif
diff --git a/ext/sockets/sockets.c b/ext/sockets/sockets.c
deleted file mode 100644
index 3c038aeef5..0000000000
--- a/ext/sockets/sockets.c
+++ /dev/null
@@ -1,1964 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Chris Vandomelen <chrisv@b0rked.dhs.org> |
- | Sterling Hughes <sterling@php.net> |
- | |
- | WinSock: Daniel Beulshausen <daniel@php4win.de> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-
-#if HAVE_SOCKETS
-
-#define _XOPEN_SOURCE_EXTENDED
-#define _XPG4_2
-#define __EXTENSIONS__
-
-#ifndef __PRAGMA_REDEFINE_EXTNAME
-#define __PRAGMA_REDEFINE_EXTNAME
-#endif
-
-#include "ext/standard/info.h"
-#include "php_ini.h"
-
-#ifndef PHP_WIN32
-# include "php_sockets.h"
-# include <sys/types.h>
-# include <sys/socket.h>
-# include <netdb.h>
-# include <netinet/in.h>
-# include <netinet/tcp.h>
-# include <sys/un.h>
-# include <arpa/inet.h>
-# include <sys/time.h>
-# include <unistd.h>
-# include <errno.h>
-# include <fcntl.h>
-# include <signal.h>
-# include <sys/uio.h>
-# define IS_INVALID_SOCKET(a) (a->socket < 0)
-# define set_errno(a) (errno = a)
-# define set_h_errno(a) (h_errno = a)
-#else /* windows */
-# include <winsock.h>
-# include "php_sockets.h"
-# include "php_sockets_win.h"
-#endif
-
-#ifdef ZTS
-int sockets_globals_id;
-#else
-php_sockets_globals sockets_globals;
-#endif
-
-
-#ifndef MSG_WAITALL
-#ifdef LINUX
-#define MSG_WAITALL 0x00000100
-#else
-#define MSG_WAITALL 0x00000000
-#endif
-#endif
-
-#ifndef SUN_LEN
-#define SUN_LEN(su) (sizeof(*(su)) - sizeof((su)->sun_path) + strlen((su)->sun_path))
-#endif
-
-#define PHP_NORMAL_READ 0x0001
-#define PHP_BINARY_READ 0x0002
-#define PHP_SYSTEM_READ 0x0004
-
-typedef struct {
- unsigned char info[256];
-} php_sockaddr_storage;
-
-
-static int le_iov, le_destroy, le_socket;
-
-static unsigned char second_and_third_args_force_ref[] =
-{3, BYREF_NONE, BYREF_FORCE, BYREF_FORCE};
-
-static unsigned char second_fifth_and_sixth_args_force_ref[] =
-{6, BYREF_NONE, BYREF_FORCE, BYREF_NONE, BYREF_NONE, BYREF_FORCE, BYREF_FORCE};
-
-static unsigned char third_through_seventh_args_force_ref[] =
-{7, BYREF_NONE, BYREF_NONE, BYREF_FORCE, BYREF_FORCE, BYREF_FORCE, BYREF_FORCE, BYREF_FORCE};
-
-/* {{{ sockets_functions[]
- */
-function_entry sockets_functions[] = {
- PHP_FE(socket_fd_alloc, NULL)
- PHP_FE(socket_fd_free, NULL)
- PHP_FE(socket_fd_set, NULL)
- PHP_FE(socket_fd_isset, NULL)
- PHP_FE(socket_fd_clear, NULL)
- PHP_FE(socket_fd_zero, NULL)
- PHP_FE(socket_iovec_alloc, NULL)
- PHP_FE(socket_iovec_free, NULL)
- PHP_FE(socket_iovec_set, NULL)
- PHP_FE(socket_iovec_fetch, NULL)
- PHP_FE(socket_iovec_add, NULL)
- PHP_FE(socket_iovec_delete, NULL)
- PHP_FE(socket_select, NULL)
- PHP_FE(socket_create, NULL)
- PHP_FE(socket_create_listen, NULL)
- PHP_FE(socket_create_pair, NULL)
- PHP_FE(socket_accept, NULL)
- PHP_FE(socket_set_nonblock, NULL)
- PHP_FE(socket_listen, NULL)
- PHP_FE(socket_close, NULL)
- PHP_FE(socket_write, NULL)
- PHP_FE(socket_read, NULL)
- PHP_FE(socket_getsockname, second_and_third_args_force_ref)
- PHP_FE(socket_getpeername, second_and_third_args_force_ref)
- PHP_FE(socket_connect, NULL)
- PHP_FE(socket_strerror, NULL)
- PHP_FE(socket_bind, NULL)
- PHP_FE(socket_recv, NULL)
- PHP_FE(socket_send, NULL)
- PHP_FE(socket_recvfrom, second_fifth_and_sixth_args_force_ref)
- PHP_FE(socket_sendto, NULL)
- PHP_FE(socket_recvmsg, third_through_seventh_args_force_ref)
- PHP_FE(socket_sendmsg, NULL)
- PHP_FE(socket_readv, NULL)
- PHP_FE(socket_writev, NULL)
- PHP_FE(socket_getopt, NULL)
- PHP_FE(socket_setopt, NULL)
- PHP_FE(socket_shutdown, NULL)
- {NULL, NULL, NULL}
-};
-/* }}} */
-
-zend_module_entry sockets_module_entry = {
- "sockets",
- sockets_functions,
- PHP_MINIT(sockets),
- NULL,
- NULL,
- NULL,
- PHP_MINFO(sockets),
- STANDARD_MODULE_PROPERTIES
-};
-
-
-#ifdef COMPILE_DL_SOCKETS
-ZEND_GET_MODULE(sockets)
-#endif
-
-/* this should be mutex'ed */
-volatile int inet_ntoa_lock = 0;
-
-static void destroy_fd_sets(zend_rsrc_list_entry *rsrc)
-{
- fd_set *set = (fd_set*)rsrc->ptr;
- efree(set);
-}
-
-static void destroy_iovec(zend_rsrc_list_entry *rsrc)
-{
- unsigned int i;
- php_iovec_t *iov = (php_iovec_t*)rsrc->ptr;
-
- if (iov->count && iov->iov_array) {
- for (i = 0; i < iov->count; i++) {
- efree(iov->iov_array[i].iov_base);
- }
-
- efree(iov->iov_array);
- efree(iov);
- }
-}
-
-static void destroy_socket(zend_rsrc_list_entry *rsrc)
-{
- php_socket *php_sock = (php_socket*)rsrc->ptr;
-
- close(php_sock->socket);
- efree(php_sock);
-}
-
-static php_socket *open_listen_sock(int port)
-{
- struct sockaddr_in la;
- struct hostent *hp;
- php_socket *php_sock = (php_socket*)emalloc(sizeof(php_socket));
-
-#ifndef PHP_WIN32
- if ((hp = gethostbyname("0.0.0.0")) == NULL) {
-#else
- if ((hp = gethostbyname("localhost")) == NULL) {
-#endif
- efree(php_sock);
- return NULL;
- }
-
- memcpy((char *)&la.sin_addr, hp->h_addr, hp->h_length);
- la.sin_family = hp->h_addrtype;
- la.sin_port = htons((unsigned short)port);
-
- php_sock->socket = socket(AF_INET, SOCK_STREAM, 0);
- php_sock->type = AF_INET;
- if (IS_INVALID_SOCKET(php_sock)) {
- efree(php_sock);
- return NULL;
- }
- if ((bind(php_sock->socket, (struct sockaddr *)&la, sizeof(la)) != 0)) {
- efree(php_sock);
- return NULL;
- }
- listen(php_sock->socket, 128);
- return php_sock;
-}
-
-static php_socket *accept_connect(php_socket *php_sock, struct sockaddr *la)
-{
- int m;
- php_socket *retval = (php_socket*)emalloc(sizeof(php_socket));
-
- m = sizeof(*la);
-
- retval->socket = accept(php_sock->socket, la, &m);
- if (IS_INVALID_SOCKET(retval)) {
- efree(retval);
- return NULL;
- }
- return retval;
-}
-
-/* {{{ php_read -- wrapper around read() so that it only reads to a \r or \n. */
-int php_read(int socket, void *buf, int maxlen)
-{
- int m = 0, n = 0;
- int no_read = 0;
- int nonblock = 0;
- char *t = (char *) buf;
-
- m = fcntl(socket, F_GETFL);
- if (m < 0) {
- return m;
- }
-
- nonblock = (m & O_NONBLOCK);
- m = 0;
-
- set_errno(0);
-
- while (*t != '\n' && *t != '\r' && n < maxlen) {
- if (m > 0) {
- t++;
- n++;
- } else if (m == 0) {
- no_read++;
- if (nonblock && no_read >= 2) {
- return n;
- /* The first pass, m always is 0, so no_read becomes 1
- * in the first pass. no_read becomes 2 in the second pass,
- * and if this is nonblocking, we should return.. */
- }
-
- if (no_read > 200) {
- set_errno(ECONNRESET);
- return -1;
- }
- }
-
- if (n < maxlen) {
- m = read(socket, (void *) t, 1);
- }
-
- if (errno != 0 && errno != ESPIPE && errno != EAGAIN) {
- return -1;
- }
-
- set_errno(0);
- }
-
- if (n < maxlen) {
- n++;
- /* The only reasons it makes it to here is
- * if '\n' or '\r' are encountered. So, increase
- * the return by 1 to make up for the lack of the
- * '\n' or '\r' in the count (since read() takes
- * place at the end of the loop..) */
- }
-
- return n;
-}
-/* }}} */
-
-/* {{{ PHP_MINIT_FUNCTION
- */
-PHP_MINIT_FUNCTION(sockets)
-{
- struct protoent *pe;
-
- le_socket = zend_register_list_destructors_ex(destroy_socket, NULL, "Socket", module_number);
- le_destroy = zend_register_list_destructors_ex(destroy_fd_sets,NULL, "Socket file descriptor set", module_number);
- le_iov = zend_register_list_destructors_ex(destroy_iovec, NULL, "Socket I/O vector", module_number);
-
- REGISTER_LONG_CONSTANT("AF_UNIX", AF_UNIX, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("AF_INET", AF_INET, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SOCK_STREAM", SOCK_STREAM, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SOCK_DGRAM", SOCK_DGRAM, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SOCK_RAW", SOCK_RAW, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SOCK_SEQPACKET",SOCK_SEQPACKET, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SOCK_RDM", SOCK_RDM, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("MSG_OOB", MSG_OOB, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("MSG_WAITALL", MSG_WAITALL, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("MSG_PEEK", MSG_PEEK, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("MSG_DONTROUTE", MSG_DONTROUTE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SO_DEBUG", SO_DEBUG, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SO_REUSEADDR", SO_REUSEADDR, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SO_KEEPALIVE", SO_KEEPALIVE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SO_DONTROUTE", SO_DONTROUTE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SO_LINGER", SO_LINGER, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SO_BROADCAST", SO_BROADCAST, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SO_OOBINLINE", SO_OOBINLINE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SO_SNDBUF", SO_SNDBUF, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SO_RCVBUF", SO_RCVBUF, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SO_SNDLOWAT", SO_SNDLOWAT, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SO_RCVLOWAT", SO_RCVLOWAT, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SO_SNDTIMEO", SO_SNDTIMEO, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SO_RCVTIMEO", SO_RCVTIMEO, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SO_TYPE", SO_TYPE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SO_ERROR", SO_ERROR, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SOL_SOCKET", SOL_SOCKET, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("PHP_NORMAL_READ", PHP_NORMAL_READ, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("PHP_BINARY_READ", PHP_BINARY_READ, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("PHP_SYSTEM_READ", PHP_SYSTEM_READ, CONST_CS | CONST_PERSISTENT);
-
- if ((pe = getprotobyname("tcp"))) {
- REGISTER_LONG_CONSTANT("SOL_TCP", pe->p_proto, CONST_CS | CONST_PERSISTENT);
- }
-
- if ((pe = getprotobyname("udp"))) {
- REGISTER_LONG_CONSTANT("SOL_UDP", pe->p_proto, CONST_CS | CONST_PERSISTENT);
- }
-
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_MINFO_FUNCTION
- */
-PHP_MINFO_FUNCTION(sockets)
-{
- php_info_print_table_start();
- php_info_print_table_row(2, "Sockets Support", "enabled");
- php_info_print_table_end();
-}
-/* }}} */
-
-/* {{{ proto resource socket_fd_alloc(void)
- Allocates a new file descriptor set */
-PHP_FUNCTION(socket_fd_alloc)
-{
- fd_set *set;
-
- set = emalloc(sizeof *set);
-
- FD_ZERO(set);
-
- ZEND_REGISTER_RESOURCE(return_value, set, le_destroy);
-}
-/* }}} */
-
-/* {{{ proto bool socket_fd_dealloc(resource set)
- Deallocates a file descriptor set */
-PHP_FUNCTION(socket_fd_free)
-{
- zval **arg1;
- fd_set *the_set;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(the_set, fd_set *, arg1, -1, "File descriptor set", le_destroy);
-
- zend_list_delete(Z_RESVAL_PP(arg1));
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool socket_fd_set(resource socket, resource set)
- Adds a file descriptor to a set */
-PHP_FUNCTION(socket_fd_set)
-{
- zval **arg1, **arg2;
- fd_set *the_set;
- php_socket *php_sock;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(php_sock, php_socket*, arg1, -1, "Socket", le_socket);
- ZEND_FETCH_RESOURCE(the_set, fd_set*, arg2, -1, "File descriptor set", le_destroy);
-
- FD_SET(php_sock->socket, the_set);
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool socket_fd_clear(resource socket, resource set)
- Clears a file descriptor from a set */
-PHP_FUNCTION(socket_fd_clear)
-{
- zval **arg1, **arg2;
- fd_set *the_set;
- php_socket *php_sock;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(php_sock, php_socket*, arg1, -1, "Socket", le_socket);
- ZEND_FETCH_RESOURCE(the_set, fd_set *, arg2, -1, "File descriptor set", le_destroy);
-
- FD_CLR(php_sock->socket, the_set);
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool socket_fd_isset(resource socket, resource set)
- Checks to see if a file descriptor is set within the file descrirptor set */
-PHP_FUNCTION(socket_fd_isset)
-{
- zval **arg1, **arg2;
- fd_set *the_set;
- php_socket *php_sock;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(php_sock, php_socket*, arg1, -1, "Socket", le_socket);
- ZEND_FETCH_RESOURCE(the_set, fd_set *, arg2, -1, "File descriptor set", le_destroy);
-
- if (FD_ISSET(php_sock->socket, the_set)) {
- RETURN_TRUE;
- }
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto bool socket_fd_zero(resource set)
- Clears a file descriptor set */
-PHP_FUNCTION(socket_fd_zero)
-{
- zval **arg1;
- fd_set *the_set;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(the_set, fd_set *, arg1, -1, "File descriptor set", le_destroy);
-
- FD_ZERO(the_set);
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int socket_select(int max_sockets, resource read_fd, resource write_fd, resource except_fd, int tv_sec, int tv_usec)
- Runs the select() system call on the sets mentioned with a timeout specified by tv_sec and tv_usec */
-PHP_FUNCTION(socket_select)
-{
- zval **arg1, **arg2, **arg3, **arg4, **arg5, **arg6;
- struct timeval tv;
- fd_set *rfds, *wfds, *xfds;
-
- if (zend_get_parameters_ex(6, &arg1, &arg2, &arg3, &arg4, &arg5, &arg6) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(arg1);
- convert_to_long_ex(arg5);
- convert_to_long_ex(arg6);
- ZEND_FETCH_RESOURCE(rfds, fd_set *, arg2, -1, "File descriptor set", le_destroy);
- ZEND_FETCH_RESOURCE(wfds, fd_set *, arg3, -1, "File descriptor set", le_destroy);
- ZEND_FETCH_RESOURCE(xfds, fd_set *, arg4, -1, "File descriptor set", le_destroy);
- tv.tv_sec = Z_LVAL_PP(arg5);
- tv.tv_usec = Z_LVAL_PP(arg6);
-
- RETURN_LONG(select(Z_LVAL_PP(arg1), rfds, wfds, xfds, &tv));
-}
-/* }}} */
-
-/* {{{ proto mixed socket_create_listen(int port)
- Opens a socket on port to accept connections */
-PHP_FUNCTION(socket_create_listen)
-{
- zval **port;
- php_socket *php_sock;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &port) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(port);
-
- php_sock = open_listen_sock(Z_LVAL_PP(port));
-
- if(php_sock == NULL) {
- php_error(E_WARNING, "unable to create listening socket, %i", errno);
- RETURN_FALSE;
- }
-
- ZEND_REGISTER_RESOURCE(return_value, php_sock, le_socket);
-}
-/* }}} */
-
-/* {{{ proto socket socket_accept(resource socket)
- Accepts a connection on the listening socket fd */
-PHP_FUNCTION(socket_accept)
-{
- zval **arg1;
- php_socket *php_sock, *new_sock;
- struct sockaddr_in sa;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(php_sock, php_socket*, arg1, -1, "Socket", le_socket);
-
- new_sock = accept_connect(php_sock, (struct sockaddr*)&sa);
-
- if(new_sock == NULL) {
- php_error(E_WARNING, "unable to accept connection, %i", errno);
- RETURN_FALSE
- }
-
- ZEND_REGISTER_RESOURCE(return_value, new_sock, le_socket);
-}
-/* }}} */
-
-/* {{{ proto bool socket_set_nonblock(resource socket)
- Sets nonblocking mode for file descriptor fd */
-PHP_FUNCTION(socket_set_nonblock)
-{
- zval **arg1;
- php_socket *php_sock;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(php_sock, php_socket*, arg1, -1, "Socket", le_socket);
-
- if (fcntl(php_sock->socket, F_SETFL, O_NONBLOCK) == 0) {
- RETURN_TRUE;
- }
-
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto bool socket_listen(resource socket, int backlog)
- Sets the maximum number of connections allowed to be waited for on the socket specified by fd */
-PHP_FUNCTION(socket_listen)
-{
- zval **arg1, **arg2;
- php_socket *php_sock;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(php_sock, php_socket*, arg1, -1, "Socket", le_socket);
- convert_to_long_ex(arg2);
-
- if (listen(php_sock->socket, Z_LVAL_PP(arg2)) == 0) {
- RETURN_FALSE;
- }
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void socket_close(resource socket)
- Closes a file descriptor */
-PHP_FUNCTION(socket_close)
-{
- zval **arg1;
- php_socket *php_sock;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(php_sock, php_socket*, arg1, -1, "Socket", le_socket);
- zend_list_delete(Z_RESVAL_PP(arg1));
-}
-/* }}} */
-
-/* {{{ proto int socket_write(resource socket, string buf[, int length])
- Writes the buffer to the file descriptor fd, length is optional */
-PHP_FUNCTION(socket_write)
-{
- zval **arg1, **arg2, **arg3;
- php_socket *php_sock;
- int retval, which, argc = ZEND_NUM_ARGS();
-
- if (argc < 2 || argc > 3 || zend_get_parameters_ex(argc, &arg1, &arg2, &arg3) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(php_sock, php_socket*, arg1, -1, "Socket", le_socket);
- convert_to_string_ex(arg2);
- if (argc == 3) {
- convert_to_long_ex(arg3);
- which = (Z_STRLEN_PP(arg2) < Z_LVAL_PP(arg3)) ? 1 : 0;
- } else {
- which = 1;
- }
-
-#ifndef PHP_WIN32
- retval = write(php_sock->socket, (void *)Z_STRVAL_PP(arg2), (which ? Z_STRLEN_PP(arg2) : Z_LVAL_PP(arg3)));
-#else
- retval = send(php_sock->socket, Z_STRVAL_PP(arg2), (which ? Z_STRLEN_PP(arg2) : Z_LVAL_PP(arg3)), 0);
-#endif
-
- if (!retval) {
- php_error(E_WARNING, "unable to write, %i", errno);
- RETURN_LONG(0);
- }
-
- RETURN_LONG(retval);
-}
-/* }}} */
-
-typedef int (*read_func)(int, void *, int);
-
-/* {{{ proto mixed socket_read(resource socket, int length [, int type])
- Reads length bytes from socket */
-PHP_FUNCTION(socket_read)
-{
- zval **arg1, **arg2, **arg3;
- char *tmpbuf;
- php_socket *php_sock;
- read_func read_function = php_read;
- int retval, argc = ZEND_NUM_ARGS();
-
- if (argc < 2 || argc > 3 || zend_get_parameters_ex(argc, &arg1, &arg2, &arg3) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(php_sock, php_socket*, arg1, -1, "Socket", le_socket);
- convert_to_long_ex(arg2);
-
- if (argc == 3) {
- convert_to_long_ex(arg3);
- switch (Z_LVAL_PP(arg3)) {
- case PHP_SYSTEM_READ:
- case PHP_BINARY_READ:
- read_function = (read_func) read;
- break;
- }
- }
-
- tmpbuf = emalloc(Z_LVAL_PP(arg2) + 1);
-
-#ifndef PHP_WIN32
- retval = (*read_function)(php_sock->socket, tmpbuf, Z_LVAL_PP(arg2));
-#else
- retval = recv(php_sock->socket, tmpbuf, Z_LVAL_PP(arg2), 0);
-#endif
-
- if (retval <= 0) {
- efree(tmpbuf);
- RETURN_FALSE;
- }
-
- tmpbuf[retval] = '\0';
- RETURN_STRING(tmpbuf, 0);
-}
-/* }}} */
-
-/* {{{ proto bool socket_getsockname(resource socket, string &addr[, int &port])
- Given an fd, stores a string representing sa.sin_addr and the value of sa.sin_port into addr and port describing the local side of a socket */
-PHP_FUNCTION(socket_getsockname)
-{
- zval **arg1, **addr, **port;
- char *tmp;
- php_sockaddr_storage sa_storage;
- php_socket *php_sock;
- struct sockaddr *sa;
- struct sockaddr_in *sin;
- struct sockaddr_un *s_un;
- int salen = sizeof(php_sockaddr_storage);
- int argc = ZEND_NUM_ARGS();
-
- if (argc < 2 || argc > 3 || zend_get_parameters_ex(argc, &arg1, &addr, &port) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(php_sock, php_socket*, arg1, -1, "Socket", le_socket);
- convert_to_long_ex(port);
- convert_to_string_ex(addr);
-
- sa = (struct sockaddr *) &sa_storage;
-
- if (getsockname(php_sock->socket, sa, &salen) != 0) {
- php_error(E_WARNING, "unable to retrieve socket name, %i", errno);
- RETURN_FALSE;
- } else {
- char *addr_string;
-
- switch (sa->sa_family) {
- case AF_INET:
- sin = (struct sockaddr_in *) sa;
- while (inet_ntoa_lock == 1);
- inet_ntoa_lock = 1;
- addr_string = inet_ntoa(sin->sin_addr);
- tmp = (char*)emalloc(strlen(addr_string) + 1);
- memset(tmp, 0, strlen(addr_string) + 1);
- strncpy(tmp, addr_string, strlen(addr_string));
- inet_ntoa_lock = 0;
-
- if (Z_STRLEN_PP(addr) > 0) {
- efree(Z_STRVAL_PP(addr));
- }
-
- Z_STRVAL_PP(addr) = tmp;
- Z_STRLEN_PP(addr) = strlen(tmp);
- Z_LVAL_PP(port) = htons(sin->sin_port);
- RETURN_TRUE;
-
- case AF_UNIX:
- if (Z_STRLEN_PP(addr) > 0) {
- efree(Z_STRVAL_PP(addr));
- }
- s_un = (struct sockaddr_un *) sa;
- Z_STRVAL_PP(addr) = estrndup(s_un->sun_path,strlen(s_un->sun_path));
- Z_STRLEN_PP(addr) = strlen(s_un->sun_path);
- RETURN_TRUE;
-
- default:
- RETURN_FALSE;
- }
- }
-}
-/* }}} */
-
-/* {{{ proto bool socket_getpeername(resource socket, string &addr[, int &port])
- Given an fd, stores a string representing sa.sin_addr and the value of sa.sin_port into addr and port describing the remote side of a socket */
-PHP_FUNCTION(socket_getpeername)
-{
- zval **arg1, **arg2, **arg3;
- char *tmp;
- php_sockaddr_storage sa_storage;
- php_socket *php_sock;
- struct sockaddr *sa;
- struct sockaddr_in *sin;
- struct sockaddr_un *s_un;
- int salen = sizeof(php_sockaddr_storage);
- int argc = ZEND_NUM_ARGS();
-
- if (argc < 2 || argc > 3 || zend_get_parameters_ex(argc, &arg1, &arg2, &arg3) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(php_sock, php_socket*, arg1, -1, "Socket", le_socket);
- convert_to_string_ex(arg2);
- convert_to_long_ex(arg3);
-
- sa = (struct sockaddr *) &sa_storage;
-
- if (getpeername(php_sock->socket, sa, &salen) != 0) {
- php_error(E_WARNING, "unable to retrieve peername, %i", errno);
- RETURN_FALSE;
- } else {
- char *addr_string;
-
- switch (sa->sa_family) {
- case AF_INET:
- sin = (struct sockaddr_in *) sa;
- while (inet_ntoa_lock == 1);
- inet_ntoa_lock = 1;
- addr_string = inet_ntoa(sin->sin_addr);
- tmp = (char*)emalloc(strlen(addr_string) + 1);
- memset(tmp, 0, strlen(addr_string) + 1);
- strncpy(tmp, addr_string, strlen(addr_string));
- inet_ntoa_lock = 0;
-
- if (Z_STRLEN_PP(arg2) > 0) {
- efree(Z_STRVAL_PP(arg2));
- }
-
- Z_STRVAL_PP(arg2) = tmp;
- Z_STRLEN_PP(arg2) = strlen(tmp);
-
- if (argc > 2) {
- Z_LVAL_PP(arg3) = htons(sin->sin_port);
- }
-
- RETURN_TRUE;
-
- case AF_UNIX:
- if (Z_STRLEN_PP(arg2) > 0) {
- efree(Z_STRVAL_PP(arg2));
- }
- s_un = (struct sockaddr_un *) sa;
- Z_STRVAL_PP(arg2) = estrndup(s_un->sun_path,strlen(s_un->sun_path));
- Z_STRLEN_PP(arg2) = strlen(s_un->sun_path);
- RETURN_TRUE;
-
- default:
- RETURN_FALSE;
- }
- }
-}
-/* }}} */
-
-/* {{{ proto mixed socket_create(int domain, int type, int protocol)
- Creates an endpoint for communication in the domain specified by domain, of type specified by type */
-PHP_FUNCTION(socket_create)
-{
- zval **arg1, **arg2, **arg3;
- php_socket *php_sock = (php_socket*)emalloc(sizeof(php_socket));
-
- if (zend_get_parameters_ex(3, &arg1, &arg2, &arg3) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(arg1);
- convert_to_long_ex(arg2);
- convert_to_long_ex(arg3);
-
- if (Z_LVAL_PP(arg1) != AF_UNIX && Z_LVAL_PP(arg1) != AF_INET) {
- php_error(E_WARNING, "invalid socket domain [%i] specified, assuming AF_INET", Z_LVAL_PP(arg1));
- Z_LVAL_PP(arg1) = AF_INET;
- }
-
- if (Z_LVAL_PP(arg2) > 10) {
- php_error(E_WARNING, "invalid socket type [%i] specified, assuming SOCK_STREAM", Z_LVAL_PP(arg2));
- Z_LVAL_PP(arg2) = SOCK_STREAM;
- }
-
- php_sock->socket = socket(Z_LVAL_PP(arg1), Z_LVAL_PP(arg2), Z_LVAL_PP(arg3));
- php_sock->type = Z_LVAL_PP(arg1);
-
- if(IS_INVALID_SOCKET(php_sock)) {
- RETURN_FALSE;
- }
-
- ZEND_REGISTER_RESOURCE(return_value, php_sock, le_socket);
-}
-/* }}} */
-
-/* {{{ proto bool socket_connect(resource socket, string addr [, int port])
- Opens a connection to addr:port on the socket specified by socket */
-PHP_FUNCTION(socket_connect)
-{
- zval **arg1, **arg2, **arg3;
- php_socket *php_sock;
- struct sockaddr_in sin;
- struct sockaddr_un s_un;
- int retval;
- struct in_addr addr_buf;
- struct hostent *host_struct;
- int argc = ZEND_NUM_ARGS();
-
- if (argc < 2 || argc > 3 || zend_get_parameters_ex(argc, &arg1, &arg2, &arg3) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(php_sock, php_socket*, arg1, -1, "Socket", le_socket);
- convert_to_string_ex(arg2);
-
- if (argc == 3) {
- convert_to_long_ex(arg3);
- }
-
-
- switch( php_sock->type ) {
- case AF_INET:
-
- if (argc != 3) {
- WRONG_PARAM_COUNT;
- }
-
- sin.sin_family = AF_INET;
- sin.sin_port = htons((unsigned short int)Z_LVAL_PP(arg3));
-
- if (inet_aton(Z_STRVAL_PP(arg2), &addr_buf)) {
- sin.sin_addr.s_addr = addr_buf.s_addr;
- } else {
- char *q = (char *) &(sin.sin_addr.s_addr);
- host_struct = gethostbyname(Z_STRVAL_PP(arg2));
- if (host_struct->h_addrtype != AF_INET) {
- RETURN_FALSE;
- }
- q[0] = host_struct->h_addr_list[0][0];
- q[1] = host_struct->h_addr_list[0][1];
- q[2] = host_struct->h_addr_list[0][2];
- q[3] = host_struct->h_addr_list[0][3];
- }
-
- retval = connect(php_sock->socket, (struct sockaddr *)&sin, sizeof(struct sockaddr_in));
- break;
-
- case AF_UNIX:
- s_un.sun_family = AF_UNIX;
- snprintf(s_un.sun_path, 108, "%s", Z_STRVAL_PP(arg2));
- retval = connect(php_sock->socket, (struct sockaddr *)&s_un, SUN_LEN(&s_un));
- break;
-
- default:
- RETURN_FALSE;
- }
-
- if (retval != 0) {
- php_error(E_WARNING, "unable to connect, %i", errno);
- RETURN_FALSE;
- }
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto string socket_strerror(int errno)
- Returns a string describing an error */
-PHP_FUNCTION(socket_strerror)
-{
- zval **arg1;
- const char *buf;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
-#ifndef PHP_WIN32
- if (Z_LVAL_PP(arg1) < -10000) {
- Z_LVAL_PP(arg1) += 10000;
-#ifdef HAVE_HSTRERROR
- buf = hstrerror(-(Z_LVAL_PP(arg1)));
-#else
- {
- static char buf[100];
- sprintf (buf, "Host lookup error %d", -(Z_LVAL_PP(arg1)));
- }
-#endif
- } else {
- buf = strerror(-(Z_LVAL_PP(arg1)));
- }
-#else
- FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
- FORMAT_MESSAGE_FROM_SYSTEM |
- FORMAT_MESSAGE_IGNORE_INSERTS,
- NULL,
- Z_LVAL_PP(arg1),
- MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
- (LPTSTR)&buf,
- 0,
- NULL
- );
-#endif
- RETURN_STRING(buf?(char*)buf:"", 1);
-}
-/* }}} */
-
-/* {{{ proto bool socket_bind(resource socket, string addr [, int port])
- Binds an open socket to a listening port, port is only specified in AF_INET family. */
-PHP_FUNCTION(socket_bind)
-{
- zval **arg1, **arg2, **arg3;
- long retval;
- php_sockaddr_storage sa_storage;
- struct sockaddr *sock_type = (struct sockaddr*) &sa_storage;
- socklen_t length = sizeof(sa_storage);
- php_socket *php_sock;
- int argc = ZEND_NUM_ARGS();
-
-
- if (argc < 2 || argc > 3 || zend_get_parameters_ex(argc, &arg1, &arg2, &arg3) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- switch (argc) {
- case 3:
- convert_to_long_ex(arg3);
- case 2:
- convert_to_string_ex(arg2);
- ZEND_FETCH_RESOURCE(php_sock, php_socket*, arg1, -1, "Socket", le_socket);
- break;
- }
-
-
- if (php_sock->type == AF_UNIX) {
- struct sockaddr_un *sa = (struct sockaddr_un *) sock_type;
- memset(sa, 0, sizeof(sa_storage));
- sa->sun_family = AF_UNIX;
- snprintf(sa->sun_path, 108, "%s", Z_STRVAL_PP(arg2));
- retval = bind(php_sock->socket, (struct sockaddr *) sa, SUN_LEN(sa));
-
- } else if (php_sock->type == AF_INET) {
-
- struct sockaddr_in sa;
- struct hostent *hp;
-
- if (argc != 3) {
- WRONG_PARAM_COUNT;
- }
-
- if ((hp = gethostbyname(Z_STRVAL_PP(arg2))) == NULL) {
- php_error(E_WARNING, "unable to lookup [%s], %i", Z_STRVAL_PP(arg2), h_errno);
- RETURN_FALSE;
- }
-
- memcpy((char *)&sa.sin_addr, hp->h_addr, hp->h_length);
- sa.sin_family = hp->h_addrtype;
- sa.sin_port = htons((unsigned short)Z_LVAL_PP(arg3));
- retval = bind(php_sock->socket, (struct sockaddr *)&sa, sizeof(sa));
-
- } else {
- php_error(E_WARNING,"the specified port is not supported");
- RETURN_FALSE;
- }
-
- if (retval != 0) {
- php_error(E_WARNING, "unable to bind address, %i", errno);
- RETURN_FALSE;
- }
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto resource socket_iovec_alloc(int num_vectors [, int ...])
- Builds a 'struct iovec' for use with sendmsg, recvmsg, writev, and readv */
-/* First parameter is number of vectors, each additional parameter is the
- length of the vector to create.
- */
-PHP_FUNCTION(socket_iovec_alloc)
-{
- zval ***args = (zval ***)NULL;
- php_iovec_t *vector;
- struct iovec *vector_array;
- int i, j, num_vectors, argc = ZEND_NUM_ARGS();
-
- args = (zval***)emalloc(argc*sizeof(zval**));
-
- if (argc < 1 || zend_get_parameters_array_ex(argc, args) == FAILURE) {
- efree(args);
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(args[0]);
- num_vectors = Z_LVAL_PP(args[0]);
-
- vector_array = (struct iovec*)emalloc(sizeof(struct iovec)*(num_vectors+1));
-
- for (i = 0, j = 1; i < num_vectors; i++, j++) {
- convert_to_long_ex(args[j]);
-
- vector_array[i].iov_base = (char*)emalloc(Z_LVAL_PP(args[j]));
- vector_array[i].iov_len = Z_LVAL_PP(args[j]);
- }
-
- vector = (php_iovec_t*)emalloc(sizeof(php_iovec_t));
- vector->iov_array = vector_array;
- vector->count = num_vectors;
-
- ZEND_REGISTER_RESOURCE(return_value, vector, le_iov);
-}
-/* }}} */
-
-/* {{{ proto string socket_iovec_fetch(resource iovec, int iovec_position)
- Returns the data held in the iovec specified by iovec_id[iovec_position] */
-PHP_FUNCTION(socket_iovec_fetch)
-{
- zval **iovec_id, **iovec_position;
- php_iovec_t *vector;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &iovec_id, &iovec_position) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(vector, php_iovec_t *, iovec_id, -1, "IO vector table", le_iov);
-
- if (Z_LVAL_PP(iovec_position) > vector->count) {
- php_error(E_WARNING, "Can't access a vector position past the amount of vectors set in the array");
- RETURN_NULL();
- }
-
- RETURN_STRINGL(vector->iov_array[Z_LVAL_PP(iovec_position)].iov_base,
- vector->iov_array[Z_LVAL_PP(iovec_position)].iov_len, 1);
-}
-/* }}} */
-
-/* {{{ proto bool socket_iovec_set(resource iovec, int iovec_position, string new_val)
- Sets the data held in iovec_id[iovec_position] to new_val */
-PHP_FUNCTION(socket_iovec_set)
-{
- zval **iovec_id, **iovec_position, **new_val;
- php_iovec_t *vector;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &iovec_id, &iovec_position, &new_val) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(vector, php_iovec_t *, iovec_id, -1, "IO vector table", le_iov);
-
- if (Z_LVAL_PP(iovec_position) > vector->count) {
- php_error(E_WARNING, "Can't access a vector position outside of the vector array bounds");
- RETURN_FALSE;
- }
-
- if (vector->iov_array[Z_LVAL_PP(iovec_position)].iov_base) {
- efree(vector->iov_array[Z_LVAL_PP(iovec_position)].iov_base);
- }
-
- vector->iov_array[Z_LVAL_PP(iovec_position)].iov_base = estrdup(Z_STRVAL_PP(new_val));
- vector->iov_array[Z_LVAL_PP(iovec_position)].iov_len = strlen(Z_STRVAL_PP(new_val));
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool socket_iovec_add(resource iovec, int iov_len)
- Adds a new vector to the scatter/gather array */
-PHP_FUNCTION(socket_iovec_add)
-{
- zval **iovec_id, **iov_len;
- php_iovec_t *vector;
- struct iovec *vector_array;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &iovec_id, &iov_len) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(vector, php_iovec_t *, iovec_id, -1, "IO vector table", le_iov);
-
- vector_array = (struct iovec*)emalloc(sizeof(struct iovec) * (vector->count + 2));
- memcpy(vector_array, vector->iov_array, sizeof(struct iovec) * vector->count);
-
- vector_array[vector->count].iov_base = (char*)emalloc(Z_LVAL_PP(iov_len));
- vector_array[vector->count].iov_len = Z_LVAL_PP(iov_len);
- efree(vector->iov_array);
- vector->iov_array = vector_array;
- vector->count++;
-
- RETURN_TRUE;
-}
-
-/* }}} */
-
-/* {{{ proto bool socket_iovec_delete(resource iovec, int iov_pos)
- Deletes a vector from an array of vectors */
-PHP_FUNCTION(socket_iovec_delete)
-{
- zval **iovec_id, **iov_pos;
- php_iovec_t *vector;
- struct iovec *vector_array;
- int i;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &iovec_id, &iov_pos) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(vector, php_iovec_t *, iovec_id, -1, "IO vector table", le_iov);
-
- if (Z_LVAL_PP(iov_pos) > vector->count) {
- php_error(E_WARNING, "Can't delete an IO vector that is out of array bounds");
- RETURN_FALSE;
- }
- vector_array = (struct iovec*)emalloc(vector->count * sizeof(struct iovec));
-
- for (i = 0; i < vector->count; i++) {
- if (i < Z_LVAL_PP(iov_pos)) {
- memcpy(&(vector->iov_array[i]), &(vector_array[i]), sizeof(struct iovec));
- } else if (i > Z_LVAL_PP(iov_pos)) {
- memcpy(&(vector->iov_array[i]), &(vector_array[i - 1]), sizeof(struct iovec));
- }
- }
-
- efree(vector->iov_array);
- vector->iov_array = vector_array;
-
- RETURN_TRUE;
-}
-
-/* }}} */
-
-/* {{{ proto bool socket_iovec_free(resource iovec)
- Frees the iovec specified by iovec_id */
-PHP_FUNCTION(socket_iovec_free)
-{
- zval **arg1;
- php_iovec_t *vector;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(vector, php_iovec_t *, arg1, -1, "IO vector table", le_iov);
-
- zend_list_delete(Z_RESVAL_PP(arg1));
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool socket_readv(resource socket, resource iovec_id)
- Reads from an fd, using the scatter-gather array defined by iovec_id */
-PHP_FUNCTION(socket_readv)
-{
- zval **arg1, **arg2;
- php_iovec_t *vector;
- php_socket *php_sock;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(php_sock, php_socket*, arg1, -1, "Socket", le_socket);
- ZEND_FETCH_RESOURCE(vector, php_iovec_t *, arg2, -1, "IO vector table", le_iov);
-
- if (readv(php_sock->socket, vector->iov_array, vector->count) != 0) {
- php_error(E_WARNING, "unable to read, %i", errno);
- RETURN_FALSE;
- }
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool socket_writev(resource socket, resource iovec_id)
- Writes to a file descriptor, fd, using the scatter-gather array defined by iovec_id */
-PHP_FUNCTION(socket_writev)
-{
- zval **arg1, **arg2;
- php_iovec_t *vector;
- php_socket *php_sock;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(php_sock, php_socket*, arg1, -1, "Socket", le_socket);
- ZEND_FETCH_RESOURCE(vector, php_iovec_t *, arg2, -1, "IO vector table", le_iov);
-
- if (writev(php_sock->socket, vector->iov_array, vector->count) != 0) {
- php_error(E_WARNING, "unable to write, %i", errno);
- RETURN_FALSE;
- }
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto mixed socket_recv(resource socket, int len, int flags)
- Receives data from a connected socket */
-PHP_FUNCTION(socket_recv)
-{
- zval **arg1, **arg2, **arg3;
- char *recv_buf;
- php_socket *php_sock;
- int retval;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &arg1, &arg2, &arg3) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(php_sock, php_socket*, arg1, -1, "Socket", le_socket);
- convert_to_long_ex(arg2);
- convert_to_long_ex(arg3);
-
- recv_buf = (char*)emalloc(Z_LVAL_PP(arg2) + 2);
- memset(recv_buf, 0, Z_LVAL_PP(arg2) + 2);
-
- retval = recv(php_sock->socket, recv_buf, Z_LVAL_PP(arg2), Z_LVAL_PP(arg3));
-
- if (retval == 0) {
- efree(recv_buf);
- RETURN_FALSE;
- }
-
- recv_buf[retval+1] = '\0';
- RETURN_STRING(recv_buf, 0);
-}
-/* }}} */
-
-/* {{{ proto int socket_send(resource socket, string buf, int len, int flags)
- Sends data to a connected socket */
-PHP_FUNCTION(socket_send)
-{
- zval **arg1, **arg2, **arg3, **arg4;
- php_socket *php_sock;
- int retval;
-
- if (ZEND_NUM_ARGS() != 4 || zend_get_parameters_ex(4, &arg1, &arg2, &arg3, &arg4) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(php_sock, php_socket*, arg1, -1, "Socket", le_socket);
- convert_to_long_ex(arg3);
- convert_to_long_ex(arg4);
- convert_to_string_ex(arg2);
-
- retval = send(php_sock->socket, Z_STRVAL_PP(arg2), (Z_STRLEN_PP(arg2) < Z_LVAL_PP(arg3) ? Z_STRLEN_PP(arg2) : Z_LVAL_PP(arg3)), Z_LVAL_PP(arg4));
-
- RETURN_LONG(retval);
-}
-/* }}} */
-
-/* {{{ proto int socket_recvfrom(resource socket, string &buf, int len, int flags, string &name [, int &port])
- Receives data from a socket, connected or not */
-PHP_FUNCTION(socket_recvfrom)
-{
- zval **arg1, **arg2, **arg3, **arg4, **arg5, **arg6;
- php_socket *php_sock;
- struct sockaddr_un s_un;
- struct sockaddr_in sin;
- socklen_t slen;
- int retval, argc = ZEND_NUM_ARGS();
- char *recv_buf, *address;
-
-
- if(argc < 5 || argc > 6 || zend_get_parameters_ex(argc, &arg1, &arg2, &arg3, &arg4, &arg5, &arg6) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- switch (argc) {
- case 6:
- convert_to_long_ex(arg6);
- case 5:
- convert_to_string_ex(arg5);
- convert_to_long_ex(arg4);
- convert_to_long_ex(arg3);
- convert_to_string_ex(arg2);
- ZEND_FETCH_RESOURCE(php_sock, php_socket*, arg1, -1, "Socket", le_socket);
- break;
- }
-
- recv_buf = (char*)emalloc(Z_LVAL_PP(arg3) + 2);
- memset(recv_buf, 0, Z_LVAL_PP(arg3) + 2);
-
- switch ( php_sock->type ) {
- case AF_UNIX:
- slen = sizeof(s_un);
- s_un.sun_family = AF_UNIX;
- retval = recvfrom(php_sock->socket, recv_buf, Z_LVAL_PP(arg3), Z_LVAL_PP(arg4),
- (struct sockaddr *)&s_un, (socklen_t *)&slen);
-
- if (retval < 0) {
- efree(recv_buf);
- php_error(E_WARNING, "unable to recvfrom, %i", errno);
- RETURN_FALSE;
- }
-
- if (Z_STRVAL_PP(arg2) != NULL) {
- efree(Z_STRVAL_PP(arg2));
- }
-
- Z_STRVAL_PP(arg2) = estrndup(recv_buf, strlen(recv_buf));
- Z_STRLEN_PP(arg2) = strlen(recv_buf);
-
- if (Z_STRLEN_PP(arg5) > 0) {
- efree(Z_STRVAL_PP(arg5));
- }
-
- Z_STRVAL_PP(arg5) = estrdup(s_un.sun_path);
- Z_STRLEN_PP(arg5) = strlen(s_un.sun_path);
- efree(recv_buf);
-
- case AF_INET:
- slen = sizeof(sin);
- sin.sin_family = AF_INET;
-
- if (argc != 6) {
- WRONG_PARAM_COUNT;
- }
-
- retval = recvfrom(php_sock->socket, recv_buf, Z_LVAL_PP(arg3), Z_LVAL_PP(arg4),
- (struct sockaddr *)&sin, (socklen_t *)&slen);
-
- if (retval < 0) {
- efree(recv_buf);
- php_error(E_WARNING, "unable to recvfrom, %i", errno);
- RETURN_FALSE;
- }
-
- if (Z_STRLEN_PP(arg2) > 0) {
- efree(Z_STRVAL_PP(arg2));
- }
-
- Z_STRVAL_PP(arg2) = estrdup(recv_buf);
- Z_STRLEN_PP(arg2) = strlen(recv_buf);
-
- if (Z_STRLEN_PP(arg5) > 0) {
- efree(Z_STRVAL_PP(arg5));
- }
-
- address = inet_ntoa(sin.sin_addr);
- if (address == NULL) {
- Z_STRVAL_PP(arg5) = estrdup("0.0.0.0");
- Z_STRLEN_PP(arg5) = strlen(Z_STRVAL_PP(arg5));
- } else {
- Z_STRVAL_PP(arg5) = estrdup(address);
- Z_STRLEN_PP(arg5) = strlen(address);
- }
-
- Z_LVAL_PP(arg6) = ntohs(sin.sin_port);
- efree(recv_buf);
-
- default:
- RETURN_FALSE;
- }
-
- RETURN_LONG(retval);
-}
-/* }}} */
-
-/* {{{ proto int socket_sendto(resource socket, string buf, int len, int flags, string addr [, int port])
- Sends a message to a socket, whether it is connected or not */
-PHP_FUNCTION(socket_sendto)
-{
- zval **arg1, **arg2, **arg3, **arg4, **arg5, **arg6;
- php_socket *php_sock;
- struct sockaddr_un s_un;
- struct sockaddr_in sin;
- struct in_addr addr_buf;
- int retval, argc = ZEND_NUM_ARGS(), which;
-
- if(argc < 5 || argc > 6 || zend_get_parameters_ex(argc, &arg1, &arg2, &arg3, &arg4, &arg5, &arg6) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- switch (argc) {
- case 6:
- convert_to_long_ex(arg6);
- case 5:
- convert_to_string_ex(arg5);
- convert_to_long_ex(arg4);
- convert_to_long_ex(arg3);
- convert_to_string_ex(arg2);
- ZEND_FETCH_RESOURCE(php_sock, php_socket*, arg1, -1, "Socket", le_socket);
- break;
- }
-
-
- switch ( php_sock->socket ) {
- case AF_UNIX:
- memset(&s_un, 0, sizeof(s_un));
- s_un.sun_family = AF_UNIX;
- snprintf(s_un.sun_path, 108, "%s", Z_STRVAL_PP(arg5));
-
- which = (Z_STRLEN_PP(arg2) > Z_LVAL_PP(arg3)) ? 1 : 0;
- retval = sendto(php_sock->socket, Z_STRVAL_PP(arg2), (which ? Z_LVAL_PP(arg3) : Z_STRLEN_PP(arg2)),
- Z_LVAL_PP(arg4), (struct sockaddr *) &s_un, SUN_LEN(&s_un));
-
- case AF_INET:
- if (argc != 6) {
- WRONG_PARAM_COUNT;
- }
-
- memset(&sin, 0, sizeof(sin));
- sin.sin_family = AF_INET;
-
- if (inet_aton(Z_STRVAL_PP(arg5), &addr_buf) == 0) {
- sin.sin_addr.s_addr = addr_buf.s_addr;
- } else {
- struct hostent *he;
- he = gethostbyname(Z_STRVAL_PP(arg4));
-
- if (he == NULL) {
- php_error(E_WARNING, "unable to sendto, %i", h_errno);
- RETURN_FALSE;
- }
-
- sin.sin_addr.s_addr = *(int *) (he->h_addr_list[0]);
- }
-
- sin.sin_port = htons((unsigned short)Z_LVAL_PP(arg6));
- which = (Z_STRLEN_PP(arg2) > Z_LVAL_PP(arg3)) ? 1 : 0;
- retval = sendto(php_sock->socket, Z_STRVAL_PP(arg2), (which ? Z_LVAL_PP(arg3) : Z_STRLEN_PP(arg2)),
- Z_LVAL_PP(arg4), (struct sockaddr *) &sin, sizeof(sin));
-
- default:
- RETURN_LONG(0);
- }
-
- RETURN_LONG(retval);
-}
-/* }}} */
-
-/* {{{ proto bool socket_recvmsg(resource socket, resource iovec, array &control, int &controllen, int &flags, string &addr [, int &port])
- Used to receive messages on a socket, whether connection-oriented or not */
-PHP_FUNCTION(socket_recvmsg)
-{
- zval **arg1, **arg2, **arg3, **arg4, **arg5, **arg6, **arg7;
- zval *control_array = NULL;
- php_iovec_t *iov;
- struct msghdr hdr;
- php_sockaddr_storage sa_storage;
- php_socket *php_sock;
- struct sockaddr *sa = (struct sockaddr *) &sa_storage;
- struct sockaddr_in *sin = (struct sockaddr_in *) sa;
- struct sockaddr_un *s_un = (struct sockaddr_un *) sa;
- struct cmsghdr *ctl_buf;
- socklen_t salen = sizeof(sa_storage);
- int argc = ZEND_NUM_ARGS();
-
- if(argc < 6 || argc > 7 || zend_get_parameters_ex(argc, &arg1, &arg2, &arg3, &arg4, &arg5, &arg6, &arg7) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- switch (argc) {
- case 7:
- convert_to_long_ex(arg7);
- case 6:
- convert_to_string_ex(arg6);
- convert_to_long_ex(arg5);
- convert_to_long_ex(arg4);
- convert_to_array_ex(arg3);
- ZEND_FETCH_RESOURCE(php_sock, php_socket*, arg1, -1, "Socket", le_socket);
- ZEND_FETCH_RESOURCE(iov, php_iovec_t *, arg2, -1, "IO vector table", le_iov);
- break;
- }
-
- if (getsockname(php_sock->socket, sa, &salen) != 0) {
- php_error(E_WARNING, "unable to recvms, %i", errno);
- RETURN_FALSE;
- }
-
- ctl_buf = (Z_LVAL_PP(arg4) > sizeof(struct cmsghdr)) ? (struct cmsghdr*)emalloc(Z_LVAL_PP(arg4)) : NULL;
- MAKE_STD_ZVAL(control_array);
-
- switch (sa->sa_family) {
- case AF_INET:
-
- if (ZEND_NUM_ARGS() != 7) {
- efree(ctl_buf);
- WRONG_PARAM_COUNT;
- }
-
- memset(sa, 0, sizeof(sa_storage));
- hdr.msg_name = sin;
- hdr.msg_namelen = sizeof(sa_storage);
- hdr.msg_iov = iov->iov_array;
- hdr.msg_iovlen = iov->count;
-
- hdr.msg_control = ctl_buf ? ctl_buf : NULL;
- hdr.msg_controllen = ctl_buf ? Z_LVAL_PP(arg4) : 0;
- hdr.msg_flags = 0;
-
- if (recvmsg(php_sock->socket, &hdr, Z_LVAL_PP(arg5)) != 0) {
- php_error(E_WARNING, "unable to recvmsg, %i", errno);
- RETURN_FALSE;
- } else {
- struct cmsghdr *mhdr = (struct cmsghdr *) hdr.msg_control;
-
- /* copy values as appropriate... */
- if (array_init(control_array) == FAILURE) {
- php_error(E_WARNING, "Cannot intialize array");
- RETURN_FALSE;
- }
-
- add_assoc_long(control_array, "cmsg_level", mhdr->cmsg_level);
- add_assoc_long(control_array, "cmsg_type", mhdr->cmsg_type);
- add_assoc_string(control_array, "cmsg_data", CMSG_DATA(mhdr), 1);
- *arg3 = control_array;
- zval_copy_ctor(*arg3);
-
- Z_LVAL_PP(arg4) = hdr.msg_controllen;
- Z_LVAL_PP(arg5) = hdr.msg_flags;
-
- if (Z_STRLEN_PP(arg6) > 0) {
- efree(Z_STRVAL_PP(arg6));
- }
-
- {
- char *tmp = inet_ntoa(sin->sin_addr);
- if (tmp == NULL) {
- Z_STRVAL_PP(arg6) = estrdup("0.0.0.0");
- } else {
- Z_STRVAL_PP(arg6) = estrdup(tmp);
- }
- }
-
- Z_STRLEN_PP(arg6) = strlen(Z_STRVAL_PP(arg6));
- Z_LVAL_PP(arg7) = ntohs(sin->sin_port);
- RETURN_TRUE;
- }
-
- case AF_UNIX:
- memset(sa, 0, sizeof(sa_storage));
- hdr.msg_name = s_un;
- hdr.msg_namelen = sizeof(struct sockaddr_un);
- hdr.msg_iov = iov->iov_array;
- hdr.msg_iovlen = iov->count;
-
- if (ctl_buf) {
- hdr.msg_control = ctl_buf;
- hdr.msg_controllen = Z_LVAL_PP(arg4);
- } else {
- hdr.msg_control = NULL;
- hdr.msg_controllen = 0;
- }
-
- hdr.msg_flags = 0;
-
- if (recvmsg(php_sock->socket, &hdr, Z_LVAL_PP(arg5)) != 0) {
- php_error(E_WARNING, "unable to recvmsg, %i", errno);
- RETURN_FALSE;
- } else {
- struct cmsghdr *mhdr = (struct cmsghdr *) hdr.msg_control;
-
- if (mhdr != NULL) {
- /* copy values as appropriate... */
- if (array_init(control_array) == FAILURE) {
- php_error(E_WARNING, "Cannot initialize return value from recvmsg()");
- RETURN_FALSE;
- }
-
- add_assoc_long(control_array, "cmsg_level", mhdr->cmsg_level);
- add_assoc_long(control_array, "cmsg_type", mhdr->cmsg_type);
- add_assoc_string(control_array, "cmsg_data", CMSG_DATA(mhdr), 1);
- *arg3 = control_array;
- Z_LVAL_PP(arg4) = hdr.msg_controllen;
- }
-
- Z_LVAL_PP(arg5) = hdr.msg_flags;
-
- if (Z_STRVAL_PP(arg6) != NULL) {
- efree(Z_STRVAL_PP(arg6));
- }
-
- Z_STRVAL_PP(arg6) = estrdup(s_un->sun_path);
- RETURN_TRUE;
- }
- default:
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto bool socket_sendmsg(resource socket, resource iovec, int flags, string addr [, int port])
- Sends a message to a socket, regardless of whether it is connection-oriented or not */
-PHP_FUNCTION(socket_sendmsg)
-{
- zval **arg1, **arg2, **arg3, **arg4, **arg5;
- php_iovec_t *iov;
- php_socket *php_sock;
- int argc = ZEND_NUM_ARGS();
- struct sockaddr sa;
- int salen;
-
- if (argc < 4 || argc > 5 || zend_get_parameters_ex(argc, &arg1, &arg2, &arg3, &arg4, &arg5) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- switch (argc) {
- case 5:
- convert_to_long_ex(arg5);
- case 4:
- convert_to_string_ex(arg4);
- convert_to_long_ex(arg3);
- ZEND_FETCH_RESOURCE(php_sock, php_socket*, arg1, -1, "Socket", le_socket);
- ZEND_FETCH_RESOURCE(iov, php_iovec_t *, arg2, -1, "IO vector table", le_iov);
- break;
- }
-
- salen = sizeof(sa);
- if (getsockname(php_sock->socket, &sa, &salen) != 0) {
- php_error(E_WARNING, "unable to sendmsg, %i", errno);
- RETURN_FALSE;
- }
-
- switch(sa.sa_family) {
- case AF_INET:
- {
- struct msghdr hdr;
- struct sockaddr_in *sin = (struct sockaddr_in *) &sa;
-
- set_h_errno(0);
- set_errno(0);
-
- memset(&hdr, 0, sizeof(hdr));
- hdr.msg_name = &sa;
- hdr.msg_namelen = sizeof(sa);
- hdr.msg_iov = iov->iov_array;
- hdr.msg_iovlen = iov->count;
-
- if (inet_aton(Z_STRVAL_PP(arg4), &sin->sin_addr) != 0) {
- struct hostent *he = gethostbyname(Z_STRVAL_PP(arg4));
- if (!he) {
- php_error(E_WARNING, "unable to sendmsg, %i", h_errno);
- RETURN_FALSE;
- }
- sin->sin_addr.s_addr = *(int *)(he->h_addr_list[0]);
- }
-
- sin->sin_port = htons((unsigned short)Z_LVAL_PP(arg5));
-
- if(sendmsg(php_sock->socket, &hdr, Z_LVAL_PP(arg3)) != 0) {
- php_error(E_WARNING, "unable to sendmsg, %i", errno);
- }
-
- RETURN_TRUE;
- }
-
- case AF_UNIX:
- {
- struct msghdr hdr;
- struct sockaddr_un *s_un = (struct sockaddr_un *) &sa;
-
- set_errno(0);
-
- hdr.msg_name = s_un;
- hdr.msg_iov = iov->iov_array;
- hdr.msg_iovlen = iov->count;
-
- snprintf(s_un->sun_path, 108, "%s", Z_STRVAL_PP(arg4));
-
- hdr.msg_namelen = SUN_LEN(s_un);
-
- if(sendmsg(php_sock->socket, &hdr, Z_LVAL_PP(arg3)) != 0) {
- php_error(E_WARNING, "unable to sendmsg, %i", errno);
- RETURN_FALSE;
- }
-
- RETURN_TRUE;
- }
-
- default:
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto mixed socket_getopt(resource socket, int level, int optname)
- Gets socket options for the socket */
-PHP_FUNCTION(socket_getopt)
-{
- zval **arg1, **arg2, **arg3;
- struct linger linger_val;
- int other_val;
- socklen_t optlen;
- php_socket *php_sock;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &arg1, &arg2, &arg3) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(php_sock, php_socket*, arg1, -1, "Socket", le_socket);
- convert_to_long_ex(arg2);
- convert_to_long_ex(arg3);
-
- if (Z_LVAL_PP(arg2) == SO_LINGER) {
- zval *optval_array = NULL;
- optlen = sizeof(struct linger);
-
- if (getsockopt(php_sock->socket, Z_LVAL_PP(arg2), Z_LVAL_PP(arg3), (char*)&linger_val, &optlen) != 0) {
- php_error(E_WARNING, "unable to retrieve socket option, %i", errno);
- RETURN_FALSE;
- }
-
- if (array_init(return_value) == FAILURE) {
- RETURN_FALSE;
- }
- add_assoc_long(return_value, "l_onoff", linger_val.l_onoff);
- add_assoc_long(return_value, "l_linger", linger_val.l_linger);
-
- } else {
- optlen = sizeof(other_val);
-
- if (getsockopt(php_sock->socket, Z_LVAL_PP(arg2), Z_LVAL_PP(arg3), (char*)&other_val, &optlen) != 0) {
- php_error(E_WARNING, "unable to retrieve socket option, %i", errno);
- RETURN_FALSE;
- }
-
- RETURN_LONG(other_val);
- }
-}
-/* }}} */
-
-/* {{{ proto bool socket_setopt(resource socket, int level, int optname, int|array optval)
- Sets socket options for the socket */
-PHP_FUNCTION(socket_setopt)
-{
- zval **arg1, **arg2, **arg3, **arg4;
- struct linger lv;
- int ov, optlen, retval;
- php_socket *php_sock;
-
- if (ZEND_NUM_ARGS() != 4 || zend_get_parameters_ex(4, &arg1, &arg2, &arg3, &arg4) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(php_sock, php_socket*, arg1, -1, "Socket", le_socket);
- convert_to_long_ex(arg2);
- convert_to_long_ex(arg3);
-
- set_errno(0);
-
- if (Z_LVAL_PP(arg3) == SO_LINGER) {
- HashTable *ht;
- zval **l_onoff;
- zval **l_linger;
-
- convert_to_array_ex(arg4);
- ht = HASH_OF(*arg4);
-
- if (zend_hash_find(ht, "l_onoff", strlen("l_onoff") + 1, (void **)&l_onoff) == FAILURE) {
- php_error(E_WARNING, "No key \"l_onoff\" passed in optval");
- RETURN_FALSE;
- }
- if (zend_hash_find(ht, "l_linger", strlen("l_linger") + 1, (void **)&l_linger) == FAILURE) {
- php_error(E_WARNING, "No key \"l_linger\" passed in optval");
- RETURN_FALSE;
- }
-
- convert_to_long_ex(l_onoff);
- convert_to_long_ex(l_linger);
-
- lv.l_onoff = (unsigned short)Z_LVAL_PP(l_onoff);
- lv.l_linger = (unsigned short)Z_LVAL_PP(l_linger);
-
- optlen = sizeof(lv);
-
- retval = setsockopt(php_sock->socket, Z_LVAL_PP(arg2), Z_LVAL_PP(arg3), (char*)&lv, optlen);
-
- } else {
- convert_to_long_ex(arg4);
-
- optlen = sizeof(ov);
- ov = Z_LVAL_PP(arg3);
-
- retval = setsockopt(php_sock->socket, Z_LVAL_PP(arg2), Z_LVAL_PP(arg3), (char*)&ov, optlen);
- }
-
- if(retval != 0) {
- php_error(E_WARNING, "unable to set socket option, %i", errno);
- RETURN_FALSE;
- }
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool socket_create_pair(int domain, int type, int protocol, array &fd)
- Creates a pair of indistinguishable sockets and stores them in fds. */
-PHP_FUNCTION(socket_create_pair)
-{
- zval **arg1, **arg2, **arg3, **arg4;
- zval *retval[2];
- php_socket *php_sock[2];
-
-#ifndef PHP_WIN32
- int fds_array[2];
-#else
- SOCKET fds_array[2];
-#endif
-
- if (ZEND_NUM_ARGS() != 4 || zend_get_parameters_ex(4, &arg1, &arg2, &arg3, &arg4) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(arg1);
- convert_to_long_ex(arg2);
- convert_to_long_ex(arg3);
- convert_to_array_ex(arg4);
-
- php_sock[0]= (php_socket*)emalloc(sizeof(php_socket));
- php_sock[1]= (php_socket*)emalloc(sizeof(php_socket));
-
- if (Z_LVAL_PP(arg1) != AF_INET && Z_LVAL_PP(arg2) != AF_UNIX) {
- php_error(E_WARNING, "invalid socket domain specified, assuming AF_INET");
- Z_LVAL_PP(arg1) = AF_INET;
- }
-
- if (Z_LVAL_PP(arg2) > 10) {
- php_error(E_WARNING, "Invalid socket type specified, assuming SOCK_STREAM");
- Z_LVAL_PP(arg2) = SOCK_STREAM;
- }
-
- if (array_init(*arg4) == FAILURE) {
- php_error(E_WARNING, "Can't initialize fds array");
- RETURN_FALSE;
- }
-
- if (socketpair(Z_LVAL_PP(arg1), Z_LVAL_PP(arg2), Z_LVAL_PP(arg3), fds_array) != 0) {
- php_error(E_WARNING, "unable to create socket pair, %i", errno);
- RETURN_FALSE;
- }
-
- MAKE_STD_ZVAL(retval[0]);
- MAKE_STD_ZVAL(retval[1]);
-
- php_sock[0]->socket = fds_array[0];
- php_sock[1]->socket = fds_array[1];
- php_sock[0]->type = Z_LVAL_PP(arg1);
- php_sock[1]->type = Z_LVAL_PP(arg1);
-
- ZEND_REGISTER_RESOURCE(retval[0], php_sock[0], le_socket);
- ZEND_REGISTER_RESOURCE(retval[1], php_sock[1], le_socket);
-
- add_index_zval(*arg4, 0, retval[0]);
- add_index_zval(*arg4, 1, retval[1]);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool socket_shutdown(resource socket[, int how])
- Shuts down a socket for receiving, sending, or both. */
-PHP_FUNCTION(socket_shutdown)
-{
- zval **arg1, **arg2;
- int how_shutdown = 0, argc = ZEND_NUM_ARGS();
- php_socket *php_sock;
-
- if (argc < 1 || argc > 2 || zend_get_parameters_ex(argc, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(php_sock, php_socket*, arg1, -1, "Socket", le_socket);
-
- if (argc > 1) {
- convert_to_long_ex(arg2);
- how_shutdown = Z_LVAL_PP(arg2);
- }
-
- if(shutdown(php_sock->socket, how_shutdown) != 0) {
- php_error(E_WARNING, "unable to shutdown socket, %i", errno);
- RETURN_FALSE;
- }
-
- RETURN_TRUE;
-}
-/* }}} */
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/sockets/sockets.dsp b/ext/sockets/sockets.dsp
deleted file mode 100644
index a909c8daea..0000000000
--- a/ext/sockets/sockets.dsp
+++ /dev/null
@@ -1,116 +0,0 @@
-# Microsoft Developer Studio Project File - Name="sockets" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=sockets - Win32 Debug_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "SOCKETS.MAK".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "SOCKETS.MAK" CFG="sockets - Win32 Debug_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "sockets - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "sockets - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "sockets - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SOCKETS_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\TSRM" /D "WIN32" /D "PHP_EXPORTS" /D "COMPILE_DL_SOCKETS" /D ZTS=1 /D HAVE_SOCKETS=1 /D ZEND_DEBUG=0 /D "NDEBUG" /D "_WINDOWS" /D "ZEND_WIN32" /D "PHP_WIN32" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x407 /d "NDEBUG"
-# ADD RSC /l 0x407 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 php4ts.lib Ws2_32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_sockets.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
-
-!ELSEIF "$(CFG)" == "sockets - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SOCKETS_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\TSRM" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "PHP_EXPORTS" /D "COMPILE_DL_SOCKETS" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_SOCKETS=1 /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x407 /d "_DEBUG"
-# ADD RSC /l 0x407 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 php4ts_debug.lib Ws2_32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"..\..\Debug_TS/php_sockets.dll" /pdbtype:sept /libpath:"..\..\Debug_TS"
-
-!ENDIF
-
-# Begin Target
-
-# Name "sockets - Win32 Release_TS"
-# Name "sockets - Win32 Debug_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\php_sockets_win.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\sockets.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_sockets.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\php_sockets_win.h
-# End Source File
-# End Group
-# End Target
-# End Project
diff --git a/ext/sockets/sockets.php b/ext/sockets/sockets.php
deleted file mode 100644
index 3bb624cd57..0000000000
--- a/ext/sockets/sockets.php
+++ /dev/null
@@ -1,10 +0,0 @@
-<?
-$module = 'sockets';
-$function = 'confirm_' . $module . '_compiled';
-if (extension_loaded($module)) {
- $str = $function($module);
-} else {
- $str = "Module $module is not compiled in PHP";
-}
-echo "$str\n";
-?>
diff --git a/ext/standard/CREDITS b/ext/standard/CREDITS
deleted file mode 100644
index 4021b08860..0000000000
--- a/ext/standard/CREDITS
+++ /dev/null
@@ -1,3 +0,0 @@
-Assert
-Thies C. Arntzen
-
diff --git a/ext/standard/Makefile.in b/ext/standard/Makefile.in
deleted file mode 100644
index 244e988aa6..0000000000
--- a/ext/standard/Makefile.in
+++ /dev/null
@@ -1,18 +0,0 @@
-
-LTLIBRARY_NAME = libstandard.la
-LTLIBRARY_SOURCES=\
- array.c base64.c basic_functions.c browscap.c crc32.c crypt.c cyr_convert.c datetime.c \
- dir.c dl.c dns.c exec.c file.c filestat.c flock_compat.c \
- formatted_print.c fsock.c head.c html.c image.c info.c iptc.c lcg.c \
- link.c mail.c math.c md5.c metaphone.c microtime.c pack.c pageinfo.c \
- parsedate.c quot_print.c rand.c reg.c soundex.c string.c scanf.c \
- syslog.c type.c uniqid.c url.c url_scanner.c var.c output.c assert.c \
- strnatcmp.c levenshtein.c incomplete_class.c url_scanner_ex.c \
- ftp_fopen_wrapper.c http_fopen_wrapper.c php_fopen_wrapper.c credits.c
-
-include $(top_srcdir)/build/dynlib.mk
-
-parsedate.c: $(srcdir)/parsedate.y
-
-$(srcdir)/url_scanner_ex.c: $(srcdir)/url_scanner_ex.re
- re2c -b $(srcdir)/url_scanner_ex.re > $@
diff --git a/ext/standard/array.c b/ext/standard/array.c
deleted file mode 100644
index 8c27c7eeba..0000000000
--- a/ext/standard/array.c
+++ /dev/null
@@ -1,3127 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- | Rasmus Lerdorf <rasmus@php.net> |
- | Andrei Zmievski <andrei@ispi.net> |
- | Stig Venaas <venaas@php.net> |
- | Jason Greene <jason@php.net> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#include "php.h"
-#include "php_ini.h"
-#include "zend_operators.h"
-#include <stdarg.h>
-#include <stdlib.h>
-#include <math.h>
-#include <time.h>
-#include <stdio.h>
-#if HAVE_STRING_H
-#include <string.h>
-#else
-#include <strings.h>
-#endif
-#ifdef PHP_WIN32
-#include "win32/unistd.h"
-#endif
-#include "zend_globals.h"
-#include "php_globals.h"
-#include "php_array.h"
-#include "basic_functions.h"
-#include "php_string.h"
-#include "php_rand.h"
-
-#ifdef ZTS
-int array_globals_id;
-#else
-php_array_globals array_globals;
-#endif
-
-#define EXTR_OVERWRITE 0
-#define EXTR_SKIP 1
-#define EXTR_PREFIX_SAME 2
-#define EXTR_PREFIX_ALL 3
-#define EXTR_PREFIX_INVALID 4
-
-#define SORT_REGULAR 0
-#define SORT_NUMERIC 1
-#define SORT_STRING 2
-
-#define SORT_DESC 3
-#define SORT_ASC 4
-
-PHP_MINIT_FUNCTION(array)
-{
-#ifdef ZTS
- array_globals_id = ts_allocate_id(sizeof(php_array_globals), NULL, NULL);
-#endif
-
- REGISTER_LONG_CONSTANT("EXTR_OVERWRITE", EXTR_OVERWRITE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("EXTR_SKIP", EXTR_SKIP, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("EXTR_PREFIX_SAME", EXTR_PREFIX_SAME, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("EXTR_PREFIX_ALL", EXTR_PREFIX_ALL, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("EXTR_PREFIX_INVALID", EXTR_PREFIX_INVALID, CONST_CS | CONST_PERSISTENT);
-
- REGISTER_LONG_CONSTANT("SORT_ASC", SORT_ASC, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SORT_DESC", SORT_DESC, CONST_CS | CONST_PERSISTENT);
-
- REGISTER_LONG_CONSTANT("SORT_REGULAR", SORT_REGULAR, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SORT_NUMERIC", SORT_NUMERIC, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SORT_STRING", SORT_STRING, CONST_CS | CONST_PERSISTENT);
-
- return SUCCESS;
-}
-
-PHP_MSHUTDOWN_FUNCTION(array)
-{
-#ifdef ZTS
- ts_free_id(array_globals_id);
-#endif
-
- return SUCCESS;
-}
-
-static void set_compare_func(int sort_type)
-{
- ARRAYLS_FETCH();
-
- switch (sort_type) {
- case SORT_NUMERIC:
- ARRAYG(compare_func) = numeric_compare_function;
- break;
-
- case SORT_STRING:
- ARRAYG(compare_func) = string_compare_function;
- break;
-
- case SORT_REGULAR:
- default:
- ARRAYG(compare_func) = compare_function;
- break;
- }
-}
-
-static int array_key_compare(const void *a, const void *b)
-{
- Bucket *f;
- Bucket *s;
- pval result;
- pval first;
- pval second;
- ARRAYLS_FETCH();
-
- f = *((Bucket **) a);
- s = *((Bucket **) b);
-
- if (f->nKeyLength == 0) {
- Z_TYPE(first) = IS_LONG;
- Z_LVAL(first) = f->h;
- } else {
- Z_TYPE(first) = IS_STRING;
- Z_STRVAL(first) = f->arKey;
- Z_STRLEN(first) = f->nKeyLength;
- }
-
- if (s->nKeyLength == 0) {
- Z_TYPE(second) = IS_LONG;
- Z_LVAL(second) = s->h;
- } else {
- Z_TYPE(second) = IS_STRING;
- Z_STRVAL(second) = s->arKey;
- Z_STRLEN(second) = s->nKeyLength;
- }
-
- if (ARRAYG(compare_func)(&result, &first, &second) == FAILURE) {
- return 0;
- }
-
- if (Z_TYPE(result) == IS_DOUBLE) {
- if (Z_DVAL(result) < 0) {
- return -1;
- } else if (Z_DVAL(result) > 0) {
- return 1;
- } else {
- return 0;
- }
- }
-
- convert_to_long(&result);
-
- if (Z_LVAL(result) < 0) {
- return -1;
- } else if (Z_LVAL(result) > 0) {
- return 1;
- }
-
- return 0;
-}
-
-static int array_reverse_key_compare(const void *a, const void *b)
-{
- return array_key_compare(a,b)*-1;
-}
-
-/* {{{ proto int krsort(array array_arg [, int sort_flags])
- Sort an array reverse by key */
-PHP_FUNCTION(krsort)
-{
- zval **array, **sort_type;
- int sort_type_val = SORT_REGULAR;
- HashTable *target_hash;
-
- if (ZEND_NUM_ARGS() < 1 || ZEND_NUM_ARGS() > 2 ||
- zend_get_parameters_ex(ZEND_NUM_ARGS(), &array, &sort_type) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- target_hash = HASH_OF(*array);
- if (!target_hash) {
- php_error(E_WARNING, "Wrong datatype in krsort() call");
- return;
- }
- if (ZEND_NUM_ARGS() == 2) {
- convert_to_long_ex(sort_type);
- sort_type_val = Z_LVAL_PP(sort_type);
- }
- set_compare_func(sort_type_val);
- if (zend_hash_sort(target_hash, qsort, array_reverse_key_compare, 0) == FAILURE) {
- return;
- }
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int ksort(array array_arg [, int sort_flags])
- Sort an array by key */
-PHP_FUNCTION(ksort)
-{
- zval **array, **sort_type;
- int sort_type_val = SORT_REGULAR;
- HashTable *target_hash;
-
- if (ZEND_NUM_ARGS() < 1 || ZEND_NUM_ARGS() > 2 ||
- zend_get_parameters_ex(ZEND_NUM_ARGS(), &array, &sort_type) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- target_hash = HASH_OF(*array);
- if (!target_hash) {
- php_error(E_WARNING, "Wrong datatype in ksort() call");
- return;
- }
- if (ZEND_NUM_ARGS() == 2) {
- convert_to_long_ex(sort_type);
- sort_type_val = Z_LVAL_PP(sort_type);
- }
- set_compare_func(sort_type_val);
- if (zend_hash_sort(target_hash, qsort, array_key_compare,0) == FAILURE) {
- return;
- }
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int count(mixed var)
- Count the number of elements in a variable (usually an array) */
-PHP_FUNCTION(count)
-{
- pval **array;
- HashTable *target_hash;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &array) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- target_hash = HASH_OF(*array);
- if (!target_hash) {
- if (Z_TYPE_PP(array) == IS_NULL) {
- RETURN_LONG(0);
- } else {
- RETURN_LONG(1);
- }
- }
-
- RETURN_LONG(zend_hash_num_elements(target_hash));
-}
-/* }}} */
-
-/* Numbers are always smaller than strings int this function as it
- * anyway doesn't make much sense to compare two different data types.
- * This keeps it consistant and simple.
- *
- * This is not correct any more, depends on what compare_func is set to.
- */
-static int array_data_compare(const void *a, const void *b)
-{
- Bucket *f;
- Bucket *s;
- pval result;
- pval *first;
- pval *second;
- ARRAYLS_FETCH();
-
- f = *((Bucket **) a);
- s = *((Bucket **) b);
-
- first = *((pval **) f->pData);
- second = *((pval **) s->pData);
-
- if (ARRAYG(compare_func)(&result, first, second) == FAILURE) {
- return 0;
- }
-
- if (Z_TYPE(result) == IS_DOUBLE) {
- if (Z_DVAL(result) < 0) {
- return -1;
- } else if (Z_DVAL(result) > 0) {
- return 1;
- } else {
- return 0;
- }
- }
-
- convert_to_long(&result);
-
- if (Z_LVAL(result) < 0) {
- return -1;
- } else if (Z_LVAL(result) > 0) {
- return 1;
- }
-
- return 0;
-}
-
-static int array_reverse_data_compare(const void *a, const void *b)
-{
- return array_data_compare(a,b)*-1;
-}
-
-static int array_natural_general_compare(const void *a, const void *b, int fold_case)
-{
- Bucket *f, *s;
- zval *fval, *sval;
- zval first, second;
- int result;
-
- f = *((Bucket **) a);
- s = *((Bucket **) b);
-
- fval = *((pval **) f->pData);
- sval = *((pval **) s->pData);
- first = *fval;
- second = *sval;
- if (Z_TYPE_P(fval) != IS_STRING) {
- zval_copy_ctor(&first);
- convert_to_string(&first);
- }
- if (Z_TYPE_P(sval) != IS_STRING) {
- zval_copy_ctor(&first);
- convert_to_string(&second);
- }
-
- result = strnatcmp_ex(Z_STRVAL(first), Z_STRLEN(first),
- Z_STRVAL(second), Z_STRLEN(second), fold_case);
-
- if (Z_TYPE_P(fval) != IS_STRING)
- zval_dtor(&first);
- if (Z_TYPE_P(sval) != IS_STRING)
- zval_dtor(&second);
-
- return result;
-}
-
-static int array_natural_compare(const void *a, const void *b)
-{
- return array_natural_general_compare(a, b, 0);
-}
-
-static int array_natural_case_compare(const void *a, const void *b)
-{
- return array_natural_general_compare(a, b, 1);
-}
-
-static void php_natsort(INTERNAL_FUNCTION_PARAMETERS, int fold_case)
-{
- zval **array;
- HashTable *target_hash;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &array) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- target_hash = HASH_OF(*array);
- if (!target_hash) {
- php_error(E_WARNING, "Wrong datatype in %s() call",
- get_active_function_name());
- return;
- }
-
- if (fold_case) {
- if (zend_hash_sort(target_hash, qsort, array_natural_case_compare, 0) == FAILURE) {
- return;
- }
- } else {
- if (zend_hash_sort(target_hash, qsort, array_natural_compare, 0) == FAILURE) {
- return;
- }
- }
-
- RETURN_TRUE;
-}
-
-
-/* {{{ proto void natsort(array array_arg)
- Sort an array using natural sort */
-PHP_FUNCTION(natsort)
-{
- php_natsort(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-/* }}} */
-
-
-/* {{{ proto void natcasesort(array array_arg)
- Sort an array using case-insensitive natural sort */
-PHP_FUNCTION(natcasesort)
-{
- php_natsort(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
-}
-/* }}} */
-
-
-/* {{{ proto void asort(array array_arg [, int sort_flags])
- Sort an array and maintain index association */
-PHP_FUNCTION(asort)
-{
- zval **array, **sort_type;
- int sort_type_val = SORT_REGULAR;
- HashTable *target_hash;
-
- if (ZEND_NUM_ARGS() < 1 || ZEND_NUM_ARGS() > 2 ||
- zend_get_parameters_ex(ZEND_NUM_ARGS(), &array, &sort_type) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- target_hash = HASH_OF(*array);
- if (!target_hash) {
- php_error(E_WARNING, "Wrong datatype in asort() call");
- return;
- }
- if (ZEND_NUM_ARGS() == 2) {
- convert_to_long_ex(sort_type);
- sort_type_val = Z_LVAL_PP(sort_type);
- }
- set_compare_func(sort_type_val);
- if (zend_hash_sort(target_hash, qsort, array_data_compare,0) == FAILURE) {
- return;
- }
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void arsort(array array_arg [, int sort_flags])
- Sort an array in reverse order and maintain index association */
-PHP_FUNCTION(arsort)
-{
- zval **array, **sort_type;
- int sort_type_val = SORT_REGULAR;
- HashTable *target_hash;
-
- if (ZEND_NUM_ARGS() < 1 || ZEND_NUM_ARGS() > 2 ||
- zend_get_parameters_ex(ZEND_NUM_ARGS(), &array, &sort_type) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- target_hash = HASH_OF(*array);
- if (!target_hash) {
- php_error(E_WARNING, "Wrong datatype in arsort() call");
- RETURN_FALSE;
- }
- if (ZEND_NUM_ARGS() == 2) {
- convert_to_long_ex(sort_type);
- sort_type_val = Z_LVAL_PP(sort_type);
- }
- set_compare_func(sort_type_val);
- if (zend_hash_sort(target_hash, qsort, array_reverse_data_compare,0) == FAILURE) {
- RETURN_FALSE;
- }
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void sort(array array_arg [, int sort_flags])
- Sort an array */
-PHP_FUNCTION(sort)
-{
- zval **array, **sort_type;
- int sort_type_val = SORT_REGULAR;
- HashTable *target_hash;
-
- if (ZEND_NUM_ARGS() < 1 || ZEND_NUM_ARGS() > 2 ||
- zend_get_parameters_ex(ZEND_NUM_ARGS(), &array, &sort_type) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- target_hash = HASH_OF(*array);
- if (!target_hash) {
- php_error(E_WARNING, "Wrong datatype in sort() call");
- RETURN_FALSE;
- }
- if (ZEND_NUM_ARGS() == 2) {
- convert_to_long_ex(sort_type);
- sort_type_val = Z_LVAL_PP(sort_type);
- }
- set_compare_func(sort_type_val);
- if (zend_hash_sort(target_hash, qsort, array_data_compare,1) == FAILURE) {
- RETURN_FALSE;
- }
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void rsort(array array_arg [, int sort_flags])
- Sort an array in reverse order */
-PHP_FUNCTION(rsort)
-{
- zval **array, **sort_type;
- int sort_type_val = SORT_REGULAR;
- HashTable *target_hash;
-
- if (ZEND_NUM_ARGS() < 1 || ZEND_NUM_ARGS() > 2 ||
- zend_get_parameters_ex(ZEND_NUM_ARGS(), &array, &sort_type) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- target_hash = HASH_OF(*array);
- if (!target_hash) {
- php_error(E_WARNING, "Wrong datatype in rsort() call");
- RETURN_FALSE;
- }
- if (ZEND_NUM_ARGS() == 2) {
- convert_to_long_ex(sort_type);
- sort_type_val = Z_LVAL_PP(sort_type);
- }
- set_compare_func(sort_type_val);
- if (zend_hash_sort(target_hash, qsort, array_reverse_data_compare,1) == FAILURE) {
- RETURN_FALSE;
- }
- RETURN_TRUE;
-}
-
-
-static int array_user_compare(const void *a, const void *b)
-{
- Bucket *f;
- Bucket *s;
- pval **args[2];
- pval *retval_ptr;
- ELS_FETCH();
- BLS_FETCH();
-
- f = *((Bucket **) a);
- s = *((Bucket **) b);
-
- args[0] = (pval **) f->pData;
- args[1] = (pval **) s->pData;
-
- if (call_user_function_ex(EG(function_table), NULL, *BG(user_compare_func_name), &retval_ptr, 2, args, 0, NULL)==SUCCESS
- && retval_ptr) {
- long retval;
-
- convert_to_long_ex(&retval_ptr);
- retval = Z_LVAL_P(retval_ptr);
- zval_ptr_dtor(&retval_ptr);
- return retval;
- } else {
- return 0;
- }
-}
-
-/* {{{ proto void usort(array array_arg, string cmp_function)
- Sort an array by values using a user-defined comparison function */
-PHP_FUNCTION(usort)
-{
- pval **array;
- pval **old_compare_func;
- HashTable *target_hash;
- BLS_FETCH();
-
- old_compare_func = BG(user_compare_func_name);
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &array, &BG(user_compare_func_name)) == FAILURE) {
- BG(user_compare_func_name) = old_compare_func;
- WRONG_PARAM_COUNT;
- }
- target_hash = HASH_OF(*array);
- if (!target_hash) {
- php_error(E_WARNING, "Wrong datatype in usort() call");
- BG(user_compare_func_name) = old_compare_func;
- RETURN_FALSE;
- }
- if (zend_hash_sort(target_hash, qsort, array_user_compare, 1) == FAILURE) {
- BG(user_compare_func_name) = old_compare_func;
- RETURN_FALSE;
- }
- BG(user_compare_func_name) = old_compare_func;
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void uasort(array array_arg, string cmp_function)
- Sort an array with a user-defined comparison function and maintain index association */
-PHP_FUNCTION(uasort)
-{
- pval **array;
- pval **old_compare_func;
- HashTable *target_hash;
- BLS_FETCH();
-
- old_compare_func = BG(user_compare_func_name);
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &array, &BG(user_compare_func_name)) == FAILURE) {
- BG(user_compare_func_name) = old_compare_func;
- WRONG_PARAM_COUNT;
- }
- target_hash = HASH_OF(*array);
- if (!target_hash) {
- php_error(E_WARNING, "Wrong datatype in uasort() call");
- BG(user_compare_func_name) = old_compare_func;
- RETURN_FALSE;
- }
- if (zend_hash_sort(target_hash, qsort, array_user_compare, 0) == FAILURE) {
- BG(user_compare_func_name) = old_compare_func;
- RETURN_FALSE;
- }
- BG(user_compare_func_name) = old_compare_func;
- RETURN_TRUE;
-}
-/* }}} */
-
-static int array_user_key_compare(const void *a, const void *b)
-{
- Bucket *f;
- Bucket *s;
- pval key1, key2;
- pval *args[2];
- pval retval;
- int status;
- ELS_FETCH();
- BLS_FETCH();
-
- args[0] = &key1;
- args[1] = &key2;
- INIT_PZVAL(&key1);
- INIT_PZVAL(&key2);
-
- f = *((Bucket **) a);
- s = *((Bucket **) b);
-
- if (f->nKeyLength) {
- Z_STRVAL(key1) = estrndup(f->arKey, f->nKeyLength);
- Z_STRLEN(key1) = f->nKeyLength-1;
- Z_TYPE(key1) = IS_STRING;
- } else {
- Z_LVAL(key1) = f->h;
- Z_TYPE(key1) = IS_LONG;
- }
- if (s->nKeyLength) {
- Z_STRVAL(key2) = estrndup(s->arKey, s->nKeyLength);
- Z_STRLEN(key2) = s->nKeyLength-1;
- Z_TYPE(key2) = IS_STRING;
- } else {
- Z_LVAL(key2) = s->h;
- Z_TYPE(key2) = IS_LONG;
- }
-
- status = call_user_function(EG(function_table), NULL, *BG(user_compare_func_name), &retval, 2, args);
-
- zval_dtor(&key1);
- zval_dtor(&key2);
-
- if (status==SUCCESS) {
- convert_to_long(&retval);
- return Z_LVAL(retval);
- } else {
- return 0;
- }
-}
-
-/* {{{ proto void uksort(array array_arg, string cmp_function)
- Sort an array by keys using a user-defined comparison function */
-PHP_FUNCTION(uksort)
-{
- pval **array;
- pval **old_compare_func;
- HashTable *target_hash;
- BLS_FETCH();
-
- old_compare_func = BG(user_compare_func_name);
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &array, &BG(user_compare_func_name)) == FAILURE) {
- BG(user_compare_func_name) = old_compare_func;
- WRONG_PARAM_COUNT;
- }
- target_hash = HASH_OF(*array);
- if (!target_hash) {
- php_error(E_WARNING, "Wrong datatype in uksort() call");
- BG(user_compare_func_name) = old_compare_func;
- RETURN_FALSE;
- }
- if (zend_hash_sort(target_hash, qsort, array_user_key_compare, 0) == FAILURE) {
- BG(user_compare_func_name) = old_compare_func;
- RETURN_FALSE;
- }
- BG(user_compare_func_name) = old_compare_func;
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto mixed end(array array_arg)
- Advances array argument's internal pointer to the last element and return it */
-PHP_FUNCTION(end)
-{
- pval **array, **entry;
- HashTable *target_hash;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &array) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- target_hash = HASH_OF(*array);
- if (!target_hash) {
- php_error(E_WARNING, "Variable passed to end() is not an array or object");
- RETURN_FALSE;
- }
- zend_hash_internal_pointer_end(target_hash);
-
- if (return_value_used) {
- if (zend_hash_get_current_data(target_hash, (void **) &entry) == FAILURE) {
- RETURN_FALSE;
- }
-
- *return_value = **entry;
- zval_copy_ctor(return_value);
- }
-}
-/* }}} */
-
-/* {{{ proto mixed prev(array array_arg)
- Move array argument's internal pointer to the previous element and return it */
-PHP_FUNCTION(prev)
-{
- pval **array, **entry;
- HashTable *target_hash;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &array) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- target_hash = HASH_OF(*array);
- if (!target_hash) {
- php_error(E_WARNING, "Variable passed to prev() is not an array or object");
- RETURN_FALSE;
- }
- zend_hash_move_backwards(target_hash);
-
- if (return_value_used) {
- if (zend_hash_get_current_data(target_hash, (void **) &entry) == FAILURE) {
- RETURN_FALSE;
- }
-
- *return_value = **entry;
- zval_copy_ctor(return_value);
- }
-}
-/* }}} */
-
-/* {{{ proto mixed next(array array_arg)
- Move array argument's internal pointer to the next element and return it */
-PHP_FUNCTION(next)
-{
- pval **array, **entry;
- HashTable *target_hash;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &array) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- target_hash = HASH_OF(*array);
- if (!target_hash) {
- php_error(E_WARNING, "Variable passed to next() is not an array or object");
- RETURN_FALSE;
- }
- zend_hash_move_forward(target_hash);
-
- if (return_value_used) {
- if (zend_hash_get_current_data(target_hash, (void **) &entry) == FAILURE) {
- RETURN_FALSE;
- }
-
- *return_value = **entry;
- zval_copy_ctor(return_value);
- }
-}
-/* }}} */
-
-/* {{{ proto mixed reset(array array_arg)
- Set array argument's internal pointer to the first element and return it */
-PHP_FUNCTION(reset)
-{
- pval **array, **entry;
- HashTable *target_hash;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &array) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- target_hash = HASH_OF(*array);
- if (!target_hash) {
- php_error(E_WARNING, "Variable passed to reset() is not an array or object");
- RETURN_FALSE;
- }
- zend_hash_internal_pointer_reset(target_hash);
-
- if (return_value_used) {
- if (zend_hash_get_current_data(target_hash, (void **) &entry) == FAILURE) {
- RETURN_FALSE;
- }
-
- *return_value = **entry;
- zval_copy_ctor(return_value);
- }
-}
-/* }}} */
-
-/* {{{ proto mixed current(array array_arg)
- Return the element currently pointed to by the internal array pointer */
-PHP_FUNCTION(current)
-{
- pval **array, **entry;
- HashTable *target_hash;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &array) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- target_hash = HASH_OF(*array);
- if (!target_hash) {
- php_error(E_WARNING, "Variable passed to current() is not an array or object");
- RETURN_FALSE;
- }
- if (zend_hash_get_current_data(target_hash, (void **) &entry) == FAILURE) {
- RETURN_FALSE;
- }
- *return_value = **entry;
- zval_copy_ctor(return_value);
-}
-/* }}} */
-
-/* {{{ proto mixed key(array array_arg)
- Return the key of the element currently pointed to by the internal array pointer */
-PHP_FUNCTION(key)
-{
- pval **array;
- char *string_key;
- ulong num_key;
- HashTable *target_hash;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &array) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- target_hash = HASH_OF(*array);
- if (!target_hash) {
- php_error(E_WARNING, "Variable passed to key() is not an array or object");
- RETURN_FALSE;
- }
- switch (zend_hash_get_current_key(target_hash, &string_key, &num_key, 1)) {
- case HASH_KEY_IS_STRING:
- RETVAL_STRING(string_key, 0);
- break;
- case HASH_KEY_IS_LONG:
- RETVAL_LONG(num_key);
- break;
- case HASH_KEY_NON_EXISTANT:
- return;
- }
-}
-/* }}} */
-
-/* {{{ proto mixed min(mixed arg1 [, mixed arg2 [, mixed ...]])
- Return the lowest value in an array or a series of arguments */
-PHP_FUNCTION(min)
-{
- int argc=ZEND_NUM_ARGS();
- pval **result;
-
- if (argc<=0) {
- php_error(E_WARNING, "min: must be passed at least 1 value");
- RETURN_NULL();
- }
- set_compare_func(SORT_REGULAR);
- if (argc == 1) {
- pval **arr;
-
- if (zend_get_parameters_ex(1, &arr) == FAILURE || Z_TYPE_PP(arr) != IS_ARRAY) {
- WRONG_PARAM_COUNT;
- }
- if (zend_hash_minmax(Z_ARRVAL_PP(arr), array_data_compare, 0, (void **) &result)==SUCCESS) {
- *return_value = **result;
- zval_copy_ctor(return_value);
- } else {
- php_error(E_WARNING, "min: array must contain at least 1 element");
- RETURN_FALSE;
- }
- } else {
- pval ***args = (pval ***) emalloc(sizeof(pval **)*ZEND_NUM_ARGS());
- pval **min, result;
- int i;
-
- if (zend_get_parameters_array_ex(ZEND_NUM_ARGS(), args)==FAILURE) {
- efree(args);
- WRONG_PARAM_COUNT;
- }
-
- min = args[0];
-
- for (i=1; i<ZEND_NUM_ARGS(); i++) {
- is_smaller_function(&result, *args[i], *min);
- if (Z_LVAL(result) == 1) {
- min = args[i];
- }
- }
-
- *return_value = **min;
- zval_copy_ctor(return_value);
-
- efree(args);
- }
-}
-/* }}} */
-
-/* {{{ proto mixed max(mixed arg1 [, mixed arg2 [, mixed ...]])
- Return the highest value in an array or a series of arguments */
-PHP_FUNCTION(max)
-{
- int argc=ZEND_NUM_ARGS();
- pval **result;
-
- if (argc<=0) {
- php_error(E_WARNING, "max: must be passed at least 1 value");
- RETURN_NULL();
- }
- set_compare_func(SORT_REGULAR);
- if (argc == 1) {
- pval **arr;
-
- if (zend_get_parameters_ex(1, &arr) == FAILURE || Z_TYPE_PP(arr) != IS_ARRAY) {
- WRONG_PARAM_COUNT;
- }
- if (zend_hash_minmax(Z_ARRVAL_PP(arr), array_data_compare, 1, (void **) &result)==SUCCESS) {
- *return_value = **result;
- zval_copy_ctor(return_value);
- } else {
- php_error(E_WARNING, "max: array must contain at least 1 element");
- RETURN_FALSE;
- }
- } else {
- pval ***args = (pval ***) emalloc(sizeof(pval **)*ZEND_NUM_ARGS());
- pval **max, result;
- int i;
-
- if (zend_get_parameters_array_ex(ZEND_NUM_ARGS(), args)==FAILURE) {
- efree(args);
- WRONG_PARAM_COUNT;
- }
-
- max = args[0];
-
- for (i=1; i<ZEND_NUM_ARGS(); i++) {
- is_smaller_or_equal_function(&result, *args[i], *max);
- if (Z_LVAL(result) == 0) {
- max = args[i];
- }
- }
-
- *return_value = **max;
- zval_copy_ctor(return_value);
-
- efree(args);
- }
-}
-/* }}} */
-
-static int php_array_walk(HashTable *target_hash, zval **userdata)
-{
- zval **args[3], /* Arguments to userland function */
- *retval_ptr, /* Return value - unused */
- *key; /* Entry key */
- char *string_key;
- ulong string_key_len;
- ulong num_key;
- HashPosition pos;
- BLS_FETCH();
- ELS_FETCH();
-
- /* Allocate space for key */
- MAKE_STD_ZVAL(key);
-
- /* Set up known arguments */
- args[1] = &key;
- args[2] = userdata;
-
- zend_hash_internal_pointer_reset_ex(target_hash, &pos);
-
- /* Iterate through hash */
- while(zend_hash_get_current_data_ex(target_hash, (void **)&args[0], &pos) == SUCCESS) {
- /* Set up the key */
- if (zend_hash_get_current_key_ex(target_hash, &string_key, &string_key_len, &num_key, 0, &pos) == HASH_KEY_IS_LONG) {
- Z_TYPE_P(key) = IS_LONG;
- Z_LVAL_P(key) = num_key;
- } else {
- Z_TYPE_P(key) = IS_STRING;
- Z_STRVAL_P(key) = string_key;
- Z_STRLEN_P(key) = string_key_len-1;
- }
-
- /* Call the userland function */
- if (call_user_function_ex(EG(function_table), NULL, *BG(array_walk_func_name),
- &retval_ptr, userdata ? 3 : 2, args, 0, NULL) == SUCCESS) {
-
- zval_ptr_dtor(&retval_ptr);
- } else
- php_error(E_WARNING,"Unable to call %s() - function does not exist",
- (*BG(array_walk_func_name))->value.str.val);
-
- zend_hash_move_forward_ex(target_hash, &pos);
- }
- efree(key);
-
- return 0;
-}
-
-/* {{{ proto int array_walk(array input, string funcname [, mixed userdata])
- Apply a user function to every member of an array */
-PHP_FUNCTION(array_walk) {
- int argc;
- zval **array,
- **userdata = NULL,
- **old_walk_func_name;
- HashTable *target_hash;
- BLS_FETCH();
-
- argc = ZEND_NUM_ARGS();
- old_walk_func_name = BG(array_walk_func_name);
- if (argc < 2 || argc > 3 ||
- zend_get_parameters_ex(argc, &array, &BG(array_walk_func_name), &userdata) == FAILURE) {
- BG(array_walk_func_name) = old_walk_func_name;
- WRONG_PARAM_COUNT;
- }
- target_hash = HASH_OF(*array);
- if (!target_hash) {
- php_error(E_WARNING, "Wrong datatype in %s() call",
- get_active_function_name());
- BG(array_walk_func_name) = old_walk_func_name;
- RETURN_FALSE;
- }
- if (Z_TYPE_PP(BG(array_walk_func_name)) != IS_ARRAY &&
- Z_TYPE_PP(BG(array_walk_func_name)) != IS_STRING) {
- php_error(E_WARNING, "Wrong syntax for function name in %s() call",
- get_active_function_name());
- BG(array_walk_func_name) = old_walk_func_name;
- RETURN_FALSE;
- }
- php_array_walk(target_hash, userdata);
- BG(array_walk_func_name) = old_walk_func_name;
- RETURN_TRUE;
-}
-/* }}} */
-
-/* void php_search_array(INTERNAL_FUNCTION_PARAMETERS, int behavior)
- * 0 = return boolean
- * 1 = return key
- */
-static void php_search_array(INTERNAL_FUNCTION_PARAMETERS, int behavior)
-{
- zval **value, /* value to check for */
- **array, /* array to check in */
- **strict, /* strict comparison or not */
- **entry, /* pointer to array entry */
- res; /* comparison result */
- HashTable *target_hash; /* array hashtable */
- HashPosition pos; /* hash iterator */
- ulong num_key;
- char *string_key;
- int (*compare_func)(zval *, zval *, zval *) = is_equal_function;
-
- if (ZEND_NUM_ARGS() < 2 || ZEND_NUM_ARGS() > 3 ||
- zend_get_parameters_ex(ZEND_NUM_ARGS(), &value, &array, &strict) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if (Z_TYPE_PP(value) == IS_ARRAY || Z_TYPE_PP(value) == IS_OBJECT) {
- php_error(E_WARNING, "Wrong datatype for first argument in call to %s", get_active_function_name());
- RETURN_FALSE;
- }
-
- if (Z_TYPE_PP(array) != IS_ARRAY) {
- php_error(E_WARNING, "Wrong datatype for second argument in call to %s", get_active_function_name());
- RETURN_FALSE;
- }
-
- if (ZEND_NUM_ARGS() == 3) {
- convert_to_boolean_ex(strict);
- if (Z_LVAL_PP(strict)) {
- compare_func = is_identical_function;
- }
- }
-
- target_hash = HASH_OF(*array);
- zend_hash_internal_pointer_reset_ex(target_hash, &pos);
- while(zend_hash_get_current_data_ex(target_hash, (void **)&entry, &pos) == SUCCESS) {
- compare_func(&res, *value, *entry);
- if (Z_LVAL(res) == 1) {
- if (behavior==0) {
- RETURN_TRUE;
- } else {
- /* Return current key */
- switch (zend_hash_get_current_key_ex(target_hash, &string_key, NULL, &num_key, 1, &pos)) {
- case HASH_KEY_IS_STRING:
- RETVAL_STRING(string_key, 0);
- break;
- case HASH_KEY_IS_LONG:
- RETVAL_LONG(num_key);
- break;
- }
- }
- }
-
- zend_hash_move_forward_ex(target_hash, &pos);
- }
-
- if (behavior == 0) {
- RETURN_FALSE;
- } else {
- return;
- }
-}
-
-
-/* {{{ proto bool in_array(mixed needle, array haystack [, bool strict])
- Checks if the given value exists in the array */
-PHP_FUNCTION(in_array)
-{
- php_search_array(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-/* }}} */
-
-/* {{{ proto mixed array_search(mixed needle, array haystack [, bool strict])
- Searches the array for a given value and returns the corresponding key if successful */
-PHP_FUNCTION(array_search)
-{
- php_search_array(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
-}
-/* }}} */
-
-
-static int php_valid_var_name(char *var_name)
-{
- int len, i;
-
- if (!var_name)
- return 0;
-
- len = strlen(var_name);
-
- if (!isalpha((int)var_name[0]) && var_name[0] != '_')
- return 0;
-
- if (len > 1) {
- for(i=1; i<len; i++) {
- if (!isalnum((int)var_name[i]) && var_name[i] != '_') {
- return 0;
- }
- }
- }
-
- return 1;
-}
-
-
-/* {{{ proto int extract(array var_array [, int extract_type [, string prefix]])
- Imports variables into symbol table from an array */
-PHP_FUNCTION(extract)
-{
- zval **var_array, **z_extract_type, **prefix;
- zval **entry, *data;
- char *var_name, *final_name;
- ulong num_key, var_name_len;
- int var_exists, extract_type, key_type, count = 0;
- HashPosition pos;
-
- switch(ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &var_array) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- extract_type = EXTR_OVERWRITE;
- break;
-
- case 2:
- if (zend_get_parameters_ex(2, &var_array, &z_extract_type) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(z_extract_type);
- extract_type = Z_LVAL_PP(z_extract_type);
- if (extract_type > EXTR_SKIP && extract_type <= EXTR_PREFIX_INVALID) {
- php_error(E_WARNING, "%s() expects a prefix to be specified",
- get_active_function_name());
- return;
- }
- break;
-
- case 3:
- if (zend_get_parameters_ex(3, &var_array, &z_extract_type, &prefix) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(z_extract_type);
- extract_type = Z_LVAL_PP(z_extract_type);
- convert_to_string_ex(prefix);
- break;
-
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- if (extract_type < EXTR_OVERWRITE || extract_type > EXTR_PREFIX_INVALID) {
- php_error(E_WARNING, "Unknown extract type in call to %s()",
- get_active_function_name());
- return;
- }
-
- if (Z_TYPE_PP(var_array) != IS_ARRAY) {
- php_error(E_WARNING, "%s() expects first argument to be an array",
- get_active_function_name());
- return;
- }
-
- zend_hash_internal_pointer_reset_ex(Z_ARRVAL_PP(var_array), &pos);
- while(zend_hash_get_current_data_ex(Z_ARRVAL_PP(var_array), (void **)&entry, &pos) == SUCCESS) {
- key_type = zend_hash_get_current_key_ex(Z_ARRVAL_PP(var_array), &var_name, &var_name_len, &num_key, 0, &pos);
- final_name = NULL;
- var_exists = 0;
-
- if (key_type == HASH_KEY_IS_STRING) {
- var_name_len--;
- var_exists = zend_hash_exists(EG(active_symbol_table), var_name, var_name_len + 1);
- } else if (extract_type == EXTR_PREFIX_ALL || extract_type == EXTR_PREFIX_INVALID) {
- final_name = emalloc(MAX_LENGTH_OF_LONG + Z_STRLEN_PP(prefix) + 2);
- zend_sprintf(final_name, "%s_%ld", Z_STRVAL_PP(prefix), num_key);
- } else {
- zend_hash_move_forward_ex(Z_ARRVAL_PP(var_array), &pos);
- continue;
- }
-
- switch (extract_type) {
- case EXTR_OVERWRITE:
- final_name = estrndup(var_name, var_name_len);
- break;
-
- case EXTR_PREFIX_SAME:
- if (!var_exists)
- final_name = estrndup(var_name, var_name_len);
- /* break omitted intentionally */
-
- case EXTR_PREFIX_ALL:
- if (!final_name) {
- final_name = emalloc(var_name_len + Z_STRLEN_PP(prefix) + 2);
- strcpy(final_name, Z_STRVAL_PP(prefix));
- strcat(final_name, "_");
- strcat(final_name, var_name);
- }
- break;
-
- case EXTR_PREFIX_INVALID:
- if (!final_name) {
- if (!php_valid_var_name(var_name)) {
- final_name = emalloc(var_name_len + Z_STRLEN_PP(prefix) + 2);
- strcpy(final_name, Z_STRVAL_PP(prefix));
- strcat(final_name, "_");
- strcat(final_name, var_name);
- } else
- final_name = estrndup(var_name, var_name_len);
- }
- break;
-
- default:
- if (!var_exists)
- final_name = estrndup(var_name, var_name_len);
- break;
- }
-
- if (final_name) {
- if (php_valid_var_name(final_name)) {
- MAKE_STD_ZVAL(data);
- *data = **entry;
- zval_copy_ctor(data);
-
- ZEND_SET_SYMBOL(EG(active_symbol_table), final_name, data);
-
- count++;
- }
- efree(final_name);
- }
-
- zend_hash_move_forward_ex(Z_ARRVAL_PP(var_array), &pos);
- }
-
- RETURN_LONG(count);
-}
-/* }}} */
-
-
-static void php_compact_var(HashTable *eg_active_symbol_table, zval *return_value, zval *entry)
-{
- zval **value_ptr, *value, *data;
-
- if (Z_TYPE_P(entry) == IS_STRING) {
- if (zend_hash_find(eg_active_symbol_table, Z_STRVAL_P(entry),
- Z_STRLEN_P(entry)+1, (void **)&value_ptr) != FAILURE) {
- value = *value_ptr;
- ALLOC_ZVAL(data);
- *data = *value;
- zval_copy_ctor(data);
- INIT_PZVAL(data);
-
- zend_hash_update(Z_ARRVAL_P(return_value), Z_STRVAL_P(entry),
- Z_STRLEN_P(entry)+1, &data, sizeof(zval *), NULL);
- }
- }
- else if (Z_TYPE_P(entry) == IS_ARRAY) {
- HashPosition pos;
-
- zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(entry), &pos);
- while (zend_hash_get_current_data_ex(Z_ARRVAL_P(entry), (void**)&value_ptr, &pos) == SUCCESS) {
- value = *value_ptr;
-
- php_compact_var(eg_active_symbol_table, return_value, value);
- zend_hash_move_forward_ex(Z_ARRVAL_P(entry), &pos);
- }
- }
-}
-
-
-/* {{{ proto array compact(mixed var_names [, mixed ...])
- Creates a hash containing variables and their values */
-PHP_FUNCTION(compact)
-{
- zval ***args; /* function arguments array */
- int i;
-
- args = (zval ***)emalloc(ZEND_NUM_ARGS() * sizeof(zval **));
-
- if (zend_get_parameters_array_ex(ZEND_NUM_ARGS(), args) == FAILURE) {
- efree(args);
- WRONG_PARAM_COUNT;
- }
-
- array_init(return_value);
-
- for (i=0; i<ZEND_NUM_ARGS(); i++) {
- php_compact_var(EG(active_symbol_table), return_value, *args[i]);
- }
-
- efree(args);
-}
-/* }}} */
-
-/* {{{ proto array range(int low, int high)
- Create an array containing the range of integers from low to high (inclusive) */
-PHP_FUNCTION(range)
-{
- zval **zlow, **zhigh;
- int low, high;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2,&zlow,&zhigh) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(zlow);
- convert_to_long_ex(zhigh);
- low = Z_LVAL_PP(zlow);
- high = Z_LVAL_PP(zhigh);
-
- /* allocate an array for return */
- if (array_init(return_value) == FAILURE) {
- RETURN_FALSE;
- }
-
- for (; low <= high; low++) {
- add_next_index_long(return_value, low);
- }
-}
-/* }}} */
-
-
-static int array_data_shuffle(const void *a, const void*b) {
- return (php_rand() % 2) ? 1 : -1;
-}
-
-
-/* {{{ proto int shuffle(array array_arg)
- Randomly shuffle the contents of an array */
-PHP_FUNCTION(shuffle)
-{
- zval **array;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &array) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- if (Z_TYPE_PP(array) != IS_ARRAY) {
- php_error(E_WARNING, "Wrong datatype in shuffle() call");
- RETURN_FALSE;
- }
- if (zend_hash_sort(Z_ARRVAL_PP(array), (sort_func_t)php_mergesort, array_data_shuffle, 1) == FAILURE) {
- RETURN_FALSE;
- }
- RETURN_TRUE;
-}
-/* }}} */
-
-
-/* HashTable* php_splice(HashTable *in_hash, int offset, int length,
- zval ***list, int list_count, HashTable **removed) */
-HashTable* php_splice(HashTable *in_hash, int offset, int length,
- zval ***list, int list_count, HashTable **removed)
-{
- HashTable *out_hash = NULL; /* Output hashtable */
- int num_in, /* Number of entries in the input hashtable */
- pos, /* Current position in the hashtable */
- i; /* Loop counter */
- Bucket *p; /* Pointer to hash bucket */
- zval *entry; /* Hash entry */
-
- /* If input hash doesn't exist, we have nothing to do */
- if (!in_hash)
- return NULL;
-
- /* Get number of entries in the input hash */
- num_in = zend_hash_num_elements(in_hash);
-
- /* Clamp the offset.. */
- if (offset > num_in)
- offset = num_in;
- else if (offset < 0 && (offset=num_in+offset) < 0)
- offset = 0;
-
- /* ..and the length */
- if (length < 0)
- length = num_in-offset+length;
- else if(offset+length > num_in)
- length = num_in-offset;
-
- /* Create and initialize output hash */
- ALLOC_HASHTABLE(out_hash);
- zend_hash_init(out_hash, 0, NULL, ZVAL_PTR_DTOR, 0);
-
- /* Start at the beginning of the input hash and copy
- entries to output hash until offset is reached */
- for (pos=0, p=in_hash->pListHead; pos<offset && p ; pos++, p=p->pListNext) {
- /* Get entry and increase reference count */
- entry = *((zval **)p->pData);
- entry->refcount++;
-
- /* Update output hash depending on key type */
- if (p->nKeyLength)
- zend_hash_update(out_hash, p->arKey, p->nKeyLength, &entry, sizeof(zval *), NULL);
- else
- zend_hash_next_index_insert(out_hash, &entry, sizeof(zval *), NULL);
- }
-
- /* If hash for removed entries exists, go until offset+length
- and copy the entries to it */
- if (removed != NULL) {
- for( ; pos<offset+length && p; pos++, p=p->pListNext) {
- entry = *((zval **)p->pData);
- entry->refcount++;
- if (p->nKeyLength)
- zend_hash_update(*removed, p->arKey, p->nKeyLength, &entry, sizeof(zval *), NULL);
- else
- zend_hash_next_index_insert(*removed, &entry, sizeof(zval *), NULL);
- }
- } else /* otherwise just skip those entries */
- for( ; pos<offset+length && p; pos++, p=p->pListNext);
-
- /* If there are entries to insert.. */
- if (list != NULL) {
- /* ..for each one, create a new zval, copy entry into it
- and copy it into the output hash */
- for (i=0; i<list_count; i++) {
- entry = *list[i];
- entry->refcount++;
- zend_hash_next_index_insert(out_hash, &entry, sizeof(zval *), NULL);
- }
- }
-
- /* Copy the remaining input hash entries to the output hash */
- for ( ; p ; p=p->pListNext) {
- entry = *((zval **)p->pData);
- entry->refcount++;
- if (p->nKeyLength)
- zend_hash_update(out_hash, p->arKey, p->nKeyLength, &entry, sizeof(zval *), NULL);
- else
- zend_hash_next_index_insert(out_hash, &entry, sizeof(zval *), NULL);
- }
-
- zend_hash_internal_pointer_reset(out_hash);
- return out_hash;
-}
-/* }}} */
-
-
-/* {{{ proto int array_push(array stack, mixed var [, mixed ...])
- Pushes elements onto the end of the array */
-PHP_FUNCTION(array_push)
-{
- zval ***args, /* Function arguments array */
- *stack, /* Input array */
- *new_var; /* Variable to be pushed */
- int i, /* Loop counter */
- argc; /* Number of function arguments */
-
- /* Get the argument count and check it */
- argc = ZEND_NUM_ARGS();
- if (argc < 2) {
- WRONG_PARAM_COUNT;
- }
-
- /* Allocate arguments array and get the arguments, checking for errors. */
- args = (zval ***)emalloc(argc * sizeof(zval **));
- if (zend_get_parameters_array_ex(argc, args) == FAILURE) {
- efree(args);
- WRONG_PARAM_COUNT;
- }
-
- /* Get first argument and check that it's an array */
- stack = *args[0];
- if (Z_TYPE_P(stack) != IS_ARRAY) {
- php_error(E_WARNING, "First argument to array_push() needs to be an array");
- efree(args);
- RETURN_FALSE;
- }
-
- /* For each subsequent argument, make it a reference, increase refcount,
- and add it to the end of the array */
- for (i=1; i<argc; i++) {
- new_var = *args[i];
- new_var->refcount++;
-
- zend_hash_next_index_insert(Z_ARRVAL_P(stack), &new_var, sizeof(zval *), NULL);
- }
-
- /* Clean up and return the number of values in the stack */
- efree(args);
- RETVAL_LONG(zend_hash_num_elements(Z_ARRVAL_P(stack)));
-}
-/* }}} */
-
-
-/* {{{ void _phpi_pop(INTERNAL_FUNCTION_PARAMETERS, int which_end) */
-static void _phpi_pop(INTERNAL_FUNCTION_PARAMETERS, int off_the_end)
-{
- zval **stack, /* Input stack */
- **val; /* Value to be popped */
- HashTable *new_hash; /* New stack */
-
- /* Get the arguments and do error-checking */
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &stack) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if (Z_TYPE_PP(stack) != IS_ARRAY) {
- php_error(E_WARNING, "The argument needs to be an array");
- return;
- }
-
- if (zend_hash_num_elements(Z_ARRVAL_PP(stack)) == 0) {
- return;
- }
-
- /* Get the first or last value and copy it into the return value */
- if (off_the_end)
- zend_hash_internal_pointer_end(Z_ARRVAL_PP(stack));
- else
- zend_hash_internal_pointer_reset(Z_ARRVAL_PP(stack));
- zend_hash_get_current_data(Z_ARRVAL_PP(stack), (void **)&val);
- *return_value = **val;
- zval_copy_ctor(return_value);
- INIT_PZVAL(return_value);
-
- /* Delete the first or last value */
- new_hash = php_splice(Z_ARRVAL_PP(stack), (off_the_end) ? -1 : 0, 1, NULL, 0, NULL);
- zend_hash_destroy(Z_ARRVAL_PP(stack));
- efree(Z_ARRVAL_PP(stack));
- Z_ARRVAL_PP(stack) = new_hash;
-}
-/* }}} */
-
-
-/* {{{ proto mixed array_pop(array stack)
- Pops an element off the end of the array */
-PHP_FUNCTION(array_pop)
-{
- _phpi_pop(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
-}
-/* }}} */
-
-
-/* {{{ proto mixed array_shift(array stack)
- Pops an element off the beginning of the array */
-PHP_FUNCTION(array_shift)
-{
- _phpi_pop(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-/* }}} */
-
-
-/* {{{ proto int array_unshift(array stack, mixed var [, mixed ...])
- Pushes elements onto the beginning of the array */
-PHP_FUNCTION(array_unshift)
-{
- zval ***args, /* Function arguments array */
- *stack; /* Input stack */
- HashTable *new_hash; /* New hashtable for the stack */
- int argc; /* Number of function arguments */
-
-
- /* Get the argument count and check it */
- argc = ZEND_NUM_ARGS();
- if (argc < 2) {
- WRONG_PARAM_COUNT;
- }
-
- /* Allocate arguments array and get the arguments, checking for errors. */
- args = (zval ***)emalloc(argc * sizeof(zval **));
- if (zend_get_parameters_array_ex(argc, args) == FAILURE) {
- efree(args);
- WRONG_PARAM_COUNT;
- }
-
- /* Get first argument and check that it's an array */
- stack = *args[0];
- if (Z_TYPE_P(stack) != IS_ARRAY) {
- php_error(E_WARNING, "First argument to array_unshift() needs to be an array");
- efree(args);
- RETURN_FALSE;
- }
-
- /* Use splice to insert the elements at the beginning. Destroy old
- hashtable and replace it with new one */
- new_hash = php_splice(Z_ARRVAL_P(stack), 0, 0, &args[1], argc-1, NULL);
- zend_hash_destroy(Z_ARRVAL_P(stack));
- efree(Z_ARRVAL_P(stack));
- Z_ARRVAL_P(stack) = new_hash;
-
- /* Clean up and return the number of elements in the stack */
- efree(args);
- RETVAL_LONG(zend_hash_num_elements(Z_ARRVAL_P(stack)));
-}
-/* }}} */
-
-
-/* {{{ proto array array_splice(array input, int offset [, int length [, array replacement]])
- Removes the elements designated by offset and length and replace them with supplied array */
-PHP_FUNCTION(array_splice)
-{
- zval ***args, /* Function arguments array */
- *array, /* Input array */
- ***repl = NULL; /* Replacement elements */
- HashTable *new_hash = NULL; /* Output array's hash */
- Bucket *p; /* Bucket used for traversing hash */
- int argc, /* Number of function arguments */
- i,
- offset,
- length,
- repl_num = 0; /* Number of replacement elements */
-
- /* Get the argument count and check it */
- argc = ZEND_NUM_ARGS();
- if (argc < 2 || argc > 4) {
- WRONG_PARAM_COUNT;
- }
-
- /* Allocate arguments array and get the arguments, checking for errors. */
- args = (zval ***)emalloc(argc * sizeof(zval **));
- if (zend_get_parameters_array_ex(argc, args) == FAILURE) {
- efree(args);
- WRONG_PARAM_COUNT;
- }
-
- /* Get first argument and check that it's an array */
- array = *args[0];
- if (Z_TYPE_P(array) != IS_ARRAY) {
- php_error(E_WARNING, "First argument to array_splice() should be an array");
- efree(args);
- return;
- }
-
- /* Get the next two arguments. If length is omitted,
- it's assumed to be until the end of the array */
- convert_to_long_ex(args[1]);
- offset = Z_LVAL_PP(args[1]);
- if (argc > 2) {
- convert_to_long_ex(args[2]);
- length = Z_LVAL_PP(args[2]);
- } else
- length = zend_hash_num_elements(Z_ARRVAL_P(array));
-
- if (argc == 4) {
- /* Make sure the last argument, if passed, is an array */
- convert_to_array_ex(args[3]);
-
- /* Create the array of replacement elements */
- repl_num = zend_hash_num_elements(Z_ARRVAL_PP(args[3]));
- repl = (zval ***)emalloc(repl_num * sizeof(zval **));
- for (p=Z_ARRVAL_PP(args[3])->pListHead, i=0; p; p=p->pListNext, i++) {
- repl[i] = ((zval **)p->pData);
- }
- }
-
- /* Initialize return value */
- array_init(return_value);
-
- /* Perform splice */
- new_hash = php_splice(Z_ARRVAL_P(array), offset, length,
- repl, repl_num,
- &Z_ARRVAL_P(return_value));
-
- /* Replace input array's hashtable with the new one */
- zend_hash_destroy(Z_ARRVAL_P(array));
- efree(Z_ARRVAL_P(array));
- Z_ARRVAL_P(array) = new_hash;
-
- /* Clean up */
- if (argc == 4)
- efree(repl);
- efree(args);
-}
-/* }}} */
-
-
-/* {{{ proto array array_slice(array input, int offset [, int length])
- Returns elements specified by offset and length */
-PHP_FUNCTION(array_slice)
-{
- zval **input, /* Input array */
- **offset, /* Offset to get elements from */
- **length, /* How many elements to get */
- **entry; /* An array entry */
- int offset_val, /* Value of the offset argument */
- length_val, /* Value of the length argument */
- num_in, /* Number of elements in the input array */
- pos, /* Current position in the array */
- argc; /* Number of function arguments */
-
- char *string_key;
- ulong string_key_len;
- ulong num_key;
- HashPosition hpos;
-
-
- /* Get the arguments and do error-checking */
- argc = ZEND_NUM_ARGS();
- if (argc < 2 || argc > 3 || zend_get_parameters_ex(argc, &input, &offset, &length)) {
- WRONG_PARAM_COUNT;
- }
-
- if (Z_TYPE_PP(input) != IS_ARRAY) {
- php_error(E_WARNING, "First argument to array_slice() should be an array");
- return;
- }
-
- /* Make sure offset and length are integers and assume
- we want all entries from offset to the end if length
- is not passed */
- convert_to_long_ex(offset);
- offset_val = Z_LVAL_PP(offset);
- if (argc == 3) {
- convert_to_long_ex(length);
- length_val = Z_LVAL_PP(length);
- } else
- length_val = zend_hash_num_elements(Z_ARRVAL_PP(input));
-
- /* Initialize returned array */
- array_init(return_value);
-
- /* Get number of entries in the input hash */
- num_in = zend_hash_num_elements(Z_ARRVAL_PP(input));
-
- /* Clamp the offset.. */
- if (offset_val > num_in)
- return;
- else if (offset_val < 0 && (offset_val=num_in+offset_val) < 0)
- offset_val = 0;
-
- /* ..and the length */
- if (length_val < 0)
- length_val = num_in-offset_val+length_val;
- else if(offset_val+length_val > num_in)
- length_val = num_in-offset_val;
-
- if (length_val == 0)
- return;
-
- /* Start at the beginning and go until we hit offset */
- pos = 0;
- zend_hash_internal_pointer_reset_ex(Z_ARRVAL_PP(input), &hpos);
- while(pos < offset_val &&
- zend_hash_get_current_data_ex(Z_ARRVAL_PP(input), (void **)&entry, &hpos) == SUCCESS) {
- pos++;
- zend_hash_move_forward_ex(Z_ARRVAL_PP(input), &hpos);
- }
-
- /* Copy elements from input array to the one that's returned */
- while(pos < offset_val+length_val &&
- zend_hash_get_current_data_ex(Z_ARRVAL_PP(input), (void **)&entry, &hpos) == SUCCESS) {
-
- (*entry)->refcount++;
-
- switch (zend_hash_get_current_key_ex(Z_ARRVAL_PP(input), &string_key, &string_key_len, &num_key, 0, &hpos)) {
- case HASH_KEY_IS_STRING:
- zend_hash_update(Z_ARRVAL_P(return_value), string_key, string_key_len,
- entry, sizeof(zval *), NULL);
- break;
-
- case HASH_KEY_IS_LONG:
- zend_hash_next_index_insert(Z_ARRVAL_P(return_value),
- entry, sizeof(zval *), NULL);
- break;
- }
- pos++;
- zend_hash_move_forward_ex(Z_ARRVAL_PP(input), &hpos);
- }
-}
-/* }}} */
-
-
-PHPAPI void php_array_merge(HashTable *dest, HashTable *src, int recursive)
-{
- zval **src_entry,
- **dest_entry;
- char *string_key;
- ulong string_key_len;
- ulong num_key;
- HashPosition pos;
-
- zend_hash_internal_pointer_reset_ex(src, &pos);
- while(zend_hash_get_current_data_ex(src, (void **)&src_entry, &pos) == SUCCESS) {
- switch (zend_hash_get_current_key_ex(src, &string_key, &string_key_len, &num_key, 0, &pos)) {
- case HASH_KEY_IS_STRING:
- if (recursive &&
- zend_hash_find(dest, string_key, string_key_len,
- (void **)&dest_entry) == SUCCESS) {
- convert_to_array_ex(dest_entry);
- convert_to_array_ex(src_entry);
- php_array_merge(Z_ARRVAL_PP(dest_entry),
- Z_ARRVAL_PP(src_entry), recursive);
- } else {
- (*src_entry)->refcount++;
-
- zend_hash_update(dest, string_key, strlen(string_key)+1,
- src_entry, sizeof(zval *), NULL);
- }
- break;
-
- case HASH_KEY_IS_LONG:
- (*src_entry)->refcount++;
- zend_hash_next_index_insert(dest, src_entry, sizeof(zval *), NULL);
- break;
- }
-
- zend_hash_move_forward_ex(src, &pos);
- }
-}
-
-static void php_array_merge_wrapper(INTERNAL_FUNCTION_PARAMETERS, int recursive)
-{
- zval ***args = NULL;
- int argc,
- i;
-
- /* Get the argument count and check it */
- argc = ZEND_NUM_ARGS();
- if (argc < 2) {
- WRONG_PARAM_COUNT;
- }
-
- /* Allocate arguments array and get the arguments, checking for errors. */
- args = (zval ***)emalloc(argc * sizeof(zval **));
- if (zend_get_parameters_array_ex(argc, args) == FAILURE) {
- efree(args);
- WRONG_PARAM_COUNT;
- }
-
- array_init(return_value);
-
- for (i=0; i<argc; i++) {
- convert_to_array_ex(args[i]);
- php_array_merge(Z_ARRVAL_P(return_value), Z_ARRVAL_PP(args[i]), recursive);
- }
-
- efree(args);
-}
-
-
-/* {{{ proto array array_merge(array arr1, array arr2 [, array ...])
- Merges elements from passed arrays into one array */
-PHP_FUNCTION(array_merge)
-{
- php_array_merge_wrapper(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-/* }}} */
-
-
-/* {{{ proto array array_merge_recursive(array arr1, array arr2 [, array ...])
- Recursively merges elements from passed arrays into one array */
-PHP_FUNCTION(array_merge_recursive)
-{
- php_array_merge_wrapper(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
-}
-/* }}} */
-
-
-/* {{{ proto array array_keys(array input [, mixed search_value])
- Return just the keys from the input array, optionally only for the specified search_value */
-PHP_FUNCTION(array_keys)
-{
- zval **input, /* Input array */
- **search_value, /* Value to search for */
- **entry, /* An entry in the input array */
- res, /* Result of comparison */
- *new_val; /* New value */
- int add_key; /* Flag to indicate whether a key should be added */
- char *string_key; /* String key */
- ulong string_key_len;
- ulong num_key; /* Numeric key */
- HashPosition pos;
-
- search_value = NULL;
-
- /* Get arguments and do error-checking */
- if (ZEND_NUM_ARGS() < 1 || ZEND_NUM_ARGS() > 2 ||
- zend_get_parameters_ex(ZEND_NUM_ARGS(), &input, &search_value) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if (Z_TYPE_PP(input) != IS_ARRAY) {
- php_error(E_WARNING, "First argument to array_keys() should be an array");
- return;
- }
-
- /* Initialize return array */
- array_init(return_value);
- add_key = 1;
-
- /* Go through input array and add keys to the return array */
- zend_hash_internal_pointer_reset_ex(Z_ARRVAL_PP(input), &pos);
- while(zend_hash_get_current_data_ex(Z_ARRVAL_PP(input), (void **)&entry, &pos) == SUCCESS) {
- if (search_value != NULL) {
- is_equal_function(&res, *search_value, *entry);
- add_key = zval_is_true(&res);
- }
-
- if (add_key) {
- MAKE_STD_ZVAL(new_val);
-
- switch (zend_hash_get_current_key_ex(Z_ARRVAL_PP(input), &string_key, &string_key_len, &num_key, 1, &pos)) {
- case HASH_KEY_IS_STRING:
- Z_TYPE_P(new_val) = IS_STRING;
- Z_STRVAL_P(new_val) = string_key;
- Z_STRLEN_P(new_val) = string_key_len-1;
- zend_hash_next_index_insert(Z_ARRVAL_P(return_value), &new_val,
- sizeof(zval *), NULL);
- break;
-
- case HASH_KEY_IS_LONG:
- Z_TYPE_P(new_val) = IS_LONG;
- Z_LVAL_P(new_val) = num_key;
- zend_hash_next_index_insert(Z_ARRVAL_P(return_value), &new_val,
- sizeof(zval *), NULL);
- break;
- }
- }
-
- zend_hash_move_forward_ex(Z_ARRVAL_PP(input), &pos);
- }
-}
-/* }}} */
-
-
-/* {{{ proto array array_values(array input)
- Return just the values from the input array */
-PHP_FUNCTION(array_values)
-{
- zval **input, /* Input array */
- **entry; /* An entry in the input array */
- HashPosition pos;
-
- /* Get arguments and do error-checking */
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(ZEND_NUM_ARGS(), &input) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if (Z_TYPE_PP(input) != IS_ARRAY) {
- php_error(E_WARNING, "Argument to array_values() should be an array");
- return;
- }
-
- /* Initialize return array */
- array_init(return_value);
-
- /* Go through input array and add values to the return array */
- zend_hash_internal_pointer_reset_ex(Z_ARRVAL_PP(input), &pos);
- while(zend_hash_get_current_data_ex(Z_ARRVAL_PP(input), (void **)&entry, &pos) == SUCCESS) {
-
- (*entry)->refcount++;
- zend_hash_next_index_insert(Z_ARRVAL_P(return_value), entry,
- sizeof(zval *), NULL);
-
- zend_hash_move_forward_ex(Z_ARRVAL_PP(input), &pos);
- }
-}
-/* }}} */
-
-
-/* {{{ proto array array_count_values(array input)
- Return the value as key and the frequency of that value in input as value */
-PHP_FUNCTION(array_count_values)
-{
- zval **input, /* Input array */
- **entry; /* An entry in the input array */
- zval **tmp;
- HashTable *myht;
- HashPosition pos;
-
- /* Get arguments and do error-checking */
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &input) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if (Z_TYPE_PP(input) != IS_ARRAY) {
- php_error(E_WARNING, "Argument to array_count_values() should be an array");
- return;
- }
-
- /* Initialize return array */
- array_init(return_value);
-
- /* Go through input array and add values to the return array */
- myht = Z_ARRVAL_PP(input);
- zend_hash_internal_pointer_reset_ex(myht, &pos);
- while (zend_hash_get_current_data_ex(myht, (void **)&entry, &pos) == SUCCESS) {
- if (Z_TYPE_PP(entry) == IS_LONG) {
- if (zend_hash_index_find(Z_ARRVAL_P(return_value),
- Z_LVAL_PP(entry),
- (void**)&tmp) == FAILURE) {
- zval *data;
- MAKE_STD_ZVAL(data);
- Z_TYPE_P(data) = IS_LONG;
- Z_LVAL_P(data) = 1;
- zend_hash_index_update(Z_ARRVAL_P(return_value),Z_LVAL_PP(entry), &data, sizeof(data), NULL);
- } else {
- Z_LVAL_PP(tmp)++;
- }
- } else if (Z_TYPE_PP(entry) == IS_STRING) {
- if (zend_hash_find(Z_ARRVAL_P(return_value),
- Z_STRVAL_PP(entry),
- Z_STRLEN_PP(entry)+1,
- (void**)&tmp) == FAILURE) {
- zval *data;
- MAKE_STD_ZVAL(data);
- Z_TYPE_P(data) = IS_LONG;
- Z_LVAL_P(data) = 1;
- zend_hash_update(Z_ARRVAL_P(return_value),Z_STRVAL_PP(entry),Z_STRLEN_PP(entry) + 1, &data, sizeof(data), NULL);
- } else {
- Z_LVAL_PP(tmp)++;
- }
- } else {
- php_error(E_WARNING, "Can only count STRING and INTEGER values!");
- }
-
- zend_hash_move_forward_ex(myht, &pos);
- }
-}
-/* }}} */
-
-
-/* {{{ proto array array_reverse(array input [, bool preserve keys])
- Return input as a new array with the order of the entries reversed */
-PHP_FUNCTION(array_reverse)
-{
- zval **input, /* Input array */
- **z_preserve_keys, /* Flag: whether to preserve keys */
- **entry; /* An entry in the input array */
- char *string_key;
- ulong string_key_len;
- ulong num_key;
- zend_bool preserve_keys = 0;
- HashPosition pos;
-
- /* Get arguments and do error-checking */
- if (ZEND_NUM_ARGS() < 1 || ZEND_NUM_ARGS() > 2 ||
- zend_get_parameters_ex(ZEND_NUM_ARGS(), &input, &z_preserve_keys) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if (Z_TYPE_PP(input) != IS_ARRAY) {
- php_error(E_WARNING, "Argument to array_reverse() should be an array");
- return;
- }
-
- if (ZEND_NUM_ARGS() > 1) {
- convert_to_boolean_ex(z_preserve_keys);
- preserve_keys = Z_BVAL_PP(z_preserve_keys);
- }
-
- /* Initialize return array */
- array_init(return_value);
-
- zend_hash_internal_pointer_end_ex(Z_ARRVAL_PP(input), &pos);
- while(zend_hash_get_current_data_ex(Z_ARRVAL_PP(input), (void **)&entry, &pos) == SUCCESS) {
- (*entry)->refcount++;
-
- switch (zend_hash_get_current_key_ex(Z_ARRVAL_PP(input), &string_key, &string_key_len, &num_key, 0, &pos)) {
- case HASH_KEY_IS_STRING:
- zend_hash_update(Z_ARRVAL_P(return_value), string_key, string_key_len,
- entry, sizeof(zval *), NULL);
- break;
-
- case HASH_KEY_IS_LONG:
- if (preserve_keys)
- zend_hash_index_update(Z_ARRVAL_P(return_value), num_key,
- entry, sizeof(zval *), NULL);
- else
- zend_hash_next_index_insert(Z_ARRVAL_P(return_value),
- entry, sizeof(zval *), NULL);
- break;
- }
-
- zend_hash_move_backwards_ex(Z_ARRVAL_PP(input), &pos);
- }
-}
-/* }}} */
-
-
-/* {{{ proto array array_pad(array input, int pad_size, mixed pad_value)
- Returns a copy of input array padded with pad_value to size pad_size */
-PHP_FUNCTION(array_pad)
-{
- zval **input; /* Input array */
- zval **pad_size; /* Size to pad to */
- zval **pad_value; /* Padding value obviously */
- zval ***pads; /* Array to pass to splice */
- HashTable *new_hash; /* Return value from splice */
- int input_size; /* Size of the input array */
- int pad_size_abs; /* Absolute value of pad_size */
- int num_pads; /* How many pads do we need */
- int do_pad; /* Whether we should do padding at all */
- int i;
-
- /* Get arguments and do error-checking */
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &input, &pad_size, &pad_value) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- /* Make sure arguments are of the proper type */
- if (Z_TYPE_PP(input) != IS_ARRAY) {
- php_error(E_WARNING, "Argument to %s() should be an array",
- get_active_function_name());
- return;
- }
- convert_to_long_ex(pad_size);
-
- /* Do some initial calculations */
- input_size = zend_hash_num_elements(Z_ARRVAL_PP(input));
- pad_size_abs = abs(Z_LVAL_PP(pad_size));
- do_pad = (input_size >= pad_size_abs) ? 0 : 1;
-
- /* Copy the original array */
- *return_value = **input;
- zval_copy_ctor(return_value);
-
- /* If no need to pad, no need to continue */
- if (!do_pad)
- return;
-
- /* Populate the pads array */
- num_pads = pad_size_abs - input_size;
- pads = (zval ***)emalloc(num_pads * sizeof(zval **));
- for (i = 0; i < num_pads; i++)
- pads[i] = pad_value;
-
- /* Pad on the right or on the left */
- if (Z_LVAL_PP(pad_size) > 0)
- new_hash = php_splice(Z_ARRVAL_P(return_value), input_size, 0, pads, num_pads, NULL);
- else
- new_hash = php_splice(Z_ARRVAL_P(return_value), 0, 0, pads, num_pads, NULL);
-
-
- /* Copy the result hash into return value */
- zend_hash_destroy(Z_ARRVAL_P(return_value));
- efree(Z_ARRVAL_P(return_value));
- Z_ARRVAL_P(return_value) = new_hash;
-
- /* Clean up */
- efree(pads);
-}
-/* }}} */
-
-/* {{{ proto array array_flip(array input)
- Return array with key <-> value flipped */
-PHP_FUNCTION(array_flip)
-{
- zval **array, **entry, *data;
- HashTable *target_hash;
- char *string_key;
- ulong str_key_len;
- ulong num_key;
- HashPosition pos;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &array) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- target_hash = HASH_OF(*array);
- if (!target_hash) {
- php_error(E_WARNING, "Wrong datatype in array_flip() call");
- RETURN_FALSE;
- }
-
- array_init(return_value);
-
- zend_hash_internal_pointer_reset_ex(target_hash, &pos);
- while (zend_hash_get_current_data_ex(target_hash, (void **)&entry, &pos) == SUCCESS) {
- MAKE_STD_ZVAL(data);
- switch (zend_hash_get_current_key_ex(target_hash, &string_key, &str_key_len, &num_key, 1, &pos)) {
- case HASH_KEY_IS_STRING:
- Z_STRVAL_P(data) = string_key;
- Z_STRLEN_P(data) = str_key_len-1;
- Z_TYPE_P(data) = IS_STRING;
- break;
- case HASH_KEY_IS_LONG:
- Z_TYPE_P(data) = IS_LONG;
- Z_LVAL_P(data) = num_key;
- break;
- }
-
- if (Z_TYPE_PP(entry) == IS_LONG) {
- zend_hash_index_update(Z_ARRVAL_P(return_value),Z_LVAL_PP(entry), &data, sizeof(data), NULL);
- } else if (Z_TYPE_PP(entry) == IS_STRING) {
- zend_hash_update(Z_ARRVAL_P(return_value),Z_STRVAL_PP(entry),Z_STRLEN_PP(entry) + 1, &data, sizeof(data), NULL);
- } else {
- zval_ptr_dtor(&data); /* will free also zval structure */
- php_error(E_WARNING, "Can only flip STRING and INTEGER values!");
- }
-
- zend_hash_move_forward_ex(target_hash, &pos);
- }
-}
-/* }}} */
-
-/* {{{ proto array array_unique(array input)
- Removes duplicate values from array */
-PHP_FUNCTION(array_unique)
-{
- zval **array;
- HashTable *target_hash;
- Bucket **arTmp, **cmpdata, **lastkept;
- Bucket *p;
- int i;
-
- if (ARG_COUNT(ht) != 1 || zend_get_parameters_ex(1, &array) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- target_hash = HASH_OF(*array);
- if (!target_hash) {
- php_error(E_WARNING, "Wrong datatype in array_unique() call");
- RETURN_FALSE;
- }
-
- /* copy the argument array */
- *return_value = **array;
- zval_copy_ctor(return_value);
-
- if (target_hash->nNumOfElements <= 1) /* nothing to do */
- return;
-
- /* create and sort array with pointers to the target_hash buckets */
- arTmp = (Bucket **) pemalloc((target_hash->nNumOfElements + 1) * sizeof(Bucket *), target_hash->persistent);
- if (!arTmp)
- RETURN_FALSE;
- for (i = 0, p = target_hash->pListHead; p; i++, p = p->pListNext)
- arTmp[i] = p;
- arTmp[i] = NULL;
- set_compare_func(SORT_STRING);
- qsort((void *) arTmp, i, sizeof(Bucket *), array_data_compare);
-
- /* go through the sorted array and delete duplicates from the copy */
- lastkept = arTmp;
- for (cmpdata = arTmp + 1; *cmpdata; cmpdata++) {
- if (array_data_compare(lastkept, cmpdata)) {
- lastkept = cmpdata;
- } else {
- p = *cmpdata;
- if (p->nKeyLength)
- zend_hash_del(Z_ARRVAL_P(return_value), p->arKey, p->nKeyLength);
- else
- zend_hash_index_del(Z_ARRVAL_P(return_value), p->h);
- }
- }
- pefree(arTmp, target_hash->persistent);
-}
-/* }}} */
-
-/* {{{ proto array array_intersect(array arr1, array arr2 [, array ...])
- Returns the entries of arr1 that have values which are present in all the other arguments */
-PHP_FUNCTION(array_intersect)
-{
- zval ***args = NULL;
- HashTable *hash;
- int argc, i, c = 0;
- Bucket ***lists, **list, ***ptrs, *p;
-
- /* Get the argument count and check it */
- argc = ARG_COUNT(ht);
- if (argc < 2) {
- WRONG_PARAM_COUNT;
- }
- /* Allocate arguments array and get the arguments, checking for errors. */
- args = (zval ***)emalloc(argc * sizeof(zval **));
- if (zend_get_parameters_array_ex(argc, args) == FAILURE) {
- efree(args);
- WRONG_PARAM_COUNT;
- }
- /* for each argument, create and sort list with pointers to the hash buckets */
- lists = (Bucket ***)emalloc(argc * sizeof(Bucket **));
- ptrs = (Bucket ***)emalloc(argc * sizeof(Bucket **));
- set_compare_func(SORT_STRING);
- for (i=0; i<argc; i++) {
- if (Z_TYPE_PP(args[i]) != IS_ARRAY) {
- php_error(E_WARNING, "Argument #%d to array_intersect() is not an array", i+1);
- argc = i; /* only free up to i-1 */
- goto out;
- }
- hash = HASH_OF(*args[i]);
- list = (Bucket **) pemalloc((hash->nNumOfElements + 1) * sizeof(Bucket *), hash->persistent);
- if (!list)
- RETURN_FALSE;
- lists[i] = list;
- ptrs[i] = list;
- for (p = hash->pListHead; p; p = p->pListNext)
- *list++ = p;
- *list = NULL;
- qsort((void *) lists[i], hash->nNumOfElements, sizeof(Bucket *), array_data_compare);
- }
-
- /* copy the argument array */
- *return_value = **args[0];
- zval_copy_ctor(return_value);
-
- /* go through the lists and look for common values */
- while (*ptrs[0]) {
- for (i=1; i<argc; i++) {
- while (*ptrs[i] && (0 < (c = array_data_compare(ptrs[0], ptrs[i]))))
- ptrs[i]++;
- if (!*ptrs[i]) {
- /* delete any values corresponding to remains of ptrs[0] */
- /* and exit */
- for (;;) {
- p = *ptrs[0]++;
- if (!p)
- goto out;
- if (p->nKeyLength)
- zend_hash_del(Z_ARRVAL_P(return_value), p->arKey, p->nKeyLength);
- else
- zend_hash_index_del(Z_ARRVAL_P(return_value), p->h);
- }
- }
- if (c)
- break;
- ptrs[i]++;
- }
- if (c) {
- /* Value of ptrs[0] not in all arguments, delete all entries */
- /* with value < value of ptrs[i] */
- for (;;) {
- p = *ptrs[0];
- if (p->nKeyLength)
- zend_hash_del(Z_ARRVAL_P(return_value), p->arKey, p->nKeyLength);
- else
- zend_hash_index_del(Z_ARRVAL_P(return_value), p->h);
- if (!*++ptrs[0])
- goto out;
- if (0 <= array_data_compare(ptrs[0], ptrs[i]))
- break;
- }
- } else {
- /* ptrs[0] is present in all the arguments */
- /* Skip all entries with same value as ptrs[0] */
- for (;;) {
- if (!*++ptrs[0])
- goto out;
- if (array_data_compare(ptrs[0]-1, ptrs[0]))
- break;
- }
- }
- }
-
-out:
- for (i=0; i<argc; i++) {
- hash = HASH_OF(*args[i]);
- pefree(lists[i], hash->persistent);
- }
- efree(ptrs);
- efree(lists);
- efree(args);
-}
-/* }}} */
-
-/* {{{ proto array array_diff(array arr1, array arr2 [, array ...])
- Returns the entries of arr1 that have values which are not present in any of the others arguments */
-PHP_FUNCTION(array_diff)
-{
- zval ***args = NULL;
- HashTable *hash;
- int argc, i, c;
- Bucket ***lists, **list, ***ptrs, *p;
-
- /* Get the argument count and check it */
- argc = ARG_COUNT(ht);
- if (argc < 2) {
- WRONG_PARAM_COUNT;
- }
- /* Allocate arguments array and get the arguments, checking for errors. */
- args = (zval ***)emalloc(argc * sizeof(zval **));
- if (zend_get_parameters_array_ex(argc, args) == FAILURE) {
- efree(args);
- WRONG_PARAM_COUNT;
- }
- /* for each argument, create and sort list with pointers to the hash buckets */
- lists = (Bucket ***)emalloc(argc * sizeof(Bucket **));
- ptrs = (Bucket ***)emalloc(argc * sizeof(Bucket **));
- set_compare_func(SORT_STRING);
- for (i=0; i<argc; i++) {
- if (Z_TYPE_PP(args[i]) != IS_ARRAY) {
- php_error(E_WARNING, "Argument #%d to array_diff() is not an array", i+1);
- argc = i; /* only free up to i-1 */
- goto out;
- }
- hash = HASH_OF(*args[i]);
- list = (Bucket **) pemalloc((hash->nNumOfElements + 1) * sizeof(Bucket *), hash->persistent);
- if (!list)
- RETURN_FALSE;
- lists[i] = list;
- ptrs[i] = list;
- for (p = hash->pListHead; p; p = p->pListNext)
- *list++ = p;
- *list = NULL;
- qsort((void *) lists[i], hash->nNumOfElements, sizeof(Bucket *), array_data_compare);
- }
-
- /* copy the argument array */
- *return_value = **args[0];
- zval_copy_ctor(return_value);
-
- /* go through the lists and look for values of ptr[0]
- that are not in the others */
- while (*ptrs[0]) {
- c = 1;
- for (i=1; i<argc; i++) {
- while (*ptrs[i] && (0 < (c = array_data_compare(ptrs[0], ptrs[i]))))
- ptrs[i]++;
- if (!c) {
- if (*ptrs[i])
- ptrs[i]++;
- break;
- }
- }
- if (!c) {
- /* ptrs[0] in one of the other arguments */
- /* delete all entries with value as ptrs[0] */
- for (;;) {
- p = *ptrs[0];
- if (p->nKeyLength)
- zend_hash_del(Z_ARRVAL_P(return_value), p->arKey, p->nKeyLength);
- else
- zend_hash_index_del(Z_ARRVAL_P(return_value), p->h);
- if (!*++ptrs[0])
- goto out;
- if (array_data_compare(ptrs[0]-1, ptrs[0]))
- break;
- }
- } else {
- /* ptrs[0] in none of the other arguments */
- /* skip all entries with value as ptrs[0] */
- for (;;) {
- if (!*++ptrs[0])
- goto out;
- if (array_data_compare(ptrs[0]-1, ptrs[0]))
- break;
- }
- }
- }
-out:
- for (i=0; i<argc; i++) {
- hash = HASH_OF(*args[i]);
- pefree(lists[i], hash->persistent);
- }
- efree(ptrs);
- efree(lists);
- efree(args);
-}
-/* }}} */
-
-#define MULTISORT_ORDER 0
-#define MULTISORT_TYPE 1
-#define MULTISORT_LAST 2
-
-int multisort_compare(const void *a, const void *b)
-{
- Bucket** ab = *(Bucket ***)a;
- Bucket** bb = *(Bucket ***)b;
- int r;
- int result = 0;
- zval temp;
- ARRAYLS_FETCH();
-
- r = 0;
- do {
- set_compare_func(ARRAYG(multisort_flags)[MULTISORT_TYPE][r]);
-
- ARRAYG(compare_func)(&temp, *((zval **)ab[r]->pData), *((zval **)bb[r]->pData));
- result = ARRAYG(multisort_flags)[MULTISORT_ORDER][r] * Z_LVAL(temp);
- if (result != 0)
- return result;
- r++;
- } while (ab[r] != NULL);
- return result;
-}
-
-#define MULTISORT_ABORT \
- for (k = 0; k < MULTISORT_LAST; k++) \
- efree(ARRAYG(multisort_flags)[k]); \
- efree(arrays); \
- efree(args); \
- RETURN_FALSE;
-
-/* {{{ proto bool array_multisort(array ar1 [, SORT_ASC|SORT_DESC [, SORT_REGULAR|SORT_NUMERIC|SORT_STRING]] [, array ar2 [, SORT_ASC|SORT_DESC [, SORT_REGULAR|SORT_NUMERIC|SORT_STRING]], ...])
- Sort multiple arrays at once similar to how ORDER BY clause works in SQL */
-PHP_FUNCTION(array_multisort)
-{
- zval*** args;
- zval*** arrays;
- Bucket*** indirect;
- Bucket* p;
- HashTable* hash;
- int argc;
- int array_size;
- int num_arrays = 0;
- int parse_state[MULTISORT_LAST]; /* 0 - flag not allowed
- 1 - flag allowed */
- int sort_order = SORT_ASC;
- int sort_type = SORT_REGULAR;
- int i, k;
- ARRAYLS_FETCH();
-
- /* Get the argument count and check it */
- argc = ZEND_NUM_ARGS();
- if (argc < 1) {
- WRONG_PARAM_COUNT;
- }
-
- /* Allocate arguments array and get the arguments, checking for errors. */
- args = (zval ***)emalloc(argc * sizeof(zval **));
- if (zend_get_parameters_array_ex(argc, args) == FAILURE) {
- efree(args);
- WRONG_PARAM_COUNT;
- }
-
- /* Allocate space for storing pointers to input arrays and sort flags. */
- arrays = (zval ***)ecalloc(argc, sizeof(zval **));
- for (i = 0; i < MULTISORT_LAST; i++) {
- parse_state[i] = 0;
- ARRAYG(multisort_flags)[i] = (int *)ecalloc(argc, sizeof(int));
- }
-
- /* Here we go through the input arguments and parse them. Each one can
- be either an array or a sort flag which follows an array. If not
- specified, the sort flags defaults to SORT_ASC and SORT_REGULAR
- accordingly. There can't be two sort flags of the same type after an
- array, and the very first argument has to be an array.
- */
- for (i = 0; i < argc; i++) {
- if (Z_TYPE_PP(args[i]) == IS_ARRAY) {
- /* We see the next array, so we update the sort flags of
- the previous array and reset the sort flags. */
- if (i > 0) {
- ARRAYG(multisort_flags)[MULTISORT_ORDER][num_arrays-1] = sort_order;
- ARRAYG(multisort_flags)[MULTISORT_TYPE][num_arrays-1] = sort_type;
- sort_order = SORT_ASC;
- sort_type = SORT_REGULAR;
- }
- arrays[num_arrays++] = args[i];
-
- /* Next one may be an array or a list of sort flags. */
- for (k = 0; k < MULTISORT_LAST; k++)
- parse_state[k] = 1;
- } else if (Z_TYPE_PP(args[i]) == IS_LONG) {
- switch (Z_LVAL_PP(args[i])) {
- case SORT_ASC:
- case SORT_DESC:
- /* flag allowed here */
- if (parse_state[MULTISORT_ORDER] == 1) {
- /* Save the flag and make sure then next arg is not the current flag. */
- sort_order = Z_LVAL_PP(args[i]) == SORT_DESC ? -1 : 1;
- parse_state[MULTISORT_ORDER] = 0;
- } else {
- php_error(E_WARNING, "Argument %i to %s() is expected to be an array or sorting flag that has not already been specified", i+1, get_active_function_name());
- MULTISORT_ABORT;
- }
- break;
-
- case SORT_REGULAR:
- case SORT_NUMERIC:
- case SORT_STRING:
- /* flag allowed here */
- if (parse_state[MULTISORT_TYPE] == 1) {
- /* Save the flag and make sure then next arg is not the current flag. */
- sort_type = Z_LVAL_PP(args[i]);
- parse_state[MULTISORT_TYPE] = 0;
- } else {
- php_error(E_WARNING, "Argument %i to %s() is expected to be an array or sorting flag that has not already been specified", i+1, get_active_function_name());
- MULTISORT_ABORT;
- }
- break;
-
- default:
- php_error(E_WARNING, "Argument %i to %s() is an unknown sort flag", i+1,
- get_active_function_name());
- MULTISORT_ABORT;
- break;
-
- }
- } else {
- php_error(E_WARNING, "Argument %i to %s() is expected to be an array or a sort flag", i+1, get_active_function_name());
- MULTISORT_ABORT;
- }
- }
- /* Take care of the last array sort flags. */
- ARRAYG(multisort_flags)[MULTISORT_ORDER][num_arrays-1] = sort_order;
- ARRAYG(multisort_flags)[MULTISORT_TYPE][num_arrays-1] = sort_type;
-
- /* Make sure the arrays are of the same size. */
- array_size = zend_hash_num_elements(Z_ARRVAL_PP(arrays[0]));
- for (i = 0; i < num_arrays; i++) {
- if (zend_hash_num_elements(Z_ARRVAL_PP(arrays[i])) != array_size) {
- php_error(E_WARNING, "Array sizes are inconsistent");
- MULTISORT_ABORT;
- }
- }
-
- /* If all arrays are empty or have only one entry,
- we don't need to do anything. */
- if (array_size <= 1) {
- for (k = 0; k < MULTISORT_LAST; k++)
- efree(ARRAYG(multisort_flags)[k]);
- efree(arrays);
- efree(args);
- RETURN_TRUE;
- }
-
- /* Create the indirection array. This array is of size MxN, where
- M is the number of entries in each input array and N is the number
- of the input arrays + 1. The last column is NULL to indicate the end
- of the row.
- */
- indirect = (Bucket ***)emalloc(array_size * sizeof(Bucket **));
- for (i = 0; i < array_size; i++)
- indirect[i] = (Bucket **)emalloc((num_arrays+1) * sizeof(Bucket *));
-
- for (i = 0; i < num_arrays; i++) {
- k = 0;
- for (p = Z_ARRVAL_PP(arrays[i])->pListHead; p; p = p->pListNext, k++) {
- indirect[k][i] = p;
- }
- }
- for (k = 0; k < array_size; k++)
- indirect[k][num_arrays] = NULL;
-
- /* Do the actual sort magic - bada-bim, bada-boom. */
- qsort(indirect, array_size, sizeof(Bucket **), multisort_compare);
-
- /* Restructure the arrays based on sorted indirect - this is mostly
- taken from zend_hash_sort() function. */
- HANDLE_BLOCK_INTERRUPTIONS();
- for (i = 0; i < num_arrays; i++) {
- hash = Z_ARRVAL_PP(arrays[i]);
- hash->pListHead = indirect[0][i];;
- hash->pListTail = NULL;
- hash->pInternalPointer = hash->pListHead;
-
- for (k = 0; k < array_size; k++) {
- if (hash->pListTail) {
- hash->pListTail->pListNext = indirect[k][i];
- }
- indirect[k][i]->pListLast = hash->pListTail;
- indirect[k][i]->pListNext = NULL;
- hash->pListTail = indirect[k][i];
- }
-
- p = hash->pListHead;
- k = 0;
- while (p != NULL) {
- if (p->nKeyLength == 0)
- p->h = k++;
- p = p->pListNext;
- }
- hash->nNextFreeElement = array_size;
- zend_hash_rehash(hash);
- }
- HANDLE_UNBLOCK_INTERRUPTIONS();
-
- /* Clean up. */
- for (i = 0; i < array_size; i++)
- efree(indirect[i]);
- efree(indirect);
- for (k = 0; k < MULTISORT_LAST; k++)
- efree(ARRAYG(multisort_flags)[k]);
- efree(arrays);
- efree(args);
- RETURN_TRUE;
-}
-/* }}} */
-
-
-/* {{{ proto mixed array_rand(array input [, int num_req])
- Return key/keys for random entry/entries in the array */
-PHP_FUNCTION(array_rand)
-{
- zval **input, **num_req;
- long randval;
- int num_req_val, num_avail, key_type;
- char *string_key;
- ulong string_key_len;
- ulong num_key;
- HashPosition pos;
-
- if (ZEND_NUM_ARGS() < 1 || ZEND_NUM_ARGS() > 2 ||
- zend_get_parameters_ex(ZEND_NUM_ARGS(), &input, &num_req) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if (Z_TYPE_PP(input) != IS_ARRAY) {
- zend_error(E_WARNING, "Argument to %s() has to be an array",
- get_active_function_name());
- return;
- }
-
- num_avail = zend_hash_num_elements(Z_ARRVAL_PP(input));
-
- if (ZEND_NUM_ARGS() > 1) {
- convert_to_long_ex(num_req);
- num_req_val = Z_LVAL_PP(num_req);
- if (num_req_val <= 0 || num_req_val > num_avail) {
- zend_error(E_WARNING, "Second argument to %s() has to be between 1 and the number of elements in the array", get_active_function_name());
- return;
- }
- } else
- num_req_val = 1;
-
- /* Make the return value an array only if we need to pass back more than one
- result. */
- if (num_req_val > 1)
- array_init(return_value);
-
- /* We can't use zend_hash_index_find() because the array may have string keys or gaps. */
- zend_hash_internal_pointer_reset_ex(Z_ARRVAL_PP(input), &pos);
- while (num_req_val && (key_type = zend_hash_get_current_key_ex(Z_ARRVAL_PP(input), &string_key, &string_key_len, &num_key, 0, &pos)) != HASH_KEY_NON_EXISTANT) {
-
-#ifdef HAVE_RANDOM
- randval = random();
-#else
-#ifdef HAVE_LRAND48
- randval = lrand48();
-#else
- randval = rand();
-#endif
-#endif
-
- if ((double)(randval/(PHP_RAND_MAX+1.0)) < (double)num_req_val/(double)num_avail) {
- /* If we are returning a single result, just do it. */
- if (Z_TYPE_P(return_value) != IS_ARRAY) {
- if (key_type == HASH_KEY_IS_STRING) {
- RETURN_STRINGL(string_key, string_key_len-1, 1);
- } else {
- RETURN_LONG(num_key);
- }
- } else {
- /* Append the result to the return value. */
- if (key_type == HASH_KEY_IS_STRING)
- add_next_index_stringl(return_value, string_key, string_key_len-1, 1);
- else
- add_next_index_long(return_value, num_key);
- }
- num_req_val--;
- }
- num_avail--;
- zend_hash_move_forward_ex(Z_ARRVAL_PP(input), &pos);
- }
-
- if (num_req_val == num_avail) {
- if (zend_hash_sort(Z_ARRVAL_P(return_value), (sort_func_t)php_mergesort, array_data_shuffle, 1) == FAILURE) {
- zval_dtor(return_value);
- RETURN_FALSE;
- }
- }
-}
-/* }}} */
-
-/* {{{ proto mixed array_sum(array input)
- Returns the sum of the array entries */
-
-PHP_FUNCTION(array_sum)
-{
- zval **input,
- **entry;
- int argc = ZEND_NUM_ARGS();
- HashPosition pos;
-
- if (argc != 1 || zend_get_parameters_ex(argc, &input) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if (Z_TYPE_PP(input) != IS_ARRAY) {
- php_error(E_WARNING, "The argument to %s() should be an array",
- get_active_function_name());
- return;
- }
-
- ZVAL_LONG(return_value, 0);
-
- for (zend_hash_internal_pointer_reset_ex(Z_ARRVAL_PP(input), &pos);
- zend_hash_get_current_data_ex(Z_ARRVAL_PP(input), (void **)&entry, &pos) == SUCCESS;
- zend_hash_move_forward_ex(Z_ARRVAL_PP(input), &pos)) {
-
- if (Z_TYPE_PP(entry) == IS_ARRAY || Z_TYPE_PP(entry) == IS_OBJECT)
- continue;
-
- SEPARATE_ZVAL(entry);
- convert_scalar_to_number(*entry);
-
- if (Z_TYPE_PP(entry) == IS_LONG && Z_TYPE_P(return_value) == IS_LONG) {
- Z_LVAL_P(return_value) += Z_LVAL_PP(entry);
- } else {
- convert_to_double(return_value);
- convert_to_double_ex(entry);
- Z_DVAL_P(return_value) += Z_DVAL_PP(entry);
- }
- }
-}
-
-/* }}} */
-
-/* {{{ proto mixed array_reduce(array input, mixed callback [, int initial])
- Iteratively reduce the array to a single value via the callback. */
-PHP_FUNCTION(array_reduce)
-{
- zval **input, **callback, **initial;
- zval **args[2];
- zval **operand;
- zval *result = NULL;
- zval *retval;
- char *callback_name;
- HashPosition pos;
-
- if (ZEND_NUM_ARGS() < 2 || ZEND_NUM_ARGS() > 3 ||
- zend_get_parameters_ex(ZEND_NUM_ARGS(), &input, &callback, &initial) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if (Z_TYPE_PP(input) != IS_ARRAY) {
- php_error(E_WARNING, "%s() expects argument 1 to be an array",
- get_active_function_name());
- return;
- }
-
- if (!zend_is_callable(*callback, 0, &callback_name)) {
- php_error(E_WARNING, "%s() expects argument 2, '%s', to be a valid callback",
- get_active_function_name(), callback_name);
- efree(callback_name);
- return;
- }
- efree(callback_name);
-
- if (ZEND_NUM_ARGS() > 2)
- result = *initial;
-
- if (zend_hash_num_elements(Z_ARRVAL_PP(input)) == 0) {
- if (result) {
- *return_value = *result;
- zval_copy_ctor(return_value);
- }
- return;
- }
-
- zend_hash_internal_pointer_reset_ex(Z_ARRVAL_PP(input), &pos);
- while (zend_hash_get_current_data_ex(Z_ARRVAL_PP(input), (void **)&operand, &pos) == SUCCESS) {
- if (result) {
- args[0] = &result;
- args[1] = operand;
- if (call_user_function_ex(EG(function_table), NULL, *callback, &retval, 2, args, 0, NULL) == SUCCESS && retval) {
- result = retval;
- } else {
- php_error(E_WARNING, "%s() had an error invoking the reduction callback", get_active_function_name());
- return;
- }
- } else
- result = *operand;
-
- zend_hash_move_forward_ex(Z_ARRVAL_PP(input), &pos);
- }
-
- *return_value = *result;
-}
-/* }}} */
-
-
-/* {{{ proto array array_filter(array input [, mixed callback])
- Filters elements from the array via the callback. */
-PHP_FUNCTION(array_filter)
-{
- zval **input, **callback = NULL;
- zval **operand;
- zval **args[1];
- zval *retval = NULL;
- char *callback_name;
- char *string_key;
- ulong string_key_len;
- ulong num_key;
- HashPosition pos;
-
- if (ZEND_NUM_ARGS() < 1 || ZEND_NUM_ARGS() > 2 ||
- zend_get_parameters_ex(ZEND_NUM_ARGS(), &input, &callback) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if (Z_TYPE_PP(input) != IS_ARRAY) {
- php_error(E_WARNING, "%s() expects argument 1 to be an array",
- get_active_function_name());
- return;
- }
-
- if (ZEND_NUM_ARGS() > 1) {
- if (!zend_is_callable(*callback, 0, &callback_name)) {
- php_error(E_WARNING, "%s() expects argument 2, '%s', to be a valid callback",
- get_active_function_name(), callback_name);
- efree(callback_name);
- return;
- }
- efree(callback_name);
- }
-
- array_init(return_value);
- if (zend_hash_num_elements(Z_ARRVAL_PP(input)) == 0)
- return;
-
- for (zend_hash_internal_pointer_reset_ex(Z_ARRVAL_PP(input), &pos);
- zend_hash_get_current_data_ex(Z_ARRVAL_PP(input), (void **)&operand, &pos) == SUCCESS;
- zend_hash_move_forward_ex(Z_ARRVAL_PP(input), &pos)) {
-
- if (callback) {
- args[0] = operand;
- if (call_user_function_ex(EG(function_table), NULL, *callback, &retval, 1, args, 0, NULL) == SUCCESS && retval) {
- if (!zend_is_true(retval)) {
- zval_ptr_dtor(&retval);
- continue;
- } else
- zval_ptr_dtor(&retval);
- } else {
- php_error(E_WARNING, "%s() had an error invoking the filter callback", get_active_function_name());
- return;
- }
- } else if (!zend_is_true(*operand))
- continue;
-
- zval_add_ref(operand);
- switch (zend_hash_get_current_key_ex(Z_ARRVAL_PP(input), &string_key, &string_key_len, &num_key, 0, &pos)) {
- case HASH_KEY_IS_STRING:
- zend_hash_update(Z_ARRVAL_P(return_value), string_key,
- string_key_len, operand, sizeof(zval *), NULL);
- break;
-
- case HASH_KEY_IS_LONG:
- zend_hash_index_update(Z_ARRVAL_P(return_value), num_key,
- operand, sizeof(zval *), NULL);
- break;
- }
- }
-}
-/* }}} */
-
-
-/* {{{ proto array array_map(mixed callback, array input1 [, array input2 ,...])
- Applies the callback to the elements in given arrays. */
-PHP_FUNCTION(array_map)
-{
- zval ***args = NULL;
- zval ***params;
- zval *callback;
- zval *result, *null;
- char *callback_name;
- int i, k, maxlen = 0;
- int *array_len;
-
- if (ZEND_NUM_ARGS() < 2) {
- WRONG_PARAM_COUNT;
- }
-
- args = (zval ***)emalloc(ZEND_NUM_ARGS() * sizeof(zval **));
- if (zend_get_parameters_array_ex(ZEND_NUM_ARGS(), args) == FAILURE) {
- efree(args);
- WRONG_PARAM_COUNT;
- }
-
- callback = *args[0];
- if (Z_TYPE_P(callback) != IS_NULL && !zend_is_callable(callback, 0, &callback_name)) {
- php_error(E_WARNING, "%s() expects argument 1, '%s', to be either NULL or a valid callback",
- get_active_function_name(), callback_name);
- efree(callback_name);
- efree(args);
- return;
- }
- efree(callback_name);
-
- /* Cache array sizes. */
- array_len = (int*)emalloc((ZEND_NUM_ARGS()-1) * sizeof(int));
-
- /* Check that arrays are indeed arrays and calculate maximum size. */
- for (i = 0; i < ZEND_NUM_ARGS()-1; i++) {
- if (Z_TYPE_PP(args[i+1]) != IS_ARRAY) {
- php_error(E_WARNING, "%s() expects argument %d to be an array",
- get_active_function_name(), i + 2);
- efree(array_len);
- efree(args);
- return;
- }
- array_len[i] = zend_hash_num_elements(Z_ARRVAL_PP(args[i+1]));
- if (array_len[i] > maxlen)
- maxlen = array_len[i];
- }
-
- /* Short-circuit: if no callback and only one array, just return it. */
- if (Z_TYPE_P(callback) == IS_NULL && ZEND_NUM_ARGS() == 2) {
- *return_value = **args[1];
- zval_copy_ctor(return_value);
- efree(array_len);
- efree(args);
- return;
- }
-
- array_init(return_value);
- params = (zval ***)emalloc((ZEND_NUM_ARGS()-1) * sizeof(zval **));
- MAKE_STD_ZVAL(null);
- ZVAL_NULL(null);
-
- /* We iterate through all the arrays at once. */
- for (k = 0; k < maxlen; k++) {
- /*
- * If no callback, the result will be an array, consisting of current
- * entries from all arrays.
- */
- if (Z_TYPE_P(callback) == IS_NULL) {
- MAKE_STD_ZVAL(result);
- array_init(result);
- }
-
- for (i = 0; i < ZEND_NUM_ARGS()-1; i++) {
- /*
- * If this array still hash elements, add the current one to the
- * parameter list, otherwise use null value.
- */
- if (k < array_len[i]) {
- zend_hash_index_find(Z_ARRVAL_PP(args[i+1]), k, (void **)&params[i]);
- } else {
- if (Z_TYPE_P(callback) == IS_NULL)
- zval_add_ref(&null);
- params[i] = &null;
- }
-
- if (Z_TYPE_P(callback) == IS_NULL)
- add_next_index_zval(result, *params[i]);
- }
-
- if (Z_TYPE_P(callback) != IS_NULL) {
- if (!call_user_function_ex(EG(function_table), NULL, callback, &result, ZEND_NUM_ARGS()-1, params, 0, NULL) == SUCCESS && result) {
- php_error(E_WARNING, "%s() had an error invoking the map callback", get_active_function_name());
- efree(array_len);
- efree(args);
- zval_dtor(return_value);
- RETURN_NULL();
- }
- }
-
- add_next_index_zval(return_value, result);
- }
-
- zval_ptr_dtor(&null);
- efree(params);
- efree(array_len);
- efree(args);
-}
-/* }}} */
-
-
-/* {{{ proto bool key_exists(mixed key, array search)
- Checks if the given key or index exists in the array */
-PHP_FUNCTION(key_exists)
-{
- zval **key, /* key to check for */
- **array; /* array to check in */
-
- if (ZEND_NUM_ARGS() != 2 ||
- zend_get_parameters_ex(ZEND_NUM_ARGS(), &key, &array) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if (Z_TYPE_PP(array) != IS_ARRAY && Z_TYPE_PP(array) != IS_OBJECT) {
- php_error(E_WARNING, "Wrong datatype for second argument in call to %s", get_active_function_name());
- RETURN_FALSE;
- }
-
- switch (Z_TYPE_PP(key)) {
- case IS_STRING:
- if (zend_hash_exists(HASH_OF(*array), Z_STRVAL_PP(key), Z_STRLEN_PP(key)+1)) {
- RETURN_TRUE;
- }
- RETURN_FALSE;
-
- case IS_LONG:
- if (zend_hash_index_exists(HASH_OF(*array), Z_LVAL_PP(key))) {
- RETURN_TRUE;
- }
- RETURN_FALSE;
-
- default:
- php_error(E_WARNING, "Wrong datatype for first argument in call to %s", get_active_function_name());
- RETURN_FALSE;
- }
-
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/standard/assert.c b/ext/standard/assert.c
deleted file mode 100644
index d28424d2bd..0000000000
--- a/ext/standard/assert.c
+++ /dev/null
@@ -1,334 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Thies C. Arntzen (thies@thieso.net) |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-/* {{{ includes/startup/misc */
-
-#include "php.h"
-#include "php_assert.h"
-#include "php_ini.h"
-
-typedef struct {
- long active;
- long bail;
- long warning;
- long quiet_eval;
- char *default_callback;
- char *callback;
-} php_assert_globals;
-
-#ifdef ZTS
-#define ASSERTLS_D php_assert_globals *assert_globals
-#define ASSERTLS_DC , ASSERTLS_D
-#define ASSERTLS_C assert_globals
-#define ASSERTLS_CC , ASSERTLS_CC
-#define ASSERT(v) (assert_globals->v)
-#define ASSERTLS_FETCH() php_assert_globals *assert_globals = ts_resource(assert_globals_id)
-int assert_globals_id;
-#else
-#define ASSERTLS_D
-#define ASSERTLS_DC
-#define ASSERTLS_C
-#define ASSERTLS_CC
-#define ASSERT(v) (assert_globals.v)
-#define ASSERTLS_FETCH()
-php_assert_globals assert_globals;
-#endif
-
-#define SAFE_STRING(s) ((s)?(s):"")
-
-#define ASSERT_ACTIVE 1
-#define ASSERT_CALLBACK 2
-#define ASSERT_BAIL 3
-#define ASSERT_WARNING 4
-#define ASSERT_QUIET_EVAL 5
-
-PHP_INI_BEGIN()
- STD_PHP_INI_ENTRY("assert.active", "1", PHP_INI_ALL, OnUpdateInt, active, php_assert_globals, assert_globals)
- STD_PHP_INI_ENTRY("assert.bail", "0", PHP_INI_ALL, OnUpdateInt, bail, php_assert_globals, assert_globals)
- STD_PHP_INI_ENTRY("assert.warning", "1", PHP_INI_ALL, OnUpdateInt, warning, php_assert_globals, assert_globals)
- STD_PHP_INI_ENTRY("assert.callback", NULL, PHP_INI_ALL, OnUpdateString, default_callback, php_assert_globals, assert_globals)
- STD_PHP_INI_ENTRY("assert.quiet_eval", "0", PHP_INI_ALL, OnUpdateInt, quiet_eval, php_assert_globals, assert_globals)
-PHP_INI_END()
-
-static void php_assert_init_globals(ASSERTLS_D)
-{
- ASSERT(callback) = 0;
-}
-
-PHP_MINIT_FUNCTION(assert)
-{
-
-#ifdef ZTS
- assert_globals_id = ts_allocate_id(sizeof(php_assert_globals), (ts_allocate_ctor) php_assert_init_globals, NULL);
-#else
- php_assert_init_globals(ASSERTLS_C);
-#endif
-
- REGISTER_INI_ENTRIES();
-
- REGISTER_LONG_CONSTANT("ASSERT_ACTIVE", ASSERT_ACTIVE, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("ASSERT_CALLBACK", ASSERT_CALLBACK, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("ASSERT_BAIL", ASSERT_BAIL, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("ASSERT_WARNING", ASSERT_WARNING, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("ASSERT_QUIET_EVAL", ASSERT_QUIET_EVAL, CONST_CS|CONST_PERSISTENT);
-
- return SUCCESS;
-}
-
-PHP_MSHUTDOWN_FUNCTION(assert)
-{
- return SUCCESS;
-}
-
-PHP_RINIT_FUNCTION(assert)
-{
- ASSERTLS_FETCH();
-
- if (ASSERT(callback)) {
- efree(ASSERT(callback));
- ASSERT(callback) = NULL;
- }
-
- return SUCCESS;
-}
-
-PHP_RSHUTDOWN_FUNCTION(assert)
-{
- ASSERTLS_FETCH();
-
- if (ASSERT(callback)) {
- efree(ASSERT(callback));
- ASSERT(callback) = NULL;
- }
-
- return SUCCESS;
-}
-
-PHP_MINFO_FUNCTION(assert)
-{
- DISPLAY_INI_ENTRIES();
-}
-
-/* }}} */
-/* {{{ internal functions */
-/* }}} */
-/* {{{ proto int assert(string|bool assertion)
- Checks if assertion is false */
-
-PHP_FUNCTION(assert)
-{
- pval **assertion;
- int val;
- char *myeval = NULL;
- char *cbfunc;
- char *compiled_string_description;
- CLS_FETCH();
- ASSERTLS_FETCH();
-
- if (! ASSERT(active)) {
- RETURN_TRUE;
- }
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &assertion) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if ((*assertion)->type == IS_STRING) {
- zval retval;
- int old_error_reporting = 0; /* shut up gcc! */
-
- myeval = (*assertion)->value.str.val;
-
- if (ASSERT(quiet_eval)) {
- old_error_reporting = EG(error_reporting);
- EG(error_reporting) = 0;
- }
-
- compiled_string_description = zend_make_compiled_string_description("assert code");
- if (zend_eval_string(myeval, &retval, compiled_string_description CLS_CC ELS_CC) == FAILURE) {
- efree(compiled_string_description);
- zend_error(E_ERROR, "Failure evaluating code:\n%s\n", myeval);
- /* zend_error() does not return in this case. */
- }
- efree(compiled_string_description);
-
- if (ASSERT(quiet_eval)) {
- EG(error_reporting) = old_error_reporting;
- }
-
- convert_to_boolean(&retval);
- val = retval.value.lval;
- } else {
- convert_to_boolean_ex(assertion);
- val = (*assertion)->value.lval;
- }
-
- if (val) {
- RETURN_TRUE;
- }
-
- if (ASSERT(callback)) {
- cbfunc = ASSERT(callback);
- } else if (ASSERT(default_callback)) {
- cbfunc = ASSERT(default_callback);
- } else {
- cbfunc = NULL;
- }
-
- if (cbfunc) {
- zval *args[5];
- zval *retval;
- int i;
- uint lineno = zend_get_executed_lineno(ELS_C);
- char *filename = zend_get_executed_filename(ELS_C);
- /*
- char *function = get_active_function_name();
- */
-
- MAKE_STD_ZVAL(args[0]);
- MAKE_STD_ZVAL(args[1]);
- MAKE_STD_ZVAL(args[2]);
- MAKE_STD_ZVAL(args[3]);
- /*
- MAKE_STD_ZVAL(args[4]);
- */
-
- args[0]->type = IS_STRING; args[0]->value.str.val = estrdup(SAFE_STRING(cbfunc)); args[0]->value.str.len = strlen(args[0]->value.str.val);
- args[1]->type = IS_STRING; args[1]->value.str.val = estrdup(SAFE_STRING(filename)); args[1]->value.str.len = strlen(args[1]->value.str.val);
- args[2]->type = IS_LONG; args[2]->value.lval = lineno;
- args[3]->type = IS_STRING; args[3]->value.str.val = estrdup(SAFE_STRING(myeval)); args[3]->value.str.len = strlen(args[3]->value.str.val);
- /*
- this is always "assert" so it's useless
- args[4]->type = IS_STRING; args[4]->value.str.val = estrdup(SAFE_STRING(function)); args[4]->value.str.len = strlen(args[4]->value.str.val);
- */
-
- MAKE_STD_ZVAL(retval);
- retval->type = IS_BOOL;
- retval->value.lval = 0;
-
- /* XXX do we want to check for error here? */
- call_user_function(CG(function_table), NULL, args[0], retval, 3, args+1);
-
- for (i = 0; i < 4; i++) {
- zval_ptr_dtor(&(args[i]));
- }
- zval_ptr_dtor(&retval);
- }
-
- if (ASSERT(warning)) {
- if (myeval) {
- php_error(E_WARNING,"Assertion \"%s\" failed",myeval);
- } else {
- php_error(E_WARNING,"Assertion failed");
- }
- }
-
- if (ASSERT(bail)) {
- zend_bailout();
- }
-}
-
-/* }}} */
-/* {{{ proto mixed assert_options(int what [, mixed value])
- Set/get the various assert flags */
-
-PHP_FUNCTION(assert_options)
-{
- pval **what,**value;
- int oldint;
- char *oldstr;
- int ac = ZEND_NUM_ARGS();
- ASSERTLS_FETCH();
-
- if (ac < 1 || ac > 2 || zend_get_parameters_ex(ac, &what, &value) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(what);
-
- switch ((*what)->value.lval) {
- case ASSERT_ACTIVE:
- oldint = ASSERT(active);
- if (ac == 2) {
- convert_to_long_ex(value);
- ASSERT(active) = (*value)->value.lval;
- }
- RETURN_LONG(oldint);
- break;
-
- case ASSERT_BAIL:
- oldint = ASSERT(bail);
- if (ac == 2) {
- convert_to_long_ex(value);
- ASSERT(bail) = (*value)->value.lval;
- }
- RETURN_LONG(oldint);
- break;
-
- case ASSERT_QUIET_EVAL:
- oldint = ASSERT(quiet_eval);
- if (ac == 2) {
- convert_to_long_ex(value);
- ASSERT(quiet_eval) = (*value)->value.lval;
- }
- RETURN_LONG(oldint);
- break;
-
- case ASSERT_WARNING:
- oldint = ASSERT(warning);
- if (ac == 2) {
- convert_to_long_ex(value);
- ASSERT(warning) = (*value)->value.lval;
- }
- RETURN_LONG(oldint);
- break;
-
- case ASSERT_CALLBACK:
- oldstr = ASSERT(callback);
- RETVAL_STRING(SAFE_STRING(oldstr),1);
-
- if (ac == 2) {
- if (oldstr) {
- efree(oldstr);
- }
- convert_to_string_ex(value);
- ASSERT(callback) = estrndup((*value)->value.str.val,(*value)->value.str.len);
- }
- return;
- break;
-
- default:
- php_error(E_WARNING,"Unknown value %d.",(*what)->value.lval);
- break;
- }
-
- RETURN_FALSE;
-}
-
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/standard/base64.c b/ext/standard/base64.c
deleted file mode 100644
index cf3a4b79a2..0000000000
--- a/ext/standard/base64.c
+++ /dev/null
@@ -1,201 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Jim Winstead (jimw@php.net) |
- +----------------------------------------------------------------------+
- */
-/* $Id$ */
-
-#include <string.h>
-
-#include "php.h"
-#include "base64.h"
-
-static char base64_table[] =
- { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M',
- 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
- 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',
- 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
- '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '/', '\0'
- };
-static char base64_pad = '=';
-
-unsigned char *php_base64_encode(const unsigned char *str, int length, int *ret_length) {
- const unsigned char *current = str;
- int i = 0;
- unsigned char *result = (unsigned char *)emalloc(((length + 3 - length % 3) * 4 / 3 + 1) * sizeof(char));
-
- while (length > 2) { /* keep going until we have less than 24 bits */
- result[i++] = base64_table[current[0] >> 2];
- result[i++] = base64_table[((current[0] & 0x03) << 4) + (current[1] >> 4)];
- result[i++] = base64_table[((current[1] & 0x0f) << 2) + (current[2] >> 6)];
- result[i++] = base64_table[current[2] & 0x3f];
-
- current += 3;
- length -= 3; /* we just handle 3 octets of data */
- }
-
- /* now deal with the tail end of things */
- if (length != 0) {
- result[i++] = base64_table[current[0] >> 2];
- if (length > 1) {
- result[i++] = base64_table[((current[0] & 0x03) << 4) + (current[1] >> 4)];
- result[i++] = base64_table[(current[1] & 0x0f) << 2];
- result[i++] = base64_pad;
- }
- else {
- result[i++] = base64_table[(current[0] & 0x03) << 4];
- result[i++] = base64_pad;
- result[i++] = base64_pad;
- }
- }
- if(ret_length) {
- *ret_length = i;
- }
- result[i] = '\0';
- return result;
-}
-
-/* as above, but backwards. :) */
-unsigned char *php_base64_decode(const unsigned char *str, int length, int *ret_length) {
- const unsigned char *current = str;
- int ch, i = 0, j = 0, k;
- /* this sucks for threaded environments */
- static short reverse_table[256];
- static int table_built;
- unsigned char *result;
-
- if (++table_built == 1) {
- char *chp;
- for(ch = 0; ch < 256; ch++) {
- chp = strchr(base64_table, ch);
- if(chp) {
- reverse_table[ch] = chp - base64_table;
- } else {
- reverse_table[ch] = -1;
- }
- }
- }
-
- result = (unsigned char *)emalloc(length + 1);
- if (result == NULL) {
- return NULL;
- }
-
- /* run through the whole string, converting as we go */
- while ((ch = *current++) != '\0') {
- if (ch == base64_pad) break;
-
- /* When Base64 gets POSTed, all pluses are interpreted as spaces.
- This line changes them back. It's not exactly the Base64 spec,
- but it is completely compatible with it (the spec says that
- spaces are invalid). This will also save many people considerable
- headache. - Turadg Aleahmad <turadg@wise.berkeley.edu>
- */
-
- if (ch == ' ') ch = '+';
-
- ch = reverse_table[ch];
- if (ch < 0) continue;
-
- switch(i % 4) {
- case 0:
- result[j] = ch << 2;
- break;
- case 1:
- result[j++] |= ch >> 4;
- result[j] = (ch & 0x0f) << 4;
- break;
- case 2:
- result[j++] |= ch >>2;
- result[j] = (ch & 0x03) << 6;
- break;
- case 3:
- result[j++] |= ch;
- break;
- }
- i++;
- }
-
- k = j;
- /* mop things up if we ended on a boundary */
- if (ch == base64_pad) {
- switch(i % 4) {
- case 0:
- case 1:
- efree(result);
- return NULL;
- case 2:
- k++;
- case 3:
- result[k++] = 0;
- }
- }
- if(ret_length) {
- *ret_length = j;
- }
- result[k] = '\0';
- return result;
-}
-
-/* {{{ proto string base64_encode(string str)
- Encodes string using MIME base64 algorithm */
-PHP_FUNCTION(base64_encode) {
- pval **str;
- unsigned char *result;
- int ret_length;
-
- if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1,&str) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(str);
- result = php_base64_encode(Z_STRVAL_PP(str), Z_STRLEN_PP(str), &ret_length);
- if (result != NULL) {
- RETVAL_STRINGL(result, ret_length, 0);
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-
-/* {{{ proto string base64_decode(string str)
- Decodes string using MIME base64 algorithm */
-PHP_FUNCTION(base64_decode) {
- pval **str;
- unsigned char *result;
- int ret_length;
-
- if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1,&str) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(str);
- result = php_base64_decode(Z_STRVAL_PP(str), Z_STRLEN_PP(str), &ret_length);
- if (result != NULL) {
- RETVAL_STRINGL(result, ret_length, 0);
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vimo<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/standard/base64.h b/ext/standard/base64.h
deleted file mode 100644
index 5db621e274..0000000000
--- a/ext/standard/base64.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Jim Winstead (jimw@php.net) |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef BASE64_H
-#define BASE64_H
-
-PHP_FUNCTION(base64_decode);
-PHP_FUNCTION(base64_encode);
-
-extern unsigned char *php_base64_encode(const unsigned char *, int, int *);
-extern unsigned char *php_base64_decode(const unsigned char *, int, int *);
-
-#endif /* BASE64_H */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c
deleted file mode 100644
index a0e2aee59e..0000000000
--- a/ext/standard/basic_functions.c
+++ /dev/null
@@ -1,2627 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#include "php.h"
-#include "php_main.h"
-#include "php_globals.h"
-#include "php_ini.h"
-#include "internal_functions_registry.h"
-#include "php_standard.h"
-#include "php_math.h"
-#include "ext/standard/info.h"
-#include "zend_operators.h"
-#include <stdarg.h>
-#include <stdlib.h>
-#include <math.h>
-#include <time.h>
-#include <stdio.h>
-#include <netdb.h>
-#if HAVE_ARPA_INET_H
-#include <arpa/inet.h>
-#endif
-#if HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#if HAVE_STRING_H
-#include <string.h>
-#else
-#include <strings.h>
-#endif
-#if HAVE_LOCALE_H
-#include <locale.h>
-#endif
-#if HAVE_SYS_MMAN_H
-#include <sys/mman.h>
-#endif
-#include "safe_mode.h"
-#ifdef PHP_WIN32
-#include "win32/unistd.h"
-#endif
-#include "zend_globals.h"
-
-#include "php_globals.h"
-#include "SAPI.h"
-
-#include "php_ticks.h"
-
-#ifdef ZTS
-int basic_globals_id;
-#else
-php_basic_globals basic_globals;
-#endif
-
-#include "php_fopen_wrappers.h"
-
-static unsigned char second_and_third_args_force_ref[] = { 3, BYREF_NONE, BYREF_FORCE, BYREF_FORCE };
-static unsigned char second_args_force_ref[] = { 2, BYREF_NONE, BYREF_FORCE };
-static unsigned char third_argument_force_ref[] = { 3, BYREF_NONE, BYREF_NONE, BYREF_FORCE };
-static unsigned char third_and_fourth_args_force_ref[] = { 4, BYREF_NONE, BYREF_NONE, BYREF_FORCE, BYREF_FORCE };
-static unsigned char third_and_rest_force_ref[] = { 3, BYREF_NONE, BYREF_NONE, BYREF_FORCE_REST };
-
-typedef struct _php_shutdown_function_entry {
- zval **arguments;
- int arg_count;
-} php_shutdown_function_entry;
-
-typedef struct _user_tick_function_entry {
- zval **arguments;
- int arg_count;
-} user_tick_function_entry;
-
-/* some prototypes for local functions */
-static void user_shutdown_function_dtor(php_shutdown_function_entry *shutdown_function_entry);
-static void user_tick_function_dtor(user_tick_function_entry *tick_function_entry);
-pval test_class_get_property(zend_property_reference *property_reference);
-int test_class_set_property(zend_property_reference *property_reference, pval *value);
-void test_class_call_function(INTERNAL_FUNCTION_PARAMETERS, zend_property_reference *property_reference);
-
-function_entry basic_functions[] = {
- PHP_FE(constant, NULL)
- PHP_FE(intval, NULL)
- PHP_FE(doubleval, NULL)
- PHP_FE(strval, NULL)
- PHP_FE(bin2hex, NULL)
- PHP_FE(sleep, NULL)
- PHP_FE(usleep, NULL)
-
- PHP_FE(time, NULL)
- PHP_FE(mktime, NULL)
- PHP_FE(gmmktime, NULL)
-#if HAVE_STRFTIME
- PHP_FE(strftime, NULL)
- PHP_FE(gmstrftime, NULL)
-#else
- PHP_FALIAS(strftime , warn_not_available, NULL)
- PHP_FALIAS(gmstrftime, warn_not_available, NULL)
-#endif
- PHP_FE(strtotime, NULL)
- PHP_FE(date, NULL)
- PHP_FE(gmdate, NULL)
- PHP_FE(getdate, NULL)
- PHP_FE(localtime, NULL)
- PHP_FE(checkdate, NULL)
-
- PHP_FE(flush, NULL)
-
- PHP_FE(gettype, NULL)
- PHP_FE(settype, first_arg_force_ref)
-
- PHP_FE(getimagesize, second_args_force_ref)
-
- PHP_FE(wordwrap, NULL)
- PHP_FE(htmlspecialchars, NULL)
- PHP_FE(htmlentities, NULL)
- PHP_FE(get_html_translation_table, NULL)
-
- PHP_NAMED_FE(md5, php_if_md5, NULL)
- PHP_NAMED_FE(crc32, php_if_crc32, NULL)
-
- PHP_FE(iptcparse, NULL)
- PHP_FE(iptcembed, NULL)
-
- PHP_FE(phpinfo, NULL)
- PHP_FE(phpversion, NULL)
- PHP_FE(phpcredits, NULL)
- PHP_FE(php_logo_guid, NULL)
- PHP_FE(zend_logo_guid, NULL)
- PHP_FE(php_sapi_name, NULL)
- PHP_FE(php_uname, NULL)
-
- PHP_FE(strnatcmp, NULL)
- PHP_FE(strnatcasecmp, NULL)
- PHP_FE(substr_count, NULL)
- PHP_FE(strspn, NULL)
- PHP_FE(strcspn, NULL)
- PHP_FE(strtok, NULL)
- PHP_FE(strtoupper, NULL)
- PHP_FE(strtolower, NULL)
- PHP_FE(strpos, NULL)
- PHP_FE(strrpos, NULL)
- PHP_FE(strrev, NULL)
- PHP_FE(hebrev, NULL)
- PHP_FE(hebrevc, NULL)
- PHP_FE(nl2br, NULL)
- PHP_FE(basename, NULL)
- PHP_FE(dirname, NULL)
- PHP_FE(pathinfo, NULL)
- PHP_FE(stripslashes, NULL)
- PHP_FE(stripcslashes, NULL)
- PHP_FE(strstr, NULL)
- PHP_FE(stristr, NULL)
- PHP_FE(strrchr, NULL)
-#ifdef HAVE_STRCOLL
- PHP_FE(strcoll, NULL)
-#else
- PHP_FALIAS(strcoll, warn_not_available, NULL)
-#endif
- PHP_FE(substr, NULL)
- PHP_FE(substr_replace, NULL)
- PHP_FE(quotemeta, NULL)
- PHP_FE(ucfirst, NULL)
- PHP_FE(ucwords, NULL)
- PHP_FE(strtr, NULL)
- PHP_FE(addslashes, NULL)
- PHP_FE(addcslashes, NULL)
- PHP_FE(chop, NULL)
- PHP_FE(str_replace, NULL)
- PHP_FE(str_repeat, NULL)
- PHP_FE(count_chars, NULL)
- PHP_FE(chunk_split, NULL)
- PHP_FE(trim, NULL)
- PHP_FE(ltrim, NULL)
- PHP_FE(strip_tags, NULL)
- PHP_FE(similar_text, third_argument_force_ref)
- PHP_FE(explode, NULL)
- PHP_FE(implode, NULL)
- PHP_FE(setlocale, NULL)
- PHP_FE(localeconv, NULL)
- PHP_FE(soundex, NULL)
- PHP_FE(levenshtein, NULL)
- PHP_FE(chr, NULL)
- PHP_FE(ord, NULL)
- PHP_FE(parse_str, second_arg_force_ref)
- PHP_FE(str_pad, NULL)
- PHP_FALIAS(rtrim, chop, NULL)
- PHP_FALIAS(strchr, strstr, NULL)
- PHP_NAMED_FE(sprintf, PHP_FN(user_sprintf), NULL)
- PHP_NAMED_FE(printf, PHP_FN(user_printf), NULL)
- PHP_FE(sscanf, third_and_rest_force_ref)
- PHP_FE(fscanf, third_and_rest_force_ref)
- PHP_FE(parse_url, NULL)
- PHP_FE(urlencode, NULL)
- PHP_FE(urldecode, NULL)
- PHP_FE(rawurlencode, NULL)
- PHP_FE(rawurldecode, NULL)
-
-#ifdef HAVE_SYMLINK
- PHP_FE(readlink, NULL)
- PHP_FE(linkinfo, NULL)
- PHP_FE(symlink, NULL)
- PHP_FE(link, NULL)
-#else
- PHP_FALIAS(readlink, warn_not_available, NULL)
- PHP_FALIAS(linkinfo, warn_not_available, NULL)
- PHP_FALIAS(symlink, warn_not_available, NULL)
- PHP_FALIAS(link, warn_not_available, NULL)
-#endif
- PHP_FE(unlink, NULL)
-
- PHP_FE(exec, second_and_third_args_force_ref)
- PHP_FE(system, second_arg_force_ref)
- PHP_FE(escapeshellcmd, NULL)
- PHP_FE(escapeshellarg, NULL)
- PHP_FE(passthru, second_arg_force_ref)
- PHP_FE(shell_exec, NULL)
-
- PHP_FE(rand, NULL)
- PHP_FE(srand, NULL)
- PHP_FE(getrandmax, NULL)
- PHP_FE(mt_rand, NULL)
- PHP_FE(mt_srand, NULL)
- PHP_FE(mt_getrandmax, NULL)
-
-#if HAVE_GETSERVBYNAME
- PHP_FE(getservbyname, NULL)
-#endif
-#if HAVE_GETSERVBYPORT
- PHP_FE(getservbyport, NULL)
-#endif
-#if HAVE_GETPROTOBYNAME
- PHP_FE(getprotobyname, NULL)
-#endif
-#if HAVE_GETPROTOBYNUMBER
- PHP_FE(getprotobynumber, NULL)
-#endif
-
- PHP_FE(gethostbyaddr, NULL)
- PHP_FE(gethostbyname, NULL)
- PHP_FE(gethostbynamel, NULL)
-#if HAVE_RES_SEARCH && !(defined(__BEOS__)||defined(PHP_WIN32))
- PHP_FE(checkdnsrr, NULL)
- PHP_FE(getmxrr, second_and_third_args_force_ref)
-#else
- PHP_FALIAS(checkdnsrr, warn_not_available, NULL)
- PHP_FALIAS(getmxrr, warn_not_available, NULL)
-#endif
-
- PHP_FE(getmyuid, NULL)
- PHP_FE(getmypid, NULL)
- PHP_FE(getmyinode, NULL)
- PHP_FE(getlastmod, NULL)
-
- PHP_FE(base64_decode, NULL)
- PHP_FE(base64_encode, NULL)
-
- PHP_FE(abs, NULL)
- PHP_FE(ceil, NULL)
- PHP_FE(floor, NULL)
- PHP_FE(round, NULL)
- PHP_FE(sin, NULL)
- PHP_FE(cos, NULL)
- PHP_FE(tan, NULL)
- PHP_FE(asin, NULL)
- PHP_FE(acos, NULL)
- PHP_FE(atan, NULL)
- PHP_FE(atan2, NULL)
- PHP_FE(pi, NULL)
- PHP_FE(pow, NULL)
- PHP_FE(exp, NULL)
- PHP_FE(log, NULL)
- PHP_FE(log10, NULL)
- PHP_FE(sqrt, NULL)
- PHP_FE(deg2rad, NULL)
- PHP_FE(rad2deg, NULL)
- PHP_FE(bindec, NULL)
- PHP_FE(hexdec, NULL)
- PHP_FE(octdec, NULL)
- PHP_FE(decbin, NULL)
- PHP_FE(decoct, NULL)
- PHP_FE(dechex, NULL)
- PHP_FE(base_convert, NULL)
- PHP_FE(number_format, NULL)
- PHP_FE(ip2long, NULL)
- PHP_FE(long2ip, NULL)
-
- PHP_FE(getenv, NULL)
-#ifdef HAVE_PUTENV
- PHP_FE(putenv, NULL)
-#else
- PHP_FALIAS(putenv , warn_not_available, NULL)
-#endif
-
- PHP_FE(microtime, NULL)
- PHP_FE(gettimeofday, NULL)
-#ifdef HAVE_GETRUSAGE
- PHP_FE(getrusage, NULL)
-#else
- PHP_FALIAS(getrusage , warn_not_available, NULL)
-#endif
-
- PHP_FE(uniqid, NULL)
-
- PHP_FE(quoted_printable_decode, NULL)
-
- PHP_FE(convert_cyr_string, NULL)
- PHP_FE(get_current_user, NULL)
- PHP_FE(set_time_limit, NULL)
-
- PHP_FE(get_cfg_var, NULL)
- PHP_FALIAS(magic_quotes_runtime, set_magic_quotes_runtime, NULL)
- PHP_FE(set_magic_quotes_runtime, NULL)
- PHP_FE(get_magic_quotes_gpc, NULL)
- PHP_FE(get_magic_quotes_runtime, NULL)
-
- PHP_FE(is_null, first_arg_allow_ref)
- PHP_FE(is_resource, first_arg_allow_ref)
- PHP_FE(is_bool, first_arg_allow_ref)
- PHP_FE(is_long, first_arg_allow_ref)
- PHP_FALIAS(is_int, is_long, first_arg_allow_ref)
- PHP_FALIAS(is_integer, is_long, first_arg_allow_ref)
- PHP_FALIAS(is_float, is_double, first_arg_allow_ref)
- PHP_FE(is_double, first_arg_allow_ref)
- PHP_FALIAS(is_real, is_double, first_arg_allow_ref)
- PHP_FE(is_numeric, NULL)
- PHP_FE(is_string, first_arg_allow_ref)
- PHP_FE(is_array, first_arg_allow_ref)
- PHP_FE(is_object, first_arg_allow_ref)
- PHP_FE(is_scalar, NULL)
- PHP_FE(is_callable, third_argument_force_ref)
-
- PHP_FE(error_log, NULL)
- PHP_FE(call_user_func, NULL)
- PHP_FE(call_user_func_array, NULL)
- PHP_FE(call_user_method, second_arg_force_ref)
- PHP_FE(call_user_method_array, second_arg_force_ref)
-
- PHP_FE(var_dump, NULL)
- PHP_FE(serialize, first_arg_allow_ref)
- PHP_FE(unserialize, first_arg_allow_ref)
-
- PHP_FE(register_shutdown_function, NULL)
-
- PHP_FE(register_tick_function, NULL)
- PHP_FE(unregister_tick_function, NULL)
-
- PHP_FE(highlight_file, NULL)
- PHP_FALIAS(show_source, highlight_file , NULL)
- PHP_FE(highlight_string, NULL)
-
- PHP_FE(ini_get, NULL)
- PHP_FE(ini_set, NULL)
- PHP_FALIAS(ini_alter, ini_set, NULL)
- PHP_FE(ini_restore, NULL)
-
- PHP_FE(print_r, NULL)
-
- PHP_FE(setcookie, NULL)
- PHP_FE(header, NULL)
- PHP_FE(headers_sent, NULL)
-
- PHP_FE(connection_aborted, NULL)
- PHP_FE(connection_status, NULL)
- PHP_FE(ignore_user_abort, NULL)
-
- PHP_FE(parse_ini_file, NULL)
-
- PHP_FE(is_uploaded_file, NULL)
- PHP_FE(move_uploaded_file, NULL)
-
- /* functions from reg.c */
- PHP_FE(ereg, third_argument_force_ref)
- PHP_FE(ereg_replace, NULL)
- PHP_FE(eregi, third_argument_force_ref)
- PHP_FE(eregi_replace, NULL)
- PHP_FE(split, NULL)
- PHP_FE(spliti, NULL)
- PHP_FALIAS(join, implode, NULL)
- PHP_FE(sql_regcase, NULL)
-
- /* functions from dl.c */
- PHP_FE(dl, NULL)
-
-
- /* functions from file.c */
- PHP_FE(pclose, NULL)
- PHP_FE(popen, NULL)
- PHP_FE(readfile, NULL)
- PHP_FE(rewind, NULL)
- PHP_FE(rmdir, NULL)
- PHP_FE(umask, NULL)
- PHP_FE(fclose, NULL)
- PHP_FE(feof, NULL)
- PHP_FE(fgetc, NULL)
- PHP_FE(fgets, NULL)
- PHP_FE(fgetss, NULL)
- PHP_FE(fread, NULL)
- PHP_STATIC_FE("fopen", php_if_fopen, NULL)
- PHP_FE(fpassthru, NULL)
- PHP_STATIC_FE("ftruncate", php_if_ftruncate, NULL)
- PHP_STATIC_FE("fstat", php_if_fstat, NULL)
- PHP_FE(fseek, NULL)
- PHP_FE(ftell, NULL)
- PHP_FE(fflush, NULL)
- PHP_FE(fwrite, NULL)
- PHP_FALIAS(fputs, fwrite, NULL)
- PHP_FE(mkdir, NULL)
- PHP_FE(rename, NULL)
- PHP_FE(copy, NULL)
- PHP_FE(tempnam, NULL)
- PHP_STATIC_FE("tmpfile", php_if_tmpfile, NULL)
- PHP_FE(file, NULL)
- PHP_FE(fgetcsv, NULL)
- PHP_FE(flock, NULL)
- PHP_FE(get_meta_tags, NULL)
- PHP_FE(set_file_buffer, NULL)
- /* set_socket_blocking() is deprecated,
- use socket_set_blocking() instead */
- PHP_FE(set_socket_blocking, NULL)
- PHP_FE(socket_set_blocking, NULL)
-#if HAVE_PHP_STREAM
- PHP_FE(fopenstream, NULL)
-#else
- PHP_FALIAS(fopenstream, warn_not_available, NULL)
-#endif
-#if HAVE_SYS_TIME_H
- PHP_FE(socket_set_timeout, NULL)
-#else
- PHP_FALIAS(socket_set_timeout, warn_not_available, NULL)
-#endif
- PHP_FE(socket_get_status, NULL)
-#if (!defined(PHP_WIN32) && !defined(__BEOS__)) || defined(ZTS)
- PHP_FE(realpath, NULL)
-#else
- PHP_FALIAS(realpath, warn_not_available, NULL)
-#endif
-
- /* functions from fsock.c */
- PHP_FE(fsockopen, third_and_fourth_args_force_ref)
- PHP_FE(pfsockopen, third_and_fourth_args_force_ref)
-
- /* functions from pack.c */
- PHP_FE(pack, NULL)
- PHP_FE(unpack, NULL)
-
- /* functions from browscap.c */
- PHP_FE(get_browser, NULL)
-
-#if HAVE_CRYPT
- /* functions from crypt.c */
- PHP_FE(crypt, NULL)
-#else
- PHP_FALIAS(crypt , warn_not_available, NULL)
-#endif
-
- /* functions from dir.c */
- PHP_FE(opendir, NULL)
- PHP_FE(closedir, NULL)
- PHP_FE(chdir, NULL)
-#if defined(HAVE_CHROOT) && !defined(ZTS)
- PHP_FE(chroot, NULL)
-#else
- PHP_FALIAS(chroot, warn_not_available, NULL)
-#endif
- PHP_FE(getcwd, NULL)
- PHP_FE(rewinddir, NULL)
- PHP_STATIC_FE("readdir", php_if_readdir, NULL)
- PHP_FALIAS(dir, getdir, NULL)
-
- /* functions from filestat.c */
- PHP_FE(fileatime, NULL)
- PHP_FE(filectime, NULL)
- PHP_FE(filegroup, NULL)
- PHP_FE(fileinode, NULL)
- PHP_FE(filemtime, NULL)
- PHP_FE(fileowner, NULL)
- PHP_FE(fileperms, NULL)
- PHP_FE(filesize, NULL)
- PHP_FE(filetype, NULL)
- PHP_FE(file_exists, NULL)
- PHP_FE(is_writable, NULL)
- PHP_FALIAS(is_writeable, is_writable, NULL)
- PHP_FE(is_readable, NULL)
- PHP_FE(is_executable, NULL)
- PHP_FE(is_file, NULL)
- PHP_FE(is_dir, NULL)
- PHP_FE(is_link, NULL)
- PHP_STATIC_FE("stat", php_if_stat, NULL)
- PHP_STATIC_FE("lstat", php_if_lstat, NULL)
- PHP_FE(chown, NULL)
- PHP_FE(chgrp, NULL)
- PHP_FE(chmod, NULL)
- PHP_FE(touch, NULL)
- PHP_FE(clearstatcache, NULL)
- PHP_FE(disk_total_space, NULL)
- PHP_FE(disk_free_space, NULL)
- PHP_FALIAS(diskfreespace, disk_free_space, NULL)
-
- /* functions from mail.c */
-#ifdef HAVE_SENDMAIL
- PHP_FE(mail, NULL)
- PHP_FE(ezmlm_hash, NULL)
-#else
- PHP_FALIAS(mail, warn_not_available, NULL)
- PHP_FALIAS(ezmlm_hash, warn_not_available, NULL)
-#endif
-
- /* functions from syslog.c */
-#ifdef HAVE_SYSLOG_H
- PHP_FE(openlog, NULL)
- PHP_FE(syslog, NULL)
- PHP_FE(closelog, NULL)
- PHP_FE(define_syslog_variables, NULL)
-#endif
-
- /* functions from lcg.c */
- PHP_FE(lcg_value, NULL)
-
- /* functions from metaphone.c */
- PHP_FE(metaphone, NULL)
-
- /* functions from output.c */
- PHP_FE(ob_start, NULL)
- PHP_FE(ob_end_flush, NULL)
- PHP_FE(ob_end_clean, NULL)
- PHP_FE(ob_get_length, NULL)
- PHP_FE(ob_get_contents, NULL)
- PHP_FE(ob_implicit_flush, NULL)
-
- /* functions from array.c */
- PHP_FE(ksort, first_arg_force_ref)
- PHP_FE(krsort, first_arg_force_ref)
- PHP_FE(natsort, first_arg_force_ref)
- PHP_FE(natcasesort, first_arg_force_ref)
- PHP_FE(asort, first_arg_force_ref)
- PHP_FE(arsort, first_arg_force_ref)
- PHP_FE(sort, first_arg_force_ref)
- PHP_FE(rsort, first_arg_force_ref)
- PHP_FE(usort, first_arg_force_ref)
- PHP_FE(uasort, first_arg_force_ref)
- PHP_FE(uksort, first_arg_force_ref)
- PHP_FE(shuffle, first_arg_force_ref)
- PHP_FE(array_walk, first_arg_force_ref)
- PHP_FE(count, first_arg_allow_ref)
- PHP_FE(end, first_arg_force_ref)
- PHP_FE(prev, first_arg_force_ref)
- PHP_FE(next, first_arg_force_ref)
- PHP_FE(reset, first_arg_force_ref)
- PHP_FE(current, first_arg_force_ref)
- PHP_FE(key, first_arg_force_ref)
- PHP_FE(min, NULL)
- PHP_FE(max, NULL)
- PHP_FE(in_array, NULL)
- PHP_FE(array_search, NULL)
- PHP_FE(extract, NULL)
- PHP_FE(compact, NULL)
- PHP_FE(range, NULL)
- PHP_FE(array_multisort, NULL)
- PHP_FE(array_push, first_arg_force_ref)
- PHP_FE(array_pop, first_arg_force_ref)
- PHP_FE(array_shift, first_arg_force_ref)
- PHP_FE(array_unshift, first_arg_force_ref)
- PHP_FE(array_splice, first_arg_force_ref)
- PHP_FE(array_slice, NULL)
- PHP_FE(array_merge, NULL)
- PHP_FE(array_merge_recursive, NULL)
- PHP_FE(array_keys, NULL)
- PHP_FE(array_values, NULL)
- PHP_FE(array_count_values, NULL)
- PHP_FE(array_reverse, NULL)
- PHP_FE(array_reduce, NULL)
- PHP_FE(array_pad, NULL)
- PHP_FE(array_flip, NULL)
- PHP_FE(array_rand, NULL)
- PHP_FE(array_unique, NULL)
- PHP_FE(array_intersect, NULL)
- PHP_FE(array_diff, NULL)
- PHP_FE(array_sum, NULL)
- PHP_FE(array_filter, NULL)
- PHP_FE(array_map, NULL)
- PHP_FE(key_exists, NULL)
-
- /* aliases from array.c */
- PHP_FALIAS(pos, current, first_arg_force_ref)
- PHP_FALIAS(sizeof, count, first_arg_allow_ref)
-
- /* functions from assert.c */
- PHP_FE(assert, NULL)
- PHP_FE(assert_options, NULL)
-
- {NULL, NULL, NULL}
-};
-
-
-static PHP_INI_MH(OnUpdateSafeModeProtectedEnvVars)
-{
- char *protected_vars, *protected_var;
- char *token_buf;
- int dummy=1;
- BLS_FETCH();
-
- protected_vars = estrndup(new_value, new_value_length);
- zend_hash_clean(&BG(sm_protected_env_vars));
-
- protected_var= php_strtok_r(protected_vars, ", ", &token_buf);
- while (protected_var) {
- zend_hash_update(&BG(sm_protected_env_vars), protected_var, strlen(protected_var), &dummy, sizeof(int), NULL);
- protected_var=php_strtok_r(NULL, ", ", &token_buf);
- }
- efree(protected_vars);
- return SUCCESS;
-}
-
-
-static PHP_INI_MH(OnUpdateSafeModeAllowedEnvVars)
-{
- BLS_FETCH();
-
- if (BG(sm_allowed_env_vars)) {
- free(BG(sm_allowed_env_vars));
- }
- BG(sm_allowed_env_vars) = zend_strndup(new_value, new_value_length);
- return SUCCESS;
-}
-
-PHP_INI_BEGIN()
- PHP_INI_ENTRY_EX("safe_mode_protected_env_vars", SAFE_MODE_PROTECTED_ENV_VARS, PHP_INI_SYSTEM, OnUpdateSafeModeProtectedEnvVars, NULL)
- PHP_INI_ENTRY_EX("safe_mode_allowed_env_vars", SAFE_MODE_ALLOWED_ENV_VARS, PHP_INI_SYSTEM, OnUpdateSafeModeAllowedEnvVars, NULL)
- STD_PHP_INI_ENTRY("session.use_trans_sid", "1", PHP_INI_ALL, OnUpdateBool, use_trans_sid, php_basic_globals, basic_globals)
-PHP_INI_END()
-
-
-zend_module_entry basic_functions_module = {
- "standard", /* extension name */
- basic_functions, /* function list */
- PHP_MINIT(basic), /* process startup */
- PHP_MSHUTDOWN(basic), /* process shutdown */
- PHP_RINIT(basic), /* request startup */
- PHP_RSHUTDOWN(basic), /* request shutdown */
- PHP_MINFO(basic), /* extension info */
- STANDARD_MODULE_PROPERTIES
-};
-
-#if defined(HAVE_PUTENV)
-
-static void php_putenv_destructor(putenv_entry *pe)
-{
- if (pe->previous_value) {
- putenv(pe->previous_value);
- } else {
-# if HAVE_UNSETENV
- unsetenv(pe->key);
-# else
- char **env;
-
- for (env = environ; env != NULL && *env != NULL; env++) {
- if (!strncmp(*env,pe->key,pe->key_len) && (*env)[pe->key_len]=='=') { /* found it */
- *env = "";
- break;
- }
- }
-# endif
- }
- efree(pe->putenv_string);
- efree(pe->key);
-}
-#endif
-
-
-void test_class_startup(void);
-
-static void basic_globals_ctor(BLS_D)
-{
- BG(next) = NULL;
- BG(left) = -1;
- BG(user_tick_functions) = NULL;
- zend_hash_init(&BG(sm_protected_env_vars), 5, NULL, NULL, 1);
- BG(sm_allowed_env_vars) = NULL;
-
-#ifdef TRANS_SID
- memset(&BG(url_adapt_state), 0, sizeof(BG(url_adapt_state)));
- memset(&BG(url_adapt_state_ex), 0, sizeof(BG(url_adapt_state_ex)));
-#endif
-
-#ifdef PHP_WIN32
- CoInitialize(NULL);
-#endif
-}
-
-static void basic_globals_dtor(BLS_D)
-{
- zend_hash_destroy(&BG(sm_protected_env_vars));
- if (BG(sm_allowed_env_vars)) {
- free(BG(sm_allowed_env_vars));
- }
-#ifdef PHP_WIN32
- CoUninitialize();
-#endif
-}
-
-
-PHP_MINIT_FUNCTION(basic)
-{
- PLS_FETCH();
-
-#ifdef ZTS
- basic_globals_id = ts_allocate_id(sizeof(php_basic_globals), (ts_allocate_ctor) basic_globals_ctor, (ts_allocate_dtor) basic_globals_dtor);
-#else
- basic_globals_ctor(BLS_C);
-#endif
-
- REGISTER_LONG_CONSTANT("CONNECTION_ABORTED", PHP_CONNECTION_ABORTED, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("CONNECTION_NORMAL", PHP_CONNECTION_NORMAL, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("CONNECTION_TIMEOUT", PHP_CONNECTION_TIMEOUT, CONST_CS | CONST_PERSISTENT);
-
-#define REGISTER_MATH_CONSTANT(x) REGISTER_DOUBLE_CONSTANT(#x, x, CONST_CS | CONST_PERSISTENT)
- REGISTER_MATH_CONSTANT(M_E);
- REGISTER_MATH_CONSTANT(M_LOG2E);
- REGISTER_MATH_CONSTANT(M_LOG10E);
- REGISTER_MATH_CONSTANT(M_LN2);
- REGISTER_MATH_CONSTANT(M_LN10);
- REGISTER_MATH_CONSTANT(M_PI);
- REGISTER_MATH_CONSTANT(M_PI_2);
- REGISTER_MATH_CONSTANT(M_PI_4);
- REGISTER_MATH_CONSTANT(M_1_PI);
- REGISTER_MATH_CONSTANT(M_2_PI);
- REGISTER_MATH_CONSTANT(M_2_SQRTPI);
- REGISTER_MATH_CONSTANT(M_SQRT2);
- REGISTER_MATH_CONSTANT(M_SQRT1_2);
-
-
- test_class_startup();
- REGISTER_INI_ENTRIES();
-
- register_phpinfo_constants(INIT_FUNC_ARGS_PASSTHRU);
- register_html_constants(INIT_FUNC_ARGS_PASSTHRU);
- register_string_constants(INIT_FUNC_ARGS_PASSTHRU);
-
- PHP_MINIT(regex)(INIT_FUNC_ARGS_PASSTHRU);
- PHP_MINIT(file)(INIT_FUNC_ARGS_PASSTHRU);
- PHP_MINIT(pack)(INIT_FUNC_ARGS_PASSTHRU);
- PHP_MINIT(browscap)(INIT_FUNC_ARGS_PASSTHRU);
-#if defined(HAVE_LOCALECONV) && defined(ZTS)
- PHP_MINIT(localeconv)(INIT_FUNC_ARGS_PASSTHRU);
-#endif
-
-#if HAVE_CRYPT
- PHP_MINIT(crypt)(INIT_FUNC_ARGS_PASSTHRU);
-#endif
-
-#ifdef ZTS
- PHP_MINIT(lcg)(INIT_FUNC_ARGS_PASSTHRU);
-#endif
-
- PHP_MINIT(dir)(INIT_FUNC_ARGS_PASSTHRU);
- PHP_MINIT(syslog)(INIT_FUNC_ARGS_PASSTHRU);
- PHP_MINIT(array)(INIT_FUNC_ARGS_PASSTHRU);
- PHP_MINIT(assert)(INIT_FUNC_ARGS_PASSTHRU);
-#ifdef TRANS_SID
- PHP_MINIT(url_scanner_ex)(INIT_FUNC_ARGS_PASSTHRU);
-#endif
-
- if(PG(allow_url_fopen)) {
- if (FAILURE==php_register_url_wrapper("http", php_fopen_url_wrap_http)) {
- return FAILURE;
- }
- if (FAILURE==php_register_url_wrapper("ftp", php_fopen_url_wrap_ftp)) {
- return FAILURE;
- }
- if (FAILURE==php_register_url_wrapper("php", php_fopen_url_wrap_php)) {
- return FAILURE;
- }
- }
-
- return SUCCESS;
-}
-
-
-PHP_MSHUTDOWN_FUNCTION(basic)
-{
- PLS_FETCH();
- BLS_FETCH();
-
- basic_globals_dtor(BLS_C);
-
-#ifdef ZTS
- ts_free_id(basic_globals_id);
-#endif
-
- if(PG(allow_url_fopen)) {
- php_unregister_url_wrapper("http");
- php_unregister_url_wrapper("ftp");
- php_unregister_url_wrapper("php");
- }
-
- UNREGISTER_INI_ENTRIES();
-
- PHP_MSHUTDOWN(regex)(SHUTDOWN_FUNC_ARGS_PASSTHRU);
- PHP_MSHUTDOWN(browscap)(SHUTDOWN_FUNC_ARGS_PASSTHRU);
- PHP_MSHUTDOWN(array)(SHUTDOWN_FUNC_ARGS_PASSTHRU);
- PHP_MSHUTDOWN(assert)(SHUTDOWN_FUNC_ARGS_PASSTHRU);
-#ifdef TRANS_SID
- PHP_MSHUTDOWN(url_scanner_ex)(SHUTDOWN_FUNC_ARGS_PASSTHRU);
-#endif
- PHP_MSHUTDOWN(file)(SHUTDOWN_FUNC_ARGS_PASSTHRU);
-#if defined(HAVE_LOCALECONV) && defined(ZTS)
- PHP_MSHUTDOWN(localeconv)(SHUTDOWN_FUNC_ARGS_PASSTHRU);
-#endif
-
- return SUCCESS;
-}
-
-
-PHP_RINIT_FUNCTION(basic)
-{
- BLS_FETCH();
-
- BG(strtok_string) = NULL;
- BG(locale_string) = NULL;
- BG(user_compare_func_name) = NULL;
- BG(array_walk_func_name) = NULL;
- BG(incomplete_class) = NULL;
-#ifdef HAVE_MMAP
- BG(mmap_file) = NULL;
-#endif
- BG(page_uid) = -1;
- BG(page_inode) = -1;
- BG(page_mtime) = -1;
-#ifdef HAVE_PUTENV
- if (zend_hash_init(&BG(putenv_ht), 1, NULL, (void (*)(void *)) php_putenv_destructor, 0) == FAILURE) {
- return FAILURE;
- }
-#endif
- BG(user_shutdown_function_names)=NULL;
-
-#if HAVE_CRYPT
- PHP_RINIT(crypt)(INIT_FUNC_ARGS_PASSTHRU);
-#endif
-
-#ifndef ZTS
- PHP_RINIT(lcg)(INIT_FUNC_ARGS_PASSTHRU);
-#endif
-
- PHP_RINIT(filestat)(INIT_FUNC_ARGS_PASSTHRU);
- PHP_RINIT(syslog)(INIT_FUNC_ARGS_PASSTHRU);
- PHP_RINIT(assert)(INIT_FUNC_ARGS_PASSTHRU);
- PHP_RINIT(dir)(INIT_FUNC_ARGS_PASSTHRU);
-
-#ifdef TRANS_SID
- if (BG(use_trans_sid)) {
- PHP_RINIT(url_scanner)(INIT_FUNC_ARGS_PASSTHRU);
- PHP_RINIT(url_scanner_ex)(INIT_FUNC_ARGS_PASSTHRU);
- }
-#endif
-
- return SUCCESS;
-}
-
-
-PHP_RSHUTDOWN_FUNCTION(basic)
-{
- BLS_FETCH();
-
- STR_FREE(BG(strtok_string));
-#ifdef HAVE_PUTENV
- zend_hash_destroy(&BG(putenv_ht));
-#endif
- /* Check if locale was changed and change it back
- to the value in startup environment */
- if (BG(locale_string) != NULL) {
- setlocale(LC_ALL, "C");
- setlocale(LC_CTYPE, "");
- }
- STR_FREE(BG(locale_string));
-
- PHP_RSHUTDOWN(fsock)(SHUTDOWN_FUNC_ARGS_PASSTHRU);
- PHP_RSHUTDOWN(filestat)(SHUTDOWN_FUNC_ARGS_PASSTHRU);
- PHP_RSHUTDOWN(syslog)(SHUTDOWN_FUNC_ARGS_PASSTHRU);
- PHP_RSHUTDOWN(assert)(SHUTDOWN_FUNC_ARGS_PASSTHRU);
-
-#ifdef TRANS_SID
- PHP_RSHUTDOWN(url_scanner_ex)(SHUTDOWN_FUNC_ARGS_PASSTHRU);
- PHP_RSHUTDOWN(url_scanner)(SHUTDOWN_FUNC_ARGS_PASSTHRU);
-#endif
-
- if (BG(user_tick_functions)) {
- zend_llist_destroy(BG(user_tick_functions));
- efree(BG(user_tick_functions));
- BG(user_tick_functions) = NULL;
- }
-
-#ifdef HAVE_MMAP
- if (BG(mmap_file)) {
- munmap(BG(mmap_file), BG(mmap_len));
- }
-#endif
-
- return SUCCESS;
-}
-
-
-PHP_MINFO_FUNCTION(basic)
-{
- php_info_print_table_start();
- PHP_MINFO(regex)(ZEND_MODULE_INFO_FUNC_ARGS_PASSTHRU);
- PHP_MINFO(dl)(ZEND_MODULE_INFO_FUNC_ARGS_PASSTHRU);
- PHP_MINFO(mail)(ZEND_MODULE_INFO_FUNC_ARGS_PASSTHRU);
- php_info_print_table_end();
- PHP_MINFO(assert)(ZEND_MODULE_INFO_FUNC_ARGS_PASSTHRU);
-}
-
-/* {{{ proto mixed constant(string const_name)
- Given the name of a constant this function will return the constants associated value */
-PHP_FUNCTION(constant)
-{
- zval **const_name;
-
- if (ZEND_NUM_ARGS() != 1 ||
- zend_get_parameters_ex(1, &const_name) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(const_name);
-
- if (!zend_get_constant(Z_STRVAL_PP(const_name), Z_STRLEN_PP(const_name), return_value)) {
- php_error(E_WARNING, "Couldn't find constant %s", Z_STRVAL_PP(const_name));
- RETURN_NULL();
- }
-}
-/* }}} */
-
-
-/* {{{ proto string ip2long(string ip_address)
- Converts a string containing an (IPv4) Internet Protocol dotted address into a proper address */
-PHP_FUNCTION(ip2long)
-{
- zval **str;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &str) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(str);
-
- RETURN_LONG(ntohl(inet_addr(Z_STRVAL_PP(str))));
-}
-/* }}} */
-
-/* {{{ proto string long2ip(int proper_address)
- Converts an (IPv4) Internet network address into a string in Internet standard dotted format */
-PHP_FUNCTION(long2ip)
-{
- zval **num;
- struct in_addr myaddr;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &num) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(num);
- myaddr.s_addr = htonl((unsigned long)Z_LVAL_PP(num));
-
- RETURN_STRING (inet_ntoa(myaddr), 1);
-}
-/* }}} */
-
-
-/********************
- * System Functions *
- ********************/
-
-/* {{{ proto string getenv(string varname)
- Get the value of an environment variable */
-PHP_FUNCTION(getenv)
-{
- pval **str;
- char *ptr;
-
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &str) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(str);
-
- if (Z_TYPE_PP(str) != IS_STRING) {
- RETURN_FALSE;
- }
-
-
- ptr = sapi_getenv(Z_STRVAL_PP(str), Z_STRLEN_PP(str));
- if (!ptr) {
- ptr = getenv(Z_STRVAL_PP(str));
- }
- if (ptr) {
- RETURN_STRING(ptr, 1);
- }
- RETURN_FALSE;
-}
-/* }}} */
-
-#ifdef HAVE_PUTENV
-
-/* {{{ proto void putenv(string setting)
- Set the value of an environment variable */
-PHP_FUNCTION(putenv)
-{
- pval **str;
- BLS_FETCH();
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &str) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(str);
-
- if (Z_STRVAL_PP(str) && *(Z_STRVAL_PP(str))) {
- int ret;
- char *p,**env;
- putenv_entry pe;
- PLS_FETCH();
-
- pe.putenv_string = estrndup(Z_STRVAL_PP(str),Z_STRLEN_PP(str));
- pe.key = estrndup(Z_STRVAL_PP(str), Z_STRLEN_PP(str));
- if ((p=strchr(pe.key,'='))) { /* nullify the '=' if there is one */
- *p='\0';
- }
- pe.key_len = strlen(pe.key);
-
- if (PG(safe_mode)) {
- /* Check the protected list */
- if (zend_hash_exists(&BG(sm_protected_env_vars), pe.key, pe.key_len)) {
- php_error(E_WARNING, "Safe Mode: Cannot override protected environment variable '%s'", pe.key);
- efree(pe.putenv_string);
- efree(pe.key);
- RETURN_FALSE;
- }
-
- /* Check the allowed list */
- if (BG(sm_allowed_env_vars) && *BG(sm_allowed_env_vars)) {
- char *allowed_env_vars = estrdup(BG(sm_allowed_env_vars));
- char *allowed_prefix = strtok(allowed_env_vars, ", ");
- zend_bool allowed=0;
-
- while (allowed_prefix) {
- if (!strncmp(allowed_prefix, pe.key, strlen(allowed_prefix))) {
- allowed=1;
- break;
- }
- allowed_prefix = strtok(NULL, ", ");
- }
- efree(allowed_env_vars);
- if (!allowed) {
- php_error(E_WARNING, "Safe Mode: Cannot set environment variable '%s' - it's not in the allowed list", pe.key);
- efree(pe.putenv_string);
- efree(pe.key);
- RETURN_FALSE;
- }
- }
- }
-
- zend_hash_del(&BG(putenv_ht),pe.key,pe.key_len+1);
-
- /* find previous value */
- pe.previous_value = NULL;
- for (env = environ; env != NULL && *env != NULL; env++) {
- if (!strncmp(*env,pe.key,pe.key_len) && (*env)[pe.key_len]=='=') { /* found it */
- pe.previous_value = *env;
- break;
- }
- }
-
- if ((ret=putenv(pe.putenv_string))==0) { /* success */
- zend_hash_add(&BG(putenv_ht),pe.key,pe.key_len+1,(void **) &pe,sizeof(putenv_entry),NULL);
-#ifdef HAVE_TZSET
- if(!strncmp(pe.key,"TZ",2)) tzset();
-#endif
- RETURN_TRUE;
- } else {
- efree(pe.putenv_string);
- efree(pe.key);
- RETURN_FALSE;
- }
- }
-}
-/* }}} */
-#endif
-
-
-/*******************
- * Basic Functions *
- *******************/
-/* {{{ proto int intval(mixed var [, int base])
- Get the integer value of a variable using the optional base for the conversion */
-PHP_FUNCTION(intval)
-{
- pval **num, **arg_base;
- int base;
-
- switch(ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &num) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- base = 10;
- break;
- case 2:
- if (zend_get_parameters_ex(2, &num, &arg_base) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(arg_base);
- base = Z_LVAL_PP(arg_base);
- break;
- default:
- WRONG_PARAM_COUNT;
- }
- *return_value=**num;
- zval_copy_ctor(return_value);
- convert_to_long_base(return_value,base);
-}
-/* }}} */
-
-/* {{{ proto double doubleval(mixed var)
- Get the double-precision value of a variable */
-PHP_FUNCTION(doubleval)
-{
- pval **num;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &num) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- *return_value=**num;
- zval_copy_ctor(return_value);
- convert_to_double(return_value);
-}
-/* }}} */
-
-/* {{{ proto string strval(mixed var)
- Get the string value of a variable */
-PHP_FUNCTION(strval)
-{
- pval **num;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &num) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- *return_value=**num;
- zval_copy_ctor(return_value);
- convert_to_string(return_value);
-}
-/* }}} */
-
-/* {{{ proto void flush(void)
- Flush the output buffer */
-PHP_FUNCTION(flush)
-{
- sapi_flush();
-}
-/* }}} */
-
-/* {{{ proto void sleep(int seconds)
- Delay for a given number of seconds */
-PHP_FUNCTION(sleep)
-{
- pval **num;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &num) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(num);
- php_sleep(Z_LVAL_PP(num));
-}
-/* }}} */
-
-/* {{{ proto void usleep(int micro_seconds)
- Delay for a given number of micro seconds */
-PHP_FUNCTION(usleep)
-{
-#if HAVE_USLEEP
- pval **num;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &num) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(num);
- usleep(Z_LVAL_PP(num));
-#endif
-}
-/* }}} */
-
-/* {{{ proto string gettype(mixed var)
- Returns the type of the variable */
-PHP_FUNCTION(gettype)
-{
- pval **arg;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- switch (Z_TYPE_PP(arg)) {
- case IS_NULL:
- RETVAL_STRING("NULL",1);
- break;
- case IS_BOOL:
- RETVAL_STRING("boolean",1);
- break;
- case IS_LONG:
- RETVAL_STRING("integer",1);
- break;
- case IS_RESOURCE:
- RETVAL_STRING("resource",1);
- break;
- case IS_DOUBLE:
- RETVAL_STRING("double",1);
- break;
- case IS_STRING:
- RETVAL_STRING("string",1);
- break;
- case IS_ARRAY:
- RETVAL_STRING("array",1);
- break;
- case IS_OBJECT:
- RETVAL_STRING("object",1);
- break;
- /*
- {
- char *result;
- int res_len;
-
- res_len = sizeof("object of type ")-1 + arg->value.obj.ce->name_length;
- result = (char *) emalloc(res_len+1);
- sprintf(result, "object of type %s", arg->value.obj.ce->name);
- RETVAL_STRINGL(result, res_len, 0);
- }
- */
- break;
- default:
- RETVAL_STRING("unknown type",1);
- }
-}
-/* }}} */
-
-/* {{{ proto int settype(mixed var, string type)
- Set the type of the variable */
-PHP_FUNCTION(settype)
-{
- pval **var, **type;
- char *new_type;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &var, &type) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(type);
- new_type = Z_STRVAL_PP(type);
-
- if (!strcasecmp(new_type, "integer")) {
- convert_to_long(*var);
- } else if (!strcasecmp(new_type, "double")) {
- convert_to_double(*var);
- } else if (!strcasecmp(new_type, "string")) {
- convert_to_string(*var);
- } else if (!strcasecmp(new_type, "array")) {
- convert_to_array(*var);
- } else if (!strcasecmp(new_type, "object")) {
- convert_to_object(*var);
- } else if (!strcasecmp(new_type, "boolean")) {
- convert_to_boolean(*var);
- } else if (!strcasecmp(new_type, "resource")) {
- php_error(E_WARNING, "settype: cannot convert to resource type");
- RETURN_FALSE;
- } else {
- php_error(E_WARNING, "settype: invalid type");
- RETURN_FALSE;
- }
- RETVAL_TRUE;
-}
-/* }}} */
-
-/* {{{ proto string get_current_user(void)
- Get the name of the owner of the current PHP script */
-PHP_FUNCTION(get_current_user)
-{
- RETURN_STRING(php_get_current_user(),1);
-}
-/* }}} */
-
-/* {{{ proto string get_cfg_var(string option_name)
- Get the value of a PHP configuration option */
-PHP_FUNCTION(get_cfg_var)
-{
- pval **varname;
- char *value;
-
- if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &varname)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(varname);
-
- if (cfg_get_string(Z_STRVAL_PP(varname),&value)==FAILURE) {
- RETURN_FALSE;
- }
- RETURN_STRING(value,1);
-}
-/* }}} */
-
-
-/* {{{ proto int set_magic_quotes_runtime(int new_setting)
- Set the current active configuration setting of magic_quotes_runtime and return previous */
-PHP_FUNCTION(set_magic_quotes_runtime)
-{
- pval **new_setting;
- PLS_FETCH();
-
- if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &new_setting)==FAILURE) {
- RETURN_FALSE;
- }
- convert_to_boolean_ex(new_setting);
-
- PG(magic_quotes_runtime) = (zend_bool) Z_LVAL_PP(new_setting);
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int get_magic_quotes_runtime(void)
- Get the current active configuration setting of magic_quotes_runtime */
-PHP_FUNCTION(get_magic_quotes_runtime)
-{
- PLS_FETCH();
-
- RETURN_LONG(PG(magic_quotes_runtime));
-}
-/* }}} */
-
-/* {{{ proto int get_magic_quotes_gpc(void)
- Get the current active configuration setting of magic_quotes_gpc */
-PHP_FUNCTION(get_magic_quotes_gpc)
-{
- PLS_FETCH();
-
- RETURN_LONG(PG(magic_quotes_gpc));
-}
-/* }}} */
-
-
-void php_is_type(INTERNAL_FUNCTION_PARAMETERS,int type)
-{
- pval **arg;
-
- if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &arg)==FAILURE) {
- RETURN_FALSE;
- }
- if (Z_TYPE_PP(arg) == type) {
- RETURN_TRUE;
- } else {
- RETURN_FALSE;
- }
-}
-
-/* {{{ proto bool is_null(mixed var)
- Returns true if variable is null */
-PHP_FUNCTION(is_null)
-{
- php_is_type(INTERNAL_FUNCTION_PARAM_PASSTHRU, IS_NULL);
-}
-/* }}} */
-
-/* {{{ proto bool is_resource(mixed var)
- Returns true if variable is a resource */
-PHP_FUNCTION(is_resource)
-{
- php_is_type(INTERNAL_FUNCTION_PARAM_PASSTHRU, IS_RESOURCE);
-}
-/* }}} */
-
-/* {{{ proto bool is_bool(mixed var)
- Returns true if variable is a boolean */
-PHP_FUNCTION(is_bool)
-{
- php_is_type(INTERNAL_FUNCTION_PARAM_PASSTHRU, IS_BOOL);
-}
-/* }}} */
-
-/* {{{ proto bool is_long(mixed var)
- Returns true if variable is a long (integer) */
-PHP_FUNCTION(is_long)
-{
- php_is_type(INTERNAL_FUNCTION_PARAM_PASSTHRU, IS_LONG);
-}
-/* }}} */
-
-/* {{{ proto bool is_double(mixed var)
- Returns true if variable is a double */
-PHP_FUNCTION(is_double)
-{
- php_is_type(INTERNAL_FUNCTION_PARAM_PASSTHRU, IS_DOUBLE);
-}
-/* }}} */
-
-/* {{{ proto bool is_string(mixed var)
- Returns true if variable is a string */
-PHP_FUNCTION(is_string)
-{
- php_is_type(INTERNAL_FUNCTION_PARAM_PASSTHRU, IS_STRING);
-}
-/* }}} */
-
-/* {{{ proto bool is_array(mixed var)
- Returns true if variable is an array */
-PHP_FUNCTION(is_array)
-{
- php_is_type(INTERNAL_FUNCTION_PARAM_PASSTHRU, IS_ARRAY);
-}
-/* }}} */
-
-/* {{{ proto bool is_object(mixed var)
- Returns true if variable is an object */
-PHP_FUNCTION(is_object)
-{
- php_is_type(INTERNAL_FUNCTION_PARAM_PASSTHRU, IS_OBJECT);
-}
-/* }}} */
-
-/* {{{ proto bool is_numeric(mixed value)
- Returns true if value is a number or a numeric string */
-PHP_FUNCTION(is_numeric)
-{
- zval **arg;
- int result;
-
- if (ZEND_NUM_ARGS() !=1 || zend_get_parameters_ex(1, &arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- switch (Z_TYPE_PP(arg)) {
- case IS_LONG:
- case IS_DOUBLE:
- RETURN_TRUE;
- break;
-
- case IS_STRING:
- result = is_numeric_string(Z_STRVAL_PP(arg), Z_STRLEN_PP(arg), NULL, NULL);
- if (result == IS_LONG || result == IS_DOUBLE) {
- RETURN_TRUE;
- } else {
- RETURN_FALSE;
- }
- break;
-
- default:
- RETURN_FALSE;
- break;
- }
-}
-/* }}} */
-
-/* {{{ proto bool is_scalar (mixed value)
- Returns true if value is a scalar */
-PHP_FUNCTION(is_scalar)
-{
- zval **arg;
-
- if (ZEND_NUM_ARGS() !=1 || zend_get_parameters_ex(1, &arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- switch (Z_TYPE_PP(arg)) {
- case IS_BOOL:
- case IS_DOUBLE:
- case IS_LONG:
- case IS_STRING:
- RETURN_TRUE;
- break;
-
- default:
- RETURN_FALSE;
- break;
- }
-}
-/* }}} */
-
-/*
- 1st arg = error message
- 2nd arg = error option
- 3rd arg = optional parameters (email address or tcp address)
- 4th arg = used for additional headers if email
-
- error options
- 0 = send to php_error_log (uses syslog or file depending on ini setting)
- 1 = send via email to 3rd parameter 4th option = additional headers
- 2 = send via tcp/ip to 3rd parameter (name or ip:port)
- 3 = save to file in 3rd parameter
-*/
-
-/* {{{ proto int error_log(string message, int message_type [, string destination] [, string extra_headers])
- Send an error message somewhere */
-PHP_FUNCTION(error_log)
-{
- pval **string, **erropt = NULL, **option = NULL, **emailhead = NULL;
- int opt_err = 0;
- char *message, *opt=NULL, *headers=NULL;
-
- switch(ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1,&string) == FAILURE) {
- php_error(E_WARNING,"Invalid argument 1 in error_log");
- RETURN_FALSE;
- }
- break;
- case 2:
- if (zend_get_parameters_ex(2,&string,&erropt) == FAILURE) {
- php_error(E_WARNING,"Invalid arguments in error_log");
- RETURN_FALSE;
- }
- convert_to_long_ex(erropt);
- opt_err=Z_LVAL_PP(erropt);
- break;
- case 3:
- if (zend_get_parameters_ex(3,&string,&erropt,&option) == FAILURE){
- php_error(E_WARNING,"Invalid arguments in error_log");
- RETURN_FALSE;
- }
- convert_to_long_ex(erropt);
- opt_err=Z_LVAL_PP(erropt);
- convert_to_string_ex(option);
- opt=Z_STRVAL_PP(option);
- break;
- case 4:
- if (zend_get_parameters_ex(4,&string,&erropt,&option,&emailhead) == FAILURE){
- php_error(E_WARNING,"Invalid arguments in error_log");
- RETURN_FALSE;
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(string);
- message=Z_STRVAL_PP(string);
- if (erropt != NULL) {
- convert_to_long_ex(erropt);
- opt_err=Z_LVAL_PP(erropt);
- }
- if (option != NULL) {
- convert_to_string_ex(option);
- opt=Z_STRVAL_PP(option);
- }
- if (emailhead != NULL) {
- convert_to_string_ex(emailhead);
- headers=Z_STRVAL_PP(emailhead);
- }
-
- if (_php_error_log(opt_err,message,opt,headers)==FAILURE) {
- RETURN_FALSE;
- }
-
- RETURN_TRUE;
-}
-/* }}} */
-
-PHPAPI int _php_error_log(int opt_err,char *message,char *opt,char *headers)
-{
- FILE *logfile;
- int issock=0, socketd=0;;
-
- switch(opt_err){
- case 1: /*send an email*/ {
-#if HAVE_SENDMAIL
- if (!php_mail(opt, "PHP error_log message", message, headers, NULL)){
- return FAILURE;
- }
-#else
- php_error(E_WARNING,"Mail option not available!");
- return FAILURE;
-#endif
- }
- break;
- case 2: /*send to an address */
- php_error(E_WARNING,"TCP/IP option not available!");
- return FAILURE;
- break;
- case 3: /*save to a file*/
- logfile=php_fopen_wrapper(opt,"a", (IGNORE_URL|ENFORCE_SAFE_MODE), &issock, &socketd, NULL);
- if(!logfile) {
- php_error(E_WARNING,"error_log: Unable to write to %s",opt);
- return FAILURE;
- }
- fwrite(message,strlen(message),1,logfile);
- fclose(logfile);
- break;
- default:
- php_log_err(message);
- break;
- }
- return SUCCESS;
-}
-
-/* {{{ proto mixed call_user_func(string function_name [, mixed parmeter] [, mixed ...])
- Call a user function which is the first parameter */
-PHP_FUNCTION(call_user_func)
-{
- zval ***params;
- zval *retval_ptr;
- char *name;
- int argc = ZEND_NUM_ARGS();
-
- if (argc < 1) {
- WRONG_PARAM_COUNT;
- }
-
- params = emalloc(sizeof(zval **) * argc);
-
- if (zend_get_parameters_array_ex(argc, params)==FAILURE) {
- efree(params);
- RETURN_FALSE;
- }
-
- if (Z_TYPE_PP(params[0]) != IS_STRING && Z_TYPE_PP(params[0]) != IS_ARRAY) {
- SEPARATE_ZVAL(params[0]);
- convert_to_string_ex(params[0]);
- }
-
- if (!zend_is_callable(*params[0], 0, &name)) {
- php_error(E_WARNING, "%s() expects first argument, '%s', to be a valid callback",
- get_active_function_name(), name);
- efree(name);
- efree(params);
- RETURN_NULL();
- }
-
- if (call_user_function_ex(EG(function_table), NULL, *params[0], &retval_ptr, argc - 1, params + 1, 0, NULL)==SUCCESS && retval_ptr) {
- COPY_PZVAL_TO_ZVAL(*return_value, retval_ptr);
- } else {
- php_error(E_WARNING, "Unable to call %s()", name);
- }
-
- efree(name);
- efree(params);
-}
-/* }}} */
-
-/* {{{ proto mixed call_user_func_array(string function_name, array parameters)
- Call a user function which is the first parameter with the arguments contained in array */
-PHP_FUNCTION(call_user_func_array)
-{
- zval ***func_params;
- zval **func;
- zval **params;
- zval *retval_ptr;
- HashTable *func_params_ht;
- char *name;
- int count;
- int current = 0;
-
- if (ZEND_NUM_ARGS() != 2 ||
- zend_get_parameters_ex(2, &func, &params) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- SEPARATE_ZVAL(params);
- convert_to_array_ex(params);
-
- if (Z_TYPE_PP(func) != IS_STRING && Z_TYPE_PP(func) != IS_ARRAY) {
- SEPARATE_ZVAL(func);
- convert_to_string_ex(func);
- }
-
- if (!zend_is_callable(*func, 0, &name)) {
- php_error(E_WARNING, "%s() expects first argument, '%s', to be a valid callback",
- get_active_function_name(), name);
- efree(name);
- RETURN_NULL();
- }
-
- func_params_ht = Z_ARRVAL_PP(params);
-
- count = zend_hash_num_elements(func_params_ht);
- func_params = emalloc(sizeof(zval **) * count);
-
- for (zend_hash_internal_pointer_reset(func_params_ht);
- zend_hash_get_current_data(func_params_ht, (void **) &func_params[current]) == SUCCESS;
- zend_hash_move_forward(func_params_ht)) {
- current++;
- }
-
- if (call_user_function_ex(EG(function_table), NULL, *func, &retval_ptr, count, func_params, 0, NULL) == SUCCESS && retval_ptr) {
- COPY_PZVAL_TO_ZVAL(*return_value, retval_ptr);
- } else {
- php_error(E_WARNING, "Unable to call %s()", name);
- }
-
- efree(name);
- efree(func_params);
-}
-/* }}} */
-
-#define _CUM_DEPREC "The %s() function is deprecated, use the call_user_func variety with the array(&$obj, \"method\") syntax instead"
-
-/* {{{ proto mixed call_user_method(string method_name, mixed object [, mixed parameter] [, mixed ...])
- Call a user method on a specific object or class */
-PHP_FUNCTION(call_user_method)
-{
- zval ***params;
- zval *retval_ptr;
- int arg_count=ZEND_NUM_ARGS();
-
- php_error(E_NOTICE, _CUM_DEPREC, "call_user_method");
-
- if (arg_count<2) {
- WRONG_PARAM_COUNT;
- }
- params = (zval ***) emalloc(sizeof(zval **) * arg_count);
-
- if (zend_get_parameters_array_ex(arg_count, params)==FAILURE) {
- efree(params);
- RETURN_FALSE;
- }
- if (Z_TYPE_PP(params[1]) != IS_OBJECT && Z_TYPE_PP(params[1]) != IS_STRING) {
- php_error(E_WARNING,"2nd argument is not an object or class name\n");
- efree(params);
- RETURN_FALSE;
- }
- SEPARATE_ZVAL(params[0]);
- convert_to_string(*params[0]);
- if (call_user_function_ex(EG(function_table), params[1], *params[0], &retval_ptr, arg_count-2, params+2, 0, NULL)==SUCCESS && retval_ptr) {
- COPY_PZVAL_TO_ZVAL(*return_value, retval_ptr);
- } else {
- php_error(E_WARNING,"Unable to call %s()", Z_STRVAL_PP(params[0]));
- }
- efree(params);
-}
-/* }}} */
-
-/* {{{ proto mixed call_user_method_array(string method_name, mixed object, array params)
- Call a user method on a specific object or class using a parameter array */
-PHP_FUNCTION(call_user_method_array)
-{
- zval **method_name,
- **obj,
- **params,
- ***method_args = NULL,
- *retval_ptr;
- HashTable *params_ar;
- int num_elems,
- element = 0;
-
- php_error(E_NOTICE, _CUM_DEPREC, "call_user_method_array");
-
- if (ZEND_NUM_ARGS() != 3 ||
- zend_get_parameters_ex(3, &method_name, &obj, &params) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if (Z_TYPE_PP(obj) != IS_OBJECT && Z_TYPE_PP(obj) != IS_STRING) {
- php_error(E_WARNING,"2nd argument is not an object or class name\n");
- RETURN_FALSE;
- }
-
- SEPARATE_ZVAL(method_name);
- SEPARATE_ZVAL(params);
- convert_to_string_ex(method_name);
- convert_to_array_ex(params);
-
- params_ar = HASH_OF(*params);
- num_elems = zend_hash_num_elements(params_ar);
- method_args = (zval ***)emalloc(sizeof(zval **) * num_elems);
-
- for (zend_hash_internal_pointer_reset(params_ar);
- zend_hash_get_current_data(params_ar, (void **)&(method_args[element])) == SUCCESS;
- zend_hash_move_forward(params_ar))
- element++;
-
- if (call_user_function_ex(EG(function_table), obj, *method_name, &retval_ptr, num_elems, method_args, 0, NULL) == SUCCESS && retval_ptr) {
- COPY_PZVAL_TO_ZVAL(*return_value, retval_ptr);
- } else {
- php_error(E_WARNING, "Unable to call %s()", Z_STRVAL_PP(method_name));
- }
-
- efree(method_args);
-}
-/* }}} */
-
-void user_shutdown_function_dtor(php_shutdown_function_entry *shutdown_function_entry)
-{
- int i;
-
- for (i=0; i<shutdown_function_entry->arg_count; i++) {
- zval_ptr_dtor(&shutdown_function_entry->arguments[i]);
- }
- efree(shutdown_function_entry->arguments);
-}
-
-void user_tick_function_dtor(user_tick_function_entry *tick_function_entry)
-{
- int i;
-
- for (i = 0; i < tick_function_entry->arg_count; i++) {
- zval_ptr_dtor(&tick_function_entry->arguments[i]);
- }
- efree(tick_function_entry->arguments);
-}
-
-static int user_shutdown_function_call(php_shutdown_function_entry *shutdown_function_entry)
-{
- zval retval;
- ELS_FETCH();
-
- if (call_user_function(EG(function_table), NULL, shutdown_function_entry->arguments[0], &retval, shutdown_function_entry->arg_count-1, shutdown_function_entry->arguments+1)==SUCCESS) {
- zval_dtor(&retval);
- } else {
- php_error(E_WARNING,"Unable to call %s() - function does not exist",
- Z_STRVAL_P(shutdown_function_entry->arguments[0]));
- }
- return 0;
-}
-
-static void user_tick_function_call(user_tick_function_entry *tick_fe)
-{
- zval retval;
- zval *function = tick_fe->arguments[0];
- ELS_FETCH();
-
- if (call_user_function(EG(function_table), NULL, function, &retval,
- tick_fe->arg_count - 1, tick_fe->arguments + 1) == SUCCESS) {
- zval_dtor(&retval);
- } else {
- zval **obj, **method;
-
- if (Z_TYPE_P(function) == IS_STRING) {
- php_error(E_WARNING, "Unable to call %s() - function does not exist",
- Z_STRVAL_P(function));
- } else if (Z_TYPE_P(function) == IS_ARRAY &&
- zend_hash_index_find(Z_ARRVAL_P(function), 0, (void **) &obj) == SUCCESS &&
- zend_hash_index_find(Z_ARRVAL_P(function), 1, (void **) &method) == SUCCESS &&
- Z_TYPE_PP(obj) == IS_OBJECT &&
- Z_TYPE_PP(method) == IS_STRING) {
- php_error(E_WARNING, "Unable to call %s::%s() - function does not exist",
- (*obj)->value.obj.ce->name, Z_STRVAL_PP(method));
- } else
- php_error(E_WARNING, "Unable to call tick function");
- }
-}
-
-static void run_user_tick_functions(int tick_count)
-{
- BLS_FETCH();
-
- zend_llist_apply(BG(user_tick_functions), (llist_apply_func_t)user_tick_function_call);
-}
-
-static int user_tick_function_compare(user_tick_function_entry *tick_fe1,
- user_tick_function_entry *tick_fe2)
-{
- zval *func1 = tick_fe1->arguments[0];
- zval *func2 = tick_fe2->arguments[0];
-
- if (Z_TYPE_P(func1) == IS_STRING && Z_TYPE_P(func2) == IS_STRING) {
- return (zend_binary_zval_strcmp(func1, func2) == 0);
- } else if (Z_TYPE_P(func1) == IS_ARRAY && Z_TYPE_P(func2) == IS_ARRAY) {
- zval result;
- zend_compare_arrays(&result, func1, func2);
- return (Z_LVAL(result) == 0);
- } else
- return 0;
-}
-
-void php_call_shutdown_functions(void)
-{
- BLS_FETCH();
- ELS_FETCH();
-
- if (BG(user_shutdown_function_names)) {
- jmp_buf orig_bailout;
-
- memcpy(&orig_bailout, &EG(bailout), sizeof(jmp_buf));
- if (setjmp(EG(bailout))!=0) {
- /* one of the shutdown functions bailed out */
- memcpy(&EG(bailout), &orig_bailout, sizeof(jmp_buf));
- return;
- }
- zend_hash_apply(BG(user_shutdown_function_names),
- (apply_func_t)user_shutdown_function_call);
- memcpy(&EG(bailout), &orig_bailout, sizeof(jmp_buf));
- zend_hash_destroy(BG(user_shutdown_function_names));
- efree(BG(user_shutdown_function_names));
- }
-}
-
-/* {{{ proto void register_shutdown_function(string function_name)
- Register a user-level function to be called on request termination */
-PHP_FUNCTION(register_shutdown_function)
-{
- php_shutdown_function_entry shutdown_function_entry;
- int i;
- BLS_FETCH();
-
- shutdown_function_entry.arg_count = ZEND_NUM_ARGS();
-
- if (shutdown_function_entry.arg_count<1) {
- WRONG_PARAM_COUNT;
- }
- shutdown_function_entry.arguments = (pval **) emalloc(sizeof(pval *)*shutdown_function_entry.arg_count);
-
- if (zend_get_parameters_array(ht, shutdown_function_entry.arg_count, shutdown_function_entry.arguments)==FAILURE) {
- RETURN_FALSE;
- }
- if (!BG(user_shutdown_function_names)) {
- ALLOC_HASHTABLE(BG(user_shutdown_function_names));
- zend_hash_init(BG(user_shutdown_function_names), 0, NULL, (void (*)(void *))user_shutdown_function_dtor, 0);
- }
-
- for (i=0; i<shutdown_function_entry.arg_count; i++) {
- shutdown_function_entry.arguments[i]->refcount++;
- }
- zend_hash_next_index_insert(BG(user_shutdown_function_names), &shutdown_function_entry, sizeof(php_shutdown_function_entry), NULL);
-}
-/* }}} */
-
-
-ZEND_API void php_get_highlight_struct(zend_syntax_highlighter_ini *syntax_highlighter_ini)
-{
- syntax_highlighter_ini->highlight_comment = INI_STR("highlight.comment");
- syntax_highlighter_ini->highlight_default = INI_STR("highlight.default");
- syntax_highlighter_ini->highlight_html = INI_STR("highlight.html");
- syntax_highlighter_ini->highlight_keyword = INI_STR("highlight.keyword");
- syntax_highlighter_ini->highlight_string = INI_STR("highlight.string");
-}
-
-
-/* {{{ proto boolean highlight_file(string file_name)
- Syntax highlight a source file */
-PHP_FUNCTION(highlight_file)
-{
- pval **filename;
- zend_syntax_highlighter_ini syntax_highlighter_ini;
-
-
- if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &filename)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(filename);
-
- php_get_highlight_struct(&syntax_highlighter_ini);
-
- if (highlight_file(Z_STRVAL_PP(filename), &syntax_highlighter_ini)==FAILURE) {
- RETURN_FALSE;
- }
- RETURN_TRUE;
-}
-/* }}} */
-
-
-/* {{{ proto boolean highlight_string(string string)
- Syntax highlight a string */
-PHP_FUNCTION(highlight_string)
-{
- pval **expr;
- zend_syntax_highlighter_ini syntax_highlighter_ini;
- char *hicompiled_string_description;
-
- if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &expr)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(expr);
-
- php_get_highlight_struct(&syntax_highlighter_ini);
-
- hicompiled_string_description = zend_make_compiled_string_description("highlighted code");
-
- if (highlight_string(*expr, &syntax_highlighter_ini, hicompiled_string_description)==FAILURE) {
- efree(hicompiled_string_description);
- RETURN_FALSE;
- }
- efree(hicompiled_string_description);
- RETURN_TRUE;
-}
-/* }}} */
-
-
-pval test_class_get_property(zend_property_reference *property_reference)
-{
- pval result;
- zend_overloaded_element *overloaded_property;
- zend_llist_element *element;
-
-
- printf("Reading a property from a OverloadedTestClass object:\n");
-
- for (element=property_reference->elements_list->head; element; element=element->next) {
- overloaded_property = (zend_overloaded_element *) element->data;
- switch (Z_TYPE_P(overloaded_property)) {
- case OE_IS_ARRAY:
- printf("Array offset: ");
- break;
- case OE_IS_OBJECT:
- printf("Object property: ");
- break;
- }
- switch (Z_TYPE(overloaded_property->element)) {
- case IS_LONG:
- printf("%ld (numeric)\n", Z_LVAL(overloaded_property->element));
- break;
- case IS_STRING:
- printf("'%s'\n", Z_STRVAL(overloaded_property->element));
- break;
- }
- pval_destructor(&overloaded_property->element);
- }
-
- Z_STRVAL(result) = estrndup("testing", 7);
- Z_STRLEN(result) = 7;
- Z_TYPE(result) = IS_STRING;
- return result;
-}
-
-
-int test_class_set_property(zend_property_reference *property_reference, pval *value)
-{
- zend_overloaded_element *overloaded_property;
- zend_llist_element *element;
-
- printf("Writing to a property from a OverloadedTestClass object:\n");
- printf("Writing '");
- zend_print_variable(value);
- printf("'\n");
-
- for (element=property_reference->elements_list->head; element; element=element->next) {
- overloaded_property = (zend_overloaded_element *) element->data;
- switch (Z_TYPE_P(overloaded_property)) {
- case OE_IS_ARRAY:
- printf("Array offset: ");
- break;
- case OE_IS_OBJECT:
- printf("Object property: ");
- break;
- }
- switch (Z_TYPE(overloaded_property->element)) {
- case IS_LONG:
- printf("%ld (numeric)\n", Z_LVAL(overloaded_property->element));
- break;
- case IS_STRING:
- printf("'%s'\n", Z_STRVAL(overloaded_property->element));
- break;
- }
- pval_destructor(&overloaded_property->element);
- }
-
- return 0;
-}
-
-
-
-void test_class_call_function(INTERNAL_FUNCTION_PARAMETERS, zend_property_reference *property_reference)
-{
- zend_overloaded_element *overloaded_property;
- zend_llist_element *element;
-
-
- printf("Invoking a method on OverloadedTestClass object:\n");
-
- for (element=property_reference->elements_list->head; element; element=element->next) {
- overloaded_property = (zend_overloaded_element *) element->data;
- switch (Z_TYPE_P(overloaded_property)) {
- case OE_IS_ARRAY:
- printf("Array offset: ");
- break;
- case OE_IS_OBJECT:
- printf("Object property: ");
- break;
- case OE_IS_METHOD:
- printf("Overloaded method: ");
- }
- switch (Z_TYPE(overloaded_property->element)) {
- case IS_LONG:
- printf("%ld (numeric)\n", Z_LVAL(overloaded_property->element));
- break;
- case IS_STRING:
- printf("'%s'\n", Z_STRVAL(overloaded_property->element));
- break;
- }
- pval_destructor(&overloaded_property->element);
- }
-
- printf("%d arguments\n", ZEND_NUM_ARGS());
- RETVAL_STRING("testing", 1);
-}
-
-
-void test_class_startup()
-{
- zend_class_entry test_class_entry;
-
- INIT_OVERLOADED_CLASS_ENTRY(test_class_entry, "OverloadedTestClass", NULL,
- test_class_call_function,
- test_class_get_property,
- test_class_set_property);
-
- zend_register_internal_class(&test_class_entry);
-}
-
-/* {{{ proto string ini_get(string varname)
- Get a configuration option */
-PHP_FUNCTION(ini_get)
-{
- pval **varname;
- char *str;
-
- if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &varname)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(varname);
-
- str = php_ini_string(Z_STRVAL_PP(varname), Z_STRLEN_PP(varname)+1, 0);
-
- if (!str) {
- RETURN_FALSE;
- }
-
- RETURN_STRING(str,1);
-}
-/* }}} */
-
-/* {{{ proto string ini_set(string varname, string newvalue)
- Set a configuration option, returns false on error and the old value of the configuration option on success */
-PHP_FUNCTION(ini_set)
-{
- pval **varname, **new_value;
- char *old_value;
-
- if (ZEND_NUM_ARGS()!=2 || zend_get_parameters_ex(2, &varname, &new_value)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(varname);
- convert_to_string_ex(new_value);
-
- old_value = php_ini_string(Z_STRVAL_PP(varname), Z_STRLEN_PP(varname)+1, 0);
- /* copy to return here, because alter might free it! */
- if (old_value) {
- RETVAL_STRING(old_value, 1);
- } else {
- RETVAL_FALSE;
- }
-
- if (zend_alter_ini_entry(Z_STRVAL_PP(varname), Z_STRLEN_PP(varname)+1, Z_STRVAL_PP(new_value), Z_STRLEN_PP(new_value), PHP_INI_USER, PHP_INI_STAGE_RUNTIME)==FAILURE) {
- zval_dtor(return_value);
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto string ini_restore(string varname)
- Restore the value of a configuration option specified by varname */
-PHP_FUNCTION(ini_restore)
-{
- pval **varname;
-
- if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &varname)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(varname);
-
- zend_restore_ini_entry(Z_STRVAL_PP(varname), Z_STRLEN_PP(varname)+1, PHP_INI_STAGE_RUNTIME);
-}
-/* }}} */
-
-/* {{{ proto string print_r(mixed var)
- Prints out information about the specified variable */
-PHP_FUNCTION(print_r)
-{
- pval **expr;
-
- if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &expr)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- zend_print_pval_r(*expr, 0);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-
-/* This should go back to PHP */
-
-/* {{{ proto int connection_aborted(void)
- Returns true if client disconnected */
-PHP_FUNCTION(connection_aborted)
-{
- PLS_FETCH();
-
- RETURN_LONG(PG(connection_status)&PHP_CONNECTION_ABORTED);
-}
-/* }}} */
-
-/* {{{ proto int connection_status(void)
- Returns the connection status bitfield */
-PHP_FUNCTION(connection_status)
-{
- PLS_FETCH();
-
- RETURN_LONG(PG(connection_status));
-}
-/* }}} */
-
-/* {{{ proto int ignore_user_abort(boolean value)
- Set whether we want to ignore a user abort event or not */
-PHP_FUNCTION(ignore_user_abort)
-{
- pval **arg;
- int old_setting;
- PLS_FETCH();
-
- old_setting = PG(ignore_user_abort);
- switch (ZEND_NUM_ARGS()) {
- case 0:
- break;
- case 1:
- if (zend_get_parameters_ex(1, &arg) == FAILURE) {
- RETURN_FALSE;
- }
- convert_to_boolean_ex(arg);
- PG(ignore_user_abort) = (zend_bool) Z_LVAL_PP(arg);
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- RETURN_LONG(old_setting);
-}
-/* }}} */
-
-/* {{{ proto int getservbyname(string service, string protocol)
- Returns port associated with service. Protocol must be "tcp" or "udp". */
-#if HAVE_GETSERVBYNAME
-PHP_FUNCTION(getservbyname)
-{
- pval **name,**proto;
- struct servent *serv;
-
- if(ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2,&name,&proto) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(name);
- convert_to_string_ex(proto);
-
- serv = getservbyname(Z_STRVAL_PP(name),Z_STRVAL_PP(proto));
-
- if(serv == NULL)
- RETURN_FALSE;
-
- RETURN_LONG(ntohs(serv->s_port));
-}
-#endif
-/* }}} */
-
-
-/* {{{ proto string getservbyport(int port, string protocol)
- Returns service name associated with port. Protocol must be "tcp" or "udp". */
-#if HAVE_GETSERVBYPORT
-PHP_FUNCTION(getservbyport)
-{
- pval **port,**proto;
- struct servent *serv;
-
- if(ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2,&port,&proto) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(port);
- convert_to_string_ex(proto);
-
- serv = getservbyport(htons((unsigned short) Z_LVAL_PP(port)),Z_STRVAL_PP(proto));
-
- if(serv == NULL)
- RETURN_FALSE;
-
- RETURN_STRING(serv->s_name,1);
-}
-#endif
-/* }}} */
-
-
-/* {{{ proto int getprotobyname(string name)
- Returns protocol number associated with name as per /etc/protocols */
-#if HAVE_GETPROTOBYNAME
-PHP_FUNCTION(getprotobyname)
-{
- pval **name;
- struct protoent *ent;
-
- if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &name) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(name);
-
- ent = getprotobyname(Z_STRVAL_PP(name));
-
- if(ent == NULL) {
- Z_LVAL_P(return_value) = -1;
- Z_TYPE_P(return_value) = IS_LONG;
- return;
- }
-
- RETURN_LONG(ent->p_proto);
-}
-#endif
-/* }}} */
-
-
-/* {{{ proto string getprotobynumber(int proto)
- Returns protocol name associated with protocol number proto */
-#if HAVE_GETPROTOBYNUMBER
-PHP_FUNCTION(getprotobynumber)
-{
- pval **proto;
- struct protoent *ent;
-
- if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &proto) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(proto);
-
- ent = getprotobynumber(Z_LVAL_PP(proto));
-
- if(ent == NULL)
- RETURN_FALSE;
-
- RETURN_STRING(ent->p_name,1);
-}
-#endif
-/* }}} */
-
-
-/* {{{ proto void register_tick_function(string function_name [, mixed arg [, ... ]])
- Registers a tick callback function */
-PHP_FUNCTION(register_tick_function)
-{
- user_tick_function_entry tick_fe;
- int i;
- BLS_FETCH();
-
- tick_fe.arg_count = ZEND_NUM_ARGS();
- if (tick_fe.arg_count < 1) {
- WRONG_PARAM_COUNT;
- }
-
- tick_fe.arguments = (zval **)emalloc(sizeof(zval *) * tick_fe.arg_count);
- if (zend_get_parameters_array(ht, tick_fe.arg_count, tick_fe.arguments) == FAILURE) {
- RETURN_FALSE;
- }
-
- if (Z_TYPE_P(tick_fe.arguments[0]) != IS_ARRAY)
- convert_to_string_ex(&tick_fe.arguments[0]);
-
- if (!BG(user_tick_functions)) {
- BG(user_tick_functions) = (zend_llist *)emalloc(sizeof(zend_llist));
- zend_llist_init(BG(user_tick_functions), sizeof(user_tick_function_entry),
- (void (*)(void *))user_tick_function_dtor, 0);
- php_add_tick_function(run_user_tick_functions);
- }
-
- for (i = 0; i < tick_fe.arg_count; i++) {
- tick_fe.arguments[i]->refcount++;
- }
-
- zend_llist_add_element(BG(user_tick_functions), &tick_fe);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-
-/* {{{ proto void unregister_tick_function(string function_name)
- Unregisters a tick callback function */
-PHP_FUNCTION(unregister_tick_function)
-{
- zval **function;
- user_tick_function_entry tick_fe;
- BLS_FETCH();
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(ZEND_NUM_ARGS(), &function)) {
- WRONG_PARAM_COUNT;
- }
-
- if (Z_TYPE_PP(function) != IS_ARRAY)
- convert_to_string_ex(function);
-
- tick_fe.arguments = (zval **)emalloc(sizeof(zval *));
- tick_fe.arguments[0] = *function;
- tick_fe.arg_count = 1;
- zend_llist_del_element(BG(user_tick_functions), &tick_fe,
- (int(*)(void*,void*))user_tick_function_compare);
- efree(tick_fe.arguments);
-}
-/* }}} */
-
-
-/* This function is not directly accessible to end users */
-PHPAPI PHP_FUNCTION(warn_not_available)
-{
- php_error(E_WARNING, "%s() is not supported in this PHP build", get_active_function_name());
- RETURN_FALSE;
-}
-
-
-/* {{{ proto boolean is_uploaded_file(string path)
- check if file was created by rfc1867 upload */
-PHP_FUNCTION(is_uploaded_file)
-{
- zval **path;
- SLS_FETCH();
-
- if (!SG(rfc1867_uploaded_files)) {
- RETURN_FALSE;
- }
-
- if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &path)!=SUCCESS) {
- ZEND_WRONG_PARAM_COUNT();
- }
- convert_to_string_ex(path);
-
- if (zend_hash_exists(SG(rfc1867_uploaded_files), Z_STRVAL_PP(path), Z_STRLEN_PP(path)+1)) {
- RETURN_TRUE;
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-
-/* {{{ proto boolean move_uploaded_file(string path, string new_path)
- move a file if and only if it was created by an upload */
-PHP_FUNCTION(move_uploaded_file)
-{
- zval **path, **new_path;
- zend_bool successful=0;
- SLS_FETCH();
- PLS_FETCH();
-
- if (!SG(rfc1867_uploaded_files)) {
- RETURN_FALSE;
- }
-
- if (ZEND_NUM_ARGS()!=2 || zend_get_parameters_ex(2, &path, &new_path)!=SUCCESS) {
- ZEND_WRONG_PARAM_COUNT();
- }
- convert_to_string_ex(path);
- convert_to_string_ex(new_path);
-
- if (!zend_hash_exists(SG(rfc1867_uploaded_files), Z_STRVAL_PP(path), Z_STRLEN_PP(path)+1)) {
- RETURN_FALSE;
- }
-
- if (PG(safe_mode) &&(!php_checkuid(Z_STRVAL_PP(new_path), NULL, CHECKUID_CHECK_FILE_AND_DIR))) {
- RETURN_FALSE;
- }
-
- VCWD_UNLINK(Z_STRVAL_PP(new_path));
- if (rename(Z_STRVAL_PP(path), Z_STRVAL_PP(new_path))==0) {
- successful=1;
- } else if (php_copy_file(Z_STRVAL_PP(path), Z_STRVAL_PP(new_path))==SUCCESS) {
- VCWD_UNLINK(Z_STRVAL_PP(path));
- successful=1;
- }
-
- if (successful) {
- zend_hash_del(SG(rfc1867_uploaded_files), Z_STRVAL_PP(path), Z_STRLEN_PP(path)+1);
- } else {
- php_error(E_WARNING, "Unable to move '%s' to '%s'", Z_STRVAL_PP(path), Z_STRVAL_PP(new_path));
- }
- RETURN_BOOL(successful);
-}
-/* }}} */
-
-
-
-static void php_simple_ini_parser_cb(zval *arg1, zval *arg2, int callback_type, zval *arr)
-{
- zval *element;
-
- switch (callback_type) {
- case ZEND_INI_PARSER_ENTRY:
- ALLOC_ZVAL(element);
- *element = *arg2;
- zval_copy_ctor(element);
- INIT_PZVAL(element);
- zend_hash_update(Z_ARRVAL_P(arr), Z_STRVAL_P(arg1), Z_STRLEN_P(arg1)+1, &element, sizeof(zval *), NULL);
- break;
- case ZEND_INI_PARSER_SECTION:
- break;
- }
-}
-
-
-static void php_ini_parser_cb_with_sections(zval *arg1, zval *arg2, int callback_type, zval *arr)
-{
- zval *element;
- BLS_FETCH();
-
- switch (callback_type) {
- case ZEND_INI_PARSER_ENTRY: {
- zval *active_arr;
-
- if (BG(active_ini_file_section)) {
- active_arr = BG(active_ini_file_section);
- } else {
- active_arr = arr;
- }
- ALLOC_ZVAL(element);
- *element = *arg2;
- zval_copy_ctor(element);
- INIT_PZVAL(element);
- zend_hash_update(Z_ARRVAL_P(active_arr), Z_STRVAL_P(arg1), Z_STRLEN_P(arg1)+1, &element, sizeof(zval *), NULL);
- }
- break;
- case ZEND_INI_PARSER_SECTION:
- MAKE_STD_ZVAL(BG(active_ini_file_section));
- array_init(BG(active_ini_file_section));
- zend_hash_update(Z_ARRVAL_P(arr), Z_STRVAL_P(arg1), Z_STRLEN_P(arg1)+1, &BG(active_ini_file_section), sizeof(zval *), NULL);
- break;
- }
-}
-
-
-/* {{{ proto void parse_ini_file(string filename [, boolean process_sections])
- Parse configuration file */
-PHP_FUNCTION(parse_ini_file)
-{
- zval **filename, **process_sections;
- zend_file_handle fh;
- zend_ini_parser_cb_t ini_parser_cb;
-
- switch (ARG_COUNT(ht)) {
- case 1:
- if (zend_get_parameters_ex(1, &filename)==FAILURE) {
- RETURN_FALSE;
- }
- ini_parser_cb = (zend_ini_parser_cb_t) php_simple_ini_parser_cb;
- break;
- case 2:
- if (zend_get_parameters_ex(2, &filename, &process_sections)==FAILURE) {
- RETURN_FALSE;
- }
- convert_to_boolean_ex(process_sections);
- if (Z_BVAL_PP(process_sections)) {
- BLS_FETCH();
-
- BG(active_ini_file_section) = NULL;
- ini_parser_cb = (zend_ini_parser_cb_t) php_ini_parser_cb_with_sections;
- } else {
- ini_parser_cb = (zend_ini_parser_cb_t) php_simple_ini_parser_cb;
- }
- break;
- default:
- ZEND_WRONG_PARAM_COUNT();
- break;
- }
-
- convert_to_string_ex(filename);
- fh.handle.fp = VCWD_FOPEN(Z_STRVAL_PP(filename), "r");
- if (!fh.handle.fp) {
- php_error(E_WARNING,"Cannot open '%s' for reading", Z_STRVAL_PP(filename));
- return;
- }
- Z_TYPE(fh) = ZEND_HANDLE_FP;
- fh.filename = Z_STRVAL_PP(filename);
- array_init(return_value);
- zend_parse_ini_file(&fh, 0, ini_parser_cb, return_value);
-}
-/* }}} */
-
-
-/* {{{ proto bool is_callable(mixed var [, bool syntax_only [, string callable_name ]]) */
-PHP_FUNCTION(is_callable)
-{
- zval **var, **syntax_only, **callable_name;
- char *name;
- zend_bool retval;
- zend_bool syntax = 0;
-
- if (ZEND_NUM_ARGS() < 1 || ZEND_NUM_ARGS() > 3 ||
- zend_get_parameters_ex(ZEND_NUM_ARGS(), &var, &syntax_only, &callable_name) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if (ZEND_NUM_ARGS() > 1) {
- convert_to_boolean_ex(syntax_only);
- syntax = Z_BVAL_PP(syntax_only);
- }
-
- if (ZEND_NUM_ARGS() > 2) {
- retval = zend_is_callable(*var, syntax, &name);
- zval_dtor(*callable_name);
- ZVAL_STRING(*callable_name, name, 0);
- } else
- retval = zend_is_callable(*var, syntax, NULL);
-
- RETURN_BOOL(retval);
-}
-/* }}} */
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/standard/basic_functions.h b/ext/standard/basic_functions.h
deleted file mode 100644
index 596829a34f..0000000000
--- a/ext/standard/basic_functions.h
+++ /dev/null
@@ -1,225 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef BASIC_FUNCTIONS_H
-#define BASIC_FUNCTIONS_H
-
-#include <sys/stat.h>
-
-#include "zend_highlight.h"
-
-#ifdef TRANS_SID
-# include "url_scanner.h"
-# include "url_scanner_ex.h"
-#endif
-
-extern zend_module_entry basic_functions_module;
-#define basic_functions_module_ptr &basic_functions_module
-
-PHP_MINIT_FUNCTION(basic);
-PHP_MSHUTDOWN_FUNCTION(basic);
-PHP_RINIT_FUNCTION(basic);
-PHP_RSHUTDOWN_FUNCTION(basic);
-PHP_MINFO_FUNCTION(basic);
-
-PHP_FUNCTION(constant);
-PHP_FUNCTION(intval);
-PHP_FUNCTION(doubleval);
-PHP_FUNCTION(strval);
-PHP_FUNCTION(toggle_short_open_tag);
-PHP_FUNCTION(sleep);
-PHP_FUNCTION(usleep);
-PHP_FUNCTION(flush);
-PHP_FUNCTION(gettype);
-PHP_FUNCTION(settype);
-PHP_FUNCTION(ip2long);
-PHP_FUNCTION(long2ip);
-
-/* system functions */
-PHP_FUNCTION(getenv);
-PHP_FUNCTION(putenv);
-
-PHP_FUNCTION(get_current_user);
-PHP_FUNCTION(set_time_limit);
-
-PHP_FUNCTION(get_cfg_var);
-PHP_FUNCTION(set_magic_quotes_runtime);
-PHP_FUNCTION(get_magic_quotes_runtime);
-PHP_FUNCTION(get_magic_quotes_gpc);
-
-void php_is_type(INTERNAL_FUNCTION_PARAMETERS, int type);
-PHP_FUNCTION(is_null);
-PHP_FUNCTION(is_resource);
-PHP_FUNCTION(is_bool);
-PHP_FUNCTION(is_long);
-PHP_FUNCTION(is_double);
-PHP_FUNCTION(is_numeric);
-PHP_FUNCTION(is_string);
-PHP_FUNCTION(is_array);
-PHP_FUNCTION(is_object);
-PHP_FUNCTION(is_scalar);
-PHP_FUNCTION(is_callable);
-
-PHP_FUNCTION(error_log);
-
-PHP_FUNCTION(call_user_func);
-PHP_FUNCTION(call_user_func_array);
-PHP_FUNCTION(call_user_method);
-PHP_FUNCTION(call_user_method_array);
-
-PHP_FUNCTION(register_shutdown_function);
-PHP_FUNCTION(highlight_file);
-PHP_FUNCTION(highlight_string);
-ZEND_API void php_get_highlight_struct(zend_syntax_highlighter_ini *syntax_highlighter_ini);
-
-PHP_FUNCTION(ini_get);
-PHP_FUNCTION(ini_set);
-PHP_FUNCTION(ini_restore);
-
-PHP_FUNCTION(print_r);
-
-PHP_FUNCTION(connection_aborted);
-PHP_FUNCTION(connection_status);
-PHP_FUNCTION(ignore_user_abort);
-
-PHP_FUNCTION(getservbyname);
-PHP_FUNCTION(getservbyport);
-PHP_FUNCTION(getprotobyname);
-PHP_FUNCTION(getprotobynumber);
-
-PHP_NAMED_FUNCTION(php_if_crc32);
-
-PHP_FUNCTION(register_tick_function);
-PHP_FUNCTION(unregister_tick_function);
-
-PHP_FUNCTION(is_uploaded_file);
-PHP_FUNCTION(move_uploaded_file);
-
-/* From the INI parser */
-PHP_FUNCTION(parse_ini_file);
-
-#ifdef PHP_WIN32
-typedef unsigned int php_stat_len;
-#else
-typedef int php_stat_len;
-#endif
-
-PHPAPI int _php_error_log(int opt_err,char *message,char *opt,char *headers);
-
-#if SIZEOF_INT == 4
-/* Most 32-bit and 64-bit systems have 32-bit ints */
-typedef unsigned int php_uint32;
-#elif SIZEOF_LONG == 4
-/* 16-bit systems? */
-typedef unsigned long php_uint32;
-#else
-#error Need type which holds 32 bits
-#endif
-
-#define MT_N (624)
-
-typedef struct {
- HashTable *user_shutdown_function_names;
- HashTable putenv_ht;
- char *strtok_string;
- char *locale_string;
- char *strtok_pos1;
- char *strtok_pos2;
- char str_ebuf[40];
- zval **array_walk_func_name;
- zval **user_compare_func_name;
- zend_llist *user_tick_functions;
-
- zval *active_ini_file_section;
-
- HashTable sm_protected_env_vars;
- char *sm_allowed_env_vars;
-
- /* pageinfo.c */
- long page_uid;
- long page_inode;
- long page_mtime;
-
- /* filestat.c */
- char *CurrentStatFile;
- php_stat_len CurrentStatLength;
- struct stat sb;
- struct stat lsb;
-
- /* rand.c */
- php_uint32 state[MT_N+1]; /* state vector + 1 extra to not violate ANSI C */
- php_uint32 *next; /* next random value is computed from here */
- int left; /* can *next++ this many times before reloading */
-
- /* syslog.c */
- int syslog_started;
- char *syslog_device;
-
- /* var.c */
- zend_class_entry *incomplete_class;
- zend_bool use_trans_sid;
-
-#ifdef TRANS_SID
- /* url_scanner.c */
- url_adapt_state_t url_adapt_state;
- /* url_scanner_ex.re */
- url_adapt_state_ex_t url_adapt_state_ex;
-#endif
-
-#ifdef HAVE_MMAP
- void *mmap_file;
- size_t mmap_len;
-#endif
-} php_basic_globals;
-
-#ifdef ZTS
-#define BLS_D php_basic_globals *basic_globals
-#define BLS_DC , BLS_D
-#define BLS_C basic_globals
-#define BLS_CC , BLS_C
-#define BG(v) (basic_globals->v)
-#define BLS_FETCH() php_basic_globals *basic_globals = ts_resource(basic_globals_id)
-extern int basic_globals_id;
-#else
-#define BLS_D
-#define BLS_DC
-#define BLS_C
-#define BLS_CC
-#define BG(v) (basic_globals.v)
-#define BLS_FETCH()
-extern php_basic_globals basic_globals;
-#endif
-
-#if HAVE_PUTENV
-typedef struct {
- char *putenv_string;
- char *previous_value;
- char *key;
- int key_len;
-} putenv_entry;
-#endif
-
-/* Values are comma-delimited
- */
-#define SAFE_MODE_PROTECTED_ENV_VARS "LD_LIBRARY_PATH"
-#define SAFE_MODE_ALLOWED_ENV_VARS "PHP_"
-
-#endif /* BASIC_FUNCTIONS_H */
diff --git a/ext/standard/browscap.c b/ext/standard/browscap.c
deleted file mode 100644
index 91183591b7..0000000000
--- a/ext/standard/browscap.c
+++ /dev/null
@@ -1,268 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#include "php.h"
-#include "php_regex.h"
-#include "php_browscap.h"
-#include "php_ini.h"
-
-#include "zend_globals.h"
-
-static HashTable browser_hash;
-static zval *current_section;
-
-#define DEFAULT_SECTION_NAME "Default Browser Capability Settings"
-
-
-static void browscap_entry_dtor(zval *pvalue)
-{
- if (pvalue->type == IS_OBJECT) {
- zend_hash_destroy(pvalue->value.obj.properties);
- free(pvalue->value.obj.properties);
- }
-}
-
-/* {{{ convert_browscap_pattern
- */
-static void convert_browscap_pattern(zval *pattern)
-{
- register int i,j;
- char *t;
-
- for (i=0; i<pattern->value.str.len; i++) {
- if (pattern->value.str.val[i]=='*' || pattern->value.str.val[i]=='?' || pattern->value.str.val[i]=='.') {
- break;
- }
- }
-
- if (i==pattern->value.str.len) { /* no wildcards */
- pattern->value.str.val = zend_strndup(pattern->value.str.val, pattern->value.str.len);
- return;
- }
-
- t = (char *) malloc(pattern->value.str.len*2);
-
- for (i=0,j=0; i<pattern->value.str.len; i++,j++) {
- switch (pattern->value.str.val[i]) {
- case '?':
- t[j] = '.';
- break;
- case '*':
- t[j++] = '.';
- t[j] = '*';
- break;
- case '.':
- t[j++] = '\\';
- t[j] = '.';
- break;
- default:
- t[j] = pattern->value.str.val[i];
- break;
- }
- }
- t[j]=0;
- pattern->value.str.val = t;
- pattern->value.str.len = j;
-}
-/* }}} */
-
-/* {{{ php_browscap_parser_cb
- */
-static void php_browscap_parser_cb(zval *arg1, zval *arg2, int callback_type, void *arg)
-{
- switch (callback_type) {
- case ZEND_INI_PARSER_ENTRY:
- if (current_section) {
- zval *new_property;
- char *new_key;
-
- new_property = (zval *) malloc(sizeof(zval));
- INIT_PZVAL(new_property);
- new_property->value.str.val = Z_STRLEN_P(arg2)?zend_strndup(Z_STRVAL_P(arg2), Z_STRLEN_P(arg2)):"";
- new_property->value.str.len = Z_STRLEN_P(arg2);
- new_property->type = IS_STRING;
-
- new_key = zend_strndup(Z_STRVAL_P(arg1), Z_STRLEN_P(arg1));
- zend_str_tolower(new_key, Z_STRLEN_P(arg1));
- zend_hash_update(current_section->value.obj.properties, new_key, Z_STRLEN_P(arg1)+1, &new_property, sizeof(zval *), NULL);
- free(new_key);
- }
- break;
- case ZEND_INI_PARSER_SECTION: {
- zval *processed;
-
- /*printf("'%s' (%d)\n",$1.value.str.val,$1.value.str.len+1);*/
- current_section = (zval *) malloc(sizeof(zval));
- INIT_PZVAL(current_section);
- processed = (zval *) malloc(sizeof(zval));
- INIT_PZVAL(processed);
-
- current_section->value.obj.ce = &zend_standard_class_def;
- current_section->value.obj.properties = (HashTable *) malloc(sizeof(HashTable));
- current_section->type = IS_OBJECT;
- zend_hash_init(current_section->value.obj.properties, 0, NULL, (dtor_func_t) browscap_entry_dtor, 1);
- zend_hash_update(&browser_hash, Z_STRVAL_P(arg1), Z_STRLEN_P(arg1)+1, (void *) &current_section, sizeof(zval *), NULL);
-
- processed->value.str.val = Z_STRVAL_P(arg1);
- processed->value.str.len = Z_STRLEN_P(arg1);
- processed->type = IS_STRING;
- convert_browscap_pattern(processed);
- zend_hash_update(current_section->value.obj.properties, "browser_name_pattern", sizeof("browser_name_pattern"), (void *) &processed, sizeof(zval *), NULL);
- }
- break;
- }
-}
-/* }}} */
-
-/* {{{ PHP_MINIT_FUNCTION
- */
-PHP_MINIT_FUNCTION(browscap)
-{
- char *browscap = INI_STR("browscap");
-
- if (browscap) {
- zend_file_handle fh;
-
- if (zend_hash_init(&browser_hash, 0, NULL, (dtor_func_t) browscap_entry_dtor, 1)==FAILURE) {
- return FAILURE;
- }
-
- fh.handle.fp = VCWD_FOPEN(browscap, "r");
- if (!fh.handle.fp) {
- php_error(E_CORE_WARNING,"Cannot open '%s' for reading", browscap);
- return FAILURE;
- }
- fh.filename = browscap;
- fh.type = ZEND_HANDLE_FP;
- zend_parse_ini_file(&fh, 1, (zend_ini_parser_cb_t) php_browscap_parser_cb, &browser_hash);
- }
-
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_MSHUTDOWN_FUNCTION
- */
-PHP_MSHUTDOWN_FUNCTION(browscap)
-{
- if (INI_STR("browscap")) {
- zend_hash_destroy(&browser_hash);
- }
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ browser_reg_compare
- */
-static int browser_reg_compare(zval **browser,int num_args, va_list args, zend_hash_key *key)
-{
- zval **browser_name;
- regex_t r;
- char *lookup_browser_name = va_arg(args,char *);
- zval **found_browser_entry = va_arg(args,zval **);
-
- if (*found_browser_entry) { /* already found */
- return 0;
- }
- if(zend_hash_find((*browser)->value.obj.properties, "browser_name_pattern",sizeof("browser_name_pattern"),(void **) &browser_name) == FAILURE) {
- return 0;
- }
-
- if (!strchr((*browser_name)->value.str.val,'*')) {
- return 0;
- }
- if (regcomp(&r,(*browser_name)->value.str.val,REG_NOSUB)!=0) {
- return 0;
- }
- if (regexec(&r,lookup_browser_name,0,NULL,0)==0) {
- *found_browser_entry = *browser;
- }
- regfree(&r);
- return 0;
-}
-/* }}} */
-
-/* {{{ proto object get_browser(string browser_name)
- Get information about the capabilities of a browser */
-PHP_FUNCTION(get_browser)
-{
- zval **agent_name,**agent;
- zval *found_browser_entry,*tmp_copy;
- char *lookup_browser_name;
- PLS_FETCH();
-
- if (!INI_STR("browscap")) {
- RETURN_FALSE;
- }
-
- switch(ZEND_NUM_ARGS()) {
- case 0:
- if (!PG(http_globals)[TRACK_VARS_SERVER]
- || zend_hash_find(PG(http_globals)[TRACK_VARS_SERVER]->value.ht, "HTTP_USER_AGENT", sizeof("HTTP_USER_AGENT"), (void **) &agent_name)==FAILURE) {
- zend_error(E_WARNING,"HTTP_USER_AGENT variable is not set, cannot determine user agent name");
- RETURN_FALSE;
- }
- break;
- case 1:
- if (zend_get_parameters_ex(1,&agent_name)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- convert_to_string_ex(agent_name);
-
- if (zend_hash_find(&browser_hash, (*agent_name)->value.str.val,(*agent_name)->value.str.len+1, (void **) &agent)==FAILURE) {
- lookup_browser_name = (*agent_name)->value.str.val;
- found_browser_entry = NULL;
- zend_hash_apply_with_arguments(&browser_hash,(int (*)(void *, int, va_list, zend_hash_key *)) browser_reg_compare,2,lookup_browser_name,&found_browser_entry);
-
- if (found_browser_entry) {
- agent = &found_browser_entry;
- } else if (zend_hash_find(&browser_hash, DEFAULT_SECTION_NAME, sizeof(DEFAULT_SECTION_NAME), (void **) &agent)==FAILURE) {
- RETURN_FALSE;
- }
- }
-
- object_init(return_value);
- zend_hash_copy(return_value->value.obj.properties,(*agent)->value.obj.properties, (copy_ctor_func_t) zval_add_ref, (void *) &tmp_copy, sizeof(zval *));
-
- while (zend_hash_find((*agent)->value.obj.properties, "parent",sizeof("parent"), (void **) &agent_name)==SUCCESS) {
-
- if (zend_hash_find(&browser_hash,(*agent_name)->value.str.val, (*agent_name)->value.str.len+1, (void **)&agent)==FAILURE) {
- break;
- }
-
- zend_hash_merge(return_value->value.obj.properties,(*agent)->value.obj.properties, (copy_ctor_func_t) zval_add_ref, (void *) &tmp_copy, sizeof(zval *), 0);
- }
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/standard/config.m4 b/ext/standard/config.m4
deleted file mode 100644
index cdfa5269dc..0000000000
--- a/ext/standard/config.m4
+++ /dev/null
@@ -1,232 +0,0 @@
-dnl $Id$ -*- sh -*-
-
-divert(3)dnl
-
-dnl
-dnl Check if flush should be called explicitly after buffered io
-dnl
-AC_DEFUN(AC_FLUSH_IO,[
- AC_CACHE_CHECK([whether flush should be called explicitly after a bufferered io], ac_cv_flush_io,[
- AC_TRY_RUN( [
-#include <stdio.h>
-#include <stdlib.h>
-
-int main(int argc, char **argv)
-{
- char *filename = tmpnam(NULL);
- char buffer[64];
- int result = 0;
-
- FILE *fp = fopen(filename, "wb");
- if (NULL == fp)
- return 0;
- fputs("line 1\n", fp);
- fputs("line 2\n", fp);
- fclose(fp);
-
- fp = fopen(filename, "rb+");
- if (NULL == fp)
- return 0;
- fgets(buffer, sizeof(buffer), fp);
- fputs("line 3\n", fp);
- rewind(fp);
- fgets(buffer, sizeof(buffer), fp);
- if (0 != strcmp(buffer, "line 1\n"))
- result = 1;
- fgets(buffer, sizeof(buffer), fp);
- if (0 != strcmp(buffer, "line 3\n"))
- result = 1;
- fclose(fp);
- unlink(filename);
-
- exit(result);
-}
-],[
- ac_cv_flush_io=no
-],[
- ac_cv_flush_io=yes
-],[
- ac_cv_flush_io=no
-])])
- if test "$ac_cv_flush_io" = "yes"; then
- AC_DEFINE(HAVE_FLUSHIO, 1, [Define if flush should be called explicitly after a buffered io.])
- fi
-])
-
-dnl
-dnl Check for crypt() capabilities
-dnl
-AC_DEFUN(AC_CRYPT_CAP,[
-
- AC_CACHE_CHECK(for standard DES crypt, ac_cv_crypt_des,[
- AC_TRY_RUN([
-#if HAVE_CRYPT_H
-#include <crypt.h>
-#endif
-
-main() {
-#if HAVE_CRYPT
- exit (strcmp((char *)crypt("rasmuslerdorf","rl"),"rl.3StKT.4T8M"));
-#else
- exit(0);
-#endif
-}],[
- ac_cv_crypt_des=yes
- ],[
- ac_cv_crypt_des=no
- ],[
- ac_cv_crypt_des=yes
- ])
- ])
- if test "$ac_cv_crypt_des" = "yes"; then
- ac_result=1
- else
- ac_result=0
- fi
- AC_DEFINE_UNQUOTED(PHP_STD_DES_CRYPT, $ac_result, [Whether the system supports standard DES salt])
-
- AC_CACHE_CHECK(for extended DES crypt, ac_cv_crypt_ext_des,[
- AC_TRY_RUN([
-#if HAVE_CRYPT_H
-#include <crypt.h>
-#endif
-
-main() {
-#if HAVE_CRYPT
- exit (strcmp((char *)crypt("rasmuslerdorf","_J9..rasm"),"_J9..rasmBYk8r9AiWNc"));
-#else
- exit(0);
-#endif
-}],[
- ac_cv_crypt_ext_des=yes
- ],[
- ac_cv_crypt_ext_des=no
- ],[
- ac_cv_crypt_ext_des=no
- ])
- ])
- if test "$ac_cv_crypt_ext_des" = "yes"; then
- ac_result=1
- else
- ac_result=0
- fi
- AC_DEFINE_UNQUOTED(PHP_EXT_DES_CRYPT, $ac_result, [Whether the system supports extended DES salt])
-
- AC_CACHE_CHECK(for MD5 crypt, ac_cv_crypt_md5,[
- AC_TRY_RUN([
-#if HAVE_CRYPT_H
-#include <crypt.h>
-#endif
-
-main() {
-#if HAVE_CRYPT
- char salt[15], answer[40];
-
- salt[0]='$'; salt[1]='1'; salt[2]='$';
- salt[3]='r'; salt[4]='a'; salt[5]='s';
- salt[6]='m'; salt[7]='u'; salt[8]='s';
- salt[9]='l'; salt[10]='e'; salt[11]='$';
- salt[12]='\0';
- strcpy(answer,salt);
- strcat(answer,"rISCgZzpwk3UhDidwXvin0");
- exit (strcmp((char *)crypt("rasmuslerdorf",salt),answer));
-#else
- exit(0);
-#endif
-}],[
- ac_cv_crypt_md5=yes
- ],[
- ac_cv_crypt_md5=no
- ],[
- ac_cv_crypt_md5=no
- ])
- ])
- if test "$ac_cv_crypt_md5" = "yes"; then
- ac_result=1
- else
- if test "$ac_cv_crypt_des" != "yes"; then
- PHP_DEBUG_MACRO(debug.log)
- fi
- ac_result=0
- fi
- AC_DEFINE_UNQUOTED(PHP_MD5_CRYPT, $ac_result, [Whether the system supports MD5 salt])
-
- AC_CACHE_CHECK(for Blowfish crypt, ac_cv_crypt_blowfish,[
- AC_TRY_RUN([
-#if HAVE_CRYPT_H
-#include <crypt.h>
-#endif
-
-main() {
-#if HAVE_CRYPT
- char salt[30], answer[70];
-
- salt[0]='$'; salt[1]='2'; salt[2]='a'; salt[3]='$'; salt[4]='0'; salt[5]='7'; salt[6]='$'; salt[7]='\0';
- strcat(salt,"rasmuslerd............");
- strcpy(answer,salt);
- strcpy(&answer[29],"nIdrcHdxcUxWomQX9j6kvERCFjTg7Ra");
- exit (strcmp((char *)crypt("rasmuslerdorf",salt),answer));
-#else
- exit(0);
-#endif
-}],[
- ac_cv_crypt_blowfish=yes
- ],[
- ac_cv_crypt_blowfish=no
- ],[
- ac_cv_crypt_blowfish=no
- ])
- ])
- if test "$ac_cv_crypt_blowfish" = "yes"; then
- ac_result=1
- else
- ac_result=0
- fi
- AC_DEFINE_UNQUOTED(PHP_BLOWFISH_CRYPT, $ac_result, [Whether the system supports BlowFish salt])
-])
-
-AC_CHECK_FUNC(dlopen, [AC_DEFINE(HAVE_LIBDL,1,[ ])])
-
-AC_CHECK_LIB(pam, pam_start, [
- EXTRA_LIBS="$EXTRA_LIBS -lpam"
- AC_DEFINE(HAVE_LIBPAM,1,[ ]) ], [])
-
-AC_CHECK_FUNCS(getcwd getwd)
-
-AC_CRYPT_CAP
-AC_FLUSH_IO
-
-divert(5)dnl
-
-AC_ARG_WITH(regex,
-[ --with-regex=TYPE regex library type: system, apache, php],
-[
- case $withval in
- system)
- REGEX_TYPE=system
- ;;
- apache)
- REGEX_TYPE=apache
- ;;
- php)
- REGEX_TYPE=php
- ;;
- *)
- REGEX_TYPE=php
- AC_MSG_WARN(Invalid regex library type. Using default value: php)
- ;;
- esac
-],[
- REGEX_TYPE=php
-])
-
-AC_ARG_WITH(system-regex,
-[ --with-system-regex (deprecated) Use system regex library],[
- if test "$withval" = "yes"; then
- REGEX_TYPE=system
- else
- REGEX_TYPE=php
- fi
-])
-
-PHP_EXTENSION(standard)
diff --git a/ext/standard/crc32.c b/ext/standard/crc32.c
deleted file mode 100644
index 86fe56cccc..0000000000
--- a/ext/standard/crc32.c
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Rasmus Lerdorf <rasmus@php.net> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#include "php.h"
-#include "basic_functions.h"
-
-/*
- * This code implements the AUTODIN II polynomial
- * The variable corresponding to the macro argument "crc" should
- * be an unsigned long.
- * Oroginal code by Spencer Garrett <srg@quick.com>
- */
-
-#define CRC32(crc, ch) (crc = (crc >> 8) ^ crc32tab[(crc ^ (ch)) & 0xff])
-
-/* generated using the AUTODIN II polynomial
- * x^32 + x^26 + x^23 + x^22 + x^16 +
- * x^12 + x^11 + x^10 + x^8 + x^7 + x^5 + x^4 + x^2 + x^1 + 1
- */
-
-static const unsigned int crc32tab[256] = {
- 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba,
- 0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3,
- 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988,
- 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91,
- 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de,
- 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7,
- 0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec,
- 0x14015c4f, 0x63066cd9, 0xfa0f3d63, 0x8d080df5,
- 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172,
- 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b,
- 0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940,
- 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59,
- 0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116,
- 0x21b4f4b5, 0x56b3c423, 0xcfba9599, 0xb8bda50f,
- 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924,
- 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d,
- 0x76dc4190, 0x01db7106, 0x98d220bc, 0xefd5102a,
- 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433,
- 0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818,
- 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01,
- 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e,
- 0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457,
- 0x65b0d9c6, 0x12b7e950, 0x8bbeb8ea, 0xfcb9887c,
- 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65,
- 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2,
- 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb,
- 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0,
- 0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9,
- 0x5005713c, 0x270241aa, 0xbe0b1010, 0xc90c2086,
- 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f,
- 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4,
- 0x59b33d17, 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad,
- 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a,
- 0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683,
- 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8,
- 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1,
- 0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe,
- 0xf762575d, 0x806567cb, 0x196c3671, 0x6e6b06e7,
- 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc,
- 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5,
- 0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252,
- 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b,
- 0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60,
- 0xdf60efc3, 0xa867df55, 0x316e8eef, 0x4669be79,
- 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236,
- 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f,
- 0xc5ba3bbe, 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04,
- 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d,
- 0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a,
- 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713,
- 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38,
- 0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21,
- 0x86d3d2d4, 0xf1d4e242, 0x68ddb3f8, 0x1fda836e,
- 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777,
- 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c,
- 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45,
- 0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2,
- 0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db,
- 0xaed16a4a, 0xd9d65adc, 0x40df0b66, 0x37d83bf0,
- 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9,
- 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6,
- 0xbad03605, 0xcdd70693, 0x54de5729, 0x23d967bf,
- 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94,
- 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d,
-};
-
-/* {{{ proto string crc32(string str)
- Calculate the crc32 polynomial of a string */
-PHP_NAMED_FUNCTION(php_if_crc32)
-{
- pval **arg;
- unsigned int crc = ~0;
- char *p ;
- int len, nr ;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(arg);
-
- len = 0 ;
- nr=(*arg)->value.str.len;
- p = (*arg)->value.str.val;
- for (len += nr; nr--; ++p) {
- CRC32(crc, *p);
- }
- RETVAL_LONG(~crc);
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/standard/credits.c b/ext/standard/credits.c
deleted file mode 100644
index b2089b2eeb..0000000000
--- a/ext/standard/credits.c
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#include "php.h"
-#include "info.h"
-
-#define CREDIT_LINE(module, authors) php_info_print_table_row(2, module, authors)
-
-/* {{{ php_print_credits
- */
-PHPAPI void php_print_credits(int flag)
-{
- if (flag & PHP_CREDITS_FULLPAGE) {
- PUTS("<html><head><title>PHP Credits</title></head><body>\n");
- }
-
- php_info_print_style();
-
- PUTS("<h1 align=\"center\">PHP 4.0 Credits</h1>\n");
-
- if (flag & PHP_CREDITS_GROUP) {
- /* Group */
-
- php_info_print_table_start();
- php_info_print_table_header(1, "PHP Group");
- php_info_print_table_row(1, "Thies C. Arntzen, Stig Bakken, Andi Gutmans, Rasmus Lerdorf, Sam Ruby, Sascha Schumann, Zeev Suraski, Jim Winstead, Andrei Zmievski");
- php_info_print_table_end();
- }
-
- if (flag & PHP_CREDITS_GENERAL) {
- /* Design & Concept */
- php_info_print_table_start();
- php_info_print_table_header(1, "Language Design & Concept");
- php_info_print_table_row(1, "Andi Gutmans, Rasmus Lerdorf, Zeev Suraski");
- php_info_print_table_end();
-
- /* PHP 4.0 Language */
- php_info_print_table_start();
- php_info_print_table_colspan_header(2, "PHP 4.0 Authors");
- php_info_print_table_header(2, "Contribution", "Authors");
- CREDIT_LINE("Zend Scripting Language Engine", "Andi Gutmans, Zeev Suraski");
- CREDIT_LINE("Extension Module API", "Andi Gutmans, Zeev Suraski");
- CREDIT_LINE("UNIX Build and Modularization", "Stig Bakken, Sascha Schumann");
- CREDIT_LINE("Win32 Port", "Shane Caraveo, Zeev Suraski");
- CREDIT_LINE("Server API (SAPI) Abstraction Layer", "Andi Gutmans, Shane Caraveo, Zeev Suraski");
- php_info_print_table_end();
- }
-
- if (flag & PHP_CREDITS_SAPI) {
- /* SAPI Modules */
-
- php_info_print_table_start();
- php_info_print_table_colspan_header(2, "SAPI Modules");
- php_info_print_table_header(2, "Contribution", "Authors");
-#include "credits_sapi.h"
- php_info_print_table_end();
- }
-
- if (flag & PHP_CREDITS_MODULES) {
- /* Modules */
-
- php_info_print_table_start();
- php_info_print_table_colspan_header(2, "Module Authors");
- php_info_print_table_header(2, "Module", "Authors");
-#include "credits_ext.h"
- php_info_print_table_end();
- }
-
- if (flag & PHP_CREDITS_DOCS) {
- php_info_print_table_start();
- php_info_print_table_header(1, "PHP Documentation Team");
- php_info_print_table_row(1, "Jouni Ahto, Alexander Aulbach, Stig Bakken, Rasmus Lerdorf, Egon Schmid, Zeev Suraski, Lars Torben Wilson, Jim Winstead");
- php_info_print_table_row(1, "Edited by: Stig Bakken and Egon Schmid");
- php_info_print_table_end();
- }
-
- if (flag & PHP_CREDITS_QA) {
- php_info_print_table_start();
- php_info_print_table_header(1, "PHP Quality Assurance Team");
- php_info_print_table_row(1, "Andre Langhorst, Hellekin O. Wolf, Jalal Pushman, James Moore, Jani Taskinen, Joey Smith, Olivier Cahagne, Phil Driscoll, Sebastian Bergmann, Zak Greant");
- php_info_print_table_end();
- }
-
- if (flag & PHP_CREDITS_WEB) {
- /* Website Team */
- php_info_print_table_start();
- php_info_print_table_header(1, "PHP Website Team");
- php_info_print_table_row(1, "Hojtsy Gabor, Colin Viebrock, Jim Winstead");
- php_info_print_table_end();
- }
-
- if (flag & PHP_CREDITS_FULLPAGE) {
- PUTS("</body></html>\n");
- }
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/standard/credits.h b/ext/standard/credits.h
deleted file mode 100644
index 04210ac927..0000000000
--- a/ext/standard/credits.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef CREDITS_H
-#define CREDITS_H
-
-#ifndef HAVE_CREDITS_DEFS
-#define HAVE_CREDITS_DEFS
-
-#define PHP_CREDITS_GROUP (1<<0)
-#define PHP_CREDITS_GENERAL (1<<1)
-#define PHP_CREDITS_SAPI (1<<2)
-#define PHP_CREDITS_MODULES (1<<3)
-#define PHP_CREDITS_DOCS (1<<4)
-#define PHP_CREDITS_FULLPAGE (1<<5)
-#define PHP_CREDITS_QA (1<<6)
-#define PHP_CREDITS_WEB (1<<7)
-#define PHP_CREDITS_ALL 0xFFFFFFFF
-
-#endif /* HAVE_CREDITS_DEFS */
-
-PHPAPI void php_print_credits(int flag);
-
-#endif
diff --git a/ext/standard/credits_ext.h b/ext/standard/credits_ext.h
deleted file mode 100644
index 69c3422169..0000000000
--- a/ext/standard/credits_ext.h
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- DO NOT EDIT THIS FILE!
-
- it has been automaticaly created by php4/scripts/credits from
- the information found in the various php4/ext/.../CREDITS and
- php4/sapi/.../CREDITS files
-
- if you want to change an entry you have to edit the appropriate
- CREDITS file instead
-
-*/
-
-CREDIT_LINE("aspell","Rasmus Lerdorf");
-CREDIT_LINE("Assert","Thies C. Arntzen");
-CREDIT_LINE("BC Math","Andi Gutmans");
-CREDIT_LINE("bz2","Sterling Hughes");
-CREDIT_LINE("ccvs","Brendan W. McAdams, Doug DeJulio");
-CREDIT_LINE("cpdf","Uwe Steinmann");
-CREDIT_LINE("crack","Alexander Feldman");
-CREDIT_LINE("ctype","Hartmut Holzgraefe");
-CREDIT_LINE("CURL","Sterling Hughes");
-CREDIT_LINE("CyberCash","Evan Klinger");
-CREDIT_LINE("DBA","Sascha Schumann");
-CREDIT_LINE("dBase","Jim Winstead");
-CREDIT_LINE("DBM","Rasmus Lerdorf, Jim Winstead");
-CREDIT_LINE("domxml","Uwe Steinmann");
-CREDIT_LINE("dotnet","Sam Ruby");
-CREDIT_LINE("EXIF","Rasmus Lerdorf");
-CREDIT_LINE("FBSQL","Frank M. Kromann");
-CREDIT_LINE("FDF","Uwe Steinmann");
-CREDIT_LINE("FilePro","Chad Robinson");
-CREDIT_LINE("FTP","Andrew Skalski");
-CREDIT_LINE("GD imaging","Rasmus Lerdorf, Stig Bakken, Jim Winstead, Jouni Ahto");
-CREDIT_LINE("GetText","Alex Plotnick");
-CREDIT_LINE("HyperWave","Uwe Steinmann");
-CREDIT_LINE("icap","Mark Musone");
-CREDIT_LINE("iisfunc","Frank M. Kromann");
-CREDIT_LINE("IMAP","Rex Logan, Mark Musone, Brian Wang, Kaj-Michael Lang, Antoni Pamies Olive, Rasmus Lerdorf, Andrew Skalski, Chuck Hagenbuch, Daniel R Kalowsky");
-CREDIT_LINE("Informix","Danny Heijl, Christian Cartus");
-CREDIT_LINE("Ingres II","David Hénot");
-CREDIT_LINE("InterBase","Jouni Ahto, Andrew Avdeev");
-CREDIT_LINE("IRCG","Sascha Schumann");
-CREDIT_LINE("Java","Sam Ruby");
-CREDIT_LINE("LDAP","Amitay Isaacs, Eric Warnke, Rasmus Lerdorf, Gerrit Thomson");
-CREDIT_LINE("Mailparse MIME parsing and manipulation functions","Wez Furlong");
-CREDIT_LINE("MCAL","Mark Musone, Chuck Hagenbuch");
-CREDIT_LINE("mcrypt","Sascha Schumann, Derick Rethans");
-CREDIT_LINE("mhash","Sascha Schumann");
-CREDIT_LINE("MING","Dave Hayden");
-CREDIT_LINE("mnoGoSearch","Alex Barkov, Ramil Kalimullin, Sergey Kartashoff");
-CREDIT_LINE("MS SQL","Frank M. Kromann");
-CREDIT_LINE("mSQL","Zeev Suraski");
-CREDIT_LINE("Multibyte (Japanese) String Functions","Tsukada Takuya");
-CREDIT_LINE("MySQL","Zeev Suraski");
-CREDIT_LINE("OCI8","Stig Bakken, Thies C. Arntzen, Andy Sautins, David Benson");
-CREDIT_LINE("ODBC","Stig Bakken, Andreas Karajannis, Frank M. Kromann, Daniel R. Kalowsky");
-CREDIT_LINE("OpenSSL","Stig Venaas, Wez Furlong, Sascha Kettler");
-CREDIT_LINE("Oracle","Stig Bakken, Mitch Golden, Rasmus Lerdorf, Andreas Karajannis, Thies C. Arntzen");
-CREDIT_LINE("Ovrimos","Nikos Mavroyanopoulos");
-CREDIT_LINE("pcntl","Jason Greene");
-CREDIT_LINE("PDF","Uwe Steinmann");
-CREDIT_LINE("Perl Compatible Regexps","Andrei Zmievski");
-CREDIT_LINE("Posix","Kristian Köhntopp");
-CREDIT_LINE("PostgreSQL","Jouni Ahto, Zeev Suraski");
-CREDIT_LINE("PRINTER","Daniel Beulshausen, Frank M. Kromann");
-CREDIT_LINE("Pspell","Vlad Krupin");
-CREDIT_LINE("qtdom","Jan Borsodi");
-CREDIT_LINE("Readline","Thies C. Arntzen");
-CREDIT_LINE("Recode","Kristian Köhntopp");
-CREDIT_LINE("Sablotron XSLT","Sterling Hughes");
-CREDIT_LINE("Satellite (CORBA)","David Eriksson");
-CREDIT_LINE("Sessions","Sascha Schumann, Andrei Zmievski");
-CREDIT_LINE("Shared Memory Operations","Slava Poliakov, Ilia Alshanetsky");
-CREDIT_LINE("SNMP","Rasmus Lerdorf");
-CREDIT_LINE("Sockets","Chris Vandomelen, Sterling Hughes, Daniel Beulshausen");
-CREDIT_LINE("SWF","Sterling Hughes");
-CREDIT_LINE("Sybase-CT","Zeev Suraski, Tom May");
-CREDIT_LINE("Sybase-DB","Zeev Suraski");
-CREDIT_LINE("System V Semaphores","Tom May");
-CREDIT_LINE("System V Shared Memory","Christian Cartus");
-CREDIT_LINE("Verisign Payflow Pro","John Donagher, David Croft");
-CREDIT_LINE("Vpopmail","David Croft, Boian Bonev");
-CREDIT_LINE("WDDX","Andrei Zmievski");
-CREDIT_LINE("Win32 COM","Zeev Suraski, Harald Radi");
-CREDIT_LINE("XML","Stig Bakken, Thies C. Arntzen");
-CREDIT_LINE("YAZ","Adam Dickmeiss");
-CREDIT_LINE("Yellow Pages","Stephanie Wehner, Fredrik Ohrn");
-CREDIT_LINE("Zip","Sterling Hughes");
-CREDIT_LINE("Zlib","Rasmus Lerdorf, Stefan Roehrich");
diff --git a/ext/standard/credits_sapi.h b/ext/standard/credits_sapi.h
deleted file mode 100644
index 8337038f81..0000000000
--- a/ext/standard/credits_sapi.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- DO NOT EDIT THIS FILE!
-
- it has been automaticaly created by php4/scripts/credits from
- the information found in the various php4/ext/.../CREDITS and
- php4/sapi/.../CREDITS files
-
- if you want to change an entry you have to edit the appropriate
- CREDITS file instead
-
-*/
-
-CREDIT_LINE("AOLserver","Sascha Schumann");
-CREDIT_LINE("Apache 1.3","Rasmus Lerdorf, Zeev Suraski, Stig Bakken, David Sklar");
-CREDIT_LINE("Apache 2.0","Sascha Schumann");
-CREDIT_LINE("Caudium / Roxen","David Hedbor");
-CREDIT_LINE("CGI","Rasmus Lerdorf, Stig Bakken");
-CREDIT_LINE("fhttpd","Alex Belits");
-CREDIT_LINE("ISAPI","Andi Gutmans, Zeev Suraski");
-CREDIT_LINE("Java Servlet","Sam Ruby");
-CREDIT_LINE("NSAPI","Jayakumar Muthukumarasamy");
-CREDIT_LINE("phttpd","Thies C. Arntzen");
-CREDIT_LINE("pi3web","Holger Zimmermann");
-CREDIT_LINE("thttpd","Sascha Schumann");
diff --git a/ext/standard/crypt.c b/ext/standard/crypt.c
deleted file mode 100644
index 9b2f8729b6..0000000000
--- a/ext/standard/crypt.c
+++ /dev/null
@@ -1,185 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Stig Bakken <ssb@gaurdian.no> |
- | Zeev Suraski <zeev@zend.com> |
- | Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
- +----------------------------------------------------------------------+
- */
-/* $Id$ */
-#include <stdlib.h>
-
-#include "php.h"
-
-#if HAVE_CRYPT
-
-#if HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#if HAVE_CRYPT_H
-#include <crypt.h>
-#endif
-#if TM_IN_SYS_TIME
-#include <sys/time.h>
-#else
-#include <time.h>
-#endif
-#if HAVE_STRING_H
-#include <string.h>
-#else
-#include <strings.h>
-#endif
-
-#ifdef PHP_WIN32
-#include <process.h>
-extern char *crypt(char *__key,char *__salt);
-#endif
-
-#include "php_lcg.h"
-#include "php_crypt.h"
-#include "php_rand.h"
-
-/*
- The capabilities of the crypt() function is determined by the test programs
- run by configure from aclocal.m4. They will set PHP_STD_DES_CRYPT,
- PHP_EXT_DES_CRYPT, PHP_MD5_CRYPT and PHP_BLOWFISH_CRYPT as appropriate
- for the target platform
-*/
-#if PHP_STD_DES_CRYPT
-#define PHP_MAX_SALT_LEN 2
-#endif
-
-#if PHP_EXT_DES_CRYPT
-#undef PHP_MAX_SALT_LEN
-#define PHP_MAX_SALT_LEN 9
-#endif
-
-#if PHP_MD5_CRYPT
-#undef PHP_MAX_SALT_LEN
-#define PHP_MAX_SALT_LEN 12
-#endif
-
-#if PHP_BLOWFISH_CRYPT
-#undef PHP_MAX_SALT_LEN
-#define PHP_MAX_SALT_LEN 60
-#endif
-
- /*
- * If the configure-time checks fail, we provide DES.
- * XXX: This is a hack. Fix the real problem
- */
-
-#ifndef PHP_MAX_SALT_LEN
-#define PHP_MAX_SALT_LEN 2
-#undef PHP_STD_DES_CRYPT
-#define PHP_STD_DES_CRYPT 1
-#endif
-
-
-#define PHP_CRYPT_RAND php_rand()
-
-static int php_crypt_rand_seeded=0;
-
-PHP_MINIT_FUNCTION(crypt)
-{
-#if PHP_STD_DES_CRYPT
- REGISTER_LONG_CONSTANT("CRYPT_SALT_LENGTH", 2, CONST_CS | CONST_PERSISTENT);
-#elif PHP_MD5_CRYPT
- REGISTER_LONG_CONSTANT("CRYPT_SALT_LENGTH", 12, CONST_CS | CONST_PERSISTENT);
-#endif
- REGISTER_LONG_CONSTANT("CRYPT_STD_DES", PHP_STD_DES_CRYPT, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("CRYPT_EXT_DES", PHP_EXT_DES_CRYPT, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("CRYPT_MD5", PHP_MD5_CRYPT, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("CRYPT_BLOWFISH", PHP_BLOWFISH_CRYPT, CONST_CS | CONST_PERSISTENT);
-
- return SUCCESS;
-}
-
-
-PHP_RINIT_FUNCTION(crypt)
-{
- if(!php_crypt_rand_seeded) {
- php_srand(time(0) * getpid() * (php_combined_lcg() * 10000.0));
- php_crypt_rand_seeded=1;
- }
- return SUCCESS;
-}
-
-
-static unsigned char itoa64[] = "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
-
-static void php_to64(char *s, long v, int n) {
- while (--n >= 0) {
- *s++ = itoa64[v&0x3f];
- v >>= 6;
- }
-}
-
-/* {{{ proto string crypt(string str [, string salt])
- Encrypt a string */
-PHP_FUNCTION(crypt)
-{
- char salt[PHP_MAX_SALT_LEN+1];
- pval **arg1, **arg2;
-
- salt[0]=salt[PHP_MAX_SALT_LEN]='\0';
- /* This will produce suitable results if people depend on DES-encryption
- available (passing always 2-character salt). At least for glibc6.1 */
- memset(&salt[1], '$', PHP_MAX_SALT_LEN-1);
-
- switch (ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &arg1)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- case 2:
- if (zend_get_parameters_ex(2, &arg1, &arg2)==FAILURE) {
- RETURN_FALSE;
- }
- convert_to_string_ex(arg2);
- memcpy(salt, Z_STRVAL_PP(arg2), MIN(PHP_MAX_SALT_LEN, Z_STRLEN_PP(arg2)));
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- convert_to_string_ex(arg1);
-
- /* The automatic salt generation only covers standard DES and md5-crypt */
- if(!*salt) {
-#if PHP_STD_DES_CRYPT
- php_to64(&salt[0], PHP_CRYPT_RAND, 2);
- salt[2] = '\0';
-#elif PHP_MD5_CRYPT
- strcpy(salt, "$1$");
- php_to64(&salt[3], PHP_CRYPT_RAND, 4);
- php_to64(&salt[7], PHP_CRYPT_RAND, 4);
- strcpy(&salt[11], "$");
-#endif
- }
-
- RETVAL_STRING(crypt(Z_STRVAL_PP(arg1), salt), 1);
-}
-/* }}} */
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/standard/cyr_convert.c b/ext/standard/cyr_convert.c
deleted file mode 100644
index 44bb49a8d6..0000000000
--- a/ext/standard/cyr_convert.c
+++ /dev/null
@@ -1,299 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Kirill Maximov <kir@rus.net> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#include <stdlib.h>
-
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#include <string.h>
-#include <errno.h>
-
-#include "php.h"
-#include "cyr_convert.h"
-
-#include <stdio.h>
-
-/*****************************************************************************
-* This is codetables for different Cyrillic charsets (relative to koi8-r).
-* Each table contains data for 128-255 symbols from ASCII table.
-* First 256 symbols are for conversion from koi8-r to corresponding charset,
-* second 256 symbols are for reverse conversion, from charset to koi8-r.
-*
-* Here we have the following tables:
-* _cyr_win1251 - for windows-1251 charset
-* _cyr_iso88595 - for iso8859-5 charset
-* _cyr_cp866 - for x-cp866 charset
-* _cyr_mac - for x-mac-cyrillic charset
-*
-*****************************************************************************/
-
-typedef unsigned char _cyr_charset_table[512];
-
-/* {{{ const static _cyr_charset_table _cyr_win1251
- */
-const static _cyr_charset_table _cyr_win1251 = {
-0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,
-16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,
-32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,
-48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,
-64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,
-80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,
-96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,
-112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,
-46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,
-46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,
-154,174,190,46,159,189,46,46,179,191,180,157,46,46,156,183,
-46,46,182,166,173,46,46,158,163,152,164,155,46,46,46,167,
-225,226,247,231,228,229,246,250,233,234,235,236,237,238,239,240,
-242,243,244,245,230,232,227,254,251,253,255,249,248,252,224,241,
-193,194,215,199,196,197,214,218,201,202,203,204,205,206,207,208,
-210,211,212,213,198,200,195,222,219,221,223,217,216,220,192,209,
-0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,
-16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,
-32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,
-48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,
-64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,
-80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,
-96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,
-112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,
-32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,
-32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,
-32,32,32,184,186,32,179,191,32,32,32,32,32,180,162,32,
-32,32,32,168,170,32,178,175,32,32,32,32,32,165,161,169,
-254,224,225,246,228,229,244,227,245,232,233,234,235,236,237,238,
-239,255,240,241,242,243,230,226,252,251,231,248,253,249,247,250,
-222,192,193,214,196,197,212,195,213,200,201,202,203,204,205,206,
-207,223,208,209,210,211,198,194,220,219,199,216,221,217,215,218,
-},
-_cyr_cp866 = {
-0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,
-16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,
-32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,
-48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,
-64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,
-80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,
-96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,
-112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,
-225,226,247,231,228,229,246,250,233,234,235,236,237,238,239,240,
-242,243,244,245,230,232,227,254,251,253,255,249,248,252,224,241,
-193,194,215,199,196,197,214,218,201,202,203,204,205,206,207,208,
-35,35,35,124,124,124,124,43,43,124,124,43,43,43,43,43,
-43,45,45,124,45,43,124,124,43,43,45,45,124,45,43,45,
-45,45,45,43,43,43,43,43,43,43,43,35,35,124,124,35,
-210,211,212,213,198,200,195,222,219,221,223,217,216,220,192,209,
-179,163,180,164,183,167,190,174,32,149,158,32,152,159,148,154,
-0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,
-16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,
-32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,
-48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,
-64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,
-80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,
-96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,
-112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,
-32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,
-32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,
-205,186,213,241,243,201,32,245,187,212,211,200,190,32,247,198,
-199,204,181,240,242,185,32,244,203,207,208,202,216,32,246,32,
-238,160,161,230,164,165,228,163,229,168,169,170,171,172,173,174,
-175,239,224,225,226,227,166,162,236,235,167,232,237,233,231,234,
-158,128,129,150,132,133,148,131,149,136,137,138,139,140,141,142,
-143,159,144,145,146,147,134,130,156,155,135,152,157,153,151,154,
-},
-_cyr_iso88595 = {
-0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,
-16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,
-32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,
-48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,
-64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,
-80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,
-96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,
-112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,
-32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,
-32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,
-32,179,32,32,32,32,32,32,32,32,32,32,32,32,32,32,
-225,226,247,231,228,229,246,250,233,234,235,236,237,238,239,240,
-242,243,244,245,230,232,227,254,251,253,255,249,248,252,224,241,
-193,194,215,199,196,197,214,218,201,202,203,204,205,206,207,208,
-210,211,212,213,198,200,195,222,219,221,223,217,216,220,192,209,
-32,163,32,32,32,32,32,32,32,32,32,32,32,32,32,32,
-0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,
-16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,
-32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,
-48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,
-64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,
-80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,
-96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,
-112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,
-32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,
-32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,
-32,32,32,241,32,32,32,32,32,32,32,32,32,32,32,32,
-32,32,32,161,32,32,32,32,32,32,32,32,32,32,32,32,
-238,208,209,230,212,213,228,211,229,216,217,218,219,220,221,222,
-223,239,224,225,226,227,214,210,236,235,215,232,237,233,231,234,
-206,176,177,198,180,181,196,179,197,184,185,186,187,188,189,190,
-191,207,192,193,194,195,182,178,204,203,183,200,205,201,199,202,
-},
-_cyr_mac = {
-0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,
-16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,
-32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,
-48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,
-64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,
-80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,
-96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,
-112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,
-225,226,247,231,228,229,246,250,233,234,235,236,237,238,239,240,
-242,243,244,245,230,232,227,254,251,253,255,249,248,252,224,241,
-160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,
-176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,
-128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,
-144,145,146,147,148,149,150,151,152,153,154,155,156,179,163,209,
-193,194,215,199,196,197,214,218,201,202,203,204,205,206,207,208,
-210,211,212,213,198,200,195,222,219,221,223,217,216,220,192,255,
-0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,
-16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,
-32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,
-48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,
-64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,
-80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,
-96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,
-112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,
-192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,
-208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,
-160,161,162,222,164,165,166,167,168,169,170,171,172,173,174,175,
-176,177,178,221,180,181,182,183,184,185,186,187,188,189,190,191,
-254,224,225,246,228,229,244,227,245,232,233,234,235,236,237,238,
-239,223,240,241,242,243,230,226,252,251,231,248,253,249,247,250,
-158,128,129,150,132,133,148,131,149,136,137,138,139,140,141,142,
-143,159,144,145,146,147,134,130,156,155,135,152,157,153,151,154,
-};
-/* }}} */
-
-/* {{{ php_convert_cyr_string
-* This is the function that performs real in-place conversion of the string
-* between charsets.
-* Parameters:
-* str - string to be converted
-* from,to - one-symbol label of source and destination charset
-* The following symbols are used as labels:
-* k - koi8-r
-* w - windows-1251
-* i - iso8859-5
-* a - x-cp866
-* d - x-cp866
-* m - x-mac-cyrillic
-*****************************************************************************/
-static char * php_convert_cyr_string(unsigned char *str, int length, char from, char to)
-{
- const unsigned char *from_table, *to_table;
- unsigned char tmp;
- int i;
-
- from_table = NULL;
- to_table = NULL;
-
- switch (toupper(from))
- {
- case 'W':
- from_table = _cyr_win1251;
- break;
- case 'A':
- case 'D':
- from_table = _cyr_cp866;
- break;
- case 'I':
- from_table = _cyr_iso88595;
- break;
- case 'M':
- from_table = _cyr_mac;
- break;
- case 'K':
- break;
- default:
- php_error(E_WARNING, "Unknown source charset: %c", from);
- break;
- }
-
- switch (toupper(to))
- {
- case 'W':
- to_table = _cyr_win1251;
- break;
- case 'A':
- case 'D':
- to_table = _cyr_cp866;
- break;
- case 'I':
- to_table = _cyr_iso88595;
- break;
- case 'M':
- to_table = _cyr_mac;
- break;
- case 'K':
- break;
- default:
- php_error(E_WARNING, "Unknown destination charset: %c", to);
- break;
- }
-
-
- if (!str)
- return (char *)str;
-
- for( i = 0; i<length; i++)
- {
- tmp = (from_table == NULL)? str[i] : from_table[ str[i] ];
- str[i] = (to_table == NULL) ? tmp : to_table[tmp + 256];
- }
- return (char *)str;
-}
-/* }}} */
-
-/* {{{ proto string convert_cyr_string(string str, string from, string to)
- Convert from one Cyrillic character set to another */
-PHP_FUNCTION(convert_cyr_string)
-{
- pval **str_arg, **fr_cs, **to_cs;
- unsigned char *str;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3,&str_arg,&fr_cs, &to_cs)==FAILURE)
- {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(str_arg);
- convert_to_string_ex(fr_cs);
- convert_to_string_ex(to_cs);
-
- str = (unsigned char*) estrndup((*str_arg)->value.str.val, (*str_arg)->value.str.len);
-
- php_convert_cyr_string(str, (*str_arg)->value.str.len, (*fr_cs)->value.str.val[0], (*to_cs)->value.str.val[0]);
- RETVAL_STRING((char *)str, 0)
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/standard/cyr_convert.h b/ext/standard/cyr_convert.h
deleted file mode 100644
index ab75c8dfe9..0000000000
--- a/ext/standard/cyr_convert.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Kirill Maximov (kir@rus.net) |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef CYR_CONVERT_H
-#define CYR_CONVERT_H
-
-PHP_FUNCTION(convert_cyr_string);
-
-#endif /* CYR_CONVERT_H */
-
-
-
diff --git a/ext/standard/datetime.c b/ext/standard/datetime.c
deleted file mode 100644
index e94f1a3bc6..0000000000
--- a/ext/standard/datetime.c
+++ /dev/null
@@ -1,832 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- | Rasmus Lerdorf <rasmus@php.net> |
- +----------------------------------------------------------------------+
- */
-
-
-/* $Id$ */
-
-
-#include "php.h"
-#include "zend_operators.h"
-#include "datetime.h"
-#include "php_globals.h"
-
-#include <time.h>
-#ifdef HAVE_SYS_TIME_H
-# include <sys/time.h>
-#endif
-#include <stdio.h>
-
-#include "php_parsedate.h"
-
-char *mon_full_names[] =
-{
- "January", "February", "March", "April",
- "May", "June", "July", "August",
- "September", "October", "November", "December"
-};
-char *mon_short_names[] =
-{
- "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
-};
-char *day_full_names[] =
-{
- "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"
-};
-char *day_short_names[] =
-{
- "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
-};
-
-#if !defined(HAVE_TM_ZONE) && !defined(_TIMEZONE) && !defined(HAVE_DECLARED_TIMEZONE)
-extern time_t timezone;
-extern int daylight;
-#endif
-
-static int phpday_tab[2][12] =
-{
- {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31},
- {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}
-};
-
-#define isleap(year) (((year%4) == 0 && (year%100)!=0) || (year%400)==0)
-
-/* {{{ proto int time(void)
- Return current UNIX timestamp */
-PHP_FUNCTION(time)
-{
- RETURN_LONG((long)time(NULL));
-}
-/* }}} */
-
-/* {{{ php_mktime
- */
-void php_mktime(INTERNAL_FUNCTION_PARAMETERS, int gm)
-{
- pval **arguments[7];
- struct tm *ta, tmbuf;
- time_t t;
- int i, gmadjust, seconds, arg_count = ZEND_NUM_ARGS();
- int is_dst = -1;
-
- if (arg_count > 7 || zend_get_parameters_array_ex(arg_count,arguments) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- /* convert supplied arguments to longs */
- for (i = 0; i < arg_count; i++) {
- convert_to_long_ex(arguments[i]);
- }
- t = time(NULL);
-#ifdef HAVE_TZSET
- tzset();
-#endif
- /*
- ** Set default time parameters with local time values,
- ** EVEN when some GMT time parameters are specified!
- ** This may give strange result, with PHP gmmktime(0,0,0),
- ** which is assumed to return GMT midnight time
- ** for today (in localtime), so that the result time may be
- ** AFTER or BEFORE the current time.
- ** May be we should initialize tn using gmtime(), so that
- ** default parameters for PHP gmmktime would be the current
- ** GMT time values...
- */
- ta = php_localtime_r(&t, &tmbuf);
-
- /* Let DST be unknown. mktime() should compute the right value
- ** and behave correctly. Unless the user overrides this.
- */
- ta->tm_isdst = -1;
-
- /*
- ** Now change date values with supplied parameters.
- */
- switch(arg_count) {
- case 7:
- ta->tm_isdst = is_dst = (*arguments[6])->value.lval;
- /* fall-through */
- case 6:
- /* special case:
- a zero in year, month and day is considered illegal
- as it would be interpreted as 30.11.1999 otherwise
- */
- if ( ( (*arguments[5])->value.lval==0)
- &&((*arguments[4])->value.lval==0)
- &&((*arguments[3])->value.lval==0)
- ) {
- RETURN_LONG(-1);
- }
-
- /*
- ** Accept parameter in range 0..1000 interpreted as 1900..2900
- ** (if 100 is given, it means year 2000)
- ** or in range 1001..9999 interpreted as is (this will store
- ** negative tm_year for years in range 1001..1899)
- ** This function is then Y2K ready, and accepts a wide range of
- ** dates including the whole gregorian calendar.
- ** But it cannot represent ancestral dates prior to year 1001.
- ** Additionally, input parameters of 0..70 are mapped to 100..170
- */
- if ((*arguments[5])->value.lval < 70)
- ta->tm_year = (*arguments[5])->value.lval + 100;
- else
- ta->tm_year = (*arguments[5])->value.lval
- - (((*arguments[5])->value.lval > 1000) ? 1900 : 0);
- /* fall-through */
- case 5:
- ta->tm_mday = (*arguments[4])->value.lval;
- /* fall-through */
- case 4:
- ta->tm_mon = (*arguments[3])->value.lval - 1;
- /* fall-through */
- case 3:
- ta->tm_sec = (*arguments[2])->value.lval;
- /* fall-through */
- case 2:
- ta->tm_min = (*arguments[1])->value.lval;
- /* fall-through */
- case 1:
- ta->tm_hour = (*arguments[0])->value.lval;
- /* fall-through */
- case 0:
- break;
- }
-
- seconds = mktime(ta);
- if (is_dst == -1)
- is_dst = ta->tm_isdst;
-
- if (gm) {
-#if HAVE_TM_GMTOFF
- /*
- ** mktime(ta) very nicely just filled ta->tm_gmtoff with
- ** the exactly right value for adjustment if we want GMT.
- */
- gmadjust = ta->tm_gmtoff;
-#else
- /*
- ** If correcting for daylight savings time, we set the adjustment to
- ** the value of timezone - 3600 seconds. Otherwise, we need to overcorrect and
- ** set the adjustment to the main timezone + 3600 seconds.
- */
- gmadjust = -(is_dst ? timezone - 3600 : timezone + 3600);
-#endif
- seconds += gmadjust;
- }
-
- RETURN_LONG(seconds);
-}
-/* }}} */
-
-/* {{{ proto int mktime(int hour, int min, int sec, int mon, int day, int year)
- Get UNIX timestamp for a date */
-PHP_FUNCTION(mktime)
-{
- php_mktime(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-/* }}} */
-
-/* {{{ proto int gmmktime(int hour, int min, int sec, int mon, int day, int year)
- Get UNIX timestamp for a GMT date */
-PHP_FUNCTION(gmmktime)
-{
- php_mktime(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
-}
-/* }}} */
-
-/* {{{ php_date
- */
-static void
-php_date(INTERNAL_FUNCTION_PARAMETERS, int gm)
-{
- pval **format, **timestamp;
- time_t the_time;
- struct tm *ta, tmbuf;
- int i, size = 0, length, h, beat, fd, wd, yd, wk;
- char tmp_buff[32];
-
- switch(ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &format) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- the_time = time(NULL);
- break;
- case 2:
- if (zend_get_parameters_ex(2, &format, &timestamp) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(timestamp);
- the_time = (*timestamp)->value.lval;
- break;
- default:
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(format);
-
- if (gm) {
- ta = php_gmtime_r(&the_time, &tmbuf);
- } else {
- ta = php_localtime_r(&the_time, &tmbuf);
- }
-
- if (!ta) { /* that really shouldn't happen... */
- php_error(E_WARNING, "unexpected error in date()");
- RETURN_FALSE;
- }
- for (i = 0; i < (*format)->value.str.len; i++) {
- switch ((*format)->value.str.val[i]) {
- case 'r': /* rfc822 format */
- size += 31;
- break;
- case 'U': /* seconds since the epoch */
- size += 10;
- break;
- case 'F': /* month, textual, full */
- case 'l': /* day (of the week), textual */
- size += 28;
- break;
- case 'T': /* timezone name */
-#if HAVE_TM_ZONE
- size += strlen(ta->tm_zone);
-#elif HAVE_TZNAME
- size += strlen(tzname[0]);
-#endif
- break;
- case 'Z': /* timezone offset in seconds */
- size += 6;
- break;
- case 'O': /* GMT offset in [+-]HHMM format */
- size += 5;
- break;
- case 'Y': /* year, numeric, 4 digits */
- size += 4;
- break;
- case 'M': /* month, textual, 3 letters */
- case 'D': /* day, textual, 3 letters */
- case 'z': /* day of the year, 1 to 366 */
- case 'B': /* Swatch Beat, 3 digits */
- size += 3;
- break;
- case 'y': /* year, numeric, 2 digits */
- case 'm': /* month, numeric */
- case 'n': /* month, numeric, no leading zeroes */
- case 'd': /* day of the month, numeric */
- case 'j': /* day of the month, numeric, no leading zeros */
- case 'H': /* hour, numeric, 24 hour format */
- case 'h': /* hour, numeric, 12 hour format */
- case 'G': /* hour, numeric, 24 hour format, no leading zeroes */
- case 'g': /* hour, numeric, 12 hour format, no leading zeroes */
- case 'i': /* minutes, numeric */
- case 's': /* seconds, numeric */
- case 'A': /* AM/PM */
- case 'a': /* am/pm */
- case 'S': /* standard english suffix for the day of the month (e.g. 3rd, 2nd, etc) */
- case 't': /* days in current month */
- case 'W': /* ISO-8601 week number of year, weeks starting on Monday */
- size += 2;
- break;
- case '\\':
- if(i < (*format)->value.str.len-1) {
- i++;
- }
- size ++;
- break;
- case 'L': /* boolean for leap year */
- case 'w': /* day of the week, numeric */
- case 'I': /* DST? */
- default:
- size++;
- break;
- }
- }
-
- return_value->value.str.val = (char *) emalloc(size + 1);
- return_value->value.str.val[0] = '\0';
-
- for (i = 0; i < (*format)->value.str.len; i++) {
- switch ((*format)->value.str.val[i]) {
- case '\\':
- if(i < (*format)->value.str.len-1) {
- char ch[2];
- ch[0]=(*format)->value.str.val[i+1];
- ch[1]='\0';
- strcat(return_value->value.str.val, ch);
- i++;
- }
- break;
- case 'U': /* seconds since the epoch */
- sprintf(tmp_buff, "%ld", (long)the_time); /* SAFE */
- strcat(return_value->value.str.val, tmp_buff);
- break;
- case 'F': /* month, textual, full */
- strcat(return_value->value.str.val, mon_full_names[ta->tm_mon]);
- break;
- case 'l': /* day (of the week), textual, full */
- strcat(return_value->value.str.val, day_full_names[ta->tm_wday]);
- break;
- case 'Y': /* year, numeric, 4 digits */
- sprintf(tmp_buff, "%d", ta->tm_year + 1900); /* SAFE */
- strcat(return_value->value.str.val, tmp_buff);
- break;
- case 'M': /* month, textual, 3 letters */
- strcat(return_value->value.str.val, mon_short_names[ta->tm_mon]);
- break;
- case 'D': /* day (of the week), textual, 3 letters */
- strcat(return_value->value.str.val, day_short_names[ta->tm_wday]);
- break;
- case 'z': /* day (of the year) */
- sprintf(tmp_buff, "%d", ta->tm_yday); /* SAFE */
- strcat(return_value->value.str.val, tmp_buff);
- break;
- case 'y': /* year, numeric, 2 digits */
- sprintf(tmp_buff, "%02d", ((ta->tm_year)%100)); /* SAFE */
- strcat(return_value->value.str.val, tmp_buff);
- break;
- case 'm': /* month, numeric */
- sprintf(tmp_buff, "%02d", ta->tm_mon + 1); /* SAFE */
- strcat(return_value->value.str.val, tmp_buff);
- break;
- case 'n': /* month, numeric, no leading zeros */
- sprintf(tmp_buff, "%d", ta->tm_mon + 1); /* SAFE */
- strcat(return_value->value.str.val, tmp_buff);
- break;
- case 'd': /* day of the month, numeric */
- sprintf(tmp_buff, "%02d", ta->tm_mday); /* SAFE */
- strcat(return_value->value.str.val, tmp_buff);
- break;
- case 'j':
- sprintf(tmp_buff, "%d", ta->tm_mday); /* SAFE */
- strcat(return_value->value.str.val, tmp_buff);
- break;
- case 'H': /* hour, numeric, 24 hour format */
- sprintf(tmp_buff, "%02d", ta->tm_hour); /* SAFE */
- strcat(return_value->value.str.val, tmp_buff);
- break;
- case 'h': /* hour, numeric, 12 hour format */
- h = ta->tm_hour % 12; if (h==0) h = 12;
- sprintf(tmp_buff, "%02d", h); /* SAFE */
- strcat(return_value->value.str.val, tmp_buff);
- break;
- case 'G': /* hour, numeric, 24 hour format, no leading zeros */
- sprintf(tmp_buff, "%d", ta->tm_hour); /* SAFE */
- strcat(return_value->value.str.val, tmp_buff);
- break;
- case 'g': /* hour, numeric, 12 hour format, no leading zeros */
- h = ta->tm_hour % 12; if (h==0) h = 12;
- sprintf(tmp_buff, "%d", h); /* SAFE */
- strcat(return_value->value.str.val, tmp_buff);
- break;
- case 'i': /* minutes, numeric */
- sprintf(tmp_buff, "%02d", ta->tm_min); /* SAFE */
- strcat(return_value->value.str.val, tmp_buff);
- break;
- case 's': /* seconds, numeric */
- sprintf(tmp_buff, "%02d", ta->tm_sec); /* SAFE */
- strcat(return_value->value.str.val, tmp_buff);
- break;
- case 'A': /* AM/PM */
- strcat(return_value->value.str.val, (ta->tm_hour >= 12 ? "PM" : "AM"));
- break;
- case 'a': /* am/pm */
- strcat(return_value->value.str.val, (ta->tm_hour >= 12 ? "pm" : "am"));
- break;
- case 'S': /* standard english suffix, e.g. 2nd/3rd for the day of the month */
- if (ta->tm_mday >= 10 && ta->tm_mday <= 19) {
- strcat(return_value->value.str.val, "th");
- } else {
- switch (ta->tm_mday % 10) {
- case 1:
- strcat(return_value->value.str.val, "st");
- break;
- case 2:
- strcat(return_value->value.str.val, "nd");
- break;
- case 3:
- strcat(return_value->value.str.val, "rd");
- break;
- default:
- strcat(return_value->value.str.val, "th");
- break;
- }
- }
- break;
- case 't': /* days in current month */
- sprintf(tmp_buff, "%2d", phpday_tab[isleap((ta->tm_year+1900))][ta->tm_mon] );
- strcat(return_value->value.str.val, tmp_buff);
- break;
- case 'w': /* day of the week, numeric EXTENSION */
- sprintf(tmp_buff, "%01d", ta->tm_wday); /* SAFE */
- strcat(return_value->value.str.val, tmp_buff);
- break;
- case 'O': /* GMT offset in [+-]HHMM format */
-#if HAVE_TM_GMTOFF
- sprintf(tmp_buff, "%c%02d%02d", (ta->tm_gmtoff < 0) ? '-' : '+', abs(ta->tm_gmtoff / 3600), abs( ta->tm_gmtoff % 3600));
-#else
- sprintf(tmp_buff, "%c%02d%02d", ((ta->tm_isdst ? timezone - 3600:timezone)>0)?'-':'+',abs((ta->tm_isdst ? timezone - 3600 : timezone) / 3600), abs((ta->tm_isdst ? timezone - 3600 : timezone) % 3600));
-#endif
- strcat(return_value->value.str.val, tmp_buff);
- break;
- case 'Z': /* timezone offset in seconds */
-#if HAVE_TM_GMTOFF
- sprintf(tmp_buff, "%ld", ta->tm_gmtoff);
-#else
- sprintf(tmp_buff, "%ld", ta->tm_isdst ? -(timezone - 3600) : -timezone);
-#endif
- strcat(return_value->value.str.val, tmp_buff);
- break;
- case 'L': /* boolean for leapyear */
- sprintf(tmp_buff, "%d", (isleap((ta->tm_year+1900)) ? 1 : 0 ) );
- strcat(return_value->value.str.val, tmp_buff);
- break;
- case 'T': /* timezone name */
-#if HAVE_TM_ZONE
- strcat(return_value->value.str.val, ta->tm_zone);
-#elif HAVE_TZNAME
- strcat(return_value->value.str.val, tzname[0]);
-#endif
- break;
- case 'B': /* Swatch Beat a.k.a. Internet Time */
- beat = (((((long)the_time)-(((long)the_time) -
- ((((long)the_time) % 86400) + 3600))) * 10) / 864);
- while (beat < 0) {
- beat += 1000;
- }
- beat = beat % 1000;
- sprintf(tmp_buff, "%03d", beat); /* SAFE */
- strcat(return_value->value.str.val, tmp_buff);
- break;
- case 'I':
- sprintf(tmp_buff, "%d", ta->tm_isdst);
- strcat(return_value->value.str.val, tmp_buff);
- break;
- case 'r':
-#if HAVE_TM_GMTOFF
- sprintf(tmp_buff, "%3s, %2d %3s %04d %02d:%02d:%02d %c%02d%02d",
- day_short_names[ta->tm_wday],
- ta->tm_mday,
- mon_short_names[ta->tm_mon],
- ta->tm_year + 1900,
- ta->tm_hour,
- ta->tm_min,
- ta->tm_sec,
- (ta->tm_gmtoff < 0) ? '-' : '+',
- abs(ta->tm_gmtoff / 3600),
- abs( ta->tm_gmtoff % 3600)
- );
-#else
- sprintf(tmp_buff, "%3s, %2d %3s %04d %02d:%02d:%02d %c%02d%02d",
- day_short_names[ta->tm_wday],
- ta->tm_mday,
- mon_short_names[ta->tm_mon],
- ta->tm_year + 1900,
- ta->tm_hour,
- ta->tm_min,
- ta->tm_sec,
- ((ta->tm_isdst ? timezone - 3600 : timezone) > 0) ? '-' : '+',
- abs((ta->tm_isdst ? timezone - 3600 : timezone) / 3600),
- abs((ta->tm_isdst ? timezone - 3600 : timezone) % 3600)
- );
-#endif
- strcat(return_value->value.str.val, tmp_buff);
- break;
- case 'W': /* ISO-8601 week number of year, weeks starting on Monday */
- wd = ta->tm_wday==0 ? 7 : ta->tm_wday;
- yd = ta->tm_yday + 1;
- fd = (7 + (wd - yd) % 7 ) % 7;
- wk = ( (yd + fd - 1) / 7 ) + 1;
- if (fd>3) {
- wk--;
- }
- sprintf(tmp_buff, "%d", wk); /* SAFE */
- strcat(return_value->value.str.val, tmp_buff);
- break;
-
- default:
- length = strlen(return_value->value.str.val);
- return_value->value.str.val[length] = (*format)->value.str.val[i];
- return_value->value.str.val[length + 1] = '\0';
- break;
- }
- }
- return_value->value.str.len = strlen(return_value->value.str.val);
- return_value->type = IS_STRING;
-}
-/* }}} */
-
-/* {{{ proto string date(string format [, int timestamp])
- Format a local time/date */
-PHP_FUNCTION(date)
-{
- php_date(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-/* }}} */
-
-/* {{{ proto string gmdate(string format [, int timestamp])
- Format a GMT/UTC date/time */
-PHP_FUNCTION(gmdate)
-{
- php_date(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
-}
-/* }}} */
-
-/* {{{ proto array localtime([int timestamp [, bool associative_array]])
- Returns the results of the C system call localtime as an associative array if the associative_array argument is set to 1 other wise it is a regular array */
-PHP_FUNCTION(localtime)
-{
- zval **timestamp_arg, **assoc_array_arg;
- struct tm *ta, tmbuf;
- time_t timestamp;
- int assoc_array = 0;
- int arg_count = ZEND_NUM_ARGS();
-
- if (arg_count < 0 || arg_count > 2 ||
- zend_get_parameters_ex(arg_count, &timestamp_arg, &assoc_array_arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- switch (arg_count) {
- case 0:
- timestamp = (long)time(NULL);
- break;
- case 1:
- convert_to_long_ex(timestamp_arg);
- timestamp = (*timestamp_arg)->value.lval;
- break;
- case 2:
- convert_to_long_ex(timestamp_arg);
- convert_to_long_ex(assoc_array_arg);
- timestamp = (*timestamp_arg)->value.lval;
- assoc_array = (*assoc_array_arg)->value.lval;
- break;
- }
- ta = php_localtime_r(&timestamp, &tmbuf);
- if (array_init(return_value) == FAILURE) {
- php_error(E_ERROR, "Cannot prepare return array from localtime");
- RETURN_FALSE;
- }
-
- if (assoc_array) {
- add_assoc_long(return_value, "tm_sec", ta->tm_sec);
- add_assoc_long(return_value, "tm_min", ta->tm_min);
- add_assoc_long(return_value, "tm_hour", ta->tm_hour);
- add_assoc_long(return_value, "tm_mday", ta->tm_mday);
- add_assoc_long(return_value, "tm_mon", ta->tm_mon);
- add_assoc_long(return_value, "tm_year", ta->tm_year);
- add_assoc_long(return_value, "tm_wday", ta->tm_wday);
- add_assoc_long(return_value, "tm_yday", ta->tm_yday);
- add_assoc_long(return_value, "tm_isdst", ta->tm_isdst);
- } else {
- add_next_index_long(return_value, ta->tm_sec);
- add_next_index_long(return_value, ta->tm_min);
- add_next_index_long(return_value, ta->tm_hour);
- add_next_index_long(return_value, ta->tm_mday);
- add_next_index_long(return_value, ta->tm_mon);
- add_next_index_long(return_value, ta->tm_year);
- add_next_index_long(return_value, ta->tm_wday);
- add_next_index_long(return_value, ta->tm_yday);
- add_next_index_long(return_value, ta->tm_isdst);
- }
-}
-/* }}} */
-
-/* {{{ proto array getdate([int timestamp])
- Get date/time information */
-PHP_FUNCTION(getdate)
-{
- pval **timestamp_arg;
- struct tm *ta, tmbuf;
- time_t timestamp;
-
- if (ZEND_NUM_ARGS() == 0) {
- timestamp = time(NULL);
- } else if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1,&timestamp_arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- } else {
- convert_to_long_ex(timestamp_arg);
- timestamp = (*timestamp_arg)->value.lval;
- }
-
- ta = php_localtime_r(&timestamp, &tmbuf);
- if (!ta) {
- php_error(E_WARNING, "Cannot perform date calculation");
- return;
- }
- if (array_init(return_value) == FAILURE) {
- php_error(E_ERROR, "Unable to initialize array");
- return;
- }
- add_assoc_long(return_value, "seconds", ta->tm_sec);
- add_assoc_long(return_value, "minutes", ta->tm_min);
- add_assoc_long(return_value, "hours", ta->tm_hour);
- add_assoc_long(return_value, "mday", ta->tm_mday);
- add_assoc_long(return_value, "wday", ta->tm_wday);
- add_assoc_long(return_value, "mon", ta->tm_mon + 1);
- add_assoc_long(return_value, "year", ta->tm_year + 1900);
- add_assoc_long(return_value, "yday", ta->tm_yday);
- add_assoc_string(return_value, "weekday", day_full_names[ta->tm_wday], 1);
- add_assoc_string(return_value, "month", mon_full_names[ta->tm_mon], 1);
- add_index_long(return_value, 0, timestamp);
-}
-/* }}} */
-
-/* {{{ php_std_date
- Return date string in standard format for http headers */
-char *php_std_date(time_t t)
-{
- struct tm *tm1, tmbuf;
- char *str;
- PLS_FETCH();
-
- tm1 = php_gmtime_r(&t, &tmbuf);
- str = emalloc(81);
- if (PG(y2k_compliance)) {
- snprintf(str, 80, "%s, %02d-%s-%04d %02d:%02d:%02d GMT",
- day_short_names[tm1->tm_wday],
- tm1->tm_mday,
- mon_short_names[tm1->tm_mon],
- tm1->tm_year+1900,
- tm1->tm_hour, tm1->tm_min, tm1->tm_sec);
- } else {
- snprintf(str, 80, "%s, %02d-%s-%02d %02d:%02d:%02d GMT",
- day_short_names[tm1->tm_wday],
- tm1->tm_mday,
- mon_short_names[tm1->tm_mon],
- ((tm1->tm_year)%100),
- tm1->tm_hour, tm1->tm_min, tm1->tm_sec);
- }
-
- str[79]=0;
- return (str);
-}
-/* }}} */
-
-/* {{{ proto bool checkdate(int month, int day, int year)
- Returns true(1) if it is a valid date in gregorian calendar */
-PHP_FUNCTION(checkdate)
-{
- pval **month, **day, **year;
- int m, d, y, res=0;
-
- if (ZEND_NUM_ARGS() != 3 ||
- zend_get_parameters_ex(3, &month, &day, &year) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if((*year)->type == IS_STRING) {
- res = is_numeric_string((*year)->value.str.val, (*year)->value.str.len, NULL, NULL);
- if(res!=IS_LONG && res !=IS_DOUBLE) {
- RETURN_FALSE;
- }
- }
- convert_to_long_ex(day);
- convert_to_long_ex(month);
- convert_to_long_ex(year);
- y = (*year)->value.lval;
- m = (*month)->value.lval;
- d = (*day)->value.lval;
-
- if (y < 1 || y > 32767) {
- RETURN_FALSE;
- }
- if (m < 1 || m > 12) {
- RETURN_FALSE;
- }
- if (d < 1 || d > phpday_tab[isleap(y)][m - 1]) {
- RETURN_FALSE;
- }
- RETURN_TRUE; /* True : This month,day,year arguments are valid */
-}
-/* }}} */
-
-#if HAVE_STRFTIME
-/* {{{ _php_strftime
- */
-void _php_strftime(INTERNAL_FUNCTION_PARAMETERS, int gm)
-{
- pval **format_arg, **timestamp_arg;
- char *format,*buf;
- time_t timestamp;
- struct tm *ta, tmbuf;
- int max_reallocs = 5;
- size_t buf_len=64, real_len;
-
- switch (ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1,&format_arg)==FAILURE) {
- RETURN_FALSE;
- }
- time(&timestamp);
- break;
- case 2:
- if (zend_get_parameters_ex(2, &format_arg,&timestamp_arg)==FAILURE) {
- RETURN_FALSE;
- }
- convert_to_long_ex(timestamp_arg);
- timestamp = (*timestamp_arg)->value.lval;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- convert_to_string_ex(format_arg);
- if ((*format_arg)->value.str.len==0) {
- RETURN_FALSE;
- }
- if (timestamp < 0) {
- RETURN_FALSE;
- }
- format = (*format_arg)->value.str.val;
- if (gm) {
- ta = php_gmtime_r(&timestamp, &tmbuf);
- } else {
- ta = php_localtime_r(&timestamp, &tmbuf);
- }
-
- buf = (char *) emalloc(buf_len);
- while ((real_len=strftime(buf,buf_len,format,ta))==buf_len || real_len==0) {
- buf_len *= 2;
- buf = (char *) erealloc(buf, buf_len);
- if(!--max_reallocs) break;
- }
-
- if(real_len && real_len != buf_len) {
- buf = (char *) erealloc(buf,real_len+1);
- RETURN_STRINGL(buf, real_len, 0);
- }
- efree(buf);
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto string strftime(string format [, int timestamp])
- Format a local time/date according to locale settings */
-PHP_FUNCTION(strftime)
-{
- _php_strftime(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-/* }}} */
-
-/* {{{ proto string gmstrftime(string format [, int timestamp])
- Format a GMT/UCT time/date according to locale settings */
-PHP_FUNCTION(gmstrftime)
-{
- _php_strftime(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
-}
-/* }}} */
-
-#endif
-
-/* {{{ proto int strtotime(string time, int now)
- Convert string representation of date and time to a timestamp */
-PHP_FUNCTION(strtotime)
-{
- zval **z_time, **z_now;
- int argc;
- time_t now;
-
- argc = ZEND_NUM_ARGS();
-
- if (argc < 1 || argc > 2 || zend_get_parameters_ex(argc, &z_time, &z_now)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(z_time);
- if (Z_STRLEN_PP(z_time) == 0)
- php_error (E_NOTICE, "strtotime() called with empty time parameter");
- if (argc == 2) {
- convert_to_long_ex(z_now);
- now = Z_LVAL_PP(z_now);
- RETURN_LONG(php_parse_date(Z_STRVAL_PP(z_time), &now));
- } else {
- RETURN_LONG(php_parse_date(Z_STRVAL_PP(z_time), NULL));
- }
-}
-/* }}} */
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/standard/datetime.h b/ext/standard/datetime.h
deleted file mode 100644
index daa3710306..0000000000
--- a/ext/standard/datetime.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef DATETIME_H
-#define DATETIME_H
-
-PHP_FUNCTION(time);
-PHP_FUNCTION(mktime);
-PHP_FUNCTION(gmmktime);
-PHP_FUNCTION(date);
-PHP_FUNCTION(gmdate);
-PHP_FUNCTION(localtime);
-PHP_FUNCTION(getdate);
-PHP_FUNCTION(checkdate);
-#if HAVE_STRFTIME
-PHP_FUNCTION(strftime);
-PHP_FUNCTION(gmstrftime);
-#endif
-PHP_FUNCTION(strtotime);
-
-extern char *php_std_date(time_t t);
-void php_mktime(INTERNAL_FUNCTION_PARAMETERS, int gm);
-#if HAVE_STRFTIME
-void _php_strftime(INTERNAL_FUNCTION_PARAMETERS, int gm);
-#endif
-
-#endif /* DATETIME_H */
diff --git a/ext/standard/dir.c b/ext/standard/dir.c
deleted file mode 100644
index ae6acdce5d..0000000000
--- a/ext/standard/dir.c
+++ /dev/null
@@ -1,373 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: |
- | PHP 4.0 patches by Thies C. Arntzen (thies@thieso.net) |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-/* {{{ includes/startup/misc */
-
-#include "php.h"
-#include "fopen_wrappers.h"
-
-#include "php_dir.h"
-
-#ifdef HAVE_DIRENT_H
-# include <dirent.h>
-#endif
-
-#if HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-
-#include <errno.h>
-
-#ifdef PHP_WIN32
-#include "win32/readdir.h"
-#endif
-
-typedef struct {
- int default_dir;
-} php_dir_globals;
-
-#ifdef ZTS
-#define DIRG(v) (dir_globals->v)
-#define DIRLS_FETCH() php_dir_globals *dir_globals = ts_resource(dir_globals_id)
-#define DIRLS_D php_dir_globals *dir_globals
-#define DIRLS_DC , DIRLS_D
-#define DIRLS_C dir_globals
-#define DIRLS_CC , DIRLS_C
-int dir_globals_id;
-#else
-#define DIRG(v) (dir_globals.v)
-#define DIRLS_FETCH()
-#define DIRLS_D
-#define DIRLS_DC
-#define DIRLS_C
-#define DIRLS_CC
-php_dir_globals dir_globals;
-#endif
-
-typedef struct {
- int id;
- DIR *dir;
-} php_dir;
-
-static int le_dirp;
-
-static zend_class_entry *dir_class_entry_ptr;
-
-#define FETCH_DIRP() \
- if (ZEND_NUM_ARGS() == 0) { \
- myself = getThis(); \
- if (myself) { \
- if (zend_hash_find(myself->value.obj.properties, "handle", sizeof("handle"), (void **)&tmp) == FAILURE) { \
- php_error(E_WARNING, "unable to find my handle property"); \
- RETURN_FALSE; \
- } \
- ZEND_FETCH_RESOURCE(dirp,php_dir *,tmp,-1, "Directory", le_dirp); \
- } else { \
- ZEND_FETCH_RESOURCE(dirp,php_dir *,0,DIRG(default_dir), "Directory", le_dirp); \
- } \
- } else if ((ZEND_NUM_ARGS() != 1) || zend_get_parameters_ex(1, &id) == FAILURE) { \
- WRONG_PARAM_COUNT; \
- } else { \
- ZEND_FETCH_RESOURCE(dirp,php_dir *,id,-1, "Directory", le_dirp); \
- }
-
-static zend_function_entry php_dir_class_functions[] = {
- PHP_FALIAS(close, closedir, NULL)
- PHP_FALIAS(rewind, rewinddir, NULL)
- PHP_STATIC_FE("read", php_if_readdir, NULL)
- {NULL, NULL, NULL}
-};
-
-
-static void php_set_default_dir(int id DIRLS_DC)
-{
- if (DIRG(default_dir)!=-1) {
- zend_list_delete(DIRG(default_dir));
- }
-
- if (id != -1) {
- zend_list_addref(id);
- }
-
- DIRG(default_dir) = id;
-}
-
-
-static void _dir_dtor(zend_rsrc_list_entry *rsrc)
-{
- php_dir *dirp = (php_dir *)rsrc->ptr;
- closedir(dirp->dir);
- efree(dirp);
-}
-
-PHP_RINIT_FUNCTION(dir)
-{
- DIRLS_FETCH();
-
- DIRG(default_dir) = -1;
- return SUCCESS;
-}
-
-PHP_MINIT_FUNCTION(dir)
-{
- static char tmpstr[2];
- zend_class_entry dir_class_entry;
-
- le_dirp = zend_register_list_destructors_ex(_dir_dtor, NULL, "dir", module_number);
-
- INIT_CLASS_ENTRY(dir_class_entry, "Directory", php_dir_class_functions);
- dir_class_entry_ptr = zend_register_internal_class(&dir_class_entry);
-
-#ifdef ZTS
- dir_globals_id = ts_allocate_id(sizeof(php_dir_globals), NULL, NULL);
-#endif
- tmpstr[0] = DEFAULT_SLASH;
- tmpstr[1] = '\0';
- REGISTER_STRING_CONSTANT("DIRECTORY_SEPARATOR", tmpstr, CONST_CS|CONST_PERSISTENT);
-
- return SUCCESS;
-}
-
-/* }}} */
-/* {{{ internal functions */
-
-static void _php_do_opendir(INTERNAL_FUNCTION_PARAMETERS, int createobject)
-{
- pval **arg;
- php_dir *dirp;
- DIRLS_FETCH();
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(arg);
-
- if (php_check_open_basedir((*arg)->value.str.val)) {
- RETURN_FALSE;
- }
-
- dirp = emalloc(sizeof(php_dir));
-
- dirp->dir = VCWD_OPENDIR((*arg)->value.str.val);
-
-#ifdef PHP_WIN32
- if (!dirp->dir || dirp->dir->finished) {
- if (dirp->dir) {
- closedir(dirp->dir);
- }
-#else
- if (!dirp->dir) {
-#endif
- efree(dirp);
- php_error(E_WARNING, "OpenDir: %s (errno %d)", strerror(errno), errno);
- RETURN_FALSE;
- }
-
- dirp->id = zend_list_insert(dirp,le_dirp);
-
- php_set_default_dir(dirp->id DIRLS_CC);
-
- if (createobject) {
- object_init_ex(return_value, dir_class_entry_ptr);
- add_property_stringl(return_value, "path", (*arg)->value.str.val, (*arg)->value.str.len, 1);
- add_property_resource(return_value, "handle", dirp->id);
- zend_list_addref(dirp->id);
- } else {
- RETURN_RESOURCE(dirp->id);
- }
-}
-
-/* }}} */
-/* {{{ proto int opendir(string path)
- Open a directory and return a dir_handle */
-
-PHP_FUNCTION(opendir)
-{
- _php_do_opendir(INTERNAL_FUNCTION_PARAM_PASSTHRU,0);
-}
-
-/* }}} */
-/* {{{ proto class dir(string directory)
- Directory class with properties, handle and class and methods read, rewind and close */
-
-PHP_FUNCTION(getdir)
-{
- _php_do_opendir(INTERNAL_FUNCTION_PARAM_PASSTHRU,1);
-}
-
-/* }}} */
-/* {{{ proto void closedir([int dir_handle])
- Close directory connection identified by the dir_handle */
-
-PHP_FUNCTION(closedir)
-{
- pval **id, **tmp, *myself;
- php_dir *dirp;
- DIRLS_FETCH();
-
- FETCH_DIRP();
-
- zend_list_delete(dirp->id);
-
- if (dirp->id == DIRG(default_dir)) {
- php_set_default_dir(-1 DIRLS_CC);
- }
-}
-
-/* }}} */
-
-#if defined(HAVE_CHROOT) && !defined(ZTS)
-/* {{{ proto int chroot(string directory)
- Change root directory */
-
-PHP_FUNCTION(chroot)
-{
- pval **arg;
- int ret;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(arg);
-
- ret = chroot((*arg)->value.str.val);
-
- if (ret != 0) {
- php_error(E_WARNING, "chroot: %s (errno %d)", strerror(errno), errno);
- RETURN_FALSE;
- }
-
- ret = chdir("/");
-
- if (ret != 0) {
- php_error(E_WARNING, "chdir: %s (errno %d)", strerror(errno), errno);
- RETURN_FALSE;
- }
-
- RETURN_TRUE;
-}
-
-/* }}} */
-#endif
-
-/* {{{ proto int chdir(string directory)
- Change the current directory */
-
-PHP_FUNCTION(chdir)
-{
- pval **arg;
- int ret;
- PLS_FETCH();
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(arg);
-
- if (PG(safe_mode) && !php_checkuid((*arg)->value.str.val, NULL, CHECKUID_ALLOW_ONLY_DIR)) {
- RETURN_FALSE;
- }
- ret = VCWD_CHDIR((*arg)->value.str.val);
-
- if (ret != 0) {
- php_error(E_WARNING, "ChDir: %s (errno %d)", strerror(errno), errno);
- RETURN_FALSE;
- }
-
- RETURN_TRUE;
-}
-
-/* }}} */
-/* {{{ proto string getcwd(void)
- Gets the current directory */
-
-PHP_FUNCTION(getcwd)
-{
- char path[MAXPATHLEN];
- char *ret=NULL;
-
- if (ZEND_NUM_ARGS() != 0) {
- WRONG_PARAM_COUNT;
- }
-
-#if HAVE_GETCWD
- ret = VCWD_GETCWD(path, MAXPATHLEN);
-#elif HAVE_GETWD
- ret = VCWD_GETWD(path);
-/*
- * #warning is not ANSI C
- * #else
- * #warning no proper getcwd support for your site
- */
-#endif
-
- if (ret) {
- RETURN_STRING(path,1);
- } else {
- RETURN_FALSE;
- }
-}
-
-/* }}} */
-/* {{{ proto void rewinddir([int dir_handle])
- Rewind dir_handle back to the start */
-
-PHP_FUNCTION(rewinddir)
-{
- pval **id, **tmp, *myself;
- php_dir *dirp;
- DIRLS_FETCH();
-
- FETCH_DIRP();
-
- rewinddir(dirp->dir);
-}
-/* }}} */
-/* {{{ proto string readdir([int dir_handle])
- Read directory entry from dir_handle */
-
-PHP_NAMED_FUNCTION(php_if_readdir)
-{
- pval **id, **tmp, *myself;
- php_dir *dirp;
- char entry[sizeof(struct dirent)+MAXPATHLEN];
- struct dirent *result = (struct dirent *)&entry; /* patch for libc5 readdir problems */
- DIRLS_FETCH();
-
- FETCH_DIRP();
-
- if (php_readdir_r(dirp->dir, (struct dirent *) entry, &result) == 0 && result) {
- RETURN_STRINGL(result->d_name, strlen(result->d_name), 1);
- }
- RETURN_FALSE;
-}
-
-/* }}} */
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/standard/dl.c b/ext/standard/dl.c
deleted file mode 100644
index 439fb889c7..0000000000
--- a/ext/standard/dl.c
+++ /dev/null
@@ -1,234 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Brian Schaffner <brian@tool.net> |
- | Shane Caraveo <shane@caraveo.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#include "php.h"
-#include "dl.h"
-#include "php_globals.h"
-#include "ext/standard/info.h"
-#include "SAPI.h"
-
-#ifndef PHP_WIN32
-#include "build-defs.h"
-#endif
-
-#ifdef HAVE_LIBDL
-#include <stdlib.h>
-#include <stdio.h>
-
-#if HAVE_STRING_H
-#include <string.h>
-#else
-#include <strings.h>
-#endif
-#ifdef PHP_WIN32
-#include "win32/param.h"
-#include "win32/winutil.h"
-#define GET_DL_ERROR() php_win_err()
-#else
-#include <sys/param.h>
-#define GET_DL_ERROR() dlerror()
-#endif
-
-#endif
-
-
-/* {{{ proto int dl(string extension_filename)
- Load a PHP extension at runtime */
-PHP_FUNCTION(dl)
-{
- pval **file;
- PLS_FETCH();
-
-#ifdef ZTS
- if (strcmp(sapi_module.name, "cgi")!=0) {
- php_error(E_ERROR, "dl() is not supported in multithreaded Web servers - use extension statements in your php.ini");
- }
-#endif
-
- /* obtain arguments */
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &file) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(file);
-
- if (!PG(enable_dl)) {
- php_error(E_ERROR, "Dynamically loaded extentions aren't enabled.");
- } else if (PG(safe_mode)) {
- php_error(E_ERROR, "Dynamically loaded extensions aren't allowed when running in SAFE MODE.");
- } else {
- php_dl(*file, MODULE_TEMPORARY, return_value);
- }
-}
-
-/* }}} */
-
-
-#ifdef HAVE_LIBDL
-
-#ifdef ZTS
-#define USING_ZTS 1
-#else
-#define USING_ZTS 0
-#endif
-
-/* {{{ php_dl
- */
-void php_dl(pval *file, int type, pval *return_value)
-{
- void *handle;
- char *libpath;
- zend_module_entry *module_entry,*tmp;
- zend_module_entry *(*get_module)(void);
- int error_type;
- char *extension_dir;
- PLS_FETCH();
- ELS_FETCH();
-
-
- if (type==MODULE_PERSISTENT) {
- /* Use the configuration hash directly, the INI mechanism is not yet initialized */
- if (cfg_get_string("extension_dir", &extension_dir)==FAILURE) {
- extension_dir = PHP_EXTENSION_DIR;
- }
- } else {
- extension_dir = PG(extension_dir);
- }
-
- if (type==MODULE_TEMPORARY) {
- error_type = E_WARNING;
- } else {
- error_type = E_CORE_WARNING;
- }
-
- if (extension_dir && extension_dir[0]){
- int extension_dir_len = strlen(extension_dir);
-
- libpath = emalloc(extension_dir_len+file->value.str.len+2);
-
- if (IS_SLASH(extension_dir[extension_dir_len-1])) {
- sprintf(libpath,"%s%s", extension_dir, file->value.str.val); /* SAFE */
- } else {
- sprintf(libpath,"%s/%s", extension_dir, file->value.str.val); /* SAFE */
- }
- } else {
- libpath = estrndup(file->value.str.val, file->value.str.len);
- }
-
- /* load dynamic symbol */
- handle = DL_LOAD(libpath);
- if (!handle) {
- php_error(error_type, "Unable to load dynamic library '%s' - %s", libpath, GET_DL_ERROR());
- efree(libpath);
- RETURN_FALSE;
- }
-
- efree(libpath);
-
-
- get_module = (zend_module_entry *(*)(void)) DL_FETCH_SYMBOL(handle, "get_module");
-
- /*
- * some OS prepend _ to symbol names while their dynamic linker
- * does not do that automatically. Thus we check manually for
- * _get_module.
- */
-
- if (!get_module)
- get_module = (zend_module_entry *(*)(void)) DL_FETCH_SYMBOL(handle, "_get_module");
-
- if (!get_module) {
- DL_UNLOAD(handle);
- php_error(error_type, "Invalid library (maybe not a PHP library) '%s' ", file->value.str.val);
- RETURN_FALSE;
- }
- module_entry = get_module();
- if ((module_entry->zend_debug != ZEND_DEBUG) || (module_entry->zts != USING_ZTS)
- || (module_entry->zend_api != ZEND_MODULE_API_NO)) {
- php_error(error_type,
- "%s: Unable to initialize module\n"
- "Module compiled with debug=%d, thread-safety=%d module API=%d\n"
- "PHP compiled with debug=%d, thread-safety=%d module API=%d\n"
- "These options need to match\n",
- module_entry->name, module_entry->zend_debug, module_entry->zts, module_entry->zend_api,
- ZEND_DEBUG, USING_ZTS, ZEND_MODULE_API_NO);
- DL_UNLOAD(handle);
- RETURN_FALSE;
- }
- module_entry->type = type;
- module_entry->module_number = zend_next_free_module();
- if (module_entry->module_startup_func) {
- if (module_entry->module_startup_func(type, module_entry->module_number ELS_CC)==FAILURE) {
- php_error(error_type, "%s: Unable to initialize module", module_entry->name);
- DL_UNLOAD(handle);
- RETURN_FALSE;
- }
- }
- zend_register_module(module_entry);
-
- if ((type == MODULE_TEMPORARY) && module_entry->request_startup_func) {
- if (module_entry->request_startup_func(type, module_entry->module_number ELS_CC)) {
- php_error(error_type, "%s: Unable to initialize module", module_entry->name);
- DL_UNLOAD(handle);
- RETURN_FALSE;
- }
- }
-
- /* update the .request_started property... */
- if (zend_hash_find(&module_registry, module_entry->name, strlen(module_entry->name)+1,(void **) &tmp)==FAILURE) {
- php_error(error_type,"%s: Loaded module got lost", module_entry->name);
- RETURN_FALSE;
- }
- tmp->handle = handle;
-
- RETURN_TRUE;
-}
-/* }}} */
-
-PHP_MINFO_FUNCTION(dl)
-{
- php_info_print_table_row(2, "Dynamic Library Support", "enabled");
-}
-
-#else
-
-void php_dl(pval *file, int type, pval *return_value)
-{
- php_error(E_WARNING,"Cannot dynamically load %s - dynamic modules are not supported", file->value.str.val);
- RETURN_FALSE;
-}
-
-PHP_MINFO_FUNCTION(dl)
-{
- PUTS("Dynamic Library support not available<br>.\n");
-}
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/standard/dl.h b/ext/standard/dl.h
deleted file mode 100644
index 0e881eaee2..0000000000
--- a/ext/standard/dl.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Brian Schaffner <brian@tool.net> |
- | Shane Caraveo <shane@caraveo.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef DL_H
-#define DL_H
-
-void php_dl(pval *file,int type,pval *return_value);
-
-
-/* dynamic loading functions */
-PHP_FUNCTION(dl);
-
-PHP_MINFO_FUNCTION(dl);
-
-#endif /* DL_H */
diff --git a/ext/standard/dns.c b/ext/standard/dns.c
deleted file mode 100644
index bf8fa2eb76..0000000000
--- a/ext/standard/dns.c
+++ /dev/null
@@ -1,337 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-/* {{{ includes
- */
-#include "php.h"
-#if HAVE_SYS_SOCKET_H
-#include <sys/socket.h>
-#endif
-#ifdef PHP_WIN32
-#if HAVE_LIBBIND
-#ifndef WINNT
-#define WINNT 1
-#endif
-/* located in www.php.net/extra/bindlib.zip */
-#if HAVE_ARPA_INET_H
-#include "arpa/inet.h"
-#endif
-#include "netdb.h"
-#if HAVE_ARPA_NAMESERV_H
-#include "arpa/nameser.h"
-#endif
-#if HAVE_RESOLV_H
-#include "resolv.h"
-#endif
-#endif
-#include <winsock.h>
-#else
-#include <netinet/in.h>
-#if HAVE_ARPA_INET_H
-#include <arpa/inet.h>
-#endif
-#include <netdb.h>
-#ifdef _OSD_POSIX
-#undef STATUS
-#undef T_UNSPEC
-#endif
-#if HAVE_ARPA_NAMESER_H
-#include <arpa/nameser.h>
-#endif
-#if HAVE_RESOLV_H
-#include <resolv.h>
-#endif
-#endif
-
-#include "dns.h"
-/* }}} */
-
-char *php_gethostbyaddr(char *ip);
-char *php_gethostbyname(char *name);
-
-/* {{{ proto string gethostbyaddr(string ip_address)
- Get the Internet host name corresponding to a given IP address */
-PHP_FUNCTION(gethostbyaddr)
-{
- pval **arg;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(arg);
-
- RETVAL_STRING(php_gethostbyaddr(Z_STRVAL_PP(arg)), 0);
-}
-/* }}} */
-
-/* {{{ php_gethostbyaddr
- */
-char *php_gethostbyaddr(char *ip)
-{
- struct in_addr addr;
- struct hostent *hp;
-
- addr.s_addr = inet_addr(ip);
- if (addr.s_addr == -1) {
-#if PHP_DEBUG
- php_error(E_WARNING, "address not in a.b.c.d form");
-#endif
- return estrdup(ip);
- }
- hp = gethostbyaddr((char *) &addr, sizeof(addr), AF_INET);
- if (!hp) {
-#if PHP_DEBUG
- php_error(E_WARNING, "Unable to resolve %s\n", ip);
-#endif
- return estrdup(ip);
- }
- return estrdup(hp->h_name);
-}
-/* }}} */
-
-/* {{{ proto string gethostbyname(string hostname)
- Get the IP address corresponding to a given Internet host name */
-PHP_FUNCTION(gethostbyname)
-{
- pval **arg;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(arg);
-
- RETVAL_STRING(php_gethostbyname(Z_STRVAL_PP(arg)), 0);
-}
-/* }}} */
-
-/* {{{ proto array gethostbynamel(string hostname)
- Return a list of IP addresses that a given hostname resolves to. */
-PHP_FUNCTION(gethostbynamel)
-{
- pval **arg;
- struct hostent *hp;
- struct in_addr in;
- int i;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(arg);
-
- if (array_init(return_value) == FAILURE) {
- RETURN_FALSE;
- }
-
- hp = gethostbyname(Z_STRVAL_PP(arg));
- if (hp == NULL || hp->h_addr_list == NULL) {
-#if PHP_DEBUG
- php_error(E_WARNING, "Unable to resolve %s\n", Z_STRVAL_PP(arg));
-#endif
- return;
- }
-
- for (i = 0 ; hp->h_addr_list[i] != 0 ; i++) {
- in = *(struct in_addr *) hp->h_addr_list[i];
- add_next_index_string(return_value, inet_ntoa(in), 1);
- }
-
- return;
-}
-/* }}} */
-
-/* {{{ php_gethostbyname
- */
-char *php_gethostbyname(char *name)
-{
- struct hostent *hp;
- struct in_addr in;
-
- hp = gethostbyname(name);
- if (!hp || !hp->h_addr_list) {
-#if PHP_DEBUG
- php_error(E_WARNING, "Unable to resolve %s\n", name);
-#endif
- return estrdup(name);
- }
- memcpy(&in.s_addr, *(hp->h_addr_list), sizeof(in.s_addr));
- return estrdup(inet_ntoa(in));
-}
-/* }}} */
-
-#if HAVE_RES_SEARCH && !(defined(__BEOS__)||defined(PHP_WIN32))
-
-/* {{{ proto int checkdnsrr(string host [, string type])
- Check DNS records corresponding to a given Internet host name or IP address */
-PHP_FUNCTION(checkdnsrr)
-{
- pval **arg1,**arg2;
- int type,i;
-#ifndef MAXPACKET
-#define MAXPACKET 8192 /* max packet size used internally by BIND */
-#endif
- u_char ans[MAXPACKET];
-
- switch (ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- type = T_MX;
- convert_to_string_ex(arg1);
- break;
- case 2:
- if (zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(arg1);
- convert_to_string_ex(arg2);
- if ( !strcasecmp("A",Z_STRVAL_PP(arg2)) ) type = T_A;
- else if ( !strcasecmp("NS",Z_STRVAL_PP(arg2)) ) type = T_NS;
- else if ( !strcasecmp("MX",Z_STRVAL_PP(arg2)) ) type = T_MX;
- else if ( !strcasecmp("PTR",Z_STRVAL_PP(arg2)) ) type = T_PTR;
- else if ( !strcasecmp("ANY",Z_STRVAL_PP(arg2)) ) type = T_ANY;
- else if ( !strcasecmp("SOA",Z_STRVAL_PP(arg2)) ) type = T_SOA;
- else if ( !strcasecmp("CNAME",Z_STRVAL_PP(arg2)) ) type = T_CNAME;
- else {
- php_error(E_WARNING,"Type '%s' not supported",Z_STRVAL_PP(arg2));
- RETURN_FALSE;
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- }
- i = res_search(Z_STRVAL_PP(arg1),C_IN,type,ans,sizeof(ans));
- if ( i < 0 ) {
- RETURN_FALSE;
- }
- RETURN_TRUE;
-}
-/* }}} */
-
-#ifndef HFIXEDSZ
-#define HFIXEDSZ 12 /* fixed data in header <arpa/nameser.h> */
-#endif /* HFIXEDSZ */
-
-#ifndef QFIXEDSZ
-#define QFIXEDSZ 4 /* fixed data in query <arpa/nameser.h> */
-#endif /* QFIXEDSZ */
-
-#ifndef MAXHOSTNAMELEN
-#define MAXHOSTNAMELEN 256
-#endif /* MAXHOSTNAMELEN */
-
-/* {{{ proto int getmxrr(string hostname, array mxhosts [, array weight])
- Get MX records corresponding to a given Internet host name */
-PHP_FUNCTION(getmxrr)
-{
- pval *host, *mx_list, *weight_list;
- int need_weight = 0;
- int count,qdc;
- u_short type,weight;
- u_char ans[MAXPACKET];
- char buf[MAXHOSTNAMELEN];
- HEADER *hp;
- u_char *cp,*end;
- int i;
-
- switch(ZEND_NUM_ARGS()) {
- case 2:
- if (zend_get_parameters(ht, 2, &host, &mx_list) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- if (!ParameterPassedByReference(ht, 2)) {
- php_error(E_WARNING, "Array to be filled with values must be passed by reference.");
- RETURN_FALSE;
- }
- break;
- case 3:
- if (zend_get_parameters(ht, 3, &host, &mx_list, &weight_list) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- if (!ParameterPassedByReference(ht, 2) || !ParameterPassedByReference(ht, 3)) {
- php_error(E_WARNING, "Array to be filled with values must be passed by reference.");
- RETURN_FALSE;
- }
- need_weight = 1;
- pval_destructor(weight_list); /* start with clean array */
- if ( array_init(weight_list) == FAILURE ) {
- RETURN_FALSE;
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string( host );
- pval_destructor(mx_list); /* start with clean array */
- if ( array_init(mx_list) == FAILURE ) {
- RETURN_FALSE;
- }
-
- /* Go! */
- i = res_search(Z_STRVAL_P(host),C_IN,T_MX,(u_char *)&ans,sizeof(ans));
- if ( i < 0 ) {
- RETURN_FALSE;
- }
- if ( i > sizeof(ans) ) i = sizeof(ans);
- hp = (HEADER *)&ans;
- cp = (u_char *)&ans + HFIXEDSZ;
- end = (u_char *)&ans +i;
- for ( qdc = ntohs((unsigned short)hp->qdcount); qdc--; cp += i + QFIXEDSZ) {
- if ( (i = dn_skipname(cp,end)) < 0 ) {
- RETURN_FALSE;
- }
- }
- count = ntohs((unsigned short)hp->ancount);
- while ( --count >= 0 && cp < end ) {
- if ( (i = dn_skipname(cp,end)) < 0 ) {
- RETURN_FALSE;
- }
- cp += i;
- GETSHORT(type,cp);
- cp += INT16SZ + INT32SZ;
- GETSHORT(i,cp);
- if ( type != T_MX ) {
- cp += i;
- continue;
- }
- GETSHORT(weight,cp);
- if ( (i = dn_expand(ans,end,cp,buf,sizeof(buf)-1)) < 0 ) {
- RETURN_FALSE;
- }
- cp += i;
- add_next_index_string(mx_list, buf, 1);
- if ( need_weight ) {
- add_next_index_long(weight_list, weight);
- }
- }
- RETURN_TRUE;
-}
-/* }}} */
-
-#endif
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/standard/dns.h b/ext/standard/dns.h
deleted file mode 100644
index cb0a4eeb57..0000000000
--- a/ext/standard/dns.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: |
- | |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef DNS_H
-#define DNS_H
-
-PHP_FUNCTION(gethostbyaddr);
-PHP_FUNCTION(gethostbyname);
-PHP_FUNCTION(gethostbynamel);
-
-#if HAVE_RES_SEARCH && !(defined(__BEOS__)||defined(PHP_WIN32))
-PHP_FUNCTION(checkdnsrr);
-PHP_FUNCTION(getmxrr);
-#endif
-
-#ifndef INT16SZ
-#define INT16SZ 2
-#endif
-
-#ifndef INT32SZ
-#define INT32SZ 4
-#endif
-
-#endif /* DNS_H */
diff --git a/ext/standard/exec.c b/ext/standard/exec.c
deleted file mode 100644
index 5dd828de26..0000000000
--- a/ext/standard/exec.c
+++ /dev/null
@@ -1,494 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Rasmus Lerdorf |
- +----------------------------------------------------------------------+
- */
-/* $Id$ */
-
-#include <stdio.h>
-#include "php.h"
-#include <ctype.h>
-#include "php_string.h"
-#include "safe_mode.h"
-#include "ext/standard/head.h"
-#include "ext/standard/file.h"
-#include "exec.h"
-#include "php_globals.h"
-#include "SAPI.h"
-
-#if HAVE_SYS_WAIT_H
-#include <sys/wait.h>
-#endif
-#if HAVE_SIGNAL_H
-#include <signal.h>
-#endif
-
-/* {{{ php_Exec
- * If type==0, only last line of output is returned (exec)
- * If type==1, all lines will be printed and last lined returned (system)
- * If type==2, all lines will be saved to given array (exec with &$array)
- * If type==3, output will be printed binary, no lines will be saved or returned (passthru)
- *
- */
-int php_Exec(int type, char *cmd, pval *array, pval *return_value)
-{
- FILE *fp;
- char *buf, *tmp=NULL;
- int buflen = 0;
- int t, l, output=1;
- int overflow_limit, lcmd, ldir;
- int rsrc_id;
- char *b, *c, *d=NULL;
-#if PHP_SIGCHILD
- void (*sig_handler)();
-#endif
- PLS_FETCH();
- FLS_FETCH();
-
- buf = (char*) emalloc(EXEC_INPUT_BUF);
- if (!buf) {
- php_error(E_WARNING, "Unable to emalloc %d bytes for exec buffer", EXEC_INPUT_BUF);
- return -1;
- }
- buflen = EXEC_INPUT_BUF;
-
- if (PG(safe_mode)) {
- lcmd = strlen(cmd);
- ldir = strlen(PG(safe_mode_exec_dir));
- l = lcmd + ldir + 2;
- overflow_limit = l;
- c = strchr(cmd, ' ');
- if (c) *c = '\0';
- if (strstr(cmd, "..")) {
- php_error(E_WARNING, "No '..' components allowed in path");
- efree(buf);
- return -1;
- }
- d = emalloc(l);
- strcpy(d, PG(safe_mode_exec_dir));
- overflow_limit -= ldir;
- b = strrchr(cmd, PHP_DIR_SEPARATOR);
- if (b) {
- strcat(d, b);
- overflow_limit -= strlen(b);
- } else {
- strcat(d, "/");
- strcat(d, cmd);
- overflow_limit-=(strlen(cmd)+1);
- }
- if (c) {
- *c = ' ';
- strncat(d, c, overflow_limit);
- }
- tmp = php_escape_shell_cmd(d);
- efree(d);
- d = tmp;
-#if PHP_SIGCHILD
- sig_handler = signal (SIGCHLD, SIG_DFL);
-#endif
-#ifdef PHP_WIN32
- fp = VCWD_POPEN(d, "rb");
-#else
- fp = VCWD_POPEN(d, "r");
-#endif
- if (!fp) {
- php_error(E_WARNING, "Unable to fork [%s]", d);
- efree(d);
- efree(buf);
-#if PHP_SIGCHILD
- signal (SIGCHLD, sig_handler);
-#endif
- return -1;
- }
- } else { /* not safe_mode */
-#if PHP_SIGCHILD
- sig_handler = signal (SIGCHLD, SIG_DFL);
-#endif
-#ifdef PHP_WIN32
- fp = VCWD_POPEN(cmd, "rb");
-#else
- fp = VCWD_POPEN(cmd, "r");
-#endif
- if (!fp) {
- php_error(E_WARNING, "Unable to fork [%s]", cmd);
- efree(buf);
-#if PHP_SIGCHILD
- signal (SIGCHLD, sig_handler);
-#endif
- return -1;
- }
- }
- buf[0] = '\0';
- if (type==2) {
- if (Z_TYPE_P(array) != IS_ARRAY) {
- pval_destructor(array);
- array_init(array);
- }
- }
-
- /* we register the resource so that case of an aborted connection the
- * fd gets pclosed
- */
-
- rsrc_id = ZEND_REGISTER_RESOURCE(NULL, fp, php_file_le_popen());
-
- if (type != 3) {
- l=0;
- while ( !feof(fp) || l != 0 ) {
- l = 0;
- /* Read a line or fill the buffer, whichever comes first */
- do {
- if ( buflen <= (l+1) ) {
- buf = erealloc(buf, buflen + EXEC_INPUT_BUF);
- if ( buf == NULL ) {
- php_error(E_WARNING, "Unable to erealloc %d bytes for exec buffer",
- buflen + EXEC_INPUT_BUF);
-#if PHP_SIGCHILD
- signal (SIGCHLD, sig_handler);
-#endif
- return -1;
- }
- buflen += EXEC_INPUT_BUF;
- }
-
- if ( fgets(&(buf[l]), buflen - l, fp) == NULL ) {
- /* eof */
- break;
- }
- l += strlen(&(buf[l]));
- } while ( (l > 0) && (buf[l-1] != '\n') );
-
- if ( feof(fp) && (l == 0) ) {
- break;
- }
-
-
- if (type == 1) {
- if (output) PUTS(buf);
- sapi_flush();
- }
- else if (type == 2) {
- /* strip trailing whitespaces */
- l = strlen(buf);
- t = l;
- while (l-- && isspace((int)buf[l]));
- if (l < t) {
- buf[l + 1] = '\0';
- }
- add_next_index_string(array, buf, 1);
- }
- }
-
- /* strip trailing spaces */
- l = strlen(buf);
- t = l;
- while (l && isspace((int)buf[l - 1])) {
- l--;
- }
- if (l < t) buf[l] = '\0';
-
- /* Return last line from the shell command */
- if (PG(magic_quotes_runtime)) {
- int len;
-
- tmp = php_addslashes(buf, 0, &len, 0);
- RETVAL_STRINGL(tmp,len,0);
- } else {
- RETVAL_STRINGL(buf,l,1);
- }
- } else {
- int b, i;
-
- while ((b = fread(buf, 1, buflen, fp)) > 0) {
- for (i = 0; i < b; i++)
- if (output) (void)PUTC(buf[i]);
- }
- }
-
- /* the zend_list_delete will pclose our popen'ed process */
- zend_list_delete(rsrc_id);
-
-#if HAVE_SYS_WAIT_H
- if (WIFEXITED(FG(pclose_ret))) {
- FG(pclose_ret) = WEXITSTATUS(FG(pclose_ret));
- }
-#endif
-#if PHP_SIGCHILD
- signal (SIGCHLD, sig_handler);
-#endif
- if (d) {
- efree(d);
- }
- efree(buf);
- return FG(pclose_ret);
-}
-/* }}} */
-
-/* {{{ proto string exec(string command [, array output [, int return_value]])
- Execute an external program */
-PHP_FUNCTION(exec)
-{
- pval **arg1, **arg2, **arg3;
- int arg_count = ZEND_NUM_ARGS();
- int ret;
-
- if (arg_count > 3 || zend_get_parameters_ex(arg_count, &arg1,&arg2, &arg3) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- switch (arg_count) {
- case 1:
- ret = php_Exec(0, Z_STRVAL_PP(arg1), NULL,return_value);
- break;
- case 2:
- if (!ParameterPassedByReference(ht,2)) {
- php_error(E_WARNING,"Array argument to exec() not passed by reference");
- }
- ret = php_Exec(2, Z_STRVAL_PP(arg1),*arg2,return_value);
- break;
- case 3:
- if (!ParameterPassedByReference(ht,2)) {
- php_error(E_WARNING,"Array argument to exec() not passed by reference");
- }
- if (!ParameterPassedByReference(ht,3)) {
- php_error(E_WARNING,"return_status argument to exec() not passed by reference");
- }
- ret = php_Exec(2,Z_STRVAL_PP(arg1),*arg2,return_value);
- Z_TYPE_PP(arg3) = IS_LONG;
- Z_LVAL_PP(arg3)=ret;
- break;
- }
-}
-
-/* }}} */
-
-/* {{{ proto int system(string command [, int return_value])
- Execute an external program and display output */
-PHP_FUNCTION(system)
-{
- pval **arg1, **arg2;
- int arg_count = ZEND_NUM_ARGS();
- int ret;
-
- if (arg_count > 2 || zend_get_parameters_ex(arg_count, &arg1,&arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- switch (arg_count) {
- case 1:
- ret = php_Exec(1, Z_STRVAL_PP(arg1), NULL,return_value);
- break;
- case 2:
- if (!ParameterPassedByReference(ht,2)) {
- php_error(E_WARNING,"return_status argument to system() not passed by reference");
- }
- ret = php_Exec(1, Z_STRVAL_PP(arg1), NULL,return_value);
- Z_TYPE_PP(arg2) = IS_LONG;
- Z_LVAL_PP(arg2)=ret;
- break;
- }
-}
-/* }}} */
-
-/* {{{ proto void passthru(string command [, int return_value])
- Execute an external program and display raw output */
-PHP_FUNCTION(passthru)
-{
- pval **arg1, **arg2;
- int arg_count = ZEND_NUM_ARGS();
- int ret;
-
- if (arg_count > 2 || zend_get_parameters_ex(arg_count, &arg1,&arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- switch (arg_count) {
- case 1:
- ret = php_Exec(3, Z_STRVAL_PP(arg1), NULL,return_value);
- break;
- case 2:
- if (!ParameterPassedByReference(ht,2)) {
- php_error(E_WARNING,"return_status argument to system() not passed by reference");
- }
- ret = php_Exec(3, Z_STRVAL_PP(arg1), NULL,return_value);
- Z_TYPE_PP(arg2) = IS_LONG;
- Z_LVAL_PP(arg2)=ret;
- break;
- }
-}
-/* }}} */
-
-/* {{{ php_get_index
- */
-static int php_get_index(char *s, char c)
-{
- register int x;
-
- for (x = 0; s[x]; x++)
- if (s[x] == c)
- return x;
-
- return -1;
-}
-/* }}} */
-
-/* {{{ php_escape_shell_cmd
- Escape all chars that could possibly be used to
- break out of a shell command
-
- This function emalloc's a string and returns the pointer.
- Remember to efree it when done with it.
-
- *NOT* safe for binary strings
-*/
-char * php_escape_shell_cmd(char *str) {
- register int x, y, l;
- char *cmd;
-
- l = strlen(str);
- cmd = emalloc(2 * l + 1);
- strcpy(cmd, str);
- for (x = 0; cmd[x]; x++) {
- if (php_get_index("#&;`'\"|*?~<>^()[]{}$\\\x0A\xFF", cmd[x]) != -1) {
- for (y = l + 1; y > x; y--)
- cmd[y] = cmd[y - 1];
- l++; /* length has been increased */
- cmd[x] = '\\';
- x++; /* skip the character */
- }
- }
- return cmd;
-}
-/* }}} */
-
-/* {{{ php_escape_shell_arg
- */
-char * php_escape_shell_arg(char *str) {
- register int x, y, l;
- char *cmd;
-
- l = strlen(str);
- cmd = emalloc(4 * l + 3);
- cmd[0] = '\'';
- strcpy(cmd+1, str);
- l++;
-
- for (x = 1; cmd[x]; x++) {
- if (cmd[x] == '\'') {
- for (y = l + 3; y > x+1; y--) {
- cmd[y] = cmd[y - 3];
- }
- cmd[++x] = '\\';
- cmd[++x] = '\'';
- cmd[++x] = '\'';
- l+=3; /* length was increased by 3 */
- }
- }
- cmd[l++] = '\'';
- cmd[l] = '\0';
- return cmd;
-}
-/* }}} */
-
-/* {{{ proto string escapeshellcmd(string command)
- Escape shell metacharacters */
-PHP_FUNCTION(escapeshellcmd)
-{
- pval **arg1;
- char *cmd = NULL;
-
- if (zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(arg1);
- if (Z_STRLEN_PP(arg1)) {
- cmd = php_escape_shell_cmd(Z_STRVAL_PP(arg1));
- RETVAL_STRING(cmd, 1);
- efree(cmd);
- }
-}
-/* }}} */
-
-/* {{{ proto string escapeshellarg(string arg)
- Quote and escape an argument for use in a shell command */
-PHP_FUNCTION(escapeshellarg)
-{
- pval **arg1;
- char *cmd = NULL;
-
- if (zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(arg1);
- if (Z_STRLEN_PP(arg1)) {
- cmd = php_escape_shell_arg(Z_STRVAL_PP(arg1));
- RETVAL_STRING(cmd, 1);
- efree(cmd);
- }
-}
-/* }}} */
-
-/* {{{ proto string shell_exec(string cmd)
- Use pclose() for FILE* that has been opened via popen() */
-PHP_FUNCTION(shell_exec)
-{
- FILE *in;
- int readbytes,total_readbytes=0,allocated_space;
- pval **cmd;
- char *ret;
- PLS_FETCH();
-
- if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1,&cmd)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if (PG(safe_mode)) {
- php_error(E_WARNING,"Cannot execute using backquotes in safe mode");
- RETURN_FALSE;
- }
-
- convert_to_string_ex(cmd);
-#ifdef PHP_WIN32
- if ((in=VCWD_POPEN(Z_STRVAL_PP(cmd),"rt"))==NULL) {
-#else
- if ((in=VCWD_POPEN(Z_STRVAL_PP(cmd),"r"))==NULL) {
-#endif
- php_error(E_WARNING,"Unable to execute '%s'",Z_STRVAL_PP(cmd));
- }
- allocated_space = EXEC_INPUT_BUF;
- ret = (char *) emalloc(allocated_space);
- while (1) {
- readbytes = fread(ret+total_readbytes,1,EXEC_INPUT_BUF,in);
- if (readbytes<=0) {
- break;
- }
- total_readbytes += readbytes;
- allocated_space = total_readbytes+EXEC_INPUT_BUF;
- ret = (char *) erealloc(ret,allocated_space);
- }
- pclose(in);
-
- RETVAL_STRINGL(ret, total_readbytes, 0);
- Z_STRVAL_P(return_value)[total_readbytes] = '\0';
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/standard/exec.h b/ext/standard/exec.h
deleted file mode 100644
index fd92e65c3e..0000000000
--- a/ext/standard/exec.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef EXEC_H
-#define EXEC_H
-
-PHP_FUNCTION(system);
-PHP_FUNCTION(exec);
-PHP_FUNCTION(escapeshellcmd);
-PHP_FUNCTION(escapeshellarg);
-PHP_FUNCTION(passthru);
-PHP_FUNCTION(shell_exec);
-
-char *php_escape_shell_cmd(char *);
-int php_Exec(int type, char *cmd, pval *array, pval *return_value);
-
-#endif /* EXEC_H */
diff --git a/ext/standard/file.c b/ext/standard/file.c
deleted file mode 100644
index 8c31f827dc..0000000000
--- a/ext/standard/file.c
+++ /dev/null
@@ -1,2464 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
- | Stig Bakken <ssb@fast.no> |
- | Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- | PHP 4.0 patches by Thies C. Arntzen (thies@thieso.net) |
- | PHP 4.1 streams by Wez Furlong (wez@thebrainroom.com) |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-/* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */
-
-/* {{{ includes */
-
-#include "php.h"
-#include "php_globals.h"
-#include "ext/standard/flock_compat.h"
-#include "ext/standard/exec.h"
-#include "ext/standard/php_filestat.h"
-#include "php_open_temporary_file.h"
-#include "ext/standard/basic_functions.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#ifdef PHP_WIN32
-#include <windows.h>
-#include <winsock.h>
-#define O_RDONLY _O_RDONLY
-#include "win32/param.h"
-#include "win32/winutil.h"
-#else
-#include <sys/param.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <netdb.h>
-#if HAVE_ARPA_INET_H
-#include <arpa/inet.h>
-#endif
-#endif
-#include "ext/standard/head.h"
-#include "safe_mode.h"
-#include "php_string.h"
-#include "file.h"
-#if HAVE_PWD_H
-#ifdef PHP_WIN32
-#include "win32/pwd.h"
-#else
-#include <pwd.h>
-#endif
-#endif
-#ifdef HAVE_SYS_TIME_H
-#include <sys/time.h>
-#endif
-#include "fsock.h"
-#include "fopen_wrappers.h"
-#include "php_globals.h"
-
-#ifdef HAVE_SYS_FILE_H
-#include <sys/file.h>
-#endif
-
-#if MISSING_FCLOSE_DECL
-extern int fclose(FILE *);
-#endif
-
-#ifdef HAVE_SYS_MMAN_H
-#include <sys/mman.h>
-#endif
-
-#ifndef MAP_FAILED
-#define MAP_FAILED ((void *) -1)
-#endif
-
-#include "scanf.h"
-#include "zend_API.h"
-
-#ifdef ZTS
-int file_globals_id;
-#else
-php_file_globals file_globals;
-#endif
-
-/* }}} */
-/* {{{ ZTS-stuff / Globals / Prototypes */
-
-/* sharing globals is *evil* */
-static int le_fopen, le_popen, le_socket;
-/* sorry folks; including this even if you haven't enabled streams
- saves a zillion ifdefs */
-static int le_stream = FAILURE;
-
-
-/* }}} */
-/* {{{ Module-Stuff */
-
-static void _file_popen_dtor(zend_rsrc_list_entry *rsrc)
-{
- FILE *pipe = (FILE *)rsrc->ptr;
- FLS_FETCH();
-
- FG(pclose_ret) = pclose(pipe);
-}
-
-
-static void _file_socket_dtor(zend_rsrc_list_entry *rsrc)
-{
- int *sock = (int *)rsrc->ptr;
- SOCK_FCLOSE(*sock);
-#if HAVE_SHUTDOWN
- shutdown(*sock, 0);
-#endif
- efree(sock);
-}
-
-#if HAVE_PHP_STREAM
-static void _file_stream_dtor(zend_rsrc_list_entry * rsrc)
-{
- php_stream * stream = (php_stream*)rsrc->ptr;
- php_stream_close(stream);
-}
-#endif
-
-PHPAPI int php_file_le_stream(void)
-{
- return le_stream;
-}
-
-static void _file_fopen_dtor(zend_rsrc_list_entry *rsrc)
-{
- FILE *fp = (FILE *)rsrc->ptr;
- fclose(fp);
-}
-
-
-PHPAPI int php_file_le_fopen(void) /* XXX doe we really want this???? */
-{
- return le_fopen;
-}
-
-PHPAPI int php_file_le_popen(void) /* XXX you may not like this, but I need it. -- KK */
-{
- return le_popen;
-}
-
-
-PHPAPI int php_file_le_socket(void) /* XXX doe we really want this???? */
-{
- return le_socket;
-}
-
-
-static void file_globals_ctor(FLS_D)
-{
- zend_hash_init(&FG(ht_fsock_keys), 0, NULL, NULL, 1);
- zend_hash_init(&FG(ht_fsock_socks), 0, NULL, (void (*)(void *))php_msock_destroy, 1);
- FG(def_chunk_size) = PHP_FSOCK_CHUNK_SIZE;
- FG(phpsockbuf) = NULL;
- FG(fgetss_state) = 0;
- FG(pclose_ret) = 0;
-}
-
-
-static void file_globals_dtor(FLS_D)
-{
- zend_hash_destroy(&FG(ht_fsock_socks));
- zend_hash_destroy(&FG(ht_fsock_keys));
- php_cleanup_sockbuf(1 FLS_CC);
-}
-
-
-PHP_MINIT_FUNCTION(file)
-{
- le_fopen = zend_register_list_destructors_ex(_file_fopen_dtor, NULL, "file", module_number);
- le_popen = zend_register_list_destructors_ex(_file_popen_dtor, NULL, "pipe", module_number);
- le_socket = zend_register_list_destructors_ex(_file_socket_dtor, NULL, "socket", module_number);
-
-#if HAVE_PHP_STREAM
- le_stream = zend_register_list_destructors_ex(_file_stream_dtor, NULL, "stream", module_number);
-#endif
-
-#ifdef ZTS
- file_globals_id = ts_allocate_id(sizeof(php_file_globals), (ts_allocate_ctor) file_globals_ctor, (ts_allocate_dtor) file_globals_dtor);
-#else
- file_globals_ctor(FLS_C);
-#endif
-
- REGISTER_LONG_CONSTANT("SEEK_SET", SEEK_SET, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SEEK_CUR", SEEK_CUR, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("SEEK_END", SEEK_END, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("LOCK_SH", 1, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("LOCK_EX", 2, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("LOCK_UN", 3, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("LOCK_NB", 4, CONST_CS | CONST_PERSISTENT);
-
- return SUCCESS;
-}
-
-/* }}} */
-
-PHP_MSHUTDOWN_FUNCTION(file)
-{
-#ifndef ZTS
- FLS_FETCH();
-
- file_globals_dtor(FLS_C);
-#endif
- return SUCCESS;
-}
-
-
-
-/* {{{ proto bool flock(int fp, int operation [, int wouldblock])
- Portable file locking */
-
-static int flock_values[] = { LOCK_SH, LOCK_EX, LOCK_UN };
-
-PHP_FUNCTION(flock)
-{
- pval **arg1, **arg2, **arg3;
- int type, fd, act, ret, arg_count = ARG_COUNT(ht);
- void *what;
-
- if (arg_count > 3 || zend_get_parameters_ex(arg_count, &arg1, &arg2, &arg3) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- what = zend_fetch_resource(arg1, -1, "File-Handle", &type, 4, le_fopen, le_popen, le_socket, le_stream);
- ZEND_VERIFY_RESOURCE(what);
-
-#if HAVE_PHP_STREAM
- if (type == le_stream) {
- if (php_stream_cast((php_stream*)what, PHP_STREAM_AS_FD, (void*)&fd, 1) == FAILURE) {
- RETURN_FALSE;
- }
- } else
-#endif
- if (type == le_socket) {
- fd = *(int *) what;
- } else {
- fd = fileno((FILE*) what);
- }
-
- convert_to_long_ex(arg2);
-
- act = (*arg2)->value.lval & 3;
- if (act < 1 || act > 3) {
- php_error(E_WARNING, "Illegal operation argument");
- RETURN_FALSE;
- }
-
- /* flock_values contains all possible actions
- if (arg2 & 4) we won't block on the lock */
- act = flock_values[act - 1] | ((*arg2)->value.lval & 4 ? LOCK_NB : 0);
- if ((ret=flock(fd, act)) == -1) {
- RETURN_FALSE;
- }
- if(ret==-1 && errno==EWOULDBLOCK && arg_count==3) {
- (*arg3)->type = IS_LONG;
- (*arg3)->value.lval=1;
- }
- RETURN_TRUE;
-}
-
-/* }}} */
-
-#define PHP_META_UNSAFE ".\\+*?[^]$() "
-
-/* {{{ proto array get_meta_tags(string filename [, int use_include_path])
- Extracts all meta tag content attributes from a file and returns an array */
-
-PHP_FUNCTION(get_meta_tags)
-{
- pval **filename, **arg2;
- FILE *fp;
- int use_include_path = 0;
- int issock=0, socketd=0;
- int in_tag=0, in_meta_tag=0, looking_for_val=0, done=0, ulc=0;
- int num_parts=0, lc=0;
- int token_len=0;
- char *token_data=NULL, *name=NULL, *value=NULL, *temp=NULL;
- php_meta_tags_token tok, tok_last;
- PLS_FETCH();
-
- /* check args */
- switch (ARG_COUNT(ht)) {
- case 1:
- if (zend_get_parameters_ex(1,&filename) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- break;
- case 2:
- if (zend_get_parameters_ex(2,&filename,&arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(arg2);
- use_include_path = (*arg2)->value.lval;
- break;
- default:
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(filename);
-
- fp = php_fopen_wrapper((*filename)->value.str.val,"rb", use_include_path|ENFORCE_SAFE_MODE, &issock, &socketd, NULL);
- if (!fp && !socketd) {
- if (issock != BAD_URL) {
- char *tmp = estrndup(Z_STRVAL_PP(filename), Z_STRLEN_PP(filename));
- php_strip_url_passwd(tmp);
- php_error(E_WARNING,"get_meta_tags(\"%s\") - %s", tmp, strerror(errno));
- efree(tmp);
- }
- RETURN_FALSE;
- }
-
- if (array_init(return_value)==FAILURE) {
- if (issock) {
- SOCK_FCLOSE(socketd);
- } else {
- fclose(fp);
- }
- RETURN_FALSE;
- }
-
- tok_last = TOK_EOF;
-
- while (!done && (tok = php_next_meta_token(fp,socketd,issock,&ulc,&lc,&token_data,&token_len)) != TOK_EOF) {
- if (tok == TOK_ID) {
- if (tok_last == TOK_OPENTAG) {
- in_meta_tag = !strcasecmp("meta",token_data);
- } else if (tok_last == TOK_SLASH && in_tag) {
- if (strcasecmp("head",token_data) == 0) {
- /* We are done here! */
- done = 1;
- }
- } else if (tok_last == TOK_EQUAL && looking_for_val) {
-
- if (!num_parts) {
- /* This is a single word attribute */
- temp = name = estrndup(token_data,token_len);
-
- while (temp && *temp) {
- if (strchr(PHP_META_UNSAFE, *temp)) {
- *temp = '_';
- }
- temp++;
- }
- num_parts++;
- } else {
- if (PG(magic_quotes_runtime)) {
- value = php_addslashes(token_data,0,&token_len,0);
- } else {
- value = estrndup(token_data,token_len);
- }
-
- /* Insert the value into the array */
- add_assoc_string(return_value, name, value, 0);
- num_parts = 0;
- }
- looking_for_val = 0;
- } else {
- if (in_meta_tag) {
- if (strcasecmp("name",token_data) == 0 || strcasecmp("content",token_data) == 0) {
- looking_for_val = 1;
- } else {
- looking_for_val = 0;
- }
- }
- }
- } else if (tok == TOK_STRING && tok_last == TOK_EQUAL && looking_for_val) {
- if (!num_parts) {
- /* First, get the name value and store it */
- temp = name = estrndup(token_data,token_len);
- while (temp && *temp) {
- if (strchr(PHP_META_UNSAFE, *temp)) {
- *temp = '_';
- }
- temp++;
- }
- num_parts++;
- } else {
- /* Then get the value value and store it, quoting if neccessary */
- if (PG(magic_quotes_runtime)) {
- value = php_addslashes(token_data,0,&token_len,0);
- } else {
- value = estrndup(token_data,token_len);
- }
-
- /* Insert the value into the array */
- add_assoc_string(return_value, name, value, 0);
- num_parts = 0;
- }
- looking_for_val = 0;
- } else if (tok == TOK_OPENTAG) {
- if (looking_for_val) {
- looking_for_val = 0;
- }
- in_tag = 1;
- } else if (tok == TOK_CLOSETAG) {
- /* We never made it to the value, free the name */
- if (num_parts) {
- efree(name);
- }
- /* Reset all of our flags */
- in_tag = in_meta_tag = looking_for_val = num_parts = 0;
- }
-
- tok_last = tok;
-
- if (token_data)
- efree(token_data);
-
- token_data = NULL;
- }
-
- if (issock) {
- SOCK_FCLOSE(socketd);
- } else {
- fclose(fp);
- }
-}
-
-/* }}} */
-/* {{{ proto array file(string filename [, int use_include_path])
- Read entire file into an array */
-
-#define PHP_FILE_BUF_SIZE 80
-
-PHP_FUNCTION(file)
-{
- pval **filename, **arg2;
- FILE *fp;
- char *slashed, *target_buf;
- register int i=0;
- int use_include_path = 0;
- int issock=0, socketd=0;
- int target_len, len;
- zend_bool reached_eof=0;
- PLS_FETCH();
-
- /* check args */
- switch (ARG_COUNT(ht)) {
- case 1:
- if (zend_get_parameters_ex(1,&filename) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- break;
- case 2:
- if (zend_get_parameters_ex(2,&filename,&arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(arg2);
- use_include_path = (*arg2)->value.lval;
- break;
- default:
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(filename);
-
- fp = php_fopen_wrapper((*filename)->value.str.val,"rb", use_include_path|ENFORCE_SAFE_MODE, &issock, &socketd, NULL);
- if (!fp && !socketd) {
- if (issock != BAD_URL) {
- char *tmp = estrndup(Z_STRVAL_PP(filename), Z_STRLEN_PP(filename));
- php_strip_url_passwd(tmp);
- php_error(E_WARNING,"file(\"%s\") - %s", tmp, strerror(errno));
- efree(tmp);
- }
- RETURN_FALSE;
- }
-
- /* Initialize return array */
- if (array_init(return_value) == FAILURE) {
- RETURN_FALSE;
- }
-
- /* Now loop through the file and do the magic quotes thing if needed */
- target_len = 0;
- target_buf = NULL;
- while (1) {
- if (!target_buf) {
- target_buf = (char *) emalloc(PHP_FILE_BUF_SIZE+1);
- target_buf[PHP_FILE_BUF_SIZE] = 0; /* avoid overflows */
- } else {
- target_buf = (char *) erealloc(target_buf, target_len+PHP_FILE_BUF_SIZE+1);
- target_buf[target_len+PHP_FILE_BUF_SIZE] = 0; /* avoid overflows */
- }
- if (FP_FGETS(target_buf+target_len, PHP_FILE_BUF_SIZE, socketd, fp, issock)==NULL) {
- if (target_len==0) {
- efree(target_buf);
- break;
- } else {
- reached_eof = 1;
- }
- }
- if (!reached_eof) {
- target_len += strlen(target_buf+target_len);
- if (target_buf[target_len-1]!='\n') {
- continue;
- }
- }
- if (PG(magic_quotes_runtime)) {
- slashed = php_addslashes(target_buf, target_len, &len, 1); /* 1 = free source string */
- add_index_stringl(return_value, i++, slashed, len, 0);
- } else {
- target_buf = erealloc(target_buf, target_len+1); /* do we really want to do that? */
- add_index_stringl(return_value, i++, target_buf, target_len, 0);
- }
- if (reached_eof) {
- break;
- }
- target_buf = NULL;
- target_len = 0;
- }
- if (issock) {
- SOCK_FCLOSE(socketd);
- } else {
- fclose(fp);
- }
-}
-
-
-/* }}} */
-/* {{{ proto string tempnam(string dir, string prefix)
- Create a unique filename in a directory */
-
-PHP_FUNCTION(tempnam)
-{
- pval **arg1, **arg2;
- char *d;
- char *opened_path;
- char p[64];
- FILE *fp;
-
- if (ARG_COUNT(ht) != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(arg1);
- convert_to_string_ex(arg2);
- d = estrndup(Z_STRVAL_PP(arg1), Z_STRLEN_PP(arg1));
- strlcpy(p, Z_STRVAL_PP(arg2), sizeof(p));
-
- if ((fp = php_open_temporary_file(d, p, &opened_path))) {
- fclose(fp);
- RETVAL_STRING(opened_path, 0);
- } else {
- RETVAL_FALSE;
- }
- efree(d);
-}
-
-/* }}} */
-/* {{{ proto int tmpfile(void)
- Create a temporary file that will be deleted automatically after use */
-PHP_NAMED_FUNCTION(php_if_tmpfile)
-{
- FILE *fp;
- if (ARG_COUNT(ht) != 0) {
- WRONG_PARAM_COUNT;
- }
- fp = tmpfile();
- if (fp == NULL) {
- php_error(E_WARNING, "tmpfile: %s", strerror(errno));
- RETURN_FALSE;
- }
- ZEND_REGISTER_RESOURCE(return_value, fp, le_fopen);
-}
-/* }}} */
-
-#if HAVE_PHP_STREAM
-/* {{{ PHP_FUNCTION
- */
-PHP_FUNCTION(fopenstream)
-{
- zval ** zfilename, ** zmode;
- php_stream * stream;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &zfilename, &zmode) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(zfilename);
- convert_to_string_ex(zmode);
-
- stream = php_stream_fopen(Z_STRVAL_PP(zfilename), Z_STRVAL_PP(zmode));
-
- if (stream == NULL) {
- zend_error(E_WARNING, "%s(): unable to open %s: %s", get_active_function_name(), Z_STRVAL_PP(zfilename), strerror(errno));
- RETURN_FALSE;
- }
- ZEND_REGISTER_RESOURCE(return_value, stream, le_stream);
-}
-/* }}} */
-#endif
-
-/* {{{ proto int fopen(string filename, string mode [, int use_include_path])
- Open a file or a URL and return a file pointer */
-
-PHP_NAMED_FUNCTION(php_if_fopen)
-{
- pval **arg1, **arg2, **arg3;
- FILE *fp;
- char *p;
- int *sock;
- int use_include_path = 0;
- int issock=0, socketd=0;
- FLS_FETCH();
-
- switch(ARG_COUNT(ht)) {
- case 2:
- if (zend_get_parameters_ex(2,&arg1,&arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- break;
- case 3:
- if (zend_get_parameters_ex(3,&arg1,&arg2,&arg3) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(arg3);
- use_include_path = (*arg3)->value.lval;
- break;
- default:
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(arg1);
- convert_to_string_ex(arg2);
- p = estrndup((*arg2)->value.str.val,(*arg2)->value.str.len);
-
- /*
- * We need a better way of returning error messages from
- * php_fopen_wrapper().
- */
- fp = php_fopen_wrapper((*arg1)->value.str.val, p, use_include_path|ENFORCE_SAFE_MODE, &issock, &socketd, NULL);
- if (!fp && !socketd) {
- if (issock != BAD_URL) {
- char *tmp = estrndup(Z_STRVAL_PP(arg1), Z_STRLEN_PP(arg1));
- php_strip_url_passwd(tmp);
- php_error(E_WARNING,"fopen(\"%s\",\"%s\") - %s", tmp, p, strerror(errno));
- efree(tmp);
- }
- efree(p);
- RETURN_FALSE;
- }
-
- efree(p);
- FG(fgetss_state)=0;
-
- if (issock) {
- sock=emalloc(sizeof(int));
- *sock=socketd;
- ZEND_REGISTER_RESOURCE(return_value,sock,le_socket);
- } else {
- ZEND_REGISTER_RESOURCE(return_value,fp,le_fopen);
- }
-}
-
-/* }}} */
-/* {{{ proto int fclose(int fp)
- Close an open file pointer */
-
-PHP_FUNCTION(fclose)
-{
- pval **arg1;
- int type;
- void *what;
-
- if (ARG_COUNT(ht) != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- what = zend_fetch_resource(arg1, -1, "File-Handle", &type, 3, le_fopen, le_socket, le_stream);
- ZEND_VERIFY_RESOURCE(what);
-
- zend_list_delete((*arg1)->value.lval);
- RETURN_TRUE;
-}
-
-/* }}} */
-/* {{{ proto int popen(string command, string mode)
- Execute a command and open either a read or a write pipe to it */
-
-PHP_FUNCTION(popen)
-{
- pval **arg1, **arg2;
- FILE *fp;
- char *p,*tmp = NULL;
- char *b, buf[1024];
- PLS_FETCH();
-
- if (ARG_COUNT(ht) != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(arg1);
- convert_to_string_ex(arg2);
- p = estrndup((*arg2)->value.str.val,(*arg2)->value.str.len);
- if (PG(safe_mode)){
- b = strchr((*arg1)->value.str.val,' ');
- if (!b) {
- b = strrchr((*arg1)->value.str.val,'/');
- } else {
- char *c;
- c = (*arg1)->value.str.val;
- while((*b!='/')&&(b!=c)) {
- b--;
- }
- if (b==c) {
- b=NULL;
- }
- }
- if (b) {
- snprintf(buf,sizeof(buf),"%s%s",PG(safe_mode_exec_dir),b);
- } else {
- snprintf(buf,sizeof(buf),"%s/%s",PG(safe_mode_exec_dir),(*arg1)->value.str.val);
- }
-
- tmp = php_escape_shell_cmd(buf);
- fp = VCWD_POPEN(tmp,p);
- efree(tmp);
-
- if (!fp) {
- php_error(E_WARNING,"popen(\"%s\",\"%s\") - %s",buf,p,strerror(errno));
- RETURN_FALSE;
- }
- } else {
- fp = VCWD_POPEN((*arg1)->value.str.val, p);
- if (!fp) {
- php_error(E_WARNING,"popen(\"%s\",\"%s\") - %s",(*arg1)->value.str.val,p,strerror(errno));
- efree(p);
- RETURN_FALSE;
- }
- }
- efree(p);
-
- ZEND_REGISTER_RESOURCE(return_value,fp,le_popen);
-}
-
-/* }}} */
-/* {{{ proto int pclose(int fp)
- Close a file pointer opened by popen() */
-
-PHP_FUNCTION(pclose)
-{
- pval **arg1;
- void *what;
- FLS_FETCH();
-
- if (ARG_COUNT(ht) != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- what = zend_fetch_resource(arg1,-1,"File-Handle",NULL,1,le_popen);
- ZEND_VERIFY_RESOURCE(what);
-
- zend_list_delete((*arg1)->value.lval);
- RETURN_LONG(FG(pclose_ret));
-}
-
-/* }}} */
-/* {{{ proto int feof(int fp)
- Test for end-of-file on a file pointer */
-
-PHP_FUNCTION(feof)
-{
- pval **arg1;
- int type;
- int issock=0;
- int socketd=0;
- void *what;
-
- if (ARG_COUNT(ht) != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- what = zend_fetch_resource(arg1, -1, "File-Handle", &type, 4, le_fopen, le_popen, le_socket, le_stream);
- ZEND_VERIFY_RESOURCE(what);
-
- if (type == le_socket) {
- issock=1;
- socketd=*(int *) what;
- }
-
-#if HAVE_PHP_STREAM
- if (type == le_stream) {
- if (php_stream_eof((php_stream*)what))
- {
- RETURN_TRUE;
- }
- RETURN_FALSE;
- }
- else
-#endif
- {
- if (FP_FEOF(socketd, (FILE*)what, issock)) {
- RETURN_TRUE;
- } else {
- RETURN_FALSE;
- }
- }
-}
-/* }}} */
-
-
-/* {{{ proto int set_socket_blocking(int socket_descriptor, int mode)
- Set blocking/non-blocking mode on a socket */
-PHPAPI int php_set_sock_blocking(int socketd, int block)
-{
- int ret = SUCCESS;
- int flags;
- int myflag = 0;
-
-#ifdef PHP_WIN32
- /* with ioctlsocket, a non-zero sets nonblocking, a zero sets blocking */
- flags = !block;
- if (ioctlsocket(socketd,FIONBIO,&flags)==SOCKET_ERROR){
- php_error(E_WARNING,"%s",WSAGetLastError());
- ret = FALSE;
- }
-#else
- flags = fcntl(socketd, F_GETFL);
-#ifdef O_NONBLOCK
- myflag = O_NONBLOCK; /* POSIX version */
-#elif defined(O_NDELAY)
- myflag = O_NDELAY; /* old non-POSIX version */
-#endif
- if (!block) {
- flags |= myflag;
- } else {
- flags &= ~myflag;
- }
- fcntl(socketd, F_SETFL, flags);
-#endif
- return ret;
-}
-
-PHP_FUNCTION(socket_set_blocking)
-{
- pval **arg1, **arg2;
- int block, type;
- int socketd = 0;
- void *what;
-
- if (ARG_COUNT(ht) != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- what = zend_fetch_resource(arg1, -1, "File-Handle", &type, 2, le_socket, le_stream);
- ZEND_VERIFY_RESOURCE(what);
-
- convert_to_long_ex(arg2);
- block = (*arg2)->value.lval;
-
- if (type == le_socket) {
- socketd = *(int*)what;
- }
-#if HAVE_PHP_STREAM
- else if (type == le_stream) {
- if (php_stream_cast((php_stream*)what, PHP_STREAM_AS_SOCKETD, (void*)&socketd, 1) == FAILURE) {
- RETURN_FALSE;
- }
- }
-#endif
- if (php_set_sock_blocking(socketd, block) == FAILURE)
- RETURN_FALSE;
-
- php_sockset_blocking(socketd, block == 0 ? 0 : 1);
-
- RETURN_TRUE;
-}
-
-/* }}} */
-
-PHP_FUNCTION(set_socket_blocking)
-{
- php_error(E_NOTICE, "set_socket_blocking() is deprecated, use socket_set_blocking() instead");
- PHP_FN(socket_set_blocking)(INTERNAL_FUNCTION_PARAM_PASSTHRU);
-}
-
-/* {{{ proto bool socket_set_timeout(int socket_descriptor, int seconds, int microseconds)
- Set timeout on socket read to seconds + microseonds */
-PHP_FUNCTION(socket_set_timeout)
-{
-#if HAVE_SYS_TIME_H
- zval **socket, **seconds, **microseconds;
- int type;
- void *what;
- int socketd = 0;
- struct timeval t;
-
- if (ZEND_NUM_ARGS() < 2 || ZEND_NUM_ARGS() > 3 ||
- zend_get_parameters_ex(ZEND_NUM_ARGS(), &socket, &seconds, &microseconds)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
- /* XXX: add stream support --Wez. */
- what = zend_fetch_resource(socket, -1, "File-Handle", &type, 1, le_socket);
- ZEND_VERIFY_RESOURCE(what);
- socketd = *(int *)what;
-
- convert_to_long_ex(seconds);
- t.tv_sec = (*seconds)->value.lval;
-
- if (ZEND_NUM_ARGS() == 3) {
- convert_to_long_ex(microseconds);
- t.tv_usec = (*microseconds)->value.lval % 1000000;
- t.tv_sec += (*microseconds)->value.lval / 1000000;
- }
- else
- t.tv_usec = 0;
-
- php_sockset_timeout(socketd, &t);
- RETURN_TRUE;
-#endif /* HAVE_SYS_TIME_H */
-}
-
-/* }}} */
-
-
-/* {{{ proto array socket_get_status(resource socket_descriptor)
- Return an array describing socket status */
-PHP_FUNCTION(socket_get_status)
-{
- zval **socket;
- int type;
- void *what;
- int socketd = 0;
- struct php_sockbuf *sock;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(ZEND_NUM_ARGS(), &socket) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- /* XXX: add stream support --Wez. */
-
- what = zend_fetch_resource(socket, -1, "File-Handle", &type, 1, le_socket);
- ZEND_VERIFY_RESOURCE(what);
- socketd = *(int *)what;
- sock = php_get_socket(socketd);
-
- array_init(return_value);
-
- add_assoc_bool(return_value, "timed_out", sock->timeout_event);
- add_assoc_bool(return_value, "blocked", sock->is_blocked);
- add_assoc_bool(return_value, "eof", sock->eof);
- add_assoc_long(return_value, "unread_bytes", sock->writepos - sock->readpos);
-}
-/* }}} */
-
-
-/* {{{ proto string fgets(int fp, int length)
- Get a line from file pointer */
-
-PHP_FUNCTION(fgets)
-{
- pval **arg1, **arg2;
- int len, type;
- char *buf;
- int issock=0;
- int socketd=0;
- void *what;
- PLS_FETCH();
-
- if (ARG_COUNT(ht) != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- what = zend_fetch_resource(arg1, -1, "File-Handle", &type, 4, le_fopen, le_popen, le_socket, le_stream);
- ZEND_VERIFY_RESOURCE(what);
-
- convert_to_long_ex(arg2);
- len = (*arg2)->value.lval;
-
- if (len < 0) {
- php_error(E_WARNING, "length parameter to fgets() may not be negative");
- RETURN_FALSE;
- }
-
- if (type == le_socket) {
- issock=1;
- socketd=*(int*)what;
- }
-
- buf = emalloc(sizeof(char) * (len + 1));
- /* needed because recv doesnt put a null at the end*/
- memset(buf,0,len+1);
-
-#if HAVE_PHP_STREAM
- if (type == le_stream) {
- if (php_stream_gets((php_stream*)what, buf, len) == NULL)
- goto exit_failed;
- }
- else
-#endif
- {
- if (type == le_socket) {
- issock=1;
- socketd=*(int*)what;
- }
-#ifdef HAVE_FLUSHIO
- if (type == le_fopen) {
- fseek((FILE*)what, 0, SEEK_CUR);
- }
-#endif
- if (FP_FGETS(buf, len, socketd, (FILE*)what, issock) == NULL)
- goto exit_failed;
- }
-
- if (PG(magic_quotes_runtime)) {
- return_value->value.str.val = php_addslashes(buf,0,&return_value->value.str.len,1);
- } else {
- return_value->value.str.val = buf;
- return_value->value.str.len = strlen(return_value->value.str.val);
- /* resize buffer if it's much larger than the result */
- if(return_value->value.str.len < len/2) {
- return_value->value.str.val = erealloc(buf,return_value->value.str.len+1);
- }
- }
- return_value->type = IS_STRING;
- return;
-
-exit_failed:
- RETVAL_FALSE;
- efree(buf);
-}
-
-/* }}} */
-/* {{{ proto string fgetc(int fp)
- Get a character from file pointer */
-
-PHP_FUNCTION(fgetc) {
- pval **arg1;
- int type;
- char *buf;
- int issock=0;
- int socketd=0;
- void *what;
- int result;
-
- if (ARG_COUNT(ht) != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- what = zend_fetch_resource(arg1, -1, "File-Handle", &type, 4, le_fopen, le_popen, le_socket, le_stream);
- ZEND_VERIFY_RESOURCE(what);
-
- if (type == le_socket) {
- issock=1;
- socketd=*(int*)what;
- }
-
-#ifdef HAVE_FLUSHIO
- if (type == le_fopen) {
- fseek((FILE*)what, 0, SEEK_CUR);
- }
-#endif
- buf = emalloc(sizeof(int));
-
-#if HAVE_PHP_STREAM
- if (type == le_stream) {
- result = php_stream_getc((php_stream*)what);
- }
- else
-#endif
- result = FP_FGETC(socketd, (FILE*)what, issock);
-
-
- if (result == EOF) {
- efree(buf);
- RETVAL_FALSE;
- } else {
- buf[0]=result;
- buf[1]='\0';
- return_value->value.str.val = buf;
- return_value->value.str.len = 1;
- return_value->type = IS_STRING;
- }
-}
-
-/* }}} */
-
-/* {{{ proto string fgetss(int fp, int length [, string allowable_tags])
- Get a line from file pointer and strip HTML tags */
-
-PHP_FUNCTION(fgetss)
-{
- pval **fd, **bytes, **allow=NULL;
- int len, type;
- char *buf;
- int issock=0;
- int socketd=0;
- void *what;
- char *allowed_tags=NULL;
- int allowed_tags_len=0;
- FLS_FETCH();
-
- switch(ARG_COUNT(ht)) {
- case 2:
- if (zend_get_parameters_ex(2, &fd, &bytes) == FAILURE) {
- RETURN_FALSE;
- }
- break;
- case 3:
- if (zend_get_parameters_ex(3, &fd, &bytes, &allow) == FAILURE) {
- RETURN_FALSE;
- }
- convert_to_string_ex(allow);
- allowed_tags = (*allow)->value.str.val;
- allowed_tags_len = (*allow)->value.str.len;
- break;
- default:
- WRONG_PARAM_COUNT;
- /* NOTREACHED */
- break;
- }
-
- what = zend_fetch_resource(fd, -1, "File-Handle", &type, 4, le_fopen, le_popen, le_socket, le_stream);
- ZEND_VERIFY_RESOURCE(what);
-
- if (type == le_socket) {
- issock=1;
- socketd=*(int*)what;
- }
-
- convert_to_long_ex(bytes);
- len = (*bytes)->value.lval;
- if (len < 0) {
- php_error(E_WARNING, "length parameter to fgetss() may not be negative");
- RETURN_FALSE;
- }
-
- buf = emalloc(sizeof(char) * (len + 1));
- /*needed because recv doesnt set null char at end*/
- memset(buf, 0, len + 1);
-
-#if HAVE_PHP_STREAM
- if (type == le_stream) {
- if (php_stream_gets((php_stream*)what, buf, len) == NULL) {
- efree(buf);
- RETURN_FALSE;
- }
- }
- else
-#endif
- if (FP_FGETS(buf, len, socketd, (FILE*)what, issock) == NULL) {
- efree(buf);
- RETURN_FALSE;
- }
-
- /* strlen() can be used here since we are doing it on the return of an fgets() anyway */
- php_strip_tags(buf, strlen(buf), FG(fgetss_state), allowed_tags, allowed_tags_len);
-
- RETURN_STRING(buf, 0);
-}
-
-/* }}} */
-/* {{{ proto mixed fscanf(string str, string format [, string ...])
- Implements a mostly ANSI compatible fscanf() */
-PHP_FUNCTION(fscanf)
-{
- int result;
- pval **file_handle, **format_string;
- int len, type;
- char *buf;
- int issock=0;
- int socketd=0;
- void *what;
-
- zval ***args;
- int argCount;
-
- argCount = ZEND_NUM_ARGS();
- if (argCount < 2) {
- WRONG_PARAM_COUNT;
- }
- args = (zval ***)emalloc(argCount * sizeof(zval **));
- if (!args || (zend_get_parameters_array_ex(argCount,args) == FAILURE)) {
- efree( args );
- WRONG_PARAM_COUNT;
- }
-
- file_handle = args[0];
- format_string = args[1];
-
- what = zend_fetch_resource(file_handle, -1, "File-Handle", &type, 4, le_fopen, le_popen, le_socket, le_stream);
-
- /*
- * we can't do a ZEND_VERIFY_RESOURCE(what), otherwise we end up
- * with a leak if we have an invalid filehandle. This needs changing
- * if the code behind ZEND_VERIFY_RESOURCE changed. - cc
- */
- if (!what) {
- efree(args);
- RETURN_FALSE;
- }
-
- len = SCAN_MAX_FSCANF_BUFSIZE;
-
- if (type == le_socket) {
- issock=1;
- socketd=*(int*)what;
- }
- buf = emalloc(sizeof(char) * (len + 1));
- /* needed because recv doesnt put a null at the end*/
- memset(buf,0,len+1);
-
-#if HAVE_PHP_STREAM
- if (type == le_stream) {
- if (php_stream_gets((php_stream*)what, buf, len) == NULL) {
- efree(buf);
- RETURN_FALSE;
- }
- }
- else
-#endif
-
- if (FP_FGETS(buf, len, socketd, (FILE*)what, issock) == NULL) {
- efree(buf);
- RETURN_FALSE;
- }
-
- convert_to_string_ex( format_string );
- result = php_sscanf_internal( buf,(*format_string)->value.str.val,
- argCount,args, 2,&return_value);
- efree(args);
- efree(buf);
- if (SCAN_ERROR_WRONG_PARAM_COUNT == result) {
- WRONG_PARAM_COUNT
- }
-
-
-}
-/* }}} */
-
-/* {{{ proto int fwrite(int fp, string str [, int length])
- Binary-safe file write */
-
-PHP_FUNCTION(fwrite)
-{
- pval **arg1, **arg2, **arg3=NULL;
- int ret,type;
- int num_bytes;
- int issock=0;
- int socketd=0;
- void *what;
- PLS_FETCH();
-
- switch (ARG_COUNT(ht)) {
- case 2:
- if (zend_get_parameters_ex(2, &arg1, &arg2)==FAILURE) {
- RETURN_FALSE;
- }
- convert_to_string_ex(arg2);
- num_bytes = (*arg2)->value.str.len;
- break;
- case 3:
- if (zend_get_parameters_ex(3, &arg1, &arg2, &arg3)==FAILURE) {
- RETURN_FALSE;
- }
- convert_to_string_ex(arg2);
- convert_to_long_ex(arg3);
- num_bytes = MIN((*arg3)->value.lval, (*arg2)->value.str.len);
- break;
- default:
- WRONG_PARAM_COUNT;
- /* NOTREACHED */
- break;
- }
-
- what = zend_fetch_resource(arg1, -1, "File-Handle", &type, 4, le_fopen,
- le_popen, le_socket, le_stream);
- ZEND_VERIFY_RESOURCE(what);
-
- if (type == le_socket) {
- issock=1;
- socketd=*(int*)what;
- }
-
- if (!arg3 && PG(magic_quotes_runtime)) {
- zval_copy_ctor(*arg2);
- php_stripslashes((*arg2)->value.str.val,&num_bytes);
- }
-
-#if HAVE_PHP_STREAM
- if (type == le_stream) {
- ret = php_stream_write((php_stream*)what, Z_STRVAL_PP(arg2), num_bytes);
- }
- else
-#endif
-
- if (issock){
- ret = SOCK_WRITEL((*arg2)->value.str.val,num_bytes,socketd);
- } else {
-#ifdef HAVE_FLUSHIO
- if (type == le_fopen) {
- fseek((FILE*)what, 0, SEEK_CUR);
- }
-#endif
- ret = fwrite((*arg2)->value.str.val,1,num_bytes,(FILE*)what);
- }
- RETURN_LONG(ret);
-}
-
-/* }}} */
-/* {{{ proto int fflush(int fp)
- Flushes output */
-
-PHP_FUNCTION(fflush)
-{
- pval **arg1;
- int ret,type;
- int issock=0;
- int socketd=0;
- void *what;
-
- if (ARG_COUNT(ht) != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- what = zend_fetch_resource(arg1,-1,"File-Handle",&type,4,le_fopen,le_popen,le_socket, le_stream);
- ZEND_VERIFY_RESOURCE(what);
-
-#if HAVE_PHP_STREAM
- if (type == le_stream) {
- ret = php_stream_flush((php_stream*)what);
- if (ret) {
- RETURN_FALSE;
- }
- RETURN_TRUE;
- }
-#endif
-
- if (type == le_socket) {
- issock=1;
- socketd=*(int*)what;
- }
-
- if (issock){
- ret = fsync(socketd);
- } else {
- ret = fflush((FILE*)what);
- }
-
- if (ret) {
- RETURN_FALSE;
- } else {
- RETURN_TRUE;
- }
-}
-
-/* }}} */
-/* {{{ proto int set_file_buffer(int fp, int buffer)
- Set file write buffer */
-
-PHP_FUNCTION(set_file_buffer)
-{
- pval **arg1, **arg2;
- int ret,type,buff;
- void *what;
-
- switch (ARG_COUNT(ht)) {
- case 2:
- if (zend_get_parameters_ex(2, &arg1, &arg2)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- /* NOTREACHED */
- break;
- }
-
- /* XXX: add stream support --Wez. */
-
- what = zend_fetch_resource(arg1,-1,"File-Handle",&type,2,le_fopen,le_popen);
- ZEND_VERIFY_RESOURCE(what);
-
- convert_to_long_ex(arg2);
- buff = (*arg2)->value.lval;
-
- /* if buff is 0 then set to non-buffered */
- if (buff == 0){
- ret = setvbuf((FILE*)what, NULL, _IONBF, 0);
- } else {
- ret = setvbuf((FILE*)what, NULL, _IOFBF, buff);
- }
-
- RETURN_LONG(ret);
-}
-
-/* }}} */
-/* {{{ proto int rewind(int fp)
- Rewind the position of a file pointer */
-
-PHP_FUNCTION(rewind)
-{
- pval **arg1;
- void *what;
-
- if (ARG_COUNT(ht) != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- /* XXX: add stream support --Wez. */
-
- what = zend_fetch_resource(arg1,-1,"File-Handle",NULL,2,le_fopen,le_popen);
- ZEND_VERIFY_RESOURCE(what);
-
- rewind((FILE*) what);
- RETURN_TRUE;
-}
-
-/* }}} */
-/* {{{ proto int ftell(int fp)
- Get file pointer's read/write position */
-
-PHP_FUNCTION(ftell)
-{
- pval **arg1;
- void *what;
- long ret;
-
- if (ARG_COUNT(ht) != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- /* XXX: add stream support --Wez. */
-
- what = zend_fetch_resource(arg1,-1,"File-Handle",NULL,2,le_fopen,le_popen);
- ZEND_VERIFY_RESOURCE(what);
-
- ret = ftell((FILE*) what);
- if(ret == -1) {
- RETURN_FALSE;
- }
-
- RETURN_LONG(ret);
-}
-
-/* }}} */
-/* {{{ proto int fseek(int fp, int offset [, int whence])
- Seek on a file pointer */
-
-PHP_FUNCTION(fseek)
-{
- zval **arg1, **arg2, **arg3;
- int argcount = ARG_COUNT(ht), whence = SEEK_SET;
- void *what;
-
- if (argcount < 2 || argcount > 3 ||
- zend_get_parameters_ex(argcount, &arg1, &arg2, &arg3) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- /* XXX: add stream support --Wez. */
-
- what = zend_fetch_resource(arg1,-1,"File-Handle",NULL,2,le_fopen,le_popen);
- ZEND_VERIFY_RESOURCE(what);
-
- convert_to_long_ex(arg2);
- if (argcount > 2) {
- convert_to_long_ex(arg3);
- whence = (*arg3)->value.lval;
- }
-
- RETURN_LONG(fseek((FILE*)what, (*arg2)->value.lval, whence));
-}
-
-/* }}} */
-/* {{{ proto int mkdir(string pathname, int mode)
- Create a directory */
-
-PHP_FUNCTION(mkdir)
-{
- pval **arg1, **arg2;
- int ret;
- mode_t mode;
- PLS_FETCH();
-
- if (ARG_COUNT(ht) != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(arg1);
- convert_to_long_ex(arg2);
- mode = (mode_t) (*arg2)->value.lval;
- if (PG(safe_mode) &&(!php_checkuid((*arg1)->value.str.val, NULL, CHECKUID_ALLOW_ONLY_DIR))) {
- RETURN_FALSE;
- }
- ret = VCWD_MKDIR((*arg1)->value.str.val, mode);
- if (ret < 0) {
- php_error(E_WARNING,"MkDir failed (%s)", strerror(errno));
- RETURN_FALSE;
- }
- RETURN_TRUE;
-}
-
-/* }}} */
-/* {{{ proto int rmdir(string dirname)
- Remove a directory */
-
-PHP_FUNCTION(rmdir)
-{
- pval **arg1;
- int ret;
- PLS_FETCH();
-
- if (ARG_COUNT(ht) != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(arg1);
- if (PG(safe_mode) &&(!php_checkuid((*arg1)->value.str.val, NULL, CHECKUID_ALLOW_FILE_NOT_EXISTS))) {
- RETURN_FALSE;
- }
- ret = VCWD_RMDIR((*arg1)->value.str.val);
- if (ret < 0) {
- php_error(E_WARNING,"RmDir failed (%s)", strerror(errno));
- RETURN_FALSE;
- }
- RETURN_TRUE;
-}
-
-/* }}} */
-/* {{{ php_passthru_fd */
-
-static size_t php_passthru_fd(int socketd, FILE *fp, int issock)
-{
- size_t bcount = 0;
- int ready = 0;
- char buf[8192];
- /* XXX: add stream support --Wez. */
-
-#ifdef HAVE_MMAP
- if(!issock) {
- int fd;
- struct stat sbuf;
- off_t off;
- void *p;
- size_t len;
-
- fd = fileno(fp);
- fstat(fd, &sbuf);
-
- if (sbuf.st_size > sizeof(buf)) {
- off = ftell(fp);
- len = sbuf.st_size - off;
- p = mmap(0, len, PROT_READ, MAP_SHARED, fd, off);
- if (p != (void *) MAP_FAILED) {
- BLS_FETCH();
- BG(mmap_file) = p;
- BG(mmap_len) = len;
- PHPWRITE(p, len);
- BG(mmap_file) = NULL;
- munmap(p, len);
- bcount += len;
- ready = 1;
- }
- }
- }
-#endif
-
- if(!ready) {
- int b;
-
- while ((b = FP_FREAD(buf, sizeof(buf), socketd, fp, issock)) > 0) {
- PHPWRITE(buf, b);
- bcount += b;
- }
- }
-
- return bcount;
-}
-
-/* }}} */
-/* {{{ proto int readfile(string filename [, int use_include_path])
- Output a file or a URL */
-
-PHP_FUNCTION(readfile)
-{
- pval **arg1, **arg2;
- FILE *fp;
- int size=0;
- int use_include_path=0;
- int issock=0, socketd=0;
- int rsrc_id;
-
- /* check args */
- switch (ARG_COUNT(ht)) {
- case 1:
- if (zend_get_parameters_ex(1,&arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- break;
- case 2:
- if (zend_get_parameters_ex(2,&arg1,&arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(arg2);
- use_include_path = (*arg2)->value.lval;
- break;
- default:
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(arg1);
-
- /*
- * We need a better way of returning error messages from
- * php_fopen_wrapper().
- */
- fp = php_fopen_wrapper((*arg1)->value.str.val,"rb", use_include_path|ENFORCE_SAFE_MODE, &issock, &socketd, NULL);
- if (!fp && !socketd){
- if (issock != BAD_URL) {
- char *tmp = estrndup(Z_STRVAL_PP(arg1), Z_STRLEN_PP(arg1));
- php_strip_url_passwd(tmp);
- php_error(E_WARNING,"readfile(\"%s\") - %s", tmp, strerror(errno));
- efree(tmp);
- }
- RETURN_FALSE;
- }
-
- if (issock) {
- int *sock=emalloc(sizeof(int));
- *sock = socketd;
- rsrc_id = ZEND_REGISTER_RESOURCE(NULL,sock,php_file_le_socket());
- } else {
- rsrc_id = ZEND_REGISTER_RESOURCE(NULL,fp,php_file_le_fopen());
- }
-
- size = php_passthru_fd(socketd, fp, issock);
-
- zend_list_delete(rsrc_id);
-
- RETURN_LONG(size);
-}
-
-/* }}} */
-/* {{{ proto int umask([int mask])
- Return or change the umask */
-
-PHP_FUNCTION(umask)
-{
- pval **arg1;
- int oldumask;
- int arg_count = ARG_COUNT(ht);
-
- oldumask = umask(077);
-
- if (arg_count == 0) {
- umask(oldumask);
- } else {
- if (arg_count > 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(arg1);
- umask((*arg1)->value.lval);
- }
-
- /* XXX we should maybe reset the umask after each request! */
-
- RETURN_LONG(oldumask);
-}
-
-/* }}} */
-/* {{{ proto int fpassthru(int fp)
- Output all remaining data from a file pointer */
-
-PHP_FUNCTION(fpassthru)
-{
- pval **arg1;
- int size, type;
- int issock=0;
- int socketd=0;
- void *what;
-
- if (ARG_COUNT(ht) != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- /* XXX: add stream support --Wez. */
- what = zend_fetch_resource(arg1,-1,"File-Handle",&type,3,le_fopen,le_popen,le_socket);
- ZEND_VERIFY_RESOURCE(what);
-
- if (type == le_socket) {
- issock=1;
- socketd=*(int*)what;
- }
-
- size = php_passthru_fd(socketd, (FILE*) what, issock);
-
- zend_list_delete((*arg1)->value.lval);
-
- RETURN_LONG(size);
-}
-/* }}} */
-
-/* {{{ proto int rename(string old_name, string new_name)
- Rename a file */
-PHP_FUNCTION(rename)
-{
- pval **old_arg, **new_arg;
- char *old_name, *new_name;
- int ret;
- PLS_FETCH();
-
- if (ARG_COUNT(ht) != 2 || zend_get_parameters_ex(2, &old_arg, &new_arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(old_arg);
- convert_to_string_ex(new_arg);
-
- old_name = (*old_arg)->value.str.val;
- new_name = (*new_arg)->value.str.val;
-
- if (PG(safe_mode) &&(!php_checkuid(old_name, NULL, CHECKUID_CHECK_FILE_AND_DIR))) {
- RETURN_FALSE;
- }
- ret = VCWD_RENAME(old_name, new_name);
-
- if (ret == -1) {
- php_error(E_WARNING,"Rename failed (%s)", strerror(errno));
- RETURN_FALSE;
- }
-
- RETVAL_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int unlink(string filename)
- Delete a file */
-PHP_FUNCTION(unlink)
-{
- pval **filename;
- int ret;
- PLS_FETCH();
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &filename) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(filename);
-
- if (PG(safe_mode) && !php_checkuid((*filename)->value.str.val, NULL, CHECKUID_CHECK_FILE_AND_DIR)) {
- RETURN_FALSE;
- }
-
- ret = VCWD_UNLINK((*filename)->value.str.val);
- if (ret == -1) {
- php_error(E_WARNING, "Unlink failed (%s)", strerror(errno));
- RETURN_FALSE;
- }
- /* Clear stat cache */
- PHP_FN(clearstatcache)(INTERNAL_FUNCTION_PARAM_PASSTHRU);
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int ftruncate (int fp, int size)
- Truncate file to 'size' length */
-PHP_NAMED_FUNCTION(php_if_ftruncate)
-{
- zval **fp , **size;
- short int ret;
- int type;
- void *what;
-
- if (ARG_COUNT(ht) != 2 || zend_get_parameters_ex(2, &fp, &size) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- /* XXX: add stream support --Wez. */
-
- what = zend_fetch_resource(fp,-1,"File-Handle",&type,3,le_fopen,le_popen,le_socket);
- ZEND_VERIFY_RESOURCE(what);
-
- if (type == le_socket)
- {
- php_error(E_WARNING, "can't truncate sockets!");
- RETURN_FALSE;
- }
-
- convert_to_long_ex(size);
-
- ret = ftruncate(fileno((FILE *)what), (*size)->value.lval);
- RETURN_LONG(ret + 1);
-}
-/* }}} */
-
-/* {{{ proto int fstat(int fp)
- Stat() on a filehandle */
-PHP_NAMED_FUNCTION(php_if_fstat)
-{
- zval **fp;
- zval *stat_dev,*stat_ino,*stat_mode,*stat_nlink,*stat_uid,*stat_gid,*stat_rdev,
- *stat_size, *stat_atime, *stat_mtime, *stat_ctime, *stat_blksize, *stat_blocks;
- int type;
- void *what;
- struct stat stat_sb;
-
- char *stat_sb_names[13]={"dev","ino","mode","nlink","uid","gid","rdev",
- "size","atime","mtime","ctime","blksize","blocks"};
-
- if (ARG_COUNT(ht) != 1 || zend_get_parameters_ex(1, &fp) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- /* XXX: add stream support --Wez. */
-
- what = zend_fetch_resource(fp,-1,"File-Handle",&type,3,le_fopen,le_popen,le_socket);
- ZEND_VERIFY_RESOURCE(what);
-
- if (fstat(fileno((FILE *) what ), &stat_sb)) {
- RETURN_FALSE;
- }
-
- array_init(return_value);
-
- MAKE_LONG_ZVAL_INCREF(stat_dev, stat_sb.st_dev);
- MAKE_LONG_ZVAL_INCREF(stat_ino, stat_sb.st_ino);
- MAKE_LONG_ZVAL_INCREF(stat_mode, stat_sb.st_mode);
- MAKE_LONG_ZVAL_INCREF(stat_nlink, stat_sb.st_nlink);
- MAKE_LONG_ZVAL_INCREF(stat_uid, stat_sb.st_uid);
- MAKE_LONG_ZVAL_INCREF(stat_gid, stat_sb.st_gid);
-#ifdef HAVE_ST_RDEV
- MAKE_LONG_ZVAL_INCREF(stat_rdev, stat_sb.st_rdev);
-#else
- MAKE_LONG_ZVAL_INCREF(stat_rdev, -1);
-#endif
- MAKE_LONG_ZVAL_INCREF(stat_size, stat_sb.st_size);
- MAKE_LONG_ZVAL_INCREF(stat_atime, stat_sb.st_atime);
- MAKE_LONG_ZVAL_INCREF(stat_mtime, stat_sb.st_mtime);
- MAKE_LONG_ZVAL_INCREF(stat_ctime, stat_sb.st_ctime);
-#ifdef HAVE_ST_BLKSIZE
- MAKE_LONG_ZVAL_INCREF(stat_blksize, stat_sb.st_blksize);
-#else
- MAKE_LONG_ZVAL_INCREF(stat_blksize,-1);
-#endif
-#ifdef HAVE_ST_BLOCKS
- MAKE_LONG_ZVAL_INCREF(stat_blocks, stat_sb.st_blocks);
-#else
- MAKE_LONG_ZVAL_INCREF(stat_blocks,-1);
-#endif
- /* Store numeric indexes in propper order */
- zend_hash_next_index_insert(HASH_OF(return_value),(void *)&stat_dev, sizeof(zval *), NULL);
- zend_hash_next_index_insert(HASH_OF(return_value),(void *)&stat_ino, sizeof(zval *), NULL);
- zend_hash_next_index_insert(HASH_OF(return_value),(void *)&stat_mode, sizeof(zval *), NULL);
- zend_hash_next_index_insert(HASH_OF(return_value),(void *)&stat_nlink, sizeof(zval *), NULL);
- zend_hash_next_index_insert(HASH_OF(return_value),(void *)&stat_uid, sizeof(zval *), NULL);
- zend_hash_next_index_insert(HASH_OF(return_value),(void *)&stat_gid, sizeof(zval *), NULL);
- zend_hash_next_index_insert(HASH_OF(return_value),(void *)&stat_rdev, sizeof(zval *), NULL);
- zend_hash_next_index_insert(HASH_OF(return_value),(void *)&stat_size, sizeof(zval *), NULL);
- zend_hash_next_index_insert(HASH_OF(return_value),(void *)&stat_atime, sizeof(zval *), NULL);
- zend_hash_next_index_insert(HASH_OF(return_value),(void *)&stat_mtime, sizeof(zval *), NULL);
- zend_hash_next_index_insert(HASH_OF(return_value),(void *)&stat_ctime, sizeof(zval *), NULL);
- zend_hash_next_index_insert(HASH_OF(return_value),(void *)&stat_blksize, sizeof(zval *), NULL);
- zend_hash_next_index_insert(HASH_OF(return_value),(void *)&stat_blocks, sizeof(zval *), NULL);
-
- /* Store string indexes referencing the same zval*/
- zend_hash_update(HASH_OF(return_value),stat_sb_names[0],strlen(stat_sb_names[0])+1,(void *)&stat_dev, sizeof(zval *), NULL);
- zend_hash_update(HASH_OF(return_value),stat_sb_names[1],strlen(stat_sb_names[1])+1,(void *)&stat_ino, sizeof(zval *), NULL);
- zend_hash_update(HASH_OF(return_value),stat_sb_names[2],strlen(stat_sb_names[2])+1,(void *)&stat_mode, sizeof(zval *), NULL);
- zend_hash_update(HASH_OF(return_value),stat_sb_names[3],strlen(stat_sb_names[3])+1,(void *)&stat_nlink, sizeof(zval *), NULL);
- zend_hash_update(HASH_OF(return_value),stat_sb_names[4],strlen(stat_sb_names[4])+1,(void *)&stat_uid, sizeof(zval *), NULL);
- zend_hash_update(HASH_OF(return_value),stat_sb_names[5],strlen(stat_sb_names[5])+1,(void *)&stat_gid, sizeof(zval *), NULL);
- zend_hash_update(HASH_OF(return_value),stat_sb_names[6],strlen(stat_sb_names[6])+1,(void *)&stat_rdev, sizeof(zval *), NULL);
- zend_hash_update(HASH_OF(return_value),stat_sb_names[7],strlen(stat_sb_names[7])+1,(void *)&stat_size, sizeof(zval *), NULL);
- zend_hash_update(HASH_OF(return_value),stat_sb_names[8],strlen(stat_sb_names[8])+1,(void *)&stat_atime, sizeof(zval *), NULL);
- zend_hash_update(HASH_OF(return_value),stat_sb_names[9],strlen(stat_sb_names[9])+1,(void *)&stat_mtime, sizeof(zval *), NULL);
- zend_hash_update(HASH_OF(return_value),stat_sb_names[10],strlen(stat_sb_names[10])+1,(void *)&stat_ctime, sizeof(zval *), NULL);
- zend_hash_update(HASH_OF(return_value),stat_sb_names[11],strlen(stat_sb_names[11])+1,(void *)&stat_blksize, sizeof(zval *), NULL);
- zend_hash_update(HASH_OF(return_value),stat_sb_names[12],strlen(stat_sb_names[12])+1,(void *)&stat_blocks, sizeof(zval *), NULL);
-}
-/* }}} */
-
-/* {{{ proto int copy(string source_file, string destination_file)
- Copy a file */
-
-PHP_FUNCTION(copy)
-{
- pval **source, **target;
- PLS_FETCH();
-
- if (ARG_COUNT(ht) != 2 || zend_get_parameters_ex(2, &source, &target) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(source);
- convert_to_string_ex(target);
-
- if (PG(safe_mode) &&(!php_checkuid((*source)->value.str.val, NULL, CHECKUID_CHECK_FILE_AND_DIR))) {
- RETURN_FALSE;
- }
-
- if (php_check_open_basedir((*source)->value.str.val)) {
- RETURN_FALSE;
- }
-
- if (PG(safe_mode) &&(!php_checkuid((*target)->value.str.val, NULL, CHECKUID_CHECK_FILE_AND_DIR))) {
- RETURN_FALSE;
- }
-
- if (php_check_open_basedir((*target)->value.str.val)) {
- RETURN_FALSE;
- }
-
- if (php_copy_file(Z_STRVAL_PP(source), Z_STRVAL_PP(target))==SUCCESS) {
- RETURN_TRUE;
- } else {
- RETURN_FALSE;
- }
-}
-
-/* }}} */
-
-/* {{{ php_copy_file
- */
-PHPAPI int php_copy_file(char *src, char *dest)
-{
- char buffer[8192];
- int fd_s,fd_t,read_bytes;
- int ret = FAILURE;
-
-#ifdef PHP_WIN32
- if ((fd_s=VCWD_OPEN((src,O_RDONLY|_O_BINARY)))==-1) {
-#else
- if ((fd_s=VCWD_OPEN((src,O_RDONLY)))==-1) {
-#endif
- php_error(E_WARNING,"Unable to open '%s' for reading: %s", src, strerror(errno));
- return FAILURE;
- }
-#ifdef PHP_WIN32
- if ((fd_t=VCWD_OPEN((dest,_O_WRONLY|_O_CREAT|_O_TRUNC|_O_BINARY,_S_IREAD|_S_IWRITE)))==-1) {
-#else
- if ((fd_t=VCWD_CREAT(dest,0777))==-1) {
-#endif
- php_error(E_WARNING,"Unable to create '%s': %s", dest, strerror(errno));
- close(fd_s);
- return FAILURE;
- }
-
-#ifdef HAVE_MMAP
- {
- void *srcfile;
- struct stat sbuf;
-
- if (fstat(fd_s, &sbuf)) {
- goto cleanup;
- }
- srcfile = mmap(NULL, sbuf.st_size, PROT_READ, MAP_SHARED, fd_s, 0);
- if (srcfile != (void *) MAP_FAILED) {
- if (write(fd_t, srcfile, sbuf.st_size) == sbuf.st_size)
- ret = SUCCESS;
- munmap(srcfile, sbuf.st_size);
- goto cleanup;
- }
- }
-#endif
-
- while ((read_bytes=read(fd_s,buffer,8192))!=-1 && read_bytes!=0) {
- if (write(fd_t,buffer,read_bytes)==-1) {
- php_error(E_WARNING,"Unable to write to '%s': %s", dest, strerror(errno));
- goto cleanup;
- }
- }
- ret = SUCCESS;
-
-cleanup:
- close(fd_s);
- close(fd_t);
- return ret;
-}
-/* }}} */
-
-/* {{{ proto string fread(int fp, int length)
- Binary-safe file read */
-
-PHP_FUNCTION(fread)
-{
- pval **arg1, **arg2;
- int len, type;
- int issock=0;
- int socketd=0;
- void *what;
- PLS_FETCH();
-
- if (ARG_COUNT(ht) != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- /* XXX: add stream support --Wez. */
-
- what = zend_fetch_resource(arg1,-1,"File-Handle",&type,3,le_fopen,le_popen,le_socket);
- ZEND_VERIFY_RESOURCE(what);
-
- if (type == le_socket) {
- issock=1;
- socketd=*(int*)what;
- }
-
- convert_to_long_ex(arg2);
- len = (*arg2)->value.lval;
- if (len < 0) {
- php_error(E_WARNING, "length parameter to fread() may not be negative");
- RETURN_FALSE;
- }
-
- return_value->value.str.val = emalloc(sizeof(char) * (len + 1));
- /* needed because recv doesnt put a null at the end*/
-
- if (!issock) {
-#ifdef HAVE_FLUSHIO
- if (type == le_fopen) {
- fseek((FILE*)what, 0, SEEK_CUR);
- }
-#endif
- return_value->value.str.len = fread(return_value->value.str.val, 1, len, (FILE*)what);
- return_value->value.str.val[return_value->value.str.len] = 0;
- } else {
- return_value->value.str.len = SOCK_FREAD(return_value->value.str.val, len, socketd);
- }
- if (PG(magic_quotes_runtime)) {
- return_value->value.str.val = php_addslashes(return_value->value.str.val,return_value->value.str.len,&return_value->value.str.len,1);
- }
- return_value->type = IS_STRING;
-}
-
-/* }}} */
-
-/* {{{ proto array fgetcsv(int fp, int length [, string delimiter])
- Get line from file pointer and parse for CSV fields */
-
-PHP_FUNCTION(fgetcsv) {
- char *temp, *tptr, *bptr, *lineEnd;
- char delimiter = ','; /* allow this to be set as parameter */
-
- /* first section exactly as php_fgetss */
-
- pval **fd, **bytes, **p_delim;
- int len, type;
- char *buf;
- int issock=0;
- int socketd=0;
- void *what;
-
- switch(ARG_COUNT(ht)) {
- case 2:
- if (zend_get_parameters_ex(2, &fd, &bytes) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- break;
-
- case 3:
- if (zend_get_parameters_ex(3, &fd, &bytes, &p_delim) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(p_delim);
- /* Make sure that there is at least one character in string */
- if ((*p_delim)->value.str.len < 1) {
- WRONG_PARAM_COUNT;
- }
- /* use first character from string */
- delimiter = (*p_delim)->value.str.val[0];
- break;
-
- default:
- WRONG_PARAM_COUNT;
- /* NOTREACHED */
- break;
- }
- /* XXX: add stream support --Wez. */
-
- what = zend_fetch_resource(fd,-1,"File-Handle",&type,3,le_fopen,le_popen,le_socket);
- ZEND_VERIFY_RESOURCE(what);
-
- if (type == le_socket) {
- issock=1;
- socketd=*(int*)what;
- }
-
- convert_to_long_ex(bytes);
- len = (*bytes)->value.lval;
- if (len < 0) {
- php_error(E_WARNING, "length parameter to fgetcsv() may not be negative");
- RETURN_FALSE;
- }
-
- buf = emalloc(sizeof(char) * (len + 1));
- /*needed because recv doesnt set null char at end*/
- memset(buf, 0, len + 1);
- if (FP_FGETS(buf, len, socketd, (FILE*)what, issock) == NULL) {
- efree(buf);
- RETURN_FALSE;
- }
-
- /* Now into new section that parses buf for comma/quote delimited fields */
-
- /* Strip trailing space from buf, saving end of line in case required for quoted field */
-
- lineEnd = emalloc(sizeof(char) * (len + 1));
- bptr = buf;
- tptr = buf + strlen(buf) -1;
- while ( isspace((int)*tptr) && (*tptr!=delimiter) && (tptr > bptr) ) tptr--;
- tptr++;
- strcpy(lineEnd, tptr);
-
- /* add single space - makes it easier to parse trailing null field */
- *tptr++ = ' ';
- *tptr = 0;
-
- /* reserve workspace for building each individual field */
-
- temp = emalloc(sizeof(char) * len); /* unlikely but possible! */
- tptr = temp;
-
- /* Initialize return array */
- if (array_init(return_value) == FAILURE) {
- efree(lineEnd);
- efree(temp);
- efree(buf);
- RETURN_FALSE;
- }
-
- /* Main loop to read CSV fields */
- /* NB this routine will return a single null entry for a blank line */
-
- do {
- /* 1. Strip any leading space */
- while(isspace((int)*bptr) && (*bptr!=delimiter)) bptr++;
- /* 2. Read field, leaving bptr pointing at start of next field */
- if (*bptr == '"') {
- /* 2A. handle quote delimited field */
- bptr++; /* move on to first character in field */
- while (*bptr) {
- if (*bptr == '"') {
- /* handle the double-quote */
- if ( *(bptr+1) == '"') {
- /* embedded double quotes */
- *tptr++ = *bptr; bptr +=2;
- } else {
- /* must be end of string - skip to start of next field or end */
- while ( (*bptr != delimiter) && *bptr ) bptr++;
- if (*bptr == delimiter) bptr++;
- *tptr=0; /* terminate temporary string */
- break; /* .. from handling this field - resumes at 3. */
- }
- } else {
- /* normal character */
- *tptr++ = *bptr++;
-
- if (*bptr == 0) { /* embedded line end? */
- *(tptr-1)=0; /* remove space character added on reading line */
- strcat(temp,lineEnd); /* add the embedded line end to the field */
-
- /* read a new line from input, as at start of routine */
- memset(buf,0,len+1);
- if (FP_FGETS(buf, len, socketd, (FILE*)what, issock) == NULL) {
- efree(lineEnd); efree(temp); efree(buf);
- zval_dtor(return_value);
- RETURN_FALSE;
- }
- bptr = buf;
- tptr = buf + strlen(buf) -1;
- while ( isspace((int)*tptr) && (*tptr!=delimiter) && (tptr > bptr) ) tptr--;
- tptr++; strcpy(lineEnd, tptr);
- *tptr++ = ' '; *tptr = 0;
-
- tptr=temp; /* reset temp pointer to end of field as read so far */
- while (*tptr) tptr++;
- }
- }
- }
- } else {
- /* 2B. Handle non-quoted field */
- while ( (*bptr != delimiter) && *bptr ) *tptr++ = *bptr++;
- *tptr=0; /* terminate temporary string */
- if (strlen(temp)) {
- tptr--;
- while (isspace((int)*tptr) && (*tptr!=delimiter)) *tptr-- = 0; /* strip any trailing spaces */
- }
- if (*bptr == delimiter) bptr++;
- }
- /* 3. Now pass our field back to php */
- add_next_index_string(return_value, temp, 1);
- tptr=temp;
- } while (*bptr);
-
- efree(lineEnd);
- efree(temp);
- efree(buf);
-}
-
-/* }}} */
-
-
-#if (!defined(PHP_WIN32) && !defined(__BEOS__)) || defined(ZTS)
-/* {{{ proto string realpath(string path)
- Return the resolved path */
-PHP_FUNCTION(realpath)
-{
- zval **path;
- char resolved_path_buff[MAXPATHLEN];
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(ZEND_NUM_ARGS(), &path) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(path);
-
- if (VCWD_REALPATH((*path)->value.str.val, resolved_path_buff)) {
- RETURN_STRING(resolved_path_buff, 1);
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-#endif
-
-
-#if 0
-
-static fd_set readfd;
-static int max_fd;
-/* {{{ PHP_FUNCTION(fd_set)
- */
-PHP_FUNCTION(fd_set)
-{
- pval **arg;
- void *what;
- int type, fd;
-
- if(ARG_COUNT(ht) <= 0) {
- php_error(E_WARNING, "fd_set: Must be passed at least one value" );
- var_uninit(return_value);
- return;
- }
- else if(ARG_COUNT(ht) == 1) {
- if(zend_get_parameters_ex(1, &arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- /* XXX: add stream support --Wez. */
- what = zend_fetch_resource(arg,-1,"select",&type,3,le_fopen,le_socket,le_popen);
- ZEND_VERIFY_RESOURCE(what);
- if(type == le_socket) {
- fd = *(int *)what;
- } else {
- fd = fileno((FILE *)what);
- }
- max_fd = fd;
- FD_ZERO(&readfd);
- FD_SET(max_fd, &readfd);
- }
- else {
- pval ***args = (pval ***) emalloc(sizeof(pval **) * ARG_COUNT(ht));
- int i;
- if(zend_get_parameters_array_ex(ARG_COUNT(ht), args) == FAILURE) {
- efree(args);
- WRONG_PARAM_COUNT;
- }
- FD_ZERO(&readfd);
- for(i = 0; i < ARG_COUNT(ht); i++) {
- /* XXX: add stream support --Wez. */
- what = zend_fetch_resource(*args,-1,"select",&type,3,le_fopen,le_socket,le_popen);
- ZEND_VERIFY_RESOURCE(what);
- if(type == le_socket) {
- fd = *(int *)what;
- } else {
- fd = fileno((FILE *)what);
- }
- FD_SET(fd, &readfd);
- if(fd > max_fd) max_fd = fd;
- }
- efree(args);
- }
- RETURN_LONG(1);
-}
-/* }}} */
-
-/* {{{ PHP_FUNCTION(select)
- */
-PHP_FUNCTION(select)
-{
- pval **timeout;
- struct timeval tv;
-
- if(ARG_COUNT(ht) != 1 || zend_get_parameters_ex(1, &timeout) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(timeout);
-
- tv.tv_sec = (*timeout)->value.lval / 1000000;
- tv.tv_usec = (*timeout)->value.lval % 1000000;
- /* XXX: add stream support --Wez. */
-
- RETURN_LONG(select(max_fd + 1,&readfd,NULL,NULL,((*timeout)->value.lval <= 0) ? NULL : &tv));
-}
-/* }}} */
-
-/* {{{ PHP_FUNCTION(fd_isset)
- */
-PHP_FUNCTION(fd_isset)
-{
- pval **fdarg;
- void *what;
- int type, fd;
-
- if(ARG_COUNT(ht) != 1 || zend_get_parameters_ex(1, &fdarg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- /* XXX: add stream support --Wez. */
-
- what = zend_fetch_resource(fdarg,-1,"select",&type,3,le_fopen,le_socket,le_popen);
- ZEND_VERIFY_RESOURCE(what);
-
- if(type == le_socket) {
- fd = *(int *)what;
- } else {
- fd = fileno((FILE *)what);
- }
-
- if(FD_ISSET(fd,&readfd)) {
- RETURN_TRUE;
- }
- RETURN_FALSE;
-}
-/* }}} */
-
-#endif
-
-/* {{{ php_fread_all
- Function reads all data from file or socket and puts it into the buffer */
-size_t php_fread_all(char **buf, int socket, FILE *fp, int issock) {
- size_t ret;
- char *ptr;
- size_t len = 0, max_len;
- int step = PHP_FSOCK_CHUNK_SIZE;
- int min_room = PHP_FSOCK_CHUNK_SIZE/4;
-
- ptr = *buf = emalloc(step);
- max_len = step;
- /* XXX: add stream support --Wez. */
-
- while((ret = FP_FREAD(ptr, max_len - len, socket, fp, issock))) {
- len += ret;
- if(len + min_room >= max_len) {
- *buf = erealloc(*buf, max_len + step);
- max_len += step;
- ptr = *buf + len;
- }
- }
-
- if(len) {
- *buf = erealloc(*buf, len);
- } else {
- efree(*buf);
- *buf = NULL;
- }
-
- return len;
-}
-/* }}} */
-
-/* See http://www.w3.org/TR/html4/intro/sgmltut.html#h-3.2.2 */
-#define PHP_META_HTML401_CHARS "-_.:"
-
-/* {{{ php_next_meta_token
- Tokenizes an HTML file for get_meta_tags */
-php_meta_tags_token php_next_meta_token(FILE *fp, int socketd, int issock, int *use_last_char, int *last_char, char **data, int *datalen) {
- int ch, compliment;
- char buff[META_DEF_BUFSIZE + 1];
-
- memset((void *)buff,0,META_DEF_BUFSIZE + 1);
-
- while (*use_last_char || (!FP_FEOF(socketd,fp,issock) && (ch = FP_FGETC(socketd,fp,issock)))) {
-
- if(FP_FEOF(socketd,fp,issock))
- break;
-
- if (*use_last_char) {
- ch = *last_char;
- *use_last_char = 0;
- }
-
- switch (ch) {
- case '<':
- return TOK_OPENTAG;
- break;
- case '>':
- return TOK_CLOSETAG;
- break;
- case '=':
- return TOK_EQUAL;
- break;
- case '/':
- return TOK_SLASH;
- break;
- case '\'':
- case '"':
- compliment = ch;
- *datalen = 0;
- while (!FP_FEOF(socketd,fp,issock) && (ch = FP_FGETC(socketd,fp,issock)) && ch != compliment) {
- buff[(*datalen)++] = ch;
-
- if (*datalen == META_DEF_BUFSIZE)
- break;
- }
-
- *data = (char *) emalloc( *datalen + 1 );
- memcpy(*data,buff,*datalen+1);
-
- return TOK_STRING;
- break;
- case '\n':
- case '\r':
- case '\t':
- break;
- case ' ':
- return TOK_SPACE;
- break;
- default:
- if (isalnum(ch)) {
- *datalen = 0;
- buff[(*datalen)++] = ch;
- while (!FP_FEOF(socketd,fp,issock) &&
- (ch = FP_FGETC(socketd,fp,issock)) &&
- (isalnum(ch) || strchr(PHP_META_HTML401_CHARS,ch))) {
-
- buff[(*datalen)++] = ch;
-
- if (*datalen == META_DEF_BUFSIZE)
- break;
- }
-
- /* This is ugly, but we have to replace ungetc */
- if (!isalpha(ch) && ch != '-') {
- *use_last_char = 1;
- *last_char = ch;
- }
-
- *data = (char *) emalloc( *datalen + 1 );
- memcpy(*data,buff,*datalen+1);
-
- return TOK_ID;
- } else {
- return TOK_OTHER;
- }
- break;
- }
- }
-
- return TOK_EOF;
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: tw=78 sw=4 ts=4 fdm=marker
- * vim<600: tw=78 sw=4 ts=4
- */
diff --git a/ext/standard/file.h b/ext/standard/file.h
deleted file mode 100644
index 4e591d1da5..0000000000
--- a/ext/standard/file.h
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-/* Synced with php 3.0 revision 1.30 1999-06-16 [ssb] */
-
-#ifndef FILE_H
-#define FILE_H
-
-PHP_MINIT_FUNCTION(file);
-PHP_MSHUTDOWN_FUNCTION(file);
-
-PHP_FUNCTION(tempnam);
-PHP_NAMED_FUNCTION(php_if_tmpfile);
-PHP_NAMED_FUNCTION(php_if_fopen);
-PHP_FUNCTION(fclose);
-PHP_FUNCTION(popen);
-PHP_FUNCTION(pclose);
-PHP_FUNCTION(feof);
-PHP_FUNCTION(fread);
-PHP_FUNCTION(fgetc);
-PHP_FUNCTION(fgets);
-PHP_FUNCTION(fscanf);
-PHP_FUNCTION(fgetss);
-PHP_FUNCTION(fgetcsv);
-PHP_FUNCTION(fwrite);
-PHP_FUNCTION(fflush);
-PHP_FUNCTION(rewind);
-PHP_FUNCTION(ftell);
-PHP_FUNCTION(fseek);
-PHP_FUNCTION(mkdir);
-PHP_FUNCTION(rmdir);
-PHP_FUNCTION(fpassthru);
-PHP_FUNCTION(readfile);
-PHP_FUNCTION(umask);
-PHP_FUNCTION(rename);
-PHP_FUNCTION(unlink);
-PHP_FUNCTION(copy);
-PHP_FUNCTION(file);
-PHP_FUNCTION(set_socket_blocking); /* deprecated */
-PHP_FUNCTION(socket_set_blocking);
-PHP_FUNCTION(socket_set_timeout);
-PHP_FUNCTION(socket_get_status);
-PHP_FUNCTION(set_file_buffer);
-PHP_FUNCTION(get_meta_tags);
-PHP_FUNCTION(flock);
-PHP_FUNCTION(fd_set);
-PHP_FUNCTION(fd_isset);
-PHP_FUNCTION(select);
-PHP_FUNCTION(realpath);
-PHP_NAMED_FUNCTION(php_if_ftruncate);
-PHP_NAMED_FUNCTION(php_if_fstat);
-
-/* temporary function for testing streams */
-PHP_FUNCTION(fopenstream);
-
-
-PHPAPI int php_set_sock_blocking(int socketd, int block);
-PHPAPI int php_file_le_fopen(void);
-PHPAPI int php_file_le_stream(void);
-PHPAPI int php_file_le_popen(void);
-PHPAPI int php_file_le_socket(void);
-PHPAPI int php_copy_file(char *src, char *dest);
-
-#define META_DEF_BUFSIZE 8192
-
-typedef enum _php_meta_tags_token {
- TOK_EOF = 0,
- TOK_OPENTAG,
- TOK_CLOSETAG,
- TOK_SLASH,
- TOK_EQUAL,
- TOK_SPACE,
- TOK_ID,
- TOK_STRING,
- TOK_OTHER
-} php_meta_tags_token;
-
-php_meta_tags_token php_next_meta_token(FILE *, int, int, int *, int *, char **, int *);
-
-typedef struct {
- int fgetss_state;
- int pclose_ret;
- HashTable ht_fsock_keys;
- HashTable ht_fsock_socks;
- struct php_sockbuf *phpsockbuf;
- size_t def_chunk_size;
-} php_file_globals;
-
-#ifdef ZTS
-#define FLS_D php_file_globals *file_globals
-#define FLS_DC , FLS_D
-#define FLS_C file_globals
-#define FLS_CC , FLS_C
-#define FG(v) (file_globals->v)
-#define FLS_FETCH() php_file_globals *file_globals = ts_resource(file_globals_id)
-extern int file_globals_id;
-#else
-#define FLS_D void
-#define FLS_DC
-#define FLS_C
-#define FLS_CC
-#define FG(v) (file_globals.v)
-#define FLS_FETCH()
-extern php_file_globals file_globals;
-#endif
-
-
-#endif /* FILE_H */
diff --git a/ext/standard/filestat.c b/ext/standard/filestat.c
deleted file mode 100644
index 3141d871f0..0000000000
--- a/ext/standard/filestat.c
+++ /dev/null
@@ -1,853 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Jim Winstead <jimw@php.net> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#include "php.h"
-#include "safe_mode.h"
-#include "fopen_wrappers.h"
-#include "php_globals.h"
-
-#include <stdlib.h>
-#include <sys/stat.h>
-#include <string.h>
-#include <errno.h>
-#include <ctype.h>
-#include <time.h>
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#ifdef OS2
-# define INCL_DOS
-# include <os2.h>
-#endif
-
-#if defined(HAVE_SYS_STATVFS_H) && defined(HAVE_STATVFS)
-# include <sys/statvfs.h>
-#elif defined(HAVE_SYS_STATFS_H) && defined(HAVE_STATFS)
-# include <sys/statfs.h>
-#elif defined(HAVE_SYS_MOUNT_H) && defined(HAVE_STATFS)
-# include <sys/mount.h>
-#endif
-
-#if HAVE_PWD_H
-# ifdef PHP_WIN32
-# include "win32/pwd.h"
-# else
-# include <pwd.h>
-# endif
-#endif
-
-#if HAVE_GRP_H
-# ifdef PHP_WIN32
-# include "win32/grp.h"
-# else
-# include <grp.h>
-# endif
-#endif
-
-#if HAVE_UTIME
-# ifdef PHP_WIN32
-# include <sys/utime.h>
-# else
-# include <utime.h>
-# endif
-#endif
-
-#include "basic_functions.h"
-#include "php_filestat.h"
-
-#ifndef S_ISDIR
-#define S_ISDIR(mode) (((mode)&S_IFMT) == S_IFDIR)
-#endif
-#ifndef S_ISREG
-#define S_ISREG(mode) (((mode)&S_IFMT) == S_IFREG)
-#endif
-#ifndef S_ISLNK
-#define S_ISLNK(mode) (((mode)&S_IFMT) == S_IFLNK)
-#endif
-
-#define S_IXROOT ( S_IXUSR | S_IXGRP | S_IXOTH )
-
-PHP_RINIT_FUNCTION(filestat)
-{
- BLS_FETCH();
-
- BG(CurrentStatFile)=NULL;
- BG(CurrentStatLength)=0;
- return SUCCESS;
-}
-
-
-PHP_RSHUTDOWN_FUNCTION(filestat)
-{
- BLS_FETCH();
-
- if (BG(CurrentStatFile)) {
- efree (BG(CurrentStatFile));
- }
- return SUCCESS;
-}
-
-/* {{{ proto double disk_total_space(string path)
- Get total disk space for filesystem that path is on */
-PHP_FUNCTION(disk_total_space)
-{
- pval **path;
-#ifdef WINDOWS
- double bytestotal;
-
- HINSTANCE kernel32;
- FARPROC gdfse;
- typedef BOOL (WINAPI *gdfse_func)(LPCTSTR, PULARGE_INTEGER, PULARGE_INTEGER, PULARGE_INTEGER);
- gdfse_func func;
-
- /* These are used by GetDiskFreeSpaceEx, if available. */
- ULARGE_INTEGER FreeBytesAvailableToCaller;
- ULARGE_INTEGER TotalNumberOfBytes;
- ULARGE_INTEGER TotalNumberOfFreeBytes;
-
- /* These are used by GetDiskFreeSpace otherwise. */
- DWORD SectorsPerCluster;
- DWORD BytesPerSector;
- DWORD NumberOfFreeClusters;
- DWORD TotalNumberOfClusters;
-
-#else /* not - WINDOWS */
-#if defined(HAVE_SYS_STATVFS_H) && defined(HAVE_STATVFS)
- struct statvfs buf;
-#elif (defined(HAVE_SYS_STATFS_H) || defined(HAVE_SYS_MOUNT_H)) && defined(HAVE_STATFS)
- struct statfs buf;
-#endif
- double bytestotal = 0;
-#endif /* WINDOWS */
-
- if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1,&path)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(path);
-
- if (php_check_open_basedir((*path)->value.str.val)) RETURN_FALSE;
-
-#ifdef WINDOWS
- /* GetDiskFreeSpaceEx is only available in NT and Win95 post-OSR2,
- so we have to jump through some hoops to see if the function
- exists. */
- kernel32 = LoadLibrary("kernel32.dll");
- if (kernel32) {
- gdfse = GetProcAddress(kernel32, "GetDiskFreeSpaceExA");
- /* It's available, so we can call it. */
- if (gdfse) {
- func = (gdfse_func)gdfse;
- if (func((*path)->value.str.val,
- &FreeBytesAvailableToCaller,
- &TotalNumberOfBytes,
- &TotalNumberOfFreeBytes) == 0) RETURN_FALSE;
-
- /* i know - this is ugly, but i works (thies@thieso.net) */
- bytestotal = TotalNumberOfBytes.HighPart *
- (double) (((unsigned long)1) << 31) * 2.0 +
- TotalNumberOfBytes.LowPart;
- }
- /* If it's not available, we just use GetDiskFreeSpace */
- else {
- if (GetDiskFreeSpace((*path)->value.str.val,
- &SectorsPerCluster, &BytesPerSector,
- &NumberOfFreeClusters, &TotalNumberOfClusters) == 0) RETURN_FALSE;
- bytestotal = (double)TotalNumberOfClusters * (double)SectorsPerCluster * (double)BytesPerSector;
- }
- }
- else {
- php_error(E_WARNING, "Unable to load kernel32.dll");
- RETURN_FALSE;
- }
-
-#elif defined(OS2)
- {
- FSALLOCATE fsinfo;
- char drive = (*path)->value.str.val[0] & 95;
-
- if (DosQueryFSInfo( drive ? drive - 64 : 0, FSIL_ALLOC, &fsinfo, sizeof( fsinfo ) ) == 0)
- bytestotal = (double)fsinfo.cbSector * fsinfo.cSectorUnit * fsinfo.cUnit;
- }
-#else /* WINDOWS, OS/2 */
-#if defined(HAVE_SYS_STATVFS_H) && defined(HAVE_STATVFS)
- if (statvfs((*path)->value.str.val,&buf)) RETURN_FALSE;
- if (buf.f_frsize) {
- bytestotal = (((double)buf.f_blocks) * ((double)buf.f_frsize));
- } else {
- bytestotal = (((double)buf.f_blocks) * ((double)buf.f_bsize));
- }
-
-#elif (defined(HAVE_SYS_STATFS_H) || defined(HAVE_SYS_MOUNT_H)) && defined(HAVE_STATFS)
- if (statfs((*path)->value.str.val,&buf)) RETURN_FALSE;
- bytestotal = (((double)buf.f_bsize) * ((double)buf.f_blocks));
-#endif
-#endif /* WINDOWS */
-
- RETURN_DOUBLE(bytestotal);
-}
-/* }}} */
-
-/* {{{ proto double disk_free_space(string path)
- Get free disk space for filesystem that path is on */
-PHP_FUNCTION(disk_free_space)
-{
- pval **path;
-#ifdef WINDOWS
- double bytesfree;
-
- HINSTANCE kernel32;
- FARPROC gdfse;
- typedef BOOL (WINAPI *gdfse_func)(LPCTSTR, PULARGE_INTEGER, PULARGE_INTEGER, PULARGE_INTEGER);
- gdfse_func func;
-
- /* These are used by GetDiskFreeSpaceEx, if available. */
- ULARGE_INTEGER FreeBytesAvailableToCaller;
- ULARGE_INTEGER TotalNumberOfBytes;
- ULARGE_INTEGER TotalNumberOfFreeBytes;
-
- /* These are used by GetDiskFreeSpace otherwise. */
- DWORD SectorsPerCluster;
- DWORD BytesPerSector;
- DWORD NumberOfFreeClusters;
- DWORD TotalNumberOfClusters;
-
-#else /* not - WINDOWS */
-#if defined(HAVE_SYS_STATVFS_H) && defined(HAVE_STATVFS)
- struct statvfs buf;
-#elif (defined(HAVE_SYS_STATFS_H) || defined(HAVE_SYS_MOUNT_H)) && defined(HAVE_STATFS)
- struct statfs buf;
-#endif
- double bytesfree = 0;
-#endif /* WINDOWS */
-
- if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1,&path)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(path);
-
- if (php_check_open_basedir((*path)->value.str.val)) RETURN_FALSE;
-
-#ifdef WINDOWS
- /* GetDiskFreeSpaceEx is only available in NT and Win95 post-OSR2,
- so we have to jump through some hoops to see if the function
- exists. */
- kernel32 = LoadLibrary("kernel32.dll");
- if (kernel32) {
- gdfse = GetProcAddress(kernel32, "GetDiskFreeSpaceExA");
- /* It's available, so we can call it. */
- if (gdfse) {
- func = (gdfse_func)gdfse;
- if (func((*path)->value.str.val,
- &FreeBytesAvailableToCaller,
- &TotalNumberOfBytes,
- &TotalNumberOfFreeBytes) == 0) RETURN_FALSE;
-
- /* i know - this is ugly, but i works (thies@thieso.net) */
- bytesfree = FreeBytesAvailableToCaller.HighPart *
- (double) (((unsigned long)1) << 31) * 2.0 +
- FreeBytesAvailableToCaller.LowPart;
- }
- /* If it's not available, we just use GetDiskFreeSpace */
- else {
- if (GetDiskFreeSpace((*path)->value.str.val,
- &SectorsPerCluster, &BytesPerSector,
- &NumberOfFreeClusters, &TotalNumberOfClusters) == 0) RETURN_FALSE;
- bytesfree = (double)NumberOfFreeClusters * (double)SectorsPerCluster * (double)BytesPerSector;
- }
- }
- else {
- php_error(E_WARNING, "Unable to load kernel32.dll");
- RETURN_FALSE;
- }
-
-#elif defined(OS2)
- {
- FSALLOCATE fsinfo;
- char drive = (*path)->value.str.val[0] & 95;
-
- if (DosQueryFSInfo( drive ? drive - 64 : 0, FSIL_ALLOC, &fsinfo, sizeof( fsinfo ) ) == 0)
- bytesfree = (double)fsinfo.cbSector * fsinfo.cSectorUnit * fsinfo.cUnitAvail;
- }
-#else /* WINDOWS, OS/2 */
-#if defined(HAVE_SYS_STATVFS_H) && defined(HAVE_STATVFS)
- if (statvfs((*path)->value.str.val,&buf)) RETURN_FALSE;
- if (buf.f_frsize) {
- bytesfree = (((double)buf.f_bavail) * ((double)buf.f_frsize));
- } else {
- bytesfree = (((double)buf.f_bavail) * ((double)buf.f_bsize));
- }
-#elif (defined(HAVE_SYS_STATFS_H) || defined(HAVE_SYS_MOUNT_H)) && defined(HAVE_STATFS)
- if (statfs((*path)->value.str.val,&buf)) RETURN_FALSE;
- bytesfree = (((double)buf.f_bsize) * ((double)buf.f_bavail));
-#endif
-#endif /* WINDOWS */
-
- RETURN_DOUBLE(bytesfree);
-}
-/* }}} */
-
-/* {{{ proto bool chgrp(string filename, mixed group)
- Change file group */
-PHP_FUNCTION(chgrp)
-{
-#ifndef WINDOWS
- pval **filename, **group;
- gid_t gid;
- struct group *gr=NULL;
- int ret;
- PLS_FETCH();
-
- if (ZEND_NUM_ARGS()!=2 || zend_get_parameters_ex(2,&filename,&group)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(filename);
- if ((*group)->type == IS_STRING) {
- gr = getgrnam((*group)->value.str.val);
- if (!gr) {
- php_error(E_WARNING, "unable to find gid for %s",
- (*group)->value.str.val);
- RETURN_FALSE;
- }
- gid = gr->gr_gid;
- } else {
- convert_to_long_ex(group);
- gid = (*group)->value.lval;
- }
-
- if (PG(safe_mode) &&(!php_checkuid((*filename)->value.str.val, NULL, CHECKUID_ALLOW_FILE_NOT_EXISTS))) {
- RETURN_FALSE;
- }
-
- /* Check the basedir */
- if (php_check_open_basedir((*filename)->value.str.val))
- RETURN_FALSE;
-
- ret = VCWD_CHOWN((*filename)->value.str.val, -1, gid);
- if (ret == -1) {
- php_error(E_WARNING, "chgrp failed: %s", strerror(errno));
- RETURN_FALSE;
- }
- RETURN_TRUE;
-#else
- RETURN_FALSE;
-#endif
-}
-/* }}} */
-
-/* {{{ proto bool chown (string filename, mixed user)
- Change file owner */
-PHP_FUNCTION(chown)
-{
-#ifndef WINDOWS
- pval **filename, **user;
- int ret;
- uid_t uid;
- struct passwd *pw = NULL;
- PLS_FETCH();
-
- if (ZEND_NUM_ARGS()!=2 || zend_get_parameters_ex(2,&filename,&user)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(filename);
- if ((*user)->type == IS_STRING) {
- pw = getpwnam((*user)->value.str.val);
- if (!pw) {
- php_error(E_WARNING, "unable to find uid for %s",
- (*user)->value.str.val);
- RETURN_FALSE;
- }
- uid = pw->pw_uid;
- } else {
- convert_to_long_ex(user);
- uid = (*user)->value.lval;
- }
-
- if (PG(safe_mode) &&(!php_checkuid((*filename)->value.str.val, NULL, CHECKUID_ALLOW_FILE_NOT_EXISTS))) {
- RETURN_FALSE;
- }
-
- /* Check the basedir */
- if (php_check_open_basedir((*filename)->value.str.val))
- RETURN_FALSE;
-
- ret = VCWD_CHOWN((*filename)->value.str.val, uid, -1);
- if (ret == -1) {
- php_error(E_WARNING, "chown failed: %s", strerror(errno));
- RETURN_FALSE;
- }
-#endif
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool chmod(string filename, int mode)
- Change file mode */
-PHP_FUNCTION(chmod)
-{
- pval **filename, **mode;
- int ret;
- mode_t imode;
- PLS_FETCH();
-
- if (ZEND_NUM_ARGS()!=2 || zend_get_parameters_ex(2,&filename,&mode)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(filename);
- convert_to_long_ex(mode);
-
- if (PG(safe_mode) &&(!php_checkuid((*filename)->value.str.val, NULL, CHECKUID_ALLOW_FILE_NOT_EXISTS))) {
- RETURN_FALSE;
- }
-
- /* Check the basedir */
- if (php_check_open_basedir((*filename)->value.str.val))
- RETURN_FALSE;
-
- imode = (mode_t) (*mode)->value.lval;
- /* in safe mode, do not allow to setuid files.
- Setuiding files could allow users to gain privileges
- that safe mode doesn't give them.
- */
- if(PG(safe_mode))
- imode &= 0777;
-
- ret = VCWD_CHMOD((*filename)->value.str.val, imode);
- if (ret == -1) {
- php_error(E_WARNING, "chmod failed: %s", strerror(errno));
- RETURN_FALSE;
- }
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool touch(string filename [, int time])
- Set modification time of file */
-PHP_FUNCTION(touch)
-{
-#if HAVE_UTIME
- pval **filename, **filetime;
- int ret;
- struct stat sb;
- FILE *file;
- struct utimbuf *newtime = NULL;
- int ac = ZEND_NUM_ARGS();
- PLS_FETCH();
-
- if (ac == 1 && zend_get_parameters_ex(1,&filename) != FAILURE) {
-#ifndef HAVE_UTIME_NULL
- newtime = (struct utimbuf *)emalloc(sizeof(struct utimbuf));
- if (!newtime) {
- php_error(E_WARNING, "unable to emalloc memory for changing time");
- return;
- }
- newtime->actime = time(NULL);
- newtime->modtime = newtime->actime;
-#endif
- } else if (ac == 2 && zend_get_parameters_ex(2,&filename,&filetime) != FAILURE) {
- newtime = (struct utimbuf *)emalloc(sizeof(struct utimbuf));
- if (!newtime) {
- php_error(E_WARNING, "unable to emalloc memory for changing time");
- return;
- }
- convert_to_long_ex(filetime);
- newtime->actime = (*filetime)->value.lval;
- newtime->modtime = (*filetime)->value.lval;
- } else {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(filename);
-
- if (PG(safe_mode) &&(!php_checkuid((*filename)->value.str.val, NULL, CHECKUID_CHECK_FILE_AND_DIR))) {
- if (newtime) efree(newtime);
- RETURN_FALSE;
- }
-
- /* Check the basedir */
- if (php_check_open_basedir((*filename)->value.str.val)) {
- if (newtime) efree(newtime);
- RETURN_FALSE;
- }
-
- /* create the file if it doesn't exist already */
- ret = VCWD_STAT((*filename)->value.str.val, &sb);
- if (ret == -1) {
- file = VCWD_FOPEN((*filename)->value.str.val, "w");
- if (file == NULL) {
- php_error(E_WARNING, "unable to create file %s because %s", (*filename)->value.str.val, strerror(errno));
- if (newtime) efree(newtime);
- RETURN_FALSE;
- }
- fclose(file);
- }
-
- ret = VCWD_UTIME((*filename)->value.str.val, newtime);
- if (newtime) efree(newtime);
- if (ret == -1) {
- php_error(E_WARNING, "utime failed: %s", strerror(errno));
- RETURN_FALSE;
- } else {
- RETURN_TRUE;
- }
-#endif
-}
-/* }}} */
-
-/* {{{ proto void clearstatcache(void)
- Clear file stat cache */
-PHP_FUNCTION(clearstatcache)
-{
- BLS_FETCH();
-
- if (BG(CurrentStatFile)) {
- efree(BG(CurrentStatFile));
- BG(CurrentStatFile) = NULL;
- }
-}
-/* }}} */
-
-#define IS_LINK_OPERATION() (type == 8 /* filetype */ || type == 14 /* is_link */ || type == 16 /* lstat */)
-
-/* {{{ php_stat
- */
-static void php_stat(const char *filename, php_stat_len filename_length, int type, pval *return_value)
-{
- zval *stat_dev,*stat_ino,*stat_mode,*stat_nlink,*stat_uid,*stat_gid,*stat_rdev,
- *stat_size, *stat_atime, *stat_mtime, *stat_ctime, *stat_blksize, *stat_blocks;
- struct stat *stat_sb;
- int rmask=S_IROTH,wmask=S_IWOTH,xmask=S_IXOTH; /* access rights defaults to other */
- char *stat_sb_names[13]={"dev","ino","mode","nlink","uid","gid","rdev",
- "size","atime","mtime","ctime","blksize","blocks"};
- BLS_FETCH();
-
- stat_sb = &BG(sb);
-
- if (!BG(CurrentStatFile) || strcmp(filename, BG(CurrentStatFile))) {
- if (!BG(CurrentStatFile) || filename_length > BG(CurrentStatLength)) {
- if (BG(CurrentStatFile)) {
- efree(BG(CurrentStatFile));
- }
- BG(CurrentStatLength) = filename_length;
- BG(CurrentStatFile) = estrndup(filename, filename_length);
- } else {
- memcpy(BG(CurrentStatFile), filename, filename_length+1);
- }
-#if HAVE_SYMLINK
- BG(lsb).st_mode = 0; /* mark lstat buf invalid */
-#endif
- if (VCWD_STAT(BG(CurrentStatFile), &BG(sb)) == -1) {
- if (!IS_LINK_OPERATION() && (type != 15 || errno != ENOENT)) { /* fileexists() test must print no error */
- php_error(E_WARNING, "stat failed for %s (errno=%d - %s)", BG(CurrentStatFile), errno, strerror(errno));
- }
- efree(BG(CurrentStatFile));
- BG(CurrentStatFile) = NULL;
- if (!IS_LINK_OPERATION()) { /* Don't require success for link operation */
- RETURN_FALSE;
- }
- }
- }
-
-#if HAVE_SYMLINK
- if (IS_LINK_OPERATION() && !BG(lsb).st_mode) {
- /* do lstat if the buffer is empty */
- if (VCWD_LSTAT(filename, &BG(lsb)) == -1) {
- php_error(E_WARNING, "lstat failed for %s (errno=%d - %s)", filename, errno, strerror(errno));
- RETURN_FALSE;
- }
- }
-#endif
-
-
- if (type >= 9 && type <= 11) {
- if(BG(sb).st_uid==getuid()) {
- rmask=S_IRUSR;
- wmask=S_IWUSR;
- xmask=S_IXUSR;
- } else if(BG(sb).st_gid==getgid()) {
- rmask=S_IRGRP;
- wmask=S_IWGRP;
- xmask=S_IXGRP;
- } else {
- int groups,n,i;
- gid_t *gids;
-
- groups = getgroups(0,NULL);
- if(groups) {
- gids=(gid_t *)emalloc(groups*sizeof(gid_t));
- n=getgroups(groups,gids);
- for(i=0;i<n;i++){
- if(BG(sb).st_gid==gids[i]) {
- rmask=S_IRGRP;
- wmask=S_IWGRP;
- xmask=S_IXGRP;
- break;
- }
- }
- efree(gids);
- }
- }
- }
-
- switch (type) {
- case 0: /* fileperms */
- RETURN_LONG((long)BG(sb).st_mode);
- case 1: /* fileinode */
- RETURN_LONG((long)BG(sb).st_ino);
- case 2: /* filesize */
- RETURN_LONG((long)BG(sb).st_size);
- case 3: /* fileowner */
- RETURN_LONG((long)BG(sb).st_uid);
- case 4: /* filegroup */
- RETURN_LONG((long)BG(sb).st_gid);
- case 5: /* fileatime */
- RETURN_LONG((long)BG(sb).st_atime);
- case 6: /* filemtime */
- RETURN_LONG((long)BG(sb).st_mtime);
- case 7: /* filectime */
- RETURN_LONG((long)BG(sb).st_ctime);
- case 8: /* filetype */
-#if HAVE_SYMLINK
- if (S_ISLNK(BG(lsb).st_mode)) {
- RETURN_STRING("link",1);
- }
-#endif
- switch(BG(sb).st_mode&S_IFMT) {
- case S_IFIFO: RETURN_STRING("fifo",1);
- case S_IFCHR: RETURN_STRING("char",1);
- case S_IFDIR: RETURN_STRING("dir",1);
- case S_IFBLK: RETURN_STRING("block",1);
- case S_IFREG: RETURN_STRING("file",1);
-#if defined(S_IFSOCK) && !defined(ZEND_WIN32)&&!defined(__BEOS__)
- case S_IFSOCK: RETURN_STRING("socket",1);
-#endif
- }
- php_error(E_WARNING,"Unknown file type (%d)",BG(sb).st_mode&S_IFMT);
- RETURN_STRING("unknown", 1);
- case 9: /*is writable*/
- if (getuid()==0) {
- RETURN_LONG(1); /* root */
- }
- RETURN_LONG((BG(sb).st_mode & wmask) != 0);
- case 10: /*is readable*/
- if (getuid()==0) {
- RETURN_LONG(1); /* root */
- }
- RETURN_LONG((BG(sb).st_mode&rmask)!=0);
- case 11: /*is executable*/
- if (getuid()==0) {
- xmask = S_IXROOT; /* root */
- }
- RETURN_LONG((BG(sb).st_mode&xmask)!=0 && !S_ISDIR(BG(sb).st_mode));
- case 12: /*is file*/
- RETURN_LONG(S_ISREG(BG(sb).st_mode));
- case 13: /*is dir*/
- RETURN_LONG(S_ISDIR(BG(sb).st_mode));
- case 14: /*is link*/
-#if HAVE_SYMLINK
- RETURN_LONG(S_ISLNK(BG(lsb).st_mode));
-#else
- RETURN_FALSE;
-#endif
- case 15: /*file exists*/
- RETURN_TRUE; /* the false case was done earlier */
- case 16: /* lstat */
-#if HAVE_SYMLINK
- stat_sb = &BG(lsb);
-#endif
- /* FALLTHROUGH */
- case 17: /* stat */
- if (array_init(return_value) == FAILURE) {
- RETURN_FALSE;
- }
-
- MAKE_LONG_ZVAL_INCREF(stat_dev, stat_sb->st_dev);
- MAKE_LONG_ZVAL_INCREF(stat_ino, stat_sb->st_ino);
- MAKE_LONG_ZVAL_INCREF(stat_mode, stat_sb->st_mode);
- MAKE_LONG_ZVAL_INCREF(stat_nlink, stat_sb->st_nlink);
- MAKE_LONG_ZVAL_INCREF(stat_uid, stat_sb->st_uid);
- MAKE_LONG_ZVAL_INCREF(stat_gid, stat_sb->st_gid);
-#ifdef HAVE_ST_RDEV
- MAKE_LONG_ZVAL_INCREF(stat_rdev, stat_sb->st_rdev);
-#else
- MAKE_LONG_ZVAL_INCREF(stat_rdev, -1);
-#endif
- MAKE_LONG_ZVAL_INCREF(stat_size, stat_sb->st_size);
- MAKE_LONG_ZVAL_INCREF(stat_atime, stat_sb->st_atime);
- MAKE_LONG_ZVAL_INCREF(stat_mtime, stat_sb->st_mtime);
- MAKE_LONG_ZVAL_INCREF(stat_ctime, stat_sb->st_ctime);
-#ifdef HAVE_ST_BLKSIZE
- MAKE_LONG_ZVAL_INCREF(stat_blksize, stat_sb->st_blksize);
-#else
- MAKE_LONG_ZVAL_INCREF(stat_blksize,-1);
-#endif
-#ifdef HAVE_ST_BLOCKS
- MAKE_LONG_ZVAL_INCREF(stat_blocks, stat_sb->st_blocks);
-#else
- MAKE_LONG_ZVAL_INCREF(stat_blocks,-1);
-#endif
- /* Store numeric indexes in propper order */
- zend_hash_next_index_insert(HASH_OF(return_value),(void *)&stat_dev, sizeof(zval *), NULL);
- zend_hash_next_index_insert(HASH_OF(return_value),(void *)&stat_ino, sizeof(zval *), NULL);
- zend_hash_next_index_insert(HASH_OF(return_value),(void *)&stat_mode, sizeof(zval *), NULL);
- zend_hash_next_index_insert(HASH_OF(return_value),(void *)&stat_nlink, sizeof(zval *), NULL);
- zend_hash_next_index_insert(HASH_OF(return_value),(void *)&stat_uid, sizeof(zval *), NULL);
- zend_hash_next_index_insert(HASH_OF(return_value),(void *)&stat_gid, sizeof(zval *), NULL);
- zend_hash_next_index_insert(HASH_OF(return_value),(void *)&stat_rdev, sizeof(zval *), NULL);
- zend_hash_next_index_insert(HASH_OF(return_value),(void *)&stat_size, sizeof(zval *), NULL);
- zend_hash_next_index_insert(HASH_OF(return_value),(void *)&stat_atime, sizeof(zval *), NULL);
- zend_hash_next_index_insert(HASH_OF(return_value),(void *)&stat_mtime, sizeof(zval *), NULL);
- zend_hash_next_index_insert(HASH_OF(return_value),(void *)&stat_ctime, sizeof(zval *), NULL);
- zend_hash_next_index_insert(HASH_OF(return_value),(void *)&stat_blksize, sizeof(zval *), NULL);
- zend_hash_next_index_insert(HASH_OF(return_value),(void *)&stat_blocks, sizeof(zval *), NULL);
-
- /* Store string indexes referencing the same zval*/
- zend_hash_update(HASH_OF(return_value),stat_sb_names[0],strlen(stat_sb_names[0])+1,(void *)&stat_dev, sizeof(zval *), NULL);
- zend_hash_update(HASH_OF(return_value),stat_sb_names[1],strlen(stat_sb_names[1])+1,(void *)&stat_ino, sizeof(zval *), NULL);
- zend_hash_update(HASH_OF(return_value),stat_sb_names[2],strlen(stat_sb_names[2])+1,(void *)&stat_mode, sizeof(zval *), NULL);
- zend_hash_update(HASH_OF(return_value),stat_sb_names[3],strlen(stat_sb_names[3])+1,(void *)&stat_nlink, sizeof(zval *), NULL);
- zend_hash_update(HASH_OF(return_value),stat_sb_names[4],strlen(stat_sb_names[4])+1,(void *)&stat_uid, sizeof(zval *), NULL);
- zend_hash_update(HASH_OF(return_value),stat_sb_names[5],strlen(stat_sb_names[5])+1,(void *)&stat_gid, sizeof(zval *), NULL);
- zend_hash_update(HASH_OF(return_value),stat_sb_names[6],strlen(stat_sb_names[6])+1,(void *)&stat_rdev, sizeof(zval *), NULL);
- zend_hash_update(HASH_OF(return_value),stat_sb_names[7],strlen(stat_sb_names[7])+1,(void *)&stat_size, sizeof(zval *), NULL);
- zend_hash_update(HASH_OF(return_value),stat_sb_names[8],strlen(stat_sb_names[8])+1,(void *)&stat_atime, sizeof(zval *), NULL);
- zend_hash_update(HASH_OF(return_value),stat_sb_names[9],strlen(stat_sb_names[9])+1,(void *)&stat_mtime, sizeof(zval *), NULL);
- zend_hash_update(HASH_OF(return_value),stat_sb_names[10],strlen(stat_sb_names[10])+1,(void *)&stat_ctime, sizeof(zval *), NULL);
- zend_hash_update(HASH_OF(return_value),stat_sb_names[11],strlen(stat_sb_names[11])+1,(void *)&stat_blksize, sizeof(zval *), NULL);
- zend_hash_update(HASH_OF(return_value),stat_sb_names[12],strlen(stat_sb_names[12])+1,(void *)&stat_blocks, sizeof(zval *), NULL);
-
- return;
- }
- php_error(E_WARNING, "didn't understand stat call");
- RETURN_FALSE;
-}
-/* }}} */
-
-/* another quickie macro to make defining similar functions easier */
-#define FileFunction(name, funcnum) \
-void name(INTERNAL_FUNCTION_PARAMETERS) { \
- pval **filename; \
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &filename) == FAILURE) { \
- WRONG_PARAM_COUNT; \
- } \
- convert_to_string_ex(filename); \
- php_stat(Z_STRVAL_PP(filename), (php_stat_len) Z_STRLEN_PP(filename), funcnum, return_value); \
-}
-
-/* {{{ proto int fileperms(string filename)
- Get file permissions */
-FileFunction(PHP_FN(fileperms),0)
-/* }}} */
-
-/* {{{ proto int fileinode(string filename)
- Get file inode */
-FileFunction(PHP_FN(fileinode),1)
-/* }}} */
-
-/* {{{ proto int filesize(string filename)
- Get file size */
-FileFunction(PHP_FN(filesize), 2)
-/* }}} */
-
-/* {{{ proto int fileowner(string filename)
- Get file owner */
-FileFunction(PHP_FN(fileowner),3)
-/* }}} */
-
-/* {{{ proto int filegroup(string filename)
- Get file group */
-FileFunction(PHP_FN(filegroup),4)
-/* }}} */
-
-/* {{{ proto int fileatime(string filename)
- Get last access time of file */
-FileFunction(PHP_FN(fileatime),5)
-/* }}} */
-
-/* {{{ proto int filemtime(string filename)
- Get last modification time of file */
-FileFunction(PHP_FN(filemtime),6)
-/* }}} */
-
-/* {{{ proto int filectime(string filename)
- Get inode modification time of file */
-FileFunction(PHP_FN(filectime),7)
-/* }}} */
-
-/* {{{ proto string filetype(string filename)
- Get file type */
-FileFunction(PHP_FN(filetype), 8)
-/* }}} */
-
-/* {{{ proto int is_writable(string filename)
- Returns true if file can be written */
-FileFunction(PHP_FN(is_writable), 9)
-/* }}} */
-
-/* {{{ proto int is_readable(string filename)
- Returns true if file can be read */
-FileFunction(PHP_FN(is_readable),10)
-/* }}} */
-
-/* {{{ proto int is_executable(string filename)
- Returns true if file is executable */
-FileFunction(PHP_FN(is_executable),11)
-/* }}} */
-
-/* {{{ proto int is_file(string filename)
- Returns true if file is a regular file */
-FileFunction(PHP_FN(is_file),12)
-/* }}} */
-
-/* {{{ proto int is_dir(string filename)
- Returns true if file is directory */
-FileFunction(PHP_FN(is_dir),13)
-/* }}} */
-
-/* {{{ proto int is_link(string filename)
- Returns true if file is symbolic link */
-FileFunction(PHP_FN(is_link),14)
-/* }}} */
-
-/* {{{ proto bool file_exists(string filename)
- Returns true if filename exists */
-FileFunction(PHP_FN(file_exists),15)
-/* }}} */
-
-/* {{{ proto array lstat(string filename)
- Give information about a file or symbolic link */
-FileFunction(php_if_lstat, 16)
-/* }}} */
-
-/* {{{ proto array stat(string filename)
- Give information about a file */
-FileFunction(php_if_stat,17)
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/standard/flock_compat.c b/ext/standard/flock_compat.c
deleted file mode 100644
index 38b387f8b2..0000000000
--- a/ext/standard/flock_compat.c
+++ /dev/null
@@ -1,225 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Sascha Schumann <sascha@schumann.cx> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#include <php.h>
-#include <errno.h>
-#include "ext/standard/flock_compat.h"
-
-#if HAVE_STRUCT_FLOCK
-#include <unistd.h>
-#include <fcntl.h>
-#endif
-
-#ifdef PHP_WIN32
-#include <windows.h>
-#include <io.h>
-#endif
-
-#ifndef HAVE_FLOCK
-int flock(int fd, int operation)
-#if HAVE_STRUCT_FLOCK
-{
- struct flock flck;
- int ret;
-
- flck.l_start = flck.l_len = 0;
- flck.l_whence = SEEK_SET;
-
- if (operation & LOCK_SH)
- flck.l_type = F_RDLCK;
- else if (operation & LOCK_EX)
- flck.l_type = F_WRLCK;
- else if (operation & LOCK_UN)
- flck.l_type = F_UNLCK;
- else {
- errno = EINVAL;
- return -1;
- }
-
- ret = fcntl(fd, operation & LOCK_NB ? F_SETLK : F_SETLKW, &flck);
-
- if (operation & LOCK_NB && ret == -1 &&
- (errno == EACCES || errno == EAGAIN))
- errno = EWOULDBLOCK;
-
- if (ret != -1) ret = 0;
-
- return ret;
-}
-#elif defined(PHP_WIN32)
-/*
- * Program: Unix compatibility routines
- *
- * Author: Mark Crispin
- * Networks and Distributed Computing
- * Computing & Communications
- * University of Washington
- * Administration Building, AG-44
- * Seattle, WA 98195
- * Internet: MRC@CAC.Washington.EDU
- *
- * Date: 14 September 1996
- * Last Edited: 14 August 1997
- *
- * Copyright 1997 by the University of Washington
- *
- * Permission to use, copy, modify, and distribute this software and its
- * documentation for any purpose and without fee is hereby granted, provided
- * that the above copyright notice appears in all copies and that both the
- * above copyright notice and this permission notice appear in supporting
- * documentation, and that the name of the University of Washington not be
- * used in advertising or publicity pertaining to distribution of the software
- * without specific, written prior permission. This software is made available
- * "as is", and
- * THE UNIVERSITY OF WASHINGTON DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED,
- * WITH REGARD TO THIS SOFTWARE, INCLUDING WITHOUT LIMITATION ALL IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, AND IN
- * NO EVENT SHALL THE UNIVERSITY OF WASHINGTON BE LIABLE FOR ANY SPECIAL,
- * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
- * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, TORT
- * (INCLUDING NEGLIGENCE) OR STRICT LIABILITY, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- */
-/* DEDICATION
-
- * This file is dedicated to my dog, Unix, also known as Yun-chan and
- * Unix J. Terwilliker Jehosophat Aloysius Monstrosity Animal Beast. Unix
- * passed away at the age of 11 1/2 on September 14, 1996, 12:18 PM PDT, after
- * a two-month bout with cirrhosis of the liver.
- *
- * He was a dear friend, and I miss him terribly.
- *
- * Lift a leg, Yunie. Luv ya forever!!!!
- */
-{
- HANDLE hdl = (HANDLE) _get_osfhandle(fd);
- DWORD low = 1, high = 0;
- OVERLAPPED offset =
- {0, 0, 0, 0, NULL};
- if (hdl < 0)
- return -1; /* error in file descriptor */
- /* bug for bug compatible with Unix */
- UnlockFileEx(hdl, 0, low, high, &offset);
- switch (operation & ~LOCK_NB) { /* translate to LockFileEx() op */
- case LOCK_EX: /* exclusive */
- if (LockFileEx(hdl, LOCKFILE_EXCLUSIVE_LOCK +
- ((operation & LOCK_NB) ? LOCKFILE_FAIL_IMMEDIATELY : 0),
- 0, low, high, &offset))
- return 0;
- break;
- case LOCK_SH: /* shared */
- if (LockFileEx(hdl, ((operation & LOCK_NB) ? LOCKFILE_FAIL_IMMEDIATELY : 0),
- 0, low, high, &offset))
- return 0;
- break;
- case LOCK_UN: /* unlock */
- return 0; /* always succeeds */
- default: /* default */
- break;
- }
- /* Under Win32 MT library, errno is not a variable but a function call,
- * which cannot be assigned to.
- */
-#if !defined(PHP_WIN32)
- errno = EINVAL; /* bad call */
-#endif
- return -1;
-}
-#else
-#warning no proper flock support for your site
-{
- errno = 0;
- return 0;
-}
-#endif
-#endif /* !defined(HAVE_FLOCK) */
-
-#if !(HAVE_INET_ATON)
-/* {{{ inet_aton
- * Check whether "cp" is a valid ascii representation
- * of an Internet address and convert to a binary address.
- * Returns 1 if the address is valid, 0 if not.
- * This replaces inet_addr, the return value from which
- * cannot distinguish between failure and a local broadcast address.
- */
-int inet_aton(const char *cp, struct in_addr *ap)
-{
- int dots = 0;
- register unsigned long acc = 0, addr = 0;
-
- do {
- register char cc = *cp;
-
- switch (cc) {
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9':
- acc = acc * 10 + (cc - '0');
- break;
-
- case '.':
- if (++dots > 3) {
- return 0;
- }
- /* Fall through */
-
- case '\0':
- if (acc > 255) {
- return 0;
- }
- addr = addr << 8 | acc;
- acc = 0;
- break;
-
- default:
- return 0;
- }
- } while (*cp++) ;
-
- /* Normalize the address */
- if (dots < 3) {
- addr <<= 8 * (3 - dots) ;
- }
-
- /* Store it if requested */
- if (ap) {
- ap->s_addr = htonl(addr);
- }
-
- return 1;
-}
-/* }}} */
-#endif /* !HAVE_INET_ATON */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/standard/flock_compat.h b/ext/standard/flock_compat.h
deleted file mode 100644
index c2e8d5e670..0000000000
--- a/ext/standard/flock_compat.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Sascha Schumann <sascha@schumann.cx> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef FLOCK_COMPAT_H
-#define FLOCK_COMPAT_H
-
-#ifndef HAVE_FLOCK
-# define LOCK_SH 1
-# define LOCK_EX 2
-# define LOCK_NB 4
-# define LOCK_UN 8
-int flock(int fd, int operation);
-#endif
-
-#ifdef PHP_WIN32
-#define EWOULDBLOCK WSAEWOULDBLOCK
-# define fsync _commit
-# define ftruncate(a,b) chsize(a,b)
-#endif /* defined(PHP_WIN32) */
-
-#if !HAVE_INET_ATON
-#if HAVE_NETINET_IN_H
-#include <netinet/in.h>
-#endif
-#if HAVE_ARPA_INET_H
-#include <arpa/inet.h>
-#endif
-
-extern int inet_aton(const char *, struct in_addr *);
-#endif
-
-#endif /* FLOCK_COMPAT_H */
diff --git a/ext/standard/formatted_print.c b/ext/standard/formatted_print.c
deleted file mode 100644
index 4ccdc40723..0000000000
--- a/ext/standard/formatted_print.c
+++ /dev/null
@@ -1,670 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Stig Sæther Bakken <ssb@guardian.no> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#include <math.h> /* modf() */
-#include "php.h"
-#include "ext/standard/head.h"
-#include "php_string.h"
-#include "zend_execute.h"
-#include <stdio.h>
-
-#define ALIGN_LEFT 0
-#define ALIGN_RIGHT 1
-#define ADJ_WIDTH 1
-#define ADJ_PRECISION 2
-#define NUM_BUF_SIZE 500
-#define NDIG 80
-#define FLOAT_DIGITS 6
-#define FLOAT_PRECISION 6
-#define MAX_FLOAT_DIGITS 38
-#define MAX_FLOAT_PRECISION 40
-
-#if 0
-/* trick to control varargs functions through cpp */
-# define PRINTF_DEBUG(arg) php_printf arg
-#else
-# define PRINTF_DEBUG(arg)
-#endif
-
-static char hexchars[] = "0123456789abcdef";
-static char HEXCHARS[] = "0123456789ABCDEF";
-
-
-/*
- * cvt.c - IEEE floating point formatting routines for FreeBSD
- * from GNU libc-4.6.27
- */
-
-/*
- * php_convert_to_decimal converts to decimal
- * the number of digits is specified by ndigit
- * decpt is set to the position of the decimal point
- * sign is set to 0 for positive, 1 for negative
- */
-static char *php_convert_to_decimal(double arg, int ndigits, int *decpt, int *sign, int eflag)
-{
- register int r2;
- double fi, fj;
- register char *p, *p1;
- /*THREADX*/
-#ifndef THREAD_SAFE
- static char cvt_buf[NDIG];
-#endif
-
- if (ndigits >= NDIG - 1)
- ndigits = NDIG - 2;
- r2 = 0;
- *sign = 0;
- p = &cvt_buf[0];
- if (arg < 0) {
- *sign = 1;
- arg = -arg;
- }
- arg = modf(arg, &fi);
- p1 = &cvt_buf[NDIG];
- /*
- * Do integer part
- */
- if (fi != 0) {
- p1 = &cvt_buf[NDIG];
- while (fi != 0) {
- fj = modf(fi / 10, &fi);
- *--p1 = (int) ((fj + .03) * 10) + '0';
- r2++;
- }
- while (p1 < &cvt_buf[NDIG])
- *p++ = *p1++;
- } else if (arg > 0) {
- while ((fj = arg * 10.0) < 0.9999999) {
- arg = fj;
- r2--;
- }
- }
- p1 = &cvt_buf[ndigits];
- if (eflag == 0)
- p1 += r2;
- *decpt = r2;
- if (p1 < &cvt_buf[0]) {
- cvt_buf[0] = '\0';
- return (cvt_buf);
- }
- while (p <= p1 && p < &cvt_buf[NDIG]) {
- arg *= 10;
- arg = modf(arg, &fj);
- *p++ = (int) fj + '0';
- }
- if (p1 >= &cvt_buf[NDIG]) {
- cvt_buf[NDIG - 1] = '\0';
- return (cvt_buf);
- }
- p = p1;
- *p1 += 5;
- while (*p1 > '9') {
- *p1 = '0';
- if (p1 > cvt_buf)
- ++ * --p1;
- else {
- *p1 = '1';
- (*decpt)++;
- if (eflag == 0) {
- if (p > cvt_buf)
- *p = '0';
- p++;
- }
- }
- }
- *p = '\0';
- return (cvt_buf);
-}
-
-
-inline static void
-php_sprintf_appendchar(char **buffer, int *pos, int *size, char add)
-{
- if ((*pos + 1) >= *size) {
- *size <<= 1;
- PRINTF_DEBUG(("%s: ereallocing buffer to %d bytes\n", get_active_function_name(), *size));
- *buffer = erealloc(*buffer, *size);
- }
- PRINTF_DEBUG(("sprintf: appending '%c', pos=\n", add, *pos));
- (*buffer)[(*pos)++] = add;
-}
-
-
-inline static void
-php_sprintf_appendstring(char **buffer, int *pos, int *size, char *add,
- int min_width, int max_width, char padding,
- int alignment, int len, int sign, int expprec)
-{
- register int npad;
-
- npad = min_width - MIN(len, (expprec ? max_width : len));
-
- if (npad < 0) {
- npad = 0;
- }
-
- PRINTF_DEBUG(("sprintf: appendstring(%x, %d, %d, \"%s\", %d, '%c', %d)\n",
- *buffer, *pos, *size, add, min_width, padding, alignment));
- if ((max_width == 0) && (! expprec)) {
- max_width = MAX(min_width, len);
- }
- if ((*pos + max_width) >= *size) {
- while ((*pos + max_width) >= *size) {
- *size <<= 1;
- }
- PRINTF_DEBUG(("sprintf ereallocing buffer to %d bytes\n", *size));
- *buffer = erealloc(*buffer, *size);
- }
- if (alignment == ALIGN_RIGHT) {
- if (sign && padding=='0') {
- (*buffer)[(*pos)++] = '-';
- add++;
- len--;
- }
- while (npad-- > 0) {
- (*buffer)[(*pos)++] = padding;
- }
- }
- PRINTF_DEBUG(("sprintf: appending \"%s\"\n", add));
- memcpy(&(*buffer)[*pos], add, MIN(max_width, len)+1);
- *pos += MIN(max_width, len);
- if (alignment == ALIGN_LEFT) {
- while (npad--) {
- (*buffer)[(*pos)++] = padding;
- }
- }
-}
-
-
-inline static void
-php_sprintf_appendint(char **buffer, int *pos, int *size, int number,
- int width, char padding, int alignment)
-{
- char numbuf[NUM_BUF_SIZE];
- register unsigned int magn, nmagn, i = NUM_BUF_SIZE - 1, neg = 0;
-
- PRINTF_DEBUG(("sprintf: appendint(%x, %x, %x, %d, %d, '%c', %d)\n",
- *buffer, pos, size, number, width, padding, alignment));
- if (number < 0) {
- neg = 1;
- magn = ((unsigned int) -(number + 1)) + 1;
- } else {
- magn = (unsigned int) number;
- }
-
- /* Can't right-pad 0's on integers */
- if(alignment==0 && padding=='0') padding=' ';
-
- numbuf[i] = '\0';
-
- do {
- nmagn = magn / 10;
-
- numbuf[--i] = (magn - (nmagn * 10)) + '0';
- magn = nmagn;
- }
- while (magn > 0 && i > 0);
- if (neg) {
- numbuf[--i] = '-';
- }
- PRINTF_DEBUG(("sprintf: appending %d as \"%s\", i=%d\n",
- number, &numbuf[i], i));
- php_sprintf_appendstring(buffer, pos, size, &numbuf[i], width, 0,
- padding, alignment, (NUM_BUF_SIZE - 1) - i,
- neg, 0);
-}
-
-inline static void
-php_sprintf_appenduint(char **buffer, int *pos, int *size, int number,
- int width, char padding, int alignment)
-{
- char numbuf[NUM_BUF_SIZE];
- register unsigned int magn, nmagn, i = NUM_BUF_SIZE - 1;
-
- PRINTF_DEBUG(("sprintf: appenduint(%x, %x, %x, %d, %d, '%c', %d)\n",
- *buffer, pos, size, number, width, padding, alignment));
- magn = (unsigned int) number;
-
- /* Can't right-pad 0's on integers */
- if (alignment == 0 && padding == '0') padding = ' ';
-
- numbuf[i] = '\0';
-
- do {
- nmagn = magn / 10;
-
- numbuf[--i] = (magn - (nmagn * 10)) + '0';
- magn = nmagn;
- }
- while (magn > 0 && i > 0);
- PRINTF_DEBUG(("sprintf: appending %d as \"%s\", i=%d\n", number, &numbuf[i], i));
- php_sprintf_appendstring(buffer, pos, size, &numbuf[i], width, 0,
- padding, alignment, (NUM_BUF_SIZE - 1) - i, 0, 0);
-}
-
-inline static void
-php_sprintf_appenddouble(char **buffer, int *pos,
- int *size, double number,
- int width, char padding,
- int alignment, int precision,
- int adjust, char fmt)
-{
- char numbuf[NUM_BUF_SIZE];
- char *cvt;
- register int i = 0, j = 0;
- int sign, decpt;
-
- PRINTF_DEBUG(("sprintf: appenddouble(%x, %x, %x, %f, %d, '%c', %d, %c)\n",
- *buffer, pos, size, number, width, padding, alignment, fmt));
- if ((adjust & ADJ_PRECISION) == 0) {
- precision = FLOAT_PRECISION;
- } else if (precision > MAX_FLOAT_PRECISION) {
- precision = MAX_FLOAT_PRECISION;
- }
-
- if (zend_isnan(number)) {
- sign = (number<0);
- php_sprintf_appendstring(buffer, pos, size, "NaN", 3, 0, padding,
- alignment, precision, sign, 0);
- return;
- }
-
- if (zend_isinf(number)) {
- sign = (number<0);
- php_sprintf_appendstring(buffer, pos, size, "INF", 3, 0, padding,
- alignment, precision, sign, 0);
- return;
- }
-
- cvt = php_convert_to_decimal(number, precision, &decpt, &sign, (fmt == 'e'));
-
- if (sign) {
- numbuf[i++] = '-';
- }
-
- if (fmt == 'f') {
- if (decpt <= 0) {
- numbuf[i++] = '0';
- if (precision > 0) {
- int k = precision;
- numbuf[i++] = '.';
- while ((decpt++ < 0) && k--) {
- numbuf[i++] = '0';
- }
- }
- } else {
- while (decpt-- > 0)
- numbuf[i++] = cvt[j++];
- if (precision > 0)
- numbuf[i++] = '.';
- }
- } else {
- numbuf[i++] = cvt[j++];
- if (precision > 0)
- numbuf[i++] = '.';
- }
-
- while (cvt[j]) {
- numbuf[i++] = cvt[j++];
- }
-
- numbuf[i] = '\0';
-
- if (precision > 0) {
- width += (precision + 1);
- }
- php_sprintf_appendstring(buffer, pos, size, numbuf, width, 0, padding,
- alignment, i, sign, 0);
-}
-
-
-inline static void
-php_sprintf_append2n(char **buffer, int *pos, int *size, int number,
- int width, char padding, int alignment, int n,
- char *chartable, int expprec)
-{
- char numbuf[NUM_BUF_SIZE];
- register unsigned int num, i = NUM_BUF_SIZE - 1, neg = 0;
- register int andbits = (1 << n) - 1;
-
- PRINTF_DEBUG(("sprintf: append2n(%x, %x, %x, %d, %d, '%c', %d, %d, %x)\n",
- *buffer, pos, size, number, width, padding, alignment, n,
- chartable));
- PRINTF_DEBUG(("sprintf: append2n 2^%d andbits=%x\n", n, andbits));
-
- if (number < 0) {
- neg = 1;
- num = ((unsigned int) -(number + 1)) + 1;
- } else {
- num = (unsigned int) number;
- }
-
- numbuf[i] = '\0';
-
- do {
- numbuf[--i] = chartable[(num & andbits)];
- num >>= n;
- }
- while (num > 0);
-
- if (neg) {
- numbuf[--i] = '-';
- }
- php_sprintf_appendstring(buffer, pos, size, &numbuf[i], width, 0,
- padding, alignment, (NUM_BUF_SIZE - 1) - i,
- neg, expprec);
-}
-
-
-inline static int
-php_sprintf_getnumber(char *buffer, int *pos)
-{
- char *endptr;
- register int num = strtol(&buffer[*pos], &endptr, 10);
- register int i = 0;
-
- if (endptr != NULL) {
- i = (endptr - &buffer[*pos]);
- }
- PRINTF_DEBUG(("sprintf_getnumber: number was %d bytes long\n", i));
- *pos += i;
- return num;
-}
-
-/* {{{ php_formatted_print
- * New sprintf implementation for PHP.
- *
- * Modifiers:
- *
- * " " pad integers with spaces
- * "-" left adjusted field
- * n field size
- * "."n precision (floats only)
- *
- * Type specifiers:
- *
- * "%" literal "%", modifiers are ignored.
- * "b" integer argument is printed as binary
- * "c" integer argument is printed as a single character
- * "d" argument is an integer
- * "f" the argument is a float
- * "o" integer argument is printed as octal
- * "s" argument is a string
- * "x" integer argument is printed as lowercase hexadecimal
- * "X" integer argument is printed as uppercase hexadecimal
- *
- */
-static char *
-php_formatted_print(int ht, int *len)
-{
- pval ***args;
- int argc, size = 240, inpos = 0, outpos = 0, temppos;
- int alignment, width, precision, currarg, adjusting, argnum;
- char *format, *result, padding;
-
- argc = ZEND_NUM_ARGS();
-
- if (argc < 1) {
- WRONG_PARAM_COUNT_WITH_RETVAL(NULL);
- }
- args = (pval ***)emalloc(argc * sizeof(pval *));
-
- if (zend_get_parameters_array_ex(argc, args) == FAILURE) {
- efree(args);
- WRONG_PARAM_COUNT_WITH_RETVAL(NULL);
- }
- convert_to_string_ex(args[0]);
- format = (*args[0])->value.str.val;
- result = emalloc(size);
-
- currarg = 1;
-
- while (inpos<(*args[0])->value.str.len) {
- int expprec = 0;
-
- PRINTF_DEBUG(("sprintf: format[%d]='%c'\n", inpos, format[inpos]));
- PRINTF_DEBUG(("sprintf: outpos=%d\n", outpos));
- if (format[inpos] != '%') {
- php_sprintf_appendchar(&result, &outpos, &size, format[inpos++]);
- } else if (format[inpos + 1] == '%') {
- php_sprintf_appendchar(&result, &outpos, &size, '%');
- inpos += 2;
- } else {
- if (currarg >= argc && format[inpos + 1] != '%') {
- efree(result);
- efree(args);
- php_error(E_WARNING, "%s(): too few arguments",get_active_function_name());
- return NULL;
- }
- /* starting a new format specifier, reset variables */
- alignment = ALIGN_RIGHT;
- adjusting = 0;
- padding = ' ';
- inpos++; /* skip the '%' */
-
- PRINTF_DEBUG(("sprintf: first looking at '%c', inpos=%d\n",
- format[inpos], inpos));
- if (isascii((int)format[inpos]) && !isalpha((int)format[inpos])) {
- /* first look for argnum */
- temppos = inpos;
- while (isdigit((int)format[temppos])) temppos++;
- if (format[temppos] == '$') {
- argnum = php_sprintf_getnumber(format, &inpos);
- inpos++; /* skip the '$' */
- } else {
- argnum = currarg++;
- }
- if (argnum >= argc) {
- efree(result);
- efree(args);
- php_error(E_WARNING, "%s(): too few arguments",get_active_function_name());
- return NULL;
- }
-
- /* after argnum comes modifiers */
- PRINTF_DEBUG(("sprintf: looking for modifiers\n"
- "sprintf: now looking at '%c', inpos=%d\n",
- format[inpos], inpos));
- for (;; inpos++) {
- if (format[inpos] == ' ' || format[inpos] == '0') {
- padding = format[inpos];
- } else if (format[inpos] == '-') {
- alignment = ALIGN_LEFT;
- /* space padding, the default */
- } else if (format[inpos] == '\'') {
- padding = format[++inpos];
- } else {
- PRINTF_DEBUG(("sprintf: end of modifiers\n"));
- break;
- }
- }
- PRINTF_DEBUG(("sprintf: padding='%c'\n", padding));
- PRINTF_DEBUG(("sprintf: alignment=%s\n",
- (alignment == ALIGN_LEFT) ? "left" : "right"));
-
-
- /* after modifiers comes width */
- if (isdigit((int)format[inpos])) {
- PRINTF_DEBUG(("sprintf: getting width\n"));
- width = php_sprintf_getnumber(format, &inpos);
- adjusting |= ADJ_WIDTH;
- } else {
- width = 0;
- }
- PRINTF_DEBUG(("sprintf: width=%d\n", width));
-
- /* after width and argnum comes precision */
- if (format[inpos] == '.') {
- inpos++;
- PRINTF_DEBUG(("sprintf: getting precision\n"));
- if (isdigit((int)format[inpos])) {
- precision = php_sprintf_getnumber(format, &inpos);
- adjusting |= ADJ_PRECISION;
- expprec = 1;
- } else {
- precision = 0;
- }
- } else {
- precision = 0;
- }
- PRINTF_DEBUG(("sprintf: precision=%d\n", precision));
- } else {
- width = precision = 0;
- argnum = currarg++;
- }
-
- if (format[inpos] == 'l') {
- inpos++;
- }
- PRINTF_DEBUG(("sprintf: format character='%c'\n", format[inpos]));
- /* now we expect to find a type specifier */
- switch (format[inpos]) {
- case 's':
- convert_to_string_ex(args[argnum]);
- php_sprintf_appendstring(&result, &outpos, &size,
- (*args[argnum])->value.str.val,
- width, precision, padding,
- alignment,
- (*args[argnum])->value.str.len,
- 0, expprec);
- break;
-
- case 'd':
- convert_to_long_ex(args[argnum]);
- php_sprintf_appendint(&result, &outpos, &size,
- (*args[argnum])->value.lval,
- width, padding, alignment);
- break;
-
- case 'u':
- convert_to_long_ex(args[argnum]);
- php_sprintf_appenduint(&result, &outpos, &size,
- (*args[argnum])->value.lval,
- width, padding, alignment);
- break;
-
- case 'e':
- case 'f':
- /* XXX not done */
- convert_to_double_ex(args[argnum]);
- php_sprintf_appenddouble(&result, &outpos, &size,
- (*args[argnum])->value.dval,
- width, padding, alignment,
- precision, adjusting,
- format[inpos]);
- break;
-
- case 'c':
- convert_to_long_ex(args[argnum]);
- php_sprintf_appendchar(&result, &outpos, &size,
- (char) (*args[argnum])->value.lval);
- break;
-
- case 'o':
- convert_to_long_ex(args[argnum]);
- php_sprintf_append2n(&result, &outpos, &size,
- (*args[argnum])->value.lval,
- width, padding, alignment, 3,
- hexchars, expprec);
- break;
-
- case 'x':
- convert_to_long_ex(args[argnum]);
- php_sprintf_append2n(&result, &outpos, &size,
- (*args[argnum])->value.lval,
- width, padding, alignment, 4,
- hexchars, expprec);
- break;
-
- case 'X':
- convert_to_long_ex(args[argnum]);
- php_sprintf_append2n(&result, &outpos, &size,
- (*args[argnum])->value.lval,
- width, padding, alignment, 4,
- HEXCHARS, expprec);
- break;
-
- case 'b':
- convert_to_long_ex(args[argnum]);
- php_sprintf_append2n(&result, &outpos, &size,
- (*args[argnum])->value.lval,
- width, padding, alignment, 1,
- hexchars, expprec);
- break;
-
- case '%':
- php_sprintf_appendchar(&result, &outpos, &size, '%');
-
- break;
- default:
- break;
- }
- inpos++;
- }
- }
-
- efree(args);
-
- /* possibly, we have to make sure we have room for the terminating null? */
- result[outpos]=0;
- *len = outpos;
- return result;
-}
-/* }}} */
-
-/* {{{ proto string sprintf(string format [, mixed arg1 [, mixed ...]])
- Return a formatted string */
-PHP_FUNCTION(user_sprintf)
-{
- char *result;
- int len;
-
- if ((result=php_formatted_print(ht,&len))==NULL) {
- RETURN_FALSE;
- }
- RETVAL_STRINGL(result,len,1);
- efree(result);
-}
-/* }}} */
-
-/* {{{ proto int printf(string format [, mixed arg1 [, mixed ...]])
- Output a formatted string */
-PHP_FUNCTION(user_printf)
-{
- char *result;
- int len;
-
- if ((result=php_formatted_print(ht,&len))==NULL) {
- RETURN_FALSE;
- }
- PHPWRITE(result,len);
- efree(result);
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/standard/fsock.c b/ext/standard/fsock.c
deleted file mode 100644
index a4f5148b5a..0000000000
--- a/ext/standard/fsock.c
+++ /dev/null
@@ -1,767 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Paul Panotzki - Bunyip Information Systems |
- | Jim Winstead <jimw@php.net> |
- | Sascha Schumann <sascha@schumann.cx> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-/* Synced with php 3.0 revision 1.121 1999-06-18 [ssb] */
-/* Synced with php 3.0 revision 1.133 1999-07-21 [sas] */
-
-#include "php.h"
-#include "php_globals.h"
-#include <stdlib.h>
-#include <stddef.h>
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-
-#ifdef HAVE_FCNTL_H
-# include <fcntl.h>
-#endif
-
-#ifdef HAVE_SYS_TIME_H
-# include <sys/time.h>
-#endif
-
-#include <sys/types.h>
-#ifdef HAVE_SYS_SOCKET_H
-#include <sys/socket.h>
-#endif
-#ifdef PHP_WIN32
-#include <winsock.h>
-#else
-#include <netinet/in.h>
-#include <netdb.h>
-#if HAVE_ARPA_INET_H
-#include <arpa/inet.h>
-#endif
-#endif
-#ifdef PHP_WIN32
-#undef AF_UNIX
-#endif
-#if defined(AF_UNIX)
-#include <sys/un.h>
-#endif
-#ifdef HAVE_SYS_SELECT_H
-#include <sys/select.h>
-#endif
-
-#include <string.h>
-#include <errno.h>
-
-#include "base64.h"
-#include "file.h"
-#include "url.h"
-#include "fsock.h"
-
-#include "php_network.h"
-
-#ifdef ZTS
-static int fsock_globals_id;
-#else
-extern int le_fp;
-#endif
-
-#define CLOSE_SOCK(free_sock) \
- if(socketd >= 0) { \
- close(socketd); \
- } \
- if (free_sock) { \
- efree(sock); \
- } \
- if (key) { \
- efree(key); \
- }
-
-#define SEARCHCR() \
- p = memchr(READPTR(sock), '\n', MIN(TOREAD(sock), maxlen));
-
-#ifdef PHP_WIN32
-#define EWOULDBLOCK WSAEWOULDBLOCK
-#else
-#include "build-defs.h"
-#endif
-
-/* {{{ php_lookup_hostname */
-
-/*
- * Converts a host name to an IP address.
- */
-PHPAPI int php_lookup_hostname(const char *addr, struct in_addr *in)
-{
- struct hostent *host_info;
-
- if (!inet_aton(addr, in)) {
- /* XXX NOT THREAD SAFE */
- host_info = gethostbyname(addr);
- if (host_info == 0) {
- /* Error: unknown host */
- return -1;
- }
- *in = *((struct in_addr *) host_info->h_addr);
- }
- return 0;
-}
-/* }}} */
-/* {{{ php_is_persistent_sock */
-
-PHPAPI int php_is_persistent_sock(int sock)
-{
- char *key;
- FLS_FETCH();
-
- if (zend_hash_find(&FG(ht_fsock_socks), (char *) &sock, sizeof(sock),
- (void **) &key) == SUCCESS) {
- return 1;
- }
- return 0;
-}
-/* }}} */
-/* {{{ php_fsockopen() */
-
-/*
- This function takes an optional third argument which should be
- passed by reference. The error code from the connect call is written
- to this variable.
-*/
-static void php_fsockopen(INTERNAL_FUNCTION_PARAMETERS, int persistent) {
- pval **args[5];
- int *sock=emalloc(sizeof(int));
- int *sockp;
- int arg_count=ZEND_NUM_ARGS();
- int socketd = -1;
- unsigned char udp = 0;
- struct timeval timeout = { 60, 0 };
- unsigned short portno;
- unsigned long conv;
- char *key = NULL;
- FLS_FETCH();
-
- if (arg_count > 5 || arg_count < 2 || zend_get_parameters_array_ex(arg_count,args)==FAILURE) {
- CLOSE_SOCK(1);
- WRONG_PARAM_COUNT;
- }
- switch(arg_count) {
- case 5:
- convert_to_double_ex(args[4]);
- conv = (unsigned long) ((*args[4])->value.dval * 1000000.0);
- timeout.tv_sec = conv / 1000000;
- timeout.tv_usec = conv % 1000000;
- /* fall-through */
- case 4:
- zval_dtor(*args[3]);
- ZVAL_STRING(*args[3],"",1);
- /* fall-through */
- case 3:
- zval_dtor(*args[2]);
- ZVAL_LONG(*args[2],0);
- break;
- }
- convert_to_string_ex(args[0]);
- convert_to_long_ex(args[1]);
- portno = (unsigned short) (*args[1])->value.lval;
-
- key = emalloc((*args[0])->value.str.len + 10);
- sprintf(key, "%s:%d", (*args[0])->value.str.val, portno);
-
- if (persistent && zend_hash_find(&FG(ht_fsock_keys), key, strlen(key) + 1,
- (void *) &sockp) == SUCCESS) {
- CLOSE_SOCK(0);
- *sock = *sockp;
- ZEND_REGISTER_RESOURCE(return_value,sock,php_file_le_socket());
- return;
- }
-
- if (portno) {
- struct sockaddr_in server;
-
- memset(&server, 0, sizeof(server));
- if(Z_STRLEN_PP(args[0]) >= 6 && !memcmp(Z_STRVAL_PP(args[0]), "udp://", sizeof("udp://")-1)) {
- udp = 1;
- }
-
- socketd = socket(AF_INET,udp ? SOCK_DGRAM : SOCK_STREAM,0);
-
- if (socketd == SOCK_ERR) {
- CLOSE_SOCK(1);
- RETURN_FALSE;
- }
-
- server.sin_family = AF_INET;
-
- if(php_lookup_hostname(udp ? &(*args[0])->value.str.val[6] : (*args[0])->value.str.val,&server.sin_addr)) {
- CLOSE_SOCK(1);
- RETURN_FALSE;
- }
-
- server.sin_port = htons(portno);
-
- if (php_connect_nonb(socketd, (struct sockaddr *)&server, sizeof(server), &timeout) == SOCK_CONN_ERR) {
- CLOSE_SOCK(1);
-
- if (arg_count>2) {
- zval_dtor(*args[2]);
- ZVAL_LONG(*args[2],errno);
- }
- if (arg_count>3) {
- zval_dtor(*args[3]);
- ZVAL_STRING(*args[3],strerror(errno),1);
- }
- RETURN_FALSE;
- }
-#if defined(AF_UNIX)
- } else {
- /* Unix domain socket. s->strval is socket name. */
- struct sockaddr_un unix_addr;
- socketd = socket(AF_UNIX,SOCK_STREAM,0);
- if (socketd == SOCK_ERR) {
- CLOSE_SOCK(1);
- RETURN_FALSE;
- }
-
- memset(&unix_addr, (char)0, sizeof(unix_addr));
- unix_addr.sun_family = AF_UNIX;
- strlcpy(unix_addr.sun_path, (*args[0])->value.str.val, sizeof(unix_addr.sun_path));
-
- if (php_connect_nonb(socketd, (struct sockaddr *) &unix_addr, sizeof(unix_addr), &timeout) == SOCK_CONN_ERR) {
- CLOSE_SOCK(1);
- if (arg_count>2) {
- zval_dtor(*args[2]);
- ZVAL_LONG(*args[2],errno);
- }
- if (arg_count>3) {
- zval_dtor(*args[3]);
- ZVAL_STRING(*args[3],strerror(errno),1);
- }
- RETURN_FALSE;
- }
-#endif /* AF_UNIX */
- }
-
-#if 0
- if ((fp = fdopen (socketd, "r+")) == NULL){
- RETURN_LONG(-6); /* FIXME */
- }
-
-#ifdef HAVE_SETVBUF
- if ((setvbuf(fp, NULL, _IONBF, 0)) != 0){
- RETURN_LONG(-7); /* FIXME */
- }
-#endif
-#endif
-
- *sock=socketd;
- if (persistent) {
- zend_hash_update(&FG(ht_fsock_keys), key, strlen(key) + 1,
- sock, sizeof(*sock), NULL);
- zend_hash_update(&FG(ht_fsock_socks), (char *) sock, sizeof(*sock),
- key, strlen(key) + 1, NULL);
- }
- if(key) efree(key);
-
- ZEND_REGISTER_RESOURCE(return_value,sock,php_file_le_socket());
-}
-/* }}} */
-
-/* {{{ proto int fsockopen(string hostname, int port [, int errno [, string errstr [, double timeout]]])
- Open Internet or Unix domain socket connection */
-PHP_FUNCTION(fsockopen)
-{
- php_fsockopen(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-/* }}} */
-/* {{{ proto int pfsockopen(string hostname, int port [, int errno [, string errstr [, double timeout]]])
- Open persistent Internet or Unix domain socket connection */
-PHP_FUNCTION(pfsockopen)
-{
- php_fsockopen(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
-}
-/* }}} */
-
-#define SOCK_DESTROY(sock) \
- if(sock->readbuf) pefree(sock->readbuf, sock->persistent); \
- if(sock->prev) sock->prev->next = sock->next; \
- if(sock->next) sock->next->prev = sock->prev; \
- if(sock == FG(phpsockbuf)) \
- FG(phpsockbuf) = sock->next; \
- pefree(sock, sock->persistent)
-
-PHPAPI void php_cleanup_sockbuf(int persistent FLS_DC)
-{
- php_sockbuf *now, *next;
-
- for(now = FG(phpsockbuf); now; now = next) {
- next = now->next;
- if(now->persistent == persistent) {
- SOCK_DESTROY(now);
- }
- }
-}
-
-#define TOREAD(sock) ((sock)->writepos - (sock)->readpos)
-#define READPTR(sock) ((sock)->readbuf + (sock)->readpos)
-#define WRITEPTR(sock) ((sock)->readbuf + (sock)->writepos)
-#define SOCK_FIND(sock,socket) \
- php_sockbuf *sock; \
- FLS_FETCH(); \
- sock = php_sockfind(socket FLS_CC); \
- if(!sock) sock = php_sockcreate(socket FLS_CC)
-
-static php_sockbuf *php_sockfind(int socket FLS_DC)
-{
- php_sockbuf *buf = NULL, *tmp;
-
- for(tmp = FG(phpsockbuf); tmp; tmp = tmp->next)
- if(tmp->socket == socket) {
- buf = tmp;
- break;
- }
-
- return buf;
-}
-
-static php_sockbuf *php_sockcreate(int socket FLS_DC)
-{
- php_sockbuf *sock;
- int persistent = php_is_persistent_sock(socket);
-
- sock = pecalloc(sizeof(*sock), 1, persistent);
- sock->socket = socket;
- if((sock->next = FG(phpsockbuf)))
- FG(phpsockbuf)->prev = sock;
- sock->persistent = persistent;
- sock->is_blocked = 1;
- sock->chunk_size = FG(def_chunk_size);
- sock->timeout.tv_sec = -1;
- FG(phpsockbuf) = sock;
-
- return sock;
-}
-
-PHPAPI php_sockbuf *php_get_socket(int socket)
-{
- SOCK_FIND(sock, socket);
- return sock;
-}
-
-PHPAPI size_t php_sock_set_def_chunk_size(size_t size)
-{
- size_t old;
- FLS_FETCH();
-
- old = FG(def_chunk_size);
-
- if(size <= PHP_FSOCK_CHUNK_SIZE || size > 0)
- FG(def_chunk_size) = size;
-
- return old;
-}
-
-PHPAPI int php_sockdestroy(int socket)
-{
- int ret = 0;
- php_sockbuf *sock;
- FLS_FETCH();
-
- sock = php_sockfind(socket FLS_CC);
- if(sock) {
- ret = 1;
- SOCK_DESTROY(sock);
- }
-
- return ret;
-}
-
-#if !defined(PHP_WIN32)
-#undef closesocket
-#define closesocket close
-#endif
-
-#ifndef HAVE_SHUTDOWN
-#undef shutdown
-#define shutdown
-#endif
-
-#define SOCK_CLOSE(s) shutdown(s, 0); closesocket(s)
-
-PHPAPI int php_sock_close(int socket)
-{
- int ret = 0;
- php_sockbuf *sock;
- FLS_FETCH();
-
- sock = php_sockfind(socket FLS_CC);
- if(sock) {
- if(!sock->persistent) {
- SOCK_CLOSE(sock->socket);
- SOCK_DESTROY(sock);
- }
- } else {
- SOCK_CLOSE(socket);
- }
-
- return ret;
-}
-
-#define MAX_CHUNKS_PER_READ 10
-
-static void php_sockwait_for_data(php_sockbuf *sock)
-{
- fd_set fdr, tfdr;
- int retval;
- struct timeval timeout, *ptimeout;
-
- FD_ZERO(&fdr);
- FD_SET(sock->socket, &fdr);
- sock->timeout_event = 0;
-
- if (sock->timeout.tv_sec == -1)
- ptimeout = NULL;
- else
- ptimeout = &timeout;
-
- while(1) {
- tfdr = fdr;
- timeout = sock->timeout;
-
- retval = select(sock->socket + 1, &tfdr, NULL, NULL, ptimeout);
-
- if (retval == 0)
- sock->timeout_event = 1;
-
- if (retval >= 0)
- break;
- }
-}
-
-static size_t php_sockread_internal(php_sockbuf *sock)
-{
- char buf[PHP_FSOCK_CHUNK_SIZE];
- int nr_bytes;
- size_t nr_read = 0;
-
- /* For blocking sockets, we wait until there is some
- data to read (real data or EOF)
-
- Otherwise, recv() may time out and return 0 and
- therefore sock->eof would be set errornously.
- */
-
-
- if(sock->is_blocked) {
- php_sockwait_for_data(sock);
- if (sock->timeout_event)
- return 0;
- }
-
- /* read at a maximum sock->chunk_size */
- nr_bytes = recv(sock->socket, buf, sock->chunk_size, 0);
- if(nr_bytes > 0) {
- if(sock->writepos + nr_bytes > sock->readbuflen) {
- sock->readbuflen += sock->chunk_size;
- sock->readbuf = perealloc(sock->readbuf, sock->readbuflen,
- sock->persistent);
- }
- memcpy(WRITEPTR(sock), buf, nr_bytes);
- sock->writepos += nr_bytes;
- nr_read = nr_bytes;
- } else if(nr_bytes == 0 || (nr_bytes < 0 && errno != EWOULDBLOCK)) {
- sock->eof = 1;
- }
-
- return nr_read;
-}
-
-static void php_sockread_total(php_sockbuf *sock, size_t maxread)
-{
- while(!sock->eof && TOREAD(sock) < maxread && !sock->timeout_event) {
- php_sockread_internal(sock);
- }
-}
-
-static size_t php_sockread(php_sockbuf *sock)
-{
- size_t nr_bytes;
- size_t nr_read = 0;
- int i;
-
- for(i = 0; !sock->eof && i < MAX_CHUNKS_PER_READ; i++) {
- nr_bytes = php_sockread_internal(sock);
- if(nr_bytes == 0) break;
- nr_read += nr_bytes;
- }
-
- return nr_read;
-}
-
-PHPAPI int php_sockset_blocking(int socket, int mode)
-{
- int old;
- SOCK_FIND(sock, socket);
-
- old = sock->is_blocked;
-
- sock->is_blocked = mode;
-
- return old;
-}
-
-PHPAPI void php_sockset_timeout(int socket, struct timeval *timeout)
-{
- SOCK_FIND(sock, socket);
-
- sock->timeout = *timeout;
- sock->timeout_event = 0;
-}
-
-#define SOCK_FIND_AND_READ_MAX(max) \
- SOCK_FIND(sock, socket); \
- if(sock->is_blocked) php_sockread_total(sock, max); else php_sockread(sock)
-
-/* {{{ php_sock_fgets() */
-/*
- * FIXME: fgets depends on '\n' as line delimiter
- */
-static char * php_sock_fgets_internal(char * buf, size_t maxlen, php_sockbuf * sock)
-{
- char *p = NULL;
- char *ret = NULL;
- size_t amount = 0;
-
- if (maxlen==0) {
- buf[0] = 0;
- return buf;
- }
-
- SEARCHCR();
-
- if(!p) {
- if(sock->is_blocked) {
- while(!p && !sock->eof && !sock->timeout_event && TOREAD(sock) < maxlen) {
- php_sockread_internal(sock);
- SEARCHCR();
- }
- } else {
- php_sockread(sock);
- SEARCHCR();
- }
- }
-
-
- if(p) {
- amount = (ptrdiff_t) p - (ptrdiff_t) READPTR(sock) + 1;
- } else {
- amount = TOREAD(sock);
- }
-
- amount = MIN(amount, maxlen);
-
- if(amount > 0) {
- memcpy(buf, READPTR(sock), amount);
- sock->readpos += amount;
- }
- buf[amount] = '\0';
-
- /* signal error only, if we don't return data from this call and
- if there is no data to read and if the eof flag is set */
- if(amount || TOREAD(sock) || !sock->eof) {
- ret = buf;
- }
-
- return ret;
-}
-PHPAPI char *php_sock_fgets(char *buf, size_t maxlen, int socket)
-{
- SOCK_FIND(sock, socket);
- return php_sock_fgets_internal(buf, maxlen, sock);
-}
-
-
-/* }}} */
-
-/*
- * FIXME: fgetc returns EOF, if no data is available on a nonblocking socket.
- * I don't have any documentation on the semantics of fgetc in this case.
- *
- * ss@2ns.de 19990528
- */
-
-PHPAPI int php_sock_fgetc(int socket)
-{
- int ret = EOF;
- SOCK_FIND_AND_READ_MAX(1);
-
- if(TOREAD(sock) > 0) {
- ret = *READPTR(sock);
- sock->readpos++;
- }
-
- return ret;
-}
-
-PHPAPI int php_sock_feof(int socket)
-{
- int ret = 0;
- SOCK_FIND(sock, socket);
-
- if(!sock->is_blocked)
- php_sockread(sock);
-
- if(!TOREAD(sock) && sock->eof)
- ret = 1;
-
- return ret;
-}
-
-/* {{{ stream abstraction */
-#if HAVE_PHP_STREAM
-static size_t php_sockop_write(php_stream * stream, const char * buf, size_t count)
-{
- php_sockbuf * sock = (php_sockbuf*)stream->abstract;
- return send(sock->socket, buf, count, 0);
-}
-
-static size_t php_sockop_read(php_stream * stream, char * buf, size_t count)
-{
- php_sockbuf * sock = (php_sockbuf*)stream->abstract;
- size_t ret = 0;
-
- if (sock->is_blocked)
- php_sockread_total(sock, count);
- else
- php_sockread(sock);
-
- if(count < 0)
- return ret;
-
- ret = MIN(TOREAD(sock), count);
- if (ret) {
- memcpy(buf, READPTR(sock), ret);
- sock->readpos += ret;
- }
-
- return ret;
-}
-
-static int php_sockop_close(php_stream * stream)
-{
- php_sockbuf * sock = (php_sockbuf*)stream->abstract;
-
- SOCK_CLOSE(sock->socket);
- SOCK_DESTROY(sock);
-
- return 0;
-}
-
-static int php_sockop_flush(php_stream * stream)
-{
- php_sockbuf * sock = (php_sockbuf*)stream->abstract;
- return fsync(sock->socket);
-}
-
-static int php_sockop_cast(php_stream * stream, int castas, void ** ret)
-{
- php_sockbuf * sock = (php_sockbuf*)stream->abstract;
-
- switch(castas) {
- case PHP_STREAM_AS_STDIO:
- if (ret) {
- /* DANGER!: data buffered in stream->readbuf will be forgotten! */
- if (TOREAD(sock) > 0)
- zend_error(E_WARNING, "%s(): buffered data lost during conversion to FILE*!", get_active_function_name());
- *ret = fdopen(sock->socket, stream->mode);
- if (*ret)
- return SUCCESS;
- return FAILURE;
- }
- return SUCCESS;
- case PHP_STREAM_AS_FD:
- case PHP_STREAM_AS_SOCKETD:
- if (ret)
- *ret = (void*)sock->socket;
- return SUCCESS;
- default:
- return FAILURE;
- }
-}
-
-static char * php_sockop_gets(php_stream * stream, char *buf, size_t size)
-{
- php_sockbuf * sock = (php_sockbuf*)stream->abstract;
- return php_sock_fgets_internal(buf, size, sock);
-}
-
-php_stream_ops php_stream_socket_ops = {
- php_sockop_write, php_sockop_read,
- php_sockop_close, php_sockop_flush,
- NULL, php_sockop_gets,
- php_sockop_cast,
- "socket"
-};
-#endif
-/* }}} */
-
-/* {{{ php_sock_fread() */
-
-PHPAPI size_t php_sock_fread(char *ptr, size_t size, int socket)
-{
- size_t ret = 0;
- SOCK_FIND_AND_READ_MAX(size);
-
- if(size < 0)
- return ret;
-
- ret = MIN(TOREAD(sock), size);
- if(ret) {
- memcpy(ptr, READPTR(sock), ret);
- sock->readpos += ret;
- }
-
- return ret;
-}
-
-/* }}} */
-
-/* {{{ module start/shutdown functions */
-
- /* {{{ php_msock_destroy */
-PHPAPI void php_msock_destroy(int *data)
-{
- close(*data);
-}
-/* }}} */
-
-
-
-PHP_RSHUTDOWN_FUNCTION(fsock)
-{
- FLS_FETCH();
-
- php_cleanup_sockbuf(0 FLS_CC);
- return SUCCESS;
-}
-/* }}} */
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/standard/fsock.h b/ext/standard/fsock.h
deleted file mode 100644
index 9f369a8b27..0000000000
--- a/ext/standard/fsock.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Paul Panotzki - Bunyip Information Systems |
- | Jim Winstead (jimw@php.net) |
- | Wez Furlong |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-/* Synced with php 3.0 revision 1.24 1999-06-18 [ssb] */
-
-#ifndef FSOCK_H
-#define FSOCK_H
-
-#include "file.h"
-
-#define PHP_FSOCK_CHUNK_SIZE 8192
-
-#include "php_network.h"
-
-#if HAVE_PHP_STREAM
-extern php_stream_ops php_stream_socket_ops;
-#endif
-
-/* stream->abstract points to an instance of this */
-struct php_sockbuf {
- int socket;
- unsigned char *readbuf;
- size_t readbuflen;
- size_t readpos;
- size_t writepos;
- struct php_sockbuf *next;
- struct php_sockbuf *prev;
- char eof;
- char persistent;
- char is_blocked;
- size_t chunk_size;
- struct timeval timeout;
- char timeout_event;
-#if HAVE_PHP_STREAM
- php_stream * stream;
-#endif
-};
-
-typedef struct php_sockbuf php_sockbuf;
-
-PHP_FUNCTION(fsockopen);
-PHP_FUNCTION(pfsockopen);
-
-PHPAPI int php_lookup_hostname(const char *addr, struct in_addr *in);
-PHPAPI char *php_sock_fgets(char *buf, size_t maxlen, int socket);
-PHPAPI size_t php_sock_fread(char *buf, size_t maxlen, int socket);
-PHPAPI int php_sock_feof(int socket);
-PHPAPI int php_sock_fgetc(int socket);
-PHPAPI int php_is_persistent_sock(int);
-PHPAPI int php_sockset_blocking(int socket, int mode);
-PHPAPI void php_sockset_timeout(int socket, struct timeval *timeout);
-PHPAPI int php_sockdestroy(int socket);
-PHPAPI int php_sock_close(int socket);
-PHPAPI size_t php_sock_set_def_chunk_size(size_t size);
-PHPAPI void php_msock_destroy(int *data);
-PHPAPI void php_cleanup_sockbuf(int persistent FLS_DC);
-
-PHPAPI struct php_sockbuf *php_get_socket(int socket);
-
-PHP_RSHUTDOWN_FUNCTION(fsock);
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim: sw=4 ts=4 tw=78
- */
-#endif /* FSOCK_H */
diff --git a/ext/standard/ftp_fopen_wrapper.c b/ext/standard/ftp_fopen_wrapper.c
deleted file mode 100644
index 1478970b02..0000000000
--- a/ext/standard/ftp_fopen_wrapper.c
+++ /dev/null
@@ -1,324 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
- | Jim Winstead <jimw@php.net> |
- | Hartmut Holzgraefe <hholzgra@php.net> |
- +----------------------------------------------------------------------+
- */
-/* $Id$ */
-
-#include "php.h"
-#include "php_globals.h"
-#include "php_network.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-
-#ifdef PHP_WIN32
-#include <windows.h>
-#include <winsock.h>
-#define O_RDONLY _O_RDONLY
-#include "win32/param.h"
-#else
-#include <sys/param.h>
-#endif
-
-#include "php_standard.h"
-
-#include <sys/types.h>
-#if HAVE_SYS_SOCKET_H
-#include <sys/socket.h>
-#endif
-
-#ifdef PHP_WIN32
-#include <winsock.h>
-#else
-#include <netinet/in.h>
-#include <netdb.h>
-#if HAVE_ARPA_INET_H
-#include <arpa/inet.h>
-#endif
-#endif
-
-#ifdef PHP_WIN32
-#undef AF_UNIX
-#endif
-
-#if defined(AF_UNIX)
-#include <sys/un.h>
-#endif
-
-#include "php_fopen_wrappers.h"
-
-static int php_get_ftp_result(int socketd)
-{
- char tmp_line[513];
-
- while (SOCK_FGETS(tmp_line, sizeof(tmp_line)-1, socketd) &&
- !(isdigit((int) tmp_line[0]) && isdigit((int) tmp_line[1]) &&
- isdigit((int) tmp_line[2]) && tmp_line[3] == ' '));
-
- return strtol(tmp_line, NULL, 10);
-}
-
-/* {{{ php_fopen_url_wrap_ftp
- */
-FILE *php_fopen_url_wrap_ftp(char *path, char *mode, int options, int *issock, int *socketd, char **opened_path)
-{
- FILE *fp=NULL;
- php_url *resource=NULL;
- char tmp_line[512];
- unsigned short portno;
- char *scratch;
- int result;
- int i;
- char *tpath, *ttpath;
-
- resource = php_url_parse((char *) path);
- if (resource == NULL) {
- php_error(E_WARNING, "Invalid URL specified, %s", path);
- *issock = BAD_URL;
- return NULL;
- } else if (resource->path == NULL) {
- php_error(E_WARNING, "No file-path specified");
- php_url_free(resource);
- *issock = BAD_URL;
- return NULL;
- }
- /* use port 21 if one wasn't specified */
- if (resource->port == 0)
- resource->port = 21;
-
- *socketd = php_hostconnect(resource->host, resource->port, SOCK_STREAM, 0);
- if (*socketd == -1)
- goto errexit;
-#if 0
- if ((fpc = fdopen(*socketd, "r+")) == NULL) {
- php_url_free(resource);
- return NULL;
- }
-#ifdef HAVE_SETVBUF
- if ((setvbuf(fpc, NULL, _IONBF, 0)) != 0) {
- php_url_free(resource);
- fclose(fpc);
- return NULL;
- }
-#endif
-#endif
-
- /* Start talking to ftp server */
- result = php_get_ftp_result(*socketd);
- if (result > 299 || result < 200)
- goto errexit;
-
- /* send the user name */
- SOCK_WRITE("USER ", *socketd);
- if (resource->user != NULL) {
- php_raw_url_decode(resource->user, strlen(resource->user));
- SOCK_WRITE(resource->user, *socketd);
- } else {
- SOCK_WRITE("anonymous", *socketd);
- }
- SOCK_WRITE("\r\n", *socketd);
-
- /* get the response */
- result = php_get_ftp_result(*socketd);
-
- /* if a password is required, send it */
- if (result >= 300 && result <= 399) {
- SOCK_WRITE("PASS ", *socketd);
- if (resource->pass != NULL) {
- php_raw_url_decode(resource->pass, strlen(resource->pass));
- SOCK_WRITE(resource->pass, *socketd);
- } else {
- /* if the user has configured who they are,
- send that as the password */
- if (cfg_get_string("from", &scratch) == SUCCESS) {
- SOCK_WRITE(scratch, *socketd);
- } else {
- SOCK_WRITE("anonymous", *socketd);
- }
- }
- SOCK_WRITE("\r\n", *socketd);
-
- /* read the response */
- result = php_get_ftp_result(*socketd);
- }
- if (result > 299 || result < 200)
- goto errexit;
-
- /* set the connection to be binary */
- SOCK_WRITE("TYPE I\r\n", *socketd);
- result = php_get_ftp_result(*socketd);
- if (result > 299 || result < 200)
- goto errexit;
-
- /* find out the size of the file (verifying it exists) */
- SOCK_WRITE("SIZE ", *socketd);
- SOCK_WRITE(resource->path, *socketd);
- SOCK_WRITE("\r\n", *socketd);
-
- /* read the response */
- result = php_get_ftp_result(*socketd);
- if (mode[0] == 'r') {
- /* when reading file, it must exist */
- if (result > 299 || result < 200) {
- php_error(E_WARNING, "File not found");
- php_url_free(resource);
- SOCK_FCLOSE(*socketd);
- *socketd = 0;
- errno = ENOENT;
- return NULL;
- }
- } else {
- /* when writing file, it must NOT exist */
- if (result <= 299 && result >= 200) {
- php_error(E_WARNING, "File already exists");
- php_url_free(resource);
- SOCK_FCLOSE(*socketd);
- *socketd = 0;
- errno = EEXIST;
- return NULL;
- }
- }
-
- /* set up the passive connection */
-
- /* We try EPSV first, needed for IPv6 and works on some IPv4 servers */
- SOCK_WRITE("EPSV\r\n", *socketd);
- while (SOCK_FGETS(tmp_line, sizeof(tmp_line)-1, *socketd) &&
- !(isdigit((int) tmp_line[0]) && isdigit((int) tmp_line[1]) &&
- isdigit((int) tmp_line[2]) && tmp_line[3] == ' '));
-
- /* check if we got a 229 response */
- if (strncmp(tmp_line, "229", 3)) {
- /* EPSV failed, let's try PASV */
- SOCK_WRITE("PASV\r\n", *socketd);
- while (SOCK_FGETS(tmp_line, sizeof(tmp_line)-1, *socketd) &&
- !(isdigit((int) tmp_line[0]) && isdigit((int) tmp_line[1]) &&
- isdigit((int) tmp_line[2]) && tmp_line[3] == ' '));
- /* make sure we got a 227 response */
- if (strncmp(tmp_line, "227", 3))
- goto errexit;
- /* parse pasv command (129,80,95,25,13,221) */
- tpath = tmp_line;
- /* skip over the "227 Some message " part */
- for (tpath += 4; *tpath && !isdigit((int) *tpath); tpath++);
- if (!*tpath)
- goto errexit;
- /* skip over the host ip, we just assume it's the same */
- for (i = 0; i < 4; i++) {
- for (; isdigit((int) *tpath); tpath++);
- if (*tpath != ',')
- goto errexit;
- tpath++;
- }
- /* pull out the MSB of the port */
- portno = (unsigned short) strtol(tpath, &ttpath, 10) * 256;
- if (ttpath == NULL) {
- /* didn't get correct response from PASV */
- goto errexit;
- }
- tpath = ttpath;
- if (*tpath != ',')
- goto errexit;
- tpath++;
- /* pull out the LSB of the port */
- portno += (unsigned short) strtol(tpath, &ttpath, 10);
- } else {
- /* parse epsv command (|||6446|) */
- for (i = 0, tpath = tmp_line + 4; *tpath; tpath++) {
- if (*tpath == '|') {
- i++;
- if (i == 3)
- break;
- }
- }
- if (i < 3)
- goto errexit;
- /* pull out the port */
- portno = (unsigned short) strtol(tpath + 1, &ttpath, 10);
- }
-
- if (ttpath == NULL) {
- /* didn't get correct response from EPSV/PASV */
- goto errexit;
- }
-
- if (mode[0] == 'r') {
- /* retrieve file */
- SOCK_WRITE("RETR ", *socketd);
- } else {
- /* store file */
- SOCK_WRITE("STOR ", *socketd);
- }
- if (resource->path != NULL) {
- SOCK_WRITE(resource->path, *socketd);
- } else {
- SOCK_WRITE("/", *socketd);
- }
-
- /* close control connection */
- SOCK_WRITE("\r\nQUIT\r\n", *socketd);
- SOCK_FCLOSE(*socketd);
-
- /* open the data channel */
- *socketd = php_hostconnect(resource->host, portno, SOCK_STREAM, 0);
- if (*socketd == -1)
- goto errexit;
-#if 0
- if (mode[0] == 'r') {
- if ((fp = fdopen(*socketd, "r+")) == NULL) {
- php_url_free(resource);
- return NULL;
- }
- } else {
- if ((fp = fdopen(*socketd, "w+")) == NULL) {
- php_url_free(resource);
- return NULL;
- }
- }
-#ifdef HAVE_SETVBUF
- if ((setvbuf(fp, NULL, _IONBF, 0)) != 0) {
- php_url_free(resource);
- fclose(fp);
- return NULL;
- }
-#endif
-#endif
- php_url_free(resource);
- *issock = 1;
- return (fp);
-
- errexit:
- php_url_free(resource);
- SOCK_FCLOSE(*socketd);
- *socketd = 0;
- return NULL;
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/standard/head.c b/ext/standard/head.c
deleted file mode 100644
index a269c97f02..0000000000
--- a/ext/standard/head.c
+++ /dev/null
@@ -1,201 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
- +----------------------------------------------------------------------+
- */
-/* $Id$ */
-
-#include <stdio.h>
-#include "php.h"
-#include "ext/standard/php_standard.h"
-#include "SAPI.h"
-#include "php_main.h"
-#include "head.h"
-#include "SAPI.h"
-#ifdef TM_IN_SYS_TIME
-#include <sys/time.h>
-#else
-#include <time.h>
-#endif
-
-#include "php_globals.h"
-#include "safe_mode.h"
-
-
-/* Implementation of the language Header() function */
-/* {{{ proto void header(string header[, bool replace])
- Send a raw HTTP header */
-PHP_FUNCTION(header)
-{
- pval **arg1, **arg2;
- zend_bool replace = 1;
-
- if (ZEND_NUM_ARGS() < 1 || ZEND_NUM_ARGS() > 2
- || zend_get_parameters_ex(ZEND_NUM_ARGS(), &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- switch (ZEND_NUM_ARGS()) {
- case 2:
- convert_to_boolean_ex(arg2);
- replace = Z_BVAL_PP(arg2);
- case 1:
- convert_to_string_ex(arg1);
- }
- sapi_add_header_ex(Z_STRVAL_PP(arg1), Z_STRLEN_PP(arg1), 1, replace);
-}
-/* }}} */
-
-PHPAPI int php_header()
-{
- SLS_FETCH();
-
- if (sapi_send_headers()==FAILURE || SG(request_info).headers_only) {
- return 0; /* don't allow output */
- } else {
- return 1; /* allow output */
- }
-}
-
-
-
-/* php_set_cookie(name,value,expires,path,domain,secure) */
-/* {{{ proto void setcookie(string name [, string value [, int expires [, string path [, string domain [, string secure]]]]])
- Send a cookie */
-PHP_FUNCTION(setcookie)
-{
- char *cookie, *encoded_value = NULL;
- int len=sizeof("Set-Cookie: ");
- time_t t;
- char *dt;
- time_t expires = 0;
- int secure = 0;
- pval **arg[6];
- int arg_count;
- zval **z_name=NULL, **z_value=NULL, **z_path=NULL, **z_domain=NULL;
- SLS_FETCH();
-
- arg_count = ZEND_NUM_ARGS();
- if (arg_count < 1 || arg_count > 6 || zend_get_parameters_array_ex(arg_count, arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- switch (arg_count) {
- case 6:
- convert_to_boolean_ex(arg[5]);
- secure = Z_LVAL_PP(arg[5]);
- /* break missing intentionally */
- case 5:
- convert_to_string_ex(arg[4]);
- z_domain = arg[4];
- /* break missing intentionally */
- case 4:
- convert_to_string_ex(arg[3]);
- z_path = arg[3];
- /* break missing intentionally */
- case 3:
- convert_to_long_ex(arg[2]);
- expires = Z_LVAL_PP(arg[2]);
- /* break missing intentionally */
- case 2:
- convert_to_string_ex(arg[1]);
- z_value = arg[1];
- /* break missing intentionally */
- case 1:
- convert_to_string_ex(arg[0]);
- z_name = arg[0];
- break;
- }
- if (z_name) {
- len += Z_STRLEN_PP(z_name);
- }
- if (z_value) {
- int encoded_value_len;
-
- encoded_value = php_url_encode(Z_STRVAL_PP(z_value), Z_STRLEN_PP(z_value), &encoded_value_len);
- len += encoded_value_len;
- }
- if (z_path) {
- len += Z_STRLEN_PP(z_path);
- }
- if (z_domain) {
- len += Z_STRLEN_PP(z_domain);
- }
- cookie = emalloc(len + 100);
- if (!Z_STRVAL_PP(z_value) || !Z_STRVAL_PP(z_value)[0]) {
- /*
- * MSIE doesn't delete a cookie when you set it to a null value
- * so in order to force cookies to be deleted, even on MSIE, we
- * pick an expiry date 1 year and 1 second in the past
- */
- t = time(NULL) - 31536001;
- dt = php_std_date(t);
- sprintf(cookie, "Set-Cookie: %s=deleted; expires=%s", Z_STRVAL_PP(z_name), dt);
- efree(dt);
- } else {
- /* FIXME: XXX: this is not binary data safe */
- sprintf(cookie, "Set-Cookie: %s=%s", Z_STRVAL_PP(z_name), Z_STRVAL_PP(z_value) ? encoded_value : "");
- if (expires > 0) {
- strcat(cookie, "; expires=");
- dt = php_std_date(expires);
- strcat(cookie, dt);
- efree(dt);
- }
- }
-
- if (encoded_value) {
- efree(encoded_value);
- }
-
- if (z_path && Z_STRVAL_PP(z_path) && Z_STRLEN_PP(z_path)>0) {
- strcat(cookie, "; path=");
- strcat(cookie, Z_STRVAL_PP(z_path));
- }
- if (z_domain && Z_STRVAL_PP(z_domain) && Z_STRLEN_PP(z_domain)>0) {
- strcat(cookie, "; domain=");
- strcat(cookie, Z_STRVAL_PP(z_domain));
- }
- if (secure) {
- strcat(cookie, "; secure");
- }
-
- if (sapi_add_header(cookie, strlen(cookie), 0)==SUCCESS) {
- RETVAL_TRUE;
- } else {
- RETVAL_FALSE;
- }
-}
-/* }}} */
-
-
-/* {{{ proto int headers_sent(void)
- Return true if headers have already been sent, false otherwise */
-PHP_FUNCTION(headers_sent)
-{
- SLS_FETCH();
-
- if (SG(headers_sent)) {
- RETURN_TRUE;
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78 * End:
- */
diff --git a/ext/standard/head.h b/ext/standard/head.h
deleted file mode 100644
index 1de1a5b379..0000000000
--- a/ext/standard/head.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef HEAD_H
-#define HEAD_H
-
-extern PHP_RINIT_FUNCTION(head);
-PHP_FUNCTION(header);
-PHP_FUNCTION(setcookie);
-PHP_FUNCTION(headers_sent);
-
-PHPAPI int php_header(void);
-
-#endif
diff --git a/ext/standard/html.c b/ext/standard/html.c
deleted file mode 100644
index 5e9bc50117..0000000000
--- a/ext/standard/html.c
+++ /dev/null
@@ -1,490 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
- | Jaakko Hyvätti <jaakko.hyvatti@iki.fi> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#include "php.h"
-#include "reg.h"
-#include "html.h"
-
-#if HAVE_LOCALE_H
-#include <locale.h>
-#endif
-
-/* This must be fixed to handle the input string according to LC_CTYPE.
- Defaults to ISO-8859-1 for now. */
-
-enum entity_charset { cs_terminator, cs_8859_1, cs_cp1252,
- cs_8859_15, cs_utf_8 };
-typedef const char * entity_table_t;
-
-/* codepage 1252 is a Windows extension to iso-8859-1. */
-static entity_table_t ent_cp_1252[] = {
- NULL, NULL, "sbquo", "fnof", "bdquo", "hellip", "dagger",
- "Dagger", "circ", "permil", "Scaron", "lsaquo", "OElig",
- NULL, NULL, NULL, NULL, "lsquo", "rsquo", "ldquo", "rdquo",
- "bull", "ndash", "mdash", "tilde", "trade", "scaron", "rsaquo",
- "oelig", NULL, NULL, "Yuml"
-};
-
-static entity_table_t ent_iso_8859_1[] = {
- "nbsp","iexcl","cent","pound","curren","yen","brvbar",
- "sect","uml","copy","ordf","laquo","not","shy","reg",
- "macr","deg","plusmn","sup2","sup3","acute","micro",
- "para","middot","cedil","sup1","ordm","raquo","frac14",
- "frac12","frac34","iquest","Agrave","Aacute","Acirc",
- "Atilde","Auml","Aring","AElig","Ccedil","Egrave",
- "Eacute","Ecirc","Euml","Igrave","Iacute","Icirc",
- "Iuml","ETH","Ntilde","Ograve","Oacute","Ocirc","Otilde",
- "Ouml","times","Oslash","Ugrave","Uacute","Ucirc","Uuml",
- "Yacute","THORN","szlig","agrave","aacute","acirc",
- "atilde","auml","aring","aelig","ccedil","egrave",
- "eacute","ecirc","euml","igrave","iacute","icirc",
- "iuml","eth","ntilde","ograve","oacute","ocirc","otilde",
- "ouml","divide","oslash","ugrave","uacute","ucirc",
- "uuml","yacute","thorn","yuml"
-};
-
-static entity_table_t ent_iso_8859_15[] = {
- "nbsp", "iexcl", "cent", "pound", "euro", "yen", "Scaron",
- "sect", "scaron", "copy", "ordf", "laquo", "not", "shy", "reg",
- "macr", "deg", "plusmn", "sup2", "sup3", NULL, /* Zcaron */
- "micro", "para", "middot", NULL, /* zcaron */ "sup1", "ordm",
- "raquo", "OElig", "oelig", "Yuml", "iquest", "Agrave", "Aacute",
- "Acirc", "Atilde", "Auml", "Aring", "AElig", "Ccedil", "Egrave",
- "Eacute","Ecirc","Euml","Igrave","Iacute","Icirc",
- "Iuml","ETH","Ntilde","Ograve","Oacute","Ocirc","Otilde",
- "Ouml","times","Oslash","Ugrave","Uacute","Ucirc","Uuml",
- "Yacute","THORN","szlig","agrave","aacute","acirc",
- "atilde","auml","aring","aelig","ccedil","egrave",
- "eacute","ecirc","euml","igrave","iacute","icirc",
- "iuml","eth","ntilde","ograve","oacute","ocirc","otilde",
- "ouml","divide","oslash","ugrave","uacute","ucirc",
- "uuml","yacute","thorn","yuml"
-};
-
-struct html_entity_map {
- enum entity_charset charset; /* charset identifier */
- unsigned short basechar; /* char code at start of table */
- unsigned short endchar; /* last char code in the table */
- entity_table_t * table; /* the table of mappings */
-};
-
-static const struct html_entity_map entity_map[] = {
- { cs_cp1252, 0x80, 0x9f, ent_cp_1252 },
- { cs_cp1252, 0xa0, 0xff, ent_iso_8859_1 },
- { cs_8859_1, 0xa0, 0xff, ent_iso_8859_1 },
- { cs_8859_15, 0xa0, 0xff, ent_iso_8859_15 },
- { cs_utf_8, 0xa0, 0xff, ent_iso_8859_1 },
- { cs_terminator }
-};
-
-static const struct {
- const char * codeset;
- enum entity_charset charset;
-} charset_map[] = {
- { "ISO-8859-1", cs_8859_1 },
- { "ISO-8859-15", cs_8859_15 },
- { "utf-8", cs_utf_8 },
- { "cp1252", cs_cp1252 },
- { NULL }
-};
-
-/* {{{ get_next_char
- */
-inline static unsigned short get_next_char(enum entity_charset charset,
- unsigned char * str,
- int * newpos,
- unsigned char * mbseq,
- int * mbseqlen
-)
-{
- int pos = *newpos;
- int mbpos = 0;
- unsigned short this_char = str[pos++];
-
- mbseq[mbpos++] = (unsigned char)this_char;
-
- if (charset == cs_utf_8) {
- unsigned long utf = 0;
- int stat = 0;
- int more = 1;
-
- /* unpack utf-8 encoding into a wide char.
- * Code stolen from the mbstring extension */
-
- do {
- if (this_char < 0x80) {
- more = 0;
- break;
- }
- else if (this_char < 0xc0) {
- switch(stat) {
- case 0x10: /* 2, 2nd */
- case 0x21: /* 3, 3rd */
- case 0x32: /* 4, 4th */
- case 0x43: /* 5, 5th */
- case 0x54: /* 6, 6th */
- /* last byte in sequence */
- more = 0;
- utf |= (this_char & 0x3f);
- this_char = (unsigned short)utf;
- break;
- case 0x20: /* 3, 2nd */
- case 0x31: /* 4, 3rd */
- case 0x42: /* 5, 4th */
- case 0x53: /* 6, 5th */
- /* penultimate char */
- utf |= ((this_char & 0x3f) << 6);
- stat++;
- break;
- case 0x30: /* 4, 2nd */
- case 0x41: /* 5, 3rd */
- case 0x52: /* 6, 4th */
- utf |= ((this_char & 0x3f) << 12);
- stat++;
- break;
- case 0x40: /* 5, 2nd */
- case 0x51:
- utf |= ((this_char & 0x3f) << 18);
- stat++;
- break;
- case 0x50: /* 6, 2nd */
- utf |= ((this_char & 0x3f) << 24);
- stat++;
- default:
- /* invalid */
- more = 0;
- }
- }
- /* lead byte */
- else if (this_char < 0xe0) {
- stat = 0x10; /* 2 byte */
- utf = (this_char & 0x1f) << 6;
- } else if (this_char < 0xf0) {
- stat = 0x20; /* 3 byte */
- utf = (this_char & 0xf) << 12;
- } else if (this_char < 0xf8) {
- stat = 0x30; /* 4 byte */
- utf = (this_char & 0x7) << 18;
- } else if (this_char < 0xfc) {
- stat = 0x40; /* 5 byte */
- utf = (this_char & 0x3) << 24;
- } else if (this_char < 0xfe) {
- stat = 0x50; /* 6 byte */
- utf = (this_char & 0x1) << 30;
- }
- else {
- /* invalid; bail */
- more = 0;
- break;
- }
- if (more)
- {
- this_char = str[pos++];
- mbseq[mbpos++] = (unsigned char)this_char;
- }
- } while(more);
- }
- *newpos = pos;
- mbseq[mbpos] = '\0';
- *mbseqlen = mbpos;
- return this_char;
-}
-/* }}} */
-
-/* {{{ entity_charset determine_charset
- * returns the charset identifier based on current locale or a hint.
- * defaults to iso-8859-1 */
-static enum entity_charset determine_charset(char * charset_hint)
-{
- int i;
- enum entity_charset charset = cs_8859_1;
- int len;
-
-#if HAVE_LOCALE_H
- if (charset_hint == NULL)
- {
- /* try to figure out the charset from the locale */
- char * localename;
- char * dot, * at;
-
- /* lang[_territory][.codeset][@modifier] */
- localename = setlocale(LC_CTYPE, NULL);
-
- dot = strchr(localename, '.');
- if (dot) {
- dot++;
- /* locale specifies a codeset */
- at = strchr(dot, '@');
- if (at)
- len = at - dot;
- else
- len = strlen(dot);
- charset_hint = dot;
- }
- else {
- /* no explicit name; see if the name itself
- * is the charset */
- charset_hint = localename;
- len = strlen(charset_hint);
- }
- }
- else
- len = strlen(charset_hint);
-#else
- if (charset_hint)
- len = strlen(charset_hint);
-#endif
-
- if (charset_hint) {
- /* now walk the charset map and look for the codeset */
- for (i = 0; charset_map[i].codeset; i++) {
- if (strncasecmp(charset_hint, charset_map[i].codeset, len) == 0) {
- charset = charset_map[i].charset;
- break;
- }
- }
- }
-
- return charset;
-}
-/* }}} */
-
-/* {{{ php_escape_html_entities
- */
-PHPAPI char *php_escape_html_entities(unsigned char *old, int oldlen, int *newlen, int all, int quote_style, char * hint_charset)
-{
- int i, maxlen, len;
- char *new;
- enum entity_charset charset = determine_charset(hint_charset);
-
- maxlen = 2 * oldlen;
- if (maxlen < 128)
- maxlen = 128;
- new = emalloc (maxlen);
- len = 0;
-
- i = 0;
- while (i < oldlen) {
- int mbseqlen;
- unsigned char mbsequence[16]; /* allow up to 15 characters
- in a multibyte sequence
- it should be more than enough.. */
- unsigned short this_char = get_next_char(charset, old, &i, mbsequence, &mbseqlen);
- int matches_map = 0;
-
- if (len + 9 > maxlen)
- new = erealloc (new, maxlen += 128);
-
- if (all) {
- /* look for a match in the maps for this charset */
- int j;
- unsigned char * rep;
-
- for (j=0; entity_map[j].charset != cs_terminator; j++) {
- if (entity_map[j].charset == charset
- && this_char >= entity_map[j].basechar
- && this_char <= entity_map[j].endchar)
- {
- rep = (unsigned char*)entity_map[j].table[this_char - entity_map[j].basechar];
- if (rep == NULL) {
- /* there is no entity for this position; fall through and
- * just output the character itself */
- break;
- }
-
- matches_map = 1;
- break;
- }
- }
-
- if (matches_map) {
- new[len++] = '&';
- strcpy(new + len, rep);
- len += strlen(rep);
- new[len++] = ';';
- }
- }
- if (!matches_map) {
- if (38 == this_char) {
- memcpy (new + len, "&amp;", 5);
- len += 5;
- } else if (34 == this_char && !(quote_style&ENT_NOQUOTES)) {
- memcpy (new + len, "&quot;", 6);
- len += 6;
- } else if (39 == this_char && (quote_style&ENT_QUOTES)) {
- memcpy (new + len, "&#039;", 6);
- len += 6;
- } else if (60 == this_char) {
- memcpy (new + len, "&lt;", 4);
- len += 4;
- } else if (62 == this_char) {
- memcpy (new + len, "&gt;", 4);
- len += 4;
- } else if (this_char > 0xff) {
- /* a wide char without a named entity; pass through the original sequence */
- memcpy(new + len, mbsequence, mbseqlen);
- len += mbseqlen;
- } else {
- new [len++] = (unsigned char)this_char;
- }
- }
- }
- new [len] = '\0';
- *newlen = len;
-
- return new;
-
-
-}
-/* }}} */
-
-/* {{{ php_html_entities
- */
-static void php_html_entities(INTERNAL_FUNCTION_PARAMETERS, int all)
-{
- zval **arg, **quotes, **charset;
- int len, quote_style = ENT_COMPAT;
- int ac = ZEND_NUM_ARGS();
- char *hint_charset = NULL;
- char *new;
-
- if (ac < 1 || ac > 3 || zend_get_parameters_ex(ac, &arg, &quotes, &charset) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(arg);
- if(ac==2) {
- convert_to_long_ex(quotes);
- quote_style = (*quotes)->value.lval;
- }
- if (ac == 3) {
- convert_to_string_ex(charset);
- hint_charset = Z_STRVAL_PP(charset);
- }
-
-
- new = php_escape_html_entities((*arg)->value.str.val, (*arg)->value.str.len, &len, all, quote_style, hint_charset);
- RETVAL_STRINGL(new,len,0);
-}
-/* }}} */
-
-#define HTML_SPECIALCHARS 0
-#define HTML_ENTITIES 1
-
-/* {{{ register_html_constants
- */
-void register_html_constants(INIT_FUNC_ARGS)
-{
- REGISTER_LONG_CONSTANT("HTML_SPECIALCHARS", HTML_SPECIALCHARS, CONST_PERSISTENT|CONST_CS);
- REGISTER_LONG_CONSTANT("HTML_ENTITIES", HTML_ENTITIES, CONST_PERSISTENT|CONST_CS);
- REGISTER_LONG_CONSTANT("ENT_COMPAT", ENT_COMPAT, CONST_PERSISTENT|CONST_CS);
- REGISTER_LONG_CONSTANT("ENT_QUOTES", ENT_QUOTES, CONST_PERSISTENT|CONST_CS);
- REGISTER_LONG_CONSTANT("ENT_NOQUOTES", ENT_NOQUOTES, CONST_PERSISTENT|CONST_CS);
-}
-/* }}} */
-
-/* {{{ proto string htmlspecialchars(string string [, int quote_style][, string charset])
- Convert special characters to HTML entities */
-PHP_FUNCTION(htmlspecialchars)
-{
- php_html_entities(INTERNAL_FUNCTION_PARAM_PASSTHRU,0);
-}
-/* }}} */
-
-/* {{{ proto string htmlentities(string string [, int quote_style][, string charset])
- Convert all applicable characters to HTML entities */
-PHP_FUNCTION(htmlentities)
-{
- php_html_entities(INTERNAL_FUNCTION_PARAM_PASSTHRU,1);
-}
-/* }}} */
-
-/* {{{ proto array get_html_translation_table([int table [, int quote_style][, string charset]])
- Returns the internal translation table used by htmlspecialchars and htmlentities */
-PHP_FUNCTION(get_html_translation_table)
-{
- zval **whichone, **quotes;
- int which = HTML_SPECIALCHARS, quote_style = ENT_COMPAT;
- int ac = ZEND_NUM_ARGS();
- int i, j;
- char ind[ 2 ];
- enum entity_charset charset = determine_charset(NULL);
-
- if (ac < 0 || ac > 2 || zend_get_parameters_ex(ac, &whichone, &quotes) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if (ac > 0) {
- convert_to_long_ex(whichone);
- which = (*whichone)->value.lval;
- }
- if (ac == 2) {
- convert_to_long_ex(quotes);
- quote_style = (*quotes)->value.lval;
- }
-
- array_init(return_value);
-
- ind[1] = 0;
-
- switch (which) {
- case HTML_ENTITIES:
- for (j=0; entity_map[j].charset != cs_terminator; j++) {
- if (entity_map[j].charset != charset)
- continue;
- for (i = 0; i < entity_map[j].endchar - entity_map[j].basechar; i++)
- {
- char buffer[16];
-
- if (entity_map[j].table[i] == NULL)
- continue;
- /* what about wide chars here ?? */
- ind[0] = i + entity_map[j].basechar;
- sprintf(buffer, "&%s;", entity_map[j].table[i]);
- add_assoc_string(return_value, ind, buffer, 1);
-
- }
- }
- /* break thru */
-
- case HTML_SPECIALCHARS:
- ind[0]=38; add_assoc_string(return_value,ind,"&amp;",1);
- if(quote_style&ENT_QUOTES) {
- ind[0]=39; add_assoc_string(return_value,ind,"&#039;",1);
- }
- if(!(quote_style&ENT_NOQUOTES)) {
- ind[0]=34; add_assoc_string(return_value,ind,"&quot;",1);
- }
- ind[0]=60; add_assoc_string(return_value,ind,"&lt;",1);
- ind[0]=62; add_assoc_string(return_value,ind,"&gt;",1);
- break;
- }
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/standard/html.h b/ext/standard/html.h
deleted file mode 100644
index 682ced2273..0000000000
--- a/ext/standard/html.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef HTML_H
-#define HTML_H
-
-#define ENT_COMPAT 1
-#define ENT_QUOTES 2
-#define ENT_NOQUOTES 4
-
-void register_html_constants(INIT_FUNC_ARGS);
-
-PHP_FUNCTION(htmlspecialchars);
-PHP_FUNCTION(htmlentities);
-PHP_FUNCTION(get_html_translation_table);
-
-PHPAPI char *php_escape_html_entities(unsigned char *old, int oldlen, int *newlen, int all, int quote_style, char * hint_charset);
-
-#endif /* HTML_H */
diff --git a/ext/standard/http_fopen_wrapper.c b/ext/standard/http_fopen_wrapper.c
deleted file mode 100644
index 86e0f5a197..0000000000
--- a/ext/standard/http_fopen_wrapper.c
+++ /dev/null
@@ -1,316 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
- | Jim Winstead <jimw@php.net> |
- | Hartmut Holzgraefe <hholzgra@php.net> |
- +----------------------------------------------------------------------+
- */
-/* $Id$ */
-
-#include "php.h"
-#include "php_globals.h"
-#include "php_network.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-
-#ifdef PHP_WIN32
-#include <windows.h>
-#include <winsock.h>
-#define O_RDONLY _O_RDONLY
-#include "win32/param.h"
-#else
-#include <sys/param.h>
-#endif
-
-#include "php_standard.h"
-
-#include <sys/types.h>
-#if HAVE_SYS_SOCKET_H
-#include <sys/socket.h>
-#endif
-
-#ifdef PHP_WIN32
-#include <winsock.h>
-#else
-#include <netinet/in.h>
-#include <netdb.h>
-#if HAVE_ARPA_INET_H
-#include <arpa/inet.h>
-#endif
-#endif
-
-#ifdef PHP_WIN32
-#undef AF_UNIX
-#endif
-
-#if defined(AF_UNIX)
-#include <sys/un.h>
-#endif
-
-#include "php_fopen_wrappers.h"
-
-#define HTTP_HEADER_BLOCK_SIZE 128
-
-/* {{{ php_fopen_url_wrap_http
- */
-FILE *php_fopen_url_wrap_http(char *path, char *mode, int options, int *issock, int *socketd, char **opened_path)
-{
- FILE *fp=NULL;
- php_url *resource=NULL;
- char tmp_line[128];
- char location[512];
- char hdr_line[8192];
- int body = 0;
- char *scratch;
- unsigned char *tmp;
- int len;
- int reqok = 0;
- zval *response_header;
- char *http_header_line;
- int http_header_line_length, http_header_line_size;
-
- resource = php_url_parse((char *) path);
- if (resource == NULL) {
- php_error(E_WARNING, "Invalid URL specified, %s", path);
- *issock = BAD_URL;
- return NULL;
- }
- /* use port 80 if one wasn't specified */
- if (resource->port == 0) {
- resource->port = 80;
- }
-
- *socketd = php_hostconnect(resource->host, resource->port, SOCK_STREAM, 0);
- if (*socketd == -1) {
- SOCK_FCLOSE(*socketd);
- *socketd = 0;
- php_url_free(resource);
- return NULL;
- }
-#if 0
- if ((fp = fdopen(*socketd, "r+")) == NULL) {
- php_url_free(resource);
- return NULL;
- }
-#ifdef HAVE_SETVBUF
- if ((setvbuf(fp, NULL, _IONBF, 0)) != 0) {
- php_url_free(resource);
- return NULL;
- }
-#endif
-#endif /*win32 */
-
- strcpy(hdr_line, "GET ");
-
- /* tell remote http which file to get */
- if (resource->path != NULL) {
- strlcat(hdr_line, resource->path, sizeof(hdr_line));
- } else {
- strlcat(hdr_line, "/", sizeof(hdr_line));
- }
- /* append the query string, if any */
- if (resource->query != NULL) {
- strlcat(hdr_line, "?", sizeof(hdr_line));
- strlcat(hdr_line, resource->query, sizeof(hdr_line));
- }
- strlcat(hdr_line, " HTTP/1.0\r\n", sizeof(hdr_line));
- SOCK_WRITE(hdr_line, *socketd);
-
- /* send authorization header if we have user/pass */
- if (resource->user != NULL && resource->pass != NULL) {
- scratch = (char *) emalloc(strlen(resource->user) + strlen(resource->pass) + 2);
- if (!scratch) {
- php_url_free(resource);
- return NULL;
- }
- strcpy(scratch, resource->user);
- strcat(scratch, ":");
- strcat(scratch, resource->pass);
- tmp = php_base64_encode((unsigned char *)scratch, strlen(scratch), NULL);
-
- if (snprintf(hdr_line, sizeof(hdr_line),
- "Authorization: Basic %s\r\n", tmp) > 0) {
- SOCK_WRITE(hdr_line, *socketd);
- }
-
- efree(scratch);
- efree(tmp);
- }
- /* if the user has configured who they are, send a From: line */
- if (cfg_get_string("from", &scratch) == SUCCESS) {
- if (snprintf(hdr_line, sizeof(hdr_line),
- "From: %s\r\n", scratch) > 0) {
- SOCK_WRITE(hdr_line, *socketd);
- }
-
- }
- /* send a Host: header so name-based virtual hosts work */
- if (resource->port != 80) {
- len = snprintf(hdr_line, sizeof(hdr_line),
- "Host: %s:%i\r\n", resource->host, resource->port);
- } else {
- len = snprintf(hdr_line, sizeof(hdr_line),
- "Host: %s\r\n", resource->host);
- }
- if(len > sizeof(hdr_line) - 1) {
- len = sizeof(hdr_line) - 1;
- }
- if (len > 0) {
- SOCK_WRITE(hdr_line, *socketd);
- }
-
- /* identify ourselves and end the headers */
- SOCK_WRITE("User-Agent: PHP/" PHP_VERSION "\r\n\r\n", *socketd);
-
- body = 0;
- location[0] = '\0';
-
- MAKE_STD_ZVAL(response_header);
- array_init(response_header);
-
- if (!SOCK_FEOF(*socketd)) {
- /* get response header */
- if (SOCK_FGETS(tmp_line, sizeof(tmp_line)-1, *socketd) != NULL) {
- zval *http_response;
-
- MAKE_STD_ZVAL(http_response);
- if (strncmp(tmp_line + 8, " 200 ", 5) == 0) {
- reqok = 1;
- }
- Z_STRLEN_P(http_response) = strlen(tmp_line);
- Z_STRVAL_P(http_response) = estrndup(tmp_line, Z_STRLEN_P(http_response));
- if (Z_STRVAL_P(http_response)[Z_STRLEN_P(http_response)-1]=='\n') {
- Z_STRVAL_P(http_response)[Z_STRLEN_P(http_response)-1]=0;
- Z_STRLEN_P(http_response)--;
- if (Z_STRVAL_P(http_response)[Z_STRLEN_P(http_response)-1]=='\r') {
- Z_STRVAL_P(http_response)[Z_STRLEN_P(http_response)-1]=0;
- Z_STRLEN_P(http_response)--;
- }
- }
- Z_TYPE_P(http_response) = IS_STRING;
- zend_hash_next_index_insert(Z_ARRVAL_P(response_header), &http_response, sizeof(zval *), NULL);
- }
- }
-
-
- /* Read past HTTP headers */
- while (!body && !SOCK_FEOF(*socketd)) {
- http_header_line = emalloc(HTTP_HEADER_BLOCK_SIZE);
- http_header_line_size = HTTP_HEADER_BLOCK_SIZE;
- http_header_line_length = 0;
- if (SOCK_FGETS(http_header_line, HTTP_HEADER_BLOCK_SIZE-1, *socketd) != NULL) {
- char *p;
- zend_bool found_eol=0;
- zval *http_header;
-
- http_header_line[HTTP_HEADER_BLOCK_SIZE-1] = '\0';
-
- do {
- p = http_header_line+http_header_line_length;
- while (*p) {
- while (*p == '\n' || *p == '\r') {
- *p = '\0';
- p--;
- found_eol=1;
- }
- if (found_eol) {
- break;
- }
- p++;
- }
- if (!found_eol) {
- http_header_line_size += HTTP_HEADER_BLOCK_SIZE;
- http_header_line_length += HTTP_HEADER_BLOCK_SIZE-1;
- http_header_line = erealloc(http_header_line, http_header_line_size);
- if (SOCK_FGETS(http_header_line+http_header_line_length, HTTP_HEADER_BLOCK_SIZE-1, *socketd)==NULL) {
- http_header_line[http_header_line_length] = 0;
- break;
- }
- } else {
- http_header_line_length = p-http_header_line+1;
- }
- } while (!found_eol);
-
- if (!strncasecmp(http_header_line, "Location: ", 10)) {
- strlcpy(location, http_header_line + 10, sizeof(location));
- }
-
- if (http_header_line[0] == '\0') {
- body = 1;
- }
-
- if (http_header_line_length>0) {
- MAKE_STD_ZVAL(http_header);
- Z_STRVAL_P(http_header) = http_header_line;
- Z_STRLEN_P(http_header) = http_header_line_length;
- Z_TYPE_P(http_header) = IS_STRING;
- zend_hash_next_index_insert(Z_ARRVAL_P(response_header), &http_header, sizeof(zval *), NULL);
- } else {
- efree(http_header_line);
- }
- }
- }
-
- if (!reqok) {
- SOCK_FCLOSE(*socketd);
- *socketd = 0;
- php_url_free(resource);
- if (location[0] != '\0') {
- zval **response_header_new, *entry, **entryp;
- ELS_FETCH();
-
- fp = php_fopen_url_wrap_http(location, mode, options, issock, socketd, opened_path);
- if (zend_hash_find(EG(active_symbol_table), "http_response_header", sizeof("http_response_header"), (void **) &response_header_new) == SUCCESS) {
- entryp = &entry;
- MAKE_STD_ZVAL(entry);
- ZVAL_EMPTY_STRING(entry);
- zend_hash_next_index_insert(Z_ARRVAL_P(response_header), entryp, sizeof(zval *), NULL);
- zend_hash_internal_pointer_reset(Z_ARRVAL_PP(response_header_new));
- while (zend_hash_get_current_data(Z_ARRVAL_PP(response_header_new), (void **)&entryp) == SUCCESS) {
- zval_add_ref(entryp);
- zend_hash_next_index_insert(Z_ARRVAL_P(response_header), entryp, sizeof(zval *), NULL);
- zend_hash_move_forward(Z_ARRVAL_PP(response_header_new));
- }
- }
- goto out;
- } else {
- fp = NULL;
- goto out;
- }
- }
- php_url_free(resource);
- *issock = 1;
- out:
- {
- ELS_FETCH();
- ZEND_SET_SYMBOL(EG(active_symbol_table), "http_response_header", response_header);
- }
- return (fp);
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/standard/image.c b/ext/standard/image.c
deleted file mode 100644
index 7b550f9519..0000000000
--- a/ext/standard/image.c
+++ /dev/null
@@ -1,530 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Rasmus Lerdorf |
- +----------------------------------------------------------------------+
- */
-/* $Id$ */
-/*
- * Based on Daniel Schmitt's imageinfo.c which carried the following
- * Copyright notice.
- */
-
-/*
- * imageinfo.c
- *
- * Simple routines to extract image width/height data from GIF/JPEG files.
- *
- * Copyright (c) 1997 Daniel Schmitt, opal online publishing, Bonn, Germany.
- *
- * Includes code snippets from rdjpgcom.c,
- * Copyright (c) 1994-1995 Thomas G. Lane
- * from release 6a of the Independent JPEG Group's software.
- *
- * Legal status: see GNU General Public License version 2 or later.
- *
- */
-
-#include "php.h"
-#include <stdio.h>
-#if HAVE_FCNTL_H
-#include <fcntl.h>
-#endif
-#include "fopen_wrappers.h"
-#include "ext/standard/fsock.h"
-#if HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#include "php_image.h"
-
-/* file type markers */
-PHPAPI const char php_sig_gif[3] = {'G', 'I', 'F'};
-PHPAPI const char php_sig_psd[4] = {'8', 'B', 'P', 'S'};
-PHPAPI const char php_sig_bmp[2] = {'B', 'M'};
-PHPAPI const char php_sig_swf[3] = {'F', 'W', 'S'};
-PHPAPI const char php_sig_jpg[3] = {(char) 0xff, (char) 0xd8, (char) 0xff};
-PHPAPI const char php_sig_png[8] = {(char) 0x89, (char) 0x50, (char) 0x4e, (char) 0x47,
-(char) 0x0d, (char) 0x0a, (char) 0x1a, (char) 0x0a};
-
-/* return info as a struct, to make expansion easier */
-
-struct gfxinfo {
- unsigned int width;
- unsigned int height;
- unsigned int bits;
- unsigned int channels;
-};
-
-/* {{{ php_handle_gif
- * routine to handle GIF files. If only everything were that easy... ;} */
-static struct gfxinfo *php_handle_gif (int socketd, FILE *fp, int issock)
-{
- struct gfxinfo *result = NULL;
- unsigned char a[2];
- char temp[3];
-
- result = (struct gfxinfo *) ecalloc(1,sizeof(struct gfxinfo));
-
- FP_FREAD(temp, 3, socketd, fp, issock); /* fseek(fp, 6L, SEEK_SET); */
-
- FP_FREAD(a, sizeof(a), socketd, fp, issock); /* fread(a,sizeof(a),1,fp); */
- result->width = (unsigned short)a[0] | (((unsigned short)a[1])<<8);
-
- FP_FREAD(a, sizeof(a), socketd, fp, issock); /* fread(a,sizeof(a),1,fp); */
- result->height = (unsigned short)a[0] | (((unsigned short)a[1])<<8);
-
- return result;
-}
-/* }}} */
-
-/* {{{ php_handle_psd
- */
-static struct gfxinfo *php_handle_psd (int socketd, FILE *fp, int issock)
-{
- struct gfxinfo *result = NULL;
- unsigned char a[8];
- char temp[11];
- unsigned long in_width, in_height;
-
- result = (struct gfxinfo *) ecalloc(1,sizeof(struct gfxinfo));
- FP_FREAD(temp, sizeof(temp), socketd, fp, issock);
-
- if((FP_FREAD(a, sizeof(a), socketd, fp, issock)) <= 0) {
- in_height = 0;
- in_width = 0;
- } else {
- in_height = (((unsigned long) a[ 0 ]) << 24) + (((unsigned long) a[ 1 ]) << 16) + (((unsigned long) a[ 2 ]) << 8) + ((unsigned long) a[ 3 ]);
- in_width = (((unsigned long) a[ 4 ]) << 24) + (((unsigned long) a[ 5 ]) << 16) + (((unsigned long) a[ 6 ]) << 8) + ((unsigned long) a[ 7 ]);
- }
-
- result->width = (unsigned int) in_width;
- result->height = (unsigned int) in_height;
-
- return result;
-}
-/* }}} */
-
-/* {{{ php_handle_bmp
- */
-static struct gfxinfo *php_handle_bmp (int socketd, FILE *fp, int issock)
-{
- struct gfxinfo *result = NULL;
- char temp[15];
-
- struct {
- unsigned long in_width, in_height;
- } dim;
-
- result = (struct gfxinfo *) ecalloc (1, sizeof(struct gfxinfo));
-
- FP_FREAD(temp, sizeof(temp), socketd, fp, issock);
- FP_FREAD((char*) &dim, sizeof(dim), socketd, fp, issock);
- result->width = dim.in_width;
- result->height = dim.in_height;
-
- return result;
-}
-/* }}} */
-
-/* {{{ php_swf_get_bits
- * routines to handle SWF files. */
-static unsigned long int php_swf_get_bits (unsigned char* buffer, unsigned int pos, unsigned int count)
-{
- unsigned int loop;
- unsigned long int result = 0;
-
- for (loop = pos; loop < pos + count; loop++)
- {
- result = result +
- ((((buffer[loop / 8]) >> (7 - (loop % 8))) & 0x01) << (count - (loop - pos) - 1));
- }
- return result;
-}
-/* }}} */
-
-/* {{{ php_handle_swf
- */
-static struct gfxinfo *php_handle_swf (int socketd, FILE *fp, int issock)
-{
- struct gfxinfo *result = NULL;
- long bits;
- unsigned char a[32];
- char temp[5];
-
- result = (struct gfxinfo *) ecalloc (1, sizeof (struct gfxinfo));
- FP_FREAD(temp, 5, socketd, fp, issock); /* fseek(fp, 8L, SEEK_SET); */
-
- FP_FREAD(a, sizeof(a), socketd, fp, issock); /* fread(a,sizeof(a),1,fp); */
- bits = php_swf_get_bits (a, 0, 5);
- result->width = (php_swf_get_bits (a, 5 + bits, bits) -
- php_swf_get_bits (a, 5, bits)) / 20;
- result->height = (php_swf_get_bits (a, 5 + (3 * bits), bits) -
- php_swf_get_bits (a, 5 + (2 * bits), bits)) / 20;
- return result;
-}
-/* }}} */
-
-/* {{{ php_handle_png
- * routine to handle PNG files */
-static struct gfxinfo *php_handle_png (int socketd, FILE *fp, int issock)
-{
- struct gfxinfo *result = NULL;
- unsigned long in_width, in_height;
- char temp[8];
- unsigned char a[8];
-
- result = (struct gfxinfo *) ecalloc(1,sizeof(struct gfxinfo));
-
- FP_FREAD(temp, sizeof(temp), socketd, fp, issock); /* fseek(fp, 16L, SEEK_SET); */
-
- if((FP_FREAD(a, sizeof(a), socketd, fp, issock)) <= 0) {
- in_width = 0;
- in_height = 0;
- } else {
- in_width = (((unsigned long) a[ 0 ]) << 24) + (((unsigned long) a[ 1 ]) << 16) + (((unsigned long) a[ 2 ]) << 8) + ((unsigned long) a[ 3 ]);
- in_height = (((unsigned long) a[ 4 ]) << 24) + (((unsigned long) a[ 5 ]) << 16) + (((unsigned long) a[ 6 ]) << 8) + ((unsigned long) a[ 7 ]);
- }
-
- result->width = (unsigned int) in_width;
- result->height = (unsigned int) in_height;
- return result;
-}
-/* }}} */
-
-/* routines to handle JPEG data */
-
-/* some defines for the different JPEG block types */
-#define M_SOF0 0xC0 /* Start Of Frame N */
-#define M_SOF1 0xC1 /* N indicates which compression process */
-#define M_SOF2 0xC2 /* Only SOF0-SOF2 are now in common use */
-#define M_SOF3 0xC3
-#define M_SOF5 0xC5 /* NB: codes C4 and CC are NOT SOF markers */
-#define M_SOF6 0xC6
-#define M_SOF7 0xC7
-#define M_SOF9 0xC9
-#define M_SOF10 0xCA
-#define M_SOF11 0xCB
-#define M_SOF13 0xCD
-#define M_SOF14 0xCE
-#define M_SOF15 0xCF
-#define M_SOI 0xD8
-#define M_EOI 0xD9 /* End Of Image (end of datastream) */
-#define M_SOS 0xDA /* Start Of Scan (begins compressed data) */
-#define M_APP0 0xe0
-#define M_APP1 0xe1
-#define M_APP2 0xe2
-#define M_APP3 0xe3
-#define M_APP4 0xe4
-#define M_APP5 0xe5
-#define M_APP6 0xe6
-#define M_APP7 0xe7
-#define M_APP8 0xe8
-#define M_APP9 0xe9
-#define M_APP10 0xea
-#define M_APP11 0xeb
-#define M_APP12 0xec
-#define M_APP13 0xed
-#define M_APP14 0xee
-#define M_APP15 0xef
-
-/* {{{ php_read2
- */
-static unsigned short php_read2(int socketd, FILE *fp, int issock)
-{
- unsigned char a[2];
-
- /* just return 0 if we hit the end-of-file */
- if((FP_FREAD(a, sizeof(a), socketd, fp, issock)) <= 0) return 0;
-
- return (((unsigned short) a[ 0 ]) << 8) + ((unsigned short) a[ 1 ]);
-}
-/* }}} */
-
-/* {{{ php_next_marker
- */
-static unsigned int php_next_marker(int socketd, FILE *fp, int issock)
- /* get next marker byte from file */
-{
- int c;
-
- /* get marker byte, swallowing possible padding */
- do {
- if ((c = FP_FGETC(socketd,fp,issock)) == EOF)
- return M_EOI; /* we hit EOF */
- } while (c == 0xff);
-
- return (unsigned int) c;
-}
-/* }}} */
-
-/* {{{ php_skip_variable
- */
-static void php_skip_variable(int socketd, FILE *fp, int issock)
- /* skip over a variable-length block; assumes proper length marker */
-{
- unsigned short length;
- char *tmp;
-
- length = php_read2(socketd,fp,issock);
- length -= 2; /* length includes itself */
-
- tmp = emalloc(length);
- FP_FREAD(tmp, (long) length, socketd, fp, issock); /* skip the header */
- efree(tmp);
-}
-/* }}} */
-
-/* {{{ php_read_APP
- */
-static void php_read_APP(int socketd, FILE *fp, int issock,unsigned int marker,pval *info)
-{
- unsigned short length;
- unsigned char *buffer;
- unsigned char markername[ 16 ];
- zval *tmp;
-
- length = php_read2(socketd,fp,issock);
- length -= 2; /* length includes itself */
-
- buffer = emalloc(length);
-
- if (FP_FREAD(buffer, (long) length, socketd, fp, issock) <= 0) {
- efree(buffer);
- return;
- }
-
- sprintf(markername,"APP%d",marker - M_APP0);
-
- if (zend_hash_find(info->value.ht, markername, strlen(markername)+1, (void **) &tmp) == FAILURE) {
- /* XXX we onyl catch the 1st tag of it's kind! */
- add_assoc_stringl(info,markername,buffer,length,1);
- }
-
- efree(buffer);
-}
-/* }}} */
-
-/* {{{ php_handle_jpeg
- main loop to parse JPEG structure */
-static struct gfxinfo *php_handle_jpeg (int socketd, FILE *fp, int issock, pval *info)
-{
- struct gfxinfo *result = NULL;
- unsigned int marker;
- char tmp[2];
- unsigned char a[4];
-
- for (;;) {
- marker = php_next_marker(socketd,fp,issock);
- switch (marker) {
- case M_SOF0:
- case M_SOF1:
- case M_SOF2:
- case M_SOF3:
- case M_SOF5:
- case M_SOF6:
- case M_SOF7:
- case M_SOF9:
- case M_SOF10:
- case M_SOF11:
- case M_SOF13:
- case M_SOF14:
- case M_SOF15:
- if (result == NULL) {
- /* handle SOFn block */
- result = (struct gfxinfo *) ecalloc(1,sizeof(struct gfxinfo));
- FP_FREAD(tmp, sizeof(tmp), socketd, fp, issock);
- result->bits = FP_FGETC(socketd,fp,issock);
- FP_FREAD(a, sizeof(a), socketd, fp, issock);
- result->height = (((unsigned short) a[ 0 ]) << 8) + ((unsigned short) a[ 1 ]);
- result->width = (((unsigned short) a[ 2 ]) << 8) + ((unsigned short) a[ 3 ]);
- result->channels = FP_FGETC(socketd,fp,issock);
-
- if (! info) /* if we don't want an extanded info -> return */
- return result;
- } else {
- php_skip_variable(socketd,fp,issock);
- }
- break;
-
- case M_APP0:
- case M_APP1:
- case M_APP2:
- case M_APP3:
- case M_APP4:
- case M_APP5:
- case M_APP6:
- case M_APP7:
- case M_APP8:
- case M_APP9:
- case M_APP10:
- case M_APP11:
- case M_APP12:
- case M_APP13:
- case M_APP14:
- case M_APP15:
- if (info) {
- php_read_APP(socketd,fp,issock,marker,info); /* read all the app markes... */
- } else {
- php_skip_variable(socketd,fp,issock);
- }
- break;
-
- case M_SOS:
- case M_EOI:
- return result; /* we're about to hit image data, or are at EOF. stop processing. */
- break;
-
- default:
- php_skip_variable(socketd,fp,issock); /* anything else isn't interesting */
- break;
- }
- }
-
- return NULL;
-}
-/* }}} */
-
-/* main function */
-
-/* {{{ proto array getimagesize(string imagefile [, array info])
- Get the size of an image as 4-element array */
-PHP_FUNCTION(getimagesize)
-{
- pval **arg1,**info = 0;
- FILE *fp;
- int issock=0, socketd=0, rsrc_id;
- int itype = 0;
- char filetype[8];
- char temp[64];
- struct gfxinfo *result = NULL;
-
- switch(ZEND_NUM_ARGS()) {
-
- case 1:
- if (zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(arg1);
- break;
-
- case 2:
- if (zend_get_parameters_ex(2, &arg1, &info) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- if (!ParameterPassedByReference(ht, 2)) {
- php_error(E_WARNING, "Array to be filled with values must be passed by reference.");
- RETURN_FALSE;
- }
-
- zval_dtor(*info);
-
- if (array_init(*info) == FAILURE) {
- return;
- }
-
- convert_to_string_ex(arg1);
- break;
-
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- fp = php_fopen_wrapper(Z_STRVAL_PP(arg1), "rb", IGNORE_PATH|ENFORCE_SAFE_MODE, &issock, &socketd, NULL);
-
- if (!fp && !socketd) {
- if (issock != BAD_URL) {
- char *tmp = estrndup(Z_STRVAL_PP(arg1), Z_STRLEN_PP(arg1));
- php_strip_url_passwd(tmp);
- php_error(E_WARNING,"getimagesize: Unable to open '%s' for reading.", tmp);
- efree(tmp);
- }
- RETURN_FALSE;
- }
-
- if (issock) {
- int *sock=emalloc(sizeof(int));
- *sock = socketd;
- rsrc_id = ZEND_REGISTER_RESOURCE(NULL,sock,php_file_le_socket());
- } else {
- rsrc_id = ZEND_REGISTER_RESOURCE(NULL,fp,php_file_le_fopen());
- }
-
- if((FP_FREAD(filetype, 3, socketd, fp, issock)) <= 0) {
- php_error(E_WARNING,"getimagesize: Read error!");
- RETURN_FALSE;
- }
-
- if (!memcmp(filetype, php_sig_gif, 3)) {
- result = php_handle_gif (socketd, fp, issock);
- itype = 1;
- } else if (!memcmp(filetype, php_sig_jpg, 3)) {
- if (info) {
- result = php_handle_jpeg(socketd, fp, issock, *info);
- } else {
- result = php_handle_jpeg(socketd, fp, issock, NULL);
- }
- itype = 2;
- } else if (!memcmp(filetype, php_sig_png, 3)) {
- FP_FREAD(filetype+3, 5, socketd, fp, issock);
- if (!memcmp(filetype, php_sig_png, 8)) {
- result = php_handle_png(socketd, fp, issock);
- itype = 3;
- } else {
- php_error(E_WARNING, "PNG file corrupted by ASCII conversion");
- }
- } else if (!memcmp(filetype, php_sig_swf, 3)) {
- result = php_handle_swf(socketd, fp, issock);
- itype = 4;
- } else if (!memcmp(filetype, php_sig_psd, 3)) {
- result = php_handle_psd(socketd, fp, issock);
- itype = 5;
- } else if (!memcmp(filetype, php_sig_bmp, 2)) {
- result = php_handle_bmp(socketd, fp, issock);
- itype = 6;
- }
-
- zend_list_delete(rsrc_id);
-
- if (result) {
- if (array_init(return_value) == FAILURE) {
- php_error(E_ERROR, "Unable to initialize array");
- efree(result);
- return;
- }
- add_index_long(return_value, 0, result->width);
- add_index_long(return_value, 1, result->height);
- add_index_long(return_value, 2, itype);
- sprintf(temp, "width=\"%d\" height=\"%d\"", result->width, result->height); /* safe */
- add_index_string(return_value, 3, temp, 1);
-
- if (result->bits != 0) {
- add_assoc_long(return_value,"bits",result->bits);
- }
- if (result->channels != 0) {
- add_assoc_long(return_value,"channels",result->channels);
- }
- efree(result);
- }
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/standard/incomplete_class.c b/ext/standard/incomplete_class.c
deleted file mode 100644
index c0019282e8..0000000000
--- a/ext/standard/incomplete_class.c
+++ /dev/null
@@ -1,150 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Sascha Schumann <sascha@schumann.cx> |
- +----------------------------------------------------------------------+
- */
-
-
-/* $Id$ */
-
-#include "php.h"
-#include "basic_functions.h"
-#include "php_incomplete_class.h"
-
-#define INCOMPLETE_CLASS_MSG \
- "The script tried to execute a method or " \
- "access a property of an incomplete object. " \
- "Please ensure that the class definition <b>%s</b> of the object " \
- "you are trying to operate on was loaded _before_ " \
- "the session was started"
-
-#define INCOMPLETE_CLASS "__PHP_Incomplete_Class"
-#define MAGIC_MEMBER "__PHP_Incomplete_Class_Name"
-
-/* {{{ incomplete_class_message
- */
-static void incomplete_class_message(zend_property_reference *ref)
-{
- char buf[1024];
- char *class_name;
-
- class_name = php_lookup_class_name(ref->object, NULL, 0);
-
- if (!class_name)
- class_name = estrdup("unknown");
-
- snprintf(buf, 1023, INCOMPLETE_CLASS_MSG, class_name);
-
- efree(class_name);
-
- php_error(E_ERROR, "%s", buf);
-}
-/* }}} */
-
-/* {{{ incomplete_class_call_func
- */
-static void incomplete_class_call_func(INTERNAL_FUNCTION_PARAMETERS, zend_property_reference *property_reference)
-{
- incomplete_class_message(property_reference);
-}
-/* }}} */
-
-/* {{{ incomplete_class_set_property
- */
-static int incomplete_class_set_property(zend_property_reference *property_reference, zval *value)
-{
- incomplete_class_message(property_reference);
-
- /* does not reach this point */
- return (0);
-}
-/* }}} */
-
-/* {{{ incomplete_class_get_property
- */
-static zval incomplete_class_get_property(zend_property_reference *property_reference)
-{
- zval foo;
-
- incomplete_class_message(property_reference);
-
- /* does not reach this point */
- memset(&foo, 0, sizeof(zval)); /* shut warnings up */
- return (foo);
-}
-/* }}} */
-
-/* {{{ php_create_incomplete_class
- */
-zend_class_entry *php_create_incomplete_class(BLS_D)
-{
- zend_class_entry incomplete_class;
-
- INIT_OVERLOADED_CLASS_ENTRY(incomplete_class, INCOMPLETE_CLASS, NULL,
- incomplete_class_call_func,
- incomplete_class_get_property,
- incomplete_class_set_property);
-
- BG(incomplete_class) = zend_register_internal_class(&incomplete_class);
-
- return (BG(incomplete_class));
-}
-/* }}} */
-
-/* {{{ php_lookup_class_name
- */
-char *php_lookup_class_name(zval *object, size_t *nlen, zend_bool del)
-{
- zval **val;
- char *retval = NULL;
-
- if (zend_hash_find(object->value.obj.properties, MAGIC_MEMBER, sizeof(MAGIC_MEMBER), (void **) &val) == SUCCESS) {
- retval = estrndup(Z_STRVAL_PP(val), Z_STRLEN_PP(val));
-
- if (nlen)
- *nlen = Z_STRLEN_PP(val);
-
- if (del)
- zend_hash_del(object->value.obj.properties, MAGIC_MEMBER, sizeof(MAGIC_MEMBER));
- }
-
- return (retval);
-}
-/* }}} */
-
-/* {{{ php_store_class_name
- */
-void php_store_class_name(zval *object, const char *name, size_t len)
-{
- zval *val;
-
- MAKE_STD_ZVAL(val);
-
- Z_TYPE_P(val) = IS_STRING;
- Z_STRVAL_P(val) = estrndup(name, len);
- Z_STRLEN_P(val) = len;
-
- zend_hash_update(object->value.obj.properties, MAGIC_MEMBER, sizeof(MAGIC_MEMBER), &val, sizeof(val), NULL);
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/standard/info.c b/ext/standard/info.c
deleted file mode 100644
index 8f911d2f68..0000000000
--- a/ext/standard/info.c
+++ /dev/null
@@ -1,574 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#include "php.h"
-#include "php_ini.h"
-#include "php_globals.h"
-#include "ext/standard/head.h"
-#include "info.h"
-#include "credits.h"
-#include "SAPI.h"
-#include <time.h>
-#if !defined(PHP_WIN32)
-#include "build-defs.h"
-#endif
-#include "zend_globals.h" /* needs ELS */
-#include "zend_highlight.h"
-
-#define SECTION(name) PUTS("<h2 align=\"center\">" name "</h2>\n")
-
-PHPAPI extern char *php_ini_opened_path;
-
-/* {{{ _display_module_info
- */
-static int _display_module_info(zend_module_entry *module, void *arg)
-{
- int show_info_func = *((int *) arg);
-
- if (show_info_func && module->info_func) {
- php_printf("<h2 align=\"center\"><a name=\"module_%s\">%s</a></h2>\n", module->name, module->name);
- module->info_func(module);
- } else if (!show_info_func && !module->info_func) {
- php_printf("<tr valign=\"baseline\" bgcolor=\"" PHP_CONTENTS_COLOR "\">");
- php_printf("<td>");
- php_printf("%s", module->name);
- php_printf("</td></tr>\n");
- }
- return 0;
-}
-/* }}} */
-
-/* {{{ php_print_gpcse_array
- */
-static void php_print_gpcse_array(char *name, uint name_length ELS_DC)
-{
- zval **data, **tmp, tmp2;
- char *string_key;
- ulong num_key;
-
- if (zend_hash_find(&EG(symbol_table), name, name_length+1, (void **) &data)!=FAILURE
- && ((*data)->type==IS_ARRAY)) {
- zend_hash_internal_pointer_reset((*data)->value.ht);
- while (zend_hash_get_current_data((*data)->value.ht, (void **) &tmp) == SUCCESS) {
- PUTS("<tr valign=\"baseline\" bgcolor=\"" PHP_CONTENTS_COLOR "\">");
- PUTS("<td bgcolor=\"" PHP_ENTRY_NAME_COLOR "\"><b>");
- PUTS(name);
- PUTS("[\"");
- switch (zend_hash_get_current_key((*data)->value.ht, &string_key, &num_key, 0)) {
- case HASH_KEY_IS_STRING:
- zend_html_puts(string_key, strlen(string_key));
- break;
- case HASH_KEY_IS_LONG:
- php_printf("%ld",num_key);
- break;
- }
- PUTS("\"]</b></td><td>");
- if ((*tmp)->type == IS_ARRAY) {
- PUTS("<pre>");
- zend_print_zval_r(*tmp, 0);
- PUTS("</pre>");
- } else if ((*tmp)->type != IS_STRING) {
- tmp2 = **tmp;
- zval_copy_ctor(&tmp2);
- convert_to_string(&tmp2);
- zend_html_puts(tmp2.value.str.val, tmp2.value.str.len);
- zval_dtor(&tmp2);
- } else {
- zend_html_puts((*tmp)->value.str.val, (*tmp)->value.str.len);
- }
- PUTS("&nbsp;</td></tr>\n");
- zend_hash_move_forward((*data)->value.ht);
- }
- }
-}
-/* }}} */
-
-/* {{{ php_info_print_style
- */
-void php_info_print_style(void)
-{
- php_printf("<style type=\"text/css\"><!--\n");
- php_printf("a { text-decoration: none; }\n");
- php_printf("a:hover { text-decoration: underline; }\n");
- php_printf("h1 { font-family: arial,helvetica,sans-serif; font-size: 18pt; font-weight: bold;}\n");
- php_printf("h2 { font-family: arial,helvetica,sans-serif; font-size: 14pt; font-weight: bold;}\n");
- php_printf("body,td { font-family: arial,helvetica,sans-serif; font-size: 10pt; }\n");
- php_printf("th { font-family: arial,helvetica,sans-serif; font-size: 11pt; font-weight: bold; }\n");
- php_printf("//--></style>\n");
-}
-/* }}} */
-
-/* {{{ php_get_uname
- */
-PHPAPI char *php_get_uname()
-{
- char *php_uname;
-#ifdef PHP_WIN32
- char php_windows_uname[256];
- DWORD dwBuild=0;
- DWORD dwVersion = GetVersion();
- DWORD dwWindowsMajorVersion = (DWORD)(LOBYTE(LOWORD(dwVersion)));
- DWORD dwWindowsMinorVersion = (DWORD)(HIBYTE(LOWORD(dwVersion)));
-
- /* Get build numbers for Windows NT or Win95 */
- if (dwVersion < 0x80000000){
- dwBuild = (DWORD)(HIWORD(dwVersion));
- snprintf(php_windows_uname,255,"%s %d.%d build %d","Windows NT",dwWindowsMajorVersion,dwWindowsMinorVersion,dwBuild);
- } else {
- snprintf(php_windows_uname,255,"%s %d.%d","Windows 95/98",dwWindowsMajorVersion,dwWindowsMinorVersion);
- }
- php_uname = php_windows_uname;
-#else
- php_uname=PHP_UNAME;
-#endif
- return estrdup(php_uname);
-}
-/* }}} */
-
-/* {{{ php_print_info
- */
-PHPAPI void php_print_info(int flag)
-{
- char **env,*tmp1,*tmp2;
- char *php_uname;
- int expose_php = INI_INT("expose_php");
- time_t the_time;
- struct tm *ta, tmbuf;
- ELS_FETCH();
- SLS_FETCH();
-
- the_time = time(NULL);
- ta = php_localtime_r(&the_time, &tmbuf);
-
- PUTS("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n<html>\n");
-
- if (flag & PHP_INFO_GENERAL) {
- char *zend_version = get_zend_version();
-
- php_uname = php_get_uname();
- PUTS("<head>");
- php_info_print_style();
- PUTS("<title>phpinfo()</title></head><body>");
-
- php_info_print_box_start(1);
- if (expose_php) {
- PUTS("<a href=\"http://www.php.net/\"><img src=\"");
- if (SG(request_info).request_uri) {
- PUTS(SG(request_info).request_uri);
- }
- if ((ta->tm_mon==3) && (ta->tm_mday==1)) {
- PUTS("?="PHP_EGG_LOGO_GUID"\" border=0 align=\"right\" alt=\"Thies!\"></a>");
- } else {
- PUTS("?="PHP_LOGO_GUID"\" border=0 align=\"right\" alt=\"PHP Logo\"></a>");
- }
- }
- php_printf("<h1>PHP Version %s</h1>\n", PHP_VERSION);
- php_info_print_box_end();
- php_info_print_table_start();
- php_info_print_table_row(2, "System", php_uname );
- php_info_print_table_row(2, "Build Date", __DATE__ );
-#ifdef CONFIGURE_COMMAND
- php_info_print_table_row(2, "Configure Command", CONFIGURE_COMMAND );
-#endif
- if (sapi_module.pretty_name) {
- php_info_print_table_row(2, "Server API", sapi_module.pretty_name );
- }
-
-#ifdef VIRTUAL_DIR
- php_info_print_table_row(2, "Virtual Directory Support", "enabled" );
-#else
- php_info_print_table_row(2, "Virtual Directory Support", "disabled" );
-#endif
-
- php_info_print_table_row(2, "Configuration File (php.ini) Path", php_ini_opened_path?php_ini_opened_path:PHP_CONFIG_FILE_PATH);
-
-#if ZEND_DEBUG
- php_info_print_table_row(2, "ZEND_DEBUG", "enabled" );
-#else
- php_info_print_table_row(2, "ZEND_DEBUG", "disabled" );
-#endif
-
-#ifdef ZTS
- php_info_print_table_row(2, "Thread Safety", "enabled" );
-#else
- php_info_print_table_row(2, "Thread Safety", "disabled" );
-#endif
-
-#if HAVE_PHP_STREAM
- php_info_print_table_row(2, "Experimental PHP Streams", "enabled");
-#endif
-
- php_info_print_table_end();
-
- /* Zend Engine */
- php_info_print_box_start(0);
- if (expose_php) {
- PUTS("<a href=\"http://www.zend.com/\"><img src=\"");
- if (SG(request_info).request_uri) {
- PUTS(SG(request_info).request_uri);
- }
- PUTS("?="ZEND_LOGO_GUID"\" border=\"0\" align=\"right\" alt=\"Zend logo\"></a>\n");
- }
- php_printf("This program makes use of the Zend Scripting Language Engine:<br>");
- zend_html_puts(zend_version, strlen(zend_version));
- php_info_print_box_end();
- efree(php_uname);
- }
-
- if ((flag & PHP_INFO_CREDITS) && expose_php) {
- php_info_print_hr();
- PUTS("<h1 align=\"center\"><a href=\"");
- if (SG(request_info).request_uri) {
- PUTS(SG(request_info).request_uri);
- }
- PUTS("?=PHPB8B5F2A0-3C92-11d3-A3A9-4C7B08C10000\">");
- PUTS("PHP 4.0 Credits");
- PUTS("</a></h1>\n");
- }
-
- zend_ini_sort_entries(ELS_C);
-
- if (flag & PHP_INFO_CONFIGURATION) {
- php_info_print_hr();
- PUTS("<h1 align=\"center\">Configuration</h1>\n");
- SECTION("PHP Core\n");
- display_ini_entries(NULL);
- }
-
- if (flag & PHP_INFO_MODULES) {
- int show_info_func;
-
- show_info_func = 1;
- zend_hash_apply_with_argument(&module_registry, (int (*)(void *, void *)) _display_module_info, &show_info_func);
-
- SECTION("Additional Modules");
- php_info_print_table_start();
- show_info_func = 0;
- zend_hash_apply_with_argument(&module_registry, (int (*)(void *, void *)) _display_module_info, &show_info_func);
- php_info_print_table_end();
- }
-
- if (flag & PHP_INFO_ENVIRONMENT) {
- SECTION("Environment");
- php_info_print_table_start();
- php_info_print_table_header(2, "Variable", "Value");
- for (env=environ; env!=NULL && *env !=NULL; env++) {
- tmp1 = estrdup(*env);
- if (!(tmp2=strchr(tmp1,'='))) { /* malformed entry? */
- efree(tmp1);
- continue;
- }
- *tmp2 = 0;
- tmp2++;
- php_info_print_table_row(2, tmp1, tmp2);
- efree(tmp1);
- }
- php_info_print_table_end();
- }
-
- if (flag & PHP_INFO_VARIABLES) {
- pval **data;
-
- SECTION("PHP Variables");
-
- php_info_print_table_start();
- php_info_print_table_header(2, "Variable", "Value");
- if (zend_hash_find(&EG(symbol_table), "PHP_SELF", sizeof("PHP_SELF"), (void **) &data) != FAILURE) {
- php_info_print_table_row(2, "PHP_SELF", (*data)->value.str.val);
- }
- if (zend_hash_find(&EG(symbol_table), "PHP_AUTH_TYPE", sizeof("PHP_AUTH_TYPE"), (void **) &data) != FAILURE) {
- php_info_print_table_row(2, "PHP_AUTH_TYPE", (*data)->value.str.val);
- }
- if (zend_hash_find(&EG(symbol_table), "PHP_AUTH_USER", sizeof("PHP_AUTH_USER"), (void **) &data) != FAILURE) {
- php_info_print_table_row(2, "PHP_AUTH_USER", (*data)->value.str.val);
- }
- if (zend_hash_find(&EG(symbol_table), "PHP_AUTH_PW", sizeof("PHP_AUTH_PW"), (void **) &data) != FAILURE) {
- php_info_print_table_row(2, "PHP_AUTH_PW", (*data)->value.str.val);
- }
- php_print_gpcse_array("HTTP_GET_VARS", sizeof("HTTP_GET_VARS")-1 ELS_CC);
- php_print_gpcse_array("HTTP_POST_VARS", sizeof("HTTP_POST_VARS")-1 ELS_CC);
- php_print_gpcse_array("HTTP_POST_FILES", sizeof("HTTP_POST_FILES")-1 ELS_CC);
- php_print_gpcse_array("HTTP_COOKIE_VARS", sizeof("HTTP_COOKIE_VARS")-1 ELS_CC);
- php_print_gpcse_array("HTTP_SERVER_VARS", sizeof("HTTP_SERVER_VARS")-1 ELS_CC);
- php_print_gpcse_array("HTTP_ENV_VARS", sizeof("HTTP_ENV_VARS")-1 ELS_CC);
- php_info_print_table_end();
- }
-
- if (flag & PHP_INFO_LICENSE) {
- SECTION("PHP License");
- php_info_print_box_start(0);
- PUTS("<p>\n");
- PUTS("This program is free software; you can redistribute it and/or modify ");
- PUTS("it under the terms of the PHP License as published by the PHP Group ");
- PUTS("and included in the distribution in the file: LICENSE\n");
- PUTS("</p>\n");
- PUTS("<p>");
- PUTS("This program is distributed in the hope that it will be useful, ");
- PUTS("but WITHOUT ANY WARRANTY; without even the implied warranty of ");
- PUTS("MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n");
- PUTS("</p>\n");
- PUTS("<p>");
- PUTS("If you did not receive a copy of the PHP license, or have any questions about ");
- PUTS("PHP licensing, please contact license@php.net.\n");
- PUTS("</p>\n");
- php_info_print_box_end();
- }
-
- PUTS("</body></html>");
-}
-/* }}} */
-
-
-PHPAPI void php_info_print_table_start()
-{
- php_printf("<table border=\"0\" cellpadding=\"3\" cellspacing=\"1\" width=\"600\" bgcolor=\"#000000\" align=\"center\">\n");
-}
-
-PHPAPI void php_info_print_table_end()
-{
- php_printf("</table><br>\n");
-
-}
-
-PHPAPI void php_info_print_box_start(int flag)
-{
- php_info_print_table_start();
- if (flag) {
- php_printf("<tr valign=\"middle\" bgcolor=\"" PHP_HEADER_COLOR "\"><td align=\"left\">\n");
- } else {
- php_printf("<tr valign=\"top\" bgcolor=\"" PHP_CONTENTS_COLOR "\"><td align=\"left\">\n");
- }
-}
-
-PHPAPI void php_info_print_box_end()
-{
- php_printf("</td></tr>\n");
- php_info_print_table_end();
-}
-
-PHPAPI void php_info_print_hr()
-{
- php_printf("<hr noshade size=\"1\" width=\"600\">\n");
-}
-
-PHPAPI void php_info_print_table_colspan_header(int num_cols, char *header)
-{
- php_printf("<tr bgcolor=\"" PHP_HEADER_COLOR "\"><th colspan=\"%d\">%s</th></tr>\n", num_cols, header );
-}
-
-/* {{{ php_info_print_table_header
- */
-PHPAPI void php_info_print_table_header(int num_cols, ...)
-{
- int i;
- va_list row_elements;
- char *row_element;
-
- va_start(row_elements, num_cols);
-
- php_printf("<tr valign=\"middle\" bgcolor=\"" PHP_HEADER_COLOR "\">");
- for (i=0; i<num_cols; i++) {
- row_element = va_arg(row_elements, char *);
- if (!row_element || !*row_element) {
- row_element = "&nbsp;";
- }
- php_printf("<th>%s</th>", row_element);
- }
- php_printf("</tr>\n");
-
- va_end(row_elements);
-}
-/* }}} */
-
-/* {{{ php_info_print_table_row
- */
-PHPAPI void php_info_print_table_row(int num_cols, ...)
-{
- int i;
- va_list row_elements;
- char *row_element;
-
- va_start(row_elements, num_cols);
-
- php_printf("<tr valign=\"baseline\" bgcolor=\"" PHP_CONTENTS_COLOR "\">");
- for (i=0; i<num_cols; i++) {
- php_printf("<td %s>%s",
- (i==0?"bgcolor=\"" PHP_ENTRY_NAME_COLOR "\" ":"align=\"left\""),
- (i==0?"<b>":""));
-
- row_element = va_arg(row_elements, char *);
- if (!row_element || !*row_element) {
- php_printf("&nbsp;");
- } else {
- zend_html_puts(row_element, strlen(row_element));
- }
-
- php_printf("%s</td>", (i==0?"</b>":""));
- }
- php_printf("</tr>\n");
-
- va_end(row_elements);
-}
-/* }}} */
-
-/* {{{ register_phpinfo_constants
- */
-void register_phpinfo_constants(INIT_FUNC_ARGS)
-{
- REGISTER_LONG_CONSTANT("INFO_GENERAL", PHP_INFO_GENERAL, CONST_PERSISTENT|CONST_CS);
- REGISTER_LONG_CONSTANT("INFO_CREDITS", PHP_INFO_CREDITS, CONST_PERSISTENT|CONST_CS);
- REGISTER_LONG_CONSTANT("INFO_CONFIGURATION", PHP_INFO_CONFIGURATION, CONST_PERSISTENT|CONST_CS);
- REGISTER_LONG_CONSTANT("INFO_MODULES", PHP_INFO_MODULES, CONST_PERSISTENT|CONST_CS);
- REGISTER_LONG_CONSTANT("INFO_ENVIRONMENT", PHP_INFO_ENVIRONMENT, CONST_PERSISTENT|CONST_CS);
- REGISTER_LONG_CONSTANT("INFO_VARIABLES", PHP_INFO_VARIABLES, CONST_PERSISTENT|CONST_CS);
- REGISTER_LONG_CONSTANT("INFO_LICENSE", PHP_INFO_LICENSE, CONST_PERSISTENT|CONST_CS);
- REGISTER_LONG_CONSTANT("INFO_ALL", PHP_INFO_ALL, CONST_PERSISTENT|CONST_CS);
- REGISTER_LONG_CONSTANT("CREDITS_GROUP", PHP_CREDITS_GROUP, CONST_PERSISTENT|CONST_CS);
- REGISTER_LONG_CONSTANT("CREDITS_GENERAL", PHP_CREDITS_GENERAL, CONST_PERSISTENT|CONST_CS);
- REGISTER_LONG_CONSTANT("CREDITS_SAPI", PHP_CREDITS_SAPI, CONST_PERSISTENT|CONST_CS);
- REGISTER_LONG_CONSTANT("CREDITS_MODULES", PHP_CREDITS_MODULES, CONST_PERSISTENT|CONST_CS);
- REGISTER_LONG_CONSTANT("CREDITS_DOCS", PHP_CREDITS_DOCS, CONST_PERSISTENT|CONST_CS);
- REGISTER_LONG_CONSTANT("CREDITS_FULLPAGE", PHP_CREDITS_FULLPAGE, CONST_PERSISTENT|CONST_CS);
- REGISTER_LONG_CONSTANT("CREDITS_QA", PHP_CREDITS_QA, CONST_PERSISTENT|CONST_CS);
- REGISTER_LONG_CONSTANT("CREDITS_ALL", PHP_CREDITS_ALL, CONST_PERSISTENT|CONST_CS);
-}
-/* }}} */
-
-/* {{{ proto void phpinfo([int what])
- Output a page of useful information about PHP and the current request */
-PHP_FUNCTION(phpinfo)
-{
- int flag;
- zval **flag_arg;
-
-
- switch (ZEND_NUM_ARGS()) {
- case 0:
- flag = 0xFFFFFFFF;
- break;
- case 1:
- if (zend_get_parameters_ex(1, &flag_arg)==FAILURE) {
- RETURN_FALSE;
- }
- convert_to_long_ex(flag_arg);
- flag = (*flag_arg)->value.lval;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- php_print_info(flag);
- RETURN_TRUE;
-}
-
-/* }}} */
-
-/* {{{ proto string phpversion(void)
- Return the current PHP version */
-PHP_FUNCTION(phpversion)
-{
- RETURN_STRING(PHP_VERSION,1);
-}
-/* }}} */
-
-/* {{{ proto void phpcredits([int flag])
- Prints the list of people who've contributed to the PHP project */
-PHP_FUNCTION(phpcredits)
-{
- int flag;
- zval **flag_arg;
-
-
- switch (ZEND_NUM_ARGS()) {
- case 0:
- flag = 0xFFFFFFFF;
- break;
- case 1:
- if (zend_get_parameters_ex(1, &flag_arg)==FAILURE) {
- RETURN_FALSE;
- }
- convert_to_long_ex(flag_arg);
- flag = (*flag_arg)->value.lval;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- php_print_credits(flag);
- RETURN_TRUE;
-}
-
-/* }}} */
-
-/* {{{ proto string php_logo_guid(void)
- Return the special ID used to request the PHP logo in phpinfo screens*/
-PHP_FUNCTION(php_logo_guid)
-{
- RETURN_STRINGL(PHP_LOGO_GUID, sizeof(PHP_LOGO_GUID)-1, 1);
-}
-/* }}} */
-
-/* {{{ proto string php_egg_logo_guid(void)
- Return the special ID used to request the PHP logo in phpinfo screens*/
-PHP_FUNCTION(php_egg_logo_guid)
-{
- RETURN_STRINGL(PHP_EGG_LOGO_GUID, sizeof(PHP_EGG_LOGO_GUID)-1, 1);
-}
-/* }}} */
-
-/* {{{ proto string zend_logo_guid(void)
- Return the special ID used to request the Zend logo in phpinfo screens*/
-PHP_FUNCTION(zend_logo_guid)
-{
- RETURN_STRINGL(ZEND_LOGO_GUID, sizeof(ZEND_LOGO_GUID)-1, 1);
-}
-/* }}} */
-
-/* {{{ proto string php_sapi_name(void)
- Return the current SAPI module name */
-PHP_FUNCTION(php_sapi_name)
-{
- if (sapi_module.name) {
- RETURN_STRING(sapi_module.name,1);
- } else {
- RETURN_FALSE;
- }
-}
-
-/* }}} */
-
-/* {{{ proto string php_uname(void)
- Return information about the system PHP was built on */
-PHP_FUNCTION(php_uname)
-{
- RETURN_STRING(php_get_uname(), 0);
-}
-
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/standard/info.h b/ext/standard/info.h
deleted file mode 100644
index b4666f0fdb..0000000000
--- a/ext/standard/info.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef INFO_H
-#define INFO_H
-
-#define PHP_ENTRY_NAME_COLOR "#ccccff"
-#define PHP_CONTENTS_COLOR "#cccccc"
-#define PHP_HEADER_COLOR "#9999cc"
-
-#define PHP_INFO_GENERAL (1<<0)
-#define PHP_INFO_CREDITS (1<<1)
-#define PHP_INFO_CONFIGURATION (1<<2)
-#define PHP_INFO_MODULES (1<<3)
-#define PHP_INFO_ENVIRONMENT (1<<4)
-#define PHP_INFO_VARIABLES (1<<5)
-#define PHP_INFO_LICENSE (1<<6)
-#define PHP_INFO_ALL 0xFFFFFFFF
-
-#ifndef HAVE_CREDITS_DEFS
-#define HAVE_CREDITS_DEFS
-
-#define PHP_CREDITS_GROUP (1<<0)
-#define PHP_CREDITS_GENERAL (1<<1)
-#define PHP_CREDITS_SAPI (1<<2)
-#define PHP_CREDITS_MODULES (1<<3)
-#define PHP_CREDITS_DOCS (1<<4)
-#define PHP_CREDITS_FULLPAGE (1<<5)
-#define PHP_CREDITS_QA (1<<6)
-#define PHP_CREDITS_WEB (1<<7)
-#define PHP_CREDITS_ALL 0xFFFFFFFF
-
-#endif /* HAVE_CREDITS_DEFS */
-
-#define PHP_LOGO_GUID "PHPE9568F34-D428-11d2-A769-00AA001ACF42"
-#define PHP_EGG_LOGO_GUID "PHPE9568F36-D428-11d2-A769-00AA001ACF42"
-#define ZEND_LOGO_GUID "PHPE9568F35-D428-11d2-A769-00AA001ACF42"
-#define PHP_CREDITS_GUID "PHPB8B5F2A0-3C92-11d3-A3A9-4C7B08C10000"
-
-PHP_FUNCTION(phpversion);
-PHP_FUNCTION(phpinfo);
-PHP_FUNCTION(phpcredits);
-PHP_FUNCTION(php_logo_guid);
-PHP_FUNCTION(zend_logo_guid);
-PHP_FUNCTION(php_egg_logo_guid);
-PHP_FUNCTION(php_sapi_name);
-PHP_FUNCTION(php_uname);
-PHPAPI void php_print_info(int flag);
-PHPAPI void php_print_style(void);
-PHPAPI void php_info_print_style(void);
-PHPAPI void php_info_print_table_colspan_header(int num_cols, char *header);
-PHPAPI void php_info_print_table_header(int num_cols, ...);
-PHPAPI void php_info_print_table_row(int num_cols, ...);
-PHPAPI void php_info_print_table_start(void);
-PHPAPI void php_info_print_table_end(void);
-PHPAPI void php_info_print_box_start(int bg);
-PHPAPI void php_info_print_box_end(void);
-PHPAPI void php_info_print_hr(void);
-
-void register_phpinfo_constants(INIT_FUNC_ARGS);
-
-#endif /* INFO_H */
diff --git a/ext/standard/iptc.c b/ext/standard/iptc.c
deleted file mode 100644
index 0d07354455..0000000000
--- a/ext/standard/iptc.c
+++ /dev/null
@@ -1,395 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Thies C. Arntzen (thies@thieso.net) |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-/*
- * Functions to parse & compse IPTC data.
- * PhotoShop >= 3.0 can read and write textual data to JPEG files.
- * ... more to come .....
- *
- * i know, parts of this is now duplicated in image.c
- * but in this case i think it's okay!
- */
-
-/*
- * TODO:
- * - add IPTC translation table
- */
-
-#include "php.h"
-#include "php_iptc.h"
-#include "ext/standard/head.h"
-
-#include <sys/stat.h>
-
-
-/* some defines for the different JPEG block types */
-#define M_SOF0 0xC0 /* Start Of Frame N */
-#define M_SOF1 0xC1 /* N indicates which compression process */
-#define M_SOF2 0xC2 /* Only SOF0-SOF2 are now in common use */
-#define M_SOF3 0xC3
-#define M_SOF5 0xC5 /* NB: codes C4 and CC are NOT SOF markers */
-#define M_SOF6 0xC6
-#define M_SOF7 0xC7
-#define M_SOF9 0xC9
-#define M_SOF10 0xCA
-#define M_SOF11 0xCB
-#define M_SOF13 0xCD
-#define M_SOF14 0xCE
-#define M_SOF15 0xCF
-#define M_SOI 0xD8
-#define M_EOI 0xD9 /* End Of Image (end of datastream) */
-#define M_SOS 0xDA /* Start Of Scan (begins compressed data) */
-#define M_APP0 0xe0
-#define M_APP1 0xe1
-#define M_APP2 0xe2
-#define M_APP3 0xe3
-#define M_APP4 0xe4
-#define M_APP5 0xe5
-#define M_APP6 0xe6
-#define M_APP7 0xe7
-#define M_APP8 0xe8
-#define M_APP9 0xe9
-#define M_APP10 0xea
-#define M_APP11 0xeb
-#define M_APP12 0xec
-#define M_APP13 0xed
-#define M_APP14 0xee
-#define M_APP15 0xef
-
-/* {{{ php_iptc_put1
- */
-static int php_iptc_put1(FILE *fp,int spool,unsigned char c,unsigned char **spoolbuf)
-{
- if (spool > 0)
- PUTC(c);
-
- if (spoolbuf) *(*spoolbuf)++ = c;
-
- return c;
-}
-/* }}} */
-
-/* {{{ php_iptc_get1
- */
-static int php_iptc_get1(FILE *fp,int spool,unsigned char **spoolbuf)
-{
- int c;
- char cc;
-
- c = getc(fp);
-
- if (c == EOF) return EOF;
-
- if (spool > 0) {
- cc = c;
- PUTC(cc);
- }
-
- if (spoolbuf) *(*spoolbuf)++ = c;
-
- return c;
-}
-/* }}} */
-
-/* {{{ php_iptc_read_remaining
- */
-static int php_iptc_read_remaining(FILE *fp,int spool,unsigned char **spoolbuf)
-{
- int c;
-
- while ((c = php_iptc_get1(fp,spool,spoolbuf)) != EOF) continue;
-
- return M_EOI;
-}
-/* }}} */
-
-/* {{{ php_iptc_skip_variable
- */
-static int php_iptc_skip_variable(FILE *fp,int spool,unsigned char **spoolbuf)
-{
- unsigned int length;
- int c1,c2;
-
- if ((c1 = php_iptc_get1(fp,spool,spoolbuf)) == EOF) return M_EOI;
-
- if ((c2 = php_iptc_get1(fp,spool,spoolbuf)) == EOF) return M_EOI;
-
- length = (((unsigned char) c1) << 8) + ((unsigned char) c2);
-
- length -= 2;
-
- while (length--)
- if (php_iptc_get1(fp,spool,spoolbuf) == EOF) return M_EOI;
-
- return 0;
-}
-/* }}} */
-
-/* {{{ php_iptc_next_marker
- */
-static int php_iptc_next_marker(FILE *fp,int spool,unsigned char **spoolbuf)
-{
- int c;
-
- /* skip unimportant stuff */
-
- c = php_iptc_get1(fp,spool,spoolbuf);
-
- if (c == EOF) return M_EOI;
-
- while (c != 0xff) {
- if ((c = php_iptc_get1(fp,spool,spoolbuf)) == EOF)
- return M_EOI; /* we hit EOF */
- }
-
- /* get marker byte, swallowing possible padding */
- do {
- c = php_iptc_get1(fp,0,0);
- if (c == EOF)
- return M_EOI; /* we hit EOF */
- else
- if (c == 0xff)
- php_iptc_put1(fp,spool,(unsigned char)c,spoolbuf);
- } while (c == 0xff);
-
- return (unsigned int) c;
-}
-/* }}} */
-
-static char psheader[] = "\xFF\xED\0\0Photoshop 3.0\08BIM\x04\x04\0\0\0\0";
-
-/* {{{ proto array iptcembed(string iptcdata, string jpeg_file_name [, int spool])
- Embed binary IPTC data into a JPEG image. */
-PHP_FUNCTION(iptcembed)
-{
- zval **iptcdata, **jpeg_file, **spool_flag;
- FILE *fp;
- unsigned int marker;
- unsigned int spool = 0, done = 0, inx, len;
- unsigned char *spoolbuf=0,*poi=0;
- struct stat sb;
-
- switch(ZEND_NUM_ARGS()){
- case 3:
- if (zend_get_parameters_ex(3, &iptcdata, &jpeg_file, &spool_flag) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(iptcdata);
- convert_to_string_ex(jpeg_file);
- convert_to_long_ex(spool_flag);
- spool = (*spool_flag)->value.lval;
- break;
-
- case 2:
- if (zend_get_parameters_ex(2, &iptcdata, &jpeg_file) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(iptcdata);
- convert_to_string_ex(jpeg_file);
- break;
-
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- if (php_check_open_basedir((*jpeg_file)->value.str.val))
- RETURN_FALSE;
-
- if ((fp = VCWD_FOPEN((*jpeg_file)->value.str.val,"rb")) == 0) {
- php_error(E_WARNING, "Unable to open %s", (*jpeg_file)->value.str.val);
- RETURN_FALSE;
- }
-
- len = (*iptcdata)->value.str.len;
-
- if (spool < 2) {
- fstat(fileno(fp),&sb);
-
- poi = spoolbuf = emalloc(len + sizeof(psheader) + sb.st_size + 1024);
-
- if (! spoolbuf) {
- fclose(fp);
- RETURN_FALSE;
- }
- }
-
- if (php_iptc_get1(fp,spool,poi?&poi:0) != 0xFF) {
- fclose(fp);
- RETURN_FALSE;
- }
-
- if (php_iptc_get1(fp,spool,poi?&poi:0) != 0xD8) {
- fclose(fp);
- RETURN_FALSE;
- }
-
- while (!done) {
- marker = php_iptc_next_marker(fp,spool,poi?&poi:0);
-
- if (marker == M_EOI) { /* EOF */
- break;
- } else if (marker != M_APP13) {
- php_iptc_put1(fp,spool,(unsigned char)marker,poi?&poi:0);
- }
-
- switch (marker) {
- case M_APP13:
- /* we are going to write a new APP13 marker, so don't output the old one */
- php_iptc_skip_variable(fp,0,0);
- php_iptc_read_remaining(fp,spool,poi?&poi:0);
- done = 1;
- break;
-
- case M_APP0:
- /* APP0 is in each and every JPEG, so when we hit APP0 we insert our new APP13! */
- php_iptc_skip_variable(fp,spool,poi?&poi:0);
-
- if (len & 1) len++; /* make the length even */
-
- psheader[ 2 ] = (len+28)>>8;
- psheader[ 3 ] = (len+28)&0xff;
-
- for (inx = 0; inx < 28; inx++)
- php_iptc_put1(fp,spool,psheader[inx],poi?&poi:0);
-
- php_iptc_put1(fp,spool,(unsigned char)(len>>8),poi?&poi:0);
- php_iptc_put1(fp,spool,(unsigned char)(len&0xff),poi?&poi:0);
-
- for (inx = 0; inx < len; inx++)
- php_iptc_put1(fp,spool,(*iptcdata)->value.str.val[inx],poi?&poi:0);
- break;
-
- case M_SOS:
- /* we hit data, no more marker-inserting can be done! */
- php_iptc_read_remaining(fp,spool,poi?&poi:0);
- done = 1;
- break;
-
- default:
- php_iptc_skip_variable(fp,spool,poi?&poi:0);
- break;
- }
- }
-
- fclose(fp);
-
- if (spool < 2) {
- RETVAL_STRINGL(spoolbuf,poi - spoolbuf,0);
- } else {
- RETURN_TRUE;
- }
-}
-/* }}} */
-
-/* {{{ proto array iptcparse(string iptcdata)
- Parse binary IPTC-data into associative array */
-PHP_FUNCTION(iptcparse)
-{
- unsigned int length, inx, len, inheader, tagsfound;
- unsigned char *buffer;
- unsigned char recnum, dataset;
- unsigned char key[ 16 ];
- zval *values, **str, **element;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &str) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(str);
-
- inx = 0;
- length = (*str)->value.str.len;
- buffer = (*str)->value.str.val;
-
- inheader = 0; /* have we already found the IPTC-Header??? */
- tagsfound = 0; /* number of tags already found */
-
- while (inx < length) { /* find 1st tag */
- if ((buffer[inx] == 0x1c) && (buffer[inx+1] == 0x02)){
- break;
- } else {
- inx++;
- }
- }
-
- while (inx < length) {
- if (buffer[ inx++ ] != 0x1c) {
- break; /* we ran against some data which does not conform to IPTC - stop parsing! */
- }
-
- if ((inx + 4) >= length)
- break;
-
- dataset = buffer[ inx++ ];
- recnum = buffer[ inx++ ];
-
- if (buffer[ inx ] & (unsigned char) 0x80) { /* long tag */
- len = (((long) buffer[ inx + 2 ]) << 24) + (((long) buffer[ inx + 3 ]) << 16) +
- (((long) buffer[ inx + 4 ]) << 8) + (((long) buffer[ inx + 5 ]));
- inx += 6;
- } else { /* short tag */
- len = (((unsigned short) buffer[ inx ])<<8) | (unsigned short)buffer[ inx+1 ];
- inx += 2;
- }
-
- sprintf(key,"%d#%03d",(unsigned int) dataset,(unsigned int) recnum);
-
- if ((inx + len) > length)
- break;
-
- if (tagsfound == 0) { /* found the 1st tag - initialize the return array */
- if (array_init(return_value) == FAILURE) {
- php_error(E_ERROR, "Unable to initialize array");
- RETURN_FALSE;
- }
- }
-
- if (zend_hash_find(return_value->value.ht,key,strlen(key) + 1,(void **) &element) == FAILURE) {
- ALLOC_ZVAL(values);
- INIT_PZVAL(values);
- if (array_init(values) == FAILURE) {
- php_error(E_ERROR, "Unable to initialize array");
- RETURN_FALSE;
- }
-
- zend_hash_update(return_value->value.ht, key, strlen(key)+1, (void *) &values, sizeof(pval*), (void **) &element);
- }
-
- add_next_index_stringl(*element,buffer+inx,len,1);
-
- inx += len;
-
- tagsfound++;
- }
-
- if (! tagsfound) {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/standard/lcg.c b/ext/standard/lcg.c
deleted file mode 100644
index 22f6fc3fb5..0000000000
--- a/ext/standard/lcg.c
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Sascha Schumann <sascha@schumann.cx> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#include "php.h"
-#include "php_lcg.h"
-
-#if HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-
-#ifdef ZTS
-int lcg_globals_id;
-#else
-static php_lcg_globals lcg_globals;
-#endif
-
-static int php_lcg_initialized = 0;
-
-#ifdef PHP_WIN32
-#include <process.h>
-#endif
-
-/*
- * combinedLCG() returns a pseudo random number in the range of (0,1).
- * The function combines two CGs with periods of
- * 2^31 - 85 and 2^31 - 249. The period of this function
- * is equal to the product of both primes.
- */
-
-#define MODMULT(a,b,c,m,s) q = s/a;s=b*(s-a*q)-c*q;if(s<0)s+=m
-
-double php_combined_lcg(void)
-{
- long q;
- long z;
- LCGLS_FETCH();
-
- MODMULT(53668,40014,12211,2147483563L, LCG(s1));
- MODMULT(52774,40692,3791, 2147483399L, LCG(s2));
-
- z = LCG(s1) - LCG(s2);
- if(z < 1) {
- z += 2147483562;
- }
-
- return z * 4.656613e-10;
-}
-
-static void lcg_init_globals(LCGLS_D)
-{
- LCG(s1) = 1;
-#ifdef ZTS
- LCG(s2) = (long) tsrm_thread_id();
-#else
- LCG(s2) = (long) getpid();
-#endif
-}
-
-#ifdef ZTS
-PHP_MINIT_FUNCTION(lcg)
-{
- lcg_globals_id = ts_allocate_id(sizeof(php_lcg_globals), (ts_allocate_ctor) lcg_init_globals, NULL);
- return SUCCESS;
-}
-#else
-PHP_RINIT_FUNCTION(lcg)
-{
- if (!php_lcg_initialized) {
- lcg_init_globals();
- php_lcg_initialized = 1;
- }
- return SUCCESS;
-}
-#endif
-
-/* {{{ proto double lcg_value()
- Returns a value from the combined linear congruential generator */
-PHP_FUNCTION(lcg_value)
-{
- RETURN_DOUBLE(php_combined_lcg());
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/standard/levenshtein.c b/ext/standard/levenshtein.c
deleted file mode 100644
index e305f8070f..0000000000
--- a/ext/standard/levenshtein.c
+++ /dev/null
@@ -1,162 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Hartmut Holzgraefe <hartmut@six.de> |
- +----------------------------------------------------------------------+
- */
-/* $Id$ */
-
-#include "php.h"
-#include <stdlib.h>
-#include <errno.h>
-#include <ctype.h>
-#include "php_string.h"
-
-#define LEVENSHTEIN_MAX_LENTH 255
-
-/* {{{ reference_levdist
- * reference implementation, only optimized for memory usage, not speed */
-static int reference_levdist(const char *s1, int l1,
- const char *s2, int l2,
- int cost_ins, int cost_rep, int cost_del )
-{
- int *p1,*p2,*tmp;
- int i1,i2,c0,c1,c2;
-
- if(l1==0) return l2*cost_ins;
- if(l2==0) return l1*cost_del;
-
- if((l1>LEVENSHTEIN_MAX_LENTH)||(l2>LEVENSHTEIN_MAX_LENTH))
- return -1;
-
- if(!(p1=emalloc(l2*sizeof(int)))) {
- return -2;
- }
- if(!(p2=emalloc(l2*sizeof(int)))) {
- free(p1);
- return -2;
- }
-
- p1[0]=(s1[0]==s2[0])?0:cost_rep;
-
- for(i2=1;i2<l2;i2++)
- p1[i2]=i2*cost_ins;
-
- for(i1=1;i1<l1;i1++)
- {
- p2[0]=i1*cost_del;
- for(i2=1;i2<l2;i2++)
- {
- c0=p1[i2-1]+((s1[i1]==s2[i2])?0:cost_rep);
- c1=p1[i2]+cost_del; if(c1<c0) c0=c1;
- c2=p2[i2-1]+cost_ins; if(c2<c0) c0=c2;
- p2[i2]=c0;
- }
- tmp=p1; p1=p2; p2=tmp;
- }
-
- c0=p1[l2-1];
-
- efree(p1);
- efree(p2);
-
- return c0;
-}
-/* }}} */
-
-/* {{{ custom_levdist
- */
-static int custom_levdist(char *str1,char *str2,char *callback_name)
-{
- php_error(E_WARNING,"the general Levenshtein support is not there yet");
- /* not there yet */
-
- return -1;
-}
-/* }}} */
-
-/* {{{ proto int levenshtein(string str1, string str2)
- Calculate Levenshtein distance between two strings */
-PHP_FUNCTION(levenshtein)
-{
- zval **str1, **str2, **cost_ins, **cost_rep, **cost_del,**callback_name;
- int distance=-1;
-
- switch(ZEND_NUM_ARGS()) {
- case 2: /* just two string: use maximum performance version */
- if (zend_get_parameters_ex(2, &str1, &str2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(str1);
- convert_to_string_ex(str2);
-
- distance = reference_levdist((*str1)->value.str.val,(*str1)->value.str.len,
- (*str2)->value.str.val,(*str2)->value.str.len,
- 1,1,1);
-
- break;
-
- case 5: /* more general version: calc cost by ins/rep/del weights */
- if (zend_get_parameters_ex(5, &str1, &str2, &cost_ins, &cost_rep, &cost_del) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(str1);
- convert_to_string_ex(str2);
- convert_to_long_ex(cost_ins);
- convert_to_long_ex(cost_rep);
- convert_to_long_ex(cost_del);
-
- distance = reference_levdist((*str1)->value.str.val,(*str1)->value.str.len,
- (*str2)->value.str.val,(*str2)->value.str.len,
- (*cost_ins)->value.lval,
- (*cost_rep)->value.lval,
- (*cost_del)->value.lval
- );
-
- break;
-
- case 3: /* most general version: calc cost by user-supplied function */
- if (zend_get_parameters_ex(3, &str1, &str2, &callback_name) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(str1);
- convert_to_string_ex(str2);
- convert_to_string_ex(callback_name);
-
- distance = custom_levdist((*str1)->value.str.val
- , (*str2)->value.str.val
- , (*callback_name)->value.str.val
- );
- break;
-
- default:
- WRONG_PARAM_COUNT;
- }
-
- if(distance<0) {
- php_error(E_WARNING,"levenshtein(): argument string(s) too long");
- }
-
- RETURN_LONG(distance);
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/standard/link.c b/ext/standard/link.c
deleted file mode 100644
index c600be1fc3..0000000000
--- a/ext/standard/link.c
+++ /dev/null
@@ -1,170 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#include "php.h"
-#include "php_filestat.h"
-#include "php_globals.h"
-
-#ifdef HAVE_SYMLINK
-
-#include <stdlib.h>
-#if HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#include <sys/stat.h>
-#include <string.h>
-#if HAVE_PWD_H
-#ifdef PHP_WIN32
-#include "win32/pwd.h"
-#else
-#include <pwd.h>
-#endif
-#endif
-#if HAVE_GRP_H
-#ifdef PHP_WIN32
-#include "win32/grp.h"
-#else
-#include <grp.h>
-#endif
-#endif
-#include <errno.h>
-#include <ctype.h>
-
-#include "safe_mode.h"
-#include "php_link.h"
-
-/* {{{ proto string readlink(string filename)
- Return the target of a symbolic link */
-PHP_FUNCTION(readlink)
-{
- pval **filename;
- char buff[256];
- int ret;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &filename) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(filename);
-
- ret = readlink((*filename)->value.str.val, buff, 255);
- if (ret == -1) {
- php_error(E_WARNING, "readlink failed (%s)", strerror(errno));
- RETURN_FALSE;
- }
- /* Append NULL to the end of the string */
- buff[ret] = '\0';
- RETURN_STRING(buff,1);
-}
-/* }}} */
-
-/* {{{ proto int linkinfo(string filename)
- Returns the st_dev field of the UNIX C stat structure describing the link */
-PHP_FUNCTION(linkinfo)
-{
- pval **filename;
- struct stat sb;
- int ret;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &filename) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(filename);
-
- ret = VCWD_LSTAT((*filename)->value.str.val, &sb);
- if (ret == -1) {
- php_error(E_WARNING, "LinkInfo failed (%s)", strerror(errno));
- RETURN_LONG(-1L);
- }
- RETURN_LONG((long) sb.st_dev);
-}
-/* }}} */
-
-/* {{{ proto int symlink(string target, string link)
- Create a symbolic link */
-PHP_FUNCTION(symlink)
-{
- pval **topath, **frompath;
- int ret;
- PLS_FETCH();
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &topath, &frompath) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(topath);
- convert_to_string_ex(frompath);
-
- if (PG(safe_mode) && !php_checkuid((*topath)->value.str.val, NULL, CHECKUID_CHECK_FILE_AND_DIR)) {
- RETURN_FALSE;
- }
- if (!strncasecmp((*topath)->value.str.val,"http://",7) || !strncasecmp((*topath)->value.str.val,"ftp://",6)) {
- php_error(E_WARNING, "Unable to symlink to a URL");
- RETURN_FALSE;
- }
-
- ret = symlink((*topath)->value.str.val, (*frompath)->value.str.val);
- if (ret == -1) {
- php_error(E_WARNING, "SymLink failed (%s)", strerror(errno));
- RETURN_FALSE;
- }
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int link(string target, string link)
- Create a hard link */
-PHP_FUNCTION(link)
-{
- pval **topath, **frompath;
- int ret;
- PLS_FETCH();
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &topath, &frompath) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(topath);
- convert_to_string_ex(frompath);
-
- if (PG(safe_mode) && !php_checkuid((*topath)->value.str.val, NULL, CHECKUID_CHECK_FILE_AND_DIR)) {
- RETURN_FALSE;
- }
- if (!strncasecmp((*topath)->value.str.val,"http://",7) || !strncasecmp((*topath)->value.str.val,"ftp://",6)) {
- php_error(E_WARNING, "Unable to link to a URL");
- RETURN_FALSE;
- }
-
- ret = link((*topath)->value.str.val, (*frompath)->value.str.val);
- if (ret == -1) {
- php_error(E_WARNING, "Link failed (%s)", strerror(errno));
- RETURN_FALSE;
- }
- RETURN_TRUE;
-}
-/* }}} */
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/standard/mail.c b/ext/standard/mail.c
deleted file mode 100644
index 652febfced..0000000000
--- a/ext/standard/mail.c
+++ /dev/null
@@ -1,220 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Rasmus Lerdorf <rasmus@php.net> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#include <stdlib.h>
-#include <ctype.h>
-#include <stdio.h>
-#include "php.h"
-#include "ext/standard/info.h"
-#if !defined(PHP_WIN32)
-#include "build-defs.h"
-#if HAVE_SYSEXITS_H
-#include <sysexits.h>
-#endif
-#if HAVE_SYS_SYSEXITS_H
-#include <sys/sysexits.h>
-#endif
-#endif
-#include "php_mail.h"
-#include "php_ini.h"
-
-#if HAVE_SENDMAIL
-#ifdef PHP_WIN32
-#include "win32/sendmail.h"
-#endif
-
-/* {{{ proto int ezmlm_hash(string addr)
- Calculate EZMLM list hash value. */
-PHP_FUNCTION(ezmlm_hash)
-{
- pval **pstr = NULL;
- char *str=NULL;
- unsigned long h = 5381L;
- int j, l;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &pstr) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(pstr);
- if ((*pstr)->value.str.val) {
- str = (*pstr)->value.str.val;
- } else {
- php_error(E_WARNING, "Must give string parameter to ezmlm_hash()");
- RETURN_FALSE;
- }
-
- l = strlen(str);
- for (j=0; j<l; j++) {
- h = (h + (h<<5)) ^ (unsigned long) (unsigned char) tolower(str[j]);
- }
-
- h = (h%53);
-
- RETURN_LONG((int) h);
-}
-/* }}} */
-
-/* {{{ proto int mail(string to, string subject, string message [, string additional_headers [, string additional_parameters]])
- Send an email message */
-PHP_FUNCTION(mail)
-{
- pval **argv[5];
- char *to=NULL, *message=NULL, *headers=NULL, *subject=NULL, *extra_cmd=NULL;
- int argc;
-
- argc = ZEND_NUM_ARGS();
- if (argc < 3 || argc > 5 || zend_get_parameters_array_ex(argc, argv) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- /* To: */
- convert_to_string_ex(argv[0]);
- if ((*argv[0])->value.str.val) {
- to = (*argv[0])->value.str.val;
- } else {
- php_error(E_WARNING, "No to field in mail command");
- RETURN_FALSE;
- }
-
- /* Subject: */
- convert_to_string_ex(argv[1]);
- if ((*argv[1])->value.str.val) {
- subject = (*argv[1])->value.str.val;
- } else {
- php_error(E_WARNING, "No subject field in mail command");
- RETURN_FALSE;
- }
-
- /* message body */
- convert_to_string_ex(argv[2]);
- if ((*argv[2])->value.str.val) {
- message = (*argv[2])->value.str.val;
- } else {
- /* this is not really an error, so it is allowed. */
- php_error(E_WARNING, "No message string in mail command");
- message = NULL;
- }
-
- if (argc >= 4) { /* other headers */
- convert_to_string_ex(argv[3]);
- headers = (*argv[3])->value.str.val;
- }
-
- if (argc == 5) { /* extra options that get passed to the mailer */
- convert_to_string_ex(argv[4]);
- extra_cmd = (*argv[4])->value.str.val;
- }
-
- if (php_mail(to, subject, message, headers, extra_cmd)) {
- RETURN_TRUE;
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ php_mail
- */
-PHPAPI int php_mail(char *to, char *subject, char *message, char *headers, char *extra_cmd)
-{
-#ifdef PHP_WIN32
- int tsm_err;
-#else
- FILE *sendmail;
- int ret;
- char *sendmail_path = INI_STR("sendmail_path");
- char *sendmail_cmd = NULL;
-#endif
-
-#ifdef PHP_WIN32
- if (TSendMail(INI_STR("SMTP"), &tsm_err, headers, subject, to, message) != SUCCESS){
- php_error(E_WARNING, GetSMErrorText(tsm_err));
- return 0;
- }
-#else
- if (!sendmail_path) {
- return 0;
- }
- if (extra_cmd != NULL) {
- sendmail_cmd = emalloc (strlen (sendmail_path) + strlen (extra_cmd) + 2);
- strcpy (sendmail_cmd, sendmail_path);
- strcat (sendmail_cmd, " ");
- strcat (sendmail_cmd, extra_cmd);
- } else {
- sendmail_cmd = sendmail_path;
- }
-
- sendmail = popen(sendmail_cmd, "w");
- if (extra_cmd != NULL)
- efree (sendmail_cmd);
-
- if (sendmail) {
- fprintf(sendmail, "To: %s\n", to);
- fprintf(sendmail, "Subject: %s\n", subject);
- if (headers != NULL) {
- fprintf(sendmail, "%s\n", headers);
- }
- fprintf(sendmail, "\n%s\n", message);
- ret = pclose(sendmail);
-#if defined(EX_TEMPFAIL)
- if ((ret != EX_OK)&&(ret != EX_TEMPFAIL)) {
-#else
- if (ret != EX_OK) {
-#endif
- return 0;
- } else {
- return 1;
- }
- } else {
- php_error(E_WARNING, "Could not execute mail delivery program");
- return 0;
- }
-#endif
- return 1;
-}
-/* }}} */
-
-/* {{{ PHP_MINFO_FUNCTION
- */
-PHP_MINFO_FUNCTION(mail)
-{
-#ifdef PHP_WIN32
- php_info_print_table_row(2, "Internal Sendmail Support for Windows 4", "enabled");
-#else
- php_info_print_table_row(2, "Path to sendmail", INI_STR("sendmail_path") );
-#endif
-}
-/* }}} */
-
-#else
-
-PHP_FUNCTION(mail) {}
-PHP_MINFO_FUNCTION(mail) {}
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/standard/math.c b/ext/standard/math.c
deleted file mode 100644
index aa62621e5f..0000000000
--- a/ext/standard/math.c
+++ /dev/null
@@ -1,730 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Jim Winstead (jimw@php.net) |
- | Stig Sæther Bakken <ssb@guardian.no> |
- | Zeev Suraski <zeev@zend.com> |
- | PHP 4.0 patches by Thies C. Arntzen (thies@thieso.net) |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#include "php.h"
-#include "php_math.h"
-
-#include <math.h>
-#include <float.h>
-
-#ifndef M_PI
-#define M_PI 3.14159265358979323846
-#endif
-
-
-char *_php_math_number_format(double, int, char ,char);
-
-/* {{{ proto int abs(int number)
- Return the absolute value of the number */
-PHP_FUNCTION(abs)
-{
- zval **value;
-
- if (ZEND_NUM_ARGS()!=1||zend_get_parameters_ex(1,&value)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_scalar_to_number_ex(value);
-
- if ((*value)->type == IS_DOUBLE) {
- RETURN_DOUBLE(fabs((*value)->value.dval));
- } else if ((*value)->type == IS_LONG) {
- RETURN_LONG((*value)->value.lval < 0 ? -(*value)->value.lval : (*value)->value.lval);
- }
-
- RETURN_FALSE;
-}
-
-/* }}} */
-/* {{{ proto double ceil(double number)
- Returns the next highest integer value of the number */
-PHP_FUNCTION(ceil)
-{
- zval **value;
-
- if (ZEND_NUM_ARGS()!=1||zend_get_parameters_ex(1,&value)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_scalar_to_number_ex(value);
-
- if ((*value)->type == IS_DOUBLE) {
- RETURN_DOUBLE(ceil((*value)->value.dval));
- } else if ((*value)->type == IS_LONG) {
- RETURN_LONG((*value)->value.lval);
- }
-
- RETURN_FALSE;
-}
-
-/* }}} */
-/* {{{ proto double floor(double number)
- Returns the next lowest integer value from the number */
-
-PHP_FUNCTION(floor) {
- zval **value;
-
- if (ZEND_NUM_ARGS()!=1||zend_get_parameters_ex(1,&value)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_scalar_to_number_ex(value);
-
- if ((*value)->type == IS_DOUBLE) {
- RETURN_DOUBLE(floor((*value)->value.dval));
- } else if ((*value)->type == IS_LONG) {
- RETURN_LONG((*value)->value.lval);
- }
-
- RETURN_FALSE;
-}
-
-/* }}} */
-
-
-/* {{{ proto double round(double number [, int precision])
- Returns the number rounded to specified precision. */
-PHP_FUNCTION(round)
-{
- zval **value, **precision;
- int places = 0;
- double f, return_val;
-
- if (ZEND_NUM_ARGS() < 1 || ZEND_NUM_ARGS() > 2 ||
- zend_get_parameters_ex(ZEND_NUM_ARGS(), &value, &precision) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if (ZEND_NUM_ARGS() == 2) {
- convert_to_long_ex(precision);
- places = (int) Z_LVAL_PP(precision);
- }
-
- convert_scalar_to_number_ex(value);
-
- switch (Z_TYPE_PP(value)) {
- case IS_LONG:
- /* Simple case - long that doesn't need to be rounded. */
- if (places >= 0) {
- RETURN_DOUBLE((double) Z_LVAL_PP(value));
- }
- /* break omitted intentionally */
-
- case IS_DOUBLE:
- return_val = (Z_TYPE_PP(value) == IS_LONG) ?
- (double)Z_LVAL_PP(value) : Z_DVAL_PP(value);
-
- f = pow(10.0, places);
-
- return_val *= f;
- if (return_val >= 0.0)
- return_val = floor(return_val + 0.5);
- else
- return_val = ceil(return_val - 0.5);
- return_val /= f;
-
- RETURN_DOUBLE(return_val);
- break;
-
- default:
- RETURN_FALSE;
- break;
- }
-}
-/* }}} */
-
-
-/* {{{ proto double sin(double number)
- Returns the sine of the number in radians */
-
-PHP_FUNCTION(sin)
-{
- zval **num;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &num) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_double_ex(num);
- return_value->value.dval = sin((*num)->value.dval);
- return_value->type = IS_DOUBLE;
-}
-
-/* }}} */
-/* {{{ proto double cos(double number)
- Returns the cosine of the number in radians */
-
-PHP_FUNCTION(cos)
-{
- zval **num;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &num) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_double_ex(num);
- return_value->value.dval = cos((*num)->value.dval);
- return_value->type = IS_DOUBLE;
-}
-/* }}} */
-/* {{{ proto double tan(double number)
- Returns the tangent of the number in radians */
-PHP_FUNCTION(tan)
-{
- zval **num;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &num) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_double_ex(num);
- return_value->value.dval = tan((*num)->value.dval);
- return_value->type = IS_DOUBLE;
-}
-
-/* }}} */
-/* {{{ proto double asin(double number)
- Returns the arc sine of the number in radians */
-
-PHP_FUNCTION(asin)
-{
- zval **num;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &num) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_double_ex(num);
- return_value->value.dval = asin((*num)->value.dval);
- return_value->type = IS_DOUBLE;
-}
-
-/* }}} */
-/* {{{ proto double acos(double number)
- Return the arc cosine of the number in radians */
-
-PHP_FUNCTION(acos)
-{
- zval **num;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &num) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_double_ex(num);
- return_value->value.dval = acos((*num)->value.dval);
- return_value->type = IS_DOUBLE;
-}
-
-/* }}} */
-/* {{{ proto double atan(double number)
- Returns the arc tangent of the number in radians */
-
-PHP_FUNCTION(atan)
-{
- zval **num;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &num) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_double_ex(num);
- return_value->value.dval = atan((*num)->value.dval);
- return_value->type = IS_DOUBLE;
-}
-
-/* }}} */
-/* {{{ proto double atan2(double y, double x)
- Returns the arc tangent of y/x, with the resulting quadrant determined by the signs of y and x */
-
-PHP_FUNCTION(atan2)
-{
- zval **num1, **num2;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &num1, &num2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_double_ex(num1);
- convert_to_double_ex(num2);
- return_value->value.dval = atan2((*num1)->value.dval,(*num2)->value.dval);
- return_value->type = IS_DOUBLE;
-}
-
-/* }}} */
-/* {{{ proto double pi(void)
- Returns an approximation of pi */
-
-PHP_FUNCTION(pi)
-{
- return_value->value.dval = M_PI;
- return_value->type = IS_DOUBLE;
-}
-
-/* }}} */
-/* {{{ proto double pow(double base, double exponent)
- Returns base raised to the power of exponent */
-
-PHP_FUNCTION(pow)
-{
- zval **num1, **num2;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2,&num1,&num2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_double_ex(num1);
- convert_to_double_ex(num2);
- RETURN_DOUBLE(pow((*num1)->value.dval, (*num2)->value.dval));
-}
-
-/* }}} */
-/* {{{ proto double exp(double number)
- Returns e raised to the power of the number */
-
-PHP_FUNCTION(exp)
-{
- zval **num;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &num) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_double_ex(num);
- return_value->value.dval = exp((*num)->value.dval);
- return_value->type = IS_DOUBLE;
-}
-
-/* }}} */
-/* {{{ proto double log(double number)
- Returns the natural logarithm of the number */
-
-PHP_FUNCTION(log)
-{
- zval **num;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &num) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_double_ex(num);
- return_value->value.dval = log((*num)->value.dval);
- return_value->type = IS_DOUBLE;
-}
-
-/* }}} */
-/* {{{ proto double log10(double number)
- Returns the base-10 logarithm of the number */
-
-PHP_FUNCTION(log10)
-{
- zval **num;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &num) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_double_ex(num);
- return_value->value.dval = log10((*num)->value.dval);
- return_value->type = IS_DOUBLE;
-}
-
-/* }}} */
-/* {{{ proto double sqrt(double number)
- Returns the square root of the number */
-
-PHP_FUNCTION(sqrt)
-{
- zval **num;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &num) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_double_ex(num);
- return_value->value.dval = sqrt((*num)->value.dval);
- return_value->type = IS_DOUBLE;
-}
-
-/* }}} */
-/* {{{ proto double deg2rad(double number)
- Converts the number in degrees to the radian equivalent */
-
-PHP_FUNCTION(deg2rad)
-{
- zval **deg;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &deg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_double_ex(deg);
- RETVAL_DOUBLE(((*deg)->value.dval / 180.0) * M_PI);
-}
-
-/* }}} */
-/* {{{ proto double rad2deg(double number)
- Converts the radian number to the equivalent number in degrees */
-
-PHP_FUNCTION(rad2deg)
-{
- zval **rad;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &rad) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_double_ex(rad);
- RETVAL_DOUBLE(((*rad)->value.dval / M_PI) * 180);
-}
-
-/* }}} */
-/* {{{ _php_math_basetolong */
-
-/*
- * Convert a string representation of a base(2-36) number to a long.
- */
-PHPAPI long
-_php_math_basetolong(zval *arg, int base) {
- long mult = 1, num = 0, digit;
- int i;
- char c, *s;
-
- if (arg->type != IS_STRING || base < 2 || base > 36) {
- return 0;
- }
-
- s = arg->value.str.val;
-
- for (i = arg->value.str.len - 1; i >= 0; i--, mult *= base) {
- c = toupper(s[i]);
- if (c >= '0' && c <= '9') {
- digit = (c - '0');
- } else if (c >= 'A' && c <= 'Z') {
- digit = (c - 'A' + 10);
- } else {
- continue;
- }
- if (digit >= base) {
- continue;
- }
- num += mult * digit;
- }
-
- return num;
-}
-
-/* }}} */
-/* {{{ _php_math_longtobase */
-
-/*
- * Convert a long to a string containing a base(2-36) representation of
- * the number.
- */
-PHPAPI char *
-_php_math_longtobase(zval *arg, int base)
-{
- static char digits[] = "0123456789abcdefghijklmnopqrstuvwxyz";
- char *result, *ptr, *ret;
- int len, digit;
- unsigned long value;
-
- if (arg->type != IS_LONG || base < 2 || base > 36) {
- return empty_string;
- }
-
- value = arg->value.lval;
-
- /* allocates space for the longest possible result with the lowest base */
- len = (sizeof(arg->value.lval) * 8) + 1;
- result = emalloc((sizeof(arg->value.lval) * 8) + 1);
-
- ptr = result + len - 1;
- *ptr-- = '\0';
-
- do {
- digit = value % base;
- *ptr = digits[digit];
- value /= base;
- }
- while (ptr-- > result && value);
- ptr++;
- ret = estrdup(ptr);
- efree(result);
-
- return ret;
-}
-
-/* }}} */
-/* {{{ proto int bindec(string binary_number)
- Returns the decimal equivalent of the binary number */
-
-PHP_FUNCTION(bindec)
-{
- zval **arg;
- long ret;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(arg);
- ret = _php_math_basetolong(*arg, 2);
-
- RETVAL_LONG(ret);
-}
-
-/* }}} */
-/* {{{ proto int hexdec(string hexadecimal_number)
- Returns the decimal equivalent of the hexadecimal number */
-
-PHP_FUNCTION(hexdec)
-{
- zval **arg;
- long ret;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(arg);
-
- ret = _php_math_basetolong(*arg, 16);
- RETVAL_LONG(ret);
-}
-
-/* }}} */
-/* {{{ proto int octdec(string octal_number)
- Returns the decimal equivalent of an octal string */
-
-PHP_FUNCTION(octdec)
-{
- zval **arg;
- long ret;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(arg);
-
- ret = _php_math_basetolong(*arg, 8);
- RETVAL_LONG(ret);
-}
-
-/* }}} */
-/* {{{ proto string decbin(int decimal_number)
- Returns a string containing a binary representation of the number */
-
-PHP_FUNCTION(decbin)
-{
- zval **arg;
- char *result;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(arg);
-
- result = _php_math_longtobase(*arg, 2);
- return_value->type = IS_STRING;
- return_value->value.str.len = strlen(result);
- return_value->value.str.val = result;
-}
-
-/* }}} */
-/* {{{ proto string decoct(int decimal_number)
- Returns a string containing an octal representation of the given number */
-
-PHP_FUNCTION(decoct)
-{
- zval **arg;
- char *result;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(arg);
-
- result = _php_math_longtobase(*arg, 8);
- return_value->type = IS_STRING;
- return_value->value.str.len = strlen(result);
- return_value->value.str.val = result;
-}
-
-/* }}} */
-/* {{{ proto string dechex(int decimal_number)
- Returns a string containing a hexadecimal representation of the given number */
-
-PHP_FUNCTION(dechex)
-{
- zval **arg;
- char *result;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(arg);
-
- result = _php_math_longtobase(*arg, 16);
- return_value->type = IS_STRING;
- return_value->value.str.len = strlen(result);
- return_value->value.str.val = result;
-}
-
-/* }}} */
-/* {{{ proto string base_convert(string number, int frombase, int tobase)
- Converts a number in a string from any base <= 36 to any base <= 36.
-*/
-
-PHP_FUNCTION(base_convert)
-{
- zval **number, **frombase, **tobase, temp;
- char *result;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &number, &frombase, &tobase) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(number);
- convert_to_long_ex(frombase);
- convert_to_long_ex(tobase);
- if ((*frombase)->value.lval < 2 || (*frombase)->value.lval > 36) {
- php_error(E_WARNING, "base_convert: invalid `from base' (%d)",(*frombase)->value.lval);
- RETURN_FALSE;
- }
- if ((*tobase)->value.lval < 2 || (*tobase)->value.lval > 36) {
- php_error(E_WARNING, "base_convert: invalid `to base' (%d)",(*tobase)->value.lval);
- RETURN_FALSE;
- }
- temp.type = IS_LONG;
- temp.value.lval = _php_math_basetolong(*number, (*frombase)->value.lval);
- result = _php_math_longtobase(&temp, (*tobase)->value.lval);
- RETVAL_STRING(result, 0);
-}
-
-/* }}} */
-/* {{{ _php_math_number_format */
-
-char *_php_math_number_format(double d,int dec,char dec_point,char thousand_sep)
-{
- char *tmpbuf,*resbuf;
- char *s,*t; /* source, target */
- int tmplen,reslen=0;
- int count=0;
- int is_negative=0;
-
- if (d<0) {
- is_negative=1;
- d = -d;
- }
- dec = MAX(0,dec);
- tmpbuf = (char *) emalloc(1+DBL_MAX_10_EXP+1+dec+1);
-
- tmplen=sprintf(tmpbuf,"%.*f",dec,d);
-
- if (!isdigit((int)tmpbuf[0])) {
- return tmpbuf;
- }
-
- if (dec) {
- reslen = dec+1 + (tmplen-dec-1) + ((thousand_sep) ? (tmplen-1-dec-1)/3 : 0);
- } else {
- reslen = tmplen+((thousand_sep) ? (tmplen-1)/3 : 0);
- }
- if (is_negative) {
- reslen++;
- }
- resbuf = (char *) emalloc(reslen+1);
-
- s = tmpbuf+tmplen-1;
- t = resbuf+reslen;
- *t-- = 0;
-
- if (dec) {
- while (isdigit((int)*s)) {
- *t-- = *s--;
- }
- *t-- = dec_point; /* copy that dot */
- s--;
- }
-
- while(s>=tmpbuf) {
- *t-- = *s--;
- if (thousand_sep && (++count%3)==0 && s>=tmpbuf) {
- *t-- = thousand_sep;
- }
- }
- if (is_negative) {
- *t-- = '-';
- }
- efree(tmpbuf);
- return resbuf;
-}
-
-/* }}} */
-/* {{{ proto string number_format(double number [, int num_decimal_places [, string dec_seperator, string thousands_seperator]])
- Formats a number with grouped thousands */
-
-PHP_FUNCTION(number_format)
-{
- zval **num,**dec,**t_s,**d_p;
- char thousand_sep=',', dec_point='.';
-
- switch(ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &num)==FAILURE) {
- RETURN_FALSE;
- }
- convert_to_double_ex(num);
- RETURN_STRING(_php_math_number_format((*num)->value.dval,0,dec_point,thousand_sep),0);
- break;
- case 2:
- if (zend_get_parameters_ex(2, &num, &dec)==FAILURE) {
- RETURN_FALSE;
- }
- convert_to_double_ex(num);
- convert_to_long_ex(dec);
- RETURN_STRING(_php_math_number_format((*num)->value.dval,(*dec)->value.lval,dec_point,thousand_sep),0);
- break;
- case 4:
- if (zend_get_parameters_ex(4, &num, &dec, &d_p, &t_s)==FAILURE) {
- RETURN_FALSE;
- }
- convert_to_double_ex(num);
- convert_to_long_ex(dec);
- convert_to_string_ex(d_p);
- convert_to_string_ex(t_s);
- if ((*d_p)->value.str.len==1) {
- dec_point=(*d_p)->value.str.val[0];
- }
- if ((*t_s)->value.str.len==1) {
- thousand_sep=(*t_s)->value.str.val[0];
- } else if((*t_s)->value.str.len==0) {
- thousand_sep=0;
- }
- RETURN_STRING(_php_math_number_format((*num)->value.dval,(*dec)->value.lval,dec_point,thousand_sep),0);
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/standard/md5.c b/ext/standard/md5.c
deleted file mode 100644
index 62699a95e3..0000000000
--- a/ext/standard/md5.c
+++ /dev/null
@@ -1,377 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Lachlan Roche |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-/*
- * md5.c - Copyright 1997 Lachlan Roche
- */
-
-#include <stdio.h>
-#include "php.h"
-
-#include "md5.h"
-
-/* {{{ proto string md5(string str)
- Calculate the md5 hash of a string */
-PHP_NAMED_FUNCTION(php_if_md5)
-{
- pval **arg;
- char md5str[33];
- PHP_MD5_CTX context;
- unsigned char digest[16];
- int i;
- char *r;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(arg);
-
- md5str[0] = '\0';
- PHP_MD5Init(&context);
- PHP_MD5Update(&context, (*arg)->value.str.val, (*arg)->value.str.len);
- PHP_MD5Final(digest, &context);
- for (i = 0, r = md5str; i < 16; i++, r += 2) {
- sprintf(r, "%02x", digest[i]);
- }
- *r = '\0';
- RETVAL_STRING(md5str,1);
-}
-/* }}} */
-
-/*
- * The remaining code is the reference MD5 code (md5c.c) from rfc1321
- */
-/* MD5C.C - RSA Data Security, Inc., MD5 message-digest algorithm
- */
-
-/* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
- rights reserved.
-
- License to copy and use this software is granted provided that it
- is identified as the "RSA Data Security, Inc. MD5 Message-Digest
- Algorithm" in all material mentioning or referencing this software
- or this function.
-
- License is also granted to make and use derivative works provided
- that such works are identified as "derived from the RSA Data
- Security, Inc. MD5 Message-Digest Algorithm" in all material
- mentioning or referencing the derived work.
-
- RSA Data Security, Inc. makes no representations concerning either
- the merchantability of this software or the suitability of this
- software for any particular purpose. It is provided "as is"
- without express or implied warranty of any kind.
-
- These notices must be retained in any copies of any part of this
- documentation and/or software.
- */
-
-/* Constants for MD5Transform routine.
- */
-
-
-#define S11 7
-#define S12 12
-#define S13 17
-#define S14 22
-#define S21 5
-#define S22 9
-#define S23 14
-#define S24 20
-#define S31 4
-#define S32 11
-#define S33 16
-#define S34 23
-#define S41 6
-#define S42 10
-#define S43 15
-#define S44 21
-
-static void MD5Transform(php_uint32[4], const unsigned char[64]);
-static void Encode(unsigned char *, php_uint32 *, unsigned int);
-static void Decode(php_uint32 *, const unsigned char *, unsigned int);
-
-static unsigned char PADDING[64] =
-{
- 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-};
-
-/* F, G, H and I are basic MD5 functions.
- */
-#define F(x, y, z) (((x) & (y)) | ((~x) & (z)))
-#define G(x, y, z) (((x) & (z)) | ((y) & (~z)))
-#define H(x, y, z) ((x) ^ (y) ^ (z))
-#define I(x, y, z) ((y) ^ ((x) | (~z)))
-
-/* ROTATE_LEFT rotates x left n bits.
- */
-#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
-
-/* FF, GG, HH, and II transformations for rounds 1, 2, 3, and 4.
- Rotation is separate from addition to prevent recomputation.
- */
-#define FF(a, b, c, d, x, s, ac) { \
- (a) += F ((b), (c), (d)) + (x) + (php_uint32)(ac); \
- (a) = ROTATE_LEFT ((a), (s)); \
- (a) += (b); \
- }
-#define GG(a, b, c, d, x, s, ac) { \
- (a) += G ((b), (c), (d)) + (x) + (php_uint32)(ac); \
- (a) = ROTATE_LEFT ((a), (s)); \
- (a) += (b); \
- }
-#define HH(a, b, c, d, x, s, ac) { \
- (a) += H ((b), (c), (d)) + (x) + (php_uint32)(ac); \
- (a) = ROTATE_LEFT ((a), (s)); \
- (a) += (b); \
- }
-#define II(a, b, c, d, x, s, ac) { \
- (a) += I ((b), (c), (d)) + (x) + (php_uint32)(ac); \
- (a) = ROTATE_LEFT ((a), (s)); \
- (a) += (b); \
- }
-
-/* {{{ PHP_MD5Init
- * MD5 initialization. Begins an MD5 operation, writing a new context.
- */
-void PHP_MD5Init(PHP_MD5_CTX * context)
-{
- context->count[0] = context->count[1] = 0;
- /* Load magic initialization constants.
- */
- context->state[0] = 0x67452301;
- context->state[1] = 0xefcdab89;
- context->state[2] = 0x98badcfe;
- context->state[3] = 0x10325476;
-}
-/* }}} */
-
-/* {{{ PHP_MD5Update
- MD5 block update operation. Continues an MD5 message-digest
- operation, processing another message block, and updating the
- context.
- */
-void PHP_MD5Update(PHP_MD5_CTX * context, const unsigned char *input,
- unsigned int inputLen)
-{
- unsigned int i, index, partLen;
-
- /* Compute number of bytes mod 64 */
- index = (unsigned int) ((context->count[0] >> 3) & 0x3F);
-
- /* Update number of bits */
- if ((context->count[0] += ((php_uint32) inputLen << 3))
- < ((php_uint32) inputLen << 3))
- context->count[1]++;
- context->count[1] += ((php_uint32) inputLen >> 29);
-
- partLen = 64 - index;
-
- /* Transform as many times as possible.
- */
- if (inputLen >= partLen) {
- memcpy
- ((unsigned char*) & context->buffer[index], (unsigned char*) input, partLen);
- MD5Transform(context->state, context->buffer);
-
- for (i = partLen; i + 63 < inputLen; i += 64)
- MD5Transform(context->state, &input[i]);
-
- index = 0;
- } else
- i = 0;
-
- /* Buffer remaining input */
- memcpy
- ((unsigned char*) & context->buffer[index], (unsigned char*) & input[i],
- inputLen - i);
-}
-/* }}} */
-
-/* {{{ PHP_MD5Final
- MD5 finalization. Ends an MD5 message-digest operation, writing the
- the message digest and zeroizing the context.
- */
-void PHP_MD5Final(unsigned char digest[16], PHP_MD5_CTX * context)
-{
- unsigned char bits[8];
- unsigned int index, padLen;
-
- /* Save number of bits */
- Encode(bits, context->count, 8);
-
- /* Pad out to 56 mod 64.
- */
- index = (unsigned int) ((context->count[0] >> 3) & 0x3f);
- padLen = (index < 56) ? (56 - index) : (120 - index);
- PHP_MD5Update(context, PADDING, padLen);
-
- /* Append length (before padding) */
- PHP_MD5Update(context, bits, 8);
-
- /* Store state in digest */
- Encode(digest, context->state, 16);
-
- /* Zeroize sensitive information.
- */
- memset((unsigned char*) context, 0, sizeof(*context));
-}
-/* }}} */
-
-/* {{{ MD5Transform
- * MD5 basic transformation. Transforms state based on block.
- */
-static void MD5Transform(state, block)
-php_uint32 state[4];
-const unsigned char block[64];
-{
- php_uint32 a = state[0], b = state[1], c = state[2], d = state[3], x[16];
-
- Decode(x, block, 64);
-
- /* Round 1 */
- FF(a, b, c, d, x[0], S11, 0xd76aa478); /* 1 */
- FF(d, a, b, c, x[1], S12, 0xe8c7b756); /* 2 */
- FF(c, d, a, b, x[2], S13, 0x242070db); /* 3 */
- FF(b, c, d, a, x[3], S14, 0xc1bdceee); /* 4 */
- FF(a, b, c, d, x[4], S11, 0xf57c0faf); /* 5 */
- FF(d, a, b, c, x[5], S12, 0x4787c62a); /* 6 */
- FF(c, d, a, b, x[6], S13, 0xa8304613); /* 7 */
- FF(b, c, d, a, x[7], S14, 0xfd469501); /* 8 */
- FF(a, b, c, d, x[8], S11, 0x698098d8); /* 9 */
- FF(d, a, b, c, x[9], S12, 0x8b44f7af); /* 10 */
- FF(c, d, a, b, x[10], S13, 0xffff5bb1); /* 11 */
- FF(b, c, d, a, x[11], S14, 0x895cd7be); /* 12 */
- FF(a, b, c, d, x[12], S11, 0x6b901122); /* 13 */
- FF(d, a, b, c, x[13], S12, 0xfd987193); /* 14 */
- FF(c, d, a, b, x[14], S13, 0xa679438e); /* 15 */
- FF(b, c, d, a, x[15], S14, 0x49b40821); /* 16 */
-
- /* Round 2 */
- GG(a, b, c, d, x[1], S21, 0xf61e2562); /* 17 */
- GG(d, a, b, c, x[6], S22, 0xc040b340); /* 18 */
- GG(c, d, a, b, x[11], S23, 0x265e5a51); /* 19 */
- GG(b, c, d, a, x[0], S24, 0xe9b6c7aa); /* 20 */
- GG(a, b, c, d, x[5], S21, 0xd62f105d); /* 21 */
- GG(d, a, b, c, x[10], S22, 0x2441453); /* 22 */
- GG(c, d, a, b, x[15], S23, 0xd8a1e681); /* 23 */
- GG(b, c, d, a, x[4], S24, 0xe7d3fbc8); /* 24 */
- GG(a, b, c, d, x[9], S21, 0x21e1cde6); /* 25 */
- GG(d, a, b, c, x[14], S22, 0xc33707d6); /* 26 */
- GG(c, d, a, b, x[3], S23, 0xf4d50d87); /* 27 */
- GG(b, c, d, a, x[8], S24, 0x455a14ed); /* 28 */
- GG(a, b, c, d, x[13], S21, 0xa9e3e905); /* 29 */
- GG(d, a, b, c, x[2], S22, 0xfcefa3f8); /* 30 */
- GG(c, d, a, b, x[7], S23, 0x676f02d9); /* 31 */
- GG(b, c, d, a, x[12], S24, 0x8d2a4c8a); /* 32 */
-
- /* Round 3 */
- HH(a, b, c, d, x[5], S31, 0xfffa3942); /* 33 */
- HH(d, a, b, c, x[8], S32, 0x8771f681); /* 34 */
- HH(c, d, a, b, x[11], S33, 0x6d9d6122); /* 35 */
- HH(b, c, d, a, x[14], S34, 0xfde5380c); /* 36 */
- HH(a, b, c, d, x[1], S31, 0xa4beea44); /* 37 */
- HH(d, a, b, c, x[4], S32, 0x4bdecfa9); /* 38 */
- HH(c, d, a, b, x[7], S33, 0xf6bb4b60); /* 39 */
- HH(b, c, d, a, x[10], S34, 0xbebfbc70); /* 40 */
- HH(a, b, c, d, x[13], S31, 0x289b7ec6); /* 41 */
- HH(d, a, b, c, x[0], S32, 0xeaa127fa); /* 42 */
- HH(c, d, a, b, x[3], S33, 0xd4ef3085); /* 43 */
- HH(b, c, d, a, x[6], S34, 0x4881d05); /* 44 */
- HH(a, b, c, d, x[9], S31, 0xd9d4d039); /* 45 */
- HH(d, a, b, c, x[12], S32, 0xe6db99e5); /* 46 */
- HH(c, d, a, b, x[15], S33, 0x1fa27cf8); /* 47 */
- HH(b, c, d, a, x[2], S34, 0xc4ac5665); /* 48 */
-
- /* Round 4 */
- II(a, b, c, d, x[0], S41, 0xf4292244); /* 49 */
- II(d, a, b, c, x[7], S42, 0x432aff97); /* 50 */
- II(c, d, a, b, x[14], S43, 0xab9423a7); /* 51 */
- II(b, c, d, a, x[5], S44, 0xfc93a039); /* 52 */
- II(a, b, c, d, x[12], S41, 0x655b59c3); /* 53 */
- II(d, a, b, c, x[3], S42, 0x8f0ccc92); /* 54 */
- II(c, d, a, b, x[10], S43, 0xffeff47d); /* 55 */
- II(b, c, d, a, x[1], S44, 0x85845dd1); /* 56 */
- II(a, b, c, d, x[8], S41, 0x6fa87e4f); /* 57 */
- II(d, a, b, c, x[15], S42, 0xfe2ce6e0); /* 58 */
- II(c, d, a, b, x[6], S43, 0xa3014314); /* 59 */
- II(b, c, d, a, x[13], S44, 0x4e0811a1); /* 60 */
- II(a, b, c, d, x[4], S41, 0xf7537e82); /* 61 */
- II(d, a, b, c, x[11], S42, 0xbd3af235); /* 62 */
- II(c, d, a, b, x[2], S43, 0x2ad7d2bb); /* 63 */
- II(b, c, d, a, x[9], S44, 0xeb86d391); /* 64 */
-
- state[0] += a;
- state[1] += b;
- state[2] += c;
- state[3] += d;
-
- /* Zeroize sensitive information. */
- memset((unsigned char*) x, 0, sizeof(x));
-}
-/* }}} */
-
-/* {{{ Encode
- Encodes input (php_uint32) into output (unsigned char). Assumes len is
- a multiple of 4.
- */
-static void Encode(output, input, len)
-unsigned char *output;
-php_uint32 *input;
-unsigned int len;
-{
- unsigned int i, j;
-
- for (i = 0, j = 0; j < len; i++, j += 4) {
- output[j] = (unsigned char) (input[i] & 0xff);
- output[j + 1] = (unsigned char) ((input[i] >> 8) & 0xff);
- output[j + 2] = (unsigned char) ((input[i] >> 16) & 0xff);
- output[j + 3] = (unsigned char) ((input[i] >> 24) & 0xff);
- }
-}
-/* }}} */
-
-/* {{{ Decode
- Decodes input (unsigned char) into output (php_uint32). Assumes len is
- a multiple of 4.
- */
-static void Decode(output, input, len)
-php_uint32 *output;
-const unsigned char *input;
-unsigned int len;
-{
- unsigned int i, j;
-
- for (i = 0, j = 0; j < len; i++, j += 4)
- output[i] = ((php_uint32) input[j]) | (((php_uint32) input[j + 1]) << 8) |
- (((php_uint32) input[j + 2]) << 16) | (((php_uint32) input[j + 3]) << 24);
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/standard/md5.h b/ext/standard/md5.h
deleted file mode 100644
index b4c09e498a..0000000000
--- a/ext/standard/md5.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef MD5_H
-#define MD5_H
-/* MD5.H - header file for MD5C.C
- */
-
-/* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
- rights reserved.
-
- License to copy and use this software is granted provided that it
- is identified as the "RSA Data Security, Inc. MD5 Message-Digest
- Algorithm" in all material mentioning or referencing this software
- or this function.
-
- License is also granted to make and use derivative works provided
- that such works are identified as "derived from the RSA Data
- Security, Inc. MD5 Message-Digest Algorithm" in all material
- mentioning or referencing the derived work.
-
- RSA Data Security, Inc. makes no representations concerning either
- the merchantability of this software or the suitability of this
- software for any particular purpose. It is provided "as is"
- without express or implied warranty of any kind.
-
- These notices must be retained in any copies of any part of this
- documentation and/or software.
- */
-
-#include "ext/standard/basic_functions.h"
-
-/* MD5 context. */
-typedef struct {
- php_uint32 state[4]; /* state (ABCD) */
- php_uint32 count[2]; /* number of bits, modulo 2^64 (lsb first) */
- unsigned char buffer[64]; /* input buffer */
-} PHP_MD5_CTX;
-
-void PHP_MD5Init(PHP_MD5_CTX *);
-void PHP_MD5Update(PHP_MD5_CTX *, const unsigned char *, unsigned int);
-void PHP_MD5Final(unsigned char[16], PHP_MD5_CTX *);
-
-PHP_NAMED_FUNCTION(php_if_md5);
-
-#endif
diff --git a/ext/standard/metaphone.c b/ext/standard/metaphone.c
deleted file mode 100644
index 545bda300c..0000000000
--- a/ext/standard/metaphone.c
+++ /dev/null
@@ -1,473 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Thies C. Arntzen <thies@thieso.net> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-/*
- Based on CPANs "Text-Metaphone-1.96" by Michael G Schwern <schwern@pobox.com>
-*/
-
-#include "php.h"
-#include "php_metaphone.h"
-
-static int metaphone(char *word, int max_phonemes, char **phoned_word, int traditional);
-
-PHP_FUNCTION(metaphone);
-
-/* {{{ proto string metaphone(string text, int phones)
- Break english phrases down into their phonemes */
-PHP_FUNCTION(metaphone)
-{
- pval **pstr, **pphones;
- char *result = 0;
- int phones = 0;
-
- if (zend_get_parameters_ex(2, &pstr, &pphones) == SUCCESS) {
- convert_to_long_ex(pphones);
- phones = (*pphones)->value.lval;
- } else if (zend_get_parameters_ex(1, &pstr) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(pstr);
-
- if (metaphone((*pstr)->value.str.val, phones, &result, 1) == 0) {
- RETVAL_STRING(result, 0);
- } else {
- if (result) {
- efree(result);
- }
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/*
- this is now the original code by Michael G Schwern:
- i've changed it just a slightly bit (use emalloc,
- get rid of includes etc)
- - thies - 13.09.1999
-*/
-
-/*----------------------------- */
-/* this used to be "metaphone.h" */
-/*----------------------------- */
-
-/* Special encodings */
-#define SH 'X'
-#define TH '0'
-
-/*----------------------------- */
-/* end of "metaphone.h" */
-/*----------------------------- */
-
-/*----------------------------- */
-/* this used to be "metachar.h" */
-/*----------------------------- */
-
-/* Metachar.h ... little bits about characters for metaphone */
-/*-- Character encoding array & accessing macros --*/
-/* Stolen directly out of the book... */
-char _codes[26] =
-{
- 1, 16, 4, 16, 9, 2, 4, 16, 9, 2, 0, 2, 2, 2, 1, 4, 0, 2, 4, 4, 1, 0, 0, 0, 8, 0
-/* a b c d e f g h i j k l m n o p q r s t u v w x y z */
-};
-
-
-#define ENCODE(c) (isalpha(c) ? _codes[((toupper(c)) - 'A')] : 0)
-
-#define isvowel(c) (ENCODE(c) & 1) /* AEIOU */
-
-/* These letters are passed through unchanged */
-#define NOCHANGE(c) (ENCODE(c) & 2) /* FJMNR */
-
-/* These form dipthongs when preceding H */
-#define AFFECTH(c) (ENCODE(c) & 4) /* CGPST */
-
-/* These make C and G soft */
-#define MAKESOFT(c) (ENCODE(c) & 8) /* EIY */
-
-/* These prevent GH from becoming F */
-#define NOGHTOF(c) (ENCODE(c) & 16) /* BDH */
-
-/*----------------------------- */
-/* end of "metachar.h" */
-/*----------------------------- */
-
-/* I suppose I could have been using a character pointer instead of
- * accesssing the array directly... */
-
-/* Look at the next letter in the word */
-#define Next_Letter (toupper(word[w_idx+1]))
-/* Look at the current letter in the word */
-#define Curr_Letter (toupper(word[w_idx]))
-/* Go N letters back. */
-#define Look_Back_Letter(n) (w_idx >= n ? toupper(word[w_idx-n]) : '\0')
-/* Previous letter. I dunno, should this return null on failure? */
-#define Prev_Letter (Look_Back_Letter(1))
-/* Look two letters down. It makes sure you don't walk off the string. */
-#define After_Next_Letter (Next_Letter != '\0' ? toupper(word[w_idx+2]) \
- : '\0')
-#define Look_Ahead_Letter(n) (toupper(Lookahead(word+w_idx, n)))
-
-
-/* Allows us to safely look ahead an arbitrary # of letters */
-/* I probably could have just used strlen... */
-static char Lookahead(char *word, int how_far)
-{
- char letter_ahead = '\0'; /* null by default */
- int idx;
- for (idx = 0; word[idx] != '\0' && idx < how_far; idx++);
- /* Edge forward in the string... */
-
- letter_ahead = word[idx]; /* idx will be either == to how_far or
- * at the end of the string
- */
- return letter_ahead;
-}
-
-
-/* phonize one letter */
-#define Phonize(c) {(*phoned_word)[p_idx++] = c;}
-/* Slap a null character on the end of the phoned word */
-#define End_Phoned_Word {(*phoned_word)[p_idx] = '\0';}
-/* How long is the phoned word? */
-#define Phone_Len (p_idx)
-
-/* Note is a letter is a 'break' in the word */
-#define Isbreak(c) (!isalpha(c))
-
-/* {{{ metaphone
- */
-static int metaphone(char *word, int max_phonemes, char **phoned_word, int traditional)
-{
- int w_idx = 0; /* point in the phonization we're at. */
- int p_idx = 0; /* end of the phoned phrase */
-
-/*-- Parameter checks --*/
- /* Negative phoneme length is meaningless */
-
- if (max_phonemes < 0)
- return -1;
-
- /* Empty/null string is meaningless */
- /* Overly paranoid */
- /* assert(word != NULL && word[0] != '\0'); */
-
- if (word == NULL)
- return -1;
-
-/*-- Allocate memory for our phoned_phrase --*/
- if (max_phonemes == 0) { /* Assume largest possible */
- *phoned_word = emalloc(sizeof(char) * strlen(word) + 1);
- if (!*phoned_word)
- return -1;
- } else {
- *phoned_word = emalloc(sizeof(char) * max_phonemes + 1);
- if (!*phoned_word)
- return -1;
- }
-
-
-/*-- The first phoneme has to be processed specially. --*/
- /* Find our first letter */
- for (; !isalpha(Curr_Letter); w_idx++) {
- /* On the off chance we were given nothing but crap... */
- if (Curr_Letter == '\0') {
- End_Phoned_Word
- return SUCCESS; /* For testing */
- }
- }
-
- switch (Curr_Letter) {
- /* AE becomes E */
- case 'A':
- if (Next_Letter == 'E') {
- Phonize('E');
- w_idx += 2;
- }
- /* Remember, preserve vowels at the beginning */
- else {
- Phonize('A');
- w_idx++;
- }
- break;
- /* [GKP]N becomes N */
- case 'G':
- case 'K':
- case 'P':
- if (Next_Letter == 'N') {
- Phonize('N');
- w_idx += 2;
- }
- break;
- /* WH becomes H,
- WR becomes R
- W if followed by a vowel */
- case 'W':
- if (Next_Letter == 'H' ||
- Next_Letter == 'R') {
- Phonize(Next_Letter);
- w_idx += 2;
- } else if (isvowel(Next_Letter)) {
- Phonize('W');
- w_idx += 2;
- }
- /* else ignore */
- break;
- /* X becomes S */
- case 'X':
- Phonize('S');
- w_idx++;
- break;
- /* Vowels are kept */
- /* We did A already
- case 'A':
- case 'a':
- */
- case 'E':
- case 'I':
- case 'O':
- case 'U':
- Phonize(Curr_Letter);
- w_idx++;
- break;
- default:
- /* do nothing */
- break;
- }
-
-
-
- /* On to the metaphoning */
- for (; Curr_Letter != '\0' &&
- (max_phonemes == 0 || Phone_Len < max_phonemes);
- w_idx++) {
- /* How many letters to skip because an eariler encoding handled
- * multiple letters */
- unsigned short int skip_letter = 0;
-
-
- /* THOUGHT: It would be nice if, rather than having things like...
- * well, SCI. For SCI you encode the S, then have to remember
- * to skip the C. So the phonome SCI invades both S and C. It would
- * be better, IMHO, to skip the C from the S part of the encoding.
- * Hell, I'm trying it.
- */
-
- /* Ignore non-alphas */
- if (!isalpha(Curr_Letter))
- continue;
-
- /* Drop duplicates, except CC */
- if (Curr_Letter == Prev_Letter &&
- Curr_Letter != 'C')
- continue;
-
- switch (Curr_Letter) {
- /* B -> B unless in MB */
- case 'B':
- if (Prev_Letter != 'M')
- Phonize('B');
- break;
- /* 'sh' if -CIA- or -CH, but not SCH, except SCHW.
- * (SCHW is handled in S)
- * S if -CI-, -CE- or -CY-
- * dropped if -SCI-, SCE-, -SCY- (handed in S)
- * else K
- */
- case 'C':
- if (MAKESOFT(Next_Letter)) { /* C[IEY] */
- if (After_Next_Letter == 'A' &&
- Next_Letter == 'I') { /* CIA */
- Phonize(SH);
- }
- /* SC[IEY] */
- else if (Prev_Letter == 'S') {
- /* Dropped */
- } else {
- Phonize('S');
- }
- } else if (Next_Letter == 'H') {
- if ((!traditional) && (After_Next_Letter == 'R' || Prev_Letter == 'S')) { /* Christ, School */
- Phonize('K');
- } else {
- Phonize(SH);
- }
- skip_letter++;
- } else {
- Phonize('K');
- }
- break;
- /* J if in -DGE-, -DGI- or -DGY-
- * else T
- */
- case 'D':
- if (Next_Letter == 'G' &&
- MAKESOFT(After_Next_Letter)) {
- Phonize('J');
- skip_letter++;
- } else
- Phonize('T');
- break;
- /* F if in -GH and not B--GH, D--GH, -H--GH, -H---GH
- * else dropped if -GNED, -GN,
- * else dropped if -DGE-, -DGI- or -DGY- (handled in D)
- * else J if in -GE-, -GI, -GY and not GG
- * else K
- */
- case 'G':
- if (Next_Letter == 'H') {
- if (!(NOGHTOF(Look_Back_Letter(3)) ||
- Look_Back_Letter(4) == 'H')) {
- Phonize('F');
- skip_letter++;
- } else {
- /* silent */
- }
- } else if (Next_Letter == 'N') {
- if (Isbreak(After_Next_Letter) ||
- (After_Next_Letter == 'E' &&
- Look_Ahead_Letter(3) == 'D')) {
- /* dropped */
- } else
- Phonize('K');
- } else if (MAKESOFT(Next_Letter) &&
- Prev_Letter != 'G') {
- Phonize('J');
- } else {
- Phonize('K');
- }
- break;
- /* H if before a vowel and not after C,G,P,S,T */
- case 'H':
- if (isvowel(Next_Letter) &&
- !AFFECTH(Prev_Letter))
- Phonize('H');
- break;
- /* dropped if after C
- * else K
- */
- case 'K':
- if (Prev_Letter != 'C')
- Phonize('K');
- break;
- /* F if before H
- * else P
- */
- case 'P':
- if (Next_Letter == 'H') {
- Phonize('F');
- } else {
- Phonize('P');
- }
- break;
- /* K
- */
- case 'Q':
- Phonize('K');
- break;
- /* 'sh' in -SH-, -SIO- or -SIA- or -SCHW-
- * else S
- */
- case 'S':
- if (Next_Letter == 'I' &&
- (After_Next_Letter == 'O' ||
- After_Next_Letter == 'A')) {
- Phonize(SH);
- } else if (Next_Letter == 'H') {
- Phonize(SH);
- skip_letter++;
- } else if ((!traditional) && (Next_Letter == 'C' && Look_Ahead_Letter(2) == 'H' && Look_Ahead_Letter(3) == 'W')) {
- Phonize(SH);
- skip_letter += 2;
- } else {
- Phonize('S');
- }
- break;
- /* 'sh' in -TIA- or -TIO-
- * else 'th' before H
- * else T
- */
- case 'T':
- if (Next_Letter == 'I' &&
- (After_Next_Letter == 'O' ||
- After_Next_Letter == 'A')) {
- Phonize(SH);
- } else if (Next_Letter == 'H') {
- Phonize(TH);
- skip_letter++;
- } else {
- Phonize('T');
- }
- break;
- /* F */
- case 'V':
- Phonize('F');
- break;
- /* W before a vowel, else dropped */
- case 'W':
- if (isvowel(Next_Letter))
- Phonize('W');
- break;
- /* KS */
- case 'X':
- Phonize('K');
- Phonize('S');
- break;
- /* Y if followed by a vowel */
- case 'Y':
- if (isvowel(Next_Letter))
- Phonize('Y');
- break;
- /* S */
- case 'Z':
- Phonize('S');
- break;
- /* No transformation */
- case 'F':
- case 'J':
- case 'L':
- case 'M':
- case 'N':
- case 'R':
- Phonize(Curr_Letter);
- break;
- default:
- /* nothing */
- break;
- } /* END SWITCH */
-
- w_idx += skip_letter;
- } /* END FOR */
-
- End_Phoned_Word;
-
- return 0;
-} /* END metaphone */
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/standard/microtime.c b/ext/standard/microtime.c
deleted file mode 100644
index 0850c6cf2c..0000000000
--- a/ext/standard/microtime.c
+++ /dev/null
@@ -1,149 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Paul Panotzki - Bunyip Information Systems |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#include "php.h"
-
-#ifdef HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-#ifdef PHP_WIN32
-#include "win32/time.h"
-#else
-#include <sys/time.h>
-#endif
-#ifdef HAVE_SYS_RESOURCE_H
-#include <sys/resource.h>
-#endif
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#include <stdlib.h>
-#include <string.h>
-#include <stdio.h>
-#include <errno.h>
-
-#include "microtime.h"
-
-#define NUL '\0'
-#define MICRO_IN_SEC 1000000.00
-
-/* {{{ proto string microtime(void)
- Returns a string containing the current time in seconds and microseconds */
-PHP_FUNCTION(microtime)
-{
-#ifdef HAVE_GETTIMEOFDAY
- struct timeval tp;
- long sec = 0L;
- double msec = 0.0;
- char ret[100];
-
- if (gettimeofday((struct timeval *) &tp, (NUL)) == 0) {
- msec = (double) (tp.tv_usec / MICRO_IN_SEC);
- sec = tp.tv_sec;
-
- if (msec >= 1.0) msec -= (long) msec;
- snprintf(ret, 100, "%.8f %ld", msec, sec);
- RETVAL_STRING(ret,1);
- } else
-#endif
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto array gettimeofday(void)
- Returns the current time as array */
-PHP_FUNCTION(gettimeofday)
-{
-#ifdef HAVE_GETTIMEOFDAY
- struct timeval tp;
- struct timezone tz;
-
- memset(&tp, 0, sizeof(tp));
- memset(&tz, 0, sizeof(tz));
- if(gettimeofday(&tp, &tz) == 0) {
- array_init(return_value);
- add_assoc_long(return_value, "sec", tp.tv_sec);
- add_assoc_long(return_value, "usec", tp.tv_usec);
- add_assoc_long(return_value, "minuteswest", tz.tz_minuteswest);
- add_assoc_long(return_value, "dsttime", tz.tz_dsttime);
- return;
- } else
-#endif
- RETURN_FALSE;
-}
-/* }}} */
-
-#ifdef HAVE_GETRUSAGE
-/* {{{ proto array getrusage([int who])
- Returns an array of usage statistics */
-PHP_FUNCTION(getrusage)
-{
- struct rusage usg;
- int ac = ZEND_NUM_ARGS();
- pval **pwho;
- int who = RUSAGE_SELF;
-
- if(ac == 1 &&
- zend_get_parameters_ex(ac, &pwho) != FAILURE) {
- convert_to_long_ex(pwho);
- if((*pwho)->value.lval == 1)
- who = RUSAGE_CHILDREN;
- }
-
- memset(&usg, 0, sizeof(usg));
- if(getrusage(who, &usg) == -1) {
- RETURN_FALSE;
- }
-
- array_init(return_value);
-#define PHP_RUSAGE_PARA(a) \
- add_assoc_long(return_value, #a, usg.a)
-#if !defined( _OSD_POSIX) && !defined(__BEOS__) /* BS2000 has only a few fields in the rusage struct */
- PHP_RUSAGE_PARA(ru_oublock);
- PHP_RUSAGE_PARA(ru_inblock);
- PHP_RUSAGE_PARA(ru_msgsnd);
- PHP_RUSAGE_PARA(ru_msgrcv);
- PHP_RUSAGE_PARA(ru_maxrss);
- PHP_RUSAGE_PARA(ru_ixrss);
- PHP_RUSAGE_PARA(ru_idrss);
- PHP_RUSAGE_PARA(ru_minflt);
- PHP_RUSAGE_PARA(ru_majflt);
- PHP_RUSAGE_PARA(ru_nsignals);
- PHP_RUSAGE_PARA(ru_nvcsw);
- PHP_RUSAGE_PARA(ru_nivcsw);
-#endif /*_OSD_POSIX*/
- PHP_RUSAGE_PARA(ru_utime.tv_usec);
- PHP_RUSAGE_PARA(ru_utime.tv_sec);
- PHP_RUSAGE_PARA(ru_stime.tv_usec);
- PHP_RUSAGE_PARA(ru_stime.tv_sec);
-#undef PHP_RUSAGE_PARA
-}
-#endif /* HAVE_GETRUSAGE */
-
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/standard/microtime.h b/ext/standard/microtime.h
deleted file mode 100644
index e7b06def5f..0000000000
--- a/ext/standard/microtime.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Paul Panotzki - Bunyip Information Systems |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef MICROTIME_H
-#define MICROTIME_H
-
-PHP_FUNCTION(microtime);
-PHP_FUNCTION(gettimeofday);
-PHP_FUNCTION(getrusage);
-
-#endif /* MICROTIME_H */
diff --git a/ext/standard/output.c b/ext/standard/output.c
deleted file mode 100644
index 26f95af2e4..0000000000
--- a/ext/standard/output.c
+++ /dev/null
@@ -1,638 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Zeev Suraski <zeev@zend.com> |
- | Thies C. Arntzen <thies@thieso.net> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#include "php.h"
-#include "ext/standard/head.h"
-#include "ext/session/php_session.h"
-#include "basic_functions.h"
-#include "SAPI.h"
-
-/* output functions */
-static int php_ub_body_write(const char *str, uint str_length);
-static int php_ub_body_write_no_header(const char *str, uint str_length);
-static int php_b_body_write(const char *str, uint str_length);
-
-static void php_ob_init(uint initial_size, uint block_size, zval *output_handler, uint chunk_size);
-static void php_ob_append(const char *text, uint text_length);
-#if 0
-static void php_ob_prepend(const char *text, uint text_length);
-#endif
-
-
-#ifdef ZTS
-int output_globals_id;
-#else
-php_output_globals output_globals;
-#endif
-
-static int php_default_output_func(const char *str, uint str_len)
-{
- fwrite(str, 1, str_len, stderr);
- return str_len;
-}
-
-
-static void php_output_init_globals(OLS_D)
-{
- OG(php_body_write) = php_default_output_func;
- OG(php_header_write) = php_default_output_func;
- OG(implicit_flush) = 0;
- OG(output_start_filename) = NULL;
- OG(output_start_lineno) = 0;
-}
-
-
-/* Start output layer */
-PHPAPI void php_output_startup()
-{
-#ifdef ZTS
- output_globals_id = ts_allocate_id(sizeof(php_output_globals), (ts_allocate_ctor) php_output_init_globals, NULL);
-#else
- php_output_init_globals(OLS_C);
-#endif
-
- {
- OLS_FETCH();
-
- OG(php_body_write) = php_ub_body_write;
- OG(php_header_write) = sapi_module.ub_write;
- OG(nesting_level) = 0;
- OG(lock) = 0;
- }
-}
-
-
-void php_output_register_constants()
-{
- ELS_FETCH();
-
- REGISTER_MAIN_LONG_CONSTANT("PHP_OUTPUT_HANDLER_START", PHP_OUTPUT_HANDLER_START, CONST_CS | CONST_PERSISTENT);
- REGISTER_MAIN_LONG_CONSTANT("PHP_OUTPUT_HANDLER_CONT", PHP_OUTPUT_HANDLER_CONT, CONST_CS | CONST_PERSISTENT);
- REGISTER_MAIN_LONG_CONSTANT("PHP_OUTPUT_HANDLER_END", PHP_OUTPUT_HANDLER_END, CONST_CS | CONST_PERSISTENT);
-}
-
-
-PHPAPI int php_body_write(const char *str, uint str_length)
-{
- OLS_FETCH();
- return OG(php_body_write)(str, str_length);
-}
-
-PHPAPI int php_header_write(const char *str, uint str_length)
-{
- OLS_FETCH();
- return OG(php_header_write)(str, str_length);
-}
-
-/* {{{ php_start_ob_buffer
- * Start output buffering */
-PHPAPI int php_start_ob_buffer(zval *output_handler, uint chunk_size)
-{
- OLS_FETCH();
-
- if (OG(lock)) {
- return FAILURE;
- }
- if (chunk_size) {
- php_ob_init((chunk_size*3/2), chunk_size/2, output_handler, chunk_size);
- } else {
- php_ob_init(40*1024, 10*1024, output_handler, chunk_size);
- }
- OG(php_body_write) = php_b_body_write;
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ php_end_ob_buffer
- * End output buffering (one level) */
-PHPAPI void php_end_ob_buffer(zend_bool send_buffer, zend_bool just_flush)
-{
- char *final_buffer=NULL;
- int final_buffer_length=0;
- zval *alternate_buffer=NULL;
- char *to_be_destroyed_buffer;
- char *to_be_destroyed_handled_output[2] = { 0, 0 };
- int status;
- SLS_FETCH();
- OLS_FETCH();
-
- if (OG(nesting_level)==0) {
- return;
- }
- status = 0;
- if (!OG(active_ob_buffer).status & PHP_OUTPUT_HANDLER_START) {
- /* our first call */
- status |= PHP_OUTPUT_HANDLER_START;
- }
- if (just_flush) {
- status |= PHP_OUTPUT_HANDLER_CONT;
- } else {
- status |= PHP_OUTPUT_HANDLER_END;
- }
-
- if (OG(active_ob_buffer).internal_output_handler) {
- final_buffer = OG(active_ob_buffer).internal_output_handler_buffer;
- final_buffer_length = OG(active_ob_buffer).internal_output_handler_buffer_size;
- OG(active_ob_buffer).internal_output_handler(OG(active_ob_buffer).buffer, OG(active_ob_buffer).text_length, &final_buffer, &final_buffer_length, status);
- } else if (OG(active_ob_buffer).output_handler) {
- zval **params[2];
- zval *orig_buffer;
- zval *z_status;
- CLS_FETCH();
-
- ALLOC_INIT_ZVAL(orig_buffer);
- orig_buffer->value.str.val = OG(active_ob_buffer).buffer;
- orig_buffer->value.str.len = OG(active_ob_buffer).text_length;
- orig_buffer->type = IS_STRING;
- orig_buffer->refcount=2; /* don't let call_user_function() destroy our buffer */
- orig_buffer->is_ref=1;
-
- ALLOC_INIT_ZVAL(z_status);
- Z_TYPE_P(z_status) = IS_LONG;
- Z_LVAL_P(z_status) = status;
-
- params[0] = &orig_buffer;
- params[1] = &z_status;
- OG(lock) = 1;
- if (call_user_function_ex(CG(function_table), NULL, OG(active_ob_buffer).output_handler, &alternate_buffer, 2, params, 1, NULL)==SUCCESS) {
- convert_to_string_ex(&alternate_buffer);
- final_buffer = alternate_buffer->value.str.val;
- final_buffer_length = alternate_buffer->value.str.len;
- }
- OG(lock) = 0;
- zval_ptr_dtor(&OG(active_ob_buffer).output_handler);
- if (orig_buffer->refcount==2) { /* free the zval */
- FREE_ZVAL(orig_buffer);
- } else {
- orig_buffer->refcount-=2;
- }
- zval_ptr_dtor(&z_status);
- }
-
- if (!final_buffer) {
- final_buffer = OG(active_ob_buffer).buffer;
- final_buffer_length = OG(active_ob_buffer).text_length;
- }
-
- if (OG(nesting_level)==1) { /* end buffering */
- if (SG(headers_sent) && !SG(request_info).headers_only) {
- OG(php_body_write) = php_ub_body_write_no_header;
- } else {
- OG(php_body_write) = php_ub_body_write;
- }
- }
-
- to_be_destroyed_buffer = OG(active_ob_buffer).buffer;
- if (OG(active_ob_buffer).internal_output_handler
- && (final_buffer != OG(active_ob_buffer).internal_output_handler_buffer)) {
- to_be_destroyed_handled_output[0] = final_buffer;
- }
-
- if (!just_flush) {
- if (OG(active_ob_buffer).internal_output_handler) {
- to_be_destroyed_handled_output[1] = OG(active_ob_buffer).internal_output_handler_buffer;
- }
- if (OG(nesting_level)>1) { /* restore previous buffer */
- php_ob_buffer *ob_buffer_p;
-
- zend_stack_top(&OG(ob_buffers), (void **) &ob_buffer_p);
- OG(active_ob_buffer) = *ob_buffer_p;
- zend_stack_del_top(&OG(ob_buffers));
- if (OG(nesting_level)==2) { /* destroy the stack */
- zend_stack_destroy(&OG(ob_buffers));
- }
- }
- OG(nesting_level)--;
- }
-
- if (send_buffer) {
- OG(php_body_write)(final_buffer, final_buffer_length);
- }
-
- if (alternate_buffer) {
- zval_ptr_dtor(&alternate_buffer);
- }
-
- if (!just_flush) {
- efree(to_be_destroyed_buffer);
- } else {
- OG(active_ob_buffer).text_length = 0;
- OG(active_ob_buffer).status |= PHP_OUTPUT_HANDLER_START;
- OG(php_body_write) = php_b_body_write;
- }
- if (to_be_destroyed_handled_output[0]) {
- efree(to_be_destroyed_handled_output[0]);
- }
- if (to_be_destroyed_handled_output[1]) {
- efree(to_be_destroyed_handled_output[1]);
- }
-}
-/* }}} */
-
-/* {{{ php_end_ob_buffers
- * End output buffering (all buffers) */
-PHPAPI void php_end_ob_buffers(zend_bool send_buffer)
-{
- OLS_FETCH();
-
- while (OG(nesting_level)!=0) {
- php_end_ob_buffer(send_buffer, 0);
- }
-}
-/* }}} */
-
-/* {{{ php_start_implicit_flush
- */
-PHPAPI void php_start_implicit_flush()
-{
- OLS_FETCH();
-
- php_end_ob_buffer(1, 0); /* Switch out of output buffering if we're in it */
- OG(implicit_flush)=1;
-}
-/* }}} */
-
-/* {{{ php_end_implicit_flush
- */
-PHPAPI void php_end_implicit_flush()
-{
- OLS_FETCH();
-
- OG(implicit_flush)=0;
-}
-/* }}} */
-
-/* {{{ php_ob_set_internal_handler
- */
-PHPAPI void php_ob_set_internal_handler(php_output_handler_func_t internal_output_handler, uint buffer_size)
-{
- OLS_FETCH();
-
- if (OG(nesting_level)==0) {
- return;
- }
-
- OG(active_ob_buffer).internal_output_handler = internal_output_handler;
- OG(active_ob_buffer).internal_output_handler_buffer = (char *) emalloc(buffer_size);
- OG(active_ob_buffer).internal_output_handler_buffer_size = buffer_size;
-}
-/* }}} */
-
-/*
- * Output buffering - implementation
- */
-
-/* {{{ php_ob_allocate
- */
-static inline void php_ob_allocate(void)
-{
- OLS_FETCH();
-
- if (OG(active_ob_buffer).size<OG(active_ob_buffer).text_length) {
- while (OG(active_ob_buffer).size <= OG(active_ob_buffer).text_length) {
- OG(active_ob_buffer).size+=OG(active_ob_buffer).block_size;
- }
-
- OG(active_ob_buffer).buffer = (char *) erealloc(OG(active_ob_buffer).buffer, OG(active_ob_buffer).size+1);
- }
-}
-/* }}} */
-
-/* {{{ php_ob_init
- */
-static void php_ob_init(uint initial_size, uint block_size, zval *output_handler, uint chunk_size)
-{
- OLS_FETCH();
-
- if (OG(nesting_level)>0) {
- if (OG(nesting_level)==1) { /* initialize stack */
- zend_stack_init(&OG(ob_buffers));
- }
- zend_stack_push(&OG(ob_buffers), &OG(active_ob_buffer), sizeof(php_ob_buffer));
- }
- OG(nesting_level)++;
- OG(active_ob_buffer).block_size = block_size;
- OG(active_ob_buffer).size = initial_size;
- OG(active_ob_buffer).buffer = (char *) emalloc(initial_size+1);
- OG(active_ob_buffer).text_length = 0;
- OG(active_ob_buffer).output_handler = output_handler;
- OG(active_ob_buffer).chunk_size = chunk_size;
- OG(active_ob_buffer).status = 0;
- OG(active_ob_buffer).internal_output_handler = NULL;
-}
-/* }}} */
-
-/* {{{ php_ob_append
- */
-static void php_ob_append(const char *text, uint text_length)
-{
- char *target;
- int original_ob_text_length;
- OLS_FETCH();
-
- original_ob_text_length=OG(active_ob_buffer).text_length;
- OG(active_ob_buffer).text_length = OG(active_ob_buffer).text_length + text_length;
-
- php_ob_allocate();
- target = OG(active_ob_buffer).buffer+original_ob_text_length;
- memcpy(target, text, text_length);
- target[text_length]=0;
-
- if (OG(active_ob_buffer).chunk_size
- && OG(active_ob_buffer).text_length >= OG(active_ob_buffer).chunk_size) {
- zval *output_handler = OG(active_ob_buffer).output_handler;
-
- if (output_handler) {
- output_handler->refcount++;
- }
- php_end_ob_buffer(1, 1);
- return;
- }
-}
-/* }}} */
-
-#if 0
-static void php_ob_prepend(const char *text, uint text_length)
-{
- char *p, *start;
- OLS_FETCH();
-
- OG(active_ob_buffer).text_length += text_length;
- php_ob_allocate();
-
- /* php_ob_allocate() may change OG(ob_buffer), so we can't initialize p&start earlier */
- p = OG(ob_buffer)+OG(ob_text_length);
- start = OG(ob_buffer);
-
- while (--p>=start) {
- p[text_length] = *p;
- }
- memcpy(OG(ob_buffer), text, text_length);
- OG(ob_buffer)[OG(active_ob_buffer).text_length]=0;
-}
-#endif
-
-
-/* {{{ php_ob_get_buffer
- * Return the current output buffer */
-int php_ob_get_buffer(pval *p)
-{
- OLS_FETCH();
-
- if (OG(nesting_level)==0) {
- return FAILURE;
- }
- p->type = IS_STRING;
- p->value.str.val = estrndup(OG(active_ob_buffer).buffer, OG(active_ob_buffer).text_length);
- p->value.str.len = OG(active_ob_buffer).text_length;
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ php_ob_get_length
- * Return the size of the current output buffer */
-int php_ob_get_length(pval *p)
-{
- OLS_FETCH();
-
- if (OG(nesting_level) == 0) {
- return FAILURE;
- }
- p->type = IS_LONG;
- p->value.lval = OG(active_ob_buffer).text_length;
- return SUCCESS;
-}
-/* }}} */
-
-/*
- * Wrapper functions - implementation
- */
-
-
-/* buffered output function */
-static int php_b_body_write(const char *str, uint str_length)
-{
- php_ob_append(str, str_length);
- return str_length;
-}
-
-/* {{{ php_ub_body_write_no_header
- */
-static int php_ub_body_write_no_header(const char *str, uint str_length)
-{
- char *newstr = NULL;
- size_t new_length=0;
- int result;
- OLS_FETCH();
- BLS_FETCH();
-
- if (BG(use_trans_sid)) {
- session_adapt_uris(str, str_length, &newstr, &new_length);
- }
-
- if (newstr) {
- str = newstr;
- str_length = new_length;
- }
-
- result = OG(php_header_write)(str, str_length);
-
- if (OG(implicit_flush)) {
- sapi_flush();
- }
-
- return result;
-}
-/* }}} */
-
-/* {{{ php_ub_body_write
- */
-static int php_ub_body_write(const char *str, uint str_length)
-{
- int result = 0;
- SLS_FETCH();
- OLS_FETCH();
-
- if (SG(request_info).headers_only) {
- php_header();
- zend_bailout();
- }
- if (php_header()) {
- if (zend_is_compiling()) {
- CLS_FETCH();
-
- OG(output_start_filename) = zend_get_compiled_filename(CLS_C);
- OG(output_start_lineno) = zend_get_compiled_lineno(CLS_C);
- } else if (zend_is_executing()) {
- ELS_FETCH();
-
- OG(output_start_filename) = zend_get_executed_filename(ELS_C);
- OG(output_start_lineno) = zend_get_executed_lineno(ELS_C);
- }
-
- OG(php_body_write) = php_ub_body_write_no_header;
- result = php_ub_body_write_no_header(str, str_length);
- }
-
- return result;
-}
-/* }}} */
-
-/*
- * HEAD support
- */
-
-/* {{{ proto void ob_start([ string user_function [, int chunk_size]])
- Turn on Output Buffering (specifying an optional output handler). */
-PHP_FUNCTION(ob_start)
-{
- zval *output_handler;
- uint chunk_size=0;
-
- switch (ZEND_NUM_ARGS()) {
- case 0:
- output_handler = NULL;
- break;
- case 1: {
- zval **output_handler_p;
-
- if (zend_get_parameters_ex(1, &output_handler_p)==FAILURE) {
- RETURN_FALSE;
- }
- SEPARATE_ZVAL(output_handler_p);
- output_handler = *output_handler_p;
- output_handler->refcount++;
- }
- break;
- case 2: {
- zval **output_handler_p, **chunk_size_p;
-
- if (zend_get_parameters_ex(2, &output_handler_p, &chunk_size_p)==FAILURE) {
- RETURN_FALSE;
- }
- SEPARATE_ZVAL(output_handler_p);
- output_handler = *output_handler_p;
- output_handler->refcount++;
- convert_to_long_ex(chunk_size_p);
- chunk_size = (uint) Z_LVAL_PP(chunk_size_p);
- }
- break;
- default:
- ZEND_WRONG_PARAM_COUNT();
- break;
- }
- if (php_start_ob_buffer(output_handler, chunk_size)==FAILURE) {
- php_error(E_WARNING, "Cannot use output buffering in output buffering display handlers");
- RETURN_FALSE;
- }
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void ob_end_flush(void)
- Flush (send) the output buffer, and turn off output buffering */
-PHP_FUNCTION(ob_end_flush)
-{
- php_end_ob_buffer(1, 0);
-}
-/* }}} */
-
-/* {{{ proto void ob_end_clean(void)
- Clean (erase) the output buffer, and turn off output buffering */
-PHP_FUNCTION(ob_end_clean)
-{
- php_end_ob_buffer(0, 0);
-}
-/* }}} */
-
-/* {{{ proto string ob_get_contents(void)
- Return the contents of the output buffer */
-PHP_FUNCTION(ob_get_contents)
-{
- if (php_ob_get_buffer(return_value)==FAILURE) {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto string ob_get_length(void)
- Return the length of the output buffer */
-PHP_FUNCTION(ob_get_length)
-{
- if (php_ob_get_length(return_value)==FAILURE) {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto void ob_implicit_flush([int flag])
- Turn implicit flush on/off and is equivalent to calling flush() after every output call */
-PHP_FUNCTION(ob_implicit_flush)
-{
- zval **zv_flag;
- int flag;
-
- switch(ZEND_NUM_ARGS()) {
- case 0:
- flag = 1;
- break;
- case 1:
- if (zend_get_parameters_ex(1, &zv_flag)==FAILURE) {
- RETURN_FALSE;
- }
- convert_to_long_ex(zv_flag);
- flag = (*zv_flag)->value.lval;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- if (flag) {
- php_start_implicit_flush();
- } else {
- php_end_implicit_flush();
- }
-}
-/* }}} */
-
-PHPAPI char *php_get_output_start_filename()
-{
- OLS_FETCH();
-
- return OG(output_start_filename);
-}
-
-
-PHPAPI int php_get_output_start_lineno()
-{
- OLS_FETCH();
-
- return OG(output_start_lineno);
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/standard/pack.c b/ext/standard/pack.c
deleted file mode 100644
index 75544c41b7..0000000000
--- a/ext/standard/pack.c
+++ /dev/null
@@ -1,877 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Chris Schneider <cschneid@relog.ch> |
- +----------------------------------------------------------------------+
- */
-/* $Id$ */
-
-#include "php.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#ifdef PHP_WIN32
-#include <windows.h>
-#include <winsock.h>
-#define O_RDONLY _O_RDONLY
-#include "win32/param.h"
-#else
-#include <sys/param.h>
-#endif
-#include "ext/standard/head.h"
-#include "safe_mode.h"
-#include "php_string.h"
-#include "pack.h"
-#if HAVE_PWD_H
-#ifdef PHP_WIN32
-#include "win32/pwd.h"
-#else
-#include <pwd.h>
-#endif
-#endif
-#include "fsock.h"
-#if HAVE_NETINET_IN_H
-#include <netinet/in.h>
-#endif
-
-/* Whether machine is little endian */
-char machine_little_endian;
-
-/* Mapping of byte from char (8bit) to long for machine endian */
-static int byte_map[1];
-
-/* Mappings of bytes from int (machine dependant) to int for machine endian */
-static int int_map[sizeof(int)];
-
-/* Mappings of bytes from shorts (16bit) for all endian environments */
-static int machine_endian_short_map[2];
-static int big_endian_short_map[2];
-static int little_endian_short_map[2];
-
-/* Mappings of bytes from longs (32bit) for all endian environments */
-static int machine_endian_long_map[4];
-static int big_endian_long_map[4];
-static int little_endian_long_map[4];
-
-/* {{{ php_pack
- */
-static void php_pack(pval **val, int size, int *map, char *output)
-{
- int i;
- char *v;
-
- convert_to_long_ex(val);
- v = (char *)&(*val)->value.lval;
-
- for (i = 0; i < size; i++) {
- *(output++) = v[map[i]];
- }
-}
-/* }}} */
-
-/* pack() idea stolen from Perl (implemented formats behave the same as there)
- * Implemented formats are A,a,h,H,c,C,s,S,i,I,l,L,n,N,f,d,x,X,@.
- */
-/* {{{ proto string pack(string format, mixed arg1 [, mixed arg2 [, mixed ...]])
- Takes one or more arguments and packs them into a binary string according to the format argument */
-PHP_FUNCTION(pack)
-{
- pval ***argv;
- int argc, i;
- int currentarg;
- char *format;
- int formatlen;
- char *formatcodes;
- int *formatargs;
- int formatcount = 0;
- int outputpos = 0, outputsize = 0;
- char *output;
-
- argc = ZEND_NUM_ARGS();
-
- if (argc < 1) {
- WRONG_PARAM_COUNT;
- }
-
- argv = emalloc(argc * sizeof(pval **));
-
- if (zend_get_parameters_array_ex(argc, argv) == FAILURE) {
- efree(argv);
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(argv[0]);
- format = (*argv[0])->value.str.val;
- formatlen = (*argv[0])->value.str.len;
-
- /* We have a maximum of <formatlen> format codes to deal with */
- formatcodes = emalloc(formatlen * sizeof(*formatcodes));
- formatargs = emalloc(formatlen * sizeof(*formatargs));
- currentarg = 1;
-
- /* Preprocess format into formatcodes and formatargs */
- for (i = 0; i < formatlen; formatcount++) {
- char code = format[i++];
- int arg = 1;
-
- /* Handle format arguments if any */
- if (i < formatlen) {
- char c = format[i];
-
- if (c == '*') {
- arg = -1;
- i++;
- }
- else if ((c >= '0') && (c <= '9')) {
- arg = atoi(&format[i]);
-
- while (format[i] >= '0' && format[i] <= '9' && i < formatlen) {
- i++;
- }
- }
- }
-
- /* Handle special arg '*' for all codes and check argv overflows */
- switch ((int)code) {
- /* Never uses any args */
- case 'x': case 'X': case '@': {
- if (arg < 0) {
- php_error(E_WARNING, "pack type %c: '*' ignored", code);
- arg = 1;
- }
- break;
- }
-
- /* Always uses one arg */
- case 'a': case 'A': case 'h': case 'H': {
- if (currentarg >= argc) {
- efree(argv);
- efree(formatcodes);
- efree(formatargs);
- php_error(E_ERROR, "pack type %c: not enough arguments", code);
- RETURN_FALSE;
- }
-
- if (arg < 0) {
- arg = (*argv[currentarg])->value.str.len;
- }
-
- currentarg++;
- break;
- }
-
- /* Use as many args as specified */
- case 'c': case 'C': case 's': case 'S': case 'i': case 'I':
- case 'l': case 'L': case 'n': case 'N': case 'v': case 'V':
- case 'f': case 'd': {
- if (arg < 0) {
- arg = argc - currentarg;
- }
-
- currentarg += arg;
-
- if (currentarg > argc) {
- efree(argv);
- efree(formatcodes);
- efree(formatargs);
- php_error(E_ERROR, "pack type %c: too few arguments", code);
- RETURN_FALSE;
- }
- break;
- }
-
- default: {
- php_error(E_ERROR, "pack type %c: unknown format code", code);
- RETURN_FALSE;
- }
- }
-
- formatcodes[formatcount] = code;
- formatargs[formatcount] = arg;
- }
-
- if (currentarg < argc) {
- php_error(E_WARNING, "pack %d arguments unused", (argc - currentarg));
- }
-
- /* Calculate output length and upper bound while processing*/
- for (i = 0; i < formatcount; i++) {
- int code = (int)formatcodes[i];
- int arg = formatargs[i];
-
- switch ((int)code) {
- case 'h': case 'H': {
- outputpos += (arg + 1) / 2; /* 4 bit per arg */
- break;
- }
-
- case 'a': case 'A':
- case 'c': case 'C':
- case 'x': {
- outputpos += arg; /* 8 bit per arg */
- break;
- }
-
- case 's': case 'S': case 'n': case 'v': {
- outputpos += arg * 2; /* 16 bit per arg */
- break;
- }
-
- case 'i': case 'I': {
- outputpos += arg * sizeof(int);
- break;
- }
-
- case 'l': case 'L': case 'N': case 'V': {
- outputpos += arg * 4; /* 32 bit per arg */
- break;
- }
-
- case 'f': {
- outputpos += arg * sizeof(float);
- break;
- }
-
- case 'd': {
- outputpos += arg * sizeof(double);
- break;
- }
-
- case 'X': {
- outputpos -= arg;
-
- if (outputpos < 0) {
- php_error(E_WARNING, "pack type %c: outside of string", code);
- outputpos = 0;
- }
- break;
- }
-
- case '@': {
- outputpos = arg;
- break;
- }
- }
-
- if (outputsize < outputpos) {
- outputsize = outputpos;
- }
- }
-
- output = emalloc(outputsize + 1);
- outputpos = 0;
- currentarg = 1;
-
- /* Do actual packing */
- for (i = 0; i < formatcount; i++) {
- int code = (int)formatcodes[i];
- int arg = formatargs[i];
- pval **val;
-
- switch ((int)code) {
- case 'a': case 'A': {
- memset(&output[outputpos], (code == 'a') ? '\0' : ' ', arg);
- val = argv[currentarg++];
- convert_to_string_ex(val);
- memcpy(&output[outputpos],(*val)->value.str.val,
- ((*val)->value.str.len < arg) ? (*val)->value.str.len : arg);
- outputpos += arg;
- break;
- }
-
- case 'h': case 'H': {
- int nibbleshift = (code == 'h') ? 0 : 4;
- int first = 1;
- char *v;
-
- val = argv[currentarg++];
- convert_to_string_ex(val);
- v = (*val)->value.str.val;
- outputpos--;
- if(arg > (*val)->value.str.len) {
- php_error(E_WARNING,"pack type %c: not enough characters in string",code);
- arg = (*val)->value.str.len;
- }
-
- while (arg-- > 0) {
- char n = *(v++);
-
- if ((n >= '0') && (n <= '9')) {
- n -= '0';
- } else if ((n >= 'A') && (n <= 'F')) {
- n -= ('A' - 10);
- } else if ((n >= 'a') && (n <= 'f')) {
- n -= ('a' - 10);
- } else {
- php_error(E_WARNING, "pack type %c: illegal hex digit %c", code, n);
- n = 0;
- }
-
- if (first--) {
- output[++outputpos] = 0;
- } else {
- first = 1;
- }
-
- output[outputpos] |= (n << nibbleshift);
- nibbleshift = (nibbleshift + 4) & 7;
- }
-
- outputpos++;
- break;
- }
-
- case 'c': case 'C': {
- while (arg-- > 0) {
- php_pack(argv[currentarg++], 1, byte_map, &output[outputpos]);
- outputpos++;
- }
- break;
- }
-
- case 's': case 'S': case 'n': case 'v': {
- int *map = machine_endian_short_map;
-
- if (code == 'n') {
- map = big_endian_short_map;
- } else if (code == 'v') {
- map = little_endian_short_map;
- }
-
- while (arg-- > 0) {
- php_pack(argv[currentarg++], 2, map, &output[outputpos]);
- outputpos += 2;
- }
- break;
- }
-
- case 'i': case 'I': {
- while (arg-- > 0) {
- php_pack(argv[currentarg++], sizeof(int), int_map, &output[outputpos]);
- outputpos += sizeof(int);
- }
- break;
- }
-
- case 'l': case 'L': case 'N': case 'V': {
- int *map = machine_endian_long_map;
-
- if (code == 'N') {
- map = big_endian_long_map;
- } else if (code == 'V') {
- map = little_endian_long_map;
- }
-
- while (arg-- > 0) {
- php_pack(argv[currentarg++], 4, map, &output[outputpos]);
- outputpos += 4;
- }
- break;
- }
-
- case 'f': {
- float v;
-
- while (arg-- > 0) {
- val = argv[currentarg++];
- convert_to_double_ex(val);
- v = (float)(*val)->value.dval;
- memcpy(&output[outputpos], &v, sizeof(v));
- outputpos += sizeof(v);
- }
- break;
- }
-
- case 'd': {
- double v;
-
- while (arg-- > 0) {
- val = argv[currentarg++];
- convert_to_double_ex(val);
- v = (double)(*val)->value.dval;
- memcpy(&output[outputpos], &v, sizeof(v));
- outputpos += sizeof(v);
- }
- break;
- }
-
- case 'x': {
- memset(&output[outputpos], '\0', arg);
- outputpos += arg;
- break;
- }
-
- case 'X': {
- outputpos -= arg;
-
- if (outputpos < 0) {
- outputpos = 0;
- }
- break;
- }
-
- case '@': {
- if (arg > outputpos) {
- memset(&output[outputpos], '\0', arg - outputpos);
- }
- outputpos = arg;
- break;
- }
- }
- }
-
- efree(argv);
- efree(formatcodes);
- efree(formatargs);
- output[outputpos] = '\0';
- RETVAL_STRINGL(output, outputpos, 1);
- efree(output);
-}
-/* }}} */
-
-/* {{{ php_unpack
- */
-static long php_unpack(char *data, int size, int issigned, int *map)
-{
- long result;
- char *cresult = (char *)&result;
- int i;
-
- result = issigned ? -1 : 0;
-
- for (i = 0; i < size; i++) {
- cresult[map[i]] = *(data++);
- }
-
- return result;
-}
-/* }}} */
-
-/* unpack() is based on Perl's unpack(), but is modified a bit from there.
- * Rather than depending on error-prone ordered lists or syntactically
- * unpleasant pass-by-reference, we return an object with named paramters
- * (like *_fetch_object()). Syntax is "f[repeat]name/...", where "f" is the
- * formatter char (like pack()), "[repeat]" is the optional repeater argument,
- * and "name" is the name of the variable to use.
- * Example: "c2chars/nints" will return an object with fields
- * chars1, chars2, and ints.
- * Numeric pack types will return numbers, a and A will return strings,
- * f and d will return doubles.
- * Implemented formats are A,a,h,H,c,C,s,S,i,I,l,L,n,N,f,d,x,X,@.
- */
-/* {{{ proto array unpack(string format, string input)
- Unpack binary string into named array elements according to format argument */
-PHP_FUNCTION(unpack)
-{
- pval **formatarg;
- pval **inputarg;
- char *format;
- char *input;
- int formatlen;
- int inputpos, inputlen;
- int i;
-
- if ((ZEND_NUM_ARGS() != 2) || zend_get_parameters_ex(2,&formatarg,&inputarg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(formatarg);
- convert_to_string_ex(inputarg);
-
- format = (*formatarg)->value.str.val;
- formatlen = (*formatarg)->value.str.len;
- input = (*inputarg)->value.str.val;
- inputlen = (*inputarg)->value.str.len;
- inputpos = 0;
-
- if (array_init(return_value) == FAILURE)
- return;
-
- while (formatlen-- > 0) {
- char type = *(format++);
- char c;
- int arg = 1;
- char *name;
- int namelen;
- int size=0;
-
- /* Handle format arguments if any */
- if (formatlen > 0) {
- c = *format;
-
- if ((c >= '0') && (c <= '9')) {
- arg = atoi(format);
-
- while ((formatlen > 0) && (*format >= '0') && (*format <= '9')) {
- format++;
- formatlen--;
- }
- } else if (c == '*') {
- arg = -1;
- format++;
- formatlen--;
- }
- }
-
- /* Get of new value in array */
- name = format;
-
- while ((formatlen > 0) && (*format != '/')) {
- formatlen--;
- format++;
- }
-
- namelen = format - name;
-
- if (namelen > 200)
- namelen = 200;
-
- switch ((int)type) {
- /* Never use any input */
- case 'X': {
- size = -1;
- break;
- }
-
- case '@': {
- size = 0;
- break;
- }
-
- case 'a': case 'A': {
- size = arg;
- arg = 1;
- break;
- }
-
- case 'h': case 'H': {
- size = (arg>0)?arg/2:arg;
- arg = 1;
- break;
- }
-
- /* Use 1 byte of input */
- case 'c': case 'C': case 'x': {
- size = 1;
- break;
- }
-
- /* Use 2 bytes of input */
- case 's': case 'S': case 'n': case 'v': {
- size = 2;
- break;
- }
-
- /* Use sizeof(int) bytes of input */
- case 'i': case 'I': {
- size = sizeof(int);
- break;
- }
-
- /* Use 4 bytes of input */
- case 'l': case 'L': case 'N': case 'V': {
- size = 4;
- break;
- }
-
- /* Use sizeof(float) bytes of input */
- case 'f': {
- size = sizeof(float);
- break;
- }
-
- /* Use sizeof(double) bytes of input */
- case 'd': {
- size = sizeof(double);
- break;
- }
- }
-
- /* Do actual unpacking */
- for (i = 0; (i != arg); i++ ) {
- /* Space for name + number, safe as namelen is ensured <= 200 */
- char n[256];
-
- if (arg != 1) {
- /* Need to add element number to name */
- sprintf(n, "%.*s%d", namelen, name, i + 1);
- } else {
- /* Truncate name to next format code or end of string */
- sprintf(n, "%.*s", namelen, name);
- }
-
- if ((inputpos + size) <= inputlen) {
- switch ((int)type) {
- case 'a': case 'A': {
- char pad = (type == 'a') ? '\0' : ' ';
- int len = inputlen - inputpos; /* Remaining string */
-
- /* If size was given take minimum of len and size */
- if ((size >= 0) && (len > size)) {
- len = size;
- }
-
- size = len;
-
- /* Remove padding chars from unpacked data */
- while (--len >= 0) {
- if (input[inputpos + len] != pad)
- break;
- }
-
- add_assoc_stringl(return_value, n, &input[inputpos], len + 1, 1);
- break;
- }
-
- case 'h': case 'H': {
- int len = (inputlen - inputpos) * 2; /* Remaining */
- int nibbleshift = (type == 'h') ? 0 : 4;
- int first = 1;
- char *buf;
- int ipos, opos;
-
- /* If size was given take minimum of len and size */
- if ((size >= 0) && (len > size*2)) {
- len = size*2;
- }
-
- buf = emalloc(len + 1);
-
- for (ipos = opos = 0; opos < len; opos++) {
- char c = (input[inputpos + ipos] >> nibbleshift) & 0xf;
-
- if (c < 10) {
- c += '0';
- } else {
- c += 'a' - 10;
- }
-
- buf[opos] = c;
- nibbleshift = (nibbleshift + 4) & 7;
-
- if (first-- == 0) {
- ipos++;
- first = 1;
- }
- }
-
- buf[len] = '\0';
- add_assoc_stringl(return_value, n, buf, len, 1);
- efree(buf);
- break;
- }
-
- case 'c': case 'C': {
- int issigned = (type == 'c') ? (input[inputpos] & 0x80) : 0;
- long v = php_unpack(&input[inputpos], 1, issigned, byte_map);
- add_assoc_long(return_value, n, v);
- break;
- }
-
- case 's': case 'S': case 'n': case 'v': {
- long v;
- int issigned = 0;
- int *map = machine_endian_short_map;
-
- if (type == 's') {
- issigned = input[inputpos + (machine_little_endian ? 1 : 0)] & 0x80;
- } else if (type == 'n') {
- map = big_endian_short_map;
- } else if (type == 'v') {
- map = little_endian_short_map;
- }
-
- v = php_unpack(&input[inputpos], 2, issigned, map);
- add_assoc_long(return_value, n, v);
- break;
- }
-
- case 'i': case 'I': {
- long v;
- int issigned = 0;
-
- if (type == 'i') {
- issigned = input[inputpos + (machine_little_endian ? (sizeof(int) - 1) : 0)] & 0x80;
- }
-
- v = php_unpack(&input[inputpos], sizeof(int), issigned, int_map);
- add_assoc_long(return_value, n, v);
- break;
- }
-
- case 'l': case 'L': case 'N': case 'V': {
- int issigned = 0;
- int *map = machine_endian_long_map;
- long v;
-
- if (type == 'l') {
- issigned = input[inputpos + (machine_little_endian ? 3 : 0)] & 0x80;
- } else if (type == 'N') {
- map = big_endian_long_map;
- } else if (type == 'V') {
- map = little_endian_long_map;
- }
-
- v = php_unpack(&input[inputpos], 4, issigned, map);
- add_assoc_long(return_value, n, v);
- break;
- }
-
- case 'f': {
- float v;
-
- memcpy(&v, &input[inputpos], sizeof(float));
- add_assoc_double(return_value, n, (double)v);
- break;
- }
-
- case 'd': {
- double v;
-
- memcpy(&v, &input[inputpos], sizeof(double));
- add_assoc_double(return_value, n, v);
- break;
- }
-
- case 'x': {
- /* Do nothing with input, just skip it */
- break;
- }
-
- case 'X': {
- if (inputpos < size) {
- inputpos = -size;
- i = arg - 1; /* Break out of for loop */
-
- if (arg >= 0) {
- php_error(E_WARNING, "pack type %c: outside of string", type);
- }
- }
- break;
- }
-
- case '@': {
- if (arg <= inputlen) {
- inputpos = arg;
- } else {
- php_error(E_WARNING, "pack type %c: outside of string", type);
- }
-
- i = arg - 1; /* Done, break out of for loop */
- break;
- }
- }
-
- inputpos += size;
- } else if (arg < 0) {
- /* Reached end of input for '*' repeater */
- break;
- } else {
- php_error(E_ERROR, "pack type %c: not enough input, need %d, have %d", type, size, inputlen - inputpos);
- RETURN_FALSE;
- }
- }
-
- formatlen--; /* Skip '/' separator, does no harm if inputlen == 0 */
- format++;
- }
-}
-/* }}} */
-
-/* {{{ PHP_MINIT_FUNCTION
- */
-PHP_MINIT_FUNCTION(pack)
-{
- int machine_endian_check = 1;
- int i;
-
- machine_little_endian = ((char *)&machine_endian_check)[0];
-
- if (machine_little_endian) {
- /* Where to get lo to hi bytes from */
- byte_map[0] = 0;
-
- for (i = 0; i < sizeof(int); i++) {
- int_map[i] = i;
- }
-
- machine_endian_short_map[0] = 0;
- machine_endian_short_map[1] = 1;
- big_endian_short_map[0] = 1;
- big_endian_short_map[1] = 0;
- little_endian_short_map[0] = 0;
- little_endian_short_map[1] = 1;
-
- machine_endian_long_map[0] = 0;
- machine_endian_long_map[1] = 1;
- machine_endian_long_map[2] = 2;
- machine_endian_long_map[3] = 3;
- big_endian_long_map[0] = 3;
- big_endian_long_map[1] = 2;
- big_endian_long_map[2] = 1;
- big_endian_long_map[3] = 0;
- little_endian_long_map[0] = 0;
- little_endian_long_map[1] = 1;
- little_endian_long_map[2] = 2;
- little_endian_long_map[3] = 3;
- }
- else {
- pval val;
- int size = sizeof(val.value.lval);
- val.value.lval=0; /*silence a warning*/
-
- /* Where to get hi to lo bytes from */
- byte_map[0] = size - 1;
-
- for (i = 0; i < sizeof(int); i++) {
- int_map[i] = size - (sizeof(int) - i);
- }
-
- machine_endian_short_map[0] = size - 2;
- machine_endian_short_map[1] = size - 1;
- big_endian_short_map[0] = size - 2;
- big_endian_short_map[1] = size - 1;
- little_endian_short_map[0] = size - 1;
- little_endian_short_map[1] = size - 2;
-
- machine_endian_long_map[0] = size - 4;
- machine_endian_long_map[1] = size - 3;
- machine_endian_long_map[2] = size - 2;
- machine_endian_long_map[3] = size - 1;
- big_endian_long_map[0] = size - 4;
- big_endian_long_map[1] = size - 3;
- big_endian_long_map[2] = size - 2;
- big_endian_long_map[3] = size - 1;
- little_endian_long_map[0] = size - 1;
- little_endian_long_map[1] = size - 2;
- little_endian_long_map[2] = size - 3;
- little_endian_long_map[3] = size - 4;
- }
-
- return SUCCESS;
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/standard/pack.h b/ext/standard/pack.h
deleted file mode 100644
index 76f4375c8f..0000000000
--- a/ext/standard/pack.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef PACK_H
-#define PACK_H
-
-extern PHP_MINIT_FUNCTION(pack);
-PHP_FUNCTION(pack);
-PHP_FUNCTION(unpack);
-
-#endif /* PACK_H */
diff --git a/ext/standard/pageinfo.c b/ext/standard/pageinfo.c
deleted file mode 100644
index d06f0fcfc4..0000000000
--- a/ext/standard/pageinfo.c
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Jim Winstead <jimw@php.net> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#include "php.h"
-#include "pageinfo.h"
-#include "SAPI.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#if HAVE_PWD_H
-#ifdef PHP_WIN32
-#include "win32/pwd.h"
-#else
-#include <pwd.h>
-#endif
-#endif
-#if HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#include <sys/stat.h>
-#ifdef PHP_WIN32
-#include <process.h>
-#endif
-
-#include "ext/standard/basic_functions.h"
-
-/* {{{ php_statpage
- */
-static void php_statpage(BLS_D)
-{
- struct stat *pstat;
-
- pstat = sapi_get_stat();
-
- if (BG(page_uid)==-1) {
- if(pstat) {
- BG(page_uid) = pstat->st_uid;
- BG(page_inode) = pstat->st_ino;
- BG(page_mtime) = pstat->st_mtime;
- }
- }
-}
-/* }}} */
-
-/* {{{ php_getuid
- */
-long php_getuid(void)
-{
- BLS_FETCH();
-
- php_statpage(BLS_C);
- return (BG(page_uid));
-}
-/* }}} */
-
-/* {{{ proto int getmyuid(void)
- Get PHP script owner's UID */
-PHP_FUNCTION(getmyuid)
-{
- long uid;
-
- uid = php_getuid();
- if (uid < 0) {
- RETURN_FALSE;
- } else {
- RETURN_LONG(uid);
- }
-}
-/* }}} */
-
-/* {{{ proto int getmypid(void)
- Get current process ID */
-PHP_FUNCTION(getmypid)
-{
- int pid;
-
- pid = getpid();
- if (pid < 0) {
- RETURN_FALSE;
- } else {
- RETURN_LONG((long) pid);
- }
-}
-/* }}} */
-
-/* {{{ proto int getmyinode(void)
- Get the inode of the current script being parsed */
-PHP_FUNCTION(getmyinode)
-{
- BLS_FETCH();
-
- php_statpage(BLS_C);
- if (BG(page_inode) < 0) {
- RETURN_FALSE;
- } else {
- RETURN_LONG(BG(page_inode));
- }
-}
-/* }}} */
-
-/* {{{ proto int getlastmod(void)
- Get time of last page modification */
-PHP_FUNCTION(getlastmod)
-{
- BLS_FETCH();
-
- php_statpage(BLS_C);
- if (BG(page_mtime) < 0) {
- RETURN_FALSE;
- } else {
- RETURN_LONG(BG(page_mtime));
- }
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/standard/pageinfo.h b/ext/standard/pageinfo.h
deleted file mode 100644
index 79d27aa5f1..0000000000
--- a/ext/standard/pageinfo.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Jim Winstead <jimw@php.net> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef PAGEINFO_H
-#define PAGEINFO_H
-
-PHP_FUNCTION(getmyuid);
-PHP_FUNCTION(getmypid);
-PHP_FUNCTION(getmyinode);
-PHP_FUNCTION(getlastmod);
-
-extern long php_getuid(void);
-
-#endif
diff --git a/ext/standard/parsedate.y b/ext/standard/parsedate.y
deleted file mode 100644
index 6cd7ba38d8..0000000000
--- a/ext/standard/parsedate.y
+++ /dev/null
@@ -1,1028 +0,0 @@
-%{
-/*
-** Originally written by Steven M. Bellovin <smb@research.att.com> while
-** at the University of North Carolina at Chapel Hill. Later tweaked by
-** a couple of people on Usenet. Completely overhauled by Rich $alz
-** <rsalz@bbn.com> and Jim Berets <jberets@bbn.com> in August, 1990.
-**
-** This code is in the public domain and has no copyright.
-*/
-
-#include "php.h"
-
-#ifdef PHP_WIN32
-#include <malloc.h>
-#endif
-
-#include <stdio.h>
-#include <sys/types.h>
-#include <time.h>
-#include <ctype.h>
-
-#ifdef HAVE_SYS_TIME_H
-# include <sys/time.h>
-#endif
-#ifdef PHP_WIN32
-# include "win32/time.h"
-#endif
-
-#include "php_parsedate.h"
-
-#if HAVE_STDLIB_H
-# include <stdlib.h> /* for `free'; used by Bison 1.27 */
-#endif
-
-#if defined(_HPUX_SOURCE)
-#include <alloca.h>
-#endif
-
-#if defined (STDC_HEADERS) || (!defined (isascii) && !defined (HAVE_ISASCII))
-# define IN_CTYPE_DOMAIN(c) 1
-#else
-# define IN_CTYPE_DOMAIN(c) isascii(c)
-#endif
-
-#define ISSPACE(c) (IN_CTYPE_DOMAIN (c) && isspace (c))
-#define ISALPHA(c) (IN_CTYPE_DOMAIN (c) && isalpha (c))
-#define ISUPPER(c) (IN_CTYPE_DOMAIN (c) && isupper (c))
-#define ISDIGIT_LOCALE(c) (IN_CTYPE_DOMAIN (c) && isdigit (c))
-
-/* ISDIGIT differs from ISDIGIT_LOCALE, as follows:
- - Its arg may be any int or unsigned int; it need not be an unsigned char.
- - It's guaranteed to evaluate its argument exactly once.
- - It's typically faster.
- Posix 1003.2-1992 section 2.5.2.1 page 50 lines 1556-1558 says that
- only '0' through '9' are digits. Prefer ISDIGIT to ISDIGIT_LOCALE unless
- it's important to use the locale's definition of `digit' even when the
- host does not conform to Posix. */
-#define ISDIGIT(c) ((unsigned) (c) - '0' <= 9)
-
-#if defined (STDC_HEADERS) || defined (USG)
-# include <string.h>
-#endif
-
-#if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
-# define __attribute__(x)
-#endif
-
-#ifndef ATTRIBUTE_UNUSED
-# define ATTRIBUTE_UNUSED __attribute__ ((__unused__))
-#endif
-
-/* Some old versions of bison generate parsers that use bcopy.
- That loses on systems that don't provide the function, so we have
- to redefine it here. */
-#if !defined (HAVE_BCOPY) && defined (HAVE_MEMCPY) && !defined (bcopy)
-# define bcopy(from, to, len) memcpy ((to), (from), (len))
-#endif
-
-/* Remap normal yacc parser interface names (yyparse, yylex, yyerror, etc),
- as well as gratuitiously global symbol names, so we can have multiple
- yacc generated parsers in the same program. Note that these are only
- the variables produced by yacc. If other parser generators (bison,
- byacc, etc) produce additional global names that conflict at link time,
- then those parser generators need to be fixed instead of adding those
- names to this list. */
-
-#define yymaxdepth php_gd_maxdepth
-#define yyparse php_gd_parse
-#define yylex php_gd_lex
-#define yyerror php_gd_error
-#define yylval php_gd_lval
-#define yychar php_gd_char
-#define yydebug php_gd_debug
-#define yypact php_gd_pact
-#define yyr1 php_gd_r1
-#define yyr2 php_gd_r2
-#define yydef php_gd_def
-#define yychk php_gd_chk
-#define yypgo php_gd_pgo
-#define yyact php_gd_act
-#define yyexca php_gd_exca
-#define yyerrflag php_gd_errflag
-#define yynerrs php_gd_nerrs
-#define yyps php_gd_ps
-#define yypv php_gd_pv
-#define yys php_gd_s
-#define yy_yys php_gd_yys
-#define yystate php_gd_state
-#define yytmp php_gd_tmp
-#define yyv php_gd_v
-#define yy_yyv php_gd_yyv
-#define yyval php_gd_val
-#define yylloc php_gd_lloc
-#define yyreds php_gd_reds /* With YYDEBUG defined */
-#define yytoks php_gd_toks /* With YYDEBUG defined */
-#define yylhs php_gd_yylhs
-#define yylen php_gd_yylen
-#define yydefred php_gd_yydefred
-#define yydgoto php_gd_yydgoto
-#define yysindex php_gd_yysindex
-#define yyrindex php_gd_yyrindex
-#define yygindex php_gd_yygindex
-#define yytable php_gd_yytable
-#define yycheck php_gd_yycheck
-
-static int yylex ();
-static int yyerror ();
-
-#define EPOCH 1970
-#define HOUR(x) ((x) * 60)
-
-#define MAX_BUFF_LEN 128 /* size of buffer to read the date into */
-
-/*
-** An entry in the lexical lookup table.
-*/
-typedef struct _TABLE {
- const char *name;
- int type;
- int value;
-} TABLE;
-
-
-/*
-** Meridian: am, pm, or 24-hour style.
-*/
-typedef enum _MERIDIAN {
- MERam, MERpm, MER24
-} MERIDIAN;
-
-
-/*
-** Global variables. We could get rid of most of these by using a good
-** union as the yacc stack. (This routine was originally written before
-** yacc had the %union construct.) Maybe someday; right now we only use
-** the %union very rarely.
-*/
-static const char *yyInput;
-static int yyDayOrdinal;
-static int yyDayNumber;
-static int yyHaveDate;
-static int yyHaveDay;
-static int yyHaveRel;
-static int yyHaveTime;
-static int yyHaveZone;
-static int yyTimezone;
-static int yyDay;
-static int yyHour;
-static int yyMinutes;
-static int yyMonth;
-static int yySeconds;
-static int yyYear;
-static MERIDIAN yyMeridian;
-static int yyRelDay;
-static int yyRelHour;
-static int yyRelMinutes;
-static int yyRelMonth;
-static int yyRelSeconds;
-static int yyRelYear;
-
-%}
-
-/* This grammar has 14 shift/reduce conflicts. */
-%expect 14
-
-%union {
- int Number;
- enum _MERIDIAN Meridian;
-}
-
-%token tAGO tDAY tDAY_UNIT tDAYZONE tDST tHOUR_UNIT tID
-%token tMERIDIAN tMINUTE_UNIT tMONTH tMONTH_UNIT
-%token tSEC_UNIT tSNUMBER tUNUMBER tYEAR_UNIT tZONE
-
-%type <Number> tDAY tDAY_UNIT tDAYZONE tHOUR_UNIT tMINUTE_UNIT
-%type <Number> tMONTH tMONTH_UNIT
-%type <Number> tSEC_UNIT tSNUMBER tUNUMBER tYEAR_UNIT tZONE
-%type <Meridian> tMERIDIAN o_merid
-
-%%
-
-spec : /* NULL */
- | spec item
- ;
-
-item : time {
- yyHaveTime++;
- }
- | zone {
- yyHaveZone++;
- }
- | date {
- yyHaveDate++;
- }
- | day {
- yyHaveDay++;
- }
- | rel {
- yyHaveRel++;
- }
- | number
- ;
-
-time : tUNUMBER tMERIDIAN {
- yyHour = $1;
- yyMinutes = 0;
- yySeconds = 0;
- yyMeridian = $2;
- }
- | tUNUMBER ':' tUNUMBER o_merid {
- yyHour = $1;
- yyMinutes = $3;
- yySeconds = 0;
- yyMeridian = $4;
- }
- | tUNUMBER ':' tUNUMBER tSNUMBER {
- yyHour = $1;
- yyMinutes = $3;
- yyMeridian = MER24;
- yyHaveZone++;
- yyTimezone = ($4 < 0
- ? -$4 % 100 + (-$4 / 100) * 60
- : - ($4 % 100 + ($4 / 100) * 60));
- }
- | tUNUMBER ':' tUNUMBER ':' tUNUMBER o_merid {
- yyHour = $1;
- yyMinutes = $3;
- yySeconds = $5;
- yyMeridian = $6;
- }
- | tUNUMBER ':' tUNUMBER ':' tUNUMBER tSNUMBER {
- yyHour = $1;
- yyMinutes = $3;
- yySeconds = $5;
- yyMeridian = MER24;
- yyHaveZone++;
- yyTimezone = ($6 < 0
- ? -$6 % 100 + (-$6 / 100) * 60
- : - ($6 % 100 + ($6 / 100) * 60));
- }
- ;
-
-zone : tZONE {
- yyTimezone = $1;
- }
- | tDAYZONE {
- yyTimezone = $1 - 60;
- }
- |
- tZONE tDST {
- yyTimezone = $1 - 60;
- }
- ;
-
-day : tDAY {
- yyDayOrdinal = 1;
- yyDayNumber = $1;
- }
- | tDAY ',' {
- yyDayOrdinal = 1;
- yyDayNumber = $1;
- }
- | tUNUMBER tDAY {
- yyDayOrdinal = $1;
- yyDayNumber = $2;
- }
- ;
-
-date : tUNUMBER '/' tUNUMBER {
- yyMonth = $1;
- yyDay = $3;
- }
- | tUNUMBER '/' tUNUMBER '/' tUNUMBER {
- /* Interpret as YYYY/MM/DD if $1 >= 1000, otherwise as MM/DD/YY.
- The goal in recognizing YYYY/MM/DD is solely to support legacy
- machine-generated dates like those in an RCS log listing. If
- you want portability, use the ISO 8601 format. */
- if ($1 >= 1000)
- {
- yyYear = $1;
- yyMonth = $3;
- yyDay = $5;
- }
- else
- {
- yyMonth = $1;
- yyDay = $3;
- yyYear = $5;
- }
- }
- | tUNUMBER tSNUMBER tSNUMBER {
- /* ISO 8601 format. yyyy-mm-dd. */
- yyYear = $1;
- yyMonth = -$2;
- yyDay = -$3;
- }
- | tUNUMBER tMONTH tSNUMBER {
- /* e.g. 17-JUN-1992. */
- yyDay = $1;
- yyMonth = $2;
- yyYear = -$3;
- }
- | tMONTH tUNUMBER tUNUMBER {
- yyMonth = $1;
- yyDay = $2;
- yyYear = $3;
- }
- | tMONTH tUNUMBER {
- yyMonth = $1;
- yyDay = $2;
- }
- | tMONTH tUNUMBER ',' tUNUMBER {
- yyMonth = $1;
- yyDay = $2;
- yyYear = $4;
- }
- | tUNUMBER tMONTH {
- yyMonth = $2;
- yyDay = $1;
- }
- | tUNUMBER tMONTH tUNUMBER {
- yyMonth = $2;
- yyDay = $1;
- yyYear = $3;
- }
- ;
-
-rel : relunit tAGO {
- yyRelSeconds = -yyRelSeconds;
- yyRelMinutes = -yyRelMinutes;
- yyRelHour = -yyRelHour;
- yyRelDay = -yyRelDay;
- yyRelMonth = -yyRelMonth;
- yyRelYear = -yyRelYear;
- }
- | relunit
- ;
-
-relunit : tUNUMBER tYEAR_UNIT {
- yyRelYear += $1 * $2;
- }
- | tSNUMBER tYEAR_UNIT {
- yyRelYear += $1 * $2;
- }
- | tYEAR_UNIT {
- yyRelYear += $1;
- }
- | tUNUMBER tMONTH_UNIT {
- yyRelMonth += $1 * $2;
- }
- | tSNUMBER tMONTH_UNIT {
- yyRelMonth += $1 * $2;
- }
- | tMONTH_UNIT {
- yyRelMonth += $1;
- }
- | tUNUMBER tDAY_UNIT {
- yyRelDay += $1 * $2;
- }
- | tSNUMBER tDAY_UNIT {
- yyRelDay += $1 * $2;
- }
- | tDAY_UNIT {
- yyRelDay += $1;
- }
- | tUNUMBER tHOUR_UNIT {
- yyRelHour += $1 * $2;
- }
- | tSNUMBER tHOUR_UNIT {
- yyRelHour += $1 * $2;
- }
- | tHOUR_UNIT {
- yyRelHour += $1;
- }
- | tUNUMBER tMINUTE_UNIT {
- yyRelMinutes += $1 * $2;
- }
- | tSNUMBER tMINUTE_UNIT {
- yyRelMinutes += $1 * $2;
- }
- | tMINUTE_UNIT {
- yyRelMinutes += $1;
- }
- | tUNUMBER tSEC_UNIT {
- yyRelSeconds += $1 * $2;
- }
- | tSNUMBER tSEC_UNIT {
- yyRelSeconds += $1 * $2;
- }
- | tSEC_UNIT {
- yyRelSeconds += $1;
- }
- ;
-
-number : tUNUMBER
- {
- if (yyHaveTime && yyHaveDate && !yyHaveRel)
- yyYear = $1;
- else
- {
- if ($1>10000)
- {
- yyHaveDate++;
- yyDay= ($1)%100;
- yyMonth= ($1/100)%100;
- yyYear = $1/10000;
- }
- else
- {
- yyHaveTime++;
- if ($1 < 100)
- {
- yyHour = $1;
- yyMinutes = 0;
- }
- else
- {
- yyHour = $1 / 100;
- yyMinutes = $1 % 100;
- }
- yySeconds = 0;
- yyMeridian = MER24;
- }
- }
- }
- ;
-
-o_merid : /* NULL */
- {
- $$ = MER24;
- }
- | tMERIDIAN
- {
- $$ = $1;
- }
- ;
-
-%%
-
-time_t get_date (char *p, time_t *now);
-
-#ifndef PHP_WIN32
-extern struct tm *gmtime();
-extern struct tm *localtime();
-extern time_t mktime();
-#endif
-
-/* Month and day table. */
-static TABLE const MonthDayTable[] = {
- { "january", tMONTH, 1 },
- { "february", tMONTH, 2 },
- { "march", tMONTH, 3 },
- { "april", tMONTH, 4 },
- { "may", tMONTH, 5 },
- { "june", tMONTH, 6 },
- { "july", tMONTH, 7 },
- { "august", tMONTH, 8 },
- { "september", tMONTH, 9 },
- { "sept", tMONTH, 9 },
- { "october", tMONTH, 10 },
- { "november", tMONTH, 11 },
- { "december", tMONTH, 12 },
- { "sunday", tDAY, 0 },
- { "monday", tDAY, 1 },
- { "tuesday", tDAY, 2 },
- { "tues", tDAY, 2 },
- { "wednesday", tDAY, 3 },
- { "wednes", tDAY, 3 },
- { "thursday", tDAY, 4 },
- { "thur", tDAY, 4 },
- { "thurs", tDAY, 4 },
- { "friday", tDAY, 5 },
- { "saturday", tDAY, 6 },
- { NULL, 0, 0 }
-};
-
-/* Time units table. */
-static TABLE const UnitsTable[] = {
- { "year", tYEAR_UNIT, 1 },
- { "month", tMONTH_UNIT, 1 },
- { "fortnight", tDAY_UNIT, 14 },
- { "week", tDAY_UNIT, 7 },
- { "day", tDAY_UNIT, 1 },
- { "hour", tHOUR_UNIT, 1 },
- { "minute", tMINUTE_UNIT, 1 },
- { "min", tMINUTE_UNIT, 1 },
- { "second", tSEC_UNIT, 1 },
- { "sec", tSEC_UNIT, 1 },
- { NULL, 0, 0 }
-};
-
-/* Assorted relative-time words. */
-static TABLE const OtherTable[] = {
- { "tomorrow", tDAY_UNIT, 1 },
- { "yesterday", tDAY_UNIT, -1 },
- { "today", tDAY_UNIT, 0 },
- { "now", tDAY_UNIT, 0 },
- { "last", tUNUMBER, -1 },
- { "this", tMINUTE_UNIT, 0 },
- { "next", tUNUMBER, 1 },
- { "first", tUNUMBER, 1 },
-/* { "second", tUNUMBER, 2 }, */
- { "third", tUNUMBER, 3 },
- { "fourth", tUNUMBER, 4 },
- { "fifth", tUNUMBER, 5 },
- { "sixth", tUNUMBER, 6 },
- { "seventh", tUNUMBER, 7 },
- { "eighth", tUNUMBER, 8 },
- { "ninth", tUNUMBER, 9 },
- { "tenth", tUNUMBER, 10 },
- { "eleventh", tUNUMBER, 11 },
- { "twelfth", tUNUMBER, 12 },
- { "ago", tAGO, 1 },
- { NULL, 0, 0 }
-};
-
-/* The timezone table. */
-static TABLE const TimezoneTable[] = {
- { "gmt", tZONE, HOUR ( 0) }, /* Greenwich Mean */
- { "ut", tZONE, HOUR ( 0) }, /* Universal (Coordinated) */
- { "utc", tZONE, HOUR ( 0) },
- { "wet", tZONE, HOUR ( 0) }, /* Western European */
- { "bst", tDAYZONE, HOUR ( 0) }, /* British Summer */
- { "wat", tZONE, HOUR ( 1) }, /* West Africa */
- { "at", tZONE, HOUR ( 2) }, /* Azores */
-#if 0
- /* For completeness. BST is also British Summer, and GST is
- * also Guam Standard. */
- { "bst", tZONE, HOUR ( 3) }, /* Brazil Standard */
- { "gst", tZONE, HOUR ( 3) }, /* Greenland Standard */
-#endif
-#if 0
- { "nft", tZONE, HOUR (3.5) }, /* Newfoundland */
- { "nst", tZONE, HOUR (3.5) }, /* Newfoundland Standard */
- { "ndt", tDAYZONE, HOUR (3.5) }, /* Newfoundland Daylight */
-#endif
- { "ast", tZONE, HOUR ( 4) }, /* Atlantic Standard */
- { "adt", tDAYZONE, HOUR ( 4) }, /* Atlantic Daylight */
- { "est", tZONE, HOUR ( 5) }, /* Eastern Standard */
- { "edt", tDAYZONE, HOUR ( 5) }, /* Eastern Daylight */
- { "cst", tZONE, HOUR ( 6) }, /* Central Standard */
- { "cdt", tDAYZONE, HOUR ( 6) }, /* Central Daylight */
- { "mst", tZONE, HOUR ( 7) }, /* Mountain Standard */
- { "mdt", tDAYZONE, HOUR ( 7) }, /* Mountain Daylight */
- { "pst", tZONE, HOUR ( 8) }, /* Pacific Standard */
- { "pdt", tDAYZONE, HOUR ( 8) }, /* Pacific Daylight */
- { "yst", tZONE, HOUR ( 9) }, /* Yukon Standard */
- { "ydt", tDAYZONE, HOUR ( 9) }, /* Yukon Daylight */
- { "hst", tZONE, HOUR (10) }, /* Hawaii Standard */
- { "hdt", tDAYZONE, HOUR (10) }, /* Hawaii Daylight */
- { "cat", tZONE, HOUR (10) }, /* Central Alaska */
- { "akst", tZONE, HOUR (10) }, /* Alaska Standard */
- { "akdt", tZONE, HOUR (10) }, /* Alaska Daylight */
- { "ahst", tZONE, HOUR (10) }, /* Alaska-Hawaii Standard */
- { "nt", tZONE, HOUR (11) }, /* Nome */
- { "idlw", tZONE, HOUR (12) }, /* International Date Line West */
- { "cet", tZONE, -HOUR (1) }, /* Central European */
- { "met", tZONE, -HOUR (1) }, /* Middle European */
- { "mewt", tZONE, -HOUR (1) }, /* Middle European Winter */
- { "mest", tDAYZONE, -HOUR (1) }, /* Middle European Summer */
- { "mesz", tDAYZONE, -HOUR (1) }, /* Middle European Summer */
- { "swt", tZONE, -HOUR (1) }, /* Swedish Winter */
- { "sst", tDAYZONE, -HOUR (1) }, /* Swedish Summer */
- { "fwt", tZONE, -HOUR (1) }, /* French Winter */
- { "fst", tDAYZONE, -HOUR (1) }, /* French Summer */
- { "eet", tZONE, -HOUR (2) }, /* Eastern Europe, USSR Zone 1 */
- { "bt", tZONE, -HOUR (3) }, /* Baghdad, USSR Zone 2 */
-#if 0
- { "it", tZONE, -HOUR (3.5) },/* Iran */
-#endif
- { "zp4", tZONE, -HOUR (4) }, /* USSR Zone 3 */
- { "zp5", tZONE, -HOUR (5) }, /* USSR Zone 4 */
-#if 0
- { "ist", tZONE, -HOUR (5.5) },/* Indian Standard */
-#endif
- { "zp6", tZONE, -HOUR (6) }, /* USSR Zone 5 */
-#if 0
- /* For completeness. NST is also Newfoundland Standard, and SST is
- * also Swedish Summer. */
- { "nst", tZONE, -HOUR (6.5) },/* North Sumatra */
- { "sst", tZONE, -HOUR (7) }, /* South Sumatra, USSR Zone 6 */
-#endif /* 0 */
- { "wast", tZONE, -HOUR (7) }, /* West Australian Standard */
- { "wadt", tDAYZONE, -HOUR (7) }, /* West Australian Daylight */
-#if 0
- { "jt", tZONE, -HOUR (7.5) },/* Java (3pm in Cronusland!) */
-#endif
- { "cct", tZONE, -HOUR (8) }, /* China Coast, USSR Zone 7 */
- { "jst", tZONE, -HOUR (9) }, /* Japan Standard, USSR Zone 8 */
-#if 0
- { "cast", tZONE, -HOUR (9.5) },/* Central Australian Standard */
- { "cadt", tDAYZONE, -HOUR (9.5) },/* Central Australian Daylight */
-#endif
- { "east", tZONE, -HOUR (10) }, /* Eastern Australian Standard */
- { "eadt", tDAYZONE, -HOUR (10) }, /* Eastern Australian Daylight */
- { "gst", tZONE, -HOUR (10) }, /* Guam Standard, USSR Zone 9 */
- { "nzt", tZONE, -HOUR (12) }, /* New Zealand */
- { "nzst", tZONE, -HOUR (12) }, /* New Zealand Standard */
- { "nzdt", tDAYZONE, -HOUR (12) }, /* New Zealand Daylight */
- { "idle", tZONE, -HOUR (12) }, /* International Date Line East */
- { NULL, 0, 0 }
-};
-
-/* Military timezone table. */
-static TABLE const MilitaryTable[] = {
- { "a", tZONE, HOUR ( 1) },
- { "b", tZONE, HOUR ( 2) },
- { "c", tZONE, HOUR ( 3) },
- { "d", tZONE, HOUR ( 4) },
- { "e", tZONE, HOUR ( 5) },
- { "f", tZONE, HOUR ( 6) },
- { "g", tZONE, HOUR ( 7) },
- { "h", tZONE, HOUR ( 8) },
- { "i", tZONE, HOUR ( 9) },
- { "k", tZONE, HOUR ( 10) },
- { "l", tZONE, HOUR ( 11) },
- { "m", tZONE, HOUR ( 12) },
- { "n", tZONE, HOUR (- 1) },
- { "o", tZONE, HOUR (- 2) },
- { "p", tZONE, HOUR (- 3) },
- { "q", tZONE, HOUR (- 4) },
- { "r", tZONE, HOUR (- 5) },
- { "s", tZONE, HOUR (- 6) },
- { "t", tZONE, HOUR (- 7) },
- { "u", tZONE, HOUR (- 8) },
- { "v", tZONE, HOUR (- 9) },
- { "w", tZONE, HOUR (-10) },
- { "x", tZONE, HOUR (-11) },
- { "y", tZONE, HOUR (-12) },
- { "z", tZONE, HOUR ( 0) },
- { NULL, 0, 0 }
-};
-
-
-
-
-/* ARGSUSED */
-static int
-yyerror (s)
- char *s ATTRIBUTE_UNUSED;
-{
- return 0;
-}
-
-static int
-ToHour (Hours, Meridian)
- int Hours;
- MERIDIAN Meridian;
-{
- switch (Meridian)
- {
- case MER24:
- if (Hours < 0 || Hours > 23)
- return -1;
- return Hours;
- case MERam:
- if (Hours < 1 || Hours > 12)
- return -1;
- if (Hours == 12)
- Hours = 0;
- return Hours;
- case MERpm:
- if (Hours < 1 || Hours > 12)
- return -1;
- if (Hours == 12)
- Hours = 0;
- return Hours + 12;
- default:
- abort ();
- }
- /* NOTREACHED */
-}
-
-static int
-ToYear (Year)
- int Year;
-{
- if (Year < 0)
- Year = -Year;
-
- /* XPG4 suggests that years 00-68 map to 2000-2068, and
- years 69-99 map to 1969-1999. */
- if (Year < 69)
- Year += 2000;
- else if (Year < 100)
- Year += 1900;
-
- return Year;
-}
-
-static int
-LookupWord (buff)
- char *buff;
-{
- register char *p;
- register char *q;
- register const TABLE *tp;
- int i;
- int abbrev;
-
- /* Make it lowercase. */
- for (p = buff; *p; p++)
- if (ISUPPER ((unsigned char) *p))
- *p = tolower (*p);
-
- if (strcmp (buff, "am") == 0 || strcmp (buff, "a.m.") == 0)
- {
- yylval.Meridian = MERam;
- return tMERIDIAN;
- }
- if (strcmp (buff, "pm") == 0 || strcmp (buff, "p.m.") == 0)
- {
- yylval.Meridian = MERpm;
- return tMERIDIAN;
- }
-
- /* See if we have an abbreviation for a month. */
- if (strlen (buff) == 3)
- abbrev = 1;
- else if (strlen (buff) == 4 && buff[3] == '.')
- {
- abbrev = 1;
- buff[3] = '\0';
- }
- else
- abbrev = 0;
-
- for (tp = MonthDayTable; tp->name; tp++)
- {
- if (abbrev)
- {
- if (strncmp (buff, tp->name, 3) == 0)
- {
- yylval.Number = tp->value;
- return tp->type;
- }
- }
- else if (strcmp (buff, tp->name) == 0)
- {
- yylval.Number = tp->value;
- return tp->type;
- }
- }
-
- for (tp = TimezoneTable; tp->name; tp++)
- if (strcmp (buff, tp->name) == 0)
- {
- yylval.Number = tp->value;
- return tp->type;
- }
-
- if (strcmp (buff, "dst") == 0)
- return tDST;
-
- for (tp = UnitsTable; tp->name; tp++)
- if (strcmp (buff, tp->name) == 0)
- {
- yylval.Number = tp->value;
- return tp->type;
- }
-
- /* Strip off any plural and try the units table again. */
- i = strlen (buff) - 1;
- if (buff[i] == 's')
- {
- buff[i] = '\0';
- for (tp = UnitsTable; tp->name; tp++)
- if (strcmp (buff, tp->name) == 0)
- {
- yylval.Number = tp->value;
- return tp->type;
- }
- buff[i] = 's'; /* Put back for "this" in OtherTable. */
- }
-
- for (tp = OtherTable; tp->name; tp++)
- if (strcmp (buff, tp->name) == 0)
- {
- yylval.Number = tp->value;
- return tp->type;
- }
-
- /* Military timezones. */
- if (buff[1] == '\0' && ISALPHA ((unsigned char) *buff))
- {
- for (tp = MilitaryTable; tp->name; tp++)
- if (strcmp (buff, tp->name) == 0)
- {
- yylval.Number = tp->value;
- return tp->type;
- }
- }
-
- /* Drop out any periods and try the timezone table again. */
- for (i = 0, p = q = buff; *q; q++)
- if (*q != '.')
- *p++ = *q;
- else
- i++;
- *p = '\0';
- if (i)
- for (tp = TimezoneTable; tp->name; tp++)
- if (strcmp (buff, tp->name) == 0)
- {
- yylval.Number = tp->value;
- return tp->type;
- }
-
- return tID;
-}
-
-static int
-yylex ()
-{
- register unsigned char c;
- register char *p;
- char buff[20];
- int Count;
- int sign;
-
- for (;;)
- {
- while (ISSPACE ((unsigned char) *yyInput))
- yyInput++;
-
- if (ISDIGIT (c = *yyInput) || c == '-' || c == '+')
- {
- if (c == '-' || c == '+')
- {
- sign = c == '-' ? -1 : 1;
- if (!ISDIGIT (*++yyInput))
- /* skip the '-' sign */
- continue;
- }
- else
- sign = 0;
- for (yylval.Number = 0; ISDIGIT (c = *yyInput++);)
- yylval.Number = 10 * yylval.Number + c - '0';
- yyInput--;
- if (sign < 0)
- yylval.Number = -yylval.Number;
- return sign ? tSNUMBER : tUNUMBER;
- }
- if (ISALPHA (c))
- {
- for (p = buff; (c = *yyInput++, ISALPHA (c)) || c == '.';)
- if (p < &buff[sizeof buff - 1])
- *p++ = c;
- *p = '\0';
- yyInput--;
- return LookupWord (buff);
- }
- if (c != '(')
- return *yyInput++;
- Count = 0;
- do
- {
- c = *yyInput++;
- if (c == '\0')
- return c;
- if (c == '(')
- Count++;
- else if (c == ')')
- Count--;
- }
- while (Count > 0);
- }
-}
-
-#define TM_YEAR_ORIGIN 1900
-
-/* Yield A - B, measured in seconds. */
-static long
-difftm (struct tm *a, struct tm *b)
-{
- int ay = a->tm_year + (TM_YEAR_ORIGIN - 1);
- int by = b->tm_year + (TM_YEAR_ORIGIN - 1);
- long days = (
- /* difference in day of year */
- a->tm_yday - b->tm_yday
- /* + intervening leap days */
- + ((ay >> 2) - (by >> 2))
- - (ay / 100 - by / 100)
- + ((ay / 100 >> 2) - (by / 100 >> 2))
- /* + difference in years * 365 */
- + (long) (ay - by) * 365
- );
- return (60 * (60 * (24 * days + (a->tm_hour - b->tm_hour))
- + (a->tm_min - b->tm_min))
- + (a->tm_sec - b->tm_sec));
-}
-
-time_t php_parse_date(char *p, time_t *now)
-{
- struct tm tm, tm0, *tmp;
- time_t Start;
-
- yyInput = p;
- Start = now ? *now : time ((time_t *) NULL);
- tmp = localtime (&Start);
- if (!tmp)
- return -1;
- yyYear = tmp->tm_year + TM_YEAR_ORIGIN;
- yyMonth = tmp->tm_mon + 1;
- yyDay = tmp->tm_mday;
- yyHour = tmp->tm_hour;
- yyMinutes = tmp->tm_min;
- yySeconds = tmp->tm_sec;
- tm.tm_isdst = tmp->tm_isdst;
- yyMeridian = MER24;
- yyRelSeconds = 0;
- yyRelMinutes = 0;
- yyRelHour = 0;
- yyRelDay = 0;
- yyRelMonth = 0;
- yyRelYear = 0;
- yyHaveDate = 0;
- yyHaveDay = 0;
- yyHaveRel = 0;
- yyHaveTime = 0;
- yyHaveZone = 0;
-
- if (yyparse ()
- || yyHaveTime > 1 || yyHaveZone > 1 || yyHaveDate > 1 || yyHaveDay > 1)
- return -1;
-
- tm.tm_year = ToYear (yyYear) - TM_YEAR_ORIGIN + yyRelYear;
- tm.tm_mon = yyMonth - 1 + yyRelMonth;
- tm.tm_mday = yyDay + yyRelDay;
- if (yyHaveTime || (yyHaveRel && !yyHaveDate && !yyHaveDay))
- {
- tm.tm_hour = ToHour (yyHour, yyMeridian);
- if (tm.tm_hour < 0)
- return -1;
- tm.tm_min = yyMinutes;
- tm.tm_sec = yySeconds;
- }
- else
- {
- tm.tm_hour = tm.tm_min = tm.tm_sec = 0;
- }
- tm.tm_hour += yyRelHour;
- tm.tm_min += yyRelMinutes;
- tm.tm_sec += yyRelSeconds;
-
- /* Let mktime deduce tm_isdst if we have an absolute timestamp,
- or if the relative timestamp mentions days, months, or years. */
- if (yyHaveDate | yyHaveDay | yyHaveTime | yyRelDay | yyRelMonth | yyRelYear)
- tm.tm_isdst = -1;
-
- tm0 = tm;
-
- Start = mktime (&tm);
-
- if (Start == (time_t) -1)
- {
-
- /* Guard against falsely reporting errors near the time_t boundaries
- when parsing times in other time zones. For example, if the min
- time_t value is 1970-01-01 00:00:00 UTC and we are 8 hours ahead
- of UTC, then the min localtime value is 1970-01-01 08:00:00; if
- we apply mktime to 1970-01-01 00:00:00 we will get an error, so
- we apply mktime to 1970-01-02 08:00:00 instead and adjust the time
- zone by 24 hours to compensate. This algorithm assumes that
- there is no DST transition within a day of the time_t boundaries. */
- if (yyHaveZone)
- {
- tm = tm0;
- if (tm.tm_year <= EPOCH - TM_YEAR_ORIGIN)
- {
- tm.tm_mday++;
- yyTimezone -= 24 * 60;
- }
- else
- {
- tm.tm_mday--;
- yyTimezone += 24 * 60;
- }
- Start = mktime (&tm);
- }
-
- if (Start == (time_t) -1)
- return Start;
- }
-
- if (yyHaveDay && !yyHaveDate)
- {
- tm.tm_mday += ((yyDayNumber - tm.tm_wday + 7) % 7
- + 7 * (yyDayOrdinal - (0 < yyDayOrdinal)));
- Start = mktime (&tm);
- if (Start == (time_t) -1)
- return Start;
- }
-
- if (yyHaveZone)
- {
- long delta;
- struct tm *gmt = gmtime (&Start);
- if (!gmt)
- return -1;
- delta = yyTimezone * 60L + difftm (&tm, gmt);
- if ((Start + delta < Start) != (delta < 0))
- return -1; /* time_t overflow */
- Start += delta;
- }
-
- return Start;
-}
diff --git a/ext/standard/php_array.h b/ext/standard/php_array.h
deleted file mode 100644
index 04ebb02167..0000000000
--- a/ext/standard/php_array.h
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- | Rasmus Lerdorf <rasmus@php.net> |
- | Andrei Zmievski <andrei@ispi.net> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef PHP_ARRAY_H
-#define PHP_ARRAY_H
-
-PHP_MINIT_FUNCTION(array);
-PHP_MSHUTDOWN_FUNCTION(array);
-
-PHP_FUNCTION(ksort);
-PHP_FUNCTION(krsort);
-PHP_FUNCTION(natsort);
-PHP_FUNCTION(natcasesort);
-PHP_FUNCTION(asort);
-PHP_FUNCTION(arsort);
-PHP_FUNCTION(sort);
-PHP_FUNCTION(rsort);
-PHP_FUNCTION(usort);
-PHP_FUNCTION(uasort);
-PHP_FUNCTION(uksort);
-PHP_FUNCTION(array_walk);
-PHP_FUNCTION(count);
-PHP_FUNCTION(end);
-PHP_FUNCTION(prev);
-PHP_FUNCTION(next);
-PHP_FUNCTION(reset);
-PHP_FUNCTION(current);
-PHP_FUNCTION(key);
-PHP_FUNCTION(min);
-PHP_FUNCTION(max);
-PHP_FUNCTION(in_array);
-PHP_FUNCTION(array_search);
-PHP_FUNCTION(extract);
-PHP_FUNCTION(compact);
-PHP_FUNCTION(range);
-PHP_FUNCTION(shuffle);
-PHP_FUNCTION(array_multisort);
-PHP_FUNCTION(array_push);
-PHP_FUNCTION(array_pop);
-PHP_FUNCTION(array_shift);
-PHP_FUNCTION(array_unshift);
-PHP_FUNCTION(array_splice);
-PHP_FUNCTION(array_slice);
-PHP_FUNCTION(array_merge);
-PHP_FUNCTION(array_merge_recursive);
-PHP_FUNCTION(array_keys);
-PHP_FUNCTION(array_values);
-PHP_FUNCTION(array_count_values);
-PHP_FUNCTION(array_reverse);
-PHP_FUNCTION(array_reduce);
-PHP_FUNCTION(array_pad);
-PHP_FUNCTION(array_flip);
-PHP_FUNCTION(array_rand);
-PHP_FUNCTION(array_unique);
-PHP_FUNCTION(array_intersect);
-PHP_FUNCTION(array_diff);
-PHP_FUNCTION(array_sum);
-PHP_FUNCTION(array_filter);
-PHP_FUNCTION(array_map);
-PHP_FUNCTION(key_exists);
-
-HashTable* php_splice(HashTable *, int, int, zval ***, int, HashTable **);
-PHPAPI void php_array_merge(HashTable *dest, HashTable *src, int recursive);
-int multisort_compare(const void *a, const void *b);
-
-typedef struct {
- int *multisort_flags[2];
- int (*compare_func)(zval *result, zval *op1, zval *op2);
-} php_array_globals;
-
-#ifdef ZTS
-#define ARRAYLS_D php_array_globals *array_globals
-#define ARRAYLS_DC , ARRAYLS_D
-#define ARRAYLS_C array_globals
-#define ARRAYLS_CC , ARRAYLS_C
-#define ARRAYG(v) (array_globals->v)
-#define ARRAYLS_FETCH() php_array_globals *array_globals = ts_resource(array_globals_id)
-extern int array_globals_id;
-#else
-#define ARRAYLS_D
-#define ARRAYLS_DC
-#define ARRAYLS_C
-#define ARRAYLS_CC
-#define ARRAYG(v) (array_globals.v)
-#define ARRAYLS_FETCH()
-extern php_array_globals array_globals;
-#endif
-
-#endif /* PHP_ARRAY_H */
diff --git a/ext/standard/php_assert.h b/ext/standard/php_assert.h
deleted file mode 100644
index bde80a8114..0000000000
--- a/ext/standard/php_assert.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Thies C. Arntzen (thies@thieso.net) |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef PHP_ASSERT_H
-#define PHP_ASSERT_H
-
-PHP_MINIT_FUNCTION(assert);
-PHP_MSHUTDOWN_FUNCTION(assert);
-PHP_RINIT_FUNCTION(assert);
-PHP_RSHUTDOWN_FUNCTION(assert);
-PHP_MINFO_FUNCTION(assert);
-PHP_FUNCTION(assert);
-PHP_FUNCTION(assert_options);
-
-#endif /* PHP_ASSERT_H */
diff --git a/ext/standard/php_browscap.h b/ext/standard/php_browscap.h
deleted file mode 100644
index 590d384c83..0000000000
--- a/ext/standard/php_browscap.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef PHP_BROWSCAP_H
-#define PHP_BROWSCAP_H
-
-extern PHP_MINIT_FUNCTION(browscap);
-extern PHP_MSHUTDOWN_FUNCTION(browscap);
-
-PHP_FUNCTION(get_browser);
-
-#endif /* PHP_BROWSCAP_H */
diff --git a/ext/standard/php_crypt.h b/ext/standard/php_crypt.h
deleted file mode 100644
index 4869ccf43e..0000000000
--- a/ext/standard/php_crypt.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Stig Bakken <ssb@gaurdian.no> |
- | Zeev Suraski <zeev@zend.com> |
- | Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef PHP_CRYPT_H
-#define PHP_CRYPT_H
-
-PHP_FUNCTION(crypt);
-#if HAVE_CRYPT
-extern PHP_MINIT_FUNCTION(crypt);
-extern PHP_RINIT_FUNCTION(crypt);
-#endif
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/standard/php_dir.h b/ext/standard/php_dir.h
deleted file mode 100644
index 186a7cdc89..0000000000
--- a/ext/standard/php_dir.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: |
- | PHP 4.0 patches by Thies C. Arntzen (thies@thieso.net) |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifndef PHP_DIR_H
-#define PHP_DIR_H
-
-/* directory functions */
-PHP_MINIT_FUNCTION(dir);
-PHP_RINIT_FUNCTION(dir);
-PHP_FUNCTION(opendir);
-PHP_FUNCTION(closedir);
-PHP_FUNCTION(chdir);
-#if defined(HAVE_CHROOT) && !defined(ZTS)
-PHP_FUNCTION(chroot);
-#endif
-PHP_FUNCTION(getcwd);
-PHP_FUNCTION(rewinddir);
-PHP_NAMED_FUNCTION(php_if_readdir);
-PHP_FUNCTION(getdir);
-
-#endif /* PHP_DIR_H */
diff --git a/ext/standard/php_ext_syslog.h b/ext/standard/php_ext_syslog.h
deleted file mode 100644
index bf22f7e015..0000000000
--- a/ext/standard/php_ext_syslog.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Stig Sæther Bakken <ssb@fast.no> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef PHP_EXT_SYSLOG_H
-#define PHP_EXT_SYSLOG_H
-
-#ifdef HAVE_SYSLOG_H
-
-#include "php_syslog.h"
-
-PHP_MINIT_FUNCTION(syslog);
-PHP_RINIT_FUNCTION(syslog);
-PHP_RSHUTDOWN_FUNCTION(syslog);
-
-PHP_FUNCTION(openlog);
-PHP_FUNCTION(syslog);
-PHP_FUNCTION(closelog);
-PHP_FUNCTION(define_syslog_variables);
-
-#endif
-
-#endif /* PHP_EXT_SYSLOG_H */
diff --git a/ext/standard/php_filestat.h b/ext/standard/php_filestat.h
deleted file mode 100644
index 56f6e1bf52..0000000000
--- a/ext/standard/php_filestat.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Jim Winstead <jimw@php.net> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef PHP_FILESTAT_H
-#define PHP_FILESTAT_H
-
-PHP_RINIT_FUNCTION(filestat);
-PHP_RSHUTDOWN_FUNCTION(filestat);
-
-PHP_FUNCTION(clearstatcache);
-PHP_FUNCTION(fileatime);
-PHP_FUNCTION(filectime);
-PHP_FUNCTION(filegroup);
-PHP_FUNCTION(fileinode);
-PHP_FUNCTION(filemtime);
-PHP_FUNCTION(fileowner);
-PHP_FUNCTION(fileperms);
-PHP_FUNCTION(filesize);
-PHP_FUNCTION(filetype);
-PHP_FUNCTION(is_writable);
-PHP_FUNCTION(is_readable);
-PHP_FUNCTION(is_executable);
-PHP_FUNCTION(is_file);
-PHP_FUNCTION(is_dir);
-PHP_FUNCTION(is_link);
-PHP_FUNCTION(file_exists);
-PHP_NAMED_FUNCTION(php_if_stat);
-PHP_NAMED_FUNCTION(php_if_lstat);
-PHP_FUNCTION(disk_total_space);
-PHP_FUNCTION(disk_free_space);
-PHP_FUNCTION(chown);
-PHP_FUNCTION(chgrp);
-PHP_FUNCTION(chmod);
-PHP_FUNCTION(touch);
-PHP_FUNCTION(clearstatcache);
-
-#define MAKE_LONG_ZVAL_INCREF(name, val)\
- MAKE_STD_ZVAL(name); \
- ZVAL_LONG(name,val); \
- name->refcount++;
-
-#ifdef PHP_WIN32
-#define S_IRUSR S_IREAD
-#define S_IWUSR S_IWRITE
-#define S_IXUSR S_IEXEC
-#define S_IRGRP S_IREAD
-#define S_IWGRP S_IWRITE
-#define S_IXGRP S_IEXEC
-#define S_IROTH S_IREAD
-#define S_IWOTH S_IWRITE
-#define S_IXOTH S_IEXEC
-
-#undef getgid
-#define getgroups(a,b) 0
-#define getgid() 1
-#define getuid() 1
-#endif
-
-#endif /* PHP_FILESTAT_H */
diff --git a/ext/standard/php_fopen_wrapper.c b/ext/standard/php_fopen_wrapper.c
deleted file mode 100644
index 6e48f2b4aa..0000000000
--- a/ext/standard/php_fopen_wrapper.c
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
- | Jim Winstead <jimw@php.net> |
- | Hartmut Holzgraefe <hholzgra@php.net> |
- +----------------------------------------------------------------------+
- */
-/* $Id$ */
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "php.h"
-#include "php_globals.h"
-#include "php_standard.h"
-#include "php_fopen_wrappers.h"
-
-
-/* {{{ php_fopen_url_wrap_php
- */
-FILE *php_fopen_url_wrap_php(char *path, char *mode, int options, int *issock, int *socketd, char **opened_path)
-{
- const char *res = path + 6;
-
- *issock = 0;
-
- if (!strcasecmp(res, "stdin")) {
- return fdopen(STDIN_FILENO, mode);
- } else if (!strcasecmp(res, "stdout")) {
- return fdopen(STDOUT_FILENO, mode);
- } else if (!strcasecmp(res, "stderr")) {
- return fdopen(STDERR_FILENO, mode);
- }
-
- return NULL;
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/standard/php_fopen_wrappers.h b/ext/standard/php_fopen_wrappers.h
deleted file mode 100644
index 8e4427e8b3..0000000000
--- a/ext/standard/php_fopen_wrappers.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
- | Jim Winstead <jimw@php.net> |
- | Hartmut Holzgraefe <hholzgra@php.net> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef PHP_FOPEN_WRAPPERS_H
-#define PHP_FOPEN_WRAPPERS_H
-
-extern FILE *php_fopen_url_wrap_http(char *, char *, int, int *, int *, char **);
-extern FILE *php_fopen_url_wrap_ftp(char *, char *, int, int *, int *, char **);
-extern FILE *php_fopen_url_wrap_php(char *, char *, int, int *, int *, char **);
-
-#endif
diff --git a/ext/standard/php_image.h b/ext/standard/php_image.h
deleted file mode 100644
index e47dab9898..0000000000
--- a/ext/standard/php_image.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Rasmus Lerdorf |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef PHP_IMAGE_H
-#define PHP_IMAGE_H
-
-PHP_FUNCTION(getimagesize);
-
-#endif /* PHP_IMAGE_H */
diff --git a/ext/standard/php_incomplete_class.h b/ext/standard/php_incomplete_class.h
deleted file mode 100644
index bfa876044e..0000000000
--- a/ext/standard/php_incomplete_class.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Sascha Schumann <sascha@schumann.cx> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef PHP_INCOMPLETE_CLASS_H
-#define PHP_INCOMPLETE_CLASS_H
-
-#include "ext/standard/basic_functions.h"
-
-#define PHP_IC_ENTRY \
- BG(incomplete_class)
-
-#define PHP_IC_ENTRY_READ \
- (PHP_IC_ENTRY ? PHP_IC_ENTRY : php_create_incomplete_class(BLS_C))
-
-
-#define PHP_SET_CLASS_ATTRIBUTES(struc) \
- if ((struc)->value.obj.ce == BG(incomplete_class)) { \
- class_name = php_lookup_class_name(struc, &name_len, 1); \
- free_class_name = 1; \
- } else { \
- class_name = (struc)->value.obj.ce->name; \
- name_len = (struc)->value.obj.ce->name_length; \
- }
-
-#define PHP_CLEANUP_CLASS_ATTRIBUTES() \
- if (free_class_name) efree(class_name)
-
-#define PHP_CLASS_ATTRIBUTES \
- char *class_name; \
- size_t name_len; \
- zend_bool free_class_name = 0 \
-
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-zend_class_entry *php_create_incomplete_class(BLS_D);
-
-char *php_lookup_class_name(zval *object, size_t *nlen, zend_bool del);
-void php_store_class_name(zval *object, const char *name, size_t len);
-
-#ifdef __cplusplus
-};
-#endif
-
-#endif
diff --git a/ext/standard/php_iptc.h b/ext/standard/php_iptc.h
deleted file mode 100644
index 434c0c13e5..0000000000
--- a/ext/standard/php_iptc.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Thies C. Arntzen <thies@thieso.net> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef PHP_IPTC_H
-#define PHP_IPTC_H
-
-PHP_FUNCTION(iptcparse);
-PHP_FUNCTION(iptcembed);
-
-#endif /* PHP_IPTC_H */
diff --git a/ext/standard/php_lcg.h b/ext/standard/php_lcg.h
deleted file mode 100644
index 1cb5fb009c..0000000000
--- a/ext/standard/php_lcg.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Sascha Schumann <sascha@schumann.cx> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef PHP_LCG_H
-#define PHP_LCG_H
-
-typedef struct {
- long s1;
- long s2;
-} php_lcg_globals;
-
-double php_combined_lcg(void);
-PHP_FUNCTION(lcg_value);
-
-#ifdef ZTS
-PHP_MINIT_FUNCTION(lcg);
-#define LCGLS_D php_lcg_globals *lcg_globals
-#define LCG(v) (lcg_globals->v)
-#define LCGLS_FETCH() php_lcg_globals *lcg_globals = ts_resource(lcg_globals_id)
-#else
-PHP_RINIT_FUNCTION(lcg);
-#define LCGLS_D void
-#define LCG(v) (lcg_globals.v)
-#define LCGLS_FETCH()
-#endif
-
-#endif
diff --git a/ext/standard/php_link.h b/ext/standard/php_link.h
deleted file mode 100644
index 298708540e..0000000000
--- a/ext/standard/php_link.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef PHP_LINK_H
-#define PHP_LINK_H
-
-#ifdef HAVE_SYMLINK
-
-PHP_FUNCTION(link);
-PHP_FUNCTION(readlink);
-PHP_FUNCTION(linkinfo);
-PHP_FUNCTION(symlink);
-
-#endif
-
-#endif /* PHP_LINK_H */
diff --git a/ext/standard/php_mail.h b/ext/standard/php_mail.h
deleted file mode 100644
index 5e5a0e54ca..0000000000
--- a/ext/standard/php_mail.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef PHP_MAIL_H
-#define PHP_MAIL_H
-
-#if HAVE_SENDMAIL
-
-PHP_FUNCTION(mail);
-PHP_FUNCTION(ezmlm_hash);
-PHP_MINFO_FUNCTION(mail);
-PHPAPI extern int php_mail(char *to, char *subject, char *message, char *headers, char *extra_cmd);
-
-#endif
-
-#endif /* PHP_MAIL_H */
diff --git a/ext/standard/php_math.h b/ext/standard/php_math.h
deleted file mode 100644
index def6225ada..0000000000
--- a/ext/standard/php_math.h
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Jim Winstead (jimw@php.net) |
- | Stig Sæther Bakken <ssb@guardian.no> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef PHP_MATH_H
-#define PHP_MATH_H
-PHP_FUNCTION(sin);
-PHP_FUNCTION(cos);
-PHP_FUNCTION(tan);
-PHP_FUNCTION(asin);
-PHP_FUNCTION(acos);
-PHP_FUNCTION(atan);
-PHP_FUNCTION(atan2);
-PHP_FUNCTION(pi);
-PHP_FUNCTION(exp);
-PHP_FUNCTION(log);
-PHP_FUNCTION(log10);
-PHP_FUNCTION(pow);
-PHP_FUNCTION(sqrt);
-PHP_FUNCTION(srand);
-PHP_FUNCTION(rand);
-PHP_FUNCTION(getrandmax);
-PHP_FUNCTION(mt_srand);
-PHP_FUNCTION(mt_rand);
-PHP_FUNCTION(mt_getrandmax);
-PHP_FUNCTION(abs);
-PHP_FUNCTION(ceil);
-PHP_FUNCTION(floor);
-PHP_FUNCTION(round);
-PHP_FUNCTION(decbin);
-PHP_FUNCTION(dechex);
-PHP_FUNCTION(decoct);
-PHP_FUNCTION(bindec);
-PHP_FUNCTION(hexdec);
-PHP_FUNCTION(octdec);
-PHP_FUNCTION(base_convert);
-PHP_FUNCTION(number_format);
-PHP_FUNCTION(deg2rad);
-PHP_FUNCTION(rad2deg);
-
-#include <math.h>
-
-#ifndef M_E
-#define M_E 2.7182818284590452354 /* e */
-#endif
-
-#ifndef M_LOG2E
-#define M_LOG2E 1.4426950408889634074 /* log_2 e */
-#endif
-
-#ifndef M_LOG10E
-#define M_LOG10E 0.43429448190325182765 /* log_10 e */
-#endif
-
-#ifndef M_LN2
-#define M_LN2 0.69314718055994530942 /* log_e 2 */
-#endif
-
-#ifndef M_LN10
-#define M_LN10 2.30258509299404568402 /* log_e 10 */
-#endif
-
-#ifndef M_PI
-#define M_PI 3.14159265358979323846 /* pi */
-#endif
-
-#ifndef M_PI_2
-#define M_PI_2 1.57079632679489661923 /* pi/2 */
-#endif
-
-#ifndef M_PI_4
-#define M_PI_4 0.78539816339744830962 /* pi/4 */
-#endif
-
-#ifndef M_1_PI
-#define M_1_PI 0.31830988618379067154 /* 1/pi */
-#endif
-
-#ifndef M_2_PI
-#define M_2_PI 0.63661977236758134308 /* 2/pi */
-#endif
-
-#ifndef M_SQRTPI
-#define M_SQRTPI 1.77245385090551602729 /* sqrt(pi) */
-#endif
-
-#ifndef M_2_SQRTPI
-#define M_2_SQRTPI 1.12837916709551257390 /* 2/sqrt(pi) */
-#endif
-
-#ifndef M_LNPI
-#define M_LNPI 1.14472988584940017414 /* ln(pi) */
-#endif
-
-#ifndef M_EULER
-#define M_EULER 0.57721566490153286061 /* Euler constant */
-#endif
-
-#ifndef M_SQRT2
-#define M_SQRT2 1.41421356237309504880 /* sqrt(2) */
-#endif
-
-#ifndef M_SQRT1_2
-#define M_SQRT1_2 0.70710678118654752440 /* 1/sqrt(2) */
-#endif
-
-#ifndef M_SQRT3
-#define M_SQRT3 1.73205080756887729352 /* sqrt(3) */
-#endif
-
-#endif /* PHP_MATH_H */
diff --git a/ext/standard/php_metaphone.h b/ext/standard/php_metaphone.h
deleted file mode 100644
index eb888c6791..0000000000
--- a/ext/standard/php_metaphone.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Thies C. Arntzen <thies@thieso.net> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifndef PHP_METAPHONE_H
-#define PHP_METAPHONE_H
-
-PHP_FUNCTION(metaphone);
-
-#endif
diff --git a/ext/standard/php_output.h b/ext/standard/php_output.h
deleted file mode 100644
index 58a3db8c15..0000000000
--- a/ext/standard/php_output.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef PHP_OUTPUT_H
-#define PHP_OUTPUT_H
-
-#include "php.h"
-
-typedef void (*php_output_handler_func_t)(char *output, uint output_len, char **handled_output, uint *handled_output_len, int mode);
-
-PHPAPI void php_output_startup(void);
-void php_output_register_constants(void);
-PHPAPI int php_body_write(const char *str, uint str_length);
-PHPAPI int php_header_write(const char *str, uint str_length);
-PHPAPI int php_start_ob_buffer(zval *output_handler, uint chunk_size);
-PHPAPI void php_end_ob_buffer(zend_bool send_buffer, zend_bool just_flush);
-PHPAPI void php_end_ob_buffers(zend_bool send_buffer);
-PHPAPI int php_ob_get_buffer(pval *p);
-PHPAPI int php_ob_get_length(pval *p);
-PHPAPI void php_start_implicit_flush(void);
-PHPAPI void php_end_implicit_flush(void);
-PHPAPI char *php_get_output_start_filename(void);
-PHPAPI int php_get_output_start_lineno(void);
-PHPAPI void php_ob_set_internal_handler(php_output_handler_func_t internal_output_handler, uint buffer_size);
-
-PHP_FUNCTION(ob_start);
-PHP_FUNCTION(ob_end_flush);
-PHP_FUNCTION(ob_end_clean);
-PHP_FUNCTION(ob_get_contents);
-PHP_FUNCTION(ob_get_length);
-PHP_FUNCTION(ob_implicit_flush);
-
-typedef struct _php_ob_buffer {
- char *buffer;
- uint size;
- uint text_length;
- int block_size;
- uint chunk_size;
- int status;
- zval *output_handler;
- php_output_handler_func_t internal_output_handler;
- char *internal_output_handler_buffer;
- uint internal_output_handler_buffer_size;
-} php_ob_buffer;
-
-typedef struct _php_output_globals {
- int (*php_body_write)(const char *str, uint str_length); /* string output */
- int (*php_header_write)(const char *str, uint str_length); /* unbuffer string output */
- php_ob_buffer active_ob_buffer;
- unsigned char implicit_flush;
- char *output_start_filename;
- int output_start_lineno;
- zend_stack ob_buffers;
- int nesting_level;
- zend_bool lock;
-} php_output_globals;
-
-
-#ifdef ZTS
-#define OLS_D php_output_globals *output_globals
-#define OLS_C output_globals
-#define OG(v) (output_globals->v)
-#define OLS_FETCH() php_output_globals *output_globals = ts_resource(output_globals_id)
-ZEND_API extern int output_globals_id;
-#else
-#define OLS_D void
-#define OLS_C
-#define OG(v) (output_globals.v)
-#define OLS_FETCH()
-ZEND_API extern php_output_globals output_globals;
-#endif
-
-#define PHP_OUTPUT_HANDLER_START (1<<0)
-#define PHP_OUTPUT_HANDLER_CONT (1<<1)
-#define PHP_OUTPUT_HANDLER_END (1<<2)
-
-#endif /* PHP_OUTPUT_H */
diff --git a/ext/standard/php_parsedate.h b/ext/standard/php_parsedate.h
deleted file mode 100644
index e4a6af7714..0000000000
--- a/ext/standard/php_parsedate.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Sascha Schumann <sascha@schumann.cx> |
- +----------------------------------------------------------------------+
- */
-
-#ifndef PHP_PARSEDATE_H
-#define PHP_PARSEDATE_H
-
-#include <time.h>
-
-time_t php_parse_date(char *p, time_t *now);
-
-#endif
diff --git a/ext/standard/php_rand.h b/ext/standard/php_rand.h
deleted file mode 100644
index b4d7e991d0..0000000000
--- a/ext/standard/php_rand.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
- | Zeev Suraski <zeev@zend.com> |
- | Pedro Melo <melo@ip.pt> |
- | |
- | Based on code from: Shawn Cokus <Cokus@math.washington.edu> |
- +----------------------------------------------------------------------+
- */
-/* $Id$ */
-
-#ifndef PHP_RAND_H
-#define PHP_RAND_H
-
-#include <stdlib.h>
-
-#ifndef RAND_MAX
-#define RAND_MAX (1<<15)
-#endif
-
-#if HAVE_LRAND48
-#define PHP_RAND_MAX 2147483647
-#else
-#define PHP_RAND_MAX RAND_MAX
-#endif
-
-/* Define rand Function wrapper */
-#ifdef HAVE_RANDOM
-#define php_rand() random()
-#else
-#ifdef HAVE_LRAND48
-#define php_rand() lrand48()
-#else
-#define php_rand() rand()
-#endif
-#endif
-
-/* Define srand Function wrapper */
-#ifdef HAVE_SRANDOM
-#define php_srand(seed) srandom((unsigned int)seed)
-#else
-#ifdef HAVE_SRAND48
-#define php_srand(seed) srand48((long)seed)
-#else
-#define php_srand(seed) srand((unsigned int)seed)
-#endif
-#endif
-
-#endif /* PHP_RAND_H */
diff --git a/ext/standard/php_smart_str.h b/ext/standard/php_smart_str.h
deleted file mode 100644
index 46d70a436a..0000000000
--- a/ext/standard/php_smart_str.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Sascha Schumann <sascha@schumann.cx> |
- +----------------------------------------------------------------------+
- */
-
-#ifndef PHP_SMART_STR_H
-#define PHP_SMART_STR_H
-
-#include "php_smart_str_public.h"
-
-#include <stdlib.h>
-#include <zend.h>
-
-#define smart_str_0(x) ((x)->c[(x)->len] = '\0')
-
-#define smart_str_alloc(d,n,what) {\
- if (!d->c) d->len = d->a = 0; \
- newlen = d->len + n; \
- if (newlen >= d->a) {\
- d->c = perealloc(d->c, newlen + 129, what); \
- d->a = newlen + 128; \
- }\
-}
-
-#define smart_str_appends_ex(dest, src, what) smart_str_appendl_ex(dest, src, strlen(src), what)
-#define smart_str_appends(dest, src) smart_str_appendl(dest, src, strlen(src))
-
-#define smart_str_appendc(dest, c) smart_str_appendc_ex(dest, c, 0)
-#define smart_str_free(s) smart_str_free_ex(s, 0)
-#define smart_str_appendl(dest,src,len) smart_str_appendl_ex(dest,src,len,0)
-#define smart_str_append(dest, src) smart_str_append_ex(dest,src,0)
-
-static inline void smart_str_appendc_ex(smart_str *dest, char c, int what)
-{
- size_t newlen;
-
- smart_str_alloc(dest, 1, what);
- dest->len = newlen;
- dest->c[dest->len - 1] = c;
-}
-
-
-static inline void smart_str_free_ex(smart_str *s, int what)
-{
- if (s->c) {
- pefree(s->c, what);
- s->c = NULL;
- }
- s->a = s->len = 0;
-}
-
-static inline void smart_str_appendl_ex(smart_str *dest, const char *src, size_t len, int what)
-{
- size_t newlen;
-
- smart_str_alloc(dest, len, what);
- memcpy(dest->c + dest->len, src, len);
- dest->len = newlen;
-}
-
-static inline void smart_str_append_ex(smart_str *dest, smart_str *src, int what)
-{
- smart_str_appendl_ex(dest, src->c, src->len, what);
-}
-
-static inline void smart_str_setl(smart_str *dest, const char *src, size_t len)
-{
- dest->len = len;
- dest->a = len + 1;
- dest->c = (char *) src;
-}
-
-static inline void smart_str_sets(smart_str *dest, const char *src)
-{
- smart_str_setl(dest, src, strlen(src));
-}
-
-#endif
diff --git a/ext/standard/php_smart_str_public.h b/ext/standard/php_smart_str_public.h
deleted file mode 100644
index 8093f3ed99..0000000000
--- a/ext/standard/php_smart_str_public.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Sascha Schumann <sascha@schumann.cx> |
- +----------------------------------------------------------------------+
- */
-
-#ifndef PHP_SMART_STR_PUBLIC_H
-#define PHP_SMART_STR_PUBLIC_H
-
-#include <sys/types.h>
-
-typedef struct {
- char *c;
- size_t len;
- size_t a;
-} smart_str;
-
-#endif
diff --git a/ext/standard/php_standard.h b/ext/standard/php_standard.h
deleted file mode 100644
index 536c13807e..0000000000
--- a/ext/standard/php_standard.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#include "basic_functions.h"
-#include "php_math.h"
-#include "php_string.h"
-#include "base64.h"
-#include "php_dir.h"
-#include "dns.h"
-#include "reg.h"
-#include "php_mail.h"
-#include "md5.h"
-#include "html.h"
-#include "exec.h"
-#include "file.h"
-#include "php_ext_syslog.h"
-#include "php_filestat.h"
-#include "php_browscap.h"
-#include "pack.h"
-#include "datetime.h"
-#include "microtime.h"
-#include "url.h"
-#include "pageinfo.h"
-#include "cyr_convert.h"
-#include "php_link.h"
-#include "fsock.h"
-#include "php_image.h"
-#include "php_iptc.h"
-#include "info.h"
-#include "uniqid.h"
-#include "php_var.h"
-#include "quot_print.h"
-#include "type.h"
-#include "dl.h"
-#include "php_crypt.h"
-#include "head.h"
-#include "php_lcg.h"
-#include "php_metaphone.h"
-#include "php_output.h"
-#include "php_array.h"
-#include "php_assert.h"
-
-#define phpext_standard_ptr basic_functions_module_ptr
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/standard/php_string.h b/ext/standard/php_string.h
deleted file mode 100644
index f4a218686f..0000000000
--- a/ext/standard/php_string.h
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
- | Stig Sæther Bakken <ssb@guardian.no> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-/* Synced with php 3.0 revision 1.43 1999-06-16 [ssb] */
-
-#ifndef PHP_STRING_H
-#define PHP_STRING_H
-
-PHP_FUNCTION(strspn);
-PHP_FUNCTION(strcspn);
-PHP_FUNCTION(str_replace);
-PHP_FUNCTION(chop);
-PHP_FUNCTION(trim);
-PHP_FUNCTION(ltrim);
-PHP_FUNCTION(soundex);
-PHP_FUNCTION(levenshtein);
-
-PHP_FUNCTION(count_chars);
-PHP_FUNCTION(wordwrap);
-PHP_FUNCTION(explode);
-PHP_FUNCTION(implode);
-PHP_FUNCTION(strtok);
-PHP_FUNCTION(strtoupper);
-PHP_FUNCTION(strtolower);
-PHP_FUNCTION(basename);
-PHP_FUNCTION(dirname);
-PHP_FUNCTION(pathinfo);
-PHP_FUNCTION(strstr);
-PHP_FUNCTION(strpos);
-PHP_FUNCTION(strrpos);
-PHP_FUNCTION(strrchr);
-PHP_FUNCTION(substr);
-PHP_FUNCTION(quotemeta);
-PHP_FUNCTION(ucfirst);
-PHP_FUNCTION(ucwords);
-PHP_FUNCTION(strtr);
-PHP_FUNCTION(strrev);
-PHP_FUNCTION(hebrev);
-PHP_FUNCTION(hebrevc);
-PHP_FUNCTION(user_sprintf);
-PHP_FUNCTION(user_printf);
-PHP_FUNCTION(addcslashes);
-PHP_FUNCTION(addslashes);
-PHP_FUNCTION(stripcslashes);
-PHP_FUNCTION(stripslashes);
-PHP_FUNCTION(chr);
-PHP_FUNCTION(ord);
-PHP_FUNCTION(nl2br);
-PHP_FUNCTION(setlocale);
-PHP_FUNCTION(localeconv);
-PHP_FUNCTION(stristr);
-PHP_FUNCTION(chunk_split);
-PHP_FUNCTION(parse_str);
-PHP_FUNCTION(bin2hex);
-PHP_FUNCTION(similar_text);
-PHP_FUNCTION(strip_tags);
-PHP_FUNCTION(str_repeat);
-PHP_FUNCTION(substr_replace);
-PHP_FUNCTION(strnatcmp);
-PHP_FUNCTION(strnatcasecmp);
-PHP_FUNCTION(substr_count);
-PHP_FUNCTION(str_pad);
-PHP_FUNCTION(sscanf);
-#ifdef HAVE_STRCOLL
-PHP_FUNCTION(strcoll);
-#endif
-
-
-#if defined(HAVE_LOCALECONV) && defined(ZTS)
-PHP_MINIT_FUNCTION(localeconv);
-PHP_MSHUTDOWN_FUNCTION(localeconv);
-#endif
-
-#define strnatcmp(a, b) \
- strnatcmp_ex(a, strlen(a), b, strlen(b), 0)
-#define strnatcasecmp(a, b) \
- strnatcmp_ex(a, strlen(a), b, strlen(b), 1)
-PHPAPI int strnatcmp_ex(char const *a, size_t a_len, char const *b, size_t b_len, int fold_case);
-
-PHPAPI char *php_strtoupper(char *s, size_t len);
-PHPAPI char *php_strtolower(char *s, size_t len);
-PHPAPI char *php_strtr(char *str, int len, char *str_from, char *str_to, int trlen);
-PHPAPI char *php_addslashes(char *str, int length, int *new_length, int freeit);
-PHPAPI char *php_addcslashes(char *str, int length, int *new_length, int freeit, char *what, int wlength);
-PHPAPI void php_stripslashes(char *str, int *len);
-PHPAPI void php_stripcslashes(char *str, int *len);
-PHPAPI char *php_basename(char *str, size_t len);
-PHPAPI void php_dirname(char *str, int len);
-PHPAPI char *php_stristr(unsigned char *s, unsigned char *t, size_t s_len, size_t t_len);
-PHPAPI char *php_str_to_str(char *haystack, int length, char *needle,
- int needle_len, char *str, int str_len, int *_new_length);
-PHPAPI void php_trim(pval *str, pval *return_value, int mode);
-PHPAPI void php_strip_tags(char *rbuf, int len, int state, char *allow, int allow_len);
-
-PHPAPI void php_char_to_str(char *str, uint len, char from, char *to, int to_len, pval *result);
-
-PHPAPI void php_implode(pval *delim, pval *arr, pval *return_value);
-PHPAPI void php_explode(pval *delim, pval *str, pval *return_value, int limit);
-
-static inline char *
-php_memnstr(char *haystack, char *needle, int needle_len, char *end)
-{
- char *p = haystack;
- char *s = NULL;
-
- for(; p <= end - needle_len &&
- (s = (char*)memchr(p, *needle, end - p - needle_len + 1)); p = s + 1) {
- if(memcmp(s, needle, needle_len) == 0)
- return s;
- }
- return NULL;
-}
-
-PHPAPI size_t php_strspn(char *s1, char *s2, char *s1_end, char *s2_end);
-PHPAPI size_t php_strcspn(char *s1, char *s2, char *s1_end, char *s2_end);
-
-#ifndef HAVE_STRERROR
-PHPAPI char *php_strerror(int errnum);
-#define strerror php_strerror
-#endif
-
-void register_string_constants(INIT_FUNC_ARGS);
-
-#endif /* PHP_STRING_H */
diff --git a/ext/standard/php_var.h b/ext/standard/php_var.h
deleted file mode 100644
index 7e2391adc3..0000000000
--- a/ext/standard/php_var.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Jani Lehtimäki <jkl@njet.net> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef PHP_VAR_H
-#define PHP_VAR_H
-
-PHP_FUNCTION(var_dump);
-PHP_FUNCTION(serialize);
-PHP_FUNCTION(unserialize);
-
-void php_var_dump(pval **struc, int level);
-
-/* typdef HashTable php_serialize_data_t; */
-#define php_serialize_data_t HashTable
-
-void php_var_serialize(pval *buf, pval **struc, php_serialize_data_t *var_hash);
-int php_var_unserialize(pval **rval, const char **p, const char *max, php_serialize_data_t *var_hash);
-
-#define PHP_VAR_SERIALIZE_INIT(var_hash) \
- zend_hash_init(&(var_hash),10,NULL,NULL,0)
-#define PHP_VAR_SERIALIZE_DESTROY(var_hash) \
- zend_hash_destroy(&(var_hash))
-
-#define PHP_VAR_UNSERIALIZE_INIT(var_hash) \
- zend_hash_init(&(var_hash),10,NULL,NULL,0)
-#define PHP_VAR_UNSERIALIZE_DESTROY(var_hash) \
- zend_hash_destroy(&(var_hash))
-
-#define PHP_VAR_UNSERIALIZE_ZVAL_CHANGED(var_hash,ozval,nzval) \
-if (var_hash) { \
- HashPosition pos; \
- zval **zval_ref; \
- zend_hash_internal_pointer_reset_ex(var_hash,&pos); \
- while (zend_hash_get_current_data_ex(var_hash, (void **) &zval_ref, &pos) == SUCCESS) { \
- if (*zval_ref == ozval) { \
- char *string_key; \
- ulong str_key_len; \
- ulong num_key; \
- zend_hash_get_current_key_ex(var_hash, &string_key, &str_key_len, &num_key, 1, &pos); \
- /* this is our hash and it _will_ be number indexed! */ \
- zend_hash_index_update(var_hash, num_key, &nzval, sizeof(zval *), NULL); \
- break; \
- } \
- zend_hash_move_forward_ex(var_hash,&pos); \
- } \
-}
-
-PHPAPI zend_class_entry *php_create_empty_class(char *class_name,int len);
-
-#endif /* PHP_VAR_H */
diff --git a/ext/standard/quot_print.c b/ext/standard/quot_print.c
deleted file mode 100644
index 2fb0f601fb..0000000000
--- a/ext/standard/quot_print.c
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Kirill Maximov <kir@actimind.com> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#include <stdlib.h>
-
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#include <string.h>
-#include <errno.h>
-
-#include "php.h"
-#include "quot_print.h"
-
-#include <stdio.h>
-
-/*
-* Converting HEX char to INT value
-*/
-static char php_hex2int(int c)
-{
- if ( isdigit(c) )
- {
- return c - '0';
- }
- else if ( c >= 'A' && c <= 'F' )
- {
- return c - 'A' + 10;
- }
- else
- {
- return -1;
- }
-}
-
-/*
-*
-* Decoding Quoted-printable string.
-*
-*/
-/* {{{ proto string quoted_printable_decode(string str)
- Convert a quoted-printable string to an 8 bit string */
-PHP_FUNCTION(quoted_printable_decode)
-{
- pval **arg1;
- char *str_in, *str_out;
- int i = 0, j = 0, k;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1,&arg1)==FAILURE)
- {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(arg1);
-
- if((*arg1)->value.str.len == 0) {
- /* shortcut */
- RETURN_EMPTY_STRING();
- }
-
- str_in = (*arg1)->value.str.val;
- str_out = emalloc((*arg1)->value.str.len+1);
- while ( str_in[i] )
- {
- switch (str_in[i])
- {
- case '=':
- if (str_in[i+1] && str_in[i+2] &&
- isxdigit((int)str_in[i+1]) &&
- isxdigit((int)str_in[i+1]) )
- {
- str_out[j++] = (php_hex2int((int)str_in[i+1]) << 4 )
- + php_hex2int((int)str_in[i+2]);
- i += 3;
- }
- else /* check for soft line break according to RFC 2045*/
- {
- k = 1;
- while ( str_in[i+k] && ((str_in[i+k] == 32) || (str_in[i+k] == 9)) )
- {
- /* Possibly, skip spaces/tabs at the end of line */
- k++;
- }
- if (!str_in[i+k])
- {
- /* End of line reached */
- i += k;
- }
- else if ( (str_in[i+k] == 10) && (str_in[i+k+1] == 13))
- {
- /* CRLF */
- i += k+2;
- }
- else if ( (str_in[i+k] == 13) || (str_in[i+k] == 10) )
- {
- /* CR or LF */
- i += k+1;
- }
- else
- {
- str_out[j++] = str_in[i++];
- }
- }
- break;
- default:
- str_out[j++] = str_in[i++];
- }
- }
- str_out[j] = '\0';
-
- RETVAL_STRINGL(str_out, j, 0);
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/standard/quot_print.h b/ext/standard/quot_print.h
deleted file mode 100644
index 79f9f871b9..0000000000
--- a/ext/standard/quot_print.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Kirill Maximov (kir@rus.net) |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef QUOT_PRINT_H
-#define QUOT_PRINT_H
-
-PHP_FUNCTION(quoted_printable_decode);
-
-#endif /* QUOT_PRINT_H */
diff --git a/ext/standard/rand.c b/ext/standard/rand.c
deleted file mode 100644
index 72227af0fd..0000000000
--- a/ext/standard/rand.c
+++ /dev/null
@@ -1,358 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
- | Zeev Suraski <zeev@zend.com> |
- | Pedro Melo <melo@ip.pt> |
- | |
- | Based on code from: Shawn Cokus <Cokus@math.washington.edu> |
- +----------------------------------------------------------------------+
- */
-/* $Id$ */
-
-#include <stdlib.h>
-
-#include "php.h"
-#include "php_math.h"
-#include "php_rand.h"
-
-#include "basic_functions.h"
-
-/*
- This is the ``Mersenne Twister'' random number generator MT19937, which
- generates pseudorandom integers uniformly distributed in 0..(2^32 - 1)
- starting from any odd seed in 0..(2^32 - 1). This version is a recode
- by Shawn Cokus (Cokus@math.washington.edu) on March 8, 1998 of a version by
- Takuji Nishimura (who had suggestions from Topher Cooper and Marc Rieffel in
- July-August 1997).
-
- Effectiveness of the recoding (on Goedel2.math.washington.edu, a DEC Alpha
- running OSF/1) using GCC -O3 as a compiler: before recoding: 51.6 sec. to
- generate 300 million random numbers; after recoding: 24.0 sec. for the same
- (i.e., 46.5% of original time), so speed is now about 12.5 million random
- number generations per second on this machine.
-
- According to the URL <http://www.math.keio.ac.jp/~matumoto/emt.html>
- (and paraphrasing a bit in places), the Mersenne Twister is ``designed
- with consideration of the flaws of various existing generators,'' has
- a period of 2^19937 - 1, gives a sequence that is 623-dimensionally
- equidistributed, and ``has passed many stringent tests, including the
- die-hard test of G. Marsaglia and the load test of P. Hellekalek and
- S. Wegenkittl.'' It is efficient in memory usage (typically using 2506
- to 5012 bytes of static data, depending on data type sizes, and the code
- is quite short as well). It generates random numbers in batches of 624
- at a time, so the caching and pipelining of modern systems is exploited.
- It is also divide- and mod-free.
-
- This library is free software; you can redistribute it and/or modify it
- under the terms of the GNU Library General Public License as published by
- the Free Software Foundation (either version 2 of the License or, at your
- option, any later version). This library is distributed in the hope that
- it will be useful, but WITHOUT ANY WARRANTY, without even the implied
- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
- the GNU Library General Public License for more details. You should have
- received a copy of the GNU Library General Public License along with this
- library; if not, write to the Free Software Foundation, Inc., 59 Temple
- Place, Suite 330, Boston, MA 02111-1307, USA.
-
- The code as Shawn received it included the following notice:
-
- Copyright (C) 1997 Makoto Matsumoto and Takuji Nishimura. When
- you use this, send an e-mail to <matumoto@math.keio.ac.jp> with
- an appropriate reference to your work.
-
- It would be nice to CC: <Cokus@math.washington.edu> when you write.
-
-
-
- php_uint32 must be an unsigned integer type capable of holding at least 32
- bits; exactly 32 should be fastest, but 64 is better on an Alpha with
- GCC at -O3 optimization so try your options and see what's best for you
-
- Melo: we should put some ifdefs here to catch those alphas...
-*/
-
-
-#define N MT_N /* length of state vector */
-#define M (397) /* a period parameter */
-#define K (0x9908B0DFU) /* a magic constant */
-#define hiBit(u) ((u) & 0x80000000U) /* mask all but highest bit of u */
-#define loBit(u) ((u) & 0x00000001U) /* mask all but lowest bit of u */
-#define loBits(u) ((u) & 0x7FFFFFFFU) /* mask the highest bit of u */
-#define mixBits(u, v) (hiBit(u)|loBits(v)) /* move hi bit of u to hi bit of v */
-
-#define MT_RAND_MAX ((long)(0x7FFFFFFF)) /* (1<<31) - 1 */
-
-/* {{{ seedMT
- */
-static void seedMT(php_uint32 seed BLS_DC)
-{
- /*
- We initialize state[0..(N-1)] via the generator
-
- x_new = (69069 * x_old) mod 2^32
-
- from Line 15 of Table 1, p. 106, Sec. 3.3.4 of Knuth's
- _The Art of Computer Programming_, Volume 2, 3rd ed.
-
- Notes (SJC): I do not know what the initial state requirements
- of the Mersenne Twister are, but it seems this seeding generator
- could be better. It achieves the maximum period for its modulus
- (2^30) iff x_initial is odd (p. 20-21, Sec. 3.2.1.2, Knuth); if
- x_initial can be even, you have sequences like 0, 0, 0, ...;
- 2^31, 2^31, 2^31, ...; 2^30, 2^30, 2^30, ...; 2^29, 2^29 + 2^31,
- 2^29, 2^29 + 2^31, ..., etc. so I force seed to be odd below.
-
- Even if x_initial is odd, if x_initial is 1 mod 4 then
-
- the lowest bit of x is always 1,
- the next-to-lowest bit of x is always 0,
- the 2nd-from-lowest bit of x alternates ... 0 1 0 1 0 1 0 1 ... ,
- the 3rd-from-lowest bit of x 4-cycles ... 0 1 1 0 0 1 1 0 ... ,
- the 4th-from-lowest bit of x has the 8-cycle ... 0 0 0 1 1 1 1 0 ... ,
- ...
-
- and if x_initial is 3 mod 4 then
-
- the lowest bit of x is always 1,
- the next-to-lowest bit of x is always 1,
- the 2nd-from-lowest bit of x alternates ... 0 1 0 1 0 1 0 1 ... ,
- the 3rd-from-lowest bit of x 4-cycles ... 0 0 1 1 0 0 1 1 ... ,
- the 4th-from-lowest bit of x has the 8-cycle ... 0 0 1 1 1 1 0 0 ... ,
- ...
-
- The generator's potency (min. s>=0 with (69069-1)^s = 0 mod 2^32) is
- 16, which seems to be alright by p. 25, Sec. 3.2.1.3 of Knuth. It
- also does well in the dimension 2..5 spectral tests, but it could be
- better in dimension 6 (Line 15, Table 1, p. 106, Sec. 3.3.4, Knuth).
-
- Note that the random number user does not see the values generated
- here directly since reloadMT() will always munge them first, so maybe
- none of all of this matters. In fact, the seed values made here could
- even be extra-special desirable if the Mersenne Twister theory says
- so-- that's why the only change I made is to restrict to odd seeds.
- */
-
- register php_uint32 x = (seed | 1U) & 0xFFFFFFFFU, *s = BG(state);
- register int j;
-
- for(BG(left)=0, *s++=x, j=N; --j;
- *s++ = (x*=69069U) & 0xFFFFFFFFU);
-}
-/* }}} */
-
-static php_uint32 reloadMT(BLS_D)
-{
- register php_uint32 *p0=BG(state), *p2=BG(state)+2, *pM=BG(state)+M, s0, s1;
- register int j;
-
- if(BG(left) < -1)
- seedMT(4357U BLS_CC);
-
- BG(left)=N-1, BG(next)=BG(state)+1;
-
- for(s0=BG(state)[0], s1=BG(state)[1], j=N-M+1; --j; s0=s1, s1=*p2++)
- *p0++ = *pM++ ^ (mixBits(s0, s1) >> 1) ^ (loBit(s1) ? K : 0U);
-
- for(pM=BG(state), j=M; --j; s0=s1, s1=*p2++)
- *p0++ = *pM++ ^ (mixBits(s0, s1) >> 1) ^ (loBit(s1) ? K : 0U);
-
- s1=BG(state)[0], *p0 = *pM ^ (mixBits(s0, s1) >> 1) ^ (loBit(s1) ? K : 0U);
- s1 ^= (s1 >> 11);
- s1 ^= (s1 << 7) & 0x9D2C5680U;
- s1 ^= (s1 << 15) & 0xEFC60000U;
- return(s1 ^ (s1 >> 18));
-}
-
-
-static inline php_uint32 randomMT(void)
-{
- php_uint32 y;
- BLS_FETCH();
-
- if(--BG(left) < 0)
- return(reloadMT(BLS_C));
-
- y = *BG(next)++;
- y ^= (y >> 11);
- y ^= (y << 7) & 0x9D2C5680U;
- y ^= (y << 15) & 0xEFC60000U;
- return(y ^ (y >> 18));
-}
-
-/* {{{ proto void srand(int seed)
- Seeds random number generator */
-PHP_FUNCTION(srand)
-{
- pval **arg;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(arg);
- php_srand((*arg)->value.lval);
-}
-/* }}} */
-
-/* {{{ proto void mt_srand(int seed)
- Seeds Mersenne Twister random number generator */
-PHP_FUNCTION(mt_srand)
-{
- pval **arg;
- BLS_FETCH();
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(arg);
- seedMT((*arg)->value.lval BLS_CC);
-}
-/* }}} */
-
-/* {{{ proto int rand([int min, int max])
- Returns a random number */
-PHP_FUNCTION(rand)
-{
- pval **p_min=NULL, **p_max=NULL;
-
- switch (ZEND_NUM_ARGS()) {
- case 0:
- break;
- case 2:
- if (zend_get_parameters_ex(2, &p_min, &p_max)==FAILURE) {
- RETURN_FALSE;
- }
- convert_to_long_ex(p_min);
- convert_to_long_ex(p_max);
- if ((*p_max)->value.lval-(*p_min)->value.lval < 0) {
- php_error(E_WARNING,"rand(): Invalid range: %ld..%ld", (*p_min)->value.lval, (*p_max)->value.lval);
- }else if ((*p_max)->value.lval-(*p_min)->value.lval > PHP_RAND_MAX){
- php3_error(E_WARNING,"rand(): Invalid range: %ld..%ld", (*p_min)->value.lval, (*p_max)->value.lval);
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- return_value->type = IS_LONG;
-
- return_value->value.lval = php_rand();
-
- /*
- * A bit of tricky math here. We want to avoid using a modulus because
- * that simply tosses the high-order bits and might skew the distribution
- * of random values over the range. Instead we map the range directly.
- *
- * We need to map the range from 0...M evenly to the range a...b
- * Let n = the random number and n' = the mapped random number
- *
- * Then we have: n' = a + n(b-a)/M
- *
- * We have a problem here in that only n==M will get mapped to b which
- # means the chances of getting b is much much less than getting any of
- # the other values in the range. We can fix this by increasing our range
- # artifically and using:
- #
- # n' = a + n(b-a+1)/M
- *
- # Now we only have a problem if n==M which would cause us to produce a
- # number of b+1 which would be bad. So we bump M up by one to make sure
- # this will never happen, and the final algorithm looks like this:
- #
- # n' = a + n(b-a+1)/(M+1)
- *
- * -RL
- */
- if (p_min && p_max) { /* implement range */
- return_value->value.lval = (*p_min)->value.lval +
- (int)((double)((*p_max)->value.lval - (*p_min)->value.lval + 1.0) * return_value->value.lval/(PHP_RAND_MAX+1.0));
- }
-}
-/* }}} */
-
-/* {{{ proto int mt_rand([int min, int max])
- Returns a random number from Mersenne Twister */
-PHP_FUNCTION(mt_rand)
-{
- pval **p_min=NULL, **p_max=NULL;
-
- switch (ZEND_NUM_ARGS()) {
- case 0:
- break;
- case 2:
- if (zend_get_parameters_ex(2, &p_min, &p_max)==FAILURE) {
- RETURN_FALSE;
- }
- convert_to_long_ex(p_min);
- convert_to_long_ex(p_max);
- if ((*p_max)->value.lval-(*p_min)->value.lval <= 0) {
- php_error(E_WARNING,"mt_rand(): Invalid range: %ld..%ld", (*p_min)->value.lval, (*p_max)->value.lval);
- }else if ((*p_max)->value.lval-(*p_min)->value.lval > MT_RAND_MAX){
- php3_error(E_WARNING,"mt_rand(): Invalid range: %ld..%ld",(*p_min)->value.lval, (*p_max)->value.lval);
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- return_value->type = IS_LONG;
- /*
- * Melo: hmms.. randomMT() returns 32 random bits...
- * Yet, the previous php_rand only returns 31 at most.
- * So I put a right shift to loose the lsb. It *seems*
- * better than clearing the msb.
- * Update:
- * I talked with Cokus via email and it won't ruin the algorithm
- */
- return_value->value.lval = (long)(randomMT() >> 1);
-
- if (p_min && p_max) { /* implement range */
- return_value->value.lval = (*p_min)->value.lval +
- (long)((double)((*p_max)->value.lval - (*p_min)->value.lval + 1.0) * return_value->value.lval/(MT_RAND_MAX+1.0));
- }
-}
-/* }}} */
-
-/* {{{ proto int getrandmax(void)
- Returns the maximum value a random number can have */
-PHP_FUNCTION(getrandmax)
-{
- return_value->type = IS_LONG;
- return_value->value.lval = PHP_RAND_MAX;
-}
-/* }}} */
-
-/* {{{ proto int mt_getrandmax(void)
- Returns the maximum value a random number from Mersenne Twister can have */
-PHP_FUNCTION(mt_getrandmax)
-{
- return_value->type = IS_LONG;
- /*
- * Melo: it could be 2^^32 but we only use 2^^31 to maintain
- * compatibility with the previous php_rand
- */
- return_value->value.lval = MT_RAND_MAX; /* 2^^31 */
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/standard/reg.c b/ext/standard/reg.c
deleted file mode 100644
index bcd0111b8a..0000000000
--- a/ext/standard/reg.c
+++ /dev/null
@@ -1,670 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
- | Jim Winstead <jimw@php.net> |
- | Jaakko Hyvätti <jaakko@hyvatti.iki.fi> |
- +----------------------------------------------------------------------+
- */
-/* $Id$ */
-
-#include <stdio.h>
-#include "php.h"
-#include "php_string.h"
-#include "reg.h"
-#include "ext/standard/info.h"
-
-#if 0
-zend_module_entry regexp_module_entry = {
- "Regular Expressions",
- reg_functions,
- PHP_MINIT(regex), PHP_MSHUTDOWN(regex),
- NULL, NULL, PHP_MINFO(regex),
- STANDARD_MODULE_PROPERTIES
-};
-#endif
-
-#ifdef ZTS
-int reg_globals_id;
-#else
-static php_reg_globals reg_globals;
-#endif
-
-typedef struct {
- regex_t preg;
- int cflags;
-} reg_cache;
-
-/* {{{ _php_regcomp
- */
-static int _php_regcomp(regex_t *preg, const char *pattern, int cflags)
-{
- int r = 0;
- int patlen = strlen(pattern);
- reg_cache *rc = NULL;
- REGLS_FETCH();
-
- if(zend_hash_find(&REG(ht_rc), (char *) pattern, patlen+1, (void **) &rc) == FAILURE ||
- rc->cflags != cflags) {
- r = regcomp(preg, pattern, cflags);
- if(!r) {
- reg_cache rcp;
-
- rcp.cflags = cflags;
- memcpy(&rcp.preg, preg, sizeof(*preg));
- zend_hash_update(&REG(ht_rc), (char *) pattern, patlen+1,
- (void *) &rcp, sizeof(rcp), NULL);
- }
- } else {
- memcpy(preg, &rc->preg, sizeof(*preg));
- }
-
- return r;
-}
-/* }}} */
-
-static void _free_reg_cache(reg_cache *rc)
-{
- regfree(&rc->preg);
-}
-
-#undef regfree
-#define regfree(a);
-#undef regcomp
-#define regcomp(a,b,c) _php_regcomp(a,b,c)
-
-static void php_reg_init_globals(php_reg_globals *reg_globals)
-{
- zend_hash_init(&reg_globals->ht_rc, 0, NULL, (void (*)(void *)) _free_reg_cache, 1);
-}
-
-PHP_MINIT_FUNCTION(regex)
-{
-#ifdef ZTS
- reg_globals_id = ts_allocate_id(sizeof(php_reg_globals), (ts_allocate_ctor) php_reg_init_globals, NULL);
-#else
- php_reg_init_globals(&reg_globals);
-#endif
-
- return SUCCESS;
-}
-
-PHP_MSHUTDOWN_FUNCTION(regex)
-{
- REGLS_FETCH();
-
- zend_hash_destroy(&REG(ht_rc));
- return SUCCESS;
-}
-
-PHP_MINFO_FUNCTION(regex)
-{
-#if HSREGEX
- php_info_print_table_row(2, "Regex Library", "Bundled library enabled");
-#else
- php_info_print_table_row(2, "Regex Library", "System library enabled");
-#endif
-}
-
-
-/* This is the maximum number of (..) constructs we'll generate from a
- call to ereg() or eregi() with the optional third argument. */
-#define NS 10
-
-/* {{{ php_reg_eprint
- * php_reg_eprint - convert error number to name
- */
-static void php_reg_eprint(int err, regex_t *re) {
- char *buf = NULL, *message = NULL;
- size_t len;
- size_t buf_len;
-
-#ifdef REG_ITOA
- /* get the length of the message */
- buf_len = regerror(REG_ITOA | err, re, NULL, 0);
- if (buf_len) {
- buf = (char *)emalloc(buf_len * sizeof(char));
- if (!buf) return; /* fail silently */
- /* finally, get the error message */
- regerror(REG_ITOA | err, re, buf, buf_len);
- }
-#else
- buf_len = 0;
-#endif
- len = regerror(err, re, NULL, 0);
- if (len) {
- message = (char *)emalloc((buf_len + len + 2) * sizeof(char));
- if (!message) {
- return; /* fail silently */
- }
- if (buf_len) {
- snprintf(message, buf_len, "%s: ", buf);
- buf_len += 1; /* so pointer math below works */
- }
- /* drop the message into place */
- regerror(err, re, message + buf_len, len);
-
- php_error(E_WARNING, "%s", message);
- }
-
- STR_FREE(buf);
- STR_FREE(message);
-}
-/* }}} */
-
-/* {{{ php_ereg
- */
-static void php_ereg(INTERNAL_FUNCTION_PARAMETERS, int icase)
-{
- pval **regex, /* Regular expression */
- **findin, /* String to apply expression to */
- **array = NULL; /* Optional register array */
- regex_t re;
- regmatch_t subs[NS];
- int err, i, match_len, string_len;
- int copts = 0;
- off_t start, end;
- char *buf = NULL;
- char *string = NULL;
-
- if (icase)
- copts |= REG_ICASE;
-
- switch(ZEND_NUM_ARGS()) {
- case 2:
- if (zend_get_parameters_ex(2, &regex, &findin) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- /* don't bother doing substring matching if we're not going
- to make use of the information */
- copts |= REG_NOSUB;
- break;
- case 3:
- if (zend_get_parameters_ex(3, &regex, &findin, &array) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- if (!ParameterPassedByReference(ht, 3)) {
- php_error(E_WARNING, "Array to be filled with values must be passed by reference.");
- RETURN_FALSE;
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- }
-
-
- /* compile the regular expression from the supplied regex */
- if ((*regex)->type == IS_STRING) {
- err = regcomp(&re, (*regex)->value.str.val, REG_EXTENDED | copts);
- } else {
- /* we convert numbers to integers and treat them as a string */
- if ((*regex)->type == IS_DOUBLE)
- convert_to_long_ex(regex); /* get rid of decimal places */
- convert_to_string_ex(regex);
- /* don't bother doing an extended regex with just a number */
- err = regcomp(&re, (*regex)->value.str.val, copts);
- }
-
- if (err) {
- php_reg_eprint(err, &re);
- RETURN_FALSE;
- }
-
- /* make a copy of the string we're looking in */
- convert_to_string_ex(findin);
- string = estrndup((*findin)->value.str.val, (*findin)->value.str.len);
-
- /* actually execute the regular expression */
- err = regexec(&re, string, (size_t) NS, subs, 0);
- if (err && err != REG_NOMATCH) {
- php_reg_eprint(err, &re);
- regfree(&re);
- RETURN_FALSE;
- }
- match_len = 1;
-
- if (array && err != REG_NOMATCH) {
- match_len = (int) (subs[0].rm_eo - subs[0].rm_so);
- string_len = strlen(string) + 1;
-
- buf = emalloc(string_len);
- if (!buf) {
- php_error(E_WARNING, "Unable to allocate memory in php_ereg");
- RETURN_FALSE;
- }
-
- pval_destructor(*array); /* start with clean array */
- array_init(*array);
-
- for (i = 0; i < NS; i++) {
- start = subs[i].rm_so;
- end = subs[i].rm_eo;
- if (start != -1 && end > 0 && start < string_len && end < string_len && start < end) {
- add_index_stringl(*array, i, string+start, end-start, 1);
- } else {
- add_index_bool(*array, i, 0);
- }
- }
- efree(buf);
- }
-
- efree(string);
- if (err == REG_NOMATCH) {
- RETVAL_FALSE;
- } else {
- if (match_len == 0)
- match_len = 1;
- RETVAL_LONG(match_len);
- }
- regfree(&re);
-}
-/* }}} */
-
-/* {{{ proto int ereg(string pattern, string string [, array registers])
- Regular expression match */
-PHP_FUNCTION(ereg)
-{
- php_ereg(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-/* }}} */
-
-/* {{{ proto int eregi(string pattern, string string [, array registers])
- Case-insensitive regular expression match */
-PHP_FUNCTION(eregi)
-{
- php_ereg(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
-}
-/* }}} */
-
-/* {{{ php_reg_replace
- * this is the meat and potatoes of regex replacement! */
-char *php_reg_replace(const char *pattern, const char *replace, const char *string, int icase, int extended)
-{
- regex_t re;
- regmatch_t subs[NS];
-
- char *buf, /* buf is where we build the replaced string */
- *nbuf, /* nbuf is used when we grow the buffer */
- *walkbuf; /* used to walk buf when replacing backrefs */
- const char *walk; /* used to walk replacement string for backrefs */
- int buf_len;
- int pos, tmp, string_len, new_l;
- int err, copts = 0;
-
- string_len = strlen(string);
-
- if (icase)
- copts = REG_ICASE;
- if (extended)
- copts |= REG_EXTENDED;
- err = regcomp(&re, pattern, copts);
- if (err) {
- php_reg_eprint(err, &re);
- return ((char *) -1);
- }
-
- /* start with a buffer that is twice the size of the stringo
- we're doing replacements in */
- buf_len = 2 * string_len + 1;
- buf = emalloc(buf_len * sizeof(char));
- if (!buf) {
- php_error(E_WARNING, "Unable to allocate memory in php_reg_replace");
- regfree(&re);
- return ((char *) -1);
- }
-
- err = pos = 0;
- buf[0] = '\0';
-
- while (!err) {
- err = regexec(&re, &string[pos], (size_t) NS, subs, (pos ? REG_NOTBOL : 0));
-
- if (err && err != REG_NOMATCH) {
- php_reg_eprint(err, &re);
- regfree(&re);
- return ((char *) -1);
- }
- if (!err) {
- /* backref replacement is done in two passes:
- 1) find out how long the string will be, and allocate buf
- 2) copy the part before match, replacement and backrefs to buf
-
- Jaakko Hyvätti <Jaakko.Hyvatti@iki.fi>
- */
-
- new_l = strlen(buf) + subs[0].rm_so; /* part before the match */
- walk = replace;
- while (*walk)
- if ('\\' == *walk
- && '0' <= walk[1] && '9' >= walk[1]
- && subs[walk[1] - '0'].rm_so > -1
- && subs[walk[1] - '0'].rm_eo > -1) {
- new_l += subs[walk[1] - '0'].rm_eo
- - subs[walk[1] - '0'].rm_so;
- walk += 2;
- } else {
- new_l++;
- walk++;
- }
-
- if (new_l + 1 > buf_len) {
- buf_len = 1 + buf_len + 2 * new_l;
- nbuf = emalloc(buf_len);
- strcpy(nbuf, buf);
- efree(buf);
- buf = nbuf;
- }
- tmp = strlen(buf);
- /* copy the part of the string before the match */
- strncat(buf, &string[pos], subs[0].rm_so);
-
- /* copy replacement and backrefs */
- walkbuf = &buf[tmp + subs[0].rm_so];
- walk = replace;
- while (*walk)
- if ('\\' == *walk
- && '0' <= walk[1] && '9' >= walk[1]
- && subs[walk[1] - '0'].rm_so > -1
- && subs[walk[1] - '0'].rm_eo > -1) {
- tmp = subs[walk[1] - '0'].rm_eo
- - subs[walk[1] - '0'].rm_so;
- memcpy (walkbuf,
- &string[pos + subs[walk[1] - '0'].rm_so],
- tmp);
- walkbuf += tmp;
- walk += 2;
- } else
- *walkbuf++ = *walk++;
- *walkbuf = '\0';
-
- /* and get ready to keep looking for replacements */
- if (subs[0].rm_so == subs[0].rm_eo) {
- if (subs[0].rm_so + pos >= string_len)
- break;
- new_l = strlen (buf) + 1;
- if (new_l + 1 > buf_len) {
- buf_len = 1 + buf_len + 2 * new_l;
- nbuf = emalloc(buf_len * sizeof(char));
- strcpy(nbuf, buf);
- efree(buf);
- buf = nbuf;
- }
- pos += subs[0].rm_eo + 1;
- buf [new_l-1] = string [pos-1];
- buf [new_l] = '\0';
- } else {
- pos += subs[0].rm_eo;
- }
- } else { /* REG_NOMATCH */
- new_l = strlen(buf) + strlen(&string[pos]);
- if (new_l + 1 > buf_len) {
- buf_len = new_l + 1; /* now we know exactly how long it is */
- nbuf = emalloc(buf_len * sizeof(char));
- strcpy(nbuf, buf);
- efree(buf);
- buf = nbuf;
- }
- /* stick that last bit of string on our output */
- strcat(buf, &string[pos]);
- }
- }
-
- /* don't want to leak memory .. */
- regfree(&re);
-
- /* whew. */
- return (buf);
-}
-/* }}} */
-
-/* {{{ php_ereg_replace
- */
-static void php_ereg_replace(INTERNAL_FUNCTION_PARAMETERS, int icase)
-{
- pval **arg_pattern,
- **arg_replace,
- **arg_string;
- char *pattern;
- char *string;
- char *replace;
- char *ret;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &arg_pattern, &arg_replace, &arg_string) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if ((*arg_pattern)->type == IS_STRING) {
- if ((*arg_pattern)->value.str.val && (*arg_pattern)->value.str.len)
- pattern = estrndup((*arg_pattern)->value.str.val,(*arg_pattern)->value.str.len);
- else
- pattern = empty_string;
- } else {
- convert_to_long_ex(arg_pattern);
- pattern = emalloc(2);
- pattern[0] = (char) (*arg_pattern)->value.lval;
- pattern[1] = '\0';
- }
-
- if ((*arg_replace)->type == IS_STRING) {
- if ((*arg_replace)->value.str.val && (*arg_replace)->value.str.len)
- replace = estrndup((*arg_replace)->value.str.val, (*arg_replace)->value.str.len);
- else
- replace = empty_string;
- } else {
- convert_to_long_ex(arg_replace);
- replace = emalloc(2);
- replace[0] = (char) (*arg_replace)->value.lval;
- replace[1] = '\0';
- }
-
- convert_to_string_ex(arg_string);
- if ((*arg_string)->value.str.val && (*arg_string)->value.str.len)
- string = estrndup((*arg_string)->value.str.val, (*arg_string)->value.str.len);
- else
- string = empty_string;
-
- /* do the actual work */
- ret = php_reg_replace(pattern, replace, string, icase, 1);
- if (ret == (char *) -1) {
- RETVAL_FALSE;
- } else {
- RETVAL_STRING(ret,1);
- STR_FREE(ret);
- }
- STR_FREE(string);
- STR_FREE(replace);
- STR_FREE(pattern);
-}
-/* }}} */
-
-/* {{{ proto string ereg_replace(string pattern, string replacement, string string)
- Replace regular expression */
-PHP_FUNCTION(ereg_replace)
-{
- php_ereg_replace(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-/* }}} */
-
-/* {{{ proto string eregi_replace(string pattern, string replacement, string string)
- Case insensitive replace regular expression */
-PHP_FUNCTION(eregi_replace)
-{
- php_ereg_replace(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
-}
-/* }}} */
-
-/* {{{ php_split
- */
-static void php_split(INTERNAL_FUNCTION_PARAMETERS, int icase)
-{
- pval **spliton, **str, **arg_count = NULL;
- regex_t re;
- regmatch_t subs[1];
- char *strp, *endp;
- int err, size, count, copts = 0;
-
- if (icase)
- copts = REG_ICASE;
-
- switch (ZEND_NUM_ARGS()) {
- case 2:
- if (zend_get_parameters_ex(2, &spliton, &str) == FAILURE)
- WRONG_PARAM_COUNT;
- count = -1;
- break;
- case 3:
- if (zend_get_parameters_ex(3, &spliton, &str, &arg_count) == FAILURE)
- WRONG_PARAM_COUNT;
- convert_to_long_ex(arg_count);
- count = (*arg_count)->value.lval;
- break;
- default:
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(spliton);
- convert_to_string_ex(str);
-
- strp = (*str)->value.str.val;
- endp = (*str)->value.str.val + strlen((*str)->value.str.val);
-
- err = regcomp(&re, (*spliton)->value.str.val, REG_EXTENDED | copts);
- if (err) {
- php_error(E_WARNING, "unexpected regex error (%d)", err);
- RETURN_FALSE;
- }
-
- if (array_init(return_value) == FAILURE) {
- regfree(&re);
- RETURN_FALSE;
- }
-
- /* churn through str, generating array entries as we go */
- while ((count == -1 || count > 1) && !(err = regexec(&re, strp, 1, subs, 0))) {
- if (subs[0].rm_so == 0 && subs[0].rm_eo) {
- /* match is at start of string, return empty string */
- add_next_index_stringl(return_value, empty_string, 0, 1);
- /* skip ahead the length of the regex match */
- strp+=subs[0].rm_eo;
- } else if (subs[0].rm_so==0 && subs[0].rm_eo==0) {
- /* No more matches */
- regfree(&re);
- php_error(E_WARNING, "bad regular expression for split()");
- zend_hash_destroy(return_value->value.ht);
- efree(return_value->value.ht);
- RETURN_FALSE;
- } else {
- /* On a real match */
-
- /* make a copy of the substring */
- size = subs[0].rm_so;
-
- /* add it to the array */
- add_next_index_stringl(return_value, strp, size, 1);
-
- /* point at our new starting point */
- strp = strp + subs[0].rm_eo;
- }
-
- /* if we're only looking for a certain number of points,
- stop looking once we hit it */
- if (count != -1) {
- count--;
- }
- }
-
- /* see if we encountered an error */
- if (err && err != REG_NOMATCH) {
- php_error(E_WARNING, "unexpected regex error (%d)", err);
- regfree(&re);
- zend_hash_destroy(return_value->value.ht);
- efree(return_value->value.ht);
- RETURN_FALSE;
- }
-
- /* otherwise we just have one last element to add to the array */
- size = endp - strp;
-
- add_next_index_stringl(return_value, strp, size, 1);
-
- regfree(&re);
-}
-/* }}} */
-
-/* ("root", "passwd", "uid", "gid", "other:stuff:like:/bin/sh")
- = split(":", $passwd_file, 5); */
-/* {{{ proto array split(string pattern, string string [, int limit])
- Split string into array by regular expression */
-
-PHP_FUNCTION(split)
-{
- php_split(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-
-/* }}} */
-
-/* {{{ proto array spliti(string pattern, string string [, int limit])
- Split string into array by regular expression case-insensitive */
-
-PHP_FUNCTION(spliti)
-{
- php_split(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
-}
-
-/* }}} */
-
-/* {{{ proto string sql_regcase(string string)
- Make regular expression for case insensitive match */
-PHPAPI PHP_FUNCTION(sql_regcase)
-{
- pval **string;
- char *tmp;
- unsigned char c;
- register int i, j;
-
- if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &string)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(string);
-
- tmp = (char *) emalloc((*string)->value.str.len*4+1);
-
- for (i=j=0; i<(*string)->value.str.len; i++) {
- c = (unsigned char) (*string)->value.str.val[i];
- if(isalpha(c)) {
- tmp[j++] = '[';
- tmp[j++] = toupper(c);
- tmp[j++] = tolower(c);
- tmp[j++] = ']';
- } else {
- tmp[j++] = c;
- }
- }
- tmp[j]=0;
-
- tmp = erealloc(tmp, j + 1);
-
- RETVAL_STRINGL(tmp, j, 0);
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/standard/reg.h b/ext/standard/reg.h
deleted file mode 100644
index cb34b15e7c..0000000000
--- a/ext/standard/reg.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
- +----------------------------------------------------------------------+
-*/
-
-
-/* $Id$ */
-
-#ifndef REG_H
-#define REG_H
-
-char *php_reg_replace(const char *pattern, const char *replace, const char *string, int icase, int extended);
-
-PHP_FUNCTION(ereg);
-PHP_FUNCTION(eregi);
-PHP_FUNCTION(eregi_replace);
-PHP_FUNCTION(ereg_replace);
-PHP_FUNCTION(split);
-PHP_FUNCTION(spliti);
-PHPAPI PHP_FUNCTION(sql_regcase);
-
-typedef struct {
- HashTable ht_rc;
-} php_reg_globals;
-
-PHP_MINIT_FUNCTION(regex);
-PHP_MSHUTDOWN_FUNCTION(regex);
-PHP_MINFO_FUNCTION(regex);
-
-
-#ifdef ZTS
-#define REGLS_D php_reg_globals *reg_globals
-#define REGLS_DC , REGLS_D
-#define REGLS_C reg_globals
-#define REGLS_CC , REGLS_C
-#define REG(v) (reg_globals->v)
-#define REGLS_FETCH() php_reg_globals *reg_globals = ts_resource(reg_globals_id)
-#else
-#define REGLS_D
-#define REGLS_DC
-#define REGLS_C
-#define REGLS_CC
-#define REG(v) (reg_globals.v)
-#define REGLS_FETCH()
-#endif
-
-#endif /* REG_H */
diff --git a/ext/standard/scanf.c b/ext/standard/scanf.c
deleted file mode 100644
index dd58d48c4a..0000000000
--- a/ext/standard/scanf.c
+++ /dev/null
@@ -1,1250 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: clayton collie <clcollie@mindspring.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-/*
- scanf.c --
-
- This file contains the base code which implements sscanf and by extension
- fscanf. Original code is from TCL8.3.0 and bears the following copyright
-
-
-
- This software is copyrighted by the Regents of the University of
- California, Sun Microsystems, Inc., Scriptics Corporation,
- and other parties. The following terms apply to all files associated
- with the software unless explicitly disclaimed in individual files.
-
- The authors hereby grant permission to use, copy, modify, distribute,
- and license this software and its documentation for any purpose, provided
- that existing copyright notices are retained in all copies and that this
- notice is included verbatim in any distributions. No written agreement,
- license, or royalty fee is required for any of the authorized uses.
- Modifications to this software may be copyrighted by their authors
- and need not follow the licensing terms described here, provided that
- the new terms are clearly indicated on the first page of each file where
- they apply.
-
- IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY
- FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
- ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY
- DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
-
- THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE
- IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE
- NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR
- MODIFICATIONS.
-
- GOVERNMENT USE: If you are acquiring this software on behalf of the
- U.S. government, the Government shall have only "Restricted Rights"
- in the software and related documentation as defined in the Federal
- Acquisition Regulations (FARs) in Clause 52.227.19 (c) (2). If you
- are acquiring the software on behalf of the Department of Defense, the
- software shall be classified as "Commercial Computer Software" and the
- Government shall have only "Restricted Rights" as defined in Clause
- 252.227-7013 (c) (1) of DFARs. Notwithstanding the foregoing, the
- authors grant the U.S. Government and others acting in its behalf
- permission to use and distribute the software in accordance with the
- terms specified in this license.
-
- */
-
-#include <stdio.h>
-#include <limits.h>
-#include <ctype.h>
-#include "php.h"
-#include "php_variables.h"
-#ifdef HAVE_LOCALE_H
-#include <locale.h>
-#endif
-#include "zend_execute.h"
-#include "zend_operators.h"
-#include "php_globals.h"
-#include "basic_functions.h"
-#include "scanf.h"
-
-/*
- * Flag values used internally by [f|s]canf.
- */
-
-#define SCAN_NOSKIP 0x1 /* Don't skip blanks. */
-#define SCAN_SUPPRESS 0x2 /* Suppress assignment. */
-#define SCAN_UNSIGNED 0x4 /* Read an unsigned value. */
-#define SCAN_WIDTH 0x8 /* A width value was supplied. */
-
-#define SCAN_SIGNOK 0x10 /* A +/- character is allowed. */
-#define SCAN_NODIGITS 0x20 /* No digits have been scanned. */
-#define SCAN_NOZERO 0x40 /* No zero digits have been scanned. */
-#define SCAN_XOK 0x80 /* An 'x' is allowed. */
-#define SCAN_PTOK 0x100 /* Decimal point is allowed. */
-#define SCAN_EXPOK 0x200 /* An exponent is allowed. */
-
-#define UCHAR(x) (zend_uchar)(x)
-
-
-
-/*
- * The following structure contains the information associated with
- * a character set.
- */
-
-typedef struct CharSet {
- int exclude; /* 1 if this is an exclusion set. */
- int nchars;
- char *chars;
- int nranges;
- struct Range {
- char start;
- char end;
- } *ranges;
-} CharSet;
-
-/*
- * Declarations for functions used only in this file.
- */
-
-static char *BuildCharSet(CharSet *cset, char *format);
-static int CharInSet(CharSet *cset, int ch);
-static void ReleaseCharSet(CharSet *cset);
-
-
-/* {{{ BuildCharSet
- *----------------------------------------------------------------------
- *
- * BuildCharSet --
- *
- * This function examines a character set format specification
- * and builds a CharSet containing the individual characters and
- * character ranges specified.
- *
- * Results:
- * Returns the next format position.
- *
- * Side effects:
- * Initializes the charset.
- *
- *----------------------------------------------------------------------
- */
-static char * BuildCharSet(CharSet *cset, char *format)
-{
- char *ch, start;
- int nranges;
- char *end;
-
- memset(cset, 0, sizeof(CharSet));
-
- ch = format;
- if (*ch == '^') {
- cset->exclude = 1;
- ch = ++format;
- }
- end = format + 1; /* verify this - cc */
-
- /*
- * Find the close bracket so we can overallocate the set.
- */
-
- if (*ch == ']') {
- ch = end++;
- }
- nranges = 0;
- while (*ch != ']') {
- if (*ch == '-') {
- nranges++;
- }
- ch = end++;
- }
-
- cset->chars = (char *) emalloc(sizeof(char) * (end - format - 1));
- if (nranges > 0) {
- cset->ranges = (struct Range *) emalloc(sizeof(struct Range)*nranges);
- } else {
- cset->ranges = NULL;
- }
-
- /*
- * Now build the character set.
- */
-
- cset->nchars = cset->nranges = 0;
- ch = format++;
- start = *ch;
- if (*ch == ']' || *ch == '-') {
- cset->chars[cset->nchars++] = *ch;
- ch = format++;
- }
- while (*ch != ']') {
- if (*format == '-') {
- /*
- * This may be the first character of a range, so don't add
- * it yet.
- */
-
- start = *ch;
- } else if (*ch == '-') {
- /*
- * Check to see if this is the last character in the set, in which
- * case it is not a range and we should add the previous character
- * as well as the dash.
- */
-
- if (*format == ']') {
- cset->chars[cset->nchars++] = start;
- cset->chars[cset->nchars++] = *ch;
- } else {
- ch = format++;
-
- /*
- * Check to see if the range is in reverse order.
- */
-
- if (start < *ch) {
- cset->ranges[cset->nranges].start = start;
- cset->ranges[cset->nranges].end = *ch;
- } else {
- cset->ranges[cset->nranges].start = *ch;
- cset->ranges[cset->nranges].end = start;
- }
- cset->nranges++;
- }
- } else {
- cset->chars[cset->nchars++] = *ch;
- }
- ch = format++;
- }
- return format;
-}
-/* }}} */
-
-/* {{{ CharInSet
- *----------------------------------------------------------------------
- *
- * CharInSet --
- *
- * Check to see if a character matches the given set.
- *
- * Results:
- * Returns non-zero if the character matches the given set.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-static int CharInSet(CharSet *cset, int c)
-{
- char ch = (char) c;
- int i, match = 0;
-
- for (i = 0; i < cset->nchars; i++) {
- if (cset->chars[i] == ch) {
- match = 1;
- break;
- }
- }
- if (!match) {
- for (i = 0; i < cset->nranges; i++) {
- if ((cset->ranges[i].start <= ch)
- && (ch <= cset->ranges[i].end)) {
- match = 1;
- break;
- }
- }
- }
- return (cset->exclude ? !match : match);
-}
-/* }}} */
-
-/* {{{ ReleaseCharSet
- *----------------------------------------------------------------------
- *
- * ReleaseCharSet --
- *
- * Free the storage associated with a character set.
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-static void ReleaseCharSet(CharSet *cset)
-{
- efree((char *)cset->chars);
- if (cset->ranges) {
- efree((char *)cset->ranges);
- }
-}
-/* }}} */
-
-/* {{{ ValidateFormat
- *----------------------------------------------------------------------
- *
- * ValidateFormat --
- *
- * Parse the format string and verify that it is properly formed
- * and that there are exactly enough variables on the command line.
- *
- * Results:
- * FAILURE or SUCCESS.
- *
- * Side effects:
- * May set php_error based on abnormal conditions.
- *
- * Parameters :
- * format The format string.
- * numVars The number of variables passed to the scan command.
- * totalSubs The number of variables that will be required.
- *
- *----------------------------------------------------------------------
-*/
-PHPAPI int ValidateFormat(char *format,int numVars,int *totalSubs)
-{
-#define STATIC_LIST_SIZE 16
- int gotXpg, gotSequential, value, i, flags;
- char *end, *ch = NULL;
- int staticAssign[STATIC_LIST_SIZE];
- int *nassign = staticAssign;
- int objIndex, xpgSize, nspace = STATIC_LIST_SIZE;
-
- /*
- * Initialize an array that records the number of times a variable
- * is assigned to by the format string. We use this to detect if
- * a variable is multiply assigned or left unassigned.
- */
-
- if (numVars > nspace) {
- nassign = (int*)emalloc(sizeof(int) * numVars);
- nspace = numVars;
- }
- for (i = 0; i < nspace; i++) {
- nassign[i] = 0;
- }
-
- xpgSize = objIndex = gotXpg = gotSequential = 0;
-
- while (*format != '\0') {
- ch = format++;
- flags = 0;
-
- if (*ch != '%') {
- continue;
- }
- ch = format++;
- if (*ch == '%') {
- continue;
- }
- if (*ch == '*') {
- flags |= SCAN_SUPPRESS;
- ch = format++;
- goto xpgCheckDone;
- }
-
- if ( isdigit( (int)*ch ) ) {
- /*
- * Check for an XPG3-style %n$ specification. Note: there
- * must not be a mixture of XPG3 specs and non-XPG3 specs
- * in the same format string.
- */
-
- value = strtoul(format-1, &end, 10);
- if (*end != '$') {
- goto notXpg;
- }
- format = end+1;
- ch = format++;
- gotXpg = 1;
- if (gotSequential) {
- goto mixedXPG;
- }
- objIndex = value - 1;
- if ((objIndex < 0) || (numVars && (objIndex >= numVars))) {
- goto badIndex;
- } else if (numVars == 0) {
- /*
- * In the case where no vars are specified, the user can
- * specify %9999$ legally, so we have to consider special
- * rules for growing the assign array. 'value' is
- * guaranteed to be > 0.
- */
-
- /* set a lower artificial limit on this
- * in the interest of security and resource friendliness
- * 255 arguments should be more than enough. - cc
- */
- if (value > SCAN_MAX_ARGS) {
- goto badIndex;
- }
-
- xpgSize = (xpgSize > value) ? xpgSize : value;
- }
- goto xpgCheckDone;
- }
-
- notXpg:
- gotSequential = 1;
- if (gotXpg) {
- mixedXPG:
- php_error(E_WARNING,
- "cannot mix \"%\" and \"%n$\" conversion specifiers in %s", get_active_function_name() );
- goto error;
- }
-
- xpgCheckDone:
- /*
- * Parse any width specifier.
- */
-
- if (isdigit(UCHAR(*ch))) {
- value = strtoul(format-1, &format, 10);
- flags |= SCAN_WIDTH;
- ch = format++;
- }
-
- /*
- * Ignore size specifier.
- */
-
- if ((*ch == 'l') || (*ch == 'L') || (*ch == 'h')) {
- ch = format++;
- }
-
- if (!(flags & SCAN_SUPPRESS) && numVars && (objIndex >= numVars)) {
- goto badIndex;
- }
-
- /*
- * Handle the various field types.
- */
-
- switch (*ch) {
- case 'n':
- case 'd':
- case 'D':
- case 'i':
- case 'o':
- case 'x':
- case 'X':
- case 'u':
- case 'f':
- case 'e':
- case 'E':
- case 'g':
- case 's':
- break;
- case 'c':
- /* we differ here with the TCL implementation in allowing for */
- /* a character width specification,to be more consistent with */
- /* ANSI. since Zend auto allocates space for vars, this is no */
- /* problem - cc */
- /*
- if (flags & SCAN_WIDTH) {
- php_error(E_WARNING, "field width may not be specified in %c conversion");
- goto error;
- }
- */
- break;
- case '[':
- if (*format == '\0') {
- goto badSet;
- }
- ch = format++;
- if (*ch == '^') {
- if (*format == '\0') {
- goto badSet;
- }
- ch = format++;
- }
- if (*ch == ']') {
- if (*format == '\0') {
- goto badSet;
- }
- ch = format++;
- }
- while (*ch != ']') {
- if (*format == '\0') {
- goto badSet;
- }
- ch = format++;
- }
- break;
- badSet:
- php_error(E_WARNING, "unmatched [ in format string");
- goto error;
- default:
- {
- php_error(E_WARNING,"bad scan conversion character \"%c\"", ch);
- goto error;
- }
- }
- if (!(flags & SCAN_SUPPRESS)) {
- if (objIndex >= nspace) {
- /*
- * Expand the nassign buffer. If we are using XPG specifiers,
- * make sure that we grow to a large enough size. xpgSize is
- * guaranteed to be at least one larger than objIndex.
- */
- value = nspace;
- if (xpgSize) {
- nspace = xpgSize;
- } else {
- nspace += STATIC_LIST_SIZE;
- }
- if (nassign == staticAssign) {
- nassign = (void *)emalloc(nspace * sizeof(int));
- for (i = 0; i < STATIC_LIST_SIZE; ++i) {
- nassign[i] = staticAssign[i];
- }
- } else {
- nassign = (void *)erealloc((void *)nassign, nspace * sizeof(int));
- }
- for (i = value; i < nspace; i++) {
- nassign[i] = 0;
- }
- }
- nassign[objIndex]++;
- objIndex++;
- }
- } /* while (*format != '\0') */
-
- /*
- * Verify that all of the variable were assigned exactly once.
- */
-
- if (numVars == 0) {
- if (xpgSize) {
- numVars = xpgSize;
- } else {
- numVars = objIndex;
- }
- }
- if (totalSubs) {
- *totalSubs = numVars;
- }
- for (i = 0; i < numVars; i++) {
- if (nassign[i] > 1) {
- php_error(E_WARNING, "variable is assigned by multiple \"%n$\" conversion specifiers");
- goto error;
- } else if (!xpgSize && (nassign[i] == 0)) {
- /*
- * If the space is empty, and xpgSize is 0 (means XPG wasn't
- * used, and/or numVars != 0), then too many vars were given
- */
- php_error(E_WARNING, "variable is not assigned by any conversion specifiers");
- goto error;
- }
- }
-
- if (nassign != staticAssign) {
- efree((char *)nassign);
- }
- return SCAN_SUCCESS;
-
- badIndex:
- if (gotXpg) {
- php_error(E_WARNING, "\"%n$\" argument index out of range");
- } else {
- php_error(E_WARNING,"different numbers of variable names and field specifiers");
- }
-
- error:
- if (nassign != staticAssign) {
- efree((char *)nassign);
- }
- return SCAN_ERROR_INVALID_FORMAT;
-#undef STATIC_LIST_SIZE
-}
-/* }}} */
-
-/* {{{ php_sscanf_internal
- * This is the internal function which does processing on behalf of
- * both sscanf() and fscanf()
- *
- * parameters :
- * string literal string to be processed
- * format format string
- * argCount total number of elements in the args array
- * args arguments passed in from user function (f|s)scanf
- * varStart offset (in args) of 1st variable passed in to (f|s)scanf
- * return_value set with the results of the scan
- */
-
-PHPAPI int php_sscanf_internal( char *string,char *format,
- int argCount,zval ***args,
- int varStart,pval **return_value)
-{
- int numVars, nconversions, totalVars = -1;
- int i, value, result;
- int objIndex;
- char *end, *baseString;
- zval **current;
- char op = 0;
- int base = 0;
- int underflow = 0;
- size_t width;
- long (*fn)() = NULL;
- char *ch, sch;
- int flags;
- char buf[64]; /* Temporary buffer to hold scanned
- * number strings before they are
- * passed to strtoul. */
-
-
- /* do some sanity checking */
- if ((varStart > argCount) || (varStart < 0)){
- varStart = SCAN_MAX_ARGS + 1;
- }
- numVars = argCount - varStart;
- if (numVars < 0) {
- numVars = 0;
- }
-
-#if 0
- zend_printf("<br>in sscanf_internal : <br> string is \"%s\",format = \"%s\"<br> NumVars = %d. VarStart = %d<br>-------------------------<br>",
- string,format,numVars,varStart);
-#endif
- /*
- * Check for errors in the format string.
- */
- if (ValidateFormat(format, numVars, &totalVars) != SCAN_SUCCESS) {
- scan_set_error_return( numVars, return_value );
- return SCAN_ERROR_INVALID_FORMAT;
- }
-
- objIndex = numVars ? varStart : 0;
-
- /*
- * If any variables are passed, make sure they are all passed by reference
- */
- if (numVars) {
- for (i = varStart;i < argCount;i++){
- if ( ! PZVAL_IS_REF( *args[ i ] ) ) {
- php_error(E_WARNING,"Parameter %d to %s() must be passed by reference",
- i, get_active_function_name());
- scan_set_error_return(numVars, return_value);
- return SCAN_ERROR_VAR_PASSED_BYVAL;
- }
- }
- }
-
-
- /*
- * Allocate space for the result objects. Only happens when no variables
- * are specified
- */
-
- if (!numVars) {
- /* allocate an array for return */
- if (array_init(*return_value) == FAILURE) {
- scan_set_error_return(0, return_value);
- return FAILURE;
- }
- for (i = 0; i < totalVars; i++) {
- if (add_next_index_null(*return_value) == FAILURE) {
- scan_set_error_return(0, return_value);
- return FAILURE;
- }
- }
- }
-
- baseString = string;
-
- /*
- * Iterate over the format string filling in the result objects until
- * we reach the end of input, the end of the format string, or there
- * is a mismatch.
- */
-
- nconversions = 0;
- /* note ! - we need to limit the loop for objIndex to keep it in bounds */
-
- while (*format != '\0') {
-
- ch = format++;
-
- flags = 0;
-
- /*
- * If we see whitespace in the format, skip whitespace in the string.
- */
-
- if ( isspace( (int)*ch ) ) {
- sch = *string;
- while ( isspace( (int)sch ) ) {
- if (*string == '\0') {
- goto done;
- }
- string++;
- sch = *string;
- }
- continue;
- }
-
- if (*ch != '%') {
- literal:
- if (*string == '\0') {
- underflow = 1;
- goto done;
- }
- sch = *string;
- string++;
- if (*ch != sch) {
- goto done;
- }
- continue;
- }
-
- ch = format++;
- if (*ch == '%') {
- goto literal;
- }
-
- /*
- * Check for assignment suppression ('*') or an XPG3-style
- * assignment ('%n$').
- */
-
- if (*ch == '*') {
- flags |= SCAN_SUPPRESS;
- ch = format++;
- } else if ( isdigit(UCHAR(*ch))) {
- value = strtoul(format-1, &end, 10);
- if (*end == '$') {
- format = end+1;
- ch = format++;
- objIndex = varStart + value;
- }
- }
-
- /*
- * Parse any width specifier.
- */
-
- if ( isdigit(UCHAR(*ch))) {
- width = strtoul(format-1, &format, 10);
- ch = format++;
- } else {
- width = 0;
- }
-
- /*
- * Ignore size specifier.
- */
-
- if ((*ch == 'l') || (*ch == 'L') || (*ch == 'h')) {
- ch = format++;
- }
-
- /*
- * Handle the various field types.
- */
-
- switch (*ch) {
- case 'n':
- if (!(flags & SCAN_SUPPRESS)) {
- if (numVars) {
- current = args[objIndex++];
- convert_to_long( *current );
- ZVAL_STRINGL( *current, string, end-string, 1);
- } else {
- add_index_long(*return_value, objIndex++, string - baseString);
- }
- }
- nconversions++;
- continue;
-
- case 'd':
- case 'D':
- op = 'i';
- base = 10;
- fn = (long (*)())strtol;
- break;
- case 'i':
- op = 'i';
- base = 0;
- fn = (long (*)())strtol;
- break;
- case 'o':
- op = 'i';
- base = 8;
- fn = (long (*)())strtol;
- break;
- case 'x':
- op = 'i';
- base = 16;
- fn = (long (*)())strtol;
- break;
- case 'u':
- op = 'i';
- base = 10;
- flags |= SCAN_UNSIGNED;
- fn = (long (*)())strtoul;
- break;
-
- case 'f':
- case 'e':
- case 'E':
- case 'g':
- op = 'f';
- break;
-
- case 's':
- op = 's';
- break;
-
- case 'c':
- op = 's';
- flags |= SCAN_NOSKIP;
- /*-cc-*/
- if (0 == width) {
- width = 1;
- }
- /*-cc-*/
- break;
- case '[':
- op = '[';
- flags |= SCAN_NOSKIP;
- break;
- } /* switch */
-
- /*
- * At this point, we will need additional characters from the
- * string to proceed.
- */
-
- if (*string == '\0') {
- underflow = 1;
- goto done;
- }
-
- /*
- * Skip any leading whitespace at the beginning of a field unless
- * the format suppresses this behavior.
- */
-
- if (!(flags & SCAN_NOSKIP)) {
- while (*string != '\0') {
- sch = *string;
- if (! isspace((int)sch) ) {
- break;
- }
- string++;
- }
- if (*string == '\0') {
- underflow = 1;
- goto done;
- }
- }
-
- /*
- * Perform the requested scanning operation.
- */
-
- switch (op) {
- case 'c':
- case 's':
- /*
- * Scan a string up to width characters or whitespace.
- */
-
- if (width == 0) {
- width = (size_t) ~0;
- }
- end = string;
- while (*end != '\0') {
- sch = *end;
- if ( isspace( (int)sch ) ) {
- break;
- }
- end++;
- if (--width == 0) {
- break;
- }
- }
- if (!(flags & SCAN_SUPPRESS)) {
- if (numVars) {
- current = args[objIndex++];
- convert_to_string( *current );
- ZVAL_STRINGL( *current, string, end-string, 1);
- } else {
- add_index_stringl( *return_value, objIndex++, string, end-string, 1);
- }
- }
- string = end;
- break;
-
- case '[': {
- CharSet cset;
-
- if (width == 0) {
- width = (size_t) ~0;
- }
- end = string;
-
- format = BuildCharSet(&cset, format);
- while (*end != '\0') {
- sch = *end;
- if (!CharInSet(&cset, (int)sch)) {
- break;
- }
- end++;
- if (--width == 0) {
- break;
- }
- }
- ReleaseCharSet(&cset);
-
- if (string == end) {
- /*
- * Nothing matched the range, stop processing
- */
- goto done;
- }
- if (!(flags & SCAN_SUPPRESS)) {
- if (numVars) {
- current = args[objIndex++];
- convert_to_string( *current );
- ZVAL_STRINGL( *current, string, end-string, 1);
- } else {
- add_index_stringl(*return_value, objIndex++, string, end-string, 1);
- }
- }
- string = end;
-
- break;
- }
- /*
- case 'c':
- / Scan a single character./
-
- sch = *string;
- string++;
- if (!(flags & SCAN_SUPPRESS)) {
- if (numVars) {
- char __buf[2];
- __buf[0] = sch;
- __buf[1] = '\0';;
- current = args[objIndex++];
- convert_to_string_ex( current );
- ZVAL_STRINGL( *current, __buf, 1, 1);
- } else {
- add_index_stringl(*return_value, objIndex++, &sch, 1, 1);
- }
- }
- break;
- */
- case 'i':
- /*
- * Scan an unsigned or signed integer.
- */
-
- /*-cc-*/
- buf[0] = '\0';
- /*-cc-*/
- if ((width == 0) || (width > sizeof(buf) - 1)) {
- width = sizeof(buf) - 1;
- }
-
- flags |= SCAN_SIGNOK | SCAN_NODIGITS | SCAN_NOZERO;
- for (end = buf; width > 0; width--) {
- switch (*string) {
- /*
- * The 0 digit has special meaning at the beginning of
- * a number. If we are unsure of the base, it
- * indicates that we are in base 8 or base 16 (if it is
- * followed by an 'x').
- */
- case '0':
- /*-cc-*/
- if (base == 16) {
- flags |= SCAN_XOK;
- }
- /*-cc-*/
- if (base == 0) {
- base = 8;
- flags |= SCAN_XOK;
- }
- if (flags & SCAN_NOZERO) {
- flags &= ~(SCAN_SIGNOK | SCAN_NODIGITS | SCAN_NOZERO);
- } else {
- flags &= ~(SCAN_SIGNOK | SCAN_XOK | SCAN_NODIGITS);
- }
- goto addToInt;
-
- case '1': case '2': case '3': case '4':
- case '5': case '6': case '7':
- if (base == 0) {
- base = 10;
- }
- flags &= ~(SCAN_SIGNOK | SCAN_XOK | SCAN_NODIGITS);
- goto addToInt;
-
- case '8': case '9':
- if (base == 0) {
- base = 10;
- }
- if (base <= 8) {
- break;
- }
- flags &= ~(SCAN_SIGNOK | SCAN_XOK | SCAN_NODIGITS);
- goto addToInt;
-
- case 'A': case 'B': case 'C':
- case 'D': case 'E': case 'F':
- case 'a': case 'b': case 'c':
- case 'd': case 'e': case 'f':
- if (base <= 10) {
- break;
- }
- flags &= ~(SCAN_SIGNOK | SCAN_XOK | SCAN_NODIGITS);
- goto addToInt;
-
- case '+': case '-':
- if (flags & SCAN_SIGNOK) {
- flags &= ~SCAN_SIGNOK;
- goto addToInt;
- }
- break;
-
- case 'x': case 'X':
- if ((flags & SCAN_XOK) && (end == buf+1)) {
- base = 16;
- flags &= ~SCAN_XOK;
- goto addToInt;
- }
- break;
- }
-
- /*
- * We got an illegal character so we are done accumulating.
- */
-
- break;
-
- addToInt:
- /*
- * Add the character to the temporary buffer.
- */
- *end++ = *string++;
- if (*string == '\0') {
- break;
- }
- }
-
- /*
- * Check to see if we need to back up because we only got a
- * sign or a trailing x after a 0.
- */
-
- if (flags & SCAN_NODIGITS) {
- if (*string == '\0') {
- underflow = 1;
- }
- goto done;
- } else if (end[-1] == 'x' || end[-1] == 'X') {
- end--;
- string--;
- }
-
-
- /*
- * Scan the value from the temporary buffer. If we are
- * returning a large unsigned value, we have to convert it back
- * to a string since PHP only supports signed values.
- */
-
- if (!(flags & SCAN_SUPPRESS)) {
- *end = '\0';
- value = (int) (*fn)(buf, NULL, base);
- if ((flags & SCAN_UNSIGNED) && (value < 0)) {
- sprintf(buf, "%u", value); /* INTL: ISO digit */
- if (numVars) {
- /* change passed value type to string */
- current = args[objIndex++];
- convert_to_string( *current );
- ZVAL_STRING( *current, buf, 1 );
- } else {
- add_index_string(*return_value, objIndex++, buf, 1);
- }
- } else {
- if (numVars) {
- current = args[objIndex++];
- convert_to_long( *current );
- Z_LVAL(**current) = value;
- } else {
- add_index_long(*return_value, objIndex++, value);
- }
- }
- }
-
- break;
-
- case 'f':
- /*
- * Scan a floating point number
- */
- buf[0] = '\0'; /* call me pedantic */
- if ((width == 0) || (width > sizeof(buf) - 1)) {
- width = sizeof(buf) - 1;
- }
- flags |= SCAN_SIGNOK | SCAN_NODIGITS | SCAN_PTOK | SCAN_EXPOK;
- for (end = buf; width > 0; width--) {
- switch (*string) {
- case '0': case '1': case '2': case '3':
- case '4': case '5': case '6': case '7':
- case '8': case '9':
- flags &= ~(SCAN_SIGNOK | SCAN_NODIGITS);
- goto addToFloat;
- case '+': case '-':
- if (flags & SCAN_SIGNOK) {
- flags &= ~SCAN_SIGNOK;
- goto addToFloat;
- }
- break;
- case '.':
- if (flags & SCAN_PTOK) {
- flags &= ~(SCAN_SIGNOK | SCAN_PTOK);
- goto addToFloat;
- }
- break;
- case 'e': case 'E':
- /*
- * An exponent is not allowed until there has
- * been at least one digit.
- */
-
- if ((flags & (SCAN_NODIGITS | SCAN_EXPOK)) == SCAN_EXPOK) {
- flags = (flags & ~(SCAN_EXPOK|SCAN_PTOK))
- | SCAN_SIGNOK | SCAN_NODIGITS;
- goto addToFloat;
- }
- break;
- }
-
- /*
- * We got an illegal character so we are done accumulating.
- */
-
- break;
-
- addToFloat:
- /*
- * Add the character to the temporary buffer.
- */
-
- *end++ = *string++;
- if (*string == '\0') {
- break;
- }
- }
-
- /*
- * Check to see if we need to back up because we saw a
- * trailing 'e' or sign.
- */
-
- if (flags & SCAN_NODIGITS) {
- if (flags & SCAN_EXPOK) {
- /*
- * There were no digits at all so scanning has
- * failed and we are done.
- */
- if (*string == '\0') {
- underflow = 1;
- }
- goto done;
- }
-
- /*
- * We got a bad exponent ('e' and maybe a sign).
- */
-
- end--;
- string--;
- if (*end != 'e' && *end != 'E') {
- end--;
- string--;
- }
- }
-
- /*
- * Scan the value from the temporary buffer.
- */
-
- if (!(flags & SCAN_SUPPRESS)) {
- double dvalue;
- *end = '\0';
- dvalue = strtod(buf, NULL);
- if (numVars) {
- current = args[objIndex++];
- convert_to_double( *current );
- Z_DVAL_PP( current ) = dvalue;
- } else {
- add_index_double( *return_value, objIndex++, dvalue );
- }
- }
- break;
- } /* switch (op) */
- nconversions++;
- } /* while (*format != '\0') */
-
- done:
- result = SCAN_SUCCESS;
-
- if (underflow && (0==nconversions)) {
- scan_set_error_return( numVars, return_value );
- result = SCAN_ERROR_EOF;
- } else if (numVars) {
- convert_to_long( *return_value );
- (*return_value)->value.lval = nconversions;
- } else if (nconversions < totalVars) {
- /* to do : not all elements converted. we need to prune the list - cc
- */
- }
-
- return result;
-}
-/* }}} */
-
-/* the compiler choked when i tried to make this a macro */
-inline void scan_set_error_return(int numVars,pval **return_value) {
- if (numVars) {
- (*return_value)->type = IS_LONG;
- (*return_value)->value.lval = SCAN_ERROR_EOF; /* EOF marker */
- } else {
- /* pval_destructor( *return_value ); */
- /* convert_to_null calls destructor */
- convert_to_null( *return_value );
- }
-}
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/standard/scanf.h b/ext/standard/scanf.h
deleted file mode 100644
index 2d902000aa..0000000000
--- a/ext/standard/scanf.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: clayton collie <clcollie@mindspring.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef SCANF_H
-#define SCANF_H
-
-
-#define SCAN_MAX_ARGS 0xFF /* Maximum number of variable which can be */
- /* passed to (f|s)scanf. This is an artifical */
- /* upper limit to keep resources in check and */
- /* minimize the possibility of exploits */
-
-#define SCAN_MAX_FSCANF_BUFSIZE 512 /* Max input buffer allocated for fscanf */
-#define SCAN_SUCCESS SUCCESS
-#define SCAN_ERROR_EOF -1 /* indicates premature termination of scan */
- /* can be caused by bad parameters or format*/
- /* string. */
-#define SCAN_ERROR_INVALID_FORMAT (SCAN_ERROR_EOF - 1)
-#define SCAN_ERROR_VAR_PASSED_BYVAL (SCAN_ERROR_INVALID_FORMAT - 1)
-#define SCAN_ERROR_WRONG_PARAM_COUNT (SCAN_ERROR_VAR_PASSED_BYVAL - 1)
-#define SCAN_ERROR_INTERNAL (SCAN_ERROR_WRONG_PARAM_COUNT - 1)
-
-
-/*
- * The following are here solely for the benefit of the scanf type functions
- * e.g. fscanf
- */
-PHPAPI int ValidateFormat(char *format, int numVars, int *totalVars);
-PHPAPI int php_sscanf_internal(char *string,char *format,int argCount,zval ***args,
- int varStart,pval **return_value);
-inline void scan_set_error_return(int numVars,pval **return_value);
-
-
-#endif /* SCANF_H */
diff --git a/ext/standard/soundex.c b/ext/standard/soundex.c
deleted file mode 100644
index a67462b1a0..0000000000
--- a/ext/standard/soundex.c
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Bjørn Borud - Guardian Networks AS <borud@guardian.no> |
- +----------------------------------------------------------------------+
- */
-/* $Id$ */
-
-#include "php.h"
-#include <stdlib.h>
-#include <errno.h>
-#include <ctype.h>
-#include "php_string.h"
-
-/* Simple soundex algorithm as described by Knuth in TAOCP, vol 3 */
-/* {{{ proto string soundex(string str)
- Calculate the soundex key of a string */
-PHP_FUNCTION(soundex)
-{
- char *somestring;
- int i, _small, len, code, last;
- pval *arg, **parg;
- char soundex[4 + 1];
-
- static char soundex_table[26] =
- {0, /* A */
- '1', /* B */
- '2', /* C */
- '3', /* D */
- 0, /* E */
- '1', /* F */
- '2', /* G */
- 0, /* H */
- 0, /* I */
- '2', /* J */
- '2', /* K */
- '4', /* L */
- '5', /* M */
- '5', /* N */
- 0, /* O */
- '1', /* P */
- '2', /* Q */
- '6', /* R */
- '2', /* S */
- '3', /* T */
- 0, /* U */
- '1', /* V */
- 0, /* W */
- '2', /* X */
- 0, /* Y */
- '2'}; /* Z */
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &parg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(parg);
- arg = *parg;
- if (arg->value.str.len==0) {
- RETURN_FALSE;
- }
- somestring = arg->value.str.val;
- len = arg->value.str.len;
-
- /* build soundex string */
- last = -1;
- for (i = 0, _small = 0; i < len && _small < 4; i++) {
- /* convert chars to upper case and strip non-letter chars */
- /* BUG: should also map here accented letters used in non */
- /* English words or names (also found in English text!): */
- /* esstsett, thorn, n-tilde, c-cedilla, s-caron, ... */
- code = toupper(somestring[i]);
- if (code >= 'A' && code <= 'Z') {
- if (_small == 0) {
- /* remember first valid char */
- soundex[_small++] = code;
- last = soundex_table[code - 'A'];
- }
- else {
- /* ignore sequences of consonants with same soundex */
- /* code in trail, and vowels unless they separate */
- /* consonant letters */
- code = soundex_table[code - 'A'];
- if (code != last) {
- if (code != 0) {
- soundex[_small++] = code;
- }
- last = code;
- }
- }
- }
- }
- /* pad with '0' and terminate with 0 ;-) */
- while (_small < 4) {
- soundex[_small++] = '0';
- }
- soundex[_small] = '\0';
-
- return_value->value.str.val = estrndup(soundex, _small);
- return_value->value.str.len = _small;
- return_value->type = IS_STRING;
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/standard/string.c b/ext/standard/string.c
deleted file mode 100644
index 6c9aa51e86..0000000000
--- a/ext/standard/string.c
+++ /dev/null
@@ -1,3371 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Rasmus Lerdorf <rasmus@php.net> |
- | Stig Sæther Bakken <ssb@fast.no> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-/* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
-
-#include <stdio.h>
-#include "php.h"
-#include "reg.h"
-#include "php_string.h"
-#include "php_variables.h"
-#ifdef HAVE_LOCALE_H
-# include <locale.h>
-#endif
-#include "scanf.h"
-#include "zend_API.h"
-#include "zend_execute.h"
-#include "php_globals.h"
-#include "basic_functions.h"
-#include "php_smart_str.h"
-#ifdef ZTS
-#include "TSRM.h"
-#endif
-
-#define STR_PAD_LEFT 0
-#define STR_PAD_RIGHT 1
-#define STR_PAD_BOTH 2
-#define PHP_PATHINFO_DIRNAME 0
-#define PHP_PATHINFO_BASENAME 1
-#define PHP_PATHINFO_EXTENSION 2
-
-/* {{{ register_string_constants
- */
-void register_string_constants(INIT_FUNC_ARGS)
-{
- REGISTER_LONG_CONSTANT("STR_PAD_LEFT", STR_PAD_LEFT, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("STR_PAD_RIGHT", STR_PAD_RIGHT, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("STR_PAD_BOTH", STR_PAD_BOTH, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("PATHINFO_DIRNAME", PHP_PATHINFO_DIRNAME, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("PATHINFO_BASENAME", PHP_PATHINFO_BASENAME, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("PATHINFO_EXTENSION", PHP_PATHINFO_EXTENSION, CONST_CS | CONST_PERSISTENT);
-
-#ifdef HAVE_LOCALECONV
- /* If last members of struct lconv equal CHAR_MAX, no grouping is done */
-
-/* This is bad, but since we are going to be hardcoding in the POSIX stuff anyway... */
-# ifndef HAVE_LIMITS_H
-# define CHAR_MAX 127
-# endif
-
- REGISTER_LONG_CONSTANT("CHAR_MAX", CHAR_MAX, CONST_CS | CONST_PERSISTENT);
-#endif
-
-#ifdef HAVE_LOCALE_H
- REGISTER_LONG_CONSTANT("LC_CTYPE", LC_CTYPE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("LC_NUMERIC", LC_NUMERIC, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("LC_TIME", LC_TIME, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("LC_COLLATE", LC_COLLATE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("LC_MONETARY", LC_MONETARY, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("LC_ALL", LC_ALL, CONST_CS | CONST_PERSISTENT);
-# ifdef LC_MESSAGES
- REGISTER_LONG_CONSTANT("LC_MESSAGES", LC_MESSAGES, CONST_CS | CONST_PERSISTENT);
-# endif
-#endif
-
-}
-/* }}} */
-
-int php_tag_find(char *tag, int len, char *set);
-
-/* this is read-only, so it's ok */
-static char hexconvtab[] = "0123456789abcdef";
-
-/* localeconv mutex */
-#ifdef ZTS
-static MUTEX_T locale_mutex = NULL;
-#endif
-
-/* {{{ php_bin2hex
- */
-static char *php_bin2hex(const unsigned char *old, const size_t oldlen, size_t *newlen)
-{
- unsigned char *result = NULL;
- size_t i, j;
-
- result = (char *) emalloc(oldlen * 2 * sizeof(char) + 1);
- if(!result) {
- return result;
- }
-
- for(i = j = 0; i < oldlen; i++) {
- result[j++] = hexconvtab[old[i] >> 4];
- result[j++] = hexconvtab[old[i] & 15];
- }
- result[j] = '\0';
-
- if(newlen) *newlen = oldlen * 2 * sizeof(char);
-
- return result;
-}
-/* }}} */
-
-#ifdef HAVE_LOCALECONV
-/* {{{ localeconv_r
- * glibc's localeconv is not reentrant, so lets make it so ... sorta */
-struct lconv *localeconv_r(struct lconv *out)
-{
- struct lconv *res;
-
-# ifdef ZTS
- tsrm_mutex_lock( locale_mutex );
-# endif
-
- /* localeconv doesn't return an error condition */
- res = localeconv();
-
- *out = *res;
-
-# ifdef ZTS
- tsrm_mutex_unlock( locale_mutex );
-# endif
-
- return out;
-}
-/* }}} */
-
-# ifdef ZTS
-/* {{{ PHP_MINIT_FUNCTION
- */
-PHP_MINIT_FUNCTION(localeconv)
-{
- locale_mutex = tsrm_mutex_alloc();
-
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_MSHUTDOWN_FUNCTION
- */
-PHP_MSHUTDOWN_FUNCTION(localeconv)
-{
- tsrm_mutex_free( locale_mutex );
-
- locale_mutex = NULL;
-
- return SUCCESS;
-}
-/* }}} */
-# endif
-#endif
-
-/* {{{ proto string bin2hex(string data)
- Converts the binary representation of data to hex */
-PHP_FUNCTION(bin2hex)
-{
- zval **data;
- char *result;
- size_t newlen;
-
- if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &data) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(data);
-
- result = php_bin2hex((*data)->value.str.val, (*data)->value.str.len, &newlen);
-
- if(!result) {
- RETURN_FALSE;
- }
-
- RETURN_STRINGL(result, newlen, 0);
-}
-/* }}} */
-
-/* {{{ proto int strspn(string str, string mask)
- Find length of initial segment consisting entirely of characters found in mask */
-PHP_FUNCTION(strspn)
-{
- zval **s1,**s2;
-
- if (ZEND_NUM_ARGS()!=2 || zend_get_parameters_ex(2, &s1, &s2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(s1);
- convert_to_string_ex(s2);
- RETURN_LONG(php_strspn((*s1)->value.str.val, (*s2)->value.str.val,
- (*s1)->value.str.val + (*s1)->value.str.len,
- (*s2)->value.str.val + (*s2)->value.str.len));
-}
-/* }}} */
-
-/* {{{ proto int strcspn(string str, string mask)
- Find length of initial segment consisting entirely of characters not found in mask */
-PHP_FUNCTION(strcspn)
-{
- zval **s1,**s2;
-
- if (ZEND_NUM_ARGS()!=2 || zend_get_parameters_ex(2, &s1, &s2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(s1);
- convert_to_string_ex(s2);
- RETURN_LONG(php_strcspn((*s1)->value.str.val, (*s2)->value.str.val,
- (*s1)->value.str.val + (*s1)->value.str.len,
- (*s2)->value.str.val + (*s2)->value.str.len));
-}
-/* }}} */
-
-#ifdef HAVE_STRCOLL
-/* {{{ proto int strcoll(string str1, string str2)
- Compare two strings using the current locale */
-PHP_FUNCTION(strcoll)
-{
- zval **s1, **s2;
-
- if (ZEND_NUM_ARGS()!=2 || zend_get_parameters_ex(2, &s1, &s2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(s1);
- convert_to_string_ex(s2);
-
- RETURN_LONG(strcoll((const char *)(*s1)->value.str.val, (const char *)(*s2)->value.str.val));
-}
-/* }}} */
-#endif
-
-/* {{{ php_trim
- */
-PHPAPI void php_trim(zval *str, zval * return_value, int mode)
-/* mode 1 : trim left
- mode 2 : trim right
- mode 3 : trim left and right
-*/
-{
- register int i;
- int len = str->value.str.len;
- int trimmed = 0;
- char *c = str->value.str.val;
-
- if (mode & 1) {
- for (i = 0; i < len; i++) {
- if (c[i] == ' ' || c[i] == '\n' || c[i] == '\r' ||
- c[i] == '\t' || c[i] == '\v' || c[i] == '\0') {
- trimmed++;
- } else {
- break;
- }
- }
- len -= trimmed;
- c += trimmed;
- }
- if (mode & 2) {
- for (i = len - 1; i >= 0; i--) {
- if (c[i] == ' ' || c[i] == '\n' || c[i] == '\r' ||
- c[i] == '\t' || c[i] == '\v' || c[i] == '\0') {
- len--;
- } else {
- break;
- }
- }
- }
- RETVAL_STRINGL(c, len, 1);
-}
-/* }}} */
-
-/* {{{ proto string rtrim(string str)
- An alias for chop */
-/* }}} */
-
-/* {{{ proto string chop(string str)
- Remove trailing whitespace */
-PHP_FUNCTION(chop)
-{
- zval **str;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &str) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(str);
-
- if ((*str)->type == IS_STRING) {
- php_trim(*str, return_value, 2);
- return;
- }
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto string trim(string str)
- Strip whitespace from the beginning and end of a string */
-PHP_FUNCTION(trim)
-{
- zval **str;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &str) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(str);
-
- if ((*str)->type == IS_STRING) {
- php_trim(*str, return_value, 3);
- return;
- }
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto string ltrim(string str)
- Strip whitespace from the beginning of a string */
-PHP_FUNCTION(ltrim)
-{
- zval **str;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &str) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(str);
- if ((*str)->type == IS_STRING) {
- php_trim(*str, return_value, 1);
- return;
- }
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto string wordwrap(string str [, int width [, string break [, int cut]]])
- Wrap buffer to selected number of characters using string break char */
-PHP_FUNCTION(wordwrap)
-{
- pval **ptext, **plinelength, **pbreakchar, **cut;
- long i=0, l=0, pgr=0, linelength=0, last=0, breakcharlen, docut=0;
- char *text, *breakchar, *newtext;
-
- if (ZEND_NUM_ARGS() < 1 || ZEND_NUM_ARGS() > 4 || zend_get_parameters_ex(ZEND_NUM_ARGS(), &ptext, &plinelength, &pbreakchar, &cut) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(ptext);
-
- if (Z_STRVAL_PP(ptext) == 0)
- RETVAL_FALSE;
-
- text = (*ptext)->value.str.val;
-
- if (ZEND_NUM_ARGS() > 1) {
- convert_to_long_ex(plinelength);
- linelength = (*plinelength)->value.lval;
- }
- else {
- linelength = 75;
- }
-
- if (ZEND_NUM_ARGS() > 2) {
- convert_to_string_ex(pbreakchar);
- breakchar = (*pbreakchar)->value.str.val;
- breakcharlen = (*pbreakchar)->value.str.len;
- }
- else {
- breakchar = "\n";
- breakcharlen = 1;
- }
-
- if (ZEND_NUM_ARGS() > 3) {
- convert_to_long_ex(cut);
- docut = (*cut)->value.lval;
- }
-
- /* Special case for a single-character break as it needs no
- additional storage space */
-
- if (breakcharlen == 1 && docut == 0) {
- newtext = estrdup (text);
- while (newtext[i] != '\0') {
- /* prescan line to see if it is greater than linelength */
- l = 0;
- while (newtext[i+l] != breakchar[0]) {
- if (newtext[i+l] == '\0') {
- l--;
- break;
- }
- l++;
- }
- if (l >= linelength) {
- pgr = l;
- l = linelength;
- /* needs breaking; work backwards to find previous word */
- while (l >= 0) {
- if (newtext[i+l] == ' ') {
- newtext[i+l] = breakchar[0];
- break;
- }
- l--;
- }
- if (l == -1) {
- /* couldn't break is backwards, try looking forwards */
- l = linelength;
- while (l <= pgr) {
- if(newtext[i+l] == ' ') {
- newtext[i+l] = breakchar[0];
- break;
- }
- l++;
- }
- }
- }
- i += l+1;
- }
- RETVAL_STRINGL(newtext, strlen(newtext), 1);
- efree(newtext);
- }
- else {
- /* Multiple character line break */
- newtext = emalloc((*ptext)->value.str.len * (breakcharlen+1)+1);
- newtext[0] = '\0';
-
- i = 0;
- while (text[i] != '\0') {
- /* prescan line to see if it is greater than linelength */
- l = 0;
- while (text[i+l] != '\0') {
- if (text[i+l] == breakchar[0]) {
- if (breakcharlen == 1 || strncmp(text+i+l, breakchar, breakcharlen)==0)
- break;
- }
- l++;
- }
- if (l >= linelength) {
- pgr = l;
- l = linelength;
-
- /* needs breaking; work backwards to find previous word */
- while (l >= 0) {
- if (text[i+l] == ' ') {
- strncat(newtext, text+last, i+l-last);
- strcat(newtext, breakchar);
- last = i + l + 1;
- break;
- }
- l--;
- }
- if (l == -1) {
- /* couldn't break it backwards, try looking forwards */
- l = linelength - 1;
- while (l <= pgr) {
- if (docut == 0)
- {
- if (text[i+l] == ' ') {
- strncat(newtext, text+last, i+l-last);
- strcat(newtext, breakchar);
- last = i + l + 1;
- break;
- }
- }
- if (docut == 1)
- {
- if (text[i+l] == ' ' || l > i-last) {
- strncat(newtext, text+last, i+l-last+1);
- strcat(newtext, breakchar);
- last = i + l + 1;
- break;
- }
- }
- l++;
- }
- }
- i += l+1;
- }
- else {
- i += (l ? l : 1);
- }
- }
-
- if (i+l > last) {
- strcat(newtext, text+last);
- }
-
- RETVAL_STRINGL(newtext, strlen(newtext), 1);
- efree(newtext);
- }
-}
-/* }}} */
-
-/* {{{ php_explode
- */
-PHPAPI void php_explode(zval *delim, zval *str, zval *return_value, int limit)
-{
- char *p1, *p2, *endp;
-
- endp = str->value.str.val + str->value.str.len;
-
- p1 = str->value.str.val;
- p2 = php_memnstr(str->value.str.val, delim->value.str.val, delim->value.str.len, endp);
-
- if (p2 == NULL) {
- add_next_index_stringl(return_value, p1, str->value.str.len, 1);
- } else {
- do {
- add_next_index_stringl(return_value, p1, p2-p1, 1);
- p1 = p2 + delim->value.str.len;
- } while ((p2 = php_memnstr(p1, delim->value.str.val, delim->value.str.len, endp)) != NULL &&
- (limit == -1 || --limit > 1));
-
- if (p1 <= endp)
- add_next_index_stringl(return_value, p1, endp-p1, 1);
- }
-}
-/* }}} */
-
-/* {{{ proto array explode(string separator, string str [, int limit])
- Split a string on string separator and return array of components */
-PHP_FUNCTION(explode)
-{
- zval **str, **delim, **zlimit = NULL;
- int limit;
-
- switch (ZEND_NUM_ARGS()) {
- case 2:
- if (zend_get_parameters_ex(2, &delim, &str) == FAILURE)
- WRONG_PARAM_COUNT;
- limit=-1;
- break;
- case 3:
- if (zend_get_parameters_ex(3, &delim, &str, &zlimit) == FAILURE)
- WRONG_PARAM_COUNT;
- convert_to_long_ex(zlimit);
- limit = (*zlimit)->value.lval;
- break;
- default:
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(str);
- convert_to_string_ex(delim);
-
- if (! (*delim)->value.str.len) {
- php_error(E_WARNING,"Empty delimiter");
- RETURN_FALSE;
- }
-
- if (array_init(return_value) == FAILURE) {
- RETURN_FALSE;
- }
-
- if(limit==0 || limit==1) {
- add_index_stringl(return_value, 0, (*str)->value.str.val, (*str)->value.str.len, 1);
- } else {
- php_explode(*delim, *str, return_value, limit);
- }
-}
-/* }}} */
-
-/* {{{ proto string join(array src, string glue)
- An alias for implode */
-/* }}} */
-
-/* {{{ php_implode
- */
-PHPAPI void php_implode(zval *delim, zval *arr, zval *return_value)
-{
- zval **tmp;
- int len = 0, count = 0, target = 0;
- HashPosition pos;
-
- /* convert everything to strings, and calculate length */
- zend_hash_internal_pointer_reset_ex(arr->value.ht, &pos);
- while (zend_hash_get_current_data_ex(arr->value.ht, (void **) &tmp, &pos) == SUCCESS) {
- convert_to_string_ex(tmp);
- len += (*tmp)->value.str.len;
- if (count>0) {
- len += delim->value.str.len;
- }
- count++;
- zend_hash_move_forward_ex(arr->value.ht, &pos);
- }
-
- /* do it */
- return_value->value.str.val = (char *) emalloc(len + 1);
- return_value->value.str.val[0] = '\0';
- return_value->value.str.val[len] = '\0';
- zend_hash_internal_pointer_reset_ex(arr->value.ht, &pos);
- while (zend_hash_get_current_data_ex(arr->value.ht, (void **) &tmp, &pos) == SUCCESS) {
- count--;
- memcpy(return_value->value.str.val + target, (*tmp)->value.str.val,
- (*tmp)->value.str.len);
- target += (*tmp)->value.str.len;
- if (count > 0) {
- memcpy(return_value->value.str.val + target, delim->value.str.val,
- delim->value.str.len);
- target += delim->value.str.len;
- }
- zend_hash_move_forward_ex(arr->value.ht, &pos);
- }
- return_value->type = IS_STRING;
- return_value->value.str.len = len;
-}
-/* }}} */
-
-/* {{{ proto string implode(array src, string glue)
- Join array elements placing glue string between items and return one string */
-PHP_FUNCTION(implode)
-{
- zval **arg1, **arg2, *delim, *arr;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if ((*arg1)->type == IS_ARRAY) {
- SEPARATE_ZVAL(arg1);
- arr = *arg1;
- convert_to_string_ex(arg2);
- delim = *arg2;
- } else if ((*arg2)->type == IS_ARRAY) {
- SEPARATE_ZVAL(arg2)
- arr = *arg2;
- convert_to_string_ex(arg1);
- delim = *arg1;
- } else {
- php_error(E_WARNING, "Bad arguments to %s()",
- get_active_function_name());
- return;
- }
- php_implode(delim, arr, return_value);
-}
-/* }}} */
-
-/* {{{ proto string strtok([string str,] string token)
- Tokenize a string */
-PHP_FUNCTION(strtok)
-{
- zval **str, **tok;
- char *token = NULL, *tokp=NULL;
- char *first = NULL;
- int argc;
- BLS_FETCH();
-
- argc = ZEND_NUM_ARGS();
-
- if ((argc == 1 && zend_get_parameters_ex(1, &tok) == FAILURE) ||
- (argc == 2 && zend_get_parameters_ex(2, &str, &tok) == FAILURE) ||
- argc < 1 || argc > 2) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(tok);
- tokp = token = (*tok)->value.str.val;
-
- if (argc == 2) {
- convert_to_string_ex(str);
-
- STR_FREE(BG(strtok_string));
- BG(strtok_string) = estrndup((*str)->value.str.val,(*str)->value.str.len);
- BG(strtok_pos1) = BG(strtok_string);
- BG(strtok_pos2) = NULL;
- }
- if (BG(strtok_pos1) && *BG(strtok_pos1)) {
- for ( /* NOP */ ; token && *token; token++) {
- BG(strtok_pos2) = strchr(BG(strtok_pos1), (int) *token);
- if (!first || (BG(strtok_pos2) && BG(strtok_pos2) < first)) {
- first = BG(strtok_pos2);
- }
- } /* NB: token is unusable now */
-
- BG(strtok_pos2) = first;
- if (BG(strtok_pos2)) {
- *BG(strtok_pos2) = '\0';
- }
- RETVAL_STRING(BG(strtok_pos1),1);
-#if 0
- /* skip 'token' white space for next call to strtok */
- while (BG(strtok_pos2) &&
- strchr(tokp, *(BG(strtok_pos2)+1))) {
- BG(strtok_pos2)++;
- }
-#endif
- if (BG(strtok_pos2))
- BG(strtok_pos1) = BG(strtok_pos2) + 1;
- else
- BG(strtok_pos1) = NULL;
- } else {
- RETVAL_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ php_strtoupper
- */
-PHPAPI char *php_strtoupper(char *s, size_t len)
-{
- char *c;
- int ch;
- size_t i;
-
- c = s;
- for (i=0; i<len; i++) {
- ch = toupper((unsigned char)*c);
- *c++ = ch;
- }
- return (s);
-}
-/* }}} */
-
-/* {{{ proto string strtoupper(string str)
- Make a string uppercase */
-PHP_FUNCTION(strtoupper)
-{
- zval **arg;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg)) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(arg);
-
- *return_value = **arg;
- zval_copy_ctor(return_value);
- php_strtoupper(return_value->value.str.val, return_value->value.str.len);
-}
-/* }}} */
-
-/* {{{ php_strtolower
- */
-PHPAPI char *php_strtolower(char *s, size_t len)
-{
- register int ch;
- char *c;
- size_t i;
-
- c = s;
- for (i=0; i<len; i++) {
- ch = tolower((unsigned char)*c);
- *c++ = ch;
- }
- return (s);
-}
-/* }}} */
-
-/* {{{ proto string strtolower(string str)
- Make a string lowercase */
-PHP_FUNCTION(strtolower)
-{
- zval **str;
- char *ret;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &str)) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(str);
-
- *return_value = **str;
- zval_copy_ctor(return_value);
- ret = php_strtolower(return_value->value.str.val, return_value->value.str.len);
-}
-/* }}} */
-
-/* {{{ php_basename
- */
-PHPAPI char *php_basename(char *s, size_t len)
-{
- char *ret=NULL, *c, *p=NULL, buf='\0';
- c = s + len - 1;
-
- /* strip trailing slashes */
- while (*c == '/'
-#ifdef PHP_WIN32
- || *c == '\\'
-#endif
- )
- c--;
- if(c < s+len-1) {
- buf = *(c + 1); /* Save overwritten char */
- *(c + 1) = '\0'; /* overwrite char */
- p = c + 1; /* Save pointer to overwritten char */
- }
-
- if ((c = strrchr(s, '/'))
-#ifdef PHP_WIN32
- || (c = strrchr(s, '\\'))
-#endif
- ) {
- ret = estrdup(c + 1);
- } else {
- ret = estrdup(s);
- }
- if(buf) *p = buf;
- return (ret);
-}
-/* }}} */
-
-/* {{{ proto string basename(string path)
- Return the filename component of the path */
-PHP_FUNCTION(basename)
-{
- zval **str;
- char *ret;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &str)) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(str);
- ret = php_basename(Z_STRVAL_PP(str), Z_STRLEN_PP(str));
- RETVAL_STRING(ret, 0)
-}
-/* }}} */
-
-/* {{{ php_dirname
- *
- * This function doesn't work with absolute paths in Win32 such as C:\foo
- * (and it didn't before either). This needs to be fixed
- */
-PHPAPI void php_dirname(char *path, int len)
-{
- register char *end = path + len - 1;
-
- if (len <= 0) {
- /* Illegal use of this function */
- return;
- }
-
- /* Strip trailing slashes */
- while (end >= path && IS_SLASH(*end)) {
- end--;
- }
- if (end < path) {
- /* The path only contained slashes */
- path[0] = DEFAULT_SLASH;
- path[1] = '\0';
- return;
- }
-
- /* Strip filename */
- while (end >= path && !IS_SLASH(*end)) {
- end--;
- }
- if (end < path) {
- /* No slash found, therefore return '.' */
- path[0] = '.';
- path[1] = '\0';
- return;
- }
-
- /* Strip slashes which came before the file name */
- while (end >= path && IS_SLASH(*end)) {
- end--;
- }
- if (end < path) {
- path[0] = DEFAULT_SLASH;
- path[1] = '\0';
- return;
- }
- *(end+1) = '\0';
-}
-/* }}} */
-
-/* {{{ proto string dirname(string path)
- Return the directory name component of the path */
-PHP_FUNCTION(dirname)
-{
- zval **str;
- char *ret;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &str) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(str);
- ret = estrndup(Z_STRVAL_PP(str), Z_STRLEN_PP(str));
- php_dirname(ret, Z_STRLEN_PP(str));
- RETVAL_STRING(ret, 0);
-}
-/* }}} */
-
-/* {{{ proto array pathinfo(string path)
- Return information about a certain string */
-PHP_FUNCTION(pathinfo)
-{
- zval **path, **uopt, *tmp;
- char *ret;
- int argc = ZEND_NUM_ARGS(), opt, len;
-
- if (argc < 1 || argc > 2 ||
- zend_get_parameters_ex(argc, &path, &uopt) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(path);
- len = Z_STRLEN_PP(path);
-
- if (argc > 1) {
- convert_to_long_ex(uopt);
- opt = Z_LVAL_PP(uopt);
- if (opt < PHP_PATHINFO_DIRNAME || opt > PHP_PATHINFO_EXTENSION) {
- php_error(E_WARNING, "Invalid option in call to %s()",
- get_active_function_name());
- return;
- }
- }
-
- MAKE_STD_ZVAL(tmp);
- array_init(tmp);
-
- if (argc < 2 || opt == PHP_PATHINFO_DIRNAME) {
- ret = estrndup(Z_STRVAL_PP(path), len);
- php_dirname(ret, len);
- if (*ret)
- add_assoc_string(tmp, "dirname", ret, 1);
- efree(ret);
- }
-
- if (argc < 2 || opt == PHP_PATHINFO_BASENAME) {
- ret = php_basename(Z_STRVAL_PP(path), len);
- add_assoc_string(tmp, "basename", ret, 0);
- }
-
- if (argc < 2 || opt == PHP_PATHINFO_EXTENSION) {
- char *p;
- int idx;
-
- p = strrchr(Z_STRVAL_PP(path), '.');
- if (p) {
- idx = p - Z_STRVAL_PP(path);
- add_assoc_stringl(tmp, "extension", Z_STRVAL_PP(path) + idx + 1, len - idx - 1, 1);
- }
- }
-
- if (argc == 2) {
- zval **element;
- zend_hash_get_current_data(Z_ARRVAL_P(tmp), (void **)&element);
- *return_value = **element;
- } else {
- *return_value = *tmp;
- }
-
- zval_copy_ctor(return_value);
- zval_dtor(tmp);
- efree(tmp);
-}
-/* }}} */
-
-/* {{{ php_stristr
- * case insensitve strstr */
-PHPAPI char *php_stristr(unsigned char *s, unsigned char *t,
- size_t s_len, size_t t_len)
-{
- php_strtolower(s, s_len);
- php_strtolower(t, t_len);
- return php_memnstr(s, t, t_len, s + s_len);
-}
-/* }}} */
-
-/* {{{ php_strspn
- */
-PHPAPI size_t php_strspn(char *s1, char *s2, char *s1_end, char *s2_end)
-{
- register const char *p = s1, *spanp;
- register char c = *p;
-
-cont:
- for (spanp = s2; p != s1_end && spanp != s2_end;)
- if (*spanp++ == c) {
- c = *(++p);
- goto cont;
- }
- return (p - s1);
-}
-/* }}} */
-
-/* {{{ php_strcspn
- */
-PHPAPI size_t php_strcspn(char *s1, char *s2, char *s1_end, char *s2_end)
-{
- register const char *p, *spanp;
- register char c = *s1;
-
- for (p = s1;;) {
- spanp = s2;
- do {
- if (*spanp == c || p == s1_end)
- return (p - s1);
- } while (spanp++ < s2_end);
- c = *(++p);
- }
- /* NOTREACHED */
-}
-/* }}} */
-
-/* {{{ proto string stristr(string haystack, string needle)
- Find first occurrence of a string within another, case insensitive */
-PHP_FUNCTION(stristr)
-{
- zval **haystack, **needle;
- char *found = NULL;
- int found_offset;
- char *haystack_orig;
- char needle_char[2];
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &haystack, &needle) ==
- FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- SEPARATE_ZVAL(haystack);
- SEPARATE_ZVAL(needle);
- convert_to_string_ex(haystack);
- haystack_orig = estrndup((*haystack)->value.str.val,
- (*haystack)->value.str.len);
-
- if ((*needle)->type == IS_STRING) {
- if ((*needle)->value.str.len==0) {
- php_error(E_WARNING,"Empty delimiter");
- efree(haystack_orig);
- RETURN_FALSE;
- }
-
- found = php_stristr((*haystack)->value.str.val, (*needle)->value.str.val,
- (*haystack)->value.str.len, (*needle)->value.str.len);
- } else {
- convert_to_long_ex(needle);
- needle_char[0] = tolower((char) (*needle)->value.lval);
- needle_char[1] = '\0';
-
- found = php_stristr((*haystack)->value.str.val, needle_char,
- (*haystack)->value.str.len, 1);
- }
-
- if (found) {
- found_offset = found - (*haystack)->value.str.val;
- RETVAL_STRINGL(haystack_orig + found_offset,
- (*haystack)->value.str.len - found_offset, 1);
- } else {
- RETVAL_FALSE;
- }
- efree(haystack_orig);
-}
-/* }}} */
-
-/* {{{ proto string strstr(string haystack, string needle)
- Find first occurrence of a string within another */
-PHP_FUNCTION(strstr)
-{
- zval **haystack, **needle;
- char *haystack_end;
- char *found = NULL;
- char needle_char[2];
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &haystack, &needle) ==
- FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(haystack);
- haystack_end = (*haystack)->value.str.val + (*haystack)->value.str.len;
-
- if ((*needle)->type == IS_STRING) {
- if ((*needle)->value.str.len==0) {
- php_error(E_WARNING,"Empty delimiter");
- RETURN_FALSE;
- }
- found = php_memnstr((*haystack)->value.str.val, (*needle)->value.str.val,
- (*needle)->value.str.len, haystack_end);
- } else {
- convert_to_long_ex(needle);
- needle_char[0] = (char) (*needle)->value.lval;
- needle_char[1] = '\0';
- found = php_memnstr((*haystack)->value.str.val, needle_char, 1, haystack_end);
- }
-
-
- if (found) {
- RETVAL_STRING(found, 1);
- } else {
- RETVAL_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto string strchr(string haystack, string needle)
- An alias for strstr */
-/* }}} */
-
-/* {{{ proto int strpos(string haystack, string needle [, int offset])
- Find position of first occurrence of a string within another */
-PHP_FUNCTION(strpos)
-{
- zval **haystack, **needle, **OFFSET;
- int offset = 0;
- char *found = NULL;
- char *endp;
- char *startp;
-
- switch(ZEND_NUM_ARGS()) {
- case 2:
- if (zend_get_parameters_ex(2, &haystack, &needle) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- break;
- case 3:
- if (zend_get_parameters_ex(3, &haystack, &needle, &OFFSET) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(OFFSET);
- offset = (*OFFSET)->value.lval;
- if (offset < 0) {
- php_error(E_WARNING,"offset not contained in string");
- RETURN_FALSE;
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(haystack);
-
- if (offset > (*haystack)->value.str.len) {
- php_error(E_WARNING,"offset not contained in string");
- RETURN_FALSE;
- }
-
- startp = (*haystack)->value.str.val;
- startp+= offset;
-
- endp = (*haystack)->value.str.val;
- endp+= (*haystack)->value.str.len;
-
- if ((*needle)->type == IS_STRING) {
- if ((*needle)->value.str.len==0) {
- php_error(E_WARNING,"Empty delimiter");
- RETURN_FALSE;
- }
- found = php_memnstr(startp, (*needle)->value.str.val, (*needle)->value.str.len, endp);
- } else {
- char buf;
-
- convert_to_long_ex(needle);
- buf = (char) (*needle)->value.lval;
-
- found = php_memnstr(startp, &buf, 1, endp);
- }
-
- if (found) {
- RETVAL_LONG(found - (*haystack)->value.str.val);
- } else {
- RETVAL_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto int strrpos(string haystack, string needle)
- Find position of last occurrence of a character in a string within another */
-PHP_FUNCTION(strrpos)
-{
- zval **haystack, **needle;
- char *found = NULL;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &haystack, &needle) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(haystack);
-
- if ((*needle)->type == IS_STRING) {
- found = strrchr((*haystack)->value.str.val, *(*needle)->value.str.val);
- } else {
- convert_to_long_ex(needle);
- found = strrchr((*haystack)->value.str.val, (char) (*needle)->value.lval);
- }
-
- if (found) {
- RETVAL_LONG((*haystack)->value.str.len - strlen(found));
- } else {
- RETVAL_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto string strrchr(string haystack, string needle)
- Find the last occurrence of a character in a string within another */
-PHP_FUNCTION(strrchr)
-{
- zval **haystack, **needle;
- char *found = NULL;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &haystack, &needle) ==
- FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(haystack);
-
- if ((*needle)->type == IS_STRING) {
- found = strrchr((*haystack)->value.str.val, *(*needle)->value.str.val);
- } else {
-
- convert_to_long_ex(needle);
- found = strrchr((*haystack)->value.str.val, (*needle)->value.lval);
- }
-
-
- if (found) {
- RETVAL_STRING(found,1);
- } else {
- RETVAL_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ php_chunk_split
- */
-static char *php_chunk_split(char *src, int srclen, char *end, int endlen,
- int chunklen, int *destlen)
-{
- char *dest;
- char *p, *q;
- int chunks; /* complete chunks! */
- int restlen;
-
- chunks = srclen / chunklen;
- restlen = srclen - chunks * chunklen; /* srclen % chunklen */
-
- dest = emalloc((srclen + (chunks + 1) * endlen + 1) * sizeof(char));
-
- for(p = src, q = dest; p < (src + srclen - chunklen + 1); ) {
- memcpy(q, p, chunklen);
- q += chunklen;
- memcpy(q, end, endlen);
- q += endlen;
- p += chunklen;
- }
-
- if(restlen) {
- memcpy(q, p, restlen);
- q += restlen;
- memcpy(q, end, endlen);
- q += endlen;
- }
-
- *q = '\0';
- if (destlen) {
- *destlen = q - dest;
- }
-
- return(dest);
-}
-/* }}} */
-
-/* {{{ proto string chunk_split(string str [, int chunklen [, string ending]])
- Return split line */
-PHP_FUNCTION(chunk_split)
-{
- zval **p_str, **p_chunklen, **p_ending;
- int argc;
- char *result;
- char *end = "\r\n";
- int endlen = 2;
- int chunklen = 76;
- int result_len;
-
- argc = ZEND_NUM_ARGS();
-
- if (argc < 1 || argc > 3 ||
- zend_get_parameters_ex(argc, &p_str, &p_chunklen, &p_ending) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- switch(argc) {
- case 3:
- convert_to_string_ex(p_ending);
- end = (*p_ending)->value.str.val;
- endlen = (*p_ending)->value.str.len;
- case 2:
- convert_to_long_ex(p_chunklen);
- chunklen = (*p_chunklen)->value.lval;
- case 1:
- convert_to_string_ex(p_str);
- }
-
- if(chunklen <= 0) {
- php_error(E_WARNING, "Chunk length should be greater than zero");
- RETURN_FALSE;
- }
-
- if((*p_str)->value.str.len == 0) {
- RETURN_EMPTY_STRING();
- }
-
- result = php_chunk_split((*p_str)->value.str.val, (*p_str)->value.str.len,
- end, endlen, chunklen, &result_len);
-
- if(result) {
- RETVAL_STRINGL(result, result_len, 0);
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto string substr(string str, int start [, int length])
- Return part of a string */
-PHP_FUNCTION(substr)
-{
- zval **str, **from, **len;
- int argc, l;
- int f;
-
- argc = ZEND_NUM_ARGS();
-
- if ((argc == 2 && zend_get_parameters_ex(2, &str, &from) == FAILURE) ||
- (argc == 3 && zend_get_parameters_ex(3, &str, &from, &len) == FAILURE) ||
- argc < 2 || argc > 3) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(str);
- convert_to_long_ex(from);
- f = (*from)->value.lval;
-
- if (argc == 2) {
- l = (*str)->value.str.len;
- } else {
- convert_to_long_ex(len);
- l = (*len)->value.lval;
- }
-
- /* if "from" position is negative, count start position from the end
- * of the string
- */
- if (f < 0) {
- f = (*str)->value.str.len + f;
- if (f < 0) {
- f = 0;
- }
- }
-
- /* if "length" position is negative, set it to the length
- * needed to stop that many chars from the end of the string
- */
- if (l < 0) {
- l = ((*str)->value.str.len - f) + l;
- if (l < 0) {
- l = 0;
- }
- }
-
- if (f >= (int)(*str)->value.str.len) {
- RETURN_FALSE;
- }
-
- if((f+l) > (int)(*str)->value.str.len) {
- l = (int)(*str)->value.str.len - f;
- }
-
- RETVAL_STRINGL((*str)->value.str.val + f, l, 1);
-}
-/* }}} */
-
-/* {{{ proto string substr_replace(string str, string repl, int start [, int length])
- Replace part of a string with another string */
-PHP_FUNCTION(substr_replace)
-{
- zval** str;
- zval** from;
- zval** len;
- zval** repl;
- char* result;
- int result_len;
- int argc;
- int l;
- int f;
-
- argc = ZEND_NUM_ARGS();
-
- if ((argc == 3 && zend_get_parameters_ex(3, &str, &repl, &from) == FAILURE) ||
- (argc == 4 && zend_get_parameters_ex(4, &str, &repl, &from, &len) == FAILURE) ||
- argc < 3 || argc > 4) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(str);
- convert_to_string_ex(repl);
- convert_to_long_ex(from);
- f = (*from)->value.lval;
-
- if (argc == 3) {
- l = (*str)->value.str.len;
- } else {
- convert_to_long_ex(len);
- l = (*len)->value.lval;
- }
-
- /* if "from" position is negative, count start position from the end
- * of the string
- */
- if (f < 0) {
- f = (*str)->value.str.len + f;
- if (f < 0) {
- f = 0;
- }
- } else if (f > (int)(*str)->value.str.len)
- f = (int)(*str)->value.str.len;
-
-
- /* if "length" position is negative, set it to the length
- * needed to stop that many chars from the end of the string
- */
- if (l < 0) {
- l = ((*str)->value.str.len - f) + l;
- if (l < 0) {
- l = 0;
- }
- }
-
- if((f+l) > (int)(*str)->value.str.len) {
- l = (int)(*str)->value.str.len - f;
- }
-
- result_len = (*str)->value.str.len - l + (*repl)->value.str.len;
- result = (char *)ecalloc(result_len + 1, sizeof(char *));
-
- memcpy(result, (*str)->value.str.val, f);
- memcpy(&result[f], (*repl)->value.str.val, (*repl)->value.str.len);
- memcpy(&result[f + (*repl)->value.str.len], (*str)->value.str.val + f + l,
- (*str)->value.str.len - f - l);
-
- RETVAL_STRINGL(result, result_len, 0);
-}
-/* }}} */
-
-/* {{{ proto string quotemeta(string str)
- Quote meta characters */
-PHP_FUNCTION(quotemeta)
-{
- zval **arg;
- char *str, *old;
- char *old_end;
- char *p, *q;
- char c;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(arg);
-
- old = (*arg)->value.str.val;
- old_end = (*arg)->value.str.val + (*arg)->value.str.len;
-
- if (old == old_end) {
- RETURN_FALSE;
- }
-
- str = emalloc(2 * (*arg)->value.str.len + 1);
-
- for(p = old, q = str; p != old_end; p++) {
- c = *p;
- switch(c) {
- case '.':
- case '\\':
- case '+':
- case '*':
- case '?':
- case '[':
- case '^':
- case ']':
- case '$':
- case '(':
- case ')':
- *q++ = '\\';
- /* break is missing _intentionally_ */
- default:
- *q++ = c;
- }
- }
- *q = 0;
- RETVAL_STRINGL(erealloc(str, q - str + 1), q - str, 0);
-}
-/* }}} */
-
-/* {{{ proto int ord(string character)
- Return ASCII value of character */
-PHP_FUNCTION(ord)
-{
- zval **str;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &str) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(str);
- RETVAL_LONG((unsigned char)(*str)->value.str.val[0]);
-}
-/* }}} */
-
-/* {{{ proto string chr(int ascii)
- Convert ASCII code to a character */
-PHP_FUNCTION(chr)
-{
- zval **num;
- char temp[2];
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &num) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(num);
- temp[0] = (char) (*num)->value.lval;
- temp[1] = '\0';
- RETVAL_STRINGL(temp, 1,1);
-}
-/* }}} */
-
-/* {{{ proto string ucfirst(string str)
- Make a string's first character uppercase */
-PHP_FUNCTION(ucfirst)
-{
- zval **arg;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(arg);
-
- if (!*(*arg)->value.str.val) {
- RETURN_FALSE;
- }
-
- *return_value=**arg;
- zval_copy_ctor(return_value);
- *return_value->value.str.val = toupper((unsigned char)*return_value->value.str.val);
-}
-/* }}} */
-
-/* {{{ proto string ucwords(string str)
- Uppercase the first character of every word in a string */
-PHP_FUNCTION(ucwords)
-{
- zval **str;
- register char *r, *r_end;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &str) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(str);
-
- if (!Z_STRLEN_PP(str)) {
- RETURN_FALSE;
- }
- *return_value=**str;
- zval_copy_ctor(return_value);
-
- r=return_value->value.str.val;
- *r=toupper((unsigned char)*r);
- for(r_end = r + return_value->value.str.len - 1 ; r < r_end ; ) {
- if(isspace((int)*r++)) {
- *r=toupper((unsigned char)*r);
- }
- }
-}
-/* }}} */
-
-/* {{{ php_strtr
- */
-PHPAPI char *php_strtr(char *str, int len, char *str_from,
- char *str_to, int trlen)
-{
- int i;
- unsigned char xlat[256];
-
- if ((trlen < 1) || (len < 1)) {
- return str;
- }
-
- for (i = 0; i < 256; xlat[i] = i, i++);
-
- for (i = 0; i < trlen; i++) {
- xlat[(unsigned char) str_from[i]] = str_to[i];
- }
-
- for (i = 0; i < len; i++) {
- str[i] = xlat[(unsigned char) str[i]];
- }
-
- return str;
-}
-/* }}} */
-
-/* {{{ php_strtr_array
- */
-static void php_strtr_array(zval *return_value,char *str,int slen,HashTable *hash)
-{
- zval *entry;
- char *string_key;
- zval **trans;
- zval ctmp;
- ulong num_key;
- int minlen = 128*1024;
- int maxlen = 0, pos, len, found;
- char *key;
- HashPosition hpos;
- smart_str result = {0};
-
- zend_hash_internal_pointer_reset_ex(hash, &hpos);
- while (zend_hash_get_current_data_ex(hash, (void **)&entry, &hpos) == SUCCESS) {
- switch (zend_hash_get_current_key_ex(hash, &string_key, NULL, &num_key, 0, &hpos)) {
- case HASH_KEY_IS_STRING:
- len = strlen(string_key);
- if (len > maxlen) maxlen = len;
- if (len < minlen) minlen = len;
- break;
-
- case HASH_KEY_IS_LONG:
- ctmp.type = IS_LONG;
- ctmp.value.lval = num_key;
-
- convert_to_string(&ctmp);
- len = ctmp.value.str.len;
- zval_dtor(&ctmp);
-
- if (len > maxlen) maxlen = len;
- if (len < minlen) minlen = len;
- break;
- }
- zend_hash_move_forward_ex(hash, &hpos);
- }
-
- key = emalloc(maxlen+1);
- pos = 0;
-
- while (pos < slen) {
- if ((pos + maxlen) > slen) {
- maxlen = slen - pos;
- }
-
- found = 0;
- memcpy(key,str+pos,maxlen);
-
- for (len = maxlen; len >= minlen; len--) {
- key[ len ]=0;
-
- if (zend_hash_find(hash,key,len+1,(void**)&trans) == SUCCESS) {
- char *tval;
- int tlen;
- zval tmp;
-
- if ((*trans)->type != IS_STRING) {
- tmp = **trans;
- zval_copy_ctor(&tmp);
- convert_to_string(&tmp);
- tval = tmp.value.str.val;
- tlen = tmp.value.str.len;
- } else {
- tval = (*trans)->value.str.val;
- tlen = (*trans)->value.str.len;
- }
-
- smart_str_appendl(&result, tval, tlen);
- pos += len;
- found = 1;
-
- if ((*trans)->type != IS_STRING) {
- zval_dtor(&tmp);
- }
- break;
- }
- }
-
- if (! found) {
- smart_str_appendc(&result, str[pos++]);
- }
- }
-
- efree(key);
- smart_str_0(&result);
- RETVAL_STRINGL(result.c,result.len,0);
-}
-/* }}} */
-
-/* {{{ proto string strtr(string str, string from, string to)
- Translate characters in str using given translation tables */
-PHP_FUNCTION(strtr)
-{ /* strtr(STRING,FROM,TO) */
- zval **str, **from, **to;
- int ac = ZEND_NUM_ARGS();
-
- if (ac < 2 || ac > 3 || zend_get_parameters_ex(ac, &str, &from, &to) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if (ac == 2 && (*from)->type != IS_ARRAY) {
- php_error(E_WARNING,"arg2 must be passed an array");
- RETURN_FALSE;
- }
-
- convert_to_string_ex(str);
-
- /* shortcut for empty string */
- if(Z_STRLEN_PP(str) == 0) {
- RETURN_EMPTY_STRING();
- }
-
- if (ac == 2) {
- php_strtr_array(return_value,(*str)->value.str.val,(*str)->value.str.len,HASH_OF(*from));
- } else {
- convert_to_string_ex(from);
- convert_to_string_ex(to);
-
- *return_value=**str;
- zval_copy_ctor(return_value);
-
- php_strtr(return_value->value.str.val,
- return_value->value.str.len,
- (*from)->value.str.val,
- (*to)->value.str.val,
- MIN((*from)->value.str.len,(*to)->value.str.len));
- }
-}
-/* }}} */
-
-/* {{{ proto string strrev(string str)
- Reverse a string */
-PHP_FUNCTION(strrev)
-{
- zval **str;
- int i,len;
- char c;
-
- if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &str)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(str);
-
- *return_value = **str;
- zval_copy_ctor(return_value);
-
- len = return_value->value.str.len;
-
- for (i=0; i<len-1-i; i++) {
- c=return_value->value.str.val[i];
- return_value->value.str.val[i] = return_value->value.str.val[len-1-i];
- return_value->value.str.val[len-1-i]=c;
- }
-}
-/* }}} */
-
-/* {{{ php_similar_str
- */
-static void php_similar_str(const char *txt1, int len1, const char *txt2,
- int len2, int *pos1, int *pos2, int *max)
-{
- char *p, *q;
- char *end1 = (char *) txt1 + len1;
- char *end2 = (char *) txt2 + len2;
- int l;
-
- *max = 0;
- for (p = (char *) txt1; p < end1; p++) {
- for (q = (char *) txt2; q < end2; q++) {
- for (l = 0; (p + l < end1) && (q + l < end2) && (p[l] == q[l]);
- l++);
- if (l > *max) {
- *max = l;
- *pos1 = p - txt1;
- *pos2 = q - txt2;
- }
- }
- }
-}
-/* }}} */
-
-/* {{{ php_similar_char
- */
-static int php_similar_char(const char *txt1, int len1,
- const char *txt2, int len2)
-{
- int sum;
- int pos1, pos2, max;
-
- php_similar_str(txt1, len1, txt2, len2, &pos1, &pos2, &max);
- if ((sum = max)) {
- if (pos1 && pos2)
- sum += php_similar_char(txt1, pos1, txt2, pos2);
- if ((pos1 + max < len1) && (pos2 + max < len2))
- sum += php_similar_char(txt1 + pos1 + max, len1 - pos1 - max,
- txt2 + pos2 + max, len2 - pos2 - max);
- }
- return sum;
-}
-/* }}} */
-
-/* {{{ proto int similar_text(string str1, string str2 [, double percent])
- Calculates the similarity between two strings */
-PHP_FUNCTION(similar_text)
-{
- zval **t1, **t2, **percent;
- int ac = ZEND_NUM_ARGS();
- int sim;
-
- if (ac < 2 || ac > 3 ||
- zend_get_parameters_ex(ac, &t1, &t2, &percent) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(t1);
- convert_to_string_ex(t2);
- if (ac > 2) {
- convert_to_double_ex(percent);
- }
-
- if (((*t1)->value.str.len + (*t2)->value.str.len) == 0) {
- if(ac > 2) {
- (*percent)->value.dval = 0;
- }
- RETURN_LONG(0);
- }
-
- sim = php_similar_char((*t1)->value.str.val, (*t1)->value.str.len,
- (*t2)->value.str.val, (*t2)->value.str.len);
-
- if (ac > 2) {
- (*percent)->value.dval = sim * 200.0 / ((*t1)->value.str.len + (*t2)->value.str.len);
- }
-
- RETURN_LONG(sim);
-}
-/* }}} */
-
-/* {{{ php_stripslashes
- *
- * be careful, this edits the string in-place */
-PHPAPI void php_stripslashes(char *str, int *len)
-{
- char *s, *t;
- int l;
- char escape_char='\\';
- PLS_FETCH();
-
- if (PG(magic_quotes_sybase)) {
- escape_char='\'';
- }
-
- if (len != NULL) {
- l = *len;
- } else {
- l = strlen(str);
- }
- s = str;
- t = str;
- while (l > 0) {
- if (*t == escape_char) {
- t++; /* skip the slash */
- if (len != NULL)
- (*len)--;
- l--;
- if (l > 0) {
- if(*t=='0') {
- *s++='\0';
- t++;
- } else {
- *s++ = *t++; /* preserve the next character */
- }
- l--;
- }
- } else {
- if (s != t)
- *s++ = *t++;
- else {
- s++;
- t++;
- }
- l--;
- }
- }
- if (s != t) {
- *s = '\0';
- }
-}
-/* }}} */
-
-/* {{{ proto string addcslashes(string str, string charlist)
- Escape all chars mentioned in charlist with backslash. It creates octal representations if asked to backslash characters with 8th bit set or with ASCII<32 (except '\n', '\r', '\t' etc...) */
-PHP_FUNCTION(addcslashes)
-{
- zval **str, **what;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &str, &what) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(str);
- convert_to_string_ex(what);
-
- if(Z_STRLEN_PP(str) == 0) {
- RETURN_EMPTY_STRING();
- }
-
- if(Z_STRLEN_PP(what) == 0) {
- RETURN_STRINGL(Z_STRVAL_PP(str),Z_STRLEN_PP(str),1);
- }
-
- return_value->value.str.val = php_addcslashes((*str)->value.str.val,(*str)->value.str.len,&return_value->value.str.len,0,(*what)->value.str.val,(*what)->value.str.len);
- return_value->type = IS_STRING;
-}
-/* }}} */
-
-/* {{{ proto string addslashes(string str)
- Escape single quote, double quotes and backslash characters in a string with backslashes */
-PHP_FUNCTION(addslashes)
-{
- zval **str;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &str) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(str);
-
- if(Z_STRLEN_PP(str) == 0) {
- RETURN_EMPTY_STRING();
- }
-
- return_value->value.str.val = php_addslashes((*str)->value.str.val,(*str)->value.str.len,&return_value->value.str.len,0);
- return_value->type = IS_STRING;
-}
-/* }}} */
-
-/* {{{ proto string stripcslashes(string str)
- Strip backslashes from a string. Uses C-style conventions */
-PHP_FUNCTION(stripcslashes)
-{
- zval **str;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &str) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(str);
-
- *return_value = **str;
- zval_copy_ctor(return_value);
- php_stripcslashes(return_value->value.str.val,&return_value->value.str.len);
-}
-/* }}} */
-
-/* {{{ proto string stripslashes(string str)
- Strip backslashes from a string */
-PHP_FUNCTION(stripslashes)
-{
- zval **str;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &str) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(str);
-
- *return_value = **str;
- zval_copy_ctor(return_value);
- php_stripslashes(return_value->value.str.val,&return_value->value.str.len);
-}
-/* }}} */
-
-#ifndef HAVE_STRERROR
-/* {{{ php_strerror
- */
-char *php_strerror(int errnum)
-{
- extern int sys_nerr;
- extern char *sys_errlist[];
- BLS_FETCH();
-
- if ((unsigned int)errnum < sys_nerr) return(sys_errlist[errnum]);
- (void)sprintf(BG(str_ebuf), "Unknown error: %d", errnum);
- return(BG(str_ebuf));
-}
-/* }}} */
-#endif
-
-/* {{{ php_stripcslashes
- */
-PHPAPI void php_stripcslashes(char *str, int *len)
-{
- char *source,*target,*end;
- int nlen = *len, i;
- char numtmp[4];
-
- for (source=str,end=str+nlen,target=str; source<end; source++) {
- if (*source == '\\' && source+1<end) {
- source++;
- switch (*source) {
- case 'n': *target++='\n'; nlen--; break;
- case 'r': *target++='\r'; nlen--; break;
- case 'a': *target++='\a'; nlen--; break;
- case 't': *target++='\t'; nlen--; break;
- case 'v': *target++='\v'; nlen--; break;
- case 'b': *target++='\b'; nlen--; break;
- case 'f': *target++='\f'; nlen--; break;
- case '\\': *target++='\\'; nlen--; break;
- case 'x': if (source+1<end && isxdigit((int)(*(source+1)))) {
- numtmp[0] = *++source;
- if (source+1<end && isxdigit((int)(*(source+1)))) {
- numtmp[1] = *++source;
- numtmp[2] = '\0';
- nlen-=3;
- } else {
- numtmp[1] = '\0';
- nlen-=2;
- }
- *target++=(char)strtol(numtmp, NULL, 16);
- break;
- }
- /* break is left intentionally */
- default: i=0;
- while (source<end && *source>='0' && *source<='7' && i<3) {
- numtmp[i++] = *source++;
- }
- if (i) {
- numtmp[i]='\0';
- *target++=(char)strtol(numtmp, NULL, 8);
- nlen-=i;
- source--;
- } else {
- *target++=*source;
- nlen--;
- }
- }
- } else {
- *target++=*source;
- }
- }
-
- if(nlen != 0) {
- *target='\0';
- }
-
- *len = nlen;
-}
-/* }}} */
-
-/* {{{ php_addcslashes
- */
-PHPAPI char *php_addcslashes(char *str, int length, int *new_length, int should_free, char *what, int wlength)
-{
- char flags[256];
- char *new_str = emalloc((length?length:(length=strlen(str)))*4+1);
- char *source,*target;
- char *end;
- char c;
- int newlen;
-
- if (!wlength) {
- wlength = strlen(what);
- }
-
- if (!length) {
- length = strlen(str);
- }
-
- memset(flags, '\0', sizeof(flags));
- for (source=what,end=source+wlength; (c=*source) || source<end; source++) {
- if (source+3<end && *(source+1) == '.' && *(source+2) == '.' && (unsigned char)*(source+3)>=(unsigned char)c) {
- memset(flags+c, 1, (unsigned char)*(source+3)-(unsigned char)c+1);
- source+=3;
- } else
- flags[(unsigned char)c]=1;
- }
-
- for (source=str,end=source+length,target=new_str; (c=*source) || source<end; source++) {
- if (flags[(unsigned char)c]) {
- if ((unsigned char)c<32 || (unsigned char)c>126) {
- *target++ = '\\';
- switch (c) {
- case '\n': *target++ = 'n'; break;
- case '\t': *target++ = 't'; break;
- case '\r': *target++ = 'r'; break;
- case '\a': *target++ = 'a'; break;
- case '\v': *target++ = 'v'; break;
- case '\b': *target++ = 'b'; break;
- case '\f': *target++ = 'f'; break;
- default: target += sprintf(target, "%03o", (unsigned char)c);
- }
- continue;
- }
- *target++ = '\\';
- }
- *target++ = c;
- }
- *target = 0;
- newlen = target-new_str;
- if (target-new_str<length*4) {
- new_str = erealloc(new_str, newlen+1);
- }
- if (new_length) {
- *new_length = newlen;
- }
- if (should_free) {
- STR_FREE(str);
- }
- return new_str;
-}
-/* }}} */
-
-/* {{{ php_addslashes
- */
-PHPAPI char *php_addslashes(char *str, int length, int *new_length, int should_free)
-{
- /* maximum string length, worst case situation */
- char *new_str;
- char *source,*target;
- char *end;
- char c;
- PLS_FETCH();
-
- if (!str) {
- *new_length = 0;
- return str;
- }
- new_str = (char *) emalloc((length?length:(length=strlen(str)))*2+1);
- for (source=str,end=source+length,target=new_str; source<end; source++) {
- c = *source;
- switch(c) {
- case '\0':
- *target++ = '\\';
- *target++ = '0';
- break;
- case '\'':
- if (PG(magic_quotes_sybase)) {
- *target++ = '\'';
- *target++ = '\'';
- break;
- }
- /* break is missing *intentionally* */
- case '\"':
- case '\\':
- if (!PG(magic_quotes_sybase)) {
- *target++ = '\\';
- }
- /* break is missing *intentionally* */
- default:
- *target++ = c;
- break;
- }
- }
- *target = 0;
- if (new_length) {
- *new_length = target - new_str;
- }
- if (should_free) {
- STR_FREE(str);
- }
- return new_str;
-}
-/* }}} */
-
-#define _HEB_BLOCK_TYPE_ENG 1
-#define _HEB_BLOCK_TYPE_HEB 2
-#define isheb(c) (((((unsigned char) c)>=224) && (((unsigned char) c)<=250)) ? 1 : 0)
-#define _isblank(c) (((((unsigned char) c)==' ' || ((unsigned char) c)=='\t')) ? 1 : 0)
-#define _isnewline(c) (((((unsigned char) c)=='\n' || ((unsigned char) c)=='\r')) ? 1 : 0)
-
-/* {{{ php_char_to_str
- */
-PHPAPI void php_char_to_str(char *str,uint len,char from,char *to,int to_len,zval *result)
-{
- int char_count=0;
- char *source,*target,*tmp,*source_end=str+len, *tmp_end=NULL;
-
- for (source=str; source<source_end; source++) {
- if (*source==from) {
- char_count++;
- }
- }
-
- result->type = IS_STRING;
-
- if (char_count==0) {
- result->value.str.val = estrndup(str,len);
- result->value.str.len = len;
- return;
- }
-
- result->value.str.len = len+char_count*(to_len-1);
- result->value.str.val = target = (char *) emalloc(result->value.str.len+1);
-
- for (source=str; source<source_end; source++) {
- if (*source==from) {
- for (tmp=to,tmp_end=tmp+to_len; tmp<tmp_end; tmp++) {
- *target = *tmp;
- target++;
- }
- } else {
- *target = *source;
- target++;
- }
- }
- *target = 0;
-}
-/* }}} */
-
-/* {{{ php_str_to_str
- */
-PHPAPI char *php_str_to_str(char *haystack, int length,
- char *needle, int needle_len, char *str, int str_len, int *_new_length)
-{
- char *p;
- char *r;
- char *end = haystack + length;
- smart_str result = {0};
-
- for (p = haystack;
- (r = php_memnstr(p, needle, needle_len, end));
- p = r + needle_len) {
- smart_str_appendl(&result, p, r - p);
- smart_str_appendl(&result, str, str_len);
- }
-
- if (p < end)
- smart_str_appendl(&result, p, end - p);
-
- smart_str_0(&result);
-
- if (_new_length) *_new_length = result.len;
-
- return result.c;
-}
-/* }}} */
-
-/* {{{ php_str_replace_in_subject
- */
-static void php_str_replace_in_subject(zval *search, zval *replace, zval **subject, zval *result)
-{
- zval **search_entry,
- **replace_entry = NULL,
- temp_result;
- char *replace_value = NULL;
- int replace_len = 0;
-
- /* Make sure we're dealing with strings. */
- convert_to_string_ex(subject);
- Z_TYPE_P(result) = IS_STRING;
- if (Z_STRLEN_PP(subject) == 0) {
- ZVAL_STRINGL(result, empty_string, 0, 1);
- return;
- }
-
- /* If search is an array */
- if (Z_TYPE_P(search) == IS_ARRAY) {
- /* Duplicate subject string for repeated replacement */
- *result = **subject;
- zval_copy_ctor(result);
-
- zend_hash_internal_pointer_reset(Z_ARRVAL_P(search));
-
- if (Z_TYPE_P(replace) == IS_ARRAY) {
- zend_hash_internal_pointer_reset(Z_ARRVAL_P(replace));
- } else {
- /* Set replacement value to the passed one */
- replace_value = Z_STRVAL_P(replace);
- replace_len = Z_STRLEN_P(replace);
- }
-
- /* For each entry in the search array, get the entry */
- while (zend_hash_get_current_data(Z_ARRVAL_P(search), (void **)&search_entry) == SUCCESS) {
- /* Make sure we're dealing with strings. */
- convert_to_string_ex(search_entry);
- if(Z_STRLEN_PP(search_entry) == 0) {
- zend_hash_move_forward(Z_ARRVAL_P(search));
- continue;
- }
-
- /* If replace is an array. */
- if (Z_TYPE_P(replace) == IS_ARRAY) {
- /* Get current entry */
- if (zend_hash_get_current_data(Z_ARRVAL_P(replace), (void **)&replace_entry) == SUCCESS) {
- /* Make sure we're dealing with strings. */
- convert_to_string_ex(replace_entry);
-
- /* Set replacement value to the one we got from array */
- replace_value = Z_STRVAL_PP(replace_entry);
- replace_len = Z_STRLEN_PP(replace_entry);
-
- zend_hash_move_forward(Z_ARRVAL_P(replace));
- } else {
- /* We've run out of replacement strings, so use an empty one. */
- replace_value = empty_string;
- replace_len = 0;
- }
- }
-
- if(Z_STRLEN_PP(search_entry) == 1) {
- php_char_to_str(Z_STRVAL_P(result),
- Z_STRLEN_P(result),
- Z_STRVAL_PP(search_entry)[0],
- replace_value,
- replace_len,
- &temp_result);
- } else if (Z_STRLEN_PP(search_entry) > 1) {
- Z_STRVAL(temp_result) = php_str_to_str(Z_STRVAL_P(result), Z_STRLEN_P(result),
- Z_STRVAL_PP(search_entry), Z_STRLEN_PP(search_entry),
- replace_value, replace_len, &Z_STRLEN(temp_result));
- }
-
- efree(Z_STRVAL_P(result));
- Z_STRVAL_P(result) = Z_STRVAL(temp_result);
- Z_STRLEN_P(result) = Z_STRLEN(temp_result);
-
- zend_hash_move_forward(Z_ARRVAL_P(search));
- }
- } else {
- if (Z_STRLEN_P(search) == 1) {
- php_char_to_str(Z_STRVAL_PP(subject),
- Z_STRLEN_PP(subject),
- Z_STRVAL_P(search)[0],
- Z_STRVAL_P(replace),
- Z_STRLEN_P(replace),
- result);
- } else if (Z_STRLEN_P(search) > 1) {
- Z_STRVAL_P(result) = php_str_to_str(Z_STRVAL_PP(subject), Z_STRLEN_PP(subject),
- Z_STRVAL_P(search), Z_STRLEN_P(search),
- Z_STRVAL_P(replace), Z_STRLEN_P(replace), &Z_STRLEN_P(result));
- } else {
- *result = **subject;
- zval_copy_ctor(result);
- }
- }
-}
-/* }}} */
-
-/* {{{ proto mixed str_replace(mixed search, mixed replace, mixed subject)
- Replace all occurrences of search in haystack with replace */
-PHP_FUNCTION(str_replace)
-{
- zval **subject, **search, **replace, **subject_entry;
- zval *result;
- char *string_key;
- ulong string_key_len, num_key;
-
- if(ZEND_NUM_ARGS() != 3 ||
- zend_get_parameters_ex(3, &search, &replace, &subject) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- SEPARATE_ZVAL(search);
- SEPARATE_ZVAL(replace);
- SEPARATE_ZVAL(subject);
-
- /* Make sure we're dealing with strings and do the replacement. */
- if (Z_TYPE_PP(search) != IS_ARRAY) {
- convert_to_string_ex(search);
- convert_to_string_ex(replace);
- } else if (Z_TYPE_PP(replace) != IS_ARRAY)
- convert_to_string_ex(replace);
-
- /* if subject is an array */
- if (Z_TYPE_PP(subject) == IS_ARRAY) {
- array_init(return_value);
- zend_hash_internal_pointer_reset(Z_ARRVAL_PP(subject));
-
- /* For each subject entry, convert it to string, then perform replacement
- and add the result to the return_value array. */
- while (zend_hash_get_current_data(Z_ARRVAL_PP(subject), (void **)&subject_entry) == SUCCESS) {
- MAKE_STD_ZVAL(result);
- php_str_replace_in_subject(*search, *replace, subject_entry, result);
- /* Add to return array */
- switch(zend_hash_get_current_key_ex(Z_ARRVAL_PP(subject), &string_key,
- &string_key_len, &num_key, 0, NULL)) {
- case HASH_KEY_IS_STRING:
- add_assoc_zval_ex(return_value, string_key, string_key_len, result);
- break;
-
- case HASH_KEY_IS_LONG:
- add_index_zval(return_value, num_key, result);
- break;
- }
-
- zend_hash_move_forward(Z_ARRVAL_PP(subject));
- }
- } else { /* if subject is not an array */
- php_str_replace_in_subject(*search, *replace, subject, return_value);
- }
-}
-/* }}} */
-
-/* {{{ php_hebrev
- *
- * Converts Logical Hebrew text (Hebrew Windows style) to Visual text
- * Cheers/complaints/flames - Zeev Suraski <zeev@php.net>
- */
-static void php_hebrev(INTERNAL_FUNCTION_PARAMETERS,int convert_newlines)
-{
- zval **str,**max_chars_per_line;
- char *heb_str,*tmp,*target,*opposite_target,*broken_str;
- int block_start, block_end, block_type, block_length, i;
- int block_ended;
- long max_chars=0;
- int begin,end,char_count,orig_begin;
-
-
- switch(ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &str)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- case 2:
- if (zend_get_parameters_ex(2, &str, &max_chars_per_line)==FAILURE) {
- RETURN_FALSE;
- }
- convert_to_long_ex(max_chars_per_line);
- max_chars = (*max_chars_per_line)->value.lval;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- convert_to_string_ex(str);
-
- if ((*str)->value.str.len==0) {
- RETURN_FALSE;
- }
-
- tmp = (*str)->value.str.val;
- block_start=block_end=0;
- block_ended=0;
-
- heb_str = (char *) emalloc((*str)->value.str.len+1);
- target = heb_str+(*str)->value.str.len;
- opposite_target = heb_str;
- *target = 0;
- target--;
-
- block_length=0;
-
- if (isheb(*tmp)) {
- block_type = _HEB_BLOCK_TYPE_HEB;
- } else {
- block_type = _HEB_BLOCK_TYPE_ENG;
- }
-
- do {
- if (block_type==_HEB_BLOCK_TYPE_HEB) {
- while((isheb((int)*(tmp+1)) || _isblank((int)*(tmp+1)) || ispunct((int)*(tmp+1)) || (int)*(tmp+1)=='\n' ) && block_end<(*str)->value.str.len-1) {
- tmp++;
- block_end++;
- block_length++;
- }
- for (i=block_start; i<=block_end; i++) {
- *target = (*str)->value.str.val[i];
- switch (*target) {
- case '(':
- *target = ')';
- break;
- case ')':
- *target = '(';
- break;
- default:
- break;
- }
- target--;
- }
- block_type = _HEB_BLOCK_TYPE_ENG;
- } else {
- while(!isheb(*(tmp+1)) && (int)*(tmp+1)!='\n' && block_end<(*str)->value.str.len-1) {
- tmp++;
- block_end++;
- block_length++;
- }
- while ((_isblank((int)*tmp) || ispunct((int)*tmp)) && *tmp!='/' && *tmp!='-' && block_end>block_start) {
- tmp--;
- block_end--;
- }
- for (i=block_end; i>=block_start; i--) {
- *target = (*str)->value.str.val[i];
- target--;
- }
- block_type = _HEB_BLOCK_TYPE_HEB;
- }
- block_start=block_end+1;
- } while(block_end<(*str)->value.str.len-1);
-
-
- broken_str = (char *) emalloc((*str)->value.str.len+1);
- begin=end=(*str)->value.str.len-1;
- target = broken_str;
-
- while (1) {
- char_count=0;
- while ((!max_chars || char_count<max_chars) && begin>0) {
- char_count++;
- begin--;
- if (begin<=0 || _isnewline(heb_str[begin])) {
- while(begin>0 && _isnewline(heb_str[begin-1])) {
- begin--;
- char_count++;
- }
- break;
- }
- }
- if (char_count==max_chars) { /* try to avoid breaking words */
- int new_char_count=char_count, new_begin=begin;
-
- while (new_char_count>0) {
- if (_isblank(heb_str[new_begin]) || _isnewline(heb_str[new_begin])) {
- break;
- }
- new_begin++;
- new_char_count--;
- }
- if (new_char_count>0) {
- char_count=new_char_count;
- begin=new_begin;
- }
- }
- orig_begin=begin;
-
- if (_isblank(heb_str[begin])) {
- heb_str[begin]='\n';
- }
- while (begin<=end && _isnewline(heb_str[begin])) { /* skip leading newlines */
- begin++;
- }
- for (i=begin; i<=end; i++) { /* copy content */
- *target = heb_str[i];
- target++;
- }
- for (i=orig_begin; i<=end && _isnewline(heb_str[i]); i++) {
- *target = heb_str[i];
- target++;
- }
- begin=orig_begin;
-
- if (begin<=0) {
- *target = 0;
- break;
- }
- begin--;
- end=begin;
- }
- efree(heb_str);
-
- if (convert_newlines) {
- php_char_to_str(broken_str,(*str)->value.str.len,'\n',"<br>\n",5,return_value);
- efree(broken_str);
- } else {
- return_value->value.str.val = broken_str;
- return_value->value.str.len = (*str)->value.str.len;
- return_value->type = IS_STRING;
- }
-}
-/* }}} */
-
-/* {{{ proto string hebrev(string str [, int max_chars_per_line])
- Convert logical Hebrew text to visual text */
-PHP_FUNCTION(hebrev)
-{
- php_hebrev(INTERNAL_FUNCTION_PARAM_PASSTHRU,0);
-}
-/* }}} */
-
-/* {{{ proto string hebrevc(string str [, int max_chars_per_line])
- Convert logical Hebrew text to visual text with newline conversion */
-PHP_FUNCTION(hebrevc)
-{
- php_hebrev(INTERNAL_FUNCTION_PARAM_PASSTHRU,1);
-}
-/* }}} */
-
-/* {{{ proto string nl2br(string str)
- Converts newlines to HTML line breaks */
-PHP_FUNCTION(nl2br)
-{
- zval **str;
-
- if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &str)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(str);
-
- php_char_to_str((*str)->value.str.val,(*str)->value.str.len,'\n',"<br />\n",7,return_value);
-}
-/* }}} */
-
-/* {{{ proto string strip_tags(string str [, string allowable_tags])
- Strips HTML and PHP tags from a string */
-PHP_FUNCTION(strip_tags)
-{
- char *buf;
- zval **str, **allow=NULL;
- char *allowed_tags=NULL;
- int allowed_tags_len=0;
-
- switch(ZEND_NUM_ARGS()) {
- case 1:
- if(zend_get_parameters_ex(1, &str)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- case 2:
- if(zend_get_parameters_ex(2, &str, &allow)==FAILURE) {
- RETURN_FALSE;
- }
- convert_to_string_ex(allow);
- allowed_tags = (*allow)->value.str.val;
- allowed_tags_len = (*allow)->value.str.len;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- convert_to_string_ex(str);
- buf = estrndup((*str)->value.str.val,(*str)->value.str.len);
- php_strip_tags(buf, (*str)->value.str.len, 0, allowed_tags, allowed_tags_len);
- RETURN_STRING(buf, 0);
-}
-/* }}} */
-
-/* {{{ proto string setlocale(mixed category, string locale)
- Set locale information */
-PHP_FUNCTION(setlocale)
-{
- zval **pcategory, **plocale;
- zval *category, *locale;
- int cat;
- char *loc, *retval;
- BLS_FETCH();
-
- if (ZEND_NUM_ARGS()!=2 || zend_get_parameters_ex(2, &pcategory, &plocale)==FAILURE)
- WRONG_PARAM_COUNT;
-#ifdef HAVE_SETLOCALE
- convert_to_string_ex(plocale);
- locale = *plocale;
-
- if (Z_TYPE_PP(pcategory) == IS_LONG) {
- convert_to_long_ex(pcategory);
- cat = Z_LVAL_PP(pcategory);
- } else { /* FIXME: The following behaviour should be removed. */
- php_error(E_NOTICE,"Passing locale category name as string is deprecated. Use the LC_* -constants instead.");
- convert_to_string_ex(pcategory);
- category = *pcategory;
-
- if (!strcasecmp ("LC_ALL", category->value.str.val))
- cat = LC_ALL;
- else if (!strcasecmp ("LC_COLLATE", category->value.str.val))
- cat = LC_COLLATE;
- else if (!strcasecmp ("LC_CTYPE", category->value.str.val))
- cat = LC_CTYPE;
-#ifdef LC_MESSAGES
- else if (!strcasecmp ("LC_MESSAGES", category->value.str.val))
- cat = LC_MESSAGES;
-#endif
- else if (!strcasecmp ("LC_MONETARY", category->value.str.val))
- cat = LC_MONETARY;
- else if (!strcasecmp ("LC_NUMERIC", category->value.str.val))
- cat = LC_NUMERIC;
- else if (!strcasecmp ("LC_TIME", category->value.str.val))
- cat = LC_TIME;
- else {
- php_error(E_WARNING,"Invalid locale category name %s, must be one of LC_ALL, LC_COLLATE, LC_CTYPE, LC_MONETARY, LC_NUMERIC or LC_TIME", category->value.str.val);
- RETURN_FALSE;
- }
- }
- if (!strcmp ("0", locale->value.str.val)) {
- loc = NULL;
- } else {
- loc = locale->value.str.val;
- }
-
- retval = setlocale (cat, loc);
- if (retval) {
- /* Remember if locale was changed */
- if (loc) {
- STR_FREE(BG(locale_string));
- BG(locale_string) = estrdup(retval);
- }
-
- RETVAL_STRING(retval,1);
- return;
- }
-#endif
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto void parse_str(string encoded_string, [array result])
- Parses GET/POST/COOKIE data and sets global variables */
-PHP_FUNCTION(parse_str)
-{
- zval **arg;
- zval **arrayArg;
- zval *sarg;
- char *res = NULL;
- int argCount;
- int old_rg;
-
- PLS_FETCH();
- SLS_FETCH();
-
- argCount = ARG_COUNT(ht);
- if(argCount < 1 || argCount > 2 || zend_get_parameters_ex(argCount, &arg, &arrayArg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(arg);
- sarg = *arg;
- if (sarg->value.str.val && *sarg->value.str.val) {
- res = estrndup(sarg->value.str.val, sarg->value.str.len);
- }
-
- old_rg = PG(register_globals);
- if(argCount == 1) {
- PG(register_globals) = 1;
- php_treat_data(PARSE_STRING, res, NULL ELS_CC PLS_CC SLS_CC);
- } else {
- PG(register_globals) = 0;
- /* Clear out the array that was passed in. */
- zval_dtor(*arrayArg);
- array_init(*arrayArg);
-
- php_treat_data(PARSE_STRING, res, *arrayArg ELS_CC PLS_CC SLS_CC);
- }
- PG(register_globals) = old_rg;
-}
-/* }}} */
-
-#define PHP_TAG_BUF_SIZE 1023
-
-/* {{{ php_tag_find
- *
- * Check if tag is in a set of tags
- *
- * states:
- *
- * 0 start tag
- * 1 first non-whitespace char seen
- */
-int php_tag_find(char *tag, int len, char *set) {
- char c, *n, *t;
- int state=0, done=0;
- char *norm = emalloc(len+1);
-
- n = norm;
- t = tag;
- c = tolower(*t);
- /*
- normalize the tag removing leading and trailing whitespace
- and turn any <a whatever...> into just <a> and any </tag>
- into <tag>
- */
- if (!len) {
- return 0;
- }
- while(!done) {
- switch(c) {
- case '<':
- *(n++) = c;
- break;
- case '>':
- done =1;
- break;
- default:
- if(!isspace((int)c)) {
- if(state==0) {
- state=1;
- if(c!='/') *(n++) = c;
- } else {
- *(n++) = c;
- }
- } else {
- if(state==1) done=1;
- }
- break;
- }
- c = tolower(*(++t));
- }
- *(n++) = '>';
- *n = '\0';
- if(strstr(set,norm)) {
- done=1;
- } else {
- done=0;
- }
- efree(norm);
- return done;
-}
-/* }}} */
-
-/* {{{ php_strip_tags
-
- A simple little state-machine to strip out html and php tags
-
- State 0 is the output state, State 1 means we are inside a
- normal html tag and state 2 means we are inside a php tag.
-
- The state variable is passed in to allow a function like fgetss
- to maintain state across calls to the function.
-
- lc holds the last significant character read and br is a bracket
- counter.
-
- When an allow string is passed in we keep track of the string
- in state 1 and when the tag is closed check it against the
- allow string to see if we should allow it.
-*/
-PHPAPI void php_strip_tags(char *rbuf, int len, int state, char *allow, int allow_len)
-{
- char *tbuf, *buf, *p, *tp, *rp, c, lc;
- int br, i=0;
-
- buf = estrndup(rbuf,len);
- c = *buf;
- lc = '\0';
- p = buf;
- rp = rbuf;
- br = 0;
- if(allow) {
- php_strtolower(allow, allow_len);
- tbuf = emalloc(PHP_TAG_BUF_SIZE+1);
- tp = tbuf;
- } else {
- tbuf = tp = NULL;
- }
-
- while(i<len) {
- switch (c) {
- case '<':
- if (state == 0) {
- lc = '<';
- state = 1;
- if(allow) {
- *(tp++) = '<';
- }
- }
- break;
-
- case '(':
- if (state == 2) {
- if (lc != '\"') {
- lc = '(';
- br++;
- }
- } else if (allow && state == 1) {
- *(tp++) = c;
- } else if (state == 0) {
- *(rp++) = c;
- }
- break;
-
- case ')':
- if (state == 2) {
- if (lc != '\"') {
- lc = ')';
- br--;
- }
- } else if (allow && state == 1) {
- *(tp++) = c;
- } else if (state == 0) {
- *(rp++) = c;
- }
- break;
-
- case '>':
- if (state == 1) {
- lc = '>';
- state = 0;
- if(allow) {
- *(tp++) = '>';
- *tp='\0';
- if(php_tag_find(tbuf, tp-tbuf, allow)) {
- memcpy(rp,tbuf,tp-tbuf);
- rp += tp-tbuf;
- }
- tp = tbuf;
- }
- } else if (state == 2) {
- if (!br && lc != '\"' && *(p-1)=='?') {
- state = 0;
- tp = tbuf;
- }
- } else {
- *(rp++) = c;
- }
- break;
-
- case '\"':
- if (state == 2) {
- if (lc == '\"') {
- lc = '\0';
- } else if (lc != '\\') {
- lc = '\"';
- }
- } else if (state == 0) {
- *(rp++) = c;
- } else if (allow && state == 1) {
- *(tp++) = c;
- }
- break;
-
- case '?':
- if (state==1 && *(p-1)=='<') {
- br=0;
- state=2;
- break;
- }
- /* fall-through */
-
- default:
- if (state == 0) {
- *(rp++) = c;
- } else if(allow && state == 1) {
- *(tp++) = c;
- if( (tp-tbuf)>=PHP_TAG_BUF_SIZE ) { /* no buffer overflows */
- tp = tbuf;
- }
- }
- break;
- }
- c = *(++p);
- i++;
- }
- *rp = '\0';
- efree(buf);
- if(allow) efree(tbuf);
-}
-/* }}} */
-
-/* {{{ proto string str_repeat(string input, int mult)
- Returns the input string repeat mult times */
-PHP_FUNCTION(str_repeat)
-{
- zval **input_str; /* Input string */
- zval **mult; /* Multiplier */
- char *result; /* Resulting string */
- int result_len; /* Length of the resulting string */
- int i;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &input_str, &mult) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- /* Make sure we're dealing with proper types */
- convert_to_string_ex(input_str);
- convert_to_long_ex(mult);
-
- if ((*mult)->value.lval < 0) {
- php_error(E_WARNING, "Second argument to %s() has to be greater than or equal to 0",
- get_active_function_name());
- return;
- }
-
- /* Don't waste our time if it's empty */
- if ((*input_str)->value.str.len == 0)
- RETURN_STRINGL(empty_string, 0, 1);
-
- /* ... or if the multiplier is zero */
- if ((*mult)->value.lval == 0)
- RETURN_STRINGL(empty_string, 0, 1);
-
- /* Initialize the result string */
- result_len = (*input_str)->value.str.len * (*mult)->value.lval;
- result = (char *)emalloc(result_len + 1);
-
- /* Copy the input string into the result as many times as necessary */
- for (i=0; i<(*mult)->value.lval; i++) {
- memcpy(result + (*input_str)->value.str.len * i,
- (*input_str)->value.str.val,
- (*input_str)->value.str.len);
- }
- result[result_len] = '\0';
-
- RETURN_STRINGL(result, result_len, 0);
-}
-/* }}} */
-
-/* {{{ proto mixed count_chars(string input [, int mode])
- Returns info about what characters are used in input */
-PHP_FUNCTION(count_chars)
-{
- zval **input, **mode;
- int chars[256];
- int ac=ZEND_NUM_ARGS();
- int mymode=0;
- unsigned char *buf;
- int len, inx;
- char retstr[256];
- int retlen=0;
-
- if (ac < 1 || ac > 2 || zend_get_parameters_ex(ac, &input, &mode) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(input);
-
- if (ac == 2) {
- convert_to_long_ex(mode);
- mymode = (*mode)->value.lval;
-
- if (mymode < 0 || mymode > 4) {
- php_error(E_WARNING, "unknown mode");
- RETURN_FALSE;
- }
- }
-
- len = (*input)->value.str.len;
- buf = (unsigned char *) (*input)->value.str.val;
- memset((void*) chars,0,sizeof(chars));
-
- while (len > 0) {
- chars[*buf]++;
- buf++;
- len--;
- }
-
- if (mymode < 3) {
- array_init(return_value);
- }
-
- for (inx=0; inx < 256; inx++) {
- switch (mymode) {
- case 0:
- add_index_long(return_value,inx,chars[inx]);
- break;
- case 1:
- if (chars[inx] != 0) {
- add_index_long(return_value,inx,chars[inx]);
- }
- break;
- case 2:
- if (chars[inx] == 0) {
- add_index_long(return_value,inx,chars[inx]);
- }
- break;
- case 3:
- if (chars[inx] != 0) {
- retstr[retlen++] = inx;
- }
- break;
- case 4:
- if (chars[inx] == 0) {
- retstr[retlen++] = inx;
- }
- break;
- }
- }
-
- if (mymode >= 3 && mymode <= 4) {
- RETURN_STRINGL(retstr,retlen,1);
- }
-}
-/* }}} */
-
-/* {{{ php_strnatcmp
- */
-static void php_strnatcmp(INTERNAL_FUNCTION_PARAMETERS, int fold_case)
-{
- zval **s1, **s2;
-
- if (ZEND_NUM_ARGS()!=2 || zend_get_parameters_ex(2, &s1, &s2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(s1);
- convert_to_string_ex(s2);
-
- RETURN_LONG(strnatcmp_ex((*s1)->value.str.val, (*s1)->value.str.len,
- (*s2)->value.str.val, (*s2)->value.str.len,
- fold_case));
-}
-/* }}} */
-
-/* {{{ proto int strnatcmp(string s1, string s2)
- Returns the result of string comparison using 'natural' algorithm */
-PHP_FUNCTION(strnatcmp)
-{
- php_strnatcmp(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-/* }}} */
-
-/* {{{ proto array localeconv( void )
- Returns numeric formatting information based on the current locale */
-PHP_FUNCTION(localeconv)
-{
- zval *grouping, *mon_grouping;
- int len, i;
-
- MAKE_STD_ZVAL(grouping);
- MAKE_STD_ZVAL(mon_grouping);
-
- /* We don't need no stinkin' parameters... */
- if (ZEND_NUM_ARGS() > 0) {
- WRONG_PARAM_COUNT;
- }
-
- if (array_init(return_value) == FAILURE) {
- RETURN_FALSE;
- }
-
- if (array_init(grouping) == FAILURE || array_init(mon_grouping) == FAILURE) {
- RETURN_FALSE;
- }
-
-#ifdef HAVE_LOCALECONV
- {
- struct lconv currlocdata;
-
- localeconv_r( &currlocdata );
-
- /* Grab the grouping data out of the array */
- len = strlen(currlocdata.grouping);
-
- for (i=0;i<len;i++) {
- add_index_long(grouping, i, currlocdata.grouping[i]);
- }
-
- /* Grab the monetary grouping data out of the array */
- len = strlen(currlocdata.mon_grouping);
-
- for (i=0;i<len;i++) {
- add_index_long(mon_grouping, i, currlocdata.mon_grouping[i]);
- }
-
- add_assoc_string(return_value, "decimal_point", currlocdata.decimal_point, 1);
- add_assoc_string(return_value, "thousands_sep", currlocdata.thousands_sep, 1);
- add_assoc_string(return_value, "int_curr_symbol", currlocdata.int_curr_symbol, 1);
- add_assoc_string(return_value, "currency_symbol", currlocdata.currency_symbol, 1);
- add_assoc_string(return_value, "mon_decimal_point", currlocdata.mon_decimal_point, 1);
- add_assoc_string(return_value, "mon_thousands_sep", currlocdata.mon_thousands_sep, 1);
- add_assoc_string(return_value, "positive_sign", currlocdata.positive_sign, 1);
- add_assoc_string(return_value, "negative_sign", currlocdata.negative_sign, 1);
- add_assoc_long( return_value, "int_frac_digits", currlocdata.int_frac_digits );
- add_assoc_long( return_value, "frac_digits", currlocdata.frac_digits );
- add_assoc_long( return_value, "p_cs_precedes", currlocdata.p_cs_precedes );
- add_assoc_long( return_value, "p_sep_by_space", currlocdata.p_sep_by_space );
- add_assoc_long( return_value, "n_cs_precedes", currlocdata.n_cs_precedes );
- add_assoc_long( return_value, "n_sep_by_space", currlocdata.n_sep_by_space );
- add_assoc_long( return_value, "p_sign_posn", currlocdata.p_sign_posn );
- add_assoc_long( return_value, "n_sign_posn", currlocdata.n_sign_posn );
- }
-#else
- /* Ok, it doesn't look like we have locale info floating around, so I guess it
- wouldn't hurt to just go ahead and return the POSIX locale information? */
-
- add_index_long(grouping, 0, -1);
- add_index_long(mon_grouping, 0, -1);
-
- add_assoc_string(return_value, "decimal_point", "\x2E", 1);
- add_assoc_string(return_value, "thousands_sep", "", 1);
- add_assoc_string(return_value, "int_curr_symbol", "", 1);
- add_assoc_string(return_value, "currency_symbol", "", 1);
- add_assoc_string(return_value, "mon_decimal_point", "\x2E", 1);
- add_assoc_string(return_value, "mon_thousands_sep", "", 1);
- add_assoc_string(return_value, "positive_sign", "", 1);
- add_assoc_string(return_value, "negative_sign", "", 1);
- add_assoc_long( return_value, "int_frac_digits", CHAR_MAX );
- add_assoc_long( return_value, "frac_digits", CHAR_MAX );
- add_assoc_long( return_value, "p_cs_precedes", CHAR_MAX );
- add_assoc_long( return_value, "p_sep_by_space", CHAR_MAX );
- add_assoc_long( return_value, "n_cs_precedes", CHAR_MAX );
- add_assoc_long( return_value, "n_sep_by_space", CHAR_MAX );
- add_assoc_long( return_value, "p_sign_posn", CHAR_MAX );
- add_assoc_long( return_value, "n_sign_posn", CHAR_MAX );
-#endif
-
- zend_hash_update(return_value->value.ht, "grouping", 9, &grouping, sizeof(zval *), NULL);
- zend_hash_update(return_value->value.ht, "mon_grouping", 13, &mon_grouping, sizeof(zval *), NULL);
-}
-/* }}} */
-
-/* {{{ proto int strnatcasecmp(string s1, string s2)
- Returns the result of case-insensitive string comparison using 'natural' algorithm */
-PHP_FUNCTION(strnatcasecmp)
-{
- php_strnatcmp(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
-}
-/* }}} */
-
-/* {{{ proto int substr_count(string haystack, string needle)
- Returns the number of times a substring occurs in the string */
-PHP_FUNCTION(substr_count)
-{
- zval **haystack, **needle;
- int i, length, count = 0;
- char *p, *endp, cmp;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &haystack, &needle) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(haystack);
- convert_to_string_ex(needle);
-
- if ((*needle)->value.str.len == 0) {
- php_error(E_WARNING, "Empty substring");
- RETURN_FALSE;
- } else if ((*needle)->value.str.len == 1) {
- /* Special optimized case to avoid calls to php_memnstr(). */
- for (i = 0, p = (*haystack)->value.str.val,
- length = (*haystack)->value.str.len, cmp = (*needle)->value.str.val[0];
- i < length; i++) {
- if (p[i] == cmp) {
- count++;
- }
- }
- } else {
- p = (*haystack)->value.str.val;
- endp = p + (*haystack)->value.str.len;
- while (p <= endp) {
- if( (p = php_memnstr(p, (*needle)->value.str.val, (*needle)->value.str.len, endp)) != NULL ) {
- p += (*needle)->value.str.len;
- count++;
- } else {
- break;
- }
- }
- }
-
- RETURN_LONG(count);
-}
-/* }}} */
-
-/* {{{ proto string str_pad(string input, int pad_length [, string pad_string [, int pad_type]])
- Returns input string padded on the left or right to specified length with pad_string */
-PHP_FUNCTION(str_pad)
-{
- /* Input arguments */
- zval **input, /* Input string */
- **pad_length, /* Length to pad to */
- **pad_string, /* Padding string */
- **pad_type; /* Padding type (left/right/both) */
-
- /* Helper variables */
- int num_pad_chars; /* Number of padding characters (total - input size) */
- char *result = NULL; /* Resulting string */
- int result_len = 0; /* Length of the resulting string */
- char *pad_str_val = " "; /* Pointer to padding string */
- int pad_str_len = 1; /* Length of the padding string */
- int pad_type_val = STR_PAD_RIGHT; /* The padding type value */
- int i, left_pad=0, right_pad=0;
-
-
- if (ZEND_NUM_ARGS() < 2 || ZEND_NUM_ARGS() > 4 ||
- zend_get_parameters_ex(ZEND_NUM_ARGS(), &input, &pad_length, &pad_string, &pad_type) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- /* Perform initial conversion to expected data types. */
- convert_to_string_ex(input);
- convert_to_long_ex(pad_length);
-
- num_pad_chars = Z_LVAL_PP(pad_length) - Z_STRLEN_PP(input);
-
- /* If resulting string turns out to be shorter than input string,
- we simply copy the input and return. */
- if (num_pad_chars < 0) {
- *return_value = **input;
- zval_copy_ctor(return_value);
- return;
- }
-
- /* Setup the padding string values if specified. */
- if (ZEND_NUM_ARGS() > 2) {
- convert_to_string_ex(pad_string);
- if (Z_STRLEN_PP(pad_string) == 0) {
- php_error(E_WARNING, "Padding string cannot be empty in %s()",
- get_active_function_name());
- return;
- }
- pad_str_val = Z_STRVAL_PP(pad_string);
- pad_str_len = Z_STRLEN_PP(pad_string);
-
- if (ZEND_NUM_ARGS() > 3) {
- convert_to_long_ex(pad_type);
- pad_type_val = Z_LVAL_PP(pad_type);
- if (pad_type_val < STR_PAD_LEFT || pad_type_val > STR_PAD_BOTH) {
- php_error(E_WARNING, "Padding type has to be STR_PAD_LEFT, STR_PAD_RIGHT, or STR_PAD_BOTH in %s()", get_active_function_name());
- return;
- }
- }
- }
-
- result = (char *)emalloc(Z_STRLEN_PP(input) + num_pad_chars + 1);
-
- /* We need to figure out the left/right padding lengths. */
- switch (pad_type_val) {
- case STR_PAD_RIGHT:
- left_pad = 0;
- right_pad = num_pad_chars;
- break;
-
- case STR_PAD_LEFT:
- left_pad = num_pad_chars;
- right_pad = 0;
- break;
-
- case STR_PAD_BOTH:
- left_pad = num_pad_chars / 2;
- right_pad = num_pad_chars - left_pad;
- break;
- }
-
- /* First we pad on the left. */
- for (i = 0; i < left_pad; i++)
- result[result_len++] = pad_str_val[i % pad_str_len];
-
- /* Then we copy the input string. */
- memcpy(result + result_len, Z_STRVAL_PP(input), Z_STRLEN_PP(input));
- result_len += Z_STRLEN_PP(input);
-
- /* Finally, we pad on the right. */
- for (i = 0; i < right_pad; i++)
- result[result_len++] = pad_str_val[i % pad_str_len];
-
- result[result_len] = '\0';
-
- RETURN_STRINGL(result, result_len, 0);
-}
-/* }}} */
-
-/* {{{ proto mixed sscanf(string str, string format [, string ...])
- Implements an ANSI C compatible sscanf */
-PHP_FUNCTION(sscanf)
-{
- zval **format;
- zval **literal;
- int result;
- zval ***args;
- int argCount;
-
-
- argCount = ZEND_NUM_ARGS();
- if (argCount < 2) {
- WRONG_PARAM_COUNT;
- }
- args = (zval ***)emalloc(argCount * sizeof(zval **));
- if (!args || (zend_get_parameters_array_ex(argCount,args) == FAILURE)) {
- efree( args );
- WRONG_PARAM_COUNT;
- }
-
- literal = args[0];
- format = args[1];
-
- convert_to_string_ex( format );
- convert_to_string_ex( literal );
-
- result = php_sscanf_internal( (*literal)->value.str.val,
- (*format)->value.str.val,
- argCount,args,
- 2,&return_value);
- efree(args);
-
- if (SCAN_ERROR_WRONG_PARAM_COUNT == result) {
- WRONG_PARAM_COUNT;
- }
-
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/standard/strnatcmp.c b/ext/standard/strnatcmp.c
deleted file mode 100644
index c21f5ce0aa..0000000000
--- a/ext/standard/strnatcmp.c
+++ /dev/null
@@ -1,173 +0,0 @@
-/* -*- mode: c; c-file-style: "k&r" -*-
-
- Modified for PHP by Andrei Zmievski <andrei@ispi.net>
-
- strnatcmp.c -- Perform 'natural order' comparisons of strings in C.
- Copyright (C) 2000 by Martin Pool <mbp@humbug.org.au>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-#include <ctype.h>
-#include <string.h>
-#include <assert.h>
-#include <stdio.h>
-
-#include "php.h"
-#include "php_string.h"
-
-#if defined(__GNUC__)
-# define UNUSED __attribute__((__unused__))
-#else
-# define UNUSED
-#endif
-
-static char const *version UNUSED =
- "$Id$";
-/* {{{ compare_right
- */
-static int
-compare_right(char const **a, char const *aend, char const **b, char const *bend)
-{
- int bias = 0;
-
- /* The longest run of digits wins. That aside, the greatest
- value wins, but we can't know that it will until we've scanned
- both numbers to know that they have the same magnitude, so we
- remember it in BIAS. */
- for(;; (*a)++, (*b)++) {
- if ((*a == aend || !isdigit((int)**a)) &&
- (*b == bend || !isdigit((int)**b)))
- return bias;
- else if (*a == aend || !isdigit((int)**a))
- return -1;
- else if (*b == bend || !isdigit((int)**b))
- return +1;
- else if (**a < **b) {
- if (!bias)
- bias = -1;
- } else if (**a > **b) {
- if (!bias)
- bias = +1;
- }
- }
-
- return 0;
-}
-/* }}} */
-
-/* {{{ compare_left
- */
-static int
-compare_left(char const **a, char const *aend, char const **b, char const *bend)
-{
- /* Compare two left-aligned numbers: the first to have a
- different value wins. */
- for(;; (*a)++, (*b)++) {
- if ((*a == aend || !isdigit((int)**a)) &&
- (*b == bend || !isdigit((int)**b)))
- return 0;
- else if (*a == aend || !isdigit((int)**a))
- return -1;
- else if (*b == bend || !isdigit((int)**b))
- return +1;
- else if (**a < **b)
- return -1;
- else if (**a > **b)
- return +1;
- }
-
- return 0;
-}
-/* }}} */
-
-/* {{{ strnatcmp_ex
- */
-PHPAPI int strnatcmp_ex(char const *a, size_t a_len, char const *b, size_t b_len, int fold_case)
-{
- char ca, cb;
- char const *ap, *bp;
- char const *aend = a + a_len,
- *bend = b + b_len;
- int fractional, result;
-
- if (a_len == 0 || b_len == 0)
- return a_len - b_len;
-
- ap = a;
- bp = b;
- while (1) {
- ca = *ap; cb = *bp;
-
- /* skip over leading spaces or zeros */
- while (isspace((int)ca))
- ca = *++ap;
-
- while (isspace((int)cb))
- cb = *++bp;
-
- /* process run of digits */
- if (isdigit((int)ca) && isdigit((int)cb)) {
- fractional = (ca == '0' || cb == '0');
-
- if (fractional)
- result = compare_left(&ap, aend, &bp, bend);
- else
- result = compare_right(&ap, aend, &bp, bend);
-
- if (result != 0)
- return result;
- else if (ap == aend && bp == bend)
- /* End of the strings. Let caller sort them out. */
- return 0;
- else {
- /* Keep on comparing from the current point. */
- ca = *ap; cb = *bp;
- }
- }
-
- if (fold_case) {
- ca = toupper(ca);
- cb = toupper(cb);
- }
-
- if (ca < cb)
- return -1;
- else if (ca > cb)
- return +1;
-
- ++ap; ++bp;
- if (ap == aend && bp == bend)
- /* The strings compare the same. Perhaps the caller
- will want to call strcmp to break the tie. */
- return 0;
- else if (ap == aend)
- return -1;
- else if (bp == bend)
- return 1;
- }
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/standard/syslog.c b/ext/standard/syslog.c
deleted file mode 100644
index 236c54cf88..0000000000
--- a/ext/standard/syslog.c
+++ /dev/null
@@ -1,281 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Stig Sæther Bakken <ssb@fast.no> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#include "php.h"
-
-#ifdef HAVE_SYSLOG_H
-#include "php_ini.h"
-#include "zend_globals.h"
-
-#include <stdlib.h>
-#if HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-
-#include <string.h>
-#include <errno.h>
-
-#include <stdio.h>
-#include "basic_functions.h"
-#include "php_ext_syslog.h"
-
-static void start_syslog(BLS_D);
-
-/* {{{ PHP_MINIT_FUNCTION
- */
-PHP_MINIT_FUNCTION(syslog)
-{
- /* error levels */
- REGISTER_LONG_CONSTANT("LOG_EMERG", LOG_EMERG, CONST_CS | CONST_PERSISTENT); /* system unusable */
- REGISTER_LONG_CONSTANT("LOG_ALERT", LOG_ALERT, CONST_CS | CONST_PERSISTENT); /* immediate action required */
- REGISTER_LONG_CONSTANT("LOG_CRIT", LOG_CRIT, CONST_CS | CONST_PERSISTENT); /* critical conditions */
- REGISTER_LONG_CONSTANT("LOG_ERR", LOG_ERR, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("LOG_WARNING", LOG_WARNING, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("LOG_NOTICE", LOG_NOTICE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("LOG_INFO", LOG_INFO, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("LOG_DEBUG", LOG_DEBUG, CONST_CS | CONST_PERSISTENT);
- /* facility: type of program logging the message */
- REGISTER_LONG_CONSTANT("LOG_KERN", LOG_KERN, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("LOG_USER", LOG_USER, CONST_CS | CONST_PERSISTENT); /* generic user level */
- REGISTER_LONG_CONSTANT("LOG_MAIL", LOG_MAIL, CONST_CS | CONST_PERSISTENT); /* log to email */
- REGISTER_LONG_CONSTANT("LOG_DAEMON", LOG_DAEMON, CONST_CS | CONST_PERSISTENT); /* other system daemons */
- REGISTER_LONG_CONSTANT("LOG_AUTH", LOG_AUTH, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("LOG_SYSLOG", LOG_SYSLOG, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("LOG_LPR", LOG_LPR, CONST_CS | CONST_PERSISTENT);
-#ifdef LOG_NEWS
- /* No LOG_NEWS on HP-UX */
- REGISTER_LONG_CONSTANT("LOG_NEWS", LOG_NEWS, CONST_CS | CONST_PERSISTENT); /* usenet new */
-#endif
-#ifdef LOG_UUCP
- /* No LOG_UUCP on HP-UX */
- REGISTER_LONG_CONSTANT("LOG_UUCP", LOG_UUCP, CONST_CS | CONST_PERSISTENT);
-#endif
-#ifdef LOG_CRON
- /* apparently some systems don't have this one */
- REGISTER_LONG_CONSTANT("LOG_CRON", LOG_CRON, CONST_CS | CONST_PERSISTENT);
-#endif
-#ifdef LOG_AUTHPRIV
- /* AIX doesn't have LOG_AUTHPRIV */
- REGISTER_LONG_CONSTANT("LOG_AUTHPRIV", LOG_AUTHPRIV, CONST_CS | CONST_PERSISTENT);
-#endif
-#if !defined(PHP_WIN32)
- REGISTER_LONG_CONSTANT("LOG_LOCAL0", LOG_LOCAL0, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("LOG_LOCAL1", LOG_LOCAL1, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("LOG_LOCAL2", LOG_LOCAL2, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("LOG_LOCAL3", LOG_LOCAL3, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("LOG_LOCAL4", LOG_LOCAL4, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("LOG_LOCAL5", LOG_LOCAL5, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("LOG_LOCAL6", LOG_LOCAL6, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("LOG_LOCAL7", LOG_LOCAL7, CONST_CS | CONST_PERSISTENT);
-#endif
- /* options */
- REGISTER_LONG_CONSTANT("LOG_PID", LOG_PID, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("LOG_CONS", LOG_CONS, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("LOG_ODELAY", LOG_ODELAY, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("LOG_NDELAY", LOG_NDELAY, CONST_CS | CONST_PERSISTENT);
-#ifdef LOG_NOWAIT
- REGISTER_LONG_CONSTANT("LOG_NOWAIT", LOG_NOWAIT, CONST_CS | CONST_PERSISTENT);
-#endif
-#ifdef LOG_PERROR
- /* AIX doesn't have LOG_PERROR */
- REGISTER_LONG_CONSTANT("LOG_PERROR", LOG_PERROR, CONST_CS | CONST_PERSISTENT); /*log to stderr*/
-#endif
-
- return SUCCESS;
-}
-/* }}} */
-
-PHP_RINIT_FUNCTION(syslog)
-{
- BLS_FETCH();
-
- if (INI_INT("define_syslog_variables")) {
- start_syslog(BLS_C);
- } else {
- BG(syslog_started)=0;
- }
- BG(syslog_device)=NULL;
- return SUCCESS;
-}
-
-
-PHP_RSHUTDOWN_FUNCTION(syslog)
-{
- BLS_FETCH();
-
- if (BG(syslog_device)) {
- efree(BG(syslog_device));
- }
- return SUCCESS;
-}
-
-/* {{{ start_syslog
- */
-static void start_syslog(BLS_D)
-{
- ELS_FETCH();
-
- /* error levels */
- SET_VAR_LONG("LOG_EMERG", LOG_EMERG); /* system unusable */
- SET_VAR_LONG("LOG_ALERT", LOG_ALERT); /* immediate action required */
- SET_VAR_LONG("LOG_CRIT", LOG_CRIT); /* critical conditions */
- SET_VAR_LONG("LOG_ERR", LOG_ERR);
- SET_VAR_LONG("LOG_WARNING", LOG_WARNING);
- SET_VAR_LONG("LOG_NOTICE", LOG_NOTICE);
- SET_VAR_LONG("LOG_INFO", LOG_INFO);
- SET_VAR_LONG("LOG_DEBUG", LOG_DEBUG);
- /* facility: type of program logging the message */
- SET_VAR_LONG("LOG_KERN", LOG_KERN);
- SET_VAR_LONG("LOG_USER", LOG_USER); /* generic user level */
- SET_VAR_LONG("LOG_MAIL", LOG_MAIL); /* log to email */
- SET_VAR_LONG("LOG_DAEMON", LOG_DAEMON); /* other system daemons */
- SET_VAR_LONG("LOG_AUTH", LOG_AUTH);
- SET_VAR_LONG("LOG_SYSLOG", LOG_SYSLOG);
- SET_VAR_LONG("LOG_LPR", LOG_LPR);
-#ifdef LOG_NEWS
- /* No LOG_NEWS on HP-UX */
- SET_VAR_LONG("LOG_NEWS", LOG_NEWS); /* usenet new */
-#endif
-#ifdef LOG_UUCP
- /* No LOG_UUCP on HP-UX */
- SET_VAR_LONG("LOG_UUCP", LOG_UUCP);
-#endif
-#ifdef LOG_CRON
- /* apparently some systems don't have this one */
- SET_VAR_LONG("LOG_CRON", LOG_CRON);
-#endif
-#ifdef LOG_AUTHPRIV
- /* AIX doesn't have LOG_AUTHPRIV */
- SET_VAR_LONG("LOG_AUTHPRIV", LOG_AUTHPRIV);
-#endif
-#if !defined(PHP_WIN32)
- SET_VAR_LONG("LOG_LOCAL0", LOG_LOCAL0);
- SET_VAR_LONG("LOG_LOCAL1", LOG_LOCAL1);
- SET_VAR_LONG("LOG_LOCAL2", LOG_LOCAL2);
- SET_VAR_LONG("LOG_LOCAL3", LOG_LOCAL3);
- SET_VAR_LONG("LOG_LOCAL4", LOG_LOCAL4);
- SET_VAR_LONG("LOG_LOCAL5", LOG_LOCAL5);
- SET_VAR_LONG("LOG_LOCAL6", LOG_LOCAL6);
- SET_VAR_LONG("LOG_LOCAL7", LOG_LOCAL7);
-#endif
- /* options */
- SET_VAR_LONG("LOG_PID", LOG_PID);
- SET_VAR_LONG("LOG_CONS", LOG_CONS);
- SET_VAR_LONG("LOG_ODELAY", LOG_ODELAY);
- SET_VAR_LONG("LOG_NDELAY", LOG_NDELAY);
-#ifdef LOG_NOWAIT
- /* BeOS doesn't have LOG_NOWAIT */
- SET_VAR_LONG("LOG_NOWAIT", LOG_NOWAIT);
-#endif
-#ifdef LOG_PERROR
- /* AIX doesn't have LOG_PERROR */
- SET_VAR_LONG("LOG_PERROR", LOG_PERROR); /*log to stderr*/
-#endif
-
- BG(syslog_started)=1;
-}
-/* }}} */
-
-/* {{{ proto void define_syslog_variables(void)
- Initializes all syslog-related variables */
-PHP_FUNCTION(define_syslog_variables)
-{
- BLS_FETCH();
-
- if (!BG(syslog_started)) {
- start_syslog(BLS_C);
- }
-}
-/* }}} */
-
-/* {{{ proto int openlog(string ident, int option, int facility)
- Open connection to system logger */
-/*
- ** OpenLog("nettopp", $LOG_PID, $LOG_LOCAL1);
- ** Syslog($LOG_EMERG, "help me!")
- ** CloseLog();
- */
-PHP_FUNCTION(openlog)
-{
- pval **ident, **option, **facility;
- BLS_FETCH();
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &ident, &option, &facility) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(ident);
- convert_to_long_ex(option);
- convert_to_long_ex(facility);
- if (BG(syslog_device)) {
- efree(BG(syslog_device));
- }
- BG(syslog_device) = estrndup((*ident)->value.str.val,(*ident)->value.str.len);
- openlog(BG(syslog_device), (*option)->value.lval, (*facility)->value.lval);
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int closelog(void)
- Close connection to system logger */
-PHP_FUNCTION(closelog)
-{
- BLS_FETCH();
-
- closelog();
- if (BG(syslog_device)) {
- efree(BG(syslog_device));
- BG(syslog_device)=NULL;
- }
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int syslog(int priority, string message)
- Generate a system log message */
-PHP_FUNCTION(syslog)
-{
- pval **priority, **message;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &priority, &message) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(priority);
- convert_to_string_ex(message);
-
- /*
- * CAVEAT: if the message contains patterns such as "%s",
- * this will cause problems.
- */
-
- php_syslog((*priority)->value.lval, "%.500s",(*message)->value.str.val);
- RETURN_TRUE;
-}
-/* }}} */
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/standard/tests/file/001.phpt b/ext/standard/tests/file/001.phpt
deleted file mode 100644
index 6c1410c805..0000000000
--- a/ext/standard/tests/file/001.phpt
+++ /dev/null
@@ -1,149 +0,0 @@
---TEST--
-File type functions
---POST--
---GET--
---FILE--
-<?php
-@unlink('test.file');
-@unlink('test.link');
-if (file_exists('test.file')) {
- echo "test.file exists\n";
-} else {
- echo "test.file does not exist\n";
-}
-fclose (fopen('test.file', 'w'));
-chmod ('test.file', 0654);
-if (file_exists('test.file')) {
- echo "test.file exists\n";
-} else {
- echo "test.file does not exist\n";
-}
-sleep (2);
-symlink('test.file','test.link');
-if (file_exists('test.link')) {
- echo "test.link exists\n";
-} else {
- echo "test.link does not exist\n";
-}
-if (is_link('test.file')) {
- echo "test.file is a symlink\n";
-} else {
- echo "test.file is not a symlink\n";
-}
-if (is_link('test.link')) {
- echo "test.link is a symlink\n";
-} else {
- echo "test.link is not a symlink\n";
-}
-if (file_exists('test.file')) {
- echo "test.file exists\n";
-} else {
- echo "test.file does not exist\n";
-}
-$s = stat ('test.file');
-$ls = lstat ('test.file');
-for ($i = 0; $i <= 12; $i++) {
- if ($ls[$i] != $s[$i]) {
- echo "test.file lstat and stat differ at element $i\n";
- }
-}
-$s = stat ('test.link');
-$ls = lstat ('test.link');
-for ($i = 0; $i <= 11; $i++) {
- if ($ls[$i] != $s[$i]) {
- if ($i != 6 && $i != 11) echo "test.link lstat and stat differ at element $i\n";
- }
-}
-echo "test.file is " . filetype('test.file') . "\n";
-echo "test.link is " . filetype('test.link') . "\n";
-printf ("test.file permissions are 0%o\n", 0777 & fileperms('test.file'));
-echo "test.file size is " . filesize('test.file') . "\n";
-if (is_writeable('test.file')) {
- echo "test.file is writeable\n";
-} else {
- echo "test.file is not writeable\n";
-}
-if (is_readable('test.file')) {
- echo "test.file is readable\n";
-} else {
- echo "test.file is not readable\n";
-}
-if (is_executable('test.file')) {
- echo "test.file is executable\n";
-} else {
- echo "test.file is not executable\n";
-}
-chmod ('test.file', 0644);
-clearstatcache();
-if (is_executable('test.file')) {
- echo "test.file is executable\n";
-} else {
- echo "test.file is not executable\n";
-}
-if (is_file('test.file')) {
- echo "test.file is a regular file\n";
-} else {
- echo "test.file is not a regular file\n";
-}
-if (is_file('test.link')) {
- echo "test.link is a regular file\n";
-} else {
- echo "test.link is not a regular file\n";
-}
-if (is_dir('test.link')) {
- echo "test.link is a directory\n";
-} else {
- echo "test.link is not a directory\n";
-}
-if (is_dir('../file')) {
- echo "../file is a directory\n";
-} else {
- echo "../file is not a directory\n";
-}
-if (is_dir('test.file')) {
- echo "test.file is a directory\n";
-} else {
- echo "test.file is not a directory\n";
-}
-unlink('test.file');
-unlink('test.link');
-if (file_exists('test.file')) {
- echo "test.file exists (cached)\n";
-} else {
- echo "test.file does not exist\n";
-}
-clearstatcache();
-if (file_exists('test.file')) {
- echo "test.file exists\n";
-} else {
- echo "test.file does not exist\n";
-}
-?>
---EXPECT--
-test.file does not exist
-test.file exists
-test.link exists
-test.file is not a symlink
-test.link is a symlink
-test.file exists
-test.link lstat and stat differ at element 1
-test.link lstat and stat differ at element 2
-test.link lstat and stat differ at element 7
-test.link lstat and stat differ at element 8
-test.link lstat and stat differ at element 9
-test.link lstat and stat differ at element 10
-test.file is file
-test.link is link
-test.file permissions are 0654
-test.file size is 0
-test.file is writeable
-test.file is readable
-test.file is not executable
-test.file is not executable
-test.file is a regular file
-test.link is a regular file
-test.link is not a directory
-../file is a directory
-test.file is not a directory
-test.file does not exist
-test.file does not exist
diff --git a/ext/standard/tests/general_functions/001.phpt b/ext/standard/tests/general_functions/001.phpt
deleted file mode 100644
index ee6d32f7f8..0000000000
--- a/ext/standard/tests/general_functions/001.phpt
+++ /dev/null
@@ -1,55 +0,0 @@
---TEST--
-sprintf() function
---POST--
---GET--
---FILE--
-<?php
-
-$agent = sprintf("%.5s", "James Bond, 007");
-
-echo("sprintf string truncate test: ");
-if ($agent == "James") {
- echo("passed\n");
-} else {
- echo("failed!\n");
-}
-
-echo("sprintf padding and align test: ");
-$test = sprintf("abc%04d %-20s%c", 20, "fisketur", 33);
-if ($test == "abc0020 fisketur !") {
- echo("passed\n");
-} else {
- echo("failed!\n");
-}
-
-echo("sprintf octal and hex test: ");
-$test = sprintf("%4o %4x %4X %0"."8x", 128, 1024, 49151, 3457925);
-if ($test == " 200 400 BFFF 0034c385") {
- echo("passed\n");
-} else {
- echo("failed!\n");
-}
-
-echo("sprintf octal binary test: ");
-$test = sprintf("%b", 3457925);
-if ($test == "1101001100001110000101") {
- echo("passed\n");
-} else {
- echo("failed!\n");
-}
-
-echo("sprintf float test: ");
-$test = sprintf("%0"."06.2f", 10000/3.0);
-if ($test == "003333.33") {
- echo("passed\n");
-} else {
- echo("failed!\n");
-}
-
-?>
---EXPECT--
-sprintf string truncate test: passed
-sprintf padding and align test: passed
-sprintf octal and hex test: passed
-sprintf octal binary test: passed
-sprintf float test: passed
diff --git a/ext/standard/tests/general_functions/002.phpt b/ext/standard/tests/general_functions/002.phpt
deleted file mode 100644
index d78bdb9afa..0000000000
--- a/ext/standard/tests/general_functions/002.phpt
+++ /dev/null
@@ -1,13 +0,0 @@
---TEST--
-quoted_printable_decode() function test
---POST--
---GET--
---FILE--
-<?php echo quoted_printable_decode("=FAwow-factor=C1=D0=D5=DD=C5=CE=CE=D9=C5=0A=
-=20=D4=CF=D2=C7=CF=D7=D9=C5=
-=20=
-=D0=
-=D2=CF=C5=CB=D4=D9"); ?>
---EXPECT--
-úwow-factorÁÐÕÝÅÎÎÙÅ
- ÔÏÒÇÏ×ÙÅ ÐÒÏÅËÔÙ \ No newline at end of file
diff --git a/ext/standard/tests/general_functions/003.phpt b/ext/standard/tests/general_functions/003.phpt
deleted file mode 100644
index 22cbd4eb4e..0000000000
--- a/ext/standard/tests/general_functions/003.phpt
+++ /dev/null
@@ -1,54 +0,0 @@
---TEST--
-levenshtein() function test
---POST--
---GET--
---FILE--
-<?php
-
-function test_me($title,$expect,$text1,$text2,$cost1=0,$cost2=0,$cost3=0) {
-
- if($cost1==0)
- $result=levenshtein($text1,$text2);
- else
- $result=levenshtein($text1,$text2,$cost1,$cost2,$cost3);
-
- if($result==$expect) return 0;
-
- echo "$title: result is $result instead of $expect ";
- echo "for '$text1'/'$text2' ";
- if($cost1) echo "($cost1:$cost2:$cost3)";
- echo "\n";
-
- return 1;
-}
-
-$n=0;
-
-$n += test_me("equal" , 0, "12345", "12345");
-$n += test_me("1st empty" , 3, "", "xzy");
-$n += test_me("2nd empty" , 3, "xzy", "");
-$n += test_me("both empty" , 0, "", "");
-$n += test_me("1 char" , 1, "1", "2");
-$n += test_me("2 char swap", 2, "12", "21");
-
-$n += test_me("inexpensive delete", 2, "2121", "11", 2, 1, 1);
-$n += test_me("expensive delete" , 10, "2121", "11", 2, 1, 5);
-$n += test_me("inexpensive insert", 2, "11", "2121", 1, 1, 1);
-$n += test_me("expensive insert" , 10, "11", "2121", 5, 1, 1);
-
-$n += test_me("expensive replace" , 3, "111", "121", 2, 3, 2);
-$n += test_me("very expensive replace", 4, "111", "121", 2, 9, 2);
-
-$n += test_me("bug #7368", 2, "13458", "12345");
-$n += test_me("bug #7368", 2, "1345", "1234");
-
-$n += test_me("bug #6562", 1, "debugg", "debug");
-$n += test_me("bug #6562", 1, "ddebug", "debug");
-$n += test_me("bug #6562", 2, "debbbug", "debug");
-$n += test_me("bug #6562", 1, "debugging", "debuging");
-
-echo ($n==0)?"all passed\n":"$n failed\n";
-
-?>
---EXPECT--
-all passed
diff --git a/ext/standard/tests/general_functions/004.data b/ext/standard/tests/general_functions/004.data
deleted file mode 100644
index 5dd0832842..0000000000
--- a/ext/standard/tests/general_functions/004.data
+++ /dev/null
@@ -1,4 +0,0 @@
-name value comment
-true 1 boolean true
-false 0 boolean false
-empty nothing
diff --git a/ext/standard/tests/general_functions/004.phpt b/ext/standard/tests/general_functions/004.phpt
deleted file mode 100644
index 0566502ab5..0000000000
--- a/ext/standard/tests/general_functions/004.phpt
+++ /dev/null
@@ -1,17 +0,0 @@
---TEST--
-fgetcsv() with tab delimited fields (BUG #8258)
---POST--
---GET--
---FILE--
-<?php
-$fp=fopen("004.data","r");
-while($a=fgetcsv($fp,100,"\t")) {
- echo join(",",$a)."\n";
-}
-fclose($fp);
-?>
---EXPECT--
-name,value,comment
-true,1,boolean true
-false,0,boolean false
-empty,,nothing
diff --git a/ext/standard/tests/general_functions/005.phpt b/ext/standard/tests/general_functions/005.phpt
deleted file mode 100644
index 329d46e764..0000000000
--- a/ext/standard/tests/general_functions/005.phpt
+++ /dev/null
@@ -1,26 +0,0 @@
---TEST--
-is_scalar() function test
---POST--
---GET--
---FILE--
-<?php
-class foo {}
-var_dump (is_scalar (TRUE));
-var_dump (is_scalar (1));
-var_dump (is_scalar (1.0));
-var_dump (is_scalar ("Hi!"));
-var_dump (is_scalar (NULL));
-var_dump (is_scalar (array ()));
-var_dump (is_scalar (new foo()));
-var_dump (is_scalar (opendir('.')));
-?>
---EXPECT--
-bool(true)
-bool(true)
-bool(true)
-bool(true)
-bool(false)
-bool(false)
-bool(false)
-bool(false)
-
diff --git a/ext/standard/tests/math/001.phpt b/ext/standard/tests/math/001.phpt
deleted file mode 100644
index dee4217342..0000000000
--- a/ext/standard/tests/math/001.phpt
+++ /dev/null
@@ -1,25 +0,0 @@
---TEST--
-Simple math tests
---POST--
---GET--
---FILE--
-<?php
- echo abs(-1) . "\n";
- echo abs(-1.5) . "\n";
- echo abs("-1") . "\n";
- echo abs("-1.5") . "\n";
- echo ceil(-1.5) . "\n";
- echo ceil(1.5) . "\n";
- echo floor(-1.5) . "\n";
- echo floor(1.5) . "\n";
-?>
---EXPECT--
-
-1
-1.5
-1
-1.5
--1
-2
--2
-1
diff --git a/ext/standard/tests/reg/001.phpt b/ext/standard/tests/reg/001.phpt
deleted file mode 100644
index f63c252518..0000000000
--- a/ext/standard/tests/reg/001.phpt
+++ /dev/null
@@ -1,9 +0,0 @@
---TEST--
-RegReplace test 1
---POST--
---GET--
---FILE--
-<?php $a="abc123";
- echo ereg_replace("123","def",$a)?>
---EXPECT--
-abcdef
diff --git a/ext/standard/tests/reg/002.phpt b/ext/standard/tests/reg/002.phpt
deleted file mode 100644
index a9b7aaa00a..0000000000
--- a/ext/standard/tests/reg/002.phpt
+++ /dev/null
@@ -1,9 +0,0 @@
---TEST--
-RegReplace test 2
---POST--
---GET--
---FILE--
-<?php $a="abc123";
- echo ereg_replace("123","",$a)?>
---EXPECT--
-abc
diff --git a/ext/standard/tests/reg/003.phpt b/ext/standard/tests/reg/003.phpt
deleted file mode 100644
index edd9c05969..0000000000
--- a/ext/standard/tests/reg/003.phpt
+++ /dev/null
@@ -1,10 +0,0 @@
---TEST--
-ereg_replace single-quote test
---POST--
---GET--
---FILE--
-<?php $a="\\'test";
- echo ereg_replace("\\\\'","'",$a)
-?>
---EXPECT--
-'test
diff --git a/ext/standard/tests/reg/004.phpt b/ext/standard/tests/reg/004.phpt
deleted file mode 100644
index 1f60ff4900..0000000000
--- a/ext/standard/tests/reg/004.phpt
+++ /dev/null
@@ -1,16 +0,0 @@
---TEST--
-simple ereg test
---POST--
---GET--
---FILE--
-<?php $a="This is a nice and simple string";
- if (ereg(".*nice and simple.*",$a)) {
- echo "ok\n";
- }
- if (!ereg(".*doesn't exist.*",$a)) {
- echo "ok\n";
- }
-?>
---EXPECT--
-ok
-ok
diff --git a/ext/standard/tests/reg/005.phpt b/ext/standard/tests/reg/005.phpt
deleted file mode 100644
index 78c0a0912a..0000000000
--- a/ext/standard/tests/reg/005.phpt
+++ /dev/null
@@ -1,20 +0,0 @@
---TEST--
-Test Regular expression register support in ereg
---POST--
---GET--
---FILE--
-<?php $a="This is a nice and simple string";
- echo ereg(".*(is).*(is).*",$a,$registers);
- echo "\n";
- echo $registers[0];
- echo "\n";
- echo $registers[1];
- echo "\n";
- echo $registers[2];
- echo "\n";
-?>
---EXPECT--
-32
-This is a nice and simple string
-is
-is
diff --git a/ext/standard/tests/reg/006.phpt b/ext/standard/tests/reg/006.phpt
deleted file mode 100644
index 50b6dbfd3a..0000000000
--- a/ext/standard/tests/reg/006.phpt
+++ /dev/null
@@ -1,10 +0,0 @@
---TEST--
-Test ereg_replace of start-of-line
---POST--
---GET--
---FILE--
-<?php $a="This is a nice and simple string";
- echo ereg_replace("^This","That",$a);
-?>
---EXPECT--
-That is a nice and simple string
diff --git a/ext/standard/tests/reg/007.phpt b/ext/standard/tests/reg/007.phpt
deleted file mode 100644
index b2646f842f..0000000000
--- a/ext/standard/tests/reg/007.phpt
+++ /dev/null
@@ -1,12 +0,0 @@
---TEST--
-Test empty result buffer in reg_replace
---POST--
---GET--
---FILE--
-<?php
- $a="abcd";
- $b=ereg_replace("abcd","",$a);
- echo "strlen(\$b)=".strlen($b);
-?>
---EXPECT--
-strlen($b)=0
diff --git a/ext/standard/tests/reg/008.phpt b/ext/standard/tests/reg/008.phpt
deleted file mode 100644
index db61d1ca07..0000000000
--- a/ext/standard/tests/reg/008.phpt
+++ /dev/null
@@ -1,10 +0,0 @@
---TEST--
-Test back-references in regular expressions
---POST--
---GET--
---FILE--
-<?php
- echo ereg_replace("([a-z]*)([-=+|]*)([0-9]+)","\\3 \\1 \\2\n","abc+-|=123");
-?>
---EXPECT--
-123 abc +-|=
diff --git a/ext/standard/tests/reg/009.phpt b/ext/standard/tests/reg/009.phpt
deleted file mode 100644
index 4996ef4c97..0000000000
--- a/ext/standard/tests/reg/009.phpt
+++ /dev/null
@@ -1,19 +0,0 @@
---TEST--
-Test split()
---POST--
---GET--
---FILE--
-<?php
- $a=split("[[:space:]]","this is a
-test");
- echo count($a) . "\n";
- for ($i = 0; $i < count($a); $i++) {
- echo $a[$i] . "\n";
- }
-?>
---EXPECT--
-4
-this
-is
-a
-test
diff --git a/ext/standard/tests/reg/010.phpt b/ext/standard/tests/reg/010.phpt
deleted file mode 100644
index 30d28fd02f..0000000000
--- a/ext/standard/tests/reg/010.phpt
+++ /dev/null
@@ -1,9 +0,0 @@
---TEST--
-Long back references
---POST--
---GET--
---FILE--
-<?php $a="abc122222222223";
- echo ereg_replace("1(2*)3","\\1def\\1",$a)?>
---EXPECT--
-abc2222222222def2222222222
diff --git a/ext/standard/tests/reg/011.phpt b/ext/standard/tests/reg/011.phpt
deleted file mode 100644
index 4eda774f58..0000000000
--- a/ext/standard/tests/reg/011.phpt
+++ /dev/null
@@ -1,9 +0,0 @@
---TEST--
-\0 back reference
---POST--
---GET--
---FILE--
-<?php $a="abc123";
- echo ereg_replace("123","def\\0ghi",$a)?>
---EXPECT--
-abcdef123ghi
diff --git a/ext/standard/tests/reg/012.phpt b/ext/standard/tests/reg/012.phpt
deleted file mode 100644
index d5342c7436..0000000000
--- a/ext/standard/tests/reg/012.phpt
+++ /dev/null
@@ -1,9 +0,0 @@
---TEST--
-nonexisting back reference
---POST--
---GET--
---FILE--
-<?php $a="abc123";
- echo ereg_replace("123",'def\1ghi',$a)?>
---EXPECT--
-abcdef\1ghi
diff --git a/ext/standard/tests/reg/013.phpt b/ext/standard/tests/reg/013.phpt
deleted file mode 100644
index ec3329fa7c..0000000000
--- a/ext/standard/tests/reg/013.phpt
+++ /dev/null
@@ -1,9 +0,0 @@
---TEST--
-escapes in replace string
---POST--
---GET--
---FILE--
-<?php $a="abc123";
- echo ereg_replace("123","def\\g\\\\hi\\",$a)?>
---EXPECT--
-abcdef\g\\hi\
diff --git a/ext/standard/tests/reg/014.phpt b/ext/standard/tests/reg/014.phpt
deleted file mode 100644
index ec4d19ed0e..0000000000
--- a/ext/standard/tests/reg/014.phpt
+++ /dev/null
@@ -1,9 +0,0 @@
---TEST--
-backreferences not replaced recursively
---POST--
---GET--
---FILE--
-<?php $a="a\\2bxc";
- echo ereg_replace("a(.*)b(.*)c","\\1",$a)?>
---EXPECT--
-\2
diff --git a/ext/standard/tests/reg/015.phpt b/ext/standard/tests/reg/015.phpt
deleted file mode 100644
index 961a60fa76..0000000000
--- a/ext/standard/tests/reg/015.phpt
+++ /dev/null
@@ -1,8 +0,0 @@
---TEST--
-replace empty matches
---POST--
---GET--
---FILE--
-<?php echo ereg_replace("^","z","abc123")?>
---EXPECT--
-zabc123
diff --git a/ext/standard/tests/reg/016.phpt b/ext/standard/tests/reg/016.phpt
deleted file mode 100644
index a24816f182..0000000000
--- a/ext/standard/tests/reg/016.phpt
+++ /dev/null
@@ -1,8 +0,0 @@
---TEST--
-test backslash handling in regular expressions
---POST--
---GET--
---FILE--
-<?php echo ereg_replace('\?',"abc","?123?")?>
---EXPECT--
-abc123abc
diff --git a/ext/standard/tests/time/001.phpt b/ext/standard/tests/time/001.phpt
deleted file mode 100644
index 004a498bac..0000000000
--- a/ext/standard/tests/time/001.phpt
+++ /dev/null
@@ -1,19 +0,0 @@
---TEST--
-microtime() function
---POST--
---GET--
---FILE--
-<?php
-$passed = 0;
-$failed = 0;
-for ($i=1;$i<=100000;$i++) {
- list($micro,$time)=explode(" ",microtime());
- $add=$micro+$time;
- $add<$last ? $failed++: $passed++;
- $last=$add; }
-echo "Passed: ".$passed."\n";
-echo "Failed: ".$failed."\n";
-?>
---EXPECT--
-Passed: 100000
-Failed: 0 \ No newline at end of file
diff --git a/ext/standard/tests/time/002.phpt b/ext/standard/tests/time/002.phpt
deleted file mode 100644
index 766af4d773..0000000000
--- a/ext/standard/tests/time/002.phpt
+++ /dev/null
@@ -1,40 +0,0 @@
---TEST--
-strtotime() function
---POST--
---GET--
---FILE--
-<?php
- echo "1999-10-13\n";
- echo strtotime ("1999-10-13")."\n";
- echo strtotime ("Oct 13 1999")."\n\n";
-
- echo "2000-01-19\n";
- echo strtotime ("2000-01-19")."\n";
- echo strtotime ("Jan 19 2000")."\n\n";
-
- echo "2001-12-21\n";
- echo strtotime ("2001-12-21")."\n";
- echo strtotime ("Dec 21 2001")."\n\n";
-
- echo "2001-12-21 12:16\n";
- echo strtotime ("2001-12-21 12:16")."\n";
- echo strtotime ("Dec 21 2001 12:16")."\n";
- echo strtotime ("Dec 21 12:16")."\n";
-?>
---EXPECT--
-1999-10-13
-939765600
-939765600
-
-2000-01-19
-948236400
-948236400
-
-2001-12-21
-1008889200
-1008889200
-
-2001-12-21 12:16
-1008933360
-1008933360
--1
diff --git a/ext/standard/type.c b/ext/standard/type.c
deleted file mode 100644
index b782df1c85..0000000000
--- a/ext/standard/type.c
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Rasmus Lerdorf <rasmus@php.net> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#include "php.h"
-#include "type.h"
-
-/* {{{ php_check_type
- * Determines if 'str' is an integer (long), real number or a string
- *
- * Note that leading zeroes automatically force a STRING type
- */
-int php_check_type(char *str)
-{
- char *s;
- int type = IS_LONG;
-
- s = str;
- if (*s == '0' && *(s + 1) && *(s + 1) != '.')
- return (IS_STRING);
- if (*s == '+' || *s == '-' || (*s >= '0' && *s <= '9') || *s == '.') {
- if (*s == '.')
- type = IS_DOUBLE;
- s++;
- while (*s) {
- if (*s >= '0' && *s <= '9') {
- s++;
- continue;
- } else if (*s == '.' && type == IS_LONG) {
- type = IS_DOUBLE;
- s++;
- continue;
- } else
- return (IS_STRING);
- }
- } else
- return (IS_STRING);
-
- return (type);
-} /* php_check_type */
-/* }}} */
-
-/* {{{ php_check_ident_type
- * 0 - simple variable
- * 1 - non-index array
- * 2 - index array
- */
-int php_check_ident_type(char *str)
-{
- char *s;
-
- if (!(s = (char *) strchr(str, '[')))
- return (GPC_REGULAR);
- s++;
- while (*s == ' ' || *s == '\t' || *s == '\n') {
- s++;
- }
- if (*s == ']') {
- return (GPC_NON_INDEXED_ARRAY);
- }
- return (GPC_INDEXED_ARRAY);
-}
-/* }}} */
-
-/* {{{ php_get_ident_index
- */
-char *php_get_ident_index(char *str)
-{
- char *temp;
- char *s, *t;
- char o;
-
- temp = emalloc(strlen(str));
- temp[0] = '\0';
- s = (char *) strchr(str, '[');
- if (s) {
- t = (char *) strrchr(str, ']');
- if (t) {
- o = *t;
- *t = '\0';
- strcpy(temp, s + 1);
- *t = o;
- }
- }
- return (temp);
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/standard/type.h b/ext/standard/type.h
deleted file mode 100644
index 20a351b041..0000000000
--- a/ext/standard/type.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef TYPE_H
-#define TYPE_H
-
-extern int php_check_type(char *str);
-extern int php_check_ident_type(char *str);
-extern char *php_get_ident_index(char *str);
-
-#define GPC_REGULAR 0x1
-#define GPC_INDEXED_ARRAY 0x2
-#define GPC_NON_INDEXED_ARRAY 0x4
-#define GPC_ARRAY (GPC_INDEXED_ARRAY | GPC_NON_INDEXED_ARRAY)
-
-#endif
diff --git a/ext/standard/uniqid.c b/ext/standard/uniqid.c
deleted file mode 100644
index 1af35de9d7..0000000000
--- a/ext/standard/uniqid.c
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Stig Sæther Bakken <ssb@guardian.no> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#include "php.h"
-
-#include <stdlib.h>
-#if HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-
-#include <string.h>
-#include <errno.h>
-
-#include <stdio.h>
-#ifdef PHP_WIN32
-#include "win32/time.h"
-#else
-#include <sys/time.h>
-#endif
-
-#include "php_lcg.h"
-#include "uniqid.h"
-
-#define MORE_ENTROPY (argc == 2 && (*flags)->value.lval)
-
-/* {{{ proto string uniqid(string prefix, [bool more_entropy])
- Generate a unique id */
-PHP_FUNCTION(uniqid)
-{
-#ifdef HAVE_GETTIMEOFDAY
- pval **prefix, **flags;
- char uniqid[138];
- int sec, usec, argc;
- struct timeval tv;
-
- argc = ZEND_NUM_ARGS();
- if (argc < 1 || argc > 2 || zend_get_parameters_ex(argc, &prefix, &flags)) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(prefix);
- if (argc == 2) {
- convert_to_boolean_ex(flags);
- }
-
- /* Do some bounds checking since we are using a char array. */
- if ((*prefix)->value.str.len > 114) {
- php_error(E_WARNING, "The prefix to uniqid should not be more than 114 characters.");
- return;
- }
-#if HAVE_USLEEP && !defined(PHP_WIN32)
- if (!MORE_ENTROPY) {
- usleep(1);
- }
-#endif
- gettimeofday((struct timeval *) &tv, (struct timezone *) NULL);
- sec = (int) tv.tv_sec;
- usec = (int) (tv.tv_usec % 1000000);
-
- /* The max value usec can have is 0xF423F, so we use only five hex
- * digits for usecs.
- */
- if (MORE_ENTROPY) {
- sprintf(uniqid, "%s%08x%05x%.8f", (*prefix)->value.str.val, sec, usec, php_combined_lcg() * 10);
- } else {
- sprintf(uniqid, "%s%08x%05x", (*prefix)->value.str.val, sec, usec);
- }
-
- RETURN_STRING(uniqid,1);
-#endif
-}
-/* }}} */
-
-function_entry uniqid_functions[] = {
- PHP_FE(uniqid, NULL)
- {NULL, NULL, NULL}
-};
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/standard/uniqid.h b/ext/standard/uniqid.h
deleted file mode 100644
index 9cf6345622..0000000000
--- a/ext/standard/uniqid.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Stig Sæther Bakken <ssb@guardian.no> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifndef UNIQID_H
-#define UNIQID_H
-
-PHP_FUNCTION(uniqid);
-
-#endif /* UNIQID_H */
diff --git a/ext/standard/url.c b/ext/standard/url.c
deleted file mode 100644
index 33af3cf777..0000000000
--- a/ext/standard/url.c
+++ /dev/null
@@ -1,470 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Jim Winstead (jimw@php.net) |
- +----------------------------------------------------------------------+
- */
-/* $Id$ */
-
-#include <stdlib.h>
-#include <string.h>
-#include <ctype.h>
-#include <sys/types.h>
-
-#include "php.h"
-
-#include "url.h"
-#ifdef _OSD_POSIX
-#ifndef APACHE
-#error On this EBCDIC platform, PHP is only supported as an Apache module.
-#else /*APACHE*/
-#ifndef CHARSET_EBCDIC
-#define CHARSET_EBCDIC /* this machine uses EBCDIC, not ASCII! */
-#endif
-#include "ebcdic.h"
-#endif /*APACHE*/
-#endif /*_OSD_POSIX*/
-
-/* {{{ free_url
- */
-PHPAPI void php_url_free(php_url *theurl)
-{
- if (theurl->scheme)
- efree(theurl->scheme);
- if (theurl->user)
- efree(theurl->user);
- if (theurl->pass)
- efree(theurl->pass);
- if (theurl->host)
- efree(theurl->host);
- if (theurl->path)
- efree(theurl->path);
- if (theurl->query)
- efree(theurl->query);
- if (theurl->fragment)
- efree(theurl->fragment);
- efree(theurl);
-}
-/* }}} */
-
-/* {{{ url_parse
- */
-PHPAPI php_url *php_url_parse(char *str)
-{
- regex_t re;
- regmatch_t subs[11];
- int err;
- int length = strlen(str);
- char *result;
-
- php_url *ret = (php_url *) emalloc(sizeof(php_url));
- if (!ret) {
- /*php_error(E_WARNING,"Unable to allocate memory\n");*/
- return NULL;
- }
- memset(ret, 0, sizeof(php_url));
-
- /* from Appendix B of draft-fielding-url-syntax-09,
- http://www.ics.uci.edu/~fielding/url/url.txt */
- err = regcomp(&re, "^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?", REG_EXTENDED);
- if (err) {
- /*php_error(E_WARNING,"Unable to compile regex: %d\n", err);*/
- efree(ret);
- return NULL;
- }
- err = regexec(&re, str, 10, subs, 0);
- if (err) {
- /*php_error(E_WARNING,"Error with regex\n");*/
- efree(ret);
- regfree(&re);
- return NULL;
- }
- /* no processing necessary on the scheme */
- if (subs[2].rm_so != -1 && subs[2].rm_so <= length) {
- ret->scheme = estrndup(str + subs[2].rm_so, subs[2].rm_eo - subs[2].rm_so);
- }
-
- /* the path to the resource */
- if (subs[5].rm_so != -1 && subs[5].rm_so <= length) {
- ret->path = estrndup(str + subs[5].rm_so, subs[5].rm_eo - subs[5].rm_so);
- }
-
- /* the query part */
- if (subs[7].rm_so != -1 && subs[7].rm_so <= length) {
- ret->query = estrndup(str + subs[7].rm_so, subs[7].rm_eo - subs[7].rm_so);
- }
-
- /* the fragment */
- if (subs[9].rm_so != -1 && subs[9].rm_so <= length) {
- ret->fragment = estrndup(str + subs[9].rm_so, subs[9].rm_eo - subs[9].rm_so);
- }
-
- /* extract the username, pass, and port from the hostname */
- if (subs[4].rm_so != -1 && subs[4].rm_so <= length) {
-
- int cerr;
- /* extract username:pass@host:port from regex results */
- result = estrndup(str + subs[4].rm_so, subs[4].rm_eo - subs[4].rm_so);
- length = strlen(result);
-
- regfree(&re); /* free the old regex */
-
- if ((cerr=regcomp(&re, "^(([^@:]+)(:([^@:]+))?@)?((\\[([^]]+)\\])|([^:@]+))(:([^:@]+))?", REG_EXTENDED))
- || (err=regexec(&re, result, 11, subs, 0))) {
- STR_FREE(ret->scheme);
- STR_FREE(ret->path);
- STR_FREE(ret->query);
- STR_FREE(ret->fragment);
- efree(ret);
- efree(result);
- /*php_error(E_WARNING,"Unable to compile regex: %d\n", err);*/
- if (!cerr) regfree(&re);
- return NULL;
- }
- /* now deal with all of the results */
- if (subs[2].rm_so != -1 && subs[2].rm_so < length) {
- ret->user = estrndup(result + subs[2].rm_so, subs[2].rm_eo - subs[2].rm_so);
- }
- if (subs[4].rm_so != -1 && subs[4].rm_so < length) {
- ret->pass = estrndup(result + subs[4].rm_so, subs[4].rm_eo - subs[4].rm_so);
- }
- if (subs[7].rm_so != -1 && subs[7].rm_so < length) {
- ret->host = estrndup(result + subs[7].rm_so, subs[7].rm_eo - subs[7].rm_so);
- } else if (subs[8].rm_so != -1 && subs[8].rm_so < length) {
- ret->host = estrndup(result + subs[8].rm_so, subs[8].rm_eo - subs[8].rm_so);
- }
- if (subs[10].rm_so != -1 && subs[10].rm_so < length) {
- ret->port = (unsigned short) strtol(result + subs[10].rm_so, NULL, 10);
- }
- efree(result);
- }
- else if (ret->scheme && !strcmp(ret->scheme, "http")) {
- STR_FREE(ret->scheme);
- STR_FREE(ret->path);
- STR_FREE(ret->query);
- STR_FREE(ret->fragment);
- efree(ret);
- regfree(&re);
- return NULL;
- }
- regfree(&re);
- return ret;
-}
-/* }}} */
-
-/* {{{ proto array parse_url(string url)
- Parse a URL and return its components */
-PHP_FUNCTION(parse_url)
-{
- pval **str;
- php_url *resource;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &str) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(str);
-
- resource = php_url_parse((*str)->value.str.val);
-
- if (resource == NULL) {
- php_error(E_WARNING, "unable to parse url (%s)", (*str)->value.str.val);
- RETURN_FALSE;
- }
- /* allocate an array for return */
- if (array_init(return_value) == FAILURE) {
- php_url_free(resource);
- RETURN_FALSE;
- }
- /* add the various elements to the array */
- if (resource->scheme != NULL)
- add_assoc_string(return_value, "scheme", resource->scheme, 1);
- if (resource->host != NULL)
- add_assoc_string(return_value, "host", resource->host, 1);
- if (resource->port != 0)
- add_assoc_long(return_value, "port", resource->port);
- if (resource->user != NULL)
- add_assoc_string(return_value, "user", resource->user, 1);
- if (resource->pass != NULL)
- add_assoc_string(return_value, "pass", resource->pass, 1);
- if (resource->path != NULL)
- add_assoc_string(return_value, "path", resource->path, 1);
- if (resource->query != NULL)
- add_assoc_string(return_value, "query", resource->query, 1);
- if (resource->fragment != NULL)
- add_assoc_string(return_value, "fragment", resource->fragment, 1);
- php_url_free(resource);
-}
-/* }}} */
-
-/* {{{ php_htoi
- */
-static int php_htoi(char *s)
-{
- int value;
- int c;
-
- c = s[0];
- if (isupper(c))
- c = tolower(c);
- value = (c >= '0' && c <= '9' ? c - '0' : c - 'a' + 10) * 16;
-
- c = s[1];
- if (isupper(c))
- c = tolower(c);
- value += c >= '0' && c <= '9' ? c - '0' : c - 'a' + 10;
-
- return (value);
-}
-/* }}} */
-
-/* rfc1738:
-
- ...The characters ";",
- "/", "?", ":", "@", "=" and "&" are the characters which may be
- reserved for special meaning within a scheme...
-
- ...Thus, only alphanumerics, the special characters "$-_.+!*'(),", and
- reserved characters used for their reserved purposes may be used
- unencoded within a URL...
-
- For added safety, we only leave -_. unencoded.
- */
-
-static unsigned char hexchars[] = "0123456789ABCDEF";
-
-/* {{{ php_url_encode
- */
-PHPAPI char *php_url_encode(char *s, int len, int *new_length)
-{
- register int x, y;
- unsigned char *str;
-
- str = (unsigned char *) emalloc(3 * strlen(s) + 1);
- for (x = 0, y = 0; len--; x++, y++) {
- str[y] = (unsigned char) s[x];
- if (str[y] == ' ') {
- str[y] = '+';
-#ifndef CHARSET_EBCDIC
- } else if ((str[y] < '0' && str[y] != '-' && str[y] != '.') ||
- (str[y] < 'A' && str[y] > '9') ||
- (str[y] > 'Z' && str[y] < 'a' && str[y] != '_') ||
- (str[y] > 'z')) {
- str[y++] = '%';
- str[y++] = hexchars[(unsigned char) s[x] >> 4];
- str[y] = hexchars[(unsigned char) s[x] & 15];
- }
-#else /*CHARSET_EBCDIC*/
- } else if (!isalnum(str[y]) && strchr("_-.", str[y]) == NULL) {
- /* Allow only alphanumeric chars and '_', '-', '.'; escape the rest */
- str[y++] = '%';
- str[y++] = hexchars[os_toascii[(unsigned char) s[x]] >> 4];
- str[y] = hexchars[os_toascii[(unsigned char) s[x]] & 0x0F];
- }
-#endif /*CHARSET_EBCDIC*/
- }
- str[y] = '\0';
- if (new_length) {
- *new_length = y;
- }
- return ((char *) str);
-}
-/* }}} */
-
-/* {{{ proto string urlencode(string str)
- URL-encodes string */
-PHP_FUNCTION(urlencode)
-{
- pval **arg;
- char *str;
- int str_len;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(arg);
-
- if (!(*arg)->value.str.len) {
- var_reset(return_value);
- return;
- }
- str = php_url_encode((*arg)->value.str.val, (*arg)->value.str.len, &str_len);
- RETVAL_STRINGL(str, str_len, 0);
-}
-/* }}} */
-
-/* {{{ proto string urldecode(string str)
- Decodes URL-encoded string */
-PHP_FUNCTION(urldecode)
-{
- pval **arg;
- int len;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(arg);
-
- if (!(*arg)->value.str.len) {
- var_reset(return_value);
- return;
- }
-
- *return_value = **arg;
- zval_copy_ctor(return_value);
-
- len = php_url_decode(return_value->value.str.val, return_value->value.str.len);
- return_value->value.str.len = len;
-}
-/* }}} */
-
-/* {{{ php_url_decode
- */
-PHPAPI int php_url_decode(char *str, int len)
-{
- char *dest = str;
- char *data = str;
-
- while (len--) {
- if (*data == '+')
- *dest = ' ';
- else if (*data == '%' && len >= 2 && isxdigit((int) *(data + 1)) && isxdigit((int) *(data + 2))) {
-#ifndef CHARSET_EBCDIC
- *dest = (char) php_htoi(data + 1);
-#else
- *dest = os_toebcdic[(char) php_htoi(data + 1)];
-#endif
- data += 2;
- len -= 2;
- } else
- *dest = *data;
- data++;
- dest++;
- }
- *dest = '\0';
- return dest - str;
-}
-/* }}} */
-
-/* {{{ php_raw_url_encode
- */
-PHPAPI char *php_raw_url_encode(char *s, int len, int *new_length)
-{
- register int x, y;
- unsigned char *str;
-
- str = (unsigned char *) emalloc(3 * len + 1);
- for (x = 0, y = 0; len--; x++, y++) {
- str[y] = (unsigned char) s[x];
-#ifndef CHARSET_EBCDIC
- if ((str[y] < '0' && str[y] != '-' && str[y] != '.') ||
- (str[y] < 'A' && str[y] > '9') ||
- (str[y] > 'Z' && str[y] < 'a' && str[y] != '_') ||
- (str[y] > 'z')) {
- str[y++] = '%';
- str[y++] = hexchars[(unsigned char) s[x] >> 4];
- str[y] = hexchars[(unsigned char) s[x] & 15];
-#else /*CHARSET_EBCDIC*/
- if (!isalnum(str[y]) && strchr("_-.", str[y]) != NULL) {
- str[y++] = '%';
- str[y++] = hexchars[os_toascii[(unsigned char) s[x]] >> 4];
- str[y] = hexchars[os_toascii[(unsigned char) s[x]] & 15];
-#endif /*CHARSET_EBCDIC*/
- }
- }
- str[y] = '\0';
- if (new_length) {
- *new_length = y;
- }
- return ((char *) str);
-}
-/* }}} */
-
-/* {{{ proto string rawurlencode(string str)
- URL-encodes string */
-PHP_FUNCTION(rawurlencode)
-{
- pval **arg;
- char *str;
- int new_len;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(arg);
-
- if (!(*arg)->value.str.len) {
- RETURN_FALSE;
- }
- str = php_raw_url_encode((*arg)->value.str.val, (*arg)->value.str.len, &new_len);
- RETVAL_STRINGL(str, new_len, 0);
-}
-/* }}} */
-
-/* {{{ proto string rawurldecode(string str)
- Decodes URL-encodes string */
-PHP_FUNCTION(rawurldecode)
-{
- pval **arg;
- int len;
- char *str;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(arg);
-
- if (!(*arg)->value.str.len) {
- RETURN_FALSE;
- }
- str = estrndup(Z_STRVAL_PP(arg), Z_STRLEN_PP(arg));
- len = php_raw_url_decode(str, Z_STRLEN_PP(arg));
-
- RETVAL_STRINGL(str, len, 0);
-}
-/* }}} */
-
-/* {{{ php_raw_url_decode
- */
-PHPAPI int php_raw_url_decode(char *str, int len)
-{
- char *dest = str;
- char *data = str;
-
- while (len--) {
- if (*data == '%' && len >= 2 && isxdigit((int) *(data + 1)) && isxdigit((int) *(data + 2))) {
-#ifndef CHARSET_EBCDIC
- *dest = (char) php_htoi(data + 1);
-#else
- *dest = os_toebcdic[(char) php_htoi(data + 1)];
-#endif
- data += 2;
- len -= 2;
- } else
- *dest = *data;
- data++;
- dest++;
- }
- *dest = '\0';
- return dest - str;
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/standard/url.h b/ext/standard/url.h
deleted file mode 100644
index ab63f28a28..0000000000
--- a/ext/standard/url.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Jim Winstead (jimw@php.net) |
- +----------------------------------------------------------------------+
- */
-/* $Id$ */
-
-#ifndef URL_H
-#define URL_H
-
-typedef struct php_url {
- char *scheme;
- char *user;
- char *pass;
- char *host;
- unsigned short port;
- char *path;
- char *query;
- char *fragment;
-} php_url;
-
-PHPAPI void php_url_free(php_url *theurl);
-PHPAPI php_url *php_url_parse(char *str);
-PHPAPI int php_url_decode(char *str, int len); /* return value: length of decoded string */
-PHPAPI int php_raw_url_decode(char *str, int len); /* return value: length of decoded string */
-PHPAPI char *php_url_encode(char *s, int len, int *new_length);
-PHPAPI char *php_raw_url_encode(char *s, int len, int *new_length);
-
-PHP_FUNCTION(parse_url);
-PHP_FUNCTION(urlencode);
-PHP_FUNCTION(urldecode);
-PHP_FUNCTION(rawurlencode);
-PHP_FUNCTION(rawurldecode);
-
-#endif /* URL_H */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/standard/url_scanner.c b/ext/standard/url_scanner.c
deleted file mode 100644
index 57cdb60a4a..0000000000
--- a/ext/standard/url_scanner.c
+++ /dev/null
@@ -1,385 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Hartmut Holzgraefe <hartmut@six.de> |
- +----------------------------------------------------------------------+
- */
-/* $Id$ */
-
-#include "php.h"
-
-#ifdef TRANS_SID
-
-#include "php_globals.h"
-
-#include <sys/types.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include "basic_functions.h"
-#include "url_scanner.h"
-
-#ifndef BUFSIZE
-#define BUFSIZE 256
-#endif
-
-PHP_RINIT_FUNCTION(url_scanner)
-{
- url_adapt(NULL,0,NULL,NULL);
- return SUCCESS;
-}
-
-
-PHP_RSHUTDOWN_FUNCTION(url_scanner)
-{
- url_adapt(NULL,0,NULL,NULL);
- return SUCCESS;
-}
-
-/* {{{ url_attr_addon
- */
-static char *url_attr_addon(const char *tag,const char *attr,const char *val,const char *buf)
-{
- int flag = 0;
- PLS_FETCH();
-
- if(!strcasecmp(tag,"a") && !strcasecmp(attr,"href")) {
- flag = 1;
- } else if(!strcasecmp(tag,"area" ) && !strcasecmp(attr,"href" )) {
- flag = 1;
- } else if(!strcasecmp(tag,"form" ) && !strcasecmp(attr,"action" )) {
- flag = 1;
- } else if(!strcasecmp(tag,"frame") && !strcasecmp(attr,"source" )) {
- flag = 1;
- } else if(!strcasecmp(tag,"img" ) && !strcasecmp(attr,"action" )) {
- flag = 1;
- }
- if(flag) {
- if(!strstr(val,buf)&&!strchr(val,':'))
- {
- char *result = (char *)emalloc(strlen(buf)+strlen(PG(arg_separator).output)+1);
- int n;
-
- if(strchr(val,'?')) {
- strcpy(result,PG(arg_separator).output);
- n=strlen(PG(arg_separator).output);
- } else {
- *result='?';
- n=1;
- }
- strcpy(result+n,buf);
- return result;
- }
- }
- return NULL;
-}
-/* }}} */
-
-#define US BG(url_adapt_state)
-
-/* {{{ url_adapt_ext
- */
-char *url_adapt_ext(const char *src, size_t srclen, const char *name, const char *val, size_t *newlen)
-{
- char buf[1024];
-
- snprintf(buf, sizeof(buf)-1, "%s=%s", name, val);
-
- return url_adapt(src, srclen, buf, newlen);
-}
-/* }}} */
-
-/* {{{ url_adapt
- */
-char *url_adapt(const char *src, size_t srclen, const char *data, size_t *newlen)
-{
- char *out,*outp;
- int maxl,n;
- BLS_FETCH();
-
- if(src==NULL) {
- US.state=STATE_NORMAL;
- if(US.tag) { efree(US.tag); US.tag =NULL; }
- if(US.attr) { efree(US.attr); US.attr=NULL; }
- if(US.val) { efree(US.val); US.val =NULL; }
- return NULL;
- }
-
- if(srclen==0)
- srclen=strlen(src);
-
- out=malloc(srclen+1);
- maxl=srclen;
- n=srclen;
-
- *newlen=0;
- outp=out;
-
- while(n--) {
- switch(US.state) {
- case STATE_NORMAL:
- if(*src=='<')
- US.state=STATE_TAG_START;
- break;
-
- case STATE_TAG_START:
- if(! isalnum(*src))
- US.state=STATE_NORMAL;
- US.state=STATE_TAG;
- US.ml=BUFSIZE;
- US.p=US.tag=erealloc(US.tag,US.ml);
- *(US.p)++=*src;
- US.l=1;
- break;
-
- case STATE_TAG:
- if(isalnum(*src)) {
- *(US.p)++ = *src;
- US.l++;
- if(US.l==US.ml) {
- US.ml+=BUFSIZE;
- US.tag=erealloc(US.tag,US.ml);
- US.p = US.tag+US.l;
- }
- } else if (isspace(*src)) {
- US.state = STATE_IN_TAG;
- *US.p='\0';
- US.tag=erealloc(US.tag,US.l);
- } else {
- US.state = STATE_NORMAL;
- efree(US.tag);
- US.tag=NULL;
- }
- break;
-
- case STATE_IN_TAG:
- if(isalnum(*src)) {
- US.state=STATE_TAG_ATTR;
- US.ml=BUFSIZE;
- US.p=US.attr=erealloc(US.attr,US.ml);
- *(US.p)++=*src;
- US.l=1;
- } else if (! isspace(*src)) {
- US.state = STATE_NORMAL;
- efree(US.tag);
- US.tag=NULL;
- }
- break;
-
- case STATE_TAG_ATTR:
- if(isalnum(*src)) {
- *US.p++=*src;
- ++US.l;
- if(US.l==US.ml) {
- US.ml+=BUFSIZE;
- US.attr=erealloc(US.attr,US.ml);
- US.p = US.attr+US.l;
- }
- if(US.l==US.ml) {
- US.ml+=BUFSIZE;
- US.attr=erealloc(US.attr,US.ml);
- US.p = US.attr+US.l;
- }
- } else if(isspace(*src)||(*src=='=')){
- US.state=STATE_TAG_IS;
- *US.p=0;
- US.attr=erealloc(US.attr,US.l);
- } else if(*src=='>') {
- US.state=STATE_NORMAL;
- } else {
- efree(US.attr);
- US.attr=NULL;
- US.state=STATE_IN_TAG;
- }
- break;
-
- case STATE_TAG_IS:
- case STATE_TAG_IS2:
- if(*src=='>'){
- US.state=STATE_NORMAL;
- if(! (US.attr_done)) {
- char *p;
- p=url_attr_addon(US.tag,US.attr,"",data);
- if(p) {
- int l= strlen(p);
- maxl+=l;
- out=realloc(out,maxl);
- outp=out+*newlen;
- strcpy(outp,p);
- outp+=l;
- *newlen+=l;
- efree(p);
- }
- }
- } else if(*src=='#') {
- if(! (US.attr_done)) {
- char *p;
- US.attr_done=1;
- p=url_attr_addon(US.tag,US.attr,"#",data);
- if(p) {
- int l= strlen(p);
- maxl+=l;
- out=realloc(out,maxl);
- outp=out+*newlen;
- strcpy(outp,p);
- outp+=l;
- *newlen+=l;
- efree(p);
- }
- }
- } else if(!isspace(*src)&&(*src!='=')) {
- US.ml=BUFSIZE;
- US.p=US.val=erealloc(US.val,US.ml);
- US.l=0;
- US.attr_done=0;
- if((*src=='"')||(*src=='\'')) {
- US.state=STATE_TAG_QVAL2;
- US.delim=*src;
- } else {
- US.state=STATE_TAG_VAL;
- *US.p++=*src;
- US.l++;
- }
- }
- break;
-
-
- case STATE_TAG_QVAL2:
- if(*src=='#') {
- if(! (US.attr_done)) {
- char *p;
- US.attr_done=1;
- *US.p='\0';
- p=url_attr_addon(US.tag,US.attr,US.val,data);
- if(p) {
- int l= strlen(p);
- maxl+=l;
- out=realloc(out,maxl);
- outp=out+*newlen;
- strcpy(outp,p);
- outp+=l;
- *newlen+=l;
- efree(p);
- }
- }
- } else if(*src==US.delim) {
- US.state=STATE_IN_TAG;
- *US.p='\0';
- if(! (US.attr_done)) {
- char *p;
- p=url_attr_addon(US.tag,US.attr,US.val,data);
- if(p) {
- int l= strlen(p);
- maxl+=l;
- out=realloc(out,maxl);
- outp=out+*newlen;
- strcpy(outp,p);
- outp+=l;
- *newlen+=l;
- efree(p);
- }
- }
- break;
- } else if(*src=='\\') {
- US.state=STATE_TAG_QVAL2b;
- } else if (*src=='>') {
- US.state=STATE_NORMAL;
- }
-
- *US.p++=*src;
- ++US.l;
- if(US.l==US.ml) {
- US.ml+=BUFSIZE;
- US.val=erealloc(US.val,US.ml);
- US.p = US.val+US.l;
- }
-
- break;
-
- case STATE_TAG_QVAL2b:
- US.state=STATE_TAG_QVAL2;
- *US.p++=*src;
- ++US.l;
- if(US.l==US.ml) {
- US.ml+=BUFSIZE;
- US.val=erealloc(US.val,US.ml);
- US.p = US.val+US.l;
- }
- break;
-
- case STATE_TAG_VAL:
- case STATE_TAG_VAL2:
- if(*src=='#') {
- if(! (US.attr_done)) {
- char *p;
- US.attr_done=1;
- *US.p='\0';
- p=url_attr_addon(US.tag,US.attr,US.val,data);
- if(p) {
- int l= strlen(p);
- maxl+=l;
- out=realloc(out,maxl);
- outp=out+*newlen;
- strcpy(outp,p);
- outp+=l;
- *newlen+=l;
- efree(p);
- }
- }
- } else if(isspace(*src)||(*src=='>')) {
- US.state=(*src=='>')?STATE_NORMAL:STATE_IN_TAG;
- *US.p='\0';
- if(! (US.attr_done)) {
- char *p;
- p=url_attr_addon(US.tag,US.attr,US.val,data);
- if(p) {
- int l= strlen(p);
- maxl+=l;
- out=realloc(out,maxl);
- outp=out+*newlen;
- strcpy(outp,p);
- outp+=l;
- *newlen+=l;
- efree(p);
- }
- }
- } else {
- *US.p++=*src;
- US.l++;
- if(US.l==US.ml) {
- US.ml+=BUFSIZE;
- US.val=erealloc(US.val,US.ml);
- US.p = US.val+US.l;
- }
- }
- break;
- }
-
- *outp++=*src++;
- *newlen+=1;
- }
- *outp='\0';
- return out;
-}
-/* }}} */
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/standard/url_scanner.h b/ext/standard/url_scanner.h
deleted file mode 100644
index c125c59b8c..0000000000
--- a/ext/standard/url_scanner.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Sascha Schumann <sascha@schumann.cx> |
- +----------------------------------------------------------------------+
- */
-/* $Id$ */
-
-#ifndef URI_SCANNER_H
-#define URI_SCANNER_H
-
-PHP_RINIT_FUNCTION(url_scanner);
-PHP_RSHUTDOWN_FUNCTION(url_scanner);
-
-char *url_adapt(const char *src, size_t srclen, const char *data, size_t *newlen);
-
-enum url_state {
- STATE_NORMAL,
- STATE_TAG_START,
- STATE_TAG,
- STATE_IN_TAG,
- STATE_TAG_ATTR,
- STATE_TAG_IS,
- STATE_TAG_IS2,
- STATE_TAG_VAL,
- STATE_TAG_VAL2,
- STATE_TAG_QVAL1,
- STATE_TAG_QVAL2,
- STATE_TAG_QVAL2b
-};
-
-typedef struct url_adapt_struct {
- enum url_state state;
- char *tag;
- char *attr;
- char *val;
- char delim;
- char *p;
- int l,ml;
- int attr_done;
-} url_adapt_state_t;
-
-#endif
diff --git a/ext/standard/url_scanner_ex.c b/ext/standard/url_scanner_ex.c
deleted file mode 100644
index 835e37f7f9..0000000000
--- a/ext/standard/url_scanner_ex.c
+++ /dev/null
@@ -1,773 +0,0 @@
-/* Generated by re2c 0.5 on Wed Apr 4 19:29:46 2001 */
-#line 1 "/usr/src/web/php/php4/ext/standard/url_scanner_ex.re"
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Sascha Schumann <sascha@schumann.cx> |
- +----------------------------------------------------------------------+
-*/
-
-#include "php.h"
-
-#ifdef TRANS_SID
-
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "php_ini.h"
-#include "php_globals.h"
-#define STATE_TAG SOME_OTHER_STATE_TAG
-#include "basic_functions.h"
-#undef STATE_TAG
-
-#define url_adapt_ext url_adapt_ext_ex
-#define url_scanner url_scanner_ex
-
-#include "php_smart_str.h"
-
-/* {{{ PHP_INI_MH
- */
-static PHP_INI_MH(OnUpdateTags)
-{
- url_adapt_state_ex_t *ctx;
- char *key;
- char *lasts;
- char *tmp;
- BLS_FETCH();
-
- ctx = &BG(url_adapt_state_ex);
-
- tmp = estrndup(new_value, new_value_length);
-
- if (ctx->tags)
- zend_hash_destroy(ctx->tags);
- else
- ctx->tags = malloc(sizeof(HashTable));
-
- zend_hash_init(ctx->tags, 0, NULL, NULL, 1);
-
- for (key = php_strtok_r(tmp, ",", &lasts);
- key;
- key = php_strtok_r(NULL, ",", &lasts)) {
- char *val;
-
- val = strchr(key, '=');
- if (val) {
- char *q;
- int keylen;
-
- *val++ = '\0';
- for (q = key; *q; q++)
- *q = tolower(*q);
- keylen = q - key;
- /* key is stored withOUT NUL
- val is stored WITH NUL */
- zend_hash_add(ctx->tags, key, keylen, val, strlen(val)+1, NULL);
- }
- }
-
- efree(tmp);
-
- return SUCCESS;
-}
-/* }}} */
-
-PHP_INI_BEGIN()
- STD_PHP_INI_ENTRY("url_rewriter.tags", "a=href,area=href,frame=src,form=fakeentry", PHP_INI_ALL, OnUpdateTags, url_adapt_state_ex, php_basic_globals, basic_globals)
-PHP_INI_END()
-
-/* {{{ append_modified_url
- */
-static inline void append_modified_url(smart_str *url, smart_str *dest, smart_str *name, smart_str *val, const char *separator)
-{
- register const char *p, *q;
- const char *bash = NULL;
- const char *sep = "?";
-
- q = url->c + url->len;
-
- for (p = url->c; p < q; p++) {
- switch(*p) {
- case ':':
- smart_str_append(dest, url);
- return;
- case '?':
- sep = separator;
- break;
- case '#':
- bash = p;
- break;
- }
- }
-
- /* Don't modify URLs of the format "#mark" */
- if (bash - url->c == 0) {
- smart_str_append(dest, url);
- return;
- }
-
- if (bash)
- smart_str_appendl(dest, url->c, bash - url->c);
- else
- smart_str_append(dest, url);
-
- smart_str_appends(dest, sep);
- smart_str_append(dest, name);
- smart_str_appendc(dest, '=');
- smart_str_append(dest, val);
-
- if (bash)
- smart_str_appendl(dest, bash, q - bash);
-}
-/* }}} */
-
-static inline void tag_arg(url_adapt_state_ex_t *ctx, char quote PLS_DC)
-{
- char f = 0;
-
- if (strncasecmp(ctx->arg.c, ctx->lookup_data, ctx->arg.len) == 0)
- f = 1;
-
- smart_str_appendc(&ctx->result, quote);
- if (f) {
- append_modified_url(&ctx->val, &ctx->result, &ctx->q_name, &ctx->q_value, PG(arg_separator).output);
- } else {
- smart_str_append(&ctx->result, &ctx->val);
- }
- smart_str_appendc(&ctx->result, quote);
-}
-
-enum {
- STATE_PLAIN,
- STATE_TAG,
- STATE_NEXT_ARG,
- STATE_ARG,
- STATE_BEFORE_VAL,
- STATE_VAL
-};
-
-#define YYFILL(n) goto stop
-#define YYCTYPE unsigned char
-#define YYCURSOR xp
-#define YYLIMIT end
-#define YYMARKER q
-#define STATE ctx->state
-
-#define STD_PARA url_adapt_state_ex_t *ctx, char *start, char *YYCURSOR PLS_DC
-#define STD_ARGS ctx, start, xp PLS_CC
-
-static inline void passthru(STD_PARA)
-{
- smart_str_appendl(&ctx->result, start, YYCURSOR - start);
-}
-
-static inline void handle_form(STD_PARA)
-{
- if (ctx->tag.len == 4 && strncasecmp(ctx->tag.c, "form", 4) == 0) {
- smart_str_appends(&ctx->result, "<input type=\"hidden\" name=\"");
- smart_str_append(&ctx->result, &ctx->q_name);
- smart_str_appends(&ctx->result, "\" value=\"");
- smart_str_append(&ctx->result, &ctx->q_value);
- smart_str_appends(&ctx->result, "\" />");
- }
-}
-
-/*
- * HANDLE_TAG copies the HTML Tag and checks whether we
- * have that tag in our table. If we might modify it,
- * we continue to scan the tag, otherwise we simply copy the complete
- * HTML stuff to the result buffer.
- */
-
-static inline void handle_tag(STD_PARA)
-{
- int ok = 0;
- int i;
-
- ctx->tag.len = 0;
- smart_str_appendl(&ctx->tag, start, YYCURSOR - start);
- for (i = 0; i < ctx->tag.len; i++)
- ctx->tag.c[i] = tolower(ctx->tag.c[i]);
- if (zend_hash_find(ctx->tags, ctx->tag.c, ctx->tag.len, (void **) &ctx->lookup_data) == SUCCESS)
- ok = 1;
- STATE = ok ? STATE_NEXT_ARG : STATE_PLAIN;
-}
-
-static inline void handle_arg(STD_PARA)
-{
- ctx->arg.len = 0;
- smart_str_appendl(&ctx->arg, start, YYCURSOR - start);
-}
-
-static inline void handle_val(STD_PARA, char quotes, char type)
-{
- smart_str_setl(&ctx->val, start + quotes, YYCURSOR - start - quotes * 2);
- tag_arg(ctx, type PLS_CC);
-}
-
-#ifdef SCANNER_DEBUG
-#define scdebug(x) printf x
-#else
-#define scdebug(x)
-#endif
-
-/* {{{ mainloop
- */
-static inline void mainloop(url_adapt_state_ex_t *ctx, const char *newdata, size_t newlen)
-{
- char *end, *q;
- char *xp;
- char *start;
- int rest;
- PLS_FETCH();
-
- smart_str_appendl(&ctx->buf, newdata, newlen);
-
- YYCURSOR = ctx->buf.c;
- YYLIMIT = ctx->buf.c + ctx->buf.len;
-
-#line 238
-
-
- while(1) {
- start = YYCURSOR;
- scdebug(("state %d at %s\n", STATE, YYCURSOR));
- switch(STATE) {
-
- case STATE_PLAIN:
-{
- YYCTYPE yych;
- unsigned int yyaccept;
- goto yy0;
-yy1: ++YYCURSOR;
-yy0:
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
- if(yych != '<') goto yy4;
-yy2: yych = *++YYCURSOR;
-yy3:
-#line 247
- { passthru(STD_ARGS); STATE = STATE_TAG; continue; }
-yy4: yych = *++YYCURSOR;
-yy5:
-#line 248
- { passthru(STD_ARGS); continue; }
-}
-#line 249
-
- break;
-
- case STATE_TAG:
-{
- YYCTYPE yych;
- unsigned int yyaccept;
- static unsigned char yybm[] = {
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 0, 0, 0, 0, 0,
- 0, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- };
- goto yy6;
-yy7: ++YYCURSOR;
-yy6:
- if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
- yych = *YYCURSOR;
- if(yych <= '@') goto yy10;
- if(yych <= 'Z') goto yy8;
- if(yych <= '`') goto yy10;
- if(yych >= '{') goto yy10;
-yy8: yych = *++YYCURSOR;
- goto yy13;
-yy9:
-#line 254
- { handle_tag(STD_ARGS); /* Sets STATE */; passthru(STD_ARGS); continue; }
-yy10: yych = *++YYCURSOR;
-yy11:
-#line 255
- { passthru(STD_ARGS); STATE = STATE_PLAIN; continue; }
-yy12: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
-yy13: if(yybm[0+yych] & 128) goto yy12;
- goto yy9;
-}
-#line 256
-
- break;
-
- case STATE_NEXT_ARG:
-{
- YYCTYPE yych;
- unsigned int yyaccept;
- goto yy14;
-yy15: ++YYCURSOR;
-yy14:
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
- if(yych <= '='){
- if(yych <= '\n'){
- if(yych <= '\t') goto yy22;
- goto yy18;
- } else {
- if(yych == ' ') goto yy18;
- goto yy22;
- }
- } else {
- if(yych <= 'Z'){
- if(yych <= '>') goto yy16;
- if(yych <= '@') goto yy22;
- goto yy20;
- } else {
- if(yych <= '`') goto yy22;
- if(yych <= 'z') goto yy20;
- goto yy22;
- }
- }
-yy16: yych = *++YYCURSOR;
-yy17:
-#line 261
- { passthru(STD_ARGS); handle_form(STD_ARGS); STATE = STATE_PLAIN; continue; }
-yy18: yych = *++YYCURSOR;
-yy19:
-#line 262
- { passthru(STD_ARGS); continue; }
-yy20: yych = *++YYCURSOR;
-yy21:
-#line 263
- { YYCURSOR--; STATE = STATE_ARG; continue; }
-yy22: yych = *++YYCURSOR;
-yy23:
-#line 264
- { passthru(STD_ARGS); STATE = STATE_PLAIN; continue; }
-}
-#line 265
-
- break;
-
- case STATE_ARG:
-{
- YYCTYPE yych;
- unsigned int yyaccept;
- static unsigned char yybm[] = {
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 0, 0, 0, 0, 0,
- 0, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- };
- goto yy24;
-yy25: ++YYCURSOR;
-yy24:
- if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
- yych = *YYCURSOR;
- if(yych <= '@') goto yy28;
- if(yych <= 'Z') goto yy26;
- if(yych <= '`') goto yy28;
- if(yych >= '{') goto yy28;
-yy26: yych = *++YYCURSOR;
- goto yy31;
-yy27:
-#line 270
- { passthru(STD_ARGS); handle_arg(STD_ARGS); STATE = STATE_BEFORE_VAL; continue; }
-yy28: yych = *++YYCURSOR;
-yy29:
-#line 271
- { passthru(STD_ARGS); STATE = STATE_NEXT_ARG; continue; }
-yy30: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
-yy31: if(yybm[0+yych] & 128) goto yy30;
- goto yy27;
-}
-#line 272
-
-
- case STATE_BEFORE_VAL:
-{
- YYCTYPE yych;
- unsigned int yyaccept;
- static unsigned char yybm[] = {
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 128, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- };
- goto yy32;
-yy33: ++YYCURSOR;
-yy32:
- if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
- yych = *YYCURSOR;
- if(yych == ' ') goto yy34;
- if(yych == '=') goto yy36;
- goto yy38;
-yy34: yyaccept = 0;
- yych = *(YYMARKER = ++YYCURSOR);
- if(yych == ' ') goto yy41;
- if(yych == '=') goto yy39;
-yy35:
-#line 277
- { YYCURSOR--; STATE = STATE_NEXT_ARG; continue; }
-yy36: yych = *++YYCURSOR;
- goto yy40;
-yy37:
-#line 276
- { passthru(STD_ARGS); STATE = STATE_VAL; continue; }
-yy38: yych = *++YYCURSOR;
- goto yy35;
-yy39: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
-yy40: if(yybm[0+yych] & 128) goto yy39;
- goto yy37;
-yy41: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
-yy42: if(yych == ' ') goto yy41;
- if(yych == '=') goto yy39;
-yy43: YYCURSOR = YYMARKER;
- switch(yyaccept){
- case 0: goto yy35;
- }
-}
-#line 278
-
- break;
-
- case STATE_VAL:
-{
- YYCTYPE yych;
- unsigned int yyaccept;
- static unsigned char yybm[] = {
- 240, 240, 240, 240, 240, 240, 240, 240,
- 240, 240, 192, 240, 240, 240, 240, 240,
- 240, 240, 240, 240, 240, 240, 240, 240,
- 240, 240, 240, 240, 240, 240, 240, 240,
- 192, 240, 64, 240, 240, 240, 240, 144,
- 240, 240, 240, 240, 240, 240, 240, 240,
- 240, 240, 240, 240, 240, 240, 240, 240,
- 240, 240, 240, 240, 240, 240, 0, 240,
- 240, 240, 240, 240, 240, 240, 240, 240,
- 240, 240, 240, 240, 240, 240, 240, 240,
- 240, 240, 240, 240, 240, 240, 240, 240,
- 240, 240, 240, 240, 240, 240, 240, 240,
- 240, 240, 240, 240, 240, 240, 240, 240,
- 240, 240, 240, 240, 240, 240, 240, 240,
- 240, 240, 240, 240, 240, 240, 240, 240,
- 240, 240, 240, 240, 240, 240, 240, 240,
- 240, 240, 240, 240, 240, 240, 240, 240,
- 240, 240, 240, 240, 240, 240, 240, 240,
- 240, 240, 240, 240, 240, 240, 240, 240,
- 240, 240, 240, 240, 240, 240, 240, 240,
- 240, 240, 240, 240, 240, 240, 240, 240,
- 240, 240, 240, 240, 240, 240, 240, 240,
- 240, 240, 240, 240, 240, 240, 240, 240,
- 240, 240, 240, 240, 240, 240, 240, 240,
- 240, 240, 240, 240, 240, 240, 240, 240,
- 240, 240, 240, 240, 240, 240, 240, 240,
- 240, 240, 240, 240, 240, 240, 240, 240,
- 240, 240, 240, 240, 240, 240, 240, 240,
- 240, 240, 240, 240, 240, 240, 240, 240,
- 240, 240, 240, 240, 240, 240, 240, 240,
- 240, 240, 240, 240, 240, 240, 240, 240,
- 240, 240, 240, 240, 240, 240, 240, 240,
- };
- goto yy44;
-yy45: ++YYCURSOR;
-yy44:
- if((YYLIMIT - YYCURSOR) < 3) YYFILL(3);
- yych = *YYCURSOR;
- if(yych <= '!'){
- if(yych <= '\n'){
- if(yych <= '\t') goto yy50;
- goto yy51;
- } else {
- if(yych == ' ') goto yy51;
- goto yy50;
- }
- } else {
- if(yych <= '\''){
- if(yych <= '"') goto yy46;
- if(yych <= '&') goto yy50;
- goto yy48;
- } else {
- if(yych == '>') goto yy51;
- goto yy50;
- }
- }
-yy46: yyaccept = 0;
- yych = *(YYMARKER = ++YYCURSOR);
- if(yych != '>') goto yy63;
-yy47:
-#line 286
- { passthru(STD_ARGS); STATE = STATE_NEXT_ARG; continue; }
-yy48: yyaccept = 1;
- yych = *(YYMARKER = ++YYCURSOR);
- goto yy55;
-yy49:
-#line 285
- { handle_val(STD_ARGS, 0, '"'); STATE = STATE_NEXT_ARG; continue; }
-yy50: yych = *++YYCURSOR;
- goto yy53;
-yy51: yych = *++YYCURSOR;
- goto yy47;
-yy52: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
-yy53: if(yybm[0+yych] & 16) goto yy52;
- goto yy49;
-yy54: yyaccept = 1;
- YYMARKER = ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
-yy55: if(yybm[0+yych] & 32) goto yy54;
- if(yych <= '&') goto yy58;
- if(yych >= '(') goto yy49;
-yy56: yych = *++YYCURSOR;
- if(yybm[0+yych] & 16) goto yy52;
-yy57:
-#line 284
- { handle_val(STD_ARGS, 1, '\''); STATE = STATE_NEXT_ARG; continue; }
-yy58: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
-yy59: if(yybm[0+yych] & 64) goto yy58;
- if(yych <= '=') goto yy61;
-yy60: YYCURSOR = YYMARKER;
- switch(yyaccept){
- case 1: goto yy49;
- case 0: goto yy47;
- }
-yy61: yych = *++YYCURSOR;
- goto yy57;
-yy62: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
-yy63: if(yybm[0+yych] & 128) goto yy62;
- if(yych >= '>') goto yy60;
-yy64: yych = *++YYCURSOR;
-yy65:
-#line 283
- { handle_val(STD_ARGS, 1, '"'); STATE = STATE_NEXT_ARG; continue; }
-}
-#line 287
-
- break;
- }
- }
-
-stop:
- scdebug(("stopped in state %d at pos %d (%d:%c)\n", STATE, YYCURSOR - ctx->buf.c, *YYCURSOR, *YYCURSOR));
-
- rest = YYLIMIT - start;
-
- /* XXX: Crash avoidance. Need to work with reporter to figure out what goes wrong */
- if (rest < 0) rest = 0;
-
- if (rest) memmove(ctx->buf.c, start, rest);
- ctx->buf.len = rest;
-}
-/* }}} */
-
-/* {{{ url_adapt_single_url
- */
-char *url_adapt_single_url(const char *url, size_t urllen, const char *name, const char *value, size_t *newlen)
-{
- smart_str surl = {0};
- smart_str buf = {0};
- smart_str sname = {0};
- smart_str sval = {0};
- PLS_FETCH();
-
- smart_str_setl(&surl, url, urllen);
- smart_str_sets(&sname, name);
- smart_str_sets(&sval, value);
-
- append_modified_url(&surl, &buf, &sname, &sval, PG(arg_separator).output);
-
- smart_str_0(&buf);
- if (newlen) *newlen = buf.len;
-
- return buf.c;
-}
-/* }}} */
-
-/* {{{ url_adapt_ext
- */
-char *url_adapt_ext(const char *src, size_t srclen, const char *name, const char *value, size_t *newlen)
-{
- char *ret;
- url_adapt_state_ex_t *ctx;
- BLS_FETCH();
-
- ctx = &BG(url_adapt_state_ex);
-
- smart_str_sets(&ctx->q_name, name);
- smart_str_sets(&ctx->q_value, value);
- mainloop(ctx, src, srclen);
-
- *newlen = ctx->result.len;
- smart_str_0(&ctx->result);
- ctx->result.len = 0;
- return ctx->result.c;
-}
-/* }}} */
-
-PHP_RINIT_FUNCTION(url_scanner)
-{
- url_adapt_state_ex_t *ctx;
- BLS_FETCH();
-
- ctx = &BG(url_adapt_state_ex);
-
- memset(ctx, 0, ((size_t) &((url_adapt_state_ex_t *)0)->tags));
-
- return SUCCESS;
-}
-
-PHP_RSHUTDOWN_FUNCTION(url_scanner)
-{
- url_adapt_state_ex_t *ctx;
- BLS_FETCH();
-
- ctx = &BG(url_adapt_state_ex);
-
- smart_str_free(&ctx->result);
- smart_str_free(&ctx->buf);
- smart_str_free(&ctx->tag);
- smart_str_free(&ctx->arg);
-
- return SUCCESS;
-}
-
-PHP_MINIT_FUNCTION(url_scanner)
-{
- url_adapt_state_ex_t *ctx;
- BLS_FETCH();
-
- ctx = &BG(url_adapt_state_ex);
-
- ctx->tags = NULL;
-
- REGISTER_INI_ENTRIES();
- return SUCCESS;
-}
-
-PHP_MSHUTDOWN_FUNCTION(url_scanner)
-{
- BLS_FETCH();
-
- UNREGISTER_INI_ENTRIES();
- zend_hash_destroy(BG(url_adapt_state_ex).tags);
- free(BG(url_adapt_state_ex).tags);
- return SUCCESS;
-}
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/standard/url_scanner_ex.h b/ext/standard/url_scanner_ex.h
deleted file mode 100644
index 5ebd9bfe5d..0000000000
--- a/ext/standard/url_scanner_ex.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Sascha Schumann <sascha@schumann.cx> |
- +----------------------------------------------------------------------+
-*/
-
-#ifndef URL_SCANNER_EX_H
-#define URL_SCANNER_EX_H
-
-PHP_MINIT_FUNCTION(url_scanner_ex);
-PHP_MSHUTDOWN_FUNCTION(url_scanner_ex);
-PHP_RSHUTDOWN_FUNCTION(url_scanner_ex);
-PHP_RINIT_FUNCTION(url_scanner_ex);
-
-char *url_adapt_ext_ex(const char *src, size_t srclen, const char *name, const char *value, size_t *newlen);
-
-char *url_adapt_single_url(const char *url, size_t urllen, const char *name, const char *value, size_t *newlen);
-
-#include "php_smart_str_public.h"
-
-typedef struct {
- /* Used by the mainloop of the scanner */
- smart_str tag; /* read only */
- smart_str arg; /* read only */
- smart_str val; /* read only */
- smart_str buf;
-
- /* The result buffer */
- smart_str result;
-
- /* The data which is appended to each relative URL */
- smart_str q_name;
- smart_str q_value;
-
- char *lookup_data;
- int state;
-
- /* Everything above is zeroed in RINIT */
- HashTable *tags;
-} url_adapt_state_ex_t;
-
-#endif
diff --git a/ext/standard/url_scanner_ex.re b/ext/standard/url_scanner_ex.re
deleted file mode 100644
index 681f08c2c0..0000000000
--- a/ext/standard/url_scanner_ex.re
+++ /dev/null
@@ -1,392 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Sascha Schumann <sascha@schumann.cx> |
- +----------------------------------------------------------------------+
-*/
-
-#include "php.h"
-
-#ifdef TRANS_SID
-
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "php_ini.h"
-#include "php_globals.h"
-#define STATE_TAG SOME_OTHER_STATE_TAG
-#include "basic_functions.h"
-#undef STATE_TAG
-
-#define url_adapt_ext url_adapt_ext_ex
-#define url_scanner url_scanner_ex
-
-#include "php_smart_str.h"
-
-static PHP_INI_MH(OnUpdateTags)
-{
- url_adapt_state_ex_t *ctx;
- char *key;
- char *lasts;
- char *tmp;
- BLS_FETCH();
-
- ctx = &BG(url_adapt_state_ex);
-
- tmp = estrndup(new_value, new_value_length);
-
- if (ctx->tags)
- zend_hash_destroy(ctx->tags);
- else
- ctx->tags = malloc(sizeof(HashTable));
-
- zend_hash_init(ctx->tags, 0, NULL, NULL, 1);
-
- for (key = php_strtok_r(tmp, ",", &lasts);
- key;
- key = php_strtok_r(NULL, ",", &lasts)) {
- char *val;
-
- val = strchr(key, '=');
- if (val) {
- char *q;
- int keylen;
-
- *val++ = '\0';
- for (q = key; *q; q++)
- *q = tolower(*q);
- keylen = q - key;
- /* key is stored withOUT NUL
- val is stored WITH NUL */
- zend_hash_add(ctx->tags, key, keylen, val, strlen(val)+1, NULL);
- }
- }
-
- efree(tmp);
-
- return SUCCESS;
-}
-
-PHP_INI_BEGIN()
- STD_PHP_INI_ENTRY("url_rewriter.tags", "a=href,area=href,frame=src,form=fakeentry", PHP_INI_ALL, OnUpdateTags, url_adapt_state_ex, php_basic_globals, basic_globals)
-PHP_INI_END()
-
-static inline void append_modified_url(smart_str *url, smart_str *dest, smart_str *name, smart_str *val, const char *separator)
-{
- register const char *p, *q;
- const char *bash = NULL;
- const char *sep = "?";
-
- q = url->c + url->len;
-
- for (p = url->c; p < q; p++) {
- switch(*p) {
- case ':':
- smart_str_append(dest, url);
- return;
- case '?':
- sep = separator;
- break;
- case '#':
- bash = p;
- break;
- }
- }
-
- /* Don't modify URLs of the format "#mark" */
- if (bash - url->c == 0) {
- smart_str_append(dest, url);
- return;
- }
-
- if (bash)
- smart_str_appendl(dest, url->c, bash - url->c);
- else
- smart_str_append(dest, url);
-
- smart_str_appends(dest, sep);
- smart_str_append(dest, name);
- smart_str_appendc(dest, '=');
- smart_str_append(dest, val);
-
- if (bash)
- smart_str_appendl(dest, bash, q - bash);
-}
-
-static inline void tag_arg(url_adapt_state_ex_t *ctx, char quote PLS_DC)
-{
- char f = 0;
-
- if (strncasecmp(ctx->arg.c, ctx->lookup_data, ctx->arg.len) == 0)
- f = 1;
-
- smart_str_appendc(&ctx->result, quote);
- if (f) {
- append_modified_url(&ctx->val, &ctx->result, &ctx->q_name, &ctx->q_value, PG(arg_separator).output);
- } else {
- smart_str_append(&ctx->result, &ctx->val);
- }
- smart_str_appendc(&ctx->result, quote);
-}
-
-enum {
- STATE_PLAIN,
- STATE_TAG,
- STATE_NEXT_ARG,
- STATE_ARG,
- STATE_BEFORE_VAL,
- STATE_VAL
-};
-
-#define YYFILL(n) goto stop
-#define YYCTYPE unsigned char
-#define YYCURSOR xp
-#define YYLIMIT end
-#define YYMARKER q
-#define STATE ctx->state
-
-#define STD_PARA url_adapt_state_ex_t *ctx, char *start, char *YYCURSOR PLS_DC
-#define STD_ARGS ctx, start, xp PLS_CC
-
-static inline void passthru(STD_PARA)
-{
- smart_str_appendl(&ctx->result, start, YYCURSOR - start);
-}
-
-static inline void handle_form(STD_PARA)
-{
- if (ctx->tag.len == 4 && strncasecmp(ctx->tag.c, "form", 4) == 0) {
- smart_str_appends(&ctx->result, "<input type=\"hidden\" name=\"");
- smart_str_append(&ctx->result, &ctx->q_name);
- smart_str_appends(&ctx->result, "\" value=\"");
- smart_str_append(&ctx->result, &ctx->q_value);
- smart_str_appends(&ctx->result, "\" />");
- }
-}
-
-/*
- * HANDLE_TAG copies the HTML Tag and checks whether we
- * have that tag in our table. If we might modify it,
- * we continue to scan the tag, otherwise we simply copy the complete
- * HTML stuff to the result buffer.
- */
-
-static inline void handle_tag(STD_PARA)
-{
- int ok = 0;
- int i;
-
- ctx->tag.len = 0;
- smart_str_appendl(&ctx->tag, start, YYCURSOR - start);
- for (i = 0; i < ctx->tag.len; i++)
- ctx->tag.c[i] = tolower(ctx->tag.c[i]);
- if (zend_hash_find(ctx->tags, ctx->tag.c, ctx->tag.len, (void **) &ctx->lookup_data) == SUCCESS)
- ok = 1;
- STATE = ok ? STATE_NEXT_ARG : STATE_PLAIN;
-}
-
-static inline void handle_arg(STD_PARA)
-{
- ctx->arg.len = 0;
- smart_str_appendl(&ctx->arg, start, YYCURSOR - start);
-}
-
-static inline void handle_val(STD_PARA, char quotes, char type)
-{
- smart_str_setl(&ctx->val, start + quotes, YYCURSOR - start - quotes * 2);
- tag_arg(ctx, type PLS_CC);
-}
-
-#ifdef SCANNER_DEBUG
-#define scdebug(x) printf x
-#else
-#define scdebug(x)
-#endif
-
-static inline void mainloop(url_adapt_state_ex_t *ctx, const char *newdata, size_t newlen)
-{
- char *end, *q;
- char *xp;
- char *start;
- int rest;
- PLS_FETCH();
-
- smart_str_appendl(&ctx->buf, newdata, newlen);
-
- YYCURSOR = ctx->buf.c;
- YYLIMIT = ctx->buf.c + ctx->buf.len;
-
-/*!re2c
-any = [\000-\377];
-alpha = [a-zA-Z];
-*/
-
- while(1) {
- start = YYCURSOR;
- scdebug(("state %d at %s\n", STATE, YYCURSOR));
- switch(STATE) {
-
- case STATE_PLAIN:
-/*!re2c
- [<] { passthru(STD_ARGS); STATE = STATE_TAG; continue; }
- (any\[<]) { passthru(STD_ARGS); continue; }
-*/
- break;
-
- case STATE_TAG:
-/*!re2c
- alpha+ { handle_tag(STD_ARGS); /* Sets STATE */; passthru(STD_ARGS); continue; }
- any { passthru(STD_ARGS); STATE = STATE_PLAIN; continue; }
-*/
- break;
-
- case STATE_NEXT_ARG:
-/*!re2c
- ">" { passthru(STD_ARGS); handle_form(STD_ARGS); STATE = STATE_PLAIN; continue; }
- [ \n] { passthru(STD_ARGS); continue; }
- alpha { YYCURSOR--; STATE = STATE_ARG; continue; }
- any { passthru(STD_ARGS); STATE = STATE_PLAIN; continue; }
-*/
- break;
-
- case STATE_ARG:
-/*!re2c
- alpha+ { passthru(STD_ARGS); handle_arg(STD_ARGS); STATE = STATE_BEFORE_VAL; continue; }
- any { passthru(STD_ARGS); STATE = STATE_NEXT_ARG; continue; }
-*/
-
- case STATE_BEFORE_VAL:
-/*!re2c
- [ ]* "=" [ ]* { passthru(STD_ARGS); STATE = STATE_VAL; continue; }
- any { YYCURSOR--; STATE = STATE_NEXT_ARG; continue; }
-*/
- break;
-
- case STATE_VAL:
-/*!re2c
- ["] (any\[">])* ["] { handle_val(STD_ARGS, 1, '"'); STATE = STATE_NEXT_ARG; continue; }
- ['] (any\['>])* ['] { handle_val(STD_ARGS, 1, '\''); STATE = STATE_NEXT_ARG; continue; }
- (any\[ \n>"])+ { handle_val(STD_ARGS, 0, '"'); STATE = STATE_NEXT_ARG; continue; }
- any { passthru(STD_ARGS); STATE = STATE_NEXT_ARG; continue; }
-*/
- break;
- }
- }
-
-stop:
- scdebug(("stopped in state %d at pos %d (%d:%c)\n", STATE, YYCURSOR - ctx->buf.c, *YYCURSOR, *YYCURSOR));
-
- rest = YYLIMIT - start;
-
- /* XXX: Crash avoidance. Need to work with reporter to figure out what goes wrong */
- if (rest < 0) rest = 0;
-
- if (rest) memmove(ctx->buf.c, start, rest);
- ctx->buf.len = rest;
-}
-
-char *url_adapt_single_url(const char *url, size_t urllen, const char *name, const char *value, size_t *newlen)
-{
- smart_str surl = {0};
- smart_str buf = {0};
- smart_str sname = {0};
- smart_str sval = {0};
- PLS_FETCH();
-
- smart_str_setl(&surl, url, urllen);
- smart_str_sets(&sname, name);
- smart_str_sets(&sval, value);
-
- append_modified_url(&surl, &buf, &sname, &sval, PG(arg_separator).output);
-
- smart_str_0(&buf);
- if (newlen) *newlen = buf.len;
-
- return buf.c;
-}
-
-char *url_adapt_ext(const char *src, size_t srclen, const char *name, const char *value, size_t *newlen)
-{
- char *ret;
- url_adapt_state_ex_t *ctx;
- BLS_FETCH();
-
- ctx = &BG(url_adapt_state_ex);
-
- smart_str_sets(&ctx->q_name, name);
- smart_str_sets(&ctx->q_value, value);
- mainloop(ctx, src, srclen);
-
- *newlen = ctx->result.len;
- smart_str_0(&ctx->result);
- ctx->result.len = 0;
- return ctx->result.c;
-}
-
-PHP_RINIT_FUNCTION(url_scanner)
-{
- url_adapt_state_ex_t *ctx;
- BLS_FETCH();
-
- ctx = &BG(url_adapt_state_ex);
-
- memset(ctx, 0, ((size_t) &((url_adapt_state_ex_t *)0)->tags));
-
- return SUCCESS;
-}
-
-PHP_RSHUTDOWN_FUNCTION(url_scanner)
-{
- url_adapt_state_ex_t *ctx;
- BLS_FETCH();
-
- ctx = &BG(url_adapt_state_ex);
-
- smart_str_free(&ctx->result);
- smart_str_free(&ctx->buf);
- smart_str_free(&ctx->tag);
- smart_str_free(&ctx->arg);
-
- return SUCCESS;
-}
-
-PHP_MINIT_FUNCTION(url_scanner)
-{
- url_adapt_state_ex_t *ctx;
- BLS_FETCH();
-
- ctx = &BG(url_adapt_state_ex);
-
- ctx->tags = NULL;
-
- REGISTER_INI_ENTRIES();
- return SUCCESS;
-}
-
-PHP_MSHUTDOWN_FUNCTION(url_scanner)
-{
- BLS_FETCH();
-
- UNREGISTER_INI_ENTRIES();
- zend_hash_destroy(BG(url_adapt_state_ex).tags);
- free(BG(url_adapt_state_ex).tags);
- return SUCCESS;
-}
-
-#endif
diff --git a/ext/standard/var.c b/ext/standard/var.c
deleted file mode 100644
index dc240cf7ad..0000000000
--- a/ext/standard/var.c
+++ /dev/null
@@ -1,676 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Jani Lehtimäki <jkl@njet.net> |
- | Thies C. Arntzen <thies@thieso.net> |
- | Sascha Schumann <sascha@schumann.cx> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-
-/* {{{ includes
-*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-#include "php.h"
-#include "php_string.h"
-#include "php_var.h"
-#include "basic_functions.h"
-#include "php_incomplete_class.h"
-
-#define COMMON ((*struc)->is_ref?"&":"")
-
-/* }}} */
-/* {{{ php_var_dump */
-
-static int php_array_element_dump(zval **zv, int num_args, va_list args, zend_hash_key *hash_key)
-{
- int level;
-
- level = va_arg(args, int);
-
- if (hash_key->nKeyLength==0) { /* numeric key */
- php_printf("%*c[%ld]=>\n", level + 1, ' ', hash_key->h);
- } else { /* string key */
- php_printf("%*c[\"%s\"]=>\n", level + 1, ' ', hash_key->arKey);
- }
- php_var_dump(zv, level + 2);
- return 0;
-}
-
-void php_var_dump(pval **struc, int level)
-{
- HashTable *myht;
-
- if (level>1) {
- php_printf("%*c", level-1, ' ');
- }
-
- switch ((*struc)->type) {
- case IS_BOOL:
- php_printf("%sbool(%s)\n", COMMON, ((*struc)->value.lval?"true":"false"));
- break;
- case IS_NULL:
- php_printf("%sNULL\n", COMMON);
- break;
- case IS_LONG:
- php_printf("%sint(%ld)\n", COMMON, (*struc)->value.lval);
- break;
- case IS_DOUBLE: {
- ELS_FETCH();
-
- php_printf("%sfloat(%.*G)\n", COMMON, (int) EG(precision), (*struc)->value.dval);
- }
- break;
- case IS_STRING:
- php_printf("%sstring(%d) \"", COMMON, (*struc)->value.str.len);
- PHPWRITE((*struc)->value.str.val, (*struc)->value.str.len);
- PUTS("\"\n");
- break;
- case IS_ARRAY:
- myht = HASH_OF(*struc);
- php_printf("%sarray(%d) {\n", COMMON, zend_hash_num_elements(myht));
- goto head_done;
- case IS_OBJECT:
- myht = HASH_OF(*struc);
- php_printf("%sobject(%s)(%d) {\n", COMMON, (*struc)->value.obj.ce->name, zend_hash_num_elements(myht));
-head_done:
- zend_hash_apply_with_arguments(myht, (ZEND_STD_HASH_APPLIER) php_array_element_dump, 1, level);
- if (level>1) {
- php_printf("%*c", level-1, ' ');
- }
- PUTS("}\n");
- break;
- case IS_RESOURCE: {
- char *type_name;
- type_name = zend_rsrc_list_get_rsrc_type((*struc)->value.lval);
- php_printf("%sresource(%ld) of type (%s)\n", COMMON, (*struc)->value.lval, type_name ? type_name : "Unknown");
- break;
- }
- default:
- php_printf("%sUNKNOWN:0\n",COMMON);
- break;
- }
-}
-
-/* }}} */
-
-
-/* {{{ proto void var_dump(mixed var)
- Dumps a string representation of variable to output */
-PHP_FUNCTION(var_dump)
-{
- zval ***args;
- int argc;
- int i;
-
- argc = ZEND_NUM_ARGS();
-
- args = (zval ***)emalloc(argc * sizeof(zval **));
- if (ZEND_NUM_ARGS() == 0 || zend_get_parameters_array_ex(argc, args) == FAILURE) {
- efree(args);
- WRONG_PARAM_COUNT;
- }
-
- for (i=0; i<argc; i++)
- php_var_dump(args[i], 1);
-
- efree(args);
-}
-/* }}} */
-
-
-/* {{{ php_var_dump */
-
-
-#define STR_CAT(P,S,I) {\
- pval *__p = (P);\
- ulong __i = __p->value.str.len;\
- __p->value.str.len += (I);\
- if (__p->value.str.val) {\
- __p->value.str.val = (char *)erealloc(__p->value.str.val, __p->value.str.len + 1);\
- } else {\
- __p->value.str.val = emalloc(__p->value.str.len + 1);\
- *__p->value.str.val = 0;\
- }\
- strcat(__p->value.str.val + __i, (S));\
-}
-
-/* }}} */
-/* {{{ php_var_serialize */
-
-inline int php_add_var_hash(HashTable *var_hash, zval *var, void *var_old) {
- ulong var_no;
- char id[sizeof(void *)*2+3];
-
- snprintf(id,sizeof(id)-1, "%p", var);
- id[sizeof(id)-1]='\0';
-
- if(var_old && zend_hash_find(var_hash, id, strlen(id), var_old) == SUCCESS) {
- if(!var->is_ref) {
- /* we still need to bump up the counter, since non-refs will
- be counted separately by unserializer */
- var_no = -1;
- zend_hash_next_index_insert(var_hash, &var_no, sizeof(var_no), NULL);
- }
- return FAILURE;
- }
-
- var_no = zend_hash_num_elements(var_hash)+1; /* +1 because otherwise hash will think we are trying to store NULL pointer */
- zend_hash_add(var_hash, id, strlen(id), &var_no, sizeof(var_no), NULL);
- return SUCCESS;
-}
-
-void php_var_serialize(pval *buf, pval **struc, HashTable *var_hash)
-{
- char s[256];
- ulong slen;
- int i;
- ulong *var_already;
- HashTable *myht;
- BLS_FETCH();
-
- if(var_hash != NULL && php_add_var_hash(var_hash,*struc,(void *)&var_already) == FAILURE && (*struc)->is_ref) {
- slen = sprintf(s,"R:%ld;",*var_already);
- STR_CAT(buf, s, slen);
- return;
- }
-
- switch ((*struc)->type) {
- case IS_BOOL:
- slen = sprintf(s, "b:%ld;", (*struc)->value.lval);
- STR_CAT(buf, s, slen);
- return;
-
- case IS_NULL:
- STR_CAT(buf, "N;", 2);
- return;
-
- case IS_LONG:
- slen = sprintf(s, "i:%ld;", (*struc)->value.lval);
- STR_CAT(buf, s, slen);
- return;
-
- case IS_DOUBLE: {
- ELS_FETCH();
- slen = sprintf(s, "d:%.*G;",(int) EG(precision), (*struc)->value.dval);
- STR_CAT(buf, s, slen);
- }
- return;
-
- case IS_STRING:{
- char *p;
-
- i = buf->value.str.len;
- slen = sprintf(s, "s:%d:\"", (*struc)->value.str.len);
- STR_CAT(buf, s, slen + (*struc)->value.str.len + 2);
- p = buf->value.str.val + i + slen;
- if ((*struc)->value.str.len > 0) {
- memcpy(p, (*struc)->value.str.val, (*struc)->value.str.len);
- p += (*struc)->value.str.len;
- }
- *p++ = '\"';
- *p++ = ';';
- *p = 0;
- }
- return;
-
- case IS_OBJECT: {
- zval *retval_ptr = NULL;
- zval *fname;
- int res;
- PHP_CLASS_ATTRIBUTES;
- CLS_FETCH();
-
- MAKE_STD_ZVAL(fname);
- ZVAL_STRING(fname,"__sleep",1);
-
- res = call_user_function_ex(CG(function_table), struc, fname, &retval_ptr, 0, 0, 1, NULL);
-
- if (res == SUCCESS) {
- if (retval_ptr && HASH_OF(retval_ptr)) {
- int count = zend_hash_num_elements(HASH_OF(retval_ptr));
-
- PHP_SET_CLASS_ATTRIBUTES(*struc);
- slen = sprintf(s, "O:%d:\"%s\":%d:{",name_len,class_name, count);
- PHP_CLEANUP_CLASS_ATTRIBUTES();
-
- STR_CAT(buf, s, slen);
- if (count > 0) {
- char *key;
- zval **d,**name;
- ulong index;
- HashPosition pos;
-
- zend_hash_internal_pointer_reset_ex(HASH_OF(retval_ptr),&pos);
- for (;; zend_hash_move_forward_ex(HASH_OF(retval_ptr),&pos)) {
- if ((i = zend_hash_get_current_key_ex(HASH_OF(retval_ptr), &key, NULL, &index, 0, &pos)) == HASH_KEY_NON_EXISTANT) {
- break;
- }
-
- zend_hash_get_current_data_ex(HASH_OF(retval_ptr), (void **) (&name), &pos);
-
- if ((*name)->type != IS_STRING) {
- php_error(E_NOTICE, "__sleep should return an array only containing the names of instance-variables to serialize.");
- continue;
- }
-
- if (zend_hash_find((*struc)->value.obj.properties,(*name)->value.str.val,(*name)->value.str.len+1,(void*)&d) == SUCCESS) {
- php_var_serialize(buf, name, NULL);
- php_var_serialize(buf,d,var_hash);
- }
- }
- }
- STR_CAT(buf, "}", 1);
- }
- } else {
- zval_dtor(fname);
- FREE_ZVAL(fname);
-
- if (retval_ptr) {
- zval_ptr_dtor(&retval_ptr);
- }
- goto std_array;
- }
-
- zval_dtor(fname);
- FREE_ZVAL(fname);
-
- if (retval_ptr) {
- zval_ptr_dtor(&retval_ptr);
- }
- return;
- }
-
- case IS_ARRAY:
- std_array:
- myht = HASH_OF(*struc);
- i = zend_hash_num_elements(myht);
- if ((*struc)->type == IS_ARRAY) {
- slen = sprintf(s, "a:%d:{", i);
- } else {
- PHP_CLASS_ATTRIBUTES;
-
- PHP_SET_CLASS_ATTRIBUTES(*struc);
- slen = sprintf(s, "O:%d:\"%s\":%d:{",name_len,class_name,i);
- PHP_CLEANUP_CLASS_ATTRIBUTES();
- }
- STR_CAT(buf, s, slen);
- if (i > 0) {
- char *key;
- pval **data,*d;
- ulong index;
- HashPosition pos;
-
- zend_hash_internal_pointer_reset_ex(myht, &pos);
- for (;; zend_hash_move_forward_ex(myht, &pos)) {
- if ((i = zend_hash_get_current_key_ex(myht, &key, NULL, &index, 0, &pos)) == HASH_KEY_NON_EXISTANT) {
- break;
- }
- if (zend_hash_get_current_data_ex(myht, (void **) (&data), &pos) != SUCCESS || !data /* || ((*data) == (*struc)) */) {
- continue;
- }
-
- switch (i) {
- case HASH_KEY_IS_LONG:
- MAKE_STD_ZVAL(d);
- d->type = IS_LONG;
- d->value.lval = index;
- php_var_serialize(buf, &d, NULL);
- FREE_ZVAL(d);
- break;
- case HASH_KEY_IS_STRING:
- MAKE_STD_ZVAL(d);
- d->type = IS_STRING;
- d->value.str.val = key;
- d->value.str.len = strlen(key);
- php_var_serialize(buf, &d, NULL);
- FREE_ZVAL(d);
- break;
- }
- php_var_serialize(buf, data, var_hash);
- }
- }
- STR_CAT(buf, "}", 1);
- return;
-
- default:
- STR_CAT(buf, "i:0;", 4);
- return;
- }
-}
-
-/* }}} */
-/* {{{ php_var_dump */
-
-int php_var_unserialize(pval **rval, const char **p, const char *max, HashTable *var_hash)
-{
- const char *q;
- char *str;
- int i;
- char cur;
- ulong id;
- HashTable *myht;
- pval **rval_ref;
-
- ELS_FETCH();
- BLS_FETCH();
-
- if(var_hash && **p != 'R') { /* references aren't counted by serializer! */
- zend_hash_next_index_insert(var_hash, rval, sizeof(*rval), NULL);
- }
-
- switch (cur = **p) {
- case 'R':
- if (*((*p) + 1) != ':') {
- return 0;
- }
- q = *p;
- while (**p && **p != ';') {
- (*p)++;
- }
- if (**p != ';') {
- return 0;
- }
- (*p)++;
- id = atol(q + 2)-1; /* count starts with 1 */
- if(!var_hash) {
- return 0;
- }
- if(zend_hash_index_find(var_hash, id, (void *)&rval_ref) != SUCCESS) {
- return 0;
- }
- zval_ptr_dtor(rval);
- *rval = *rval_ref;
- (*rval)->refcount++;
- (*rval)->is_ref = 1;
- return 1;
-
- case 'N':
- if (*((*p) + 1) != ';') {
- return 0;
- }
- (*p)++;
- INIT_PZVAL(*rval);
- (*rval)->type = IS_NULL;
- (*p)++;
- return 1;
-
- case 'b': /* bool */
- case 'i':
- if (*((*p) + 1) != ':') {
- return 0;
- }
- q = *p;
- while (**p && **p != ';') {
- (*p)++;
- }
- if (**p != ';') {
- return 0;
- }
- (*p)++;
- if (cur == 'b') {
- (*rval)->type = IS_BOOL;
- } else {
- (*rval)->type = IS_LONG;
- }
- INIT_PZVAL(*rval);
- (*rval)->value.lval = atol(q + 2);
- return 1;
-
- case 'd':
- if (*((*p) + 1) != ':') {
- return 0;
- }
- q = *p;
- while (**p && **p != ';') {
- (*p)++;
- }
- if (**p != ';') {
- return 0;
- }
- (*p)++;
- (*rval)->type = IS_DOUBLE;
- INIT_PZVAL(*rval);
- (*rval)->value.dval = atof(q + 2);
- return 1;
-
- case 's':
- if (*((*p) + 1) != ':') {
- return 0;
- }
- (*p) += 2;
- q = *p;
- while (**p && **p != ':') {
- (*p)++;
- }
- if (**p != ':') {
- return 0;
- }
- i = atoi(q);
- if (i < 0 || (*p + 3 + i) > max || *((*p) + 1) != '\"' ||
- *((*p) + 2 + i) != '\"' || *((*p) + 3 + i) != ';') {
- return 0;
- }
- (*p) += 2;
-
- if (i == 0) {
- str = empty_string;
- } else {
- str = estrndup(*p,i);
- }
- (*p) += i + 2;
- (*rval)->type = IS_STRING;
- (*rval)->value.str.val = str;
- (*rval)->value.str.len = i;
- INIT_PZVAL(*rval);
- return 1;
-
- case 'a':
- case 'o':
- case 'O': {
- zend_bool incomplete_class = 0;
- char *class_name = NULL;
- size_t name_len = 0;
- int pi;
-
- INIT_PZVAL(*rval);
-
- if (cur == 'a') {
- (*rval)->type = IS_ARRAY;
- ALLOC_HASHTABLE((*rval)->value.ht);
- myht = (*rval)->value.ht;
- } else {
- zend_class_entry *ce;
-
- if (cur == 'O') { /* php4 serialized - we get the class-name */
- if (*((*p) + 1) != ':') {
- return 0;
- }
- (*p) += 2;
- q = *p;
- while (**p && **p != ':') {
- (*p)++;
- }
- if (**p != ':') {
- return 0;
- }
- name_len = i = atoi(q);
- if (i < 0 || (*p + 3 + i) > max || *((*p) + 1) != '\"' ||
- *((*p) + 2 + i) != '\"' || *((*p) + 3 + i) != ':') {
- return 0;
- }
- (*p) += 2;
- class_name = emalloc(i + 1);
- for(pi=0;pi<i;pi++) {
- class_name[pi] = tolower((*p)[pi]);
- }
- class_name[i] = 0;
- (*p) += i;
-
- if (zend_hash_find(EG(class_table), class_name, i+1, (void **) &ce)==FAILURE) {
- incomplete_class = 1;
- ce = PHP_IC_ENTRY_READ;
- }
- } else { /* old php 3.0 data 'o' */
- ce = &zend_standard_class_def;
- }
-
- object_init_ex(*rval,ce);
- myht = (*rval)->value.obj.properties;
-
- if (incomplete_class)
- php_store_class_name(*rval, class_name, name_len);
-
- if (class_name)
- efree(class_name);
- }
-
- (*p) += 2;
- i = atoi(*p);
-
- if (cur == 'a') { /* object_init_ex will init the HashTable for objects! */
- zend_hash_init(myht, i + 1, NULL, ZVAL_PTR_DTOR, 0);
- }
-
- while (**p && **p != ':') {
- (*p)++;
- }
- if (**p != ':' || *((*p) + 1) != '{') {
- return 0;
- }
- for ((*p) += 2; **p && **p != '}' && i > 0; i--) {
- pval *key;
- pval *data;
-
- ALLOC_INIT_ZVAL(key);
- ALLOC_INIT_ZVAL(data);
-
- if (!php_var_unserialize(&key, p, max, NULL)) {
- zval_dtor(key);
- FREE_ZVAL(key);
- FREE_ZVAL(data);
- return 0;
- }
- if (!php_var_unserialize(&data, p, max, var_hash)) {
- zval_dtor(key);
- FREE_ZVAL(key);
- zval_dtor(data);
- FREE_ZVAL(data);
- return 0;
- }
- switch (key->type) {
- case IS_LONG:
- zend_hash_index_update(myht, key->value.lval, &data, sizeof(data), NULL);
- break;
- case IS_STRING:
- zend_hash_update(myht, key->value.str.val, key->value.str.len + 1, &data, sizeof(data), NULL);
- break;
- }
- zval_dtor(key);
- FREE_ZVAL(key);
- }
-
- if ((*rval)->type == IS_OBJECT) {
- zval *retval_ptr = NULL;
- zval *fname;
- CLS_FETCH();
-
- MAKE_STD_ZVAL(fname);
- ZVAL_STRING(fname,"__wakeup",1);
-
- call_user_function_ex(CG(function_table), rval, fname, &retval_ptr, 0, 0, 1, NULL);
-
- zval_dtor(fname);
- FREE_ZVAL(fname);
- if (retval_ptr)
- zval_ptr_dtor(&retval_ptr);
- }
-
- return *((*p)++) == '}';
- }
- }
-
- return 0;
-}
-
-/* }}} */
-/* {{{ proto string serialize(mixed variable)
- Returns a string representation of variable (which can later be unserialized) */
-PHP_FUNCTION(serialize)
-{
- pval **struc;
- php_serialize_data_t var_hash;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &struc) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- return_value->type = IS_STRING;
- return_value->value.str.val = NULL;
- return_value->value.str.len = 0;
-
- PHP_VAR_SERIALIZE_INIT(var_hash);
- php_var_serialize(return_value, struc, &var_hash);
- PHP_VAR_SERIALIZE_DESTROY(var_hash);
-}
-
-/* }}} */
-/* {{{ proto mixed unserialize(string variable_representation)
- Takes a string representation of variable and recreates it */
-
-
-PHP_FUNCTION(unserialize)
-{
- pval **buf;
- php_serialize_data_t var_hash;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &buf) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if ((*buf)->type == IS_STRING) {
- const char *p = (*buf)->value.str.val;
-
- if ((*buf)->value.str.len == 0) {
- RETURN_FALSE;
- }
-
- PHP_VAR_UNSERIALIZE_INIT(var_hash);
- if (!php_var_unserialize(&return_value, &p, p + (*buf)->value.str.len, &var_hash)) {
- PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
- zval_dtor(return_value);
- php_error(E_NOTICE, "unserialize() failed at offset %d of %d bytes",p-(*buf)->value.str.val,(*buf)->value.str.len);
- RETURN_FALSE;
- }
- PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
- } else {
- php_error(E_NOTICE, "argument passed to unserialize() is not an string");
- RETURN_FALSE;
- }
-}
-
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/swf/CREDITS b/ext/swf/CREDITS
deleted file mode 100644
index a215076e37..0000000000
--- a/ext/swf/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-SWF
-Sterling Hughes
diff --git a/ext/swf/Makefile.in b/ext/swf/Makefile.in
deleted file mode 100644
index fbeaf882f4..0000000000
--- a/ext/swf/Makefile.in
+++ /dev/null
@@ -1,7 +0,0 @@
-
-LTLIBRARY_NAME = libswf.la
-LTLIBRARY_SOURCES = swf.c
-LTLIBRARY_SHARED_NAME = swf.la
-LTLIBRARY_SHARED_LIBADD = $(SWF_SHARED_LIBADD)
-
-include $(top_srcdir)/build/dynlib.mk
diff --git a/ext/swf/config.m4 b/ext/swf/config.m4
deleted file mode 100644
index b05221bb60..0000000000
--- a/ext/swf/config.m4
+++ /dev/null
@@ -1,34 +0,0 @@
-dnl $Id$
-dnl config.m4 for extension libswf
-
-PHP_ARG_WITH(swf, for libswf support,
-[ --with-swf[=DIR] Include swf support])
-
-if test "$PHP_SWF" != "no"; then
- if test -r $PHP_SWF/lib/libswf.a; then
- SWF_DIR=$PHP_SWF
- else
- AC_MSG_CHECKING(for libswf in default path)
- for i in /usr/local /usr; do
- if test -r $i/lib/libswf.a; then
- SWF_DIR=$i
- AC_MSG_RESULT(found in $i)
- fi
- done
- fi
-
- if test -z "$SWF_DIR"; then
- AC_MSG_RESULT(not found)
- AC_MSG_ERROR(Please reinstall the libswf distribution -
- swf.h should be <swf-dir>/include and
- libswf.a should be in <swf-dir>/lib)
- fi
-
- PHP_ADD_INCLUDE($SWF_DIR/include)
-
- PHP_SUBST(SWF_SHARED_LIBADD)
- PHP_ADD_LIBRARY_WITH_PATH(swf, $SWF_DIR/lib, SWF_SHARED_LIBADD)
- AC_DEFINE(HAVE_SWF,1,[ ])
-
- PHP_EXTENSION(swf, $ext_shared)
-fi
diff --git a/ext/swf/php_swf.h b/ext/swf/php_swf.h
deleted file mode 100644
index e4bd699761..0000000000
--- a/ext/swf/php_swf.h
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Sterling Hughes <sterling@php.net> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef PHP_SWF_H
-#define PHP_SWF_H
-
-#if HAVE_SWF
-
-extern zend_module_entry swf_module_entry;
-#define swf_module_ptr &swf_module_entry
-
-PHP_MINIT_FUNCTION(swf);
-PHP_MINFO_FUNCTION(swf);
-PHP_RINIT_FUNCTION(swf);
-extern void php_swf_define(INTERNAL_FUNCTION_PARAMETERS, int opt);
-extern void php_swf_fill_bitmap(INTERNAL_FUNCTION_PARAMETERS, int opt);
-extern void php_swf_geo_same(INTERNAL_FUNCTION_PARAMETERS, int opt);
-PHP_FUNCTION(swf_openfile);
-PHP_FUNCTION(swf_closefile);
-PHP_FUNCTION(swf_labelframe);
-PHP_FUNCTION(swf_showframe);
-PHP_FUNCTION(swf_setframe);
-PHP_FUNCTION(swf_getframe);
-PHP_FUNCTION(swf_mulcolor);
-PHP_FUNCTION(swf_addcolor);
-PHP_FUNCTION(swf_placeobject);
-PHP_FUNCTION(swf_modifyobject);
-PHP_FUNCTION(swf_removeobject);
-PHP_FUNCTION(swf_nextid);
-PHP_FUNCTION(swf_startdoaction);
-PHP_FUNCTION(swf_enddoaction);
-PHP_FUNCTION(swf_actiongotoframe);
-PHP_FUNCTION(swf_actiongeturl);
-PHP_FUNCTION(swf_actionnextframe);
-PHP_FUNCTION(swf_actionprevframe);
-PHP_FUNCTION(swf_actionplay);
-PHP_FUNCTION(swf_actionstop);
-PHP_FUNCTION(swf_actiontogglequality);
-PHP_FUNCTION(swf_actionwaitforframe);
-PHP_FUNCTION(swf_actionsettarget);
-PHP_FUNCTION(swf_actiongotolabel);
-PHP_FUNCTION(swf_defineline);
-PHP_FUNCTION(swf_definerect);
-PHP_FUNCTION(swf_definepoly);
-PHP_FUNCTION(swf_startshape);
-PHP_FUNCTION(swf_shapelinesolid);
-PHP_FUNCTION(swf_shapefilloff);
-PHP_FUNCTION(swf_shapefillsolid);
-PHP_FUNCTION(swf_shapefillbitmapclip);
-PHP_FUNCTION(swf_shapefillbitmaptile);
-PHP_FUNCTION(swf_shapemoveto);
-PHP_FUNCTION(swf_shapelineto);
-PHP_FUNCTION(swf_shapecurveto);
-PHP_FUNCTION(swf_shapecurveto3);
-PHP_FUNCTION(swf_shapearc);
-PHP_FUNCTION(swf_endshape);
-PHP_FUNCTION(swf_definefont);
-PHP_FUNCTION(swf_setfont);
-PHP_FUNCTION(swf_fontsize);
-PHP_FUNCTION(swf_fontslant);
-PHP_FUNCTION(swf_fonttracking);
-PHP_FUNCTION(swf_getfontinfo);
-PHP_FUNCTION(swf_definetext);
-PHP_FUNCTION(swf_textwidth);
-PHP_FUNCTION(swf_definebitmap);
-PHP_FUNCTION(swf_getbitmapinfo);
-PHP_FUNCTION(swf_startsymbol);
-PHP_FUNCTION(swf_endsymbol);
-PHP_FUNCTION(swf_startbutton);
-PHP_FUNCTION(swf_addbuttonrecord);
-PHP_FUNCTION(swf_oncondition);
-PHP_FUNCTION(swf_endbutton);
-PHP_FUNCTION(swf_viewport);
-PHP_FUNCTION(swf_ortho);
-PHP_FUNCTION(swf_ortho2);
-PHP_FUNCTION(swf_perspective);
-PHP_FUNCTION(swf_polarview);
-PHP_FUNCTION(swf_lookat);
-PHP_FUNCTION(swf_pushmatrix);
-PHP_FUNCTION(swf_popmatrix);
-PHP_FUNCTION(swf_scale);
-PHP_FUNCTION(swf_translate);
-PHP_FUNCTION(swf_rotate);
-PHP_FUNCTION(swf_posround);
-
-
-ZEND_BEGIN_MODULE_GLOBALS(swf)
- int use_file;
- char *tmpfile_name;
-ZEND_END_MODULE_GLOBALS(swf)
-
-#ifdef ZTS
-#define SWFLS_D zend_swf_globals *swf_globals
-#define SWFG(v) (swf_globals->v)
-#define SWFLS_FETCH() zend_swf_globals *swf_globals = ts_resource(swf_globals_id)
-#else
-#define SWFLS_D
-#define SWFG(v) (swf_globals.v)
-#define SWFLS_FETCH()
-#endif
-
-#else
-#define swf_module_ptr NULL
-#endif /* HAVE_FLASH */
-#define phpext_swf_ptr swf_module_ptr
-#endif /* _PHP_FLASH_H */
diff --git a/ext/swf/swf.c b/ext/swf/swf.c
deleted file mode 100644
index ac7e6f3bcb..0000000000
--- a/ext/swf/swf.c
+++ /dev/null
@@ -1,1258 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Sterling Hughes <sterling@php.net> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-
-#if HAVE_SWF
-#include <stdio.h>
-#include <swf.h>
-#include "ext/standard/info.h"
-#include "php_open_temporary_file.h"
-#include "php_swf.h"
-
-ZEND_DECLARE_MODULE_GLOBALS(swf)
-
-/* {{{ swf_functions[]
- */
-function_entry swf_functions[] = {
- PHP_FE(swf_openfile, NULL)
- PHP_FE(swf_closefile, NULL)
- PHP_FE(swf_labelframe, NULL)
- PHP_FE(swf_showframe, NULL)
- PHP_FE(swf_setframe, NULL)
- PHP_FE(swf_getframe, NULL)
- PHP_FE(swf_mulcolor, NULL)
- PHP_FE(swf_addcolor, NULL)
- PHP_FE(swf_placeobject, NULL)
- PHP_FE(swf_modifyobject, NULL)
- PHP_FE(swf_removeobject, NULL)
- PHP_FE(swf_nextid, NULL)
- PHP_FE(swf_startdoaction, NULL)
- PHP_FE(swf_enddoaction, NULL)
- PHP_FE(swf_actiongotoframe, NULL)
- PHP_FE(swf_actiongeturl, NULL)
- PHP_FE(swf_actionnextframe, NULL)
- PHP_FE(swf_actionprevframe, NULL)
- PHP_FE(swf_actionplay, NULL)
- PHP_FE(swf_actionstop, NULL)
- PHP_FE(swf_actiontogglequality, NULL)
- PHP_FE(swf_actionwaitforframe, NULL)
- PHP_FE(swf_actionsettarget, NULL)
- PHP_FE(swf_actiongotolabel, NULL)
- PHP_FE(swf_defineline, NULL)
- PHP_FE(swf_definerect, NULL)
- PHP_FE(swf_definepoly, NULL)
- PHP_FE(swf_startshape, NULL)
- PHP_FE(swf_shapelinesolid, NULL)
- PHP_FE(swf_shapefilloff, NULL)
- PHP_FE(swf_shapefillsolid, NULL)
- PHP_FE(swf_shapefillbitmapclip, NULL)
- PHP_FE(swf_shapefillbitmaptile, NULL)
- PHP_FE(swf_shapemoveto, NULL)
- PHP_FE(swf_shapelineto, NULL)
- PHP_FE(swf_shapecurveto, NULL)
- PHP_FE(swf_shapecurveto3, NULL)
- PHP_FE(swf_shapearc, NULL)
- PHP_FE(swf_endshape, NULL)
- PHP_FE(swf_definefont, NULL)
- PHP_FE(swf_setfont, NULL)
- PHP_FE(swf_fontsize, NULL)
- PHP_FE(swf_fontslant, NULL)
- PHP_FE(swf_fonttracking, NULL)
- PHP_FE(swf_getfontinfo, NULL)
- PHP_FE(swf_definetext, NULL)
- PHP_FE(swf_textwidth, NULL)
- PHP_FE(swf_definebitmap, NULL)
- PHP_FE(swf_getbitmapinfo, NULL)
- PHP_FE(swf_startsymbol, NULL)
- PHP_FE(swf_endsymbol, NULL)
- PHP_FE(swf_startbutton, NULL)
- PHP_FE(swf_addbuttonrecord, NULL)
- PHP_FE(swf_oncondition, NULL)
- PHP_FE(swf_endbutton, NULL)
- PHP_FE(swf_viewport, NULL)
- PHP_FE(swf_ortho, NULL)
- PHP_FE(swf_ortho2, NULL)
- PHP_FE(swf_perspective, NULL)
- PHP_FE(swf_polarview, NULL)
- PHP_FE(swf_lookat, NULL)
- PHP_FE(swf_pushmatrix, NULL)
- PHP_FE(swf_popmatrix, NULL)
- PHP_FE(swf_scale, NULL)
- PHP_FE(swf_translate, NULL)
- PHP_FE(swf_rotate, NULL)
- PHP_FE(swf_posround, NULL)
- {NULL,NULL,NULL}
-};
-/* }}} */
-
-/* {{{ swf_module_entry
- */
-zend_module_entry swf_module_entry = {
- "swf",
- swf_functions,
- PHP_MINIT(swf),
- NULL,
- PHP_RINIT(swf),
- NULL,
- PHP_MINFO(swf),
- STANDARD_MODULE_PROPERTIES
-};
-/* }}} */
-
-#ifdef COMPILE_DL_SWF
-ZEND_GET_MODULE(swf)
-#endif
-
-/* {{{ PHP_MINFO_FUNCTION
- */
-PHP_MINFO_FUNCTION(swf)
-{
- php_info_print_table_start();
- php_info_print_table_row(2, "swf support", "enabled");
- php_info_print_table_end();
-}
-/* }}} */
-
-/* {{{ PHP_MINIT_FUNCTION
- */
-PHP_MINIT_FUNCTION(swf)
-{
- REGISTER_LONG_CONSTANT("MOD_COLOR", MOD_COLOR, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("MOD_MATRIX", MOD_MATRIX, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("TYPE_PUSHBUTTON", TYPE_PUSHBUTTON, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("TYPE_MENUBUTTON", TYPE_MENUBUTTON, CONST_CS | CONST_PERSISTENT);
- REGISTER_DOUBLE_CONSTANT("BSHitTest", BSHitTest, CONST_CS | CONST_PERSISTENT);
- REGISTER_DOUBLE_CONSTANT("BSDown", BSDown, CONST_CS | CONST_PERSISTENT);
- REGISTER_DOUBLE_CONSTANT("BSOver", BSOver, CONST_CS | CONST_PERSISTENT);
- REGISTER_DOUBLE_CONSTANT("BSUp", BSUp, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("OverDowntoIdle", OverDowntoIdle, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("IdletoOverDown", IdletoOverDown, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("OutDowntoIdle", OutDowntoIdle, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("OutDowntoOverDown", OutDowntoOverDown, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("OverDowntoOutDown", OverDowntoOutDown, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("OverUptoOverDown", OverUptoOverDown, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("OverUptoIdle", OverUptoIdle, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("IdletoOverUp", IdletoOverUp, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("ButtonEnter", ButtonEnter, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("ButtonExit", ButtonExit, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("MenuEnter", MenuEnter, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("MenuExit", MenuExit, CONST_CS | CONST_PERSISTENT);
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_RINIT_FUNCTION
- */
-PHP_RINIT_FUNCTION(swf)
-{
- SWFLS_FETCH();
- SWFG(use_file) = 0;
-
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ proto void swf_openfile(string name, double xsize, double ysize, double framerate, double r, double g, double b)
- Create a Shockwave Flash file given by name, with width xsize and height ysize at a frame rate of framerate and a background color specified by a red value of r, green value of g and a blue value of b */
-PHP_FUNCTION(swf_openfile)
-{
- zval **name, **sizeX, **sizeY, **frameRate, **r, **g, **b;
- char *na, *tmpna;
- zend_bool free_na;
- SWFLS_FETCH();
-
- if (ZEND_NUM_ARGS() != 7 ||
- zend_get_parameters_ex(7, &name, &sizeX, &sizeY, &frameRate, &r, &g, &b) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(name);
- convert_to_double_ex(sizeX);
- convert_to_double_ex(sizeY);
- convert_to_double_ex(frameRate);
- convert_to_double_ex(r);
- convert_to_double_ex(g);
- convert_to_double_ex(b);
-
-
- tmpna = Z_STRVAL_PP(name);
-
- if (strcasecmp("php://stdout", tmpna) == 0) {
- FILE *fp;
-
- fp = php_open_temporary_file(NULL, "php_swf_stdout", &na);
- if (!fp) {
- free_na = 0;
- RETURN_FALSE;
- }
- VCWD_UNLINK((const char *)na);
- fclose(fp);
- free_na = 1;
- SWFG(use_file) = 0;
- } else {
- na = tmpna;
- SWFG(use_file) = 1;
- }
-
-#ifdef VIRTUAL_DIR
- if (virtual_filepath(na, &tmpna)) {
- if (free_na) {
- efree(na);
- }
- return;
- }
- if (free_na) {
- efree(na);
- }
- na = tmpna;
-#endif
- if (!SWFG(use_file))
- SWFG(tmpfile_name) = na;
-
- swf_openfile(na,(float)Z_DVAL_PP(sizeX), (float)Z_DVAL_PP(sizeY),
- (float)Z_DVAL_PP(frameRate), (float)Z_DVAL_PP(r),
- (float)Z_DVAL_PP(g), (float)Z_DVAL_PP(b));
-#ifdef VIRTUAL_DIR
- free(na);
-#endif
-}
-/* }}} */
-
-/* {{{ proto void swf_closefile(void)
- Close a Shockwave flash file that was opened with swf_openfile */
-PHP_FUNCTION(swf_closefile)
-{
- SWFLS_FETCH();
-
- swf_closefile();
-
- if (!SWFG(use_file)) {
- FILE *f;
- char buf[4096];
- int b;
-
- if ((f = VCWD_FOPEN(SWFG(tmpfile_name), "r")) == NULL) {
- php_error(E_WARNING, "Cannot create temporary file for stdout support with SWF");
- RETURN_NULL();
- }
-
- while ((b = fread(buf, 1, sizeof(buf), f)) > 0)
- php_write(buf, b);
-
- fclose(f);
-
- VCWD_UNLINK((const char *)SWFG(tmpfile_name));
- }
-}
-/* }}} */
-
-/* {{{ proto void swf_labelframe(string name)
- Adds string name to the current frame */
-PHP_FUNCTION(swf_labelframe)
-{
- zval **name;
- if (ZEND_NUM_ARGS() != 1 ||
- zend_get_parameters_ex(1, &name) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(name);
- swf_labelframe(Z_STRVAL_PP(name));
-}
-/* }}} */
-
-/* {{{ proto void swf_showframe(void)
- Finish the current frame */
-PHP_FUNCTION(swf_showframe)
-{
- swf_showframe();
-}
-/* }}} */
-
-/* {{{ proto void swf_setframe(int frame_number)
- Set the current frame number to the number given by frame_number */
-PHP_FUNCTION(swf_setframe)
-{
- zval **frameno;
- if (ZEND_NUM_ARGS() != 1 ||
- zend_get_parameters_ex(1, &frameno) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(frameno);
-
- swf_setframe(Z_LVAL_PP(frameno));
-}
-/* }}} */
-
-/* {{{ proto int swf_getframe(void)
- Returns the current frame */
-PHP_FUNCTION(swf_getframe)
-{
- RETURN_LONG(swf_getframe());
-}
-/* }}} */
-
-/* {{{ col_swf
- */
-void col_swf(INTERNAL_FUNCTION_PARAMETERS, int opt) {
- zval **r, **g, **b, **a;
- if (ZEND_NUM_ARGS() != 4 ||
- zend_get_parameters_ex(4, &r, &g, &b, &a) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_double_ex(r);
- convert_to_double_ex(g);
- convert_to_double_ex(b);
- convert_to_double_ex(a);
- if (opt) {
- swf_addcolor((float)Z_DVAL_PP(r), (float)Z_DVAL_PP(g), (float)Z_DVAL_PP(b), (float)Z_DVAL_PP(a));
- } else {
- swf_mulcolor((float)Z_DVAL_PP(r), (float)Z_DVAL_PP(g), (float)Z_DVAL_PP(b), (float)Z_DVAL_PP(a));
- }
-}
-/* }}} */
-
-/* {{{ proto void swf_mulcolor(double r, double g, double b, double a)
- Sets the global multiply color to the rgba value specified */
-PHP_FUNCTION(swf_mulcolor)
-{
- col_swf(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-/* }}} */
-
-/* {{{ proto void swf_addcolor(double r, double g, double b, double a)
- Set the global add color to the rgba value specified */
-PHP_FUNCTION(swf_addcolor)
-{
- col_swf(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
-}
-/* }}} */
-
-/* {{{ proto void swf_placeobject(int objid, int depth)
- Places the object, objid, in the current frame at depth, depth */
-PHP_FUNCTION(swf_placeobject)
-{
- zval **objid, **depth;
- if (ZEND_NUM_ARGS() != 2 ||
- zend_get_parameters_ex(2, &objid, &depth) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(objid);
- convert_to_long_ex(depth);
- swf_placeobject(Z_LVAL_PP(objid), Z_LVAL_PP(depth));
-}
-/* }}} */
-
-/* {{{ proto void swf_modifyobject(int depth, int how)
- Updates the position and/or color of the object */
-PHP_FUNCTION(swf_modifyobject)
-{
- zval **depth, **how;
- if (ZEND_NUM_ARGS() != 2 ||
- zend_get_parameters_ex(2, &depth, &how) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(depth);
- convert_to_long_ex(how);
-
- swf_modifyobject(Z_LVAL_PP(depth), Z_LVAL_PP(how));
-}
-/* }}} */
-
-/* {{{ proto void swf_removeobject(int depth)
- Removes the object at the specified depth */
-PHP_FUNCTION(swf_removeobject)
-{
- zval **depth;
- if (ZEND_NUM_ARGS() != 1 ||
- zend_get_parameters_ex(1, &depth) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(depth);
-
- swf_removeobject(Z_LVAL_PP(depth));
-}
-/* }}} */
-
-/* {{{ proto int swf_nextid(void)
- Returns a free objid */
-PHP_FUNCTION(swf_nextid)
-{
- RETURN_LONG(swf_nextid());
-}
-/* }}} */
-
-/* {{{ proto void swf_startdoaction(void)
- Starts the description of an action list for the current frame */
-PHP_FUNCTION(swf_startdoaction)
-{
- swf_startdoaction();
-}
-/* }}} */
-
-/* {{{ proto void swf_enddoaction(void)
- Ends the list of actions to perform for the current frame */
-PHP_FUNCTION(swf_enddoaction)
-{
- swf_enddoaction();
-}
-/* }}} */
-
-/* {{{ proto void swf_actiongotoframe(int frame_number)
- Causes the Flash movie to display the specified frame, frame_number, and then stop. */
-PHP_FUNCTION(swf_actiongotoframe)
-{
- zval **frameno;
- if (ZEND_NUM_ARGS() != 1 ||
- zend_get_parameters_ex(1, &frameno) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(frameno);
-
- swf_actionGotoFrame(Z_LVAL_PP(frameno));
-}
-/* }}} */
-
-/* {{{ proto void swf_actiongeturl(string url, string target)
- Gets the specified url */
-PHP_FUNCTION(swf_actiongeturl)
-{
- zval **url, **target;
- if (ZEND_NUM_ARGS() != 2 ||
- zend_get_parameters_ex(2, &url, &target) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(url);
- convert_to_string_ex(target);
-
- swf_actionGetURL(Z_STRVAL_PP(url), Z_STRVAL_PP(target));
-}
-/* }}} */
-
-/* {{{ proto void swf_actionnextframe(void)
- Goes foward one frame */
-PHP_FUNCTION(swf_actionnextframe)
-{
- swf_actionNextFrame();
-}
-/* }}} */
-
-/* {{{ proto void swf_actionprevframe(void)
- Goes backward one frame */
-PHP_FUNCTION(swf_actionprevframe)
-{
- swf_actionPrevFrame();
-}
-/* }}} */
-
-/* {{{ proto void swf_actionplay(void)
- Starts playing the Flash movie from the current frame */
-PHP_FUNCTION(swf_actionplay)
-{
- swf_actionPlay();
-}
-/* }}} */
-
-/* {{{ proto void swf_actionstop(void)
- Stops playing the Flash movie at the current frame */
-PHP_FUNCTION(swf_actionstop)
-{
- swf_actionStop();
-}
-/* }}} */
-
-/* {{{ proto void swf_actiontogglequality(void)
- Toggles between high and low quality */
-PHP_FUNCTION(swf_actiontogglequality)
-{
- swf_actionToggleQuality();
-}
-/* }}} */
-
-/* {{{ proto void swf_actionwaitforframe(int frame, int skipcount)
- If the specified frame has not been loaded, skip the specified number of actions in the action list */
-PHP_FUNCTION(swf_actionwaitforframe)
-{
- zval **frame, **skipcount;
- if (ZEND_NUM_ARGS() != 2 ||
- zend_get_parameters_ex(2, &frame, &skipcount) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(frame);
- convert_to_long_ex(skipcount);
- swf_actionWaitForFrame(Z_LVAL_PP(frame), Z_LVAL_PP(skipcount));
-}
-/* }}} */
-
-/* {{{ proto void swf_actionsettarget(string target)
- Sets the context for actions */
-PHP_FUNCTION(swf_actionsettarget)
-{
- zval **target;
- if (ZEND_NUM_ARGS() != 1 ||
- zend_get_parameters_ex(1, &target) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(target);
- swf_actionSetTarget(Z_STRVAL_PP(target));
-}
-/* }}} */
-
-/* {{{ proto void swf_actiongotolabel(string label)
- Causes the flash movie to display the frame with the given label and then stop */
-PHP_FUNCTION(swf_actiongotolabel)
-{
- zval **label;
- if (ZEND_NUM_ARGS() != 1 ||
- zend_get_parameters_ex(1, &label) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(label);
- swf_actionGoToLabel(Z_STRVAL_PP(label));
-}
-/* }}} */
-
-/* {{{ php_swf_define
- */
-void php_swf_define(INTERNAL_FUNCTION_PARAMETERS, int opt)
-{
- zval **objid, **x1, **y1, **x2, **y2, **width;
- if (ZEND_NUM_ARGS() != 6 ||
- zend_get_parameters_ex(6, &objid, &x1, &y1, &x2, &y2, &width) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(objid);
- convert_to_double_ex(x1);
- convert_to_double_ex(y1);
- convert_to_double_ex(x2);
- convert_to_double_ex(y2);
- convert_to_double_ex(width);
-
- if (opt) {
- swf_defineline(Z_LVAL_PP(objid), (float)Z_DVAL_PP(x1), (float)Z_DVAL_PP(y1),
- (float)Z_DVAL_PP(x2), (float)Z_DVAL_PP(y2), (float)Z_DVAL_PP(width));
- } else {
- swf_definerect(Z_LVAL_PP(objid), (float)Z_DVAL_PP(x1), (float)Z_DVAL_PP(y1),
- (float)Z_DVAL_PP(x2), (float)Z_DVAL_PP(y2), (float)Z_DVAL_PP(width));
- }
-}
-/* }}} */
-
-/* {{{ proto void swf_defineline(int objid, double x1, double y1, double x2, double y2, double width)
- Create a line with object id, objid, starting from x1, y1 and going to x2, y2 with width, width */
-PHP_FUNCTION(swf_defineline)
-{
- php_swf_define(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
-}
-/* }}} */
-
-/* {{{ proto void swf_definerect(int objid, double x1, double y1, double x2, double y2, double width)
- Create a rectangle with object id, objid, the upper lefthand coordinate is given by x1, y1 the bottom right coordinate is x2, y2 and with is the width of the line */
-PHP_FUNCTION(swf_definerect)
-{
- php_swf_define(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-/* }}} */
-
-/* {{{ proto void swf_definepoly(int obj_id, array coords, int npoints, double width)
- Define a Polygon from an array of x,y coordinates, coords. */
-PHP_FUNCTION(swf_definepoly)
-{
- zval **obj_id, **coordinates, **NumPoints, **width, **var;
- int npoints, i;
- float coords[256][2];
-
- if (ZEND_NUM_ARGS() != 4 ||
- zend_get_parameters_ex(4, &obj_id, &coordinates, &NumPoints, &width) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(obj_id);
- convert_to_long_ex(NumPoints);
- convert_to_double_ex(width);
-
- if ((*coordinates)->type != IS_ARRAY) {
- return;
- php_error(E_WARNING, "Wrong datatype of second argument to swf_definepoly");
- }
-
- npoints = Z_LVAL_PP(NumPoints);
- for (i = 0; i < npoints; i++)
- {
- if (zend_hash_index_find(Z_ARRVAL_PP(coordinates), (i * 2), (void **)&var) == SUCCESS) {
- SEPARATE_ZVAL(var);
- convert_to_double_ex(var);
- coords[i][0] = (float)Z_DVAL_PP(var);
- }
-
- if (zend_hash_index_find(Z_ARRVAL_PP(coordinates), (i * 2) + 1, (void **)&var) == SUCCESS) {
- SEPARATE_ZVAL(var);
- convert_to_double_ex(var);
- coords[i][1] = (float)Z_DVAL_PP(var);
- }
-
- }
- swf_definepoly(Z_LVAL_PP(obj_id), coords, npoints, (float)Z_DVAL_PP(width));
-}
-/* }}} */
-
-/* {{{ proto void swf_startshape(int objid)
- Initialize a new shape with object id, objid */
-PHP_FUNCTION(swf_startshape)
-{
- zval **objid;
- if (ZEND_NUM_ARGS() != 1 ||
- zend_get_parameters_ex(1, &objid) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(objid);
- swf_startshape(Z_LVAL_PP(objid));
-}
-/* }}} */
-
-/* {{{ proto void swf_shapelinesolid(double r, double g, double b, double a, double width)
- Create a line with color defined by rgba, and a width of width */
-PHP_FUNCTION(swf_shapelinesolid)
-{
- zval **r, **g, **b, **a, **width;
- if (ZEND_NUM_ARGS() != 5 ||
- zend_get_parameters_ex(5, &r, &g, &b, &a, &width) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_double_ex(r);
- convert_to_double_ex(g);
- convert_to_double_ex(b);
- convert_to_double_ex(a);
- convert_to_double_ex(width);
- swf_shapelinesolid((float)Z_DVAL_PP(r), (float)Z_DVAL_PP(g), (float)Z_DVAL_PP(b), (float)Z_DVAL_PP(a),
- (float)Z_DVAL_PP(width));
-}
-/* }}} */
-
-/* {{{ proto void swf_shapefilloff(void)
- Turns off filling */
-PHP_FUNCTION(swf_shapefilloff)
-{
- swf_shapefilloff();
-}
-/* }}} */
-
-/* {{{ proto void swf_shapefillsolid(double r, double g, double b, double a)
- Sets the current fill style to a solid fill with the specified rgba color */
-PHP_FUNCTION(swf_shapefillsolid)
-{
- zval **r, **g, **b, **a;
- if (ZEND_NUM_ARGS() != 4 ||
- zend_get_parameters_ex(4, &r, &g, &b, &a) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_double_ex(r);
- convert_to_double_ex(g);
- convert_to_double_ex(b);
- convert_to_double_ex(a);
-
- swf_shapefillsolid((float)Z_DVAL_PP(r), (float)Z_DVAL_PP(g), (float)Z_DVAL_PP(b), (float)Z_DVAL_PP(a));
-}
-/* }}} */
-
-/* {{{ php_swf_fill_bitmap
- */
-void php_swf_fill_bitmap(INTERNAL_FUNCTION_PARAMETERS, int opt)
-{
- zval **bitmapid;
- if (ZEND_NUM_ARGS() != 1 ||
- zend_get_parameters_ex(1, &bitmapid) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(bitmapid);
-
- if (opt) {
- swf_shapefillbitmapclip(Z_LVAL_PP(bitmapid));
- } else {
- swf_shapefillbitmaptile(Z_LVAL_PP(bitmapid));
- }
-}
-/* }}} */
-
-/* {{{ proto void swf_shapefillbitmapclip(int bitmapid)
- Sets the current fill mode to clipped bitmap fill. Pixels from the previously defined bitmapid will be used to fill areas */
-PHP_FUNCTION(swf_shapefillbitmapclip)
-{
- php_swf_fill_bitmap(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
-}
-/* }}} */
-
-/* {{{ proto void swf_shapefillbitmaptile(int bitmapid)
- Sets the current fill mode to tiled bitmap fill. Pixels from the previously defined bitmapid will be used to fill areas */
-PHP_FUNCTION(swf_shapefillbitmaptile)
-{
- php_swf_fill_bitmap(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-/* }}} */
-
-/* {{{ php_swf_shape
- */
-void php_swf_shape(INTERNAL_FUNCTION_PARAMETERS, int opt)
-{
- zval **x, **y;
- if (ZEND_NUM_ARGS() != 2 ||
- zend_get_parameters_ex(2, &x, &y) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_double_ex(x);
- convert_to_double_ex(y);
-
- if (opt) {
- swf_shapemoveto((float)Z_DVAL_PP(x), (float)Z_DVAL_PP(y));
- } else {
- swf_shapelineto((float)Z_DVAL_PP(x), (float)Z_DVAL_PP(y));
- }
-}
-/* }}} */
-
-/* {{{ proto void swf_shapemoveto(double x, double y)
- swf_shapemoveto moves the current position to the given x,y. */
-PHP_FUNCTION(swf_shapemoveto)
-{
- php_swf_shape(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
-}
-/* }}} */
-
-/* {{{ proto void swf_shapelineto(double x, double y)
- Draws a line from the current position to x,y, the current position is then set to x,y */
-PHP_FUNCTION(swf_shapelineto)
-{
- php_swf_shape(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-/* }}} */
-
-/* {{{ proto void swf_shapecurveto(double x1, double y1, double x2, double y2)
- Draws a quadratic bezier curve starting at the current position using x1, y1 as an off curve control point and using x2, y2 as the end point. The current position is then set to x2, y2. */
-PHP_FUNCTION(swf_shapecurveto)
-{
- zval **x1, **y1, **x2, **y2;
- if (ZEND_NUM_ARGS() != 4 ||
- zend_get_parameters_ex(4, &x1, &y1, &x2, &y2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_double_ex(x1);
- convert_to_double_ex(y1);
- convert_to_double_ex(x2);
- convert_to_double_ex(y2);
-
- swf_shapecurveto((float)Z_DVAL_PP(x1), (float)Z_DVAL_PP(y1), (float)Z_DVAL_PP(x2), (float)Z_DVAL_PP(y2));
-}
-/* }}} */
-
-/* {{{ proto void swf_shapecurveto3(double x1, double y1, double x2, double y2, double x3, double y3)
- Draws a cubic bezier curve starting at the current position using x1, y1 and x2, y2 as off curve control points and using x3,y3 as the end point. The current position is then sent to x3, y3 */
-PHP_FUNCTION(swf_shapecurveto3)
-{
- zval **x1, **y1, **x2, **y2, **x3, **y3;
- if (ZEND_NUM_ARGS() != 6 ||
- zend_get_parameters_ex(6, &x1, &y1, &x2, &y2, &x3, &y3) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_double_ex(x1);
- convert_to_double_ex(y1);
- convert_to_double_ex(x2);
- convert_to_double_ex(y2);
- convert_to_double_ex(x3);
- convert_to_double_ex(y3);
-
- swf_shapecurveto3((float)Z_DVAL_PP(x1), (float)Z_DVAL_PP(y1), (float)Z_DVAL_PP(x2), (float)Z_DVAL_PP(y2),
- (float)Z_DVAL_PP(x3), (float)Z_DVAL_PP(y3));
-}
-/* }}} */
-
-/* {{{ proto void swf_shapearc(double x, double y, double r, double ang1, double ang2)
- Draws a circular arc from ang1 to ang2. The center of the circle is given by x, and y. r specifies the radius of the arc */
-PHP_FUNCTION(swf_shapearc)
-{
- zval **x, **y, **r, **ang1, **ang2;
- if (ZEND_NUM_ARGS() != 5 ||
- zend_get_parameters_ex(5, &x, &y, &r, &ang1, &ang2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_double_ex(x);
- convert_to_double_ex(y);
- convert_to_double_ex(r);
- convert_to_double_ex(ang1);
- convert_to_double_ex(ang2);
-
- swf_shapearc((float)Z_DVAL_PP(x), (float)Z_DVAL_PP(y), (float)Z_DVAL_PP(r), (float)Z_DVAL_PP(ang1),
- (float)Z_DVAL_PP(ang2));
-}
-/* }}} */
-
-/* {{{ proto void swf_endshape(void)
- Completes the definition of the current shape */
-PHP_FUNCTION(swf_endshape)
-{
- swf_endshape();
-}
-/* }}} */
-
-/* {{{ proto void swf_definefont(int fontid, string name)
- Defines a font. name specifies the PostScript name of the font to use. This font also becomes the current font. */
-PHP_FUNCTION(swf_definefont)
-{
- zval **fontid, **name;
- if (ZEND_NUM_ARGS() != 2 ||
- zend_get_parameters_ex(2, &fontid, &name) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(fontid);
- convert_to_string_ex(name);
-
- swf_definefont(Z_LVAL_PP(fontid), Z_STRVAL_PP(name));
-}
-/* }}} */
-
-/* {{{ proto void swf_setfont(int fontid)
- Sets fontid to the current font */
-PHP_FUNCTION(swf_setfont)
-{
- zval **fontid;
- if (ZEND_NUM_ARGS() != 1 ||
- zend_get_parameters_ex(1, &fontid) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(fontid);
- swf_setfont(Z_LVAL_PP(fontid));
-}
-/* }}} */
-
-/* {{{ proto void swf_fontsize(double height)
- Sets the current font's height to the value specified by height */
-PHP_FUNCTION(swf_fontsize)
-{
- zval **height;
- if (ZEND_NUM_ARGS() != 1 ||
- zend_get_parameters_ex(1, &height) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_double_ex(height);
-
- swf_fontsize((float)Z_DVAL_PP(height));
-}
-/* }}} */
-
-/* {{{ proto void swf_fontslant(double slant)
- Set the current font slant to the angle indicated by slant */
-PHP_FUNCTION(swf_fontslant)
-{
- zval **slant;
- if (ZEND_NUM_ARGS() != 1 ||
- zend_get_parameters_ex(1, &slant) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_double_ex(slant);
-
- swf_fontslant((float)Z_DVAL_PP(slant));
-}
-/* }}} */
-
-/* {{{ proto void swf_fonttracking(track)
- Sets the current font tracking to the specified value, track */
-PHP_FUNCTION(swf_fonttracking)
-{
- zval **track;
- if (ZEND_NUM_ARGS() != 1 ||
- zend_get_parameters_ex(1, &track) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_double_ex(track);
- swf_fonttracking((float)Z_DVAL_PP(track));
-}
-/* }}} */
-
-/* {{{ proto array swf_getfontinfo(void)
- Get information about the current font */
-PHP_FUNCTION(swf_getfontinfo)
-{
- float A_height, x_height;
- swf_getfontinfo(&A_height, &x_height);
- if (array_init(return_value) == FAILURE) {
- php_error(E_WARNING, "Cannot initialize return value from swf_getfontinfo");
- RETURN_FALSE;
- }
- add_assoc_double(return_value, "Aheight", A_height);
- add_assoc_double(return_value, "xheight", x_height);
-}
-/* }}} */
-
-/* {{{ proto void swf_definetext(int objid, string str, int docCenter)
- defines a text string using the current font, current fontsize and current font slant. If docCenter is 1, the word is centered in x */
-PHP_FUNCTION(swf_definetext)
-{
- zval **objid, **str, **docCenter;
- if (ZEND_NUM_ARGS() != 3 ||
- zend_get_parameters_ex(3, &objid, &str, &docCenter) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(objid);
- convert_to_string_ex(str);
- convert_to_long_ex(docCenter);
-
- swf_definetext(Z_LVAL_PP(objid), Z_STRVAL_PP(str), Z_LVAL_PP(docCenter));
-}
-/* }}} */
-
-/* {{{ proto void swf_textwidth(string str)
- Calculates the width of a string, str, using the current fontsize & current font */
-PHP_FUNCTION(swf_textwidth)
-{
- zval **str;
- if (ZEND_NUM_ARGS() != 1 ||
- zend_get_parameters_ex(1, &str) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(str);
- RETURN_DOUBLE((double)swf_textwidth(Z_STRVAL_PP(str)));
-}
-/* }}} */
-
-/* {{{ proto void swf_definebitmap(int objid, string imgname)
- Defines a bitmap given the name of a .gif .rgb .jpeg or .fi image. The image will be converted into Flash jpeg or Flash color map format */
-PHP_FUNCTION(swf_definebitmap)
-{
- zval **objid, **imgname;
- if (ZEND_NUM_ARGS() != 2 ||
- zend_get_parameters_ex(2, &objid, &imgname) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(objid);
- convert_to_string_ex(imgname);
-
- swf_definebitmap(Z_LVAL_PP(objid), Z_STRVAL_PP(imgname));
-}
-/* }}} */
-
-/* {{{ proto array swf_getbitmapinfo(int bitmapid)
- Returns an array of information about a bitmap specified by bitmapid */
-PHP_FUNCTION(swf_getbitmapinfo)
-{
- zval **bitmapid;
- int size, width, height;
-
- if (ZEND_NUM_ARGS() != 1 ||
- zend_get_parameters_ex(1, &bitmapid) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(bitmapid);
-
- size = swf_getbitmapinfo(Z_LVAL_PP(bitmapid), &width, &height);
- if (array_init(return_value) == FAILURE) {
- php_error(E_WARNING, "Cannot initialize return value from swf_getbitmapinfo");
- RETURN_FALSE;
- }
-
- add_assoc_long(return_value, "size", size);
- add_assoc_long(return_value, "width", width);
- add_assoc_long(return_value, "height", height);
-}
-/* }}} */
-
-/* {{{ proto void swf_startsymbol(int objid)
- Create a new symbol with object id, objid */
-PHP_FUNCTION(swf_startsymbol)
-{
- zval **objid;
- if (ZEND_NUM_ARGS() != 1 ||
- zend_get_parameters_ex(1, &objid) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(objid);
-
- swf_startsymbol(Z_LVAL_PP(objid));
-}
-/* }}} */
-
-/* {{{ proto void swf_endsymbol(void)
- End the current symbol */
-PHP_FUNCTION(swf_endsymbol)
-{
- swf_endsymbol();
-}
-/* }}} */
-
-/* {{{ proto void swf_startbutton(int objid, int type)
- Start a button with an object id, objid and a type of either TYPE_MENUBUTTON or TYPE_PUSHBUTTON */
-PHP_FUNCTION(swf_startbutton)
-{
- zval **objid, **type;
- if (ZEND_NUM_ARGS() != 2 ||
- zend_get_parameters_ex(2, &objid, &type) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(objid);
- convert_to_long_ex(type);
-
- swf_startbutton(Z_LVAL_PP(objid), Z_LVAL_PP(type)); /* TYPE_MENUBUTTON, TYPE_PUSHBUTTON */
-}
-/* }}} */
-
-/* {{{ proto void swf_addbuttonrecord(int state, int objid, int depth)
- Controls the location, appearance and active area of the current button */
-PHP_FUNCTION(swf_addbuttonrecord)
-{
- zval **state, **objid, **depth;
- if (ZEND_NUM_ARGS() != 3 ||
- zend_get_parameters_ex(3, &state, &objid, &depth) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(state);
- convert_to_long_ex(objid);
- convert_to_long_ex(depth);
-
- swf_addbuttonrecord(Z_LVAL_PP(state), Z_LVAL_PP(objid), Z_LVAL_PP(depth));
-}
-/* }}} */
-
-/* {{{ proto void swf_oncondition(int transitions)
- Describes a transition used to trigger an action list */
-PHP_FUNCTION(swf_oncondition)
-{
- zval **transitions;
- if (ZEND_NUM_ARGS() != 1 ||
- zend_get_parameters_ex(1, &transitions) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(transitions);
-
- swf_oncondition(Z_LVAL_PP(transitions));
-}
-/* }}} */
-
-/* {{{ proto void swf_endbutton(void)
- Complete the definition of the current button */
-PHP_FUNCTION(swf_endbutton)
-{
- swf_endbutton();
-}
-/* }}} */
-
-/* {{{ php_swf_geo_same
- */
-void php_swf_geo_same(INTERNAL_FUNCTION_PARAMETERS, int opt)
-{
- zval **arg1, **arg2, **arg3, **arg4;
- if (ZEND_NUM_ARGS() != 4 ||
- zend_get_parameters_ex(4, &arg1, &arg2, &arg3, &arg4) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_double_ex(arg1);
- convert_to_double_ex(arg2);
- convert_to_double_ex(arg3);
- convert_to_double_ex(arg4);
-
- if (opt == 0) {
- swf_viewport(Z_DVAL_PP(arg1), Z_DVAL_PP(arg2), Z_DVAL_PP(arg3),
- Z_DVAL_PP(arg4));
- } else if (opt == 1) {
- swf_ortho2(Z_DVAL_PP(arg1), Z_DVAL_PP(arg2), Z_DVAL_PP(arg3),
- Z_DVAL_PP(arg4));
- } else if (opt == 2) {
- swf_polarview(Z_DVAL_PP(arg1), Z_DVAL_PP(arg2), Z_DVAL_PP(arg3),
- Z_DVAL_PP(arg4));
- } else if (opt == 3) {
- swf_perspective(Z_DVAL_PP(arg1), Z_DVAL_PP(arg2), Z_DVAL_PP(arg3),
- Z_DVAL_PP(arg4));
- }
-}
-/* }}} */
-
-/* {{{ proto void swf_viewport(double xmin, double xmax, double ymin, double ymax)
- Selects an area on the drawing surface for future drawing */
-PHP_FUNCTION(swf_viewport)
-{
- php_swf_geo_same(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-/* }}} */
-
-/* {{{ proto void swf_ortho2(double xmin, double xmax, double ymin, double ymax)
- Defines a 2-D orthographic mapping of user coordinates onto the current viewport */
-PHP_FUNCTION(swf_ortho2)
-{
- php_swf_geo_same(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
-}
-/* }}} */
-
-/* {{{ proto void swf_ortho(double xmin, double xmax, double ymin, double ymax, double zmin, double zmax)
- Defines an orthographic mapping of user coordinates onto the current viewport */
-PHP_FUNCTION(swf_ortho)
-{
- zval **xmin, **xmax, **ymin, **ymax, **zmin, **zmax;
- if (ZEND_NUM_ARGS() != 6 ||
- zend_get_parameters_ex(6, &xmin, &xmax, &ymin, &ymax, &zmin, &zmax) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_double_ex(xmin);
- convert_to_double_ex(xmax);
- convert_to_double_ex(ymin);
- convert_to_double_ex(ymax);
- convert_to_double_ex(zmin);
- convert_to_double_ex(zmax);
-
- swf_ortho(Z_DVAL_PP(xmin), Z_DVAL_PP(xmax),
- Z_DVAL_PP(ymin), Z_DVAL_PP(ymax),
- Z_DVAL_PP(zmin), Z_DVAL_PP(zmax));
-}
-/* }}} */
-
-/* {{{ proto void swf_polarview(double dist, double azimuth, double incidence, double twist)
- Defines he viewer's position in polar coordinates */
-PHP_FUNCTION(swf_polarview)
-{
- php_swf_geo_same(INTERNAL_FUNCTION_PARAM_PASSTHRU, 2);
-}
-/* }}} */
-
-/* {{{ proto void swf_perspective(double fovy, double aspect, double near, double far)
- Define a perspective projection transformation. */
-PHP_FUNCTION(swf_perspective)
-{
- php_swf_geo_same(INTERNAL_FUNCTION_PARAM_PASSTHRU, 3);
-}
-/* }}} */
-
-/* {{{ proto void swf_lookat(double vx, double vy, double vz, double px, double py, double pz, double twist)
- Defines a viewing transformation by giving the view position vx, vy, vz, and the coordinates of a reference point in the scene at px, py, pz. Twist controls a rotation along the viewer's z axis */
-PHP_FUNCTION(swf_lookat)
-{
- zval **vx, **vy, **vz, **px, **py, **pz, **twist;
- if (ZEND_NUM_ARGS() != 7 ||
- zend_get_parameters_ex(7, &vx, &vy, &vz, &px, &py, &pz, &twist) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_double_ex(vx);
- convert_to_double_ex(vy);
- convert_to_double_ex(vz);
- convert_to_double_ex(px);
- convert_to_double_ex(py);
- convert_to_double_ex(pz);
- convert_to_double_ex(twist);
-
- swf_lookat(Z_DVAL_PP(vx), Z_DVAL_PP(vy), Z_DVAL_PP(vz),
- Z_DVAL_PP(px), Z_DVAL_PP(py), Z_DVAL_PP(pz), Z_DVAL_PP(twist));
-}
-/* }}} */
-
-/* {{{ proto void swf_pushmatrix(void)
- Push the current transformation matrix onto the stack */
-PHP_FUNCTION(swf_pushmatrix)
-{
- swf_pushmatrix();
-}
-/* }}} */
-
-/* {{{ proto void swf_popmatrix(void)
- Restore a previous transformation matrix */
-PHP_FUNCTION(swf_popmatrix)
-{
- swf_popmatrix();
-}
-/* }}} */
-
-/* {{{ proto void swf_scale(double x, double y, double z)
- Scale the current transformation */
-PHP_FUNCTION(swf_scale)
-{
- zval **x, **y, **z;
- if (ZEND_NUM_ARGS() != 3 ||
- zend_get_parameters_ex(3, &x, &y, &z) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_double_ex(x);
- convert_to_double_ex(y);
- convert_to_double_ex(z);
-
- swf_scale(Z_DVAL_PP(x), Z_DVAL_PP(y), Z_DVAL_PP(z));
-}
-/* }}} */
-
-/* {{{ proto void swf_translate(double x, double y, double z)
- Translate the current transformation */
-PHP_FUNCTION(swf_translate)
-{
- zval **x, **y, **z;
- if (ZEND_NUM_ARGS() != 3 ||
- zend_get_parameters_ex(3, &x, &y, &z) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_double_ex(x);
- convert_to_double_ex(y);
- convert_to_double_ex(z);
-
- swf_translate(Z_DVAL_PP(x), Z_DVAL_PP(y), Z_DVAL_PP(z));
-}
-/* }}} */
-
-/* {{{ proto void swf_rotate(double angle, string axis)
- Rotate the current transformation by the given angle about x, y, or z axis. The axis may be 'x', 'y', or 'z' */
-PHP_FUNCTION(swf_rotate)
-{
- zval **angle, **axis;
- if (ZEND_NUM_ARGS() != 2 ||
- zend_get_parameters_ex(2, &angle, &axis) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_double_ex(angle);
- convert_to_string_ex(axis);
-
- swf_rotate(Z_DVAL_PP(angle), (char)(Z_STRVAL_PP(axis))[0]);
-}
-/* }}} */
-
-/* {{{ proto void swf_posround(int doit)
- This enables or disables rounding of the translation when objects are places or moved */
-PHP_FUNCTION(swf_posround)
-{
- zval **doit;
- if (ZEND_NUM_ARGS() != 1 ||
- zend_get_parameters_ex(1, &doit) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(doit);
-
- swf_posround(Z_LVAL_PP(doit));
-}
-/* }}} */
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/sybase/CREDITS b/ext/sybase/CREDITS
deleted file mode 100644
index 632dcce0ca..0000000000
--- a/ext/sybase/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-Sybase-DB
-Zeev Suraski
diff --git a/ext/sybase/Makefile.in b/ext/sybase/Makefile.in
deleted file mode 100644
index a51051d7d0..0000000000
--- a/ext/sybase/Makefile.in
+++ /dev/null
@@ -1,7 +0,0 @@
-
-LTLIBRARY_NAME = libsybase.la
-LTLIBRARY_SOURCES = php_sybase_db.c
-LTLIBRARY_SHARED_NAME = php_sybase_db.la
-LTLIBRARY_SHARED_LIBADD = $(SYBASE_SHARED_LIBADD)
-
-include $(top_srcdir)/build/dynlib.mk
diff --git a/ext/sybase/config.m4 b/ext/sybase/config.m4
deleted file mode 100644
index 60b55eca74..0000000000
--- a/ext/sybase/config.m4
+++ /dev/null
@@ -1,28 +0,0 @@
-dnl $Id$
-
-PHP_ARG_WITH(sybase,for Sybase support,
-[ --with-sybase[=DIR] Include Sybase-DB support. DIR is the Sybase home
- directory, defaults to /home/sybase.])
-
-
-if test "$PHP_SYBASE" != "no"; then
- if test "$PHP_SYBASE" = "yes"; then
- SYBASE_INCDIR=/home/sybase/include
- SYBASE_LIBDIR=/home/sybase/lib
- else
- SYBASE_INCDIR=$PHP_SYBASE/include
- SYBASE_LIBDIR=$PHP_SYBASE/lib
- fi
- PHP_ADD_INCLUDE($SYBASE_INCDIR)
- PHP_ADD_LIBRARY_WITH_PATH(sybdb, $SYBASE_LIBDIR, SYBASE_SHARED_LIBADD)
- PHP_EXTENSION(sybase, $ext_shared)
- AC_CHECK_LIB(dnet_stub, dnet_addr,
- [ PHP_ADD_LIBRARY_WITH_PATH(dnet_stub,,SYBASE_SHARED_LIBADD)
- AC_DEFINE(HAVE_LIBDNET_STUB,1,[ ])
- ])
- AC_DEFINE(HAVE_SYBASE,1,[ ])
- AC_CHECK_LIB(sybdb, tdsdbopen,
- [ AC_DEFINE(PHP_SYBASE_DBOPEN,tdsdbopen,[ ])
- AC_DEFINE(DBMFIX,1,[ ]) ],
- [ AC_DEFINE(PHP_SYBASE_DBOPEN,dbopen,[ ]) ])
-fi
diff --git a/ext/sybase/php_sybase_db.c b/ext/sybase/php_sybase_db.c
deleted file mode 100644
index b0d496fe82..0000000000
--- a/ext/sybase/php_sybase_db.c
+++ /dev/null
@@ -1,1366 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
- | php_sybase_get_column_content_with_type() based on code by: |
- | Muhammad A Muquit <MA_Muquit@fccc.edu> |
- | Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "php_sybase_db.h"
-#include "ext/standard/php_standard.h"
-#include "ext/standard/info.h"
-#include "php_globals.h"
-
-#if HAVE_SYBASE
-
-#include <sybfront.h>
-#include <sybdb.h>
-#include <syberror.h>
-
-#if BROKEN_SYBASE_PCONNECTS
-#include "http_log.h"
-#endif
-
-function_entry sybase_functions[] = {
- PHP_FE(sybase_connect, NULL)
- PHP_FE(sybase_pconnect, NULL)
- PHP_FE(sybase_close, NULL)
- PHP_FE(sybase_select_db, NULL)
- PHP_FE(sybase_query, NULL)
- PHP_FE(sybase_free_result, NULL)
- PHP_FE(sybase_get_last_message, NULL)
- PHP_FE(sybase_num_rows, NULL)
- PHP_FE(sybase_num_fields, NULL)
- PHP_FE(sybase_fetch_row, NULL)
- PHP_FE(sybase_fetch_array, NULL)
- PHP_FE(sybase_fetch_object, NULL)
- PHP_FE(sybase_data_seek, NULL)
- PHP_FE(sybase_fetch_field, NULL)
- PHP_FE(sybase_field_seek, NULL)
- PHP_FE(sybase_result, NULL)
- PHP_FE(sybase_affected_rows, NULL)
- PHP_FE(sybase_min_error_severity, NULL)
- PHP_FE(sybase_min_message_severity, NULL)
- PHP_FALIAS(mssql_connect, sybase_connect, NULL)
- PHP_FALIAS(mssql_pconnect, sybase_pconnect, NULL)
- PHP_FALIAS(mssql_close, sybase_close, NULL)
- PHP_FALIAS(mssql_select_db, sybase_select_db, NULL)
- PHP_FALIAS(mssql_query, sybase_query, NULL)
- PHP_FALIAS(mssql_free_result, sybase_free_result, NULL)
- PHP_FALIAS(mssql_get_last_message, sybase_get_last_message, NULL)
- PHP_FALIAS(mssql_num_rows, sybase_num_rows, NULL)
- PHP_FALIAS(mssql_num_fields, sybase_num_fields, NULL)
- PHP_FALIAS(mssql_fetch_row, sybase_fetch_row, NULL)
- PHP_FALIAS(mssql_fetch_array, sybase_fetch_array, NULL)
- PHP_FALIAS(mssql_fetch_object, sybase_fetch_object, NULL)
- PHP_FALIAS(mssql_data_seek, sybase_data_seek, NULL)
- PHP_FALIAS(mssql_fetch_field, sybase_fetch_field, NULL)
- PHP_FALIAS(mssql_field_seek, sybase_field_seek, NULL)
- PHP_FALIAS(mssql_result, sybase_result, NULL)
- PHP_FALIAS(mssql_affected_rows, sybase_affected_rows, NULL)
- PHP_FALIAS(mssql_min_error_severity, sybase_min_error_severity, NULL)
- PHP_FALIAS(mssql_min_message_severity, sybase_min_message_severity, NULL)
- {NULL, NULL, NULL}
-};
-
-zend_module_entry sybase_module_entry = {
- "sybase", sybase_functions, PHP_MINIT(sybase), PHP_MSHUTDOWN(sybase), PHP_RINIT(sybase), PHP_RSHUTDOWN(sybase), PHP_MINFO(sybase), STANDARD_MODULE_PROPERTIES
-};
-
-#ifdef COMPILE_DL_SYBASE
-ZEND_GET_MODULE(sybase)
-#endif
-
-THREAD_LS sybase_module php_sybase_module;
-
-
-#define CHECK_LINK(link) { if (link==-1) { php_error(E_WARNING,"Sybase: A link to the server could not be established"); RETURN_FALSE; } }
-
-
-static void php_sybase_get_column_content(sybase_link *sybase_ptr,int offset,pval **result_ptr, int column_type);
-
-/* error handler */
-static int php_sybase_error_handler(DBPROCESS *dbproc,int severity,int dberr,
- int oserr,char *dberrstr,char *oserrstr)
-{
- if (severity >= php_sybase_module.min_error_severity) {
- php_error(E_WARNING,"Sybase error: %s (severity %d)",dberrstr,severity);
- }
- return INT_CANCEL;
-}
-
-/* message handler */
-static int php_sybase_message_handler(DBPROCESS *dbproc,DBINT msgno,int msgstate,
- int severity,char *msgtext,char *srvname,
- char *procname,DBUSMALLINT line)
-{
- if (severity >= php_sybase_module.min_message_severity) {
- php_error(E_WARNING,"Sybase message: %s (severity %d)",msgtext,severity);
- }
- STR_FREE(php_sybase_module.server_message);
- php_sybase_module.server_message = estrdup(msgtext);
- return 0;
-}
-
-
-static int _clean_invalid_results(list_entry *le)
-{
- if (le->type == php_sybase_module.le_result) {
- sybase_link *sybase_ptr = ((sybase_result *) le->ptr)->sybase_ptr;
-
- if (!sybase_ptr->valid) {
- return 1;
- }
- }
- return 0;
-}
-
-
-static void _free_sybase_result(zend_rsrc_list_entry *rsrc)
-{
- sybase_result *result = (sybase_result *)rsrc->ptr;
- int i,j;
-
- if (result->data) {
- for (i=0; i<result->num_rows; i++) {
- for (j=0; j<result->num_fields; j++) {
- zval_ptr_dtor(&result->data[i][j]);
- }
- efree(result->data[i]);
- }
- efree(result->data);
- }
-
- if (result->fields) {
- for (i=0; i<result->num_fields; i++) {
- STR_FREE(result->fields[i].name);
- STR_FREE(result->fields[i].column_source);
- }
- efree(result->fields);
- }
- efree(result);
-}
-
-
-static void _close_sybase_link(zend_rsrc_list_entry *rsrc)
-{
- sybase_link *sybase_ptr = (sybase_link *)rsrc->ptr;
- ELS_FETCH();
-
- sybase_ptr->valid = 0;
-
- /*
- this can cause crashes in the current model.
- if the resource gets destroyed via destroy_resource_list() resource_list
- will *not* be in a consistent state. thies@thieso.net
- */
-
- zend_hash_apply(&EG(regular_list),(int (*)(void *))_clean_invalid_results);
- dbclose(sybase_ptr->link);
- dbloginfree(sybase_ptr->login);
- efree(sybase_ptr);
- php_sybase_module.num_links--;
-}
-
-
-static void _close_sybase_plink(zend_rsrc_list_entry *rsrc)
-{
- sybase_link *sybase_ptr = (sybase_link *)rsrc->ptr;
- dbclose(sybase_ptr->link);
- dbloginfree(sybase_ptr->login);
- free(sybase_ptr);
- php_sybase_module.num_persistent--;
- php_sybase_module.num_links--;
-}
-
-
-PHP_MINIT_FUNCTION(sybase)
-{
- char *interface_file;
-
- if (dbinit()==FAIL) {
- return FAILURE;
- }
- dberrhandle((EHANDLEFUNC) php_sybase_error_handler);
- dbmsghandle((MHANDLEFUNC) php_sybase_message_handler);
-
- if (cfg_get_string("sybase.interface_file",&interface_file)==SUCCESS) {
- dbsetifile(interface_file);
- }
- if (cfg_get_long("sybase.allow_persistent",&php_sybase_module.allow_persistent)==FAILURE) {
- php_sybase_module.allow_persistent=1;
- }
- if (cfg_get_long("sybase.max_persistent",&php_sybase_module.max_persistent)==FAILURE) {
- php_sybase_module.max_persistent=-1;
- }
- if (cfg_get_long("sybase.max_links",&php_sybase_module.max_links)==FAILURE) {
- php_sybase_module.max_links=-1;
- }
- if (cfg_get_long("sybase.min_error_severity",&php_sybase_module.cfg_min_error_severity)==FAILURE) {
- php_sybase_module.cfg_min_error_severity=10;
- }
- if (cfg_get_long("sybase.min_message_severity",&php_sybase_module.cfg_min_message_severity)==FAILURE) {
- php_sybase_module.cfg_min_message_severity=10;
- }
- if (cfg_get_long("sybase.compatability_mode",&php_sybase_module.compatability_mode)==FAILURE) {
- php_sybase_module.compatability_mode = 0;
- }
-
- php_sybase_module.num_persistent=0;
- php_sybase_module.le_link = zend_register_list_destructors_ex(_close_sybase_link, NULL, "sybase-db link", module_number);
- php_sybase_module.le_plink = zend_register_list_destructors_ex(NULL, _close_sybase_plink, "sybase-db link persistent", module_number);
- php_sybase_module.le_result = zend_register_list_destructors_ex(_free_sybase_result, NULL, "sybase-db result", module_number);
-
- return SUCCESS;
-}
-
-
-PHP_RINIT_FUNCTION(sybase)
-{
- php_sybase_module.default_link=-1;
- php_sybase_module.num_links = php_sybase_module.num_persistent;
- php_sybase_module.appname = estrndup("PHP 4.0",7);
- php_sybase_module.server_message = empty_string;
- php_sybase_module.min_error_severity = php_sybase_module.cfg_min_error_severity;
- php_sybase_module.min_message_severity = php_sybase_module.cfg_min_message_severity;
- return SUCCESS;
-}
-
-PHP_MSHUTDOWN_FUNCTION(sybase)
-{
- dbexit();
- return SUCCESS;
-}
-
-PHP_RSHUTDOWN_FUNCTION(sybase)
-{
- efree(php_sybase_module.appname);
- STR_FREE(php_sybase_module.server_message);
- return SUCCESS;
-}
-
-static void php_sybase_do_connect(INTERNAL_FUNCTION_PARAMETERS,int persistent)
-{
- char *user=NULL,*passwd=NULL,*host=NULL,*charset=NULL;
- char *hashed_details;
- int hashed_details_length;
- sybase_link sybase,*sybase_ptr;
-
- switch(ZEND_NUM_ARGS()) {
- case 0: /* defaults */
- hashed_details_length=6+3;
- hashed_details = (char *) emalloc(hashed_details_length+1);
- strcpy(hashed_details,"sybase___");
- break;
- case 1: {
- pval *yyhost;
-
- if (getParameters(ht, 1, &yyhost)==FAILURE) {
- RETURN_FALSE;
- }
- convert_to_string(yyhost);
- host = yyhost->value.str.val;
- hashed_details_length = yyhost->value.str.len+6+3;
- hashed_details = (char *) emalloc(hashed_details_length+1);
- sprintf(hashed_details,"sybase_%s__",yyhost->value.str.val);
- }
- break;
- case 2: {
- pval *yyhost,*yyuser;
-
- if (getParameters(ht, 2, &yyhost, &yyuser)==FAILURE) {
- RETURN_FALSE;
- }
- convert_to_string(yyhost);
- convert_to_string(yyuser);
- host = yyhost->value.str.val;
- user = yyuser->value.str.val;
- hashed_details_length = yyhost->value.str.len+yyuser->value.str.len+6+3;
- hashed_details = (char *) emalloc(hashed_details_length+1);
- sprintf(hashed_details,"sybase_%s_%s_",yyhost->value.str.val,yyuser->value.str.val);
- }
- break;
- case 3: {
- pval *yyhost,*yyuser,*yypasswd;
-
- if (getParameters(ht, 3, &yyhost, &yyuser, &yypasswd) == FAILURE) {
- RETURN_FALSE;
- }
- convert_to_string(yyhost);
- convert_to_string(yyuser);
- convert_to_string(yypasswd);
- host = yyhost->value.str.val;
- user = yyuser->value.str.val;
- passwd = yypasswd->value.str.val;
- hashed_details_length = yyhost->value.str.len+yyuser->value.str.len+yypasswd->value.str.len+6+3;
- hashed_details = (char *) emalloc(hashed_details_length+1);
- sprintf(hashed_details,"sybase_%s_%s_%s",yyhost->value.str.val,yyuser->value.str.val,yypasswd->value.str.val); /* SAFE */
- }
- break;
- case 4: {
- pval *yyhost,*yyuser,*yypasswd,*yycharset;
-
- if (getParameters(ht, 4, &yyhost, &yyuser, &yypasswd, &yycharset) == FAILURE) {
- RETURN_FALSE;
- }
- convert_to_string(yyhost);
- convert_to_string(yyuser);
- convert_to_string(yypasswd);
- convert_to_string(yycharset);
- host = yyhost->value.str.val;
- user = yyuser->value.str.val;
- passwd = yypasswd->value.str.val;
- charset = yycharset->value.str.val;
- hashed_details_length = yyhost->value.str.len+yyuser->value.str.len+yypasswd->value.str.len+yycharset->value.str.len+6+3;
- hashed_details = (char *) emalloc(hashed_details_length+1);
- sprintf(hashed_details,"sybase_%s_%s_%s_%s",yyhost->value.str.val,yyuser->value.str.val,yypasswd->value.str.val,yycharset->value.str.val); /* SAFE */
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
-
- /* set a DBLOGIN record */
- if ((sybase.login=dblogin())==NULL) {
- php_error(E_WARNING,"Sybase: Unable to allocate login record");
- RETURN_FALSE;
- }
-
- if (user) {
- DBSETLUSER(sybase.login,user);
- }
- if (passwd) {
- DBSETLPWD(sybase.login,passwd);
- }
- if (charset) {
- DBSETLCHARSET(sybase.login,charset);
- }
- DBSETLAPP(sybase.login,php_sybase_module.appname);
- sybase.valid = 1;
-
- if (!php_sybase_module.allow_persistent) {
- persistent=0;
- }
- if (persistent) {
- list_entry *le;
-
- /* try to find if we already have this link in our persistent list */
- if (zend_hash_find(&EG(persistent_list), hashed_details, hashed_details_length+1, (void **) &le)==FAILURE) { /* we don't */
- list_entry new_le;
-
- if (php_sybase_module.max_links!=-1 && php_sybase_module.num_links>=php_sybase_module.max_links) {
- php_error(E_WARNING,"Sybase: Too many open links (%d)",php_sybase_module.num_links);
- efree(hashed_details);
- dbloginfree(sybase.login);
- RETURN_FALSE;
- }
- if (php_sybase_module.max_persistent!=-1 && php_sybase_module.num_persistent>=php_sybase_module.max_persistent) {
- php_error(E_WARNING,"Sybase: Too many open persistent links (%d)",php_sybase_module.num_persistent);
- efree(hashed_details);
- dbloginfree(sybase.login);
- RETURN_FALSE;
- }
- /* create the link */
- if ((sybase.link=PHP_SYBASE_DBOPEN(sybase.login,host))==FAIL) {
- /*php_error(E_WARNING,"Sybase: Unable to connect to server: %s",sybase_error(sybase));*/
- efree(hashed_details);
- dbloginfree(sybase.login);
- RETURN_FALSE;
- }
-
- if (dbsetopt(sybase.link,DBBUFFER,"2",-1)==FAIL) {
- efree(hashed_details);
- dbloginfree(sybase.login);
- dbclose(sybase.link);
- RETURN_FALSE;
- }
-
- /* hash it up */
- sybase_ptr = (sybase_link *) malloc(sizeof(sybase_link));
- memcpy(sybase_ptr,&sybase,sizeof(sybase_link));
- new_le.type = php_sybase_module.le_plink;
- new_le.ptr = sybase_ptr;
- if (zend_hash_update(&EG(persistent_list), hashed_details, hashed_details_length+1, (void *) &new_le, sizeof(list_entry),NULL)==FAILURE) {
- free(sybase_ptr);
- efree(hashed_details);
- dbloginfree(sybase.login);
- RETURN_FALSE;
- }
- php_sybase_module.num_persistent++;
- php_sybase_module.num_links++;
- } else { /* we do */
- if (le->type != php_sybase_module.le_plink) {
- php_error(E_WARNING,"Sybase: Hashed persistent link is not a Sybase link!");
- RETURN_FALSE;
- }
-
- sybase_ptr = (sybase_link *) le->ptr;
- /* test that the link hasn't died */
- if (DBDEAD(sybase_ptr->link)==TRUE) {
- if ((sybase_ptr->link=PHP_SYBASE_DBOPEN(sybase_ptr->login,host))==FAIL) {
- /*php_error(E_WARNING,"Sybase: Link to server lost, unable to reconnect");*/
- zend_hash_del(&EG(persistent_list), hashed_details, hashed_details_length+1);
- efree(hashed_details);
- RETURN_FALSE;
- }
- if (dbsetopt(sybase_ptr->link,DBBUFFER,"2",-1)==FAIL) {
- zend_hash_del(&EG(persistent_list), hashed_details, hashed_details_length+1);
- efree(hashed_details);
- RETURN_FALSE;
- }
- }
- }
- return_value->value.lval = zend_list_insert(sybase_ptr,php_sybase_module.le_plink);
- return_value->type = IS_LONG;
- } else { /* non persistent */
- list_entry *index_ptr,new_index_ptr;
-
- /* first we check the hash for the hashed_details key. if it exists,
- * it should point us to the right offset where the actual sybase link sits.
- * if it doesn't, open a new sybase link, add it to the resource list,
- * and add a pointer to it with hashed_details as the key.
- */
- if (zend_hash_find(&EG(regular_list),hashed_details,hashed_details_length+1,(void **) &index_ptr)==SUCCESS) {
- int type,link;
- void *ptr;
-
- if (index_ptr->type != le_index_ptr) {
- RETURN_FALSE;
- }
- link = (int) index_ptr->ptr;
- ptr = zend_list_find(link,&type); /* check if the link is still there */
- if (ptr && (type==php_sybase_module.le_link || type==php_sybase_module.le_plink)) {
- return_value->value.lval = php_sybase_module.default_link = link;
- return_value->type = IS_LONG;
- efree(hashed_details);
- return;
- } else {
- zend_hash_del(&EG(regular_list),hashed_details,hashed_details_length+1);
- }
- }
- if (php_sybase_module.max_links!=-1 && php_sybase_module.num_links>=php_sybase_module.max_links) {
- php_error(E_WARNING,"Sybase: Too many open links (%d)",php_sybase_module.num_links);
- efree(hashed_details);
- RETURN_FALSE;
- }
-
- if ((sybase.link=PHP_SYBASE_DBOPEN(sybase.login,host))==NULL) {
- /*php_error(E_WARNING,"Sybase: Unable to connect to server: %s",sybase_error(sybase));*/
- efree(hashed_details);
- RETURN_FALSE;
- }
-
- if (dbsetopt(sybase.link,DBBUFFER,"2",-1)==FAIL) {
- efree(hashed_details);
- dbloginfree(sybase.login);
- dbclose(sybase.link);
- RETURN_FALSE;
- }
-
- /* add it to the list */
- sybase_ptr = (sybase_link *) emalloc(sizeof(sybase_link));
- memcpy(sybase_ptr,&sybase,sizeof(sybase_link));
- return_value->value.lval = zend_list_insert(sybase_ptr,php_sybase_module.le_link);
- return_value->type = IS_LONG;
-
- /* add it to the hash */
- new_index_ptr.ptr = (void *) return_value->value.lval;
- new_index_ptr.type = le_index_ptr;
- if (zend_hash_update(&EG(regular_list),hashed_details,hashed_details_length+1,(void *) &new_index_ptr, sizeof(list_entry),NULL)==FAILURE) {
- efree(hashed_details);
- RETURN_FALSE;
- }
- php_sybase_module.num_links++;
- }
- efree(hashed_details);
- php_sybase_module.default_link=return_value->value.lval;
-}
-
-
-static int php_sybase_get_default_link(INTERNAL_FUNCTION_PARAMETERS)
-{
- if (php_sybase_module.default_link==-1) { /* no link opened yet, implicitly open one */
- ht = 0;
- php_sybase_do_connect(INTERNAL_FUNCTION_PARAM_PASSTHRU,0);
- }
- return php_sybase_module.default_link;
-}
-
-
-/* {{{ proto int sybase_connect([string host [, string user [, string password [, string charset]]]])
- Open Sybase server connection */
-PHP_FUNCTION(sybase_connect)
-{
- php_sybase_do_connect(INTERNAL_FUNCTION_PARAM_PASSTHRU,0);
-}
-/* }}} */
-
-/* {{{ proto int sybase_pconnect([string host [, string user [, string password [, string charset]]]])
- Open persistent Sybase connection */
-PHP_FUNCTION(sybase_pconnect)
-{
- php_sybase_do_connect(INTERNAL_FUNCTION_PARAM_PASSTHRU,1);
-}
-/* }}} */
-
-/* {{{ proto bool sybase_close([int link_id])
- Close Sybase connection */
-PHP_FUNCTION(sybase_close)
-{
- pval *sybase_link_index;
- int id,type;
-
- switch (ZEND_NUM_ARGS()) {
- case 0:
- id = php_sybase_module.default_link;
- break;
- case 1:
- if (getParameters(ht, 1, &sybase_link_index)==FAILURE) {
- RETURN_FALSE;
- }
- convert_to_long(sybase_link_index);
- id = sybase_link_index->value.lval;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- zend_list_find(id,&type);
- if (type!=php_sybase_module.le_link && type!=php_sybase_module.le_plink) {
- php_error(E_WARNING,"%d is not a Sybase link index",id);
- RETURN_FALSE;
- }
-
- zend_list_delete(id);
- RETURN_TRUE;
-}
-/* }}} */
-
-
-/* {{{ proto bool sybase_select_db(string database [, int link_id])
- Select Sybase database */
-PHP_FUNCTION(sybase_select_db)
-{
- pval *db,*sybase_link_index;
- int id,type;
- sybase_link *sybase_ptr;
-
- switch(ZEND_NUM_ARGS()) {
- case 1:
- if (getParameters(ht, 1, &db)==FAILURE) {
- RETURN_FALSE;
- }
- id = php_sybase_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU);
- break;
- case 2:
- if (getParameters(ht, 2, &db, &sybase_link_index)==FAILURE) {
- RETURN_FALSE;
- }
- convert_to_long(sybase_link_index);
- id = sybase_link_index->value.lval;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- CHECK_LINK(id);
-
- sybase_ptr = (sybase_link *) zend_list_find(id,&type);
- if (type!=php_sybase_module.le_link && type!=php_sybase_module.le_plink) {
- php_error(E_WARNING,"%d is not a Sybase link index",id);
- RETURN_FALSE;
- }
-
- convert_to_string(db);
-
- if (dbuse(sybase_ptr->link,db->value.str.val)==FAIL) {
- /*php_error(E_WARNING,"Sybase: Unable to select database: %s",sybase_error(sybase));*/
- RETURN_FALSE;
- } else {
- RETURN_TRUE;
- }
-}
-/* }}} */
-
-
-static void php_sybase_get_column_content(sybase_link *sybase_ptr,int offset,pval **result_ptr, int column_type)
-{
- zval *result;
-
- ALLOC_INIT_ZVAL(result);
- *result_ptr = result;
-
- if (dbdatlen(sybase_ptr->link,offset) == 0) {
- var_reset(result);
- return;
- }
-
- switch (column_type)
- {
- case SYBINT2:
- case SYBINT4: {
- result->value.lval = (long) anyintcol(offset);
- result->type = IS_LONG;
- break;
- }
- case SYBCHAR:
- case SYBTEXT: {
- int length;
- char *data = charcol(offset);
-
- length=dbdatlen(sybase_ptr->link,offset);
- while (length>0 && charcol(offset)[length-1] == ' ') { /* nuke trailing whitespace */
- length--;
- }
- result->value.str.val = estrndup(data,length);
- result->value.str.len = length;
- result->type = IS_STRING;
- break;
- }
- /*case SYBFLT8:*/
- case SYBREAL: {
- result->value.dval = (double) floatcol(offset);
- result->type = IS_DOUBLE;
- break;
- }
- default: {
- if (dbwillconvert(coltype(offset),SYBCHAR)) {
- char *res_buf;
- int res_length = dbdatlen(sybase_ptr->link,offset);
- register char *p;
-
- switch (coltype(offset)) {
- case SYBBINARY:
- case SYBVARBINARY:
- case SYBCHAR:
- case SYBVARCHAR:
- case SYBTEXT:
- case SYBIMAGE:
- break;
- default:
- /* take no chances, no telling how big the result would really be */
- res_length += 20;
- break;
- }
-
- res_buf = (char *) emalloc(res_length+1);
- memset(res_buf,' ',res_length+1); /* XXX i'm sure there's a better way
- but i don't have sybase here to test
- 991105 thies@thieso.net */
- dbconvert(NULL,coltype(offset),dbdata(sybase_ptr->link,offset), res_length,SYBCHAR,res_buf,-1);
-
- /* get rid of trailing spaces */
- p = res_buf + res_length;
- while (*p == ' ') {
- p--;
- res_length--;
- }
- *(++p) = 0; /* put a trailing NULL */
-
- result->value.str.len = res_length;
- result->value.str.val = res_buf;
- result->type = IS_STRING;
- } else {
- php_error(E_WARNING,"Sybase: column %d has unknown data type (%d)", offset, coltype(offset));
- var_reset(result);
- }
- }
- }
-}
-
-
-/* {{{ proto int sybase_query(string query [, int link_id])
- Send Sybase query */
-PHP_FUNCTION(sybase_query)
-{
- pval *query,*sybase_link_index;
- int id,type,retvalue;
- sybase_link *sybase_ptr;
- sybase_result *result;
- int num_fields;
- int blocks_initialized=1;
- int i,j;
- int *column_types;
- PLS_FETCH();
-
- switch(ZEND_NUM_ARGS()) {
- case 1:
- if (getParameters(ht, 1, &query)==FAILURE) {
- RETURN_FALSE;
- }
- id = php_sybase_module.default_link;
- break;
- case 2:
- if (getParameters(ht, 2, &query, &sybase_link_index)==FAILURE) {
- RETURN_FALSE;
- }
- convert_to_long(sybase_link_index);
- id = sybase_link_index->value.lval;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- sybase_ptr = (sybase_link *) zend_list_find(id,&type);
- if (type!=php_sybase_module.le_link && type!=php_sybase_module.le_plink) {
- php_error(E_WARNING,"%d is not a Sybase link index",id);
- RETURN_FALSE;
- }
-
- convert_to_string(query);
- if (dbcmd(sybase_ptr->link,query->value.str.val)==FAIL) {
- /*php_error(E_WARNING,"Sybase: Unable to set query");*/
- RETURN_FALSE;
- }
- if (dbsqlexec(sybase_ptr->link)==FAIL || dbresults(sybase_ptr->link)==FAIL) {
- /*php_error(E_WARNING,"Sybase: Query failed");*/
- RETURN_FALSE;
- }
-
- /* The following is more or less the equivalent of mysql_store_result().
- * fetch all rows from the server into the row buffer, thus:
- * 1) Being able to fire up another query without explicitly reading all rows
- * 2) Having numrows accessible
- */
-
- retvalue=dbnextrow(sybase_ptr->link);
-
- if (retvalue==FAIL) {
- RETURN_FALSE;
- }
-
- num_fields = dbnumcols(sybase_ptr->link);
- if (num_fields<=0) {
- RETURN_TRUE;
- }
-
- column_types = (int *) emalloc(sizeof(int) * num_fields);
- for (i=0; i<num_fields; i++) {
- column_types[i] = coltype(i+1);
- }
-
- result = (sybase_result *) emalloc(sizeof(sybase_result));
- result->data = (pval ***) emalloc(sizeof(pval **)*SYBASE_ROWS_BLOCK);
- result->sybase_ptr = sybase_ptr;
- result->cur_field=result->cur_row=result->num_rows=0;
- result->num_fields = num_fields;
-
- i=0;
- while (retvalue!=FAIL && retvalue!=NO_MORE_ROWS) {
- result->num_rows++;
- if (result->num_rows > blocks_initialized*SYBASE_ROWS_BLOCK) {
- result->data = (pval ***) erealloc(result->data,sizeof(pval **)*SYBASE_ROWS_BLOCK*(++blocks_initialized));
- }
- result->data[i] = (pval **) emalloc(sizeof(pval *)*num_fields);
- for (j=1; j<=num_fields; j++) {
- php_sybase_get_column_content(sybase_ptr, j, &result->data[i][j-1], column_types[j-1]);
- if (!php_sybase_module.compatability_mode) {
- zval *cur_value = result->data[i][j-1];
-
- convert_to_string(cur_value);
- if (PG(magic_quotes_runtime)) {
- cur_value->value.str.val = php_addslashes(cur_value->value.str.val, cur_value->value.str.len, &cur_value->value.str.len,0);
- }
- }
- }
- retvalue=dbnextrow(sybase_ptr->link);
- dbclrbuf(sybase_ptr->link,DBLASTROW(sybase_ptr->link)-1);
- i++;
- }
- result->num_rows = DBCOUNT(sybase_ptr->link);
-
- result->fields = (sybase_field *) emalloc(sizeof(sybase_field)*num_fields);
- j=0;
- for (i=0; i<num_fields; i++) {
- char *fname = dbcolname(sybase_ptr->link,i+1);
- char computed_buf[16];
-
- if (*fname) {
- result->fields[i].name = estrdup(fname);
- } else {
- if (j>0) {
- snprintf(computed_buf,16,"computed%d",j);
- } else {
- strcpy(computed_buf,"computed");
- }
- result->fields[i].name = estrdup(computed_buf);
- j++;
- }
- result->fields[i].max_length = dbcollen(sybase_ptr->link,i+1);
- result->fields[i].column_source = estrdup(dbcolsource(sybase_ptr->link,i+1));
- if (!result->fields[i].column_source) {
- result->fields[i].column_source = empty_string;
- }
- result->fields[i].type = column_types[i];
- /* set numeric flag */
- switch (column_types[i]) {
- case SYBINT2:
- case SYBINT4:
- case SYBFLT8:
- case SYBREAL:
- result->fields[i].numeric = 1;
- break;
- case SYBCHAR:
- case SYBTEXT:
- default:
- result->fields[i].numeric = 0;
- break;
- }
- }
- efree(column_types);
- return_value->value.lval = zend_list_insert(result,php_sybase_module.le_result);
- return_value->type = IS_LONG;
-}
-/* }}} */
-
-
-/* {{{ proto bool sybase_free_result(int result)
- Free result memory */
-PHP_FUNCTION(sybase_free_result)
-{
- pval *sybase_result_index;
- sybase_result *result;
- int type;
-
- if (ZEND_NUM_ARGS()!=1 || getParameters(ht, 1, &sybase_result_index)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(sybase_result_index);
- if (sybase_result_index->value.lval==0) {
- RETURN_FALSE;
- }
- result = (sybase_result *) zend_list_find(sybase_result_index->value.lval,&type);
-
- if (type!=php_sybase_module.le_result) {
- php_error(E_WARNING,"%d is not a Sybase result index",sybase_result_index->value.lval);
- RETURN_FALSE;
- }
- zend_list_delete(sybase_result_index->value.lval);
- RETURN_TRUE;
-}
-/* }}} */
-
-
-
-/* {{{ proto string sybase_get_last_message(void)
- Returns the last message from server (over min_message_severity) */
-PHP_FUNCTION(sybase_get_last_message)
-{
- RETURN_STRING(php_sybase_module.server_message,1);
-}
-/* }}} */
-
-/* {{{ proto int sybase_num_rows(int result)
- Get number of rows in result */
-PHP_FUNCTION(sybase_num_rows)
-{
- pval *result_index;
- int type,id;
- sybase_result *result;
-
- if (ZEND_NUM_ARGS()!=1 || getParameters(ht, 1, &result_index)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(result_index);
- id = result_index->value.lval;
-
- result = (sybase_result *) zend_list_find(id,&type);
- if (type!=php_sybase_module.le_result) {
- php_error(E_WARNING,"%d is not a Sybase result index",id);
- RETURN_FALSE;
- }
-
- return_value->value.lval = result->num_rows;
- return_value->type = IS_LONG;
-}
-/* }}} */
-
-/* {{{ proto int sybase_num_fields(int result)
- Get number of fields in result */
-PHP_FUNCTION(sybase_num_fields)
-{
- pval *result_index;
- int type,id;
- sybase_result *result;
-
- if (ZEND_NUM_ARGS()!=1 || getParameters(ht, 1, &result_index)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(result_index);
- id = result_index->value.lval;
-
- result = (sybase_result *) zend_list_find(id,&type);
- if (type!=php_sybase_module.le_result) {
- php_error(E_WARNING,"%d is not a Sybase result index",id);
- RETURN_FALSE;
- }
-
- return_value->value.lval = result->num_fields;
- return_value->type = IS_LONG;
-}
-/* }}} */
-
-/* {{{ proto array sybase_fetch_row(int result)
- Get row as enumerated array */
-PHP_FUNCTION(sybase_fetch_row)
-{
- pval *sybase_result_index;
- int type,i,id;
- sybase_result *result;
- pval *field_content;
-
- if (ZEND_NUM_ARGS()!=1 || getParameters(ht, 1, &sybase_result_index)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(sybase_result_index);
- id = sybase_result_index->value.lval;
-
- result = (sybase_result *) zend_list_find(id,&type);
- if (type!=php_sybase_module.le_result) {
- php_error(E_WARNING,"%d is not a Sybase result index",id);
- RETURN_FALSE;
- }
-
- if (result->cur_row >= result->num_rows) {
- RETURN_FALSE;
- }
-
- array_init(return_value);
- for (i=0; i<result->num_fields; i++) {
- ZVAL_ADDREF(result->data[result->cur_row][i]);
- zend_hash_index_update(return_value->value.ht, i, (void *) &result->data[result->cur_row][i], sizeof(pval *), NULL);
- }
- result->cur_row++;
-}
-/* }}} */
-
-
-static void php_sybase_fetch_hash(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *sybase_result_index;
- sybase_result *result;
- int type;
- int i;
-
- if (ZEND_NUM_ARGS()!=1 || getParameters(ht, 1, &sybase_result_index)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(sybase_result_index);
- result = (sybase_result *) zend_list_find(sybase_result_index->value.lval,&type);
-
- if (type!=php_sybase_module.le_result) {
- php_error(E_WARNING,"%d is not a Sybase result index",sybase_result_index->value.lval);
- RETURN_FALSE;
- }
-
- if (result->cur_row >= result->num_rows) {
- RETURN_FALSE;
- }
-
- if (array_init(return_value)==FAILURE) {
- RETURN_FALSE;
- }
-
- for (i=0; i<result->num_fields; i++) {
- ZVAL_ADDREF(result->data[result->cur_row][i]);
- zend_hash_index_update(return_value->value.ht, i, (void *) &result->data[result->cur_row][i], sizeof(pval *), NULL);
- ZVAL_ADDREF(result->data[result->cur_row][i]);
- zend_hash_update(return_value->value.ht, result->fields[i].name, strlen(result->fields[i].name)+1, (void *) &result->data[result->cur_row][i], sizeof(pval *), NULL);
- }
- result->cur_row++;
-}
-
-
-/* {{{ proto object sybase_fetch_object(int result)
- Fetch row as object */
-PHP_FUNCTION(sybase_fetch_object)
-{
- php_sybase_fetch_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU);
- if (return_value->type==IS_ARRAY) {
- return_value->type=IS_OBJECT;
- return_value->value.obj.properties = return_value->value.ht;
- return_value->value.obj.ce = &zend_standard_class_def;
- }
-}
-/* }}} */
-
-/* {{{ proto array sybase_fetch_array(int result)
- Fetch row as array */
-PHP_FUNCTION(sybase_fetch_array)
-{
- php_sybase_fetch_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU);
-}
-/* }}} */
-
-/* {{{ proto bool sybase_data_seek(int result, int offset)
- Move internal row pointer */
-PHP_FUNCTION(sybase_data_seek)
-{
- pval *sybase_result_index,*offset;
- int type,id;
- sybase_result *result;
-
- if (ZEND_NUM_ARGS()!=2 || getParameters(ht, 2, &sybase_result_index, &offset)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(sybase_result_index);
- id = sybase_result_index->value.lval;
-
- result = (sybase_result *) zend_list_find(id,&type);
- if (type!=php_sybase_module.le_result) {
- php_error(E_WARNING,"%d is not a Sybase result index",id);
- RETURN_FALSE;
- }
-
- convert_to_long(offset);
- if (offset->value.lval<0 || offset->value.lval>=result->num_rows) {
- php_error(E_WARNING,"Sybase: Bad row offset");
- RETURN_FALSE;
- }
-
- result->cur_row = offset->value.lval;
- RETURN_TRUE;
-}
-/* }}} */
-
-static char *php_sybase_get_field_name(int type)
-{
- switch (type) {
- case SYBBINARY:
- case SYBVARBINARY:
- return "blob";
- break;
- case SYBCHAR:
- case SYBVARCHAR:
- case SYBTEXT:
- return "string";
- case SYBDATETIME:
- case SYBDATETIME4:
- case SYBDATETIMN:
- return "datetime";
- break;
- case SYBDECIMAL:
- case SYBFLT8:
- case SYBFLTN:
- case SYBREAL:
- case SYBNUMERIC:
- return "real";
- break;
- case SYBINT1:
- case SYBINT2:
- case SYBINT4:
- case SYBINTN:
- return "int";
- break;
- case SYBMONEY:
- case SYBMONEY4:
- case SYBMONEYN:
- return "money";
- break;
- case SYBBIT:
- return "bit";
- break;
- case SYBIMAGE:
- return "image";
- break;
- default:
- return "unknown";
- break;
- }
-}
-
-
-/* {{{ proto object sybase_fetch_field(int result [, int offset])
- Get field information */
-PHP_FUNCTION(sybase_fetch_field)
-{
- pval *sybase_result_index,*offset;
- int type,id,field_offset;
- sybase_result *result;
-
- switch (ZEND_NUM_ARGS()) {
- case 1:
- if (getParameters(ht, 1, &sybase_result_index)==FAILURE) {
- RETURN_FALSE;
- }
- field_offset=-1;
- break;
- case 2:
- if (getParameters(ht, 2, &sybase_result_index, &offset)==FAILURE) {
- RETURN_FALSE;
- }
- convert_to_long(offset);
- field_offset = offset->value.lval;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- convert_to_long(sybase_result_index);
- id = sybase_result_index->value.lval;
-
- result = (sybase_result *) zend_list_find(id,&type);
- if (type!=php_sybase_module.le_result) {
- php_error(E_WARNING,"%d is not a Sybase result index",id);
- RETURN_FALSE;
- }
-
- if (field_offset==-1) {
- field_offset = result->cur_field;
- result->cur_field++;
- }
-
- if (field_offset<0 || field_offset >= result->num_fields) {
- if (ZEND_NUM_ARGS()==2) { /* field specified explicitly */
- php_error(E_WARNING,"Sybase: Bad column offset");
- }
- RETURN_FALSE;
- }
-
- if (object_init(return_value)==FAILURE) {
- RETURN_FALSE;
- }
- add_property_string(return_value, "name",result->fields[field_offset].name, 1);
- add_property_long(return_value, "max_length",result->fields[field_offset].max_length);
- add_property_string(return_value, "column_source",result->fields[field_offset].column_source, 1);
- add_property_long(return_value, "numeric", result->fields[field_offset].numeric);
- add_property_string(return_value, "type", php_sybase_get_field_name(result->fields[field_offset].type), 1);
-}
-/* }}} */
-
-/* {{{ proto bool sybase_field_seek(int result, int offset)
- Set field offset */
-PHP_FUNCTION(sybase_field_seek)
-{
- pval *sybase_result_index,*offset;
- int type,id,field_offset;
- sybase_result *result;
-
- if (ZEND_NUM_ARGS()!=2 || getParameters(ht, 2, &sybase_result_index, &offset)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(sybase_result_index);
- id = sybase_result_index->value.lval;
-
- result = (sybase_result *) zend_list_find(id,&type);
- if (type!=php_sybase_module.le_result) {
- php_error(E_WARNING,"%d is not a Sybase result index",id);
- RETURN_FALSE;
- }
-
- convert_to_long(offset);
- field_offset = offset->value.lval;
-
- if (field_offset<0 || field_offset >= result->num_fields) {
- php_error(E_WARNING,"Sybase: Bad column offset");
- RETURN_FALSE;
- }
-
- result->cur_field = field_offset;
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto string sybase_result(int result, int row, mixed field)
- Get result data */
-PHP_FUNCTION(sybase_result)
-{
- pval *row, *field, *sybase_result_index;
- int id,type,field_offset=0;
- sybase_result *result;
-
-
- if (ZEND_NUM_ARGS()!=3 || getParameters(ht, 3, &sybase_result_index, &row, &field)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(sybase_result_index);
- id = sybase_result_index->value.lval;
-
- result = (sybase_result *) zend_list_find(id,&type);
- if (type!=php_sybase_module.le_result) {
- php_error(E_WARNING,"%d is not a Sybase result index",id);
- RETURN_FALSE;
- }
-
- convert_to_long(row);
- if (row->value.lval<0 || row->value.lval>=result->num_rows) {
- php_error(E_WARNING,"Sybase: Bad row offset (%d)",row->value.lval);
- RETURN_FALSE;
- }
-
- switch(field->type) {
- case IS_STRING: {
- int i;
-
- for (i=0; i<result->num_fields; i++) {
- if (!strcasecmp(result->fields[i].name,field->value.str.val)) {
- field_offset = i;
- break;
- }
- }
- if (i>=result->num_fields) { /* no match found */
- php_error(E_WARNING,"Sybase: %s field not found in result",field->value.str.val);
- RETURN_FALSE;
- }
- break;
- }
- default:
- convert_to_long(field);
- field_offset = field->value.lval;
- if (field_offset<0 || field_offset>=result->num_fields) {
- php_error(E_WARNING,"Sybase: Bad column offset specified");
- RETURN_FALSE;
- }
- break;
- }
-
- *return_value = *result->data[row->value.lval][field_offset];
- pval_copy_constructor(return_value);
-}
-/* }}} */
-
-
-/* {{{ proto int sybase_affected_rows([int link_id])
- Get number of affected rows in last query */
-PHP_FUNCTION(sybase_affected_rows)
-{
- pval *sybase_link_index = NULL;
- sybase_link *sybase_ptr = NULL;
- int id = 0;
- int type = 0;
-
- switch(ZEND_NUM_ARGS())
- {
- case 0:
- {
- id = php_sybase_module.default_link;
- }
- break;
-
- case 1:
- {
- if (getParameters(ht, 1, &sybase_link_index)==FAILURE)
- {
- RETURN_FALSE;
- }
-
- convert_to_long(sybase_link_index);
- id = sybase_link_index->value.lval;
- }
- break;
-
- default:
- {
- WRONG_PARAM_COUNT;
- }
- break;
- }
-
- sybase_ptr = (sybase_link *)zend_list_find(id, &type);
-
- if(type!=php_sybase_module.le_link && type!=php_sybase_module.le_plink)
- {
- php_error(E_WARNING,"%d is not a Sybase link index",id);
- RETURN_FALSE;
- }
-
- return_value->value.lval = DBCOUNT(sybase_ptr->link);
- return_value->type = IS_LONG;
-}
-
-
-PHP_MINFO_FUNCTION(sybase)
-{
- char maxp[32],maxl[32];
-
- if (php_sybase_module.max_persistent==-1) {
- snprintf(maxp, 31, "%ld/unlimited", php_sybase_module.num_persistent );
- } else {
- snprintf(maxp, 31, "%ld/%ld", php_sybase_module.num_persistent, php_sybase_module.max_persistent);
- }
- maxp[31]=0;
-
- if (php_sybase_module.max_links==-1) {
- snprintf(maxl, 31, "%ld/unlimited", php_sybase_module.num_links );
- } else {
- snprintf(maxl, 31, "%ld/%ld", php_sybase_module.num_links, php_sybase_module.max_links);
- }
- maxl[31]=0;
-
- php_info_print_table_start();
- php_info_print_table_row(2, "Sybase Support", "enabled");
- php_info_print_table_row(2, "Allow Persistent Links", (php_sybase_module.allow_persistent?"Yes":"No") );
- php_info_print_table_row(2, "Persistent Links", maxp);
- php_info_print_table_row(2, "Total Links", maxl);
- php_info_print_table_row(2, "Application Name", php_sybase_module.appname );
- php_info_print_table_row(2, "Client API Version", dbversion() );
- php_info_print_table_end();
-
-}
-
-
-/* {{{ proto void sybase_min_error_severity(int severity)
- Sets the minimum error severity */
-PHP_FUNCTION(sybase_min_error_severity)
-{
- pval *severity;
-
- if (ZEND_NUM_ARGS()!=1 || getParameters(ht, 1, &severity)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long(severity);
- php_sybase_module.min_error_severity = severity->value.lval;
-}
-/* }}} */
-
-/* {{{ proto void sybase_min_message_severity(int severity)
- Sets the minimum message severity */
-PHP_FUNCTION(sybase_min_message_severity)
-{
- pval *severity;
-
- if (ZEND_NUM_ARGS()!=1 || getParameters(ht, 1, &severity)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long(severity);
- php_sybase_module.min_message_severity = severity->value.lval;
-}
-/* }}} */
-
-#endif
diff --git a/ext/sybase/php_sybase_db.h b/ext/sybase/php_sybase_db.h
deleted file mode 100644
index a622e1222a..0000000000
--- a/ext/sybase/php_sybase_db.h
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef PHP_SYBASE_DB_H
-#define PHP_SYBASE_DB_H
-
-#if HAVE_SYBASE
-
-extern zend_module_entry sybase_module_entry;
-#define sybase_module_ptr &sybase_module_entry
-
-PHP_MINIT_FUNCTION(sybase);
-PHP_RINIT_FUNCTION(sybase);
-PHP_MSHUTDOWN_FUNCTION(sybase);
-PHP_RSHUTDOWN_FUNCTION(sybase);
-PHP_MINFO_FUNCTION(sybase);
-PHP_FUNCTION(sybase_connect);
-PHP_FUNCTION(sybase_pconnect);
-PHP_FUNCTION(sybase_close);
-PHP_FUNCTION(sybase_select_db);
-PHP_FUNCTION(sybase_query);
-PHP_FUNCTION(sybase_free_result);
-PHP_FUNCTION(sybase_get_last_message);
-PHP_FUNCTION(sybase_num_rows);
-PHP_FUNCTION(sybase_num_fields);
-PHP_FUNCTION(sybase_fetch_row);
-PHP_FUNCTION(sybase_fetch_array);
-PHP_FUNCTION(sybase_fetch_object);
-PHP_FUNCTION(sybase_data_seek);
-PHP_FUNCTION(sybase_affected_rows);
-PHP_FUNCTION(sybase_result);
-PHP_FUNCTION(sybase_field_seek);
-PHP_FUNCTION(sybase_min_error_severity);
-PHP_FUNCTION(sybase_min_message_severity);
-
-PHP_FUNCTION(sybase_db_query);
-PHP_FUNCTION(sybase_list_fields);
-PHP_FUNCTION(sybase_fetch_lengths);
-PHP_FUNCTION(sybase_fetch_field);
-PHP_FUNCTION(sybase_field_seek);
-PHP_FUNCTION(sybase_free_result);
-PHP_FUNCTION(sybase_field_name);
-PHP_FUNCTION(sybase_field_table);
-PHP_FUNCTION(sybase_field_len);
-PHP_FUNCTION(sybase_field_type);
-PHP_FUNCTION(sybase_field_flags);
-
-
-
-#include <sybfront.h>
-#include <sybdb.h>
-#include <syberror.h>
-
-#define coltype(j) dbcoltype(sybase_ptr->link,j)
-#define intcol(i) ((int) *(DBINT *) dbdata(sybase_ptr->link,i))
-#define smallintcol(i) ((int) *(DBSMALLINT *) dbdata(sybase_ptr->link,i))
-#define tinyintcol(i) ((int) *(DBTINYINT *) dbdata(sybase_ptr->link,i))
-#define anyintcol(j) (coltype(j)==SYBINT4?intcol(j):(coltype(j)==SYBINT2?smallintcol(j):tinyintcol(j)))
-#define charcol(i) ((DBCHAR *) dbdata(sybase_ptr->link,i))
-#define floatcol(i) ((float) *(DBFLT8 *) dbdata(sybase_ptr->link,i))
-
-typedef struct sybase_link_struct sybase_link;
-
-typedef struct {
- long default_link;
- long num_links,num_persistent;
- long max_links,max_persistent;
- long allow_persistent;
- char *appname;
- char *server_message;
- int le_link,le_plink,le_result;
- long min_error_severity,min_message_severity;
- long cfg_min_error_severity,cfg_min_message_severity;
- long compatability_mode;
-} sybase_module;
-
-struct sybase_link_struct {
- LOGINREC *login;
- DBPROCESS *link;
- int valid;
-};
-
-#define SYBASE_ROWS_BLOCK 128
-
-typedef struct {
- char *name,*column_source;
- int max_length, numeric;
- int type;
-} sybase_field;
-
-typedef struct {
- pval ***data;
- sybase_field *fields;
- sybase_link *sybase_ptr;
- int cur_row,cur_field;
- int num_rows,num_fields;
-} sybase_result;
-
-
-extern sybase_module php_sybase_module;
-
-#else
-
-#define sybase_module_ptr NULL
-
-#endif
-
-#define phpext_sybase_ptr sybase_module_ptr
-
-#endif /* PHP_SYBASE_DB_H */
diff --git a/ext/sybase/setup.stub b/ext/sybase/setup.stub
deleted file mode 100644
index 58e0b789c6..0000000000
--- a/ext/sybase/setup.stub
+++ /dev/null
@@ -1,11 +0,0 @@
-# $Source$
-# $Id$
-
-define_option with-sybase 'Sybase support?' yesnodir \
- 'no /home/sybase Sybase install' \
-' Whether to build PHP with Sybase support (DBLib only).\n
- More info about Sybase can be found at http://www.sybase.com/.'
-
-define_option with-sybase-ct 'Sybase-CT support?' yesnodir \
- 'no /home/sybase Sybase-CT install' \
-' Whether to build PHP with Sybase-CT support.'
diff --git a/ext/sybase_ct/CREDITS b/ext/sybase_ct/CREDITS
deleted file mode 100644
index 4816351f8a..0000000000
--- a/ext/sybase_ct/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-Sybase-CT
-Zeev Suraski, Tom May
diff --git a/ext/sybase_ct/Makefile.in b/ext/sybase_ct/Makefile.in
deleted file mode 100644
index 4b495e4a85..0000000000
--- a/ext/sybase_ct/Makefile.in
+++ /dev/null
@@ -1,5 +0,0 @@
-
-LTLIBRARY_NAME = libsybase_ct.la
-LTLIBRARY_SOURCES = php_sybase_ct.c
-
-include $(top_srcdir)/build/dynlib.mk
diff --git a/ext/sybase_ct/config.m4 b/ext/sybase_ct/config.m4
deleted file mode 100644
index bb640d75c0..0000000000
--- a/ext/sybase_ct/config.m4
+++ /dev/null
@@ -1,44 +0,0 @@
-dnl $Id$
-
-AC_MSG_CHECKING(for Sybase-CT support)
-AC_ARG_WITH(sybase-ct,
-[ --with-sybase-ct[=DIR] Include Sybase-CT support. DIR is the Sybase home
- directory, defaults to /home/sybase.],
-[
- if test "$withval" != "no"; then
- AC_MSG_RESULT(yes)
- if test -z "$SYBASE_LIBS"; then
- PHP_EXTENSION(sybase_ct)
- fi
- AC_DEFINE(HAVE_SYBASE_CT,1,[ ])
- if test "$withval" = "yes"; then
- SYBASE_CT_INCDIR=/home/sybase/include
- SYBASE_CT_LIBDIR=/home/sybase/lib
- else
- SYBASE_CT_INCDIR=$withval/include
- SYBASE_CT_LIBDIR=$withval/lib
- fi
- PHP_ADD_INCLUDE($SYBASE_CT_INCDIR)
- PHP_ADD_LIBPATH($SYBASE_CT_LIBDIR)
- PHP_ADD_LIBRARY(cs)
- PHP_ADD_LIBRARY(ct)
- PHP_ADD_LIBRARY(comn)
- PHP_ADD_LIBRARY(intl)
- SYBASE_CT_LIBS="-lcs -lct -lcomn -lintl"
- old_LDFLAGS=$LDFLAGS
- LDFLAGS="$LDFLAGS -L$SYBASE_CT_LIBDIR"
- AC_CHECK_LIB(tcl, netg_errstr,
- [ PHP_ADD_LIBRARY(tcl) ],
- [ PHP_ADD_LIBRARY(sybtcl) ],
- [ $SYBASE_CT_LIBS ])
- AC_CHECK_LIB(insck, insck__getVdate,
- [ PHP_ADD_LIBRARY(insck) ])
- AC_CHECK_LIB(insck, bsd_tcp,
- [ PHP_ADD_LIBRARY(insck) ])
- LDFLAGS=$old_LDFLAGS
- else
- AC_MSG_RESULT(no)
- fi
-],[
- AC_MSG_RESULT(no)
-])
diff --git a/ext/sybase_ct/php_sybase_ct.c b/ext/sybase_ct/php_sybase_ct.c
deleted file mode 100644
index 3196b43d83..0000000000
--- a/ext/sybase_ct/php_sybase_ct.c
+++ /dev/null
@@ -1,1681 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Zeev Suraski <zeev@zend.com> |
- | Tom May <tom@go2net.com> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "php_sybase_ct.h"
-#include "ext/standard/php_standard.h"
-#include "ext/standard/info.h"
-#include "php_globals.h"
-#include "php_ini.h"
-
-/* True globals, no need for thread safety */
-static int le_link, le_plink, le_result;
-
-#if HAVE_SYBASE_CT
-
-function_entry sybase_functions[] = {
- PHP_FE(sybase_connect, NULL)
- PHP_FE(sybase_pconnect, NULL)
- PHP_FE(sybase_close, NULL)
- PHP_FE(sybase_select_db, NULL)
- PHP_FE(sybase_query, NULL)
- PHP_FE(sybase_free_result, NULL)
- PHP_FE(sybase_get_last_message, NULL)
- PHP_FE(sybase_num_rows, NULL)
- PHP_FE(sybase_num_fields, NULL)
- PHP_FE(sybase_fetch_row, NULL)
- PHP_FE(sybase_fetch_array, NULL)
- PHP_FE(sybase_fetch_object, NULL)
- PHP_FE(sybase_data_seek, NULL)
- PHP_FE(sybase_fetch_field, NULL)
- PHP_FE(sybase_field_seek, NULL)
- PHP_FE(sybase_result, NULL)
- PHP_FE(sybase_affected_rows, NULL)
- PHP_FE(sybase_min_client_severity, NULL)
- PHP_FE(sybase_min_server_severity, NULL)
-
- PHP_FALIAS(mssql_connect, sybase_connect, NULL)
- PHP_FALIAS(mssql_pconnect, sybase_pconnect, NULL)
- PHP_FALIAS(mssql_close, sybase_close, NULL)
- PHP_FALIAS(mssql_select_db, sybase_select_db, NULL)
- PHP_FALIAS(mssql_query, sybase_query, NULL)
- PHP_FALIAS(mssql_free_result, sybase_free_result, NULL)
- PHP_FALIAS(mssql_get_last_message, sybase_get_last_message,NULL)
- PHP_FALIAS(mssql_num_rows, sybase_num_rows, NULL)
- PHP_FALIAS(mssql_num_fields, sybase_num_fields, NULL)
- PHP_FALIAS(mssql_fetch_row, sybase_fetch_row, NULL)
- PHP_FALIAS(mssql_fetch_array, sybase_fetch_array, NULL)
- PHP_FALIAS(mssql_fetch_object, sybase_fetch_object, NULL)
- PHP_FALIAS(mssql_data_seek, sybase_data_seek, NULL)
- PHP_FALIAS(mssql_fetch_field, sybase_fetch_field, NULL)
- PHP_FALIAS(mssql_field_seek, sybase_field_seek, NULL)
- PHP_FALIAS(mssql_result, sybase_result, NULL)
- PHP_FALIAS(mssql_affected_rows, sybase_affected_rows, NULL)
- PHP_FALIAS(mssql_min_client_severity, sybase_min_client_severity, NULL)
- PHP_FALIAS(mssql_min_server_severity, sybase_min_server_severity, NULL)
- {NULL, NULL, NULL}
-};
-
-zend_module_entry sybase_module_entry = {
- "sybase_ct", sybase_functions, PHP_MINIT(sybase), PHP_MSHUTDOWN(sybase), PHP_RINIT(sybase), PHP_RSHUTDOWN(sybase), PHP_MINFO(sybase), STANDARD_MODULE_PROPERTIES
-};
-
-ZEND_DECLARE_MODULE_GLOBALS(sybase)
-static CS_CONTEXT *context;
-
-#ifdef COMPILE_DL_SYBASE_CT
-ZEND_GET_MODULE(sybase)
-#endif
-
-ZEND_DECLARE_MODULE_GLOBALS(sybase)
-
-#define CHECK_LINK(link) { if (link==-1) { php_error(E_WARNING, "Sybase: A link to the server could not be established"); RETURN_FALSE; } }
-
-
-static int _clean_invalid_results(list_entry *le)
-{
- SybCtLS_FETCH();
-
- if (le->type == le_result) {
- sybase_link *sybase_ptr = ((sybase_result *) le->ptr)->sybase_ptr;
-
- if (!sybase_ptr->valid) {
- return 1;
- }
- }
- return 0;
-}
-
-
-static void _free_sybase_result(sybase_result *result)
-{
- int i, j;
-
- if (result->data) {
- for (i=0; i<result->num_rows; i++) {
- for (j=0; j<result->num_fields; j++) {
- pval_destructor(&result->data[i][j]);
- }
- efree(result->data[i]);
- }
- efree(result->data);
- }
-
- if (result->fields) {
- for (i=0; i<result->num_fields; i++) {
- STR_FREE(result->fields[i].name);
- STR_FREE(result->fields[i].column_source);
- }
- efree(result->fields);
- }
-
- efree(result);
-}
-
-static void php_free_sybase_result(zend_rsrc_list_entry *rsrc)
-{
- sybase_result *result = (sybase_result *)rsrc->ptr;
- _free_sybase_result(result);
-}
-
-static void _close_sybase_link(zend_rsrc_list_entry *rsrc)
-{
- sybase_link *sybase_ptr = (sybase_link *)rsrc->ptr;
- CS_INT con_status;
- ELS_FETCH();
- SybCtLS_FETCH();
-
- sybase_ptr->valid = 0;
-
- zend_hash_apply(&EG(regular_list),(int (*)(void *))_clean_invalid_results);
-
- /* Non-persistent connections will always be connected or we wouldn't
- * get here, but since we want to check the death status anyway
- * we might as well double-check the connect status.
- */
- if (ct_con_props(sybase_ptr->connection, CS_GET, CS_CON_STATUS,
- &con_status, CS_UNUSED, NULL)!=CS_SUCCEED) {
- php_error(E_WARNING, "Sybase: Unable to get connection status on close");
- /* Assume the worst. */
- con_status = CS_CONSTAT_CONNECTED | CS_CONSTAT_DEAD;
- }
- if (con_status & CS_CONSTAT_CONNECTED) {
- if ((con_status & CS_CONSTAT_DEAD) || ct_close(sybase_ptr->connection, CS_UNUSED)!=CS_SUCCEED) {
- ct_close(sybase_ptr->connection, CS_FORCE_CLOSE);
- }
- }
-
- ct_con_drop(sybase_ptr->connection);
- efree(sybase_ptr);
- SybCtG(num_links)--;
-}
-
-
-static void _close_sybase_plink(zend_rsrc_list_entry *rsrc)
-{
- sybase_link *sybase_ptr = (sybase_link *)rsrc->ptr;
- CS_INT con_status;
- SybCtLS_FETCH();
-
- /* Persistent connections may have been closed before a failed
- * reopen attempt.
- */
- if (ct_con_props(sybase_ptr->connection, CS_GET, CS_CON_STATUS,
- &con_status, CS_UNUSED, NULL)!=CS_SUCCEED) {
- php_error(E_WARNING, "Sybase: Unable to get connection status on close");
- /* Assume the worst. */
- con_status = CS_CONSTAT_CONNECTED | CS_CONSTAT_DEAD;
- }
- if (con_status & CS_CONSTAT_CONNECTED) {
- if ((con_status & CS_CONSTAT_DEAD) || ct_close(sybase_ptr->connection, CS_UNUSED)!=CS_SUCCEED) {
- ct_close(sybase_ptr->connection, CS_FORCE_CLOSE);
- }
- }
-
- ct_con_drop(sybase_ptr->connection);
- free(sybase_ptr);
- SybCtG(num_persistent)--;
- SybCtG(num_links)--;
-}
-
-
-static CS_RETCODE CS_PUBLIC _client_message_handler(CS_CONTEXT *context, CS_CONNECTION *connection, CS_CLIENTMSG *errmsg)
-{
- SybCtLS_FETCH();
-
- if (CS_SEVERITY(errmsg->msgnumber) >= SybCtG(min_client_severity)) {
- php_error(E_WARNING, "Sybase: Client message: %s (severity %d)", errmsg->msgstring, CS_SEVERITY(errmsg->msgnumber));
- }
- STR_FREE(SybCtG(server_message));
- SybCtG(server_message) = estrdup(errmsg->msgstring);
-
-
- /* If this is a timeout message, return CS_FAIL to cancel the
- * operation and mark the connection as dead.
- */
- if (CS_SEVERITY(errmsg->msgnumber) == CS_SV_RETRY_FAIL &&
- CS_NUMBER(errmsg->msgnumber) == 63 &&
- CS_ORIGIN(errmsg->msgnumber) == 2 &&
- CS_LAYER(errmsg->msgnumber) == 1)
- {
- return CS_FAIL;
- }
-
- return CS_SUCCEED;
-}
-
-
-static CS_RETCODE CS_PUBLIC _server_message_handler(CS_CONTEXT *context, CS_CONNECTION *connection, CS_SERVERMSG *srvmsg)
-{
- SybCtLS_FETCH();
-
- if (srvmsg->severity >= SybCtG(min_server_severity)) {
- php_error(E_WARNING, "Sybase: Server message: %s (severity %d, procedure %s)",
- srvmsg->text, srvmsg->severity, ((srvmsg->proclen>0) ? srvmsg->proc : "N/A"));
- }
- STR_FREE(SybCtG(server_message));
- SybCtG(server_message) = estrdup(srvmsg->text);
-
- /* If this is a deadlock message, set the connection's deadlock flag
- * so we will retry the request. Sorry about the bare constant here,
- * but it's not defined anywhere and it's a "well-known" number.
- */
- if (srvmsg->msgnumber == 1205) {
- sybase_link *sybase;
-
- if (ct_con_props(connection, CS_GET, CS_USERDATA, &sybase, CS_SIZEOF(sybase), NULL)==CS_SUCCEED) {
- sybase->deadlock = 1;
- }
- else {
- /* oh well */
- }
- }
-
- return CS_SUCCEED;
-}
-
-
-PHP_INI_BEGIN()
- STD_PHP_INI_BOOLEAN("sybct.allow_persistent", "1", PHP_INI_SYSTEM, OnUpdateInt, allow_persistent, zend_sybase_globals, sybase_globals)
- STD_PHP_INI_ENTRY_EX("sybct.max_persistent", "-1", PHP_INI_SYSTEM, OnUpdateInt, max_persistent, zend_sybase_globals, sybase_globals, display_link_numbers)
- STD_PHP_INI_ENTRY_EX("sybct.max_links", "-1", PHP_INI_SYSTEM, OnUpdateInt, max_links, zend_sybase_globals, sybase_globals, display_link_numbers)
- STD_PHP_INI_ENTRY("sybct.min_server_severity", "10", PHP_INI_ALL, OnUpdateInt, min_server_severity, zend_sybase_globals, sybase_globals)
- STD_PHP_INI_ENTRY("sybct.min_client_severity", "10", PHP_INI_ALL, OnUpdateInt, min_client_severity, zend_sybase_globals, sybase_globals)
- STD_PHP_INI_ENTRY("sybct.hostname", NULL, PHP_INI_ALL, OnUpdateString, hostname, zend_sybase_globals, sybase_globals)
-PHP_INI_END()
-
-
-static void php_sybase_init_globals(zend_sybase_globals *sybase_globals)
-{
- long timeout;
-
- if (cs_ctx_alloc(CTLIB_VERSION, &sybase_globals->context)!=CS_SUCCEED || ct_init(sybase_globals->context,CTLIB_VERSION)!=CS_SUCCEED) {
- return;
- }
-
- /* Initialize message handlers */
- if (ct_callback(sybase_globals->context, NULL, CS_SET, CS_SERVERMSG_CB, (CS_VOID *)_server_message_handler)!=CS_SUCCEED) {
- php_error(E_WARNING, "Sybase: Unable to set server message handler");
- }
-
- if (ct_callback(sybase_globals->context, NULL, CS_SET, CS_CLIENTMSG_CB, (CS_VOID *)_client_message_handler)!=CS_SUCCEED) {
- php_error(E_WARNING, "Sybase: Unable to set client message handler");
- }
-
- /* Set datetime conversion format to "Nov 3 1998 8:06PM".
- * This is the default format for the ct-lib that comes with
- * Sybase ASE 11.5.1 for Solaris, but the Linux libraries that
- * come with 11.0.3.3 default to "03/11/98" which is singularly
- * useless. This levels the playing field for all platforms.
- */
- {
- CS_INT dt_convfmt = CS_DATES_SHORT;
- if (cs_dt_info(sybase_globals->context, CS_SET, NULL, CS_DT_CONVFMT, CS_UNUSED, &dt_convfmt, sizeof(dt_convfmt), NULL)!=CS_SUCCEED) {
- php_error(E_WARNING, "Sybase: Unable to set datetime conversion format");
- }
- }
-
- /* Set the login and command timeouts. These are per-context and
- * can't be set with ct_con_props(), so set them globally from
- * their config values if requested. The defaults are 1 minute
- * for CS_LOGIN_TIMEOUT and CS_NO_LIMIT for CS_TIMEOUT. The latter
- * especially is fairly useless for web applications.
- * Note that depite some noise in the documentation about using
- * signals to implement timeouts, they are actually implemented
- * by using poll() or select() on Solaris and Linux.
- */
- if (cfg_get_long("sybct.login_timeout", &timeout)==SUCCESS) {
- CS_INT cs_login_timeout = timeout;
- if (ct_config(sybase_globals->context, CS_SET, CS_LOGIN_TIMEOUT, &cs_login_timeout, CS_UNUSED, NULL)!=CS_SUCCEED) {
- php_error(E_WARNING, "Sybase: Unable to set login timeoutt");
- }
- }
- if (cfg_get_long("sybct.timeout", &timeout)==SUCCESS) {
- CS_INT cs_timeout = timeout;
- if (ct_config(sybase_globals->context, CS_SET, CS_TIMEOUT, &cs_timeout, CS_UNUSED, NULL)!=CS_SUCCEED) {
- php_error(E_WARNING, "Sybase: Unable to set timeout");
- }
- }
- sybase_globals->num_persistent=0;
-}
-
-
-static void php_sybase_destroy_globals(zend_sybase_globals *sybase_globals)
-{
- ct_exit(sybase_globals->context, CS_UNUSED);
- cs_ctx_drop(sybase_globals->context);
-}
-
-PHP_MINIT_FUNCTION(sybase)
-{
- ZEND_INIT_MODULE_GLOBALS(sybase, php_sybase_init_globals, php_sybase_destroy_globals);
-
- REGISTER_INI_ENTRIES();
-
- le_link = zend_register_list_destructors_ex(_close_sybase_link, NULL, "sybase-ct link", module_number);
- le_plink = zend_register_list_destructors_ex(NULL, _close_sybase_plink, "sybase-ct link persistent", module_number);
- le_result = zend_register_list_destructors_ex(php_free_sybase_result, NULL, "sybase-ct result", module_number);
-
- return SUCCESS;
-}
-
-
-
-PHP_RINIT_FUNCTION(sybase)
-{
- SybCtLS_FETCH();
-
- SybCtG(default_link)=-1;
- SybCtG(num_links) = SybCtG(num_persistent);
- SybCtG(appname) = estrndup("PHP 4.0", 7);
- SybCtG(server_message) = empty_string;
- return SUCCESS;
-}
-
-
-
-PHP_MSHUTDOWN_FUNCTION(sybase)
-{
- UNREGISTER_INI_ENTRIES();
-#if 0
- ct_exit(context,CS_UNUSED);
- cs_ctx_drop(context);
-#endif
- return SUCCESS;
-}
-
-
-PHP_RSHUTDOWN_FUNCTION(sybase)
-{
- SybCtLS_FETCH();
-
- efree(SybCtG(appname));
- STR_FREE(SybCtG(server_message));
- return SUCCESS;
-}
-
-
-static int php_sybase_do_connect_internal(sybase_link *sybase, char *host, char *user, char *passwd)
-{
- SybCtLS_FETCH();
-
- /* set a CS_CONNECTION record */
- if (ct_con_alloc(SybCtG(context), &sybase->connection)!=CS_SUCCEED) {
- php_error(E_WARNING, "Sybase: Unable to allocate connection record");
- return 0;
- }
-
- /* Note - this saves a copy of sybase, not a pointer to it. */
- if (ct_con_props(sybase->connection, CS_SET, CS_USERDATA, &sybase, CS_SIZEOF(sybase), NULL)!=CS_SUCCEED) {
- php_error(E_WARNING, "Sybase: Unable to set userdata");
- ct_con_drop(sybase->connection);
- return 0;
- }
-
- if (user) {
- ct_con_props(sybase->connection, CS_SET, CS_USERNAME, user, CS_NULLTERM, NULL);
- }
- if (passwd) {
- ct_con_props(sybase->connection, CS_SET, CS_PASSWORD, passwd, CS_NULLTERM, NULL);
- }
- ct_con_props(sybase->connection, CS_SET, CS_APPNAME, SybCtG(appname), CS_NULLTERM, NULL);
-
- if (SybCtG(hostname)) {
- ct_con_props(sybase->connection, CS_SET, CS_HOSTNAME, SybCtG(hostname), CS_NULLTERM, NULL);
- }
-
- sybase->valid = 1;
- sybase->dead = 0;
-
- /* create the link */
- if (ct_connect(sybase->connection, host, CS_NULLTERM)!=CS_SUCCEED) {
- php_error(E_WARNING, "Sybase: Unable to connect");
- ct_con_drop(sybase->connection);
- return 0;
- }
-
- if (ct_cmd_alloc(sybase->connection, &sybase->cmd)!=CS_SUCCEED) {
- php_error(E_WARNING, "Sybase: Unable to allocate command record");
- ct_close(sybase->connection,CS_UNUSED);
- ct_con_drop(sybase->connection);
- return 0;
- }
-
- return 1;
-}
-
-
-static void php_sybase_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
-{
- char *user,*passwd,*host;
- char *hashed_details;
- int hashed_details_length;
- sybase_link *sybase_ptr;
- SybCtLS_FETCH();
-
- switch(ZEND_NUM_ARGS()) {
- case 0: /* defaults */
- host=user=passwd=NULL;
- hashed_details_length=6+3;
- hashed_details = (char *) emalloc(hashed_details_length+1);
- strcpy(hashed_details, "sybase___");
- break;
- case 1: {
- pval *yyhost;
-
- if (getParameters(ht, 1, &yyhost)==FAILURE) {
- RETURN_FALSE;
- }
- convert_to_string(yyhost);
- host = yyhost->value.str.val;
- user=passwd=NULL;
- hashed_details_length = yyhost->value.str.len+6+3;
- hashed_details = (char *) emalloc(hashed_details_length+1);
- sprintf(hashed_details, "sybase_%s__", yyhost->value.str.val);
- }
- break;
- case 2: {
- pval *yyhost,*yyuser;
-
- if (getParameters(ht, 2, &yyhost, &yyuser)==FAILURE) {
- RETURN_FALSE;
- }
- convert_to_string(yyhost);
- convert_to_string(yyuser);
- host = yyhost->value.str.val;
- user = yyuser->value.str.val;
- passwd=NULL;
- hashed_details_length = yyhost->value.str.len+yyuser->value.str.len+6+3;
- hashed_details = (char *) emalloc(hashed_details_length+1);
- sprintf(hashed_details, "sybase_%s_%s_", yyhost->value.str.val, yyuser->value.str.val);
- }
- break;
- case 3: {
- pval *yyhost,*yyuser,*yypasswd;
-
- if (getParameters(ht, 3, &yyhost, &yyuser, &yypasswd) == FAILURE) {
- RETURN_FALSE;
- }
- convert_to_string(yyhost);
- convert_to_string(yyuser);
- convert_to_string(yypasswd);
- host = yyhost->value.str.val;
- user = yyuser->value.str.val;
- passwd = yypasswd->value.str.val;
- hashed_details_length = yyhost->value.str.len+yyuser->value.str.len+yypasswd->value.str.len+6+3;
- hashed_details = (char *) emalloc(hashed_details_length+1);
- sprintf(hashed_details, "sybase_%s_%s_%s", yyhost->value.str.val, yyuser->value.str.val, yypasswd->value.str.val); /* SAFE */
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
-
- if (!SybCtG(allow_persistent)) {
- persistent=0;
- }
- if (persistent) {
- list_entry *le;
-
- /* try to find if we already have this link in our persistent list */
- if (zend_hash_find(&EG(persistent_list), hashed_details, hashed_details_length+1, (void **) &le)==FAILURE) { /* we don't */
- list_entry new_le;
-
- if (SybCtG(max_links)!=-1 && SybCtG(num_links)>=SybCtG(max_links)) {
- php_error(E_WARNING, "Sybase: Too many open links (%d)",SybCtG(num_links));
- efree(hashed_details);
- RETURN_FALSE;
- }
- if (SybCtG(max_persistent)!=-1 && SybCtG(num_persistent)>=SybCtG(max_persistent)) {
- php_error(E_WARNING, "Sybase: Too many open persistent links (%d)",SybCtG(num_persistent));
- efree(hashed_details);
- RETURN_FALSE;
- }
-
- sybase_ptr = (sybase_link *) malloc(sizeof(sybase_link));
- if (!php_sybase_do_connect_internal(sybase_ptr, host, user, passwd)) {
- free(sybase_ptr);
- efree(hashed_details);
- RETURN_FALSE;
- }
-
- /* hash it up */
- new_le.type = le_plink;
- new_le.ptr = sybase_ptr;
- if (zend_hash_update(&EG(persistent_list), hashed_details, hashed_details_length+1, (void *) &new_le, sizeof(list_entry),NULL)==FAILURE) {
- ct_close(sybase_ptr->connection, CS_UNUSED);
- ct_con_drop(sybase_ptr->connection);
- free(sybase_ptr);
- efree(hashed_details);
- RETURN_FALSE;
- }
- SybCtG(num_persistent)++;
- SybCtG(num_links)++;
- } else { /* we do */
- CS_INT con_status;
-
- if (le->type != le_plink) {
- efree(hashed_details);
- RETURN_FALSE;
- }
-
- sybase_ptr = (sybase_link *) le->ptr;
-
- /* If the link has died, close it and overwrite it with a new one. */
-
- if (ct_con_props(sybase_ptr->connection, CS_GET, CS_CON_STATUS,
- &con_status, CS_UNUSED, NULL)!=CS_SUCCEED) {
- php_error(E_WARNING, "Sybase: Unable to get connection status");
- efree(hashed_details);
- RETURN_FALSE;
- }
- if (!(con_status & CS_CONSTAT_CONNECTED) || (con_status & CS_CONSTAT_DEAD) || sybase_ptr->dead) {
- sybase_link sybase;
-
- if (con_status & CS_CONSTAT_CONNECTED) {
- ct_close(sybase_ptr->connection, CS_FORCE_CLOSE);
- }
- /* Create a new connection, then replace the old
- * connection. If we fail to create a new connection,
- * put the old one back so there will be a connection,
- * even if it is a non-functional one. This is because
- * code may still be holding an id for this connection
- * so we can't free the CS_CONNECTION.
- * (This is actually totally hokey, it would be better
- * to just ct_con_drop() the connection and set
- * sybase_ptr->connection to NULL, then test it for
- * NULL before trying to use it elsewhere . . .)
- */
- memcpy(&sybase, sybase_ptr, sizeof(sybase_link));
- if (!php_sybase_do_connect_internal(sybase_ptr, host, user, passwd)) {
- memcpy(sybase_ptr, &sybase, sizeof(sybase_link));
- efree(hashed_details);
- RETURN_FALSE;
- }
- ct_con_drop(sybase.connection); /* drop old connection */
- }
- }
- ZEND_REGISTER_RESOURCE(return_value, sybase_ptr, le_plink);
- } else { /* non persistent */
- list_entry *index_ptr, new_index_ptr;
-
- /* first we check the hash for the hashed_details key. if it exists,
- * it should point us to the right offset where the actual sybase link sits.
- * if it doesn't, open a new sybase link, add it to the resource list,
- * and add a pointer to it with hashed_details as the key.
- */
- if (zend_hash_find(&EG(regular_list), hashed_details, hashed_details_length+1,(void **) &index_ptr)==SUCCESS) {
- int type, link;
- void *ptr;
-
- if (index_ptr->type != le_index_ptr) {
- efree(hashed_details);
- RETURN_FALSE;
- }
- link = (int) index_ptr->ptr;
- ptr = zend_list_find(link, &type); /* check if the link is still there */
- if (ptr && (type==le_link || type==le_plink)) {
- return_value->value.lval = SybCtG(default_link) = link;
- return_value->type = IS_RESOURCE;
- efree(hashed_details);
- return;
- } else {
- zend_hash_del(&EG(regular_list), hashed_details, hashed_details_length+1);
- }
- }
- if (SybCtG(max_links)!=-1 && SybCtG(num_links)>=SybCtG(max_links)) {
- php_error(E_WARNING, "Sybase: Too many open links (%d)",SybCtG(num_links));
- efree(hashed_details);
- RETURN_FALSE;
- }
-
- sybase_ptr = (sybase_link *) emalloc(sizeof(sybase_link));
- if (!php_sybase_do_connect_internal(sybase_ptr, host, user, passwd)) {
- efree(sybase_ptr);
- efree(hashed_details);
- RETURN_FALSE;
- }
-
- /* add it to the list */
- ZEND_REGISTER_RESOURCE(return_value, sybase_ptr, le_link);
-
- /* add it to the hash */
- new_index_ptr.ptr = (void *) return_value->value.lval;
- new_index_ptr.type = le_index_ptr;
- if (zend_hash_update(&EG(regular_list), hashed_details, hashed_details_length+1,(void *) &new_index_ptr, sizeof(list_entry),NULL)==FAILURE) {
- ct_close(sybase_ptr->connection, CS_UNUSED);
- ct_con_drop(sybase_ptr->connection);
- efree(sybase_ptr);
- efree(hashed_details);
- RETURN_FALSE;
- }
- SybCtG(num_links)++;
- }
- efree(hashed_details);
- SybCtG(default_link)=return_value->value.lval;
-}
-
-
-static int php_sybase_get_default_link(INTERNAL_FUNCTION_PARAMETERS)
-{
- SybCtLS_FETCH();
-
- if (SybCtG(default_link)==-1) { /* no link opened yet, implicitly open one */
- ht = 0;
- php_sybase_do_connect(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
- }
- return SybCtG(default_link);
-}
-
-
-/* {{{ proto int sybase_connect([string host [, string user [, string password [, string charset]]]])
- Open Sybase server connection */
-PHP_FUNCTION(sybase_connect)
-{
- php_sybase_do_connect(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-
-/* }}} */
-
-/* {{{ proto int sybase_pconnect([string host [, string user [, string password [, string charset]]]])
- Open persistent Sybase connection */
-PHP_FUNCTION(sybase_pconnect)
-{
- php_sybase_do_connect(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
-}
-
-/* }}} */
-
-
-/* {{{ proto bool sybase_close([int link_id])
- Close Sybase connection */
-PHP_FUNCTION(sybase_close)
-{
- pval *sybase_link_index = 0;
- int id;
- sybase_link *sybase_ptr;
- SybCtLS_FETCH();
-
- switch (ZEND_NUM_ARGS()) {
- case 0:
- id = SybCtG(default_link);
- break;
- case 1:
- if (getParameters(ht, 1, &sybase_link_index)==FAILURE) {
- RETURN_FALSE;
- }
- id = -1;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- ZEND_FETCH_RESOURCE2(sybase_ptr, sybase_link *, &sybase_link_index, id, "Sybase-Link", le_link, le_plink);
-
- if (id==-1) { /* explicit resource number */
- zend_list_delete(Z_RESVAL_P(sybase_link_index));
- }
-
- if (id!=-1
- || (sybase_link_index && Z_RESVAL_P(sybase_link_index)==SybCtG(default_link))) {
- zend_list_delete(SybCtG(default_link));
- SybCtG(default_link) = -1;
- }
-
- RETURN_TRUE;
-}
-
-/* }}} */
-
-
-static int exec_cmd(sybase_link *sybase_ptr, char *cmdbuf)
-{
- CS_RETCODE retcode;
- CS_INT restype;
- int failure=0;
- SybCtLS_FETCH();
-
- /* Fail if we already marked this connection dead. */
-
- if (sybase_ptr->dead) {
- return FAILURE;
- }
-
- /*
- ** Get a command handle, store the command string in it, and
- ** send it to the server.
- */
-
- if (ct_command(sybase_ptr->cmd, CS_LANG_CMD, cmdbuf, CS_NULLTERM, CS_UNUSED)!=CS_SUCCEED) {
- sybase_ptr->dead = 1;
- return FAILURE;
- }
- if (ct_send(sybase_ptr->cmd)!=CS_SUCCEED) {
- sybase_ptr->dead = 1;
- return FAILURE;
- }
-
- while ((retcode = ct_results(sybase_ptr->cmd, &restype))==CS_SUCCEED) {
- switch ((int) restype) {
- case CS_CMD_SUCCEED:
- case CS_CMD_DONE:
- break;
-
- case CS_CMD_FAIL:
- failure=1;
- break;
-
- case CS_STATUS_RESULT:
- ct_cancel(NULL, sybase_ptr->cmd, CS_CANCEL_CURRENT);
- break;
-
- default:
- failure=1;
- break;
- }
- if (failure) {
- ct_cancel(NULL, sybase_ptr->cmd, CS_CANCEL_ALL);
- return FAILURE;
- }
- }
-
- switch (retcode) {
- case CS_END_RESULTS:
- return SUCCESS;
- break;
-
- case CS_FAIL:
- /* Hopefully this either cleans up the connection, or the
- * connection ends up marked dead so it will be reopened
- * if it is persistent. We may want to do
- * ct_close(CS_FORCE_CLOSE) if ct_cancel() fails; see the
- * doc for ct_results()==CS_FAIL.
- */
- ct_cancel(NULL, sybase_ptr->cmd, CS_CANCEL_ALL);
- /* Don't take chances with the vagaries of ct-lib. Mark it
- * dead ourselves.
- */
- sybase_ptr->dead = 1;
- return FAILURE;
-
- default:
- return FAILURE;
- }
-}
-
-
-/* {{{ proto bool sybase_select_db(string database [, int link_id])
- Select Sybase database */
-PHP_FUNCTION(sybase_select_db)
-{
- pval *db,*sybase_link_index;
- int id;
- char *cmdbuf;
- sybase_link *sybase_ptr;
- SybCtLS_FETCH();
-
- switch(ZEND_NUM_ARGS()) {
- case 1:
- if (getParameters(ht, 1, &db)==FAILURE) {
- RETURN_FALSE;
- }
- id = php_sybase_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU);
- CHECK_LINK(id);
- break;
- case 2:
- if (getParameters(ht, 2, &db, &sybase_link_index)==FAILURE) {
- RETURN_FALSE;
- }
- id = -1;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- ZEND_FETCH_RESOURCE2(sybase_ptr, sybase_link *, &sybase_link_index, id, "Sybase-Link", le_link, le_plink);
-
- convert_to_string(db);
- cmdbuf = (char *) emalloc(sizeof("use ")+db->value.str.len+1);
- sprintf(cmdbuf, "use %s", db->value.str.val); /* SAFE */
-
- if (exec_cmd(sybase_ptr, cmdbuf)==FAILURE) {
- efree(cmdbuf);
- RETURN_FALSE;
- } else {
- efree(cmdbuf);
- RETURN_TRUE;
- }
-}
-
-/* }}} */
-
-
-static sybase_result * php_sybase_fetch_result_set (sybase_link *sybase_ptr)
-{
- int num_fields;
- sybase_result *result;
- char **tmp_buffer;
- CS_INT *lengths;
- CS_SMALLINT *indicators;
- unsigned char *numerics;
- CS_INT *types;
- CS_DATAFMT *datafmt;
- int i, j, retcode;
- int blocks_initialized=1;
- SybCtLS_FETCH();
-
- /* The following is more or less the equivalent of mysql_store_result().
- * fetch all rows from the server into the row buffer, thus:
- * 1) Being able to fire up another query without explicitly reading all rows
- * 2) Having numrows accessible
- */
-
- if (ct_res_info(sybase_ptr->cmd, CS_NUMDATA, &num_fields, CS_UNUSED, NULL)!=CS_SUCCEED) {
- return NULL;
- }
-
- result = (sybase_result *) emalloc(sizeof(sybase_result));
- result->data = (pval **) emalloc(sizeof(pval *)*SYBASE_ROWS_BLOCK);
- result->fields = NULL;
- result->sybase_ptr = sybase_ptr;
- result->cur_field=result->cur_row=result->num_rows=0;
- result->num_fields = num_fields;
-
- tmp_buffer = (char **) emalloc(sizeof(char *)*num_fields);
- lengths = (CS_INT *) emalloc(sizeof(CS_INT)*num_fields);
- indicators = (CS_SMALLINT *) emalloc(sizeof(CS_INT)*num_fields);
- datafmt = (CS_DATAFMT *) emalloc(sizeof(CS_DATAFMT)*num_fields);
- numerics = (unsigned char *) emalloc(sizeof(unsigned char)*num_fields);
- types = (CS_INT *) emalloc(sizeof(CS_INT)*num_fields);
-
-
- for (i=0; i<num_fields; i++) {
- ct_describe(sybase_ptr->cmd, i+1, &datafmt[i]);
- types[i] = datafmt[i].datatype;
- switch (datafmt[i].datatype) {
- case CS_CHAR_TYPE:
- case CS_VARCHAR_TYPE:
- case CS_TEXT_TYPE:
- case CS_IMAGE_TYPE:
- datafmt[i].maxlength++;
- numerics[i] = 0;
- break;
- case CS_BINARY_TYPE:
- case CS_VARBINARY_TYPE:
- datafmt[i].maxlength *= 2;
- datafmt[i].maxlength++;
- numerics[i] = 0;
- break;
- case CS_BIT_TYPE:
- case CS_TINYINT_TYPE:
- datafmt[i].maxlength = 4;
- numerics[i] = 1;
- break;
- case CS_SMALLINT_TYPE:
- datafmt[i].maxlength = 7;
- numerics[i] = 1;
- break;
- case CS_INT_TYPE:
- datafmt[i].maxlength = 12;
- numerics[i] = 1;
- break;
- case CS_REAL_TYPE:
- case CS_FLOAT_TYPE:
- datafmt[i].maxlength = 24;
- numerics[i] = 1;
- break;
- case CS_MONEY_TYPE:
- case CS_MONEY4_TYPE:
- datafmt[i].maxlength = 24;
- numerics[i] = 0;
- break;
- case CS_DATETIME_TYPE:
- case CS_DATETIME4_TYPE:
- datafmt[i].maxlength = 30;
- numerics[i] = 0;
- break;
- case CS_NUMERIC_TYPE:
- case CS_DECIMAL_TYPE:
- datafmt[i].maxlength = datafmt[i].precision + 3;
- numerics[i] = 1;
- break;
- default:
- datafmt[i].maxlength++;
- numerics[i] = 0;
- break;
- }
- tmp_buffer[i] = (char *)emalloc(datafmt[i].maxlength);
- datafmt[i].datatype = CS_CHAR_TYPE;
- datafmt[i].format = CS_FMT_NULLTERM;
- ct_bind(sybase_ptr->cmd, i+1, &datafmt[i], tmp_buffer[i], &lengths[i], &indicators[i]);
- }
-
- while ((retcode=ct_fetch(sybase_ptr->cmd,CS_UNUSED,CS_UNUSED,CS_UNUSED,NULL))==CS_SUCCEED
- || retcode==CS_ROW_FAIL) {
- /*
- if (retcode==CS_ROW_FAIL) {
- php_error(E_WARNING, "Sybase: Error reading row %d", result->num_rows);
- }
- */
- i = result->num_rows++;
- if (result->num_rows > blocks_initialized*SYBASE_ROWS_BLOCK) {
- result->data = (pval **) erealloc(result->data, sizeof(pval *)*SYBASE_ROWS_BLOCK*(++blocks_initialized));
- }
- result->data[i] = (pval *) emalloc(sizeof(pval)*num_fields);
- for (j=0; j<num_fields; j++) {
- if (indicators[j] == -1) { /* null value */
- var_reset(&result->data[i][j]);
- } else {
- result->data[i][j].value.str.len = lengths[j]-1; /* we don't need the NULL in the length */
- result->data[i][j].value.str.val = estrndup(tmp_buffer[j], lengths[j]);
- result->data[i][j].type = IS_STRING;
- }
- }
- }
-
- if (retcode != CS_END_DATA) {
- _free_sybase_result(result);
- result = NULL;
- } else {
- result->fields = (sybase_field *) emalloc(sizeof(sybase_field)*num_fields);
- j=0;
- for (i=0; i<num_fields; i++) {
- char computed_buf[16];
-
- if (datafmt[i].namelen>0) {
- result->fields[i].name = estrndup(datafmt[i].name, datafmt[i].namelen);
- } else {
- if (j>0) {
- snprintf(computed_buf, 16, "computed%d", j);
- } else {
- strcpy(computed_buf, "computed");
- }
- result->fields[i].name = estrdup(computed_buf);
- j++;
- }
- result->fields[i].column_source = empty_string;
- result->fields[i].max_length = datafmt[i].maxlength-1;
- result->fields[i].numeric = numerics[i];
- result->fields[i].type = types[i];
- }
- }
-
- efree(datafmt);
- efree(lengths);
- efree(indicators);
- efree(numerics);
- efree(types);
- for (i=0; i<num_fields; i++) {
- efree(tmp_buffer[i]);
- }
- efree(tmp_buffer);
-
- return result;
-}
-
-
-/* {{{ proto int sybase_query(string query [, int link_id])
- Send Sybase query */
-PHP_FUNCTION(sybase_query)
-{
- pval **query, **sybase_link_index=NULL;
- int id;
- sybase_link *sybase_ptr;
- sybase_result *result;
- CS_INT restype;
- CS_RETCODE retcode;
- enum {
- Q_RESULT, /* Success with results. */
- Q_SUCCESS, /* Success but no results. */
- Q_FAILURE, /* Failure, no results. */
- } status;
- SybCtLS_FETCH();
-
- switch(ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &query)==FAILURE) {
- RETURN_FALSE;
- }
- id = SybCtG(default_link);
- break;
- case 2:
- if (zend_get_parameters_ex(2, &query, &sybase_link_index)==FAILURE) {
- RETURN_FALSE;
- }
- id = -1;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- ZEND_FETCH_RESOURCE2(sybase_ptr, sybase_link *, sybase_link_index, id, "Sybase-Link", le_link, le_plink);
-
- convert_to_string_ex(query);
-
- /* Fail if we already marked this connection dead. */
-
- if (sybase_ptr->dead) {
- RETURN_FALSE;
- }
-
- /* Repeat until we don't deadlock. */
-
- for (;;) {
- result = NULL;
- sybase_ptr->deadlock = 0;
- sybase_ptr->affected_rows = 0;
-
- /* On Solaris 11.5, ct_command() can be moved outside the
- * loop, but not on Linux 11.0.
- */
- if (ct_command(sybase_ptr->cmd, CS_LANG_CMD, (*query)->value.str.val, CS_NULLTERM, CS_UNUSED)!=CS_SUCCEED) {
- /* If this didn't work, the connection is screwed but
- * ct-lib might not set CS_CONSTAT_DEAD. So set our own
- * flag. This happens sometimes when the database is restarted
- * and/or its machine is rebooted, and ct_command() returns
- * CS_BUSY for some reason.
- */
- sybase_ptr->dead = 1;
- RETURN_FALSE;
- }
-
- if (ct_send(sybase_ptr->cmd)!=CS_SUCCEED) {
- ct_cancel(NULL, sybase_ptr->cmd, CS_CANCEL_ALL);
- sybase_ptr->dead = 1;
- RETURN_FALSE;
- }
-
- /* Use the first result set or succeed/fail status and discard the
- * others. Applications really shouldn't be making calls that
- * return multiple result sets, but if they do then we need to
- * properly read or cancel them or the connection will become
- * unusable.
- */
- if (ct_results(sybase_ptr->cmd, &restype)!=CS_SUCCEED) {
- ct_cancel(NULL, sybase_ptr->cmd, CS_CANCEL_ALL);
- sybase_ptr->dead = 1;
- RETURN_FALSE;
- }
-
- switch ((int) restype) {
- case CS_CMD_FAIL:
- default:
- status = Q_FAILURE;
- break;
- case CS_CMD_SUCCEED:
- case CS_CMD_DONE: {
- CS_INT row_count;
- if (ct_res_info(sybase_ptr->cmd, CS_ROW_COUNT, &row_count, CS_UNUSED, NULL)==CS_SUCCEED) {
- sybase_ptr->affected_rows = (long)row_count;
- }
- }
- /* Fall through */
- case CS_COMPUTEFMT_RESULT:
- case CS_ROWFMT_RESULT:
- case CS_DESCRIBE_RESULT:
- case CS_MSG_RESULT:
- status = Q_SUCCESS;
- break;
- case CS_COMPUTE_RESULT:
- case CS_CURSOR_RESULT:
- case CS_PARAM_RESULT:
- case CS_ROW_RESULT:
- case CS_STATUS_RESULT:
- result = php_sybase_fetch_result_set(sybase_ptr);
- if (result == NULL) {
- ct_cancel(NULL, sybase_ptr->cmd, CS_CANCEL_ALL);
- sybase_ptr->dead = 1;
- RETURN_FALSE;
- }
- status = Q_RESULT;
- break;
- }
-
- /* The only restype we should get now is CS_CMD_DONE, possibly
- * followed by a CS_STATUS_RESULT/CS_CMD_SUCCEED/CS_CMD_DONE
- * sequence if the command was a stored procedure call. But we
- * still need to read and discard unexpected results. We might
- * want to return a failure in this case because the application
- * won't be getting all the results it asked for.
- */
- while ((retcode = ct_results(sybase_ptr->cmd, &restype))==CS_SUCCEED) {
- switch ((int) restype) {
- case CS_CMD_SUCCEED:
- case CS_CMD_DONE:
- break;
-
- case CS_CMD_FAIL:
- status = Q_FAILURE;
- break;
-
- case CS_COMPUTE_RESULT:
- case CS_CURSOR_RESULT:
- case CS_PARAM_RESULT:
- case CS_ROW_RESULT:
- /* Unexpected results, cancel them. */
- case CS_STATUS_RESULT:
- ct_cancel(NULL, sybase_ptr->cmd, CS_CANCEL_CURRENT);
- break;
-
- default:
- status = Q_FAILURE;
- break;
- }
- if (status == Q_FAILURE) {
- ct_cancel(NULL, sybase_ptr->cmd, CS_CANCEL_ALL);
- }
- }
-
- switch (retcode) {
- case CS_END_RESULTS:
- /* Normal. */
- break;
-
- case CS_FAIL:
- /* Hopefully this either cleans up the connection, or the
- * connection ends up marked dead so it will be reopened
- * if it is persistent. We may want to do
- * ct_close(CS_FORCE_CLOSE) if ct_cancel() fails; see the
- * doc for ct_results()==CS_FAIL.
- */
- ct_cancel(NULL, sybase_ptr->cmd, CS_CANCEL_ALL);
- /* Don't take chances with the vagaries of ct-lib. Mark it
- * dead ourselves.
- */
- sybase_ptr->dead = 1;
- case CS_CANCELED:
- default:
- status = Q_FAILURE;
- break;
- }
-
- /* If query completed without deadlock, break out of the loop.
- * Sometimes deadlock results in failures and sometimes not,
- * it seems to depend on the server flavor. But we want to
- * retry all deadlocks.
- */
- if (sybase_ptr->dead || sybase_ptr->deadlock == 0) {
- break;
- }
-
- /* Get rid of any results we may have fetched. This happens:
- * e.g., our result set may be a stored procedure status which
- * is returned even if the stored procedure deadlocks. As an
- * optimization, we could try not to fetch results in known
- * deadlock conditions, but deadlock is (should be) rare.
- */
- if (result != NULL) {
- _free_sybase_result(result);
- }
- }
-
- if (status == Q_SUCCESS) {
- RETURN_TRUE;
- }
-
- if (status == Q_FAILURE) {
- if (result != NULL) {
- _free_sybase_result(result);
- }
- RETURN_FALSE;
- }
-
- ZEND_REGISTER_RESOURCE(return_value, result, le_result);
-}
-
-/* }}} */
-
-/* {{{ proto bool sybase_free_result(int result)
- Free result memory */
-PHP_FUNCTION(sybase_free_result)
-{
- pval *sybase_result_index;
- sybase_result *result;
- SybCtLS_FETCH();
-
- if (ZEND_NUM_ARGS()!=1 || getParameters(ht, 1, &sybase_result_index)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if (sybase_result_index->type==IS_RESOURCE
- && sybase_result_index->value.lval==0) {
- RETURN_FALSE;
- }
-
- ZEND_FETCH_RESOURCE(result, sybase_result *, &sybase_result_index, -1, "Sybase result", le_result);
-
- zend_list_delete(sybase_result_index->value.lval);
- RETURN_TRUE;
-}
-
-/* }}} */
-
-/* {{{ proto string sybase_get_last_message(void)
- Returns the last message from server (over min_message_severity) */
-PHP_FUNCTION(sybase_get_last_message)
-{
- SybCtLS_FETCH();
-
- RETURN_STRING(SybCtG(server_message),1);
-}
-/* }}} */
-
-/* {{{ proto int sybase_num_rows(int result)
- Get number of rows in result */
-PHP_FUNCTION(sybase_num_rows)
-{
- pval *sybase_result_index;
- sybase_result *result;
- SybCtLS_FETCH();
-
- if (ZEND_NUM_ARGS()!=1 || getParameters(ht, 1, &sybase_result_index)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(result, sybase_result *, &sybase_result_index, -1, "Sybase result", le_result);
-
- return_value->value.lval = result->num_rows;
- return_value->type = IS_LONG;
-}
-
-/* }}} */
-
-/* {{{ proto int sybase_num_fields(int result)
- Get number of fields in result */
-PHP_FUNCTION(sybase_num_fields)
-{
- pval *sybase_result_index;
- sybase_result *result;
- SybCtLS_FETCH();
-
- if (ZEND_NUM_ARGS()!=1 || getParameters(ht, 1, &sybase_result_index)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(result, sybase_result *, &sybase_result_index, -1, "Sybase result", le_result);
-
- return_value->value.lval = result->num_fields;
- return_value->type = IS_LONG;
-}
-
-/* }}} */
-
-/* {{{ proto array sybase_fetch_row(int result)
- Get row as enumerated array */
-PHP_FUNCTION(sybase_fetch_row)
-{
- pval *sybase_result_index;
- int i;
- sybase_result *result;
- pval *field_content;
- SybCtLS_FETCH();
-
- if (ZEND_NUM_ARGS()!=1 || getParameters(ht, 1, &sybase_result_index)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(result, sybase_result *, &sybase_result_index, -1, "Sybase result", le_result);
-
- if (result->cur_row >= result->num_rows) {
- RETURN_FALSE;
- }
-
- array_init(return_value);
- for (i=0; i<result->num_fields; i++) {
- ALLOC_ZVAL(field_content);
- *field_content = result->data[result->cur_row][i];
- INIT_PZVAL(field_content);
- pval_copy_constructor(field_content);
- zend_hash_index_update(return_value->value.ht, i, (void *) &field_content, sizeof(pval* ), NULL);
- }
- result->cur_row++;
-}
-
-/* }}} */
-
-static void php_sybase_fetch_hash(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *sybase_result_index;
- sybase_result *result;
- int i;
- pval *tmp;
- PLS_FETCH();
- SybCtLS_FETCH();
-
- if (ZEND_NUM_ARGS()!=1 || getParameters(ht, 1, &sybase_result_index)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(result, sybase_result *, &sybase_result_index, -1, "Sybase result", le_result);
-
- if (result->cur_row >= result->num_rows) {
- RETURN_FALSE;
- }
-
- if (array_init(return_value)==FAILURE) {
- RETURN_FALSE;
- }
-
- for (i=0; i<result->num_fields; i++) {
- ALLOC_ZVAL(tmp);
- *tmp = result->data[result->cur_row][i];
- INIT_PZVAL(tmp);
- if (PG(magic_quotes_runtime) && tmp->type == IS_STRING) {
- tmp->value.str.val = php_addslashes(tmp->value.str.val, tmp->value.str.len, &tmp->value.str.len, 0);
- } else {
- pval_copy_constructor(tmp);
- }
- zend_hash_index_update(return_value->value.ht, i, (void *) &tmp, sizeof(pval *), NULL);
- tmp->refcount++;
- zend_hash_update(return_value->value.ht, result->fields[i].name, strlen(result->fields[i].name)+1, (void *) &tmp, sizeof(pval *), NULL);
- }
- result->cur_row++;
-}
-
-
-/* {{{ proto object sybase_fetch_object(int result)
- Fetch row as object */
-PHP_FUNCTION(sybase_fetch_object)
-{
- php_sybase_fetch_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU);
- if (return_value->type==IS_ARRAY) {
- return_value->type=IS_OBJECT;
- return_value->value.obj.properties = return_value->value.ht;
- return_value->value.obj.ce = &zend_standard_class_def;
- }
-}
-/* }}} */
-
-/* {{{ proto array sybase_fetch_array(int result)
- Fetch row as array */
-PHP_FUNCTION(sybase_fetch_array)
-{
- php_sybase_fetch_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU);
-}
-/* }}} */
-
-/* {{{ proto bool sybase_data_seek(int result, int offset)
- Move internal row pointer */
-PHP_FUNCTION(sybase_data_seek)
-{
- pval *sybase_result_index,*offset;
- sybase_result *result;
- SybCtLS_FETCH();
-
- if (ZEND_NUM_ARGS()!=2 || getParameters(ht, 2, &sybase_result_index, &offset)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
-
- ZEND_FETCH_RESOURCE(result, sybase_result *, &sybase_result_index, -1, "Sybase result", le_result);
-
- convert_to_long(offset);
- if (offset->value.lval<0 || offset->value.lval>=result->num_rows) {
- php_error(E_WARNING, "Sybase: Bad row offset");
- RETURN_FALSE;
- }
-
- result->cur_row = offset->value.lval;
- RETURN_TRUE;
-}
-/* }}} */
-
-static char *php_sybase_get_field_name(CS_INT type)
-{
- switch (type) {
- case CS_CHAR_TYPE:
- case CS_VARCHAR_TYPE:
- case CS_TEXT_TYPE:
- return "string";
- break;
- case CS_IMAGE_TYPE:
- return "image";
- break;
- case CS_BINARY_TYPE:
- case CS_VARBINARY_TYPE:
- return "blob";
- break;
- case CS_BIT_TYPE:
- return "bit";
- break;
- case CS_TINYINT_TYPE:
- case CS_SMALLINT_TYPE:
- case CS_INT_TYPE:
- return "int";
- break;
- case CS_REAL_TYPE:
- case CS_FLOAT_TYPE:
- case CS_NUMERIC_TYPE:
- case CS_DECIMAL_TYPE:
- return "real";
- break;
- case CS_MONEY_TYPE:
- case CS_MONEY4_TYPE:
- return "money";
- break;
- case CS_DATETIME_TYPE:
- case CS_DATETIME4_TYPE:
- return "datetime";
- break;
- default:
- return "unknown";
- break;
- }
-}
-
-
-/* {{{ proto object sybase_fetch_field(int result [, int offset])
- Get field information */
-PHP_FUNCTION(sybase_fetch_field)
-{
- pval *sybase_result_index,*offset;
- int field_offset;
- sybase_result *result;
- SybCtLS_FETCH();
-
- switch (ZEND_NUM_ARGS()) {
- case 1:
- if (getParameters(ht, 1, &sybase_result_index)==FAILURE) {
- RETURN_FALSE;
- }
- field_offset=-1;
- break;
- case 2:
- if (getParameters(ht, 2, &sybase_result_index, &offset)==FAILURE) {
- RETURN_FALSE;
- }
- convert_to_long(offset);
- field_offset = offset->value.lval;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- ZEND_FETCH_RESOURCE(result, sybase_result *, &sybase_result_index, -1, "Sybase result", le_result);
-
- if (field_offset==-1) {
- field_offset = result->cur_field;
- result->cur_field++;
- }
-
- if (field_offset<0 || field_offset >= result->num_fields) {
- if (ZEND_NUM_ARGS()==2) { /* field specified explicitly */
- php_error(E_WARNING, "Sybase: Bad column offset");
- }
- RETURN_FALSE;
- }
-
- if (object_init(return_value)==FAILURE) {
- RETURN_FALSE;
- }
- add_property_string(return_value, "name", result->fields[field_offset].name, 1);
- add_property_long(return_value, "max_length", result->fields[field_offset].max_length);
- add_property_string(return_value, "column_source", result->fields[field_offset].column_source, 1);
- add_property_long(return_value, "numeric", result->fields[field_offset].numeric);
- add_property_string(return_value, "type", php_sybase_get_field_name(result->fields[field_offset].type), 1);
-}
-/* }}} */
-
-
-/* {{{ proto bool sybase_field_seek(int result, int offset)
- Set field offset */
-PHP_FUNCTION(sybase_field_seek)
-{
- pval *sybase_result_index,*offset;
- int field_offset;
- sybase_result *result;
- SybCtLS_FETCH();
-
- if (ZEND_NUM_ARGS()!=2 || getParameters(ht, 2, &sybase_result_index, &offset)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(result, sybase_result *, &sybase_result_index, -1, "Sybase result", le_result);
-
- convert_to_long(offset);
- field_offset = offset->value.lval;
-
- if (field_offset<0 || field_offset >= result->num_fields) {
- php_error(E_WARNING, "Sybase: Bad column offset");
- RETURN_FALSE;
- }
-
- result->cur_field = field_offset;
- RETURN_TRUE;
-}
-/* }}} */
-
-
-/* {{{ proto string sybase_result(int result, int row, mixed field)
- Get result data */
-PHP_FUNCTION(sybase_result)
-{
- pval *row, *field, *sybase_result_index;
- int field_offset=0;
- sybase_result *result;
- SybCtLS_FETCH();
-
- if (ZEND_NUM_ARGS()!=3 || getParameters(ht, 3, &sybase_result_index, &row, &field)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
-
- ZEND_FETCH_RESOURCE(result, sybase_result *, &sybase_result_index, -1, "Sybase result", le_result);
-
- convert_to_long(row);
- if (row->value.lval<0 || row->value.lval>=result->num_rows) {
- php_error(E_WARNING, "Sybase: Bad row offset (%d)", row->value.lval);
- RETURN_FALSE;
- }
-
- switch(field->type) {
- case IS_STRING: {
- int i;
-
- for (i=0; i<result->num_fields; i++) {
- if (!strcasecmp(result->fields[i].name, field->value.str.val)) {
- field_offset = i;
- break;
- }
- }
- if (i>=result->num_fields) { /* no match found */
- php_error(E_WARNING, "Sybase: %s field not found in result", field->value.str.val);
- RETURN_FALSE;
- }
- break;
- }
- default:
- convert_to_long(field);
- field_offset = field->value.lval;
- if (field_offset<0 || field_offset>=result->num_fields) {
- php_error(E_WARNING, "Sybase: Bad column offset specified");
- RETURN_FALSE;
- }
- break;
- }
-
- *return_value = result->data[row->value.lval][field_offset];
- pval_copy_constructor(return_value);
-}
-/* }}} */
-
-
-/* {{{ proto int sybase_affected_rows([int link_id])
- Get number of affected rows in last query */
-PHP_FUNCTION(sybase_affected_rows)
-{
- pval *sybase_link_index;
- sybase_link *sybase_ptr;
- int id;
- SybCtLS_FETCH();
-
- switch(ZEND_NUM_ARGS()) {
- case 0:
- id = php_sybase_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU);
- break;
- case 1:
- if (getParameters(ht, 1, &sybase_link_index)==FAILURE) {
- RETURN_FALSE;
- }
- id = -1;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- ZEND_FETCH_RESOURCE2(sybase_ptr, sybase_link *, &sybase_link_index, id, "Sybase-Link", le_link, le_plink);
-
- return_value->value.lval = sybase_ptr->affected_rows;
- return_value->type = IS_LONG;
-}
-/* }}} */
-
-
-PHP_MINFO_FUNCTION(sybase)
-{
- char buf[32];
- SybCtLS_FETCH();
-
- php_info_print_table_start();
- php_info_print_table_row(2, "Sybase_CT Support", "enabled" );
- sprintf(buf, "%ld", SybCtG(num_persistent));
- php_info_print_table_row(2, "Active Persistent Links", buf);
- sprintf(buf, "%ld", SybCtG(num_links));
- php_info_print_table_row(2, "Active Links", buf);
- php_info_print_table_row(2, "Application Name", SybCtG(appname));
- php_info_print_table_end();
-
- DISPLAY_INI_ENTRIES();
-}
-
-
-/* {{{ proto void sybase_min_client_severity(int severity)
- Sets minimum client severity */
-PHP_FUNCTION(sybase_min_client_severity)
-{
- pval *severity;
- SybCtLS_FETCH();
-
- if (ZEND_NUM_ARGS()!=1 || getParameters(ht, 1, &severity)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long(severity);
- SybCtG(min_client_severity) = severity->value.lval;
-}
-/* }}} */
-
-
-/* {{{ proto void sybase_min_server_severity(int severity)
- Sets minimum server severity */
-PHP_FUNCTION(sybase_min_server_severity)
-{
- pval *severity;
- SybCtLS_FETCH();
-
- if (ZEND_NUM_ARGS()!=1 || getParameters(ht, 1, &severity)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long(severity);
- SybCtG(min_server_severity) = severity->value.lval;
-}
-/* }}} */
-
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/sybase_ct/php_sybase_ct.h b/ext/sybase_ct/php_sybase_ct.h
deleted file mode 100644
index 8d7a56c15f..0000000000
--- a/ext/sybase_ct/php_sybase_ct.h
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef PHP_SYBASE_CT_H
-#define PHP_SYBASE_CT_H
-
-#if HAVE_SYBASE_CT
-
-#define CTLIB_VERSION CS_VERSION_100
-
-extern zend_module_entry sybase_module_entry;
-#define sybase_module_ptr &sybase_module_entry
-
-PHP_MINIT_FUNCTION(sybase);
-PHP_MSHUTDOWN_FUNCTION(sybase);
-PHP_RINIT_FUNCTION(sybase);
-PHP_RSHUTDOWN_FUNCTION(sybase);
-PHP_MINFO_FUNCTION(sybase);
-
-PHP_FUNCTION(sybase_connect);
-PHP_FUNCTION(sybase_pconnect);
-PHP_FUNCTION(sybase_close);
-PHP_FUNCTION(sybase_select_db);
-PHP_FUNCTION(sybase_query);
-PHP_FUNCTION(sybase_free_result);
-PHP_FUNCTION(sybase_get_last_message);
-PHP_FUNCTION(sybase_num_rows);
-PHP_FUNCTION(sybase_num_fields);
-PHP_FUNCTION(sybase_fetch_row);
-PHP_FUNCTION(sybase_fetch_array);
-PHP_FUNCTION(sybase_fetch_object);
-PHP_FUNCTION(sybase_data_seek);
-PHP_FUNCTION(sybase_result);
-PHP_FUNCTION(sybase_affected_rows);
-PHP_FUNCTION(sybase_field_seek);
-PHP_FUNCTION(sybase_min_client_severity);
-PHP_FUNCTION(sybase_min_server_severity);
-PHP_FUNCTION(sybase_fetch_field);
-
-
-#include <ctpublic.h>
-
-ZEND_BEGIN_MODULE_GLOBALS(sybase)
- long default_link;
- long num_links,num_persistent;
- long max_links,max_persistent;
- long allow_persistent;
- char *appname;
- char *hostname;
- char *server_message;
- long min_server_severity, min_client_severity;
- CS_CONTEXT *context;
-ZEND_END_MODULE_GLOBALS(sybase)
-
-typedef struct {
- CS_CONNECTION *connection;
- CS_COMMAND *cmd;
- int valid;
- int deadlock;
- int dead;
- long affected_rows;
-} sybase_link;
-
-#define SYBASE_ROWS_BLOCK 128
-
-typedef struct {
- char *name,*column_source;
- int max_length, numeric;
- CS_INT type;
-} sybase_field;
-
-typedef struct {
- pval **data;
- sybase_field *fields;
- sybase_link *sybase_ptr;
- int cur_row,cur_field;
- int num_rows,num_fields;
-} sybase_result;
-
-
-#ifdef ZTS
-# define SybCtLS_D zend_sybase_globals *sybase_globals
-# define SybCtLS_DC , SybCtLS_D
-# define SybCtLS_C sybase_globals
-# define SybCtLS_CC , SybCtLS_C
-# define SybCtG(v) (sybase_globals->v)
-# define SybCtLS_FETCH() zend_sybase_globals *sybase_globals = ts_resource(sybase_globals_id)
-#else
-# define SybCtLS_D
-# define SybCtLS_DC
-# define SybCtLS_C
-# define SybCtLS_CC
-# define SybCtG(v) (sybase_globals.v)
-# define SybCtLS_FETCH()
-#endif
-
-#else
-
-#define sybase_module_ptr NULL
-
-#endif
-
-#define phpext_sybase_ct_ptr sybase_module_ptr
-
-#endif /* PHP_SYBASE_CT_H */
diff --git a/ext/sybase_ct/setup.stub b/ext/sybase_ct/setup.stub
deleted file mode 100644
index 8d549cdd29..0000000000
--- a/ext/sybase_ct/setup.stub
+++ /dev/null
@@ -1,6 +0,0 @@
-# $Source$
-# $Id$
-
-define_option with-sybase-ct 'Sybase-CT support?' yesnodir \
- 'no /home/sybase Sybase-CT install' \
-' Whether to build PHP with Sybase-CT support.'
diff --git a/ext/sybase_ct/sybase_ct.dsp b/ext/sybase_ct/sybase_ct.dsp
deleted file mode 100644
index f1a1abf4d1..0000000000
--- a/ext/sybase_ct/sybase_ct.dsp
+++ /dev/null
@@ -1,114 +0,0 @@
-# Microsoft Developer Studio Project File - Name="sybase_ct" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=sybase_ct - Win32 Release_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "sybase_ct.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "sybase_ct.mak" CFG="sybase_ct - Win32 Release_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "sybase_ct - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "sybase_ct - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "sybase_ct - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\..\Zend" /I "..\..\..\TSRM" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SYBASE_CT_EXPORTS" /D "COMPILE_DL_SYBASE_CT" /D ZTS=1 /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\main" /D "WIN32" /D "SYBASE_CT_EXPORTS" /D "COMPILE_DL_SYBASE_CT" /D HAVE_SYBASE_CT=1 /D ZTS=1 /D ZEND_DEBUG=0 /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZEND_WIN32" /D "PHP_WIN32" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x406 /d "NDEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib /nologo /dll /machine:I386
-# ADD LINK32 php4ts.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libct.lib libcs.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_sybase_ct.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
-# SUBTRACT LINK32 /pdb:none
-
-!ELSEIF "$(CFG)" == "sybase_ct - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SYBASE_CT_EXPORTS" /D "COMPILE_DL_SYBASE_CT" /D ZTS=1 /YX /FD /c
-# ADD CPP /nologo /MDd /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\main" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SYBASE_CT_EXPORTS" /D "COMPILE_DL_SYBASE_CT" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_SYBASE_CT=1 /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x406 /d "NDEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts_debug.lib /nologo /dll /machine:I386
-# ADD LINK32 php4ts_debug.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\Debug_TS/php_sybase_ct.dll" /libpath:"..\..\Debug_TS"
-
-!ENDIF
-
-# Begin Target
-
-# Name "sybase_ct - Win32 Release_TS"
-# Name "sybase_ct - Win32 Debug_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\php_sybase_ct.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_sybase_ct.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/ext/sysvsem/CREDITS b/ext/sysvsem/CREDITS
deleted file mode 100644
index 45232809f0..0000000000
--- a/ext/sysvsem/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-System V Semaphores
-Tom May
diff --git a/ext/sysvsem/Makefile.in b/ext/sysvsem/Makefile.in
deleted file mode 100644
index e5578288d7..0000000000
--- a/ext/sysvsem/Makefile.in
+++ /dev/null
@@ -1,6 +0,0 @@
-
-LTLIBRARY_NAME = libsysvsem.la
-LTLIBRARY_SOURCES = sysvsem.c
-LTLIBRARY_SHARED_NAME = sysvsem.la
-
-include $(top_srcdir)/build/dynlib.mk
diff --git a/ext/sysvsem/config.m4 b/ext/sysvsem/config.m4
deleted file mode 100644
index 48ebc3f31d..0000000000
--- a/ext/sysvsem/config.m4
+++ /dev/null
@@ -1,27 +0,0 @@
-dnl $Id$
-
-PHP_ARG_ENABLE(sysvsem,whether to enable System V semaphore support,
-[ --enable-sysvsem Enable System V semaphore support.])
-
-if test "$PHP_SYSVSEM" != "no"; then
- PHP_EXTENSION(sysvsem, $ext_shared)
- AC_DEFINE(HAVE_SYSVSEM, 1, [ ])
- AC_CACHE_CHECK(for union semun,php_cv_semun,
- AC_TRY_COMPILE([
-#include <sys/types.h>
-#include <sys/ipc.h>
-#include <sys/sem.h>
- ],
- [union semun x;],
- [
- php_cv_semun=yes
- ],[
- php_cv_semun=no
- ])
- )
- if test "$php_cv_semun" = "yes"; then
- AC_DEFINE(HAVE_SEMUN, 1, [ ])
- else
- AC_DEFINE(HAVE_SEMUN, 0, [ ])
- fi
-fi
diff --git a/ext/sysvsem/php_sysvsem.h b/ext/sysvsem/php_sysvsem.h
deleted file mode 100644
index 089e9797d1..0000000000
--- a/ext/sysvsem/php_sysvsem.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Tom May <tom@go2net.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef PHP_SYSVSEM_H
-#define PHP_SYSVSEM_H
-
-#if HAVE_SYSVSEM
-
-extern zend_module_entry sysvsem_module_entry;
-#define sysvsem_module_ptr &sysvsem_module_entry
-
-PHP_MINIT_FUNCTION(sysvsem);
-PHP_FUNCTION(sem_get);
-PHP_FUNCTION(sem_acquire);
-PHP_FUNCTION(sem_release);
-PHP_FUNCTION(sem_remove);
-
-typedef struct {
- int le_sem;
-} sysvsem_module;
-
-typedef struct {
- int id; /* For error reporting. */
- int key; /* For error reporting. */
- int semid; /* Returned by semget(). */
- int count; /* Acquire count for auto-release. */
-} sysvsem_sem;
-
-extern sysvsem_module php_sysvsem_module;
-
-#else
-
-#define sysvsem_module_ptr NULL
-
-#endif
-
-#define phpext_sysvsem_ptr sysvsem_module_ptr
-
-#endif /* PHP_SYSVSEM_H */
diff --git a/ext/sysvsem/setup.stub b/ext/sysvsem/setup.stub
deleted file mode 100644
index cad1279592..0000000000
--- a/ext/sysvsem/setup.stub
+++ /dev/null
@@ -1,5 +0,0 @@
-# $Source$
-# $Id$
-
-define_option enable-sysvsem 'System V semaphores support? ' yesno no \
-' Whether to use the System V semaphores (currently only solaris and linux).'
diff --git a/ext/sysvsem/sysvsem.c b/ext/sysvsem/sysvsem.c
deleted file mode 100644
index 5cfb0b37db..0000000000
--- a/ext/sysvsem/sysvsem.c
+++ /dev/null
@@ -1,438 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Tom May <tom@go2net.com> |
- | Gavin Sherry <gavin@linuxworld.com.au> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-/* Latest update build anc tested on Linux 2.2.14
- *
- * This has been built and tested on Solaris 2.6 and Linux 2.1.122.
- * It may not compile or execute correctly on other systems.
- *
- * sas: Works for me on Linux 2.0.36 and FreeBSD 3.0-current
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-
-#if HAVE_SYSVSEM
-
-#include <sys/types.h>
-#include <sys/ipc.h>
-#include <sys/sem.h>
-#include <errno.h>
-
-#include "php_sysvsem.h"
-
-#if !HAVE_SEMUN
-
-union semun {
- int val; /* value for SETVAL */
- struct semid_ds *buf; /* buffer for IPC_STAT, IPC_SET */
- unsigned short int *array; /* array for GETALL, SETALL */
- struct seminfo *__buf; /* buffer for IPC_INFO */
-};
-
-#undef HAVE_SEMUN
-#define HAVE_SEMUN 1
-
-#endif
-
-/* {{{ sysvsem_functions[]
- */
-function_entry sysvsem_functions[] = {
- PHP_FE(sem_get, NULL)
- PHP_FE(sem_acquire, NULL)
- PHP_FE(sem_release, NULL)
- PHP_FE(sem_remove, NULL)
- {NULL, NULL, NULL}
-};
-/* }}} */
-
-/* {{{ sysvsem_module_entry
- */
-zend_module_entry sysvsem_module_entry = {
- "sysvsem", sysvsem_functions, PHP_MINIT(sysvsem), NULL, NULL, NULL, NULL, STANDARD_MODULE_PROPERTIES
-};
-/* }}} */
-
-#ifdef COMPILE_DL_SYSVSEM
-ZEND_GET_MODULE(sysvsem)
-#endif
-
-
-THREAD_LS sysvsem_module php_sysvsem_module;
-
-/* Semaphore functions using System V semaphores. Each semaphore
- * actually consists of three semaphores allocated as a unit under the
- * same key. Semaphore 0 (SYSVSEM_SEM) is the actual semaphore, it is
- * initialized to max_acquire and decremented as processes acquire it.
- * The value of semaphore 1 (SYSVSEM_USAGE) is a count of the number
- * of processes using the semaphore. After calling semget(), if a
- * process finds that the usage count is 1, it will set the value of
- * SYSVSEM_SEM to max_acquire. This allows max_acquire to be set and
- * track the PHP code without having a global init routine or external
- * semaphore init code. Except see the bug regarding a race condition
- * php_sysvsem_get(). Semaphore 2 (SYSVSEM_SETVAL) serializes the
- * calls to GETVAL SYSVSEM_USAGE and SETVAL SYSVSEM_SEM. It can be
- * acquired only when it is zero.
- */
-
-#define SYSVSEM_SEM 0
-#define SYSVSEM_USAGE 1
-#define SYSVSEM_SETVAL 2
-
-/* {{{ release_sysvsem_sem
- */
-static void release_sysvsem_sem(zend_rsrc_list_entry *rsrc)
-{
- sysvsem_sem *sem_ptr = (sysvsem_sem *)rsrc->ptr;
- struct sembuf sop[2];
-
-/*
- * if count == -1, semaphore has been removed
- * Need better way to handle this
- */
-
- if(sem_ptr->count == -1) {
- return;
- }
- /* Decrement the usage count. */
-
- sop[0].sem_num = SYSVSEM_USAGE;
- sop[0].sem_op = -1;
- sop[0].sem_flg = SEM_UNDO;
-
- /* Release the semaphore if it has been acquired but not released. */
-
- if (sem_ptr->count) {
- php_error(E_WARNING, "Releasing SysV semaphore id %d key 0x%x in request cleanup", sem_ptr->id, sem_ptr->key);
-
- sop[1].sem_num = SYSVSEM_SEM;
- sop[1].sem_op = sem_ptr->count;
- sop[1].sem_flg = SEM_UNDO;
- }
- if (semop(sem_ptr->semid, sop, sem_ptr->count ? 2 : 1) == -1) {
- php_error(E_WARNING, "semop() failed in release_sysvsem_sem for key 0x%x: %s", sem_ptr->key, strerror(errno));
- }
-
- efree(sem_ptr);
-}
-/* }}} */
-
-/* {{{ PHP_MINIT_FUNCTION
- */
-PHP_MINIT_FUNCTION(sysvsem)
-{
- php_sysvsem_module.le_sem = zend_register_list_destructors_ex(release_sysvsem_sem, NULL, "sysvsem", module_number);
-
- return SUCCESS;
-}
-/* }}} */
-
-#define SETVAL_WANTS_PTR
-
-#if defined(_AIX)
-#undef SETVAL_WANTS_PTR
-#endif
-
-/* {{{ proto int sem_get(int key [, int max_acquire [, int perm]])
- Return an id for the semaphore with the given key, and allow max_acquire (default 1) processes to acquire it simultaneously */
-PHP_FUNCTION(sem_get)
-{
- pval **arg_key, **arg_max_acquire, **arg_perm;
- int key, max_acquire, perm;
- int semid;
- struct sembuf sop[3];
- int count;
- sysvsem_sem *sem_ptr;
-#if HAVE_SEMUN
- union semun un;
-#endif
-
- max_acquire = 1;
- perm = 0666;
-
- switch (ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &arg_key)==FAILURE) {
- RETURN_FALSE;
- }
- convert_to_long_ex(arg_key);
- key = (int)(*arg_key)->value.lval;
- break;
- case 2:
- if (zend_get_parameters_ex(2, &arg_key, &arg_max_acquire)==FAILURE) {
- RETURN_FALSE;
- }
- convert_to_long_ex(arg_key);
- key = (int)(*arg_key)->value.lval;
- convert_to_long_ex(arg_max_acquire);
- max_acquire = (int)(*arg_max_acquire)->value.lval;
- break;
- case 3:
- if (zend_get_parameters_ex(3, &arg_key, &arg_max_acquire, &arg_perm)==FAILURE) {
- RETURN_FALSE;
- }
- convert_to_long_ex(arg_key);
- convert_to_long_ex(arg_max_acquire);
- convert_to_long_ex(arg_perm);
- key = (int)(*arg_key)->value.lval;
- max_acquire = (int)(*arg_max_acquire)->value.lval;
- perm = (int)(*arg_perm)->value.lval;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- /* Get/create the semaphore. Note that we rely on the semaphores
- * being zeroed when they are created. Despite the fact that
- * the(?) Linux semget() man page says they are not initialized,
- * the kernel versions 2.0.x and 2.1.z do in fact zero them.
- */
-
- semid = semget(key, 3, perm|IPC_CREAT);
- if (semid == -1) {
- php_error(E_WARNING, "semget() failed for key 0x%x: %s", key, strerror(errno));
- RETURN_FALSE;
- }
-
- /* Find out how many processes are using this semaphore. Note
- * that on Linux (at least) there is a race condition here because
- * semaphore undo on process exit is not atomic, so we could
- * acquire SYSVSEM_SETVAL before a crashed process has decremented
- * SYSVSEM_USAGE in which case count will be greater than it
- * should be and we won't set max_acquire. Fortunately this
- * doesn't actually matter in practice.
- */
-
- /* Wait for sem 1 to be zero . . . */
-
- sop[0].sem_num = SYSVSEM_SETVAL;
- sop[0].sem_op = 0;
- sop[0].sem_flg = 0;
-
- /* . . . and increment it so it becomes non-zero . . . */
-
- sop[1].sem_num = SYSVSEM_SETVAL;
- sop[1].sem_op = 1;
- sop[1].sem_flg = SEM_UNDO;
-
- /* . . . and increment the usage count. */
-
- sop[2].sem_num = SYSVSEM_USAGE;
- sop[2].sem_op = 1;
- sop[2].sem_flg = SEM_UNDO;
- while (semop(semid, sop, 3) == -1) {
- if (errno != EINTR) {
- php_error(E_WARNING, "semop() failed acquiring SYSVSEM_SETVAL for key 0x%x: %s", key, strerror(errno));
- break;
- }
- }
-
- /* Get the usage count. */
-#if HAVE_SEMUN
- count = semctl(semid, SYSVSEM_USAGE, GETVAL, un);
-#else
- count = semctl(semid, SYSVSEM_USAGE, GETVAL, NULL);
-#endif
- if (count == -1) {
- php_error(E_WARNING, "semctl(GETVAL) failed for key 0x%x: %s", key, strerror(errno));
- }
-
- /* If we are the only user, then take this opportunity to set the max. */
-
- if (count == 1) {
-#if HAVE_SEMUN
- /* This is correct for Linux which has union semun. */
- union semun semarg;
- semarg.val = max_acquire;
- if (semctl(semid, SYSVSEM_SEM, SETVAL, semarg) == -1) {
- php_error(E_WARNING, "semctl(SETVAL) failed for key 0x%x: %s", key, strerror(errno));
- }
-#elif defined(SETVAL_WANTS_PTR)
- /* This is correct for Solaris 2.6 which does not have union semun. */
- if (semctl(semid, SYSVSEM_SEM, SETVAL, &max_acquire) == -1) {
- php_error(E_WARNING, "semctl(SETVAL) failed for key 0x%x: %s", key, strerror(errno));
- }
-#else
- /* This works for i.e. AIX */
- if (semctl(semid, SYSVSEM_SEM, SETVAL, max_acquire) == -1) {
- php_error(E_WARNING, "semctl(SETVAL) failed for key 0x%x: %s", key, strerror(errno));
- }
-#endif
- }
-
- /* Set semaphore 1 back to zero. */
-
- sop[0].sem_num = SYSVSEM_SETVAL;
- sop[0].sem_op = -1;
- sop[0].sem_flg = SEM_UNDO;
- while (semop(semid, sop, 1) == -1) {
- if (errno != EINTR) {
- php_error(E_WARNING, "semop() failed releasing SYSVSEM_SETVAL for key 0x%x: %s", key, strerror(errno));
- break;
- }
- }
-
- sem_ptr = (sysvsem_sem *) emalloc(sizeof(sysvsem_sem));
- sem_ptr->key = key;
- sem_ptr->semid = semid;
- sem_ptr->count = 0;
-
- return_value->value.lval = zend_list_insert(sem_ptr, php_sysvsem_module.le_sem);
- return_value->type = IS_LONG;
-
- sem_ptr->id = (int)return_value->value.lval;
-}
-/* }}} */
-
-/* {{{ php_sysvsem_semop
- */
-static void php_sysvsem_semop(INTERNAL_FUNCTION_PARAMETERS, int acquire)
-{
- pval **arg_id;
- int id, type;
- sysvsem_sem *sem_ptr;
- struct sembuf sop;
-
- switch(ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &arg_id)==FAILURE) {
- RETURN_FALSE;
- }
- convert_to_long_ex(arg_id);
- id = (int)(*arg_id)->value.lval;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- sem_ptr = (sysvsem_sem *) zend_list_find(id, &type);
- if (type!=php_sysvsem_module.le_sem) {
- php_error(E_WARNING, "%d is not a SysV semaphore index", id);
- RETURN_FALSE;
- }
-
- if (!acquire && sem_ptr->count == 0) {
- php_error(E_WARNING, "SysV semaphore index %d (key 0x%x) is not currently acquired", id, sem_ptr->key);
- RETURN_FALSE;
- }
-
- sop.sem_num = SYSVSEM_SEM;
- sop.sem_op = acquire ? -1 : 1;
- sop.sem_flg = SEM_UNDO;
-
- while (semop(sem_ptr->semid, &sop, 1) == -1) {
- if (errno != EINTR) {
- php_error(E_WARNING, "semop(%s) failed for key 0x%x: %s",
- acquire ? "acquire" : "release", sem_ptr->key, strerror(errno));
- RETURN_FALSE;
- }
- }
-
- sem_ptr->count -= acquire ? -1 : 1;
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int sem_acquire(int id)
- Acquires the semaphore with the given id, blocking if necessary */
-PHP_FUNCTION(sem_acquire)
-{
- php_sysvsem_semop(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
-}
-/* }}} */
-
-/* {{{ proto int sem_release(int id)
- Releases the semaphore with the given id */
-PHP_FUNCTION(sem_release)
-{
- php_sysvsem_semop(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-/* }}} */
-
-/* {{{ proto int sem_remove(int id)
- Removes semaphore from Unix systems */
-
-/*
- * contributed by Gavin Sherry gavin@linuxworld.com.au
- * Fri Mar 16 00:50:13 EST 2001
- */
-
-PHP_FUNCTION(sem_remove)
-{
- pval **arg_id;
- int id,type;
- sysvsem_sem *sem_ptr;
-#if HAVE_SEMUN
- union semun un;
-#endif
- if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg_id) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(arg_id);
-
- id = (*arg_id)->value.lval;
-
- sem_ptr = (sysvsem_sem *) zend_list_find(id, &type);
-
- if (type!=php_sysvsem_module.le_sem) {
- php_error(E_WARNING, "%d is not a SysV semaphore index", id);
- RETURN_FALSE;
- }
-
-#if HAVE_SEMUN
- if(semctl(sem_ptr->semid,NULL,IPC_STAT,un)<0) {
-#else
- if(semctl(sem_ptr->semid,NULL,IPC_STAT,NULL)<0) {
-#endif
- php_error(E_WARNING, "%d is not a existing SysV Semaphore Id", id);
- RETURN_FALSE;
- }
-
- if(semctl(sem_ptr->semid,NULL,IPC_RMID,NULL)<0) {
- php_error(E_WARNING, "sem_remove() failed for id %d: %s", id, strerror(errno));
- RETURN_FALSE;
- }
-
- /* let release_sysvsem_sem know we have removed
- * the semaphore to avoid issues with releasing.
- */
-
- sem_ptr->count = -1;
- RETURN_TRUE;
-}
-
-/* }}} */
-
-#endif /* HAVE_SYSVSEM */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/sysvshm/CREDITS b/ext/sysvshm/CREDITS
deleted file mode 100644
index 65a30ceb0c..0000000000
--- a/ext/sysvshm/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-System V Shared Memory
-Christian Cartus
diff --git a/ext/sysvshm/Makefile.in b/ext/sysvshm/Makefile.in
deleted file mode 100644
index 9039ca6648..0000000000
--- a/ext/sysvshm/Makefile.in
+++ /dev/null
@@ -1,6 +0,0 @@
-
-LTLIBRARY_NAME = libsysvshm.la
-LTLIBRARY_SOURCES = sysvshm.c
-LTLIBRARY_SHARED_NAME = sysvshm.la
-
-include $(top_srcdir)/build/dynlib.mk
diff --git a/ext/sysvshm/config.m4 b/ext/sysvshm/config.m4
deleted file mode 100644
index 4d36ea474c..0000000000
--- a/ext/sysvshm/config.m4
+++ /dev/null
@@ -1,9 +0,0 @@
-dnl $Id$
-
-PHP_ARG_ENABLE(sysvshm,whether to enable System V shared memory support,
-[ --enable-sysvshm Enable the System V shared memory support])
-
-if test "$PHP_SYSVSHM" != "no"; then
- AC_DEFINE(HAVE_SYSVSHM, 1, [ ])
- PHP_EXTENSION(sysvshm, $ext_shared)
-fi
diff --git a/ext/sysvshm/php_sysvshm.h b/ext/sysvshm/php_sysvshm.h
deleted file mode 100644
index a8508ca81b..0000000000
--- a/ext/sysvshm/php_sysvshm.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Christian Cartus <cartus@atrior.de> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef PHP_SYSVSHM_H
-#define PHP_SYSVSHM_H
-
-#if HAVE_SYSVSHM
-
-extern zend_module_entry sysvshm_module_entry;
-#define sysvshm_module_ptr &sysvshm_module_entry
-
-#include <sys/types.h>
-#include <sys/ipc.h>
-#include <sys/shm.h>
-
-typedef struct {
- int le_shm;
- long init_mem;
-} sysvshm_module;
-
-
-typedef struct {
- long key;
- long length;
- long next;
- char mem;
-} sysvshm_chunk;
-
-
-typedef struct {
- char magic[8];
- long start;
- long end;
- long free;
- long total;
-} sysvshm_chunk_head;
-
-
-typedef struct {
- key_t key; /* Key set by user */
- long id; /* Returned by shmget. */
- sysvshm_chunk_head *ptr; /* memoryaddress of shared memory */
-} sysvshm_shm;
-
-
-
-PHP_MINIT_FUNCTION(sysvshm);
-PHP_FUNCTION(shm_attach);
-PHP_FUNCTION(shm_detach);
-PHP_FUNCTION(shm_remove);
-PHP_FUNCTION(shm_put_var);
-PHP_FUNCTION(shm_get_var);
-PHP_FUNCTION(shm_remove_var);
-extern int php_put_shm_data(sysvshm_chunk_head *ptr,long key,char *data, long len);
-extern long php_check_shm_data(sysvshm_chunk_head *ptr, long key);
-extern int php_remove_shm_data(sysvshm_chunk_head *ptr, long shm_varpos);
-
-extern sysvshm_module php_sysvshm;
-
-#else
-
-#define sysvshm_module_ptr NULL
-
-#endif
-
-#define phpext_sysvshm_ptr sysvshm_module_ptr
-
-#endif /* PHP_SYSVSHM_H */
diff --git a/ext/sysvshm/setup.stub b/ext/sysvshm/setup.stub
deleted file mode 100644
index 4a9e894b4e..0000000000
--- a/ext/sysvshm/setup.stub
+++ /dev/null
@@ -1,5 +0,0 @@
-# $Source$
-# $Id$
-
-define_option enable-sysvshm 'System V shared memory support? ' yesno no \
-' Whether to use the System V shared memory (currently only Solaris and Linux).'
diff --git a/ext/sysvshm/sysvshm.c b/ext/sysvshm/sysvshm.c
deleted file mode 100644
index 999d95ce0d..0000000000
--- a/ext/sysvshm/sysvshm.c
+++ /dev/null
@@ -1,427 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Christian Cartus <cartus@atrior.de> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-/* This has been built and tested on Linux 2.2.14
- *
- * This has been built and tested on Solaris 2.6.
- * It may not compile or execute correctly on other systems.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-
-#if HAVE_SYSVSHM
-
-#include <errno.h>
-
-#include "php_sysvshm.h"
-#include "../standard/php_var.h"
-
-/* {{{ sysvshm_functions[]
- */
-function_entry sysvshm_functions[] = {
- PHP_FE(shm_attach, NULL)
- PHP_FE(shm_remove, NULL)
- PHP_FE(shm_detach, NULL)
- PHP_FE(shm_put_var, NULL)
- PHP_FE(shm_get_var, NULL)
- PHP_FE(shm_remove_var, NULL)
- {0}
-};
-/* }}} */
-
-/* {{{ sysvshm_module_entry
- */
-zend_module_entry sysvshm_module_entry = {
- "sysvshm", sysvshm_functions,
- PHP_MINIT(sysvshm), NULL,
- NULL, NULL,
- NULL,
- STANDARD_MODULE_PROPERTIES
-};
-/* }}} */
-
-#ifdef COMPILE_DL_SYSVSHM
-ZEND_GET_MODULE(sysvshm)
-#endif
-
-#undef shm_ptr /* undefine AIX-specific macro */
-
-THREAD_LS sysvshm_module php_sysvshm;
-
-/* {{{ php_release_sysvshm
- */
-static void php_release_sysvshm(zend_rsrc_list_entry *rsrc)
-{
- sysvshm_shm *shm_ptr = (sysvshm_shm *)rsrc->ptr;
- shmdt((void*)shm_ptr->ptr);
- efree(shm_ptr);
-}
-/* }}} */
-
-/* {{{ PHP_MINIT_FUNCTION
- */
-PHP_MINIT_FUNCTION(sysvshm)
-{
- php_sysvshm.le_shm = zend_register_list_destructors_ex(php_release_sysvshm, NULL, "sysvshm", module_number);
- if (cfg_get_long("sysvshm.init_mem",
- &php_sysvshm.init_mem)==FAILURE) {
- php_sysvshm.init_mem=10000;
- }
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ proto int shm_attach(int key [, int memsize [, int perm]])
- Creates or open a shared memory segment */
-PHP_FUNCTION(shm_attach)
-{
- pval **arg_key,**arg_size,**arg_flag;
- long shm_size,shm_flag;
- sysvshm_shm *shm_list_ptr;
- char *shm_ptr;
- sysvshm_chunk_head *chunk_ptr;
- key_t shm_key = (key_t) 0;
- long shm_id,list_id;
- int ac = ZEND_NUM_ARGS();
-
- shm_flag = 0666;
- shm_size = php_sysvshm.init_mem;
-
- if(ac < 1 || ac > 3 || zend_get_parameters_ex(ac, &arg_key, &arg_size, &arg_flag) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- switch (ac) {
- case 3:
- convert_to_long_ex(arg_flag);
- shm_flag = (*arg_flag)->value.lval;
- case 2:
- convert_to_long_ex(arg_size);
- shm_size= (*arg_size)->value.lval;
- case 1:
- convert_to_long_ex(arg_key);
- shm_key = (*arg_key)->value.lval;
- }
-
- if((shm_list_ptr = (sysvshm_shm *) emalloc(sizeof(sysvshm_shm)))==NULL) {
- php_error(E_WARNING, "shm_attach() failed for key 0x%x: cannot allocate internal listelement", shm_key);
- RETURN_FALSE;
- }
-
- /* get the id from a specified key or create new shared memory */
- if((shm_id=shmget(shm_key,0,0))<0) {
- if(shm_size<sizeof(sysvshm_chunk_head)) {
- php_error(E_WARNING, "shm_attach() failed for key 0x%x: memorysize too small", shm_key);
- RETURN_FALSE;
- }
- if((shm_id=shmget(shm_key,shm_size,shm_flag|IPC_CREAT|IPC_EXCL))<0) {
- php_error(E_WARNING, "shmget() failed for key 0x%x: %s", shm_key, strerror(errno));
- RETURN_FALSE;
- }
- }
-
- if((shm_ptr = shmat(shm_id,NULL,0))==(void *)-1) {
- php_error(E_WARNING, "shmget() failed for key 0x%x: %s", shm_key, strerror(errno));
- RETURN_FALSE;
- }
-
- /* check if shm is already initialized */
- chunk_ptr= (sysvshm_chunk_head*) shm_ptr;
- if(strcmp((char*)&(chunk_ptr->magic),"PHP_SM")!=0) {
- strcpy((char*)&(chunk_ptr->magic),"PHP_SM");
- chunk_ptr->start=sizeof(sysvshm_chunk_head);
- chunk_ptr->end=chunk_ptr->start;
- chunk_ptr->total=shm_size;
- chunk_ptr->free=shm_size-chunk_ptr->end;
- }
-
-
- shm_list_ptr->key = shm_key;
- shm_list_ptr->id = shm_id;
- shm_list_ptr->ptr = chunk_ptr;
- list_id = zend_list_insert(shm_list_ptr, php_sysvshm.le_shm);
- RETURN_LONG(list_id);
-}
-/* }}} */
-
-/* {{{ proto int shm_detach(int shm_identifier)
- Disconnects from shared memory segment */
-PHP_FUNCTION(shm_detach)
-{
- pval **arg_id;
- long id;
-
- if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg_id) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(arg_id);
-
- id = (*arg_id)->value.lval;
-
- zend_list_delete(id);
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int shm_remove(int shm_identifier)
- Removes shared memory from Unix systems */
-
-PHP_FUNCTION(shm_remove)
-{
- pval **arg_id;
- long id;
- int type;
- sysvshm_shm *shm_list_ptr;
-
- if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg_id) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(arg_id);
-
- id = (*arg_id)->value.lval;
-
- shm_list_ptr = (sysvshm_shm *) zend_list_find(id, &type);
- if(shmctl(shm_list_ptr->id,IPC_RMID,NULL)<0) {
- php_error(E_WARNING, "shm_remove() failed for key 0x%x, id %i: %s", shm_list_ptr->key, id,strerror(errno));
- RETURN_FALSE;
- }
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int shm_put_var(int shm_identifier, int variable_key, mixed variable)
- Inserts or updates a variable in shared memory */
-PHP_FUNCTION(shm_put_var)
-{
- pval **arg_id, **arg_key, **arg_var;
- long key, id;
- sysvshm_shm *shm_list_ptr;
- int type;
- pval shm_var;
- int ret;
- php_serialize_data_t var_hash;
-
- if(ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &arg_id, &arg_key,&arg_var) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(arg_id);
- id = (*arg_id)->value.lval;
- convert_to_long_ex(arg_key);
- key = (*arg_key)->value.lval;
-
- shm_list_ptr = (sysvshm_shm *) zend_list_find(id, &type);
- if (type!=php_sysvshm.le_shm) {
- php_error(E_WARNING, "%d is not a SysV shared memory index", id);
- RETURN_FALSE;
- }
-
- /* setup string-variable and serialize */
-
- shm_var.type=IS_STRING;
- shm_var.value.str.len=0;
- shm_var.value.str.val=0;
- PHP_VAR_SERIALIZE_INIT(var_hash);
- php_var_serialize(&shm_var,arg_var,&var_hash);
- PHP_VAR_SERIALIZE_DESTROY(var_hash);
- /* insert serialized variable into shared memory */
- ret=php_put_shm_data(shm_list_ptr->ptr,key,shm_var.value.str.val,shm_var.value.str.len);
-
- /* free string */
- efree(shm_var.value.str.val);
-
- if(ret==-1) {
- php_error(E_WARNING, "not enough shared memory left");
- RETURN_FALSE;
- }
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto mixed shm_get_var(int id, int variable_key)
- Returns a variable from shared memory */
-PHP_FUNCTION(shm_get_var)
-{
- pval **arg_id, **arg_key;
- long key, id;
- sysvshm_shm *shm_list_ptr;
- int type;
- char *shm_data;
- long shm_varpos;
- sysvshm_chunk *shm_var;
- php_serialize_data_t var_hash;
-
- if(ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg_id, &arg_key) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(arg_id);
- id = (*arg_id)->value.lval;
- convert_to_long_ex(arg_key);
- key = (*arg_key)->value.lval;
-
- shm_list_ptr = (sysvshm_shm *) zend_list_find(id, &type);
- if (type!=php_sysvshm.le_shm) {
- php_error(E_WARNING, "%d is not a SysV shared memory index", id);
- RETURN_FALSE;
- }
-
- /* setup string-variable and serialize */
- /* get serialized variable from shared memory */
- shm_varpos=php_check_shm_data((shm_list_ptr->ptr),key);
-
- if(shm_varpos<0) {
- php_error(E_WARNING, "variable key %d doesn't exist", key);
- RETURN_FALSE;
- }
- shm_var=(sysvshm_chunk*)((char*)shm_list_ptr->ptr+shm_varpos);
- shm_data=&shm_var->mem;
-
- PHP_VAR_UNSERIALIZE_INIT(var_hash);
- if(php_var_unserialize(&return_value, (const char **) &shm_data, shm_data+shm_var->length,&var_hash)!=1) {
- PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
- php_error(E_WARNING, "variable data in shared memory is corruped");
- RETURN_FALSE;
- }
- PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
-}
-/* }}} */
-
-/* {{{ proto int shm_remove_var(int id, int variable_key)
- Removes variable from shared memory */
-PHP_FUNCTION(shm_remove_var)
-{
- pval **arg_id, **arg_key;
- long key, id;
- sysvshm_shm *shm_list_ptr;
- int type;
- long shm_varpos;
-
- if(ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg_id, &arg_key) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(arg_id);
- id = (*arg_id)->value.lval;
- convert_to_long_ex(arg_key);
- key = (*arg_key)->value.lval;
-
- shm_list_ptr = (sysvshm_shm *) zend_list_find(id, &type);
- if (type!=php_sysvshm.le_shm) {
- php_error(E_WARNING, "%d is not a SysV shared memory index", id);
- RETURN_FALSE;
- }
-
- shm_varpos=php_check_shm_data((shm_list_ptr->ptr),key);
-
- if(shm_varpos<0) {
- php_error(E_WARNING, "variable key %d doesn't exist", key);
- RETURN_FALSE;
- }
- php_remove_shm_data((shm_list_ptr->ptr),shm_varpos);
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ php_put_shm_data
- * inserts an ascii-string into shared memory */
-int php_put_shm_data(sysvshm_chunk_head *ptr,long key,char *data, long len) {
- sysvshm_chunk* shm_var;
- long total_size;
- long shm_varpos;
-
- total_size=((long)(len+sizeof(sysvshm_chunk)-1)/4)*4+4; /* 4-byte alligment */
-
- if(ptr->free<total_size) {
- return -1; /* not enough memeory */
- }
-
- if((shm_varpos=php_check_shm_data(ptr,key))>0) {
- php_remove_shm_data(ptr, shm_varpos);
- }
- shm_var=(sysvshm_chunk*)((char *)ptr+ptr->end);
- shm_var->key=key;
- shm_var->length=len;
- shm_var->next=total_size;
- memcpy(&(shm_var->mem),data,len);
- ptr->end+=total_size;
- ptr->free-=total_size;
- return 0;
-}
-/* }}} */
-
-/* {{{ php_check_shm_data
- */
-long php_check_shm_data(sysvshm_chunk_head *ptr, long key) {
- long pos;
- sysvshm_chunk *shm_var;
-
- pos=ptr->start;
-
- for(;;) {
- if(pos>=ptr->end) {
- return -1;
- }
- shm_var=(sysvshm_chunk*)((char*)ptr+pos);
- if(shm_var->key==key) {
- return pos;
- }
- pos+=shm_var->next;
- }
- return -1;
-}
-/* }}} */
-
-/* {{{ php_remove_shm_data
- */
-int php_remove_shm_data(sysvshm_chunk_head *ptr, long shm_varpos) {
- sysvshm_chunk *chunk_ptr, *next_chunk_ptr;
- long memcpy_len;
-
- chunk_ptr=(sysvshm_chunk*)((char*)ptr+shm_varpos);
- next_chunk_ptr=(sysvshm_chunk*)((char*)ptr+shm_varpos+chunk_ptr->next);
-
- memcpy_len=ptr->end-shm_varpos-chunk_ptr->next;
- ptr->free+=chunk_ptr->next;
- ptr->end-=chunk_ptr->next;
- if(memcpy_len>0)
- memcpy(chunk_ptr,next_chunk_ptr,memcpy_len);
- return 0;
-}
-/* }}} */
-
-#endif /* HAVE_SYSVSHM */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/vpopmail/CREDITS b/ext/vpopmail/CREDITS
deleted file mode 100644
index ed89afbb5f..0000000000
--- a/ext/vpopmail/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-Vpopmail
-David Croft, Boian Bonev
diff --git a/ext/vpopmail/EXPERIMENTAL b/ext/vpopmail/EXPERIMENTAL
deleted file mode 100644
index 6443e99646..0000000000
--- a/ext/vpopmail/EXPERIMENTAL
+++ /dev/null
@@ -1,5 +0,0 @@
-this extension is experimental,
-its functions may change their names
-or move to extension all together
-so do not rely to much on them
-you have been warned!
diff --git a/ext/vpopmail/Makefile.in b/ext/vpopmail/Makefile.in
deleted file mode 100644
index fbb38775d2..0000000000
--- a/ext/vpopmail/Makefile.in
+++ /dev/null
@@ -1,8 +0,0 @@
-# $Id$
-
-LTLIBRARY_NAME = libvpopmail.la
-LTLIBRARY_SOURCES = php_vpopmail.c
-LTLIBRARY_SHARED_NAME = vpopmail.la
-LTLIBRARY_SHARED_LIBADD = $(VPOPMAIL_SHARED_LIBADD)
-
-include $(top_srcdir)/build/dynlib.mk
diff --git a/ext/vpopmail/README b/ext/vpopmail/README
deleted file mode 100644
index a47c9b0f56..0000000000
--- a/ext/vpopmail/README
+++ /dev/null
@@ -1,194 +0,0 @@
-Minimum Survial Readme
-
-VPOPMAIL SPECIFIC ISSUES
--------------------------------------------------------------------------------
-
-assume
- qmail is installed in /var/qmail
- vpopmail in ~vpopmail
- qmail-send runs as qmails
-
-
-different parts of vpopmail require certain user id (uid) and
-group id (gid) in order to operate normally.
-
-brief list with requirements:
-
-adddomain
-deldomain
-addaliasdomain
- read/write permissions on
- /var/qmail/users/ assing, assign.lock, cdb
-
- read/write permissions on
- /var/qmail/control/*
-
- singnal qmail-send with SIGHUP (uid==qmails or root)
-
- read/write permissions on
- ~vpopmail/domains
-
- optionally read/write to cdb vpopmail databases
-
-adduser
-deluser
- read/write permissions on
- ~vpopmail/domains/<givendomain> (or the default domain)
-
- optionally read/write to cdb vpopmail databases
-
-passwd
- optionally read/write on
- ~vpopmail/domains/<givendomain>/<givenuser>
- (only when sqwebmail is configured)
-
-setuserquota
- optionally read/write to cdb vpopmail databases
-
-auth_user
- optionally read from cdb vpopmail databases
-
-POSSIBLE SCENARIOS
--------------------------------------------------------------------------------
-
-php is in cgi mode
-
- command line invocation
-
- web server cgi invocation
-
-php is web server module
-
-
-in command line mode the php interpreter may be run from vpopmail uid to
-administer users, etc. or as root to add/del domains - this is the easiest case
-
-in cgi mode proper uid may be provided eighter by suid php interpreter or
-using cgi exec wrapper. the same restrictions as in command line mode apply
-
-the web server module mode is the most powerful and works much faster that cgi.
-in this mode more restrictions apply because web server's uid at least must
-be able to read/write the directories of the manages domains.
-
-first scenario only allows web scripts to manage certain domains. security
-may be compromised if there are user webs under the same web server
-with allowed script execution.
-
-second scenario is to setup web server and vpopmail under the same uid/gid.
-thus allowing only user management in all domains.
-
-third scenario extends second with the ability to manage domains. generally
-from security reasons it is not a good idea to run such a system on a server
-with shell users - vpopmail's domain admin tools must be suid root to work
-properly and most users will be able to add/delete domains.
-
-it is not considered a good idea to run web servers as root. hence the need
-to suid vpopmail domain management tools and exec them insted using native api.
-native api for domains is only suitable for cgi/command line mode, when php is
-run through suid root wrapper or suid itself.
-
-almost all scenarios lack secutiry in different ways - eighter powerful tools
-get suid root or parts of vpopmail setup become useable by any system user
-or web users with cgi/php access may utilize vpopmail api for mail management.
-
-perhapse the most secure solution is to run a separate apache server under
-the vpopmail user and chmod 700 ~vpopmail/bin.
-
-FREQUENTLY USED CONFIGURATION STEPS
--------------------------------------------------------------------------------
-
-changing existing vpopmail uid/gid is possible but not easy -
-take these into account:
-
-#1 - backup your setup, mail and configuration!
-
- stop qmail-send before doing any changes
- else your mail in process may get bounced or
- deleted or delivered to a default destination or...
-
- stop pop3/imap remote/local users - while changing uids
- users cannot check their mail
-
- you may leave smtp - qmail-inject will take care
- no matter vpopmail setup is broken (if and only
- if you have stopped qmail-send)
-
- in rc.d scripts tcpserver uid/gid may need to be changed
-
- reconfiguring vpopmail:
- ./configure ....your opts plus new uid/gid....
-
- remember to
- make clean all install
- in vpopmail src tree; clean is needed if vpopmail has already been
- configured with another uid/gid - vpopmail's dependencies are not
- intact after reconfigure
-
- after these steps change the uid/gid in
- /var/qmail/users/assign
- compile the assign file. the dummies way is to
- vadddomain mydummy.domain aaaa
- vdeldomain mydummy.domain
-
- suid root vadddomain, vdeldomain and vaddaliasdomain
- (this is only needed for domain management in web server module)
- cd ~vpopmail/bin
- chown 0.0 vadddomain vdeldomain vaddaliasdomain
- chmod +s vadddomain vdeldomain vaddaliasdomain
-
- optionally secure ~vpopmail/bin
- (beware these programs may be exploitable or at least used)
- chmod 700 ~vpopmail/bin
-
- run qmail-send
- /bin/csh -cf '/var/qmail/rc &'
-
- run pop3 tcpserver or what you are using
-
- verify your setup
-
-#2 verify php vpopmail module and configuration
-
- for web server module and cgi setups create a phpinfo page:
-
- <?php phpinfo() ?>
-
- for command line mode run
- php -i
-
- check for vpopmail section in result
-
- verify that php euid/egid match vpopmail's
-
- in setups where only certain domain users will be administrated
- verify that php euid/egid can access their respective directories
-
-FUNCTION PROTOTYPES
--------------------------------------------------------------------------------
-
-bool vpopmail_add_domain(string domain, string dir, int uid, int gid)
-bool vpopmail_del_domain(string domain)
-bool vpopmail_add_alias_domain(string domain, string aliasdomain)
-bool vpopmail_add_domain_ex(string domain, string passwd [, string quota [, string bounce [, bool apop]]])
-bool vpopmail_del_domain_ex(string domain)
-bool vpopmail_add_alias_domain_ex(string olddomain, string newdomain)
-bool vpopmail_add_user(string user, string domain, string password[, string gecos[, bool apop]])
-bool vpopmail_del_user(string user, string domain)
-bool vpopmail_passwd(string user, string domain, string password)
-bool vpopmail_set_user_quota(string user, string domain, string quota)
-bool vpopmail_auth_user(string user, string domain, string password[, string apop])
-bool vpopmail_alias_add(string user, string domain, string alias)
-bool vpopmail_alias_del(string user, string domain)
-bool vpopmail_alias_del_domain(string domain)
-array vpopmail_alias_get(string alias, string domain)
-string vpopmail_error(void)
-
-
-CONTACT INFO
--------------------------------------------------------------------------------
-
-your comments, fixes and stuff are welcome
-Boian Bonev <boian@bonev.com>
-
-$Id$
-
diff --git a/ext/vpopmail/config.m4 b/ext/vpopmail/config.m4
deleted file mode 100644
index 7e123b7e1d..0000000000
--- a/ext/vpopmail/config.m4
+++ /dev/null
@@ -1,58 +0,0 @@
-dnl $Id$
-dnl config.m4 for extension vpopmail
-
-PHP_ARG_WITH(vpopmail, for vpopmail support,
-[ --with-vpopmail[=DIR] Include vpopmail support.])
-
-if test "$PHP_VPOPMAIL" != "no"; then
- AC_MSG_CHECKING(for vpopmail install directory)
- for i in ~vpopmail /home/vpopmail /home/popmail /var/qmail/vpopmail /var/qmail/popmail $PHP_VPOPMAIL; do
- if test -r $i/vpopmail.h; then
- VPOPMAIL_INC_DIR=$i
- VPOPMAIL_DIR=$i
- elif test -r $i/include/vpopmail.h; then
- VPOPMAIL_INC_DIR=$i/include
- VPOPMAIL_DIR=$i
- fi
-
- if test -r $i/libvpopmail.a; then
- VPOPMAIL_LIB_DIR=$i
- elif test -r $i/lib/libvpopmail.a; then
- VPOPMAIL_LIB_DIR=$i/lib
- fi
-
- if test -r $i/vadddomain; then
- VPOPMAIL_BIN_DIR=$i
- elif test -r $i/bin/vadddomain; then
- VPOPMAIL_BIN_DIR=$i/bin
- fi
- done
-
- for i in "$VPOPMAIL_INC_DIR/vpopmail.h" "$VPOPMAIL_INC_DIR/vpopmail_config.h" "$VPOPMAIL_LIB_DIR/libvpopmail.a" "$VPOPMAIL_BIN_DIR/vadddomain" "$VPOPMAIL_BIN_DIR/vaddaliasdomain" "$VPOPMAIL_BIN_DIR/vdeldomain" ; do
- if test ! -r "$i"; then
- AC_MSG_ERROR(Could not find '$i'. Please make sure you have
- vpopmail installed. Use
- ./configure --with-vpopmail=<vpopmail-home-dir> if necessary)
- fi
- done
-
- AC_MSG_RESULT($VPOPMAIL_DIR)
-
- dnl newer versions of vpopmail have include/vauth.h defining valias functions
- if test -r $VPOPMAIL_INC_DIR/vauth.h; then
- AC_DEFINE(HAVE_VPOPMAIL_VAUTH,1,[Whether vpopmail has vauth.h])
- fi
- dnl check for valias functions in the -lvpopmail
- AC_CHECK_LIB(vpopmail, valias_select,
- [ AC_DEFINE(HAVE_VPOPMAIL_VALIAS,1,[Whether vpopmail has valias support]) ],[],[ -L$VPOPMAIL_LIB_DIR ])
-
- PHP_ADD_INCLUDE($VPOPMAIL_INC_DIR)
-
- PHP_SUBST(VPOPMAIL_SHARED_LIBADD)
- PHP_ADD_LIBRARY_WITH_PATH(vpopmail, $VPOPMAIL_LIB_DIR, VPOPMAIL_SHARED_LIBADD)
-
- AC_DEFINE(HAVE_VPOPMAIL,1,[Whether you have vpopmail])
- AC_DEFINE_UNQUOTED(VPOPMAIL_BIN_DIR,"$VPOPMAIL_BIN_DIR",[vpopmail bin path])
-
- PHP_EXTENSION(vpopmail, $ext_shared)
-fi
diff --git a/ext/vpopmail/php_vpopmail.c b/ext/vpopmail/php_vpopmail.c
deleted file mode 100644
index 30d5428168..0000000000
--- a/ext/vpopmail/php_vpopmail.c
+++ /dev/null
@@ -1,947 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997, 1998, 1999, 2000, 2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: David Croft <david@infotrek.co.uk> |
- | Boian Bonev <boian@bonev.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-/* TODO: move to config.m4 when support for old versions is ready or just
- * don't support rather old vpopmail. current version must bail out if
- * incompat option is specified and work for minimal params
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#undef VPOPMAIL_IS_REALLY_OLD
-
-#include <errno.h>
-#include <signal.h>
-#include "php.h"
-#include "php_ini.h"
-#include "php_vpopmail.h"
-
-#if HAVE_VPOPMAIL
-
-#include "ext/standard/exec.h"
-#include "ext/standard/info.h"
-#include "ext/standard/php_string.h"
-
-ZEND_DECLARE_MODULE_GLOBALS(vpopmail)
-
-/* keep this as the last include in order to destroy VERSION/PACKAGE only for the rest of the code */
-
-#undef VERSION
-#undef PACKAGE
-#include "vpopmail_config.h"
-#include "vpopmail.h"
-#if HAVE_VPOPMAIL_VAUTH
-#include "vauth.h"
-#endif
-
-
-/* vpopmail does not export this, argh! */
-#define MAX_BUFF 500
-
-/* Function table */
-
-function_entry vpopmail_functions[] = {
- /* domain management - lib call */
- PHP_FE(vpopmail_add_domain, NULL)
- PHP_FE(vpopmail_del_domain, NULL)
- PHP_FE(vpopmail_add_alias_domain, NULL)
- /* domain management - exec */
- PHP_FE(vpopmail_add_domain_ex, NULL)
- PHP_FE(vpopmail_del_domain_ex, NULL)
- PHP_FE(vpopmail_add_alias_domain_ex, NULL)
- /* user management */
- PHP_FE(vpopmail_add_user, NULL)
- PHP_FE(vpopmail_del_user, NULL)
- PHP_FE(vpopmail_passwd, NULL)
- PHP_FE(vpopmail_set_user_quota, NULL)
- PHP_FE(vpopmail_auth_user, NULL)
- /* alias management */
-#if HAVE_VPOPMAIL_VALIAS
- PHP_FE(vpopmail_alias_add, NULL)
- PHP_FE(vpopmail_alias_del, NULL)
-#ifdef VALIAS
- PHP_FE(vpopmail_alias_del_domain, NULL)
-#endif
- PHP_FE(vpopmail_alias_get, NULL)
- PHP_FE(vpopmail_alias_get_all, NULL)
-#endif
- /* error handling */
- PHP_FE(vpopmail_error, NULL)
- {NULL, NULL, NULL}
-};
-
-zend_module_entry vpopmail_module_entry = {
- "vpopmail",
- vpopmail_functions,
- PHP_MINIT(vpopmail),
- PHP_MSHUTDOWN(vpopmail),
- PHP_RINIT(vpopmail),
- PHP_RSHUTDOWN(vpopmail),
- PHP_MINFO(vpopmail),
- STANDARD_MODULE_PROPERTIES
-};
-
-#ifdef COMPILE_DL_VPOPMAIL
-ZEND_GET_MODULE(vpopmail)
-#endif
-
-
-PHP_INI_BEGIN()
- /*STD_PHP_INI_ENTRY("vpopmail.directory", "", PHP_INI_ALL, OnUpdateString, directory, php_vpopmail_globals, vpopmail_globals)*/
-PHP_INI_END()
-
-
-PHP_MINIT_FUNCTION(vpopmail)
-{
- REGISTER_INI_ENTRIES();
- return SUCCESS;
-}
-
-PHP_MSHUTDOWN_FUNCTION(vpopmail)
-{
- UNREGISTER_INI_ENTRIES();
- return SUCCESS;
-}
-
-PHP_RINIT_FUNCTION(vpopmail)
-{
- VPOPMAILLS_FETCH();
-
- VPOPMAILG(vpopmail_open) = 0;
- VPOPMAILG(vpopmail_errno) = 0;
-
- return SUCCESS;
-}
-
-/* nasty but... */
-void vclose();
-/* ...we need this */
-
-PHP_RSHUTDOWN_FUNCTION(vpopmail)
-{
- VPOPMAILLS_FETCH();
-
- if (VPOPMAILG(vpopmail_open) != 0) {
- vclose();
- }
-
- return SUCCESS;
-}
-
-PHP_MINFO_FUNCTION(vpopmail)
-{
- char ids[64];
-
- sprintf(ids, "%d/%d %d/%d/%d/%d", VPOPMAILUID, VPOPMAILGID, getuid(), getgid(), geteuid(), getegid());
-
- php_info_print_table_start();
- php_info_print_table_header(2, "vpopmail support", "enabled");
- php_info_print_table_row(2, "vpopmail version", VERSION);
- php_info_print_table_row(2, "vpopmail uid/gid php uid/gid/euid/egid", ids);
- php_info_print_table_row(2, "vpopmail dir", VPOPMAILDIR);
- php_info_print_table_row(2, "vpopmail vadddomain", VPOPMAIL_BIN_DIR VPOPMAIL_ADDD);
- php_info_print_table_row(2, "vpopmail vdeldomain", VPOPMAIL_BIN_DIR VPOPMAIL_DELD);
- php_info_print_table_row(2, "vpopmail vaddaliasdomain", VPOPMAIL_BIN_DIR VPOPMAIL_ADAD);
-#if HAVE_VPOPMAIL_VALIAS
- php_info_print_table_row(2, "vpopmail valias support", "Enabled");
-#else
- php_info_print_table_row(2, "vpopmail valias support", "Not supported by vpopmail");
-#endif
- php_info_print_table_end();
-
- DISPLAY_INI_ENTRIES();
-}
-
-/*
- * Domain management functions - library call
- */
-
-/* {{{ proto bool vpopmail_add_domain(string domain, string dir, int uid, int gid)
- Add a new virtual domain */
-PHP_FUNCTION(vpopmail_add_domain)
-{
- zval **domain;
- zval **dir;
- zval **uid;
- zval **gid;
- int retval;
-
- if (ZEND_NUM_ARGS() != 4
- || zend_get_parameters_ex(4, &domain, &dir, &uid, &gid) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_string_ex(domain);
- convert_to_string_ex(dir);
- convert_to_long_ex(uid);
- convert_to_long_ex(gid);
-
- VPOPMAILLS_FETCH();
- VPOPMAILG(vpopmail_open) = 1;
-
- retval = vadddomain(Z_STRVAL_PP(domain),
-#ifdef VPOPMAIL_IS_REALLY_OLD
- 0
-#else
- Z_STRVAL_PP(dir),
- Z_LVAL_PP(uid),
- Z_LVAL_PP(gid)
-#endif
- );
- VPOPMAILG(vpopmail_errno)=retval;
-
- if (retval == VA_SUCCESS) {
- RETURN_TRUE;
- } else {
- php_error(E_WARNING, "vpopmail error: %s", verror(retval));
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto bool vpopmail_del_domain(string domain)
- Delete a virtual domain */
-PHP_FUNCTION(vpopmail_del_domain)
-{
- zval **domain;
- int retval;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &domain) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_string_ex(domain);
-
- VPOPMAILLS_FETCH();
- VPOPMAILG(vpopmail_open) = 1;
-
- retval = vdeldomain(Z_STRVAL_PP(domain));
-
- VPOPMAILG(vpopmail_errno)=retval;
-
- if (retval == VA_SUCCESS) {
- RETURN_TRUE;
- } else {
- php_error(E_WARNING, "vpopmail error: %s", verror(retval));
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto bool vpopmail_add_alias_domain(string domain, string aliasdomain)
- Add an alias for a virtual domain */
-PHP_FUNCTION(vpopmail_add_alias_domain)
-{
- zval **domain;
- zval **aliasdomain;
- char *tmpstr;
- char Dir[156];
- char TmpBuf1[300];
- char TmpBuf2[300];
- int uid, gid;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &domain, &aliasdomain) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_string_ex(domain);
- convert_to_string_ex(aliasdomain);
-
- php_strtolower(Z_STRVAL_PP(domain), Z_STRLEN_PP(domain));
- php_strtolower(Z_STRVAL_PP(aliasdomain), Z_STRLEN_PP(aliasdomain));
-
- VPOPMAILLS_FETCH();
- VPOPMAILG(vpopmail_open) = 1;
-
- tmpstr = vget_assign(Z_STRVAL_PP(domain), Dir, 156, &uid, &gid);
-
- if (tmpstr == NULL) {
- php_error(E_WARNING, "vpopmail_add_alias_domain error: existing domain %s was not found", Z_STRVAL_PP(domain));
- VPOPMAILG(vpopmail_errno) = 1;
- RETURN_FALSE;
- }
-
- tmpstr = strstr(Dir, "/domains");
- *tmpstr = 0;
-
- sprintf(TmpBuf1, "%s/domains/%s", Dir, Z_STRVAL_PP(aliasdomain));
- sprintf(TmpBuf2, "%s/domains/%s", Dir, Z_STRVAL_PP(domain));
-
- if (symlink(TmpBuf2, TmpBuf1) != 0) {
- php_error(E_WARNING, "vpopmail_add_alias_domain error: could not symlink domains: %s", strerror(errno));
- VPOPMAILG(vpopmail_errno) = 1;
- RETURN_FALSE;
- }
-
- if (add_domain_assign(Z_STRVAL_PP(aliasdomain), Dir, uid, gid) != 0) {
- php_error(E_WARNING, "vpopmail_addaliasdomain could not add domain to control files");
- VPOPMAILG(vpopmail_errno) = 1;
- RETURN_FALSE;
- }
-
- signal_process("qmail-send", SIGHUP);
-
- VPOPMAILG(vpopmail_errno) = 0;
- RETURN_TRUE;
-}
-/* }}} */
-
-/*
- * Domain management functions - exec
- */
-
-/* {{{ proto bool vpopmail_add_domain_ex(string domain, string passwd [, string quota [, string bounce [, bool apop]]])
- Add a new virtual domain */
-PHP_FUNCTION(vpopmail_add_domain_ex) {
- zval **domain, **passwd, **quota, **bounce, **apop;
- int retval,len=0,argc=ZEND_NUM_ARGS(),is_bounce_email;
- int fr_bounce=0,fr_quota=0;
- char *cmd,*escdomain="",*escpasswd="",*escquota="",*escbounce="",*escapop="";
-
- if (argc < 2 || argc > 5 || zend_get_parameters_ex(argc, &domain, &passwd, &quota, &bounce, &apop) == FAILURE){
- WRONG_PARAM_COUNT;
- }
-
- VPOPMAILLS_FETCH();
-
- switch (argc) {
- case 5:
- convert_to_long_ex(apop);
- escapop=Z_BVAL_PP(apop)?"1":"0";
- /* Fall-through. */
- case 4:
- fr_bounce=1;
- convert_to_string_ex(bounce);
- escbounce=php_escape_shell_cmd(Z_STRVAL_PP(bounce));
- if (!escbounce) {
- php_error(E_WARNING,"vpopmail_adddomain error: cannot alloc");
- VPOPMAILG(vpopmail_errno)=1;
- RETURN_FALSE;
- }
- /* Fall-through. */
- case 3:
- fr_quota=1;
- convert_to_string_ex(quota);
- escquota=php_escape_shell_cmd(Z_STRVAL_PP(quota));
- if (!escquota) {
- php_error(E_WARNING,"vpopmail_adddomain error: cannot alloc");
- VPOPMAILG(vpopmail_errno)=1;
- RETURN_FALSE;
- }
- /* Fall-through. */
- case 2:
- convert_to_string_ex(passwd);
- convert_to_string_ex(domain);
- break;
- }
-
- escdomain=php_escape_shell_cmd(Z_STRVAL_PP(domain));
- escpasswd=php_escape_shell_cmd(Z_STRVAL_PP(passwd));
- if (!escdomain||!escpasswd) {
- if (fr_quota)
- efree(escquota);
- if (fr_bounce)
- efree(escbounce);
- php_error(E_WARNING,"vpopmail_adddomain error: cannot alloc");
- VPOPMAILG(vpopmail_errno)=1;
- RETURN_FALSE;
- }
- len+=strlen(VPOPMAIL_BIN_DIR);
- len+=strlen(VPOPMAIL_ADDD);
- if (*escquota)
- len+=strlen("-q ")+strlen(escquota)+strlen(" ");
- if (*escbounce) {
- if (strchr(Z_STRVAL_PP(bounce),'@')) {
- is_bounce_email=1;
- len+=strlen("-e ")+strlen(escbounce)+strlen(" ");
- } else {
- is_bounce_email=0;
- len+=strlen("-b ");
- }
- }
- if (*escapop)
- len+=strlen("-a ");
- len+=strlen(escdomain)+strlen(" ");
- len+=strlen(escpasswd)+strlen(" ");
- len++;
- cmd=emalloc(len);
- if (!cmd) {
- if (fr_quota)
- efree(escquota);
- if (fr_bounce)
- efree(escbounce);
- efree(escdomain);
- efree(escpasswd);
- php_error(E_WARNING,"vpopmail_adddomain error: cannot alloc");
- VPOPMAILG(vpopmail_errno)=1;
- RETURN_FALSE;
- }
- strcpy(cmd,VPOPMAIL_BIN_DIR VPOPMAIL_ADDD);
- if (*escquota) {
- strcat(cmd,"-q ");
- strcat(cmd,escquota);
- strcat(cmd," ");
- }
- if (*escbounce) {
- if (is_bounce_email) {
- strcat(cmd,"-e ");
- strcat(cmd,escbounce);
- strcat(cmd," ");
- } else {
- strcat(cmd,"-b ");
- }
- }
- if (*escapop)
- strcat(cmd,"-a ");
- strcat(cmd,escdomain);
- strcat(cmd," ");
- strcat(cmd,escpasswd);
- retval=php_Exec(0,cmd,NULL,return_value);
- efree(cmd);
- efree(escdomain);
- efree(escpasswd);
- if (fr_quota)
- efree(escquota);
- if (fr_bounce)
- efree(escbounce);
-
- if (retval!=VA_SUCCESS) {
- php_error(E_WARNING,"vpopmail_add_domain_ex error: %d", retval);
- VPOPMAILG(vpopmail_errno)=1;
- RETURN_FALSE;
- } else {
- VPOPMAILG(vpopmail_errno)=0;
- RETURN_TRUE;
- }
-}
-/* }}} */
-
-/* {{{ proto bool vpopmail_del_domain_ex(string domain)
- Delete a virtual domain */
-PHP_FUNCTION(vpopmail_del_domain_ex) {
- zval **domain;
- int retval=-1;
- char *cmd,*escdomain;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &domain) == FAILURE){
- WRONG_PARAM_COUNT;
- }
-
- VPOPMAILLS_FETCH();
-
- convert_to_string_ex(domain);
-
- escdomain=php_escape_shell_cmd(Z_STRVAL_PP(domain));
- if (!escdomain) {
- php_error(E_WARNING,"vpopmail_del_domain_ex error: cannot alloc");
- VPOPMAILG(vpopmail_errno)=1;
- RETURN_FALSE;
- }
- cmd=emalloc(strlen(VPOPMAIL_BIN_DIR)+strlen(VPOPMAIL_DELD)+strlen(escdomain)+1);
- if (!cmd) {
- efree(escdomain);
- php_error(E_WARNING,"vpopmail_del_domain_ex error: cannot alloc");
- VPOPMAILG(vpopmail_errno)=1;
- RETURN_FALSE;
- }
- sprintf(cmd,VPOPMAIL_BIN_DIR VPOPMAIL_DELD"%s",escdomain);
- retval=php_Exec(0,cmd,NULL,return_value);
- efree(escdomain);
- efree(cmd);
-
- if (retval!=VA_SUCCESS) {
- php_error(E_WARNING,"vpopmail_del_domain_ex error: %d", retval);
- VPOPMAILG(vpopmail_errno)=1;
- RETURN_FALSE;
- } else {
- VPOPMAILG(vpopmail_errno)=0;
- RETURN_TRUE;
- }
-}
-/* }}} */
-
-/* {{{ proto bool vpopmail_add_alias_domain_ex(string olddomain, string newdomain)
- Add alias to an existing virtual domain */
-PHP_FUNCTION(vpopmail_add_alias_domain_ex) {
- zval **olddomain, **newdomain;
- int retval;
- char *cmd,*escolddomain,*escnewdomain;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &olddomain, &newdomain) == FAILURE){
- WRONG_PARAM_COUNT;
- }
-
- VPOPMAILLS_FETCH();
-
- convert_to_string_ex(olddomain);
- convert_to_string_ex(newdomain);
- escnewdomain=php_escape_shell_cmd(Z_STRVAL_PP(newdomain));
- if (!escnewdomain) {
- php_error(E_WARNING,"vpopmail_addaliasdomain error: cannot alloc");
- VPOPMAILG(vpopmail_errno)=1;
- RETURN_FALSE;
- }
- escolddomain=php_escape_shell_cmd(Z_STRVAL_PP(olddomain));
- if (!escolddomain) {
- efree(escnewdomain);
- php_error(E_WARNING,"vpopmail_addaliasdomain error: cannot alloc");
- VPOPMAILG(vpopmail_errno)=1;
- RETURN_FALSE;
- }
-
- cmd=emalloc(strlen(VPOPMAIL_BIN_DIR VPOPMAIL_ADAD)+strlen(escolddomain)+strlen(" ")+strlen(escnewdomain)+1);
- if (!cmd) {
- efree(escnewdomain);
- efree(escolddomain);
- php_error(E_WARNING,"vpopmail_addaliasdomain error: cannot alloc");
- VPOPMAILG(vpopmail_errno)=1;
- RETURN_FALSE;
- }
- sprintf(cmd,"%s%s %s",VPOPMAIL_BIN_DIR VPOPMAIL_ADAD,escolddomain,escnewdomain);
- retval=php_Exec(0,cmd,NULL,return_value);
- efree(cmd);
- efree(escnewdomain);
- efree(escolddomain);
-
- if (retval!=VA_SUCCESS) {
- php_error(E_WARNING,"vpopmail_addaliasdomain error: %d", retval);
- VPOPMAILG(vpopmail_errno)=1;
- RETURN_FALSE;
- } else {
- VPOPMAILG(vpopmail_errno)=0;
- RETURN_TRUE;
- }
-}
-/* }}} */
-
-/*
- * User management functions
- */
-
-/* {{{ proto bool vpopmail_add_user(string user, string domain, string password[, string gecos[, bool apop]])
- Add a new user to the specified virtual domain */
-PHP_FUNCTION(vpopmail_add_user)
-{
- zval **user;
- zval **domain;
- zval **password;
- zval **gecos;
- zval **apop;
- int is_apop = 0;
- char *the_gecos = "";
- int retval;
-
- if (ZEND_NUM_ARGS() < 3 || ZEND_NUM_ARGS() > 5
- || zend_get_parameters_ex(ZEND_NUM_ARGS(), &user, &domain, &password, &gecos, &apop) == FAILURE)
- WRONG_PARAM_COUNT;
-
- switch (ZEND_NUM_ARGS()) {
- case 5:
- convert_to_boolean_ex(apop);
- is_apop = (Z_BVAL_PP(apop) ? 1 : 0);
- /* fall through */
-
- case 4:
- convert_to_string_ex(gecos);
- the_gecos = Z_STRVAL_PP(gecos);
- /* fall through */
-
- default:
- convert_to_string_ex(user);
- convert_to_string_ex(domain);
- convert_to_string_ex(password);
- }
-
- VPOPMAILLS_FETCH();
- VPOPMAILG(vpopmail_open) = 1;
-
- retval = vadduser(Z_STRVAL_PP(user),
- Z_STRVAL_PP(domain),
- Z_STRVAL_PP(password),
- the_gecos,
- is_apop);
-
- VPOPMAILG(vpopmail_errno)=retval;
-
- if (retval == VA_SUCCESS) {
- RETURN_TRUE;
- } else {
- php_error(E_WARNING, "vpopmail error: %s", verror(retval));
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto bool vpopmail_del_user(string user, string domain)
- Delete a user from a virtual domain */
-PHP_FUNCTION(vpopmail_del_user)
-{
- zval **user;
- zval **domain;
- int retval;
-
- if (ZEND_NUM_ARGS() != 2
- || zend_get_parameters_ex(2, &user, &domain) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_string_ex(user);
- convert_to_string_ex(domain);
-
- VPOPMAILLS_FETCH();
- VPOPMAILG(vpopmail_open) = 1;
-
- retval = vdeluser(Z_STRVAL_PP(user),
- Z_STRVAL_PP(domain));
-
- VPOPMAILG(vpopmail_errno)=retval;
-
- if (retval == VA_SUCCESS) {
- RETURN_TRUE;
- } else {
- php_error(E_WARNING, "vpopmail error: %s", verror(retval));
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto bool vpopmail_passwd(string user, string domain, string password)
- Change a virtual user's password */
-PHP_FUNCTION(vpopmail_passwd)
-{
- zval **user;
- zval **domain;
- zval **password;
- zval **apop;
- int is_apop = 0;
- int retval;
-
- if (ZEND_NUM_ARGS() < 3 || ZEND_NUM_ARGS() > 4
- || zend_get_parameters_ex(ZEND_NUM_ARGS(), &user, &domain, &password, &apop) == FAILURE)
- WRONG_PARAM_COUNT;
-
- if (ZEND_NUM_ARGS() > 3) {
- convert_to_boolean_ex(apop);
- is_apop = (Z_BVAL_PP(apop) ? 1 : 0);
- }
-
- convert_to_string_ex(user);
- convert_to_string_ex(domain);
- convert_to_string_ex(password);
-
- VPOPMAILLS_FETCH();
- VPOPMAILG(vpopmail_open) = 1;
-
- retval = vpasswd(Z_STRVAL_PP(user),
- Z_STRVAL_PP(domain),
- Z_STRVAL_PP(password),
- is_apop);
-
- VPOPMAILG(vpopmail_errno)=retval;
-
- if (retval == VA_SUCCESS) {
- RETURN_TRUE;
- } else {
- php_error(E_WARNING, "vpopmail error: %s", verror(retval));
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto bool vpopmail_set_user_quota(string user, string domain, string quota)
- Sets a virtual user's quota */
-PHP_FUNCTION(vpopmail_set_user_quota)
-{
- zval **user;
- zval **domain;
- zval **quota;
- int retval;
-
- if (ZEND_NUM_ARGS() != 3
- || zend_get_parameters_ex(3, &user, &domain, &quota) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_string_ex(user);
- convert_to_string_ex(domain);
- convert_to_string_ex(quota);
-
- VPOPMAILLS_FETCH();
- VPOPMAILG(vpopmail_open) = 1;
-
- retval = vsetuserquota(Z_STRVAL_PP(user),
- Z_STRVAL_PP(domain),
- Z_STRVAL_PP(quota));
-
- VPOPMAILG(vpopmail_errno)=retval;
-
- if (retval == VA_SUCCESS) {
- RETURN_TRUE;
- } else {
- php_error(E_WARNING, "vpopmail error: %s", verror(retval));
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto bool vpopmail_auth_user(string user, string domain, string password[, string apop])
- Attempt to validate a username/domain/password. Returns true/false */
-PHP_FUNCTION(vpopmail_auth_user)
-{
- zval **user;
- zval **domain;
- zval **password;
- zval **apop;
- /* indeed we do not care of contents; newer vpopmail versions use struct vpasswd instead passwd */
- void *retval;
- int argc=ZEND_NUM_ARGS();
-
- if (argc < 3 || argc > 4
- || zend_get_parameters_ex(argc, &user, &domain, &password, &apop) == FAILURE)
- WRONG_PARAM_COUNT;
-
- if (argc > 3)
- convert_to_string_ex(apop);
-
- convert_to_string_ex(user);
- convert_to_string_ex(domain);
- convert_to_string_ex(password);
-
- VPOPMAILLS_FETCH();
- VPOPMAILG(vpopmail_open) = 1;
- VPOPMAILG(vpopmail_errno) = 0;
-
- retval = vauth_user(Z_STRVAL_PP(user),
- Z_STRVAL_PP(domain),
- Z_STRVAL_PP(password),
- (argc>3)?Z_STRVAL_PP(apop):"");
-
- /*
- * we do not set vpopmail_errno here - it is considered auth_user cannot fail; insted it does not auth
- * this is a vpopmail's api limitation - there is no error return form vauth_user
- */
-
- if (retval == NULL) {
- RETURN_FALSE;
- } else {
- RETURN_TRUE;
- }
-}
-/* }}} */
-
-
-#if HAVE_VPOPMAIL_VALIAS
-
-/*
- * Alias management functions
- */
-
-
-/* {{{ proto bool vpopmail_alias_add(string user, string domain, string alias)
- insert a virtual alias */
-PHP_FUNCTION(vpopmail_alias_add)
-{
- zval **user;
- zval **domain;
- zval **alias;
- int retval;
-
- if (ZEND_NUM_ARGS() != 3
- || zend_get_parameters_ex(ZEND_NUM_ARGS(), &user, &domain, &alias) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_string_ex(user);
- convert_to_string_ex(domain);
- convert_to_string_ex(alias);
-
- VPOPMAILLS_FETCH();
- VPOPMAILG(vpopmail_open) = 1;
-
- retval = valias_insert(Z_STRVAL_PP(user),
- Z_STRVAL_PP(domain),
- Z_STRVAL_PP(alias));
-
- VPOPMAILG(vpopmail_errno)=retval;
-
- if (retval == VA_SUCCESS) {
- RETURN_TRUE;
- } else {
- php_error(E_WARNING, "vpopmail error: %s", verror(retval));
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto bool vpopmail_alias_del(string user, string domain)
- deletes all virtual aliases of a user */
-PHP_FUNCTION(vpopmail_alias_del)
-{
- zval **user;
- zval **domain;
- int retval;
-
- if (ZEND_NUM_ARGS() != 2
- || zend_get_parameters_ex(ZEND_NUM_ARGS(), &user, &domain) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_string_ex(user);
- convert_to_string_ex(domain);
-
- VPOPMAILLS_FETCH();
- VPOPMAILG(vpopmail_open) = 1;
-
- retval = valias_delete(Z_STRVAL_PP(user), Z_STRVAL_PP(domain));
-
- VPOPMAILG(vpopmail_errno)=retval;
-
- if (retval == VA_SUCCESS) {
- RETURN_TRUE;
- } else {
- php_error(E_WARNING, "vpopmail error: %s", verror(retval));
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-#ifdef VALIAS
-/* {{{ proto bool vpopmail_alias_del_domain(string domain)
- deletes all virtual aliases of a domain */
-PHP_FUNCTION(vpopmail_alias_del_domain)
-{
- zval **domain;
- int retval;
-
- if (ZEND_NUM_ARGS() != 1
- || zend_get_parameters_ex(ZEND_NUM_ARGS(), &domain) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_string_ex(domain);
-
- VPOPMAILLS_FETCH();
- VPOPMAILG(vpopmail_open) = 1;
-
- retval = valias_delete_domain(Z_STRVAL_PP(domain));
-
- VPOPMAILG(vpopmail_errno)=retval;
-
- if (retval == VA_SUCCESS) {
- RETURN_TRUE;
- } else {
- php_error(E_WARNING, "vpopmail error: %s", verror(retval));
- RETURN_FALSE;
- }
-}
-/* }}} */
-#endif
-
-/* {{{ proto array vpopmail_alias_get(string alias, string domain)
- get all lines of an alias for a domain */
-PHP_FUNCTION(vpopmail_alias_get)
-{
- zval **alias;
- zval **domain;
- int retval;
- char *talias;
- uint index=0;
-
- if (ZEND_NUM_ARGS() != 2
- || zend_get_parameters_ex(ZEND_NUM_ARGS(), &alias, &domain) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_string_ex(alias);
- convert_to_string_ex(domain);
-
- VPOPMAILLS_FETCH();
- VPOPMAILG(vpopmail_open) = 1;
-
- if (array_init(return_value)!=SUCCESS) {
- zend_error(E_ERROR,"unable to create array");
- RETURN_FALSE;
- }
-
- talias=valias_select(Z_STRVAL_PP(alias), Z_STRVAL_PP(domain));
- while (talias) {
- add_index_string(return_value,index++,talias,1);
- talias=valias_select_next();
- }
-}
-/* }}} */
-
-/* {{{ proto array vpopmail_alias_get_all(string domain)
- get all lines of an alias for a domain */
-PHP_FUNCTION(vpopmail_alias_get_all)
-{
- zval **domain;
- int retval;
- char *talias;
- char tpath[1024];
- uint index=0;
-
- if (ZEND_NUM_ARGS() != 1
- || zend_get_parameters_ex(ZEND_NUM_ARGS(), &domain) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_string_ex(domain);
-
- VPOPMAILLS_FETCH();
- VPOPMAILG(vpopmail_open) = 1;
-
- if (array_init(return_value)!=SUCCESS) {
- zend_error(E_ERROR,"unable to create array");
- RETURN_FALSE;
- }
-
- talias=valias_select_all(tpath, Z_STRVAL_PP(domain));
- while (talias) {
- strcat(tpath,":");
- strcat(tpath,talias);
- add_index_string(return_value,index++,tpath,1);
- talias=valias_select_all_next(tpath);
- }
-}
-/* }}} */
-
-#endif
-
-/*
- * Error handling helper
- */
-
-/* {{{ proto string vpopmail_error(void)
- Get text message for last vpopmail error. Returns string */
-PHP_FUNCTION(vpopmail_error)
-{
- if (ZEND_NUM_ARGS() != 0)
- WRONG_PARAM_COUNT;
-
- VPOPMAILLS_FETCH();
-
- RETURN_STRING(verror(VPOPMAILG(vpopmail_errno)),1);
-}
-/* }}} */
-
-#endif HAVE_VPOPMAIL
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/vpopmail/php_vpopmail.h b/ext/vpopmail/php_vpopmail.h
deleted file mode 100644
index 10c1b7c8cf..0000000000
--- a/ext/vpopmail/php_vpopmail.h
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: David Croft <david@infotrek.co.uk> |
- | Boian Bonev <boian@bonev.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef PHP_VPOPMAIL_H
-#define PHP_VPOPMAIL_H
-
-#if HAVE_VPOPMAIL
-
-extern zend_module_entry vpopmail_module_entry;
-#define phpext_vpopmail_ptr &vpopmail_module_entry
-
-#ifdef PHP_WIN32
-#define PHP_VPOPMAIL_API __declspec(dllexport)
-#else
-#define PHP_VPOPMAIL_API
-#endif
-
-PHP_MINIT_FUNCTION(vpopmail);
-PHP_MSHUTDOWN_FUNCTION(vpopmail);
-PHP_RINIT_FUNCTION(vpopmail);
-PHP_RSHUTDOWN_FUNCTION(vpopmail);
-PHP_MINFO_FUNCTION(vpopmail);
-
-/* domain management - lib call */
-PHP_FUNCTION(vpopmail_add_domain);
-PHP_FUNCTION(vpopmail_del_domain);
-PHP_FUNCTION(vpopmail_add_alias_domain);
-/* domain management - exec */
-PHP_FUNCTION(vpopmail_add_domain_ex);
-PHP_FUNCTION(vpopmail_del_domain_ex);
-PHP_FUNCTION(vpopmail_add_alias_domain_ex);
-/* user management */
-PHP_FUNCTION(vpopmail_add_user);
-PHP_FUNCTION(vpopmail_del_user);
-PHP_FUNCTION(vpopmail_passwd);
-PHP_FUNCTION(vpopmail_set_user_quota);
-PHP_FUNCTION(vpopmail_auth_user);
-/* alias management */
-#if HAVE_VPOPMAIL_VALIAS
-PHP_FUNCTION(vpopmail_alias_add);
-PHP_FUNCTION(vpopmail_alias_del);
-PHP_FUNCTION(vpopmail_alias_del_domain);
-PHP_FUNCTION(vpopmail_alias_get);
-PHP_FUNCTION(vpopmail_alias_get_all);
-#endif
-/* error handling */
-PHP_FUNCTION(vpopmail_error);
-
-/* defines for vpopmail command line tool names */
-#define VPOPMAIL_ADDD "/vadddomain "
-#define VPOPMAIL_DELD "/vdeldomain "
-#define VPOPMAIL_ADAD "/vaddaliasdomain "
-
-ZEND_BEGIN_MODULE_GLOBALS(vpopmail)
- int vpopmail_open;
- int vpopmail_errno;
-ZEND_END_MODULE_GLOBALS(vpopmail)
-
-#ifdef ZTS
-#define VPOPMAILG(v) (vpopmail_globals->v)
-#define VPOPMAILLS_FETCH() php_vpopmail_globals *vpopmail_globals = ts_resource(gd_vpopmail_id)
-#else
-#define VPOPMAILG(v) (vpopmail_globals.v)
-#define VPOPMAILLS_FETCH()
-#endif
-
-#else
-
-#define phpext_vpopmail_ptr NULL
-
-#endif
-
-#endif /* PHP_VPOPMAIL_H */
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/wddx/CREDITS b/ext/wddx/CREDITS
deleted file mode 100644
index 4c98513048..0000000000
--- a/ext/wddx/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-WDDX
-Andrei Zmievski
diff --git a/ext/wddx/Makefile.in b/ext/wddx/Makefile.in
deleted file mode 100644
index a5ec87c5fb..0000000000
--- a/ext/wddx/Makefile.in
+++ /dev/null
@@ -1,5 +0,0 @@
-
-LTLIBRARY_NAME = libwddx.la
-LTLIBRARY_SOURCES = wddx.c
-
-include $(top_srcdir)/build/dynlib.mk
diff --git a/ext/wddx/config.m4 b/ext/wddx/config.m4
deleted file mode 100644
index 347ad117e9..0000000000
--- a/ext/wddx/config.m4
+++ /dev/null
@@ -1,14 +0,0 @@
-dnl $Id$
-dnl config.m4 for extension wddx
-
-PHP_ARG_ENABLE(wddx,for WDDX support,
-[ --enable-wddx Enable WDDX support])
-
-if test "$PHP_WDDX" != "no"; then
- if test "$ext_shared" != "yes" && test "$enable_xml" = "no"; then
- AC_MSG_WARN(Activating XML)
- enable_xml=yes
- fi
- AC_DEFINE(HAVE_WDDX, 1, [ ])
- PHP_EXTENSION(wddx, $ext_shared)
-fi
diff --git a/ext/wddx/php_wddx.h b/ext/wddx/php_wddx.h
deleted file mode 100644
index 6c60fca201..0000000000
--- a/ext/wddx/php_wddx.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andrei Zmievski <andrei@ispi.net> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifndef PHP_WDDX_H
-#define PHP_WDDX_H
-
-#if HAVE_WDDX
-
-#include <expat.h>
-
-extern zend_module_entry wddx_module_entry;
-#define wddx_module_ptr &wddx_module_entry
-
-PHP_FUNCTION(wddx_serialize_value);
-PHP_FUNCTION(wddx_serialize_vars);
-PHP_FUNCTION(wddx_packet_start);
-PHP_FUNCTION(wddx_packet_end);
-PHP_FUNCTION(wddx_add_vars);
-PHP_FUNCTION(wddx_deserialize);
-
-#else
-
-#define wddx_module_ptr NULL
-
-#endif /* HAVE_WDDX */
-
-#define phpext_wddx_ptr wddx_module_ptr
-
-#endif /* !PHP_WDDX_H */
diff --git a/ext/wddx/php_wddx_api.h b/ext/wddx/php_wddx_api.h
deleted file mode 100644
index bc546ae190..0000000000
--- a/ext/wddx/php_wddx_api.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Andrei Zmievski <andrei@ispi.net> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifndef PHP_WDDX_API_H
-#define PHP_WDDX_API_H
-
-#include "ext/standard/php_smart_str.h"
-
-#define WDDX_ARRAY_S "<array length='%d'>"
-#define WDDX_ARRAY_E "</array>"
-#define WDDX_BINARY_S "<binary>"
-#define WDDX_BINARY_E "</binary>"
-#define WDDX_BOOLEAN "<boolean value='%s'/>"
-#define WDDX_CHAR "<char code='%02X'/>"
-#define WDDX_COMMENT_S "<comment>"
-#define WDDX_COMMENT_E "</comment>"
-#define WDDX_DATA_S "<data>"
-#define WDDX_DATA_E "</data>"
-#define WDDX_HEADER "<header/>"
-#define WDDX_HEADER_S "<header>"
-#define WDDX_HEADER_E "</header>"
-#define WDDX_NULL "<null/>"
-#define WDDX_NUMBER "<number>%s</number>"
-#define WDDX_PACKET_S "<wddxPacket version='1.0'>"
-#define WDDX_PACKET_E "</wddxPacket>"
-#define WDDX_STRING_S "<string>"
-#define WDDX_STRING_E "</string>"
-#define WDDX_STRUCT_S "<struct>"
-#define WDDX_STRUCT_E "</struct>"
-#define WDDX_VAR_S "<var name='%s'>"
-#define WDDX_VAR_E "</var>"
-
-#define php_wddx_add_chunk(packet, str) smart_str_appends(packet, str)
-#define php_wddx_add_chunk_ex(packet, str, len) smart_str_appendl(packet, str, len)
-#define php_wddx_add_chunk_static(packet, str) smart_str_appendl(packet, str, sizeof(str)-1)
-
-typedef smart_str wddx_packet;
-
-wddx_packet* php_wddx_constructor(void);
-void php_wddx_destructor(wddx_packet *packet);
-
-void php_wddx_packet_start(wddx_packet *packet, char *comment, int comment_len);
-void php_wddx_packet_end(wddx_packet *packet);
-
-void php_wddx_serialize_var(wddx_packet *packet, zval *var, char *name, int name_len);
-int php_wddx_deserialize_ex(char *, int, zval *return_value);
-#define php_wddx_gather(packet) estrndup(packet->c, packet->len)
-
-#endif /* PHP_WDDX_API_H */
diff --git a/ext/wddx/wddx.c b/ext/wddx/wddx.c
deleted file mode 100644
index 365f6cecb6..0000000000
--- a/ext/wddx/wddx.c
+++ /dev/null
@@ -1,1211 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andrei Zmievski <andrei@ispi.net> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#include "php.h"
-#include "php_wddx.h"
-
-#if HAVE_WDDX
-
-#include "php_wddx_api.h"
-#define PHP_XML_INTERNAL
-#include "ext/xml/php_xml.h"
-#include "ext/standard/php_incomplete_class.h"
-#include "ext/standard/base64.h"
-#include "ext/standard/info.h"
-#include "ext/standard/php_smart_str.h"
-#include "ext/standard/html.h"
-
-#define WDDX_BUF_LEN 256
-#define PHP_CLASS_NAME_VAR "php_class_name"
-
-#define EL_ARRAY "array"
-#define EL_BINARY "binary"
-#define EL_BOOLEAN "boolean"
-#define EL_CHAR "char"
-#define EL_CHAR_CODE "code"
-#define EL_NULL "null"
-#define EL_NUMBER "number"
-#define EL_PACKET "wddxPacket"
-#define EL_STRING "string"
-#define EL_STRUCT "struct"
-#define EL_VALUE "value"
-#define EL_VAR "var"
-#define EL_VAR_NAME "name"
-#define EL_VERSION "version"
-
-#define php_wddx_deserialize(a,b) \
- php_wddx_deserialize_ex((a)->value.str.val, (a)->value.str.len, (b))
-
-#define SET_STACK_VARNAME \
- if (stack->varname) { \
- ent.varname = estrdup(stack->varname); \
- efree(stack->varname); \
- stack->varname = NULL; \
- } else \
- ent.varname = NULL; \
-
-static int le_wddx;
-
-typedef struct {
- zval *data;
- enum {
- ST_ARRAY,
- ST_BOOLEAN,
- ST_NULL,
- ST_NUMBER,
- ST_STRING,
- ST_BINARY,
- ST_STRUCT
- } type;
- char *varname;
-} st_entry;
-
-typedef struct {
- int top, max;
- char *varname;
- void **elements;
-} wddx_stack;
-
-
-static void php_wddx_process_data(void *user_data, const char *s, int len);
-
-/* {{{ wddx_functions[]
- */
-function_entry wddx_functions[] = {
- PHP_FE(wddx_serialize_value, NULL)
- PHP_FE(wddx_serialize_vars, NULL)
- PHP_FE(wddx_packet_start, NULL)
- PHP_FE(wddx_packet_end, NULL)
- PHP_FE(wddx_add_vars, NULL)
- PHP_FE(wddx_deserialize, NULL)
- {NULL, NULL, NULL}
-};
-/* }}} */
-
-PHP_MINIT_FUNCTION(wddx);
-PHP_MINFO_FUNCTION(wddx);
-
-/* {{{ wddx_module_entry
- */
-zend_module_entry wddx_module_entry = {
- "wddx",
- wddx_functions,
- PHP_MINIT(wddx),
- NULL,
- NULL,
- NULL,
- PHP_MINFO(wddx),
- STANDARD_MODULE_PROPERTIES
-};
-/* }}} */
-
-/* {{{ wddx_stack_init
- */
-static int wddx_stack_init(wddx_stack *stack)
-{
- stack->top = 0;
- stack->elements = (void **) emalloc(sizeof(void **) * STACK_BLOCK_SIZE);
- if (!stack->elements) {
- return FAILURE;
- } else {
- stack->max = STACK_BLOCK_SIZE;
- stack->varname = NULL;
- return SUCCESS;
- }
-}
-/* }}} */
-
-/* {{{ wddx_stack_push
- */
-static int wddx_stack_push(wddx_stack *stack, void *element, int size)
-{
- if (stack->top >= stack->max) { /* we need to allocate more memory */
- stack->elements = (void **) erealloc(stack->elements,
- (sizeof(void **) * (stack->max += STACK_BLOCK_SIZE)));
- if (!stack->elements) {
- return FAILURE;
- }
- }
- stack->elements[stack->top] = (void *) emalloc(size);
- memcpy(stack->elements[stack->top], element, size);
- return stack->top++;
-}
-/* }}} */
-
-/* {{{ wddx_stack_top
- */
-static int wddx_stack_top(wddx_stack *stack, void **element)
-{
- if (stack->top > 0) {
- *element = stack->elements[stack->top - 1];
- return SUCCESS;
- } else {
- *element = NULL;
- return FAILURE;
- }
-}
-/* }}} */
-
-/* {{{ wddx_stack_is_empty
- */
-static int wddx_stack_is_empty(wddx_stack *stack)
-{
- if (stack->top == 0) {
- return 1;
- } else {
- return 0;
- }
-}
-/* }}} */
-
-/* {{{ wddx_stack_destroy
- */
-static int wddx_stack_destroy(wddx_stack *stack)
-{
- register int i;
-
- if (stack->elements) {
- for (i = 0; i < stack->top; i++) {
- if (((st_entry *)stack->elements[i])->data)
- {
- zval_dtor(((st_entry *)stack->elements[i])->data);
- efree(((st_entry *)stack->elements[i])->data);
- }
- if (((st_entry *)stack->elements[i])->varname)
- efree(((st_entry *)stack->elements[i])->varname);
- efree(stack->elements[i]);
- }
- efree(stack->elements);
- }
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ release_wddx_packet_rsrc
- */
-static void release_wddx_packet_rsrc(zend_rsrc_list_entry *rsrc)
-{
- smart_str *str = (smart_str *)rsrc->ptr;
- smart_str_free(str);
- efree(str);
-}
-/* }}} */
-
-#include "ext/session/php_session.h"
-
-/* {{{ PS_SERIALIZER_ENCODE_FUNC
- */
-PS_SERIALIZER_ENCODE_FUNC(wddx)
-{
- wddx_packet *packet;
- PS_ENCODE_VARS;
-
- packet = php_wddx_constructor();
- if (!packet)
- return FAILURE;
-
- php_wddx_packet_start(packet, NULL, 0);
- php_wddx_add_chunk_static(packet, WDDX_STRUCT_S);
-
- PS_ENCODE_LOOP(
- php_wddx_serialize_var(packet, *struc, key, key_length);
- );
-
- php_wddx_add_chunk_static(packet, WDDX_STRUCT_E);
- php_wddx_packet_end(packet);
- *newstr = php_wddx_gather(packet);
- php_wddx_destructor(packet);
-
- if (newlen)
- *newlen = strlen(*newstr);
-
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PS_SERIALIZER_DECODE_FUNC
- */
-PS_SERIALIZER_DECODE_FUNC(wddx)
-{
- zval *retval;
- zval **ent;
- char *key;
- ulong key_length;
- char tmp[128];
- ulong idx;
- int hash_type;
- int ret;
-
- if (vallen == 0)
- return SUCCESS;
-
- MAKE_STD_ZVAL(retval);
-
- if ((ret = php_wddx_deserialize_ex((char *)val, vallen, retval)) == SUCCESS) {
-
- for (zend_hash_internal_pointer_reset(Z_ARRVAL_P(retval));
- zend_hash_get_current_data(Z_ARRVAL_P(retval), (void **) &ent) == SUCCESS;
- zend_hash_move_forward(Z_ARRVAL_P(retval))) {
- hash_type = zend_hash_get_current_key_ex(Z_ARRVAL_P(retval), &key, &key_length, &idx, 0, NULL);
-
- switch (hash_type) {
- case HASH_KEY_IS_LONG:
- sprintf(tmp, "%ld", idx);
- key = tmp;
- /* fallthru */
- case HASH_KEY_IS_STRING:
- php_set_session_var(key, key_length-1, *ent, NULL PSLS_CC);
- PS_ADD_VAR(key);
- }
- }
- }
-
- zval_ptr_dtor(&retval);
-
- return ret;
-}
-/* }}} */
-
-/* {{{ PHP_MINIT_FUNCTION
- */
-PHP_MINIT_FUNCTION(wddx)
-{
- le_wddx = zend_register_list_destructors_ex(release_wddx_packet_rsrc, NULL, "wddx", module_number);
- php_session_register_serializer("wddx",
- PS_SERIALIZER_ENCODE_NAME(wddx),
- PS_SERIALIZER_DECODE_NAME(wddx));
-
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_MINFO_FUNCTION
- */
-PHP_MINFO_FUNCTION(wddx)
-{
- php_info_print_table_start();
- php_info_print_table_row(2, "WDDX Support", "enabled" );
- php_info_print_table_end();
-}
-/* }}} */
-
-/* {{{ php_wddx_packet_start
- */
-void php_wddx_packet_start(wddx_packet *packet, char *comment, int comment_len)
-{
- php_wddx_add_chunk_static(packet, WDDX_PACKET_S);
- if (comment) {
- php_wddx_add_chunk_static(packet, WDDX_HEADER_S);
- php_wddx_add_chunk_static(packet, WDDX_COMMENT_S);
- php_wddx_add_chunk_ex(packet, comment, comment_len);
- php_wddx_add_chunk_static(packet, WDDX_COMMENT_E);
- php_wddx_add_chunk_static(packet, WDDX_HEADER_E);
- } else
- php_wddx_add_chunk_static(packet, WDDX_HEADER);
- php_wddx_add_chunk_static(packet, WDDX_DATA_S);
-}
-/* }}} */
-
-/* {{{ php_wddx_packet_end
- */
-void php_wddx_packet_end(wddx_packet *packet)
-{
- php_wddx_add_chunk_static(packet, WDDX_DATA_E);
- php_wddx_add_chunk_static(packet, WDDX_PACKET_E);
-}
-/* }}} */
-
-#define FLUSH_BUF() \
- if (l > 0) { \
- php_wddx_add_chunk_ex(packet, buf, l); \
- l = 0; \
- }
-
-/* {{{ php_wddx_serialize_string
- */
-static void php_wddx_serialize_string(wddx_packet *packet, zval *var)
-{
- char *buf,
- *p,
- *vend,
- control_buf[WDDX_BUF_LEN];
- int l;
-
- php_wddx_add_chunk_static(packet, WDDX_STRING_S);
-
- if (Z_STRLEN_P(var) > 0) {
- l = 0;
- vend = Z_STRVAL_P(var) + Z_STRLEN_P(var);
- buf = (char *)emalloc(Z_STRLEN_P(var) + 1);
-
- for(p = Z_STRVAL_P(var); p != vend; p++) {
- switch (*p) {
- case '<':
- FLUSH_BUF();
- php_wddx_add_chunk_static(packet, "&lt;");
- break;
-
- case '&':
- FLUSH_BUF();
- php_wddx_add_chunk_static(packet, "&amp;");
- break;
-
- case '>':
- FLUSH_BUF();
- php_wddx_add_chunk_static(packet, "&gt;");
- break;
-
- default:
- if (iscntrl((int)*p)) {
- FLUSH_BUF();
- sprintf(control_buf, WDDX_CHAR, *p);
- php_wddx_add_chunk(packet, control_buf);
- } else
- buf[l++] = *p;
- break;
- }
- }
-
- FLUSH_BUF();
- efree(buf);
- }
-
- php_wddx_add_chunk_static(packet, WDDX_STRING_E);
-}
-/* }}} */
-
-/* {{{ php_wddx_serialize_number
- */
-static void php_wddx_serialize_number(wddx_packet *packet, zval *var)
-{
- char tmp_buf[WDDX_BUF_LEN];
- zval tmp;
-
- tmp = *var;
- zval_copy_ctor(&tmp);
- convert_to_string(&tmp);
- sprintf(tmp_buf, WDDX_NUMBER, Z_STRVAL(tmp));
- zval_dtor(&tmp);
-
- php_wddx_add_chunk(packet, tmp_buf);
-}
-/* }}} */
-
-/* {{{ php_wddx_serialize_boolean
- */
-static void php_wddx_serialize_boolean(wddx_packet *packet, zval *var)
-{
- char tmp_buf[WDDX_BUF_LEN];
-
- sprintf(tmp_buf, WDDX_BOOLEAN, Z_LVAL_P(var) ? "true" : "false");
- php_wddx_add_chunk(packet, tmp_buf);
-}
-/* }}} */
-
-/* {{{ php_wddx_serialize_unset
- */
-static void php_wddx_serialize_unset(wddx_packet *packet)
-{
- php_wddx_add_chunk_static(packet, WDDX_NULL);
-}
-/* }}} */
-
-/* {{{ php_wddx_serialize_object
- */
-static void php_wddx_serialize_object(wddx_packet *packet, zval *obj)
-{
- zval **ent, *fname, **varname;
- zval *retval = NULL;
- char *key;
- ulong idx;
- char tmp_buf[WDDX_BUF_LEN];
- CLS_FETCH();
- BLS_FETCH();
-
- MAKE_STD_ZVAL(fname);
- ZVAL_STRING(fname, "__sleep", 1);
-
- /*
- * We try to call __sleep() method on object. It's supposed to return an
- * array of property names to be serialized.
- */
- if (call_user_function_ex(CG(function_table), &obj, fname, &retval, 0, 0, 1, NULL) == SUCCESS) {
- if (retval && HASH_OF(retval)) {
- PHP_CLASS_ATTRIBUTES;
-
- PHP_SET_CLASS_ATTRIBUTES(obj);
-
- php_wddx_add_chunk_static(packet, WDDX_STRUCT_S);
- sprintf(tmp_buf, WDDX_VAR_S, PHP_CLASS_NAME_VAR);
- php_wddx_add_chunk(packet, tmp_buf);
- php_wddx_add_chunk_static(packet, WDDX_STRING_S);
- php_wddx_add_chunk_ex(packet, class_name, name_len);
- php_wddx_add_chunk_static(packet, WDDX_STRING_E);
- php_wddx_add_chunk_static(packet, WDDX_VAR_E);
-
- PHP_CLEANUP_CLASS_ATTRIBUTES();
-
- for (zend_hash_internal_pointer_reset(HASH_OF(retval));
- zend_hash_get_current_data(HASH_OF(retval), (void **)&varname) == SUCCESS;
- zend_hash_move_forward(HASH_OF(retval))) {
- if (Z_TYPE_PP(varname) != IS_STRING) {
- php_error(E_NOTICE, "__sleep should return an array only containing the names of instance-variables to serialize.");
- continue;
- }
-
- if (zend_hash_find(HASH_OF(obj), Z_STRVAL_PP(varname), Z_STRLEN_PP(varname)+1, (void **)&ent) == SUCCESS) {
- php_wddx_serialize_var(packet, *ent, Z_STRVAL_PP(varname), Z_STRLEN_PP(varname));
- }
- }
-
- php_wddx_add_chunk_static(packet, WDDX_STRUCT_E);
- }
- } else {
- ulong key_len;
-
- PHP_CLASS_ATTRIBUTES;
-
- PHP_SET_CLASS_ATTRIBUTES(obj);
-
- php_wddx_add_chunk_static(packet, WDDX_STRUCT_S);
- sprintf(tmp_buf, WDDX_VAR_S, PHP_CLASS_NAME_VAR);
- php_wddx_add_chunk(packet, tmp_buf);
- php_wddx_add_chunk_static(packet, WDDX_STRING_S);
- php_wddx_add_chunk_ex(packet, class_name, name_len);
- php_wddx_add_chunk_static(packet, WDDX_STRING_E);
- php_wddx_add_chunk_static(packet, WDDX_VAR_E);
-
- PHP_CLEANUP_CLASS_ATTRIBUTES();
-
- for (zend_hash_internal_pointer_reset(HASH_OF(obj));
- zend_hash_get_current_data(HASH_OF(obj), (void**)&ent) == SUCCESS;
- zend_hash_move_forward(HASH_OF(obj))) {
- if (*ent == obj)
- continue;
-
- if (zend_hash_get_current_key_ex(HASH_OF(obj), &key, &key_len, &idx, 0, NULL) == HASH_KEY_IS_STRING) {
- php_wddx_serialize_var(packet, *ent, key, key_len);
- } else {
- key_len = sprintf(tmp_buf, "%ld", idx);
- php_wddx_serialize_var(packet, *ent, tmp_buf, key_len);
- }
- }
- php_wddx_add_chunk_static(packet, WDDX_STRUCT_E);
- }
-
- zval_dtor(fname);
- FREE_ZVAL(fname);
-
- if (retval)
- zval_ptr_dtor(&retval);
-}
-/* }}} */
-
-/* {{{ php_wddx_serialize_array
- */
-static void php_wddx_serialize_array(wddx_packet *packet, zval *arr)
-{
- zval **ent;
- char *key;
- ulong key_len;
- int is_struct = 0, ent_type;
- ulong idx;
- HashTable *target_hash;
- char tmp_buf[WDDX_BUF_LEN];
- ulong ind = 0;
- int type;
-
- target_hash = HASH_OF(arr);
-
- for (zend_hash_internal_pointer_reset(target_hash);
- zend_hash_get_current_data(target_hash, (void**)&ent) == SUCCESS;
- zend_hash_move_forward(target_hash)) {
-
- type = zend_hash_get_current_key(target_hash, &key, &idx, 0);
-
- if (type == HASH_KEY_IS_STRING) {
- is_struct = 1;
- break;
- }
-
- if (idx != ind) {
- is_struct = 1;
- break;
- }
-
- ind++;
- }
-
- if (is_struct) {
- php_wddx_add_chunk_static(packet, WDDX_STRUCT_S);
- } else {
- sprintf(tmp_buf, WDDX_ARRAY_S, zend_hash_num_elements(target_hash));
- php_wddx_add_chunk(packet, tmp_buf);
- }
-
- for (zend_hash_internal_pointer_reset(target_hash);
- zend_hash_get_current_data(target_hash, (void**)&ent) == SUCCESS;
- zend_hash_move_forward(target_hash)) {
- if (*ent == arr)
- continue;
-
- if (is_struct) {
- ent_type = zend_hash_get_current_key_ex(target_hash, &key, &key_len, &idx, 0, NULL);
-
- if (ent_type == HASH_KEY_IS_STRING) {
- php_wddx_serialize_var(packet, *ent, key, key_len);
- } else {
- key_len = sprintf(tmp_buf, "%ld", idx);
- php_wddx_serialize_var(packet, *ent, tmp_buf, key_len);
- }
- } else
- php_wddx_serialize_var(packet, *ent, NULL, 0);
- }
-
- if (is_struct) {
- php_wddx_add_chunk_static(packet, WDDX_STRUCT_E);
- } else {
- php_wddx_add_chunk_static(packet, WDDX_ARRAY_E);
- }
-}
-/* }}} */
-
-/* {{{ php_wddx_serialize_var
- */
-void php_wddx_serialize_var(wddx_packet *packet, zval *var, char *name, int name_len)
-{
- char tmp_buf[WDDX_BUF_LEN];
- char *name_esc;
- int name_esc_len;
-
- if (name) {
- name_esc = php_escape_html_entities(name, name_len, &name_esc_len, 0, ENT_QUOTES, NULL);
- sprintf(tmp_buf, WDDX_VAR_S, name_esc);
- php_wddx_add_chunk(packet, tmp_buf);
- efree(name_esc);
- }
-
- switch(Z_TYPE_P(var)) {
- case IS_STRING:
- php_wddx_serialize_string(packet, var);
- break;
-
- case IS_LONG:
- case IS_DOUBLE:
- php_wddx_serialize_number(packet, var);
- break;
-
- case IS_BOOL:
- php_wddx_serialize_boolean(packet, var);
- break;
-
- case IS_NULL:
- php_wddx_serialize_unset(packet);
- break;
-
- case IS_ARRAY:
- php_wddx_serialize_array(packet, var);
- break;
-
- case IS_OBJECT:
- php_wddx_serialize_object(packet, var);
- break;
- }
-
- if (name) {
- php_wddx_add_chunk_static(packet, WDDX_VAR_E);
- }
-}
-/* }}} */
-
-/* {{{ php_wddx_add_var
- */
-static void php_wddx_add_var(wddx_packet *packet, zval *name_var)
-{
- zval **val;
- HashTable *target_hash;
- ELS_FETCH();
-
- if (Z_TYPE_P(name_var) == IS_STRING)
- {
- if (zend_hash_find(EG(active_symbol_table), Z_STRVAL_P(name_var),
- Z_STRLEN_P(name_var)+1, (void**)&val) != FAILURE) {
- php_wddx_serialize_var(packet, *val, Z_STRVAL_P(name_var), Z_STRLEN_P(name_var));
- }
- }
- else if (Z_TYPE_P(name_var) == IS_ARRAY || Z_TYPE_P(name_var) == IS_OBJECT)
- {
- target_hash = HASH_OF(name_var);
-
- zend_hash_internal_pointer_reset(target_hash);
-
- while(zend_hash_get_current_data(target_hash, (void**)&val) == SUCCESS) {
- php_wddx_add_var(packet, *val);
-
- zend_hash_move_forward(target_hash);
- }
- }
-}
-/* }}} */
-
-/* {{{ php_wddx_push_element
- */
-static void php_wddx_push_element(void *user_data, const char *name, const char **atts)
-{
- st_entry ent;
- wddx_stack *stack = (wddx_stack *)user_data;
-
- if (!strcmp(name, EL_PACKET)) {
- int i;
-
- for (i=0; atts[i]; i++) {
- if (!strcmp(atts[i], EL_VERSION)) {
- /* nothing for now */
- }
- }
- } else if (!strcmp(name, EL_STRING)) {
- ent.type = ST_STRING;
- SET_STACK_VARNAME;
-
- ALLOC_ZVAL(ent.data);
- INIT_PZVAL(ent.data);
- Z_TYPE_P(ent.data) = IS_STRING;
- Z_STRVAL_P(ent.data) = empty_string;
- Z_STRLEN_P(ent.data) = 0;
- wddx_stack_push((wddx_stack *)stack, &ent, sizeof(st_entry));
- } else if (!strcmp(name, EL_BINARY)) {
- ent.type = ST_BINARY;
- SET_STACK_VARNAME;
-
- ALLOC_ZVAL(ent.data);
- INIT_PZVAL(ent.data);
- Z_TYPE_P(ent.data) = IS_STRING;
- Z_STRVAL_P(ent.data) = empty_string;
- Z_STRLEN_P(ent.data) = 0;
- wddx_stack_push((wddx_stack *)stack, &ent, sizeof(st_entry));
- } else if (!strcmp(name, EL_CHAR)) {
- int i;
- char tmp_buf[2];
-
- for (i=0; atts[i]; i++) {
- if (!strcmp(atts[i], EL_CHAR_CODE) && atts[i+1]) {
- sprintf(tmp_buf, "%c", (char)strtol(atts[i+1], NULL, 16));
- php_wddx_process_data(user_data, tmp_buf, strlen(tmp_buf));
- }
- }
- } else if (!strcmp(name, EL_NUMBER)) {
- ent.type = ST_NUMBER;
- SET_STACK_VARNAME;
-
- ALLOC_ZVAL(ent.data);
- INIT_PZVAL(ent.data);
- Z_TYPE_P(ent.data) = IS_LONG;
- wddx_stack_push((wddx_stack *)stack, &ent, sizeof(st_entry));
- } else if (!strcmp(name, EL_BOOLEAN)) {
- int i;
-
- for (i=0; atts[i]; i++) {
- if (!strcmp(atts[i], EL_VALUE) && atts[i+1]) {
- ent.type = ST_BOOLEAN;
- SET_STACK_VARNAME;
-
- ALLOC_ZVAL(ent.data);
- INIT_PZVAL(ent.data);
- Z_TYPE_P(ent.data) = IS_BOOL;
- wddx_stack_push((wddx_stack *)stack, &ent, sizeof(st_entry));
- php_wddx_process_data(user_data, atts[i+1], strlen(atts[i+1]));
- }
- }
- } else if (!strcmp(name, EL_NULL)) {
- ent.type = ST_NULL;
- SET_STACK_VARNAME;
-
- ALLOC_ZVAL(ent.data);
- INIT_PZVAL(ent.data);
- ZVAL_NULL(ent.data);
-
- wddx_stack_push((wddx_stack *)stack, &ent, sizeof(st_entry));
- } else if (!strcmp(name, EL_ARRAY)) {
- ent.type = ST_ARRAY;
- SET_STACK_VARNAME;
-
- ALLOC_ZVAL(ent.data);
- array_init(ent.data);
- INIT_PZVAL(ent.data);
- wddx_stack_push((wddx_stack *)stack, &ent, sizeof(st_entry));
- } else if (!strcmp(name, EL_STRUCT)) {
- ent.type = ST_STRUCT;
- SET_STACK_VARNAME;
-
- ALLOC_ZVAL(ent.data);
- array_init(ent.data);
- INIT_PZVAL(ent.data);
- wddx_stack_push((wddx_stack *)stack, &ent, sizeof(st_entry));
- } else if (!strcmp(name, EL_VAR)) {
- int i;
-
- for (i=0; atts[i]; i++) {
- if (!strcmp(atts[i], EL_VAR_NAME) && atts[i+1]) {
- char *decoded_value;
- int decoded_len;
- decoded_value = xml_utf8_decode(atts[i+1],strlen(atts[i+1]),&decoded_len,"ISO-8859-1");
- stack->varname = decoded_value;
- }
- }
- }
-}
-/* }}} */
-
-/* {{{ php_wddx_pop_element
- */
-static void php_wddx_pop_element(void *user_data, const char *name)
-{
- st_entry *ent1, *ent2;
- wddx_stack *stack = (wddx_stack *)user_data;
- HashTable *target_hash;
- zend_class_entry *ce;
- zval *obj;
- zval *tmp;
- ELS_FETCH();
-
- if (stack->top == 0)
- return;
-
- if (!strcmp(name, EL_STRING) || !strcmp(name, EL_NUMBER) ||
- !strcmp(name, EL_BOOLEAN) || !strcmp(name, EL_NULL) ||
- !strcmp(name, EL_ARRAY) || !strcmp(name, EL_STRUCT) ||
- !strcmp(name, EL_BINARY)) {
- wddx_stack_top(stack, (void**)&ent1);
-
- if (!strcmp(name, EL_BINARY)) {
- int new_len=0;
- unsigned char *new_str;
-
- new_str = php_base64_decode(Z_STRVAL_P(ent1->data), Z_STRLEN_P(ent1->data), &new_len);
- STR_FREE(Z_STRVAL_P(ent1->data));
- Z_STRVAL_P(ent1->data) = new_str;
- Z_STRLEN_P(ent1->data) = new_len;
- }
-
- /* Call __wakeup() method on the object. */
- if (Z_TYPE_P(ent1->data) == IS_OBJECT) {
- zval *fname, *retval = NULL;
-
- MAKE_STD_ZVAL(fname);
- ZVAL_STRING(fname, "__wakeup", 1);
-
- call_user_function_ex(NULL, &ent1->data, fname, &retval, 0, 0, 0, NULL);
-
- zval_dtor(fname);
- FREE_ZVAL(fname);
- if (retval)
- zval_ptr_dtor(&retval);
- }
-
- if (stack->top > 1) {
- stack->top--;
- wddx_stack_top(stack, (void**)&ent2);
- if (Z_TYPE_P(ent2->data) == IS_ARRAY || Z_TYPE_P(ent2->data) == IS_OBJECT) {
- target_hash = HASH_OF(ent2->data);
-
- if (ent1->varname) {
- if (!strcmp(ent1->varname, PHP_CLASS_NAME_VAR) &&
- Z_TYPE_P(ent1->data) == IS_STRING && Z_STRLEN_P(ent1->data)) {
- zend_bool incomplete_class = 0;
-
- zend_str_tolower(Z_STRVAL_P(ent1->data), Z_STRLEN_P(ent1->data));
- if (zend_hash_find(EG(class_table), Z_STRVAL_P(ent1->data),
- Z_STRLEN_P(ent1->data)+1, (void **) &ce)==FAILURE) {
- BLS_FETCH();
-
- incomplete_class = 1;
- ce = PHP_IC_ENTRY_READ;
- }
-
- /* Initialize target object */
- MAKE_STD_ZVAL(obj);
- INIT_PZVAL(obj);
- object_init_ex(obj, ce);
-
- /* Merge current hashtable with object's default properties */
- zend_hash_merge(obj->value.obj.properties,
- Z_ARRVAL_P(ent2->data),
- (void (*)(void *)) zval_add_ref,
- (void *) &tmp, sizeof(zval *), 0);
-
- if (incomplete_class)
- php_store_class_name(obj, Z_STRVAL_P(ent1->data), Z_STRLEN_P(ent1->data));
-
- /* Clean up old array entry */
- zval_dtor(ent2->data);
- efree(ent2->data);
-
- /* Set stack entry to point to the newly created object */
- ent2->data = obj;
-
- /* Clean up class name var entry */
- zval_dtor(ent1->data);
- efree(ent1->data);
- }
- else
- zend_hash_update(target_hash,
- ent1->varname, strlen(ent1->varname)+1,
- &ent1->data, sizeof(zval *), NULL);
- efree(ent1->varname);
- } else {
- zend_hash_next_index_insert(target_hash,
- &ent1->data,
- sizeof(zval *), NULL);
- }
- }
- efree(ent1);
- }
- }
- else if (!strcmp(name, EL_VAR) && stack->varname)
- efree(stack->varname);
-}
-/* }}} */
-
-/* {{{ php_wddx_process_data
- */
-static void php_wddx_process_data(void *user_data, const char *s, int len)
-{
- st_entry *ent;
- wddx_stack *stack = (wddx_stack *)user_data;
- char *decoded_value;
- int decoded_len;
-
- if (!wddx_stack_is_empty(stack)) {
- wddx_stack_top(stack, (void**)&ent);
- switch (Z_TYPE_P(ent)) {
- case ST_STRING:
- decoded_value = xml_utf8_decode(s,len,&decoded_len,"ISO-8859-1");
-
- if (Z_STRLEN_P(ent->data) == 0) {
- Z_STRVAL_P(ent->data) = estrndup(decoded_value, decoded_len);
- Z_STRLEN_P(ent->data) = decoded_len;
- } else {
- Z_STRVAL_P(ent->data) = erealloc(Z_STRVAL_P(ent->data),
- Z_STRLEN_P(ent->data) + decoded_len + 1);
- strncpy(Z_STRVAL_P(ent->data)+Z_STRLEN_P(ent->data), decoded_value, decoded_len);
- Z_STRLEN_P(ent->data) += decoded_len;
- Z_STRVAL_P(ent->data)[Z_STRLEN_P(ent->data)] = '\0';
- }
-
- efree(decoded_value);
- break;
-
- case ST_BINARY:
- if (Z_STRLEN_P(ent->data) == 0) {
- Z_STRVAL_P(ent->data) = estrndup(s, len + 1);
- } else {
- Z_STRVAL_P(ent->data) = erealloc(Z_STRVAL_P(ent->data), Z_STRLEN_P(ent->data) + len + 1);
- memcpy(Z_STRVAL_P(ent->data) + Z_STRLEN_P(ent->data), s, len);
- }
- Z_STRLEN_P(ent->data) += len;
- Z_STRVAL_P(ent->data)[Z_STRLEN_P(ent->data)] = '\0';
- break;
-
- case ST_NUMBER:
- Z_TYPE_P(ent->data) = IS_STRING;
- Z_STRLEN_P(ent->data) = len;
- Z_STRVAL_P(ent->data) = estrndup(s, len);
- convert_scalar_to_number(ent->data);
- break;
-
- case ST_BOOLEAN:
- if (!strcmp(s, "true"))
- Z_LVAL_P(ent->data) = 1;
- else if (!strcmp(s, "false"))
- Z_LVAL_P(ent->data) = 0;
- else {
- stack->top--;
- zval_dtor(ent->data);
- efree(ent->data);
- if (ent->varname)
- efree(ent->varname);
- efree(ent);
- }
- break;
-
- default:
- break;
- }
- }
-}
-/* }}} */
-
-/* {{{ php_wddx_deserialize_ex
- */
-int php_wddx_deserialize_ex(char *value, int vallen, zval *return_value)
-{
- wddx_stack stack;
- XML_Parser parser;
- st_entry *ent;
- int retval;
-
- wddx_stack_init(&stack);
- parser = XML_ParserCreate("ISO-8859-1");
-
- XML_SetUserData(parser, &stack);
- XML_SetElementHandler(parser, php_wddx_push_element, php_wddx_pop_element);
- XML_SetCharacterDataHandler(parser, php_wddx_process_data);
-
- XML_Parse(parser, value, vallen, 1);
-
- XML_ParserFree(parser);
-
- if (stack.top == 1) {
- wddx_stack_top(&stack, (void**)&ent);
- *return_value = *(ent->data);
- zval_copy_ctor(return_value);
- retval = SUCCESS;
- } else
- retval = FAILURE;
-
- wddx_stack_destroy(&stack);
-
- return retval;
-}
-/* }}} */
-
-/* {{{ proto string wddx_serialize_value(mixed var [, string comment])
- Creates a new packet and serializes the given value */
-PHP_FUNCTION(wddx_serialize_value)
-{
- int argc;
- zval **var,
- **comment;
- wddx_packet *packet;
-
- argc = ZEND_NUM_ARGS();
- if(argc < 1 || argc > 2 || zend_get_parameters_ex(argc, &var, &comment) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- packet = php_wddx_constructor();
- if (!packet) {
- RETURN_FALSE;
- }
-
- if (argc == 2)
- {
- convert_to_string_ex(comment);
- php_wddx_packet_start(packet, Z_STRVAL_PP(comment), Z_STRLEN_PP(comment));
- }
- else
- php_wddx_packet_start(packet, NULL, 0);
-
- php_wddx_serialize_var(packet, (*var), NULL, 0);
- php_wddx_packet_end(packet);
-
- ZVAL_STRINGL(return_value, packet->c, packet->len, 1);
- smart_str_free(packet);
- efree(packet);
-}
-/* }}} */
-
-/* {{{ proto string wddx_serialize_vars(mixed var_name [, mixed ...])
- Creates a new packet and serializes given variables into a struct */
-PHP_FUNCTION(wddx_serialize_vars)
-{
- int argc, i;
- wddx_packet *packet;
- zval ***args;
-
- argc = ZEND_NUM_ARGS();
- /* Allocate arguments array and get the arguments, checking for errors. */
- args = (zval ***)emalloc(argc * sizeof(zval **));
- if (zend_get_parameters_array_ex(argc, args) == FAILURE) {
- efree(args);
- WRONG_PARAM_COUNT;
- }
-
- packet = php_wddx_constructor();
- if (!packet) {
- RETURN_FALSE;
- }
-
- php_wddx_packet_start(packet, NULL, 0);
- php_wddx_add_chunk_static(packet, WDDX_STRUCT_S);
-
- for (i=0; i<argc; i++) {
- if (Z_TYPE_PP(args[i]) != IS_ARRAY && Z_TYPE_PP(args[i]) != IS_OBJECT)
- convert_to_string_ex(args[i]);
- php_wddx_add_var(packet, *args[i]);
- }
-
- php_wddx_add_chunk_static(packet, WDDX_STRUCT_E);
- php_wddx_packet_end(packet);
-
- efree(args);
-
- ZVAL_STRINGL(return_value, packet->c, packet->len, 1);
- smart_str_free(packet);
- efree(packet);
-}
-/* }}} */
-
-/* {{{ php_wddx_constructor
- */
-wddx_packet *php_wddx_constructor(void)
-{
- smart_str *packet;
-
- packet = (smart_str *)emalloc(sizeof(smart_str));
- packet->c = NULL;
-
- return packet;
-}
-/* }}} */
-
-/* {{{ php_wddx_destructor
- */
-void php_wddx_destructor(wddx_packet *packet)
-{
- smart_str_free(packet);
- efree(packet);
-}
-/* }}} */
-
-/* {{{ proto int wddx_packet_start([string comment])
- Starts a WDDX packet with optional comment and returns the packet id */
-PHP_FUNCTION(wddx_packet_start)
-{
- int argc;
- zval **comment;
- wddx_packet *packet;
-
- comment = NULL;
- argc = ZEND_NUM_ARGS();
-
- if (argc > 1 || (argc == 1 && zend_get_parameters_ex(1, &comment)==FAILURE)) {
- WRONG_PARAM_COUNT;
- }
-
- packet = php_wddx_constructor();
- if (!packet) {
- RETURN_FALSE;
- }
-
- if (argc == 1) {
- convert_to_string_ex(comment);
- php_wddx_packet_start(packet, Z_STRVAL_PP(comment), Z_STRLEN_PP(comment));
- } else
- php_wddx_packet_start(packet, NULL, 0);
-
- php_wddx_add_chunk_static(packet, WDDX_STRUCT_S);
-
- ZEND_REGISTER_RESOURCE(return_value, packet, le_wddx);
-}
-/* }}} */
-
-/* {{{ proto string wddx_packet_end(int packet_id)
- Ends specified WDDX packet and returns the string containing the packet */
-PHP_FUNCTION(wddx_packet_end)
-{
- zval **packet_id;
- wddx_packet *packet = NULL;
-
- if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &packet_id)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(packet, wddx_packet *, packet_id, -1, "WDDX packet ID", le_wddx);
-
- php_wddx_add_chunk_static(packet, WDDX_STRUCT_E);
-
- php_wddx_packet_end(packet);
-
- ZVAL_STRINGL(return_value, packet->c, packet->len, 1);
-
- zend_list_delete(Z_LVAL_PP(packet_id));
-}
-/* }}} */
-
-/* {{{ proto int wddx_add_vars(int packet_id [, mixed var_names [, mixed ...]])
- Serializes given variables and adds them to packet given by packet_id */
-PHP_FUNCTION(wddx_add_vars)
-{
- int argc, i;
- zval ***args;
- zval **packet_id;
- wddx_packet *packet = NULL;
-
- argc = ZEND_NUM_ARGS();
- if (argc < 2) {
- WRONG_PARAM_COUNT;
- }
-
- /* Allocate arguments array and get the arguments, checking for errors. */
- args = (zval ***)emalloc(argc * sizeof(zval **));
- if (zend_get_parameters_array_ex(argc, args) == FAILURE) {
- efree(args);
- WRONG_PARAM_COUNT;
- }
-
- packet_id = args[0];
-
- packet = (wddx_packet *)zend_fetch_resource(packet_id, -1, "WDDX packet ID", NULL, 1, le_wddx);
- if (!packet)
- {
- efree(args);
- RETURN_FALSE;
- }
-
- for (i=1; i<argc; i++) {
- if (Z_TYPE_PP(args[i]) != IS_ARRAY && Z_TYPE_PP(args[i]) != IS_OBJECT)
- convert_to_string_ex(args[i]);
- php_wddx_add_var(packet, (*args[i]));
- }
-
- efree(args);
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto mixed wddx_deserialize(string packet)
- Deserializes given packet and returns a PHP value */
-PHP_FUNCTION(wddx_deserialize)
-{
- zval **packet;
-
- if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &packet) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(packet);
- if (Z_STRLEN_PP(packet) == 0)
- return;
-
- php_wddx_deserialize(*packet, return_value);
-}
-/* }}} */
-
-#endif /* HAVE_LIBEXPAT */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/xml/CREDITS b/ext/xml/CREDITS
deleted file mode 100644
index 9f781a8c9c..0000000000
--- a/ext/xml/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-XML
-Stig Bakken, Thies C. Arntzen
diff --git a/ext/xml/Makefile.in b/ext/xml/Makefile.in
deleted file mode 100644
index b685c9a67c..0000000000
--- a/ext/xml/Makefile.in
+++ /dev/null
@@ -1,11 +0,0 @@
-
-LTLIBRARY_NAME = libxml.la
-LTLIBRARY_SOURCES = xml.c
-LTLIBRARY_DEPENDENCIES = $(EXPAT_INTERNAL_LIBADD)
-LTLIBRARY_LIBADD = $(LTLIBRARY_DEPENDENCIES)
-LTLIBRARY_SHARED_NAME = xml.la
-LTLIBRARY_SHARED_LIBADD = $(EXPAT_SHARED_LIBADD)
-
-SUBDIRS = $(EXPAT_SUBDIRS)
-
-include $(top_srcdir)/build/dynlib.mk
diff --git a/ext/xml/config.m4 b/ext/xml/config.m4
deleted file mode 100644
index e1eaeb0863..0000000000
--- a/ext/xml/config.m4
+++ /dev/null
@@ -1,57 +0,0 @@
-# $Source$
-# $Id$
-
-dnl Fallback for --with-xml[=DIR]
-AC_ARG_WITH(xml,[],enable_xml=$withval)
-
-AC_C_BIGENDIAN
-
-if test "$ac_cv_c_bigendian" = "yes"; then
- order=21
-else
- order=12
-fi
-
-PHP_ARG_ENABLE(xml,for XML support,
-[ --disable-xml Disable XML support using bundled expat lib], yes)
-
-PHP_ARG_WITH(expat-dir, external libexpat install dir,
-[ --with-expat-dir=DIR XML: external libexpat install dir])
-
-if test "$PHP_XML" = "yes"; then
-if test "$PHP_EXPAT_DIR" = "no"; then
-
- AC_DEFINE(HAVE_LIBEXPAT, 1, [ ])
- AC_DEFINE(HAVE_LIBEXPAT_BUNDLED, 1, [ ])
- XML_CPPFLAGS=-DXML_BYTE_ORDER=$order
- EXPAT_INTERNAL_LIBADD=expat/libexpat.la
- PHP_SUBST(EXPAT_INTERNAL_LIBADD)
- PHP_SUBST(XML_CPPFLAGS)
- EXPAT_SUBDIRS=expat
- PHP_SUBST(EXPAT_SUBDIRS)
- PHP_SUBST(EXPAT_SHARED_LIBADD)
- PHP_EXTENSION(xml, $ext_shared)
- LIB_BUILD($ext_builddir/expat,$ext_shared,yes)
- PHP_ADD_INCLUDE($ext_srcdir/expat)
- PHP_FAST_OUTPUT($ext_builddir/expat/Makefile)
-
-else
-
- PHP_EXTENSION(xml, $ext_shared)
- PHP_SUBST(EXPAT_SHARED_LIBADD)
- AC_DEFINE(HAVE_LIBEXPAT, 1, [ ])
-
- for i in $PHP_XML $PHP_EXPAT_DIR; do
- if test -f $i/lib/libexpat.a -o -f $i/lib/libexpat.s? ; then
- EXPAT_DIR=$i
- fi
- done
-
- if test -z "$EXPAT_DIR"; then
- AC_MSG_ERROR(not found. Please reinstall the expat distribution.)
- fi
-
- PHP_ADD_INCLUDE($EXPAT_DIR/include)
- PHP_ADD_LIBRARY_WITH_PATH(expat, $EXPAT_DIR/lib, EXPAT_SHARED_LIBADD)
-fi
-fi
diff --git a/ext/xml/expat/Changes b/ext/xml/expat/Changes
deleted file mode 100644
index 5b78b862a7..0000000000
--- a/ext/xml/expat/Changes
+++ /dev/null
@@ -1,34 +0,0 @@
-Release 1.95.1 Sun Oct 22 15:11:36 EDT 2000
- - Changes to get expat to build under Microsoft compiler
- - Removed all aborts and instead return an UNEXPECTED_STATE error.
- - Fixed a bug where a stray '%' in an entity value would cause an
- abort.
- - Defined XML_SetEndNamespaceDeclHandler. Thanks to Darryl Miles for
- finding this oversight.
- - Changed default patterns in lib/Makefile.in to fit non-GNU makes
- Thanks to robin@unrated.net for reporting and providing an
- account to test on.
- - The reference had the wrong label for XML_SetStartNamespaceDecl.
- Reported by an anonymous user.
-Release 1.95.0 Fri Sep 29 2000
- - XML_ParserCreate_MM
- Allows you to set a memory management suite to replace the
- standard malloc,realloc, and free.
- - XML_SetReturnNSTriplet
- If you turn this feature on when namespace processing is in
- effect, then qualified, prefixed element and attribute names
- are returned as "uri|name|prefix" where '|' is whatever
- separator character is used in namespace processing.
- - Merged in features from perl-expat
- o XML_SetElementDeclHandler
- o XML_SetAttlistDeclHandler
- o XML_SetXmlDeclHandler
- o XML_SetEntityDeclHandler
- o StartDoctypeDeclHandler takes 3 additional parameters:
- sysid, pubid, has_internal_subset
- o Many paired handler setters (like XML_SetElementHandler)
- now have corresponding individual handler setters
- o XML_GetInputContext for getting the input context of
- the current parse position.
- - Added reference material
- - Packaged into a distribution that builds a sharable library \ No newline at end of file
diff --git a/ext/xml/expat/Makefile.in b/ext/xml/expat/Makefile.in
deleted file mode 100644
index 39609a3403..0000000000
--- a/ext/xml/expat/Makefile.in
+++ /dev/null
@@ -1,7 +0,0 @@
-
-LTLIBRARY_NAME = libexpat.la
-LTLIBRARY_SOURCES = xmlparse.c xmlrole.c xmltok.c
-
-EXTRA_INCLUDES = $(XML_CPPFLAGS)
-
-include $(top_srcdir)/build/dynlib.mk
diff --git a/ext/xml/expat/README b/ext/xml/expat/README
deleted file mode 100644
index d1c6874190..0000000000
--- a/ext/xml/expat/README
+++ /dev/null
@@ -1,57 +0,0 @@
-
- Expat, Release 1.95.1
-
-This is expat, the C library for parsing XML, written by James Clark. Expat
-is a stream oriented XML parser. This means that you register handlers with
-the parser prior to starting the parse. These handlers are called when
-the parser discovers the associated structures in the document being parsed.
-A start tag is an example of the kind of structures for which you may
-register handlers.
-
-Expat is free software. You may copy, distribute, and modify it under the
-terms of the License contained in the file, COPYING, distributed with this
-package. This license is the same as the MIT/X Consortium license.
-
-Versions of expat that have an odd minor version (the middle number in the
-release above), are development releases and should be considered as
-beta software. Releases with even minor version numbers are intended to be
-production grade software.
-
-To build expat, you first run the configuration shell script in the top
-level distribution directory:
-
- ./configure
-
-There are many options which you may provide to configure (which you can
-discover by running configure with the --help option.) But the one of most
-interest is the one that sets the installation directory. By default,
-the configure script will set things up to install libexpat into
-/usr/local/lib and expat.h into /usr/local/include. If, for example, you'd
-prefer to install into /home/me/mystuff/lib and /home/me/mystuff/include,
-you can tell configure about that with:
-
- ./configure --prefix=/home/me/mystuff
-
-After running the configure script, the "make" command will build things and
-"make install" will install things into their proper location. Note that
-you need to have write permission into the directories into which things
-will be installed.
-
-Alternatively, on Win32 systems with Microsoft's Developer's Studio installed,
-you can simply double-click on lib/expat.dsp from Windows Explorer and build
-and install in the usual way from with DevStudio.
-
-As a third alternative you may choose to download expat_win32bin which has
-a pre-compiled dll in it.
-
-A reference manual is available in the doc/reference.html in this
-distribution.
-
-The homepage for this project is http://expat.sourceforge.net. There are
-links there to connect you to the bug reports page. If you need to report
-a bug when you don't have access to a browser, you may also send a bug
-report by email to expat-bugs@lists.sourceforge.net.
-
-Discussion related to the direction of future expat development takes place
-on expat-discuss@lists.sourceforge.net. Archives of this list may be found
-at http://www.geocrawler.com/redir-sf.php3?list=expat-discuss.
diff --git a/ext/xml/expat/README.php b/ext/xml/expat/README.php
deleted file mode 100644
index 187ef60be8..0000000000
--- a/ext/xml/expat/README.php
+++ /dev/null
@@ -1,11 +0,0 @@
-this is the PHP-bundled version of expat 1.95.1
-
-changes from the original version:
-- include <php_config.h> instead of <config.h>
-- include "php_compat.h" for namespace protection
-- hardcode version in xmlparse.c
-- stripped off all unneded files
-
-
-thies@thieso.net, 11th May, 2001
-
diff --git a/ext/xml/expat/ascii.h b/ext/xml/expat/ascii.h
deleted file mode 100644
index 6376b1f311..0000000000
--- a/ext/xml/expat/ascii.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
-Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
-See the file COPYING for copying permission.
-*/
-
-#define ASCII_A 0x41
-#define ASCII_B 0x42
-#define ASCII_C 0x43
-#define ASCII_D 0x44
-#define ASCII_E 0x45
-#define ASCII_F 0x46
-#define ASCII_G 0x47
-#define ASCII_H 0x48
-#define ASCII_I 0x49
-#define ASCII_J 0x4A
-#define ASCII_K 0x4B
-#define ASCII_L 0x4C
-#define ASCII_M 0x4D
-#define ASCII_N 0x4E
-#define ASCII_O 0x4F
-#define ASCII_P 0x50
-#define ASCII_Q 0x51
-#define ASCII_R 0x52
-#define ASCII_S 0x53
-#define ASCII_T 0x54
-#define ASCII_U 0x55
-#define ASCII_V 0x56
-#define ASCII_W 0x57
-#define ASCII_X 0x58
-#define ASCII_Y 0x59
-#define ASCII_Z 0x5A
-
-#define ASCII_a 0x61
-#define ASCII_b 0x62
-#define ASCII_c 0x63
-#define ASCII_d 0x64
-#define ASCII_e 0x65
-#define ASCII_f 0x66
-#define ASCII_g 0x67
-#define ASCII_h 0x68
-#define ASCII_i 0x69
-#define ASCII_j 0x6A
-#define ASCII_k 0x6B
-#define ASCII_l 0x6C
-#define ASCII_m 0x6D
-#define ASCII_n 0x6E
-#define ASCII_o 0x6F
-#define ASCII_p 0x70
-#define ASCII_q 0x71
-#define ASCII_r 0x72
-#define ASCII_s 0x73
-#define ASCII_t 0x74
-#define ASCII_u 0x75
-#define ASCII_v 0x76
-#define ASCII_w 0x77
-#define ASCII_x 0x78
-#define ASCII_y 0x79
-#define ASCII_z 0x7A
-
-#define ASCII_0 0x30
-#define ASCII_1 0x31
-#define ASCII_2 0x32
-#define ASCII_3 0x33
-#define ASCII_4 0x34
-#define ASCII_5 0x35
-#define ASCII_6 0x36
-#define ASCII_7 0x37
-#define ASCII_8 0x38
-#define ASCII_9 0x39
-
-#define ASCII_TAB 0x09
-#define ASCII_SPACE 0x20
-#define ASCII_EXCL 0x21
-#define ASCII_QUOT 0x22
-#define ASCII_AMP 0x26
-#define ASCII_APOS 0x27
-#define ASCII_MINUS 0x2D
-#define ASCII_PERIOD 0x2E
-#define ASCII_COLON 0x3A
-#define ASCII_SEMI 0x3B
-#define ASCII_LT 0x3C
-#define ASCII_EQUALS 0x3D
-#define ASCII_GT 0x3E
-#define ASCII_LSQB 0x5B
-#define ASCII_RSQB 0x5D
-#define ASCII_UNDERSCORE 0x5F
diff --git a/ext/xml/expat/asciitab.h b/ext/xml/expat/asciitab.h
deleted file mode 100644
index eb445cc52c..0000000000
--- a/ext/xml/expat/asciitab.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
-Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
-See the file COPYING for copying permission.
-*/
-
-/* 0x00 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
-/* 0x04 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
-/* 0x08 */ BT_NONXML, BT_S, BT_LF, BT_NONXML,
-/* 0x0C */ BT_NONXML, BT_CR, BT_NONXML, BT_NONXML,
-/* 0x10 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
-/* 0x14 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
-/* 0x18 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
-/* 0x1C */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
-/* 0x20 */ BT_S, BT_EXCL, BT_QUOT, BT_NUM,
-/* 0x24 */ BT_OTHER, BT_PERCNT, BT_AMP, BT_APOS,
-/* 0x28 */ BT_LPAR, BT_RPAR, BT_AST, BT_PLUS,
-/* 0x2C */ BT_COMMA, BT_MINUS, BT_NAME, BT_SOL,
-/* 0x30 */ BT_DIGIT, BT_DIGIT, BT_DIGIT, BT_DIGIT,
-/* 0x34 */ BT_DIGIT, BT_DIGIT, BT_DIGIT, BT_DIGIT,
-/* 0x38 */ BT_DIGIT, BT_DIGIT, BT_COLON, BT_SEMI,
-/* 0x3C */ BT_LT, BT_EQUALS, BT_GT, BT_QUEST,
-/* 0x40 */ BT_OTHER, BT_HEX, BT_HEX, BT_HEX,
-/* 0x44 */ BT_HEX, BT_HEX, BT_HEX, BT_NMSTRT,
-/* 0x48 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
-/* 0x4C */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
-/* 0x50 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
-/* 0x54 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
-/* 0x58 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_LSQB,
-/* 0x5C */ BT_OTHER, BT_RSQB, BT_OTHER, BT_NMSTRT,
-/* 0x60 */ BT_OTHER, BT_HEX, BT_HEX, BT_HEX,
-/* 0x64 */ BT_HEX, BT_HEX, BT_HEX, BT_NMSTRT,
-/* 0x68 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
-/* 0x6C */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
-/* 0x70 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
-/* 0x74 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
-/* 0x78 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_OTHER,
-/* 0x7C */ BT_VERBAR, BT_OTHER, BT_OTHER, BT_OTHER,
diff --git a/ext/xml/expat/expat.h b/ext/xml/expat/expat.h
deleted file mode 100644
index 68cde08614..0000000000
--- a/ext/xml/expat/expat.h
+++ /dev/null
@@ -1,712 +0,0 @@
-/*
-Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd
-See the file COPYING for copying permission.
-*/
-
-#ifndef XmlParse_INCLUDED
-#define XmlParse_INCLUDED 1
-
-#include <stdlib.h>
-
-#ifndef XMLPARSEAPI
-# ifdef __declspec
-# define XMLPARSEAPI __declspec(dllimport)
-# else
-# define XMLPARSEAPI /* nothing */
-# endif
-#endif /* not defined XMLPARSEAPI */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef void *XML_Parser;
-
-/* Information is UTF-8 encoded. */
-typedef char XML_Char;
-typedef char XML_LChar;
-
-enum XML_Content_Type {
- XML_CTYPE_EMPTY = 1,
- XML_CTYPE_ANY,
- XML_CTYPE_MIXED,
- XML_CTYPE_NAME,
- XML_CTYPE_CHOICE,
- XML_CTYPE_SEQ
-};
-
-enum XML_Content_Quant {
- XML_CQUANT_NONE,
- XML_CQUANT_OPT,
- XML_CQUANT_REP,
- XML_CQUANT_PLUS
-};
-
-/* If type == XML_CTYPE_EMPTY or XML_CTYPE_ANY, then quant will be
- XML_CQUANT_NONE, and the other fields will be zero or NULL.
- If type == XML_CTYPE_MIXED, then quant will be NONE or REP and
- numchildren will contain number of elements that may be mixed in
- and children point to an array of XML_Content cells that will be
- all of XML_CTYPE_NAME type with no quantification.
-
- If type == XML_CTYPE_NAME, then the name points to the name, and
- the numchildren field will be zero and children will be NULL. The
- quant fields indicates any quantifiers placed on the name.
-
- CHOICE and SEQ will have name NULL, the number of children in
- numchildren and children will point, recursively, to an array
- of XML_Content cells.
-
- The EMPTY, ANY, and MIXED types will only occur at top level.
-*/
-
-typedef struct XML_cp XML_Content;
-
-struct XML_cp {
- enum XML_Content_Type type;
- enum XML_Content_Quant quant;
- const XML_Char * name;
- unsigned int numchildren;
- XML_Content * children;
-};
-
-
-/* This is called for an element declaration. See above for
- description of the model argument. It's the caller's responsibility
- to free model when finished with it.
-*/
-
-typedef void (*XML_ElementDeclHandler) (void *userData,
- const XML_Char *name,
- XML_Content *model);
-
-void XMLPARSEAPI
-XML_SetElementDeclHandler(XML_Parser parser,
- XML_ElementDeclHandler eldecl);
-
-/*
- The Attlist declaration handler is called for *each* attribute. So
- a single Attlist declaration with multiple attributes declared will
- generate multiple calls to this handler. The "default" parameter
- may be NULL in the case of the "#IMPLIED" or "#REQUIRED" keyword.
- The "isrequired" parameter will be true and the default value will
- be NULL in the case of "#REQUIRED". If "isrequired" is true and
- default is non-NULL, then this is a "#FIXED" default.
- */
-
-typedef void (*XML_AttlistDeclHandler) (void *userData,
- const XML_Char *elname,
- const XML_Char *attname,
- const XML_Char *att_type,
- const XML_Char *dflt,
- int isrequired);
-
-void XMLPARSEAPI
-XML_SetAttlistDeclHandler(XML_Parser parser,
- XML_AttlistDeclHandler attdecl);
-
-
- /* The XML declaration handler is called for *both* XML declarations and
- text declarations. The way to distinguish is that the version parameter
- will be null for text declarations. The encoding parameter may be null
- for XML declarations. The standalone parameter will be -1, 0, or 1
- indicating respectively that there was no standalone parameter in
- the declaration, that it was given as no, or that it was given as yes.
- */
-
-typedef void (*XML_XmlDeclHandler) (void *userData,
- const XML_Char *version,
- const XML_Char *encoding,
- int standalone);
-
-void XMLPARSEAPI
-XML_SetXmlDeclHandler(XML_Parser parser,
- XML_XmlDeclHandler xmldecl);
-
-
-typedef struct {
- void *(*malloc_fcn)(size_t size);
- void *(*realloc_fcn)(void *ptr, size_t size);
- void (*free_fcn)(void *ptr);
-} XML_Memory_Handling_Suite;
-
-/* Constructs a new parser; encoding is the encoding specified by the external
-protocol or null if there is none specified. */
-
-XML_Parser XMLPARSEAPI
-XML_ParserCreate(const XML_Char *encoding);
-
-/* Constructs a new parser and namespace processor. Element type names
-and attribute names that belong to a namespace will be expanded;
-unprefixed attribute names are never expanded; unprefixed element type
-names are expanded only if there is a default namespace. The expanded
-name is the concatenation of the namespace URI, the namespace separator character,
-and the local part of the name. If the namespace separator is '\0' then
-the namespace URI and the local part will be concatenated without any
-separator. When a namespace is not declared, the name and prefix will be
-passed through without expansion. */
-
-XML_Parser XMLPARSEAPI
-XML_ParserCreateNS(const XML_Char *encoding, XML_Char namespaceSeparator);
-
-
-/* Constructs a new parser using the memory management suit referred to
- by memsuite. If memsuite is NULL, then use the standard library memory
- suite. If namespaceSeparator is non-NULL it creates a parser with
- namespace processing as described above. The character pointed at
- will serve as the namespace separator.
-
- All further memory operations used for the created parser will come from
- the given suite.
-*/
-
-XML_Parser XMLPARSEAPI
-XML_ParserCreate_MM(const XML_Char *encoding,
- const XML_Memory_Handling_Suite *memsuite,
- const XML_Char *namespaceSeparator);
-
-/* atts is array of name/value pairs, terminated by 0;
- names and values are 0 terminated. */
-
-typedef void (*XML_StartElementHandler)(void *userData,
- const XML_Char *name,
- const XML_Char **atts);
-
-typedef void (*XML_EndElementHandler)(void *userData,
- const XML_Char *name);
-
-
-/* s is not 0 terminated. */
-typedef void (*XML_CharacterDataHandler)(void *userData,
- const XML_Char *s,
- int len);
-
-/* target and data are 0 terminated */
-typedef void (*XML_ProcessingInstructionHandler)(void *userData,
- const XML_Char *target,
- const XML_Char *data);
-
-/* data is 0 terminated */
-typedef void (*XML_CommentHandler)(void *userData, const XML_Char *data);
-
-typedef void (*XML_StartCdataSectionHandler)(void *userData);
-typedef void (*XML_EndCdataSectionHandler)(void *userData);
-
-/* This is called for any characters in the XML document for
-which there is no applicable handler. This includes both
-characters that are part of markup which is of a kind that is
-not reported (comments, markup declarations), or characters
-that are part of a construct which could be reported but
-for which no handler has been supplied. The characters are passed
-exactly as they were in the XML document except that
-they will be encoded in UTF-8. Line boundaries are not normalized.
-Note that a byte order mark character is not passed to the default handler.
-There are no guarantees about how characters are divided between calls
-to the default handler: for example, a comment might be split between
-multiple calls. */
-
-typedef void (*XML_DefaultHandler)(void *userData,
- const XML_Char *s,
- int len);
-
-/* This is called for the start of the DOCTYPE declaration, before
- any DTD or internal subset is parsed. */
-
-typedef void (*XML_StartDoctypeDeclHandler)(void *userData,
- const XML_Char *doctypeName,
- const XML_Char *sysid,
- const XML_Char *pubid,
- int has_internal_subset
- );
-
-/* This is called for the start of the DOCTYPE declaration when the
-closing > is encountered, but after processing any external subset. */
-typedef void (*XML_EndDoctypeDeclHandler)(void *userData);
-
-/* This is called for entity declarations. The is_parameter_entity
- argument will be non-zero if the entity is a parameter entity, zero
- otherwise.
-
- For internal entities (<!ENTITY foo "bar">), value will
- be non-null and systemId, publicID, and notationName will be null.
- The value string is NOT null terminated; the length is provided in
- the value_length argument. Since it is legal to have zero-length
- values, do not use this argument to test for internal entities.
-
- For external entities, value will be null and systemId will be non-null.
- The publicId argument will be null unless a public identifier was
- provided. The notationName argument will have a non-null value only
- for unparsed entity declarations.
-*/
-
-typedef void (*XML_EntityDeclHandler) (void *userData,
- const XML_Char *entityName,
- int is_parameter_entity,
- const XML_Char *value,
- int value_length,
- const XML_Char *base,
- const XML_Char *systemId,
- const XML_Char *publicId,
- const XML_Char *notationName);
-
-void XMLPARSEAPI
-XML_SetEntityDeclHandler(XML_Parser parser,
- XML_EntityDeclHandler handler);
-
-/* OBSOLETE -- OBSOLETE -- OBSOLETE
- This handler has been superceded by the EntityDeclHandler above.
- It is provided here for backward compatibility.
-This is called for a declaration of an unparsed (NDATA)
-entity. The base argument is whatever was set by XML_SetBase.
-The entityName, systemId and notationName arguments will never be null.
-The other arguments may be. */
-
-typedef void (*XML_UnparsedEntityDeclHandler)(void *userData,
- const XML_Char *entityName,
- const XML_Char *base,
- const XML_Char *systemId,
- const XML_Char *publicId,
- const XML_Char *notationName);
-
-/* This is called for a declaration of notation.
-The base argument is whatever was set by XML_SetBase.
-The notationName will never be null. The other arguments can be. */
-
-typedef void (*XML_NotationDeclHandler)(void *userData,
- const XML_Char *notationName,
- const XML_Char *base,
- const XML_Char *systemId,
- const XML_Char *publicId);
-
-/* When namespace processing is enabled, these are called once for
-each namespace declaration. The call to the start and end element
-handlers occur between the calls to the start and end namespace
-declaration handlers. For an xmlns attribute, prefix will be null.
-For an xmlns="" attribute, uri will be null. */
-
-typedef void (*XML_StartNamespaceDeclHandler)(void *userData,
- const XML_Char *prefix,
- const XML_Char *uri);
-
-typedef void (*XML_EndNamespaceDeclHandler)(void *userData,
- const XML_Char *prefix);
-
-/* This is called if the document is not standalone (it has an
-external subset or a reference to a parameter entity, but does not
-have standalone="yes"). If this handler returns 0, then processing
-will not continue, and the parser will return a
-XML_ERROR_NOT_STANDALONE error. */
-
-typedef int (*XML_NotStandaloneHandler)(void *userData);
-
-/* This is called for a reference to an external parsed general entity.
-The referenced entity is not automatically parsed.
-The application can parse it immediately or later using
-XML_ExternalEntityParserCreate.
-The parser argument is the parser parsing the entity containing the reference;
-it can be passed as the parser argument to XML_ExternalEntityParserCreate.
-The systemId argument is the system identifier as specified in the entity declaration;
-it will not be null.
-The base argument is the system identifier that should be used as the base for
-resolving systemId if systemId was relative; this is set by XML_SetBase;
-it may be null.
-The publicId argument is the public identifier as specified in the entity declaration,
-or null if none was specified; the whitespace in the public identifier
-will have been normalized as required by the XML spec.
-The context argument specifies the parsing context in the format
-expected by the context argument to
-XML_ExternalEntityParserCreate; context is valid only until the handler
-returns, so if the referenced entity is to be parsed later, it must be copied.
-The handler should return 0 if processing should not continue because of
-a fatal error in the handling of the external entity.
-In this case the calling parser will return an XML_ERROR_EXTERNAL_ENTITY_HANDLING
-error.
-Note that unlike other handlers the first argument is the parser, not userData. */
-
-typedef int (*XML_ExternalEntityRefHandler)(XML_Parser parser,
- const XML_Char *context,
- const XML_Char *base,
- const XML_Char *systemId,
- const XML_Char *publicId);
-
-/* This structure is filled in by the XML_UnknownEncodingHandler
-to provide information to the parser about encodings that are unknown
-to the parser.
-The map[b] member gives information about byte sequences
-whose first byte is b.
-If map[b] is c where c is >= 0, then b by itself encodes the Unicode scalar value c.
-If map[b] is -1, then the byte sequence is malformed.
-If map[b] is -n, where n >= 2, then b is the first byte of an n-byte
-sequence that encodes a single Unicode scalar value.
-The data member will be passed as the first argument to the convert function.
-The convert function is used to convert multibyte sequences;
-s will point to a n-byte sequence where map[(unsigned char)*s] == -n.
-The convert function must return the Unicode scalar value
-represented by this byte sequence or -1 if the byte sequence is malformed.
-The convert function may be null if the encoding is a single-byte encoding,
-that is if map[b] >= -1 for all bytes b.
-When the parser is finished with the encoding, then if release is not null,
-it will call release passing it the data member;
-once release has been called, the convert function will not be called again.
-
-Expat places certain restrictions on the encodings that are supported
-using this mechanism.
-
-1. Every ASCII character that can appear in a well-formed XML document,
-other than the characters
-
- $@\^`{}~
-
-must be represented by a single byte, and that byte must be the
-same byte that represents that character in ASCII.
-
-2. No character may require more than 4 bytes to encode.
-
-3. All characters encoded must have Unicode scalar values <= 0xFFFF,
-(ie characters that would be encoded by surrogates in UTF-16
-are not allowed). Note that this restriction doesn't apply to
-the built-in support for UTF-8 and UTF-16.
-
-4. No Unicode character may be encoded by more than one distinct sequence
-of bytes. */
-
-typedef struct {
- int map[256];
- void *data;
- int (*convert)(void *data, const char *s);
- void (*release)(void *data);
-} XML_Encoding;
-
-/* This is called for an encoding that is unknown to the parser.
-The encodingHandlerData argument is that which was passed as the
-second argument to XML_SetUnknownEncodingHandler.
-The name argument gives the name of the encoding as specified in
-the encoding declaration.
-If the callback can provide information about the encoding,
-it must fill in the XML_Encoding structure, and return 1.
-Otherwise it must return 0.
-If info does not describe a suitable encoding,
-then the parser will return an XML_UNKNOWN_ENCODING error. */
-
-typedef int (*XML_UnknownEncodingHandler)(void *encodingHandlerData,
- const XML_Char *name,
- XML_Encoding *info);
-
-void XMLPARSEAPI
-XML_SetElementHandler(XML_Parser parser,
- XML_StartElementHandler start,
- XML_EndElementHandler end);
-
-void XMLPARSEAPI
-XML_SetStartElementHandler(XML_Parser, XML_StartElementHandler);
-
-void XMLPARSEAPI
-XML_SetEndElementHandler(XML_Parser, XML_EndElementHandler);
-
-void XMLPARSEAPI
-XML_SetCharacterDataHandler(XML_Parser parser,
- XML_CharacterDataHandler handler);
-
-void XMLPARSEAPI
-XML_SetProcessingInstructionHandler(XML_Parser parser,
- XML_ProcessingInstructionHandler handler);
-void XMLPARSEAPI
-XML_SetCommentHandler(XML_Parser parser,
- XML_CommentHandler handler);
-
-void XMLPARSEAPI
-XML_SetCdataSectionHandler(XML_Parser parser,
- XML_StartCdataSectionHandler start,
- XML_EndCdataSectionHandler end);
-
-void XMLPARSEAPI
-XML_SetStartCdataSectionHandler(XML_Parser parser,
- XML_StartCdataSectionHandler start);
-
-void XMLPARSEAPI
-XML_SetEndCdataSectionHandler(XML_Parser parser,
- XML_EndCdataSectionHandler end);
-
-/* This sets the default handler and also inhibits expansion of internal entities.
-The entity reference will be passed to the default handler. */
-
-void XMLPARSEAPI
-XML_SetDefaultHandler(XML_Parser parser,
- XML_DefaultHandler handler);
-
-/* This sets the default handler but does not inhibit expansion of internal entities.
-The entity reference will not be passed to the default handler. */
-
-void XMLPARSEAPI
-XML_SetDefaultHandlerExpand(XML_Parser parser,
- XML_DefaultHandler handler);
-
-void XMLPARSEAPI
-XML_SetDoctypeDeclHandler(XML_Parser parser,
- XML_StartDoctypeDeclHandler start,
- XML_EndDoctypeDeclHandler end);
-
-void XMLPARSEAPI
-XML_SetStartDoctypeDeclHandler(XML_Parser parser,
- XML_StartDoctypeDeclHandler start);
-
-void XMLPARSEAPI
-XML_SetEndDoctypeDeclHandler(XML_Parser parser,
- XML_EndDoctypeDeclHandler end);
-
-void XMLPARSEAPI
-XML_SetUnparsedEntityDeclHandler(XML_Parser parser,
- XML_UnparsedEntityDeclHandler handler);
-
-void XMLPARSEAPI
-XML_SetNotationDeclHandler(XML_Parser parser,
- XML_NotationDeclHandler handler);
-
-void XMLPARSEAPI
-XML_SetNamespaceDeclHandler(XML_Parser parser,
- XML_StartNamespaceDeclHandler start,
- XML_EndNamespaceDeclHandler end);
-
-void XMLPARSEAPI
-XML_SetStartNamespaceDeclHandler(XML_Parser parser,
- XML_StartNamespaceDeclHandler start);
-
-void XMLPARSEAPI
-XML_SetEndNamespaceDeclHandler(XML_Parser parser,
- XML_EndNamespaceDeclHandler end);
-
-void XMLPARSEAPI
-XML_SetNotStandaloneHandler(XML_Parser parser,
- XML_NotStandaloneHandler handler);
-
-void XMLPARSEAPI
-XML_SetExternalEntityRefHandler(XML_Parser parser,
- XML_ExternalEntityRefHandler handler);
-
-/* If a non-null value for arg is specified here, then it will be passed
-as the first argument to the external entity ref handler instead
-of the parser object. */
-void XMLPARSEAPI
-XML_SetExternalEntityRefHandlerArg(XML_Parser, void *arg);
-
-void XMLPARSEAPI
-XML_SetUnknownEncodingHandler(XML_Parser parser,
- XML_UnknownEncodingHandler handler,
- void *encodingHandlerData);
-
-/* This can be called within a handler for a start element, end element,
-processing instruction or character data. It causes the corresponding
-markup to be passed to the default handler. */
-void XML_DefaultCurrent(XML_Parser parser);
-
-/* If do_nst is non-zero, and namespace processing is in effect, and
- a name has a prefix (i.e. an explicit namespace qualifier) then
- that name is returned as a triplet in a single
- string separated by the separator character specified when the parser
- was created: URI + sep + local_name + sep + prefix.
-
- If do_nst is zero, then namespace information is returned in the
- default manner (URI + sep + local_name) whether or not the names
- has a prefix.
-*/
-
-void XMLPARSEAPI
-XML_SetReturnNSTriplet(XML_Parser parser, int do_nst);
-
-/* This value is passed as the userData argument to callbacks. */
-void XMLPARSEAPI
-XML_SetUserData(XML_Parser parser, void *userData);
-
-/* Returns the last value set by XML_SetUserData or null. */
-#define XML_GetUserData(parser) (*(void **)(parser))
-
-/* This is equivalent to supplying an encoding argument
-to XML_ParserCreate. It must not be called after XML_Parse
-or XML_ParseBuffer. */
-
-int XMLPARSEAPI
-XML_SetEncoding(XML_Parser parser, const XML_Char *encoding);
-
-/* If this function is called, then the parser will be passed
-as the first argument to callbacks instead of userData.
-The userData will still be accessible using XML_GetUserData. */
-
-void XMLPARSEAPI
-XML_UseParserAsHandlerArg(XML_Parser parser);
-
-/* Sets the base to be used for resolving relative URIs in system identifiers in
-declarations. Resolving relative identifiers is left to the application:
-this value will be passed through as the base argument to the
-XML_ExternalEntityRefHandler, XML_NotationDeclHandler
-and XML_UnparsedEntityDeclHandler. The base argument will be copied.
-Returns zero if out of memory, non-zero otherwise. */
-
-int XMLPARSEAPI
-XML_SetBase(XML_Parser parser, const XML_Char *base);
-
-const XML_Char XMLPARSEAPI *
-XML_GetBase(XML_Parser parser);
-
-/* Returns the number of the attribute/value pairs passed in last call
-to the XML_StartElementHandler that were specified in the start-tag
-rather than defaulted. Each attribute/value pair counts as 2; thus
-this correspondds to an index into the atts array passed to the
-XML_StartElementHandler. */
-
-int XMLPARSEAPI
-XML_GetSpecifiedAttributeCount(XML_Parser parser);
-
-/* Returns the index of the ID attribute passed in the last call to
-XML_StartElementHandler, or -1 if there is no ID attribute. Each
-attribute/value pair counts as 2; thus this correspondds to an index
-into the atts array passed to the XML_StartElementHandler. */
-
-int XMLPARSEAPI
-XML_GetIdAttributeIndex(XML_Parser parser);
-
-/* Parses some input. Returns 0 if a fatal error is detected.
-The last call to XML_Parse must have isFinal true;
-len may be zero for this call (or any other). */
-int XMLPARSEAPI
-XML_Parse(XML_Parser parser, const char *s, int len, int isFinal);
-
-void XMLPARSEAPI *
-XML_GetBuffer(XML_Parser parser, int len);
-
-int XMLPARSEAPI
-XML_ParseBuffer(XML_Parser parser, int len, int isFinal);
-
-/* Creates an XML_Parser object that can parse an external general entity;
-context is a '\0'-terminated string specifying the parse context;
-encoding is a '\0'-terminated string giving the name of the externally specified encoding,
-or null if there is no externally specified encoding.
-The context string consists of a sequence of tokens separated by formfeeds (\f);
-a token consisting of a name specifies that the general entity of the name
-is open; a token of the form prefix=uri specifies the namespace for a particular
-prefix; a token of the form =uri specifies the default namespace.
-This can be called at any point after the first call to an ExternalEntityRefHandler
-so longer as the parser has not yet been freed.
-The new parser is completely independent and may safely be used in a separate thread.
-The handlers and userData are initialized from the parser argument.
-Returns 0 if out of memory. Otherwise returns a new XML_Parser object. */
-XML_Parser XMLPARSEAPI
-XML_ExternalEntityParserCreate(XML_Parser parser,
- const XML_Char *context,
- const XML_Char *encoding);
-
-enum XML_ParamEntityParsing {
- XML_PARAM_ENTITY_PARSING_NEVER,
- XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE,
- XML_PARAM_ENTITY_PARSING_ALWAYS
-};
-
-/* Controls parsing of parameter entities (including the external DTD
-subset). If parsing of parameter entities is enabled, then references
-to external parameter entities (including the external DTD subset)
-will be passed to the handler set with
-XML_SetExternalEntityRefHandler. The context passed will be 0.
-Unlike external general entities, external parameter entities can only
-be parsed synchronously. If the external parameter entity is to be
-parsed, it must be parsed during the call to the external entity ref
-handler: the complete sequence of XML_ExternalEntityParserCreate,
-XML_Parse/XML_ParseBuffer and XML_ParserFree calls must be made during
-this call. After XML_ExternalEntityParserCreate has been called to
-create the parser for the external parameter entity (context must be 0
-for this call), it is illegal to make any calls on the old parser
-until XML_ParserFree has been called on the newly created parser. If
-the library has been compiled without support for parameter entity
-parsing (ie without XML_DTD being defined), then
-XML_SetParamEntityParsing will return 0 if parsing of parameter
-entities is requested; otherwise it will return non-zero. */
-
-int XMLPARSEAPI
-XML_SetParamEntityParsing(XML_Parser parser,
- enum XML_ParamEntityParsing parsing);
-
-enum XML_Error {
- XML_ERROR_NONE,
- XML_ERROR_NO_MEMORY,
- XML_ERROR_SYNTAX,
- XML_ERROR_NO_ELEMENTS,
- XML_ERROR_INVALID_TOKEN,
- XML_ERROR_UNCLOSED_TOKEN,
- XML_ERROR_PARTIAL_CHAR,
- XML_ERROR_TAG_MISMATCH,
- XML_ERROR_DUPLICATE_ATTRIBUTE,
- XML_ERROR_JUNK_AFTER_DOC_ELEMENT,
- XML_ERROR_PARAM_ENTITY_REF,
- XML_ERROR_UNDEFINED_ENTITY,
- XML_ERROR_RECURSIVE_ENTITY_REF,
- XML_ERROR_ASYNC_ENTITY,
- XML_ERROR_BAD_CHAR_REF,
- XML_ERROR_BINARY_ENTITY_REF,
- XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF,
- XML_ERROR_MISPLACED_XML_PI,
- XML_ERROR_UNKNOWN_ENCODING,
- XML_ERROR_INCORRECT_ENCODING,
- XML_ERROR_UNCLOSED_CDATA_SECTION,
- XML_ERROR_EXTERNAL_ENTITY_HANDLING,
- XML_ERROR_NOT_STANDALONE,
- XML_ERROR_UNEXPECTED_STATE
-};
-
-/* If XML_Parse or XML_ParseBuffer have returned 0, then XML_GetErrorCode
-returns information about the error. */
-
-enum XML_Error XMLPARSEAPI
-XML_GetErrorCode(XML_Parser parser);
-
-/* These functions return information about the current parse location.
-They may be called when XML_Parse or XML_ParseBuffer return 0;
-in this case the location is the location of the character at which
-the error was detected.
-They may also be called from any other callback called to report
-some parse event; in this the location is the location of the first
-of the sequence of characters that generated the event. */
-
-int XMLPARSEAPI XML_GetCurrentLineNumber(XML_Parser parser);
-int XMLPARSEAPI XML_GetCurrentColumnNumber(XML_Parser parser);
-long XMLPARSEAPI XML_GetCurrentByteIndex(XML_Parser parser);
-
-/* Return the number of bytes in the current event.
-Returns 0 if the event is in an internal entity. */
-
-int XMLPARSEAPI
-XML_GetCurrentByteCount(XML_Parser parser);
-
-/* If XML_CONTEXT_BYTES is defined, returns the input buffer, sets
- the integer pointed to by offset to the offset within this buffer
- of the current parse position, and sets the integer pointed to by size
- to the size of this buffer (the number of input bytes). Otherwise
- returns a null pointer. Also returns a null pointer if a parse isn't active.
-
- NOTE: The character pointer returned should not be used outside
- the handler that makes the call. */
-
-const char XMLPARSEAPI *
-XML_GetInputContext(XML_Parser parser,
- int *offset,
- int *size);
-
-/* For backwards compatibility with previous versions. */
-#define XML_GetErrorLineNumber XML_GetCurrentLineNumber
-#define XML_GetErrorColumnNumber XML_GetCurrentColumnNumber
-#define XML_GetErrorByteIndex XML_GetCurrentByteIndex
-
-/* Frees memory used by the parser. */
-void XMLPARSEAPI
-XML_ParserFree(XML_Parser parser);
-
-/* Returns a string describing the error. */
-const XML_LChar XMLPARSEAPI *
-XML_ErrorString(int code);
-
-/* Return a string containing the version number of this expat */
-const XML_LChar XMLPARSEAPI *
-XML_ExpatVersion();
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* not XmlParse_INCLUDED */
diff --git a/ext/xml/expat/iasciitab.h b/ext/xml/expat/iasciitab.h
deleted file mode 100644
index 55dbc398b8..0000000000
--- a/ext/xml/expat/iasciitab.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
-Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
-See the file COPYING for copying permission.
-*/
-
-/* Like asciitab.h, except that 0xD has code BT_S rather than BT_CR */
-/* 0x00 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
-/* 0x04 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
-/* 0x08 */ BT_NONXML, BT_S, BT_LF, BT_NONXML,
-/* 0x0C */ BT_NONXML, BT_S, BT_NONXML, BT_NONXML,
-/* 0x10 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
-/* 0x14 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
-/* 0x18 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
-/* 0x1C */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
-/* 0x20 */ BT_S, BT_EXCL, BT_QUOT, BT_NUM,
-/* 0x24 */ BT_OTHER, BT_PERCNT, BT_AMP, BT_APOS,
-/* 0x28 */ BT_LPAR, BT_RPAR, BT_AST, BT_PLUS,
-/* 0x2C */ BT_COMMA, BT_MINUS, BT_NAME, BT_SOL,
-/* 0x30 */ BT_DIGIT, BT_DIGIT, BT_DIGIT, BT_DIGIT,
-/* 0x34 */ BT_DIGIT, BT_DIGIT, BT_DIGIT, BT_DIGIT,
-/* 0x38 */ BT_DIGIT, BT_DIGIT, BT_COLON, BT_SEMI,
-/* 0x3C */ BT_LT, BT_EQUALS, BT_GT, BT_QUEST,
-/* 0x40 */ BT_OTHER, BT_HEX, BT_HEX, BT_HEX,
-/* 0x44 */ BT_HEX, BT_HEX, BT_HEX, BT_NMSTRT,
-/* 0x48 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
-/* 0x4C */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
-/* 0x50 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
-/* 0x54 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
-/* 0x58 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_LSQB,
-/* 0x5C */ BT_OTHER, BT_RSQB, BT_OTHER, BT_NMSTRT,
-/* 0x60 */ BT_OTHER, BT_HEX, BT_HEX, BT_HEX,
-/* 0x64 */ BT_HEX, BT_HEX, BT_HEX, BT_NMSTRT,
-/* 0x68 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
-/* 0x6C */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
-/* 0x70 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
-/* 0x74 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
-/* 0x78 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_OTHER,
-/* 0x7C */ BT_VERBAR, BT_OTHER, BT_OTHER, BT_OTHER,
diff --git a/ext/xml/expat/latin1tab.h b/ext/xml/expat/latin1tab.h
deleted file mode 100644
index 178b1d186d..0000000000
--- a/ext/xml/expat/latin1tab.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
-Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
-See the file COPYING for copying permission.
-*/
-
-/* 0x80 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
-/* 0x84 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
-/* 0x88 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
-/* 0x8C */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
-/* 0x90 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
-/* 0x94 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
-/* 0x98 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
-/* 0x9C */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
-/* 0xA0 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
-/* 0xA4 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
-/* 0xA8 */ BT_OTHER, BT_OTHER, BT_NMSTRT, BT_OTHER,
-/* 0xAC */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
-/* 0xB0 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
-/* 0xB4 */ BT_OTHER, BT_NMSTRT, BT_OTHER, BT_NAME,
-/* 0xB8 */ BT_OTHER, BT_OTHER, BT_NMSTRT, BT_OTHER,
-/* 0xBC */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
-/* 0xC0 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
-/* 0xC4 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
-/* 0xC8 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
-/* 0xCC */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
-/* 0xD0 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
-/* 0xD4 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_OTHER,
-/* 0xD8 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
-/* 0xDC */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
-/* 0xE0 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
-/* 0xE4 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
-/* 0xE8 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
-/* 0xEC */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
-/* 0xF0 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
-/* 0xF4 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_OTHER,
-/* 0xF8 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
-/* 0xFC */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
diff --git a/ext/xml/expat/nametab.h b/ext/xml/expat/nametab.h
deleted file mode 100644
index b05e62c77a..0000000000
--- a/ext/xml/expat/nametab.h
+++ /dev/null
@@ -1,150 +0,0 @@
-static const unsigned namingBitmap[] = {
-0x00000000, 0x00000000, 0x00000000, 0x00000000,
-0x00000000, 0x00000000, 0x00000000, 0x00000000,
-0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
-0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
-0x00000000, 0x04000000, 0x87FFFFFE, 0x07FFFFFE,
-0x00000000, 0x00000000, 0xFF7FFFFF, 0xFF7FFFFF,
-0xFFFFFFFF, 0x7FF3FFFF, 0xFFFFFDFE, 0x7FFFFFFF,
-0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFE00F, 0xFC31FFFF,
-0x00FFFFFF, 0x00000000, 0xFFFF0000, 0xFFFFFFFF,
-0xFFFFFFFF, 0xF80001FF, 0x00000003, 0x00000000,
-0x00000000, 0x00000000, 0x00000000, 0x00000000,
-0xFFFFD740, 0xFFFFFFFB, 0x547F7FFF, 0x000FFFFD,
-0xFFFFDFFE, 0xFFFFFFFF, 0xDFFEFFFF, 0xFFFFFFFF,
-0xFFFF0003, 0xFFFFFFFF, 0xFFFF199F, 0x033FCFFF,
-0x00000000, 0xFFFE0000, 0x027FFFFF, 0xFFFFFFFE,
-0x0000007F, 0x00000000, 0xFFFF0000, 0x000707FF,
-0x00000000, 0x07FFFFFE, 0x000007FE, 0xFFFE0000,
-0xFFFFFFFF, 0x7CFFFFFF, 0x002F7FFF, 0x00000060,
-0xFFFFFFE0, 0x23FFFFFF, 0xFF000000, 0x00000003,
-0xFFF99FE0, 0x03C5FDFF, 0xB0000000, 0x00030003,
-0xFFF987E0, 0x036DFDFF, 0x5E000000, 0x001C0000,
-0xFFFBAFE0, 0x23EDFDFF, 0x00000000, 0x00000001,
-0xFFF99FE0, 0x23CDFDFF, 0xB0000000, 0x00000003,
-0xD63DC7E0, 0x03BFC718, 0x00000000, 0x00000000,
-0xFFFDDFE0, 0x03EFFDFF, 0x00000000, 0x00000003,
-0xFFFDDFE0, 0x03EFFDFF, 0x40000000, 0x00000003,
-0xFFFDDFE0, 0x03FFFDFF, 0x00000000, 0x00000003,
-0x00000000, 0x00000000, 0x00000000, 0x00000000,
-0xFFFFFFFE, 0x000D7FFF, 0x0000003F, 0x00000000,
-0xFEF02596, 0x200D6CAE, 0x0000001F, 0x00000000,
-0x00000000, 0x00000000, 0xFFFFFEFF, 0x000003FF,
-0x00000000, 0x00000000, 0x00000000, 0x00000000,
-0x00000000, 0x00000000, 0x00000000, 0x00000000,
-0x00000000, 0xFFFFFFFF, 0xFFFF003F, 0x007FFFFF,
-0x0007DAED, 0x50000000, 0x82315001, 0x002C62AB,
-0x40000000, 0xF580C900, 0x00000007, 0x02010800,
-0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
-0x0FFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0x03FFFFFF,
-0x3F3FFFFF, 0xFFFFFFFF, 0xAAFF3F3F, 0x3FFFFFFF,
-0xFFFFFFFF, 0x5FDFFFFF, 0x0FCF1FDC, 0x1FDC1FFF,
-0x00000000, 0x00004C40, 0x00000000, 0x00000000,
-0x00000007, 0x00000000, 0x00000000, 0x00000000,
-0x00000080, 0x000003FE, 0xFFFFFFFE, 0xFFFFFFFF,
-0x001FFFFF, 0xFFFFFFFE, 0xFFFFFFFF, 0x07FFFFFF,
-0xFFFFFFE0, 0x00001FFF, 0x00000000, 0x00000000,
-0x00000000, 0x00000000, 0x00000000, 0x00000000,
-0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
-0xFFFFFFFF, 0x0000003F, 0x00000000, 0x00000000,
-0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
-0xFFFFFFFF, 0x0000000F, 0x00000000, 0x00000000,
-0x00000000, 0x07FF6000, 0x87FFFFFE, 0x07FFFFFE,
-0x00000000, 0x00800000, 0xFF7FFFFF, 0xFF7FFFFF,
-0x00FFFFFF, 0x00000000, 0xFFFF0000, 0xFFFFFFFF,
-0xFFFFFFFF, 0xF80001FF, 0x00030003, 0x00000000,
-0xFFFFFFFF, 0xFFFFFFFF, 0x0000003F, 0x00000003,
-0xFFFFD7C0, 0xFFFFFFFB, 0x547F7FFF, 0x000FFFFD,
-0xFFFFDFFE, 0xFFFFFFFF, 0xDFFEFFFF, 0xFFFFFFFF,
-0xFFFF007B, 0xFFFFFFFF, 0xFFFF199F, 0x033FCFFF,
-0x00000000, 0xFFFE0000, 0x027FFFFF, 0xFFFFFFFE,
-0xFFFE007F, 0xBBFFFFFB, 0xFFFF0016, 0x000707FF,
-0x00000000, 0x07FFFFFE, 0x0007FFFF, 0xFFFF03FF,
-0xFFFFFFFF, 0x7CFFFFFF, 0xFFEF7FFF, 0x03FF3DFF,
-0xFFFFFFEE, 0xF3FFFFFF, 0xFF1E3FFF, 0x0000FFCF,
-0xFFF99FEE, 0xD3C5FDFF, 0xB080399F, 0x0003FFCF,
-0xFFF987E4, 0xD36DFDFF, 0x5E003987, 0x001FFFC0,
-0xFFFBAFEE, 0xF3EDFDFF, 0x00003BBF, 0x0000FFC1,
-0xFFF99FEE, 0xF3CDFDFF, 0xB0C0398F, 0x0000FFC3,
-0xD63DC7EC, 0xC3BFC718, 0x00803DC7, 0x0000FF80,
-0xFFFDDFEE, 0xC3EFFDFF, 0x00603DDF, 0x0000FFC3,
-0xFFFDDFEC, 0xC3EFFDFF, 0x40603DDF, 0x0000FFC3,
-0xFFFDDFEC, 0xC3FFFDFF, 0x00803DCF, 0x0000FFC3,
-0x00000000, 0x00000000, 0x00000000, 0x00000000,
-0xFFFFFFFE, 0x07FF7FFF, 0x03FF7FFF, 0x00000000,
-0xFEF02596, 0x3BFF6CAE, 0x03FF3F5F, 0x00000000,
-0x03000000, 0xC2A003FF, 0xFFFFFEFF, 0xFFFE03FF,
-0xFEBF0FDF, 0x02FE3FFF, 0x00000000, 0x00000000,
-0x00000000, 0x00000000, 0x00000000, 0x00000000,
-0x00000000, 0x00000000, 0x1FFF0000, 0x00000002,
-0x000000A0, 0x003EFFFE, 0xFFFFFFFE, 0xFFFFFFFF,
-0x661FFFFF, 0xFFFFFFFE, 0xFFFFFFFF, 0x77FFFFFF,
-};
-static const unsigned char nmstrtPages[] = {
-0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x00,
-0x00, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
-0x10, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x13,
-0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x15, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01,
-0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
-0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
-0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
-0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
-0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
-0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
-0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
-0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
-0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
-0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x17,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01,
-0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
-0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
-0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
-0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
-0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x18,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-};
-static const unsigned char namePages[] = {
-0x19, 0x03, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x00,
-0x00, 0x1F, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25,
-0x10, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x13,
-0x26, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x27, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01,
-0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
-0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
-0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
-0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
-0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
-0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
-0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
-0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
-0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
-0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x17,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01,
-0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
-0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
-0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
-0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
-0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x18,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-};
diff --git a/ext/xml/expat/utf8tab.h b/ext/xml/expat/utf8tab.h
deleted file mode 100644
index 9e3b6b83eb..0000000000
--- a/ext/xml/expat/utf8tab.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
-Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
-See the file COPYING for copying permission.
-*/
-
-
-/* 0x80 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
-/* 0x84 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
-/* 0x88 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
-/* 0x8C */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
-/* 0x90 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
-/* 0x94 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
-/* 0x98 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
-/* 0x9C */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
-/* 0xA0 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
-/* 0xA4 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
-/* 0xA8 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
-/* 0xAC */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
-/* 0xB0 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
-/* 0xB4 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
-/* 0xB8 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
-/* 0xBC */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
-/* 0xC0 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2,
-/* 0xC4 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2,
-/* 0xC8 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2,
-/* 0xCC */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2,
-/* 0xD0 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2,
-/* 0xD4 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2,
-/* 0xD8 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2,
-/* 0xDC */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2,
-/* 0xE0 */ BT_LEAD3, BT_LEAD3, BT_LEAD3, BT_LEAD3,
-/* 0xE4 */ BT_LEAD3, BT_LEAD3, BT_LEAD3, BT_LEAD3,
-/* 0xE8 */ BT_LEAD3, BT_LEAD3, BT_LEAD3, BT_LEAD3,
-/* 0xEC */ BT_LEAD3, BT_LEAD3, BT_LEAD3, BT_LEAD3,
-/* 0xF0 */ BT_LEAD4, BT_LEAD4, BT_LEAD4, BT_LEAD4,
-/* 0xF4 */ BT_LEAD4, BT_NONXML, BT_NONXML, BT_NONXML,
-/* 0xF8 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
-/* 0xFC */ BT_NONXML, BT_NONXML, BT_MALFORM, BT_MALFORM,
diff --git a/ext/xml/expat/winconfig.h b/ext/xml/expat/winconfig.h
deleted file mode 100644
index 77b1ece8ca..0000000000
--- a/ext/xml/expat/winconfig.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/*================================================================
-** Copyright 2000, Clark Cooper
-** All rights reserved.
-**
-** This is free software. You are permitted to copy, distribute, or modify
-** it under the terms of the MIT/X license (contained in the COPYING file
-** with this distribution.)
-**
-**
-*/
-
-#ifndef WINCONFIG_H
-#define WINCONFIG_H
-
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-#undef WIN32_LEAN_AND_MEAN
-
-#include <memory.h>
-#include <string.h>
-
-#define XML_NS 1
-#define XML_DTD 1
-#define XML_BYTE_ORDER 12
-#define XML_CONTEXT_BYTES 1024
-
-#endif /* ndef WINCONFIG_H */
diff --git a/ext/xml/expat/xmlparse.c b/ext/xml/expat/xmlparse.c
deleted file mode 100644
index d11079b7bd..0000000000
--- a/ext/xml/expat/xmlparse.c
+++ /dev/null
@@ -1,4629 +0,0 @@
-/*
-Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd
-See the file COPYING for copying permission.
-*/
-
-#if 0
-static char RCSId[]
- = "$Header$";
-#endif
-
-#include "php_compat.h"
-
-#ifdef COMPILED_FROM_DSP
-# include "winconfig.h"
-# define XMLPARSEAPI __declspec(dllexport)
-# include "expat.h"
-# undef XMLPARSEAPI
-#else
-#include <php_config.h>
-
-#ifdef __declspec
-# define XMLPARSEAPI __declspec(dllexport)
-#endif
-
-#include "expat.h"
-
-#ifdef __declspec
-# undef XMLPARSEAPI
-#endif
-#endif /* ndef COMPILED_FROM_DSP */
-
-#include <stddef.h>
-
-#ifdef XML_UNICODE
-#define XML_ENCODE_MAX XML_UTF16_ENCODE_MAX
-#define XmlConvert XmlUtf16Convert
-#define XmlGetInternalEncoding XmlGetUtf16InternalEncoding
-#define XmlGetInternalEncodingNS XmlGetUtf16InternalEncodingNS
-#define XmlEncode XmlUtf16Encode
-#define MUST_CONVERT(enc, s) (!(enc)->isUtf16 || (((unsigned long)s) & 1))
-typedef unsigned short ICHAR;
-#else
-#define XML_ENCODE_MAX XML_UTF8_ENCODE_MAX
-#define XmlConvert XmlUtf8Convert
-#define XmlGetInternalEncoding XmlGetUtf8InternalEncoding
-#define XmlGetInternalEncodingNS XmlGetUtf8InternalEncodingNS
-#define XmlEncode XmlUtf8Encode
-#define MUST_CONVERT(enc, s) (!(enc)->isUtf8)
-typedef char ICHAR;
-#endif
-
-
-#ifndef XML_NS
-
-#define XmlInitEncodingNS XmlInitEncoding
-#define XmlInitUnknownEncodingNS XmlInitUnknownEncoding
-#undef XmlGetInternalEncodingNS
-#define XmlGetInternalEncodingNS XmlGetInternalEncoding
-#define XmlParseXmlDeclNS XmlParseXmlDecl
-
-#endif
-
-#ifdef XML_UNICODE_WCHAR_T
-#define XML_T(x) L ## x
-#else
-#define XML_T(x) x
-#endif
-
-/* Round up n to be a multiple of sz, where sz is a power of 2. */
-#define ROUND_UP(n, sz) (((n) + ((sz) - 1)) & ~((sz) - 1))
-
-#include "xmltok.h"
-#include "xmlrole.h"
-
-typedef const XML_Char *KEY;
-
-typedef struct {
- KEY name;
-} NAMED;
-
-typedef struct {
- NAMED **v;
- size_t size;
- size_t used;
- size_t usedLim;
- XML_Memory_Handling_Suite *mem;
-} HASH_TABLE;
-
-typedef struct {
- NAMED **p;
- NAMED **end;
-} HASH_TABLE_ITER;
-
-#define INIT_TAG_BUF_SIZE 32 /* must be a multiple of sizeof(XML_Char) */
-#define INIT_DATA_BUF_SIZE 1024
-#define INIT_ATTS_SIZE 16
-#define INIT_BLOCK_SIZE 1024
-#define INIT_BUFFER_SIZE 1024
-
-#define EXPAND_SPARE 24
-
-typedef struct binding {
- struct prefix *prefix;
- struct binding *nextTagBinding;
- struct binding *prevPrefixBinding;
- const struct attribute_id *attId;
- XML_Char *uri;
- int uriLen;
- int uriAlloc;
-} BINDING;
-
-typedef struct prefix {
- const XML_Char *name;
- BINDING *binding;
-} PREFIX;
-
-typedef struct {
- const XML_Char *str;
- const XML_Char *localPart;
- int uriLen;
-} TAG_NAME;
-
-typedef struct tag {
- struct tag *parent;
- const char *rawName;
- int rawNameLength;
- TAG_NAME name;
- char *buf;
- char *bufEnd;
- BINDING *bindings;
-} TAG;
-
-typedef struct {
- const XML_Char *name;
- const XML_Char *textPtr;
- int textLen;
- const XML_Char *systemId;
- const XML_Char *base;
- const XML_Char *publicId;
- const XML_Char *notation;
- char open;
- char is_param;
-} ENTITY;
-
-typedef struct {
- enum XML_Content_Type type;
- enum XML_Content_Quant quant;
- const XML_Char * name;
- int firstchild;
- int lastchild;
- int childcnt;
- int nextsib;
-} CONTENT_SCAFFOLD;
-
-typedef struct block {
- struct block *next;
- int size;
- XML_Char s[1];
-} BLOCK;
-
-typedef struct {
- BLOCK *blocks;
- BLOCK *freeBlocks;
- const XML_Char *end;
- XML_Char *ptr;
- XML_Char *start;
- XML_Memory_Handling_Suite *mem;
-} STRING_POOL;
-
-/* The XML_Char before the name is used to determine whether
-an attribute has been specified. */
-typedef struct attribute_id {
- XML_Char *name;
- PREFIX *prefix;
- char maybeTokenized;
- char xmlns;
-} ATTRIBUTE_ID;
-
-typedef struct {
- const ATTRIBUTE_ID *id;
- char isCdata;
- const XML_Char *value;
-} DEFAULT_ATTRIBUTE;
-
-typedef struct {
- const XML_Char *name;
- PREFIX *prefix;
- const ATTRIBUTE_ID *idAtt;
- int nDefaultAtts;
- int allocDefaultAtts;
- DEFAULT_ATTRIBUTE *defaultAtts;
-} ELEMENT_TYPE;
-
-typedef struct {
- HASH_TABLE generalEntities;
- HASH_TABLE elementTypes;
- HASH_TABLE attributeIds;
- HASH_TABLE prefixes;
- STRING_POOL pool;
- int complete;
- int standalone;
-#ifdef XML_DTD
- HASH_TABLE paramEntities;
-#endif /* XML_DTD */
- PREFIX defaultPrefix;
- /* === scaffolding for building content model === */
- int in_eldecl;
- CONTENT_SCAFFOLD *scaffold;
- unsigned contentStringLen;
- unsigned scaffSize;
- unsigned scaffCount;
- int scaffLevel;
- int *scaffIndex;
-} DTD;
-
-typedef struct open_internal_entity {
- const char *internalEventPtr;
- const char *internalEventEndPtr;
- struct open_internal_entity *next;
- ENTITY *entity;
-} OPEN_INTERNAL_ENTITY;
-
-typedef enum XML_Error Processor(XML_Parser parser,
- const char *start,
- const char *end,
- const char **endPtr);
-
-static Processor prologProcessor;
-static Processor prologInitProcessor;
-static Processor contentProcessor;
-static Processor cdataSectionProcessor;
-#ifdef XML_DTD
-static Processor ignoreSectionProcessor;
-#endif /* XML_DTD */
-static Processor epilogProcessor;
-static Processor errorProcessor;
-static Processor externalEntityInitProcessor;
-static Processor externalEntityInitProcessor2;
-static Processor externalEntityInitProcessor3;
-static Processor externalEntityContentProcessor;
-
-static enum XML_Error
-handleUnknownEncoding(XML_Parser parser, const XML_Char *encodingName);
-static enum XML_Error
-processXmlDecl(XML_Parser parser, int isGeneralTextEntity, const char *, const char *);
-static enum XML_Error
-initializeEncoding(XML_Parser parser);
-static enum XML_Error
-doProlog(XML_Parser parser, const ENCODING *enc, const char *s,
- const char *end, int tok, const char *next, const char **nextPtr);
-static enum XML_Error
-processInternalParamEntity(XML_Parser parser, ENTITY *entity);
-static enum XML_Error
-doContent(XML_Parser parser, int startTagLevel, const ENCODING *enc,
- const char *start, const char *end, const char **endPtr);
-static enum XML_Error
-doCdataSection(XML_Parser parser, const ENCODING *, const char **startPtr, const char *end, const char **nextPtr);
-#ifdef XML_DTD
-static enum XML_Error
-doIgnoreSection(XML_Parser parser, const ENCODING *, const char **startPtr, const char *end, const char **nextPtr);
-#endif /* XML_DTD */
-static enum XML_Error storeAtts(XML_Parser parser, const ENCODING *, const char *s,
- TAG_NAME *tagNamePtr, BINDING **bindingsPtr);
-static
-int addBinding(XML_Parser parser, PREFIX *prefix, const ATTRIBUTE_ID *attId, const XML_Char *uri, BINDING **bindingsPtr);
-
-static int
-defineAttribute(ELEMENT_TYPE *type, ATTRIBUTE_ID *,
- int isCdata, int isId, const XML_Char *dfltValue,
- XML_Parser parser);
-
-static enum XML_Error
-storeAttributeValue(XML_Parser parser, const ENCODING *, int isCdata, const char *, const char *,
- STRING_POOL *);
-static enum XML_Error
-appendAttributeValue(XML_Parser parser, const ENCODING *, int isCdata, const char *, const char *,
- STRING_POOL *);
-static ATTRIBUTE_ID *
-getAttributeId(XML_Parser parser, const ENCODING *enc, const char *start, const char *end);
-static int setElementTypePrefix(XML_Parser parser, ELEMENT_TYPE *);
-static enum XML_Error
-storeEntityValue(XML_Parser parser, const ENCODING *enc, const char *start, const char *end);
-static int
-reportProcessingInstruction(XML_Parser parser, const ENCODING *enc, const char *start, const char *end);
-static int
-reportComment(XML_Parser parser, const ENCODING *enc, const char *start, const char *end);
-static void
-reportDefault(XML_Parser parser, const ENCODING *enc, const char *start, const char *end);
-
-static const XML_Char *getContext(XML_Parser parser);
-static int setContext(XML_Parser parser, const XML_Char *context);
-static void normalizePublicId(XML_Char *s);
-static int dtdInit(DTD *, XML_Parser parser);
-
-static void dtdDestroy(DTD *, XML_Parser parser);
-
-static int dtdCopy(DTD *newDtd, const DTD *oldDtd, XML_Parser parser);
-
-static int copyEntityTable(HASH_TABLE *, STRING_POOL *, const HASH_TABLE *,
- XML_Parser parser);
-
-#ifdef XML_DTD
-static void dtdSwap(DTD *, DTD *);
-#endif /* XML_DTD */
-
-static NAMED *lookup(HASH_TABLE *table, KEY name, size_t createSize);
-
-static void hashTableInit(HASH_TABLE *, XML_Memory_Handling_Suite *ms);
-
-static void hashTableDestroy(HASH_TABLE *);
-static void hashTableIterInit(HASH_TABLE_ITER *, const HASH_TABLE *);
-static NAMED *hashTableIterNext(HASH_TABLE_ITER *);
-static void poolInit(STRING_POOL *, XML_Memory_Handling_Suite *ms);
-static void poolClear(STRING_POOL *);
-static void poolDestroy(STRING_POOL *);
-static XML_Char *poolAppend(STRING_POOL *pool, const ENCODING *enc,
- const char *ptr, const char *end);
-static XML_Char *poolStoreString(STRING_POOL *pool, const ENCODING *enc,
- const char *ptr, const char *end);
-
-static int poolGrow(STRING_POOL *pool);
-
-static int nextScaffoldPart(XML_Parser parser);
-static XML_Content *build_model(XML_Parser parser);
-
-static const XML_Char *poolCopyString(STRING_POOL *pool, const XML_Char *s);
-static const XML_Char *poolCopyStringN(STRING_POOL *pool, const XML_Char *s, int n);
-static const XML_Char *poolAppendString(STRING_POOL *pool, const XML_Char *s);
-static ELEMENT_TYPE * getElementType(XML_Parser Paraser,
- const ENCODING *enc,
- const char *ptr,
- const char *end);
-
-#define poolStart(pool) ((pool)->start)
-#define poolEnd(pool) ((pool)->ptr)
-#define poolLength(pool) ((pool)->ptr - (pool)->start)
-#define poolChop(pool) ((void)--(pool->ptr))
-#define poolLastChar(pool) (((pool)->ptr)[-1])
-#define poolDiscard(pool) ((pool)->ptr = (pool)->start)
-#define poolFinish(pool) ((pool)->start = (pool)->ptr)
-#define poolAppendChar(pool, c) \
- (((pool)->ptr == (pool)->end && !poolGrow(pool)) \
- ? 0 \
- : ((*((pool)->ptr)++ = c), 1))
-
-typedef struct {
- /* The first member must be userData so that the XML_GetUserData macro works. */
- void *m_userData;
- void *m_handlerArg;
- char *m_buffer;
- XML_Memory_Handling_Suite m_mem;
- /* first character to be parsed */
- const char *m_bufferPtr;
- /* past last character to be parsed */
- char *m_bufferEnd;
- /* allocated end of buffer */
- const char *m_bufferLim;
- long m_parseEndByteIndex;
- const char *m_parseEndPtr;
- XML_Char *m_dataBuf;
- XML_Char *m_dataBufEnd;
- XML_StartElementHandler m_startElementHandler;
- XML_EndElementHandler m_endElementHandler;
- XML_CharacterDataHandler m_characterDataHandler;
- XML_ProcessingInstructionHandler m_processingInstructionHandler;
- XML_CommentHandler m_commentHandler;
- XML_StartCdataSectionHandler m_startCdataSectionHandler;
- XML_EndCdataSectionHandler m_endCdataSectionHandler;
- XML_DefaultHandler m_defaultHandler;
- XML_StartDoctypeDeclHandler m_startDoctypeDeclHandler;
- XML_EndDoctypeDeclHandler m_endDoctypeDeclHandler;
- XML_UnparsedEntityDeclHandler m_unparsedEntityDeclHandler;
- XML_NotationDeclHandler m_notationDeclHandler;
- XML_StartNamespaceDeclHandler m_startNamespaceDeclHandler;
- XML_EndNamespaceDeclHandler m_endNamespaceDeclHandler;
- XML_NotStandaloneHandler m_notStandaloneHandler;
- XML_ExternalEntityRefHandler m_externalEntityRefHandler;
- void *m_externalEntityRefHandlerArg;
- XML_UnknownEncodingHandler m_unknownEncodingHandler;
- XML_ElementDeclHandler m_elementDeclHandler;
- XML_AttlistDeclHandler m_attlistDeclHandler;
- XML_EntityDeclHandler m_entityDeclHandler;
- XML_XmlDeclHandler m_xmlDeclHandler;
- const ENCODING *m_encoding;
- INIT_ENCODING m_initEncoding;
- const ENCODING *m_internalEncoding;
- const XML_Char *m_protocolEncodingName;
- int m_ns;
- int m_ns_triplets;
- void *m_unknownEncodingMem;
- void *m_unknownEncodingData;
- void *m_unknownEncodingHandlerData;
- void (*m_unknownEncodingRelease)(void *);
- PROLOG_STATE m_prologState;
- Processor *m_processor;
- enum XML_Error m_errorCode;
- const char *m_eventPtr;
- const char *m_eventEndPtr;
- const char *m_positionPtr;
- OPEN_INTERNAL_ENTITY *m_openInternalEntities;
- int m_defaultExpandInternalEntities;
- int m_tagLevel;
- ENTITY *m_declEntity;
- const XML_Char *m_doctypeName;
- const XML_Char *m_doctypeSysid;
- const XML_Char *m_doctypePubid;
- const XML_Char *m_declAttributeType;
- const XML_Char *m_declNotationName;
- const XML_Char *m_declNotationPublicId;
- ELEMENT_TYPE *m_declElementType;
- ATTRIBUTE_ID *m_declAttributeId;
- char m_declAttributeIsCdata;
- char m_declAttributeIsId;
- DTD m_dtd;
- const XML_Char *m_curBase;
- TAG *m_tagStack;
- TAG *m_freeTagList;
- BINDING *m_inheritedBindings;
- BINDING *m_freeBindingList;
- int m_attsSize;
- int m_nSpecifiedAtts;
- int m_idAttIndex;
- ATTRIBUTE *m_atts;
- POSITION m_position;
- STRING_POOL m_tempPool;
- STRING_POOL m_temp2Pool;
- char *m_groupConnector;
- unsigned m_groupSize;
- int m_hadExternalDoctype;
- XML_Char m_namespaceSeparator;
-#ifdef XML_DTD
- enum XML_ParamEntityParsing m_paramEntityParsing;
- XML_Parser m_parentParser;
-#endif
-} Parser;
-
-#define MALLOC(s) (((Parser *)parser)->m_mem.malloc_fcn((s)))
-#define REALLOC(p,s) (((Parser *)parser)->m_mem.realloc_fcn((p),(s)))
-#define FREE(p) (((Parser *)parser)->m_mem.free_fcn((p)))
-
-#define userData (((Parser *)parser)->m_userData)
-#define handlerArg (((Parser *)parser)->m_handlerArg)
-#define startElementHandler (((Parser *)parser)->m_startElementHandler)
-#define endElementHandler (((Parser *)parser)->m_endElementHandler)
-#define characterDataHandler (((Parser *)parser)->m_characterDataHandler)
-#define processingInstructionHandler (((Parser *)parser)->m_processingInstructionHandler)
-#define commentHandler (((Parser *)parser)->m_commentHandler)
-#define startCdataSectionHandler (((Parser *)parser)->m_startCdataSectionHandler)
-#define endCdataSectionHandler (((Parser *)parser)->m_endCdataSectionHandler)
-#define defaultHandler (((Parser *)parser)->m_defaultHandler)
-#define startDoctypeDeclHandler (((Parser *)parser)->m_startDoctypeDeclHandler)
-#define endDoctypeDeclHandler (((Parser *)parser)->m_endDoctypeDeclHandler)
-#define unparsedEntityDeclHandler (((Parser *)parser)->m_unparsedEntityDeclHandler)
-#define notationDeclHandler (((Parser *)parser)->m_notationDeclHandler)
-#define startNamespaceDeclHandler (((Parser *)parser)->m_startNamespaceDeclHandler)
-#define endNamespaceDeclHandler (((Parser *)parser)->m_endNamespaceDeclHandler)
-#define notStandaloneHandler (((Parser *)parser)->m_notStandaloneHandler)
-#define externalEntityRefHandler (((Parser *)parser)->m_externalEntityRefHandler)
-#define externalEntityRefHandlerArg (((Parser *)parser)->m_externalEntityRefHandlerArg)
-#define unknownEncodingHandler (((Parser *)parser)->m_unknownEncodingHandler)
-#define elementDeclHandler (((Parser *)parser)->m_elementDeclHandler)
-#define attlistDeclHandler (((Parser *)parser)->m_attlistDeclHandler)
-#define entityDeclHandler (((Parser *)parser)->m_entityDeclHandler)
-#define xmlDeclHandler (((Parser *)parser)->m_xmlDeclHandler)
-#define encoding (((Parser *)parser)->m_encoding)
-#define initEncoding (((Parser *)parser)->m_initEncoding)
-#define internalEncoding (((Parser *)parser)->m_internalEncoding)
-#define unknownEncodingMem (((Parser *)parser)->m_unknownEncodingMem)
-#define unknownEncodingData (((Parser *)parser)->m_unknownEncodingData)
-#define unknownEncodingHandlerData \
- (((Parser *)parser)->m_unknownEncodingHandlerData)
-#define unknownEncodingRelease (((Parser *)parser)->m_unknownEncodingRelease)
-#define protocolEncodingName (((Parser *)parser)->m_protocolEncodingName)
-#define ns (((Parser *)parser)->m_ns)
-#define ns_triplets (((Parser *)parser)->m_ns_triplets)
-#define prologState (((Parser *)parser)->m_prologState)
-#define processor (((Parser *)parser)->m_processor)
-#define errorCode (((Parser *)parser)->m_errorCode)
-#define eventPtr (((Parser *)parser)->m_eventPtr)
-#define eventEndPtr (((Parser *)parser)->m_eventEndPtr)
-#define positionPtr (((Parser *)parser)->m_positionPtr)
-#define position (((Parser *)parser)->m_position)
-#define openInternalEntities (((Parser *)parser)->m_openInternalEntities)
-#define defaultExpandInternalEntities (((Parser *)parser)->m_defaultExpandInternalEntities)
-#define tagLevel (((Parser *)parser)->m_tagLevel)
-#define buffer (((Parser *)parser)->m_buffer)
-#define bufferPtr (((Parser *)parser)->m_bufferPtr)
-#define bufferEnd (((Parser *)parser)->m_bufferEnd)
-#define parseEndByteIndex (((Parser *)parser)->m_parseEndByteIndex)
-#define parseEndPtr (((Parser *)parser)->m_parseEndPtr)
-#define bufferLim (((Parser *)parser)->m_bufferLim)
-#define dataBuf (((Parser *)parser)->m_dataBuf)
-#define dataBufEnd (((Parser *)parser)->m_dataBufEnd)
-#define dtd (((Parser *)parser)->m_dtd)
-#define curBase (((Parser *)parser)->m_curBase)
-#define declEntity (((Parser *)parser)->m_declEntity)
-#define doctypeName (((Parser *)parser)->m_doctypeName)
-#define doctypeSysid (((Parser *)parser)->m_doctypeSysid)
-#define doctypePubid (((Parser *)parser)->m_doctypePubid)
-#define declAttributeType (((Parser *)parser)->m_declAttributeType)
-#define declNotationName (((Parser *)parser)->m_declNotationName)
-#define declNotationPublicId (((Parser *)parser)->m_declNotationPublicId)
-#define declElementType (((Parser *)parser)->m_declElementType)
-#define declAttributeId (((Parser *)parser)->m_declAttributeId)
-#define declAttributeIsCdata (((Parser *)parser)->m_declAttributeIsCdata)
-#define declAttributeIsId (((Parser *)parser)->m_declAttributeIsId)
-#define freeTagList (((Parser *)parser)->m_freeTagList)
-#define freeBindingList (((Parser *)parser)->m_freeBindingList)
-#define inheritedBindings (((Parser *)parser)->m_inheritedBindings)
-#define tagStack (((Parser *)parser)->m_tagStack)
-#define atts (((Parser *)parser)->m_atts)
-#define attsSize (((Parser *)parser)->m_attsSize)
-#define nSpecifiedAtts (((Parser *)parser)->m_nSpecifiedAtts)
-#define idAttIndex (((Parser *)parser)->m_idAttIndex)
-#define tempPool (((Parser *)parser)->m_tempPool)
-#define temp2Pool (((Parser *)parser)->m_temp2Pool)
-#define groupConnector (((Parser *)parser)->m_groupConnector)
-#define groupSize (((Parser *)parser)->m_groupSize)
-#define hadExternalDoctype (((Parser *)parser)->m_hadExternalDoctype)
-#define namespaceSeparator (((Parser *)parser)->m_namespaceSeparator)
-#ifdef XML_DTD
-#define parentParser (((Parser *)parser)->m_parentParser)
-#define paramEntityParsing (((Parser *)parser)->m_paramEntityParsing)
-#endif /* XML_DTD */
-
-#ifdef COMPILED_FROM_DSP
-BOOL WINAPI DllMain(HINSTANCE h, DWORD r, LPVOID p) {
- return TRUE;
-}
-#endif /* def COMPILED_FROM_DSP */
-
-#ifdef _MSC_VER
-#ifdef _DEBUG
-Parser *asParser(XML_Parser parser)
-{
- return parser;
-}
-#endif
-#endif
-
-XML_Parser XML_ParserCreate(const XML_Char *encodingName)
-{
- return XML_ParserCreate_MM(encodingName, NULL, NULL);
-}
-
-XML_Parser XML_ParserCreateNS(const XML_Char *encodingName, XML_Char nsSep)
-{
- XML_Char tmp[2];
- *tmp = nsSep;
- return XML_ParserCreate_MM(encodingName, NULL, tmp);
-}
-
-XML_Parser
-XML_ParserCreate_MM(const XML_Char *encodingName,
- const XML_Memory_Handling_Suite *memsuite,
- const XML_Char *nameSep) {
-
- XML_Parser parser;
- static
- const XML_Char implicitContext[] = {
- XML_T('x'), XML_T('m'), XML_T('l'), XML_T('='),
- XML_T('h'), XML_T('t'), XML_T('t'), XML_T('p'), XML_T(':'),
- XML_T('/'), XML_T('/'), XML_T('w'), XML_T('w'), XML_T('w'),
- XML_T('.'), XML_T('w'), XML_T('3'),
- XML_T('.'), XML_T('o'), XML_T('r'), XML_T('g'),
- XML_T('/'), XML_T('X'), XML_T('M'), XML_T('L'),
- XML_T('/'), XML_T('1'), XML_T('9'), XML_T('9'), XML_T('8'),
- XML_T('/'), XML_T('n'), XML_T('a'), XML_T('m'), XML_T('e'),
- XML_T('s'), XML_T('p'), XML_T('a'), XML_T('c'), XML_T('e'),
- XML_T('\0')
- };
-
-
- if (memsuite) {
- XML_Memory_Handling_Suite *mtemp;
- parser = memsuite->malloc_fcn(sizeof(Parser));
- mtemp = &(((Parser *) parser)->m_mem);
- mtemp->malloc_fcn = memsuite->malloc_fcn;
- mtemp->realloc_fcn = memsuite->realloc_fcn;
- mtemp->free_fcn = memsuite->free_fcn;
- }
- else {
- XML_Memory_Handling_Suite *mtemp;
- parser = malloc(sizeof(Parser));
- mtemp = &(((Parser *) parser)->m_mem);
- mtemp->malloc_fcn = malloc;
- mtemp->realloc_fcn = realloc;
- mtemp->free_fcn = free;
- }
-
- if (!parser)
- return parser;
- processor = prologInitProcessor;
- XmlPrologStateInit(&prologState);
- userData = 0;
- handlerArg = 0;
- startElementHandler = 0;
- endElementHandler = 0;
- characterDataHandler = 0;
- processingInstructionHandler = 0;
- commentHandler = 0;
- startCdataSectionHandler = 0;
- endCdataSectionHandler = 0;
- defaultHandler = 0;
- startDoctypeDeclHandler = 0;
- endDoctypeDeclHandler = 0;
- unparsedEntityDeclHandler = 0;
- notationDeclHandler = 0;
- startNamespaceDeclHandler = 0;
- endNamespaceDeclHandler = 0;
- notStandaloneHandler = 0;
- externalEntityRefHandler = 0;
- externalEntityRefHandlerArg = parser;
- unknownEncodingHandler = 0;
- elementDeclHandler = 0;
- attlistDeclHandler = 0;
- entityDeclHandler = 0;
- xmlDeclHandler = 0;
- buffer = 0;
- bufferPtr = 0;
- bufferEnd = 0;
- parseEndByteIndex = 0;
- parseEndPtr = 0;
- bufferLim = 0;
- declElementType = 0;
- declAttributeId = 0;
- declEntity = 0;
- doctypeName = 0;
- doctypeSysid = 0;
- doctypePubid = 0;
- declAttributeType = 0;
- declNotationName = 0;
- declNotationPublicId = 0;
- memset(&position, 0, sizeof(POSITION));
- errorCode = XML_ERROR_NONE;
- eventPtr = 0;
- eventEndPtr = 0;
- positionPtr = 0;
- openInternalEntities = 0;
- tagLevel = 0;
- tagStack = 0;
- freeTagList = 0;
- freeBindingList = 0;
- inheritedBindings = 0;
- attsSize = INIT_ATTS_SIZE;
- atts = MALLOC(attsSize * sizeof(ATTRIBUTE));
- nSpecifiedAtts = 0;
- dataBuf = MALLOC(INIT_DATA_BUF_SIZE * sizeof(XML_Char));
- groupSize = 0;
- groupConnector = 0;
- hadExternalDoctype = 0;
- unknownEncodingMem = 0;
- unknownEncodingRelease = 0;
- unknownEncodingData = 0;
- unknownEncodingHandlerData = 0;
- namespaceSeparator = '!';
-#ifdef XML_DTD
- parentParser = 0;
- paramEntityParsing = XML_PARAM_ENTITY_PARSING_NEVER;
-#endif
- ns = 0;
- ns_triplets = 0;
- poolInit(&tempPool, &(((Parser *) parser)->m_mem));
- poolInit(&temp2Pool, &(((Parser *) parser)->m_mem));
- protocolEncodingName = encodingName ? poolCopyString(&tempPool, encodingName) : 0;
- curBase = 0;
- if (!dtdInit(&dtd, parser) || !atts || !dataBuf
- || (encodingName && !protocolEncodingName)) {
- XML_ParserFree(parser);
- return 0;
- }
- dataBufEnd = dataBuf + INIT_DATA_BUF_SIZE;
-
- if (nameSep) {
- XmlInitEncodingNS(&initEncoding, &encoding, 0);
- ns = 1;
- internalEncoding = XmlGetInternalEncodingNS();
- namespaceSeparator = *nameSep;
-
- if (! setContext(parser, implicitContext)) {
- XML_ParserFree(parser);
- return 0;
- }
- }
- else {
- XmlInitEncoding(&initEncoding, &encoding, 0);
- internalEncoding = XmlGetInternalEncoding();
- }
-
- return parser;
-} /* End XML_ParserCreate_MM */
-
-int XML_SetEncoding(XML_Parser parser, const XML_Char *encodingName)
-{
- if (!encodingName)
- protocolEncodingName = 0;
- else {
- protocolEncodingName = poolCopyString(&tempPool, encodingName);
- if (!protocolEncodingName)
- return 0;
- }
- return 1;
-}
-
-XML_Parser XML_ExternalEntityParserCreate(XML_Parser oldParser,
- const XML_Char *context,
- const XML_Char *encodingName)
-{
- XML_Parser parser = oldParser;
- DTD *oldDtd = &dtd;
- XML_StartElementHandler oldStartElementHandler = startElementHandler;
- XML_EndElementHandler oldEndElementHandler = endElementHandler;
- XML_CharacterDataHandler oldCharacterDataHandler = characterDataHandler;
- XML_ProcessingInstructionHandler oldProcessingInstructionHandler = processingInstructionHandler;
- XML_CommentHandler oldCommentHandler = commentHandler;
- XML_StartCdataSectionHandler oldStartCdataSectionHandler = startCdataSectionHandler;
- XML_EndCdataSectionHandler oldEndCdataSectionHandler = endCdataSectionHandler;
- XML_DefaultHandler oldDefaultHandler = defaultHandler;
- XML_UnparsedEntityDeclHandler oldUnparsedEntityDeclHandler = unparsedEntityDeclHandler;
- XML_NotationDeclHandler oldNotationDeclHandler = notationDeclHandler;
- XML_StartNamespaceDeclHandler oldStartNamespaceDeclHandler = startNamespaceDeclHandler;
- XML_EndNamespaceDeclHandler oldEndNamespaceDeclHandler = endNamespaceDeclHandler;
- XML_NotStandaloneHandler oldNotStandaloneHandler = notStandaloneHandler;
- XML_ExternalEntityRefHandler oldExternalEntityRefHandler = externalEntityRefHandler;
- XML_UnknownEncodingHandler oldUnknownEncodingHandler = unknownEncodingHandler;
- XML_ElementDeclHandler oldElementDeclHandler = elementDeclHandler;
- XML_AttlistDeclHandler oldAttlistDeclHandler = attlistDeclHandler;
- XML_EntityDeclHandler oldEntityDeclHandler = entityDeclHandler;
- XML_XmlDeclHandler oldXmlDeclHandler = xmlDeclHandler;
- ELEMENT_TYPE * oldDeclElementType = declElementType;
-
- void *oldUserData = userData;
- void *oldHandlerArg = handlerArg;
- int oldDefaultExpandInternalEntities = defaultExpandInternalEntities;
- void *oldExternalEntityRefHandlerArg = externalEntityRefHandlerArg;
-#ifdef XML_DTD
- int oldParamEntityParsing = paramEntityParsing;
-#endif
- int oldns_triplets = ns_triplets;
-
- if (ns) {
- XML_Char tmp[2];
-
- *tmp = namespaceSeparator;
- parser = XML_ParserCreate_MM(encodingName, &((Parser *)parser)->m_mem,
- tmp);
- }
- else {
- parser = XML_ParserCreate_MM(encodingName, &((Parser *)parser)->m_mem,
- NULL);
- }
-
- if (!parser)
- return 0;
-
- startElementHandler = oldStartElementHandler;
- endElementHandler = oldEndElementHandler;
- characterDataHandler = oldCharacterDataHandler;
- processingInstructionHandler = oldProcessingInstructionHandler;
- commentHandler = oldCommentHandler;
- startCdataSectionHandler = oldStartCdataSectionHandler;
- endCdataSectionHandler = oldEndCdataSectionHandler;
- defaultHandler = oldDefaultHandler;
- unparsedEntityDeclHandler = oldUnparsedEntityDeclHandler;
- notationDeclHandler = oldNotationDeclHandler;
- startNamespaceDeclHandler = oldStartNamespaceDeclHandler;
- endNamespaceDeclHandler = oldEndNamespaceDeclHandler;
- notStandaloneHandler = oldNotStandaloneHandler;
- externalEntityRefHandler = oldExternalEntityRefHandler;
- unknownEncodingHandler = oldUnknownEncodingHandler;
- elementDeclHandler = oldElementDeclHandler;
- attlistDeclHandler = oldAttlistDeclHandler;
- entityDeclHandler = oldEntityDeclHandler;
- xmlDeclHandler = oldXmlDeclHandler;
- declElementType = oldDeclElementType;
- userData = oldUserData;
- if (oldUserData == oldHandlerArg)
- handlerArg = userData;
- else
- handlerArg = parser;
- if (oldExternalEntityRefHandlerArg != oldParser)
- externalEntityRefHandlerArg = oldExternalEntityRefHandlerArg;
- defaultExpandInternalEntities = oldDefaultExpandInternalEntities;
- ns_triplets = oldns_triplets;
-#ifdef XML_DTD
- paramEntityParsing = oldParamEntityParsing;
- if (context) {
-#endif /* XML_DTD */
- if (!dtdCopy(&dtd, oldDtd, parser) || !setContext(parser, context)) {
- XML_ParserFree(parser);
- return 0;
- }
- processor = externalEntityInitProcessor;
-#ifdef XML_DTD
- }
- else {
- dtdSwap(&dtd, oldDtd);
- parentParser = oldParser;
- XmlPrologStateInitExternalEntity(&prologState);
- dtd.complete = 1;
- hadExternalDoctype = 1;
- }
-#endif /* XML_DTD */
- return parser;
-}
-
-static
-void destroyBindings(BINDING *bindings, XML_Parser parser)
-{
- for (;;) {
- BINDING *b = bindings;
- if (!b)
- break;
- bindings = b->nextTagBinding;
- FREE(b->uri);
- FREE(b);
- }
-}
-
-void XML_ParserFree(XML_Parser parser)
-{
- for (;;) {
- TAG *p;
- if (tagStack == 0) {
- if (freeTagList == 0)
- break;
- tagStack = freeTagList;
- freeTagList = 0;
- }
- p = tagStack;
- tagStack = tagStack->parent;
- FREE(p->buf);
- destroyBindings(p->bindings, parser);
- FREE(p);
- }
- destroyBindings(freeBindingList, parser);
- destroyBindings(inheritedBindings, parser);
- poolDestroy(&tempPool);
- poolDestroy(&temp2Pool);
-#ifdef XML_DTD
- if (parentParser) {
- if (hadExternalDoctype)
- dtd.complete = 0;
- dtdSwap(&dtd, &((Parser *)parentParser)->m_dtd);
- }
-#endif /* XML_DTD */
- dtdDestroy(&dtd, parser);
- FREE((void *)atts);
- if (groupConnector)
- FREE(groupConnector);
- if (buffer)
- FREE(buffer);
- FREE(dataBuf);
- if (unknownEncodingMem)
- FREE(unknownEncodingMem);
- if (unknownEncodingRelease)
- unknownEncodingRelease(unknownEncodingData);
- FREE(parser);
-}
-
-void XML_UseParserAsHandlerArg(XML_Parser parser)
-{
- handlerArg = parser;
-}
-
-void
-XML_SetReturnNSTriplet(XML_Parser parser, int do_nst) {
- ns_triplets = do_nst;
-}
-
-void XML_SetUserData(XML_Parser parser, void *p)
-{
- if (handlerArg == userData)
- handlerArg = userData = p;
- else
- userData = p;
-}
-
-int XML_SetBase(XML_Parser parser, const XML_Char *p)
-{
- if (p) {
- p = poolCopyString(&dtd.pool, p);
- if (!p)
- return 0;
- curBase = p;
- }
- else
- curBase = 0;
- return 1;
-}
-
-const XML_Char *XML_GetBase(XML_Parser parser)
-{
- return curBase;
-}
-
-int XML_GetSpecifiedAttributeCount(XML_Parser parser)
-{
- return nSpecifiedAtts;
-}
-
-int XML_GetIdAttributeIndex(XML_Parser parser)
-{
- return idAttIndex;
-}
-
-void XML_SetElementHandler(XML_Parser parser,
- XML_StartElementHandler start,
- XML_EndElementHandler end)
-{
- startElementHandler = start;
- endElementHandler = end;
-}
-
-void XML_SetStartElementHandler(XML_Parser parser,
- XML_StartElementHandler start) {
- startElementHandler = start;
-}
-
-void XML_SetEndElementHandler(XML_Parser parser,
- XML_EndElementHandler end) {
- endElementHandler = end;
-}
-
-void XML_SetCharacterDataHandler(XML_Parser parser,
- XML_CharacterDataHandler handler)
-{
- characterDataHandler = handler;
-}
-
-void XML_SetProcessingInstructionHandler(XML_Parser parser,
- XML_ProcessingInstructionHandler handler)
-{
- processingInstructionHandler = handler;
-}
-
-void XML_SetCommentHandler(XML_Parser parser,
- XML_CommentHandler handler)
-{
- commentHandler = handler;
-}
-
-void XML_SetCdataSectionHandler(XML_Parser parser,
- XML_StartCdataSectionHandler start,
- XML_EndCdataSectionHandler end)
-{
- startCdataSectionHandler = start;
- endCdataSectionHandler = end;
-}
-
-void XML_SetStartCdataSectionHandler(XML_Parser parser,
- XML_StartCdataSectionHandler start) {
- startCdataSectionHandler = start;
-}
-
-void XML_SetEndCdataSectionHandler(XML_Parser parser,
- XML_EndCdataSectionHandler end) {
- endCdataSectionHandler = end;
-}
-
-void XML_SetDefaultHandler(XML_Parser parser,
- XML_DefaultHandler handler)
-{
- defaultHandler = handler;
- defaultExpandInternalEntities = 0;
-}
-
-void XML_SetDefaultHandlerExpand(XML_Parser parser,
- XML_DefaultHandler handler)
-{
- defaultHandler = handler;
- defaultExpandInternalEntities = 1;
-}
-
-void XML_SetDoctypeDeclHandler(XML_Parser parser,
- XML_StartDoctypeDeclHandler start,
- XML_EndDoctypeDeclHandler end)
-{
- startDoctypeDeclHandler = start;
- endDoctypeDeclHandler = end;
-}
-
-void XML_SetStartDoctypeDeclHandler(XML_Parser parser,
- XML_StartDoctypeDeclHandler start) {
- startDoctypeDeclHandler = start;
-}
-
-void XML_SetEndDoctypeDeclHandler(XML_Parser parser,
- XML_EndDoctypeDeclHandler end) {
- endDoctypeDeclHandler = end;
-}
-
-void XML_SetUnparsedEntityDeclHandler(XML_Parser parser,
- XML_UnparsedEntityDeclHandler handler)
-{
- unparsedEntityDeclHandler = handler;
-}
-
-void XML_SetNotationDeclHandler(XML_Parser parser,
- XML_NotationDeclHandler handler)
-{
- notationDeclHandler = handler;
-}
-
-void XML_SetNamespaceDeclHandler(XML_Parser parser,
- XML_StartNamespaceDeclHandler start,
- XML_EndNamespaceDeclHandler end)
-{
- startNamespaceDeclHandler = start;
- endNamespaceDeclHandler = end;
-}
-
-void XML_SetStartNamespaceDeclHandler(XML_Parser parser,
- XML_StartNamespaceDeclHandler start) {
- startNamespaceDeclHandler = start;
-}
-
-void XML_SetEndNamespaceDeclHandler(XML_Parser parser,
- XML_EndNamespaceDeclHandler end) {
- endNamespaceDeclHandler = end;
-}
-
-
-void XML_SetNotStandaloneHandler(XML_Parser parser,
- XML_NotStandaloneHandler handler)
-{
- notStandaloneHandler = handler;
-}
-
-void XML_SetExternalEntityRefHandler(XML_Parser parser,
- XML_ExternalEntityRefHandler handler)
-{
- externalEntityRefHandler = handler;
-}
-
-void XML_SetExternalEntityRefHandlerArg(XML_Parser parser, void *arg)
-{
- if (arg)
- externalEntityRefHandlerArg = arg;
- else
- externalEntityRefHandlerArg = parser;
-}
-
-void XML_SetUnknownEncodingHandler(XML_Parser parser,
- XML_UnknownEncodingHandler handler,
- void *data)
-{
- unknownEncodingHandler = handler;
- unknownEncodingHandlerData = data;
-}
-
-void XML_SetElementDeclHandler(XML_Parser parser,
- XML_ElementDeclHandler eldecl)
-{
- elementDeclHandler = eldecl;
-}
-
-void XML_SetAttlistDeclHandler(XML_Parser parser,
- XML_AttlistDeclHandler attdecl)
-{
- attlistDeclHandler = attdecl;
-}
-
-void XML_SetEntityDeclHandler(XML_Parser parser,
- XML_EntityDeclHandler handler)
-{
- entityDeclHandler = handler;
-}
-
-void XML_SetXmlDeclHandler(XML_Parser parser,
- XML_XmlDeclHandler handler) {
- xmlDeclHandler = handler;
-}
-
-int XML_SetParamEntityParsing(XML_Parser parser,
- enum XML_ParamEntityParsing parsing)
-{
-#ifdef XML_DTD
- paramEntityParsing = parsing;
- return 1;
-#else
- return parsing == XML_PARAM_ENTITY_PARSING_NEVER;
-#endif
-}
-
-int XML_Parse(XML_Parser parser, const char *s, int len, int isFinal)
-{
- if (len == 0) {
- if (!isFinal)
- return 1;
- positionPtr = bufferPtr;
- errorCode = processor(parser, bufferPtr, parseEndPtr = bufferEnd, 0);
- if (errorCode == XML_ERROR_NONE)
- return 1;
- eventEndPtr = eventPtr;
- processor = errorProcessor;
- return 0;
- }
-#ifndef XML_CONTEXT_BYTES
- else if (bufferPtr == bufferEnd) {
- const char *end;
- int nLeftOver;
- parseEndByteIndex += len;
- positionPtr = s;
- if (isFinal) {
- errorCode = processor(parser, s, parseEndPtr = s + len, 0);
- if (errorCode == XML_ERROR_NONE)
- return 1;
- eventEndPtr = eventPtr;
- processor = errorProcessor;
- return 0;
- }
- errorCode = processor(parser, s, parseEndPtr = s + len, &end);
- if (errorCode != XML_ERROR_NONE) {
- eventEndPtr = eventPtr;
- processor = errorProcessor;
- return 0;
- }
- XmlUpdatePosition(encoding, positionPtr, end, &position);
- nLeftOver = s + len - end;
- if (nLeftOver) {
- if (buffer == 0 || nLeftOver > bufferLim - buffer) {
- /* FIXME avoid integer overflow */
- buffer = buffer == 0 ? MALLOC(len * 2) : REALLOC(buffer, len * 2);
- /* FIXME storage leak if realloc fails */
- if (!buffer) {
- errorCode = XML_ERROR_NO_MEMORY;
- eventPtr = eventEndPtr = 0;
- processor = errorProcessor;
- return 0;
- }
- bufferLim = buffer + len * 2;
- }
- memcpy(buffer, end, nLeftOver);
- bufferPtr = buffer;
- bufferEnd = buffer + nLeftOver;
- }
- return 1;
- }
-#endif /* not defined XML_CONTEXT_BYTES */
- else {
- memcpy(XML_GetBuffer(parser, len), s, len);
- return XML_ParseBuffer(parser, len, isFinal);
- }
-}
-
-int XML_ParseBuffer(XML_Parser parser, int len, int isFinal)
-{
- const char *start = bufferPtr;
- positionPtr = start;
- bufferEnd += len;
- parseEndByteIndex += len;
- errorCode = processor(parser, start, parseEndPtr = bufferEnd,
- isFinal ? (const char **)0 : &bufferPtr);
- if (errorCode == XML_ERROR_NONE) {
- if (!isFinal)
- XmlUpdatePosition(encoding, positionPtr, bufferPtr, &position);
- return 1;
- }
- else {
- eventEndPtr = eventPtr;
- processor = errorProcessor;
- return 0;
- }
-}
-
-void *XML_GetBuffer(XML_Parser parser, int len)
-{
- if (len > bufferLim - bufferEnd) {
- /* FIXME avoid integer overflow */
- int neededSize = len + (bufferEnd - bufferPtr);
-#ifdef XML_CONTEXT_BYTES
- int keep = bufferPtr - buffer;
-
- if (keep > XML_CONTEXT_BYTES)
- keep = XML_CONTEXT_BYTES;
- neededSize += keep;
-#endif /* defined XML_CONTEXT_BYTES */
- if (neededSize <= bufferLim - buffer) {
-#ifdef XML_CONTEXT_BYTES
- if (keep < bufferPtr - buffer) {
- int offset = (bufferPtr - buffer) - keep;
- memmove(buffer, &buffer[offset], bufferEnd - bufferPtr + keep);
- bufferEnd -= offset;
- bufferPtr -= offset;
- }
-#else
- memmove(buffer, bufferPtr, bufferEnd - bufferPtr);
- bufferEnd = buffer + (bufferEnd - bufferPtr);
- bufferPtr = buffer;
-#endif /* not defined XML_CONTEXT_BYTES */
- }
- else {
- char *newBuf;
- int bufferSize = bufferLim - bufferPtr;
- if (bufferSize == 0)
- bufferSize = INIT_BUFFER_SIZE;
- do {
- bufferSize *= 2;
- } while (bufferSize < neededSize);
- newBuf = MALLOC(bufferSize);
- if (newBuf == 0) {
- errorCode = XML_ERROR_NO_MEMORY;
- return 0;
- }
- bufferLim = newBuf + bufferSize;
-#ifdef XML_CONTEXT_BYTES
- if (bufferPtr) {
- int keep = bufferPtr - buffer;
- if (keep > XML_CONTEXT_BYTES)
- keep = XML_CONTEXT_BYTES;
- memcpy(newBuf, &bufferPtr[-keep], bufferEnd - bufferPtr + keep);
- FREE(buffer);
- buffer = newBuf;
- bufferEnd = buffer + (bufferEnd - bufferPtr) + keep;
- bufferPtr = buffer + keep;
- }
- else {
- bufferEnd = newBuf + (bufferEnd - bufferPtr);
- bufferPtr = buffer = newBuf;
- }
-#else
- if (bufferPtr) {
- memcpy(newBuf, bufferPtr, bufferEnd - bufferPtr);
- FREE(buffer);
- }
- bufferEnd = newBuf + (bufferEnd - bufferPtr);
- bufferPtr = buffer = newBuf;
-#endif /* not defined XML_CONTEXT_BYTES */
- }
- }
- return bufferEnd;
-}
-
-enum XML_Error XML_GetErrorCode(XML_Parser parser)
-{
- return errorCode;
-}
-
-long XML_GetCurrentByteIndex(XML_Parser parser)
-{
- if (eventPtr)
- return parseEndByteIndex - (parseEndPtr - eventPtr);
- return -1;
-}
-
-int XML_GetCurrentByteCount(XML_Parser parser)
-{
- if (eventEndPtr && eventPtr)
- return eventEndPtr - eventPtr;
- return 0;
-}
-
-const char * XML_GetInputContext(XML_Parser parser, int *offset, int *size)
-{
-#ifdef XML_CONTEXT_BYTES
- if (eventPtr && buffer) {
- *offset = eventPtr - buffer;
- *size = bufferEnd - buffer;
- return buffer;
- }
-#endif /* defined XML_CONTEXT_BYTES */
- return (char *) 0;
-}
-
-int XML_GetCurrentLineNumber(XML_Parser parser)
-{
- if (eventPtr) {
- XmlUpdatePosition(encoding, positionPtr, eventPtr, &position);
- positionPtr = eventPtr;
- }
- return position.lineNumber + 1;
-}
-
-int XML_GetCurrentColumnNumber(XML_Parser parser)
-{
- if (eventPtr) {
- XmlUpdatePosition(encoding, positionPtr, eventPtr, &position);
- positionPtr = eventPtr;
- }
- return position.columnNumber;
-}
-
-void XML_DefaultCurrent(XML_Parser parser)
-{
- if (defaultHandler) {
- if (openInternalEntities)
- reportDefault(parser,
- internalEncoding,
- openInternalEntities->internalEventPtr,
- openInternalEntities->internalEventEndPtr);
- else
- reportDefault(parser, encoding, eventPtr, eventEndPtr);
- }
-}
-
-const XML_LChar *XML_ErrorString(int code)
-{
- static const XML_LChar *message[] = {
- 0,
- XML_T("out of memory"),
- XML_T("syntax error"),
- XML_T("no element found"),
- XML_T("not well-formed (invalid token)"),
- XML_T("unclosed token"),
- XML_T("unclosed token"),
- XML_T("mismatched tag"),
- XML_T("duplicate attribute"),
- XML_T("junk after document element"),
- XML_T("illegal parameter entity reference"),
- XML_T("undefined entity"),
- XML_T("recursive entity reference"),
- XML_T("asynchronous entity"),
- XML_T("reference to invalid character number"),
- XML_T("reference to binary entity"),
- XML_T("reference to external entity in attribute"),
- XML_T("xml processing instruction not at start of external entity"),
- XML_T("unknown encoding"),
- XML_T("encoding specified in XML declaration is incorrect"),
- XML_T("unclosed CDATA section"),
- XML_T("error in processing external entity reference"),
- XML_T("document is not standalone"),
- XML_T("unexpected parser state - please send a bug report")
- };
- if (code > 0 && code < sizeof(message)/sizeof(message[0]))
- return message[code];
- return 0;
-}
-
-const XML_LChar *
-XML_ExpatVersion() {
- return "1.95.1"; /*VERSION; thies@thieso.net*/
-}
-
-static
-enum XML_Error contentProcessor(XML_Parser parser,
- const char *start,
- const char *end,
- const char **endPtr)
-{
- return doContent(parser, 0, encoding, start, end, endPtr);
-}
-
-static
-enum XML_Error externalEntityInitProcessor(XML_Parser parser,
- const char *start,
- const char *end,
- const char **endPtr)
-{
- enum XML_Error result = initializeEncoding(parser);
- if (result != XML_ERROR_NONE)
- return result;
- processor = externalEntityInitProcessor2;
- return externalEntityInitProcessor2(parser, start, end, endPtr);
-}
-
-static
-enum XML_Error externalEntityInitProcessor2(XML_Parser parser,
- const char *start,
- const char *end,
- const char **endPtr)
-{
- const char *next;
- int tok = XmlContentTok(encoding, start, end, &next);
- switch (tok) {
- case XML_TOK_BOM:
- start = next;
- break;
- case XML_TOK_PARTIAL:
- if (endPtr) {
- *endPtr = start;
- return XML_ERROR_NONE;
- }
- eventPtr = start;
- return XML_ERROR_UNCLOSED_TOKEN;
- case XML_TOK_PARTIAL_CHAR:
- if (endPtr) {
- *endPtr = start;
- return XML_ERROR_NONE;
- }
- eventPtr = start;
- return XML_ERROR_PARTIAL_CHAR;
- }
- processor = externalEntityInitProcessor3;
- return externalEntityInitProcessor3(parser, start, end, endPtr);
-}
-
-static
-enum XML_Error externalEntityInitProcessor3(XML_Parser parser,
- const char *start,
- const char *end,
- const char **endPtr)
-{
- const char *next;
- int tok = XmlContentTok(encoding, start, end, &next);
- switch (tok) {
- case XML_TOK_XML_DECL:
- {
- enum XML_Error result = processXmlDecl(parser, 1, start, next);
- if (result != XML_ERROR_NONE)
- return result;
- start = next;
- }
- break;
- case XML_TOK_PARTIAL:
- if (endPtr) {
- *endPtr = start;
- return XML_ERROR_NONE;
- }
- eventPtr = start;
- return XML_ERROR_UNCLOSED_TOKEN;
- case XML_TOK_PARTIAL_CHAR:
- if (endPtr) {
- *endPtr = start;
- return XML_ERROR_NONE;
- }
- eventPtr = start;
- return XML_ERROR_PARTIAL_CHAR;
- }
- processor = externalEntityContentProcessor;
- tagLevel = 1;
- return doContent(parser, 1, encoding, start, end, endPtr);
-}
-
-static
-enum XML_Error externalEntityContentProcessor(XML_Parser parser,
- const char *start,
- const char *end,
- const char **endPtr)
-{
- return doContent(parser, 1, encoding, start, end, endPtr);
-}
-
-static enum XML_Error
-doContent(XML_Parser parser,
- int startTagLevel,
- const ENCODING *enc,
- const char *s,
- const char *end,
- const char **nextPtr)
-{
- const char **eventPP;
- const char **eventEndPP;
- if (enc == encoding) {
- eventPP = &eventPtr;
- eventEndPP = &eventEndPtr;
- }
- else {
- eventPP = &(openInternalEntities->internalEventPtr);
- eventEndPP = &(openInternalEntities->internalEventEndPtr);
- }
- *eventPP = s;
- for (;;) {
- const char *next = s; /* XmlContentTok doesn't always set the last arg */
- int tok = XmlContentTok(enc, s, end, &next);
- *eventEndPP = next;
- switch (tok) {
- case XML_TOK_TRAILING_CR:
- if (nextPtr) {
- *nextPtr = s;
- return XML_ERROR_NONE;
- }
- *eventEndPP = end;
- if (characterDataHandler) {
- XML_Char c = 0xA;
- characterDataHandler(handlerArg, &c, 1);
- }
- else if (defaultHandler)
- reportDefault(parser, enc, s, end);
- if (startTagLevel == 0)
- return XML_ERROR_NO_ELEMENTS;
- if (tagLevel != startTagLevel)
- return XML_ERROR_ASYNC_ENTITY;
- return XML_ERROR_NONE;
- case XML_TOK_NONE:
- if (nextPtr) {
- *nextPtr = s;
- return XML_ERROR_NONE;
- }
- if (startTagLevel > 0) {
- if (tagLevel != startTagLevel)
- return XML_ERROR_ASYNC_ENTITY;
- return XML_ERROR_NONE;
- }
- return XML_ERROR_NO_ELEMENTS;
- case XML_TOK_INVALID:
- *eventPP = next;
- return XML_ERROR_INVALID_TOKEN;
- case XML_TOK_PARTIAL:
- if (nextPtr) {
- *nextPtr = s;
- return XML_ERROR_NONE;
- }
- return XML_ERROR_UNCLOSED_TOKEN;
- case XML_TOK_PARTIAL_CHAR:
- if (nextPtr) {
- *nextPtr = s;
- return XML_ERROR_NONE;
- }
- return XML_ERROR_PARTIAL_CHAR;
- case XML_TOK_ENTITY_REF:
- {
- const XML_Char *name;
- ENTITY *entity;
- XML_Char ch = XmlPredefinedEntityName(enc,
- s + enc->minBytesPerChar,
- next - enc->minBytesPerChar);
- if (ch) {
- if (characterDataHandler)
- characterDataHandler(handlerArg, &ch, 1);
- else if (defaultHandler)
- reportDefault(parser, enc, s, next);
- break;
- }
- name = poolStoreString(&dtd.pool, enc,
- s + enc->minBytesPerChar,
- next - enc->minBytesPerChar);
- if (!name)
- return XML_ERROR_NO_MEMORY;
- entity = (ENTITY *)lookup(&dtd.generalEntities, name, 0);
- poolDiscard(&dtd.pool);
- if (!entity) {
- if (dtd.complete || dtd.standalone)
- return XML_ERROR_UNDEFINED_ENTITY;
- if (defaultHandler)
- reportDefault(parser, enc, s, next);
- break;
- }
- if (entity->open)
- return XML_ERROR_RECURSIVE_ENTITY_REF;
- if (entity->notation)
- return XML_ERROR_BINARY_ENTITY_REF;
- if (entity) {
- if (entity->textPtr) {
- enum XML_Error result;
- OPEN_INTERNAL_ENTITY openEntity;
- if (defaultHandler && !defaultExpandInternalEntities) {
- reportDefault(parser, enc, s, next);
- break;
- }
- entity->open = 1;
- openEntity.next = openInternalEntities;
- openInternalEntities = &openEntity;
- openEntity.entity = entity;
- openEntity.internalEventPtr = 0;
- openEntity.internalEventEndPtr = 0;
- result = doContent(parser,
- tagLevel,
- internalEncoding,
- (char *)entity->textPtr,
- (char *)(entity->textPtr + entity->textLen),
- 0);
- entity->open = 0;
- openInternalEntities = openEntity.next;
- if (result)
- return result;
- }
- else if (externalEntityRefHandler) {
- const XML_Char *context;
- entity->open = 1;
- context = getContext(parser);
- entity->open = 0;
- if (!context)
- return XML_ERROR_NO_MEMORY;
- if (!externalEntityRefHandler(externalEntityRefHandlerArg,
- context,
- entity->base,
- entity->systemId,
- entity->publicId))
- return XML_ERROR_EXTERNAL_ENTITY_HANDLING;
- poolDiscard(&tempPool);
- }
- else if (defaultHandler)
- reportDefault(parser, enc, s, next);
- }
- break;
- }
- case XML_TOK_START_TAG_WITH_ATTS:
- if (!startElementHandler) {
- enum XML_Error result = storeAtts(parser, enc, s, 0, 0);
- if (result)
- return result;
- }
- /* fall through */
- case XML_TOK_START_TAG_NO_ATTS:
- {
- TAG *tag;
- if (freeTagList) {
- tag = freeTagList;
- freeTagList = freeTagList->parent;
- }
- else {
- tag = MALLOC(sizeof(TAG));
- if (!tag)
- return XML_ERROR_NO_MEMORY;
- tag->buf = MALLOC(INIT_TAG_BUF_SIZE);
- if (!tag->buf)
- return XML_ERROR_NO_MEMORY;
- tag->bufEnd = tag->buf + INIT_TAG_BUF_SIZE;
- }
- tag->bindings = 0;
- tag->parent = tagStack;
- tagStack = tag;
- tag->name.localPart = 0;
- tag->rawName = s + enc->minBytesPerChar;
- tag->rawNameLength = XmlNameLength(enc, tag->rawName);
- if (nextPtr) {
- /* Need to guarantee that:
- tag->buf + ROUND_UP(tag->rawNameLength, sizeof(XML_Char)) <= tag->bufEnd - sizeof(XML_Char) */
- if (tag->rawNameLength + (int)(sizeof(XML_Char) - 1) + (int)sizeof(XML_Char) > tag->bufEnd - tag->buf) {
- int bufSize = tag->rawNameLength * 4;
- bufSize = ROUND_UP(bufSize, sizeof(XML_Char));
- tag->buf = REALLOC(tag->buf, bufSize);
- if (!tag->buf)
- return XML_ERROR_NO_MEMORY;
- tag->bufEnd = tag->buf + bufSize;
- }
- memcpy(tag->buf, tag->rawName, tag->rawNameLength);
- tag->rawName = tag->buf;
- }
- ++tagLevel;
- if (startElementHandler) {
- enum XML_Error result;
- XML_Char *toPtr;
- for (;;) {
- const char *rawNameEnd = tag->rawName + tag->rawNameLength;
- const char *fromPtr = tag->rawName;
- int bufSize;
- if (nextPtr)
- toPtr = (XML_Char *)(tag->buf + ROUND_UP(tag->rawNameLength, sizeof(XML_Char)));
- else
- toPtr = (XML_Char *)tag->buf;
- tag->name.str = toPtr;
- XmlConvert(enc,
- &fromPtr, rawNameEnd,
- (ICHAR **)&toPtr, (ICHAR *)tag->bufEnd - 1);
- if (fromPtr == rawNameEnd)
- break;
- bufSize = (tag->bufEnd - tag->buf) << 1;
- tag->buf = REALLOC(tag->buf, bufSize);
- if (!tag->buf)
- return XML_ERROR_NO_MEMORY;
- tag->bufEnd = tag->buf + bufSize;
- if (nextPtr)
- tag->rawName = tag->buf;
- }
- *toPtr = XML_T('\0');
- result = storeAtts(parser, enc, s, &(tag->name), &(tag->bindings));
- if (result)
- return result;
- startElementHandler(handlerArg, tag->name.str, (const XML_Char **)atts);
- poolClear(&tempPool);
- }
- else {
- tag->name.str = 0;
- if (defaultHandler)
- reportDefault(parser, enc, s, next);
- }
- break;
- }
- case XML_TOK_EMPTY_ELEMENT_WITH_ATTS:
- if (!startElementHandler) {
- enum XML_Error result = storeAtts(parser, enc, s, 0, 0);
- if (result)
- return result;
- }
- /* fall through */
- case XML_TOK_EMPTY_ELEMENT_NO_ATTS:
- if (startElementHandler || endElementHandler) {
- const char *rawName = s + enc->minBytesPerChar;
- enum XML_Error result;
- BINDING *bindings = 0;
- TAG_NAME name;
- name.str = poolStoreString(&tempPool, enc, rawName,
- rawName + XmlNameLength(enc, rawName));
- if (!name.str)
- return XML_ERROR_NO_MEMORY;
- poolFinish(&tempPool);
- result = storeAtts(parser, enc, s, &name, &bindings);
- if (result)
- return result;
- poolFinish(&tempPool);
- if (startElementHandler)
- startElementHandler(handlerArg, name.str, (const XML_Char **)atts);
- if (endElementHandler) {
- if (startElementHandler)
- *eventPP = *eventEndPP;
- endElementHandler(handlerArg, name.str);
- }
- poolClear(&tempPool);
- while (bindings) {
- BINDING *b = bindings;
- if (endNamespaceDeclHandler)
- endNamespaceDeclHandler(handlerArg, b->prefix->name);
- bindings = bindings->nextTagBinding;
- b->nextTagBinding = freeBindingList;
- freeBindingList = b;
- b->prefix->binding = b->prevPrefixBinding;
- }
- }
- else if (defaultHandler)
- reportDefault(parser, enc, s, next);
- if (tagLevel == 0)
- return epilogProcessor(parser, next, end, nextPtr);
- break;
- case XML_TOK_END_TAG:
- if (tagLevel == startTagLevel)
- return XML_ERROR_ASYNC_ENTITY;
- else {
- int len;
- const char *rawName;
- TAG *tag = tagStack;
- tagStack = tag->parent;
- tag->parent = freeTagList;
- freeTagList = tag;
- rawName = s + enc->minBytesPerChar*2;
- len = XmlNameLength(enc, rawName);
- if (len != tag->rawNameLength
- || memcmp(tag->rawName, rawName, len) != 0) {
- *eventPP = rawName;
- return XML_ERROR_TAG_MISMATCH;
- }
- --tagLevel;
- if (endElementHandler && tag->name.str) {
- if (tag->name.localPart) {
- XML_Char *to = (XML_Char *)tag->name.str + tag->name.uriLen;
- const XML_Char *from = tag->name.localPart;
- while ((*to++ = *from++) != 0)
- ;
- }
- endElementHandler(handlerArg, tag->name.str);
- }
- else if (defaultHandler)
- reportDefault(parser, enc, s, next);
- while (tag->bindings) {
- BINDING *b = tag->bindings;
- if (endNamespaceDeclHandler)
- endNamespaceDeclHandler(handlerArg, b->prefix->name);
- tag->bindings = tag->bindings->nextTagBinding;
- b->nextTagBinding = freeBindingList;
- freeBindingList = b;
- b->prefix->binding = b->prevPrefixBinding;
- }
- if (tagLevel == 0)
- return epilogProcessor(parser, next, end, nextPtr);
- }
- break;
- case XML_TOK_CHAR_REF:
- {
- int n = XmlCharRefNumber(enc, s);
- if (n < 0)
- return XML_ERROR_BAD_CHAR_REF;
- if (characterDataHandler) {
- XML_Char buf[XML_ENCODE_MAX];
- characterDataHandler(handlerArg, buf, XmlEncode(n, (ICHAR *)buf));
- }
- else if (defaultHandler)
- reportDefault(parser, enc, s, next);
- }
- break;
- case XML_TOK_XML_DECL:
- return XML_ERROR_MISPLACED_XML_PI;
- case XML_TOK_DATA_NEWLINE:
- if (characterDataHandler) {
- XML_Char c = 0xA;
- characterDataHandler(handlerArg, &c, 1);
- }
- else if (defaultHandler)
- reportDefault(parser, enc, s, next);
- break;
- case XML_TOK_CDATA_SECT_OPEN:
- {
- enum XML_Error result;
- if (startCdataSectionHandler)
- startCdataSectionHandler(handlerArg);
-#if 0
- /* Suppose you doing a transformation on a document that involves
- changing only the character data. You set up a defaultHandler
- and a characterDataHandler. The defaultHandler simply copies
- characters through. The characterDataHandler does the transformation
- and writes the characters out escaping them as necessary. This case
- will fail to work if we leave out the following two lines (because &
- and < inside CDATA sections will be incorrectly escaped).
-
- However, now we have a start/endCdataSectionHandler, so it seems
- easier to let the user deal with this. */
-
- else if (characterDataHandler)
- characterDataHandler(handlerArg, dataBuf, 0);
-#endif
- else if (defaultHandler)
- reportDefault(parser, enc, s, next);
- result = doCdataSection(parser, enc, &next, end, nextPtr);
- if (!next) {
- processor = cdataSectionProcessor;
- return result;
- }
- }
- break;
- case XML_TOK_TRAILING_RSQB:
- if (nextPtr) {
- *nextPtr = s;
- return XML_ERROR_NONE;
- }
- if (characterDataHandler) {
- if (MUST_CONVERT(enc, s)) {
- ICHAR *dataPtr = (ICHAR *)dataBuf;
- XmlConvert(enc, &s, end, &dataPtr, (ICHAR *)dataBufEnd);
- characterDataHandler(handlerArg, dataBuf, dataPtr - (ICHAR *)dataBuf);
- }
- else
- characterDataHandler(handlerArg,
- (XML_Char *)s,
- (XML_Char *)end - (XML_Char *)s);
- }
- else if (defaultHandler)
- reportDefault(parser, enc, s, end);
- if (startTagLevel == 0) {
- *eventPP = end;
- return XML_ERROR_NO_ELEMENTS;
- }
- if (tagLevel != startTagLevel) {
- *eventPP = end;
- return XML_ERROR_ASYNC_ENTITY;
- }
- return XML_ERROR_NONE;
- case XML_TOK_DATA_CHARS:
- if (characterDataHandler) {
- if (MUST_CONVERT(enc, s)) {
- for (;;) {
- ICHAR *dataPtr = (ICHAR *)dataBuf;
- XmlConvert(enc, &s, next, &dataPtr, (ICHAR *)dataBufEnd);
- *eventEndPP = s;
- characterDataHandler(handlerArg, dataBuf, dataPtr - (ICHAR *)dataBuf);
- if (s == next)
- break;
- *eventPP = s;
- }
- }
- else
- characterDataHandler(handlerArg,
- (XML_Char *)s,
- (XML_Char *)next - (XML_Char *)s);
- }
- else if (defaultHandler)
- reportDefault(parser, enc, s, next);
- break;
- case XML_TOK_PI:
- if (!reportProcessingInstruction(parser, enc, s, next))
- return XML_ERROR_NO_MEMORY;
- break;
- case XML_TOK_COMMENT:
- if (!reportComment(parser, enc, s, next))
- return XML_ERROR_NO_MEMORY;
- break;
- default:
- if (defaultHandler)
- reportDefault(parser, enc, s, next);
- break;
- }
- *eventPP = s = next;
- }
- /* not reached */
-}
-
-/* If tagNamePtr is non-null, build a real list of attributes,
-otherwise just check the attributes for well-formedness. */
-
-static enum XML_Error storeAtts(XML_Parser parser, const ENCODING *enc,
- const char *attStr, TAG_NAME *tagNamePtr,
- BINDING **bindingsPtr)
-{
- ELEMENT_TYPE *elementType = 0;
- int nDefaultAtts = 0;
- const XML_Char **appAtts; /* the attribute list to pass to the application */
- int attIndex = 0;
- int i;
- int n;
- int nPrefixes = 0;
- BINDING *binding;
- const XML_Char *localPart;
-
- /* lookup the element type name */
- if (tagNamePtr) {
- elementType = (ELEMENT_TYPE *)lookup(&dtd.elementTypes, tagNamePtr->str,0);
- if (!elementType) {
- tagNamePtr->str = poolCopyString(&dtd.pool, tagNamePtr->str);
- if (!tagNamePtr->str)
- return XML_ERROR_NO_MEMORY;
- elementType = (ELEMENT_TYPE *)lookup(&dtd.elementTypes, tagNamePtr->str, sizeof(ELEMENT_TYPE));
- if (!elementType)
- return XML_ERROR_NO_MEMORY;
- if (ns && !setElementTypePrefix(parser, elementType))
- return XML_ERROR_NO_MEMORY;
- }
- nDefaultAtts = elementType->nDefaultAtts;
- }
- /* get the attributes from the tokenizer */
- n = XmlGetAttributes(enc, attStr, attsSize, atts);
- if (n + nDefaultAtts > attsSize) {
- int oldAttsSize = attsSize;
- attsSize = n + nDefaultAtts + INIT_ATTS_SIZE;
- atts = REALLOC((void *)atts, attsSize * sizeof(ATTRIBUTE));
- if (!atts)
- return XML_ERROR_NO_MEMORY;
- if (n > oldAttsSize)
- XmlGetAttributes(enc, attStr, n, atts);
- }
- appAtts = (const XML_Char **)atts;
- for (i = 0; i < n; i++) {
- /* add the name and value to the attribute list */
- ATTRIBUTE_ID *attId = getAttributeId(parser, enc, atts[i].name,
- atts[i].name
- + XmlNameLength(enc, atts[i].name));
- if (!attId)
- return XML_ERROR_NO_MEMORY;
- /* detect duplicate attributes */
- if ((attId->name)[-1]) {
- if (enc == encoding)
- eventPtr = atts[i].name;
- return XML_ERROR_DUPLICATE_ATTRIBUTE;
- }
- (attId->name)[-1] = 1;
- appAtts[attIndex++] = attId->name;
- if (!atts[i].normalized) {
- enum XML_Error result;
- int isCdata = 1;
-
- /* figure out whether declared as other than CDATA */
- if (attId->maybeTokenized) {
- int j;
- for (j = 0; j < nDefaultAtts; j++) {
- if (attId == elementType->defaultAtts[j].id) {
- isCdata = elementType->defaultAtts[j].isCdata;
- break;
- }
- }
- }
-
- /* normalize the attribute value */
- result = storeAttributeValue(parser, enc, isCdata,
- atts[i].valuePtr, atts[i].valueEnd,
- &tempPool);
- if (result)
- return result;
- if (tagNamePtr) {
- appAtts[attIndex] = poolStart(&tempPool);
- poolFinish(&tempPool);
- }
- else
- poolDiscard(&tempPool);
- }
- else if (tagNamePtr) {
- /* the value did not need normalizing */
- appAtts[attIndex] = poolStoreString(&tempPool, enc, atts[i].valuePtr, atts[i].valueEnd);
- if (appAtts[attIndex] == 0)
- return XML_ERROR_NO_MEMORY;
- poolFinish(&tempPool);
- }
- /* handle prefixed attribute names */
- if (attId->prefix && tagNamePtr) {
- if (attId->xmlns) {
- /* deal with namespace declarations here */
- if (!addBinding(parser, attId->prefix, attId, appAtts[attIndex], bindingsPtr))
- return XML_ERROR_NO_MEMORY;
- --attIndex;
- }
- else {
- /* deal with other prefixed names later */
- attIndex++;
- nPrefixes++;
- (attId->name)[-1] = 2;
- }
- }
- else
- attIndex++;
- }
- if (tagNamePtr) {
- int j;
- nSpecifiedAtts = attIndex;
- if (elementType->idAtt && (elementType->idAtt->name)[-1]) {
- for (i = 0; i < attIndex; i += 2)
- if (appAtts[i] == elementType->idAtt->name) {
- idAttIndex = i;
- break;
- }
- }
- else
- idAttIndex = -1;
- /* do attribute defaulting */
- for (j = 0; j < nDefaultAtts; j++) {
- const DEFAULT_ATTRIBUTE *da = elementType->defaultAtts + j;
- if (!(da->id->name)[-1] && da->value) {
- if (da->id->prefix) {
- if (da->id->xmlns) {
- if (!addBinding(parser, da->id->prefix, da->id, da->value, bindingsPtr))
- return XML_ERROR_NO_MEMORY;
- }
- else {
- (da->id->name)[-1] = 2;
- nPrefixes++;
- appAtts[attIndex++] = da->id->name;
- appAtts[attIndex++] = da->value;
- }
- }
- else {
- (da->id->name)[-1] = 1;
- appAtts[attIndex++] = da->id->name;
- appAtts[attIndex++] = da->value;
- }
- }
- }
- appAtts[attIndex] = 0;
- }
- i = 0;
- if (nPrefixes) {
- /* expand prefixed attribute names */
- for (; i < attIndex; i += 2) {
- if (appAtts[i][-1] == 2) {
- ATTRIBUTE_ID *id;
- ((XML_Char *)(appAtts[i]))[-1] = 0;
- id = (ATTRIBUTE_ID *)lookup(&dtd.attributeIds, appAtts[i], 0);
- if (id->prefix->binding) {
- int j;
- const BINDING *b = id->prefix->binding;
- const XML_Char *s = appAtts[i];
- for (j = 0; j < b->uriLen; j++) {
- if (!poolAppendChar(&tempPool, b->uri[j]))
- return XML_ERROR_NO_MEMORY;
- }
- while (*s++ != ':')
- ;
- do {
- if (!poolAppendChar(&tempPool, *s))
- return XML_ERROR_NO_MEMORY;
- } while (*s++);
- if (ns_triplets) {
- tempPool.ptr[-1] = namespaceSeparator;
- s = b->prefix->name;
- do {
- if (!poolAppendChar(&tempPool, *s))
- return XML_ERROR_NO_MEMORY;
- } while (*s++);
- }
-
- appAtts[i] = poolStart(&tempPool);
- poolFinish(&tempPool);
- }
- if (!--nPrefixes)
- break;
- }
- else
- ((XML_Char *)(appAtts[i]))[-1] = 0;
- }
- }
- /* clear the flags that say whether attributes were specified */
- for (; i < attIndex; i += 2)
- ((XML_Char *)(appAtts[i]))[-1] = 0;
- if (!tagNamePtr)
- return XML_ERROR_NONE;
- for (binding = *bindingsPtr; binding; binding = binding->nextTagBinding)
- binding->attId->name[-1] = 0;
- /* expand the element type name */
- if (elementType->prefix) {
- binding = elementType->prefix->binding;
- if (!binding)
- return XML_ERROR_NONE;
- localPart = tagNamePtr->str;
- while (*localPart++ != XML_T(':'))
- ;
- }
- else if (dtd.defaultPrefix.binding) {
- binding = dtd.defaultPrefix.binding;
- localPart = tagNamePtr->str;
- }
- else
- return XML_ERROR_NONE;
- tagNamePtr->localPart = localPart;
- tagNamePtr->uriLen = binding->uriLen;
- for (i = 0; localPart[i++];)
- ;
- n = i + binding->uriLen;
- if (n > binding->uriAlloc) {
- TAG *p;
- XML_Char *uri = MALLOC((n + EXPAND_SPARE) * sizeof(XML_Char));
- if (!uri)
- return XML_ERROR_NO_MEMORY;
- binding->uriAlloc = n + EXPAND_SPARE;
- memcpy(uri, binding->uri, binding->uriLen * sizeof(XML_Char));
- for (p = tagStack; p; p = p->parent)
- if (p->name.str == binding->uri)
- p->name.str = uri;
- FREE(binding->uri);
- binding->uri = uri;
- }
- memcpy(binding->uri + binding->uriLen, localPart, i * sizeof(XML_Char));
- tagNamePtr->str = binding->uri;
- return XML_ERROR_NONE;
-}
-
-static
-int addBinding(XML_Parser parser, PREFIX *prefix, const ATTRIBUTE_ID *attId, const XML_Char *uri, BINDING **bindingsPtr)
-{
- BINDING *b;
- int len;
- for (len = 0; uri[len]; len++)
- ;
- if (namespaceSeparator)
- len++;
- if (freeBindingList) {
- b = freeBindingList;
- if (len > b->uriAlloc) {
- b->uri = REALLOC(b->uri, sizeof(XML_Char) * (len + EXPAND_SPARE));
- if (!b->uri)
- return 0;
- b->uriAlloc = len + EXPAND_SPARE;
- }
- freeBindingList = b->nextTagBinding;
- }
- else {
- b = MALLOC(sizeof(BINDING));
- if (!b)
- return 0;
- b->uri = MALLOC(sizeof(XML_Char) * (len + EXPAND_SPARE));
- if (!b->uri) {
- FREE(b);
- return 0;
- }
- b->uriAlloc = len + EXPAND_SPARE;
- }
- b->uriLen = len;
- memcpy(b->uri, uri, len * sizeof(XML_Char));
- if (namespaceSeparator)
- b->uri[len - 1] = namespaceSeparator;
- b->prefix = prefix;
- b->attId = attId;
- b->prevPrefixBinding = prefix->binding;
- if (*uri == XML_T('\0') && prefix == &dtd.defaultPrefix)
- prefix->binding = 0;
- else
- prefix->binding = b;
- b->nextTagBinding = *bindingsPtr;
- *bindingsPtr = b;
- if (startNamespaceDeclHandler)
- startNamespaceDeclHandler(handlerArg, prefix->name,
- prefix->binding ? uri : 0);
- return 1;
-}
-
-/* The idea here is to avoid using stack for each CDATA section when
-the whole file is parsed with one call. */
-
-static
-enum XML_Error cdataSectionProcessor(XML_Parser parser,
- const char *start,
- const char *end,
- const char **endPtr)
-{
- enum XML_Error result = doCdataSection(parser, encoding, &start, end, endPtr);
- if (start) {
- processor = contentProcessor;
- return contentProcessor(parser, start, end, endPtr);
- }
- return result;
-}
-
-/* startPtr gets set to non-null is the section is closed, and to null if
-the section is not yet closed. */
-
-static
-enum XML_Error doCdataSection(XML_Parser parser,
- const ENCODING *enc,
- const char **startPtr,
- const char *end,
- const char **nextPtr)
-{
- const char *s = *startPtr;
- const char **eventPP;
- const char **eventEndPP;
- if (enc == encoding) {
- eventPP = &eventPtr;
- *eventPP = s;
- eventEndPP = &eventEndPtr;
- }
- else {
- eventPP = &(openInternalEntities->internalEventPtr);
- eventEndPP = &(openInternalEntities->internalEventEndPtr);
- }
- *eventPP = s;
- *startPtr = 0;
- for (;;) {
- const char *next;
- int tok = XmlCdataSectionTok(enc, s, end, &next);
- *eventEndPP = next;
- switch (tok) {
- case XML_TOK_CDATA_SECT_CLOSE:
- if (endCdataSectionHandler)
- endCdataSectionHandler(handlerArg);
-#if 0
- /* see comment under XML_TOK_CDATA_SECT_OPEN */
- else if (characterDataHandler)
- characterDataHandler(handlerArg, dataBuf, 0);
-#endif
- else if (defaultHandler)
- reportDefault(parser, enc, s, next);
- *startPtr = next;
- return XML_ERROR_NONE;
- case XML_TOK_DATA_NEWLINE:
- if (characterDataHandler) {
- XML_Char c = 0xA;
- characterDataHandler(handlerArg, &c, 1);
- }
- else if (defaultHandler)
- reportDefault(parser, enc, s, next);
- break;
- case XML_TOK_DATA_CHARS:
- if (characterDataHandler) {
- if (MUST_CONVERT(enc, s)) {
- for (;;) {
- ICHAR *dataPtr = (ICHAR *)dataBuf;
- XmlConvert(enc, &s, next, &dataPtr, (ICHAR *)dataBufEnd);
- *eventEndPP = next;
- characterDataHandler(handlerArg, dataBuf, dataPtr - (ICHAR *)dataBuf);
- if (s == next)
- break;
- *eventPP = s;
- }
- }
- else
- characterDataHandler(handlerArg,
- (XML_Char *)s,
- (XML_Char *)next - (XML_Char *)s);
- }
- else if (defaultHandler)
- reportDefault(parser, enc, s, next);
- break;
- case XML_TOK_INVALID:
- *eventPP = next;
- return XML_ERROR_INVALID_TOKEN;
- case XML_TOK_PARTIAL_CHAR:
- if (nextPtr) {
- *nextPtr = s;
- return XML_ERROR_NONE;
- }
- return XML_ERROR_PARTIAL_CHAR;
- case XML_TOK_PARTIAL:
- case XML_TOK_NONE:
- if (nextPtr) {
- *nextPtr = s;
- return XML_ERROR_NONE;
- }
- return XML_ERROR_UNCLOSED_CDATA_SECTION;
- default:
- *eventPP = next;
- return XML_ERROR_UNEXPECTED_STATE;
- }
- *eventPP = s = next;
- }
- /* not reached */
-}
-
-#ifdef XML_DTD
-
-/* The idea here is to avoid using stack for each IGNORE section when
-the whole file is parsed with one call. */
-
-static
-enum XML_Error ignoreSectionProcessor(XML_Parser parser,
- const char *start,
- const char *end,
- const char **endPtr)
-{
- enum XML_Error result = doIgnoreSection(parser, encoding, &start, end, endPtr);
- if (start) {
- processor = prologProcessor;
- return prologProcessor(parser, start, end, endPtr);
- }
- return result;
-}
-
-/* startPtr gets set to non-null is the section is closed, and to null if
-the section is not yet closed. */
-
-static
-enum XML_Error doIgnoreSection(XML_Parser parser,
- const ENCODING *enc,
- const char **startPtr,
- const char *end,
- const char **nextPtr)
-{
- const char *next;
- int tok;
- const char *s = *startPtr;
- const char **eventPP;
- const char **eventEndPP;
- if (enc == encoding) {
- eventPP = &eventPtr;
- *eventPP = s;
- eventEndPP = &eventEndPtr;
- }
- else {
- eventPP = &(openInternalEntities->internalEventPtr);
- eventEndPP = &(openInternalEntities->internalEventEndPtr);
- }
- *eventPP = s;
- *startPtr = 0;
- tok = XmlIgnoreSectionTok(enc, s, end, &next);
- *eventEndPP = next;
- switch (tok) {
- case XML_TOK_IGNORE_SECT:
- if (defaultHandler)
- reportDefault(parser, enc, s, next);
- *startPtr = next;
- return XML_ERROR_NONE;
- case XML_TOK_INVALID:
- *eventPP = next;
- return XML_ERROR_INVALID_TOKEN;
- case XML_TOK_PARTIAL_CHAR:
- if (nextPtr) {
- *nextPtr = s;
- return XML_ERROR_NONE;
- }
- return XML_ERROR_PARTIAL_CHAR;
- case XML_TOK_PARTIAL:
- case XML_TOK_NONE:
- if (nextPtr) {
- *nextPtr = s;
- return XML_ERROR_NONE;
- }
- return XML_ERROR_SYNTAX; /* XML_ERROR_UNCLOSED_IGNORE_SECTION */
- default:
- *eventPP = next;
- return XML_ERROR_UNEXPECTED_STATE;
- }
- /* not reached */
-}
-
-#endif /* XML_DTD */
-
-static enum XML_Error
-initializeEncoding(XML_Parser parser)
-{
- const char *s;
-#ifdef XML_UNICODE
- char encodingBuf[128];
- if (!protocolEncodingName)
- s = 0;
- else {
- int i;
- for (i = 0; protocolEncodingName[i]; i++) {
- if (i == sizeof(encodingBuf) - 1
- || (protocolEncodingName[i] & ~0x7f) != 0) {
- encodingBuf[0] = '\0';
- break;
- }
- encodingBuf[i] = (char)protocolEncodingName[i];
- }
- encodingBuf[i] = '\0';
- s = encodingBuf;
- }
-#else
- s = protocolEncodingName;
-#endif
- if ((ns ? XmlInitEncodingNS : XmlInitEncoding)(&initEncoding, &encoding, s))
- return XML_ERROR_NONE;
- return handleUnknownEncoding(parser, protocolEncodingName);
-}
-
-static enum XML_Error
-processXmlDecl(XML_Parser parser, int isGeneralTextEntity,
- const char *s, const char *next)
-{
- const char *encodingName = 0;
- const char *storedEncName = 0;
- const ENCODING *newEncoding = 0;
- const char *version = 0;
- const char *versionend;
- const char *storedversion = 0;
- int standalone = -1;
- if (!(ns
- ? XmlParseXmlDeclNS
- : XmlParseXmlDecl)(isGeneralTextEntity,
- encoding,
- s,
- next,
- &eventPtr,
- &version,
- &versionend,
- &encodingName,
- &newEncoding,
- &standalone))
- return XML_ERROR_SYNTAX;
- if (!isGeneralTextEntity && standalone == 1) {
- dtd.standalone = 1;
-#ifdef XML_DTD
- if (paramEntityParsing == XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE)
- paramEntityParsing = XML_PARAM_ENTITY_PARSING_NEVER;
-#endif /* XML_DTD */
- }
- if (xmlDeclHandler) {
- if (encodingName) {
- storedEncName = poolStoreString(&temp2Pool,
- encoding,
- encodingName,
- encodingName
- + XmlNameLength(encoding, encodingName));
- if (! storedEncName)
- return XML_ERROR_NO_MEMORY;
- poolFinish(&temp2Pool);
- }
- if (version) {
- storedversion = poolStoreString(&temp2Pool,
- encoding,
- version,
- versionend - encoding->minBytesPerChar);
- if (! storedversion)
- return XML_ERROR_NO_MEMORY;
- }
- xmlDeclHandler(handlerArg, storedversion, storedEncName, standalone);
- }
- else if (defaultHandler)
- reportDefault(parser, encoding, s, next);
- if (!protocolEncodingName) {
- if (newEncoding) {
- if (newEncoding->minBytesPerChar != encoding->minBytesPerChar) {
- eventPtr = encodingName;
- return XML_ERROR_INCORRECT_ENCODING;
- }
- encoding = newEncoding;
- }
- else if (encodingName) {
- enum XML_Error result;
- if (! storedEncName) {
- storedEncName = poolStoreString(&temp2Pool,
- encoding,
- encodingName,
- encodingName
- + XmlNameLength(encoding, encodingName));
- if (! storedEncName)
- return XML_ERROR_NO_MEMORY;
- }
- result = handleUnknownEncoding(parser, storedEncName);
- poolClear(&tempPool);
- if (result == XML_ERROR_UNKNOWN_ENCODING)
- eventPtr = encodingName;
- return result;
- }
- }
-
- if (storedEncName || storedversion)
- poolClear(&temp2Pool);
-
- return XML_ERROR_NONE;
-}
-
-static enum XML_Error
-handleUnknownEncoding(XML_Parser parser, const XML_Char *encodingName)
-{
- if (unknownEncodingHandler) {
- XML_Encoding info;
- int i;
- for (i = 0; i < 256; i++)
- info.map[i] = -1;
- info.convert = 0;
- info.data = 0;
- info.release = 0;
- if (unknownEncodingHandler(unknownEncodingHandlerData, encodingName, &info)) {
- ENCODING *enc;
- unknownEncodingMem = MALLOC(XmlSizeOfUnknownEncoding());
- if (!unknownEncodingMem) {
- if (info.release)
- info.release(info.data);
- return XML_ERROR_NO_MEMORY;
- }
- enc = (ns
- ? XmlInitUnknownEncodingNS
- : XmlInitUnknownEncoding)(unknownEncodingMem,
- info.map,
- info.convert,
- info.data);
- if (enc) {
- unknownEncodingData = info.data;
- unknownEncodingRelease = info.release;
- encoding = enc;
- return XML_ERROR_NONE;
- }
- }
- if (info.release)
- info.release(info.data);
- }
- return XML_ERROR_UNKNOWN_ENCODING;
-}
-
-static enum XML_Error
-prologInitProcessor(XML_Parser parser,
- const char *s,
- const char *end,
- const char **nextPtr)
-{
- enum XML_Error result = initializeEncoding(parser);
- if (result != XML_ERROR_NONE)
- return result;
- processor = prologProcessor;
- return prologProcessor(parser, s, end, nextPtr);
-}
-
-static enum XML_Error
-prologProcessor(XML_Parser parser,
- const char *s,
- const char *end,
- const char **nextPtr)
-{
- const char *next;
- int tok = XmlPrologTok(encoding, s, end, &next);
- return doProlog(parser, encoding, s, end, tok, next, nextPtr);
-}
-
-static enum XML_Error
-doProlog(XML_Parser parser,
- const ENCODING *enc,
- const char *s,
- const char *end,
- int tok,
- const char *next,
- const char **nextPtr)
-{
-#ifdef XML_DTD
- static const XML_Char externalSubsetName[] = { '#' , '\0' };
-#endif /* XML_DTD */
-
- const char **eventPP;
- const char **eventEndPP;
- enum XML_Content_Quant quant;
-
- if (enc == encoding) {
- eventPP = &eventPtr;
- eventEndPP = &eventEndPtr;
- }
- else {
- eventPP = &(openInternalEntities->internalEventPtr);
- eventEndPP = &(openInternalEntities->internalEventEndPtr);
- }
- for (;;) {
- int role;
- *eventPP = s;
- *eventEndPP = next;
- if (tok <= 0) {
- if (nextPtr != 0 && tok != XML_TOK_INVALID) {
- *nextPtr = s;
- return XML_ERROR_NONE;
- }
- switch (tok) {
- case XML_TOK_INVALID:
- *eventPP = next;
- return XML_ERROR_INVALID_TOKEN;
- case XML_TOK_PARTIAL:
- return XML_ERROR_UNCLOSED_TOKEN;
- case XML_TOK_PARTIAL_CHAR:
- return XML_ERROR_PARTIAL_CHAR;
- case XML_TOK_NONE:
-#ifdef XML_DTD
- if (enc != encoding)
- return XML_ERROR_NONE;
- if (parentParser) {
- if (XmlTokenRole(&prologState, XML_TOK_NONE, end, end, enc)
- == XML_ROLE_ERROR)
- return XML_ERROR_SYNTAX;
- hadExternalDoctype = 0;
- return XML_ERROR_NONE;
- }
-#endif /* XML_DTD */
- return XML_ERROR_NO_ELEMENTS;
- default:
- tok = -tok;
- next = end;
- break;
- }
- }
- role = XmlTokenRole(&prologState, tok, s, next, enc);
- switch (role) {
- case XML_ROLE_XML_DECL:
- {
- enum XML_Error result = processXmlDecl(parser, 0, s, next);
- if (result != XML_ERROR_NONE)
- return result;
- enc = encoding;
- }
- break;
- case XML_ROLE_DOCTYPE_NAME:
- if (startDoctypeDeclHandler) {
- doctypeName = poolStoreString(&tempPool, enc, s, next);
- if (! doctypeName)
- return XML_ERROR_NO_MEMORY;
- poolFinish(&tempPool);
- doctypeSysid = 0;
- doctypePubid = 0;
- }
- break;
- case XML_ROLE_DOCTYPE_INTERNAL_SUBSET:
- if (startDoctypeDeclHandler) {
- startDoctypeDeclHandler(handlerArg, doctypeName, doctypeSysid,
- doctypePubid, 1);
- doctypeName = 0;
- poolClear(&tempPool);
- }
- break;
-#ifdef XML_DTD
- case XML_ROLE_TEXT_DECL:
- {
- enum XML_Error result = processXmlDecl(parser, 1, s, next);
- if (result != XML_ERROR_NONE)
- return result;
- enc = encoding;
- }
- break;
-#endif /* XML_DTD */
- case XML_ROLE_DOCTYPE_PUBLIC_ID:
- if (startDoctypeDeclHandler) {
- doctypePubid = poolStoreString(&tempPool, enc, s + 1, next - 1);
- if (! doctypePubid)
- return XML_ERROR_NO_MEMORY;
- poolFinish(&tempPool);
- }
-#ifdef XML_DTD
- declEntity = (ENTITY *)lookup(&dtd.paramEntities,
- externalSubsetName,
- sizeof(ENTITY));
- if (!declEntity)
- return XML_ERROR_NO_MEMORY;
-#endif /* XML_DTD */
- /* fall through */
- case XML_ROLE_ENTITY_PUBLIC_ID:
- if (!XmlIsPublicId(enc, s, next, eventPP))
- return XML_ERROR_SYNTAX;
- if (declEntity) {
- XML_Char *tem = poolStoreString(&dtd.pool,
- enc,
- s + enc->minBytesPerChar,
- next - enc->minBytesPerChar);
- if (!tem)
- return XML_ERROR_NO_MEMORY;
- normalizePublicId(tem);
- declEntity->publicId = tem;
- poolFinish(&dtd.pool);
- }
- break;
- case XML_ROLE_DOCTYPE_CLOSE:
- if (doctypeName) {
- startDoctypeDeclHandler(handlerArg, doctypeName,
- doctypeSysid, doctypePubid, 0);
- poolClear(&tempPool);
- }
- if (dtd.complete && hadExternalDoctype) {
- dtd.complete = 0;
-#ifdef XML_DTD
- if (paramEntityParsing && externalEntityRefHandler) {
- ENTITY *entity = (ENTITY *)lookup(&dtd.paramEntities,
- externalSubsetName,
- 0);
- if (!externalEntityRefHandler(externalEntityRefHandlerArg,
- 0,
- entity->base,
- entity->systemId,
- entity->publicId))
- return XML_ERROR_EXTERNAL_ENTITY_HANDLING;
- }
-#endif /* XML_DTD */
- if (!dtd.complete
- && !dtd.standalone
- && notStandaloneHandler
- && !notStandaloneHandler(handlerArg))
- return XML_ERROR_NOT_STANDALONE;
- }
- if (endDoctypeDeclHandler)
- endDoctypeDeclHandler(handlerArg);
- break;
- case XML_ROLE_INSTANCE_START:
- processor = contentProcessor;
- return contentProcessor(parser, s, end, nextPtr);
- case XML_ROLE_ATTLIST_ELEMENT_NAME:
- declElementType = getElementType(parser, enc, s, next);
- if (!declElementType)
- return XML_ERROR_NO_MEMORY;
- break;
- case XML_ROLE_ATTRIBUTE_NAME:
- declAttributeId = getAttributeId(parser, enc, s, next);
- if (!declAttributeId)
- return XML_ERROR_NO_MEMORY;
- declAttributeIsCdata = 0;
- declAttributeType = 0;
- declAttributeIsId = 0;
- break;
- case XML_ROLE_ATTRIBUTE_TYPE_CDATA:
- declAttributeIsCdata = 1;
- declAttributeType = "CDATA";
- break;
- case XML_ROLE_ATTRIBUTE_TYPE_ID:
- declAttributeIsId = 1;
- declAttributeType = "ID";
- break;
- case XML_ROLE_ATTRIBUTE_TYPE_IDREF:
- declAttributeType = "IDREF";
- break;
- case XML_ROLE_ATTRIBUTE_TYPE_IDREFS:
- declAttributeType = "IDREFS";
- break;
- case XML_ROLE_ATTRIBUTE_TYPE_ENTITY:
- declAttributeType = "ENTITY";
- break;
- case XML_ROLE_ATTRIBUTE_TYPE_ENTITIES:
- declAttributeType = "ENTITIES";
- break;
- case XML_ROLE_ATTRIBUTE_TYPE_NMTOKEN:
- declAttributeType = "NMTOKEN";
- break;
- case XML_ROLE_ATTRIBUTE_TYPE_NMTOKENS:
- declAttributeType = "NMTOKENS";
- break;
-
- case XML_ROLE_ATTRIBUTE_ENUM_VALUE:
- case XML_ROLE_ATTRIBUTE_NOTATION_VALUE:
- if (attlistDeclHandler)
- {
- char *prefix;
- if (declAttributeType) {
- prefix = "|";
- }
- else {
- prefix = (role == XML_ROLE_ATTRIBUTE_NOTATION_VALUE
- ? "NOTATION("
- : "(");
- }
- if (! poolAppendString(&tempPool, prefix))
- return XML_ERROR_NO_MEMORY;
- if (! poolAppend(&tempPool, enc, s, next))
- return XML_ERROR_NO_MEMORY;
- declAttributeType = tempPool.start;
- }
- break;
- case XML_ROLE_IMPLIED_ATTRIBUTE_VALUE:
- case XML_ROLE_REQUIRED_ATTRIBUTE_VALUE:
- if (dtd.complete
- && !defineAttribute(declElementType, declAttributeId,
- declAttributeIsCdata, declAttributeIsId, 0,
- parser))
- return XML_ERROR_NO_MEMORY;
- if (attlistDeclHandler && declAttributeType) {
- if (*declAttributeType == '('
- || *declAttributeType == 'N' && declAttributeType[1] == 'O') {
- /* Enumerated or Notation type */
- if (! poolAppendChar(&tempPool, ')')
- || ! poolAppendChar(&tempPool, '\0'))
- return XML_ERROR_NO_MEMORY;
- declAttributeType = tempPool.start;
- poolFinish(&tempPool);
- }
- *eventEndPP = s;
- attlistDeclHandler(handlerArg, declElementType->name,
- declAttributeId->name, declAttributeType,
- 0, role == XML_ROLE_REQUIRED_ATTRIBUTE_VALUE);
- poolClear(&tempPool);
- }
- break;
- case XML_ROLE_DEFAULT_ATTRIBUTE_VALUE:
- case XML_ROLE_FIXED_ATTRIBUTE_VALUE:
- {
- const XML_Char *attVal;
- enum XML_Error result
- = storeAttributeValue(parser, enc, declAttributeIsCdata,
- s + enc->minBytesPerChar,
- next - enc->minBytesPerChar,
- &dtd.pool);
- if (result)
- return result;
- attVal = poolStart(&dtd.pool);
- poolFinish(&dtd.pool);
- if (dtd.complete
- /* ID attributes aren't allowed to have a default */
- && !defineAttribute(declElementType, declAttributeId, declAttributeIsCdata, 0, attVal, parser))
- return XML_ERROR_NO_MEMORY;
- if (attlistDeclHandler && declAttributeType) {
- if (*declAttributeType == '('
- || *declAttributeType == 'N' && declAttributeType[1] == 'O') {
- /* Enumerated or Notation type */
- if (! poolAppendChar(&tempPool, ')')
- || ! poolAppendChar(&tempPool, '\0'))
- return XML_ERROR_NO_MEMORY;
- declAttributeType = tempPool.start;
- poolFinish(&tempPool);
- }
- *eventEndPP = s;
- attlistDeclHandler(handlerArg, declElementType->name,
- declAttributeId->name, declAttributeType,
- attVal,
- role == XML_ROLE_FIXED_ATTRIBUTE_VALUE);
- poolClear(&tempPool);
- }
- break;
- }
- case XML_ROLE_ENTITY_VALUE:
- {
- enum XML_Error result = storeEntityValue(parser, enc,
- s + enc->minBytesPerChar,
- next - enc->minBytesPerChar);
- if (declEntity) {
- declEntity->textPtr = poolStart(&dtd.pool);
- declEntity->textLen = poolLength(&dtd.pool);
- poolFinish(&dtd.pool);
- if (entityDeclHandler) {
- *eventEndPP = s;
- entityDeclHandler(handlerArg,
- declEntity->name,
- declEntity->is_param,
- declEntity->textPtr,
- declEntity->textLen,
- curBase, 0, 0, 0);
- }
- }
- else
- poolDiscard(&dtd.pool);
- if (result != XML_ERROR_NONE)
- return result;
- }
- break;
- case XML_ROLE_DOCTYPE_SYSTEM_ID:
- if (startDoctypeDeclHandler) {
- doctypeSysid = poolStoreString(&tempPool, enc, s + 1, next - 1);
- if (! doctypeSysid)
- return XML_ERROR_NO_MEMORY;
- poolFinish(&tempPool);
- }
- if (!dtd.standalone
-#ifdef XML_DTD
- && !paramEntityParsing
-#endif /* XML_DTD */
- && notStandaloneHandler
- && !notStandaloneHandler(handlerArg))
- return XML_ERROR_NOT_STANDALONE;
- hadExternalDoctype = 1;
-#ifndef XML_DTD
- break;
-#else /* XML_DTD */
- if (!declEntity) {
- declEntity = (ENTITY *)lookup(&dtd.paramEntities,
- externalSubsetName,
- sizeof(ENTITY));
- declEntity->publicId = 0;
- if (!declEntity)
- return XML_ERROR_NO_MEMORY;
- }
- /* fall through */
-#endif /* XML_DTD */
- case XML_ROLE_ENTITY_SYSTEM_ID:
- if (declEntity) {
- declEntity->systemId = poolStoreString(&dtd.pool, enc,
- s + enc->minBytesPerChar,
- next - enc->minBytesPerChar);
- if (!declEntity->systemId)
- return XML_ERROR_NO_MEMORY;
- declEntity->base = curBase;
- poolFinish(&dtd.pool);
- }
- break;
- case XML_ROLE_ENTITY_COMPLETE:
- if (declEntity && entityDeclHandler) {
- *eventEndPP = s;
- entityDeclHandler(handlerArg,
- declEntity->name,
- 0,0,0,
- declEntity->base,
- declEntity->systemId,
- declEntity->publicId,
- 0);
- }
- break;
- case XML_ROLE_ENTITY_NOTATION_NAME:
- if (declEntity) {
- declEntity->notation = poolStoreString(&dtd.pool, enc, s, next);
- if (!declEntity->notation)
- return XML_ERROR_NO_MEMORY;
- poolFinish(&dtd.pool);
- if (unparsedEntityDeclHandler) {
- *eventEndPP = s;
- unparsedEntityDeclHandler(handlerArg,
- declEntity->name,
- declEntity->base,
- declEntity->systemId,
- declEntity->publicId,
- declEntity->notation);
- }
- else if (entityDeclHandler) {
- *eventEndPP = s;
- entityDeclHandler(handlerArg,
- declEntity->name,
- 0,0,0,
- declEntity->base,
- declEntity->systemId,
- declEntity->publicId,
- declEntity->notation);
- }
- }
- break;
- case XML_ROLE_GENERAL_ENTITY_NAME:
- {
- const XML_Char *name;
- if (XmlPredefinedEntityName(enc, s, next)) {
- declEntity = 0;
- break;
- }
- name = poolStoreString(&dtd.pool, enc, s, next);
- if (!name)
- return XML_ERROR_NO_MEMORY;
- if (dtd.complete) {
- declEntity = (ENTITY *)lookup(&dtd.generalEntities, name, sizeof(ENTITY));
- if (!declEntity)
- return XML_ERROR_NO_MEMORY;
- if (declEntity->name != name) {
- poolDiscard(&dtd.pool);
- declEntity = 0;
- }
- else {
- poolFinish(&dtd.pool);
- declEntity->publicId = 0;
- declEntity->is_param = 0;
- }
- }
- else {
- poolDiscard(&dtd.pool);
- declEntity = 0;
- }
- }
- break;
- case XML_ROLE_PARAM_ENTITY_NAME:
-#ifdef XML_DTD
- if (dtd.complete) {
- const XML_Char *name = poolStoreString(&dtd.pool, enc, s, next);
- if (!name)
- return XML_ERROR_NO_MEMORY;
- declEntity = (ENTITY *)lookup(&dtd.paramEntities,
- name, sizeof(ENTITY));
- if (!declEntity)
- return XML_ERROR_NO_MEMORY;
- if (declEntity->name != name) {
- poolDiscard(&dtd.pool);
- declEntity = 0;
- }
- else {
- poolFinish(&dtd.pool);
- declEntity->publicId = 0;
- declEntity->is_param = 1;
- }
- }
-#else /* not XML_DTD */
- declEntity = 0;
-#endif /* not XML_DTD */
- break;
- case XML_ROLE_NOTATION_NAME:
- declNotationPublicId = 0;
- declNotationName = 0;
- if (notationDeclHandler) {
- declNotationName = poolStoreString(&tempPool, enc, s, next);
- if (!declNotationName)
- return XML_ERROR_NO_MEMORY;
- poolFinish(&tempPool);
- }
- break;
- case XML_ROLE_NOTATION_PUBLIC_ID:
- if (!XmlIsPublicId(enc, s, next, eventPP))
- return XML_ERROR_SYNTAX;
- if (declNotationName) {
- XML_Char *tem = poolStoreString(&tempPool,
- enc,
- s + enc->minBytesPerChar,
- next - enc->minBytesPerChar);
- if (!tem)
- return XML_ERROR_NO_MEMORY;
- normalizePublicId(tem);
- declNotationPublicId = tem;
- poolFinish(&tempPool);
- }
- break;
- case XML_ROLE_NOTATION_SYSTEM_ID:
- if (declNotationName && notationDeclHandler) {
- const XML_Char *systemId
- = poolStoreString(&tempPool, enc,
- s + enc->minBytesPerChar,
- next - enc->minBytesPerChar);
- if (!systemId)
- return XML_ERROR_NO_MEMORY;
- *eventEndPP = s;
- notationDeclHandler(handlerArg,
- declNotationName,
- curBase,
- systemId,
- declNotationPublicId);
- }
- poolClear(&tempPool);
- break;
- case XML_ROLE_NOTATION_NO_SYSTEM_ID:
- if (declNotationPublicId && notationDeclHandler) {
- *eventEndPP = s;
- notationDeclHandler(handlerArg,
- declNotationName,
- curBase,
- 0,
- declNotationPublicId);
- }
- poolClear(&tempPool);
- break;
- case XML_ROLE_ERROR:
- switch (tok) {
- case XML_TOK_PARAM_ENTITY_REF:
- return XML_ERROR_PARAM_ENTITY_REF;
- case XML_TOK_XML_DECL:
- return XML_ERROR_MISPLACED_XML_PI;
- default:
- return XML_ERROR_SYNTAX;
- }
-#ifdef XML_DTD
- case XML_ROLE_IGNORE_SECT:
- {
- enum XML_Error result;
- if (defaultHandler)
- reportDefault(parser, enc, s, next);
- result = doIgnoreSection(parser, enc, &next, end, nextPtr);
- if (!next) {
- processor = ignoreSectionProcessor;
- return result;
- }
- }
- break;
-#endif /* XML_DTD */
- case XML_ROLE_GROUP_OPEN:
- if (prologState.level >= groupSize) {
- if (groupSize) {
- groupConnector = REALLOC(groupConnector, groupSize *= 2);
- if (dtd.scaffIndex)
- dtd.scaffIndex = REALLOC(dtd.scaffIndex, groupSize * sizeof(int));
- }
- else
- groupConnector = MALLOC(groupSize = 32);
- if (!groupConnector)
- return XML_ERROR_NO_MEMORY;
- }
- groupConnector[prologState.level] = 0;
- if (dtd.in_eldecl) {
- int myindex = nextScaffoldPart(parser);
- if (myindex < 0)
- return XML_ERROR_NO_MEMORY;
- dtd.scaffIndex[dtd.scaffLevel] = myindex;
- dtd.scaffLevel++;
- dtd.scaffold[myindex].type = XML_CTYPE_SEQ;
- }
- break;
- case XML_ROLE_GROUP_SEQUENCE:
- if (groupConnector[prologState.level] == '|')
- return XML_ERROR_SYNTAX;
- groupConnector[prologState.level] = ',';
- break;
- case XML_ROLE_GROUP_CHOICE:
- if (groupConnector[prologState.level] == ',')
- return XML_ERROR_SYNTAX;
- if (dtd.in_eldecl
- && ! groupConnector[prologState.level]
- && dtd.scaffold[dtd.scaffIndex[dtd.scaffLevel - 1]].type != XML_CTYPE_MIXED
- ) {
- dtd.scaffold[dtd.scaffIndex[dtd.scaffLevel - 1]].type = XML_CTYPE_CHOICE;
- }
- groupConnector[prologState.level] = '|';
- break;
- case XML_ROLE_PARAM_ENTITY_REF:
-#ifdef XML_DTD
- case XML_ROLE_INNER_PARAM_ENTITY_REF:
- if (paramEntityParsing
- && (dtd.complete || role == XML_ROLE_INNER_PARAM_ENTITY_REF)) {
- const XML_Char *name;
- ENTITY *entity;
- name = poolStoreString(&dtd.pool, enc,
- s + enc->minBytesPerChar,
- next - enc->minBytesPerChar);
- if (!name)
- return XML_ERROR_NO_MEMORY;
- entity = (ENTITY *)lookup(&dtd.paramEntities, name, 0);
- poolDiscard(&dtd.pool);
- if (!entity) {
- /* FIXME what to do if !dtd.complete? */
- return XML_ERROR_UNDEFINED_ENTITY;
- }
- if (entity->open)
- return XML_ERROR_RECURSIVE_ENTITY_REF;
- if (entity->textPtr) {
- enum XML_Error result;
- result = processInternalParamEntity(parser, entity);
- if (result != XML_ERROR_NONE)
- return result;
- break;
- }
- if (role == XML_ROLE_INNER_PARAM_ENTITY_REF)
- return XML_ERROR_PARAM_ENTITY_REF;
- if (externalEntityRefHandler) {
- dtd.complete = 0;
- entity->open = 1;
- if (!externalEntityRefHandler(externalEntityRefHandlerArg,
- 0,
- entity->base,
- entity->systemId,
- entity->publicId)) {
- entity->open = 0;
- return XML_ERROR_EXTERNAL_ENTITY_HANDLING;
- }
- entity->open = 0;
- if (dtd.complete)
- break;
- }
- }
-#endif /* XML_DTD */
- if (!dtd.standalone
- && notStandaloneHandler
- && !notStandaloneHandler(handlerArg))
- return XML_ERROR_NOT_STANDALONE;
- dtd.complete = 0;
- if (defaultHandler)
- reportDefault(parser, enc, s, next);
- break;
-
- /* Element declaration stuff */
-
- case XML_ROLE_ELEMENT_NAME:
- if (elementDeclHandler) {
- declElementType = getElementType(parser, enc, s, next);
- if (! declElementType)
- return XML_ERROR_NO_MEMORY;
- dtd.scaffLevel = 0;
- dtd.scaffCount = 0;
- dtd.in_eldecl = 1;
- }
- break;
-
- case XML_ROLE_CONTENT_ANY:
- case XML_ROLE_CONTENT_EMPTY:
- if (dtd.in_eldecl) {
- if (elementDeclHandler) {
- XML_Content * content = (XML_Content *) MALLOC(sizeof(XML_Content));
- if (! content)
- return XML_ERROR_NO_MEMORY;
- content->quant = XML_CQUANT_NONE;
- content->name = 0;
- content->numchildren = 0;
- content->children = 0;
- content->type = ((role == XML_ROLE_CONTENT_ANY) ?
- XML_CTYPE_ANY :
- XML_CTYPE_EMPTY);
- *eventEndPP = s;
- elementDeclHandler(handlerArg, declElementType->name, content);
- }
- dtd.in_eldecl = 0;
- }
- break;
-
- case XML_ROLE_CONTENT_PCDATA:
- if (dtd.in_eldecl) {
- dtd.scaffold[dtd.scaffIndex[dtd.scaffLevel - 1]].type = XML_CTYPE_MIXED;
- }
- break;
-
- case XML_ROLE_CONTENT_ELEMENT:
- quant = XML_CQUANT_NONE;
- goto elementContent;
- case XML_ROLE_CONTENT_ELEMENT_OPT:
- quant = XML_CQUANT_OPT;
- goto elementContent;
- case XML_ROLE_CONTENT_ELEMENT_REP:
- quant = XML_CQUANT_REP;
- goto elementContent;
- case XML_ROLE_CONTENT_ELEMENT_PLUS:
- quant = XML_CQUANT_PLUS;
- elementContent:
- if (dtd.in_eldecl)
- {
- ELEMENT_TYPE *el;
- const char *nxt = quant == XML_CQUANT_NONE ? next : next - 1;
- int myindex = nextScaffoldPart(parser);
- if (myindex < 0)
- return XML_ERROR_NO_MEMORY;
- dtd.scaffold[myindex].type = XML_CTYPE_NAME;
- dtd.scaffold[myindex].quant = quant;
- el = getElementType(parser, enc, s, nxt);
- if (! el)
- return XML_ERROR_NO_MEMORY;
- dtd.scaffold[myindex].name = el->name;
- dtd.contentStringLen += nxt - s + 1;
- }
- break;
-
- case XML_ROLE_GROUP_CLOSE:
- quant = XML_CQUANT_NONE;
- goto closeGroup;
- case XML_ROLE_GROUP_CLOSE_OPT:
- quant = XML_CQUANT_OPT;
- goto closeGroup;
- case XML_ROLE_GROUP_CLOSE_REP:
- quant = XML_CQUANT_REP;
- goto closeGroup;
- case XML_ROLE_GROUP_CLOSE_PLUS:
- quant = XML_CQUANT_PLUS;
- closeGroup:
- if (dtd.in_eldecl) {
- dtd.scaffLevel--;
- dtd.scaffold[dtd.scaffIndex[dtd.scaffLevel]].quant = quant;
- if (dtd.scaffLevel == 0) {
- if (elementDeclHandler) {
- XML_Content *model = build_model(parser);
- if (! model)
- return XML_ERROR_NO_MEMORY;
- *eventEndPP = s;
- elementDeclHandler(handlerArg, declElementType->name, model);
- }
- dtd.in_eldecl = 0;
- dtd.contentStringLen = 0;
- }
- }
- break;
- /* End element declaration stuff */
-
- case XML_ROLE_NONE:
- switch (tok) {
- case XML_TOK_PI:
- if (!reportProcessingInstruction(parser, enc, s, next))
- return XML_ERROR_NO_MEMORY;
- break;
- case XML_TOK_COMMENT:
- if (!reportComment(parser, enc, s, next))
- return XML_ERROR_NO_MEMORY;
- break;
- }
- break;
- }
- if (defaultHandler) {
- switch (tok) {
- case XML_TOK_PI:
- case XML_TOK_COMMENT:
- case XML_TOK_BOM:
- case XML_TOK_XML_DECL:
-#ifdef XML_DTD
- case XML_TOK_IGNORE_SECT:
-#endif /* XML_DTD */
- case XML_TOK_PARAM_ENTITY_REF:
- break;
- default:
-#ifdef XML_DTD
- if (role != XML_ROLE_IGNORE_SECT)
-#endif /* XML_DTD */
- reportDefault(parser, enc, s, next);
- }
- }
- s = next;
- tok = XmlPrologTok(enc, s, end, &next);
- }
- /* not reached */
-}
-
-static
-enum XML_Error epilogProcessor(XML_Parser parser,
- const char *s,
- const char *end,
- const char **nextPtr)
-{
- processor = epilogProcessor;
- eventPtr = s;
- for (;;) {
- const char *next;
- int tok = XmlPrologTok(encoding, s, end, &next);
- eventEndPtr = next;
- switch (tok) {
- case -XML_TOK_PROLOG_S:
- if (defaultHandler) {
- eventEndPtr = end;
- reportDefault(parser, encoding, s, end);
- }
- /* fall through */
- case XML_TOK_NONE:
- if (nextPtr)
- *nextPtr = end;
- return XML_ERROR_NONE;
- case XML_TOK_PROLOG_S:
- if (defaultHandler)
- reportDefault(parser, encoding, s, next);
- break;
- case XML_TOK_PI:
- if (!reportProcessingInstruction(parser, encoding, s, next))
- return XML_ERROR_NO_MEMORY;
- break;
- case XML_TOK_COMMENT:
- if (!reportComment(parser, encoding, s, next))
- return XML_ERROR_NO_MEMORY;
- break;
- case XML_TOK_INVALID:
- eventPtr = next;
- return XML_ERROR_INVALID_TOKEN;
- case XML_TOK_PARTIAL:
- if (nextPtr) {
- *nextPtr = s;
- return XML_ERROR_NONE;
- }
- return XML_ERROR_UNCLOSED_TOKEN;
- case XML_TOK_PARTIAL_CHAR:
- if (nextPtr) {
- *nextPtr = s;
- return XML_ERROR_NONE;
- }
- return XML_ERROR_PARTIAL_CHAR;
- default:
- return XML_ERROR_JUNK_AFTER_DOC_ELEMENT;
- }
- eventPtr = s = next;
- }
-}
-
-#ifdef XML_DTD
-
-static enum XML_Error
-processInternalParamEntity(XML_Parser parser, ENTITY *entity)
-{
- const char *s, *end, *next;
- int tok;
- enum XML_Error result;
- OPEN_INTERNAL_ENTITY openEntity;
- entity->open = 1;
- openEntity.next = openInternalEntities;
- openInternalEntities = &openEntity;
- openEntity.entity = entity;
- openEntity.internalEventPtr = 0;
- openEntity.internalEventEndPtr = 0;
- s = (char *)entity->textPtr;
- end = (char *)(entity->textPtr + entity->textLen);
- tok = XmlPrologTok(internalEncoding, s, end, &next);
- result = doProlog(parser, internalEncoding, s, end, tok, next, 0);
- entity->open = 0;
- openInternalEntities = openEntity.next;
- return result;
-}
-
-#endif /* XML_DTD */
-
-static
-enum XML_Error errorProcessor(XML_Parser parser,
- const char *s,
- const char *end,
- const char **nextPtr)
-{
- return errorCode;
-}
-
-static enum XML_Error
-storeAttributeValue(XML_Parser parser, const ENCODING *enc, int isCdata,
- const char *ptr, const char *end,
- STRING_POOL *pool)
-{
- enum XML_Error result = appendAttributeValue(parser, enc, isCdata, ptr, end, pool);
- if (result)
- return result;
- if (!isCdata && poolLength(pool) && poolLastChar(pool) == 0x20)
- poolChop(pool);
- if (!poolAppendChar(pool, XML_T('\0')))
- return XML_ERROR_NO_MEMORY;
- return XML_ERROR_NONE;
-}
-
-static enum XML_Error
-appendAttributeValue(XML_Parser parser, const ENCODING *enc, int isCdata,
- const char *ptr, const char *end,
- STRING_POOL *pool)
-{
- for (;;) {
- const char *next;
- int tok = XmlAttributeValueTok(enc, ptr, end, &next);
- switch (tok) {
- case XML_TOK_NONE:
- return XML_ERROR_NONE;
- case XML_TOK_INVALID:
- if (enc == encoding)
- eventPtr = next;
- return XML_ERROR_INVALID_TOKEN;
- case XML_TOK_PARTIAL:
- if (enc == encoding)
- eventPtr = ptr;
- return XML_ERROR_INVALID_TOKEN;
- case XML_TOK_CHAR_REF:
- {
- XML_Char buf[XML_ENCODE_MAX];
- int i;
- int n = XmlCharRefNumber(enc, ptr);
- if (n < 0) {
- if (enc == encoding)
- eventPtr = ptr;
- return XML_ERROR_BAD_CHAR_REF;
- }
- if (!isCdata
- && n == 0x20 /* space */
- && (poolLength(pool) == 0 || poolLastChar(pool) == 0x20))
- break;
- n = XmlEncode(n, (ICHAR *)buf);
- if (!n) {
- if (enc == encoding)
- eventPtr = ptr;
- return XML_ERROR_BAD_CHAR_REF;
- }
- for (i = 0; i < n; i++) {
- if (!poolAppendChar(pool, buf[i]))
- return XML_ERROR_NO_MEMORY;
- }
- }
- break;
- case XML_TOK_DATA_CHARS:
- if (!poolAppend(pool, enc, ptr, next))
- return XML_ERROR_NO_MEMORY;
- break;
- break;
- case XML_TOK_TRAILING_CR:
- next = ptr + enc->minBytesPerChar;
- /* fall through */
- case XML_TOK_ATTRIBUTE_VALUE_S:
- case XML_TOK_DATA_NEWLINE:
- if (!isCdata && (poolLength(pool) == 0 || poolLastChar(pool) == 0x20))
- break;
- if (!poolAppendChar(pool, 0x20))
- return XML_ERROR_NO_MEMORY;
- break;
- case XML_TOK_ENTITY_REF:
- {
- const XML_Char *name;
- ENTITY *entity;
- XML_Char ch = XmlPredefinedEntityName(enc,
- ptr + enc->minBytesPerChar,
- next - enc->minBytesPerChar);
- if (ch) {
- if (!poolAppendChar(pool, ch))
- return XML_ERROR_NO_MEMORY;
- break;
- }
- name = poolStoreString(&temp2Pool, enc,
- ptr + enc->minBytesPerChar,
- next - enc->minBytesPerChar);
- if (!name)
- return XML_ERROR_NO_MEMORY;
- entity = (ENTITY *)lookup(&dtd.generalEntities, name, 0);
- poolDiscard(&temp2Pool);
- if (!entity) {
- if (dtd.complete) {
- if (enc == encoding)
- eventPtr = ptr;
- return XML_ERROR_UNDEFINED_ENTITY;
- }
- }
- else if (entity->open) {
- if (enc == encoding)
- eventPtr = ptr;
- return XML_ERROR_RECURSIVE_ENTITY_REF;
- }
- else if (entity->notation) {
- if (enc == encoding)
- eventPtr = ptr;
- return XML_ERROR_BINARY_ENTITY_REF;
- }
- else if (!entity->textPtr) {
- if (enc == encoding)
- eventPtr = ptr;
- return XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF;
- }
- else {
- enum XML_Error result;
- const XML_Char *textEnd = entity->textPtr + entity->textLen;
- entity->open = 1;
- result = appendAttributeValue(parser, internalEncoding, isCdata, (char *)entity->textPtr, (char *)textEnd, pool);
- entity->open = 0;
- if (result)
- return result;
- }
- }
- break;
- default:
- if (enc == encoding)
- eventPtr = ptr;
- return XML_ERROR_UNEXPECTED_STATE;
- }
- ptr = next;
- }
- /* not reached */
-}
-
-static
-enum XML_Error storeEntityValue(XML_Parser parser,
- const ENCODING *enc,
- const char *entityTextPtr,
- const char *entityTextEnd)
-{
- STRING_POOL *pool = &(dtd.pool);
- for (;;) {
- const char *next;
- int tok = XmlEntityValueTok(enc, entityTextPtr, entityTextEnd, &next);
- switch (tok) {
- case XML_TOK_PARAM_ENTITY_REF:
-#ifdef XML_DTD
- if (parentParser || enc != encoding) {
- enum XML_Error result;
- const XML_Char *name;
- ENTITY *entity;
- name = poolStoreString(&tempPool, enc,
- entityTextPtr + enc->minBytesPerChar,
- next - enc->minBytesPerChar);
- if (!name)
- return XML_ERROR_NO_MEMORY;
- entity = (ENTITY *)lookup(&dtd.paramEntities, name, 0);
- poolDiscard(&tempPool);
- if (!entity) {
- if (enc == encoding)
- eventPtr = entityTextPtr;
- return XML_ERROR_UNDEFINED_ENTITY;
- }
- if (entity->open) {
- if (enc == encoding)
- eventPtr = entityTextPtr;
- return XML_ERROR_RECURSIVE_ENTITY_REF;
- }
- if (entity->systemId) {
- if (enc == encoding)
- eventPtr = entityTextPtr;
- return XML_ERROR_PARAM_ENTITY_REF;
- }
- entity->open = 1;
- result = storeEntityValue(parser,
- internalEncoding,
- (char *)entity->textPtr,
- (char *)(entity->textPtr + entity->textLen));
- entity->open = 0;
- if (result)
- return result;
- break;
- }
-#endif /* XML_DTD */
- eventPtr = entityTextPtr;
- return XML_ERROR_SYNTAX;
- case XML_TOK_NONE:
- return XML_ERROR_NONE;
- case XML_TOK_ENTITY_REF:
- case XML_TOK_DATA_CHARS:
- if (!poolAppend(pool, enc, entityTextPtr, next))
- return XML_ERROR_NO_MEMORY;
- break;
- case XML_TOK_TRAILING_CR:
- next = entityTextPtr + enc->minBytesPerChar;
- /* fall through */
- case XML_TOK_DATA_NEWLINE:
- if (pool->end == pool->ptr && !poolGrow(pool))
- return XML_ERROR_NO_MEMORY;
- *(pool->ptr)++ = 0xA;
- break;
- case XML_TOK_CHAR_REF:
- {
- XML_Char buf[XML_ENCODE_MAX];
- int i;
- int n = XmlCharRefNumber(enc, entityTextPtr);
- if (n < 0) {
- if (enc == encoding)
- eventPtr = entityTextPtr;
- return XML_ERROR_BAD_CHAR_REF;
- }
- n = XmlEncode(n, (ICHAR *)buf);
- if (!n) {
- if (enc == encoding)
- eventPtr = entityTextPtr;
- return XML_ERROR_BAD_CHAR_REF;
- }
- for (i = 0; i < n; i++) {
- if (pool->end == pool->ptr && !poolGrow(pool))
- return XML_ERROR_NO_MEMORY;
- *(pool->ptr)++ = buf[i];
- }
- }
- break;
- case XML_TOK_PARTIAL:
- if (enc == encoding)
- eventPtr = entityTextPtr;
- return XML_ERROR_INVALID_TOKEN;
- case XML_TOK_INVALID:
- if (enc == encoding)
- eventPtr = next;
- return XML_ERROR_INVALID_TOKEN;
- default:
- if (enc == encoding)
- eventPtr = entityTextPtr;
- return XML_ERROR_UNEXPECTED_STATE;
- }
- entityTextPtr = next;
- }
- /* not reached */
-}
-
-static void
-normalizeLines(XML_Char *s)
-{
- XML_Char *p;
- for (;; s++) {
- if (*s == XML_T('\0'))
- return;
- if (*s == 0xD)
- break;
- }
- p = s;
- do {
- if (*s == 0xD) {
- *p++ = 0xA;
- if (*++s == 0xA)
- s++;
- }
- else
- *p++ = *s++;
- } while (*s);
- *p = XML_T('\0');
-}
-
-static int
-reportProcessingInstruction(XML_Parser parser, const ENCODING *enc, const char *start, const char *end)
-{
- const XML_Char *target;
- XML_Char *data;
- const char *tem;
- if (!processingInstructionHandler) {
- if (defaultHandler)
- reportDefault(parser, enc, start, end);
- return 1;
- }
- start += enc->minBytesPerChar * 2;
- tem = start + XmlNameLength(enc, start);
- target = poolStoreString(&tempPool, enc, start, tem);
- if (!target)
- return 0;
- poolFinish(&tempPool);
- data = poolStoreString(&tempPool, enc,
- XmlSkipS(enc, tem),
- end - enc->minBytesPerChar*2);
- if (!data)
- return 0;
- normalizeLines(data);
- processingInstructionHandler(handlerArg, target, data);
- poolClear(&tempPool);
- return 1;
-}
-
-static int
-reportComment(XML_Parser parser, const ENCODING *enc, const char *start, const char *end)
-{
- XML_Char *data;
- if (!commentHandler) {
- if (defaultHandler)
- reportDefault(parser, enc, start, end);
- return 1;
- }
- data = poolStoreString(&tempPool,
- enc,
- start + enc->minBytesPerChar * 4,
- end - enc->minBytesPerChar * 3);
- if (!data)
- return 0;
- normalizeLines(data);
- commentHandler(handlerArg, data);
- poolClear(&tempPool);
- return 1;
-}
-
-static void
-reportDefault(XML_Parser parser, const ENCODING *enc, const char *s, const char *end)
-{
- if (MUST_CONVERT(enc, s)) {
- const char **eventPP;
- const char **eventEndPP;
- if (enc == encoding) {
- eventPP = &eventPtr;
- eventEndPP = &eventEndPtr;
- }
- else {
- eventPP = &(openInternalEntities->internalEventPtr);
- eventEndPP = &(openInternalEntities->internalEventEndPtr);
- }
- do {
- ICHAR *dataPtr = (ICHAR *)dataBuf;
- XmlConvert(enc, &s, end, &dataPtr, (ICHAR *)dataBufEnd);
- *eventEndPP = s;
- defaultHandler(handlerArg, dataBuf, dataPtr - (ICHAR *)dataBuf);
- *eventPP = s;
- } while (s != end);
- }
- else
- defaultHandler(handlerArg, (XML_Char *)s, (XML_Char *)end - (XML_Char *)s);
-}
-
-
-static int
-defineAttribute(ELEMENT_TYPE *type, ATTRIBUTE_ID *attId, int isCdata,
- int isId, const XML_Char *value, XML_Parser parser)
-{
- DEFAULT_ATTRIBUTE *att;
- if (value || isId) {
- /* The handling of default attributes gets messed up if we have
- a default which duplicates a non-default. */
- int i;
- for (i = 0; i < type->nDefaultAtts; i++)
- if (attId == type->defaultAtts[i].id)
- return 1;
- if (isId && !type->idAtt && !attId->xmlns)
- type->idAtt = attId;
- }
- if (type->nDefaultAtts == type->allocDefaultAtts) {
- if (type->allocDefaultAtts == 0) {
- type->allocDefaultAtts = 8;
- type->defaultAtts = MALLOC(type->allocDefaultAtts*sizeof(DEFAULT_ATTRIBUTE));
- }
- else {
- type->allocDefaultAtts *= 2;
- type->defaultAtts = REALLOC(type->defaultAtts,
- type->allocDefaultAtts*sizeof(DEFAULT_ATTRIBUTE));
- }
- if (!type->defaultAtts)
- return 0;
- }
- att = type->defaultAtts + type->nDefaultAtts;
- att->id = attId;
- att->value = value;
- att->isCdata = isCdata;
- if (!isCdata)
- attId->maybeTokenized = 1;
- type->nDefaultAtts += 1;
- return 1;
-}
-
-static int setElementTypePrefix(XML_Parser parser, ELEMENT_TYPE *elementType)
-{
- const XML_Char *name;
- for (name = elementType->name; *name; name++) {
- if (*name == XML_T(':')) {
- PREFIX *prefix;
- const XML_Char *s;
- for (s = elementType->name; s != name; s++) {
- if (!poolAppendChar(&dtd.pool, *s))
- return 0;
- }
- if (!poolAppendChar(&dtd.pool, XML_T('\0')))
- return 0;
- prefix = (PREFIX *)lookup(&dtd.prefixes, poolStart(&dtd.pool), sizeof(PREFIX));
- if (!prefix)
- return 0;
- if (prefix->name == poolStart(&dtd.pool))
- poolFinish(&dtd.pool);
- else
- poolDiscard(&dtd.pool);
- elementType->prefix = prefix;
-
- }
- }
- return 1;
-}
-
-static ATTRIBUTE_ID *
-getAttributeId(XML_Parser parser, const ENCODING *enc, const char *start, const char *end)
-{
- ATTRIBUTE_ID *id;
- const XML_Char *name;
- if (!poolAppendChar(&dtd.pool, XML_T('\0')))
- return 0;
- name = poolStoreString(&dtd.pool, enc, start, end);
- if (!name)
- return 0;
- ++name;
- id = (ATTRIBUTE_ID *)lookup(&dtd.attributeIds, name, sizeof(ATTRIBUTE_ID));
- if (!id)
- return 0;
- if (id->name != name)
- poolDiscard(&dtd.pool);
- else {
- poolFinish(&dtd.pool);
- if (!ns)
- ;
- else if (name[0] == 'x'
- && name[1] == 'm'
- && name[2] == 'l'
- && name[3] == 'n'
- && name[4] == 's'
- && (name[5] == XML_T('\0') || name[5] == XML_T(':'))) {
- if (name[5] == '\0')
- id->prefix = &dtd.defaultPrefix;
- else
- id->prefix = (PREFIX *)lookup(&dtd.prefixes, name + 6, sizeof(PREFIX));
- id->xmlns = 1;
- }
- else {
- int i;
- for (i = 0; name[i]; i++) {
- if (name[i] == XML_T(':')) {
- int j;
- for (j = 0; j < i; j++) {
- if (!poolAppendChar(&dtd.pool, name[j]))
- return 0;
- }
- if (!poolAppendChar(&dtd.pool, XML_T('\0')))
- return 0;
- id->prefix = (PREFIX *)lookup(&dtd.prefixes, poolStart(&dtd.pool), sizeof(PREFIX));
- if (id->prefix->name == poolStart(&dtd.pool))
- poolFinish(&dtd.pool);
- else
- poolDiscard(&dtd.pool);
- break;
- }
- }
- }
- }
- return id;
-}
-
-#define CONTEXT_SEP XML_T('\f')
-
-static
-const XML_Char *getContext(XML_Parser parser)
-{
- HASH_TABLE_ITER iter;
- int needSep = 0;
-
- if (dtd.defaultPrefix.binding) {
- int i;
- int len;
- if (!poolAppendChar(&tempPool, XML_T('=')))
- return 0;
- len = dtd.defaultPrefix.binding->uriLen;
- if (namespaceSeparator != XML_T('\0'))
- len--;
- for (i = 0; i < len; i++)
- if (!poolAppendChar(&tempPool, dtd.defaultPrefix.binding->uri[i]))
- return 0;
- needSep = 1;
- }
-
- hashTableIterInit(&iter, &(dtd.prefixes));
- for (;;) {
- int i;
- int len;
- const XML_Char *s;
- PREFIX *prefix = (PREFIX *)hashTableIterNext(&iter);
- if (!prefix)
- break;
- if (!prefix->binding)
- continue;
- if (needSep && !poolAppendChar(&tempPool, CONTEXT_SEP))
- return 0;
- for (s = prefix->name; *s; s++)
- if (!poolAppendChar(&tempPool, *s))
- return 0;
- if (!poolAppendChar(&tempPool, XML_T('=')))
- return 0;
- len = prefix->binding->uriLen;
- if (namespaceSeparator != XML_T('\0'))
- len--;
- for (i = 0; i < len; i++)
- if (!poolAppendChar(&tempPool, prefix->binding->uri[i]))
- return 0;
- needSep = 1;
- }
-
-
- hashTableIterInit(&iter, &(dtd.generalEntities));
- for (;;) {
- const XML_Char *s;
- ENTITY *e = (ENTITY *)hashTableIterNext(&iter);
- if (!e)
- break;
- if (!e->open)
- continue;
- if (needSep && !poolAppendChar(&tempPool, CONTEXT_SEP))
- return 0;
- for (s = e->name; *s; s++)
- if (!poolAppendChar(&tempPool, *s))
- return 0;
- needSep = 1;
- }
-
- if (!poolAppendChar(&tempPool, XML_T('\0')))
- return 0;
- return tempPool.start;
-}
-
-static
-int setContext(XML_Parser parser, const XML_Char *context)
-{
- const XML_Char *s = context;
-
- while (*context != XML_T('\0')) {
- if (*s == CONTEXT_SEP || *s == XML_T('\0')) {
- ENTITY *e;
- if (!poolAppendChar(&tempPool, XML_T('\0')))
- return 0;
- e = (ENTITY *)lookup(&dtd.generalEntities, poolStart(&tempPool), 0);
- if (e)
- e->open = 1;
- if (*s != XML_T('\0'))
- s++;
- context = s;
- poolDiscard(&tempPool);
- }
- else if (*s == '=') {
- PREFIX *prefix;
- if (poolLength(&tempPool) == 0)
- prefix = &dtd.defaultPrefix;
- else {
- if (!poolAppendChar(&tempPool, XML_T('\0')))
- return 0;
- prefix = (PREFIX *)lookup(&dtd.prefixes, poolStart(&tempPool), sizeof(PREFIX));
- if (!prefix)
- return 0;
- if (prefix->name == poolStart(&tempPool)) {
- prefix->name = poolCopyString(&dtd.pool, prefix->name);
- if (!prefix->name)
- return 0;
- }
- poolDiscard(&tempPool);
- }
- for (context = s + 1; *context != CONTEXT_SEP && *context != XML_T('\0'); context++)
- if (!poolAppendChar(&tempPool, *context))
- return 0;
- if (!poolAppendChar(&tempPool, XML_T('\0')))
- return 0;
- if (!addBinding(parser, prefix, 0, poolStart(&tempPool), &inheritedBindings))
- return 0;
- poolDiscard(&tempPool);
- if (*context != XML_T('\0'))
- ++context;
- s = context;
- }
- else {
- if (!poolAppendChar(&tempPool, *s))
- return 0;
- s++;
- }
- }
- return 1;
-}
-
-
-static
-void normalizePublicId(XML_Char *publicId)
-{
- XML_Char *p = publicId;
- XML_Char *s;
- for (s = publicId; *s; s++) {
- switch (*s) {
- case 0x20:
- case 0xD:
- case 0xA:
- if (p != publicId && p[-1] != 0x20)
- *p++ = 0x20;
- break;
- default:
- *p++ = *s;
- }
- }
- if (p != publicId && p[-1] == 0x20)
- --p;
- *p = XML_T('\0');
-}
-
-static int dtdInit(DTD *p, XML_Parser parser)
-{
- XML_Memory_Handling_Suite *ms = &((Parser *) parser)->m_mem;
- poolInit(&(p->pool), ms);
- hashTableInit(&(p->generalEntities), ms);
- hashTableInit(&(p->elementTypes), ms);
- hashTableInit(&(p->attributeIds), ms);
- hashTableInit(&(p->prefixes), ms);
- p->complete = 1;
- p->standalone = 0;
-#ifdef XML_DTD
- hashTableInit(&(p->paramEntities), ms);
-#endif /* XML_DTD */
- p->defaultPrefix.name = 0;
- p->defaultPrefix.binding = 0;
-
- p->in_eldecl = 0;
- p->scaffIndex = 0;
- p->scaffLevel = 0;
- p->scaffold = 0;
- p->contentStringLen = 0;
- p->scaffSize = 0;
- p->scaffCount = 0;
-
- return 1;
-}
-
-#ifdef XML_DTD
-
-static void dtdSwap(DTD *p1, DTD *p2)
-{
- DTD tem;
- memcpy(&tem, p1, sizeof(DTD));
- memcpy(p1, p2, sizeof(DTD));
- memcpy(p2, &tem, sizeof(DTD));
-}
-
-#endif /* XML_DTD */
-
-static void dtdDestroy(DTD *p, XML_Parser parser)
-{
- HASH_TABLE_ITER iter;
- hashTableIterInit(&iter, &(p->elementTypes));
- for (;;) {
- ELEMENT_TYPE *e = (ELEMENT_TYPE *)hashTableIterNext(&iter);
- if (!e)
- break;
- if (e->allocDefaultAtts != 0)
- FREE(e->defaultAtts);
- }
- hashTableDestroy(&(p->generalEntities));
-#ifdef XML_DTD
- hashTableDestroy(&(p->paramEntities));
-#endif /* XML_DTD */
- hashTableDestroy(&(p->elementTypes));
- hashTableDestroy(&(p->attributeIds));
- hashTableDestroy(&(p->prefixes));
- poolDestroy(&(p->pool));
- if (p->scaffIndex)
- FREE(p->scaffIndex);
- if (p->scaffold)
- FREE(p->scaffold);
-}
-
-/* Do a deep copy of the DTD. Return 0 for out of memory; non-zero otherwise.
-The new DTD has already been initialized. */
-
-static int dtdCopy(DTD *newDtd, const DTD *oldDtd, XML_Parser parser)
-{
- HASH_TABLE_ITER iter;
-
- /* Copy the prefix table. */
-
- hashTableIterInit(&iter, &(oldDtd->prefixes));
- for (;;) {
- const XML_Char *name;
- const PREFIX *oldP = (PREFIX *)hashTableIterNext(&iter);
- if (!oldP)
- break;
- name = poolCopyString(&(newDtd->pool), oldP->name);
- if (!name)
- return 0;
- if (!lookup(&(newDtd->prefixes), name, sizeof(PREFIX)))
- return 0;
- }
-
- hashTableIterInit(&iter, &(oldDtd->attributeIds));
-
- /* Copy the attribute id table. */
-
- for (;;) {
- ATTRIBUTE_ID *newA;
- const XML_Char *name;
- const ATTRIBUTE_ID *oldA = (ATTRIBUTE_ID *)hashTableIterNext(&iter);
-
- if (!oldA)
- break;
- /* Remember to allocate the scratch byte before the name. */
- if (!poolAppendChar(&(newDtd->pool), XML_T('\0')))
- return 0;
- name = poolCopyString(&(newDtd->pool), oldA->name);
- if (!name)
- return 0;
- ++name;
- newA = (ATTRIBUTE_ID *)lookup(&(newDtd->attributeIds), name, sizeof(ATTRIBUTE_ID));
- if (!newA)
- return 0;
- newA->maybeTokenized = oldA->maybeTokenized;
- if (oldA->prefix) {
- newA->xmlns = oldA->xmlns;
- if (oldA->prefix == &oldDtd->defaultPrefix)
- newA->prefix = &newDtd->defaultPrefix;
- else
- newA->prefix = (PREFIX *)lookup(&(newDtd->prefixes), oldA->prefix->name, 0);
- }
- }
-
- /* Copy the element type table. */
-
- hashTableIterInit(&iter, &(oldDtd->elementTypes));
-
- for (;;) {
- int i;
- ELEMENT_TYPE *newE;
- const XML_Char *name;
- const ELEMENT_TYPE *oldE = (ELEMENT_TYPE *)hashTableIterNext(&iter);
- if (!oldE)
- break;
- name = poolCopyString(&(newDtd->pool), oldE->name);
- if (!name)
- return 0;
- newE = (ELEMENT_TYPE *)lookup(&(newDtd->elementTypes), name, sizeof(ELEMENT_TYPE));
- if (!newE)
- return 0;
- if (oldE->nDefaultAtts) {
- newE->defaultAtts = (DEFAULT_ATTRIBUTE *)MALLOC(oldE->nDefaultAtts * sizeof(DEFAULT_ATTRIBUTE));
- if (!newE->defaultAtts)
- return 0;
- }
- if (oldE->idAtt)
- newE->idAtt = (ATTRIBUTE_ID *)lookup(&(newDtd->attributeIds), oldE->idAtt->name, 0);
- newE->allocDefaultAtts = newE->nDefaultAtts = oldE->nDefaultAtts;
- if (oldE->prefix)
- newE->prefix = (PREFIX *)lookup(&(newDtd->prefixes), oldE->prefix->name, 0);
- for (i = 0; i < newE->nDefaultAtts; i++) {
- newE->defaultAtts[i].id = (ATTRIBUTE_ID *)lookup(&(newDtd->attributeIds), oldE->defaultAtts[i].id->name, 0);
- newE->defaultAtts[i].isCdata = oldE->defaultAtts[i].isCdata;
- if (oldE->defaultAtts[i].value) {
- newE->defaultAtts[i].value = poolCopyString(&(newDtd->pool), oldE->defaultAtts[i].value);
- if (!newE->defaultAtts[i].value)
- return 0;
- }
- else
- newE->defaultAtts[i].value = 0;
- }
- }
-
- /* Copy the entity tables. */
- if (!copyEntityTable(&(newDtd->generalEntities),
- &(newDtd->pool),
- &(oldDtd->generalEntities), parser))
- return 0;
-
-#ifdef XML_DTD
- if (!copyEntityTable(&(newDtd->paramEntities),
- &(newDtd->pool),
- &(oldDtd->paramEntities), parser))
- return 0;
-#endif /* XML_DTD */
-
- newDtd->complete = oldDtd->complete;
- newDtd->standalone = oldDtd->standalone;
-
- /* Don't want deep copying for scaffolding */
- newDtd->in_eldecl = oldDtd->in_eldecl;
- newDtd->scaffold = oldDtd->scaffold;
- newDtd->contentStringLen = oldDtd->contentStringLen;
- newDtd->scaffSize = oldDtd->scaffSize;
- newDtd->scaffLevel = oldDtd->scaffLevel;
- newDtd->scaffIndex = oldDtd->scaffIndex;
-
- return 1;
-} /* End dtdCopy */
-
-static int copyEntityTable(HASH_TABLE *newTable,
- STRING_POOL *newPool,
- const HASH_TABLE *oldTable,
- XML_Parser parser)
-{
- HASH_TABLE_ITER iter;
- const XML_Char *cachedOldBase = 0;
- const XML_Char *cachedNewBase = 0;
-
- hashTableIterInit(&iter, oldTable);
-
- for (;;) {
- ENTITY *newE;
- const XML_Char *name;
- const ENTITY *oldE = (ENTITY *)hashTableIterNext(&iter);
- if (!oldE)
- break;
- name = poolCopyString(newPool, oldE->name);
- if (!name)
- return 0;
- newE = (ENTITY *)lookup(newTable, name, sizeof(ENTITY));
- if (!newE)
- return 0;
- if (oldE->systemId) {
- const XML_Char *tem = poolCopyString(newPool, oldE->systemId);
- if (!tem)
- return 0;
- newE->systemId = tem;
- if (oldE->base) {
- if (oldE->base == cachedOldBase)
- newE->base = cachedNewBase;
- else {
- cachedOldBase = oldE->base;
- tem = poolCopyString(newPool, cachedOldBase);
- if (!tem)
- return 0;
- cachedNewBase = newE->base = tem;
- }
- }
- }
- else {
- const XML_Char *tem = poolCopyStringN(newPool, oldE->textPtr, oldE->textLen);
- if (!tem)
- return 0;
- newE->textPtr = tem;
- newE->textLen = oldE->textLen;
- }
- if (oldE->notation) {
- const XML_Char *tem = poolCopyString(newPool, oldE->notation);
- if (!tem)
- return 0;
- newE->notation = tem;
- }
- }
- return 1;
-}
-
-#define INIT_SIZE 64
-
-static
-int keyeq(KEY s1, KEY s2)
-{
- for (; *s1 == *s2; s1++, s2++)
- if (*s1 == 0)
- return 1;
- return 0;
-}
-
-static
-unsigned long hash(KEY s)
-{
- unsigned long h = 0;
- while (*s)
- h = (h << 5) + h + (unsigned char)*s++;
- return h;
-}
-
-static
-NAMED *lookup(HASH_TABLE *table, KEY name, size_t createSize)
-{
- size_t i;
- if (table->size == 0) {
- size_t tsize;
-
- if (!createSize)
- return 0;
- tsize = INIT_SIZE * sizeof(NAMED *);
- table->v = table->mem->malloc_fcn(tsize);
- if (!table->v)
- return 0;
- memset(table->v, 0, tsize);
- table->size = INIT_SIZE;
- table->usedLim = INIT_SIZE / 2;
- i = hash(name) & (table->size - 1);
- }
- else {
- unsigned long h = hash(name);
- for (i = h & (table->size - 1);
- table->v[i];
- i == 0 ? i = table->size - 1 : --i) {
- if (keyeq(name, table->v[i]->name))
- return table->v[i];
- }
- if (!createSize)
- return 0;
- if (table->used == table->usedLim) {
- /* check for overflow */
- size_t newSize = table->size * 2;
- size_t tsize = newSize * sizeof(NAMED *);
- NAMED **newV = table->mem->malloc_fcn(tsize);
- if (!newV)
- return 0;
- memset(newV, 0, tsize);
- for (i = 0; i < table->size; i++)
- if (table->v[i]) {
- size_t j;
- for (j = hash(table->v[i]->name) & (newSize - 1);
- newV[j];
- j == 0 ? j = newSize - 1 : --j)
- ;
- newV[j] = table->v[i];
- }
- table->mem->free_fcn(table->v);
- table->v = newV;
- table->size = newSize;
- table->usedLim = newSize/2;
- for (i = h & (table->size - 1);
- table->v[i];
- i == 0 ? i = table->size - 1 : --i)
- ;
- }
- }
- table->v[i] = table->mem->malloc_fcn(createSize);
- if (!table->v[i])
- return 0;
- memset(table->v[i], 0, createSize);
- table->v[i]->name = name;
- (table->used)++;
- return table->v[i];
-}
-
-static
-void hashTableDestroy(HASH_TABLE *table)
-{
- size_t i;
- for (i = 0; i < table->size; i++) {
- NAMED *p = table->v[i];
- if (p)
- table->mem->free_fcn(p);
- }
- if (table->v)
- table->mem->free_fcn(table->v);
-}
-
-static
-void hashTableInit(HASH_TABLE *p, XML_Memory_Handling_Suite *ms)
-{
- p->size = 0;
- p->usedLim = 0;
- p->used = 0;
- p->v = 0;
- p->mem = ms;
-}
-
-static
-void hashTableIterInit(HASH_TABLE_ITER *iter, const HASH_TABLE *table)
-{
- iter->p = table->v;
- iter->end = iter->p + table->size;
-}
-
-static
-NAMED *hashTableIterNext(HASH_TABLE_ITER *iter)
-{
- while (iter->p != iter->end) {
- NAMED *tem = *(iter->p)++;
- if (tem)
- return tem;
- }
- return 0;
-}
-
-
-static
-void poolInit(STRING_POOL *pool, XML_Memory_Handling_Suite *ms)
-{
- pool->blocks = 0;
- pool->freeBlocks = 0;
- pool->start = 0;
- pool->ptr = 0;
- pool->end = 0;
- pool->mem = ms;
-}
-
-static
-void poolClear(STRING_POOL *pool)
-{
- if (!pool->freeBlocks)
- pool->freeBlocks = pool->blocks;
- else {
- BLOCK *p = pool->blocks;
- while (p) {
- BLOCK *tem = p->next;
- p->next = pool->freeBlocks;
- pool->freeBlocks = p;
- p = tem;
- }
- }
- pool->blocks = 0;
- pool->start = 0;
- pool->ptr = 0;
- pool->end = 0;
-}
-
-static
-void poolDestroy(STRING_POOL *pool)
-{
- BLOCK *p = pool->blocks;
- while (p) {
- BLOCK *tem = p->next;
- pool->mem->free_fcn(p);
- p = tem;
- }
- pool->blocks = 0;
- p = pool->freeBlocks;
- while (p) {
- BLOCK *tem = p->next;
- pool->mem->free_fcn(p);
- p = tem;
- }
- pool->freeBlocks = 0;
- pool->ptr = 0;
- pool->start = 0;
- pool->end = 0;
-}
-
-static
-XML_Char *poolAppend(STRING_POOL *pool, const ENCODING *enc,
- const char *ptr, const char *end)
-{
- if (!pool->ptr && !poolGrow(pool))
- return 0;
- for (;;) {
- XmlConvert(enc, &ptr, end, (ICHAR **)&(pool->ptr), (ICHAR *)pool->end);
- if (ptr == end)
- break;
- if (!poolGrow(pool))
- return 0;
- }
- return pool->start;
-}
-
-static const XML_Char *poolCopyString(STRING_POOL *pool, const XML_Char *s)
-{
- do {
- if (!poolAppendChar(pool, *s))
- return 0;
- } while (*s++);
- s = pool->start;
- poolFinish(pool);
- return s;
-}
-
-static const XML_Char *poolCopyStringN(STRING_POOL *pool, const XML_Char *s, int n)
-{
- if (!pool->ptr && !poolGrow(pool))
- return 0;
- for (; n > 0; --n, s++) {
- if (!poolAppendChar(pool, *s))
- return 0;
-
- }
- s = pool->start;
- poolFinish(pool);
- return s;
-}
-
-static
-const XML_Char *poolAppendString(STRING_POOL *pool, const XML_Char *s)
-{
- while (*s) {
- if (!poolAppendChar(pool, *s))
- return 0;
- s++;
- }
- return pool->start;
-} /* End poolAppendString */
-
-static
-XML_Char *poolStoreString(STRING_POOL *pool, const ENCODING *enc,
- const char *ptr, const char *end)
-{
- if (!poolAppend(pool, enc, ptr, end))
- return 0;
- if (pool->ptr == pool->end && !poolGrow(pool))
- return 0;
- *(pool->ptr)++ = 0;
- return pool->start;
-}
-
-static
-int poolGrow(STRING_POOL *pool)
-{
- if (pool->freeBlocks) {
- if (pool->start == 0) {
- pool->blocks = pool->freeBlocks;
- pool->freeBlocks = pool->freeBlocks->next;
- pool->blocks->next = 0;
- pool->start = pool->blocks->s;
- pool->end = pool->start + pool->blocks->size;
- pool->ptr = pool->start;
- return 1;
- }
- if (pool->end - pool->start < pool->freeBlocks->size) {
- BLOCK *tem = pool->freeBlocks->next;
- pool->freeBlocks->next = pool->blocks;
- pool->blocks = pool->freeBlocks;
- pool->freeBlocks = tem;
- memcpy(pool->blocks->s, pool->start, (pool->end - pool->start) * sizeof(XML_Char));
- pool->ptr = pool->blocks->s + (pool->ptr - pool->start);
- pool->start = pool->blocks->s;
- pool->end = pool->start + pool->blocks->size;
- return 1;
- }
- }
- if (pool->blocks && pool->start == pool->blocks->s) {
- int blockSize = (pool->end - pool->start)*2;
- pool->blocks = pool->mem->realloc_fcn(pool->blocks, offsetof(BLOCK, s) + blockSize * sizeof(XML_Char));
- if (!pool->blocks)
- return 0;
- pool->blocks->size = blockSize;
- pool->ptr = pool->blocks->s + (pool->ptr - pool->start);
- pool->start = pool->blocks->s;
- pool->end = pool->start + blockSize;
- }
- else {
- BLOCK *tem;
- int blockSize = pool->end - pool->start;
- if (blockSize < INIT_BLOCK_SIZE)
- blockSize = INIT_BLOCK_SIZE;
- else
- blockSize *= 2;
- tem = pool->mem->malloc_fcn(offsetof(BLOCK, s) + blockSize * sizeof(XML_Char));
- if (!tem)
- return 0;
- tem->size = blockSize;
- tem->next = pool->blocks;
- pool->blocks = tem;
- if (pool->ptr != pool->start)
- memcpy(tem->s, pool->start, (pool->ptr - pool->start) * sizeof(XML_Char));
- pool->ptr = tem->s + (pool->ptr - pool->start);
- pool->start = tem->s;
- pool->end = tem->s + blockSize;
- }
- return 1;
-}
-
-static int
-nextScaffoldPart(XML_Parser parser)
-{
- CONTENT_SCAFFOLD * me;
- int next;
-
- if (! dtd.scaffIndex) {
- dtd.scaffIndex = MALLOC(groupSize * sizeof(int));
- if (! dtd.scaffIndex)
- return -1;
- dtd.scaffIndex[0] = 0;
- }
-
- if (dtd.scaffCount >= dtd.scaffSize) {
- if (dtd.scaffold) {
- dtd.scaffSize *= 2;
- dtd.scaffold = (CONTENT_SCAFFOLD *) REALLOC(dtd.scaffold,
- dtd.scaffSize * sizeof(CONTENT_SCAFFOLD));
- }
- else {
- dtd.scaffSize = 32;
- dtd.scaffold = (CONTENT_SCAFFOLD *) MALLOC(dtd.scaffSize * sizeof(CONTENT_SCAFFOLD));
- }
- if (! dtd.scaffold)
- return -1;
- }
- next = dtd.scaffCount++;
- me = &dtd.scaffold[next];
- if (dtd.scaffLevel) {
- CONTENT_SCAFFOLD *parent = &dtd.scaffold[dtd.scaffIndex[dtd.scaffLevel - 1]];
- if (parent->lastchild) {
- dtd.scaffold[parent->lastchild].nextsib = next;
- }
- if (! parent->childcnt)
- parent->firstchild = next;
- parent->lastchild = next;
- parent->childcnt++;
- }
- me->firstchild = me->lastchild = me->childcnt = me->nextsib = 0;
- return next;
-} /* End nextScaffoldPart */
-
-static void
-build_node (XML_Parser parser,
- int src_node,
- XML_Content *dest,
- XML_Content **contpos,
- char **strpos)
-{
- dest->type = dtd.scaffold[src_node].type;
- dest->quant = dtd.scaffold[src_node].quant;
- if (dest->type == XML_CTYPE_NAME) {
- const char *src;
- dest->name = *strpos;
- src = dtd.scaffold[src_node].name;
- for (;;) {
- *(*strpos)++ = *src;
- if (! *src)
- break;
- src++;
- }
- dest->numchildren = 0;
- dest->children = 0;
- }
- else {
- unsigned int i;
- int cn;
- dest->numchildren = dtd.scaffold[src_node].childcnt;
- dest->children = *contpos;
- *contpos += dest->numchildren;
- for (i = 0, cn = dtd.scaffold[src_node].firstchild;
- i < dest->numchildren;
- i++, cn = dtd.scaffold[cn].nextsib) {
- build_node(parser, cn, &(dest->children[i]), contpos, strpos);
- }
- dest->name = 0;
- }
-} /* End build_node */
-
-static XML_Content *
-build_model (XML_Parser parser)
-{
- XML_Content *ret;
- XML_Content *cpos;
- char * str;
- int allocsize = dtd.scaffCount * sizeof(XML_Content) + dtd.contentStringLen;
-
- ret = MALLOC(allocsize);
- if (! ret)
- return 0;
-
- str = (char *) (&ret[dtd.scaffCount]);
- cpos = &ret[1];
-
- build_node(parser, 0, ret, &cpos, &str);
- return ret;
-} /* End build_model */
-
-static ELEMENT_TYPE *
-getElementType(XML_Parser parser,
- const ENCODING *enc,
- const char *ptr,
- const char *end)
-{
- const XML_Char *name = poolStoreString(&dtd.pool, enc, ptr, end);
- ELEMENT_TYPE *ret;
-
- if (! name)
- return 0;
- ret = (ELEMENT_TYPE *) lookup(&dtd.elementTypes, name, sizeof(ELEMENT_TYPE));
- if (! ret)
- return 0;
- if (ret->name != name)
- poolDiscard(&dtd.pool);
- else {
- poolFinish(&dtd.pool);
- if (!setElementTypePrefix(parser, ret))
- return 0;
- }
- return ret;
-} /* End getElementType */
diff --git a/ext/xml/expat/xmlrole.c b/ext/xml/expat/xmlrole.c
deleted file mode 100644
index ae3840e9f4..0000000000
--- a/ext/xml/expat/xmlrole.c
+++ /dev/null
@@ -1,1279 +0,0 @@
-/*
-Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
-See the file COPYING for copying permission.
-*/
-
-#if 0
-static char RCSId[]
- = "$Header$";
-#endif
-
-#include "php_compat.h"
-
-#ifdef COMPILED_FROM_DSP
-# include "winconfig.h"
-#else
-# include <php_config.h>
-#endif /* ndef COMPILED_FROM_DSP */
-
-#include "xmlrole.h"
-#include "ascii.h"
-
-/* Doesn't check:
-
- that ,| are not mixed in a model group
- content of literals
-
-*/
-
-static const char KW_ANY[] = { ASCII_A, ASCII_N, ASCII_Y, '\0' };
-static const char KW_ATTLIST[] = { ASCII_A, ASCII_T, ASCII_T, ASCII_L, ASCII_I, ASCII_S, ASCII_T, '\0' };
-static const char KW_CDATA[] = { ASCII_C, ASCII_D, ASCII_A, ASCII_T, ASCII_A, '\0' };
-static const char KW_DOCTYPE[] = { ASCII_D, ASCII_O, ASCII_C, ASCII_T, ASCII_Y, ASCII_P, ASCII_E, '\0' };
-static const char KW_ELEMENT[] = { ASCII_E, ASCII_L, ASCII_E, ASCII_M, ASCII_E, ASCII_N, ASCII_T, '\0' };
-static const char KW_EMPTY[] = { ASCII_E, ASCII_M, ASCII_P, ASCII_T, ASCII_Y, '\0' };
-static const char KW_ENTITIES[] = { ASCII_E, ASCII_N, ASCII_T, ASCII_I, ASCII_T, ASCII_I, ASCII_E, ASCII_S, '\0' };
-static const char KW_ENTITY[] = { ASCII_E, ASCII_N, ASCII_T, ASCII_I, ASCII_T, ASCII_Y, '\0' };
-static const char KW_FIXED[] = { ASCII_F, ASCII_I, ASCII_X, ASCII_E, ASCII_D, '\0' };
-static const char KW_ID[] = { ASCII_I, ASCII_D, '\0' };
-static const char KW_IDREF[] = { ASCII_I, ASCII_D, ASCII_R, ASCII_E, ASCII_F, '\0' };
-static const char KW_IDREFS[] = { ASCII_I, ASCII_D, ASCII_R, ASCII_E, ASCII_F, ASCII_S, '\0' };
-static const char KW_IGNORE[] = { ASCII_I, ASCII_G, ASCII_N, ASCII_O, ASCII_R, ASCII_E, '\0' };
-static const char KW_IMPLIED[] = { ASCII_I, ASCII_M, ASCII_P, ASCII_L, ASCII_I, ASCII_E, ASCII_D, '\0' };
-static const char KW_INCLUDE[] = { ASCII_I, ASCII_N, ASCII_C, ASCII_L, ASCII_U, ASCII_D, ASCII_E, '\0' };
-static const char KW_NDATA[] = { ASCII_N, ASCII_D, ASCII_A, ASCII_T, ASCII_A, '\0' };
-static const char KW_NMTOKEN[] = { ASCII_N, ASCII_M, ASCII_T, ASCII_O, ASCII_K, ASCII_E, ASCII_N, '\0' };
-static const char KW_NMTOKENS[] = { ASCII_N, ASCII_M, ASCII_T, ASCII_O, ASCII_K, ASCII_E, ASCII_N, ASCII_S, '\0' };
-static const char KW_NOTATION[] = { ASCII_N, ASCII_O, ASCII_T, ASCII_A, ASCII_T, ASCII_I, ASCII_O, ASCII_N, '\0' };
-static const char KW_PCDATA[] = { ASCII_P, ASCII_C, ASCII_D, ASCII_A, ASCII_T, ASCII_A, '\0' };
-static const char KW_PUBLIC[] = { ASCII_P, ASCII_U, ASCII_B, ASCII_L, ASCII_I, ASCII_C, '\0' };
-static const char KW_REQUIRED[] = { ASCII_R, ASCII_E, ASCII_Q, ASCII_U, ASCII_I, ASCII_R, ASCII_E, ASCII_D, '\0' };
-static const char KW_SYSTEM[] = { ASCII_S, ASCII_Y, ASCII_S, ASCII_T, ASCII_E, ASCII_M, '\0' };
-
-#ifndef MIN_BYTES_PER_CHAR
-#define MIN_BYTES_PER_CHAR(enc) ((enc)->minBytesPerChar)
-#endif
-
-#ifdef XML_DTD
-#define setTopLevel(state) \
- ((state)->handler = ((state)->documentEntity \
- ? internalSubset \
- : externalSubset1))
-#else /* not XML_DTD */
-#define setTopLevel(state) ((state)->handler = internalSubset)
-#endif /* not XML_DTD */
-
-typedef int PROLOG_HANDLER(PROLOG_STATE *state,
- int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc);
-
-static PROLOG_HANDLER
- prolog0, prolog1, prolog2,
- doctype0, doctype1, doctype2, doctype3, doctype4, doctype5,
- internalSubset,
- entity0, entity1, entity2, entity3, entity4, entity5, entity6,
- entity7, entity8, entity9,
- notation0, notation1, notation2, notation3, notation4,
- attlist0, attlist1, attlist2, attlist3, attlist4, attlist5, attlist6,
- attlist7, attlist8, attlist9,
- element0, element1, element2, element3, element4, element5, element6,
- element7,
-#ifdef XML_DTD
- externalSubset0, externalSubset1,
- condSect0, condSect1, condSect2,
-#endif /* XML_DTD */
- declClose,
- error;
-
-static
-int common(PROLOG_STATE *state, int tok);
-
-static
-int prolog0(PROLOG_STATE *state,
- int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
-{
- switch (tok) {
- case XML_TOK_PROLOG_S:
- state->handler = prolog1;
- return XML_ROLE_NONE;
- case XML_TOK_XML_DECL:
- state->handler = prolog1;
- return XML_ROLE_XML_DECL;
- case XML_TOK_PI:
- state->handler = prolog1;
- return XML_ROLE_NONE;
- case XML_TOK_COMMENT:
- state->handler = prolog1;
- case XML_TOK_BOM:
- return XML_ROLE_NONE;
- case XML_TOK_DECL_OPEN:
- if (!XmlNameMatchesAscii(enc,
- ptr + 2 * MIN_BYTES_PER_CHAR(enc),
- end,
- KW_DOCTYPE))
- break;
- state->handler = doctype0;
- return XML_ROLE_NONE;
- case XML_TOK_INSTANCE_START:
- state->handler = error;
- return XML_ROLE_INSTANCE_START;
- }
- return common(state, tok);
-}
-
-static
-int prolog1(PROLOG_STATE *state,
- int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
-{
- switch (tok) {
- case XML_TOK_PROLOG_S:
- return XML_ROLE_NONE;
- case XML_TOK_PI:
- case XML_TOK_COMMENT:
- case XML_TOK_BOM:
- return XML_ROLE_NONE;
- case XML_TOK_DECL_OPEN:
- if (!XmlNameMatchesAscii(enc,
- ptr + 2 * MIN_BYTES_PER_CHAR(enc),
- end,
- KW_DOCTYPE))
- break;
- state->handler = doctype0;
- return XML_ROLE_NONE;
- case XML_TOK_INSTANCE_START:
- state->handler = error;
- return XML_ROLE_INSTANCE_START;
- }
- return common(state, tok);
-}
-
-static
-int prolog2(PROLOG_STATE *state,
- int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
-{
- switch (tok) {
- case XML_TOK_PROLOG_S:
- return XML_ROLE_NONE;
- case XML_TOK_PI:
- case XML_TOK_COMMENT:
- return XML_ROLE_NONE;
- case XML_TOK_INSTANCE_START:
- state->handler = error;
- return XML_ROLE_INSTANCE_START;
- }
- return common(state, tok);
-}
-
-static
-int doctype0(PROLOG_STATE *state,
- int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
-{
- switch (tok) {
- case XML_TOK_PROLOG_S:
- return XML_ROLE_NONE;
- case XML_TOK_NAME:
- case XML_TOK_PREFIXED_NAME:
- state->handler = doctype1;
- return XML_ROLE_DOCTYPE_NAME;
- }
- return common(state, tok);
-}
-
-static
-int doctype1(PROLOG_STATE *state,
- int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
-{
- switch (tok) {
- case XML_TOK_PROLOG_S:
- return XML_ROLE_NONE;
- case XML_TOK_OPEN_BRACKET:
- state->handler = internalSubset;
- return XML_ROLE_DOCTYPE_INTERNAL_SUBSET;
- case XML_TOK_DECL_CLOSE:
- state->handler = prolog2;
- return XML_ROLE_DOCTYPE_CLOSE;
- case XML_TOK_NAME:
- if (XmlNameMatchesAscii(enc, ptr, end, KW_SYSTEM)) {
- state->handler = doctype3;
- return XML_ROLE_NONE;
- }
- if (XmlNameMatchesAscii(enc, ptr, end, KW_PUBLIC)) {
- state->handler = doctype2;
- return XML_ROLE_NONE;
- }
- break;
- }
- return common(state, tok);
-}
-
-static
-int doctype2(PROLOG_STATE *state,
- int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
-{
- switch (tok) {
- case XML_TOK_PROLOG_S:
- return XML_ROLE_NONE;
- case XML_TOK_LITERAL:
- state->handler = doctype3;
- return XML_ROLE_DOCTYPE_PUBLIC_ID;
- }
- return common(state, tok);
-}
-
-static
-int doctype3(PROLOG_STATE *state,
- int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
-{
- switch (tok) {
- case XML_TOK_PROLOG_S:
- return XML_ROLE_NONE;
- case XML_TOK_LITERAL:
- state->handler = doctype4;
- return XML_ROLE_DOCTYPE_SYSTEM_ID;
- }
- return common(state, tok);
-}
-
-static
-int doctype4(PROLOG_STATE *state,
- int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
-{
- switch (tok) {
- case XML_TOK_PROLOG_S:
- return XML_ROLE_NONE;
- case XML_TOK_OPEN_BRACKET:
- state->handler = internalSubset;
- return XML_ROLE_DOCTYPE_INTERNAL_SUBSET;
- case XML_TOK_DECL_CLOSE:
- state->handler = prolog2;
- return XML_ROLE_DOCTYPE_CLOSE;
- }
- return common(state, tok);
-}
-
-static
-int doctype5(PROLOG_STATE *state,
- int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
-{
- switch (tok) {
- case XML_TOK_PROLOG_S:
- return XML_ROLE_NONE;
- case XML_TOK_DECL_CLOSE:
- state->handler = prolog2;
- return XML_ROLE_DOCTYPE_CLOSE;
- }
- return common(state, tok);
-}
-
-static
-int internalSubset(PROLOG_STATE *state,
- int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
-{
- switch (tok) {
- case XML_TOK_PROLOG_S:
- return XML_ROLE_NONE;
- case XML_TOK_DECL_OPEN:
- if (XmlNameMatchesAscii(enc,
- ptr + 2 * MIN_BYTES_PER_CHAR(enc),
- end,
- KW_ENTITY)) {
- state->handler = entity0;
- return XML_ROLE_NONE;
- }
- if (XmlNameMatchesAscii(enc,
- ptr + 2 * MIN_BYTES_PER_CHAR(enc),
- end,
- KW_ATTLIST)) {
- state->handler = attlist0;
- return XML_ROLE_NONE;
- }
- if (XmlNameMatchesAscii(enc,
- ptr + 2 * MIN_BYTES_PER_CHAR(enc),
- end,
- KW_ELEMENT)) {
- state->handler = element0;
- return XML_ROLE_NONE;
- }
- if (XmlNameMatchesAscii(enc,
- ptr + 2 * MIN_BYTES_PER_CHAR(enc),
- end,
- KW_NOTATION)) {
- state->handler = notation0;
- return XML_ROLE_NONE;
- }
- break;
- case XML_TOK_PI:
- case XML_TOK_COMMENT:
- return XML_ROLE_NONE;
- case XML_TOK_PARAM_ENTITY_REF:
- return XML_ROLE_PARAM_ENTITY_REF;
- case XML_TOK_CLOSE_BRACKET:
- state->handler = doctype5;
- return XML_ROLE_NONE;
- }
- return common(state, tok);
-}
-
-#ifdef XML_DTD
-
-static
-int externalSubset0(PROLOG_STATE *state,
- int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
-{
- state->handler = externalSubset1;
- if (tok == XML_TOK_XML_DECL)
- return XML_ROLE_TEXT_DECL;
- return externalSubset1(state, tok, ptr, end, enc);
-}
-
-static
-int externalSubset1(PROLOG_STATE *state,
- int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
-{
- switch (tok) {
- case XML_TOK_COND_SECT_OPEN:
- state->handler = condSect0;
- return XML_ROLE_NONE;
- case XML_TOK_COND_SECT_CLOSE:
- if (state->includeLevel == 0)
- break;
- state->includeLevel -= 1;
- return XML_ROLE_NONE;
- case XML_TOK_PROLOG_S:
- return XML_ROLE_NONE;
- case XML_TOK_CLOSE_BRACKET:
- break;
- case XML_TOK_NONE:
- if (state->includeLevel)
- break;
- return XML_ROLE_NONE;
- default:
- return internalSubset(state, tok, ptr, end, enc);
- }
- return common(state, tok);
-}
-
-#endif /* XML_DTD */
-
-static
-int entity0(PROLOG_STATE *state,
- int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
-{
- switch (tok) {
- case XML_TOK_PROLOG_S:
- return XML_ROLE_NONE;
- case XML_TOK_PERCENT:
- state->handler = entity1;
- return XML_ROLE_NONE;
- case XML_TOK_NAME:
- state->handler = entity2;
- return XML_ROLE_GENERAL_ENTITY_NAME;
- }
- return common(state, tok);
-}
-
-static
-int entity1(PROLOG_STATE *state,
- int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
-{
- switch (tok) {
- case XML_TOK_PROLOG_S:
- return XML_ROLE_NONE;
- case XML_TOK_NAME:
- state->handler = entity7;
- return XML_ROLE_PARAM_ENTITY_NAME;
- }
- return common(state, tok);
-}
-
-static
-int entity2(PROLOG_STATE *state,
- int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
-{
- switch (tok) {
- case XML_TOK_PROLOG_S:
- return XML_ROLE_NONE;
- case XML_TOK_NAME:
- if (XmlNameMatchesAscii(enc, ptr, end, KW_SYSTEM)) {
- state->handler = entity4;
- return XML_ROLE_NONE;
- }
- if (XmlNameMatchesAscii(enc, ptr, end, KW_PUBLIC)) {
- state->handler = entity3;
- return XML_ROLE_NONE;
- }
- break;
- case XML_TOK_LITERAL:
- state->handler = declClose;
- return XML_ROLE_ENTITY_VALUE;
- }
- return common(state, tok);
-}
-
-static
-int entity3(PROLOG_STATE *state,
- int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
-{
- switch (tok) {
- case XML_TOK_PROLOG_S:
- return XML_ROLE_NONE;
- case XML_TOK_LITERAL:
- state->handler = entity4;
- return XML_ROLE_ENTITY_PUBLIC_ID;
- }
- return common(state, tok);
-}
-
-
-static
-int entity4(PROLOG_STATE *state,
- int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
-{
- switch (tok) {
- case XML_TOK_PROLOG_S:
- return XML_ROLE_NONE;
- case XML_TOK_LITERAL:
- state->handler = entity5;
- return XML_ROLE_ENTITY_SYSTEM_ID;
- }
- return common(state, tok);
-}
-
-static
-int entity5(PROLOG_STATE *state,
- int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
-{
- switch (tok) {
- case XML_TOK_PROLOG_S:
- return XML_ROLE_NONE;
- case XML_TOK_DECL_CLOSE:
- setTopLevel(state);
- return XML_ROLE_ENTITY_COMPLETE;
- case XML_TOK_NAME:
- if (XmlNameMatchesAscii(enc, ptr, end, KW_NDATA)) {
- state->handler = entity6;
- return XML_ROLE_NONE;
- }
- break;
- }
- return common(state, tok);
-}
-
-static
-int entity6(PROLOG_STATE *state,
- int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
-{
- switch (tok) {
- case XML_TOK_PROLOG_S:
- return XML_ROLE_NONE;
- case XML_TOK_NAME:
- state->handler = declClose;
- return XML_ROLE_ENTITY_NOTATION_NAME;
- }
- return common(state, tok);
-}
-
-static
-int entity7(PROLOG_STATE *state,
- int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
-{
- switch (tok) {
- case XML_TOK_PROLOG_S:
- return XML_ROLE_NONE;
- case XML_TOK_NAME:
- if (XmlNameMatchesAscii(enc, ptr, end, KW_SYSTEM)) {
- state->handler = entity9;
- return XML_ROLE_NONE;
- }
- if (XmlNameMatchesAscii(enc, ptr, end, KW_PUBLIC)) {
- state->handler = entity8;
- return XML_ROLE_NONE;
- }
- break;
- case XML_TOK_LITERAL:
- state->handler = declClose;
- return XML_ROLE_ENTITY_VALUE;
- }
- return common(state, tok);
-}
-
-static
-int entity8(PROLOG_STATE *state,
- int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
-{
- switch (tok) {
- case XML_TOK_PROLOG_S:
- return XML_ROLE_NONE;
- case XML_TOK_LITERAL:
- state->handler = entity9;
- return XML_ROLE_ENTITY_PUBLIC_ID;
- }
- return common(state, tok);
-}
-
-static
-int entity9(PROLOG_STATE *state,
- int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
-{
- switch (tok) {
- case XML_TOK_PROLOG_S:
- return XML_ROLE_NONE;
- case XML_TOK_LITERAL:
- state->handler = declClose;
- return XML_ROLE_ENTITY_SYSTEM_ID;
- }
- return common(state, tok);
-}
-
-static
-int notation0(PROLOG_STATE *state,
- int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
-{
- switch (tok) {
- case XML_TOK_PROLOG_S:
- return XML_ROLE_NONE;
- case XML_TOK_NAME:
- state->handler = notation1;
- return XML_ROLE_NOTATION_NAME;
- }
- return common(state, tok);
-}
-
-static
-int notation1(PROLOG_STATE *state,
- int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
-{
- switch (tok) {
- case XML_TOK_PROLOG_S:
- return XML_ROLE_NONE;
- case XML_TOK_NAME:
- if (XmlNameMatchesAscii(enc, ptr, end, KW_SYSTEM)) {
- state->handler = notation3;
- return XML_ROLE_NONE;
- }
- if (XmlNameMatchesAscii(enc, ptr, end, KW_PUBLIC)) {
- state->handler = notation2;
- return XML_ROLE_NONE;
- }
- break;
- }
- return common(state, tok);
-}
-
-static
-int notation2(PROLOG_STATE *state,
- int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
-{
- switch (tok) {
- case XML_TOK_PROLOG_S:
- return XML_ROLE_NONE;
- case XML_TOK_LITERAL:
- state->handler = notation4;
- return XML_ROLE_NOTATION_PUBLIC_ID;
- }
- return common(state, tok);
-}
-
-static
-int notation3(PROLOG_STATE *state,
- int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
-{
- switch (tok) {
- case XML_TOK_PROLOG_S:
- return XML_ROLE_NONE;
- case XML_TOK_LITERAL:
- state->handler = declClose;
- return XML_ROLE_NOTATION_SYSTEM_ID;
- }
- return common(state, tok);
-}
-
-static
-int notation4(PROLOG_STATE *state,
- int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
-{
- switch (tok) {
- case XML_TOK_PROLOG_S:
- return XML_ROLE_NONE;
- case XML_TOK_LITERAL:
- state->handler = declClose;
- return XML_ROLE_NOTATION_SYSTEM_ID;
- case XML_TOK_DECL_CLOSE:
- setTopLevel(state);
- return XML_ROLE_NOTATION_NO_SYSTEM_ID;
- }
- return common(state, tok);
-}
-
-static
-int attlist0(PROLOG_STATE *state,
- int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
-{
- switch (tok) {
- case XML_TOK_PROLOG_S:
- return XML_ROLE_NONE;
- case XML_TOK_NAME:
- case XML_TOK_PREFIXED_NAME:
- state->handler = attlist1;
- return XML_ROLE_ATTLIST_ELEMENT_NAME;
- }
- return common(state, tok);
-}
-
-static
-int attlist1(PROLOG_STATE *state,
- int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
-{
- switch (tok) {
- case XML_TOK_PROLOG_S:
- return XML_ROLE_NONE;
- case XML_TOK_DECL_CLOSE:
- setTopLevel(state);
- return XML_ROLE_NONE;
- case XML_TOK_NAME:
- case XML_TOK_PREFIXED_NAME:
- state->handler = attlist2;
- return XML_ROLE_ATTRIBUTE_NAME;
- }
- return common(state, tok);
-}
-
-static
-int attlist2(PROLOG_STATE *state,
- int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
-{
- switch (tok) {
- case XML_TOK_PROLOG_S:
- return XML_ROLE_NONE;
- case XML_TOK_NAME:
- {
- static const char *types[] = {
- KW_CDATA,
- KW_ID,
- KW_IDREF,
- KW_IDREFS,
- KW_ENTITY,
- KW_ENTITIES,
- KW_NMTOKEN,
- KW_NMTOKENS,
- };
- int i;
- for (i = 0; i < (int)(sizeof(types)/sizeof(types[0])); i++)
- if (XmlNameMatchesAscii(enc, ptr, end, types[i])) {
- state->handler = attlist8;
- return XML_ROLE_ATTRIBUTE_TYPE_CDATA + i;
- }
- }
- if (XmlNameMatchesAscii(enc, ptr, end, KW_NOTATION)) {
- state->handler = attlist5;
- return XML_ROLE_NONE;
- }
- break;
- case XML_TOK_OPEN_PAREN:
- state->handler = attlist3;
- return XML_ROLE_NONE;
- }
- return common(state, tok);
-}
-
-static
-int attlist3(PROLOG_STATE *state,
- int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
-{
- switch (tok) {
- case XML_TOK_PROLOG_S:
- return XML_ROLE_NONE;
- case XML_TOK_NMTOKEN:
- case XML_TOK_NAME:
- case XML_TOK_PREFIXED_NAME:
- state->handler = attlist4;
- return XML_ROLE_ATTRIBUTE_ENUM_VALUE;
- }
- return common(state, tok);
-}
-
-static
-int attlist4(PROLOG_STATE *state,
- int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
-{
- switch (tok) {
- case XML_TOK_PROLOG_S:
- return XML_ROLE_NONE;
- case XML_TOK_CLOSE_PAREN:
- state->handler = attlist8;
- return XML_ROLE_NONE;
- case XML_TOK_OR:
- state->handler = attlist3;
- return XML_ROLE_NONE;
- }
- return common(state, tok);
-}
-
-static
-int attlist5(PROLOG_STATE *state,
- int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
-{
- switch (tok) {
- case XML_TOK_PROLOG_S:
- return XML_ROLE_NONE;
- case XML_TOK_OPEN_PAREN:
- state->handler = attlist6;
- return XML_ROLE_NONE;
- }
- return common(state, tok);
-}
-
-
-static
-int attlist6(PROLOG_STATE *state,
- int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
-{
- switch (tok) {
- case XML_TOK_PROLOG_S:
- return XML_ROLE_NONE;
- case XML_TOK_NAME:
- state->handler = attlist7;
- return XML_ROLE_ATTRIBUTE_NOTATION_VALUE;
- }
- return common(state, tok);
-}
-
-static
-int attlist7(PROLOG_STATE *state,
- int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
-{
- switch (tok) {
- case XML_TOK_PROLOG_S:
- return XML_ROLE_NONE;
- case XML_TOK_CLOSE_PAREN:
- state->handler = attlist8;
- return XML_ROLE_NONE;
- case XML_TOK_OR:
- state->handler = attlist6;
- return XML_ROLE_NONE;
- }
- return common(state, tok);
-}
-
-/* default value */
-static
-int attlist8(PROLOG_STATE *state,
- int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
-{
- switch (tok) {
- case XML_TOK_PROLOG_S:
- return XML_ROLE_NONE;
- case XML_TOK_POUND_NAME:
- if (XmlNameMatchesAscii(enc,
- ptr + MIN_BYTES_PER_CHAR(enc),
- end,
- KW_IMPLIED)) {
- state->handler = attlist1;
- return XML_ROLE_IMPLIED_ATTRIBUTE_VALUE;
- }
- if (XmlNameMatchesAscii(enc,
- ptr + MIN_BYTES_PER_CHAR(enc),
- end,
- KW_REQUIRED)) {
- state->handler = attlist1;
- return XML_ROLE_REQUIRED_ATTRIBUTE_VALUE;
- }
- if (XmlNameMatchesAscii(enc,
- ptr + MIN_BYTES_PER_CHAR(enc),
- end,
- KW_FIXED)) {
- state->handler = attlist9;
- return XML_ROLE_NONE;
- }
- break;
- case XML_TOK_LITERAL:
- state->handler = attlist1;
- return XML_ROLE_DEFAULT_ATTRIBUTE_VALUE;
- }
- return common(state, tok);
-}
-
-static
-int attlist9(PROLOG_STATE *state,
- int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
-{
- switch (tok) {
- case XML_TOK_PROLOG_S:
- return XML_ROLE_NONE;
- case XML_TOK_LITERAL:
- state->handler = attlist1;
- return XML_ROLE_FIXED_ATTRIBUTE_VALUE;
- }
- return common(state, tok);
-}
-
-static
-int element0(PROLOG_STATE *state,
- int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
-{
- switch (tok) {
- case XML_TOK_PROLOG_S:
- return XML_ROLE_NONE;
- case XML_TOK_NAME:
- case XML_TOK_PREFIXED_NAME:
- state->handler = element1;
- return XML_ROLE_ELEMENT_NAME;
- }
- return common(state, tok);
-}
-
-static
-int element1(PROLOG_STATE *state,
- int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
-{
- switch (tok) {
- case XML_TOK_PROLOG_S:
- return XML_ROLE_NONE;
- case XML_TOK_NAME:
- if (XmlNameMatchesAscii(enc, ptr, end, KW_EMPTY)) {
- state->handler = declClose;
- return XML_ROLE_CONTENT_EMPTY;
- }
- if (XmlNameMatchesAscii(enc, ptr, end, KW_ANY)) {
- state->handler = declClose;
- return XML_ROLE_CONTENT_ANY;
- }
- break;
- case XML_TOK_OPEN_PAREN:
- state->handler = element2;
- state->level = 1;
- return XML_ROLE_GROUP_OPEN;
- }
- return common(state, tok);
-}
-
-static
-int element2(PROLOG_STATE *state,
- int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
-{
- switch (tok) {
- case XML_TOK_PROLOG_S:
- return XML_ROLE_NONE;
- case XML_TOK_POUND_NAME:
- if (XmlNameMatchesAscii(enc,
- ptr + MIN_BYTES_PER_CHAR(enc),
- end,
- KW_PCDATA)) {
- state->handler = element3;
- return XML_ROLE_CONTENT_PCDATA;
- }
- break;
- case XML_TOK_OPEN_PAREN:
- state->level = 2;
- state->handler = element6;
- return XML_ROLE_GROUP_OPEN;
- case XML_TOK_NAME:
- case XML_TOK_PREFIXED_NAME:
- state->handler = element7;
- return XML_ROLE_CONTENT_ELEMENT;
- case XML_TOK_NAME_QUESTION:
- state->handler = element7;
- return XML_ROLE_CONTENT_ELEMENT_OPT;
- case XML_TOK_NAME_ASTERISK:
- state->handler = element7;
- return XML_ROLE_CONTENT_ELEMENT_REP;
- case XML_TOK_NAME_PLUS:
- state->handler = element7;
- return XML_ROLE_CONTENT_ELEMENT_PLUS;
- }
- return common(state, tok);
-}
-
-static
-int element3(PROLOG_STATE *state,
- int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
-{
- switch (tok) {
- case XML_TOK_PROLOG_S:
- return XML_ROLE_NONE;
- case XML_TOK_CLOSE_PAREN:
- state->handler = declClose;
- return XML_ROLE_GROUP_CLOSE;
- case XML_TOK_CLOSE_PAREN_ASTERISK:
- state->handler = declClose;
- return XML_ROLE_GROUP_CLOSE_REP;
- case XML_TOK_OR:
- state->handler = element4;
- return XML_ROLE_NONE;
- }
- return common(state, tok);
-}
-
-static
-int element4(PROLOG_STATE *state,
- int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
-{
- switch (tok) {
- case XML_TOK_PROLOG_S:
- return XML_ROLE_NONE;
- case XML_TOK_NAME:
- case XML_TOK_PREFIXED_NAME:
- state->handler = element5;
- return XML_ROLE_CONTENT_ELEMENT;
- }
- return common(state, tok);
-}
-
-static
-int element5(PROLOG_STATE *state,
- int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
-{
- switch (tok) {
- case XML_TOK_PROLOG_S:
- return XML_ROLE_NONE;
- case XML_TOK_CLOSE_PAREN_ASTERISK:
- state->handler = declClose;
- return XML_ROLE_GROUP_CLOSE_REP;
- case XML_TOK_OR:
- state->handler = element4;
- return XML_ROLE_NONE;
- }
- return common(state, tok);
-}
-
-static
-int element6(PROLOG_STATE *state,
- int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
-{
- switch (tok) {
- case XML_TOK_PROLOG_S:
- return XML_ROLE_NONE;
- case XML_TOK_OPEN_PAREN:
- state->level += 1;
- return XML_ROLE_GROUP_OPEN;
- case XML_TOK_NAME:
- case XML_TOK_PREFIXED_NAME:
- state->handler = element7;
- return XML_ROLE_CONTENT_ELEMENT;
- case XML_TOK_NAME_QUESTION:
- state->handler = element7;
- return XML_ROLE_CONTENT_ELEMENT_OPT;
- case XML_TOK_NAME_ASTERISK:
- state->handler = element7;
- return XML_ROLE_CONTENT_ELEMENT_REP;
- case XML_TOK_NAME_PLUS:
- state->handler = element7;
- return XML_ROLE_CONTENT_ELEMENT_PLUS;
- }
- return common(state, tok);
-}
-
-static
-int element7(PROLOG_STATE *state,
- int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
-{
- switch (tok) {
- case XML_TOK_PROLOG_S:
- return XML_ROLE_NONE;
- case XML_TOK_CLOSE_PAREN:
- state->level -= 1;
- if (state->level == 0)
- state->handler = declClose;
- return XML_ROLE_GROUP_CLOSE;
- case XML_TOK_CLOSE_PAREN_ASTERISK:
- state->level -= 1;
- if (state->level == 0)
- state->handler = declClose;
- return XML_ROLE_GROUP_CLOSE_REP;
- case XML_TOK_CLOSE_PAREN_QUESTION:
- state->level -= 1;
- if (state->level == 0)
- state->handler = declClose;
- return XML_ROLE_GROUP_CLOSE_OPT;
- case XML_TOK_CLOSE_PAREN_PLUS:
- state->level -= 1;
- if (state->level == 0)
- state->handler = declClose;
- return XML_ROLE_GROUP_CLOSE_PLUS;
- case XML_TOK_COMMA:
- state->handler = element6;
- return XML_ROLE_GROUP_SEQUENCE;
- case XML_TOK_OR:
- state->handler = element6;
- return XML_ROLE_GROUP_CHOICE;
- }
- return common(state, tok);
-}
-
-#ifdef XML_DTD
-
-static
-int condSect0(PROLOG_STATE *state,
- int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
-{
- switch (tok) {
- case XML_TOK_PROLOG_S:
- return XML_ROLE_NONE;
- case XML_TOK_NAME:
- if (XmlNameMatchesAscii(enc, ptr, end, KW_INCLUDE)) {
- state->handler = condSect1;
- return XML_ROLE_NONE;
- }
- if (XmlNameMatchesAscii(enc, ptr, end, KW_IGNORE)) {
- state->handler = condSect2;
- return XML_ROLE_NONE;
- }
- break;
- }
- return common(state, tok);
-}
-
-static
-int condSect1(PROLOG_STATE *state,
- int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
-{
- switch (tok) {
- case XML_TOK_PROLOG_S:
- return XML_ROLE_NONE;
- case XML_TOK_OPEN_BRACKET:
- state->handler = externalSubset1;
- state->includeLevel += 1;
- return XML_ROLE_NONE;
- }
- return common(state, tok);
-}
-
-static
-int condSect2(PROLOG_STATE *state,
- int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
-{
- switch (tok) {
- case XML_TOK_PROLOG_S:
- return XML_ROLE_NONE;
- case XML_TOK_OPEN_BRACKET:
- state->handler = externalSubset1;
- return XML_ROLE_IGNORE_SECT;
- }
- return common(state, tok);
-}
-
-#endif /* XML_DTD */
-
-static
-int declClose(PROLOG_STATE *state,
- int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
-{
- switch (tok) {
- case XML_TOK_PROLOG_S:
- return XML_ROLE_NONE;
- case XML_TOK_DECL_CLOSE:
- setTopLevel(state);
- return XML_ROLE_NONE;
- }
- return common(state, tok);
-}
-
-#if 0
-
-static
-int ignore(PROLOG_STATE *state,
- int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
-{
- switch (tok) {
- case XML_TOK_DECL_CLOSE:
- state->handler = internalSubset;
- return 0;
- default:
- return XML_ROLE_NONE;
- }
- return common(state, tok);
-}
-#endif
-
-static
-int error(PROLOG_STATE *state,
- int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
-{
- return XML_ROLE_NONE;
-}
-
-static
-int common(PROLOG_STATE *state, int tok)
-{
-#ifdef XML_DTD
- if (!state->documentEntity && tok == XML_TOK_PARAM_ENTITY_REF)
- return XML_ROLE_INNER_PARAM_ENTITY_REF;
-#endif
- state->handler = error;
- return XML_ROLE_ERROR;
-}
-
-void XmlPrologStateInit(PROLOG_STATE *state)
-{
- state->handler = prolog0;
-#ifdef XML_DTD
- state->documentEntity = 1;
- state->includeLevel = 0;
-#endif /* XML_DTD */
-}
-
-#ifdef XML_DTD
-
-void XmlPrologStateInitExternalEntity(PROLOG_STATE *state)
-{
- state->handler = externalSubset0;
- state->documentEntity = 0;
- state->includeLevel = 0;
-}
-
-#endif /* XML_DTD */
diff --git a/ext/xml/expat/xmlrole.h b/ext/xml/expat/xmlrole.h
deleted file mode 100644
index db3ebc8484..0000000000
--- a/ext/xml/expat/xmlrole.h
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
-Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
-See the file COPYING for copying permission.
-*/
-
-#ifndef XmlRole_INCLUDED
-#define XmlRole_INCLUDED 1
-
-#include "xmltok.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-enum {
- XML_ROLE_ERROR = -1,
- XML_ROLE_NONE = 0,
- XML_ROLE_XML_DECL,
- XML_ROLE_INSTANCE_START,
- XML_ROLE_DOCTYPE_NAME,
- XML_ROLE_DOCTYPE_SYSTEM_ID,
- XML_ROLE_DOCTYPE_PUBLIC_ID,
- XML_ROLE_DOCTYPE_INTERNAL_SUBSET,
- XML_ROLE_DOCTYPE_CLOSE,
- XML_ROLE_GENERAL_ENTITY_NAME,
- XML_ROLE_PARAM_ENTITY_NAME,
- XML_ROLE_ENTITY_VALUE,
- XML_ROLE_ENTITY_SYSTEM_ID,
- XML_ROLE_ENTITY_PUBLIC_ID,
- XML_ROLE_ENTITY_COMPLETE,
- XML_ROLE_ENTITY_NOTATION_NAME,
- XML_ROLE_NOTATION_NAME,
- XML_ROLE_NOTATION_SYSTEM_ID,
- XML_ROLE_NOTATION_NO_SYSTEM_ID,
- XML_ROLE_NOTATION_PUBLIC_ID,
- XML_ROLE_ATTRIBUTE_NAME,
- XML_ROLE_ATTRIBUTE_TYPE_CDATA,
- XML_ROLE_ATTRIBUTE_TYPE_ID,
- XML_ROLE_ATTRIBUTE_TYPE_IDREF,
- XML_ROLE_ATTRIBUTE_TYPE_IDREFS,
- XML_ROLE_ATTRIBUTE_TYPE_ENTITY,
- XML_ROLE_ATTRIBUTE_TYPE_ENTITIES,
- XML_ROLE_ATTRIBUTE_TYPE_NMTOKEN,
- XML_ROLE_ATTRIBUTE_TYPE_NMTOKENS,
- XML_ROLE_ATTRIBUTE_ENUM_VALUE,
- XML_ROLE_ATTRIBUTE_NOTATION_VALUE,
- XML_ROLE_ATTLIST_ELEMENT_NAME,
- XML_ROLE_IMPLIED_ATTRIBUTE_VALUE,
- XML_ROLE_REQUIRED_ATTRIBUTE_VALUE,
- XML_ROLE_DEFAULT_ATTRIBUTE_VALUE,
- XML_ROLE_FIXED_ATTRIBUTE_VALUE,
- XML_ROLE_ELEMENT_NAME,
- XML_ROLE_CONTENT_ANY,
- XML_ROLE_CONTENT_EMPTY,
- XML_ROLE_CONTENT_PCDATA,
- XML_ROLE_GROUP_OPEN,
- XML_ROLE_GROUP_CLOSE,
- XML_ROLE_GROUP_CLOSE_REP,
- XML_ROLE_GROUP_CLOSE_OPT,
- XML_ROLE_GROUP_CLOSE_PLUS,
- XML_ROLE_GROUP_CHOICE,
- XML_ROLE_GROUP_SEQUENCE,
- XML_ROLE_CONTENT_ELEMENT,
- XML_ROLE_CONTENT_ELEMENT_REP,
- XML_ROLE_CONTENT_ELEMENT_OPT,
- XML_ROLE_CONTENT_ELEMENT_PLUS,
-#ifdef XML_DTD
- XML_ROLE_TEXT_DECL,
- XML_ROLE_IGNORE_SECT,
- XML_ROLE_INNER_PARAM_ENTITY_REF,
-#endif /* XML_DTD */
- XML_ROLE_PARAM_ENTITY_REF
-};
-
-typedef struct prolog_state {
- int (*handler)(struct prolog_state *state,
- int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc);
- unsigned level;
-#ifdef XML_DTD
- unsigned includeLevel;
- int documentEntity;
-#endif /* XML_DTD */
-} PROLOG_STATE;
-
-void XmlPrologStateInit(PROLOG_STATE *);
-#ifdef XML_DTD
-void XmlPrologStateInitExternalEntity(PROLOG_STATE *);
-#endif /* XML_DTD */
-
-#define XmlTokenRole(state, tok, ptr, end, enc) \
- (((state)->handler)(state, tok, ptr, end, enc))
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* not XmlRole_INCLUDED */
diff --git a/ext/xml/expat/xmltok.c b/ext/xml/expat/xmltok.c
deleted file mode 100644
index 700b5d1a01..0000000000
--- a/ext/xml/expat/xmltok.c
+++ /dev/null
@@ -1,1572 +0,0 @@
-/*
-Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
-See the file COPYING for copying permission.
-*/
-
-#if 0
-static char RCSId[]
- = "$Header$";
-#endif
-
-#include "php_compat.h"
-
-#ifdef COMPILED_FROM_DSP
-# include "winconfig.h"
-#else
-# include <php_config.h>
-#endif /* ndef COMPILED_FROM_DSP */
-
-#include "xmltok.h"
-#include "nametab.h"
-
-#ifdef XML_DTD
-#define IGNORE_SECTION_TOK_VTABLE , PREFIX(ignoreSectionTok)
-#else
-#define IGNORE_SECTION_TOK_VTABLE /* as nothing */
-#endif
-
-#define VTABLE1 \
- { PREFIX(prologTok), PREFIX(contentTok), \
- PREFIX(cdataSectionTok) IGNORE_SECTION_TOK_VTABLE }, \
- { PREFIX(attributeValueTok), PREFIX(entityValueTok) }, \
- PREFIX(sameName), \
- PREFIX(nameMatchesAscii), \
- PREFIX(nameLength), \
- PREFIX(skipS), \
- PREFIX(getAtts), \
- PREFIX(charRefNumber), \
- PREFIX(predefinedEntityName), \
- PREFIX(updatePosition), \
- PREFIX(isPublicId)
-
-#define VTABLE VTABLE1, PREFIX(toUtf8), PREFIX(toUtf16)
-
-#define UCS2_GET_NAMING(pages, hi, lo) \
- (namingBitmap[(pages[hi] << 3) + ((lo) >> 5)] & (1 << ((lo) & 0x1F)))
-
-/* A 2 byte UTF-8 representation splits the characters 11 bits
-between the bottom 5 and 6 bits of the bytes.
-We need 8 bits to index into pages, 3 bits to add to that index and
-5 bits to generate the mask. */
-#define UTF8_GET_NAMING2(pages, byte) \
- (namingBitmap[((pages)[(((byte)[0]) >> 2) & 7] << 3) \
- + ((((byte)[0]) & 3) << 1) \
- + ((((byte)[1]) >> 5) & 1)] \
- & (1 << (((byte)[1]) & 0x1F)))
-
-/* A 3 byte UTF-8 representation splits the characters 16 bits
-between the bottom 4, 6 and 6 bits of the bytes.
-We need 8 bits to index into pages, 3 bits to add to that index and
-5 bits to generate the mask. */
-#define UTF8_GET_NAMING3(pages, byte) \
- (namingBitmap[((pages)[((((byte)[0]) & 0xF) << 4) \
- + ((((byte)[1]) >> 2) & 0xF)] \
- << 3) \
- + ((((byte)[1]) & 3) << 1) \
- + ((((byte)[2]) >> 5) & 1)] \
- & (1 << (((byte)[2]) & 0x1F)))
-
-#define UTF8_GET_NAMING(pages, p, n) \
- ((n) == 2 \
- ? UTF8_GET_NAMING2(pages, (const unsigned char *)(p)) \
- : ((n) == 3 \
- ? UTF8_GET_NAMING3(pages, (const unsigned char *)(p)) \
- : 0))
-
-#define UTF8_INVALID3(p) \
- ((*p) == 0xED \
- ? (((p)[1] & 0x20) != 0) \
- : ((*p) == 0xEF \
- ? ((p)[1] == 0xBF && ((p)[2] == 0xBF || (p)[2] == 0xBE)) \
- : 0))
-
-#define UTF8_INVALID4(p) ((*p) == 0xF4 && ((p)[1] & 0x30) != 0)
-
-static
-int isNever(const ENCODING *enc, const char *p)
-{
- return 0;
-}
-
-static
-int utf8_isName2(const ENCODING *enc, const char *p)
-{
- return UTF8_GET_NAMING2(namePages, (const unsigned char *)p);
-}
-
-static
-int utf8_isName3(const ENCODING *enc, const char *p)
-{
- return UTF8_GET_NAMING3(namePages, (const unsigned char *)p);
-}
-
-#define utf8_isName4 isNever
-
-static
-int utf8_isNmstrt2(const ENCODING *enc, const char *p)
-{
- return UTF8_GET_NAMING2(nmstrtPages, (const unsigned char *)p);
-}
-
-static
-int utf8_isNmstrt3(const ENCODING *enc, const char *p)
-{
- return UTF8_GET_NAMING3(nmstrtPages, (const unsigned char *)p);
-}
-
-#define utf8_isNmstrt4 isNever
-
-#define utf8_isInvalid2 isNever
-
-static
-int utf8_isInvalid3(const ENCODING *enc, const char *p)
-{
- return UTF8_INVALID3((const unsigned char *)p);
-}
-
-static
-int utf8_isInvalid4(const ENCODING *enc, const char *p)
-{
- return UTF8_INVALID4((const unsigned char *)p);
-}
-
-struct normal_encoding {
- ENCODING enc;
- unsigned char type[256];
-#ifdef XML_MIN_SIZE
- int (*byteType)(const ENCODING *, const char *);
- int (*isNameMin)(const ENCODING *, const char *);
- int (*isNmstrtMin)(const ENCODING *, const char *);
- int (*byteToAscii)(const ENCODING *, const char *);
- int (*charMatches)(const ENCODING *, const char *, int);
-#endif /* XML_MIN_SIZE */
- int (*isName2)(const ENCODING *, const char *);
- int (*isName3)(const ENCODING *, const char *);
- int (*isName4)(const ENCODING *, const char *);
- int (*isNmstrt2)(const ENCODING *, const char *);
- int (*isNmstrt3)(const ENCODING *, const char *);
- int (*isNmstrt4)(const ENCODING *, const char *);
- int (*isInvalid2)(const ENCODING *, const char *);
- int (*isInvalid3)(const ENCODING *, const char *);
- int (*isInvalid4)(const ENCODING *, const char *);
-};
-
-#ifdef XML_MIN_SIZE
-
-#define STANDARD_VTABLE(E) \
- E ## byteType, \
- E ## isNameMin, \
- E ## isNmstrtMin, \
- E ## byteToAscii, \
- E ## charMatches,
-
-#else
-
-#define STANDARD_VTABLE(E) /* as nothing */
-
-#endif
-
-#define NORMAL_VTABLE(E) \
- E ## isName2, \
- E ## isName3, \
- E ## isName4, \
- E ## isNmstrt2, \
- E ## isNmstrt3, \
- E ## isNmstrt4, \
- E ## isInvalid2, \
- E ## isInvalid3, \
- E ## isInvalid4
-
-static int checkCharRefNumber(int);
-
-#include "xmltok_impl.h"
-#include "ascii.h"
-
-#ifdef XML_MIN_SIZE
-#define sb_isNameMin isNever
-#define sb_isNmstrtMin isNever
-#endif
-
-#ifdef XML_MIN_SIZE
-#define MINBPC(enc) ((enc)->minBytesPerChar)
-#else
-/* minimum bytes per character */
-#define MINBPC(enc) 1
-#endif
-
-#define SB_BYTE_TYPE(enc, p) \
- (((struct normal_encoding *)(enc))->type[(unsigned char)*(p)])
-
-#ifdef XML_MIN_SIZE
-static
-int sb_byteType(const ENCODING *enc, const char *p)
-{
- return SB_BYTE_TYPE(enc, p);
-}
-#define BYTE_TYPE(enc, p) \
- (((const struct normal_encoding *)(enc))->byteType(enc, p))
-#else
-#define BYTE_TYPE(enc, p) SB_BYTE_TYPE(enc, p)
-#endif
-
-#ifdef XML_MIN_SIZE
-#define BYTE_TO_ASCII(enc, p) \
- (((const struct normal_encoding *)(enc))->byteToAscii(enc, p))
-static
-int sb_byteToAscii(const ENCODING *enc, const char *p)
-{
- return *p;
-}
-#else
-#define BYTE_TO_ASCII(enc, p) (*(p))
-#endif
-
-#define IS_NAME_CHAR(enc, p, n) \
- (((const struct normal_encoding *)(enc))->isName ## n(enc, p))
-#define IS_NMSTRT_CHAR(enc, p, n) \
- (((const struct normal_encoding *)(enc))->isNmstrt ## n(enc, p))
-#define IS_INVALID_CHAR(enc, p, n) \
- (((const struct normal_encoding *)(enc))->isInvalid ## n(enc, p))
-
-#ifdef XML_MIN_SIZE
-#define IS_NAME_CHAR_MINBPC(enc, p) \
- (((const struct normal_encoding *)(enc))->isNameMin(enc, p))
-#define IS_NMSTRT_CHAR_MINBPC(enc, p) \
- (((const struct normal_encoding *)(enc))->isNmstrtMin(enc, p))
-#else
-#define IS_NAME_CHAR_MINBPC(enc, p) (0)
-#define IS_NMSTRT_CHAR_MINBPC(enc, p) (0)
-#endif
-
-#ifdef XML_MIN_SIZE
-#define CHAR_MATCHES(enc, p, c) \
- (((const struct normal_encoding *)(enc))->charMatches(enc, p, c))
-static
-int sb_charMatches(const ENCODING *enc, const char *p, int c)
-{
- return *p == c;
-}
-#else
-/* c is an ASCII character */
-#define CHAR_MATCHES(enc, p, c) (*(p) == c)
-#endif
-
-#define PREFIX(ident) normal_ ## ident
-#include "xmltok_impl.c"
-
-#undef MINBPC
-#undef BYTE_TYPE
-#undef BYTE_TO_ASCII
-#undef CHAR_MATCHES
-#undef IS_NAME_CHAR
-#undef IS_NAME_CHAR_MINBPC
-#undef IS_NMSTRT_CHAR
-#undef IS_NMSTRT_CHAR_MINBPC
-#undef IS_INVALID_CHAR
-
-enum { /* UTF8_cvalN is value of masked first byte of N byte sequence */
- UTF8_cval1 = 0x00,
- UTF8_cval2 = 0xc0,
- UTF8_cval3 = 0xe0,
- UTF8_cval4 = 0xf0
-};
-
-static
-void utf8_toUtf8(const ENCODING *enc,
- const char **fromP, const char *fromLim,
- char **toP, const char *toLim)
-{
- char *to;
- const char *from;
- if (fromLim - *fromP > toLim - *toP) {
- /* Avoid copying partial characters. */
- for (fromLim = *fromP + (toLim - *toP); fromLim > *fromP; fromLim--)
- if (((unsigned char)fromLim[-1] & 0xc0) != 0x80)
- break;
- }
- for (to = *toP, from = *fromP; from != fromLim; from++, to++)
- *to = *from;
- *fromP = from;
- *toP = to;
-}
-
-static
-void utf8_toUtf16(const ENCODING *enc,
- const char **fromP, const char *fromLim,
- unsigned short **toP, const unsigned short *toLim)
-{
- unsigned short *to = *toP;
- const char *from = *fromP;
- while (from != fromLim && to != toLim) {
- switch (((struct normal_encoding *)enc)->type[(unsigned char)*from]) {
- case BT_LEAD2:
- *to++ = ((from[0] & 0x1f) << 6) | (from[1] & 0x3f);
- from += 2;
- break;
- case BT_LEAD3:
- *to++ = ((from[0] & 0xf) << 12) | ((from[1] & 0x3f) << 6) | (from[2] & 0x3f);
- from += 3;
- break;
- case BT_LEAD4:
- {
- unsigned long n;
- if (to + 1 == toLim)
- break;
- n = ((from[0] & 0x7) << 18) | ((from[1] & 0x3f) << 12) | ((from[2] & 0x3f) << 6) | (from[3] & 0x3f);
- n -= 0x10000;
- to[0] = (unsigned short)((n >> 10) | 0xD800);
- to[1] = (unsigned short)((n & 0x3FF) | 0xDC00);
- to += 2;
- from += 4;
- }
- break;
- default:
- *to++ = *from++;
- break;
- }
- }
- *fromP = from;
- *toP = to;
-}
-
-#ifdef XML_NS
-static const struct normal_encoding utf8_encoding_ns = {
- { VTABLE1, utf8_toUtf8, utf8_toUtf16, 1, 1, 0 },
- {
-#include "asciitab.h"
-#include "utf8tab.h"
- },
- STANDARD_VTABLE(sb_) NORMAL_VTABLE(utf8_)
-};
-#endif
-
-static const struct normal_encoding utf8_encoding = {
- { VTABLE1, utf8_toUtf8, utf8_toUtf16, 1, 1, 0 },
- {
-#define BT_COLON BT_NMSTRT
-#include "asciitab.h"
-#undef BT_COLON
-#include "utf8tab.h"
- },
- STANDARD_VTABLE(sb_) NORMAL_VTABLE(utf8_)
-};
-
-#ifdef XML_NS
-
-static const struct normal_encoding internal_utf8_encoding_ns = {
- { VTABLE1, utf8_toUtf8, utf8_toUtf16, 1, 1, 0 },
- {
-#include "iasciitab.h"
-#include "utf8tab.h"
- },
- STANDARD_VTABLE(sb_) NORMAL_VTABLE(utf8_)
-};
-
-#endif
-
-static const struct normal_encoding internal_utf8_encoding = {
- { VTABLE1, utf8_toUtf8, utf8_toUtf16, 1, 1, 0 },
- {
-#define BT_COLON BT_NMSTRT
-#include "iasciitab.h"
-#undef BT_COLON
-#include "utf8tab.h"
- },
- STANDARD_VTABLE(sb_) NORMAL_VTABLE(utf8_)
-};
-
-static
-void latin1_toUtf8(const ENCODING *enc,
- const char **fromP, const char *fromLim,
- char **toP, const char *toLim)
-{
- for (;;) {
- unsigned char c;
- if (*fromP == fromLim)
- break;
- c = (unsigned char)**fromP;
- if (c & 0x80) {
- if (toLim - *toP < 2)
- break;
- *(*toP)++ = ((c >> 6) | UTF8_cval2);
- *(*toP)++ = ((c & 0x3f) | 0x80);
- (*fromP)++;
- }
- else {
- if (*toP == toLim)
- break;
- *(*toP)++ = *(*fromP)++;
- }
- }
-}
-
-static
-void latin1_toUtf16(const ENCODING *enc,
- const char **fromP, const char *fromLim,
- unsigned short **toP, const unsigned short *toLim)
-{
- while (*fromP != fromLim && *toP != toLim)
- *(*toP)++ = (unsigned char)*(*fromP)++;
-}
-
-#ifdef XML_NS
-
-static const struct normal_encoding latin1_encoding_ns = {
- { VTABLE1, latin1_toUtf8, latin1_toUtf16, 1, 0, 0 },
- {
-#include "asciitab.h"
-#include "latin1tab.h"
- },
- STANDARD_VTABLE(sb_)
-};
-
-#endif
-
-static const struct normal_encoding latin1_encoding = {
- { VTABLE1, latin1_toUtf8, latin1_toUtf16, 1, 0, 0 },
- {
-#define BT_COLON BT_NMSTRT
-#include "asciitab.h"
-#undef BT_COLON
-#include "latin1tab.h"
- },
- STANDARD_VTABLE(sb_)
-};
-
-static
-void ascii_toUtf8(const ENCODING *enc,
- const char **fromP, const char *fromLim,
- char **toP, const char *toLim)
-{
- while (*fromP != fromLim && *toP != toLim)
- *(*toP)++ = *(*fromP)++;
-}
-
-#ifdef XML_NS
-
-static const struct normal_encoding ascii_encoding_ns = {
- { VTABLE1, ascii_toUtf8, latin1_toUtf16, 1, 1, 0 },
- {
-#include "asciitab.h"
-/* BT_NONXML == 0 */
- },
- STANDARD_VTABLE(sb_)
-};
-
-#endif
-
-static const struct normal_encoding ascii_encoding = {
- { VTABLE1, ascii_toUtf8, latin1_toUtf16, 1, 1, 0 },
- {
-#define BT_COLON BT_NMSTRT
-#include "asciitab.h"
-#undef BT_COLON
-/* BT_NONXML == 0 */
- },
- STANDARD_VTABLE(sb_)
-};
-
-static int unicode_byte_type(char hi, char lo)
-{
- switch ((unsigned char)hi) {
- case 0xD8: case 0xD9: case 0xDA: case 0xDB:
- return BT_LEAD4;
- case 0xDC: case 0xDD: case 0xDE: case 0xDF:
- return BT_TRAIL;
- case 0xFF:
- switch ((unsigned char)lo) {
- case 0xFF:
- case 0xFE:
- return BT_NONXML;
- }
- break;
- }
- return BT_NONASCII;
-}
-
-#define DEFINE_UTF16_TO_UTF8(E) \
-static \
-void E ## toUtf8(const ENCODING *enc, \
- const char **fromP, const char *fromLim, \
- char **toP, const char *toLim) \
-{ \
- const char *from; \
- for (from = *fromP; from != fromLim; from += 2) { \
- int plane; \
- unsigned char lo2; \
- unsigned char lo = GET_LO(from); \
- unsigned char hi = GET_HI(from); \
- switch (hi) { \
- case 0: \
- if (lo < 0x80) { \
- if (*toP == toLim) { \
- *fromP = from; \
- return; \
- } \
- *(*toP)++ = lo; \
- break; \
- } \
- /* fall through */ \
- case 0x1: case 0x2: case 0x3: \
- case 0x4: case 0x5: case 0x6: case 0x7: \
- if (toLim - *toP < 2) { \
- *fromP = from; \
- return; \
- } \
- *(*toP)++ = ((lo >> 6) | (hi << 2) | UTF8_cval2); \
- *(*toP)++ = ((lo & 0x3f) | 0x80); \
- break; \
- default: \
- if (toLim - *toP < 3) { \
- *fromP = from; \
- return; \
- } \
- /* 16 bits divided 4, 6, 6 amongst 3 bytes */ \
- *(*toP)++ = ((hi >> 4) | UTF8_cval3); \
- *(*toP)++ = (((hi & 0xf) << 2) | (lo >> 6) | 0x80); \
- *(*toP)++ = ((lo & 0x3f) | 0x80); \
- break; \
- case 0xD8: case 0xD9: case 0xDA: case 0xDB: \
- if (toLim - *toP < 4) { \
- *fromP = from; \
- return; \
- } \
- plane = (((hi & 0x3) << 2) | ((lo >> 6) & 0x3)) + 1; \
- *(*toP)++ = ((plane >> 2) | UTF8_cval4); \
- *(*toP)++ = (((lo >> 2) & 0xF) | ((plane & 0x3) << 4) | 0x80); \
- from += 2; \
- lo2 = GET_LO(from); \
- *(*toP)++ = (((lo & 0x3) << 4) \
- | ((GET_HI(from) & 0x3) << 2) \
- | (lo2 >> 6) \
- | 0x80); \
- *(*toP)++ = ((lo2 & 0x3f) | 0x80); \
- break; \
- } \
- } \
- *fromP = from; \
-}
-
-#define DEFINE_UTF16_TO_UTF16(E) \
-static \
-void E ## toUtf16(const ENCODING *enc, \
- const char **fromP, const char *fromLim, \
- unsigned short **toP, const unsigned short *toLim) \
-{ \
- /* Avoid copying first half only of surrogate */ \
- if (fromLim - *fromP > ((toLim - *toP) << 1) \
- && (GET_HI(fromLim - 2) & 0xF8) == 0xD8) \
- fromLim -= 2; \
- for (; *fromP != fromLim && *toP != toLim; *fromP += 2) \
- *(*toP)++ = (GET_HI(*fromP) << 8) | GET_LO(*fromP); \
-}
-
-#define SET2(ptr, ch) \
- (((ptr)[0] = ((ch) & 0xff)), ((ptr)[1] = ((ch) >> 8)))
-#define GET_LO(ptr) ((unsigned char)(ptr)[0])
-#define GET_HI(ptr) ((unsigned char)(ptr)[1])
-
-DEFINE_UTF16_TO_UTF8(little2_)
-DEFINE_UTF16_TO_UTF16(little2_)
-
-#undef SET2
-#undef GET_LO
-#undef GET_HI
-
-#define SET2(ptr, ch) \
- (((ptr)[0] = ((ch) >> 8)), ((ptr)[1] = ((ch) & 0xFF)))
-#define GET_LO(ptr) ((unsigned char)(ptr)[1])
-#define GET_HI(ptr) ((unsigned char)(ptr)[0])
-
-DEFINE_UTF16_TO_UTF8(big2_)
-DEFINE_UTF16_TO_UTF16(big2_)
-
-#undef SET2
-#undef GET_LO
-#undef GET_HI
-
-#define LITTLE2_BYTE_TYPE(enc, p) \
- ((p)[1] == 0 \
- ? ((struct normal_encoding *)(enc))->type[(unsigned char)*(p)] \
- : unicode_byte_type((p)[1], (p)[0]))
-#define LITTLE2_BYTE_TO_ASCII(enc, p) ((p)[1] == 0 ? (p)[0] : -1)
-#define LITTLE2_CHAR_MATCHES(enc, p, c) ((p)[1] == 0 && (p)[0] == c)
-#define LITTLE2_IS_NAME_CHAR_MINBPC(enc, p) \
- UCS2_GET_NAMING(namePages, (unsigned char)p[1], (unsigned char)p[0])
-#define LITTLE2_IS_NMSTRT_CHAR_MINBPC(enc, p) \
- UCS2_GET_NAMING(nmstrtPages, (unsigned char)p[1], (unsigned char)p[0])
-
-#ifdef XML_MIN_SIZE
-
-static
-int little2_byteType(const ENCODING *enc, const char *p)
-{
- return LITTLE2_BYTE_TYPE(enc, p);
-}
-
-static
-int little2_byteToAscii(const ENCODING *enc, const char *p)
-{
- return LITTLE2_BYTE_TO_ASCII(enc, p);
-}
-
-static
-int little2_charMatches(const ENCODING *enc, const char *p, int c)
-{
- return LITTLE2_CHAR_MATCHES(enc, p, c);
-}
-
-static
-int little2_isNameMin(const ENCODING *enc, const char *p)
-{
- return LITTLE2_IS_NAME_CHAR_MINBPC(enc, p);
-}
-
-static
-int little2_isNmstrtMin(const ENCODING *enc, const char *p)
-{
- return LITTLE2_IS_NMSTRT_CHAR_MINBPC(enc, p);
-}
-
-#undef VTABLE
-#define VTABLE VTABLE1, little2_toUtf8, little2_toUtf16
-
-#else /* not XML_MIN_SIZE */
-
-#undef PREFIX
-#define PREFIX(ident) little2_ ## ident
-#define MINBPC(enc) 2
-/* CHAR_MATCHES is guaranteed to have MINBPC bytes available. */
-#define BYTE_TYPE(enc, p) LITTLE2_BYTE_TYPE(enc, p)
-#define BYTE_TO_ASCII(enc, p) LITTLE2_BYTE_TO_ASCII(enc, p)
-#define CHAR_MATCHES(enc, p, c) LITTLE2_CHAR_MATCHES(enc, p, c)
-#define IS_NAME_CHAR(enc, p, n) 0
-#define IS_NAME_CHAR_MINBPC(enc, p) LITTLE2_IS_NAME_CHAR_MINBPC(enc, p)
-#define IS_NMSTRT_CHAR(enc, p, n) (0)
-#define IS_NMSTRT_CHAR_MINBPC(enc, p) LITTLE2_IS_NMSTRT_CHAR_MINBPC(enc, p)
-
-#include "xmltok_impl.c"
-
-#undef MINBPC
-#undef BYTE_TYPE
-#undef BYTE_TO_ASCII
-#undef CHAR_MATCHES
-#undef IS_NAME_CHAR
-#undef IS_NAME_CHAR_MINBPC
-#undef IS_NMSTRT_CHAR
-#undef IS_NMSTRT_CHAR_MINBPC
-#undef IS_INVALID_CHAR
-
-#endif /* not XML_MIN_SIZE */
-
-#ifdef XML_NS
-
-static const struct normal_encoding little2_encoding_ns = {
- { VTABLE, 2, 0,
-#if XML_BYTE_ORDER == 12
- 1
-#else
- 0
-#endif
- },
- {
-#include "asciitab.h"
-#include "latin1tab.h"
- },
- STANDARD_VTABLE(little2_)
-};
-
-#endif
-
-static const struct normal_encoding little2_encoding = {
- { VTABLE, 2, 0,
-#if XML_BYTE_ORDER == 12
- 1
-#else
- 0
-#endif
- },
- {
-#define BT_COLON BT_NMSTRT
-#include "asciitab.h"
-#undef BT_COLON
-#include "latin1tab.h"
- },
- STANDARD_VTABLE(little2_)
-};
-
-#if XML_BYTE_ORDER != 21
-
-#ifdef XML_NS
-
-static const struct normal_encoding internal_little2_encoding_ns = {
- { VTABLE, 2, 0, 1 },
- {
-#include "iasciitab.h"
-#include "latin1tab.h"
- },
- STANDARD_VTABLE(little2_)
-};
-
-#endif
-
-static const struct normal_encoding internal_little2_encoding = {
- { VTABLE, 2, 0, 1 },
- {
-#define BT_COLON BT_NMSTRT
-#include "iasciitab.h"
-#undef BT_COLON
-#include "latin1tab.h"
- },
- STANDARD_VTABLE(little2_)
-};
-
-#endif
-
-
-#define BIG2_BYTE_TYPE(enc, p) \
- ((p)[0] == 0 \
- ? ((struct normal_encoding *)(enc))->type[(unsigned char)(p)[1]] \
- : unicode_byte_type((p)[0], (p)[1]))
-#define BIG2_BYTE_TO_ASCII(enc, p) ((p)[0] == 0 ? (p)[1] : -1)
-#define BIG2_CHAR_MATCHES(enc, p, c) ((p)[0] == 0 && (p)[1] == c)
-#define BIG2_IS_NAME_CHAR_MINBPC(enc, p) \
- UCS2_GET_NAMING(namePages, (unsigned char)p[0], (unsigned char)p[1])
-#define BIG2_IS_NMSTRT_CHAR_MINBPC(enc, p) \
- UCS2_GET_NAMING(nmstrtPages, (unsigned char)p[0], (unsigned char)p[1])
-
-#ifdef XML_MIN_SIZE
-
-static
-int big2_byteType(const ENCODING *enc, const char *p)
-{
- return BIG2_BYTE_TYPE(enc, p);
-}
-
-static
-int big2_byteToAscii(const ENCODING *enc, const char *p)
-{
- return BIG2_BYTE_TO_ASCII(enc, p);
-}
-
-static
-int big2_charMatches(const ENCODING *enc, const char *p, int c)
-{
- return BIG2_CHAR_MATCHES(enc, p, c);
-}
-
-static
-int big2_isNameMin(const ENCODING *enc, const char *p)
-{
- return BIG2_IS_NAME_CHAR_MINBPC(enc, p);
-}
-
-static
-int big2_isNmstrtMin(const ENCODING *enc, const char *p)
-{
- return BIG2_IS_NMSTRT_CHAR_MINBPC(enc, p);
-}
-
-#undef VTABLE
-#define VTABLE VTABLE1, big2_toUtf8, big2_toUtf16
-
-#else /* not XML_MIN_SIZE */
-
-#undef PREFIX
-#define PREFIX(ident) big2_ ## ident
-#define MINBPC(enc) 2
-/* CHAR_MATCHES is guaranteed to have MINBPC bytes available. */
-#define BYTE_TYPE(enc, p) BIG2_BYTE_TYPE(enc, p)
-#define BYTE_TO_ASCII(enc, p) BIG2_BYTE_TO_ASCII(enc, p)
-#define CHAR_MATCHES(enc, p, c) BIG2_CHAR_MATCHES(enc, p, c)
-#define IS_NAME_CHAR(enc, p, n) 0
-#define IS_NAME_CHAR_MINBPC(enc, p) BIG2_IS_NAME_CHAR_MINBPC(enc, p)
-#define IS_NMSTRT_CHAR(enc, p, n) (0)
-#define IS_NMSTRT_CHAR_MINBPC(enc, p) BIG2_IS_NMSTRT_CHAR_MINBPC(enc, p)
-
-#include "xmltok_impl.c"
-
-#undef MINBPC
-#undef BYTE_TYPE
-#undef BYTE_TO_ASCII
-#undef CHAR_MATCHES
-#undef IS_NAME_CHAR
-#undef IS_NAME_CHAR_MINBPC
-#undef IS_NMSTRT_CHAR
-#undef IS_NMSTRT_CHAR_MINBPC
-#undef IS_INVALID_CHAR
-
-#endif /* not XML_MIN_SIZE */
-
-#ifdef XML_NS
-
-static const struct normal_encoding big2_encoding_ns = {
- { VTABLE, 2, 0,
-#if XML_BYTE_ORDER == 21
- 1
-#else
- 0
-#endif
- },
- {
-#include "asciitab.h"
-#include "latin1tab.h"
- },
- STANDARD_VTABLE(big2_)
-};
-
-#endif
-
-static const struct normal_encoding big2_encoding = {
- { VTABLE, 2, 0,
-#if XML_BYTE_ORDER == 21
- 1
-#else
- 0
-#endif
- },
- {
-#define BT_COLON BT_NMSTRT
-#include "asciitab.h"
-#undef BT_COLON
-#include "latin1tab.h"
- },
- STANDARD_VTABLE(big2_)
-};
-
-#if XML_BYTE_ORDER != 12
-
-#ifdef XML_NS
-
-static const struct normal_encoding internal_big2_encoding_ns = {
- { VTABLE, 2, 0, 1 },
- {
-#include "iasciitab.h"
-#include "latin1tab.h"
- },
- STANDARD_VTABLE(big2_)
-};
-
-#endif
-
-static const struct normal_encoding internal_big2_encoding = {
- { VTABLE, 2, 0, 1 },
- {
-#define BT_COLON BT_NMSTRT
-#include "iasciitab.h"
-#undef BT_COLON
-#include "latin1tab.h"
- },
- STANDARD_VTABLE(big2_)
-};
-
-#endif
-
-#undef PREFIX
-
-static
-int streqci(const char *s1, const char *s2)
-{
- for (;;) {
- char c1 = *s1++;
- char c2 = *s2++;
- if (ASCII_a <= c1 && c1 <= ASCII_z)
- c1 += ASCII_A - ASCII_a;
- if (ASCII_a <= c2 && c2 <= ASCII_z)
- c2 += ASCII_A - ASCII_a;
- if (c1 != c2)
- return 0;
- if (!c1)
- break;
- }
- return 1;
-}
-
-static
-void initUpdatePosition(const ENCODING *enc, const char *ptr,
- const char *end, POSITION *pos)
-{
- normal_updatePosition(&utf8_encoding.enc, ptr, end, pos);
-}
-
-static
-int toAscii(const ENCODING *enc, const char *ptr, const char *end)
-{
- char buf[1];
- char *p = buf;
- XmlUtf8Convert(enc, &ptr, end, &p, p + 1);
- if (p == buf)
- return -1;
- else
- return buf[0];
-}
-
-static
-int isSpace(int c)
-{
- switch (c) {
- case 0x20:
- case 0xD:
- case 0xA:
- case 0x9:
- return 1;
- }
- return 0;
-}
-
-/* Return 1 if there's just optional white space
-or there's an S followed by name=val. */
-static
-int parsePseudoAttribute(const ENCODING *enc,
- const char *ptr,
- const char *end,
- const char **namePtr,
- const char **nameEndPtr,
- const char **valPtr,
- const char **nextTokPtr)
-{
- int c;
- char open;
- if (ptr == end) {
- *namePtr = 0;
- return 1;
- }
- if (!isSpace(toAscii(enc, ptr, end))) {
- *nextTokPtr = ptr;
- return 0;
- }
- do {
- ptr += enc->minBytesPerChar;
- } while (isSpace(toAscii(enc, ptr, end)));
- if (ptr == end) {
- *namePtr = 0;
- return 1;
- }
- *namePtr = ptr;
- for (;;) {
- c = toAscii(enc, ptr, end);
- if (c == -1) {
- *nextTokPtr = ptr;
- return 0;
- }
- if (c == ASCII_EQUALS) {
- *nameEndPtr = ptr;
- break;
- }
- if (isSpace(c)) {
- *nameEndPtr = ptr;
- do {
- ptr += enc->minBytesPerChar;
- } while (isSpace(c = toAscii(enc, ptr, end)));
- if (c != ASCII_EQUALS) {
- *nextTokPtr = ptr;
- return 0;
- }
- break;
- }
- ptr += enc->minBytesPerChar;
- }
- if (ptr == *namePtr) {
- *nextTokPtr = ptr;
- return 0;
- }
- ptr += enc->minBytesPerChar;
- c = toAscii(enc, ptr, end);
- while (isSpace(c)) {
- ptr += enc->minBytesPerChar;
- c = toAscii(enc, ptr, end);
- }
- if (c != ASCII_QUOT && c != ASCII_APOS) {
- *nextTokPtr = ptr;
- return 0;
- }
- open = c;
- ptr += enc->minBytesPerChar;
- *valPtr = ptr;
- for (;; ptr += enc->minBytesPerChar) {
- c = toAscii(enc, ptr, end);
- if (c == open)
- break;
- if (!(ASCII_a <= c && c <= ASCII_z)
- && !(ASCII_A <= c && c <= ASCII_Z)
- && !(ASCII_0 <= c && c <= ASCII_9)
- && c != ASCII_PERIOD
- && c != ASCII_MINUS
- && c != ASCII_UNDERSCORE) {
- *nextTokPtr = ptr;
- return 0;
- }
- }
- *nextTokPtr = ptr + enc->minBytesPerChar;
- return 1;
-}
-
-static const char KW_version[] = {
- ASCII_v, ASCII_e, ASCII_r, ASCII_s, ASCII_i, ASCII_o, ASCII_n, '\0'
-};
-
-static const char KW_encoding[] = {
- ASCII_e, ASCII_n, ASCII_c, ASCII_o, ASCII_d, ASCII_i, ASCII_n, ASCII_g, '\0'
-};
-
-static const char KW_standalone[] = {
- ASCII_s, ASCII_t, ASCII_a, ASCII_n, ASCII_d, ASCII_a, ASCII_l, ASCII_o, ASCII_n, ASCII_e, '\0'
-};
-
-static const char KW_yes[] = {
- ASCII_y, ASCII_e, ASCII_s, '\0'
-};
-
-static const char KW_no[] = {
- ASCII_n, ASCII_o, '\0'
-};
-
-static
-int doParseXmlDecl(const ENCODING *(*encodingFinder)(const ENCODING *,
- const char *,
- const char *),
- int isGeneralTextEntity,
- const ENCODING *enc,
- const char *ptr,
- const char *end,
- const char **badPtr,
- const char **versionPtr,
- const char **versionEndPtr,
- const char **encodingName,
- const ENCODING **encoding,
- int *standalone)
-{
- const char *val = 0;
- const char *name = 0;
- const char *nameEnd = 0;
- ptr += 5 * enc->minBytesPerChar;
- end -= 2 * enc->minBytesPerChar;
- if (!parsePseudoAttribute(enc, ptr, end, &name, &nameEnd, &val, &ptr) || !name) {
- *badPtr = ptr;
- return 0;
- }
- if (!XmlNameMatchesAscii(enc, name, nameEnd, KW_version)) {
- if (!isGeneralTextEntity) {
- *badPtr = name;
- return 0;
- }
- }
- else {
- if (versionPtr)
- *versionPtr = val;
- if (versionEndPtr)
- *versionEndPtr = ptr;
- if (!parsePseudoAttribute(enc, ptr, end, &name, &nameEnd, &val, &ptr)) {
- *badPtr = ptr;
- return 0;
- }
- if (!name) {
- if (isGeneralTextEntity) {
- /* a TextDecl must have an EncodingDecl */
- *badPtr = ptr;
- return 0;
- }
- return 1;
- }
- }
- if (XmlNameMatchesAscii(enc, name, nameEnd, KW_encoding)) {
- int c = toAscii(enc, val, end);
- if (!(ASCII_a <= c && c <= ASCII_z) && !(ASCII_A <= c && c <= ASCII_Z)) {
- *badPtr = val;
- return 0;
- }
- if (encodingName)
- *encodingName = val;
- if (encoding)
- *encoding = encodingFinder(enc, val, ptr - enc->minBytesPerChar);
- if (!parsePseudoAttribute(enc, ptr, end, &name, &nameEnd, &val, &ptr)) {
- *badPtr = ptr;
- return 0;
- }
- if (!name)
- return 1;
- }
- if (!XmlNameMatchesAscii(enc, name, nameEnd, KW_standalone) || isGeneralTextEntity) {
- *badPtr = name;
- return 0;
- }
- if (XmlNameMatchesAscii(enc, val, ptr - enc->minBytesPerChar, KW_yes)) {
- if (standalone)
- *standalone = 1;
- }
- else if (XmlNameMatchesAscii(enc, val, ptr - enc->minBytesPerChar, KW_no)) {
- if (standalone)
- *standalone = 0;
- }
- else {
- *badPtr = val;
- return 0;
- }
- while (isSpace(toAscii(enc, ptr, end)))
- ptr += enc->minBytesPerChar;
- if (ptr != end) {
- *badPtr = ptr;
- return 0;
- }
- return 1;
-}
-
-static
-int checkCharRefNumber(int result)
-{
- switch (result >> 8) {
- case 0xD8: case 0xD9: case 0xDA: case 0xDB:
- case 0xDC: case 0xDD: case 0xDE: case 0xDF:
- return -1;
- case 0:
- if (latin1_encoding.type[result] == BT_NONXML)
- return -1;
- break;
- case 0xFF:
- if (result == 0xFFFE || result == 0xFFFF)
- return -1;
- break;
- }
- return result;
-}
-
-int XmlUtf8Encode(int c, char *buf)
-{
- enum {
- /* minN is minimum legal resulting value for N byte sequence */
- min2 = 0x80,
- min3 = 0x800,
- min4 = 0x10000
- };
-
- if (c < 0)
- return 0;
- if (c < min2) {
- buf[0] = (c | UTF8_cval1);
- return 1;
- }
- if (c < min3) {
- buf[0] = ((c >> 6) | UTF8_cval2);
- buf[1] = ((c & 0x3f) | 0x80);
- return 2;
- }
- if (c < min4) {
- buf[0] = ((c >> 12) | UTF8_cval3);
- buf[1] = (((c >> 6) & 0x3f) | 0x80);
- buf[2] = ((c & 0x3f) | 0x80);
- return 3;
- }
- if (c < 0x110000) {
- buf[0] = ((c >> 18) | UTF8_cval4);
- buf[1] = (((c >> 12) & 0x3f) | 0x80);
- buf[2] = (((c >> 6) & 0x3f) | 0x80);
- buf[3] = ((c & 0x3f) | 0x80);
- return 4;
- }
- return 0;
-}
-
-int XmlUtf16Encode(int charNum, unsigned short *buf)
-{
- if (charNum < 0)
- return 0;
- if (charNum < 0x10000) {
- buf[0] = charNum;
- return 1;
- }
- if (charNum < 0x110000) {
- charNum -= 0x10000;
- buf[0] = (charNum >> 10) + 0xD800;
- buf[1] = (charNum & 0x3FF) + 0xDC00;
- return 2;
- }
- return 0;
-}
-
-struct unknown_encoding {
- struct normal_encoding normal;
- int (*convert)(void *userData, const char *p);
- void *userData;
- unsigned short utf16[256];
- char utf8[256][4];
-};
-
-int XmlSizeOfUnknownEncoding(void)
-{
- return sizeof(struct unknown_encoding);
-}
-
-static
-int unknown_isName(const ENCODING *enc, const char *p)
-{
- int c = ((const struct unknown_encoding *)enc)
- ->convert(((const struct unknown_encoding *)enc)->userData, p);
- if (c & ~0xFFFF)
- return 0;
- return UCS2_GET_NAMING(namePages, c >> 8, c & 0xFF);
-}
-
-static
-int unknown_isNmstrt(const ENCODING *enc, const char *p)
-{
- int c = ((const struct unknown_encoding *)enc)
- ->convert(((const struct unknown_encoding *)enc)->userData, p);
- if (c & ~0xFFFF)
- return 0;
- return UCS2_GET_NAMING(nmstrtPages, c >> 8, c & 0xFF);
-}
-
-static
-int unknown_isInvalid(const ENCODING *enc, const char *p)
-{
- int c = ((const struct unknown_encoding *)enc)
- ->convert(((const struct unknown_encoding *)enc)->userData, p);
- return (c & ~0xFFFF) || checkCharRefNumber(c) < 0;
-}
-
-static
-void unknown_toUtf8(const ENCODING *enc,
- const char **fromP, const char *fromLim,
- char **toP, const char *toLim)
-{
- char buf[XML_UTF8_ENCODE_MAX];
- for (;;) {
- const char *utf8;
- int n;
- if (*fromP == fromLim)
- break;
- utf8 = ((const struct unknown_encoding *)enc)->utf8[(unsigned char)**fromP];
- n = *utf8++;
- if (n == 0) {
- int c = ((const struct unknown_encoding *)enc)
- ->convert(((const struct unknown_encoding *)enc)->userData, *fromP);
- n = XmlUtf8Encode(c, buf);
- if (n > toLim - *toP)
- break;
- utf8 = buf;
- *fromP += ((const struct normal_encoding *)enc)->type[(unsigned char)**fromP]
- - (BT_LEAD2 - 2);
- }
- else {
- if (n > toLim - *toP)
- break;
- (*fromP)++;
- }
- do {
- *(*toP)++ = *utf8++;
- } while (--n != 0);
- }
-}
-
-static
-void unknown_toUtf16(const ENCODING *enc,
- const char **fromP, const char *fromLim,
- unsigned short **toP, const unsigned short *toLim)
-{
- while (*fromP != fromLim && *toP != toLim) {
- unsigned short c
- = ((const struct unknown_encoding *)enc)->utf16[(unsigned char)**fromP];
- if (c == 0) {
- c = (unsigned short)((const struct unknown_encoding *)enc)
- ->convert(((const struct unknown_encoding *)enc)->userData, *fromP);
- *fromP += ((const struct normal_encoding *)enc)->type[(unsigned char)**fromP]
- - (BT_LEAD2 - 2);
- }
- else
- (*fromP)++;
- *(*toP)++ = c;
- }
-}
-
-ENCODING *
-XmlInitUnknownEncoding(void *mem,
- int *table,
- int (*convert)(void *userData, const char *p),
- void *userData)
-{
- int i;
- struct unknown_encoding *e = mem;
- for (i = 0; i < (int)sizeof(struct normal_encoding); i++)
- ((char *)mem)[i] = ((char *)&latin1_encoding)[i];
- for (i = 0; i < 128; i++)
- if (latin1_encoding.type[i] != BT_OTHER
- && latin1_encoding.type[i] != BT_NONXML
- && table[i] != i)
- return 0;
- for (i = 0; i < 256; i++) {
- int c = table[i];
- if (c == -1) {
- e->normal.type[i] = BT_MALFORM;
- /* This shouldn't really get used. */
- e->utf16[i] = 0xFFFF;
- e->utf8[i][0] = 1;
- e->utf8[i][1] = 0;
- }
- else if (c < 0) {
- if (c < -4)
- return 0;
- e->normal.type[i] = BT_LEAD2 - (c + 2);
- e->utf8[i][0] = 0;
- e->utf16[i] = 0;
- }
- else if (c < 0x80) {
- if (latin1_encoding.type[c] != BT_OTHER
- && latin1_encoding.type[c] != BT_NONXML
- && c != i)
- return 0;
- e->normal.type[i] = latin1_encoding.type[c];
- e->utf8[i][0] = 1;
- e->utf8[i][1] = (char)c;
- e->utf16[i] = c == 0 ? 0xFFFF : c;
- }
- else if (checkCharRefNumber(c) < 0) {
- e->normal.type[i] = BT_NONXML;
- /* This shouldn't really get used. */
- e->utf16[i] = 0xFFFF;
- e->utf8[i][0] = 1;
- e->utf8[i][1] = 0;
- }
- else {
- if (c > 0xFFFF)
- return 0;
- if (UCS2_GET_NAMING(nmstrtPages, c >> 8, c & 0xff))
- e->normal.type[i] = BT_NMSTRT;
- else if (UCS2_GET_NAMING(namePages, c >> 8, c & 0xff))
- e->normal.type[i] = BT_NAME;
- else
- e->normal.type[i] = BT_OTHER;
- e->utf8[i][0] = (char)XmlUtf8Encode(c, e->utf8[i] + 1);
- e->utf16[i] = c;
- }
- }
- e->userData = userData;
- e->convert = convert;
- if (convert) {
- e->normal.isName2 = unknown_isName;
- e->normal.isName3 = unknown_isName;
- e->normal.isName4 = unknown_isName;
- e->normal.isNmstrt2 = unknown_isNmstrt;
- e->normal.isNmstrt3 = unknown_isNmstrt;
- e->normal.isNmstrt4 = unknown_isNmstrt;
- e->normal.isInvalid2 = unknown_isInvalid;
- e->normal.isInvalid3 = unknown_isInvalid;
- e->normal.isInvalid4 = unknown_isInvalid;
- }
- e->normal.enc.utf8Convert = unknown_toUtf8;
- e->normal.enc.utf16Convert = unknown_toUtf16;
- return &(e->normal.enc);
-}
-
-/* If this enumeration is changed, getEncodingIndex and encodings
-must also be changed. */
-enum {
- UNKNOWN_ENC = -1,
- ISO_8859_1_ENC = 0,
- US_ASCII_ENC,
- UTF_8_ENC,
- UTF_16_ENC,
- UTF_16BE_ENC,
- UTF_16LE_ENC,
- /* must match encodingNames up to here */
- NO_ENC
-};
-
-static const char KW_ISO_8859_1[] = {
- ASCII_I, ASCII_S, ASCII_O, ASCII_MINUS, ASCII_8, ASCII_8, ASCII_5, ASCII_9, ASCII_MINUS, ASCII_1, '\0'
-};
-static const char KW_US_ASCII[] = {
- ASCII_U, ASCII_S, ASCII_MINUS, ASCII_A, ASCII_S, ASCII_C, ASCII_I, ASCII_I, '\0'
-};
-static const char KW_UTF_8[] = {
- ASCII_U, ASCII_T, ASCII_F, ASCII_MINUS, ASCII_8, '\0'
-};
-static const char KW_UTF_16[] = {
- ASCII_U, ASCII_T, ASCII_F, ASCII_MINUS, ASCII_1, ASCII_6, '\0'
-};
-static const char KW_UTF_16BE[] = {
- ASCII_U, ASCII_T, ASCII_F, ASCII_MINUS, ASCII_1, ASCII_6, ASCII_B, ASCII_E, '\0'
-};
-static const char KW_UTF_16LE[] = {
- ASCII_U, ASCII_T, ASCII_F, ASCII_MINUS, ASCII_1, ASCII_6, ASCII_L, ASCII_E, '\0'
-};
-
-static
-int getEncodingIndex(const char *name)
-{
- static const char *encodingNames[] = {
- KW_ISO_8859_1,
- KW_US_ASCII,
- KW_UTF_8,
- KW_UTF_16,
- KW_UTF_16BE,
- KW_UTF_16LE,
- };
- int i;
- if (name == 0)
- return NO_ENC;
- for (i = 0; i < (int)(sizeof(encodingNames)/sizeof(encodingNames[0])); i++)
- if (streqci(name, encodingNames[i]))
- return i;
- return UNKNOWN_ENC;
-}
-
-/* For binary compatibility, we store the index of the encoding specified
-at initialization in the isUtf16 member. */
-
-#define INIT_ENC_INDEX(enc) ((int)(enc)->initEnc.isUtf16)
-#define SET_INIT_ENC_INDEX(enc, i) ((enc)->initEnc.isUtf16 = (char)i)
-
-/* This is what detects the encoding.
-encodingTable maps from encoding indices to encodings;
-INIT_ENC_INDEX(enc) is the index of the external (protocol) specified encoding;
-state is XML_CONTENT_STATE if we're parsing an external text entity,
-and XML_PROLOG_STATE otherwise.
-*/
-
-
-static
-int initScan(const ENCODING **encodingTable,
- const INIT_ENCODING *enc,
- int state,
- const char *ptr,
- const char *end,
- const char **nextTokPtr)
-{
- const ENCODING **encPtr;
-
- if (ptr == end)
- return XML_TOK_NONE;
- encPtr = enc->encPtr;
- if (ptr + 1 == end) {
- /* only a single byte available for auto-detection */
-#ifndef XML_DTD /* FIXME */
- /* a well-formed document entity must have more than one byte */
- if (state != XML_CONTENT_STATE)
- return XML_TOK_PARTIAL;
-#endif
- /* so we're parsing an external text entity... */
- /* if UTF-16 was externally specified, then we need at least 2 bytes */
- switch (INIT_ENC_INDEX(enc)) {
- case UTF_16_ENC:
- case UTF_16LE_ENC:
- case UTF_16BE_ENC:
- return XML_TOK_PARTIAL;
- }
- switch ((unsigned char)*ptr) {
- case 0xFE:
- case 0xFF:
- case 0xEF: /* possibly first byte of UTF-8 BOM */
- if (INIT_ENC_INDEX(enc) == ISO_8859_1_ENC
- && state == XML_CONTENT_STATE)
- break;
- /* fall through */
- case 0x00:
- case 0x3C:
- return XML_TOK_PARTIAL;
- }
- }
- else {
- switch (((unsigned char)ptr[0] << 8) | (unsigned char)ptr[1]) {
- case 0xFEFF:
- if (INIT_ENC_INDEX(enc) == ISO_8859_1_ENC
- && state == XML_CONTENT_STATE)
- break;
- *nextTokPtr = ptr + 2;
- *encPtr = encodingTable[UTF_16BE_ENC];
- return XML_TOK_BOM;
- /* 00 3C is handled in the default case */
- case 0x3C00:
- if ((INIT_ENC_INDEX(enc) == UTF_16BE_ENC
- || INIT_ENC_INDEX(enc) == UTF_16_ENC)
- && state == XML_CONTENT_STATE)
- break;
- *encPtr = encodingTable[UTF_16LE_ENC];
- return XmlTok(*encPtr, state, ptr, end, nextTokPtr);
- case 0xFFFE:
- if (INIT_ENC_INDEX(enc) == ISO_8859_1_ENC
- && state == XML_CONTENT_STATE)
- break;
- *nextTokPtr = ptr + 2;
- *encPtr = encodingTable[UTF_16LE_ENC];
- return XML_TOK_BOM;
- case 0xEFBB:
- /* Maybe a UTF-8 BOM (EF BB BF) */
- /* If there's an explicitly specified (external) encoding
- of ISO-8859-1 or some flavour of UTF-16
- and this is an external text entity,
- don't look for the BOM,
- because it might be a legal data. */
- if (state == XML_CONTENT_STATE) {
- int e = INIT_ENC_INDEX(enc);
- if (e == ISO_8859_1_ENC || e == UTF_16BE_ENC || e == UTF_16LE_ENC || e == UTF_16_ENC)
- break;
- }
- if (ptr + 2 == end)
- return XML_TOK_PARTIAL;
- if ((unsigned char)ptr[2] == 0xBF) {
- *encPtr = encodingTable[UTF_8_ENC];
- return XML_TOK_BOM;
- }
- break;
- default:
- if (ptr[0] == '\0') {
- /* 0 isn't a legal data character. Furthermore a document entity can only
- start with ASCII characters. So the only way this can fail to be big-endian
- UTF-16 if it it's an external parsed general entity that's labelled as
- UTF-16LE. */
- if (state == XML_CONTENT_STATE && INIT_ENC_INDEX(enc) == UTF_16LE_ENC)
- break;
- *encPtr = encodingTable[UTF_16BE_ENC];
- return XmlTok(*encPtr, state, ptr, end, nextTokPtr);
- }
- else if (ptr[1] == '\0') {
- /* We could recover here in the case:
- - parsing an external entity
- - second byte is 0
- - no externally specified encoding
- - no encoding declaration
- by assuming UTF-16LE. But we don't, because this would mean when
- presented just with a single byte, we couldn't reliably determine
- whether we needed further bytes. */
- if (state == XML_CONTENT_STATE)
- break;
- *encPtr = encodingTable[UTF_16LE_ENC];
- return XmlTok(*encPtr, state, ptr, end, nextTokPtr);
- }
- break;
- }
- }
- *encPtr = encodingTable[INIT_ENC_INDEX(enc)];
- return XmlTok(*encPtr, state, ptr, end, nextTokPtr);
-}
-
-
-#define NS(x) x
-#define ns(x) x
-#include "xmltok_ns.c"
-#undef NS
-#undef ns
-
-#ifdef XML_NS
-
-#define NS(x) x ## NS
-#define ns(x) x ## _ns
-
-#include "xmltok_ns.c"
-
-#undef NS
-#undef ns
-
-ENCODING *
-XmlInitUnknownEncodingNS(void *mem,
- int *table,
- int (*convert)(void *userData, const char *p),
- void *userData)
-{
- ENCODING *enc = XmlInitUnknownEncoding(mem, table, convert, userData);
- if (enc)
- ((struct normal_encoding *)enc)->type[ASCII_COLON] = BT_COLON;
- return enc;
-}
-
-#endif /* XML_NS */
diff --git a/ext/xml/expat/xmltok.h b/ext/xml/expat/xmltok.h
deleted file mode 100644
index 8b02324c38..0000000000
--- a/ext/xml/expat/xmltok.h
+++ /dev/null
@@ -1,299 +0,0 @@
-/*
-Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
-See the file COPYING for copying permission.
-*/
-
-#ifndef XmlTok_INCLUDED
-#define XmlTok_INCLUDED 1
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* The following token may be returned by XmlContentTok */
-#define XML_TOK_TRAILING_RSQB -5 /* ] or ]] at the end of the scan; might be start of
- illegal ]]> sequence */
-/* The following tokens may be returned by both XmlPrologTok and XmlContentTok */
-#define XML_TOK_NONE -4 /* The string to be scanned is empty */
-#define XML_TOK_TRAILING_CR -3 /* A CR at the end of the scan;
- might be part of CRLF sequence */
-#define XML_TOK_PARTIAL_CHAR -2 /* only part of a multibyte sequence */
-#define XML_TOK_PARTIAL -1 /* only part of a token */
-#define XML_TOK_INVALID 0
-
-/* The following tokens are returned by XmlContentTok; some are also
- returned by XmlAttributeValueTok, XmlEntityTok, XmlCdataSectionTok */
-
-#define XML_TOK_START_TAG_WITH_ATTS 1
-#define XML_TOK_START_TAG_NO_ATTS 2
-#define XML_TOK_EMPTY_ELEMENT_WITH_ATTS 3 /* empty element tag <e/> */
-#define XML_TOK_EMPTY_ELEMENT_NO_ATTS 4
-#define XML_TOK_END_TAG 5
-#define XML_TOK_DATA_CHARS 6
-#define XML_TOK_DATA_NEWLINE 7
-#define XML_TOK_CDATA_SECT_OPEN 8
-#define XML_TOK_ENTITY_REF 9
-#define XML_TOK_CHAR_REF 10 /* numeric character reference */
-
-/* The following tokens may be returned by both XmlPrologTok and XmlContentTok */
-#define XML_TOK_PI 11 /* processing instruction */
-#define XML_TOK_XML_DECL 12 /* XML decl or text decl */
-#define XML_TOK_COMMENT 13
-#define XML_TOK_BOM 14 /* Byte order mark */
-
-/* The following tokens are returned only by XmlPrologTok */
-#define XML_TOK_PROLOG_S 15
-#define XML_TOK_DECL_OPEN 16 /* <!foo */
-#define XML_TOK_DECL_CLOSE 17 /* > */
-#define XML_TOK_NAME 18
-#define XML_TOK_NMTOKEN 19
-#define XML_TOK_POUND_NAME 20 /* #name */
-#define XML_TOK_OR 21 /* | */
-#define XML_TOK_PERCENT 22
-#define XML_TOK_OPEN_PAREN 23
-#define XML_TOK_CLOSE_PAREN 24
-#define XML_TOK_OPEN_BRACKET 25
-#define XML_TOK_CLOSE_BRACKET 26
-#define XML_TOK_LITERAL 27
-#define XML_TOK_PARAM_ENTITY_REF 28
-#define XML_TOK_INSTANCE_START 29
-
-/* The following occur only in element type declarations */
-#define XML_TOK_NAME_QUESTION 30 /* name? */
-#define XML_TOK_NAME_ASTERISK 31 /* name* */
-#define XML_TOK_NAME_PLUS 32 /* name+ */
-#define XML_TOK_COND_SECT_OPEN 33 /* <![ */
-#define XML_TOK_COND_SECT_CLOSE 34 /* ]]> */
-#define XML_TOK_CLOSE_PAREN_QUESTION 35 /* )? */
-#define XML_TOK_CLOSE_PAREN_ASTERISK 36 /* )* */
-#define XML_TOK_CLOSE_PAREN_PLUS 37 /* )+ */
-#define XML_TOK_COMMA 38
-
-/* The following token is returned only by XmlAttributeValueTok */
-#define XML_TOK_ATTRIBUTE_VALUE_S 39
-
-/* The following token is returned only by XmlCdataSectionTok */
-#define XML_TOK_CDATA_SECT_CLOSE 40
-
-/* With namespace processing this is returned by XmlPrologTok
- for a name with a colon. */
-#define XML_TOK_PREFIXED_NAME 41
-
-#ifdef XML_DTD
-#define XML_TOK_IGNORE_SECT 42
-#endif /* XML_DTD */
-
-#ifdef XML_DTD
-#define XML_N_STATES 4
-#else /* not XML_DTD */
-#define XML_N_STATES 3
-#endif /* not XML_DTD */
-
-#define XML_PROLOG_STATE 0
-#define XML_CONTENT_STATE 1
-#define XML_CDATA_SECTION_STATE 2
-#ifdef XML_DTD
-#define XML_IGNORE_SECTION_STATE 3
-#endif /* XML_DTD */
-
-#define XML_N_LITERAL_TYPES 2
-#define XML_ATTRIBUTE_VALUE_LITERAL 0
-#define XML_ENTITY_VALUE_LITERAL 1
-
-/* The size of the buffer passed to XmlUtf8Encode must be at least this. */
-#define XML_UTF8_ENCODE_MAX 4
-/* The size of the buffer passed to XmlUtf16Encode must be at least this. */
-#define XML_UTF16_ENCODE_MAX 2
-
-typedef struct position {
- /* first line and first column are 0 not 1 */
- unsigned long lineNumber;
- unsigned long columnNumber;
-} POSITION;
-
-typedef struct {
- const char *name;
- const char *valuePtr;
- const char *valueEnd;
- char normalized;
-} ATTRIBUTE;
-
-struct encoding;
-typedef struct encoding ENCODING;
-
-struct encoding {
- int (*scanners[XML_N_STATES])(const ENCODING *,
- const char *,
- const char *,
- const char **);
- int (*literalScanners[XML_N_LITERAL_TYPES])(const ENCODING *,
- const char *,
- const char *,
- const char **);
- int (*sameName)(const ENCODING *,
- const char *, const char *);
- int (*nameMatchesAscii)(const ENCODING *,
- const char *, const char *, const char *);
- int (*nameLength)(const ENCODING *, const char *);
- const char *(*skipS)(const ENCODING *, const char *);
- int (*getAtts)(const ENCODING *enc, const char *ptr,
- int attsMax, ATTRIBUTE *atts);
- int (*charRefNumber)(const ENCODING *enc, const char *ptr);
- int (*predefinedEntityName)(const ENCODING *, const char *, const char *);
- void (*updatePosition)(const ENCODING *,
- const char *ptr,
- const char *end,
- POSITION *);
- int (*isPublicId)(const ENCODING *enc, const char *ptr, const char *end,
- const char **badPtr);
- void (*utf8Convert)(const ENCODING *enc,
- const char **fromP,
- const char *fromLim,
- char **toP,
- const char *toLim);
- void (*utf16Convert)(const ENCODING *enc,
- const char **fromP,
- const char *fromLim,
- unsigned short **toP,
- const unsigned short *toLim);
- int minBytesPerChar;
- char isUtf8;
- char isUtf16;
-};
-
-/*
-Scan the string starting at ptr until the end of the next complete token,
-but do not scan past eptr. Return an integer giving the type of token.
-
-Return XML_TOK_NONE when ptr == eptr; nextTokPtr will not be set.
-
-Return XML_TOK_PARTIAL when the string does not contain a complete token;
-nextTokPtr will not be set.
-
-Return XML_TOK_INVALID when the string does not start a valid token; nextTokPtr
-will be set to point to the character which made the token invalid.
-
-Otherwise the string starts with a valid token; nextTokPtr will be set to point
-to the character following the end of that token.
-
-Each data character counts as a single token, but adjacent data characters
-may be returned together. Similarly for characters in the prolog outside
-literals, comments and processing instructions.
-*/
-
-
-#define XmlTok(enc, state, ptr, end, nextTokPtr) \
- (((enc)->scanners[state])(enc, ptr, end, nextTokPtr))
-
-#define XmlPrologTok(enc, ptr, end, nextTokPtr) \
- XmlTok(enc, XML_PROLOG_STATE, ptr, end, nextTokPtr)
-
-#define XmlContentTok(enc, ptr, end, nextTokPtr) \
- XmlTok(enc, XML_CONTENT_STATE, ptr, end, nextTokPtr)
-
-#define XmlCdataSectionTok(enc, ptr, end, nextTokPtr) \
- XmlTok(enc, XML_CDATA_SECTION_STATE, ptr, end, nextTokPtr)
-
-#ifdef XML_DTD
-
-#define XmlIgnoreSectionTok(enc, ptr, end, nextTokPtr) \
- XmlTok(enc, XML_IGNORE_SECTION_STATE, ptr, end, nextTokPtr)
-
-#endif /* XML_DTD */
-
-/* This is used for performing a 2nd-level tokenization on
-the content of a literal that has already been returned by XmlTok. */
-
-#define XmlLiteralTok(enc, literalType, ptr, end, nextTokPtr) \
- (((enc)->literalScanners[literalType])(enc, ptr, end, nextTokPtr))
-
-#define XmlAttributeValueTok(enc, ptr, end, nextTokPtr) \
- XmlLiteralTok(enc, XML_ATTRIBUTE_VALUE_LITERAL, ptr, end, nextTokPtr)
-
-#define XmlEntityValueTok(enc, ptr, end, nextTokPtr) \
- XmlLiteralTok(enc, XML_ENTITY_VALUE_LITERAL, ptr, end, nextTokPtr)
-
-#define XmlSameName(enc, ptr1, ptr2) (((enc)->sameName)(enc, ptr1, ptr2))
-
-#define XmlNameMatchesAscii(enc, ptr1, end1, ptr2) \
- (((enc)->nameMatchesAscii)(enc, ptr1, end1, ptr2))
-
-#define XmlNameLength(enc, ptr) \
- (((enc)->nameLength)(enc, ptr))
-
-#define XmlSkipS(enc, ptr) \
- (((enc)->skipS)(enc, ptr))
-
-#define XmlGetAttributes(enc, ptr, attsMax, atts) \
- (((enc)->getAtts)(enc, ptr, attsMax, atts))
-
-#define XmlCharRefNumber(enc, ptr) \
- (((enc)->charRefNumber)(enc, ptr))
-
-#define XmlPredefinedEntityName(enc, ptr, end) \
- (((enc)->predefinedEntityName)(enc, ptr, end))
-
-#define XmlUpdatePosition(enc, ptr, end, pos) \
- (((enc)->updatePosition)(enc, ptr, end, pos))
-
-#define XmlIsPublicId(enc, ptr, end, badPtr) \
- (((enc)->isPublicId)(enc, ptr, end, badPtr))
-
-#define XmlUtf8Convert(enc, fromP, fromLim, toP, toLim) \
- (((enc)->utf8Convert)(enc, fromP, fromLim, toP, toLim))
-
-#define XmlUtf16Convert(enc, fromP, fromLim, toP, toLim) \
- (((enc)->utf16Convert)(enc, fromP, fromLim, toP, toLim))
-
-typedef struct {
- ENCODING initEnc;
- const ENCODING **encPtr;
-} INIT_ENCODING;
-
-int XmlParseXmlDecl(int isGeneralTextEntity,
- const ENCODING *enc,
- const char *ptr,
- const char *end,
- const char **badPtr,
- const char **versionPtr,
- const char **versionEndPtr,
- const char **encodingNamePtr,
- const ENCODING **namedEncodingPtr,
- int *standalonePtr);
-
-int XmlInitEncoding(INIT_ENCODING *, const ENCODING **, const char *name);
-const ENCODING *XmlGetUtf8InternalEncoding(void);
-const ENCODING *XmlGetUtf16InternalEncoding(void);
-int XmlUtf8Encode(int charNumber, char *buf);
-int XmlUtf16Encode(int charNumber, unsigned short *buf);
-
-int XmlSizeOfUnknownEncoding(void);
-ENCODING *
-XmlInitUnknownEncoding(void *mem,
- int *table,
- int (*conv)(void *userData, const char *p),
- void *userData);
-
-int XmlParseXmlDeclNS(int isGeneralTextEntity,
- const ENCODING *enc,
- const char *ptr,
- const char *end,
- const char **badPtr,
- const char **versionPtr,
- const char **versionEndPtr,
- const char **encodingNamePtr,
- const ENCODING **namedEncodingPtr,
- int *standalonePtr);
-int XmlInitEncodingNS(INIT_ENCODING *, const ENCODING **, const char *name);
-const ENCODING *XmlGetUtf8InternalEncodingNS(void);
-const ENCODING *XmlGetUtf16InternalEncodingNS(void);
-ENCODING *
-XmlInitUnknownEncodingNS(void *mem,
- int *table,
- int (*conv)(void *userData, const char *p),
- void *userData);
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* not XmlTok_INCLUDED */
diff --git a/ext/xml/expat/xmltok_impl.c b/ext/xml/expat/xmltok_impl.c
deleted file mode 100644
index 70131c0fcc..0000000000
--- a/ext/xml/expat/xmltok_impl.c
+++ /dev/null
@@ -1,1770 +0,0 @@
-/*
-Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
-See the file COPYING for copying permission.
-*/
-
-#include "php_compat.h"
-
-#ifndef IS_INVALID_CHAR
-#define IS_INVALID_CHAR(enc, ptr, n) (0)
-#endif
-
-#define INVALID_LEAD_CASE(n, ptr, nextTokPtr) \
- case BT_LEAD ## n: \
- if (end - ptr < n) \
- return XML_TOK_PARTIAL_CHAR; \
- if (IS_INVALID_CHAR(enc, ptr, n)) { \
- *(nextTokPtr) = (ptr); \
- return XML_TOK_INVALID; \
- } \
- ptr += n; \
- break;
-
-#define INVALID_CASES(ptr, nextTokPtr) \
- INVALID_LEAD_CASE(2, ptr, nextTokPtr) \
- INVALID_LEAD_CASE(3, ptr, nextTokPtr) \
- INVALID_LEAD_CASE(4, ptr, nextTokPtr) \
- case BT_NONXML: \
- case BT_MALFORM: \
- case BT_TRAIL: \
- *(nextTokPtr) = (ptr); \
- return XML_TOK_INVALID;
-
-#define CHECK_NAME_CASE(n, enc, ptr, end, nextTokPtr) \
- case BT_LEAD ## n: \
- if (end - ptr < n) \
- return XML_TOK_PARTIAL_CHAR; \
- if (!IS_NAME_CHAR(enc, ptr, n)) { \
- *nextTokPtr = ptr; \
- return XML_TOK_INVALID; \
- } \
- ptr += n; \
- break;
-
-#define CHECK_NAME_CASES(enc, ptr, end, nextTokPtr) \
- case BT_NONASCII: \
- if (!IS_NAME_CHAR_MINBPC(enc, ptr)) { \
- *nextTokPtr = ptr; \
- return XML_TOK_INVALID; \
- } \
- case BT_NMSTRT: \
- case BT_HEX: \
- case BT_DIGIT: \
- case BT_NAME: \
- case BT_MINUS: \
- ptr += MINBPC(enc); \
- break; \
- CHECK_NAME_CASE(2, enc, ptr, end, nextTokPtr) \
- CHECK_NAME_CASE(3, enc, ptr, end, nextTokPtr) \
- CHECK_NAME_CASE(4, enc, ptr, end, nextTokPtr)
-
-#define CHECK_NMSTRT_CASE(n, enc, ptr, end, nextTokPtr) \
- case BT_LEAD ## n: \
- if (end - ptr < n) \
- return XML_TOK_PARTIAL_CHAR; \
- if (!IS_NMSTRT_CHAR(enc, ptr, n)) { \
- *nextTokPtr = ptr; \
- return XML_TOK_INVALID; \
- } \
- ptr += n; \
- break;
-
-#define CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr) \
- case BT_NONASCII: \
- if (!IS_NMSTRT_CHAR_MINBPC(enc, ptr)) { \
- *nextTokPtr = ptr; \
- return XML_TOK_INVALID; \
- } \
- case BT_NMSTRT: \
- case BT_HEX: \
- ptr += MINBPC(enc); \
- break; \
- CHECK_NMSTRT_CASE(2, enc, ptr, end, nextTokPtr) \
- CHECK_NMSTRT_CASE(3, enc, ptr, end, nextTokPtr) \
- CHECK_NMSTRT_CASE(4, enc, ptr, end, nextTokPtr)
-
-#ifndef PREFIX
-#define PREFIX(ident) ident
-#endif
-
-/* ptr points to character following "<!-" */
-
-static
-int PREFIX(scanComment)(const ENCODING *enc, const char *ptr, const char *end,
- const char **nextTokPtr)
-{
- if (ptr != end) {
- if (!CHAR_MATCHES(enc, ptr, ASCII_MINUS)) {
- *nextTokPtr = ptr;
- return XML_TOK_INVALID;
- }
- ptr += MINBPC(enc);
- while (ptr != end) {
- switch (BYTE_TYPE(enc, ptr)) {
- INVALID_CASES(ptr, nextTokPtr)
- case BT_MINUS:
- if ((ptr += MINBPC(enc)) == end)
- return XML_TOK_PARTIAL;
- if (CHAR_MATCHES(enc, ptr, ASCII_MINUS)) {
- if ((ptr += MINBPC(enc)) == end)
- return XML_TOK_PARTIAL;
- if (!CHAR_MATCHES(enc, ptr, ASCII_GT)) {
- *nextTokPtr = ptr;
- return XML_TOK_INVALID;
- }
- *nextTokPtr = ptr + MINBPC(enc);
- return XML_TOK_COMMENT;
- }
- break;
- default:
- ptr += MINBPC(enc);
- break;
- }
- }
- }
- return XML_TOK_PARTIAL;
-}
-
-/* ptr points to character following "<!" */
-
-static
-int PREFIX(scanDecl)(const ENCODING *enc, const char *ptr, const char *end,
- const char **nextTokPtr)
-{
- if (ptr == end)
- return XML_TOK_PARTIAL;
- switch (BYTE_TYPE(enc, ptr)) {
- case BT_MINUS:
- return PREFIX(scanComment)(enc, ptr + MINBPC(enc), end, nextTokPtr);
- case BT_LSQB:
- *nextTokPtr = ptr + MINBPC(enc);
- return XML_TOK_COND_SECT_OPEN;
- case BT_NMSTRT:
- case BT_HEX:
- ptr += MINBPC(enc);
- break;
- default:
- *nextTokPtr = ptr;
- return XML_TOK_INVALID;
- }
- while (ptr != end) {
- switch (BYTE_TYPE(enc, ptr)) {
- case BT_PERCNT:
- if (ptr + MINBPC(enc) == end)
- return XML_TOK_PARTIAL;
- /* don't allow <!ENTITY% foo "whatever"> */
- switch (BYTE_TYPE(enc, ptr + MINBPC(enc))) {
- case BT_S: case BT_CR: case BT_LF: case BT_PERCNT:
- *nextTokPtr = ptr;
- return XML_TOK_INVALID;
- }
- /* fall through */
- case BT_S: case BT_CR: case BT_LF:
- *nextTokPtr = ptr;
- return XML_TOK_DECL_OPEN;
- case BT_NMSTRT:
- case BT_HEX:
- ptr += MINBPC(enc);
- break;
- default:
- *nextTokPtr = ptr;
- return XML_TOK_INVALID;
- }
- }
- return XML_TOK_PARTIAL;
-}
-
-static
-int PREFIX(checkPiTarget)(const ENCODING *enc, const char *ptr, const char *end, int *tokPtr)
-{
- int upper = 0;
- *tokPtr = XML_TOK_PI;
- if (end - ptr != MINBPC(enc)*3)
- return 1;
- switch (BYTE_TO_ASCII(enc, ptr)) {
- case ASCII_x:
- break;
- case ASCII_X:
- upper = 1;
- break;
- default:
- return 1;
- }
- ptr += MINBPC(enc);
- switch (BYTE_TO_ASCII(enc, ptr)) {
- case ASCII_m:
- break;
- case ASCII_M:
- upper = 1;
- break;
- default:
- return 1;
- }
- ptr += MINBPC(enc);
- switch (BYTE_TO_ASCII(enc, ptr)) {
- case ASCII_l:
- break;
- case ASCII_L:
- upper = 1;
- break;
- default:
- return 1;
- }
- if (upper)
- return 0;
- *tokPtr = XML_TOK_XML_DECL;
- return 1;
-}
-
-/* ptr points to character following "<?" */
-
-static
-int PREFIX(scanPi)(const ENCODING *enc, const char *ptr, const char *end,
- const char **nextTokPtr)
-{
- int tok;
- const char *target = ptr;
- if (ptr == end)
- return XML_TOK_PARTIAL;
- switch (BYTE_TYPE(enc, ptr)) {
- CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr)
- default:
- *nextTokPtr = ptr;
- return XML_TOK_INVALID;
- }
- while (ptr != end) {
- switch (BYTE_TYPE(enc, ptr)) {
- CHECK_NAME_CASES(enc, ptr, end, nextTokPtr)
- case BT_S: case BT_CR: case BT_LF:
- if (!PREFIX(checkPiTarget)(enc, target, ptr, &tok)) {
- *nextTokPtr = ptr;
- return XML_TOK_INVALID;
- }
- ptr += MINBPC(enc);
- while (ptr != end) {
- switch (BYTE_TYPE(enc, ptr)) {
- INVALID_CASES(ptr, nextTokPtr)
- case BT_QUEST:
- ptr += MINBPC(enc);
- if (ptr == end)
- return XML_TOK_PARTIAL;
- if (CHAR_MATCHES(enc, ptr, ASCII_GT)) {
- *nextTokPtr = ptr + MINBPC(enc);
- return tok;
- }
- break;
- default:
- ptr += MINBPC(enc);
- break;
- }
- }
- return XML_TOK_PARTIAL;
- case BT_QUEST:
- if (!PREFIX(checkPiTarget)(enc, target, ptr, &tok)) {
- *nextTokPtr = ptr;
- return XML_TOK_INVALID;
- }
- ptr += MINBPC(enc);
- if (ptr == end)
- return XML_TOK_PARTIAL;
- if (CHAR_MATCHES(enc, ptr, ASCII_GT)) {
- *nextTokPtr = ptr + MINBPC(enc);
- return tok;
- }
- /* fall through */
- default:
- *nextTokPtr = ptr;
- return XML_TOK_INVALID;
- }
- }
- return XML_TOK_PARTIAL;
-}
-
-
-static
-int PREFIX(scanCdataSection)(const ENCODING *enc, const char *ptr, const char *end,
- const char **nextTokPtr)
-{
- static const char CDATA_LSQB[] = { ASCII_C, ASCII_D, ASCII_A, ASCII_T, ASCII_A, ASCII_LSQB };
- int i;
- /* CDATA[ */
- if (end - ptr < 6 * MINBPC(enc))
- return XML_TOK_PARTIAL;
- for (i = 0; i < 6; i++, ptr += MINBPC(enc)) {
- if (!CHAR_MATCHES(enc, ptr, CDATA_LSQB[i])) {
- *nextTokPtr = ptr;
- return XML_TOK_INVALID;
- }
- }
- *nextTokPtr = ptr;
- return XML_TOK_CDATA_SECT_OPEN;
-}
-
-static
-int PREFIX(cdataSectionTok)(const ENCODING *enc, const char *ptr, const char *end,
- const char **nextTokPtr)
-{
- if (ptr == end)
- return XML_TOK_NONE;
- if (MINBPC(enc) > 1) {
- size_t n = end - ptr;
- if (n & (MINBPC(enc) - 1)) {
- n &= ~(MINBPC(enc) - 1);
- if (n == 0)
- return XML_TOK_PARTIAL;
- end = ptr + n;
- }
- }
- switch (BYTE_TYPE(enc, ptr)) {
- case BT_RSQB:
- ptr += MINBPC(enc);
- if (ptr == end)
- return XML_TOK_PARTIAL;
- if (!CHAR_MATCHES(enc, ptr, ASCII_RSQB))
- break;
- ptr += MINBPC(enc);
- if (ptr == end)
- return XML_TOK_PARTIAL;
- if (!CHAR_MATCHES(enc, ptr, ASCII_GT)) {
- ptr -= MINBPC(enc);
- break;
- }
- *nextTokPtr = ptr + MINBPC(enc);
- return XML_TOK_CDATA_SECT_CLOSE;
- case BT_CR:
- ptr += MINBPC(enc);
- if (ptr == end)
- return XML_TOK_PARTIAL;
- if (BYTE_TYPE(enc, ptr) == BT_LF)
- ptr += MINBPC(enc);
- *nextTokPtr = ptr;
- return XML_TOK_DATA_NEWLINE;
- case BT_LF:
- *nextTokPtr = ptr + MINBPC(enc);
- return XML_TOK_DATA_NEWLINE;
- INVALID_CASES(ptr, nextTokPtr)
- default:
- ptr += MINBPC(enc);
- break;
- }
- while (ptr != end) {
- switch (BYTE_TYPE(enc, ptr)) {
-#define LEAD_CASE(n) \
- case BT_LEAD ## n: \
- if (end - ptr < n || IS_INVALID_CHAR(enc, ptr, n)) { \
- *nextTokPtr = ptr; \
- return XML_TOK_DATA_CHARS; \
- } \
- ptr += n; \
- break;
- LEAD_CASE(2) LEAD_CASE(3) LEAD_CASE(4)
-#undef LEAD_CASE
- case BT_NONXML:
- case BT_MALFORM:
- case BT_TRAIL:
- case BT_CR:
- case BT_LF:
- case BT_RSQB:
- *nextTokPtr = ptr;
- return XML_TOK_DATA_CHARS;
- default:
- ptr += MINBPC(enc);
- break;
- }
- }
- *nextTokPtr = ptr;
- return XML_TOK_DATA_CHARS;
-}
-
-/* ptr points to character following "</" */
-
-static
-int PREFIX(scanEndTag)(const ENCODING *enc, const char *ptr, const char *end,
- const char **nextTokPtr)
-{
- if (ptr == end)
- return XML_TOK_PARTIAL;
- switch (BYTE_TYPE(enc, ptr)) {
- CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr)
- default:
- *nextTokPtr = ptr;
- return XML_TOK_INVALID;
- }
- while (ptr != end) {
- switch (BYTE_TYPE(enc, ptr)) {
- CHECK_NAME_CASES(enc, ptr, end, nextTokPtr)
- case BT_S: case BT_CR: case BT_LF:
- for (ptr += MINBPC(enc); ptr != end; ptr += MINBPC(enc)) {
- switch (BYTE_TYPE(enc, ptr)) {
- case BT_S: case BT_CR: case BT_LF:
- break;
- case BT_GT:
- *nextTokPtr = ptr + MINBPC(enc);
- return XML_TOK_END_TAG;
- default:
- *nextTokPtr = ptr;
- return XML_TOK_INVALID;
- }
- }
- return XML_TOK_PARTIAL;
-#ifdef XML_NS
- case BT_COLON:
- /* no need to check qname syntax here, since end-tag must match exactly */
- ptr += MINBPC(enc);
- break;
-#endif
- case BT_GT:
- *nextTokPtr = ptr + MINBPC(enc);
- return XML_TOK_END_TAG;
- default:
- *nextTokPtr = ptr;
- return XML_TOK_INVALID;
- }
- }
- return XML_TOK_PARTIAL;
-}
-
-/* ptr points to character following "&#X" */
-
-static
-int PREFIX(scanHexCharRef)(const ENCODING *enc, const char *ptr, const char *end,
- const char **nextTokPtr)
-{
- if (ptr != end) {
- switch (BYTE_TYPE(enc, ptr)) {
- case BT_DIGIT:
- case BT_HEX:
- break;
- default:
- *nextTokPtr = ptr;
- return XML_TOK_INVALID;
- }
- for (ptr += MINBPC(enc); ptr != end; ptr += MINBPC(enc)) {
- switch (BYTE_TYPE(enc, ptr)) {
- case BT_DIGIT:
- case BT_HEX:
- break;
- case BT_SEMI:
- *nextTokPtr = ptr + MINBPC(enc);
- return XML_TOK_CHAR_REF;
- default:
- *nextTokPtr = ptr;
- return XML_TOK_INVALID;
- }
- }
- }
- return XML_TOK_PARTIAL;
-}
-
-/* ptr points to character following "&#" */
-
-static
-int PREFIX(scanCharRef)(const ENCODING *enc, const char *ptr, const char *end,
- const char **nextTokPtr)
-{
- if (ptr != end) {
- if (CHAR_MATCHES(enc, ptr, ASCII_x))
- return PREFIX(scanHexCharRef)(enc, ptr + MINBPC(enc), end, nextTokPtr);
- switch (BYTE_TYPE(enc, ptr)) {
- case BT_DIGIT:
- break;
- default:
- *nextTokPtr = ptr;
- return XML_TOK_INVALID;
- }
- for (ptr += MINBPC(enc); ptr != end; ptr += MINBPC(enc)) {
- switch (BYTE_TYPE(enc, ptr)) {
- case BT_DIGIT:
- break;
- case BT_SEMI:
- *nextTokPtr = ptr + MINBPC(enc);
- return XML_TOK_CHAR_REF;
- default:
- *nextTokPtr = ptr;
- return XML_TOK_INVALID;
- }
- }
- }
- return XML_TOK_PARTIAL;
-}
-
-/* ptr points to character following "&" */
-
-static
-int PREFIX(scanRef)(const ENCODING *enc, const char *ptr, const char *end,
- const char **nextTokPtr)
-{
- if (ptr == end)
- return XML_TOK_PARTIAL;
- switch (BYTE_TYPE(enc, ptr)) {
- CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr)
- case BT_NUM:
- return PREFIX(scanCharRef)(enc, ptr + MINBPC(enc), end, nextTokPtr);
- default:
- *nextTokPtr = ptr;
- return XML_TOK_INVALID;
- }
- while (ptr != end) {
- switch (BYTE_TYPE(enc, ptr)) {
- CHECK_NAME_CASES(enc, ptr, end, nextTokPtr)
- case BT_SEMI:
- *nextTokPtr = ptr + MINBPC(enc);
- return XML_TOK_ENTITY_REF;
- default:
- *nextTokPtr = ptr;
- return XML_TOK_INVALID;
- }
- }
- return XML_TOK_PARTIAL;
-}
-
-/* ptr points to character following first character of attribute name */
-
-static
-int PREFIX(scanAtts)(const ENCODING *enc, const char *ptr, const char *end,
- const char **nextTokPtr)
-{
-#ifdef XML_NS
- int hadColon = 0;
-#endif
- while (ptr != end) {
- switch (BYTE_TYPE(enc, ptr)) {
- CHECK_NAME_CASES(enc, ptr, end, nextTokPtr)
-#ifdef XML_NS
- case BT_COLON:
- if (hadColon) {
- *nextTokPtr = ptr;
- return XML_TOK_INVALID;
- }
- hadColon = 1;
- ptr += MINBPC(enc);
- if (ptr == end)
- return XML_TOK_PARTIAL;
- switch (BYTE_TYPE(enc, ptr)) {
- CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr)
- default:
- *nextTokPtr = ptr;
- return XML_TOK_INVALID;
- }
- break;
-#endif
- case BT_S: case BT_CR: case BT_LF:
- for (;;) {
- int t;
-
- ptr += MINBPC(enc);
- if (ptr == end)
- return XML_TOK_PARTIAL;
- t = BYTE_TYPE(enc, ptr);
- if (t == BT_EQUALS)
- break;
- switch (t) {
- case BT_S:
- case BT_LF:
- case BT_CR:
- break;
- default:
- *nextTokPtr = ptr;
- return XML_TOK_INVALID;
- }
- }
- /* fall through */
- case BT_EQUALS:
- {
- int open;
-#ifdef XML_NS
- hadColon = 0;
-#endif
- for (;;) {
-
- ptr += MINBPC(enc);
- if (ptr == end)
- return XML_TOK_PARTIAL;
- open = BYTE_TYPE(enc, ptr);
- if (open == BT_QUOT || open == BT_APOS)
- break;
- switch (open) {
- case BT_S:
- case BT_LF:
- case BT_CR:
- break;
- default:
- *nextTokPtr = ptr;
- return XML_TOK_INVALID;
- }
- }
- ptr += MINBPC(enc);
- /* in attribute value */
- for (;;) {
- int t;
- if (ptr == end)
- return XML_TOK_PARTIAL;
- t = BYTE_TYPE(enc, ptr);
- if (t == open)
- break;
- switch (t) {
- INVALID_CASES(ptr, nextTokPtr)
- case BT_AMP:
- {
- int tok = PREFIX(scanRef)(enc, ptr + MINBPC(enc), end, &ptr);
- if (tok <= 0) {
- if (tok == XML_TOK_INVALID)
- *nextTokPtr = ptr;
- return tok;
- }
- break;
- }
- case BT_LT:
- *nextTokPtr = ptr;
- return XML_TOK_INVALID;
- default:
- ptr += MINBPC(enc);
- break;
- }
- }
- ptr += MINBPC(enc);
- if (ptr == end)
- return XML_TOK_PARTIAL;
- switch (BYTE_TYPE(enc, ptr)) {
- case BT_S:
- case BT_CR:
- case BT_LF:
- break;
- case BT_SOL:
- goto sol;
- case BT_GT:
- goto gt;
- default:
- *nextTokPtr = ptr;
- return XML_TOK_INVALID;
- }
- /* ptr points to closing quote */
- for (;;) {
- ptr += MINBPC(enc);
- if (ptr == end)
- return XML_TOK_PARTIAL;
- switch (BYTE_TYPE(enc, ptr)) {
- CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr)
- case BT_S: case BT_CR: case BT_LF:
- continue;
- case BT_GT:
- gt:
- *nextTokPtr = ptr + MINBPC(enc);
- return XML_TOK_START_TAG_WITH_ATTS;
- case BT_SOL:
- sol:
- ptr += MINBPC(enc);
- if (ptr == end)
- return XML_TOK_PARTIAL;
- if (!CHAR_MATCHES(enc, ptr, ASCII_GT)) {
- *nextTokPtr = ptr;
- return XML_TOK_INVALID;
- }
- *nextTokPtr = ptr + MINBPC(enc);
- return XML_TOK_EMPTY_ELEMENT_WITH_ATTS;
- default:
- *nextTokPtr = ptr;
- return XML_TOK_INVALID;
- }
- break;
- }
- break;
- }
- default:
- *nextTokPtr = ptr;
- return XML_TOK_INVALID;
- }
- }
- return XML_TOK_PARTIAL;
-}
-
-/* ptr points to character following "<" */
-
-static
-int PREFIX(scanLt)(const ENCODING *enc, const char *ptr, const char *end,
- const char **nextTokPtr)
-{
-#ifdef XML_NS
- int hadColon;
-#endif
- if (ptr == end)
- return XML_TOK_PARTIAL;
- switch (BYTE_TYPE(enc, ptr)) {
- CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr)
- case BT_EXCL:
- if ((ptr += MINBPC(enc)) == end)
- return XML_TOK_PARTIAL;
- switch (BYTE_TYPE(enc, ptr)) {
- case BT_MINUS:
- return PREFIX(scanComment)(enc, ptr + MINBPC(enc), end, nextTokPtr);
- case BT_LSQB:
- return PREFIX(scanCdataSection)(enc, ptr + MINBPC(enc), end, nextTokPtr);
- }
- *nextTokPtr = ptr;
- return XML_TOK_INVALID;
- case BT_QUEST:
- return PREFIX(scanPi)(enc, ptr + MINBPC(enc), end, nextTokPtr);
- case BT_SOL:
- return PREFIX(scanEndTag)(enc, ptr + MINBPC(enc), end, nextTokPtr);
- default:
- *nextTokPtr = ptr;
- return XML_TOK_INVALID;
- }
-#ifdef XML_NS
- hadColon = 0;
-#endif
- /* we have a start-tag */
- while (ptr != end) {
- switch (BYTE_TYPE(enc, ptr)) {
- CHECK_NAME_CASES(enc, ptr, end, nextTokPtr)
-#ifdef XML_NS
- case BT_COLON:
- if (hadColon) {
- *nextTokPtr = ptr;
- return XML_TOK_INVALID;
- }
- hadColon = 1;
- ptr += MINBPC(enc);
- if (ptr == end)
- return XML_TOK_PARTIAL;
- switch (BYTE_TYPE(enc, ptr)) {
- CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr)
- default:
- *nextTokPtr = ptr;
- return XML_TOK_INVALID;
- }
- break;
-#endif
- case BT_S: case BT_CR: case BT_LF:
- {
- ptr += MINBPC(enc);
- while (ptr != end) {
- switch (BYTE_TYPE(enc, ptr)) {
- CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr)
- case BT_GT:
- goto gt;
- case BT_SOL:
- goto sol;
- case BT_S: case BT_CR: case BT_LF:
- ptr += MINBPC(enc);
- continue;
- default:
- *nextTokPtr = ptr;
- return XML_TOK_INVALID;
- }
- return PREFIX(scanAtts)(enc, ptr, end, nextTokPtr);
- }
- return XML_TOK_PARTIAL;
- }
- case BT_GT:
- gt:
- *nextTokPtr = ptr + MINBPC(enc);
- return XML_TOK_START_TAG_NO_ATTS;
- case BT_SOL:
- sol:
- ptr += MINBPC(enc);
- if (ptr == end)
- return XML_TOK_PARTIAL;
- if (!CHAR_MATCHES(enc, ptr, ASCII_GT)) {
- *nextTokPtr = ptr;
- return XML_TOK_INVALID;
- }
- *nextTokPtr = ptr + MINBPC(enc);
- return XML_TOK_EMPTY_ELEMENT_NO_ATTS;
- default:
- *nextTokPtr = ptr;
- return XML_TOK_INVALID;
- }
- }
- return XML_TOK_PARTIAL;
-}
-
-static
-int PREFIX(contentTok)(const ENCODING *enc, const char *ptr, const char *end,
- const char **nextTokPtr)
-{
- if (ptr == end)
- return XML_TOK_NONE;
- if (MINBPC(enc) > 1) {
- size_t n = end - ptr;
- if (n & (MINBPC(enc) - 1)) {
- n &= ~(MINBPC(enc) - 1);
- if (n == 0)
- return XML_TOK_PARTIAL;
- end = ptr + n;
- }
- }
- switch (BYTE_TYPE(enc, ptr)) {
- case BT_LT:
- return PREFIX(scanLt)(enc, ptr + MINBPC(enc), end, nextTokPtr);
- case BT_AMP:
- return PREFIX(scanRef)(enc, ptr + MINBPC(enc), end, nextTokPtr);
- case BT_CR:
- ptr += MINBPC(enc);
- if (ptr == end)
- return XML_TOK_TRAILING_CR;
- if (BYTE_TYPE(enc, ptr) == BT_LF)
- ptr += MINBPC(enc);
- *nextTokPtr = ptr;
- return XML_TOK_DATA_NEWLINE;
- case BT_LF:
- *nextTokPtr = ptr + MINBPC(enc);
- return XML_TOK_DATA_NEWLINE;
- case BT_RSQB:
- ptr += MINBPC(enc);
- if (ptr == end)
- return XML_TOK_TRAILING_RSQB;
- if (!CHAR_MATCHES(enc, ptr, ASCII_RSQB))
- break;
- ptr += MINBPC(enc);
- if (ptr == end)
- return XML_TOK_TRAILING_RSQB;
- if (!CHAR_MATCHES(enc, ptr, ASCII_GT)) {
- ptr -= MINBPC(enc);
- break;
- }
- *nextTokPtr = ptr;
- return XML_TOK_INVALID;
- INVALID_CASES(ptr, nextTokPtr)
- default:
- ptr += MINBPC(enc);
- break;
- }
- while (ptr != end) {
- switch (BYTE_TYPE(enc, ptr)) {
-#define LEAD_CASE(n) \
- case BT_LEAD ## n: \
- if (end - ptr < n || IS_INVALID_CHAR(enc, ptr, n)) { \
- *nextTokPtr = ptr; \
- return XML_TOK_DATA_CHARS; \
- } \
- ptr += n; \
- break;
- LEAD_CASE(2) LEAD_CASE(3) LEAD_CASE(4)
-#undef LEAD_CASE
- case BT_RSQB:
- if (ptr + MINBPC(enc) != end) {
- if (!CHAR_MATCHES(enc, ptr + MINBPC(enc), ASCII_RSQB)) {
- ptr += MINBPC(enc);
- break;
- }
- if (ptr + 2*MINBPC(enc) != end) {
- if (!CHAR_MATCHES(enc, ptr + 2*MINBPC(enc), ASCII_GT)) {
- ptr += MINBPC(enc);
- break;
- }
- *nextTokPtr = ptr + 2*MINBPC(enc);
- return XML_TOK_INVALID;
- }
- }
- /* fall through */
- case BT_AMP:
- case BT_LT:
- case BT_NONXML:
- case BT_MALFORM:
- case BT_TRAIL:
- case BT_CR:
- case BT_LF:
- *nextTokPtr = ptr;
- return XML_TOK_DATA_CHARS;
- default:
- ptr += MINBPC(enc);
- break;
- }
- }
- *nextTokPtr = ptr;
- return XML_TOK_DATA_CHARS;
-}
-
-/* ptr points to character following "%" */
-
-static
-int PREFIX(scanPercent)(const ENCODING *enc, const char *ptr, const char *end,
- const char **nextTokPtr)
-{
- if (ptr == end)
- return XML_TOK_PARTIAL;
- switch (BYTE_TYPE(enc, ptr)) {
- CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr)
- case BT_S: case BT_LF: case BT_CR: case BT_PERCNT:
- *nextTokPtr = ptr;
- return XML_TOK_PERCENT;
- default:
- *nextTokPtr = ptr;
- return XML_TOK_INVALID;
- }
- while (ptr != end) {
- switch (BYTE_TYPE(enc, ptr)) {
- CHECK_NAME_CASES(enc, ptr, end, nextTokPtr)
- case BT_SEMI:
- *nextTokPtr = ptr + MINBPC(enc);
- return XML_TOK_PARAM_ENTITY_REF;
- default:
- *nextTokPtr = ptr;
- return XML_TOK_INVALID;
- }
- }
- return XML_TOK_PARTIAL;
-}
-
-static
-int PREFIX(scanPoundName)(const ENCODING *enc, const char *ptr, const char *end,
- const char **nextTokPtr)
-{
- if (ptr == end)
- return XML_TOK_PARTIAL;
- switch (BYTE_TYPE(enc, ptr)) {
- CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr)
- default:
- *nextTokPtr = ptr;
- return XML_TOK_INVALID;
- }
- while (ptr != end) {
- switch (BYTE_TYPE(enc, ptr)) {
- CHECK_NAME_CASES(enc, ptr, end, nextTokPtr)
- case BT_CR: case BT_LF: case BT_S:
- case BT_RPAR: case BT_GT: case BT_PERCNT: case BT_VERBAR:
- *nextTokPtr = ptr;
- return XML_TOK_POUND_NAME;
- default:
- *nextTokPtr = ptr;
- return XML_TOK_INVALID;
- }
- }
- return -XML_TOK_POUND_NAME;
-}
-
-static
-int PREFIX(scanLit)(int open, const ENCODING *enc,
- const char *ptr, const char *end,
- const char **nextTokPtr)
-{
- while (ptr != end) {
- int t = BYTE_TYPE(enc, ptr);
- switch (t) {
- INVALID_CASES(ptr, nextTokPtr)
- case BT_QUOT:
- case BT_APOS:
- ptr += MINBPC(enc);
- if (t != open)
- break;
- if (ptr == end)
- return -XML_TOK_LITERAL;
- *nextTokPtr = ptr;
- switch (BYTE_TYPE(enc, ptr)) {
- case BT_S: case BT_CR: case BT_LF:
- case BT_GT: case BT_PERCNT: case BT_LSQB:
- return XML_TOK_LITERAL;
- default:
- return XML_TOK_INVALID;
- }
- default:
- ptr += MINBPC(enc);
- break;
- }
- }
- return XML_TOK_PARTIAL;
-}
-
-static
-int PREFIX(prologTok)(const ENCODING *enc, const char *ptr, const char *end,
- const char **nextTokPtr)
-{
- int tok;
- if (ptr == end)
- return XML_TOK_NONE;
- if (MINBPC(enc) > 1) {
- size_t n = end - ptr;
- if (n & (MINBPC(enc) - 1)) {
- n &= ~(MINBPC(enc) - 1);
- if (n == 0)
- return XML_TOK_PARTIAL;
- end = ptr + n;
- }
- }
- switch (BYTE_TYPE(enc, ptr)) {
- case BT_QUOT:
- return PREFIX(scanLit)(BT_QUOT, enc, ptr + MINBPC(enc), end, nextTokPtr);
- case BT_APOS:
- return PREFIX(scanLit)(BT_APOS, enc, ptr + MINBPC(enc), end, nextTokPtr);
- case BT_LT:
- {
- ptr += MINBPC(enc);
- if (ptr == end)
- return XML_TOK_PARTIAL;
- switch (BYTE_TYPE(enc, ptr)) {
- case BT_EXCL:
- return PREFIX(scanDecl)(enc, ptr + MINBPC(enc), end, nextTokPtr);
- case BT_QUEST:
- return PREFIX(scanPi)(enc, ptr + MINBPC(enc), end, nextTokPtr);
- case BT_NMSTRT:
- case BT_HEX:
- case BT_NONASCII:
- case BT_LEAD2:
- case BT_LEAD3:
- case BT_LEAD4:
- *nextTokPtr = ptr - MINBPC(enc);
- return XML_TOK_INSTANCE_START;
- }
- *nextTokPtr = ptr;
- return XML_TOK_INVALID;
- }
- case BT_CR:
- if (ptr + MINBPC(enc) == end)
- return -XML_TOK_PROLOG_S;
- /* fall through */
- case BT_S: case BT_LF:
- for (;;) {
- ptr += MINBPC(enc);
- if (ptr == end)
- break;
- switch (BYTE_TYPE(enc, ptr)) {
- case BT_S: case BT_LF:
- break;
- case BT_CR:
- /* don't split CR/LF pair */
- if (ptr + MINBPC(enc) != end)
- break;
- /* fall through */
- default:
- *nextTokPtr = ptr;
- return XML_TOK_PROLOG_S;
- }
- }
- *nextTokPtr = ptr;
- return XML_TOK_PROLOG_S;
- case BT_PERCNT:
- return PREFIX(scanPercent)(enc, ptr + MINBPC(enc), end, nextTokPtr);
- case BT_COMMA:
- *nextTokPtr = ptr + MINBPC(enc);
- return XML_TOK_COMMA;
- case BT_LSQB:
- *nextTokPtr = ptr + MINBPC(enc);
- return XML_TOK_OPEN_BRACKET;
- case BT_RSQB:
- ptr += MINBPC(enc);
- if (ptr == end)
- return -XML_TOK_CLOSE_BRACKET;
- if (CHAR_MATCHES(enc, ptr, ASCII_RSQB)) {
- if (ptr + MINBPC(enc) == end)
- return XML_TOK_PARTIAL;
- if (CHAR_MATCHES(enc, ptr + MINBPC(enc), ASCII_GT)) {
- *nextTokPtr = ptr + 2*MINBPC(enc);
- return XML_TOK_COND_SECT_CLOSE;
- }
- }
- *nextTokPtr = ptr;
- return XML_TOK_CLOSE_BRACKET;
- case BT_LPAR:
- *nextTokPtr = ptr + MINBPC(enc);
- return XML_TOK_OPEN_PAREN;
- case BT_RPAR:
- ptr += MINBPC(enc);
- if (ptr == end)
- return -XML_TOK_CLOSE_PAREN;
- switch (BYTE_TYPE(enc, ptr)) {
- case BT_AST:
- *nextTokPtr = ptr + MINBPC(enc);
- return XML_TOK_CLOSE_PAREN_ASTERISK;
- case BT_QUEST:
- *nextTokPtr = ptr + MINBPC(enc);
- return XML_TOK_CLOSE_PAREN_QUESTION;
- case BT_PLUS:
- *nextTokPtr = ptr + MINBPC(enc);
- return XML_TOK_CLOSE_PAREN_PLUS;
- case BT_CR: case BT_LF: case BT_S:
- case BT_GT: case BT_COMMA: case BT_VERBAR:
- case BT_RPAR:
- *nextTokPtr = ptr;
- return XML_TOK_CLOSE_PAREN;
- }
- *nextTokPtr = ptr;
- return XML_TOK_INVALID;
- case BT_VERBAR:
- *nextTokPtr = ptr + MINBPC(enc);
- return XML_TOK_OR;
- case BT_GT:
- *nextTokPtr = ptr + MINBPC(enc);
- return XML_TOK_DECL_CLOSE;
- case BT_NUM:
- return PREFIX(scanPoundName)(enc, ptr + MINBPC(enc), end, nextTokPtr);
-#define LEAD_CASE(n) \
- case BT_LEAD ## n: \
- if (end - ptr < n) \
- return XML_TOK_PARTIAL_CHAR; \
- if (IS_NMSTRT_CHAR(enc, ptr, n)) { \
- ptr += n; \
- tok = XML_TOK_NAME; \
- break; \
- } \
- if (IS_NAME_CHAR(enc, ptr, n)) { \
- ptr += n; \
- tok = XML_TOK_NMTOKEN; \
- break; \
- } \
- *nextTokPtr = ptr; \
- return XML_TOK_INVALID;
- LEAD_CASE(2) LEAD_CASE(3) LEAD_CASE(4)
-#undef LEAD_CASE
- case BT_NMSTRT:
- case BT_HEX:
- tok = XML_TOK_NAME;
- ptr += MINBPC(enc);
- break;
- case BT_DIGIT:
- case BT_NAME:
- case BT_MINUS:
-#ifdef XML_NS
- case BT_COLON:
-#endif
- tok = XML_TOK_NMTOKEN;
- ptr += MINBPC(enc);
- break;
- case BT_NONASCII:
- if (IS_NMSTRT_CHAR_MINBPC(enc, ptr)) {
- ptr += MINBPC(enc);
- tok = XML_TOK_NAME;
- break;
- }
- if (IS_NAME_CHAR_MINBPC(enc, ptr)) {
- ptr += MINBPC(enc);
- tok = XML_TOK_NMTOKEN;
- break;
- }
- /* fall through */
- default:
- *nextTokPtr = ptr;
- return XML_TOK_INVALID;
- }
- while (ptr != end) {
- switch (BYTE_TYPE(enc, ptr)) {
- CHECK_NAME_CASES(enc, ptr, end, nextTokPtr)
- case BT_GT: case BT_RPAR: case BT_COMMA:
- case BT_VERBAR: case BT_LSQB: case BT_PERCNT:
- case BT_S: case BT_CR: case BT_LF:
- *nextTokPtr = ptr;
- return tok;
-#ifdef XML_NS
- case BT_COLON:
- ptr += MINBPC(enc);
- switch (tok) {
- case XML_TOK_NAME:
- if (ptr == end)
- return XML_TOK_PARTIAL;
- tok = XML_TOK_PREFIXED_NAME;
- switch (BYTE_TYPE(enc, ptr)) {
- CHECK_NAME_CASES(enc, ptr, end, nextTokPtr)
- default:
- tok = XML_TOK_NMTOKEN;
- break;
- }
- break;
- case XML_TOK_PREFIXED_NAME:
- tok = XML_TOK_NMTOKEN;
- break;
- }
- break;
-#endif
- case BT_PLUS:
- if (tok == XML_TOK_NMTOKEN) {
- *nextTokPtr = ptr;
- return XML_TOK_INVALID;
- }
- *nextTokPtr = ptr + MINBPC(enc);
- return XML_TOK_NAME_PLUS;
- case BT_AST:
- if (tok == XML_TOK_NMTOKEN) {
- *nextTokPtr = ptr;
- return XML_TOK_INVALID;
- }
- *nextTokPtr = ptr + MINBPC(enc);
- return XML_TOK_NAME_ASTERISK;
- case BT_QUEST:
- if (tok == XML_TOK_NMTOKEN) {
- *nextTokPtr = ptr;
- return XML_TOK_INVALID;
- }
- *nextTokPtr = ptr + MINBPC(enc);
- return XML_TOK_NAME_QUESTION;
- default:
- *nextTokPtr = ptr;
- return XML_TOK_INVALID;
- }
- }
- return -tok;
-}
-
-static
-int PREFIX(attributeValueTok)(const ENCODING *enc, const char *ptr, const char *end,
- const char **nextTokPtr)
-{
- const char *start;
- if (ptr == end)
- return XML_TOK_NONE;
- start = ptr;
- while (ptr != end) {
- switch (BYTE_TYPE(enc, ptr)) {
-#define LEAD_CASE(n) \
- case BT_LEAD ## n: ptr += n; break;
- LEAD_CASE(2) LEAD_CASE(3) LEAD_CASE(4)
-#undef LEAD_CASE
- case BT_AMP:
- if (ptr == start)
- return PREFIX(scanRef)(enc, ptr + MINBPC(enc), end, nextTokPtr);
- *nextTokPtr = ptr;
- return XML_TOK_DATA_CHARS;
- case BT_LT:
- /* this is for inside entity references */
- *nextTokPtr = ptr;
- return XML_TOK_INVALID;
- case BT_LF:
- if (ptr == start) {
- *nextTokPtr = ptr + MINBPC(enc);
- return XML_TOK_DATA_NEWLINE;
- }
- *nextTokPtr = ptr;
- return XML_TOK_DATA_CHARS;
- case BT_CR:
- if (ptr == start) {
- ptr += MINBPC(enc);
- if (ptr == end)
- return XML_TOK_TRAILING_CR;
- if (BYTE_TYPE(enc, ptr) == BT_LF)
- ptr += MINBPC(enc);
- *nextTokPtr = ptr;
- return XML_TOK_DATA_NEWLINE;
- }
- *nextTokPtr = ptr;
- return XML_TOK_DATA_CHARS;
- case BT_S:
- if (ptr == start) {
- *nextTokPtr = ptr + MINBPC(enc);
- return XML_TOK_ATTRIBUTE_VALUE_S;
- }
- *nextTokPtr = ptr;
- return XML_TOK_DATA_CHARS;
- default:
- ptr += MINBPC(enc);
- break;
- }
- }
- *nextTokPtr = ptr;
- return XML_TOK_DATA_CHARS;
-}
-
-static
-int PREFIX(entityValueTok)(const ENCODING *enc, const char *ptr, const char *end,
- const char **nextTokPtr)
-{
- const char *start;
- if (ptr == end)
- return XML_TOK_NONE;
- start = ptr;
- while (ptr != end) {
- switch (BYTE_TYPE(enc, ptr)) {
-#define LEAD_CASE(n) \
- case BT_LEAD ## n: ptr += n; break;
- LEAD_CASE(2) LEAD_CASE(3) LEAD_CASE(4)
-#undef LEAD_CASE
- case BT_AMP:
- if (ptr == start)
- return PREFIX(scanRef)(enc, ptr + MINBPC(enc), end, nextTokPtr);
- *nextTokPtr = ptr;
- return XML_TOK_DATA_CHARS;
- case BT_PERCNT:
- if (ptr == start) {
- int tok = PREFIX(scanPercent)(enc, ptr + MINBPC(enc),
- end, nextTokPtr);
- return (tok == XML_TOK_PERCENT) ? XML_TOK_INVALID : tok;
- }
- *nextTokPtr = ptr;
- return XML_TOK_DATA_CHARS;
- case BT_LF:
- if (ptr == start) {
- *nextTokPtr = ptr + MINBPC(enc);
- return XML_TOK_DATA_NEWLINE;
- }
- *nextTokPtr = ptr;
- return XML_TOK_DATA_CHARS;
- case BT_CR:
- if (ptr == start) {
- ptr += MINBPC(enc);
- if (ptr == end)
- return XML_TOK_TRAILING_CR;
- if (BYTE_TYPE(enc, ptr) == BT_LF)
- ptr += MINBPC(enc);
- *nextTokPtr = ptr;
- return XML_TOK_DATA_NEWLINE;
- }
- *nextTokPtr = ptr;
- return XML_TOK_DATA_CHARS;
- default:
- ptr += MINBPC(enc);
- break;
- }
- }
- *nextTokPtr = ptr;
- return XML_TOK_DATA_CHARS;
-}
-
-#ifdef XML_DTD
-
-static
-int PREFIX(ignoreSectionTok)(const ENCODING *enc, const char *ptr, const char *end,
- const char **nextTokPtr)
-{
- int level = 0;
- if (MINBPC(enc) > 1) {
- size_t n = end - ptr;
- if (n & (MINBPC(enc) - 1)) {
- n &= ~(MINBPC(enc) - 1);
- end = ptr + n;
- }
- }
- while (ptr != end) {
- switch (BYTE_TYPE(enc, ptr)) {
- INVALID_CASES(ptr, nextTokPtr)
- case BT_LT:
- if ((ptr += MINBPC(enc)) == end)
- return XML_TOK_PARTIAL;
- if (CHAR_MATCHES(enc, ptr, ASCII_EXCL)) {
- if ((ptr += MINBPC(enc)) == end)
- return XML_TOK_PARTIAL;
- if (CHAR_MATCHES(enc, ptr, ASCII_LSQB)) {
- ++level;
- ptr += MINBPC(enc);
- }
- }
- break;
- case BT_RSQB:
- if ((ptr += MINBPC(enc)) == end)
- return XML_TOK_PARTIAL;
- if (CHAR_MATCHES(enc, ptr, ASCII_RSQB)) {
- if ((ptr += MINBPC(enc)) == end)
- return XML_TOK_PARTIAL;
- if (CHAR_MATCHES(enc, ptr, ASCII_GT)) {
- ptr += MINBPC(enc);
- if (level == 0) {
- *nextTokPtr = ptr;
- return XML_TOK_IGNORE_SECT;
- }
- --level;
- }
- }
- break;
- default:
- ptr += MINBPC(enc);
- break;
- }
- }
- return XML_TOK_PARTIAL;
-}
-
-#endif /* XML_DTD */
-
-static
-int PREFIX(isPublicId)(const ENCODING *enc, const char *ptr, const char *end,
- const char **badPtr)
-{
- ptr += MINBPC(enc);
- end -= MINBPC(enc);
- for (; ptr != end; ptr += MINBPC(enc)) {
- switch (BYTE_TYPE(enc, ptr)) {
- case BT_DIGIT:
- case BT_HEX:
- case BT_MINUS:
- case BT_APOS:
- case BT_LPAR:
- case BT_RPAR:
- case BT_PLUS:
- case BT_COMMA:
- case BT_SOL:
- case BT_EQUALS:
- case BT_QUEST:
- case BT_CR:
- case BT_LF:
- case BT_SEMI:
- case BT_EXCL:
- case BT_AST:
- case BT_PERCNT:
- case BT_NUM:
-#ifdef XML_NS
- case BT_COLON:
-#endif
- break;
- case BT_S:
- if (CHAR_MATCHES(enc, ptr, ASCII_TAB)) {
- *badPtr = ptr;
- return 0;
- }
- break;
- case BT_NAME:
- case BT_NMSTRT:
- if (!(BYTE_TO_ASCII(enc, ptr) & ~0x7f))
- break;
- default:
- switch (BYTE_TO_ASCII(enc, ptr)) {
- case 0x24: /* $ */
- case 0x40: /* @ */
- break;
- default:
- *badPtr = ptr;
- return 0;
- }
- break;
- }
- }
- return 1;
-}
-
-/* This must only be called for a well-formed start-tag or empty element tag.
-Returns the number of attributes. Pointers to the first attsMax attributes
-are stored in atts. */
-
-static
-int PREFIX(getAtts)(const ENCODING *enc, const char *ptr,
- int attsMax, ATTRIBUTE *atts)
-{
- enum { other, inName, inValue } state = inName;
- int nAtts = 0;
- int open = 0; /* defined when state == inValue;
- initialization just to shut up compilers */
-
- for (ptr += MINBPC(enc);; ptr += MINBPC(enc)) {
- switch (BYTE_TYPE(enc, ptr)) {
-#define START_NAME \
- if (state == other) { \
- if (nAtts < attsMax) { \
- atts[nAtts].name = ptr; \
- atts[nAtts].normalized = 1; \
- } \
- state = inName; \
- }
-#define LEAD_CASE(n) \
- case BT_LEAD ## n: START_NAME ptr += (n - MINBPC(enc)); break;
- LEAD_CASE(2) LEAD_CASE(3) LEAD_CASE(4)
-#undef LEAD_CASE
- case BT_NONASCII:
- case BT_NMSTRT:
- case BT_HEX:
- START_NAME
- break;
-#undef START_NAME
- case BT_QUOT:
- if (state != inValue) {
- if (nAtts < attsMax)
- atts[nAtts].valuePtr = ptr + MINBPC(enc);
- state = inValue;
- open = BT_QUOT;
- }
- else if (open == BT_QUOT) {
- state = other;
- if (nAtts < attsMax)
- atts[nAtts].valueEnd = ptr;
- nAtts++;
- }
- break;
- case BT_APOS:
- if (state != inValue) {
- if (nAtts < attsMax)
- atts[nAtts].valuePtr = ptr + MINBPC(enc);
- state = inValue;
- open = BT_APOS;
- }
- else if (open == BT_APOS) {
- state = other;
- if (nAtts < attsMax)
- atts[nAtts].valueEnd = ptr;
- nAtts++;
- }
- break;
- case BT_AMP:
- if (nAtts < attsMax)
- atts[nAtts].normalized = 0;
- break;
- case BT_S:
- if (state == inName)
- state = other;
- else if (state == inValue
- && nAtts < attsMax
- && atts[nAtts].normalized
- && (ptr == atts[nAtts].valuePtr
- || BYTE_TO_ASCII(enc, ptr) != ASCII_SPACE
- || BYTE_TO_ASCII(enc, ptr + MINBPC(enc)) == ASCII_SPACE
- || BYTE_TYPE(enc, ptr + MINBPC(enc)) == open))
- atts[nAtts].normalized = 0;
- break;
- case BT_CR: case BT_LF:
- /* This case ensures that the first attribute name is counted
- Apart from that we could just change state on the quote. */
- if (state == inName)
- state = other;
- else if (state == inValue && nAtts < attsMax)
- atts[nAtts].normalized = 0;
- break;
- case BT_GT:
- case BT_SOL:
- if (state != inValue)
- return nAtts;
- break;
- default:
- break;
- }
- }
- /* not reached */
-}
-
-static
-int PREFIX(charRefNumber)(const ENCODING *enc, const char *ptr)
-{
- int result = 0;
- /* skip &# */
- ptr += 2*MINBPC(enc);
- if (CHAR_MATCHES(enc, ptr, ASCII_x)) {
- for (ptr += MINBPC(enc); !CHAR_MATCHES(enc, ptr, ASCII_SEMI); ptr += MINBPC(enc)) {
- int c = BYTE_TO_ASCII(enc, ptr);
- switch (c) {
- case ASCII_0: case ASCII_1: case ASCII_2: case ASCII_3: case ASCII_4:
- case ASCII_5: case ASCII_6: case ASCII_7: case ASCII_8: case ASCII_9:
- result <<= 4;
- result |= (c - ASCII_0);
- break;
- case ASCII_A: case ASCII_B: case ASCII_C: case ASCII_D: case ASCII_E: case ASCII_F:
- result <<= 4;
- result += 10 + (c - ASCII_A);
- break;
- case ASCII_a: case ASCII_b: case ASCII_c: case ASCII_d: case ASCII_e: case ASCII_f:
- result <<= 4;
- result += 10 + (c - ASCII_a);
- break;
- }
- if (result >= 0x110000)
- return -1;
- }
- }
- else {
- for (; !CHAR_MATCHES(enc, ptr, ASCII_SEMI); ptr += MINBPC(enc)) {
- int c = BYTE_TO_ASCII(enc, ptr);
- result *= 10;
- result += (c - ASCII_0);
- if (result >= 0x110000)
- return -1;
- }
- }
- return checkCharRefNumber(result);
-}
-
-static
-int PREFIX(predefinedEntityName)(const ENCODING *enc, const char *ptr, const char *end)
-{
- switch ((end - ptr)/MINBPC(enc)) {
- case 2:
- if (CHAR_MATCHES(enc, ptr + MINBPC(enc), ASCII_t)) {
- switch (BYTE_TO_ASCII(enc, ptr)) {
- case ASCII_l:
- return ASCII_LT;
- case ASCII_g:
- return ASCII_GT;
- }
- }
- break;
- case 3:
- if (CHAR_MATCHES(enc, ptr, ASCII_a)) {
- ptr += MINBPC(enc);
- if (CHAR_MATCHES(enc, ptr, ASCII_m)) {
- ptr += MINBPC(enc);
- if (CHAR_MATCHES(enc, ptr, ASCII_p))
- return ASCII_AMP;
- }
- }
- break;
- case 4:
- switch (BYTE_TO_ASCII(enc, ptr)) {
- case ASCII_q:
- ptr += MINBPC(enc);
- if (CHAR_MATCHES(enc, ptr, ASCII_u)) {
- ptr += MINBPC(enc);
- if (CHAR_MATCHES(enc, ptr, ASCII_o)) {
- ptr += MINBPC(enc);
- if (CHAR_MATCHES(enc, ptr, ASCII_t))
- return ASCII_QUOT;
- }
- }
- break;
- case ASCII_a:
- ptr += MINBPC(enc);
- if (CHAR_MATCHES(enc, ptr, ASCII_p)) {
- ptr += MINBPC(enc);
- if (CHAR_MATCHES(enc, ptr, ASCII_o)) {
- ptr += MINBPC(enc);
- if (CHAR_MATCHES(enc, ptr, ASCII_s))
- return ASCII_APOS;
- }
- }
- break;
- }
- }
- return 0;
-}
-
-static
-int PREFIX(sameName)(const ENCODING *enc, const char *ptr1, const char *ptr2)
-{
- for (;;) {
- switch (BYTE_TYPE(enc, ptr1)) {
-#define LEAD_CASE(n) \
- case BT_LEAD ## n: \
- if (*ptr1++ != *ptr2++) \
- return 0;
- LEAD_CASE(4) LEAD_CASE(3) LEAD_CASE(2)
-#undef LEAD_CASE
- /* fall through */
- if (*ptr1++ != *ptr2++)
- return 0;
- break;
- case BT_NONASCII:
- case BT_NMSTRT:
-#ifdef XML_NS
- case BT_COLON:
-#endif
- case BT_HEX:
- case BT_DIGIT:
- case BT_NAME:
- case BT_MINUS:
- if (*ptr2++ != *ptr1++)
- return 0;
- if (MINBPC(enc) > 1) {
- if (*ptr2++ != *ptr1++)
- return 0;
- if (MINBPC(enc) > 2) {
- if (*ptr2++ != *ptr1++)
- return 0;
- if (MINBPC(enc) > 3) {
- if (*ptr2++ != *ptr1++)
- return 0;
- }
- }
- }
- break;
- default:
- if (MINBPC(enc) == 1 && *ptr1 == *ptr2)
- return 1;
- switch (BYTE_TYPE(enc, ptr2)) {
- case BT_LEAD2:
- case BT_LEAD3:
- case BT_LEAD4:
- case BT_NONASCII:
- case BT_NMSTRT:
-#ifdef XML_NS
- case BT_COLON:
-#endif
- case BT_HEX:
- case BT_DIGIT:
- case BT_NAME:
- case BT_MINUS:
- return 0;
- default:
- return 1;
- }
- }
- }
- /* not reached */
-}
-
-static
-int PREFIX(nameMatchesAscii)(const ENCODING *enc, const char *ptr1,
- const char *end1, const char *ptr2)
-{
- for (; *ptr2; ptr1 += MINBPC(enc), ptr2++) {
- if (ptr1 == end1)
- return 0;
- if (!CHAR_MATCHES(enc, ptr1, *ptr2))
- return 0;
- }
- return ptr1 == end1;
-}
-
-static
-int PREFIX(nameLength)(const ENCODING *enc, const char *ptr)
-{
- const char *start = ptr;
- for (;;) {
- switch (BYTE_TYPE(enc, ptr)) {
-#define LEAD_CASE(n) \
- case BT_LEAD ## n: ptr += n; break;
- LEAD_CASE(2) LEAD_CASE(3) LEAD_CASE(4)
-#undef LEAD_CASE
- case BT_NONASCII:
- case BT_NMSTRT:
-#ifdef XML_NS
- case BT_COLON:
-#endif
- case BT_HEX:
- case BT_DIGIT:
- case BT_NAME:
- case BT_MINUS:
- ptr += MINBPC(enc);
- break;
- default:
- return ptr - start;
- }
- }
-}
-
-static
-const char *PREFIX(skipS)(const ENCODING *enc, const char *ptr)
-{
- for (;;) {
- switch (BYTE_TYPE(enc, ptr)) {
- case BT_LF:
- case BT_CR:
- case BT_S:
- ptr += MINBPC(enc);
- break;
- default:
- return ptr;
- }
- }
-}
-
-static
-void PREFIX(updatePosition)(const ENCODING *enc,
- const char *ptr,
- const char *end,
- POSITION *pos)
-{
- while (ptr != end) {
- switch (BYTE_TYPE(enc, ptr)) {
-#define LEAD_CASE(n) \
- case BT_LEAD ## n: \
- ptr += n; \
- break;
- LEAD_CASE(2) LEAD_CASE(3) LEAD_CASE(4)
-#undef LEAD_CASE
- case BT_LF:
- pos->columnNumber = (unsigned)-1;
- pos->lineNumber++;
- ptr += MINBPC(enc);
- break;
- case BT_CR:
- pos->lineNumber++;
- ptr += MINBPC(enc);
- if (ptr != end && BYTE_TYPE(enc, ptr) == BT_LF)
- ptr += MINBPC(enc);
- pos->columnNumber = (unsigned)-1;
- break;
- default:
- ptr += MINBPC(enc);
- break;
- }
- pos->columnNumber++;
- }
-}
-
-#undef DO_LEAD_CASE
-#undef MULTIBYTE_CASES
-#undef INVALID_CASES
-#undef CHECK_NAME_CASE
-#undef CHECK_NAME_CASES
-#undef CHECK_NMSTRT_CASE
-#undef CHECK_NMSTRT_CASES
diff --git a/ext/xml/expat/xmltok_impl.h b/ext/xml/expat/xmltok_impl.h
deleted file mode 100644
index da0ea60a65..0000000000
--- a/ext/xml/expat/xmltok_impl.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
-Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
-See the file COPYING for copying permission.
-*/
-
-enum {
- BT_NONXML,
- BT_MALFORM,
- BT_LT,
- BT_AMP,
- BT_RSQB,
- BT_LEAD2,
- BT_LEAD3,
- BT_LEAD4,
- BT_TRAIL,
- BT_CR,
- BT_LF,
- BT_GT,
- BT_QUOT,
- BT_APOS,
- BT_EQUALS,
- BT_QUEST,
- BT_EXCL,
- BT_SOL,
- BT_SEMI,
- BT_NUM,
- BT_LSQB,
- BT_S,
- BT_NMSTRT,
- BT_COLON,
- BT_HEX,
- BT_DIGIT,
- BT_NAME,
- BT_MINUS,
- BT_OTHER, /* known not to be a name or name start character */
- BT_NONASCII, /* might be a name or name start character */
- BT_PERCNT,
- BT_LPAR,
- BT_RPAR,
- BT_AST,
- BT_PLUS,
- BT_COMMA,
- BT_VERBAR
-};
-
-#include <stddef.h>
diff --git a/ext/xml/expat/xmltok_ns.c b/ext/xml/expat/xmltok_ns.c
deleted file mode 100644
index 21859738ac..0000000000
--- a/ext/xml/expat/xmltok_ns.c
+++ /dev/null
@@ -1,98 +0,0 @@
-const ENCODING *NS(XmlGetUtf8InternalEncoding)(void)
-{
- return &ns(internal_utf8_encoding).enc;
-}
-
-const ENCODING *NS(XmlGetUtf16InternalEncoding)(void)
-{
-#if XML_BYTE_ORDER == 12
- return &ns(internal_little2_encoding).enc;
-#elif XML_BYTE_ORDER == 21
- return &ns(internal_big2_encoding).enc;
-#else
- const short n = 1;
- return *(const char *)&n ? &ns(internal_little2_encoding).enc : &ns(internal_big2_encoding).enc;
-#endif
-}
-
-static
-const ENCODING *NS(encodings)[] = {
- &ns(latin1_encoding).enc,
- &ns(ascii_encoding).enc,
- &ns(utf8_encoding).enc,
- &ns(big2_encoding).enc,
- &ns(big2_encoding).enc,
- &ns(little2_encoding).enc,
- &ns(utf8_encoding).enc /* NO_ENC */
-};
-
-static
-int NS(initScanProlog)(const ENCODING *enc, const char *ptr, const char *end,
- const char **nextTokPtr)
-{
- return initScan(NS(encodings), (const INIT_ENCODING *)enc, XML_PROLOG_STATE, ptr, end, nextTokPtr);
-}
-
-static
-int NS(initScanContent)(const ENCODING *enc, const char *ptr, const char *end,
- const char **nextTokPtr)
-{
- return initScan(NS(encodings), (const INIT_ENCODING *)enc, XML_CONTENT_STATE, ptr, end, nextTokPtr);
-}
-
-int NS(XmlInitEncoding)(INIT_ENCODING *p, const ENCODING **encPtr, const char *name)
-{
- int i = getEncodingIndex(name);
- if (i == UNKNOWN_ENC)
- return 0;
- SET_INIT_ENC_INDEX(p, i);
- p->initEnc.scanners[XML_PROLOG_STATE] = NS(initScanProlog);
- p->initEnc.scanners[XML_CONTENT_STATE] = NS(initScanContent);
- p->initEnc.updatePosition = initUpdatePosition;
- p->encPtr = encPtr;
- *encPtr = &(p->initEnc);
- return 1;
-}
-
-static
-const ENCODING *NS(findEncoding)(const ENCODING *enc, const char *ptr, const char *end)
-{
-#define ENCODING_MAX 128
- char buf[ENCODING_MAX];
- char *p = buf;
- int i;
- XmlUtf8Convert(enc, &ptr, end, &p, p + ENCODING_MAX - 1);
- if (ptr != end)
- return 0;
- *p = 0;
- if (streqci(buf, KW_UTF_16) && enc->minBytesPerChar == 2)
- return enc;
- i = getEncodingIndex(buf);
- if (i == UNKNOWN_ENC)
- return 0;
- return NS(encodings)[i];
-}
-
-int NS(XmlParseXmlDecl)(int isGeneralTextEntity,
- const ENCODING *enc,
- const char *ptr,
- const char *end,
- const char **badPtr,
- const char **versionPtr,
- const char **versionEndPtr,
- const char **encodingName,
- const ENCODING **encoding,
- int *standalone)
-{
- return doParseXmlDecl(NS(findEncoding),
- isGeneralTextEntity,
- enc,
- ptr,
- end,
- badPtr,
- versionPtr,
- versionEndPtr,
- encodingName,
- encoding,
- standalone);
-}
diff --git a/ext/xml/php_xml.h b/ext/xml/php_xml.h
deleted file mode 100644
index ed2f709793..0000000000
--- a/ext/xml/php_xml.h
+++ /dev/null
@@ -1,164 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Stig Sæther Bakken <ssb@fast.no> |
- | Thies C. Arntzen <thies@thieso.net> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef PHP_XML_H
-#define PHP_XML_H
-
-#ifdef HAVE_LIBEXPAT
-
-extern zend_module_entry xml_module_entry;
-#define xml_module_ptr &xml_module_entry
-
-#else
-
-#define xml_module_ptr NULL
-
-#endif
-
-#if defined(PHP_XML_INTERNAL)
-
-#include <expat.h>
-
-#ifdef PHP_WIN32
-#define PHP_XML_API __declspec(dllexport)
-#else
-#define PHP_XML_API
-#endif
-
-
-#ifdef XML_UNICODE
-#error "UTF-16 Unicode support not implemented!"
-#endif
-
-typedef struct {
- XML_Char *default_encoding;
-} php_xml_globals;
-
-typedef struct {
- int index;
- int case_folding;
- XML_Parser parser;
- XML_Char *target_encoding;
- zval *startElementHandler;
- zval *endElementHandler;
- zval *characterDataHandler;
- zval *processingInstructionHandler;
- zval *defaultHandler;
- zval *unparsedEntityDeclHandler;
- zval *notationDeclHandler;
- zval *externalEntityRefHandler;
- zval *unknownEncodingHandler;
- zval *startNamespaceDeclHandler;
- zval *endNamespaceDeclHandler;
- zval *object;
-
- zval *data;
- zval *info;
- int level;
- int toffset;
- int curtag;
- pval **ctag;
- char **ltags;
- int lastwasopen;
- int skipwhite;
-
- XML_Char *baseURI;
-} xml_parser;
-
-
-typedef struct {
- XML_Char *name;
- char (*decoding_function)(unsigned short);
- unsigned short (*encoding_function)(unsigned char);
-} xml_encoding;
-
-
-enum php_xml_option {
- PHP_XML_OPTION_CASE_FOLDING = 1,
- PHP_XML_OPTION_TARGET_ENCODING,
- PHP_XML_OPTION_SKIP_TAGSTART,
- PHP_XML_OPTION_SKIP_WHITE
-};
-
-#define RETURN_OUT_OF_MEMORY \
- php_error(E_WARNING, "Out of memory");\
- RETURN_FALSE
-
-/* for xml_parse_into_struct */
-
-#define XML_MAXLEVEL 255 /* XXX this should be dynamic */
-
-PHP_FUNCTION(xml_parser_create);
-PHP_FUNCTION(xml_parser_create_ns);
-PHP_FUNCTION(xml_set_object);
-PHP_FUNCTION(xml_set_element_handler);
-PHP_FUNCTION(xml_set_character_data_handler);
-PHP_FUNCTION(xml_set_processing_instruction_handler);
-PHP_FUNCTION(xml_set_default_handler);
-PHP_FUNCTION(xml_set_unparsed_entity_decl_handler);
-PHP_FUNCTION(xml_set_notation_decl_handler);
-PHP_FUNCTION(xml_set_external_entity_ref_handler);
-PHP_FUNCTION(xml_set_start_namespace_decl_handler);
-PHP_FUNCTION(xml_set_end_namespace_decl_handler);
-PHP_FUNCTION(xml_parse);
-PHP_FUNCTION(xml_get_error_code);
-PHP_FUNCTION(xml_error_string);
-PHP_FUNCTION(xml_get_current_line_number);
-PHP_FUNCTION(xml_get_current_column_number);
-PHP_FUNCTION(xml_get_current_byte_index);
-PHP_FUNCTION(xml_parser_free);
-PHP_FUNCTION(xml_parser_set_option);
-PHP_FUNCTION(xml_parser_get_option);
-PHP_FUNCTION(utf8_encode);
-PHP_FUNCTION(utf8_decode);
-PHP_FUNCTION(xml_parse_into_struct);
-
-PHPAPI char *_xml_zval_strdup(zval *val);
-PHPAPI char *xml_utf8_decode(const XML_Char *, int, int *, const XML_Char *);
-
-#endif /* HAVE_LIBEXPAT */
-
-#define phpext_xml_ptr xml_module_ptr
-
-#ifdef ZTS
-#define XMLLS_D php_xml_globals *xml_globals
-#define XMLLS_DC , PSLS_D
-#define XMLLS_C xml_globals
-#define XMLLS_CC , XMLLS_C
-#define XML(v) (xml_globals->v)
-#define XMLLS_FETCH() php_xml_globals *xml_globals = ts_resource(xml_globals_id)
-#else
-#define XMLLS_D
-#define XMLLS_DC
-#define XMLLS_C
-#define XMLLS_CC
-#define XML(v) (xml_globals.v)
-#define XMLLS_FETCH()
-#endif
-
-#endif /* PHP_XML_H */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/xml/tests/001.phpt b/ext/xml/tests/001.phpt
deleted file mode 100644
index ac19312ebf..0000000000
--- a/ext/xml/tests/001.phpt
+++ /dev/null
@@ -1,97 +0,0 @@
---TEST--
-XML parser test, function callbacks
---SKIPIF--
-<?php include("skipif.inc"); ?>
---FILE--
-<?php
-
-
-$xml_parser = xml_parser_create();
-xml_parser_set_option($xml_parser, XML_OPTION_CASE_FOLDING, 1);
-xml_set_element_handler($xml_parser, "startElement", "endElement");
-xml_set_character_data_handler($xml_parser, "characterData");
-xml_set_processing_instruction_handler($xml_parser, "PIHandler");
-xml_set_default_handler($xml_parser, "defaultHandler");
-xml_set_external_entity_ref_handler($xml_parser, "externalEntityRefHandler");
-
-if (!($fp = @fopen("xmltest.xml", "r"))) {
- die("could not open XML input");
-}
-
-while ($data = fread($fp, 4096)) {
- if (!xml_parse($xml_parser, $data, feof($fp))) {
- die(sprintf("XML error: %s at line %d\n",
- xml_error_string(xml_get_error_code($xml_parser)),
- xml_get_current_line_number($xml_parser)));
- }
-}
-print "parse complete\n";
-xml_parser_free($xml_parser);
-
-function startElement($parser, $name, $attribs)
-{
- print "\{$name";
- if (sizeof($attribs)) {
- while (list($k, $v) = each($attribs)) {
- print " $k=\"$v\"";
- }
- }
- print "}";
-}
-
-function endElement($parser, $name)
-{
- print "\{/$name}";
-}
-
-function characterData($parser, $data)
-{
- print "\{CDATA[$data]}";
-}
-
-function PIHandler($parser, $target, $data)
-{
- print "\{PI[$target,$data]}";
-}
-
-function defaultHandler($parser, $data)
-{
- if (substr($data, 0, 1) == "&" && substr($data, -1, 1) == ";") {
- print "\{ENTREF[$data]}";
- } else {
- print "\{?[$data]}";
- }
-}
-
-function externalEntityRefHandler($parser, $openEntityNames, $base, $systemId,
- $publicId)
-{
- print "\{EXTENTREF[$openEntityNames,$base,$systemId,$publicId]}\n";
- return true;
-}
-
-?>
---GET--
---POST--
---EXPECT--
-{?[<?xml version="1.0" encoding="ISO-8859-1"?>]}{?[
-]}{?[<!DOCTYPE]}{?[ ]}{?[phptest]}{?[ ]}{?[SYSTEM]}{?[ ]}{?["notfound.dtd"]}{?[ ]}{?[[]}{?[
-]}{?[<!ENTITY]}{?[ ]}{?[%]}{?[ ]}{?[incent]}{?[ ]}{?[SYSTEM]}{?[ ]}{?["inc.ent"]}{?[>]}{?[
-]}{?[%incent;]}{?[
-]}{?[]]}{?[>]}{?[
-]}{ROOT ID="elem1"}{CDATA[
-]}{CDATA[ Plain text.]}{CDATA[
-]}{CDATA[ ]}{ELEM1}{CDATA[
-]}{CDATA[ ]}{?[<!-- comment -->]}{CDATA[
-]}{CDATA[ ]}{ELEM2}{CDATA[
-]}{CDATA[ ]}{?[<![CDATA[]}{CDATA[CDATA block]}{?[]]>]}{CDATA[
-]}{CDATA[ ]}{ELEM3}{CDATA[
-]}{CDATA[ ]}{ENTREF[&included-entity;]}{CDATA[
-]}{CDATA[ ]}{ELEM4}{CDATA[
-]}{CDATA[ ]}{PI[test,processing instruction ]}{CDATA[
-]}{CDATA[ ]}{/ELEM4}{CDATA[
-]}{CDATA[ ]}{/ELEM3}{CDATA[
-]}{CDATA[ ]}{/ELEM2}{CDATA[
-]}{CDATA[ ]}{/ELEM1}{CDATA[
-]}{/ROOT}{?[
-]}parse complete
diff --git a/ext/xml/tests/002.phpt b/ext/xml/tests/002.phpt
deleted file mode 100644
index 017fe19db6..0000000000
--- a/ext/xml/tests/002.phpt
+++ /dev/null
@@ -1,90 +0,0 @@
---TEST--
-XML parser test, object tuple callbacks
---SKIPIF--
-<?php include("skipif.inc"); ?>
---FILE--
-<?php
-
-$xml_parser = xml_parser_create();
-$obj = new myclass;
-xml_parser_set_option($xml_parser, XML_OPTION_CASE_FOLDING, 1);
-xml_set_element_handler($xml_parser, array($obj,"startElement"),
- array($obj, "endElement"));
-xml_set_character_data_handler($xml_parser, array($obj, "characterData"));
-xml_set_processing_instruction_handler($xml_parser, array($obj, "PIHandler"));
-xml_set_default_handler($xml_parser, array($obj, "defaultHandler"));
-xml_set_external_entity_ref_handler($xml_parser,
- array($obj, "externalEntityRefHandler"));
-
-if (!($fp = @fopen("xmltest.xml", "r"))) {
- die("could not open XML input");
-}
-
-while ($data = fread($fp, 4096)) {
- if (!xml_parse($xml_parser, $data, feof($fp))) {
- die(sprintf("XML error: %s at line %d\n",
- xml_error_string(xml_get_error_code($xml_parser)),
- xml_get_current_line_number($xml_parser)));
- }
-}
-print "parse complete\n";
-xml_parser_free($xml_parser);
-
-class myclass {
- function startElement($parser, $name, $attribs) {
- print "\{$name";
- if (sizeof($attribs)) {
- while (list($k, $v) = each($attribs)) {
- print " $k=\"$v\"";
- }
- }
- print "}";
- }
- function endElement($parser, $name) {
- print "\{/$name}";
- }
- function characterData($parser, $data) {
- print "\{CDATA[$data]}";
- }
- function PIHandler($parser, $target, $data) {
- print "\{PI[$target,$data]}";
- }
- function defaultHandler($parser, $data) {
- if (substr($data, 0, 1) == "&" && substr($data, -1, 1) == ";") {
- print "\{ENTREF[$data]}";
- } else {
- print "\{?[$data]}";
- }
- }
- function externalEntityRefHandler($parser, $openEntityNames, $base,
- $systemId, $publicId) {
- print "\{EXTENTREF[$openEntityNames,$base,$systemId,$publicId]}\n";
- return true;
- }
-}
-
-?>
---GET--
---POST--
---EXPECT--
-{?[<?xml version="1.0" encoding="ISO-8859-1"?>]}{?[
-]}{?[<!DOCTYPE]}{?[ ]}{?[phptest]}{?[ ]}{?[SYSTEM]}{?[ ]}{?["notfound.dtd"]}{?[ ]}{?[[]}{?[
-]}{?[<!ENTITY]}{?[ ]}{?[%]}{?[ ]}{?[incent]}{?[ ]}{?[SYSTEM]}{?[ ]}{?["inc.ent"]}{?[>]}{?[
-]}{?[%incent;]}{?[
-]}{?[]]}{?[>]}{?[
-]}{ROOT ID="elem1"}{CDATA[
-]}{CDATA[ Plain text.]}{CDATA[
-]}{CDATA[ ]}{ELEM1}{CDATA[
-]}{CDATA[ ]}{?[<!-- comment -->]}{CDATA[
-]}{CDATA[ ]}{ELEM2}{CDATA[
-]}{CDATA[ ]}{?[<![CDATA[]}{CDATA[CDATA block]}{?[]]>]}{CDATA[
-]}{CDATA[ ]}{ELEM3}{CDATA[
-]}{CDATA[ ]}{ENTREF[&included-entity;]}{CDATA[
-]}{CDATA[ ]}{ELEM4}{CDATA[
-]}{CDATA[ ]}{PI[test,processing instruction ]}{CDATA[
-]}{CDATA[ ]}{/ELEM4}{CDATA[
-]}{CDATA[ ]}{/ELEM3}{CDATA[
-]}{CDATA[ ]}{/ELEM2}{CDATA[
-]}{CDATA[ ]}{/ELEM1}{CDATA[
-]}{/ROOT}{?[
-]}parse complete
diff --git a/ext/xml/tests/003.phpt b/ext/xml/tests/003.phpt
deleted file mode 100644
index acb9fc3394..0000000000
--- a/ext/xml/tests/003.phpt
+++ /dev/null
@@ -1,89 +0,0 @@
---TEST--
-XML parser test, xml_set_object callbacks
---SKIPIF--
-<?php include("skipif.inc"); ?>
---FILE--
-<?php
-
-$xml_parser = xml_parser_create();
-$obj = new myclass;
-xml_set_object($xml_parser, $obj);
-xml_parser_set_option($xml_parser, XML_OPTION_CASE_FOLDING, 1);
-xml_set_element_handler($xml_parser, "startElement", "endElement");
-xml_set_character_data_handler($xml_parser, "characterData");
-xml_set_processing_instruction_handler($xml_parser, "PIHandler");
-xml_set_default_handler($xml_parser, "defaultHandler");
-xml_set_external_entity_ref_handler($xml_parser, "externalEntityRefHandler");
-
-if (!($fp = @fopen("xmltest.xml", "r"))) {
- die("could not open XML input");
-}
-
-while ($data = fread($fp, 4096)) {
- if (!xml_parse($xml_parser, $data, feof($fp))) {
- die(sprintf("XML error: %s at line %d\n",
- xml_error_string(xml_get_error_code($xml_parser)),
- xml_get_current_line_number($xml_parser)));
- }
-}
-print "parse complete\n";
-xml_parser_free($xml_parser);
-
-class myclass {
- function startElement($parser, $name, $attribs) {
- print "\{$name";
- if (sizeof($attribs)) {
- while (list($k, $v) = each($attribs)) {
- print " $k=\"$v\"";
- }
- }
- print "}";
- }
- function endElement($parser, $name) {
- print "\{/$name}";
- }
- function characterData($parser, $data) {
- print "\{CDATA[$data]}";
- }
- function PIHandler($parser, $target, $data) {
- print "\{PI[$target,$data]}";
- }
- function defaultHandler($parser, $data) {
- if (substr($data, 0, 1) == "&" && substr($data, -1, 1) == ";") {
- print "\{ENTREF[$data]}";
- } else {
- print "\{?[$data]}";
- }
- }
- function externalEntityRefHandler($parser, $openEntityNames, $base,
- $systemId, $publicId) {
- print "\{EXTENTREF[$openEntityNames,$base,$systemId,$publicId]}\n";
- return true;
- }
-}
-
-?>
---GET--
---POST--
---EXPECT--
-{?[<?xml version="1.0" encoding="ISO-8859-1"?>]}{?[
-]}{?[<!DOCTYPE]}{?[ ]}{?[phptest]}{?[ ]}{?[SYSTEM]}{?[ ]}{?["notfound.dtd"]}{?[ ]}{?[[]}{?[
-]}{?[<!ENTITY]}{?[ ]}{?[%]}{?[ ]}{?[incent]}{?[ ]}{?[SYSTEM]}{?[ ]}{?["inc.ent"]}{?[>]}{?[
-]}{?[%incent;]}{?[
-]}{?[]]}{?[>]}{?[
-]}{ROOT ID="elem1"}{CDATA[
-]}{CDATA[ Plain text.]}{CDATA[
-]}{CDATA[ ]}{ELEM1}{CDATA[
-]}{CDATA[ ]}{?[<!-- comment -->]}{CDATA[
-]}{CDATA[ ]}{ELEM2}{CDATA[
-]}{CDATA[ ]}{?[<![CDATA[]}{CDATA[CDATA block]}{?[]]>]}{CDATA[
-]}{CDATA[ ]}{ELEM3}{CDATA[
-]}{CDATA[ ]}{ENTREF[&included-entity;]}{CDATA[
-]}{CDATA[ ]}{ELEM4}{CDATA[
-]}{CDATA[ ]}{PI[test,processing instruction ]}{CDATA[
-]}{CDATA[ ]}{/ELEM4}{CDATA[
-]}{CDATA[ ]}{/ELEM3}{CDATA[
-]}{CDATA[ ]}{/ELEM2}{CDATA[
-]}{CDATA[ ]}{/ELEM1}{CDATA[
-]}{/ROOT}{?[
-]}parse complete
diff --git a/ext/xml/tests/004.phpt b/ext/xml/tests/004.phpt
deleted file mode 100644
index 5788fcac37..0000000000
--- a/ext/xml/tests/004.phpt
+++ /dev/null
@@ -1,58 +0,0 @@
---TEST--
-XML parser case folding test
---SKIPIF--
-<?php include("skipif.inc"); ?>
---FILE--
-<?php
-$xp = xml_parser_create();
-xml_parser_set_option($xp, XML_OPTION_CASE_FOLDING, false);
-xml_set_element_handler($xp, "start_element", "end_element");
-$fp = fopen("xmltest.xml", "r");
-while ($data = fread($fp, 4096)) {
- xml_parse($xp, $data, feof($fp));
-}
-xml_parser_free($xp);
-$xp = xml_parser_create();
-xml_parser_set_option($xp, XML_OPTION_CASE_FOLDING, true);
-xml_set_element_handler($xp, "start_element", "end_element");
-$fp = fopen("xmltest.xml", "r");
-while ($data = fread($fp, 4096)) {
- xml_parse($xp, $data, feof($fp));
-}
-xml_parser_free($xp);
-function start_element($xp, $elem, $attribs) {
- print "<$elem";
- if (sizeof($attribs)) {
- while (list($k, $v) = each($attribs)) {
- print " $k=\"$v\"";
- }
- }
- print ">\n";
-}
-function end_element($xp, $elem) {
- print "</$elem>\n";
-}
-?>
---GET--
---POST--
---EXPECT--
-<root id="elem1">
-<elem1>
-<elem2>
-<elem3>
-<elem4>
-</elem4>
-</elem3>
-</elem2>
-</elem1>
-</root>
-<ROOT ID="elem1">
-<ELEM1>
-<ELEM2>
-<ELEM3>
-<ELEM4>
-</ELEM4>
-</ELEM3>
-</ELEM2>
-</ELEM1>
-</ROOT>
diff --git a/ext/xml/tests/006.phpt b/ext/xml/tests/006.phpt
deleted file mode 100644
index a1b339f0e0..0000000000
--- a/ext/xml/tests/006.phpt
+++ /dev/null
@@ -1,14 +0,0 @@
---TEST--
-UTF-8<->ISO Latin 1 encoding/decoding test
---SKIPIF--
-<?php include("skipif.inc"); ?>
---FILE--
-<?php
-printf("%s -> %s\n", urlencode("æ"), urlencode(utf8_encode("æ")));
-printf("%s <- %s\n", urlencode(utf8_decode(urldecode("%C3%A6"))), "%C3%A6");
-?>
---GET--
---POST--
---EXPECT--
-%E6 -> %C3%A6
-%E6 <- %C3%A6
diff --git a/ext/xml/tests/inc.ent b/ext/xml/tests/inc.ent
deleted file mode 100644
index 8f86465c2a..0000000000
--- a/ext/xml/tests/inc.ent
+++ /dev/null
@@ -1 +0,0 @@
-<!ENTITY included-entity "This is text included from an entity">
diff --git a/ext/xml/tests/skipif.inc b/ext/xml/tests/skipif.inc
deleted file mode 100644
index 1c33251b76..0000000000
--- a/ext/xml/tests/skipif.inc
+++ /dev/null
@@ -1,9 +0,0 @@
-<?php
-if (!extension_loaded("xml")) {
- $dlext = (substr(PHP_OS, 0, 3) == "WIN") ? ".dll" : ".so";
- @dl("xml$dlext");
-}
-if (!extension_loaded("xml")) {
- print "skip\n";
-}
-?>
diff --git a/ext/xml/tests/xmltest.xml b/ext/xml/tests/xmltest.xml
deleted file mode 100644
index c15d6ea1ab..0000000000
--- a/ext/xml/tests/xmltest.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!DOCTYPE phptest SYSTEM "notfound.dtd" [
-<!ENTITY % incent SYSTEM "inc.ent">
-%incent;
-]>
-<root id="elem1">
- Plain text.
- <elem1>
- <!-- comment -->
- <elem2>
- <![CDATA[CDATA block]]>
- <elem3>
- &included-entity;
- <elem4>
- <?test processing instruction ?>
- </elem4>
- </elem3>
- </elem2>
- </elem1>
-</root>
diff --git a/ext/xml/xml.c b/ext/xml/xml.c
deleted file mode 100644
index 3aaac36138..0000000000
--- a/ext/xml/xml.c
+++ /dev/null
@@ -1,1657 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Stig Sæther Bakken <ssb@fast.no> |
- | Thies C. Arntzen <thies@thieso.net> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-#define IS_EXT_MODULE
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-
-#define PHP_XML_INTERNAL
-#include "php_xml.h"
-#include "zend_variables.h"
-#include "ext/standard/php_string.h"
-#include "ext/standard/info.h"
-
-#if HAVE_LIBEXPAT
-
-#ifndef PHP_WIN32
-# include "build-defs.h"
-# endif
-# include "ext/standard/head.h"
-
-/* Short-term TODO list:
- * - Implement XML_ExternalEntityParserCreate()
- */
-
-/* Long-term TODO list:
- * - Fix the expat library so you can install your own memory manager
- * functions
- */
-
-/* Known bugs:
- * - Weird things happen with <![CDATA[]]> sections.
- */
-
-
-#ifdef ZTS
-int xml_globals_id;
-#else
-PHP_XML_API php_xml_globals xml_globals;
-#endif
-
-/* {{{ dynamically loadable module stuff */
-
-#ifdef COMPILE_DL_XML
-ZEND_GET_MODULE(xml)
-#endif /* COMPILE_DL_XML */
-
-/* }}} */
-/* {{{ function prototypes */
-
-PHP_MINIT_FUNCTION(xml);
-PHP_RINIT_FUNCTION(xml);
-PHP_MSHUTDOWN_FUNCTION(xml);
-PHP_RSHUTDOWN_FUNCTION(xml);
-PHP_MINFO_FUNCTION(xml);
-
-static void xml_parser_dtor(zend_rsrc_list_entry *rsrc);
-static void xml_set_handler(zval **, zval **);
-inline static unsigned short xml_encode_iso_8859_1(unsigned char);
-inline static char xml_decode_iso_8859_1(unsigned short);
-inline static unsigned short xml_encode_us_ascii(unsigned char);
-inline static char xml_decode_us_ascii(unsigned short);
-static XML_Char *xml_utf8_encode(const char *, int, int *, const XML_Char *);
-static zval *xml_call_handler(xml_parser *, zval *, int, zval **);
-static zval *_xml_xmlchar_zval(const XML_Char *, int, const XML_Char *);
-static int _xml_xmlcharlen(const XML_Char *);
-static void _xml_add_to_info(xml_parser *parser,char *name);
-
-
-void _xml_startElementHandler(void *, const char *, const char **);
-void _xml_endElementHandler(void *, const char *);
-void _xml_characterDataHandler(void *, const XML_Char *, int);
-void _xml_processingInstructionHandler(void *, const XML_Char *, const XML_Char *);
-void _xml_defaultHandler(void *, const XML_Char *, int);
-void _xml_unparsedEntityDeclHandler(void *, const XML_Char *, const XML_Char *, const XML_Char *, const XML_Char *, const XML_Char *);
-void _xml_notationDeclHandler(void *, const XML_Char *, const XML_Char *, const XML_Char *, const XML_Char *);
-int _xml_externalEntityRefHandler(XML_Parser, const XML_Char *, const XML_Char *, const XML_Char *, const XML_Char *);
-
-void _xml_startNamespaceDeclHandler(void *, const XML_Char *, const XML_Char *);
-void _xml_endNamespaceDeclHandler(void *, const XML_Char *);
-/* }}} */
-/* {{{ extension definition structures */
-
-static unsigned char third_and_fourth_args_force_ref[] = { 4, BYREF_NONE, BYREF_NONE, BYREF_FORCE, BYREF_FORCE };
-
-function_entry xml_functions[] = {
- PHP_FE(xml_parser_create, NULL)
- PHP_FE(xml_parser_create_ns, NULL)
- PHP_FE(xml_set_object, second_arg_force_ref)
- PHP_FE(xml_set_element_handler, NULL)
- PHP_FE(xml_set_character_data_handler, NULL)
- PHP_FE(xml_set_processing_instruction_handler, NULL)
- PHP_FE(xml_set_default_handler, NULL)
- PHP_FE(xml_set_unparsed_entity_decl_handler, NULL)
- PHP_FE(xml_set_notation_decl_handler, NULL)
- PHP_FE(xml_set_external_entity_ref_handler, NULL)
- PHP_FE(xml_set_start_namespace_decl_handler, NULL)
- PHP_FE(xml_set_end_namespace_decl_handler, NULL)
- PHP_FE(xml_parse, NULL)
- PHP_FE(xml_parse_into_struct, third_and_fourth_args_force_ref)
- PHP_FE(xml_get_error_code, NULL)
- PHP_FE(xml_error_string, NULL)
- PHP_FE(xml_get_current_line_number, NULL)
- PHP_FE(xml_get_current_column_number, NULL)
- PHP_FE(xml_get_current_byte_index, NULL)
- PHP_FE(xml_parser_free, NULL)
- PHP_FE(xml_parser_set_option, NULL)
- PHP_FE(xml_parser_get_option, NULL)
- PHP_FE(utf8_encode, NULL)
- PHP_FE(utf8_decode, NULL)
- {NULL, NULL, NULL}
-};
-
-zend_module_entry xml_module_entry = {
- "xml", /* extension name */
- xml_functions, /* extension function list */
- PHP_MINIT(xml), /* extension-wide startup function */
- PHP_MSHUTDOWN(xml), /* extension-wide shutdown function */
- PHP_RINIT(xml), /* per-request startup function */
- PHP_RSHUTDOWN(xml), /* per-request shutdown function */
- PHP_MINFO(xml), /* information function */
- STANDARD_MODULE_PROPERTIES
-};
-
-/* All the encoding functions are set to NULL right now, since all
- * the encoding is currently done internally by expat/xmltok.
- */
-xml_encoding xml_encodings[] = {
- { "ISO-8859-1", xml_decode_iso_8859_1, xml_encode_iso_8859_1 },
- { "US-ASCII", xml_decode_us_ascii, xml_encode_us_ascii },
- { "UTF-8", NULL, NULL },
- { NULL, NULL, NULL }
-};
-
-/* True globals, no need for thread safety */
-static int le_xml_parser;
-
-/* }}} */
-/* {{{ startup, shutdown and info functions */
-
-
-#ifdef ZTS
-static void php_xml_init_globals(php_xml_globals *xml_globals)
-{
- XML(default_encoding) = "ISO-8859-1";
-}
-#endif
-
-PHP_MINIT_FUNCTION(xml)
-{
- le_xml_parser = zend_register_list_destructors_ex(xml_parser_dtor, NULL, "xml", module_number);
-
-#ifdef ZTS
- xml_globals_id = ts_allocate_id(sizeof(php_xml_globals), (ts_allocate_ctor) php_xml_init_globals, NULL);
-#else
- XML(default_encoding) = "ISO-8859-1";
-#endif
-
- REGISTER_LONG_CONSTANT("XML_ERROR_NONE", XML_ERROR_NONE, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XML_ERROR_NO_MEMORY", XML_ERROR_NO_MEMORY, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XML_ERROR_SYNTAX", XML_ERROR_SYNTAX, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XML_ERROR_NO_ELEMENTS", XML_ERROR_NO_ELEMENTS, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XML_ERROR_INVALID_TOKEN", XML_ERROR_INVALID_TOKEN, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XML_ERROR_UNCLOSED_TOKEN", XML_ERROR_UNCLOSED_TOKEN, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XML_ERROR_PARTIAL_CHAR", XML_ERROR_PARTIAL_CHAR, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XML_ERROR_TAG_MISMATCH", XML_ERROR_TAG_MISMATCH, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XML_ERROR_DUPLICATE_ATTRIBUTE", XML_ERROR_DUPLICATE_ATTRIBUTE, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XML_ERROR_JUNK_AFTER_DOC_ELEMENT", XML_ERROR_JUNK_AFTER_DOC_ELEMENT, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XML_ERROR_PARAM_ENTITY_REF", XML_ERROR_PARAM_ENTITY_REF, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XML_ERROR_UNDEFINED_ENTITY", XML_ERROR_UNDEFINED_ENTITY, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XML_ERROR_RECURSIVE_ENTITY_REF", XML_ERROR_RECURSIVE_ENTITY_REF, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XML_ERROR_ASYNC_ENTITY", XML_ERROR_ASYNC_ENTITY, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XML_ERROR_BAD_CHAR_REF", XML_ERROR_BAD_CHAR_REF, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XML_ERROR_BINARY_ENTITY_REF", XML_ERROR_BINARY_ENTITY_REF, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF", XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XML_ERROR_MISPLACED_XML_PI", XML_ERROR_MISPLACED_XML_PI, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XML_ERROR_UNKNOWN_ENCODING", XML_ERROR_UNKNOWN_ENCODING, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XML_ERROR_INCORRECT_ENCODING", XML_ERROR_INCORRECT_ENCODING, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XML_ERROR_UNCLOSED_CDATA_SECTION", XML_ERROR_UNCLOSED_CDATA_SECTION, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XML_ERROR_EXTERNAL_ENTITY_HANDLING", XML_ERROR_EXTERNAL_ENTITY_HANDLING, CONST_CS|CONST_PERSISTENT);
-
- REGISTER_LONG_CONSTANT("XML_OPTION_CASE_FOLDING", PHP_XML_OPTION_CASE_FOLDING, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XML_OPTION_TARGET_ENCODING", PHP_XML_OPTION_TARGET_ENCODING, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XML_OPTION_SKIP_TAGSTART", PHP_XML_OPTION_SKIP_TAGSTART, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("XML_OPTION_SKIP_WHITE", PHP_XML_OPTION_SKIP_WHITE, CONST_CS|CONST_PERSISTENT);
-
-
- return SUCCESS;
-}
-
-
-PHP_RINIT_FUNCTION(xml)
-{
- return SUCCESS;
-}
-
-
-PHP_MSHUTDOWN_FUNCTION(xml)
-{
- return SUCCESS;
-}
-
-
-PHP_RSHUTDOWN_FUNCTION(xml)
-{
- return SUCCESS;
-}
-
-
-PHP_MINFO_FUNCTION(xml)
-{
-
- php_info_print_table_start();
- php_info_print_table_row(2, "XML Support", "active");
- php_info_print_table_row(2, "XML Namespace Support", "active");
- php_info_print_table_row(2, "EXPAT Version",XML_ExpatVersion());
- php_info_print_table_end();
-}
-/* }}} */
-
-/* {{{ extension-internal functions */
-
-static zval *_xml_resource_zval(long value)
-{
- zval *ret;
- MAKE_STD_ZVAL(ret);
-
- ret->type = IS_RESOURCE;
- ret->value.lval = value;
-
- zend_list_addref(value);
-
- return ret;
-}
-
-static zval *_xml_string_zval(const char *str)
-{
- zval *ret;
- int len = strlen(str);
- MAKE_STD_ZVAL(ret);
-
- ret->type = IS_STRING;
- ret->value.str.len = len;
- ret->value.str.val = estrndup(str, len);
- return ret;
-}
-
-static zval *_xml_xmlchar_zval(const XML_Char *s, int len, const XML_Char *encoding)
-{
- zval *ret;
- MAKE_STD_ZVAL(ret);
-
- if (s == NULL) {
- var_reset(ret);
- return ret;
- }
- if (len == 0) {
- len = _xml_xmlcharlen(s);
- }
- ret->type = IS_STRING;
- ret->value.str.val = xml_utf8_decode(s, len, &ret->value.str.len, encoding);
- return ret;
-}
-
-/* }}} */
-
-/* {{{ xml_parser_dtor() */
-
-static void
-xml_parser_dtor(zend_rsrc_list_entry *rsrc)
-{
- xml_parser *parser = (xml_parser *)rsrc->ptr;
-
- /* please leave this commented - or ask thies@thieso.net before doing it (again)
- if (parser->object) {
- zval_ptr_dtor(&parser->object);
- }
- */
-
- if (parser->parser) {
- XML_ParserFree(parser->parser);
- }
- if (parser->ltags) {
- int inx;
- for (inx = 0; inx < parser->level; inx++)
- efree(parser->ltags[ inx ]);
- efree(parser->ltags);
- }
- if (parser->startElementHandler) {
- zval_ptr_dtor(&parser->startElementHandler);
- }
- if (parser->endElementHandler) {
- zval_ptr_dtor(&parser->endElementHandler);
- }
- if (parser->characterDataHandler) {
- zval_ptr_dtor(&parser->characterDataHandler);
- }
- if (parser->processingInstructionHandler) {
- zval_ptr_dtor(&parser->processingInstructionHandler);
- }
- if (parser->defaultHandler) {
- zval_ptr_dtor(&parser->defaultHandler);
- }
- if (parser->unparsedEntityDeclHandler) {
- zval_ptr_dtor(&parser->unparsedEntityDeclHandler);
- }
- if (parser->notationDeclHandler) {
- zval_ptr_dtor(&parser->notationDeclHandler);
- }
- if (parser->externalEntityRefHandler) {
- zval_ptr_dtor(&parser->externalEntityRefHandler);
- }
- if (parser->unknownEncodingHandler) {
- zval_ptr_dtor(&parser->unknownEncodingHandler);
- }
- if (parser->startNamespaceDeclHandler) {
- zval_ptr_dtor(&parser->startNamespaceDeclHandler);
- }
- if (parser->endNamespaceDeclHandler) {
- zval_ptr_dtor(&parser->endNamespaceDeclHandler);
- }
- if (parser->baseURI) {
- efree(parser->baseURI);
- }
-
- efree(parser);
-}
-
-/* }}} */
- /* {{{ xml_set_handler() */
-
-static void
-xml_set_handler(zval **handler, zval **data)
-{
- /* IS_ARRAY might indicate that we're using array($obj, 'method') syntax */
- if (Z_TYPE_PP(data) != IS_ARRAY) {
- convert_to_string_ex(data);
- }
-
- zval_add_ref(data);
- *handler = *data;
-}
-
-/* }}} */
- /* {{{ xml_call_handler() */
-
-static zval *
-xml_call_handler(xml_parser *parser, zval *handler, int argc, zval **argv)
-{
- ELS_FETCH();
-
- if (parser && handler) {
- zval *retval;
- int i;
- int result;
-
- MAKE_STD_ZVAL(retval);
- retval->type = IS_BOOL;
- retval->value.lval = 0;
-
- result = call_user_function(EG(function_table), &parser->object, handler, retval, argc, argv);
-
- if (result == FAILURE) {
- zval **method;
- zval **obj;
-
- if (Z_TYPE_P(handler) == IS_STRING) {
- php_error(E_WARNING, "Unable to call handler %s()", Z_STRVAL_P(handler));
- } else if (zend_hash_index_find(handler->value.ht, 0, (void **) &obj) == SUCCESS &&
- zend_hash_index_find(handler->value.ht, 1, (void **) &method) == SUCCESS &&
- Z_TYPE_PP(obj) == IS_OBJECT &&
- Z_TYPE_PP(method) == IS_STRING) {
- php_error(E_WARNING, "Unable to call handler %s::%s()", (*obj)->value.obj.ce->name, Z_STRVAL_PP(method));
- } else
- php_error(E_WARNING, "Unable to call handler");
-
- zval_dtor(retval);
- efree(retval);
- }
-
- for (i = 0; i < argc; i++) {
- zval_ptr_dtor(&(argv[i]));
- }
-
- if (result == FAILURE) {
- return NULL;
- } else {
- return retval;
- }
- }
- return NULL;
-}
-
-/* }}} */
- /* {{{ xml_encode_iso_8859_1() */
-
-inline static unsigned short
-xml_encode_iso_8859_1(unsigned char c)
-{
- return (unsigned short)c;
-}
-
-/* }}} */
- /* {{{ xml_decode_iso_8859_1() */
-
-inline static char
-xml_decode_iso_8859_1(unsigned short c)
-{
- return (char)(c > 0xff ? '?' : c);
-}
-
-/* }}} */
- /* {{{ xml_encode_us_ascii() */
-
-inline static unsigned short
-xml_encode_us_ascii(unsigned char c)
-{
- return (unsigned short)c;
-}
-
-/* }}} */
- /* {{{ xml_decode_us_ascii() */
-
-inline static char
-xml_decode_us_ascii(unsigned short c)
-{
- return (char)(c > 0x7f ? '?' : c);
-}
-
-/* }}} */
- /* {{{ xml_get_encoding() */
-
-static xml_encoding *
-xml_get_encoding(const XML_Char *name)
-{
- xml_encoding *enc = &xml_encodings[0];
-
- while (enc && enc->name) {
- if (strcasecmp(name, enc->name) == 0) {
- return enc;
- }
- enc++;
- }
- return NULL;
-}
-
-/* }}} */
- /* {{{ xml_utf8_encode */
-static XML_Char *
-xml_utf8_encode(const char *s, int len, int *newlen, const XML_Char *encoding)
-{
- int pos = len;
- char *newbuf;
- unsigned short c;
- unsigned short (*encoder)(unsigned char) = NULL;
- xml_encoding *enc = xml_get_encoding(encoding);
-
- *newlen = 0;
- if (enc) {
- encoder = enc->encoding_function;
- } else {
- /* If the target encoding was unknown, fail */
- return NULL;
- }
- if (encoder == NULL) {
- /* If no encoder function was specified, return the data as-is.
- */
- newbuf = emalloc(len);
- memcpy(newbuf, s, len);
- *newlen = len;
- return newbuf;
- }
- /* This is the theoretical max (will never get beyond len * 2 as long
- * as we are converting from single-byte characters, though) */
- newbuf = emalloc(len * 4);
- while (pos > 0) {
- c = encoder ? encoder((unsigned char)(*s)) : (unsigned short)(*s);
- if (c < 0x80) {
- newbuf[(*newlen)++] = (char) c;
- } else if (c < 0x800) {
- newbuf[(*newlen)++] = (0xc0 | (c >> 6));
- newbuf[(*newlen)++] = (0x80 | (c & 0x3f));
- } else if (c < 0x10000) {
- newbuf[(*newlen)++] = (0xe0 | (c >> 12));
- newbuf[(*newlen)++] = (0xc0 | ((c >> 6) & 0x3f));
- newbuf[(*newlen)++] = (0x80 | (c & 0x3f));
- } else if (c < 0x200000) {
- newbuf[(*newlen)++] = (0xf0 | (c >> 18));
- newbuf[(*newlen)++] = (0xe0 | ((c >> 12) & 0x3f));
- newbuf[(*newlen)++] = (0xc0 | ((c >> 6) & 0x3f));
- newbuf[(*newlen)++] = (0x80 | (c & 0x3f));
- }
- pos--;
- s++;
- }
- if (*newlen < len * 4) {
- newbuf = erealloc(newbuf, *newlen);
- }
- return newbuf;
-}
-/* }}} */
- /* {{{ xml_utf8_decode */
-PHPAPI char *
-xml_utf8_decode(const XML_Char *s, int len, int *newlen, const XML_Char *encoding)
-{
- int pos = len;
- char *newbuf = emalloc(len + 1);
- unsigned short c;
- char (*decoder)(unsigned short) = NULL;
- xml_encoding *enc = xml_get_encoding(encoding);
-
- *newlen = 0;
- if (enc) {
- decoder = enc->decoding_function;
- }
- if (decoder == NULL) {
- /* If the target encoding was unknown, or no decoder function
- * was specified, return the UTF-8-encoded data as-is.
- */
- memcpy(newbuf, s, len);
- *newlen = len;
- newbuf[*newlen] = '\0';
- return newbuf;
- }
- while (pos > 0) {
- c = (unsigned char)(*s);
- if (c >= 0xf0) { /* four bytes encoded, 21 bits */
- c = ((s[0]&7)<<18) | ((s[1]&63)<<12) | ((s[2]&63)<<6) | (s[3]&63);
- s += 4;
- pos -= 4;
- } else if (c >= 0xe0) { /* three bytes encoded, 16 bits */
- c = ((s[0]&63)<<12) | ((s[1]&63)<<6) | (s[2]&63);
- s += 3;
- pos -= 3;
- } else if (c >= 0xc0) { /* two bytes encoded, 11 bits */
- c = ((s[0]&63)<<6) | (s[1]&63);
- s += 2;
- pos -= 2;
- } else {
- s++;
- pos--;
- }
- newbuf[*newlen] = decoder ? decoder(c) : c;
- ++*newlen;
- }
- if (*newlen < len) {
- newbuf = erealloc(newbuf, *newlen + 1);
- }
- newbuf[*newlen] = '\0';
- return newbuf;
-}
-/* }}} */
- /* {{{ _xml_xmlcharlen() */
-
-static int _xml_xmlcharlen(const XML_Char *s)
-{
- int len = 0;
-
- while (*s) {
- len++;
- s++;
- }
- return len;
-}
-
-/* }}} */
- /* {{{ _xml_zval_strdup() */
-
-PHPAPI char *_xml_zval_strdup(zval *val)
-{
- if (val->type == IS_STRING) {
- char *buf = emalloc(val->value.str.len + 1);
- memcpy(buf, val->value.str.val, val->value.str.len);
- buf[val->value.str.len] = '\0';
- return buf;
- }
- return NULL;
-}
-
-/* }}} */
- /* {{{ _xml_add_to_info */
-static void _xml_add_to_info(xml_parser *parser,char *name)
-{
- zval **element, *values;
-
- if (! parser->info) {
- return;
- }
-
- if (zend_hash_find(parser->info->value.ht,name,strlen(name) + 1,(void **) &element) == FAILURE) {
- MAKE_STD_ZVAL(values);
-
- if (array_init(values) == FAILURE) {
- php_error(E_ERROR, "Unable to initialize array");
- return;
- }
-
- zend_hash_update(parser->info->value.ht, name, strlen(name)+1, (void *) &values, sizeof(zval*), (void **) &element);
- }
-
- add_next_index_long(*element,parser->curtag);
-
- parser->curtag++;
-}
-
-/* }}} */
- /* {{{ _xml_startElementHandler() */
-
-void _xml_startElementHandler(void *userData, const char *name,
- const char **attributes)
-{
- xml_parser *parser = (xml_parser *)userData;
- const char **attrs = attributes;
-
- if (parser) {
- zval *retval, *args[3];
-
- parser->level++;
-
- if (parser->case_folding) {
- name = php_strtoupper(estrdup(name), strlen(name));
- }
-
- if (parser->startElementHandler) {
- args[0] = _xml_resource_zval(parser->index);
- args[1] = _xml_string_zval(name);
- MAKE_STD_ZVAL(args[2]);
- array_init(args[2]);
- while (attributes && *attributes) {
- char *key = (char *)attributes[0];
- char *value = (char *)attributes[1];
- char *decoded_value;
- int decoded_len;
- if (parser->case_folding) {
- key = php_strtoupper(estrdup(key), strlen(key));
- }
- decoded_value = xml_utf8_decode(value, strlen(value),
- &decoded_len,
- parser->target_encoding);
-
- add_assoc_stringl(args[2], key, decoded_value, decoded_len, 0);
- if (parser->case_folding) {
- efree(key);
- }
- attributes += 2;
- }
-
- if ((retval = xml_call_handler(parser, parser->startElementHandler, 3, args))) {
- zval_dtor(retval);
- efree(retval);
- }
- }
-
- if (parser->data) {
- zval *tag, *atr;
- int atcnt = 0;
-
- MAKE_STD_ZVAL(tag);
- MAKE_STD_ZVAL(atr);
-
- array_init(tag);
- array_init(atr);
-
- _xml_add_to_info(parser,((char *) name) + parser->toffset);
-
- add_assoc_string(tag,"tag",((char *) name) + parser->toffset,1); /* cast to avoid gcc-warning */
- add_assoc_string(tag,"type","open",1);
- add_assoc_long(tag,"level",parser->level);
-
- parser->ltags[parser->level-1] = estrdup(name);
- parser->lastwasopen = 1;
-
- attributes = attrs;
- while (attributes && *attributes) {
- char *key = (char *)attributes[0];
- char *value = (char *)attributes[1];
- char *decoded_value;
- int decoded_len;
- if (parser->case_folding) {
- key = php_strtoupper(estrdup(key), strlen(key));
- }
- decoded_value = xml_utf8_decode(value, strlen(value),
- &decoded_len,
- parser->target_encoding);
-
- add_assoc_stringl(atr,key,decoded_value,decoded_len,0);
- atcnt++;
- if (parser->case_folding) {
- efree(key);
- }
- attributes += 2;
- }
-
- if (atcnt) {
- zend_hash_add(tag->value.ht,"attributes",sizeof("attributes"),&atr,sizeof(zval*),NULL);
- } else {
- zval_dtor(atr);
- efree(atr);
- }
-
- zend_hash_next_index_insert(parser->data->value.ht,&tag,sizeof(zval*),(void *) &parser->ctag);
- }
-
- if (parser->case_folding) {
- efree((char *)name);
- }
- }
-}
-
-/* }}} */
- /* {{{ _xml_endElementHandler() */
-
-void _xml_endElementHandler(void *userData, const char *name)
-{
- xml_parser *parser = (xml_parser *)userData;
-
- if (parser) {
- zval *retval, *args[2];
-
- if (parser->case_folding) {
- name = php_strtoupper(estrdup(name), strlen(name));
- }
-
- if (parser->endElementHandler) {
- args[0] = _xml_resource_zval(parser->index);
- args[1] = _xml_string_zval(name);
-
- if ((retval = xml_call_handler(parser, parser->endElementHandler, 2, args))) {
- zval_dtor(retval);
- efree(retval);
- }
- }
-
- if (parser->data) {
- zval *tag;
-
- if (parser->lastwasopen) {
- add_assoc_string(*(parser->ctag),"type","complete",1);
- } else {
- MAKE_STD_ZVAL(tag);
-
- array_init(tag);
-
- _xml_add_to_info(parser,((char *) name) + parser->toffset);
-
- add_assoc_string(tag,"tag",((char *) name) + parser->toffset,1); /* cast to avoid gcc-warning */
- add_assoc_string(tag,"type","close",1);
- add_assoc_long(tag,"level",parser->level);
-
- zend_hash_next_index_insert(parser->data->value.ht,&tag,sizeof(zval*),NULL);
- }
-
- parser->lastwasopen = 0;
- }
-
- if (parser->case_folding) {
- efree((char *)name);
- }
- if (parser->ltags) {
- efree(parser->ltags[parser->level-1]);
- }
- parser->level--;
- }
-}
-
-/* }}} */
- /* {{{ _xml_characterDataHandler() */
-
-void _xml_characterDataHandler(void *userData, const XML_Char *s, int len)
-{
- xml_parser *parser = (xml_parser *)userData;
-
- if (parser) {
- zval *retval, *args[2];
-
- if (parser->characterDataHandler) {
- args[0] = _xml_resource_zval(parser->index);
- args[1] = _xml_xmlchar_zval(s, len, parser->target_encoding);
- if ((retval = xml_call_handler(parser, parser->characterDataHandler, 2, args))) {
- zval_dtor(retval);
- efree(retval);
- }
- }
-
- if (parser->data) {
- int i;
- int doprint = 0;
-
- char *decoded_value;
- int decoded_len;
-
- decoded_value = xml_utf8_decode(s,len,&decoded_len,parser->target_encoding);
- for (i = 0; i < decoded_len; i++) {
- switch (decoded_value[i]) {
- case ' ':
- case '\t':
- case '\n':
- continue;
- default:
- doprint = 1;
- break;
- }
- if (doprint) {
- break;
- }
- }
- if (doprint || (! parser->skipwhite)) {
- if (parser->lastwasopen) {
- zval **myval;
-
- /* check if the current tag already has a value - if yes append to that! */
- if (zend_hash_find((*parser->ctag)->value.ht,"value",sizeof("value"),(void **) &myval) == SUCCESS) {
- int newlen = (*myval)->value.str.len + decoded_len;
- (*myval)->value.str.val = erealloc((*myval)->value.str.val,newlen+1);
- strcpy((*myval)->value.str.val + (*myval)->value.str.len,decoded_value);
- (*myval)->value.str.len += decoded_len;
- efree(decoded_value);
- } else {
- add_assoc_string(*(parser->ctag),"value",decoded_value,0);
- }
-
- } else {
- zval *tag;
-
- MAKE_STD_ZVAL(tag);
-
- array_init(tag);
-
- _xml_add_to_info(parser,parser->ltags[parser->level-1] + parser->toffset);
-
- add_assoc_string(tag,"tag",parser->ltags[parser->level-1] + parser->toffset,1);
- add_assoc_string(tag,"value",decoded_value,0);
- add_assoc_string(tag,"type","cdata",1);
- add_assoc_long(tag,"level",parser->level);
-
- zend_hash_next_index_insert(parser->data->value.ht,&tag,sizeof(zval*),NULL);
- }
- } else {
- efree(decoded_value);
- }
- }
- }
-}
-
-/* }}} */
- /* {{{ _xml_processingInstructionHandler() */
-
-void _xml_processingInstructionHandler(void *userData,
- const XML_Char *target,
- const XML_Char *data)
-{
- xml_parser *parser = (xml_parser *)userData;
-
- if (parser && parser->processingInstructionHandler) {
- zval *retval, *args[3];
-
- args[0] = _xml_resource_zval(parser->index);
- args[1] = _xml_xmlchar_zval(target, 0, parser->target_encoding);
- args[2] = _xml_xmlchar_zval(data, 0, parser->target_encoding);
- if ((retval = xml_call_handler(parser, parser->processingInstructionHandler, 3, args))) {
- zval_dtor(retval);
- efree(retval);
- }
- }
-}
-
-/* }}} */
- /* {{{ _xml_defaultHandler() */
-
-void _xml_defaultHandler(void *userData, const XML_Char *s, int len)
-{
- xml_parser *parser = (xml_parser *)userData;
-
- if (parser && parser->defaultHandler) {
- zval *retval, *args[2];
-
- args[0] = _xml_resource_zval(parser->index);
- args[1] = _xml_xmlchar_zval(s, len, parser->target_encoding);
- if ((retval = xml_call_handler(parser, parser->defaultHandler, 2, args))) {
- zval_dtor(retval);
- efree(retval);
- }
- }
-}
-
-/* }}} */
- /* {{{ _xml_unparsedEntityDeclHandler() */
-
-void _xml_unparsedEntityDeclHandler(void *userData,
- const XML_Char *entityName,
- const XML_Char *base,
- const XML_Char *systemId,
- const XML_Char *publicId,
- const XML_Char *notationName)
-{
- xml_parser *parser = (xml_parser *)userData;
-
- if (parser && parser->unparsedEntityDeclHandler) {
- zval *retval, *args[6];
-
- args[0] = _xml_resource_zval(parser->index);
- args[1] = _xml_xmlchar_zval(entityName, 0, parser->target_encoding);
- args[2] = _xml_xmlchar_zval(base, 0, parser->target_encoding);
- args[3] = _xml_xmlchar_zval(systemId, 0, parser->target_encoding);
- args[4] = _xml_xmlchar_zval(publicId, 0, parser->target_encoding);
- args[5] = _xml_xmlchar_zval(notationName, 0, parser->target_encoding);
- if ((retval = xml_call_handler(parser, parser->unparsedEntityDeclHandler, 6, args))) {
- zval_dtor(retval);
- efree(retval);
- }
- }
-}
-
-/* }}} */
- /* {{{ _xml_notationDeclHandler() */
-
-void
-_xml_notationDeclHandler(void *userData,
- const XML_Char *notationName,
- const XML_Char *base,
- const XML_Char *systemId,
- const XML_Char *publicId)
-{
- xml_parser *parser = (xml_parser *)userData;
-
- if (parser && parser->notationDeclHandler) {
- zval *retval, *args[5];
-
- args[0] = _xml_resource_zval(parser->index);
- args[1] = _xml_xmlchar_zval(notationName, 0, parser->target_encoding);
- args[2] = _xml_xmlchar_zval(base, 0, parser->target_encoding);
- args[3] = _xml_xmlchar_zval(systemId, 0, parser->target_encoding);
- args[4] = _xml_xmlchar_zval(publicId, 0, parser->target_encoding);
- if ((retval = xml_call_handler(parser, parser->notationDeclHandler, 5, args))) {
- zval_dtor(retval);
- efree(retval);
- }
- }
-}
-
-/* }}} */
- /* {{{ _xml_externalEntityRefHandler() */
-
-int
-_xml_externalEntityRefHandler(XML_Parser parserPtr,
- const XML_Char *openEntityNames,
- const XML_Char *base,
- const XML_Char *systemId,
- const XML_Char *publicId)
-{
- xml_parser *parser = XML_GetUserData(parserPtr);
- int ret = 0; /* abort if no handler is set (should be configurable?) */
-
- if (parser && parser->externalEntityRefHandler) {
- zval *retval, *args[5];
-
- args[0] = _xml_resource_zval(parser->index);
- args[1] = _xml_xmlchar_zval(openEntityNames, 0, parser->target_encoding);
- args[2] = _xml_xmlchar_zval(base, 0, parser->target_encoding);
- args[3] = _xml_xmlchar_zval(systemId, 0, parser->target_encoding);
- args[4] = _xml_xmlchar_zval(publicId, 0, parser->target_encoding);
- if ((retval = xml_call_handler(parser, parser->externalEntityRefHandler, 5, args))) {
- convert_to_long(retval);
- ret = retval->value.lval;
- efree(retval);
- } else {
- ret = 0;
- }
- }
- return ret;
-}
-
-/* }}} */
- /* {{{ _xml_startNamespaceDeclHandler() */
-
-void _xml_startNamespaceDeclHandler(void *userData,
- const XML_Char *prefix,
- const XML_Char *uri)
-{
- xml_parser *parser = (xml_parser *)userData;
-
- if (parser && parser->startNamespaceDeclHandler) {
- zval *retval, *args[3];
-
- args[0] = _xml_resource_zval(parser->index);
- args[1] = _xml_xmlchar_zval(prefix, 0, parser->target_encoding);
- args[2] = _xml_xmlchar_zval(uri, 0, parser->target_encoding);
- if ((retval = xml_call_handler(parser, parser->startNamespaceDeclHandler, 3, args))) {
- zval_dtor(retval);
- efree(retval);
- }
- }
-}
-
-/* }}} */
- /* {{{ _xml_endNamespaceDeclHandler() */
-
-void _xml_endNamespaceDeclHandler(void *userData,
- const XML_Char *prefix)
-{
- xml_parser *parser = (xml_parser *)userData;
-
- if (parser && parser->endNamespaceDeclHandler) {
- zval *retval, *args[2];
-
- args[0] = _xml_resource_zval(parser->index);
- args[1] = _xml_xmlchar_zval(prefix, 0, parser->target_encoding);
- if ((retval = xml_call_handler(parser, parser->endNamespaceDeclHandler, 2, args))) {
- zval_dtor(retval);
- efree(retval);
- }
- }
-}
-
-/* }}} */
-
-/* }}} */
-
-/************************* EXTENSION FUNCTIONS *************************/
-
-/* {{{ proto int xml_parser_create([string encoding])
- Create an XML parser */
-PHP_FUNCTION(xml_parser_create)
-{
- xml_parser *parser;
- int argc;
- zval **encodingArg;
- XML_Char *encoding;
- char thisfunc[] = "xml_parser_create";
- XMLLS_FETCH();
-
- argc = ZEND_NUM_ARGS();
-
- if (argc > 1 || zend_get_parameters_ex(argc, &encodingArg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if (argc == 1) {
- convert_to_string_ex(encodingArg);
- /* The supported encoding types are hardcoded here because
- * we are limited to the encodings supported by expat/xmltok.
- */
- if (strncasecmp((*encodingArg)->value.str.val, "ISO-8859-1",
- (*encodingArg)->value.str.len) == 0) {
- encoding = "ISO-8859-1";
- } else if (strncasecmp((*encodingArg)->value.str.val, "UTF-8",
- (*encodingArg)->value.str.len) == 0) {
- encoding = "UTF-8";
- } else if (strncasecmp((*encodingArg)->value.str.val, "US-ASCII",
- (*encodingArg)->value.str.len) == 0) {
- encoding = "US-ASCII";
- } else { /* UTF-16 not supported */
- php_error(E_WARNING, "%s: unsupported source encoding \"%s\"",
- thisfunc, (*encodingArg)->value.str.val);
- RETURN_FALSE;
- }
- } else {
- encoding = XML(default_encoding);
- }
-
- parser = ecalloc(sizeof(xml_parser), 1);
- parser->parser = XML_ParserCreate(encoding);
- parser->target_encoding = encoding;
- parser->case_folding = 1;
- parser->object = NULL;
- XML_SetUserData(parser->parser, parser);
-
- ZEND_REGISTER_RESOURCE(return_value,parser,le_xml_parser);
- parser->index = return_value->value.lval;
-}
-/* }}} */
-
-/* {{{ proto int xml_parser_create_ns([string encoding][, string sep])
- Create an XML parser */
-PHP_FUNCTION(xml_parser_create_ns)
-{
- xml_parser *parser;
- int argc;
- zval **encodingArg, **sepArg;
- XML_Char *encoding, *sep;
- char thisfunc[] = "xml_parser_create";
- XMLLS_FETCH();
-
- argc = ZEND_NUM_ARGS();
-
- if (argc > 2 || zend_get_parameters_ex(argc, &encodingArg, &sepArg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if (argc >= 1) {
- convert_to_string_ex(encodingArg);
- /* The supported encoding types are hardcoded here because
- * we are limited to the encodings supported by expat/xmltok.
- */
- if (strncasecmp((*encodingArg)->value.str.val, "ISO-8859-1",
- (*encodingArg)->value.str.len) == 0) {
- encoding = "ISO-8859-1";
- } else if (strncasecmp((*encodingArg)->value.str.val, "UTF-8",
- (*encodingArg)->value.str.len) == 0) {
- encoding = "UTF-8";
- } else if (strncasecmp((*encodingArg)->value.str.val, "US-ASCII",
- (*encodingArg)->value.str.len) == 0) {
- encoding = "US-ASCII";
- } else { /* UTF-16 not supported */
- php_error(E_WARNING, "%s: unsupported source encoding \"%s\"",
- thisfunc, (*encodingArg)->value.str.val);
- RETURN_FALSE;
- }
- } else {
- encoding = XML(default_encoding);
- }
-
- if (argc == 2){
- convert_to_string_ex(sepArg);
- sep = (*sepArg)->value.str.val;
- } else {
- sep = ":";
- }
-
- parser = ecalloc(sizeof(xml_parser), 1);
- parser->parser = XML_ParserCreateNS(encoding, sep[0]);
- parser->target_encoding = encoding;
- parser->case_folding = 1;
- parser->object = NULL;
- XML_SetUserData(parser->parser, parser);
-
- ZEND_REGISTER_RESOURCE(return_value,parser,le_xml_parser);
- parser->index = return_value->value.lval;
-}
-/* }}} */
-
-/* {{{ proto int xml_set_object(int pind, object &obj)
- Set up object which should be used for callbacks */
-PHP_FUNCTION(xml_set_object)
-{
- xml_parser *parser;
- zval **pind, **mythis;
-
- if (ZEND_NUM_ARGS() != 2 ||
- zend_get_parameters_ex(2, &pind, &mythis) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if ((*mythis)->type != IS_OBJECT) {
- php_error(E_WARNING,"arg 2 has wrong type");
- RETURN_FALSE;
- }
-
- ZEND_FETCH_RESOURCE(parser,xml_parser *,pind, -1, "XML Parser", le_xml_parser);
-
- /* please leave this commented - or ask thies@thieso.net before doing it (again)
- if (parser->object) {
- zval_ptr_dtor(&parser->object);
- }
- */
-
- parser->object = *mythis;
-
- /* please leave this commented - or ask thies@thieso.net before doing it (again)
- zval_add_ref(&parser->object);
- */
-
- RETVAL_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int xml_set_element_handler(int pind, string shdl, string ehdl)
- Set up start and end element handlers */
-PHP_FUNCTION(xml_set_element_handler)
-{
- xml_parser *parser;
- zval **pind, **shdl, **ehdl;
-
- if (ZEND_NUM_ARGS() != 3 ||
- zend_get_parameters_ex(3, &pind, &shdl, &ehdl) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(parser,xml_parser *,pind, -1, "XML Parser", le_xml_parser);
-
- xml_set_handler(&parser->startElementHandler, shdl);
- xml_set_handler(&parser->endElementHandler, ehdl);
- XML_SetElementHandler(parser->parser, _xml_startElementHandler, _xml_endElementHandler);
- RETVAL_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int xml_set_character_data_handler(int pind, string hdl)
- Set up character data handler */
-PHP_FUNCTION(xml_set_character_data_handler)
-{
- xml_parser *parser;
- zval **pind, **hdl;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &pind, &hdl) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(parser,xml_parser *, pind, -1, "XML Parser", le_xml_parser);
-
- xml_set_handler(&parser->characterDataHandler, hdl);
- XML_SetCharacterDataHandler(parser->parser, _xml_characterDataHandler);
- RETVAL_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int xml_set_processing_instruction_handler(int pind, string hdl)
- Set up processing instruction (PI) handler */
-PHP_FUNCTION(xml_set_processing_instruction_handler)
-{
- xml_parser *parser;
- zval **pind, **hdl;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &pind, &hdl) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(parser,xml_parser *, pind, -1, "XML Parser", le_xml_parser);
-
- xml_set_handler(&parser->processingInstructionHandler, hdl);
- XML_SetProcessingInstructionHandler(parser->parser, _xml_processingInstructionHandler);
- RETVAL_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int xml_set_default_handler(int pind, string hdl)
- Set up default handler */
-PHP_FUNCTION(xml_set_default_handler)
-{
- xml_parser *parser;
- zval **pind, **hdl;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &pind, &hdl) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- ZEND_FETCH_RESOURCE(parser,xml_parser *, pind, -1, "XML Parser", le_xml_parser);
-
- xml_set_handler(&parser->defaultHandler, hdl);
- XML_SetDefaultHandler(parser->parser, _xml_defaultHandler);
- RETVAL_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int xml_set_unparsed_entity_decl_handler(int pind, string hdl)
- Set up unparsed entity declaration handler */
-PHP_FUNCTION(xml_set_unparsed_entity_decl_handler)
-{
- xml_parser *parser;
- zval **pind, **hdl;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &pind, &hdl) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(parser,xml_parser *, pind, -1, "XML Parser", le_xml_parser);
-
- xml_set_handler(&parser->unparsedEntityDeclHandler, hdl);
- XML_SetUnparsedEntityDeclHandler(parser->parser, _xml_unparsedEntityDeclHandler);
- RETVAL_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int xml_set_notation_decl_handler(int pind, string hdl)
- Set up notation declaration handler */
-PHP_FUNCTION(xml_set_notation_decl_handler)
-{
- xml_parser *parser;
- zval **pind, **hdl;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &pind, &hdl) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- ZEND_FETCH_RESOURCE(parser,xml_parser *, pind, -1, "XML Parser", le_xml_parser);
-
- xml_set_handler(&parser->notationDeclHandler, hdl);
- XML_SetNotationDeclHandler(parser->parser, _xml_notationDeclHandler);
- RETVAL_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int xml_set_external_entity_ref_handler(int pind, string hdl)
- Set up external entity reference handler */
-PHP_FUNCTION(xml_set_external_entity_ref_handler)
-{
- xml_parser *parser;
- zval **pind, **hdl;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &pind, &hdl) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- ZEND_FETCH_RESOURCE(parser,xml_parser *, pind, -1, "XML Parser", le_xml_parser);
-
- xml_set_handler(&parser->externalEntityRefHandler, hdl);
- XML_SetExternalEntityRefHandler(parser->parser, _xml_externalEntityRefHandler);
- RETVAL_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int xml_set_start_namespace_decl_handler(int pind, string hdl)
- Set up character data handler */
-PHP_FUNCTION(xml_set_start_namespace_decl_handler)
-{
- xml_parser *parser;
- zval **pind, **hdl;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &pind, &hdl) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(parser,xml_parser *, pind, -1, "XML Parser", le_xml_parser);
-
- xml_set_handler(&parser->startNamespaceDeclHandler, hdl);
- XML_SetStartNamespaceDeclHandler(parser->parser, _xml_startNamespaceDeclHandler);
- RETVAL_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int xml_set_end_namespace_decl_handler(int pind, string hdl)
- Set up character data handler */
-PHP_FUNCTION(xml_set_end_namespace_decl_handler)
-{
- xml_parser *parser;
- zval **pind, **hdl;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &pind, &hdl) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(parser,xml_parser *, pind, -1, "XML Parser", le_xml_parser);
-
- xml_set_handler(&parser->endNamespaceDeclHandler, hdl);
- XML_SetEndNamespaceDeclHandler(parser->parser, _xml_endNamespaceDeclHandler);
- RETVAL_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int xml_parse(int pind, string data [, int isFinal])
- Start parsing an XML document */
-PHP_FUNCTION(xml_parse)
-{
- xml_parser *parser;
- zval **pind, **data, **final;
- int argc, isFinal, ret;
-
- argc = ZEND_NUM_ARGS();
- if (argc < 2 || argc > 3 || zend_get_parameters_ex(argc, &pind, &data, &final) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- ZEND_FETCH_RESOURCE(parser,xml_parser *, pind, -1, "XML Parser", le_xml_parser);
-
- convert_to_string_ex(data);
-
- if (argc == 3) {
- convert_to_long_ex(final);
- isFinal = (*final)->value.lval;
- } else {
- isFinal = 0;
- }
-
- ret = XML_Parse(parser->parser, (*data)->value.str.val, (*data)->value.str.len, isFinal);
- RETVAL_LONG(ret);
-}
-
-/* }}} */
-
-/* {{{ proto int xml_parse_into_struct(int pind, string data, array &struct, array &index)
- Parsing a XML document */
-
-PHP_FUNCTION(xml_parse_into_struct)
-{
- xml_parser *parser;
- zval **pind, **data, **xdata, **info = 0;
- int argc, ret;
-
- argc = ZEND_NUM_ARGS();
- if (zend_get_parameters_ex(4, &pind, &data, &xdata,&info) == SUCCESS) {
- zval_dtor(*info);
- array_init(*info);
- } else if (zend_get_parameters_ex(3, &pind, &data, &xdata) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(parser,xml_parser *, pind, -1, "XML Parser", le_xml_parser);
-
- convert_to_string_ex(data);
- zval_dtor(*xdata);
- array_init(*xdata);
-
- parser->data = *xdata;
- if (info)
- parser->info = *info;
- parser->level = 0;
- parser->ltags = emalloc(XML_MAXLEVEL * sizeof(char *));
-
- XML_SetDefaultHandler(parser->parser, _xml_defaultHandler);
- XML_SetElementHandler(parser->parser, _xml_startElementHandler, _xml_endElementHandler);
- XML_SetCharacterDataHandler(parser->parser, _xml_characterDataHandler);
-
- ret = XML_Parse(parser->parser, (*data)->value.str.val, (*data)->value.str.len, 1);
-
- RETVAL_LONG(ret);
-}
-/* }}} */
-
-/* {{{ proto int xml_get_error_code(int pind)
- Get XML parser error code */
-PHP_FUNCTION(xml_get_error_code)
-{
- xml_parser *parser;
- zval **pind;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &pind) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- ZEND_FETCH_RESOURCE(parser,xml_parser *, pind, -1, "XML Parser", le_xml_parser);
-
- RETVAL_LONG((long)XML_GetErrorCode(parser->parser));
-}
-/* }}} */
-
-/* {{{ proto string xml_error_string(int code)
- Get XML parser error string */
-PHP_FUNCTION(xml_error_string)
-{
- zval **code;
- char *str;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &code) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(code);
- str = (char *)XML_ErrorString((int)(*code)->value.lval);
- if (str) {
- RETVAL_STRING(str, 1);
- }
-}
-/* }}} */
-
-/* {{{ proto int xml_get_current_line_number(int pind)
- Get current line number for an XML parser */
-PHP_FUNCTION(xml_get_current_line_number)
-{
- xml_parser *parser;
- zval **pind;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &pind) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- ZEND_FETCH_RESOURCE(parser,xml_parser *, pind, -1, "XML Parser", le_xml_parser);
-
- RETVAL_LONG(XML_GetCurrentLineNumber(parser->parser));
-}
-/* }}} */
-
-/* {{{ proto int xml_get_current_column_number(int pind)
- Get current column number for an XML parser */
-PHP_FUNCTION(xml_get_current_column_number)
-{
- xml_parser *parser;
- zval **pind;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &pind) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- ZEND_FETCH_RESOURCE(parser,xml_parser *, pind, -1, "XML Parser", le_xml_parser);
-
- RETVAL_LONG(XML_GetCurrentColumnNumber(parser->parser));
-}
-/* }}} */
-
-/* {{{ proto int xml_get_current_byte_index(int pind)
- Get current byte index for an XML parser */
-PHP_FUNCTION(xml_get_current_byte_index)
-{
- xml_parser *parser;
- zval **pind;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &pind) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- ZEND_FETCH_RESOURCE(parser,xml_parser *, pind, -1, "XML Parser", le_xml_parser);
-
- RETVAL_LONG(XML_GetCurrentByteIndex(parser->parser));
-}
-/* }}} */
-
-/* {{{ proto int xml_parser_free(int pind)
- Free an XML parser */
-PHP_FUNCTION(xml_parser_free)
-{
- zval **pind;
- xml_parser *parser;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &pind) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(parser,xml_parser *, pind, -1, "XML Parser", le_xml_parser);
-
- if (zend_list_delete(parser->index) == FAILURE) {
- RETURN_FALSE;
- }
-
- RETVAL_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int xml_parser_set_option(int pind, int option, mixed value)
- Set options in an XML parser */
-PHP_FUNCTION(xml_parser_set_option)
-{
- xml_parser *parser;
- zval **pind, **opt, **val;
- char thisfunc[] = "xml_parser_set_option";
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &pind, &opt, &val) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- ZEND_FETCH_RESOURCE(parser,xml_parser *, pind, -1, "XML Parser", le_xml_parser);
-
- convert_to_long_ex(opt);
-
- switch ((*opt)->value.lval) {
- case PHP_XML_OPTION_CASE_FOLDING:
- convert_to_long_ex(val);
- parser->case_folding = (*val)->value.lval;
- break;
- case PHP_XML_OPTION_SKIP_TAGSTART:
- convert_to_long_ex(val);
- parser->toffset = (*val)->value.lval;
- break;
- case PHP_XML_OPTION_SKIP_WHITE:
- convert_to_long_ex(val);
- parser->skipwhite = (*val)->value.lval;
- break;
- case PHP_XML_OPTION_TARGET_ENCODING: {
- xml_encoding *enc;
- convert_to_string_ex(val);
- enc = xml_get_encoding((*val)->value.str.val);
- if (enc == NULL) {
- php_error(E_WARNING, "%s: unsupported target encoding \"%s\"",
- thisfunc, (*val)->value.str.val);
- RETURN_FALSE;
- }
- parser->target_encoding = enc->name;
- break;
- }
- default:
- php_error(E_WARNING, "%s: unknown option", thisfunc);
- RETURN_FALSE;
- break;
- }
- RETVAL_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int xml_parser_get_option(int pind, int option)
- Get options from an XML parser */
-PHP_FUNCTION(xml_parser_get_option)
-{
- xml_parser *parser;
- zval **pind, **opt;
- char thisfunc[] = "xml_parser_get_option";
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &pind, &opt) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- ZEND_FETCH_RESOURCE(parser,xml_parser *, pind, -1, "XML Parser", le_xml_parser);
-
- convert_to_long_ex(opt);
-
- switch ((*opt)->value.lval) {
- case PHP_XML_OPTION_CASE_FOLDING:
- RETURN_LONG(parser->case_folding);
- break;
- case PHP_XML_OPTION_TARGET_ENCODING:
- RETURN_STRING(parser->target_encoding, 1);
- break;
- default:
- php_error(E_WARNING, "%s: unknown option", thisfunc);
- RETURN_FALSE;
- break;
- }
- RETVAL_FALSE;
-}
-/* }}} */
-
-/* {{{ proto string utf8_encode(string data)
- Encodes an ISO-8859-1 string to UTF-8 */
-PHP_FUNCTION(utf8_encode)
-{
- zval **arg;
- XML_Char *encoded;
- int len;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(arg);
- encoded = xml_utf8_encode((*arg)->value.str.val, (*arg)->value.str.len, &len, "ISO-8859-1");
- if (encoded == NULL) {
- RETURN_FALSE;
- }
- RETVAL_STRINGL(encoded, len, 0);
-}
-/* }}} */
-
-/* {{{ proto string utf8_decode(string data)
- Converts a UTF-8 encoded string to ISO-8859-1 */
-PHP_FUNCTION(utf8_decode)
-{
- zval **arg;
- XML_Char *decoded;
- int len;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(arg);
- decoded = xml_utf8_decode((*arg)->value.str.val, (*arg)->value.str.len, &len, "ISO-8859-1");
- if (decoded == NULL) {
- RETURN_FALSE;
- }
- RETVAL_STRINGL(decoded, len, 0);
-}
-/* }}} */
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/xslt/EXPERIMENTAL b/ext/xslt/EXPERIMENTAL
deleted file mode 100644
index 6443e99646..0000000000
--- a/ext/xslt/EXPERIMENTAL
+++ /dev/null
@@ -1,5 +0,0 @@
-this extension is experimental,
-its functions may change their names
-or move to extension all together
-so do not rely to much on them
-you have been warned!
diff --git a/ext/xslt/Makefile.in b/ext/xslt/Makefile.in
deleted file mode 100644
index df6a07d830..0000000000
--- a/ext/xslt/Makefile.in
+++ /dev/null
@@ -1,8 +0,0 @@
-# $Id$
-
-LTLIBRARY_NAME = libxslt.la
-LTLIBRARY_SOURCES = xslt.c sablot.c
-LTLIBRARY_SHARED_NAME = xslt.la
-LTLIBRARY_SHARED_LIBADD = $(XSLT_SHARED_LIBADD)
-
-include $(top_srcdir)/build/dynlib.mk
diff --git a/ext/xslt/README.XSLT-BACKENDS b/ext/xslt/README.XSLT-BACKENDS
deleted file mode 100644
index d45b07c5a5..0000000000
--- a/ext/xslt/README.XSLT-BACKENDS
+++ /dev/null
@@ -1,284 +0,0 @@
-+------------------------------------------------------------------------------+
-| CREATING XSLT BACKENDS |
-+------------------------------------------------------------------------------+
-
- Author(s): Sterling Hughes <sterling@php.net>
-
- Introduction
- -------------------------------------------------------------------------------
- Truth be told, at this point in time there are about a zillion and two
- different XSLT libraries, each with there unique merits and faults. If you
- provide a Sablotron extension, people will clamor for a Xalan extension, if you
- provide a Xalan extension people will clamor for a libxslt extension.
-
- In order to be as user friendly as possible, we try and provide the most
- amount of options to the user. At the same time we must try to keep a level of
- consistency, so the user does not need to remember 15 different syntaxes, etc.
- for each XSLT extension, and when switching from XSLT backends, no changes in
- the PHP code should be necessary (akin to the concept of a database independent
- api, but with XSLT libraries).
-
- At the same time, you'll also notice that in some cases extensions seem to
- duplicate each others functionality. All extensions need code for calling
- user-defined handlers, omitting debug messages, etc. In the interests of
- laziness, we must also try to make these as minimal as possible.
-
- Therefore, I've create a processor independent api for XSLT, aka, the XSLT
- extension (but doesn't "A processor independent API for XSLT" sound cooler?).
- It defines a set of functions which every XSLT backend must provide, as well
- as a syntax which those functions must adhere to. Furthermore, the underlying
- code, provides a "library" if you will, of code that is relevant to all XSLT
- extensions.
-
- The API
- -------------------------------------------------------------------------------
- Every extension must define the following functions:
-
- - xslt_create()
- - xslt_set_scheme_handlers()
- - xslt_set_sax_handlers()
- - xslt_set_error_handler()
- - xslt_set_log()
- - xslt_process()
- - xslt_error()
- - xslt_errno()
- - xslt_free()
-
- These functions are common or implementable with every single XSLT library that
- I've come across so far (at least every C library) and should there for be
- defined by the extension.
-
-
- resource xslt_create(void)
-
- The XSLT create function allocates a new XSLT processor and returns a resource
- pointer to the XSLT processor. It also handles any initialization that the
- processor requires.
-
-
- void xslt_set_scheme_handlers(resource processor, array handlers)
-
- Registers the scheme handlers for the document (aka XPath handlers), given a
- XSLT processor resource (allocated by xslt_create()) and an array in the
- following format:
-
- array(
- "get_all" => function,
- "open" => function,
- "get" => function,
- "put" => function,
- "close" => function
- )
-
- Where function is either a function name or an array in the following format:
-
- array(&$obj, "method")
-
- Note: You do not need to handle the array(&$obj, "method") syntax by yourself
- as this is handled in the call_xslt_function() library function (and
- more specifically, Zend's call_user_function_ex() function.
- Note: The given array does not need to contain all of the different scheme
- handler elements (although it can), but it only needs to conform to
- the "handler" => "function" format described above.
-
- Each of the individual scheme handler functions called are in the formats
- below:
-
- string get_all(resource processor, string scheme, string rest)
- resource open(resource processor, string scheme, string rest)
- int get(resource processor, resource fp, string &data)
- int put(resource processor, resource fp, string data)
- void close(resource processor, resource fp)
-
-
- void xslt_set_sax_handlers(resource processor, array handlers)
-
- Registers the SAX handlers for the document, given a XSLT processor resource
- (allocated by xslt_create()) and an array in the following format:
-
- array(
- "document" => array(document_start_function,
- document_end_function),
- "element" => array(element_start_function,
- element_end_function),
- "namespace" => array(namespace_start_function,
- namespace_end_function),
- "comment" => function,
- "pi" => function,
- "character" => function
- )
-
- Where the functions follow the syntax described for the scheme handler
- functions.
-
- Each of the individual SAX handler functions are in the format below:
-
- void start_doc(resource processor)
- void end_doc(resource processor)
- void start_element(resource processor, string name, array attributes)
- void end_element(resource processor, string name)
- void start_namespace(resource processor, string prefix, string uri)
- void end_namespace(resource processor, string prefix)
- void comment(resource processor, string contents)
- void pi(resource processor, string target, string contents)
- void characters(resource processor, string contents)
-
-
- void xslt_set_error_handler(resource processor, function error_handler)
-
- This function sets the user defined error handler to be called when a
- processing or any other type of error occurs. It is given a XSLT
- processor resource (allocated by xslt_create()) and an error function of
- the same syntax described for the scheme handler function.
-
- The user defined error handler as the following syntax:
-
- void error(resource processor, int level, int error, array info)
-
-
- void xslt_set_log(resource processor, string logname)
-
- Sets the XSLT log to record log information (processor messages, not errors).
- Its given a XSLT processor (allocated by xslt_create()) and a string containing
- the name of the log file. If the string is "php://stderr" then the logging
- should go to standard error (stderr). Also the default place to send log
- messages is standard error (if no log file is set).
-
-
- mixed xslt_process(resource processor,
- string xml,
- string xsl[,
- string result[,
- array arguments[,
- array parameters]]])
-
- This function performs the magic, it takes the user's data, performs the
- transformation and depending on the context either saves the result to a file
- or returns the data to the user.
-
- To understand the way the xslt_process() function works, you must first
- understand the concept of "argument buffers". Argument buffers are equivalent
- to the concept of symlinks on a Unix system, take the following example:
-
- <?php
-
- /**
- * $xml contains the contents of an XML file and $xsl contains
- * the contents of an XSLT stylesheet
- */
- $args = array("/_xml" => $xml,
- "/_xsl" => $xsl);
-
- $xh = xslt_create();
- $data = xslt_process("arg:/_xml", "arg:/_xsl", NULL, $args);
- xslt_free($xh);
-
- print( "The results of the transformation were\n" );
- print( "<br>\n<hr>\n<br>" );
- print( $data );
- print( "<br>\n<hr>\n<br>" );
- ?>
-
- See what was done? The argument buffer was declared ($args) and the different
- arguments were defined. Then when the xslt_process() function was called
- instead of giving the XML filename and XSLT filename we instead gave
- "arguments", which correspond to the XML and XSLT data in the argument buffers.
-
- This concept is a bit foreign to some people, however, I find it the best way
- to handle processing xsl data. If your still having trouble with this, try
- playing around with the sablotron backend a bit, you should be able to catch on
- pretty quickly.
-
- In order to use argument buffers, the XSLT extension provides a couple of easy
- to use API functions, you can use them as follows:
-
- {
- zval **arguments_zp;
- char **arguments_cp;
- xslt_args *arguments;
- char *types[] = { "file", "data" };
-
- /* Fetch the arguments from the user into a zval ** */
-
- /* Translate the zval array into a character array */
- xslt_make_array(&arguments_cp, arguments_zp);
-
- /* Translate the character array into an xslt_arg * structure */
- arguments = xslt_parse_arguments(arguments_cp);
-
- /* Print out the resulting xslt_arg * structure */
- php_printf("XML type: %s\n", types[arguments->xml.type]);
- php_printf("XML data: %s\n", arguments->xml.ptr);
- PUTS("\n");
- php_printf("XSLT type: %s\n", types[arguments->xsl.type]);
- php_printf("XSLT data: %s\n", arguments->xsl.ptr);
- PUTS("\n");
- php_printf("Result type: %s\n", types[arguments->result.type]);
- php_printf("Result data: %s\n", arguments->result.ptr);
- PUTS("\n");
- }
-
- You can also test the "type" field by using the XSLT_IS_FILE and XSLT_IS_DATA
- constants.
-
- Anyway back to the syntax of the xslt_process() function. The first argument
- to the xslt_process() function is a resource pointer to the XSLT processor to
- be used. The second argument is either an "argument buffer" pointing to the
- XML data or the name of a file containing the XML data. The third argument is
- either an argument buffer pointing to the XSLT data or a file containing the
- XSLT data. The fourth argument is optional, it either contains the name of the
- file to place the results of the transformation into, NULL or "arg:/_result",
- in the latter 2 cases, the results of the transformation will be returned. The
- fifth optional argument is the "argument buffer" itself, it is an associative
- PHP array of "argument_name" => "value" pairs, or NULL, if no arguments are to
- be passed. The final optional argument is a set of parameters to pass to the
- XSLT stylesheet. The parameter argument is an associative array of
- "parameter_name" => "value" pairs.
-
-
- string xslt_error(resource processor)
-
- The xslt_error() function returns the last error that occured, given a XSLT
- processor resource (allocated by xslt_create()).
-
-
- int xslt_errno(resource processor)
-
- The xslt_errno() function returns the last error number that occured given a
- XSLT processor resource (allocated by xslt_create()).
-
-
- void xslt_free(resource processor)
-
- The xslt_free() function free's the given XSLT processor resource (allocated
- by xslt_create()).
-
-
- Config.m4
- -------------------------------------------------------------------------------
-
- The XSLT extensions "magic" really occurs in the config.m4 file. Here you must
- add a couple of things in order for your backend to be enabled. Its a bit too
- complex to describe (but easy to implement and understand). Take a look at
- config.m4 (which is well commented) to see what is necessary.
-
-
- Makefile.in
- -------------------------------------------------------------------------------
-
- Simply add the source files for your backend to the LTLIBRARY_SOURCES variable
- and you're all set with this file.
-
-
- Conclusion
- -------------------------------------------------------------------------------
-
- Nobody's perfect, I'm sure I've made some mistakes while thinking this whole
- thing through and I would be glad to here from any of you who think I'm a
- colossal moron and think you have a better way to do it. Please e-mail at
- sterling@php.net, this extension will only get better with feedback.
-
- With that said, the concepts here may take a little bit of time to sink in, I
- know I've written a whole lot. My suggestion to you, if you're planning on
- writing an XSLT backend is simply to go off and implement, taking the api
- section as a guide and making sure you match that api as closely as possible.
diff --git a/ext/xslt/config.m4 b/ext/xslt/config.m4
deleted file mode 100644
index a4d5984a35..0000000000
--- a/ext/xslt/config.m4
+++ /dev/null
@@ -1,89 +0,0 @@
-dnl config.m4 for extension xslt
-dnl +------------------------------------------------------------------------------+
-dnl | This is where the magic of the extension reallly is. Depending on what |
-dnl | backend the user chooses, this script performs the magic |
-dnl +------------------------------------------------------------------------------+
-dnl $Id$
-
-PHP_ARG_ENABLE(xslt, whether to enable xslt support,
-[ --enable-xslt Enable xslt support])
-
-PHP_ARG_WITH(xslt-sablot, whether to enable the XSLT Sablotron backend,
-[ --with-xslt-sablot XSLT: Enable the sablotron backend])
-
-PHP_ARG_WITH(expat-dir, libexpat dir for Sablotron XSL support,
-[ --with-expat-dir=DIR Sablotron: libexpat dir for Sablotron 0.50])
-
-if test "$PHP_XSLT" != "no"; then
-
- PHP_EXTENSION(xslt, $ext_shared)
- PHP_SUBST(XSLT_SHARED_LIBADD)
-
- if test "$PHP_XSLT_SABLOT" != "no"; then
- XSLT_CHECK_DIR=$PHP_XSLT_SABLOT
- XSLT_TEST_FILE=/include/sablot.h
- XSLT_BACKEND_NAME=Sablotron
- XSLT_LIBNAME=sablot
- fi
-
- condition="$XSLT_CHECK_DIR$XSLT_TEST_FILE"
-
- if test -r $condition; then
- XSLT_DIR=$XSLT_CHECK_DIR
- else
- AC_MSG_CHECKING(for $XSLT_BACKEND_NAME libraries in the default path)
- for i in /usr /usr/local; do
- condition="$i$XSLT_TEST_FILE"
- if test -r $condition; then
- XSLT_DIR=$i
- AC_MSG_RESULT(found $XSLT_BACKEND_NAME in $i)
- fi
- done
- fi
-
- if test -z "$XSLT_DIR"; then
- AC_MSG_ERROR(not found. Please re-install the $XSLT_BACKEND_NAME distribution)
- fi
-
- PHP_ADD_INCLUDE($XSLT_DIR/include)
- PHP_ADD_LIBRARY_WITH_PATH($XSLT_LIBNAME, $XSLT_DIR/lib, XSLT_SHARED_LIBADD)
-
- if test "$PHP_XSLT_SABLOT" != "no"; then
- found_expat=no
- for i in $PHP_EXPAT_DIR $XSLT_DIR; do
- if test -f $i/lib/libexpat.a -o -f $i/lib/libexpat.so; then
- AC_DEFINE(HAVE_LIBEXPAT2, 1, [ ])
- PHP_ADD_INCLUDE($i/include)
- PHP_ADD_LIBRARY_WITH_PATH(expat, $i/lib)
- found_expat=yes
- fi
- done
-
- if test "$found_expat" = "no"; then
- PHP_ADD_LIBRARY(xmlparse)
- PHP_ADD_LIBRARY(xmltok)
- fi
-
- found_iconv=no
- AC_CHECK_LIB(c, iconv_open, found_iconv=yes)
- if test "$found_iconv" = "no"; then
- if test "$PHP_ICONV" = "no"; then
- for i in /usr /usr/local; do
- if test -f $i/lib/libconv.a -o -f $i/lib/libiconv.so; then
- PHP_ADD_LIBRARY_WITH_PATH(iconv, $i/lib)
- found_iconv=yes
- fi
- done
- fi
- fi
-
- if test "$found_iconv" = "no"; then
- AC_MSG_ERROR(iconv not found, in order to build sablotron you need the iconv library)
- fi
-
- AC_DEFINE(HAVE_SABLOT_BACKEND, 1, [ ])
- AC_CHECK_LIB(sablot, SablotSetEncoding, AC_DEFINE(HAVE_SABLOT_SET_ENCODING, 1, [ ]))
- fi
-
- AC_DEFINE(HAVE_XSLT, 1, [ ])
-fi
diff --git a/ext/xslt/php_sablot.h b/ext/xslt/php_sablot.h
deleted file mode 100644
index f494fba848..0000000000
--- a/ext/xslt/php_sablot.h
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997, 1998, 1999, 2000, 2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Sterling Hughes <sterling@php.net> |
- +----------------------------------------------------------------------+
- */
-
-#ifndef PHP_XSLT_H
-#define PHP_XSLT_H
-
-#include "php.h"
-
-#if HAVE_SABLOT_BACKEND
-
-#include "php_xslt.h"
-
-#include <sablot.h>
-
-extern zend_module_entry xslt_module_entry;
-#define phpext_xslt_ptr &xslt_module_entry
-
-#ifdef PHP_WIN32
-#define PHP_XSLT_API __declspec(dllexport)
-#else
-#define PHP_XSLT_API
-#endif
-
-#define XSLT_SCHEME(handle) ((handle)->handlers->scheme)
-#define XSLT_SAX(handle) ((handle)->handlers->sax)
-#define XSLT_ERROR(handle) ((handle)->handlers->error)
-
-#define XSLT_PROCESSOR(handle) ((handle)->processor.ptr)
-
-#define XSLT_ERRNO(handle) ((handle)->err->no)
-#define XSLT_ERRSTR(handle) ((handle)->err->str)
-#define XSLT_LOG(handle) ((handle)->err->log)
-
-#define XSLT_FUNCH_FREE(__var) if (__var) zval_ptr_dtor(&(__var));
-
-PHP_MINIT_FUNCTION(xslt);
-PHP_MINFO_FUNCTION(xslt);
-
-PHP_FUNCTION(xslt_create);
-PHP_FUNCTION(xslt_set_sax_handlers);
-PHP_FUNCTION(xslt_set_scheme_handlers);
-PHP_FUNCTION(xslt_set_error_handler);
-PHP_FUNCTION(xslt_set_base);
-PHP_FUNCTION(xslt_set_encoding);
-PHP_FUNCTION(xslt_set_log);
-PHP_FUNCTION(xslt_process);
-PHP_FUNCTION(xslt_error);
-PHP_FUNCTION(xslt_errno);
-PHP_FUNCTION(xslt_free);
-
-struct scheme_handlers {
- zval *get_all;
- zval *open;
- zval *get;
- zval *put;
- zval *close;
-};
-
-struct sax_handlers {
- zval *doc_start;
- zval *element_start;
- zval *element_end;
- zval *namespace_start;
- zval *namespace_end;
- zval *comment;
- zval *pi;
- zval *characters;
- zval *doc_end;
-};
-
-struct xslt_handlers {
- struct scheme_handlers scheme;
- struct sax_handlers sax;
- zval *error;
-};
-
-struct xslt_processor {
- SablotHandle ptr;
- long idx;
-};
-
-struct xslt_log {
- char *path;
- int fd;
-};
-
-struct xslt_error {
- struct xslt_log log;
- char *str;
- int no;
-};
-
-typedef struct {
- struct xslt_handlers *handlers;
- struct xslt_processor processor;
- struct xslt_error *err;
-} php_xslt;
-
-#else
-#define phpext_xslt_ptr NULL
-#endif
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/xslt/php_xslt.h b/ext/xslt/php_xslt.h
deleted file mode 100644
index 1426aab9b2..0000000000
--- a/ext/xslt/php_xslt.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997, 1998, 1999, 2000, 2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Sterling Hughes <sterling@php.net> |
- +----------------------------------------------------------------------+
- */
-
-#ifndef _PHP_XSLT_H
-#define _PHP_XSLT_H
-
-#include "php.h"
-#include "ext/standard/php_filestat.h"
-
-#ifdef HAVE_XSLT
-
-#define XSLT_OBJ(__func) (&(__func)->obj)
-#define XSLT_FUNC(__func) ((__func)->func)
-
-#define XSLT_IS_FILE 0
-#define XSLT_IS_DATA 1
-
-struct xslt_function {
- zval *obj;
- zval *func;
-};
-
-struct _xslt_argument {
- char *ptr;
- int type;
-};
-
-typedef struct {
- struct _xslt_argument xml;
- struct _xslt_argument xsl;
- struct _xslt_argument result;
-} xslt_args;
-
-extern xslt_args *xslt_parse_arguments(char *, char *, char *, char **);
-extern void xslt_free_arguments(xslt_args *);
-
-extern void xslt_assign_handler(struct xslt_function **, zval **);
-extern void xslt_free_handler(struct xslt_function *);
-extern void xslt_call_function(char *, zval *, int, zval **, zval **);
-
-extern void xslt_debug(char *, char *, ...);
-
-#endif
-
-#endif
diff --git a/ext/xslt/sablot.c b/ext/xslt/sablot.c
deleted file mode 100644
index d7c17eff2e..0000000000
--- a/ext/xslt/sablot.c
+++ /dev/null
@@ -1,1549 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997, 1998, 1999, 2000, 2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Sterling Hughes <sterling@php.net> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "php_xslt.h"
-#include "php_sablot.h"
-#include "ext/standard/info.h"
-
-#if HAVE_SABLOT_BACKEND
-
-#include <sablot.h>
-
-#include <string.h>
-#include <stdarg.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-
-/* functions relating to handlers */
-static void register_sax_handler_pair(zval *, zval *, zval **);
-
-/* Free processor */
-static void free_processor(zend_rsrc_list_entry *);
-
-/* Scheme handler functions */
-static int scheme_getall(void *, SablotHandle, const char *, const char *, char **, int *);
-static int scheme_freememory(void *, SablotHandle, char *);
-static int scheme_open(void *, SablotHandle, const char *, const char *, int *);
-static int scheme_get(void *, SablotHandle, int, char *, int *);
-static int scheme_put(void *, SablotHandle, int, const char *, int *);
-static int scheme_close(void *, SablotHandle, int);
-
-/* Sax handler functions */
-static SAX_RETURN sax_startdoc(void *);
-static SAX_RETURN sax_startelement(void *, const char *, const char **);
-static SAX_RETURN sax_endelement(void *, const char *);
-static SAX_RETURN sax_startnamespace(void *, const char *, const char *);
-static SAX_RETURN sax_endnamespace(void *, const char *);
-static SAX_RETURN sax_comment(void *, const char *);
-static SAX_RETURN sax_pi(void *, const char *, const char *);
-static SAX_RETURN sax_characters(void *, const char *, int);
-static SAX_RETURN sax_enddoc(void *);
-
-/* Error handlers */
-static MH_ERROR error_makecode(void *, SablotHandle, int, unsigned short, unsigned short);
-static MH_ERROR error_log(void *, SablotHandle, MH_ERROR, MH_LEVEL, char **);
-static MH_ERROR error_print(void *, SablotHandle, MH_ERROR, MH_LEVEL, char **);
-
-/* Resource related */
-#define le_xslt_name "XSLT Processor"
-static int le_xslt;
-
-/* {{{ xslt_functions[]
- */
-function_entry xslt_functions[] = {
- PHP_FE(xslt_create, NULL)
- PHP_FE(xslt_set_sax_handlers, NULL)
- PHP_FE(xslt_set_scheme_handlers, NULL)
- PHP_FE(xslt_set_error_handler, NULL)
- PHP_FE(xslt_set_base, NULL)
-#ifdef HAVE_SABLOT_SET_ENCODING
- PHP_FE(xslt_set_encoding, NULL)
-#else
- PHP_FALIAS(xslt_set_encoding, warn_not_available, NULL)
-#endif
- PHP_FE(xslt_set_log, NULL)
- PHP_FE(xslt_process, NULL)
- PHP_FE(xslt_error, NULL)
- PHP_FE(xslt_errno, NULL)
- PHP_FE(xslt_free, NULL)
-};
-/* }}} */
-
-/* {{{ xslt_module_entry
- */
-zend_module_entry xslt_module_entry = {
- "xslt",
- xslt_functions,
- PHP_MINIT(xslt),
- NULL,
- NULL,
- NULL,
- PHP_MINFO(xslt),
- STANDARD_MODULE_PROPERTIES
-};
-/* }}} */
-
-#ifdef COMPILE_DL_XSLT
-ZEND_GET_MODULE(xslt)
-#endif
-
-/* {{{ handler structs
- A structure containing the sax handlers, automatically
- registered whether the user defines them or not */
-static SAXHandler sax_handlers =
-{
- sax_startdoc,
- sax_startelement,
- sax_endelement,
- sax_startnamespace,
- sax_endnamespace,
- sax_comment,
- sax_pi,
- sax_characters,
- sax_enddoc
-};
-
-/* Error handlers, automatically registered */
-static MessageHandler message_handler = {
- error_makecode,
- error_log,
- error_print
-};
-
-/* Scheme handlers automatically registered */
-static SchemeHandler scheme_handler = {
- scheme_getall,
- scheme_freememory,
- scheme_open,
- scheme_get,
- scheme_put,
- scheme_close
-};
-/* }}} */
-
-/* {{{ PHP_MINIT_FUNCTION
- */
-PHP_MINIT_FUNCTION(xslt)
-{
- le_xslt = zend_register_list_destructors_ex(free_processor, NULL, le_xslt_name, module_number);
-
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_MINFO_FUNCTION
- */
-PHP_MINFO_FUNCTION(xslt)
-{
- php_info_print_table_start();
- php_info_print_table_header(2, "XSLT support", "enabled");
- php_info_print_table_end();
-}
-/* }}} */
-
-/* {{{ proto resource xslt_create(void)
- Create a new XSLT processor */
-PHP_FUNCTION(xslt_create)
-{
- php_xslt *handle; /* The php -> sablotron handle */
- SablotHandle processor; /* The sablotron processor */
- int error; /* The error container */
-
- /* Allocate the php-sablotron handle */
- handle = emalloc(sizeof(php_xslt));
- handle->handlers = emalloc(sizeof(struct xslt_handlers));
- handle->err = emalloc(sizeof(struct xslt_error));
-
- XSLT_LOG(handle).path = NULL;
-
- /* Allocate the actual processor itself, via sablotron */
- error = SablotCreateProcessor(&processor);
- if (error) {
- XSLT_ERRNO(handle) = error;
- RETURN_FALSE;
- }
-
- /* Save the processor and set the default handlers */
- XSLT_PROCESSOR(handle) = processor;
- SablotRegHandler(XSLT_PROCESSOR(handle), HLR_SAX, (void *) &sax_handlers, (void *) handle);
- SablotRegHandler(XSLT_PROCESSOR(handle), HLR_MESSAGE, (void *) &message_handler, (void *) handle);
- SablotRegHandler(XSLT_PROCESSOR(handle), HLR_SCHEME, (void *) &scheme_handler, (void *) handle);
-
- /* Register the processor as a resource and return it to the user */
- ZEND_REGISTER_RESOURCE(return_value, handle, le_xslt);
-
- /* The resource index, save it for later use */
- handle->processor.idx = Z_LVAL_P(return_value);
-}
-/* }}} */
-
-/* {{{ proto void xslt_set_sax_handlers(resource processor, array handlers)
- Set the SAX handlers to be called when the XML document gets processed */
-PHP_FUNCTION(xslt_set_sax_handlers)
-{
- zval **processor_p, /* Resource pointer to the php->sablotron handle */
- **sax_handlers_p, /* Pointer to the sax handlers php array */
- **handler; /* Individual handler, or handler pair */
- HashTable *sax_handlers; /* PHP array of sax handlers */
- php_xslt *handle; /* Pointer to a php_xslt handle */
- char *string_key; /* String key for the hash */
- ulong num_key; /* (unused) hash's numerical key */
- int key_type; /* The type of the current hash key */
-
- if (ZEND_NUM_ARGS() != 2 ||
- zend_get_parameters_ex(2, &processor_p, &sax_handlers_p) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- ZEND_FETCH_RESOURCE(handle, php_xslt *, processor_p, -1, le_xslt_name, le_xslt);
-
- /* Convert the sax_handlers_p zval ** to a hash table we can process */
- sax_handlers = HASH_OF(*sax_handlers_p);
- if (!sax_handlers) {
- php_error(E_WARNING, "Expecting an array as the second argument to xslt_set_sax_handlers()");
- return;
- }
-
- /* Loop through the HashTable containing the SAX handlers */
- for (zend_hash_internal_pointer_reset(sax_handlers);
- zend_hash_get_current_data(sax_handlers, (void **) &handler) == SUCCESS;
- zend_hash_move_forward(sax_handlers)) {
-
- /* Allocate the handler */
- SEPARATE_ZVAL(handler);
-
- key_type = zend_hash_get_current_key(sax_handlers, &string_key, &num_key, 0);
- if (key_type == HASH_KEY_IS_LONG) {
- convert_to_string_ex(handler);
- php_error(E_NOTICE, "Skipping numerical index %d (with value %s) in xslt_set_sax_handlers()",
- num_key, Z_STRVAL_PP(handler));
- continue;
- }
-
- /* Document handlers (document start, document end) */
- if (strcasecmp(string_key, "document") == 0) {
- register_sax_handler_pair(XSLT_SAX(handle).doc_start,
- XSLT_SAX(handle).doc_end,
- handler);
- }
- /* Element handlers, start of an element, and end of an element */
- else if (strcasecmp(string_key, "element") == 0) {
- register_sax_handler_pair(XSLT_SAX(handle).element_start,
- XSLT_SAX(handle).element_end,
- handler);
- }
- /* Namespace handlers, start of a namespace, end of a namespace */
- else if (strcasecmp(string_key, "namespace") == 0) {
- register_sax_handler_pair(XSLT_SAX(handle).namespace_start,
- XSLT_SAX(handle).namespace_end,
- handler);
- }
- /* Comment handlers, called when a comment is reached */
- else if (strcasecmp(string_key, "comment") == 0) {
- XSLT_SAX(handle).comment = *handler;
- zval_add_ref(&XSLT_SAX(handle).comment);
- }
- /* Processing instructions handler called when processing instructions
- (<? ?>) */
- else if (strcasecmp(string_key, "pi") == 0) {
- XSLT_SAX(handle).pi = *handler;
- zval_add_ref(&XSLT_SAX(handle).pi);
- }
- /* Character handler, called when data is found */
- else if (strcasecmp(string_key, "character") == 0) {
- XSLT_SAX(handle).characters = *handler;
- zval_add_ref(&XSLT_SAX(handle).characters);
- }
- /* Invalid handler name, tsk, tsk, tsk :) */
- else {
- php_error(E_WARNING, "Invalid option to xslt_set_sax_handlers(): %s", string_key);
- }
- }
-}
-/* }}} *
-
-/* {{{ proto void xslt_set_scheme_handlers(resource processor, array handlers)
- Set the scheme handlers for the XSLT processor */
-PHP_FUNCTION(xslt_set_scheme_handlers)
-{
- zval **processor_p, /* Resource pointer to the php->sablotron handle */
- **scheme_handlers_p, /* Pointer to the scheme handler array */
- **handler; /* Individual scheme handler */
- zval *assign_handle; /* The handler to assign to */
- HashTable *scheme_handlers; /* Scheme handler array */
- php_xslt *handle; /* php->sablotron handle */
- char *string_key; /* Hash key (string) */
- ulong num_key; /* (unused) Hash key (number) */
- int key_type; /* The type of the current key */
-
- if (ZEND_NUM_ARGS() != 2 ||
- zend_get_parameters_ex(2, &processor_p, &scheme_handlers_p) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- ZEND_FETCH_RESOURCE(handle, php_xslt *, processor_p, -1, le_xslt_name, le_xslt);
-
- scheme_handlers = HASH_OF(*scheme_handlers_p);
- if (!scheme_handlers) {
- php_error(E_WARNING, "2nd argument to xslt_set_scheme_handlers() must be an array");
- return;
- }
-
- /* Loop through the scheme handlers array, setting the given
- scheme handlers */
- for (zend_hash_internal_pointer_reset(scheme_handlers);
- zend_hash_get_current_data(scheme_handlers, (void **) &handler) == SUCCESS;
- zend_hash_move_forward(scheme_handlers)) {
-
- SEPARATE_ZVAL(handler);
-
- key_type = zend_hash_get_current_key(scheme_handlers, &string_key, &num_key, 0);
- if (key_type == HASH_KEY_IS_LONG) {
- php_error(E_NOTICE, "Numerical key %d (with value %s) being ignored in xslt_set_scheme_handlers()",
- num_key, Z_STRVAL_PP(handler));
- continue;
- }
-
- /* Open the URI and return the whole string */
- if (strcasecmp(string_key, "get_all") == 0) {
- assign_handle = XSLT_SCHEME(handle).get_all;
- }
- /* Open the URI and return a handle */
- else if (strcasecmp(string_key, "open") == 0) {
- assign_handle = XSLT_SCHEME(handle).open;
- }
- /* Retrieve data from the URI */
- else if (strcasecmp(string_key, "get") == 0) {
- assign_handle = XSLT_SCHEME(handle).get;
- }
- /* Save data to the URI */
- else if (strcasecmp(string_key, "put") == 0) {
- assign_handle = XSLT_SCHEME(handle).put;
- }
- /* Close the URI */
- else if (strcasecmp(string_key, "close") == 0) {
- assign_handle = XSLT_SCHEME(handle).close;
- }
- /* Invalid handler name */
- else {
- php_error(E_WARNING, "Invalid option to xslt_set_scheme_handlers(): %s", string_key);
- }
-
- assign_handle = *handler;
- zval_add_ref(&assign_handle);
- }
-}
-/* }}} */
-
-/* {{{ proto void xslt_set_error_handler(resource processor, mixed error_func)
- Set the error handler, to be called when an XSLT error happens */
-PHP_FUNCTION(xslt_set_error_handler)
-{
- zval **processor_p, /* Resource Pointer to a PHP-XSLT processor */
- **error_func; /* Name of the user defined error function */
- php_xslt *handle; /* A PHP-XSLT processor */
-
- if (ZEND_NUM_ARGS() != 2 ||
- zend_get_parameters_ex(2, &processor_p, &error_func) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- ZEND_FETCH_RESOURCE(handle, php_xslt *, processor_p, -1, le_xslt_name, le_xslt);
-
- XSLT_ERROR(handle) = *error_func;
- zval_add_ref(&XSLT_ERROR(handle));
-}
-/* }}} */
-
-/* {{{ proto void xslt_set_base(resource processor, string base)
- Sets the base URI for all XSLT transformations */
-PHP_FUNCTION(xslt_set_base)
-{
- zval **processor_p, /* Resource Pointer to a PHP-XSLT processor */
- **base; /* The base URI for the transformation */
- php_xslt *handle; /* A PHP-XSLT processor */
-
- if (ZEND_NUM_ARGS() != 2 ||
- zend_get_parameters_ex(2, &processor_p, &base) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- ZEND_FETCH_RESOURCE(handle, php_xslt *, processor_p, -1, le_xslt_name, le_xslt);
- convert_to_string_ex(base);
-
- /* Set the base */
- SablotSetBase(XSLT_PROCESSOR(handle), Z_STRVAL_PP(base));
-}
-/* }}} */
-
-/* {{{ proto void xslt_set_encoding(resource processor, string encoding)
- Set the output encoding for the current stylesheet */
-PHP_FUNCTION(xslt_set_encoding)
-{
-/* The user has to explicitly compile sablotron with sablotron
- encoding functions in order for SablotSetEncoding to be
- enabled. config.m4 automatically checks for this... */
-
-#ifdef HAVE_SABLOT_SET_ENCODING
- zval **processor_p, /* Resource Pointer to a PHP-XSLT processor */
- **encoding; /* The encoding to use for the output */
- php_xslt *handle; /* A PHP-XSLT processor */
-
- if (ZEND_NUM_ARGS() != 2 ||
- zend_get_parameters_ex(2, &processor_p, &encoding) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- ZEND_FETCH_RESOURCE(handle, php_xslt *, processor_p, -1, le_xslt_name, le_xslt);
- convert_to_string_ex(encoding);
-
- /* Set the encoding */
- SablotSetEncoding(XSLT_PROCESSOR(handle), Z_STRVAL_PP(encoding));
-#endif
-
-}
-/* }}} */
-
-/* {{{ proto void xslt_set_log(resource processor, string logfile)
- Set the log file to write the errors to (defaults to stderr) */
-PHP_FUNCTION(xslt_set_log)
-{
- zval **processor_p, /* Resource pointer to a PHP-XSLT processor */
- **logfile; /* Path to the logfile */
- php_xslt *handle; /* A PHP-XSLT processor */
- int argc = ZEND_NUM_ARGS(); /* Argument count */
-
- if (argc < 1 || argc > 2 ||
- zend_get_parameters_ex(argc, &processor_p, &logfile) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- ZEND_FETCH_RESOURCE(handle, php_xslt *, processor_p, -1, le_xslt_name, le_xslt);
- convert_to_string_ex(logfile);
-
- /* If the log file already exists, free it */
- if (XSLT_LOG(handle).path) {
- efree(XSLT_LOG(handle).path);
- }
-
- /* Copy the path */
- XSLT_LOG(handle).path = estrndup(Z_STRVAL_PP(logfile),
- Z_STRLEN_PP(logfile));
-}
-/* }}} */
-
-/* {{{ proto string xslt_process(resource processor, string xml, string xslt[, mixed result[, array args[, array params]]])
- Perform the xslt transformation */
-PHP_FUNCTION(xslt_process)
-{
- zval **processor_p, /* Resource Pointer to a PHP-XSLT processor */
- **xml_p, /* A zval pointer to the XML data */
- **xslt_p, /* A zval pointer to the XSLT data */
- **result_p, /* A zval pointer to the transformation results */
- **params_p, /* A zval pointer to the XSLT parameters array */
- **args_p; /* A zval pointer to the XSLT arguments array */
- php_xslt *handle; /* A PHP-XSLT processor */
- char **params = NULL; /* A Sablotron parameter array (derived from the zval parameter array) */
- char **args = NULL; /* A Sablotron argument array (derived from the zval argument array) */
- char *xslt; /* The XSLT stylesheet or argument buffer (pointer to xslt_p) */
- char *xml; /* The XML stylesheet or argument buffer (pointer to xml_p) */
- char *result; /* The result file or argument buffer */
- int argc = ZEND_NUM_ARGS(); /* The number of arguments given */
- int error; /* Our error container */
-
- if (argc < 3 || argc > 6 ||
- zend_get_parameters_ex(argc, &processor_p, &xml_p, &xslt_p, &result_p, &args_p, &params_p) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(handle, php_xslt *, processor_p, -1, le_xslt_name, le_xslt);
- convert_to_string_ex(xml_p);
- convert_to_string_ex(xslt_p);
-
- xml = Z_STRVAL_PP(xml_p);
- xslt = Z_STRVAL_PP(xslt_p);
-
- /* Well, no result file was given or result buffer, that means (guess what?)
- we're returning the result yipp di doo! */
- if (argc < 4 || Z_TYPE_PP(result_p) == IS_NULL) {
- result = "arg:/_result";
- }
- /* The result buffer to place the data into, either a file or an argument buffer, etc. */
- else {
- convert_to_string_ex(result_p);
- result = Z_STRVAL_PP(result_p);
- }
-
- /* Translate a PHP array into a Sablotron array */
- if (argc > 4) {
- xslt_make_array(args_p, &args);
- }
-
- if (argc > 5) {
- xslt_make_array(params_p, &params);
- }
-
- /* Perform transformation */
- error = SablotRunProcessor(XSLT_PROCESSOR(handle), xslt, xml, result, params, args);
- if (error) {
- XSLT_ERRNO(handle) = error;
-
- if (params) xslt_free_array(params);
- if (args) xslt_free_array(args);
-
- RETURN_FALSE;
- }
-
- /* If the result buffer is specified, then we return the results of the XSLT
- transformation */
- if (!strcmp(result, "arg:/_result")) {
- char *trans_result;
-
- /* Fetch the result buffer into trans_result */
- error = SablotGetResultArg(handle->processor.ptr, "arg:/_result", &trans_result);
- if (error) {
- /* Save the error number */
- XSLT_ERRNO(handle) = error;
-
- /* Cleanup */
- if (params) xslt_free_array(params);
- if (args) xslt_free_array(args);
-
- RETURN_FALSE;
- }
-
- RETVAL_STRING(trans_result, 1);
- SablotFree(trans_result);
- }
- else {
- RETVAL_TRUE;
- }
-
- /* Cleanup */
- if (params) xslt_free_array(params);
- if (args) xslt_free_array(args);
-}
-/* }}} */
-
-/* {{{ proto int xslt_errno(resource processor)
- Error number */
-PHP_FUNCTION(xslt_errno)
-{
- zval **processor_p; /* Resource pointer to a PHP-XSLT processor */
- php_xslt *handle; /* A PHP-XSLT processor */
-
- if (ZEND_NUM_ARGS() != 1 ||
- zend_get_parameters_ex(1, &processor_p) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- ZEND_FETCH_RESOURCE(handle, php_xslt *, processor_p, -1, le_xslt_name, le_xslt);
-
- RETURN_LONG(XSLT_ERRNO(handle));
-}
-/* }}} */
-
-/* {{{ proto string xslt_error(resource processor)
- Error string */
-PHP_FUNCTION(xslt_error)
-{
- zval **processor_p; /* Resource pointer to a PHP-XSLT processor */
- php_xslt *handle; /* A PHP-XSLT processor */
-
- if (ZEND_NUM_ARGS() != 1 ||
- zend_get_parameters_ex(1, &processor_p) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- ZEND_FETCH_RESOURCE(handle, php_xslt *, processor_p, -1, le_xslt_name, le_xslt);
-
- RETURN_STRING(XSLT_ERRSTR(handle), 1);
-}
-/* }}} */
-
-/* {{{ proto void xslt_free(resource processor)
- Free the xslt processor up */
-PHP_FUNCTION(xslt_free)
-{
- zval **processor_p; /* Resource pointer to a php-xslt processor */
- php_xslt *handle; /* A PHP-XSLT processor */
-
- if (ZEND_NUM_ARGS() != 1 ||
- zend_get_parameters_ex(1, &processor_p) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- ZEND_FETCH_RESOURCE(handle, php_xslt *, processor_p, -1, le_xslt_name, le_xslt);
-
- /* Remove the entry from the list */
- zend_list_delete(Z_LVAL_PP(processor_p));
-}
-/* }}} */
-
-/* {{{ free_processor()
- Free an XSLT processor */
-static void free_processor(zend_rsrc_list_entry *rsrc)
-{
- php_xslt *handle = (php_xslt *) rsrc->ptr; /* A PHP-XSLT processor */
-
- /* Free the processor */
- if (XSLT_PROCESSOR(handle)) {
- SablotUnregHandler(XSLT_PROCESSOR(handle), HLR_MESSAGE, NULL, NULL);
- SablotUnregHandler(XSLT_PROCESSOR(handle), HLR_SAX, NULL, NULL);
- SablotUnregHandler(XSLT_PROCESSOR(handle), HLR_SCHEME, NULL, NULL);
- SablotDestroyProcessor(XSLT_PROCESSOR(handle));
- }
-
- /* Free Scheme handlers */
- XSLT_FUNCH_FREE(XSLT_SCHEME(handle).get_all);
- XSLT_FUNCH_FREE(XSLT_SCHEME(handle).open);
- XSLT_FUNCH_FREE(XSLT_SCHEME(handle).get);
- XSLT_FUNCH_FREE(XSLT_SCHEME(handle).put);
- XSLT_FUNCH_FREE(XSLT_SCHEME(handle).close);
- /* Free SAX handlers */
- XSLT_FUNCH_FREE(XSLT_SAX(handle).doc_start);
- XSLT_FUNCH_FREE(XSLT_SAX(handle).element_start);
- XSLT_FUNCH_FREE(XSLT_SAX(handle).element_end);
- XSLT_FUNCH_FREE(XSLT_SAX(handle).namespace_start);
- XSLT_FUNCH_FREE(XSLT_SAX(handle).namespace_end);
- XSLT_FUNCH_FREE(XSLT_SAX(handle).comment);
- XSLT_FUNCH_FREE(XSLT_SAX(handle).pi);
- XSLT_FUNCH_FREE(XSLT_SAX(handle).characters);
- XSLT_FUNCH_FREE(XSLT_SAX(handle).doc_end);
- /* Free error handler */
- XSLT_FUNCH_FREE(XSLT_ERROR(handle));
-
- /* Free error message, if any */
- if (XSLT_ERRSTR(handle)) {
- efree(XSLT_ERRSTR(handle));
- }
-
- /* Close log file */
- if (XSLT_LOG(handle).fd) {
- close(XSLT_LOG(handle).fd);
- }
-
- /* Free log file path */
- if (XSLT_LOG(handle).path) {
- efree(XSLT_LOG(handle).path);
- }
-
- /* Free up the handle */
- efree(handle->handlers);
- efree(handle->err);
- efree(handle);
-}
-/* }}} */
-
-/* {{{ register_sax_handler_pair()
- Register a pair of sax handlers */
-static void register_sax_handler_pair(zval *handler1, zval *handler2, zval **handler)
-{
- zval **current; /* The current handler we're grabbing */
-
- /* Grab and assign handler 1 */
- if (zend_hash_index_find(Z_ARRVAL_PP(handler), 0, (void **) &current) == SUCCESS) {
- handler1 = *current;
- zval_add_ref(&handler1);
- }
- else {
- php_error(E_WARNING, "Wrong format of arguments to xslt_set_sax_handlers()");
- return;
- }
-
- /* Grab and assign handler 2 */
- if (zend_hash_index_find(Z_ARRVAL_PP(handler), 1, (void **) &current) == SUCCESS) {
- handler2 = *current;
- zval_add_ref(&handler2);
- }
- else {
- php_error(E_WARNING, "Wrong format of arguments to xslt_set_sax_handlers()");
- return;
- }
-}
-/* }}} */
-
-/* {{{ scheme_getall()
- The getall scheme handler */
-static int scheme_getall(void *user_data, SablotHandle proc, const char *scheme, const char *rest, char **buffer, int *byte_count)
-{
- zval *argv[3]; /* Arguments to the scheme getall function */
- zval *retval; /* Return value from the scheme getall function */
- php_xslt *handle = (php_xslt *) user_data; /* A PHP-XSLT processor */
-
- /* If the scheme handler get all function doesn't
- exist, exit out */
- if (!XSLT_SCHEME(handle).get_all) {
- return 0;
- }
-
- /* Allocate and initialize */
- MAKE_STD_ZVAL(argv[0]);
- MAKE_STD_ZVAL(argv[1]);
- MAKE_STD_ZVAL(argv[2]);
-
- /* Argument 1: XSLT processor (resource)
- Argument 2: Scheme (string)
- Argument 3: Rest (string)
- */
- ZVAL_RESOURCE(argv[0], handle->processor.idx);
- zend_list_addref(handle->processor.idx);
- ZVAL_STRING(argv[1], (char *) scheme, 1);
- ZVAL_STRING(argv[2], (char *) rest, 1);
-
- xslt_call_function("scheme get all", XSLT_SCHEME(handle).get_all,
- 3, argv, &retval);
-
- /* Save the return value in the buffer (copying it) */
- *buffer = estrndup(Z_STRVAL_P(retval), Z_STRLEN_P(retval));
- *byte_count = Z_STRLEN_P(retval);
-
- /* Free return value */
- zval_ptr_dtor(&retval);
-
- return 0;
-}
-/* }}} */
-
-/* {{{ scheme_handler_is_registered()
- Check to see if the scheme handler is registered with the user */
-static int scheme_handler_is_registered(php_xslt *handle)
-{
- /* If one of the functions is exists, then scheme
- handlers are registered */
- if (XSLT_SCHEME(handle).get_all ||
- XSLT_SCHEME(handle).open ||
- XSLT_SCHEME(handle).get ||
- XSLT_SCHEME(handle).put ||
- XSLT_SCHEME(handle).close)
- return 1;
- /* otherwise, no cigar */
- else
- return 0;
-}
-/* }}} */
-
-/* {{{ scheme_freememory()
- Called when sablotron needs to free memory related to scheme handling */
-static int scheme_freememory(void *user_data, SablotHandle proc, char *buffer)
-{
- /* If we don't have any scheme handler's registered, then emalloc() wasn't
- used, and if emalloc() wasn't then efree shouldn't be used */
- if (!scheme_handler_is_registered((php_xslt *) user_data)) {
- return 0;
- }
-
- /* Free the memory using efree() and remove it from the register */
- efree(buffer);
-
- return 0;
-}
-/* }}} */
-
-/* {{{ scheme_open()
- Called when the URI needs to be opened */
-static int scheme_open(void *user_data, SablotHandle proc, const char *scheme, const char *rest, int *fd)
-{
- zval *argv[3]; /* Arguments to the scheme open function */
- zval *retval; /* The return value from the scheme open function */
- php_xslt *handle = (php_xslt *) user_data; /* A PHP-XSLT processor */
-
- /* If no open handler exists, let's exit */
- if (!XSLT_SCHEME(handle).open) {
- return 0;
- }
-
- /* Allocate and initialize arguments */
- MAKE_STD_ZVAL(argv[0]);
- MAKE_STD_ZVAL(argv[1]);
- MAKE_STD_ZVAL(argv[2]);
-
- /* Argument 1: XSLT Processor (resource)
- Argument 2: Scheme (string)
- Argument 3: Rest (string)
- */
- ZVAL_RESOURCE(argv[0], handle->processor.idx);
- zend_list_addref(handle->processor.idx);
- ZVAL_STRING(argv[1], (char *) scheme, 1);
- ZVAL_STRING(argv[2], (char *) rest, 1);
-
- /* Call the function */
- xslt_call_function("scheme open", XSLT_SCHEME(handle).open,
- 3, argv, &retval);
-
- /* Return value is a resource pointer to an open file */
- *fd = Z_LVAL_P(retval);
-
- /* Free it all up */
- zval_ptr_dtor(&retval);
-
- /* return success */
- return 0;
-}
-/* }}} */
-
-/* {{{ scheme_get()
- Called when data needs to be fetched from the URI */
-static int scheme_get(void *user_data, SablotHandle proc, int fd, char *buffer, int *byte_count)
-{
- zval *argv[3]; /* Arguments to the scheme get function */
- zval *retval; /* Return value from the scheme get function */
- php_xslt *handle = (php_xslt *) user_data; /* A PHP-XSLT processor */
-
- /* If no get handler exists, let's exit */
- if (!XSLT_SCHEME(handle).get) {
- return 0;
- }
-
- /* Allocate and initialize arguments */
- MAKE_STD_ZVAL(argv[0]);
- MAKE_STD_ZVAL(argv[1]);
- MAKE_STD_ZVAL(argv[2]);
-
- /* Argument 1: XSLT Processor (resource)
- Argument 2: File Pointer (resource)
- Argument 3: Data (string)
- */
- ZVAL_RESOURCE(argv[0], handle->processor.idx);
- zend_list_addref(handle->processor.idx);
- ZVAL_RESOURCE(argv[1], fd);
- zend_list_addref(fd);
- ZVAL_STRINGL(argv[2], buffer, *byte_count, 0);
-
- /* Call the function */
- xslt_call_function("scheme get", XSLT_SCHEME(handle).get,
- 3, argv, &retval);
-
- /* Returns the number of bytes read */
- *byte_count = Z_LVAL_P(retval);
-
- /* Free things up */
- zval_ptr_dtor(&retval);
-
- /* return success */
- return 0;
-}
-/* }}} */
-
-/* {{{ scheme_put()
- Called when data needs to be written */
-static int scheme_put(void *user_data, SablotHandle proc, int fd, const char *buffer, int *byte_count)
-{
- zval *argv[3]; /* Arguments to the scheme put function */
- zval *retval; /* Return value from the scheme put function */
- php_xslt *handle = (php_xslt *) user_data; /* A PHP-XSLT processor */
-
- /* If no put handler exists, let's exit */
- if (!XSLT_SCHEME(handle).put) {
- return 0;
- }
-
- /* Allocate and initialize arguments */
- MAKE_STD_ZVAL(argv[0]);
- MAKE_STD_ZVAL(argv[1]);
- MAKE_STD_ZVAL(argv[2]);
-
- /* Argument 1: XSLT processor (resource)
- Argument 2: File pointer (resource)
- Argument 3: Data (string)
- */
- ZVAL_RESOURCE(argv[0], handle->processor.idx);
- zend_list_addref(handle->processor.idx);
- ZVAL_RESOURCE(argv[1], fd);
- zend_list_addref(fd);
- ZVAL_STRINGL(argv[2], (char *) buffer, *byte_count, 1);
-
- /* Call the scheme put function already */
- xslt_call_function("scheme put", XSLT_SCHEME(handle).put,
- 3, argv, &retval);
-
- /* The return value is the number of bytes written */
- *byte_count = Z_LVAL_P(retval);
-
- /* Free everything up */
- zval_ptr_dtor(&retval);
-
- /* Return success */
- return 0;
-}
-/* }}} */
-
-/* {{{ scheme_close()
- Called when its time to close the fd */
-static int scheme_close(void *user_data, SablotHandle proc, int fd)
-{
- zval *argv[2]; /* Arguments to the scheme close function*/
- zval *retval; /* Return value from the scheme close function */
- php_xslt *handle = (php_xslt *) user_data; /* A PHP-XSLT processor */
-
- /* if no close handler exists, exit */
- if (!XSLT_SCHEME(handle).close) {
- return 0;
- }
-
- /* Allocate and initialize arguments */
- MAKE_STD_ZVAL(argv[0]);
- MAKE_STD_ZVAL(argv[1]);
-
- /* Argument 1: XSLT processor (resource)
- Argument 2: File pointer (resource)
- */
- ZVAL_RESOURCE(argv[0], handle->processor.idx);
- zend_list_addref(handle->processor.idx);
- ZVAL_RESOURCE(argv[1], fd);
- zend_list_addref(fd);
-
- /* Call the scheme handler close function */
- xslt_call_function("scheme close", XSLT_SCHEME(handle).close,
- 2, argv, &retval);
-
- /* Free everything up */
- zval_ptr_dtor(&retval);
-
- /* Return success */
- return 0;
-}
-/* }}} */
-
-/* {{{ sax_startdoc()
- Called when the document starts to be processed */
-static SAX_RETURN sax_startdoc(void *ctx)
-{
- zval *argv[1]; /* Arguments to the sax start doc function */
- zval *retval; /* Return value from sax start doc function */
- php_xslt *handle = (php_xslt *) ctx; /* A PHP-XSLT processor */
-
- /* if no document start function exists, exit */
- if (!XSLT_SAX(handle).doc_start) {
- return;
- }
-
- /* Allocate and initialize arguments */
- MAKE_STD_ZVAL(argv[0]);
-
- /* Argument 1: XSLT processor (resource) */
- ZVAL_RESOURCE(argv[0], handle->processor.idx);
- zend_list_addref(handle->processor.idx);
-
- /* Call the Sax start doc function */
- xslt_call_function("sax start doc", XSLT_SAX(handle).doc_start,
- 1, argv, &retval);
-
- /* Cleanup */
- zval_ptr_dtor(&retval);
-}
-/* }}} */
-
-/* {{{ sax_startelement()
- Called when an element is begun to be processed */
-static SAX_RETURN sax_startelement(void *ctx,
- const char *name,
- const char **attr)
-{
- zval *argv[3]; /* Arguments to the sax start element function */
- zval *retval; /* Return value from the sax start element function */
- php_xslt *handle = (php_xslt *) ctx; /* A PHP-XSLT processor */
- char **p; /* Pointer to attributes */
-
- /* If no element start function is found, exit */
- if (!XSLT_SAX(handle).element_start) {
- return;
- }
-
- /* Allocate and initialize arguments */
- MAKE_STD_ZVAL(argv[0]);
- MAKE_STD_ZVAL(argv[1]);
- MAKE_STD_ZVAL(argv[2]);
- array_init(argv[2]);
-
- /* Argument 1: XSLT processor (resource)
- Argument 2: Element name (string)
- Argument 3: Element attributes (array)
- */
- ZVAL_RESOURCE(argv[0], handle->processor.idx);
- zend_list_addref(handle->processor.idx);
- ZVAL_STRING(argv[1], (char *) name, 1);
-
- /* loop through the attributes array, copying it onto our
- php array */
- p = (char **) attr;
- while (p && *p) {
- add_assoc_string(argv[2], *p, *(p + 1), 1);
- p += 2;
- }
-
- /* Call the sax element start function */
- xslt_call_function("sax start element", XSLT_SAX(handle).element_start,
- 3, argv, &retval);
-
- /* Cleanup */
- zval_ptr_dtor(&retval);
-}
-/* }}} */
-
-/* {{{ xslt_sax_endelement()
- Called when an ending XML element is encountered */
-static SAX_RETURN sax_endelement(void *ctx, const char *name)
-{
- zval *argv[2]; /* Arguments to the sax end element function */
- zval *retval; /* Return value from the sax end element function */
- php_xslt *handle = (php_xslt *) ctx; /* A PHP-XSLT processor */
-
- /* If no element end function exists, exit */
- if (!XSLT_SAX(handle).element_end) {
- return;
- }
-
- /* Allocate and initialize arguments */
- MAKE_STD_ZVAL(argv[0]);
- MAKE_STD_ZVAL(argv[1]);
-
- /* Argument 1: XSLT processor (resource)
- Argument 2: Element name (string)
- */
- ZVAL_RESOURCE(argv[0], handle->processor.idx);
- zend_list_addref(handle->processor.idx);
- ZVAL_STRING(argv[1], (char *) name, 1);
-
- /* Call the sax end element function */
- xslt_call_function("sax end element", XSLT_SAX(handle).element_end,
- 2, argv, &retval);
-
- /* Cleanup */
- zval_ptr_dtor(&retval);
-}
-/* }}} */
-
-/* {{{ sax_startnamespace()
- Called at the beginning of the parsing of a new namespace */
-static SAX_RETURN sax_startnamespace(void *ctx,
- const char *prefix,
- const char *uri)
-{
- zval *argv[3]; /* Arguments to the sax start namespace function */
- zval *retval; /* Return value from the sax start namespace function */
- php_xslt *handle = (php_xslt *) ctx; /* A PHP-XSLT processor */
-
- /* if no namespace start function exists, exit */
- if (!XSLT_SAX(handle).namespace_start) {
- return;
- }
-
- /* Allocate and initialize arguments */
- MAKE_STD_ZVAL(argv[0]);
- MAKE_STD_ZVAL(argv[1]);
- MAKE_STD_ZVAL(argv[2]);
-
- /* Argument 1: XSLT processor (resource)
- Argument 2: Prefix (string)
- Argument 3: URI (string)
- */
- ZVAL_RESOURCE(argv[0], handle->processor.idx);
- zend_list_addref(handle->processor.idx);
- ZVAL_STRING(argv[1], (char *) prefix, 1);
- ZVAL_STRING(argv[2], (char *) uri, 1);
-
- /* Call the sax start namespace function */
- xslt_call_function("sax start namespace", XSLT_SAX(handle).namespace_start,
- 3, argv, &retval);
-
- /* Cleanup */
- zval_ptr_dtor(&retval);
-}
-/* }}} */
-
-/* {{{ sax_endnamespace()
- Called when a new namespace is finished being parsed */
-static SAX_RETURN sax_endnamespace(void *ctx, const char *prefix)
-{
- zval *argv[2]; /* Arguments to the sax end namespace function */
- zval *retval; /* Return value from the sax end namespace function */
- php_xslt *handle = (php_xslt *) ctx; /* A PHP-XSLT processor */
-
- /* If no namespace end function exists, exit */
- if (!XSLT_SAX(handle).namespace_end) {
- return;
- }
-
- /* Allocate and initialize arguments */
- MAKE_STD_ZVAL(argv[0]);
- MAKE_STD_ZVAL(argv[1]);
-
- /* Argument 1: XSLT processor (resource)
- Argument 2: Prefix (string)
- */
- ZVAL_RESOURCE(argv[0], handle->processor.idx);
- zend_list_addref(handle->processor.idx);
- ZVAL_STRING(argv[1], (char *) prefix, 1);
-
- /* Call the sax end namespace function */
- xslt_call_function("sax end namespace", XSLT_SAX(handle).namespace_end,
- 2, argv, &retval);
-
- /* Cleanup */
- zval_ptr_dtor(&retval);
-}
-/* }}} */
-
-/* {{{ sax_comment()
- Called when a comment is found */
-static SAX_RETURN sax_comment(void *ctx, const char *contents)
-{
- zval *argv[2]; /* Arguments to the sax comment function */
- zval *retval; /* Return value from the sax comment function */
- php_xslt *handle = (php_xslt *) ctx; /* A PHP-XSLT processor */
-
- /* if no comment function exists, exit */
- if (!XSLT_SAX(handle).comment) {
- return;
- }
-
- /* Allocate and initialize arguments */
- MAKE_STD_ZVAL(argv[0]);
- MAKE_STD_ZVAL(argv[1]);
-
- /* Argument 1: XSLT processor (resource)
- Argument 2: Comment contents (string)
- */
- ZVAL_RESOURCE(argv[0], handle->processor.idx);
- zend_list_addref(handle->processor.idx);
- ZVAL_STRING(argv[1], (char *) contents, 1);
-
- /* Call the sax comment function */
- xslt_call_function("sax comment", XSLT_SAX(handle).comment,
- 2, argv, &retval);
-
- /* Cleanup */
- zval_ptr_dtor(&retval);
-}
-/* }}} */
-
-/* {{{ sax_pi()
- Called when processing instructions are found */
-static SAX_RETURN sax_pi(void *ctx,
- const char *target,
- const char *contents)
-{
- zval *argv[3]; /* Arguments to the sax processing instruction function */
- zval *retval; /* Return value from the sax processing instruction function */
- php_xslt *handle = (php_xslt *) ctx; /* A PHP-XSLT processor */
-
- /* If no processing instructions function exists, exit */
- if (!XSLT_SAX(handle).pi) {
- return;
- }
-
- /* Allocate and initialize arguments */
- MAKE_STD_ZVAL(argv[0]);
- MAKE_STD_ZVAL(argv[1]);
- MAKE_STD_ZVAL(argv[2]);
-
- /* Argument 1: XSLT processor (resource)
- Argument 2: Target of the pi (string)
- Argument 3: Contents of the pi (string)
- */
- ZVAL_RESOURCE(argv[0], handle->processor.idx);
- zend_list_addref(handle->processor.idx);
- ZVAL_STRING(argv[1], (char *) target, 1);
- ZVAL_STRING(argv[2], (char *) contents, 1);
-
- /* Call processing instructions function */
- xslt_call_function("sax processing instructions", XSLT_SAX(handle).pi,
- 3, argv, &retval);
-
- /* Cleanup */
- zval_ptr_dtor(&retval);
-}
-/* }}} */
-
-/* {{{ sax_characters()
- Called when characters are come upon */
-static SAX_RETURN sax_characters(void *ctx,
- const char *contents,
- int length)
-{
- zval *argv[2]; /* Arguments to the sax characters function */
- zval *retval; /* Return value to the sax characters function */
- php_xslt *handle = (php_xslt *) ctx; /* A PHP-XSLT processor */
-
- /* If no characters function exists, exit */
- if (!XSLT_SAX(handle).characters) {
- return;
- }
-
- /* Allocate and initialize arguments */
- MAKE_STD_ZVAL(argv[0]);
- MAKE_STD_ZVAL(argv[1]);
-
- /* Argument 1: XSLT processor (resource)
- Argument 2: Contents (string)
- */
- ZVAL_RESOURCE(argv[0], handle->processor.idx);
- zend_list_addref(handle->processor.idx);
- ZVAL_STRINGL(argv[1], (char *) contents, length, 1);
-
- /* Call characters function */
- xslt_call_function("sax characters", XSLT_SAX(handle).characters,
- 2, argv, &retval);
-
- /* Cleanup */
- zval_ptr_dtor(&retval);
-}
-/* }}} */
-
-/* {{{ sax_enddoc()
- Called when the document is finished being parsed */
-static SAX_RETURN sax_enddoc(void *ctx)
-{
- zval *argv[1]; /* Arguments to the end document function */
- zval *retval; /* Return value from the end document function */
- php_xslt *handle = (php_xslt *) ctx; /* A PHP-XSLT processor */
-
- /* If no end document function exists, exit */
- if (!XSLT_SAX(handle).doc_end) {
- return;
- }
-
- /* Allocate and initialize arguments */
- MAKE_STD_ZVAL(argv[0]);
-
- /* Argument 1: XSLT Processor (resource)
- */
- ZVAL_RESOURCE(argv[0], handle->processor.idx);
- zend_list_addref(handle->processor.idx);
-
- /* Call the function */
- xslt_call_function("sax end doc", XSLT_SAX(handle).doc_end,
- 1, argv, &retval);
-
- /* Cleanup */
- zval_ptr_dtor(&retval);
-}
-/* }}} */
-
-/* {{{ error_makecode()
- Make the error code */
-static MH_ERROR error_makecode(void *user_data, SablotHandle proc, int severity, unsigned short facility, unsigned short code)
-{
- return(0);
-}
-/* }}} */
-
-/* {{{ error_log()
- Called when its time to log data */
-static MH_ERROR error_log(void *user_data, SablotHandle proc, MH_ERROR code, MH_LEVEL level, char **fields)
-{
- php_xslt *handle = (php_xslt *) user_data; /* A PHP-XSLT processor */
- char *errmsg = NULL; /* Error message*/
- char *errtype = NULL; /* Error type */
- char *errline = NULL; /* Error line */
- char *msgbuf = NULL; /* Message buffer */
- char msgformat[] = "Sablotron Message on line %s, level %s: %s\n"; /* Message format */
- int error = 0; /* Error container */
-
- /* Parse the error array */
- /* Loop through the error array */
- if (fields) {
- while (fields && *fields) {
- char *key; /* Key to for the message */
- char *val; /* The message itself */
- char *ptr; /* Pointer to the location of the ':' (separator) */
- int pos; /* Position of the ':' (separator) */
- int len; /* Length of the string */
-
- len = strlen(*fields);
-
- /* Grab the separator's position */
- ptr = strchr(*fields, ':');
- if (!ptr) {
- continue;
- }
- pos = ptr - *fields;
-
- /* Allocate the key and value and copy the data onto them */
- key = emalloc(pos + 1);
- val = emalloc((len - pos) + 1);
-
- memcpy(key, *fields, pos);
- memcpy(val, *fields + pos + 1, len - pos - 1);
-
- key[pos] = '\0';
- val[len - pos - 1] = '\0';
-
- /* Check to see whether or not we want to save the data */
- if (!strcmp(key, "msg")) {
- errmsg = estrndup(val, len - pos -1);
- }
- else if (!strcmp(key, "type")) {
- errtype = estrndup(val, len - pos - 1);
- }
- else if (!strcmp(key, "line")) {
- errline = estrndup(val, len - pos - 1);
- }
-
- /* Cleanup */
- if (key) efree(key);
- if (val) efree(val);
-
- /* Next key:value pair please :) */
- fields++;
- }
- }
-
-
- /* If no error line is given, then place none in the
- file */
- if (!errline) {
- errline = estrndup("none", sizeof("none") - 1);
- }
-
- /* Default type is a log handle */
- if (!errtype) {
- errtype = estrndup("log", sizeof("log") - 1);
- }
-
- /* No error message, no cry */
- if (!errmsg) {
- errmsg = estrndup("unknown error", sizeof("unknown error") - 1);
- }
-
- /* Allocate the message buf and copy the data into it */
- msgbuf = emalloc((sizeof(msgformat) - 6) +
- strlen(errmsg) +
- strlen(errline) +
- strlen(errtype) + 1);
- sprintf(msgbuf, msgformat, errline, errtype, errmsg);
-
- /* If the error is serious enough, copy it to our error buffer
- which will show up when someone calls the xslt_error() function */
- if (level == MH_LEVEL_WARN ||
- level == MH_LEVEL_ERROR ||
- level == MH_LEVEL_CRITICAL) {
- if (XSLT_ERRSTR(handle))
- efree(XSLT_ERRSTR(handle));
-
- XSLT_ERRSTR(handle) = estrdup(errmsg);
- }
-
- /* If we haven't allocated and opened the file yet */
- if (!XSLT_LOG(handle).fd) {
- /* Lets open up a file */
- if (XSLT_LOG(handle).path && strcmp(XSLT_LOG(handle).path, "php://stderr")) {
- /* open for append */
- XSLT_LOG(handle).fd = open(XSLT_LOG(handle).path,
- O_WRONLY|O_CREAT|O_APPEND,
- S_IRUSR|S_IRGRP|S_IROTH|S_IWUSR);
- if (XSLT_LOG(handle).fd < 0) {
- php_error(E_WARNING, "Cannot open log file, %s [%d]: %s",
- XSLT_LOG(handle).path, errno, strerror(errno));
- XSLT_LOG(handle).fd = 0;
- }
- }
- /* Default is stderr, or if the user provided "php://stderr" that's the
- stream */
- else {
- XSLT_LOG(handle).fd = 2;
- }
- }
-
- /* Write the error to the file */
- error = write(XSLT_LOG(handle).fd, msgbuf, strlen(msgbuf));
- if (error < 1) {
- php_error(E_WARNING, "Cannot write data to log file, %s, with fd, %d [%d]: %s",
- (XSLT_LOG(handle).path ? XSLT_LOG(handle).path : "stderr"),
- XSLT_LOG(handle).fd,
- error,
- strerror(error));
- return 0;
- }
-
- /* Cleanup */
- if (msgbuf) efree(msgbuf);
- if (errtype) efree(errtype);
- if (errline) efree(errline);
- if (errmsg) efree(errmsg);
-
- return 0;
-}
-/* }}} */
-
-/* {{{ error_print()
- Print out an error message or call the error handler */
-static MH_ERROR error_print(void *user_data, SablotHandle proc, MH_ERROR code, MH_LEVEL level, char **fields)
-{
- php_xslt *handle = (php_xslt *) user_data; /* A PHP-XSLT processor */
-
- if (XSLT_ERROR(handle)) {
- zval *argv[4]; /* Arguments to the error function */
- zval *retval; /* Return value from the error function */
-
- /* Allocate and initialize */
- MAKE_STD_ZVAL(argv[0]);
- MAKE_STD_ZVAL(argv[1]);
- MAKE_STD_ZVAL(argv[2]);
- MAKE_STD_ZVAL(argv[3]);
- array_init(argv[3]);
-
- /* Argument 1: XSLT Processor (resource)
- Argument 2: Error level (long)
- Argument 3: Error code (long)
- Argument 4: Error messages (array)
- */
- ZVAL_RESOURCE(argv[0], handle->processor.idx);
- zend_list_addref(handle->processor.idx);
- ZVAL_LONG(argv[1], level);
- ZVAL_LONG(argv[2], code);
-
- if (fields) {
- while (fields && *fields) {
- char *key; /* Key to for the message */
- char *val; /* The message itself */
- char *ptr; /* Pointer to the location of the ':' (separator) */
- int pos; /* Position of the ':' (separator) */
- int len; /* Length of the string */
-
- len = strlen(*fields);
-
- /* Grab the separator's position */
- ptr = strchr(*fields, ':');
- if (!ptr) {
- continue;
- }
- pos = ptr - *fields;
-
- /* Allocate the key and value and copy the data onto them */
- key = emalloc(pos + 1);
- val = emalloc((len - pos) + 1);
-
- memcpy(key, *fields, pos);
- memcpy(val, *fields + pos + 1, len - pos - 1);
- key[pos] = '\0';
- val[len - pos - 1] = '\0';
-
- /* Add it */
- add_assoc_stringl_ex(argv[3], key, pos, val, len - pos - 1, 1);
-
- /* Cleanup */
- efree(key);
- efree(val);
-
- /* Next field please */
- fields++;
- }
- }
-
- /* Call the function */
- xslt_call_function("error handler", XSLT_ERROR(handle),
- 4, argv, &retval);
-
- /* Free up */
- zval_ptr_dtor(&retval);
- }
- else {
- char *errmsg = NULL; /* Error message */
- char *errline = NULL; /* Error line */
- char *msgbuf = NULL; /* Message buffer */
- char msgformat[] = "Sablotron error on line %s: %s"; /* Message format */
-
- /* If the error is not serious, exit out */
- if (code == MH_LEVEL_WARN ||
- code == MH_LEVEL_ERROR ||
- code == MH_LEVEL_CRITICAL) {
- return 0;
- }
-
- /* Loop through and extract the error message and the
- error line */
- if (fields) {
- while (fields && *fields) {
- char *key; /* Key to for the message */
- char *val; /* The message itself */
- char *ptr; /* Pointer to the location of the ':' (separator) */
- int pos; /* Position of the ':' (separator) */
- int len; /* Length of the string */
-
- len = strlen(*fields);
-
- /* Grab the separator's position */
- ptr = strchr(*fields, ':');
- if (!ptr) {
- continue;
- }
- pos = ptr - *fields;
-
- /* Allocate the key and value and copy the data onto them */
- key = emalloc(pos + 1);
- val = emalloc((len - pos) + 1);
-
- memcpy(key, *fields, pos);
- memcpy(val, *fields + pos + 1, len - pos - 1);
-
- key[pos] = '\0';
- val[len - pos - 1] = '\0';
-
- /* Check to see whether or not we want to save the data */
- if (!strcmp(key, "msg")) {
- errmsg = estrdup(val);
- }
- else if (!strcmp(key, "line")) {
- errline = estrdup(val);
- }
-
- /* Cleanup */
- if (key) efree(key);
- if (val) efree(val);
-
- /* Next key:value pair please :) */
- fields++;
- }
- }
-
- if (!errline) {
- errline = estrndup("none", sizeof("none") - 1);
- }
-
- /* Allocate the message buffer and copy the data onto it */
- msgbuf = emalloc((sizeof(msgformat) - 4) + strlen(errmsg) + strlen(errline) + 1);
- sprintf(msgbuf, msgformat, errline, errmsg);
-
- /* Copy the error message onto the handle for use when
- the xslt_error function is called */
- XSLT_ERRSTR(handle) = estrdup(errmsg);
-
- /* Output a warning */
- php_error(E_WARNING, msgbuf);
-
- /* Cleanup */
- efree(msgbuf);
- efree(errmsg);
- efree(errline);
- }
-
- return(0);
-}
-/* }}} */
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/xslt/tests/001.phpt b/ext/xslt/tests/001.phpt
deleted file mode 100644
index 3270c3f20e..0000000000
--- a/ext/xslt/tests/001.phpt
+++ /dev/null
@@ -1,12 +0,0 @@
---TEST--
-Check for xslt presence
---SKIPIF--
-<?php if (!extension_loaded("xslt")) print "skip"; ?>
---POST--
---GET--
---FILE--
-<?php
-echo "xslt extension is available";
-?>
---EXPECT--
-xslt extension is available \ No newline at end of file
diff --git a/ext/xslt/xslt.c b/ext/xslt/xslt.c
deleted file mode 100644
index dc969b5f12..0000000000
--- a/ext/xslt/xslt.c
+++ /dev/null
@@ -1,256 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997, 1998, 1999, 2000, 2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Sterling Hughes <sterling@php.net> |
- +----------------------------------------------------------------------+
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "php_xslt.h"
-
-#if HAVE_XSLT
-
-#include <stdio.h>
-#include <string.h>
-#include <stdarg.h>
-
-static int debug = 0;
-
-/* {{{ xslt_debug()
- Output a debug message if debugging is enabled */
-extern void xslt_debug(char *function_name, char *format, ...)
-{
- if (debug) {
- va_list argv;
- char buffer[1024];
-
- va_start(argv, format);
- vsnprintf(buffer, sizeof(buffer) - 1, format, argv);
- va_end(argv);
-
- buffer[sizeof(buffer) - 1] = '\0';
-
- php_printf("<b>XSLT Debug</b>: %s: %s<br>\n",
- function_name, buffer);
- }
-}
-/* }}} */
-
-/* {{{ find_xslt_argument()
- Find and return an xslt argument from the argument buffer */
-static char *_find_xslt_argument(const char **argv, const char *key)
-{
- char **ptr; /* Pointer to the passed char ** array */
- char *return_value = NULL; /* Value to return from the function */
-
- /* Loop through the array searching for the value */
- ptr = (char **) argv;
- while (ptr && *ptr) {
- /* If we have a match, save the value and exit out */
- if (! strcmp(*ptr, key)) {
- return_value = estrdup(*ptr);
- break;
- }
-
- ptr++;
- }
-
- return return_value;
-}
-/* }}} */
-
-/* {{{ xslt_make_array()
- Make an XSLT array (char **) from a zval array (HashTable *) */
-extern void xslt_make_array(zval **zarr, char ***carr)
-{
- zval **current;
- HashTable *arr;
- int idx = 0;
-
- arr = HASH_OF(*zarr);
- if (! arr) {
- php_error(E_WARNING, "Invalid argument or parameter array to %s",
- get_active_function_name());
- return;
- }
-
- *carr = emalloc((zend_hash_num_elements(arr) * 2) + 1);
-
- for (zend_hash_internal_pointer_reset(arr);
- zend_hash_get_current_data(arr, (void **) &current) == SUCCESS;
- zend_hash_move_forward(arr)) {
- char *string_key = NULL;
- ulong num_key;
- int type;
-
- SEPARATE_ZVAL(current);
- convert_to_string_ex(current);
-
- type = zend_hash_get_current_key(arr, &string_key, &num_key, 0);
- if (type == HASH_KEY_IS_LONG) {
- php_error(E_WARNING, "Invalid argument or parameter array to %s",
- get_active_function_name());
- return;
- }
-
- (*carr)[idx++] = estrdup(string_key);
- (*carr)[idx++] = estrndup(Z_STRVAL_PP(current), Z_STRLEN_PP(current));
- }
-
- (*carr)[idx] = NULL;
-}
-/* }}} */
-
-/* {{{ xslt_free_array()
- Free an xslt array built by xslt_make_array() */
-extern void xslt_free_array(char **arr)
-{
- char **ptr = arr;
-
- while (*ptr != NULL) {
- efree(*ptr);
- ptr++;
- }
-
- efree(arr);
-}
-/* }}} */
-
-/* {{{ xslt_parse_arguments()
- Parse an XSLT argument buffer */
-extern xslt_args *xslt_parse_arguments(char *xml,
- char *xsl,
- char *result,
- char **argv)
-{
- xslt_args *return_value; /* The value to return from the function */
-
- return_value = emalloc(sizeof(xslt_args));
-
- /* The xml argument */
- if (! strncasecmp(xml, "arg:", 4)) {
- char *key = xml + 5;
-
- return_value->xml.type = XSLT_IS_DATA;
- return_value->xml.ptr = _find_xslt_argument((const char **) argv,
- (const char *) key);
- }
- else {
- return_value->xml.type = XSLT_IS_FILE;
- return_value->xml.ptr = estrdup(xml);
- }
-
- /* The xslt arguments */
- if (! strncasecmp(xsl, "arg:", 4)) {
- char *key = xsl + 5;
-
- return_value->xsl.type = XSLT_IS_DATA;
- return_value->xsl.ptr = _find_xslt_argument((const char **) argv,
- (const char *) key);
- }
- else {
- return_value->xsl.type = XSLT_IS_FILE;
- return_value->xsl.ptr = estrdup(xsl);
- }
-
- /* The result argument */
- if (! strncasecmp(result, "arg:", 4)) {
- char *key = result + 5;
-
- return_value->result.type = XSLT_IS_DATA;
- return_value->result.ptr = _find_xslt_argument((const char **) argv,
- (const char *) key);
- }
- else {
- return_value->result.type = XSLT_IS_FILE;
- return_value->result.ptr = estrdup(result);
- }
-
- return return_value;
-}
-/* }}} */
-
-/* {{{ free_xslt_arguments()
- Free's an XSLT argument list returned from parse_xslt_arguments() */
-extern void xslt_free_arguments(xslt_args *to_free)
-{
- if (to_free->xml.ptr) {
- efree(to_free->xml.ptr);
- }
-
- if (to_free->xsl.ptr) {
- efree(to_free->xsl.ptr);
- }
-
- if (to_free->result.ptr) {
- efree(to_free->result.ptr);
- }
-
- efree(to_free);
-}
-/* }}} */
-
-/* {{{ call_xslt_function()
- Call an XSLT handler */
-extern void xslt_call_function(char *name,
- zval *function,
- int argc,
- zval **user_args,
- zval **retval)
-{
- zval ***argv; /* Argument container, maps around for call_user_function_ex() */
- int error; /* Error container */
- int idx; /* Idx, when looping through and free'ing the arguments */
- ELS_FETCH(); /* For TS mode, fetch the executor globals */
-
- /* Allocate and initialize return value from the function */
- MAKE_STD_ZVAL(*retval);
-
- argv = emalloc(argc * sizeof(zval **));
- for (idx = 0; idx < argc; idx++) {
- argv[idx] = &user_args[idx];
- }
-
- /* Call the function */
- error = call_user_function_ex(EG(function_table),
- NULL, function,
- retval, argc, argv, 0, NULL);
- if (error == FAILURE) {
- php_error(E_WARNING, "Cannot call the %s handler: %s",
- name, Z_STRVAL_P(function));
- }
-
- /* Cleanup arguments */
- for (idx = 0; idx < argc; idx++) {
- /* Decrease refcount and free if refcount is <= 0 */
- zval_ptr_dtor(argv[idx]);
- }
-
- efree(argv);
-}
-/* }}} */
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/xslt/xslt.dsp b/ext/xslt/xslt.dsp
deleted file mode 100644
index fd8c2dc10e..0000000000
--- a/ext/xslt/xslt.dsp
+++ /dev/null
@@ -1,115 +0,0 @@
-# Microsoft Developer Studio Project File - Name="xslt" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=xslt - Win32 Debug_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "xslt.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "xslt.mak" CFG="xslt - Win32 Debug_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "xslt - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "xslt - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "xslt - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XSLT_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\main" /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\win32" /D "WIN32" /D "COMPILE_DL_XSLT" /D ZTS=1 /D HAVE_XSLT=1 /D ZEND_DEBUG=0 /D "NDEBUG" /D "_WINDOWS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "HAVE_SABLOT_BACKEND" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x407 /d "NDEBUG"
-# ADD RSC /l 0x407 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 kernel32.lib php4ts.lib sablot.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_xslt.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
-
-!ELSEIF "$(CFG)" == "xslt - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XSLT_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\TSRM" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_XSLT=1 /D COMPILE_DL_XSLT=1 /D "HAVE_SABLOT_BACKEND" /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x407 /d "_DEBUG"
-# ADD RSC /l 0x407 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib php4ts_debug.lib sablot.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"..\..\Debug_TS/php_xslt.dll" /pdbtype:sept /libpath:"..\..\Debug_TS"
-
-!ENDIF
-
-# Begin Target
-
-# Name "xslt - Win32 Release_TS"
-# Name "xslt - Win32 Debug_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\sablot.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\xslt.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_sablot.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\php_xslt.h
-# End Source File
-# End Group
-# End Target
-# End Project
diff --git a/ext/yaz/CREDITS b/ext/yaz/CREDITS
deleted file mode 100644
index e44f215df0..0000000000
--- a/ext/yaz/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-YAZ
-Adam Dickmeiss
diff --git a/ext/yaz/Makefile.in b/ext/yaz/Makefile.in
deleted file mode 100644
index 0df612ffa2..0000000000
--- a/ext/yaz/Makefile.in
+++ /dev/null
@@ -1,7 +0,0 @@
-LTLIBRARY_NAME = libyaz.la
-LTLIBRARY_SOURCES = php_yaz.c
-LTLIBRARY_SHARED_NAME = yaz.la
-LTLIBRARY_SHARED_LIBADD = $(YAZ_SHARED_LIBADD)
-
-include $(top_srcdir)/build/dynlib.mk
-
diff --git a/ext/yaz/README b/ext/yaz/README
deleted file mode 100644
index 2ee3ac1781..0000000000
--- a/ext/yaz/README
+++ /dev/null
@@ -1,5 +0,0 @@
-This extension implements a Z39.50 client for PHP using the YAZ toolkit.
-
-Find more information at:
- http://www.indexdata.dk/phpyaz/
- http://www.indexdata.dk/yaz/
diff --git a/ext/yaz/config.m4 b/ext/yaz/config.m4
deleted file mode 100644
index 9eeb9d2e9e..0000000000
--- a/ext/yaz/config.m4
+++ /dev/null
@@ -1,29 +0,0 @@
-dnl $Id$
-
-PHP_ARG_WITH(yaz,for YAZ support,
-[ --with-yaz[=DIR] Include YAZ support (ANSI/NISO Z39.50). DIR is
- the YAZ bin install directory])
-
-
-if test "$PHP_YAZ" != "no"; then
- yazconfig=NONE
- if test "$PHP_YAZ" = "yes"; then
- AC_PATH_PROG(yazconfig, yaz-config, NONE)
- else
- if test -r ${PHP_YAZ}/yaz-config; then
- yazconfig=${PHP_YAZ}/yaz-config
- else
- yazconfig=${PHP_YAZ}/bin/yaz-config
- fi
- fi
-
- if test -f $yazconfig; then
- AC_DEFINE(HAVE_YAZ,1,[Whether you have YAZ])
- . $yazconfig
- YAZLIB=`echo $YAZLIB|sed 's%/.libs%%'`
- PHP_EVAL_LIBLINE($YAZLIB, YAZ_SHARED_LIBADD)
- PHP_EVAL_INCLINE($YAZINC)
- PHP_SUBST(YAZ_SHARED_LIBADD)
- PHP_EXTENSION(yaz, $ext_shared)
- fi
-fi
diff --git a/ext/yaz/php_yaz.c b/ext/yaz/php_yaz.c
deleted file mode 100644
index 8ce2e1fa5c..0000000000
--- a/ext/yaz/php_yaz.c
+++ /dev/null
@@ -1,2495 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Adam Dickmeiss <adam@indexdata.dk> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#include "php.h"
-
-#if HAVE_YAZ
-#include "ext/standard/info.h"
-#include "php_yaz.h"
-
-#include <yaz/proto.h>
-#include <yaz/tcpip.h>
-#include <yaz/pquery.h>
-#include <yaz/diagbib1.h>
-#include <yaz/otherinfo.h>
-#include <yaz/marcdisp.h>
-#include <yaz/yaz-util.h>
-#include <yaz/yaz-version.h>
-#include <yaz/yaz-ccl.h>
-#include <yaz/ill.h>
-
-#define MAX_ASSOC 100
-
-typedef struct Yaz_ResultSetInfo *Yaz_ResultSet;
-typedef struct Yaz_AssociationInfo *Yaz_Association;
-typedef struct Yaz_RecordCacheInfo *Yaz_RecordCache;
-
-struct Yaz_RecordCacheInfo {
- Z_NamePlusRecordList recordList;
- Yaz_RecordCache next;
-};
-
-struct Yaz_ResultSetInfo {
- Z_Query *query;
- Z_ReferenceId *referenceId;
- ODR odr;
- int resultCount;
- Yaz_ResultSet next;
- Z_NamePlusRecordList *recordList;
-};
-
-#define PHP_YAZ_SELECT_READ 1
-#define PHP_YAZ_SELECT_WRITE 2
-#define PHP_YAZ_STATE_CONNECTING 1
-#define PHP_YAZ_STATE_ESTABLISHED 2
-#define PHP_YAZ_STATE_CLOSED 3
-
-#define PHP_YAZ_ERROR_CONNECTION_LOST (-1)
-#define PHP_YAZ_ERROR_DECODE (-2)
-#define PHP_YAZ_ERROR_ENCODE (-3)
-#define PHP_YAZ_ERROR_CONNECT (-4)
-#define PHP_YAZ_ERROR_INIT (-5)
-#define PHP_YAZ_ERROR_TIMEOUT (-6)
-
-struct Yaz_AssociationInfo {
- char *host_port;
- int num_databaseNames;
- char **databaseNames;
- char *local_databases;
- COMSTACK cs;
- char *cookie_in;
- char *cookie_out;
- char *user;
- char *group;
- char *pass;
- char *proxy;
- int error;
- char *addinfo;
- Yaz_ResultSet resultSets;
- int persistent;
- int order;
- int state;
- int mask_select;
- int reconnect_flag;
- ODR odr_in;
- ODR odr_out;
- ODR odr_scan;
- Z_ScanResponse *scan_response;
- char *buf_out;
- int len_out;
- char *buf_in;
- int len_in;
- int (*action)(Yaz_Association t);
- int resultSetStartPoint;
- int numberOfRecordsRequested;
- char *elementSetNames;
- char *preferredRecordSyntax;
-
- CCL_parser ccl_parser;
- char *ill_buf_out;
- int ill_len_out;
-};
-
-static Yaz_Association yaz_association_mk ()
-{
- Yaz_Association p = xmalloc (sizeof(*p));
- p->host_port = 0;
- p->num_databaseNames = 0;
- p->databaseNames = 0;
- p->local_databases = 0;
- p->cs = 0;
- p->cookie_in = 0;
- p->cookie_out = 0;
- p->user = 0;
- p->group = 0;
- p->pass = 0;
- p->proxy = 0;
- p->error = 0;
- p->addinfo = 0;
- p->resultSets = 0;
- p->order = 0;
- p->state = PHP_YAZ_STATE_CLOSED;
- p->mask_select = 0;
- p->reconnect_flag = 0;
- p->odr_in = odr_createmem (ODR_DECODE);
- p->odr_out = odr_createmem (ODR_ENCODE);
- p->odr_scan = odr_createmem (ODR_ENCODE);
- p->scan_response = 0;
- p->buf_out = 0;
- p->len_out = 0;
- p->buf_in = 0;
- p->len_in = 0;
- p->action = 0;
- p->ill_buf_out = 0;
- p->ill_len_out = 0;
- p->resultSetStartPoint = 1;
- p->numberOfRecordsRequested = 10;
- p->elementSetNames = 0;
- p->preferredRecordSyntax = 0;
- p->ccl_parser = ccl_parser_create();
- p->ccl_parser->bibset = 0;
- return p;
-}
-
-static void yaz_association_destroy (Yaz_Association p)
-{
- int i;
- if (!p)
- return ;
- xfree (p->host_port);
- xfree (p->local_databases);
- for (i = 0; i<p->num_databaseNames; i++)
- xfree (p->databaseNames[i]);
- xfree (p->databaseNames);
- if (p->cs)
- cs_close (p->cs);
- xfree (p->cookie_in);
- xfree (p->cookie_out);
- xfree (p->user);
- xfree (p->group);
- xfree (p->pass);
- xfree (p->proxy);
- xfree (p->addinfo);
- odr_destroy (p->odr_in);
- odr_destroy (p->odr_out);
- odr_destroy (p->odr_scan);
- /* buf_out */
- /* buf_in */
- /* action */
- xfree (p->ill_buf_out);
- xfree (p->elementSetNames);
- xfree (p->preferredRecordSyntax);
- ccl_qual_rm(&p->ccl_parser->bibset);
- ccl_parser_destroy(p->ccl_parser);
-}
-
-static Yaz_ResultSet yaz_resultset_mk()
-{
- ODR odr = odr_createmem (ODR_ENCODE);
- Yaz_ResultSet p = odr_malloc (odr, sizeof(*p));
-
- p->query = 0;
- p->referenceId = 0;
- p->odr = odr;
- p->resultCount = 0;
- p->next = 0;
- p->recordList = 0;
- return p;
-}
-
-static void yaz_resultset_destroy (Yaz_ResultSet p)
-{
- if (!p)
- return;
- if (p->odr)
- odr_destroy (p->odr);
-}
-
-#ifdef ZTS
-static MUTEX_T yaz_mutex;
-#endif
-
-static Yaz_Association *shared_associations;
-static int order_associations;
-
-static unsigned char third_argument_force_ref[] = {
- 3, BYREF_NONE, BYREF_NONE, BYREF_FORCE };
-
-static unsigned char second_argument_force_ref[] = {
- 2, BYREF_NONE, BYREF_FORCE };
-
-function_entry yaz_functions [] = {
- PHP_FE(yaz_connect, NULL)
- PHP_FE(yaz_close, NULL)
- PHP_FE(yaz_search, NULL)
- PHP_FE(yaz_wait, second_argument_force_ref)
- PHP_FE(yaz_errno, NULL)
- PHP_FE(yaz_error, NULL)
- PHP_FE(yaz_addinfo, NULL)
- PHP_FE(yaz_hits, NULL)
- PHP_FE(yaz_record, NULL)
- PHP_FE(yaz_syntax, NULL)
- PHP_FE(yaz_element, NULL)
- PHP_FE(yaz_range, NULL)
- PHP_FE(yaz_itemorder, NULL)
- PHP_FE(yaz_scan, NULL)
- PHP_FE(yaz_scan_result, second_argument_force_ref)
- PHP_FE(yaz_present, NULL)
- PHP_FE(yaz_ccl_conf, NULL)
- PHP_FE(yaz_ccl_parse, third_argument_force_ref)
- PHP_FE(yaz_database, NULL)
- {NULL, NULL, NULL}
-};
-
-static Yaz_Association get_assoc (pval **id)
-{
- Yaz_Association assoc;
- int i;
- convert_to_long_ex(id);
- i = (*id)->value.lval;
-
-#ifdef ZTS
- tsrm_mutex_lock (yaz_mutex);
-#endif
- if (i < 1 || i > MAX_ASSOC || !shared_associations ||
- !(assoc = shared_associations[i-1]))
- {
-#ifdef ZTS
- tsrm_mutex_unlock (yaz_mutex);
-#endif
- php_error(E_WARNING, "Invalid YAZ handle");
- return 0;
- }
- return assoc;
-}
-
-static void release_assoc (Yaz_Association assoc)
-{
-#ifdef ZTS
- if (assoc)
- tsrm_mutex_unlock(yaz_mutex);
-#endif
-}
-static void do_close (Yaz_Association p)
-{
- p->mask_select = 0;
- p->state = PHP_YAZ_STATE_CLOSED;
- if (p->cs)
- {
- cs_close (p->cs);
- p->cs = 0;
- }
-}
-
-static void do_connect (Yaz_Association p)
-{
- void *addr;
- char *cp;
-
- p->reconnect_flag = 0;
- p->cs = cs_create (tcpip_type, 0, PROTO_Z3950);
-
- if (p->proxy)
- addr = tcpip_strtoaddr (p->proxy);
- else
- addr = tcpip_strtoaddr (p->host_port);
- if (!addr)
- {
- do_close(p);
- p->error = PHP_YAZ_ERROR_CONNECT;
- return;
- }
- cs_connect (p->cs, addr);
- p->state = PHP_YAZ_STATE_CONNECTING;
- p->mask_select = PHP_YAZ_SELECT_READ | PHP_YAZ_SELECT_WRITE;
-}
-
-static void response_diag (Yaz_Association t, Z_DiagRec *p)
-{
- Z_DefaultDiagFormat *r;
- char *addinfo = 0;
-
- xfree (t->addinfo);
- t->addinfo = 0;
- if (p->which != Z_DiagRec_defaultFormat)
- {
- t->error = PHP_YAZ_ERROR_DECODE;
- return;
- }
- r = p->u.defaultFormat;
-#ifdef ASN_COMPILED
- switch (r->which)
- {
- case Z_DefaultDiagFormat_v2Addinfo:
- addinfo = r->u.v2Addinfo;
- break;
- case Z_DefaultDiagFormat_v3Addinfo:
- addinfo = r->u.v3Addinfo;
- break;
- }
-#else
- addinfo = r->addinfo;
-#endif
- if (addinfo)
- t->addinfo = xstrdup (addinfo);
- t->error = *r->condition;
-}
-
-static const char *array_lookup_string(HashTable *ht, const char *idx)
-{
- pval **pvalue;
-
- if (ht && zend_hash_find(ht, (char*) idx, strlen(idx)+1,
- (void**) &pvalue) == SUCCESS)
- {
- SEPARATE_ZVAL(pvalue);
- convert_to_string(*pvalue);
- return (*pvalue)->value.str.val;
- }
- return 0;
-}
-
-static long *array_lookup_long(HashTable *ht, const char *idx)
-{
- pval **pvalue;
-
- if (ht && zend_hash_find(ht, (char*) idx, strlen(idx)+1,
- (void**) &pvalue) == SUCCESS)
- {
- SEPARATE_ZVAL(pvalue);
- convert_to_long(*pvalue);
- return &(*pvalue)->value.lval;
- }
- return 0;
-}
-
-static long *array_lookup_bool(HashTable *ht, const char *idx)
-{
- pval **pvalue;
-
- if (ht && zend_hash_find(ht, (char*) idx, strlen(idx)+1,
- (void**) &pvalue) == SUCCESS)
- {
- SEPARATE_ZVAL(pvalue);
- convert_to_boolean(*pvalue);
- return &(*pvalue)->value.lval;
- }
- return 0;
-}
-
-static int send_present (Yaz_Association t);
-
-static void handle_records (Yaz_Association t, Z_Records *sr,
- int present_phase)
-{
- if (sr && sr->which == Z_Records_NSD)
- {
-#ifdef ASN_COMPILED
- Z_DiagRec dr, *dr_p = &dr;
- dr.which = Z_DiagRec_defaultFormat;
- dr.u.defaultFormat = sr->u.nonSurrogateDiagnostic;
-
- response_diag (t, dr_p);
-#else
- response_diag (t, sr->u.nonSurrogateDiagnostic);
-#endif
- }
- else if (sr && sr->which == Z_Records_multipleNSD)
- {
- if (sr->u.multipleNonSurDiagnostics->num_diagRecs >= 1)
- response_diag(t, sr->u.multipleNonSurDiagnostics->diagRecs[0]);
- else
- t->error = PHP_YAZ_ERROR_DECODE;
- }
- else
- {
- if (t->numberOfRecordsRequested > 0 && !t->resultSets->recordList)
- {
- int i;
-
- t->resultSets->recordList =
- odr_malloc (t->resultSets->odr,
- sizeof(*t->resultSets->recordList));
- t->resultSets->recordList->records =
- odr_malloc (t->resultSets->odr, t->numberOfRecordsRequested
- * sizeof(*t->resultSets->recordList->records));
- for (i = 0; i < t->numberOfRecordsRequested; i++)
- t->resultSets->recordList->records[i] = 0;
- if (t->numberOfRecordsRequested + t->resultSetStartPoint-1 >
- t->resultSets->resultCount)
- t->resultSets->recordList->num_records =
- t->resultSets->resultCount - t->resultSetStartPoint + 1;
- else
- t->resultSets->recordList->num_records =
- t->numberOfRecordsRequested;
- }
- if (sr && sr->which == Z_Records_DBOSD)
- {
- int j, i;
- NMEM nmem = odr_extract_mem (t->odr_in);
- Z_NamePlusRecordList *p =
- sr->u.databaseOrSurDiagnostics;
- if (t->resultSets->recordList)
- {
- for (j = 0; j < t->resultSets->recordList->num_records; j++)
- if (!t->resultSets->recordList->records[j])
- break;
- for (i = 0; i<p->num_records; i++)
- t->resultSets->recordList->records[i+j] = p->records[i];
- /* transfer our response to search_nmem .. we need it later */
- nmem_transfer (t->resultSets->odr->mem, nmem);
- nmem_destroy (nmem);
- }
- if (present_phase && p->num_records == 0)
- {
- /* present response and we didn't get any records! */
- t->error = PHP_YAZ_ERROR_DECODE;
- t->resultSets->recordList = 0;
- }
- }
- else if (present_phase)
- {
- /* present response and we didn't get any records! */
- t->error = PHP_YAZ_ERROR_DECODE;
- t->resultSets->recordList = 0;
- }
- }
-}
-
-static void search_response (Yaz_Association t, Z_SearchResponse *sr)
-{
- t->resultSets->resultCount = *sr->resultCount;
- handle_records (t, sr->records, 0);
-}
-
-static void present_response (Yaz_Association t, Z_PresentResponse *pr)
-{
- handle_records (t, pr->records, 1);
-}
-
-void scan_response (Yaz_Association t, Z_ScanResponse *res)
-{
- NMEM nmem = odr_extract_mem (t->odr_in);
- if (res->entries && res->entries->nonsurrogateDiagnostics)
- response_diag(t, res->entries->nonsurrogateDiagnostics[0]);
- t->scan_response = res;
- nmem_transfer (t->odr_scan->mem, nmem);
- nmem_destroy (nmem);
-}
-
-void es_response (Yaz_Association t,
- Z_ExtendedServicesResponse *res)
-{
-#if 0
- Odr_oct *id = res->referenceId;
-
- if (id)
- html_var_n (req, "refid", id->buf, id->len);
- else
- html_var (req, "refid", "");
-
- html_var (req, "targetreference", "");
- if (res->taskPackage &&
- res->taskPackage->which == Z_External_extendedService)
- {
- Z_TaskPackage *taskPackage = res->taskPackage->u.extendedService;
- Odr_oct *id = taskPackage->targetReference;
-
- if (id)
- html_var_n (req, "targetreference", id->buf, id->len);
- }
- switch (*res->operationStatus)
- {
- case Z_ExtendedServicesResponse_done:
- html_dump (req, "es-response done");
- break;
- case Z_ExtendedServicesResponse_accepted:
- html_dump (req, "es-response accepted");
- break;
- case Z_ExtendedServicesResponse_failure:
- html_dump (req, "es-response failure");
- break;
- default:
- html_dump (req, "es-response unknown");
- break;
- }
-#endif
- if (res->diagnostics && res->num_diagnostics > 0)
- response_diag(t, res->diagnostics[0]);
-}
-
-
-static void handle_apdu (Yaz_Association t, Z_APDU *apdu)
-{
- Z_InitResponse *initrs;
-
- t->mask_select = 0;
-
- switch(apdu->which)
- {
- case Z_APDU_initResponse:
- initrs = apdu->u.initResponse;
- if (!*initrs->result)
- {
- t->error = PHP_YAZ_ERROR_INIT;
- }
- else
- {
- char *cookie =
- yaz_oi_get_string_oidval (&apdu->u.initResponse->otherInfo,
- VAL_COOKIE, 1, 0);
- if (cookie)
- {
- xfree(t->cookie_in);
- t->cookie_in = xstrdup(cookie);
- }
- if (t->action)
- (*t->action) (t);
- t->action = 0;
- }
- break;
- case Z_APDU_searchResponse:
- search_response (t, apdu->u.searchResponse);
- send_present (t);
- break;
- case Z_APDU_presentResponse:
- present_response (t, apdu->u.presentResponse);
- send_present (t);
- break;
- case Z_APDU_scanResponse:
- scan_response (t, apdu->u.scanResponse);
- break;
- case Z_APDU_extendedServicesResponse:
- es_response (t, apdu->u.extendedServicesResponse);
- break;
- case Z_APDU_close:
- do_close(t);
- if (t->reconnect_flag)
- do_connect (t);
- else
- t->error = PHP_YAZ_ERROR_CONNECTION_LOST;
- break;
- default:
- do_close (t);
- t->error = PHP_YAZ_ERROR_DECODE;
- break;
- }
-}
-
-static int do_read (Yaz_Association t)
-{
- int r;
- Z_APDU *apdu;
-
- r = cs_get (t->cs, &t->buf_in, &t->len_in);
- if (r == 1)
- return 0;
- if (r <= 0)
- {
- do_close (t);
- if (t->reconnect_flag)
- {
- do_connect (t);
- }
- else
- {
- do_close (t);
- t->error = PHP_YAZ_ERROR_CONNECTION_LOST;
- }
- }
- else
- {
- odr_reset (t->odr_in);
- odr_setbuf (t->odr_in, t->buf_in, r, 0);
- if (!z_APDU (t->odr_in, &apdu, 0, 0))
- {
- do_close (t);
- t->error = PHP_YAZ_ERROR_DECODE;
- }
- else
- {
- /* apdu_log(req, t->odr_print, apdu); */
- handle_apdu (t, apdu);
- }
- }
- return 1;
-}
-
-static int do_write_ex (Yaz_Association t, char *buf_out, int len_out)
-{
- int r;
-
- if ((r=cs_put (t->cs, buf_out, len_out)) < 0)
- {
- if (t->reconnect_flag)
- {
- do_close (t);
- do_connect (t);
- }
- else
- {
- if (t->state == PHP_YAZ_STATE_CONNECTING)
- t->error = PHP_YAZ_ERROR_CONNECT;
- else
- t->error = PHP_YAZ_ERROR_CONNECTION_LOST;
- do_close (t);
- return 1;
- }
- }
- else if (r == 1)
- {
- t->state = PHP_YAZ_STATE_ESTABLISHED;
- t->mask_select = PHP_YAZ_SELECT_READ|PHP_YAZ_SELECT_WRITE;
- }
- else
- {
- t->state = PHP_YAZ_STATE_ESTABLISHED;
- t->mask_select = PHP_YAZ_SELECT_READ;
- }
- return 0;
-}
-
-static int do_write(Yaz_Association t)
-{
- return do_write_ex (t, t->buf_out, t->len_out);
-}
-
-static int send_packet (Yaz_Association t)
-{
- return do_write_ex (t, t->ill_buf_out, t->ill_len_out);
-}
-
-static int encode_APDU(Yaz_Association t, Z_APDU *a, ODR out)
-{
- char str[120];
-
- if (a == 0)
- abort();
- sprintf (str, "send_APDU t=%p type=%d", t, a->which);
-#if 0
- php_error (E_WARNING, str);
-#endif
- if (t->cookie_out)
- {
- Z_OtherInformation **oi;
- yaz_oi_APDU(a, &oi);
- yaz_oi_set_string_oidval(oi, out, VAL_COOKIE, 1, t->cookie_out);
- }
-/* from ZAP */
-#if 0
- if (req->request->connection)
- {
- Z_OtherInformation **oi;
- yaz_oi_APDU(a, &oi);
- yaz_oi_set_string_oidval(oi, out, VAL_CLIENT_IP, 1,
- req->request->connection->remote_ip);
- }
-#endif
- if (!z_APDU(out, &a, 0, 0))
- {
- FILE *outf = fopen("/tmp/apdu.txt", "w");
- if (outf)
- {
- ODR odr_pr = odr_createmem(ODR_PRINT);
- fprintf (outf, "a=%p\n", a);
- odr_setprint(odr_pr, outf);
- z_APDU(odr_pr, &a, 0, 0);
- odr_destroy(odr_pr);
- fclose (outf);
- }
- php_error (E_WARNING, "YAZ: Couldn't encode APDU");
- do_close (t);
- t->error = PHP_YAZ_ERROR_ENCODE;
- return -1;
- }
- return 0;
-}
-
-static int send_APDU (Yaz_Association t, Z_APDU *a)
-{
- encode_APDU(t, a, t->odr_out);
- t->buf_out = odr_getbuf(t->odr_out, &t->len_out, 0);
- odr_reset(t->odr_out);
- do_write (t);
- return 0;
-}
-
-/* set database names. Take local databases (if set); otherwise
- take databases given in ZURL (if set); otherwise use Default */
-static char **set_DatabaseNames (Yaz_Association t, int *num)
-{
- char **databaseNames;
- char *c;
- int no = 2;
- char *cp = t->local_databases;
-
- if (!cp || !*cp)
- {
- cp = strchr (t->host_port, '/');
- if (cp)
- cp++;
- }
- if (cp)
- {
- c = cp;
- while ((c = strchr(c, '+')))
- {
- c++;
- no++;
- }
- }
- else
- cp = "Default";
- databaseNames = odr_malloc (t->odr_out, no * sizeof(*databaseNames));
- no = 0;
- while (*cp)
- {
- c = strchr (cp, '+');
- if (!c)
- c = cp + strlen(cp);
- else if (c == cp)
- {
- cp++;
- continue;
- }
- /* cp ptr to first char of db name, c is char following db name */
- databaseNames[no] = odr_malloc (t->odr_out, 1+c-cp);
- memcpy (databaseNames[no], cp, c-cp);
- databaseNames[no++][c-cp] = '\0';
- cp = c;
- if (*cp)
- cp++;
- }
- databaseNames[no] = NULL;
- *num = no;
- return databaseNames;
-}
-
-static int send_search (Yaz_Association t)
-{
- Yaz_ResultSet r = t->resultSets;
- Z_APDU *apdu = zget_APDU(t->odr_out, Z_APDU_searchRequest);
- Z_SearchRequest *sreq = apdu->u.searchRequest;
-
- /* resultSetPrepare (req, t, req->cur_pa); */
- if (t->resultSetStartPoint == 1)
- {
- sreq->largeSetLowerBound = odr_malloc (t->odr_out, sizeof(int));
- *sreq->largeSetLowerBound = 999999;
- sreq->smallSetUpperBound = &t->numberOfRecordsRequested;
- sreq->mediumSetPresentNumber = &t->numberOfRecordsRequested;
- if (t->elementSetNames && *t->elementSetNames)
- {
- Z_ElementSetNames *esn = odr_malloc (t->odr_out, sizeof(*esn));
-
- esn->which = Z_ElementSetNames_generic;
- esn->u.generic = t->elementSetNames;
- sreq->mediumSetElementSetNames = esn;
- sreq->smallSetElementSetNames = esn;
- }
- }
- else
- {
- sreq->smallSetUpperBound = odr_malloc (t->odr_out, sizeof(int));
- *sreq->smallSetUpperBound = 0;
- sreq->largeSetLowerBound = odr_malloc (t->odr_out, sizeof(int));
- *sreq->largeSetLowerBound = 1;
- sreq->mediumSetPresentNumber = odr_malloc (t->odr_out, sizeof(int));
- *sreq->mediumSetPresentNumber = 0;
- }
- sreq->query = r->query;
- if (t->preferredRecordSyntax && *t->preferredRecordSyntax)
- {
- struct oident ident;
-
- ident.proto = PROTO_Z3950;
- ident.oclass = CLASS_RECSYN;
- ident.value = oid_getvalbyname (t->preferredRecordSyntax);
- sreq->preferredRecordSyntax =
- odr_oiddup (t->odr_out, oid_getoidbyent (&ident));
- }
- sreq->databaseNames = set_DatabaseNames (t, &sreq->num_databaseNames);
-
- send_APDU (t, apdu);
- return 1;
-}
-
-static int send_present (Yaz_Association t)
-{
- Z_APDU *apdu = zget_APDU(t->odr_out, Z_APDU_presentRequest);
- Z_PresentRequest *req = apdu->u.presentRequest;
- int i = 0;
-
- if (t->error) /* don't continue on error */
- return 0;
- if (!t->resultSets) /* no result set yet? */
- return 0;
- while (t->resultSets->recordList)
- {
- if (i >= t->resultSets->recordList->num_records)
- { /* got all records ... */
- return 0;
- }
- if (!t->resultSets->recordList->records[i])
- break;
- i++;
- }
- /* got record(s) to retrieve */
-
- req->resultSetStartPoint = odr_malloc (t->odr_out, sizeof(int));
- *req->resultSetStartPoint = t->resultSetStartPoint + i;
-
- req->numberOfRecordsRequested = odr_malloc (t->odr_out, sizeof(int));
- if (t->resultSets->recordList)
- *req->numberOfRecordsRequested =
- t->resultSets->recordList->num_records - i;
- else
- *req->numberOfRecordsRequested = t->numberOfRecordsRequested;
-
- if (*req->numberOfRecordsRequested <= 0)
- return 0;
-
- if (t->preferredRecordSyntax && *t->preferredRecordSyntax)
- {
- struct oident ident;
-
- ident.proto = PROTO_Z3950;
- ident.oclass = CLASS_RECSYN;
- ident.value = oid_getvalbyname (t->preferredRecordSyntax);
- req->preferredRecordSyntax =
- odr_oiddup (t->odr_out, oid_getoidbyent (&ident));
- }
-
- if (t->elementSetNames && *t->elementSetNames)
- {
- Z_ElementSetNames *esn = odr_malloc (t->odr_out, sizeof(*esn));
- Z_RecordComposition *compo = odr_malloc (t->odr_out, sizeof(*compo));
-
- esn->which = Z_ElementSetNames_generic;
- esn->u.generic = t->elementSetNames;
- compo->which = Z_RecordComp_simple;
- compo->u.simple = esn;
- req->recordComposition = compo;
- }
- send_APDU (t, apdu);
- return 1;
-}
-
-static void send_init(Yaz_Association t)
-{
- char *cp;
- Z_APDU *apdu = zget_APDU(t->odr_out, Z_APDU_initRequest);
- Z_InitRequest *ireq = apdu->u.initRequest;
- Z_IdAuthentication *auth = odr_malloc(t->odr_out, sizeof(*auth));
- const char *auth_groupId = t->group;
- const char *auth_userId = t->user;
- const char *auth_password = t->pass;
-
- ODR_MASK_SET(ireq->options, Z_Options_search);
- ODR_MASK_SET(ireq->options, Z_Options_present);
- ODR_MASK_SET(ireq->options, Z_Options_namedResultSets);
- ODR_MASK_SET(ireq->options, Z_Options_scan);
- ODR_MASK_SET(ireq->options, Z_Options_extendedServices);
-
- ODR_MASK_SET(ireq->protocolVersion, Z_ProtocolVersion_1);
- ODR_MASK_SET(ireq->protocolVersion, Z_ProtocolVersion_2);
- ODR_MASK_SET(ireq->protocolVersion, Z_ProtocolVersion_3);
-
- ireq->implementationName = "PHP/YAZ";
-
- *ireq->maximumRecordSize = 1024*1024;
- *ireq->preferredMessageSize = 1024*1024;
-
- if (auth_groupId || auth_password)
- {
-
- Z_IdPass *pass = odr_malloc(t->odr_out, sizeof(*pass));
- int i = 0;
- pass->groupId = 0;
- if (auth_groupId && *auth_groupId)
- {
- pass->groupId = odr_malloc(t->odr_out, strlen(auth_groupId)+1);
- strcpy(pass->groupId, auth_groupId);
- i++;
- }
- pass->userId = 0;
- if (auth_userId && *auth_userId)
- {
- pass->userId = odr_malloc(t->odr_out, strlen(auth_userId)+1);
- strcpy(pass->userId, auth_userId);
- i++;
- }
- pass->password = 0;
- if (auth_password && *auth_password)
- {
- pass->password = odr_malloc(t->odr_out, strlen(auth_password)+1);
- strcpy(pass->password, auth_password);
- i++;
- }
- if (i)
- {
- auth->which = Z_IdAuthentication_idPass;
- auth->u.idPass = pass;
- ireq->idAuthentication = auth;
- }
- }
- else if (auth_userId)
- {
- auth->which = Z_IdAuthentication_open;
- auth->u.open = odr_malloc(t->odr_out, strlen(auth_userId)+1);
- strcpy(auth->u.open, auth_userId);
- ireq->idAuthentication = auth;
- }
- yaz_oi_set_string_oidval(&ireq->otherInfo, t->odr_out,
- VAL_PROXY, 1, t->host_port);
- send_APDU (t, apdu);
-}
-
-static int do_event (int *id, int timeout)
-{
- fd_set input, output;
- int i;
- int no = 0;
- int max_fd = 0;
- struct timeval tv;
-
- tv.tv_sec = timeout;
- tv.tv_usec = 0;
-
-#ifdef ZTS
- tsrm_mutex_lock (yaz_mutex);
-#endif
- FD_ZERO (&input);
- FD_ZERO (&output);
- for (i = 0; i < MAX_ASSOC; i++)
- {
- Yaz_Association p = shared_associations[i];
- int fd;
- if (!p || p->order != order_associations || !p->cs)
- continue;
- fd = cs_fileno (p->cs);
- if (max_fd < fd)
- max_fd = fd;
- if (p->mask_select & PHP_YAZ_SELECT_READ)
- {
- FD_SET (fd, &input);
- no++;
- }
- if (p->mask_select & PHP_YAZ_SELECT_WRITE)
- {
- FD_SET (fd, &output);
- no++;
- }
- }
-#ifdef ZTS
- tsrm_mutex_unlock (yaz_mutex);
-#endif
- if (!no)
- return 0;
- no = select (max_fd+1, &input, &output, 0, &tv);
-#ifdef ZTS
- tsrm_mutex_lock (yaz_mutex);
-#endif
- for (i = 0; i<MAX_ASSOC; i++)
- {
- int fd;
- Yaz_Association p = shared_associations[i];
- if (!p || p->order != order_associations || !p->cs)
- continue;
- *id = i+1;
- fd =cs_fileno(p->cs);
- if (no <= 0)
- {
- if (p->mask_select) /* only mark for those still pending */
- {
- p->error = PHP_YAZ_ERROR_TIMEOUT;
- do_close (p);
- }
- }
- else if (p->state == PHP_YAZ_STATE_CONNECTING)
- {
- if (FD_ISSET (fd, &output))
- {
- send_init(p);
- }
- else if (FD_ISSET (fd, &input))
- {
- do_close(p);
- p->error = PHP_YAZ_ERROR_CONNECT;
- }
- }
- else if (p->state == PHP_YAZ_STATE_ESTABLISHED)
- {
- if (FD_ISSET (fd, &input))
- do_read (p);
- if (p->cs && FD_ISSET (fd, &output))
- do_write (p);
- }
- else
- {
- do_close (p);
- p->error = PHP_YAZ_ERROR_CONNECTION_LOST;
- }
- }
-#ifdef ZTS
- tsrm_mutex_unlock (yaz_mutex);
-#endif
- return no;
-}
-
-static int strcmp_null(const char *s1, const char *s2)
-{
- if (s1 == 0 && s2 == 0)
- return 0;
- if (s1 == 0 || s2 == 0)
- return -1;
- return strcmp(s1, s2);
-}
-
-/* {{{ proto int yaz_connect(string zurl [ array options])
- Create target with given zurl. Returns positive id if successful. */
-PHP_FUNCTION(yaz_connect)
-{
- int i;
- char *cp;
- char *zurl_str;
- const char *user_str = 0, *group_str = 0, *pass_str = 0;
- const char *cookie_str = 0, *proxy_str = 0;
- int persistent = 1;
- pval **zurl, **user = 0, **group = 0, **pass = 0;
- if (ZEND_NUM_ARGS() == 1)
- {
- if (zend_get_parameters_ex (1, &zurl) == FAILURE)
- WRONG_PARAM_COUNT;
- }
- else if (ZEND_NUM_ARGS() == 2)
- {
- if (zend_get_parameters_ex (2, &zurl, &user) == FAILURE)
- WRONG_PARAM_COUNT;
-
- if (Z_TYPE_PP(user) == IS_ARRAY)
- {
- long *persistent_val;
- HashTable *ht = Z_ARRVAL_PP(user);
- user_str = array_lookup_string(ht, "user");
- group_str = array_lookup_string(ht, "group");
- pass_str = array_lookup_string(ht, "password");
- cookie_str = array_lookup_string(ht, "cookie");
- proxy_str = array_lookup_string(ht, "proxy");
- persistent_val = array_lookup_bool(ht, "persistent");
- if (persistent_val)
- persistent = *persistent_val;
- }
- else
- {
- convert_to_string_ex (user);
- user_str = (*user)->value.str.val;
- }
- }
- else
- {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex (zurl);
- zurl_str = (*zurl)->value.str.val;
- for (cp = zurl_str; *cp && strchr("\t\n ", *cp); cp++)
- ;
- if (!*cp)
- RETURN_LONG(0);
-
- /* see if we have it already ... */
-#ifdef ZTS
- tsrm_mutex_lock (yaz_mutex);
-#endif
- for (i = 0; i<MAX_ASSOC; i++)
- {
- Yaz_Association as = shared_associations[i];
- if (persistent && as && as->order != order_associations &&
- !strcmp_null (as->host_port, zurl_str) &&
- !strcmp_null (as->user, user_str) &&
- !strcmp_null (as->group, group_str) &&
- !strcmp_null (as->pass, pass_str) &&
- !strcmp_null (as->proxy, proxy_str) &&
- !strcmp_null (as->cookie_out, cookie_str))
- break;
- }
- if (i == MAX_ASSOC)
- {
- /* we didn't have it (or already in use) */
- int i0 = -1;
- int min_order = 2000000000;
- /* find completely free slot or the oldest one */
- for (i = 0; i<MAX_ASSOC && shared_associations[i]; i++)
- if (shared_associations[i]->order < min_order
- && shared_associations[i]->order != order_associations)
- {
- min_order = shared_associations[i]->order;
- i0 = i;
- }
- if (i == MAX_ASSOC)
- {
- i = i0;
- if (i == -1)
- {
-#ifdef ZTS
- tsrm_mutex_unlock (yaz_mutex);
-#endif
- RETURN_LONG(0); /* no free slot */
- }
- else /* "best" free slot */
- yaz_association_destroy(shared_associations[i]);
- }
- shared_associations[i] = yaz_association_mk ();
- shared_associations[i]->host_port = xstrdup (zurl_str);
- if (cookie_str)
- shared_associations[i]->cookie_out = xstrdup (cookie_str);
- if (user_str)
- shared_associations[i]->user = xstrdup (user_str);
- if (group_str)
- shared_associations[i]->group = xstrdup (group_str);
- if (pass_str)
- shared_associations[i]->pass = xstrdup (pass_str);
- if (proxy_str)
- shared_associations[i]->proxy = xstrdup (proxy_str);
- }
- shared_associations[i]->persistent = persistent;
- shared_associations[i]->order = order_associations;
- shared_associations[i]->error = 0;
- shared_associations[i]->numberOfRecordsRequested = 10;
- shared_associations[i]->resultSetStartPoint = 1;
- xfree (shared_associations[i]->local_databases);
- shared_associations[i]->local_databases = 0;
-#ifdef ZTS
- tsrm_mutex_unlock (yaz_mutex);
-#endif
- RETURN_LONG(i+1);
-}
-/* }}} */
-
-/* {{{ proto int yaz_close(int id)
- Destory and close target */
-PHP_FUNCTION(yaz_close)
-{
- Yaz_Association p;
- pval **id;
- int i;
- if (ZEND_NUM_ARGS() != 1)
- WRONG_PARAM_COUNT;
- if (zend_get_parameters_ex (1, &id) == FAILURE)
- RETURN_FALSE;
- p = get_assoc (id);
- if (!p)
- RETURN_FALSE;
- convert_to_long_ex (id);
- i = (*id)->value.lval - 1;
- yaz_association_destroy (shared_associations[i]);
- shared_associations[i] = 0;
- release_assoc (p);
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int yaz_search(int id, string type, string query)
- Specify query of type for search - returns true if successful */
-PHP_FUNCTION(yaz_search)
-{
- char *query_str, *type_str;
- pval **id, **type, **query;
- Yaz_Association p;
- Yaz_ResultSet r;
- if (ZEND_NUM_ARGS() == 3)
- {
- if (zend_get_parameters_ex(3, &id, &type, &query) == FAILURE)
- {
- WRONG_PARAM_COUNT;
- }
- }
- else
- {
- WRONG_PARAM_COUNT;
- }
- p = get_assoc (id);
- if (!p)
- {
- RETURN_FALSE;
- }
- p->action = 0;
- convert_to_string_ex (type);
- type_str = (*type)->value.str.val;
- convert_to_string_ex (query);
- query_str = (*query)->value.str.val;
- yaz_resultset_destroy (p->resultSets);
- r = p->resultSets = yaz_resultset_mk();
- r->query = odr_malloc (r->odr, sizeof(*r->query));
- if (!strcmp (type_str, "rpn"))
- {
- r->query->which = Z_Query_type_1;
- r->query->u.type_1 = p_query_rpn (r->odr, PROTO_Z3950, query_str);
- if (!r->query->u.type_1)
- {
- yaz_resultset_destroy(r);
- p->resultSets = 0;
- RETVAL_FALSE;
- }
- else
- {
- RETVAL_TRUE;
- }
- }
- else if (!strcmp(type_str, "ccl"))
- {
- r->query->which = Z_Query_type_2;
- r->query->u.type_2 = odr_malloc (r->odr, sizeof(*r->query->u.type_2));
- r->query->u.type_2->buf = odr_strdup(r->odr, query_str);
- r->query->u.type_2->len = strlen(query_str);
- }
- else
- {
- yaz_resultset_destroy(r);
- p->resultSets = 0;
- RETVAL_FALSE;
- }
- if (p->resultSets)
- p->action = send_search;
- release_assoc (p);
-}
-/* }}} */
-
-/* {{{ proto int yaz_present(int id)
- Retrieve records */
-PHP_FUNCTION(yaz_present)
-{
- pval **id;
- Yaz_Association p;
- if (ZEND_NUM_ARGS() != 1)
- WRONG_PARAM_COUNT;
- if (zend_get_parameters_ex(1, &id) == FAILURE)
- {
- WRONG_PARAM_COUNT;
- }
- p = get_assoc (id);
- if (!p)
- {
- RETURN_FALSE;
- }
- p->action = 0;
- if (p->resultSets)
- {
- p->resultSets->recordList = 0;
- p->action = send_present;
- }
- release_assoc (p);
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int yaz_wait([array options])
- Process events. */
-PHP_FUNCTION(yaz_wait)
-{
- int i;
- int id;
- int timeout = 15;
- if (ZEND_NUM_ARGS() == 1)
- {
- long *val = 0;
- pval **pval_options = 0;
- HashTable *options_ht = 0;
- if (zend_get_parameters_ex(1, &pval_options) == FAILURE)
- {
- WRONG_PARAM_COUNT;
- }
- if (Z_TYPE_PP(pval_options) != IS_ARRAY)
- {
- php_error(E_WARNING, "yaz_wait: Expected array parameter");
- RETURN_FALSE;
- }
- options_ht = Z_ARRVAL_PP(pval_options);
- val = array_lookup_long(options_ht, "timeout");
- if (val)
- timeout = *val;
- }
-#ifdef ZTS
- tsrm_mutex_lock (yaz_mutex);
-#endif
- for (i = 0; i<MAX_ASSOC; i++)
- {
- Yaz_Association p = shared_associations[i];
- if (!p || p->order != order_associations || !p->action
- || p->mask_select)
- continue;
- if (!p->cs)
- {
- do_connect (p);
- }
- else
- {
- p->reconnect_flag = 1;
- (*p->action)(p);
- }
- }
-#ifdef ZTS
- tsrm_mutex_unlock (yaz_mutex);
-#endif
- while (do_event(&id, timeout))
- ;
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int yaz_errno(int id)
- Return last error number (>0 for bib-1 diagnostic, <0 for other error, 0 for no error */
-PHP_FUNCTION(yaz_errno)
-{
- pval **id;
- Yaz_Association p;
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &id) == FAILURE)
- {
- WRONG_PARAM_COUNT;
- }
- p = get_assoc (id);
- if (!p)
- {
- RETURN_LONG(0);
- }
- RETVAL_LONG(p->error);
- release_assoc (p);
-}
-/* }}} */
-
-/* {{{ proto string yaz_error(int id)
- Return last error message */
-PHP_FUNCTION(yaz_error)
-{
- pval **id;
- Yaz_Association p;
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &id) == FAILURE)
- {
- WRONG_PARAM_COUNT;
- }
- p = get_assoc (id);
- if (p && p->error)
- {
- const char *msg = 0;
- if (p->error < 0)
- {
- switch (p->error)
- {
- case PHP_YAZ_ERROR_CONNECTION_LOST:
- msg = "connection lost";
- break;
- case PHP_YAZ_ERROR_DECODE:
- msg = "decoding failure";
- break;
- case PHP_YAZ_ERROR_ENCODE:
- msg = "encoding failure";
- break;
- case PHP_YAZ_ERROR_CONNECT:
- msg = "connect failed";
- break;
- case PHP_YAZ_ERROR_INIT:
- msg = "initialization failed";
- break;
- case PHP_YAZ_ERROR_TIMEOUT:
- msg = "timeout failure";
- break;
- default:
- msg = "unknown failure";
- break;
- }
- }
- else
- {
- msg = diagbib1_str (p->error);
- if (!msg)
- msg = "unknown diagnostic";
- }
- /* Not macro using because RETURN_STRING throws away const */
- return_value->value.str.len = strlen(msg);
- return_value->value.str.val =
- estrndup(msg, return_value->value.str.len);
- return_value->type = IS_STRING;
- }
- release_assoc (p);
-}
-/* }}} */
-
-/* {{{ proto string yaz_addinfo(int id)
- Return additional info for last error (empty string if none) */
-PHP_FUNCTION(yaz_addinfo)
-{
- pval **id;
- Yaz_Association p;
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &id) == FAILURE)
- {
- WRONG_PARAM_COUNT;
- }
- p = get_assoc (id);
- if (p && p->error > 0 && p->addinfo && *p->addinfo)
- {
- RETVAL_STRING(p->addinfo, 1);
- }
- release_assoc (p);
-}
-/* }}} */
-
-/* {{{ proto int yaz_hits(int id)
- Return number of hits (result count) for last search */
-PHP_FUNCTION(yaz_hits)
-{
- pval **id;
- Yaz_Association p;
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &id) == FAILURE)
- {
- WRONG_PARAM_COUNT;
- }
- p = get_assoc (id);
- if (!p || !p->resultSets)
- {
- RETVAL_LONG(0);
- }
- else
- {
- RETVAL_LONG(p->resultSets->resultCount);
- }
- release_assoc (p);
-}
-/* }}} */
-
-static Z_GenericRecord *marc_to_grs1(const char *buf, ODR o, Odr_oid *oid)
-{
- int entry_p;
- int record_length;
- int indicator_length;
- int identifier_length;
- int base_address;
- int length_data_entry;
- int length_starting;
- int length_implementation;
- int max_elements = 256;
- Z_GenericRecord *r = odr_malloc (o, sizeof(*r));
- r->elements = odr_malloc (o, sizeof(*r->elements) * max_elements);
- r->num_elements = 0;
-
- record_length = atoi_n (buf, 5);
- if (record_length < 25)
- return 0;
- indicator_length = atoi_n (buf+10, 1);
- identifier_length = atoi_n (buf+11, 1);
- base_address = atoi_n (buf+12, 4);
-
- length_data_entry = atoi_n (buf+20, 1);
- length_starting = atoi_n (buf+21, 1);
- length_implementation = atoi_n (buf+22, 1);
-
- for (entry_p = 24; buf[entry_p] != ISO2709_FS; )
- {
- entry_p += 3+length_data_entry+length_starting;
- if (entry_p >= record_length)
- return 0;
- }
- base_address = entry_p+1;
- for (entry_p = 24; buf[entry_p] != ISO2709_FS; )
- {
- Z_TaggedElement *tag;
- int data_length;
- int data_offset;
- int end_offset;
- int i;
- char tag_str[4];
-
- memcpy (tag_str, buf+entry_p, 3);
- entry_p += 3;
- tag_str[3] = '\0';
-
- if ((r->num_elements + 1) >= max_elements)
- {
- Z_TaggedElement **tmp = r->elements;
-
- /* double array space, throw away old buffer (nibble memory) */
- r->elements = odr_malloc(o, sizeof(*r->elements) *
- (max_elements *= 2));
- memcpy(r->elements, tmp, r->num_elements * sizeof(*tmp));
- }
- tag = r->elements[r->num_elements++] = odr_malloc (o, sizeof(*tag));
- tag->tagType = odr_malloc(o, sizeof(*tag->tagType));
- *tag->tagType = 3;
- tag->tagOccurrence = 0;
- tag->metaData = 0;
- tag->appliedVariant = 0;
- tag->tagValue = odr_malloc (o, sizeof(*tag->tagValue));
- tag->tagValue->which = Z_StringOrNumeric_string;
- tag->tagValue->u.string = odr_strdup(o, tag_str);
-
- tag->content = odr_malloc(o, sizeof(*tag->content));
- tag->content->which = Z_ElementData_subtree;
-
- tag->content->u.subtree =
- odr_malloc (o, sizeof(*tag->content->u.subtree));
- tag->content->u.subtree->elements = odr_malloc (o, sizeof(*r->elements));
- tag->content->u.subtree->num_elements = 1;
-
- tag = tag->content->u.subtree->elements[0] =
- odr_malloc (o, sizeof(**tag->content->u.subtree->elements));
-
- tag->tagType = odr_malloc(o, sizeof(*tag->tagType));
- *tag->tagType = 3;
- tag->tagOccurrence = 0;
- tag->metaData = 0;
- tag->appliedVariant = 0;
- tag->tagValue = odr_malloc (o, sizeof(*tag->tagValue));
- tag->tagValue->which = Z_StringOrNumeric_string;
- tag->content = odr_malloc(o, sizeof(*tag->content));
-
- data_length = atoi_n (buf+entry_p, length_data_entry);
- entry_p += length_data_entry;
- data_offset = atoi_n (buf+entry_p, length_starting);
- entry_p += length_starting;
- i = data_offset + base_address;
- end_offset = i+data_length-1;
-
- if (memcmp (tag_str, "00", 2) && indicator_length)
- {
- /* indicator */
- tag->tagValue->u.string = odr_malloc(o, indicator_length+1);
- memcpy (tag->tagValue->u.string, buf + i, indicator_length);
- tag->tagValue->u.string[indicator_length] = '\0';
- i += indicator_length;
-
- tag->content->which = Z_ElementData_subtree;
-
- tag->content->u.subtree =
- odr_malloc (o, sizeof(*tag->content->u.subtree));
- tag->content->u.subtree->elements =
- odr_malloc (o, 256 * sizeof(*r->elements));
- tag->content->u.subtree->num_elements = 0;
-
- while (buf[i] != ISO2709_RS && buf[i] != ISO2709_FS
- && i < end_offset)
- {
- int i0;
- /* prepare tag */
- Z_TaggedElement *parent_tag = tag;
- Z_TaggedElement *tag = odr_malloc (o, sizeof(*tag));
-
- if (parent_tag->content->u.subtree->num_elements < 256)
- parent_tag->content->u.subtree->elements[
- parent_tag->content->u.subtree->num_elements++] = tag;
-
- tag->tagType = odr_malloc(o, sizeof(*tag->tagType));
- *tag->tagType = 3;
- tag->tagOccurrence = 0;
- tag->metaData = 0;
- tag->appliedVariant = 0;
- tag->tagValue = odr_malloc (o, sizeof(*tag->tagValue));
- tag->tagValue->which = Z_StringOrNumeric_string;
-
- /* sub field */
- tag->tagValue->u.string = odr_malloc (o, identifier_length);
- memcpy (tag->tagValue->u.string, buf+i+1, identifier_length-1);
- tag->tagValue->u.string[identifier_length-1] = '\0';
- i += identifier_length;
-
- /* data ... */
- tag->content = odr_malloc(o, sizeof(*tag->content));
- tag->content->which = Z_ElementData_string;
-
- i0 = i;
- while (buf[i] != ISO2709_RS && buf[i] != ISO2709_IDFS &&
- buf[i] != ISO2709_FS && i < end_offset)
- i++;
-
- tag->content->u.string = odr_malloc (o, i - i0 + 1);
- memcpy (tag->content->u.string, buf + i0, i - i0);
- tag->content->u.string[i - i0] = '\0';
- }
- }
- else
- {
- int i0 = i;
-
- tag->tagValue->u.string = "@";
- tag->content->which = Z_ElementData_string;
-
- while (buf[i] != ISO2709_RS && buf[i] != ISO2709_FS &&
- i < end_offset)
- i++;
- tag->content->u.string = odr_malloc (o, i - i0 +1);
- memcpy (tag->content->u.string, buf+i0, i - i0);
- tag->content->u.string[i-i0] = '\0';
- }
- }
- return r;
-}
-
-static void retval_grs1 (zval *return_value, Z_GenericRecord *p)
-{
- Z_GenericRecord *grs[20];
- int eno[20];
- int level = 0;
-
- if (array_init(return_value) == FAILURE)
- {
- RETURN_FALSE;
- }
- eno[level] = 0;
- grs[level] = p;
- while (level >= 0)
- {
- zval *my_zval;
- Z_TaggedElement *e = 0;
- Z_GenericRecord *p = grs[level];
- int i;
- char tag[256];
- int taglen = 0;
-
- if (eno[level] >= p->num_elements)
- {
- --level;
- if (level >= 0)
- eno[level]++;
- continue;
- }
- /* eno[level]++; */
-
- *tag = '\0';
- for (i = 0; i<=level; i++)
- {
- int tag_type = 3;
- e = grs[i]->elements[eno[i]];
-
- if (e->tagType)
- tag_type = *e->tagType;
-
- taglen = strlen(tag);
- sprintf (tag+taglen, "(%d,", tag_type);
- taglen = strlen(tag);
-
- if (e->tagValue->which == Z_StringOrNumeric_string)
- {
- int len = strlen(e->tagValue->u.string);
- memcpy (tag + taglen, e->tagValue->u.string, len);
- tag[taglen+len] = '\0';
- }
- else if (e->tagValue->which == Z_StringOrNumeric_numeric)
- {
- sprintf (tag + taglen, "%d", *e->tagValue->u.numeric);
- }
- taglen = strlen(tag);
- strcpy (tag + taglen, ")");
- }
- ALLOC_ZVAL(my_zval);
- array_init(my_zval);
- INIT_PZVAL(my_zval);
-
- add_next_index_string(my_zval, tag, 1);
-
- switch (e->content->which)
- {
- case Z_ElementData_string:
- add_next_index_string (my_zval, e->content->u.string, 1);
- break;
- case Z_ElementData_numeric:
- add_next_index_long (my_zval, *e->content->u.numeric);
- break;
- case Z_ElementData_trueOrFalse:
- add_next_index_long (my_zval, *e->content->u.trueOrFalse);
- break;
- case Z_ElementData_subtree:
- level++;
- grs[level] = e->content->u.subtree;
- eno[level] = -1;
- }
- zend_hash_next_index_insert (return_value->value.ht,
- (void *) &my_zval, sizeof(zval *), NULL);
- eno[level]++;
- }
-}
-
-
-/* {{{ proto string yaz_record(int id, int pos, string type)
- Return record information at given result set position */
-PHP_FUNCTION(yaz_record)
-{
- pval **pval_id, **pval_pos, **pval_type;
- Yaz_Association p;
- int pos;
- char *type;
-
- if (ZEND_NUM_ARGS() != 3)
- WRONG_PARAM_COUNT;
- if (zend_get_parameters_ex(3, &pval_id, &pval_pos, &pval_type) == FAILURE)
- {
- WRONG_PARAM_COUNT;
- }
- p = get_assoc (pval_id);
-
- convert_to_long_ex(pval_pos);
- pos = (*pval_pos)->value.lval;
-
- convert_to_string_ex(pval_type);
- type = (*pval_type)->value.str.val;
-
- if (p && p->resultSets && p->resultSets->recordList &&
- pos >= p->resultSetStartPoint &&
- pos < p->resultSetStartPoint + p->resultSets->recordList->num_records)
- {
- Z_NamePlusRecord *npr =
- p->resultSets->recordList->records[pos - p->resultSetStartPoint];
- if (npr->which == Z_NamePlusRecord_databaseRecord)
- {
- Z_External *r = (Z_External *) npr->u.databaseRecord;
- oident *ent = oid_getentbyoid(r->direct_reference);
-
- if (!strcmp (type, "syntax"))
- {
- if (ent && ent->desc)
- RETVAL_STRING(ent->desc, 1);
- }
- else if (!strcmp (type, "database"))
- {
- if (npr->databaseName)
- RETVAL_STRING(npr->databaseName, 1);
- }
- else if (!strcmp (type, "string"))
- {
- if (r->which == Z_External_sutrs && ent->value == VAL_SUTRS)
- {
- RETVAL_STRINGL(r->u.sutrs->buf, r->u.sutrs->len, 1);
- }
- else if (r->which == Z_External_octet)
- {
- char *buf = (char *) (r->u.octet_aligned->buf);
- int len = r->u.octet_aligned->len;
-
- switch (ent->value)
- {
- case VAL_SOIF:
- case VAL_HTML:
- break;
- case VAL_TEXT_XML:
- case VAL_APPLICATION_XML:
- break;
- default:
- break;
- }
- RETVAL_STRINGL(buf, len, 1);
- }
- }
- else if (!strcmp (type, "array"))
- {
- if (r->which == Z_External_grs1 && ent->value == VAL_GRS1)
- {
- retval_grs1 (return_value, r->u.grs1);
- }
- else if (r->which == Z_External_octet)
- {
- char *buf = (char *) (r->u.octet_aligned->buf);
- ODR odr = odr_createmem (ODR_DECODE);
- Z_GenericRecord *rec = 0;
-
- switch (ent->value)
- {
- case VAL_SOIF:
- case VAL_HTML:
- break;
- case VAL_TEXT_XML:
- case VAL_APPLICATION_XML:
- /* text2grs1 (&buf, &len, t->odr_in, 0, 0); */
- break;
- default:
- rec = marc_to_grs1 (buf, odr, r->direct_reference);
- }
- if (rec)
- retval_grs1 (return_value, rec);
- odr_destroy (odr);
- }
- }
- }
- }
- release_assoc (p);
-}
-/* }}} */
-
-
-/* {{{ proto int yaz_syntax(int id, string syntax)
- Set record syntax for retrieval */
-PHP_FUNCTION(yaz_syntax)
-{
- pval **pval_id, **pval_syntax;
- Yaz_Association p;
- if (ZEND_NUM_ARGS() != 2 ||
- zend_get_parameters_ex(2, &pval_id, &pval_syntax) == FAILURE)
- {
- WRONG_PARAM_COUNT;
- }
- p = get_assoc (pval_id);
- if (p)
- {
- convert_to_string_ex (pval_syntax);
- xfree (p->preferredRecordSyntax);
- p->preferredRecordSyntax = xstrdup ((*pval_syntax)->value.str.val);
- }
- release_assoc (p);
-}
-/* }}} */
-
-/* {{{ proto int yaz_element(int id, string elementsetname)
- Set Element-Set-Name for retrieval */
-PHP_FUNCTION(yaz_element)
-{
- pval **pval_id, **pval_element;
- Yaz_Association p;
- if (ZEND_NUM_ARGS() != 2 ||
- zend_get_parameters_ex(2, &pval_id, &pval_element) == FAILURE)
- {
- WRONG_PARAM_COUNT;
- }
- p = get_assoc (pval_id);
- if (p)
- {
- convert_to_string_ex (pval_element);
- xfree (p->elementSetNames);
- p->elementSetNames = xstrdup ((*pval_element)->value.str.val);
- }
- release_assoc (p);
-}
-/* }}} */
-
-/* {{{ proto int yaz_range(int id, int start, int number)
- Set result set start point and number of records to request */
-
-PHP_FUNCTION(yaz_range)
-{
- pval **pval_id, **pval_start, **pval_number;
- Yaz_Association p;
- if (ZEND_NUM_ARGS() != 3 ||
- zend_get_parameters_ex(3, &pval_id, &pval_start, &pval_number) ==
- FAILURE)
- {
- WRONG_PARAM_COUNT;
- }
- p = get_assoc (pval_id);
- if (p)
- {
- convert_to_long_ex (pval_start);
- p->resultSetStartPoint = (*pval_start)->value.lval;
- if (p->resultSetStartPoint < 1)
- p->resultSetStartPoint = 1;
- convert_to_long_ex (pval_number);
- p->numberOfRecordsRequested = (*pval_number)->value.lval;
- }
- release_assoc (p);
-}
-/* }}} */
-
-static const char *ill_array_lookup (void *clientData, const char *idx)
-{
- return array_lookup_string((HashTable *) clientData, idx+4);
-}
-
-static Z_External *encode_ill_request (Yaz_Association t, HashTable *ht)
-{
- ODR out = t->odr_out;
- ILL_Request *req;
- Z_External *r = 0;
- struct ill_get_ctl ctl;
-
- ctl.odr = t->odr_out;
- ctl.clientData = ht;
- ctl.f = ill_array_lookup;
-
- req = ill_get_ILLRequest(&ctl, "ill", 0);
-
- if (!ill_Request (out, &req, 0, 0))
- {
- int ill_request_size;
- char *ill_request_buf = odr_getbuf (out, &ill_request_size, 0);
- if (ill_request_buf)
- odr_setbuf (out, ill_request_buf, ill_request_size, 1);
- php_error(E_WARNING, "yaz_itemorder: Expected array parameter");
- return 0;
- }
- else
- {
- oident oid;
- int illRequest_size = 0;
- char *illRequest_buf = odr_getbuf (out, &illRequest_size, 0);
-
- oid.proto = PROTO_GENERAL;
- oid.oclass = CLASS_GENERAL;
- oid.value = VAL_ISO_ILL_1;
-
- r = (Z_External *) odr_malloc (out, sizeof(*r));
- r->direct_reference = odr_oiddup(out,oid_getoidbyent(&oid));
- r->indirect_reference = 0;
- r->descriptor = 0;
- r->which = Z_External_single;
-
- r->u.single_ASN1_type = (Odr_oct *)
- odr_malloc (out, sizeof(*r->u.single_ASN1_type));
- r->u.single_ASN1_type->buf = odr_malloc (out, illRequest_size);
- r->u.single_ASN1_type->len = illRequest_size;
- r->u.single_ASN1_type->size = illRequest_size;
- memcpy (r->u.single_ASN1_type->buf, illRequest_buf, illRequest_size);
- }
- return r;
-}
-
-static Z_ItemOrder *encode_item_order(Yaz_Association t,
- HashTable *ht)
-{
- Z_ItemOrder *req = odr_malloc (t->odr_out, sizeof(*req));
- const char *str;
-
-#ifdef ASN_COMPILED
- req->which=Z_IOItemOrder_esRequest;
-#else
- req->which=Z_ItemOrder_esRequest;
-#endif
- req->u.esRequest = (Z_IORequest *)
- odr_malloc(t->odr_out,sizeof(Z_IORequest));
-
- /* to keep part ... */
- req->u.esRequest->toKeep = (Z_IOOriginPartToKeep *)
- odr_malloc(t->odr_out,sizeof(Z_IOOriginPartToKeep));
- req->u.esRequest->toKeep->supplDescription = 0;
- req->u.esRequest->toKeep->contact =
- odr_malloc (t->odr_out, sizeof(*req->u.esRequest->toKeep->contact));
-
- str = array_lookup_string (ht, "contact-name");
- req->u.esRequest->toKeep->contact->name = str ?
- nmem_strdup (t->odr_out->mem, str) : 0;
-
- str = array_lookup_string (ht, "contact-phone");
- req->u.esRequest->toKeep->contact->phone = str ?
- nmem_strdup (t->odr_out->mem, str) : 0;
-
- str = array_lookup_string (ht, "contact-email");
- req->u.esRequest->toKeep->contact->email = str ?
- nmem_strdup (t->odr_out->mem, str) : 0;
-
- req->u.esRequest->toKeep->addlBilling = 0;
-
- /* not to keep part ... */
- req->u.esRequest->notToKeep = (Z_IOOriginPartNotToKeep *)
- odr_malloc(t->odr_out,sizeof(Z_IOOriginPartNotToKeep));
-
- req->u.esRequest->notToKeep->resultSetItem = (Z_IOResultSetItem *)
- odr_malloc(t->odr_out, sizeof(Z_IOResultSetItem));
- req->u.esRequest->notToKeep->resultSetItem->resultSetId = "default";
- req->u.esRequest->notToKeep->resultSetItem->item =
- (int *) odr_malloc(t->odr_out, sizeof(int));
-
- str = array_lookup_string (ht, "itemorder-item");
- *req->u.esRequest->notToKeep->resultSetItem->item =
- (str ? atoi(str) : 1);
-
- req->u.esRequest->notToKeep->itemRequest =
- encode_ill_request(t, ht);
-
- return req;
-}
-
-static Z_APDU *encode_es_itemorder (Yaz_Association t, HashTable *ht)
-{
- Z_APDU *apdu = zget_APDU(t->odr_out, Z_APDU_extendedServicesRequest);
- Z_ExtendedServicesRequest *req = apdu->u.extendedServicesRequest;
- const char *str;
- struct oident oident;
- int oid[OID_SIZE];
- Z_External *r = odr_malloc (t->odr_out, sizeof(*r));
-
- *req->function = Z_ExtendedServicesRequest_create;
- oident.proto = PROTO_Z3950;
- oident.oclass = CLASS_EXTSERV;
- oident.value = VAL_ITEMORDER;
- req->taskSpecificParameters = r;
- r->direct_reference =
- odr_oiddup(t->odr_out, oid_ent_to_oid(&oident, oid));
- r->indirect_reference = 0;
- r->descriptor = 0;
- r->which = Z_External_itemOrder;
- r->u.itemOrder = encode_item_order (t, ht);
- req->packageType = odr_oiddup(t->odr_out, oid_ent_to_oid(&oident, oid));
-
- str = array_lookup_string(ht, "package-name");
- if (str && *str)
- req->packageName = nmem_strdup (t->odr_out->mem, str);
-
- str = array_lookup_string(ht, "user-id");
- if (str)
- req->userId = nmem_strdup (t->odr_out->mem, str);
-
- return apdu;
-}
-
-
-/* {{{ proto int yaz_itemorder(int id, array package)
- Sends Item Order request */
-
-PHP_FUNCTION(yaz_itemorder)
-{
- pval **pval_id, **pval_package;
- Yaz_Association p;
- if (ZEND_NUM_ARGS() != 2 ||
- zend_get_parameters_ex(2, &pval_id, &pval_package) ==
- FAILURE)
- {
- WRONG_PARAM_COUNT;
- }
- if (Z_TYPE_PP(pval_package) != IS_ARRAY)
- {
- php_error(E_WARNING, "yaz_itemorder: Expected array parameter");
- RETURN_FALSE;
- }
- p = get_assoc (pval_id);
- if (p)
- {
- Z_APDU *apdu;
- p->action = 0;
- apdu = encode_es_itemorder (p, Z_ARRVAL_PP(pval_package));
- if (apdu)
- {
- char *buf;
- encode_APDU(p, apdu, p->odr_out);
- buf = odr_getbuf(p->odr_out, &p->ill_len_out, 0);
- xfree (p->ill_buf_out);
- p->ill_buf_out = xmalloc (p->ill_len_out);
- memcpy (p->ill_buf_out, buf, p->ill_len_out);
- p->action = send_packet;
- }
- }
- release_assoc (p);
-}
-/* }}} */
-
-static Z_APDU *encode_scan (Yaz_Association t, const char *type,
- const char *query, HashTable *ht)
-{
- Z_APDU *apdu = zget_APDU(t->odr_out, Z_APDU_scanRequest);
- Z_ScanRequest *req = apdu->u.scanRequest;
- const char *val;
- if (!strcmp(type, "rpn"))
- {
- if (!(req->termListAndStartPoint =
- p_query_scan(t->odr_out, PROTO_Z3950, &req->attributeSet,
- query)))
- {
- char str[80];
- sprintf (str, "YAZ: Bad Scan query: '%.40s'", query);
- php_error (E_WARNING, str);
- return 0;
- }
- }
- else
- {
- char str[80];
- sprintf (str, "YAZ: Bad Scan query type: '%.40s'", type);
- php_error (E_WARNING, str);
- return 0;
- }
- val = array_lookup_string(ht, "number");
- if (val && *val)
- *req->numberOfTermsRequested = atoi(val);
- val = array_lookup_string(ht, "position");
- if (val && *val)
- {
- req->preferredPositionInResponse =
- odr_malloc (t->odr_out, sizeof(int));
- *req->preferredPositionInResponse = atoi(val);
- }
- val = array_lookup_string(ht, "stepsize");
- if (val && *val)
- {
- req->stepSize = odr_malloc (t->odr_out, sizeof(int));
- *req->stepSize = atoi(val);
- }
- req->databaseNames = set_DatabaseNames (t, &req->num_databaseNames);
- return apdu;
-}
-
-/* {{{ proto int yaz_scan(int id, type, query [, flags])
- Sends Scan Request */
-PHP_FUNCTION(yaz_scan)
-{
- pval **pval_id, **pval_type, **pval_query, **pval_flags = 0;
- HashTable *flags_ht = 0;
- Yaz_Association p;
- if (ZEND_NUM_ARGS() == 3)
- {
- if (zend_get_parameters_ex(3, &pval_id, &pval_type, &pval_query) ==
- FAILURE)
- {
- WRONG_PARAM_COUNT;
- }
- }
- else if (ZEND_NUM_ARGS() == 4)
- {
- if (zend_get_parameters_ex(4, &pval_id, &pval_type, &pval_query,
- &pval_flags) ==
- FAILURE)
- {
- WRONG_PARAM_COUNT;
- }
- if (Z_TYPE_PP(pval_flags) != IS_ARRAY)
- {
- php_error(E_WARNING, "yaz_scan: Bad flags parameter");
- RETURN_FALSE;
- }
- flags_ht = Z_ARRVAL_PP(pval_flags);
- }
- else
- {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex (pval_type);
- convert_to_string_ex (pval_query);
-
- p = get_assoc (pval_id);
- if (p)
- {
- Z_APDU *apdu;
- p->action = 0;
- apdu = encode_scan (p, Z_STRVAL_PP(pval_type), Z_STRVAL_PP(pval_query),
- flags_ht);
- if (apdu)
- {
- char *buf;
- odr_reset(p->odr_scan);
- p->scan_response = 0;
- encode_APDU(p, apdu, p->odr_out);
- buf = odr_getbuf(p->odr_out, &p->ill_len_out, 0);
- xfree (p->ill_buf_out);
- p->ill_buf_out = xmalloc (p->ill_len_out);
- memcpy (p->ill_buf_out, buf, p->ill_len_out);
- p->action = send_packet;
- }
- }
- release_assoc (p);
-}
-/* }}} */
-
-/* {{{ proto int yaz_scan_result(int id, array options)
- Inspects Scan Result */
-PHP_FUNCTION(yaz_scan_result)
-{
- pval **pval_id, **pval_opt = 0;
- Yaz_Association p;
- if (ZEND_NUM_ARGS() == 2)
- {
- if (zend_get_parameters_ex(2, &pval_id, &pval_opt) == FAILURE)
- {
- WRONG_PARAM_COUNT;
- }
- if (!ParameterPassedByReference(ht, 2))
- {
- WRONG_PARAM_COUNT;
- }
- }
- else if (ZEND_NUM_ARGS() == 1)
- {
- if (zend_get_parameters_ex(1, &pval_id) == FAILURE)
- {
- WRONG_PARAM_COUNT;
- }
- }
- else
- {
- WRONG_PARAM_COUNT;
- }
- if (array_init(return_value) == FAILURE)
- {
- RETURN_FALSE;
- }
- if (pval_opt && array_init(*pval_opt) == FAILURE)
- {
- RETURN_FALSE;
- }
- p = get_assoc (pval_id);
- if (p && p->scan_response)
- {
- int i;
- Z_ScanResponse *res = p->scan_response;
- if (pval_opt)
- {
- if (res->numberOfEntriesReturned)
- add_assoc_long(*pval_opt, "number",
- *res->numberOfEntriesReturned);
- if (res->stepSize)
- add_assoc_long(*pval_opt, "stepsize", *res->stepSize);
- if (res->positionOfTerm)
- add_assoc_long(*pval_opt, "position", *res->positionOfTerm);
- if (res->scanStatus)
- add_assoc_long(*pval_opt, "status", *res->scanStatus);
- }
- for (i = 0; res->entries && i < res->entries->num_entries; i++)
- {
- zval *my_zval;
- ALLOC_ZVAL(my_zval);
- array_init(my_zval);
- INIT_PZVAL(my_zval);
-
- if (res->entries->entries[i]->which == Z_Entry_termInfo)
- {
- Z_TermInfo *t = res->entries->entries[i]->u.termInfo;
- add_next_index_string(my_zval, "term", 1);
-
- if (t->term->which == Z_Term_general)
- add_next_index_stringl (my_zval, t->term->u.general->buf,
- t->term->u.general->len, 1);
- else
- add_next_index_string (my_zval, "?", 1);
- add_next_index_long (my_zval, t->globalOccurrences ?
- *t->globalOccurrences : 0);
- }
- else
- add_next_index_string(my_zval, "unknown", 1);
-
- zend_hash_next_index_insert (
- return_value->value.ht, (void *) &my_zval, sizeof(zval *),
- NULL);
- }
-
- }
- release_assoc (p);
-}
-/* }}} */
-
-/* {{{ proto int yaz_ccl_conf(int id, array package)
- Configure CCL package */
-
-PHP_FUNCTION(yaz_ccl_conf)
-{
- pval **pval_id, **pval_package;
- Yaz_Association p;
- if (ZEND_NUM_ARGS() != 2 ||
- zend_get_parameters_ex(2, &pval_id, &pval_package) ==
- FAILURE)
- {
- WRONG_PARAM_COUNT;
- }
- if (Z_TYPE_PP(pval_package) != IS_ARRAY)
- {
- php_error(E_WARNING, "yaz_ccl_conf: Expected array parameter");
- RETURN_FALSE;
- }
- p = get_assoc (pval_id);
- if (p)
- {
- HashTable *ht = Z_ARRVAL_PP(pval_package);
- HashPosition pos;
- zval **ent;
- char *key;
-
- ccl_qual_rm(&p->ccl_parser->bibset);
- p->ccl_parser->bibset = ccl_qual_mk();
- for(zend_hash_internal_pointer_reset_ex(ht, &pos);
- zend_hash_get_current_data_ex(ht, (void**) &ent, &pos) == SUCCESS;
- zend_hash_move_forward_ex(ht, &pos))
- {
- ulong idx;
-#if PHP_API_VERSION > 20010101
- int type = zend_hash_get_current_key_ex(ht, &key, 0,
- &idx, 0, &pos);
-#else
- int type = zend_hash_get_current_key_ex(ht, &key, 0,
- &idx, &pos);
-#endif
- if (type != HASH_KEY_IS_STRING || Z_TYPE_PP(ent) != IS_STRING)
- continue;
- ccl_qual_fitem(p->ccl_parser->bibset, (*ent)->value.str.val, key);
- }
- }
- release_assoc (p);
-}
-/* }}} */
-
-/* {{{ proto int yaz_ccl_parse(int id, string query, array res)
- Parse a CCL query */
-
-PHP_FUNCTION(yaz_ccl_parse)
-{
- pval **pval_id, **pval_query, **pval_res = 0;
- Yaz_Association p;
- if (ZEND_NUM_ARGS() != 3 ||
- zend_get_parameters_ex(3, &pval_id, &pval_query, &pval_res) ==
- FAILURE)
- {
- WRONG_PARAM_COUNT;
- }
-
- if (!ParameterPassedByReference(ht, 3)) {
- php_error(E_WARNING, "Third argument must be passed by reference.");
- RETURN_FALSE;
- }
- pval_destructor(*pval_res);
- if (array_init(*pval_res) == FAILURE)
- {
- php_error(E_WARNING, "cannot initialize array");
- RETURN_FALSE;
- }
- convert_to_string_ex (pval_query);
- p = get_assoc (pval_id);
- if (p)
- {
- const char *query_str = (*pval_query)->value.str.val;
- struct ccl_rpn_node *rpn;
- struct ccl_token *token_list =
- ccl_parser_tokenize(p->ccl_parser, query_str);
- rpn = ccl_parser_find(p->ccl_parser, token_list);
- ccl_token_del(token_list);
-
- add_assoc_long(*pval_res, "errorcode", p->ccl_parser->error_code);
- if (p->ccl_parser->error_code)
- {
- add_assoc_string(*pval_res, "errorstring",
- (char*) ccl_err_msg(p->ccl_parser->error_code),
- 1);
- add_assoc_long(*pval_res, "errorpos",
- p->ccl_parser->error_pos - query_str);
- RETVAL_FALSE;
- }
- else
- {
- WRBUF wrbuf_pqf = wrbuf_alloc();
- ccl_pquery(wrbuf_pqf, rpn);
- add_assoc_stringl(*pval_res, "rpn", wrbuf_buf(wrbuf_pqf),
- wrbuf_len(wrbuf_pqf),1);
- wrbuf_free(wrbuf_pqf, 1);
- RETVAL_TRUE;
- }
- ccl_rpn_delete(rpn);
- }
- else
- RETVAL_FALSE;
- release_assoc (p);
-}
-/* }}} */
-
-/* {{{ proto int yaz_ccl_parse(int id, string query, array res)
- Parse a CCL query */
-
-PHP_FUNCTION(yaz_database)
-{
- pval **pval_id, **pval_database;
- Yaz_Association p;
- if (ZEND_NUM_ARGS() != 2 ||
- zend_get_parameters_ex(2, &pval_id, &pval_database) ==
- FAILURE)
- {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex (pval_database);
- p = get_assoc (pval_id);
- if (p)
- {
- xfree (p->local_databases);
- p->local_databases = xstrdup ((*pval_database)->value.str.val);
- RETVAL_TRUE;
- }
- else
- RETVAL_FALSE;
- release_assoc (p);
-}
-/* }}} */
-
-
-PHP_MINIT_FUNCTION(yaz)
-{
- int i;
- nmem_init();
-#ifdef ZTS
- yaz_mutex = tsrm_mutex_alloc();
-#endif
- order_associations = 1;
- shared_associations = xmalloc (sizeof(*shared_associations) * MAX_ASSOC);
- for (i = 0; i<MAX_ASSOC; i++)
- shared_associations[i] = 0;
- return SUCCESS;
-}
-
-PHP_MSHUTDOWN_FUNCTION(yaz)
-{
- int i;
-
- if (shared_associations)
- {
- for (i = 0; i<MAX_ASSOC; i++)
- yaz_association_destroy (shared_associations[i]);
- xfree (shared_associations);
- shared_associations = 0;
- nmem_exit();
- }
-#ifdef ZTS
- tsrm_mutex_free (yaz_mutex);
-#endif
- return SUCCESS;
-}
-
-PHP_MINFO_FUNCTION(yaz)
-{
- php_info_print_table_start();
- php_info_print_table_row(2, "YAZ Support", "enabled");
- php_info_print_table_row(2, "YAZ Version", YAZ_VERSION);
- php_info_print_table_end();
-}
-
-PHP_RSHUTDOWN_FUNCTION(yaz)
-{
- int i;
-
-#ifdef ZTS
- tsrm_mutex_lock (yaz_mutex);
-#endif
- if (shared_associations)
- {
- for (i = 0; i<MAX_ASSOC; i++)
- /* destroy those where password has been used */
- if (shared_associations[i] && !shared_associations[i]->persistent)
- {
- yaz_association_destroy(shared_associations[i]);
- shared_associations[i] = 0;
- }
- }
-#ifdef ZTS
- tsrm_mutex_unlock (yaz_mutex);
-#endif
- return SUCCESS;
-}
-
-PHP_RINIT_FUNCTION(yaz)
-{
-#ifdef ZTS
- tsrm_mutex_lock (yaz_mutex);
-#endif
- order_associations++;
-#ifdef ZTS
- tsrm_mutex_unlock (yaz_mutex);
-#endif
- return SUCCESS;
-}
-
-zend_module_entry yaz_module_entry = {
- "YAZ",
- yaz_functions,
- PHP_MINIT(yaz),
- PHP_MSHUTDOWN(yaz),
- PHP_RINIT(yaz),
- PHP_RSHUTDOWN(yaz),
- PHP_MINFO(yaz),
- STANDARD_MODULE_PROPERTIES
-};
-
-#ifdef COMPILE_DL_YAZ
-ZEND_GET_MODULE(yaz)
-#endif
-
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/yaz/php_yaz.h b/ext/yaz/php_yaz.h
deleted file mode 100644
index 46024c5d2e..0000000000
--- a/ext/yaz/php_yaz.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Adam Dickmeiss <adam@indexdata.dk> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifndef PHP_YAZ_H
-#define PHP_YAZ_H
-
-#if HAVE_YAZ
-
-#ifdef ZTS
-#include "TSRM.h"
-#endif
-
-extern zend_module_entry yaz_module_entry;
-#define yaz_module_ptr &yaz_module_entry
-
-PHP_FUNCTION(yaz_connect);
-PHP_FUNCTION(yaz_close);
-PHP_FUNCTION(yaz_search);
-PHP_FUNCTION(yaz_wait);
-PHP_FUNCTION(yaz_errno);
-PHP_FUNCTION(yaz_error);
-PHP_FUNCTION(yaz_addinfo);
-PHP_FUNCTION(yaz_hits);
-PHP_FUNCTION(yaz_record);
-PHP_FUNCTION(yaz_syntax);
-PHP_FUNCTION(yaz_element);
-PHP_FUNCTION(yaz_range);
-PHP_FUNCTION(yaz_itemorder);
-PHP_FUNCTION(yaz_scan);
-PHP_FUNCTION(yaz_scan_result);
-PHP_FUNCTION(yaz_present);
-PHP_FUNCTION(yaz_ccl_conf);
-PHP_FUNCTION(yaz_ccl_parse);
-PHP_FUNCTION(yaz_database);
-
-#else
-
-#define yaz_module_ptr NULL
-#endif
-
-#define phpext_yaz_ptr yaz_module_ptr
-#endif
diff --git a/ext/yaz/setup.stub b/ext/yaz/setup.stub
deleted file mode 100644
index 191cd76fd8..0000000000
--- a/ext/yaz/setup.stub
+++ /dev/null
@@ -1,8 +0,0 @@
-# $Source$
-# $Id$
-
-define_option with-yaz 'YAZ support?' yesnodir \
- 'no /usr/bin YAZ base install' \
-' Whether to build with YAZ (Z39.50 protocol package)\n
- support.\n
- More info about YAZ can be found at http://www.indexdata.dk/yaz/'
diff --git a/ext/yaz/yaz.dsp b/ext/yaz/yaz.dsp
deleted file mode 100644
index ee9d6ee163..0000000000
--- a/ext/yaz/yaz.dsp
+++ /dev/null
@@ -1,111 +0,0 @@
-# Microsoft Developer Studio Project File - Name="yaz" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=yaz - Win32 Debug_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "yaz.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "yaz.mak" CFG="yaz - Win32 Debug_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "yaz - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "yaz - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "yaz - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "YAZ_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\main" /D ZEND_DEBUG=0 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "PHP_EXPORTS" /D "COMPILE_DL_YAZ" /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_YAZ=1 /D ZTS=1 /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x407 /d "NDEBUG"
-# ADD RSC /l 0x407 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 php4ts.lib yaz.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_yaz.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
-
-!ELSEIF "$(CFG)" == "yaz - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "YAZ_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\main" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "PHP_EXPORTS" /D "COMPILE_DL_YAZ" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_YAZ=1 /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x407 /d "_DEBUG"
-# ADD RSC /l 0x407 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 php4ts-debug.lib yaz.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib /nologo /dll /debug /machine:I386 /out:"..\..\Debug_TS/php_yaz.dll" /pdbtype:sept /libpath:"..\..\Debug_TS"
-
-!ENDIF
-
-# Begin Target
-
-# Name "yaz - Win32 Release_TS"
-# Name "yaz - Win32 Debug_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\php_yaz.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_yaz.h
-# End Source File
-# End Group
-# Begin Source File
-
-SOURCE=.\README
-# End Source File
-# End Target
-# End Project
diff --git a/ext/yp/CREDITS b/ext/yp/CREDITS
deleted file mode 100644
index 4c52145877..0000000000
--- a/ext/yp/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-Yellow Pages
-Stephanie Wehner, Fredrik Ohrn
diff --git a/ext/yp/Makefile.in b/ext/yp/Makefile.in
deleted file mode 100644
index 42cfa1351c..0000000000
--- a/ext/yp/Makefile.in
+++ /dev/null
@@ -1,6 +0,0 @@
-
-LTLIBRARY_NAME = libyp.la
-LTLIBRARY_SOURCES = yp.c
-LTLIBRARY_SHARED_NAME = yp.la
-
-include $(top_srcdir)/build/dynlib.mk
diff --git a/ext/yp/config.m4 b/ext/yp/config.m4
deleted file mode 100644
index eba76b9ffa..0000000000
--- a/ext/yp/config.m4
+++ /dev/null
@@ -1,15 +0,0 @@
-dnl $Id$
-dnl config.m4 for extension yp
-dnl don't forget to call PHP_EXTENSION(yp)
-
-PHP_ARG_ENABLE(yp,whether to include YP support,
-[ --enable-yp Include YP support])
-
-if test "$PHP_YP" != "no"; then
- AC_DEFINE(HAVE_YP,1,[ ])
- PHP_EXTENSION(yp, $ext_shared)
- case $host_alias in
- *solaris*)
- AC_DEFINE(SOLARIS_YP,1,[ ]) ;;
- esac
-fi
diff --git a/ext/yp/php_yp.h b/ext/yp/php_yp.h
deleted file mode 100644
index 0b6d7bbad1..0000000000
--- a/ext/yp/php_yp.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Stephanie Wehner <_@r4k.net> |
- | Fredrik Ohrn |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef PHP_YP_H
-#define PHP_YP_H
-
-#if HAVE_YP
-
-#ifdef PHP_WIN32
-#define PHP_YP_API __declspec(dllexport)
-#else
-#define PHP_YP_API
-#endif
-
-extern zend_module_entry yp_module_entry;
-#define yp_module_ptr &yp_module_entry
-
-/* yp.c functions */
-PHP_FUNCTION(yp_get_default_domain);
-PHP_FUNCTION(yp_order);
-PHP_FUNCTION(yp_master);
-PHP_FUNCTION(yp_match);
-PHP_FUNCTION(yp_first);
-PHP_FUNCTION(yp_next);
-PHP_FUNCTION(yp_all);
-PHP_FUNCTION(yp_cat);
-PHP_FUNCTION(yp_errno);
-PHP_FUNCTION(yp_err_string);
-PHP_MINIT_FUNCTION(yp);
-PHP_RINIT_FUNCTION(yp);
-PHP_MINFO_FUNCTION(yp);
-
-typedef struct {
- int error;
-} php_yp_globals;
-
-#ifdef ZTS
-#define YPLS_D php_yp_globals *yp_globals
-#define YPLS_DC , YPLS_D
-#define YPLS_C yp_globals
-#define YPLS_CC , YPLS_C
-#define YP(v) (yp_globals->v)
-#define YPLS_FETCH() php_yp_globals *yp_globals = ts_resource(yp_globals_id)
-#else
-#define YPLS_D
-#define YPLS_DC
-#define YPLS_C
-#define YPLS_CC
-#define YP(v) (yp_globals.v)
-#define YPLS_FETCH()
-#endif
-
-#else
-
-#define yp_module_ptr NULL
-
-#endif /* HAVE_YP */
-
-#define phpext_yp_ptr yp_module_ptr
-
-#endif /* PHP_YP_H */
diff --git a/ext/yp/setup.stub b/ext/yp/setup.stub
deleted file mode 100644
index f91adef610..0000000000
--- a/ext/yp/setup.stub
+++ /dev/null
@@ -1,6 +0,0 @@
-# $Source$
-# $Id$
-
-define_option with-yp 'yp support?' yesnodir no \
-' Whether to build the yp extension.'
-
diff --git a/ext/yp/yp.c b/ext/yp/yp.c
deleted file mode 100644
index 672fe100de..0000000000
--- a/ext/yp/yp.c
+++ /dev/null
@@ -1,412 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Stephanie Wehner <_@r4k.net> |
- | Fredrik Ohrn |
- +----------------------------------------------------------------------+
- */
-/* $Id$ */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "ext/standard/info.h"
-
-#if HAVE_YP
-
-#include "php_yp.h"
-
-#include <rpcsvc/ypclnt.h>
-
-/* {{{ thread safety stuff */
-
-#ifdef ZTS
-int yp_globals_id;
-#else
-PHP_YP_API php_yp_globals yp_globals;
-#endif
-
-/* }}} */
-
-function_entry yp_functions[] = {
- PHP_FE(yp_get_default_domain, NULL)
- PHP_FE(yp_order, NULL)
- PHP_FE(yp_master, NULL)
- PHP_FE(yp_match, NULL)
- PHP_FE(yp_first, NULL)
- PHP_FE(yp_next, NULL)
- PHP_FE(yp_all, NULL)
- PHP_FE(yp_cat, NULL)
- PHP_FE(yp_errno, NULL)
- PHP_FE(yp_err_string, NULL)
- {NULL, NULL, NULL}
-};
-
-zend_module_entry yp_module_entry = {
- "yp",
- yp_functions,
- PHP_MINIT(yp),
- NULL,
- PHP_RINIT(yp),
- NULL,
- PHP_MINFO(yp),
- STANDARD_MODULE_PROPERTIES
-};
-
-#ifdef COMPILE_DL_YP
-ZEND_GET_MODULE(yp)
-#endif
-
-/* {{{ proto string yp_get_default_domain(void)
- Returns the domain or false */
-PHP_FUNCTION(yp_get_default_domain) {
- char *outdomain;
- YPLS_FETCH();
-
- if(YP(error) = yp_get_default_domain(&outdomain)) {
- php_error(E_WARNING, yperr_string (YP(error)));
- RETURN_FALSE;
- }
- RETVAL_STRING(outdomain,1);
-}
-/* }}} */
-
-/* {{{ proto int yp_order(string domain, string map)
- Returns the order number or false */
-PHP_FUNCTION(yp_order) {
- pval **domain, **map;
-
-#if SOLARIS_YP
- unsigned long outval;
-#else
- int outval;
-#endif
-
- YPLS_FETCH();
-
- if((ZEND_NUM_ARGS() != 2) || zend_get_parameters_ex(2,&domain,&map) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(domain);
- convert_to_string_ex(map);
-
- if(YP(error) = yp_order(Z_STRVAL_PP (domain), Z_STRVAL_PP (map), &outval)) {
- php_error(E_WARNING, yperr_string (YP(error)));
- RETURN_FALSE;
- }
-
- RETVAL_LONG(outval);
-}
-/* }}} */
-
-/* {{{ proto string yp_master(string domain, string map)
- Returns the machine name of the master */
-PHP_FUNCTION(yp_master) {
- pval **domain, **map;
- char *outname;
- YPLS_FETCH();
-
- if((ZEND_NUM_ARGS() != 2) || zend_get_parameters_ex(2,&domain,&map) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(domain);
- convert_to_string_ex(map);
-
- if(YP(error) = yp_master(Z_STRVAL_PP (domain), Z_STRVAL_PP (map), &outname)) {
- php_error(E_WARNING, yperr_string (YP(error)));
- RETURN_FALSE;
- }
-
- RETVAL_STRING(outname,1);
-}
-/* }}} */
-
-/* {{{ proto string yp_match(string domain, string map, string key)
- Returns the matched line or false */
-PHP_FUNCTION(yp_match) {
- pval **domain, **map, **key;
- char *outval;
- int outvallen;
- YPLS_FETCH();
-
- if((ZEND_NUM_ARGS() != 3) || zend_get_parameters_ex(3,&domain,&map,&key) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(domain);
- convert_to_string_ex(map);
- convert_to_string_ex(key);
-
- if(YP(error) = yp_match(Z_STRVAL_PP (domain), Z_STRVAL_PP (map), Z_STRVAL_PP (key), Z_STRLEN_PP (key), &outval, &outvallen)) {
- php_error(E_WARNING, yperr_string (YP(error)));
- RETURN_FALSE;
- }
-
- RETVAL_STRINGL(outval,outvallen,1);
-}
-/* }}} */
-
-/* {{{ proto array yp_first(string domain, string map)
- Returns the first key as array with $var[$key] and the the line as the value */
-PHP_FUNCTION(yp_first) {
- pval **domain, **map;
- char *outval, *outkey;
- int outvallen, outkeylen;
- YPLS_FETCH();
-
- if((ZEND_NUM_ARGS() != 2) || zend_get_parameters_ex(2,&domain,&map) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(domain);
- convert_to_string_ex(map);
-
- if(YP(error) = yp_first(Z_STRVAL_PP (domain), Z_STRVAL_PP (map), &outkey, &outkeylen, &outval, &outvallen)) {
- php_error(E_WARNING, yperr_string (YP(error)));
- RETURN_FALSE;
- }
- array_init(return_value);
- add_assoc_stringl_ex(return_value,outkey,outkeylen,outval,outvallen,1);
-
- /* Deprecated */
- add_assoc_stringl(return_value,"key",outkey,outkeylen,1);
- add_assoc_stringl(return_value,"value",outval,outvallen,1);
-}
-/* }}} */
-
-/* {{{ proto array yp_next(string domain, string map, string key)
- Returns an array with $var[$key] and the the line as the value */
-PHP_FUNCTION(yp_next) {
- pval **domain, **map, **key;
- char *outval, *outkey;
- int outvallen, outkeylen;
- YPLS_FETCH();
-
- if((ZEND_NUM_ARGS() != 3) || zend_get_parameters_ex(3,&domain,&map,&key) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(domain);
- convert_to_string_ex(map);
- convert_to_string_ex(key);
-
- if(YP(error) = yp_next(Z_STRVAL_PP (domain), Z_STRVAL_PP (map), Z_STRVAL_PP (key), Z_STRLEN_PP (key), &outkey, &outkeylen, &outval, &outvallen)) {
- php_error(E_WARNING, yperr_string (YP(error)));
- RETURN_FALSE;
- }
-
- array_init(return_value);
- add_assoc_stringl_ex(return_value,outkey,outkeylen,outval,outvallen,1);
-}
-/* }}} */
-
-/* {{{ php_foreach_all
- */
-static int php_foreach_all (int instatus, char *inkey, int inkeylen, char *inval, int invallen, char *indata)
-{
- int r;
- zval *status, *key, *value;
- zval **args [3];
- zval *retval;
- CLS_FETCH();
-
- args[0] = &status;
- args[1] = &key;
- args[2] = &value;
-
- MAKE_STD_ZVAL (status);
- ZVAL_LONG (status, ypprot_err (instatus));
-
- MAKE_STD_ZVAL (key);
- ZVAL_STRINGL (key, inkey, inkeylen, 1);
-
- MAKE_STD_ZVAL (value);
- ZVAL_STRINGL (value, inval, invallen, 1);
-
- if(call_user_function_ex(CG(function_table), NULL, *((zval **)indata), &retval, 3, args, 0, NULL) != SUCCESS)
- {
- zend_error(E_ERROR, "Function call failed");
- return 1;
- }
-
- convert_to_long_ex(&retval);
- r = Z_LVAL_P (retval);
-
- zval_ptr_dtor(&retval);
-
- zval_ptr_dtor(&status);
- zval_ptr_dtor(&key);
- zval_ptr_dtor(&value);
-
- return r;
-}
-/* }}} */
-
-/* {{{ proto void yp_all(string domain, string map, string callback)
- Traverse the map and call a function on each entry */
-PHP_FUNCTION(yp_all) {
- pval **domain, **map, **php_callback;
- struct ypall_callback callback;
-
- if((ZEND_NUM_ARGS() != 3) || zend_get_parameters_ex(3,&domain,&map,&php_callback) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(domain);
- convert_to_string_ex(map);
-
- callback.foreach = php_foreach_all;
- callback.data = (char *) php_callback;
-
- yp_all(Z_STRVAL_PP(domain),Z_STRVAL_PP(map),&callback);
-
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ php_foreach_cat
- */
-static int php_foreach_cat (int instatus, char *inkey, int inkeylen, char *inval, int invallen, char *indata)
-{
- int err;
-
- err = ypprot_err (instatus);
-
- if (!err)
- {
- if (inkeylen)
- add_assoc_stringl_ex((zval *) indata,inkey,inkeylen,inval,invallen,1);
-
- return 0;
- }
-
- if (err != YPERR_NOMORE)
- {
- YPLS_FETCH();
- YP(error) = err;
- php_error(E_WARNING, yperr_string (err));
- }
-
- return 0;
-}
-/* }}} */
-
-/* {{{ proto array yp_cat(string domain, string map)
- Return an array containing the entire map */
-PHP_FUNCTION(yp_cat) {
- pval **domain, **map;
- struct ypall_callback callback;
-
- if((ZEND_NUM_ARGS() != 2) || zend_get_parameters_ex(2,&domain,&map) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(domain);
- convert_to_string_ex(map);
-
- array_init(return_value);
-
- callback.foreach = php_foreach_cat;
- callback.data = (char *) return_value;
-
- yp_all(Z_STRVAL_PP(domain),Z_STRVAL_PP(map),&callback);
-}
-/* }}} */
-
-/* {{{ proto int yp_errno()
- Returns the error code from the last call or 0 if no error occured */
-PHP_FUNCTION(yp_errno) {
- YPLS_FETCH();
-
- if((ZEND_NUM_ARGS() != 0)) {
- WRONG_PARAM_COUNT;
- }
-
- RETURN_LONG (YP(error));
-}
-/* }}} */
-
-/* {{{ proto string yp_err_string(int errorcode)
- Returns the corresponding error string for the given error code */
-PHP_FUNCTION(yp_err_string) {
- pval **error;
- char *string;
-
- if((ZEND_NUM_ARGS() != 1) || zend_get_parameters_ex(1,&error) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(error);
-
- if((string = yperr_string(Z_LVAL_PP(error))) == NULL) {
- RETURN_FALSE;
- }
-
- RETVAL_STRING(string,1);
-}
-/* }}} */
-
-/* {{{ PHP_MINIT_FUNCTION
- */
-PHP_MINIT_FUNCTION(yp)
-{
-#ifdef ZTS
- yp_globals_id = ts_allocate_id(sizeof(php_yp_globals), NULL, NULL);
-#endif
-
- REGISTER_LONG_CONSTANT("YPERR_BADARGS", YPERR_BADARGS, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("YPERR_BADDB", YPERR_BADDB, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("YPERR_BUSY", YPERR_BUSY, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("YPERR_DOMAIN", YPERR_DOMAIN, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("YPERR_KEY", YPERR_KEY, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("YPERR_MAP", YPERR_MAP, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("YPERR_NODOM", YPERR_NODOM, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("YPERR_NOMORE", YPERR_NOMORE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("YPERR_PMAP", YPERR_PMAP, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("YPERR_RESRC", YPERR_RESRC, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("YPERR_RPC", YPERR_RPC, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("YPERR_YPBIND", YPERR_YPBIND, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("YPERR_YPERR", YPERR_YPERR, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("YPERR_YPSERV", YPERR_YPSERV, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("YPERR_VERS", YPERR_VERS, CONST_CS | CONST_PERSISTENT);
-
- return SUCCESS;
-}
-/* }}} */
-
-PHP_RINIT_FUNCTION(yp)
-{
- YPLS_FETCH();
- YP(error) = 0;
-}
-
-PHP_MINFO_FUNCTION(yp) {
- php_info_print_table_start();
- php_info_print_table_row(2, "YP Support", "enabled");
- php_info_print_table_end();
-}
-#endif /* HAVE_YP */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/zip/CREDITS b/ext/zip/CREDITS
deleted file mode 100644
index be2c5a2b44..0000000000
--- a/ext/zip/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-Zip
-Sterling Hughes
diff --git a/ext/zip/Makefile.in b/ext/zip/Makefile.in
deleted file mode 100644
index b419edc3bd..0000000000
--- a/ext/zip/Makefile.in
+++ /dev/null
@@ -1,8 +0,0 @@
-# $Id$
-
-LTLIBRARY_NAME = libzip.la
-LTLIBRARY_SOURCES = zip.c
-LTLIBRARY_SHARED_NAME = zip.la
-LTLIBRARY_SHARED_LIBADD = $(ZIP_SHARED_LIBADD)
-
-include $(top_srcdir)/build/dynlib.mk
diff --git a/ext/zip/config.m4 b/ext/zip/config.m4
deleted file mode 100644
index 0db652f4e8..0000000000
--- a/ext/zip/config.m4
+++ /dev/null
@@ -1,39 +0,0 @@
-dnl $Id$
-dnl config.m4 for extension zziplib
-
-PHP_ARG_WITH(zip,whether to include zziplib support,
-[ --with-zip[=DIR] Include zip support (requires zziplib >= 0.10.6).
- DIR is the zziplib install directory,
- default is /usr/local.])
-
-
-if test "$PHP_ZIP" != "no"; then
- PHP_EXTENSION(zip, $ext_shared)
- for i in $PHP_ZIP /usr/local /usr ; do
- if test -f $i/include/zzlib/zziplib.h; then
- ZZIPLIB_DIR=$i
- ZZIPLIB_INCDIR=$i/include/zzlib
- elif test -f $i/include/zziplib.h; then
- ZZIPLIB_DIR=$i
- ZZIPLIB_INCDIR=$i/include
- fi
- done
-
- if test -z "$ZZIPLIB_DIR"; then
- AC_MSG_ERROR(Cannot find libzzip)
- fi
-
- ZZIPLIB_LIBDIR=$ZZIPLIB_DIR/lib
-
- PHP_TEMP_LDFLAGS(-L$ZZIPLIB_LIBDIR,[
- AC_CHECK_LIB(zzip, zzip_open, [AC_DEFINE(HAVE_ZZIPLIB,1,[ ])],
- [AC_MSG_ERROR(zziplib module requires zzlib >= 0.10.6.)])
- ])
-
- PHP_SUBST(ZIP_SHARED_LIBADD)
- PHP_ADD_LIBRARY_WITH_PATH(zzip, $ZZIPLIB_LIBDIR, ZIP_SHARED_LIBADD)
-
- PHP_ADD_INCLUDE($ZZIPLIB_INCDIR)
-
- PHP_FOPENCOOKIE
-fi
diff --git a/ext/zip/php_zip.h b/ext/zip/php_zip.h
deleted file mode 100644
index c4b46ca37b..0000000000
--- a/ext/zip/php_zip.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Sterling Hughes <sterling@php.net> |
- +----------------------------------------------------------------------+
- */
-
-#ifndef PHP_ZIP_H
-#define PHP_ZIP_H
-
-#if HAVE_ZZIPLIB
-
-#include <zziplib.h>
-
-extern zend_module_entry zip_module_entry;
-#define phpext_zip_ptr &zip_module_entry
-
-#ifdef PHP_WIN32
-#define PHP_ZZIPLIB_API __declspec(dllexport)
-#else
-#define PHP_ZZIPLIB_API
-#endif
-
-PHP_MINIT_FUNCTION(zip);
-PHP_MINFO_FUNCTION(zip);
-
-PHP_FUNCTION(zip_open);
-PHP_FUNCTION(zip_read);
-PHP_FUNCTION(zip_close);
-PHP_FUNCTION(zip_entry_name);
-PHP_FUNCTION(zip_entry_compressedsize);
-PHP_FUNCTION(zip_entry_filesize);
-PHP_FUNCTION(zip_entry_compressionmethod);
-PHP_FUNCTION(zip_entry_open);
-PHP_FUNCTION(zip_entry_read);
-PHP_FUNCTION(zip_entry_close);
-
-typedef struct {
- ZZIP_FILE *fp;
- ZZIP_DIRENT dirent;
-} php_zzip_dirent;
-
-#else
-#define phpext_zziplib_ptr NULL
-#endif
-
-#endif /* PHP_ZZIPLIB_H */
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/zip/tests/001.phpt b/ext/zip/tests/001.phpt
deleted file mode 100644
index 787ade9722..0000000000
--- a/ext/zip/tests/001.phpt
+++ /dev/null
@@ -1,23 +0,0 @@
---TEST--
-Check for zziplib presence
---SKIPIF--
-<?php if (!extension_loaded("zip")) print "skip"; ?>
---POST--
---GET--
---FILE--
-<?php
-echo "zip extension is available";
-/*
- you can add regression tests for your extension here
-
- the output of your test code has to be equal to the
- text in the --EXPECT-- section below for the tests
- to pass, differences between the output and the
- expected text are interpreted as failure
-
- see php4/tests/README for further information on
- writing regression tests
-*/
-?>
---EXPECT--
-zip extension is available
diff --git a/ext/zip/zip.c b/ext/zip/zip.c
deleted file mode 100644
index c466d82d42..0000000000
--- a/ext/zip/zip.c
+++ /dev/null
@@ -1,338 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Sterling Hughes <sterling@php.net> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#include "php.h"
-#include "php_ini.h"
-#include "php_zip.h"
-
-#if HAVE_ZZIPLIB
-
-#include "ext/standard/info.h"
-#include <zziplib.h>
-
-#ifndef O_BINARY
-#define O_BINARY 0
-#endif
-
-static int le_zip_dir;
-#define le_zip_dir_name "Zip Directory"
-static int le_zip_entry;
-#define le_zip_entry_name "Zip Entry"
-
-/* {{{ zip_functions[]
- */
-function_entry zip_functions[] = {
- PHP_FE(zip_open, NULL)
- PHP_FE(zip_read, NULL)
- PHP_FE(zip_close, NULL)
- PHP_FE(zip_entry_name, NULL)
- PHP_FE(zip_entry_compressedsize, NULL)
- PHP_FE(zip_entry_filesize, NULL)
- PHP_FE(zip_entry_compressionmethod, NULL)
- PHP_FE(zip_entry_open, NULL)
- PHP_FE(zip_entry_read, NULL)
- PHP_FE(zip_entry_close, NULL)
- {NULL, NULL, NULL}
-};
-/* }}} */
-
-/* {{{ zip_module_entry
- */
-zend_module_entry zip_module_entry = {
- "zip",
- zip_functions,
- PHP_MINIT(zip),
- NULL,
- NULL,
- NULL,
- PHP_MINFO(zip),
- STANDARD_MODULE_PROPERTIES
-};
-/* }}} */
-
-#ifdef COMPILE_DL_ZIP
-ZEND_GET_MODULE(zip)
-#endif
-
-/* {{{ php_zip_free_dir
- */
-static void php_zip_free_dir(zend_rsrc_list_entry *rsrc)
-{
- ZZIP_DIR *z_dir = (ZZIP_DIR *) rsrc->ptr;
- zzip_closedir(z_dir);
-}
-/* }}} */
-
-/* {{{ php_zip_free_entry
- */
-static void php_zip_free_entry(zend_rsrc_list_entry *rsrc)
-{
- php_zzip_dirent *entry = (php_zzip_dirent *) rsrc->ptr;
-
- if (entry->fp) {
- zzip_close(entry->fp);
- }
-
- efree(entry);
-}
-/* }}} */
-
-/* {{{ PHP_MINIT_FUNCTION
- */
-PHP_MINIT_FUNCTION(zip)
-{
- le_zip_dir = zend_register_list_destructors_ex(php_zip_free_dir, NULL, le_zip_dir_name, module_number);
- le_zip_entry = zend_register_list_destructors_ex(php_zip_free_entry, NULL, le_zip_entry_name, module_number);
-
- return(SUCCESS);
-}
-/* }}} */
-
-/* {{{ PHP_MINFO_FUNCTION
- */
-PHP_MINFO_FUNCTION(zip)
-{
- php_info_print_table_start();
- php_info_print_table_row(2, "Zip support", "enabled");
- php_info_print_table_end();
-
-}
-/* }}} */
-
-/* {{{ proto resource zip_opendir(string filename)
- Open a new zip archive for reading */
-PHP_FUNCTION(zip_open)
-{
- zval **filename;
- ZZIP_DIR *archive_p = NULL;
-
- if (ZEND_NUM_ARGS() != 1 ||
- zend_get_parameters_ex(1, &filename) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- archive_p = zzip_opendir(Z_STRVAL_PP(filename));
- if (archive_p == NULL) {
- php_error(E_WARNING, "Cannot open zip archive %s", Z_STRVAL_PP(filename));
- RETURN_FALSE;
- }
-
- ZEND_REGISTER_RESOURCE(return_value, archive_p, le_zip_dir);
-}
-/* }}} */
-
-/* {{{ proto resource zip_readdir(resource zip)
- Returns the next file in the archive */
-PHP_FUNCTION(zip_read)
-{
- zval **zzip_dp;
- ZZIP_DIR *archive_p = NULL;
- php_zzip_dirent *entry = NULL;
- int ret;
-
- if (ZEND_NUM_ARGS() != 1 ||
- zend_get_parameters_ex(1, &zzip_dp) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(archive_p, ZZIP_DIR *, zzip_dp, -1, le_zip_dir_name, le_zip_dir);
-
- entry = emalloc(sizeof(php_zzip_dirent));
-
- ret = zzip_dir_read(archive_p, &entry->dirent);
- if (ret == 0) {
- efree(entry);
- RETURN_FALSE;
- }
-
- entry->fp = NULL;
-
- ZEND_REGISTER_RESOURCE(return_value, entry, le_zip_entry);
-}
-/* }}} */
-
-/* {{{ proto void zip_closedir(resource zip)
- Close a Zip archive */
-PHP_FUNCTION(zip_close)
-{
- zval **zzip_dp;
- ZZIP_DIR *archive_p = NULL;
-
- if (ZEND_NUM_ARGS() != 1 ||
- zend_get_parameters_ex(1, &zzip_dp) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(archive_p, ZZIP_DIR *, zzip_dp, -1, le_zip_dir_name, le_zip_dir);
-
- zend_list_delete(Z_LVAL_PP(zzip_dp));
-}
-/* }}} */
-
-/* {{{ php_zzip_get_entry
- */
-static void php_zzip_get_entry(INTERNAL_FUNCTION_PARAMETERS, int opt)
-{
- zval **zzip_ent;
- php_zzip_dirent *entry = NULL;
-
- if (ZEND_NUM_ARGS() != 1 ||
- zend_get_parameters_ex(1, &zzip_ent) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(entry, php_zzip_dirent *, zzip_ent, -1, le_zip_entry_name, le_zip_entry);
-
- switch (opt) {
- case 0:
- RETURN_STRING(entry->dirent.d_name, 1);
- break;
- case 1:
- RETURN_LONG(entry->dirent.d_csize);
- break;
- case 2:
- RETURN_LONG(entry->dirent.st_size);
- break;
- case 3:
- RETURN_STRING((char *) zzip_compr_str(entry->dirent.d_compr), 1);
- break;
- }
-}
-/* }}} */
-
-/* {{{ proto string zip_entry_name(resource zip_entry)
- Return the name given a ZZip entry */
-PHP_FUNCTION(zip_entry_name)
-{
- php_zzip_get_entry(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-/* }}} */
-
-/* {{{ proto int zip_entry_compressedsize(resource zip_entry)
- Return the compressed size of a ZZip entry */
-PHP_FUNCTION(zip_entry_compressedsize)
-{
- php_zzip_get_entry(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
-}
-/* }}} */
-
-/* {{{ proto int zip_entry_filesize(resource zip_entry)
- Return the actual filesize of a ZZip entry */
-PHP_FUNCTION(zip_entry_filesize)
-{
- php_zzip_get_entry(INTERNAL_FUNCTION_PARAM_PASSTHRU, 2);
-}
-/* }}} */
-
-/* {{{ proto string zip_entry_compressionmethod(resource zip_entry)
- Return a string containing the compression method used on a particular entry */
-PHP_FUNCTION(zip_entry_compressionmethod)
-{
- php_zzip_get_entry(INTERNAL_FUNCTION_PARAM_PASSTHRU, 3);
-}
-/* }}} */
-
-/* {{{ proto bool zip_entry_open(resource zip_dp, resource zip_entry, string mode)
- Open a Zip File, pointed by the resource entry */
-PHP_FUNCTION(zip_entry_open)
-{
- zval **zzip_dp, **zzip_ent, **mode;
- ZZIP_DIR *archive_p = NULL;
- php_zzip_dirent *entry = NULL;
-
- if (ZEND_NUM_ARGS() < 2 || ZEND_NUM_ARGS() > 3 ||
- zend_get_parameters_ex(ZEND_NUM_ARGS(), &zzip_dp, &zzip_ent, &mode) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(archive_p, ZZIP_DIR *, zzip_dp, -1, le_zip_dir_name, le_zip_dir);
- ZEND_FETCH_RESOURCE(entry, php_zzip_dirent *, zzip_ent, -1, le_zip_entry_name, le_zip_entry);
-
- entry->fp = zzip_file_open(archive_p, entry->dirent.d_name, O_RDONLY | O_BINARY);
-
- if (entry->fp) {
- RETURN_TRUE;
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto string zip_read(resource zip_ent)
- Read X bytes from an opened zip entry */
-PHP_FUNCTION(zip_entry_read)
-{
- zval **zzip_ent, **length;
- php_zzip_dirent *entry = NULL;
- char *buf = NULL;
- int len = 1024,
- argc = ZEND_NUM_ARGS(),
- ret = 0;
-
- if (argc < 1 || argc > 2 ||
- zend_get_parameters_ex(argc, &zzip_ent, &length) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(entry, php_zzip_dirent *, zzip_ent, -1, le_zip_entry_name, le_zip_entry);
- if (argc > 1) {
- convert_to_long_ex(length);
- len = Z_LVAL_PP(length);
- }
-
- buf = emalloc(len + 1);
-
- ret = zzip_read(entry->fp, buf, len);
- if (ret == 0) {
- RETURN_FALSE;
- }
-
- RETURN_STRINGL(buf, len, 0);
-}
-/* }}} */
-
-/* {{{ proto void zip_close(resource zip_ent)
- Close a zip entry */
-PHP_FUNCTION(zip_entry_close)
-{
- zval **zzip_ent;
- php_zzip_dirent *entry = NULL;
-
- if (ZEND_NUM_ARGS() != 1 ||
- zend_get_parameters_ex(1, &zzip_ent) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(entry, php_zzip_dirent *, zzip_ent, -1, le_zip_entry_name, le_zip_entry);
-
- zend_list_delete(Z_LVAL_PP(zzip_ent));
-}
-/* }}} */
-
-#endif /* HAVE_ZZIPLIB */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/zlib/CREDITS b/ext/zlib/CREDITS
deleted file mode 100644
index 4972838339..0000000000
--- a/ext/zlib/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-Zlib
-Rasmus Lerdorf, Stefan Roehrich
diff --git a/ext/zlib/Makefile.in b/ext/zlib/Makefile.in
deleted file mode 100644
index bda6385578..0000000000
--- a/ext/zlib/Makefile.in
+++ /dev/null
@@ -1,7 +0,0 @@
-
-LTLIBRARY_NAME = libzlib.la
-LTLIBRARY_SOURCES = zlib.c zlib_fopen_wrapper.c
-LTLIBRARY_SHARED_NAME = zlib.la
-LTLIBRARY_SHARED_LIBADD = $(ZLIB_SHARED_LIBADD)
-
-include $(top_srcdir)/build/dynlib.mk
diff --git a/ext/zlib/config0.m4 b/ext/zlib/config0.m4
deleted file mode 100644
index 6038844b2f..0000000000
--- a/ext/zlib/config0.m4
+++ /dev/null
@@ -1,53 +0,0 @@
-dnl
-dnl $Id$
-dnl
-
-PHP_ARG_WITH(zlib-dir,if the location of ZLIB install directory is defined,
-[ --with-zlib-dir=<DIR> Define the location of zlib install directory])
-
-PHP_ARG_WITH(zlib,whether to include ZLIB support,
-[ --with-zlib[=DIR] Include zlib support (requires zlib >= 1.0.9).
- DIR is the zlib install directory.])
-
-if test "$PHP_ZLIB" != "no" -o "$PHP_ZLIB_DIR" != "no"; then
- PHP_EXTENSION(zlib, $ext_shared)
- PHP_SUBST(ZLIB_SHARED_LIBADD)
-
- if test "$PHP_ZLIB" != "yes" -a "$PHP_ZLIB" != "no"; then
- if test -f $PHP_ZLIB/include/zlib/zlib.h; then
- ZLIB_DIR=$PHP_ZLIB
- ZLIB_INCDIR=$ZLIB_DIR/include/zlib
- elif test -f $PHP_ZLIB/include/zlib.h; then
- ZLIB_DIR=$PHP_ZLIB
- ZLIB_INCDIR=$ZLIB_DIR/include
- fi
- else
- for i in /usr/local /usr $PHP_ZLIB_DIR; do
- if test -f $i/include/zlib/zlib.h; then
- ZLIB_DIR=$i
- ZLIB_INCDIR=$i/include/zlib
- elif test -f $i/include/zlib.h; then
- ZLIB_DIR=$i
- ZLIB_INCDIR=$i/include
- fi
- done
- fi
-
- if test -z "$ZLIB_DIR"; then
- AC_MSG_ERROR(Cannot find libz)
- fi
-
- PHP_ADD_LIBPATH($ZLIB_DIR/lib, ZLIB_SHARED_LIBADD)
-
- AC_CHECK_LIB(z, gzgets, [
- AC_DEFINE(HAVE_ZLIB,1,[ ])
- ],[
- AC_MSG_ERROR(ZLIB extension requires zlib >= 1.0.9)
- ])
-
- PHP_ZLIB_DIR=$ZLIB_DIR
- PHP_ADD_LIBRARY(z,, ZLIB_SHARED_LIBADD)
- PHP_ADD_INCLUDE($ZLIB_INCDIR)
-
- PHP_FOPENCOOKIE
-fi
diff --git a/ext/zlib/php_zlib.h b/ext/zlib/php_zlib.h
deleted file mode 100644
index 11884c7883..0000000000
--- a/ext/zlib/php_zlib.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
- | Stefan Röhrich <sr@linux.de> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef PHP_ZLIB_H
-#define PHP_ZLIB_H
-
-#include <zlib.h>
-
-
-typedef struct {
- int gzgetss_state;
-
- /* variables for transparent gzip encoding */
- int compression_coding;
- z_stream stream;
- uLong crc;
- int ob_gzhandler_status;
- int ob_gzip_coding;
- int output_compression;
-} php_zlib_globals;
-
-extern zend_module_entry php_zlib_module_entry;
-#define zlib_module_ptr &php_zlib_module_entry
-
-PHP_MINIT_FUNCTION(zlib);
-PHP_MSHUTDOWN_FUNCTION(zlib);
-PHP_RINIT_FUNCTION(zlib);
-PHP_MINFO_FUNCTION(zlib);
-PHP_FUNCTION(gzopen);
-PHP_FUNCTION(gzclose);
-PHP_FUNCTION(gzeof);
-PHP_FUNCTION(gzread);
-PHP_FUNCTION(gzgetc);
-PHP_FUNCTION(gzgets);
-PHP_FUNCTION(gzgetss);
-PHP_FUNCTION(gzwrite);
-PHP_FUNCTION(gzrewind);
-PHP_FUNCTION(gztell);
-PHP_FUNCTION(gzseek);
-PHP_FUNCTION(gzpassthru);
-PHP_FUNCTION(readgzfile);
-PHP_FUNCTION(gzfile);
-PHP_FUNCTION(gzcompress);
-PHP_FUNCTION(gzuncompress);
-PHP_FUNCTION(gzdeflate);
-PHP_FUNCTION(gzinflate);
-PHP_FUNCTION(gzencode);
-PHP_FUNCTION(ob_gzhandler);
-
-FILE *zlib_fopen_wrapper(char *path, char *mode, int options, int *issock, int *socketd, char **opened_path);
-int php_enable_output_compression(int buffer_size);
-
-
-#ifdef ZTS
-#define ZLIBLS_D php_zlib_globals *zlib_globals
-#define ZLIBLS_DC , ZLIBLS_D
-#define ZLIBLS_C zlib_globals
-#define ZLIBLS_CC , ZLIBLS_C
-#define ZLIBG(v) (zlib_globals->v)
-#define ZLIBLS_FETCH() php_zlib_globals *zlib_globals = ts_resource(zlib_globals_id)
-#else
-#define ZLIBLS_D
-#define ZLIBLS_DC
-#define ZLIBLS_C
-#define ZLIBLS_CC
-#define ZLIBG(v) (zlib_globals.v)
-#define ZLIBLS_FETCH()
-#endif
-
-#define phpext_zlib_ptr zlib_module_ptr
-
-#endif /* PHP_ZLIB_H */
diff --git a/ext/zlib/setup.stub b/ext/zlib/setup.stub
deleted file mode 100644
index 158978766c..0000000000
--- a/ext/zlib/setup.stub
+++ /dev/null
@@ -1,7 +0,0 @@
-# $Source$
-# $Id$
-
-define_option with-zlib 'zlib (>= 1.0.9) support? ' yesnodir \
- 'no /usr zlib install' \
-' Whether to use the zlib support to read/write .gz-files.\n
- Requires zlib version >= 1.0.9!'
diff --git a/ext/zlib/zlib.c b/ext/zlib/zlib.c
deleted file mode 100644
index 6f501769e0..0000000000
--- a/ext/zlib/zlib.c
+++ /dev/null
@@ -1,1288 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
- | Stefan Röhrich <sr@linux.de> |
- +----------------------------------------------------------------------+
- */
-/* $Id$ */
-#define IS_EXT_MODULE
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "SAPI.h"
-#include "php_ini.h"
-
-#include <stdlib.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#ifdef PHP_WIN32
-#include <windows.h>
-#include <winsock.h>
-#define O_RDONLY _O_RDONLY
-#include "win32/param.h"
-#else
-#include <sys/param.h>
-/* #include <sys/uio.h> */
-#endif
-#include "ext/standard/head.h"
-#include "safe_mode.h"
-#include "ext/standard/php_standard.h"
-#include "ext/standard/info.h"
-#include "php_zlib.h"
-#include "fopen_wrappers.h"
-#if HAVE_PWD_H
-#ifdef PHP_WIN32
-#include "win32/pwd.h"
-#else
-#include <pwd.h>
-#endif
-#endif
-#if defined(HAVE_UNISTD_H) && defined(PHP_WIN32)
-#undef HAVE_UNISTD_H
-#endif
-
-
-#ifdef COMPILE_DL_ZLIB
-#ifndef PUTS
-#define PUTS(a) php_printf("%s",a)
-#endif
-#ifndef PUTC
-#define PUTC(a) PUTS(a)
-#endif
-#ifndef PHPWRITE
-#define PHPWRITE(a,n) php_write((a),(n))
-#endif
-#endif
-
-#ifdef ZTS
-int zlib_globals_id;
-#else
-static php_zlib_globals zlib_globals;
-#endif
-
-#define OS_CODE 0x03 /* FIXME */
-#define CODING_GZIP 1
-#define CODING_DEFLATE 2
-
-/* True globals, no need for thread safety */
-static int le_zp;
-static int gz_magic[2] = {0x1f, 0x8b}; /* gzip magic header */
-
-/* {{{ php_zlib_functions[]
- */
-function_entry php_zlib_functions[] = {
- PHP_FE(readgzfile, NULL)
- PHP_FE(gzrewind, NULL)
- PHP_FE(gzclose, NULL)
- PHP_FE(gzeof, NULL)
- PHP_FE(gzgetc, NULL)
- PHP_FE(gzgets, NULL)
- PHP_FE(gzgetss, NULL)
- PHP_FE(gzread, NULL)
- PHP_FE(gzopen, NULL)
- PHP_FE(gzpassthru, NULL)
- PHP_FE(gzseek, NULL)
- PHP_FE(gztell, NULL)
- PHP_FE(gzwrite, NULL)
- PHP_FALIAS(gzputs, gzwrite, NULL)
- PHP_FE(gzfile, NULL)
- PHP_FE(gzcompress, NULL)
- PHP_FE(gzuncompress, NULL)
- PHP_FE(gzdeflate, NULL)
- PHP_FE(gzinflate, NULL)
- PHP_FE(gzencode, NULL)
- PHP_FE(ob_gzhandler, NULL)
- {NULL, NULL, NULL}
-};
-/* }}} */
-
-PHP_INI_BEGIN()
- STD_PHP_INI_BOOLEAN("zlib.output_compression", "0", PHP_INI_ALL, OnUpdateInt, output_compression, php_zlib_globals, zlib_globals)
-PHP_INI_END()
-
-/* {{{ php_zlib_module_entry
- */
-zend_module_entry php_zlib_module_entry = {
- "zlib",
- php_zlib_functions,
- PHP_MINIT(zlib),
- PHP_MSHUTDOWN(zlib),
- PHP_RINIT(zlib),
- NULL,
- PHP_MINFO(zlib),
- STANDARD_MODULE_PROPERTIES
-};
-/* }}} */
-
-#ifdef COMPILE_DL_ZLIB
-ZEND_GET_MODULE(php_zlib)
-#endif
-
-/* {{{ phpi_destructor_gzclose
- */
-static void phpi_destructor_gzclose(zend_rsrc_list_entry *rsrc)
-{
- gzFile *zp = (gzFile *)rsrc->ptr;
- (void)gzclose(zp);
-}
-/* }}} */
-
-#ifdef ZTS
-/* {{{ php_zlib_init_globals
- */
-static void php_zlib_init_globals(ZLIBLS_D)
-{
- ZLIBG(gzgetss_state) = 0;
-}
-/* }}} */
-#endif
-
-/* {{{ PHP_MINIT_FUNCTION
- */
-PHP_MINIT_FUNCTION(zlib)
-{
- PLS_FETCH();
-
-#ifdef ZTS
- zlib_globals_id = ts_allocate_id(sizeof(php_zlib_globals), (ts_allocate_ctor) php_zlib_init_globals, NULL);
-#else
- ZLIBG(gzgetss_state)=0;
-#endif
- le_zp = zend_register_list_destructors_ex(phpi_destructor_gzclose, NULL, "zlib", module_number);
-
-#if HAVE_FOPENCOOKIE
-
- if(PG(allow_url_fopen)) {
- php_register_url_wrapper("zlib",zlib_fopen_wrapper);
- }
-#endif
-
- REGISTER_LONG_CONSTANT("FORCE_GZIP", CODING_GZIP, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FORCE_DEFLATE", CODING_DEFLATE, CONST_CS | CONST_PERSISTENT);
-
- REGISTER_INI_ENTRIES();
-
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_RINIT_FUNCTION
- */
-PHP_RINIT_FUNCTION(zlib)
-{
- ZLIBLS_FETCH();
-
- ZLIBG(ob_gzhandler_status) = 0;
- switch (ZLIBG(output_compression)) {
- case 0:
- break;
- case 1:
- php_enable_output_compression(4096);
- break;
- default:
- php_enable_output_compression(ZLIBG(output_compression));
- }
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_MSHUTDOWN_FUNCTION
- */
-PHP_MSHUTDOWN_FUNCTION(zlib)
-{
-#if HAVE_FOPENCOOKIE
- PLS_FETCH();
-
- if(PG(allow_url_fopen)) {
- php_unregister_url_wrapper("zlib");
- }
-#endif
-
- UNREGISTER_INI_ENTRIES();
-
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_MINFO_FUNCTION
- */
-PHP_MINFO_FUNCTION(zlib)
-{
- php_info_print_table_start();
- php_info_print_table_row(2, "ZLib Support", "enabled");
-#if HAVE_FOPENCOOKIE
- php_info_print_table_row(2, "'zlib:' fopen wrapper", "enabled");
-#endif
- php_info_print_table_row(2, "Compiled Version", ZLIB_VERSION );
- php_info_print_table_row(2, "Linked Version", (char *)zlibVersion() );
- php_info_print_table_end();
-}
-/* }}} */
-
-/* {{{ php_gzopen_wrapper
- */
-static gzFile php_gzopen_wrapper(char *path, char *mode, int options)
-{
- FILE *f;
- int issock=0, socketd=0;
-
- f = php_fopen_wrapper(path, mode, options, &issock, &socketd, NULL);
-
- if (!f) {
- return NULL;
- }
- return gzdopen(fileno(f), mode);
-}
-/* }}} */
-
-/* {{{ proto array gzfile(string filename [, int use_include_path])
- Read und uncompress entire .gz-file into an array */
-PHP_FUNCTION(gzfile)
-{
- pval **filename, **arg2;
- gzFile zp;
- char *slashed, buf[8192];
- register int i=0;
- int use_include_path = 0;
- PLS_FETCH();
-
- /* check args */
- switch (ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1,&filename) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- break;
- case 2:
- if (zend_get_parameters_ex(2,&filename,&arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(arg2);
- use_include_path = (*arg2)->value.lval?USE_PATH:0;
- break;
- default:
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(filename);
-
- zp = php_gzopen_wrapper((*filename)->value.str.val,"r", use_include_path|ENFORCE_SAFE_MODE);
- if (!zp) {
- php_error(E_WARNING,"gzFile(\"%s\") - %s",(*filename)->value.str.val,strerror(errno));
- RETURN_FALSE;
- }
-
- /* Initialize return array */
- if (array_init(return_value) == FAILURE) {
- RETURN_FALSE;
- }
-
- /* Now loop through the file and do the magic quotes thing if needed */
- memset(buf,0,8191);
- while(gzgets(zp, buf, 8191) != NULL) {
- if (PG(magic_quotes_runtime)) {
- int len;
-
- slashed = php_addslashes(buf,0,&len,0); /* 0 = don't free source string */
- add_index_stringl(return_value, i++, slashed, len, 0);
- } else {
- add_index_string(return_value, i++, buf, 1);
- }
- }
- gzclose(zp);
-}
-/* }}} */
-
-/* {{{ proto int gzopen(string filename, string mode [, int use_include_path])
- Open a .gz-file and return a .gz-file pointer */
-PHP_FUNCTION(gzopen)
-{
- pval **arg1, **arg2, **arg3;
- gzFile *zp;
- char *p;
- int use_include_path = 0;
- ZLIBLS_FETCH();
-
- switch(ZEND_NUM_ARGS()) {
- case 2:
- if (zend_get_parameters_ex(2,&arg1,&arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- break;
- case 3:
- if (zend_get_parameters_ex(3,&arg1,&arg2,&arg3) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(arg3);
- use_include_path = (*arg3)->value.lval?USE_PATH:0;
- break;
- default:
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(arg1);
- convert_to_string_ex(arg2);
- p = estrndup((*arg2)->value.str.val,(*arg2)->value.str.len);
-
- /*
- * We need a better way of returning error messages from
- * php_gzopen_wrapper().
- */
- zp = php_gzopen_wrapper((*arg1)->value.str.val, p, use_include_path|ENFORCE_SAFE_MODE);
- if (!zp) {
- php_error(E_WARNING,"gzopen(\"%s\",\"%s\") - %s",
- (*arg1)->value.str.val, p, strerror(errno));
- efree(p);
- RETURN_FALSE;
- }
- ZLIBG(gzgetss_state)=0;
- efree(p);
- ZEND_REGISTER_RESOURCE(return_value, zp, le_zp);
-}
-/* }}} */
-
-/* {{{ proto int gzclose(int zp)
- Close an open .gz-file pointer */
-PHP_FUNCTION(gzclose)
-{
- pval **arg1;
- gzFile *zp;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- ZEND_FETCH_RESOURCE(zp, gzFile *, arg1, -1, "Zlib file", le_zp);
- zend_list_delete((*arg1)->value.lval);
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int gzeof(int zp)
- Test for end-of-file on a .gz-file pointer */
-PHP_FUNCTION(gzeof)
-{
- pval **arg1;
- gzFile *zp;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- ZEND_FETCH_RESOURCE(zp, gzFile *, arg1, -1, "Zlib file", le_zp);
-
- if ((gzeof(zp))) {
- RETURN_TRUE;
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto string gzgets(int zp, int length)
- Get a line from .gz-file pointer */
-PHP_FUNCTION(gzgets)
-{
- pval **arg1, **arg2;
- gzFile *zp;
- int len;
- char *buf;
- PLS_FETCH();
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(arg2);
- len = (*arg2)->value.lval;
-
- ZEND_FETCH_RESOURCE(zp, gzFile *, arg1, -1, "Zlib file", le_zp);
-
- buf = emalloc(sizeof(char) * (len + 1));
- /* needed because recv doesnt put a null at the end*/
- memset(buf,0,len+1);
- if (!(gzgets(zp, buf, len) != NULL)) {
- efree(buf);
- RETVAL_FALSE;
- } else {
- if (PG(magic_quotes_runtime)) {
- return_value->value.str.val = php_addslashes(buf,0,&return_value->value.str.len,1);
- } else {
- return_value->value.str.val = buf;
- return_value->value.str.len = strlen(return_value->value.str.val);
- }
- return_value->type = IS_STRING;
- }
- return;
-}
-/* }}} */
-
-/* {{{ proto string gzgetc(int zp)
- Get a character from .gz-file pointer */
-PHP_FUNCTION(gzgetc)
-{
- pval **arg1;
- gzFile *zp;
- int c;
- char *buf;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(zp, gzFile *, arg1, -1, "Zlib file", le_zp);
-
- buf = emalloc(sizeof(char) * 2);
- if ((c=gzgetc(zp)) == (-1)) {
- efree(buf);
- RETVAL_FALSE;
- } else {
- buf[0]=(char)c;
- buf[1]='\0';
- return_value->value.str.val = buf;
- return_value->value.str.len = 1;
- return_value->type = IS_STRING;
- }
- return;
-}
-/* }}} */
-
-/* Strip any HTML tags while reading */
-/* {{{ proto string gzgetss(int zp, int length [, string allowable_tags])
- Get a line from file pointer and strip HTML tags */
-PHP_FUNCTION(gzgetss)
-{
- pval **fd, **bytes, **allow=NULL;
- gzFile *zp;
- int len;
- char *buf;
- char *allowed_tags=NULL;
- int allowed_tags_len=0;
- ZLIBLS_FETCH();
-
- switch(ZEND_NUM_ARGS()) {
- case 2:
- if(zend_get_parameters_ex(2, &fd, &bytes) == FAILURE) {
- RETURN_FALSE;
- }
- break;
- case 3:
- if(zend_get_parameters_ex(3, &fd, &bytes, &allow) == FAILURE) {
- RETURN_FALSE;
- }
- convert_to_string_ex(allow);
- allowed_tags = (*allow)->value.str.val;
- allowed_tags_len = (*allow)->value.str.len;
- break;
- default:
- WRONG_PARAM_COUNT;
- /* NOTREACHED */
- break;
- }
-
- convert_to_long_ex(bytes);
-
- len = (*bytes)->value.lval;
-
- ZEND_FETCH_RESOURCE(zp, gzFile *, fd, -1, "Zlib file", le_zp);
-
- buf = emalloc(sizeof(char) * (len + 1));
- /*needed because recv doesnt set null char at end*/
- memset(buf,0,len+1);
- if (!(gzgets(zp, buf, len) != NULL)) {
- efree(buf);
- RETURN_FALSE;
- }
-
- /* strlen() can be used here since we are doing it on the return of an fgets() anyway */
- php_strip_tags(buf, strlen(buf), ZLIBG(gzgetss_state), allowed_tags, allowed_tags_len);
- RETURN_STRING(buf, 0);
-
-}
-/* }}} */
-
-/* {{{ proto int gzwrite(int zp, string str [, int length])
- Binary-safe .gz-file write */
-PHP_FUNCTION(gzwrite)
-{
- pval **arg1, **arg2, **arg3=NULL;
- gzFile *zp;
- int ret;
- int num_bytes;
- PLS_FETCH();
-
- switch (ZEND_NUM_ARGS()) {
- case 2:
- if (zend_get_parameters_ex(2, &arg1, &arg2)==FAILURE) {
- RETURN_FALSE;
- }
- convert_to_string_ex(arg2);
- num_bytes = (*arg2)->value.str.len;
- break;
- case 3:
- if (zend_get_parameters_ex(3, &arg1, &arg2, &arg3)==FAILURE) {
- RETURN_FALSE;
- }
- convert_to_string_ex(arg2);
- convert_to_long_ex(arg3);
- num_bytes = MIN((*arg3)->value.lval, (*arg2)->value.str.len);
- break;
- default:
- WRONG_PARAM_COUNT;
- /* NOTREACHED */
- break;
- }
- ZEND_FETCH_RESOURCE(zp, gzFile *, arg1, -1, "Zlib file", le_zp);
-
- /* strip slashes only if the length wasn't specified explicitly */
- if (!arg3 && PG(magic_quotes_runtime)) {
- php_stripslashes((*arg2)->value.str.val,&num_bytes);
- }
-
- ret = gzwrite(zp, (*arg2)->value.str.val,num_bytes);
- RETURN_LONG(ret);
-}
-/* }}} */
-
-/* {{{ proto int gzputs(int zp, string str [, int length])
- An alias for gzwrite */
-/* }}} */
-
-/* {{{ proto int gzrewind(int zp)
- Rewind the position of a .gz-file pointer */
-PHP_FUNCTION(gzrewind)
-{
- pval **arg1;
- gzFile *zp;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(zp, gzFile *, arg1, -1, "Zlib file", le_zp);
-
- gzrewind(zp);
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int gztell(int zp)
- Get .gz-file pointer's read/write position */
-PHP_FUNCTION(gztell)
-{
- pval **arg1;
- long pos;
- gzFile *zp;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(zp, gzFile *, arg1, -1, "Zlib file", le_zp);
-
- pos = gztell(zp);
- RETURN_LONG(pos);
-}
-/* }}} */
-
-/* {{{ proto int gzseek(int zp, int offset)
- Seek on a file pointer */
-PHP_FUNCTION(gzseek)
-{
- pval **arg1, **arg2;
- int ret;
- gzFile *zp;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(arg2);
-
- ZEND_FETCH_RESOURCE(zp, gzFile *, arg1, -1, "Zlib file", le_zp);
-
- ret = gzseek(zp, (*arg2)->value.lval, SEEK_SET);
- RETURN_LONG(ret);
-}
-/* }}} */
-
-/*
- * Read a file and write the ouput to stdout
- */
-/* {{{ proto int readgzfile(string filename [, int use_include_path])
- Output a .gz-file */
-PHP_FUNCTION(readgzfile)
-{
- pval **arg1, **arg2;
- char buf[8192];
- gzFile *zp;
- int b, size;
- int use_include_path = 0;
-
-
- /* check args */
- switch (ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1,&arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- break;
- case 2:
- if (zend_get_parameters_ex(2,&arg1,&arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(arg2);
- use_include_path = (*arg2)->value.lval?USE_PATH:0;
- break;
- default:
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(arg1);
-
- /*
- * We need a better way of returning error messages from
- * php_gzopen_wrapper().
- */
- zp = php_gzopen_wrapper((*arg1)->value.str.val,"r", use_include_path|ENFORCE_SAFE_MODE);
- if (!zp){
- php_error(E_WARNING,"ReadGzFile(\"%s\") - %s",(*arg1)->value.str.val,strerror(errno));
- RETURN_FALSE;
- }
- size= 0;
- while((b = gzread(zp, buf, sizeof(buf))) > 0) {
- PHPWRITE(buf,b);
- size += b ;
- }
- gzclose(zp);
- RETURN_LONG(size);
-}
-/* }}} */
-
-/*
- * Read to EOF on a file descriptor and write the output to stdout.
- */
-/* {{{ proto int gzpassthru(int zp)
- Output all remaining data from a .gz-file pointer */
-PHP_FUNCTION(gzpassthru)
-{
- pval **arg1;
- gzFile *zp;
- char buf[8192];
- int size, b;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(zp, gzFile *, arg1, -1, "Zlib file", le_zp);
-
- size = 0;
- while((b = gzread(zp, buf, sizeof(buf))) > 0) {
- PHPWRITE(buf,b);
- size += b ;
- }
-/* gzclose(zp); */
- zend_list_delete((*arg1)->value.lval);
- RETURN_LONG(size);
-}
-/* }}} */
-
-/* {{{ proto string gzread(int zp, int length)
- Binary-safe file read */
-PHP_FUNCTION(gzread)
-{
- pval **arg1, **arg2;
- gzFile *zp;
- int len;
- PLS_FETCH();
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(arg2);
- len = (*arg2)->value.lval;
-
- ZEND_FETCH_RESOURCE(zp, gzFile *, arg1, -1, "Zlib file", le_zp);
-
- return_value->value.str.val = emalloc(sizeof(char) * (len + 1));
- /* needed because recv doesnt put a null at the end*/
-
- return_value->value.str.len = gzread(zp, return_value->value.str.val, len);
- return_value->value.str.val[return_value->value.str.len] = 0;
-
- if (PG(magic_quotes_runtime)) {
- return_value->value.str.val = php_addslashes(return_value->value.str.val,return_value->value.str.len,&return_value->value.str.len,1);
- }
- return_value->type = IS_STRING;
-}
-
-/* }}} */
-
-
-/* {{{ proto string gzcompress(string data [, int level])
- Gzip-compress a string */
-PHP_FUNCTION(gzcompress)
-{
- zval **data, **zlimit = NULL;
- int limit,status;
- unsigned long l2;
- char *s2;
-
- switch (ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &data) == FAILURE)
- WRONG_PARAM_COUNT;
- limit=-1;
- break;
- case 2:
- if (zend_get_parameters_ex(2, &data, &zlimit) == FAILURE)
- WRONG_PARAM_COUNT;
- convert_to_long_ex(zlimit);
- limit = (*zlimit)->value.lval;
- if((limit<0)||(limit>9)) {
- php_error(E_WARNING,"gzcompress: compression level must be whithin 0..9");
- RETURN_FALSE;
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(data);
-
- l2 = (*data)->value.str.len + ((*data)->value.str.len/1000) + 15;
- s2 = (char *) emalloc(l2);
- if(! s2) RETURN_FALSE;
-
- if(limit>=0) {
- status = compress2(s2,&l2,(*data)->value.str.val, (*data)->value.str.len,limit);
- } else {
- status = compress(s2,&l2,(*data)->value.str.val, (*data)->value.str.len);
- }
-
- if(status==Z_OK) {
- RETURN_STRINGL(s2, l2, 0);
- } else {
- efree(s2);
- php_error(E_WARNING,"gzcompress: %s",zError(status));
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto string gzuncompress(string data, int length)
- Unzip a gzip-compressed string */
-PHP_FUNCTION(gzuncompress)
-{
- zval **data, **zlimit = NULL;
- int status,factor=1,maxfactor=8;
- unsigned long plength=0,length;
- char *s1=NULL,*s2=NULL;
-
- switch (ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &data) == FAILURE)
- WRONG_PARAM_COUNT;
- length=0;
- break;
- case 2:
- if (zend_get_parameters_ex(2, &data, &zlimit) == FAILURE)
- WRONG_PARAM_COUNT;
- convert_to_long_ex(zlimit);
- if((*zlimit)->value.lval<=0) {
- php_error(E_WARNING,"gzuncompress: length must be greater zero");
- RETURN_FALSE;
- }
- plength = (*zlimit)->value.lval;
- break;
- default:
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(data);
-
- /*
- zlib::uncompress() wants to know the output data length
- if none was given as a parameter
- we try from input length * 2 up to input length * 2^8
- doubling it whenever it wasn't big enough
- that should be eneugh for all real life cases
- */
- do {
- length=plength?plength:(*data)->value.str.len*(1<<factor++);
- s2 = (char *) erealloc(s1,length);
- if(! s2) { if(s1) efree(s1); RETURN_FALSE; }
- status = uncompress(s2, &length ,(*data)->value.str.val, (*data)->value.str.len);
- s1=s2;
- } while((status==Z_BUF_ERROR)&&(!plength)&&(factor<maxfactor));
-
- if(status==Z_OK) {
- s2 = erealloc(s2, length);
- RETURN_STRINGL(s2, length, 0);
- } else {
- efree(s2);
- php_error(E_WARNING,"gzuncompress: %s",zError(status));
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto string gzdeflate(string data [, int level])
- Gzip-compress a string */
-PHP_FUNCTION(gzdeflate)
-{
- zval **data, **zlimit = NULL;
- int level,status;
- z_stream stream;
- char *s2;
-
- switch (ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &data) == FAILURE)
- WRONG_PARAM_COUNT;
- level=Z_DEFAULT_COMPRESSION;
- break;
- case 2:
- if (zend_get_parameters_ex(2, &data, &zlimit) == FAILURE)
- WRONG_PARAM_COUNT;
- convert_to_long_ex(zlimit);
- level = (*zlimit)->value.lval;
- if((level<0)||(level>9)) {
- php_error(E_WARNING,"gzdeflate: compression level must be whithin 0..9");
- RETURN_FALSE;
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(data);
-
- stream.data_type = Z_ASCII;
- stream.zalloc = (alloc_func) Z_NULL;
- stream.zfree = (free_func) Z_NULL;
- stream.opaque = (voidpf) Z_NULL;
-
- stream.next_in = (Bytef*) (*data)->value.str.val;
- stream.avail_in = (*data)->value.str.len;
-
- stream.avail_out = stream.avail_in + (stream.avail_in/1000) + 15;
- s2 = (char *) emalloc(stream.avail_out);
- if(!s2) RETURN_FALSE;
- stream.next_out = s2;
-
- /* init with -MAX_WBITS disables the zlib internal headers */
- status = deflateInit2(&stream, level, Z_DEFLATED, -MAX_WBITS, MAX_MEM_LEVEL, 0);
- if (status == Z_OK) {
-
- status = deflate(&stream, Z_FINISH);
- if (status != Z_STREAM_END) {
- deflateEnd(&stream);
- if (status == Z_OK) {
- status = Z_BUF_ERROR;
- }
- } else {
- status = deflateEnd(&stream);
- }
- }
-
- if(status==Z_OK) {
- RETURN_STRINGL(s2, stream.total_out, 0);
- } else {
- efree(s2);
- php_error(E_WARNING,"gzdeflate: %s",zError(status));
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto string gzinflate(string data, int length)
- Unzip a gzip-compressed string */
-PHP_FUNCTION(gzinflate)
-{
- zval **data, **zlimit = NULL;
- int status,factor=1,maxfactor=8;
- unsigned long plength=0,length;
- char *s1=NULL,*s2=NULL;
- z_stream stream;
-
- switch (ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &data) == FAILURE)
- WRONG_PARAM_COUNT;
- length=0;
- break;
- case 2:
- if (zend_get_parameters_ex(2, &data, &zlimit) == FAILURE)
- WRONG_PARAM_COUNT;
- convert_to_long_ex(zlimit);
- if((*zlimit)->value.lval<=0) {
- php_error(E_WARNING,"gzinflate: length must be greater zero");
- RETURN_FALSE;
- }
- plength = (*zlimit)->value.lval;
- break;
- default:
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(data);
-
- /*
- stream.avail_out wants to know the output data length
- if none was given as a parameter
- we try from input length * 2 up to input length * 2^8
- doubling it whenever it wasn't big enough
- that should be enaugh for all real life cases
- */
- stream.zalloc = (alloc_func) Z_NULL;
- stream.zfree = (free_func) Z_NULL;
-
- do {
- length=plength?plength:(*data)->value.str.len*(1<<factor++);
- s2 = (char *) erealloc(s1,length);
- if(! s2) { if(s1) efree(s1); RETURN_FALSE; }
-
- stream.next_in = (Bytef*) (*data)->value.str.val;
- stream.avail_in = (uInt) (*data)->value.str.len;
-
- stream.next_out = s2;
- stream.avail_out = (uInt) length;
-
- /* init with -MAX_WBITS disables the zlib internal headers */
- status = inflateInit2(&stream, -MAX_WBITS);
- if (status == Z_OK) {
- status = inflate(&stream, Z_FINISH);
- if (status != Z_STREAM_END) {
- inflateEnd(&stream);
- if (status == Z_OK) {
- status = Z_BUF_ERROR;
- }
- } else {
- status = inflateEnd(&stream);
- }
- }
- s1=s2;
-
- } while((status==Z_BUF_ERROR)&&(!plength)&&(factor<maxfactor));
-
- if(status==Z_OK) {
- s2 = erealloc(s2, stream.total_out);
- RETURN_STRINGL(s2, stream.total_out, 0);
- } else {
- efree(s2);
- php_error(E_WARNING,"gzinflate: %s",zError(status));
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ php_do_deflate
- */
-static int php_do_deflate(uint str_length, Bytef **p_buffer, uint *p_buffer_len, zend_bool do_start, zend_bool do_end ZLIBLS_DC)
-{
- Bytef *buffer;
- uInt prev_outlen, outlen;
- int err;
- int start_offset = (do_start?10:0);
- int end_offset = (do_end?8:0);
-
- outlen = sizeof(char) * (str_length * 1.001 + 12);
- if ((outlen+start_offset+end_offset) > *p_buffer_len) {
- buffer = (Bytef *) emalloc(outlen+start_offset+end_offset);
- } else {
- buffer = *p_buffer;
- }
-
- ZLIBG(stream).next_out = buffer+start_offset;
- ZLIBG(stream).avail_out = outlen;
-
-
- err = deflate(&ZLIBG(stream), Z_SYNC_FLUSH);
- while (err == Z_OK && !ZLIBG(stream).avail_out) {
- prev_outlen = outlen;
- outlen *= 3;
- if ((outlen+start_offset+end_offset) > *p_buffer_len) {
- buffer = realloc(buffer, outlen+start_offset+end_offset);
- }
-
- ZLIBG(stream).next_out = buffer+start_offset + prev_outlen;
- ZLIBG(stream).avail_out = prev_outlen * 2;
-
- err = deflate(&ZLIBG(stream), Z_SYNC_FLUSH);
- }
-
- if (do_end) {
- err = deflate(&ZLIBG(stream), Z_FINISH);
- }
-
-
- *p_buffer = buffer;
- *p_buffer_len = outlen - ZLIBG(stream).avail_out;
-
- return err;
-}
-/* }}} */
-
-/* {{{ php_deflate_string
- */
-int php_deflate_string(const char *str, uint str_length, char **newstr, uint *new_length, int coding, zend_bool do_start, zend_bool do_end)
-{
- int err;
- ZLIBLS_FETCH();
-
- ZLIBG(compression_coding) = coding;
-
- if (do_start) {
- ZLIBG(stream).zalloc = Z_NULL;
- ZLIBG(stream).zfree = Z_NULL;
- ZLIBG(stream).opaque = Z_NULL;
- switch (coding) {
- case CODING_GZIP:
- /* windowBits is passed < 0 to suppress zlib header & trailer */
- if (deflateInit2(&ZLIBG(stream), Z_DEFAULT_COMPRESSION, Z_DEFLATED,
- -MAX_WBITS, MAX_MEM_LEVEL, Z_DEFAULT_STRATEGY)
- != Z_OK) {
- /* TODO: print out error */
- return FAILURE;
- }
-
- ZLIBG(crc) = crc32(0L, Z_NULL, 0);
- break;
- case CODING_DEFLATE:
- if (deflateInit(&ZLIBG(stream), Z_DEFAULT_COMPRESSION) != Z_OK) {
- /* TODO: print out error */
- return FAILURE;
- }
- break;
- }
- }
-
-
- ZLIBG(stream).next_in = (Bytef*) str;
- ZLIBG(stream).avail_in = (uInt) str_length;
-
- if (ZLIBG(compression_coding) == 1) {
- ZLIBG(crc) = crc32(ZLIBG(crc), (const Bytef *) str, str_length);
- }
-
- err = php_do_deflate(str_length, (Bytef **) newstr, new_length, do_start, do_end ZLIBLS_CC);
- /* TODO: error handling (err may be Z_STREAM_ERROR, Z_BUF_ERROR, ?) */
-
- if (do_start) {
- /* Write a very simple .gz header: */
- (*newstr)[0] = gz_magic[0];
- (*newstr)[1] = gz_magic[1];
- (*newstr)[2] = Z_DEFLATED;
- (*newstr)[3] = (*newstr)[4] = (*newstr)[5] = (*newstr)[6] = (*newstr)[7] = (*newstr)[8] = 0;
- (*newstr)[9] = OS_CODE;
- *new_length += 10;
- }
- if (do_end) {
- if (ZLIBG(compression_coding) == 1) {
- char *trailer = (*newstr)+(*new_length);
-
- /* write crc & stream.total_in in LSB order */
- trailer[0] = (char) ZLIBG(crc) & 0xFF;
- trailer[1] = (char) (ZLIBG(crc) >> 8) & 0xFF;
- trailer[2] = (char) (ZLIBG(crc) >> 16) & 0xFF;
- trailer[3] = (char) (ZLIBG(crc) >> 24) & 0xFF;
- trailer[4] = (char) ZLIBG(stream).total_in & 0xFF;
- trailer[5] = (char) (ZLIBG(stream).total_in >> 8) & 0xFF;
- trailer[6] = (char) (ZLIBG(stream).total_in >> 16) & 0xFF;
- trailer[7] = (char) (ZLIBG(stream).total_in >> 24) & 0xFF;
- *new_length += 8;
- }
- deflateEnd(&ZLIBG(stream));
- }
-
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ proto string gzencode(string data [, int encoding_mode])
- GZ encode a string */
-PHP_FUNCTION(gzencode)
-{
- zval **zv_coding, **zv_string;
- int coding;
-
- switch(ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &zv_string)==FAILURE) {
- RETURN_FALSE;
- }
- convert_to_string_ex(zv_string);
- coding = 1;
- break;
- case 2:
- if (zend_get_parameters_ex(2, &zv_string, &zv_coding)==FAILURE) {
- RETURN_FALSE;
- }
- convert_to_string_ex(zv_string);
- convert_to_long_ex(zv_coding);
- coding = Z_LVAL_PP(zv_coding);
- break;
- default:
- ZEND_WRONG_PARAM_COUNT();
- break;
- }
- if (php_deflate_string(Z_STRVAL_PP(zv_string), Z_STRLEN_PP(zv_string), &Z_STRVAL_P(return_value), &Z_STRLEN_P(return_value), coding, 1, 1)==SUCCESS) {
- Z_TYPE_P(return_value) = IS_STRING;
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto string ob_gzhandler(string str, int mode)
- Encode str based on accept-encoding setting - designed to be called from ob_start() */
-PHP_FUNCTION(ob_gzhandler)
-{
- int coding;
- zval **zv_string, **zv_mode;
- zval **data, **a_encoding;
- zend_bool return_original=0;
- zend_bool do_start, do_end;
- ZLIBLS_FETCH();
-
- if (ZEND_NUM_ARGS()!=2 || zend_get_parameters_ex(2, &zv_string, &zv_mode)==FAILURE) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
- if (ZLIBG(ob_gzhandler_status)==-1
- || zend_hash_find(&EG(symbol_table), "HTTP_SERVER_VARS", sizeof("HTTP_SERVER_VARS"), (void **) &data)==FAILURE
- || Z_TYPE_PP(data)!=IS_ARRAY
- || zend_hash_find(Z_ARRVAL_PP(data), "HTTP_ACCEPT_ENCODING", sizeof("HTTP_ACCEPT_ENCODING"), (void **) &a_encoding)==FAILURE) {
- /* return the original string */
- *return_value = **zv_string;
- zval_copy_ctor(return_value);
- ZLIBG(ob_gzhandler_status)=-1;
- return;
- }
- convert_to_string_ex(a_encoding);
- if (php_memnstr(Z_STRVAL_PP(a_encoding), "gzip", 4, Z_STRVAL_PP(a_encoding) + Z_STRLEN_PP(a_encoding))) {
- coding = CODING_GZIP;
- } else if(php_memnstr(Z_STRVAL_PP(a_encoding), "deflate", 7, Z_STRVAL_PP(a_encoding) + Z_STRLEN_PP(a_encoding))) {
- coding = CODING_DEFLATE;
- } else {
- RETURN_FALSE;
- }
-
- convert_to_long_ex(zv_mode);
- do_start = ((Z_LVAL_PP(zv_mode) & PHP_OUTPUT_HANDLER_START) ? 1 : 0);
- do_end = ((Z_LVAL_PP(zv_mode) & PHP_OUTPUT_HANDLER_END) ? 1 : 0);
- Z_STRVAL_P(return_value) = NULL;
- Z_STRLEN_P(return_value) = 0;
- if (php_deflate_string(Z_STRVAL_PP(zv_string), Z_STRLEN_PP(zv_string), &Z_STRVAL_P(return_value), &Z_STRLEN_P(return_value), coding, do_start, do_end)==SUCCESS) {
- Z_TYPE_P(return_value) = IS_STRING;
- if (do_start) {
- switch (coding) {
- case CODING_GZIP:
- if (sapi_add_header("Content-Encoding: gzip", sizeof("Content-Encoding: gzip") - 1, 1)==FAILURE) {
- return_original = 1;
- }
- if (sapi_add_header("Vary: Accept-Encoding", sizeof("Vary: Accept-Encoding") - 1, 1)==FAILURE) {
- return_original = 1;
- }
- break;
- case CODING_DEFLATE:
- if (sapi_add_header("Content-Encoding: deflate", sizeof("Content-Encoding: deflate") - 1, 1)==FAILURE) {
- return_original = 1;
- }
- if (sapi_add_header("Vary: Accept-Encoding", sizeof("Vary: Accept-Encoding") - 1, 1)==FAILURE) {
- return_original = 1;
- }
- break;
- default:
- return_original = 1;
- break;
- }
- }
-
- if (return_original) {
- zval_dtor(return_value);
-#if 0
- } else {
- char lenbuf[64];
-
- sprintf(lenbuf,"Content-Length: %d",Z_STRLEN_P(return_value));
- sapi_add_header(lenbuf,strlen(lenbuf), 1);
-#endif
- }
- } else {
- return_original = 1;
- }
-
- if (return_original) {
- /* return the original string */
- *return_value = **zv_string;
- zval_copy_ctor(return_value);
- }
-}
-/* }}} */
-
-/* {{{ php_gzip_output_handler
- */
-static void php_gzip_output_handler(char *output, uint output_len, char **handled_output, uint *handled_output_len, int mode)
-{
- zend_bool do_start, do_end;
- ZLIBLS_FETCH();
-
- do_start = (mode & PHP_OUTPUT_HANDLER_START ? 1 : 0);
- do_end = (mode & PHP_OUTPUT_HANDLER_END ? 1 : 0);
- if (php_deflate_string(output, output_len, handled_output, handled_output_len, ZLIBG(ob_gzip_coding), do_start, do_end)!=SUCCESS) {
- zend_error(E_ERROR, "Compression failed");
- }
-}
-/* }}} */
-
-/* {{{ php_enable_output_compression
- */
-int php_enable_output_compression(int buffer_size)
-{
- zval **a_encoding, **data;
- ELS_FETCH();
- ZLIBLS_FETCH();
-
- if (zend_hash_find(&EG(symbol_table), "HTTP_SERVER_VARS", sizeof("HTTP_SERVER_VARS"), (void **) &data)==FAILURE
- || Z_TYPE_PP(data)!=IS_ARRAY
- || zend_hash_find(Z_ARRVAL_PP(data), "HTTP_ACCEPT_ENCODING", sizeof("HTTP_ACCEPT_ENCODING"), (void **) &a_encoding)==FAILURE) {
- return FAILURE;
- }
- convert_to_string_ex(a_encoding);
- if (php_memnstr(Z_STRVAL_PP(a_encoding), "gzip", 4, Z_STRVAL_PP(a_encoding) + Z_STRLEN_PP(a_encoding))) {
- if (sapi_add_header("Content-Encoding: gzip", sizeof("Content-Encoding: gzip") - 1, 1)==FAILURE) {
- return FAILURE;
- }
- ZLIBG(ob_gzip_coding) = CODING_GZIP;
- } else if(php_memnstr(Z_STRVAL_PP(a_encoding), "deflate", 7, Z_STRVAL_PP(a_encoding) + Z_STRLEN_PP(a_encoding))) {
- if (sapi_add_header("Content-Encoding: deflate", sizeof("Content-Encoding: deflate") - 1, 1)==FAILURE) {
- return FAILURE;
- }
- ZLIBG(ob_gzip_coding) = CODING_DEFLATE;
- } else {
- return FAILURE;
- }
-
- php_start_ob_buffer(NULL, buffer_size);
- php_ob_set_internal_handler(php_gzip_output_handler, buffer_size*1.5);
- return SUCCESS;
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/ext/zlib/zlib.dsp b/ext/zlib/zlib.dsp
deleted file mode 100644
index b34b267234..0000000000
--- a/ext/zlib/zlib.dsp
+++ /dev/null
@@ -1,113 +0,0 @@
-# Microsoft Developer Studio Project File - Name="zlib" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=zlib - Win32 Release_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "zlib.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "zlib.mak" CFG="zlib - Win32 Release_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "zlib - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "zlib - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "zlib - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\..\TSRM" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_ZLIB" /D ZTS=1 /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /I "..\..\..\php_build\zlib" /D ZEND_DEBUG=0 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZLIB_EXPORTS" /D "COMPILE_DL_ZLIB" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_ZLIB=1 /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x406 /d "NDEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib /nologo /dll /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib zlib.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_zlib.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\..\php_build\zlib\Release" /libpath:"..\..\Release_TS_Inline"
-
-!ELSEIF "$(CFG)" == "zlib - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_ZLIB" /D ZTS=1 /YX /FD /c
-# ADD CPP /nologo /MDd /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /I "..\..\..\php_build\zlib" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZLIB_EXPORTS" /D "COMPILE_DL_ZLIB" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_ZLIB=1 /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x406 /d "NDEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts_debug.lib /nologo /dll /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts_debug.lib zlib.lib /nologo /dll /machine:I386 /out:"..\..\Debug_TS/php_zlib.dll" /libpath:"..\..\Debug_TS" /libpath:"..\..\..\php_build\zlib\Debug"
-
-!ENDIF
-
-# Begin Target
-
-# Name "zlib - Win32 Release_TS"
-# Name "zlib - Win32 Debug_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\zlib.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_zlib.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/ext/zlib/zlib_fopen_wrapper.c b/ext/zlib/zlib_fopen_wrapper.c
deleted file mode 100644
index ad87ba705f..0000000000
--- a/ext/zlib/zlib_fopen_wrapper.c
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Hartmut Holzgraefe <hartmut@six.de> |
- +----------------------------------------------------------------------+
- */
-/* $Id$ */
-#define IS_EXT_MODULE
-#define _GNU_SOURCE
-
-#include "php.h"
-#include "php_zlib.h"
-#include "fopen_wrappers.h"
-
-#if HAVE_FOPENCOOKIE
-
-
-struct gz_cookie {
- gzFile gz_file;
-};
-
-static ssize_t gz_reader(void *cookie, char *buffer, size_t size)
-{
- return gzread(((struct gz_cookie *)cookie)->gz_file,buffer,size);
-}
-
-static ssize_t gz_writer(void *cookie, const char *buffer, size_t size) {
- return gzwrite(((struct gz_cookie *)cookie)->gz_file,(char *)buffer,size);
-}
-
-static int gz_seeker(void *cookie,off_t position, int whence) {
- return gzseek(((struct gz_cookie *)cookie)->gz_file,(z_off_t)position,whence);
-}
-
-static int gz_closer(void *cookie) {
- int ret=gzclose(((struct gz_cookie *)cookie)->gz_file);
- free(cookie);
- cookie=NULL;
- return ret;
-}
-
-
-
-static COOKIE_IO_FUNCTIONS_T gz_cookie_functions =
-{ gz_reader
-, gz_writer
-, gz_seeker
-, gz_closer
-};
-
-FILE *zlib_fopen_wrapper(char *path, char *mode, int options, int *issock, int *socketd, char **opened_path)
-{
- struct gz_cookie *gc = NULL;
- FILE *fp;
- int fissock=0, fsocketd=0;
-
- gc = (struct gz_cookie *)malloc(sizeof(struct gz_cookie));
-
- if(gc) {
- *issock = 0;
-
- while(*path!=':')
- path++;
-
- path++;
-
- fp = php_fopen_wrapper(path, mode, options|IGNORE_URL, &fissock, &fsocketd, NULL);
-
- if (!fp) {
- free(gc);
- return NULL;
- }
-
- gc->gz_file = gzdopen(fileno(fp), mode);
-
- if(gc->gz_file) {
- return fopencookie(gc,mode,gz_cookie_functions);
- } else {
- free(gc);
- return NULL;
- }
- }
- errno = ENOENT;
- return NULL;
-}
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/zlib/zlib_win32_howto.txt b/ext/zlib/zlib_win32_howto.txt
deleted file mode 100644
index 72e767ac5e..0000000000
--- a/ext/zlib/zlib_win32_howto.txt
+++ /dev/null
@@ -1,16 +0,0 @@
-Rules for building ZLIB
------------------------
-
-The zlib project requires the folowing files:
-
-php_build\zlib\include\zlib.h
-php_build\zlib\include\zconf.h
-php_build\zlib\lib\zlibstat.lib
-
-php_build is a directory at the same level as php4.
-
-Start Visual Studio, load php_modules.dsw, select the ZLIB projects, and build
-it.
-
-
- \ No newline at end of file
diff --git a/footer b/footer
deleted file mode 100644
index 6513b56b0b..0000000000
--- a/footer
+++ /dev/null
@@ -1,8 +0,0 @@
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * indent-tabs-mode: t
- * End:
- */
diff --git a/genfiles b/genfiles
deleted file mode 100755
index 691333e4c8..0000000000
--- a/genfiles
+++ /dev/null
@@ -1,22 +0,0 @@
-#! /bin/sh
-
-STD='make -f Makefile.am LEX="flex -L" YACC="bison -y -l" srcdir=.'
-
-(cd Zend && eval "$STD zend_language_parser.c zend_language_scanner.c zend_language_scanner_cc.cc zend_ini_parser.c zend_ini_scanner.c zend_ini_scanner_cc.cc")
-
-files="Makefile main/Makefile ext/standard/Makefile"
-sh build/fastgen.sh . yes no $files
-touch .deps main/.deps ext/standard/libs.mk
-
-cat > config_vars.mk <<EOF
-LEX=flex -L
-YACC=bison -y -l
-EOF
-
-(cd ext/standard && make parsedate.c)
-
-rm config_vars.mk .deps ext/standard/libs.mk $files
-
-f=ext/standard/url_scanner_ex.c
-cp $f $f.orig
-grep -v '#line ' $f.orig > $f
diff --git a/header b/header
deleted file mode 100644
index 000bbe498f..0000000000
--- a/header
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997, 1998, 1999, 2000, 2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: |
- | |
- +----------------------------------------------------------------------+
- */
diff --git a/ltmain.sh b/ltmain.sh
deleted file mode 100644
index 5959c479b0..0000000000
--- a/ltmain.sh
+++ /dev/null
@@ -1,4946 +0,0 @@
-# ltmain.sh - Provide generalized library-building support services.
-# NOTE: Changing this file will not affect anything until you rerun configure.
-#
-# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001
-# Free Software Foundation, Inc.
-# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-# As a special exception to the GNU General Public License, if you
-# distribute this file as part of a program that contains a
-# configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that program.
-
-# Check that we have a working $echo.
-if test "X$1" = X--no-reexec; then
- # Discard the --no-reexec flag, and continue.
- shift
-elif test "X$1" = X--fallback-echo; then
- # Avoid inline document here, it may be left over
- :
-elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
- # Yippee, $echo works!
- :
-else
- # Restart under the correct shell, and then maybe $echo will work.
- exec $SHELL "$0" --no-reexec ${1+"$@"}
-fi
-
-if test "X$1" = X--fallback-echo; then
- # used as fallback echo
- shift
- cat <<EOF
-$*
-EOF
- exit 0
-fi
-
-# The name of this program.
-progname=`$echo "$0" | sed 's%^.*/%%'`
-modename="$progname"
-
-# Constants.
-PROGRAM=ltmain.sh
-PACKAGE=libtool
-VERSION=1.4
-TIMESTAMP=" (1.920 2001/04/24 23:26:18)"
-
-default_mode=
-help="Try \`$progname --help' for more information."
-magic="%%%MAGIC variable%%%"
-mkdir="mkdir"
-mv="mv -f"
-rm="rm -f"
-
-# Sed substitution that helps us do robust quoting. It backslashifies
-# metacharacters that are still active within double-quoted strings.
-Xsed='sed -e 1s/^X//'
-sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
-SP2NL='tr \040 \012'
-NL2SP='tr \015\012 \040\040'
-
-# NLS nuisances.
-# Only set LANG and LC_ALL to C if already set.
-# These must not be set unconditionally because not all systems understand
-# e.g. LANG=C (notably SCO).
-# We save the old values to restore during execute mode.
-if test "${LC_ALL+set}" = set; then
- save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL
-fi
-if test "${LANG+set}" = set; then
- save_LANG="$LANG"; LANG=C; export LANG
-fi
-
-if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
- echo "$modename: not configured to build any kind of library" 1>&2
- echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
- exit 1
-fi
-
-# Global variables.
-mode=$default_mode
-nonopt=
-prev=
-prevopt=
-run=
-show="$echo"
-show_help=
-execute_dlfiles=
-lo2o="s/\\.lo\$/.${objext}/"
-o2lo="s/\\.${objext}\$/.lo/"
-
-# Parse our command line options once, thoroughly.
-while test $# -gt 0
-do
- arg="$1"
- shift
-
- case $arg in
- -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
- *) optarg= ;;
- esac
-
- # If the previous option needs an argument, assign it.
- if test -n "$prev"; then
- case $prev in
- execute_dlfiles)
- execute_dlfiles="$execute_dlfiles $arg"
- ;;
- *)
- eval "$prev=\$arg"
- ;;
- esac
-
- prev=
- prevopt=
- continue
- fi
-
- # Have we seen a non-optional argument yet?
- case $arg in
- --help)
- show_help=yes
- ;;
-
- --version)
- echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
- exit 0
- ;;
-
- --config)
- sed -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $0
- exit 0
- ;;
-
- --debug)
- echo "$progname: enabling shell trace mode"
- set -x
- ;;
-
- --dry-run | -n)
- run=:
- ;;
-
- --features)
- echo "host: $host"
- if test "$build_libtool_libs" = yes; then
- echo "enable shared libraries"
- else
- echo "disable shared libraries"
- fi
- if test "$build_old_libs" = yes; then
- echo "enable static libraries"
- else
- echo "disable static libraries"
- fi
- exit 0
- ;;
-
- --finish) mode="finish" ;;
-
- --mode) prevopt="--mode" prev=mode ;;
- --mode=*) mode="$optarg" ;;
-
- --quiet | --silent)
- show=:
- ;;
-
- -dlopen)
- prevopt="-dlopen"
- prev=execute_dlfiles
- ;;
-
- -*)
- $echo "$modename: unrecognized option \`$arg'" 1>&2
- $echo "$help" 1>&2
- exit 1
- ;;
-
- *)
- nonopt="$arg"
- break
- ;;
- esac
-done
-
-if test -n "$prevopt"; then
- $echo "$modename: option \`$prevopt' requires an argument" 1>&2
- $echo "$help" 1>&2
- exit 1
-fi
-
-if test -z "$show_help"; then
-
- # Infer the operation mode.
- if test -z "$mode"; then
- case $nonopt in
- *cc | *++ | gcc* | *-gcc*)
- mode=link
- for arg
- do
- case $arg in
- -c)
- mode=compile
- break
- ;;
- esac
- done
- ;;
- *db | *dbx | *strace | *truss)
- mode=execute
- ;;
- *install*|cp|mv)
- mode=install
- ;;
- *rm)
- mode=uninstall
- ;;
- *)
- # If we have no mode, but dlfiles were specified, then do execute mode.
- test -n "$execute_dlfiles" && mode=execute
-
- # Just use the default operation mode.
- if test -z "$mode"; then
- if test -n "$nonopt"; then
- $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
- else
- $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
- fi
- fi
- ;;
- esac
- fi
-
- # Only execute mode is allowed to have -dlopen flags.
- if test -n "$execute_dlfiles" && test "$mode" != execute; then
- $echo "$modename: unrecognized option \`-dlopen'" 1>&2
- $echo "$help" 1>&2
- exit 1
- fi
-
- # Change the help message to a mode-specific one.
- generic_help="$help"
- help="Try \`$modename --help --mode=$mode' for more information."
-
- # These modes are in order of execution frequency so that they run quickly.
- case $mode in
- # libtool compile mode
- compile)
- modename="$modename: compile"
- # Get the compilation command and the source file.
- base_compile=
- prev=
- lastarg=
- srcfile="$nonopt"
- suppress_output=
-
- user_target=no
- for arg
- do
- case $prev in
- "") ;;
- xcompiler)
- # Aesthetically quote the previous argument.
- prev=
- lastarg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
-
- case $arg in
- # Double-quote args containing other shell metacharacters.
- # Many Bourne shells cannot handle close brackets correctly
- # in scan sets, so we specify it separately.
- *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
- arg="\"$arg\""
- ;;
- esac
-
- # Add the previous argument to base_compile.
- if test -z "$base_compile"; then
- base_compile="$lastarg"
- else
- base_compile="$base_compile $lastarg"
- fi
- continue
- ;;
- esac
-
- # Accept any command-line options.
- case $arg in
- -o)
- if test "$user_target" != "no"; then
- $echo "$modename: you cannot specify \`-o' more than once" 1>&2
- exit 1
- fi
- user_target=next
- ;;
-
- -static)
- build_old_libs=yes
- continue
- ;;
-
- -prefer-pic)
- pic_mode=yes
- continue
- ;;
-
- -prefer-non-pic)
- pic_mode=no
- continue
- ;;
-
- -Xcompiler)
- prev=xcompiler
- continue
- ;;
-
- -Wc,*)
- args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
- lastarg=
- IFS="${IFS= }"; save_ifs="$IFS"; IFS=','
- for arg in $args; do
- IFS="$save_ifs"
-
- # Double-quote args containing other shell metacharacters.
- # Many Bourne shells cannot handle close brackets correctly
- # in scan sets, so we specify it separately.
- case $arg in
- *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
- arg="\"$arg\""
- ;;
- esac
- lastarg="$lastarg $arg"
- done
- IFS="$save_ifs"
- lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
-
- # Add the arguments to base_compile.
- if test -z "$base_compile"; then
- base_compile="$lastarg"
- else
- base_compile="$base_compile $lastarg"
- fi
- continue
- ;;
- esac
-
- case $user_target in
- next)
- # The next one is the -o target name
- user_target=yes
- continue
- ;;
- yes)
- # We got the output file
- user_target=set
- libobj="$arg"
- continue
- ;;
- esac
-
- # Accept the current argument as the source file.
- lastarg="$srcfile"
- srcfile="$arg"
-
- # Aesthetically quote the previous argument.
-
- # Backslashify any backslashes, double quotes, and dollar signs.
- # These are the only characters that are still specially
- # interpreted inside of double-quoted scrings.
- lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
-
- # Double-quote args containing other shell metacharacters.
- # Many Bourne shells cannot handle close brackets correctly
- # in scan sets, so we specify it separately.
- case $lastarg in
- *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
- lastarg="\"$lastarg\""
- ;;
- esac
-
- # Add the previous argument to base_compile.
- if test -z "$base_compile"; then
- base_compile="$lastarg"
- else
- base_compile="$base_compile $lastarg"
- fi
- done
-
- case $user_target in
- set)
- ;;
- no)
- # Get the name of the library object.
- libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
- ;;
- *)
- $echo "$modename: you must specify a target with \`-o'" 1>&2
- exit 1
- ;;
- esac
-
- # Recognize several different file suffixes.
- # If the user specifies -o file.o, it is replaced with file.lo
- xform='[cCFSfmso]'
- case $libobj in
- *.ada) xform=ada ;;
- *.adb) xform=adb ;;
- *.ads) xform=ads ;;
- *.asm) xform=asm ;;
- *.c++) xform=c++ ;;
- *.cc) xform=cc ;;
- *.cpp) xform=cpp ;;
- *.cxx) xform=cxx ;;
- *.f90) xform=f90 ;;
- *.for) xform=for ;;
- esac
-
- libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
-
- case $libobj in
- *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
- *)
- $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
- exit 1
- ;;
- esac
-
- if test -z "$base_compile"; then
- $echo "$modename: you must specify a compilation command" 1>&2
- $echo "$help" 1>&2
- exit 1
- fi
-
- # Delete any leftover library objects.
- if test "$build_old_libs" = yes; then
- removelist="$obj $libobj"
- else
- removelist="$libobj"
- fi
-
- $run $rm $removelist
- trap "$run $rm $removelist; exit 1" 1 2 15
-
- # On Cygwin there's no "real" PIC flag so we must build both object types
- case $host_os in
- cygwin* | mingw* | pw32* | os2*)
- pic_mode=default
- ;;
- esac
- if test $pic_mode = no && test "$deplibs_check_method" != pass_all; then
- # non-PIC code in shared libraries is not supported
- pic_mode=default
- fi
-
- # Calculate the filename of the output object if compiler does
- # not support -o with -c
- if test "$compiler_c_o" = no; then
- output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
- lockfile="$output_obj.lock"
- removelist="$removelist $output_obj $lockfile"
- trap "$run $rm $removelist; exit 1" 1 2 15
- else
- need_locks=no
- lockfile=
- fi
-
- # Lock this critical section if it is needed
- # We use this script file to make the link, it avoids creating a new file
- if test "$need_locks" = yes; then
- until $run ln "$0" "$lockfile" 2>/dev/null; do
- $show "Waiting for $lockfile to be removed"
- sleep 2
- done
- elif test "$need_locks" = warn; then
- if test -f "$lockfile"; then
- echo "\
-*** ERROR, $lockfile exists and contains:
-`cat $lockfile 2>/dev/null`
-
-This indicates that another process is trying to use the same
-temporary object file, and libtool could not work around it because
-your compiler does not support \`-c' and \`-o' together. If you
-repeat this compilation, it may succeed, by chance, but you had better
-avoid parallel builds (make -j) in this platform, or get a better
-compiler."
-
- $run $rm $removelist
- exit 1
- fi
- echo $srcfile > "$lockfile"
- fi
-
- if test -n "$fix_srcfile_path"; then
- eval srcfile=\"$fix_srcfile_path\"
- fi
-
- # Only build a PIC object if we are building libtool libraries.
- if test "$build_libtool_libs" = yes; then
- # Without this assignment, base_compile gets emptied.
- fbsd_hideous_sh_bug=$base_compile
-
- if test "$pic_mode" != no; then
- # All platforms use -DPIC, to notify preprocessed assembler code.
- command="$base_compile $srcfile $pic_flag -DPIC"
- else
- # Don't build PIC code
- command="$base_compile $srcfile"
- fi
- if test "$build_old_libs" = yes; then
- lo_libobj="$libobj"
- dir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
- if test "X$dir" = "X$libobj"; then
- dir="$objdir"
- else
- dir="$dir/$objdir"
- fi
- libobj="$dir/"`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
-
- if test -d "$dir"; then
- $show "$rm $libobj"
- $run $rm $libobj
- else
- $show "$mkdir $dir"
- $run $mkdir $dir
- status=$?
- if test $status -ne 0 && test ! -d $dir; then
- exit $status
- fi
- fi
- fi
- if test "$compiler_o_lo" = yes; then
- output_obj="$libobj"
- command="$command -o $output_obj"
- elif test "$compiler_c_o" = yes; then
- output_obj="$obj"
- command="$command -o $output_obj"
- fi
-
- $run $rm "$output_obj"
- $show "$command"
- if $run eval "$command"; then :
- else
- test -n "$output_obj" && $run $rm $removelist
- exit 1
- fi
-
- if test "$need_locks" = warn &&
- test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
- echo "\
-*** ERROR, $lockfile contains:
-`cat $lockfile 2>/dev/null`
-
-but it should contain:
-$srcfile
-
-This indicates that another process is trying to use the same
-temporary object file, and libtool could not work around it because
-your compiler does not support \`-c' and \`-o' together. If you
-repeat this compilation, it may succeed, by chance, but you had better
-avoid parallel builds (make -j) in this platform, or get a better
-compiler."
-
- $run $rm $removelist
- exit 1
- fi
-
- # Just move the object if needed, then go on to compile the next one
- if test x"$output_obj" != x"$libobj"; then
- $show "$mv $output_obj $libobj"
- if $run $mv $output_obj $libobj; then :
- else
- error=$?
- $run $rm $removelist
- exit $error
- fi
- fi
-
- # If we have no pic_flag, then copy the object into place and finish.
- if (test -z "$pic_flag" || test "$pic_mode" != default) &&
- test "$build_old_libs" = yes; then
- # Rename the .lo from within objdir to obj
- if test -f $obj; then
- $show $rm $obj
- $run $rm $obj
- fi
-
- $show "$mv $libobj $obj"
- if $run $mv $libobj $obj; then :
- else
- error=$?
- $run $rm $removelist
- exit $error
- fi
-
- xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
- if test "X$xdir" = "X$obj"; then
- xdir="."
- else
- xdir="$xdir"
- fi
- baseobj=`$echo "X$obj" | $Xsed -e "s%.*/%%"`
- libobj=`$echo "X$baseobj" | $Xsed -e "$o2lo"`
- # Now arrange that obj and lo_libobj become the same file
- $show "(cd $xdir && $LN_S $baseobj $libobj)"
- if $run eval '(cd $xdir && $LN_S $baseobj $libobj)'; then
- exit 0
- else
- error=$?
- $run $rm $removelist
- exit $error
- fi
- fi
-
- # Allow error messages only from the first compilation.
- suppress_output=' >/dev/null 2>&1'
- fi
-
- # Only build a position-dependent object if we build old libraries.
- if test "$build_old_libs" = yes; then
- if test "$pic_mode" != yes; then
- # Don't build PIC code
- command="$base_compile $srcfile"
- else
- # All platforms use -DPIC, to notify preprocessed assembler code.
- command="$base_compile $srcfile $pic_flag -DPIC"
- fi
- if test "$compiler_c_o" = yes; then
- command="$command -o $obj"
- output_obj="$obj"
- fi
-
- # Suppress compiler output if we already did a PIC compilation.
- command="$command$suppress_output"
- $run $rm "$output_obj"
- $show "$command"
- if $run eval "$command"; then :
- else
- $run $rm $removelist
- exit 1
- fi
-
- if test "$need_locks" = warn &&
- test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
- echo "\
-*** ERROR, $lockfile contains:
-`cat $lockfile 2>/dev/null`
-
-but it should contain:
-$srcfile
-
-This indicates that another process is trying to use the same
-temporary object file, and libtool could not work around it because
-your compiler does not support \`-c' and \`-o' together. If you
-repeat this compilation, it may succeed, by chance, but you had better
-avoid parallel builds (make -j) in this platform, or get a better
-compiler."
-
- $run $rm $removelist
- exit 1
- fi
-
- # Just move the object if needed
- if test x"$output_obj" != x"$obj"; then
- $show "$mv $output_obj $obj"
- if $run $mv $output_obj $obj; then :
- else
- error=$?
- $run $rm $removelist
- exit $error
- fi
- fi
-
- # Create an invalid libtool object if no PIC, so that we do not
- # accidentally link it into a program.
- if test "$build_libtool_libs" != yes; then
- $show "echo timestamp > $libobj"
- $run eval "echo timestamp > \$libobj" || exit $?
- else
- # Move the .lo from within objdir
- $show "$mv $libobj $lo_libobj"
- if $run $mv $libobj $lo_libobj; then :
- else
- error=$?
- $run $rm $removelist
- exit $error
- fi
- fi
- fi
-
- # Unlock the critical section if it was locked
- if test "$need_locks" != no; then
- $run $rm "$lockfile"
- fi
-
- exit 0
- ;;
-
- # libtool link mode
- link | relink)
- modename="$modename: link"
- case $host in
- *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
- # It is impossible to link a dll without this setting, and
- # we shouldn't force the makefile maintainer to figure out
- # which system we are compiling for in order to pass an extra
- # flag for every libtool invokation.
- # allow_undefined=no
-
- # FIXME: Unfortunately, there are problems with the above when trying
- # to make a dll which has undefined symbols, in which case not
- # even a static library is built. For now, we need to specify
- # -no-undefined on the libtool link line when we can be certain
- # that all symbols are satisfied, otherwise we get a static library.
- allow_undefined=yes
- ;;
- *)
- allow_undefined=yes
- ;;
- esac
- libtool_args="$nonopt"
- compile_command="$nonopt"
- finalize_command="$nonopt"
-
- compile_rpath=
- finalize_rpath=
- compile_shlibpath=
- finalize_shlibpath=
- convenience=
- old_convenience=
- deplibs=
- old_deplibs=
- compiler_flags=
- linker_flags=
- dllsearchpath=
- lib_search_path=`pwd`
-
- avoid_version=no
- dlfiles=
- dlprefiles=
- dlself=no
- export_dynamic=no
- export_symbols=
- export_symbols_regex=
- generated=
- libobjs=
- ltlibs=
- module=no
- no_install=no
- objs=
- prefer_static_libs=no
- preload=no
- prev=
- prevarg=
- release=
- rpath=
- xrpath=
- perm_rpath=
- temp_rpath=
- thread_safe=no
- vinfo=
-
- # We need to know -static, to get the right output filenames.
- for arg
- do
- case $arg in
- -all-static | -static)
- if test "X$arg" = "X-all-static"; then
- if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
- $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
- fi
- if test -n "$link_static_flag"; then
- dlopen_self=$dlopen_self_static
- fi
- else
- if test -z "$pic_flag" && test -n "$link_static_flag"; then
- dlopen_self=$dlopen_self_static
- fi
- fi
- build_libtool_libs=no
- build_old_libs=yes
- prefer_static_libs=yes
- break
- ;;
- esac
- done
-
- # See if our shared archives depend on static archives.
- test -n "$old_archive_from_new_cmds" && build_old_libs=yes
-
- # Go through the arguments, transforming them on the way.
- while test $# -gt 0; do
- arg="$1"
- shift
- case $arg in
- *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
- qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
- ;;
- *) qarg=$arg ;;
- esac
- libtool_args="$libtool_args $qarg"
-
- # If the previous option needs an argument, assign it.
- if test -n "$prev"; then
- case $prev in
- output)
- compile_command="$compile_command @OUTPUT@"
- finalize_command="$finalize_command @OUTPUT@"
- ;;
- esac
-
- case $prev in
- dlfiles|dlprefiles)
- if test "$preload" = no; then
- # Add the symbol object into the linking commands.
- compile_command="$compile_command @SYMFILE@"
- finalize_command="$finalize_command @SYMFILE@"
- preload=yes
- fi
- case $arg in
- *.la | *.lo) ;; # We handle these cases below.
- force)
- if test "$dlself" = no; then
- dlself=needless
- export_dynamic=yes
- fi
- prev=
- continue
- ;;
- self)
- if test "$prev" = dlprefiles; then
- dlself=yes
- elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
- dlself=yes
- else
- dlself=needless
- export_dynamic=yes
- fi
- prev=
- continue
- ;;
- *)
- if test "$prev" = dlfiles; then
- dlfiles="$dlfiles $arg"
- else
- dlprefiles="$dlprefiles $arg"
- fi
- prev=
- continue
- ;;
- esac
- ;;
- expsyms)
- export_symbols="$arg"
- if test ! -f "$arg"; then
- $echo "$modename: symbol file \`$arg' does not exist"
- exit 1
- fi
- prev=
- continue
- ;;
- expsyms_regex)
- export_symbols_regex="$arg"
- prev=
- continue
- ;;
- release)
- release="-$arg"
- prev=
- continue
- ;;
- rpath | xrpath)
- # We need an absolute path.
- case $arg in
- [\\/]* | [A-Za-z]:[\\/]*) ;;
- *)
- $echo "$modename: only absolute run-paths are allowed" 1>&2
- exit 1
- ;;
- esac
- if test "$prev" = rpath; then
- case "$rpath " in
- *" $arg "*) ;;
- *) rpath="$rpath $arg" ;;
- esac
- else
- case "$xrpath " in
- *" $arg "*) ;;
- *) xrpath="$xrpath $arg" ;;
- esac
- fi
- prev=
- continue
- ;;
- xcompiler)
- compiler_flags="$compiler_flags $qarg"
- prev=
- compile_command="$compile_command $qarg"
- finalize_command="$finalize_command $qarg"
- continue
- ;;
- xlinker)
- linker_flags="$linker_flags $qarg"
- compiler_flags="$compiler_flags $wl$qarg"
- prev=
- compile_command="$compile_command $wl$qarg"
- finalize_command="$finalize_command $wl$qarg"
- continue
- ;;
- *)
- eval "$prev=\"\$arg\""
- prev=
- continue
- ;;
- esac
- fi # test -n $prev
-
- prevarg="$arg"
-
- case $arg in
- -all-static)
- if test -n "$link_static_flag"; then
- compile_command="$compile_command $link_static_flag"
- finalize_command="$finalize_command $link_static_flag"
- fi
- continue
- ;;
-
- -allow-undefined)
- # FIXME: remove this flag sometime in the future.
- $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
- continue
- ;;
-
- -avoid-version)
- avoid_version=yes
- continue
- ;;
-
- -dlopen)
- prev=dlfiles
- continue
- ;;
-
- -dlpreopen)
- prev=dlprefiles
- continue
- ;;
-
- -export-dynamic)
- export_dynamic=yes
- continue
- ;;
-
- -export-symbols | -export-symbols-regex)
- if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
- $echo "$modename: more than one -exported-symbols argument is not allowed"
- exit 1
- fi
- if test "X$arg" = "X-export-symbols"; then
- prev=expsyms
- else
- prev=expsyms_regex
- fi
- continue
- ;;
-
- # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
- # so, if we see these flags be careful not to treat them like -L
- -L[A-Z][A-Z]*:*)
- case $with_gcc/$host in
- no/*-*-irix*)
- compile_command="$compile_command $arg"
- finalize_command="$finalize_command $arg"
- ;;
- esac
- continue
- ;;
-
- -L*)
- dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
- # We need an absolute path.
- case $dir in
- [\\/]* | [A-Za-z]:[\\/]*) ;;
- *)
- absdir=`cd "$dir" && pwd`
- if test -z "$absdir"; then
- $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
- exit 1
- fi
- dir="$absdir"
- ;;
- esac
- case "$deplibs " in
- *" -L$dir "*) ;;
- *)
- deplibs="$deplibs -L$dir"
- lib_search_path="$lib_search_path $dir"
- ;;
- esac
- case $host in
- *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
- case :$dllsearchpath: in
- *":$dir:"*) ;;
- *) dllsearchpath="$dllsearchpath:$dir";;
- esac
- ;;
- esac
- continue
- ;;
-
- -l*)
- if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
- case $host in
- *-*-cygwin* | *-*-pw32* | *-*-beos*)
- # These systems don't actually have a C or math library (as such)
- continue
- ;;
- *-*-mingw* | *-*-os2*)
- # These systems don't actually have a C library (as such)
- test "X$arg" = "X-lc" && continue
- ;;
- esac
- fi
- deplibs="$deplibs $arg"
- continue
- ;;
-
- -module)
- module=yes
- continue
- ;;
-
- -no-fast-install)
- fast_install=no
- continue
- ;;
-
- -no-install)
- case $host in
- *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
- # The PATH hackery in wrapper scripts is required on Windows
- # in order for the loader to find any dlls it needs.
- $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
- $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
- fast_install=no
- ;;
- *) no_install=yes ;;
- esac
- continue
- ;;
-
- -no-undefined)
- allow_undefined=no
- continue
- ;;
-
- -o) prev=output ;;
-
- -release)
- prev=release
- continue
- ;;
-
- -rpath)
- prev=rpath
- continue
- ;;
-
- -R)
- prev=xrpath
- continue
- ;;
-
- -R*)
- dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
- # We need an absolute path.
- case $dir in
- [\\/]* | [A-Za-z]:[\\/]*) ;;
- *)
- $echo "$modename: only absolute run-paths are allowed" 1>&2
- exit 1
- ;;
- esac
- case "$xrpath " in
- *" $dir "*) ;;
- *) xrpath="$xrpath $dir" ;;
- esac
- continue
- ;;
-
- -static)
- # The effects of -static are defined in a previous loop.
- # We used to do the same as -all-static on platforms that
- # didn't have a PIC flag, but the assumption that the effects
- # would be equivalent was wrong. It would break on at least
- # Digital Unix and AIX.
- continue
- ;;
-
- -thread-safe)
- thread_safe=yes
- continue
- ;;
-
- -version-info)
- prev=vinfo
- continue
- ;;
-
- -Wc,*)
- args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
- arg=
- IFS="${IFS= }"; save_ifs="$IFS"; IFS=','
- for flag in $args; do
- IFS="$save_ifs"
- case $flag in
- *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
- flag="\"$flag\""
- ;;
- esac
- arg="$arg $wl$flag"
- compiler_flags="$compiler_flags $flag"
- done
- IFS="$save_ifs"
- arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
- ;;
-
- -Wl,*)
- args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
- arg=
- IFS="${IFS= }"; save_ifs="$IFS"; IFS=','
- for flag in $args; do
- IFS="$save_ifs"
- case $flag in
- *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
- flag="\"$flag\""
- ;;
- esac
- arg="$arg $wl$flag"
- compiler_flags="$compiler_flags $wl$flag"
- linker_flags="$linker_flags $flag"
- done
- IFS="$save_ifs"
- arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
- ;;
-
- -Xcompiler)
- prev=xcompiler
- continue
- ;;
-
- -Xlinker)
- prev=xlinker
- continue
- ;;
-
- # Some other compiler flag.
- -* | +*)
- # Unknown arguments in both finalize_command and compile_command need
- # to be aesthetically quoted because they are evaled later.
- arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
- case $arg in
- *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
- arg="\"$arg\""
- ;;
- esac
- ;;
-
- *.lo | *.$objext)
- # A library or standard object.
- if test "$prev" = dlfiles; then
- # This file was specified with -dlopen.
- if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
- dlfiles="$dlfiles $arg"
- prev=
- continue
- else
- # If libtool objects are unsupported, then we need to preload.
- prev=dlprefiles
- fi
- fi
-
- if test "$prev" = dlprefiles; then
- # Preload the old-style object.
- dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e "$lo2o"`
- prev=
- else
- case $arg in
- *.lo) libobjs="$libobjs $arg" ;;
- *) objs="$objs $arg" ;;
- esac
- fi
- ;;
-
- *.$libext)
- # An archive.
- deplibs="$deplibs $arg"
- old_deplibs="$old_deplibs $arg"
- continue
- ;;
-
- *.la)
- # A libtool-controlled library.
-
- if test "$prev" = dlfiles; then
- # This library was specified with -dlopen.
- dlfiles="$dlfiles $arg"
- prev=
- elif test "$prev" = dlprefiles; then
- # The library was specified with -dlpreopen.
- dlprefiles="$dlprefiles $arg"
- prev=
- else
- deplibs="$deplibs $arg"
- fi
- continue
- ;;
-
- # Some other compiler argument.
- *)
- # Unknown arguments in both finalize_command and compile_command need
- # to be aesthetically quoted because they are evaled later.
- arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
- case $arg in
- *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
- arg="\"$arg\""
- ;;
- esac
- ;;
- esac # arg
-
- # Now actually substitute the argument into the commands.
- if test -n "$arg"; then
- compile_command="$compile_command $arg"
- finalize_command="$finalize_command $arg"
- fi
- done # argument parsing loop
-
- if test -n "$prev"; then
- $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
- $echo "$help" 1>&2
- exit 1
- fi
-
- if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
- eval arg=\"$export_dynamic_flag_spec\"
- compile_command="$compile_command $arg"
- finalize_command="$finalize_command $arg"
- fi
-
- # calculate the name of the file, without its directory
- outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
- libobjs_save="$libobjs"
-
- if test -n "$shlibpath_var"; then
- # get the directories listed in $shlibpath_var
- eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
- else
- shlib_search_path=
- fi
- eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
- eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
-
- output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
- if test "X$output_objdir" = "X$output"; then
- output_objdir="$objdir"
- else
- output_objdir="$output_objdir/$objdir"
- fi
- # Create the object directory.
- if test ! -d $output_objdir; then
- $show "$mkdir $output_objdir"
- $run $mkdir $output_objdir
- status=$?
- if test $status -ne 0 && test ! -d $output_objdir; then
- exit $status
- fi
- fi
-
- # Determine the type of output
- case $output in
- "")
- $echo "$modename: you must specify an output file" 1>&2
- $echo "$help" 1>&2
- exit 1
- ;;
- *.$libext) linkmode=oldlib ;;
- *.lo | *.$objext) linkmode=obj ;;
- *.la) linkmode=lib ;;
- *) linkmode=prog ;; # Anything else should be a program.
- esac
-
- specialdeplibs=
- libs=
- # Find all interdependent deplibs by searching for libraries
- # that are linked more than once (e.g. -la -lb -la)
- for deplib in $deplibs; do
- case "$libs " in
- *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
- esac
- libs="$libs $deplib"
- done
- deplibs=
- newdependency_libs=
- newlib_search_path=
- need_relink=no # whether we're linking any uninstalled libtool libraries
- notinst_deplibs= # not-installed libtool libraries
- notinst_path= # paths that contain not-installed libtool libraries
- case $linkmode in
- lib)
- passes="conv link"
- for file in $dlfiles $dlprefiles; do
- case $file in
- *.la) ;;
- *)
- $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
- exit 1
- ;;
- esac
- done
- ;;
- prog)
- compile_deplibs=
- finalize_deplibs=
- alldeplibs=no
- newdlfiles=
- newdlprefiles=
- passes="conv scan dlopen dlpreopen link"
- ;;
- *) passes="conv"
- ;;
- esac
- for pass in $passes; do
- if test $linkmode = prog; then
- # Determine which files to process
- case $pass in
- dlopen)
- libs="$dlfiles"
- save_deplibs="$deplibs" # Collect dlpreopened libraries
- deplibs=
- ;;
- dlpreopen) libs="$dlprefiles" ;;
- link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
- esac
- fi
- for deplib in $libs; do
- lib=
- found=no
- case $deplib in
- -l*)
- if test $linkmode = oldlib && test $linkmode = obj; then
- $echo "$modename: warning: \`-l' is ignored for archives/objects: $deplib" 1>&2
- continue
- fi
- if test $pass = conv; then
- deplibs="$deplib $deplibs"
- continue
- fi
- name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
- for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
- # Search the libtool library
- lib="$searchdir/lib${name}.la"
- if test -f "$lib"; then
- found=yes
- break
- fi
- done
- if test "$found" != yes; then
- # deplib doesn't seem to be a libtool library
- if test "$linkmode,$pass" = "prog,link"; then
- compile_deplibs="$deplib $compile_deplibs"
- finalize_deplibs="$deplib $finalize_deplibs"
- else
- deplibs="$deplib $deplibs"
- test $linkmode = lib && newdependency_libs="$deplib $newdependency_libs"
- fi
- continue
- fi
- ;; # -l
- -L*)
- case $linkmode in
- lib)
- deplibs="$deplib $deplibs"
- test $pass = conv && continue
- newdependency_libs="$deplib $newdependency_libs"
- newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
- ;;
- prog)
- if test $pass = conv; then
- deplibs="$deplib $deplibs"
- continue
- fi
- if test $pass = scan; then
- deplibs="$deplib $deplibs"
- newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
- else
- compile_deplibs="$deplib $compile_deplibs"
- finalize_deplibs="$deplib $finalize_deplibs"
- fi
- ;;
- *)
- $echo "$modename: warning: \`-L' is ignored for archives/objects: $deplib" 1>&2
- ;;
- esac # linkmode
- continue
- ;; # -L
- -R*)
- if test $pass = link; then
- dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
- # Make sure the xrpath contains only unique directories.
- case "$xrpath " in
- *" $dir "*) ;;
- *) xrpath="$xrpath $dir" ;;
- esac
- fi
- deplibs="$deplib $deplibs"
- continue
- ;;
- *.la) lib="$deplib" ;;
- *.$libext)
- if test $pass = conv; then
- deplibs="$deplib $deplibs"
- continue
- fi
- case $linkmode in
- lib)
- if test "$deplibs_check_method" != pass_all; then
- echo
- echo "*** Warning: This library needs some functionality provided by $deplib."
- echo "*** I have the capability to make that library automatically link in when"
- echo "*** you link to this library. But I can only do this if you have a"
- echo "*** shared version of the library, which you do not appear to have."
- else
- echo
- echo "*** Warning: Linking the shared library $output against the"
- echo "*** static library $deplib is not portable!"
- deplibs="$deplib $deplibs"
- fi
- continue
- ;;
- prog)
- if test $pass != link; then
- deplibs="$deplib $deplibs"
- else
- compile_deplibs="$deplib $compile_deplibs"
- finalize_deplibs="$deplib $finalize_deplibs"
- fi
- continue
- ;;
- esac # linkmode
- ;; # *.$libext
- *.lo | *.$objext)
- if test $pass = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
- # If there is no dlopen support or we're linking statically,
- # we need to preload.
- newdlprefiles="$newdlprefiles $deplib"
- compile_deplibs="$deplib $compile_deplibs"
- finalize_deplibs="$deplib $finalize_deplibs"
- else
- newdlfiles="$newdlfiles $deplib"
- fi
- continue
- ;;
- %DEPLIBS%)
- alldeplibs=yes
- continue
- ;;
- esac # case $deplib
- if test $found = yes || test -f "$lib"; then :
- else
- $echo "$modename: cannot find the library \`$lib'" 1>&2
- exit 1
- fi
-
- # Check to see that this really is a libtool archive.
- if (sed -e '2q' $lib | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
- else
- $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
- exit 1
- fi
-
- ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
- test "X$ladir" = "X$lib" && ladir="."
-
- dlname=
- dlopen=
- dlpreopen=
- libdir=
- library_names=
- old_library=
- # If the library was installed with an old release of libtool,
- # it will not redefine variable installed.
- installed=yes
-
- # Read the .la file
- case $lib in
- */* | *\\*) . $lib ;;
- *) . ./$lib ;;
- esac
-
- if test "$linkmode,$pass" = "lib,link" ||
- test "$linkmode,$pass" = "prog,scan" ||
- { test $linkmode = oldlib && test $linkmode = obj; }; then
- # Add dl[pre]opened files of deplib
- test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
- test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
- fi
-
- if test $pass = conv; then
- # Only check for convenience libraries
- deplibs="$lib $deplibs"
- if test -z "$libdir"; then
- if test -z "$old_library"; then
- $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
- exit 1
- fi
- # It is a libtool convenience library, so add in its objects.
- convenience="$convenience $ladir/$objdir/$old_library"
- old_convenience="$old_convenience $ladir/$objdir/$old_library"
- tmp_libs=
- for deplib in $dependency_libs; do
- deplibs="$deplib $deplibs"
- case "$tmp_libs " in
- *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
- esac
- tmp_libs="$tmp_libs $deplib"
- done
- elif test $linkmode != prog && test $linkmode != lib; then
- $echo "$modename: \`$lib' is not a convenience library" 1>&2
- exit 1
- fi
- continue
- fi # $pass = conv
-
- # Get the name of the library we link against.
- linklib=
- for l in $old_library $library_names; do
- linklib="$l"
- done
- if test -z "$linklib"; then
- $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
- exit 1
- fi
-
- # This library was specified with -dlopen.
- if test $pass = dlopen; then
- if test -z "$libdir"; then
- $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
- exit 1
- fi
- if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
- # If there is no dlname, no dlopen support or we're linking
- # statically, we need to preload.
- dlprefiles="$dlprefiles $lib"
- else
- newdlfiles="$newdlfiles $lib"
- fi
- continue
- fi # $pass = dlopen
-
- # We need an absolute path.
- case $ladir in
- [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
- *)
- abs_ladir=`cd "$ladir" && pwd`
- if test -z "$abs_ladir"; then
- $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
- $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
- abs_ladir="$ladir"
- fi
- ;;
- esac
- laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
-
- # Find the relevant object directory and library name.
- if test "X$installed" = Xyes; then
- if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
- $echo "$modename: warning: library \`$lib' was moved." 1>&2
- dir="$ladir"
- absdir="$abs_ladir"
- libdir="$abs_ladir"
- else
- dir="$libdir"
- absdir="$libdir"
- fi
- else
- dir="$ladir/$objdir"
- absdir="$abs_ladir/$objdir"
- # Remove this search path later
- notinst_path="$notinst_path $abs_ladir"
- fi # $installed = yes
- name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
-
- # This library was specified with -dlpreopen.
- if test $pass = dlpreopen; then
- if test -z "$libdir"; then
- $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
- exit 1
- fi
- # Prefer using a static library (so that no silly _DYNAMIC symbols
- # are required to link).
- if test -n "$old_library"; then
- newdlprefiles="$newdlprefiles $dir/$old_library"
- # Otherwise, use the dlname, so that lt_dlopen finds it.
- elif test -n "$dlname"; then
- newdlprefiles="$newdlprefiles $dir/$dlname"
- else
- newdlprefiles="$newdlprefiles $dir/$linklib"
- fi
- fi # $pass = dlpreopen
-
- if test -z "$libdir"; then
- # Link the convenience library
- if test $linkmode = lib; then
- deplibs="$dir/$old_library $deplibs"
- elif test "$linkmode,$pass" = "prog,link"; then
- compile_deplibs="$dir/$old_library $compile_deplibs"
- finalize_deplibs="$dir/$old_library $finalize_deplibs"
- else
- deplibs="$lib $deplibs"
- fi
- continue
- fi
-
- if test $linkmode = prog && test $pass != link; then
- newlib_search_path="$newlib_search_path $ladir"
- deplibs="$lib $deplibs"
-
- linkalldeplibs=no
- if test "$link_all_deplibs" != no || test -z "$library_names" ||
- test "$build_libtool_libs" = no; then
- linkalldeplibs=yes
- fi
-
- tmp_libs=
- for deplib in $dependency_libs; do
- case $deplib in
- -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
- esac
- # Need to link against all dependency_libs?
- if test $linkalldeplibs = yes; then
- deplibs="$deplib $deplibs"
- else
- # Need to hardcode shared library paths
- # or/and link against static libraries
- newdependency_libs="$deplib $newdependency_libs"
- fi
- case "$tmp_libs " in
- *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
- esac
- tmp_libs="$tmp_libs $deplib"
- done # for deplib
- continue
- fi # $linkmode = prog...
-
- link_static=no # Whether the deplib will be linked statically
- if test -n "$library_names" &&
- { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
- # Link against this shared library
-
- if test "$linkmode,$pass" = "prog,link" ||
- { test $linkmode = lib && test $hardcode_into_libs = yes; }; then
- # Hardcode the library path.
- # Skip directories that are in the system default run-time
- # search path.
- case " $sys_lib_dlsearch_path " in
- *" $absdir "*) ;;
- *)
- case "$compile_rpath " in
- *" $absdir "*) ;;
- *) compile_rpath="$compile_rpath $absdir"
- esac
- ;;
- esac
- case " $sys_lib_dlsearch_path " in
- *" $libdir "*) ;;
- *)
- case "$finalize_rpath " in
- *" $libdir "*) ;;
- *) finalize_rpath="$finalize_rpath $libdir"
- esac
- ;;
- esac
- if test $linkmode = prog; then
- # We need to hardcode the library path
- if test -n "$shlibpath_var"; then
- # Make sure the rpath contains only unique directories.
- case "$temp_rpath " in
- *" $dir "*) ;;
- *" $absdir "*) ;;
- *) temp_rpath="$temp_rpath $dir" ;;
- esac
- fi
- fi
- fi # $linkmode,$pass = prog,link...
-
- if test "$alldeplibs" = yes &&
- { test "$deplibs_check_method" = pass_all ||
- { test "$build_libtool_libs" = yes &&
- test -n "$library_names"; }; }; then
- # We only need to search for static libraries
- continue
- fi
-
- if test "$installed" = no; then
- notinst_deplibs="$notinst_deplibs $lib"
- need_relink=yes
- fi
-
- if test -n "$old_archive_from_expsyms_cmds"; then
- # figure out the soname
- set dummy $library_names
- realname="$2"
- shift; shift
- libname=`eval \\$echo \"$libname_spec\"`
- # use dlname if we got it. it's perfectly good, no?
- if test -n "$dlname"; then
- soname="$dlname"
- elif test -n "$soname_spec"; then
- # bleh windows
- case $host in
- *cygwin*)
- major=`expr $current - $age`
- versuffix="-$major"
- ;;
- esac
- eval soname=\"$soname_spec\"
- else
- soname="$realname"
- fi
-
- # Make a new name for the extract_expsyms_cmds to use
- soroot="$soname"
- soname=`echo $soroot | sed -e 's/^.*\///'`
- newlib="libimp-`echo $soname | sed 's/^lib//;s/\.dll$//'`.a"
-
- # If the library has no export list, then create one now
- if test -f "$output_objdir/$soname-def"; then :
- else
- $show "extracting exported symbol list from \`$soname'"
- IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
- eval cmds=\"$extract_expsyms_cmds\"
- for cmd in $cmds; do
- IFS="$save_ifs"
- $show "$cmd"
- $run eval "$cmd" || exit $?
- done
- IFS="$save_ifs"
- fi
-
- # Create $newlib
- if test -f "$output_objdir/$newlib"; then :; else
- $show "generating import library for \`$soname'"
- IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
- eval cmds=\"$old_archive_from_expsyms_cmds\"
- for cmd in $cmds; do
- IFS="$save_ifs"
- $show "$cmd"
- $run eval "$cmd" || exit $?
- done
- IFS="$save_ifs"
- fi
- # make sure the library variables are pointing to the new library
- dir=$output_objdir
- linklib=$newlib
- fi # test -n $old_archive_from_expsyms_cmds
-
- if test $linkmode = prog || test "$mode" != relink; then
- add_shlibpath=
- add_dir=
- add=
- lib_linked=yes
- case $hardcode_action in
- immediate | unsupported)
- if test "$hardcode_direct" = no; then
- add="$dir/$linklib"
- elif test "$hardcode_minus_L" = no; then
- case $host in
- *-*-sunos*) add_shlibpath="$dir" ;;
- esac
- add_dir="-L$dir"
- add="-l$name"
- elif test "$hardcode_shlibpath_var" = no; then
- add_shlibpath="$dir"
- add="-l$name"
- else
- lib_linked=no
- fi
- ;;
- relink)
- if test "$hardcode_direct" = yes; then
- add="$dir/$linklib"
- elif test "$hardcode_minus_L" = yes; then
- add_dir="-L$dir"
- add="-l$name"
- elif test "$hardcode_shlibpath_var" = yes; then
- add_shlibpath="$dir"
- add="-l$name"
- else
- lib_linked=no
- fi
- ;;
- *) lib_linked=no ;;
- esac
-
- if test "$lib_linked" != yes; then
- $echo "$modename: configuration error: unsupported hardcode properties"
- exit 1
- fi
-
- if test -n "$add_shlibpath"; then
- case :$compile_shlibpath: in
- *":$add_shlibpath:"*) ;;
- *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
- esac
- fi
- if test $linkmode = prog; then
- test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
- test -n "$add" && compile_deplibs="$add $compile_deplibs"
- else
- test -n "$add_dir" && deplibs="$add_dir $deplibs"
- test -n "$add" && deplibs="$add $deplibs"
- if test "$hardcode_direct" != yes && \
- test "$hardcode_minus_L" != yes && \
- test "$hardcode_shlibpath_var" = yes; then
- case :$finalize_shlibpath: in
- *":$libdir:"*) ;;
- *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
- esac
- fi
- fi
- fi
-
- if test $linkmode = prog || test "$mode" = relink; then
- add_shlibpath=
- add_dir=
- add=
- # Finalize command for both is simple: just hardcode it.
- if test "$hardcode_direct" = yes; then
- add="$libdir/$linklib"
- elif test "$hardcode_minus_L" = yes; then
- add_dir="-L$libdir"
- add="-l$name"
- elif test "$hardcode_shlibpath_var" = yes; then
- case :$finalize_shlibpath: in
- *":$libdir:"*) ;;
- *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
- esac
- add="-l$name"
- else
- # We cannot seem to hardcode it, guess we'll fake it.
- add_dir="-L$libdir"
- add="-l$name"
- fi
-
- if test $linkmode = prog; then
- test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
- test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
- else
- test -n "$add_dir" && deplibs="$add_dir $deplibs"
- test -n "$add" && deplibs="$add $deplibs"
- fi
- fi
- elif test $linkmode = prog; then
- if test "$alldeplibs" = yes &&
- { test "$deplibs_check_method" = pass_all ||
- { test "$build_libtool_libs" = yes &&
- test -n "$library_names"; }; }; then
- # We only need to search for static libraries
- continue
- fi
-
- # Try to link the static library
- # Here we assume that one of hardcode_direct or hardcode_minus_L
- # is not unsupported. This is valid on all known static and
- # shared platforms.
- if test "$hardcode_direct" != unsupported; then
- test -n "$old_library" && linklib="$old_library"
- compile_deplibs="$dir/$linklib $compile_deplibs"
- finalize_deplibs="$dir/$linklib $finalize_deplibs"
- else
- compile_deplibs="-l$name -L$dir $compile_deplibs"
- finalize_deplibs="-l$name -L$dir $finalize_deplibs"
- fi
- elif test "$build_libtool_libs" = yes; then
- # Not a shared library
- if test "$deplibs_check_method" != pass_all; then
- # We're trying link a shared library against a static one
- # but the system doesn't support it.
-
- # Just print a warning and add the library to dependency_libs so
- # that the program can be linked against the static library.
- echo
- echo "*** Warning: This library needs some functionality provided by $lib."
- echo "*** I have the capability to make that library automatically link in when"
- echo "*** you link to this library. But I can only do this if you have a"
- echo "*** shared version of the library, which you do not appear to have."
- if test "$module" = yes; then
- echo "*** Therefore, libtool will create a static module, that should work "
- echo "*** as long as the dlopening application is linked with the -dlopen flag."
- if test -z "$global_symbol_pipe"; then
- echo
- echo "*** However, this would only work if libtool was able to extract symbol"
- echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
- echo "*** not find such a program. So, this module is probably useless."
- echo "*** \`nm' from GNU binutils and a full rebuild may help."
- fi
- if test "$build_old_libs" = no; then
- build_libtool_libs=module
- build_old_libs=yes
- else
- build_libtool_libs=no
- fi
- fi
- else
- convenience="$convenience $dir/$old_library"
- old_convenience="$old_convenience $dir/$old_library"
- deplibs="$dir/$old_library $deplibs"
- link_static=yes
- fi
- fi # link shared/static library?
-
- if test $linkmode = lib; then
- if test -n "$dependency_libs" &&
- { test $hardcode_into_libs != yes || test $build_old_libs = yes ||
- test $link_static = yes; }; then
- # Extract -R from dependency_libs
- temp_deplibs=
- for libdir in $dependency_libs; do
- case $libdir in
- -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
- case " $xrpath " in
- *" $temp_xrpath "*) ;;
- *) xrpath="$xrpath $temp_xrpath";;
- esac;;
- *) temp_deplibs="$temp_deplibs $libdir";;
- esac
- done
- dependency_libs="$temp_deplibs"
- fi
-
- newlib_search_path="$newlib_search_path $absdir"
- # Link against this library
- test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
- # ... and its dependency_libs
- tmp_libs=
- for deplib in $dependency_libs; do
- newdependency_libs="$deplib $newdependency_libs"
- case "$tmp_libs " in
- *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
- esac
- tmp_libs="$tmp_libs $deplib"
- done
-
- if test $link_all_deplibs != no; then
- # Add the search paths of all dependency libraries
- for deplib in $dependency_libs; do
- case $deplib in
- -L*) path="$deplib" ;;
- *.la)
- dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
- test "X$dir" = "X$deplib" && dir="."
- # We need an absolute path.
- case $dir in
- [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
- *)
- absdir=`cd "$dir" && pwd`
- if test -z "$absdir"; then
- $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
- absdir="$dir"
- fi
- ;;
- esac
- if grep "^installed=no" $deplib > /dev/null; then
- path="-L$absdir/$objdir"
- else
- eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
- if test -z "$libdir"; then
- $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
- exit 1
- fi
- if test "$absdir" != "$libdir"; then
- $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
- fi
- path="-L$absdir"
- fi
- ;;
- *) continue ;;
- esac
- case " $deplibs " in
- *" $path "*) ;;
- *) deplibs="$deplibs $path" ;;
- esac
- done
- fi # link_all_deplibs != no
- fi # linkmode = lib
- done # for deplib in $libs
- if test $pass = dlpreopen; then
- # Link the dlpreopened libraries before other libraries
- for deplib in $save_deplibs; do
- deplibs="$deplib $deplibs"
- done
- fi
- if test $pass != dlopen; then
- test $pass != scan && dependency_libs="$newdependency_libs"
- if test $pass != conv; then
- # Make sure lib_search_path contains only unique directories.
- lib_search_path=
- for dir in $newlib_search_path; do
- case "$lib_search_path " in
- *" $dir "*) ;;
- *) lib_search_path="$lib_search_path $dir" ;;
- esac
- done
- newlib_search_path=
- fi
-
- if test "$linkmode,$pass" != "prog,link"; then
- vars="deplibs"
- else
- vars="compile_deplibs finalize_deplibs"
- fi
- for var in $vars dependency_libs; do
- # Add libraries to $var in reverse order
- eval tmp_libs=\"\$$var\"
- new_libs=
- for deplib in $tmp_libs; do
- case $deplib in
- -L*) new_libs="$deplib $new_libs" ;;
- *)
- case " $specialdeplibs " in
- *" $deplib "*) new_libs="$deplib $new_libs" ;;
- *)
- case " $new_libs " in
- *" $deplib "*) ;;
- *) new_libs="$deplib $new_libs" ;;
- esac
- ;;
- esac
- ;;
- esac
- done
- tmp_libs=
- for deplib in $new_libs; do
- case $deplib in
- -L*)
- case " $tmp_libs " in
- *" $deplib "*) ;;
- *) tmp_libs="$tmp_libs $deplib" ;;
- esac
- ;;
- *) tmp_libs="$tmp_libs $deplib" ;;
- esac
- done
- eval $var=\"$tmp_libs\"
- done # for var
- fi
- if test "$pass" = "conv" &&
- { test "$linkmode" = "lib" || test "$linkmode" = "prog"; }; then
- libs="$deplibs" # reset libs
- deplibs=
- fi
- done # for pass
- if test $linkmode = prog; then
- dlfiles="$newdlfiles"
- dlprefiles="$newdlprefiles"
- fi
-
- case $linkmode in
- oldlib)
- if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
- $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
- fi
-
- if test -n "$rpath"; then
- $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
- fi
-
- if test -n "$xrpath"; then
- $echo "$modename: warning: \`-R' is ignored for archives" 1>&2
- fi
-
- if test -n "$vinfo"; then
- $echo "$modename: warning: \`-version-info' is ignored for archives" 1>&2
- fi
-
- if test -n "$release"; then
- $echo "$modename: warning: \`-release' is ignored for archives" 1>&2
- fi
-
- if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
- $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
- fi
-
- # Now set the variables for building old libraries.
- build_libtool_libs=no
- oldlibs="$output"
- objs="$objs$old_deplibs"
- ;;
-
- lib)
- # Make sure we only generate libraries of the form `libNAME.la'.
- case $outputname in
- lib*)
- name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
- eval libname=\"$libname_spec\"
- ;;
- *)
- if test "$module" = no; then
- $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
- $echo "$help" 1>&2
- exit 1
- fi
- if test "$need_lib_prefix" != no; then
- # Add the "lib" prefix for modules if required
- name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
- eval libname=\"$libname_spec\"
- else
- libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
- fi
- ;;
- esac
-
- if test -n "$objs"; then
- if test "$deplibs_check_method" != pass_all; then
- $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
- exit 1
- else
- echo
- echo "*** Warning: Linking the shared library $output against the non-libtool"
- echo "*** objects $objs is not portable!"
- libobjs="$libobjs $objs"
- fi
- fi
-
- if test "$dlself" != no; then
- $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
- fi
-
- set dummy $rpath
- if test $# -gt 2; then
- $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
- fi
- install_libdir="$2"
-
- oldlibs=
- if test -z "$rpath"; then
- if test "$build_libtool_libs" = yes; then
- # Building a libtool convenience library.
- libext=al
- oldlibs="$output_objdir/$libname.$libext $oldlibs"
- build_libtool_libs=convenience
- build_old_libs=yes
- fi
-
- if test -n "$vinfo"; then
- $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2
- fi
-
- if test -n "$release"; then
- $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
- fi
- else
-
- # Parse the version information argument.
- IFS="${IFS= }"; save_ifs="$IFS"; IFS=':'
- set dummy $vinfo 0 0 0
- IFS="$save_ifs"
-
- if test -n "$8"; then
- $echo "$modename: too many parameters to \`-version-info'" 1>&2
- $echo "$help" 1>&2
- exit 1
- fi
-
- current="$2"
- revision="$3"
- age="$4"
-
- # Check that each of the things are valid numbers.
- case $current in
- 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
- *)
- $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
- $echo "$modename: \`$vinfo' is not valid version information" 1>&2
- exit 1
- ;;
- esac
-
- case $revision in
- 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
- *)
- $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
- $echo "$modename: \`$vinfo' is not valid version information" 1>&2
- exit 1
- ;;
- esac
-
- case $age in
- 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
- *)
- $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
- $echo "$modename: \`$vinfo' is not valid version information" 1>&2
- exit 1
- ;;
- esac
-
- if test $age -gt $current; then
- $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
- $echo "$modename: \`$vinfo' is not valid version information" 1>&2
- exit 1
- fi
-
- # Calculate the version variables.
- major=
- versuffix=
- verstring=
- case $version_type in
- none) ;;
-
- darwin)
- # Like Linux, but with the current version available in
- # verstring for coding it into the library header
- major=.`expr $current - $age`
- versuffix="$major.$age.$revision"
- # Darwin ld doesn't like 0 for these options...
- minor_current=`expr $current + 1`
- verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
- ;;
-
- freebsd-aout)
- major=".$current"
- versuffix=".$current.$revision";
- ;;
-
- freebsd-elf)
- major=".$current"
- versuffix=".$current";
- ;;
-
- irix)
- major=`expr $current - $age + 1`
- verstring="sgi$major.$revision"
-
- # Add in all the interfaces that we are compatible with.
- loop=$revision
- while test $loop != 0; do
- iface=`expr $revision - $loop`
- loop=`expr $loop - 1`
- verstring="sgi$major.$iface:$verstring"
- done
-
- # Before this point, $major must not contain `.'.
- major=.$major
- versuffix="$major.$revision"
- ;;
-
- linux)
- major=.`expr $current - $age`
- versuffix="$major.$age.$revision"
- ;;
-
- osf)
- major=`expr $current - $age`
- versuffix=".$current.$age.$revision"
- verstring="$current.$age.$revision"
-
- # Add in all the interfaces that we are compatible with.
- loop=$age
- while test $loop != 0; do
- iface=`expr $current - $loop`
- loop=`expr $loop - 1`
- verstring="$verstring:${iface}.0"
- done
-
- # Make executables depend on our current version.
- verstring="$verstring:${current}.0"
- ;;
-
- sunos)
- major=".$current"
- versuffix=".$current.$revision"
- ;;
-
- windows)
- # Use '-' rather than '.', since we only want one
- # extension on DOS 8.3 filesystems.
- major=`expr $current - $age`
- versuffix="-$major"
- ;;
-
- *)
- $echo "$modename: unknown library version type \`$version_type'" 1>&2
- echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
- exit 1
- ;;
- esac
-
- # Clear the version info if we defaulted, and they specified a release.
- if test -z "$vinfo" && test -n "$release"; then
- major=
- verstring="0.0"
- if test "$need_version" = no; then
- versuffix=
- else
- versuffix=".0.0"
- fi
- fi
-
- # Remove version info from name if versioning should be avoided
- if test "$avoid_version" = yes && test "$need_version" = no; then
- major=
- versuffix=
- verstring=""
- fi
-
- # Check to see if the archive will have undefined symbols.
- if test "$allow_undefined" = yes; then
- if test "$allow_undefined_flag" = unsupported; then
- $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
- build_libtool_libs=no
- build_old_libs=yes
- fi
- else
- # Don't allow undefined symbols.
- allow_undefined_flag="$no_undefined_flag"
- fi
- fi
-
- if test "$mode" != relink; then
- # Remove our outputs.
- $show "${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*"
- $run ${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*
- fi
-
- # Now set the variables for building old libraries.
- if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
- oldlibs="$oldlibs $output_objdir/$libname.$libext"
-
- # Transform .lo files to .o files.
- oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
- fi
-
- # Eliminate all temporary directories.
- for path in $notinst_path; do
- lib_search_path=`echo "$lib_search_path " | sed -e 's% $path % %g'`
- deplibs=`echo "$deplibs " | sed -e 's% -L$path % %g'`
- dependency_libs=`echo "$dependency_libs " | sed -e 's% -L$path % %g'`
- done
-
- if test -n "$xrpath"; then
- # If the user specified any rpath flags, then add them.
- temp_xrpath=
- for libdir in $xrpath; do
- temp_xrpath="$temp_xrpath -R$libdir"
- case "$finalize_rpath " in
- *" $libdir "*) ;;
- *) finalize_rpath="$finalize_rpath $libdir" ;;
- esac
- done
- if test $hardcode_into_libs != yes || test $build_old_libs = yes; then
- dependency_libs="$temp_xrpath $dependency_libs"
- fi
- fi
-
- # Make sure dlfiles contains only unique files that won't be dlpreopened
- old_dlfiles="$dlfiles"
- dlfiles=
- for lib in $old_dlfiles; do
- case " $dlprefiles $dlfiles " in
- *" $lib "*) ;;
- *) dlfiles="$dlfiles $lib" ;;
- esac
- done
-
- # Make sure dlprefiles contains only unique files
- old_dlprefiles="$dlprefiles"
- dlprefiles=
- for lib in $old_dlprefiles; do
- case "$dlprefiles " in
- *" $lib "*) ;;
- *) dlprefiles="$dlprefiles $lib" ;;
- esac
- done
-
- if test "$build_libtool_libs" = yes; then
- if test -n "$rpath"; then
- case $host in
- *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
- # these systems don't actually have a c library (as such)!
- ;;
- *-*-rhapsody* | *-*-darwin1.[012])
- # Rhapsody C library is in the System framework
- deplibs="$deplibs -framework System"
- ;;
- *-*-netbsd*)
- # Don't link with libc until the a.out ld.so is fixed.
- ;;
- *)
- # Add libc to deplibs on all other systems if necessary.
- if test $build_libtool_need_lc = "yes"; then
- deplibs="$deplibs -lc"
- fi
- ;;
- esac
- fi
-
- # Transform deplibs into only deplibs that can be linked in shared.
- name_save=$name
- libname_save=$libname
- release_save=$release
- versuffix_save=$versuffix
- major_save=$major
- # I'm not sure if I'm treating the release correctly. I think
- # release should show up in the -l (ie -lgmp5) so we don't want to
- # add it in twice. Is that correct?
- release=""
- versuffix=""
- major=""
- newdeplibs=
- droppeddeps=no
- case $deplibs_check_method in
- pass_all)
- # Don't check for shared/static. Everything works.
- # This might be a little naive. We might want to check
- # whether the library exists or not. But this is on
- # osf3 & osf4 and I'm not really sure... Just
- # implementing what was already the behaviour.
- newdeplibs=$deplibs
- ;;
- test_compile)
- # This code stresses the "libraries are programs" paradigm to its
- # limits. Maybe even breaks it. We compile a program, linking it
- # against the deplibs as a proxy for the library. Then we can check
- # whether they linked in statically or dynamically with ldd.
- $rm conftest.c
- cat > conftest.c <<EOF
- int main() { return 0; }
-EOF
- $rm conftest
- $CC -o conftest conftest.c $deplibs
- if test $? -eq 0 ; then
- ldd_output=`ldd conftest`
- for i in $deplibs; do
- name="`expr $i : '-l\(.*\)'`"
- # If $name is empty we are operating on a -L argument.
- if test -n "$name" && test "$name" != "0"; then
- libname=`eval \\$echo \"$libname_spec\"`
- deplib_matches=`eval \\$echo \"$library_names_spec\"`
- set dummy $deplib_matches
- deplib_match=$2
- if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
- newdeplibs="$newdeplibs $i"
- else
- droppeddeps=yes
- echo
- echo "*** Warning: This library needs some functionality provided by $i."
- echo "*** I have the capability to make that library automatically link in when"
- echo "*** you link to this library. But I can only do this if you have a"
- echo "*** shared version of the library, which you do not appear to have."
- fi
- else
- newdeplibs="$newdeplibs $i"
- fi
- done
- else
- # Error occured in the first compile. Let's try to salvage the situation:
- # Compile a seperate program for each library.
- for i in $deplibs; do
- name="`expr $i : '-l\(.*\)'`"
- # If $name is empty we are operating on a -L argument.
- if test -n "$name" && test "$name" != "0"; then
- $rm conftest
- $CC -o conftest conftest.c $i
- # Did it work?
- if test $? -eq 0 ; then
- ldd_output=`ldd conftest`
- libname=`eval \\$echo \"$libname_spec\"`
- deplib_matches=`eval \\$echo \"$library_names_spec\"`
- set dummy $deplib_matches
- deplib_match=$2
- if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
- newdeplibs="$newdeplibs $i"
- else
- droppeddeps=yes
- echo
- echo "*** Warning: This library needs some functionality provided by $i."
- echo "*** I have the capability to make that library automatically link in when"
- echo "*** you link to this library. But I can only do this if you have a"
- echo "*** shared version of the library, which you do not appear to have."
- fi
- else
- droppeddeps=yes
- echo
- echo "*** Warning! Library $i is needed by this library but I was not able to"
- echo "*** make it link in! You will probably need to install it or some"
- echo "*** library that it depends on before this library will be fully"
- echo "*** functional. Installing it before continuing would be even better."
- fi
- else
- newdeplibs="$newdeplibs $i"
- fi
- done
- fi
- ;;
- file_magic*)
- set dummy $deplibs_check_method
- file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
- for a_deplib in $deplibs; do
- name="`expr $a_deplib : '-l\(.*\)'`"
- # If $name is empty we are operating on a -L argument.
- if test -n "$name" && test "$name" != "0"; then
- libname=`eval \\$echo \"$libname_spec\"`
- for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
- potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
- for potent_lib in $potential_libs; do
- # Follow soft links.
- if ls -lLd "$potent_lib" 2>/dev/null \
- | grep " -> " >/dev/null; then
- continue
- fi
- # The statement above tries to avoid entering an
- # endless loop below, in case of cyclic links.
- # We might still enter an endless loop, since a link
- # loop can be closed while we follow links,
- # but so what?
- potlib="$potent_lib"
- while test -h "$potlib" 2>/dev/null; do
- potliblink=`ls -ld $potlib | sed 's/.* -> //'`
- case $potliblink in
- [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
- *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
- esac
- done
- if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
- | sed 10q \
- | egrep "$file_magic_regex" > /dev/null; then
- newdeplibs="$newdeplibs $a_deplib"
- a_deplib=""
- break 2
- fi
- done
- done
- if test -n "$a_deplib" ; then
- droppeddeps=yes
- echo
- echo "*** Warning: This library needs some functionality provided by $a_deplib."
- echo "*** I have the capability to make that library automatically link in when"
- echo "*** you link to this library. But I can only do this if you have a"
- echo "*** shared version of the library, which you do not appear to have."
- fi
- else
- # Add a -L argument.
- newdeplibs="$newdeplibs $a_deplib"
- fi
- done # Gone through all deplibs.
- ;;
- match_pattern*)
- set dummy $deplibs_check_method
- match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
- for a_deplib in $deplibs; do
- name="`expr $a_deplib : '-l\(.*\)'`"
- # If $name is empty we are operating on a -L argument.
- if test -n "$name" && test "$name" != "0"; then
- libname=`eval \\$echo \"$libname_spec\"`
- for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
- potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
- for potent_lib in $potential_libs; do
- if eval echo \"$potent_lib\" 2>/dev/null \
- | sed 10q \
- | egrep "$match_pattern_regex" > /dev/null; then
- newdeplibs="$newdeplibs $a_deplib"
- a_deplib=""
- break 2
- fi
- done
- done
- if test -n "$a_deplib" ; then
- droppeddeps=yes
- echo
- echo "*** Warning: This library needs some functionality provided by $a_deplib."
- echo "*** I have the capability to make that library automatically link in when"
- echo "*** you link to this library. But I can only do this if you have a"
- echo "*** shared version of the library, which you do not appear to have."
- fi
- else
- # Add a -L argument.
- newdeplibs="$newdeplibs $a_deplib"
- fi
- done # Gone through all deplibs.
- ;;
- none | unknown | *)
- newdeplibs=""
- if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
- -e 's/ -[LR][^ ]*//g' -e 's/[ ]//g' |
- grep . >/dev/null; then
- echo
- if test "X$deplibs_check_method" = "Xnone"; then
- echo "*** Warning: inter-library dependencies are not supported in this platform."
- else
- echo "*** Warning: inter-library dependencies are not known to be supported."
- fi
- echo "*** All declared inter-library dependencies are being dropped."
- droppeddeps=yes
- fi
- ;;
- esac
- versuffix=$versuffix_save
- major=$major_save
- release=$release_save
- libname=$libname_save
- name=$name_save
-
- case $host in
- *-*-rhapsody* | *-*-darwin1.[012])
- # On Rhapsody replace the C library is the System framework
- newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'`
- ;;
- esac
-
- if test "$droppeddeps" = yes; then
- if test "$module" = yes; then
- echo
- echo "*** Warning: libtool could not satisfy all declared inter-library"
- echo "*** dependencies of module $libname. Therefore, libtool will create"
- echo "*** a static module, that should work as long as the dlopening"
- echo "*** application is linked with the -dlopen flag."
- if test -z "$global_symbol_pipe"; then
- echo
- echo "*** However, this would only work if libtool was able to extract symbol"
- echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
- echo "*** not find such a program. So, this module is probably useless."
- echo "*** \`nm' from GNU binutils and a full rebuild may help."
- fi
- if test "$build_old_libs" = no; then
- oldlibs="$output_objdir/$libname.$libext"
- build_libtool_libs=module
- build_old_libs=yes
- else
- build_libtool_libs=no
- fi
- else
- echo "*** The inter-library dependencies that have been dropped here will be"
- echo "*** automatically added whenever a program is linked with this library"
- echo "*** or is declared to -dlopen it."
-
- if test $allow_undefined = no; then
- echo
- echo "*** Since this library must not contain undefined symbols,"
- echo "*** because either the platform does not support them or"
- echo "*** it was explicitly requested with -no-undefined,"
- echo "*** libtool will only create a static version of it."
- if test "$build_old_libs" = no; then
- oldlibs="$output_objdir/$libname.$libext"
- build_libtool_libs=module
- build_old_libs=yes
- else
- build_libtool_libs=no
- fi
- fi
- fi
- fi
- # Done checking deplibs!
- deplibs=$newdeplibs
- fi
-
- # All the library-specific variables (install_libdir is set above).
- library_names=
- old_library=
- dlname=
-
- # Test again, we may have decided not to build it any more
- if test "$build_libtool_libs" = yes; then
- if test $hardcode_into_libs = yes; then
- # Hardcode the library paths
- hardcode_libdirs=
- dep_rpath=
- rpath="$finalize_rpath"
- test "$mode" != relink && rpath="$compile_rpath$rpath"
- for libdir in $rpath; do
- if test -n "$hardcode_libdir_flag_spec"; then
- if test -n "$hardcode_libdir_separator"; then
- if test -z "$hardcode_libdirs"; then
- hardcode_libdirs="$libdir"
- else
- # Just accumulate the unique libdirs.
- case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
- *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
- ;;
- *)
- hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
- ;;
- esac
- fi
- else
- eval flag=\"$hardcode_libdir_flag_spec\"
- dep_rpath="$dep_rpath $flag"
- fi
- elif test -n "$runpath_var"; then
- case "$perm_rpath " in
- *" $libdir "*) ;;
- *) perm_rpath="$perm_rpath $libdir" ;;
- esac
- fi
- done
- # Substitute the hardcoded libdirs into the rpath.
- if test -n "$hardcode_libdir_separator" &&
- test -n "$hardcode_libdirs"; then
- libdir="$hardcode_libdirs"
- eval dep_rpath=\"$hardcode_libdir_flag_spec\"
- fi
- if test -n "$runpath_var" && test -n "$perm_rpath"; then
- # We should set the runpath_var.
- rpath=
- for dir in $perm_rpath; do
- rpath="$rpath$dir:"
- done
- eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
- fi
- test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
- fi
-
- shlibpath="$finalize_shlibpath"
- test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
- if test -n "$shlibpath"; then
- eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
- fi
-
- # Get the real and link names of the library.
- eval library_names=\"$library_names_spec\"
- set dummy $library_names
- realname="$2"
- shift; shift
-
- if test -n "$soname_spec"; then
- eval soname=\"$soname_spec\"
- else
- soname="$realname"
- fi
- test -z "$dlname" && dlname=$soname
-
- lib="$output_objdir/$realname"
- for link
- do
- linknames="$linknames $link"
- done
-
- # Ensure that we have .o objects for linkers which dislike .lo
- # (e.g. aix) in case we are running --disable-static
- for obj in $libobjs; do
- xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
- if test "X$xdir" = "X$obj"; then
- xdir="."
- else
- xdir="$xdir"
- fi
- baseobj=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
- oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
- if test ! -f $xdir/$oldobj; then
- $show "(cd $xdir && ${LN_S} $baseobj $oldobj)"
- $run eval '(cd $xdir && ${LN_S} $baseobj $oldobj)' || exit $?
- fi
- done
-
- # Use standard objects if they are pic
- test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
-
- # Prepare the list of exported symbols
- if test -z "$export_symbols"; then
- if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
- $show "generating symbol list for \`$libname.la'"
- export_symbols="$output_objdir/$libname.exp"
- $run $rm $export_symbols
- eval cmds=\"$export_symbols_cmds\"
- IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
- for cmd in $cmds; do
- IFS="$save_ifs"
- $show "$cmd"
- $run eval "$cmd" || exit $?
- done
- IFS="$save_ifs"
- if test -n "$export_symbols_regex"; then
- $show "egrep -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
- $run eval 'egrep -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
- $show "$mv \"${export_symbols}T\" \"$export_symbols\""
- $run eval '$mv "${export_symbols}T" "$export_symbols"'
- fi
- fi
- fi
-
- if test -n "$export_symbols" && test -n "$include_expsyms"; then
- $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
- fi
-
- if test -n "$convenience"; then
- if test -n "$whole_archive_flag_spec"; then
- eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
- else
- gentop="$output_objdir/${outputname}x"
- $show "${rm}r $gentop"
- $run ${rm}r "$gentop"
- $show "mkdir $gentop"
- $run mkdir "$gentop"
- status=$?
- if test $status -ne 0 && test ! -d "$gentop"; then
- exit $status
- fi
- generated="$generated $gentop"
-
- for xlib in $convenience; do
- # Extract the objects.
- case $xlib in
- [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
- *) xabs=`pwd`"/$xlib" ;;
- esac
- xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
- xdir="$gentop/$xlib"
-
- $show "${rm}r $xdir"
- $run ${rm}r "$xdir"
- $show "mkdir $xdir"
- $run mkdir "$xdir"
- status=$?
- if test $status -ne 0 && test ! -d "$xdir"; then
- exit $status
- fi
- $show "(cd $xdir && $AR x $xabs)"
- $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
-
- libobjs="$libobjs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
- done
- fi
- fi
-
- if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
- eval flag=\"$thread_safe_flag_spec\"
- linker_flags="$linker_flags $flag"
- fi
-
- # Make a backup of the uninstalled library when relinking
- if test "$mode" = relink; then
- $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $?
- fi
-
- # Do each of the archive commands.
- if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
- eval cmds=\"$archive_expsym_cmds\"
- else
- eval cmds=\"$archive_cmds\"
- fi
- IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
- for cmd in $cmds; do
- IFS="$save_ifs"
- $show "$cmd"
- $run eval "$cmd" || exit $?
- done
- IFS="$save_ifs"
-
- # Restore the uninstalled library and exit
- if test "$mode" = relink; then
- $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
- exit 0
- fi
-
- # Create links to the real library.
- for linkname in $linknames; do
- if test "$realname" != "$linkname"; then
- $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
- $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
- fi
- done
-
- # If -module or -export-dynamic was specified, set the dlname.
- if test "$module" = yes || test "$export_dynamic" = yes; then
- # On all known operating systems, these are identical.
- dlname="$soname"
- fi
- fi
- ;;
-
- obj)
- if test -n "$deplibs"; then
- $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
- fi
-
- if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
- $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
- fi
-
- if test -n "$rpath"; then
- $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
- fi
-
- if test -n "$xrpath"; then
- $echo "$modename: warning: \`-R' is ignored for objects" 1>&2
- fi
-
- if test -n "$vinfo"; then
- $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
- fi
-
- if test -n "$release"; then
- $echo "$modename: warning: \`-release' is ignored for objects" 1>&2
- fi
-
- case $output in
- *.lo)
- if test -n "$objs$old_deplibs"; then
- $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
- exit 1
- fi
- libobj="$output"
- obj=`$echo "X$output" | $Xsed -e "$lo2o"`
- ;;
- *)
- libobj=
- obj="$output"
- ;;
- esac
-
- # Delete the old objects.
- $run $rm $obj $libobj
-
- # Objects from convenience libraries. This assumes
- # single-version convenience libraries. Whenever we create
- # different ones for PIC/non-PIC, this we'll have to duplicate
- # the extraction.
- reload_conv_objs=
- gentop=
- # reload_cmds runs $LD directly, so let us get rid of
- # -Wl from whole_archive_flag_spec
- wl=
-
- if test -n "$convenience"; then
- if test -n "$whole_archive_flag_spec"; then
- eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
- else
- gentop="$output_objdir/${obj}x"
- $show "${rm}r $gentop"
- $run ${rm}r "$gentop"
- $show "mkdir $gentop"
- $run mkdir "$gentop"
- status=$?
- if test $status -ne 0 && test ! -d "$gentop"; then
- exit $status
- fi
- generated="$generated $gentop"
-
- for xlib in $convenience; do
- # Extract the objects.
- case $xlib in
- [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
- *) xabs=`pwd`"/$xlib" ;;
- esac
- xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
- xdir="$gentop/$xlib"
-
- $show "${rm}r $xdir"
- $run ${rm}r "$xdir"
- $show "mkdir $xdir"
- $run mkdir "$xdir"
- status=$?
- if test $status -ne 0 && test ! -d "$xdir"; then
- exit $status
- fi
- $show "(cd $xdir && $AR x $xabs)"
- $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
-
- reload_conv_objs="$reload_objs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
- done
- fi
- fi
-
- # Create the old-style object.
- reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
-
- output="$obj"
- eval cmds=\"$reload_cmds\"
- IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
- for cmd in $cmds; do
- IFS="$save_ifs"
- $show "$cmd"
- $run eval "$cmd" || exit $?
- done
- IFS="$save_ifs"
-
- # Exit if we aren't doing a library object file.
- if test -z "$libobj"; then
- if test -n "$gentop"; then
- $show "${rm}r $gentop"
- $run ${rm}r $gentop
- fi
-
- exit 0
- fi
-
- if test "$build_libtool_libs" != yes; then
- if test -n "$gentop"; then
- $show "${rm}r $gentop"
- $run ${rm}r $gentop
- fi
-
- # Create an invalid libtool object if no PIC, so that we don't
- # accidentally link it into a program.
- $show "echo timestamp > $libobj"
- $run eval "echo timestamp > $libobj" || exit $?
- exit 0
- fi
-
- if test -n "$pic_flag" || test "$pic_mode" != default; then
- # Only do commands if we really have different PIC objects.
- reload_objs="$libobjs $reload_conv_objs"
- output="$libobj"
- eval cmds=\"$reload_cmds\"
- IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
- for cmd in $cmds; do
- IFS="$save_ifs"
- $show "$cmd"
- $run eval "$cmd" || exit $?
- done
- IFS="$save_ifs"
- else
- # Just create a symlink.
- $show $rm $libobj
- $run $rm $libobj
- xdir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
- if test "X$xdir" = "X$libobj"; then
- xdir="."
- else
- xdir="$xdir"
- fi
- baseobj=`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
- oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
- $show "(cd $xdir && $LN_S $oldobj $baseobj)"
- $run eval '(cd $xdir && $LN_S $oldobj $baseobj)' || exit $?
- fi
-
- if test -n "$gentop"; then
- $show "${rm}r $gentop"
- $run ${rm}r $gentop
- fi
-
- exit 0
- ;;
-
- prog)
- case $host in
- *cygwin*) output=`echo $output | sed -e 's,.exe$,,;s,$,.exe,'` ;;
- esac
- if test -n "$vinfo"; then
- $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
- fi
-
- if test -n "$release"; then
- $echo "$modename: warning: \`-release' is ignored for programs" 1>&2
- fi
-
- if test "$preload" = yes; then
- if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown &&
- test "$dlopen_self_static" = unknown; then
- $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
- fi
- fi
-
- case $host in
- *-*-rhapsody* | *-*-darwin1.[012])
- # On Rhapsody replace the C library is the System framework
- compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
- finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
- ;;
- esac
-
- compile_command="$compile_command $compile_deplibs"
- finalize_command="$finalize_command $finalize_deplibs"
-
- if test -n "$rpath$xrpath"; then
- # If the user specified any rpath flags, then add them.
- for libdir in $rpath $xrpath; do
- # This is the magic to use -rpath.
- case "$finalize_rpath " in
- *" $libdir "*) ;;
- *) finalize_rpath="$finalize_rpath $libdir" ;;
- esac
- done
- fi
-
- # Now hardcode the library paths
- rpath=
- hardcode_libdirs=
- for libdir in $compile_rpath $finalize_rpath; do
- if test -n "$hardcode_libdir_flag_spec"; then
- if test -n "$hardcode_libdir_separator"; then
- if test -z "$hardcode_libdirs"; then
- hardcode_libdirs="$libdir"
- else
- # Just accumulate the unique libdirs.
- case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
- *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
- ;;
- *)
- hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
- ;;
- esac
- fi
- else
- eval flag=\"$hardcode_libdir_flag_spec\"
- rpath="$rpath $flag"
- fi
- elif test -n "$runpath_var"; then
- case "$perm_rpath " in
- *" $libdir "*) ;;
- *) perm_rpath="$perm_rpath $libdir" ;;
- esac
- fi
- case $host in
- *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
- case :$dllsearchpath: in
- *":$libdir:"*) ;;
- *) dllsearchpath="$dllsearchpath:$libdir";;
- esac
- ;;
- esac
- done
- # Substitute the hardcoded libdirs into the rpath.
- if test -n "$hardcode_libdir_separator" &&
- test -n "$hardcode_libdirs"; then
- libdir="$hardcode_libdirs"
- eval rpath=\" $hardcode_libdir_flag_spec\"
- fi
- compile_rpath="$rpath"
-
- rpath=
- hardcode_libdirs=
- for libdir in $finalize_rpath; do
- if test -n "$hardcode_libdir_flag_spec"; then
- if test -n "$hardcode_libdir_separator"; then
- if test -z "$hardcode_libdirs"; then
- hardcode_libdirs="$libdir"
- else
- # Just accumulate the unique libdirs.
- case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
- *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
- ;;
- *)
- hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
- ;;
- esac
- fi
- else
- eval flag=\"$hardcode_libdir_flag_spec\"
- rpath="$rpath $flag"
- fi
- elif test -n "$runpath_var"; then
- case "$finalize_perm_rpath " in
- *" $libdir "*) ;;
- *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
- esac
- fi
- done
- # Substitute the hardcoded libdirs into the rpath.
- if test -n "$hardcode_libdir_separator" &&
- test -n "$hardcode_libdirs"; then
- libdir="$hardcode_libdirs"
- eval rpath=\" $hardcode_libdir_flag_spec\"
- fi
- finalize_rpath="$rpath"
-
- if test -n "$libobjs" && test "$build_old_libs" = yes; then
- # Transform all the library objects into standard objects.
- compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
- finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
- fi
-
- dlsyms=
- if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
- if test -n "$NM" && test -n "$global_symbol_pipe"; then
- dlsyms="${outputname}S.c"
- else
- $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
- fi
- fi
-
- if test -n "$dlsyms"; then
- case $dlsyms in
- "") ;;
- *.c)
- # Discover the nlist of each of the dlfiles.
- nlist="$output_objdir/${outputname}.nm"
-
- $show "$rm $nlist ${nlist}S ${nlist}T"
- $run $rm "$nlist" "${nlist}S" "${nlist}T"
-
- # Parse the name list into a source file.
- $show "creating $output_objdir/$dlsyms"
-
- test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
-/* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
-/* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
-
-#ifdef __cplusplus
-extern \"C\" {
-#endif
-
-/* Prevent the only kind of declaration conflicts we can make. */
-#define lt_preloaded_symbols some_other_symbol
-
-/* External symbol declarations for the compiler. */\
-"
-
- if test "$dlself" = yes; then
- $show "generating symbol list for \`$output'"
-
- test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
-
- # Add our own program objects to the symbol list.
- progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
- for arg in $progfiles; do
- $show "extracting global C symbols from \`$arg'"
- $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
- done
-
- if test -n "$exclude_expsyms"; then
- $run eval 'egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
- $run eval '$mv "$nlist"T "$nlist"'
- fi
-
- if test -n "$export_symbols_regex"; then
- $run eval 'egrep -e "$export_symbols_regex" "$nlist" > "$nlist"T'
- $run eval '$mv "$nlist"T "$nlist"'
- fi
-
- # Prepare the list of exported symbols
- if test -z "$export_symbols"; then
- export_symbols="$output_objdir/$output.exp"
- $run $rm $export_symbols
- $run eval "sed -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
- else
- $run eval "sed -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"'
- $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T'
- $run eval 'mv "$nlist"T "$nlist"'
- fi
- fi
-
- for arg in $dlprefiles; do
- $show "extracting global C symbols from \`$arg'"
- name=`echo "$arg" | sed -e 's%^.*/%%'`
- $run eval 'echo ": $name " >> "$nlist"'
- $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
- done
-
- if test -z "$run"; then
- # Make sure we have at least an empty file.
- test -f "$nlist" || : > "$nlist"
-
- if test -n "$exclude_expsyms"; then
- egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
- $mv "$nlist"T "$nlist"
- fi
-
- # Try sorting and uniquifying the output.
- if grep -v "^: " < "$nlist" | sort +2 | uniq > "$nlist"S; then
- :
- else
- grep -v "^: " < "$nlist" > "$nlist"S
- fi
-
- if test -f "$nlist"S; then
- eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
- else
- echo '/* NONE */' >> "$output_objdir/$dlsyms"
- fi
-
- $echo >> "$output_objdir/$dlsyms" "\
-
-#undef lt_preloaded_symbols
-
-#if defined (__STDC__) && __STDC__
-# define lt_ptr_t void *
-#else
-# define lt_ptr_t char *
-# define const
-#endif
-
-/* The mapping between symbol names and symbols. */
-const struct {
- const char *name;
- lt_ptr_t address;
-}
-lt_preloaded_symbols[] =
-{\
-"
-
- sed -n -e 's/^: \([^ ]*\) $/ {\"\1\", (lt_ptr_t) 0},/p' \
- -e 's/^. \([^ ]*\) \([^ ]*\)$/ {"\2", (lt_ptr_t) \&\2},/p' \
- < "$nlist" >> "$output_objdir/$dlsyms"
-
- $echo >> "$output_objdir/$dlsyms" "\
- {0, (lt_ptr_t) 0}
-};
-
-/* This works around a problem in FreeBSD linker */
-#ifdef FREEBSD_WORKAROUND
-static const void *lt_preloaded_setup() {
- return lt_preloaded_symbols;
-}
-#endif
-
-#ifdef __cplusplus
-}
-#endif\
-"
- fi
-
- pic_flag_for_symtable=
- case $host in
- # compiling the symbol table file with pic_flag works around
- # a FreeBSD bug that causes programs to crash when -lm is
- # linked before any other PIC object. But we must not use
- # pic_flag when linking with -static. The problem exists in
- # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
- *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
- case "$compile_command " in
- *" -static "*) ;;
- *) pic_flag_for_symtable=" $pic_flag -DPIC -DFREEBSD_WORKAROUND";;
- esac;;
- *-*-hpux*)
- case "$compile_command " in
- *" -static "*) ;;
- *) pic_flag_for_symtable=" $pic_flag -DPIC";;
- esac
- esac
-
- # Now compile the dynamic symbol file.
- $show "(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
- $run eval '(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
-
- # Clean up the generated files.
- $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
- $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
-
- # Transform the symbol file into the correct name.
- compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
- finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
- ;;
- *)
- $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
- exit 1
- ;;
- esac
- else
- # We keep going just in case the user didn't refer to
- # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
- # really was required.
-
- # Nullify the symbol file.
- compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
- finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
- fi
-
- if test $need_relink = no || test "$build_libtool_libs" != yes; then
- # Replace the output file specification.
- compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
- link_command="$compile_command$compile_rpath"
-
- # We have no uninstalled library dependencies, so finalize right now.
- $show "$link_command"
- $run eval "$link_command"
- status=$?
-
- # Delete the generated files.
- if test -n "$dlsyms"; then
- $show "$rm $output_objdir/${outputname}S.${objext}"
- $run $rm "$output_objdir/${outputname}S.${objext}"
- fi
-
- exit $status
- fi
-
- if test -n "$shlibpath_var"; then
- # We should set the shlibpath_var
- rpath=
- for dir in $temp_rpath; do
- case $dir in
- [\\/]* | [A-Za-z]:[\\/]*)
- # Absolute path.
- rpath="$rpath$dir:"
- ;;
- *)
- # Relative path: add a thisdir entry.
- rpath="$rpath\$thisdir/$dir:"
- ;;
- esac
- done
- temp_rpath="$rpath"
- fi
-
- if test -n "$compile_shlibpath$finalize_shlibpath"; then
- compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
- fi
- if test -n "$finalize_shlibpath"; then
- finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
- fi
-
- compile_var=
- finalize_var=
- if test -n "$runpath_var"; then
- if test -n "$perm_rpath"; then
- # We should set the runpath_var.
- rpath=
- for dir in $perm_rpath; do
- rpath="$rpath$dir:"
- done
- compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
- fi
- if test -n "$finalize_perm_rpath"; then
- # We should set the runpath_var.
- rpath=
- for dir in $finalize_perm_rpath; do
- rpath="$rpath$dir:"
- done
- finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
- fi
- fi
-
- if test "$no_install" = yes; then
- # We don't need to create a wrapper script.
- link_command="$compile_var$compile_command$compile_rpath"
- # Replace the output file specification.
- link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
- # Delete the old output file.
- $run $rm $output
- # Link the executable and exit
- $show "$link_command"
- $run eval "$link_command" || exit $?
- exit 0
- fi
-
- if test "$hardcode_action" = relink; then
- # Fast installation is not supported
- link_command="$compile_var$compile_command$compile_rpath"
- relink_command="$finalize_var$finalize_command$finalize_rpath"
-
- $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
- $echo "$modename: \`$output' will be relinked during installation" 1>&2
- else
- if test "$fast_install" != no; then
- link_command="$finalize_var$compile_command$finalize_rpath"
- if test "$fast_install" = yes; then
- relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
- else
- # fast_install is set to needless
- relink_command=
- fi
- else
- link_command="$compile_var$compile_command$compile_rpath"
- relink_command="$finalize_var$finalize_command$finalize_rpath"
- fi
- fi
-
- # Replace the output file specification.
- link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
-
- # Delete the old output files.
- $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
-
- $show "$link_command"
- $run eval "$link_command" || exit $?
-
- # Now create the wrapper script.
- $show "creating $output"
-
- # Quote the relink command for shipping.
- if test -n "$relink_command"; then
- # Preserve any variables that may affect compiler behavior
- for var in $variables_saved_for_relink; do
- if eval test -z \"\${$var+set}\"; then
- relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
- elif eval var_value=\$$var; test -z "$var_value"; then
- relink_command="$var=; export $var; $relink_command"
- else
- var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
- relink_command="$var=\"$var_value\"; export $var; $relink_command"
- fi
- done
- relink_command="cd `pwd`; $relink_command"
- relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
- fi
-
- # Quote $echo for shipping.
- if test "X$echo" = "X$SHELL $0 --fallback-echo"; then
- case $0 in
- [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";;
- *) qecho="$SHELL `pwd`/$0 --fallback-echo";;
- esac
- qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
- else
- qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
- fi
-
- # Only actually do things if our run command is non-null.
- if test -z "$run"; then
- # win32 will think the script is a binary if it has
- # a .exe suffix, so we strip it off here.
- case $output in
- *.exe) output=`echo $output|sed 's,.exe$,,'` ;;
- esac
- # test for cygwin because mv fails w/o .exe extensions
- case $host in
- *cygwin*) exeext=.exe ;;
- *) exeext= ;;
- esac
- $rm $output
- trap "$rm $output; exit 1" 1 2 15
-
- $echo > $output "\
-#! $SHELL
-
-# $output - temporary wrapper script for $objdir/$outputname
-# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
-#
-# The $output program cannot be directly executed until all the libtool
-# libraries that it depends on are installed.
-#
-# This wrapper script should never be moved out of the build directory.
-# If it is, it will not operate correctly.
-
-# Sed substitution that helps us do robust quoting. It backslashifies
-# metacharacters that are still active within double-quoted strings.
-Xsed='sed -e 1s/^X//'
-sed_quote_subst='$sed_quote_subst'
-
-# The HP-UX ksh and POSIX shell print the target directory to stdout
-# if CDPATH is set.
-if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi
-
-relink_command=\"$relink_command\"
-
-# This environment variable determines our operation mode.
-if test \"\$libtool_install_magic\" = \"$magic\"; then
- # install mode needs the following variable:
- notinst_deplibs='$notinst_deplibs'
-else
- # When we are sourced in execute mode, \$file and \$echo are already set.
- if test \"\$libtool_execute_magic\" != \"$magic\"; then
- echo=\"$qecho\"
- file=\"\$0\"
- # Make sure echo works.
- if test \"X\$1\" = X--no-reexec; then
- # Discard the --no-reexec flag, and continue.
- shift
- elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
- # Yippee, \$echo works!
- :
- else
- # Restart under the correct shell, and then maybe \$echo will work.
- exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
- fi
- fi\
-"
- $echo >> $output "\
-
- # Find the directory that this script lives in.
- thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
- test \"x\$thisdir\" = \"x\$file\" && thisdir=.
-
- # Follow symbolic links until we get to the real thisdir.
- file=\`ls -ld \"\$file\" | sed -n 's/.*-> //p'\`
- while test -n \"\$file\"; do
- destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
-
- # If there was a directory component, then change thisdir.
- if test \"x\$destdir\" != \"x\$file\"; then
- case \"\$destdir\" in
- [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
- *) thisdir=\"\$thisdir/\$destdir\" ;;
- esac
- fi
-
- file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
- file=\`ls -ld \"\$thisdir/\$file\" | sed -n 's/.*-> //p'\`
- done
-
- # Try to get the absolute directory name.
- absdir=\`cd \"\$thisdir\" && pwd\`
- test -n \"\$absdir\" && thisdir=\"\$absdir\"
-"
-
- if test "$fast_install" = yes; then
- echo >> $output "\
- program=lt-'$outputname'$exeext
- progdir=\"\$thisdir/$objdir\"
-
- if test ! -f \"\$progdir/\$program\" || \\
- { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | sed 1q\`; \\
- test \"X\$file\" != \"X\$progdir/\$program\"; }; then
-
- file=\"\$\$-\$program\"
-
- if test ! -d \"\$progdir\"; then
- $mkdir \"\$progdir\"
- else
- $rm \"\$progdir/\$file\"
- fi"
-
- echo >> $output "\
-
- # relink executable if necessary
- if test -n \"\$relink_command\"; then
- if (eval \$relink_command); then :
- else
- $rm \"\$progdir/\$file\"
- exit 1
- fi
- fi
-
- $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
- { $rm \"\$progdir/\$program\";
- $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
- $rm \"\$progdir/\$file\"
- fi"
- else
- echo >> $output "\
- program='$outputname'
- progdir=\"\$thisdir/$objdir\"
-"
- fi
-
- echo >> $output "\
-
- if test -f \"\$progdir/\$program\"; then"
-
- # Export our shlibpath_var if we have one.
- if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
- $echo >> $output "\
- # Add our own library path to $shlibpath_var
- $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
-
- # Some systems cannot cope with colon-terminated $shlibpath_var
- # The second colon is a workaround for a bug in BeOS R4 sed
- $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
-
- export $shlibpath_var
-"
- fi
-
- # fixup the dll searchpath if we need to.
- if test -n "$dllsearchpath"; then
- $echo >> $output "\
- # Add the dll search path components to the executable PATH
- PATH=$dllsearchpath:\$PATH
-"
- fi
-
- $echo >> $output "\
- if test \"\$libtool_execute_magic\" != \"$magic\"; then
- # Run the actual program with our arguments.
-"
- case $host in
- # win32 systems need to use the prog path for dll
- # lookup to work
- *-*-cygwin* | *-*-pw32*)
- $echo >> $output "\
- exec \$progdir/\$program \${1+\"\$@\"}
-"
- ;;
-
- # Backslashes separate directories on plain windows
- *-*-mingw | *-*-os2*)
- $echo >> $output "\
- exec \$progdir\\\\\$program \${1+\"\$@\"}
-"
- ;;
-
- *)
- $echo >> $output "\
- # Export the path to the program.
- PATH=\"\$progdir:\$PATH\"
- export PATH
-
- exec \$program \${1+\"\$@\"}
-"
- ;;
- esac
- $echo >> $output "\
- \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
- exit 1
- fi
- else
- # The program doesn't exist.
- \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2
- \$echo \"This script is just a wrapper for \$program.\" 1>&2
- echo \"See the $PACKAGE documentation for more information.\" 1>&2
- exit 1
- fi
-fi\
-"
- chmod +x $output
- fi
- exit 0
- ;;
- esac
-
- # See if we need to build an old-fashioned archive.
- for oldlib in $oldlibs; do
-
- if test "$build_libtool_libs" = convenience; then
- oldobjs="$libobjs_save"
- addlibs="$convenience"
- build_libtool_libs=no
- else
- if test "$build_libtool_libs" = module; then
- oldobjs="$libobjs_save"
- build_libtool_libs=no
- else
- oldobjs="$objs$old_deplibs "`$echo "X$libobjs_save" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`
- fi
- addlibs="$old_convenience"
- fi
-
- if test -n "$addlibs"; then
- gentop="$output_objdir/${outputname}x"
- $show "${rm}r $gentop"
- $run ${rm}r "$gentop"
- $show "mkdir $gentop"
- $run mkdir "$gentop"
- status=$?
- if test $status -ne 0 && test ! -d "$gentop"; then
- exit $status
- fi
- generated="$generated $gentop"
-
- # Add in members from convenience archives.
- for xlib in $addlibs; do
- # Extract the objects.
- case $xlib in
- [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
- *) xabs=`pwd`"/$xlib" ;;
- esac
- xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
- xdir="$gentop/$xlib"
-
- $show "${rm}r $xdir"
- $run ${rm}r "$xdir"
- $show "mkdir $xdir"
- $run mkdir "$xdir"
- status=$?
- if test $status -ne 0 && test ! -d "$xdir"; then
- exit $status
- fi
- $show "(cd $xdir && $AR x $xabs)"
- $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
-
- oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP`
- done
- fi
-
- # Do each command in the archive commands.
- if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
- eval cmds=\"$old_archive_from_new_cmds\"
- else
- # Ensure that we have .o objects in place in case we decided
- # not to build a shared library, and have fallen back to building
- # static libs even though --disable-static was passed!
- for oldobj in $oldobjs; do
- if test ! -f $oldobj; then
- xdir=`$echo "X$oldobj" | $Xsed -e 's%/[^/]*$%%'`
- if test "X$xdir" = "X$oldobj"; then
- xdir="."
- else
- xdir="$xdir"
- fi
- baseobj=`$echo "X$oldobj" | $Xsed -e 's%^.*/%%'`
- obj=`$echo "X$baseobj" | $Xsed -e "$o2lo"`
- $show "(cd $xdir && ${LN_S} $obj $baseobj)"
- $run eval '(cd $xdir && ${LN_S} $obj $baseobj)' || exit $?
- fi
- done
-
- eval cmds=\"$old_archive_cmds\"
- fi
- IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
- for cmd in $cmds; do
- IFS="$save_ifs"
- $show "$cmd"
- $run eval "$cmd" || exit $?
- done
- IFS="$save_ifs"
- done
-
- if test -n "$generated"; then
- $show "${rm}r$generated"
- $run ${rm}r$generated
- fi
-
- # Now create the libtool archive.
- case $output in
- *.la)
- old_library=
- test "$build_old_libs" = yes && old_library="$libname.$libext"
- $show "creating $output"
-
- # Preserve any variables that may affect compiler behavior
- for var in $variables_saved_for_relink; do
- if eval test -z \"\${$var+set}\"; then
- relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
- elif eval var_value=\$$var; test -z "$var_value"; then
- relink_command="$var=; export $var; $relink_command"
- else
- var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
- relink_command="$var=\"$var_value\"; export $var; $relink_command"
- fi
- done
- # Quote the link command for shipping.
- relink_command="cd `pwd`; $SHELL $0 --mode=relink $libtool_args"
- relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
-
- # Only create the output if not a dry run.
- if test -z "$run"; then
- for installed in no yes; do
- if test "$installed" = yes; then
- if test -z "$install_libdir"; then
- break
- fi
- output="$output_objdir/$outputname"i
- # Replace all uninstalled libtool libraries with the installed ones
- newdependency_libs=
- for deplib in $dependency_libs; do
- case $deplib in
- *.la)
- name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'`
- eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
- if test -z "$libdir"; then
- $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
- exit 1
- fi
- newdependency_libs="$newdependency_libs $libdir/$name"
- ;;
- *) newdependency_libs="$newdependency_libs $deplib" ;;
- esac
- done
- dependency_libs="$newdependency_libs"
- newdlfiles=
- for lib in $dlfiles; do
- name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
- eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
- if test -z "$libdir"; then
- $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
- exit 1
- fi
- newdlfiles="$newdlfiles $libdir/$name"
- done
- dlfiles="$newdlfiles"
- newdlprefiles=
- for lib in $dlprefiles; do
- name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
- eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
- if test -z "$libdir"; then
- $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
- exit 1
- fi
- newdlprefiles="$newdlprefiles $libdir/$name"
- done
- dlprefiles="$newdlprefiles"
- fi
- $rm $output
- # place dlname in correct position for cygwin
- tdlname=$dlname
- case $host,$output,$installed,$module,$dlname in
- *cygwin*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
- esac
- $echo > $output "\
-# $outputname - a libtool library file
-# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
-#
-# Please DO NOT delete this file!
-# It is necessary for linking the library.
-
-# The name that we can dlopen(3).
-dlname='$tdlname'
-
-# Names of this library.
-library_names='$library_names'
-
-# The name of the static archive.
-old_library='$old_library'
-
-# Libraries that this one depends upon.
-dependency_libs='$dependency_libs'
-
-# Version information for $libname.
-current=$current
-age=$age
-revision=$revision
-
-# Is this an already installed library?
-installed=$installed
-
-# Files to dlopen/dlpreopen
-dlopen='$dlfiles'
-dlpreopen='$dlprefiles'
-
-# Directory that this library needs to be installed in:
-libdir='$install_libdir'"
- if test "$installed" = no && test $need_relink = yes; then
- $echo >> $output "\
-relink_command=\"$relink_command\""
- fi
- done
- fi
-
- # Do a symbolic link so that the libtool archive can be found in
- # LD_LIBRARY_PATH before the program is installed.
- $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
- $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
- ;;
- esac
- exit 0
- ;;
-
- # libtool install mode
- install)
- modename="$modename: install"
-
- # There may be an optional sh(1) argument at the beginning of
- # install_prog (especially on Windows NT).
- if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
- # Allow the use of GNU shtool's install command.
- $echo "X$nonopt" | $Xsed | grep shtool > /dev/null; then
- # Aesthetically quote it.
- arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
- case $arg in
- *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
- arg="\"$arg\""
- ;;
- esac
- install_prog="$arg "
- arg="$1"
- shift
- else
- install_prog=
- arg="$nonopt"
- fi
-
- # The real first argument should be the name of the installation program.
- # Aesthetically quote it.
- arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
- case $arg in
- *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
- arg="\"$arg\""
- ;;
- esac
- install_prog="$install_prog$arg"
-
- # We need to accept at least all the BSD install flags.
- dest=
- files=
- opts=
- prev=
- install_type=
- isdir=no
- stripme=
- for arg
- do
- if test -n "$dest"; then
- files="$files $dest"
- dest="$arg"
- continue
- fi
-
- case $arg in
- -d) isdir=yes ;;
- -f) prev="-f" ;;
- -g) prev="-g" ;;
- -m) prev="-m" ;;
- -o) prev="-o" ;;
- -s)
- stripme=" -s"
- continue
- ;;
- -*) ;;
-
- *)
- # If the previous option needed an argument, then skip it.
- if test -n "$prev"; then
- prev=
- else
- dest="$arg"
- continue
- fi
- ;;
- esac
-
- # Aesthetically quote the argument.
- arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
- case $arg in
- *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
- arg="\"$arg\""
- ;;
- esac
- install_prog="$install_prog $arg"
- done
-
- if test -z "$install_prog"; then
- $echo "$modename: you must specify an install program" 1>&2
- $echo "$help" 1>&2
- exit 1
- fi
-
- if test -n "$prev"; then
- $echo "$modename: the \`$prev' option requires an argument" 1>&2
- $echo "$help" 1>&2
- exit 1
- fi
-
- if test -z "$files"; then
- if test -z "$dest"; then
- $echo "$modename: no file or destination specified" 1>&2
- else
- $echo "$modename: you must specify a destination" 1>&2
- fi
- $echo "$help" 1>&2
- exit 1
- fi
-
- # Strip any trailing slash from the destination.
- dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
-
- # Check to see that the destination is a directory.
- test -d "$dest" && isdir=yes
- if test "$isdir" = yes; then
- destdir="$dest"
- destname=
- else
- destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
- test "X$destdir" = "X$dest" && destdir=.
- destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
-
- # Not a directory, so check to see that there is only one file specified.
- set dummy $files
- if test $# -gt 2; then
- $echo "$modename: \`$dest' is not a directory" 1>&2
- $echo "$help" 1>&2
- exit 1
- fi
- fi
- case $destdir in
- [\\/]* | [A-Za-z]:[\\/]*) ;;
- *)
- for file in $files; do
- case $file in
- *.lo) ;;
- *)
- $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
- $echo "$help" 1>&2
- exit 1
- ;;
- esac
- done
- ;;
- esac
-
- # This variable tells wrapper scripts just to set variables rather
- # than running their programs.
- libtool_install_magic="$magic"
-
- staticlibs=
- future_libdirs=
- current_libdirs=
- for file in $files; do
-
- # Do each installation.
- case $file in
- *.$libext)
- # Do the static libraries later.
- staticlibs="$staticlibs $file"
- ;;
-
- *.la)
- # Check to see that this really is a libtool archive.
- if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
- else
- $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
- $echo "$help" 1>&2
- exit 1
- fi
-
- library_names=
- old_library=
- relink_command=
- # If there is no directory component, then add one.
- case $file in
- */* | *\\*) . $file ;;
- *) . ./$file ;;
- esac
-
- # Add the libdir to current_libdirs if it is the destination.
- if test "X$destdir" = "X$libdir"; then
- case "$current_libdirs " in
- *" $libdir "*) ;;
- *) current_libdirs="$current_libdirs $libdir" ;;
- esac
- else
- # Note the libdir as a future libdir.
- case "$future_libdirs " in
- *" $libdir "*) ;;
- *) future_libdirs="$future_libdirs $libdir" ;;
- esac
- fi
-
- dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/
- test "X$dir" = "X$file/" && dir=
- dir="$dir$objdir"
-
- if test -n "$relink_command"; then
- $echo "$modename: warning: relinking \`$file'" 1>&2
- $show "$relink_command"
- if $run eval "$relink_command"; then :
- else
- $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
- continue
- fi
- fi
-
- # See the names of the shared library.
- set dummy $library_names
- if test -n "$2"; then
- realname="$2"
- shift
- shift
-
- srcname="$realname"
- test -n "$relink_command" && srcname="$realname"T
-
- # Install the shared library and build the symlinks.
- $show "$install_prog $dir/$srcname $destdir/$realname"
- $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $?
- if test -n "$stripme" && test -n "$striplib"; then
- $show "$striplib $destdir/$realname"
- $run eval "$striplib $destdir/$realname" || exit $?
- fi
-
- if test $# -gt 0; then
- # Delete the old symlinks, and create new ones.
- for linkname
- do
- if test "$linkname" != "$realname"; then
- $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
- $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
- fi
- done
- fi
-
- # Do each command in the postinstall commands.
- lib="$destdir/$realname"
- eval cmds=\"$postinstall_cmds\"
- IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
- for cmd in $cmds; do
- IFS="$save_ifs"
- $show "$cmd"
- $run eval "$cmd" || exit $?
- done
- IFS="$save_ifs"
- fi
-
- # Install the pseudo-library for information purposes.
- name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
- instname="$dir/$name"i
- $show "$install_prog $instname $destdir/$name"
- $run eval "$install_prog $instname $destdir/$name" || exit $?
-
- # Maybe install the static library, too.
- test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
- ;;
-
- *.lo)
- # Install (i.e. copy) a libtool object.
-
- # Figure out destination file name, if it wasn't already specified.
- if test -n "$destname"; then
- destfile="$destdir/$destname"
- else
- destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
- destfile="$destdir/$destfile"
- fi
-
- # Deduce the name of the destination old-style object file.
- case $destfile in
- *.lo)
- staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
- ;;
- *.$objext)
- staticdest="$destfile"
- destfile=
- ;;
- *)
- $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
- $echo "$help" 1>&2
- exit 1
- ;;
- esac
-
- # Install the libtool object if requested.
- if test -n "$destfile"; then
- $show "$install_prog $file $destfile"
- $run eval "$install_prog $file $destfile" || exit $?
- fi
-
- # Install the old object if enabled.
- if test "$build_old_libs" = yes; then
- # Deduce the name of the old-style object file.
- staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
-
- $show "$install_prog $staticobj $staticdest"
- $run eval "$install_prog \$staticobj \$staticdest" || exit $?
- fi
- exit 0
- ;;
-
- *)
- # Figure out destination file name, if it wasn't already specified.
- if test -n "$destname"; then
- destfile="$destdir/$destname"
- else
- destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
- destfile="$destdir/$destfile"
- fi
-
- # Do a test to see if this is really a libtool program.
- if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
- notinst_deplibs=
- relink_command=
-
- # If there is no directory component, then add one.
- case $file in
- */* | *\\*) . $file ;;
- *) . ./$file ;;
- esac
-
- # Check the variables that should have been set.
- if test -z "$notinst_deplibs"; then
- $echo "$modename: invalid libtool wrapper script \`$file'" 1>&2
- exit 1
- fi
-
- finalize=yes
- for lib in $notinst_deplibs; do
- # Check to see that each library is installed.
- libdir=
- if test -f "$lib"; then
- # If there is no directory component, then add one.
- case $lib in
- */* | *\\*) . $lib ;;
- *) . ./$lib ;;
- esac
- fi
- libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
- if test -n "$libdir" && test ! -f "$libfile"; then
- $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
- finalize=no
- fi
- done
-
- relink_command=
- # If there is no directory component, then add one.
- case $file in
- */* | *\\*) . $file ;;
- *) . ./$file ;;
- esac
-
- outputname=
- if test "$fast_install" = no && test -n "$relink_command"; then
- if test "$finalize" = yes && test -z "$run"; then
- tmpdir="/tmp"
- test -n "$TMPDIR" && tmpdir="$TMPDIR"
- tmpdir="$tmpdir/libtool-$$"
- if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then :
- else
- $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
- continue
- fi
- file=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
- outputname="$tmpdir/$file"
- # Replace the output file specification.
- relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
-
- $show "$relink_command"
- if $run eval "$relink_command"; then :
- else
- $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
- ${rm}r "$tmpdir"
- continue
- fi
- file="$outputname"
- else
- $echo "$modename: warning: cannot relink \`$file'" 1>&2
- fi
- else
- # Install the binary that we compiled earlier.
- file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
- fi
- fi
-
- # remove .exe since cygwin /usr/bin/install will append another
- # one anyways
- case $install_prog,$host in
- /usr/bin/install*,*cygwin*)
- case $file:$destfile in
- *.exe:*.exe)
- # this is ok
- ;;
- *.exe:*)
- destfile=$destfile.exe
- ;;
- *:*.exe)
- destfile=`echo $destfile | sed -e 's,.exe$,,'`
- ;;
- esac
- ;;
- esac
- $show "$install_prog$stripme $file $destfile"
- $run eval "$install_prog\$stripme \$file \$destfile" || exit $?
- test -n "$outputname" && ${rm}r "$tmpdir"
- ;;
- esac
- done
-
- for file in $staticlibs; do
- name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
-
- # Set up the ranlib parameters.
- oldlib="$destdir/$name"
-
- $show "$install_prog $file $oldlib"
- $run eval "$install_prog \$file \$oldlib" || exit $?
-
- if test -n "$stripme" && test -n "$striplib"; then
- $show "$old_striplib $oldlib"
- $run eval "$old_striplib $oldlib" || exit $?
- fi
-
- # Do each command in the postinstall commands.
- eval cmds=\"$old_postinstall_cmds\"
- IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
- for cmd in $cmds; do
- IFS="$save_ifs"
- $show "$cmd"
- $run eval "$cmd" || exit $?
- done
- IFS="$save_ifs"
- done
-
- if test -n "$future_libdirs"; then
- $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
- fi
-
- if test -n "$current_libdirs"; then
- # Maybe just do a dry run.
- test -n "$run" && current_libdirs=" -n$current_libdirs"
- exec $SHELL $0 --finish$current_libdirs
- exit 1
- fi
-
- exit 0
- ;;
-
- # libtool finish mode
- finish)
- modename="$modename: finish"
- libdirs="$nonopt"
- admincmds=
-
- if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
- for dir
- do
- libdirs="$libdirs $dir"
- done
-
- for libdir in $libdirs; do
- if test -n "$finish_cmds"; then
- # Do each command in the finish commands.
- eval cmds=\"$finish_cmds\"
- IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
- for cmd in $cmds; do
- IFS="$save_ifs"
- $show "$cmd"
- $run eval "$cmd" || admincmds="$admincmds
- $cmd"
- done
- IFS="$save_ifs"
- fi
- if test -n "$finish_eval"; then
- # Do the single finish_eval.
- eval cmds=\"$finish_eval\"
- $run eval "$cmds" || admincmds="$admincmds
- $cmds"
- fi
- done
- fi
-
- # Exit here if they wanted silent mode.
- test "$show" = ":" && exit 0
-
- echo "----------------------------------------------------------------------"
- echo "Libraries have been installed in:"
- for libdir in $libdirs; do
- echo " $libdir"
- done
- echo
- echo "If you ever happen to want to link against installed libraries"
- echo "in a given directory, LIBDIR, you must either use libtool, and"
- echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
- echo "flag during linking and do at least one of the following:"
- if test -n "$shlibpath_var"; then
- echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
- echo " during execution"
- fi
- if test -n "$runpath_var"; then
- echo " - add LIBDIR to the \`$runpath_var' environment variable"
- echo " during linking"
- fi
- if test -n "$hardcode_libdir_flag_spec"; then
- libdir=LIBDIR
- eval flag=\"$hardcode_libdir_flag_spec\"
-
- echo " - use the \`$flag' linker flag"
- fi
- if test -n "$admincmds"; then
- echo " - have your system administrator run these commands:$admincmds"
- fi
- if test -f /etc/ld.so.conf; then
- echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
- fi
- echo
- echo "See any operating system documentation about shared libraries for"
- echo "more information, such as the ld(1) and ld.so(8) manual pages."
- echo "----------------------------------------------------------------------"
- exit 0
- ;;
-
- # libtool execute mode
- execute)
- modename="$modename: execute"
-
- # The first argument is the command name.
- cmd="$nonopt"
- if test -z "$cmd"; then
- $echo "$modename: you must specify a COMMAND" 1>&2
- $echo "$help"
- exit 1
- fi
-
- # Handle -dlopen flags immediately.
- for file in $execute_dlfiles; do
- if test ! -f "$file"; then
- $echo "$modename: \`$file' is not a file" 1>&2
- $echo "$help" 1>&2
- exit 1
- fi
-
- dir=
- case $file in
- *.la)
- # Check to see that this really is a libtool archive.
- if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
- else
- $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
- $echo "$help" 1>&2
- exit 1
- fi
-
- # Read the libtool library.
- dlname=
- library_names=
-
- # If there is no directory component, then add one.
- case $file in
- */* | *\\*) . $file ;;
- *) . ./$file ;;
- esac
-
- # Skip this library if it cannot be dlopened.
- if test -z "$dlname"; then
- # Warn if it was a shared library.
- test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
- continue
- fi
-
- dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
- test "X$dir" = "X$file" && dir=.
-
- if test -f "$dir/$objdir/$dlname"; then
- dir="$dir/$objdir"
- else
- $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
- exit 1
- fi
- ;;
-
- *.lo)
- # Just add the directory containing the .lo file.
- dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
- test "X$dir" = "X$file" && dir=.
- ;;
-
- *)
- $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
- continue
- ;;
- esac
-
- # Get the absolute pathname.
- absdir=`cd "$dir" && pwd`
- test -n "$absdir" && dir="$absdir"
-
- # Now add the directory to shlibpath_var.
- if eval "test -z \"\$$shlibpath_var\""; then
- eval "$shlibpath_var=\"\$dir\""
- else
- eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
- fi
- done
-
- # This variable tells wrapper scripts just to set shlibpath_var
- # rather than running their programs.
- libtool_execute_magic="$magic"
-
- # Check if any of the arguments is a wrapper script.
- args=
- for file
- do
- case $file in
- -*) ;;
- *)
- # Do a test to see if this is really a libtool program.
- if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
- # If there is no directory component, then add one.
- case $file in
- */* | *\\*) . $file ;;
- *) . ./$file ;;
- esac
-
- # Transform arg to wrapped name.
- file="$progdir/$program"
- fi
- ;;
- esac
- # Quote arguments (to preserve shell metacharacters).
- file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
- args="$args \"$file\""
- done
-
- if test -z "$run"; then
- if test -n "$shlibpath_var"; then
- # Export the shlibpath_var.
- eval "export $shlibpath_var"
- fi
-
- # Restore saved enviroment variables
- if test "${save_LC_ALL+set}" = set; then
- LC_ALL="$save_LC_ALL"; export LC_ALL
- fi
- if test "${save_LANG+set}" = set; then
- LANG="$save_LANG"; export LANG
- fi
-
- # Now actually exec the command.
- eval "exec \$cmd$args"
-
- $echo "$modename: cannot exec \$cmd$args"
- exit 1
- else
- # Display what would be done.
- if test -n "$shlibpath_var"; then
- eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
- $echo "export $shlibpath_var"
- fi
- $echo "$cmd$args"
- exit 0
- fi
- ;;
-
- # libtool clean and uninstall mode
- clean | uninstall)
- modename="$modename: $mode"
- rm="$nonopt"
- files=
- rmforce=
- exit_status=0
-
- # This variable tells wrapper scripts just to set variables rather
- # than running their programs.
- libtool_install_magic="$magic"
-
- for arg
- do
- case $arg in
- -f) rm="$rm $arg"; rmforce=yes ;;
- -*) rm="$rm $arg" ;;
- *) files="$files $arg" ;;
- esac
- done
-
- if test -z "$rm"; then
- $echo "$modename: you must specify an RM program" 1>&2
- $echo "$help" 1>&2
- exit 1
- fi
-
- rmdirs=
-
- for file in $files; do
- dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
- if test "X$dir" = "X$file"; then
- dir=.
- objdir="$objdir"
- else
- objdir="$dir/$objdir"
- fi
- name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
- test $mode = uninstall && objdir="$dir"
-
- # Remember objdir for removal later, being careful to avoid duplicates
- if test $mode = clean; then
- case " $rmdirs " in
- *" $objdir "*) ;;
- *) rmdirs="$rmdirs $objdir" ;;
- esac
- fi
-
- # Don't error if the file doesn't exist and rm -f was used.
- if (test -L "$file") >/dev/null 2>&1 \
- || (test -h "$file") >/dev/null 2>&1 \
- || test -f "$file"; then
- :
- elif test -d "$file"; then
- exit_status=1
- continue
- elif test "$rmforce" = yes; then
- continue
- fi
-
- rmfiles="$file"
-
- case $name in
- *.la)
- # Possibly a libtool archive, so verify it.
- if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
- . $dir/$name
-
- # Delete the libtool libraries and symlinks.
- for n in $library_names; do
- rmfiles="$rmfiles $objdir/$n"
- done
- test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
- test $mode = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
-
- if test $mode = uninstall; then
- if test -n "$library_names"; then
- # Do each command in the postuninstall commands.
- eval cmds=\"$postuninstall_cmds\"
- IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
- for cmd in $cmds; do
- IFS="$save_ifs"
- $show "$cmd"
- $run eval "$cmd"
- if test $? != 0 && test "$rmforce" != yes; then
- exit_status=1
- fi
- done
- IFS="$save_ifs"
- fi
-
- if test -n "$old_library"; then
- # Do each command in the old_postuninstall commands.
- eval cmds=\"$old_postuninstall_cmds\"
- IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
- for cmd in $cmds; do
- IFS="$save_ifs"
- $show "$cmd"
- $run eval "$cmd"
- if test $? != 0 && test "$rmforce" != yes; then
- exit_status=1
- fi
- done
- IFS="$save_ifs"
- fi
- # FIXME: should reinstall the best remaining shared library.
- fi
- fi
- ;;
-
- *.lo)
- if test "$build_old_libs" = yes; then
- oldobj=`$echo "X$name" | $Xsed -e "$lo2o"`
- rmfiles="$rmfiles $dir/$oldobj"
- fi
- ;;
-
- *)
- # Do a test to see if this is a libtool program.
- if test $mode = clean &&
- (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
- relink_command=
- . $dir/$file
-
- rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
- if test "$fast_install" = yes && test -n "$relink_command"; then
- rmfiles="$rmfiles $objdir/lt-$name"
- fi
- fi
- ;;
- esac
- $show "$rm $rmfiles"
- $run $rm $rmfiles || exit_status=1
- done
-
- # Try to remove the ${objdir}s in the directories where we deleted files
- for dir in $rmdirs; do
- if test -d "$dir"; then
- $show "rmdir $dir"
- $run rmdir $dir >/dev/null 2>&1
- fi
- done
-
- exit $exit_status
- ;;
-
- "")
- $echo "$modename: you must specify a MODE" 1>&2
- $echo "$generic_help" 1>&2
- exit 1
- ;;
- esac
-
- $echo "$modename: invalid operation mode \`$mode'" 1>&2
- $echo "$generic_help" 1>&2
- exit 1
-fi # test -z "$show_help"
-
-# We need to display help for each of the modes.
-case $mode in
-"") $echo \
-"Usage: $modename [OPTION]... [MODE-ARG]...
-
-Provide generalized library-building support services.
-
- --config show all configuration variables
- --debug enable verbose shell tracing
--n, --dry-run display commands without modifying any files
- --features display basic configuration information and exit
- --finish same as \`--mode=finish'
- --help display this help message and exit
- --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS]
- --quiet same as \`--silent'
- --silent don't print informational messages
- --version print version information
-
-MODE must be one of the following:
-
- clean remove files from the build directory
- compile compile a source file into a libtool object
- execute automatically set library path, then run a program
- finish complete the installation of libtool libraries
- install install libraries or executables
- link create a library or an executable
- uninstall remove libraries from an installed directory
-
-MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for
-a more detailed description of MODE."
- exit 0
- ;;
-
-clean)
- $echo \
-"Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
-
-Remove files from the build directory.
-
-RM is the name of the program to use to delete files associated with each FILE
-(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
-to RM.
-
-If FILE is a libtool library, object or program, all the files associated
-with it are deleted. Otherwise, only FILE itself is deleted using RM."
- ;;
-
-compile)
- $echo \
-"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
-
-Compile a source file into a libtool library object.
-
-This mode accepts the following additional options:
-
- -o OUTPUT-FILE set the output file name to OUTPUT-FILE
- -prefer-pic try to building PIC objects only
- -prefer-non-pic try to building non-PIC objects only
- -static always build a \`.o' file suitable for static linking
-
-COMPILE-COMMAND is a command to be used in creating a \`standard' object file
-from the given SOURCEFILE.
-
-The output file name is determined by removing the directory component from
-SOURCEFILE, then substituting the C source code suffix \`.c' with the
-library object suffix, \`.lo'."
- ;;
-
-execute)
- $echo \
-"Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
-
-Automatically set library path, then run a program.
-
-This mode accepts the following additional options:
-
- -dlopen FILE add the directory containing FILE to the library path
-
-This mode sets the library path environment variable according to \`-dlopen'
-flags.
-
-If any of the ARGS are libtool executable wrappers, then they are translated
-into their corresponding uninstalled binary, and any of their required library
-directories are added to the library path.
-
-Then, COMMAND is executed, with ARGS as arguments."
- ;;
-
-finish)
- $echo \
-"Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
-
-Complete the installation of libtool libraries.
-
-Each LIBDIR is a directory that contains libtool libraries.
-
-The commands that this mode executes may require superuser privileges. Use
-the \`--dry-run' option if you just want to see what would be executed."
- ;;
-
-install)
- $echo \
-"Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
-
-Install executables or libraries.
-
-INSTALL-COMMAND is the installation command. The first component should be
-either the \`install' or \`cp' program.
-
-The rest of the components are interpreted as arguments to that command (only
-BSD-compatible install options are recognized)."
- ;;
-
-link)
- $echo \
-"Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
-
-Link object files or libraries together to form another library, or to
-create an executable program.
-
-LINK-COMMAND is a command using the C compiler that you would use to create
-a program from several object files.
-
-The following components of LINK-COMMAND are treated specially:
-
- -all-static do not do any dynamic linking at all
- -avoid-version do not add a version suffix if possible
- -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
- -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
- -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
- -export-symbols SYMFILE
- try to export only the symbols listed in SYMFILE
- -export-symbols-regex REGEX
- try to export only the symbols matching REGEX
- -LLIBDIR search LIBDIR for required installed libraries
- -lNAME OUTPUT-FILE requires the installed library libNAME
- -module build a library that can dlopened
- -no-fast-install disable the fast-install mode
- -no-install link a not-installable executable
- -no-undefined declare that a library does not refer to external symbols
- -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
- -release RELEASE specify package release information
- -rpath LIBDIR the created library will eventually be installed in LIBDIR
- -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
- -static do not do any dynamic linking of libtool libraries
- -version-info CURRENT[:REVISION[:AGE]]
- specify library version info [each variable defaults to 0]
-
-All other options (arguments beginning with \`-') are ignored.
-
-Every other argument is treated as a filename. Files ending in \`.la' are
-treated as uninstalled libtool libraries, other files are standard or library
-object files.
-
-If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
-only library objects (\`.lo' files) may be specified, and \`-rpath' is
-required, except when creating a convenience library.
-
-If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
-using \`ar' and \`ranlib', or on Windows using \`lib'.
-
-If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
-is created, otherwise an executable program is created."
- ;;
-
-uninstall)
- $echo \
-"Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
-
-Remove libraries from an installation directory.
-
-RM is the name of the program to use to delete files associated with each FILE
-(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
-to RM.
-
-If FILE is a libtool library, all the files associated with it are deleted.
-Otherwise, only FILE itself is deleted using RM."
- ;;
-
-*)
- $echo "$modename: invalid operation mode \`$mode'" 1>&2
- $echo "$help" 1>&2
- exit 1
- ;;
-esac
-
-echo
-$echo "Try \`$modename --help' for more information about other modes."
-
-exit 0
-
-# Local Variables:
-# mode:shell-script
-# sh-indentation:2
-# End:
diff --git a/main/Makefile.in b/main/Makefile.in
deleted file mode 100644
index 61aeb98aaa..0000000000
--- a/main/Makefile.in
+++ /dev/null
@@ -1,16 +0,0 @@
-LTLIBRARY_NAME = libmain.la
-
-LTLIBRARY_SOURCES = \
- main.c internal_functions.c snprintf.c php_sprintf.c \
- safe_mode.c fopen_wrappers.c alloca.c \
- php_ini.c SAPI.c rfc1867.c php_content_types.c strlcpy.c \
- strlcat.c mergesort.c reentrancy.c php_variables.c php_ticks.c \
- streams.c \
- network.c php_open_temporary_file.c php_logos.c
-
-include $(top_srcdir)/build/ltlib.mk
-
-
-internal_functions.c: $(srcdir)/internal_functions.c.in $(top_builddir)/config.status
- cd $(top_builddir) && \
- REDO_ALL=yes ./config.status
diff --git a/main/SAPI.c b/main/SAPI.c
deleted file mode 100644
index 499a2f682d..0000000000
--- a/main/SAPI.c
+++ /dev/null
@@ -1,603 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Original design: Shane Caraveo <shane@caraveo.com> |
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-#include <ctype.h>
-#include <sys/stat.h>
-
-#include "php.h"
-#include "SAPI.h"
-#ifdef ZTS
-#include "TSRM.h"
-#endif
-
-#include "rfc1867.h"
-
-#ifdef PHP_WIN32
-#define STRCASECMP stricmp
-#else
-#define STRCASECMP strcasecmp
-#endif
-
-#include "php_content_types.h"
-
-static HashTable known_post_content_types;
-
-SAPI_API void (*sapi_error)(int error_type, const char *message, ...);
-
-
-#ifdef ZTS
-SAPI_API int sapi_globals_id;
-#else
-sapi_globals_struct sapi_globals;
-#endif
-
-static void sapi_globals_ctor(sapi_globals_struct *sapi_globals)
-{
- memset(sapi_globals,0,sizeof(*sapi_globals));
-}
-
-/* True globals (no need for thread safety) */
-SAPI_API sapi_module_struct sapi_module;
-SAPI_API void (*sapi_error)(int error_type, const char *message, ...);
-
-
-SAPI_API void sapi_startup(sapi_module_struct *sf)
-{
- sapi_module = *sf;
- zend_hash_init_ex(&known_post_content_types, 5, NULL, NULL, 1, 0);
-
-#ifdef ZTS
- sapi_globals_id = ts_allocate_id(sizeof(sapi_globals_struct), (ts_allocate_ctor) sapi_globals_ctor, NULL);
-#else
- sapi_globals_ctor(&sapi_globals);
-#endif
-
-#ifdef VIRTUAL_DIR
- virtual_cwd_startup(); /* Could use shutdown to free the main cwd but it would just slow it down for CGI */
-#endif
-
-#ifdef PHP_WIN32
- tsrm_win32_startup();
-#endif
-
- reentrancy_startup();
-
- php_global_startup_internal_extensions();
-}
-
-SAPI_API void sapi_shutdown(void)
-{
- reentrancy_shutdown();
-#ifdef VIRTUAL_DIR
- virtual_cwd_shutdown();
-#endif
-
-#ifdef PHP_WIN32
- tsrm_win32_shutdown();
-#endif
-
- php_global_shutdown_internal_extensions();
- zend_hash_destroy(&known_post_content_types);
-}
-
-
-SAPI_API void sapi_free_header(sapi_header_struct *sapi_header)
-{
- efree(sapi_header->header);
-}
-
-
-SAPI_API void sapi_handle_post(void *arg SLS_DC)
-{
- if (SG(request_info).post_entry && SG(request_info).content_type_dup) {
- SG(request_info).post_entry->post_handler(SG(request_info).content_type_dup, arg SLS_CC);
- if (SG(request_info).post_data) {
- efree(SG(request_info).post_data);
- SG(request_info).post_data = NULL;
- }
- efree(SG(request_info).content_type_dup);
- SG(request_info).content_type_dup = NULL;
- }
-}
-
-static void sapi_read_post_data(SLS_D)
-{
- sapi_post_entry *post_entry;
- uint content_type_length = strlen(SG(request_info).content_type);
- char *content_type = estrndup(SG(request_info).content_type, content_type_length);
- char *p;
- char oldchar=0;
- void (*post_reader_func)(SLS_D);
-
-
- /* dedicated implementation for increased performance:
- * - Make the content type lowercase
- * - Trim descriptive data, stay with the content-type only
- */
- for (p=content_type; p<content_type+content_type_length; p++) {
- switch (*p) {
- case ';':
- case ',':
- case ' ':
- content_type_length = p-content_type;
- oldchar = *p;
- *p = 0;
- break;
- default:
- *p = tolower(*p);
- break;
- }
- }
-
- if (zend_hash_find(&known_post_content_types, content_type, content_type_length+1, (void **) &post_entry)==SUCCESS) {
- SG(request_info).post_entry = post_entry;
- post_reader_func = post_entry->post_reader;
- } else {
- if (!sapi_module.default_post_reader) {
- sapi_module.sapi_error(E_WARNING, "Unsupported content type: '%s'", content_type);
- return;
- }
- SG(request_info).post_entry = NULL;
- post_reader_func = sapi_module.default_post_reader;
- }
- if (oldchar) {
- *(p-1) = oldchar;
- }
- post_reader_func(SLS_C);
- SG(request_info).content_type_dup = content_type;
-}
-
-
-SAPI_POST_READER_FUNC(sapi_read_standard_form_data)
-{
- int read_bytes;
- int allocated_bytes=SAPI_POST_BLOCK_SIZE+1;
-
- if (SG(request_info).content_length > SG(post_max_size)) {
- php_error(E_WARNING, "POST Content-Length of %d bytes exceeds the limit of %d bytes",
- SG(request_info).content_length, SG(post_max_size));
- return;
- }
- SG(request_info).post_data = emalloc(allocated_bytes);
-
- for (;;) {
- read_bytes = sapi_module.read_post(SG(request_info).post_data+SG(read_post_bytes), SAPI_POST_BLOCK_SIZE SLS_CC);
- if (read_bytes<=0) {
- break;
- }
- SG(read_post_bytes) += read_bytes;
- if (SG(read_post_bytes) > SG(post_max_size)) {
- php_error(E_WARNING, "Actual POST length does not match Content-Length, and exceeds %d bytes", SG(post_max_size));
- return;
- }
- if (read_bytes < SAPI_POST_BLOCK_SIZE) {
- break;
- }
- if (SG(read_post_bytes)+SAPI_POST_BLOCK_SIZE >= allocated_bytes) {
- allocated_bytes = SG(read_post_bytes)+SAPI_POST_BLOCK_SIZE+1;
- SG(request_info).post_data = erealloc(SG(request_info).post_data, allocated_bytes);
- }
- }
- SG(request_info).post_data[SG(read_post_bytes)] = 0; /* terminating NULL */
- SG(request_info).post_data_length = SG(read_post_bytes);
-}
-
-
-SAPI_API char *sapi_get_default_content_type(SLS_D)
-{
- char *mimetype, *charset, *content_type;
-
- mimetype = SG(default_mimetype) ? SG(default_mimetype) : SAPI_DEFAULT_MIMETYPE;
- charset = SG(default_charset) ? SG(default_charset) : SAPI_DEFAULT_CHARSET;
-
- if (strncasecmp(mimetype, "text/", 5) == 0 && *charset) {
- int len = strlen(mimetype) + sizeof("; charset=") + strlen(charset);
- content_type = emalloc(len);
- snprintf(content_type, len, "%s; charset=%s", mimetype, charset);
- } else {
- content_type = estrdup(mimetype);
- }
- return content_type;
-}
-
-
-SAPI_API void sapi_get_default_content_type_header(sapi_header_struct *default_header SLS_DC)
-{
- char *default_content_type = sapi_get_default_content_type(SLS_C);
- int default_content_type_len = strlen(default_content_type);
-
- default_header->header_len = (sizeof("Content-type: ")-1) + default_content_type_len;
- default_header->header = emalloc(default_header->header_len+1);
- memcpy(default_header->header, "Content-type: ", sizeof("Content-type: "));
- memcpy(default_header->header+sizeof("Content-type: ")-1, default_content_type, default_content_type_len);
- default_header->header[default_header->header_len] = 0;
- efree(default_content_type);
-}
-
-/*
- * Add charset on content-type header if the MIME type starts with
- * "text/", the default_charset directive is not empty and
- * there is not already a charset option in there.
- *
- * If "mimetype" is non-NULL, it should point to a pointer allocated
- * with emalloc(). If a charset is added, the string will be
- * re-allocated and the new length is returned. If mimetype is
- * unchanged, 0 is returned.
- *
- */
-SAPI_API size_t sapi_apply_default_charset(char **mimetype, size_t len SLS_DC)
-{
- char *charset, *newtype;
- size_t newlen;
- charset = SG(default_charset) ? SG(default_charset) : SAPI_DEFAULT_CHARSET;
-
- if (*charset && strncmp(*mimetype, "text/", 5) == 0 && strstr(*mimetype, "charset=") == NULL) {
- newlen = len + (sizeof(";charset=")-1) + strlen(charset);
- newtype = emalloc(newlen + 1);
- PHP_STRLCPY(newtype, *mimetype, newlen + 1, len);
- strlcat(newtype, ";charset=", newlen + 1);
- if (*mimetype != NULL) {
- efree(*mimetype);
- }
- *mimetype = newtype;
- return newlen;
- }
- return 0;
-}
-
-
-/*
- * Called from php_request_startup() for every request.
- */
-SAPI_API void sapi_activate(SLS_D)
-{
- zend_llist_init(&SG(sapi_headers).headers, sizeof(sapi_header_struct), (void (*)(void *)) sapi_free_header, 0);
- SG(sapi_headers).send_default_content_type = 1;
-
- /*
- SG(sapi_headers).http_response_code = 200;
- */
- SG(sapi_headers).http_status_line = NULL;
- SG(headers_sent) = 0;
- SG(read_post_bytes) = 0;
- SG(request_info).post_data = NULL;
- SG(request_info).current_user = NULL;
- SG(request_info).current_user_length = 0;
- SG(request_info).no_headers = 0;
-
- /* It's possible to override this general case in the activate() callback, if
- * necessary.
- */
- if (SG(request_info).request_method && !strcmp(SG(request_info).request_method, "HEAD")) {
- SG(request_info).headers_only = 1;
- } else {
- SG(request_info).headers_only = 0;
- }
- SG(rfc1867_uploaded_files) = NULL;
-
- if (SG(server_context)) {
- if (SG(request_info).request_method
- && !strcmp(SG(request_info).request_method, "POST")) {
- if (!SG(request_info).content_type) {
- sapi_module.sapi_error(E_WARNING, "No content-type in POST request");
- SG(request_info).content_type_dup = NULL;
- } else {
- sapi_read_post_data(SLS_C);
- }
- } else {
- SG(request_info).content_type_dup = NULL;
- }
- SG(request_info).cookie_data = sapi_module.read_cookies(SLS_C);
- if (sapi_module.activate) {
- sapi_module.activate(SLS_C);
- }
- }
-}
-
-
-SAPI_API void sapi_deactivate(SLS_D)
-{
- zend_llist_destroy(&SG(sapi_headers).headers);
- if (SG(request_info).post_data) {
- efree(SG(request_info).post_data);
- }
- if (SG(request_info).auth_user) {
- efree(SG(request_info).auth_user);
- }
- if (SG(request_info).auth_password) {
- efree(SG(request_info).auth_password);
- }
- if (SG(request_info).content_type_dup) {
- efree(SG(request_info).content_type_dup);
- }
- if (SG(request_info).current_user) {
- efree(SG(request_info).current_user);
- }
- if (sapi_module.deactivate) {
- sapi_module.deactivate(SLS_C);
- }
- if (SG(rfc1867_uploaded_files)) {
- destroy_uploaded_files_hash(SLS_C);
- }
-}
-
-
-SAPI_API void sapi_initialize_empty_request(SLS_D)
-{
- SG(server_context) = NULL;
- SG(request_info).request_method = NULL;
- SG(request_info).auth_user = SG(request_info).auth_password = NULL;
- SG(request_info).content_type_dup = NULL;
-}
-
-
-static int sapi_extract_response_code(const char *header_line)
-{
- int code = 200;
- const char *ptr;
-
- for (ptr = header_line; *ptr; ptr++) {
- if (*ptr == ' ' && *(ptr + 1) != ' ') {
- code = atoi(ptr + 1);
- break;
- }
- }
-
- return code;
-}
-
-/* This function expects a *duplicated* string, that was previously emalloc()'d.
- * Pointers sent to this functions will be automatically freed by the framework.
- */
-SAPI_API int sapi_add_header_ex(char *header_line, uint header_line_len, zend_bool duplicate, zend_bool replace)
-{
- int retval, free_header = 0;
- sapi_header_struct sapi_header;
- char *colon_offset;
- SLS_FETCH();
-
- if (SG(headers_sent) && !SG(request_info).no_headers) {
- char *output_start_filename = php_get_output_start_filename();
- int output_start_lineno = php_get_output_start_lineno();
-
- if (output_start_filename) {
- sapi_module.sapi_error(E_WARNING, "Cannot add header information - headers already sent by (output started at %s:%d)",
- output_start_filename, output_start_lineno);
- } else {
- sapi_module.sapi_error(E_WARNING, "Cannot add header information - headers already sent");
- }
- if (!duplicate) {
- efree(header_line);
- }
- return FAILURE;
- }
-
- if (duplicate) {
- header_line = estrndup(header_line, header_line_len);
- }
-
- /* cut of trailing spaces, linefeeds and carriage-returns */
- while(isspace(header_line[header_line_len-1]))
- header_line[--header_line_len]='\0';
-
-
- sapi_header.header = header_line;
- sapi_header.header_len = header_line_len;
- sapi_header.replace = replace;
-
- /* Check the header for a few cases that we have special support for in SAPI */
- if (header_line_len>=5
- && !strncasecmp(header_line, "HTTP/", 5)) {
- /* filter out the response code */
- SG(sapi_headers).http_response_code = sapi_extract_response_code(header_line);
- SG(sapi_headers).http_status_line = header_line;
- return SUCCESS;
- } else {
- colon_offset = strchr(header_line, ':');
- if (colon_offset) {
- *colon_offset = 0;
- if (!STRCASECMP(header_line, "Content-Type")) {
- char *ptr = colon_offset, *mimetype = NULL, *newheader;
- size_t len = header_line_len - (ptr - header_line), newlen;
- while (*ptr == ' ' && *ptr != '\0') {
- ptr++;
- }
- mimetype = estrdup(ptr);
- newlen = sapi_apply_default_charset(&mimetype, len SLS_CC);
- if (newlen != 0) {
- newlen += sizeof("Content-type: ");
- newheader = emalloc(newlen);
- PHP_STRLCPY(newheader, "Content-type: ", newlen, sizeof("Content-type: ")-1);
- strlcat(newheader, mimetype, newlen);
- sapi_header.header = newheader;
- sapi_header.header_len = newlen - 1;
- colon_offset = strchr(newheader, ':');
- *colon_offset = '\0';
- free_header = 1;
- }
- efree(mimetype);
- SG(sapi_headers).send_default_content_type = 0;
- } else if (!STRCASECMP(header_line, "Location")) {
- if (SG(sapi_headers).http_response_code < 300 ||
- SG(sapi_headers).http_response_code > 307) {
- /* Return a Found Redirect if one is not already specified */
- SG(sapi_headers).http_response_code = 302;
- }
- } else if (!STRCASECMP(header_line, "WWW-Authenticate")) { /* HTTP Authentication */
- SG(sapi_headers).http_response_code = 401; /* authentication-required */
- }
- *colon_offset = ':';
- }
- }
-
- if (sapi_module.header_handler) {
- retval = sapi_module.header_handler(&sapi_header, &SG(sapi_headers) SLS_CC);
- } else {
- retval = SAPI_HEADER_ADD;
- }
- if (retval & SAPI_HEADER_DELETE_ALL) {
- zend_llist_clean(&SG(sapi_headers).headers);
- }
- if (retval & SAPI_HEADER_ADD) {
- zend_llist_add_element(&SG(sapi_headers).headers, (void *) &sapi_header);
- }
- if (free_header) {
- efree(sapi_header.header);
- }
- return SUCCESS;
-}
-
-
-SAPI_API int sapi_send_headers()
-{
- int retval;
- int ret = FAILURE;
- SLS_FETCH();
-
- if (SG(headers_sent) || SG(request_info).no_headers) {
- return SUCCESS;
- }
-
- /* Success-oriented. We set headers_sent to 1 here to avoid an infinite loop
- * in case of an error situation.
- */
- SG(headers_sent) = 1;
-
- if (sapi_module.send_headers) {
- retval = sapi_module.send_headers(&SG(sapi_headers) SLS_CC);
- } else {
- retval = SAPI_HEADER_DO_SEND;
- }
-
- switch (retval) {
- case SAPI_HEADER_SENT_SUCCESSFULLY:
- ret = SUCCESS;
- break;
- case SAPI_HEADER_DO_SEND:
- if (SG(sapi_headers).http_status_line) {
- sapi_header_struct http_status_line;
-
- http_status_line.header = SG(sapi_headers).http_status_line;
- http_status_line.header_len = strlen(SG(sapi_headers).http_status_line);
- sapi_module.send_header(&http_status_line, SG(server_context));
- }
- zend_llist_apply_with_argument(&SG(sapi_headers).headers, (void (*)(void *, void *)) sapi_module.send_header, SG(server_context));
- if(SG(sapi_headers).send_default_content_type) {
- sapi_header_struct default_header;
-
- sapi_get_default_content_type_header(&default_header SLS_CC);
- sapi_module.send_header(&default_header, SG(server_context));
- sapi_free_header(&default_header);
- }
- sapi_module.send_header(NULL, SG(server_context));
- ret = SUCCESS;
- break;
- case SAPI_HEADER_SEND_FAILED:
- SG(headers_sent) = 0;
- ret = FAILURE;
- break;
- }
-
- if (SG(sapi_headers).http_status_line) {
- efree(SG(sapi_headers).http_status_line);
- }
-
- return ret;
-}
-
-
-SAPI_API int sapi_register_post_entries(sapi_post_entry *post_entries)
-{
- sapi_post_entry *p=post_entries;
-
- while (p->content_type) {
- if (sapi_register_post_entry(p)==FAILURE) {
- return FAILURE;
- }
- p++;
- }
- return SUCCESS;
-}
-
-
-SAPI_API int sapi_register_post_entry(sapi_post_entry *post_entry)
-{
- return zend_hash_add(&known_post_content_types, post_entry->content_type, post_entry->content_type_len+1, (void *) post_entry, sizeof(sapi_post_entry), NULL);
-}
-
-SAPI_API void sapi_unregister_post_entry(sapi_post_entry *post_entry)
-{
- zend_hash_del(&known_post_content_types, post_entry->content_type, post_entry->content_type_len+1);
-}
-
-
-SAPI_API int sapi_register_default_post_reader(void (*default_post_reader)(SLS_D))
-{
- sapi_module.default_post_reader = default_post_reader;
- return SUCCESS;
-}
-
-
-SAPI_API int sapi_flush()
-{
- if (sapi_module.flush) {
- SLS_FETCH();
-
- sapi_module.flush(SG(server_context));
- return SUCCESS;
- } else {
- return FAILURE;
- }
-}
-
-SAPI_API struct stat *sapi_get_stat()
-{
- SLS_FETCH();
-
- if (sapi_module.get_stat) {
- return sapi_module.get_stat(SLS_C);
- } else {
- if (!SG(request_info).path_translated || (VCWD_STAT(SG(request_info).path_translated, &SG(global_stat))==-1)) {
- return NULL;
- }
- return &SG(global_stat);
- }
-}
-
-
-SAPI_API char *sapi_getenv(char *name, size_t name_len)
-{
- if (sapi_module.getenv) {
- SLS_FETCH();
-
- return sapi_module.getenv(name, name_len SLS_CC);
- } else {
- return NULL;
- }
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/main/SAPI.h b/main/SAPI.h
deleted file mode 100644
index a9ce5922ae..0000000000
--- a/main/SAPI.h
+++ /dev/null
@@ -1,235 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-
-#ifndef SAPI_H
-#define SAPI_H
-
-#include "zend.h"
-#include "zend_llist.h"
-#include "zend_operators.h"
-#include <sys/stat.h>
-
-#define SAPI_OPTION_NO_CHDIR 1
-
-#define SAPI_POST_BLOCK_SIZE 4000
-
-#ifdef PHP_WIN32
-# ifdef SAPI_EXPORTS
-# define SAPI_API __declspec(dllexport)
-# else
-# define SAPI_API __declspec(dllimport)
-# endif
-#else
-#define SAPI_API
-#endif
-
-
-typedef struct {
- char *header;
- uint header_len;
- zend_bool replace;
-} sapi_header_struct;
-
-
-typedef struct {
- zend_llist headers;
- int http_response_code;
- unsigned char send_default_content_type;
- char *http_status_line;
-} sapi_headers_struct;
-
-
-typedef struct _sapi_post_entry sapi_post_entry;
-typedef struct _sapi_module_struct sapi_module_struct;
-
-
-extern SAPI_API sapi_module_struct sapi_module; /* true global */
-
-/* Some values in this structure needs to be filled in before
- * calling sapi_activate(). We WILL change the `char *' entries,
- * so make sure that you allocate a separate buffer for them
- * and that you free them after sapi_deactivate().
- */
-
-typedef struct {
- const char *request_method;
- char *query_string;
- char *post_data;
- char *cookie_data;
- long content_length;
- uint post_data_length;
-
- char *path_translated;
- char *request_uri;
-
- const char *content_type;
-
- zend_bool headers_only;
- zend_bool no_headers;
-
- sapi_post_entry *post_entry;
-
- char *content_type_dup;
-
- /* for HTTP authentication */
- char *auth_user;
- char *auth_password;
-
- /* this is necessary for the CGI SAPI module */
- char *argv0;
-
- /* this is necessary for Safe Mode */
- char *current_user;
- int current_user_length;
-} sapi_request_info;
-
-
-typedef struct {
- void *server_context;
- sapi_request_info request_info;
- sapi_headers_struct sapi_headers;
- int read_post_bytes;
- unsigned char headers_sent;
- struct stat global_stat;
- char *default_mimetype;
- char *default_charset;
- HashTable *rfc1867_uploaded_files;
- long post_max_size;
- int options;
-} sapi_globals_struct;
-
-
-#ifdef ZTS
-# define SLS_D sapi_globals_struct *sapi_globals
-# define SLS_DC , SLS_D
-# define SLS_C sapi_globals
-# define SLS_CC , SLS_C
-# define SG(v) (sapi_globals->v)
-# define SLS_FETCH() sapi_globals_struct *sapi_globals = ts_resource(sapi_globals_id)
-SAPI_API extern int sapi_globals_id;
-#else
-# define SLS_D void
-# define SLS_DC
-# define SLS_C
-# define SLS_CC
-# define SG(v) (sapi_globals.v)
-# define SLS_FETCH()
-extern SAPI_API sapi_globals_struct sapi_globals;
-#endif
-
-
-SAPI_API void sapi_startup(sapi_module_struct *sf);
-SAPI_API void sapi_shutdown(void);
-SAPI_API void sapi_activate(SLS_D);
-SAPI_API void sapi_deactivate(SLS_D);
-SAPI_API void sapi_initialize_empty_request(SLS_D);
-
-SAPI_API int sapi_add_header_ex(char *header_line, uint header_line_len, zend_bool duplicate, zend_bool replace);
-#define sapi_add_header(header_line, header_line_len, duplicate) \
- sapi_add_header_ex((header_line), (header_line_len), (duplicate), 1)
-SAPI_API int sapi_send_headers(void);
-SAPI_API void sapi_free_header(sapi_header_struct *sapi_header);
-SAPI_API void sapi_handle_post(void *arg SLS_DC);
-
-SAPI_API int sapi_register_post_entries(sapi_post_entry *post_entry);
-SAPI_API int sapi_register_post_entry(sapi_post_entry *post_entry);
-SAPI_API void sapi_unregister_post_entry(sapi_post_entry *post_entry);
-SAPI_API int sapi_register_default_post_reader(void (*default_post_reader)(SLS_D));
-
-SAPI_API int sapi_flush(void);
-SAPI_API struct stat *sapi_get_stat(void);
-SAPI_API char *sapi_getenv(char *name, size_t name_len);
-
-SAPI_API char *sapi_get_default_content_type(SLS_D);
-SAPI_API void sapi_get_default_content_type_header(sapi_header_struct *default_header SLS_DC);
-SAPI_API size_t sapi_apply_default_charset(char **mimetype, size_t len SLS_DC);
-
-struct _sapi_module_struct {
- char *name;
- char *pretty_name;
-
- int (*startup)(struct _sapi_module_struct *sapi_module);
- int (*shutdown)(struct _sapi_module_struct *sapi_module);
-
- int (*activate)(SLS_D);
- int (*deactivate)(SLS_D);
-
- int (*ub_write)(const char *str, unsigned int str_length);
- void (*flush)(void *server_context);
- struct stat *(*get_stat)(SLS_D);
- char *(*getenv)(char *name, size_t name_len SLS_DC);
-
- void (*sapi_error)(int type, const char *error_msg, ...);
-
- int (*header_handler)(sapi_header_struct *sapi_header, sapi_headers_struct *sapi_headers SLS_DC);
- int (*send_headers)(sapi_headers_struct *sapi_headers SLS_DC);
- void (*send_header)(sapi_header_struct *sapi_header, void *server_context);
-
- int (*read_post)(char *buffer, uint count_bytes SLS_DC);
- char *(*read_cookies)(SLS_D);
-
- void (*register_server_variables)(zval *track_vars_array ELS_DC SLS_DC PLS_DC);
- void (*log_message)(char *message);
-
- char *php_ini_path_override;
-
- void (*block_interruptions)(void);
- void (*unblock_interruptions)(void);
-
- void (*default_post_reader)(SLS_D);
-};
-
-
-struct _sapi_post_entry {
- char *content_type;
- uint content_type_len;
- void (*post_reader)(SLS_D);
- void (*post_handler)(char *content_type_dup, void *arg SLS_DC);
-};
-
-/* header_handler() constants */
-#define SAPI_HEADER_ADD (1<<0)
-#define SAPI_HEADER_DELETE_ALL (1<<1)
-#define SAPI_HEADER_SEND_NOW (1<<2)
-
-
-#define SAPI_HEADER_SENT_SUCCESSFULLY 1
-#define SAPI_HEADER_DO_SEND 2
-#define SAPI_HEADER_SEND_FAILED 3
-
-#define SAPI_DEFAULT_MIMETYPE "text/html"
-#define SAPI_DEFAULT_CHARSET ""
-#define SAPI_PHP_VERSION_HEADER "X-Powered-By: PHP/" PHP_VERSION
-
-#define SAPI_POST_READER_FUNC(post_reader) SAPI_API void post_reader(SLS_D)
-#define SAPI_POST_HANDLER_FUNC(post_handler) SAPI_API void post_handler(char *content_type_dup, void *arg SLS_DC)
-
-SAPI_POST_READER_FUNC(sapi_read_standard_form_data);
-SAPI_POST_READER_FUNC(php_default_post_reader);
-
-#define STANDARD_SAPI_MODULE_PROPERTIES NULL
-
-#endif /* SAPI_H */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/main/alloca.c b/main/alloca.c
deleted file mode 100644
index faba929ef8..0000000000
--- a/main/alloca.c
+++ /dev/null
@@ -1,499 +0,0 @@
-/* alloca.c -- allocate automatically reclaimed memory
- (Mostly) portable public-domain implementation -- D A Gwyn
-
- This implementation of the PWB library alloca function,
- which is used to allocate space off the run-time stack so
- that it is automatically reclaimed upon procedure exit,
- was inspired by discussions with J. Q. Johnson of Cornell.
- J.Otto Tennant <jot@cray.com> contributed the Cray support.
-
- There are some preprocessor constants that can
- be defined when compiling for your specific system, for
- improved efficiency; however, the defaults should be okay.
-
- The general concept of this implementation is to keep
- track of all alloca-allocated blocks, and reclaim any
- that are found to be deeper in the stack than the current
- invocation. This heuristic does not reclaim storage as
- soon as it becomes invalid, but it will do so eventually.
-
- As a special case, alloca(0) reclaims storage without
- allocating any. It is a good idea to use alloca(0) in
- your main control loop, etc. to force garbage collection. */
-
-#include "php_config.h"
-
-#if !HAVE_ALLOCA
-
-#ifdef HAVE_STRING_H
-#include <string.h>
-#endif
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
-
-#ifdef emacs
-#include "blockinput.h"
-#endif
-
-/* If compiling with GCC 2, this file's not needed. */
-#if !defined (__GNUC__) || __GNUC__ < 2
-
-/* If someone has defined alloca as a macro,
- there must be some other way alloca is supposed to work. */
-#ifndef alloca
-
-#ifdef emacs
-#ifdef static
-/* actually, only want this if static is defined as ""
- -- this is for usg, in which emacs must undefine static
- in order to make unexec workable
- */
-#ifndef STACK_DIRECTION
-you
-lose
--- must know STACK_DIRECTION at compile-time
-#endif /* STACK_DIRECTION undefined */
-#endif /* static */
-#endif /* emacs */
-
-/* If your stack is a linked list of frames, you have to
- provide an "address metric" ADDRESS_FUNCTION macro. */
-
-#if defined (CRAY) && defined (CRAY_STACKSEG_END)
-long i00afunc ();
-#define ADDRESS_FUNCTION(arg) (char *) i00afunc (&(arg))
-#else
-#define ADDRESS_FUNCTION(arg) &(arg)
-#endif
-
-#if __STDC__
-typedef void *pointer;
-#else
-typedef char *pointer;
-#endif
-
-#ifndef NULL
-#define NULL 0
-#endif
-
-/* Define STACK_DIRECTION if you know the direction of stack
- growth for your system; otherwise it will be automatically
- deduced at run-time.
-
- STACK_DIRECTION > 0 => grows toward higher addresses
- STACK_DIRECTION < 0 => grows toward lower addresses
- STACK_DIRECTION = 0 => direction of growth unknown */
-
-#ifndef STACK_DIRECTION
-#define STACK_DIRECTION 0 /* Direction unknown. */
-#endif
-
-#if STACK_DIRECTION != 0
-
-#define STACK_DIR STACK_DIRECTION /* Known at compile-time. */
-
-#else /* STACK_DIRECTION == 0; need run-time code. */
-
-static int stack_dir; /* 1 or -1 once known. */
-#define STACK_DIR stack_dir
-
-static void
-find_stack_direction ()
-{
- static char *addr = NULL; /* Address of first `dummy', once known. */
- auto char dummy; /* To get stack address. */
-
- if (addr == NULL)
- { /* Initial entry. */
- addr = ADDRESS_FUNCTION (dummy);
-
- find_stack_direction (); /* Recurse once. */
- }
- else
- {
- /* Second entry. */
- if (ADDRESS_FUNCTION (dummy) > addr)
- stack_dir = 1; /* Stack grew upward. */
- else
- stack_dir = -1; /* Stack grew downward. */
- }
-}
-
-#endif /* STACK_DIRECTION == 0 */
-
-/* An "alloca header" is used to:
- (a) chain together all alloca'ed blocks;
- (b) keep track of stack depth.
-
- It is very important that sizeof(header) agree with malloc
- alignment chunk size. The following default should work okay. */
-
-#ifndef ALIGN_SIZE
-#define ALIGN_SIZE sizeof(double)
-#endif
-
-typedef union hdr
-{
- char align[ALIGN_SIZE]; /* To force sizeof(header). */
- struct
- {
- union hdr *next; /* For chaining headers. */
- char *deep; /* For stack depth measure. */
- } h;
-} header;
-
-static header *last_alloca_header = NULL; /* -> last alloca header. */
-
-/* Return a pointer to at least SIZE bytes of storage,
- which will be automatically reclaimed upon exit from
- the procedure that called alloca. Originally, this space
- was supposed to be taken from the current stack frame of the
- caller, but that method cannot be made to work for some
- implementations of C, for example under Gould's UTX/32. */
-
-pointer
-alloca (size)
- size_t size;
-{
- auto char probe; /* Probes stack depth: */
- register char *depth = ADDRESS_FUNCTION (probe);
-
-#if STACK_DIRECTION == 0
- if (STACK_DIR == 0) /* Unknown growth direction. */
- find_stack_direction ();
-#endif
-
- /* Reclaim garbage, defined as all alloca'd storage that
- was allocated from deeper in the stack than currently. */
-
- {
- register header *hp; /* Traverses linked list. */
-
-#ifdef emacs
- BLOCK_INPUT;
-#endif
-
- for (hp = last_alloca_header; hp != NULL;)
- if ((STACK_DIR > 0 && hp->h.deep > depth)
- || (STACK_DIR < 0 && hp->h.deep < depth))
- {
- register header *np = hp->h.next;
-
- free ((pointer) hp); /* Collect garbage. */
-
- hp = np; /* -> next header. */
- }
- else
- break; /* Rest are not deeper. */
-
- last_alloca_header = hp; /* -> last valid storage. */
-
-#ifdef emacs
- UNBLOCK_INPUT;
-#endif
- }
-
- if (size == 0)
- return NULL; /* No allocation required. */
-
- /* Allocate combined header + user data storage. */
-
- {
- register pointer new = malloc (sizeof (header) + size);
- /* Address of header. */
-
- if (new == 0)
- abort();
-
- ((header *) new)->h.next = last_alloca_header;
- ((header *) new)->h.deep = depth;
-
- last_alloca_header = (header *) new;
-
- /* User storage begins just after header. */
-
- return (pointer) ((char *) new + sizeof (header));
- }
-}
-
-#if defined (CRAY) && defined (CRAY_STACKSEG_END)
-
-#ifdef DEBUG_I00AFUNC
-#include <stdio.h>
-#endif
-
-#ifndef CRAY_STACK
-#define CRAY_STACK
-#ifndef CRAY2
-/* Stack structures for CRAY-1, CRAY X-MP, and CRAY Y-MP */
-struct stack_control_header
- {
- long shgrow:32; /* Number of times stack has grown. */
- long shaseg:32; /* Size of increments to stack. */
- long shhwm:32; /* High water mark of stack. */
- long shsize:32; /* Current size of stack (all segments). */
- };
-
-/* The stack segment linkage control information occurs at
- the high-address end of a stack segment. (The stack
- grows from low addresses to high addresses.) The initial
- part of the stack segment linkage control information is
- 0200 (octal) words. This provides for register storage
- for the routine which overflows the stack. */
-
-struct stack_segment_linkage
- {
- long ss[0200]; /* 0200 overflow words. */
- long sssize:32; /* Number of words in this segment. */
- long ssbase:32; /* Offset to stack base. */
- long:32;
- long sspseg:32; /* Offset to linkage control of previous
- segment of stack. */
- long:32;
- long sstcpt:32; /* Pointer to task common address block. */
- long sscsnm; /* Private control structure number for
- microtasking. */
- long ssusr1; /* Reserved for user. */
- long ssusr2; /* Reserved for user. */
- long sstpid; /* Process ID for pid based multi-tasking. */
- long ssgvup; /* Pointer to multitasking thread giveup. */
- long sscray[7]; /* Reserved for Cray Research. */
- long ssa0;
- long ssa1;
- long ssa2;
- long ssa3;
- long ssa4;
- long ssa5;
- long ssa6;
- long ssa7;
- long sss0;
- long sss1;
- long sss2;
- long sss3;
- long sss4;
- long sss5;
- long sss6;
- long sss7;
- };
-
-#else /* CRAY2 */
-/* The following structure defines the vector of words
- returned by the STKSTAT library routine. */
-struct stk_stat
- {
- long now; /* Current total stack size. */
- long maxc; /* Amount of contiguous space which would
- be required to satisfy the maximum
- stack demand to date. */
- long high_water; /* Stack high-water mark. */
- long overflows; /* Number of stack overflow ($STKOFEN) calls. */
- long hits; /* Number of internal buffer hits. */
- long extends; /* Number of block extensions. */
- long stko_mallocs; /* Block allocations by $STKOFEN. */
- long underflows; /* Number of stack underflow calls ($STKRETN). */
- long stko_free; /* Number of deallocations by $STKRETN. */
- long stkm_free; /* Number of deallocations by $STKMRET. */
- long segments; /* Current number of stack segments. */
- long maxs; /* Maximum number of stack segments so far. */
- long pad_size; /* Stack pad size. */
- long current_address; /* Current stack segment address. */
- long current_size; /* Current stack segment size. This
- number is actually corrupted by STKSTAT to
- include the fifteen word trailer area. */
- long initial_address; /* Address of initial segment. */
- long initial_size; /* Size of initial segment. */
- };
-
-/* The following structure describes the data structure which trails
- any stack segment. I think that the description in 'asdef' is
- out of date. I only describe the parts that I am sure about. */
-
-struct stk_trailer
- {
- long this_address; /* Address of this block. */
- long this_size; /* Size of this block (does not include
- this trailer). */
- long unknown2;
- long unknown3;
- long link; /* Address of trailer block of previous
- segment. */
- long unknown5;
- long unknown6;
- long unknown7;
- long unknown8;
- long unknown9;
- long unknown10;
- long unknown11;
- long unknown12;
- long unknown13;
- long unknown14;
- };
-
-#endif /* CRAY2 */
-#endif /* not CRAY_STACK */
-
-#ifdef CRAY2
-/* Determine a "stack measure" for an arbitrary ADDRESS.
- I doubt that "lint" will like this much. */
-
-static long
-i00afunc (long *address)
-{
- struct stk_stat status;
- struct stk_trailer *trailer;
- long *block, size;
- long result = 0;
-
- /* We want to iterate through all of the segments. The first
- step is to get the stack status structure. We could do this
- more quickly and more directly, perhaps, by referencing the
- $LM00 common block, but I know that this works. */
-
- STKSTAT (&status);
-
- /* Set up the iteration. */
-
- trailer = (struct stk_trailer *) (status.current_address
- + status.current_size
- - 15);
-
- /* There must be at least one stack segment. Therefore it is
- a fatal error if "trailer" is null. */
-
- if (trailer == 0)
- abort ();
-
- /* Discard segments that do not contain our argument address. */
-
- while (trailer != 0)
- {
- block = (long *) trailer->this_address;
- size = trailer->this_size;
- if (block == 0 || size == 0)
- abort ();
- trailer = (struct stk_trailer *) trailer->link;
- if ((block <= address) && (address < (block + size)))
- break;
- }
-
- /* Set the result to the offset in this segment and add the sizes
- of all predecessor segments. */
-
- result = address - block;
-
- if (trailer == 0)
- {
- return result;
- }
-
- do
- {
- if (trailer->this_size <= 0)
- abort ();
- result += trailer->this_size;
- trailer = (struct stk_trailer *) trailer->link;
- }
- while (trailer != 0);
-
- /* We are done. Note that if you present a bogus address (one
- not in any segment), you will get a different number back, formed
- from subtracting the address of the first block. This is probably
- not what you want. */
-
- return (result);
-}
-
-#else /* not CRAY2 */
-/* Stack address function for a CRAY-1, CRAY X-MP, or CRAY Y-MP.
- Determine the number of the cell within the stack,
- given the address of the cell. The purpose of this
- routine is to linearize, in some sense, stack addresses
- for alloca. */
-
-static long
-i00afunc (long address)
-{
- long stkl = 0;
-
- long size, pseg, this_segment, stack;
- long result = 0;
-
- struct stack_segment_linkage *ssptr;
-
- /* Register B67 contains the address of the end of the
- current stack segment. If you (as a subprogram) store
- your registers on the stack and find that you are past
- the contents of B67, you have overflowed the segment.
-
- B67 also points to the stack segment linkage control
- area, which is what we are really interested in. */
-
- stkl = CRAY_STACKSEG_END ();
- ssptr = (struct stack_segment_linkage *) stkl;
-
- /* If one subtracts 'size' from the end of the segment,
- one has the address of the first word of the segment.
-
- If this is not the first segment, 'pseg' will be
- nonzero. */
-
- pseg = ssptr->sspseg;
- size = ssptr->sssize;
-
- this_segment = stkl - size;
-
- /* It is possible that calling this routine itself caused
- a stack overflow. Discard stack segments which do not
- contain the target address. */
-
- while (!(this_segment <= address && address <= stkl))
- {
-#ifdef DEBUG_I00AFUNC
- fprintf (stderr, "%011o %011o %011o\n", this_segment, address, stkl);
-#endif
- if (pseg == 0)
- break;
- stkl = stkl - pseg;
- ssptr = (struct stack_segment_linkage *) stkl;
- size = ssptr->sssize;
- pseg = ssptr->sspseg;
- this_segment = stkl - size;
- }
-
- result = address - this_segment;
-
- /* If you subtract pseg from the current end of the stack,
- you get the address of the previous stack segment's end.
- This seems a little convoluted to me, but I'll bet you save
- a cycle somewhere. */
-
- while (pseg != 0)
- {
-#ifdef DEBUG_I00AFUNC
- fprintf (stderr, "%011o %011o\n", pseg, size);
-#endif
- stkl = stkl - pseg;
- ssptr = (struct stack_segment_linkage *) stkl;
- size = ssptr->sssize;
- pseg = ssptr->sspseg;
- result += size;
- }
- return (result);
-}
-
-#endif /* not CRAY2 */
-#endif /* CRAY */
-
-#endif /* no alloca */
-#endif /* not GCC version 2 */
-#endif /* HAVE_ALLOCA */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/main/build-defs.h.in b/main/build-defs.h.in
deleted file mode 100644
index 58e3d4a209..0000000000
--- a/main/build-defs.h.in
+++ /dev/null
@@ -1,88 +0,0 @@
-/* -*- C -*-
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Stig Sæther Bakken <ssb@fast.no> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#define CONFIGURE_COMMAND "@CONFIGURE_COMMAND@"
-#define PHP_ADA_INCLUDE ""
-#define PHP_ADA_LFLAGS ""
-#define PHP_ADA_LIBS ""
-#define PHP_APACHE_INCLUDE ""
-#define PHP_APACHE_TARGET ""
-#define PHP_FHTTPD_INCLUDE ""
-#define PHP_FHTTPD_LIB ""
-#define PHP_FHTTPD_TARGET ""
-#define PHP_CFLAGS "@CFLAGS@"
-#define PHP_DBASE_LIB ""
-#define PHP_BUILD_DEBUG "@DEBUG_CFLAGS@"
-#define PHP_GDBM_INCLUDE ""
-#define PHP_HSREGEX ""
-#define PHP_IBASE_INCLUDE ""
-#define PHP_IBASE_LFLAGS ""
-#define PHP_IBASE_LIBS ""
-#define PHP_IFX_INCLUDE ""
-#define PHP_IFX_LFLAGS ""
-#define PHP_IFX_LIBS ""
-#define PHP_INSTALL_IT "@INSTALL_IT@"
-#define PHP_IODBC_INCLUDE ""
-#define PHP_IODBC_LFLAGS ""
-#define PHP_IODBC_LIBS ""
-#define PHP_MSQL_INCLUDE ""
-#define PHP_MSQL_LFLAGS ""
-#define PHP_MSQL_LIBS ""
-#define PHP_MYSQL_INCLUDE "@MYSQL_INCLUDE@"
-#define PHP_MYSQL_LIBS "@MYSQL_LIBS@"
-#define PHP_MYSQL_TYPE "@MYSQL_MODULE_TYPE@"
-#define PHP_ODBC_INCLUDE "@ODBC_INCLUDE@"
-#define PHP_ODBC_LFLAGS "@ODBC_LFLAGS@"
-#define PHP_ODBC_LIBS "@ODBC_LIBS@"
-#define PHP_ODBC_TYPE "@ODBC_TYPE@"
-#define PHP_OCI8_SHARED_LIBADD "@OCI8_SHARED_LIBADD@"
-#define PHP_OCI8_DIR "@OCI8_DIR@"
-#define PHP_OCI8_VERSION "@OCI8_VERSION@"
-#define PHP_ORACLE_SHARED_LIBADD "@ORACLE_SHARED_LIBADD@"
-#define PHP_ORACLE_DIR "@ORACLE_DIR@"
-#define PHP_ORACLE_VERSION "@ORACLE_VERSION@"
-#define PHP_PGSQL_INCLUDE ""
-#define PHP_PGSQL_LFLAGS ""
-#define PHP_PGSQL_LIBS ""
-#define PHP_PROG_SENDMAIL "@PROG_SENDMAIL@"
-#define PHP_REGEX_LIB ""
-#define PHP_SOLID_INCLUDE ""
-#define PHP_SOLID_LIBS ""
-#define PHP_EMPRESS_INCLUDE ""
-#define PHP_EMPRESS_LIBS ""
-#define PHP_SYBASE_INCLUDE ""
-#define PHP_SYBASE_LFLAGS ""
-#define PHP_SYBASE_LIBS ""
-#define PHP_DBM_TYPE ""
-#define PHP_DBM_LIB ""
-#define PHP_LDAP_LFLAGS ""
-#define PHP_LDAP_INCLUDE ""
-#define PHP_LDAP_LIBS ""
-#define PHP_VELOCIS_INCLUDE ""
-#define PHP_VELOCIS_LIBS ""
-#define PEAR_INSTALLDIR "@EXPANDED_PEAR_INSTALLDIR@"
-#define PHP_INCLUDE_PATH "@INCLUDE_PATH@"
-#define PHP_EXTENSION_DIR "@EXPANDED_EXTENSION_DIR@"
-#define PHP_BINDIR "@EXPANDED_BINDIR@"
-#define PHP_LIBDIR "@EXPANDED_LIBDIR@"
-#define PHP_DATADIR "@EXPANDED_DATADIR@"
-#define PHP_SYSCONFDIR "@EXPANDED_SYSCONFDIR@"
-#define PHP_LOCALSTATEDIR "@EXPANDED_LOCALSTATEDIR@"
-#define PHP_CONFIG_FILE_PATH "@EXPANDED_PHP_CONFIG_FILE_PATH@"
diff --git a/main/config.w32.h b/main/config.w32.h
deleted file mode 100644
index 0290096126..0000000000
--- a/main/config.w32.h
+++ /dev/null
@@ -1,336 +0,0 @@
-/* config.w32.h. Configure file for win32 platforms */
-/* tested only with MS Visual C++ V6 */
-
-
-/* Define if PHP to setup it's own SIGCHLD handler (not needed on Win32) */
-#define PHP_SIGCHILD 0
-
-/* if you have resolv.lib and lib44bsd95.lib you can compile the extra
- dns functions located in dns.c. Set this to 1. add resolv.lib and
- lib33bsd95.lib to the project settings, and add the path to the
- bind include directory to the preprocessor settings. These libs
- are availabe in the ntbind distribution */
-#define HAVE_LIBBIND 1
-
-/* set to enable bcmath */
-#define WITH_BCMATH 1
-
-/* set to enable mysql */
-#define HAVE_MYSQL 1
-
-/* set to enable FTP support */
-#define HAVE_FTP 1
-
-/* set to enable bundled PCRE library */
-#define HAVE_BUNDLED_PCRE 1
-
-/* set to enable bundled expat library */
-#define HAVE_LIBEXPAT 1
-#define HAVE_WDDX 1
-
-/* set to enable the crypt command */
-#define HAVE_CRYPT 0
-
-/* set to enable trans sid */
-#define TRANS_SID 1
-
-/* set to enable force cgi redirect */
-#define FORCE_CGI_REDIRECT 0
-
-/* should be added to runtime config*/
-#define PHP_URL_FOPEN 1
-
-#define STDIN_FILENO 0
-#define STDOUT_FILENO 1
-#define STDERR_FILENO 2
-
-/* ----------------------------------------------------------------
- The following are defaults for run-time configuration
- ---------------------------------------------------------------*/
-
-#define PHP_SAFE_MODE 0
-#define MAGIC_QUOTES 0
-/* This is the default configuration file to read */
-#define CONFIGURATION_FILE_PATH "php.ini"
-#define USE_CONFIG_FILE 1
-
-#define PHP_INCLUDE_PATH NULL
-
-
-/* Undefine if you want stricter XML/SGML compliance by default */
-/* this disables "<?expression?>" and "<?=expression?>" */
-#define DEFAULT_SHORT_OPEN_TAG "1"
-
-
-/* ----------------------------------------------------------------
- The following defines are for those modules which require
- external libraries to compile. These will be removed from
- here in a future beta, as these modules will be moved out to dll's
- ---------------------------------------------------------------*/
-#define HAVE_ERRMSG_H 0 /*needed for mysql 3.21.17 and up*/
-#undef HAVE_ADABAS
-#undef HAVE_SOLID
-
-
-/* ----------------------------------------------------------------
- The following may or may not be (or need to be) ported to the
- windows environment.
- ---------------------------------------------------------------*/
-
-/* Define if you have the link function. */
-#undef HAVE_LINK
-
-/* Define if you have the lockf function. */
-/* #undef HAVE_LOCKF */
-
-/* Define if you have the lrand48 function. */
-/* #undef HAVE_LRAND48 */
-
-/* Define if you have the srand48 function. */
-/* #undef HAVE_SRAND48 */
-
-/* Define if you have the symlink function. */
-#undef HAVE_SYMLINK
-
-/* Define if you have the usleep function. */
-#undef HAVE_USLEEP
-
-
-#define HAVE_GETCWD 1
-#define HAVE_POSIX_READDIR_R 1
-
-#define NEED_ISBLANK 1
-/* ----------------------------------------------------------------
- The following may be changed and played with right now, but
- will move to the "don't touch" list below eventualy.
- ---------------------------------------------------------------*/
-
-
-/* ----------------------------------------------------------------
- The following should never need to be played with
- Functions defined to 0 or remarked out are either already
- handled by the standard VC libraries, or are no longer needed, or
- simply will/can not be ported.
-
- DONT TOUCH!!!!! Unless you realy know what your messing with!
- ---------------------------------------------------------------*/
-
-#define DISCARD_PATH 0
-#undef HAVE_SETITIMER
-#undef HAVE_IODBC
-#define HAVE_UODBC 1
-#define HAVE_LIBDL 1
-#define HAVE_SENDMAIL 1
-#define HAVE_GETTIMEOFDAY 1
-#define HAVE_PUTENV 1
-#define HAVE_LIMITS_H 1
-
-#define HAVE_TZSET 1
-/* Define if you have the flock function. */
-#undef HAVE_FLOCK
-
-/* Define if using alloca.c. */
-/* #undef C_ALLOCA */
-
-/* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems.
- This function is required for alloca.c support on those systems. */
-/* #undef CRAY_STACKSEG_END */
-
-/* Define to `int' if <sys/types.h> doesn't define. */
-/* #undef gid_t */
-
-/* Define if you have alloca, as a function or macro. */
-#define HAVE_ALLOCA 1
-
-/* Define if you have <alloca.h> and it should be used (not on Ultrix). */
-/* #undef HAVE_ALLOCA_H */
-
-/* Define if you have <sys/time.h> */
-#undef HAVE_SYS_TIME_H
-
-/* Define if you have <signal.h> */
-#define HAVE_SIGNAL_H 1
-
-/* Define if you don't have vprintf but do have _doprnt. */
-/* #undef HAVE_DOPRNT */
-
-/* Define if your struct stat has st_blksize. */
-#undef HAVE_ST_BLKSIZE
-
-/* Define if your struct stat has st_blocks. */
-#undef HAVE_ST_BLOCKS
-
-/* Define if your struct stat has st_rdev. */
-#define HAVE_ST_RDEV 1
-
-/* Define if utime(file, NULL) sets file's timestamp to the present. */
-#define HAVE_UTIME_NULL 1
-
-/* Define if you have the vprintf function. */
-#define HAVE_VPRINTF 1
-
-/* Define to `unsigned' if <sys/types.h> doesn't define. */
-/* #undef size_t */
-
-/* If using the C implementation of alloca, define if you know the
- direction of stack growth for your system; otherwise it will be
- automatically deduced at run-time.
- STACK_DIRECTION > 0 => grows toward higher addresses
- STACK_DIRECTION < 0 => grows toward lower addresses
- STACK_DIRECTION = 0 => direction of growth unknown
- */
-/* #undef STACK_DIRECTION */
-
-/* Define if you have the ANSI C header files. */
-#define STDC_HEADERS 1
-
-/* Define if your <sys/time.h> declares struct tm. */
-/* #undef TM_IN_SYS_TIME */
-
-/* Define to `int' if <sys/types.h> doesn't define. */
-/* #undef uid_t */
-
-/* Define both of these if you want the bundled REGEX library */
-#define REGEX 1
-#define HSREGEX 1
-
-#define HAVE_PCRE 1
-
-/* Define if you have the gcvt function. */
-#define HAVE_GCVT 1
-
-/* Define if you have the getlogin function. */
-#define HAVE_GETLOGIN 1
-
-/* Define if you have the gettimeofday function. */
-#define HAVE_GETTIMEOFDAY 1
-
-/* Define if you have the memcpy function. */
-#define HAVE_MEMCPY 1
-
-/* Define if you have the strlcat function. */
-/* #undef HAVE_STRLCAT */
-
-/* Define if you have the strlcpy function. */
-/* #undef HAVE_STRLCPY */
-
-/* Define if you have the memmove function. */
-#define HAVE_MEMMOVE 1
-
-/* Define if you have the putenv function. */
-#define HAVE_PUTENV 1
-
-/* Define if you have the regcomp function. */
-#define HAVE_REGCOMP 1
-
-/* Define if you have the setlocale function. */
-#define HAVE_SETLOCALE 1
-
-#define HAVE_LOCALECONV 1
-
-#define HAVE_LOCALE_H 1
-
-/* Define if you have the setvbuf function. */
-#ifndef HAVE_LIBBIND
-#define HAVE_SETVBUF 1
-#endif
-
-/* Define if you have the snprintf function. */
-#define HAVE_SNPRINTF 1
-#define HAVE_VSNPRINTF 1
-/* Define if you have the strcasecmp function. */
-#define HAVE_STRCASECMP 1
-
-/* Define if you have the strdup function. */
-#define HAVE_STRDUP 1
-
-/* Define if you have the strerror function. */
-#define HAVE_STRERROR 1
-
-/* Define if you have the strstr function. */
-#define HAVE_STRSTR 1
-
-/* Define if you have the tempnam function. */
-#define HAVE_TEMPNAM 1
-
-/* Define if you have the utime function. */
-#define HAVE_UTIME 1
-
-/* Define if you have the <crypt.h> header file. */
-/* #undef HAVE_CRYPT_H */
-
-/* Define if you have the <dirent.h> header file. */
-#undef HAVE_DIRENT_H
-
-/* Define if you have the <fcntl.h> header file. */
-#define HAVE_FCNTL_H 1
-
-/* Define if you have the <grp.h> header file. */
-#define HAVE_GRP_H 0
-
-/* Define if you have the <ndir.h> header file. */
-/* #undef HAVE_NDIR_H */
-
-/* Define if you have the <pwd.h> header file. */
-#define HAVE_PWD_H 1
-
-/* Define if you have the <string.h> header file. */
-#define HAVE_STRING_H 1
-
-/* Define if you have the <sys/dir.h> header file. */
-/* #undef HAVE_SYS_DIR_H */
-
-/* Define if you have the <sys/file.h> header file. */
-#undef HAVE_SYS_FILE_H
-
-/* Define if you have the <sys/ndir.h> header file. */
-/* #undef HAVE_SYS_NDIR_H */
-
-/* Define if you have the <sys/socket.h> header file. */
-#undef HAVE_SYS_SOCKET_H
-
-/* Define if you have the <sys/wait.h> header file. */
-#undef HAVE_SYS_WAIT_H
-
-/* Define if you have the <syslog.h> header file. */
-#define HAVE_SYSLOG_H 1
-
-/* Define if you have the <unistd.h> header file. */
-#undef HAVE_UNISTD_H
-
-/* Define if you have the crypt library (-lcrypt). */
-/* #undef HAVE_LIBCRYPT */
-
-/* Define if you have the dl library (-ldl). */
-#define HAVE_LIBDL 1
-
-/* Define if you have the m library (-lm). */
-#define HAVE_LIBM 1
-
-/* Define if you have the nsl library (-lnsl). */
-/* #undef HAVE_LIBNSL */
-
-/* Define if you have the socket library (-lsocket). */
-/* #undef HAVE_LIBSOCKET */
-
-/* Define if you have the cuserid function. */
-#define HAVE_CUSERID 0
-
-/* Define if you have the rint function. */
-#undef HAVE_RINT
-
-#define HAVE_STRFTIME 1
-
-/* Default directory for loading extensions. */
-#define PHP_EXTENSION_DIR NULL
-
-#define SIZEOF_INT 4
-
-/* Define directory constants for php and pear */
-#define PHP_BINDIR "c:\\php4"
-#define PHP_LIBDIR "c:\\php4"
-#define PHP_DATADIR "c:\\php4"
-#define PHP_SYSCONFDIR "c:\\php4"
-#define PHP_LOCALSTATEDIR "c:\\php4"
-#define PHP_CONFIG_FILE_PATH "c:\\winnt"
-#define PEAR_INSTALLDIR "c:\\php4\\pear"
diff --git a/main/fopen_wrappers.c b/main/fopen_wrappers.c
deleted file mode 100644
index f76ae1f88a..0000000000
--- a/main/fopen_wrappers.c
+++ /dev/null
@@ -1,587 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
- | Jim Winstead <jimw@php.net> |
- +----------------------------------------------------------------------+
- */
-/* $Id$ */
-
-/* {{{ includes
- */
-#include "php.h"
-#include "php_globals.h"
-#include "SAPI.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-
-#ifdef PHP_WIN32
-#include <windows.h>
-#include <winsock.h>
-#define O_RDONLY _O_RDONLY
-#include "win32/param.h"
-#else
-#include <sys/param.h>
-#endif
-
-#include "safe_mode.h"
-#include "ext/standard/head.h"
-#include "ext/standard/php_standard.h"
-#include "zend_compile.h"
-#include "php_network.h"
-
-#if HAVE_PWD_H
-#ifdef PHP_WIN32
-#include "win32/pwd.h"
-#else
-#include <pwd.h>
-#endif
-#endif
-
-#include <sys/types.h>
-#if HAVE_SYS_SOCKET_H
-#include <sys/socket.h>
-#endif
-
-#ifndef S_ISREG
-#define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG)
-#endif
-
-#ifdef PHP_WIN32
-#include <winsock.h>
-#else
-#include <netinet/in.h>
-#include <netdb.h>
-#if HAVE_ARPA_INET_H
-#include <arpa/inet.h>
-#endif
-#endif
-
-#ifdef PHP_WIN32
-#undef AF_UNIX
-#endif
-
-#if defined(AF_UNIX)
-#include <sys/un.h>
-#endif
-/* }}} */
-
-typedef FILE * (*php_fopen_url_wrapper_t) (const char *, char *, int, int *, int *, char **) ;
-
-static FILE *php_fopen_url_wrapper(const char *, char *, int, int *, int *, char **);
-
-PHPAPI char *expand_filepath(const char *filepath, char *real_path);
-
-
-HashTable fopen_url_wrappers_hash;
-
-/* {{{ php_register_url_wrapper
- */
-PHPAPI int php_register_url_wrapper(char *protocol, FILE * (*wrapper)(char *path, char *mode, int options, int *issock, int *socketd, char **opened_path))
-{
- PLS_FETCH();
-
- if(PG(allow_url_fopen)) {
- return zend_hash_add(&fopen_url_wrappers_hash, protocol, strlen(protocol), &wrapper, sizeof(wrapper), NULL);
- } else {
- return FAILURE;
- }
-}
-/* }}} */
-
-/* {{{ php_unregister_url_wrapper
- */
-PHPAPI int php_unregister_url_wrapper(char *protocol)
-{
- PLS_FETCH();
-
- if(PG(allow_url_fopen)) {
- return zend_hash_del(&fopen_url_wrappers_hash, protocol, strlen(protocol));
- } else {
- return SUCCESS;
- }
-}
-/* }}} */
-
-/* {{{ php_init_fopen_wrappers
- */
-int php_init_fopen_wrappers(void)
-{
- PLS_FETCH();
-
- if(PG(allow_url_fopen))
- return zend_hash_init(&fopen_url_wrappers_hash, 0, NULL, NULL, 1);
-
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ php_shutdown_fopen_wrappers
- */
-int php_shutdown_fopen_wrappers(void)
-{
- PLS_FETCH();
-
- if(PG(allow_url_fopen)) {
- zend_hash_destroy(&fopen_url_wrappers_hash);
- }
-
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ php_check_specific_open_basedir
- When open_basedir is not NULL, check if the given filename is located in
- open_basedir. Returns -1 if error or not in the open_basedir, else 0
-
- When open_basedir is NULL, always return 0
-*/
-PHPAPI int php_check_specific_open_basedir(char *basedir, char *path PLS_DC)
-{
- char resolved_name[MAXPATHLEN];
- char resolved_basedir[MAXPATHLEN];
- char local_open_basedir[MAXPATHLEN];
- int local_open_basedir_pos;
- SLS_FETCH();
-
- /* Special case basedir==".": Use script-directory */
- if ((strcmp(basedir, ".") == 0) &&
- SG(request_info).path_translated &&
- *SG(request_info).path_translated
- ) {
- strlcpy(local_open_basedir, SG(request_info).path_translated, sizeof(local_open_basedir));
- local_open_basedir_pos = strlen(local_open_basedir) - 1;
-
- /* Strip filename */
- while (!IS_SLASH(local_open_basedir[local_open_basedir_pos])
- && (local_open_basedir_pos >= 0)) {
- local_open_basedir[local_open_basedir_pos--] = 0;
- }
- } else {
- /* Else use the unmodified path */
- strlcpy(local_open_basedir, basedir, sizeof(local_open_basedir));
- }
-
- /* Resolve the real path into resolved_name */
- if ((expand_filepath(path, resolved_name) != NULL) && (expand_filepath(local_open_basedir, resolved_basedir) != NULL)) {
- /* Check the path */
-#ifdef PHP_WIN32
- if (strncasecmp(resolved_basedir, resolved_name, strlen(resolved_basedir)) == 0) {
-#else
- if (strncmp(resolved_basedir, resolved_name, strlen(resolved_basedir)) == 0) {
-#endif
- /* File is in the right directory */
- return 0;
- } else {
- return -1;
- }
- } else {
- /* Unable to resolve the real path, return -1 */
- return -1;
- }
-}
-/* }}} */
-
-/* {{{ php_check_open_basedir
- */
-PHPAPI int php_check_open_basedir(char *path)
-{
- PLS_FETCH();
-
- /* Only check when open_basedir is available */
- if (PG(open_basedir) && *PG(open_basedir)) {
- char *pathbuf;
- char *ptr;
- char *end;
-
- pathbuf = estrdup(PG(open_basedir));
-
- ptr = pathbuf;
-
- while (ptr && *ptr) {
-#ifdef PHP_WIN32
- end = strchr(ptr, ';');
-#else
- end = strchr(ptr, ':');
-#endif
- if (end != NULL) {
- *end = '\0';
- end++;
- }
-
- if (php_check_specific_open_basedir(ptr, path PLS_CC) == 0) {
- efree(pathbuf);
- return 0;
- }
-
- ptr = end;
- }
- php_error(E_WARNING, "open_basedir restriction in effect. File is in wrong directory");
- efree(pathbuf);
- errno = EPERM; /* we deny permission to open it */
- return -1;
- }
-
- /* Nothing to check... */
- return 0;
-}
-/* }}} */
-
-/* {{{ php_fopen_and_set_opened_path
- */
-static FILE *php_fopen_and_set_opened_path(const char *path, char *mode, char **opened_path)
-{
- FILE *fp;
-
- if (php_check_open_basedir((char *)path)) {
- return NULL;
- }
- fp = VCWD_FOPEN(path, mode);
- if (fp && opened_path) {
- *opened_path = expand_filepath(path,NULL);
- }
- return fp;
-}
-/* }}} */
-
-/* {{{ php_fopen_wrapper
- */
-PHPAPI FILE *php_fopen_wrapper(char *path, char *mode, int options, int *issock, int *socketd, char **opened_path)
-{
- PLS_FETCH();
-
- if(!path) return NULL;
- if(!*path) return NULL;
-
- if (opened_path) {
- *opened_path = NULL;
- }
-
- if(PG(allow_url_fopen)) {
- if (!(options & IGNORE_URL)) {
- return php_fopen_url_wrapper(path, mode, options, issock, socketd, opened_path);
- }
- }
-
- if (options & USE_PATH && PG(include_path) != NULL) {
- return php_fopen_with_path(path, mode, PG(include_path), opened_path);
- } else {
- if (options & ENFORCE_SAFE_MODE && PG(safe_mode) && (!php_checkuid(path, mode, CHECKUID_CHECK_MODE_PARAM))) {
- return NULL;
- }
- return php_fopen_and_set_opened_path(path, mode, opened_path);
- }
-}
-/* }}} */
-
-/* {{{ php_fopen_primary_script
- */
-PHPAPI FILE *php_fopen_primary_script(void)
-{
- FILE *fp;
- struct stat st;
- char *path_info, *filename;
- int length;
- PLS_FETCH();
- SLS_FETCH();
-
- filename = SG(request_info).path_translated;
- path_info = SG(request_info).request_uri;
-#if HAVE_PWD_H
- if (PG(user_dir) && *PG(user_dir)
- && path_info && '/' == path_info[0] && '~' == path_info[1]) {
-
- char user[32];
- struct passwd *pw;
- char *s = strchr(path_info + 2, '/');
-
- filename = NULL; /* discard the original filename, it must not be used */
- if (s) { /* if there is no path name after the file, do not bother */
- /* to try open the directory */
- length = s - (path_info + 2);
- if (length > sizeof(user) - 1)
- length = sizeof(user) - 1;
- memcpy(user, path_info + 2, length);
- user[length] = '\0';
-
- pw = getpwnam(user);
- if (pw && pw->pw_dir) {
- filename = emalloc(strlen(PG(user_dir)) + strlen(path_info) + strlen(pw->pw_dir) + 4);
- if (filename) {
- sprintf(filename, "%s%c%s%c%s", pw->pw_dir, PHP_DIR_SEPARATOR,
- PG(user_dir), PHP_DIR_SEPARATOR, s+1); /* Safe */
- STR_FREE(SG(request_info).path_translated);
- SG(request_info).path_translated = filename;
- }
- }
- }
- } else
-#endif
- if (PG(doc_root) && path_info) {
- length = strlen(PG(doc_root));
- if (IS_ABSOLUTE_PATH(PG(doc_root), length)) {
- filename = emalloc(length + strlen(path_info) + 2);
- if (filename) {
- memcpy(filename, PG(doc_root), length);
- if (!IS_SLASH(filename[length - 1])) { /* length is never 0 */
- filename[length++] = PHP_DIR_SEPARATOR;
- }
- if (IS_SLASH(path_info[0])) {
- length--;
- }
- strcpy(filename + length, path_info);
- STR_FREE(SG(request_info).path_translated);
- SG(request_info).path_translated = filename;
- }
- }
- } /* if doc_root && path_info */
-
- if (!filename) {
- /* we have to free SG(request_info).path_translated here because
- php_destroy_request_info assumes that it will get
- freed when the include_names hash is emptied, but
- we're not adding it in this case */
- STR_FREE(SG(request_info).path_translated);
- SG(request_info).path_translated = NULL;
- return NULL;
- }
- fp = VCWD_FOPEN(filename, "rb");
-
- /* refuse to open anything that is not a regular file */
- if (fp && (0 > fstat(fileno(fp), &st) || !S_ISREG(st.st_mode))) {
- fclose(fp);
- fp = NULL;
- }
- if (!fp) {
- php_error(E_ERROR, "Unable to open %s", filename);
- STR_FREE(SG(request_info).path_translated); /* for same reason as above */
- return NULL;
- }
- if (!(SG(options) & SAPI_OPTION_NO_CHDIR)) {
- VCWD_CHDIR_FILE(filename);
- }
- SG(request_info).path_translated = filename;
-
- return fp;
-}
-/* }}} */
-
-/* {{{ php_fopen_with_path
- * Tries to open a file with a PATH-style list of directories.
- * If the filename starts with "." or "/", the path is ignored.
- */
-PHPAPI FILE *php_fopen_with_path(char *filename, char *mode, char *path, char **opened_path)
-{
- char *pathbuf, *ptr, *end;
- char trypath[MAXPATHLEN];
- struct stat sb;
- FILE *fp;
- int filename_length;
- PLS_FETCH();
-
- if (opened_path) {
- *opened_path = NULL;
- }
-
- filename_length = strlen(filename);
-
- /* Absolute & relative path open */
- if ((*filename == '.') || (IS_ABSOLUTE_PATH(filename, filename_length))) {
- if (PG(safe_mode) && (!php_checkuid(filename, mode, CHECKUID_CHECK_MODE_PARAM))) {
- return NULL;
- }
- return php_fopen_and_set_opened_path(filename, mode, opened_path);
- }
-
- if (!path || (path && !*path)) {
- if (PG(safe_mode) && (!php_checkuid(filename, mode, CHECKUID_CHECK_MODE_PARAM))) {
- return NULL;
- }
- return php_fopen_and_set_opened_path(filename, mode, opened_path);
- }
- pathbuf = estrdup(path);
-
- ptr = pathbuf;
-
- while (ptr && *ptr) {
-#ifdef PHP_WIN32
- end = strchr(ptr, ';');
-#else
- end = strchr(ptr, ':');
-#endif
- if (end != NULL) {
- *end = '\0';
- end++;
- }
- snprintf(trypath, MAXPATHLEN, "%s/%s", ptr, filename);
- if (PG(safe_mode)) {
- if (VCWD_STAT(trypath, &sb) == 0 && (!php_checkuid(trypath, mode, CHECKUID_CHECK_MODE_PARAM))) {
- efree(pathbuf);
- return NULL;
- }
- }
- fp = php_fopen_and_set_opened_path(trypath, mode, opened_path);
- if (fp) {
- efree(pathbuf);
- return fp;
- }
- ptr = end;
- }
- efree(pathbuf);
- return NULL;
-}
-/* }}} */
-
-/* {{{ php_fopen_url_wrapper
- */
-static FILE *php_fopen_url_wrapper(const char *path, char *mode, int options, int *issock, int *socketd, char **opened_path)
-{
- FILE *fp = NULL;
- const char *p;
- const char *protocol=NULL;
- int n=0;
-
-
- for (p=path; isalnum((int)*p); p++) {
- n++;
- }
- if ((*p==':')&&(n>1)) {
- protocol=path;
- }
-
- if (protocol) {
- php_fopen_url_wrapper_t *wrapper=NULL;
-
- if (FAILURE==zend_hash_find(&fopen_url_wrappers_hash, (char *) protocol, n, (void **)&wrapper)) {
- wrapper=NULL;
- protocol=NULL;
- }
- if (wrapper) {
- return (*wrapper)(path, mode, options, issock, socketd, opened_path);
- }
- }
-
- if (!protocol || !strncasecmp(protocol, "file",n)){
- PLS_FETCH();
-
- *issock = 0;
-
- if(protocol) {
- if(path[n+1]=='/') {
- if(path[n+2]=='/') {
- php_error(E_WARNING, "remote host file access not supported, %s", path);
- return NULL;
- }
- }
- path+= n+1;
- }
-
- if (options & USE_PATH) {
- fp = php_fopen_with_path((char *) path, mode, PG(include_path), opened_path);
- } else {
- if (options & ENFORCE_SAFE_MODE && PG(safe_mode) && (!php_checkuid(path, mode, CHECKUID_CHECK_MODE_PARAM))) {
- fp = NULL;
- } else {
- fp = php_fopen_and_set_opened_path(path, mode, opened_path);
- }
- }
- return (fp);
- }
-
- php_error(E_WARNING, "Invalid URL specified, %s", path);
- return NULL;
-}
-/* }}} */
-
-/* {{{ php_strip_url_passwd
- */
-PHPAPI char *php_strip_url_passwd(char *url)
-{
- register char *p = url, *url_start;
-
- while (*p) {
- if (*p==':' && *(p+1)=='/' && *(p+2)=='/') {
- /* found protocol */
- url_start = p = p+3;
-
- while (*p) {
- if (*p=='@') {
- int i;
-
- for (i=0; i<3 && url_start<p; i++, url_start++) {
- *url_start = '.';
- }
- for (; *p; p++) {
- *url_start++ = *p;
- }
- *url_start=0;
- break;
- }
- p++;
- }
- return url;
- }
- p++;
- }
- return url;
-}
-/* }}} */
-
-/* {{{ expand_filepath
- */
-PHPAPI char *expand_filepath(const char *filepath, char *real_path)
-{
- cwd_state new_state;
- char cwd[MAXPATHLEN];
- char *result;
-
- result = VCWD_GETCWD(cwd, MAXPATHLEN);
- if (!result) {
- cwd[0] = '\0';
- }
-
- new_state.cwd = strdup(cwd);
- new_state.cwd_length = strlen(cwd);
-
- if(virtual_file_ex(&new_state, filepath, NULL)) {
- free(new_state.cwd);
- return NULL;
- }
-
- if(real_path) {
- int copy_len = new_state.cwd_length>MAXPATHLEN-1?MAXPATHLEN-1:new_state.cwd_length;
- memcpy(real_path,new_state.cwd,copy_len);
- real_path[copy_len]='\0';
- } else {
- real_path = estrndup(new_state.cwd, new_state.cwd_length);
- }
- free(new_state.cwd);
-
- return real_path;
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/main/fopen_wrappers.h b/main/fopen_wrappers.h
deleted file mode 100644
index 0bb7880608..0000000000
--- a/main/fopen_wrappers.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Jim Winstead <jimw@php.net> |
- +----------------------------------------------------------------------+
- */
-/* $Id$ */
-
-#ifndef FOPEN_WRAPPERS_H
-#define FOPEN_WRAPPERS_H
-
-#include "php_globals.h"
-
-#define IGNORE_PATH 0
-#define USE_PATH 1
-#define IGNORE_URL 2
-/* There's no USE_URL. */
-#ifdef PHP_WIN32
-# define IGNORE_URL_WIN 2
-#else
-# define IGNORE_URL_WIN 0
-#endif
-#define ENFORCE_SAFE_MODE 4
-
-#ifdef PHP_WIN32
-# define SOCK_ERR INVALID_SOCKET
-# define SOCK_CONN_ERR SOCKET_ERROR
-# define SOCK_RECV_ERR SOCKET_ERROR
-#else
-# define SOCK_ERR -1
-# define SOCK_CONN_ERR -1
-# define SOCK_RECV_ERR -1
-#endif
-#define SOCK_WRITE(d,s) send(s,d,strlen(d),0)
-#define SOCK_WRITEL(d,l,s) send(s,d,l,0)
-#define SOCK_FGETC(s) php_sock_fgetc((s))
-#define SOCK_FGETS(b,l,s) php_sock_fgets((b),(l),(s))
-#define SOCK_FEOF(sock) php_sock_feof((sock))
-#define SOCK_FREAD(ptr,size,sock) php_sock_fread((ptr),(size),(sock))
-#define SOCK_FCLOSE(s) php_sock_close(s)
-
-#define FP_FGETS(buf,len,sock,fp,issock) \
- ((issock)?SOCK_FGETS(buf,len,sock):fgets(buf,len,fp))
-#define FP_FREAD(buf,len,sock,fp,issock) \
- ((issock)?SOCK_FREAD(buf,len,sock):fread(buf,1,len,fp))
-#define FP_FEOF(sock,fp,issock) \
- ((issock)?SOCK_FEOF(sock):feof(fp))
-#define FP_FGETC(sock,fp,issock) \
- ((issock)?SOCK_FGETC(sock):fgetc(fp))
-
-/* values for issock */
-#define IS_NOT_SOCKET 0
-#define IS_SOCKET 1
-#define BAD_URL 2
-
-PHPAPI FILE *php_fopen_wrapper(char *filename, char *mode, int options, int *issock, int *socketd, char **opened_path);
-
-PHPAPI FILE *php_fopen_primary_script(void);
-
-PHPAPI int php_check_open_basedir(char *path);
-PHPAPI int php_check_specific_open_basedir(char *basedir, char *path PLS_DC);
-
-PHPAPI FILE *php_fopen_with_path(char *filename, char *mode, char *path, char **opened_path);
-
-PHPAPI int php_is_url(char *path);
-PHPAPI char *php_strip_url_passwd(char *path);
-
-
-int php_init_fopen_wrappers(void);
-int php_shutdown_fopen_wrappers(void);
-PHPAPI int php_register_url_wrapper(char *protocol, FILE * (*wrapper)(char *path, char *mode, int options, int *issock, int *socketd, char **opened_path));
-PHPAPI int php_unregister_url_wrapper(char *protocol);
-
-#endif
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/main/internal_functions.c.in b/main/internal_functions.c.in
deleted file mode 100644
index e304665c84..0000000000
--- a/main/internal_functions.c.in
+++ /dev/null
@@ -1,61 +0,0 @@
-/* -*- C -*-
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
- */
-
-
-/* $Id$ */
-
-#include "php.h"
-#include "php_main.h"
-#include "zend_modules.h"
-#include "internal_functions_registry.h"
-#include "zend_compile.h"
-#include <stdarg.h>
-#include <stdlib.h>
-#include <stdio.h>
-
-@EXT_INCLUDE_CODE@
-
-zend_module_entry *php_builtin_extensions[] = {
-@EXT_MODULE_PTRS@
-};
-
-#define EXTCOUNT (sizeof(php_builtin_extensions)/sizeof(zend_module_entry *))
-
-
-int php_startup_internal_extensions(void)
-{
- return php_startup_extensions(php_builtin_extensions, EXTCOUNT);
-}
-
-int php_global_startup_internal_extensions(void)
-{
- return php_global_startup_extensions(php_builtin_extensions, EXTCOUNT);
-}
-
-int php_global_shutdown_internal_extensions(void)
-{
- return php_global_shutdown_extensions(php_builtin_extensions, EXTCOUNT);
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/main/internal_functions_registry.h b/main/internal_functions_registry.h
deleted file mode 100644
index 3cc68943dc..0000000000
--- a/main/internal_functions_registry.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
- */
-
-
-/* $Id$ */
-
-#ifndef INTERNAL_FUNCTIONS_REGISTRY_H
-#define INTERNAL_FUNCTIONS_REGISTRY_H
-
-extern int php_init_mime(INIT_FUNC_ARGS);
-
-/* environment functions */
-extern int php_init_environment(void);
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/main/internal_functions_win32.c b/main/internal_functions_win32.c
deleted file mode 100644
index 61c42a9ca1..0000000000
--- a/main/internal_functions_win32.c
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
- */
-
-
-/* $Id$ */
-
-/* {{{ includes
- */
-#include "php.h"
-#include "php_main.h"
-#include "zend_modules.h"
-#include "internal_functions_registry.h"
-#include "zend_compile.h"
-#include <stdarg.h>
-#include <stdlib.h>
-#include <stdio.h>
-
-#include "ext/bcmath/php_bcmath.h"
-#include "ext/db/php_db.h"
-#include "ext/gd/php_gd.h"
-#include "ext/standard/dl.h"
-#include "ext/standard/file.h"
-#include "ext/standard/fsock.h"
-#include "ext/standard/head.h"
-#include "ext/standard/pack.h"
-#include "ext/standard/php_browscap.h"
-#include "ext/standard/php_crypt.h"
-#include "ext/standard/php_dir.h"
-#include "ext/standard/php_filestat.h"
-#include "ext/standard/php_mail.h"
-#include "ext/standard/php_ext_syslog.h"
-#include "ext/standard/php_standard.h"
-#include "ext/standard/php_lcg.h"
-#include "ext/standard/php_output.h"
-#include "ext/standard/php_array.h"
-#include "ext/standard/php_assert.h"
-#include "ext/calendar/php_calendar.h"
-#include "ext/com/php_COM.h"
-#include "ext/com/php_VARIANT.h"
-#include "ext/ftp/php_ftp.h"
-#include "ext/standard/reg.h"
-#include "ext/pcre/php_pcre.h"
-#include "ext/odbc/php_odbc.h"
-#include "ext/session/php_session.h"
-#include "ext/xml/php_xml.h"
-#include "ext/wddx/php_wddx.h"
-#include "ext/mysql/php_mysql.h"
-/* }}} */
-
-/* {{{ php_builtin_extensions[]
- */
-zend_module_entry *php_builtin_extensions[] = {
- phpext_standard_ptr,
-#if WITH_BCMATH
- phpext_bcmath_ptr,
-#endif
- phpext_calendar_ptr,
- COM_module_ptr,
- VARIANT_module_ptr,
- phpext_ftp_ptr,
- phpext_mysql_ptr,
- phpext_odbc_ptr,
- phpext_pcre_ptr,
- phpext_session_ptr,
- phpext_xml_ptr,
- phpext_wddx_ptr
-};
-/* }}} */
-
-#define EXTCOUNT (sizeof(php_builtin_extensions)/sizeof(zend_module_entry *))
-
-
-int php_startup_internal_extensions(void)
-{
- return php_startup_extensions(php_builtin_extensions, EXTCOUNT);
-}
-
-int php_global_startup_internal_extensions(void)
-{
- return php_global_startup_extensions(php_builtin_extensions, EXTCOUNT);
-}
-
-int php_global_shutdown_internal_extensions(void)
-{
- return php_global_shutdown_extensions(php_builtin_extensions, EXTCOUNT);
-}
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/main/logos.h b/main/logos.h
deleted file mode 100644
index 428cf6dc90..0000000000
--- a/main/logos.h
+++ /dev/null
@@ -1,1059 +0,0 @@
-#define CONTEXT_TYPE_IMAGE_GIF "Content-Type: image/gif"
-
-unsigned char zend_logo[] = {
- 71, 73, 70, 56, 57, 97, 100, 0, 58, 0,
- 247, 255, 0, 255, 255, 255, 8, 8, 8, 24,
- 24, 24, 57, 57, 57, 74, 74, 74, 90, 90,
- 90, 99, 99, 99, 123, 123, 123, 132, 132, 132,
- 140, 140, 140, 148, 148, 148, 189, 189, 189, 214,
- 214, 214, 231, 231, 231, 239, 239, 239, 90, 99,
- 99, 222, 231, 239, 57, 66, 74, 165, 173, 181,
- 0, 8, 16, 214, 222, 231, 57, 66, 82, 16,
- 33, 66, 0, 8, 24, 24, 41, 82, 222, 231,
- 255, 57, 66, 90, 198, 206, 231, 181, 189, 214,
- 99, 107, 132, 0, 8, 33, 189, 198, 231, 123,
- 132, 165, 148, 165, 231, 123, 140, 206, 123, 148,
- 239, 49, 66, 132, 24, 33, 66, 49, 74, 165,
- 214, 222, 255, 206, 214, 247, 181, 189, 222, 148,
- 156, 189, 123, 132, 173, 156, 173, 247, 132, 148,
- 214, 99, 115, 181, 49, 57, 90, 41, 49, 82,
- 90, 107, 181, 82, 99, 173, 24, 33, 74, 57,
- 82, 189, 49, 74, 173, 16, 24, 57, 8, 16,
- 49, 198, 206, 247, 181, 189, 231, 165, 173, 214,
- 99, 107, 148, 74, 82, 123, 140, 156, 239, 66,
- 74, 115, 115, 132, 222, 41, 49, 90, 57, 74,
- 165, 49, 66, 148, 49, 66, 156, 41, 57, 140,
- 57, 82, 206, 33, 49, 123, 57, 82, 214, 16,
- 24, 66, 198, 206, 255, 181, 189, 239, 189, 198,
- 255, 156, 165, 214, 140, 148, 198, 132, 140, 189,
- 115, 123, 173, 90, 99, 148, 132, 148, 247, 123,
- 140, 239, 107, 123, 214, 115, 132, 231, 57, 66,
- 115, 107, 123, 222, 115, 132, 239, 57, 66, 123,
- 99, 115, 214, 90, 107, 214, 74, 90, 181, 74,
- 90, 189, 66, 82, 173, 57, 74, 173, 49, 66,
- 165, 66, 90, 231, 49, 66, 173, 24, 33, 90,
- 41, 57, 156, 33, 49, 140, 8, 16, 66, 181,
- 189, 247, 165, 173, 231, 148, 156, 214, 132, 140,
- 198, 115, 123, 181, 82, 90, 148, 49, 57, 115,
- 99, 115, 231, 90, 107, 231, 82, 99, 214, 82,
- 99, 222, 74, 90, 206, 82, 99, 231, 66, 82,
- 189, 33, 41, 99, 57, 74, 189, 57, 74, 198,
- 57, 74, 206, 49, 66, 181, 41, 57, 165, 24,
- 33, 99, 16, 24, 82, 8, 16, 74, 173, 181,
- 247, 173, 181, 255, 165, 173, 247, 140, 148, 214,
- 156, 165, 239, 165, 173, 255, 156, 165, 247, 132,
- 140, 214, 140, 148, 231, 99, 107, 173, 107, 115,
- 189, 115, 123, 206, 123, 132, 222, 99, 107, 189,
- 82, 90, 165, 90, 99, 181, 74, 82, 156, 82,
- 90, 173, 90, 99, 189, 66, 74, 140, 57, 66,
- 140, 57, 66, 148, 41, 49, 115, 74, 90, 222,
- 74, 90, 231, 41, 49, 132, 66, 82, 222, 33,
- 41, 115, 33, 41, 123, 24, 33, 107, 24, 33,
- 123, 16, 24, 90, 148, 156, 247, 140, 148, 239,
- 132, 140, 231, 140, 148, 247, 132, 140, 239, 123,
- 132, 231, 107, 115, 206, 123, 132, 239, 123, 132,
- 247, 99, 107, 206, 99, 107, 214, 82, 90, 181,
- 90, 99, 206, 49, 57, 148, 41, 49, 148, 33,
- 41, 140, 239, 239, 247, 247, 247, 255, 198, 198,
- 206, 214, 214, 222, 173, 173, 181, 189, 189, 198,
- 148, 148, 156, 156, 156, 165, 231, 231, 247, 239,
- 239, 255, 173, 173, 189, 90, 90, 99, 231, 231,
- 255, 222, 222, 247, 140, 140, 156, 66, 66, 74,
- 132, 132, 148, 198, 198, 222, 123, 123, 140, 173,
- 173, 198, 107, 107, 123, 222, 222, 255, 57, 57,
- 66, 49, 49, 57, 156, 156, 181, 198, 198, 231,
- 140, 140, 165, 181, 181, 214, 90, 90, 107, 214,
- 214, 255, 165, 165, 198, 82, 82, 99, 123, 123,
- 148, 74, 74, 90, 115, 115, 140, 33, 33, 41,
- 99, 99, 123, 156, 156, 198, 90, 90, 115, 132,
- 132, 173, 173, 173, 231, 165, 165, 222, 24, 24,
- 33, 82, 82, 115, 156, 156, 222, 115, 115, 165,
- 57, 57, 82, 107, 107, 156, 123, 123, 181, 33,
- 33, 49, 156, 156, 231, 82, 82, 123, 49, 49,
- 74, 107, 107, 165, 74, 74, 115, 148, 148, 231,
- 57, 57, 90, 41, 41, 66, 82, 82, 132, 66,
- 66, 107, 132, 132, 214, 140, 140, 231, 99, 99,
- 165, 123, 123, 206, 66, 66, 115, 82, 82, 148,
- 123, 123, 222, 66, 66, 123, 8, 8, 16, 41,
- 41, 82, 49, 49, 99, 24, 24, 49, 41, 41,
- 90, 24, 24, 66, 8, 8, 24, 16, 16, 57,
- 8, 8, 41, 8, 8, 49, 8, 8, 57, 0,
- 0, 8, 0, 0, 16, 0, 0, 24, 0, 0,
- 0, 44, 0, 0, 0, 0, 100, 0, 58, 0,
- 0, 8, 255, 0, 255, 9, 28, 72, 176, 160,
- 193, 131, 8, 19, 42, 92, 200, 176, 161, 195,
- 135, 188, 146, 37, 131, 246, 176, 226, 193, 94,
- 188, 10, 6, 203, 104, 177, 99, 67, 99, 31,
- 140, 25, 75, 230, 177, 227, 200, 130, 39, 75,
- 170, 60, 104, 12, 87, 128, 103, 198, 40, 174,
- 108, 248, 1, 87, 193, 154, 51, 115, 10, 52,
- 198, 236, 31, 175, 15, 196, 124, 246, 58, 150,
- 17, 227, 203, 0, 2, 122, 9, 240, 121, 140,
- 232, 191, 94, 201, 130, 57, 229, 213, 148, 227,
- 63, 103, 199, 96, 218, 36, 104, 172, 89, 47,
- 140, 2, 159, 57, 19, 232, 236, 153, 206, 143,
- 199, 130, 33, 43, 118, 213, 216, 50, 96, 31,
- 4, 24, 139, 230, 204, 152, 179, 100, 198, 4,
- 240, 50, 166, 2, 88, 76, 144, 200, 144, 17,
- 53, 86, 12, 46, 69, 188, 133, 113, 114, 229,
- 11, 55, 104, 49, 14, 1, 226, 113, 56, 118,
- 150, 33, 72, 99, 207, 2, 252, 3, 70, 249,
- 222, 200, 98, 199, 122, 141, 236, 165, 226, 159,
- 138, 98, 206, 150, 113, 240, 92, 44, 192, 215,
- 211, 169, 145, 45, 93, 214, 235, 95, 128, 148,
- 3, 63, 4, 179, 13, 172, 54, 177, 145, 184,
- 140, 5, 173, 172, 176, 37, 87, 146, 255, 70,
- 23, 251, 0, 90, 119, 114, 99, 28, 158, 45,
- 197, 45, 50, 250, 210, 228, 200, 21, 15, 52,
- 254, 175, 169, 192, 99, 129, 41, 19, 255, 231,
- 103, 142, 31, 203, 158, 3, 139, 45, 227, 5,
- 19, 26, 94, 96, 204, 66, 82, 124, 187, 173,
- 236, 94, 244, 255, 150, 173, 103, 159, 177, 24,
- 178, 8, 120, 225, 183, 211, 49, 196, 224, 149,
- 76, 63, 252, 252, 6, 212, 66, 252, 152, 87,
- 145, 57, 30, 176, 132, 156, 64, 208, 112, 0,
- 82, 52, 255, 64, 163, 155, 0, 31, 44, 67,
- 33, 50, 74, 228, 128, 12, 52, 184, 85, 8,
- 24, 69, 208, 32, 35, 18, 78, 14, 254, 19,
- 82, 72, 102, 245, 211, 207, 63, 130, 49, 56,
- 163, 69, 48, 208, 115, 16, 52, 154, 17, 20,
- 0, 49, 215, 253, 131, 75, 60, 255, 108, 227,
- 141, 64, 252, 208, 163, 193, 112, 60, 22, 68,
- 204, 112, 3, 17, 3, 141, 0, 68, 182, 56,
- 37, 49, 247, 8, 116, 207, 5, 117, 89, 117,
- 80, 63, 19, 180, 248, 144, 61, 230, 204, 196,
- 15, 130, 252, 120, 83, 130, 152, 30, 177, 57,
- 80, 63, 30, 168, 224, 97, 66, 112, 186, 217,
- 208, 61, 224, 220, 168, 210, 4, 253, 204, 80,
- 142, 78, 13, 30, 196, 143, 7, 214, 96, 67,
- 103, 62, 122, 90, 196, 79, 59, 24, 204, 212,
- 79, 60, 232, 228, 3, 168, 157, 255, 240, 147,
- 143, 62, 148, 122, 224, 1, 165, 13, 149, 160,
- 205, 13, 156, 50, 228, 79, 62, 80, 72, 170,
- 83, 162, 5, 121, 80, 70, 62, 108, 242, 51,
- 65, 62, 155, 170, 255, 212, 15, 15, 226, 220,
- 224, 15, 159, 97, 226, 10, 230, 174, 97, 54,
- 24, 232, 160, 85, 156, 147, 37, 160, 168, 34,
- 233, 1, 31, 248, 120, 208, 107, 131, 23, 232,
- 147, 44, 167, 215, 228, 115, 77, 177, 72, 222,
- 144, 134, 19, 24, 224, 3, 171, 7, 247, 116,
- 219, 45, 183, 223, 198, 19, 79, 0, 174, 246,
- 67, 135, 33, 166, 2, 122, 129, 160, 249, 240,
- 177, 71, 62, 247, 140, 27, 192, 61, 250, 240,
- 161, 15, 181, 3, 221, 67, 79, 56, 229, 192,
- 96, 14, 168, 3, 241, 19, 128, 7, 108, 4,
- 98, 141, 59, 24, 216, 99, 195, 194, 12, 51,
- 76, 15, 61, 210, 114, 235, 129, 61, 46, 208,
- 17, 79, 168, 22, 249, 211, 42, 63, 55, 136,
- 161, 7, 18, 55, 72, 124, 195, 30, 72, 196,
- 202, 96, 60, 54, 148, 179, 195, 57, 155, 186,
- 26, 207, 61, 54, 72, 130, 130, 25, 138, 68,
- 194, 198, 36, 56, 231, 140, 51, 29, 98, 204,
- 96, 129, 13, 244, 76, 130, 134, 17, 218, 226,
- 235, 209, 5, 254, 20, 196, 207, 61, 248, 232,
- 145, 137, 30, 51, 148, 64, 143, 13, 30, 235,
- 67, 228, 67, 150, 142, 115, 142, 61, 19, 220,
- 35, 173, 13, 108, 120, 146, 203, 18, 158, 88,
- 49, 69, 22, 103, 79, 113, 202, 217, 169, 116,
- 65, 2, 29, 116, 44, 242, 13, 36, 249, 228,
- 179, 79, 62, 73, 43, 250, 101, 132, 72, 242,
- 255, 19, 143, 7, 72, 104, 194, 10, 17, 152,
- 96, 48, 131, 38, 152, 204, 224, 193, 197, 21,
- 45, 61, 79, 19, 240, 212, 51, 3, 6, 24,
- 24, 241, 67, 18, 174, 228, 146, 196, 18, 156,
- 115, 190, 249, 18, 130, 128, 194, 69, 23, 228,
- 152, 33, 9, 61, 209, 210, 83, 198, 13, 23,
- 152, 23, 232, 5, 30, 92, 19, 175, 140, 247,
- 132, 121, 177, 157, 253, 232, 179, 110, 131, 127,
- 95, 51, 3, 38, 171, 124, 177, 138, 17, 70,
- 168, 66, 7, 62, 215, 244, 26, 112, 131, 50,
- 226, 126, 13, 36, 213, 144, 19, 131, 36, 108,
- 64, 50, 133, 31, 185, 0, 0, 128, 43, 220,
- 111, 207, 125, 230, 126, 72, 177, 4, 14, 93,
- 248, 140, 4, 29, 152, 32, 206, 70, 21, 243,
- 200, 83, 78, 57, 219, 208, 115, 65, 60, 176,
- 75, 235, 79, 188, 189, 146, 75, 16, 63, 251,
- 232, 115, 143, 223, 250, 154, 129, 24, 44, 49,
- 4, 46, 60, 162, 17, 142, 24, 67, 61, 44,
- 128, 4, 120, 45, 235, 76, 19, 208, 212, 176,
- 12, 210, 143, 124, 96, 33, 16, 56, 240, 132,
- 41, 136, 113, 13, 1, 64, 163, 131, 83, 10,
- 161, 7, 71, 8, 141, 10, 173, 65, 18, 139,
- 64, 68, 54, 190, 145, 142, 67, 24, 129, 14,
- 51, 136, 161, 13, 22, 39, 174, 111, 105, 10,
- 92, 241, 242, 155, 175, 252, 182, 15, 36, 220,
- 205, 3, 55, 176, 128, 24, 255, 38, 65, 132,
- 24, 112, 224, 131, 196, 88, 132, 17, 48, 161,
- 135, 61, 36, 235, 30, 254, 64, 218, 61, 36,
- 72, 169, 165, 221, 192, 29, 223, 80, 70, 18,
- 130, 212, 144, 3, 228, 226, 15, 102, 248, 195,
- 33, 26, 177, 10, 34, 104, 98, 6, 72, 128,
- 88, 180, 174, 113, 13, 77, 229, 227, 6, 55,
- 88, 216, 195, 110, 208, 70, 111, 141, 235, 101,
- 251, 224, 4, 39, 98, 136, 129, 122, 16, 81,
- 8, 136, 128, 133, 102, 4, 16, 131, 49, 172,
- 34, 19, 154, 216, 195, 221, 46, 85, 55, 88,
- 5, 74, 80, 241, 200, 135, 5, 136, 48, 133,
- 36, 200, 164, 33, 3, 112, 133, 45, 146, 48,
- 10, 35, 120, 12, 19, 155, 96, 162, 24, 12,
- 103, 1, 123, 32, 97, 97, 37, 40, 193, 228,
- 48, 48, 202, 61, 76, 78, 106, 106, 236, 86,
- 62, 108, 160, 7, 77, 100, 2, 19, 153, 176,
- 4, 17, 134, 16, 132, 64, 106, 230, 26, 169,
- 192, 195, 42, 44, 161, 9, 78, 32, 161, 12,
- 251, 184, 193, 182, 254, 87, 197, 8, 218, 0,
- 3, 68, 24, 197, 53, 4, 114, 0, 90, 40,
- 64, 1, 214, 196, 102, 2, 122, 244, 143, 5,
- 0, 224, 15, 93, 152, 68, 61, 244, 64, 7,
- 75, 144, 161, 140, 150, 120, 33, 220, 198, 57,
- 78, 244, 101, 194, 8, 233, 92, 34, 220, 48,
- 144, 74, 160, 77, 13, 3, 182, 36, 3, 17,
- 86, 49, 255, 134, 47, 212, 160, 14, 63, 16,
- 228, 63, 4, 144, 5, 47, 172, 130, 137, 122,
- 68, 22, 188, 186, 165, 49, 133, 136, 139, 30,
- 208, 252, 196, 117, 24, 160, 73, 87, 120, 15,
- 0, 10, 24, 72, 1, 0, 224, 135, 57, 168,
- 179, 156, 252, 12, 131, 72, 195, 96, 130, 49,
- 8, 65, 8, 68, 72, 233, 42, 134, 240, 133,
- 48, 124, 1, 15, 97, 168, 193, 23, 136, 96,
- 137, 121, 174, 18, 19, 68, 24, 67, 30, 90,
- 234, 133, 158, 210, 32, 160, 154, 129, 70, 22,
- 194, 64, 4, 158, 113, 130, 100, 250, 192, 155,
- 140, 16, 148, 16, 129, 121, 109, 18, 159, 176,
- 69, 1, 8, 64, 0, 6, 36, 193, 15, 75,
- 224, 158, 50, 100, 209, 35, 1, 52, 64, 25,
- 169, 136, 196, 11, 49, 161, 203, 49, 132, 1,
- 15, 115, 136, 195, 35, 82, 193, 5, 60, 224,
- 161, 167, 117, 240, 66, 29, 236, 96, 135, 59,
- 164, 53, 21, 143, 216, 66, 35, 134, 64, 4,
- 156, 97, 2, 158, 121, 16, 41, 30, 234, 192,
- 133, 84, 164, 226, 13, 63, 104, 192, 32, 181,
- 16, 6, 98, 138, 225, 168, 253, 83, 214, 163,
- 152, 218, 212, 123, 148, 128, 17, 202, 88, 2,
- 10, 114, 193, 89, 63, 68, 97, 9, 0, 56,
- 65, 18, 134, 49, 16, 90, 184, 226, 10, 38,
- 176, 4, 206, 140, 144, 83, 19, 112, 225, 16,
- 211, 136, 192, 147, 152, 241, 4, 45, 255, 20,
- 225, 8, 69, 200, 130, 26, 180, 112, 132, 31,
- 104, 195, 25, 79, 170, 64, 52, 92, 224, 5,
- 33, 68, 66, 8, 47, 29, 108, 29, 70, 225,
- 4, 102, 12, 131, 24, 195, 152, 70, 44, 130,
- 154, 133, 47, 212, 84, 12, 123, 80, 100, 200,
- 226, 209, 60, 78, 249, 45, 31, 116, 168, 6,
- 14, 78, 225, 136, 69, 40, 34, 11, 109, 16,
- 196, 38, 205, 48, 139, 129, 16, 0, 0, 102,
- 224, 66, 95, 233, 48, 9, 18, 32, 247, 17,
- 29, 224, 162, 64, 152, 33, 2, 74, 180, 161,
- 25, 241, 56, 70, 19, 6, 96, 16, 1, 116,
- 96, 11, 255, 164, 171, 29, 226, 192, 4, 3,
- 112, 83, 32, 93, 29, 170, 37, 244, 128, 93,
- 146, 193, 138, 187, 143, 106, 230, 196, 214, 144,
- 132, 63, 160, 226, 164, 65, 208, 130, 25, 132,
- 225, 7, 65, 80, 96, 154, 3, 109, 64, 46,
- 74, 225, 5, 44, 76, 130, 172, 95, 152, 67,
- 58, 182, 114, 16, 98, 84, 163, 52, 182, 185,
- 218, 65, 162, 17, 135, 34, 220, 246, 13, 41,
- 240, 146, 65, 160, 97, 138, 26, 212, 116, 15,
- 144, 213, 135, 7, 118, 69, 89, 131, 44, 45,
- 31, 51, 88, 135, 25, 112, 80, 8, 68, 168,
- 227, 15, 73, 232, 195, 21, 212, 107, 128, 129,
- 40, 0, 0, 75, 40, 69, 28, 186, 16, 132,
- 71, 152, 226, 19, 228, 216, 141, 64, 226, 97,
- 128, 4, 32, 32, 255, 40, 1, 136, 5, 10,
- 40, 64, 128, 130, 16, 32, 1, 9, 192, 15,
- 63, 156, 112, 132, 75, 196, 161, 15, 248, 129,
- 70, 48, 20, 16, 140, 32, 9, 64, 11, 214,
- 213, 68, 133, 241, 161, 100, 127, 112, 247, 145,
- 78, 134, 147, 13, 230, 97, 8, 52, 152, 193,
- 12, 125, 72, 135, 35, 226, 224, 7, 87, 112,
- 85, 32, 196, 216, 222, 85, 253, 208, 135, 68,
- 252, 128, 173, 77, 232, 17, 47, 24, 144, 1,
- 205, 66, 160, 154, 56, 176, 130, 39, 40, 64,
- 96, 219, 208, 98, 108, 56, 104, 197, 116, 5,
- 130, 11, 55, 92, 34, 20, 18, 24, 136, 1,
- 40, 176, 1, 28, 216, 162, 1, 5, 160, 144,
- 41, 172, 107, 84, 69, 42, 25, 195, 77, 118,
- 114, 0, 250, 225, 53, 123, 204, 67, 156, 154,
- 216, 130, 25, 92, 161, 139, 225, 4, 224, 21,
- 218, 115, 69, 6, 250, 112, 138, 26, 212, 128,
- 6, 90, 232, 242, 63, 136, 225, 128, 64, 248,
- 186, 18, 159, 64, 1, 14, 220, 0, 6, 48,
- 4, 130, 22, 2, 33, 192, 18, 172, 64, 137,
- 74, 80, 1, 5, 25, 29, 168, 40, 42, 145,
- 3, 153, 48, 99, 3, 87, 168, 4, 37, 172,
- 128, 3, 197, 14, 84, 194, 154, 192, 64, 118,
- 35, 203, 221, 71, 51, 200, 101, 23, 160, 135,
- 17, 216, 161, 12, 205, 97, 72, 32, 193, 8,
- 119, 18, 72, 81, 4, 185, 114, 193, 20, 104,
- 255, 144, 137, 2, 62, 144, 182, 44, 200, 65,
- 14, 112, 0, 195, 37, 46, 209, 134, 93, 228,
- 91, 20, 245, 190, 4, 37, 164, 0, 129, 171,
- 165, 193, 10, 183, 128, 48, 7, 124, 61, 243,
- 75, 80, 129, 2, 65, 77, 69, 99, 233, 128,
- 100, 39, 42, 121, 169, 209, 174, 108, 61, 92,
- 96, 134, 19, 152, 161, 19, 77, 24, 136, 0,
- 28, 224, 10, 18, 183, 129, 176, 113, 240, 47,
- 1, 184, 25, 128, 178, 151, 29, 26, 33, 184,
- 132, 204, 213, 238, 6, 155, 255, 131, 0, 35,
- 152, 121, 191, 229, 128, 130, 90, 175, 96, 4,
- 1, 231, 69, 40, 212, 206, 247, 43, 8, 84,
- 0, 203, 46, 234, 99, 157, 173, 172, 71, 99,
- 140, 31, 54, 192, 130, 33, 206, 144, 229, 40,
- 148, 34, 10, 164, 21, 72, 44, 92, 177, 132,
- 78, 148, 66, 10, 140, 95, 66, 20, 164, 32,
- 100, 130, 8, 160, 26, 107, 151, 121, 27, 18,
- 144, 111, 82, 168, 93, 230, 149, 88, 66, 157,
- 255, 177, 130, 30, 32, 64, 32, 5, 104, 131,
- 204, 103, 47, 10, 129, 10, 245, 11, 47, 60,
- 234, 30, 86, 181, 56, 4, 69, 189, 32, 253,
- 192, 64, 19, 86, 152, 142, 31, 156, 162, 13,
- 109, 216, 129, 123, 1, 96, 11, 206, 157, 64,
- 24, 202, 16, 134, 43, 146, 16, 138, 206, 107,
- 253, 12, 106, 127, 185, 27, 174, 224, 118, 2,
- 72, 129, 18, 148, 224, 187, 255, 18, 86, 223,
- 122, 210, 251, 196, 215, 179, 55, 250, 223, 171,
- 251, 194, 236, 42, 116, 201, 221, 69, 72, 60,
- 110, 0, 133, 38, 184, 163, 10, 144, 112, 196,
- 90, 219, 160, 142, 235, 4, 128, 1, 218, 195,
- 124, 87, 245, 7, 125, 80, 11, 40, 16, 10,
- 178, 16, 11, 215, 129, 0, 177, 208, 128, 177,
- 176, 0, 125, 32, 7, 200, 87, 9, 96, 208,
- 118, 55, 151, 126, 151, 96, 6, 228, 23, 10,
- 177, 32, 16, 2, 240, 3, 51, 71, 123, 72,
- 55, 80, 169, 48, 4, 158, 52, 3, 72, 197,
- 45, 59, 36, 40, 212, 118, 14, 58, 208, 14,
- 51, 80, 5, 141, 176, 127, 165, 128, 31, 8,
- 176, 61, 2, 120, 2, 182, 80, 104, 2, 32,
- 1, 161, 48, 2, 102, 160, 110, 5, 96, 117,
- 75, 96, 6, 75, 48, 8, 161, 112, 5, 107,
- 87, 115, 249, 38, 5, 124, 167, 118, 26, 40,
- 16, 43, 112, 116, 87, 19, 13, 49, 199, 119,
- 84, 0, 1, 65, 245, 8, 145, 64, 7, 24,
- 128, 4, 72, 160, 100, 247, 64, 89, 110, 194,
- 60, 215, 112, 14, 213, 176, 14, 238, 112, 8,
- 234, 224, 9, 81, 48, 8, 108, 145, 111, 1,
- 200, 124, 39, 160, 61, 201, 246, 15, 180, 48,
- 8, 143, 183, 0, 3, 17, 12, 74, 112, 5,
- 110, 208, 6, 82, 64, 13, 221, 32, 7, 106,
- 55, 122, 55, 87, 116, 50, 55, 126, 2, 65,
- 13, 116, 255, 103, 126, 252, 176, 3, 68, 39,
- 7, 103, 96, 126, 132, 100, 4, 245, 128, 4,
- 140, 54, 134, 190, 98, 35, 55, 240, 4, 214,
- 128, 3, 40, 160, 12, 186, 32, 12, 181, 112,
- 73, 4, 16, 12, 6, 160, 138, 170, 184, 138,
- 50, 113, 107, 202, 208, 113, 119, 248, 15, 222,
- 16, 12, 218, 192, 13, 117, 22, 15, 210, 0,
- 7, 151, 96, 129, 111, 39, 10, 69, 167, 118,
- 125, 176, 122, 212, 112, 9, 61, 208, 10, 80,
- 18, 1, 59, 0, 2, 191, 16, 121, 235, 22,
- 3, 147, 48, 3, 16, 83, 59, 24, 179, 63,
- 150, 50, 3, 88, 224, 8, 136, 64, 8, 133,
- 208, 1, 21, 65, 11, 39, 240, 7, 161, 240,
- 9, 27, 0, 37, 67, 150, 13, 148, 160, 5,
- 110, 199, 11, 137, 64, 87, 113, 112, 4, 71,
- 16, 133, 255, 0, 2, 151, 0, 7, 31, 240,
- 10, 250, 69, 16, 241, 80, 12, 93, 128, 9,
- 22, 32, 59, 58, 134, 53, 93, 51, 75, 208,
- 164, 6, 22, 65, 11, 61, 64, 3, 65, 16,
- 4, 34, 192, 0, 2, 18, 37, 177, 240, 1,
- 71, 160, 5, 181, 241, 15, 3, 128, 8, 38,
- 240, 79, 62, 86, 13, 28, 1, 2, 240, 152,
- 5, 186, 240, 10, 181, 86, 16, 188, 32, 11,
- 136, 144, 7, 116, 80, 2, 139, 83, 141, 144,
- 228, 1, 244, 64, 2, 128, 48, 11, 5, 96,
- 0, 52, 89, 147, 54, 121, 147, 6, 255, 240,
- 10, 202, 176, 5, 186, 20, 4, 236, 0, 1,
- 177, 96, 0, 3, 80, 66, 5, 64, 11, 13,
- 144, 3, 169, 96, 7, 169, 112, 11, 52, 169,
- 0, 79, 112, 92, 95, 48, 87, 57, 160, 0,
- 52, 169, 2, 115, 32, 87, 89, 176, 1, 174,
- 64, 11, 5, 80, 66, 196, 96, 0, 177, 224,
- 11, 46, 96, 72, 116, 64, 15, 226, 194, 146,
- 210, 70, 15, 144, 208, 7, 228, 160, 3, 27,
- 176, 89, 22, 53, 135, 114, 201, 124, 40, 96,
- 12, 56, 96, 6, 142, 64, 7, 36, 176, 10,
- 143, 144, 13, 40, 160, 11, 181, 80, 11, 20,
- 128, 12, 135, 16, 4, 66, 96, 2, 142, 160,
- 3, 190, 224, 11, 28, 176, 6, 116, 0, 79,
- 253, 36, 2, 34, 97, 12, 78, 32, 4, 67,
- 160, 10, 95, 208, 5, 45, 240, 1, 186, 208,
- 10, 181, 0, 1, 41, 224, 4, 144, 128, 9,
- 100, 165, 7, 55, 240, 63, 109, 130, 50, 139,
- 96, 6, 139, 128, 1, 147, 224, 8, 160, 160,
- 12, 182, 240, 61, 180, 201, 61, 182, 144, 1,
- 127, 224, 8, 70, 32, 4, 132, 240, 7, 144,
- 128, 62, 171, 144, 7, 93, 32, 3, 50, 208,
- 8, 238, 96, 4, 171, 69, 60, 150, 224, 98,
- 243, 64, 7, 64, 0, 55, 172, 69, 4, 40,
- 133, 5, 99, 5, 79, 252, 20, 4, 142, 32,
- 3, 139, 224, 14, 108, 0, 55, 64, 32, 6,
- 233, 211, 64, 97, 255, 98, 17, 55, 48, 15,
- 238, 128, 6, 235, 80, 15, 11, 83, 15, 143,
- 96, 6, 185, 96, 11, 39, 16, 139, 242, 41,
- 159, 89, 150, 8, 150, 16, 53, 24, 192, 8,
- 103, 208, 8, 191, 179, 10, 100, 80, 83, 60,
- 83, 15, 125, 36, 6, 236, 100, 56, 62, 19,
- 67, 98, 0, 55, 152, 96, 83, 148, 163, 160,
- 240, 4, 160, 134, 83, 2, 63, 3, 134, 217,
- 85, 50, 104, 249, 15, 254, 160, 50, 220, 32,
- 14, 24, 112, 49, 94, 35, 6, 138, 176, 4,
- 154, 131, 105, 127, 80, 162, 38, 90, 162, 234,
- 208, 8, 245, 0, 49, 249, 80, 2, 144, 32,
- 2, 104, 132, 75, 122, 64, 74, 11, 99, 1,
- 22, 16, 67, 104, 36, 71, 83, 131, 4, 172,
- 68, 97, 72, 160, 48, 54, 96, 74, 24, 64,
- 78, 154, 64, 97, 51, 0, 52, 209, 178, 45,
- 30, 160, 15, 145, 197, 146, 23, 80, 14, 47,
- 176, 80, 174, 243, 55, 245, 128, 8, 162, 24,
- 8, 228, 64, 8, 234, 176, 165, 92, 170, 14,
- 233, 192, 8, 147, 176, 15, 220, 34, 46, 30,
- 0, 15, 80, 128, 15, 72, 160, 7, 31, 3,
- 71, 215, 160, 76, 55, 128, 15, 101, 112, 74,
- 110, 250, 166, 72, 224, 46, 21, 10, 71, 116,
- 138, 100, 106, 42, 6, 167,
- 4, 43, 221, 34, 47, 211, 6, 68, 254, 131,
- 49, 247, 16, 14, 124, 179, 63, 3, 83, 15,
- 104, 128, 2, 214, 255, 192, 14, 134, 96, 8,
- 235, 16, 169, 146, 186, 14, 80, 128, 14, 42,
- 121, 150, 126, 131, 15, 162, 89, 167, 198, 164,
- 76, 117, 3, 71, 61, 84, 6, 248, 0, 71,
- 111, 116, 3, 117, 154, 93, 36, 163, 45, 111,
- 234, 46, 122, 164, 71, 32, 67, 67, 191, 34,
- 16, 21, 148, 44, 191, 151, 47, 244, 80, 69,
- 247, 0, 5, 74, 144, 6, 231, 208, 14, 47,
- 80, 15, 47, 48, 15, 47, 16, 172, 243, 32,
- 172, 51, 112, 154, 14, 226, 58, 248, 0, 5,
- 108, 80, 161, 154, 114, 1, 223, 114, 41, 73,
- 245, 172, 83, 84, 55, 76, 250, 67, 83, 228,
- 1, 118, 83, 167, 238, 210, 64, 204, 116, 16,
- 23, 208, 72, 173, 243, 37, 183, 218, 84, 51,
- 224, 4, 91, 211, 72, 55, 36, 65, 235, 106,
- 113, 4, 209, 15, 123, 224, 14, 98, 128, 55,
- 227, 178, 67, 13, 18, 38, 228, 66, 46, 190,
- 18, 15, 19, 96, 120, 2, 243, 40, 110, 196,
- 45, 70, 83, 41, 174, 114, 63, 13, 165, 143,
- 215, 16, 42, 30, 176, 3, 232, 176, 146, 249,
- 154, 175, 13, 82, 118, 2, 3, 105, 111, 178,
- 15, 108, 208, 14, 172, 210, 56, 149, 34, 40,
- 145, 193, 93, 88, 179, 52, 209, 54, 176, 2,
- 33, 15, 207, 224, 1, 250, 170, 52, 27, 203,
- 32, 118, 99, 3, 225, 144, 46, 57, 225, 58,
- 23, 138, 36, 227, 137, 53, 227, 240, 2, 140,
- 61, 163, 18, 131, 146, 15, 220, 229, 13, 19,
- 100, 38, 20, 139, 53, 34, 171, 52, 224, 80,
- 14, 181, 90, 17, 21, 212, 58, 253, 48, 45,
- 47, 187, 130, 29, 241, 179, 10, 193, 15, 225,
- 16, 14, 183, 131, 36, 109, 2, 173, 14, 114,
- 179, 12, 225, 58, 78, 102, 175, 109, 226, 32,
- 1, 1, 0, 59 };
-
-unsigned char php_logo[] = {
- 71, 73, 70, 56, 57, 97, 130, 0, 67, 0,
- 213, 255, 0, 0, 0, 0, 48, 47, 49, 2,
- 2, 3, 7, 7, 10, 152, 152, 203, 153, 153,
- 204, 150, 150, 200, 147, 147, 195, 3, 3, 4,
- 91, 91, 105, 164, 164, 178, 69, 69, 73, 196,
- 196, 206, 141, 142, 189, 136, 137, 180, 152, 153,
- 187, 101, 103, 134, 126, 129, 172, 176, 178, 205,
- 25, 26, 36, 49, 52, 73, 33, 35, 49, 69,
- 73, 100, 82, 88, 127, 111, 119, 168, 201, 204,
- 221, 81, 95, 159, 85, 99, 163, 97, 105, 147,
- 13, 14, 19, 162, 169, 205, 183, 189, 220, 88,
- 103, 165, 92, 106, 169, 90, 104, 165, 91, 105,
- 166, 95, 110, 172, 102, 115, 174, 93, 105, 158,
- 139, 150, 197, 148, 158, 202, 219, 221, 229, 192,
- 192, 192, 2, 2, 1, 3, 3, 2, 7, 7,
- 6, 15, 15, 14, 133, 133, 131, 152, 152, 151,
- 114, 113, 110, 5, 4, 3, 20, 19, 18, 31,
- 30, 29, 39, 38, 37, 10, 9, 9, 25, 24,
- 24, 61, 60, 60, 183, 183, 183, 81, 81, 81,
- 12, 12, 12, 5, 5, 5, 1, 1, 1, 255,
- 255, 255, 0, 0, 0, 33, 249, 4, 1, 0,
- 0, 42, 0, 44, 0, 0, 0, 0, 130, 0,
- 67, 0, 64, 6, 255, 64, 149, 112, 72, 44,
- 26, 143, 200, 100, 146, 192, 108, 58, 159, 80,
- 130, 114, 74, 173, 90, 175, 70, 130, 225, 112,
- 48, 72, 24, 169, 112, 42, 227, 105, 96, 66,
- 155, 52, 72, 36, 26, 185, 223, 240, 184, 124,
- 78, 15, 185, 69, 38, 14, 100, 15, 73, 236,
- 49, 14, 13, 92, 6, 88, 133, 72, 91, 13,
- 15, 138, 24, 32, 32, 116, 143, 144, 112, 26,
- 30, 48, 0, 150, 150, 59, 25, 140, 145, 156,
- 157, 111, 33, 33, 23, 11, 1, 1, 11, 128,
- 13, 132, 134, 66, 4, 7, 17, 24, 24, 158,
- 35, 27, 31, 9, 151, 150, 51, 9, 49, 186,
- 49, 58, 56, 46, 182, 151, 60, 57, 40, 25,
- 51, 192, 52, 58, 201, 201, 56, 52, 192, 150,
- 45, 12, 17, 62, 49, 192, 59, 185, 187, 9,
- 190, 206, 0, 44, 48, 37, 142, 115, 33, 32,
- 19, 0, 19, 16, 17, 168, 84, 91, 28, 28,
- 38, 177, 27, 39, 57, 43, 192, 48, 30, 27,
- 114, 26, 31, 212, 244, 149, 182, 52, 41, 223,
- 36, 125, 120, 1, 204, 6, 131, 15, 12, 16,
- 0, 123, 241, 65, 3, 190, 15, 253, 108, 197,
- 136, 0, 238, 17, 137, 11, 2, 120, 248, 137,
- 112, 128, 74, 43, 118, 109, 34, 129, 200, 176,
- 96, 155, 73, 75, 60, 22, 228, 72, 129, 65,
- 67, 132, 12, 60, 22, 54, 132, 3, 2, 67,
- 134, 22, 192, 98, 100, 240, 81, 235, 228, 54,
- 255, 22, 56, 20, 124, 32, 113, 175, 19, 9,
- 13, 3, 0, 4, 216, 216, 17, 139, 1, 3,
- 13, 34, 236, 105, 247, 102, 3, 10, 5, 206,
- 114, 156, 40, 26, 171, 235, 195, 28, 206, 94,
- 4, 244, 10, 39, 196, 197, 14, 0, 6, 80,
- 240, 3, 168, 169, 42, 117, 7, 26, 56, 136,
- 160, 135, 15, 132, 118, 33, 201, 234, 245, 100,
- 54, 132, 137, 11, 22, 2, 212, 160, 65, 163,
- 194, 218, 11, 16, 48, 68, 112, 208, 229, 173,
- 227, 199, 66, 158, 110, 225, 210, 64, 174, 131,
- 203, 17, 50, 107, 222, 204, 153, 243, 229, 203,
- 149, 185, 116, 73, 5, 185, 180, 233, 44, 90,
- 38, 115, 41, 224, 65, 130, 107, 6, 176, 25,
- 184, 158, 173, 64, 129, 34, 69, 152, 51, 191,
- 194, 192, 174, 119, 111, 197, 139, 67, 143, 38,
- 125, 186, 184, 138, 201, 15, 90, 203, 110, 80,
- 34, 77, 222, 189, 179, 98, 184, 152, 62, 29,
- 71, 10, 18, 21, 247, 134, 243, 203, 33, 129,
- 178, 4, 167, 26, 27, 223, 162, 121, 44, 29,
- 16, 36, 82, 4, 160, 206, 190, 189, 139, 25,
- 53, 116, 188, 200, 144, 161, 185, 172, 6, 57,
- 88, 0, 107, 177, 195, 253, 141, 0, 242, 101,
- 48, 84, 35, 210, 248, 226, 158, 123, 240, 201,
- 39, 155, 56, 116, 92, 116, 131, 12, 230, 160,
- 67, 156, 58, 116, 113, 208, 149, 6, 18, 68,
- 100, 137, 65, 155, 208, 68, 255, 66, 6, 53,
- 0, 115, 131, 15, 37, 217, 178, 64, 6, 35,
- 228, 37, 194, 72, 58, 0, 19, 64, 6, 41,
- 96, 101, 11, 11, 57, 56, 144, 93, 138, 34,
- 100, 128, 3, 48, 51, 120, 16, 194, 115, 113,
- 160, 129, 86, 0, 231, 52, 48, 5, 43, 188,
- 185, 211, 9, 8, 37, 164, 240, 139, 68, 62,
- 124, 32, 229, 7, 244, 229, 208, 98, 88, 62,
- 200, 120, 201, 10, 57, 52, 192, 149, 44, 241,
- 244, 64, 15, 140, 205, 216, 162, 67, 148, 83,
- 86, 217, 83, 78, 246, 24, 69, 1, 0, 55,
- 248, 193, 152, 21, 80, 233, 97, 33, 29, 249,
- 16, 100, 203, 12, 0, 109, 208, 200, 159, 107,
- 0, 249, 6, 160, 128, 158, 71, 104, 35, 41,
- 104, 8, 128, 11, 10, 136, 115, 40, 27, 100,
- 97, 71, 206, 14, 22, 92, 192, 193, 156, 144,
- 33, 66, 215, 84, 28, 60, 170, 157, 118, 43,
- 122, 218, 149, 89, 26, 88, 128, 86, 57, 149,
- 38, 22, 200, 132, 198, 169, 131, 136, 92, 174,
- 212, 101, 215, 172, 119, 245, 102, 194, 173, 184,
- 178, 161, 43, 174, 183, 246, 182, 199, 5, 9,
- 4, 171, 140, 14, 11, 20, 187, 128, 5, 9,
- 32, 118, 151, 98, 129, 140, 214, 234, 179, 88,
- 164, 38, 153, 106, 148, 85, 102, 237, 181, 215,
- 138, 54, 200, 180, 79, 65, 235, 173, 21, 169,
- 13, 242, 5, 140, 98, 132, 193, 128, 7, 7,
- 204, 133, 255, 65, 9, 118, 172, 168, 198, 161,
- 128, 66, 250, 6, 30, 184, 178, 67, 235, 93,
- 193, 9, 210, 237, 183, 111, 105, 193, 133, 114,
- 244, 73, 96, 134, 8, 126, 222, 216, 137, 8,
- 37, 36, 172, 48, 187, 130, 238, 101, 71, 30,
- 125, 4, 203, 86, 179, 172, 126, 139, 156, 2,
- 30, 120, 224, 0, 81, 13, 239, 85, 83, 6,
- 59, 200, 228, 208, 167, 157, 252, 120, 65, 47,
- 56, 232, 192, 1, 58, 226, 157, 182, 197, 103,
- 17, 164, 72, 71, 27, 11, 215, 108, 51, 118,
- 26, 100, 215, 134, 142, 192, 232, 80, 223, 205,
- 32, 228, 12, 135, 8, 33, 216, 108, 116, 194,
- 216, 249, 89, 71, 8, 22, 212, 112, 67, 5,
- 69, 186, 85, 8, 43, 14, 40, 214, 33, 36,
- 86, 129, 229, 211, 73, 58, 176, 148, 207, 62,
- 91, 111, 163, 128, 4, 249, 48, 32, 64, 216,
- 219, 44, 48, 96, 131, 22, 136, 73, 193, 202,
- 82, 31, 121, 64, 146, 177, 124, 108, 67, 78,
- 13, 105, 160, 247, 61, 37, 100, 160, 40, 0,
- 56, 100, 185, 95, 52, 5, 175, 145, 222, 154,
- 150, 208, 248, 129, 147, 120, 235, 189, 247, 8,
- 125, 43, 48, 143, 45, 1, 180, 249, 72, 8,
- 21, 148, 83, 100, 197, 68, 176, 146, 135, 146,
- 7, 135, 144, 65, 0, 61, 103, 176, 70, 28,
- 118, 3, 179, 0, 3, 56, 217, 82, 207, 200,
- 110, 128, 16, 1, 235, 57, 165, 64, 255, 34,
- 48, 56, 100, 240, 35, 234, 77, 26, 67, 185,
- 229, 22, 89, 0, 64, 7, 150, 58, 192, 121,
- 100, 7, 176, 3, 58, 39, 95, 31, 115, 157,
- 35, 108, 4, 29, 66, 10, 122, 154, 233, 67,
- 153, 151, 36, 144, 193, 151, 34, 124, 24, 162,
- 137, 59, 85, 111, 137, 11, 245, 129, 179, 98,
- 206, 126, 59, 179, 0, 240, 22, 93, 208, 131,
- 70, 231, 196, 109, 132, 1, 14, 40, 223, 201,
- 6, 30, 104, 137, 118, 207, 41, 68, 64, 11,
- 238, 186, 123, 78, 116, 142, 81, 165, 253, 165,
- 141, 1, 230, 129, 196, 69, 4, 208, 3, 10,
- 92, 0, 16, 199, 35, 66, 43, 238, 98, 2,
- 59, 156, 199, 1, 12, 144, 65, 237, 232, 195,
- 193, 48, 208, 231, 3, 13, 64, 67, 27, 54,
- 16, 129, 49, 112, 144, 131, 36, 16, 96, 9,
- 79, 200, 193, 197, 181, 46, 123, 44, 36, 151,
- 128, 36, 64, 145, 47, 113, 130, 4, 109, 3,
- 192, 90, 226, 87, 8, 242, 76, 69, 14, 76,
- 74, 193, 13, 128, 161, 61, 27, 146, 44, 18,
- 27, 112, 128, 15, 190, 119, 137, 5, 160, 192,
- 136, 122, 33, 74, 230, 16, 176, 67, 9, 61,
- 230, 41, 233, 170, 75, 59, 172, 82, 46, 49,
- 124, 64, 94, 71, 228, 196, 138, 22, 215, 197,
- 20, 176, 175, 43, 36, 184, 8, 57, 80, 133,
- 152, 197, 200, 207, 101, 113, 217, 20, 31, 168,
- 98, 193, 48, 218, 255, 17, 18, 125, 1, 204,
- 4, 118, 192, 131, 14, 44, 5, 49, 225, 225,
- 151, 18, 16, 161, 46, 89, 217, 165, 29, 38,
- 104, 67, 29, 239, 248, 9, 80, 60, 140, 3,
- 23, 16, 197, 2, 112, 128, 3, 82, 224, 96,
- 1, 201, 194, 23, 197, 4, 233, 178, 201, 88,
- 70, 55, 134, 188, 23, 31, 36, 70, 202, 82,
- 154, 50, 147, 83, 121, 69, 102, 2, 161, 175,
- 8, 114, 242, 149, 157, 139, 130, 44, 103, 217,
- 4, 88, 218, 242, 52, 210, 226, 150, 46, 119,
- 185, 175, 91, 250, 242, 72, 210, 210, 22, 23,
- 110, 67, 204, 98, 230, 70, 55, 187, 1, 14,
- 43, 5, 177, 173, 94, 254, 18, 90, 225, 90,
- 141, 4, 168, 68, 46, 19, 198, 70, 2, 30,
- 120, 192, 39, 145, 153, 204, 110, 246, 202, 55,
- 190, 90, 214, 98, 154, 229, 172, 103, 190, 5,
- 139, 7, 40, 128, 4, 170, 233, 65, 116, 69,
- 128, 93, 32, 72, 67, 193, 116, 117, 199, 111,
- 222, 139, 89, 173, 52, 231, 18, 38, 163, 78,
- 250, 132, 225, 3, 173, 64, 131, 159, 58, 38,
- 135, 80, 17, 138, 160, 94, 129, 88, 196, 130,
- 117, 142, 77, 234, 19, 57, 95, 128, 205, 3,
- 98, 54, 80, 232, 156, 192, 132, 29, 68, 145,
- 193, 62, 245, 176, 136, 233, 32, 88, 225, 113,
- 229, 120, 134, 233, 26, 141, 17, 101, 163, 100,
- 33, 218, 232, 74, 135, 82, 59, 254, 168, 59,
- 255, 198, 186, 128, 27, 69, 234, 24, 68, 60,
- 160, 54, 14, 104, 14, 66, 245, 2, 15, 121,
- 0, 67, 1, 79, 100, 36, 30, 255, 66, 73,
- 28, 36, 96, 166, 35, 189, 204, 3, 54, 134,
- 82, 131, 194, 75, 84, 113, 104, 158, 45, 106,
- 144, 2, 71, 29, 116, 14, 79, 125, 42, 24,
- 229, 32, 142, 166, 213, 224, 109, 86, 204, 84,
- 186, 46, 195, 8, 130, 110, 64, 2, 24, 141,
- 225, 9, 61, 248, 1, 12, 40, 109, 4, 76,
- 202, 192, 147, 178, 151, 86, 127, 126, 208, 173,
- 208, 75, 79, 93, 213, 218, 66, 15, 52, 7,
- 165, 23, 161, 129, 11, 34, 36, 136, 115, 166,
- 43, 51, 9, 196, 234, 236, 98, 98, 64, 56,
- 189, 32, 5, 14, 72, 3, 37, 26, 107, 9,
- 26, 192, 32, 5, 35, 208, 0, 10, 82, 112,
- 183, 198, 206, 32, 6, 31, 72, 236, 27, 46,
- 114, 55, 168, 133, 245, 10, 80, 217, 205, 78,
- 221, 128, 161, 191, 25, 48, 6, 41, 24, 201,
- 142, 40, 107, 137, 0, 96, 54, 70, 180, 189,
- 132, 14, 206, 8, 7, 18, 188, 105, 0, 224,
- 193, 84, 21, 234, 132, 129, 20, 30, 204, 123,
- 61, 67, 83, 154, 252, 22, 178, 218, 229, 64,
- 33, 174, 75, 1, 53, 253, 169, 128, 230, 94,
- 162, 7, 57, 240, 128, 15, 102, 123, 9, 235,
- 76, 73, 74, 244, 129, 129, 239, 204, 180, 149,
- 224, 1, 160, 7, 22, 184, 255, 212, 27, 231,
- 215, 0, 251, 121, 162, 167, 98, 114, 93, 80,
- 231, 181, 129, 38, 205, 181, 178, 62, 16, 31,
- 0, 254, 129, 29, 93, 137, 64, 170, 151, 32,
- 31, 66, 160, 123, 137, 23, 144, 109, 104, 27,
- 72, 15, 246, 44, 113, 3, 9, 32, 20, 135,
- 0, 224, 65, 122, 133, 139, 4, 36, 81, 229,
- 29, 250, 0, 6, 85, 141, 235, 161, 12, 12,
- 113, 170, 66, 108, 28, 77, 154, 180, 96, 0,
- 248, 44, 191, 34, 2, 200, 141, 84, 74, 58,
- 91, 52, 184, 165, 110, 240, 109, 57, 30, 152,
- 142, 36, 172, 227, 194, 75, 178, 137, 117, 45,
- 1, 90, 216, 85, 5, 5, 57, 136, 239, 37,
- 98, 160, 191, 8, 71, 35, 59, 86, 41, 50,
- 0, 96, 0, 163, 241, 90, 162, 136, 114, 216,
- 64, 3, 24, 160, 31, 19, 149, 87, 129, 23,
- 72, 139, 156, 214, 139, 60, 247, 118, 98, 18,
- 138, 226, 193, 145, 227, 176, 1, 12, 164, 160,
- 196, 46, 72, 193, 149, 186, 27, 64, 56, 204,
- 2, 113, 0, 168, 65, 1, 109, 209, 3, 5,
- 92, 185, 42, 77, 106, 241, 37, 108, 160, 128,
- 18, 236, 116, 129, 240, 227, 136, 18, 88, 161,
- 188, 69, 62, 98, 103, 220, 181, 196, 137, 228,
- 185, 129, 162, 109, 22, 6, 147, 219, 51, 140,
- 24, 91, 224, 3, 15, 202, 38, 157, 29, 242,
- 78, 214, 92, 91, 211, 105, 32, 13, 69, 187,
- 168, 2, 255, 50, 253, 140, 62, 195, 56, 198,
- 194, 179, 6, 15, 149, 240, 145, 59, 113, 66,
- 202, 25, 212, 240, 71, 133, 181, 30, 147, 116,
- 109, 32, 60, 82, 177, 36, 50, 4, 12, 97,
- 80, 233, 133, 150, 136, 143, 196, 122, 225, 100,
- 19, 125, 96, 119, 157, 32, 71, 5, 18, 112,
- 41, 87, 222, 216, 213, 144, 200, 83, 110, 89,
- 0, 91, 27, 129, 136, 136, 219, 27, 154, 232,
- 244, 172, 104, 24, 185, 22, 109, 9, 64, 224,
- 169, 71, 251, 166, 14, 88, 96, 115, 234, 104,
- 47, 59, 68, 210, 59, 96, 32, 0, 65, 52,
- 0, 208, 11, 86, 130, 130, 120, 246, 212, 61,
- 90, 249, 210, 189, 219, 195, 228, 20, 48, 209,
- 18, 50, 128, 55, 128, 98, 144, 131, 12, 108,
- 101, 220, 228, 6, 0, 165, 30, 104, 60, 58,
- 205, 237, 46, 102, 189, 10, 48, 4, 160, 21,
- 163, 137, 227, 211, 207, 233, 158, 205, 144, 237,
- 33, 155, 129, 224, 3, 90, 187, 238, 11, 114,
- 90, 51, 18, 160, 33, 103, 171, 237, 173, 6,
- 208, 50, 1, 182, 212, 216, 225, 245, 187, 203,
- 121, 50, 192, 105, 192, 181, 89, 168, 231, 41,
- 1, 79, 52, 44, 1, 40, 70, 81, 4, 153,
- 75, 73, 27, 95, 238, 148, 9, 66, 156, 38,
- 139, 21, 25, 206, 31, 161, 89, 206, 18, 209,
- 70, 71, 60, 10, 57, 120, 176, 195, 182, 92,
- 145, 60, 90, 100, 45, 68, 102, 192, 219, 117,
- 174, 83, 85, 180, 75, 79, 17, 8, 98, 212,
- 117, 174, 211, 64, 1, 28, 254, 57, 5, 206,
- 214, 129, 5, 0, 146, 194, 98, 173, 218, 28,
- 17, 102, 51, 153, 133, 125, 14, 52, 171, 187,
- 94, 72, 181, 246, 180, 44, 5, 95, 133, 125,
- 214, 83, 228, 130, 129, 57, 114, 128, 104, 119,
- 79, 188, 27, 72, 101, 129, 9, 136, 169, 3,
- 59, 92, 25, 99, 104, 90, 154, 151, 201, 113,
- 42, 137, 28, 129, 161, 21, 239, 149, 190, 108,
- 224, 2, 20, 168, 1, 215, 255, 147, 42, 197,
- 232, 235, 153, 132, 188, 252, 28, 111, 197, 249,
- 203, 57, 242, 191, 128, 169, 164, 96, 2, 64,
- 129, 84, 113, 128, 89, 45, 211, 231, 16, 176,
- 8, 171, 194, 139, 82, 121, 172, 255, 132, 230,
- 55, 207, 85, 71, 26, 63, 69, 16, 3, 86,
- 50, 138, 85, 212, 99, 101, 242, 246, 193, 201,
- 189, 238, 7, 249, 170, 185, 196, 74, 148, 216,
- 191, 215, 41, 73, 57, 44, 29, 32, 11, 149,
- 208, 143, 190, 244, 167, 175, 10, 201, 84, 235,
- 152, 175, 176, 87, 246, 215, 207, 14, 85, 174,
- 146, 149, 229, 36, 63, 44, 167, 37, 204, 250,
- 219, 255, 254, 206, 52, 103, 16, 0, 0, 59,
- 10, 124, 165, 92, 136, 65, 105, 236, 247, 73,
- 168, 224, 1, 35, 240, 0, 23, 226, 0, 154,
- 225, 54, 178, 247, 74, 94, 17, 75, 229, 34,
- 22, 137, 33, 128, 174, 3, 88, 10, 143, 65,
- 21, 34, 48, 1, 51, 160, 3, 207, 151, 127,
- 104, 37, 126, 248, 196, 4, 196, 18, 46, 202,
- 52, 75, 2, 50, 129, 21, 88, 7, 209, 100,
- 114, 95, 97, 12, 172, 96, 92, 36, 176, 128,
- 104, 213, 128, 10, 117, 76, 254, 71, 8, 175,
- 80, 130, 203, 164, 46, 186, 176, 130, 20, 24,
- 7, 62, 24, 77, 199, 52, 47, 247, 177, 54,
- 19, 128, 90, 60, 240, 43, 229, 132, 86, 180,
- 161, 121, 58, 85, 11, 46, 115, 8, 175, 49,
- 25, 155, 17, 8, 58, 184, 76, 9, 80, 46,
- 3, 0, 85, 80, 165, 78, 235, 52, 13, 247,
- 178, 47, 241, 164, 26, 177, 65, 27, 221, 241,
- 132, 183, 193, 86, 189, 49, 78, 228, 84, 78,
- 110, 248, 134, 112, 24, 135, 242, 68, 134, 28,
- 37, 42, 103, 136, 134, 33, 104, 48, 39, 35,
- 27, 109, 160, 48, 220, 242, 135, 21, 224, 25,
- 220, 2, 49, 7, 53, 49, 32, 21, 4, 0,
- 59, 0 };
-
-unsigned char php_egg_logo[] = {
- 71, 73, 70, 56, 57, 97, 130, 0, 67, 0,
- 213, 255, 0, 0, 0, 0, 152, 138, 142, 104,
- 95, 105, 89, 86, 93, 160, 151, 174, 102, 101,
- 136, 164, 163, 205, 174, 173, 213, 102, 102, 153,
- 99, 99, 149, 102, 102, 152, 96, 96, 143, 90,
- 90, 134, 82, 82, 115, 87, 87, 121, 80, 80,
- 108, 74, 74, 100, 110, 110, 147, 95, 95, 127,
- 149, 149, 198, 118, 118, 157, 67, 67, 89, 144,
- 144, 191, 128, 128, 169, 137, 137, 180, 155, 155,
- 197, 186, 186, 227, 209, 209, 247, 242, 242, 254,
- 64, 67, 65, 192, 192, 192, 32, 45, 25, 50,
- 54, 36, 65, 63, 42, 75, 71, 53, 87, 79,
- 61, 93, 85, 69, 231, 180, 110, 106, 92, 74,
- 207, 155, 100, 121, 101, 80, 181, 131, 89, 141,
- 110, 88, 158, 125, 103, 148, 118, 97, 169, 135,
- 112, 131, 112, 99, 180, 141, 117, 135, 101, 81,
- 191, 148, 124, 168, 126, 107, 201, 153, 130, 164,
- 116, 97, 191, 139, 119, 213, 155, 135, 220, 164,
- 146, 203, 142, 124, 180, 127, 112, 175, 118, 103,
- 191, 127, 114, 162, 102, 91, 255, 255, 255, 0,
- 0, 0, 0, 0, 0, 33, 249, 4, 1, 0,
- 0, 30, 0, 44, 0, 0, 0, 0, 130, 0,
- 67, 0, 64, 6, 255, 64, 143, 112, 72, 44,
- 26, 143, 72, 226, 100, 105, 105, 98, 158, 151,
- 40, 133, 18, 137, 20, 36, 18, 135, 118, 203,
- 213, 74, 10, 133, 200, 52, 122, 121, 98, 154,
- 150, 229, 50, 201, 110, 187, 223, 202, 137, 5,
- 115, 137, 72, 30, 16, 72, 101, 15, 105, 48,
- 24, 11, 9, 130, 10, 132, 10, 8, 135, 136,
- 137, 137, 11, 3, 34, 31, 31, 32, 32, 33,
- 147, 34, 149, 34, 35, 152, 153, 34, 33, 32,
- 143, 143, 29, 2, 133, 130, 9, 11, 127, 14,
- 13, 13, 91, 88, 18, 17, 101, 105, 19, 112,
- 112, 114, 24, 17, 120, 123, 21, 14, 129, 132,
- 138, 188, 189, 190, 137, 21, 31, 33, 38, 48,
- 44, 52, 58, 57, 59, 53, 56, 203, 56, 206,
- 206, 51, 207, 204, 53, 47, 57, 50, 44, 40,
- 36, 35, 150, 33, 144, 191, 188, 132, 164, 12,
- 14, 95, 96, 20, 103, 176, 111, 22, 20, 182,
- 16, 12, 9, 134, 223, 242, 243, 138, 32, 36,
- 48, 42, 52, 50, 57, 203, 205, 206, 54, 0,
- 111, 8, 20, 8, 112, 198, 140, 24, 212, 86,
- 184, 64, 97, 162, 33, 166, 77, 32, 36, 208,
- 251, 165, 32, 193, 31, 49, 231, 44, 176, 185,
- 3, 33, 87, 188, 137, 32, 229, 129, 24, 129,
- 66, 5, 10, 23, 35, 62, 184, 112, 1, 163,
- 134, 141, 26, 57, 98, 210, 88, 209, 2, 69,
- 139, 24, 49, 94, 188, 136, 97, 16, 71, 181,
- 255, 28, 42, 26, 170, 184, 105, 99, 199, 142,
- 25, 20, 66, 130, 43, 101, 134, 13, 173, 44,
- 126, 224, 41, 157, 170, 72, 129, 128, 124, 59,
- 152, 225, 115, 121, 3, 161, 209, 29, 52, 118,
- 228, 192, 97, 131, 160, 13, 28, 8, 173, 173,
- 208, 183, 130, 133, 10, 131, 48, 73, 124, 156,
- 90, 145, 65, 134, 13, 26, 50, 104, 116, 51,
- 139, 2, 152, 43, 14, 222, 237, 162, 58, 113,
- 0, 10, 26, 47, 100, 208, 40, 113, 2, 6,
- 15, 30, 58, 190, 234, 72, 81, 162, 68, 179,
- 131, 60, 11, 190, 88, 209, 150, 133, 11, 21,
- 109, 77, 74, 149, 23, 110, 65, 1, 13, 61,
- 56, 108, 48, 160, 38, 22, 27, 38, 116, 168,
- 84, 169, 82, 224, 15, 160, 65, 133, 168, 38,
- 0, 113, 162, 132, 138, 98, 156, 101, 200, 104,
- 177, 83, 231, 138, 202, 59, 115, 182, 88, 190,
- 188, 184, 206, 196, 161, 85, 184, 8, 76, 193,
- 192, 134, 235, 120, 89, 171, 73, 231, 186, 123,
- 119, 53, 104, 230, 152, 33, 67, 222, 204, 153,
- 240, 232, 211, 167, 201, 192, 190, 189, 28, 245,
- 175, 214, 120, 159, 79, 63, 142, 147, 11, 84,
- 36, 52, 120, 192, 63, 143, 255, 10, 121, 240,
- 151, 138, 109, 128, 44, 96, 224, 129, 6, 98,
- 49, 0, 39, 158, 52, 8, 130, 8, 29, 116,
- 16, 32, 127, 15, 160, 194, 197, 23, 98, 184,
- 242, 74, 125, 243, 49, 81, 255, 7, 30, 122,
- 0, 232, 71, 32, 240, 204, 69, 88, 3, 143,
- 132, 80, 201, 8, 13, 161, 224, 34, 10, 197,
- 12, 199, 28, 113, 45, 200, 208, 22, 75, 38,
- 144, 176, 201, 35, 32, 48, 224, 75, 56, 226,
- 156, 66, 14, 22, 5, 100, 36, 223, 119, 22,
- 92, 32, 65, 136, 238, 148, 72, 24, 72, 144,
- 16, 115, 76, 50, 254, 144, 21, 208, 64, 4,
- 57, 83, 67, 13, 53, 98, 211, 16, 9, 58,
- 66, 84, 1, 85, 225, 140, 19, 134, 24, 232,
- 180, 81, 75, 30, 130, 61, 73, 88, 7, 35,
- 196, 200, 79, 79, 86, 222, 96, 195, 12, 48,
- 45, 199, 19, 78, 124, 62, 39, 214, 10, 12,
- 145, 208, 16, 11, 47, 192, 36, 209, 147, 117,
- 21, 16, 5, 6, 108, 68, 224, 64, 133, 186,
- 184, 73, 213, 0, 38, 168, 96, 140, 112, 44,
- 192, 0, 3, 13, 49, 25, 245, 204, 87, 210,
- 60, 3, 83, 14, 250, 216, 168, 194, 80, 91,
- 194, 36, 131, 143, 132, 85, 180, 64, 4, 7,
- 24, 176, 87, 18, 115, 216, 129, 69, 46, 163,
- 73, 74, 207, 0, 155, 110, 169, 2, 15, 52,
- 4, 107, 77, 88, 151, 213, 176, 67, 98, 53,
- 24, 148, 19, 78, 47, 180, 48, 147, 91, 248,
- 172, 96, 146, 4, 38, 210, 227, 106, 4, 28,
- 168, 166, 157, 119, 179, 212, 49, 91, 109, 183,
- 57, 169, 43, 34, 9, 176, 136, 2, 101, 39,
- 28, 19, 255, 217, 87, 89, 225, 208, 219, 9,
- 60, 25, 116, 208, 102, 156, 177, 192, 89, 169,
- 44, 228, 235, 194, 0, 85, 85, 36, 206, 5,
- 27, 100, 139, 87, 6, 173, 113, 40, 203, 44,
- 177, 77, 161, 48, 126, 84, 148, 98, 219, 129,
- 163, 140, 82, 8, 3, 33, 208, 80, 192, 2,
- 29, 8, 90, 146, 165, 246, 114, 214, 86, 10,
- 49, 48, 215, 236, 114, 156, 181, 16, 0, 1,
- 7, 104, 160, 178, 202, 7, 196, 74, 240, 118,
- 6, 199, 252, 26, 19, 226, 73, 97, 199, 41,
- 251, 81, 216, 159, 127, 60, 247, 220, 179, 206,
- 2, 162, 146, 138, 42, 97, 80, 80, 198, 121,
- 27, 202, 172, 180, 125, 177, 221, 1, 98, 30,
- 124, 84, 248, 7, 196, 18, 23, 98, 117, 60,
- 14, 52, 210, 73, 131, 144, 68, 178, 53, 215,
- 33, 12, 144, 139, 195, 167, 4, 61, 52, 145,
- 70, 163, 195, 221, 210, 73, 120, 72, 1, 71,
- 76, 142, 72, 98, 110, 83, 49, 176, 181, 36,
- 151, 128, 169, 55, 9, 47, 46, 100, 210, 73,
- 129, 142, 192, 32, 36, 13, 244, 235, 106, 41,
- 66, 14, 249, 133, 145, 107, 27, 220, 151, 3,
- 80, 3, 24, 238, 96, 227, 34, 208, 193, 37,
- 38, 108, 236, 150, 189, 50, 164, 26, 106, 170,
- 212, 144, 154, 105, 54, 219, 116, 2, 66, 2,
- 164, 249, 139, 248, 144, 230, 164, 233, 93, 173,
- 182, 72, 30, 105, 229, 188, 116, 240, 255, 193,
- 61, 249, 32, 163, 140, 52, 0, 5, 212, 251,
- 157, 206, 88, 115, 77, 160, 218, 64, 244, 1,
- 234, 33, 185, 106, 38, 24, 173, 164, 241, 134,
- 28, 236, 132, 120, 91, 181, 180, 39, 18, 2,
- 223, 185, 39, 195, 251, 239, 3, 149, 85, 208,
- 188, 210, 50, 244, 229, 67, 145, 56, 208, 170,
- 2, 165, 176, 82, 133, 235, 72, 40, 169, 71,
- 147, 212, 87, 175, 136, 8, 184, 239, 211, 238,
- 51, 189, 99, 105, 103, 239, 7, 81, 163, 211,
- 240, 95, 2, 211, 138, 88, 213, 42, 113, 40,
- 140, 81, 73, 224, 200, 3, 102, 39, 191, 111,
- 192, 233, 36, 167, 178, 212, 62, 114, 16, 131,
- 59, 229, 196, 70, 52, 97, 14, 159, 228, 181,
- 37, 82, 193, 32, 71, 38, 88, 1, 79, 118,
- 96, 131, 28, 196, 111, 34, 232, 99, 0, 25,
- 54, 178, 31, 143, 52, 112, 30, 25, 43, 201,
- 10, 132, 35, 28, 172, 24, 5, 25, 157, 170,
- 1, 78, 60, 231, 140, 180, 12, 43, 83, 42,
- 24, 11, 64, 248, 81, 0, 55, 165, 144, 96,
- 8, 108, 31, 84, 0, 113, 194, 23, 34, 160,
- 0, 149, 50, 198, 49, 104, 128, 2, 30, 220,
- 80, 7, 88, 140, 140, 149, 126, 39, 170, 97,
- 233, 131, 6, 167, 202, 193, 157, 10, 101, 130,
- 5, 32, 202, 34, 6, 208, 128, 172, 216, 80,
- 171, 91, 49, 177, 137, 242, 187, 138, 22, 107,
- 240, 27, 77, 57, 255, 6, 139, 193, 90, 198,
- 12, 98, 130, 3, 121, 45, 171, 6, 138, 153,
- 73, 91, 74, 226, 150, 50, 158, 175, 20, 7,
- 184, 206, 182, 218, 48, 1, 58, 252, 37, 11,
- 186, 128, 163, 174, 20, 80, 18, 107, 192, 96,
- 130, 84, 202, 1, 30, 129, 85, 131, 96, 33,
- 68, 89, 51, 176, 224, 102, 242, 117, 170, 98,
- 100, 234, 80, 32, 81, 30, 106, 56, 144, 151,
- 35, 201, 98, 14, 84, 248, 75, 96, 34, 249,
- 194, 4, 240, 141, 5, 50, 64, 215, 20, 143,
- 113, 63, 116, 133, 242, 32, 161, 180, 65, 78,
- 58, 67, 74, 123, 185, 101, 95, 39, 44, 13,
- 3, 48, 144, 45, 109, 21, 140, 67, 176, 241,
- 214, 183, 166, 134, 27, 73, 210, 3, 2, 36,
- 160, 76, 10, 166, 148, 21, 207, 225, 169, 55,
- 241, 154, 151, 141, 102, 68, 35, 12, 110, 46,
- 20, 170, 99, 64, 4, 238, 162, 154, 236, 60,
- 147, 109, 69, 136, 166, 194, 230, 25, 1, 2,
- 25, 168, 154, 148, 243, 69, 185, 122, 3, 66,
- 205, 229, 43, 131, 43, 64, 215, 140, 116, 194,
- 172, 231, 44, 7, 131, 1, 176, 14, 118, 84,
- 102, 128, 151, 185, 18, 158, 223, 161, 25, 20,
- 200, 67, 81, 50, 200, 6, 12, 14, 35, 144,
- 109, 40, 37, 168, 204, 245, 109, 37, 1, 8,
- 41, 1, 50, 96, 0, 3, 180, 236, 164, 45,
- 43, 41, 193, 208, 0, 51, 136, 186, 244, 165,
- 255, 48, 141, 105, 76, 193, 227, 132, 132, 89,
- 1, 42, 66, 3, 154, 78, 129, 38, 180, 46,
- 148, 35, 67, 71, 99, 233, 67, 101, 170, 52,
- 137, 74, 225, 10, 57, 219, 153, 207, 252, 99,
- 182, 46, 104, 225, 1, 123, 136, 80, 132, 0,
- 52, 161, 166, 122, 161, 104, 65, 77, 26, 81,
- 35, 58, 7, 252, 56, 138, 66, 60, 139, 218,
- 128, 10, 116, 207, 136, 225, 179, 0, 2, 24,
- 193, 215, 184, 198, 181, 145, 144, 96, 28, 168,
- 160, 80, 79, 175, 218, 138, 39, 104, 117, 171,
- 70, 136, 166, 29, 158, 118, 139, 62, 204, 146,
- 68, 37, 178, 26, 69, 6, 176, 86, 72, 76,
- 226, 176, 136, 141, 4, 216, 6, 48, 10, 3,
- 253, 33, 174, 22, 82, 92, 93, 239, 42, 211,
- 110, 237, 53, 114, 21, 120, 192, 44, 171, 102,
- 205, 68, 56, 160, 3, 221, 16, 134, 37, 50,
- 49, 2, 48, 53, 228, 180, 95, 50, 222, 39,
- 6, 96, 8, 171, 9, 194, 97, 115, 93, 69,
- 218, 156, 247, 210, 190, 20, 0, 68, 124, 24,
- 81, 53, 221, 20, 12, 72, 172, 168, 163, 167,
- 61, 201, 103, 242, 101, 204, 124, 193, 128, 33,
- 165, 227, 17, 242, 18, 33, 138, 32, 165, 98,
- 21, 172, 112, 69, 227, 160, 217, 213, 219, 134,
- 40, 179, 147, 235, 236, 60, 42, 32, 9, 76,
- 128, 9, 70, 46, 146, 32, 5, 251, 129, 144,
- 231, 88, 35, 95, 200, 221, 255, 209, 7, 32,
- 240, 13, 81, 172, 110, 21, 97, 144, 46, 117,
- 105, 17, 187, 10, 232, 54, 159, 186, 74, 0,
- 4, 236, 1, 163, 236, 117, 106, 26, 161, 210,
- 210, 150, 170, 113, 141, 15, 134, 137, 65, 99,
- 154, 135, 50, 189, 80, 14, 35, 113, 11, 118,
- 76, 154, 158, 118, 67, 18, 12, 146, 228, 131,
- 155, 85, 250, 199, 239, 162, 49, 224, 243, 146,
- 110, 27, 198, 91, 174, 130, 149, 71, 142, 191,
- 56, 88, 22, 24, 136, 222, 30, 30, 32, 152,
- 9, 79, 37, 18, 196, 200, 199, 127, 183, 167,
- 191, 253, 161, 69, 85, 94, 2, 19, 136, 59,
- 81, 56, 165, 148, 201, 1, 204, 107, 222, 116,
- 143, 208, 200, 53, 73, 78, 92, 78, 60, 68,
- 8, 44, 204, 203, 251, 245, 49, 127, 4, 49,
- 203, 141, 55, 99, 146, 211, 22, 143, 19, 32,
- 112, 241, 33, 126, 60, 155, 11, 208, 150, 86,
- 24, 184, 237, 30, 26, 192, 192, 36, 31, 130,
- 126, 248, 152, 210, 150, 160, 241, 100, 40, 19,
- 196, 143, 128, 244, 210, 248, 74, 7, 130, 4,
- 147, 73, 28, 103, 42, 195, 144, 135, 64, 95,
- 61, 120, 68, 203, 79, 186, 94, 154, 169, 20,
- 42, 55, 119, 15, 120, 3, 166, 50, 241, 180,
- 193, 137, 30, 31, 82, 157, 99, 152, 213, 17,
- 40, 208, 0, 63, 47, 0, 208, 110, 138, 161,
- 140, 147, 21, 141, 58, 213, 88, 89, 49, 64,
- 75, 78, 255, 116, 98, 141, 160, 128, 176, 33,
- 194, 33, 129, 164, 82, 120, 64, 54, 88, 23,
- 126, 102, 238, 197, 3, 57, 182, 143, 29, 254,
- 18, 79, 214, 184, 73, 48, 49, 179, 195, 208,
- 201, 32, 27, 66, 209, 73, 13, 110, 224, 2,
- 76, 35, 64, 121, 43, 76, 32, 30, 200, 108,
- 236, 64, 147, 164, 99, 10, 129, 17, 13, 200,
- 130, 39, 197, 12, 37, 0, 32, 0, 128, 9,
- 88, 160, 107, 101, 17, 216, 192, 42, 144, 65,
- 40, 219, 101, 62, 68, 49, 229, 9, 27, 193,
- 131, 11, 99, 205, 139, 145, 128, 215, 5, 217,
- 246, 12, 12, 148, 177, 3, 100, 212, 64, 7,
- 156, 154, 129, 64, 228, 229, 71, 177, 228, 0,
- 27, 48, 106, 129, 75, 138, 130, 131, 164, 152,
- 155, 1, 78, 112, 245, 126, 152, 205, 110, 94,
- 64, 128, 24, 156, 139, 201, 10, 54, 197, 174,
- 100, 196, 68, 147, 235, 122, 198, 14, 133, 55,
- 19, 75, 137, 241, 37, 200, 64, 37, 153, 12,
- 212, 80, 73, 27, 129, 2, 101, 107, 83, 195,
- 17, 81, 129, 74, 5, 139, 6, 60, 168, 35,
- 14, 249, 97, 165, 0, 63, 3, 79, 247, 214,
- 7, 190, 79, 149, 239, 23, 224, 128, 7, 4,
- 164, 139, 69, 46, 16, 43, 147, 23, 225, 2,
- 5, 208, 2, 153, 115, 213, 112, 5, 72, 41,
- 50, 157, 68, 129, 24, 113, 64, 42, 117, 105,
- 145, 44, 221, 187, 177, 90, 216, 226, 255, 150,
- 23, 8, 51, 6, 52, 96, 0, 166, 175, 149,
- 29, 163, 19, 33, 73, 183, 90, 122, 179, 167,
- 34, 199, 110, 106, 74, 56, 157, 18, 11, 22,
- 153, 33, 196, 59, 113, 152, 26, 129, 180, 81,
- 166, 146, 5, 148, 7, 156, 241, 85, 215, 57,
- 192, 80, 149, 128, 118, 55, 50, 61, 214, 3,
- 80, 1, 212, 73, 85, 199, 95, 173, 139, 93,
- 48, 225, 244, 168, 113, 82, 35, 143, 1, 177,
- 45, 134, 188, 179, 10, 85, 211, 202, 61, 15,
- 65, 14, 72, 191, 2, 36, 15, 239, 196, 2,
- 160, 128, 5, 150, 156, 210, 88, 96, 146, 149,
- 80, 222, 96, 143, 57, 168, 6, 168, 149, 213,
- 130, 122, 213, 49, 124, 102, 244, 49, 41, 10,
- 16, 176, 13, 8, 126, 240, 121, 133, 229, 35,
- 113, 133, 95, 249, 217, 242, 146, 53, 208, 84,
- 13, 82, 160, 169, 199, 56, 31, 6, 232, 210,
- 161, 228, 119, 61, 74, 82, 194, 160, 45, 48,
- 8, 5, 10, 93, 37, 129, 85, 174, 6, 248,
- 109, 19, 190, 44, 37, 236, 68, 195, 132, 251,
- 5, 232, 114, 62, 100, 216, 245, 174, 95, 102,
- 198, 130, 181, 39, 46, 207, 221, 130, 130, 220,
- 183, 87, 28, 17, 216, 64, 106, 190, 15, 126,
- 70, 194, 114, 54, 55, 67, 126, 242, 131, 77,
- 37, 129, 46, 89, 132, 69, 158, 130, 3, 59,
- 208, 27, 252, 102, 119, 205, 226, 49, 245, 50,
- 67, 250, 34, 0, 255, 34, 134, 8, 64, 194,
- 0, 5, 112, 0, 251, 167, 70, 239, 68, 31,
- 239, 225, 85, 211, 148, 93, 180, 147, 0, 34,
- 96, 2, 218, 4, 25, 66, 20, 42, 239, 146,
- 25, 6, 241, 128, 52, 17, 28, 251, 160, 119,
- 150, 130, 2, 200, 3, 36, 165, 0, 43, 2,
- 227, 123, 45, 181, 52, 221, 34, 27, 33, 120,
- 79, 116, 243, 36, 11, 16, 2, 148, 65, 3,
- 184, 132, 73, 133, 210, 130, 232, 210, 39, 228,
- 68, 28, 207, 33, 28, 157, 17, 20, 18, 128,
- 127, 119, 177, 80, 218, 209, 127, 50, 35, 79,
- 243, 148, 31, 83, 3, 88, 65, 72, 15, 67,
- 216, 27, 217, 192, 49, 29, 51, 35, 43, 240,
- 46, 207, 209, 44, 207, 81, 80, 58, 17, 127,
- 38, 225, 2, 24, 160, 1, 216, 145, 29, 14,
- 229, 121, 48, 245, 30, 9, 179, 133, 13, 243,
- 48, 101, 21, 88, 87, 131, 8, 11, 48, 2,
- 39, 208, 2, 112, 146, 57, 196, 213, 22, 51,
- 52, 28, 103, 88, 2, 109, 232, 132, 6, 85,
- 121, 38, 147, 70, 120, 177, 50, 177, 178, 29,
- 118, 136, 87, 66, 32, 81, 121, 88, 81, 117,
- 112, 49, 26, 69, 86, 7, 130, 11, 6, 210,
- 0, 37, 232, 81, 248, 64, 134, 167, 2, 129,
- 156, 33, 82, 41, 67, 137, 41, 213, 80, 239,
- 209, 129, 152, 24, 11, 52, 53, 30, 156, 88,
- 30, 102, 0, 31, 186, 56, 1, 236, 81, 82,
- 30, 190, 248, 139, 42, 181, 82, 66, 133, 133,
- 179, 232, 129, 52, 85, 83, 230, 145, 140, 202,
- 184, 140, 230, 161, 139, 195, 120, 137, 108, 19,
- 4, 0, 59, 0 };
-
-
diff --git a/main/main.c b/main/main.c
deleted file mode 100644
index 73d2bc9889..0000000000
--- a/main/main.c
+++ /dev/null
@@ -1,1362 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-/* {{{ includes
- */
-#include <stdio.h>
-#include "php.h"
-#ifdef PHP_WIN32
-#include "win32/time.h"
-#include "win32/signal.h"
-#include <process.h>
-#else
-#include "build-defs.h"
-#endif
-#if HAVE_SYS_TIME_H
-#include <sys/time.h>
-#endif
-#if HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#if HAVE_SIGNAL_H
-#include <signal.h>
-#endif
-#if HAVE_SETLOCALE
-#include <locale.h>
-#endif
-#include "zend.h"
-#include "zend_extensions.h"
-#include "php_ini.h"
-#include "php_globals.h"
-#include "php_main.h"
-#include "fopen_wrappers.h"
-#include "ext/standard/php_standard.h"
-#include "php_variables.h"
-#include "ext/standard/credits.h"
-#ifdef PHP_WIN32
-#include <io.h>
-#include <fcntl.h>
-#include "win32/php_registry.h"
-#endif
-#include "php_syslog.h"
-
-#if PHP_SIGCHILD
-#include <sys/types.h>
-#include <sys/wait.h>
-#endif
-
-#include "zend_compile.h"
-#include "zend_execute.h"
-#include "zend_highlight.h"
-#include "zend_indent.h"
-#include "zend_extensions.h"
-
-#include "php_content_types.h"
-#include "php_ticks.h"
-#include "php_logos.h"
-
-#include "SAPI.h"
-/* }}} */
-
-#ifndef ZTS
-php_core_globals core_globals;
-#else
-PHPAPI int core_globals_id;
-#endif
-
-static void php_build_argv(char *s, zval *track_vars_array ELS_DC PLS_DC);
-
-#define SAFE_FILENAME(f) ((f)?(f):"-")
-
-/* {{{ PHP_INI_MH
- */
-static PHP_INI_MH(OnSetPrecision)
-{
- ELS_FETCH();
-
- EG(precision) = atoi(new_value);
- return SUCCESS;
-}
-/* }}} */
-
-#if MEMORY_LIMIT
-/* {{{ PHP_INI_MH
- */
-static PHP_INI_MH(OnChangeMemoryLimit)
-{
- int new_limit;
-
- if (new_value) {
- new_limit = zend_atoi(new_value, new_value_length);
- } else {
- new_limit = 1<<30; /* effectively, no limit */
- }
- return zend_set_memory_limit(new_limit);
-}
-/* }}} */
-#endif
-
-/* {{{ PHP_INI_MH
- */
-static PHP_INI_MH(OnUpdateErrorReporting)
-{
- ELS_FETCH();
-
- if (!new_value) {
- EG(error_reporting) = E_ALL & ~E_NOTICE;
- } else {
- EG(error_reporting) = atoi(new_value);
- }
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ php_disable_functions
- */
-static void php_disable_functions()
-{
- char *func;
- char *new_value_dup = strdup(INI_STR("disable_functions")); /* This is an intentional leak,
- * it's not a big deal as it's process-wide
- */
-
- func = strtok(new_value_dup, ", ");
- while (func) {
- zend_disable_function(func, strlen(func));
- func = strtok(NULL, ", ");
- }
-}
-/* }}} */
-
-/* {{{ PHP_INI_MH
- */
-static PHP_INI_MH(OnUpdateTimeout)
-{
- ELS_FETCH();
-
- EG(timeout_seconds) = atoi(new_value);
- if (stage==PHP_INI_STAGE_STARTUP) {
- /* Don't set a timeout on startup, only per-request */
- return SUCCESS;
- }
- zend_unset_timeout();
- zend_set_timeout(EG(timeout_seconds));
- return SUCCESS;
-}
-/* }}} */
-
-/* Need to convert to strings and make use of:
- * PHP_SAFE_MODE
- *
- * Need to be read from the environment (?):
- * PHP_AUTO_PREPEND_FILE
- * PHP_AUTO_APPEND_FILE
- * PHP_DOCUMENT_ROOT
- * PHP_USER_DIR
- * PHP_INCLUDE_PATH
- */
-
-#ifndef SAFE_MODE_EXEC_DIR
-# define SAFE_MODE_EXEC_DIR "/"
-#endif
-
-#ifdef PHP_PROG_SENDMAIL
-# define DEFAULT_SENDMAIL_PATH PHP_PROG_SENDMAIL " -t -i "
-#else
-# define DEFAULT_SENDMAIL_PATH NULL
-#endif
-/* {{{ PHP_INI
- */
-PHP_INI_BEGIN()
- PHP_INI_ENTRY_EX("define_syslog_variables", "0", PHP_INI_ALL, NULL, php_ini_boolean_displayer_cb)
- PHP_INI_ENTRY_EX("highlight.bg", HL_BG_COLOR, PHP_INI_ALL, NULL, php_ini_color_displayer_cb)
- PHP_INI_ENTRY_EX("highlight.comment", HL_COMMENT_COLOR, PHP_INI_ALL, NULL, php_ini_color_displayer_cb)
- PHP_INI_ENTRY_EX("highlight.default", HL_DEFAULT_COLOR, PHP_INI_ALL, NULL, php_ini_color_displayer_cb)
- PHP_INI_ENTRY_EX("highlight.html", HL_HTML_COLOR, PHP_INI_ALL, NULL, php_ini_color_displayer_cb)
- PHP_INI_ENTRY_EX("highlight.keyword", HL_KEYWORD_COLOR, PHP_INI_ALL, NULL, php_ini_color_displayer_cb)
- PHP_INI_ENTRY_EX("highlight.string", HL_STRING_COLOR, PHP_INI_ALL, NULL, php_ini_color_displayer_cb)
-
- STD_PHP_INI_BOOLEAN("allow_call_time_pass_reference","1",PHP_INI_SYSTEM|PHP_INI_PERDIR, OnUpdateBool, allow_call_time_pass_reference, zend_compiler_globals, compiler_globals)
- STD_PHP_INI_BOOLEAN("asp_tags", "0", PHP_INI_SYSTEM|PHP_INI_PERDIR, OnUpdateBool, asp_tags, zend_compiler_globals, compiler_globals)
- STD_PHP_INI_BOOLEAN("display_errors", "1", PHP_INI_ALL, OnUpdateBool, display_errors, php_core_globals, core_globals)
- STD_PHP_INI_BOOLEAN("display_startup_errors", "0", PHP_INI_ALL, OnUpdateBool, display_startup_errors, php_core_globals, core_globals)
- STD_PHP_INI_BOOLEAN("enable_dl", "1", PHP_INI_SYSTEM, OnUpdateBool, enable_dl, php_core_globals, core_globals)
- STD_PHP_INI_BOOLEAN("expose_php", "1", PHP_INI_SYSTEM, OnUpdateBool, expose_php, php_core_globals, core_globals)
- STD_PHP_INI_BOOLEAN("html_errors", "1", PHP_INI_SYSTEM, OnUpdateBool, html_errors, php_core_globals, core_globals)
- STD_PHP_INI_BOOLEAN("ignore_user_abort", "0", PHP_INI_ALL, OnUpdateBool, ignore_user_abort, php_core_globals, core_globals)
- STD_PHP_INI_BOOLEAN("implicit_flush", "0", PHP_INI_PERDIR|PHP_INI_SYSTEM,OnUpdateBool, implicit_flush, php_core_globals, core_globals)
- STD_PHP_INI_BOOLEAN("log_errors", "0", PHP_INI_ALL, OnUpdateBool, log_errors, php_core_globals, core_globals)
- STD_PHP_INI_BOOLEAN("magic_quotes_gpc", "1", PHP_INI_ALL, OnUpdateBool, magic_quotes_gpc, php_core_globals, core_globals)
- STD_PHP_INI_BOOLEAN("magic_quotes_runtime", "0", PHP_INI_ALL, OnUpdateBool, magic_quotes_runtime, php_core_globals, core_globals)
- STD_PHP_INI_BOOLEAN("magic_quotes_sybase", "0", PHP_INI_ALL, OnUpdateBool, magic_quotes_sybase, php_core_globals, core_globals)
- STD_PHP_INI_BOOLEAN("output_buffering", "0", PHP_INI_PERDIR|PHP_INI_SYSTEM,OnUpdateBool, output_buffering, php_core_globals, core_globals)
- STD_PHP_INI_ENTRY("output_handler", NULL, PHP_INI_PERDIR|PHP_INI_SYSTEM,OnUpdateString, output_handler, php_core_globals, core_globals)
- STD_PHP_INI_BOOLEAN("register_argc_argv", "1", PHP_INI_ALL, OnUpdateBool, register_argc_argv, php_core_globals, core_globals)
- STD_PHP_INI_BOOLEAN("register_globals", "1", PHP_INI_ALL, OnUpdateBool, register_globals, php_core_globals, core_globals)
- STD_PHP_INI_BOOLEAN("safe_mode", "0", PHP_INI_SYSTEM, OnUpdateBool, safe_mode, php_core_globals, core_globals)
- STD_PHP_INI_BOOLEAN("short_open_tag",DEFAULT_SHORT_OPEN_TAG, PHP_INI_SYSTEM|PHP_INI_PERDIR, OnUpdateBool, short_tags, zend_compiler_globals, compiler_globals)
- STD_PHP_INI_BOOLEAN("sql.safe_mode", "0", PHP_INI_SYSTEM, OnUpdateBool, sql_safe_mode, php_core_globals, core_globals)
- STD_PHP_INI_BOOLEAN("track_errors", "0", PHP_INI_ALL, OnUpdateBool, track_errors, php_core_globals, core_globals)
- STD_PHP_INI_BOOLEAN("y2k_compliance", "0", PHP_INI_ALL, OnUpdateBool, y2k_compliance, php_core_globals, core_globals)
-
- STD_PHP_INI_ENTRY("arg_separator.output", "&", PHP_INI_ALL, OnUpdateStringUnempty, arg_separator.output, php_core_globals, core_globals)
- STD_PHP_INI_ENTRY("arg_separator.input", "&", PHP_INI_SYSTEM|PHP_INI_PERDIR, OnUpdateStringUnempty, arg_separator.input, php_core_globals, core_globals)
-
- STD_PHP_INI_ENTRY("auto_append_file", NULL, PHP_INI_ALL, OnUpdateString, auto_append_file, php_core_globals, core_globals)
- STD_PHP_INI_ENTRY("auto_prepend_file", NULL, PHP_INI_ALL, OnUpdateString, auto_prepend_file, php_core_globals, core_globals)
- STD_PHP_INI_ENTRY("doc_root", NULL, PHP_INI_SYSTEM, OnUpdateStringUnempty, doc_root, php_core_globals, core_globals)
- STD_PHP_INI_ENTRY("default_charset", SAPI_DEFAULT_CHARSET, PHP_INI_ALL, OnUpdateString, default_charset, sapi_globals_struct,sapi_globals)
- STD_PHP_INI_ENTRY("default_mimetype",SAPI_DEFAULT_MIMETYPE, PHP_INI_ALL, OnUpdateString, default_mimetype, sapi_globals_struct,sapi_globals)
- STD_PHP_INI_ENTRY("error_log", NULL, PHP_INI_ALL, OnUpdateString, error_log, php_core_globals, core_globals)
- STD_PHP_INI_ENTRY("extension_dir", PHP_EXTENSION_DIR, PHP_INI_SYSTEM, OnUpdateStringUnempty, extension_dir, php_core_globals, core_globals)
- STD_PHP_INI_ENTRY("gpc_order", "GPC", PHP_INI_ALL, OnUpdateStringUnempty, gpc_order, php_core_globals, core_globals)
- STD_PHP_INI_ENTRY("include_path", PHP_INCLUDE_PATH, PHP_INI_ALL, OnUpdateStringUnempty, include_path, php_core_globals, core_globals)
- PHP_INI_ENTRY("max_execution_time", "30", PHP_INI_ALL, OnUpdateTimeout)
- STD_PHP_INI_ENTRY("open_basedir", NULL, PHP_INI_SYSTEM, OnUpdateStringUnempty, open_basedir, php_core_globals, core_globals)
- STD_PHP_INI_ENTRY("safe_mode_exec_dir", "1", PHP_INI_SYSTEM, OnUpdateString, safe_mode_exec_dir, php_core_globals, core_globals)
- STD_PHP_INI_ENTRY("upload_max_filesize", "2M", PHP_INI_ALL, OnUpdateInt, upload_max_filesize, php_core_globals, core_globals)
- STD_PHP_INI_ENTRY("file_uploads", "1", PHP_INI_ALL, OnUpdateBool, file_uploads, php_core_globals, core_globals)
- STD_PHP_INI_ENTRY("post_max_size", "8M", PHP_INI_SYSTEM, OnUpdateInt, post_max_size, sapi_globals_struct,sapi_globals)
- STD_PHP_INI_ENTRY("upload_tmp_dir", NULL, PHP_INI_SYSTEM, OnUpdateStringUnempty, upload_tmp_dir, php_core_globals, core_globals)
- STD_PHP_INI_ENTRY("user_dir", NULL, PHP_INI_SYSTEM, OnUpdateStringUnempty, user_dir, php_core_globals, core_globals)
- STD_PHP_INI_ENTRY("variables_order", NULL, PHP_INI_ALL, OnUpdateStringUnempty, variables_order, php_core_globals, core_globals)
-
- STD_PHP_INI_ENTRY("error_append_string", NULL, PHP_INI_ALL, OnUpdateStringUnempty, error_append_string, php_core_globals, core_globals)
- STD_PHP_INI_ENTRY("error_prepend_string", NULL, PHP_INI_ALL, OnUpdateStringUnempty, error_prepend_string, php_core_globals, core_globals)
-
- PHP_INI_ENTRY("SMTP", "localhost",PHP_INI_ALL, NULL)
- PHP_INI_ENTRY("browscap", NULL, PHP_INI_SYSTEM, NULL)
- PHP_INI_ENTRY("error_reporting", NULL, PHP_INI_ALL, OnUpdateErrorReporting)
-#if MEMORY_LIMIT
- PHP_INI_ENTRY("memory_limit", "8M", PHP_INI_ALL, OnChangeMemoryLimit)
-#endif
- PHP_INI_ENTRY("precision", "14", PHP_INI_ALL, OnSetPrecision)
- PHP_INI_ENTRY("sendmail_from", NULL, PHP_INI_ALL, NULL)
- PHP_INI_ENTRY("sendmail_path", DEFAULT_SENDMAIL_PATH, PHP_INI_SYSTEM, NULL)
- PHP_INI_ENTRY("disable_functions", "", PHP_INI_SYSTEM, NULL)
-
- STD_PHP_INI_ENTRY("allow_url_fopen", "1", PHP_INI_ALL, OnUpdateBool, allow_url_fopen, php_core_globals, core_globals)
-
-PHP_INI_END()
-/* }}} */
-
-/* True global (no need for thread safety */
-static int module_initialized = 0;
-
-/* {{{ php_log_err
- */
-PHPAPI void php_log_err(char *log_message)
-{
- FILE *log_file;
- char error_time_str[128];
- struct tm tmbuf;
- time_t error_time;
- PLS_FETCH();
-
- /* Try to use the specified logging location. */
- if (PG(error_log) != NULL) {
-#ifdef HAVE_SYSLOG_H
- if (!strcmp(PG(error_log), "syslog")) {
- php_syslog(LOG_NOTICE, "%.500s", log_message);
- return;
- }
-#endif
- log_file = VCWD_FOPEN(PG(error_log), "a");
- if (log_file != NULL) {
- time(&error_time);
- strftime(error_time_str, 128, "%d-%b-%Y %H:%M:%S", php_localtime_r(&error_time, &tmbuf));
- fprintf(log_file, "[%s] ", error_time_str);
- fprintf(log_file, "%s", log_message);
- fprintf(log_file, "\n");
- fclose(log_file);
- return;
- }
- }
-
- /* Otherwise fall back to the default logging location, if we have one */
-
- if (sapi_module.log_message) {
- sapi_module.log_message(log_message);
- }
-}
-/* }}} */
-
-/* is 4K big enough? */
-#define PRINTF_BUFFER_SIZE 1024*4
-
-/* {{{ php_write
- wrapper for modules to use PHPWRITE */
-PHPAPI int php_write(void *buf, uint size)
-{
- return PHPWRITE(buf, size);
-}
-/* }}} */
-
-/* {{{ php_printf
- */
-PHPAPI int php_printf(const char *format, ...)
-{
- va_list args;
- int ret;
- char buffer[PRINTF_BUFFER_SIZE];
- int size;
-
- va_start(args, format);
- size = vsnprintf(buffer, sizeof(buffer), format, args);
- if(size > sizeof(buffer) - 1) {
- size = sizeof(buffer) - 1;
- }
- ret = PHPWRITE(buffer, size);
- va_end(args);
-
- return ret;
-}
-/* }}} */
-
-/* {{{ php_error_cb
- extended error handling function */
-static void php_error_cb(int type, const char *error_filename, const uint error_lineno, const char *format, va_list args)
-{
- char buffer[1024];
- int buffer_len;
- ELS_FETCH();
- PLS_FETCH();
-
- buffer_len = vsnprintf(buffer, sizeof(buffer)-1, format, args);
- buffer[sizeof(buffer)-1]=0;
- if(buffer_len > sizeof(buffer) - 1 || buffer_len < 0) {
- buffer_len = sizeof(buffer) - 1;
- }
-
- /* display/log the error if necessary */
- if ((EG(error_reporting) & type || (type & E_CORE))
- && (PG(log_errors) || PG(display_errors) || (!module_initialized))) {
- char *error_type_str;
-
- switch (type) {
- case E_ERROR:
- case E_CORE_ERROR:
- case E_COMPILE_ERROR:
- case E_USER_ERROR:
- error_type_str = "Fatal error";
- break;
- case E_WARNING:
- case E_CORE_WARNING:
- case E_COMPILE_WARNING:
- case E_USER_WARNING:
- error_type_str = "Warning";
- break;
- case E_PARSE:
- error_type_str = "Parse error";
- break;
- case E_NOTICE:
- error_type_str = "Warning";
- break;
- case E_USER_NOTICE:
- error_type_str = "Notice";
- break;
- default:
- error_type_str = "Unknown error";
- break;
- }
-
- if (!module_initialized || PG(log_errors)) {
- char log_buffer[1024];
-
-#ifdef PHP_WIN32
- if (type==E_CORE_ERROR || type==E_CORE_WARNING) {
- MessageBox(NULL, buffer, error_type_str, MB_OK|ZEND_SERVICE_MB_STYLE);
- }
-#endif
- snprintf(log_buffer, 1024, "PHP %s: %s in %s on line %d", error_type_str, buffer, error_filename, error_lineno);
- php_log_err(log_buffer);
- }
- if (module_initialized && PG(display_errors)
- && (!PG(during_request_startup) || PG(display_startup_errors))) {
- char *prepend_string = INI_STR("error_prepend_string");
- char *append_string = INI_STR("error_append_string");
- char *error_format;
-
- error_format = PG(html_errors) ?
- "<br>\n<b>%s</b>: %s in <b>%s</b> on line <b>%d</b><br>\n"
- : "\n%s: %s in %s on line %d\n";
-
- if (prepend_string) {
- PUTS(prepend_string);
- }
- php_printf(error_format, error_type_str, buffer,
- error_filename, error_lineno);
- if (append_string) {
- PUTS(append_string);
- }
- }
-#if ZEND_DEBUG
- {
- zend_bool trigger_break;
-
- switch (type) {
- case E_ERROR:
- case E_CORE_ERROR:
- case E_COMPILE_ERROR:
- case E_USER_ERROR:
- trigger_break=1;
- break;
- default:
- trigger_break=0;
- break;
- }
- zend_output_debug_string(trigger_break, "%s(%d) : %s - %s", error_filename, error_lineno, error_type_str, buffer);
- }
-#endif
- }
-
- /* Bail out if we can't recover */
- switch (type) {
- case E_CORE_ERROR:
- if(!module_initialized) {
- /* bad error in module startup - no way we can live with this */
- exit(-2);
- }
- /* no break - intentionally */
- case E_ERROR:
- /*case E_PARSE: the parser would return 1 (failure), we can bail out nicely */
- case E_COMPILE_ERROR:
- case E_USER_ERROR:
- if (module_initialized) {
- zend_bailout();
- return;
- }
- break;
- }
-
- /* Log if necessary */
- if (PG(track_errors) && EG(active_symbol_table)) {
- pval *tmp;
-
- ALLOC_ZVAL(tmp);
- INIT_PZVAL(tmp);
- tmp->value.str.val = (char *) estrndup(buffer, buffer_len);
- tmp->value.str.len = buffer_len;
- tmp->type = IS_STRING;
- zend_hash_update(EG(active_symbol_table), "php_errormsg", sizeof("php_errormsg"), (void **) & tmp, sizeof(pval *), NULL);
- }
-}
-/* }}} */
-
-/* {{{ proto void set_time_limit(int seconds)
- Sets the maximum time a script can run */
-PHP_FUNCTION(set_time_limit)
-{
- zval **new_timeout;
- PLS_FETCH();
-
- if (PG(safe_mode)) {
- php_error(E_WARNING, "Cannot set time limit in safe mode");
- RETURN_FALSE;
- }
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &new_timeout) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(new_timeout);
- zend_unset_timeout();
- zend_set_timeout(Z_LVAL_PP(new_timeout));
-}
-/* }}} */
-
-/* {{{ php_fopen_wrapper_for_zend
- */
-static FILE *php_fopen_wrapper_for_zend(const char *filename, char **opened_path)
-{
- int issock=0, socketd=0;
- int old_chunk_size;
- FILE *retval;
-
- old_chunk_size = php_sock_set_def_chunk_size(1);
- retval=php_fopen_wrapper((char *) filename, "rb", USE_PATH|IGNORE_URL_WIN, &issock, &socketd, opened_path);
- php_sock_set_def_chunk_size(old_chunk_size);
-
- if (issock) {
- retval = fdopen(socketd, "rb");
- }
- return retval;
-}
-/* }}} */
-
-/* {{{ php_get_configuration_directive_for_zend
- */
-static int php_get_configuration_directive_for_zend(char *name, uint name_length, zval *contents)
-{
- zval *retval = cfg_get_entry(name, name_length);
-
- if (retval) {
- *contents = *retval;
- return SUCCESS;
- } else {
- return FAILURE;
- }
-}
-/* }}} */
-
-/* {{{ php_message_handler_for_zend
- */
-static void php_message_handler_for_zend(long message, void *data)
-{
- switch (message) {
- case ZMSG_FAILED_INCLUDE_FOPEN: {
- PLS_FETCH();
-
- php_error(E_WARNING, "Failed opening '%s' for inclusion (include_path='%s')", php_strip_url_passwd((char *) data), STR_PRINT(PG(include_path)));
- }
- break;
- case ZMSG_FAILED_REQUIRE_FOPEN: {
- PLS_FETCH();
-
- php_error(E_COMPILE_ERROR, "Failed opening required '%s' (include_path='%s')", php_strip_url_passwd((char *) data), STR_PRINT(PG(include_path)));
- }
- break;
- case ZMSG_FAILED_HIGHLIGHT_FOPEN:
- php_error(E_WARNING, "Failed opening '%s' for highlighting", php_strip_url_passwd((char *) data));
- break;
- case ZMSG_MEMORY_LEAK_DETECTED:
- case ZMSG_MEMORY_LEAK_REPEATED: {
- ELS_FETCH();
-
- if (EG(error_reporting)&E_WARNING) {
-#if ZEND_DEBUG
- char memory_leak_buf[512];
- SLS_FETCH();
-
- if (message==ZMSG_MEMORY_LEAK_DETECTED) {
- zend_mem_header *t = (zend_mem_header *) data;
- void *ptr = (void *)((char *)t+sizeof(zend_mem_header)+MEM_HEADER_PADDING);
-
- snprintf(memory_leak_buf, 512, "%s(%d) : Freeing 0x%.8lX (%d bytes), script=%s\n", t->filename, t->lineno, (unsigned long)ptr, t->size, SAFE_FILENAME(SG(request_info).path_translated));
- if (t->orig_filename) {
- char relay_buf[512];
-
- snprintf(relay_buf, 512, "%s(%d) : Actual location (location was relayed)\n", t->orig_filename, t->orig_lineno);
- strcat(memory_leak_buf, relay_buf);
- }
- } else {
- unsigned long leak_count = (unsigned long) data;
-
- snprintf(memory_leak_buf, 512, "Last leak repeated %ld time%s\n", leak_count, (leak_count>1?"s":""));
- }
-# if defined(PHP_WIN32)
- OutputDebugString(memory_leak_buf);
-# else
- fprintf(stderr, memory_leak_buf);
-# endif
-#endif
- }
- }
- break;
- case ZMSG_LOG_SCRIPT_NAME: {
- struct tm *ta, tmbuf;
- time_t curtime;
- char *datetime_str, asctimebuf[52];
- SLS_FETCH();
-
- time(&curtime);
- ta = php_localtime_r(&curtime, &tmbuf);
- datetime_str = php_asctime_r(ta, asctimebuf);
- datetime_str[strlen(datetime_str)-1]=0; /* get rid of the trailing newline */
- fprintf(stderr, "[%s] Script: '%s'\n", datetime_str, SAFE_FILENAME(SG(request_info).path_translated));
- }
- break;
- }
-}
-/* }}} */
-
-#if PHP_SIGCHILD
-/* {{{ sigchld_handler
- */
-static void sigchld_handler(int apar)
-{
- while (waitpid(-1, NULL, WNOHANG) > 0)
- ;
- signal(SIGCHLD,sigchld_handler);
-}
-/* }}} */
-#endif
-
-static int php_hash_environment(ELS_D SLS_DC PLS_DC);
-
-/* {{{ php_request_startup
- */
-int php_request_startup(CLS_D ELS_DC PLS_DC SLS_DC)
-{
-#if PHP_SIGCHILD
- signal(SIGCHLD,sigchld_handler);
-#endif
-
- PG(during_request_startup) = 1;
-
- php_output_startup();
-
- /* initialize global variables */
- PG(modules_activated) = 0;
- PG(header_is_being_sent) = 0;
- PG(connection_status) = PHP_CONNECTION_NORMAL;
-
- zend_activate(CLS_C ELS_CC);
- sapi_activate(SLS_C);
-
- zend_set_timeout(EG(timeout_seconds));
-
- if (PG(expose_php)) {
- sapi_add_header(SAPI_PHP_VERSION_HEADER, sizeof(SAPI_PHP_VERSION_HEADER)-1, 1);
- }
-
- if (PG(output_handler) && PG(output_handler)[0]) {
- zval *output_handler;
-
- ALLOC_INIT_ZVAL(output_handler);
- Z_STRLEN_P(output_handler) = strlen(PG(output_handler)); /* this can be optimized */
- Z_STRVAL_P(output_handler) = estrndup(PG(output_handler), Z_STRLEN_P(output_handler));
- Z_TYPE_P(output_handler) = IS_STRING;
- php_start_ob_buffer(output_handler, 0);
- } else if (PG(output_buffering)) {
- php_start_ob_buffer(NULL, 0);
- } else if (PG(implicit_flush)) {
- php_start_implicit_flush();
- }
-
- /* We turn this off in php_execute_script() */
- /* PG(during_request_startup) = 0; */
-
- php_hash_environment(ELS_C SLS_CC PLS_CC);
- zend_activate_modules();
- PG(modules_activated)=1;
-
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ php_request_shutdown_for_exec
- */
-void php_request_shutdown_for_exec(void *dummy)
-{
- /* used to close fd's in the 3..255 range here, but it's problematic
- */
- shutdown_memory_manager(1, 1);
-}
-/* }}} */
-
-/* {{{ php_request_shutdown
- */
-void php_request_shutdown(void *dummy)
-{
- CLS_FETCH();
- ELS_FETCH();
- SLS_FETCH();
- PLS_FETCH();
-
- if (setjmp(EG(bailout))==0) {
- php_end_ob_buffers((zend_bool)(SG(request_info).headers_only?0:1));
- }
-
- if (setjmp(EG(bailout))==0) {
- sapi_send_headers();
- }
-
- if (PG(modules_activated) && setjmp(EG(bailout))==0) {
- php_call_shutdown_functions();
- }
-
- if (PG(modules_activated)) {
- zend_deactivate_modules();
- }
-
- zend_deactivate(CLS_C ELS_CC);
-
- if (setjmp(EG(bailout))==0) {
- sapi_deactivate(SLS_C);
- }
-
- if (setjmp(EG(bailout))==0) {
- shutdown_memory_manager(CG(unclean_shutdown), 0);
- }
-
- if (setjmp(EG(bailout))==0) {
- zend_unset_timeout();
- }
-}
-/* }}} */
-
-/* {{{ php_config_ini_shutdown
- */
-static void php_config_ini_shutdown(void)
-{
- php_shutdown_config();
-}
-/* }}} */
-
-/* {{{ php_body_write_wrapper
- */
-static int php_body_write_wrapper(const char *str, uint str_length)
-{
- return php_body_write(str, str_length);
-}
-/* }}} */
-
-#ifdef ZTS
-/* {{{ core_globals_ctor
- */
-static void core_globals_ctor(php_core_globals *core_globals)
-{
- memset(core_globals,0,sizeof(*core_globals));
-}
-/* }}} */
-#endif
-
-/* {{{ php_startup_extensions
- */
-int php_startup_extensions(zend_module_entry **ptr, int count)
-{
- zend_module_entry **end = ptr+count;
-
- while (ptr < end) {
- if (*ptr) {
- if (zend_startup_module(*ptr)==FAILURE) {
- return FAILURE;
- }
- }
- ptr++;
- }
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ php_global_startup_extensions
- */
-int php_global_startup_extensions(zend_module_entry **ptr, int count)
-{
- zend_module_entry **end = ptr+count;
-
- while (ptr < end) {
- if (*ptr) {
- if ((*ptr)->global_startup_func &&
- (*ptr)->global_startup_func()==FAILURE) {
- return FAILURE;
- }
- }
- ptr++;
- }
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ php_global_shutdown_extensions
- */
-int php_global_shutdown_extensions(zend_module_entry **ptr, int count)
-{
- zend_module_entry **end = ptr+count;
-
- while (ptr < end) {
- if (*ptr) {
- if ((*ptr)->global_shutdown_func &&
- (*ptr)->global_shutdown_func()==FAILURE) {
- return FAILURE;
- }
- }
- ptr++;
- }
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ php_module_startup
- */
-int php_module_startup(sapi_module_struct *sf)
-{
- zend_utility_functions zuf;
- zend_utility_values zuv;
- int module_number=0; /* for REGISTER_INI_ENTRIES() */
- char *php_os;
-#ifdef ZTS
- zend_executor_globals *executor_globals;
- php_core_globals *core_globals;
- sapi_globals_struct *sapi_globals = ts_resource(sapi_globals_id);
-#endif
-#ifdef PHP_WIN32
- WORD wVersionRequested = MAKEWORD(2, 0);
- WSADATA wsaData;
-#endif
-#ifdef PHP_WIN32
- {
- DWORD dwVersion = GetVersion();
-
- /* Get build numbers for Windows NT or Win95 */
- if (dwVersion < 0x80000000){
- php_os="WINNT";
- } else {
- php_os="WIN32";
- }
- }
-#else
- php_os=PHP_OS;
-#endif
-
- sapi_initialize_empty_request(SLS_C);
- sapi_activate(SLS_C);
-
- if (module_initialized) {
- return SUCCESS;
- }
-
- sapi_module = *sf;
-
- php_output_startup();
-
- zuf.error_function = php_error_cb;
- zuf.printf_function = php_printf;
- zuf.write_function = php_body_write_wrapper;
- zuf.fopen_function = php_fopen_wrapper_for_zend;
- zuf.message_handler = php_message_handler_for_zend;
- zuf.block_interruptions = sapi_module.block_interruptions;
- zuf.unblock_interruptions = sapi_module.unblock_interruptions;
- zuf.get_configuration_directive = php_get_configuration_directive_for_zend;
- zuf.ticks_function = php_run_ticks;
- zend_startup(&zuf, NULL, 1);
-
-#ifdef ZTS
- executor_globals = ts_resource(executor_globals_id);
- core_globals_id = ts_allocate_id(sizeof(php_core_globals), (ts_allocate_ctor) core_globals_ctor, NULL);
- core_globals = ts_resource(core_globals_id);
-#endif
- EG(error_reporting) = E_ALL & ~E_NOTICE;
-
- PG(header_is_being_sent) = 0;
- SG(request_info).headers_only = 0;
- SG(request_info).argv0 = NULL;
- PG(connection_status) = PHP_CONNECTION_NORMAL;
- PG(during_request_startup) = 0;
-
-#if HAVE_SETLOCALE
- setlocale(LC_CTYPE, "");
-#endif
-
-#ifdef PHP_WIN32
- /* start up winsock services */
- if (WSAStartup(wVersionRequested, &wsaData) != 0) {
- php_printf("\nwinsock.dll unusable. %d\n", WSAGetLastError());
- return FAILURE;
- }
-#endif
-
- le_index_ptr = zend_register_list_destructors_ex(NULL, NULL, "index pointer", 0);
-
-
- /* this will read in php.ini, set up the configuration parameters,
- load zend extensions and register php function extensions
- to be loaded later */
- if (php_init_config(sf->php_ini_path_override) == FAILURE) {
- return FAILURE;
- }
-
- REGISTER_INI_ENTRIES();
-
- /* initialize fopen wrappers registry
- (this uses configuration parameters from php.ini)
- */
- if (php_init_fopen_wrappers() == FAILURE) {
- php_printf("PHP: Unable to initialize fopen url wrappers.\n");
- return FAILURE;
- }
-
- /* initialize registry for images to be used in phpinfo()
- (this uses configuration parameters from php.ini)
- */
- if (php_init_info_logos() == FAILURE) {
- php_printf("PHP: Unable to initialize info phpinfo logos.\n");
- return FAILURE;
- }
-
- zuv.import_use_extension = ".php";
- zend_set_utility_values(&zuv);
- php_startup_sapi_content_types();
-
- REGISTER_MAIN_STRINGL_CONSTANT("PHP_VERSION", PHP_VERSION, sizeof(PHP_VERSION)-1, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_STRINGL_CONSTANT("PHP_OS", php_os, strlen(php_os), CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_STRINGL_CONSTANT("DEFAULT_INCLUDE_PATH", PHP_INCLUDE_PATH, sizeof(PHP_INCLUDE_PATH)-1, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_STRINGL_CONSTANT("PEAR_INSTALL_DIR", PEAR_INSTALLDIR, sizeof(PEAR_INSTALLDIR)-1, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_STRINGL_CONSTANT("PEAR_EXTENSION_DIR", PHP_EXTENSION_DIR, sizeof(PHP_EXTENSION_DIR)-1, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_STRINGL_CONSTANT("PHP_EXTENSION_DIR", PHP_EXTENSION_DIR, sizeof(PHP_EXTENSION_DIR)-1, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_STRINGL_CONSTANT("PHP_BINDIR", PHP_BINDIR, sizeof(PHP_BINDIR)-1, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_STRINGL_CONSTANT("PHP_LIBDIR", PHP_LIBDIR, sizeof(PHP_LIBDIR)-1, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_STRINGL_CONSTANT("PHP_DATADIR", PHP_DATADIR, sizeof(PHP_DATADIR)-1, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_STRINGL_CONSTANT("PHP_SYSCONFDIR", PHP_SYSCONFDIR, sizeof(PHP_SYSCONFDIR)-1, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_STRINGL_CONSTANT("PHP_LOCALSTATEDIR", PHP_LOCALSTATEDIR, sizeof(PHP_LOCALSTATEDIR)-1, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_STRINGL_CONSTANT("PHP_CONFIG_FILE_PATH", PHP_CONFIG_FILE_PATH, sizeof(PHP_CONFIG_FILE_PATH)-1, CONST_PERSISTENT | CONST_CS);
- php_output_register_constants();
-
- if (php_startup_ticks(PLS_C) == FAILURE) {
- php_printf("Unable to start PHP ticks\n");
- return FAILURE;
- }
-
- /* startup extensions staticly compiled in */
- if (php_startup_internal_extensions() == FAILURE) {
- php_printf("Unable to start builtin modules\n");
- return FAILURE;
- }
-
- /* load and startup extensions compiled as shared objects (aka DLLs)
- as requested by php.ini entries
- theese are loaded after initialization of internal extensions
- as extensions *might* rely on things from ext/standard
- which is always an internal extension and to be initialized
- ahead of all other internals
- */
- php_ini_delayed_modules_startup();
-
- /* disable certain functions as requested by php.ini */
- php_disable_functions();
-
- zend_startup_extensions();
-
- /* */
- module_initialized = 1;
- sapi_deactivate(SLS_C);
-
- /* we're done */
- return SUCCESS;
-}
-/* }}} */
-
-void php_module_shutdown_for_exec()
-{
- /* used to close fd's in the range 3.255 here, but it's problematic */
-}
-
-/* {{{ php_module_shutdown_wrapper
- */
-int php_module_shutdown_wrapper(sapi_module_struct *sapi_globals)
-{
- php_module_shutdown();
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ php_module_shutdown
- */
-void php_module_shutdown()
-{
- int module_number=0; /* for UNREGISTER_INI_ENTRIES() */
- PLS_FETCH();
-
- if (!module_initialized) {
- return;
- }
-
- /* close down the ini config */
- php_config_ini_shutdown();
-
-#ifdef PHP_WIN32
- /*close winsock */
- WSACleanup();
-#endif
-
- php_shutdown_ticks(PLS_C);
- sapi_flush();
-
- zend_shutdown();
- php_shutdown_fopen_wrappers();
- php_shutdown_info_logos();
- UNREGISTER_INI_ENTRIES();
-#ifndef ZTS
- zend_ini_shutdown(ELS_C);
-#endif
- shutdown_memory_manager(0, 1);
- module_initialized = 0;
-}
-/* }}} */
-
-/* {{{ php_register_server_variables
- */
-static inline void php_register_server_variables(ELS_D SLS_DC PLS_DC)
-{
- zval *array_ptr=NULL;
-
- ALLOC_ZVAL(array_ptr);
- array_init(array_ptr);
- INIT_PZVAL(array_ptr);
- PG(http_globals)[TRACK_VARS_SERVER] = array_ptr;
-
- /* Server variables */
- if (sapi_module.register_server_variables) {
- sapi_module.register_server_variables(array_ptr ELS_CC SLS_CC PLS_CC);
- }
-
- /* argv/argc support */
- if (PG(register_argc_argv)) {
- php_build_argv(SG(request_info).query_string, array_ptr ELS_CC PLS_CC);
- }
-
- /* PHP Authentication support */
- if (SG(request_info).auth_user) {
- php_register_variable("PHP_AUTH_USER", SG(request_info).auth_user, array_ptr ELS_CC PLS_CC);
- }
- if (SG(request_info).auth_password) {
- php_register_variable("PHP_AUTH_PW", SG(request_info).auth_password, array_ptr ELS_CC PLS_CC);
- }
-}
-/* }}} */
-
-/* {{{ php_hash_environment
- */
-static int php_hash_environment(ELS_D SLS_DC PLS_DC)
-{
- char *p;
- unsigned char _gpc_flags[3] = {0,0,0};
- zend_bool have_variables_order;
- zval *dummy_track_vars_array;
- zend_bool initialized_dummy_track_vars_array=0;
- int i;
- char *track_vars_names[] = {
- "HTTP_POST_VARS",
- "HTTP_GET_VARS",
- "HTTP_COOKIE_VARS",
- "HTTP_SERVER_VARS",
- "HTTP_ENV_VARS",
- "HTTP_POST_FILES",
- NULL
- };
- int track_vars_names_length[] = {
- sizeof("HTTP_POST_VARS"),
- sizeof("HTTP_GET_VARS"),
- sizeof("HTTP_COOKIE_VARS"),
- sizeof("HTTP_SERVER_VARS"),
- sizeof("HTTP_ENV_VARS"),
- sizeof("HTTP_POST_FILES")
- };
-
-
- for (i=0; i<6; i++) {
- PG(http_globals)[i] = NULL;
- }
-
- if (PG(variables_order)) {
- p = PG(variables_order);
- have_variables_order=1;
- } else {
- p = PG(gpc_order);
- have_variables_order=0;
- ALLOC_ZVAL(PG(http_globals)[TRACK_VARS_ENV]);
- array_init(PG(http_globals)[TRACK_VARS_ENV]);
- INIT_PZVAL(PG(http_globals)[TRACK_VARS_ENV]);
- php_import_environment_variables(PG(http_globals)[TRACK_VARS_ENV] ELS_CC PLS_CC);
- }
-
- while(p && *p) {
- switch(*p++) {
- case 'p':
- case 'P':
- if (!_gpc_flags[0] && !SG(headers_sent) && SG(request_info).request_method && !strcasecmp(SG(request_info).request_method, "POST")) {
- php_treat_data(PARSE_POST, NULL, NULL ELS_CC PLS_CC SLS_CC); /* POST Data */
- _gpc_flags[0]=1;
- }
- break;
- case 'c':
- case 'C':
- if (!_gpc_flags[1]) {
- php_treat_data(PARSE_COOKIE, NULL, NULL ELS_CC PLS_CC SLS_CC); /* Cookie Data */
- _gpc_flags[1]=1;
- }
- break;
- case 'g':
- case 'G':
- if (!_gpc_flags[2]) {
- php_treat_data(PARSE_GET, NULL, NULL ELS_CC PLS_CC SLS_CC); /* GET Data */
- _gpc_flags[2]=1;
- }
- break;
- case 'e':
- case 'E':
- if (have_variables_order) {
- ALLOC_ZVAL(PG(http_globals)[TRACK_VARS_ENV]);
- array_init(PG(http_globals)[TRACK_VARS_ENV]);
- INIT_PZVAL(PG(http_globals)[TRACK_VARS_ENV]);
- php_import_environment_variables(PG(http_globals)[TRACK_VARS_ENV] ELS_CC PLS_CC);
- } else {
- php_error(E_WARNING, "Unsupported 'e' element (environment) used in gpc_order - use variables_order instead");
- }
- break;
- case 's':
- case 'S':
- php_register_server_variables(ELS_C SLS_CC PLS_CC);
- break;
- }
- }
-
- if (!have_variables_order) {
- php_register_server_variables(ELS_C SLS_CC PLS_CC);
- }
-
- for (i=0; i<6; i++) {
- if (!PG(http_globals)[i]) {
- if (!initialized_dummy_track_vars_array) {
- ALLOC_ZVAL(dummy_track_vars_array);
- array_init(dummy_track_vars_array);
- INIT_PZVAL(dummy_track_vars_array);
- initialized_dummy_track_vars_array = 1;
- } else {
- dummy_track_vars_array->refcount++;
- }
- PG(http_globals)[i] = dummy_track_vars_array;
- }
- zend_hash_update(&EG(symbol_table), track_vars_names[i], track_vars_names_length[i], &PG(http_globals)[i], sizeof(zval *), NULL);
- }
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ php_build_argv
- */
-static void php_build_argv(char *s, zval *track_vars_array ELS_DC PLS_DC)
-{
- pval *arr, *argc, *tmp;
- int count = 0;
- char *ss, *space;
-
- ALLOC_ZVAL(arr);
- array_init(arr);
- INIT_PZVAL(arr);
-
- /* Prepare argv */
- if (s && *s) {
- ss = s;
- while (ss) {
- space = strchr(ss, '+');
- if (space) {
- *space = '\0';
- }
- /* auto-type */
- ALLOC_ZVAL(tmp);
- tmp->type = IS_STRING;
- tmp->value.str.len = strlen(ss);
- tmp->value.str.val = estrndup(ss, tmp->value.str.len);
- INIT_PZVAL(tmp);
- count++;
- if (zend_hash_next_index_insert(arr->value.ht, &tmp, sizeof(pval *), NULL)==FAILURE) {
- if (tmp->type == IS_STRING) {
- efree(tmp->value.str.val);
- }
- }
- if (space) {
- *space = '+';
- ss = space + 1;
- } else {
- ss = space;
- }
- }
- }
-
- /* prepare argc */
- ALLOC_ZVAL(argc);
- argc->value.lval = count;
- argc->type = IS_LONG;
- INIT_PZVAL(argc);
-
- if (PG(register_globals)) {
- arr->refcount++;
- argc->refcount++;
- zend_hash_update(&EG(symbol_table), "argv", sizeof("argv"), &arr, sizeof(zval *), NULL);
- zend_hash_add(&EG(symbol_table), "argc", sizeof("argc"), &argc, sizeof(zval *), NULL);
- }
-
- zend_hash_update(track_vars_array->value.ht, "argv", sizeof("argv"), &arr, sizeof(pval *), NULL);
- zend_hash_update(track_vars_array->value.ht, "argc", sizeof("argc"), &argc, sizeof(pval *), NULL);
-}
-/* }}} */
-
-/* {{{ php_handle_special_queries
- */
-PHPAPI int php_handle_special_queries(SLS_D PLS_DC)
-{
- if (SG(request_info).query_string && SG(request_info).query_string[0]=='='
- && PG(expose_php)) {
- if (php_info_logos(SG(request_info).query_string+1)) {
- return 1;
- } else if (!strcmp(SG(request_info).query_string+1, PHP_CREDITS_GUID)) {
- php_print_credits(PHP_CREDITS_ALL);
- return 1;
- }
- }
- return 0;
-}
-/* }}} */
-
-/* {{{ php_execute_script
- */
-PHPAPI int php_execute_script(zend_file_handle *primary_file CLS_DC ELS_DC PLS_DC)
-{
- zend_file_handle *prepend_file_p, *append_file_p;
- zend_file_handle prepend_file, append_file;
- char *old_cwd;
- SLS_FETCH();
-
- EG(exit_status) = 0;
- if (php_handle_special_queries(SLS_C PLS_CC))
- return 0;
-#define OLD_CWD_SIZE 4096
- old_cwd = do_alloca(OLD_CWD_SIZE);
- old_cwd[0] = '\0';
-
- if (setjmp(EG(bailout))!=0) {
- if (old_cwd[0] != '\0')
- VCWD_CHDIR(old_cwd);
- free_alloca(old_cwd);
- return EG(exit_status);
- }
-
-#ifdef PHP_WIN32
- UpdateIniFromRegistry(primary_file->filename);
-#endif
-
- PG(during_request_startup) = 0;
-
- if (primary_file->type == ZEND_HANDLE_FILENAME
- && primary_file->filename) {
- VCWD_GETCWD(old_cwd, OLD_CWD_SIZE-1);
- VCWD_CHDIR_FILE(primary_file->filename);
- }
-
- if (PG(auto_prepend_file) && PG(auto_prepend_file)[0]) {
- prepend_file.filename = PG(auto_prepend_file);
- prepend_file.opened_path = NULL;
- prepend_file.free_filename = 0;
- prepend_file.type = ZEND_HANDLE_FILENAME;
- prepend_file_p = &prepend_file;
- } else {
- prepend_file_p = NULL;
- }
- if (PG(auto_append_file) && PG(auto_append_file)[0]) {
- append_file.filename = PG(auto_append_file);
- append_file.opened_path = NULL;
- append_file.free_filename = 0;
- append_file.type = ZEND_HANDLE_FILENAME;
- append_file_p = &append_file;
- } else {
- append_file_p = NULL;
- }
- zend_execute_scripts(ZEND_REQUIRE CLS_CC ELS_CC, 3, prepend_file_p, primary_file, append_file_p);
-
- if (old_cwd[0] != '\0')
- VCWD_CHDIR(old_cwd);
- free_alloca(old_cwd);
-
- return EG(exit_status);
-}
-/* }}} */
-
-/* {{{ php_handle_aborted_connection
- */
-PHPAPI void php_handle_aborted_connection(void)
-{
- PLS_FETCH();
-
- PG(connection_status) = PHP_CONNECTION_ABORTED;
-
- if (!PG(ignore_user_abort)) {
- zend_bailout();
- }
-}
-/* }}} */
-
-/* {{{ php_handle_auth_data
- */
-PHPAPI int php_handle_auth_data(const char *auth SLS_DC)
-{
- int ret = -1;
-
- if (auth && auth[0] != '\0'
- && strncmp(auth, "Basic ", 6) == 0) {
- char *pass;
- char *user;
-
- user = php_base64_decode(auth + 6, strlen(auth) - 6, NULL);
- if (user) {
- pass = strchr(user, ':');
- if (pass) {
- *pass++ = '\0';
- SG(request_info).auth_user = user;
- SG(request_info).auth_password = estrdup(pass);
- ret = 0;
- } else {
- efree(user);
- }
- }
- }
-
- if (ret == -1)
- SG(request_info).auth_user = SG(request_info).auth_password = NULL;
-
- return ret;
-}
-/* }}} */
-
-/* {{{ php_lint_script
- */
-PHPAPI int php_lint_script(zend_file_handle *file CLS_DC ELS_DC PLS_DC)
-{
- zend_op_array *op_array;
- SLS_FETCH();
-
- if (setjmp(EG(bailout))!=0) {
- return FAILURE;
- }
-
- op_array = zend_compile_file(file, ZEND_INCLUDE CLS_CC);
- zend_destroy_file_handle(file CLS_CC);
-
- if (op_array) {
- destroy_op_array(op_array);
- efree(op_array);
- return SUCCESS;
- } else {
- return FAILURE;
- }
-}
-/* }}} */
-
-#ifdef PHP_WIN32
-/* {{{ dummy_indent
- just so that this symbol gets exported... */
-PHPAPI void dummy_indent()
-{
- zend_indent();
-}
-/* }}} */
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/main/mergesort.c b/main/mergesort.c
deleted file mode 100644
index 73c65c5100..0000000000
--- a/main/mergesort.c
+++ /dev/null
@@ -1,356 +0,0 @@
-/*-
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Peter McIlroy.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)merge.c 8.2 (Berkeley) 2/14/94";
-#endif /* LIBC_SCCS and not lint */
-
-/*
- * Hybrid exponential search/linear search merge sort with hybrid
- * natural/pairwise first pass. Requires about .3% more comparisons
- * for random data than LSMS with pairwise first pass alone.
- * It works for objects as small as two bytes.
- */
-
-#define NATURAL
-#define THRESHOLD 16 /* Best choice for natural merge cut-off. */
-
-/* #define NATURAL to get hybrid natural merge.
- * (The default is pairwise merging.)
- */
-
-#include <sys/types.h>
-
-#include <errno.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "php.h"
-
-#ifdef PHP_WIN32
-#include <winsock.h> /* Includes definition for u_char */
-#endif
-
-static void setup(u_char *list1, u_char *list2, size_t n, size_t size, int (*cmp)(const void *, const void *));
-static void insertionsort(u_char *a, size_t n, size_t size, int (*cmp)(const void *, const void *));
-
-#define ISIZE sizeof(int)
-#define PSIZE sizeof(u_char *)
-#define ICOPY_LIST(src, dst, last) \
- do \
- *(int*)dst = *(int*)src, src += ISIZE, dst += ISIZE; \
- while(src < last)
-#define ICOPY_ELT(src, dst, i) \
- do \
- *(int*) dst = *(int*) src, src += ISIZE, dst += ISIZE; \
- while (i -= ISIZE)
-
-#define CCOPY_LIST(src, dst, last) \
- do \
- *dst++ = *src++; \
- while (src < last)
-#define CCOPY_ELT(src, dst, i) \
- do \
- *dst++ = *src++; \
- while (i -= 1)
-
-/*
- * Find the next possible pointer head. (Trickery for forcing an array
- * to do double duty as a linked list when objects do not align with word
- * boundaries.
- */
-/* Assumption: PSIZE is a power of 2. */
-#define EVAL(p) (u_char **) \
- ((u_char *)0 + \
- (((u_char *)p + PSIZE - 1 - (u_char *) 0) & ~(PSIZE - 1)))
-
-/* {{{ php_mergesort
- * Arguments are as for qsort.
- */
-int php_mergesort(void *base, size_t nmemb, size_t size, int (*cmp)(const void *, const void *))
-{
- register unsigned int i;
- register int sense;
- int big, iflag;
- register u_char *f1, *f2, *t, *b, *tp2, *q, *l1, *l2;
- u_char *list2, *list1, *p2, *p, *last, **p1;
-
- if (size < PSIZE / 2) { /* Pointers must fit into 2 * size. */
- errno = EINVAL;
- return (-1);
- }
-
- if (nmemb == 0)
- return (0);
-
- /*
- * XXX
- * Stupid subtraction for the Cray.
- */
- iflag = 0;
- if (!(size % ISIZE) && !(((char *)base - (char *)0) % ISIZE))
- iflag = 1;
-
- if ((list2 = malloc(nmemb * size + PSIZE)) == NULL)
- return (-1);
-
- list1 = base;
- setup(list1, list2, nmemb, size, cmp);
- last = list2 + nmemb * size;
- i = big = 0;
- while (*EVAL(list2) != last) {
- l2 = list1;
- p1 = EVAL(list1);
- for (tp2 = p2 = list2; p2 != last; p1 = EVAL(l2)) {
- p2 = *EVAL(p2);
- f1 = l2;
- f2 = l1 = list1 + (p2 - list2);
- if (p2 != last)
- p2 = *EVAL(p2);
- l2 = list1 + (p2 - list2);
- while (f1 < l1 && f2 < l2) {
- if ((*cmp)(f1, f2) <= 0) {
- q = f2;
- b = f1, t = l1;
- sense = -1;
- } else {
- q = f1;
- b = f2, t = l2;
- sense = 0;
- }
- if (!big) { /* here i = 0 */
- while ((b += size) < t && cmp(q, b) >sense)
- if (++i == 6) {
- big = 1;
- goto EXPONENTIAL;
- }
- } else {
-EXPONENTIAL: for (i = size; ; i <<= 1)
- if ((p = (b + i)) >= t) {
- if ((p = t - size) > b &&
- (*cmp)(q, p) <= sense)
- t = p;
- else
- b = p;
- break;
- } else if ((*cmp)(q, p) <= sense) {
- t = p;
- if (i == size)
- big = 0;
- goto FASTCASE;
- } else
- b = p;
- while (t > b+size) {
- i = (((t - b) / size) >> 1) * size;
- if ((*cmp)(q, p = b + i) <= sense)
- t = p;
- else
- b = p;
- }
- goto COPY;
-FASTCASE: while (i > size)
- if ((*cmp)(q,
- p = b + (i >>= 1)) <= sense)
- t = p;
- else
- b = p;
-COPY: b = t;
- }
- i = size;
- if (q == f1) {
- if (iflag) {
- ICOPY_LIST(f2, tp2, b);
- ICOPY_ELT(f1, tp2, i);
- } else {
- CCOPY_LIST(f2, tp2, b);
- CCOPY_ELT(f1, tp2, i);
- }
- } else {
- if (iflag) {
- ICOPY_LIST(f1, tp2, b);
- ICOPY_ELT(f2, tp2, i);
- } else {
- CCOPY_LIST(f1, tp2, b);
- CCOPY_ELT(f2, tp2, i);
- }
- }
- }
- if (f2 < l2) {
- if (iflag)
- ICOPY_LIST(f2, tp2, l2);
- else
- CCOPY_LIST(f2, tp2, l2);
- } else if (f1 < l1) {
- if (iflag)
- ICOPY_LIST(f1, tp2, l1);
- else
- CCOPY_LIST(f1, tp2, l1);
- }
- *p1 = l2;
- }
- tp2 = list1; /* swap list1, list2 */
- list1 = list2;
- list2 = tp2;
- last = list2 + nmemb*size;
- }
- if (base == list2) {
- memmove(list2, list1, nmemb*size);
- list2 = list1;
- }
- free(list2);
- return (0);
-}
-/* }}} */
-
-#define swap(a, b) { \
- s = b; \
- i = size; \
- do { \
- tmp = *a; *a++ = *s; *s++ = tmp; \
- } while (--i); \
- a -= size; \
- }
-#define reverse(bot, top) { \
- s = top; \
- do { \
- i = size; \
- do { \
- tmp = *bot; *bot++ = *s; *s++ = tmp; \
- } while (--i); \
- s -= size2; \
- } while(bot < s); \
-}
-
-/* {{{ setup
- * Optional hybrid natural/pairwise first pass. Eats up list1 in runs of
- * increasing order, list2 in a corresponding linked list. Checks for runs
- * when THRESHOLD/2 pairs compare with same sense. (Only used when NATURAL
- * is defined. Otherwise simple pairwise merging is used.)
- */
-static void setup(u_char *list1, u_char *list2, size_t n, size_t size, int (*cmp)(const void *, const void *))
-{
- int i, length, size2, tmp, sense;
- u_char *f1, *f2, *s, *l2, *last, *p2;
-
- size2 = size*2;
- if (n <= 5) {
- insertionsort(list1, n, size, cmp);
- *EVAL(list2) = (u_char*) list2 + n*size;
- return;
- }
- /*
- * Avoid running pointers out of bounds; limit n to evens
- * for simplicity.
- */
- i = 4 + (n & 1);
- insertionsort(list1 + (n - i) * size, i, size, cmp);
- last = list1 + size * (n - i);
- *EVAL(list2 + (last - list1)) = list2 + n * size;
-
-#ifdef NATURAL
- p2 = list2;
- f1 = list1;
- sense = (cmp(f1, f1 + size) > 0);
- for (; f1 < last; sense = !sense) {
- length = 2;
- /* Find pairs with same sense. */
- for (f2 = f1 + size2; f2 < last; f2 += size2) {
- if ((cmp(f2, f2+ size) > 0) != sense)
- break;
- length += 2;
- }
- if (length < THRESHOLD) { /* Pairwise merge */
- do {
- p2 = *EVAL(p2) = f1 + size2 - list1 + list2;
- if (sense > 0)
- swap (f1, f1 + size);
- } while ((f1 += size2) < f2);
- } else { /* Natural merge */
- l2 = f2;
- for (f2 = f1 + size2; f2 < l2; f2 += size2) {
- if ((cmp(f2-size, f2) > 0) != sense) {
- p2 = *EVAL(p2) = f2 - list1 + list2;
- if (sense > 0)
- reverse(f1, f2-size);
- f1 = f2;
- }
- }
- if (sense > 0)
- reverse (f1, f2-size);
- f1 = f2;
- if (f2 < last || cmp(f2 - size, f2) > 0)
- p2 = *EVAL(p2) = f2 - list1 + list2;
- else
- p2 = *EVAL(p2) = list2 + n*size;
- }
- }
-#else /* pairwise merge only. */
- for (f1 = list1, p2 = list2; f1 < last; f1 += size2) {
- p2 = *EVAL(p2) = p2 + size2;
- if (cmp (f1, f1 + size) > 0)
- swap(f1, f1 + size);
- }
-#endif /* NATURAL */
-}
-/* }}} */
-
-/* {{{ insertionsort
- * This is to avoid out-of-bounds addresses in sorting the
- * last 4 elements.
- */
-static void insertionsort(u_char *a, size_t n, size_t size, int (*cmp)(const void *, const void *))
-{
- u_char *ai, *s, *t, *u, tmp;
- int i;
-
- for (ai = a+size; --n >= 1; ai += size)
- for (t = ai; t > a; t -= size) {
- u = t - size;
- if (cmp(u, t) <= 0)
- break;
- swap(u, t);
- }
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/main/network.c b/main/network.c
deleted file mode 100644
index b2fb94b3b5..0000000000
--- a/main/network.c
+++ /dev/null
@@ -1,347 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Stig Venaas <venaas@uninett.no> |
- +----------------------------------------------------------------------+
- */
-/* $Id$ */
-
-#include "php.h"
-
-#ifdef PHP_WIN32
-#include <windows.h>
-#include <winsock.h>
-#define O_RDONLY _O_RDONLY
-#include "win32/param.h"
-#else
-#include <sys/param.h>
-#endif
-
-#include <sys/types.h>
-#if HAVE_SYS_SOCKET_H
-#include <sys/socket.h>
-#endif
-
-#ifndef PHP_WIN32
-#include <netinet/in.h>
-#include <netdb.h>
-#if HAVE_ARPA_INET_H
-#include <arpa/inet.h>
-#endif
-#endif
-
-#ifndef HAVE_INET_ATON
-int inet_aton(const char *, struct in_addr *);
-#endif
-
-#include "php_network.h"
-
-#ifdef PHP_WIN32
-#undef AF_UNIX
-#endif
-
-#if defined(AF_UNIX)
-#include <sys/un.h>
-#endif
-
-#ifdef PHP_WIN32
-# define SOCK_ERR INVALID_SOCKET
-# define SOCK_CONN_ERR SOCKET_ERROR
-#else
-# define SOCK_ERR -1
-# define SOCK_CONN_ERR -1
-#endif
-
-#ifdef HAVE_GETADDRINFO
-#ifdef HAVE_GAI_STRERROR
-# define PHP_GAI_STRERROR(x) (gai_strerror(x))
-#else
-# define PHP_GAI_STRERROR(x) (php_gai_strerror(x))
-/* {{{ php_gai_strerror
- */
-static char *php_gai_strerror(int code)
-{
- static struct {
- int code;
- const char *msg;
- } values[] = {
-# ifdef EAI_ADDRFAMILY
- {EAI_ADDRFAMILY, "Address family for hostname not supported"},
-# endif
- {EAI_AGAIN, "Temporary failure in name resolution"},
- {EAI_BADFLAGS, "Bad value for ai_flags"},
- {EAI_FAIL, "Non-recoverable failure in name resolution"},
- {EAI_FAMILY, "ai_family not supported"},
- {EAI_MEMORY, "Memory allocation failure"},
-# ifdef EAI_NODATA
- {EAI_NODATA, "No address associated with hostname"},
-# endif
- {EAI_NONAME, "Name or service not known"},
- {EAI_SERVICE, "Servname not supported for ai_socktype"},
- {EAI_SOCKTYPE, "ai_socktype not supported"},
- {EAI_SYSTEM, "System error"},
- {0, NULL}
- };
- int i;
-
- for (i = 0; values[i].msg != NULL; i++) {
- if (values[i].code == code) {
- return (char *)values[i].msg;
- }
- }
-
- return "Unknown error";
-}
-/* }}} */
-#endif
-#endif
-
-/* {{{ php_network_freeaddresses
- */
-static void php_network_freeaddresses(struct sockaddr **sal)
-{
- struct sockaddr **sap;
-
- if (sal == NULL)
- return;
- for (sap = sal; *sap != NULL; sap++)
- efree(*sap);
- efree(sal);
-}
-/* }}} */
-
-/* {{{ php_network_getaddresses
- */
-static int php_network_getaddresses(const char *host, struct sockaddr ***sal)
-{
- struct sockaddr **sap;
-
- if (host == NULL) {
- return -1;
- }
-
- {
-#ifdef HAVE_GETADDRINFO
- struct addrinfo hints, *res, *sai;
- int n;
-
- memset(&hints, '\0', sizeof(hints));
- hints.ai_family = AF_UNSPEC;
- if ((n = getaddrinfo(host, NULL, &hints, &res))) {
- php_error(E_WARNING, "php_network_getaddresses: getaddrinfo failed: %s", PHP_GAI_STRERROR(n));
- return -1;
- }
-
- sai = res;
- for (n=2; (sai = sai->ai_next) != NULL; n++);
- *sal = emalloc(n * sizeof(*sal));
- sai = res;
- sap = *sal;
- do {
- switch (sai->ai_family) {
-# ifdef HAVE_IPV6
- case AF_INET6:
- *sap = emalloc(sizeof(struct sockaddr_in6));
- *(struct sockaddr_in6 *)*sap =
- *((struct sockaddr_in6 *)sai->ai_addr);
- sap++;
- break;
-# endif
- case AF_INET:
- *sap = emalloc(sizeof(struct sockaddr_in));
- *(struct sockaddr_in *)*sap =
- *((struct sockaddr_in *)sai->ai_addr);
- sap++;
- break;
- }
- } while ((sai = sai->ai_next) != NULL);
- freeaddrinfo(res);
-#else
- struct hostent *host_info;
- struct in_addr in;
-
- if (!inet_aton(host, &in)) {
- /* XXX NOT THREAD SAFE */
- host_info = gethostbyname(host);
- if (host_info == NULL) {
- php_error(E_WARNING, "php_network_getaddresses: gethostbyname failed");
- return -1;
- }
- in = *((struct in_addr *) host_info->h_addr);
- }
-
- *sal = emalloc(2 * sizeof(*sal));
- sap = *sal;
- *sap = emalloc(sizeof(struct sockaddr_in));
- (*sap)->sa_family = AF_INET;
- ((struct sockaddr_in *)*sap)->sin_addr = in;
- sap++;
-#endif
- }
- *sap = NULL;
- return 0;
-}
-/* }}} */
-
-/* {{{ php_connect_nonb */
-PHPAPI int php_connect_nonb(int sockfd,
- struct sockaddr *addr,
- socklen_t addrlen,
- struct timeval *timeout)
-{
- /* probably won't work on Win32, someone else might try it (read: fix it ;) */
-
-#if (!defined(__BEOS__) && !defined(PHP_WIN32)) && (defined(O_NONBLOCK) || defined(O_NDELAY))
-
-#ifndef O_NONBLOCK
-#define O_NONBLOCK O_NDELAY
-#endif
-
- int flags;
- int n;
- int error = 0;
- socklen_t len;
- int ret = 0;
- fd_set rset;
- fd_set wset;
-
- if (timeout == NULL) {
- /* blocking mode */
- return connect(sockfd, addr, addrlen);
- }
-
- flags = fcntl(sockfd, F_GETFL, 0);
- fcntl(sockfd, F_SETFL, flags | O_NONBLOCK);
-
- if ((n = connect(sockfd, addr, addrlen)) < 0) {
- if (errno != EINPROGRESS) {
- return -1;
- }
- }
-
- if (n == 0) {
- goto ok;
- }
-
- FD_ZERO(&rset);
- FD_SET(sockfd, &rset);
-
- wset = rset;
-
- if ((n = select(sockfd + 1, &rset, &wset, NULL, timeout)) == 0) {
- error = ETIMEDOUT;
- }
-
- if(FD_ISSET(sockfd, &rset) || FD_ISSET(sockfd, &wset)) {
- len = sizeof(error);
- /*
- BSD-derived systems set errno correctly
- Solaris returns -1 from getsockopt in case of error
- */
- if (getsockopt(sockfd, SOL_SOCKET, SO_ERROR, &error, &len) < 0) {
- ret = -1;
- }
- } else {
- /* whoops: sockfd has disappeared */
- ret = -1;
- }
-
-ok:
- fcntl(sockfd, F_SETFL, flags);
-
- if(error) {
- errno = error;
- ret = -1;
- }
- return ret;
-#else /* !defined(PHP_WIN32) && ... */
- return connect(sockfd, addr, addrlen);
-#endif
-}
-/* }}} */
-
-/* {{{ php_hostconnect
- * Creates a socket of type socktype and connects to the given host and
- * port, returns the created socket on success, else returns -1.
- * timeout gives timeout in seconds, 0 means blocking mode.
- */
-int php_hostconnect(char *host, unsigned short port, int socktype, int timeout)
-{
- int s;
- struct sockaddr **sal, **psal;
- struct timeval timeoutval;
-
- if (php_network_getaddresses(host, &sal))
- return -1;
-
- if (timeout) {
- timeoutval.tv_sec = timeout;
- timeoutval.tv_usec = 0;
- }
-
- psal = sal;
- while (*sal != NULL) {
- s = socket((*sal)->sa_family, socktype, 0);
- if (s != SOCK_ERR) {
- switch ((*sal)->sa_family) {
-#if defined( HAVE_GETADDRINFO ) && defined( HAVE_IPV6 )
- case AF_INET6:
- {
- struct sockaddr_in6 *sa =
- (struct sockaddr_in6 *)*sal;
-
- sa->sin6_family = (*sal)->sa_family;
- sa->sin6_port = htons(port);
- if (php_connect_nonb(s, (struct sockaddr *) sa,
- sizeof(*sa), timeout ? &timeoutval : NULL) != SOCK_CONN_ERR)
- goto ok;
- }
- break;
-#endif
- case AF_INET:
- {
- struct sockaddr_in *sa =
- (struct sockaddr_in *)*sal;
-
- sa->sin_family = (*sal)->sa_family;
- sa->sin_port = htons(port);
- if (php_connect_nonb(s, (struct sockaddr *) sa,
- sizeof(*sa), timeout ? &timeoutval : NULL) != SOCK_CONN_ERR)
- goto ok;
-
- }
- break;
- }
- close (s);
- }
- sal++;
- }
- php_network_freeaddresses(psal);
- php_error(E_WARNING, "php_hostconnect: connect failed");
- return -1;
-
- ok:
- php_network_freeaddresses(psal);
- return s;
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 8
- * c-basic-offset: 8
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/main/output.c b/main/output.c
deleted file mode 100644
index 26f95af2e4..0000000000
--- a/main/output.c
+++ /dev/null
@@ -1,638 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Zeev Suraski <zeev@zend.com> |
- | Thies C. Arntzen <thies@thieso.net> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#include "php.h"
-#include "ext/standard/head.h"
-#include "ext/session/php_session.h"
-#include "basic_functions.h"
-#include "SAPI.h"
-
-/* output functions */
-static int php_ub_body_write(const char *str, uint str_length);
-static int php_ub_body_write_no_header(const char *str, uint str_length);
-static int php_b_body_write(const char *str, uint str_length);
-
-static void php_ob_init(uint initial_size, uint block_size, zval *output_handler, uint chunk_size);
-static void php_ob_append(const char *text, uint text_length);
-#if 0
-static void php_ob_prepend(const char *text, uint text_length);
-#endif
-
-
-#ifdef ZTS
-int output_globals_id;
-#else
-php_output_globals output_globals;
-#endif
-
-static int php_default_output_func(const char *str, uint str_len)
-{
- fwrite(str, 1, str_len, stderr);
- return str_len;
-}
-
-
-static void php_output_init_globals(OLS_D)
-{
- OG(php_body_write) = php_default_output_func;
- OG(php_header_write) = php_default_output_func;
- OG(implicit_flush) = 0;
- OG(output_start_filename) = NULL;
- OG(output_start_lineno) = 0;
-}
-
-
-/* Start output layer */
-PHPAPI void php_output_startup()
-{
-#ifdef ZTS
- output_globals_id = ts_allocate_id(sizeof(php_output_globals), (ts_allocate_ctor) php_output_init_globals, NULL);
-#else
- php_output_init_globals(OLS_C);
-#endif
-
- {
- OLS_FETCH();
-
- OG(php_body_write) = php_ub_body_write;
- OG(php_header_write) = sapi_module.ub_write;
- OG(nesting_level) = 0;
- OG(lock) = 0;
- }
-}
-
-
-void php_output_register_constants()
-{
- ELS_FETCH();
-
- REGISTER_MAIN_LONG_CONSTANT("PHP_OUTPUT_HANDLER_START", PHP_OUTPUT_HANDLER_START, CONST_CS | CONST_PERSISTENT);
- REGISTER_MAIN_LONG_CONSTANT("PHP_OUTPUT_HANDLER_CONT", PHP_OUTPUT_HANDLER_CONT, CONST_CS | CONST_PERSISTENT);
- REGISTER_MAIN_LONG_CONSTANT("PHP_OUTPUT_HANDLER_END", PHP_OUTPUT_HANDLER_END, CONST_CS | CONST_PERSISTENT);
-}
-
-
-PHPAPI int php_body_write(const char *str, uint str_length)
-{
- OLS_FETCH();
- return OG(php_body_write)(str, str_length);
-}
-
-PHPAPI int php_header_write(const char *str, uint str_length)
-{
- OLS_FETCH();
- return OG(php_header_write)(str, str_length);
-}
-
-/* {{{ php_start_ob_buffer
- * Start output buffering */
-PHPAPI int php_start_ob_buffer(zval *output_handler, uint chunk_size)
-{
- OLS_FETCH();
-
- if (OG(lock)) {
- return FAILURE;
- }
- if (chunk_size) {
- php_ob_init((chunk_size*3/2), chunk_size/2, output_handler, chunk_size);
- } else {
- php_ob_init(40*1024, 10*1024, output_handler, chunk_size);
- }
- OG(php_body_write) = php_b_body_write;
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ php_end_ob_buffer
- * End output buffering (one level) */
-PHPAPI void php_end_ob_buffer(zend_bool send_buffer, zend_bool just_flush)
-{
- char *final_buffer=NULL;
- int final_buffer_length=0;
- zval *alternate_buffer=NULL;
- char *to_be_destroyed_buffer;
- char *to_be_destroyed_handled_output[2] = { 0, 0 };
- int status;
- SLS_FETCH();
- OLS_FETCH();
-
- if (OG(nesting_level)==0) {
- return;
- }
- status = 0;
- if (!OG(active_ob_buffer).status & PHP_OUTPUT_HANDLER_START) {
- /* our first call */
- status |= PHP_OUTPUT_HANDLER_START;
- }
- if (just_flush) {
- status |= PHP_OUTPUT_HANDLER_CONT;
- } else {
- status |= PHP_OUTPUT_HANDLER_END;
- }
-
- if (OG(active_ob_buffer).internal_output_handler) {
- final_buffer = OG(active_ob_buffer).internal_output_handler_buffer;
- final_buffer_length = OG(active_ob_buffer).internal_output_handler_buffer_size;
- OG(active_ob_buffer).internal_output_handler(OG(active_ob_buffer).buffer, OG(active_ob_buffer).text_length, &final_buffer, &final_buffer_length, status);
- } else if (OG(active_ob_buffer).output_handler) {
- zval **params[2];
- zval *orig_buffer;
- zval *z_status;
- CLS_FETCH();
-
- ALLOC_INIT_ZVAL(orig_buffer);
- orig_buffer->value.str.val = OG(active_ob_buffer).buffer;
- orig_buffer->value.str.len = OG(active_ob_buffer).text_length;
- orig_buffer->type = IS_STRING;
- orig_buffer->refcount=2; /* don't let call_user_function() destroy our buffer */
- orig_buffer->is_ref=1;
-
- ALLOC_INIT_ZVAL(z_status);
- Z_TYPE_P(z_status) = IS_LONG;
- Z_LVAL_P(z_status) = status;
-
- params[0] = &orig_buffer;
- params[1] = &z_status;
- OG(lock) = 1;
- if (call_user_function_ex(CG(function_table), NULL, OG(active_ob_buffer).output_handler, &alternate_buffer, 2, params, 1, NULL)==SUCCESS) {
- convert_to_string_ex(&alternate_buffer);
- final_buffer = alternate_buffer->value.str.val;
- final_buffer_length = alternate_buffer->value.str.len;
- }
- OG(lock) = 0;
- zval_ptr_dtor(&OG(active_ob_buffer).output_handler);
- if (orig_buffer->refcount==2) { /* free the zval */
- FREE_ZVAL(orig_buffer);
- } else {
- orig_buffer->refcount-=2;
- }
- zval_ptr_dtor(&z_status);
- }
-
- if (!final_buffer) {
- final_buffer = OG(active_ob_buffer).buffer;
- final_buffer_length = OG(active_ob_buffer).text_length;
- }
-
- if (OG(nesting_level)==1) { /* end buffering */
- if (SG(headers_sent) && !SG(request_info).headers_only) {
- OG(php_body_write) = php_ub_body_write_no_header;
- } else {
- OG(php_body_write) = php_ub_body_write;
- }
- }
-
- to_be_destroyed_buffer = OG(active_ob_buffer).buffer;
- if (OG(active_ob_buffer).internal_output_handler
- && (final_buffer != OG(active_ob_buffer).internal_output_handler_buffer)) {
- to_be_destroyed_handled_output[0] = final_buffer;
- }
-
- if (!just_flush) {
- if (OG(active_ob_buffer).internal_output_handler) {
- to_be_destroyed_handled_output[1] = OG(active_ob_buffer).internal_output_handler_buffer;
- }
- if (OG(nesting_level)>1) { /* restore previous buffer */
- php_ob_buffer *ob_buffer_p;
-
- zend_stack_top(&OG(ob_buffers), (void **) &ob_buffer_p);
- OG(active_ob_buffer) = *ob_buffer_p;
- zend_stack_del_top(&OG(ob_buffers));
- if (OG(nesting_level)==2) { /* destroy the stack */
- zend_stack_destroy(&OG(ob_buffers));
- }
- }
- OG(nesting_level)--;
- }
-
- if (send_buffer) {
- OG(php_body_write)(final_buffer, final_buffer_length);
- }
-
- if (alternate_buffer) {
- zval_ptr_dtor(&alternate_buffer);
- }
-
- if (!just_flush) {
- efree(to_be_destroyed_buffer);
- } else {
- OG(active_ob_buffer).text_length = 0;
- OG(active_ob_buffer).status |= PHP_OUTPUT_HANDLER_START;
- OG(php_body_write) = php_b_body_write;
- }
- if (to_be_destroyed_handled_output[0]) {
- efree(to_be_destroyed_handled_output[0]);
- }
- if (to_be_destroyed_handled_output[1]) {
- efree(to_be_destroyed_handled_output[1]);
- }
-}
-/* }}} */
-
-/* {{{ php_end_ob_buffers
- * End output buffering (all buffers) */
-PHPAPI void php_end_ob_buffers(zend_bool send_buffer)
-{
- OLS_FETCH();
-
- while (OG(nesting_level)!=0) {
- php_end_ob_buffer(send_buffer, 0);
- }
-}
-/* }}} */
-
-/* {{{ php_start_implicit_flush
- */
-PHPAPI void php_start_implicit_flush()
-{
- OLS_FETCH();
-
- php_end_ob_buffer(1, 0); /* Switch out of output buffering if we're in it */
- OG(implicit_flush)=1;
-}
-/* }}} */
-
-/* {{{ php_end_implicit_flush
- */
-PHPAPI void php_end_implicit_flush()
-{
- OLS_FETCH();
-
- OG(implicit_flush)=0;
-}
-/* }}} */
-
-/* {{{ php_ob_set_internal_handler
- */
-PHPAPI void php_ob_set_internal_handler(php_output_handler_func_t internal_output_handler, uint buffer_size)
-{
- OLS_FETCH();
-
- if (OG(nesting_level)==0) {
- return;
- }
-
- OG(active_ob_buffer).internal_output_handler = internal_output_handler;
- OG(active_ob_buffer).internal_output_handler_buffer = (char *) emalloc(buffer_size);
- OG(active_ob_buffer).internal_output_handler_buffer_size = buffer_size;
-}
-/* }}} */
-
-/*
- * Output buffering - implementation
- */
-
-/* {{{ php_ob_allocate
- */
-static inline void php_ob_allocate(void)
-{
- OLS_FETCH();
-
- if (OG(active_ob_buffer).size<OG(active_ob_buffer).text_length) {
- while (OG(active_ob_buffer).size <= OG(active_ob_buffer).text_length) {
- OG(active_ob_buffer).size+=OG(active_ob_buffer).block_size;
- }
-
- OG(active_ob_buffer).buffer = (char *) erealloc(OG(active_ob_buffer).buffer, OG(active_ob_buffer).size+1);
- }
-}
-/* }}} */
-
-/* {{{ php_ob_init
- */
-static void php_ob_init(uint initial_size, uint block_size, zval *output_handler, uint chunk_size)
-{
- OLS_FETCH();
-
- if (OG(nesting_level)>0) {
- if (OG(nesting_level)==1) { /* initialize stack */
- zend_stack_init(&OG(ob_buffers));
- }
- zend_stack_push(&OG(ob_buffers), &OG(active_ob_buffer), sizeof(php_ob_buffer));
- }
- OG(nesting_level)++;
- OG(active_ob_buffer).block_size = block_size;
- OG(active_ob_buffer).size = initial_size;
- OG(active_ob_buffer).buffer = (char *) emalloc(initial_size+1);
- OG(active_ob_buffer).text_length = 0;
- OG(active_ob_buffer).output_handler = output_handler;
- OG(active_ob_buffer).chunk_size = chunk_size;
- OG(active_ob_buffer).status = 0;
- OG(active_ob_buffer).internal_output_handler = NULL;
-}
-/* }}} */
-
-/* {{{ php_ob_append
- */
-static void php_ob_append(const char *text, uint text_length)
-{
- char *target;
- int original_ob_text_length;
- OLS_FETCH();
-
- original_ob_text_length=OG(active_ob_buffer).text_length;
- OG(active_ob_buffer).text_length = OG(active_ob_buffer).text_length + text_length;
-
- php_ob_allocate();
- target = OG(active_ob_buffer).buffer+original_ob_text_length;
- memcpy(target, text, text_length);
- target[text_length]=0;
-
- if (OG(active_ob_buffer).chunk_size
- && OG(active_ob_buffer).text_length >= OG(active_ob_buffer).chunk_size) {
- zval *output_handler = OG(active_ob_buffer).output_handler;
-
- if (output_handler) {
- output_handler->refcount++;
- }
- php_end_ob_buffer(1, 1);
- return;
- }
-}
-/* }}} */
-
-#if 0
-static void php_ob_prepend(const char *text, uint text_length)
-{
- char *p, *start;
- OLS_FETCH();
-
- OG(active_ob_buffer).text_length += text_length;
- php_ob_allocate();
-
- /* php_ob_allocate() may change OG(ob_buffer), so we can't initialize p&start earlier */
- p = OG(ob_buffer)+OG(ob_text_length);
- start = OG(ob_buffer);
-
- while (--p>=start) {
- p[text_length] = *p;
- }
- memcpy(OG(ob_buffer), text, text_length);
- OG(ob_buffer)[OG(active_ob_buffer).text_length]=0;
-}
-#endif
-
-
-/* {{{ php_ob_get_buffer
- * Return the current output buffer */
-int php_ob_get_buffer(pval *p)
-{
- OLS_FETCH();
-
- if (OG(nesting_level)==0) {
- return FAILURE;
- }
- p->type = IS_STRING;
- p->value.str.val = estrndup(OG(active_ob_buffer).buffer, OG(active_ob_buffer).text_length);
- p->value.str.len = OG(active_ob_buffer).text_length;
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ php_ob_get_length
- * Return the size of the current output buffer */
-int php_ob_get_length(pval *p)
-{
- OLS_FETCH();
-
- if (OG(nesting_level) == 0) {
- return FAILURE;
- }
- p->type = IS_LONG;
- p->value.lval = OG(active_ob_buffer).text_length;
- return SUCCESS;
-}
-/* }}} */
-
-/*
- * Wrapper functions - implementation
- */
-
-
-/* buffered output function */
-static int php_b_body_write(const char *str, uint str_length)
-{
- php_ob_append(str, str_length);
- return str_length;
-}
-
-/* {{{ php_ub_body_write_no_header
- */
-static int php_ub_body_write_no_header(const char *str, uint str_length)
-{
- char *newstr = NULL;
- size_t new_length=0;
- int result;
- OLS_FETCH();
- BLS_FETCH();
-
- if (BG(use_trans_sid)) {
- session_adapt_uris(str, str_length, &newstr, &new_length);
- }
-
- if (newstr) {
- str = newstr;
- str_length = new_length;
- }
-
- result = OG(php_header_write)(str, str_length);
-
- if (OG(implicit_flush)) {
- sapi_flush();
- }
-
- return result;
-}
-/* }}} */
-
-/* {{{ php_ub_body_write
- */
-static int php_ub_body_write(const char *str, uint str_length)
-{
- int result = 0;
- SLS_FETCH();
- OLS_FETCH();
-
- if (SG(request_info).headers_only) {
- php_header();
- zend_bailout();
- }
- if (php_header()) {
- if (zend_is_compiling()) {
- CLS_FETCH();
-
- OG(output_start_filename) = zend_get_compiled_filename(CLS_C);
- OG(output_start_lineno) = zend_get_compiled_lineno(CLS_C);
- } else if (zend_is_executing()) {
- ELS_FETCH();
-
- OG(output_start_filename) = zend_get_executed_filename(ELS_C);
- OG(output_start_lineno) = zend_get_executed_lineno(ELS_C);
- }
-
- OG(php_body_write) = php_ub_body_write_no_header;
- result = php_ub_body_write_no_header(str, str_length);
- }
-
- return result;
-}
-/* }}} */
-
-/*
- * HEAD support
- */
-
-/* {{{ proto void ob_start([ string user_function [, int chunk_size]])
- Turn on Output Buffering (specifying an optional output handler). */
-PHP_FUNCTION(ob_start)
-{
- zval *output_handler;
- uint chunk_size=0;
-
- switch (ZEND_NUM_ARGS()) {
- case 0:
- output_handler = NULL;
- break;
- case 1: {
- zval **output_handler_p;
-
- if (zend_get_parameters_ex(1, &output_handler_p)==FAILURE) {
- RETURN_FALSE;
- }
- SEPARATE_ZVAL(output_handler_p);
- output_handler = *output_handler_p;
- output_handler->refcount++;
- }
- break;
- case 2: {
- zval **output_handler_p, **chunk_size_p;
-
- if (zend_get_parameters_ex(2, &output_handler_p, &chunk_size_p)==FAILURE) {
- RETURN_FALSE;
- }
- SEPARATE_ZVAL(output_handler_p);
- output_handler = *output_handler_p;
- output_handler->refcount++;
- convert_to_long_ex(chunk_size_p);
- chunk_size = (uint) Z_LVAL_PP(chunk_size_p);
- }
- break;
- default:
- ZEND_WRONG_PARAM_COUNT();
- break;
- }
- if (php_start_ob_buffer(output_handler, chunk_size)==FAILURE) {
- php_error(E_WARNING, "Cannot use output buffering in output buffering display handlers");
- RETURN_FALSE;
- }
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void ob_end_flush(void)
- Flush (send) the output buffer, and turn off output buffering */
-PHP_FUNCTION(ob_end_flush)
-{
- php_end_ob_buffer(1, 0);
-}
-/* }}} */
-
-/* {{{ proto void ob_end_clean(void)
- Clean (erase) the output buffer, and turn off output buffering */
-PHP_FUNCTION(ob_end_clean)
-{
- php_end_ob_buffer(0, 0);
-}
-/* }}} */
-
-/* {{{ proto string ob_get_contents(void)
- Return the contents of the output buffer */
-PHP_FUNCTION(ob_get_contents)
-{
- if (php_ob_get_buffer(return_value)==FAILURE) {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto string ob_get_length(void)
- Return the length of the output buffer */
-PHP_FUNCTION(ob_get_length)
-{
- if (php_ob_get_length(return_value)==FAILURE) {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto void ob_implicit_flush([int flag])
- Turn implicit flush on/off and is equivalent to calling flush() after every output call */
-PHP_FUNCTION(ob_implicit_flush)
-{
- zval **zv_flag;
- int flag;
-
- switch(ZEND_NUM_ARGS()) {
- case 0:
- flag = 1;
- break;
- case 1:
- if (zend_get_parameters_ex(1, &zv_flag)==FAILURE) {
- RETURN_FALSE;
- }
- convert_to_long_ex(zv_flag);
- flag = (*zv_flag)->value.lval;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- if (flag) {
- php_start_implicit_flush();
- } else {
- php_end_implicit_flush();
- }
-}
-/* }}} */
-
-PHPAPI char *php_get_output_start_filename()
-{
- OLS_FETCH();
-
- return OG(output_start_filename);
-}
-
-
-PHPAPI int php_get_output_start_lineno()
-{
- OLS_FETCH();
-
- return OG(output_start_lineno);
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/main/php.h b/main/php.h
deleted file mode 100644
index f99d2c3007..0000000000
--- a/main/php.h
+++ /dev/null
@@ -1,348 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifndef PHP_H
-#define PHP_H
-
-#ifdef HAVE_DMALLOC
-#include <dmalloc.h>
-#endif
-
-#define PHP_API_VERSION 20010119
-
-#define YYDEBUG 0
-
-#include "php_version.h"
-#include "zend.h"
-#include "php_compat.h"
-
-#include "zend_API.h"
-
-#if PHP_BROKEN_SPRINTF
-#undef sprintf
-#define sprintf php_sprintf
-#endif
-
-#ifdef PHP_WIN32
-#include "tsrm_win32.h"
-#include "win95nt.h"
-# ifdef PHP_EXPORTS
-# define PHPAPI __declspec(dllexport)
-# else
-# define PHPAPI __declspec(dllimport)
-# endif
-#define PHP_DIR_SEPARATOR '\\'
-#else
-#define PHPAPI
-#define THREAD_LS
-#define PHP_DIR_SEPARATOR '/'
-#endif
-
-#include "php_regex.h"
-
-/* PHP's DEBUG value must match Zend's ZEND_DEBUG value */
-#undef PHP_DEBUG
-#define PHP_DEBUG ZEND_DEBUG
-
-
-#define APACHE 0
-#define CGI_BINARY 0
-
-#if HAVE_UNIX_H
-#include <unix.h>
-#endif
-
-#if HAVE_ALLOCA_H
-#include <alloca.h>
-#endif
-
-/*
- * This is a fast version of strlcpy which should be used, if you
- * know the size of the destination buffer and if you know
- * the length of the source string.
- *
- * size is the allocated number of bytes of dst
- * src_size is the number of bytes excluding the NUL of src
- */
-
-#define PHP_STRLCPY(dst, src, size, src_size) \
- { \
- size_t php_str_len; \
- \
- if (src_size >= size) \
- php_str_len = size - 1; \
- else \
- php_str_len = src_size; \
- memcpy(dst, src, php_str_len); \
- dst[php_str_len] = '\0'; \
- }
-
-#ifndef HAVE_STRLCPY
-PHPAPI size_t php_strlcpy(char *dst, const char *src, size_t siz);
-#define strlcpy php_strlcpy
-#endif
-
-#ifndef HAVE_STRLCAT
-PHPAPI size_t php_strlcat(char *dst, const char *src, size_t siz);
-#define strlcat php_strlcat
-#endif
-
-#ifndef HAVE_STRTOK_R
-char *strtok_r(char *s, const char *delim, char **last);
-#endif
-
-#ifndef HAVE_SOCKLEN_T
-typedef unsigned int socklen_t;
-#endif
-
-#define CREATE_MUTEX(a,b)
-#define SET_MUTEX(a)
-#define FREE_MUTEX(a)
-
-/*
- * Then the ODBC support can use both iodbc and Solid,
- * uncomment this.
- * #define HAVE_ODBC (HAVE_IODBC|HAVE_SOLID)
- */
-
-#include <stdlib.h>
-#include <ctype.h>
-#if HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#if HAVE_STDARG_H
-#include <stdarg.h>
-#else
-# if HAVE_SYS_VARARGS_H
-# include <sys/varargs.h>
-# endif
-#endif
-
-
-#include "zend_hash.h"
-#include "php3_compat.h"
-#include "zend_alloc.h"
-#include "zend_stack.h"
-
-#if STDC_HEADERS
-# include <string.h>
-#else
-# ifndef HAVE_MEMCPY
-# define memcpy(d, s, n) bcopy((s), (d), (n))
-# endif
-# ifndef HAVE_MEMMOVE
-# define memmove(d, s, n) bcopy ((s), (d), (n))
-# endif
-#endif
-
-#include "safe_mode.h"
-
-#ifndef HAVE_STRERROR
-char *strerror(int);
-#endif
-
-#include "php_streams.h"
-#include "fopen_wrappers.h"
-
-#if (REGEX == 1 || REGEX == 0) && !defined(NO_REGEX_EXTRA_H)
-#include "regex/regex_extra.h"
-#endif
-
-#if HAVE_PWD_H
-# ifdef PHP_WIN32
-#include "win32/pwd.h"
-#include "win32/param.h"
-# else
-#include <pwd.h>
-#include <sys/param.h>
-# endif
-#endif
-
-#if HAVE_LIMITS_H
-#include <limits.h>
-#endif
-
-#ifndef LONG_MAX
-#define LONG_MAX 2147483647L
-#endif
-
-#ifndef LONG_MIN
-#define LONG_MIN (- LONG_MAX - 1)
-#endif
-
-#if !defined(HAVE_SNPRINTF) || !defined(HAVE_VSNPRINTF) || defined(BROKEN_SPRINTF) || defined(BROKEN_SNPRINTF) || defined(BROKEN_VSNPRINTF)
-#include "snprintf.h"
-#endif
-
-#define EXEC_INPUT_BUF 4096
-
-#define PHP_MIME_TYPE "application/x-httpd-php"
-
-/* macros */
-#define STR_PRINT(str) ((str)?(str):"")
-
-#ifndef MAXPATHLEN
-# ifdef PATH_MAX
-# define MAXPATHLEN PATH_MAX
-# else
-# define MAXPATHLEN 256 /* Should be safe for any weird systems that do not define it */
-# endif
-#endif
-
-#define PHP_FN(name) php_if_##name
-#define PHP_NAMED_FUNCTION(name) void name(INTERNAL_FUNCTION_PARAMETERS)
-#define PHP_FUNCTION(name) PHP_NAMED_FUNCTION(PHP_FN(name))
-
-#define PHP_NAMED_FE(php_name, name, arg_types) { #php_name, name, arg_types },
-#define PHP_FE(name, arg_types) PHP_NAMED_FE(name, PHP_FN(name), arg_types)
-#define PHP_FALIAS(name, alias, arg_types) PHP_NAMED_FE(name, PHP_FN(alias), arg_types)
-#define PHP_STATIC_FE(php_name, func_name, arg_types) { php_name, func_name, arg_types },
-
-#define PHP_MINIT(module) php_minit_##module
-#define PHP_MSHUTDOWN(module) php_mshutdown_##module
-#define PHP_RINIT(module) php_rinit_##module
-#define PHP_RSHUTDOWN(module) php_rshutdown_##module
-#define PHP_MINFO(module) php_info_##module
-#define PHP_GINIT(module) php_ginit_##module
-#define PHP_GSHUTDOWN(module) php_gshutdown_##module
-
-#define PHP_MINIT_FUNCTION(module) int PHP_MINIT(module)(INIT_FUNC_ARGS)
-#define PHP_MSHUTDOWN_FUNCTION(module) int PHP_MSHUTDOWN(module)(SHUTDOWN_FUNC_ARGS)
-#define PHP_RINIT_FUNCTION(module) int PHP_RINIT(module)(INIT_FUNC_ARGS)
-#define PHP_RSHUTDOWN_FUNCTION(module) int PHP_RSHUTDOWN(module)(SHUTDOWN_FUNC_ARGS)
-#define PHP_MINFO_FUNCTION(module) void PHP_MINFO(module)(ZEND_MODULE_INFO_FUNC_ARGS)
-#define PHP_GINIT_FUNCTION(module) int PHP_GINIT(module)(GINIT_FUNC_ARGS)
-#define PHP_GSHUTDOWN_FUNCTION(module) int PHP_GSHUTDOWN(module)(void)
-
-
-/* global variables */
-extern pval *data;
-#if !defined(PHP_WIN32)
-extern char **environ;
-#define php_sleep sleep
-#endif
-
-#ifdef PHP_PWRITE_64
-ssize_t pwrite(int, void *, size_t, off64_t);
-#endif
-
-#ifdef PHP_PREAD_64
-ssize_t pread(int, void *, size_t, off64_t);
-#endif
-
-void phperror(char *error);
-PHPAPI int php_write(void *buf, uint size);
-PHPAPI int php_printf(const char *format, ...);
-PHPAPI void php_log_err(char *log_message);
-int Debug(char *format, ...);
-int cfgparse(void);
-
-#define php_error zend_error
-
-#define zenderror phperror
-#define zendlex phplex
-
-#define phpparse zendparse
-#define phprestart zendrestart
-#define phpin zendin
-
-/* functions */
-int php_startup_internal_extensions(void);
-int php_global_startup_internal_extensions(void);
-int php_global_shutdown_internal_extensions(void);
-
-int php_mergesort(void *base, size_t nmemb, register size_t size, int (*cmp) (const void *, const void *));
-
-PHPAPI void php_register_pre_request_shutdown(void (*func)(void *), void *userdata);
-
-PHPAPI int cfg_get_long(char *varname, long *result);
-PHPAPI int cfg_get_double(char *varname, double *result);
-PHPAPI int cfg_get_string(char *varname, char **result);
-
-
-/* Output support */
-#include "ext/standard/php_output.h"
-#define PHPWRITE(str, str_len) php_body_write((str), (str_len))
-#define PUTS(str) php_body_write((str), strlen((str)))
-#define PUTC(c) (php_body_write(&(c), 1), (c))
-#define PHPWRITE_H(str, str_len) php_header_write((str), (str_len))
-#define PUTS_H(str) php_header_write((str), strlen((str)))
-#define PUTC_H(c) (php_header_write(&(c), 1), (c))
-
-#ifdef ZTS
-#define VIRTUAL_DIR
-#endif
-
-/* Virtual current working directory support */
-#include "tsrm_virtual_cwd.h"
-
-#include "zend_constants.h"
-
-/* connection status states */
-#define PHP_CONNECTION_NORMAL 0
-#define PHP_CONNECTION_ABORTED 1
-#define PHP_CONNECTION_TIMEOUT 2
-
-#include "php_reentrancy.h"
-
-/* Finding offsets of elements within structures.
- * Taken from the Apache code, which in turn, was taken from X code...
- */
-
-#if defined(CRAY) || (defined(__arm) && !defined(LINUX))
-#ifdef __STDC__
-#define XtOffset(p_type,field) _Offsetof(p_type,field)
-#else
-#ifdef CRAY2
-#define XtOffset(p_type,field) \
- (sizeof(int)*((unsigned int)&(((p_type)NULL)->field)))
-
-#else /* !CRAY2 */
-
-#define XtOffset(p_type,field) ((unsigned int)&(((p_type)NULL)->field))
-
-#endif /* !CRAY2 */
-#endif /* __STDC__ */
-#else /* ! (CRAY || __arm) */
-
-#define XtOffset(p_type,field) \
- ((long) (((char *) (&(((p_type)NULL)->field))) - ((char *) NULL)))
-
-#endif /* !CRAY */
-
-#ifdef offsetof
-#define XtOffsetOf(s_type,field) offsetof(s_type,field)
-#else
-#define XtOffsetOf(s_type,field) XtOffset(s_type*,field)
-#endif
-
-PHPAPI PHP_FUNCTION(warn_not_available);
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/main/php3_compat.h b/main/php3_compat.h
deleted file mode 100644
index 4093a79a90..0000000000
--- a/main/php3_compat.h
+++ /dev/null
@@ -1,102 +0,0 @@
-#ifndef PHP3_COMPAT_H
-#define PHP3_COMPAT_H
-
-typedef zval pval;
-
-#define pval_copy_constructor zval_copy_ctor
-#define pval_destructor zval_dtor
-
-#define _php3_hash_init zend_hash_init
-#define _php3_hash_destroy zend_hash_destroy
-
-#define _php3_hash_clean zend_hash_clean
-
-#define _php3_hash_add_or_update zend_hash_add_or_update
-#define _php3_hash_add zend_hash_add
-#define _php3_hash_update zend_hash_update
-
-#define _php3_hash_quick_add_or_update zend_hash_quick_add_or_update
-#define _php3_hash_quick_add zend_hash_quick_add
-#define _php3_hash_quick_update zend_hash_quick_update
-
-#define _php3_hash_index_update_or_next_insert zend_hash_index_update_or_next_insert
-#define _php3_hash_index_update zend_hash_index_update
-#define _php3_hash_next_index_insert zend_hash_next_index_insert
-
-#define _php3_hash_pointer_update zend_hash_pointer_update
-
-#define _php3_hash_pointer_index_update_or_next_insert zend_hash_pointer_index_update_or_next_insert
-#define _php3_hash_pointer_index_update zend_hash_pointer_index_update
-#define _php3_hash_next_index_pointer_update zend_hash_next_index_pointer_update
-#define _php3_hash_next_index_pointer_insert zend_hash_next_index_pointer_insert
-
-#define _php3_hash_del_key_or_index zend_hash_del_key_or_index
-#define _php3_hash_del zend_hash_del
-#define _php3_hash_index_del zend_hash_index_del
-
-#define _php3_hash_find zend_hash_find
-#define _php3_hash_quick_find zend_hash_quick_find
-#define _php3_hash_index_find zend_hash_index_find
-
-#define _php3_hash_exists zend_hash_exists
-#define _php3_hash_index_exists zend_hash_index_exists
-#define _php3_hash_is_pointer zend_hash_is_pointer
-#define _php3_hash_index_is_pointer zend_hash_index_is_pointer
-#define _php3_hash_next_free_element zend_hash_next_free_element
-
-#define _php3_hash_move_forward zend_hash_move_forward
-#define _php3_hash_move_backwards zend_hash_move_backwards
-#define _php3_hash_get_current_key zend_hash_get_current_key
-#define _php3_hash_get_current_data zend_hash_get_current_data
-#define _php3_hash_internal_pointer_reset zend_hash_internal_pointer_reset
-#define _php3_hash_internal_pointer_end zend_hash_internal_pointer_end
-
-#define _php3_hash_copy zend_hash_copy
-#define _php3_hash_merge zend_hash_merge
-#define _php3_hash_sort zend_hash_sort
-#define _php3_hash_minmax zend_hash_minmax
-
-#define _php3_hash_num_elements zend_hash_num_elements
-
-#define _php3_hash_apply zend_hash_apply
-#define _php3_hash_apply_with_argument zend_hash_apply_with_argument
-
-
-#define php3_error php_error
-
-#define php3_printf php_printf
-#define _php3_sprintf php_sprintf
-
-
-
-#define php3_module_entry zend_module_entry
-
-#define php3_strndup zend_strndup
-#define php3_str_tolower zend_str_tolower
-#define php3_binary_strcmp zend_binary_strcmp
-
-
-#define php3_list_insert zend_list_insert
-#define php3_list_find zend_list_find
-#define php3_list_delete zend_list_delete
-
-#define php3_plist_insert zend_plist_insert
-#define php3_plist_find zend_plist_find
-#define php3_plist_delete zend_plist_delete
-
-#define zend_print_pval zend_print_zval
-#define zend_print_pval_r zend_print_zval_r
-
-
-#define function_entry zend_function_entry
-
-#define _php3_addslashes php_addslashes
-#define _php3_stripslashes php_stripslashes
-#define php3_dl php_dl
-
-#define getParameters zend_get_parameters
-#define getParametersArray zend_get_parameters_array
-
-#define list_entry zend_rsrc_list_entry
-
-#endif /* PHP3_COMPAT_H */
diff --git a/main/php_compat.h b/main/php_compat.h
deleted file mode 100644
index 5152f1a85c..0000000000
--- a/main/php_compat.h
+++ /dev/null
@@ -1,96 +0,0 @@
-#ifndef PHP_COMPAT_H
-#define PHP_COMPAT_H
-
-#ifdef PHP_WIN32
-#include "config.w32.h"
-#else
-#include "php_config.h"
-#endif
-
-#if defined(HAVE_BUNDLED_PCRE) || !defined(PHP_VERSION)
-#define pcre_compile php_pcre_compile
-#define pcre_copy_substring php_pcre_copy_substring
-#define pcre_exec php_pcre_exec
-#define pcre_get_substring php_pcre_substring
-#define pcre_get_substring_list php_pcre_get_substring_list
-#define pcre_info php_pcre_info
-#define pcre_maketables php_pcre_maketables
-#define pcre_study php_pcre_study
-#define pcre_version php_pcre_version
-#endif
-
-#define lookup php_lookup
-#define hashTableInit php_hashTableInit
-#define hashTableDestroy php_hashTableDestroy
-#define hashTableIterInit php_hashTableIterInit
-#define hashTableIterNext php_hashTableIterNext
-
-#ifdef HAVE_LIBEXPAT_BUNDLED
-#define XML_DefaultCurrent php_XML_DefaultCurrent
-#define XML_ErrorString php_XML_ErrorString
-#define XML_ExpatVersion php_XML_ExpatVersion
-#define XML_ExternalEntityParserCreate php_XML_ExternalEntityParserCreate
-#define XML_GetBase php_XML_GetBase
-#define XML_GetBuffer php_XML_GetBuffer
-#define XML_GetCurrentByteCount php_XML_GetCurrentByteCount
-#define XML_GetCurrentByteIndex php_XML_GetCurrentByteIndex
-#define XML_GetCurrentColumnNumber php_XML_GetCurrentColumnNumber
-#define XML_GetCurrentLineNumber php_XML_GetCurrentLineNumber
-#define XML_GetErrorCode php_XML_GetErrorCode
-#define XML_GetIdAttributeIndex php_XML_GetIdAttributeIndex
-#define XML_GetInputContext php_XML_GetInputContext
-#define XML_GetSpecifiedAttributeCount php_XML_GetSpecifiedAttributeCount
-#define XmlGetUtf16InternalEncodingNS php_XmlGetUtf16InternalEncodingNS
-#define XmlGetUtf16InternalEncoding php_XmlGetUtf16InternalEncoding
-#define XmlGetUtf8InternalEncodingNS php_XmlGetUtf8InternalEncodingNS
-#define XmlGetUtf8InternalEncoding php_XmlGetUtf8InternalEncoding
-#define XmlInitEncoding php_XmlInitEncoding
-#define XmlInitUnknownEncoding php_XmlInitUnknownEncoding
-#define XML_ParseBuffer php_XML_ParseBuffer
-#define XML_Parse php_XML_Parse
-#define XML_ParserCreate_MM php_XML_ParserCreate_MM
-#define XML_ParserCreateNS php_XML_ParserCreateNS
-#define XML_ParserCreate php_XML_ParserCreate
-#define XML_ParserFree php_XML_ParserFree
-#define XmlParseXmlDecl php_XmlParseXmlDecl
-#define XmlPrologStateInitExternalEntity php_XmlPrologStateInitExternalEntity
-#define XmlPrologStateInit php_XmlPrologStateInit
-#define XML_SetAttlistDeclHandler php_XML_SetAttlistDeclHandler
-#define XML_SetBase php_XML_SetBase
-#define XML_SetCdataSectionHandler php_XML_SetCdataSectionHandler
-#define XML_SetCharacterDataHandler php_XML_SetCharacterDataHandler
-#define XML_SetCommentHandler php_XML_SetCommentHandler
-#define XML_SetDefaultHandlerExpand php_XML_SetDefaultHandlerExpand
-#define XML_SetDefaultHandler php_XML_SetDefaultHandler
-#define XML_SetDoctypeDeclHandler php_XML_SetDoctypeDeclHandler
-#define XML_SetElementDeclHandler php_XML_SetElementDeclHandler
-#define XML_SetElementHandler php_XML_SetElementHandler
-#define XML_SetEncoding php_XML_SetEncoding
-#define XML_SetEndCdataSectionHandler php_XML_SetEndCdataSectionHandler
-#define XML_SetEndDoctypeDeclHandler php_XML_SetEndDoctypeDeclHandler
-#define XML_SetEndElementHandler php_XML_SetEndElementHandler
-#define XML_SetEndNamespaceDeclHandler php_XML_SetEndNamespaceDeclHandler
-#define XML_SetEntityDeclHandler php_XML_SetEntityDeclHandler
-#define XML_SetExternalEntityRefHandlerArg php_XML_SetExternalEntityRefHandlerArg
-#define XML_SetExternalEntityRefHandler php_XML_SetExternalEntityRefHandler
-#define XML_SetNamespaceDeclHandler php_XML_SetNamespaceDeclHandler
-#define XML_SetNotationDeclHandler php_XML_SetNotationDeclHandler
-#define XML_SetNotStandaloneHandler php_XML_SetNotStandaloneHandler
-#define XML_SetParamEntityParsing php_XML_SetParamEntityParsing
-#define XML_SetProcessingInstructionHandler php_XML_SetProcessingInstructionHandler
-#define XML_SetReturnNSTriplet php_XML_SetReturnNSTriplet
-#define XML_SetStartCdataSectionHandler php_XML_SetStartCdataSectionHandler
-#define XML_SetStartDoctypeDeclHandler php_XML_SetStartDoctypeDeclHandler
-#define XML_SetStartElementHandler php_XML_SetStartElementHandler
-#define XML_SetStartNamespaceDeclHandler php_XML_SetStartNamespaceDeclHandler
-#define XML_SetUnknownEncodingHandler php_XML_SetUnknownEncodingHandler
-#define XML_SetUnparsedEntityDeclHandler php_XML_SetUnparsedEntityDeclHandler
-#define XML_SetUserData php_XML_SetUserData
-#define XML_SetXmlDeclHandler php_XML_SetXmlDeclHandler
-#define XmlSizeOfUnknownEncoding php_XmlSizeOfUnknownEncoding
-#define XML_UseParserAsHandlerArg php_XML_UseParserAsHandlerArg
-#define XmlUtf16Encode php_XmlUtf16Encode
-#define XmlUtf8Encode php_XmlUtf8Encode
-#endif
-
-#endif
diff --git a/main/php_content_types.c b/main/php_content_types.c
deleted file mode 100644
index a9c8b1d781..0000000000
--- a/main/php_content_types.c
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#include "php.h"
-#include "SAPI.h"
-#include "rfc1867.h"
-
-#include "php_content_types.h"
-
-/* {{{ php_post_entries[]
- */
-static sapi_post_entry php_post_entries[] = {
- { DEFAULT_POST_CONTENT_TYPE, sizeof(DEFAULT_POST_CONTENT_TYPE)-1, sapi_read_standard_form_data, php_std_post_handler },
- { MULTIPART_CONTENT_TYPE, sizeof(MULTIPART_CONTENT_TYPE)-1, sapi_read_standard_form_data, rfc1867_post_handler },
- { NULL, 0, NULL }
-};
-/* }}} */
-
-/* {{{ SAPI_POST_READER_FUNC
- */
-SAPI_POST_READER_FUNC(php_default_post_reader)
-{
- char *data;
- ELS_FETCH();
-
- sapi_read_standard_form_data(SLS_C);
- data = estrndup(SG(request_info).post_data,SG(request_info).post_data_length);
- SET_VAR_STRINGL("HTTP_RAW_POST_DATA", data, SG(request_info).post_data_length);
-}
-/* }}} */
-
-/* {{{ php_startup_sapi_content_types
- */
-int php_startup_sapi_content_types(void)
-{
- sapi_register_post_entries(php_post_entries);
- sapi_register_default_post_reader(php_default_post_reader);
- return SUCCESS;
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/main/php_content_types.h b/main/php_content_types.h
deleted file mode 100644
index 7752b8c121..0000000000
--- a/main/php_content_types.h
+++ /dev/null
@@ -1,10 +0,0 @@
-#ifndef PHP_CONTENT_TYPES_H
-#define PHP_CONTENT_TYPES_H
-
-#define DEFAULT_POST_CONTENT_TYPE "application/x-www-form-urlencoded"
-
-SAPI_POST_READER_FUNC(php_default_post_reader);
-SAPI_POST_HANDLER_FUNC(php_std_post_handler);
-int php_startup_sapi_content_types(void);
-
-#endif /* PHP_CONTENT_TYPES_H */
diff --git a/main/php_globals.h b/main/php_globals.h
deleted file mode 100644
index 57b9da2a9b..0000000000
--- a/main/php_globals.h
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-
-#ifndef PHP_GLOBALS_H
-#define PHP_GLOBALS_H
-
-#include "zend_globals.h"
-
-typedef struct _php_core_globals php_core_globals;
-
-#ifdef ZTS
-# define PLS_D php_core_globals *core_globals
-# define PLS_DC , PLS_D
-# define PLS_C core_globals
-# define PLS_CC , PLS_C
-# define PG(v) (core_globals->v)
-# define PLS_FETCH() php_core_globals *core_globals = ts_resource(core_globals_id)
-extern PHPAPI int core_globals_id;
-#else
-# define PLS_D
-# define PLS_DC
-# define PLS_C
-# define PLS_CC
-# define PG(v) (core_globals.v)
-# define PLS_FETCH()
-extern ZEND_API struct _php_core_globals core_globals;
-#endif
-
-
-#define TRACK_VARS_POST 0
-#define TRACK_VARS_GET 1
-#define TRACK_VARS_COOKIE 2
-#define TRACK_VARS_SERVER 3
-#define TRACK_VARS_ENV 4
-#define TRACK_VARS_FILES 5
-
-struct _php_tick_function_entry;
-
-typedef struct _arg_separators {
- char *output;
- char *input;
-} arg_separators;
-
-struct _php_core_globals {
- zend_bool magic_quotes_gpc;
- zend_bool magic_quotes_runtime;
- zend_bool magic_quotes_sybase;
-
- zend_bool allow_call_time_pass_reference;
- zend_bool zend_set_utility_values;
- zend_bool output_buffering;
- zend_bool implicit_flush;
-
- zend_bool safe_mode;
- zend_bool sql_safe_mode;
- zend_bool enable_dl;
-
- char *output_handler;
-
- char *safe_mode_exec_dir;
-
- long memory_limit;
-
- zend_bool track_errors;
- zend_bool display_errors;
- zend_bool display_startup_errors;
- zend_bool log_errors;
- char *error_log;
-
- char *doc_root;
- char *user_dir;
- char *include_path;
- char *open_basedir;
- char *extension_dir;
-
- char *upload_tmp_dir;
- long upload_max_filesize;
-
- char *error_append_string;
- char *error_prepend_string;
-
- char *auto_prepend_file;
- char *auto_append_file;
-
- arg_separators arg_separator;
-
- char *gpc_order;
- char *variables_order;
-
- HashTable rfc1867_protected_variables;
-
- short connection_status;
- short ignore_user_abort;
-
- unsigned char header_is_being_sent;
-
- zend_llist tick_functions;
-
- zval *http_globals[6];
-
- zend_bool expose_php;
-
- zend_bool register_globals;
- zend_bool register_argc_argv;
-
- zend_bool y2k_compliance;
-
- zend_bool html_errors;
-
- zend_bool modules_activated;
-
- zend_bool file_uploads;
-
- zend_bool during_request_startup;
-
- zend_bool allow_url_fopen;
-};
-
-
-#endif /* PHP_GLOBALS_H */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/main/php_ini.c b/main/php_ini.c
deleted file mode 100644
index 1358f6cdae..0000000000
--- a/main/php_ini.c
+++ /dev/null
@@ -1,380 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
- */
-
-
-#include "php.h"
-#ifndef PHP_WIN32
-#include "build-defs.h"
-#endif
-#include "ext/standard/info.h"
-#include "zend_ini.h"
-#include "php_ini.h"
-#include "ext/standard/dl.h"
-#include "zend_extensions.h"
-#include "zend_highlight.h"
-
-typedef struct _php_extension_lists {
- zend_llist engine;
- zend_llist functions;
-} php_extension_lists;
-
-
-/* True globals */
-static HashTable configuration_hash;
-PHPAPI char *php_ini_opened_path=NULL;
-static php_extension_lists extension_lists;
-
-/* {{{ php_ini_displayer_cb
- */
-static void php_ini_displayer_cb(zend_ini_entry *ini_entry, int type)
-{
- if (ini_entry->displayer) {
- ini_entry->displayer(ini_entry, type);
- } else {
- char *display_string;
- uint display_string_length, esc_html=0;
-
- if (type==ZEND_INI_DISPLAY_ORIG && ini_entry->modified) {
- if (ini_entry->orig_value) {
- display_string = ini_entry->orig_value;
- display_string_length = ini_entry->orig_value_length;
- esc_html=1;
- } else {
- display_string = "<i>no value</i>";
- display_string_length = sizeof("<i>no value</i>")-1;
- }
- } else if (ini_entry->value && ini_entry->value[0]) {
- display_string = ini_entry->value;
- display_string_length = ini_entry->value_length;
- esc_html=1;
- } else {
- display_string = "<i>no value</i>";
- display_string_length = sizeof("<i>no value</i>")-1;
- }
- if(esc_html) {
- zend_html_puts(display_string, display_string_length);
- } else {
- PHPWRITE(display_string, display_string_length);
- }
- }
-}
-/* }}} */
-
-/* {{{ php_ini_displayer
- */
-static int php_ini_displayer(zend_ini_entry *ini_entry, int module_number)
-{
- if (ini_entry->module_number != module_number) {
- return 0;
- }
-
- PUTS("<tr valign=\"baseline\" bgcolor=\"" PHP_CONTENTS_COLOR "\">");
- PUTS("<td bgcolor=\"" PHP_ENTRY_NAME_COLOR "\"><b>");
- PHPWRITE(ini_entry->name, ini_entry->name_length-1);
- PUTS("</b><br></td><td align=\"center\">");
- php_ini_displayer_cb(ini_entry, ZEND_INI_DISPLAY_ACTIVE);
- PUTS("</td><td align=\"center\">");
- php_ini_displayer_cb(ini_entry, ZEND_INI_DISPLAY_ORIG);
- PUTS("</td></tr>\n");
- return 0;
-}
-/* }}} */
-
-/* {{{ display_ini_entries
- */
-PHPAPI void display_ini_entries(zend_module_entry *module)
-{
- int module_number;
- ELS_FETCH();
-
- if (module) {
- module_number = module->module_number;
- } else {
- module_number = 0;
- }
- php_info_print_table_start();
- php_info_print_table_header(3, "Directive", "Local Value", "Master Value");
- zend_hash_apply_with_argument(&EG(ini_directives), (apply_func_arg_t) php_ini_displayer, (void *) (long) module_number);
- php_info_print_table_end();
-}
-/* }}} */
-
-/* php.ini support */
-
-#ifdef ZTS
-# if (ZEND_DEBUG)
-# define ZEND_EXTENSION_TOKEN "zend_extension_debug_ts"
-# else
-# define ZEND_EXTENSION_TOKEN "zend_extension_ts"
-# endif
-#else
-# if (ZEND_DEBUG)
-# define ZEND_EXTENSION_TOKEN "zend_extension_debug"
-# else
-# define ZEND_EXTENSION_TOKEN "zend_extension"
-# endif
-#endif
-
-/* {{{ pvalue_config_destructor
- */
-static void pvalue_config_destructor(zval *pvalue)
-{
- if (pvalue->type == IS_STRING && pvalue->value.str.val != empty_string) {
- free(pvalue->value.str.val);
- }
-}
-/* }}} */
-
-/* {{{ php_config_ini_parser_cb
- */
-static void php_config_ini_parser_cb(zval *arg1, zval *arg2, int callback_type, void *arg)
-{
- switch (callback_type) {
- case ZEND_INI_PARSER_ENTRY: {
- zval *entry;
-
- if (!arg2) {
- break;
- }
- if (!strcasecmp(Z_STRVAL_P(arg1), "extension")) { /* load function module */
- zval copy;
-
- copy = *arg2;
- zval_copy_ctor(&copy);
- copy.refcount = 0;
- zend_llist_add_element(&extension_lists.functions, &copy);
- } else if (!strcasecmp(Z_STRVAL_P(arg1), ZEND_EXTENSION_TOKEN)) { /* load Zend extension */
- char *extension_name = estrndup(Z_STRVAL_P(arg2), Z_STRLEN_P(arg2));
-
- zend_llist_add_element(&extension_lists.engine, &extension_name);
- } else {
- zend_hash_update(&configuration_hash, Z_STRVAL_P(arg1), Z_STRLEN_P(arg1)+1, arg2, sizeof(zval), (void **) &entry);
- Z_STRVAL_P(entry) = zend_strndup(Z_STRVAL_P(entry), Z_STRLEN_P(entry));
- }
- }
- break;
- case ZEND_INI_PARSER_SECTION:
- break;
- }
-}
-/* }}} */
-
-/* {{{ php_load_function_extension_cb
- */
-static void php_load_function_extension_cb(void *arg)
-{
- zval *extension = (zval *) arg;
- zval zval;
-
- php_dl(extension, MODULE_PERSISTENT, &zval);
-}
-/* }}} */
-
-/* {{{ php_load_zend_extension_cb
- */
-static void php_load_zend_extension_cb(void *arg)
-{
- zend_load_extension(*((char **) arg));
-}
-/* }}} */
-
-/* {{{ php_init_config
- */
-int php_init_config(char *php_ini_path_override)
-{
- char *env_location, *php_ini_search_path;
- int safe_mode_state;
- char *open_basedir;
- int free_ini_search_path=0;
- zend_file_handle fh;
- PLS_FETCH();
-
- if (zend_hash_init(&configuration_hash, 0, NULL, (dtor_func_t) pvalue_config_destructor, 1)==FAILURE) {
- return FAILURE;
- }
-
- zend_llist_init(&extension_lists.engine, sizeof(zval), (llist_dtor_func_t) free_estring, 1);
- zend_llist_init(&extension_lists.functions, sizeof(zval), (llist_dtor_func_t) ZVAL_DESTRUCTOR, 1);
-
- safe_mode_state = PG(safe_mode);
- open_basedir = PG(open_basedir);
-
- env_location = getenv("PHPRC");
- if (!env_location) {
- env_location="";
- }
- if (php_ini_path_override) {
- php_ini_search_path = php_ini_path_override;
- free_ini_search_path = 0;
- } else {
- char *default_location;
- int free_default_location;
-
-#ifdef PHP_WIN32
- default_location = (char *) emalloc(512);
-
- if (!GetWindowsDirectory(default_location,255)) {
- default_location[0]=0;
- }
- free_default_location=1;
-#else
- default_location = PHP_CONFIG_FILE_PATH;
- free_default_location=0;
-#endif
- php_ini_search_path = (char *) emalloc(sizeof(".")+strlen(env_location)+strlen(default_location)+2+1);
- free_ini_search_path = 1;
- if(env_location && env_location[0]) {
- sprintf(php_ini_search_path, ".%c%s%c%s", ZEND_PATHS_SEPARATOR, env_location, ZEND_PATHS_SEPARATOR, default_location);
- } else {
- sprintf(php_ini_search_path, ".%c%s", ZEND_PATHS_SEPARATOR, default_location);
- }
- if (free_default_location) {
- efree(default_location);
- }
- }
-
- PG(safe_mode) = 0;
- PG(open_basedir) = NULL;
-
- fh.handle.fp = php_fopen_with_path("php.ini", "r", php_ini_search_path, &php_ini_opened_path);
- if (free_ini_search_path) {
- efree(php_ini_search_path);
- }
- PG(safe_mode) = safe_mode_state;
- PG(open_basedir) = open_basedir;
-
- if (!fh.handle.fp) {
- return SUCCESS; /* having no configuration file is ok */
- }
- fh.type = ZEND_HANDLE_FP;
- fh.filename = php_ini_opened_path;
-
- zend_parse_ini_file(&fh, 1, php_config_ini_parser_cb, &extension_lists);
-
- if (php_ini_opened_path) {
- zval tmp;
-
- tmp.value.str.len = strlen(php_ini_opened_path);
- tmp.value.str.val = zend_strndup(php_ini_opened_path, tmp.value.str.len);
- tmp.type = IS_STRING;
- zend_hash_update(&configuration_hash, "cfg_file_path", sizeof("cfg_file_path"),(void *) &tmp,sizeof(zval), NULL);
- persist_alloc(php_ini_opened_path);
- }
-
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ php_shutdown_config
- */
-int php_shutdown_config(void)
-{
- zend_hash_destroy(&configuration_hash);
- if (php_ini_opened_path) {
- efree(php_ini_opened_path);
- }
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ php_ini_delayed_modules_startup
- */
-void php_ini_delayed_modules_startup(void)
-{
- zend_llist_apply(&extension_lists.engine, php_load_zend_extension_cb);
- zend_llist_apply(&extension_lists.functions, php_load_function_extension_cb);
-
- zend_llist_destroy(&extension_lists.engine);
- zend_llist_destroy(&extension_lists.functions);
-}
-/* }}} */
-
-/* {{{ cfg_get_entry
- */
-zval *cfg_get_entry(char *name, uint name_length)
-{
- zval *tmp;
-
- if (zend_hash_find(&configuration_hash, name, name_length, (void **) &tmp)==SUCCESS) {
- return tmp;
- } else {
- return NULL;
- }
-}
-/* }}} */
-
-/* {{{ cfg_get_long
- */
-PHPAPI int cfg_get_long(char *varname,long *result)
-{
- zval *tmp,var;
-
- if (zend_hash_find(&configuration_hash,varname,strlen(varname)+1,(void **) &tmp)==FAILURE) {
- *result=(long)NULL;
- return FAILURE;
- }
- var = *tmp;
- zval_copy_ctor(&var);
- convert_to_long(&var);
- *result = var.value.lval;
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ cfg_get_double
- */
-PHPAPI int cfg_get_double(char *varname,double *result)
-{
- zval *tmp,var;
-
- if (zend_hash_find(&configuration_hash,varname,strlen(varname)+1,(void **) &tmp)==FAILURE) {
- *result=(double)0;
- return FAILURE;
- }
- var = *tmp;
- zval_copy_ctor(&var);
- convert_to_double(&var);
- *result = var.value.dval;
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ cfg_get_string
- */
-PHPAPI int cfg_get_string(char *varname, char **result)
-{
- zval *tmp;
-
- if (zend_hash_find(&configuration_hash,varname,strlen(varname)+1,(void **) &tmp)==FAILURE) {
- *result=NULL;
- return FAILURE;
- }
- *result = tmp->value.str.val;
- return SUCCESS;
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * indent-tabs-mode: t
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/main/php_ini.h b/main/php_ini.h
deleted file mode 100644
index 107a1cdc53..0000000000
--- a/main/php_ini.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-#ifndef PHP_INI_H
-#define PHP_INI_H
-
-#include "zend_ini.h"
-
-int php_init_config(char *php_ini_path_override);
-int php_shutdown_config(void);
-void php_ini_delayed_modules_startup(void);
-zval *cfg_get_entry(char *name, uint name_length);
-
-#define PHP_INI_USER ZEND_INI_USER
-#define PHP_INI_PERDIR ZEND_INI_PERDIR
-#define PHP_INI_SYSTEM ZEND_INI_SYSTEM
-
-#define PHP_INI_ALL ZEND_INI_ALL
-
-#define php_ini_entry zend_ini_entry
-
-#define PHP_INI_MH ZEND_INI_MH
-#define PHP_INI_DISP ZEND_INI_DISP
-
-#define PHP_INI_BEGIN ZEND_INI_BEGIN
-#define PHP_INI_END ZEND_INI_END
-
-#define PHP_INI_ENTRY3_EX ZEND_INI_ENTRY3_EX
-#define PHP_INI_ENTRY3 ZEND_INI_ENTRY3
-#define PHP_INI_ENTRY2_EX ZEND_INI_ENTRY2_EX
-#define PHP_INI_ENTRY2 ZEND_INI_ENTRY2
-#define PHP_INI_ENTRY1_EX ZEND_INI_ENTRY1_EX
-#define PHP_INI_ENTRY1 ZEND_INI_ENTRY1
-#define PHP_INI_ENTRY_EX ZEND_INI_ENTRY_EX
-#define PHP_INI_ENTRY ZEND_INI_ENTRY
-
-#define STD_PHP_INI_ENTRY STD_ZEND_INI_ENTRY
-#define STD_PHP_INI_ENTRY_EX STD_ZEND_INI_ENTRY_EX
-#define STD_PHP_INI_BOOLEAN STD_ZEND_INI_BOOLEAN
-
-#define PHP_INI_DISPLAY_ORIG ZEND_INI_DISPLAY_ORIG
-#define PHP_INI_DISPLAY_ACTIVE ZEND_INI_DISPLAY_ACTIVE
-
-#define PHP_INI_STAGE_STARTUP ZEND_INI_STAGE_STARTUP
-#define PHP_INI_STAGE_SHUTDOWN ZEND_INI_STAGE_SHUTDOWN
-#define PHP_INI_STAGE_ACTIVATE ZEND_INI_STAGE_ACTIVATE
-#define PHP_INI_STAGE_DEACTIVATE ZEND_INI_STAGE_DEACTIVATE
-#define PHP_INI_STAGE_RUNTIME ZEND_INI_STAGE_RUNTIME
-
-#define php_ini_boolean_displayer_cb zend_ini_boolean_displayer_cb
-#define php_ini_color_displayer_cb zend_ini_color_displayer_cb
-
-#define php_alter_ini_entry zend_alter_ini_entry
-
-#define php_ini_long zend_ini_long
-#define php_ini_double zend_ini_double
-#define php_ini_string zend_ini_string
-
-#endif /* PHP_INI_H */
diff --git a/main/php_logos.c b/main/php_logos.c
deleted file mode 100644
index c9eb588911..0000000000
--- a/main/php_logos.c
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Hartmut Holzgraefe <hartmut@six.de> |
- +----------------------------------------------------------------------+
-*/
-
-#include "php.h"
-#include "logos.h"
-#include "php_logos.h"
-#include "ext/standard/info.h"
-#include "SAPI.h"
-
-typedef struct _php_info_logo {
- char *mimetype;
- int mimelen;
- unsigned char *data;
- int size;
-} php_info_logo;
-
-HashTable phpinfo_logo_hash;
-
-PHPAPI int php_register_info_logo(char *logo_string, char *mimetype, unsigned char *data, int size)
-{
- php_info_logo info_logo;
-
- info_logo.mimetype = mimetype;
- info_logo.mimelen = strlen(mimetype);
- info_logo.data = data;
- info_logo.size = size;
-
- return zend_hash_add(&phpinfo_logo_hash, logo_string, strlen(logo_string), &info_logo, sizeof(php_info_logo), NULL);
-}
-
-PHPAPI int php_unregister_info_logo(char *logo_string)
-{
- return zend_hash_del(&phpinfo_logo_hash, logo_string, strlen(logo_string));
-}
-
-int php_init_info_logos(void)
-{
- if(zend_hash_init(&phpinfo_logo_hash, 0, NULL, NULL, 1)==FAILURE)
- return FAILURE;
-
- php_register_info_logo(PHP_LOGO_GUID , "image/gif", php_logo , sizeof(php_logo));
- php_register_info_logo(PHP_EGG_LOGO_GUID, "image/gif", php_egg_logo, sizeof(php_egg_logo));
- php_register_info_logo(ZEND_LOGO_GUID , "image/gif", zend_logo , sizeof(zend_logo));
-
- return SUCCESS;
-}
-
-int php_shutdown_info_logos(void)
-{
- zend_hash_destroy(&phpinfo_logo_hash);
- return SUCCESS;
-}
-
-#define CONTENT_TYPE_HEADER "Content-Type: "
-int php_info_logos(const char *logo_string)
-{
- php_info_logo *logo_image;
- char *content_header;
- int len;
-
- if(FAILURE==zend_hash_find(&phpinfo_logo_hash,(char *) logo_string,strlen(logo_string),(void **)&logo_image))
- return 0;
-
- len=strlen(CONTENT_TYPE_HEADER)+logo_image->mimelen;
- content_header=malloc(len+1);
- if(!content_header) return 0;
- strcpy(content_header,CONTENT_TYPE_HEADER);
- strcat(content_header,logo_image->mimetype);
- sapi_add_header(content_header, len, 1);
- free(content_header);
-
- PHPWRITE(logo_image->data, logo_image->size);
- return 1;
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/main/php_logos.h b/main/php_logos.h
deleted file mode 100644
index 42df0a87ae..0000000000
--- a/main/php_logos.h
+++ /dev/null
@@ -1,10 +0,0 @@
-#ifndef _PHP_LOGOS_H
-#define _PHP_LOGOS_H
-
-PHPAPI int php_register_info_logo(char *logo_string, char *mimetype, unsigned char *data, int size);
-PHPAPI int php_unregister_info_logo(char *logo_string);
-int php_init_info_logos(void);
-int php_shutdown_info_logos(void);
-int php_info_logos(const char *logo_string);
-
-#endif /* _PHP_LOGOS_H */
diff --git a/main/php_main.h b/main/php_main.h
deleted file mode 100644
index d8253f768f..0000000000
--- a/main/php_main.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
- */
-
-
-/* $Id$ */
-
-
-#ifndef PHP_MAIN_H
-#define PHP_MAIN_H
-
-#include "zend_globals.h"
-#include "php_globals.h"
-#include "SAPI.h"
-
-PHPAPI int php_request_startup(CLS_D ELS_DC PLS_DC SLS_DC);
-PHPAPI void php_request_shutdown(void *dummy);
-PHPAPI void php_request_shutdown_for_exec(void *dummy);
-PHPAPI int php_module_startup(sapi_module_struct *sf);
-PHPAPI void php_module_shutdown(void);
-PHPAPI void php_module_shutdown_for_exec(void);
-PHPAPI int php_module_shutdown_wrapper(sapi_module_struct *sapi_globals);
-
-PHPAPI int php_startup_extensions(zend_module_entry **ptr, int count);
-PHPAPI int php_global_startup_extensions(zend_module_entry **ptr, int count);
-PHPAPI int php_global_shutdown_extensions(zend_module_entry **ptr, int count);
-
-PHPAPI int php_execute_script(zend_file_handle *primary_file CLS_DC ELS_DC PLS_DC);
-PHPAPI int php_handle_special_queries(SLS_D PLS_DC);
-PHPAPI int php_lint_script(zend_file_handle *file CLS_DC ELS_DC PLS_DC);
-
-PHPAPI void php_handle_aborted_connection(void);
-PHPAPI int php_handle_auth_data(const char *auth SLS_DC);
-
-extern void php_call_shutdown_functions(void);
-
-/* environment module */
-extern int php_init_environ(void);
-extern int php_shutdown_environ(void);
-
-#if defined(MBSTR_ENC_TRANS)
-#define php_treat_data mbstr_treat_data
-#endif
-
-#endif
diff --git a/main/php_network.h b/main/php_network.h
deleted file mode 100644
index 43ce3ce182..0000000000
--- a/main/php_network.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Stig Venaas <venaas@uninett.no> |
- +----------------------------------------------------------------------+
- */
-/* $Id$ */
-
-#ifndef _PHP_NETWORK_H
-#define _PHP_NETWORK_H
-
-#ifdef PHP_WIN32
-# ifndef WINNT
-# define WINNT 1
-# endif
-# undef FD_SETSIZE
-# include "arpa/inet.h"
-# define socklen_t unsigned int
-#endif
-
-#ifdef HAVE_NETINET_IN_H
-# include <netinet/in.h>
-#endif
-
-#ifdef HAVE_SYS_SOCKET_H
-#include <sys/socket.h>
-#endif
-
-#ifdef HAVE_SYS_TIME_H
-#include <sys/time.h>
-#endif
-
-
-
-int php_hostconnect(char *host, unsigned short port, int socktype, int timeout);
-PHPAPI int php_connect_nonb(int sockfd, struct sockaddr *addr, socklen_t addrlen, struct timeval *timeout);
-
-#endif /* _PHP_NETWORK_H */
-
-/*
- * Local variables:
- * tab-width: 8
- * c-basic-offset: 8
- * End:
- */
diff --git a/main/php_open_temporary_file.c b/main/php_open_temporary_file.c
deleted file mode 100644
index de4aacc998..0000000000
--- a/main/php_open_temporary_file.c
+++ /dev/null
@@ -1,204 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
- */
-
-#include "php.h"
-
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-
-#ifdef PHP_WIN32
-#include <windows.h>
-#include <winsock.h>
-#define O_RDONLY _O_RDONLY
-#include "win32/param.h"
-#include "win32/winutil.h"
-#else
-#include <sys/param.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <netdb.h>
-#if HAVE_ARPA_INET_H
-#include <arpa/inet.h>
-#endif
-#endif
-#ifdef HAVE_SYS_TIME_H
-#include <sys/time.h>
-#endif
-
-#ifdef HAVE_SYS_FILE_H
-#include <sys/file.h>
-#endif
-
-#if !defined(P_tmpdir)
-#define P_tmpdir ""
-#endif
-
-/* {{{ php_do_open_temporary_file */
-
-/* Loosely based on a tempnam() implementation by UCLA */
-
-/*
- * Copyright (c) 1988, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-static FILE *php_do_open_temporary_file(char *path, const char *pfx, char **opened_path_p)
-{
- char *trailing_slash;
- FILE *fp;
- char *opened_path;
-#ifndef PHP_WIN32
- int fd;
-#endif
-
- if (!path) {
- return NULL;
- }
-
- if (!(opened_path = emalloc(MAXPATHLEN))) {
- return NULL;
- }
-
- if (*path+strlen(path)-1 == '/') {
- trailing_slash = "";
- } else {
- trailing_slash = "/";
- }
-
- (void)snprintf(opened_path, MAXPATHLEN, "%s%s%sXXXXXX", path, trailing_slash, pfx);
-
-#ifdef PHP_WIN32
- if (GetTempFileName(path, pfx, 0, opened_path)) {
- fp = VCWD_FOPEN(opened_path, "wb");
- } else {
- fp = NULL;
- }
-#elif defined(HAVE_MKSTEMP)
- fd = mkstemp(opened_path);
- if (fd==-1) {
- fp = NULL;
- } else {
- fp = fdopen(fd, "wb");
- }
-#else
- if (mktemp(opened_path)) {
- fp = VCWD_FOPEN(opened_path, "wb");
- } else {
- fp = NULL;
- }
-#endif
- if (!fp || !opened_path_p) {
- efree(opened_path);
- } else {
- *opened_path_p = opened_path;
- }
- return fp;
-}
-/* }}} */
-
-/* {{{ php_open_temporary_file
- *
- * Unlike tempnam(), the supplied dir argument takes precedence
- * over the TMPDIR environment variable
- * This function should do its best to return a file pointer to a newly created
- * unique file, on every platform.
- */
-PHPAPI FILE *php_open_temporary_file(const char *dir, const char *pfx, char **opened_path_p)
-{
- static char path_tmp[] = "/tmp";
- FILE *fp;
-
-
- if (!pfx) {
- pfx = "tmp.";
- }
-
- if (opened_path_p) {
- *opened_path_p = NULL;
- }
-
- if ((fp=php_do_open_temporary_file((char *) dir, pfx, opened_path_p))) {
- return fp;
- }
-
- if ((fp=php_do_open_temporary_file(getenv("TMPDIR"), pfx, opened_path_p))) {
- return fp;
- }
-#if PHP_WIN32
- {
- char *TempPath;
-
- TempPath = (char *) emalloc(MAXPATHLEN);
- if (GetTempPath(MAXPATHLEN, TempPath)) {
- fp = php_do_open_temporary_file(TempPath, pfx, opened_path_p);
- }
- efree(TempPath);
- return fp;
- }
-#else
- if ((fp=php_do_open_temporary_file(P_tmpdir, pfx, opened_path_p))) {
- return fp;
- }
-
- if ((fp=php_do_open_temporary_file(path_tmp, pfx, opened_path_p))) {
- return fp;
- }
-#endif
-
- return NULL;
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/main/php_open_temporary_file.h b/main/php_open_temporary_file.h
deleted file mode 100644
index 38c99cf0aa..0000000000
--- a/main/php_open_temporary_file.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-#ifndef PHP_OPEN_TEMPORARY_FILE_H
-#define PHP_OPEN_TEMPORARY_FILE_H
-
-PHPAPI FILE *php_open_temporary_file(const char *dir, const char *pfx, char **opened_path_p);
-
-#endif /* PHP_OPEN_TEMPORARY_FILE_H */
diff --git a/main/php_output.h b/main/php_output.h
deleted file mode 100644
index 58a3db8c15..0000000000
--- a/main/php_output.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef PHP_OUTPUT_H
-#define PHP_OUTPUT_H
-
-#include "php.h"
-
-typedef void (*php_output_handler_func_t)(char *output, uint output_len, char **handled_output, uint *handled_output_len, int mode);
-
-PHPAPI void php_output_startup(void);
-void php_output_register_constants(void);
-PHPAPI int php_body_write(const char *str, uint str_length);
-PHPAPI int php_header_write(const char *str, uint str_length);
-PHPAPI int php_start_ob_buffer(zval *output_handler, uint chunk_size);
-PHPAPI void php_end_ob_buffer(zend_bool send_buffer, zend_bool just_flush);
-PHPAPI void php_end_ob_buffers(zend_bool send_buffer);
-PHPAPI int php_ob_get_buffer(pval *p);
-PHPAPI int php_ob_get_length(pval *p);
-PHPAPI void php_start_implicit_flush(void);
-PHPAPI void php_end_implicit_flush(void);
-PHPAPI char *php_get_output_start_filename(void);
-PHPAPI int php_get_output_start_lineno(void);
-PHPAPI void php_ob_set_internal_handler(php_output_handler_func_t internal_output_handler, uint buffer_size);
-
-PHP_FUNCTION(ob_start);
-PHP_FUNCTION(ob_end_flush);
-PHP_FUNCTION(ob_end_clean);
-PHP_FUNCTION(ob_get_contents);
-PHP_FUNCTION(ob_get_length);
-PHP_FUNCTION(ob_implicit_flush);
-
-typedef struct _php_ob_buffer {
- char *buffer;
- uint size;
- uint text_length;
- int block_size;
- uint chunk_size;
- int status;
- zval *output_handler;
- php_output_handler_func_t internal_output_handler;
- char *internal_output_handler_buffer;
- uint internal_output_handler_buffer_size;
-} php_ob_buffer;
-
-typedef struct _php_output_globals {
- int (*php_body_write)(const char *str, uint str_length); /* string output */
- int (*php_header_write)(const char *str, uint str_length); /* unbuffer string output */
- php_ob_buffer active_ob_buffer;
- unsigned char implicit_flush;
- char *output_start_filename;
- int output_start_lineno;
- zend_stack ob_buffers;
- int nesting_level;
- zend_bool lock;
-} php_output_globals;
-
-
-#ifdef ZTS
-#define OLS_D php_output_globals *output_globals
-#define OLS_C output_globals
-#define OG(v) (output_globals->v)
-#define OLS_FETCH() php_output_globals *output_globals = ts_resource(output_globals_id)
-ZEND_API extern int output_globals_id;
-#else
-#define OLS_D void
-#define OLS_C
-#define OG(v) (output_globals.v)
-#define OLS_FETCH()
-ZEND_API extern php_output_globals output_globals;
-#endif
-
-#define PHP_OUTPUT_HANDLER_START (1<<0)
-#define PHP_OUTPUT_HANDLER_CONT (1<<1)
-#define PHP_OUTPUT_HANDLER_END (1<<2)
-
-#endif /* PHP_OUTPUT_H */
diff --git a/main/php_realpath.c b/main/php_realpath.c
deleted file mode 100644
index 8c7cef5f86..0000000000
--- a/main/php_realpath.c
+++ /dev/null
@@ -1,283 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997, 1998, 1999, 2000 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Sander Steffann (sander@steffann.nl) |
- +----------------------------------------------------------------------+
- */
-
-#include "php.h"
-
-#if HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#include <sys/stat.h>
-
-#ifndef MAXSYMLINKS
-#define MAXSYMLINKS 32
-#endif
-
-#ifndef S_ISDIR
-#define S_ISDIR(mode) (((mode)&S_IFMT) == S_IFDIR)
-#endif
-
-char *php_realpath(char *path, char resolved_path[]);
-
-#ifdef PHP_WIN32
-#define IS_SLASH(p) ((p) == '/' || (p) == '\\')
-#else
-#define IS_SLASH(p) ((p) == '/')
-#endif
-
-char *php_realpath(char *path, char resolved_path []) {
- char path_construction[MAXPATHLEN]; /* We build the result in here */
- char *writepos; /* Position to write next char */
-
- char path_copy[MAXPATHLEN]; /* A work-copy of the path */
- char *workpos; /* working position in *path */
-
-#if !defined(PHP_WIN32)
- char buf[MAXPATHLEN]; /* Buffer for readlink */
- int linklength; /* The result from readlink */
-#endif
- int linkcount = 0; /* Count symlinks to avoid loops */
-
- struct stat filestat; /* result from stat */
-
-#ifdef PHP_WIN32
- char *temppos; /* position while counting '.' */
- int dotcount; /* number of '.' */
- int t; /* counter */
-#endif
-
- /* Set the work-position to the beginning of the given path */
- strcpy(path_copy, path);
- workpos = path_copy;
-
-#ifdef PHP_WIN32
- /* Find out where we start - Windows version */
- if (IS_SLASH(*workpos)) {
- /* We start at the root of the current drive */
- /* Get the current directory */
- if (V_GETCWD(path_construction, MAXPATHLEN-1) == NULL) {
- /* Unable to get cwd */
- resolved_path[0] = 0;
- return NULL;
- }
- /* We only need the first three chars (for example "C:\") */
- path_construction[3] = 0;
- workpos++;
- } else if (workpos[1] == ':') {
- /* A drive-letter is specified, copy it */
- strncpy(path_construction, path, 2);
- strcat(path_construction, "\\");
- workpos++;
- workpos++;
- } else {
- /* Use the current directory */
- if (V_GETCWD(path_construction, MAXPATHLEN-1) == NULL) {
- /* Unable to get cwd */
- resolved_path[0] = 0;
- return NULL;
- }
- strcat(path_construction, "\\");
- }
-#else
- /* Find out where we start - Unix version */
- if (*workpos == '/') {
- /* We start at the root */
- strcpy(path_construction, "/");
- workpos++;
- } else {
- /* Use the current directory */
- if (V_GETCWD(path_construction, MAXPATHLEN-1) == NULL) {
- /* Unable to get cwd */
- resolved_path[0] = 0;
- return NULL;
- }
- strcat(path_construction, "/");
- }
-#endif
-
- /* Set the next-char-position */
- writepos = &path_construction[strlen(path_construction)];
-
- /* Go to the end, then stop */
- while(*workpos != 0) {
- /* Strip (back)slashes */
- while(IS_SLASH(*workpos)) workpos++;
-
-#ifdef PHP_WIN32
- /* reset dotcount */
- dotcount = 0;
-
- /* Look for .. */
- if ((workpos[0] == '.') && (workpos[1] != 0)) {
- /* Windows accepts \...\ as \..\..\, \....\ as \..\..\..\, etc */
- /* At least Win98 does */
-
- temppos = workpos;
- while(*temppos++ == '.') {
- dotcount++;
- if (!IS_SLASH(*temppos) && (*temppos != 0) && (*temppos != '.')) {
- /* This is not a /../ component, but a filename that starts with '.' */
- dotcount = 0;
- }
- }
-
- /* Go back dotcount-1 times */
- for (t=0 ; t<(dotcount-1) ; t++) {
- workpos++; /* move to next '.' */
-
- /* Can we still go back? */
- if ((writepos-3) <= path_construction) return NULL;
-
- /* Go back */
- writepos--; /* move to '\' */
- writepos--;
- while(!IS_SLASH(*writepos)) writepos--; /* skip until previous '\\' */
- }
- workpos++;
- }
-
- /* No special case */
- if (dotcount == 0) {
- /* Append */
- while(!IS_SLASH(*workpos) && (*workpos != 0)) {
- *writepos++ = *workpos++;
- }
- }
-
- /* Just one '.', go to next element */
- if (dotcount == 1) {
- while(!IS_SLASH(*workpos) && (*workpos != 0)) {
- *workpos++;
- }
-
- /* Avoid double \ in the result */
- writepos--;
- }
-
- /* If it was a directory, append a slash */
- if (IS_SLASH(*workpos)) {
- *writepos++ = *workpos++;
- }
- *writepos = 0;
-#else /* defined(PHP_WIN32) */
- /* Look for .. */
- if ((workpos[0] == '.') && (workpos[1] != 0)) {
- if ((workpos[1] == '.') && ((workpos[2] == '/') || (workpos[2] == 0))) {
- /* One directory back */
- /* Set pointers to right position */
- workpos++; /* move to second '.' */
- workpos++; /* move to '/' */
-
- /* Only apply .. if not in root */
- if ((writepos-1) > path_construction) {
- writepos--; /* move to '/' */
- while(*--writepos != '/') ; /* skip until previous '/' */
- }
- } else {
- if (workpos[1] == '/') {
- /* Found a /./ skip it */
- workpos++; /* move to '/' */
-
- /* Avoid double / in the result */
- writepos--;
- } else {
- /* No special case, the name just started with a . */
- /* Append */
- while((*workpos != '/') && (*workpos != 0)) {
- *writepos++ = *workpos++;
- }
- }
- }
- } else {
- /* No special case */
- /* Append */
- while((*workpos != '/') && (*workpos != 0)) {
- *writepos++ = *workpos++;
- }
- }
-
-#if HAVE_SYMLINK
- /* We are going to use path_construction, so close it */
- *writepos = 0;
-
- /* Check the current location to see if it is a symlink */
- if((linklength = readlink(path_construction, buf, MAXPATHLEN)) != -1) {
- /* Check linkcount */
- if (linkcount > MAXSYMLINKS) return NULL;
-
- /* Count this symlink */
- linkcount++;
-
- /* Set end of buf */
- buf[linklength] = 0;
-
- /* Check for overflow */
- if ((strlen(workpos) + strlen(buf) + 1) >= MAXPATHLEN) return NULL;
-
- /* Remove the symlink-component wrom path_construction */
- writepos--; /* move to '/' */
- while(*--writepos != '/') ; /* skip until previous '/' */
- *++writepos = 0; /* end of string after '/' */
-
- /* If the symlink starts with a '/', empty path_construction */
- if (*buf == '/') {
- *path_construction = 0;
- writepos = path_construction;
- }
-
- /* Insert symlink into path_copy */
- strcat(buf, workpos);
- strcpy(path_copy, buf);
- workpos = path_copy;
- }
-#endif /* HAVE_SYMLINK */
-
- /* If it was a directory, append a slash */
- if (*workpos == '/') {
- *writepos++ = *workpos++;
- }
- *writepos = 0;
-#endif /* defined(PHP_WIN32) */
- }
-
- /* Check if the resolved path is a directory */
- if (V_STAT(path_construction, &filestat) != 0) {
- if (errno != ENOENT) return NULL;
- } else {
- if (S_ISDIR(filestat.st_mode)) {
- /* It's a directory, append a / if needed */
- if (*(writepos-1) != '/') {
- /* Check for overflow */
- if ((strlen(workpos) + 2) >= MAXPATHLEN) {
- return NULL;
- }
- *writepos++ = '/';
- *writepos = 0;
- }
- }
- }
-
- strcpy(resolved_path, path_construction);
- return resolved_path;
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/main/php_reentrancy.h b/main/php_reentrancy.h
deleted file mode 100644
index 8e9c674a14..0000000000
--- a/main/php_reentrancy.h
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Sascha Schumann <sascha@schumann.cx> |
- +----------------------------------------------------------------------+
- */
-
-
-#ifndef PHP_REENTRANCY_H
-#define PHP_REENTRANCY_H
-
-#include "php.h"
-
-#include <sys/types.h>
-#ifdef HAVE_DIRENT_H
-#include <dirent.h>
-#endif
-#include <time.h>
-
-/* currently, PHP does not check for these functions, but assumes
- that they are available on all systems. */
-
-#define HAVE_LOCALTIME 1
-#define HAVE_GMTIME 1
-#define HAVE_ASCTIME 1
-#define HAVE_CTIME 1
-
-#if defined(PHP_IRIX_TIME_R)
-#undef HAVE_ASCTIME_R
-#undef HAVE_CTIME_R
-#endif
-
-#if defined(PHP_HPUX_TIME_R)
-#undef HAVE_LOCALTIME_R
-#undef HAVE_ASCTIME_R
-#undef HAVE_CTIME_R
-#undef HAVE_GMTIME_R
-#endif
-
-#if defined(HAVE_POSIX_READDIR_R)
-#define php_readdir_r readdir_r
-#else
-PHPAPI int php_readdir_r(DIR *dirp, struct dirent *entry,
- struct dirent **result);
-#endif
-
-#if !defined(HAVE_LOCALTIME_R) && defined(HAVE_LOCALTIME)
-#define PHP_NEED_REENTRANCY 1
-PHPAPI struct tm *php_localtime_r(const time_t *const timep, struct tm *p_tm);
-#else
-#define php_localtime_r localtime_r
-#ifdef MISSING_LOCALTIME_R_DECL
-struct tm *localtime_r(const time_t *const timep, struct tm *p_tm);
-#endif
-#endif
-
-
-#if !defined(HAVE_CTIME_R) && defined(HAVE_CTIME)
-#define PHP_NEED_REENTRANCY 1
-PHPAPI char *php_ctime_r(const time_t *clock, char *buf);
-#else
-#define php_ctime_r ctime_r
-#ifdef MISSING_CTIME_R_DECL
-char *ctime_r(const time_t *clock, char *buf);
-#endif
-#endif
-
-
-#if !defined(HAVE_ASCTIME_R) && defined(HAVE_ASCTIME)
-#define PHP_NEED_REENTRANCY 1
-PHPAPI char *php_asctime_r(const struct tm *tm, char *buf);
-#else
-#define php_asctime_r asctime_r
-#ifdef MISSING_ASCTIME_R_DECL
-char *asctime_r(const struct tm *tm, char *buf);
-#endif
-#endif
-
-
-#if !defined(HAVE_GMTIME_R) && defined(HAVE_GMTIME)
-#define PHP_NEED_REENTRANCY 1
-PHPAPI struct tm *php_gmtime_r(const time_t *const timep, struct tm *p_tm);
-#else
-#define php_gmtime_r gmtime_r
-#ifdef MISSING_GMTIME_R_DECL
-struct tm *php_gmtime_r(const time_t *const timep, struct tm *p_tm);
-#endif
-#endif
-
-#if !defined(HAVE_STRTOK_R)
-PHPAPI char *php_strtok_r(char *s, const char *delim, char **last);
-#else
-#define php_strtok_r strtok_r
-#ifdef MISSING_STRTOK_R_DECL
-char *strtok_r(char *s, const char *delim, char **last);
-#endif
-#endif
-
-#if !defined(HAVE_RAND_R)
-PHPAPI int php_rand_r(unsigned int *seed);
-#else
-#define php_rand_r rand_r
-#endif
-
-#if !defined(ZTS)
-#undef PHP_NEED_REENTRANCY
-#endif
-
-#if defined(PHP_NEED_REENTRANCY)
-void reentrancy_startup(void);
-void reentrancy_shutdown(void);
-#else
-#define reentrancy_startup()
-#define reentrancy_shutdown()
-#endif
-
-#endif
diff --git a/main/php_regex.h b/main/php_regex.h
deleted file mode 100644
index c1d1e0c232..0000000000
--- a/main/php_regex.h
+++ /dev/null
@@ -1,45 +0,0 @@
-#ifndef PHP_REGEX_H
-#define PHP_REGEX_H
-
-/*
- * REGEX means:
- * 0.. system regex
- * 1.. bundled regex
- */
-
-#if REGEX
-/* get aliases */
-#include "regex/regex_extra.h"
-#include "regex/regex.h"
-
-/* get rid of aliases */
-#define PHP_NO_ALIASES
-#include "regex/regex_extra.h"
-#undef PHP_NO_ALIASES
-
-#undef _PCREPOSIX_H
-#define _PCREPOSIX_H 1
-
-#ifndef _REGEX_H
-#define _REGEX_H 1 /* this should stop Apache from loading the system version of regex.h */
-#endif
-#ifndef _REGEX_H_
-#define _REGEX_H_ 1
-#endif
-#ifndef _RX_H
-#define _RX_H 1 /* Try defining these for Linux to */
-#endif
-#ifndef __REGEXP_LIBRARY_H__
-#define __REGEXP_LIBRARY_H__ 1 /* avoid Apache including regex.h */
-#endif
-#ifndef _H_REGEX
-#define _H_REGEX 1 /* This one is for AIX */
-#endif
-#elif REGEX == 0
-#include <regex.h>
-#ifndef _REGEX_H_
-#define _REGEX_H_ 1
-#endif
-#endif
-
-#endif /* PHP_REGEX_H */
diff --git a/main/php_sprintf.c b/main/php_sprintf.c
deleted file mode 100644
index ecbd6b0238..0000000000
--- a/main/php_sprintf.c
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Jaakko Hyvätti <jaakko.hyvatti@iki.fi> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#include <stdio.h>
-#include <stdarg.h>
-#include "php_config.h"
-
-#if PHP_BROKEN_SPRINTF
-
-int
-php_sprintf (char*s, const char* format, ...)
-{
- va_list args;
- char *ret;
-
- va_start (args, format);
- s[0] = '\0';
- ret = vsprintf (s, format, args);
- va_end (args);
- if (!ret)
- return -1;
- return strlen (s);
-}
-
-#endif /* BROKEN_SPRINTF */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/main/php_streams.h b/main/php_streams.h
deleted file mode 100755
index 5083b5ba29..0000000000
--- a/main/php_streams.h
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997, 1998, 1999, 2000, 2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: |
- | Wez Furlong (wez@thebrainroom.com) |
- +----------------------------------------------------------------------+
- */
-
-#ifndef PHP_STREAMS_H
-#define PHP_STREAMS_H
-
-#if HAVE_PHP_STREAM
-
-#ifdef HAVE_SYS_TIME_H
-#include <sys/time.h>
-#endif
-
-/* See README.STREAMS in php4 root dir for more info about this stuff */
-
-typedef struct _php_stream php_stream;
-
-typedef struct _php_stream_ops {
- /* stdio like functions - these are mandatory! */
- size_t (*write)(php_stream * stream, const char * buf, size_t count);
- size_t (*read)(php_stream * stream, char * buf, size_t count);
- int (*close)(php_stream * stream);
- int (*flush)(php_stream * stream);
- /* these are optional */
- int (*seek)(php_stream * stream, off_t offset, int whence);
- char * (*gets)(php_stream * stream, char * buf, size_t size);
- int (*cast)(php_stream * stream, int castas, void ** ret);
- const char * label; /* label for this ops structure */
-} php_stream_ops;
-
-struct _php_stream {
- php_stream_ops * ops;
- void * abstract; /* convenience pointer for abstraction */
- int is_persistent;
- char mode[16]; /* "rwb" etc. ala stdio */
- /* so we know how to clean it up correctly. This should be set to
- * PHP_STREAM_FCLOSE_XXX as appropriate */
- int fclose_stdiocast;
- FILE * stdiocast; /* cache this, otherwise we might leak! */
-}; /* php_stream */
-#define PHP_STREAM_FCLOSE_NONE 0
-#define PHP_STREAM_FCLOSE_FDOPEN 1
-#define PHP_STREAM_FCLOSE_FOPENCOOKIE 2
-
-
-/* allocate a new stream for a particular ops */
-PHPAPI php_stream * php_stream_alloc(php_stream_ops * ops, void * abstract, int persistent, const char * mode);
-
-PHPAPI int php_stream_free(php_stream * stream, int call_dtor);
-#define php_stream_close(stream) php_stream_free(stream, 1)
-
-PHPAPI int php_stream_seek(php_stream * stream, off_t offset, int whence);
-#define php_stream_rewind(stream) php_stream_seek(stream, 0L, SEEK_SET)
-PHPAPI off_t php_stream_tell(php_stream * stream);
-PHPAPI size_t php_stream_read(php_stream * stream, char * buf, size_t count);
-PHPAPI size_t php_stream_write(php_stream * stream, const char * buf, size_t count);
-PHPAPI int php_stream_eof(php_stream * stream);
-PHPAPI int php_stream_getc(php_stream * stream);
-PHPAPI int php_stream_flush(php_stream * stream);
-PHPAPI char *php_stream_gets(php_stream * stream, char *buf, size_t maxlen);
-
-/* operations for a stdio FILE; the FILE * must be placed in stream->abstract */
-extern php_stream_ops php_stream_stdio_ops;
-/* like fopen, but returns a stream */
-PHPAPI php_stream * php_stream_fopen(const char * filename, const char * mode);
-
-/* coerce the stream into some other form */
-/* cast as a stdio FILE * */
-#define PHP_STREAM_AS_STDIO 0
-/* cast as a POSIX fd or socketd */
-#define PHP_STREAM_AS_FD 1
-/* cast as a socketd */
-#define PHP_STREAM_AS_SOCKETD 2
-
-PHPAPI int php_stream_cast(php_stream * stream, int castas, void ** ret, int show_err);
-/* use this to check if a stream can be cast into another form */
-#define php_stream_can_cast(stream, as) php_stream_cast(stream, as, NULL, 0)
-
-/* use this to check if a stream is of a particular type:
- * PHPAPI int php_stream_is(php_stream * stream, php_stream_ops * ops); */
-#define php_stream_is(stream, anops) (stream->ops == anops)
-
-#endif /* HAVE_PHP_STREAM */
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/main/php_syslog.h b/main/php_syslog.h
deleted file mode 100644
index 279da71c92..0000000000
--- a/main/php_syslog.h
+++ /dev/null
@@ -1,32 +0,0 @@
-#ifndef PHP_SYSLOG_H
-#define PHP_SYSLOG_H
-
-#ifdef PHP_WIN32
-#include "win32/syslog.h"
-#else
-#include "php_config.h"
-#ifdef HAVE_SYSLOG_H
-#include <syslog.h>
-#endif
-#endif
-
-/*
- * The SCO OpenServer 5 Development System (not the UDK)
- * defines syslog to std_syslog.
- */
-
-#ifdef syslog
-
-#ifdef HAVE_STD_SYSLOG
-#define php_syslog std_syslog
-#endif
-
-#undef syslog
-
-#endif
-
-#ifndef php_syslog
-#define php_syslog syslog
-#endif
-
-#endif
diff --git a/main/php_ticks.c b/main/php_ticks.c
deleted file mode 100644
index 95e63df322..0000000000
--- a/main/php_ticks.c
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Stig Bakken <ssb@fast.no> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#include "php.h"
-#include "php_ticks.h"
-
-int php_startup_ticks(PLS_D)
-{
- zend_llist_init(&PG(tick_functions), sizeof(void(*)(int)), NULL, 1);
- return SUCCESS;
-}
-
-void php_shutdown_ticks(PLS_D)
-{
- zend_llist_destroy(&PG(tick_functions));
-}
-
-static int php_compare_tick_functions(void *elem1, void *elem2)
-{
- void(*func1)(int);
- void(*func2)(int);
- memcpy(&func1, elem1, sizeof(void(*)(int)));
- memcpy(&func2, elem2, sizeof(void(*)(int)));
- return (func1 == func2);
-}
-
-PHPAPI void php_add_tick_function(void (*func)(int))
-{
- PLS_FETCH();
-
- zend_llist_add_element(&PG(tick_functions), (void *)&func);
-}
-
-PHPAPI void php_remove_tick_function(void (*func)(int))
-{
- PLS_FETCH();
-
- zend_llist_del_element(&PG(tick_functions), func,
- (int(*)(void*,void*))php_compare_tick_functions);
-}
-
-static void php_tick_iterator(void *data, void *arg)
-{
- void (*func)(int);
-
- memcpy(&func, data, sizeof(void(*)(int)));
- func(*((int *)arg));
-}
-
-void php_run_ticks(int count)
-{
- PLS_FETCH();
-
- zend_llist_apply_with_argument(&PG(tick_functions), (void(*)(void*,void*))php_tick_iterator, &count);
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/main/php_ticks.h b/main/php_ticks.h
deleted file mode 100644
index 7259a68d55..0000000000
--- a/main/php_ticks.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Stig Bakken <ssb@fast.no> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef PHP_TICKS_H
-#define PHP_TICKS_H
-
-int php_startup_ticks(PLS_D);
-void php_shutdown_ticks(PLS_D);
-void php_run_ticks(int count);
-PHPAPI void php_add_tick_function(void (*func)(int));
-PHPAPI void php_remove_tick_function(void (*func)(int));
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/main/php_variables.c b/main/php_variables.c
deleted file mode 100644
index bb577fa609..0000000000
--- a/main/php_variables.c
+++ /dev/null
@@ -1,338 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
- */
-/* $Id$ */
-
-#include <stdio.h>
-#include "php.h"
-#include "ext/standard/php_standard.h"
-#include "php_variables.h"
-#include "php_globals.h"
-#include "php_content_types.h"
-#include "SAPI.h"
-
-#include "zend_globals.h"
-
-
-PHPAPI void php_register_variable(char *var, char *strval, zval *track_vars_array ELS_DC PLS_DC) {
- php_register_variable_safe(var, strval, strlen(strval), track_vars_array ELS_CC PLS_CC);
-}
-
-/* binary-safe version */
-PHPAPI void php_register_variable_safe(char *var, char *strval, int str_len, zval *track_vars_array ELS_DC PLS_DC)
-{
- zval new_entry;
-
- /* Prepare value */
- new_entry.value.str.len = str_len;
- if (PG(magic_quotes_gpc)) {
- new_entry.value.str.val = php_addslashes(strval, new_entry.value.str.len, &new_entry.value.str.len, 0);
- } else {
- new_entry.value.str.val = estrndup(strval, new_entry.value.str.len);
- }
- new_entry.type = IS_STRING;
-
- php_register_variable_ex(var, &new_entry, track_vars_array ELS_CC PLS_CC);
-}
-
-
-PHPAPI void php_register_variable_ex(char *var, zval *val, pval *track_vars_array ELS_DC PLS_DC)
-{
- char *p = NULL;
- char *ip; /* index pointer */
- char *index;
- int var_len, index_len;
- zval *gpc_element, **gpc_element_p, **top_gpc_p=NULL;
- zend_bool is_array;
- zend_bool free_index;
- HashTable *symtable1=NULL;
- HashTable *symtable2=NULL;
-
- if (PG(register_globals)) {
- symtable1 = EG(active_symbol_table);
- }
- if (track_vars_array) {
- if (symtable1) {
- symtable2 = track_vars_array->value.ht;
- } else {
- symtable1 = track_vars_array->value.ht;
- }
- }
- if (!symtable1) {
- /* Nothing to do */
- zval_dtor(val);
- return;
- }
-
- /*
- * Prepare variable name
- */
- ip = strchr(var, '[');
- if (ip) {
- is_array = 1;
- *ip = 0;
- } else {
- is_array = 0;
- }
- /* ignore leading spaces in the variable name */
- while (*var && *var==' ') {
- var++;
- }
- var_len = strlen(var);
- if (var_len==0) { /* empty variable name, or variable name with a space in it */
- zval_dtor(val);
- return;
- }
- /* ensure that we don't have spaces or dots in the variable name (not binary safe) */
- for (p=var; *p; p++) {
- switch(*p) {
- case ' ':
- case '.':
- *p='_';
- break;
- }
- }
-
- index = var;
- index_len = var_len;
- free_index = 0;
-
- while (1) {
- if (is_array) {
- char *escaped_index;
-
- if (!index) {
- MAKE_STD_ZVAL(gpc_element);
- array_init(gpc_element);
- zend_hash_next_index_insert(symtable1, &gpc_element, sizeof(zval *), (void **) &gpc_element_p);
- } else {
- if (PG(magic_quotes_gpc) && (index!=var)) {
- /* no need to addslashes() the index if it's the main variable name */
- escaped_index = php_addslashes(index, index_len, &index_len, 0);
- } else {
- escaped_index = index;
- }
- if (zend_hash_find(symtable1, escaped_index, index_len+1, (void **) &gpc_element_p)==FAILURE
- || (*gpc_element_p)->type != IS_ARRAY) {
- MAKE_STD_ZVAL(gpc_element);
- array_init(gpc_element);
- zend_hash_update(symtable1, escaped_index, index_len+1, &gpc_element, sizeof(zval *), (void **) &gpc_element_p);
- }
- if (index!=escaped_index) {
- efree(escaped_index);
- }
- }
- if (!top_gpc_p) {
- top_gpc_p = gpc_element_p;
- }
- symtable1 = (*gpc_element_p)->value.ht;
- /* ip pointed to the '[' character, now obtain the key */
- index = ++ip;
- index_len = 0;
- if (*ip=='\n' || *ip=='\r' || *ip=='\t' || *ip==' ') {
- ip++;
- }
- if (*ip==']') {
- index = NULL;
- } else {
- ip = strchr(ip, ']');
- if (!ip) {
- php_error(E_WARNING, "Missing ] in %s variable", var);
- return;
- }
- *ip = 0;
- index_len = strlen(index);
- }
- ip++;
- if (*ip=='[') {
- is_array = 1;
- *ip = 0;
- } else {
- is_array = 0;
- }
- } else {
- MAKE_STD_ZVAL(gpc_element);
- gpc_element->value = val->value;
- gpc_element->type = val->type;
- if (!index) {
- zend_hash_next_index_insert(symtable1, &gpc_element, sizeof(zval *), (void **) &gpc_element_p);
- } else {
- zend_hash_update(symtable1, index, index_len+1, &gpc_element, sizeof(zval *), (void **) &gpc_element_p);
- }
- if (!top_gpc_p) {
- top_gpc_p = gpc_element_p;
- }
- break;
- }
- }
-
- if (top_gpc_p) {
- if (symtable2) {
- zend_hash_update(symtable2, var, var_len+1, top_gpc_p, sizeof(zval *), NULL);
- (*top_gpc_p)->refcount++;
- }
- }
-}
-
-
-SAPI_POST_HANDLER_FUNC(php_std_post_handler)
-{
- char *var, *val;
- char *strtok_buf = NULL;
- zval *array_ptr = (zval *) arg;
- ELS_FETCH();
- PLS_FETCH();
-
- var = php_strtok_r(SG(request_info).post_data, "&", &strtok_buf);
-
- while (var) {
- val = strchr(var, '=');
- if (val) { /* have a value */
- int val_len;
-
- *val++ = '\0';
- php_url_decode(var, strlen(var));
- val_len = php_url_decode(val, strlen(val));
- php_register_variable_safe(var, val, val_len, array_ptr ELS_CC PLS_CC);
- }
- var = php_strtok_r(NULL, "&", &strtok_buf);
- }
-}
-
-
-void php_treat_data(int arg, char *str, zval* destArray ELS_DC PLS_DC SLS_DC)
-{
- char *res = NULL, *var, *val, *separator=NULL;
- const char *c_var;
- pval *array_ptr;
- int free_buffer=0;
- char *strtok_buf = NULL;
-
- switch (arg) {
- case PARSE_POST:
- case PARSE_GET:
- case PARSE_COOKIE:
- ALLOC_ZVAL(array_ptr);
- array_init(array_ptr);
- INIT_PZVAL(array_ptr);
- switch (arg) {
- case PARSE_POST:
- PG(http_globals)[TRACK_VARS_POST] = array_ptr;
- break;
- case PARSE_GET:
- PG(http_globals)[TRACK_VARS_GET] = array_ptr;
- break;
- case PARSE_COOKIE:
- PG(http_globals)[TRACK_VARS_COOKIE] = array_ptr;
- break;
- }
- break;
- default:
- array_ptr=destArray;
- break;
- }
-
- if (arg==PARSE_POST) {
- sapi_handle_post(array_ptr SLS_CC);
- return;
- }
-
- if (arg == PARSE_GET) { /* GET data */
- c_var = SG(request_info).query_string;
- if (c_var && *c_var) {
- res = (char *) estrdup(c_var);
- free_buffer = 1;
- } else {
- free_buffer = 0;
- }
- } else if (arg == PARSE_COOKIE) { /* Cookie data */
- c_var = SG(request_info).cookie_data;
- if (c_var && *c_var) {
- res = (char *) estrdup(c_var);
- free_buffer = 1;
- } else {
- free_buffer = 0;
- }
- } else if (arg == PARSE_STRING) { /* String data */
- res = str;
- free_buffer = 1;
- }
-
- if (!res) {
- return;
- }
-
- switch (arg) {
- case PARSE_GET:
- case PARSE_STRING:
- separator = (char *) estrdup(PG(arg_separator).input);
- break;
- case PARSE_COOKIE:
- separator = ";\0";
- break;
- }
-
- var = php_strtok_r(res, separator, &strtok_buf);
-
- while (var) {
- val = strchr(var, '=');
- if (val) { /* have a value */
- int val_len;
-
- *val++ = '\0';
- php_url_decode(var, strlen(var));
- val_len = php_url_decode(val, strlen(val));
- php_register_variable_safe(var, val, val_len, array_ptr ELS_CC PLS_CC);
- }
- var = php_strtok_r(NULL, separator, &strtok_buf);
- }
-
- if(arg != PARSE_COOKIE) {
- efree(separator);
- }
-
- if (free_buffer) {
- efree(res);
- }
-}
-
-
-void php_import_environment_variables(zval *array_ptr ELS_DC PLS_DC)
-{
- char **env, *p, *t;
-
- for (env = environ; env != NULL && *env != NULL; env++) {
- p = strchr(*env, '=');
- if (!p) { /* malformed entry? */
- continue;
- }
- t = estrndup(*env, p - *env);
- php_register_variable(t, p+1, array_ptr ELS_CC PLS_CC);
- efree(t);
- }
-}
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/main/php_variables.h b/main/php_variables.h
deleted file mode 100644
index 55c139341c..0000000000
--- a/main/php_variables.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef PHP_VARIABLES_H
-#define PHP_VARIABLES_H
-
-#include "php.h"
-#include "SAPI.h"
-
-#define PARSE_POST 0
-#define PARSE_GET 1
-#define PARSE_COOKIE 2
-#define PARSE_STRING 3
-
-void php_treat_data(int arg, char *str, zval* destArray ELS_DC PLS_DC SLS_DC);
-PHPAPI void php_import_environment_variables(zval *array_ptr ELS_DC PLS_DC);
-PHPAPI void php_register_variable(char *var, char *val, pval *track_vars_array ELS_DC PLS_DC);
-/* binary-safe version */
-PHPAPI void php_register_variable_safe(char *var, char *val, int val_len, pval *track_vars_array ELS_DC PLS_DC);
-PHPAPI void php_register_variable_ex(char *var, zval *val, pval *track_vars_array ELS_DC PLS_DC);
-
-
-#endif /* PHP_VARIABLES_H */
diff --git a/main/php_version.h b/main/php_version.h
deleted file mode 100644
index cd8c544248..0000000000
--- a/main/php_version.h
+++ /dev/null
@@ -1,3 +0,0 @@
-/* automatically generated by configure */
-/* edit configure.in to change version number */
-#define PHP_VERSION "4.0.7-dev"
diff --git a/main/reentrancy.c b/main/reentrancy.c
deleted file mode 100644
index 80d169baed..0000000000
--- a/main/reentrancy.c
+++ /dev/null
@@ -1,441 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Sascha Schumann <sascha@schumann.cx> |
- +----------------------------------------------------------------------+
- */
-
-
-#include <sys/types.h>
-#include <string.h>
-#include <errno.h>
-#ifdef HAVE_DIRENT_H
-#include <dirent.h>
-#endif
-
-#ifdef PHP_WIN32
-#include "win32/readdir.h"
-#endif
-
-#include "php_reentrancy.h"
-#include "ext/standard/php_rand.h" /* for RAND_MAX */
-
-enum {
- LOCALTIME_R,
- CTIME_R,
- ASCTIME_R,
- GMTIME_R,
- READDIR_R,
- NUMBER_OF_LOCKS
-};
-
-#if defined(PHP_NEED_REENTRANCY)
-
-#include <TSRM.h>
-
-static MUTEX_T reentrant_locks[NUMBER_OF_LOCKS];
-
-#define local_lock(x) tsrm_mutex_lock(reentrant_locks[x])
-#define local_unlock(x) tsrm_mutex_unlock(reentrant_locks[x])
-
-#else
-
-#define local_lock(x)
-#define local_unlock(x)
-
-#endif
-
-#if defined(PHP_IRIX_TIME_R)
-
-#define HAVE_CTIME_R 1
-#define HAVE_ASCTIME_R 1
-
-PHPAPI char *php_ctime_r(const time_t *clock, char *buf)
-{
- if (ctime_r(clock, buf, 26) == buf)
- return (buf);
- return (NULL);
-}
-
-PHPAPI char *php_asctime_r(const struct tm *tm, char *buf)
-{
- if (asctime_r(tm, buf, 26) == buf)
- return (buf);
- return (NULL);
-}
-
-#endif
-
-#if defined(PHP_HPUX_TIME_R)
-
-#define HAVE_LOCALTIME_R 1
-#define HAVE_CTIME_R 1
-#define HAVE_ASCTIME_R 1
-#define HAVE_GMTIME_R 1
-
-PHPAPI struct tm *php_localtime_r(const time_t *const timep, struct tm *p_tm)
-{
- if (localtime_r(timep, p_tm) == 0)
- return (p_tm);
- return (NULL);
-}
-
-PHPAPI char *php_ctime_r(const time_t *clock, char *buf)
-{
- if (ctime_r(clock, buf, 26) != -1)
- return (buf);
- return (NULL);
-}
-
-PHPAPI char *php_asctime_r(const struct tm *tm, char *buf)
-{
- if (asctime_r(tm, buf, 26) != -1)
- return (buf);
- return (NULL);
-}
-
-PHPAPI struct tm *php_gmtime_r(const time_t *const timep, struct tm *p_tm)
-{
- if (gmtime_r(timep, p_tm) == 0)
- return (p_tm);
- return (NULL);
-}
-
-#endif
-
-#if !defined(HAVE_POSIX_READDIR_R)
-
-PHPAPI int php_readdir_r(DIR *dirp, struct dirent *entry,
- struct dirent **result)
-{
-#if defined(HAVE_OLD_READDIR_R)
- int ret = 0;
-
- /* We cannot rely on the return value of readdir_r
- as it differs between various platforms
- (HPUX returns 0 on success whereas Solaris returns non-zero)
- */
- entry->d_name[0] = '\0';
- readdir_r(dirp, entry);
-
- if (entry->d_name[0] == '\0') {
- *result = NULL;
- ret = errno;
- } else {
- *result = entry;
- }
- return ret;
-#else
- struct dirent *ptr;
- int ret = 0;
-
- local_lock(READDIR_R);
-
- errno = 0;
-
- ptr = readdir(dirp);
-
- if (!ptr && errno != 0)
- ret = errno;
-
- if (ptr)
- memcpy(entry, ptr, sizeof(*ptr));
-
- *result = ptr;
-
- local_unlock(READDIR_R);
-
- return ret;
-#endif
-}
-
-#endif
-
-#if !defined(HAVE_LOCALTIME_R) && defined(HAVE_LOCALTIME)
-
-PHPAPI struct tm *php_localtime_r(const time_t *const timep, struct tm *p_tm)
-{
- struct tm *tmp;
-
- local_lock(LOCALTIME_R);
-
- tmp = localtime(timep);
- if (tmp) {
- memcpy(p_tm, tmp, sizeof(struct tm));
- tmp = p_tm;
- }
-
- local_unlock(LOCALTIME_R);
-
- return tmp;
-}
-
-#endif
-
-#if !defined(HAVE_CTIME_R) && defined(HAVE_CTIME)
-
-PHPAPI char *php_ctime_r(const time_t *clock, char *buf)
-{
- char *tmp;
-
- local_lock(CTIME_R);
-
- tmp = ctime(clock);
- strcpy(buf, tmp);
-
- local_unlock(CTIME_R);
-
- return buf;
-}
-
-#endif
-
-#if !defined(HAVE_ASCTIME_R) && defined(HAVE_ASCTIME)
-
-PHPAPI char *php_asctime_r(const struct tm *tm, char *buf)
-{
- char *tmp;
-
- local_lock(ASCTIME_R);
-
- tmp = asctime(tm);
- strcpy(buf, tmp);
-
- local_unlock(ASCTIME_R);
-
- return buf;
-}
-
-#endif
-
-#if !defined(HAVE_GMTIME_R) && defined(HAVE_GMTIME)
-
-PHPAPI struct tm *php_gmtime_r(const time_t *const timep, struct tm *p_tm)
-{
- struct tm *tmp;
-
- local_lock(GMTIME_R);
-
- tmp = gmtime(timep);
- if (tmp) {
- memcpy(p_tm, tmp, sizeof(struct tm));
- tmp = p_tm;
- }
-
- local_unlock(GMTIME_R);
-
- return tmp;
-}
-
-#endif
-
-#if defined(PHP_NEED_REENTRANCY)
-
-void reentrancy_startup(void)
-{
- int i;
-
- for (i = 0; i < NUMBER_OF_LOCKS; i++) {
- reentrant_locks[i] = tsrm_mutex_alloc();
- }
-}
-
-void reentrancy_shutdown(void)
-{
- int i;
-
- for (i = 0; i < NUMBER_OF_LOCKS; i++) {
- tsrm_mutex_free(reentrant_locks[i]);
- }
-}
-
-#endif
-
-#ifndef HAVE_RAND_R
-
-/*-
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * Posix rand_r function added May 1999 by Wes Peters <wes@softweyr.com>.
- */
-
-#include <sys/types.h>
-#include <stdlib.h>
-
-static int
-do_rand(unsigned long *ctx)
-{
- return ((*ctx = *ctx * 1103515245 + 12345) % ((u_long)RAND_MAX + 1));
-}
-
-
-PHPAPI int
-php_rand_r(unsigned int *ctx)
-{
- u_long val = (u_long) *ctx;
- *ctx = do_rand(&val);
- return (int) *ctx;
-}
-
-#endif
-
-
-#ifndef HAVE_STRTOK_R
-
-/*
- * Copyright (c) 1998 Softweyr LLC. All rights reserved.
- *
- * strtok_r, from Berkeley strtok
- * Oct 13, 1998 by Wes Peters <wes@softweyr.com>
- *
- * Copyright (c) 1988, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notices, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notices, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- *
- * This product includes software developed by Softweyr LLC, the
- * University of California, Berkeley, and its contributors.
- *
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY SOFTWEYR LLC, THE REGENTS AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
- * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SOFTWEYR LLC, THE
- * REGENTS, OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
- * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <stddef.h>
-
-PHPAPI char *
-php_strtok_r(char *s, const char *delim, char **last)
-{
- char *spanp;
- int c, sc;
- char *tok;
-
- if (s == NULL && (s = *last) == NULL)
- {
- return NULL;
- }
-
- /*
- * Skip (span) leading delimiters (s += strspn(s, delim), sort of).
- */
-cont:
- c = *s++;
- for (spanp = (char *)delim; (sc = *spanp++) != 0; )
- {
- if (c == sc)
- {
- goto cont;
- }
- }
-
- if (c == 0) /* no non-delimiter characters */
- {
- *last = NULL;
- return NULL;
- }
- tok = s - 1;
-
- /*
- * Scan token (scan for delimiters: s += strcspn(s, delim), sort of).
- * Note that delim must have one NUL; we stop if we see that, too.
- */
- for (;;)
- {
- c = *s++;
- spanp = (char *)delim;
- do
- {
- if ((sc = *spanp++) == c)
- {
- if (c == 0)
- {
- s = NULL;
- }
- else
- {
- char *w = s - 1;
- *w = '\0';
- }
- *last = s;
- return tok;
- }
- }
- while (sc != 0);
- }
- /* NOTREACHED */
-}
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/main/rfc1867.c b/main/rfc1867.c
deleted file mode 100644
index d7a90fa792..0000000000
--- a/main/rfc1867.c
+++ /dev/null
@@ -1,484 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Rasmus Lerdorf <rasmus@php.net> |
- +----------------------------------------------------------------------+
- */
-/* $Id$ */
-
-#include <stdio.h>
-#include "php.h"
-#include "php_open_temporary_file.h"
-#include "zend_globals.h"
-#include "php_globals.h"
-#include "php_variables.h"
-#include "rfc1867.h"
-#include "ext/standard/type.h"
-
-
-#define NEW_BOUNDARY_CHECK 1
-#define SAFE_RETURN { if (namebuf) efree(namebuf); if (filenamebuf) efree(filenamebuf); if (lbuf) efree(lbuf); if (abuf) efree(abuf); if(arr_index) efree(arr_index); zend_hash_destroy(&PG(rfc1867_protected_variables)); return; }
-
-/* The longest property name we use in an uploaded file array */
-#define MAX_SIZE_OF_INDEX sizeof("[tmp_name]")
-
-static void add_protected_variable(char *varname PLS_DC)
-{
- int dummy=1;
-
- zend_hash_add(&PG(rfc1867_protected_variables), varname, strlen(varname)+1, &dummy, sizeof(int), NULL);
-}
-
-
-static zend_bool is_protected_variable(char *varname PLS_DC)
-{
- return zend_hash_exists(&PG(rfc1867_protected_variables), varname, strlen(varname)+1);
-}
-
-
-static void safe_php_register_variable(char *var, char *strval, zval *track_vars_array, zend_bool override_protection ELS_DC PLS_DC)
-{
- if (override_protection || !is_protected_variable(var PLS_CC)) {
- php_register_variable(var, strval, track_vars_array ELS_CC PLS_CC);
- }
-}
-
-
-static void safe_php_register_variable_ex(char *var, zval *val, pval *track_vars_array, zend_bool override_protection ELS_DC PLS_DC)
-{
- if (override_protection || !is_protected_variable(var PLS_CC)) {
- php_register_variable_ex(var, val, track_vars_array ELS_CC PLS_CC);
- }
-}
-
-
-static void register_http_post_files_variable(char *strvar, char *val, zval *http_post_files, zend_bool override_protection ELS_DC PLS_DC)
-{
- int register_globals = PG(register_globals);
-
- PG(register_globals) = 0;
- safe_php_register_variable(strvar, val, http_post_files, override_protection ELS_CC PLS_CC);
- PG(register_globals) = register_globals;
-}
-
-
-static void register_http_post_files_variable_ex(char *var, zval *val, zval *http_post_files, zend_bool override_protection ELS_DC PLS_DC)
-{
- int register_globals = PG(register_globals);
-
- PG(register_globals) = 0;
- safe_php_register_variable_ex(var, val, http_post_files, override_protection ELS_CC PLS_CC);
- PG(register_globals) = register_globals;
-}
-
-
-static int unlink_filename(char **filename)
-{
- VCWD_UNLINK(*filename);
- return 0;
-}
-
-
-void destroy_uploaded_files_hash(SLS_D)
-{
- zend_hash_apply(SG(rfc1867_uploaded_files), (apply_func_t) unlink_filename);
- zend_hash_destroy(SG(rfc1867_uploaded_files));
- FREE_HASHTABLE(SG(rfc1867_uploaded_files));
-}
-
-/*
- * Split raw mime stream up into appropriate components
- */
-static void php_mime_split(char *buf, int cnt, char *boundary, zval *array_ptr SLS_DC PLS_DC)
-{
- char *ptr, *loc, *loc2, *loc3, *s, *name, *filename, *u, *temp_filename;
- int len, state = 0, Done = 0, rem, urem;
- int eolsize;
- long bytes, max_file_size = 0;
- char *namebuf=NULL, *filenamebuf=NULL, *lbuf=NULL,
- *abuf=NULL, *start_arr=NULL, *end_arr=NULL, *arr_index=NULL;
- FILE *fp;
- int itype, is_arr_upload=0, arr_len=0;
- zval *http_post_files=NULL;
- zend_bool upload_successful;
- zend_bool magic_quotes_gpc;
- ELS_FETCH();
-
- zend_hash_init(&PG(rfc1867_protected_variables), 5, NULL, NULL, 0);
-
- ALLOC_HASHTABLE(SG(rfc1867_uploaded_files));
- zend_hash_init(SG(rfc1867_uploaded_files), 5, NULL, (dtor_func_t) free_estring, 0);
-
- ALLOC_ZVAL(http_post_files);
- array_init(http_post_files);
- INIT_PZVAL(http_post_files);
- PG(http_globals)[TRACK_VARS_FILES] = http_post_files;
-
- ptr = buf;
- rem = cnt;
- len = strlen(boundary);
- while ((ptr - buf < cnt) && !Done) {
- switch (state) {
- case 0: /* Looking for mime boundary */
- loc = memchr(ptr, *boundary, cnt);
- if (loc) {
- if (!strncmp(loc, boundary, len)) {
-
- state = 1;
-
- eolsize = 2;
- if(*(loc+len)==0x0a) {
- eolsize = 1;
- }
-
- rem -= (loc - ptr) + len + eolsize;
- ptr = loc + len + eolsize;
- } else {
- rem -= (loc - ptr) + 1;
- ptr = loc + 1;
- }
- } else {
- Done = 1;
- }
- break;
- case 1: /* Check content-disposition */
- while (strncasecmp(ptr, "Content-Disposition: form-data;", 31)) {
- if (rem < 31) {
- SAFE_RETURN;
- }
- if (ptr[1] == '\n') {
- /* empty line as end of header found */
- php_error(E_WARNING, "File Upload Mime headers garbled ptr: [%c%c%c%c%c]", *ptr, *(ptr + 1), *(ptr + 2), *(ptr + 3), *(ptr + 4));
- SAFE_RETURN;
- }
- /* some other headerfield found, skip it */
- loc = (char *) memchr(ptr, '\n', rem)+1;
- while (*loc == ' ' || *loc == '\t')
- /* other field is folded, skip it */
- loc = (char *) memchr(loc, '\n', rem-(loc-ptr))+1;
- rem -= (loc - ptr);
- ptr = loc;
- }
- loc = memchr(ptr, '\n', rem);
- while (loc[1] == ' ' || loc[1] == '\t')
- /* field is folded, look for end */
- loc = memchr(loc+1, '\n', rem-(loc-ptr)-1);
- name = strstr(ptr, " name=");
- if (name && name < loc) {
- name += 6;
- if ( *name == '\"' ) {
- name++;
- s = memchr(name, '\"', loc - name);
- if(!s) {
- php_error(E_WARNING, "File Upload Mime headers garbled name: [%c%c%c%c%c]", *name, *(name + 1), *(name + 2), *(name + 3), *(name + 4));
- SAFE_RETURN;
- }
- } else {
- s = strpbrk(name, " \t()<>@,;:\\\"/[]?=\r\n");
- }
- if (namebuf) {
- efree(namebuf);
- }
- namebuf = estrndup(name, s-name);
- if (lbuf) {
- efree(lbuf);
- }
- lbuf = emalloc(s-name + MAX_SIZE_OF_INDEX + 1);
- state = 2;
- loc2 = loc;
- while (loc2[2] != '\n') {
- /* empty line as end of header not yet found */
- loc2 = memchr(loc2 + 1, '\n', rem-(loc2-ptr)-1);
- }
- rem -= (loc2 - ptr) + 3;
- ptr = loc2 + 3;
- /* is_arr_upload is true when name of file upload field
- * ends in [.*]
- * start_arr is set to point to 1st [
- * end_arr points to last ]
- */
- is_arr_upload = (start_arr = strchr(namebuf,'[')) &&
- (end_arr = strrchr(namebuf,']')) &&
- (end_arr = namebuf+strlen(namebuf)-1);
- if(is_arr_upload) {
- arr_len = strlen(start_arr);
- if(arr_index) efree(arr_index);
- arr_index = estrndup(start_arr+1,arr_len-2);
- }
- } else {
- php_error(E_WARNING, "File upload error - no name component in content disposition");
- SAFE_RETURN;
- }
- filename = strstr(s, "filename=\"");
- if (filename && filename < loc) {
- filename += 10;
- s = memchr(filename, '\"', loc - filename);
- if (!s) {
- php_error(E_WARNING, "File Upload Mime headers garbled filename: [%c%c%c%c%c]", *filename, *(filename + 1), *(filename + 2), *(filename + 3), *(filename + 4));
- SAFE_RETURN;
- }
- if (filenamebuf) {
- efree(filenamebuf);
- }
- filenamebuf = estrndup(filename, s-filename);
-
- /* Add $foo_name */
- if (is_arr_upload) {
- if (abuf) {
- efree(abuf);
- }
- abuf = estrndup(namebuf, strlen(namebuf)-arr_len);
- sprintf(lbuf, "%s_name[%s]", abuf, arr_index);
- } else {
- sprintf(lbuf, "%s_name", namebuf);
- }
- s = strrchr(filenamebuf, '\\');
- if (s && s > filenamebuf) {
- safe_php_register_variable(lbuf, s+1, NULL, 0 ELS_CC PLS_CC);
- } else {
- safe_php_register_variable(lbuf, filenamebuf, NULL, 0 ELS_CC PLS_CC);
- }
-
- /* Add $foo[name] */
- if (is_arr_upload) {
- sprintf(lbuf, "%s[name][%s]", abuf, arr_index);
- } else {
- sprintf(lbuf, "%s[name]", namebuf);
- }
- if (s && s > filenamebuf) {
- register_http_post_files_variable(lbuf, s+1, http_post_files, 0 ELS_CC PLS_CC);
- } else {
- register_http_post_files_variable(lbuf, filenamebuf, http_post_files, 0 ELS_CC PLS_CC);
- }
-
- state = 3;
- s = "";
- if ((loc2 - loc) > 2) {
- if (!strncasecmp(loc + 1, "Content-Type:", 13)) {
- *(loc2 - 1) = '\0';
- s = loc+15;
- }
- loc3=memchr(loc2+1, '\n', rem-1);
- if (loc3==NULL) {
- php_error(E_WARNING, "File Upload Mime headers garbled header3: [%c%c%c%c%c]", *loc2, *(loc2 + 1), *(loc2 + 2), *(loc2 + 3), *(loc2 + 4));
- SAFE_RETURN;
- }
- if (loc3 - loc2 > 2) { /* we have a third header */
- rem -= (ptr-loc3)+3;
- ptr = loc3+3;
- } else {
- rem -= (ptr-loc3)+1;
- ptr = loc3+1;
- }
- }
-
- /* Add $foo_type */
- if (is_arr_upload) {
- sprintf(lbuf, "%s_type[%s]", abuf, arr_index);
- } else {
- sprintf(lbuf, "%s_type", namebuf);
- }
- safe_php_register_variable(lbuf, s, NULL, 0 ELS_CC PLS_CC);
-
- /* Add $foo[type] */
- if (is_arr_upload) {
- sprintf(lbuf, "%s[type][%s]", abuf, arr_index);
- } else {
- sprintf(lbuf, "%s[type]", namebuf);
- }
- register_http_post_files_variable(lbuf, s, http_post_files, 0 ELS_CC PLS_CC);
- if(*s != '\0') {
- *(loc2 - 1) = '\n';
- }
- }
- break;
-
- case 2: /* handle form-data fields */
- loc = memchr(ptr, *boundary, rem);
- u = ptr;
- while (loc) {
- if (!strncmp(loc, boundary, len))
- break;
- u = loc + 1;
- urem = rem - (loc - ptr) - 1;
- loc = memchr(u, *boundary, urem);
- }
- if (!loc) {
- php_error(E_WARNING, "File Upload Field Data garbled");
- SAFE_RETURN;
- }
- *(loc - 4) = '\0';
-
- /* Check to make sure we are not overwriting special file
- * upload variables */
- safe_php_register_variable(namebuf, ptr, array_ptr, 0 ELS_CC PLS_CC);
-
- /* And a little kludge to pick out special MAX_FILE_SIZE */
- itype = php_check_ident_type(namebuf);
- if (itype) {
- u = strchr(namebuf, '[');
- if (u)
- *u = '\0';
- }
- if (!strcmp(namebuf, "MAX_FILE_SIZE")) {
- max_file_size = atol(ptr);
- }
- if (itype) {
- if (u)
- *u = '[';
- }
- rem -= (loc - ptr);
- ptr = loc;
- state = 0;
- break;
-
- case 3: /* Handle file */
- loc = memchr(ptr, *boundary, rem);
- u = ptr;
- while (loc) {
- if (!strncmp(loc, boundary, len)
-#if NEW_BOUNDARY_CHECK
- && (loc-2>buf && *(loc-2)=='-' && *(loc-1)=='-') /* ensure boundary is prefixed with -- */
- && (loc-2==buf || *(loc-3)=='\n') /* ensure beginning of line */
-#endif
- ) {
- break;
- }
- u = loc + 1;
- urem = rem - (loc - ptr) - 1;
- loc = memchr(u, *boundary, urem);
- }
- if (!loc) {
- php_error(E_WARNING, "File Upload Error - No Mime boundary found after start of file header");
- SAFE_RETURN;
- }
- bytes = 0;
-
- fp = php_open_temporary_file(PG(upload_tmp_dir), "php", &temp_filename);
- if (!fp) {
- php_error(E_WARNING, "File upload error - unable to create a temporary file");
- SAFE_RETURN;
- }
- if ((loc - ptr - 4) > PG(upload_max_filesize)) {
- php_error(E_WARNING, "Max file size of %ld bytes exceeded - file [%s] not saved", PG(upload_max_filesize),namebuf);
- upload_successful = 0;
- } else if (max_file_size && ((loc - ptr - 4) > max_file_size)) {
- php_error(E_WARNING, "Max file size exceeded - file [%s] not saved", namebuf);
- upload_successful = 0;
- } else if ((loc - ptr - 4) <= 0) {
- upload_successful = 0;
- } else {
- bytes = fwrite(ptr, 1, loc - ptr - 4, fp);
- if (bytes < (loc - ptr - 4)) {
- php_error(E_WARNING, "Only %d bytes were written, expected to write %ld", bytes, loc - ptr - 4);
- }
- upload_successful = 1;
- }
- fclose(fp);
- add_protected_variable(namebuf PLS_CC);
- if (!upload_successful) {
- if(temp_filename) {
- unlink(temp_filename);
- efree(temp_filename);
- }
- temp_filename = "none";
- } else {
- zend_hash_add(SG(rfc1867_uploaded_files), temp_filename, strlen(temp_filename)+1, &temp_filename, sizeof(char *), NULL);
- }
-
- magic_quotes_gpc = PG(magic_quotes_gpc);
- PG(magic_quotes_gpc) = 0;
- safe_php_register_variable(namebuf, temp_filename, NULL, 1 ELS_CC PLS_CC);
- /* Add $foo[tmp_name] */
- if(is_arr_upload) {
- sprintf(lbuf, "%s[tmp_name][%s]", abuf, arr_index);
- } else {
- sprintf(lbuf, "%s[tmp_name]", namebuf);
- }
- add_protected_variable(lbuf PLS_CC);
- register_http_post_files_variable(lbuf, temp_filename, http_post_files, 1 ELS_CC PLS_CC);
- PG(magic_quotes_gpc) = magic_quotes_gpc;
-
- {
- zval file_size;
-
- file_size.value.lval = bytes;
- file_size.type = IS_LONG;
-
- /* Add $foo_size */
- if(is_arr_upload) {
- sprintf(lbuf, "%s_size[%s]", abuf, arr_index);
- } else {
- sprintf(lbuf, "%s_size", namebuf);
- }
- safe_php_register_variable_ex(lbuf, &file_size, NULL, 0 ELS_CC PLS_CC);
-
- /* Add $foo[size] */
- if(is_arr_upload) {
- sprintf(lbuf, "%s[size][%s]", abuf, arr_index);
- } else {
- sprintf(lbuf, "%s[size]", namebuf);
- }
- register_http_post_files_variable_ex(lbuf, &file_size, http_post_files, 0 ELS_CC PLS_CC);
- }
- state = 0;
- rem -= (loc - ptr);
- ptr = loc;
- break;
- }
- }
- SAFE_RETURN;
-}
-
-
-SAPI_POST_HANDLER_FUNC(rfc1867_post_handler)
-{
- char *boundary;
- uint boundary_len;
- zval *array_ptr = (zval *) arg;
- PLS_FETCH();
-
- if (!PG(file_uploads)) {
- php_error(E_WARNING, "File uploads are disabled");
- return;
- }
-
- boundary = strstr(content_type_dup, "boundary");
- if (!boundary || !(boundary=strchr(boundary, '='))) {
- sapi_module.sapi_error(E_COMPILE_ERROR, "Missing boundary in multipart/form-data POST data");
- return;
- }
- boundary++;
- boundary_len = strlen(boundary);
-
- if (boundary[0] == '"' && boundary[boundary_len-1] == '"') {
- boundary++;
- boundary_len -= 2;
- boundary[boundary_len] = '\0';
- }
-
- if (SG(request_info).post_data) {
- php_mime_split(SG(request_info).post_data, SG(request_info).post_data_length, boundary, array_ptr SLS_CC PLS_CC);
- }
-}
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/main/rfc1867.h b/main/rfc1867.h
deleted file mode 100644
index 1bcba038ea..0000000000
--- a/main/rfc1867.h
+++ /dev/null
@@ -1,15 +0,0 @@
-#ifndef RFC1867_H
-#define RFC1867_H
-
-#include "SAPI.h"
-
-#define MULTIPART_CONTENT_TYPE "multipart/form-data"
-
-SAPI_POST_READER_FUNC(rfc1867_post_reader);
-SAPI_POST_HANDLER_FUNC(rfc1867_post_handler);
-
-#define FILE_UPLOAD_INPUT_BUFFER_SIZE 8192
-
-void destroy_uploaded_files_hash(SLS_D);
-
-#endif /* RFC1867_H */
diff --git a/main/safe_mode.c b/main/safe_mode.c
deleted file mode 100644
index f14f7df0fa..0000000000
--- a/main/safe_mode.c
+++ /dev/null
@@ -1,174 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
- +----------------------------------------------------------------------+
- */
-/* $Id$ */
-
-#include "php.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#if HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#include <sys/stat.h>
-#include "ext/standard/pageinfo.h"
-#include "safe_mode.h"
-#include "SAPI.h"
-
-
-/*
- * php_checkuid
- *
- * This function has four modes:
- *
- * 0 - return invalid (0) if file does not exist
- * 1 - return valid (1) if file does not exist
- * 2 - if file does not exist, check directory
- * 3 - only check directory (needed for mkdir)
- */
-
-PHPAPI int php_checkuid(const char *filename, char *fopen_mode, int mode)
-{
- struct stat sb;
- int ret;
- long uid=0L, duid=0L;
- char *s;
-
- if (!filename) {
- return 0; /* path must be provided */
- }
-
- if (fopen_mode) {
- if (fopen_mode[0] == 'r') {
- mode = CHECKUID_DISALLOW_FILE_NOT_EXISTS;
- } else {
- mode = CHECKUID_CHECK_FILE_AND_DIR;
- }
- }
-
- /*
- * If given filepath is a URL, allow - safe mode stuff
- * related to URL's is checked in individual functions
- */
- if (!strncasecmp(filename,"http://",7) || !strncasecmp(filename,"ftp://",6)) {
- return 1;
- }
-
- if (mode != CHECKUID_ALLOW_ONLY_DIR) {
- ret = VCWD_STAT(filename, &sb);
- if (ret < 0) {
- if (mode == CHECKUID_DISALLOW_FILE_NOT_EXISTS) {
- php_error(E_WARNING, "Unable to access %s", filename);
- return 0;
- } else if (mode == CHECKUID_ALLOW_FILE_NOT_EXISTS)
- php_error(E_WARNING, "Unable to access %s", filename);{
- return 1;
- }
- } else {
- uid = sb.st_uid;
- if (uid == php_getuid()) {
- return 1;
- }
- }
- }
- s = strrchr(filename,'/');
-
- /* This loop gets rid of trailing slashes which could otherwise be
- * used to confuse the function.
- */
- while(s && *(s+1)=='\0' && s>filename) {
- *s='\0';
- s = strrchr(filename,'/');
- }
-
- if (s) {
- *s='\0';
- ret = VCWD_STAT(filename, &sb);
- *s='/';
- if (ret < 0) {
- php_error(E_WARNING, "Unable to access %s", filename);
- return 0;
- }
- duid = sb.st_uid;
- } else {
- char cwd[MAXPATHLEN];
- if (!VCWD_GETCWD(cwd, MAXPATHLEN)) {
- php_error(E_WARNING, "Unable to access current working directory");
- return 0;
- }
- ret = VCWD_STAT(cwd, &sb);
- if (ret < 0) {
- php_error(E_WARNING, "Unable to access %s", cwd);
- return 0;
- }
- duid = sb.st_uid;
- }
- if (duid == (uid=php_getuid())) {
- return 1;
- } else {
- SLS_FETCH();
-
- if (SG(rfc1867_uploaded_files)) {
- if (zend_hash_exists(SG(rfc1867_uploaded_files), (char *) filename, strlen(filename)+1)) {
- return 1;
- }
- }
-
- php_error(E_WARNING, "SAFE MODE Restriction in effect. The script whose uid is %ld is not allowed to access %s owned by uid %ld", uid, filename, duid);
- return 0;
- }
-}
-
-
-PHPAPI char *php_get_current_user()
-{
- struct passwd *pwd;
- struct stat *pstat;
- SLS_FETCH();
-
- if (SG(request_info).current_user) {
- return SG(request_info).current_user;
- }
-
- /* FIXME: I need to have this somehow handled if
- USE_SAPI is defined, because cgi will also be
- interfaced in USE_SAPI */
-
- pstat = sapi_get_stat();
-
- if (!pstat) {
- return empty_string;
- }
-
- if ((pwd=getpwuid(pstat->st_uid))==NULL) {
- return empty_string;
- }
- SG(request_info).current_user_length = strlen(pwd->pw_name);
- SG(request_info).current_user = estrndup(pwd->pw_name, SG(request_info).current_user_length);
-
- return SG(request_info).current_user;
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/main/safe_mode.h b/main/safe_mode.h
deleted file mode 100644
index 9f012689f4..0000000000
--- a/main/safe_mode.h
+++ /dev/null
@@ -1,14 +0,0 @@
-#ifndef SAFE_MODE_H
-#define SAFE_MODE_H
-
-/* mode's for php_checkuid() */
-#define CHECKUID_DISALLOW_FILE_NOT_EXISTS 0
-#define CHECKUID_ALLOW_FILE_NOT_EXISTS 1
-#define CHECKUID_CHECK_FILE_AND_DIR 2
-#define CHECKUID_ALLOW_ONLY_DIR 3
-#define CHECKUID_CHECK_MODE_PARAM 4
-
-extern PHPAPI int php_checkuid(const char *filename, char *fopen_mode, int mode);
-extern PHPAPI char *php_get_current_user(void);
-
-#endif
diff --git a/main/snprintf.c b/main/snprintf.c
deleted file mode 100644
index 5fe1860d86..0000000000
--- a/main/snprintf.c
+++ /dev/null
@@ -1,949 +0,0 @@
-/* ====================================================================
- * Copyright (c) 1995-1998 The Apache Group. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. All advertising materials mentioning features or use of this
- * software must display the following acknowledgment:
- * "This product includes software developed by the Apache Group
- * for use in the Apache HTTP server project (http://www.apache.org/)."
- *
- * 4. The names "Apache Server" and "Apache Group" must not be used to
- * endorse or promote products derived from this software without
- * prior written permission.
- *
- * 5. Redistributions of any form whatsoever must retain the following
- * acknowledgment:
- * "This product includes software developed by the Apache Group
- * for use in the Apache HTTP server project (http://www.apache.org/)."
- *
- * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY
- * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Group and was originally based
- * on public domain software written at the National Center for
- * Supercomputing Applications, University of Illinois, Urbana-Champaign.
- * For more information on the Apache Group and the Apache HTTP server
- * project, please see <http://www.apache.org/>.
- *
- * This code is based on, and used with the permission of, the
- * SIO stdio-replacement strx_* functions by Panos Tsirigotis
- * <panos@alumni.cs.colorado.edu> for xinetd.
- */
-
-#include "php.h"
-
-#if !defined(HAVE_SNPRINTF) || !defined(HAVE_VSNPRINTF) || defined(BROKEN_SNPRINTF) || defined(BROKEN_VSNPRINTF)
-
-#include <stdio.h>
-#include <ctype.h>
-#include <sys/types.h>
-#include <stdarg.h>
-#include <string.h>
-#include <stdlib.h>
-#include <math.h>
-
-
-#ifdef HAVE_GCVT
-
-#define ap_php_ecvt ecvt
-#define ap_php_fcvt fcvt
-#define ap_php_gcvt gcvt
-
-#else
-
-/*
- * cvt.c - IEEE floating point formatting routines for FreeBSD
- * from GNU libc-4.6.27
- */
-
-/*
- * ap_php_ecvt converts to decimal
- * the number of digits is specified by ndigit
- * decpt is set to the position of the decimal point
- * sign is set to 0 for positive, 1 for negative
- */
-
-#define NDIG 80
-
-static char *
- ap_php_cvt(double arg, int ndigits, int *decpt, int *sign, int eflag)
-{
- register int r2;
- double fi, fj;
- register char *p, *p1;
- static char buf[NDIG];
-
- if (ndigits >= NDIG - 1)
- ndigits = NDIG - 2;
- r2 = 0;
- *sign = 0;
- p = &buf[0];
- if (arg < 0) {
- *sign = 1;
- arg = -arg;
- }
- arg = modf(arg, &fi);
- p1 = &buf[NDIG];
- /*
- * Do integer part
- */
- if (fi != 0) {
- p1 = &buf[NDIG];
- while (p1 > &buf[0] && fi != 0) {
- fj = modf(fi / 10, &fi);
- *--p1 = (int) ((fj + .03) * 10) + '0';
- r2++;
- }
- while (p1 < &buf[NDIG])
- *p++ = *p1++;
- } else if (arg > 0) {
- while ((fj = arg * 10) < 1) {
- arg = fj;
- r2--;
- }
- }
- p1 = &buf[ndigits];
- if (eflag == 0)
- p1 += r2;
- *decpt = r2;
- if (p1 < &buf[0]) {
- buf[0] = '\0';
- return (buf);
- }
- while (p <= p1 && p < &buf[NDIG]) {
- arg *= 10;
- arg = modf(arg, &fj);
- *p++ = (int) fj + '0';
- }
- if (p1 >= &buf[NDIG]) {
- buf[NDIG - 1] = '\0';
- return (buf);
- }
- p = p1;
- *p1 += 5;
- while (*p1 > '9') {
- *p1 = '0';
- if (p1 > buf)
- ++ * --p1;
- else {
- *p1 = '1';
- (*decpt)++;
- if (eflag == 0) {
- if (p > buf)
- *p = '0';
- p++;
- }
- }
- }
- *p = '\0';
- return (buf);
-}
-
-static char *
- ap_php_ecvt(double arg, int ndigits, int *decpt, int *sign)
-{
- return (ap_php_cvt(arg, ndigits, decpt, sign, 1));
-}
-
-static char *
- ap_php_fcvt(double arg, int ndigits, int *decpt, int *sign)
-{
- return (ap_php_cvt(arg, ndigits, decpt, sign, 0));
-}
-
-/*
- * ap_php_gcvt - Floating output conversion to
- * minimal length string
- */
-
-static char *
- ap_php_gcvt(double number, int ndigit, char *buf)
-{
- int sign, decpt;
- register char *p1, *p2;
- register i;
-
- p1 = ap_php_ecvt(number, ndigit, &decpt, &sign);
- p2 = buf;
- if (sign)
- *p2++ = '-';
- for (i = ndigit - 1; i > 0 && p1[i] == '0'; i--)
- ndigit--;
- if ((decpt >= 0 && decpt - ndigit > 4)
- || (decpt < 0 && decpt < -3)) { /* use E-style */
- decpt--;
- *p2++ = *p1++;
- *p2++ = '.';
- for (i = 1; i < ndigit; i++)
- *p2++ = *p1++;
- *p2++ = 'e';
- if (decpt < 0) {
- decpt = -decpt;
- *p2++ = '-';
- } else
- *p2++ = '+';
- if (decpt / 100 > 0)
- *p2++ = decpt / 100 + '0';
- if (decpt / 10 > 0)
- *p2++ = (decpt % 100) / 10 + '0';
- *p2++ = decpt % 10 + '0';
- } else {
- if (decpt <= 0) {
- if (*p1 != '0')
- *p2++ = '.';
- while (decpt < 0) {
- decpt++;
- *p2++ = '0';
- }
- }
- for (i = 1; i <= ndigit; i++) {
- *p2++ = *p1++;
- if (i == decpt)
- *p2++ = '.';
- }
- if (ndigit < decpt) {
- while (ndigit++ < decpt)
- *p2++ = '0';
- *p2++ = '.';
- }
- }
- if (p2[-1] == '.')
- p2--;
- *p2 = '\0';
- return (buf);
-}
-
-#endif /* HAVE_CVT */
-
-typedef enum {
- NO = 0, YES = 1
-} boolean_e;
-
-#define FALSE 0
-#define TRUE 1
-#define NUL '\0'
-#define INT_NULL ((int *)0)
-#define WIDE_INT long
-
-typedef WIDE_INT wide_int;
-typedef unsigned WIDE_INT u_wide_int;
-typedef int bool_int;
-
-#define S_NULL "(null)"
-#define S_NULL_LEN 6
-
-#define FLOAT_DIGITS 6
-#define EXPONENT_LENGTH 10
-
-/*
- * NUM_BUF_SIZE is the size of the buffer used for arithmetic conversions
- *
- * XXX: this is a magic number; do not decrease it
- */
-#define NUM_BUF_SIZE 512
-
-
-/*
- * Descriptor for buffer area
- */
-struct buf_area {
- char *buf_end;
- char *nextb; /* pointer to next byte to read/write */
-};
-
-typedef struct buf_area buffy;
-
-/*
- * The INS_CHAR macro inserts a character in the buffer and writes
- * the buffer back to disk if necessary
- * It uses the char pointers sp and bep:
- * sp points to the next available character in the buffer
- * bep points to the end-of-buffer+1
- * While using this macro, note that the nextb pointer is NOT updated.
- *
- * NOTE: Evaluation of the c argument should not have any side-effects
- */
-#define INS_CHAR( c, sp, bep, cc ) \
- { \
- if ( sp < bep ) \
- { \
- *sp++ = c ; \
- cc++ ; \
- } \
- }
-
-#define NUM( c ) ( c - '0' )
-
-#define STR_TO_DEC( str, num ) \
- num = NUM( *str++ ) ; \
- while ( isdigit((int)*str ) ) \
- { \
- num *= 10 ; \
- num += NUM( *str++ ) ; \
- }
-
-/*
- * This macro does zero padding so that the precision
- * requirement is satisfied. The padding is done by
- * adding '0's to the left of the string that is going
- * to be printed.
- */
-#define FIX_PRECISION( adjust, precision, s, s_len ) \
- if ( adjust ) \
- while ( s_len < precision ) \
- { \
- *--s = '0' ; \
- s_len++ ; \
- }
-
-/*
- * Macro that does padding. The padding is done by printing
- * the character ch.
- */
-#define PAD( width, len, ch ) do \
- { \
- INS_CHAR( ch, sp, bep, cc ) ; \
- width-- ; \
- } \
- while ( width > len )
-
-/*
- * Prefix the character ch to the string str
- * Increase length
- * Set the has_prefix flag
- */
-#define PREFIX( str, length, ch ) *--str = ch ; length++ ; has_prefix = YES
-
-
-/*
- * Convert num to its decimal format.
- * Return value:
- * - a pointer to a string containing the number (no sign)
- * - len contains the length of the string
- * - is_negative is set to TRUE or FALSE depending on the sign
- * of the number (always set to FALSE if is_unsigned is TRUE)
- *
- * The caller provides a buffer for the string: that is the buf_end argument
- * which is a pointer to the END of the buffer + 1 (i.e. if the buffer
- * is declared as buf[ 100 ], buf_end should be &buf[ 100 ])
- */
-static char *
- conv_10(register wide_int num, register bool_int is_unsigned,
- register bool_int * is_negative, char *buf_end, register int *len)
-{
- register char *p = buf_end;
- register u_wide_int magnitude;
-
- if (is_unsigned) {
- magnitude = (u_wide_int) num;
- *is_negative = FALSE;
- } else {
- *is_negative = (num < 0);
-
- /*
- * On a 2's complement machine, negating the most negative integer
- * results in a number that cannot be represented as a signed integer.
- * Here is what we do to obtain the number's magnitude:
- * a. add 1 to the number
- * b. negate it (becomes positive)
- * c. convert it to unsigned
- * d. add 1
- */
- if (*is_negative) {
- wide_int t = num + 1;
-
- magnitude = ((u_wide_int) - t) + 1;
- } else
- magnitude = (u_wide_int) num;
- }
-
- /*
- * We use a do-while loop so that we write at least 1 digit
- */
- do {
- register u_wide_int new_magnitude = magnitude / 10;
-
- *--p = magnitude - new_magnitude * 10 + '0';
- magnitude = new_magnitude;
- }
- while (magnitude);
-
- *len = buf_end - p;
- return (p);
-}
-
-
-
-/*
- * Convert a floating point number to a string formats 'f', 'e' or 'E'.
- * The result is placed in buf, and len denotes the length of the string
- * The sign is returned in the is_negative argument (and is not placed
- * in buf).
- */
-static char *
- conv_fp(register char format, register double num,
- boolean_e add_dp, int precision, bool_int * is_negative, char *buf, int *len)
-{
- register char *s = buf;
- register char *p;
- int decimal_point;
-
- if (format == 'f')
- p = ap_php_fcvt(num, precision, &decimal_point, is_negative);
- else /* either e or E format */
- p = ap_php_ecvt(num, precision + 1, &decimal_point, is_negative);
-
- /*
- * Check for Infinity and NaN
- */
- if (isalpha((int)*p)) {
- *len = strlen(strcpy(buf, p));
- *is_negative = FALSE;
- return (buf);
- }
- if (format == 'f') {
- if (decimal_point <= 0) {
- *s++ = '0';
- if (precision > 0) {
- *s++ = '.';
- while (decimal_point++ < 0)
- *s++ = '0';
- } else if (add_dp) {
- *s++ = '.';
- }
- } else {
- while (decimal_point-- > 0) {
- *s++ = *p++;
- }
- if (precision > 0 || add_dp) {
- *s++ = '.';
- }
- }
- } else {
- *s++ = *p++;
- if (precision > 0 || add_dp)
- *s++ = '.';
- }
-
- /*
- * copy the rest of p, the NUL is NOT copied
- */
- while (*p)
- *s++ = *p++;
-
- if (format != 'f') {
- char temp[EXPONENT_LENGTH]; /* for exponent conversion */
- int t_len;
- bool_int exponent_is_negative;
-
- *s++ = format; /* either e or E */
- decimal_point--;
- if (decimal_point != 0) {
- p = conv_10((wide_int) decimal_point, FALSE, &exponent_is_negative,
- &temp[EXPONENT_LENGTH], &t_len);
- *s++ = exponent_is_negative ? '-' : '+';
-
- /*
- * Make sure the exponent has at least 2 digits
- */
- if (t_len == 1)
- *s++ = '0';
- while (t_len--)
- *s++ = *p++;
- } else {
- *s++ = '+';
- *s++ = '0';
- *s++ = '0';
- }
- }
- *len = s - buf;
- return (buf);
-}
-
-
-/*
- * Convert num to a base X number where X is a power of 2. nbits determines X.
- * For example, if nbits is 3, we do base 8 conversion
- * Return value:
- * a pointer to a string containing the number
- *
- * The caller provides a buffer for the string: that is the buf_end argument
- * which is a pointer to the END of the buffer + 1 (i.e. if the buffer
- * is declared as buf[ 100 ], buf_end should be &buf[ 100 ])
- */
-static char *
- conv_p2(register u_wide_int num, register int nbits,
- char format, char *buf_end, register int *len)
-{
- register int mask = (1 << nbits) - 1;
- register char *p = buf_end;
- static char low_digits[] = "0123456789abcdef";
- static char upper_digits[] = "0123456789ABCDEF";
- register char *digits = (format == 'X') ? upper_digits : low_digits;
-
- do {
- *--p = digits[num & mask];
- num >>= nbits;
- }
- while (num);
-
- *len = buf_end - p;
- return (p);
-}
-
-
-/*
- * Do format conversion placing the output in buffer
- */
-static int format_converter(register buffy * odp, const char *fmt,
- va_list ap)
-{
- register char *sp;
- register char *bep;
- register int cc = 0;
- register int i;
-
- register char *s = NULL;
- char *q;
- int s_len;
-
- register int min_width = 0;
- int precision = 0;
- enum {
- LEFT, RIGHT
- } adjust;
- char pad_char;
- char prefix_char;
-
- double fp_num;
- wide_int i_num = (wide_int) 0;
- u_wide_int ui_num;
-
- char num_buf[NUM_BUF_SIZE];
- char char_buf[2]; /* for printing %% and %<unknown> */
-
- /*
- * Flag variables
- */
- boolean_e is_long;
- boolean_e alternate_form;
- boolean_e print_sign;
- boolean_e print_blank;
- boolean_e adjust_precision;
- boolean_e adjust_width;
- bool_int is_negative;
-
- sp = odp->nextb;
- bep = odp->buf_end;
-
- while (*fmt) {
- if (*fmt != '%') {
- INS_CHAR(*fmt, sp, bep, cc);
- } else {
- /*
- * Default variable settings
- */
- adjust = RIGHT;
- alternate_form = print_sign = print_blank = NO;
- pad_char = ' ';
- prefix_char = NUL;
-
- fmt++;
-
- /*
- * Try to avoid checking for flags, width or precision
- */
- if (isascii((int)*fmt) && !islower((int)*fmt)) {
- /*
- * Recognize flags: -, #, BLANK, +
- */
- for (;; fmt++) {
- if (*fmt == '-')
- adjust = LEFT;
- else if (*fmt == '+')
- print_sign = YES;
- else if (*fmt == '#')
- alternate_form = YES;
- else if (*fmt == ' ')
- print_blank = YES;
- else if (*fmt == '0')
- pad_char = '0';
- else
- break;
- }
-
- /*
- * Check if a width was specified
- */
- if (isdigit((int)*fmt)) {
- STR_TO_DEC(fmt, min_width);
- adjust_width = YES;
- } else if (*fmt == '*') {
- min_width = va_arg(ap, int);
- fmt++;
- adjust_width = YES;
- if (min_width < 0) {
- adjust = LEFT;
- min_width = -min_width;
- }
- } else
- adjust_width = NO;
-
- /*
- * Check if a precision was specified
- *
- * XXX: an unreasonable amount of precision may be specified
- * resulting in overflow of num_buf. Currently we
- * ignore this possibility.
- */
- if (*fmt == '.') {
- adjust_precision = YES;
- fmt++;
- if (isdigit((int)*fmt)) {
- STR_TO_DEC(fmt, precision);
- } else if (*fmt == '*') {
- precision = va_arg(ap, int);
- fmt++;
- if (precision < 0)
- precision = 0;
- } else
- precision = 0;
- } else
- adjust_precision = NO;
- } else
- adjust_precision = adjust_width = NO;
-
- /*
- * Modifier check
- */
- if (*fmt == 'l') {
- is_long = YES;
- fmt++;
- } else
- is_long = NO;
-
- /*
- * Argument extraction and printing.
- * First we determine the argument type.
- * Then, we convert the argument to a string.
- * On exit from the switch, s points to the string that
- * must be printed, s_len has the length of the string
- * The precision requirements, if any, are reflected in s_len.
- *
- * NOTE: pad_char may be set to '0' because of the 0 flag.
- * It is reset to ' ' by non-numeric formats
- */
- switch (*fmt) {
- case 'u':
- if (is_long)
- i_num = va_arg(ap, u_wide_int);
- else
- i_num = (wide_int) va_arg(ap, unsigned int);
- /*
- * The rest also applies to other integer formats, so fall
- * into that case.
- */
- case 'd':
- case 'i':
- /*
- * Get the arg if we haven't already.
- */
- if ((*fmt) != 'u') {
- if (is_long)
- i_num = va_arg(ap, wide_int);
- else
- i_num = (wide_int) va_arg(ap, int);
- };
- s = conv_10(i_num, (*fmt) == 'u', &is_negative,
- &num_buf[NUM_BUF_SIZE], &s_len);
- FIX_PRECISION(adjust_precision, precision, s, s_len);
-
- if (*fmt != 'u') {
- if (is_negative)
- prefix_char = '-';
- else if (print_sign)
- prefix_char = '+';
- else if (print_blank)
- prefix_char = ' ';
- }
- break;
-
-
- case 'o':
- if (is_long)
- ui_num = va_arg(ap, u_wide_int);
- else
- ui_num = (u_wide_int) va_arg(ap, unsigned int);
- s = conv_p2(ui_num, 3, *fmt,
- &num_buf[NUM_BUF_SIZE], &s_len);
- FIX_PRECISION(adjust_precision, precision, s, s_len);
- if (alternate_form && *s != '0') {
- *--s = '0';
- s_len++;
- }
- break;
-
-
- case 'x':
- case 'X':
- if (is_long)
- ui_num = (u_wide_int) va_arg(ap, u_wide_int);
- else
- ui_num = (u_wide_int) va_arg(ap, unsigned int);
- s = conv_p2(ui_num, 4, *fmt,
- &num_buf[NUM_BUF_SIZE], &s_len);
- FIX_PRECISION(adjust_precision, precision, s, s_len);
- if (alternate_form && i_num != 0) {
- *--s = *fmt; /* 'x' or 'X' */
- *--s = '0';
- s_len += 2;
- }
- break;
-
-
- case 's':
- s = va_arg(ap, char *);
- if (s != NULL) {
- s_len = strlen(s);
- if (adjust_precision && precision < s_len)
- s_len = precision;
- } else {
- s = S_NULL;
- s_len = S_NULL_LEN;
- }
- pad_char = ' ';
- break;
-
-
- case 'f':
- case 'e':
- case 'E':
- fp_num = va_arg(ap, double);
-
- if (zend_isnan(fp_num)) {
- s = "nan";
- s_len = 3;
- } else if (zend_isinf(fp_num)) {
- s = "inf";
- s_len = 3;
- } else {
- s = conv_fp(*fmt, fp_num, alternate_form,
- (adjust_precision == NO) ? FLOAT_DIGITS : precision,
- &is_negative, &num_buf[1], &s_len);
- if (is_negative)
- prefix_char = '-';
- else if (print_sign)
- prefix_char = '+';
- else if (print_blank)
- prefix_char = ' ';
- }
- break;
-
-
- case 'g':
- case 'G':
- if (adjust_precision == NO)
- precision = FLOAT_DIGITS;
- else if (precision == 0)
- precision = 1;
- /*
- * * We use &num_buf[ 1 ], so that we have room for the sign
- */
- s = ap_php_gcvt(va_arg(ap, double), precision, &num_buf[1]);
- if (*s == '-')
- prefix_char = *s++;
- else if (print_sign)
- prefix_char = '+';
- else if (print_blank)
- prefix_char = ' ';
-
- s_len = strlen(s);
-
- if (alternate_form && (q = strchr(s, '.')) == NULL)
- s[s_len++] = '.';
- if (*fmt == 'G' && (q = strchr(s, 'e')) != NULL)
- *q = 'E';
- break;
-
-
- case 'c':
- char_buf[0] = (char) (va_arg(ap, int));
- s = &char_buf[0];
- s_len = 1;
- pad_char = ' ';
- break;
-
-
- case '%':
- char_buf[0] = '%';
- s = &char_buf[0];
- s_len = 1;
- pad_char = ' ';
- break;
-
-
- case 'n':
- *(va_arg(ap, int *)) = cc;
- break;
-
- /*
- * Always extract the argument as a "char *" pointer. We
- * should be using "void *" but there are still machines
- * that don't understand it.
- * If the pointer size is equal to the size of an unsigned
- * integer we convert the pointer to a hex number, otherwise
- * we print "%p" to indicate that we don't handle "%p".
- */
- case 'p':
- ui_num = (u_wide_int) va_arg(ap, char *);
-
- if (sizeof(char *) <= sizeof(u_wide_int))
- s = conv_p2(ui_num, 4, 'x',
- &num_buf[NUM_BUF_SIZE], &s_len);
- else {
- s = "%p";
- s_len = 2;
- }
- pad_char = ' ';
- break;
-
-
- case NUL:
- /*
- * The last character of the format string was %.
- * We ignore it.
- */
- continue;
-
-
- /*
- * The default case is for unrecognized %'s.
- * We print %<char> to help the user identify what
- * option is not understood.
- * This is also useful in case the user wants to pass
- * the output of format_converter to another function
- * that understands some other %<char> (like syslog).
- * Note that we can't point s inside fmt because the
- * unknown <char> could be preceded by width etc.
- */
- default:
- char_buf[0] = '%';
- char_buf[1] = *fmt;
- s = char_buf;
- s_len = 2;
- pad_char = ' ';
- break;
- }
-
- if (prefix_char != NUL) {
- *--s = prefix_char;
- s_len++;
- }
- if (adjust_width && adjust == RIGHT && min_width > s_len) {
- if (pad_char == '0' && prefix_char != NUL) {
- INS_CHAR(*s, sp, bep, cc)
- s++;
- s_len--;
- min_width--;
- }
- PAD(min_width, s_len, pad_char);
- }
- /*
- * Print the string s.
- */
- for (i = s_len; i != 0; i--) {
- INS_CHAR(*s, sp, bep, cc);
- s++;
- }
-
- if (adjust_width && adjust == LEFT && min_width > s_len)
- PAD(min_width, s_len, pad_char);
- }
- fmt++;
- }
- odp->nextb = sp;
- return (cc);
-}
-
-
-/*
- * This is the general purpose conversion function.
- */
-static void strx_printv(int *ccp, char *buf, size_t len, const char *format,
- va_list ap)
-{
- buffy od;
- int cc;
-
- /*
- * First initialize the descriptor
- * Notice that if no length is given, we initialize buf_end to the
- * highest possible address.
- */
- od.buf_end = len ? &buf[len] : (char *) ~0;
- od.nextb = buf;
-
- /*
- * Do the conversion
- */
- cc = format_converter(&od, format, ap);
- if (len == 0 || od.nextb <= od.buf_end)
- *(od.nextb) = '\0';
- if (ccp)
- *ccp = cc;
-}
-
-
-int ap_php_snprintf(char *buf, size_t len, const char *format,...)
-{
- int cc;
- va_list ap;
-
- va_start(ap, format);
- strx_printv(&cc, buf, (len - 1), format, ap);
- va_end(ap);
- return (cc);
-}
-
-
-int ap_php_vsnprintf(char *buf, size_t len, const char *format, va_list ap)
-{
- int cc;
-
- strx_printv(&cc, buf, (len - 1), format, ap);
- return (cc);
-}
-
-#endif /* HAVE_SNPRINTF */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/main/snprintf.h b/main/snprintf.h
deleted file mode 100644
index 3f9bb98503..0000000000
--- a/main/snprintf.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Stig Sæther Bakken <ssb@guardian.no> |
- +----------------------------------------------------------------------+
- */
-
-#ifndef SNPRINTF_H
-#define SNPRINTF_H
-
-#if !defined(HAVE_SNPRINTF) || defined(BROKEN_SNPRINTF)
-extern int ap_php_snprintf(char *, size_t, const char *, ...);
-#define snprintf ap_php_snprintf
-#endif
-
-#if !defined(HAVE_VSNPRINTF) || defined(BROKEN_VSNPRINTF)
-extern int ap_php_vsnprintf(char *, size_t, const char *, va_list ap);
-#define vsnprintf ap_php_vsnprintf
-#endif
-
-#if PHP_BROKEN_SPRINTF
-int php_sprintf (char* s, const char* format, ...);
-#define sprintf php_sprintf
-#endif
-
-#endif /* SNPRINTF_H */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/main/streams.c b/main/streams.c
deleted file mode 100755
index 6b3cd0f472..0000000000
--- a/main/streams.c
+++ /dev/null
@@ -1,360 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997, 1998, 1999, 2000, 2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: |
- | Wez Furlong (wez@thebrainroom.com) |
- +----------------------------------------------------------------------+
- */
-
-#define _GNU_SOURCE
-#include "php.h"
-
-#if HAVE_PHP_STREAM
-
-#ifdef PHP_WIN32
-#define EWOULDBLOCK WSAEWOULDBLOCK
-#else
-#include "build-defs.h"
-#endif
-
-#define MAX_CHUNK_SIZE 8192
-
-#define TOREAD(stream) ((stream)->readbuf.writepos - (stream)->readbuf.readpos)
-#define TOWRITE(stream) ((stream)->readbuf.writepos - (stream)->readbuf.readpos)
-
-#define READPTR(stream) ((stream)->readbuf.buffer + (stream)->readbuf.readpos)
-#define WRITEPTR(stream) ((stream)->readbuf.buffer + (stream)->readbuf.writepos)
-
-#define READ_MAX(stream, max) if (stream->is_blocked) stream_read_total(sock, max); else stream_readahead(sock)
-
-/* allocate a new stream for a particular ops */
-PHPAPI php_stream * php_stream_alloc(php_stream_ops * ops, void * abstract, int persistent, const char * mode)
-{
- php_stream * ret;
-
- ret = (php_stream*)pemalloc(sizeof(php_stream), persistent);
-
- memset(ret, 0, sizeof(php_stream));
-
- ret->ops = ops;
- ret->abstract = abstract;
- ret->is_persistent = persistent;
-
- strncpy(ret->mode, mode, sizeof(ret->mode));
-
- return ret;
-}
-
-PHPAPI int php_stream_free(php_stream * stream, int call_dtor)
-{
- int ret = 1;
-
- if (call_dtor) {
-
- if (stream->fclose_stdiocast == PHP_STREAM_FCLOSE_FOPENCOOKIE) {
- /* calling fclose on an fopencookied stream will ultimately
- call this very same function. If we were called via fclose,
- the cookie_closer unsets the fclose_stdiocast flags, so
- we can be sure that we only reach here when PHP code calls
- php_stream_free.
- Lets let the cookie code clean it all up.
- */
- return fclose(stream->stdiocast);
- }
-
- php_stream_flush(stream);
- ret = stream->ops->close(stream);
-
- /* tidy up any FILE* that might have been fdopened */
- if (stream->fclose_stdiocast == PHP_STREAM_FCLOSE_FDOPEN && stream->stdiocast)
- {
- fclose(stream->stdiocast);
- stream->stdiocast = NULL;
- }
- }
- pefree(stream, stream->is_persistent);
-
- return ret;
-}
-
-PHPAPI size_t php_stream_read(php_stream * stream, char * buf, size_t size)
-{
- return stream->ops->read(stream, buf, size);
-}
-
-PHPAPI int php_stream_eof(php_stream * stream)
-{
- /* we define our stream reading function so that it
- must return EOF when an EOF condition occurs, when
- working in unbuffered mode and called with these args */
- return stream->ops->read(stream, NULL, 0) == EOF ? 1 : 0;
-}
-
-PHPAPI int php_stream_getc(php_stream * stream)
-{
- char buf;
-
- if (php_stream_read(stream, &buf, 1) > 0)
- return buf;
- return EOF;
-}
-
-PHPAPI char *php_stream_gets(php_stream * stream, char *buf, size_t maxlen)
-{
-
- if (maxlen == 0) {
- buf[0] = 0;
- return buf;
- }
-
- if (stream->ops->gets) {
- return stream->ops->gets(stream, buf, maxlen);
- }
- else {
- /* unbuffered fgets - poor performance ! */
- size_t n = 0;
- char * c = buf;
-
- /* TODO: look at error returns? */
-
- while(n < maxlen && stream->ops->read(stream, c, 1) > 0) {
- n++;
- if (*c == '\n') {
- c++;
- break;
- }
- c++;
- }
- *c = 0;
- return buf;
- }
-}
-
-PHPAPI int php_stream_flush(php_stream * stream)
-{
- return stream->ops->flush(stream);
-}
-
-PHPAPI size_t php_stream_write(php_stream * stream, const char * buf, size_t count)
-{
- if (strchr(stream->mode, 'w') == NULL) {
- zend_error(E_WARNING, "%s(): stream was not opened for writing", get_active_function_name());
- return 0;
- }
-
- return stream->ops->write(stream, buf, count);
-}
-
-PHPAPI off_t php_stream_tell(php_stream * stream)
-{
- off_t ret = -1;
- if (stream->ops->seek) {
- ret = stream->ops->seek(stream, 0, SEEK_CUR);
- }
- return ret;
-}
-
-PHPAPI int php_stream_seek(php_stream * stream, off_t offset, int whence)
-{
- if (stream->ops->seek)
- return stream->ops->seek(stream, offset, whence);
-
- zend_error(E_WARNING, "streams of type %s do not support seeking", stream->ops->label);
- return -1;
-}
-
-/*------- STDIO stream implementation -------*/
-
-static size_t php_stdiop_write(php_stream * stream, const char * buf, size_t count)
-{
- return fwrite(buf, 1, count, (FILE*)stream->abstract);
-}
-
-static size_t php_stdiop_read(php_stream * stream, char * buf, size_t count)
-{
- if (buf == NULL && count == 0) {
- /* check for EOF condition */
- if (feof((FILE*)stream->abstract)) {
- return EOF;
- }
- return 0;
- }
- return fread(buf, 1, count, (FILE*)stream->abstract);
-}
-
-static int php_stdiop_close(php_stream * stream)
-{
- return fclose((FILE*)stream->abstract);
-}
-
-static int php_stdiop_flush(php_stream * stream)
-{
- return fflush((FILE*)stream->abstract);
-}
-
-static int php_stdiop_seek(php_stream * stream, off_t offset, int whence)
-{
- return fseek((FILE*)stream->abstract, offset, whence);
-}
-
-static char * php_stdiop_gets(php_stream * stream, char * buf, size_t size)
-{
- return fgets(buf, size, (FILE*)stream->abstract);
-}
-static int php_stdiop_cast(php_stream * stream, int castas, void ** ret)
-{
- int fd;
-
- switch (castas) {
- case PHP_STREAM_AS_STDIO:
- if (ret)
- *ret = stream->abstract;
- return SUCCESS;
-
- case PHP_STREAM_AS_FD:
- fd = fileno((FILE*)stream->abstract);
- if (fd < 0)
- return FAILURE;
- if (ret)
- *ret = (void*)fd;
- return SUCCESS;
- default:
- return FAILURE;
- }
-}
-
-php_stream_ops php_stream_stdio_ops = {
- php_stdiop_write, php_stdiop_read,
- php_stdiop_close, php_stdiop_flush, php_stdiop_seek,
- php_stdiop_gets, php_stdiop_cast,
- "STDIO"
-};
-
-PHPAPI php_stream * php_stream_fopen(const char * filename, const char * mode)
-{
- FILE * fp = fopen(filename, mode);
-
- if (fp) {
- php_stream * ret = php_stream_alloc(&php_stream_stdio_ops, fp, 0, mode);
-
- if (ret)
- return ret;
-
- fclose(fp);
- }
- return NULL;
-}
-
-#if HAVE_FOPENCOOKIE
-static ssize_t stream_cookie_reader(void *cookie, char *buffer, size_t size)
-{
- return php_stream_read(((php_stream *)cookie), buffer, size);
-}
-
-static ssize_t stream_cookie_writer(void *cookie, const char *buffer, size_t size) {
- return php_stream_write(((php_stream *)cookie), (char *)buffer, size);
-}
-
-static int stream_cookie_seeker(void *cookie, off_t position, int whence) {
- return php_stream_seek(((php_stream *)cookie), position, whence);
-}
-
-static int stream_cookie_closer(void *cookie) {
- php_stream * stream = (php_stream*)cookie;
- /* prevent recursion */
- stream->fclose_stdiocast = PHP_STREAM_FCLOSE_NONE;
- return php_stream_close(stream);
-}
-
-static COOKIE_IO_FUNCTIONS_T stream_cookie_functions =
-{
- stream_cookie_reader, stream_cookie_writer,
- stream_cookie_seeker, stream_cookie_closer
-};
-#else
-/* TODO: use socketpair() to emulate fopecookie, as suggested by Hartmut ? */
-#endif
-
-PHPAPI int php_stream_cast(php_stream * stream, int castas, void ** ret, int show_err)
-{
- if (castas == PHP_STREAM_AS_STDIO) {
- if (stream->stdiocast) {
- if (ret)
- *ret = stream->stdiocast;
- return SUCCESS;
- }
-
- if (stream->ops->cast && stream->ops->cast(stream, castas, ret) == SUCCESS)
- goto exit_success;
-
-
-#if HAVE_FOPENCOOKIE
- /* if just checking, say yes we can be a FILE*, but don't actually create it yet */
- if (ret == NULL)
- goto exit_success;
-
- *ret = fopencookie(stream, stream->mode, stream_cookie_functions);
-
- if (*ret != NULL) {
- stream->fclose_stdiocast = 1;
- goto exit_success;
- }
-
- /* must be either:
- a) programmer error
- b) no memory
- -> lets bail
- */
- zend_error(E_ERROR, "%s(): fopencookie failed", get_active_function_name());
- return FAILURE;
-#endif
-
- goto exit_fail;
- }
- if (stream->ops->cast && stream->ops->cast(stream, castas, ret) == SUCCESS)
- goto exit_success;
-
-
-exit_fail:
- if (show_err) {
- /* these names depend on the values of the PHP_STREAM_AS_XXX defines in php_streams.h */
- static const char * cast_names[3] = {
- "STDIO FILE*", "File Descriptor", "Socket Descriptor"
- };
- zend_error(E_WARNING, "%s(): cannot represent a stream of type %s as a %s",
- get_active_function_name(),
- stream->ops->label,
- cast_names[castas]
- );
- }
-
- return FAILURE;
-
-exit_success:
- if (castas == PHP_STREAM_AS_STDIO && ret)
- stream->stdiocast = *ret;
-
- return SUCCESS;
-
-}
-
-#endif
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/main/strlcat.c b/main/strlcat.c
deleted file mode 100644
index e6bc017cc0..0000000000
--- a/main/strlcat.c
+++ /dev/null
@@ -1,86 +0,0 @@
-#include "php.h"
-
-#ifndef HAVE_STRLCAT
-
-/* $OpenBSD: strlcat.c,v 1.2 1999/06/17 16:28:58 millert Exp $ */
-
-/*
- * Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
- * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
- * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char *rcsid = "$OpenBSD: strlcat.c,v 1.2 1999/06/17 16:28:58 millert Exp $";
-#endif /* LIBC_SCCS and not lint */
-
-#include <sys/types.h>
-#include <string.h>
-
-/*
- * Appends src to string dst of size siz (unlike strncat, siz is the
- * full size of dst, not space left). At most siz-1 characters
- * will be copied. Always NUL terminates (unless siz == 0).
- * Returns strlen(src); if retval >= siz, truncation occurred.
- */
-PHPAPI size_t php_strlcat(dst, src, siz)
- char *dst;
- const char *src;
- size_t siz;
-{
- register char *d = dst;
- register const char *s = src;
- register size_t n = siz;
- size_t dlen;
-
- /* Find the end of dst and adjust bytes left but don't go past end */
- while (*d != '\0' && n-- != 0)
- d++;
- dlen = d - dst;
- n = siz - dlen;
-
- if (n == 0)
- return(dlen + strlen(s));
- while (*s != '\0') {
- if (n != 1) {
- *d++ = *s;
- n--;
- }
- s++;
- }
- *d = '\0';
-
- return(dlen + (s - src)); /* count does not include NUL */
-}
-
-#endif /* !HAVE_STRLCAT */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/main/strlcpy.c b/main/strlcpy.c
deleted file mode 100644
index 9c1f4da01d..0000000000
--- a/main/strlcpy.c
+++ /dev/null
@@ -1,83 +0,0 @@
-#include "php.h"
-
-#ifndef HAVE_STRLCPY
-
-/* $OpenBSD: strlcpy.c,v 1.4 1999/05/01 18:56:41 millert Exp $ */
-
-/*
- * Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
- * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
- * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char *rcsid = "$OpenBSD: strlcpy.c,v 1.4 1999/05/01 18:56:41 millert Exp $";
-#endif /* LIBC_SCCS and not lint */
-
-#include <sys/types.h>
-#include <string.h>
-
-/*
- * Copy src to string dst of size siz. At most siz-1 characters
- * will be copied. Always NUL terminates (unless siz == 0).
- * Returns strlen(src); if retval >= siz, truncation occurred.
- */
-PHPAPI size_t php_strlcpy(dst, src, siz)
- char *dst;
- const char *src;
- size_t siz;
-{
- register char *d = dst;
- register const char *s = src;
- register size_t n = siz;
-
- /* Copy as many bytes as will fit */
- if (n != 0 && --n != 0) {
- do {
- if ((*d++ = *s++) == 0)
- break;
- } while (--n != 0);
- }
-
- /* Not enough room in dst, add NUL and traverse rest of src */
- if (n == 0) {
- if (siz != 0)
- *d = '\0'; /* NUL-terminate dst */
- while (*s++)
- ;
- }
-
- return(s - src - 1); /* count does not include NUL */
-}
-
-#endif /* !HAVE_STRLCPY */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/main/win95nt.h b/main/win95nt.h
deleted file mode 100644
index bc0e83b4b7..0000000000
--- a/main/win95nt.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/* Defines and types for Windows 95/NT */
-#define HAVE_DECLARED_TIMEZONE
-#define WIN32_LEAN_AND_MEAN
-#include <io.h>
-#include <malloc.h>
-#include <direct.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <stdarg.h>
-#include <sys/types.h>
-typedef int uid_t;
-typedef int gid_t;
-typedef char * caddr_t;
-#define lstat(x, y) stat(x, y)
-#define _IFIFO 0010000 /* fifo */
-#define _IFBLK 0060000 /* block special */
-#define _IFLNK 0120000 /* symbolic link */
-#define S_IFIFO _IFIFO
-#define S_IFBLK _IFBLK
-#define S_IFLNK _IFLNK
-#define chdir(path) SetCurrentDirectory(path)
-#define mkdir(a,b) _mkdir(a)
-#define rmdir(a) _rmdir(a)
-#define getpid _getpid
-#define php_sleep(t) Sleep(t*1000)
-#define getcwd(a, b) _getcwd(a, b)
-#define snprintf _snprintf
-#define off_t _off_t
-#define vsnprintf _vsnprintf
-typedef unsigned int uint;
-typedef unsigned long ulong;
-#if !NSAPI
-#define strcasecmp(s1, s2) stricmp(s1, s2)
-#define strncasecmp(s1, s2, n) strnicmp(s1, s2, n)
-typedef long pid_t;
-#endif
-
-/* missing in vc5 math.h */
-#define M_PI 3.14159265358979323846
-#define M_TWOPI (M_PI * 2.0)
-#define M_PI_2 1.57079632679489661923
-#ifndef M_PI_4
-#define M_PI_4 0.78539816339744830962
-#endif
-
-#if !PHP_DEBUG
-#ifdef inline
-#undef inline
-#endif
-#define inline __inline
-#endif
-
-/* General Windows stuff */
-#define WINDOWS 1
-
-/* Prevent use of VC5 OpenFile function */
-#define NOOPENFILE
-
-/* sendmail is built-in */
-#ifdef PHP_PROG_SENDMAIL
-#undef PHP_PROG_SENDMAIL
-#define PHP_PROG_SENDMAIL "Built in mailer"
-#endif
diff --git a/makedist b/makedist
deleted file mode 100755
index de5ebc6d74..0000000000
--- a/makedist
+++ /dev/null
@@ -1,148 +0,0 @@
-#!/bin/sh
-#
-# Distribution generator for CVS based packages.
-# To work, this script needs a consistent tagging of all releases.
-# Each release of a package should have a tag of the form
-#
-# <package>_<version>
-#
-# where <package> is the package name and the CVS module
-# and <version> s the version number with underscores instead of dots.
-#
-# For example: cvs tag php_3_0a1
-#
-# The distribution ends up in a .tar.gz file that contains the distribution
-# in a directory called <package>-<version>. The distribution contains all
-# directories from the CVS module except the one called "nodist", but only
-# the files INSTALL, README and config* are included.
-#
-# Since you can no longer set the CVS password via an env variable, you
-# need to have previously done a cvs login for the server and user id
-# this script uses so it will have an entry in your ~/.cvspasswd file.
-#
-# Usage: makedist <package> <version>
-#
-# Written by Stig Bakken <ssb@guardian.no> 1997-05-28.
-#
-# $Id$
-#
-
-if test "$#" != "2"; then
- echo "Usage: makedist <package> <version>" >&2
- exit 1
-fi
-
-PKG=$1 ; shift
-VER=$1 ; shift
-
-old_IFS="$IFS"
-IFS=.
-eval set `bison -V|sed "s/GNU Bison version //"`
-if test "$1" = "1" && test "28" -gt "$2"; then
- echo "Please use Bison 1.28 or higher"
- exit 10
-fi
-IFS="$old_IFS"
-
-PHPROOT=:pserver:cvsread@cvs.php.net:/repository
-ZENDROOT=:pserver:cvsread@cvs.zend.com:/repository
-PHPMOD=php4
-ZENDMOD=Zend
-TSRMMOD=TSRM
-LT_TARGETS='ltconfig ltmain.sh config.guess config.sub'
-
-if echo '\c' | grep -s c >/dev/null 2>&1
-then
- ECHO_N="echo -n"
- ECHO_C=""
-else
- ECHO_N="echo"
- ECHO_C='\c'
-fi
-
-MY_OLDPWD=`pwd`
-
-# the destination .tar.gz file
-ARCHIVE=$MY_OLDPWD/$PKG-$VER.tar
-
-# temporary directory used to check out files from CVS
-DIR=$PKG-$VER
-DIRPATH=$MY_OLDPWD/$DIR
-
-if test -d "$DIRPATH"; then
- echo "The directory $DIR"
- echo "already exists, rename or remove it and run makedist again."
- exit 1
-fi
-
-# version part of the CVS release tag
-CVSVER=`echo $VER | sed -e 's/[\.\-]/_/g'`
-
-# CVS release tag
-CVSTAG=${PKG}_$CVSVER
-
-if test ! -d $DIRPATH; then
- mkdir -p $DIRPATH || exit 2
-fi
-
-#cd $DIRPATH || exit 3
-
-# Export PHP
-$ECHO_N "makedist: exporting tag '$CVSTAG' from '$PHPMOD'...$ECHO_C"
-cvs -z 9 -d $PHPROOT -Q export -d $DIR -r $CVSTAG $PHPMOD || exit 4
-echo ""
-
-# Export the other modules inside the PHP directory
-cd $DIR || exit 5
-
-# Export Zend
-$ECHO_N "makedist: exporting tag '$CVSTAG' from '$ZENDMOD'...$ECHO_C"
-cvs -z 9 -d $ZENDROOT -Q export -r $CVSTAG $ZENDMOD || exit 4
-echo ""
-
-# Export TSRM
-$ECHO_N "makedist: exporting tag '$CVSTAG' from '$TSRMMOD'...$ECHO_C"
-cvs -z 9 -d $ZENDROOT -Q export -r $CVSTAG $TSRMMOD || exit 4
-echo ""
-
-# remove CVS stuff...
-find . \( \( -name CVS -type d \) -o -name .cvsignore \) -exec rm -rf {} \;
-
-# The full ChangeLog is available separately from lxr.php.net
-rm ChangeLog
-
-# hide away our own versions of libtool-generated files
-for i in $LT_TARGETS; do
- if test -f "$i"; then
- mv $i $i.bak
- cp $i.bak $i
- fi
-done
-
-# generate some files so people don't need bison, flex and autoconf
-# to install
-set -x
-./buildconf --copy
-
-# remove buildmk.stamp. Otherwise, buildcheck.sh might not be run,
-# when a user runs buildconf in the distribution.
-rm -f buildmk.stamp
-
-./genfiles
-
-# now restore our versions of libtool-generated files
-for i in $LT_TARGETS; do
- test -f "$i" && mv $i.bak $i
-done
-
-cd $MY_OLDPWD
-$ECHO_N "makedist: making gzipped tar archive...$ECHO_C"
-tar cf $ARCHIVE $PKG-$VER || exit 8
-gzip -9 $ARCHIVE || exit 9
-echo ""
-
-$ECHO_N "makedist: cleaning up...$ECHO_C"
-rm -rf $DIRPATH || exit 10
-echo ""
-
-exit 0
diff --git a/makerpm b/makerpm
deleted file mode 100644
index 36e51c9fde..0000000000
--- a/makerpm
+++ /dev/null
@@ -1,176 +0,0 @@
-#! /bin/sh
-
-# Based slightly on an original by John H Terpstra but not much left of his.
-# S Liddicott 1999 sam@campbellsci.co.uk
-
-PREFIX="php"
-TARDIR="`basename \`pwd\``"
-RELEASE=${1:-1}
-VERSION=${2:-`echo $TARDIR | sed "s/$PREFIX//g"`}
-
-if [ "$VERSION" = "" ]
-then cat <<"EOH"
-$PREFIX source needs to be installed in a folder that contains the version
-number, e.g. ${PREFIX}4 or ${PREFIX}4b2
-EOH
-fi
-
-echo "Usage:"
-echo "$0 <release>"
-echo
-echo "e.g.:"
-echo "$0 2"
-echo -n "Building RPM version $VERSION, release: $RELEASE "
-sleep 1 ; echo -n . ; sleep 1 ; echo -n . ; sleep 1 ; echo -n .
-echo
-
-TAR=php$VERSION.tar.gz
-SPEC=php$VERSION.spec
-
-# write out the .spec file
-sed -e "s/PVERSION/$VERSION/g" \
- -e "s/PRELEASE/$RELEASE/g" \
- -e "s/TARDIR/$TARDIR/g" \
- > $SPEC <<'EOF'
-Summary: PHP4b1 - a powerful scripting language for HTML
-Name: mod_php4
-Version: PVERSION
-Release: PRELEASE
-Group: Networking/Daemons
-Source0: http://www.php.net/distributions/php%{PACKAGE_VERSION}.tar.gz
-#Source1: php3-manual.tar.gz
-Copyright: GPL
-BuildRoot: /tmp/php3-root
-Requires: webserver
-
-%description
-PHP4 is a powerful apache module that adds scripting and database connection
-capabilities to the apache server. This version includes the "php" binary
-for suExec and stand alone php scripts too.
-
-%prep
-%setup -q -n TARDIR
-#mkdir manual; cd manual && tar xzf $RPM_SOURCE_DIR/php3-manual.tar.gz
-chown -R root.root .
-./buildconf
-
-%build
-# first the standalone (why can't you build both at once?)
-# need to run this under sh or it breaks
-cd ext/wddx
-ln -s /usr/src/redhat/BUILD/apache_1.3.9/src/lib/expat-lite ./xml
-cd ../..
-
-sh ./configure --prefix=/usr \
- --without-gd \
- --with-config-file-path=/usr/lib \
- --enable-force-cgi-redirect \
- --enable-debugger=yes \
- --enable-safe-mode \
- --with-exec-dir=/usr/bin \
- --with-mysql=/usr \
- --with-imap=/usr \
- --with-pdflib=/usr \
- --with-system-regex \
- --enable-track-vars \
- --with-ttf \
- --with-zlib \
- --with-xml=/usr/src/redhat/BUILD/apache_1.3.9/src/lib/expat-lite \
- --with-wddx \
-
-# ldap don't work
-# --with-ldap=/usr \
-
-# system regex conflicts with apache_ssl for some reason
-
-make
-mv php php.keepme
-
-# then the apache module
-rm config.cache
-sh ./configure --prefix=/usr \
- --without-gd \
- --with-apxs=/usr/sbin/apxs \
- --enable-versioning \
- --with-config-file-path=/usr/lib \
- --enable-debugger=yes \
- --enable-safe-mode \
- --with-exec-dir=/usr/bin \
- --with-mysql=/usr \
- --with-imap=/usr \
- --with-pdflib=/usr \
- --with-system-regex \
- --enable-track-vars \
- --with-ttf \
- --with-zlib \
- --with-xml=/usr/src/redhat/BUILD/apache_1.3.9/src/lib/expat-lite \
- --with-wddx \
-
-# ldap don't work
-# --with-ldap=/usr \
-
-# system regex conflicts with apache_ssl for some reason
-
-make clean
-make
-# restore cgi version
-mv php.keepme php
-
-%install
-rm -rf $RPM_BUILD_ROOT
-mkdir -p $RPM_BUILD_ROOT/usr/lib/apache
-install -m 755 libphp4.so $RPM_BUILD_ROOT/usr/lib/apache
-mkdir -p $RPM_BUILD_ROOT/usr/bin
-install -m 755 php $RPM_BUILD_ROOT/usr/bin
-
-%clean
-rm -rf $RPM_BUILD_ROOT
-
-%changelog
-* Sun Apr 30 2000 Joey Smith <joey@samaritan.com>
-- Small fix: Description still referred to package as PHP3.
-
-* Wed Jul 21 1999 Sam Liddicott <sam@campbellsci.co.uk>
-- added php4b1 and modified cgi building rules so it doesn't break module
-
-* Wed Mar 17 1999 Sam Liddicott <sam@campbellsci.co.uk>
-- Stuffed in 3.0.7 source tar and added "php" as a build destination
-
-* Mon Oct 12 1998 Cristian Gafton <gafton@redhat.com>
-- rebuild for apache 1.3.3
-
-* Thu Oct 08 1998 Preston Brown <pbrown@redhat.com>
-- updated to 3.0.5, fixes nasty bugs in 3.0.4.
-
-* Sun Sep 27 1998 Cristian Gafton <gafton@redhat.com>
-- updated to 3.0.4 and recompiled for apache 1.3.2
-
-* Thu Sep 03 1998 Preston Brown <pbrown@redhat.com>
-- improvements; builds with apache-devel package installed.
-
-* Tue Sep 01 1998 Preston Brown <pbrown@redhat.com>
-- Made initial cut for PHP3.
-
-%files
-/usr/lib/apache/libphp4.so
-/usr/bin/php
-%doc TODO CODING_STANDARDS CREDITS ChangeLog LICENSE BUGS examples
-%doc manual/*
-EOF
-
-RPMDIR=/usr/src/redhat/RPMS
-SPECDIR=/usr/src/redhat/SPECS
-SRCDIR=/usr/src/redhat/SOURCES
-
-(
-make clean
-find . -name config.cache -exec rm -f '{}'
-cd ..
-tar czvf ${SRCDIR}/${TAR} $TARDIR )
-
-cp -a $SPEC $SPECDIR/${SPEC}
-#cp -a *.patch $SRCDIR
-cd $SRCDIR
-chown -R root.root ${TAR}
-cd $SPECDIR
-rpm -ba -v ${SPEC}
diff --git a/pear/CMD.php b/pear/CMD.php
deleted file mode 100755
index cc4f4bc7e8..0000000000
--- a/pear/CMD.php
+++ /dev/null
@@ -1,286 +0,0 @@
-<?php
-//
-// +----------------------------------------------------------------------+
-// | PHP version 4.0 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1997-2001 The PHP Group |
-// +----------------------------------------------------------------------+
-// | This source file is subject to version 2.02 of the PHP license, |
-// | that is bundled with this package in the file LICENSE, and is |
-// | available at through the world-wide-web at |
-// | http://www.php.net/license/2_02.txt. |
-// | If you did not receive a copy of the PHP license and are unable to |
-// | obtain it through the world-wide-web, please send a note to |
-// | license@php.net so we can mail you a copy immediately. |
-// +----------------------------------------------------------------------+
-// | Authors: Anders Johannsen <anders@johannsen.com> |
-// | |
-// +----------------------------------------------------------------------+
-//
-define('CMD_RCSID', '$Id$');
-
-/**
- * The Cmd:: class implements an abstraction for various ways
- * of executing commands (directly using the backtick operator,
- * as a background task after the script has terminated using
- * register_shutdown_function() or as a detached process using nohup).
- *
- * @author Anders Johannsen <anders@johannsen.com>
- * @version $Revision$
- **/
-
-require_once 'PEAR.php';
-
-
-class Cmd extends PEAR
-{
- var $arrSetting = array();
- var $arrConstant = array();
- var $arrCommand = array();
-
- /**
- * Class constructor
- *
- * Defines all necessary constants and sets defaults
- *
- * @author Anders Johannsen <anders@johannsen.com>
- *
- * @access public
- *
- **/
-
- function Cmd ()
- {
- // Defining constants
- $this->arrConstant = array ("CMD_SEQUENCE",
- "CMD_SHUTDOWN",
- "CMD_SHELL",
- "CMD_OUTPUT",
- "CMD_NOHUP",
- "CMD_VERBOSE"
- );
-
- foreach ($this->arrConstant as $key => $value) {
- if (!defined($value)) {
- define($value, $key);
- }
- }
-
- // Setting default values
- $this->arrSetting[CMD_SEQUENCE] = true;
- $this->arrSetting[CMD_SHUTDOWN] = false;
- $this->arrSetting[CMD_OUTPUT] = false;
- $this->arrSetting[CMD_NOHUP] = false;
- $this->arrSetting[CMD_VERBOSE] = false;
-
- $arrShell = array ("sh", "bash", "zsh", "tcsh", "csh", "ash", "sash", "esh", "ksh");
-
- foreach ($arrShell as $shell) {
- if ($this->arrSetting[CMD_SHELL] = $this->which($shell)) {
- break;
- }
- }
-
- if (empty($this->arrSetting[CMD_SHELL])) {
- $this->raiseError("No shell found");
- }
- }
-
- /**
- * Sets any option
- *
- * The options are currently:
- * CMD_SHUTDOWN : Execute commands via a shutdown function
- * CMD_SHELL : Path to shell
- * CMD_OUTPUT : Output stdout from process
- * CMD_NOHUP : Use nohup to detach process
- * CMD_VERBOSE : Print errors to stdout
- *
- * @param $option is a constant, which corresponds to the
- * option that should be changed
- *
- * @param $setting is the value of the option currently
- * being toggled.
- *
- * @return bool true if succes, else false
- *
- * @access public
- *
- * @author Anders Johannsen <anders@johannsen.com>
- *
- **/
-
- function setOption ($option, $setting)
- {
- if (empty($this->arrConstant[$option])) {
- $this->raiseError("No such option: $option");
- return false;
- }
-
-
- switch ($option) {
- case CMD_OUTPUT:
- case CMD_SHUTDOWN:
- case CMD_VERBOSE:
- case CMD_SEQUENCE:
- $this->arrSetting[$option] = $setting;
- return true;
- break;
-
- case CMD_SHELL:
- if (is_executable($setting)) {
- $this->arrSetting[$option] = $setting;
- return true;
- } else {
- $this->raiseError("No such shell: $setting");
- return false;
- }
- break;
-
-
- case CMD_NOHUP:
- if (empty($setting)) {
- $this->arrSetting[$option] = false;
-
- } else if ($location = $this->which("nohup")) {
- $this->arrSetting[$option] = true;
-
- } else {
- $this->raiseError("Nohup was not found on your system");
- return false;
- }
- break;
-
- }
- }
-
- /**
- * Add command for execution
- *
- * @param $command accepts both arrays and regular strings
- *
- * @return bool true if succes, else false
- *
- * @access public
- *
- * @author Anders Johannsen <anders@johannsen.com>
- *
- **/
-
- function command($command)
- {
- if (is_array($command)) {
- foreach ($command as $key => $value) {
- $this->arrCommand[] = $value;
- }
- return true;
-
- } else if (is_string($command)) {
- $this->arrCommand[] = $command;
- return true;
- }
-
- $this->raiseError("Argument not valid");
- return false;
- }
-
- /**
- * Executes the code according to given options
- *
- * @return bool true if succes, else false
- *
- * @access public
- *
- * @author Anders Johannsen <anders@johannsen.com>
- *
- **/
-
- function exec()
- {
- // Warning about impossible mix of options
- if (!empty($this->arrSetting[CMD_OUTPUT])) {
- if (!empty($this->arrSetting[CMD_SHUTDOWN]) || !empty($this->arrSetting[CMD_NOHUP])) {
- $this->raiseError("Error: Commands executed via shutdown functions or nohup cannot return output");
- return false;
- }
- }
-
- // Building command
- $strCommand = implode(";", $this->arrCommand);
-
- $strExec = "echo '$strCommand' | ".$this->arrSetting[CMD_SHELL];
-
- if (empty($this->arrSetting[CMD_OUTPUT])) {
- $strExec = $strExec . ' > /dev/null';
- }
-
- if (!empty($this->arrSetting[CMD_NOHUP])) {
- $strExec = 'nohup ' . $strExec;
- }
-
- // Executing
- if (!empty($this->arrSetting[CMD_SHUTDOWN])) {
- $line = "system(\"$strExec\");";
- $function = create_function('', $line);
- register_shutdown_function($function);
- return true;
- } else {
- return `$strExec`;
- }
- }
-
- /**
- * Errorhandler. If option CMD_VERBOSE is true,
- * the error is printed to stdout, otherwise it
- * is avaliable in lastError
- *
- * @return bool always returns true
- *
- * @access private
- *
- * @author Anders Johannsen <anders@johannsen.com>
- **/
-
- function raiseError($strError)
- {
- if (!empty($this->arrSetting[CMD_VERBOSE])) {
- echo $strError;
- } else {
- $this->lastError = $strError;
- }
-
- return true;
- }
-
- /**
- * Functionality similiar to unix 'which'. Searches the path
- * for the specified program.
- *
- * @param $cmd name of the executable to search for
- *
- * @return string returns the full path if found,
- * false if not
- *
- * @access private
- *
- * @author Anders Johannsen <anders@johannsen.com>
- **/
-
- function which($cmd)
- {
- global $HTTP_ENV_VARS;
-
- $arrPath = explode(":", $HTTP_ENV_VARS['PATH']);
-
- foreach ($arrPath as $path) {
- $location = $path . "/" . $cmd;
-
- if (is_executable($location)) {
- return $location;
- }
- }
- return false;
- }
-}
-
-?>
diff --git a/pear/CODING_STANDARDS b/pear/CODING_STANDARDS
deleted file mode 100644
index cd48d1546b..0000000000
--- a/pear/CODING_STANDARDS
+++ /dev/null
@@ -1,241 +0,0 @@
-===========================================================================
-|| PEAR Coding Standards ||
-===========================================================================
-
-$Id$
-
--------------
-[1] Indenting
-=============
-
-Use an indent of 4 spaces, with no tabs. If you use Emacs to edit PEAR
-code, you should set indent-tabs-mode to nil. Here is an example mode
-hook that will set up Emacs according to these guidelines (you will
-need to ensure that it is called when you are editing php files):
-
-(defun php-mode-hook ()
- (setq tab-width 4
- c-basic-offset 4
- c-hanging-comment-ender-p nil
- indent-tabs-mode
- (not
- (and (string-match "/\\(PEAR\\|pear\\)/" (buffer-file-name))
- (string-match "\.php$" (buffer-file-name))))))
-
-Here are vim rules for the same thing:
-
- set expandtab
- set shiftwidth=4
- set tabstop=4
-
-
-----------------------
-[2] Control Structures
-======================
-
-These include if, for, while, switch, etc. Here is an example if statement,
-since it is the most complicated of them:
-
- if ((condition1) || (condition2)) {
- action1;
- } elseif ((condition3) && (condition4)) {
- action2;
- } else {
- defaultaction;
- }
-
-Control statements should have one space between the control keyword
-and opening parenthesis, to distinguish them from function calls.
-
-You are strongly encouraged to always use curly braces even in
-situations where they are technically optional. Having them increases
-readability and decreases the likelihood of logic errors being
-introduced when new lines are added.
-
-For switch statements:
-
- switch (condition) {
- case 1:
- action1;
- break;
-
- case 2:
- action2;
- break;
-
- default:
- defaultaction;
- break;
-
- }
-
-
-------------------
-[3] Function Calls
-==================
-
-Functions should be called with no spaces between the function name,
-the opening parenthesis, and the first parameter; spaces between commas
-and each parameter, and no space between the last parameter, the
-closing parenthesis, and the semicolon. Here's an example:
-
- $var = foo($bar, $baz, $quux);
-
-As displayed above, there should be one space on either side of an
-equals sign used to assign the return value of a function to a
-variable. In the case of a block of related assignments, more space
-may be inserted to promote readability:
-
- $short = foo($bar);
- $long_variable = foo($baz);
-
-
-------------------------
-[4] Function Definitions
-========================
-
-Function declaractions follow the "one true brace" convention:
-
-function fooFunction($arg1, $arg2 = '')
-{
- if (condition) {
- statement;
- }
- return $val;
-}
-
-Arguments with default values go at the end of the argument list.
-Always attempt to return a meaningful value from a function if one is
-appropriate. Here is a slightly longer example:
-
-function connect(&$dsn, $persistent = false)
-{
- if (is_array($dsn)) {
- $dsninfo = &$dsn;
- } else {
- $dsninfo = DB::parseDSN($dsn);
- }
-
- if (!$dsninfo || !$dsninfo['phptype']) {
- return $this->raiseError();
- }
-
- return true;
-}
-
-
-------------
-[5] Comments
-============
-
-Inline documentation for classes should follow the PHPDoc convention, similar
-to Javadoc. More information about PHPDoc can be found here:
-
- http://www.phpdoc.de/
-
-Non-documentation comments are strongly encouraged. A general rule of
-thumb is that if you look at a section of code and think "Wow, I don't
-want to try and describe that", you need to comment it before you
-forget how it works.
-
-C++ style comments (/* */) and standard C comments (// ) are both
-fine. Use of perl/shell style comments (# ) is discouraged.
-
-
-------------------
-[6] Including Code
-==================
-
-Anywhere you are unconditionally including a class file, use
-require_once. Anywhere you are conditionally including a class file
-(for example, factory methods), use include_once. Either of these will
-ensure that class files are included only once. They share the same
-file list, so you don't need to worry about mixing them - a file
-included with require_once will not be included again by include_once.
-
-Note: include_once and require_once are statements, not functions. You
-don't need parentheses around the filename to be included.
-
-
------------------
-[7] PHP Code Tags
-=================
-
-ALWAYS use <?php ?> to delimit PHP code, not the <? ?> shorthand.
-This is required for PEAR compliance and is also the most portable way
-to include PHP code on differing operating systems and setups.
-
-
--------------------------
-[8] Header Comment Blocks
-=========================
-
-All source code files in the core PEAR distribution should contain the
-following comment block as the header:
-
-/* vim: set expandtab tabstop=4 shiftwidth=4: */
-// +----------------------------------------------------------------------+
-// | PHP version 4.0 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1997, 1998, 1999, 2000, 2001 The PHP Group |
-// +----------------------------------------------------------------------+
-// | This source file is subject to version 2.0 of the PHP license, |
-// | that is bundled with this package in the file LICENSE, and is |
-// | available at through the world-wide-web at |
-// | http://www.php.net/license/2_02.txt. |
-// | If you did not receive a copy of the PHP license and are unable to |
-// | obtain it through the world-wide-web, please send a note to |
-// | license@php.net so we can mail you a copy immediately. |
-// +----------------------------------------------------------------------+
-// | Authors: Original Author <author@example.com> |
-// | Your Name <you@example.com> |
-// +----------------------------------------------------------------------+
-//
-// $Id$
-
-There's no hard rule to determine when a new code contributer should be
-added to the list of authors for a given source file. In general, their
-changes should fall into the "substantial" category (meaning somewhere
-around 10% to 20% of code changes). Exceptions could be made for rewriting
-functions or contributing new logic.
-
-Simple code reorganization or bug fixes would not justify the addition of a
-new individual to the list of authors.
-
-Files not in the core PEAR repository should have a similar block
-stating the copyright, the license, and the authors. All files should
-include the modeline comments to encourage consistency.
-
-
-------------
-[9] CVS Tags
-============
-
-Include the <dollar>Id CVS vendor tag in each file. As each
-file is edited, add this tag if it's not yet present (or replace existing
-forms such as "Last Modified:", etc.).
-
-[NOTE: we have a custom $Horde tag in Horde cvs to track our versions
-seperately; we could do the same and make a $PEAR tag, that would remain even
-if PEAR files were put into another source control system, etc...]
-
-
------------------
-[10] Example URLs
-=================
-
-Use "example.com" for all example URLs, per RFC 2606.
-
-
----------------------
-[11] Naming Constants
-=====================
-
-Constants should always be uppercase, with underscores to seperate
-words. Prefix constant names with the name of the class/package they
-are used in. For example, the constants used by the DB:: package all
-begin with "DB_".
-
-True and false are built in to the php language and behave like
-constants, but should be written in lowercase to distinguish them from
-user-defined constants.
diff --git a/pear/Cache.php b/pear/Cache.php
deleted file mode 100644
index 7338bd8939..0000000000
--- a/pear/Cache.php
+++ /dev/null
@@ -1,355 +0,0 @@
-<?php
-// +----------------------------------------------------------------------+
-// | PHP version 4.0 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1997, 1998, 1999, 2000, 2001 The PHP Group |
-// +----------------------------------------------------------------------+
-// | This source file is subject to version 2.0 of the PHP license, |
-// | that is bundled with this package in the file LICENSE, and is |
-// | available at through the world-wide-web at |
-// | http://www.php.net/license/2_02.txt. |
-// | If you did not receive a copy of the PHP license and are unable to |
-// | obtain it through the world-wide-web, please send a note to |
-// | license@php.net so we can mail you a copy immediately. |
-// +----------------------------------------------------------------------+
-// | Authors: Ulf Wendel <ulf.wendel@phpdoc.de> |
-// | Sebastian Bergmann <sb@sebastian-bergmann.de> |
-// +----------------------------------------------------------------------+
-//
-// $Id$
-
-require_once "Cache/Error.php";
-
-/**
-* Cache is a base class for cache implementations.
-*
-* The pear cache module is a generic data cache which can be used to
-* cache script runs. The idea behind the cache is quite simple. If you have
-* the same input parameters for whatever tasks/algorithm you use you'll
-* usually get the same output. So why not caching templates, functions calls,
-* graphic generation etc. Caching certain actions e.g. XSLT tranformations
-* saves you lots of time.
-*
-* The design of the cache reminds of PHPLibs session implementation. A
-* (PHPLib: session) controller uses storage container (PHPLib: ct_*.inc) to save
-* certain data (PHPLib: session data). In contrast to the session stuff it's up to
-* you to generate an ID for the data to cache. If you're using the output cache
-* you might use the script name as a seed for cache::generateID(), if your using the
-* function cache you'd use an array with all function parameters.
-*
-* Usage example of the generic data cache:
-*
-* require_once("Cache.php");
-*
-* $cache = new Cache("file", array("cache_dir" => "cache/") );
-* $id = $cache->generateID("testentry");
-*
-* if ($data = $cache->get($id)) {
-* print "Cache hit.<br>Data: $data";
-*
-* } else {
-* $data = "data of any kind";
-* $cache->save($id, $data);
-* print "Cache miss.<br>";
-* }
-*
-* WARNING: No File/DB-Table-Row locking is implemented yet,
-* it's possible, that you get corrupted data-entries under
-* bad circumstances (especially with the file container)
-*
-* @author Ulf Wendel <ulf.wendel@phpdoc.de>
-* @version $Id$
-* @package Cache
-* @access public
-*/
-class Cache extends PEAR {
-
- /**
- * Enables / disables caching.
- *
- * TODO: Add explanation what this is good for.
- *
- * @var boolean
- * @access private
- */
- var $caching = true;
-
- /**
- * Garbage collection: probability in seconds
- *
- * If set to a value above 0 a garbage collection will
- * flush all cache entries older than the specified number
- * of seconds.
- *
- * @var integer
- * @see $gc_probability, $gc_maxlifetime
- * @access public
- */
- var $gc_time = 1;
-
- /**
- * Garbage collection: probability in percent
- *
- * TODO: Add an explanation.
- *
- * @var integer 0 => never
- * @see $gc_time, $gc_maxlifetime
- * @access public
- */
- var $gc_probability = 1;
-
- /**
- * Garbage collection: delete all entries not use for n seconds.
- *
- * Default is one day, 60 * 60 * 24 = 86400 seconds.
- *
- * @var integer
- * @see $gc_probability, $gc_time
- */
- var $gc_maxlifetime = 86400;
-
- /**
- * Storage container object.
- *
- * @var object Cache_Container
- */
- var $container;
-
- //
- // public methods
- //
-
- /**
- *
- * @param string Name of storage container class
- * @param array Array with storage class dependend config options
- */
- function Cache($storage_driver, $storage_options = "")
- {
- $this->PEAR();
- $storage_driver = strtolower($storage_driver);
- $storage_class = 'Cache_Container_' . $storage_driver;
- $storage_classfile = 'Cache/Container/' . $storage_driver . '.php';
-
- include_once $storage_classfile;
- $this->container = new $storage_class($storage_options);
- }
-
- //deconstructor
- function _Cache()
- {
- $this->garbageCollection();
- }
-
- /**
- * Returns the current caching state.
- *
- * @return boolean The current caching state.
- * @access public
- */
- function getCaching()
- {
- return ($this->caching);
- }
-
- /**
- * Enables or disables caching.
- *
- * @param boolean The new caching state.
- * @access public
- */
- function setCaching($state)
- {
- $this->caching = $state;
- }
-
- /**
- * Returns the requested dataset it if exists and is not expired
- *
- * @param string dataset ID
- * @param string cache group
- * @return mixed cached data or NULL on failure
- * @access public
- */
- function get($id, $group = "default") {
- if (!$this->caching)
- return "";
-
- if ($this->isCached($id, $group) && !$this->isExpired($id, $group))
- return $this->load($id, $group);
-
- return NULL;
- } // end func get
-
- /**
- * Stores the given data in the cache.
- *
- * @param string dataset ID used as cache identifier
- * @param mixed data to cache
- * @param integer lifetime of the cached data in seconds - 0 for endless
- * @param string cache group
- * @return boolean
- * @access public
- */
- function save($id, $data, $expires = 0, $group = "default") {
- if (!$this->caching)
- return true;
-
- return $this->extSave($id, $data, "",$expires, $group);
- } // end func save
-
- /**
- * Stores a dataset without additional userdefined data.
- *
- * @param string dataset ID
- * @param mixed data to store
- * @param string additional userdefined data
- * @param mixed userdefined expire date
- * @param string cache group
- * @return boolean
- * @throws Cache_Error
- * @access public
- * @see getUserdata()
- */
- function extSave($id, $cachedata, $userdata, $expires = 0, $group = "default") {
- if (!$this->caching)
- return true;
-
- return $this->container->save($id, $cachedata, $expires, $group, $userdata);
- } // end func extSave
-
- /**
- * Loads the given ID from the cache.
- *
- * @param string dataset ID
- * @param string cache group
- * @return mixed cached data or NULL on failure
- * @access public
- */
- function load($id, $group = "default") {
- if (!$this->caching)
- return "";
-
- return $this->container->load($id, $group);
- } // end func load
-
- /**
- * Returns the userdata field of a cached data set.
- *
- * @param string dataset ID
- * @param string cache group
- * @return string userdata
- * @access public
- * @see extSave()
- */
- function getUserdata($id, $group = "default") {
- if (!$this->caching)
- return "";
-
- return $this->container->getUserdata($id, $group);
- } // end func getUserdata
-
- /**
- * Removes the specified dataset from the cache.
- *
- * @param string dataset ID
- * @param string cache group
- * @return boolean
- * @access public
- */
- function delete($id, $group = "default") {
- if (!$this->caching)
- return true;
-
- return $this->container->delete($id, $group);
- } // end func delete
-
- /**
- * Flushes the cache - removes all data from it
- *
- * @param string cache group, if empty all groups will be flashed
- * @return integer number of removed datasets
- */
- function flush($group = "") {
- if (!$this->caching)
- return true;
-
- return $this->container->flush($group);
- } // end func flush
-
- /**
- * Checks if a dataset exists.
- *
- * Note: this does not say that the cached data is not expired!
- *
- * @param string dataset ID
- * @param string cache group
- * @return boolean
- * @access public
- */
- function isCached($id, $group = "default") {
- if (!$this->caching)
- return false;
-
- return $this->container->isCached($id, $group);
- } // end func isCached
-
- /**
- * Checks if a dataset is expired
- *
- * @param string dataset ID
- * @param string cache group
- * @param integer maximum age for the cached data in seconds - 0 for endless
- * If the cached data is older but the given lifetime it will
- * be removed from the cache. You don't have to provide this
- * argument if you call isExpired(). Every dataset knows
- * it's expire date and will be removed automatically. Use
- * this only if you know what you're doing...
- * @return boolean
- * @access public
- */
- function isExpired($id, $group = "default", $max_age = 0) {
- if (!$this->caching)
- return true;
-
- return $this->container->isExpired($id, $group, $max_age);
- } // end func isExpired
-
- /**
- * Generates a "unique" ID for the given value
- *
- * This is a quick but dirty hack to get a "unique" ID for a any kind of variable.
- * ID clashes might occur from time to time although they are extreme unlikely!
- *
- * @param mixed variable to generate a ID for
- * @return string "unique" ID
- * @access public
- */
- function generateID($variable) {
- // WARNING: ID clashes are possible although unlikely
- return md5(serialize($variable));
- }
-
- /**
- * Calls the garbage collector of the storage object with a certain probability
- *
- * @param boolean Force a garbage collection run?
- * @see $gc_probability, $gc_time
- */
- function garbageCollection($force = false) {
- static $last_run = 0;
-
- if (!$this->caching)
- return;
-
- srand((double) microtime() * 1000000);
-
- // time and probability based
- if (($force) || ($last_run && $last_run < time() + $this->gc_time) || (rand(1, 100) < $this->gc_probability)) {
- $this->container->garbageCollection($this->gc_maxlifetime);
- $last_run = time();
- }
- } // end func garbageCollection
-
-} // end class cache
-?>
diff --git a/pear/Cache.xml b/pear/Cache.xml
deleted file mode 100644
index 193501f5f9..0000000000
--- a/pear/Cache.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE Package SYSTEM "F:\cvs\php4\pear\package.dtd">
-<Package Type="Source">
- <Name>Cache</Name>
- <Summary>The PEAR Cache Package is a generic data/content cache that can be used to cache data, output, function calls and dynamic graphic generation. </Summary>
- <Maintainer>
- <Initials>chregu</Initials>
- <Name>Christian Stocker</Name>
- <Email>chregu@phant.ch</Email>
- </Maintainer>
- <Release>
- <Version>1.1</Version>
- <Date>2001/03/27</Date>
- <Notes>stable Code, SHM Implementation missing</Notes>
- </Release>
- <FileList>
- <File Role="php">Cache.php</File>
- <Dir>Cache/</Dir>
- </FileList>
-</Package>
diff --git a/pear/Console/Getopt.php b/pear/Console/Getopt.php
deleted file mode 100644
index b116b20777..0000000000
--- a/pear/Console/Getopt.php
+++ /dev/null
@@ -1,202 +0,0 @@
-<?php
-
-/* vim: set expandtab tabstop=4 shiftwidth=4: */
-// +----------------------------------------------------------------------+
-// | PHP version 4.0 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1997, 1998, 1999, 2000, 2001 The PHP Group |
-// +----------------------------------------------------------------------+
-// | This source file is subject to version 2.0 of the PHP license, |
-// | that is bundled with this package in the file LICENSE, and is |
-// | available at through the world-wide-web at |
-// | http://www.php.net/license/2_02.txt. |
-// | If you did not receive a copy of the PHP license and are unable to |
-// | obtain it through the world-wide-web, please send a note to |
-// | license@php.net so we can mail you a copy immediately. |
-// +----------------------------------------------------------------------+
-// | Authors: Andrei Zmievski <andrei@ispi.net> |
-// +----------------------------------------------------------------------+
-//
-// $Id$
-
-require_once 'PEAR.php';
-
-/**
- * Command-line options parsing class.
- *
- * @author Andrei Zmievski <andrei@ispi.net>
- *
- */
-class Console_Getopt {
- /**
- * Parses the command-line options.
- *
- * The first parameter to this function should be the list of command-line
- * arguments without the leading reference to the running program.
- *
- * The second parameter is a string of allowed short options. Each of the
- * option letters can be followed by a colon ':' to specify that the option
- * requires an argument, or a double colon '::' to specify that the option
- * takes an optional argument.
- *
- * The third argument is an optional array of allowed long options. The
- * leading '--' should not be included in the option name. Options that
- * require an argument should be followed by '=', and options that take an
- * option argument should be followed by '=='.
- *
- * The return value is an array of two elements: the list of parsed
- * options and the list of non-option command-line arguments. Each entry in
- * the list of parsed options is a pair of elements - the first one
- * specifies the option, and the second one specifies the option argument,
- * if there was one.
- *
- * Long and short options can be mixed.
- *
- * Most of the semantics of this function are based on GNU getopt_long().
- *
- * @param $args array an array of command-line arguments
- * @param $short_options string specifies the list of allowed short options
- * @param $long_options array specifies the list of allowed long options
- *
- * @return array two-element array containing the list of parsed options and
- * the non-option arguments
- *
- * @access public
- *
- */
- function getopt($args, $short_options, $long_options = null)
- {
- $opts = array();
- $non_opts = array();
-
- settype($args, 'array');
-
- if ($long_options)
- sort($long_options);
-
- reset($args);
- while (list(, $arg) = each($args)) {
-
- /* The special element '--' means explicit end of options. Treat the
- rest of the arguments as non-options and end the loop. */
- if ($arg == '--') {
- $non_opts = array_merge($non_opts, array_slice($args, $i + 1));
- break;
- }
-
- if ($arg{0} != '-' || ($arg{1} == '-' && !$long_options)) {
- $non_opts[] = $arg;
- } else if ($arg{1} == '-') {
- $error = Console_Getopt::_parseLongOption(substr($arg, 2), $long_options, $opts, $args);
- if (PEAR::isError($error))
- return $error;
- } else {
- $error = Console_Getopt::_parseShortOption(substr($arg, 1), $short_options, $opts, $args);
- if (PEAR::isError($error))
- return $error;
- }
- }
-
- return array($opts, $non_opts);
- }
-
- /**
- * @access private
- *
- */
- function _parseShortOption($arg, $short_options, &$opts, &$args)
- {
- for ($i = 0; $i < strlen($arg); $i++) {
- $opt = $arg{$i};
- $opt_arg = null;
-
- /* Try to find the short option in the specifier string. */
- if (($spec = strstr($short_options, $opt)) === false || $arg{$i} == ':')
- {
- return new Getopt_Error("unrecognized option -- $opt\n");
- }
-
- if ($spec{1} == ':') {
- if ($spec{2} == ':') {
- if ($i + 1 < strlen($arg)) {
- /* Option takes an optional argument. Use the remainder of
- the arg string if there is anything left. */
- $opts[] = array($opt, substr($arg, $i + 1));
- break;
- }
- } else {
- /* Option requires an argument. Use the remainder of the arg
- string if there is anything left. */
- if ($i + 1 < strlen($arg)) {
- $opts[] = array($opt, substr($arg, $i + 1));
- break;
- } else if (list(, $opt_arg) = each($args))
- /* Else use the next argument. */;
- else
- return new Getopt_Error("option requires an argument -- $opt\n");
- }
- }
-
- $opts[] = array($opt, $opt_arg);
- }
- }
-
- /**
- * @access private
- *
- */
- function _parseLongOption($arg, $long_options, &$opts, &$args)
- {
- list($opt, $opt_arg) = explode('=', $arg);
- $opt_len = strlen($opt);
-
- for ($i = 0; $i < count($long_options); $i++) {
- $long_opt = $long_options[$i];
- $opt_start = substr($long_opt, 0, $opt_len);
-
- /* Option doesn't match. Go on to the next one. */
- if ($opt_start != $opt)
- continue;
-
- $opt_rest = substr($long_opt, $opt_len);
-
- /* Check that the options uniquely matches one of the allowed
- options. */
- if ($opt_rest != '' && $opt{0} != '=' &&
- $i + 1 < count($long_options) &&
- $opt == substr($long_options[$i+1], 0, $opt_len)) {
- return new Getopt_Error("option --$opt is ambiguous\n");
- }
-
- if (substr($long_opt, -1) == '=') {
- if (substr($long_opt, -2) != '==') {
- /* Long option requires an argument.
- Take the next argument if one wasn't specified. */;
- if (!$opt_arg && !(list(, $opt_arg) = each($args))) {
- return new Getopt_Error("option --$opt requires an argument\n");
- }
- }
- } else if ($opt_arg) {
- return new Getopt_Error("option --$opt doesn't allow an argument\n");
- }
-
- $opts[] = array('--' . $opt, $opt_arg);
- return;
- }
-
- return new Getopt_Error("unrecognized option --$opt\n");
- }
-}
-
-
-class Getopt_Error extends PEAR_Error {
- var $classname = 'Getopt';
- var $error_message_prepend = 'Error in Getopt';
-
- function Getopt_Error($message, $code = 0, $mode = PEAR_ERROR_RETURN, $level = E_USER_NOTICE)
- {
- $this->PEAR_Error($message, $code, $mode, $level);
- }
-}
-
-?>
diff --git a/pear/DB.php b/pear/DB.php
deleted file mode 100644
index 997e7eeea3..0000000000
--- a/pear/DB.php
+++ /dev/null
@@ -1,671 +0,0 @@
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4: */
-// +----------------------------------------------------------------------+
-// | PHP version 4.0 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1997-2001 The PHP Group |
-// +----------------------------------------------------------------------+
-// | This source file is subject to version 2.02 of the PHP license, |
-// | that is bundled with this package in the file LICENSE, and is |
-// | available at through the world-wide-web at |
-// | http://www.php.net/license/2_02.txt. |
-// | If you did not receive a copy of the PHP license and are unable to |
-// | obtain it through the world-wide-web, please send a note to |
-// | license@php.net so we can mail you a copy immediately. |
-// +----------------------------------------------------------------------+
-// | Authors: Stig Bakken <ssb@fast.no> |
-// | Tomas V.V.Cox <cox@idecnet.com> |
-// +----------------------------------------------------------------------+
-//
-// $Id$
-//
-// Database independent query interface.
-//
-
-require_once "PEAR.php";
-
-/*
- * The method mapErrorCode in each DB_dbtype implementation maps
- * native error codes to one of these.
- *
- * If you add an error code here, make sure you also add a textual
- * version of it in DB::errorMessage().
- */
-
-define("DB_OK", 1);
-define("DB_ERROR", -1);
-define("DB_ERROR_SYNTAX", -2);
-define("DB_ERROR_CONSTRAINT", -3);
-define("DB_ERROR_NOT_FOUND", -4);
-define("DB_ERROR_ALREADY_EXISTS", -5);
-define("DB_ERROR_UNSUPPORTED", -6);
-define("DB_ERROR_MISMATCH", -7);
-define("DB_ERROR_INVALID", -8);
-define("DB_ERROR_NOT_CAPABLE", -9);
-define("DB_ERROR_TRUNCATED", -10);
-define("DB_ERROR_INVALID_NUMBER", -11);
-define("DB_ERROR_INVALID_DATE", -12);
-define("DB_ERROR_DIVZERO", -13);
-define("DB_ERROR_NODBSELECTED", -14);
-define("DB_ERROR_CANNOT_CREATE", -15);
-define("DB_ERROR_CANNOT_DELETE", -16);
-define("DB_ERROR_CANNOT_DROP", -17);
-define("DB_ERROR_NOSUCHTABLE", -18);
-define("DB_ERROR_NOSUCHFIELD", -19);
-define("DB_ERROR_NEED_MORE_DATA", -20);
-define("DB_ERROR_NOT_LOCKED", -21);
-define("DB_ERROR_VALUE_COUNT_ON_ROW", -22);
-define("DB_ERROR_INVALID_DSN", -23);
-define("DB_ERROR_CONNECT_FAILED", -24);
-
-/*
- * Warnings are not detected as errors by DB::isError(), and are not
- * fatal. You can detect whether an error is in fact a warning with
- * DB::isWarning().
- */
-
-define('DB_WARNING', -1000);
-define('DB_WARNING_READ_ONLY', -1001);
-
-/*
- * These constants are used when storing information about prepared
- * statements (using the "prepare" method in DB_dbtype).
- *
- * The prepare/execute model in DB is mostly borrowed from the ODBC
- * extension, in a query the "?" character means a scalar parameter.
- * There is one extension though, a "*" character means an opaque
- * parameter. An opaque parameter is simply a file name, the real
- * data are in that file (useful for stuff like putting uploaded files
- * into your database).
- */
-
-define('DB_PARAM_SCALAR', 1);
-define('DB_PARAM_OPAQUE', 2);
-
-/*
- * These constants define different ways of returning binary data
- * from queries. Again, this model has been borrowed from the ODBC
- * extension.
- *
- * DB_BINMODE_PASSTHRU sends the data directly through to the browser
- * when data is fetched from the database.
- * DB_BINMODE_RETURN lets you return data as usual.
- * DB_BINMODE_CONVERT returns data as well, only it is converted to
- * hex format, for example the string "123" would become "313233".
- */
-
-define('DB_BINMODE_PASSTHRU', 1);
-define('DB_BINMODE_RETURN', 2);
-define('DB_BINMODE_CONVERT', 3);
-
-/**
- * This is a special constant that tells DB the user hasn't specified
- * any particular get mode, so the default should be used.
- */
-
-define('DB_FETCHMODE_DEFAULT', 0);
-
-/**
- * Column data indexed by numbers, ordered from 0 and up
- */
-
-define('DB_FETCHMODE_ORDERED', 1);
-
-/**
- * Column data indexed by column names
- */
-
-define('DB_FETCHMODE_ASSOC', 2);
-
-/**
- * For multi-dimensional results: normally the first level of arrays
- * is the row number, and the second level indexed by column number or name.
- * DB_FETCHMODE_FLIPPED switches this order, so the first level of arrays
- * is the column name, and the second level the row number.
- */
-
-define('DB_FETCHMODE_FLIPPED', 4);
-
-/* for compatibility */
-
-define('DB_GETMODE_ORDERED', DB_FETCHMODE_ORDERED);
-define('DB_GETMODE_ASSOC', DB_FETCHMODE_ASSOC);
-define('DB_GETMODE_FLIPPED', DB_FETCHMODE_FLIPPED);
-
-/**
- * these are constants for the tableInfo-function
- * they are bitwised or'ed. so if there are more constants to be defined
- * in the future, adjust DB_TABLEINFO_FULL accordingly
- */
-
-define('DB_TABLEINFO_ORDER', 1);
-define('DB_TABLEINFO_ORDERTABLE', 2);
-define('DB_TABLEINFO_FULL', 3);
-
-
-/**
- * The main "DB" class is simply a container class with some static
- * methods for creating DB objects as well as some utility functions
- * common to all parts of DB.
- *
- * The object model of DB is as follows (indentation means inheritance):
- *
- * DB The main DB class. This is simply a utility class
- * with some "static" methods for creating DB objects as
- * well as common utility functions for other DB classes.
- *
- * DB_common The base for each DB implementation. Provides default
- * | implementations (in OO lingo virtual methods) for
- * | the actual DB implementations as well as a bunch of
- * | query utility functions.
- * |
- * +-DB_mysql The DB implementation for MySQL. Inherits DB_common.
- * When calling DB::factory or DB::connect for MySQL
- * connections, the object returned is an instance of this
- * class.
- *
- * @version 2
- * @author Stig Bakken <ssb@fast.no>
- * @since PHP 4.0
- */
-
-class DB
-{
- /**
- * Create a new DB object for the specified database type
- *
- * @param $type string database type, for example "mysql"
- *
- * @return object a newly created DB object, or a DB error code on
- * error
- */
-
- function &factory($type)
- {
- @include_once("DB/${type}.php");
-
- $classname = "DB_${type}";
-
- if (!class_exists($classname)) {
- return PEAR::raiseError(null, DB_ERROR_NOT_FOUND,
- null, null, null, 'DB_Error', true);
- }
-
- @$obj =& new $classname;
-
- return $obj;
- }
-
- /**
- * Create a new DB object and connect to the specified database
- *
- * @param $dsn mixed "data source name", see the DB::parseDSN
- * method for a description of the dsn format. Can also be
- * specified as an array of the format returned by DB::parseDSN.
- *
- * @param $options mixed if boolean (or scalar), tells whether
- * this connection should be persistent (for backends that support
- * this). This parameter can also be an array of options, see
- * DB_common::setOption for more information on connection
- * options.
- *
- * @return object a newly created DB connection object, or a DB
- * error object on error
- *
- * @see DB::parseDSN
- * @see DB::isError
- */
- function &connect($dsn, $options = false)
- {
- if (is_array($dsn)) {
- $dsninfo = $dsn;
- } else {
- $dsninfo = DB::parseDSN($dsn);
- }
- $type = $dsninfo["phptype"];
-
- if (is_array($options) && isset($options["debug"]) &&
- $options["debug"] >= 2) {
- // expose php errors with sufficient debug level
- include_once "DB/${type}.php";
- } else {
- @include_once "DB/${type}.php";
- }
-
- $classname = "DB_${type}";
- if (!class_exists($classname)) {
- return PEAR::raiseError(null, DB_ERROR_NOT_FOUND,
- null, null, null, 'DB_Error', true);
- }
-
- @$obj =& new $classname;
-
- if (is_array($options)) {
- foreach ($options as $option => $value) {
- $test = $obj->setOption($option, $value);
- if (DB::isError($test)) {
- return $test;
- }
- }
- } else {
- $obj->setOption('persistent', $options);
- }
- $err = $obj->connect($dsninfo, $obj->getOption('persistent'));
-
- if (DB::isError($err)) {
- $err->addUserInfo($dsn);
- return $err;
- }
-
- return $obj;
- }
-
- /**
- * Return the DB API version
- *
- * @return int the DB API version number
- */
- function apiVersion()
- {
- return 2;
- }
-
- /**
- * Tell whether a result code from a DB method is an error
- *
- * @param $value int result code
- *
- * @return bool whether $value is an error
- */
- function isError($value)
- {
- return (is_object($value) &&
- (get_class($value) == 'db_error' ||
- is_subclass_of($value, 'db_error')));
- }
-
- /**
- * Tell whether a query is a data manipulation query (insert,
- * update or delete) or a data definition query (create, drop,
- * alter, grant, revoke).
- *
- * @access public
- *
- * @param string the query
- *
- * @return bool whether $query is a data manipulation query
- */
- function isManip($query)
- {
- if (preg_match('/^\s*"?(INSERT|UPDATE|DELETE|REPLACE|CREATE|DROP|ALTER|GRANT|REVOKE)\s+/i', $query)) {
- return true;
- }
- return false;
- }
-
- /**
- * Tell whether a result code from a DB method is a warning.
- * Warnings differ from errors in that they are generated by DB,
- * and are not fatal.
- *
- * @param $value mixed result value
- *
- * @return bool whether $value is a warning
- */
- function isWarning($value)
- {
- return is_object($value) &&
- (get_class( $value ) == "db_warning" ||
- is_subclass_of($value, "db_warning"));
- }
-
- /**
- * Return a textual error message for a DB error code
- *
- * @param $value int error code
- *
- * @return string error message, or false if the error code was
- * not recognized
- */
- function errorMessage($value)
- {
- if (!isset($errorMessages)) {
- $errorMessages = array(
- DB_ERROR => 'unknown error',
- DB_ERROR_ALREADY_EXISTS => 'already exists',
- DB_ERROR_CANNOT_CREATE => 'can not create',
- DB_ERROR_CANNOT_DELETE => 'can not delete',
- DB_ERROR_CANNOT_DROP => 'can not drop',
- DB_ERROR_CONSTRAINT => 'constraint violation',
- DB_ERROR_DIVZERO => 'division by zero',
- DB_ERROR_INVALID => 'invalid',
- DB_ERROR_INVALID_DATE => 'invalid date or time',
- DB_ERROR_INVALID_NUMBER => 'invalid number',
- DB_ERROR_MISMATCH => 'mismatch',
- DB_ERROR_NODBSELECTED => 'no database selected',
- DB_ERROR_NOSUCHFIELD => 'no such field',
- DB_ERROR_NOSUCHTABLE => 'no such table',
- DB_ERROR_NOT_CAPABLE => 'DB backend not capable',
- DB_ERROR_NOT_FOUND => 'not found',
- DB_ERROR_NOT_LOCKED => 'not locked',
- DB_ERROR_SYNTAX => 'syntax error',
- DB_ERROR_UNSUPPORTED => 'not supported',
- DB_ERROR_VALUE_COUNT_ON_ROW => 'value count on row',
- DB_ERROR_INVALID_DSN => "invalid DSN",
- DB_ERROR_CONNECT_FAILED => "connect failed",
- DB_OK => 'no error',
- DB_WARNING => 'unknown warning',
- DB_WARNING_READ_ONLY => 'read only'
- );
- }
-
- if (DB::isError($value)) {
- $value = $value->getCode();
- }
-
- return $errorMessages[$value];
- }
-
- /**
- * Parse a data source name
- *
- * @param $dsn string Data Source Name to be parsed
- *
- * @return array an associative array with the following keys:
- *
- * phptype: Database backend used in PHP (mysql, odbc etc.)
- * dbsyntax: Database used with regards to SQL syntax etc.
- * protocol: Communication protocol to use (tcp, unix etc.)
- * hostspec: Host specification (hostname[:port])
- * database: Database to use on the DBMS server
- * username: User name for login
- * password: Password for login
- *
- * The format of the supplied DSN is in its fullest form:
- *
- * phptype(dbsyntax)://username:password@protocol+hostspec/database
- *
- * Most variations are allowed:
- *
- * phptype://username:password@protocol+hostspec:110//usr/db_file.db
- * phptype://username:password@hostspec/database_name
- * phptype://username:password@hostspec
- * phptype://username@hostspec
- * phptype://hostspec/database
- * phptype://hostspec
- * phptype(dbsyntax)
- * phptype
- *
- * @author Tomas V.V.Cox <cox@idecnet.com>
- */
- function parseDSN($dsn)
- {
- if (is_array($dsn)) {
- return $dsn;
- }
-
- $parsed = array(
- 'phptype' => false,
- 'dbsyntax' => false,
- 'protocol' => false,
- 'hostspec' => false,
- 'database' => false,
- 'username' => false,
- 'password' => false
- );
-
- // Find phptype and dbsyntax
- if (($pos = strpos($dsn, '://')) !== false) {
- $str = substr($dsn, 0, $pos);
- $dsn = substr($dsn, $pos + 3);
- } else {
- $str = $dsn;
- $dsn = NULL;
- }
-
- // Get phptype and dbsyntax
- // $str => phptype(dbsyntax)
- if (preg_match('|^(.+?)\((.*?)\)$|', $str, $arr)) {
- $parsed['phptype'] = $arr[1];
- $parsed['dbsyntax'] = (empty($arr[2])) ? $arr[1] : $arr[2];
- } else {
- $parsed['phptype'] = $str;
- $parsed['dbsyntax'] = $str;
- }
-
- if (empty($dsn)) {
- return $parsed;
- }
-
- // Get (if found): username and password
- // $dsn => username:password@protocol+hostspec/database
- if (($at = strpos($dsn,'@')) !== false) {
- $str = substr($dsn, 0, $at);
- $dsn = substr($dsn, $at + 1);
- if (($pos = strpos($str, ':')) !== false) {
- $parsed['username'] = urldecode(substr($str, 0, $pos));
- $parsed['password'] = urldecode(substr($str, $pos + 1));
- } else {
- $parsed['username'] = urldecode($str);
- }
- }
-
- // Find protocol and hostspec
- // $dsn => protocol+hostspec/database
- if (($pos=strpos($dsn, '/')) !== false) {
- $str = substr($dsn, 0, $pos);
- $dsn = substr($dsn, $pos + 1);
- } else {
- $str = $dsn;
- $dsn = NULL;
- }
-
- // Get protocol + hostspec
- // $str => protocol+hostspec
- if (($pos=strpos($str, '+')) !== false) {
- $parsed['protocol'] = substr($str, 0, $pos);
- $parsed['hostspec'] = urldecode(substr($str, $pos + 1));
- } else {
- $parsed['hostspec'] = urldecode($str);
- }
-
- // Get dabase if any
- // $dsn => database
- if (!empty($dsn)) {
- $parsed['database'] = $dsn;
- }
-
- return $parsed;
- }
-
- /**
- * Load a PHP database extension if it is not loaded already.
- *
- * @access public
- *
- * @param $name the base name of the extension (without the .so or
- * .dll suffix)
- *
- * @return bool true if the extension was already or successfully
- * loaded, false if it could not be loaded
- */
- function assertExtension($name)
- {
- if (!extension_loaded($name)) {
- $dlext = (substr(PHP_OS, 0, 3) == 'WIN') ? '.dll' : '.so';
- @dl($name . $dlext);
- }
- if (!extension_loaded($name)) {
- return false;
- }
- return true;
- }
-}
-
-/**
- * DB_Error implements a class for reporting portable database error
- * messages.
- *
- * @author Stig Bakken <ssb@fast.no>
- */
-class DB_Error extends PEAR_Error
-{
- /**
- * DB_Error constructor.
- *
- * @param $code mixed DB error code, or string with error message.
- * @param $mode int what "error mode" to operate in
- * @param $level what error level to use for $mode & PEAR_ERROR_TRIGGER
- * @param $debuginfo additional debug info, such as the last query
- *
- * @access public
- *
- * @see PEAR_Error
- */
-
- function DB_Error($code = DB_ERROR, $mode = PEAR_ERROR_RETURN,
- $level = E_USER_NOTICE, $debuginfo = null)
- {
- if (is_int($code)) {
- $this->PEAR_Error('DB Error: ' . DB::errorMessage($code), $code, $mode, $level, $debuginfo);
- } else {
- $this->PEAR_Error("DB Error: $code", DB_ERROR, $mode, $level, $debuginfo);
- }
- }
-}
-
-/**
- * DB_Warning implements a class for reporting portable database
- * warning messages.
- *
- * @author Stig Bakken <ssb@fast.no>
- */
-class DB_Warning extends PEAR_Error
-{
- /**
- * DB_Warning constructor.
- *
- * @param $code mixed DB error code, or string with error message.
- * @param $mode int what "error mode" to operate in
- * @param $level what error level to use for $mode == PEAR_ERROR_TRIGGER
- * @param $debuginfo additional debug info, such as the last query
- *
- * @access public
- *
- * @see PEAR_Error
- */
-
- function DB_Warning($code = DB_WARNING, $mode = PEAR_ERROR_RETURN,
- $level = E_USER_NOTICE, $debuginfo = null)
- {
- if (is_int($code)) {
- $this->PEAR_Error('DB Warning: ' . DB::errorMessage($code), $code, $mode, $level, $debuginfo);
- } else {
- $this->PEAR_Error("DB Warning: $code", 0, $mode, $level, $debuginfo);
- }
- }
-}
-
-/**
- * This class implements a wrapper for a DB result set.
- * A new instance of this class will be returned by the DB implementation
- * after processing a query that returns data.
- *
- * @author Stig Bakken <ssb@fast.no>
- */
-
-class DB_result
-{
- var $dbh;
- var $result;
-
- /**
- * DB_result constructor.
- * @param $dbh DB object reference
- * @param $result result resource id
- */
-
- function DB_result(&$dbh, $result)
- {
- $this->dbh = &$dbh;
- $this->result = $result;
- }
-
- /**
- * Fetch and return a row of data (it uses fetchInto for that)
- * @param $fetchmode format of fetched row array
- * @param $rownum the absolute row number to fetch
- *
- * @return array a row of data, or false on error
- */
- function fetchRow($fetchmode = DB_FETCHMODE_DEFAULT, $rownum=null)
- {
- if ($fetchmode === DB_FETCHMODE_DEFAULT) {
- $fetchmode = $this->dbh->fetchmode;
- }
-
- $res = $this->dbh->fetchInto($this->result, $arr, $fetchmode, $rownum);
- if ($res !== DB_OK) {
- return $res;
- }
- return $arr;
- }
-
- /**
- * Fetch a row of data into an existing array.
- *
- * @param $arr reference to data array
- * @param $fetchmode format of fetched row array
- * @param $rownum the absolute row number to fetch
- *
- * @return int error code
- */
- function fetchInto(&$arr, $fetchmode = DB_FETCHMODE_DEFAULT, $rownum=null)
- {
- if ($fetchmode === DB_FETCHMODE_DEFAULT) {
- $fetchmode = $this->dbh->fetchmode;
- }
- return $this->dbh->fetchInto($this->result, $arr, $fetchmode, $rownum);
- }
-
- /**
- * Get the the number of columns in a result set.
- *
- * @return int the number of columns, or a DB error
- */
- function numCols()
- {
- return $this->dbh->numCols($this->result);
- }
-
- /**
- * Get the number of rows in a result set.
- *
- * @return int the number of rows, or a DB error
- */
- function numRows()
- {
- return $this->dbh->numRows($this->result);
- }
-
- /**
- * Frees the resources allocated for this result set.
- * @return int error code
- */
- function free()
- {
- $err = $this->dbh->freeResult($this->result);
- if(DB::isError($err)) {
- return $err;
- }
- $this->result = false;
- return true;
- }
-
- function tableInfo($mode = null)
- {
- return $this->dbh->tableInfo($this->result, $mode);
- }
-}
-
-?>
diff --git a/pear/HTTP.php b/pear/HTTP.php
deleted file mode 100644
index cffe66ac08..0000000000
--- a/pear/HTTP.php
+++ /dev/null
@@ -1,112 +0,0 @@
-<?php
-//
-// +----------------------------------------------------------------------+
-// | PHP version 4.0 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1997-2001 The PHP Group |
-// +----------------------------------------------------------------------+
-// | This source file is subject to version 2.02 of the PHP license, |
-// | that is bundled with this package in the file LICENSE, and is |
-// | available at through the world-wide-web at |
-// | http://www.php.net/license/2_02.txt. |
-// | If you did not receive a copy of the PHP license and are unable to |
-// | obtain it through the world-wide-web, please send a note to |
-// | license@php.net so we can mail you a copy immediately. |
-// +----------------------------------------------------------------------+
-// | Authors: Stig Bakken <ssb@fast.no> |
-// | |
-// +----------------------------------------------------------------------+
-//
-// $Id$
-//
-// HTTP utility functions.
-//
-
-if (!empty($GLOBALS['USED_PACKAGES']['HTTP'])) return;
-$GLOBALS['USED_PACKAGES']['HTTP'] = true;
-
-class HTTP {
- /**
- * Format a date according to RFC-XXXX (can't remember the HTTP
- * RFC number off-hand anymore, shame on me). This function
- * honors the "y2k_compliance" php.ini directive.
- *
- * @param $time int UNIX timestamp
- *
- * @return HTTP date string, or false for an invalid timestamp.
- *
- * @author Stig Bakken <ssb@fast.no>
- */
- function Date($time) {
- $y = ini_get("y2k_compliance") ? "Y" : "y";
- return gmdate("D, d M $y H:i:s", $time);
- }
-
- /**
- * Negotiate language with the user's browser through the
- * Accept-Language HTTP header or the user's host address.
- * Language codes are generally in the form "ll" for a language
- * spoken in only one country, or "ll_CC" for a language spoken in
- * a particular country. For example, U.S. English is "en_US",
- * while British English is "en_UK". Portugese as spoken in
- * Portugal is "pt_PT", while Brazilian Portugese is "pt_BR".
- * Two-letter country codes can be found in the ISO 3166 standard.
- *
- * Quantities in the Accept-Language: header are supported, for
- * example:
- *
- * Accept-Language: en_UK;q=0.7, en_US;q=0.6, no;q=1.0, dk;q=0.8
- *
- * @param $supported an associative array indexed by language
- * codes (country codes) supported by the application. Values
- * must evaluate to true.
- *
- * @param $default the default language to use if none is found
- * during negotiation, defaults to "en_US" for U.S. English
- *
- * @author Stig Bakken <ssb@fast.no>
- */
- function negotiateLanguage(&$supported, $default = 'en_US') {
- global $HTTP_SERVER_VARS;
-
- /* If the client has sent an Accept-Language: header, see if
- * it contains a language we support.
- */
- if (isset($HTTP_SERVER_VARS['HTTP_ACCEPT_LANGUAGE'])) {
- $accepted = split(',[[:space:]]*', $HTTP_ACCEPT_LANGUAGE);
- for ($i = 0; $i < count($accepted); $i++) {
- if (eregi('^([a-z]+);[[:space:]]*q=([0-9\.]+)', $accepted[$i], &$arr)) {
- $q = (double)$arr[2];
- $l = $arr[1];
- } else {
- $q = 42;
- $l = $accepted[$i];
- }
- if (!empty($supported[$l]) && ($q > 0.0)) {
- if ($q == 42) {
- return $l;
- }
- $candidates[$l] = $q;
- }
- }
- if (isset($candidates)) {
- arsort($candidates);
- reset($candidates);
- return key($candidates);
- }
- }
-
- /* Check for a valid language code in the top-level domain of
- * the client's host address.
- */
- if (ereg("\.[^\.]+$", $HTTP_SERVER_VARS['REMOTE_HOST'], &$arr)) {
- $lang = strtolower($arr[1]);
- if (!empty($supported[$lang])) {
- return $lang;
- }
- }
-
- return $default;
- }
-}
-?>
diff --git a/pear/ITX.xml b/pear/ITX.xml
deleted file mode 100644
index e484e69852..0000000000
--- a/pear/ITX.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE Package SYSTEM "F:\cvs\php4\pear\package.dtd">
-<Package Type="Source">
- <Name>IT[X] Template</Name>
- <Summary>Easy to use preg_* based template system.</Summary>
- <Maintainer>
- <Initials>uw</Initials>
- <Name>Ulf Wendel</Name>
- <Email>ulf.wendel@phpdoc.de</Email>
- </Maintainer>
- <Release>
- <Version>1.1</Version>
- <Date>2001/03/27</Date>
- <Notes>some IT[X] methods seem to be broken</Notes>
- </Release>
- <FileList>
- <File>HTML/IT.php</File>
- <File>HTML/ITX.php</File>
- <File>HTML/IT_Error.php</File>
- </FileList>
-</Package>
diff --git a/pear/Log.php b/pear/Log.php
deleted file mode 100644
index f4c029c002..0000000000
--- a/pear/Log.php
+++ /dev/null
@@ -1,194 +0,0 @@
-<?php
-// $Id$
-// $Horde: horde/lib/Log.php,v 1.15 2000/06/29 23:39:45 jon Exp $
-
-/**
- * The Log:: class implements both an abstraction for various logging
- * mechanisms and the Subject end of a Subject-Observer pattern.
- *
- * @author Chuck Hagenbuch <chuck@horde.org>
- * @author Jon Parise <jon@csh.rit.edu>
- * @version $Revision$
- * @since Horde 1.3
- */
-class Log {
-
- // {{{ properties
-
- /** Boolean indicating whether or not the log connection is
- currently open. */
- var $opened = false;
-
- /** String holding the identifier that will be stored along with
- each logged message. */
- var $ident = '';
-
- /** Array holding all Log_observer objects that wish to be notified
- of any messages that we handle. */
- var $listeners = array();
-
- // }}}
-
- // {{{ factory()
- /**
- * Attempts to return a concrete Log instance of $log_type.
- *
- * @param $log_type The type of concrete Log subclass to return.
- * Attempt to dynamically include the code for this
- * subclass. Currently, valid values are 'syslog',
- * 'sql', 'file', and 'mcal'.
- *
- * @param $log_name (optional) The name of the actually log file,
- * table, or other specific store to use. Defaults
- * to an empty string, with which the subclass will
- * attempt to do something intelligent.
- *
- * @param $ident (optional) The indentity reported to the log system.
- *
- * @param $conf (optional) A hash containing any additional
- * configuration information that a subclass might need.
- *
- * @return The newly created concrete Log instance, or an
- * false on an error.
- */
- function factory ($log_type, $log_name = '', $ident = '', $conf = array()) {
- $log_type = strtolower($log_type);
- $classfile = 'Log/' . $log_type . '.php';
- if (@include_once $classfile) {
- $class = 'Log_' . $log_type;
- return new $class($log_name, $ident, $conf);
- } else {
- return false;
- }
- }
- // }}}
-
- // {{{ singleton()
- /**
- * Attempts to return a reference to a concrete Log instance of
- * $log_type, only creating a new instance if no log instance with
- * the same parameters currently exists.
- *
- * You should use this if there are multiple places you might
- * create a logger, you don't want to create multiple loggers, and
- * you don't want to check for the existance of one each time. The
- * singleton pattern does all the checking work for you.
- *
- * <b>You MUST call this method with the $var = &Log::singleton()
- * syntax. Without the ampersand (&) in front of the method name,
- * you will not get a reference, you will get a copy.</b>
- *
- * @param $log_type The type of concrete Log subclass to return.
- * Attempt to dynamically include the code for
- * this subclass. Currently, valid values are
- * 'syslog', 'sql', 'file', and 'mcal'.
- *
- * @param $log_name (optional) The name of the actually log file,
- * table, or other specific store to use. Defaults
- * to an empty string, with which the subclass will
- * attempt to do something intelligent.
- *
- * @param $ident (optional) The identity reported to the log system.
- *
- * @param $conf (optional) A hash containing any additional
- * configuration information that a subclass might need.
- *
- * @return The concrete Log reference, or false on an error.
- */
- function &singleton ($log_type, $log_name = '', $ident = '', $conf = array()) {
- static $instances;
- if (!isset($instances)) $instances = array();
-
- $signature = md5($log_type . '][' . $log_name . '][' . $ident . '][' . implode('][', $conf));
- if (!isset($instances[$signature])) {
- $instances[$signature] = Log::factory($log_type, $log_name, $ident, $conf);
- }
- return $instances[$signature];
- }
- // }}}
-
- // {{{ priorityToString()
- /**
- * Returns the string representation of a LOG_* integer constant.
- *
- * @param $priority The LOG_* integer constant.
- *
- * @return The string representation of $priority.
- */
- function priorityToString ($priority) {
- $priorities = array(
- LOG_EMERG => 'emergency',
- LOG_ALERT => 'alert',
- LOG_CRIT => 'critical',
- LOG_ERR => 'error',
- LOG_WARNING => 'warning',
- LOG_NOTICE => 'notice',
- LOG_INFO => 'info',
- LOG_DEBUG => 'debug'
- );
- return $priorities[$priority];
- }
- // }}}
-
- // {{{ attach()
- /**
- * Adds a Log_observer instance to the list of observers that are
- * be notified when a message is logged.
- *
- * @param $logObserver The Log_observer instance to be added to
- * the $listeners array.
- */
- function attach (&$logObserver) {
- if (!is_object($logObserver))
- return false;
-
- $logObserver->_listenerID = uniqid(rand());
-
- $this->listeners[$logObserver->_listenerID] = &$logObserver;
- }
- // }}}
-
- // {{{ detach()
- /**
- * Removes a Log_observer instance from the list of observers.
- *
- * @param $logObserver The Log_observer instance to be removed
- * from the $listeners array.
- */
- function detach ($logObserver) {
- if (isset($this->listeners[$logObserver->_listenerID]))
- unset($this->listeners[$logObserver->_listenerID]);
- }
- // }}}
-
- // {{{ notifyAll()
- /**
- * Sends any Log_observer objects listening to this Log the message
- * that was just logged.
- *
- * @param $messageOb The data structure holding all relevant log
- * information - the message, the priority, what
- * log this is, etc.
- */
- function notifyAll ($messageOb) {
- reset($this->listeners);
- foreach ($this->listeners as $listener) {
- if ($messageOb['priority'] <= $listener->priority)
- $listener->notify($messageOb);
- }
- }
- // }}}
-
- // {{{ isComposite()
- /**
- * @return a Boolean: true if this is a composite class, false
- * otherwise. The composite subclass overrides this to return
- * true.
- */
- function isComposite () {
- return false;
- }
- // }}}
-}
-
-?>
diff --git a/pear/Mail.php b/pear/Mail.php
deleted file mode 100644
index 807568edf7..0000000000
--- a/pear/Mail.php
+++ /dev/null
@@ -1,176 +0,0 @@
-<?php
-//
-// +----------------------------------------------------------------------+
-// | PHP version 4.0 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1997-2001 The PHP Group |
-// +----------------------------------------------------------------------+
-// | This source file is subject to version 2.02 of the PHP license, |
-// | that is bundled with this package in the file LICENSE, and is |
-// | available at through the world-wide-web at |
-// | http://www.php.net/license/2_02.txt. |
-// | If you did not receive a copy of the PHP license and are unable to |
-// | obtain it through the world-wide-web, please send a note to |
-// | license@php.net so we can mail you a copy immediately. |
-// +----------------------------------------------------------------------+
-// | Authors: Chuck Hagenbuch <chuck@horde.org> |
-// +----------------------------------------------------------------------+
-
-require_once 'PEAR.php';
-
-/**
- * PEAR's Mail:: interface. Defines the interface for implementing
- * mailers under the PEAR hierarchy, and provides supporting functions
- * useful in multiple mailer backends.
- */
-class Mail extends PEAR {
-
- /**
- * Provides an interface for generating Mail:: objects of various
- * types
- *
- * @param string The kind of Mail:: object to instantiate.
- * @param array The parameters to pass to the Mail:: object.
- * @access public
- */
- function factory($driver, $params = array())
- {
- $driver = strtolower($driver);
- if (@include_once 'Mail/' . $driver . '.php') {
- $class = 'Mail_' . $driver;
- return new $class($params);
- } else {
- return new PEAR_Error('Unable to find class for driver ' . $driver);
- }
- }
-
- /**
- * Implements Mail::send() function using php's built-in mail()
- * command.
- *
- * @param mixed Either a comma-seperated list of recipients
- * (RFC822 compliant), or an array of recipients,
- * each RFC822 valid. This may contain recipients not
- * specified in the headers, for Bcc:, resending
- * messages, etc.
- *
- * @param array The array of headers to send with the mail, in an
- * associative array, where the array key is the
- * header name (ie, 'Subject'), and the array value
- * is the header value (ie, 'test'). The header
- * produced from those values would be 'Subject:
- * test'.
- *
- * @param string The full text of the message body, including any
- * Mime parts, etc.
- *
- * @return mixed Returns true on success, or a PEAR_Error
- * containing a descriptive error message on
- * failure.
- * @access public
- */
- function send($recipients, $headers, $body)
- {
- // if we're passed an array of recipients, implode it.
- if (is_array($recipients)) {
- $recipients = implode(', ', $recipients);
- }
-
- // get the Subject out of the headers array so that we can
- // pass it as a seperate argument to mail().
- $subject = '';
- if (isset($headers['Subject'])) {
- $subject = $headers['Subject'];
- unset($headers['Subject']);
- }
-
- // flatten the headers out.
- list(,$text_headers) = Mail::prepareHeaders($headers);
-
- return mail($recipients, $subject, $body, $text_headers);
- }
-
- /**
- * Take an array of mail headers and return a string containing
- * text usable in sending a message.
- *
- * @param array The array of headers to prepare, in an associative
- * array, where the array key is the header name (ie,
- * 'Subject'), and the array value is the header
- * value (ie, 'test'). The header produced from those
- * values would be 'Subject: test'.
- *
- * @return mixed Returns false if it encounters a bad address,
- * otherwise returns an array containing two
- * elements: Any From: address found in the headers,
- * and the plain text version of the headers.
- * @access protected
- */
- function prepareHeaders($headers)
- {
- // Look out for the From: value to use along the way.
- $text_headers = ''; // text representation of headers
- $from = null;
-
- foreach ($headers as $key => $val) {
- if ($key == 'From') {
- include_once 'Mail/RFC822.php';
-
- $from_arr = Mail_RFC822::parseAddressList($val, 'localhost', false);
- $from = $from_arr[0]->mailbox . '@' . $from_arr[0]->host;
- if (strstr($from, ' ')) {
- // Reject outright envelope From addresses with spaces.
- return false;
- }
- $text_headers .= $key . ': ' . $val . "\n";
- } else if ($key == 'Received') {
- // put Received: headers at the top, since Receieved:
- // after Subject: in the header order is somtimes used
- // as a spam trap.
- $text_headers = $key . ': ' . $val . "\n" . $text_headers;
- } else {
- $text_headers .= $key . ': ' . $val . "\n";
- }
- }
-
- return array($from, $text_headers);
- }
-
- /**
- * Take a set of recipients and parse them, returning an array of
- * bare addresses (forward paths) that can be passed to sendmail
- * or an smtp server with the rcpt to: command.
- *
- * @param mixed Either a comma-seperated list of recipients
- * (RFC822 compliant), or an array of recipients,
- * each RFC822 valid.
- *
- * @return array An array of forward paths (bare addresses).
- * @access protected
- */
- function parseRecipients($recipients)
- {
- include_once 'Mail/RFC822.php';
-
- // if we're passed an array, assume addresses are valid and
- // implode them before parsing.
- if (is_array($recipients)) {
- $recipients = implode(', ', $recipients);
- }
-
- // Parse recipients, leaving out all personal info. This is
- // for smtp recipients, etc. All relevant personal information
- // should already be in the headers.
- $addresses = Mail_RFC822::parseAddressList($recipients, 'localhost', false);
- $recipients = array();
- if (is_array($addresses)) {
- foreach ($addresses as $ob) {
- $recipients[] = $ob->mailbox . '@' . $ob->host;
- }
- }
-
- return $recipients;
- }
-
-}
-?>
diff --git a/pear/Makefile.in b/pear/Makefile.in
deleted file mode 100644
index 898674974f..0000000000
--- a/pear/Makefile.in
+++ /dev/null
@@ -1,191 +0,0 @@
-
-install_targets = \
- install-data-local \
- install-headers \
- install-build \
- install-programs
-
-include $(top_srcdir)/build/rules.mk
-
-peardir=$(PEAR_INSTALLDIR)
-
-PEAR_SUBDIRS = \
- Benchmark \
- Cache \
- Cache/Container \
- Console \
- Crypt \
- Date \
- DB \
- File \
- HTML \
- HTTP \
- Image \
- Log \
- Mail \
- Math \
- Net \
- Numbers \
- Payment \
- PEAR \
- Schedule \
- XML \
- XML/RPC
-
-PEAR_FILES = \
- Benchmark/Iterate.php \
- Benchmark/Timer.php \
- Cache.php \
- Cache/Container.php \
- Cache/Function.php \
- Cache/Graphics.php \
- Cache/Output.php \
- Cache/Error.php \
- Cache/OutputCompression.php \
- Cache/Container/db.php \
- Cache/Container/dbx.php \
- Cache/Container/file.php \
- Cache/Container/phplib.php \
- Cache/Container/shm.php \
- Console/Getopt.php \
- Crypt/CBC.php \
- Crypt/HCEMD5.php \
- Date/Calc.php \
- Date/Human.php \
- DB.php \
- DB/common.php \
- DB/ibase.php \
- DB/ifx.php \
- DB/msql.php \
- DB/mssql.php \
- DB/mysql.php \
- DB/oci8.php \
- DB/odbc.php \
- DB/pgsql.php \
- DB/storage.php \
- DB/sybase.php \
- File/Find.php \
- File/Passwd.php \
- File/SearchReplace.php \
- HTML/Common.php \
- HTML/Form.php \
- HTML/IT.php \
- HTML/ITX.php \
- HTML/Page.php \
- HTML/Processor.php \
- HTML/Select.php \
- HTML/Table.php \
- HTTP.php \
- HTTP/Compress.php \
- Image/Remote.php \
- Log.php \
- Log/composite.php \
- Log/file.php \
- Log/mcal.php \
- Log/observer.php \
- Log/sql.php \
- Log/syslog.php \
- Mail.php \
- Mail/RFC822.php \
- Mail/sendmail.php \
- Mail/smtp.php \
- Math/Fraction.php \
- Math/Util.php \
- Net/Curl.php \
- Net/Dig.php \
- Net/SMTP.php \
- Net/Socket.php \
- Numbers/Roman.php \
- PEAR.php \
- PEAR/Common.php \
- PEAR/Installer.php \
- PEAR/Packager.php \
- PEAR/Uploader.php \
- Payment/Verisign.php \
- Schedule/At.php \
- XML/Parser.php \
- XML/RPC.php \
- XML/RPC/Server.php
-
-install-data-local:
- @if $(mkinstalldirs) $(INSTALL_ROOT)$(peardir); then \
- for i in $(PEAR_SUBDIRS); do \
- (set -x;$(mkinstalldirs) $(INSTALL_ROOT)$(peardir)/$$i); \
- done; \
- for i in $(PEAR_FILES); do \
- dir=`echo $$i|sed 's%[^/][^/]*$$%%'`; \
- (set -x;$(INSTALL_DATA) $(srcdir)/$$i $(INSTALL_ROOT)$(peardir)/$$dir); \
- done; \
- else \
- cat $(srcdir)/install-pear.txt; \
- exit 5; \
- fi
-
-phpincludedir = $(includedir)/php
-phpbuilddir = $(prefix)/lib/php/build
-
-BUILD_FILES = \
- pear/pear.m4 \
- build/fastgen.sh \
- build/library.mk \
- build/ltlib.mk \
- build/mkdep.awk \
- build/program.mk \
- build/rules.mk \
- build/rules_common.mk \
- build/rules_pear.mk \
- build/dynlib.mk \
- build/shtool \
- dynlib.m4 \
- acinclude.m4
-
-bin_SCRIPTS = phpize php-config pear pearize
-
-install-build:
- $(mkinstalldirs) $(INSTALL_ROOT)$(phpbuilddir) $(INSTALL_ROOT)$(bindir) && \
- (cd $(top_srcdir) && cp $(BUILD_FILES) $(INSTALL_ROOT)$(phpbuilddir))
-
-install-programs:
- for prog in $(bin_SCRIPTS); do \
- $(INSTALL) -m 755 scripts/$$prog $(INSTALL_ROOT)$(bindir)/$$prog; \
- done; \
- for prog in phpextdist; do \
- $(INSTALL) -m 755 $(srcdir)/scripts/$$prog $(INSTALL_ROOT)$(bindir)/$$prog; \
- done
-
-HEADER_DIRS = \
- / \
- Zend \
- TSRM \
- ext/standard \
- ext/xml \
- ext/xml/expat/xmlparse \
- ext/xml/expat/xmltok \
- main \
- regex
-
-install-headers:
- -@for i in $(HEADER_DIRS); do \
- paths="$$paths $(INSTALL_ROOT)$(phpincludedir)/$$i"; \
- done; \
- $(mkinstalldirs) $$paths && \
- echo "creating header file hierarchy" && \
- for i in $(HEADER_DIRS); do \
- (cd $(top_srcdir)/$$i && cp -p *.h $(INSTALL_ROOT)$(phpincludedir)/$$i; \
- cd $(top_builddir)/$$i && cp -p *.h $(INSTALL_ROOT)$(phpincludedir)/$$i) 2>/dev/null || true; \
- done
-
-Makefile: Makefile.in $(top_builddir)/config.status
- (cd ..;CONFIG_FILES=pear/Makefile CONFIG_HEADERS= $(top_builddir)/config.status)
-
-scripts/pear: scripts/pear.in $(top_builddir)/config.status
- (cd ..;CONFIG_FILES=pear/scripts/pear CONFIG_HEADERS= $(top_builddir)/config.status)
-
-scripts/phpize: scripts/phpize.in $(top_builddir)/config.status
- (cd ..;CONFIG_FILES=pear/scripts/phpize CONFIG_HEADERS= $(top_builddir)/config.status)
-
-scripts/pearize: scripts/pearize.in $(top_builddir)/config.status
- (cd ..;CONFIG_FILES=pear/scripts/pearize CONFIG_HEADERS= $(top_builddir)/config.status)
-
-scripts/php-config: scripts/php-config.in $(top_builddir)/config.status
- (cd ..;CONFIG_FILES=pear/scripts/php-config CONFIG_HEADERS= $(top_builddir)/config.status)
diff --git a/pear/PEAR.php b/pear/PEAR.php
deleted file mode 100644
index 659c59d59a..0000000000
--- a/pear/PEAR.php
+++ /dev/null
@@ -1,606 +0,0 @@
-<?php
-//
-// +----------------------------------------------------------------------+
-// | PHP version 4.0 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1997-2001 The PHP Group |
-// +----------------------------------------------------------------------+
-// | This source file is subject to version 2.0 of the PHP license, |
-// | that is bundled with this package in the file LICENSE, and is |
-// | available at through the world-wide-web at |
-// | http://www.php.net/license/2_02.txt. |
-// | If you did not receive a copy of the PHP license and are unable to |
-// | obtain it through the world-wide-web, please send a note to |
-// | license@php.net so we can mail you a copy immediately. |
-// +----------------------------------------------------------------------+
-// | Authors: Sterling Hughes <sterling@php.net> |
-// | Stig Bakken <ssb@fast.no> |
-// +----------------------------------------------------------------------+
-//
-// $Id$
-//
-
-define('PEAR_ERROR_RETURN', 1);
-define('PEAR_ERROR_PRINT', 2);
-define('PEAR_ERROR_TRIGGER', 4);
-define('PEAR_ERROR_DIE', 8);
-define('PEAR_ERROR_CALLBACK', 16);
-
-if (substr(PHP_OS, 0, 3) == 'WIN') {
- define('OS_WINDOWS', true);
- define('OS_UNIX', false);
- define('PEAR_OS', 'Windows');
-} else {
- define('OS_WINDOWS', false);
- define('OS_UNIX', true);
- define('PEAR_OS', 'Unix'); // blatant assumption
-}
-
-$GLOBALS['_PEAR_default_error_mode'] = PEAR_ERROR_RETURN;
-$GLOBALS['_PEAR_default_error_options'] = E_USER_NOTICE;
-$GLOBALS['_PEAR_default_error_callback'] = '';
-$GLOBALS['_PEAR_destructor_object_list'] = array();
-
-//
-// Tests needed: - PEAR inheritance
-// - destructors
-//
-
-/**
- * Base class for other PEAR classes. Provides rudimentary
- * emulation of destructors.
- *
- * If you want a destructor in your class, inherit PEAR and make a
- * destructor method called _yourclassname (same name as the
- * constructor, but with a "_" prefix). Also, in your constructor you
- * have to call the PEAR constructor: <code>$this->PEAR();</code>.
- * The destructor method will be called without parameters. Note that
- * at in some SAPI implementations (such as Apache), any output during
- * the request shutdown (in which destructors are called) seems to be
- * discarded. If you need to get any debug information from your
- * destructor, use <code>error_log()</code>, <code>syslog()</code> or
- * something like that instead.
- *
- * @since PHP 4.0.2
- * @author Stig Bakken <ssb@fast.no>
- */
-class PEAR
-{
- // {{{ properties
-
- var $_debug = false;
- var $_default_error_mode = null;
- var $_default_error_options = null;
- var $_default_error_handler = '';
- var $_error_class = 'PEAR_Error';
-
- // }}}
-
- // {{{ constructor
-
- /**
- * Constructor. Registers this object in
- * $_PEAR_destructor_object_list for destructor emulation if a
- * destructor object exists.
- */
- function PEAR($error_class = null)
- {
- $classname = get_class($this);
- if ($this->_debug) {
- print "PEAR constructor called, class=$classname\n";
- }
- if ($error_class !== null) {
- $this->_error_class = $error_class;
- }
- while ($classname) {
- $destructor = "_$classname";
- if (method_exists($this, $destructor)) {
- global $_PEAR_destructor_object_list;
- $_PEAR_destructor_object_list[] = &$this;
- break;
- } else {
- $classname = get_parent_class($classname);
- }
- }
- }
-
- // }}}
- // {{{ destructor
-
- /**
- * Destructor (the emulated type of...). Does nothing right now,
- * but is included for forward compatibility, so subclass
- * destructors should always call it.
- *
- * See the note in the class desciption about output from
- * destructors.
- *
- * @access public
- */
- function _PEAR() {
- if ($this->_debug) {
- printf("PEAR destructor called, class=%s\n",
- get_class($this));
- }
- }
-
- // }}}
- // {{{ isError()
-
- /**
- * Tell whether a value is a PEAR error.
- *
- * @param $data the value to test
- * @access public
- * @return bool true if $data is an error
- */
- function isError($data) {
- return (bool)(is_object($data) &&
- (get_class($data) == "pear_error" ||
- is_subclass_of($data, "pear_error")));
- }
-
- // }}}
- // {{{ setErrorHandling()
-
- /**
- * Sets how errors generated by this DB object should be handled.
- * Can be invoked both in objects and statically. If called
- * statically, setErrorHandling sets the default behaviour for all
- * PEAR objects. If called in an object, setErrorHandling sets
- * the default behaviour for that object.
- *
- * @param $mode int
- * one of PEAR_ERROR_RETURN, PEAR_ERROR_PRINT,
- * PEAR_ERROR_TRIGGER, PEAR_ERROR_DIE or
- * PEAR_ERROR_CALLBACK.
- *
- * @param $options mixed
- * Ignored unless $mode is PEAR_ERROR_TRIGGER or
- * PEAR_ERROR_CALLBACK. When $mode is PEAR_ERROR_TRIGGER,
- * this parameter is expected to be an integer and one of
- * E_USER_NOTICE, E_USER_WARNING or E_USER_ERROR. When
- * $mode is PEAR_ERROR_CALLBACK, this parameter is expected
- * to be the callback function or method. A callback
- * function is a string with the name of the function, a
- * callback method is an array of two elements: the element
- * at index 0 is the object, and the element at index 1 is
- * the name of the method to call in the object.
- *
- * @see PEAR_ERROR_RETURN
- * @see PEAR_ERROR_PRINT
- * @see PEAR_ERROR_TRIGGER
- * @see PEAR_ERROR_DIE
- * @see PEAR_ERROR_CALLBACK
- *
- * @since PHP 4.0.5
- */
-
- function setErrorHandling($mode, $options = null)
- {
- if (isset($this)) {
- $setmode = &$this->_default_error_mode;
- $setoptions = &$this->_default_error_options;
- $setcallback = &$this->_default_error_callback;
- } else {
- $setmode = &$GLOBALS['_PEAR_default_error_mode'];
- $setoptions = &$GLOBALS['_PEAR_default_error_options'];
- $setcallback = &$GLOBALS['_PEAR_default_error_callback'];
- }
-
- switch ($mode) {
- case PEAR_ERROR_RETURN:
- case PEAR_ERROR_PRINT:
- case PEAR_ERROR_TRIGGER:
- case PEAR_ERROR_DIE:
- case null:
- $setmode = $mode;
- $setoptions = $options;
- break;
-
- case PEAR_ERROR_CALLBACK:
- $setmode = $mode;
- if ((is_string($options) && function_exists($options)) ||
- (is_array($options) && method_exists(@$options[0], @$options[1])))
- {
- $setcallback = $options;
- } else {
- trigger_error("invalid error callback", E_USER_WARNING);
- }
- break;
-
- default:
- trigger_error("invalid error mode", E_USER_WARNING);
- break;
- }
- }
-
- // }}}
- // {{{ raiseError()
-
- /**
- * This method is a wrapper that returns an instance of the
- * configured error class with this object's default error
- * handling applied. If the $mode and $options parameters are not
- * specified, the object's defaults are used.
- *
- * @param $message a text error message
- * @param $code a numeric error code (it is up to your class
- * to define these if you want to use codes)
- * @param $mode One of PEAR_ERROR_RETURN, PEAR_ERROR_PRINT,
- * PEAR_ERROR_TRIGGER, PEAR_ERROR_DIE or
- * PEAR_ERROR_CALLBACK.
- * @param $options If $mode is PEAR_ERROR_TRIGGER, this parameter
- * specifies the PHP-internal error level (one of
- * E_USER_NOTICE, E_USER_WARNING or E_USER_ERROR).
- * If $mode is PEAR_ERROR_CALLBACK, this
- * parameter specifies the callback function or
- * method. In other error modes this parameter
- * is ignored.
- * @param $userinfo If you need to pass along for example debug
- * information, this parameter is meant for that.
- * @param $error_class The returned error object will be instantiated
- * from this class, if specified.
- * @param $skipmsg If true, raiseError will only pass error codes,
- * the error message parameter will be dropped.
- *
- *
- * @return object a PEAR error object
- *
- * @see PEAR::setErrorHandling
- *
- * @since PHP 4.0.5
- */
-
- function &raiseError($message = null,
- $code = null,
- $mode = null,
- $options = null,
- $userinfo = null,
- $error_class = null,
- $skipmsg = false)
- {
- if ($mode === null) {
- if (isset($this) && isset($this->_default_error_mode)) {
- $mode = $this->_default_error_mode;
- } else {
- $mode = $GLOBALS['_PEAR_default_error_mode'];
- }
- }
-
- if ($mode == PEAR_ERROR_TRIGGER && $options === null) {
- if (isset($this) && isset($this->_default_error_options)) {
- $options = $this->_default_error_options;
- } else {
- $options = $GLOBALS['_PEAR_default_error_options'];
- }
- }
-
- if ($mode == PEAR_ERROR_CALLBACK) {
- if (!is_string($options) &&
- !(is_array($options) && sizeof($options) == 2 &&
- is_object($options[0]) && is_string($options[1]))) {
- if (isset($this) && isset($this->_default_error_callback)) {
- $options = $this->_default_error_callback;
- } else {
- $options = $GLOBALS['_PEAR_default_error_callback'];
- }
- }
- } else {
- if ($options === null) {
- if (isset($this) && isset($this->_default_error_options)) {
- $options = $this->_default_error_options;
- } else {
- $options = $GLOBALS['_PEAR_default_error_options'];
- }
- }
- }
- if ($error_class !== null) {
- $ec = $error_class;
- } elseif (isset($this) && isset($this->_error_class)) {
- $ec = $this->_error_class;
- } else {
- $ec = 'PEAR_Error';
- }
- if ($skipmsg) {
- return new $ec($code, $mode, $options, $userinfo);
- } else {
- return new $ec($message, $code, $mode, $options, $userinfo);
- }
- }
-
- // }}}
-}
-
-// {{{ _PEAR_call_destructors()
-
-function _PEAR_call_destructors()
-{
- global $_PEAR_destructor_object_list;
- if (is_array($_PEAR_destructor_object_list) &&
- sizeof($_PEAR_destructor_object_list))
- {
- reset($_PEAR_destructor_object_list);
- while (list($k, $objref) = each($_PEAR_destructor_object_list)) {
- $classname = get_class($objref);
- while ($classname) {
- $destructor = "_$classname";
- if (method_exists($objref, $destructor)) {
- $objref->$destructor();
- break;
- } else {
- $classname = get_parent_class($classname);
- }
- }
- }
- // Empty the object list to ensure that destructors are
- // not called more than once.
- $_PEAR_destructor_object_list = array();
- }
-}
-
-// }}}
-
-class PEAR_Error
-{
- // {{{ properties
-
- var $error_message_prefix = '';
- var $error_prepend = '';
- var $error_append = '';
- var $mode = PEAR_ERROR_RETURN;
- var $level = E_USER_NOTICE;
- var $code = -1;
- var $message = '';
- var $debuginfo = '';
-
- // Wait until we have a stack-groping function in PHP.
- //var $file = '';
- //var $line = 0;
-
-
- // }}}
- // {{{ constructor
-
- /**
- * PEAR_Error constructor
- *
- * @param $message error message
- *
- * @param $code (optional) error code
- *
- * @param $mode (optional) error mode, one of: PEAR_ERROR_RETURN,
- * PEAR_ERROR_PRINT, PEAR_ERROR_DIE, PEAR_ERROR_TRIGGER or
- * PEAR_ERROR_CALLBACK
- *
- * @param $level (optional) error level, _OR_ in the case of
- * PEAR_ERROR_CALLBACK, the callback function or object/method
- * tuple.
- *
- * @access public
- *
- */
- function PEAR_Error($message = "unknown error", $code = null,
- $mode = null, $options = null, $userinfo = null)
- {
- if ($mode === null) {
- $mode = PEAR_ERROR_RETURN;
- }
- $this->message = $message;
- $this->code = $code;
- $this->mode = $mode;
- $this->userinfo = $userinfo;
- if ($mode & PEAR_ERROR_CALLBACK) {
- $this->level = E_USER_NOTICE;
- $this->callback = $options;
- } else {
- if ($options === null) {
- $options = E_USER_NOTICE;
- }
- $this->level = $options;
- $this->callback = null;
- }
- if ($this->mode & PEAR_ERROR_PRINT) {
- print $this->getMessage();
- }
- if ($this->mode & PEAR_ERROR_TRIGGER) {
- trigger_error($this->getMessage(), $this->level);
- }
- if ($this->mode & PEAR_ERROR_DIE) {
- $msg = $this->getMessage();
- if (substr($msg, -1) != "\n") {
- $msg .= "\n";
- }
- die($msg);
- }
- if ($this->mode & PEAR_ERROR_CALLBACK) {
- if (is_string($this->callback) && strlen($this->callback)) {
- call_user_func($this->callback, $this);
- } elseif (is_array($this->callback) &&
- sizeof($this->callback) == 2 &&
- is_object($this->callback[0]) &&
- is_string($this->callback[1]) &&
- strlen($this->callback[1])) {
- call_user_method($this->callback[1], $this->callback[0],
- $this);
- }
- }
- }
-
- // }}}
- // {{{ getMode()
-
- /**
- * Get the error mode from an error object.
- *
- * @return int error mode
- * @access public
- */
- function getMode() {
- return $this->mode;
- }
-
- // }}}
- // {{{ getCallback()
-
- /**
- * Get the callback function/method from an error object.
- *
- * @return mixed callback function or object/method array
- * @access public
- */
- function getCallback() {
- return $this->callback;
- }
-
- // }}}
- // {{{ getMessage()
-
-
- /**
- * Get the error message from an error object.
- *
- * @return string full error message
- * @access public
- */
- function getMessage ()
- {
- return ($this->error_prepend . $this->error_message_prefix .
- $this->message . $this->error_append);
- }
-
-
- // }}}
- // {{{ getCode()
-
- /**
- * Get error code from an error object
- *
- * @return int error code
- * @access public
- */
- function getCode()
- {
- return $this->code;
- }
-
- // }}}
- // {{{ getType()
-
- /**
- * Get the name of this error/exception.
- *
- * @return string error/exception name (type)
- * @access public
- */
- function getType ()
- {
- return get_class($this);
- }
-
- // }}}
- // {{{ getUserInfo()
-
- /**
- * Get additional user-supplied information.
- *
- * @return string user-supplied information
- * @access public
- */
- function getUserInfo ()
- {
- return $this->userinfo;
- }
-
- // }}}
- // {{{ getDebugInfo()
-
- /**
- * Get additional debug information supplied by the application.
- *
- * @return string debug information
- * @access public
- */
- function getDebugInfo ()
- {
- return $this->getUserInfo();
- }
-
- // }}}
- // {{{ addUserInfo()
-
- function addUserInfo($info)
- {
- if (empty($this->userinfo)) {
- $this->userinfo = $info;
- } else {
- $this->userinfo .= " ** $info";
- }
- }
-
- // }}}
- // {{{ toString()
-
- /**
- * Make a string representation of this object.
- *
- * @return string a string with an object summary
- * @access public
- */
- function toString() {
- $modes = array();
- $levels = array(E_USER_NOTICE => "notice",
- E_USER_WARNING => "warning",
- E_USER_ERROR => "error");
- if ($this->mode & PEAR_ERROR_CALLBACK) {
- if (is_array($this->callback)) {
- $callback = get_class($this->callback[0]) . "::" .
- $this->callback[1];
- } else {
- $callback = $this->callback;
- }
- return sprintf('[%s: message="%s" code=%d mode=callback '.
- 'callback=%s prefix="%s" prepend="%s" append="%s" '.
- 'info="%s"]',
- get_class($this), $this->message, $this->code,
- $callback, $this->error_message_prefix,
- $this->error_prepend, $this->error_append,
- $this->debuginfo);
- }
- if ($this->mode & PEAR_ERROR_CALLBACK) {
- $modes[] = "callback";
- }
- if ($this->mode & PEAR_ERROR_PRINT) {
- $modes[] = "print";
- }
- if ($this->mode & PEAR_ERROR_TRIGGER) {
- $modes[] = "trigger";
- }
- if ($this->mode & PEAR_ERROR_DIE) {
- $modes[] = "die";
- }
- if ($this->mode & PEAR_ERROR_RETURN) {
- $modes[] = "return";
- }
- return sprintf('[%s: message="%s" code=%d mode=%s level=%s prefix="%s" '.
- 'prepend="%s" append="%s" info="%s"]',
- get_class($this), $this->message, $this->code,
- implode("|", $modes), $levels[$this->level],
- $this->error_message_prefix,
- $this->error_prepend, $this->error_append,
- $this->userinfo);
- }
-
- // }}}
-}
-
-register_shutdown_function("_PEAR_call_destructors");
-
-/*
- * Local Variables:
- * mode: c++
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
-?>
diff --git a/pear/PEAR/Common.php b/pear/PEAR/Common.php
deleted file mode 100644
index 6b3bf3dc5a..0000000000
--- a/pear/PEAR/Common.php
+++ /dev/null
@@ -1,187 +0,0 @@
-<?php
-//
-// +----------------------------------------------------------------------+
-// | PHP version 4.0 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1997-2001 The PHP Group |
-// +----------------------------------------------------------------------+
-// | This source file is subject to version 2.02 of the PHP license, |
-// | that is bundled with this package in the file LICENSE, and is |
-// | available at through the world-wide-web at |
-// | http://www.php.net/license/2_02.txt. |
-// | If you did not receive a copy of the PHP license and are unable to |
-// | obtain it through the world-wide-web, please send a note to |
-// | license@php.net so we can mail you a copy immediately. |
-// +----------------------------------------------------------------------+
-// | Authors: Stig Bakken <ssb@fast.no> |
-// | |
-// +----------------------------------------------------------------------+
-//
-
-require_once "PEAR.php";
-
-class PEAR_Common extends PEAR
-{
- // {{{ properties
-
- /** stack of elements, gives some sort of XML context */
- var $element_stack;
-
- /** name of currently parsed XML element */
- var $current_element;
-
- /** array of attributes of the currently parsed XML element */
- var $current_attributes = array();
-
- /** list of temporary files created by this object */
- var $_tempfiles = array();
-
- /** assoc with information about a package */
- var $pkginfo = array();
-
- // }}}
-
- // {{{ constructor
-
- function PEAR_Common()
- {
- $this->PEAR();
- }
-
- // }}}
- // {{{ destructor
-
- function _PEAR_Common() {
- $this->_PEAR();
- while (is_array($this->_tempfiles) &&
- $file = array_shift($this->_tempfiles))
- {
- if (is_dir($file)) {
- system("rm -rf $file"); // XXX FIXME Windows
- } else {
- unlink($file);
- }
- }
- }
-
- // }}}
- // {{{ addTempFile()
-
- function addTempFile($file)
- {
- $this->_tempfiles[] = $file;
- }
-
- // }}}
- // {{{ _element_start()
-
- function _element_start($xp, $name, $attribs)
- {
- array_push($this->element_stack, $name);
- $this->current_element = $name;
- $this->current_attributes = $attribs;
- }
-
- // }}}
- // {{{ _element_end()
-
- function _element_end($xp, $name)
- {
- array_pop($this->element_stack);
- $this->current_element = $this->element_stack[sizeof($this->element_stack)-1];
- }
-
- // }}}
- // {{{ _pkginfo_cdata()
-
- function _pkginfo_cdata($xp, $data)
- {
- $next = $this->element_stack[sizeof($this->element_stack)-1];
- switch ($this->current_element) {
- case "Name":
- switch ($next) {
- case "Package":
- $this->pkginfo["package"] .= $data;
- break;
- case "Maintainer":
- $this->pkginfo["maintainer_name"] .= $data;
- break;
- }
- break;
- case "Summary":
- $this->pkginfo["summary"] .= $data;
- break;
- case "Initials":
- $this->pkginfo["maintainer_handle"] .= $data;
- break;
- case "Email":
- $this->pkginfo["maintainer_email"] .= $data;
- break;
- case "Version":
- $this->pkginfo["version"] .= $data;
- break;
- case "Date":
- $this->pkginfo["release_date"] .= $data;
- break;
- case "Notes":
- $this->pkginfo["release_notes"] .= $data;
- break;
- case "Dir":
- if (!$this->phpdir) {
- break;
- }
- $dir = trim($data);
- // XXX add to file list
- break;
- case "File":
- $role = strtolower($this->current_attributes["Role"]);
- $file = trim($data);
- // XXX add to file list
- break;
- }
- }
-
- // }}}
- // {{{ infoFromDescriptionFile()
-
- function infoFromDescriptionFile($descfile)
- {
- $fp = fopen($descfile, "r");
- $xp = @xml_parser_create();
- if (!$xp) {
- return $this->raiseError("Unable to create XML parser.");
- }
- xml_set_object($xp, $this);
- xml_set_element_handler($xp, "_element_start", "_element_end");
- xml_set_character_data_handler($xp, "_pkginfo_cdata");
- xml_parser_set_option($xp, XML_OPTION_CASE_FOLDING, false);
-
- $this->element_stack = array();
- $this->pkginfo = array();
- $this->current_element = false;
- $this->destdir = '';
-
- // read the whole thing so we only get one cdata callback
- // for each block of cdata
- $data = fread($fp, filesize($descfile));
- if (!@xml_parse($xp, $data, 1)) {
- $msg = sprintf("XML error: %s at line %d",
- xml_error_string(xml_get_error_code($xp)),
- xml_get_current_line_number($xp));
- xml_parser_free($xp);
- return $this->raiseError($msg);
- }
-
- xml_parser_free($xp);
-
- foreach ($this->pkginfo as $k => $v) {
- $this->pkginfo[$k] = trim($v);
- }
-
- return $this->pkginfo;
- }
-
- // }}}
-}
-
-?>
diff --git a/pear/PEAR/Installer.php b/pear/PEAR/Installer.php
deleted file mode 100644
index 5a650a4ba3..0000000000
--- a/pear/PEAR/Installer.php
+++ /dev/null
@@ -1,535 +0,0 @@
-<?php
-//
-// +----------------------------------------------------------------------+
-// | PHP version 4.0 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1997-2001 The PHP Group |
-// +----------------------------------------------------------------------+
-// | This source file is subject to version 2.02 of the PHP license, |
-// | that is bundled with this package in the file LICENSE, and is |
-// | available at through the world-wide-web at |
-// | http://www.php.net/license/2_02.txt. |
-// | If you did not receive a copy of the PHP license and are unable to |
-// | obtain it through the world-wide-web, please send a note to |
-// | license@php.net so we can mail you a copy immediately. |
-// +----------------------------------------------------------------------+
-// | Authors: Stig Bakken <ssb@fast.no> |
-// | |
-// +----------------------------------------------------------------------+
-//
-
-require_once "PEAR/Common.php";
-
-/**
- * Administration class used to install PEAR packages and maintain the
- * installed package database.
- *
- * @since PHP 4.0.2
- * @author Stig Bakken <ssb@fast.no>
- */
-class PEAR_Installer extends PEAR_Common
-{
- // {{{ properties
-
- /** name of the package directory, for example Foo-1.0 */
- var $pkgdir;
-
- /** directory where PHP code files go */
- var $phpdir;
-
- /** directory where PHP extension files go */
- var $extdir;
-
- /** directory where documentation goes */
- var $docdir;
-
- /** directory where system state information goes */
- var $statedir;
-
- /** directory where the package wants to put files, relative
- * to one of the three previous dirs
- */
- var $destdir = '';
-
- /** debug level (integer) */
- var $debug = 1;
-
- /** list of installed packages */
- var $pkglist = array();
-
- /** temporary directory */
- var $tmpdir;
-
- /** file pointer for package list file if open */
- var $pkglist_fp;
-
- // }}}
-
- // {{{ constructor
-
- function PEAR_Installer($phpdir = PEAR_INSTALL_DIR,
- $extdir = PEAR_EXTENSION_DIR,
- $docdir = '')
- {
- $this->PEAR();
- $this->phpdir = $phpdir;
- $this->extdir = $extdir;
- $this->docdir = $docdir;
- $this->statedir = "/var/lib/php"; // XXX FIXME Windows
- $this->loadPackageList("$this->statedir/packages.lst");
- }
-
- // }}}
- // {{{ destructor
-
- function _PEAR_Installer()
- {
- if ($this->tmpdir && is_dir($this->tmpdir)) {
- system("rm -rf $this->tmpdir"); // XXX FIXME Windows
- }
- if ($this->pkglist_fp && is_resource($this->pkglist_fp)) {
- flock($this->pkglist_fp, LOCK_UN);
- fclose($this->pkglist_fp);
- }
- $this->tmpdir = null;
- $this->pkglist_fp = null;
- $this->_PEAR_Common();
- }
-
- // }}}
-
- // {{{ mkDirHier()
-
- function mkDirHier($dir)
- {
- $dirstack = array();
- while (!@is_dir($dir) && $dir != DIRECTORY_SEPARATOR) {
- array_unshift($dirstack, $dir);
- $dir = dirname($dir);
- }
- while ($newdir = array_shift($dirstack)) {
- if (mkdir($newdir, 0777)) {
- $this->log(1, "created dir $newdir");
- } else {
- return $this->raiseError("mkdir($newdir) failed");
- }
- }
- }
-
- // }}}
- // {{{ log()
-
- function log($level, $msg)
- {
- if ($this->debug >= $level) {
- print "$msg\n";
- }
- }
-
- // }}}
-
- // {{{ lockPackageList()
-
- function lockPackageList()
- {
- $fp = $this->pkglist_fp;
- if (!is_resource($fp)) {
- $this->pkglist_fp = $fp = fopen($this->pkglist_file, "r");
- }
- return flock($fp, LOCK_EX);
- }
-
- // }}}
- // {{{ unlockPackageList()
-
- function unlockPackageList()
- {
- $fp = $this->pkglist_fp;
- if (!is_resource($fp)) {
- $this->pkglist_fp = $fp = fopen($this->pkglist_file, "r");
- $doclose = true;
- }
- $ret = flock($fp, LOCK_EX);
- if ($doclose) {
- fclose($fp);
- }
- return $ret;
- }
-
- // }}}
- // {{{ loadPackageList()
-
- function loadPackageList($file)
- {
- $this->pkglist_file = $file;
- $this->pkglist = array();
- if (!file_exists($file)) {
- if (!@touch($file)) {
- return $this->raiseError("touch($file): $php_errormsg");
- }
- }
- $fp = $this->pkglist_fp = @fopen($file, "r");
- if (!is_resource($fp)) {
- return $this->raiseError("fopen($file): $php_errormsg");
- }
- $this->lockPackageList();
- $versionline = trim(fgets($fp, 2048));
- if ($versionline == ";1") {
- while ($line = fgets($fp, 2048)) {
- list($name, $version, $file) = explode(";", trim($line));
- $this->pkglist[$name]["version"] = $version;
- $this->pkglist[$name]["files"][] = $file;
- }
- }
- $this->unlockPackageList();
- }
-
- // }}}
- // {{{ savePackageList()
-
- function savePackageList()
- {
- $fp = $this->pkglist_fp;
- $wfp = @fopen($this->pkglist_file, "w");
- if (!is_resource($wfp)) {
- return $this->raiseError("could not write $this->pkglist_file");
- }
- if (is_resource($fp)) {
- fclose($fp);
- }
- $this->pkglist_fp = $fp = $wfp;
- fwrite($fp, ";1\n");
- foreach ($this->pkglist as $name => $entry) {
- $ver = $entry["version"];
- foreach ($entry["files"] as $file) {
- fwrite($fp, "$name;$ver;$file\n");
- }
- }
- fclose($fp);
- $this->pkglist_fp = $fp = null;
- }
-
- // }}}
- // {{{ updatePackageListFrom()
-
- function updatePackageListFrom($file)
- {
- /*
- $new = $this->classesDeclaredBy($file);
- reset($new);
- while (list($i, $name) = each($new)) {
- $this->pkglist['class'][$name] = $file;
- }
- */
- }
-
- // }}}
-
- // {{{ install()
-
- /**
- * Installs the files within the package file specified.
- *
- * @param $pkgfile path to the package file
- *
- * @return bool true if successful, false if not
- */
- function install($pkgfile)
- {
- if (preg_match('#^(http|ftp)://#', $pkgfile)) {
- $need_download = true;
- } elseif (!file_exists($pkgfile)) {
- return $this->raiseError("$pkgfile: no such file");
- }
-
- if ($need_download) {
- $file = basename($pkgfile);
- // XXX FIXME use ??? on Windows, use $TMPDIR on unix
- $downloaddir = "/tmp/pearinstall";
- $this->mkDirHier($downloaddir);
- $downloadfile = $downloaddir.DIRECTORY_SEPARATOR.$file;
- $this->log(1, "downloading $pkgfile...");
- $fp = @fopen($pkgfile, "r");
- if (!$fp) {
- return $this->raiseError("$pkgfile: failed to download ($php_errormsg)");
- }
- $wp = @fopen($downloadfile, "w");
- if (!$wp) {
- return $this->raiseError("$downloadfile: write failed ($php_errormsg)");
- }
- $this->addTempFile($downloadfile);
- $bytes = 0;
- while ($data = @fread($fp, 16384)) {
- $bytes += strlen($data);
- if (!@fwrite($wp, $data)) {
- return $this->raiseError("$downloadfile: write failed ($php_errormsg)");
- }
- }
- $pkgfile = $downloadfile;
- fclose($fp);
- fclose($wp);
- $this->log(1, "...done, $bytes bytes");
- }
- // XXX FIXME depends on external gzip+tar
- $fp = popen("gzip -dc $pkgfile | tar -tf -", "r");
- if (!$fp) {
- return $this->raiseError("Unable to examine $pkgfile (gzip or tar failed)");
- }
- while ($line = fgets($fp, 4096)) {
- $line = rtrim($line);
- if (preg_match('!^[^/]+/package.xml$!', $line)) {
- if ($descfile) {
- return $this->raiseError("Invalid package: multiple package.xml files at depth one!");
- }
- $descfile = $line;
- }
- }
- pclose($fp);
-
- if (!$descfile) {
- return $this->raiseError("Invalid package: no package.xml file found!");
- }
-
- // XXX FIXME Windows
- $this->tmpdir = tempnam("/tmp", "pear");
- unlink($this->tmpdir);
- if (!mkdir($this->tmpdir, 0755)) {
- return $this->raiseError("Unable to create temporary directory $this->tmpdir.");
- }
- $this->addTempFile($this->tmpdir);
- $pwd = getcwd();
-
- // XXX FIXME Windows should check for drive
- if (substr($pkgfile, 0, 1) == DIRECTORY_SEPARATOR) {
- $pkgfilepath = $pkgfile;
- } else {
- $pkgfilepath = $pwd.DIRECTORY_SEPARATOR.$pkgfile;
- }
-
- if (!chdir($this->tmpdir)) {
- return $this->raiseError("Unable to chdir to $this->tmpdir.");
- }
-
- system("gzip -dc $pkgfilepath | tar -xf -");
-
- if (!file_exists($descfile)) {
- return $this->raiseError("Huh? No package.xml file after extracting the archive.");
- }
-
- $this->pkgdir = dirname($descfile);
-
- $fp = fopen($descfile, "r");
- $xp = xml_parser_create();
- if (!$xp) {
- return $this->raiseError("Unable to create XML parser.");
- }
- xml_set_object($xp, &$this);
- xml_set_element_handler($xp, "startHandler", "endHandler");
- xml_set_character_data_handler($xp, "charHandler");
- xml_parser_set_option($xp, XML_OPTION_CASE_FOLDING, false);
-
- $this->element_stack = array();
- $this->pkginfo = array();
- $this->current_element = false;
- $this->destdir = '';
-
- $data = fread($fp, filesize($descfile));
- if (!xml_parse($xp, $data, 1)) {
- $msg = sprintf("XML error: %s at line %d",
- xml_error_string(xml_get_error_code($xp)),
- xml_get_current_line_number($xp));
- xml_parser_free($xp);
- return $this->raiseError($msg);
- }
-
- xml_parser_free($xp);
- return true;
- }
-
- // }}}
- // {{{ startHandler()
-
- function startHandler($xp, $name, $attribs)
- {
- array_push($this->element_stack, $name);
- $this->current_element = $name;
- $this->current_attributes = $attribs;
- switch ($name) {
- case "Package":
-/*
- if (strtolower($attribs["Type"]) != "binary") {
- return $this->raiseError("Invalid package: only binary packages supported yet.");
- }
- $this->pkginfo['pkgtype'] = strtolower($attribs["Type"]);
-*/
- break;
- }
- }
-
- // }}}
- // {{{ endHandler()
-
- function endHandler($xp, $name)
- {
- array_pop($this->element_stack);
- $this->current_element = $this->element_stack[sizeof($this->element_stack)-1];
- }
-
- // }}}
- // {{{ charHandler()
-
- function charHandler($xp, $data)
- {
- $next = $this->element_stack[sizeof($this->element_stack)-1];
- switch ($this->current_element) {
- case "Name":
- if ($next == "Package") {
- $this->pkginfo["name"] = $data;
- }
- break;
- case "Version":
- $this->pkginfo["version"] = $data;
- break;
- case "Dir":
- if (!$this->phpdir) {
- return $this->raiseError("No script destination directory found\n",
- null, PEAR_ERROR_DIE);
- break;
- }
- $type = $this->current_attributes["Type"];
- $dir = trim($data);
- $d = "$this->phpdir/$this->destdir/$dir";
- if (substr($dir, 0, 1) == "/") {
- $this->destdir = substr($dir, 1);
- } else {
- $this->destdir = $dir;
- }
- break;
-
- case "File":
- if (!$this->phpdir) {
- return $this->raiseError("No script destination directory found\n",
- null, PEAR_ERROR_DIE);
- break;
- }
- $type = strtolower($this->current_attributes["Role"]);
- $file = trim($data);
- $updatepkglist = false;
- switch ($type) {
- case "test":
- $d = ""; // don't install test files for now
- break;
- default:
- if ($this->destdir) {
- $d = "$this->phpdir/$this->destdir";
- } else {
- $d = $this->phpdir;
- }
- $updatepkglist = true;
- break;
- }
- if (!$d) {
- break;
- }
- if (!@is_dir($d)) {
- $this->mkDirHier($d);
- }
- $bfile = basename($file);
- if (!copy("$this->pkgdir/$file", "$d/$bfile")) {
- $this->log(0, "failed to copy $this->pkgdir/$file to $d");
- break;
- }
- if ($updatepkglist) {
- $this->updatePackageListFrom("$d/$file");
- }
- $this->log(1, "installed $d/$bfile");
- break;
- }
- }
-
- // }}}
-
- // {{{ classesDeclaredBy()
-
- /**
- * Find out which new classes are defined by a file.
- *
- * @param $file file name passed to "include"
- *
- * @return array classes that were defined
- */
- function classesDeclaredBy($file)
- {
- $before = get_declared_classes();
- ob_start();
- include($file);
- ob_end_clean();
- $after = get_declared_classes();
- // using array_slice to renumber array
- $diff = array_slice(array_diff($after, $before), 0);
- return $diff;
- }
-
- // }}}
-
- // {{{ declaredWhenIncluding()
-
- /**
- * Find out which new classes are defined by a file.
- *
- * @param $file file name passed to "include"
- *
- * @return array classes that were defined
- */
- function &declaredWhenIncluding($file)
- {
- $classes_before = get_declared_classes();
- $funcs_before = get_defined_functions();
-// $vars_before = $GLOBALS;
- ob_start();
- include($file);
- ob_end_clean();
- $classes_after = get_declared_classes();
- $funcs_after = get_defined_functions();
-// $vars_after = $GLOBALS;
- //using array_slice to renumber array
- return array(
- "classes" => array_slice(array_diff($classes_after, $classes_before), 0),
- "functions" => array_slice(array_diff($funcs_after, $funcs_before), 0),
-// "globals" => array_slice(array_diff($vars_after, $vars_before), 0)
- );
- }
-
- // }}}
-
- // {{{ lockDir()
-
- /**
- * Uses advisory locking (flock) to temporarily claim $dir as its
- * own.
- *
- * @param $dir the directory to lock
- *
- * @return bool true if successful, false if not
- */
- function lockDir($dir)
- {
- $lockfile = "$dir/.lock";
- if (!file_exists($lockfile)) {
- if (!touch($lockfile)) {
- // could not create lockfile!
- return false;
- }
- }
- $fp = fopen($lockfile, "r");
- if (!flock($fp, LOCK_EX)) {
- // could not create lock!
- return false;
- }
- return true;
- }
-
- // }}}
-}
-
-?>
diff --git a/pear/PEAR/Packager.php b/pear/PEAR/Packager.php
deleted file mode 100644
index 6e8ae88ddd..0000000000
--- a/pear/PEAR/Packager.php
+++ /dev/null
@@ -1,312 +0,0 @@
-<?php
-//
-// +----------------------------------------------------------------------+
-// | PHP version 4.0 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1997-2001 The PHP Group |
-// +----------------------------------------------------------------------+
-// | This source file is subject to version 2.02 of the PHP license, |
-// | that is bundled with this package in the file LICENSE, and is |
-// | available at through the world-wide-web at |
-// | http://www.php.net/license/2_02.txt. |
-// | If you did not receive a copy of the PHP license and are unable to |
-// | obtain it through the world-wide-web, please send a note to |
-// | license@php.net so we can mail you a copy immediately. |
-// +----------------------------------------------------------------------+
-// | Authors: Stig Bakken <ssb@fast.no> |
-// | |
-// +----------------------------------------------------------------------+
-//
-
-require_once "PEAR.php";
-
-/**
- * Administration class used to make a PEAR release tarball.
- *
- * @since PHP 4.0.2
- * @author Stig Bakken <ssb@fast.no>
- */
-class PEAR_Packager extends PEAR
-{
- // {{{ properties
-
- /** XML_Parser object */
- var $parser;
-
- /** stack of elements, gives some sort of XML context */
- var $element_stack;
-
- /** name of currently parsed XML element */
- var $current_element;
-
- /** array of attributes of the currently parsed XML element */
- var $current_attributes = array();
-
- /** assoc with information about the package */
- var $pkginfo = array();
-
- /** name of the package directory, for example Foo-1.0 */
- var $pkgdir;
-
- /** directory where PHP code files go */
- var $phpdir;
-
- /** directory where PHP extension files go */
- var $extdir;
-
- /** directory where documentation goes */
- var $docdir;
-
- /** directory where system state information goes */
- var $statedir;
-
- /** debug mode (integer) */
- var $debug = 0;
-
- /** temporary directory */
- var $tmpdir;
-
- /** whether file list is currently being copied */
- var $recordfilelist;
-
- /** temporary space for copying file list */
- var $filelist;
-
- /** package name and version, for example "HTTP-1.0" */
- var $pkgver;
-
- // }}}
-
- // {{{ constructor
-
- function PEAR_Packager($phpdir = PEAR_INSTALL_DIR,
- $extdir = PEAR_EXTENSION_DIR,
- $docdir = '')
- {
- $this->PEAR();
- $this->phpdir = $phpdir;
- $this->extdir = $extdir;
- $this->docdir = $docdir;
- }
-
- // }}}
- // {{{ destructor
-
- function _PEAR_Packager() {
- $this->_PEAR();
- while (is_array($this->_tempfiles) &&
- $file = array_shift($this->_tempfiles))
- {
- if (is_dir($file)) {
- system("rm -rf $file"); // XXX FIXME Windows
- } else {
- unlink($file);
- }
- }
- }
-
- // }}}
-
- // {{{ package()
-
- function package($pkgfile = "package.xml")
- {
- $pwd = getcwd();
- $fp = @fopen($pkgfile, "r");
- if (!is_resource($fp)) {
- return $this->raiseError($php_errormsg);
- }
-
- $xp = xml_parser_create();
- if (!$xp) {
- return $this->raiseError("Unable to create XML parser.");
- }
- xml_set_object($xp, $this);
- xml_set_element_handler($xp, "startHandler", "endHandler");
- xml_set_character_data_handler($xp, "charHandler");
- xml_parser_set_option($xp, XML_OPTION_CASE_FOLDING, false);
- xml_parser_set_option($xp, XML_OPTION_TARGET_ENCODING, "UTF-8");
-
- $this->element_stack = array();
- $this->pkginfo = array();
- $this->current_element = false;
-
- $data = fread($fp, filesize($pkgfile));
- fclose($fp);
- if (!xml_parse($xp, $data, true)) {
- $msg = sprintf("XML error: %s at line %d",
- xml_error_string(xml_get_error_code($xp)),
- xml_get_current_line_number($xp));
- xml_parser_free($xp);
- return $this->raiseError($msg);
- }
- xml_parser_free($xp);
-
- $pkginfofile = $this->tmpdir . DIRECTORY_SEPARATOR . "package.xml";
- $fp = fopen($pkginfofile, "w");
- if (!is_resource($fp)) {
- return $this->raiseError("Could not create $pkginfofile: $php_errormsg");
- }
-
- $this->filelist = preg_replace('/^[\r\n]+\s+/', ' ', $this->filelist);
- $this->filelist = preg_replace('/\n\s+/', "\n ", $this->filelist);
- $this->filelist = preg_replace('/\n\s+$/', "", $this->filelist);
-
- fputs($fp, "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n".
- "<!DOCTYPE Package PUBLIC \"-//PHP Group//DTD PEAR Package 1.0//EN//XML\" \"http://php.net/pear/package.dtd\">\n".
- "<Package Type=\"Source\">\n".
- " <Name>".$this->pkginfo["Package,Name"]."</Name>\n".
- " <Summary>".$this->pkginfo["Package,Summary"]."</Summary>\n".
- " <Maintainer>\n".
- " <Initials>".$this->pkginfo["Maintainer,Initials"]."</Initials>\n".
- " <Name>".$this->pkginfo["Maintainer,Name"]."</Name>\n".
- " <Email>".$this->pkginfo["Maintainer,Email"]."</Email>\n".
- " </Maintainer>\n".
- " <Release>\n".
- " <Version>".$this->pkginfo["Release,Version"]."</Version>\n".
- " <Date>".$this->pkginfo["Release,Date"]."</Date>\n".
- " <Notes>".$this->pkginfo["Release,Notes"]."</Notes>\n".
- " </Release>\n".
- " <FileList>\n".
- "$this->filelist\n".
- " </FileList>\n".
- "</Package>\n");
- fclose($fp);
- chdir(dirname($this->tmpdir));
- // XXX FIXME Windows and non-GNU tar
- $pkgver = quotemeta($this->pkgver);
- system("tar -cvzf $pwd/${pkgver}.tgz $pkgver");
- }
-
- // }}}
-
- // {{{ mkDirHier()
-
- function mkDirHier($dir)
- {
- $dirstack = array();
- while (!is_dir($dir) && $dir != DIRECTORY_SEPARATOR) {
- array_unshift($dirstack, $dir);
- $dir = dirname($dir);
- }
- while ($newdir = array_shift($dirstack)) {
- if (mkdir($newdir, 0777)) {
- $this->log(1, "created dir $newdir");
- } else {
- return $this->raiseError("mkdir($newdir) failed");
- }
- }
- }
-
- // }}}
- // {{{ log()
-
- function log($level, $msg)
- {
- if ($this->debug >= $level) {
- print "$msg\n";
- }
- }
-
- // }}}
-
- // {{{ startHandler()
-
- function startHandler($xp, $name, $attribs)
- {
- array_push($this->element_stack, $name);
- $this->current_element = $name;
- $this->current_attributes = $attribs;
- $this->tmpdata = '';
- if ($this->recordfilelist) {
- $this->filelist .= "<$name";
- foreach ($attribs as $k => $v) {
- $this->filelist .= " $k=\"$v\"";
- }
- $this->filelist .= ">";
- }
- switch ($name) {
- case "Package":
- if ($attribs["Type"]) {
- // warning
- }
- break;
- case "FileList":
- // XXX FIXME Windows
- $this->recordfilelist = true;
- $pwd = getcwd();
- $this->pkgver = $this->pkginfo["Package,Name"] . "-" .
- $this->pkginfo["Release,Version"];
- $this->tmpdir = $pwd . DIRECTORY_SEPARATOR . $this->pkgver;
- if (file_exists($this->tmpdir)) {
- xml_parser_free($xp);
- $this->raiseError("$this->tmpdir already exists",
- null, PEAR_ERROR_TRIGGER,
- E_USER_ERROR);
- }
- if (!mkdir($this->tmpdir, 0755)) {
- xml_parser_free($xp);
- $this->raiseError("Unable to create temporary directory $this->tmpdir.",
- null, PEAR_ERROR_TRIGGER,
- E_USER_ERROR);
- }
- $this->_tempfiles[] = $this->tmpdir;
- break;
- }
- }
-
- // }}}
- // {{{ endHandler()
-
- function endHandler($xp, $name)
- {
- array_pop($this->element_stack);
- $this->current_element = $this->element_stack[sizeof($this->element_stack)-1];
- switch ($name) {
- case "FileList":
- $this->recordfilelist = false;
- break;
- }
- if ($this->recordfilelist) {
- $this->filelist .= "</$name>";
- }
- }
-
- // }}}
- // {{{ charHandler()
-
- function charHandler($xp, $data)
- {
- if ($this->recordfilelist) {
- $this->filelist .= $data;
- }
- switch ($this->current_element) {
- case "Dir":
- break;
- case "File":
- $file = "$this->tmpdir/$data";
- $dir = dirname($file);
- if (!is_dir($dir)) {
- if (!$this->mkDirHier($dir)) {
- $this->log(0, "could not mkdir $dir");
- break;
- }
- }
- if (!@copy($data, $file)) {
- $this->log(0, "could not copy $data to $file");
- }
- // fall through
- default:
- $data = trim($data);
- if ($data) {
- $id = implode(",", array_slice($this->element_stack, -2));
- $this->pkginfo[$id] = $data;
- }
- break;
- }
- }
-
- // }}}
-}
-
-?>
diff --git a/pear/PEAR/Uploader.php b/pear/PEAR/Uploader.php
deleted file mode 100644
index 593a92d01b..0000000000
--- a/pear/PEAR/Uploader.php
+++ /dev/null
@@ -1,61 +0,0 @@
-<?php
-//
-// +----------------------------------------------------------------------+
-// | PHP version 4.0 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1997-2001 The PHP Group |
-// +----------------------------------------------------------------------+
-// | This source file is subject to version 2.02 of the PHP license, |
-// | that is bundled with this package in the file LICENSE, and is |
-// | available at through the world-wide-web at |
-// | http://www.php.net/license/2_02.txt. |
-// | If you did not receive a copy of the PHP license and are unable to |
-// | obtain it through the world-wide-web, please send a note to |
-// | license@php.net so we can mail you a copy immediately. |
-// +----------------------------------------------------------------------+
-// | Authors: Stig Bakken <ssb@fast.no> |
-// | |
-// +----------------------------------------------------------------------+
-//
-
-require_once "PEAR/Common.php";
-
-/**
- * Administration class used to install PEAR packages and maintain the
- * installed package database.
- *
- * @since PHP 4.0.2
- * @author Stig Bakken <ssb@fast.no>
- */
-class PEAR_Uploader extends PEAR_Common
-{
- // {{{ properties
-
- var $_tempfiles = array();
-
- // }}}
-
- // {{{ constructor
-
- function PEAR_Uploader()
- {
- $this->PEAR_Common();
- }
-
- // }}}
-
- function upload($pkgfile, $infofile = null)
- {
- if ($infofile === null) {
- $info = $this->infoFromTarBall($pkgfile);
- } else {
- $info = $this->infoFromDescriptionFile($infofile);
- }
- if (PEAR::isError($info)) {
- return $info;
- }
-
- }
-}
-
-?>
diff --git a/pear/README b/pear/README
deleted file mode 100644
index bed22c7106..0000000000
--- a/pear/README
+++ /dev/null
@@ -1,34 +0,0 @@
- PEAR - PHP Extension and Application Repository
- ===============================================
- Dedicated to Malin Bakken, born 1999-11-21
-
-WHAT IS PEAR?
-
-PEAR is a code repository for PHP extensions and PHP library code
-similar to TeX's CTAN and Perl's CPAN.
-
-The intention behind PEAR is to provide a means for library code
-authors to organize their code in a defined way shared by other
-developers, and to give the PHP community a single source for such
-code.
-
-
-ADMINISTRATION
-
-This section will describe the rules for how files are structured and
-how functions and classes should be named.
-
-
-TOOLS
-
-This section will describe the tools provided to PEAR users.
-
-
-CODING RULES AND GUIDELINES
-
-* All PHP code must use <?php ?>. This is the only really portable tag.
-
-* Before adding a new top-level directory ("DB" is one), discuss your
- intentions on php-pear@lists.php.net.
-
-* Please see the CODING_STANDARDS file for full rules and guidelines.
diff --git a/pear/TODO b/pear/TODO
deleted file mode 100644
index 64dde1b275..0000000000
--- a/pear/TODO
+++ /dev/null
@@ -1,20 +0,0 @@
-TODO file for PEAR. Last modified $Date$ by $Author$
-
-Legend:
-
--: noone actively working on this right now
-W: work in progress by NN
-
-Infrastructure stuff:
-
-- finish database design
-W ssb make XML DTD for package description files
-- build web site for uploading/downloading packages and XML
- description files
-W ssb build tools for installing packages from the net
-
-Bundled PEAR packages:
-
-W ssb make regression tests for DB
-- make DB_Error store queries
-W uw implement Javadoc -> phpdoc/DocBook conversion
diff --git a/pear/catalog b/pear/catalog
deleted file mode 100644
index 6e0c69d40b..0000000000
--- a/pear/catalog
+++ /dev/null
@@ -1 +0,0 @@
-PUBLIC "-//PHP Group//DTD PEAR Package 1.0//EN//XML" "package.dtd"
diff --git a/pear/install-pear.txt b/pear/install-pear.txt
deleted file mode 100644
index 3cb9338a40..0000000000
--- a/pear/install-pear.txt
+++ /dev/null
@@ -1,11 +0,0 @@
-+----------------------------------------------------------------------+
-| The installation process is incomplete. The following resources were |
-| not installed: |
-| |
-| Self-contained Extension Support |
-| PEAR: PHP Extension and Add-on Repository |
-| |
-| To install these components, become the superuser and execute: |
-| |
-| # make install-su |
-+----------------------------------------------------------------------+
diff --git a/pear/package.dtd b/pear/package.dtd
deleted file mode 100644
index e45c436dea..0000000000
--- a/pear/package.dtd
+++ /dev/null
@@ -1,125 +0,0 @@
-<!--
- $Id: package.dtd,v 1.6 2001-05-28 11:14:47 ssb Exp $
-
- This is the PEAR package description, version 1.1b1.
- It should be used with the informal public identifier:
-
- "-//PHP Group//DTD PEAR Package 1.1b1//EN//XML"
-
- Copyright (c) 1997-2001 The PHP Group
-
- This source file is subject to version 2.02 of the PHP license,
- that is bundled with this package in the file LICENSE, and is
- available at through the world-wide-web at
- http://www.php.net/license/2_02.txt.
- If you did not receive a copy of the PHP license and are unable to
- obtain it through the world-wide-web, please send a note to
- license@php.net so we can mail you a copy immediately.
-
- Authors:
- Stig S. Bakken <ssb@fast.no>
-
- -->
-<!--============== attributes present in all elements ======================-->
-<!ENTITY % global.atts "id ID #IMPLIED">
-<!--============== attributes common to several elements ===================-->
-<!ENTITY % role.atts "Role (php|ext|test|doc) 'php'">
-<!ENTITY % extension.atts "Debug (on|off) 'off'
- ThreadSafe (on|off) 'off'">
-<!ENTITY % format.atts "Format CDATA #IMPLIED">
-<!--=============== ELEMENT: Package =======================================-->
-<!ELEMENT Package (Name, Summary, Maintainer, Release, FileList)>
-<!ATTLIST Package
- %global.atts;
- Type (Source | Binary | Empty) "Empty"
->
-<!--=============== ELEMENT: Name ==========================================-->
-<!ELEMENT Name (#PCDATA)>
-<!ATTLIST Name
- %global.atts;
->
-<!--=============== ELEMENT: Summary =======================================-->
-<!ELEMENT Summary (#PCDATA)>
-<!ATTLIST Summary
- %global.atts;
->
-<!--=============== ELEMENT: Maintainer ====================================-->
-<!ELEMENT Maintainer (Initials, Name, Email)>
-<!ATTLIST Maintainer
- %global.atts;
->
-<!--=============== ELEMENT: Initials ======================================-->
-<!ELEMENT Initials (#PCDATA)>
-<!ATTLIST Initials
- %global.atts;
->
-<!--=============== ELEMENT: Email =========================================-->
-<!ELEMENT Email (#PCDATA)>
-<!ATTLIST Email
- %global.atts;
->
-<!--=============== ELEMENT: Release =======================================-->
-<!ELEMENT Release (Version, Date, Notes?)>
-<!ATTLIST Release
- %global.atts;
->
-<!--=============== ELEMENT: Version =======================================-->
-<!ELEMENT Version (#PCDATA)>
-<!ATTLIST Version
- %global.atts;
->
-<!--=============== ELEMENT: Date =========================================-->
-<!ELEMENT Date (#PCDATA)>
-<!ATTLIST Date
- %global.atts;
->
-<!--=============== ELEMENT: Notes =========================================-->
-<!ELEMENT Notes (#PCDATA)>
-<!ATTLIST Notes
- %global.atts;
->
-<!--=============== ELEMENT: FileList ======================================-->
-<!ELEMENT FileList (Dir | File | LibFile)*>
-<!ATTLIST FileList
- %global.atts;
->
-<!--=============== ELEMENT: Dir ===========================================-->
-<!ELEMENT Dir (#PCDATA)>
-<!ATTLIST Dir
- %global.atts;
->
-<!--=============== ELEMENT: File ==========================================-->
-<!ELEMENT File (#PCDATA)>
-<!ATTLIST File
- %global.atts;
- %role.atts;
- %extension.atts;
- %format.atts;
->
-<!--=============== ELEMENT: LibFile =======================================-->
-<!ELEMENT LibFile (LibName,Sources,Includes?,LibAdd?)>
-<!ATTLIST LibFile
- %global.atts;
- %role.atts;
->
-<!--=============== ELEMENT: LibFile =======================================-->
-<!ELEMENT LibFile (LibName,Sources,Includes?,LibAdd?)>
-<!ATTLIST LibFile
- %global.atts;
- %role.atts;
->
-<!--=============== ELEMENT: LibName =======================================-->
-<!ELEMENT LibName (#PCDATA)>
-<!ATTLIST LibName
- %global.atts;
->
-<!--=============== ELEMENT: Sources =======================================-->
-<!ELEMENT Sources (#PCDATA)>
-<!ATTLIST Sources
- %global.atts;
->
-<!--=============== ELEMENT: LibAdd ========================================-->
-<!ELEMENT LibAdd (#PCDATA)>
-<!ATTLIST LibAdd
- %global.atts;
->
diff --git a/pear/pear.m4 b/pear/pear.m4
deleted file mode 100644
index 92ec102bb6..0000000000
--- a/pear/pear.m4
+++ /dev/null
@@ -1,87 +0,0 @@
-
-AC_INIT(Makefile.in)
-
-AC_DEFUN(PHP_WITH_PHP_CONFIG,[
- AC_ARG_WITH(php-config,
-[ --with-php-config=PATH],[
- PHP_CONFIG=$withval
-],[
- PHP_CONFIG=php-config
-])
-
- prefix=`$PHP_CONFIG --prefix 2>/dev/null`
- INCLUDES=`$PHP_CONFIG --includes 2>/dev/null`
- EXTENSION_DIR=`$PHP_CONFIG --extension-dir`
-
- if test -z "$prefix"; then
- AC_MSG_ERROR(Cannot find php-config. Please use --with-php-config=PATH)
- fi
- AC_MSG_CHECKING(for PHP prefix)
- AC_MSG_RESULT($prefix)
- AC_MSG_CHECKING(for PHP includes)
- AC_MSG_RESULT($INCLUDES)
- AC_MSG_CHECKING(for PHP extension directory)
- AC_MSG_RESULT($EXTENSION_DIR)
-])
-
-abs_srcdir=`(cd $srcdir && pwd)`
-
-php_always_shared=yes
-
-AC_PROG_CC
-AC_PROG_CC_C_O
-
-PHP_WITH_PHP_CONFIG
-
-AC_PREFIX_DEFAULT()
-
-sinclude(config.m4)
-
-enable_static=no
-enable_shared=yes
-
-AC_PROG_LIBTOOL
-
-SHARED_LIBTOOL='$(LIBTOOL)'
-PHP_COMPILE='$(LIBTOOL) --mode=compile $(COMPILE) -c $<'
-phplibdir="`pwd`/modules"
-CPPFLAGS="$CPPFLAGS -DHAVE_CONFIG_H"
-
-test "$prefix" = "NONE" && prefix="/usr/local"
-test "$exec_prefix" = "NONE" && exec_prefix='$(prefix)'
-
-PHP_SUBST(prefix)
-PHP_SUBST(exec_prefix)
-PHP_SUBST(libdir)
-PHP_SUBST(prefix)
-PHP_SUBST(phplibdir)
-
-PHP_SUBST(PHP_COMPILE)
-PHP_SUBST(CC)
-PHP_SUBST(CFLAGS)
-PHP_SUBST(CPP)
-PHP_SUBST(CPPFLAGS)
-PHP_SUBST(CXX)
-PHP_SUBST(DEFS)
-PHP_SUBST(EXTENSION_DIR)
-PHP_SUBST(EXTRA_LDFLAGS)
-PHP_SUBST(EXTRA_LIBS)
-PHP_SUBST(INCLUDES)
-PHP_SUBST(LEX)
-PHP_SUBST(LEX_OUTPUT_ROOT)
-PHP_SUBST(LFLAGS)
-PHP_SUBST(SHARED_LIBTOOL)
-PHP_SUBST(LIBTOOL)
-PHP_SUBST(SHELL)
-
-PHP_FAST_OUTPUT(Makefile)
-
-PHP_GEN_CONFIG_VARS
-PHP_GEN_MAKEFILES($PHP_FAST_OUTPUT_FILES)
-
-test -d modules || mkdir modules
-touch .deps
-
-AC_CONFIG_HEADER(config.h)
-
-AC_OUTPUT()
diff --git a/pear/scripts/pear.in b/pear/scripts/pear.in
deleted file mode 100644
index 41fdde598d..0000000000
--- a/pear/scripts/pear.in
+++ /dev/null
@@ -1,116 +0,0 @@
-#!@prefix@/bin/php -Cq
-<?php // -*- C++ -*-
-//
-// +----------------------------------------------------------------------+
-// | PHP version 4.0 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1997-2001 The PHP Group |
-// +----------------------------------------------------------------------+
-// | This source file is subject to version 2.02 of the PHP license, |
-// | that is bundled with this package in the file LICENSE, and is |
-// | available at through the world-wide-web at |
-// | http://www.php.net/license/2_02.txt. |
-// | If you did not receive a copy of the PHP license and are unable to |
-// | obtain it through the world-wide-web, please send a note to |
-// | license@php.net so we can mail you a copy immediately. |
-// +----------------------------------------------------------------------+
-// | Authors: Stig Bakken <ssb@fast.no> |
-// | Tomas V.V.Cox <cox@idecnet.com> |
-// +----------------------------------------------------------------------+
-//
-require_once 'PEAR.php';
-require_once 'PEAR/Installer.php';
-require_once 'PEAR/Packager.php';
-require_once 'Console/Getopt.php';
-
-error_reporting(E_ALL ^ E_NOTICE);
-
-$options = Console_Getopt::getopt($argv, "h?v:e:p:d:");
-if (PEAR::isError($options)) {
- usage($options);
-}
-
-$opts = $options[0];
-foreach ($opts as $opt) {
- $param = $opt[1];
- switch ($opt[0]) {
- case 'v':
- $verbose = $param;
- break;
- case 'e':
- if ($param{0} != DIRECTORY_SEPARATOR) {
- usage (new PEAR_Error("no absolute path (ej. /usr/lib/php)\n"));
- }
- $ext_dir = $param;
- break;
- case 'p':
- if ($param{0} != DIRECTORY_SEPARATOR) {
- usage (new PEAR_Error("no absolute path (ej. /usr/lib/php)\n"));
- }
- $script_dir = $param;
- break;
- case 'd':
- if ($param{0} != DIRECTORY_SEPARATOR) {
- usage (new PEAR_Error("no absolute path (ej. /usr/lib/php)\n"));
- }
- $doc_dir = $param;
- break;
- }
-}
-
-$verbose = (isset($verbose)) ? $verbose : 1;
-$script_dir = (isset($script_dir)) ? $script_dir : PEAR_INSTALL_DIR;
-$ext_dir = (isset($ext_dir)) ? $ext_dir : PEAR_EXTENSION_DIR;
-$doc_dir = (isset($doc_dir)) ? $doc_dir : '';
-
-PEAR::setErrorHandling(PEAR_ERROR_PRINT);
-$command = $options[1][1];
-switch ($command) {
- case 'install':
- $package = $options[1][2];
- $installer =& new PEAR_Installer($script_dir, $ext_dir, $doc_dir);
- $installer->debug = $verbose;
- if (PEAR::isError($installer->Install($package))) {
- print "\ninstall failed\n";
- } else {
- print "install ok\n";
- }
- break;
- case 'package':
- $pkginfofile = $options[1][2];
- $packager =& new PEAR_Packager($script_dir, $ext_dir, $doc_dir);
- $packager->debug = $verbose;
- if (PEAR::isError($packager->Package($pkginfofile))) {
- print "\npackage failed\n";
- } else {
- print "package ok\n";
- }
- break;
- default:
- usage();
- break;
-}
-
-function usage($obj = null)
-{
- $stderr = fopen('php://stderr', 'w');
- if ($obj !== null) {
- fputs($stderr, $obj->getMessage());
- }
- fputs($stderr,
- "Usage: pear [-v n] [-h] [-p <dir>] [-e <dir>] [-d <dir>] command <parameters>\n".
- "Options:\n".
- " -v set verbosity level to <n> (0-2, default 1)\n".
- " -p <dir> set script install dir (absolute path)\n".
- " -e <dir> set extension install dir (absolute path)\n".
- " -d <dir> set documentation dest dir (absolute path)\n".
- " -h, -? display help/usage (this message)\n".
- "Commands:\n".
- " install <package file>\n".
- " package [package info file]\n".
- "\n");
- fclose($stderr);
- exit;
-}
-
-?>
diff --git a/pear/scripts/pearize.in b/pear/scripts/pearize.in
deleted file mode 100644
index 0f03d21083..0000000000
--- a/pear/scripts/pearize.in
+++ /dev/null
@@ -1,165 +0,0 @@
-#!@prefix@/bin/php -Cq
-<?php // -*- PHP -*-
-
-main($argc, $argv, $HTTP_ENV_VARS);
-
-// {{{ main()
-
-function main(&$argc, &$argv, &$env)
-{
- $file = check_options($argc, $argv, $env);
- parse_package_file($file);
- make_makefile_in($env);
-}
-
-// }}}
-// {{{ check_options()
-
-function check_options(&$argc, &$argv, &$env)
-{
- $file = $argv[1];
- if (empty($file)) {
- $file = "package.xml";
- }
- return $file;
-}
-
-// }}}
-// {{{ make_makefile_in()
-
-function make_makefile_in(&$env)
-{
- global $libdata;
- if (sizeof($libdata) == 0) {
- exit;
- } elseif (sizeof($libdata) > 1) {
- die("No support yet for multiple libraries in one package.\n");
- }
-
- $wp = @fopen("Makefile.in", "w");
- if (is_resource($wp)) {
- print "Creating Makefile.in...";
- flush();
- } else {
- die("Could not create Makefile.in in current directory.\n");
- }
-
- foreach ($libdata as $lib => $info) {
- extract($info);
- $_who = $env["USER"];
- $_when = gmdate('Y-m-d h:i');
- fwrite($wp, "\
-# This file was generated by `pearize' by $_who at $_when GMT
-INCLUDES = $includes
-LTLIBRARY_NAME = lib{$lib}.la
-LTLIBRARY_SOURCES = $sources
-LTLIBRARY_SHARED_NAME = {$lib}.la
-LTLIBRARY_SHARED_LIBADD = $libadd
-
-include \$(top_srcdir)/build/dynlib.mk
-");
- }
- fclose($wp);
- print "done.\n";
-}
-
-// }}}
-// {{{ parse_package_file()
-
-function parse_package_file($file)
-{
- global $in_file, $curlib, $curelem, $libdata, $cdata;
-
- $in_file = false;
- $curlib = '';
- $curelem = '';
- $libdata = array();
- $cdata = array();
-
- $xp = xml_parser_create();
- xml_set_element_handler($xp, "start_handler", "end_handler");
- xml_set_character_data_handler($xp, "cdata_handler");
- xml_parser_set_option($xp, XML_OPTION_CASE_FOLDING, false);
-
- $fp = @fopen($file, "r");
- if (!is_resource($fp)) {
- die("Could not open file `$file'.\n");
- }
- while (!feof($fp)) {
- xml_parse($xp, fread($fp, 2048), feof($fp));
- }
- xml_parser_free($xp);
-}
-
-// }}}
-// {{{ start_handler()
-
-function start_handler($xp, $elem, $attrs)
-{
- global $cdata, $in_file, $curelem;
- switch ($elem) {
- case "File": {
- switch ($attrs['Role']) {
- case "ext": {
- $in_file = true;
- $cdata = array();
- break;
- }
- case "php": default: {
- break;
- }
- }
- break;
- }
- case "Includes":
- case "LibName":
- case "LibAdd":
- case "Sources": {
- $curelem = $elem;
- break;
- }
- }
-}
-
-// }}}
-// {{{ end_handler()
-
-function end_handler($xp, $elem)
-{
- global $in_file, $curlib, $curelem, $libdata, $cdata;
- switch ($elem) {
- case "File": {
- if ($in_file === true) {
- $libname = trim($cdata['LibName']);
- $libdata[$libname] = array(
- "sources" => trim($cdata['Sources']),
- "includes" => trim($cdata['Includes']),
- "libadd" => trim($cdata['LibAdd']),
- );
- $in_file = false;
- }
- break;
- }
- }
-}
-
-// }}}
-// {{{ cdata_handler()
-
-function cdata_handler($xp, $data)
-{
- global $curelem, $cdata;
- switch ($curelem) {
- case "Includes":
- case "LibAdd":
- case "LibName":
- case "Sources": {
- $cdata[$curelem] .= $data;
- break;
- }
- }
-}
-
-// }}}
-
-?>
diff --git a/pear/scripts/php-config.in b/pear/scripts/php-config.in
deleted file mode 100644
index 62acb5ac68..0000000000
--- a/pear/scripts/php-config.in
+++ /dev/null
@@ -1,23 +0,0 @@
-#! /bin/sh
-
-prefix="@prefix@"
-includedir="@includedir@/php"
-includes="-I$includedir -I$includedir/main -I$includedir/Zend"
-if test '@TSRM_DIR@' != ''; then
- includes="$includes -I$includedir/TSRM"
-fi
-extension_dir='@EXTENSION_DIR@'
-
-case "$1" in
---prefix)
- echo $prefix;;
---includes)
- echo $includes;;
---extension-dir)
- echo $extension_dir;;
-*)
- echo "Usage: $0 [--prefix|--includes|--extension-dir]"
- exit 1;;
-esac
-
-exit 0
diff --git a/pear/scripts/phpextdist b/pear/scripts/phpextdist
deleted file mode 100755
index 97df70020d..0000000000
--- a/pear/scripts/phpextdist
+++ /dev/null
@@ -1,27 +0,0 @@
-#! /bin/sh
-if test $# -lt 2; then
- echo "usage: phpextdist <extension> <version>";
- exit 1
-fi
-
-phpize=`php-config --prefix`/bin/phpize
-distname="$1-$2"
-
-if test ! -f Makefile.in || test ! -f config.m4; then
- echo "Did not find required files in current directory"
- exit 1
-fi
-
-rm -rf modules *.lo *.o *.la config.status config.cache \
-config.log libtool php_config.h config_vars.mk Makefile
-
-myname=`basename \`pwd\``
-cd ..
-cp -rp $myname $distname
-cd $distname
-$phpize
-cd ..
-tar cf $distname.tar $distname
-rm -rf $distname $distname.tar.*
-gzip --best $distname.tar
-mv $distname.tar.gz $myname
diff --git a/pear/scripts/phpize.in b/pear/scripts/phpize.in
deleted file mode 100644
index 33b5ad2cfb..0000000000
--- a/pear/scripts/phpize.in
+++ /dev/null
@@ -1,31 +0,0 @@
-#! /bin/sh
-
-prefix='@prefix@'
-phpdir="$prefix/lib/php/build"
-builddir="`pwd`"
-FILES_BUILD="dynlib.mk fastgen.sh library.mk ltlib.mk mkdep.awk program.mk rules.mk rules_common.mk rules_pear.mk shtool"
-FILES="acinclude.m4 dynlib.m4"
-
-if test ! -r config.m4; then
- echo "Cannot find config.m4. "
- echo "Make sure that you run $0 in the top level source directory of the module"
- exit 1
-fi
-
-test -d build || mkdir build
-
-(cd $phpdir && cp $FILES_BUILD $builddir/build)
-(cd $phpdir && cp $FILES $builddir)
-
-mv build/rules_pear.mk build/rules.mk
-
-sed \
--e "s#@prefix@#$prefix#" \
-< $phpdir/pear.m4 > configure.in
-
-touch install-sh mkinstalldirs missing
-
-aclocal
-autoconf
-autoheader
-libtoolize -f -c
diff --git a/pear/tests/PEAR.r b/pear/tests/PEAR.r
deleted file mode 100644
index e8210eee35..0000000000
--- a/pear/tests/PEAR.r
+++ /dev/null
@@ -1,3 +0,0 @@
-test class __TestPEAR1
-PEAR constructor called, class=__testpear1
-string(11) "__testpear1"
diff --git a/pear/tests/PEAR.t b/pear/tests/PEAR.t
deleted file mode 100644
index 6c8346adc7..0000000000
--- a/pear/tests/PEAR.t
+++ /dev/null
@@ -1,16 +0,0 @@
-<?php // -*- C++ -*-
-
-require_once "PEAR.php";
-
-class __TestPEAR1 extends PEAR {
- function __TestPEAR1() {
- $this->_debug = true;
- $this->PEAR();
- }
-}
-
-print "test class __TestPEAR1\n";
-$o = new __TestPEAR1;
-var_dump(get_class($o));
-
-?>
diff --git a/pear/tests/PEAR_Error.r b/pear/tests/PEAR_Error.r
deleted file mode 100644
index fce8a664a7..0000000000
--- a/pear/tests/PEAR_Error.r
+++ /dev/null
@@ -1,20 +0,0 @@
-new PEAR_Error object(pear_error)(8) {
- ["classname"]=>
- string(10) "pear_error"
- ["error_message_prefix"]=>
- string(0) ""
- ["error_prepend"]=>
- string(0) ""
- ["error_append"]=>
- string(0) ""
- ["mode"]=>
- int(0)
- ["level"]=>
- int(1024)
- ["message"]=>
- string(13) "unknown error"
- ["code"]=>
- int(0)
-}
-isError 1 bool(true)
-isError 2 bool(false)
diff --git a/pear/tests/PEAR_Error.t b/pear/tests/PEAR_Error.t
deleted file mode 100644
index 4fae7b4cda..0000000000
--- a/pear/tests/PEAR_Error.t
+++ /dev/null
@@ -1,18 +0,0 @@
-<?php // -*- C++ -*-
-
-// Test for: PEAR.php
-// Parts tested: - PEAR_Error class
-// - PEAR::isError static method
-// testing PEAR_Error
-
-require_once "PEAR.php";
-
-print "new PEAR_Error ";
-var_dump($err = new PEAR_Error);
-print "isError 1 ";
-var_dump(PEAR::isError($err));
-print "isError 2 ";
-$str = "not an error";
-var_dump(PEAR::isError($str));
-
-?>
diff --git a/pear/tests/pear1.phpt b/pear/tests/pear1.phpt
deleted file mode 100644
index 07b737f5bc..0000000000
--- a/pear/tests/pear1.phpt
+++ /dev/null
@@ -1,58 +0,0 @@
---TEST--
-PEAR constructor/destructor test
---SKIPIF--
---FILE--
-<?php
-
-require_once "PEAR.php";
-
-class TestPEAR extends PEAR {
- function TestPEAR($name) {
- $this->_debug = true;
- $this->name = $name;
- $this->PEAR();
- }
- function _TestPEAR() {
- print "This is the TestPEAR($this->name) destructor\n";
- $this->_PEAR();
- }
-}
-
-class Test2 extends PEAR {
- function _Test2() {
- print "This is the Test2 destructor\n";
- $this->_PEAR();
- }
-}
-
-class Test3 extends Test2 {
-}
-
-print "testing plain destructors\n";
-$o = new TestPEAR("test1");
-$p = new TestPEAR("test2");
-print "..\n";
-print "testing inherited destructors\n";
-$q = new Test3;
-
-print "..\n";
-print "script exiting...\n";
-print "..\n";
-
-?>
---GET--
---POST--
---EXPECT--
-testing plain destructors
-PEAR constructor called, class=testpear
-PEAR constructor called, class=testpear
-..
-testing inherited destructors
-..
-script exiting...
-..
-This is the TestPEAR(test1) destructor
-PEAR destructor called, class=testpear
-This is the TestPEAR(test2) destructor
-PEAR destructor called, class=testpear
-This is the Test2 destructor
diff --git a/pear/tests/pear_error.phpt b/pear/tests/pear_error.phpt
deleted file mode 100644
index e42085403b..0000000000
--- a/pear/tests/pear_error.phpt
+++ /dev/null
@@ -1,128 +0,0 @@
---TEST--
-PEAR_Error test
---SKIPIF--
---FILE--
-<?php // -*- C++ -*-
-
-// Test for: PEAR.php
-// Parts tested: - PEAR_Error class
-// - PEAR::isError static method
-// testing PEAR_Error
-
-require_once "PEAR.php";
-
-error_reporting(4095);
-
-class Foo_Error extends PEAR_Error {
- function Foo_Error($message = "unknown error", $code = null,
- $mode = null, $options = null, $userinfo = null)
- {
- $this->PEAR_Error($message, $code, $mode, $options, $userinfo);
- $this->error_message_prefix = 'Foo_Error prefix';
- }
-}
-
-class Test1 extends PEAR {
- function Test1() {
- $this->PEAR("Foo_Error");
- }
- function runtest() {
- return $this->raiseError("test error");
- }
-}
-
-function errorhandler(&$obj) {
- print "errorhandler function called, obj=".$obj->toString()."\n";
-}
-
-class errorclass {
- function errorhandler(&$obj) {
- print "errorhandler method called, obj=".$obj->toString()."\n";
- }
-}
-
-print "specify error class: ";
-$obj = new Test1;
-$err = $obj->runtest();
-print $err->toString() . "\n";
-
-$eo = new errorclass;
-
-print "default PEAR_Error: ";
-$err = new PEAR_Error;
-print $err->toString() . "\n";
-print "Testing it: ";
-var_dump(PEAR::isError($err));
-print "This is not an error: ";
-$str = "not an error";
-var_dump(PEAR::isError($str));
-
-print "Now trying a bunch of variations...\n";
-
-print "different message: ";
-$err = new PEAR_Error("test error");
-print $err->toString() . "\n";
-
-print "different message,code: ";
-$err = new PEAR_Error("test error", -42);
-print $err->toString() . "\n";
-
-print "mode=print: ";
-$err = new PEAR_Error("test error", -42, PEAR_ERROR_PRINT);
-print $err->toString() . "\n";
-
-print "mode=callback(function): ";
-$err = new PEAR_Error("test error", -42, PEAR_ERROR_CALLBACK, "errorhandler");
-
-print "mode=callback(method): ";
-$err = new PEAR_Error("test error", -42, PEAR_ERROR_CALLBACK,
- array(&$eo, "errorhandler"));
-
-print "mode=print&trigger: ";
-$err = new PEAR_Error("test error", -42, PEAR_ERROR_PRINT|PEAR_ERROR_TRIGGER);
-print $err->toString() . "\n";
-
-print "mode=trigger: ";
-$err = new PEAR_Error("test error", -42, PEAR_ERROR_TRIGGER);
-print $err->toString() . "\n";
-
-print "mode=trigger,level=notice: ";
-$err = new PEAR_Error("test error", -42, PEAR_ERROR_TRIGGER, E_USER_NOTICE);
-print $err->toString() . "\n";
-
-print "mode=trigger,level=warning: ";
-$err = new PEAR_Error("test error", -42, PEAR_ERROR_TRIGGER, E_USER_WARNING);
-print $err->toString() . "\n";
-
-print "mode=trigger,level=error: ";
-$err = new PEAR_Error("test error", -42, PEAR_ERROR_TRIGGER, E_USER_ERROR);
-print $err->toString() . "\n";
-
-?>
---GET--
---POST--
---EXPECT--
-specify error class: [foo_error: message="test error" code=0 mode=return level=notice prefix="Foo_Error prefix" prepend="" append="" info=""]
-default PEAR_Error: [pear_error: message="unknown error" code=0 mode=return level=notice prefix="" prepend="" append="" info=""]
-Testing it: bool(true)
-This is not an error: bool(false)
-Now trying a bunch of variations...
-different message: [pear_error: message="test error" code=0 mode=return level=notice prefix="" prepend="" append="" info=""]
-different message,code: [pear_error: message="test error" code=-42 mode=return level=notice prefix="" prepend="" append="" info=""]
-mode=print: test error[pear_error: message="test error" code=-42 mode=print level=notice prefix="" prepend="" append="" info=""]
-mode=callback(function): errorhandler function called, obj=[pear_error: message="test error" code=-42 mode=callback callback=errorhandler prefix="" prepend="" append="" info=""]
-mode=callback(method): errorhandler method called, obj=[pear_error: message="test error" code=-42 mode=callback callback=errorclass::errorhandler prefix="" prepend="" append="" info=""]
-mode=print&trigger: test error<br>
-<b>Notice</b>: test error in <b>/usr/local/share/php/pear/PEAR.php</b> on line <b>401</b><br>
-[pear_error: message="test error" code=-42 mode=print|trigger level=notice prefix="" prepend="" append="" info=""]
-mode=trigger: <br>
-<b>Notice</b>: test error in <b>/usr/local/share/php/pear/PEAR.php</b> on line <b>401</b><br>
-[pear_error: message="test error" code=-42 mode=trigger level=notice prefix="" prepend="" append="" info=""]
-mode=trigger,level=notice: <br>
-<b>Notice</b>: test error in <b>/usr/local/share/php/pear/PEAR.php</b> on line <b>401</b><br>
-[pear_error: message="test error" code=-42 mode=trigger level=notice prefix="" prepend="" append="" info=""]
-mode=trigger,level=warning: <br>
-<b>Warning</b>: test error in <b>/usr/local/share/php/pear/PEAR.php</b> on line <b>401</b><br>
-[pear_error: message="test error" code=-42 mode=trigger level=warning prefix="" prepend="" append="" info=""]
-mode=trigger,level=error: <br>
-<b>Fatal error</b>: test error in <b>/usr/local/share/php/pear/PEAR.php</b> on line <b>401</b><br>
diff --git a/pear/tests/pear_error2.phpt b/pear/tests/pear_error2.phpt
deleted file mode 100644
index 8d2531380e..0000000000
--- a/pear/tests/pear_error2.phpt
+++ /dev/null
@@ -1,24 +0,0 @@
---TEST--
-PEAR_Error in die mode
---SKIPIF--
---FILE--
-<?php // -*- C++ -*-
-
-// Test for: PEAR.php
-// Parts tested: - PEAR_Error class
-// - PEAR::isError static method
-// testing PEAR_Error
-
-require_once "PEAR.php";
-
-error_reporting(4095);
-
-print "mode=die: ";
-$err = new PEAR_Error("test error!!\n", -42, PEAR_ERROR_DIE);
-print $err->toString() . "\n";
-
-?>
---GET--
---POST--
---EXPECT--
-mode=die: test error!!
diff --git a/pear/tests/pear_error3.phpt b/pear/tests/pear_error3.phpt
deleted file mode 100644
index 4703a222b6..0000000000
--- a/pear/tests/pear_error3.phpt
+++ /dev/null
@@ -1,40 +0,0 @@
---TEST--
-PEAR default error handling
---FILE--
-<?php // -*- C++ -*-
-
-// Test for: PEAR.php
-// Parts tested: - PEAR_Error class
-// - PEAR::setErrorHandling
-// - PEAR::raiseError method
-
-require_once "PEAR.php";
-
-error_reporting(4095);
-
-function errorhandler($eobj)
-{
- if (PEAR::isError($eobj)) {
- print "errorhandler called with an error object.\n";
- print "error message: ".$eobj->getMessage()."\n";
- } else {
- print "errorhandler called, but without an error object.\n";
- }
-}
-
-$obj = new PEAR;
-$obj->setErrorHandling(PEAR_ERROR_PRINT);
-$obj->raiseError("error 1\n");
-$obj->setErrorHandling(null);
-$obj->raiseError("error 2\n");
-PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, "errorhandler");
-$obj->raiseError("error 3\n");
-$obj->setErrorHandling(PEAR_ERROR_PRINT);
-$obj->raiseError("error 4\n");
-
-?>
---EXPECT--
-error 1
-errorhandler called with an error object.
-error message: error 3
-error 4
diff --git a/pear/tests/php.ini b/pear/tests/php.ini
deleted file mode 100644
index c75c9b4f11..0000000000
--- a/pear/tests/php.ini
+++ /dev/null
@@ -1,2 +0,0 @@
-; php.ini for PEAR tests
-include_path=..
diff --git a/php.ini-dist b/php.ini-dist
deleted file mode 100644
index d3d115f95a..0000000000
--- a/php.ini-dist
+++ /dev/null
@@ -1,800 +0,0 @@
-[PHP]
-; $Id$
-
-;;;;;;;;;;;;;;;;;;;
-; About this file ;
-;;;;;;;;;;;;;;;;;;;
-; This file controls many aspects of PHP's behavior. In order for PHP to
-; read it, it must be named 'php.ini'. PHP looks for it in the current
-; working directory, in the path designated by the environment variable
-; PHPRC, and in the path that was defined in compile time (in that order).
-; Under Windows, the compile-time path is the Windows directory. The
-; path in which the php.ini file is looked for can be overriden using
-; the -c argument in command line mode.
-;
-; The syntax of the file is extremely simple. Whitespace and Lines
-; beginning with a semicolon are silently ignored (as you probably guessed).
-; Section headers (e.g. [Foo]) are also silently ignored, even though
-; they might mean something in the future.
-;
-; Directives are specified using the following syntax:
-; directive = value
-; Directive names are *case sensitive* - foo=bar is different from FOO=bar.
-;
-; The value can be a string, a number, a PHP constant (e.g. E_ALL or M_PI), one
-; of the INI constants (On, Off, True, False, Yes, No and None) or an expression
-; (e.g. E_ALL & ~E_NOTICE), or a quoted string ("foo").
-;
-; Expressions in the INI file are limited to bitwise operators and parentheses:
-; | bitwise OR
-; & bitwise AND
-; ~ bitwise NOT
-; ! boolean NOT
-;
-; Boolean flags can be turned on using the values 1, On, True or Yes.
-; They can be turned off using the values 0, Off, False or No.
-;
-; An empty string can be denoted by simply not writing anything after the equal
-; sign, or by using the None keyword:
-;
-; foo = ; sets foo to an empty string
-; foo = none ; sets foo to an empty string
-; foo = "none" ; sets foo to the string 'none'
-;
-; If you use constants in your value, and these constants belong to a
-; dynamically loaded extension (either a PHP extension or a Zend extension),
-; you may only use these constants *after* the line that loads the extension.
-;
-; All the values in the php.ini-dist file correspond to the builtin
-; defaults (that is, if no php.ini is used, or if you delete these lines,
-; the builtin defaults will be identical).
-
-
-;;;;;;;;;;;;;;;;;;;;
-; Language Options ;
-;;;;;;;;;;;;;;;;;;;;
-
-; Enable the PHP scripting language engine under Apache.
-engine = On
-
-; Allow the <? tag. Otherwise, only <?php and <script> tags are recognized.
-short_open_tag = On
-
-; Allow ASP-style <% %> tags.
-asp_tags = Off
-
-; The number of significant digits displayed in floating point numbers.
-precision = 14
-
-; Enforce year 2000 compliance (will cause problems with non-compliant browsers)
-y2k_compliance = Off
-
-; Output buffering allows you to send header lines (including cookies) even
-; after you send body content, at the price of slowing PHP's output layer a
-; bit. You can enable output buffering during runtime by calling the output
-; buffering functions. You can also enable output buffering for all files by
-; setting this directive to On.
-output_buffering = Off
-
-; You can redirect all of the output of your scripts to a function. For
-; example, if you set output_handler to "ob_gzhandler", output will be
-; transparently compressed for browsers that support gzip or deflate encoding.
-; Setting an output handler automatically turns on output buffering.
-output_handler =
-
-; Transparent output compression using the zlib library
-; Valid values for this option are 'off', 'on', or a specific buffer size
-; to be used for compression (default is 4KB)
-zlib.output_compression = Off
-
-; Implicit flush tells PHP to tell the output layer to flush itself
-; automatically after every output block. This is equivalent to calling the
-; PHP function flush() after each and every call to print() or echo() and each
-; and every HTML block. Turning this option on has serious performance
-; implications and is generally recommended for debugging purposes only.
-implicit_flush = Off
-
-; Whether to enable the ability to force arguments to be passed by reference
-; at function call time. This method is deprecated and is likely to be
-; unsupported in future versions of PHP/Zend. The encouraged method of
-; specifying which arguments should be passed by reference is in the function
-; declaration. You're encouraged to try and turn this option Off and make
-; sure your scripts work properly with it in order to ensure they will work
-; with future versions of the language (you will receive a warning each time
-; you use this feature, and the argument will be passed by value instead of by
-; reference).
-allow_call_time_pass_reference = On
-
-
-;
-; Safe Mode
-;
-safe_mode = Off
-
-safe_mode_exec_dir =
-
-; Setting certain environment variables may be a potential security breach.
-; This directive contains a comma-delimited list of prefixes. In Safe Mode,
-; the user may only alter environment variables whose names begin with the
-; prefixes supplied here. By default, users will only be able to set
-; environment variables that begin with PHP_ (e.g. PHP_FOO=BAR).
-;
-; Note: If this directive is empty, PHP will let the user modify ANY
-; environment variable!
-safe_mode_allowed_env_vars = PHP_
-
-; This directive contains a comma-delimited list of environment variables that
-; the end user won't be able to change using putenv(). These variables will be
-; protected even if safe_mode_allowed_env_vars is set to allow to change them.
-safe_mode_protected_env_vars = LD_LIBRARY_PATH
-
-; This directive allows you to disable certain functions for security reasons.
-; It receives a comma-deliminated list of function names. This directive is
-; *NOT* affected by whether Safe Mode is turned On or Off.
-disable_functions =
-
-; Colors for Syntax Highlighting mode. Anything that's acceptable in
-; <font color="??????"> would work.
-highlight.string = #CC0000
-highlight.comment = #FF9900
-highlight.keyword = #006600
-highlight.bg = #FFFFFF
-highlight.default = #0000CC
-highlight.html = #000000
-
-
-;
-; Misc
-;
-; Decides whether PHP may expose the fact that it is installed on the server
-; (e.g. by adding its signature to the Web server header). It is no security
-; threat in any way, but it makes it possible to determine whether you use PHP
-; on your server or not.
-expose_php = On
-
-
-;;;;;;;;;;;;;;;;;;;
-; Resource Limits ;
-;;;;;;;;;;;;;;;;;;;
-
-max_execution_time = 30 ; Maximum execution time of each script, in seconds
-memory_limit = 8M ; Maximum amount of memory a script may consume (8MB)
-
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-; Error handling and logging ;
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
-; error_reporting is a bit-field. Or each number up to get desired error
-; reporting level
-; E_ALL - All errors and warnings
-; E_ERROR - fatal run-time errors
-; E_WARNING - run-time warnings (non-fatal errors)
-; E_PARSE - compile-time parse errors
-; E_NOTICE - run-time notices (these are warnings which often result
-; from a bug in your code, but it's possible that it was
-; intentional (e.g., using an uninitialized variable and
-; relying on the fact it's automatically initialized to an
-; empty string)
-; E_CORE_ERROR - fatal errors that occur during PHP's initial startup
-; E_CORE_WARNING - warnings (non-fatal errors) that occur during PHP's
-; initial startup
-; E_COMPILE_ERROR - fatal compile-time errors
-; E_COMPILE_WARNING - compile-time warnings (non-fatal errors)
-; E_USER_ERROR - user-generated error message
-; E_USER_WARNING - user-generated warning message
-; E_USER_NOTICE - user-generated notice message
-;
-; Examples:
-;
-; - Show all errors, except for notices
-;
-;error_reporting = E_ALL & ~E_NOTICE
-;
-; - Show only errors
-;
-;error_reporting = E_COMPILE_ERROR|E_ERROR|E_CORE_ERROR
-;
-; - Show all errors except for notices
-;
-error_reporting = E_ALL & ~E_NOTICE
-
-; Print out errors (as a part of the output). For production web sites,
-; you're strongly encouraged to turn this feature off, and use error logging
-; instead (see below). Keeping display_errors enabled on a production web site
-; may reveal security information to end users, such as file paths on your Web
-; server, your database schema or other information.
-display_errors = On
-
-; Even when display_errors is on, errors that occur during PHP's startup
-; sequence are not displayed. It's strongly recommended to keep
-; display_startup_errors off, except for when debugging.
-display_startup_errors = Off
-
-; Log errors into a log file (server-specific log, stderr, or error_log (below))
-; As stated above, you're strongly advised to use error logging in place of
-; error displaying on production web sites.
-log_errors = Off
-
-; Store the last error/warning message in $php_errormsg (boolean).
-track_errors = Off
-
-; Disable the inclusion of HTML tags in error messages.
-;html_errors = Off
-
-; String to output before an error message.
-;error_prepend_string = "<font color=ff0000>"
-
-; String to output after an error message.
-;error_append_string = "</font>"
-
-; Log errors to specified file.
-;error_log = filename
-
-; Log errors to syslog (Event Log on NT, not valid in Windows 95).
-;error_log = syslog
-
-; Warn if the + operator is used with strings.
-warn_plus_overloading = Off
-
-
-;;;;;;;;;;;;;;;;;
-; Data Handling ;
-;;;;;;;;;;;;;;;;;
-;
-; Note - track_vars is ALWAYS enabled as of PHP 4.0.3
-
-; The separator used in PHP generated URLs to separate arguments.
-; Default is "&".
-;arg_separator.output = "&amp;"
-
-; List of separator(s) used by PHP to parse input URLs into variables.
-; Default is "&".
-; NOTE: Every character in this directive is considered as separator!
-;arg_separator.input = ";&"
-
-; This directive describes the order in which PHP registers GET, POST, Cookie,
-; Environment and Built-in variables (G, P, C, E & S respectively, often
-; referred to as EGPCS or GPC). Registration is done from left to right, newer
-; values override older values.
-variables_order = "EGPCS"
-
-; Whether or not to register the EGPCS variables as global variables. You may
-; want to turn this off if you don't want to clutter your scripts' global scope
-; with user data. This makes most sense when coupled with track_vars - in which
-; case you can access all of the GPC variables through the $HTTP_*_VARS[],
-; variables.
-;
-; You should do your best to write your scripts so that they do not require
-; register_globals to be on; Using form variables as globals can easily lead
-; to possible security problems, if the code is not very well thought of.
-register_globals = On
-
-; This directive tells PHP whether to declare the argv&argc variables (that
-; would contain the GET information). If you don't use these variables, you
-; should turn it off for increased performance.
-register_argc_argv = On
-
-; Maximum size of POST data that PHP will accept.
-post_max_size = 8M
-
-; This directive is deprecated. Use variables_order instead.
-gpc_order = "GPC"
-
-; Magic quotes
-;
-
-; Magic quotes for incoming GET/POST/Cookie data.
-magic_quotes_gpc = On
-
-; Magic quotes for runtime-generated data, e.g. data from SQL, from exec(), etc.
-magic_quotes_runtime = Off
-
-; Use Sybase-style magic quotes (escape ' with '' instead of \').
-magic_quotes_sybase = Off
-
-; Automatically add files before or after any PHP document.
-auto_prepend_file =
-auto_append_file =
-
-; As of 4.0b4, PHP always outputs a character encoding by default in
-; the Content-type: header. To disable sending of the charset, simply
-; set it to be empty.
-;
-; PHP's built-in default is text/html
-default_mimetype = "text/html"
-;default_charset = "iso-8859-1"
-
-
-;;;;;;;;;;;;;;;;;;;;;;;;;
-; Paths and Directories ;
-;;;;;;;;;;;;;;;;;;;;;;;;;
-
-; UNIX: "/path1:/path2"
-;include_path = ".:/php/includes"
-;
-; Windows: "\path1;\path2"
-;include_path = ".;c:\php\includes"
-
-; The root of the PHP pages, used only if nonempty.
-doc_root =
-
-; The directory under which PHP opens the script using /~usernamem used only
-; if nonempty.
-user_dir =
-
-; Directory in which the loadable extensions (modules) reside.
-extension_dir = ./
-
-; Whether or not to enable the dl() function. The dl() function does NOT work
-; properly in multithreaded servers, such as IIS or Zeus, and is automatically
-; disabled on them.
-enable_dl = On
-
-
-;;;;;;;;;;;;;;;;
-; File Uploads ;
-;;;;;;;;;;;;;;;;
-
-; Whether to allow HTTP file uploads.
-file_uploads = On
-
-; Temporary directory for HTTP uploaded files (will use system default if not
-; specified).
-;upload_tmp_dir =
-
-; Maximum allowed size for uploaded files.
-upload_max_filesize = 2M
-
-
-;;;;;;;;;;;;;;;;;;
-; Fopen wrappers ;
-;;;;;;;;;;;;;;;;;;
-
-; Whether to allow the treatment of URLs (like http:// or ftp://) as files.
-allow_url_fopen = On
-
-; Define the anonymous ftp password (your email address)
-;from="john@doe.com"
-
-
-;;;;;;;;;;;;;;;;;;;;;;
-; Dynamic Extensions ;
-;;;;;;;;;;;;;;;;;;;;;;
-;
-; If you wish to have an extension loaded automaticly, use the following
-; syntax:
-;
-; extension=modulename.extension
-;
-; For example, on Windows:
-;
-; extension=msql.dll
-;
-; ... or under UNIX:
-;
-; extension=msql.so
-;
-; Note that it should be the name of the module only; no directory information
-; needs to go here. Specify the location of the extension with the
-; extension_dir directive above.
-
-
-;Windows Extensions
-;Note that MySQL and ODBC support is now built in, so no dll is needed for it.
-;
-;extension=php_bz2.dll
-;extension=php_ctype.dll
-;extension=php_cpdf.dll
-;extension=php_curl.dll
-;extension=php_cybercash.dll
-;extension=php_db.dll
-;extension=php_dba.dll
-;extension=php_dbase.dll
-;extension=php_dbx.dll
-;extension=php_domxml.dll
-;extension=php_dotnet.dll
-;extension=php_exif.dll
-;extension=php_fdf.dll
-;extension=php_filepro.dll
-;extension=php_gd.dll
-;extension=php_gettext.dll
-;extension=php_hyperwave.dll
-;extension=php_iconv.dll
-;extension=php_ifx.dll
-;extension=php_iisfunc.dll
-;extension=php_imap.dll
-;extension=php_ingres.dll
-;extension=php_interbase.dll
-;extension=php_java.dll
-;extension=php_ldap.dll
-;extension=php_mbstring.dll
-;extension=php_mcrypt.dll
-;extension=php_mhash.dll
-;extension=php_ming.dll
-;extension=php_mssql.dll
-;extension=php_oci8.dll
-;extension=php_openssl.dll
-;extension=php_oracle.dll
-;extension=php_pdf.dll
-;extension=php_pgsql.dll
-;extension=php_printer.dll
-;extension=php_sablot.dll
-;extension=php_snmp.dll
-;extension=php_sybase_ct.dll
-;extension=php_xslt.dll
-;extension=php_yaz.dll
-;extension=php_zlib.dll
-
-
-;;;;;;;;;;;;;;;;;;;
-; Module Settings ;
-;;;;;;;;;;;;;;;;;;;
-
-[Syslog]
-; Whether or not to define the various syslog variables (e.g. $LOG_PID,
-; $LOG_CRON, etc.). Turning it off is a good idea performance-wise. In
-; runtime, you can define these variables by calling define_syslog_variables().
-define_syslog_variables = Off
-
-[mail function]
-; For Win32 only.
-SMTP = localhost
-
-; For Win32 only.
-sendmail_from = me@localhost.com
-
-; For Unix only. You may supply arguments as well (default: 'sendmail -t -i').
-;sendmail_path =
-
-[Logging]
-; These configuration directives are used by the example logging mechanism.
-; See examples/README.logging for more explanation.
-;logging.method = db
-;logging.directory = /path/to/log/directory
-
-[Java]
-;java.class.path = .\php_java.jar
-;java.home = c:\jdk
-;java.library = c:\jdk\jre\bin\hotspot\jvm.dll
-;java.library.path = .\
-
-[SQL]
-sql.safe_mode = Off
-
-[ODBC]
-;odbc.default_db = Not yet implemented
-;odbc.default_user = Not yet implemented
-;odbc.default_pw = Not yet implemented
-
-; Allow or prevent persistent links.
-odbc.allow_persistent = On
-
-; Check that a connection is still valid before reuse.
-odbc.check_persistent = On
-
-; Maximum number of persistent links. -1 means no limit.
-odbc.max_persistent = -1
-
-; Maximum number of links (persistent + non-persistent). -1 means no limit.
-odbc.max_links = -1
-
-; Handling of LONG fields. Returns number of bytes to variables. 0 means
-; passthru.
-odbc.defaultlrl = 4096
-
-; Handling of binary data. 0 means passthru, 1 return as is, 2 convert to char.
-; See the documentation on odbc_binmode and odbc_longreadlen for an explanation
-; of uodbc.defaultlrl and uodbc.defaultbinmode
-odbc.defaultbinmode = 1
-
-[MySQL]
-; Allow or prevent persistent links.
-mysql.allow_persistent = On
-
-; Maximum number of persistent links. -1 means no limit.
-mysql.max_persistent = -1
-
-; Maximum number of links (persistent + non-persistent). -1 means no limit.
-mysql.max_links = -1
-
-; Default port number for mysql_connect(). If unset, mysql_connect() will use
-; the $MYSQL_TCP_PORT or the mysql-tcp entry in /etc/services or the
-; compile-time value defined MYSQL_PORT (in that order). Win32 will only look
-' at MYSQL_PORT.
-mysql.default_port =
-
-; Default socket name for local MySQL connects. If empty, uses the built-in
-; MySQL defaults.
-mysql.default_socket =
-
-; Default host for mysql_connect() (doesn't apply in safe mode).
-mysql.default_host =
-
-; Default user for mysql_connect() (doesn't apply in safe mode).
-mysql.default_user =
-
-; Default password for mysql_connect() (doesn't apply in safe mode).
-; Note that this is generally a *bad* idea to store passwords in this file.
-; *Any* user with PHP access can run 'echo cfg_get_var("mysql.default_password")
-; and reveal this password! And of course, any users with read access to this
-; file will be able to reveal the password as well.
-mysql.default_password =
-
-[mSQL]
-; Allow or prevent persistent links.
-msql.allow_persistent = On
-
-; Maximum number of persistent links. -1 means no limit.
-msql.max_persistent = -1
-
-; Maximum number of links (persistent+non persistent). -1 means no limit.
-msql.max_links = -1
-
-[PostgresSQL]
-; Allow or prevent persistent links.
-pgsql.allow_persistent = On
-
-; Maximum number of persistent links. -1 means no limit.
-pgsql.max_persistent = -1
-
-; Maximum number of links (persistent+non persistent). -1 means no limit.
-pgsql.max_links = -1
-
-[Sybase]
-; Allow or prevent persistent links.
-sybase.allow_persistent = On
-
-; Maximum number of persistent links. -1 means no limit.
-sybase.max_persistent = -1
-
-; Maximum number of links (persistent + non-persistent). -1 means no limit.
-sybase.max_links = -1
-
-;sybase.interface_file = "/usr/sybase/interfaces"
-
-; Minimum error severity to display.
-sybase.min_error_severity = 10
-
-; Minimum message severity to display.
-sybase.min_message_severity = 10
-
-; Compatability mode with old versions of PHP 3.0.
-; If on, this will cause PHP to automatically assign types to results according
-; to their Sybase type, instead of treating them all as strings. This
-; compatability mode will probably not stay around forever, so try applying
-; whatever necessary changes to your code, and turn it off.
-sybase.compatability_mode = Off
-
-[Sybase-CT]
-; Allow or prevent persistent links.
-sybct.allow_persistent = On
-
-; Maximum number of persistent links. -1 means no limit.
-sybct.max_persistent = -1
-
-; Maximum number of links (persistent + non-persistent). -1 means no limit.
-sybct.max_links = -1
-
-; Minimum server message severity to display.
-sybct.min_server_severity = 10
-
-; Minimum client message severity to display.
-sybct.min_client_severity = 10
-
-[bcmath]
-; Number of decimal digits for all bcmath functions.
-bcmath.scale = 0
-
-[browscap]
-;browscap = extra/browscap.ini
-
-[Informix]
-; Default host for ifx_connect() (doesn't apply in safe mode).
-ifx.default_host =
-
-; Default user for ifx_connect() (doesn't apply in safe mode).
-ifx.default_user =
-
-; Default password for ifx_connect() (doesn't apply in safe mode).
-ifx.default_password =
-
-; Allow or prevent persistent links.
-ifx.allow_persistent = On
-
-; Maximum number of persistent links. -1 means no limit.
-ifx.max_persistent = -1
-
-; Maximum number of links (persistent + non-persistent). -1 means no limit.
-ifx.max_links = -1
-
-; If on, select statements return the contents of a text blob instead of its id.
-ifx.textasvarchar = 0
-
-; If on, select statements return the contents of a byte blob instead of its id.
-ifx.byteasvarchar = 0
-
-; Trailing blanks are stripped from fixed-length char columns. May help the
-; life of Informix SE users.
-ifx.charasvarchar = 0
-
-; If on, the contents of text and byte blobs are dumped to a file instead of
-; keeping them in memory.
-ifx.blobinfile = 0
-
-; NULL's are returned as empty strings, unless this is set to 1. In that case,
-; NULL's are returned as string 'NULL'.
-ifx.nullformat = 0
-
-[Session]
-; Handler used to store/retrieve data.
-session.save_handler = files
-
-; Argument passed to save_handler. In the case of files, this is the path
-; where data files are stored. Note: Windows users have to change this
-; variable in order to use PHP's session functions.
-session.save_path = /tmp
-
-; Whether to use cookies.
-session.use_cookies = 1
-
-
-; Name of the session (used as cookie name).
-session.name = PHPSESSID
-
-; Initialize session on request startup.
-session.auto_start = 0
-
-; Lifetime in seconds of cookie or, if 0, until browser is restarted.
-session.cookie_lifetime = 0
-
-; The path for which the cookie is valid.
-session.cookie_path = /
-
-; The domain for which the cookie is valid.
-session.cookie_domain =
-
-; Handler used to serialize data. php is the standard serializer of PHP.
-session.serialize_handler = php
-
-; Percentual probability that the 'garbage collection' process is started
-; on every session initialization.
-session.gc_probability = 1
-
-; After this number of seconds, stored data will be seen as 'garbage' and
-; cleaned up by the garbage collection process.
-session.gc_maxlifetime = 1440
-
-; Check HTTP Referer to invalidate externally stored URLs containing ids.
-session.referer_check =
-
-; How many bytes to read from the file.
-session.entropy_length = 0
-
-; Specified here to create the session id.
-session.entropy_file =
-
-;session.entropy_length = 16
-
-;session.entropy_file = /dev/urandom
-
-; Set to {nocache,private,public} to determine HTTP caching aspects.
-session.cache_limiter = nocache
-
-; Document expires after n minutes.
-session.cache_expire = 180
-
-; use transient sid support if enabled by compiling with --enable-trans-sid.
-session.use_trans_sid = 1
-
-url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=fakeentry"
-
-[MSSQL]
-; Allow or prevent persistent links.
-mssql.allow_persistent = On
-
-; Maximum number of persistent links. -1 means no limit.
-mssql.max_persistent = -1
-
-; Maximum number of links (persistent+non persistent). -1 means no limit.
-mssql.max_links = -1
-
-; Minimum error severity to display.
-mssql.min_error_severity = 10
-
-; Minimum message severity to display.
-mssql.min_message_severity = 10
-
-; Compatability mode with old versions of PHP 3.0.
-mssql.compatability_mode = Off
-
-; Valid range 0 - 2147483647. Default = 4096.
-;mssql.textlimit = 4096
-
-; Valid range 0 - 2147483647. Default = 4096.
-;mssql.textsize = 4096
-
-; Limits the number of records in each bach. 0 = all records in one batch.
-;mssql.batchsize = 0
-
-[Assertion]
-; Assert(expr); active by default.
-;assert.active = On
-
-; Issue a PHP warning for each failed assertion.
-;assert.warning = On
-
-; Don't bail out by default.
-;assert.bail = Off
-
-; User-function to be called if an assertion fails.
-;assert.callback = 0
-
-; Eval the expression with current error_reporting(). Set to true if you want
-; error_reporting(0) around the eval().
-;assert.quiet_eval = 0
-
-[Ingres II]
-; Allow or prevent persistent links.
-ingres.allow_persistent = On
-
-; Maximum number of persistent links. -1 means no limit.
-ingres.max_persistent = -1
-
-; Maximum number of links, including persistents. -1 means no limit.
-ingres.max_links = -1
-
-; Default database (format: [node_id::]dbname[/srv_class]).
-ingres.default_database =
-
-; Default user.
-ingres.default_user =
-
-; Default password.
-ingres.default_password =
-
-[Verisign Payflow Pro]
-; Default Signio server.
-pfpro.defaulthost = "test.signio.com"
-
-; Default port to connect to.
-pfpro.defaultport = 443
-
-; Default timeout in seconds.
-pfpro.defaulttimeout = 30
-
-; Default proxy IP address (if required).
-;pfpro.proxyaddress =
-
-; Default proxy port.
-;pfpro.proxyport =
-
-; Default proxy logon.
-;pfpro.proxylogon =
-
-; Default proxy password.
-;pfpro.proxypassword =
-
-[Sockets]
-; Use the system read() function instead of the php_read() wrapper.
-sockets.use_system_read = On
-
-[com]
-; path to a file containing GUIDs, IIDs or filenames of files with TypeLibs
-;com.typelib_file =
-; allow Distributed-COM calls
-;com.allow_dcom = true
-
-[Printer]
-;printer.default_printer = ""
-
-[mbstring]
-;mbstring.internal_encoding = EUC-JP
-;mbstring.http_input = auto
-;mbstring.http_output = SJIS
-;mbstring.detect_order = auto
-;mbstring.substitute_character = none;
-
-; Local Variables:
-; tab-width: 4
-; End:
diff --git a/php.ini-optimized b/php.ini-optimized
deleted file mode 100644
index e9538edfd6..0000000000
--- a/php.ini-optimized
+++ /dev/null
@@ -1,528 +0,0 @@
-[PHP]
-
-;;;;;;;;;;;;;;;;;;;
-; About this file ;
-;;;;;;;;;;;;;;;;;;;
-;
-; This is the 'optimized', PHP 4-style version of the php.ini-dist file.
-; For general information about the php.ini file, please consult the php.ini-dist
-; file, included in your PHP distribution.
-;
-; This file is different from the php.ini-dist file in the fact that it features
-; different values for several directives, in order to improve performance, while
-; possibly breaking compatibility with the standard out-of-the-box behavior of
-; PHP 3. Please make sure you read what's different, and modify your scripts
-; accordingly, if you decide to use this file instead.
-;
-; - allow_call_time_pass_reference = Off
-; It's not possible to decide to force a variable to be passed by reference
-; when calling a function. The PHP 4 style to do this is by making the
-; function require the relevant argument by reference.
-; - register_globals = Off
-; Global variables are no longer registered for input data (POST, GET, cookies,
-; environment and other server variables). Instead of using $foo, you must use
-; $HTTP_POST_VARS["foo"], $HTTP_GET_VARS["foo"], $HTTP_COOKIE_VARS["foo"],
-; $HTTP_ENV_VARS["foo"] or $HTTP_SERVER_VARS["foo"], depending on which kind
-; of input source you're expecting 'foo' to come from.
-; - register_argc_argv = Off
-; Disables registration of the somewhat redundant $argv and $argc global
-; variables.
-; - magic_quotes_gpc = Off
-; Input data is no longer escaped with slashes so that it can be sent into
-; SQL databases without further manipulation. Instead, you should use the
-; function addslashes() on each input element you wish to send to a database.
-; - variables_order = "GPCS"
-; The environment variables are not hashed into the $HTTP_ENV_VARS[]. To access
-; environment variables, you can use getenv() instead.
-
-
-;;;;;;;;;;;;;;;;;;;;
-; Language Options ;
-;;;;;;;;;;;;;;;;;;;;
-
-engine = On ; Enable the PHP scripting language engine under Apache
-short_open_tag = On ; allow the <? tag. otherwise, only <?php and <script> tags are recognized.
-asp_tags = Off ; allow ASP-style <% %> tags
-precision = 14 ; number of significant digits displayed in floating point numbers
-y2k_compliance = Off ; whether to be year 2000 compliant (will cause problems with non y2k compliant browsers)
-output_buffering = Off ; Output buffering allows you to send header lines (including cookies)
- ; even after you send body content, in the price of slowing PHP's
- ; output layer a bit.
- ; You can enable output buffering by in runtime by calling the output
- ; buffering functions, or enable output buffering for all files
- ; by setting this directive to On.
-output_handler = ; You can redirect all of the output of your scripts to a function,
- ; that can be responsible to process or log it. For example,
- ; if you set the output_handler to "ob_gzhandler", than output
- ; will be transparently compressed for browsers that support gzip or
- ; deflate encoding. Setting an output handler automatically turns on
- ; output buffering.
-zlib.output_compression = Off ; Transparent output compression using the zlib library
- ; Valid values for this option are 'off', 'on', or a specific buffer size
- ; to be used for compression (default is 4KB)
-
-implicit_flush = Off ; Implicit flush tells PHP to tell the output layer to flush itself
- ; automatically after every output block. This is equivalent to
- ; calling the PHP function flush() after each and every call to print()
- ; or echo() and each and every HTML block.
- ; Turning this option on has serious performance implications, and
- ; is generally recommended for debugging purposes only.
-allow_call_time_pass_reference = Off ; whether to enable the ability to force arguments to be
- ; passed by reference at function-call time. This method
- ; is deprecated, and is likely to be unsupported in future
- ; versions of PHP/Zend. The encouraged method of specifying
- ; which arguments should be passed by reference is in the
- ; function declaration. You're encouraged to try and
- ; turn this option Off, and make sure your scripts work
- ; properly with it, to ensure they will work with future
- ; versions of the language (you will receive a warning
- ; each time you use this feature, and the argument will
- ; be passed by value instead of by reference).
-
-; Safe Mode
-safe_mode = Off
-safe_mode_exec_dir =
-safe_mode_allowed_env_vars = PHP_ ; Setting certain environment variables
- ; may be a potential security breach.
- ; This directive contains a comma-delimited
- ; list of prefixes. In Safe Mode, the
- ; user may only alter environment
- ; variables whose names begin with the
- ; prefixes supplied here.
- ; By default, users will only be able
- ; to set environment variables that begin
- ; with PHP_ (e.g. PHP_FOO=BAR).
- ; Note: If this directive is empty, PHP
- ; will let the user modify ANY environment
- ; variable!
-safe_mode_protected_env_vars = LD_LIBRARY_PATH ; This directive contains a comma-
- ; delimited list of environment variables,
- ; that the end user won't be able to
- ; change using putenv().
- ; These variables will be protected
- ; even if safe_mode_allowed_env_vars is
- ; set to allow to change them.
-
-
-disable_functions = ; This directive allows you to disable certain
- ; functions for security reasons. It receives
- ; a comma separated list of function names.
- ; This directive is *NOT* affected by whether
- ; Safe Mode is turned on or off.
-
-
-; Colors for Syntax Highlighting mode. Anything that's acceptable in <font color=???> would work.
-highlight.string = #DD0000
-highlight.comment = #FF8000
-highlight.keyword = #007700
-highlight.bg = #FFFFFF
-highlight.default = #0000BB
-highlight.html = #000000
-
-; Misc
-expose_php = On ; Decides whether PHP may expose the fact that it is installed on the
- ; server (e.g., by adding its signature to the Web server header).
- ; It is no security threat in any way, but it makes it possible
- ; to determine whether you use PHP on your server or not.
-
-
-
-;;;;;;;;;;;;;;;;;;;
-; Resource Limits ;
-;;;;;;;;;;;;;;;;;;;
-
-max_execution_time = 30 ; Maximum execution time of each script, in seconds
-memory_limit = 8M ; Maximum amount of memory a script may consume (8MB)
-
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-; Error handling and logging ;
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-; error_reporting is a bit-field. Or each number up to get desired error reporting level
-; E_ALL - All errors and warnings
-; E_ERROR - fatal run-time errors
-; E_WARNING - run-time warnings (non fatal errors)
-; E_PARSE - compile-time parse errors
-; E_NOTICE - run-time notices (these are warnings which often result from a bug in
-; your code, but it's possible that it was intentional (e.g., using an
-; uninitialized variable and relying on the fact it's automatically
-; initialized to an empty string)
-; E_CORE_ERROR - fatal errors that occur during PHP's initial startup
-; E_CORE_WARNING - warnings (non fatal errors) that occur during PHP's initial startup
-; E_COMPILE_ERROR - fatal compile-time errors
-; E_COMPILE_WARNING - compile-time warnings (non fatal errors)
-; E_USER_ERROR - user-generated error message
-; E_USER_WARNING - user-generated warning message
-; E_USER_NOTICE - user-generated notice message
-; Examples:
-; error_reporting = E_ALL & ~E_NOTICE ; show all errors, except for notices
-; error_reporting = E_COMPILE_ERROR|E_ERROR|E_CORE_ERROR ; show only errors
-error_reporting = E_ALL & ~E_NOTICE ; Show all errors except for notices
-display_errors = On ; Print out errors (as a part of the output)
- ; For production web sites, you're strongly encouraged
- ; to turn this feature off, and use error logging instead (see below).
- ; Keeping display_errors enabled on a production web site may reveal
- ; security information to end users, such as file paths on your Web server,
- ; your database schema or other information.
-display_startup_errors = Off ; Even when display_errors is on, errors that occur during
- ; PHP's startup sequence are not displayed. It's strongly
- ; recommended to keep display_startup_errors off, except for
- ; when debugging.
-log_errors = Off ; Log errors into a log file (server-specific log, stderr, or error_log (below))
- ; As stated above, you're strongly advised to use error logging in place of
- ; error displaying on production web sites.
-track_errors = Off ; Store the last error/warning message in $php_errormsg (boolean)
-;error_prepend_string = "<font color=ff0000>" ; string to output before an error message
-;error_append_string = "</font>" ; string to output after an error message
-;error_log = filename ; log errors to specified file
-;error_log = syslog ; log errors to syslog (Event Log on NT, not valid in Windows 95)
-warn_plus_overloading = Off ; warn if the + operator is used with strings
-
-
-;;;;;;;;;;;;;;;;;
-; Data Handling ;
-;;;;;;;;;;;;;;;;;
-
-;arg_separator.output = "&amp;" ; The separator used in PHP generated URLs to separate arguments.
- ; Default is "&".
-
-;arg_separator.input = ";&" ; List of separator(s) used by PHP to parse input URLs into variables.
- ; Default is "&".
- ; NOTE: Every character in this directive is considered as separator!
-
-variables_order = "GPCS" ; This directive describes the order in which PHP registers
- ; GET, POST, Cookie, Environment and Built-in variables (G, P,
- ; C, E & S respectively, often referred to as EGPCS or GPC).
- ; Registration is done from left to right, newer values override
- ; older values.
-register_globals = Off ; Whether or not to register the EGPCS variables as global
- ; variables. You may want to turn this off if you don't want
- ; to clutter your scripts' global scope with user data. This makes
- ; most sense when coupled with track_vars - in which case you can
- ; access all of the GPC variables through the $HTTP_*_VARS[],
- ; variables.
-register_argc_argv = Off ; This directive tells PHP whether to declare the argv&argc
- ; variables (that would contain the GET information). If you
- ; don't use these variables, you should turn it off for
- ; increased performance (you should try not to use it anyway,
- ; for less likelihood of security bugs in your code).
-post_max_size = 8M ; Maximum size of POST data that PHP will accept.
-gpc_order = "GPC" ; This directive is deprecated. Use variables_order instead.
-
-; Magic quotes
-magic_quotes_gpc = Off ; magic quotes for incoming GET/POST/Cookie data
-magic_quotes_runtime= Off ; magic quotes for runtime-generated data, e.g. data from SQL, from exec(), etc.
-magic_quotes_sybase = Off ; Use Sybase-style magic quotes (escape ' with '' instead of \')
-
-; automatically add files before or after any PHP document
-auto_prepend_file =
-auto_append_file =
-
-; As of 4.0b4, PHP always outputs a character encoding by default in
-; the Content-type: header. To disable sending of the charset, simply
-; set it to be empty.
-; PHP's built-in default is text/html
-default_mimetype = "text/html"
-;default_charset = "iso-8859-1"
-
-;;;;;;;;;;;;;;;;;;;;;;;;;
-; Paths and Directories ;
-;;;;;;;;;;;;;;;;;;;;;;;;;
-include_path = ; UNIX: "/path1:/path2" Windows: "\path1;\path2"
-doc_root = ; the root of the php pages, used only if nonempty
-user_dir = ; the directory under which php opens the script using /~username, used only if nonempty
-extension_dir = ./ ; directory in which the loadable extensions (modules) reside
-enable_dl = On ; Whether or not to enable the dl() function.
- ; The dl() function does NOT properly work in multithreaded
- ; servers, such as IIS or Zeus, and is automatically disabled
- ; on them.
-
-
-;;;;;;;;;;;;;;;;
-; File Uploads ;
-;;;;;;;;;;;;;;;;
-file_uploads = On ; Whether to allow HTTP file uploads
-;upload_tmp_dir = ; temporary directory for HTTP uploaded files (will use system default if not specified)
-upload_max_filesize = 2M ; Maximum allowed size for uploaded files
-
-
-;;;;;;;;;;;;;;;;;;
-; Fopen wrappers ;
-;;;;;;;;;;;;;;;;;;
-allow_url_fopen = On ; Whether to allow the treatment of URLs (like http:// or ftp://) as files
-;from="john@doe.com" ; Define the anonymous ftp password (your email address)
-
-
-;;;;;;;;;;;;;;;;;;;;;;
-; Dynamic Extensions ;
-;;;;;;;;;;;;;;;;;;;;;;
-; if you wish to have an extension loaded automaticly, use the
-; following syntax: extension=modulename.extension
-; for example, on windows,
-; extension=msql.dll
-; or under UNIX,
-; extension=msql.so
-; Note that it should be the name of the module only, no directory information
-; needs to go here. Specify the location of the extension with the extension_dir directive above.
-
-
-
-;Windows Extensions
-;Note that MySQL and ODBC support is now built in, so no dll is needed for it.
-;
-;extension=php_bz2.dll
-;extension=php_ctype.dll
-;extension=php_cpdf.dll
-;extension=php_curl.dll
-;extension=php_cybercash.dll
-;extension=php_db.dll
-;extension=php_dba.dll
-;extension=php_dbase.dll
-;extension=php_dbx.dll
-;extension=php_domxml.dll
-;extension=php_dotnet.dll
-;extension=php_exif.dll
-;extension=php_fdf.dll
-;extension=php_filepro.dll
-;extension=php_gd.dll
-;extension=php_gettext.dll
-;extension=php_hyperwave.dll
-;extension=php_iconv.dll
-;extension=php_ifx.dll
-;extension=php_iisfunc.dll
-;extension=php_imap.dll
-;extension=php_ingres.dll
-;extension=php_interbase.dll
-;extension=php_java.dll
-;extension=php_ldap.dll
-;extension=php_mbstring.dll
-;extension=php_mcrypt.dll
-;extension=php_mhash.dll
-;extension=php_ming.dll
-;extension=php_mssql.dll
-;extension=php_oci8.dll
-;extension=php_openssl.dll
-;extension=php_oracle.dll
-;extension=php_pdf.dll
-;extension=php_pgsql.dll
-;extension=php_printer.dll
-;extension=php_sablot.dll
-;extension=php_snmp.dll
-;extension=php_sybase_ct.dll
-;extension=php_xslt.dll
-;extension=php_yaz.dll
-;extension=php_zlib.dll
-
-;;;;;;;;;;;;;;;;;;;
-; Module Settings ;
-;;;;;;;;;;;;;;;;;;;
-
-[Syslog]
-define_syslog_variables = Off ; Whether or not to define the various syslog variables,
- ; e.g. $LOG_PID, $LOG_CRON, etc. Turning it off is a
- ; good idea performance-wise. In runtime, you can define
- ; these variables by calling define_syslog_variables()
-
-
-[mail function]
-SMTP = localhost ;for win32 only
-sendmail_from = me@localhost.com ;for win32 only
-;sendmail_path = ;for unix only, may supply arguments as well (default is 'sendmail -t -i')
-
-[Debugger]
-debugger.host = localhost
-debugger.port = 7869
-debugger.enabled = False
-
-[Logging]
-; These configuration directives are used by the example logging mechanism.
-; See examples/README.logging for more explanation.
-;logging.method = db
-;logging.directory = /path/to/log/directory
-
-[Java]
-;java.class.path = .\php_java.jar
-;java.home = c:\jdk
-;java.library = c:\jdk\jre\bin\hotspot\jvm.dll
-;java.library.path = .\
-
-[SQL]
-sql.safe_mode = Off
-
-[ODBC]
-;odbc.default_db = Not yet implemented
-;odbc.default_user = Not yet implemented
-;odbc.default_pw = Not yet implemented
-odbc.allow_persistent = On ; allow or prevent persistent links
-odbc.check_persistent = On ; check that a connection is still validbefore reuse
-odbc.max_persistent = -1 ; maximum number of persistent links. -1 means no limit
-odbc.max_links = -1 ; maximum number of links (persistent+non persistent). -1 means no limit
-odbc.defaultlrl = 4096 ; Handling of LONG fields. Returns number of bytes to variables, 0 means passthru
-odbc.defaultbinmode = 1 ; Handling of binary data. 0 means passthru, 1 return as is, 2 convert to char
-; See the documentation on odbc_binmode and odbc_longreadlen for an explanation of uodbc.defaultlrl
-; and uodbc.defaultbinmode
-
-[MySQL]
-mysql.allow_persistent = On ; allow or prevent persistent link
-mysql.max_persistent = -1 ; maximum number of persistent links. -1 means no limit
-mysql.max_links = -1 ; maximum number of links (persistent+non persistent). -1 means no limit
-mysql.default_port = ; default port number for mysql_connect(). If unset,
- ; mysql_connect() will use the $MYSQL_TCP_PORT, or the mysql-tcp
- ; entry in /etc/services, or the compile-time defined MYSQL_PORT
- ; (in that order). Win32 will only look at MYSQL_PORT.
-mysql.default_socket = ; default socket name for local MySQL connects. If empty, uses the built-in
- ; MySQL defaults
-mysql.default_host = ; default host for mysql_connect() (doesn't apply in safe mode)
-mysql.default_user = ; default user for mysql_connect() (doesn't apply in safe mode)
-mysql.default_password = ; default password for mysql_connect() (doesn't apply in safe mode)
- ; Note that this is generally a *bad* idea to store passwords
- ; in this file. *Any* user with PHP access can run
- ; 'echo cfg_get_var("mysql.default_password")' and reveal that
- ; password! And of course, any users with read access to this
- ; file will be able to reveal the password as well.
-
-[mSQL]
-msql.allow_persistent = On ; allow or prevent persistent link
-msql.max_persistent = -1 ; maximum number of persistent links. -1 means no limit
-msql.max_links = -1 ; maximum number of links (persistent+non persistent). -1 means no limit
-
-[PostgresSQL]
-pgsql.allow_persistent = On ; allow or prevent persistent link
-pgsql.max_persistent = -1 ; maximum number of persistent links. -1 means no limit
-pgsql.max_links = -1 ; maximum number of links (persistent+non persistent). -1 means no limit
-
-[Sybase]
-sybase.allow_persistent = On ; allow or prevent persistent link
-sybase.max_persistent = -1 ; maximum number of persistent links. -1 means no limit
-sybase.max_links = -1 ; maximum number of links (persistent+non persistent). -1 means no limit
-;sybase.interface_file = "/usr/sybase/interfaces"
-sybase.min_error_severity = 10 ; minimum error severity to display
-sybase.min_message_severity = 10 ; minimum message severity to display
-sybase.compatability_mode = Off ; compatability mode with old versions of PHP 3.0.
- ; If on, this will cause PHP to automatically assign types to results
- ; according to their Sybase type, instead of treating them all as
- ; strings. This compatability mode will probably not stay around
- ; forever, so try applying whatever necessary changes to your code,
- ; and turn it off.
-
-[Sybase-CT]
-sybct.allow_persistent = On ; allow or prevent persistent link
-sybct.max_persistent = -1 ; maximum number of persistent links. -1 means no limit
-sybct.max_links = -1 ; maximum number of links (persistent+non persistent). -1 means no limit
-sybct.min_server_severity = 10 ; minimum server message severity to display
-sybct.min_client_severity = 10 ; minimum client message severity to display
-
-[bcmath]
-bcmath.scale = 0 ; number of decimal digits for all bcmath functions
-
-[browscap]
-;browscap = extra/browscap.ini
-
-[Informix]
-ifx.default_host = ; default host for ifx_connect() (doesn't apply in safe mode)
-ifx.default_user = ; default user for ifx_connect() (doesn't apply in safe mode)
-ifx.default_password = ; default password for ifx_connect() (doesn't apply in safe mode)
-ifx.allow_persistent = On ; allow or prevent persistent link
-ifx.max_persistent = -1 ; maximum number of persistent links. -1 means no limit
-ifx.max_links = -1 ; maximum number of links (persistent+non persistent). -1 means no limit
-ifx.textasvarchar = 0 ; if set on, select statements return the contents of a text blob instead of it's id
-ifx.byteasvarchar = 0 ; if set on, select statements return the contents of a byte blob instead of it's id
-ifx.charasvarchar = 0 ; trailing blanks are stripped from fixed-length char columns. May help the life
- ; of Informix SE users.
-ifx.blobinfile = 0 ; if set on, the contents of text&byte blobs are dumped to a file instead of
- ; keeping them in memory
-ifx.nullformat = 0 ; NULL's are returned as empty strings, unless this is set to 1. In that case,
- ; NULL's are returned as string 'NULL'.
-
-[Session]
-session.save_handler = files ; handler used to store/retrieve data
-session.save_path = /tmp ; argument passed to save_handler
- ; in the case of files, this is the
- ; path where data files are stored
-session.use_cookies = 1 ; whether to use cookies
-session.name = PHPSESSID
- ; name of the session
- ; is used as cookie name
-session.auto_start = 0 ; initialize session on request startup
-session.cookie_lifetime = 0 ; lifetime in seconds of cookie
- ; or if 0, until browser is restarted
-session.cookie_path = / ; the path the cookie is valid for
-session.cookie_domain = ; the domain the cookie is valid for
-session.serialize_handler = php ; handler used to serialize data
- ; php is the standard serializer of PHP
-session.gc_probability = 1 ; percentual probability that the
- ; 'garbage collection' process is started
- ; on every session initialization
-session.gc_maxlifetime = 1440 ; after this number of seconds, stored
- ; data will be seen as 'garbage' and
- ; cleaned up by the gc process
-session.referer_check = ; check HTTP Referer to invalidate
- ; externally stored URLs containing ids
-session.entropy_length = 0 ; how many bytes to read from the file
-session.entropy_file = ; specified here to create the session id
-; session.entropy_length = 16
-; session.entropy_file = /dev/urandom
-session.cache_limiter = nocache ; set to {nocache,private,public} to
- ; determine HTTP caching aspects
-session.cache_expire = 180 ; document expires after n minutes
-session.use_trans_sid = 1 ; use transient sid support if enabled
- ; by compiling with --enable-trans-sid
-
-url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=fakeentry"
-
-[MSSQL]
-mssql.allow_persistent = On ; allow or prevent persistent link
-mssql.max_persistent = -1 ; maximum number of persistent links. -1 means no limit
-mssql.max_links = -1 ; maximum number of links (persistent+non persistent). -1 means no limit
-mssql.min_error_severity = 10 ; minimum error severity to display
-mssql.min_message_severity = 10 ; minimum message severity to display
-mssql.compatability_mode = Off ; compatability mode with old versions of PHP 3.0.
-;mssql.textlimit = 4096 ; valid range 0 - 2147483647 default = 4096
-;mssql.textsize = 4096 ; valid range 0 - 2147483647 default = 4096
-;mssql.batchsize = 0 ; limits the number of records in each bach. 0 = all records in one batch.
-
-[Assertion]
-;assert.active = Off ; assert(expr); does nothing by default
-;assert.warning = On ; issue a PHP warning for each failed assertion.
-;assert.bail = Off ; don't bail out by default.
-;assert.callback = 0 ; user-function to be called if an assertion fails.
-;assert.quiet_eval = 0 ; eval the expression with current error_reporting(). set to true if you want error_reporting(0) around the eval().
-
-[Ingres II]
-ingres.allow_persistent = On ; allow or prevent persistent link
-ingres.max_persistent = -1 ; maximum number of persistent links. (-1 means no limit)
-ingres.max_links = -1 ; maximum number of links, including persistents (-1 means no limit)
-ingres.default_database = ; default database (format : [node_id::]dbname[/srv_class]
-ingres.default_user = ; default user
-ingres.default_password = ; default password
-
-[Verisign Payflow Pro]
-pfpro.defaulthost = "test.signio.com" ; default Signio server
-pfpro.defaultport = 443 ; default port to connect to
-pfpro.defaulttimeout = 30 ; default timeout in seconds
-
-; pfpro.proxyaddress = ; default proxy IP address (if required)
-; pfpro.proxyport = ; default proxy port
-; pfpro.proxylogon = ; default proxy logon
-; pfpro.proxypassword = ; default proxy password
-
-[Sockets]
-sockets.use_system_read = Off ; Use the system read() function instead of
- ; the php_read() wrapper.
-[com]
-;com.typelib_file = ; path to a file containing GUIDs, IIDs or filenames of files with TypeLibs
-;com.allow_dcom = true ; allow Distributed-COM calls
-
-[Printer]
-;printer.default_printer = ""
-
-[mbstring]
-;mbstring.internal_encoding = EUC-JP
-;mbstring.http_input = auto
-;mbstring.http_output = SJIS
-;mbstring.detect_order = auto
-;mbstring.substitute_character = none;
-
-; Local Variables:
-; tab-width: 4
-; End: \ No newline at end of file
diff --git a/php.ini-recommended b/php.ini-recommended
deleted file mode 100644
index e9538edfd6..0000000000
--- a/php.ini-recommended
+++ /dev/null
@@ -1,528 +0,0 @@
-[PHP]
-
-;;;;;;;;;;;;;;;;;;;
-; About this file ;
-;;;;;;;;;;;;;;;;;;;
-;
-; This is the 'optimized', PHP 4-style version of the php.ini-dist file.
-; For general information about the php.ini file, please consult the php.ini-dist
-; file, included in your PHP distribution.
-;
-; This file is different from the php.ini-dist file in the fact that it features
-; different values for several directives, in order to improve performance, while
-; possibly breaking compatibility with the standard out-of-the-box behavior of
-; PHP 3. Please make sure you read what's different, and modify your scripts
-; accordingly, if you decide to use this file instead.
-;
-; - allow_call_time_pass_reference = Off
-; It's not possible to decide to force a variable to be passed by reference
-; when calling a function. The PHP 4 style to do this is by making the
-; function require the relevant argument by reference.
-; - register_globals = Off
-; Global variables are no longer registered for input data (POST, GET, cookies,
-; environment and other server variables). Instead of using $foo, you must use
-; $HTTP_POST_VARS["foo"], $HTTP_GET_VARS["foo"], $HTTP_COOKIE_VARS["foo"],
-; $HTTP_ENV_VARS["foo"] or $HTTP_SERVER_VARS["foo"], depending on which kind
-; of input source you're expecting 'foo' to come from.
-; - register_argc_argv = Off
-; Disables registration of the somewhat redundant $argv and $argc global
-; variables.
-; - magic_quotes_gpc = Off
-; Input data is no longer escaped with slashes so that it can be sent into
-; SQL databases without further manipulation. Instead, you should use the
-; function addslashes() on each input element you wish to send to a database.
-; - variables_order = "GPCS"
-; The environment variables are not hashed into the $HTTP_ENV_VARS[]. To access
-; environment variables, you can use getenv() instead.
-
-
-;;;;;;;;;;;;;;;;;;;;
-; Language Options ;
-;;;;;;;;;;;;;;;;;;;;
-
-engine = On ; Enable the PHP scripting language engine under Apache
-short_open_tag = On ; allow the <? tag. otherwise, only <?php and <script> tags are recognized.
-asp_tags = Off ; allow ASP-style <% %> tags
-precision = 14 ; number of significant digits displayed in floating point numbers
-y2k_compliance = Off ; whether to be year 2000 compliant (will cause problems with non y2k compliant browsers)
-output_buffering = Off ; Output buffering allows you to send header lines (including cookies)
- ; even after you send body content, in the price of slowing PHP's
- ; output layer a bit.
- ; You can enable output buffering by in runtime by calling the output
- ; buffering functions, or enable output buffering for all files
- ; by setting this directive to On.
-output_handler = ; You can redirect all of the output of your scripts to a function,
- ; that can be responsible to process or log it. For example,
- ; if you set the output_handler to "ob_gzhandler", than output
- ; will be transparently compressed for browsers that support gzip or
- ; deflate encoding. Setting an output handler automatically turns on
- ; output buffering.
-zlib.output_compression = Off ; Transparent output compression using the zlib library
- ; Valid values for this option are 'off', 'on', or a specific buffer size
- ; to be used for compression (default is 4KB)
-
-implicit_flush = Off ; Implicit flush tells PHP to tell the output layer to flush itself
- ; automatically after every output block. This is equivalent to
- ; calling the PHP function flush() after each and every call to print()
- ; or echo() and each and every HTML block.
- ; Turning this option on has serious performance implications, and
- ; is generally recommended for debugging purposes only.
-allow_call_time_pass_reference = Off ; whether to enable the ability to force arguments to be
- ; passed by reference at function-call time. This method
- ; is deprecated, and is likely to be unsupported in future
- ; versions of PHP/Zend. The encouraged method of specifying
- ; which arguments should be passed by reference is in the
- ; function declaration. You're encouraged to try and
- ; turn this option Off, and make sure your scripts work
- ; properly with it, to ensure they will work with future
- ; versions of the language (you will receive a warning
- ; each time you use this feature, and the argument will
- ; be passed by value instead of by reference).
-
-; Safe Mode
-safe_mode = Off
-safe_mode_exec_dir =
-safe_mode_allowed_env_vars = PHP_ ; Setting certain environment variables
- ; may be a potential security breach.
- ; This directive contains a comma-delimited
- ; list of prefixes. In Safe Mode, the
- ; user may only alter environment
- ; variables whose names begin with the
- ; prefixes supplied here.
- ; By default, users will only be able
- ; to set environment variables that begin
- ; with PHP_ (e.g. PHP_FOO=BAR).
- ; Note: If this directive is empty, PHP
- ; will let the user modify ANY environment
- ; variable!
-safe_mode_protected_env_vars = LD_LIBRARY_PATH ; This directive contains a comma-
- ; delimited list of environment variables,
- ; that the end user won't be able to
- ; change using putenv().
- ; These variables will be protected
- ; even if safe_mode_allowed_env_vars is
- ; set to allow to change them.
-
-
-disable_functions = ; This directive allows you to disable certain
- ; functions for security reasons. It receives
- ; a comma separated list of function names.
- ; This directive is *NOT* affected by whether
- ; Safe Mode is turned on or off.
-
-
-; Colors for Syntax Highlighting mode. Anything that's acceptable in <font color=???> would work.
-highlight.string = #DD0000
-highlight.comment = #FF8000
-highlight.keyword = #007700
-highlight.bg = #FFFFFF
-highlight.default = #0000BB
-highlight.html = #000000
-
-; Misc
-expose_php = On ; Decides whether PHP may expose the fact that it is installed on the
- ; server (e.g., by adding its signature to the Web server header).
- ; It is no security threat in any way, but it makes it possible
- ; to determine whether you use PHP on your server or not.
-
-
-
-;;;;;;;;;;;;;;;;;;;
-; Resource Limits ;
-;;;;;;;;;;;;;;;;;;;
-
-max_execution_time = 30 ; Maximum execution time of each script, in seconds
-memory_limit = 8M ; Maximum amount of memory a script may consume (8MB)
-
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-; Error handling and logging ;
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-; error_reporting is a bit-field. Or each number up to get desired error reporting level
-; E_ALL - All errors and warnings
-; E_ERROR - fatal run-time errors
-; E_WARNING - run-time warnings (non fatal errors)
-; E_PARSE - compile-time parse errors
-; E_NOTICE - run-time notices (these are warnings which often result from a bug in
-; your code, but it's possible that it was intentional (e.g., using an
-; uninitialized variable and relying on the fact it's automatically
-; initialized to an empty string)
-; E_CORE_ERROR - fatal errors that occur during PHP's initial startup
-; E_CORE_WARNING - warnings (non fatal errors) that occur during PHP's initial startup
-; E_COMPILE_ERROR - fatal compile-time errors
-; E_COMPILE_WARNING - compile-time warnings (non fatal errors)
-; E_USER_ERROR - user-generated error message
-; E_USER_WARNING - user-generated warning message
-; E_USER_NOTICE - user-generated notice message
-; Examples:
-; error_reporting = E_ALL & ~E_NOTICE ; show all errors, except for notices
-; error_reporting = E_COMPILE_ERROR|E_ERROR|E_CORE_ERROR ; show only errors
-error_reporting = E_ALL & ~E_NOTICE ; Show all errors except for notices
-display_errors = On ; Print out errors (as a part of the output)
- ; For production web sites, you're strongly encouraged
- ; to turn this feature off, and use error logging instead (see below).
- ; Keeping display_errors enabled on a production web site may reveal
- ; security information to end users, such as file paths on your Web server,
- ; your database schema or other information.
-display_startup_errors = Off ; Even when display_errors is on, errors that occur during
- ; PHP's startup sequence are not displayed. It's strongly
- ; recommended to keep display_startup_errors off, except for
- ; when debugging.
-log_errors = Off ; Log errors into a log file (server-specific log, stderr, or error_log (below))
- ; As stated above, you're strongly advised to use error logging in place of
- ; error displaying on production web sites.
-track_errors = Off ; Store the last error/warning message in $php_errormsg (boolean)
-;error_prepend_string = "<font color=ff0000>" ; string to output before an error message
-;error_append_string = "</font>" ; string to output after an error message
-;error_log = filename ; log errors to specified file
-;error_log = syslog ; log errors to syslog (Event Log on NT, not valid in Windows 95)
-warn_plus_overloading = Off ; warn if the + operator is used with strings
-
-
-;;;;;;;;;;;;;;;;;
-; Data Handling ;
-;;;;;;;;;;;;;;;;;
-
-;arg_separator.output = "&amp;" ; The separator used in PHP generated URLs to separate arguments.
- ; Default is "&".
-
-;arg_separator.input = ";&" ; List of separator(s) used by PHP to parse input URLs into variables.
- ; Default is "&".
- ; NOTE: Every character in this directive is considered as separator!
-
-variables_order = "GPCS" ; This directive describes the order in which PHP registers
- ; GET, POST, Cookie, Environment and Built-in variables (G, P,
- ; C, E & S respectively, often referred to as EGPCS or GPC).
- ; Registration is done from left to right, newer values override
- ; older values.
-register_globals = Off ; Whether or not to register the EGPCS variables as global
- ; variables. You may want to turn this off if you don't want
- ; to clutter your scripts' global scope with user data. This makes
- ; most sense when coupled with track_vars - in which case you can
- ; access all of the GPC variables through the $HTTP_*_VARS[],
- ; variables.
-register_argc_argv = Off ; This directive tells PHP whether to declare the argv&argc
- ; variables (that would contain the GET information). If you
- ; don't use these variables, you should turn it off for
- ; increased performance (you should try not to use it anyway,
- ; for less likelihood of security bugs in your code).
-post_max_size = 8M ; Maximum size of POST data that PHP will accept.
-gpc_order = "GPC" ; This directive is deprecated. Use variables_order instead.
-
-; Magic quotes
-magic_quotes_gpc = Off ; magic quotes for incoming GET/POST/Cookie data
-magic_quotes_runtime= Off ; magic quotes for runtime-generated data, e.g. data from SQL, from exec(), etc.
-magic_quotes_sybase = Off ; Use Sybase-style magic quotes (escape ' with '' instead of \')
-
-; automatically add files before or after any PHP document
-auto_prepend_file =
-auto_append_file =
-
-; As of 4.0b4, PHP always outputs a character encoding by default in
-; the Content-type: header. To disable sending of the charset, simply
-; set it to be empty.
-; PHP's built-in default is text/html
-default_mimetype = "text/html"
-;default_charset = "iso-8859-1"
-
-;;;;;;;;;;;;;;;;;;;;;;;;;
-; Paths and Directories ;
-;;;;;;;;;;;;;;;;;;;;;;;;;
-include_path = ; UNIX: "/path1:/path2" Windows: "\path1;\path2"
-doc_root = ; the root of the php pages, used only if nonempty
-user_dir = ; the directory under which php opens the script using /~username, used only if nonempty
-extension_dir = ./ ; directory in which the loadable extensions (modules) reside
-enable_dl = On ; Whether or not to enable the dl() function.
- ; The dl() function does NOT properly work in multithreaded
- ; servers, such as IIS or Zeus, and is automatically disabled
- ; on them.
-
-
-;;;;;;;;;;;;;;;;
-; File Uploads ;
-;;;;;;;;;;;;;;;;
-file_uploads = On ; Whether to allow HTTP file uploads
-;upload_tmp_dir = ; temporary directory for HTTP uploaded files (will use system default if not specified)
-upload_max_filesize = 2M ; Maximum allowed size for uploaded files
-
-
-;;;;;;;;;;;;;;;;;;
-; Fopen wrappers ;
-;;;;;;;;;;;;;;;;;;
-allow_url_fopen = On ; Whether to allow the treatment of URLs (like http:// or ftp://) as files
-;from="john@doe.com" ; Define the anonymous ftp password (your email address)
-
-
-;;;;;;;;;;;;;;;;;;;;;;
-; Dynamic Extensions ;
-;;;;;;;;;;;;;;;;;;;;;;
-; if you wish to have an extension loaded automaticly, use the
-; following syntax: extension=modulename.extension
-; for example, on windows,
-; extension=msql.dll
-; or under UNIX,
-; extension=msql.so
-; Note that it should be the name of the module only, no directory information
-; needs to go here. Specify the location of the extension with the extension_dir directive above.
-
-
-
-;Windows Extensions
-;Note that MySQL and ODBC support is now built in, so no dll is needed for it.
-;
-;extension=php_bz2.dll
-;extension=php_ctype.dll
-;extension=php_cpdf.dll
-;extension=php_curl.dll
-;extension=php_cybercash.dll
-;extension=php_db.dll
-;extension=php_dba.dll
-;extension=php_dbase.dll
-;extension=php_dbx.dll
-;extension=php_domxml.dll
-;extension=php_dotnet.dll
-;extension=php_exif.dll
-;extension=php_fdf.dll
-;extension=php_filepro.dll
-;extension=php_gd.dll
-;extension=php_gettext.dll
-;extension=php_hyperwave.dll
-;extension=php_iconv.dll
-;extension=php_ifx.dll
-;extension=php_iisfunc.dll
-;extension=php_imap.dll
-;extension=php_ingres.dll
-;extension=php_interbase.dll
-;extension=php_java.dll
-;extension=php_ldap.dll
-;extension=php_mbstring.dll
-;extension=php_mcrypt.dll
-;extension=php_mhash.dll
-;extension=php_ming.dll
-;extension=php_mssql.dll
-;extension=php_oci8.dll
-;extension=php_openssl.dll
-;extension=php_oracle.dll
-;extension=php_pdf.dll
-;extension=php_pgsql.dll
-;extension=php_printer.dll
-;extension=php_sablot.dll
-;extension=php_snmp.dll
-;extension=php_sybase_ct.dll
-;extension=php_xslt.dll
-;extension=php_yaz.dll
-;extension=php_zlib.dll
-
-;;;;;;;;;;;;;;;;;;;
-; Module Settings ;
-;;;;;;;;;;;;;;;;;;;
-
-[Syslog]
-define_syslog_variables = Off ; Whether or not to define the various syslog variables,
- ; e.g. $LOG_PID, $LOG_CRON, etc. Turning it off is a
- ; good idea performance-wise. In runtime, you can define
- ; these variables by calling define_syslog_variables()
-
-
-[mail function]
-SMTP = localhost ;for win32 only
-sendmail_from = me@localhost.com ;for win32 only
-;sendmail_path = ;for unix only, may supply arguments as well (default is 'sendmail -t -i')
-
-[Debugger]
-debugger.host = localhost
-debugger.port = 7869
-debugger.enabled = False
-
-[Logging]
-; These configuration directives are used by the example logging mechanism.
-; See examples/README.logging for more explanation.
-;logging.method = db
-;logging.directory = /path/to/log/directory
-
-[Java]
-;java.class.path = .\php_java.jar
-;java.home = c:\jdk
-;java.library = c:\jdk\jre\bin\hotspot\jvm.dll
-;java.library.path = .\
-
-[SQL]
-sql.safe_mode = Off
-
-[ODBC]
-;odbc.default_db = Not yet implemented
-;odbc.default_user = Not yet implemented
-;odbc.default_pw = Not yet implemented
-odbc.allow_persistent = On ; allow or prevent persistent links
-odbc.check_persistent = On ; check that a connection is still validbefore reuse
-odbc.max_persistent = -1 ; maximum number of persistent links. -1 means no limit
-odbc.max_links = -1 ; maximum number of links (persistent+non persistent). -1 means no limit
-odbc.defaultlrl = 4096 ; Handling of LONG fields. Returns number of bytes to variables, 0 means passthru
-odbc.defaultbinmode = 1 ; Handling of binary data. 0 means passthru, 1 return as is, 2 convert to char
-; See the documentation on odbc_binmode and odbc_longreadlen for an explanation of uodbc.defaultlrl
-; and uodbc.defaultbinmode
-
-[MySQL]
-mysql.allow_persistent = On ; allow or prevent persistent link
-mysql.max_persistent = -1 ; maximum number of persistent links. -1 means no limit
-mysql.max_links = -1 ; maximum number of links (persistent+non persistent). -1 means no limit
-mysql.default_port = ; default port number for mysql_connect(). If unset,
- ; mysql_connect() will use the $MYSQL_TCP_PORT, or the mysql-tcp
- ; entry in /etc/services, or the compile-time defined MYSQL_PORT
- ; (in that order). Win32 will only look at MYSQL_PORT.
-mysql.default_socket = ; default socket name for local MySQL connects. If empty, uses the built-in
- ; MySQL defaults
-mysql.default_host = ; default host for mysql_connect() (doesn't apply in safe mode)
-mysql.default_user = ; default user for mysql_connect() (doesn't apply in safe mode)
-mysql.default_password = ; default password for mysql_connect() (doesn't apply in safe mode)
- ; Note that this is generally a *bad* idea to store passwords
- ; in this file. *Any* user with PHP access can run
- ; 'echo cfg_get_var("mysql.default_password")' and reveal that
- ; password! And of course, any users with read access to this
- ; file will be able to reveal the password as well.
-
-[mSQL]
-msql.allow_persistent = On ; allow or prevent persistent link
-msql.max_persistent = -1 ; maximum number of persistent links. -1 means no limit
-msql.max_links = -1 ; maximum number of links (persistent+non persistent). -1 means no limit
-
-[PostgresSQL]
-pgsql.allow_persistent = On ; allow or prevent persistent link
-pgsql.max_persistent = -1 ; maximum number of persistent links. -1 means no limit
-pgsql.max_links = -1 ; maximum number of links (persistent+non persistent). -1 means no limit
-
-[Sybase]
-sybase.allow_persistent = On ; allow or prevent persistent link
-sybase.max_persistent = -1 ; maximum number of persistent links. -1 means no limit
-sybase.max_links = -1 ; maximum number of links (persistent+non persistent). -1 means no limit
-;sybase.interface_file = "/usr/sybase/interfaces"
-sybase.min_error_severity = 10 ; minimum error severity to display
-sybase.min_message_severity = 10 ; minimum message severity to display
-sybase.compatability_mode = Off ; compatability mode with old versions of PHP 3.0.
- ; If on, this will cause PHP to automatically assign types to results
- ; according to their Sybase type, instead of treating them all as
- ; strings. This compatability mode will probably not stay around
- ; forever, so try applying whatever necessary changes to your code,
- ; and turn it off.
-
-[Sybase-CT]
-sybct.allow_persistent = On ; allow or prevent persistent link
-sybct.max_persistent = -1 ; maximum number of persistent links. -1 means no limit
-sybct.max_links = -1 ; maximum number of links (persistent+non persistent). -1 means no limit
-sybct.min_server_severity = 10 ; minimum server message severity to display
-sybct.min_client_severity = 10 ; minimum client message severity to display
-
-[bcmath]
-bcmath.scale = 0 ; number of decimal digits for all bcmath functions
-
-[browscap]
-;browscap = extra/browscap.ini
-
-[Informix]
-ifx.default_host = ; default host for ifx_connect() (doesn't apply in safe mode)
-ifx.default_user = ; default user for ifx_connect() (doesn't apply in safe mode)
-ifx.default_password = ; default password for ifx_connect() (doesn't apply in safe mode)
-ifx.allow_persistent = On ; allow or prevent persistent link
-ifx.max_persistent = -1 ; maximum number of persistent links. -1 means no limit
-ifx.max_links = -1 ; maximum number of links (persistent+non persistent). -1 means no limit
-ifx.textasvarchar = 0 ; if set on, select statements return the contents of a text blob instead of it's id
-ifx.byteasvarchar = 0 ; if set on, select statements return the contents of a byte blob instead of it's id
-ifx.charasvarchar = 0 ; trailing blanks are stripped from fixed-length char columns. May help the life
- ; of Informix SE users.
-ifx.blobinfile = 0 ; if set on, the contents of text&byte blobs are dumped to a file instead of
- ; keeping them in memory
-ifx.nullformat = 0 ; NULL's are returned as empty strings, unless this is set to 1. In that case,
- ; NULL's are returned as string 'NULL'.
-
-[Session]
-session.save_handler = files ; handler used to store/retrieve data
-session.save_path = /tmp ; argument passed to save_handler
- ; in the case of files, this is the
- ; path where data files are stored
-session.use_cookies = 1 ; whether to use cookies
-session.name = PHPSESSID
- ; name of the session
- ; is used as cookie name
-session.auto_start = 0 ; initialize session on request startup
-session.cookie_lifetime = 0 ; lifetime in seconds of cookie
- ; or if 0, until browser is restarted
-session.cookie_path = / ; the path the cookie is valid for
-session.cookie_domain = ; the domain the cookie is valid for
-session.serialize_handler = php ; handler used to serialize data
- ; php is the standard serializer of PHP
-session.gc_probability = 1 ; percentual probability that the
- ; 'garbage collection' process is started
- ; on every session initialization
-session.gc_maxlifetime = 1440 ; after this number of seconds, stored
- ; data will be seen as 'garbage' and
- ; cleaned up by the gc process
-session.referer_check = ; check HTTP Referer to invalidate
- ; externally stored URLs containing ids
-session.entropy_length = 0 ; how many bytes to read from the file
-session.entropy_file = ; specified here to create the session id
-; session.entropy_length = 16
-; session.entropy_file = /dev/urandom
-session.cache_limiter = nocache ; set to {nocache,private,public} to
- ; determine HTTP caching aspects
-session.cache_expire = 180 ; document expires after n minutes
-session.use_trans_sid = 1 ; use transient sid support if enabled
- ; by compiling with --enable-trans-sid
-
-url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=fakeentry"
-
-[MSSQL]
-mssql.allow_persistent = On ; allow or prevent persistent link
-mssql.max_persistent = -1 ; maximum number of persistent links. -1 means no limit
-mssql.max_links = -1 ; maximum number of links (persistent+non persistent). -1 means no limit
-mssql.min_error_severity = 10 ; minimum error severity to display
-mssql.min_message_severity = 10 ; minimum message severity to display
-mssql.compatability_mode = Off ; compatability mode with old versions of PHP 3.0.
-;mssql.textlimit = 4096 ; valid range 0 - 2147483647 default = 4096
-;mssql.textsize = 4096 ; valid range 0 - 2147483647 default = 4096
-;mssql.batchsize = 0 ; limits the number of records in each bach. 0 = all records in one batch.
-
-[Assertion]
-;assert.active = Off ; assert(expr); does nothing by default
-;assert.warning = On ; issue a PHP warning for each failed assertion.
-;assert.bail = Off ; don't bail out by default.
-;assert.callback = 0 ; user-function to be called if an assertion fails.
-;assert.quiet_eval = 0 ; eval the expression with current error_reporting(). set to true if you want error_reporting(0) around the eval().
-
-[Ingres II]
-ingres.allow_persistent = On ; allow or prevent persistent link
-ingres.max_persistent = -1 ; maximum number of persistent links. (-1 means no limit)
-ingres.max_links = -1 ; maximum number of links, including persistents (-1 means no limit)
-ingres.default_database = ; default database (format : [node_id::]dbname[/srv_class]
-ingres.default_user = ; default user
-ingres.default_password = ; default password
-
-[Verisign Payflow Pro]
-pfpro.defaulthost = "test.signio.com" ; default Signio server
-pfpro.defaultport = 443 ; default port to connect to
-pfpro.defaulttimeout = 30 ; default timeout in seconds
-
-; pfpro.proxyaddress = ; default proxy IP address (if required)
-; pfpro.proxyport = ; default proxy port
-; pfpro.proxylogon = ; default proxy logon
-; pfpro.proxypassword = ; default proxy password
-
-[Sockets]
-sockets.use_system_read = Off ; Use the system read() function instead of
- ; the php_read() wrapper.
-[com]
-;com.typelib_file = ; path to a file containing GUIDs, IIDs or filenames of files with TypeLibs
-;com.allow_dcom = true ; allow Distributed-COM calls
-
-[Printer]
-;printer.default_printer = ""
-
-[mbstring]
-;mbstring.internal_encoding = EUC-JP
-;mbstring.http_input = auto
-;mbstring.http_output = SJIS
-;mbstring.detect_order = auto
-;mbstring.substitute_character = none;
-
-; Local Variables:
-; tab-width: 4
-; End: \ No newline at end of file
diff --git a/php4.gif b/php4.gif
deleted file mode 100644
index e5d3c477fd..0000000000
--- a/php4.gif
+++ /dev/null
Binary files differ
diff --git a/php4.spec.in b/php4.spec.in
deleted file mode 100644
index cfcd0796c7..0000000000
--- a/php4.spec.in
+++ /dev/null
@@ -1,48 +0,0 @@
-%define version @VERSION@
-%define so_version 4
-%define release 1
-
-Name: php
-Summary: PHP: Hypertext Preprocessor
-Group: Development/Languages
-Version: %{version}
-Release: %{release}
-Copyright: The PHP license (see "LICENSE" file included in distribution)
-Source: http://www.php.net/version4/downloads/php-%{version}.tar.gz
-Icon: php4.gif
-URL: http://www.php.net/
-Packager: PHP Group <group@php.net>
-
-BuildRoot: /var/tmp/php-%{version}
-
-%description
-PHP is an HTML-embedded scripting language. Much of its syntax is
-borrowed from C, Java and Perl with a couple of unique PHP-specific
-features thrown in. The goal of the language is to allow web
-developers to write dynamically generated pages quickly.
-
-%prep
-
-%setup
-
-%build
-set -x
-./buildconf
-./configure --prefix=/usr --with-apxs \
- --enable-track-vars --disable-debug \
- --with-xml=shared \
-
-# figure out configure options options based on what packages are installed
-# to override, use the OVERRIDE_OPTIONS environment variable. To add
-# extra options, use the OPTIONS environment variable.
-
-#test rpm -q MySQL-devel >&/dev/null && OPTIONS="$OPTIONS --with-mysql=shared"
-#test rpm -q solid-devel >&/dev/null && OPTIONS="$OPTIONS --with-solid=shared,/home/solid"
-#test rpm -q postgresql-devel >&/dev/null && OPTIONS="$OPTIONS --with-pgsql=shared"
-test rpm -q expat >&/dev/null && OPTIONS="$OPTIONS --with-xml=shared"
-
-if test "x$OVERRIDE_OPTIONS" = "x"; then
- ./configure --prefix=/usr --with-apxs=$APXS $OPTIONS
-else
- ./configure $OVERRIDE_OPTIONS
-fi
diff --git a/regex/COPYRIGHT b/regex/COPYRIGHT
deleted file mode 100644
index d43362fbfc..0000000000
--- a/regex/COPYRIGHT
+++ /dev/null
@@ -1,20 +0,0 @@
-Copyright 1992, 1993, 1994 Henry Spencer. All rights reserved.
-This software is not subject to any license of the American Telephone
-and Telegraph Company or of the Regents of the University of California.
-
-Permission is granted to anyone to use this software for any purpose on
-any computer system, and to alter it and redistribute it, subject
-to the following restrictions:
-
-1. The author is not responsible for the consequences of use of this
- software, no matter how awful, even if they arise from flaws in it.
-
-2. The origin of this software must not be misrepresented, either by
- explicit claim or by omission. Since few users ever read sources,
- credits must appear in the documentation.
-
-3. Altered versions must be plainly marked as such, and must not be
- misrepresented as being the original software. Since few users
- ever read sources, credits must appear in the documentation.
-
-4. This notice may not be removed or altered.
diff --git a/regex/Makefile.in b/regex/Makefile.in
deleted file mode 100644
index 27b0331b9b..0000000000
--- a/regex/Makefile.in
+++ /dev/null
@@ -1,5 +0,0 @@
-
-LTLIBRARY_NAME = libregex.la
-LTLIBRARY_SOURCES = regcomp.c regexec.c regerror.c regfree.c
-
-include $(top_srcdir)/build/ltlib.mk
diff --git a/regex/README b/regex/README
deleted file mode 100644
index cea9b67b66..0000000000
--- a/regex/README
+++ /dev/null
@@ -1,32 +0,0 @@
-alpha3.4 release.
-Thu Mar 17 23:17:18 EST 1994
-henry@zoo.toronto.edu
-
-See WHATSNEW for change listing.
-
-installation notes:
---------
-Read the comments at the beginning of Makefile before running.
-
-Utils.h contains some things that just might have to be modified on
-some systems, as well as a nested include (ugh) of <assert.h>.
-
-The "fake" directory contains quick-and-dirty fakes for some header
-files and routines that old systems may not have. Note also that
--DUSEBCOPY will make utils.h substitute bcopy() for memmove().
-
-After that, "make r" will build regcomp.o, regexec.o, regfree.o,
-and regerror.o (the actual routines), bundle them together into a test
-program, and run regression tests on them. No output is good output.
-
-"make lib" builds just the .o files for the actual routines (when
-you're happy with testing and have adjusted CFLAGS for production),
-and puts them together into libregex.a. You can pick up either the
-library or *.o ("make lib" makes sure there are no other .o files left
-around to confuse things).
-
-Main.c, debug.c, split.c are used for regression testing but are not part
-of the RE routines themselves.
-
-Regex.h goes in /usr/include. All other .h files are internal only.
---------
diff --git a/regex/WHATSNEW b/regex/WHATSNEW
deleted file mode 100644
index 6e82e1dae0..0000000000
--- a/regex/WHATSNEW
+++ /dev/null
@@ -1,92 +0,0 @@
-New in alpha3.4: The complex bug alluded to below has been fixed (in a
-slightly kludgey temporary way that may hurt efficiency a bit; this is
-another "get it out the door for 4.4" release). The tests at the end of
-the tests file have accordingly been uncommented. The primary sign of
-the bug was that something like a?b matching ab matched b rather than ab.
-(The bug was essentially specific to this exact situation, else it would
-have shown up earlier.)
-
-New in alpha3.3: The definition of word boundaries has been altered
-slightly, to more closely match the usual programming notion that "_"
-is an alphabetic. Stuff used for pre-ANSI systems is now in a subdir,
-and the makefile no longer alludes to it in mysterious ways. The
-makefile has generally been cleaned up some. Fixes have been made
-(again!) so that the regression test will run without -DREDEBUG, at
-the cost of weaker checking. A workaround for a bug in some folks'
-<assert.h> has been added. And some more things have been added to
-tests, including a couple right at the end which are commented out
-because the code currently flunks them (complex bug; fix coming).
-Plus the usual minor cleanup.
-
-New in alpha3.2: Assorted bits of cleanup and portability improvement
-(the development base is now a BSDI system using GCC instead of an ancient
-Sun system, and the newer compiler exposed some glitches). Fix for a
-serious bug that affected REs using many [] (including REG_ICASE REs
-because of the way they are implemented), *sometimes*, depending on
-memory-allocation patterns. The header-file prototypes no longer name
-the parameters, avoiding possible name conflicts. The possibility that
-some clot has defined CHAR_MIN as (say) `-128' instead of `(-128)' is
-now handled gracefully. "uchar" is no longer used as an internal type
-name (too many people have the same idea). Still the same old lousy
-performance, alas.
-
-New in alpha3.1: Basically nothing, this release is just a bookkeeping
-convenience. Stay tuned.
-
-New in alpha3.0: Performance is no better, alas, but some fixes have been
-made and some functionality has been added. (This is basically the "get
-it out the door in time for 4.4" release.) One bug fix: regfree() didn't
-free the main internal structure (how embarrassing). It is now possible
-to put NULs in either the RE or the target string, using (resp.) a new
-REG_PEND flag and the old REG_STARTEND flag. The REG_NOSPEC flag to
-regcomp() makes all characters ordinary, so you can match a literal
-string easily (this will become more useful when performance improves!).
-There are now primitives to match beginnings and ends of words, although
-the syntax is disgusting and so is the implementation. The REG_ATOI
-debugging interface has changed a bit. And there has been considerable
-internal cleanup of various kinds.
-
-New in alpha2.3: Split change list out of README, and moved flags notes
-into Makefile. Macro-ized the name of regex(7) in regex(3), since it has
-to change for 4.4BSD. Cleanup work in engine.c, and some new regression
-tests to catch tricky cases thereof.
-
-New in alpha2.2: Out-of-date manpages updated. Regerror() acquires two
-small extensions -- REG_ITOA and REG_ATOI -- which avoid debugging kludges
-in my own test program and might be useful to others for similar purposes.
-The regression test will now compile (and run) without REDEBUG. The
-BRE \$ bug is fixed. Most uses of "uchar" are gone; it's all chars now.
-Char/uchar parameters are now written int/unsigned, to avoid possible
-portability problems with unpromoted parameters. Some unsigned casts have
-been introduced to minimize portability problems with shifting into sign
-bits.
-
-New in alpha2.1: Lots of little stuff, cleanup and fixes. The one big
-thing is that regex.h is now generated, using mkh, rather than being
-supplied in the distribution; due to circularities in dependencies,
-you have to build regex.h explicitly by "make h". The two known bugs
-have been fixed (and the regression test now checks for them), as has a
-problem with assertions not being suppressed in the absence of REDEBUG.
-No performance work yet.
-
-New in alpha2: Backslash-anything is an ordinary character, not an
-error (except, of course, for the handful of backslashed metacharacters
-in BREs), which should reduce script breakage. The regression test
-checks *where* null strings are supposed to match, and has generally
-been tightened up somewhat. Small bug fixes in parameter passing (not
-harmful, but technically errors) and some other areas. Debugging
-invoked by defining REDEBUG rather than not defining NDEBUG.
-
-New in alpha+3: full prototyping for internal routines, using a little
-helper program, mkh, which extracts prototypes given in stylized comments.
-More minor cleanup. Buglet fix: it's CHAR_BIT, not CHAR_BITS. Simple
-pre-screening of input when a literal string is known to be part of the
-RE; this does wonders for performance.
-
-New in alpha+2: minor bits of cleanup. Notably, the number "32" for the
-word width isn't hardwired into regexec.c any more, the public header
-file prototypes the functions if __STDC__ is defined, and some small typos
-in the manpages have been fixed.
-
-New in alpha+1: improvements to the manual pages, and an important
-extension, the REG_STARTEND option to regexec().
diff --git a/regex/cclass.h b/regex/cclass.h
deleted file mode 100644
index 6227f810b7..0000000000
--- a/regex/cclass.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/* character-class table */
-static struct cclass {
- char *name;
- char *chars;
- char *multis;
-} cclasses[] = {
- {"alnum", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", ""},
- {"alpha", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",
- ""},
- {"blank", " \t", ""},
- {"cntrl", "\007\b\t\n\v\f\r\1\2\3\4\5\6\16\17\20\21\22\23\24\
-\25\26\27\30\31\32\33\34\35\36\37\177", ""},
- {"digit", "0123456789", ""},
- {"graph", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\
-0123456789!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~",
- ""},
- {"lower", "abcdefghijklmnopqrstuvwxyz",
- ""},
- {"print", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\
-0123456789!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~ ",
- ""},
- {"punct", "!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~",
- ""},
- {"space", "\t\n\v\f\r ", ""},
- {"upper", "ABCDEFGHIJKLMNOPQRSTUVWXYZ",
- ""},
- {"xdigit", "0123456789ABCDEFabcdef",
- ""},
- {NULL, 0, ""}
-};
diff --git a/regex/cname.h b/regex/cname.h
deleted file mode 100644
index 670b273882..0000000000
--- a/regex/cname.h
+++ /dev/null
@@ -1,102 +0,0 @@
-/* character-name table */
-static struct cname {
- char *name;
- char code;
-} cnames[] = {
- {"NUL", '\0'},
- {"SOH", '\001'},
- {"STX", '\002'},
- {"ETX", '\003'},
- {"EOT", '\004'},
- {"ENQ", '\005'},
- {"ACK", '\006'},
- {"BEL", '\007'},
- {"alert", '\007'},
- {"BS", '\010'},
- {"backspace", '\b'},
- {"HT", '\011'},
- {"tab", '\t'},
- {"LF", '\012'},
- {"newline", '\n'},
- {"VT", '\013'},
- {"vertical-tab", '\v'},
- {"FF", '\014'},
- {"form-feed", '\f'},
- {"CR", '\015'},
- {"carriage-return", '\r'},
- {"SO", '\016'},
- {"SI", '\017'},
- {"DLE", '\020'},
- {"DC1", '\021'},
- {"DC2", '\022'},
- {"DC3", '\023'},
- {"DC4", '\024'},
- {"NAK", '\025'},
- {"SYN", '\026'},
- {"ETB", '\027'},
- {"CAN", '\030'},
- {"EM", '\031'},
- {"SUB", '\032'},
- {"ESC", '\033'},
- {"IS4", '\034'},
- {"FS", '\034'},
- {"IS3", '\035'},
- {"GS", '\035'},
- {"IS2", '\036'},
- {"RS", '\036'},
- {"IS1", '\037'},
- {"US", '\037'},
- {"space", ' '},
- {"exclamation-mark", '!'},
- {"quotation-mark", '"'},
- {"number-sign", '#'},
- {"dollar-sign", '$'},
- {"percent-sign", '%'},
- {"ampersand", '&'},
- {"apostrophe", '\''},
- {"left-parenthesis", '('},
- {"right-parenthesis", ')'},
- {"asterisk", '*'},
- {"plus-sign", '+'},
- {"comma", ','},
- {"hyphen", '-'},
- {"hyphen-minus", '-'},
- {"period", '.'},
- {"full-stop", '.'},
- {"slash", '/'},
- {"solidus", '/'},
- {"zero", '0'},
- {"one", '1'},
- {"two", '2'},
- {"three", '3'},
- {"four", '4'},
- {"five", '5'},
- {"six", '6'},
- {"seven", '7'},
- {"eight", '8'},
- {"nine", '9'},
- {"colon", ':'},
- {"semicolon", ';'},
- {"less-than-sign", '<'},
- {"equals-sign", '='},
- {"greater-than-sign", '>'},
- {"question-mark", '?'},
- {"commercial-at", '@'},
- {"left-square-bracket", '['},
- {"backslash", '\\'},
- {"reverse-solidus", '\\'},
- {"right-square-bracket", ']'},
- {"circumflex", '^'},
- {"circumflex-accent", '^'},
- {"underscore", '_'},
- {"low-line", '_'},
- {"grave-accent", '`'},
- {"left-brace", '{'},
- {"left-curly-bracket", '{'},
- {"vertical-line", '|'},
- {"right-brace", '}'},
- {"right-curly-bracket", '}'},
- {"tilde", '~'},
- {"DEL", '\177'},
- {NULL, 0},
-};
diff --git a/regex/debug.c b/regex/debug.c
deleted file mode 100644
index c0feaeb169..0000000000
--- a/regex/debug.c
+++ /dev/null
@@ -1,242 +0,0 @@
-#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
-#include <limits.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <regex.h>
-
-#include "utils.h"
-#include "regex2.h"
-#include "debug.ih"
-
-/*
- - regprint - print a regexp for debugging
- == void regprint(regex_t *r, FILE *d);
- */
-void
-regprint(r, d)
-regex_t *r;
-FILE *d;
-{
- register struct re_guts *g = r->re_g;
- register int i;
- register int c;
- register int last;
- int nincat[NC];
-
- fprintf(d, "%ld states, %d categories", (long)g->nstates,
- g->ncategories);
- fprintf(d, ", first %ld last %ld", (long)g->firststate,
- (long)g->laststate);
- if (g->iflags&USEBOL)
- fprintf(d, ", USEBOL");
- if (g->iflags&USEEOL)
- fprintf(d, ", USEEOL");
- if (g->iflags&BAD)
- fprintf(d, ", BAD");
- if (g->nsub > 0)
- fprintf(d, ", nsub=%ld", (long)g->nsub);
- if (g->must != NULL)
- fprintf(d, ", must(%ld) `%*s'", (long)g->mlen, (int)g->mlen,
- g->must);
- if (g->backrefs)
- fprintf(d, ", backrefs");
- if (g->nplus > 0)
- fprintf(d, ", nplus %ld", (long)g->nplus);
- fprintf(d, "\n");
- s_print(g, d);
- for (i = 0; i < g->ncategories; i++) {
- nincat[i] = 0;
- for (c = CHAR_MIN; c <= CHAR_MAX; c++)
- if (g->categories[c] == i)
- nincat[i]++;
- }
- fprintf(d, "cc0#%d", nincat[0]);
- for (i = 1; i < g->ncategories; i++)
- if (nincat[i] == 1) {
- for (c = CHAR_MIN; c <= CHAR_MAX; c++)
- if (g->categories[c] == i)
- break;
- fprintf(d, ", %d=%s", i, regchar(c));
- }
- fprintf(d, "\n");
- for (i = 1; i < g->ncategories; i++)
- if (nincat[i] != 1) {
- fprintf(d, "cc%d\t", i);
- last = -1;
- for (c = CHAR_MIN; c <= CHAR_MAX+1; c++) /* +1 does flush */
- if (c <= CHAR_MAX && g->categories[c] == i) {
- if (last < 0) {
- fprintf(d, "%s", regchar(c));
- last = c;
- }
- } else {
- if (last >= 0) {
- if (last != c-1)
- fprintf(d, "-%s",
- regchar(c-1));
- last = -1;
- }
- }
- fprintf(d, "\n");
- }
-}
-
-/*
- - s_print - print the strip for debugging
- == static void s_print(register struct re_guts *g, FILE *d);
- */
-static void
-s_print(g, d)
-register struct re_guts *g;
-FILE *d;
-{
- register sop *s;
- register cset *cs;
- register int i;
- register int done = 0;
- register sop opnd;
- register int col = 0;
- register int last;
- register sopno offset = 2;
-# define GAP() { if (offset % 5 == 0) { \
- if (col > 40) { \
- fprintf(d, "\n\t"); \
- col = 0; \
- } else { \
- fprintf(d, " "); \
- col++; \
- } \
- } else \
- col++; \
- offset++; \
- }
-
- if (OP(g->strip[0]) != OEND)
- fprintf(d, "missing initial OEND!\n");
- for (s = &g->strip[1]; !done; s++) {
- opnd = OPND(*s);
- switch (OP(*s)) {
- case OEND:
- fprintf(d, "\n");
- done = 1;
- break;
- case OCHAR:
- if (strchr("\\|()^$.[+*?{}!<> ", (char)opnd) != NULL)
- fprintf(d, "\\%c", (char)opnd);
- else
- fprintf(d, "%s", regchar((char)opnd));
- break;
- case OBOL:
- fprintf(d, "^");
- break;
- case OEOL:
- fprintf(d, "$");
- break;
- case OBOW:
- fprintf(d, "\\{");
- break;
- case OEOW:
- fprintf(d, "\\}");
- break;
- case OANY:
- fprintf(d, ".");
- break;
- case OANYOF:
- fprintf(d, "[(%ld)", (long)opnd);
- cs = &g->sets[opnd];
- last = -1;
- for (i = 0; i < g->csetsize+1; i++) /* +1 flushes */
- if (CHIN(cs, i) && i < g->csetsize) {
- if (last < 0) {
- fprintf(d, "%s", regchar(i));
- last = i;
- }
- } else {
- if (last >= 0) {
- if (last != i-1)
- fprintf(d, "-%s",
- regchar(i-1));
- last = -1;
- }
- }
- fprintf(d, "]");
- break;
- case OBACK_:
- fprintf(d, "(\\<%ld>", (long)opnd);
- break;
- case O_BACK:
- fprintf(d, "<%ld>\\)", (long)opnd);
- break;
- case OPLUS_:
- fprintf(d, "(+");
- if (OP(*(s+opnd)) != O_PLUS)
- fprintf(d, "<%ld>", (long)opnd);
- break;
- case O_PLUS:
- if (OP(*(s-opnd)) != OPLUS_)
- fprintf(d, "<%ld>", (long)opnd);
- fprintf(d, "+)");
- break;
- case OQUEST_:
- fprintf(d, "(?");
- if (OP(*(s+opnd)) != O_QUEST)
- fprintf(d, "<%ld>", (long)opnd);
- break;
- case O_QUEST:
- if (OP(*(s-opnd)) != OQUEST_)
- fprintf(d, "<%ld>", (long)opnd);
- fprintf(d, "?)");
- break;
- case OLPAREN:
- fprintf(d, "((<%ld>", (long)opnd);
- break;
- case ORPAREN:
- fprintf(d, "<%ld>))", (long)opnd);
- break;
- case OCH_:
- fprintf(d, "<");
- if (OP(*(s+opnd)) != OOR2)
- fprintf(d, "<%ld>", (long)opnd);
- break;
- case OOR1:
- if (OP(*(s-opnd)) != OOR1 && OP(*(s-opnd)) != OCH_)
- fprintf(d, "<%ld>", (long)opnd);
- fprintf(d, "|");
- break;
- case OOR2:
- fprintf(d, "|");
- if (OP(*(s+opnd)) != OOR2 && OP(*(s+opnd)) != O_CH)
- fprintf(d, "<%ld>", (long)opnd);
- break;
- case O_CH:
- if (OP(*(s-opnd)) != OOR1)
- fprintf(d, "<%ld>", (long)opnd);
- fprintf(d, ">");
- break;
- default:
- fprintf(d, "!%ld(%ld)!", OP(*s), opnd);
- break;
- }
- if (!done)
- GAP();
- }
-}
-
-/*
- - regchar - make a character printable
- == static char *regchar(int ch);
- */
-static char * /* -> representation */
-regchar(ch)
-int ch;
-{
- static char buf[10];
-
- if (isprint(ch) || ch == ' ')
- sprintf(buf, "%c", ch);
- else
- sprintf(buf, "\\%o", ch);
- return(buf);
-}
diff --git a/regex/debug.ih b/regex/debug.ih
deleted file mode 100644
index 5f40ff7917..0000000000
--- a/regex/debug.ih
+++ /dev/null
@@ -1,14 +0,0 @@
-/* ========= begin header generated by ./mkh ========= */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* === debug.c === */
-void regprint(regex_t *r, FILE *d);
-static void s_print(register struct re_guts *g, FILE *d);
-static char *regchar(int ch);
-
-#ifdef __cplusplus
-}
-#endif
-/* ========= end header generated by ./mkh ========= */
diff --git a/regex/engine.c b/regex/engine.c
deleted file mode 100644
index 0b88dcf1ed..0000000000
--- a/regex/engine.c
+++ /dev/null
@@ -1,1019 +0,0 @@
-/*
- * The matching engine and friends. This file is #included by regexec.c
- * after suitable #defines of a variety of macros used herein, so that
- * different state representations can be used without duplicating masses
- * of code.
- */
-
-#ifdef SNAMES
-#define matcher smatcher
-#define fast sfast
-#define slow sslow
-#define dissect sdissect
-#define backref sbackref
-#define step sstep
-#define print sprint
-#define at sat
-#define match smat
-#endif
-#ifdef LNAMES
-#define matcher lmatcher
-#define fast lfast
-#define slow lslow
-#define dissect ldissect
-#define backref lbackref
-#define step lstep
-#define print lprint
-#define at lat
-#define match lmat
-#endif
-
-/* another structure passed up and down to avoid zillions of parameters */
-struct match {
- struct re_guts *g;
- int eflags;
- regmatch_t *pmatch; /* [nsub+1] (0 element unused) */
- char *offp; /* offsets work from here */
- char *beginp; /* start of string -- virtual NUL precedes */
- char *endp; /* end of string -- virtual NUL here */
- char *coldp; /* can be no match starting before here */
- char **lastpos; /* [nplus+1] */
- STATEVARS;
- states st; /* current states */
- states fresh; /* states for a fresh start */
- states tmp; /* temporary */
- states empty; /* empty set of states */
-};
-
-#include "engine.ih"
-
-#ifdef REDEBUG
-#define SP(t, s, c) print(m, t, s, c, stdout)
-#define AT(t, p1, p2, s1, s2) at(m, t, p1, p2, s1, s2)
-#define NOTE(str) { if (m->eflags&REG_TRACE) printf("=%s\n", (str)); }
-#else
-#define SP(t, s, c) /* nothing */
-#define AT(t, p1, p2, s1, s2) /* nothing */
-#define NOTE(s) /* nothing */
-#endif
-
-/*
- - matcher - the actual matching engine
- == static int matcher(register struct re_guts *g, char *string, \
- == size_t nmatch, regmatch_t pmatch[], int eflags);
- */
-static int /* 0 success, REG_NOMATCH failure */
-matcher(g, string, nmatch, pmatch, eflags)
-register struct re_guts *g;
-char *string;
-size_t nmatch;
-regmatch_t pmatch[];
-int eflags;
-{
- register char *endp;
- register size_t i;
- struct match mv;
- register struct match *m = &mv;
- register char *dp;
- const register sopno gf = g->firststate+1; /* +1 for OEND */
- const register sopno gl = g->laststate;
- char *start;
- char *stop;
-
- /* simplify the situation where possible */
- if (g->cflags&REG_NOSUB)
- nmatch = 0;
- if (eflags&REG_STARTEND) {
- start = string + pmatch[0].rm_so;
- stop = string + pmatch[0].rm_eo;
- } else {
- start = string;
- stop = start + strlen(start);
- }
- if (stop < start)
- return(REG_INVARG);
-
- /* prescreening; this does wonders for this rather slow code */
- if (g->must != NULL) {
- for (dp = start; dp < stop; dp++)
- if (*dp == g->must[0] && stop - dp >= g->mlen &&
- memcmp(dp, g->must, (size_t)g->mlen) == 0)
- break;
- if (dp == stop) /* we didn't find g->must */
- return(REG_NOMATCH);
- }
-
- /* match struct setup */
- m->g = g;
- m->eflags = eflags;
- m->pmatch = NULL;
- m->lastpos = NULL;
- m->offp = string;
- m->beginp = start;
- m->endp = stop;
- STATESETUP(m, 4);
- SETUP(m->st);
- SETUP(m->fresh);
- SETUP(m->tmp);
- SETUP(m->empty);
- CLEAR(m->empty);
-
- /* this loop does only one repetition except for backrefs */
- for (;;) {
- endp = fast(m, start, stop, gf, gl);
- if (endp == NULL) { /* a miss */
- STATETEARDOWN(m);
- return(REG_NOMATCH);
- }
- if (nmatch == 0 && !g->backrefs)
- break; /* no further info needed */
-
- /* where? */
- assert(m->coldp != NULL);
- for (;;) {
- NOTE("finding start");
- endp = slow(m, m->coldp, stop, gf, gl);
- if (endp != NULL)
- break;
- assert(m->coldp < m->endp);
- m->coldp++;
- }
- if (nmatch == 1 && !g->backrefs)
- break; /* no further info needed */
-
- /* oh my, he wants the subexpressions... */
- if (m->pmatch == NULL)
- m->pmatch = (regmatch_t *)malloc((m->g->nsub + 1) *
- sizeof(regmatch_t));
- if (m->pmatch == NULL) {
- STATETEARDOWN(m);
- return(REG_ESPACE);
- }
- for (i = 1; i <= m->g->nsub; i++)
- m->pmatch[i].rm_so = m->pmatch[i].rm_eo = -1;
- if (!g->backrefs && !(m->eflags&REG_BACKR)) {
- NOTE("dissecting");
- dp = dissect(m, m->coldp, endp, gf, gl);
- } else {
- if (g->nplus > 0 && m->lastpos == NULL)
- m->lastpos = (char **)malloc((g->nplus+1) *
- sizeof(char *));
- if (g->nplus > 0 && m->lastpos == NULL) {
- free(m->pmatch);
- STATETEARDOWN(m);
- return(REG_ESPACE);
- }
- NOTE("backref dissect");
- dp = backref(m, m->coldp, endp, gf, gl, (sopno)0);
- }
- if (dp != NULL)
- break;
-
- /* uh-oh... we couldn't find a subexpression-level match */
- assert(g->backrefs); /* must be back references doing it */
- assert(g->nplus == 0 || m->lastpos != NULL);
- for (;;) {
- if (dp != NULL || endp <= m->coldp)
- break; /* defeat */
- NOTE("backoff");
- endp = slow(m, m->coldp, endp-1, gf, gl);
- if (endp == NULL)
- break; /* defeat */
- /* try it on a shorter possibility */
-#ifndef NDEBUG
- for (i = 1; i <= m->g->nsub; i++) {
- assert(m->pmatch[i].rm_so == -1);
- assert(m->pmatch[i].rm_eo == -1);
- }
-#endif
- NOTE("backoff dissect");
- dp = backref(m, m->coldp, endp, gf, gl, (sopno)0);
- }
- assert(dp == NULL || dp == endp);
- if (dp != NULL) /* found a shorter one */
- break;
-
- /* despite initial appearances, there is no match here */
- NOTE("false alarm");
- start = m->coldp + 1; /* recycle starting later */
- assert(start <= stop);
- }
-
- /* fill in the details if requested */
- if (nmatch > 0) {
- pmatch[0].rm_so = m->coldp - m->offp;
- pmatch[0].rm_eo = endp - m->offp;
- }
- if (nmatch > 1) {
- assert(m->pmatch != NULL);
- for (i = 1; i < nmatch; i++)
- if (i <= m->g->nsub)
- pmatch[i] = m->pmatch[i];
- else {
- pmatch[i].rm_so = -1;
- pmatch[i].rm_eo = -1;
- }
- }
-
- if (m->pmatch != NULL)
- free((char *)m->pmatch);
- if (m->lastpos != NULL)
- free((char *)m->lastpos);
- STATETEARDOWN(m);
- return(0);
-}
-
-/*
- - dissect - figure out what matched what, no back references
- == static char *dissect(register struct match *m, char *start, \
- == char *stop, sopno startst, sopno stopst);
- */
-static char * /* == stop (success) always */
-dissect(m, start, stop, startst, stopst)
-register struct match *m;
-char *start;
-char *stop;
-sopno startst;
-sopno stopst;
-{
- register int i;
- register sopno ss; /* start sop of current subRE */
- register sopno es; /* end sop of current subRE */
- register char *sp; /* start of string matched by it */
- register char *stp; /* string matched by it cannot pass here */
- register char *rest; /* start of rest of string */
- register char *tail; /* string unmatched by rest of RE */
- register sopno ssub; /* start sop of subsubRE */
- register sopno esub; /* end sop of subsubRE */
- register char *ssp; /* start of string matched by subsubRE */
- register char *sep; /* end of string matched by subsubRE */
- register char *oldssp; /* previous ssp */
- register char *dp;
-
- AT("diss", start, stop, startst, stopst);
- sp = start;
- for (ss = startst; ss < stopst; ss = es) {
- /* identify end of subRE */
- es = ss;
- switch (OP(m->g->strip[es])) {
- case OPLUS_:
- case OQUEST_:
- es += OPND(m->g->strip[es]);
- break;
- case OCH_:
- while (OP(m->g->strip[es]) != O_CH)
- es += OPND(m->g->strip[es]);
- break;
- }
- es++;
-
- /* figure out what it matched */
- switch (OP(m->g->strip[ss])) {
- case OEND:
- assert(nope);
- break;
- case OCHAR:
- sp++;
- break;
- case OBOL:
- case OEOL:
- case OBOW:
- case OEOW:
- break;
- case OANY:
- case OANYOF:
- sp++;
- break;
- case OBACK_:
- case O_BACK:
- assert(nope);
- break;
- /* cases where length of match is hard to find */
- case OQUEST_:
- stp = stop;
- for (;;) {
- /* how long could this one be? */
- rest = slow(m, sp, stp, ss, es);
- assert(rest != NULL); /* it did match */
- /* could the rest match the rest? */
- tail = slow(m, rest, stop, es, stopst);
- if (tail == stop)
- break; /* yes! */
- /* no -- try a shorter match for this one */
- stp = rest - 1;
- assert(stp >= sp); /* it did work */
- }
- ssub = ss + 1;
- esub = es - 1;
- /* did innards match? */
- if (slow(m, sp, rest, ssub, esub) != NULL) {
- dp = dissect(m, sp, rest, ssub, esub);
- assert(dp == rest);
- } else /* no */
- assert(sp == rest);
- sp = rest;
- break;
- case OPLUS_:
- stp = stop;
- for (;;) {
- /* how long could this one be? */
- rest = slow(m, sp, stp, ss, es);
- assert(rest != NULL); /* it did match */
- /* could the rest match the rest? */
- tail = slow(m, rest, stop, es, stopst);
- if (tail == stop)
- break; /* yes! */
- /* no -- try a shorter match for this one */
- stp = rest - 1;
- assert(stp >= sp); /* it did work */
- }
- ssub = ss + 1;
- esub = es - 1;
- ssp = sp;
- oldssp = ssp;
- for (;;) { /* find last match of innards */
- sep = slow(m, ssp, rest, ssub, esub);
- if (sep == NULL || sep == ssp)
- break; /* failed or matched null */
- oldssp = ssp; /* on to next try */
- ssp = sep;
- }
- if (sep == NULL) {
- /* last successful match */
- sep = ssp;
- ssp = oldssp;
- }
- assert(sep == rest); /* must exhaust substring */
- assert(slow(m, ssp, sep, ssub, esub) == rest);
- dp = dissect(m, ssp, sep, ssub, esub);
- assert(dp == sep);
- sp = rest;
- break;
- case OCH_:
- stp = stop;
- for (;;) {
- /* how long could this one be? */
- rest = slow(m, sp, stp, ss, es);
- assert(rest != NULL); /* it did match */
- /* could the rest match the rest? */
- tail = slow(m, rest, stop, es, stopst);
- if (tail == stop)
- break; /* yes! */
- /* no -- try a shorter match for this one */
- stp = rest - 1;
- assert(stp >= sp); /* it did work */
- }
- ssub = ss + 1;
- esub = ss + OPND(m->g->strip[ss]) - 1;
- assert(OP(m->g->strip[esub]) == OOR1);
- for (;;) { /* find first matching branch */
- if (slow(m, sp, rest, ssub, esub) == rest)
- break; /* it matched all of it */
- /* that one missed, try next one */
- assert(OP(m->g->strip[esub]) == OOR1);
- esub++;
- assert(OP(m->g->strip[esub]) == OOR2);
- ssub = esub + 1;
- esub += OPND(m->g->strip[esub]);
- if (OP(m->g->strip[esub]) == OOR2)
- esub--;
- else
- assert(OP(m->g->strip[esub]) == O_CH);
- }
- dp = dissect(m, sp, rest, ssub, esub);
- assert(dp == rest);
- sp = rest;
- break;
- case O_PLUS:
- case O_QUEST:
- case OOR1:
- case OOR2:
- case O_CH:
- assert(nope);
- break;
- case OLPAREN:
- i = OPND(m->g->strip[ss]);
- assert(0 < i && i <= m->g->nsub);
- m->pmatch[i].rm_so = sp - m->offp;
- break;
- case ORPAREN:
- i = OPND(m->g->strip[ss]);
- assert(0 < i && i <= m->g->nsub);
- m->pmatch[i].rm_eo = sp - m->offp;
- break;
- default: /* uh oh */
- assert(nope);
- break;
- }
- }
-
- assert(sp == stop);
- return(sp);
-}
-
-/*
- - backref - figure out what matched what, figuring in back references
- == static char *backref(register struct match *m, char *start, \
- == char *stop, sopno startst, sopno stopst, sopno lev);
- */
-static char * /* == stop (success) or NULL (failure) */
-backref(m, start, stop, startst, stopst, lev)
-register struct match *m;
-char *start;
-char *stop;
-sopno startst;
-sopno stopst;
-sopno lev; /* PLUS nesting level */
-{
- register int i;
- register sopno ss; /* start sop of current subRE */
- register char *sp; /* start of string matched by it */
- register sopno ssub; /* start sop of subsubRE */
- register sopno esub; /* end sop of subsubRE */
- register char *ssp; /* start of string matched by subsubRE */
- register char *dp;
- register size_t len;
- register int hard;
- register sop s;
- register regoff_t offsave;
- register cset *cs;
-
- AT("back", start, stop, startst, stopst);
- sp = start;
-
- /* get as far as we can with easy stuff */
- hard = 0;
- for (ss = startst; !hard && ss < stopst; ss++)
- switch (OP(s = m->g->strip[ss])) {
- case OCHAR:
- if (sp == stop || *sp++ != (char)OPND(s))
- return(NULL);
- break;
- case OANY:
- if (sp == stop)
- return(NULL);
- sp++;
- break;
- case OANYOF:
- cs = &m->g->sets[OPND(s)];
- if (sp == stop || !CHIN(cs, *sp++))
- return(NULL);
- break;
- case OBOL:
- if ( (sp == m->beginp && !(m->eflags&REG_NOTBOL)) ||
- (sp < m->endp && *(sp-1) == '\n' &&
- (m->g->cflags&REG_NEWLINE)) )
- { /* yes */ }
- else
- return(NULL);
- break;
- case OEOL:
- if ( (sp == m->endp && !(m->eflags&REG_NOTEOL)) ||
- (sp < m->endp && *sp == '\n' &&
- (m->g->cflags&REG_NEWLINE)) )
- { /* yes */ }
- else
- return(NULL);
- break;
- case OBOW:
- if (( (sp == m->beginp && !(m->eflags&REG_NOTBOL)) ||
- (sp < m->endp && *(sp-1) == '\n' &&
- (m->g->cflags&REG_NEWLINE)) ||
- (sp > m->beginp &&
- !ISWORD(*(sp-1))) ) &&
- (sp < m->endp && ISWORD(*sp)) )
- { /* yes */ }
- else
- return(NULL);
- break;
- case OEOW:
- if (( (sp == m->endp && !(m->eflags&REG_NOTEOL)) ||
- (sp < m->endp && *sp == '\n' &&
- (m->g->cflags&REG_NEWLINE)) ||
- (sp < m->endp && !ISWORD(*sp)) ) &&
- (sp > m->beginp && ISWORD(*(sp-1))) )
- { /* yes */ }
- else
- return(NULL);
- break;
- case O_QUEST:
- break;
- case OOR1: /* matches null but needs to skip */
- ss++;
- s = m->g->strip[ss];
- do {
- assert(OP(s) == OOR2);
- ss += OPND(s);
- } while (OP(s = m->g->strip[ss]) != O_CH);
- /* note that the ss++ gets us past the O_CH */
- break;
- default: /* have to make a choice */
- hard = 1;
- break;
- }
- if (!hard) { /* that was it! */
- if (sp != stop)
- return(NULL);
- return(sp);
- }
- ss--; /* adjust for the for's final increment */
-
- /* the hard stuff */
- AT("hard", sp, stop, ss, stopst);
- s = m->g->strip[ss];
- switch (OP(s)) {
- case OBACK_: /* the vilest depths */
- i = OPND(s);
- assert(0 < i && i <= m->g->nsub);
- if (m->pmatch[i].rm_eo == -1)
- return(NULL);
- assert(m->pmatch[i].rm_so != -1);
- len = m->pmatch[i].rm_eo - m->pmatch[i].rm_so;
- assert(stop - m->beginp >= len);
- if (sp > stop - len)
- return(NULL); /* not enough left to match */
- ssp = m->offp + m->pmatch[i].rm_so;
- if (memcmp(sp, ssp, len) != 0)
- return(NULL);
- while (m->g->strip[ss] != SOP(O_BACK, i))
- ss++;
- return(backref(m, sp+len, stop, ss+1, stopst, lev));
- break;
- case OQUEST_: /* to null or not */
- dp = backref(m, sp, stop, ss+1, stopst, lev);
- if (dp != NULL)
- return(dp); /* not */
- return(backref(m, sp, stop, ss+OPND(s)+1, stopst, lev));
- break;
- case OPLUS_:
- assert(m->lastpos != NULL);
- assert(lev+1 <= m->g->nplus);
- m->lastpos[lev+1] = sp;
- return(backref(m, sp, stop, ss+1, stopst, lev+1));
- break;
- case O_PLUS:
- if (sp == m->lastpos[lev]) /* last pass matched null */
- return(backref(m, sp, stop, ss+1, stopst, lev-1));
- /* try another pass */
- m->lastpos[lev] = sp;
- dp = backref(m, sp, stop, ss-OPND(s)+1, stopst, lev);
- if (dp == NULL)
- return(backref(m, sp, stop, ss+1, stopst, lev-1));
- else
- return(dp);
- break;
- case OCH_: /* find the right one, if any */
- ssub = ss + 1;
- esub = ss + OPND(s) - 1;
- assert(OP(m->g->strip[esub]) == OOR1);
- for (;;) { /* find first matching branch */
- dp = backref(m, sp, stop, ssub, esub, lev);
- if (dp != NULL)
- return(dp);
- /* that one missed, try next one */
- if (OP(m->g->strip[esub]) == O_CH)
- return(NULL); /* there is none */
- esub++;
- assert(OP(m->g->strip[esub]) == OOR2);
- ssub = esub + 1;
- esub += OPND(m->g->strip[esub]);
- if (OP(m->g->strip[esub]) == OOR2)
- esub--;
- else
- assert(OP(m->g->strip[esub]) == O_CH);
- }
- break;
- case OLPAREN: /* must undo assignment if rest fails */
- i = OPND(s);
- assert(0 < i && i <= m->g->nsub);
- offsave = m->pmatch[i].rm_so;
- m->pmatch[i].rm_so = sp - m->offp;
- dp = backref(m, sp, stop, ss+1, stopst, lev);
- if (dp != NULL)
- return(dp);
- m->pmatch[i].rm_so = offsave;
- return(NULL);
- break;
- case ORPAREN: /* must undo assignment if rest fails */
- i = OPND(s);
- assert(0 < i && i <= m->g->nsub);
- offsave = m->pmatch[i].rm_eo;
- m->pmatch[i].rm_eo = sp - m->offp;
- dp = backref(m, sp, stop, ss+1, stopst, lev);
- if (dp != NULL)
- return(dp);
- m->pmatch[i].rm_eo = offsave;
- return(NULL);
- break;
- default: /* uh oh */
- assert(nope);
- break;
- }
-
- /* "can't happen" */
- assert(nope);
- /* NOTREACHED */
- return((char *)NULL); /* dummy */
-}
-
-/*
- - fast - step through the string at top speed
- == static char *fast(register struct match *m, char *start, \
- == char *stop, sopno startst, sopno stopst);
- */
-static char * /* where tentative match ended, or NULL */
-fast(m, start, stop, startst, stopst)
-register struct match *m;
-char *start;
-char *stop;
-sopno startst;
-sopno stopst;
-{
- register states st = m->st;
- register states fresh = m->fresh;
- register states tmp = m->tmp;
- register char *p = start;
- register int c = (start == m->beginp) ? OUT : *(start-1);
- register int lastc; /* previous c */
- register int flagch;
- register int i;
- register char *coldp; /* last p after which no match was underway */
-
- CLEAR(st);
- SET1(st, startst);
- st = step(m->g, startst, stopst, st, NOTHING, st);
- ASSIGN(fresh, st);
- SP("start", st, *p);
- coldp = NULL;
- for (;;) {
- /* next character */
- lastc = c;
- c = (p == m->endp) ? OUT : *p;
- if (EQ(st, fresh))
- coldp = p;
-
- /* is there an EOL and/or BOL between lastc and c? */
- flagch = '\0';
- i = 0;
- if ( (lastc == '\n' && m->g->cflags&REG_NEWLINE) ||
- (lastc == OUT && !(m->eflags&REG_NOTBOL)) ) {
- flagch = BOL;
- i = m->g->nbol;
- }
- if ( (c == '\n' && m->g->cflags&REG_NEWLINE) ||
- (c == OUT && !(m->eflags&REG_NOTEOL)) ) {
- flagch = (flagch == BOL) ? BOLEOL : EOL;
- i += m->g->neol;
- }
- if (i != 0) {
- for (; i > 0; i--)
- st = step(m->g, startst, stopst, st, flagch, st);
- SP("boleol", st, c);
- }
-
- /* how about a word boundary? */
- if ( (flagch == BOL || (lastc != OUT && !ISWORD(lastc))) &&
- (c != OUT && ISWORD(c)) ) {
- flagch = BOW;
- }
- if ( (lastc != OUT && ISWORD(lastc)) &&
- (flagch == EOL || (c != OUT && !ISWORD(c))) ) {
- flagch = EOW;
- }
- if (flagch == BOW || flagch == EOW) {
- st = step(m->g, startst, stopst, st, flagch, st);
- SP("boweow", st, c);
- }
-
- /* are we done? */
- if (ISSET(st, stopst) || p == stop)
- break; /* NOTE BREAK OUT */
-
- /* no, we must deal with this character */
- ASSIGN(tmp, st);
- ASSIGN(st, fresh);
- assert(c != OUT);
- st = step(m->g, startst, stopst, tmp, c, st);
- SP("aft", st, c);
- assert(EQ(step(m->g, startst, stopst, st, NOTHING, st), st));
- p++;
- }
-
- assert(coldp != NULL);
- m->coldp = coldp;
- if (ISSET(st, stopst))
- return(p+1);
- else
- return(NULL);
-}
-
-/*
- - slow - step through the string more deliberately
- == static char *slow(register struct match *m, char *start, \
- == char *stop, sopno startst, sopno stopst);
- */
-static char * /* where it ended */
-slow(m, start, stop, startst, stopst)
-register struct match *m;
-char *start;
-char *stop;
-sopno startst;
-sopno stopst;
-{
- register states st = m->st;
- register states empty = m->empty;
- register states tmp = m->tmp;
- register char *p = start;
- register int c = (start == m->beginp) ? OUT : *(start-1);
- register int lastc; /* previous c */
- register int flagch;
- register int i;
- register char *matchp; /* last p at which a match ended */
-
- AT("slow", start, stop, startst, stopst);
- CLEAR(st);
- SET1(st, startst);
- SP("sstart", st, *p);
- st = step(m->g, startst, stopst, st, NOTHING, st);
- matchp = NULL;
- for (;;) {
- /* next character */
- lastc = c;
- c = (p == m->endp) ? OUT : *p;
-
- /* is there an EOL and/or BOL between lastc and c? */
- flagch = '\0';
- i = 0;
- if ( (lastc == '\n' && m->g->cflags&REG_NEWLINE) ||
- (lastc == OUT && !(m->eflags&REG_NOTBOL)) ) {
- flagch = BOL;
- i = m->g->nbol;
- }
- if ( (c == '\n' && m->g->cflags&REG_NEWLINE) ||
- (c == OUT && !(m->eflags&REG_NOTEOL)) ) {
- flagch = (flagch == BOL) ? BOLEOL : EOL;
- i += m->g->neol;
- }
- if (i != 0) {
- for (; i > 0; i--)
- st = step(m->g, startst, stopst, st, flagch, st);
- SP("sboleol", st, c);
- }
-
- /* how about a word boundary? */
- if ( (flagch == BOL || (lastc != OUT && !ISWORD(lastc))) &&
- (c != OUT && ISWORD(c)) ) {
- flagch = BOW;
- }
- if ( (lastc != OUT && ISWORD(lastc)) &&
- (flagch == EOL || (c != OUT && !ISWORD(c))) ) {
- flagch = EOW;
- }
- if (flagch == BOW || flagch == EOW) {
- st = step(m->g, startst, stopst, st, flagch, st);
- SP("sboweow", st, c);
- }
-
- /* are we done? */
- if (ISSET(st, stopst))
- matchp = p;
- if (EQ(st, empty) || p == stop)
- break; /* NOTE BREAK OUT */
-
- /* no, we must deal with this character */
- ASSIGN(tmp, st);
- ASSIGN(st, empty);
- assert(c != OUT);
- st = step(m->g, startst, stopst, tmp, c, st);
- SP("saft", st, c);
- assert(EQ(step(m->g, startst, stopst, st, NOTHING, st), st));
- p++;
- }
-
- return(matchp);
-}
-
-
-/*
- - step - map set of states reachable before char to set reachable after
- == static states step(register struct re_guts *g, sopno start, sopno stop, \
- == register states bef, int ch, register states aft);
- == #define BOL (OUT+1)
- == #define EOL (BOL+1)
- == #define BOLEOL (BOL+2)
- == #define NOTHING (BOL+3)
- == #define BOW (BOL+4)
- == #define EOW (BOL+5)
- == #define CODEMAX (BOL+5) // highest code used
- == #define NONCHAR(c) ((c) > CHAR_MAX)
- == #define NNONCHAR (CODEMAX-CHAR_MAX)
- */
-static states
-step(g, start, stop, bef, ch, aft)
-register struct re_guts *g;
-sopno start; /* start state within strip */
-sopno stop; /* state after stop state within strip */
-register states bef; /* states reachable before */
-int ch; /* character or NONCHAR code */
-register states aft; /* states already known reachable after */
-{
- register cset *cs;
- register sop s;
- register sopno pc;
- register onestate here; /* note, macros know this name */
- register sopno look;
- register long i;
-
- for (pc = start, INIT(here, pc); pc != stop; pc++, INC(here)) {
- s = g->strip[pc];
- switch (OP(s)) {
- case OEND:
- assert(pc == stop-1);
- break;
- case OCHAR:
- /* only characters can match */
- assert(!NONCHAR(ch) || ch != (char)OPND(s));
- if (ch == (char)OPND(s))
- FWD(aft, bef, 1);
- break;
- case OBOL:
- if (ch == BOL || ch == BOLEOL)
- FWD(aft, bef, 1);
- break;
- case OEOL:
- if (ch == EOL || ch == BOLEOL)
- FWD(aft, bef, 1);
- break;
- case OBOW:
- if (ch == BOW)
- FWD(aft, bef, 1);
- break;
- case OEOW:
- if (ch == EOW)
- FWD(aft, bef, 1);
- break;
- case OANY:
- if (!NONCHAR(ch))
- FWD(aft, bef, 1);
- break;
- case OANYOF:
- cs = &g->sets[OPND(s)];
- if (!NONCHAR(ch) && CHIN(cs, ch))
- FWD(aft, bef, 1);
- break;
- case OBACK_: /* ignored here */
- case O_BACK:
- FWD(aft, aft, 1);
- break;
- case OPLUS_: /* forward, this is just an empty */
- FWD(aft, aft, 1);
- break;
- case O_PLUS: /* both forward and back */
- FWD(aft, aft, 1);
- i = ISSETBACK(aft, OPND(s));
- BACK(aft, aft, OPND(s));
- if (!i && ISSETBACK(aft, OPND(s))) {
- /* oho, must reconsider loop body */
- pc -= OPND(s) + 1;
- INIT(here, pc);
- }
- break;
- case OQUEST_: /* two branches, both forward */
- FWD(aft, aft, 1);
- FWD(aft, aft, OPND(s));
- break;
- case O_QUEST: /* just an empty */
- FWD(aft, aft, 1);
- break;
- case OLPAREN: /* not significant here */
- case ORPAREN:
- FWD(aft, aft, 1);
- break;
- case OCH_: /* mark the first two branches */
- FWD(aft, aft, 1);
- assert(OP(g->strip[pc+OPND(s)]) == OOR2);
- FWD(aft, aft, OPND(s));
- break;
- case OOR1: /* done a branch, find the O_CH */
- if (ISSTATEIN(aft, here)) {
- for (look = 1;
- OP(s = g->strip[pc+look]) != O_CH;
- look += OPND(s))
- assert(OP(s) == OOR2);
- FWD(aft, aft, look);
- }
- break;
- case OOR2: /* propagate OCH_'s marking */
- FWD(aft, aft, 1);
- if (OP(g->strip[pc+OPND(s)]) != O_CH) {
- assert(OP(g->strip[pc+OPND(s)]) == OOR2);
- FWD(aft, aft, OPND(s));
- }
- break;
- case O_CH: /* just empty */
- FWD(aft, aft, 1);
- break;
- default: /* ooooops... */
- assert(nope);
- break;
- }
- }
-
- return(aft);
-}
-
-#ifdef REDEBUG
-/*
- - print - print a set of states
- == #ifdef REDEBUG
- == static void print(struct match *m, char *caption, states st, \
- == int ch, FILE *d);
- == #endif
- */
-static void
-print(m, caption, st, ch, d)
-struct match *m;
-char *caption;
-states st;
-int ch;
-FILE *d;
-{
- register struct re_guts *g = m->g;
- register int i;
- register int first = 1;
-
- if (!(m->eflags&REG_TRACE))
- return;
-
- fprintf(d, "%s", caption);
- if (ch != '\0')
- fprintf(d, " %s", pchar(ch));
- for (i = 0; i < g->nstates; i++)
- if (ISSET(st, i)) {
- fprintf(d, "%s%d", (first) ? "\t" : ", ", i);
- first = 0;
- }
- fprintf(d, "\n");
-}
-
-/*
- - at - print current situation
- == #ifdef REDEBUG
- == static void at(struct match *m, char *title, char *start, char *stop, \
- == sopno startst, sopno stopst);
- == #endif
- */
-static void
-at(m, title, start, stop, startst, stopst)
-struct match *m;
-char *title;
-char *start;
-char *stop;
-sopno startst;
-sopno stopst;
-{
- if (!(m->eflags&REG_TRACE))
- return;
-
- printf("%s %s-", title, pchar(*start));
- printf("%s ", pchar(*stop));
- printf("%ld-%ld\n", (long)startst, (long)stopst);
-}
-
-#ifndef PCHARDONE
-#define PCHARDONE /* never again */
-/*
- - pchar - make a character printable
- == #ifdef REDEBUG
- == static char *pchar(int ch);
- == #endif
- *
- * Is this identical to regchar() over in debug.c? Well, yes. But a
- * duplicate here avoids having a debugging-capable regexec.o tied to
- * a matching debug.o, and this is convenient. It all disappears in
- * the non-debug compilation anyway, so it doesn't matter much.
- */
-static char * /* -> representation */
-pchar(ch)
-int ch;
-{
- static char pbuf[10];
-
- if (isprint(ch) || ch == ' ')
- sprintf(pbuf, "%c", ch);
- else
- sprintf(pbuf, "\\%o", ch);
- return(pbuf);
-}
-#endif
-#endif
-
-#undef matcher
-#undef fast
-#undef slow
-#undef dissect
-#undef backref
-#undef step
-#undef print
-#undef at
-#undef match
diff --git a/regex/engine.ih b/regex/engine.ih
deleted file mode 100644
index cc98334e75..0000000000
--- a/regex/engine.ih
+++ /dev/null
@@ -1,35 +0,0 @@
-/* ========= begin header generated by ./mkh ========= */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* === engine.c === */
-static int matcher(register struct re_guts *g, char *string, size_t nmatch, regmatch_t pmatch[], int eflags);
-static char *dissect(register struct match *m, char *start, char *stop, sopno startst, sopno stopst);
-static char *backref(register struct match *m, char *start, char *stop, sopno startst, sopno stopst, sopno lev);
-static char *fast(register struct match *m, char *start, char *stop, sopno startst, sopno stopst);
-static char *slow(register struct match *m, char *start, char *stop, sopno startst, sopno stopst);
-static states step(register struct re_guts *g, sopno start, sopno stop, register states bef, int ch, register states aft);
-#define BOL (OUT+1)
-#define EOL (BOL+1)
-#define BOLEOL (BOL+2)
-#define NOTHING (BOL+3)
-#define BOW (BOL+4)
-#define EOW (BOL+5)
-#define CODEMAX (BOL+5) /* highest code used */
-#define NONCHAR(c) ((c) > CHAR_MAX)
-#define NNONCHAR (CODEMAX-CHAR_MAX)
-#ifdef REDEBUG
-static void print(struct match *m, char *caption, states st, int ch, FILE *d);
-#endif
-#ifdef REDEBUG
-static void at(struct match *m, char *title, char *start, char *stop, sopno startst, sopno stopst);
-#endif
-#ifdef REDEBUG
-static char *pchar(int ch);
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-/* ========= end header generated by ./mkh ========= */
diff --git a/regex/main.c b/regex/main.c
deleted file mode 100644
index 657338a2c1..0000000000
--- a/regex/main.c
+++ /dev/null
@@ -1,510 +0,0 @@
-#include <stdio.h>
-#include <string.h>
-#include <sys/types.h>
-#include <regex.h>
-#include <assert.h>
-#include <stdlib.h>
-
-#include "main.ih"
-
-char *progname;
-int debug = 0;
-int line = 0;
-int status = 0;
-
-int copts = REG_EXTENDED;
-int eopts = 0;
-regoff_t startoff = 0;
-regoff_t endoff = 0;
-
-
-extern int split();
-extern void regprint();
-
-/*
- - main - do the simple case, hand off to regress() for regression
- */
-int main(argc, argv)
-int argc;
-char *argv[];
-{
- regex_t re;
-# define NS 10
- regmatch_t subs[NS];
- char erbuf[100];
- int err;
- size_t len;
- int c;
- int errflg = 0;
- register int i;
- extern int optind;
- extern char *optarg;
-
- progname = argv[0];
-
- while ((c = getopt(argc, argv, "c:e:S:E:x")) != EOF)
- switch (c) {
- case 'c': /* compile options */
- copts = options('c', optarg);
- break;
- case 'e': /* execute options */
- eopts = options('e', optarg);
- break;
- case 'S': /* start offset */
- startoff = (regoff_t)atoi(optarg);
- break;
- case 'E': /* end offset */
- endoff = (regoff_t)atoi(optarg);
- break;
- case 'x': /* Debugging. */
- debug++;
- break;
- case '?':
- default:
- errflg++;
- break;
- }
- if (errflg) {
- fprintf(stderr, "usage: %s ", progname);
- fprintf(stderr, "[-c copt][-C][-d] [re]\n");
- exit(2);
- }
-
- if (optind >= argc) {
- regress(stdin);
- exit(status);
- }
-
- err = regcomp(&re, argv[optind++], copts);
- if (err) {
- len = regerror(err, &re, erbuf, sizeof(erbuf));
- fprintf(stderr, "error %s, %d/%d `%s'\n",
- eprint(err), len, sizeof(erbuf), erbuf);
- exit(status);
- }
- regprint(&re, stdout);
-
- if (optind >= argc) {
- regfree(&re);
- exit(status);
- }
-
- if (eopts&REG_STARTEND) {
- subs[0].rm_so = startoff;
- subs[0].rm_eo = strlen(argv[optind]) - endoff;
- }
- err = regexec(&re, argv[optind], (size_t)NS, subs, eopts);
- if (err) {
- len = regerror(err, &re, erbuf, sizeof(erbuf));
- fprintf(stderr, "error %s, %d/%d `%s'\n",
- eprint(err), len, sizeof(erbuf), erbuf);
- exit(status);
- }
- if (!(copts&REG_NOSUB)) {
- len = (int)(subs[0].rm_eo - subs[0].rm_so);
- if (subs[0].rm_so != -1) {
- if (len != 0)
- printf("match `%.*s'\n", (int)len,
- argv[optind] + subs[0].rm_so);
- else
- printf("match `'@%.1s\n",
- argv[optind] + subs[0].rm_so);
- }
- for (i = 1; i < NS; i++)
- if (subs[i].rm_so != -1)
- printf("(%d) `%.*s'\n", i,
- (int)(subs[i].rm_eo - subs[i].rm_so),
- argv[optind] + subs[i].rm_so);
- }
- exit(status);
-}
-
-/*
- - regress - main loop of regression test
- == void regress(FILE *in);
- */
-void
-regress(in)
-FILE *in;
-{
- char inbuf[1000];
-# define MAXF 10
- char *f[MAXF];
- int nf;
- int i;
- char erbuf[100];
- size_t ne;
- char *badpat = "invalid regular expression";
-# define SHORT 10
- char *bpname = "REG_BADPAT";
- regex_t re;
-
- while (fgets(inbuf, sizeof(inbuf), in) != NULL) {
- line++;
- if (inbuf[0] == '#' || inbuf[0] == '\n')
- continue; /* NOTE CONTINUE */
- inbuf[strlen(inbuf)-1] = '\0'; /* get rid of stupid \n */
- if (debug)
- fprintf(stdout, "%d:\n", line);
- nf = split(inbuf, f, MAXF, "\t\t");
- if (nf < 3) {
- fprintf(stderr, "bad input, line %d\n", line);
- exit(1);
- }
- for (i = 0; i < nf; i++)
- if (strcmp(f[i], "\"\"") == 0)
- f[i] = "";
- if (nf <= 3)
- f[3] = NULL;
- if (nf <= 4)
- f[4] = NULL;
- try(f[0], f[1], f[2], f[3], f[4], options('c', f[1]));
- if (opt('&', f[1])) /* try with either type of RE */
- try(f[0], f[1], f[2], f[3], f[4],
- options('c', f[1]) &~ REG_EXTENDED);
- }
-
- ne = regerror(REG_BADPAT, (regex_t *)NULL, erbuf, sizeof(erbuf));
- if (strcmp(erbuf, badpat) != 0 || ne != strlen(badpat)+1) {
- fprintf(stderr, "end: regerror() test gave `%s' not `%s'\n",
- erbuf, badpat);
- status = 1;
- }
- ne = regerror(REG_BADPAT, (regex_t *)NULL, erbuf, (size_t)SHORT);
- if (strncmp(erbuf, badpat, SHORT-1) != 0 || erbuf[SHORT-1] != '\0' ||
- ne != strlen(badpat)+1) {
- fprintf(stderr, "end: regerror() short test gave `%s' not `%.*s'\n",
- erbuf, SHORT-1, badpat);
- status = 1;
- }
- ne = regerror(REG_ITOA|REG_BADPAT, (regex_t *)NULL, erbuf, sizeof(erbuf));
- if (strcmp(erbuf, bpname) != 0 || ne != strlen(bpname)+1) {
- fprintf(stderr, "end: regerror() ITOA test gave `%s' not `%s'\n",
- erbuf, bpname);
- status = 1;
- }
- re.re_endp = bpname;
- ne = regerror(REG_ATOI, &re, erbuf, sizeof(erbuf));
- if (atoi(erbuf) != (int)REG_BADPAT) {
- fprintf(stderr, "end: regerror() ATOI test gave `%s' not `%ld'\n",
- erbuf, (long)REG_BADPAT);
- status = 1;
- } else if (ne != strlen(erbuf)+1) {
- fprintf(stderr, "end: regerror() ATOI test len(`%s') = %ld\n",
- erbuf, (long)REG_BADPAT);
- status = 1;
- }
-}
-
-/*
- - try - try it, and report on problems
- == void try(char *f0, char *f1, char *f2, char *f3, char *f4, int opts);
- */
-void
-try(f0, f1, f2, f3, f4, opts)
-char *f0;
-char *f1;
-char *f2;
-char *f3;
-char *f4;
-int opts; /* may not match f1 */
-{
- regex_t re;
-# define NSUBS 10
- regmatch_t subs[NSUBS];
-# define NSHOULD 15
- char *should[NSHOULD];
- int nshould;
- char erbuf[100];
- int err;
- int len;
- char *type = (opts & REG_EXTENDED) ? "ERE" : "BRE";
- register int i;
- char *grump;
- char f0copy[1000];
- char f2copy[1000];
-
- strcpy(f0copy, f0);
- re.re_endp = (opts&REG_PEND) ? f0copy + strlen(f0copy) : NULL;
- fixstr(f0copy);
- err = regcomp(&re, f0copy, opts);
- if (err != 0 && (!opt('C', f1) || err != efind(f2))) {
- /* unexpected error or wrong error */
- len = regerror(err, &re, erbuf, sizeof(erbuf));
- fprintf(stderr, "%d: %s error %s, %d/%d `%s'\n",
- line, type, eprint(err), len,
- sizeof(erbuf), erbuf);
- status = 1;
- } else if (err == 0 && opt('C', f1)) {
- /* unexpected success */
- fprintf(stderr, "%d: %s should have given REG_%s\n",
- line, type, f2);
- status = 1;
- err = 1; /* so we won't try regexec */
- }
-
- if (err != 0) {
- regfree(&re);
- return;
- }
-
- strcpy(f2copy, f2);
- fixstr(f2copy);
-
- if (options('e', f1)&REG_STARTEND) {
- if (strchr(f2, '(') == NULL || strchr(f2, ')') == NULL)
- fprintf(stderr, "%d: bad STARTEND syntax\n", line);
- subs[0].rm_so = strchr(f2, '(') - f2 + 1;
- subs[0].rm_eo = strchr(f2, ')') - f2;
- }
- err = regexec(&re, f2copy, NSUBS, subs, options('e', f1));
-
- if (err != 0 && (f3 != NULL || err != REG_NOMATCH)) {
- /* unexpected error or wrong error */
- len = regerror(err, &re, erbuf, sizeof(erbuf));
- fprintf(stderr, "%d: %s exec error %s, %d/%d `%s'\n",
- line, type, eprint(err), len,
- sizeof(erbuf), erbuf);
- status = 1;
- } else if (err != 0) {
- /* nothing more to check */
- } else if (f3 == NULL) {
- /* unexpected success */
- fprintf(stderr, "%d: %s exec should have failed\n",
- line, type);
- status = 1;
- err = 1; /* just on principle */
- } else if (opts&REG_NOSUB) {
- /* nothing more to check */
- } else if ((grump = check(f2, subs[0], f3)) != NULL) {
- fprintf(stderr, "%d: %s %s\n", line, type, grump);
- status = 1;
- err = 1;
- }
-
- if (err != 0 || f4 == NULL) {
- regfree(&re);
- return;
- }
-
- for (i = 1; i < NSHOULD; i++)
- should[i] = NULL;
- nshould = split(f4, should+1, NSHOULD-1, ",");
- if (nshould == 0) {
- nshould = 1;
- should[1] = "";
- }
- for (i = 1; i < NSUBS; i++) {
- grump = check(f2, subs[i], should[i]);
- if (grump != NULL) {
- fprintf(stderr, "%d: %s $%d %s\n", line,
- type, i, grump);
- status = 1;
- err = 1;
- }
- }
-
- regfree(&re);
-}
-
-/*
- - options - pick options out of a regression-test string
- == int options(int type, char *s);
- */
-int
-options(type, s)
-int type; /* 'c' compile, 'e' exec */
-char *s;
-{
- register char *p;
- register int o = (type == 'c') ? copts : eopts;
- register char *legal = (type == 'c') ? "bisnmp" : "^$#tl";
-
- for (p = s; *p != '\0'; p++)
- if (strchr(legal, *p) != NULL)
- switch (*p) {
- case 'b':
- o &= ~REG_EXTENDED;
- break;
- case 'i':
- o |= REG_ICASE;
- break;
- case 's':
- o |= REG_NOSUB;
- break;
- case 'n':
- o |= REG_NEWLINE;
- break;
- case 'm':
- o &= ~REG_EXTENDED;
- o |= REG_NOSPEC;
- break;
- case 'p':
- o |= REG_PEND;
- break;
- case '^':
- o |= REG_NOTBOL;
- break;
- case '$':
- o |= REG_NOTEOL;
- break;
- case '#':
- o |= REG_STARTEND;
- break;
- case 't': /* trace */
- o |= REG_TRACE;
- break;
- case 'l': /* force long representation */
- o |= REG_LARGE;
- break;
- case 'r': /* force backref use */
- o |= REG_BACKR;
- break;
- }
- return(o);
-}
-
-/*
- - opt - is a particular option in a regression string?
- == int opt(int c, char *s);
- */
-int /* predicate */
-opt(c, s)
-int c;
-char *s;
-{
- return(strchr(s, c) != NULL);
-}
-
-/*
- - fixstr - transform magic characters in strings
- == void fixstr(register char *p);
- */
-void
-fixstr(p)
-register char *p;
-{
- if (p == NULL)
- return;
-
- for (; *p != '\0'; p++)
- if (*p == 'N')
- *p = '\n';
- else if (*p == 'T')
- *p = '\t';
- else if (*p == 'S')
- *p = ' ';
- else if (*p == 'Z')
- *p = '\0';
-}
-
-/*
- - check - check a substring match
- == char *check(char *str, regmatch_t sub, char *should);
- */
-char * /* NULL or complaint */
-check(str, sub, should)
-char *str;
-regmatch_t sub;
-char *should;
-{
- register int len;
- register int shlen;
- register char *p;
- static char grump[500];
- register char *at = NULL;
-
- if (should != NULL && strcmp(should, "-") == 0)
- should = NULL;
- if (should != NULL && should[0] == '@') {
- at = should + 1;
- should = "";
- }
-
- /* check rm_so and rm_eo for consistency */
- if (sub.rm_so > sub.rm_eo || (sub.rm_so == -1 && sub.rm_eo != -1) ||
- (sub.rm_so != -1 && sub.rm_eo == -1) ||
- (sub.rm_so != -1 && sub.rm_so < 0) ||
- (sub.rm_eo != -1 && sub.rm_eo < 0) ) {
- sprintf(grump, "start %ld end %ld", (long)sub.rm_so,
- (long)sub.rm_eo);
- return(grump);
- }
-
- /* check for no match */
- if (sub.rm_so == -1 && should == NULL)
- return(NULL);
- if (sub.rm_so == -1)
- return("did not match");
-
- /* check for in range */
- if (sub.rm_eo > strlen(str)) {
- sprintf(grump, "start %ld end %ld, past end of string",
- (long)sub.rm_so, (long)sub.rm_eo);
- return(grump);
- }
-
- len = (int)(sub.rm_eo - sub.rm_so);
- shlen = (int)strlen(should);
- p = str + sub.rm_so;
-
- /* check for not supposed to match */
- if (should == NULL) {
- sprintf(grump, "matched `%.*s'", len, p);
- return(grump);
- }
-
- /* check for wrong match */
- if (len != shlen || strncmp(p, should, (size_t)shlen) != 0) {
- sprintf(grump, "matched `%.*s' instead", len, p);
- return(grump);
- }
- if (shlen > 0)
- return(NULL);
-
- /* check null match in right place */
- if (at == NULL)
- return(NULL);
- shlen = strlen(at);
- if (shlen == 0)
- shlen = 1; /* force check for end-of-string */
- if (strncmp(p, at, shlen) != 0) {
- sprintf(grump, "matched null at `%.20s'", p);
- return(grump);
- }
- return(NULL);
-}
-
-/*
- - eprint - convert error number to name
- == static char *eprint(int err);
- */
-static char *
-eprint(err)
-int err;
-{
- static char epbuf[100];
- size_t len;
-
- len = regerror(REG_ITOA|err, (regex_t *)NULL, epbuf, sizeof(epbuf));
- assert(len <= sizeof(epbuf));
- return(epbuf);
-}
-
-/*
- - efind - convert error name to number
- == static int efind(char *name);
- */
-static int
-efind(name)
-char *name;
-{
- static char efbuf[100];
- regex_t re;
-
- sprintf(efbuf, "REG_%s", name);
- assert(strlen(efbuf) < sizeof(efbuf));
- re.re_endp = efbuf;
- (void) regerror(REG_ATOI, &re, efbuf, sizeof(efbuf));
- return(atoi(efbuf));
-}
diff --git a/regex/main.ih b/regex/main.ih
deleted file mode 100644
index 5a0118ac44..0000000000
--- a/regex/main.ih
+++ /dev/null
@@ -1,19 +0,0 @@
-/* ========= begin header generated by ./mkh ========= */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* === main.c === */
-void regress(FILE *in);
-void try(char *f0, char *f1, char *f2, char *f3, char *f4, int opts);
-int options(int type, char *s);
-int opt(int c, char *s);
-void fixstr(register char *p);
-char *check(char *str, regmatch_t sub, char *should);
-static char *eprint(int err);
-static int efind(char *name);
-
-#ifdef __cplusplus
-}
-#endif
-/* ========= end header generated by ./mkh ========= */
diff --git a/regex/mkh b/regex/mkh
deleted file mode 100644
index 252b246c7b..0000000000
--- a/regex/mkh
+++ /dev/null
@@ -1,76 +0,0 @@
-#! /bin/sh
-# mkh - pull headers out of C source
-PATH=/bin:/usr/bin ; export PATH
-
-# egrep pattern to pick out marked lines
-egrep='^ =([ ]|$)'
-
-# Sed program to process marked lines into lines for the header file.
-# The markers have already been removed. Two things are done here: removal
-# of backslashed newlines, and some fudging of comments. The first is done
-# because -o needs to have prototypes on one line to strip them down.
-# Getting comments into the output is tricky; we turn C++-style // comments
-# into /* */ comments, after altering any existing */'s to avoid trouble.
-peel=' /\\$/N
- /\\\n[ ]*/s///g
- /\/\//s;\*/;* /;g
- /\/\//s;//\(.*\);/*\1 */;'
-
-for a
-do
- case "$a" in
- -o) # old (pre-function-prototype) compiler
- # add code to comment out argument lists
- peel="$peel
- "'/^\([^#\/][^\/]*[a-zA-Z0-9_)]\)(\(.*\))/s;;\1(/*\2*/);'
- shift
- ;;
- -b) # funny Berkeley __P macro
- peel="$peel
- "'/^\([^#\/][^\/]*[a-zA-Z0-9_)]\)(\(.*\))/s;;\1 __P((\2));'
- shift
- ;;
- -s) # compiler doesn't like `static foo();'
- # add code to get rid of the `static'
- peel="$peel
- "'/^static[ ][^\/]*[a-zA-Z0-9_)](.*)/s;static.;;'
- shift
- ;;
- -p) # private declarations
- egrep='^ ==([ ]|$)'
- shift
- ;;
- -i) # wrap in #ifndef, argument is name
- ifndef="$2"
- shift ; shift
- ;;
- *) break
- ;;
- esac
-done
-
-if test " $ifndef" != " "
-then
- echo "#ifndef $ifndef"
- echo "#define $ifndef /* never again */"
-fi
-echo "/* ========= begin header generated by $0 ========= */"
-echo '#ifdef __cplusplus'
-echo 'extern "C" {'
-echo '#endif'
-for f
-do
- echo
- echo "/* === $f === */"
- egrep "$egrep" $f | sed 's/^ ==*[ ]//;s/^ ==*$//' | sed "$peel"
- echo
-done
-echo '#ifdef __cplusplus'
-echo '}'
-echo '#endif'
-echo "/* ========= end header generated by $0 ========= */"
-if test " $ifndef" != " "
-then
- echo "#endif"
-fi
-exit 0
diff --git a/regex/regcomp.c b/regex/regcomp.c
deleted file mode 100644
index 0b939461bd..0000000000
--- a/regex/regcomp.c
+++ /dev/null
@@ -1,1608 +0,0 @@
-#include <sys/types.h>
-#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
-#include <limits.h>
-#include <stdlib.h>
-
-#define POSIX_MISTAKE
-
-#include "utils.h"
-#include "regex.h"
-#include "regex2.h"
-
-#include "cclass.h"
-#include "cname.h"
-
-/*
- * parse structure, passed up and down to avoid global variables and
- * other clumsinesses
- */
-struct parse {
- char *next; /* next character in RE */
- char *end; /* end of string (-> NUL normally) */
- int error; /* has an error been seen? */
- sop *strip; /* malloced strip */
- sopno ssize; /* malloced strip size (allocated) */
- sopno slen; /* malloced strip length (used) */
- int ncsalloc; /* number of csets allocated */
- struct re_guts *g;
-# define NPAREN 10 /* we need to remember () 1-9 for back refs */
- sopno pbegin[NPAREN]; /* -> ( ([0] unused) */
- sopno pend[NPAREN]; /* -> ) ([0] unused) */
-};
-
-#include "regcomp.ih"
-
-static char nuls[10]; /* place to point scanner in event of error */
-
-/*
- * macros for use with parse structure
- * BEWARE: these know that the parse structure is named `p' !!!
- */
-#define PEEK() (*p->next)
-#define PEEK2() (*(p->next+1))
-#define MORE() (p->next < p->end)
-#define MORE2() (p->next+1 < p->end)
-#define SEE(c) (MORE() && PEEK() == (c))
-#define SEETWO(a, b) (MORE() && MORE2() && PEEK() == (a) && PEEK2() == (b))
-#define EAT(c) ((SEE(c)) ? (NEXT(), 1) : 0)
-#define EATTWO(a, b) ((SEETWO(a, b)) ? (NEXT2(), 1) : 0)
-#define NEXT() (p->next++)
-#define NEXT2() (p->next += 2)
-#define NEXTn(n) (p->next += (n))
-#define GETNEXT() (*p->next++)
-#define SETERROR(e) seterr(p, (e))
-#define REQUIRE(co, e) (void) ((co) || SETERROR(e))
-#define MUSTSEE(c, e) (REQUIRE(MORE() && PEEK() == (c), e))
-#define MUSTEAT(c, e) (REQUIRE(MORE() && GETNEXT() == (c), e))
-#define MUSTNOTSEE(c, e) (REQUIRE(!MORE() || PEEK() != (c), e))
-#define EMIT(op, sopnd) doemit(p, (sop)(op), (size_t)(sopnd))
-#define INSERT(op, pos) doinsert(p, (sop)(op), HERE()-(pos)+1, pos)
-#define AHEAD(pos) dofwd(p, pos, HERE()-(pos))
-#define ASTERN(sop, pos) EMIT(sop, HERE()-pos)
-#define HERE() (p->slen)
-#define THERE() (p->slen - 1)
-#define THERETHERE() (p->slen - 2)
-#define DROP(n) (p->slen -= (n))
-
-#ifndef NDEBUG
-static int never = 0; /* for use in asserts; shuts lint up */
-#else
-#define never 0 /* some <assert.h>s have bugs too */
-#endif
-
-/*
- - regcomp - interface for parser and compilation
- = API_EXPORT(int) regcomp(regex_t *, const char *, int);
- = #define REG_BASIC 0000
- = #define REG_EXTENDED 0001
- = #define REG_ICASE 0002
- = #define REG_NOSUB 0004
- = #define REG_NEWLINE 0010
- = #define REG_NOSPEC 0020
- = #define REG_PEND 0040
- = #define REG_DUMP 0200
- */
-API_EXPORT(int) /* 0 success, otherwise REG_something */
-regcomp(preg, pattern, cflags)
-regex_t *preg;
-const char *pattern;
-int cflags;
-{
- struct parse pa;
- register struct re_guts *g;
- register struct parse *p = &pa;
- register int i;
- register size_t len;
-#ifdef REDEBUG
-# define GOODFLAGS(f) (f)
-#else
-# define GOODFLAGS(f) ((f)&~REG_DUMP)
-#endif
-
- cflags = GOODFLAGS(cflags);
- if ((cflags&REG_EXTENDED) && (cflags&REG_NOSPEC))
- return(REG_INVARG);
-
- if (cflags&REG_PEND) {
- if (preg->re_endp < pattern)
- return(REG_INVARG);
- len = preg->re_endp - pattern;
- } else
- len = strlen((char *)pattern);
-
- /* do the mallocs early so failure handling is easy */
- g = (struct re_guts *)malloc(sizeof(struct re_guts) +
- (NC-1)*sizeof(cat_t));
- if (g == NULL)
- return(REG_ESPACE);
- p->ssize = len/(size_t)2*(size_t)3 + (size_t)1; /* ugh */
- p->strip = (sop *)malloc(p->ssize * sizeof(sop));
- p->slen = 0;
- if (p->strip == NULL) {
- free((char *)g);
- return(REG_ESPACE);
- }
-
- /* set things up */
- p->g = g;
- p->next = (char *)pattern; /* convenience; we do not modify it */
- p->end = p->next + len;
- p->error = 0;
- p->ncsalloc = 0;
- for (i = 0; i < NPAREN; i++) {
- p->pbegin[i] = 0;
- p->pend[i] = 0;
- }
- g->csetsize = NC;
- g->sets = NULL;
- g->setbits = NULL;
- g->ncsets = 0;
- g->cflags = cflags;
- g->iflags = 0;
- g->nbol = 0;
- g->neol = 0;
- g->must = NULL;
- g->mlen = 0;
- g->nsub = 0;
- g->ncategories = 1; /* category 0 is "everything else" */
- g->categories = &g->catspace[-(CHAR_MIN)];
- (void) memset((char *)g->catspace, 0, NC*sizeof(cat_t));
- g->backrefs = 0;
-
- /* do it */
- EMIT(OEND, 0);
- g->firststate = THERE();
- if (cflags&REG_EXTENDED)
- p_ere(p, OUT);
- else if (cflags&REG_NOSPEC)
- p_str(p);
- else
- p_bre(p, OUT, OUT);
- EMIT(OEND, 0);
- g->laststate = THERE();
-
- /* tidy up loose ends and fill things in */
- categorize(p, g);
- stripsnug(p, g);
- findmust(p, g);
- g->nplus = pluscount(p, g);
- g->magic = MAGIC2;
- preg->re_nsub = g->nsub;
- preg->re_g = g;
- preg->re_magic = MAGIC1;
-#ifndef REDEBUG
- /* not debugging, so can't rely on the assert() in regexec() */
- if (g->iflags&BAD)
- SETERROR(REG_ASSERT);
-#endif
-
- /* win or lose, we're done */
- if (p->error != 0) /* lose */
- regfree(preg);
- return(p->error);
-}
-
-/*
- - p_ere - ERE parser top level, concatenation and alternation
- == static void p_ere(register struct parse *p, int stop);
- */
-static void
-p_ere(p, stop)
-register struct parse *p;
-int stop; /* character this ERE should end at */
-{
- register char c;
- register sopno prevback = 0;
- register sopno prevfwd = 0;
- register sopno conc;
- register int first = 1; /* is this the first alternative? */
-
- for (;;) {
- /* do a bunch of concatenated expressions */
- conc = HERE();
- while (MORE() && (c = PEEK()) != '|' && c != stop)
- p_ere_exp(p);
- (void) REQUIRE(HERE() != conc, REG_EMPTY); /* require nonempty */
-
- if (!EAT('|'))
- break; /* NOTE BREAK OUT */
-
- if (first) {
- INSERT(OCH_, conc); /* offset is wrong */
- prevfwd = conc;
- prevback = conc;
- first = 0;
- }
- ASTERN(OOR1, prevback);
- prevback = THERE();
- AHEAD(prevfwd); /* fix previous offset */
- prevfwd = HERE();
- EMIT(OOR2, 0); /* offset is very wrong */
- }
-
- if (!first) { /* tail-end fixups */
- AHEAD(prevfwd);
- ASTERN(O_CH, prevback);
- }
-
- assert(!MORE() || SEE(stop));
-}
-
-/*
- - p_ere_exp - parse one subERE, an atom possibly followed by a repetition op
- == static void p_ere_exp(register struct parse *p);
- */
-static void
-p_ere_exp(p)
-register struct parse *p;
-{
- register char c;
- register sopno pos;
- register int count;
- register int count2;
- register sopno subno;
- int wascaret = 0;
-
- assert(MORE()); /* caller should have ensured this */
- c = GETNEXT();
-
- pos = HERE();
- switch (c) {
- case '(':
- REQUIRE(MORE(), REG_EPAREN);
- p->g->nsub++;
- subno = p->g->nsub;
- if (subno < NPAREN)
- p->pbegin[subno] = HERE();
- EMIT(OLPAREN, subno);
- if (!SEE(')'))
- p_ere(p, ')');
- if (subno < NPAREN) {
- p->pend[subno] = HERE();
- assert(p->pend[subno] != 0);
- }
- EMIT(ORPAREN, subno);
- MUSTEAT(')', REG_EPAREN);
- break;
-#ifndef POSIX_MISTAKE
- case ')': /* happens only if no current unmatched ( */
- /*
- * You may ask, why the ifndef? Because I didn't notice
- * this until slightly too late for 1003.2, and none of the
- * other 1003.2 regular-expression reviewers noticed it at
- * all. So an unmatched ) is legal POSIX, at least until
- * we can get it fixed.
- */
- SETERROR(REG_EPAREN);
- break;
-#endif
- case '^':
- EMIT(OBOL, 0);
- p->g->iflags |= USEBOL;
- p->g->nbol++;
- wascaret = 1;
- break;
- case '$':
- EMIT(OEOL, 0);
- p->g->iflags |= USEEOL;
- p->g->neol++;
- break;
- case '|':
- SETERROR(REG_EMPTY);
- break;
- case '*':
- case '+':
- case '?':
- SETERROR(REG_BADRPT);
- break;
- case '.':
- if (p->g->cflags&REG_NEWLINE)
- nonnewline(p);
- else
- EMIT(OANY, 0);
- break;
- case '[':
- p_bracket(p);
- break;
- case '\\':
- REQUIRE(MORE(), REG_EESCAPE);
- c = GETNEXT();
- ordinary(p, c);
- break;
- case '{': /* okay as ordinary except if digit follows */
- REQUIRE(!MORE() || !isdigit(PEEK()), REG_BADRPT);
- /* FALLTHROUGH */
- default:
- ordinary(p, c);
- break;
- }
-
- if (!MORE())
- return;
- c = PEEK();
- /* we call { a repetition if followed by a digit */
- if (!( c == '*' || c == '+' || c == '?' ||
- (c == '{' && MORE2() && isdigit(PEEK2())) ))
- return; /* no repetition, we're done */
- NEXT();
-
- REQUIRE(!wascaret, REG_BADRPT);
- switch (c) {
- case '*': /* implemented as +? */
- /* this case does not require the (y|) trick, noKLUDGE */
- INSERT(OPLUS_, pos);
- ASTERN(O_PLUS, pos);
- INSERT(OQUEST_, pos);
- ASTERN(O_QUEST, pos);
- break;
- case '+':
- INSERT(OPLUS_, pos);
- ASTERN(O_PLUS, pos);
- break;
- case '?':
- /* KLUDGE: emit y? as (y|) until subtle bug gets fixed */
- INSERT(OCH_, pos); /* offset slightly wrong */
- ASTERN(OOR1, pos); /* this one's right */
- AHEAD(pos); /* fix the OCH_ */
- EMIT(OOR2, 0); /* offset very wrong... */
- AHEAD(THERE()); /* ...so fix it */
- ASTERN(O_CH, THERETHERE());
- break;
- case '{':
- count = p_count(p);
- if (EAT(',')) {
- if (isdigit(PEEK())) {
- count2 = p_count(p);
- REQUIRE(count <= count2, REG_BADBR);
- } else /* single number with comma */
- count2 = INFINITY;
- } else /* just a single number */
- count2 = count;
- repeat(p, pos, count, count2);
- if (!EAT('}')) { /* error heuristics */
- while (MORE() && PEEK() != '}')
- NEXT();
- REQUIRE(MORE(), REG_EBRACE);
- SETERROR(REG_BADBR);
- }
- break;
- }
-
- if (!MORE())
- return;
- c = PEEK();
- if (!( c == '*' || c == '+' || c == '?' ||
- (c == '{' && MORE2() && isdigit(PEEK2())) ) )
- return;
- SETERROR(REG_BADRPT);
-}
-
-/*
- - p_str - string (no metacharacters) "parser"
- == static void p_str(register struct parse *p);
- */
-static void
-p_str(p)
-register struct parse *p;
-{
- REQUIRE(MORE(), REG_EMPTY);
- while (MORE())
- ordinary(p, GETNEXT());
-}
-
-/*
- - p_bre - BRE parser top level, anchoring and concatenation
- == static void p_bre(register struct parse *p, register int end1, \
- == register int end2);
- * Giving end1 as OUT essentially eliminates the end1/end2 check.
- *
- * This implementation is a bit of a kludge, in that a trailing $ is first
- * taken as an ordinary character and then revised to be an anchor. The
- * only undesirable side effect is that '$' gets included as a character
- * category in such cases. This is fairly harmless; not worth fixing.
- * The amount of lookahead needed to avoid this kludge is excessive.
- */
-static void
-p_bre(p, end1, end2)
-register struct parse *p;
-register int end1; /* first terminating character */
-register int end2; /* second terminating character */
-{
- register sopno start = HERE();
- register int first = 1; /* first subexpression? */
- register int wasdollar = 0;
-
- if (EAT('^')) {
- EMIT(OBOL, 0);
- p->g->iflags |= USEBOL;
- p->g->nbol++;
- }
- while (MORE() && !SEETWO(end1, end2)) {
- wasdollar = p_simp_re(p, first);
- first = 0;
- }
- if (wasdollar) { /* oops, that was a trailing anchor */
- DROP(1);
- EMIT(OEOL, 0);
- p->g->iflags |= USEEOL;
- p->g->neol++;
- }
-
- REQUIRE(HERE() != start, REG_EMPTY); /* require nonempty */
-}
-
-/*
- - p_simp_re - parse a simple RE, an atom possibly followed by a repetition
- == static int p_simp_re(register struct parse *p, int starordinary);
- */
-static int /* was the simple RE an unbackslashed $? */
-p_simp_re(p, starordinary)
-register struct parse *p;
-int starordinary; /* is a leading * an ordinary character? */
-{
- register int c;
- register int count;
- register int count2;
- register sopno pos;
- register int i;
- register sopno subno;
-# define BACKSL (1<<CHAR_BIT)
-
- pos = HERE(); /* repetion op, if any, covers from here */
-
- assert(MORE()); /* caller should have ensured this */
- c = GETNEXT();
- if (c == '\\') {
- REQUIRE(MORE(), REG_EESCAPE);
- c = BACKSL | (unsigned char)GETNEXT();
- }
- switch (c) {
- case '.':
- if (p->g->cflags&REG_NEWLINE)
- nonnewline(p);
- else
- EMIT(OANY, 0);
- break;
- case '[':
- p_bracket(p);
- break;
- case BACKSL|'{':
- SETERROR(REG_BADRPT);
- break;
- case BACKSL|'(':
- p->g->nsub++;
- subno = p->g->nsub;
- if (subno < NPAREN)
- p->pbegin[subno] = HERE();
- EMIT(OLPAREN, subno);
- /* the MORE here is an error heuristic */
- if (MORE() && !SEETWO('\\', ')'))
- p_bre(p, '\\', ')');
- if (subno < NPAREN) {
- p->pend[subno] = HERE();
- assert(p->pend[subno] != 0);
- }
- EMIT(ORPAREN, subno);
- REQUIRE(EATTWO('\\', ')'), REG_EPAREN);
- break;
- case BACKSL|')': /* should not get here -- must be user */
- case BACKSL|'}':
- SETERROR(REG_EPAREN);
- break;
- case BACKSL|'1':
- case BACKSL|'2':
- case BACKSL|'3':
- case BACKSL|'4':
- case BACKSL|'5':
- case BACKSL|'6':
- case BACKSL|'7':
- case BACKSL|'8':
- case BACKSL|'9':
- i = (c&~BACKSL) - '0';
- assert(i < NPAREN);
- if (p->pend[i] != 0) {
- assert(i <= p->g->nsub);
- EMIT(OBACK_, i);
- assert(p->pbegin[i] != 0);
- assert(OP(p->strip[p->pbegin[i]]) == OLPAREN);
- assert(OP(p->strip[p->pend[i]]) == ORPAREN);
- (void) dupl(p, p->pbegin[i]+1, p->pend[i]);
- EMIT(O_BACK, i);
- } else
- SETERROR(REG_ESUBREG);
- p->g->backrefs = 1;
- break;
- case '*':
- REQUIRE(starordinary, REG_BADRPT);
- /* FALLTHROUGH */
- default:
- ordinary(p, (char)c); /* takes off BACKSL, if any */
- break;
- }
-
- if (EAT('*')) { /* implemented as +? */
- /* this case does not require the (y|) trick, noKLUDGE */
- INSERT(OPLUS_, pos);
- ASTERN(O_PLUS, pos);
- INSERT(OQUEST_, pos);
- ASTERN(O_QUEST, pos);
- } else if (EATTWO('\\', '{')) {
- count = p_count(p);
- if (EAT(',')) {
- if (MORE() && isdigit(PEEK())) {
- count2 = p_count(p);
- REQUIRE(count <= count2, REG_BADBR);
- } else /* single number with comma */
- count2 = INFINITY;
- } else /* just a single number */
- count2 = count;
- repeat(p, pos, count, count2);
- if (!EATTWO('\\', '}')) { /* error heuristics */
- while (MORE() && !SEETWO('\\', '}'))
- NEXT();
- REQUIRE(MORE(), REG_EBRACE);
- SETERROR(REG_BADBR);
- }
- } else if (c == (unsigned char)'$') /* $ (but not \$) ends it */
- return(1);
-
- return(0);
-}
-
-/*
- - p_count - parse a repetition count
- == static int p_count(register struct parse *p);
- */
-static int /* the value */
-p_count(p)
-register struct parse *p;
-{
- register int count = 0;
- register int ndigits = 0;
-
- while (MORE() && isdigit(PEEK()) && count <= DUPMAX) {
- count = count*10 + (GETNEXT() - '0');
- ndigits++;
- }
-
- REQUIRE(ndigits > 0 && count <= DUPMAX, REG_BADBR);
- return(count);
-}
-
-/*
- - p_bracket - parse a bracketed character list
- == static void p_bracket(register struct parse *p);
- *
- * Note a significant property of this code: if the allocset() did SETERROR,
- * no set operations are done.
- */
-static void
-p_bracket(p)
-register struct parse *p;
-{
- register cset *cs = allocset(p);
- register int invert = 0;
-
- /* Dept of Truly Sickening Special-Case Kludges */
- if (p->next + 5 < p->end && strncmp(p->next, "[:<:]]", 6) == 0) {
- EMIT(OBOW, 0);
- NEXTn(6);
- return;
- }
- if (p->next + 5 < p->end && strncmp(p->next, "[:>:]]", 6) == 0) {
- EMIT(OEOW, 0);
- NEXTn(6);
- return;
- }
-
- if (EAT('^'))
- invert++; /* make note to invert set at end */
- if (EAT(']'))
- CHadd(cs, ']');
- else if (EAT('-'))
- CHadd(cs, '-');
- while (MORE() && PEEK() != ']' && !SEETWO('-', ']'))
- p_b_term(p, cs);
- if (EAT('-'))
- CHadd(cs, '-');
- MUSTEAT(']', REG_EBRACK);
-
- if (p->error != 0) /* don't mess things up further */
- return;
-
- if (p->g->cflags&REG_ICASE) {
- register int i;
- register int ci;
-
- for (i = p->g->csetsize - 1; i >= 0; i--)
- if (CHIN(cs, i) && isalpha(i)) {
- ci = othercase(i);
- if (ci != i)
- CHadd(cs, ci);
- }
- if (cs->multis != NULL)
- mccase(p, cs);
- }
- if (invert) {
- register int i;
-
- for (i = p->g->csetsize - 1; i >= 0; i--)
- if (CHIN(cs, i))
- CHsub(cs, i);
- else
- CHadd(cs, i);
- if (p->g->cflags&REG_NEWLINE)
- CHsub(cs, '\n');
- if (cs->multis != NULL)
- mcinvert(p, cs);
- }
-
- assert(cs->multis == NULL); /* xxx */
-
- if (nch(p, cs) == 1) { /* optimize singleton sets */
- ordinary(p, firstch(p, cs));
- freeset(p, cs);
- } else
- EMIT(OANYOF, freezeset(p, cs));
-}
-
-/*
- - p_b_term - parse one term of a bracketed character list
- == static void p_b_term(register struct parse *p, register cset *cs);
- */
-static void
-p_b_term(p, cs)
-register struct parse *p;
-register cset *cs;
-{
- register char c;
- register char start, finish;
- register int i;
-
- /* classify what we've got */
- switch ((MORE()) ? PEEK() : '\0') {
- case '[':
- c = (MORE2()) ? PEEK2() : '\0';
- break;
- case '-':
- SETERROR(REG_ERANGE);
- return; /* NOTE RETURN */
- break;
- default:
- c = '\0';
- break;
- }
-
- switch (c) {
- case ':': /* character class */
- NEXT2();
- REQUIRE(MORE(), REG_EBRACK);
- c = PEEK();
- REQUIRE(c != '-' && c != ']', REG_ECTYPE);
- p_b_cclass(p, cs);
- REQUIRE(MORE(), REG_EBRACK);
- REQUIRE(EATTWO(':', ']'), REG_ECTYPE);
- break;
- case '=': /* equivalence class */
- NEXT2();
- REQUIRE(MORE(), REG_EBRACK);
- c = PEEK();
- REQUIRE(c != '-' && c != ']', REG_ECOLLATE);
- p_b_eclass(p, cs);
- REQUIRE(MORE(), REG_EBRACK);
- REQUIRE(EATTWO('=', ']'), REG_ECOLLATE);
- break;
- default: /* symbol, ordinary character, or range */
-/* xxx revision needed for multichar stuff */
- start = p_b_symbol(p);
- if (SEE('-') && MORE2() && PEEK2() != ']') {
- /* range */
- NEXT();
- if (EAT('-'))
- finish = '-';
- else
- finish = p_b_symbol(p);
- } else
- finish = start;
-/* xxx what about signed chars here... */
- REQUIRE(start <= finish, REG_ERANGE);
- for (i = start; i <= finish; i++)
- CHadd(cs, i);
- break;
- }
-}
-
-/*
- - p_b_cclass - parse a character-class name and deal with it
- == static void p_b_cclass(register struct parse *p, register cset *cs);
- */
-static void
-p_b_cclass(p, cs)
-register struct parse *p;
-register cset *cs;
-{
- register char *sp = p->next;
- register struct cclass *cp;
- register size_t len;
- register char *u;
- register char c;
-
- while (MORE() && isalpha(PEEK()))
- NEXT();
- len = p->next - sp;
- for (cp = cclasses; cp->name != NULL; cp++)
- if (strncmp(cp->name, sp, len) == 0 && cp->name[len] == '\0')
- break;
- if (cp->name == NULL) {
- /* oops, didn't find it */
- SETERROR(REG_ECTYPE);
- return;
- }
-
- u = cp->chars;
- while ((c = *u++) != '\0')
- CHadd(cs, c);
- for (u = cp->multis; *u != '\0'; u += strlen(u) + 1)
- MCadd(p, cs, u);
-}
-
-/*
- - p_b_eclass - parse an equivalence-class name and deal with it
- == static void p_b_eclass(register struct parse *p, register cset *cs);
- *
- * This implementation is incomplete. xxx
- */
-static void
-p_b_eclass(p, cs)
-register struct parse *p;
-register cset *cs;
-{
- register char c;
-
- c = p_b_coll_elem(p, '=');
- CHadd(cs, c);
-}
-
-/*
- - p_b_symbol - parse a character or [..]ed multicharacter collating symbol
- == static char p_b_symbol(register struct parse *p);
- */
-static char /* value of symbol */
-p_b_symbol(p)
-register struct parse *p;
-{
- register char value;
-
- REQUIRE(MORE(), REG_EBRACK);
- if (!EATTWO('[', '.'))
- return(GETNEXT());
-
- /* collating symbol */
- value = p_b_coll_elem(p, '.');
- REQUIRE(EATTWO('.', ']'), REG_ECOLLATE);
- return(value);
-}
-
-/*
- - p_b_coll_elem - parse a collating-element name and look it up
- == static char p_b_coll_elem(register struct parse *p, int endc);
- */
-static char /* value of collating element */
-p_b_coll_elem(p, endc)
-register struct parse *p;
-int endc; /* name ended by endc,']' */
-{
- register char *sp = p->next;
- register struct cname *cp;
- register int len;
-
- while (MORE() && !SEETWO(endc, ']'))
- NEXT();
- if (!MORE()) {
- SETERROR(REG_EBRACK);
- return(0);
- }
- len = p->next - sp;
- for (cp = cnames; cp->name != NULL; cp++)
- if (strncmp(cp->name, sp, len) == 0 && cp->name[len] == '\0')
- return(cp->code); /* known name */
- if (len == 1)
- return(*sp); /* single character */
- SETERROR(REG_ECOLLATE); /* neither */
- return(0);
-}
-
-/*
- - othercase - return the case counterpart of an alphabetic
- == static char othercase(int ch);
- */
-static char /* if no counterpart, return ch */
-othercase(ch)
-int ch;
-{
- assert(isalpha(ch));
- if (isupper(ch))
- return(tolower(ch));
- else if (islower(ch))
- return(toupper(ch));
- else /* peculiar, but could happen */
- return(ch);
-}
-
-/*
- - bothcases - emit a dualcase version of a two-case character
- == static void bothcases(register struct parse *p, int ch);
- *
- * Boy, is this implementation ever a kludge...
- */
-static void
-bothcases(p, ch)
-register struct parse *p;
-int ch;
-{
- register char *oldnext = p->next;
- register char *oldend = p->end;
- char bracket[3];
-
- assert(othercase(ch) != ch); /* p_bracket() would recurse */
- p->next = bracket;
- p->end = bracket+2;
- bracket[0] = ch;
- bracket[1] = ']';
- bracket[2] = '\0';
- p_bracket(p);
- assert(p->next == bracket+2);
- p->next = oldnext;
- p->end = oldend;
-}
-
-/*
- - ordinary - emit an ordinary character
- == static void ordinary(register struct parse *p, register int ch);
- */
-static void
-ordinary(p, ch)
-register struct parse *p;
-register int ch;
-{
- register cat_t *cap = p->g->categories;
-
- if ((p->g->cflags&REG_ICASE) && isalpha(ch) && othercase(ch) != ch)
- bothcases(p, ch);
- else {
- EMIT(OCHAR, (unsigned char)ch);
- if (cap[ch] == 0)
- cap[ch] = p->g->ncategories++;
- }
-}
-
-/*
- - nonnewline - emit REG_NEWLINE version of OANY
- == static void nonnewline(register struct parse *p);
- *
- * Boy, is this implementation ever a kludge...
- */
-static void
-nonnewline(p)
-register struct parse *p;
-{
- register char *oldnext = p->next;
- register char *oldend = p->end;
- char bracket[4];
-
- p->next = bracket;
- p->end = bracket+3;
- bracket[0] = '^';
- bracket[1] = '\n';
- bracket[2] = ']';
- bracket[3] = '\0';
- p_bracket(p);
- assert(p->next == bracket+3);
- p->next = oldnext;
- p->end = oldend;
-}
-
-/*
- - repeat - generate code for a bounded repetition, recursively if needed
- == static void repeat(register struct parse *p, sopno start, int from, int to);
- */
-static void
-repeat(p, start, from, to)
-register struct parse *p;
-sopno start; /* operand from here to end of strip */
-int from; /* repeated from this number */
-int to; /* to this number of times (maybe INFINITY) */
-{
- register sopno finish = HERE();
-# define N 2
-# define INF 3
-# define REP(f, t) ((f)*8 + (t))
-# define MAP(n) (((n) <= 1) ? (n) : ((n) == INFINITY) ? INF : N)
- register sopno copy;
-
- if (p->error != 0) /* head off possible runaway recursion */
- return;
-
- assert(from <= to);
-
- switch (REP(MAP(from), MAP(to))) {
- case REP(0, 0): /* must be user doing this */
- DROP(finish-start); /* drop the operand */
- break;
- case REP(0, 1): /* as x{1,1}? */
- case REP(0, N): /* as x{1,n}? */
- case REP(0, INF): /* as x{1,}? */
- /* KLUDGE: emit y? as (y|) until subtle bug gets fixed */
- INSERT(OCH_, start); /* offset is wrong... */
- repeat(p, start+1, 1, to);
- ASTERN(OOR1, start);
- AHEAD(start); /* ... fix it */
- EMIT(OOR2, 0);
- AHEAD(THERE());
- ASTERN(O_CH, THERETHERE());
- break;
- case REP(1, 1): /* trivial case */
- /* done */
- break;
- case REP(1, N): /* as x?x{1,n-1} */
- /* KLUDGE: emit y? as (y|) until subtle bug gets fixed */
- INSERT(OCH_, start);
- ASTERN(OOR1, start);
- AHEAD(start);
- EMIT(OOR2, 0); /* offset very wrong... */
- AHEAD(THERE()); /* ...so fix it */
- ASTERN(O_CH, THERETHERE());
- copy = dupl(p, start+1, finish+1);
- assert(copy == finish+4);
- repeat(p, copy, 1, to-1);
- break;
- case REP(1, INF): /* as x+ */
- INSERT(OPLUS_, start);
- ASTERN(O_PLUS, start);
- break;
- case REP(N, N): /* as xx{m-1,n-1} */
- copy = dupl(p, start, finish);
- repeat(p, copy, from-1, to-1);
- break;
- case REP(N, INF): /* as xx{n-1,INF} */
- copy = dupl(p, start, finish);
- repeat(p, copy, from-1, to);
- break;
- default: /* "can't happen" */
- SETERROR(REG_ASSERT); /* just in case */
- break;
- }
-}
-
-/*
- - seterr - set an error condition
- == static int seterr(register struct parse *p, int e);
- */
-static int /* useless but makes type checking happy */
-seterr(p, e)
-register struct parse *p;
-int e;
-{
- if (p->error == 0) /* keep earliest error condition */
- p->error = e;
- p->next = nuls; /* try to bring things to a halt */
- p->end = nuls;
- return(0); /* make the return value well-defined */
-}
-
-/*
- - allocset - allocate a set of characters for []
- == static cset *allocset(register struct parse *p);
- */
-static cset *
-allocset(p)
-register struct parse *p;
-{
- register int no = p->g->ncsets++;
- register size_t nc;
- register size_t nbytes;
- register cset *cs;
- register size_t css = (size_t)p->g->csetsize;
- register int i;
-
- if (no >= p->ncsalloc) { /* need another column of space */
- p->ncsalloc += CHAR_BIT;
- nc = p->ncsalloc;
- assert(nc % CHAR_BIT == 0);
- nbytes = nc / CHAR_BIT * css;
- if (p->g->sets == NULL)
- p->g->sets = (cset *)malloc(nc * sizeof(cset));
- else
- p->g->sets = (cset *)realloc((char *)p->g->sets,
- nc * sizeof(cset));
- if (p->g->setbits == NULL)
- p->g->setbits = (uch *)malloc(nbytes);
- else {
- p->g->setbits = (uch *)realloc((char *)p->g->setbits,
- nbytes);
- /* xxx this isn't right if setbits is now NULL */
- for (i = 0; i < no; i++)
- p->g->sets[i].ptr = p->g->setbits + css*(i/CHAR_BIT);
- }
- if (p->g->sets != NULL && p->g->setbits != NULL)
- (void) memset((char *)p->g->setbits + (nbytes - css),
- 0, css);
- else {
- no = 0;
- SETERROR(REG_ESPACE);
- /* caller's responsibility not to do set ops */
- }
- }
-
- assert(p->g->sets != NULL); /* xxx */
- cs = &p->g->sets[no];
- cs->ptr = p->g->setbits + css*((no)/CHAR_BIT);
- cs->mask = 1 << ((no) % CHAR_BIT);
- cs->hash = 0;
- cs->smultis = 0;
- cs->multis = NULL;
-
- return(cs);
-}
-
-/*
- - freeset - free a now-unused set
- == static void freeset(register struct parse *p, register cset *cs);
- */
-static void
-freeset(p, cs)
-register struct parse *p;
-register cset *cs;
-{
- register size_t i;
- register cset *top = &p->g->sets[p->g->ncsets];
- register size_t css = (size_t)p->g->csetsize;
-
- for (i = 0; i < css; i++)
- CHsub(cs, i);
- if (cs == top-1) /* recover only the easy case */
- p->g->ncsets--;
-}
-
-/*
- - freezeset - final processing on a set of characters
- == static int freezeset(register struct parse *p, register cset *cs);
- *
- * The main task here is merging identical sets. This is usually a waste
- * of time (although the hash code minimizes the overhead), but can win
- * big if REG_ICASE is being used. REG_ICASE, by the way, is why the hash
- * is done using addition rather than xor -- all ASCII [aA] sets xor to
- * the same value!
- */
-static int /* set number */
-freezeset(p, cs)
-register struct parse *p;
-register cset *cs;
-{
- register uch h = cs->hash;
- register size_t i;
- register cset *top = &p->g->sets[p->g->ncsets];
- register cset *cs2;
- register size_t css = (size_t)p->g->csetsize;
-
- /* look for an earlier one which is the same */
- for (cs2 = &p->g->sets[0]; cs2 < top; cs2++)
- if (cs2->hash == h && cs2 != cs) {
- /* maybe */
- for (i = 0; i < css; i++)
- if (!!CHIN(cs2, i) != !!CHIN(cs, i))
- break; /* no */
- if (i == css)
- break; /* yes */
- }
-
- if (cs2 < top) { /* found one */
- freeset(p, cs);
- cs = cs2;
- }
-
- return((int)(cs - p->g->sets));
-}
-
-/*
- - firstch - return first character in a set (which must have at least one)
- == static int firstch(register struct parse *p, register cset *cs);
- */
-static int /* character; there is no "none" value */
-firstch(p, cs)
-register struct parse *p;
-register cset *cs;
-{
- register size_t i;
- register size_t css = (size_t)p->g->csetsize;
-
- for (i = 0; i < css; i++)
- if (CHIN(cs, i))
- return((char)i);
- assert(never);
- return(0); /* arbitrary */
-}
-
-/*
- - nch - number of characters in a set
- == static int nch(register struct parse *p, register cset *cs);
- */
-static int
-nch(p, cs)
-register struct parse *p;
-register cset *cs;
-{
- register size_t i;
- register size_t css = (size_t)p->g->csetsize;
- register int n = 0;
-
- for (i = 0; i < css; i++)
- if (CHIN(cs, i))
- n++;
- return(n);
-}
-
-/*
- - mcadd - add a collating element to a cset
- == static void mcadd(register struct parse *p, register cset *cs, \
- == register char *cp);
- */
-static void
-mcadd(p, cs, cp)
-register struct parse *p;
-register cset *cs;
-register char *cp;
-{
- register size_t oldend = cs->smultis;
-
- cs->smultis += strlen(cp) + 1;
- if (cs->multis == NULL)
- cs->multis = malloc(cs->smultis);
- else
- cs->multis = realloc(cs->multis, cs->smultis);
- if (cs->multis == NULL) {
- SETERROR(REG_ESPACE);
- return;
- }
-
- (void) strcpy(cs->multis + oldend - 1, cp);
- cs->multis[cs->smultis - 1] = '\0';
-}
-
-#if 0
-/*
- - mcsub - subtract a collating element from a cset
- == static void mcsub(register cset *cs, register char *cp);
- */
-static void
-mcsub(cs, cp)
-register cset *cs;
-register char *cp;
-{
- register char *fp = mcfind(cs, cp);
- register size_t len = strlen(fp);
-
- assert(fp != NULL);
- (void) memmove(fp, fp + len + 1,
- cs->smultis - (fp + len + 1 - cs->multis));
- cs->smultis -= len;
-
- if (cs->smultis == 0) {
- free(cs->multis);
- cs->multis = NULL;
- return;
- }
-
- cs->multis = realloc(cs->multis, cs->smultis);
- assert(cs->multis != NULL);
-}
-
-/*
- - mcin - is a collating element in a cset?
- == static int mcin(register cset *cs, register char *cp);
- */
-static int
-mcin(cs, cp)
-register cset *cs;
-register char *cp;
-{
- return(mcfind(cs, cp) != NULL);
-}
-
-
-/*
- - mcfind - find a collating element in a cset
- == static char *mcfind(register cset *cs, register char *cp);
- */
-static char *
-mcfind(cs, cp)
-register cset *cs;
-register char *cp;
-{
- register char *p;
-
- if (cs->multis == NULL)
- return(NULL);
- for (p = cs->multis; *p != '\0'; p += strlen(p) + 1)
- if (strcmp(cp, p) == 0)
- return(p);
- return(NULL);
-}
-#endif
-
-/*
- - mcinvert - invert the list of collating elements in a cset
- == static void mcinvert(register struct parse *p, register cset *cs);
- *
- * This would have to know the set of possibilities. Implementation
- * is deferred.
- */
-static void
-mcinvert(p, cs)
-register struct parse *p;
-register cset *cs;
-{
- assert(cs->multis == NULL); /* xxx */
-}
-
-/*
- - mccase - add case counterparts of the list of collating elements in a cset
- == static void mccase(register struct parse *p, register cset *cs);
- *
- * This would have to know the set of possibilities. Implementation
- * is deferred.
- */
-static void
-mccase(p, cs)
-register struct parse *p;
-register cset *cs;
-{
- assert(cs->multis == NULL); /* xxx */
-}
-
-/*
- - isinsets - is this character in any sets?
- == static int isinsets(register struct re_guts *g, int c);
- */
-static int /* predicate */
-isinsets(g, c)
-register struct re_guts *g;
-int c;
-{
- register uch *col;
- register int i;
- register int ncols = (g->ncsets+(CHAR_BIT-1)) / CHAR_BIT;
- register unsigned uc = (unsigned char)c;
-
- for (i = 0, col = g->setbits; i < ncols; i++, col += g->csetsize)
- if (col[uc] != 0)
- return(1);
- return(0);
-}
-
-/*
- - samesets - are these two characters in exactly the same sets?
- == static int samesets(register struct re_guts *g, int c1, int c2);
- */
-static int /* predicate */
-samesets(g, c1, c2)
-register struct re_guts *g;
-int c1;
-int c2;
-{
- register uch *col;
- register int i;
- register int ncols = (g->ncsets+(CHAR_BIT-1)) / CHAR_BIT;
- register unsigned uc1 = (unsigned char)c1;
- register unsigned uc2 = (unsigned char)c2;
-
- for (i = 0, col = g->setbits; i < ncols; i++, col += g->csetsize)
- if (col[uc1] != col[uc2])
- return(0);
- return(1);
-}
-
-/*
- - categorize - sort out character categories
- == static void categorize(struct parse *p, register struct re_guts *g);
- */
-static void
-categorize(p, g)
-struct parse *p;
-register struct re_guts *g;
-{
- register cat_t *cats = g->categories;
- register int c;
- register int c2;
- register cat_t cat;
-
- /* avoid making error situations worse */
- if (p->error != 0)
- return;
-
- for (c = CHAR_MIN; c <= CHAR_MAX; c++)
- if (cats[c] == 0 && isinsets(g, c)) {
- cat = g->ncategories++;
- cats[c] = cat;
- for (c2 = c+1; c2 <= CHAR_MAX; c2++)
- if (cats[c2] == 0 && samesets(g, c, c2))
- cats[c2] = cat;
- }
-}
-
-/*
- - dupl - emit a duplicate of a bunch of sops
- == static sopno dupl(register struct parse *p, sopno start, sopno finish);
- */
-static sopno /* start of duplicate */
-dupl(p, start, finish)
-register struct parse *p;
-sopno start; /* from here */
-sopno finish; /* to this less one */
-{
- register sopno ret = HERE();
- register sopno len = finish - start;
-
- assert(finish >= start);
- if (len == 0)
- return(ret);
- enlarge(p, p->ssize + len); /* this many unexpected additions */
- assert(p->ssize >= p->slen + len);
- (void) memcpy((char *)(p->strip + p->slen),
- (char *)(p->strip + start), (size_t)len*sizeof(sop));
- p->slen += len;
- return(ret);
-}
-
-/*
- - doemit - emit a strip operator
- == static void doemit(register struct parse *p, sop op, size_t opnd);
- *
- * It might seem better to implement this as a macro with a function as
- * hard-case backup, but it's just too big and messy unless there are
- * some changes to the data structures. Maybe later.
- */
-static void
-doemit(p, op, opnd)
-register struct parse *p;
-sop op;
-size_t opnd;
-{
- /* avoid making error situations worse */
- if (p->error != 0)
- return;
-
- /* deal with oversize operands ("can't happen", more or less) */
- assert(opnd < 1<<OPSHIFT);
-
- /* deal with undersized strip */
- if (p->slen >= p->ssize)
- enlarge(p, (p->ssize+1) / 2 * 3); /* +50% */
- assert(p->slen < p->ssize);
-
- /* finally, it's all reduced to the easy case */
- p->strip[p->slen++] = SOP(op, opnd);
-}
-
-/*
- - doinsert - insert a sop into the strip
- == static void doinsert(register struct parse *p, sop op, size_t opnd, sopno pos);
- */
-static void
-doinsert(p, op, opnd, pos)
-register struct parse *p;
-sop op;
-size_t opnd;
-sopno pos;
-{
- register sopno sn;
- register sop s;
- register int i;
-
- /* avoid making error situations worse */
- if (p->error != 0)
- return;
-
- sn = HERE();
- EMIT(op, opnd); /* do checks, ensure space */
- assert(HERE() == sn+1);
- s = p->strip[sn];
-
- /* adjust paren pointers */
- assert(pos > 0);
- for (i = 1; i < NPAREN; i++) {
- if (p->pbegin[i] >= pos) {
- p->pbegin[i]++;
- }
- if (p->pend[i] >= pos) {
- p->pend[i]++;
- }
- }
-
- memmove((char *)&p->strip[pos+1], (char *)&p->strip[pos],
- (HERE()-pos-1)*sizeof(sop));
- p->strip[pos] = s;
-}
-
-/*
- - dofwd - complete a forward reference
- == static void dofwd(register struct parse *p, sopno pos, sop value);
- */
-static void
-dofwd(p, pos, value)
-register struct parse *p;
-register sopno pos;
-sop value;
-{
- /* avoid making error situations worse */
- if (p->error != 0)
- return;
-
- assert(value < 1<<OPSHIFT);
- p->strip[pos] = OP(p->strip[pos]) | value;
-}
-
-/*
- - enlarge - enlarge the strip
- == static void enlarge(register struct parse *p, sopno size);
- */
-static void
-enlarge(p, size)
-register struct parse *p;
-register sopno size;
-{
- register sop *sp;
-
- if (p->ssize >= size)
- return;
-
- sp = (sop *)realloc(p->strip, size*sizeof(sop));
- if (sp == NULL) {
- SETERROR(REG_ESPACE);
- return;
- }
- p->strip = sp;
- p->ssize = size;
-}
-
-/*
- - stripsnug - compact the strip
- == static void stripsnug(register struct parse *p, register struct re_guts *g);
- */
-static void
-stripsnug(p, g)
-register struct parse *p;
-register struct re_guts *g;
-{
- g->nstates = p->slen;
- g->strip = (sop *)realloc((char *)p->strip, p->slen * sizeof(sop));
- if (g->strip == NULL) {
- SETERROR(REG_ESPACE);
- g->strip = p->strip;
- }
-}
-
-/*
- - findmust - fill in must and mlen with longest mandatory literal string
- == static void findmust(register struct parse *p, register struct re_guts *g);
- *
- * This algorithm could do fancy things like analyzing the operands of |
- * for common subsequences. Someday. This code is simple and finds most
- * of the interesting cases.
- *
- * Note that must and mlen got initialized during setup.
- */
-static void
-findmust(p, g)
-struct parse *p;
-register struct re_guts *g;
-{
- register sop *scan;
- sop *start = NULL;
- register sop *newstart = NULL;
- register sopno newlen;
- register sop s;
- register char *cp;
- register sopno i;
-
- /* avoid making error situations worse */
- if (p->error != 0)
- return;
-
- /* find the longest OCHAR sequence in strip */
- newlen = 0;
- scan = g->strip + 1;
- do {
- s = *scan++;
- switch (OP(s)) {
- case OCHAR: /* sequence member */
- if (newlen == 0) /* new sequence */
- newstart = scan - 1;
- newlen++;
- break;
- case OPLUS_: /* things that don't break one */
- case OLPAREN:
- case ORPAREN:
- break;
- case OQUEST_: /* things that must be skipped */
- case OCH_:
- scan--;
- do {
- scan += OPND(s);
- s = *scan;
- /* assert() interferes w debug printouts */
- if (OP(s) != O_QUEST && OP(s) != O_CH &&
- OP(s) != OOR2) {
- g->iflags |= BAD;
- return;
- }
- } while (OP(s) != O_QUEST && OP(s) != O_CH);
- /* fallthrough */
- default: /* things that break a sequence */
- if (newlen > g->mlen) { /* ends one */
- start = newstart;
- g->mlen = newlen;
- }
- newlen = 0;
- break;
- }
- } while (OP(s) != OEND);
-
- if (g->mlen == 0) /* there isn't one */
- return;
-
- /* turn it into a character string */
- g->must = malloc((size_t)g->mlen + 1);
- if (g->must == NULL) { /* argh; just forget it */
- g->mlen = 0;
- return;
- }
- cp = g->must;
- scan = start;
- for (i = g->mlen; i > 0; i--) {
- while (OP(s = *scan++) != OCHAR)
- continue;
- assert(cp < g->must + g->mlen);
- *cp++ = (char)OPND(s);
- }
- assert(cp == g->must + g->mlen);
- *cp++ = '\0'; /* just on general principles */
-}
-
-/*
- - pluscount - count + nesting
- == static sopno pluscount(register struct parse *p, register struct re_guts *g);
- */
-static sopno /* nesting depth */
-pluscount(p, g)
-struct parse *p;
-register struct re_guts *g;
-{
- register sop *scan;
- register sop s;
- register sopno plusnest = 0;
- register sopno maxnest = 0;
-
- if (p->error != 0)
- return(0); /* there may not be an OEND */
-
- scan = g->strip + 1;
- do {
- s = *scan++;
- switch (OP(s)) {
- case OPLUS_:
- plusnest++;
- break;
- case O_PLUS:
- if (plusnest > maxnest)
- maxnest = plusnest;
- plusnest--;
- break;
- }
- } while (OP(s) != OEND);
- if (plusnest != 0)
- g->iflags |= BAD;
- return(maxnest);
-}
diff --git a/regex/regcomp.ih b/regex/regcomp.ih
deleted file mode 100644
index 6efafebf60..0000000000
--- a/regex/regcomp.ih
+++ /dev/null
@@ -1,53 +0,0 @@
-/* ========= begin header generated by ./mkh ========= */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* === regcomp.c === */
-static void p_ere(register struct parse *p, int stop);
-static void p_ere_exp(register struct parse *p);
-static void p_str(register struct parse *p);
-static void p_bre(register struct parse *p, register int end1, register int end2);
-static int p_simp_re(register struct parse *p, int starordinary);
-static int p_count(register struct parse *p);
-static void p_bracket(register struct parse *p);
-static void p_b_term(register struct parse *p, register cset *cs);
-static void p_b_cclass(register struct parse *p, register cset *cs);
-static void p_b_eclass(register struct parse *p, register cset *cs);
-static char p_b_symbol(register struct parse *p);
-static char p_b_coll_elem(register struct parse *p, int endc);
-static char othercase(int ch);
-static void bothcases(register struct parse *p, int ch);
-static void ordinary(register struct parse *p, register int ch);
-static void nonnewline(register struct parse *p);
-static void repeat(register struct parse *p, sopno start, int from, int to);
-static int seterr(register struct parse *p, int e);
-static cset *allocset(register struct parse *p);
-static void freeset(register struct parse *p, register cset *cs);
-static int freezeset(register struct parse *p, register cset *cs);
-static int firstch(register struct parse *p, register cset *cs);
-static int nch(register struct parse *p, register cset *cs);
-static void mcadd(register struct parse *p, register cset *cs, register char *cp);
-#if 0
-static void mcsub(register cset *cs, register char *cp);
-static int mcin(register cset *cs, register char *cp);
-static char *mcfind(register cset *cs, register char *cp);
-#endif
-static void mcinvert(register struct parse *p, register cset *cs);
-static void mccase(register struct parse *p, register cset *cs);
-static int isinsets(register struct re_guts *g, int c);
-static int samesets(register struct re_guts *g, int c1, int c2);
-static void categorize(struct parse *p, register struct re_guts *g);
-static sopno dupl(register struct parse *p, sopno start, sopno finish);
-static void doemit(register struct parse *p, sop op, size_t opnd);
-static void doinsert(register struct parse *p, sop op, size_t opnd, sopno pos);
-static void dofwd(register struct parse *p, sopno pos, sop value);
-static void enlarge(register struct parse *p, sopno size);
-static void stripsnug(register struct parse *p, register struct re_guts *g);
-static void findmust(register struct parse *p, register struct re_guts *g);
-static sopno pluscount(register struct parse *p, register struct re_guts *g);
-
-#ifdef __cplusplus
-}
-#endif
-/* ========= end header generated by ./mkh ========= */
diff --git a/regex/regerror.c b/regex/regerror.c
deleted file mode 100644
index bf71e3a814..0000000000
--- a/regex/regerror.c
+++ /dev/null
@@ -1,126 +0,0 @@
-#include <sys/types.h>
-#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
-#include <limits.h>
-#include <stdlib.h>
-#include <regex.h>
-
-#include "utils.h"
-#include "regerror.ih"
-
-/*
- = #define REG_OKAY 0
- = #define REG_NOMATCH 1
- = #define REG_BADPAT 2
- = #define REG_ECOLLATE 3
- = #define REG_ECTYPE 4
- = #define REG_EESCAPE 5
- = #define REG_ESUBREG 6
- = #define REG_EBRACK 7
- = #define REG_EPAREN 8
- = #define REG_EBRACE 9
- = #define REG_BADBR 10
- = #define REG_ERANGE 11
- = #define REG_ESPACE 12
- = #define REG_BADRPT 13
- = #define REG_EMPTY 14
- = #define REG_ASSERT 15
- = #define REG_INVARG 16
- = #define REG_ATOI 255 // convert name to number (!)
- = #define REG_ITOA 0400 // convert number to name (!)
- */
-static struct rerr {
- int code;
- char *name;
- char *explain;
-} rerrs[] = {
- {REG_OKAY, "REG_OKAY", "no errors detected"},
- {REG_NOMATCH, "REG_NOMATCH", "regexec() failed to match"},
- {REG_BADPAT, "REG_BADPAT", "invalid regular expression"},
- {REG_ECOLLATE, "REG_ECOLLATE", "invalid collating element"},
- {REG_ECTYPE, "REG_ECTYPE", "invalid character class"},
- {REG_EESCAPE, "REG_EESCAPE", "trailing backslash (\\)"},
- {REG_ESUBREG, "REG_ESUBREG", "invalid backreference number"},
- {REG_EBRACK, "REG_EBRACK", "brackets ([ ]) not balanced"},
- {REG_EPAREN, "REG_EPAREN", "parentheses not balanced"},
- {REG_EBRACE, "REG_EBRACE", "braces not balanced"},
- {REG_BADBR, "REG_BADBR", "invalid repetition count(s)"},
- {REG_ERANGE, "REG_ERANGE", "invalid character range"},
- {REG_ESPACE, "REG_ESPACE", "out of memory"},
- {REG_BADRPT, "REG_BADRPT", "repetition-operator operand invalid"},
- {REG_EMPTY, "REG_EMPTY", "empty (sub)expression"},
- {REG_ASSERT, "REG_ASSERT", "\"can't happen\" -- you found a bug"},
- {REG_INVARG, "REG_INVARG", "invalid argument to regex routine"},
- {-1, "", "*** unknown regexp error code ***"},
-};
-
-/*
- - regerror - the interface to error numbers
- = API_EXPORT(size_t) regerror(int, const regex_t *, char *, size_t);
- */
-/* ARGSUSED */
-API_EXPORT(size_t)
-regerror(errcode, preg, errbuf, errbuf_size)
-int errcode;
-const regex_t *preg;
-char *errbuf;
-size_t errbuf_size;
-{
- register struct rerr *r;
- register size_t len;
- register int target = errcode &~ REG_ITOA;
- register char *s;
- char convbuf[50];
-
- if (errcode == REG_ATOI)
- s = regatoi(preg, convbuf);
- else {
- for (r = rerrs; r->code >= 0; r++)
- if (r->code == target)
- break;
-
- if (errcode&REG_ITOA) {
- if (r->code >= 0)
- (void) strcpy(convbuf, r->name);
- else
- sprintf(convbuf, "REG_0x%x", target);
- assert(strlen(convbuf) < sizeof(convbuf));
- s = convbuf;
- } else
- s = r->explain;
- }
-
- len = strlen(s) + 1;
- if (errbuf_size > 0) {
- if (errbuf_size > len)
- (void) strcpy(errbuf, s);
- else {
- (void) strncpy(errbuf, s, errbuf_size-1);
- errbuf[errbuf_size-1] = '\0';
- }
- }
-
- return(len);
-}
-
-/*
- - regatoi - internal routine to implement REG_ATOI
- == static char *regatoi(const regex_t *preg, char *localbuf);
- */
-static char *
-regatoi(preg, localbuf)
-const regex_t *preg;
-char *localbuf;
-{
- register struct rerr *r;
-
- for (r = rerrs; r->code >= 0; r++)
- if (strcmp(r->name, preg->re_endp) == 0)
- break;
- if (r->code < 0)
- return("0");
-
- sprintf(localbuf, "%d", r->code);
- return(localbuf);
-}
diff --git a/regex/regerror.ih b/regex/regerror.ih
deleted file mode 100644
index 2cb668c24f..0000000000
--- a/regex/regerror.ih
+++ /dev/null
@@ -1,12 +0,0 @@
-/* ========= begin header generated by ./mkh ========= */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* === regerror.c === */
-static char *regatoi(const regex_t *preg, char *localbuf);
-
-#ifdef __cplusplus
-}
-#endif
-/* ========= end header generated by ./mkh ========= */
diff --git a/regex/regex.3 b/regex/regex.3
deleted file mode 100644
index 100c8a7f71..0000000000
--- a/regex/regex.3
+++ /dev/null
@@ -1,502 +0,0 @@
-.TH REGEX 3 "17 May 1993"
-.BY "Henry Spencer"
-.de ZR
-.\" one other place knows this name: the SEE ALSO section
-.IR regex (7) \\$1
-..
-.SH NAME
-regcomp, regexec, regerror, regfree \- regular-expression library
-.SH SYNOPSIS
-.ft B
-.\".na
-#include <sys/types.h>
-.br
-#include <regex.h>
-.HP 10
-int regcomp(regex_t\ *preg, const\ char\ *pattern, int\ cflags);
-.HP
-int\ regexec(const\ regex_t\ *preg, const\ char\ *string,
-size_t\ nmatch, regmatch_t\ pmatch[], int\ eflags);
-.HP
-size_t\ regerror(int\ errcode, const\ regex_t\ *preg,
-char\ *errbuf, size_t\ errbuf_size);
-.HP
-void\ regfree(regex_t\ *preg);
-.\".ad
-.ft
-.SH DESCRIPTION
-These routines implement POSIX 1003.2 regular expressions (``RE''s);
-see
-.ZR .
-.I Regcomp
-compiles an RE written as a string into an internal form,
-.I regexec
-matches that internal form against a string and reports results,
-.I regerror
-transforms error codes from either into human-readable messages,
-and
-.I regfree
-frees any dynamically-allocated storage used by the internal form
-of an RE.
-.PP
-The header
-.I <regex.h>
-declares two structure types,
-.I regex_t
-and
-.IR regmatch_t ,
-the former for compiled internal forms and the latter for match reporting.
-It also declares the four functions,
-a type
-.IR regoff_t ,
-and a number of constants with names starting with ``REG_''.
-.PP
-.I Regcomp
-compiles the regular expression contained in the
-.I pattern
-string,
-subject to the flags in
-.IR cflags ,
-and places the results in the
-.I regex_t
-structure pointed to by
-.IR preg .
-.I Cflags
-is the bitwise OR of zero or more of the following flags:
-.IP REG_EXTENDED \w'REG_EXTENDED'u+2n
-Compile modern (``extended'') REs,
-rather than the obsolete (``basic'') REs that
-are the default.
-.IP REG_BASIC
-This is a synonym for 0,
-provided as a counterpart to REG_EXTENDED to improve readability.
-.IP REG_NOSPEC
-Compile with recognition of all special characters turned off.
-All characters are thus considered ordinary,
-so the ``RE'' is a literal string.
-This is an extension,
-compatible with but not specified by POSIX 1003.2,
-and should be used with
-caution in software intended to be portable to other systems.
-REG_EXTENDED and REG_NOSPEC may not be used
-in the same call to
-.IR regcomp .
-.IP REG_ICASE
-Compile for matching that ignores upper/lower case distinctions.
-See
-.ZR .
-.IP REG_NOSUB
-Compile for matching that need only report success or failure,
-not what was matched.
-.IP REG_NEWLINE
-Compile for newline-sensitive matching.
-By default, newline is a completely ordinary character with no special
-meaning in either REs or strings.
-With this flag,
-`[^' bracket expressions and `.' never match newline,
-a `^' anchor matches the null string after any newline in the string
-in addition to its normal function,
-and the `$' anchor matches the null string before any newline in the
-string in addition to its normal function.
-.IP REG_PEND
-The regular expression ends,
-not at the first NUL,
-but just before the character pointed to by the
-.I re_endp
-member of the structure pointed to by
-.IR preg .
-The
-.I re_endp
-member is of type
-.IR const\ char\ * .
-This flag permits inclusion of NULs in the RE;
-they are considered ordinary characters.
-This is an extension,
-compatible with but not specified by POSIX 1003.2,
-and should be used with
-caution in software intended to be portable to other systems.
-.PP
-When successful,
-.I regcomp
-returns 0 and fills in the structure pointed to by
-.IR preg .
-One member of that structure
-(other than
-.IR re_endp )
-is publicized:
-.IR re_nsub ,
-of type
-.IR size_t ,
-contains the number of parenthesized subexpressions within the RE
-(except that the value of this member is undefined if the
-REG_NOSUB flag was used).
-If
-.I regcomp
-fails, it returns a non-zero error code;
-see DIAGNOSTICS.
-.PP
-.I Regexec
-matches the compiled RE pointed to by
-.I preg
-against the
-.IR string ,
-subject to the flags in
-.IR eflags ,
-and reports results using
-.IR nmatch ,
-.IR pmatch ,
-and the returned value.
-The RE must have been compiled by a previous invocation of
-.IR regcomp .
-The compiled form is not altered during execution of
-.IR regexec ,
-so a single compiled RE can be used simultaneously by multiple threads.
-.PP
-By default,
-the NUL-terminated string pointed to by
-.I string
-is considered to be the text of an entire line, minus any terminating
-newline.
-The
-.I eflags
-argument is the bitwise OR of zero or more of the following flags:
-.IP REG_NOTBOL \w'REG_STARTEND'u+2n
-The first character of
-the string
-is not the beginning of a line, so the `^' anchor should not match before it.
-This does not affect the behavior of newlines under REG_NEWLINE.
-.IP REG_NOTEOL
-The NUL terminating
-the string
-does not end a line, so the `$' anchor should not match before it.
-This does not affect the behavior of newlines under REG_NEWLINE.
-.IP REG_STARTEND
-The string is considered to start at
-\fIstring\fR\ + \fIpmatch\fR[0].\fIrm_so\fR
-and to have a terminating NUL located at
-\fIstring\fR\ + \fIpmatch\fR[0].\fIrm_eo\fR
-(there need not actually be a NUL at that location),
-regardless of the value of
-.IR nmatch .
-See below for the definition of
-.IR pmatch
-and
-.IR nmatch .
-This is an extension,
-compatible with but not specified by POSIX 1003.2,
-and should be used with
-caution in software intended to be portable to other systems.
-Note that a non-zero \fIrm_so\fR does not imply REG_NOTBOL;
-REG_STARTEND affects only the location of the string,
-not how it is matched.
-.PP
-See
-.ZR
-for a discussion of what is matched in situations where an RE or a
-portion thereof could match any of several substrings of
-.IR string .
-.PP
-Normally,
-.I regexec
-returns 0 for success and the non-zero code REG_NOMATCH for failure.
-Other non-zero error codes may be returned in exceptional situations;
-see DIAGNOSTICS.
-.PP
-If REG_NOSUB was specified in the compilation of the RE,
-or if
-.I nmatch
-is 0,
-.I regexec
-ignores the
-.I pmatch
-argument (but see below for the case where REG_STARTEND is specified).
-Otherwise,
-.I pmatch
-points to an array of
-.I nmatch
-structures of type
-.IR regmatch_t .
-Such a structure has at least the members
-.I rm_so
-and
-.IR rm_eo ,
-both of type
-.I regoff_t
-(a signed arithmetic type at least as large as an
-.I off_t
-and a
-.IR ssize_t ),
-containing respectively the offset of the first character of a substring
-and the offset of the first character after the end of the substring.
-Offsets are measured from the beginning of the
-.I string
-argument given to
-.IR regexec .
-An empty substring is denoted by equal offsets,
-both indicating the character following the empty substring.
-.PP
-The 0th member of the
-.I pmatch
-array is filled in to indicate what substring of
-.I string
-was matched by the entire RE.
-Remaining members report what substring was matched by parenthesized
-subexpressions within the RE;
-member
-.I i
-reports subexpression
-.IR i ,
-with subexpressions counted (starting at 1) by the order of their opening
-parentheses in the RE, left to right.
-Unused entries in the array\(emcorresponding either to subexpressions that
-did not participate in the match at all, or to subexpressions that do not
-exist in the RE (that is, \fIi\fR\ > \fIpreg\fR\->\fIre_nsub\fR)\(emhave both
-.I rm_so
-and
-.I rm_eo
-set to \-1.
-If a subexpression participated in the match several times,
-the reported substring is the last one it matched.
-(Note, as an example in particular, that when the RE `(b*)+' matches `bbb',
-the parenthesized subexpression matches each of the three `b's and then
-an infinite number of empty strings following the last `b',
-so the reported substring is one of the empties.)
-.PP
-If REG_STARTEND is specified,
-.I pmatch
-must point to at least one
-.I regmatch_t
-(even if
-.I nmatch
-is 0 or REG_NOSUB was specified),
-to hold the input offsets for REG_STARTEND.
-Use for output is still entirely controlled by
-.IR nmatch ;
-if
-.I nmatch
-is 0 or REG_NOSUB was specified,
-the value of
-.IR pmatch [0]
-will not be changed by a successful
-.IR regexec .
-.PP
-.I Regerror
-maps a non-zero
-.I errcode
-from either
-.I regcomp
-or
-.I regexec
-to a human-readable, printable message.
-If
-.I preg
-is non-NULL,
-the error code should have arisen from use of
-the
-.I regex_t
-pointed to by
-.IR preg ,
-and if the error code came from
-.IR regcomp ,
-it should have been the result from the most recent
-.I regcomp
-using that
-.IR regex_t .
-.RI ( Regerror
-may be able to supply a more detailed message using information
-from the
-.IR regex_t .)
-.I Regerror
-places the NUL-terminated message into the buffer pointed to by
-.IR errbuf ,
-limiting the length (including the NUL) to at most
-.I errbuf_size
-bytes.
-If the whole message won't fit,
-as much of it as will fit before the terminating NUL is supplied.
-In any case,
-the returned value is the size of buffer needed to hold the whole
-message (including terminating NUL).
-If
-.I errbuf_size
-is 0,
-.I errbuf
-is ignored but the return value is still correct.
-.PP
-If the
-.I errcode
-given to
-.I regerror
-is first ORed with REG_ITOA,
-the ``message'' that results is the printable name of the error code,
-e.g. ``REG_NOMATCH'',
-rather than an explanation thereof.
-If
-.I errcode
-is REG_ATOI,
-then
-.I preg
-shall be non-NULL and the
-.I re_endp
-member of the structure it points to
-must point to the printable name of an error code;
-in this case, the result in
-.I errbuf
-is the decimal digits of
-the numeric value of the error code
-(0 if the name is not recognized).
-REG_ITOA and REG_ATOI are intended primarily as debugging facilities;
-they are extensions,
-compatible with but not specified by POSIX 1003.2,
-and should be used with
-caution in software intended to be portable to other systems.
-Be warned also that they are considered experimental and changes are possible.
-.PP
-.I Regfree
-frees any dynamically-allocated storage associated with the compiled RE
-pointed to by
-.IR preg .
-The remaining
-.I regex_t
-is no longer a valid compiled RE
-and the effect of supplying it to
-.I regexec
-or
-.I regerror
-is undefined.
-.PP
-None of these functions references global variables except for tables
-of constants;
-all are safe for use from multiple threads if the arguments are safe.
-.SH IMPLEMENTATION CHOICES
-There are a number of decisions that 1003.2 leaves up to the implementor,
-either by explicitly saying ``undefined'' or by virtue of them being
-forbidden by the RE grammar.
-This implementation treats them as follows.
-.PP
-See
-.ZR
-for a discussion of the definition of case-independent matching.
-.PP
-There is no particular limit on the length of REs,
-except insofar as memory is limited.
-Memory usage is approximately linear in RE size, and largely insensitive
-to RE complexity, except for bounded repetitions.
-See BUGS for one short RE using them
-that will run almost any system out of memory.
-.PP
-A backslashed character other than one specifically given a magic meaning
-by 1003.2 (such magic meanings occur only in obsolete [``basic''] REs)
-is taken as an ordinary character.
-.PP
-Any unmatched [ is a REG_EBRACK error.
-.PP
-Equivalence classes cannot begin or end bracket-expression ranges.
-The endpoint of one range cannot begin another.
-.PP
-RE_DUP_MAX, the limit on repetition counts in bounded repetitions, is 255.
-.PP
-A repetition operator (?, *, +, or bounds) cannot follow another
-repetition operator.
-A repetition operator cannot begin an expression or subexpression
-or follow `^' or `|'.
-.PP
-`|' cannot appear first or last in a (sub)expression or after another `|',
-i.e. an operand of `|' cannot be an empty subexpression.
-An empty parenthesized subexpression, `()', is legal and matches an
-empty (sub)string.
-An empty string is not a legal RE.
-.PP
-A `{' followed by a digit is considered the beginning of bounds for a
-bounded repetition, which must then follow the syntax for bounds.
-A `{' \fInot\fR followed by a digit is considered an ordinary character.
-.PP
-`^' and `$' beginning and ending subexpressions in obsolete (``basic'')
-REs are anchors, not ordinary characters.
-.SH SEE ALSO
-grep(1), regex(7)
-.PP
-POSIX 1003.2, sections 2.8 (Regular Expression Notation)
-and
-B.5 (C Binding for Regular Expression Matching).
-.SH DIAGNOSTICS
-Non-zero error codes from
-.I regcomp
-and
-.I regexec
-include the following:
-.PP
-.nf
-.ta \w'REG_ECOLLATE'u+3n
-REG_NOMATCH regexec() failed to match
-REG_BADPAT invalid regular expression
-REG_ECOLLATE invalid collating element
-REG_ECTYPE invalid character class
-REG_EESCAPE \e applied to unescapable character
-REG_ESUBREG invalid backreference number
-REG_EBRACK brackets [ ] not balanced
-REG_EPAREN parentheses ( ) not balanced
-REG_EBRACE braces { } not balanced
-REG_BADBR invalid repetition count(s) in { }
-REG_ERANGE invalid character range in [ ]
-REG_ESPACE ran out of memory
-REG_BADRPT ?, *, or + operand invalid
-REG_EMPTY empty (sub)expression
-REG_ASSERT ``can't happen''\(emyou found a bug
-REG_INVARG invalid argument, e.g. negative-length string
-.fi
-.SH HISTORY
-Written by Henry Spencer at University of Toronto,
-henry@zoo.toronto.edu.
-.SH BUGS
-This is an alpha release with known defects.
-Please report problems.
-.PP
-There is one known functionality bug.
-The implementation of internationalization is incomplete:
-the locale is always assumed to be the default one of 1003.2,
-and only the collating elements etc. of that locale are available.
-.PP
-The back-reference code is subtle and doubts linger about its correctness
-in complex cases.
-.PP
-.I Regexec
-performance is poor.
-This will improve with later releases.
-.I Nmatch
-exceeding 0 is expensive;
-.I nmatch
-exceeding 1 is worse.
-.I Regexec
-is largely insensitive to RE complexity \fIexcept\fR that back
-references are massively expensive.
-RE length does matter; in particular, there is a strong speed bonus
-for keeping RE length under about 30 characters,
-with most special characters counting roughly double.
-.PP
-.I Regcomp
-implements bounded repetitions by macro expansion,
-which is costly in time and space if counts are large
-or bounded repetitions are nested.
-An RE like, say,
-`((((a{1,100}){1,100}){1,100}){1,100}){1,100}'
-will (eventually) run almost any existing machine out of swap space.
-.PP
-There are suspected problems with response to obscure error conditions.
-Notably,
-certain kinds of internal overflow,
-produced only by truly enormous REs or by multiply nested bounded repetitions,
-are probably not handled well.
-.PP
-Due to a mistake in 1003.2, things like `a)b' are legal REs because `)' is
-a special character only in the presence of a previous unmatched `('.
-This can't be fixed until the spec is fixed.
-.PP
-The standard's definition of back references is vague.
-For example, does
-`a\e(\e(b\e)*\e2\e)*d' match `abbbd'?
-Until the standard is clarified,
-behavior in such cases should not be relied on.
-.PP
-The implementation of word-boundary matching is a bit of a kludge,
-and bugs may lurk in combinations of word-boundary matching and anchoring.
diff --git a/regex/regex.7 b/regex/regex.7
deleted file mode 100644
index d89012bda1..0000000000
--- a/regex/regex.7
+++ /dev/null
@@ -1,233 +0,0 @@
-.TH REGEX 7 "7 Feb 1994"
-.BY "Henry Spencer"
-.SH NAME
-regex \- POSIX 1003.2 regular expressions
-.SH DESCRIPTION
-Regular expressions (``RE''s),
-as defined in POSIX 1003.2, come in two forms:
-modern REs (roughly those of
-.IR egrep ;
-1003.2 calls these ``extended'' REs)
-and obsolete REs (roughly those of
-.IR ed ;
-1003.2 ``basic'' REs).
-Obsolete REs mostly exist for backward compatibility in some old programs;
-they will be discussed at the end.
-1003.2 leaves some aspects of RE syntax and semantics open;
-`\(dg' marks decisions on these aspects that
-may not be fully portable to other 1003.2 implementations.
-.PP
-A (modern) RE is one\(dg or more non-empty\(dg \fIbranches\fR,
-separated by `|'.
-It matches anything that matches one of the branches.
-.PP
-A branch is one\(dg or more \fIpieces\fR, concatenated.
-It matches a match for the first, followed by a match for the second, etc.
-.PP
-A piece is an \fIatom\fR possibly followed
-by a single\(dg `*', `+', `?', or \fIbound\fR.
-An atom followed by `*' matches a sequence of 0 or more matches of the atom.
-An atom followed by `+' matches a sequence of 1 or more matches of the atom.
-An atom followed by `?' matches a sequence of 0 or 1 matches of the atom.
-.PP
-A \fIbound\fR is `{' followed by an unsigned decimal integer,
-possibly followed by `,'
-possibly followed by another unsigned decimal integer,
-always followed by `}'.
-The integers must lie between 0 and RE_DUP_MAX (255\(dg) inclusive,
-and if there are two of them, the first may not exceed the second.
-An atom followed by a bound containing one integer \fIi\fR
-and no comma matches
-a sequence of exactly \fIi\fR matches of the atom.
-An atom followed by a bound
-containing one integer \fIi\fR and a comma matches
-a sequence of \fIi\fR or more matches of the atom.
-An atom followed by a bound
-containing two integers \fIi\fR and \fIj\fR matches
-a sequence of \fIi\fR through \fIj\fR (inclusive) matches of the atom.
-.PP
-An atom is a regular expression enclosed in `()' (matching a match for the
-regular expression),
-an empty set of `()' (matching the null string)\(dg,
-a \fIbracket expression\fR (see below), `.'
-(matching any single character), `^' (matching the null string at the
-beginning of a line), `$' (matching the null string at the
-end of a line), a `\e' followed by one of the characters
-`^.[$()|*+?{\e'
-(matching that character taken as an ordinary character),
-a `\e' followed by any other character\(dg
-(matching that character taken as an ordinary character,
-as if the `\e' had not been present\(dg),
-or a single character with no other significance (matching that character).
-A `{' followed by a character other than a digit is an ordinary
-character, not the beginning of a bound\(dg.
-It is illegal to end an RE with `\e'.
-.PP
-A \fIbracket expression\fR is a list of characters enclosed in `[]'.
-It normally matches any single character from the list (but see below).
-If the list begins with `^',
-it matches any single character
-(but see below) \fInot\fR from the rest of the list.
-If two characters in the list are separated by `\-', this is shorthand
-for the full \fIrange\fR of characters between those two (inclusive) in the
-collating sequence,
-e.g. `[0-9]' in ASCII matches any decimal digit.
-It is illegal\(dg for two ranges to share an
-endpoint, e.g. `a-c-e'.
-Ranges are very collating-sequence-dependent,
-and portable programs should avoid relying on them.
-.PP
-To include a literal `]' in the list, make it the first character
-(following a possible `^').
-To include a literal `\-', make it the first or last character,
-or the second endpoint of a range.
-To use a literal `\-' as the first endpoint of a range,
-enclose it in `[.' and `.]' to make it a collating element (see below).
-With the exception of these and some combinations using `[' (see next
-paragraphs), all other special characters, including `\e', lose their
-special significance within a bracket expression.
-.PP
-Within a bracket expression, a collating element (a character,
-a multi-character sequence that collates as if it were a single character,
-or a collating-sequence name for either)
-enclosed in `[.' and `.]' stands for the
-sequence of characters of that collating element.
-The sequence is a single element of the bracket expression's list.
-A bracket expression containing a multi-character collating element
-can thus match more than one character,
-e.g. if the collating sequence includes a `ch' collating element,
-then the RE `[[.ch.]]*c' matches the first five characters
-of `chchcc'.
-.PP
-Within a bracket expression, a collating element enclosed in `[=' and
-`=]' is an equivalence class, standing for the sequences of characters
-of all collating elements equivalent to that one, including itself.
-(If there are no other equivalent collating elements,
-the treatment is as if the enclosing delimiters were `[.' and `.]'.)
-For example, if o and \o'o^' are the members of an equivalence class,
-then `[[=o=]]', `[[=\o'o^'=]]', and `[o\o'o^']' are all synonymous.
-An equivalence class may not\(dg be an endpoint
-of a range.
-.PP
-Within a bracket expression, the name of a \fIcharacter class\fR enclosed
-in `[:' and `:]' stands for the list of all characters belonging to that
-class.
-Standard character class names are:
-.PP
-.RS
-.nf
-.ta 3c 6c 9c
-alnum digit punct
-alpha graph space
-blank lower upper
-cntrl print xdigit
-.fi
-.RE
-.PP
-These stand for the character classes defined in
-.IR ctype (3).
-A locale may provide others.
-A character class may not be used as an endpoint of a range.
-.PP
-There are two special cases\(dg of bracket expressions:
-the bracket expressions `[[:<:]]' and `[[:>:]]' match the null string at
-the beginning and end of a word respectively.
-A word is defined as a sequence of
-word characters
-which is neither preceded nor followed by
-word characters.
-A word character is an
-.I alnum
-character (as defined by
-.IR ctype (3))
-or an underscore.
-This is an extension,
-compatible with but not specified by POSIX 1003.2,
-and should be used with
-caution in software intended to be portable to other systems.
-.PP
-In the event that an RE could match more than one substring of a given
-string,
-the RE matches the one starting earliest in the string.
-If the RE could match more than one substring starting at that point,
-it matches the longest.
-Subexpressions also match the longest possible substrings, subject to
-the constraint that the whole match be as long as possible,
-with subexpressions starting earlier in the RE taking priority over
-ones starting later.
-Note that higher-level subexpressions thus take priority over
-their lower-level component subexpressions.
-.PP
-Match lengths are measured in characters, not collating elements.
-A null string is considered longer than no match at all.
-For example,
-`bb*' matches the three middle characters of `abbbc',
-`(wee|week)(knights|nights)' matches all ten characters of `weeknights',
-when `(.*).*' is matched against `abc' the parenthesized subexpression
-matches all three characters, and
-when `(a*)*' is matched against `bc' both the whole RE and the parenthesized
-subexpression match the null string.
-.PP
-If case-independent matching is specified,
-the effect is much as if all case distinctions had vanished from the
-alphabet.
-When an alphabetic that exists in multiple cases appears as an
-ordinary character outside a bracket expression, it is effectively
-transformed into a bracket expression containing both cases,
-e.g. `x' becomes `[xX]'.
-When it appears inside a bracket expression, all case counterparts
-of it are added to the bracket expression, so that (e.g.) `[x]'
-becomes `[xX]' and `[^x]' becomes `[^xX]'.
-.PP
-No particular limit is imposed on the length of REs\(dg.
-Programs intended to be portable should not employ REs longer
-than 256 bytes,
-as an implementation can refuse to accept such REs and remain
-POSIX-compliant.
-.PP
-Obsolete (``basic'') regular expressions differ in several respects.
-`|', `+', and `?' are ordinary characters and there is no equivalent
-for their functionality.
-The delimiters for bounds are `\e{' and `\e}',
-with `{' and `}' by themselves ordinary characters.
-The parentheses for nested subexpressions are `\e(' and `\e)',
-with `(' and `)' by themselves ordinary characters.
-`^' is an ordinary character except at the beginning of the
-RE or\(dg the beginning of a parenthesized subexpression,
-`$' is an ordinary character except at the end of the
-RE or\(dg the end of a parenthesized subexpression,
-and `*' is an ordinary character if it appears at the beginning of the
-RE or the beginning of a parenthesized subexpression
-(after a possible leading `^').
-Finally, there is one new type of atom, a \fIback reference\fR:
-`\e' followed by a non-zero decimal digit \fId\fR
-matches the same sequence of characters
-matched by the \fId\fRth parenthesized subexpression
-(numbering subexpressions by the positions of their opening parentheses,
-left to right),
-so that (e.g.) `\e([bc]\e)\e1' matches `bb' or `cc' but not `bc'.
-.SH SEE ALSO
-regex(3)
-.PP
-POSIX 1003.2, section 2.8 (Regular Expression Notation).
-.SH BUGS
-Having two kinds of REs is a botch.
-.PP
-The current 1003.2 spec says that `)' is an ordinary character in
-the absence of an unmatched `(';
-this was an unintentional result of a wording error,
-and change is likely.
-Avoid relying on it.
-.PP
-Back references are a dreadful botch,
-posing major problems for efficient implementations.
-They are also somewhat vaguely defined
-(does
-`a\e(\e(b\e)*\e2\e)*d' match `abbbd'?).
-Avoid using them.
-.PP
-1003.2's specification of case-independent matching is vague.
-The ``one case implies all cases'' definition given above
-is current consensus among implementors as to the right interpretation.
-.PP
-The syntax for word boundaries is incredibly ugly.
diff --git a/regex/regex.dsp b/regex/regex.dsp
deleted file mode 100644
index e8f1ad4299..0000000000
--- a/regex/regex.dsp
+++ /dev/null
@@ -1,106 +0,0 @@
-# Microsoft Developer Studio Project File - Name="regex" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 5.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=regex - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "regex.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "regex.mak" CFG="regex - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "regex - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "regex - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "regex - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
-# ADD CPP /nologo /MT /W3 /GX /O2 /I "." /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386
-
-!ELSEIF "$(CFG)" == "regex - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
-# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "." /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept
-
-!ENDIF
-
-# Begin Target
-
-# Name "regex - Win32 Release"
-# Name "regex - Win32 Debug"
-# Begin Source File
-
-SOURCE=.\regcomp.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\regerror.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\regexec.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\regfree.c
-# End Source File
-# End Target
-# End Project
diff --git a/regex/regex.dsw b/regex/regex.dsw
deleted file mode 100644
index 7b7df8126c..0000000000
--- a/regex/regex.dsw
+++ /dev/null
@@ -1,29 +0,0 @@
-Microsoft Developer Studio Workspace File, Format Version 5.00
-# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
-
-###############################################################################
-
-Project: "regex"=.\regex.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Global:
-
-Package=<5>
-{{{
-}}}
-
-Package=<3>
-{{{
-}}}
-
-###############################################################################
-
diff --git a/regex/regex.h b/regex/regex.h
deleted file mode 100644
index b39c5e178c..0000000000
--- a/regex/regex.h
+++ /dev/null
@@ -1,83 +0,0 @@
-#ifndef _HSREGEX_H_
-#define _HSREGEX_H_
-#ifndef _HSREGEX_H
-#define _HSREGEX_H /* never again */
-/* ========= begin header generated by ././mkh ========= */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* === regex2.h === */
-#ifdef WIN32
-#define API_EXPORT(type) __declspec(dllexport) type __stdcall
-#else
-#define API_EXPORT(type) type
-#endif
-
-typedef off_t regoff_t;
-typedef struct {
- int re_magic;
- size_t re_nsub; /* number of parenthesized subexpressions */
- const char *re_endp; /* end pointer for REG_PEND */
- struct re_guts *re_g; /* none of your business :-) */
-} regex_t;
-typedef struct {
- regoff_t rm_so; /* start of match */
- regoff_t rm_eo; /* end of match */
-} regmatch_t;
-
-
-/* === regcomp.c === */
-API_EXPORT(int) regcomp(regex_t *, const char *, int);
-#define REG_BASIC 0000
-#define REG_EXTENDED 0001
-#define REG_ICASE 0002
-#define REG_NOSUB 0004
-#define REG_NEWLINE 0010
-#define REG_NOSPEC 0020
-#define REG_PEND 0040
-#define REG_DUMP 0200
-
-
-/* === regerror.c === */
-#define REG_OKAY 0
-#define REG_NOMATCH 1
-#define REG_BADPAT 2
-#define REG_ECOLLATE 3
-#define REG_ECTYPE 4
-#define REG_EESCAPE 5
-#define REG_ESUBREG 6
-#define REG_EBRACK 7
-#define REG_EPAREN 8
-#define REG_EBRACE 9
-#define REG_BADBR 10
-#define REG_ERANGE 11
-#define REG_ESPACE 12
-#define REG_BADRPT 13
-#define REG_EMPTY 14
-#define REG_ASSERT 15
-#define REG_INVARG 16
-#define REG_ATOI 255 /* convert name to number (!) */
-#define REG_ITOA 0400 /* convert number to name (!) */
-API_EXPORT(size_t) regerror(int, const regex_t *, char *, size_t);
-
-
-/* === regexec.c === */
-API_EXPORT(int) regexec(const regex_t *, const char *, size_t, regmatch_t [], int);
-#define REG_NOTBOL 00001
-#define REG_NOTEOL 00002
-#define REG_STARTEND 00004
-#define REG_TRACE 00400 /* tracing of execution */
-#define REG_LARGE 01000 /* force large representation */
-#define REG_BACKR 02000 /* force use of backref code */
-
-
-/* === regfree.c === */
-API_EXPORT(void) regfree(regex_t *);
-
-#ifdef __cplusplus
-}
-#endif
-/* ========= end header generated by ././mkh ========= */
-#endif
-#endif
diff --git a/regex/regex.mak b/regex/regex.mak
deleted file mode 100644
index b87ded340b..0000000000
--- a/regex/regex.mak
+++ /dev/null
@@ -1,304 +0,0 @@
-# Microsoft Developer Studio Generated NMAKE File, Based on regex.dsp
-!IF "$(CFG)" == ""
-CFG=regex - Win32 Release
-!MESSAGE No configuration specified. Defaulting to regex - Win32 Release.
-!ENDIF
-
-!IF "$(CFG)" != "regex - Win32 Release" && "$(CFG)" != "regex - Win32 Debug"
-!MESSAGE Invalid configuration "$(CFG)" specified.
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "regex.mak" CFG="regex - Win32 Release"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "regex - Win32 Release" (based on "Win32 (x86) Static Library")
-!MESSAGE "regex - Win32 Debug" (based on "Win32 (x86) Static Library")
-!MESSAGE
-!ERROR An invalid configuration is specified.
-!ENDIF
-
-!IF "$(OS)" == "Windows_NT"
-NULL=
-!ELSE
-NULL=nul
-!ENDIF
-
-CPP=cl.exe
-
-!IF "$(CFG)" == "regex - Win32 Release"
-
-OUTDIR=.\Release
-INTDIR=.\Release
-# Begin Custom Macros
-OutDir=.\.\Release
-# End Custom Macros
-
-!IF "$(RECURSE)" == "0"
-
-ALL : "$(OUTDIR)\regex.lib"
-
-!ELSE
-
-ALL : "$(OUTDIR)\regex.lib"
-
-!ENDIF
-
-CLEAN :
- -@erase "$(INTDIR)\regcomp.obj"
- -@erase "$(INTDIR)\regerror.obj"
- -@erase "$(INTDIR)\regexec.obj"
- -@erase "$(INTDIR)\regfree.obj"
- -@erase "$(INTDIR)\vc50.idb"
- -@erase "$(OUTDIR)\regex.lib"
-
-"$(OUTDIR)" :
- if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
-
-CPP_PROJ=/nologo /MD /W3 /GX /O2 /I "." /D "WIN32" /D "NDEBUG" /D "_WINDOWS"\
- /Fp"$(INTDIR)\regex.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
-CPP_OBJS=.\Release/
-CPP_SBRS=.
-BSC32=bscmake.exe
-BSC32_FLAGS=/nologo /o"$(OUTDIR)\regex.bsc"
-BSC32_SBRS= \
-
-LIB32=link.exe -lib
-LIB32_FLAGS=/nologo /out:"$(OUTDIR)\regex.lib"
-LIB32_OBJS= \
- "$(INTDIR)\regcomp.obj" \
- "$(INTDIR)\regerror.obj" \
- "$(INTDIR)\regexec.obj" \
- "$(INTDIR)\regfree.obj"
-
-"$(OUTDIR)\regex.lib" : "$(OUTDIR)" $(DEF_FILE) $(LIB32_OBJS)
- $(LIB32) @<<
- $(LIB32_FLAGS) $(DEF_FLAGS) $(LIB32_OBJS)
-<<
-
-!ELSEIF "$(CFG)" == "regex - Win32 Debug"
-
-OUTDIR=.\Debug
-INTDIR=.\Debug
-# Begin Custom Macros
-OutDir=.\.\Debug
-# End Custom Macros
-
-!IF "$(RECURSE)" == "0"
-
-ALL : "$(OUTDIR)\regex.lib" "$(OUTDIR)\regex.bsc"
-
-!ELSE
-
-ALL : "$(OUTDIR)\regex.lib" "$(OUTDIR)\regex.bsc"
-
-!ENDIF
-
-CLEAN :
- -@erase "$(INTDIR)\regcomp.obj"
- -@erase "$(INTDIR)\regcomp.sbr"
- -@erase "$(INTDIR)\regerror.obj"
- -@erase "$(INTDIR)\regerror.sbr"
- -@erase "$(INTDIR)\regexec.obj"
- -@erase "$(INTDIR)\regexec.sbr"
- -@erase "$(INTDIR)\regfree.obj"
- -@erase "$(INTDIR)\regfree.sbr"
- -@erase "$(INTDIR)\vc50.idb"
- -@erase "$(OUTDIR)\regex.bsc"
- -@erase "$(OUTDIR)\regex.lib"
-
-"$(OUTDIR)" :
- if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
-
-CPP_PROJ=/nologo /MDd /W3 /GX /Z7 /Od /I "." /D "WIN32" /D "_DEBUG" /D\
- "_WINDOWS" /FR"$(INTDIR)\\" /Fp"$(INTDIR)\regex.pch" /YX /Fo"$(INTDIR)\\"\
- /Fd"$(INTDIR)\\" /FD /c
-CPP_OBJS=.\Debug/
-CPP_SBRS=.\Debug/
-BSC32=bscmake.exe
-BSC32_FLAGS=/nologo /o"$(OUTDIR)\regex.bsc"
-BSC32_SBRS= \
- "$(INTDIR)\regcomp.sbr" \
- "$(INTDIR)\regerror.sbr" \
- "$(INTDIR)\regexec.sbr" \
- "$(INTDIR)\regfree.sbr"
-
-"$(OUTDIR)\regex.bsc" : "$(OUTDIR)" $(BSC32_SBRS)
- $(BSC32) @<<
- $(BSC32_FLAGS) $(BSC32_SBRS)
-<<
-
-LIB32=link.exe -lib
-LIB32_FLAGS=/nologo /out:"$(OUTDIR)\regex.lib"
-LIB32_OBJS= \
- "$(INTDIR)\regcomp.obj" \
- "$(INTDIR)\regerror.obj" \
- "$(INTDIR)\regexec.obj" \
- "$(INTDIR)\regfree.obj"
-
-"$(OUTDIR)\regex.lib" : "$(OUTDIR)" $(DEF_FILE) $(LIB32_OBJS)
- $(LIB32) @<<
- $(LIB32_FLAGS) $(DEF_FLAGS) $(LIB32_OBJS)
-<<
-
-!ENDIF
-
-.c{$(CPP_OBJS)}.obj::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cpp{$(CPP_OBJS)}.obj::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cxx{$(CPP_OBJS)}.obj::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.c{$(CPP_SBRS)}.sbr::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cpp{$(CPP_SBRS)}.sbr::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cxx{$(CPP_SBRS)}.sbr::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-
-!IF "$(CFG)" == "regex - Win32 Release" || "$(CFG)" == "regex - Win32 Debug"
-SOURCE=.\regcomp.c
-
-!IF "$(CFG)" == "regex - Win32 Release"
-
-DEP_CPP_REGCO=\
- ".\cclass.h"\
- ".\cname.h"\
- ".\regcomp.ih"\
- ".\regex.h"\
- ".\regex2.h"\
- ".\utils.h"\
-
-
-"$(INTDIR)\regcomp.obj" : $(SOURCE) $(DEP_CPP_REGCO) "$(INTDIR)"
-
-
-!ELSEIF "$(CFG)" == "regex - Win32 Debug"
-
-DEP_CPP_REGCO=\
- ".\cclass.h"\
- ".\cname.h"\
- ".\regcomp.ih"\
- ".\regex.h"\
- ".\regex2.h"\
- ".\utils.h"\
- {$(INCLUDE)}"sys\types.h"\
-
-
-"$(INTDIR)\regcomp.obj" "$(INTDIR)\regcomp.sbr" : $(SOURCE) $(DEP_CPP_REGCO)\
- "$(INTDIR)"
-
-
-!ENDIF
-
-SOURCE=.\regerror.c
-
-!IF "$(CFG)" == "regex - Win32 Release"
-
-DEP_CPP_REGER=\
- ".\regerror.ih"\
- ".\regex.h"\
- ".\utils.h"\
-
-
-"$(INTDIR)\regerror.obj" : $(SOURCE) $(DEP_CPP_REGER) "$(INTDIR)"
-
-
-!ELSEIF "$(CFG)" == "regex - Win32 Debug"
-
-DEP_CPP_REGER=\
- ".\regerror.ih"\
- ".\regex.h"\
- ".\utils.h"\
- {$(INCLUDE)}"sys\types.h"\
-
-
-"$(INTDIR)\regerror.obj" "$(INTDIR)\regerror.sbr" : $(SOURCE) $(DEP_CPP_REGER)\
- "$(INTDIR)"
-
-
-!ENDIF
-
-SOURCE=.\regexec.c
-
-!IF "$(CFG)" == "regex - Win32 Release"
-
-DEP_CPP_REGEX=\
- ".\engine.c"\
- ".\engine.ih"\
- ".\regex.h"\
- ".\regex2.h"\
- ".\utils.h"\
-
-
-"$(INTDIR)\regexec.obj" : $(SOURCE) $(DEP_CPP_REGEX) "$(INTDIR)"
-
-
-!ELSEIF "$(CFG)" == "regex - Win32 Debug"
-
-DEP_CPP_REGEX=\
- ".\engine.c"\
- ".\engine.ih"\
- ".\regex.h"\
- ".\regex2.h"\
- ".\utils.h"\
- {$(INCLUDE)}"sys\types.h"\
-
-
-"$(INTDIR)\regexec.obj" "$(INTDIR)\regexec.sbr" : $(SOURCE) $(DEP_CPP_REGEX)\
- "$(INTDIR)"
-
-
-!ENDIF
-
-SOURCE=.\regfree.c
-
-!IF "$(CFG)" == "regex - Win32 Release"
-
-DEP_CPP_REGFR=\
- ".\regex.h"\
- ".\regex2.h"\
- ".\utils.h"\
-
-
-"$(INTDIR)\regfree.obj" : $(SOURCE) $(DEP_CPP_REGFR) "$(INTDIR)"
-
-
-!ELSEIF "$(CFG)" == "regex - Win32 Debug"
-
-DEP_CPP_REGFR=\
- ".\regex.h"\
- ".\regex2.h"\
- ".\utils.h"\
- {$(INCLUDE)}"sys\types.h"\
-
-
-"$(INTDIR)\regfree.obj" "$(INTDIR)\regfree.sbr" : $(SOURCE) $(DEP_CPP_REGFR)\
- "$(INTDIR)"
-
-
-!ENDIF
-
-SOURCE=.\engine.c
-
-!ENDIF
-
diff --git a/regex/regex2.h b/regex/regex2.h
deleted file mode 100644
index 7cd39a59ae..0000000000
--- a/regex/regex2.h
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * First, the stuff that ends up in the outside-world include file
- = #ifdef WIN32
- = #define API_EXPORT(type) __declspec(dllexport) type __stdcall
- = #else
- = #define API_EXPORT(type) type
- = #endif
- =
- = typedef off_t regoff_t;
- = typedef struct {
- = int re_magic;
- = size_t re_nsub; // number of parenthesized subexpressions
- = const char *re_endp; // end pointer for REG_PEND
- = struct re_guts *re_g; // none of your business :-)
- = } regex_t;
- = typedef struct {
- = regoff_t rm_so; // start of match
- = regoff_t rm_eo; // end of match
- = } regmatch_t;
- */
-/*
- * internals of regex_t
- */
-#define MAGIC1 ((('r'^0200)<<8) | 'e')
-
-/*
- * The internal representation is a *strip*, a sequence of
- * operators ending with an endmarker. (Some terminology etc. is a
- * historical relic of earlier versions which used multiple strips.)
- * Certain oddities in the representation are there to permit running
- * the machinery backwards; in particular, any deviation from sequential
- * flow must be marked at both its source and its destination. Some
- * fine points:
- *
- * - OPLUS_ and O_PLUS are *inside* the loop they create.
- * - OQUEST_ and O_QUEST are *outside* the bypass they create.
- * - OCH_ and O_CH are *outside* the multi-way branch they create, while
- * OOR1 and OOR2 are respectively the end and the beginning of one of
- * the branches. Note that there is an implicit OOR2 following OCH_
- * and an implicit OOR1 preceding O_CH.
- *
- * In state representations, an operator's bit is on to signify a state
- * immediately *preceding* "execution" of that operator.
- */
-typedef long sop; /* strip operator */
-typedef long sopno;
-#define OPRMASK 0x7c000000
-#define OPDMASK 0x03ffffff
-#define OPSHIFT (26)
-#define OP(n) ((n)&OPRMASK)
-#define OPND(n) ((n)&OPDMASK)
-#define SOP(op, opnd) ((op)|(opnd))
-/* operators meaning operand */
-/* (back, fwd are offsets) */
-#define OEND (1<<OPSHIFT) /* endmarker - */
-#define OCHAR (2<<OPSHIFT) /* character unsigned char */
-#define OBOL (3<<OPSHIFT) /* left anchor - */
-#define OEOL (4<<OPSHIFT) /* right anchor - */
-#define OANY (5<<OPSHIFT) /* . - */
-#define OANYOF (6<<OPSHIFT) /* [...] set number */
-#define OBACK_ (7<<OPSHIFT) /* begin \d paren number */
-#define O_BACK (8<<OPSHIFT) /* end \d paren number */
-#define OPLUS_ (9<<OPSHIFT) /* + prefix fwd to suffix */
-#define O_PLUS (10<<OPSHIFT) /* + suffix back to prefix */
-#define OQUEST_ (11<<OPSHIFT) /* ? prefix fwd to suffix */
-#define O_QUEST (12<<OPSHIFT) /* ? suffix back to prefix */
-#define OLPAREN (13<<OPSHIFT) /* ( fwd to ) */
-#define ORPAREN (14<<OPSHIFT) /* ) back to ( */
-#define OCH_ (15<<OPSHIFT) /* begin choice fwd to OOR2 */
-#define OOR1 (16<<OPSHIFT) /* | pt. 1 back to OOR1 or OCH_ */
-#define OOR2 (17<<OPSHIFT) /* | pt. 2 fwd to OOR2 or O_CH */
-#define O_CH (18<<OPSHIFT) /* end choice back to OOR1 */
-#define OBOW (19<<OPSHIFT) /* begin word - */
-#define OEOW (20<<OPSHIFT) /* end word - */
-
-/*
- * Structure for [] character-set representation. Character sets are
- * done as bit vectors, grouped 8 to a byte vector for compactness.
- * The individual set therefore has both a pointer to the byte vector
- * and a mask to pick out the relevant bit of each byte. A hash code
- * simplifies testing whether two sets could be identical.
- *
- * This will get trickier for multicharacter collating elements. As
- * preliminary hooks for dealing with such things, we also carry along
- * a string of multi-character elements, and decide the size of the
- * vectors at run time.
- */
-typedef struct {
- uch *ptr; /* -> uch [csetsize] */
- uch mask; /* bit within array */
- uch hash; /* hash code */
- size_t smultis;
- char *multis; /* -> char[smulti] ab\0cd\0ef\0\0 */
-} cset;
-/* note that CHadd and CHsub are unsafe, and CHIN doesn't yield 0/1 */
-#define CHadd(cs, c) ((cs)->ptr[(uch)(c)] |= (cs)->mask, (cs)->hash += (c))
-#define CHsub(cs, c) ((cs)->ptr[(uch)(c)] &= ~(cs)->mask, (cs)->hash -= (c))
-#define CHIN(cs, c) ((cs)->ptr[(uch)(c)] & (cs)->mask)
-#define MCadd(p, cs, cp) mcadd(p, cs, cp) /* regcomp() internal fns */
-#define MCsub(p, cs, cp) mcsub(p, cs, cp)
-#define MCin(p, cs, cp) mcin(p, cs, cp)
-
-/* stuff for character categories */
-typedef unsigned char cat_t;
-
-/*
- * main compiled-expression structure
- */
-struct re_guts {
- int magic;
-# define MAGIC2 ((('R'^0200)<<8)|'E')
- sop *strip; /* malloced area for strip */
- int csetsize; /* number of bits in a cset vector */
- int ncsets; /* number of csets in use */
- cset *sets; /* -> cset [ncsets] */
- uch *setbits; /* -> uch[csetsize][ncsets/CHAR_BIT] */
- int cflags; /* copy of regcomp() cflags argument */
- sopno nstates; /* = number of sops */
- sopno firststate; /* the initial OEND (normally 0) */
- sopno laststate; /* the final OEND */
- int iflags; /* internal flags */
-# define USEBOL 01 /* used ^ */
-# define USEEOL 02 /* used $ */
-# define BAD 04 /* something wrong */
- int nbol; /* number of ^ used */
- int neol; /* number of $ used */
- int ncategories; /* how many character categories */
- cat_t *categories; /* ->catspace[-CHAR_MIN] */
- char *must; /* match must contain this string */
- int mlen; /* length of must */
- size_t nsub; /* copy of re_nsub */
- int backrefs; /* does it use back references? */
- sopno nplus; /* how deep does it nest +s? */
- /* catspace must be last */
- cat_t catspace[1]; /* actually [NC] */
-};
-
-/* misc utilities */
-#define OUT (CHAR_MAX+1) /* a non-character value */
-#define ISWORD(c) (isalnum(c) || (c) == '_')
diff --git a/regex/regex_extra.h b/regex/regex_extra.h
deleted file mode 100644
index 3db9e4ad1a..0000000000
--- a/regex/regex_extra.h
+++ /dev/null
@@ -1,23 +0,0 @@
-/* do not frame this - we must be able to include this file multiple times */
-
-#undef regexec
-#undef regerror
-#undef regfree
-#undef regcomp
-
-#if (defined(REGEX) && REGEX == 1) || (!defined(REGEX))
-
-#if !(WIN32|WINNT)
-
-#ifndef PHP_NO_ALIASES
-
-#define regexec php_regexec
-#define regerror php_regerror
-#define regfree php_regfree
-#define regcomp php_regcomp
-
-#endif
-
-#endif
-
-#endif
diff --git a/regex/regexec.c b/regex/regexec.c
deleted file mode 100644
index 7888d02368..0000000000
--- a/regex/regexec.c
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * the outer shell of regexec()
- *
- * This file includes engine.c *twice*, after muchos fiddling with the
- * macros that code uses. This lets the same code operate on two different
- * representations for state sets.
- */
-#include <sys/types.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <limits.h>
-#include <ctype.h>
-#include <regex.h>
-
-#include "utils.h"
-#include "regex2.h"
-
-static int nope = 0; /* for use in asserts; shuts lint up */
-
-/* macros for manipulating states, small version */
-#define states unsigned
-#define states1 unsigned /* for later use in regexec() decision */
-#define CLEAR(v) ((v) = 0)
-#define SET0(v, n) ((v) &= ~((unsigned)1 << (n)))
-#define SET1(v, n) ((v) |= (unsigned)1 << (n))
-#define ISSET(v, n) ((v) & ((unsigned)1 << (n)))
-#define ASSIGN(d, s) ((d) = (s))
-#define EQ(a, b) ((a) == (b))
-#define STATEVARS int dummy /* dummy version */
-#define STATESETUP(m, n) /* nothing */
-#define STATETEARDOWN(m) /* nothing */
-#define SETUP(v) ((v) = 0)
-#define onestate unsigned
-#define INIT(o, n) ((o) = (unsigned)1 << (n))
-#define INC(o) ((o) <<= 1)
-#define ISSTATEIN(v, o) ((v) & (o))
-/* some abbreviations; note that some of these know variable names! */
-/* do "if I'm here, I can also be there" etc without branches */
-#define FWD(dst, src, n) ((dst) |= ((unsigned)(src)&(here)) << (n))
-#define BACK(dst, src, n) ((dst) |= ((unsigned)(src)&(here)) >> (n))
-#define ISSETBACK(v, n) ((v) & ((unsigned)here >> (n)))
-/* function names */
-#define SNAMES /* engine.c looks after details */
-
-#include "engine.c"
-
-/* now undo things */
-#undef states
-#undef CLEAR
-#undef SET0
-#undef SET1
-#undef ISSET
-#undef ASSIGN
-#undef EQ
-#undef STATEVARS
-#undef STATESETUP
-#undef STATETEARDOWN
-#undef SETUP
-#undef onestate
-#undef INIT
-#undef INC
-#undef ISSTATEIN
-#undef FWD
-#undef BACK
-#undef ISSETBACK
-#undef SNAMES
-
-/* macros for manipulating states, large version */
-#define states char *
-#define CLEAR(v) memset(v, 0, m->g->nstates)
-#define SET0(v, n) ((v)[n] = 0)
-#define SET1(v, n) ((v)[n] = 1)
-#define ISSET(v, n) ((v)[n])
-#define ASSIGN(d, s) memcpy(d, s, m->g->nstates)
-#define EQ(a, b) (memcmp(a, b, m->g->nstates) == 0)
-#define STATEVARS int vn; char *space
-#define STATESETUP(m, nv) { (m)->space = malloc((nv)*(m)->g->nstates); \
- if ((m)->space == NULL) return(REG_ESPACE); \
- (m)->vn = 0; }
-#define STATETEARDOWN(m) { free((m)->space); }
-#define SETUP(v) ((v) = &m->space[m->vn++ * m->g->nstates])
-#define onestate int
-#define INIT(o, n) ((o) = (n))
-#define INC(o) ((o)++)
-#define ISSTATEIN(v, o) ((v)[o])
-/* some abbreviations; note that some of these know variable names! */
-/* do "if I'm here, I can also be there" etc without branches */
-#define FWD(dst, src, n) ((dst)[here+(n)] |= (src)[here])
-#define BACK(dst, src, n) ((dst)[here-(n)] |= (src)[here])
-#define ISSETBACK(v, n) ((v)[here - (n)])
-/* function names */
-#define LNAMES /* flag */
-
-#include "engine.c"
-
-/*
- - regexec - interface for matching
- = API_EXPORT(int) regexec(const regex_t *, const char *, size_t, \
- = regmatch_t [], int);
- = #define REG_NOTBOL 00001
- = #define REG_NOTEOL 00002
- = #define REG_STARTEND 00004
- = #define REG_TRACE 00400 // tracing of execution
- = #define REG_LARGE 01000 // force large representation
- = #define REG_BACKR 02000 // force use of backref code
- *
- * We put this here so we can exploit knowledge of the state representation
- * when choosing which matcher to call. Also, by this point the matchers
- * have been prototyped.
- */
-API_EXPORT(int) /* 0 success, REG_NOMATCH failure */
-regexec(preg, string, nmatch, pmatch, eflags)
-const regex_t *preg;
-const char *string;
-size_t nmatch;
-regmatch_t pmatch[];
-int eflags;
-{
- register struct re_guts *g = preg->re_g;
-#ifdef REDEBUG
-# define GOODFLAGS(f) (f)
-#else
-# define GOODFLAGS(f) ((f)&(REG_NOTBOL|REG_NOTEOL|REG_STARTEND))
-#endif
-
- if (preg->re_magic != MAGIC1 || g->magic != MAGIC2)
- return(REG_BADPAT);
- assert(!(g->iflags&BAD));
- if (g->iflags&BAD) /* backstop for no-debug case */
- return(REG_BADPAT);
- eflags = GOODFLAGS(eflags);
-
- if (g->nstates <= CHAR_BIT*sizeof(states1) && !(eflags&REG_LARGE))
- return(smatcher(g, (char *)string, nmatch, pmatch, eflags));
- else
- return(lmatcher(g, (char *)string, nmatch, pmatch, eflags));
-}
diff --git a/regex/regfree.c b/regex/regfree.c
deleted file mode 100644
index 9fd618a13b..0000000000
--- a/regex/regfree.c
+++ /dev/null
@@ -1,37 +0,0 @@
-#include <sys/types.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <regex.h>
-
-#include "utils.h"
-#include "regex2.h"
-
-/*
- - regfree - free everything
- = API_EXPORT(void) regfree(regex_t *);
- */
-API_EXPORT(void)
-regfree(preg)
-regex_t *preg;
-{
- register struct re_guts *g;
-
- if (preg->re_magic != MAGIC1) /* oops */
- return; /* nice to complain, but hard */
-
- g = preg->re_g;
- if (g == NULL || g->magic != MAGIC2) /* oops again */
- return;
- preg->re_magic = 0; /* mark it invalid */
- g->magic = 0; /* mark it invalid */
-
- if (g->strip != NULL)
- free((char *)g->strip);
- if (g->sets != NULL)
- free((char *)g->sets);
- if (g->setbits != NULL)
- free((char *)g->setbits);
- if (g->must != NULL)
- free(g->must);
- free((char *)g);
-}
diff --git a/regex/split.c b/regex/split.c
deleted file mode 100644
index 188bdb775b..0000000000
--- a/regex/split.c
+++ /dev/null
@@ -1,316 +0,0 @@
-#include <stdio.h>
-#include <string.h>
-
-/*
- - split - divide a string into fields, like awk split()
- = int split(char *string, char *fields[], int nfields, char *sep);
- */
-int /* number of fields, including overflow */
-split(string, fields, nfields, sep)
-char *string;
-char *fields[]; /* list is not NULL-terminated */
-int nfields; /* number of entries available in fields[] */
-char *sep; /* "" white, "c" single char, "ab" [ab]+ */
-{
- register char *p = string;
- register char c; /* latest character */
- register char sepc = sep[0];
- register char sepc2;
- register int fn;
- register char **fp = fields;
- register char *sepp;
- register int trimtrail;
-
- /* white space */
- if (sepc == '\0') {
- while ((c = *p++) == ' ' || c == '\t')
- continue;
- p--;
- trimtrail = 1;
- sep = " \t"; /* note, code below knows this is 2 long */
- sepc = ' ';
- } else
- trimtrail = 0;
- sepc2 = sep[1]; /* now we can safely pick this up */
-
- /* catch empties */
- if (*p == '\0')
- return(0);
-
- /* single separator */
- if (sepc2 == '\0') {
- fn = nfields;
- for (;;) {
- *fp++ = p;
- fn--;
- if (fn == 0)
- break;
- while ((c = *p++) != sepc)
- if (c == '\0')
- return(nfields - fn);
- *(p-1) = '\0';
- }
- /* we have overflowed the fields vector -- just count them */
- fn = nfields;
- for (;;) {
- while ((c = *p++) != sepc)
- if (c == '\0')
- return(fn);
- fn++;
- }
- /* not reached */
- }
-
- /* two separators */
- if (sep[2] == '\0') {
- fn = nfields;
- for (;;) {
- *fp++ = p;
- fn--;
- while ((c = *p++) != sepc && c != sepc2)
- if (c == '\0') {
- if (trimtrail && **(fp-1) == '\0')
- fn++;
- return(nfields - fn);
- }
- if (fn == 0)
- break;
- *(p-1) = '\0';
- while ((c = *p++) == sepc || c == sepc2)
- continue;
- p--;
- }
- /* we have overflowed the fields vector -- just count them */
- fn = nfields;
- while (c != '\0') {
- while ((c = *p++) == sepc || c == sepc2)
- continue;
- p--;
- fn++;
- while ((c = *p++) != '\0' && c != sepc && c != sepc2)
- continue;
- }
- /* might have to trim trailing white space */
- if (trimtrail) {
- p--;
- while ((c = *--p) == sepc || c == sepc2)
- continue;
- p++;
- if (*p != '\0') {
- if (fn == nfields+1)
- *p = '\0';
- fn--;
- }
- }
- return(fn);
- }
-
- /* n separators */
- fn = 0;
- for (;;) {
- if (fn < nfields)
- *fp++ = p;
- fn++;
- for (;;) {
- c = *p++;
- if (c == '\0')
- return(fn);
- sepp = sep;
- while ((sepc = *sepp++) != '\0' && sepc != c)
- continue;
- if (sepc != '\0') /* it was a separator */
- break;
- }
- if (fn < nfields)
- *(p-1) = '\0';
- for (;;) {
- c = *p++;
- sepp = sep;
- while ((sepc = *sepp++) != '\0' && sepc != c)
- continue;
- if (sepc == '\0') /* it wasn't a separator */
- break;
- }
- p--;
- }
-
- /* not reached */
-}
-
-#ifdef TEST_SPLIT
-
-
-/*
- * test program
- * pgm runs regression
- * pgm sep splits stdin lines by sep
- * pgm str sep splits str by sep
- * pgm str sep n splits str by sep n times
- */
-int
-main(argc, argv)
-int argc;
-char *argv[];
-{
- char buf[512];
- register int n;
-# define MNF 10
- char *fields[MNF];
-
- if (argc > 4)
- for (n = atoi(argv[3]); n > 0; n--) {
- (void) strcpy(buf, argv[1]);
- }
- else if (argc > 3)
- for (n = atoi(argv[3]); n > 0; n--) {
- (void) strcpy(buf, argv[1]);
- (void) split(buf, fields, MNF, argv[2]);
- }
- else if (argc > 2)
- dosplit(argv[1], argv[2]);
- else if (argc > 1)
- while (fgets(buf, sizeof(buf), stdin) != NULL) {
- buf[strlen(buf)-1] = '\0'; /* stomp newline */
- dosplit(buf, argv[1]);
- }
- else
- regress();
-
- exit(0);
-}
-
-dosplit(string, seps)
-char *string;
-char *seps;
-{
-# define NF 5
- char *fields[NF];
- register int nf;
-
- nf = split(string, fields, NF, seps);
- print(nf, NF, fields);
-}
-
-print(nf, nfp, fields)
-int nf;
-int nfp;
-char *fields[];
-{
- register int fn;
- register int bound;
-
- bound = (nf > nfp) ? nfp : nf;
- printf("%d:\t", nf);
- for (fn = 0; fn < bound; fn++)
- printf("\"%s\"%s", fields[fn], (fn+1 < nf) ? ", " : "\n");
-}
-
-#define RNF 5 /* some table entries know this */
-struct {
- char *str;
- char *seps;
- int nf;
- char *fi[RNF];
-} tests[] = {
- "", " ", 0, { "" },
- " ", " ", 2, { "", "" },
- "x", " ", 1, { "x" },
- "xy", " ", 1, { "xy" },
- "x y", " ", 2, { "x", "y" },
- "abc def g ", " ", 5, { "abc", "def", "", "g", "" },
- " a bcd", " ", 4, { "", "", "a", "bcd" },
- "a b c d e f", " ", 6, { "a", "b", "c", "d", "e f" },
- " a b c d ", " ", 6, { "", "a", "b", "c", "d " },
-
- "", " _", 0, { "" },
- " ", " _", 2, { "", "" },
- "x", " _", 1, { "x" },
- "x y", " _", 2, { "x", "y" },
- "ab _ cd", " _", 2, { "ab", "cd" },
- " a_b c ", " _", 5, { "", "a", "b", "c", "" },
- "a b c_d e f", " _", 6, { "a", "b", "c", "d", "e f" },
- " a b c d ", " _", 6, { "", "a", "b", "c", "d " },
-
- "", " _~", 0, { "" },
- " ", " _~", 2, { "", "" },
- "x", " _~", 1, { "x" },
- "x y", " _~", 2, { "x", "y" },
- "ab _~ cd", " _~", 2, { "ab", "cd" },
- " a_b c~", " _~", 5, { "", "a", "b", "c", "" },
- "a b_c d~e f", " _~", 6, { "a", "b", "c", "d", "e f" },
- "~a b c d ", " _~", 6, { "", "a", "b", "c", "d " },
-
- "", " _~-", 0, { "" },
- " ", " _~-", 2, { "", "" },
- "x", " _~-", 1, { "x" },
- "x y", " _~-", 2, { "x", "y" },
- "ab _~- cd", " _~-", 2, { "ab", "cd" },
- " a_b c~", " _~-", 5, { "", "a", "b", "c", "" },
- "a b_c-d~e f", " _~-", 6, { "a", "b", "c", "d", "e f" },
- "~a-b c d ", " _~-", 6, { "", "a", "b", "c", "d " },
-
- "", " ", 0, { "" },
- " ", " ", 2, { "", "" },
- "x", " ", 1, { "x" },
- "xy", " ", 1, { "xy" },
- "x y", " ", 2, { "x", "y" },
- "abc def g ", " ", 4, { "abc", "def", "g", "" },
- " a bcd", " ", 3, { "", "a", "bcd" },
- "a b c d e f", " ", 6, { "a", "b", "c", "d", "e f" },
- " a b c d ", " ", 6, { "", "a", "b", "c", "d " },
-
- "", "", 0, { "" },
- " ", "", 0, { "" },
- "x", "", 1, { "x" },
- "xy", "", 1, { "xy" },
- "x y", "", 2, { "x", "y" },
- "abc def g ", "", 3, { "abc", "def", "g" },
- "\t a bcd", "", 2, { "a", "bcd" },
- " a \tb\t c ", "", 3, { "a", "b", "c" },
- "a b c d e ", "", 5, { "a", "b", "c", "d", "e" },
- "a b\tc d e f", "", 6, { "a", "b", "c", "d", "e f" },
- " a b c d e f ", "", 6, { "a", "b", "c", "d", "e f " },
-
- NULL, NULL, 0, { NULL },
-};
-
-regress()
-{
- char buf[512];
- register int n;
- char *fields[RNF+1];
- register int nf;
- register int i;
- register int printit;
- register char *f;
-
- for (n = 0; tests[n].str != NULL; n++) {
- (void) strcpy(buf, tests[n].str);
- fields[RNF] = NULL;
- nf = split(buf, fields, RNF, tests[n].seps);
- printit = 0;
- if (nf != tests[n].nf) {
- printf("split `%s' by `%s' gave %d fields, not %d\n",
- tests[n].str, tests[n].seps, nf, tests[n].nf);
- printit = 1;
- } else if (fields[RNF] != NULL) {
- printf("split() went beyond array end\n");
- printit = 1;
- } else {
- for (i = 0; i < nf && i < RNF; i++) {
- f = fields[i];
- if (f == NULL)
- f = "(NULL)";
- if (strcmp(f, tests[n].fi[i]) != 0) {
- printf("split `%s' by `%s', field %d is `%s', not `%s'\n",
- tests[n].str, tests[n].seps,
- i, fields[i], tests[n].fi[i]);
- printit = 1;
- }
- }
- }
- if (printit)
- print(nf, RNF, fields);
- }
-}
-#endif
diff --git a/regex/tests b/regex/tests
deleted file mode 100644
index c05846177f..0000000000
--- a/regex/tests
+++ /dev/null
@@ -1,475 +0,0 @@
-# regular expression test set
-# Lines are at least three fields, separated by one or more tabs. "" stands
-# for an empty field. First field is an RE. Second field is flags. If
-# C flag given, regcomp() is expected to fail, and the third field is the
-# error name (minus the leading REG_).
-#
-# Otherwise it is expected to succeed, and the third field is the string to
-# try matching it against. If there is no fourth field, the match is
-# expected to fail. If there is a fourth field, it is the substring that
-# the RE is expected to match. If there is a fifth field, it is a comma-
-# separated list of what the subexpressions should match, with - indicating
-# no match for that one. In both the fourth and fifth fields, a (sub)field
-# starting with @ indicates that the (sub)expression is expected to match
-# a null string followed by the stuff after the @; this provides a way to
-# test where null strings match. The character `N' in REs and strings
-# is newline, `S' is space, `T' is tab, `Z' is NUL.
-#
-# The full list of flags:
-# - placeholder, does nothing
-# b RE is a BRE, not an ERE
-# & try it as both an ERE and a BRE
-# C regcomp() error expected, third field is error name
-# i REG_ICASE
-# m ("mundane") REG_NOSPEC
-# s REG_NOSUB (not really testable)
-# n REG_NEWLINE
-# ^ REG_NOTBOL
-# $ REG_NOTEOL
-# # REG_STARTEND (see below)
-# p REG_PEND
-#
-# For REG_STARTEND, the start/end offsets are those of the substring
-# enclosed in ().
-
-# basics
-a & a a
-abc & abc abc
-abc|de - abc abc
-a|b|c - abc a
-
-# parentheses and perversions thereof
-a(b)c - abc abc
-a\(b\)c b abc abc
-a( C EPAREN
-a( b a( a(
-a\( - a( a(
-a\( bC EPAREN
-a\(b bC EPAREN
-a(b C EPAREN
-a(b b a(b a(b
-# gag me with a right parenthesis -- 1003.2 goofed here (my fault, partly)
-a) - a) a)
-) - ) )
-# end gagging (in a just world, those *should* give EPAREN)
-a) b a) a)
-a\) bC EPAREN
-\) bC EPAREN
-a()b - ab ab
-a\(\)b b ab ab
-
-# anchoring and REG_NEWLINE
-^abc$ & abc abc
-a^b - a^b
-a^b b a^b a^b
-a$b - a$b
-a$b b a$b a$b
-^ & abc @abc
-$ & abc @
-^$ & "" @
-$^ - "" @
-\($\)\(^\) b "" @
-# stop retching, those are legitimate (although disgusting)
-^^ - "" @
-$$ - "" @
-b$ & abNc
-b$ &n abNc b
-^b$ & aNbNc
-^b$ &n aNbNc b
-^$ &n aNNb @Nb
-^$ n abc
-^$ n abcN @
-$^ n aNNb @Nb
-\($\)\(^\) bn aNNb @Nb
-^^ n^ aNNb @Nb
-$$ n aNNb @NN
-^a ^ a
-a$ $ a
-^a ^n aNb
-^b ^n aNb b
-a$ $n bNa
-b$ $n bNa b
-a*(^b$)c* - b b
-a*\(^b$\)c* b b b
-
-# certain syntax errors and non-errors
-| C EMPTY
-| b | |
-* C BADRPT
-* b * *
-+ C BADRPT
-? C BADRPT
-"" &C EMPTY
-() - abc @abc
-\(\) b abc @abc
-a||b C EMPTY
-|ab C EMPTY
-ab| C EMPTY
-(|a)b C EMPTY
-(a|)b C EMPTY
-(*a) C BADRPT
-(+a) C BADRPT
-(?a) C BADRPT
-({1}a) C BADRPT
-\(\{1\}a\) bC BADRPT
-(a|*b) C BADRPT
-(a|+b) C BADRPT
-(a|?b) C BADRPT
-(a|{1}b) C BADRPT
-^* C BADRPT
-^* b * *
-^+ C BADRPT
-^? C BADRPT
-^{1} C BADRPT
-^\{1\} bC BADRPT
-
-# metacharacters, backslashes
-a.c & abc abc
-a[bc]d & abd abd
-a\*c & a*c a*c
-a\\b & a\b a\b
-a\\\*b & a\*b a\*b
-a\bc & abc abc
-a\ &C EESCAPE
-a\\bc & a\bc a\bc
-\{ bC BADRPT
-a\[b & a[b a[b
-a[b &C EBRACK
-# trailing $ is a peculiar special case for the BRE code
-a$ & a a
-a$ & a$
-a\$ & a
-a\$ & a$ a$
-a\\$ & a
-a\\$ & a$
-a\\$ & a\$
-a\\$ & a\ a\
-
-# back references, ugh
-a\(b\)\2c bC ESUBREG
-a\(b\1\)c bC ESUBREG
-a\(b*\)c\1d b abbcbbd abbcbbd bb
-a\(b*\)c\1d b abbcbd
-a\(b*\)c\1d b abbcbbbd
-^\(.\)\1 b abc
-a\([bc]\)\1d b abcdabbd abbd b
-a\(\([bc]\)\2\)*d b abbccd abbccd
-a\(\([bc]\)\2\)*d b abbcbd
-# actually, this next one probably ought to fail, but the spec is unclear
-a\(\(b\)*\2\)*d b abbbd abbbd
-# here is a case that no NFA implementation does right
-\(ab*\)[ab]*\1 b ababaaa ababaaa a
-# check out normal matching in the presence of back refs
-\(a\)\1bcd b aabcd aabcd
-\(a\)\1bc*d b aabcd aabcd
-\(a\)\1bc*d b aabd aabd
-\(a\)\1bc*d b aabcccd aabcccd
-\(a\)\1bc*[ce]d b aabcccd aabcccd
-^\(a\)\1b\(c\)*cd$ b aabcccd aabcccd
-
-# ordinary repetitions
-ab*c & abc abc
-ab+c - abc abc
-ab?c - abc abc
-a\(*\)b b a*b a*b
-a\(**\)b b ab ab
-a\(***\)b bC BADRPT
-*a b *a *a
-**a b a a
-***a bC BADRPT
-
-# the dreaded bounded repetitions
-{ & { {
-{abc & {abc {abc
-{1 C BADRPT
-{1} C BADRPT
-a{b & a{b a{b
-a{1}b - ab ab
-a\{1\}b b ab ab
-a{1,}b - ab ab
-a\{1,\}b b ab ab
-a{1,2}b - aab aab
-a\{1,2\}b b aab aab
-a{1 C EBRACE
-a\{1 bC EBRACE
-a{1a C EBRACE
-a\{1a bC EBRACE
-a{1a} C BADBR
-a\{1a\} bC BADBR
-a{,2} - a{,2} a{,2}
-a\{,2\} bC BADBR
-a{,} - a{,} a{,}
-a\{,\} bC BADBR
-a{1,x} C BADBR
-a\{1,x\} bC BADBR
-a{1,x C EBRACE
-a\{1,x bC EBRACE
-a{300} C BADBR
-a\{300\} bC BADBR
-a{1,0} C BADBR
-a\{1,0\} bC BADBR
-ab{0,0}c - abcac ac
-ab\{0,0\}c b abcac ac
-ab{0,1}c - abcac abc
-ab\{0,1\}c b abcac abc
-ab{0,3}c - abbcac abbc
-ab\{0,3\}c b abbcac abbc
-ab{1,1}c - acabc abc
-ab\{1,1\}c b acabc abc
-ab{1,3}c - acabc abc
-ab\{1,3\}c b acabc abc
-ab{2,2}c - abcabbc abbc
-ab\{2,2\}c b abcabbc abbc
-ab{2,4}c - abcabbc abbc
-ab\{2,4\}c b abcabbc abbc
-((a{1,10}){1,10}){1,10} - a a a,a
-
-# multiple repetitions
-a** &C BADRPT
-a++ C BADRPT
-a?? C BADRPT
-a*+ C BADRPT
-a*? C BADRPT
-a+* C BADRPT
-a+? C BADRPT
-a?* C BADRPT
-a?+ C BADRPT
-a{1}{1} C BADRPT
-a*{1} C BADRPT
-a+{1} C BADRPT
-a?{1} C BADRPT
-a{1}* C BADRPT
-a{1}+ C BADRPT
-a{1}? C BADRPT
-a*{b} - a{b} a{b}
-a\{1\}\{1\} bC BADRPT
-a*\{1\} bC BADRPT
-a\{1\}* bC BADRPT
-
-# brackets, and numerous perversions thereof
-a[b]c & abc abc
-a[ab]c & abc abc
-a[^ab]c & adc adc
-a[]b]c & a]c a]c
-a[[b]c & a[c a[c
-a[-b]c & a-c a-c
-a[^]b]c & adc adc
-a[^-b]c & adc adc
-a[b-]c & a-c a-c
-a[b &C EBRACK
-a[] &C EBRACK
-a[1-3]c & a2c a2c
-a[3-1]c &C ERANGE
-a[1-3-5]c &C ERANGE
-a[[.-.]--]c & a-c a-c
-a[1- &C ERANGE
-a[[. &C EBRACK
-a[[.x &C EBRACK
-a[[.x. &C EBRACK
-a[[.x.] &C EBRACK
-a[[.x.]] & ax ax
-a[[.x,.]] &C ECOLLATE
-a[[.one.]]b & a1b a1b
-a[[.notdef.]]b &C ECOLLATE
-a[[.].]]b & a]b a]b
-a[[:alpha:]]c & abc abc
-a[[:notdef:]]c &C ECTYPE
-a[[: &C EBRACK
-a[[:alpha &C EBRACK
-a[[:alpha:] &C EBRACK
-a[[:alpha,:] &C ECTYPE
-a[[:]:]]b &C ECTYPE
-a[[:-:]]b &C ECTYPE
-a[[:alph:]] &C ECTYPE
-a[[:alphabet:]] &C ECTYPE
-[[:alnum:]]+ - -%@a0X- a0X
-[[:alpha:]]+ - -%@aX0- aX
-[[:blank:]]+ - aSSTb SST
-[[:cntrl:]]+ - aNTb NT
-[[:digit:]]+ - a019b 019
-[[:graph:]]+ - Sa%bS a%b
-[[:lower:]]+ - AabC ab
-[[:print:]]+ - NaSbN aSb
-[[:punct:]]+ - S%-&T %-&
-[[:space:]]+ - aSNTb SNT
-[[:upper:]]+ - aBCd BC
-[[:xdigit:]]+ - p0f3Cq 0f3C
-a[[=b=]]c & abc abc
-a[[= &C EBRACK
-a[[=b &C EBRACK
-a[[=b= &C EBRACK
-a[[=b=] &C EBRACK
-a[[=b,=]] &C ECOLLATE
-a[[=one=]]b & a1b a1b
-
-# complexities
-a(((b)))c - abc abc
-a(b|(c))d - abd abd
-a(b*|c)d - abbd abbd
-# just gotta have one DFA-buster, of course
-a[ab]{20} - aaaaabaaaabaaaabaaaab aaaaabaaaabaaaabaaaab
-# and an inline expansion in case somebody gets tricky
-a[ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab] - aaaaabaaaabaaaabaaaab aaaaabaaaabaaaabaaaab
-# and in case somebody just slips in an NFA...
-a[ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab](wee|week)(knights|night) - aaaaabaaaabaaaabaaaabweeknights aaaaabaaaabaaaabaaaabweeknights
-# fish for anomalies as the number of states passes 32
-12345678901234567890123456789 - a12345678901234567890123456789b 12345678901234567890123456789
-123456789012345678901234567890 - a123456789012345678901234567890b 123456789012345678901234567890
-1234567890123456789012345678901 - a1234567890123456789012345678901b 1234567890123456789012345678901
-12345678901234567890123456789012 - a12345678901234567890123456789012b 12345678901234567890123456789012
-123456789012345678901234567890123 - a123456789012345678901234567890123b 123456789012345678901234567890123
-# and one really big one, beyond any plausible word width
-1234567890123456789012345678901234567890123456789012345678901234567890 - a1234567890123456789012345678901234567890123456789012345678901234567890b 1234567890123456789012345678901234567890123456789012345678901234567890
-# fish for problems as brackets go past 8
-[ab][cd][ef][gh][ij][kl][mn] - xacegikmoq acegikm
-[ab][cd][ef][gh][ij][kl][mn][op] - xacegikmoq acegikmo
-[ab][cd][ef][gh][ij][kl][mn][op][qr] - xacegikmoqy acegikmoq
-[ab][cd][ef][gh][ij][kl][mn][op][q] - xacegikmoqy acegikmoq
-
-# subtleties of matching
-abc & xabcy abc
-a\(b\)?c\1d b acd
-aBc i Abc Abc
-a[Bc]*d i abBCcd abBCcd
-0[[:upper:]]1 &i 0a1 0a1
-0[[:lower:]]1 &i 0A1 0A1
-a[^b]c &i abc
-a[^b]c &i aBc
-a[^b]c &i adc adc
-[a]b[c] - abc abc
-[a]b[a] - aba aba
-[abc]b[abc] - abc abc
-[abc]b[abd] - abd abd
-a(b?c)+d - accd accd
-(wee|week)(knights|night) - weeknights weeknights
-(we|wee|week|frob)(knights|night|day) - weeknights weeknights
-a[bc]d - xyzaaabcaababdacd abd
-a[ab]c - aaabc abc
-abc s abc abc
-a* & b @b
-
-# Let's have some fun -- try to match a C comment.
-# first the obvious, which looks okay at first glance...
-/\*.*\*/ - /*x*/ /*x*/
-# but...
-/\*.*\*/ - /*x*/y/*z*/ /*x*/y/*z*/
-# okay, we must not match */ inside; try to do that...
-/\*([^*]|\*[^/])*\*/ - /*x*/ /*x*/
-/\*([^*]|\*[^/])*\*/ - /*x*/y/*z*/ /*x*/
-# but...
-/\*([^*]|\*[^/])*\*/ - /*x**/y/*z*/ /*x**/y/*z*/
-# and a still fancier version, which does it right (I think)...
-/\*([^*]|\*+[^*/])*\*+/ - /*x*/ /*x*/
-/\*([^*]|\*+[^*/])*\*+/ - /*x*/y/*z*/ /*x*/
-/\*([^*]|\*+[^*/])*\*+/ - /*x**/y/*z*/ /*x**/
-/\*([^*]|\*+[^*/])*\*+/ - /*x****/y/*z*/ /*x****/
-/\*([^*]|\*+[^*/])*\*+/ - /*x**x*/y/*z*/ /*x**x*/
-/\*([^*]|\*+[^*/])*\*+/ - /*x***x/y/*z*/ /*x***x/y/*z*/
-
-# subexpressions
-a(b)(c)d - abcd abcd b,c
-a(((b)))c - abc abc b,b,b
-a(b|(c))d - abd abd b,-
-a(b*|c|e)d - abbd abbd bb
-a(b*|c|e)d - acd acd c
-a(b*|c|e)d - ad ad @d
-a(b?)c - abc abc b
-a(b?)c - ac ac @c
-a(b+)c - abc abc b
-a(b+)c - abbbc abbbc bbb
-a(b*)c - ac ac @c
-(a|ab)(bc([de]+)f|cde) - abcdef abcdef a,bcdef,de
-# the regression tester only asks for 9 subexpressions
-a(b)(c)(d)(e)(f)(g)(h)(i)(j)k - abcdefghijk abcdefghijk b,c,d,e,f,g,h,i,j
-a(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)l - abcdefghijkl abcdefghijkl b,c,d,e,f,g,h,i,j,k
-a([bc]?)c - abc abc b
-a([bc]?)c - ac ac @c
-a([bc]+)c - abc abc b
-a([bc]+)c - abcc abcc bc
-a([bc]+)bc - abcbc abcbc bc
-a(bb+|b)b - abb abb b
-a(bbb+|bb+|b)b - abb abb b
-a(bbb+|bb+|b)b - abbb abbb bb
-a(bbb+|bb+|b)bb - abbb abbb b
-(.*).* - abcdef abcdef abcdef
-(a*)* - bc @b @b
-
-# do we get the right subexpression when it is used more than once?
-a(b|c)*d - ad ad -
-a(b|c)*d - abcd abcd c
-a(b|c)+d - abd abd b
-a(b|c)+d - abcd abcd c
-a(b|c?)+d - ad ad @d
-a(b|c?)+d - abcd abcd @d
-a(b|c){0,0}d - ad ad -
-a(b|c){0,1}d - ad ad -
-a(b|c){0,1}d - abd abd b
-a(b|c){0,2}d - ad ad -
-a(b|c){0,2}d - abcd abcd c
-a(b|c){0,}d - ad ad -
-a(b|c){0,}d - abcd abcd c
-a(b|c){1,1}d - abd abd b
-a(b|c){1,1}d - acd acd c
-a(b|c){1,2}d - abd abd b
-a(b|c){1,2}d - abcd abcd c
-a(b|c){1,}d - abd abd b
-a(b|c){1,}d - abcd abcd c
-a(b|c){2,2}d - acbd acbd b
-a(b|c){2,2}d - abcd abcd c
-a(b|c){2,4}d - abcd abcd c
-a(b|c){2,4}d - abcbd abcbd b
-a(b|c){2,4}d - abcbcd abcbcd c
-a(b|c){2,}d - abcd abcd c
-a(b|c){2,}d - abcbd abcbd b
-a(b+|((c)*))+d - abd abd @d,@d,-
-a(b+|((c)*))+d - abcd abcd @d,@d,-
-
-# check out the STARTEND option
-[abc] &# a(b)c b
-[abc] &# a(d)c
-[abc] &# a(bc)d b
-[abc] &# a(dc)d c
-. &# a()c
-b.*c &# b(bc)c bc
-b.* &# b(bc)c bc
-.*c &# b(bc)c bc
-
-# plain strings, with the NOSPEC flag
-abc m abc abc
-abc m xabcy abc
-abc m xyz
-a*b m aba*b a*b
-a*b m ab
-"" mC EMPTY
-
-# cases involving NULs
-aZb & a a
-aZb &p a
-aZb &p# (aZb) aZb
-aZ*b &p# (ab) ab
-a.b &# (aZb) aZb
-a.* &# (aZb)c aZb
-
-# word boundaries (ick)
-[[:<:]]a & a a
-[[:<:]]a & ba
-[[:<:]]a & -a a
-a[[:>:]] & a a
-a[[:>:]] & ab
-a[[:>:]] & a- a
-[[:<:]]a.c[[:>:]] & axcd-dayc-dazce-abc abc
-[[:<:]]a.c[[:>:]] & axcd-dayc-dazce-abc-q abc
-[[:<:]]a.c[[:>:]] & axc-dayc-dazce-abc axc
-[[:<:]]b.c[[:>:]] & a_bxc-byc_d-bzc-q bzc
-[[:<:]].x..[[:>:]] & y_xa_-_xb_y-_xc_-axdc _xc_
-[[:<:]]a_b[[:>:]] & x_a_b
-
-# past problems, and suspected problems
-(A[1])|(A[2])|(A[3])|(A[4])|(A[5])|(A[6])|(A[7])|(A[8])|(A[9])|(A[A]) - A1 A1
-abcdefghijklmnop i abcdefghijklmnop abcdefghijklmnop
-abcdefghijklmnopqrstuv i abcdefghijklmnopqrstuv abcdefghijklmnopqrstuv
-(ALAK)|(ALT[AB])|(CC[123]1)|(CM[123]1)|(GAMC)|(LC[23][EO ])|(SEM[1234])|(SL[ES][12])|(SLWW)|(SLF )|(SLDT)|(VWH[12])|(WH[34][EW])|(WP1[ESN]) - CC11 CC11
-CC[13]1|a{21}[23][EO][123][Es][12]a{15}aa[34][EW]aaaaaaa[X]a - CC11 CC11
-Char \([a-z0-9_]*\)\[.* b Char xyz[k Char xyz[k xyz
-a?b - ab ab
--\{0,1\}[0-9]*$ b -5 -5
diff --git a/regex/utils.h b/regex/utils.h
deleted file mode 100644
index cd4a96025f..0000000000
--- a/regex/utils.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/* utility definitions */
-
-#include "regex_extra.h"
-
-#ifdef _POSIX2_RE_DUP_MAX
-#define DUPMAX _POSIX2_RE_DUP_MAX
-#else
-#define DUPMAX 255
-#endif
-#define INFINITY (DUPMAX + 1)
-#define NC (CHAR_MAX - CHAR_MIN + 1)
-typedef unsigned char uch;
-
-/* switch off assertions (if not already off) if no REDEBUG */
-#ifndef REDEBUG
-#ifndef NDEBUG
-#define NDEBUG /* no assertions please */
-#endif
-#endif
-#include <assert.h>
-
-/* for old systems with bcopy() but no memmove() */
-#ifdef USEBCOPY
-#define memmove(d, s, c) bcopy(s, d, c)
-#endif
diff --git a/run-tests.php b/run-tests.php
deleted file mode 100755
index 71e6f4e835..0000000000
--- a/run-tests.php
+++ /dev/null
@@ -1,564 +0,0 @@
-<?php
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Stig Bakken <ssb@fast.no> |
- | (based on the PHP 3 test framework by Rasmus Lerdorf) |
- +----------------------------------------------------------------------+
- */
-
-/*
- * TODO:
- * - look for test-specific php.ini files
- * - implement module skipping for PEAR
- * - do not test PEAR components if base class and/or component class cannot be instanciated
- */
-
-ob_implicit_flush();
-
-define('TEST_PASSED', 0);
-define('TEST_FAILED', -1);
-define('TEST_SKIPPED', -2);
-define('TEST_INTERNAL_ERROR', -3);
-
-define('EXT_DIR_NAME','/php4/ext/');
-define('EXT_DIR_NAME_LEN',strlen(EXT_DIR_NAME));
-
-initialize();
-/*
-$opts = parse_options(&$argc, &$argv);
-if ($opts['help']) {
- usage();
- exit;
-}
-*/
-do_testing($argc, $argv);
-
-exit;
-
-/*****************************************************************************/
-
-function usage()
-{
- dowriteln("Usage: run-tests.php [-d] [-h] [dir|file...]");
-}
-
-/*
- * Please use dowrite() and dowriteln() for all screen output.
- * This makes it easier to convert to HTML output later.
- */
-
-function dowrite($str)
-{
- global $term_bold, $term_norm;
- $str = str_replace("%b", $term_bold, $str);
- $str = str_replace("%B", $term_norm, $str);
- print $str;
-}
-
-function dowriteln($str)
-{
- dowrite("$str\n");
-}
-
-function create_compiled_in_modules_list() {
- global $compiled_in_modules;
- $compiled_in_modules = @get_loaded_extensions();
-}
-
-function extract_module_name_from_path($path) {
- if ($pos1=strpos($path,EXT_DIR_NAME)) {
- $pos3=strpos($path,'/',$pos1+EXT_DIR_NAME_LEN);
- return substr($path,$pos2=$pos1+EXT_DIR_NAME_LEN,$pos3-$pos2);
- }
-}
-
-
-function create_found_tests_4_modules_list() {
- global $modules_2_test,$testdirs;
-
- foreach ($testdirs AS $path) {
- if ($mod_name=extract_module_name_from_path($path))
- $modules_2_test[$mod_name]=TRUE;
- }
-}
-
-function create_modules_2_test_list() {
- global $compiled_in_modules,$modules_2_test,$modules_available;
- foreach ($compiled_in_modules AS $value)
- if ($modules_2_test[$value]) $modules_available[]=$value;
-}
-
-
-
-function initialize()
-{
- global $term, $windows_p, $php, $skip, $testdirs, $tmpfile,
- $skipped, $failed, $passed, $total, $term_bold, $term_norm,
- $tests_in_dir;
-
- // XXX Should support HTML output as well.
- $term = getenv("TERM");
- if (ereg('^(xterm|vt220)', $term)) {
- $term_bold = sprintf("%c%c%c%c", 27, 91, 49, 109);
- $term_norm = sprintf("%c%c%c", 27, 91, 109);
- } elseif (ereg('^vt100', $term)) {
- $term_bold = sprintf("%c%c%c%c", 27, 91, 49, 109);
- $term_norm = sprintf("%c%c%c", 27, 91, 109);
- } else {
- $term_bold = $term_norm = "";
- }
-
- if((substr(PHP_OS, 0, 3) == "WIN")) {
- $windows_p = true;
- $term = getenv("COMSPEC");
- $null = getenv("TOP_BUILDDIR");
- $php = ($null ? $null : getcwd()) . "/php.exe";
- unset($null);
- } else {
- if (isset($GLOBALS["TOP_BUILDDIR"])) {
- $php = $GLOBALS["TOP_BUILDDIR"]."/php";
- } else {
- $php = getcwd() . '/php';
- }
- }
-
- create_compiled_in_modules_list();
-
- if (!is_executable($php) && !$windows_p) {
- dowriteln("PHP CGI binary ($php) is not executable.");
- dowriteln("Please compile PHP as a CGI executable and try again.");
- exit;
- }
-
- $skip = array(
- "CVS" => 1
- );
- $testdirs = array();
- $tmpfile = array();
- $tests_in_dir = array();
-
- register_shutdown_function("delete_tmpfiles");
-
- $skipped = $failed = $passed = $total = 0;
-}
-
-function &parse_options(&$argc, &$argv)
-{
- $options = array();
- while ($argc > 0 && ($opt = substr($argv[0], 0, 2)) == "--") {
- $opt = array_shift($argv);
- $argc--;
- if ($arg == "--") {
- return $options;
- }
- if (ereg('^--([^=]+)=(.*)$', $opt, $matches)) {
- $opt = $matches[1];
- $arg = $matches[2];
- } else {
- $arg = true;
- }
- $options[$opt] = $arg;
- }
- return $options;
-}
-
-function do_testing($argc, &$argv)
-{
- global $term, $windows_p, $php, $skip, $testdirs, $tmpfile, $opts,
- $skipped, $failed, $passed, $total, $term_bold, $term_norm, $skipped_extensions;
-
- if ($argc > 1) {
- if (is_dir($argv[1])) {
- $dir = $argv[1];
- } else {
- for ($i = 1; $i < $argc; $i++) {
- switch (run_test($argv[$i])) {
- case TEST_SKIPPED:
- case TEST_INTERNAL_ERROR:
- $skipped++;
- break;
- case TEST_FAILED:
- $failed++;
- break;
- case TEST_PASSED:
- $passed++;
- break;
- }
- $total++;
- }
- }
- } else {
- // $dir = $GLOBALS["TOP_SRCDIR"]; // XXX ??? where should this variable be set?
- $dir=str_replace('\\','/',trim(($windows_p ? getenv("TEST_DIR"):`pwd`)));
- }
- if (isset($dir) && $dir) {
- find_testdirs($dir);
-
- create_found_tests_4_modules_list();
- create_modules_2_test_list();
-
- for ($i = 0; $i < sizeof($testdirs); $i++) {
- run_tests_in_dir($testdirs[$i]);
- }
- }
-
- $counting = $total - $skipped;
-
- if ($counting <= 0) {
- dowriteln("No tests were run.");
- return;
- }
-
- $total_d = (double)$total;
- $counting_d = (double)$counting;
- $passed_p = 100 * ($passed / $counting_d);
- $failed_p = 100 * ($failed / $counting_d);
- $skipped_p = 100 * ($skipped / $total_d);
- $passed_pstr = sprintf($passed_p < 10.0 ? "%1.1f" : "%3.0f", $passed_p);
- $failed_pstr = sprintf($failed_p < 10.0 ? "%1.1f" : "%3.0f", $failed_p);
- $skipped_pstr = sprintf($skipped_p < 10.0 ? "%1.1f" : "%3.0f", $skipped_p);
-
- dowriteln("TEST RESULT SUMMARY");
- dowriteln("=============================");
- dowriteln(sprintf("Number of tests: %4d", $total));
- dowriteln(sprintf("Tests skipped: %4d (%s%%)", $skipped, $skipped_pstr));
- dowriteln(sprintf("Tests failed: %4d (%s%%)", $failed, $failed_pstr));
- dowriteln(sprintf("Tests passed: %4d (%s%%)", $passed, $passed_pstr));
- dowriteln("=============================");
- dowriteln("Skipped ".sizeof($skipped_extensions)." extensions.");
- dowriteln("PHP Version: ".phpversion());
-}
-
-function find_testdirs($dir = '.', $first_pass = true)
-{
- global $testdirs, $skip;
-
- if ($first_pass && is_dir($dir)) {
- $testdirs[] = $dir;
- }
- $dp = @opendir($dir);
- if (!$dp) {
- print "Warning: could not open directory $dir\n";
- return false;
- }
- while ($ent = readdir($dp)) {
- $path = "$dir/$ent";
-
- if ((isset($skip[$ent]) && $skip[$ent])
- || substr($ent, 0, 1) == "."
- || !is_dir($path)
-
- ) {
- continue;
- }
-
- if (strstr("/$path/", "/tests/")) {
- $testdirs[] = $path;
- }
- find_testdirs($path, false);
- }
- closedir($dp);
-
-}
-
-function run_tests_in_dir($dir = '.')
-{
- global $skip, $skipped, $failed, $passed, $total, $opts, $tests_in_dir,$modules_available,$skipped_extensions;
- $dp = opendir($dir);
- if (!$dp) {
- print "Warning: could not run tests in $dir\n";
- return false;
- }
- $testfiles = array();
- while ($ent = readdir($dp)) {
- if ((isset($skip[$ent]) && $skip[$ent]) || substr($ent, 0, 1) == "." || substr($ent, -5) != ".phpt") {
- continue;
- }
- $testfiles[] = "$dir/$ent";
- if(isset($tests_in_dir[$dir])) $tests_in_dir[$dir]++; else $tests_in_dir[$dir]=1;
- }
- closedir($dp);
- if (isset($tests_in_dir[$dir]) && ($tests_in_dir[$dir] == 0)) {
- return true;
- }
- $oskipped = $skipped;
- if (sizeof($testfiles) == 0) {
- return;
- }
-
- if ($mod_name=extract_module_name_from_path($dir)) {
- if ($ext_found=in_array($mod_name,$modules_available))
- dowriteln("Testing extension: $mod_name");
- else $skipped_extensions[$mod_name]=TRUE;
- }
-
- if ($ext_found!==FALSE) {
- dowriteln("%bRunning tests in $dir%B");
- dowriteln("=================".str_repeat("=", strlen($dir)));
- sort($testfiles);
- for ($i = 0; $i < sizeof($testfiles); $i++) {
- switch (run_test($testfiles[$i])) {
- case TEST_SKIPPED:
- case TEST_INTERNAL_ERROR:
- $skipped++;
- break;
- case TEST_FAILED:
- $failed++;
- break;
- case TEST_PASSED:
- $passed++;
- break;
- }
- $total++;
- }
- if ($oskipped + (isset($tests_in_dir[$dir])?$tests_in_dir[$dir]:0) == $skipped) {
- $skippednow = $skipped - $oskipped;
- dowriteln("[all $skippednow test(s) skipped]");
- }
- dowriteln("");
- }
-
- return true;
-}
-
-function skip_headers($fp)
-{
- while (!feof($fp)) {
- if (trim(fgets($fp, 1024)) == "") {
- break;
- }
- }
-}
-
-function delete_tmpfiles()
-{
- global $tmpfile;
- reset($tmpfile);
- while (list($k, $v) = each($tmpfile)) {
- if (file_exists($v)) {
- //print "unlink($v): "; var_dump(unlink($v));
- unlink($v);
- }
- }
-}
-
-/**
- * Compares two files, ignoring blank lines.
- *
- * @param $file1 string name of first file to compare
- * @param $file2 string name of second file to compare
- *
- * @return bool whether the files were "equal"
- */
-function compare_results($file1, $file2)
-{
- $data1 = $data2 = "";
- if (!($fp1 = @fopen($file1, "r")) || !($fp2 = @fopen($file2, "r"))) {
- return false;
- }
-
- while (!(feof($fp1) || feof($fp2))) {
- if (!feof($fp1) && trim($line1 = fgets($fp1, 10240)) != "") {
- //print "adding line1 $line1\n";
-
- $data1 .= trim($line1);
- }
- if (!feof($fp2) && trim($line2 = fgets($fp2, 10240)) != "") {
- //print "adding line2 $line2\n";
-
- $data2 .= trim($line2);
- }
- }
- fclose($fp1);
- fclose($fp2);
- if ((trim($data1) != trim($data2))
- || ($data1=='' && $data2=='')) {
- //print "data1=";var_dump($data1);
- //print "data2=";var_dump($data2);
- return false;
- }
- return true;
-}
-
-function run_test($file)
-{
- global $php, $tmpfile, $term_bold, $term_norm, $term, $windows_p;
-
- $variables = array("TEST", "POST", "GET", "FILE", "EXPECT", "SKIPIF",
- "OUTPUT");
- $fp = @fopen($file, "r");
- if (!$fp) {
- return TEST_INTERNAL_ERROR;
- }
- $tmpdir = dirname($file);
- $tmpfix = "phpt.";
- $tmpfile["FILE"] = tempnam($tmpdir, $tmpfix);
- $tmpfile["SKIPIF"] = tempnam($tmpdir, $tmpfix);
- $tmpfile["POST"] = tempnam($tmpdir, $tmpfix);
-
- $tmpfile["EXPECT"] = tempnam($tmpdir, $tmpfix);
- $tmpfile["OUTPUT"] = tempnam($tmpdir, $tmpfix);
-
-
- while ($line = fgets($fp, 4096)) {
- if (ereg('^--([A-Z]+)--', $line, $matches)) {
- $var = $matches[1];
- if (isset($tmpfile[$var]) && $tmpfile[$var]) {
- $fps[$var] = @fopen($tmpfile[$var], "w");
- } else {
- $$var = '';
- }
- } else {
- if (isset($var) && $var) {
- if ($var == "POST") {
- $line = trim($line);
- }
- if (isset($fps[$var]) && $fps[$var]) {
- fwrite($fps[$var], $line);
- } else {
- $$var .= $line;
- }
- }
- }
- }
- if(isset($fps) && is_array($fps)) {
- reset($fps);
- while (list($k, $v) = each($fps)) {
- if (is_resource($v)) {
- fclose($v);
- }
- }
- }
- putenv("PHP_TEST=1");
- putenv("REDIRECT_STATUS=1");
- putenv("CONTENT_LENGTH=");
- putenv("QUERY_STRING=".(isset($GET)?$GET:""));
- $include_path = ini_get("include_path");
- if (isset($fps["SKIPIF"])) {
- $tmpfile["SKIPIF_OUTPUT"] = tempnam($tmpdir, $tmpfix);
- putenv("REQUEST_METHOD=GET");
- putenv("CONTENT_TYPE=");
- putenv("PATH_TRANSLATED=$tmpfile[SKIPIF]");
- putenv("SCRIPT_FILENAME=$tmpfile[SKIPIF]");
- $skipifcmd = "$php -q -f $tmpfile[SKIPIF] > $tmpfile[SKIPIF_OUTPUT]";
- system($skipifcmd, $ret);
- $sp = @fopen($tmpfile["SKIPIF_OUTPUT"], "r");
- if ($sp) {
- skip_headers($sp);
- $skip = trim(fgets($sp, 1024));
- fclose($sp);
- if ($skip == "skip") {
- delete_tmpfiles();
- return TEST_SKIPPED;
- }
- }
- }
- putenv("PATH_TRANSLATED=$tmpfile[FILE]");
- putenv("SCRIPT_FILENAME=$tmpfile[FILE]");
- if (isset($fps["POST"])) {
- putenv("REQUEST_METHOD=POST");
- putenv("CONTENT_TYPE=application/x-www-form-urlencoded");
- putenv("CONTENT_LENGTH=".filesize($tmpfile["POST"]));
- } else {
- putenv("REQUEST_METHOD=GET");
- putenv("CONTENT_TYPE=");
- putenv("CONTENT_LENGTH=");
- }
- if (isset($fps["POST"])) {
- if(!$windows_p) {
- $cmd = "2>&1 $php -q $tmpfile[FILE] < $tmpfile[POST]";
- }
- else {
- $cmd = "$term /c " . realpath($php) ." -q $tmpfile[FILE] < $tmpfile[POST]";
- }
- } else {
- if(!$windows_p) {
- $cmd = "2>&1 $php -q $tmpfile[FILE]";
- }
- else {
- $cmd = "$term /c " . realpath($php) ." -q $tmpfile[FILE]";;
- }
- }
- $ofp = @fopen($tmpfile["OUTPUT"], "w");
- if (!$ofp) {
- dowriteln("Error: could not write to output file");
- delete_tmpfiles();
- return TEST_INTERNAL_ERROR;
- }
- //echo $cmd;
- $cp = popen($cmd, "r");
- if (!$cp) {
- dowriteln("Error: could not execute: $cmd");
- delete_tmpfiles();
- return TEST_INTERNAL_ERROR;
- }
- skip_headers($cp);
- while ($data = fread($cp, 2048)) {
- fwrite($ofp, $data);
- }
- fclose($ofp);
- pclose($cp);
- $desc = isset($TEST)?trim($TEST):"";
- $outfile = ereg_replace('\.phpt$', '.out', $file);
- $expectfile = ereg_replace('\.phpt$', '.exp', $file);
- $phpfile = ereg_replace('\.phpt$', '.php', $file);
- if (compare_results($tmpfile["OUTPUT"], $tmpfile["EXPECT"])) {
- $status = TEST_PASSED;
- $text = "passed";
- $pre = $post = "";
- if (file_exists($outfile)) {
- unlink($outfile);
- }
- if (file_exists($expectfile)) {
- unlink($expectfile);
- }
- if (file_exists($phpfile)) {
- unlink($phpfile);
- }
- } else {
- //system("env");
- $status = TEST_FAILED;
- $text = "failed";
- $pre = $term_bold;
- $post = $term_norm;
- $desc .= " (".basename($file).")";
- if (file_exists($outfile)) {
- unlink($outfile);
- }
- copy($tmpfile["OUTPUT"], $outfile);
- copy($tmpfile["EXPECT"], $expectfile);
- copy($tmpfile["FILE"], $phpfile);
- }
- dowriteln(sprintf("%s%-68s ... %s%s", $pre, substr($desc, 0, 68),
- $text, $post));
-// if ($status == TEST_FAILED) {
-// for ($i = 0; $i < sizeof($variables); $i++) {
-// $var = $variables[$i];
-// print "$var:\n";
-// if ($tmpfile[$var]) {
-// if (file_exists($tmpfile[$var])) {
-// system("cat ".$tmpfile[$var]);
-// }
-// } else {
-// print $$var;
-// }
-// }
-// print "--\n\n";
-// }
- delete_tmpfiles();
- return $status;
-}
-
-?>
diff --git a/sapi/Makefile.in b/sapi/Makefile.in
deleted file mode 100644
index 089a1e4a65..0000000000
--- a/sapi/Makefile.in
+++ /dev/null
@@ -1,4 +0,0 @@
-
-SUBDIRS = $(PHP_SAPI)
-
-include $(top_srcdir)/build/rules.mk
diff --git a/sapi/README b/sapi/README
deleted file mode 100644
index d9a759dd93..0000000000
--- a/sapi/README
+++ /dev/null
@@ -1,17 +0,0 @@
-Each SAPI backend has to contain:
-
-config.m4: just like for extensions, this file contains
-autoconf directives that end up in the configure script. The
-only difference is that the sapi config.m4 files are read in diversion
-(output block) 2 instead of 3. The sapi config.m4 files should set
-two variables: PHP_SAPI (which sapi backend to choose) and INSTALL_IT
-(the actions performed when "make install" is executed). If they are
-not specified, they will default to "cgi" and "do nothing,"
-respectively. Additionally, the following m4 macros can be used to
-influence what is created during "make":
-
-PHP_BUILD_SHARED -- build shared target $SAPI_SHARED
-PHP_BUILD_STATIC -- build static target $SAPI_STATIC
-PHP_BUILD_PROGRAM -- build executable $SAPI_PROGRAM
-
-(paths relative to top build dir)
diff --git a/sapi/aolserver/CREDITS b/sapi/aolserver/CREDITS
deleted file mode 100644
index 8f9a4af950..0000000000
--- a/sapi/aolserver/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-AOLserver
-Sascha Schumann
diff --git a/sapi/aolserver/Makefile.in b/sapi/aolserver/Makefile.in
deleted file mode 100644
index 96a33af6bd..0000000000
--- a/sapi/aolserver/Makefile.in
+++ /dev/null
@@ -1,5 +0,0 @@
-
-LTLIBRARY_NAME = libsapi.la
-LTLIBRARY_SOURCES = aolserver.c
-
-include $(top_srcdir)/build/ltlib.mk
diff --git a/sapi/aolserver/README b/sapi/aolserver/README
deleted file mode 100644
index 0a725a10bc..0000000000
--- a/sapi/aolserver/README
+++ /dev/null
@@ -1,69 +0,0 @@
-AOLserver README ($Id$)
-
-To compile PHP 4.0 as a module for AOLserver, you need:
-
-- installed AOLserver 3.1 or later
- (see the note below for AOLserver 3.0)
-
-NOTE: You should not use this module in production. PHP is not 100% stable
- yet in threaded mode. To increase reliability enable the Global Lock
- by removing #define NO_GLOBAL_LOCK in main/main.c. Also don't use
- php_value as it will lead to races in a sub-system (use an ini file
- instead).
-
-
-1.) Configuring AOLserver
-
-Read doc/install.txt in the source distribution
-
-It usually boils down to changing the INST/PREFIX variable in
-include/Makefile.global and running make all install.
-
-2.) Configuring PHP
-
-$ ./configure \
- --with-aolserver=/path/to/installed/aolserver \
- <other options>
-
-NOTE: If you are still using AOLserver 3.0, you need to retain the
- AOLserver source code and pass another option to PHP:
-
- --with-aolserver-src=/path/to/source/distribution
-
-3.) Compiling and Installing PHP
-
-$ make install
-
-4.) Changing nsd.tcl
-
-a) New section
-
-Add a new section to pass options to PHP (required):
-
-ns_section "ns/server/${servername}/module/php"
-
-You can use the following commands in this section:
-
-The 'map' command will cause AOLserver to pass all requests to *.php to
-the PHP module (can be specified multiple times). Example:
-
-ns_param map *.php
-
-The 'php_value "name val"' command assigns the configuration option name
-the value val (can be used multiple times). Example:
-
-ns_param php_value "session.auto_start 1"
-
-b) Enabling PHP
-
-Then enable the PHP module:
-
-ns_section "ns/server/${servername}/modules"
-...
-ns_param php ${bindir}/libphp4.so
-
-
-=============================================================================
-This has been tested with AOLserver release 3.0.
-
-AOLserver support has been written by Sascha Schumann <sascha@schumann.cx>.
diff --git a/sapi/aolserver/aolserver.c b/sapi/aolserver/aolserver.c
deleted file mode 100644
index 81dbda5346..0000000000
--- a/sapi/aolserver/aolserver.c
+++ /dev/null
@@ -1,639 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Sascha Schumann <sascha@schumann.cx> |
- +----------------------------------------------------------------------+
- */
-
-/*
- * TODO:
- * - write documentation
- * - CGI/1.1 conformance
- */
-
-/* $Id$ */
-
-/* conflict between PHP and AOLserver headers */
-#define Debug php_Debug
-#include "php.h"
-#undef Debug
-
-#ifdef HAVE_AOLSERVER
-
-#ifndef ZTS
-#error AOLserver module is only useable in thread-safe mode
-#endif
-
-#include "ext/standard/info.h"
-#define SECTION(name) PUTS("<H2 align=\"center\">" name "</H2>\n")
-
-#define NS_BUF_SIZE 511
-
-#include "php_ini.h"
-#include "php_globals.h"
-#include "SAPI.h"
-#include "php_main.h"
-#include "php_variables.h"
-
-#include "ns.h"
-
-#include "php_version.h"
-
-/* This symbol is used by AOLserver to tell the API version we expect */
-
-int Ns_ModuleVersion = 1;
-
-#define NSLS_D ns_globals_struct *ns_context
-#define NSLS_DC , NSLS_D
-#define NSLS_C ns_context
-#define NSLS_CC , NSLS_C
-#define NSG(v) (ns_context->v)
-#define NSLS_FETCH() ns_globals_struct *ns_context = ts_resource(ns_globals_id)
-
-/* php_ns_context is per-server (thus only once at all) */
-
-typedef struct {
- sapi_module_struct *sapi_module;
- char *ns_server;
- char *ns_module;
-} php_ns_context;
-
-/* ns_globals_struct is per-thread */
-
-typedef struct {
- Ns_Conn *conn;
- size_t data_avail;
-} ns_globals_struct;
-
-/* TSRM id */
-
-static int ns_globals_id;
-
-/* global context */
-
-static php_ns_context *global_context;
-
-static void php_ns_config(php_ns_context *ctx, char global);
-
-/*
- * php_ns_sapi_ub_write() writes data to the client connection.
- */
-
-static int
-php_ns_sapi_ub_write(const char *str, uint str_length)
-{
- int n;
- uint sent = 0;
- NSLS_FETCH();
-
- while (str_length > 0) {
- n = Ns_ConnWrite(NSG(conn), (void *) str, str_length);
-
- if (n == -1)
- php_handle_aborted_connection();
-
- str += n;
- sent += n;
- str_length -= n;
- }
-
- return sent;
-}
-
-/*
- * php_ns_sapi_header_handler() sets a HTTP reply header to be
- * sent to the client.
- */
-
-static int
-php_ns_sapi_header_handler(sapi_header_struct *sapi_header, sapi_headers_struct *sapi_headers SLS_DC)
-{
- char *header_name, *header_content;
- char *p;
- NSLS_FETCH();
-
- header_name = sapi_header->header;
- header_content = p = strchr(header_name, ':');
-
- if (p) {
- *p = '\0';
- do {
- header_content++;
- } while (*header_content == ' ');
-
- if (!strcasecmp(header_name, "Content-type")) {
- Ns_ConnSetTypeHeader(NSG(conn), header_content);
- } else {
- Ns_ConnSetHeaders(NSG(conn), header_name, header_content);
- }
-
- *p = ':';
- }
-
- sapi_free_header(sapi_header);
-
- return 0;
-}
-
-/*
- * php_ns_sapi_send_headers() flushes the headers to the client.
- * Called before real content is sent by PHP.
- */
-
-static int
-php_ns_sapi_send_headers(sapi_headers_struct *sapi_headers SLS_DC)
-{
- NSLS_FETCH();
-
- if(SG(sapi_headers).send_default_content_type) {
- Ns_ConnSetRequiredHeaders(NSG(conn), "text/html", 0);
- }
-
- Ns_ConnFlushHeaders(NSG(conn), SG(sapi_headers).http_response_code);
-
- return SAPI_HEADER_SENT_SUCCESSFULLY;
-}
-
-/*
- * php_ns_sapi_read_post() reads a specified number of bytes from
- * the client. Used for POST/PUT requests.
- */
-
-static int
-php_ns_sapi_read_post(char *buf, uint count_bytes SLS_DC)
-{
- uint max_read;
- uint total_read = 0;
- NSLS_FETCH();
-
- max_read = MIN(NSG(data_avail), count_bytes);
-
- total_read = Ns_ConnRead(NSG(conn), buf, max_read);
-
- if(total_read == NS_ERROR) {
- total_read = -1;
- } else {
- NSG(data_avail) -= total_read;
- }
-
- return total_read;
-}
-
-/*
- * php_ns_sapi_read_cookies() returns the Cookie header from
- * the HTTP request header
- */
-
-static char *
-php_ns_sapi_read_cookies(SLS_D)
-{
- int i;
- char *http_cookie = NULL;
- NSLS_FETCH();
-
- i = Ns_SetIFind(NSG(conn->headers), "cookie");
- if(i != -1) {
- http_cookie = Ns_SetValue(NSG(conn->headers), i);
- }
-
- return http_cookie;
-}
-
-static void php_info_aolserver(ZEND_MODULE_INFO_FUNC_ARGS)
-{
- char buf[512];
- int uptime = Ns_InfoUptime();
- int i;
- NSLS_FETCH();
-
- php_info_print_table_start();
- php_info_print_table_row(2, "SAPI module version", "$Id$");
- php_info_print_table_row(2, "Build date", Ns_InfoBuildDate());
- php_info_print_table_row(2, "Config file path", Ns_InfoConfigFile());
- php_info_print_table_row(2, "Error Log path", Ns_InfoErrorLog());
- php_info_print_table_row(2, "Installation path", Ns_InfoHomePath());
- php_info_print_table_row(2, "Hostname of server", Ns_InfoHostname());
- php_info_print_table_row(2, "Source code label", Ns_InfoLabel());
- php_info_print_table_row(2, "Server platform", Ns_InfoPlatform());
- snprintf(buf, 511, "%s/%s", Ns_InfoServerName(), Ns_InfoServerVersion());
- php_info_print_table_row(2, "Server version", buf);
- snprintf(buf, 511, "%d day(s), %02d:%02d:%02d",
- uptime / 86400,
- (uptime / 3600) % 24,
- (uptime / 60) % 60,
- uptime % 60);
- php_info_print_table_row(2, "Server uptime", buf);
- php_info_print_table_end();
-
- SECTION("HTTP Headers Information");
- php_info_print_table_start();
- php_info_print_table_colspan_header(2, "HTTP Request Headers");
- php_info_print_table_row(2, "HTTP Request", NSG(conn)->request->line);
- for (i = 0; i < Ns_SetSize(NSG(conn)->headers); i++) {
- php_info_print_table_row(2, Ns_SetKey(NSG(conn)->headers, i), Ns_SetValue(NSG(conn)->headers, i));
- }
-
- php_info_print_table_colspan_header(2, "HTTP Response Headers");
- for (i = 0; i < Ns_SetSize(NSG(conn)->outputheaders); i++) {
- php_info_print_table_row(2, Ns_SetKey(NSG(conn)->outputheaders, i), Ns_SetValue(NSG(conn)->outputheaders, i));
- }
- php_info_print_table_end();
-}
-
-PHP_FUNCTION(getallheaders);
-
-static function_entry aolserver_functions[] = {
- PHP_FE(getallheaders, NULL)
- {0}
-};
-
-static zend_module_entry php_aolserver_module = {
- "AOLserver",
- aolserver_functions,
- NULL,
- NULL,
- NULL,
- NULL,
- php_info_aolserver,
- STANDARD_MODULE_PROPERTIES
-};
-
-PHP_FUNCTION(getallheaders)
-{
- int i;
- NSLS_FETCH();
-
- if (array_init(return_value) == FAILURE) {
- RETURN_FALSE;
- }
-
- for (i = 0; i < Ns_SetSize(NSG(conn->headers)); i++) {
- char *key = Ns_SetKey(NSG(conn->headers), i);
- char *value = Ns_SetValue(NSG(conn->headers), i);
-
- add_assoc_string(return_value, key, value, 1);
- }
-}
-
-static int
-php_ns_startup(sapi_module_struct *sapi_module)
-{
- if(php_module_startup(sapi_module) == FAILURE
- || zend_startup_module(&php_aolserver_module) == FAILURE) {
- return FAILURE;
- } else {
- return SUCCESS;
- }
-}
-
-
-/*
- * php_ns_sapi_register_variables() populates the php script environment
- * with a number of variables. HTTP_* variables are created for
- * the HTTP header data, so that a script can access these.
- */
-
-#define ADD_STRINGX(name,buf) \
- php_register_variable(name, buf, track_vars_array ELS_CC PLS_CC)
-
-#define ADD_STRING(name) \
- ADD_STRINGX(name, buf)
-
-static void
-php_ns_sapi_register_variables(zval *track_vars_array ELS_DC SLS_DC PLS_DC)
-{
- int i;
- char buf[NS_BUF_SIZE + 1];
- char *tmp;
- NSLS_FETCH();
-
- for(i = 0; i < Ns_SetSize(NSG(conn->headers)); i++) {
- char *key = Ns_SetKey(NSG(conn->headers), i);
- char *value = Ns_SetValue(NSG(conn->headers), i);
- char *p;
- char c;
- int buf_len;
-
- buf_len = snprintf(buf, NS_BUF_SIZE, "HTTP_%s", key);
- for(p = buf + 5; (c = *p); p++) {
- c = toupper(c);
- if(c < 'A' || c > 'Z') {
- c = '_';
- }
- *p = c;
- }
-
- ADD_STRINGX(buf, value);
- }
-
- snprintf(buf, NS_BUF_SIZE, "%s/%s", Ns_InfoServerName(), Ns_InfoServerVersion());
- ADD_STRING("SERVER_SOFTWARE");
- snprintf(buf, NS_BUF_SIZE, "HTTP/%1.1f", NSG(conn)->request->version);
- ADD_STRING("SERVER_PROTOCOL");
-
- ADD_STRINGX("REQUEST_METHOD", NSG(conn)->request->method);
-
- if(NSG(conn)->request->query)
- ADD_STRINGX("QUERY_STRING", NSG(conn)->request->query);
-
- ADD_STRINGX("SERVER_BUILDDATE", Ns_InfoBuildDate());
-
- ADD_STRINGX("REMOTE_ADDR", Ns_ConnPeer(NSG(conn)));
-
- snprintf(buf, NS_BUF_SIZE, "%d", Ns_ConnPeerPort(NSG(conn)));
- ADD_STRING("REMOTE_PORT");
-
- snprintf(buf, NS_BUF_SIZE, "%d", Ns_ConnPort(NSG(conn)));
- ADD_STRING("SERVER_PORT");
-
- tmp = Ns_ConnHost(NSG(conn));
- if (tmp)
- ADD_STRINGX("SERVER_NAME", tmp);
-
- ADD_STRINGX("PATH_TRANSLATED", SG(request_info).path_translated);
- ADD_STRINGX("REQUEST_URI", SG(request_info).request_uri);
- ADD_STRINGX("PHP_SELF", SG(request_info).request_uri);
-
- ADD_STRINGX("GATEWAY_INTERFACE", "CGI/1.1");
-
- snprintf(buf, NS_BUF_SIZE, "%d", Ns_InfoBootTime());
- ADD_STRING("SERVER_BOOTTIME");
-}
-
-
-
-/* this structure is static (as in "it does not change") */
-
-static sapi_module_struct aolserver_sapi_module = {
- "aolserver",
- "AOLserver",
-
- php_ns_startup, /* startup */
- php_module_shutdown_wrapper, /* shutdown */
-
- NULL, /* activate */
- NULL, /* deactivate */
-
- php_ns_sapi_ub_write, /* unbuffered write */
- NULL, /* flush */
- NULL, /* get uid */
- NULL, /* getenv */
-
- php_error, /* error handler */
-
- php_ns_sapi_header_handler, /* header handler */
- php_ns_sapi_send_headers, /* send headers handler */
- NULL, /* send header handler */
-
- php_ns_sapi_read_post, /* read POST data */
- php_ns_sapi_read_cookies, /* read Cookies */
-
- php_ns_sapi_register_variables,
- NULL, /* Log message */
-
- NULL, /* Block interruptions */
- NULL, /* Unblock interruptions */
-
- STANDARD_SAPI_MODULE_PROPERTIES
-};
-
-/*
- * php_ns_module_main() is called by the per-request handler and
- * "executes" the script
- */
-
-static int
-php_ns_module_main(NSLS_D SLS_DC)
-{
- zend_file_handle file_handle;
- CLS_FETCH();
- ELS_FETCH();
- PLS_FETCH();
-
- file_handle.type = ZEND_HANDLE_FILENAME;
- file_handle.filename = SG(request_info).path_translated;
- file_handle.free_filename = 0;
- file_handle.opened_path = NULL;
-
- php_ns_config(global_context, 0);
- if (php_request_startup(CLS_C ELS_CC PLS_CC SLS_CC) == FAILURE) {
- return NS_ERROR;
- }
-
- php_execute_script(&file_handle CLS_CC ELS_CC PLS_CC);
- php_request_shutdown(NULL);
-
- return NS_OK;
-}
-
-/*
- * php_ns_request_ctor() initializes the per-request data structure
- * and fills it with data provided by the web server
- */
-
-static void
-php_ns_request_ctor(NSLS_D SLS_DC)
-{
- char *server;
- Ns_DString ds;
- char *root;
- int index;
- char *tmp;
-
- server = Ns_ConnServer(NSG(conn));
-
-#define safe_strdup(x) ((x)?strdup((x)):NULL)
- SG(request_info).query_string = safe_strdup(NSG(conn->request->query));
-
- Ns_DStringInit(&ds);
- Ns_UrlToFile(&ds, server, NSG(conn->request->url));
-
- /* path_translated is the absolute path to the file */
- SG(request_info).path_translated = safe_strdup(Ns_DStringValue(&ds));
- Ns_DStringFree(&ds);
- root = Ns_PageRoot(server);
- SG(request_info).request_uri = strdup(SG(request_info).path_translated + strlen(root));
- SG(request_info).request_method = NSG(conn)->request->method;
- SG(request_info).content_length = Ns_ConnContentLength(NSG(conn));
- index = Ns_SetIFind(NSG(conn)->headers, "content-type");
- SG(request_info).content_type = index == -1 ? NULL :
- Ns_SetValue(NSG(conn)->headers, index);
- SG(sapi_headers).http_response_code = 200;
-
- tmp = Ns_ConnAuthUser(NSG(conn));
- if (tmp)
- tmp = estrdup(tmp);
- SG(request_info).auth_user = tmp;
-
- tmp = Ns_ConnAuthPasswd(NSG(conn));
- if (tmp)
- tmp = estrdup(tmp);
- SG(request_info).auth_password = tmp;
-
- NSG(data_avail) = SG(request_info).content_length;
-}
-
-/*
- * php_ns_request_dtor() destroys all data associated with
- * the per-request structure
- */
-
-static void
-php_ns_request_dtor(NSLS_D SLS_DC)
-{
- free(SG(request_info).path_translated);
- if (SG(request_info).query_string)
- free(SG(request_info).query_string);
- free(SG(request_info).request_uri);
-}
-
-/*
- * The php_ns_request_handler() is called per request and handles
- * everything for one request.
- */
-
-static int
-php_ns_request_handler(void *context, Ns_Conn *conn)
-{
- int status = NS_OK;
- SLS_FETCH();
- NSLS_FETCH();
-
- NSG(conn) = conn;
-
- SG(server_context) = global_context;
-
- php_ns_request_ctor(NSLS_C SLS_CC);
-
- status = php_ns_module_main(NSLS_C SLS_CC);
-
- php_ns_request_dtor(NSLS_C SLS_CC);
-
- return status;
-}
-
-/*
- * php_ns_config() fetches the configuration data.
- *
- * It understands the "map" and "php_value" command.
- */
-
-static void
-php_ns_config(php_ns_context *ctx, char global)
-{
- int i;
- char *path;
- Ns_Set *set;
-
- path = Ns_ConfigGetPath(ctx->ns_server, ctx->ns_module, NULL);
- set = Ns_ConfigGetSection(path);
-
- for (i = 0; set && i < Ns_SetSize(set); i++) {
- char *key = Ns_SetKey(set, i);
- char *value = Ns_SetValue(set, i);
-
- if (global && !strcasecmp(key, "map")) {
- Ns_Log(Notice, "Registering PHP for \"%s\"", value);
- Ns_RegisterRequest(ctx->ns_server, "GET", value, php_ns_request_handler, NULL, ctx, 0);
- Ns_RegisterRequest(ctx->ns_server, "POST", value, php_ns_request_handler, NULL, ctx, 0);
- Ns_RegisterRequest(ctx->ns_server, "HEAD", value, php_ns_request_handler, NULL, ctx, 0);
-
- /*
- * Deactivated for now. The ini system will cause random crashes when
- * accessed from here (since there are no locks to protect the global
- * known_directives)
- */
-
- } else if (!global && !strcasecmp(key, "php_value")) {
- Ns_Log(Notice, "php_value has been deactivated temporarily. Please use a php.ini file to pass directives to PHP. Thanks.");
-#if 0
- char *val;
-
- val = strchr(value, ' ');
- if (val) {
- char *new_key;
-
- new_key = estrndup(value, val - value);
-
- do {
- val++;
- } while(*val == ' ');
-
- Ns_Log(Debug, "PHP configuration option '%s=%s'", new_key, val);
- zend_alter_ini_entry(new_key, strlen(new_key) + 1, val,
- strlen(val) + 1, PHP_INI_SYSTEM, PHP_INI_STAGE_RUNTIME);
-
- efree(new_key);
- }
-#endif
- }
-
- }
-}
-
-/*
- * php_ns_server_shutdown() performs the last steps before the
- * server exits. Shutdowns basic services and frees memory
- */
-
-static void
-php_ns_server_shutdown(void *context)
-{
- php_ns_context *ctx = (php_ns_context *) context;
-
- ctx->sapi_module->shutdown(ctx->sapi_module);
- sapi_shutdown();
- tsrm_shutdown();
-
- free(ctx->ns_module);
- free(ctx->ns_server);
- free(ctx);
-}
-
-/*
- * Ns_ModuleInit() is called by AOLserver once at startup
- *
- * This functions allocates basic structures and initializes
- * basic services.
- */
-
-int Ns_ModuleInit(char *server, char *module)
-{
- php_ns_context *ctx;
-
- tsrm_startup(1, 1, 0, NULL);
- sapi_startup(&aolserver_sapi_module);
- sapi_module.startup(&aolserver_sapi_module);
-
- /* TSRM is used to allocate a per-thread structure */
- ns_globals_id = ts_allocate_id(sizeof(ns_globals_struct), NULL, NULL);
-
- /* the context contains data valid for all threads */
- ctx = malloc(sizeof *ctx);
- ctx->sapi_module = &aolserver_sapi_module;
- ctx->ns_server = strdup(server);
- ctx->ns_module = strdup(module);
-
- /* read the configuration */
- php_ns_config(ctx, 1);
-
- global_context = ctx;
-
- /* register shutdown handler */
- Ns_RegisterServerShutdown(server, php_ns_server_shutdown, ctx);
-
- return NS_OK;
-}
-
-#endif
diff --git a/sapi/aolserver/config.m4 b/sapi/aolserver/config.m4
deleted file mode 100644
index 790462d7c6..0000000000
--- a/sapi/aolserver/config.m4
+++ /dev/null
@@ -1,32 +0,0 @@
-dnl ## $Id$ -*- sh -*-
-
-AC_MSG_CHECKING(for AOLserver support)
-AC_ARG_WITH(aolserver,
-[ --with-aolserver=DIR Specify path to the installed AOLserver],[
- PHP_AOLSERVER=$withval
-],[
- PHP_AOLSERVER=no
-])
-AC_MSG_RESULT($PHP_AOLSERVER)
-
-if test "$PHP_AOLSERVER" != "no"; then
- if test -d "$PHP_AOLSERVER/include"; then
- PHP_AOLSERVER_SRC=$PHP_AOLSERVER
- fi
- if test -z "$PHP_AOLSERVER_SRC" || test ! -d $PHP_AOLSERVER_SRC/include; then
- AC_MSG_ERROR(Please specify the path to the source distribution of AOLserver using --with-aolserver-src=DIR)
- fi
- if test ! -d $PHP_AOLSERVER/bin ; then
- AC_MSG_ERROR(Please specify the path to the root of AOLserver using --with-aolserver=DIR)
- fi
- PHP_BUILD_THREAD_SAFE
- PHP_ADD_INCLUDE($PHP_AOLSERVER_SRC/include)
- AC_DEFINE(HAVE_AOLSERVER,1,[Whether you have AOLserver])
- PHP_SAPI=aolserver
- PHP_BUILD_SHARED
- INSTALL_IT="\$(INSTALL) -m 0755 $SAPI_SHARED \$(INSTALL_ROOT)$PHP_AOLSERVER/bin/"
-fi
-
-dnl ## Local Variables:
-dnl ## tab-width: 4
-dnl ## End:
diff --git a/sapi/aolserver/php.sym b/sapi/aolserver/php.sym
deleted file mode 100644
index b401ffd2b3..0000000000
--- a/sapi/aolserver/php.sym
+++ /dev/null
@@ -1,2 +0,0 @@
-Ns_ModuleVersion
-Ns_ModuleInit
diff --git a/sapi/aolserver/php4aolserver.dsp b/sapi/aolserver/php4aolserver.dsp
deleted file mode 100644
index 1d5a79598c..0000000000
--- a/sapi/aolserver/php4aolserver.dsp
+++ /dev/null
@@ -1,135 +0,0 @@
-# Microsoft Developer Studio Project File - Name="php4aolserver" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=php4aolserver - Win32 Debug_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "php4aolserver.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "php4aolserver.mak" CFG="php4aolserver - Win32 Debug_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "php4aolserver - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "php4aolserver - Win32 Release_TS_inline" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "php4aolserver - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "php4aolserver - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "..\..\Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PHP4AOLSERVER_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /I "..\..\..\php_build\nsapi30\include\\" /I "..\..\include" /I "..\..\win32" /I "..\..\Zend" /I "..\.." /I "..\..\..\bindlib_w32" /I "..\..\main" /I "..\..\tsrm" /D ZEND_DEBUG=0 /D "NDEBUG" /D "PHP4AOLSERVER_EXPORTS" /D "PHP_WIN32" /D "ZTS" /D "ZEND_WIN32" /D "_WINDOWS" /D "_USRDLL" /D "WIN32" /D "_MBCS" /D "HAVE_AOLSERVER" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 nsd.lib php4ts.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /base:"0x62000000" /version:4.0 /dll /machine:I386 /out:"../../Release_TS/php4aolserver.so" /libpath:"..\..\..\php_build\nsapi30\lib\\" /libpath:"..\..\Release_TS" /libpath:"..\..\TSRM\Release_TS" /libpath:"..\..\Zend\Release_TS"
-
-!ELSEIF "$(CFG)" == "php4aolserver - Win32 Release_TS_inline"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS_inline"
-# PROP BASE Intermediate_Dir "Release_TS_inline"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "..\..\Release_TS_inline"
-# PROP Intermediate_Dir "Release_TS_inline"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PHP4AOLSERVER_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /I "..\..\..\php_build\nsapi30\include\\" /I "..\..\include" /I "..\..\win32" /I "..\..\Zend" /I "..\.." /I "..\..\..\bindlib_w32" /I "..\..\main" /I "..\..\tsrm" /D ZEND_DEBUG=0 /D "ZEND_WIN32_FORCE_INLINE" /D "NDEBUG" /D "PHPAOLSERVER_EXPORTS" /D "PHP_WIN32" /D "ZTS" /D "ZEND_WIN32" /D "_WINDOWS" /D "_USRDLL" /D "WIN32" /D "_MBCS" /D "HAVE_AOLSERVER" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 nsd.lib php4ts.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /base:"0x62000000" /version:4.0 /dll /machine:I386 /out:"../../Release_TS_inline/php4aolserver.so" /libpath:"..\..\..\php_build\nsapi30\lib\\" /libpath:"..\..\Release_TS_inline" /libpath:"..\..\TSRM\Release_TS_inline" /libpath:"..\..\Zend\Release_TS_inline"
-
-!ELSEIF "$(CFG)" == "php4aolserver - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "..\..\Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PHP4AOLSERVER_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "." /I "..\..\..\php_build\nsapi30\include\\" /I "..\..\include" /I "..\..\win32" /I "..\..\Zend" /I "..\.." /I "..\..\..\bindlib_w32" /I "..\..\main" /I "..\..\tsrm" /D "_DEBUG" /D ZEND_DEBUG=1 /D "PHP4AOLSERVER_EXPORTS" /D "PHP_WIN32" /D "ZTS" /D "ZEND_WIN32" /D "_WINDOWS" /D "_USRDLL" /D "WIN32" /D "_MBCS" /D "HAVE_AOLSERVER" /FR /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 nsd.lib php4ts_debug.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /base:"0x62000000" /version:4.0 /dll /debug /machine:I386 /out:"..\..\Debug_TS/php4aolserver.so" /pdbtype:sept /libpath:"..\..\..\php_build\nsapi30\lib\\" /libpath:"..\..\Debug_TS" /libpath:"..\..\TSRM\Debug_TS" /libpath:"..\..\Zend\Debug_TS"
-
-!ENDIF
-
-# Begin Target
-
-# Name "php4aolserver - Win32 Release_TS"
-# Name "php4aolserver - Win32 Release_TS_inline"
-# Name "php4aolserver - Win32 Debug_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\aolserver.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/sapi/apache/CREDITS b/sapi/apache/CREDITS
deleted file mode 100644
index 991deb5633..0000000000
--- a/sapi/apache/CREDITS
+++ /dev/null
@@ -1,3 +0,0 @@
-Apache 1.3
-Rasmus Lerdorf, Zeev Suraski, Stig Bakken, David Sklar
-
diff --git a/sapi/apache/Makefile.in b/sapi/apache/Makefile.in
deleted file mode 100644
index 477b3a4762..0000000000
--- a/sapi/apache/Makefile.in
+++ /dev/null
@@ -1,7 +0,0 @@
-
-LTLIBRARY_NAME = libsapi.la
-LTLIBRARY_SOURCES = sapi_apache.c mod_php4.c php_apache.c
-
-EXTRA_INCLUDES = $(APACHE_INCLUDE)
-
-include $(top_srcdir)/build/ltlib.mk
diff --git a/sapi/apache/apMakefile.libdir b/sapi/apache/apMakefile.libdir
deleted file mode 100644
index 7b5254013a..0000000000
--- a/sapi/apache/apMakefile.libdir
+++ /dev/null
@@ -1,4 +0,0 @@
-This is a place-holder which indicates to Configure that it shouldn't
-provide the default targets when building the Makefile in this directory.
-Instead it'll just prepend all the important variable definitions, and
-copy the Makefile.tmpl onto the end.
diff --git a/sapi/apache/apMakefile.tmpl b/sapi/apache/apMakefile.tmpl
deleted file mode 100644
index f77b9975ba..0000000000
--- a/sapi/apache/apMakefile.tmpl
+++ /dev/null
@@ -1,77 +0,0 @@
-##
-## Apache 1.3 Makefile template for PHP 4.0 Module
-## [src/modules/php4/Makefile.tmpl]
-##
-
-# the parametrized target
-LIB=libphp4.$(LIBEXT)
-
-# objects for building the static library
-OBJS=mod_php4.o
-OBJS_LIB=libmodphp4.a
-
-# objects for building the shared object library
-SHLIB_OBJS=mod_php4.so-o
-SHLIB_OBJS_LIB=libmodphp4.a
-
-# the general targets
-all: lib
-lib: $(LIB)
-
-# build the static library by merging the object files
-libphp4.a: $(OBJS) $(OBJS_LIB)
- cp $(OBJS_LIB) $@
- ar r $@ $(OBJS)
- $(RANLIB) $@
-
-# ugly hack to support older Apache-1.3 betas that don't set $LIBEXT
-libphp4.: $(OBJS) $(OBJS_LIB)
- cp $(OBJS_LIB) $@
- ar r $@ $(OBJS)
- $(RANLIB) $@
- cp libphp4. libphp4.a
-
-# build the shared object library by linking the object files
-libphp4.so: $(SHLIB_OBJS) $(SHLIB_OBJS_LIB)
- rm -f $@
- $(LD_SHLIB) $(LDFLAGS_SHLIB) -o $@ $(SHLIB_OBJS) $(SHLIB_OBJS_LIB) $(LIBS)
-
-# 1. extension .o for shared objects cannot be used here because
-# first these files aren't still shared objects and second we
-# have to use a different name to trigger the different
-# implicit Make rule
-# 2. extension -so.o (as used elsewhere) cannot be used because
-# the suffix feature of Make really wants just .x, so we use
-# extension .so-o
-.SUFFIXES: .o .so-o
-.c.o:
- $(CC) -c $(INCLUDES) $(CFLAGS) $(CPPFLAGS) $(SPACER) $<
-.c.so-o:
- $(CC) -c $(INCLUDES) $(CFLAGS) $(CFLAGS_SHLIB) $(CPPFLAGS) $(SPACER) $< && mv $*.o $*.so-o
-
-# cleanup
-clean:
- -rm -f $(OBJS) $(SHLIB_OBJS) $(LIB)
-
-# We really don't expect end users to use this rule. It works only with
-# gcc, and rebuilds Makefile.tmpl. You have to re-run Configure after
-# using it.
-depend:
- cp Makefile.tmpl Makefile.tmpl.bak \
- && sed -ne '1,/^# DO NOT REMOVE/p' Makefile.tmpl > Makefile.new \
- && gcc -MM $(INCLUDES) $(CFLAGS) $(CPPFLAGS) *.c >> Makefile.new \
- && sed -e '1,$$s: $(INCDIR)/: $$(INCDIR)/:g' Makefile.new \
- > Makefile.tmpl \
- && rm Makefile.new
-
-#Dependencies
-
-$(OBJS): Makefile
-
-# DO NOT REMOVE
-mod_php4.o: mod_php4.c $(INCDIR)/httpd.h $(INCDIR)/conf.h \
- $(INCDIR)/buff.h \
- $(INCDIR)/http_config.h \
- $(INCDIR)/http_core.h $(INCDIR)/http_main.h \
- $(INCDIR)/http_protocol.h $(INCDIR)/http_request.h \
- $(INCDIR)/http_log.h $(INCDIR)/util_script.h mod_php4.h
diff --git a/sapi/apache/config.m4 b/sapi/apache/config.m4
deleted file mode 100644
index 3cdb95566b..0000000000
--- a/sapi/apache/config.m4
+++ /dev/null
@@ -1,237 +0,0 @@
-dnl ## -*- sh -*-
-
-
-AC_MSG_CHECKING(for Apache module support via DSO through APXS)
-AC_ARG_WITH(apxs,
-[ --with-apxs[=FILE] Build shared Apache module. FILE is the optional
- pathname to the Apache apxs tool; defaults to "apxs".],[
- if test "$withval" = "yes"; then
- APXS=apxs
- $APXS -q CFLAGS >/dev/null 2>&1
- if test "$?" != "0" && test -x /usr/sbin/apxs; then #SUSE 6.x
- APXS=/usr/sbin/apxs
- fi
- else
- PHP_EXPAND_PATH($withval, APXS)
- fi
-
- $APXS -q CFLAGS >/dev/null 2>&1
- if test "$?" != "0"; then
- AC_MSG_RESULT()
- AC_MSG_RESULT()
- AC_MSG_RESULT([Sorry, I was not able to successfully run APXS. Possible reasons:])
- AC_MSG_RESULT()
- AC_MSG_RESULT([1. Perl is not installed;])
- AC_MSG_RESULT([2. Apache was not compiled with DSO support (--enable-module=so);])
- AC_MSG_RESULT([3. 'apxs' is not in your path. Try to use --with-apxs=/path/to/apxs])
- AC_MSG_RESULT([The output of $APXS follows])
- $APXS
- AC_MSG_ERROR([Aborting])
- fi
-
- APXS_LDFLAGS="@SYBASE_LFLAGS@ @SYBASE_LIBS@ @SYBASE_CT_LFLAGS@ @SYBASE_CT_LIBS@"
- APXS_INCLUDEDIR=`$APXS -q INCLUDEDIR`
- APXS_CFLAGS=`$APXS -q CFLAGS`
- for flag in $APXS_CFLAGS; do
- case $flag in
- -D*) CPPFLAGS="$CPPFLAGS $flag";;
- esac
- done
- PHP_ADD_INCLUDE($APXS_INCLUDEDIR)
- PHP_SAPI=apache
- APACHE_INSTALL="\$(mkinstalldirs) \"\$(INSTALL_ROOT)`$APXS -q LIBEXECDIR`\" && $APXS -S LIBEXECDIR=\"\$(INSTALL_ROOT)`$APXS -q LIBEXECDIR`\" -i -a -n php4 $SAPI_SHARED"
- PHP_BUILD_SHARED
- if test -z "`$APXS -q LD_SHLIB`" || test "`$APXS -q LIBEXECDIR`" = "modules"; then
- PHP_APXS_BROKEN=yes
- fi
- STRONGHOLD=
- AC_DEFINE(HAVE_AP_CONFIG_H,1,[ ])
- AC_DEFINE(HAVE_AP_COMPAT_H,1,[ ])
- AC_MSG_RESULT(yes)
- case $host_alias in
- *aix*)
- APXS_LIBEXECDIR=`$APXS -q LIBEXECDIR`
- EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-bI:$APXS_LIBEXECDIR/httpd.exp"
- ;;
- esac
-],[
- AC_MSG_RESULT(no)
-])
-
-APACHE_INSTALL_FILES="\$(srcdir)/sapi/apache/mod_php4.* sapi/apache/libphp4.module"
-
-if test "$PHP_SAPI" != "apache"; then
-AC_MSG_CHECKING(for Apache module support)
-AC_ARG_WITH(apache,
-[ --with-apache[=DIR] Build Apache module. DIR is the top-level Apache
- build directory, defaults to /usr/local/etc/httpd.],[
- if test "$withval" = "yes"; then
- # Apache's default directory
- withval=/usr/local/apache
- fi
- if test "$withval" != "no"; then
- APACHE_MODULE=yes
- PHP_EXPAND_PATH($withval, withval)
- # For Apache 1.2.x
- if test -f $withval/src/httpd.h; then
- APACHE_INCLUDE=-I$withval/src
- APACHE_TARGET=$withval/src
- PHP_SAPI=apache
- APACHE_INSTALL="mkdir -p $APACHE_TARGET; cp $SAPI_STATIC $APACHE_INSTALL_FILES $APACHE_TARGET"
- PHP_LIBS="-L. -lphp3"
- AC_MSG_RESULT(yes - Apache 1.2.x)
- STRONGHOLD=
- if test -f $withval/src/ap_config.h; then
- AC_DEFINE(HAVE_AP_CONFIG_H,1,[ ])
- fi
- # For Apache 2.0.x
- elif test -f $withval/src/include/httpd.h &&
- test -f $withval/src/lib/apr/include/apr_general.h ; then
- APACHE_HAS_REGEX=1
- APACHE_INCLUDE="-I$withval/src/include -I$withval/src/os/unix -I$withval/src/lib/apr/include"
- APACHE_TARGET=$withval/src/modules/php4
- if test ! -d $APACHE_TARGET; then
- mkdir $APACHE_TARGET
- fi
- PHP_SAPI=apache
- APACHE_INSTALL="mkdir -p $APACHE_TARGET; cp $SAPI_STATIC $APACHE_TARGET/libmodphp4.a; cp $APACHE_INSTALL_FILES $APACHE_TARGET; cp $srcdir/sapi/apache/apMakefile.tmpl $APACHE_TARGET/Makefile.tmpl; cp $srcdir/sapi/apache/apMakefile.libdir $APACHE_TARGET/Makefile.libdir"
- PHP_LIBS="-Lmodules/php4 -L../modules/php4 -L../../modules/php4 -lmodphp4"
- AC_MSG_RESULT(yes - Apache 2.0.X)
- STRONGHOLD=
- if test -f $withval/src/include/ap_config.h; then
- AC_DEFINE(HAVE_AP_CONFIG_H,1,[ ])
- fi
- if test -f $withval/src/include/ap_compat.h; then
- AC_DEFINE(HAVE_AP_COMPAT_H,1,[ ])
- if test ! -f $withval/src/include/ap_config_auto.h; then
- AC_MSG_ERROR(Please run Apache\'s configure or src/Configure program once and try again)
- fi
- else
- if test -f $withval/src/include/compat.h; then
- AC_DEFINE(HAVE_OLD_COMPAT_H,1,[ ])
- fi
- fi
- # For Apache 1.3.x
- elif test -f $withval/src/main/httpd.h; then
- APACHE_HAS_REGEX=1
- APACHE_INCLUDE="-I$withval/src/main -I$withval/src/os/unix -I$withval/src/ap"
- APACHE_TARGET=$withval/src/modules/php4
- if test ! -d $APACHE_TARGET; then
- mkdir $APACHE_TARGET
- fi
- PHP_SAPI=apache
- APACHE_INSTALL="mkdir -p $APACHE_TARGET; cp $SAPI_STATIC $APACHE_TARGET/libmodphp4.a; cp $APACHE_INSTALL_FILES $APACHE_TARGET; cp $srcdir/sapi/apache/apMakefile.tmpl $APACHE_TARGET/Makefile.tmpl; cp $srcdir/sapi/apache/apMakefile.libdir $APACHE_TARGET/Makefile.libdir"
- PHP_LIBS="-Lmodules/php4 -L../modules/php4 -L../../modules/php4 -lmodphp4"
- AC_MSG_RESULT(yes - Apache 1.3.x)
- STRONGHOLD=
- if test -f $withval/src/include/ap_config.h; then
- AC_DEFINE(HAVE_AP_CONFIG_H,1,[ ])
- fi
- if test -f $withval/src/include/ap_compat.h; then
- AC_DEFINE(HAVE_AP_COMPAT_H,1,[ ])
- if test ! -f $withval/src/include/ap_config_auto.h; then
- AC_MSG_ERROR(Please run Apache\'s configure or src/Configure program once and try again)
- fi
- else
- if test -f $withval/src/include/compat.h; then
- AC_DEFINE(HAVE_OLD_COMPAT_H,1,[ ])
- fi
- fi
- # Also for Apache 1.3.x
- elif test -f $withval/src/include/httpd.h; then
- APACHE_HAS_REGEX=1
- APACHE_INCLUDE="-I$withval/src/include -I$withval/src/os/unix"
- APACHE_TARGET=$withval/src/modules/php4
- if test ! -d $APACHE_TARGET; then
- mkdir $APACHE_TARGET
- fi
- PHP_SAPI=apache
- PHP_LIBS="-Lmodules/php4 -L../modules/php4 -L../../modules/php4 -lmodphp4"
- APACHE_INSTALL="mkdir -p $APACHE_TARGET; cp $SAPI_STATIC $APACHE_TARGET/libmodphp4.a; cp $APACHE_INSTALL_FILES $APACHE_TARGET; cp $srcdir/sapi/apache/apMakefile.tmpl $APACHE_TARGET/Makefile.tmpl; cp $srcdir/sapi/apache/apMakefile.libdir $APACHE_TARGET/Makefile.libdir"
- AC_MSG_RESULT(yes - Apache 1.3.x)
- STRONGHOLD=
- if test -f $withval/src/include/ap_config.h; then
- AC_DEFINE(HAVE_AP_CONFIG_H,1,[ ])
- fi
- if test -f $withval/src/include/ap_compat.h; then
- AC_DEFINE(HAVE_AP_COMPAT_H,1,[ ])
- if test ! -f $withval/src/include/ap_config_auto.h; then
- AC_MSG_ERROR(Please run Apache\'s configure or src/Configure program once and try again)
- fi
- else
- if test -f $withval/src/include/compat.h; then
- AC_DEFINE(HAVE_OLD_COMPAT_H,1,[ ])
- fi
- fi
- # For StrongHold 2.2
- elif test -f $withval/apache/httpd.h; then
- APACHE_INCLUDE=-"I$withval/apache -I$withval/ssl/include"
- APACHE_TARGET=$withval/apache
- PHP_SAPI=apache
- PHP_LIBS="-Lmodules/php4 -L../modules/php4 -L../../modules/php4 -lmodphp4"
- APACHE_INSTALL="mkdir -p $APACHE_TARGET; cp $SAPI_STATIC $APACHE_TARGET/libmodphp4.a; cp $APACHE_INSTALL_FILES $APACHE_TARGET"
- STRONGHOLD=-DSTRONGHOLD=1
- AC_MSG_RESULT(yes - StrongHold)
- if test -f $withval/apache/ap_config.h; then
- AC_DEFINE(HAVE_AP_CONFIG_H,1,[ ])
- fi
- if test -f $withval/src/ap_compat.h; then
- AC_DEFINE(HAVE_AP_COMPAT_H,1,[ ])
- if test ! -f $withval/src/include/ap_config_auto.h; then
- AC_MSG_ERROR(Please run Apache\'s configure or src/Configure program once and try again)
- fi
- else
- if test -f $withval/src/compat.h; then
- AC_DEFINE(HAVE_OLD_COMPAT_H,1,[ ])
- fi
- fi
- else
- AC_MSG_RESULT(no)
- AC_MSG_ERROR(Invalid Apache directory - unable to find httpd.h under $withval)
- fi
- else
- AC_MSG_RESULT(no)
- fi
-],[
- AC_MSG_RESULT(no)
-])
-
- INCLUDES="$INCLUDES $APACHE_INCLUDE"
-fi
-
-if test "x$APXS" != "x" -a "`uname -sv`" = "AIX 4" -a "$GCC" != "yes"; then
- APXS_EXP=-bE:sapi/apache/mod_php4.exp
-fi
-
-PHP_SUBST(APXS_EXP)
-PHP_SUBST(APACHE_INCLUDE)
-PHP_SUBST(APACHE_TARGET)
-PHP_SUBST(APXS)
-PHP_SUBST(APXS_LDFLAGS)
-PHP_SUBST(APACHE_INSTALL)
-PHP_SUBST(STRONGHOLD)
-
-AC_MSG_CHECKING(for mod_charset compatibility option)
-AC_ARG_WITH(mod_charset,
-[ --with-mod_charset Enable transfer tables for mod_charset (Rus Apache).],
-[
- AC_MSG_RESULT(yes)
- AC_DEFINE(USE_TRANSFER_TABLES,1,[ ])
-],[
- AC_MSG_RESULT(no)
-])
-
-if test -n "$APACHE_MODULE"; then
- PHP_TARGET_RDYNAMIC
- $php_shtool mkdir -p sapi/apache
- PHP_OUTPUT(sapi/apache/libphp4.module)
- PHP_BUILD_STATIC
-fi
-
-if test -n "$APACHE_INSTALL"; then
- INSTALL_IT=$APACHE_INSTALL
-fi
-
-dnl ## Local Variables:
-dnl ## tab-width: 4
-dnl ## End:
diff --git a/sapi/apache/libphp4.module.in b/sapi/apache/libphp4.module.in
deleted file mode 100644
index 277394b722..0000000000
--- a/sapi/apache/libphp4.module.in
+++ /dev/null
@@ -1,7 +0,0 @@
-Name: php4_module
-ConfigStart
- RULE_WANTHSREGEX=no
- LIBS="@NATIVE_RPATHS@ @PHP_LDFLAGS@ @PHP_LIBS@ @EXTRA_LIBS@ $LIBS"
- RULE_HIDE=yes
- CFLAGS="$CFLAGS -I@abs_srcdir@ -I@abs_srcdir@/main -I@abs_builddir@/main -I@abs_srcdir@/Zend -I@abs_builddir@/Zend -I@abs_builddir@/TSRM -I@abs_srcdir@/TSRM -I@abs_builddir@"
-ConfigEnd
diff --git a/sapi/apache/mod_php4.c b/sapi/apache/mod_php4.c
deleted file mode 100644
index db90946b53..0000000000
--- a/sapi/apache/mod_php4.c
+++ /dev/null
@@ -1,916 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Rasmus Lerdorf <rasmus@php.net> |
- | (with helpful hints from Dean Gaudet <dgaudet@arctic.org> |
- | PHP 4.0 patches by Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
- */
-/* $Id$ */
-
-#define NO_REGEX_EXTRA_H
-#ifdef WIN32
-#include <winsock2.h>
-#include <stddef.h>
-#endif
-
-#include "zend.h"
-#include "php.h"
-#include "php_variables.h"
-
-#include "httpd.h"
-#include "http_config.h"
-#if MODULE_MAGIC_NUMBER > 19980712
-# include "ap_compat.h"
-#else
-# if MODULE_MAGIC_NUMBER > 19980324
-# include "compat.h"
-# endif
-#endif
-#include "http_core.h"
-#include "http_main.h"
-#include "http_protocol.h"
-#include "http_request.h"
-#include "http_log.h"
-
-#include "php_ini.h"
-#include "php_globals.h"
-#include "SAPI.h"
-#include "php_main.h"
-
-#include "zend_compile.h"
-#include "zend_execute.h"
-#include "zend_highlight.h"
-#include "zend_indent.h"
-
-#include "ext/standard/php_standard.h"
-
-#include "util_script.h"
-
-#include "mod_php4.h"
-
-#undef shutdown
-
-/* {{{ Prototypes
- */
-int apache_php_module_main(request_rec *r, int display_source_mode CLS_DC ELS_DC PLS_DC SLS_DC);
-void php_save_umask(void);
-void php_restore_umask(void);
-int sapi_apache_read_post(char *buffer, uint count_bytes SLS_DC);
-char *sapi_apache_read_cookies(SLS_D);
-int sapi_apache_header_handler(sapi_header_struct *sapi_header, sapi_headers_struct *sapi_headers SLS_DC);
-int sapi_apache_send_headers(sapi_headers_struct *sapi_headers SLS_DC);
-static int send_php(request_rec *r, int display_source_mode, char *filename);
-static int send_parsed_php(request_rec * r);
-static int send_parsed_php_source(request_rec * r);
-int php_xbithack_handler(request_rec * r);
-void php_init_handler(server_rec *s, pool *p);
-/* }}} */
-
-#if MODULE_MAGIC_NUMBER >= 19970728
-static void php_child_exit_handler(server_rec *s, pool *p);
-#endif
-
-#if MODULE_MAGIC_NUMBER > 19961007
-#define CONST_PREFIX const
-#else
-#define CONST_PREFIX
-#endif
-CONST_PREFIX char *php_apache_value_handler_ex(cmd_parms *cmd, HashTable *conf, char *arg1, char *arg2, int mode);
-CONST_PREFIX char *php_apache_value_handler(cmd_parms *cmd, HashTable *conf, char *arg1, char *arg2);
-CONST_PREFIX char *php_apache_admin_value_handler(cmd_parms *cmd, HashTable *conf, char *arg1, char *arg2);
-CONST_PREFIX char *php_apache_flag_handler(cmd_parms *cmd, HashTable *conf, char *arg1, char *arg2);
-CONST_PREFIX char *php_apache_flag_handler_ex(cmd_parms *cmd, HashTable *conf, char *arg1, char *arg2, int mode);
-CONST_PREFIX char *php_apache_admin_flag_handler(cmd_parms *cmd, HashTable *conf, char *arg1, char *arg2);
-
-/* ### these should be defined in mod_php4.h or somewhere else */
-#define USE_PATH 1
-#define IGNORE_URL 2
-
-module MODULE_VAR_EXPORT php4_module;
-
-int saved_umask;
-static unsigned char apache_php_initialized;
-
-typedef struct _php_per_dir_entry {
- char *key;
- char *value;
- uint key_length;
- uint value_length;
- int type;
-} php_per_dir_entry;
-
-/* some systems are missing these from their header files */
-
-/* {{{ php_save_umask
- */
-void php_save_umask(void)
-{
- saved_umask = umask(077);
- umask(saved_umask);
-}
-/* }}} */
-
-/* {{{ sapi_apache_ub_write
- */
-static int sapi_apache_ub_write(const char *str, uint str_length)
-{
- int ret=0;
- SLS_FETCH();
-
- if (SG(server_context)) {
- ret = rwrite(str, str_length, (request_rec *) SG(server_context));
- }
- if (ret != str_length) {
- php_handle_aborted_connection();
- }
- return ret;
-}
-/* }}} */
-
-/* {{{ sapi_apache_flush
- */
-static void sapi_apache_flush(void *server_context)
-{
- if (server_context) {
-#if MODULE_MAGIC_NUMBER > 19970110
- rflush((request_rec *) server_context);
-#else
- bflush((request_rec *) server_context->connection->client);
-#endif
- }
-}
-/* }}} */
-
-/* {{{ sapi_apache_read_post
- */
-int sapi_apache_read_post(char *buffer, uint count_bytes SLS_DC)
-{
- uint total_read_bytes=0, read_bytes;
- request_rec *r = (request_rec *) SG(server_context);
- void (*handler)(int);
-
- handler = signal(SIGPIPE, SIG_IGN);
- while (total_read_bytes<count_bytes) {
- hard_timeout("Read POST information", r); /* start timeout timer */
- read_bytes = get_client_block(r, buffer+total_read_bytes, count_bytes-total_read_bytes);
- reset_timeout(r);
- if (read_bytes<=0) {
- break;
- }
- total_read_bytes += read_bytes;
- }
- signal(SIGPIPE, handler);
- return total_read_bytes;
-}
-/* }}} */
-
-/* {{{ sapi_apache_read_cookies
- */
-char *sapi_apache_read_cookies(SLS_D)
-{
- return (char *) table_get(((request_rec *) SG(server_context))->subprocess_env, "HTTP_COOKIE");
-}
-/* }}} */
-
-/* {{{ sapi_apache_header_handler
- */
-int sapi_apache_header_handler(sapi_header_struct *sapi_header, sapi_headers_struct *sapi_headers SLS_DC)
-{
- char *header_name, *header_content, *p;
- request_rec *r = (request_rec *) SG(server_context);
-
- header_name = sapi_header->header;
-
- header_content = p = strchr(header_name, ':');
- if (!p) {
- return 0;
- }
-
- *p = 0;
- do {
- header_content++;
- } while (*header_content==' ');
-
- if (!strcasecmp(header_name, "Content-Type")) {
- r->content_type = pstrdup(r->pool, header_content);
- } else if (!strcasecmp(header_name, "Set-Cookie")) {
- table_add(r->headers_out, header_name, header_content);
- } else {
- table_set(r->headers_out, header_name, header_content);
- }
-
- *p = ':'; /* a well behaved header handler shouldn't change its original arguments */
-
- efree(sapi_header->header);
-
- return 0; /* don't use the default SAPI mechanism, Apache duplicates this functionality */
-}
-/* }}} */
-
-/* {{{ sapi_apache_send_headers
- */
-int sapi_apache_send_headers(sapi_headers_struct *sapi_headers SLS_DC)
-{
- if(SG(server_context) == NULL) { /* server_context is not here anymore */
- return SAPI_HEADER_SEND_FAILED;
- }
-
- ((request_rec *) SG(server_context))->status = SG(sapi_headers).http_response_code;
- send_http_header((request_rec *) SG(server_context));
- return SAPI_HEADER_SENT_SUCCESSFULLY;
-}
-/* }}} */
-
-/* {{{ sapi_apache_register_server_variables
- */
-static void sapi_apache_register_server_variables(zval *track_vars_array ELS_DC SLS_DC PLS_DC)
-{
- register int i;
- array_header *arr = table_elts(((request_rec *) SG(server_context))->subprocess_env);
- table_entry *elts = (table_entry *) arr->elts;
- zval **path_translated;
- HashTable *symbol_table;
-
- for (i = 0; i < arr->nelts; i++) {
- char *val;
-
- if (elts[i].val) {
- val = elts[i].val;
- } else {
- val = empty_string;
- }
- php_register_variable(elts[i].key, val, track_vars_array ELS_CC PLS_CC);
- }
-
- /* If PATH_TRANSLATED doesn't exist, copy it from SCRIPT_FILENAME */
- if (track_vars_array) {
- symbol_table = track_vars_array->value.ht;
- } else if (PG(register_globals)) {
- /* should never happen nowadays */
- symbol_table = EG(active_symbol_table);
- } else {
- symbol_table = NULL;
- }
- if (symbol_table
- && !zend_hash_exists(symbol_table, "PATH_TRANSLATED", sizeof("PATH_TRANSLATED"))
- && zend_hash_find(symbol_table, "SCRIPT_FILENAME", sizeof("SCRIPT_FILENAME"), (void **) &path_translated)==SUCCESS) {
- php_register_variable("PATH_TRANSLATED", Z_STRVAL_PP(path_translated), track_vars_array ELS_CC PLS_CC);
- }
-
- php_register_variable("PHP_SELF", ((request_rec *) SG(server_context))->uri, track_vars_array ELS_CC PLS_CC);
-}
-/* }}} */
-
-/* {{{ php_apache_startup
- */
-static int php_apache_startup(sapi_module_struct *sapi_module)
-{
- if (php_module_startup(sapi_module) == FAILURE
- || zend_startup_module(&apache_module_entry) == FAILURE) {
- return FAILURE;
- } else {
- return SUCCESS;
- }
-}
-/* }}} */
-
-/* {{{ php_apache_log_message
- */
-static void php_apache_log_message(char *message)
-{
- SLS_FETCH();
-
- if (SG(server_context)) {
-#if MODULE_MAGIC_NUMBER >= 19970831
- aplog_error(NULL, 0, APLOG_ERR | APLOG_NOERRNO, ((request_rec *) SG(server_context))->server, "%s", message);
-#else
- log_error(message, ((request_rec *) SG(server_context))->server);
-#endif
- } else {
- fprintf(stderr, "%s", message);
- fprintf(stderr, "\n");
- }
-}
-/* }}} */
-
-/* {{{ php_apache_request_shutdown
- */
-static void php_apache_request_shutdown(void *dummy)
-{
- SLS_FETCH();
- APLS_FETCH();
-
- AP(in_request)=0;
- SG(server_context) = NULL; /* The server context (request) is invalid by the time run_cleanups() is called */
- php_request_shutdown(dummy);
-}
-/* }}} */
-
-/* {{{ php_apache_sapi_activate
- */
-static int php_apache_sapi_activate(SLS_D)
-{
- request_rec *r = (request_rec *) SG(server_context);
- APLS_FETCH();
-
- /*
- * For the Apache module version, this bit of code registers a cleanup
- * function that gets triggered when our request pool is destroyed.
- * We need this because at any point in our code we can be interrupted
- * and that may happen before we have had time to free our memory.
- * The php_request_shutdown function needs to free all outstanding allocated
- * memory.
- */
- block_alarms();
- register_cleanup(r->pool, NULL, php_apache_request_shutdown, php_request_shutdown_for_exec);
- AP(in_request)=1;
- unblock_alarms();
-
- /* Override the default headers_only value - sometimes "GET" requests should actually only
- * send headers.
- */
- SG(request_info).headers_only = r->header_only;
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ php_apache_get_stat
- */
-static struct stat *php_apache_get_stat(SLS_D)
-{
- return &((request_rec *) SG(server_context))->finfo;
-}
-/* }}} */
-
-/* {{{ php_apache_getenv
- */
-static char *php_apache_getenv(char *name, size_t name_len SLS_DC)
-{
- return (char *) table_get(((request_rec *) SG(server_context))->subprocess_env, name);
-}
-/* }}} */
-
-/* {{{ sapi_module_struct apache_sapi_module
- */
-static sapi_module_struct apache_sapi_module = {
- "apache", /* name */
- "Apache", /* pretty name */
-
- php_apache_startup, /* startup */
- php_module_shutdown_wrapper, /* shutdown */
-
- php_apache_sapi_activate, /* activate */
- NULL, /* deactivate */
-
- sapi_apache_ub_write, /* unbuffered write */
- sapi_apache_flush, /* flush */
- php_apache_get_stat, /* get uid */
- php_apache_getenv, /* getenv */
-
- php_error, /* error handler */
-
- sapi_apache_header_handler, /* header handler */
- sapi_apache_send_headers, /* send headers handler */
- NULL, /* send header handler */
-
- sapi_apache_read_post, /* read POST data */
- sapi_apache_read_cookies, /* read Cookies */
-
- sapi_apache_register_server_variables, /* register server variables */
- php_apache_log_message, /* Log message */
-
- NULL, /* php.ini path override */
-
-#ifdef PHP_WIN32
- NULL,
- NULL,
-#else
- block_alarms, /* Block interruptions */
- unblock_alarms, /* Unblock interruptions */
-#endif
-
- STANDARD_SAPI_MODULE_PROPERTIES
-};
-/* }}} */
-
-/* {{{ php_restore_umask
- */
-void php_restore_umask(void)
-{
- umask(saved_umask);
-}
-/* }}} */
-
-/* {{{ init_request_info
- */
-static void init_request_info(SLS_D)
-{
- request_rec *r = ((request_rec *) SG(server_context));
- char *content_length = (char *) table_get(r->subprocess_env, "CONTENT_LENGTH");
- const char *authorization=NULL;
- char *tmp;
-
- SG(request_info).query_string = r->args;
- SG(request_info).path_translated = r->filename;
- SG(request_info).request_uri = r->uri;
- SG(request_info).request_method = (char *)r->method;
- SG(request_info).content_type = (char *) table_get(r->subprocess_env, "CONTENT_TYPE");
- SG(request_info).content_length = (content_length ? atoi(content_length) : 0);
- SG(sapi_headers).http_response_code = r->status;
-
- if (r->headers_in) {
- authorization = table_get(r->headers_in, "Authorization");
- }
- if (authorization
-/* && !auth_type(r) */
- && !strcasecmp(getword(r->pool, &authorization, ' '), "Basic")) {
- tmp = uudecode(r->pool, authorization);
- SG(request_info).auth_user = getword_nulls_nc(r->pool, &tmp, ':');
- if (SG(request_info).auth_user) {
- r->connection->user = pstrdup(r->connection->pool,SG(request_info).auth_user);
- r->connection->ap_auth_type = "Basic";
- SG(request_info).auth_user = estrdup(SG(request_info).auth_user);
- }
- SG(request_info).auth_password = tmp;
- if (SG(request_info).auth_password) {
- SG(request_info).auth_password = estrdup(SG(request_info).auth_password);
- }
- } else {
- SG(request_info).auth_user = NULL;
- SG(request_info).auth_password = NULL;
- }
-}
-/* }}} */
-
-/* {{{ php_apache_alter_ini_entries
- */
-static int php_apache_alter_ini_entries(php_per_dir_entry *per_dir_entry)
-{
- zend_alter_ini_entry(per_dir_entry->key, per_dir_entry->key_length+1, per_dir_entry->value, per_dir_entry->value_length, per_dir_entry->type, PHP_INI_STAGE_ACTIVATE);
- return 0;
-}
-/* }}} */
-
-/* {{{ php_apache_get_default_mimetype
- */
-static char *php_apache_get_default_mimetype(request_rec *r SLS_DC)
-{
-
- char *mimetype;
- if (SG(default_mimetype) || SG(default_charset)) {
- /* Assume output will be of the default MIME type. Individual
- scripts may change this later. */
- char *tmpmimetype;
- tmpmimetype = sapi_get_default_content_type(SLS_C);
- mimetype = pstrdup(r->pool, tmpmimetype);
- efree(tmpmimetype);
- } else {
- mimetype = SAPI_DEFAULT_MIMETYPE "; charset=" SAPI_DEFAULT_CHARSET;
- }
- return mimetype;
-}
-/* }}} */
-
-/* {{{ send_php
- */
-static int send_php(request_rec *r, int display_source_mode, char *filename)
-{
- int retval;
- HashTable *per_dir_conf;
- SLS_FETCH();
- ELS_FETCH();
- CLS_FETCH();
- PLS_FETCH();
- APLS_FETCH();
-
- if (AP(in_request)) {
- zend_file_handle fh;
-
- fh.filename = r->filename;
- fh.opened_path = NULL;
- fh.free_filename = 0;
- fh.type = ZEND_HANDLE_FILENAME;
- zend_execute_scripts(ZEND_INCLUDE CLS_CC ELS_CC, 1, &fh);
- return OK;
- }
-
- if (setjmp(EG(bailout))!=0) {
- return OK;
- }
- /* We don't accept OPTIONS requests, but take everything else */
- if (r->method_number == M_OPTIONS) {
- r->allowed |= (1 << METHODS) - 1;
- return DECLINED;
- }
-
- /* Make sure file exists */
- if (filename == NULL && r->finfo.st_mode == 0) {
- return DECLINED;
- }
-
- per_dir_conf = (HashTable *) get_module_config(r->per_dir_config, &php4_module);
- if (per_dir_conf) {
- zend_hash_apply((HashTable *) per_dir_conf, (int (*)(void *)) php_apache_alter_ini_entries);
- }
-
- /* If PHP parser engine has been turned off with an "engine off"
- * directive, then decline to handle this request
- */
- if (!AP(engine)) {
- r->content_type = php_apache_get_default_mimetype(r SLS_CC);
- r->allowed |= (1 << METHODS) - 1;
- if (setjmp(EG(bailout))==0) {
- zend_ini_deactivate(ELS_C);
- }
- return DECLINED;
- }
- if (filename == NULL) {
- filename = r->filename;
- }
-
- /* Apache 1.2 has a more complex mechanism for reading POST data */
-#if MODULE_MAGIC_NUMBER > 19961007
- if ((retval = setup_client_block(r, REQUEST_CHUNKED_ERROR))) {
- if (setjmp(EG(bailout))==0) {
- zend_ini_deactivate(ELS_C);
- }
- return retval;
- }
-#endif
-
- if (AP(last_modified)) {
-#if MODULE_MAGIC_NUMBER < 19970912
- if ((retval = set_last_modified(r, r->finfo.st_mtime))) {
- if (setjmp(EG(bailout))==0) {
- zend_ini_deactivate(ELS_C);
- }
- return retval;
- }
-#else
- update_mtime (r, r->finfo.st_mtime);
- set_last_modified(r);
- set_etag(r);
-#endif
- }
- /* Assume output will be of the default MIME type. Individual
- scripts may change this later in the request. */
- r->content_type = php_apache_get_default_mimetype(r SLS_CC);
-
- /* Init timeout */
- hard_timeout("send", r);
-
- SG(server_context) = r;
-
- php_save_umask();
- add_common_vars(r);
- add_cgi_vars(r);
-
- init_request_info(SLS_C);
- apache_php_module_main(r, display_source_mode CLS_CC ELS_CC PLS_CC SLS_CC);
-
- /* Done, restore umask, turn off timeout, close file and return */
- php_restore_umask();
- kill_timeout(r);
- return OK;
-}
-/* }}} */
-
-/* {{{ send_parsed_php
- */
-static int send_parsed_php(request_rec * r)
-{
- int result = send_php(r, 0, NULL);
-
-#if MEMORY_LIMIT
- {
- char mem_usage[ 32 ];
- ALS_FETCH()
-
- sprintf(mem_usage,"%u", (int) AG(allocated_memory_peak));
- ap_table_setn(r->notes, "mod_php_memory_usage", ap_pstrdup(r->pool,mem_usage));
- }
-#endif
-
- return result;
-}
-/* }}} */
-
-/* {{{ send_parsed_php_source
- */
-static int send_parsed_php_source(request_rec * r)
-{
- return send_php(r, 1, NULL);
-}
-/* }}} */
-
-/* {{{ estroy_per_dir_entry
- */
-static void destroy_per_dir_entry(php_per_dir_entry *per_dir_entry)
-{
- free(per_dir_entry->key);
- free(per_dir_entry->value);
-}
-/* }}} */
-
-/* {{{ copy_per_dir_entry
- */
-static void copy_per_dir_entry(php_per_dir_entry *per_dir_entry)
-{
- php_per_dir_entry tmp = *per_dir_entry;
-
- per_dir_entry->key = (char *) malloc(tmp.key_length+1);
- memcpy(per_dir_entry->key, tmp.key, tmp.key_length);
- per_dir_entry->key[per_dir_entry->key_length] = 0;
-
- per_dir_entry->value = (char *) malloc(tmp.value_length+1);
- memcpy(per_dir_entry->value, tmp.value, tmp.value_length);
- per_dir_entry->value[per_dir_entry->value_length] = 0;
-}
-/* }}} */
-
-/* {{{ should_overwrite_per_dir_entry
- */
-static zend_bool should_overwrite_per_dir_entry(php_per_dir_entry *orig_per_dir_entry, php_per_dir_entry *new_per_dir_entry)
-{
- if (new_per_dir_entry->type==PHP_INI_SYSTEM
- && orig_per_dir_entry->type!=PHP_INI_SYSTEM) {
- return 1;
- } else {
- return 0;
- }
-}
-/* }}} */
-
-/* {{{ php_destroy_per_dir_info
- */
-static void php_destroy_per_dir_info(HashTable *per_dir_info)
-{
- zend_hash_destroy(per_dir_info);
- free(per_dir_info);
-}
-/* }}} */
-
-/* {{{ php_create_dir
- */
-static void *php_create_dir(pool *p, char *dummy)
-{
- HashTable *per_dir_info;
-
- per_dir_info = (HashTable *) malloc(sizeof(HashTable));
- zend_hash_init(per_dir_info, 5, NULL, (void (*)(void *)) destroy_per_dir_entry, 1);
- register_cleanup(p, (void *) per_dir_info, (void (*)(void *)) php_destroy_per_dir_info, (void (*)(void *)) zend_hash_destroy);
-
- return per_dir_info;
-}
-/* }}} */
-
-/* {{{ php_merge_dir
- */
-static void *php_merge_dir(pool *p, void *basev, void *addv)
-{
- /* This function *must* return addv, and not modify basev */
- zend_hash_merge_ex((HashTable *) addv, (HashTable *) basev, (copy_ctor_func_t) copy_per_dir_entry, sizeof(php_per_dir_entry), (zend_bool (*)(void *, void *)) should_overwrite_per_dir_entry);
- return addv;
-}
-/* }}} */
-
-/* {{{ php_apache_value_handler_ex
- */
-CONST_PREFIX char *php_apache_value_handler_ex(cmd_parms *cmd, HashTable *conf, char *arg1, char *arg2, int mode)
-{
- php_per_dir_entry per_dir_entry;
-
- if (!apache_php_initialized) {
- apache_php_initialized = 1;
-#ifdef ZTS
- tsrm_startup(1, 1, 0, NULL);
-#endif
- sapi_startup(&apache_sapi_module);
- php_apache_startup(&apache_sapi_module);
- }
- per_dir_entry.type = mode;
-
- if (strcasecmp(arg2, "none") == 0) {
- arg2 = "";
- }
-
- per_dir_entry.key_length = strlen(arg1);
- per_dir_entry.value_length = strlen(arg2);
-
- per_dir_entry.key = (char *) malloc(per_dir_entry.key_length+1);
- memcpy(per_dir_entry.key, arg1, per_dir_entry.key_length);
- per_dir_entry.key[per_dir_entry.key_length] = 0;
-
- per_dir_entry.value = (char *) malloc(per_dir_entry.value_length+1);
- memcpy(per_dir_entry.value, arg2, per_dir_entry.value_length);
- per_dir_entry.value[per_dir_entry.value_length] = 0;
-
- zend_hash_update((HashTable *) conf, per_dir_entry.key, per_dir_entry.key_length, &per_dir_entry, sizeof(php_per_dir_entry), NULL);
- return NULL;
-}
-/* }}} */
-
-/* {{{ php_apache_value_handler
- */
-CONST_PREFIX char *php_apache_value_handler(cmd_parms *cmd, HashTable *conf, char *arg1, char *arg2)
-{
- return php_apache_value_handler_ex(cmd, conf, arg1, arg2, PHP_INI_PERDIR);
-}
-/* }}} */
-
-/* {{{ php_apache_admin_value_handler
- */
-CONST_PREFIX char *php_apache_admin_value_handler(cmd_parms *cmd, HashTable *conf, char *arg1, char *arg2)
-{
- return php_apache_value_handler_ex(cmd, conf, arg1, arg2, PHP_INI_SYSTEM);
-}
-/* }}} */
-
-/* {{{ php_apache_flag_handler_ex
- */
-CONST_PREFIX char *php_apache_flag_handler_ex(cmd_parms *cmd, HashTable *conf, char *arg1, char *arg2, int mode)
-{
- char bool_val[2];
-
- if (!strcasecmp(arg2, "On")) {
- bool_val[0] = '1';
- } else {
- bool_val[0] = '0';
- }
- bool_val[1] = 0;
-
- return php_apache_value_handler_ex(cmd, conf, arg1, bool_val, mode);
-}
-/* }}} */
-
-/* {{{ php_apache_flag_handler
- */
-CONST_PREFIX char *php_apache_flag_handler(cmd_parms *cmd, HashTable *conf, char *arg1, char *arg2)
-{
- return php_apache_flag_handler_ex(cmd, conf, arg1, arg2, PHP_INI_PERDIR);
-}
-/* }}} */
-
-/* {{{ php_apache_admin_flag_handler
- */
-CONST_PREFIX char *php_apache_admin_flag_handler(cmd_parms *cmd, HashTable *conf, char *arg1, char *arg2)
-{
- return php_apache_flag_handler_ex(cmd, conf, arg1, arg2, PHP_INI_SYSTEM);
-}
-/* }}} */
-
-/* {{{ int php_xbithack_handler(request_rec * r)
- */
-int php_xbithack_handler(request_rec * r)
-{
- php_apache_info_struct *conf;
-
- conf = (php_apache_info_struct *) get_module_config(r->per_dir_config, &php4_module);
- if (!(r->finfo.st_mode & S_IXUSR)) {
- r->allowed |= (1 << METHODS) - 1;
- return DECLINED;
- }
- if (conf->xbithack == 0) {
- r->allowed |= (1 << METHODS) - 1;
- return DECLINED;
- }
- return send_parsed_php(r);
-}
-/* }}} */
-
-/* {{{ apache_php_module_shutdown_wrapper
- */
-static void apache_php_module_shutdown_wrapper(void)
-{
- apache_php_initialized = 0;
- apache_sapi_module.shutdown(&apache_sapi_module);
-
-#if MODULE_MAGIC_NUMBER >= 19970728
- /* This function is only called on server exit if the apache API
- * child_exit handler exists, so shutdown globally
- */
- sapi_shutdown();
-#endif
-
-#ifdef ZTS
- tsrm_shutdown();
-#endif
-}
-/* }}} */
-
-#if MODULE_MAGIC_NUMBER >= 19970728
-/* {{{ php_child_exit_handler
- */
-static void php_child_exit_handler(server_rec *s, pool *p)
-{
-/* apache_php_initialized = 0; */
- apache_sapi_module.shutdown(&apache_sapi_module);
-
-#ifdef ZTS
- tsrm_shutdown();
-#endif
-}
-/* }}} */
-#endif
-
-/* {{{ void php_init_handler(server_rec *s, pool *p)
- */
-void php_init_handler(server_rec *s, pool *p)
-{
- register_cleanup(p, NULL, (void (*)(void *))apache_php_module_shutdown_wrapper, (void (*)(void *))php_module_shutdown_for_exec);
- if (!apache_php_initialized) {
- apache_php_initialized = 1;
-#ifdef ZTS
- tsrm_startup(1, 1, 0, NULL);
-#endif
- sapi_startup(&apache_sapi_module);
- php_apache_startup(&apache_sapi_module);
- }
-#if MODULE_MAGIC_NUMBER >= 19980527
- {
- PLS_FETCH();
- if (PG(expose_php)) {
- ap_add_version_component("PHP/" PHP_VERSION);
- }
- }
-#endif
-}
-/* }}} */
-
-/* {{{ handler_rec php_handlers[]
- */
-handler_rec php_handlers[] =
-{
- {"application/x-httpd-php", send_parsed_php},
- {"application/x-httpd-php-source", send_parsed_php_source},
- {"text/html", php_xbithack_handler},
- {NULL}
-};
-/* }}} */
-
-/* {{{ command_rec php_commands[]
- */
-command_rec php_commands[] =
-{
- {"php_value", php_apache_value_handler, NULL, OR_OPTIONS, TAKE2, "PHP Value Modifier"},
- {"php_flag", php_apache_flag_handler, NULL, OR_OPTIONS, TAKE2, "PHP Flag Modifier"},
- {"php_admin_value", php_apache_admin_value_handler, NULL, ACCESS_CONF|RSRC_CONF, TAKE2, "PHP Value Modifier (Admin)"},
- {"php_admin_flag", php_apache_admin_flag_handler, NULL, ACCESS_CONF|RSRC_CONF, TAKE2, "PHP Flag Modifier (Admin)"},
- {NULL}
-};
-/* }}} */
-
-/* {{{ odule MODULE_VAR_EXPORT php4_module
- */
-module MODULE_VAR_EXPORT php4_module =
-{
- STANDARD_MODULE_STUFF,
- php_init_handler, /* initializer */
- php_create_dir, /* per-directory config creator */
- php_merge_dir, /* dir merger */
- NULL, /* per-server config creator */
- NULL, /* merge server config */
- php_commands, /* command table */
- php_handlers, /* handlers */
- NULL, /* filename translation */
- NULL, /* check_user_id */
- NULL, /* check auth */
- NULL, /* check access */
- NULL, /* type_checker */
- NULL, /* fixups */
- NULL /* logger */
-#if MODULE_MAGIC_NUMBER >= 19970103
- ,NULL /* header parser */
-#endif
-#if MODULE_MAGIC_NUMBER >= 19970719
- ,NULL /* child_init */
-#endif
-#if MODULE_MAGIC_NUMBER >= 19970728
- ,php_child_exit_handler /* child_exit */
-#endif
-#if MODULE_MAGIC_NUMBER >= 19970902
- ,NULL /* post read-request */
-#endif
-};
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/sapi/apache/mod_php4.exp b/sapi/apache/mod_php4.exp
deleted file mode 100644
index 2dca1256c2..0000000000
--- a/sapi/apache/mod_php4.exp
+++ /dev/null
@@ -1 +0,0 @@
-php4_module
diff --git a/sapi/apache/mod_php4.h b/sapi/apache/mod_php4.h
deleted file mode 100644
index c70d09a5a8..0000000000
--- a/sapi/apache/mod_php4.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Rasmus Lerdorf <rasmus@php.net> |
- +----------------------------------------------------------------------+
- */
-/* $Id$ */
-
-#ifndef MOD_PHP4_H
-#define MOD_PHP4_H
-
-#if !defined(WIN32) && !defined(WINNT)
-#ifndef MODULE_VAR_EXPORT
-#define MODULE_VAR_EXPORT
-#endif
-#endif
-
-typedef struct {
- long engine;
- long last_modified;
- long xbithack;
- long terminate_child;
- zend_bool in_request;
-} php_apache_info_struct;
-
-extern zend_module_entry apache_module_entry;
-
-#ifdef ZTS
-extern int php_apache_info_id;
-#define APLS_D php_apache_info_struct *apache_globals
-#define AP(v) (apache_globals->v)
-#define APLS_FETCH() APLS_D = ts_resource(php_apache_info_id)
-#else
-extern php_apache_info_struct php_apache_info;
-#define APLS_D
-#define AP(v) (php_apache_info.v)
-#define APLS_FETCH()
-#endif
-
-
-#ifdef WIN32
-#define S_IXUSR _S_IEXEC
-#endif
-
-#endif /* MOD_PHP4_H */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/sapi/apache/php.sym b/sapi/apache/php.sym
deleted file mode 100644
index 2dca1256c2..0000000000
--- a/sapi/apache/php.sym
+++ /dev/null
@@ -1 +0,0 @@
-php4_module
diff --git a/sapi/apache/php4apache.dsp b/sapi/apache/php4apache.dsp
deleted file mode 100644
index 87508b3065..0000000000
--- a/sapi/apache/php4apache.dsp
+++ /dev/null
@@ -1,151 +0,0 @@
-# Microsoft Developer Studio Project File - Name="php4apache" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=php4apache - Win32 Release_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "php4apache.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "php4apache.mak" CFG="php4apache - Win32 Release_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "php4apache - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "php4apache - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "php4apache - Win32 Release_TS_inline" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "php4apache - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "..\..\Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "APACHEPHP4_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "...\..\include" /I "..\..\win32" /I "..\..\Zend" /I "..\.." /I "..\..\..\bindlib_w32" /I "..\..\..\php_build\apache\src\include" /I "..\..\main" /I "..\..\TSRM" /D ZEND_DEBUG=0 /D "NDEBUG" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "_WINDOWS" /D "_USRDLL" /D "APACHEPHP4_EXPORTS" /D "WIN32" /D "_MBCS" /D "APACHE_READDIR_H" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 php4ts.lib ApacheCore.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /base:"0x60000000" /version:4.0 /dll /machine:I386 /libpath:"..\..\..\php_build\apache\src\corer" /libpath:"..\..\Release_TS" /libpath:"..\..\TSRM\Release_TS" /libpath:"..\..\Zend\Release_TS"
-
-!ELSEIF "$(CFG)" == "php4apache - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "..\Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "APACHEPHP4_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "...\..\include" /I "..\..\win32" /I "..\..\Zend" /I "..\.." /I "..\..\..\bindlib_w32" /I "..\..\..\php_build\apache\src\include" /I "..\..\main" /I "..\..\TSRM" /D "_DEBUG" /D ZEND_DEBUG=1 /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "_WINDOWS" /D "_USRDLL" /D "APACHEPHP4_EXPORTS" /D "WIN32" /D "_MBCS" /D "APACHE_READDIR_H" /FR /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 php4ts_debug.lib ApacheCore.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /base:"0x60000000" /version:4.0 /dll /incremental:yes /debug /machine:I386 /out:"..\..\Debug_TS/php4apache.dll" /pdbtype:sept /libpath:"..\..\..\php_build\apache\src\cored" /libpath:"..\..\Debug_TS" /libpath:"..\..\TSRM\Debug_TS" /libpath:"..\..\Zend\Debug_TS"
-
-!ELSEIF "$(CFG)" == "php4apache - Win32 Release_TS_inline"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS_inline"
-# PROP BASE Intermediate_Dir "Release_TS_inline"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "..\..\Release_TS_inline"
-# PROP Intermediate_Dir "Release_TS_inline"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "APACHEPHP4_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "...\..\include" /I "..\..\win32" /I "..\..\Zend" /I "..\.." /I "..\..\..\bindlib_w32" /I "..\..\..\php_build\apache\src\include" /I "..\..\main" /I "..\..\TSRM" /D ZEND_DEBUG=0 /D "ZEND_WIN32_FORCE_INLINE" /D "NDEBUG" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "_WINDOWS" /D "_USRDLL" /D "APACHEPHP4_EXPORTS" /D "WIN32" /D "_MBCS" /D "APACHE_READDIR_H" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 php4ts.lib ApacheCore.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /version:4.0 /dll /machine:I386 /libpath:"\apache\src\corer" /libpath:"..\..\Release_TS_inline" /libpath:"..\..\TSRM\Release_TS_inline" /libpath:"..\..\Zend\Release_TS_inline"
-
-!ENDIF
-
-# Begin Target
-
-# Name "php4apache - Win32 Release_TS"
-# Name "php4apache - Win32 Debug_TS"
-# Name "php4apache - Win32 Release_TS_inline"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\mod_php4.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\php_apache.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\sapi_apache.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\mod_php4.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\php_apache_http.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/sapi/apache/php_apache.c b/sapi/apache/php_apache.c
deleted file mode 100644
index c969371526..0000000000
--- a/sapi/apache/php_apache.c
+++ /dev/null
@@ -1,474 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
- | Stig Sæther Bakken <ssb@guardian.no> |
- | David Sklar <sklar@student.net> |
- +----------------------------------------------------------------------+
- */
-/* $Id$ */
-
-#define NO_REGEX_EXTRA_H
-
-#ifdef WIN32
-#include <winsock2.h>
-#include <stddef.h>
-#endif
-
-#include "php.h"
-#include "ext/standard/head.h"
-#include "php_globals.h"
-#include "php_ini.h"
-#include "SAPI.h"
-#include "mod_php4.h"
-#include "ext/standard/info.h"
-
-#include <stdlib.h>
-#if HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#include <string.h>
-#include <errno.h>
-#include <ctype.h>
-
-#include "php_apache_http.h"
-#include "http_request.h"
-
-#ifdef ZTS
-int php_apache_info_id;
-#else
-php_apache_info_struct php_apache_info;
-#endif
-
-#ifdef PHP_WIN32
-#include "zend.h"
-#include "ap_compat.h"
-#else
-#include "build-defs.h"
-#endif
-
-#define SECTION(name) PUTS("<H2 align=\"center\">" name "</H2>\n")
-
-extern module *top_module;
-
-PHP_FUNCTION(virtual);
-PHP_FUNCTION(getallheaders);
-PHP_FUNCTION(apachelog);
-PHP_FUNCTION(apache_note);
-PHP_FUNCTION(apache_lookup_uri);
-PHP_FUNCTION(apache_child_terminate);
-
-PHP_MINFO_FUNCTION(apache);
-
-function_entry apache_functions[] = {
- PHP_FE(virtual, NULL)
- PHP_FE(getallheaders, NULL)
- PHP_FE(apache_note, NULL)
- PHP_FE(apache_lookup_uri, NULL)
- PHP_FE(apache_child_terminate, NULL)
- {NULL, NULL, NULL}
-};
-
-
-PHP_INI_BEGIN()
- STD_PHP_INI_ENTRY("xbithack", "0", PHP_INI_ALL, OnUpdateInt, xbithack, php_apache_info_struct, php_apache_info)
- STD_PHP_INI_ENTRY("engine", "1", PHP_INI_ALL, OnUpdateInt, engine, php_apache_info_struct, php_apache_info)
- STD_PHP_INI_ENTRY("last_modified", "0", PHP_INI_ALL, OnUpdateInt, last_modified, php_apache_info_struct, php_apache_info)
- STD_PHP_INI_ENTRY("child_terminate", "0", PHP_INI_ALL, OnUpdateInt, terminate_child, php_apache_info_struct, php_apache_info)
-PHP_INI_END()
-
-
-
-static void php_apache_globals_ctor(php_apache_info_struct *apache_globals)
-{
- apache_globals->in_request = 0;
-}
-
-
-static PHP_MINIT_FUNCTION(apache)
-{
-#ifdef ZTS
- php_apache_info_id = ts_allocate_id(sizeof(php_apache_info_struct), php_apache_globals_ctor, NULL);
-#else
- php_apache_globals_ctor(&php_apache_info);
-#endif
- REGISTER_INI_ENTRIES();
- return SUCCESS;
-}
-
-
-static PHP_MSHUTDOWN_FUNCTION(apache)
-{
- UNREGISTER_INI_ENTRIES();
- return SUCCESS;
-}
-
-
-zend_module_entry apache_module_entry = {
- "apache", apache_functions, PHP_MINIT(apache), PHP_MSHUTDOWN(apache), NULL, NULL, PHP_MINFO(apache), STANDARD_MODULE_PROPERTIES
-};
-
-/* {{{ proto string child_terminate()
- Get and set Apache request notes */
-PHP_FUNCTION(apache_child_terminate)
-{
-#ifndef MULTITHREAD
- APLS_FETCH();
- SLS_FETCH();
-
- if (AP(terminate_child)) {
- ap_child_terminate( ((request_rec *)SG(server_context)) );
- } else { /* tell them to get lost! */
- php_error(E_WARNING, "apache.child_terminate is disabled");
- }
-#else
- php_error(E_WARNING, "apache_child_terminate() is not supported in this build");
-#endif
-}
-/* }}} */
-
-/* {{{ proto string apache_note(string note_name [, string note_value])
- Get and set Apache request notes */
-PHP_FUNCTION(apache_note)
-{
- pval **arg_name,**arg_val;
- char *note_val;
- int arg_count = ARG_COUNT(ht);
- SLS_FETCH();
-
- if (arg_count<1 || arg_count>2 ||
- zend_get_parameters_ex(arg_count,&arg_name,&arg_val) ==FAILURE ) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(arg_name);
- note_val = (char *) table_get(((request_rec *)SG(server_context))->notes,(*arg_name)->value.str.val);
-
- if (arg_count == 2) {
- convert_to_string_ex(arg_val);
- table_set(((request_rec *)SG(server_context))->notes,(*arg_name)->value.str.val,(*arg_val)->value.str.val);
- }
-
- if (note_val) {
- RETURN_STRING(note_val,1);
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ PHP_MINFO_FUNCTION
- */
-PHP_MINFO_FUNCTION(apache)
-{
- module *modp = NULL;
- char output_buf[128];
-#if !defined(WIN32) && !defined(WINNT)
- char name[64];
- char modulenames[1024];
- char *p;
-#endif
- server_rec *serv;
- extern char server_root[MAX_STRING_LEN];
- extern uid_t user_id;
- extern char *user_name;
- extern gid_t group_id;
- extern int max_requests_per_child;
- SLS_FETCH();
-
- serv = ((request_rec *) SG(server_context))->server;
-
-
- php_info_print_table_start();
-
-#ifdef PHP_WIN32
- php_info_print_table_row(1, "Apache for Windows 95/NT");
- php_info_print_table_end();
- php_info_print_table_start();
-#else
- php_info_print_table_row(2, "APACHE_INCLUDE", PHP_APACHE_INCLUDE);
- php_info_print_table_row(2, "APACHE_TARGET", PHP_APACHE_TARGET);
-#endif
-
- php_info_print_table_row(2, "Apache Version", SERVER_VERSION);
-
-#ifdef APACHE_RELEASE
- sprintf(output_buf, "%d", APACHE_RELEASE);
- php_info_print_table_row(2, "Apache Release", output_buf);
-#endif
- sprintf(output_buf, "%d", MODULE_MAGIC_NUMBER);
- php_info_print_table_row(2, "Apache API Version", output_buf);
- sprintf(output_buf, "%s:%u", serv->server_hostname,serv->port);
- php_info_print_table_row(2, "Hostname:Port", output_buf);
-#if !defined(WIN32) && !defined(WINNT)
- sprintf(output_buf, "%s(%d)/%d", user_name,(int)user_id,(int)group_id);
- php_info_print_table_row(2, "User/Group", output_buf);
- sprintf(output_buf, "Per Child: %d<br>Keep Alive: %s<br>Max Per Connection: %d",max_requests_per_child,serv->keep_alive ? "on":"off", serv->keep_alive_max);
- php_info_print_table_row(2, "Max Requests", output_buf);
-#endif
- sprintf(output_buf, "Connection: %d<br>Keep-Alive: %d",serv->timeout,serv->keep_alive_timeout);
- php_info_print_table_row(2, "Timeouts", output_buf);
-#if !defined(WIN32) && !defined(WINNT)
- php_info_print_table_row(2, "Server Root", server_root);
-
- strcpy(modulenames, "");
- for(modp = top_module; modp; modp = modp->next) {
- strlcpy(name, modp->name, sizeof(name));
- if ((p = strrchr(name, '.'))) {
- *p='\0'; /* Cut off ugly .c extensions on module names */
- }
- strcat(modulenames, name);
- if (modp->next) {
- strcat(modulenames, ", ");
- }
- }
- php_info_print_table_row(2, "Loaded Modules", modulenames);
-#endif
-
- php_info_print_table_end();
-
- DISPLAY_INI_ENTRIES();
-
- {
- register int i;
- array_header *arr;
- table_entry *elts;
- request_rec *r;
- SLS_FETCH();
-
- r = ((request_rec *) SG(server_context));
- arr = table_elts(r->subprocess_env);
- elts = (table_entry *)arr->elts;
-
- SECTION("Apache Environment");
- php_info_print_table_start();
- php_info_print_table_header(2, "Variable", "Value");
- for (i=0; i < arr->nelts; i++) {
- php_info_print_table_row(2, elts[i].key, elts[i].val);
- }
- php_info_print_table_end();
- }
-
- {
- array_header *env_arr;
- table_entry *env;
- int i;
- request_rec *r;
- SLS_FETCH();
-
- r = ((request_rec *) SG(server_context));
- SECTION("HTTP Headers Information");
- php_info_print_table_start();
- php_info_print_table_colspan_header(2, "HTTP Request Headers");
- php_info_print_table_row(2, "HTTP Request", r->the_request);
- env_arr = table_elts(r->headers_in);
- env = (table_entry *)env_arr->elts;
- for (i = 0; i < env_arr->nelts; ++i) {
- if (env[i].key) {
- php_info_print_table_row(2, env[i].key, env[i].val);
- }
- }
- php_info_print_table_colspan_header(2, "HTTP Response Headers");
- env_arr = table_elts(r->headers_out);
- env = (table_entry *)env_arr->elts;
- for(i = 0; i < env_arr->nelts; ++i) {
- if (env[i].key) {
- php_info_print_table_row(2, env[i].key, env[i].val);
- }
- }
- php_info_print_table_end();
- }
-}
-/* }}} */
-
-/* {{{ proto int virtual(string filename)
- Perform an Apache sub-request */
-/* This function is equivalent to <!--#include virtual...-->
- * in mod_include. It does an Apache sub-request. It is useful
- * for including CGI scripts or .shtml files, or anything else
- * that you'd parse through Apache (for .phtml files, you'd probably
- * want to use <?Include>. This only works when PHP is compiled
- * as an Apache module, since it uses the Apache API for doing
- * sub requests.
- */
-PHP_FUNCTION(virtual)
-{
- pval **filename;
- request_rec *rr = NULL;
- SLS_FETCH();
-
- if (ARG_COUNT(ht) != 1 || zend_get_parameters_ex(1,&filename) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(filename);
-
- if (!(rr = sub_req_lookup_uri ((*filename)->value.str.val,((request_rec *) SG(server_context))))) {
- php_error(E_WARNING, "Unable to include '%s' - URI lookup failed", (*filename)->value.str.val);
- if (rr) destroy_sub_req (rr);
- RETURN_FALSE;
- }
-
- if (rr->status != 200) {
- php_error(E_WARNING, "Unable to include '%s' - error finding URI", (*filename)->value.str.val);
- if (rr) destroy_sub_req (rr);
- RETURN_FALSE;
- }
-
- php_end_ob_buffers(1);
- php_header();
-
- if (run_sub_req(rr)) {
- php_error(E_WARNING, "Unable to include '%s' - request execution failed", (*filename)->value.str.val);
- if (rr) destroy_sub_req (rr);
- RETURN_FALSE;
- } else {
- if (rr) destroy_sub_req (rr);
- RETURN_TRUE;
- }
-}
-/* }}} */
-
-/* {{{ proto array getallheaders(void)
- Fetch all HTTP request headers */
-PHP_FUNCTION(getallheaders)
-{
- array_header *env_arr;
- table_entry *tenv;
- int i;
- SLS_FETCH();
- PLS_FETCH();
-
- if (array_init(return_value) == FAILURE) {
- RETURN_FALSE;
- }
- env_arr = table_elts(((request_rec *) SG(server_context))->headers_in);
- tenv = (table_entry *)env_arr->elts;
- for (i = 0; i < env_arr->nelts; ++i) {
- if (!tenv[i].key ||
- (PG(safe_mode) &&
- !strncasecmp(tenv[i].key, "authorization", 13))) {
- continue;
- }
- if (add_assoc_string(return_value, tenv[i].key,(tenv[i].val==NULL) ? "" : tenv[i].val, 1)==FAILURE) {
- RETURN_FALSE;
- }
- }
-}
-/* }}} */
-
-/* {{{ proto class apache_lookup_uri(string URI)
- Perform a partial request of the given URI to obtain information about it */
-PHP_FUNCTION(apache_lookup_uri)
-{
- pval **filename;
- request_rec *rr=NULL;
- SLS_FETCH();
-
- if (ARG_COUNT(ht) != 1 || zend_get_parameters_ex(1,&filename) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(filename);
-
- if(!(rr = sub_req_lookup_uri((*filename)->value.str.val,((request_rec *) SG(server_context))))) {
- php_error(E_WARNING, "URI lookup failed",(*filename)->value.str.val);
- RETURN_FALSE;
- }
- object_init(return_value);
- add_property_long(return_value,"status",rr->status);
- if (rr->the_request) {
- add_property_string(return_value,"the_request",rr->the_request,1);
- }
- if (rr->status_line) {
- add_property_string(return_value,"status_line",(char *)rr->status_line,1);
- }
- if (rr->method) {
- add_property_string(return_value,"method",(char *)rr->method,1);
- }
- if (rr->content_type) {
- add_property_string(return_value,"content_type",(char *)rr->content_type,1);
- }
- if (rr->handler) {
- add_property_string(return_value,"handler",(char *)rr->handler,1);
- }
- if (rr->uri) {
- add_property_string(return_value,"uri",rr->uri,1);
- }
- if (rr->filename) {
- add_property_string(return_value,"filename",rr->filename,1);
- }
- if (rr->path_info) {
- add_property_string(return_value,"path_info",rr->path_info,1);
- }
- if (rr->args) {
- add_property_string(return_value,"args",rr->args,1);
- }
- if (rr->boundary) {
- add_property_string(return_value,"boundary",rr->boundary,1);
- }
- add_property_long(return_value,"no_cache",rr->no_cache);
- add_property_long(return_value,"no_local_copy",rr->no_local_copy);
- add_property_long(return_value,"allowed",rr->allowed);
- add_property_long(return_value,"sent_bodyct",rr->sent_bodyct);
- add_property_long(return_value,"bytes_sent",rr->bytes_sent);
- add_property_long(return_value,"byterange",rr->byterange);
- add_property_long(return_value,"clength",rr->clength);
-
-#if MODULE_MAGIC_NUMBER >= 19980324
- if (rr->unparsed_uri) {
- add_property_string(return_value,"unparsed_uri",rr->unparsed_uri,1);
- }
- if(rr->mtime) {
- add_property_long(return_value,"mtime",rr->mtime);
- }
-#endif
- if(rr->request_time) {
- add_property_long(return_value,"request_time",rr->request_time);
- }
-
- destroy_sub_req(rr);
-}
-/* }}} */
-
-
-#if 0
-This function is most likely a bad idea. Just playing with it for now.
-
-PHP_FUNCTION(apache_exec_uri)
-{
- pval **filename;
- request_rec *rr=NULL;
- SLS_FETCH();
-
- if (ARG_COUNT(ht) != 1 || zend_get_parameters_ex(1,&filename) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(filename);
-
- if(!(rr = ap_sub_req_lookup_uri((*filename)->value.str.val,((request_rec *) SG(server_context))))) {
- php_error(E_WARNING, "URI lookup failed",(*filename)->value.str.val);
- RETURN_FALSE;
- }
- RETVAL_LONG(ap_run_sub_req(rr));
- ap_destroy_sub_req(rr);
-}
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/sapi/apache/php_apache_http.h b/sapi/apache/php_apache_http.h
deleted file mode 100644
index a878b8fa3e..0000000000
--- a/sapi/apache/php_apache_http.h
+++ /dev/null
@@ -1,24 +0,0 @@
-# if HAVE_AP_CONFIG_H
-#include "ap_config_auto.h"
-#ifdef RHAPSODY
-#undef HAVE_SNPRINTF
-#endif
-#include "ap_config.h"
-#ifdef RHAPSODY
-#undef HAVE_SNPRINTF
-#define HAVE_SNPRINTF 1
-#endif
-# endif
-# if HAVE_OLD_COMPAT_H
-#include "compat.h"
-# endif
-# if HAVE_AP_COMPAT_H
-#include "ap_compat.h"
-# endif
-#include "httpd.h"
-#include "http_main.h"
-#include "http_core.h"
-#include "http_request.h"
-#include "http_protocol.h"
-#include "http_config.h"
-#include "http_log.h"
diff --git a/sapi/apache/sapi_apache.c b/sapi/apache/sapi_apache.c
deleted file mode 100644
index 90d47da7d6..0000000000
--- a/sapi/apache/sapi_apache.c
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Rasmus Lerdorf <rasmus@php.net> |
- | (with helpful hints from Dean Gaudet <dgaudet@arctic.org> |
- | PHP 4.0 patches by: |
- | Zeev Suraski <zeev@zend.com> |
- | Stig Bakken <ssb@fast.no> |
- +----------------------------------------------------------------------+
- */
-/* $Id$ */
-
-#define NO_REGEX_EXTRA_H
-#ifdef WIN32
-#include <winsock2.h>
-#include <stddef.h>
-#endif
-
-#include "php.h"
-
-#include "httpd.h"
-#include "http_config.h"
-#if MODULE_MAGIC_NUMBER > 19980712
-# include "ap_compat.h"
-#else
-# if MODULE_MAGIC_NUMBER > 19980324
-# include "compat.h"
-# endif
-#endif
-#include "http_core.h"
-#include "http_main.h"
-#include "http_protocol.h"
-#include "http_request.h"
-#include "http_log.h"
-
-#include "zend.h"
-#include "php_ini.h"
-#include "php_globals.h"
-#include "SAPI.h"
-#include "php_main.h"
-#include "zend_compile.h"
-#include "zend_execute.h"
-#include "zend_highlight.h"
-#include "zend_indent.h"
-#include "ext/standard/php_standard.h"
-#include "util_script.h"
-#include "php_version.h"
-/*#include "mod_php4.h"*/
-
-/* {{{ apache_php_module_main
- */
-int apache_php_module_main(request_rec *r, int display_source_mode CLS_DC ELS_DC PLS_DC SLS_DC)
-{
- zend_file_handle file_handle;
-
- if (php_request_startup(CLS_C ELS_CC PLS_CC SLS_CC) == FAILURE) {
- return FAILURE;
- }
- /* sending a file handle to another dll is not working
- // so let zend open it.
- */
-
- if (display_source_mode) {
- zend_syntax_highlighter_ini syntax_highlighter_ini;
-
- php_get_highlight_struct(&syntax_highlighter_ini);
- if (highlight_file(SG(request_info).path_translated,&syntax_highlighter_ini)){
- return OK;
- } else {
- return NOT_FOUND;
- }
- } else {
- file_handle.type = ZEND_HANDLE_FILENAME;
- file_handle.handle.fd = 0;
- file_handle.filename = SG(request_info).path_translated;
- file_handle.opened_path = NULL;
- file_handle.free_filename = 0;
-
- (void) php_execute_script(&file_handle CLS_CC ELS_CC PLS_CC);
- }
-
- if (setjmp(EG(bailout))!=0) {
- return OK;
- }
- php_end_ob_buffers(1);
- php_header(); /* Make sure headers have been sent */
- return (OK);
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/sapi/apache2filter/CREDITS b/sapi/apache2filter/CREDITS
deleted file mode 100644
index 8fa27e8393..0000000000
--- a/sapi/apache2filter/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-Apache 2.0
-Sascha Schumann
diff --git a/sapi/apache2filter/Makefile.in b/sapi/apache2filter/Makefile.in
deleted file mode 100644
index e4e876c904..0000000000
--- a/sapi/apache2filter/Makefile.in
+++ /dev/null
@@ -1,7 +0,0 @@
-
-LTLIBRARY_NAME = libsapi.la
-LTLIBRARY_SOURCES = sapi_apache2.c apache_config.c php_functions.c
-
-EXTRA_INCLUDES = $(APACHE_INCLUDE)
-
-include $(top_srcdir)/build/ltlib.mk
diff --git a/sapi/apache2filter/README b/sapi/apache2filter/README
deleted file mode 100644
index f2b0a0097d..0000000000
--- a/sapi/apache2filter/README
+++ /dev/null
@@ -1,63 +0,0 @@
-WHAT IS THIS?
-
- This module exploits the layered I/O support in Apache 2.0.
-
-HOW DOES IT WORK?
-
- In Apache 2.0, you have handlers which generate content (like
- reading a script from disk). The content goes then through
- a chain of filters. PHP can be such a filter, so that it processes
- your script and hands the output to the next filter (which will
- usually cause a write to the network).
-
-DOES IT WORK?
-
- It is experimental as interfaces in Apache 2.0 might change in the
- future.
-
-HOW TO INSTALL
-
- Get the latest Apache 2.0 alpha or the CVS code and install it.
-
- $ cd apache-2.x
- $ cd src
- $ ./configure --enable-so
- $ make install
-
- For testing purposes, you might want to use --with-mpm=prefork.
- (Albeit PHP also works with threaded MPMs.)
-
- Configure PHP 4:
-
- $ cd php-4.x
- $ ./configure --with-apxs2=/path/to/apache-2.0/bin/apxs
- $ make install
-
- At the end of conf/httpd.conf, add:
-
- <Files *.php>
- SetOutputFilter PHP
- SetInputFilter PHP
- </Files>
-
- That's it. Now start bin/httpd.
-
-DEBUGGING APACHE AND PHP
-
- To debug Apache, we recommened:
-
- 1. Use the Prefork MPM (Apache 1.3-like process model) by
- configuring Apache with '--with-mpm=prefork'.
- 2. Set the variable "ONE_PROCESS" to 1 and export it before
- starting Apache/a debugger.
-
- If you want to debug a part of the PHP startup procedure, set a
- breakpoint on 'load_module'. Step through it until apr_dso_load() is
- done. Then you can set a breakpoint on any PHP-related symbol.
-
-TODO
-
- PHP functions like apache_sub_req (see php_functions.c)
- Protocol handlers
- Passing script data to engine without temporary file
- Syntax Highlighter (relies on files as well)
diff --git a/sapi/apache2filter/apache_config.c b/sapi/apache2filter/apache_config.c
deleted file mode 100644
index 2b0ce50c7e..0000000000
--- a/sapi/apache2filter/apache_config.c
+++ /dev/null
@@ -1,156 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Sascha Schumann <sascha@schumann.cx> |
- +----------------------------------------------------------------------+
- */
-
-#include "php.h"
-#include "php_ini.h"
-
-#include "apr_strings.h"
-#include "ap_config.h"
-#include "util_filter.h"
-#include "httpd.h"
-#include "http_config.h"
-#include "http_request.h"
-#include "http_core.h"
-#include "http_protocol.h"
-#include "http_log.h"
-#include "http_main.h"
-#include "util_script.h"
-#include "http_core.h"
-
-#ifdef PHP_AP_DEBUG
-#define phpapdebug(a) fprintf a
-#else
-#define phpapdebug(a)
-#endif
-
-typedef struct {
- HashTable config;
-} php_conf_rec;
-
-typedef struct {
- char *value;
- size_t value_len;
- char status;
-} php_dir_entry;
-
-static const char *real_value_hnd(cmd_parms *cmd, void *dummy, const char *name, const char *value, int status)
-{
- php_conf_rec *d = dummy;
- php_dir_entry e;
- php_dir_entry *pe;
- size_t str_len;
-
- phpapdebug((stderr, "Getting %s=%s for %p (%d)\n", name, value, dummy, zend_hash_num_elements(&d->config)));
- e.value = apr_pstrdup(cmd->pool, value);
- e.value_len = strlen(value);
- e.status = status;
-
- str_len = strlen(name);
-
- if (zend_hash_find(&d->config, (char *) name, str_len + 1, (void **) &pe) == SUCCESS) {
- if (pe->status > status)
- return NULL;
- }
-
- zend_hash_update(&d->config, (char *) name, strlen(name) + 1, &e, sizeof(e),
- NULL);
- return NULL;
-}
-
-static const char *php_apache_value_handler(cmd_parms *cmd, void *dummy, const char *name, const char *value)
-{
- return real_value_hnd(cmd, dummy, name, value, PHP_INI_USER);
-}
-
-static const char *php_apache_admin_value_handler(cmd_parms *cmd, void *dummy, const char *name, const char *value)
-{
- return real_value_hnd(cmd, dummy, name, value, PHP_INI_SYSTEM);
-}
-
-void *merge_php_config(apr_pool_t *p, void *base_conf, void *new_conf)
-{
- php_conf_rec *d = base_conf, *e = new_conf;
- php_dir_entry *pe;
- php_dir_entry *data;
- char *str;
- ulong str_len;
- ulong num_index;
-
- phpapdebug((stderr, "Merge dir (%p) (%p)\n", base_conf, new_conf));
- for (zend_hash_internal_pointer_reset(&d->config);
- zend_hash_get_current_key_ex(&d->config, &str, &str_len, &num_index, 0, NULL) == HASH_KEY_IS_STRING;
- zend_hash_move_forward(&d->config)) {
- pe = NULL;
- zend_hash_get_current_data(&d->config, (void **) &data);
- if (zend_hash_find(&e->config, str, str_len, (void **) &pe) == SUCCESS) {
- if (pe->status >= data->status) continue;
- }
- zend_hash_update(&e->config, str, str_len, data, sizeof(*data), NULL);
- phpapdebug((stderr, "ADDING/OVERWRITING %s (%d vs. %d)\n", str, data->status, pe?pe->status:-1));
- }
- return new_conf;
-}
-
-void apply_config(void *dummy)
-{
- php_conf_rec *d = dummy;
- char *str;
- ulong str_len;
- php_dir_entry *data;
-
- for (zend_hash_internal_pointer_reset(&d->config);
- zend_hash_get_current_key_ex(&d->config, &str, &str_len, NULL, 0, NULL) == HASH_KEY_IS_STRING;
- zend_hash_move_forward(&d->config)) {
- zend_hash_get_current_data(&d->config, (void **) &data);
- phpapdebug((stderr, "APPLYING (%s)(%s)\n", str, data->value));
- if (zend_alter_ini_entry(str, str_len, data->value, data->value_len + 1,
- data->status, PHP_INI_STAGE_RUNTIME) == FAILURE)
- phpapdebug((stderr, "..FAILED\n"));
- }
-}
-
-const command_rec php_dir_cmds[] =
-{
- AP_INIT_TAKE2("php_value", php_apache_value_handler, NULL, OR_OPTIONS,
- "PHP Value Modifier"),
- AP_INIT_TAKE2("php_admin_value", php_apache_admin_value_handler, NULL, OR_NONE,
- "PHP Value Modifier"),
- {NULL}
-};
-
-static apr_status_t destroy_php_config(void *data)
-{
- php_conf_rec *d = data;
-
- phpapdebug((stderr, "Destroying config %p\n", data));
- zend_hash_destroy(&d->config);
-
- return APR_SUCCESS;
-}
-
-void *create_php_config(apr_pool_t *p, char *dummy)
-{
- php_conf_rec *newx =
- (php_conf_rec *) apr_pcalloc(p, sizeof(*newx));
-
- phpapdebug((stderr, "Creating new config (%p) for %s\n", newx, dummy));
- zend_hash_init(&newx->config, 0, NULL, NULL, 1);
- apr_pool_cleanup_register(p, newx, destroy_php_config, NULL);
- return (void *) newx;
-}
-
diff --git a/sapi/apache2filter/config.m4 b/sapi/apache2filter/config.m4
deleted file mode 100644
index cb3aeb2997..0000000000
--- a/sapi/apache2filter/config.m4
+++ /dev/null
@@ -1,59 +0,0 @@
-dnl ## -*- sh -*-
-
-AC_MSG_CHECKING(for Apache 2.0 module support via DSO through APXS)
-AC_ARG_WITH(apxs2,
-[ --with-apxs2[=FILE] Build shared Apache 2.0 module. FILE is the optional
- pathname to the Apache apxs tool; defaults to "apxs".],[
- if test "$withval" = "yes"; then
- APXS=apxs
- $APXS -q CFLAGS >/dev/null 2>&1
- if test "$?" != "0" && test -x /usr/sbin/apxs; then
- APXS=/usr/sbin/apxs
- fi
- else
- PHP_EXPAND_PATH($withval, APXS)
- fi
-
- $APXS -q CFLAGS >/dev/null 2>&1
- if test "$?" != "0"; then
- AC_MSG_RESULT()
- AC_MSG_RESULT()
- AC_MSG_RESULT([Sorry, I cannot run apxs. Possible reasons follow:])
- AC_MSG_RESULT()
- AC_MSG_RESULT([1. Perl is not installed])
- AC_MSG_RESULT([2. apxs was not found. Try to pass the path using --with-apxs2=/path/to/apxs])
- AC_MSG_RESULT([3. Apache was not built using --enable-so (the apxs usage page is displayed)])
- AC_MSG_RESULT()
- AC_MSG_RESULT([The output of $APXS follows:])
- $APXS
- AC_MSG_ERROR([Aborting])
- fi
-
- APXS_INCLUDEDIR=`$APXS -q INCLUDEDIR`
- APXS_CFLAGS=`$APXS -q CFLAGS`
- for flag in $APXS_CFLAGS; do
- case $flag in
- -D*) CPPFLAGS="$CPPFLAGS $flag";;
- esac
- done
- PHP_ADD_INCLUDE($APXS_INCLUDEDIR)
- PHP_SAPI=apache2filter
- INSTALL_IT="$APXS -i -a -n php4 $SAPI_LIBTOOL"
- PHP_BUILD_SHARED
- PHP_BUILD_THREAD_SAFE
- AC_MSG_RESULT(yes)
- case $host_alias in
- *aix*)
- APXS_SBINDIR=`$APXS -q SBINDIR`
- EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-bI:$APXS_SBINDIR/httpd.exp"
- ;;
- esac
-],[
- AC_MSG_RESULT(no)
-])
-
-PHP_SUBST(APXS)
-
-dnl ## Local Variables:
-dnl ## tab-width: 4
-dnl ## End:
diff --git a/sapi/apache2filter/php.sym b/sapi/apache2filter/php.sym
deleted file mode 100644
index 2dca1256c2..0000000000
--- a/sapi/apache2filter/php.sym
+++ /dev/null
@@ -1 +0,0 @@
-php4_module
diff --git a/sapi/apache2filter/php_apache.h b/sapi/apache2filter/php_apache.h
deleted file mode 100644
index 101c81430b..0000000000
--- a/sapi/apache2filter/php_apache.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Sascha Schumann <sascha@schumann.cx> |
- +----------------------------------------------------------------------+
- */
-
-#ifndef PHP_APACHE_H
-#define PHP_APACHE_H
-
-typedef struct php_struct {
- int state;
- apr_bucket_brigade *bb;
- ap_filter_t *f;
- /* Length of post_data buffer */
- int post_len;
- /* Index for reading from buffer */
- int post_idx;
- /* Buffer for request body filter */
- char *post_data;
-} php_struct;
-
-int php_apache_register_module(void);
-void *merge_php_config(apr_pool_t *p, void *base_conf, void *new_conf);
-void *create_php_config(apr_pool_t *p, char *dummy);
-void apply_config(void *);
-extern const command_rec php_dir_cmds[];
-
-#define APR_ARRAY_FOREACH_OPEN(arr, key, val) \
-{ \
- apr_table_entry_t *elts; \
- int i; \
- elts = (apr_table_entry_t *) arr->elts; \
- for (i = 0; i < arr->nelts; i++) { \
- key = elts[i].key; \
- val = elts[i].val;
-
-#define APR_ARRAY_FOREACH_CLOSE() }}
-
-#endif /* PHP_APACHE_H */
diff --git a/sapi/apache2filter/php_functions.c b/sapi/apache2filter/php_functions.c
deleted file mode 100644
index 2679c38488..0000000000
--- a/sapi/apache2filter/php_functions.c
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Sascha Schumann <sascha@schumann.cx> |
- +----------------------------------------------------------------------+
- */
-
-#include "php.h"
-#include "SAPI.h"
-
-#include "apr_strings.h"
-#include "ap_config.h"
-#include "util_filter.h"
-#include "httpd.h"
-#include "http_config.h"
-#include "http_request.h"
-#include "http_core.h"
-#include "http_protocol.h"
-#include "http_log.h"
-#include "http_main.h"
-#include "util_script.h"
-#include "http_core.h"
-
-#include "php_apache.h"
-
-static request_rec *php_apache_lookup_uri(INTERNAL_FUNCTION_PARAMETERS)
-{
- zval **p1;
- php_struct *ctx;
- SLS_FETCH();
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &p1) == FAILURE)
- return NULL;
-
- convert_to_string_ex(p1);
-
- ctx = SG(server_context);
- return ap_sub_req_lookup_uri(Z_STRVAL_PP(p1), ctx->f->r, NULL);
-}
-
-PHP_FUNCTION(apache_sub_req)
-{
- request_rec *rr;
-
- rr = php_apache_lookup_uri(INTERNAL_FUNCTION_PARAM_PASSTHRU);
-
- if (!rr)
- WRONG_PARAM_COUNT;
-
- if (rr->status == HTTP_OK) {
- ap_run_sub_req(rr);
- RETURN_TRUE;
- }
- RETURN_FALSE;
-}
-
-#define ADD_LONG(name) \
- add_assoc_long(return_value, #name, rr->name)
-#define ADD_STRING(name) \
- if (rr->name) add_assoc_string(return_value, #name, (char *) rr->name, 1)
-
-PHP_FUNCTION(apache_lookup_uri)
-{
- request_rec *rr;
-
- rr = php_apache_lookup_uri(INTERNAL_FUNCTION_PARAM_PASSTHRU);
- if (!rr)
- WRONG_PARAM_COUNT;
-
- if (rr->status == HTTP_OK) {
- array_init(return_value);
-
- ADD_LONG(status);
- ADD_STRING(the_request);
- ADD_STRING(status_line);
- ADD_STRING(method);
- ADD_LONG(mtime);
- ADD_LONG(clength);
- ADD_STRING(boundary);
- ADD_STRING(range);
- ADD_LONG(chunked);
- ADD_STRING(content_type);
- ADD_STRING(handler);
- ADD_LONG(no_cache);
- ADD_LONG(no_local_copy);
- ADD_STRING(unparsed_uri);
- ADD_STRING(uri);
- ADD_STRING(filename);
- ADD_STRING(path_info);
- ADD_STRING(args);
-
- return;
- }
- RETURN_FALSE;
-}
-
-PHP_FUNCTION(get_all_headers)
-{
- php_struct *ctx;
- apr_array_header_t *arr;
- char *key, *val;
- SLS_FETCH();
-
- if (array_init(return_value) == FAILURE) {
- RETURN_FALSE;
- }
-
- ctx = SG(server_context);
- arr = apr_table_elts(ctx->f->r->headers_in);
-
- APR_ARRAY_FOREACH_OPEN(arr, key, val)
- if (!val) val = empty_string;
- add_assoc_string(return_value, key, val, 1);
- APR_ARRAY_FOREACH_CLOSE()
-}
-
-PHP_MINFO_FUNCTION(apache)
-{
-}
-
-static function_entry apache_functions[] = {
- PHP_FE(apache_lookup_uri, NULL)
- PHP_FE(apache_sub_req, NULL)
- PHP_FE(get_all_headers, NULL)
- {0}
-};
-
-static zend_module_entry php_apache_module = {
- "Apache 2.0",
- apache_functions,
- NULL,
- NULL,
- NULL,
- NULL,
- PHP_MINFO(apache),
- STANDARD_MODULE_PROPERTIES
-};
-
-int php_apache_register_module(void)
-{
- return zend_startup_module(&php_apache_module);
-}
diff --git a/sapi/apache2filter/sapi_apache2.c b/sapi/apache2filter/sapi_apache2.c
deleted file mode 100644
index 27aa660852..0000000000
--- a/sapi/apache2filter/sapi_apache2.c
+++ /dev/null
@@ -1,454 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Sascha Schumann <sascha@schumann.cx> |
- | Parts based on Apache 1.3 SAPI module by |
- | Rasmus Lerdorf and Zeev Suraski |
- +----------------------------------------------------------------------+
- */
-
-#include <fcntl.h>
-
-#include "php.h"
-#include "php_main.h"
-#include "php_ini.h"
-#include "php_variables.h"
-#include "SAPI.h"
-
-#include "ext/standard/php_smart_str.h"
-
-#include "apr_strings.h"
-#include "ap_config.h"
-#include "util_filter.h"
-#include "httpd.h"
-#include "http_config.h"
-#include "http_request.h"
-#include "http_core.h"
-#include "http_protocol.h"
-#include "http_log.h"
-#include "http_main.h"
-#include "util_script.h"
-#include "http_core.h"
-
-#include "php_apache.h"
-
-static int
-php_apache_sapi_ub_write(const char *str, uint str_length)
-{
- apr_bucket *b;
- apr_bucket_brigade *bb;
- php_struct *ctx;
- uint now;
- SLS_FETCH();
-
- ctx = SG(server_context);
-
- if (str_length == 0) return 0;
-
- bb = apr_brigade_create(ctx->f->r->pool);
- while (str_length > 0) {
- now = MIN(str_length, 4096);
- b = apr_bucket_transient_create(str, now);
- APR_BRIGADE_INSERT_TAIL(bb, b);
- str += now;
- str_length -= now;
- }
- if (ap_pass_brigade(ctx->f->next, bb) != APR_SUCCESS) {
- php_handle_aborted_connection();
- }
-
- return str_length;
-}
-
-static int
-php_apache_sapi_header_handler(sapi_header_struct *sapi_header, sapi_headers_struct *sapi_headers SLS_DC)
-{
- php_struct *ctx = SG(server_context);
- char *val;
-
- val = strchr(sapi_header->header, ':');
-
- if (!val) return 0;
-
- *val = '\0';
-
- do {
- val++;
- } while (*val == ' ');
-
- if (!strcasecmp(sapi_header->header, "content-type"))
- ctx->f->r->content_type = apr_pstrdup(ctx->f->r->pool, val);
- else if (sapi_header->replace)
- apr_table_set(ctx->f->r->headers_out, sapi_header->header, val);
- else
- apr_table_add(ctx->f->r->headers_out, sapi_header->header, val);
-
- sapi_free_header(sapi_header);
-
- return 0;
-}
-
-static int
-php_apache_sapi_send_headers(sapi_headers_struct *sapi_headers SLS_DC)
-{
- php_struct *ctx = SG(server_context);
-
- ctx->f->r->status = SG(sapi_headers).http_response_code;
-
- return SAPI_HEADER_SENT_SUCCESSFULLY;
-}
-
-static int
-php_apache_sapi_read_post(char *buf, uint count_bytes SLS_DC)
-{
- int n;
- int to_read;
- php_struct *ctx = SG(server_context);
-
- to_read = ctx->post_len - ctx->post_idx;
- n = MIN(to_read, count_bytes);
-
- if (n > 0) {
- memcpy(buf, ctx->post_data + ctx->post_idx, n);
- ctx->post_idx += n;
- } else {
- if (ctx->post_data) free(ctx->post_data);
- ctx->post_data = NULL;
- }
-
- return n;
-}
-
-static char *
-php_apache_sapi_read_cookies(SLS_D)
-{
- php_struct *ctx = SG(server_context);
- const char *http_cookie;
-
- http_cookie = apr_table_get(ctx->f->r->headers_in, "cookie");
-
- /* The SAPI interface should use 'const char *' */
- return (char *) http_cookie;
-}
-
-static void
-php_apache_sapi_register_variables(zval *track_vars_array ELS_DC SLS_DC PLS_DC)
-{
- php_struct *ctx = SG(server_context);
- apr_array_header_t *arr = apr_table_elts(ctx->f->r->subprocess_env);
- char *key, *val;
-
- APR_ARRAY_FOREACH_OPEN(arr, key, val)
- if (!val) val = empty_string;
- php_register_variable(key, val, track_vars_array ELS_CC PLS_CC);
- APR_ARRAY_FOREACH_CLOSE()
-
- php_register_variable("PHP_SELF", ctx->f->r->uri, track_vars_array ELS_CC PLS_CC);
-}
-
-static void
-php_apache_sapi_flush(void *server_context)
-{
- php_struct *ctx = server_context;
- apr_bucket_brigade *bb;
- apr_bucket *b;
-
- /* Send a flush bucket down the filter chain. The current default
- * handler seems to act on the first flush bucket, but ignores
- * all further flush buckets.
- */
-
- bb = apr_brigade_create(ctx->f->r->pool);
- b = apr_bucket_flush_create();
- APR_BRIGADE_INSERT_TAIL(bb, b);
- if (ap_pass_brigade(ctx->f->next, bb) != APR_SUCCESS) {
- php_handle_aborted_connection();
- }
-}
-
-static void php_apache_sapi_log_message(char *msg)
-{
- php_struct *ctx;
- SLS_FETCH();
-
- ctx = SG(server_context);
-
- apr_file_puts(msg, ctx->f->r->server->error_log);
-}
-
-static sapi_module_struct apache2_sapi_module = {
- "apache2filter",
- "Apache 2.0 Filter",
-
- php_module_startup, /* startup */
- php_module_shutdown_wrapper, /* shutdown */
-
- NULL, /* activate */
- NULL, /* deactivate */
-
- php_apache_sapi_ub_write, /* unbuffered write */
- php_apache_sapi_flush, /* flush */
- NULL, /* get uid */
- NULL, /* getenv */
-
- php_error, /* error handler */
-
- php_apache_sapi_header_handler, /* header handler */
- php_apache_sapi_send_headers, /* send headers handler */
- NULL, /* send header handler */
-
- php_apache_sapi_read_post, /* read POST data */
- php_apache_sapi_read_cookies, /* read Cookies */
-
- php_apache_sapi_register_variables,
- php_apache_sapi_log_message, /* Log message */
-
- NULL, /* Block interruptions */
- NULL, /* Unblock interruptions */
-
- STANDARD_SAPI_MODULE_PROPERTIES
-};
-
-
-AP_MODULE_DECLARE_DATA module php4_module;
-
-#define INIT_CTX \
- if (ctx == NULL) { \
- /* Initialize filter context */ \
- SG(server_context) = ctx = apr_pcalloc(f->r->pool, sizeof(*ctx)); \
- ctx->bb = apr_brigade_create(f->c->pool); \
- }
-
-static int php_input_filter(ap_filter_t *f, apr_bucket_brigade *bb,
- ap_input_mode_t mode, apr_size_t *readbytes)
-{
- php_struct *ctx;
- long old_index;
- apr_bucket *b;
- const char *str;
- apr_ssize_t n;
- apr_status_t rv;
- SLS_FETCH();
-
- ctx = SG(server_context);
-
- INIT_CTX;
-
- if ((rv = ap_get_brigade(f->next, bb, mode, readbytes)) != APR_SUCCESS) {
- return rv;
- }
-
- APR_BRIGADE_FOREACH(b, bb) {
- apr_bucket_read(b, &str, &n, 1);
- if (n > 0) {
- old_index = ctx->post_len;
- ctx->post_len += n;
- ctx->post_data = realloc(ctx->post_data, ctx->post_len + 1);
- memcpy(ctx->post_data + old_index, str, n);
- }
- }
- return APR_SUCCESS;
-}
-
-static void php_apache_request_ctor(ap_filter_t *f, php_struct *ctx SLS_DC)
-{
- char *content_type;
- const char *auth;
- CLS_FETCH();
- ELS_FETCH();
- PLS_FETCH();
-
- PG(during_request_startup) = 0;
- SG(sapi_headers).http_response_code = 200;
- SG(request_info).content_type = apr_table_get(f->r->headers_in, "Content-Type");
-#undef safe_strdup
-#define safe_strdup(x) ((x)?strdup((x)):NULL)
- SG(request_info).query_string = safe_strdup(f->r->args);
- SG(request_info).request_method = f->r->method;
- SG(request_info).request_uri = safe_strdup(f->r->uri);
- f->r->no_local_copy = 1;
- content_type = sapi_get_default_content_type(SLS_C);
- f->r->content_type = apr_pstrdup(f->r->pool, content_type);
- SG(request_info).post_data = ctx->post_data;
- SG(request_info).post_data_length = ctx->post_len;
- efree(content_type);
- apr_table_unset(f->r->headers_out, "Content-Length");
- apr_table_unset(f->r->headers_out, "Last-Modified");
- apr_table_unset(f->r->headers_out, "Expires");
- apr_table_unset(f->r->headers_out, "ETag");
- apr_table_unset(f->r->headers_in, "Connection");
- auth = apr_table_get(f->r->headers_in, "Authorization");
- php_handle_auth_data(auth SLS_CC);
-
- php_request_startup(CLS_C ELS_CC PLS_CC SLS_CC);
-}
-
-static void php_apache_request_dtor(ap_filter_t *f SLS_DC)
-{
- php_request_shutdown(NULL);
-
-#undef safe_free
-#define safe_free(x) ((x)?free((x)):0)
- safe_free(SG(request_info).query_string);
- safe_free(SG(request_info).request_uri);
-}
-
-static int php_output_filter(ap_filter_t *f, apr_bucket_brigade *bb)
-{
- php_struct *ctx;
- apr_bucket *b;
- apr_status_t rv;
- const char *str;
- apr_ssize_t n;
- void *conf = ap_get_module_config(f->r->per_dir_config, &php4_module);
- SLS_FETCH();
-
- ctx = SG(server_context);
- INIT_CTX;
-
- ctx->f = f;
-
- /* states:
- * 0: request startup
- * 1: collecting data
- * 2: script execution and request shutdown
- */
- if (ctx->state == 0) {
-
- apply_config(conf);
-
- ctx->state++;
-
- php_apache_request_ctor(f, ctx SLS_CC);
- }
-
- /* moves all buckets from bb to ctx->bb */
- ap_save_brigade(f, &ctx->bb, &bb);
-
- /* If we have received all data from the previous filters,
- * we "flatten" the buckets by creating a single string buffer.
- */
- if (ctx->state == 1 && APR_BUCKET_IS_EOS(APR_BRIGADE_LAST(ctx->bb))) {
- int fd;
- zend_file_handle zfd;
- smart_str content = {0};
- apr_bucket *eos;
- CLS_FETCH();
- ELS_FETCH();
- PLS_FETCH();
-
- /* We want to execute only one script per request.
- * A bug in Apache or other filters could cause us
- * to reenter php_filter during script execution, so
- * we protect ourselves here.
- */
- ctx->state = 2;
-
- /* Handle phpinfo/phpcredits/built-in images */
- if (php_handle_special_queries(SLS_C PLS_CC))
- goto ok;
-
- /* Loop over all buckets and put them into the buffer */
- APR_BRIGADE_FOREACH(b, ctx->bb) {
- rv = apr_bucket_read(b, &str, &n, 1);
- if (rv == APR_SUCCESS && n > 0)
- smart_str_appendl(&content, str, n);
- }
-
- /* Empty script */
- if (!content.c) goto skip_execution;
-
- smart_str_0(&content);
-
- /*
- * This hack is used only for testing purposes and will
- * go away when the scripting engine will be able to deal
- * with something more complex than files/-handles.
- */
-
-#if 1
-#define FFFF "/tmp/really_silly"
- fd = open(FFFF, O_WRONLY|O_TRUNC|O_CREAT, 0600);
-
- write(fd, content.c, content.len);
-
- close(fd);
-
- zfd.type = ZEND_HANDLE_FILENAME;
- zfd.filename = FFFF;
- zfd.free_filename = 0;
- zfd.opened_path = NULL;
-
- php_execute_script(&zfd CLS_CC ELS_CC PLS_CC);
-#else
- CG(in_compilation) = 1;
- zend_eval_string(content, NULL, "foo" CLS_CC ELS_CC);
-#endif
-
- smart_str_free(&content);
- goto ok;
-skip_execution:
-#define NO_DATA "php_filter did not get ANY data"
- eos = apr_bucket_transient_create(NO_DATA, sizeof(NO_DATA)-1);
- APR_BRIGADE_INSERT_HEAD(bb, eos);
-ok:
- php_apache_request_dtor(f SLS_CC);
-
- SG(server_context) = 0;
- /* Pass EOS bucket to next filter to signal end of request */
- eos = apr_bucket_eos_create();
- APR_BRIGADE_INSERT_TAIL(bb, eos);
-
- return ap_pass_brigade(f->next, bb);
- } else
- apr_brigade_destroy(bb);
-
- return APR_SUCCESS;
-}
-
-static apr_status_t
-php_apache_server_shutdown(void *tmp)
-{
- apache2_sapi_module.shutdown(&apache2_sapi_module);
- sapi_shutdown();
- tsrm_shutdown();
- return APR_SUCCESS;
-}
-
-static void
-php_apache_server_startup(apr_pool_t *pchild, server_rec *s)
-{
- tsrm_startup(1, 1, 0, NULL);
- sapi_startup(&apache2_sapi_module);
- apache2_sapi_module.startup(&apache2_sapi_module);
- apr_pool_cleanup_register(pchild, NULL, php_apache_server_shutdown, NULL);
- php_apache_register_module();
-}
-
-static void php_register_hook(apr_pool_t *p)
-{
- ap_hook_child_init(php_apache_server_startup, NULL, NULL, APR_HOOK_MIDDLE);
- ap_register_output_filter("PHP", php_output_filter, AP_FTYPE_CONTENT);
- ap_register_input_filter("PHP", php_input_filter, AP_FTYPE_CONTENT);
-}
-
-AP_MODULE_DECLARE_DATA module php4_module = {
- STANDARD20_MODULE_STUFF,
- create_php_config, /* create per-directory config structure */
- merge_php_config, /* merge per-directory config structures */
- NULL, /* create per-server config structure */
- NULL, /* merge per-server config structures */
- php_dir_cmds, /* command apr_table_t */
- php_register_hook /* register hooks */
-};
diff --git a/sapi/caudium/CREDITS b/sapi/caudium/CREDITS
deleted file mode 100644
index 45789dbdfe..0000000000
--- a/sapi/caudium/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-Caudium / Roxen
-David Hedbor
diff --git a/sapi/caudium/Makefile.in b/sapi/caudium/Makefile.in
deleted file mode 100644
index 6063dd209b..0000000000
--- a/sapi/caudium/Makefile.in
+++ /dev/null
@@ -1,5 +0,0 @@
-
-LTLIBRARY_NAME = libsapi.la
-LTLIBRARY_SOURCES = caudium.c
-
-include $(top_srcdir)/build/ltlib.mk
diff --git a/sapi/caudium/README b/sapi/caudium/README
deleted file mode 100644
index 86ef65655d..0000000000
--- a/sapi/caudium/README
+++ /dev/null
@@ -1,16 +0,0 @@
-Embedded Caudium PHP support. It seems to work but isn't tested
-much. Due to a design choice it requires _Pike_ threads and a
-thread-safe PHP. It doesn't however require _Caudium_ to run in
-threaded mode. Due to the design, utilization of multiple processors
-should be pretty good.
-
-It requires a new Pike 7.0 and Caudium. It will not work with
-Roxen. Also, with the help of the VIRTUAL_DIR code in PHP, PHP
-execution should be very similar to that of mod_php or the cgi
-script.
-
-If you have any questions, please contact me, David Hedbor
-(neotron@php.net or neotron@caudium.net). For more information on
-Caudium, see http://caudium.net/ and http://caudium.org/.
-
-
diff --git a/sapi/caudium/TODO b/sapi/caudium/TODO
deleted file mode 100644
index b8217c5934..0000000000
--- a/sapi/caudium/TODO
+++ /dev/null
@@ -1,30 +0,0 @@
-TODO:
-
-- per-virtual-server configuration
-- configurable limit of number of concurrent PHP executions
-- fix setting of auth info.
-
-FIXED:
-+ => fixed
-- => not fixed and no fix planned
-? => Maybe fixed, maybe not.
-
-+ Allow multiple headers
- This is now fixed.
-+ fix backtraces
- Uses th_farm, thus problem is fixed
-+ exit in PHP exits Caudium
- Name conflict with do_exit in Pike and PHP. Reported to both teams.
-+ POST newline added?
- Was a Caudium bug.
-+ use th_farm
- Yeppers. Works great.
-- change cwd in single threaded mode
- There will be no single threaded mode support. The Caudium module
- will requite PHP ZTS and Pike threads to run. Single threaded PHP
- is rather uninteresting anyway.
-? Recursive mutex lock problem:
- Dunno if this is fixed. Major rewrite so it would have to be
- retested.
-
-
diff --git a/sapi/caudium/caudium.c b/sapi/caudium/caudium.c
deleted file mode 100644
index 44e296b51c..0000000000
--- a/sapi/caudium/caudium.c
+++ /dev/null
@@ -1,842 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: David Hedbor <neotron@php.net> |
- | Based on aolserver SAPI by Sascha Schumann <sascha@schumann.cx> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#include "php.h"
-#ifdef HAVE_CAUDIUM
-
-#include "php_ini.h"
-#include "php_globals.h"
-#include "SAPI.h"
-#include "php_main.h"
-#include "ext/standard/info.h"
-
-#include "php_version.h"
-
-/* Pike Include Files
- *
- * conflicts with pike avoided by only using long names. Requires a new
- * Pike 0.7 since it was implemented for this interface only.
- *
- */
-#define NO_PIKE_SHORTHAND
-
-/* Ok, we are now using Pike level threads to handle PHP4 since
- * the nice th_farm threads aren't working on Linux with glibc 2.2
- * (why this is I don't know).
- */
-#define USE_PIKE_LEVEL_THREADS
-
-#include <fdlib.h>
-#include <program.h>
-#include <pike_types.h>
-#include <interpret.h>
-#include <module_support.h>
-#include <array.h>
-#include <backend.h>
-#include <stralloc.h>
-#include <mapping.h>
-#include <object.h>
-#include <threads.h>
-#include <builtin_functions.h>
-#include <operators.h>
-#include <version.h>
-
-#if (PIKE_MAJOR_VERSION == 7 && PIKE_MINOR_VERSION == 1 && PIKE_BUILD_VERSION >= 12) || PIKE_MAJOR_VERSION > 7 || (PIKE_MAJOR_VERSION == 7 && PIKE_MINOR_VERSION > 1)
-# include "pike_error.h"
-#else
-# include "error.h"
-# ifndef Pike_error
-# define Pike_error error
-# endif
-#endif
-
-#ifndef ZTS
-/* Need thread safety */
-#error You need to compile PHP with threads.
-#endif
-
-#ifndef PIKE_THREADS
-#error The PHP4 module requires that your Pike has thread support.
-#endif
-
-#undef HIDE_GLOBAL_VARIABLES
-#undef REVEAL_GLOBAL_VARIABLES
-#define HIDE_GLOBAL_VARIABLES()
-#define REVEAL_GLOBAL_VARIABLES()
-
-/* php_caudium_request is per-request object storage */
-
-typedef struct
-{
- struct mapping *request_data;
- struct object *my_fd_obj;
- struct svalue done_cb;
- struct pike_string *filename;
- int my_fd;
- int written;
- SLS_D;
-} php_caudium_request;
-
-
-void pike_module_init(void);
-void pike_module_exit(void);
-static void free_struct(SLS_D);
-void f_php_caudium_request_handler(INT32 args);
-
-/* Defines to get to the data supplied when the script is started. */
-
-/* Per thread storage area id... */
-static int caudium_globals_id;
-
-#define GET_THIS() php_caudium_request *_request = ts_resource(caudium_globals_id)
-#define THIS _request
-#define PTHIS ((php_caudium_request *)(Pike_fp->current_storage))
-/* File descriptor integer. Used to write directly to the FD without
- * passing Pike
- */
-#define MY_FD (THIS->my_fd)
-
-/* FD object. Really a PHPScript object from Pike which implements a couple
- * of functions to handle headers, writing and buffering.
- */
-#define MY_FD_OBJ ((struct object *)(THIS->my_fd_obj))
-
-/* Mapping with data supplied from the calling Caudium module. Contains
- * a mapping with headers, an FD object etc.
- */
-#define REQUEST_DATA ((struct mapping *)(THIS->request_data))
-
-extern int fd_from_object(struct object *o);
-static unsigned char caudium_php_initialized;
-
-#ifndef mt_lock_interpreter
-#define mt_lock_interpreter() mt_lock(&interpreter_lock);
-#define mt_unlock_interpreter() mt_unlock(&interpreter_lock);
-#endif
-
-
-/* This allows calling of pike functions from the PHP callbacks,
- * which requires the Pike interpreter to be locked.
- */
-#define THREAD_SAFE_RUN(COMMAND, what) do {\
- struct thread_state *state;\
- if((state = thread_state_for_id(th_self()))!=NULL) {\
- if(!state->swapped) {\
- COMMAND;\
- } else {\
- mt_lock_interpreter();\
- SWAP_IN_THREAD(state);\
- COMMAND;\
- SWAP_OUT_THREAD(state);\
- mt_unlock_interpreter();\
- }\
- }\
-} while(0)
-
-
-
-/* Low level header lookup. Basically looks for the named header in the mapping
- * headers in the supplied options mapping.
- */
-
-INLINE static struct svalue *lookup_header(char *headername)
-{
- struct svalue *headers, *value;
- struct pike_string *sind;
- GET_THIS();
- sind = make_shared_string("env");
- headers = low_mapping_string_lookup(REQUEST_DATA, sind);
- free_string(sind);
- if(!headers || headers->type != PIKE_T_MAPPING) return NULL;
- sind = make_shared_string(headername);
- value = low_mapping_string_lookup(headers->u.mapping, sind);
- free_string(sind);
- if(!value) return NULL;
- return value;
-}
-
-/* Lookup a header in the mapping and return the value as a string, or
- * return the default if it's missing
- */
-INLINE static char *lookup_string_header(char *headername, char *default_value)
-{
- struct svalue *head = NULL;
- THREAD_SAFE_RUN(head = lookup_header(headername), "header lookup");
- if(!head || head->type != PIKE_T_STRING)
- return default_value;
- return head->u.string->str;
-}
-
-/* Lookup a header in the mapping and return the value as if it's an integer
- * and otherwise return the default.
- */
-INLINE static int lookup_integer_header(char *headername, int default_value)
-{
- struct svalue *head = NULL;
- THREAD_SAFE_RUN(head = lookup_header(headername), "header lookup");
- if(!head || head->type != PIKE_T_INT)
- return default_value;
- return head->u.integer;
-}
-
-/*
- * php_caudium_low_ub_write() writes data to the client connection. Might be
- * rewritten to do more direct IO to save CPU and the need to lock the
- * interpreter for better threading.
- */
-
-INLINE static int
-php_caudium_low_ub_write(const char *str, uint str_length) {
- int sent_bytes = 0;
- struct pike_string *to_write = NULL;
- PLS_FETCH();
- GET_THIS();
- if(!MY_FD_OBJ->prog) {
- PG(connection_status) = PHP_CONNECTION_ABORTED;
- zend_bailout();
- return -1;
- }
- to_write = make_shared_binary_string(str, str_length);
- push_string(to_write);
- safe_apply(MY_FD_OBJ, "write", 1);
- if(Pike_sp[-1].type == PIKE_T_INT)
- sent_bytes = Pike_sp[-1].u.integer;
- pop_stack();
- if(sent_bytes != str_length) {
- /* This means the connection is closed. Dead. Gone. *sniff* */
- PG(connection_status) = PHP_CONNECTION_ABORTED;
- zend_bailout();
- }
- return sent_bytes;
-}
-
-/*
- * php_caudium_sapi_ub_write() calls php_caudium_low_ub_write in a Pike thread
- * safe manner or writes directly to the output FD if RXML post-parsing is
- * disabled.
- */
-
-static int
-php_caudium_sapi_ub_write(const char *str, uint str_length)
-{
- PLS_FETCH();
- GET_THIS();
- int sent_bytes = 0, fd = MY_FD;
- if(fd)
- {
- for(sent_bytes=0;sent_bytes < str_length;)
- {
- int written;
- written = fd_write(fd, str + sent_bytes, str_length - sent_bytes);
- if(written < 0)
- {
- switch(errno)
- {
- default:
- /* This means the connection is closed. Dead. Gone. *sniff* */
- PG(connection_status) = PHP_CONNECTION_ABORTED;
- zend_bailout();
- THIS->written += sent_bytes;
- return sent_bytes;
- case EINTR:
- case EWOULDBLOCK:
- continue;
- }
- } else {
- sent_bytes += written;
- }
- }
- THIS->written += sent_bytes;
- } else {
- THREAD_SAFE_RUN(sent_bytes = php_caudium_low_ub_write(str, str_length),
- "write");
- }
- return sent_bytes;
-}
-
-/* php_caudium_set_header() sets a header in the header mapping. Called in a
- * thread safe manner from php_caudium_sapi_header_handler.
- */
-INLINE static void
-php_caudium_set_header(char *header_name, char *value, char *p)
-{
- struct svalue hsval;
- struct pike_string *hval, *ind, *hind;
- struct mapping *headermap;
- struct svalue *s_headermap, *soldval;
- int vallen;
- GET_THIS();
- // hval = make_shared_string(value);
- ind = make_shared_string(" _headers");
- hind = make_shared_binary_string(header_name,
- (int)(p - header_name));
-
- s_headermap = low_mapping_string_lookup(REQUEST_DATA, ind);
- if(!s_headermap || s_headermap->type != PIKE_T_MAPPING)
- {
- struct svalue mappie;
- mappie.type = PIKE_T_MAPPING;
- headermap = allocate_mapping(1);
- mappie.u.mapping = headermap;
- mapping_string_insert(REQUEST_DATA, ind, &mappie);
- free_mapping(headermap);
- hval = make_shared_string(value);
- } else {
- headermap = s_headermap->u.mapping;
- soldval = low_mapping_string_lookup(headermap, hind);
- vallen = strlen(value);
- if(soldval != NULL &&
- soldval->type == PIKE_T_STRING &&
- soldval->u.string->size_shift == 0) {
- /* Existing, valid header. Prepend.*/
- hval = begin_shared_string(soldval->u.string->len + 1 + vallen);
- MEMCPY(hval->str, soldval->u.string->str, soldval->u.string->len);
- STR0(hval)[soldval->u.string->len] = '\0';
- MEMCPY(hval->str+soldval->u.string->len+1, value, vallen);
- hval = end_shared_string(hval);
- } else {
- hval = make_shared_string(value);
- }
- }
- hsval.type = PIKE_T_STRING;
- hsval.u.string = hval;
-
- mapping_string_insert(headermap, hind, &hsval);
-
- free_string(hval);
- free_string(ind);
- free_string(hind);
-}
-
-/*
- * php_caudium_sapi_header_handler() sets a HTTP reply header to be
- * sent to the client.
- */
-static int
-php_caudium_sapi_header_handler(sapi_header_struct *sapi_header,
- sapi_headers_struct *sapi_headers SLS_DC)
-{
- char *header_name, *header_content, *p;
- header_name = sapi_header->header;
- header_content = p = strchr(header_name, ':');
-
- if(p) {
- do {
- header_content++;
- } while(*header_content == ' ');
- THREAD_SAFE_RUN(php_caudium_set_header(header_name, header_content, p), "header handler");
- }
- sapi_free_header(sapi_header);
- return 0;
-}
-
-/*
- * php_caudium_sapi_send_headers() flushes the headers to the client.
- * Called before real content is sent by PHP.
- */
-
-INLINE static int
-php_caudium_low_send_headers(sapi_headers_struct *sapi_headers SLS_DC)
-{
- PLS_FETCH();
- struct pike_string *ind;
- struct svalue *s_headermap;
- GET_THIS();
- if(!MY_FD_OBJ->prog) {
- PG(connection_status) = PHP_CONNECTION_ABORTED;
- zend_bailout();
- return SAPI_HEADER_SEND_FAILED;
- }
- ind = make_shared_string(" _headers");
- s_headermap = low_mapping_string_lookup(REQUEST_DATA, ind);
- free_string(ind);
-
- push_int(SG(sapi_headers).http_response_code);
- if(s_headermap && s_headermap->type == PIKE_T_MAPPING)
- ref_push_mapping(s_headermap->u.mapping);
- else
- push_int(0);
- safe_apply(MY_FD_OBJ, "send_headers", 2);
- pop_stack();
-
- return SAPI_HEADER_SENT_SUCCESSFULLY;
-}
-
-static int
-php_caudium_sapi_send_headers(sapi_headers_struct *sapi_headers SLS_DC)
-{
- int res = 0;
- THREAD_SAFE_RUN(res = php_caudium_low_send_headers(sapi_headers SLS_CC), "send headers");
- return res;
-}
-
-/*
- * php_caudium_sapi_read_post() reads a specified number of bytes from
- * the client. Used for POST/PUT requests.
- */
-
-INLINE static int php_caudium_low_read_post(char *buf, uint count_bytes)
-{
- uint total_read = 0;
- GET_THIS();
- PLS_FETCH();
-
- if(!MY_FD_OBJ->prog)
- {
- PG(connection_status) = PHP_CONNECTION_ABORTED;
- zend_bailout();
- return -1;
- }
- push_int(count_bytes);
- safe_apply(MY_FD_OBJ, "read_post", 1);
- if(Pike_sp[-1].type == PIKE_T_STRING) {
- MEMCPY(buf, Pike_sp[-1].u.string->str,
- (total_read = Pike_sp[-1].u.string->len));
- buf[total_read] = '\0';
- } else
- total_read = 0;
- pop_stack();
- return total_read;
-}
-
-static int
-php_caudium_sapi_read_post(char *buf, uint count_bytes SLS_DC)
-{
- uint total_read = 0;
- THREAD_SAFE_RUN(total_read = php_caudium_low_read_post(buf, count_bytes), "read post");
- return total_read;
-}
-
-/*
- * php_caudium_sapi_read_cookies() returns the Cookie header from
- * the HTTP request header
- */
-
-static char *
-php_caudium_sapi_read_cookies(SLS_D)
-{
- char *cookies;
- cookies = lookup_string_header("HTTP_COOKIE", NULL);
- return cookies;
-}
-
-static void php_info_caudium(ZEND_MODULE_INFO_FUNC_ARGS)
-{
- /* char buf[512]; */
- php_info_print_table_start();
- php_info_print_table_row(2, "SAPI module version", "$Id$");
- /* php_info_print_table_row(2, "Build date", Ns_InfoBuildDate());
- php_info_print_table_row(2, "Config file path", Ns_InfoConfigFile());
- php_info_print_table_row(2, "Error Log path", Ns_InfoErrorLog());
- php_info_print_table_row(2, "Installation path", Ns_InfoHomePath());
- php_info_print_table_row(2, "Hostname of server", Ns_InfoHostname());
- php_info_print_table_row(2, "Source code label", Ns_InfoLabel());
- php_info_print_table_row(2, "Server platform", Ns_InfoPlatform());
- snprintf(buf, 511, "%s/%s", Ns_InfoServerName(), Ns_InfoServerVersion());
- php_info_print_table_row(2, "Server version", buf);
- snprintf(buf, 511, "%d day(s), %02d:%02d:%02d",
- uptime / 86400,
- (uptime / 3600) % 24,
- (uptime / 60) % 60,
- uptime % 60);
- php_info_print_table_row(2, "Server uptime", buf);
- */
- php_info_print_table_end();
-}
-
-static zend_module_entry php_caudium_module = {
- "Caudium",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- php_info_caudium,
- STANDARD_MODULE_PROPERTIES
-};
-
-
-INLINE static void low_sapi_caudium_register_variables(zval *track_vars_array ELS_DC SLS_DC PLS_DC)
-{
- char *tmp;
- php_register_variable("PHP_SELF", SG(request_info).request_uri,
- track_vars_array ELS_CC PLS_CC);
- php_register_variable("GATEWAY_INTERFACE", "CGI/1.1",
- track_vars_array ELS_CC PLS_CC);
- php_register_variable("REQUEST_METHOD",
- (char *) SG(request_info).request_method,
- track_vars_array ELS_CC PLS_CC);
- php_register_variable("REQUEST_URI", SG(request_info).request_uri,
- track_vars_array ELS_CC PLS_CC);
- php_register_variable("PATH_TRANSLATED", SG(request_info).path_translated,
- track_vars_array ELS_CC PLS_CC);
-
- if( (tmp = lookup_string_header("SERVER_NAME", NULL)) != NULL)
- php_register_variable("SERVER_NAME", tmp, track_vars_array ELS_CC PLS_CC);
- if( (tmp = lookup_string_header("SERVER_PORT", NULL)) != NULL)
- php_register_variable("SERVER_PORT", tmp, track_vars_array ELS_CC PLS_CC);
- if( (tmp = lookup_string_header("SERVER_PROTOCOL", NULL)) != NULL)
- php_register_variable("SERVER_PROTOCOL", tmp, track_vars_array ELS_CC PLS_CC);
- if( (tmp = lookup_string_header("SCRIPT_NAME", NULL)) != NULL)
- php_register_variable("SCRIPT_NAME", tmp, track_vars_array ELS_CC PLS_CC);
- if( (tmp = lookup_string_header("SCRIPT_FILENAME", NULL)) != NULL)
- php_register_variable("SCRIPT_FILENAME", tmp, track_vars_array ELS_CC PLS_CC);
- if( (tmp = lookup_string_header("REMOTE_ADDR", NULL)) != NULL)
- php_register_variable("REMOTE_ADDR", tmp, track_vars_array ELS_CC PLS_CC);
- if( (tmp = lookup_string_header("REMOTE_PORT", NULL)) != NULL)
- php_register_variable("REMOTE_PORT", tmp, track_vars_array ELS_CC PLS_CC);
- if( (tmp = lookup_string_header("DOCUMENT_ROOT", NULL)) != NULL)
- php_register_variable("DOCUMENT_ROOT", tmp, track_vars_array ELS_CC PLS_CC);
- if( (tmp = lookup_string_header("HTTP_CONNECTION", NULL)) != NULL)
- php_register_variable("HTTP_CONNECTION", tmp, track_vars_array ELS_CC PLS_CC);
- if( (tmp = lookup_string_header("HTTP_USER_AGENT", NULL)) != NULL)
- php_register_variable("HTTP_USER_AGENT", tmp, track_vars_array ELS_CC PLS_CC);
- if( (tmp = lookup_string_header("DOCUMENT_ROOT", NULL)) != NULL)
- php_register_variable("DOCUMENT_ROOT", tmp, track_vars_array ELS_CC PLS_CC);
- if( (tmp = lookup_string_header("QUERY_STRING", "")) != NULL)
- php_register_variable("QUERY_STRING", tmp, track_vars_array ELS_CC PLS_CC);
- if( (tmp = lookup_string_header("REMOTE_USER", NULL)) != NULL)
- php_register_variable("REMOTE_USER", tmp, track_vars_array ELS_CC PLS_CC);
- if( (tmp = lookup_string_header("REMOTE_PASSWORD", NULL)) != NULL)
- php_register_variable("REMOTE_PASSWORD", tmp, track_vars_array ELS_CC PLS_CC);
-
-}
-
-static void sapi_caudium_register_variables(zval *track_vars_array ELS_DC SLS_DC PLS_DC)
-{
- THREAD_SAFE_RUN(low_sapi_caudium_register_variables(track_vars_array ELS_CC SLS_CC PLS_CC), "register_variables");
-}
-
-/* this structure is static (as in "it does not change") */
-static sapi_module_struct caudium_sapi_module = {
- "caudium",
- "Caudium",
- php_module_startup, /* startup */
- php_module_shutdown_wrapper, /* shutdown */
- NULL, /* activate */
- NULL, /* deactivate */
- php_caudium_sapi_ub_write, /* unbuffered write */
- NULL, /* flush */
- NULL, /* get uid */
- NULL, /* getenv */
- php_error, /* error handler */
- php_caudium_sapi_header_handler, /* header handler */
- php_caudium_sapi_send_headers, /* send headers handler */
- NULL, /* send header handler */
- php_caudium_sapi_read_post, /* read POST data */
- php_caudium_sapi_read_cookies, /* read cookies */
- sapi_caudium_register_variables, /* register server variables */
- NULL, /* Log message */
- NULL, /* Block interruptions */
- NULL, /* Unblock interruptions */
-
- STANDARD_SAPI_MODULE_PROPERTIES
-};
-
-/*
- * php_caudium_hash_environment() populates the php script environment
- * with a number of variables. HTTP_* variables are created for
- * the HTTP header data, so that a script can access these.
- */
-static void php_caudium_hash_environment(CLS_D ELS_DC PLS_DC SLS_DC)
-{
- int i;
- char buf[512];
- zval *pval;
- struct svalue *headers;
- struct pike_string *sind;
- struct array *indices;
- struct svalue *ind, *val;
- GET_THIS();
- sind = make_shared_string("env");
- headers = low_mapping_string_lookup(REQUEST_DATA, sind);
- free_string(sind);
- if(headers && headers->type == PIKE_T_MAPPING) {
- indices = mapping_indices(headers->u.mapping);
- for(i = 0; i < indices->size; i++) {
- ind = &indices->item[i];
- val = low_mapping_lookup(headers->u.mapping, ind);
- if(ind && ind->type == PIKE_T_STRING &&
- val && val->type == PIKE_T_STRING) {
- int buf_len;
- buf_len = MIN(511, ind->u.string->len);
- strncpy(buf, ind->u.string->str, buf_len);
- buf[buf_len] = '\0'; /* Terminate correctly */
- MAKE_STD_ZVAL(pval);
- pval->type = IS_STRING;
- pval->value.str.len = val->u.string->len;
- pval->value.str.val = estrndup(val->u.string->str, pval->value.str.len);
-
- zend_hash_update(&EG(symbol_table), buf, buf_len + 1, &pval, sizeof(zval *), NULL);
- }
- }
- free_array(indices);
- }
-
- /*
- MAKE_STD_ZVAL(pval);
- pval->type = IS_LONG;
- pval->value.lval = Ns_InfoBootTime();
- zend_hash_update(&EG(symbol_table), "SERVER_BOOTTIME", sizeof("SERVER_BOOTTIME"), &pval, sizeof(zval *), NULL);
- */
-}
-
-/*
- * php_caudium_module_main() is called by the per-request handler and
- * "executes" the script
- */
-
-static void php_caudium_module_main(php_caudium_request *ureq)
-{
- int res;
- zend_file_handle file_handle;
-#ifndef USE_PIKE_LEVEL_THREADS
- struct thread_state *state;
- extern struct program *thread_id_prog;
-#endif
- SLS_FETCH();
- CLS_FETCH();
- PLS_FETCH();
- ELS_FETCH();
- GET_THIS();
- THIS->filename = ureq->filename;
- THIS->done_cb = ureq->done_cb;
- THIS->my_fd_obj = ureq->my_fd_obj;
- THIS->my_fd = ureq->my_fd;
- THIS->request_data = ureq->request_data;
- free(ureq);
-
-#ifndef USE_PIKE_LEVEL_THREADS
- mt_lock_interpreter();
- init_interpreter();
-#if PIKE_MAJOR_VERSION == 7 && PIKE_MINOR_VERSION < 1
- thread_id = low_clone(thread_id_prog);
- state = OBJ2THREAD(thread_id);
- Pike_stack_top=((char *)&state)+ (thread_stack_size-16384) * STACK_DIRECTION;
- recoveries = NULL;
- call_c_initializers(thread_id);
- OBJ2THREAD(thread_id)->id=th_self();
- num_threads++;
- thread_table_insert(thread_id);
- state->status=THREAD_RUNNING;
-#else
- Pike_interpreter.thread_id = low_clone(thread_id_prog);
- state = OBJ2THREAD(Pike_interpreter.thread_id);
- Pike_interpreter.stack_top=((char *)&state)+ (thread_stack_size-16384) * STACK_DIRECTION;
- Pike_interpreter.recoveries = NULL;
- call_c_initializers(Pike_interpreter.thread_id);
- state->id=th_self();
- // SWAP_OUT_THREAD(OBJ2THREAD(Pike_interpreter.thread_id));
- num_threads++;
- thread_table_insert(Pike_interpreter.thread_id);
- state->status=THREAD_RUNNING;
-#endif
- state->swapped = 0;
-#endif
- SG(request_info).query_string = lookup_string_header("QUERY_STRING", 0);
- SG(server_context) = (void *)1; /* avoid server_context == NULL */
-
- /* path_translated is apparently the absolute path to the file, not
- the translated PATH_INFO
- */
- SG(request_info).path_translated =
- lookup_string_header("SCRIPT_FILENAME", NULL);
- SG(request_info).request_uri = lookup_string_header("DOCUMENT_URI", NULL);
- if(!SG(request_info).request_uri)
- SG(request_info).request_uri = lookup_string_header("SCRIPT_NAME", NULL);
- SG(request_info).request_method = lookup_string_header("REQUEST_METHOD", "GET");
- SG(request_info).content_length = lookup_integer_header("HTTP_CONTENT_LENGTH", 0);
- SG(request_info).content_type = lookup_string_header("HTTP_CONTENT_TYPE", NULL);
- SG(sapi_headers).http_response_code = 200;
- if (!strcmp(SG(request_info).request_method, "HEAD")) {
- SG(request_info).headers_only = 1;
- } else {
- SG(request_info).headers_only = 0;
- }
-
- /* Let PHP4 handle the deconding of the AUTH */
- php_handle_auth_data(lookup_string_header("HTTP_AUTHORIZATION", NULL), SLS_C);
- /* Swap out this thread and release the interpreter lock to allow
- * Pike threads to run. We wait since the above would otherwise require
- * a lot of unlock/lock.
- */
-#ifndef USE_PIKE_LEVEL_THREADS
- SWAP_OUT_THREAD(state);
- mt_unlock_interpreter();
-#else
- THREADS_ALLOW();
-#endif
-
-#ifdef VIRTUAL_DIR
- /* Change virtual directory, if the feature is enabled, which is
- * (almost) a requirement for PHP in Caudium. Might want to fail if it
- * isn't. Not a problem though, since it's on by default when using ZTS
- * which we require.
- */
- VCWD_CHDIR_FILE(THIS->filename->str);
-#endif
-
- file_handle.type = ZEND_HANDLE_FILENAME;
- file_handle.filename = THIS->filename->str;
- file_handle.opened_path = NULL;
- file_handle.free_filename = 0;
-
- THIS->written = 0;
- res = php_request_startup(CLS_C ELS_CC PLS_CC SLS_CC);
-
- if(res == FAILURE) {
- THREAD_SAFE_RUN({
- apply_svalue(&THIS->done_cb, 0);
- pop_stack();
- free_struct(SLS_C);
- }, "Negative run response");
- } else {
- THREAD_SAFE_RUN(php_caudium_hash_environment(CLS_C ELS_CC PLS_CC SLS_CC),
- "environment hashing");
- php_execute_script(&file_handle CLS_CC ELS_CC PLS_CC);
- php_request_shutdown(NULL);
- THREAD_SAFE_RUN({
- push_int(THIS->written);
- apply_svalue(&THIS->done_cb, 1);
- pop_stack();
- free_struct(SLS_C);
- }, "positive run response");
- }
-
-#ifndef USE_PIKE_LEVEL_THREADS
- mt_lock_interpreter();
- SWAP_IN_THREAD(state);
-#if PIKE_MAJOR_VERSION == 7 && PIKE_MINOR_VERSION < 1
- state->status=THREAD_EXITED;
- co_signal(& state->status_change);
- thread_table_delete(thread_id);
- free_object(thread_id);
- thread_id=NULL;
-#else
- state->status=THREAD_EXITED;
- co_signal(& state->status_change);
- thread_table_delete(Pike_interpreter.thread_id);
- free_object(Pike_interpreter.thread_id);
- Pike_interpreter.thread_id=NULL;
-#endif
- cleanup_interpret();
- num_threads--;
- mt_unlock_interpreter();
-#else
- THREADS_DISALLOW();
-#endif
-}
-
-/*
- * The php_caudium_request_handler() is called per request and handles
- * everything for one request.
- */
-
-void f_php_caudium_request_handler(INT32 args)
-{
- struct object *my_fd_obj;
- struct mapping *request_data;
- struct svalue *done_callback;
- struct pike_string *script;
- struct svalue *raw_fd;
- struct pike_string *ind;
- php_caudium_request *_request;
- THIS = malloc(sizeof(php_caudium_request));
- if(THIS == NULL)
- Pike_error("Out of memory.");
-
- get_all_args("PHP4.Interpreter->run", args, "%S%m%O%*", &script,
- &request_data, &my_fd_obj, &done_callback);
- if(done_callback->type != PIKE_T_FUNCTION)
- Pike_error("PHP4.Interpreter->run: Bad argument 4, expected function.\n");
- add_ref(request_data);
- add_ref(my_fd_obj);
- add_ref(script);
-
- THIS->request_data = request_data;
- THIS->my_fd_obj = my_fd_obj;
- THIS->filename = script;
- assign_svalue_no_free(&THIS->done_cb, done_callback);
-
- ind = make_shared_binary_string("my_fd", 5);
- raw_fd = low_mapping_string_lookup(THIS->request_data, ind);
- if(raw_fd && raw_fd->type == PIKE_T_OBJECT)
- {
- int fd = fd_from_object(raw_fd->u.object);
- if(fd == -1)
- THIS->my_fd = 0; /* Don't send directly to this FD... */
- else
- THIS->my_fd = fd;
- } else
- THIS->my_fd = 0;
-#ifdef USE_PIKE_LEVEL_THREADS
- php_caudium_module_main(THIS);
-#else
- th_farm((void (*)(void *))php_caudium_module_main, THIS);
-#endif
- pop_n_elems(args);
-}
-
-static void free_struct(SLS_D)
-{
- GET_THIS();
- if(THIS->request_data) free_mapping(THIS->request_data);
- if(THIS->my_fd_obj) free_object(THIS->my_fd_obj);
- free_svalue(&THIS->done_cb);
- if(THIS->filename) free_string(THIS->filename);
- MEMSET(THIS, 0, sizeof(php_caudium_request));
-}
-
-
-/*
- * pike_module_init() is called by Pike once at startup
- *
- * This functions allocates basic structures
- */
-
-void pike_module_init( void )
-{
- if (!caudium_php_initialized) {
- caudium_php_initialized = 1;
- tsrm_startup(1, 1, 0, NULL);
- caudium_globals_id = ts_allocate_id(sizeof(php_caudium_request), NULL, NULL);
- sapi_startup(&caudium_sapi_module);
- sapi_module.startup(&caudium_sapi_module);
- zend_startup_module(&php_caudium_module);
- }
- start_new_program(); /* Text */
- pike_add_function("run", f_php_caudium_request_handler,
- "function(string,mapping,object,function:void)", 0);
- end_class("Interpreter", 0);
-}
-
-/*
- * pike_module_exit() performs the last steps before the
- * server exists. Shutdowns basic services and frees memory
- */
-
-void pike_module_exit(void)
-{
- caudium_php_initialized = 0;
- sapi_module.shutdown(&caudium_sapi_module);
- tsrm_shutdown();
-}
-#endif
diff --git a/sapi/caudium/config.m4 b/sapi/caudium/config.m4
deleted file mode 100644
index 9fdbb3bebb..0000000000
--- a/sapi/caudium/config.m4
+++ /dev/null
@@ -1,98 +0,0 @@
-dnl ## $Id$ -*- sh -*-
-
-RESULT=no
-AC_MSG_CHECKING(for Caudium support)
-AC_ARG_WITH(caudium,
-[ --with-caudium=DIR Build PHP as a Pike module for use with Caudium
- DIR is the Caudium server dir, with the default value
- /usr/local/caudium/server.],
-[
- if test "$prefix" = "NONE"; then CPREF=/usr/local/; fi
- if test ! -d $withval ; then
- if test "$prefix" = "NONE"; then
- withval=/usr/local/caudium/server/
- else
- withval=$prefix/caudium/server/
- fi
- fi
- if test -f $withval/bin/caudium; then
- PIKE=$withval/bin/caudium
- elif test -f $withval/bin/pike; then
- PIKE=$withval/bin/pike
- else
- AC_MSG_ERROR(Couldn't find a pike in $withval/bin/)
- fi
- if $PIKE -e 'float v; int rel;sscanf(version(), "Pike v%f release %d", v, rel);v += rel/10000.0; if(v < 7.0268) exit(1); exit(0);'; then
- PIKE_MODULE_DIR=`$PIKE --show-paths 2>&1| grep '^Module' | sed -e 's/.*: //'`
- PIKE_INCLUDE_DIR=`echo $PIKE_MODULE_DIR | sed -e 's,lib/pike/modules,include/pike,' -e 's,lib/modules,include/pike,' `
- if test -z "$PIKE_INCLUDE_DIR" -o -z "$PIKE_MODULE_DIR"; then
- AC_MSG_ERROR(Failed to figure out Pike module and include directories)
- fi
- AC_MSG_RESULT(yes)
- PIKE=`echo $PIKE | pike -e 'int tries=100;
- string orig,pike=Stdio.File("stdin")->read()-"\n";
- orig=pike;
- if(search(orig, "/"))
- orig = combine_path(getcwd(), orig);
- while(!catch(pike=readlink(pike)) && tries--)
- ;
- write(combine_path(dirname(orig), pike)); '`
- PHP_ADD_INCLUDE($PIKE_INCLUDE_DIR)
- if test "$prefix" != "NONE"; then
- PIKE_C_INCLUDE=$prefix/include/`basename $PIKE`
- else
- PIKE_C_INCLUDE=/usr/local/include/`basename $PIKE`
- fi
- AC_MSG_CHECKING(for C includes in $PIKE_C_INCLUDE)
- if test -f $PIKE_C_INCLUDE/version.h; then
- PIKE_TEST_VER=`$PIKE -e 'string v; int rel;sscanf(version(), "Pike v%s release %d", v, rel); write(v+"."+rel);'`
- ###### VERSION MATCH CHECK #######
- PMAJOR="^#define PIKE_MAJOR_VERSION"
- PMINOR="^#define PIKE_MINOR_VERSION"
- PBUILD="^#define PIKE_BUILD_VERSION"
-
- PIKE_CMAJOR_VERSION=0
- PIKE_CMINOR_VERSION=0
- PIKE_CBUILD_VERSION=0
-
- PIKE_CMAJOR_VERSION=`grep "$PMAJOR" $PIKE_C_INCLUDE/version.h | sed -e 's/\(#define.*N \)\(.*\)/\2/'`
- if test -z "$PIKE_CMAJOR_VERSION"; then
- if test -n "`grep f_version $PIKE_C_INCLUDE/version.h`"; then
- PIKE_CMAJOR_VERSION=6
- fi
- else
- PIKE_CMINOR_VERSION=`grep "$PMINOR" $PIKE_C_INCLUDE/version.h | sed -e 's/\(#define.*N \)\(.*\)/\2/'`
- PIKE_CBUILD_VERSION=`grep "$PBUILD" $PIKE_C_INCLUDE/version.h | sed -e 's/\(#define.*N \)\(.*\)/\2/'`
- fi
-
- if test "$PIKE_TEST_VER" = "${PIKE_CMAJOR_VERSION}.${PIKE_CMINOR_VERSION}.${PIKE_CBUILD_VERSION}"; then
- PHP_ADD_INCLUDE($PIKE_C_INCLUDE)
- PIKE_INCLUDE_DIR="$PIKE_INCLUDE_DIR, $PIKE_C_INCLUDE"
- AC_MSG_RESULT(found)
- else
- AC_MSG_RESULT(version mismatch)
- fi
- else
- AC_MSG_RESULT(not found)
- fi
- else
- AC_MSG_ERROR(Caudium PHP4 requires Pike 7.0 or newer)
- fi
- PIKE_VERSION=`$PIKE -e 'string v; int rel;sscanf(version(), "Pike v%s release %d", v, rel); write(v+"."+rel);'`
- AC_DEFINE(HAVE_CAUDIUM,1,[Whether to compile with Caudium support])
- PHP_SAPI=caudium
- PHP_BUILD_SHARED
- INSTALL_IT="\$(INSTALL) -m 0755 $SAPI_SHARED $withval/lib/$PIKE_VERSION/PHP4.so"
- RESULT=" *** Pike binary used: $PIKE
- *** Pike include dir(s) used: $PIKE_INCLUDE_DIR
- *** Pike version: $PIKE_VERSION"
- dnl Always use threads since thread-free support really blows.
- PHP_BUILD_THREAD_SAFE
-
-])
-AC_MSG_RESULT($RESULT)
-
-dnl ## Local Variables:
-dnl ## tab-width: 4
-dnl ## End:
-
diff --git a/sapi/cgi/CREDITS b/sapi/cgi/CREDITS
deleted file mode 100644
index 734f5c5a78..0000000000
--- a/sapi/cgi/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-CGI
-Rasmus Lerdorf, Stig Bakken
diff --git a/sapi/cgi/Makefile.in b/sapi/cgi/Makefile.in
deleted file mode 100644
index 3b66c7d418..0000000000
--- a/sapi/cgi/Makefile.in
+++ /dev/null
@@ -1,5 +0,0 @@
-
-LTLIBRARY_NAME = libsapi.la
-LTLIBRARY_SOURCES = cgi_main.c getopt.c
-
-include $(top_srcdir)/build/ltlib.mk
diff --git a/sapi/cgi/cgi_main.c b/sapi/cgi/cgi_main.c
deleted file mode 100644
index bd1ae85873..0000000000
--- a/sapi/cgi/cgi_main.c
+++ /dev/null
@@ -1,810 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
- | Stig Bakken <ssb@fast.no> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-
-#include "php.h"
-#include "php_globals.h"
-#include "php_variables.h"
-#include "zend_modules.h"
-
-#include "SAPI.h"
-
-#include <stdio.h>
-#include "php.h"
-#ifdef PHP_WIN32
-#include "win32/time.h"
-#include "win32/signal.h"
-#include <process.h>
-#else
-#include "build-defs.h"
-#endif
-#if HAVE_SYS_TIME_H
-#include <sys/time.h>
-#endif
-#if HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#if HAVE_SIGNAL_H
-#include <signal.h>
-#endif
-#if HAVE_SETLOCALE
-#include <locale.h>
-#endif
-#include "zend.h"
-#include "zend_extensions.h"
-#include "php_ini.h"
-#include "php_globals.h"
-#include "php_main.h"
-#include "fopen_wrappers.h"
-#include "ext/standard/php_standard.h"
-#ifdef PHP_WIN32
-#include <io.h>
-#include <fcntl.h>
-#include "win32/php_registry.h"
-#endif
-
-#if HAVE_SIGNAL_H
-#include <signal.h>
-#endif
-
-#include "zend_compile.h"
-#include "zend_execute.h"
-#include "zend_highlight.h"
-#include "zend_indent.h"
-
-
-#include "php_getopt.h"
-
-#define PHP_MODE_STANDARD 1
-#define PHP_MODE_HIGHLIGHT 2
-#define PHP_MODE_INDENT 3
-#define PHP_MODE_LINT 4
-
-extern char *ap_php_optarg;
-extern int ap_php_optind;
-
-#define OPTSTRING "aCc:d:ef:g:hilmnqs?vz:"
-
-static int _print_module_info ( zend_module_entry *module, void *arg ) {
- php_printf("%s\n", module->name);
- return 0;
-}
-
-#ifndef STDOUT_FILENO
-#define STDOUT_FILENO 1
-#endif
-
-static inline size_t sapi_cgibin_single_write(const char *str, uint str_length)
-{
-#ifdef PHP_WRITE_STDOUT
- long ret;
-
- ret = write(STDOUT_FILENO, str, str_length);
- if (ret <= 0) return 0;
- return ret;
-#else
- size_t ret;
-
- ret = fwrite(str, 1, MIN(str_length, 16384), stdout);
- return ret;
-#endif
-}
-
-static int sapi_cgibin_ub_write(const char *str, uint str_length)
-{
- const char *ptr = str;
- uint remaining = str_length;
- size_t ret;
-
- while (remaining > 0)
- {
- ret = sapi_cgibin_single_write(ptr, remaining);
- if (!ret) {
- php_handle_aborted_connection();
- }
- ptr += ret;
- remaining -= ret;
- }
-
- return str_length;
-}
-
-
-static void sapi_cgibin_flush(void *server_context)
-{
- if (fflush(stdout)==EOF) {
- php_handle_aborted_connection();
- }
-}
-
-
-static void sapi_cgi_send_header(sapi_header_struct *sapi_header, void *server_context)
-{
- if (sapi_header) {
- PHPWRITE_H(sapi_header->header, sapi_header->header_len);
- }
- PHPWRITE_H("\r\n", 2);
-}
-
-
-static int sapi_cgi_read_post(char *buffer, uint count_bytes SLS_DC)
-{
- uint read_bytes=0, tmp_read_bytes;
-
- count_bytes = MIN(count_bytes, (uint)SG(request_info).content_length-SG(read_post_bytes));
- while (read_bytes < count_bytes) {
- tmp_read_bytes = read(0, buffer+read_bytes, count_bytes-read_bytes);
- if (tmp_read_bytes<=0) {
- break;
- }
- read_bytes += tmp_read_bytes;
- }
- return read_bytes;
-}
-
-
-static char *sapi_cgi_read_cookies(SLS_D)
-{
- return getenv("HTTP_COOKIE");
-}
-
-
-static void sapi_cgi_register_variables(zval *track_vars_array ELS_DC SLS_DC PLS_DC)
-{
- /* In CGI mode, we consider the environment to be a part of the server
- * variables
- */
- php_import_environment_variables(track_vars_array ELS_CC PLS_CC);
-
- /* Build the special-case PHP_SELF variable for the CGI version */
- php_register_variable("PHP_SELF", (SG(request_info).request_uri ? SG(request_info).request_uri:""), track_vars_array ELS_CC PLS_CC);
-}
-
-
-static void sapi_cgi_log_message(char *message)
-{
- if (php_header()) {
- fprintf(stderr, "%s", message);
- fprintf(stderr, "\n");
- }
-}
-
-static int sapi_cgi_deactivate(SLS_D)
-{
- fflush(stdout);
- if(SG(request_info).argv0) {
- free(SG(request_info).argv0);
- SG(request_info).argv0 = NULL;
- }
- return SUCCESS;
-}
-
-
-/* {{{ sapi_module_struct cgi_sapi_module
- */
-static sapi_module_struct cgi_sapi_module = {
- "cgi", /* name */
- "CGI", /* pretty name */
-
- php_module_startup, /* startup */
- php_module_shutdown_wrapper, /* shutdown */
-
- NULL, /* activate */
- sapi_cgi_deactivate, /* deactivate */
-
- sapi_cgibin_ub_write, /* unbuffered write */
- sapi_cgibin_flush, /* flush */
- NULL, /* get uid */
- NULL, /* getenv */
-
- php_error, /* error handler */
-
- NULL, /* header handler */
- NULL, /* send headers handler */
- sapi_cgi_send_header, /* send header handler */
-
- sapi_cgi_read_post, /* read POST data */
- sapi_cgi_read_cookies, /* read Cookies */
-
- sapi_cgi_register_variables, /* register server variables */
- sapi_cgi_log_message, /* Log message */
-
- NULL, /* Block interruptions */
- NULL, /* Unblock interruptions */
-
- STANDARD_SAPI_MODULE_PROPERTIES
-};
-/* }}} */
-
-/* {{{ php_cgi_usage
- */
-static void php_cgi_usage(char *argv0)
-{
- char *prog;
-
- prog = strrchr(argv0, '/');
- if (prog) {
- prog++;
- } else {
- prog = "php";
- }
-
- php_printf("Usage: %s [-q] [-h] [-s [-v] [-i] [-f <file>] | {<file> [args...]}\n"
- " -q Quiet-mode. Suppress HTTP Header output.\n"
- " -s Display colour syntax highlighted source.\n"
- " -f <file> Parse <file>. Implies `-q'\n"
- " -v Version number\n"
- " -C Do not chdir to the script's directory\n"
- " -c <path> Look for php.ini file in this directory\n"
-#if SUPPORT_INTERACTIVE
- " -a Run interactively\n"
-#endif
- " -d foo[=bar] Define INI entry foo with value 'bar'\n"
- " -e Generate extended information for debugger/profiler\n"
- " -z <file> Load Zend extension <file>.\n"
- " -l Syntax check only (lint)\n"
- " -m Show compiled in modules\n"
- " -i PHP information\n"
- " -h This help\n", prog);
-}
-/* }}} */
-
-/* {{{ init_request_info
- */
-static void init_request_info(SLS_D)
-{
- char *content_length = getenv("CONTENT_LENGTH");
- char *content_type = getenv("CONTENT_TYPE");
- const char *auth;
-
-#if 0
-/* SG(request_info).path_translated is always set to NULL at the end of this function
- call so why the hell did this code exist in the first place? Am I missing something? */
- char *script_filename;
-
-
- script_filename = getenv("SCRIPT_FILENAME");
- /* Hack for annoying servers that do not set SCRIPT_FILENAME for us */
- if (!script_filename) {
- script_filename = SG(request_info).argv0;
- }
-#ifdef PHP_WIN32
- /* FIXME WHEN APACHE NT IS FIXED */
- /* a hack for apache nt because it does not appear to set argv[1] and sets
- script filename to php.exe thus makes us parse php.exe instead of file.php
- requires we get the info from path translated. This can be removed at
- such a time that apache nt is fixed */
- if (!script_filename) {
- script_filename = getenv("PATH_TRANSLATED");
- }
-#endif
-
- /* doc_root configuration variable is currently ignored,
- as it is with every other access method currently also. */
-
- /* We always need to emalloc() filename, since it gets placed into
- the include file hash table, and gets freed with that table.
- Notice that this means that we don't need to efree() it in
- php_destroy_request_info()! */
-#if DISCARD_PATH
- if (script_filename) {
- SG(request_info).path_translated = estrdup(script_filename);
- } else {
- SG(request_info).path_translated = NULL;
- }
-#endif
-
-#endif /* 0 */
-
- SG(request_info).request_method = getenv("REQUEST_METHOD");
- SG(request_info).query_string = getenv("QUERY_STRING");
- SG(request_info).request_uri = getenv("PATH_INFO");
- if (!SG(request_info).request_uri) {
- SG(request_info).request_uri = getenv("SCRIPT_NAME");
- }
- SG(request_info).path_translated = NULL; /* we have to update it later, when we have that information */
- SG(request_info).content_type = (content_type ? content_type : "" );
- SG(request_info).content_length = (content_length?atoi(content_length):0);
- SG(sapi_headers).http_response_code = 200;
-
- /* The CGI RFC allows servers to pass on unvalidated Authorization data */
- auth = getenv("HTTP_AUTHORIZATION");
- php_handle_auth_data(auth SLS_CC);
-}
-/* }}} */
-
-static void define_command_line_ini_entry(char *arg)
-{
- char *name, *value;
-
- name = arg;
- value = strchr(arg, '=');
- if (value) {
- *value = 0;
- value++;
- } else {
- value = "1";
- }
- zend_alter_ini_entry(name, strlen(name)+1, value, strlen(value), PHP_INI_SYSTEM, PHP_INI_STAGE_ACTIVATE);
-}
-
-
-static void php_register_command_line_global_vars(char **arg)
-{
- char *var, *val;
- ELS_FETCH();
- PLS_FETCH();
-
- var = *arg;
- val = strchr(var, '=');
- if (!val) {
- printf("No value specified for variable '%s'\n", var);
- } else {
- *val++ = '\0';
- php_register_variable(var, val, NULL ELS_CC PLS_CC);
- }
- efree(*arg);
-}
-
-/* {{{ main
- */
-int main(int argc, char *argv[])
-{
- int exit_status = SUCCESS;
- int cgi = 0, c, i, len;
- zend_file_handle file_handle;
- char *s;
-/* temporary locals */
- int behavior=PHP_MODE_STANDARD;
- int no_headers=0;
- int orig_optind=ap_php_optind;
- char *orig_optarg=ap_php_optarg;
- char *argv0=NULL;
- char *script_file=NULL;
- zend_llist global_vars;
-#if SUPPORT_INTERACTIVE
- int interactive=0;
-#endif
-/* end of temporary locals */
-#ifdef ZTS
- zend_compiler_globals *compiler_globals;
- zend_executor_globals *executor_globals;
- php_core_globals *core_globals;
- sapi_globals_struct *sapi_globals;
-#endif
-
-
-#ifdef HAVE_SIGNAL_H
-#if defined(SIGPIPE) && defined(SIG_IGN)
- signal(SIGPIPE,SIG_IGN); /* ignore SIGPIPE in standalone mode so
- that sockets created via fsockopen()
- don't kill PHP if the remote site
- closes it. in apache|apxs mode apache
- does that for us! thies@thieso.net
- 20000419 */
-#endif
-#endif
-
-#ifndef ZTS
- if (setjmp(EG(bailout))!=0) {
- return -1;
- }
-#endif
-
-#ifdef ZTS
- tsrm_startup(1,1,0, NULL);
-#endif
-
- sapi_startup(&cgi_sapi_module);
-
-#ifdef PHP_WIN32
- _fmode = _O_BINARY; /*sets default for file streams to binary */
- setmode(_fileno(stdin), O_BINARY); /* make the stdio mode be binary */
- setmode(_fileno(stdout), O_BINARY); /* make the stdio mode be binary */
- setmode(_fileno(stderr), O_BINARY); /* make the stdio mode be binary */
-#endif
-
-
- /* Make sure we detect we are a cgi - a bit redundancy here,
- but the default case is that we have to check only the first one. */
- if (getenv("SERVER_SOFTWARE")
- || getenv("SERVER_NAME")
- || getenv("GATEWAY_INTERFACE")
- || getenv("REQUEST_METHOD")) {
- cgi = 1;
- if (argc > 1) {
- argv0 = strdup(argv[1]);
- } else {
- argv0 = NULL;
- }
- }
-
- if (!cgi) {
- while ((c=ap_php_getopt(argc, argv, OPTSTRING))!=-1) {
- switch (c) {
- case 'c':
- cgi_sapi_module.php_ini_path_override = strdup(ap_php_optarg);
- break;
- }
-
- }
- ap_php_optind = orig_optind;
- ap_php_optarg = orig_optarg;
- }
-
- /* startup after we get the above ini override se we get things right */
- if (php_module_startup(&cgi_sapi_module)==FAILURE) {
- return FAILURE;
- }
-
-#if FORCE_CGI_REDIRECT
- /* check force_cgi after startup, so we have proper output */
- if (cgi) {
- /* Apache will generate REDIRECT_STATUS,
- * Netscape and redirect.so will generate HTTP_REDIRECT_STATUS.
- * redirect.so and installation instructions available from
- * http://www.koehntopp.de/php.
- * -- kk@netuse.de
- */
- if (!getenv("REDIRECT_STATUS") && !getenv ("HTTP_REDIRECT_STATUS")) {
- PUTS("<b>Security Alert!</b> PHP CGI cannot be accessed directly.\n\
-\n\
-<P>This PHP CGI binary was compiled with force-cgi-redirect enabled. This\n\
-means that a page will only be served up if the REDIRECT_STATUS CGI variable is\n\
-set. This variable is set, for example, by Apache's Action directive redirect.\n\
-<P>You may disable this restriction by recompiling the PHP binary with the\n\
---disable-force-cgi-redirect switch. If you do this and you have your PHP CGI\n\
-binary accessible somewhere in your web tree, people will be able to circumvent\n\
-.htaccess security by loading files through the PHP parser. A good way around\n\
-this is to define doc_root in your php.ini file to something other than your\n\
-top-level DOCUMENT_ROOT. This way you can separate the part of your web space\n\n\
-which uses PHP from the normal part using .htaccess security. If you do not have\n\
-any .htaccess restrictions anywhere on your site you can leave doc_root undefined.\n\
-\n");
-
- /* remove that detailed explanation some time */
-
- return FAILURE;
- }
- }
-#endif /* FORCE_CGI_REDIRECT */
-
-#ifdef ZTS
- compiler_globals = ts_resource(compiler_globals_id);
- executor_globals = ts_resource(executor_globals_id);
- core_globals = ts_resource(core_globals_id);
- sapi_globals = ts_resource(sapi_globals_id);
- if (setjmp(EG(bailout))!=0) {
- return -1;
- }
-#endif
-
- if (!cgi) {
- while ((c=ap_php_getopt(argc, argv, OPTSTRING))!=-1) {
- switch (c) {
- case '?':
- no_headers = 1;
- php_output_startup();
- SG(headers_sent) = 1;
- php_cgi_usage(argv[0]);
- php_end_ob_buffers(1);
- exit(1);
- break;
- }
- }
- ap_php_optind = orig_optind;
- ap_php_optarg = orig_optarg;
- }
-
- init_request_info(SLS_C);
- SG(server_context) = (void *) 1; /* avoid server_context==NULL checks */
- CG(extended_info) = 0;
-
- SG(request_info).argv0 = argv0;
-
- zend_llist_init(&global_vars, sizeof(char *), NULL, 0);
-
- if (!cgi) { /* never execute the arguments if you are a CGI */
- if (SG(request_info).argv0) {
- free(SG(request_info).argv0);
- SG(request_info).argv0 = NULL;
- }
- while ((c = ap_php_getopt(argc, argv, OPTSTRING)) != -1) {
- switch (c) {
-
- case 'a': /* interactive mode */
-#if SUPPORT_INTERACTIVE
- printf("Interactive mode enabled\n\n");
- interactive=1;
-#else
- printf("Interactive mode not supported!\n\n");
-#endif
- break;
-
- case 'C': /* don't chdir to the script directory */
- SG(options) |= SAPI_OPTION_NO_CHDIR;
- break;
- case 'd': /* define ini entries on command line */
- define_command_line_ini_entry(ap_php_optarg);
- break;
-
- case 'e': /* enable extended info output */
- CG(extended_info) = 1;
- break;
-
- case 'f': /* parse file */
- script_file = estrdup(ap_php_optarg);
- no_headers = 1;
- break;
-
- case 'g': /* define global variables on command line */
- {
- char *arg = estrdup(ap_php_optarg);
-
- zend_llist_add_element(&global_vars, &arg);
- }
- break;
-
- case 'h': /* help & quit */
- case '?':
- no_headers = 1;
- php_output_startup();
- SG(headers_sent) = 1;
- php_cgi_usage(argv[0]);
- php_end_ob_buffers(1);
- exit(1);
- break;
-
- case 'i': /* php info & quit */
- if (php_request_startup(CLS_C ELS_CC PLS_CC SLS_CC)==FAILURE) {
- php_module_shutdown();
- return FAILURE;
- }
- if (no_headers) {
- SG(headers_sent) = 1;
- SG(request_info).no_headers = 1;
- }
- php_print_info(0xFFFFFFFF);
- exit(1);
- break;
-
- case 'l': /* syntax check mode */
- no_headers = 1;
- behavior=PHP_MODE_LINT;
- break;
-
- case 'm': /* list compiled in modules */
- php_output_startup();
- SG(headers_sent) = 1;
- php_printf("Running PHP %s\n%s\n", PHP_VERSION , get_zend_version());
- php_printf("[PHP Modules]\n");
- zend_hash_apply_with_argument(&module_registry, (int (*)(void *, void *)) _print_module_info, NULL);
- php_printf("\n[Zend Modules]\n");
- zend_llist_apply_with_argument(&zend_extensions, (void (*)(void *, void *)) _print_module_info, NULL);
- php_printf("\n");
- php_end_ob_buffers(1);
- exit(1);
- break;
-
-#if 0 /* not yet operational, see also below ... */
- case 'n': /* generate indented source mode*/
- behavior=PHP_MODE_INDENT;
- break;
-#endif
-
- case 'q': /* do not generate HTTP headers */
- no_headers = 1;
- break;
-
- case 's': /* generate highlighted HTML from source */
- behavior=PHP_MODE_HIGHLIGHT;
- break;
-
- case 'v': /* show php version & quit */
- no_headers = 1;
- if (php_request_startup(CLS_C ELS_CC PLS_CC SLS_CC)==FAILURE) {
- php_module_shutdown();
- return FAILURE;
- }
- if (no_headers) {
- SG(headers_sent) = 1;
- SG(request_info).no_headers = 1;
- }
- php_printf("%s\n", PHP_VERSION);
- php_end_ob_buffers(1);
- exit(1);
- break;
-
- case 'z': /* load extension file */
- zend_load_extension(ap_php_optarg);
- break;
-
- default:
- break;
- }
- }
- } /* not cgi */
-
-#if SUPPORT_INTERACTIVE
- EG(interactive) = interactive;
-#endif
-
- if (!cgi) {
- if (!SG(request_info).query_string) {
- len = 0;
- if (script_file) {
- len += strlen(script_file) + 1;
- }
- for (i = ap_php_optind; i < argc; i++) {
- len += strlen(argv[i]) + 1;
- }
-
- s = malloc(len + 1); /* leak - but only for command line version, so ok */
- *s = '\0'; /* we are pretending it came from the environment */
- if (script_file) {
- strcpy(s, script_file);
- if (ap_php_optind<argc) {
- strcat(s, "+");
- }
- }
- for (i = ap_php_optind, len = 0; i < argc; i++) {
- strcat(s, argv[i]);
- if (i < (argc - 1)) {
- strcat(s, "+");
- }
- }
- SG(request_info).query_string = s;
- }
- }
-
- if (script_file) {
- SG(request_info).path_translated = script_file;
- }
-
- if (php_request_startup(CLS_C ELS_CC PLS_CC SLS_CC)==FAILURE) {
- php_module_shutdown();
- return FAILURE;
- }
- if (no_headers) {
- SG(headers_sent) = 1;
- SG(request_info).no_headers = 1;
- }
- file_handle.filename = "-";
- file_handle.type = ZEND_HANDLE_FP;
- file_handle.handle.fp = stdin;
- file_handle.opened_path = NULL;
-
- /* This actually destructs the elements of the list - ugly hack */
- zend_llist_apply(&global_vars, (llist_apply_func_t) php_register_command_line_global_vars);
- zend_llist_destroy(&global_vars);
-
- if (!cgi) {
- if (!SG(request_info).path_translated && argc > ap_php_optind) {
- SG(request_info).path_translated = estrdup(argv[ap_php_optind]);
- }
- } else {
- /* If for some reason the CGI interface is not setting the
- PATH_TRANSLATED correctly, SG(request_info).path_translated is NULL.
- We still call php_fopen_primary_script, because if you set doc_root
- or user_dir configuration directives, PATH_INFO is used to construct
- the filename as a side effect of php_fopen_primary_script.
- */
- char *env_path_translated=NULL;
-#if DISCARD_PATH
- env_path_translated = getenv("SCRIPT_FILENAME");
-#else
- env_path_translated = getenv("PATH_TRANSLATED");
-#endif
- if(env_path_translated) {
- SG(request_info).path_translated = estrdup(env_path_translated);
- }
- }
- if (cgi || SG(request_info).path_translated) {
- file_handle.handle.fp = php_fopen_primary_script();
- file_handle.filename = SG(request_info).path_translated;
- }
-
- if (cgi && !file_handle.handle.fp) {
- if(!argv0 || !(file_handle.handle.fp = VCWD_FOPEN(argv0, "rb"))) {
- PUTS("No input file specified.\n");
- php_request_shutdown((void *) 0);
- php_module_shutdown();
- return FAILURE;
- }
- file_handle.filename = argv0;
- } else if (file_handle.handle.fp && file_handle.handle.fp!=stdin) {
- /* #!php support */
- c = fgetc(file_handle.handle.fp);
- if (c == '#') {
- while (c != 10 && c != 13) {
- c = fgetc(file_handle.handle.fp); /* skip to end of line */
- }
- CG(zend_lineno)++;
- } else {
- rewind(file_handle.handle.fp);
- }
- }
-
- file_handle.free_filename = 0;
- switch (behavior) {
- case PHP_MODE_STANDARD:
- exit_status = php_execute_script(&file_handle CLS_CC ELS_CC PLS_CC);
- break;
- case PHP_MODE_LINT:
- PG(during_request_startup) = 0;
- exit_status = php_lint_script(&file_handle CLS_CC ELS_CC PLS_CC);
- if (exit_status==SUCCESS) {
- zend_printf("No syntax errors detected in %s\n", file_handle.filename);
- } else {
- zend_printf("Errors parsing %s\n", file_handle.filename);
- }
- break;
- case PHP_MODE_HIGHLIGHT:
- {
- zend_syntax_highlighter_ini syntax_highlighter_ini;
-
- if (open_file_for_scanning(&file_handle CLS_CC)==SUCCESS) {
- php_get_highlight_struct(&syntax_highlighter_ini);
- zend_highlight(&syntax_highlighter_ini);
- fclose(file_handle.handle.fp);
- }
- return SUCCESS;
- }
- break;
-#if 0
- /* Zeev might want to do something with this one day */
- case PHP_MODE_INDENT:
- open_file_for_scanning(&file_handle CLS_CC);
- zend_indent();
- fclose(file_handle.handle.fp);
- return SUCCESS;
- break;
-#endif
- }
-
-
- if (SG(request_info).path_translated) {
- persist_alloc(SG(request_info).path_translated);
- }
-
- php_request_shutdown((void *) 0);
- php_module_shutdown();
-
- STR_FREE(SG(request_info).path_translated);
-
- if (cgi_sapi_module.php_ini_path_override) {
- free(cgi_sapi_module.php_ini_path_override);
- }
-#ifdef ZTS
- tsrm_shutdown();
-#endif
-
- return exit_status;
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/sapi/cgi/config.m4 b/sapi/cgi/config.m4
deleted file mode 100644
index 7a0007e572..0000000000
--- a/sapi/cgi/config.m4
+++ /dev/null
@@ -1,98 +0,0 @@
-AC_DEFUN(PHP_TEST_WRITE_STDOUT,[
- AC_CACHE_CHECK(whether writing to stdout works,ac_cv_write_stdout,[
- AC_TRY_RUN([
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-
-#define TEXT "This is the test message -- "
-
-main()
-{
- int n;
-
- n = write(1, TEXT, sizeof(TEXT)-1);
- return (!(n == sizeof(TEXT)-1));
-}
- ],[
- ac_cv_write_stdout=yes
- ],[
- ac_cv_write_stdout=no
- ],[
- ac_cv_write_stdout=no
- ])
- ])
- if test "$ac_cv_write_stdout" = "yes"; then
- AC_DEFINE(PHP_WRITE_STDOUT, 1, [whether write(2) works])
- fi
-])
-
-if test "$PHP_SAPI" = "cgi"; then
-
- PHP_TEST_WRITE_STDOUT
-
- PHP_ARG_ENABLE(force-cgi-redirect,whether to force Apache CGI redirect,
-[ --enable-force-cgi-redirect
- Enable the security check for internal server
- redirects. You should use this if you are
- running the CGI version with Apache. ])
-
- if test "$PHP_FORCE_CGI_REDIRECT" = "yes"; then
- REDIRECT=1
- else
- REDIRECT=0
- fi
- AC_DEFINE_UNQUOTED(FORCE_CGI_REDIRECT,$REDIRECT,[ ])
-
- PHP_ARG_ENABLE(discard-path,whether to discard path_info + path_translated,
-[ --enable-discard-path If this is enabled, the PHP CGI binary
- can safely be placed outside of the
- web tree and people will not be able
- to circumvent .htaccess security. ])
-
- if test "$PHP_DISCARD_PATH" = "yes"; then
- DISCARD_PATH=1
- else
- DISCARD_PATH=0
- fi
- AC_DEFINE_UNQUOTED(DISCARD_PATH, $DISCARD_PATH, [ ])
-
-fi
-
-if test "$PHP_SAPI" = "cgi" ; then
- INSTALL_IT="\$(INSTALL) -m 0755 $SAPI_PROGRAM \$(INSTALL_ROOT)\$(bindir)/$SAPI_CGI"
-fi
-
-AC_MSG_CHECKING(for fhttpd module support)
-AC_ARG_WITH(fhttpd,
-[ --with-fhttpd[=DIR] Build fhttpd module. DIR is the fhttpd sources
- directory, defaults to /usr/local/src/fhttpd.],
-[
- if test "$withval" = "yes"; then
- # fhttpd source directory
- withval=/usr/local/src/fhttpd
- fi
- if test "$withval" != "no"; then
-# For fhttpd 0.3.x
- if test -f $withval/servproc.h; then
- FHTTPD_INCLUDE=-I$withval/
- FHTTPD_LIB=$withval/servproc.o
- FHTTPD_TARGET=$withval/
- PHP_BUILD_STATIC
- PHP_SAPI=cgi
- AC_DEFINE(FHTTPD,1,[ ])
- AC_MSG_RESULT(yes - fhttpd 0.3.x)
- else
- AC_MSG_RESULT(no)
- AC_MSG_ERROR(Invalid fhttpd directory - unable to find servproc.h under $withval)
- fi
- else
- AC_MSG_RESULT(no)
- fi
-],[
- AC_MSG_RESULT(no)
-])
-INCLUDES="$INCLUDES $FHTTPD_INCLUDE"
-dnl## AC_SUBST(FHTTPD_INCLUDE)
-PHP_SUBST(FHTTPD_LIB)
-PHP_SUBST(FHTTPD_TARGET)
diff --git a/sapi/cgi/getopt.c b/sapi/cgi/getopt.c
deleted file mode 100644
index 120870108a..0000000000
--- a/sapi/cgi/getopt.c
+++ /dev/null
@@ -1,175 +0,0 @@
-/* Borrowed from Apache NT Port */
-
-#include <stdio.h>
-#include <string.h>
-#include <assert.h>
-#include <stdlib.h>
-#include "php_getopt.h"
-#define OPTERRCOLON (1)
-#define OPTERRNF (2)
-#define OPTERRARG (3)
-
-
-char *ap_php_optarg;
-int ap_php_optind = 1;
-static int ap_php_opterr = 1;
-static int ap_php_optopt;
-
-static int
-ap_php_optiserr(int argc, char * const *argv, int oint, const char *optstr,
- int optchr, int err)
-{
- if (ap_php_opterr)
- {
- fprintf(stderr, "Error in argument %d, char %d: ", oint, optchr+1);
- switch(err)
- {
- case OPTERRCOLON:
- fprintf(stderr, ": in flags\n");
- break;
- case OPTERRNF:
- fprintf(stderr, "option not found %c\n", argv[oint][optchr]);
- break;
- case OPTERRARG:
- fprintf(stderr, "no argument for option %c\n", argv[oint][optchr]);
- break;
- default:
- fprintf(stderr, "unknown\n");
- break;
- }
- }
- ap_php_optopt = argv[oint][optchr];
- return('?');
-}
-
-int ap_php_getopt(int argc, char* const *argv, const char *optstr)
-{
- static int optchr = 0;
- static int dash = 0; /* have already seen the - */
-
- char *cp;
-
- if (ap_php_optind >= argc)
- return(EOF);
- if (!dash && (argv[ap_php_optind][0] != '-'))
- return(EOF);
- if (!dash && (argv[ap_php_optind][0] == '-') && !argv[ap_php_optind][1])
- {
- /*
- * use to specify stdin. Need to let pgm process this and
- * the following args
- */
- return(EOF);
- }
- if ((argv[ap_php_optind][0] == '-') && (argv[ap_php_optind][1] == '-'))
- {
- /* -- indicates end of args */
- ap_php_optind++;
- return(EOF);
- }
- if (!dash)
- {
- assert((argv[ap_php_optind][0] == '-') && argv[ap_php_optind][1]);
- dash = 1;
- optchr = 1;
- }
-
- /* Check if the guy tries to do a -: kind of flag */
- assert(dash);
- if (argv[ap_php_optind][optchr] == ':')
- {
- dash = 0;
- ap_php_optind++;
- return(ap_php_optiserr(argc, argv, ap_php_optind-1, optstr, optchr, OPTERRCOLON));
- }
- if (!(cp = strchr(optstr, argv[ap_php_optind][optchr])))
- {
- int errind = ap_php_optind;
- int errchr = optchr;
-
- if (!argv[ap_php_optind][optchr+1])
- {
- dash = 0;
- ap_php_optind++;
- }
- else
- optchr++;
- return(ap_php_optiserr(argc, argv, errind, optstr, errchr, OPTERRNF));
- }
- if (cp[1] == ':')
- {
- /* Check for cases where the value of the argument
- is in the form -<arg> <val> or in the form -<arg><val> */
- dash = 0;
- if(!argv[ap_php_optind][2]) {
- ap_php_optind++;
- if (ap_php_optind == argc)
- return(ap_php_optiserr(argc, argv, ap_php_optind-1, optstr, optchr, OPTERRARG));
- ap_php_optarg = argv[ap_php_optind++];
- }
- else
- {
- ap_php_optarg = &argv[ap_php_optind][2];
- ap_php_optind++;
- }
- return(*cp);
- }
- else
- {
- if (!argv[ap_php_optind][optchr+1])
- {
- dash = 0;
- ap_php_optind++;
- }
- else
- optchr++;
- return(*cp);
- }
- assert(0);
- return(0);
-}
-
-#ifdef TESTGETOPT
-int
- main (int argc, char **argv)
- {
- int c;
- extern char *ap_php_optarg;
- extern int ap_php_optind;
- int aflg = 0;
- int bflg = 0;
- int errflg = 0;
- char *ofile = NULL;
-
- while ((c = ap_php_getopt(argc, argv, "abo:")) != EOF)
- switch (c) {
- case 'a':
- if (bflg)
- errflg++;
- else
- aflg++;
- break;
- case 'b':
- if (aflg)
- errflg++;
- else
- bflg++;
- break;
- case 'o':
- ofile = ap_php_optarg;
- (void)printf("ofile = %s\n", ofile);
- break;
- case '?':
- errflg++;
- }
- if (errflg) {
- (void)fprintf(stderr,
- "usage: cmd [-a|-b] [-o <filename>] files...\n");
- exit (2);
- }
- for ( ; ap_php_optind < argc; ap_php_optind++)
- (void)printf("%s\n", argv[ap_php_optind]);
- return 0;
- }
-
-#endif /* TESTGETOPT */
diff --git a/sapi/cgi/php.sym b/sapi/cgi/php.sym
deleted file mode 100644
index e69de29bb2..0000000000
--- a/sapi/cgi/php.sym
+++ /dev/null
diff --git a/sapi/cgi/php_getopt.h b/sapi/cgi/php_getopt.h
deleted file mode 100644
index 40da432b59..0000000000
--- a/sapi/cgi/php_getopt.h
+++ /dev/null
@@ -1,7 +0,0 @@
-/* Borrowed from Apache NT Port */
-#include "php.h"
-
-extern char *ap_php_optarg;
-extern int ap_php_optind;
-
-int ap_php_getopt(int argc, char* const *argv, const char *optstr);
diff --git a/sapi/fastcgi/CREDITS b/sapi/fastcgi/CREDITS
deleted file mode 100644
index eb9cece428..0000000000
--- a/sapi/fastcgi/CREDITS
+++ /dev/null
@@ -1,4 +0,0 @@
-fastcgi
-Ben Mansell
-Stephen Landamore
-Daniel Silverstone
diff --git a/sapi/fastcgi/Makefile.in b/sapi/fastcgi/Makefile.in
deleted file mode 100644
index 0bea9c31b1..0000000000
--- a/sapi/fastcgi/Makefile.in
+++ /dev/null
@@ -1,5 +0,0 @@
-
-LTLIBRARY_NAME = libsapi.la
-LTLIBRARY_SOURCES = fastcgi.c
-
-include $(top_srcdir)/build/ltlib.mk
diff --git a/sapi/fastcgi/README.FastCGI b/sapi/fastcgi/README.FastCGI
deleted file mode 100644
index 65dbc44ea0..0000000000
--- a/sapi/fastcgi/README.FastCGI
+++ /dev/null
@@ -1,17 +0,0 @@
-FastCGI module
---------------
-
-This module requires the FastCGI development kit, available from
-http://www.fastcgi.com/
-
-Before building PHP, please enter the dev kit, and run:
-
-./configure
-make
-make export
-
-This will compile the library code required for the FastCGI module. All
-that is then required is to configure PHP with the '--with-fastcgi' option.
-After making the code, you will end up with a binary file called 'php'.
-Installation of this file will depend on the web server being used, please
-see their documentation for details.
diff --git a/sapi/fastcgi/config.m4 b/sapi/fastcgi/config.m4
deleted file mode 100644
index 74dba3a0d0..0000000000
--- a/sapi/fastcgi/config.m4
+++ /dev/null
@@ -1,22 +0,0 @@
-AC_MSG_CHECKING(for FastCGI support)
-AC_ARG_WITH(fastcgi,
-[ --with-fastcgi=SRCDIR Build PHP as FastCGI application],[
- if test "$withval" = "yes"; then
- FASTCGIPATH=/usr/local
- else
- FASTCGIPATH=$withval
- fi
- test -f "$FASTCGIPATH/lib/libfcgi.a" || AC_MSG_ERROR(Unable to find libfcgi.a in $FASTCGIPATH/lib)
- test -f "$FASTCGIPATH/include/fastcgi.h" || AC_MSG_ERROR(Unable to find fastcgi.h in $FASTCGIPATH/include)
- PHP_SAPI=fastcgi
- PHP_LIBS=$FASTCGIPATH/lib/libfcgi.a
- PHP_ADD_INCLUDE($FASTCGIPATH/include)
- EXT_PROGRAM_LDADD="$EXT_PROGRAM_LDADD $FASTCGIPATH/lib/libfcgi.a"
- INSTALL_IT="\$(INSTALL) -m 0755 $SAPI_PROGRAM \$(bindir)/$SAPI_FASTCGI"
- RESULT=yes
- PHP_SUBST(FASTCGI_LIBADD)
- PHP_SUBST(EXT_PROGRAM_LDADD)
-],[
- RESULT=no
-])
-AC_MSG_RESULT($RESULT)
diff --git a/sapi/fastcgi/fastcgi.c b/sapi/fastcgi/fastcgi.c
deleted file mode 100644
index cc96a6d7f0..0000000000
--- a/sapi/fastcgi/fastcgi.c
+++ /dev/null
@@ -1,431 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Ben Mansell <php@slimyhorror.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* Debugging */
-/* #define DEBUG_FASTCGI 1 */
-
-/* Two configurables for the FastCGI runner.
- *
- * PHP_FCGI_CHILDREN - if set, the FastCGI will pre-fork this many processes
- * which will accept requests.
- *
- * PHP_FCGI_MAX_REQUESTS - if set, the runner will kill itself after handling
- * the given number of requests. This is to curb any
- * memory leaks in PHP.
- */
-
-
-/* The following code is based mainly on the thttpd sapi and the original
- * CGI code, no doubt with many new and interesting bugs created... :)
- */
-
-#include "php.h"
-#include "SAPI.h"
-#include "php_main.h"
-#include "php_fastcgi.h"
-#include "php_variables.h"
-
-#include "fcgi_config.h"
-#include "fcgiapp.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <sys/wait.h>
-#include <sys/stat.h>
-
-
-#define TLS_D
-#define TLS_DC
-#define TLS_C
-#define TLS_CC
-#define TLS_FETCH()
-
-
-FCGX_Stream *in, *out, *err;
-FCGX_ParamArray envp;
-char *path_info = NULL;
-
-/* Our original environment from when the FastCGI first started */
-char **orig_env;
-
-/* The environment given by the FastCGI */
-char **cgi_env;
-
-/* The manufactured environment, from merging the base environ with
- * the parameters set by the per-connection environment
- */
-char **merge_env;
-
-
-static int sapi_fastcgi_ub_write(const char *str, uint str_length)
-{
- uint sent = FCGX_PutStr( str, str_length, out );
- return sent;
-}
-
-
-static void sapi_fastcgi_flush( void *server_context )
-{
- if( FCGX_FFlush( out ) == -1 ) {
- php_handle_aborted_connection();
- }
-}
-
-
-static void sapi_fastcgi_send_header(sapi_header_struct *sapi_header, void *server_context)
-{
- if( sapi_header ) {
-#ifdef DEBUG_FASTCGI
- fprintf( stderr, "Header: %s\n", sapi_header->header );
-#endif
- FCGX_PutStr( sapi_header->header, sapi_header->header_len, out );
- }
- FCGX_PutStr( "\r\n", 2, out );
-}
-
-static int sapi_fastcgi_read_post(char *buffer, uint count_bytes SLS_DC)
-{
- size_t read_bytes = 0, tmp;
- int c;
- char *pos = buffer;
- TLS_FETCH();
-
- while( count_bytes ) {
- c = FCGX_GetStr( pos, count_bytes, in );
- read_bytes += c;
- count_bytes -= c;
- pos += c;
- if( !c ) break;
- }
- return read_bytes;
-}
-
-static char *sapi_fastcgi_read_cookies(SLS_D)
-{
- return getenv( "HTTP_COOKIE" );
-}
-
-
-static void sapi_fastcgi_register_variables(zval *track_vars_array ELS_DC SLS_DC PLS_DC)
-{
- char *self = getenv("REQUEST_URI");
- char *ptr = strchr( self, '?' );
-
- /*
- * note that the environment will already have been set up
- * via fastcgi_module_main(), below.
- *
- * fastcgi_module_main() -> php_request_startup() ->
- * php_hash_environment() -> php_import_environment_variables()
- */
-
- /* strip query string off this */
- if ( ptr ) *ptr = 0;
- php_register_variable( "PHP_SELF", getenv("REQUEST_URI"), track_vars_array ELS_CC PLS_CC);
- if ( ptr ) *ptr = '?';
-}
-
-
-static sapi_module_struct fastcgi_sapi_module = {
- "fastcgi",
- "FastCGI",
-
- php_module_startup,
- php_module_shutdown_wrapper,
-
- NULL, /* activate */
- NULL, /* deactivate */
-
- sapi_fastcgi_ub_write,
- sapi_fastcgi_flush,
- NULL, /* get uid */
- NULL, /* getenv */
-
- php_error,
-
- NULL,
- NULL,
- sapi_fastcgi_send_header,
- sapi_fastcgi_read_post,
- sapi_fastcgi_read_cookies,
-
- sapi_fastcgi_register_variables,
- NULL, /* Log message */
-
- NULL, /* Block interruptions */
- NULL, /* Unblock interruptions */
-
- STANDARD_SAPI_MODULE_PROPERTIES
-};
-
-static void fastcgi_module_main(TLS_D SLS_DC)
-{
- zend_file_handle file_handle;
- CLS_FETCH();
- ELS_FETCH();
- PLS_FETCH();
-
- file_handle.type = ZEND_HANDLE_FILENAME;
- file_handle.filename = SG(request_info).path_translated;
- file_handle.free_filename = 0;
- file_handle.opened_path = NULL;
-
- if (php_request_startup(CLS_C ELS_CC PLS_CC SLS_CC) == SUCCESS) {
- php_execute_script(&file_handle CLS_CC ELS_CC PLS_CC);
- }
- php_request_shutdown(NULL);
-}
-
-
-static void init_request_info( SLS_D )
-{
- char *content_length = getenv("CONTENT_LENGTH");
- char *content_type = getenv( "CONTENT_TYPE" );
- const char *auth;
- struct stat st;
- char *pi = getenv( "PATH_INFO" );
- char *pt = getenv( "PATH_TRANSLATED" );
- path_info = strdup( pi );
-
- SG(request_info).request_method = getenv("REQUEST_METHOD");
- SG(request_info).query_string = getenv("QUERY_STRING");
- SG(request_info).request_uri = path_info;
- SG(request_info).content_type = ( content_type ? content_type : "" );
- SG(request_info).content_length = (content_length?atoi(content_length):0);
- SG(sapi_headers).http_response_code = 200;
-
- SG(request_info).path_translated = pt;
- /*
- * if the file doesn't exist, try to extract PATH_INFO out
- * of it by stat'ing back through the '/'
- */
- if ( stat( pt, &st ) == -1 ) {
- int len = strlen(pt);
- char *ptr;
- while( ptr = strrchr(pt,'/') ) {
- *ptr = 0;
- if ( stat(pt,&st) == 0 && S_ISREG(st.st_mode) ) {
- /*
- * okay, we found the base script!
- * work out how many chars we had to strip off;
- * then we can modify PATH_INFO
- * accordingly
- */
- int slen = len - strlen(pt);
- if ( pi ) {
- int pilen = strlen( pi );
- strcpy( pi, pi + pilen - slen );
- }
- break;
- }
- }
- /*
- * if we stripped out all the '/' and still didn't find
- * a valid path... we will fail, badly. of course we would
- * have failed anyway... is there a nice way to error?
- */
- } else {
- /* the first stat succeeded... */
- if ( pi ) *pi = 0;
- }
-
- /* The CGI RFC allows servers to pass on unvalidated Authorization data */
- auth = getenv("HTTP_AUTHORIZATION");
-#ifdef DEBUG_FASTCGI
- fprintf( stderr, "Authorization: %s\n", auth );
-#endif
- php_handle_auth_data(auth SLS_CC);
-
-
-}
-
-
-void fastcgi_php_init(void)
-{
- sapi_startup(&fastcgi_sapi_module);
- fastcgi_sapi_module.startup(&fastcgi_sapi_module);
- SG(server_context) = (void *) 1;
-}
-
-void fastcgi_php_shutdown(void)
-{
- if (SG(server_context) != NULL) {
- fastcgi_sapi_module.shutdown(&fastcgi_sapi_module);
- sapi_shutdown();
- }
-}
-
-
-int main(int argc, char *argv[])
-{
- int exit_status = SUCCESS;
- int c, i, len;
- zend_file_handle file_handle;
- char *s;
- char *argv0=NULL;
- char *script_file=NULL;
- zend_llist global_vars;
- int children = 8;
- int max_requests = 500;
- int requests = 0;
- int status;
- int env_size, cgi_env_size;
-
-#ifdef FASTCGI_DEBUG
- fprintf( stderr, "Initialising now!\n" );
-#endif
-
- /* Calculate environment size */
- env_size = 0;
- while( environ[ env_size ] ) { env_size++; }
- /* Also include the final NULL pointer */
- env_size++;
-
- /* Allocate for our environment */
- orig_env = malloc( env_size * sizeof( char *));
- if( !orig_env ) {
- perror( "Can't malloc environment" );
- exit( 1 );
- }
- memcpy( orig_env, environ, env_size * sizeof( char *));
-
-#ifdef HAVE_SIGNAL_H
-#if defined(SIGPIPE) && defined(SIG_IGN)
- signal(SIGPIPE,SIG_IGN); /* ignore SIGPIPE in standalone mode so
- that sockets created via fsockopen()
- don't kill PHP if the remote site
- closes it. in apache|apxs mode apache
- does that for us! thies@thieso.net
- 20000419 */
-#endif
-#endif
-
- sapi_startup(&fastcgi_sapi_module);
-
- if (php_module_startup(&fastcgi_sapi_module)==FAILURE) {
- return FAILURE;
- }
-
- /* How many times to run PHP scripts before dying */
- if( getenv( "PHP_FCGI_MAX_REQUESTS" )) {
- max_requests = atoi( getenv( "PHP_FCGI_MAX_REQUESTS" ));
- if( !max_requests ) {
- fprintf( stderr,
- "PHP_FCGI_MAX_REQUESTS is not valid\n" );
- exit( 1 );
- }
- }
-
- /* Pre-fork, if required */
- if( getenv( "PHP_FCGI_CHILDREN" )) {
- children = atoi( getenv( "PHP_FCGI_CHILDREN" ));
- if( !children ) {
- fprintf( stderr,
- "PHP_FCGI_CHILDREN is not valid\n" );
- exit( 1 );
- }
- }
-
- if( children ) {
- int parent = 1;
- int running = 0;
- while( parent ) {
- do {
-#ifdef FASTCGI_DEBUG
- fprintf( stderr, "Forking, %d running\n",
- running );
-#endif
- switch( fork() ) {
- case 0:
- /* One of the children.
- * Make sure we don't go round the
- * fork loop any more
- */
- parent = 0;
- break;
- case -1:
- perror( "php (pre-forking)" );
- exit( 1 );
- break;
- default:
- /* Fine */
- running++;
- break;
- }
- } while( parent && ( running < children ));
-
- if( parent ) {
- wait( &status );
- running--;
- }
- }
- }
-
- /* Main FastCGI loop */
-#ifdef FASTCGI_DEBUG
- fprintf( stderr, "Going into accept loop\n" );
-#endif
-
- while( FCGX_Accept( &in, &out, &err, &cgi_env ) >= 0 ) {
-
-#ifdef FASTCGI_DEBUG
- fprintf( stderr, "Got accept\n" );
-#endif
-
- cgi_env_size = 0;
- while( cgi_env[ cgi_env_size ] ) { cgi_env_size++; }
- merge_env = malloc( (env_size+cgi_env_size)*sizeof(char*) );
- if( !merge_env ) {
- perror( "Can't malloc environment" );
- exit( 1 );
- }
- memcpy( merge_env, orig_env, (env_size-1)*sizeof(char *) );
- memcpy( merge_env + env_size - 1,
- cgi_env, (cgi_env_size+1)*sizeof(char *) );
- environ = merge_env;
-
- init_request_info( TLS_C SLS_CC );
- SG(server_context) = (void *) 1; /* avoid server_context==NULL checks */
- CG(extended_info) = 0;
- SG(request_info).argv0 = argv0;
- zend_llist_init(&global_vars, sizeof(char *), NULL, 0);
-
- fastcgi_module_main( TLS_C SLS_CC );
- if( path_info ) {
- free( path_info );
- path_info = NULL;
- }
-
- /* TODO: We should free our environment here, but
- * some platforms are unhappy if they've altered our
- * existing environment and we then free() the new
- * environ pointer
- */
-
- requests++;
- if( max_requests && ( requests == max_requests )) {
- FCGX_Finish();
- break;
- }
- }
-
-#ifdef FASTCGI_DEBUG
- fprintf( stderr, "Exiting...\n" );
-#endif
- return 0;
-}
diff --git a/sapi/fastcgi/php.sym b/sapi/fastcgi/php.sym
deleted file mode 100644
index e69de29bb2..0000000000
--- a/sapi/fastcgi/php.sym
+++ /dev/null
diff --git a/sapi/fastcgi/php_fastcgi.h b/sapi/fastcgi/php_fastcgi.h
deleted file mode 100644
index 9031d7bd11..0000000000
--- a/sapi/fastcgi/php_fastcgi.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Sascha Schumann <sascha@schumann.cx> |
- +----------------------------------------------------------------------+
-*/
-
-#ifndef PHP_FASTCGI_H
-#define PHP_FASTCGI_H
-
-#include <sys/types.h>
-#include <sys/stat.h>
-
-void fastcgi_php_shutdown(void);
-void fastcgi_php_init(void);
-
-#endif
diff --git a/sapi/fhttpd/CREDITS b/sapi/fhttpd/CREDITS
deleted file mode 100644
index aaa5aac1fd..0000000000
--- a/sapi/fhttpd/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-fhttpd
-Alex Belits
diff --git a/sapi/fhttpd/fhttpd.c b/sapi/fhttpd/fhttpd.c
deleted file mode 100644
index 762251df3d..0000000000
--- a/sapi/fhttpd/fhttpd.c
+++ /dev/null
@@ -1,185 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Alex Belits <abelits@phobos.illtel.denver.co.us> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-#include "php.h"
-
-#include <stdlib.h>
-#if HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#include <string.h>
-#include <errno.h>
-#include <ctype.h>
-
-#if FHTTPD
-#include <servproc.h>
-#include <signal.h>
-
-struct http_server *server = NULL;
-struct request *req = NULL;
-struct httpresponse *response = NULL;
-int headermade = 0;
-int global_alarmflag = 0;
-int idle_timeout = IDLE_TIMEOUT;
-int exit_status = 0;
-char **currentheader = NULL;
-char *headerfirstline = NULL;
-int headerlines = 0;
-static int headerlinesallocated = 0;
-
-void alarmhandler(SIGACTARGS)
-{
- global_alarmflag = 1;
-}
-
-void setalarm(int t)
-{
- struct sigaction tmpsigaction;
- global_alarmflag = 0;
- if (t){
- bzero((char *) &tmpsigaction, sizeof(struct sigaction));
- tmpsigaction.sa_handler = alarmhandler;
- sigaddset(&tmpsigaction.sa_mask, SIGALRM);
- tmpsigaction.sa_flags = 0;
- sigaction(SIGALRM, &tmpsigaction, NULL);
- alarm(t);
- }
-}
-
-int checkinput(int h)
-{
- fd_set readfd;
- FD_ZERO(&readfd);
- FD_SET(h, &readfd);
- return select(h + 1, &readfd, NULL, NULL, NULL) > 0;
-}
-
-
-PHPAPI void php_fhttpd_free_header(void)
-{
- int i;
-
- if (headerfirstline) {
- free(headerfirstline);
- headerfirstline = NULL;
- }
- if (currentheader) {
- for (i = 0; i < headerlines; i++) {
- free(currentheader[i]);
- }
- free(currentheader);
- currentheader = NULL;
- }
- headerlines = 0;
- headerlinesallocated = 0;
- headermade = 0;
-}
-
-
-PHPAPI void php_fhttpd_puts_header(char *s)
-{
- char *p0, *p1, *p2, *p3, **p;
- int l;
-
- if (!s || !*s || *s == '\r' || *s == '\n')
- return;
- l = strlen(s);
- p2 = strchr(s, '\r');
- p3 = strchr(s, '\n');
- p0 = strchr(s, ':');
- p1 = strchr(s, ' ');
- if (p0 && (!p1 || p1 > p0)) {
- if (!headerlinesallocated) {
- currentheader = (char **) malloc(10 * sizeof(char *));
- if (currentheader)
- headerlinesallocated = 10;
- } else {
- if (headerlinesallocated <= headerlines) {
- p = (char **) realloc(currentheader, (headerlinesallocated + 10) * sizeof(char *));
- if (p) {
- currentheader = p;
- headerlinesallocated += 10;
- }
- }
- }
-
- if (headerlinesallocated > headerlines) {
- currentheader[headerlines] = malloc(l + 3);
- if (currentheader[headerlines]) {
- strcpy(currentheader[headerlines], s);
- if (!p3) {
- if (p2) {
- (currentheader[headerlines] + (p2 - s))[1] = '\n';
- (currentheader[headerlines] + (p2 - s))[2] = 0;
- } else {
- currentheader[headerlines][l] = '\r';
- currentheader[headerlines][l + 1] = '\n';
- currentheader[headerlines][l + 2] = 0;
- }
- }
- headerlines++;
- headermade = 1;
- }
- }
- } else {
- if (headerfirstline)
- free(headerfirstline);
- headerfirstline = malloc(l + 3);
- if (headerfirstline) {
- strcpy(headerfirstline, s);
- if (!p3) {
- if (p2) {
- (headerfirstline + (p2 - s))[1] = '\n';
- (headerfirstline + (p2 - s))[2] = 0;
- } else {
- headerfirstline[l] = '\r';
- headerfirstline[l + 1] = '\n';
- headerfirstline[l + 2] = 0;
- }
- }
- }
- headermade = 1;
- }
-}
-
-void fhttpd_flush(void)
-{
-}
-
-PHPAPI void php_fhttpd_puts(char *s)
-{
- putlinetoresponse(response, s);
-}
-
-PHPAPI void php_fhttpd_putc(char c)
-{
- writetoresponse(response, &c, 1);
-}
-
-PHPAPI int php_fhttpd_write(char *a, int n)
-{
- return writetoresponse(response, a, n);
-}
-#endif
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/sapi/isapi/CREDITS b/sapi/isapi/CREDITS
deleted file mode 100644
index 11c6fdc73c..0000000000
--- a/sapi/isapi/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-ISAPI
-Andi Gutmans, Zeev Suraski
diff --git a/sapi/isapi/Makefile.in b/sapi/isapi/Makefile.in
deleted file mode 100644
index 34d4bdc15c..0000000000
--- a/sapi/isapi/Makefile.in
+++ /dev/null
@@ -1,5 +0,0 @@
-
-LTLIBRARY_NAME = libsapi.la
-LTLIBRARY_SOURCES = php4isapi.c
-
-include $(top_srcdir)/build/ltlib.mk
diff --git a/sapi/isapi/config.m4 b/sapi/isapi/config.m4
deleted file mode 100644
index 85fc88059a..0000000000
--- a/sapi/isapi/config.m4
+++ /dev/null
@@ -1,26 +0,0 @@
-dnl ## $Id$ -*- sh -*-
-
-RESULT=no
-AC_MSG_CHECKING(for Zeus ISAPI support)
-AC_ARG_WITH(isapi,
-[ --with-isapi=DIR Build PHP as an ISAPI module for use with Zeus.],
-[
- if test "$withval" = "yes"; then
- ZEUSPATH=/usr/local/zeus # the default
- else
- ZEUSPATH=$withval
- fi
- test -f "$ZEUSPATH/web/include/httpext.h" || AC_MSG_ERROR(Unable to find httpext.h in $ZEUSPATH/web/include)
- PHP_BUILD_THREAD_SAFE
- AC_DEFINE(WITH_ZEUS,1,[ ])
- PHP_ADD_INCLUDE($ZEUSPATH/web/include)
- PHP_SAPI=isapi
- PHP_BUILD_SHARED
- INSTALL_IT="\$(SHELL) \$(srcdir)/install-sh -m 0755 $SAPI_SHARED \$(INSTALL_ROOT)$ZEUSPATH/web/bin/"
- RESULT=yes
-])
-AC_MSG_RESULT($RESULT)
-
-dnl ## Local Variables:
-dnl ## tab-width: 4
-dnl ## End:
diff --git a/sapi/isapi/php.sym b/sapi/isapi/php.sym
deleted file mode 100644
index 34b50b851c..0000000000
--- a/sapi/isapi/php.sym
+++ /dev/null
@@ -1,5 +0,0 @@
-GetFilterVersion
-HttpFilterProc
-GetExtensionVersion
-HttpExtensionProc
-ZSLMain
diff --git a/sapi/isapi/php4isapi.c b/sapi/isapi/php4isapi.c
deleted file mode 100644
index daee230634..0000000000
--- a/sapi/isapi/php4isapi.c
+++ /dev/null
@@ -1,864 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Zeev Suraski <zeev@zend.com> |
- | Zeus Support: Ben Mansell <ben@zeus.com> |
- +----------------------------------------------------------------------+
- */
-
-#ifdef PHP_WIN32
-# include <windows.h>
-# include <process.h>
-#else
-# define __try
-# define __except(val)
-# define __declspec(foo)
-#endif
-
-#include <httpext.h>
-#include <httpfilt.h>
-#include <httpext.h>
-#include "php.h"
-#include "php_main.h"
-#include "SAPI.h"
-#include "php_globals.h"
-#include "ext/standard/info.h"
-#include "php_variables.h"
-#include "php_ini.h"
-
-#ifdef WITH_ZEUS
-# include "httpext.h"
-# include <errno.h>
-# define GetLastError() errno
-#endif
-
-/*
-uncomment the following lines to turn off
-exception trapping when running under a debugger
-
-
-#ifdef _DEBUG
-#define NO_EXCEPTION_HANDLERS
-#endif
-*/
-
-#define MAX_STATUS_LENGTH sizeof("xxxx LONGEST STATUS DESCRIPTION")
-#define ISAPI_SERVER_VAR_BUF_SIZE 1024
-#define ISAPI_POST_DATA_BUF 1024
-
-static zend_bool bFilterLoaded=0;
-static zend_bool bTerminateThreadsOnError=0;
-
-static char *isapi_special_server_variable_names[] = {
- "ALL_HTTP",
- "HTTPS",
-#ifndef WITH_ZEUS
- "SCRIPT_NAME",
-#endif
- NULL
-};
-
-#define NUM_SPECIAL_VARS (sizeof(isapi_special_server_variable_names)/sizeof(char *))
-#define SPECIAL_VAR_ALL_HTTP 0
-#define SPECIAL_VAR_HTTPS 1
-#define SPECIAL_VAR_PHP_SELF 2
-
-static char *isapi_server_variable_names[] = {
- "AUTH_PASSWORD",
- "AUTH_TYPE",
- "AUTH_USER",
- "CONTENT_LENGTH",
- "CONTENT_TYPE",
- "PATH_TRANSLATED",
- "QUERY_STRING",
- "REMOTE_ADDR",
- "REMOTE_HOST",
- "REMOTE_USER",
- "REQUEST_METHOD",
- "SERVER_NAME",
- "SERVER_PORT",
- "SERVER_PROTOCOL",
- "SERVER_SOFTWARE",
-#ifndef WITH_ZEUS
- "APPL_MD_PATH",
- "APPL_PHYSICAL_PATH",
- "INSTANCE_ID",
- "INSTANCE_META_PATH",
- "LOGON_USER",
- "REQUEST_URI",
- "URL",
-#else
- "DOCUMENT_ROOT",
-#endif
- NULL
-};
-
-
-static char *isapi_secure_server_variable_names[] = {
- "CERT_COOKIE",
- "CERT_FLAGS",
- "CERT_ISSUER",
- "CERT_KEYSIZE",
- "CERT_SECRETKEYSIZE",
- "CERT_SERIALNUMBER",
- "CERT_SERVER_ISSUER",
- "CERT_SERVER_SUBJECT",
- "CERT_SUBJECT",
- "HTTPS_KEYSIZE",
- "HTTPS_SECRETKEYSIZE",
- "HTTPS_SERVER_ISSUER",
- "HTTPS_SERVER_SUBJECT",
- "SERVER_PORT_SECURE",
-#ifdef WITH_ZEUS
- "SSL_CLIENT_CN",
- "SSL_CLIENT_EMAIL",
- "SSL_CLIENT_OU",
- "SSL_CLIENT_O",
- "SSL_CLIENT_L",
- "SSL_CLIENT_ST",
- "SSL_CLIENT_C",
- "SSL_CLIENT_I_CN",
- "SSL_CLIENT_I_EMAIL",
- "SSL_CLIENT_I_OU",
- "SSL_CLIENT_I_O",
- "SSL_CLIENT_I_L",
- "SSL_CLIENT_I_ST",
- "SSL_CLIENT_I_C",
-#endif
- NULL
-};
-
-
-static void php_info_isapi(ZEND_MODULE_INFO_FUNC_ARGS)
-{
- char **p;
- char variable_buf[ISAPI_SERVER_VAR_BUF_SIZE];
- DWORD variable_len;
- char **all_variables[] = {
- isapi_server_variable_names,
- isapi_special_server_variable_names,
- isapi_secure_server_variable_names,
- NULL
- };
- char ***server_variable_names;
- LPEXTENSION_CONTROL_BLOCK lpECB;
- SLS_FETCH();
-
- lpECB = (LPEXTENSION_CONTROL_BLOCK) SG(server_context);
-
- php_info_print_table_start();
- php_info_print_table_header(2, "Server Variable", "Value");
- server_variable_names = all_variables;
- while (*server_variable_names) {
- p = *server_variable_names;
- while (*p) {
- variable_len = ISAPI_SERVER_VAR_BUF_SIZE;
- if (lpECB->GetServerVariable(lpECB->ConnID, *p, variable_buf, &variable_len)
- && variable_buf[0]) {
- php_info_print_table_row(2, *p, variable_buf);
- } else if (GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
- char *tmp_variable_buf;
-
- tmp_variable_buf = (char *) emalloc(variable_len);
- if (lpECB->GetServerVariable(lpECB->ConnID, *p, tmp_variable_buf, &variable_len)
- && variable_buf[0]) {
- php_info_print_table_row(2, *p, tmp_variable_buf);
- }
- efree(tmp_variable_buf);
- }
- p++;
- }
- server_variable_names++;
- }
- php_info_print_table_end();
-}
-
-
-static zend_module_entry php_isapi_module = {
- "ISAPI",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- php_info_isapi,
- STANDARD_MODULE_PROPERTIES
-};
-
-
-static int sapi_isapi_ub_write(const char *str, uint str_length)
-{
- DWORD num_bytes = str_length;
- LPEXTENSION_CONTROL_BLOCK ecb;
- SLS_FETCH();
-
- ecb = (LPEXTENSION_CONTROL_BLOCK) SG(server_context);
- if (ecb->WriteClient(ecb->ConnID, (char *) str, &num_bytes, HSE_IO_SYNC ) == FALSE) {
- php_handle_aborted_connection();
- }
- return num_bytes;
-}
-
-
-static int sapi_isapi_header_handler(sapi_header_struct *sapi_header, sapi_headers_struct *sapi_headers SLS_DC)
-{
- return SAPI_HEADER_ADD;
-}
-
-
-
-static void accumulate_header_length(sapi_header_struct *sapi_header, uint *total_length)
-{
- *total_length += sapi_header->header_len+2;
-}
-
-
-static void concat_header(sapi_header_struct *sapi_header, char **combined_headers_ptr)
-{
- memcpy(*combined_headers_ptr, sapi_header->header, sapi_header->header_len);
- *combined_headers_ptr += sapi_header->header_len;
- **combined_headers_ptr = '\r';
- (*combined_headers_ptr)++;
- **combined_headers_ptr = '\n';
- (*combined_headers_ptr)++;
-}
-
-
-static int sapi_isapi_send_headers(sapi_headers_struct *sapi_headers SLS_DC)
-{
- uint total_length = 2; /* account for the trailing \r\n */
- char *combined_headers, *combined_headers_ptr;
- LPEXTENSION_CONTROL_BLOCK lpECB = (LPEXTENSION_CONTROL_BLOCK) SG(server_context);
- HSE_SEND_HEADER_EX_INFO header_info;
- char status_buf[MAX_STATUS_LENGTH];
- sapi_header_struct default_content_type;
- PLS_FETCH();
-
- /* Obtain headers length */
- if (SG(sapi_headers).send_default_content_type) {
- sapi_get_default_content_type_header(&default_content_type SLS_CC);
- accumulate_header_length(&default_content_type, (void *) &total_length);
- }
- zend_llist_apply_with_argument(&SG(sapi_headers).headers, (void (*)(void *, void *)) accumulate_header_length, (void *) &total_length);
-
- /* Generate headers */
- combined_headers = (char *) emalloc(total_length+1);
- combined_headers_ptr = combined_headers;
- if (SG(sapi_headers).send_default_content_type) {
- concat_header(&default_content_type, (void *) &combined_headers_ptr);
- sapi_free_header(&default_content_type); /* we no longer need it */
- }
- zend_llist_apply_with_argument(&SG(sapi_headers).headers, (void (*)(void *, void *)) concat_header, (void *) &combined_headers_ptr);
- *combined_headers_ptr++ = '\r';
- *combined_headers_ptr++ = '\n';
- *combined_headers_ptr = 0;
-
- switch (SG(sapi_headers).http_response_code) {
- case 200:
- header_info.pszStatus = "200 OK";
- break;
- case 302:
- header_info.pszStatus = "302 Moved Temporarily";
- break;
- case 401:
- header_info.pszStatus = "401 Authorization Required";
- break;
- default:
- snprintf(status_buf, MAX_STATUS_LENGTH, "%d Undescribed", SG(sapi_headers).http_response_code);
- header_info.pszStatus = status_buf;
- break;
- }
- header_info.cchStatus = strlen(header_info.pszStatus);
- header_info.pszHeader = combined_headers;
- header_info.cchHeader = total_length;
- lpECB->dwHttpStatusCode = SG(sapi_headers).http_response_code;
-
- lpECB->ServerSupportFunction(lpECB->ConnID, HSE_REQ_SEND_RESPONSE_HEADER_EX, &header_info, NULL, NULL);
-
- efree(combined_headers);
- return SAPI_HEADER_SENT_SUCCESSFULLY;
-}
-
-
-static int php_isapi_startup(sapi_module_struct *sapi_module)
-{
- if (php_module_startup(sapi_module)==FAILURE
- || zend_startup_module(&php_isapi_module)==FAILURE) {
- return FAILURE;
- } else {
- bTerminateThreadsOnError = (zend_bool) INI_INT("isapi.terminate_threads_on_error");
- return SUCCESS;
- }
-}
-
-
-
-static int sapi_isapi_read_post(char *buffer, uint count_bytes SLS_DC)
-{
- LPEXTENSION_CONTROL_BLOCK lpECB = (LPEXTENSION_CONTROL_BLOCK) SG(server_context);
- DWORD read_from_buf=0;
- DWORD read_from_input=0;
- DWORD total_read=0;
-
- if ((DWORD) SG(read_post_bytes) < lpECB->cbAvailable) {
- read_from_buf = MIN(lpECB->cbAvailable-SG(read_post_bytes), count_bytes);
- memcpy(buffer, lpECB->lpbData+SG(read_post_bytes), read_from_buf);
- total_read += read_from_buf;
- }
- if (read_from_buf<count_bytes
- && (SG(read_post_bytes)+read_from_buf) < lpECB->cbTotalBytes) {
- DWORD cbRead=0, cbSize;
-
- read_from_input = MIN(count_bytes-read_from_buf, lpECB->cbTotalBytes-SG(read_post_bytes)-read_from_buf);
- while (cbRead < read_from_input) {
- cbSize = read_from_input - cbRead;
- if (!lpECB->ReadClient(lpECB->ConnID, buffer+read_from_buf+cbRead, &cbSize) || cbSize==0) {
- break;
- }
- cbRead += cbSize;
- }
- total_read += cbRead;
- }
- return total_read;
-}
-
-
-static char *sapi_isapi_read_cookies(SLS_D)
-{
- LPEXTENSION_CONTROL_BLOCK lpECB = (LPEXTENSION_CONTROL_BLOCK) SG(server_context);
- char variable_buf[ISAPI_SERVER_VAR_BUF_SIZE];
- DWORD variable_len = ISAPI_SERVER_VAR_BUF_SIZE;
-
- if (lpECB->GetServerVariable(lpECB->ConnID, "HTTP_COOKIE", variable_buf, &variable_len)) {
- return estrndup(variable_buf, variable_len);
- } else if (GetLastError()==ERROR_INSUFFICIENT_BUFFER) {
- char *tmp_variable_buf = (char *) emalloc(variable_len+1);
-
- if (lpECB->GetServerVariable(lpECB->ConnID, "HTTP_COOKIE", tmp_variable_buf, &variable_len)) {
- tmp_variable_buf[variable_len] = 0;
- return tmp_variable_buf;
- } else {
- efree(tmp_variable_buf);
- }
- }
- return NULL;
-}
-
-
-#ifdef WITH_ZEUS
-
-static void sapi_isapi_register_zeus_ssl_variables(LPEXTENSION_CONTROL_BLOCK lpECB, zval *track_vars_array ELS_DC PLS_DC)
-{
- char static_variable_buf[ISAPI_SERVER_VAR_BUF_SIZE];
- DWORD variable_len = ISAPI_SERVER_VAR_BUF_SIZE;
- char static_cons_buf[ISAPI_SERVER_VAR_BUF_SIZE];
- /*
- * We need to construct the /C=.../ST=...
- * DN's for SSL_CLIENT_DN and SSL_CLIENT_I_DN
- */
- strcpy( static_cons_buf, "/C=" );
- if( lpECB->GetServerVariable( lpECB->ConnID, "SSL_CLIENT_C", static_variable_buf, &variable_len ) && static_variable_buf[0] ) {
- strcat( static_cons_buf, static_variable_buf );
- }
- strcat( static_cons_buf, "/ST=" );
- variable_len = ISAPI_SERVER_VAR_BUF_SIZE;
- if( lpECB->GetServerVariable( lpECB->ConnID, "SSL_CLIENT_ST", static_variable_buf, &variable_len ) && static_variable_buf[0] ) {
- strcat( static_cons_buf, static_variable_buf );
- }
- php_register_variable( "SSL_CLIENT_DN", static_cons_buf, track_vars_array ELS_CC PLS_CC );
-
- strcpy( static_cons_buf, "/C=" );
- variable_len = ISAPI_SERVER_VAR_BUF_SIZE;
- if( lpECB->GetServerVariable( lpECB->ConnID, "SSL_CLIENT_I_C", static_variable_buf, &variable_len ) && static_variable_buf[0] ) {
- strcat( static_cons_buf, static_variable_buf );
- }
- strcat( static_cons_buf, "/ST=" );
- variable_len = ISAPI_SERVER_VAR_BUF_SIZE;
- if( lpECB->GetServerVariable( lpECB->ConnID, "SSL_CLIENT_I_ST", static_variable_buf, &variable_len ) && static_variable_buf[0] ) {
- strcat( static_cons_buf, static_variable_buf );
- }
- php_register_variable( "SSL_CLIENT_I_DN", static_cons_buf, track_vars_array ELS_CC PLS_CC );
-}
-
-static void sapi_isapi_register_zeus_variables(LPEXTENSION_CONTROL_BLOCK lpECB, zval *track_vars_array ELS_DC PLS_DC)
-{
- char static_variable_buf[ISAPI_SERVER_VAR_BUF_SIZE];
- DWORD variable_len = ISAPI_SERVER_VAR_BUF_SIZE;
- DWORD scriptname_len = ISAPI_SERVER_VAR_BUF_SIZE;
- DWORD pathinfo_len = 0;
- char *strtok_buf = NULL;
-
- /* Get SCRIPT_NAME, we use this to work out which bit of the URL
- * belongs in PHP's version of PATH_INFO
- */
- lpECB->GetServerVariable(lpECB->ConnID, "SCRIPT_NAME", static_variable_buf, &scriptname_len);
-
- /* Adjust Zeus' version of PATH_INFO, set PHP_SELF,
- * and generate REQUEST_URI
- */
- if ( lpECB->GetServerVariable(lpECB->ConnID, "PATH_INFO", static_variable_buf, &variable_len) && static_variable_buf[0] ) {
-
- /* PHP_SELF is just PATH_INFO */
- php_register_variable( "PHP_SELF", static_variable_buf, track_vars_array ELS_CC PLS_CC );
-
- /* Chop off filename to get just the 'real' PATH_INFO' */
- pathinfo_len = variable_len - scriptname_len;
- php_register_variable( "PATH_INFO", static_variable_buf + scriptname_len - 1, track_vars_array ELS_CC PLS_CC );
- /* append query string to give url... extra byte for '?' */
- if ( strlen(lpECB->lpszQueryString) + variable_len + 1 < ISAPI_SERVER_VAR_BUF_SIZE ) {
- /* append query string only if it is present... */
- if ( strlen(lpECB->lpszQueryString) ) {
- static_variable_buf[ variable_len - 1 ] = '?';
- strcpy( static_variable_buf + variable_len, lpECB->lpszQueryString );
- }
- php_register_variable( "URL", static_variable_buf, track_vars_array ELS_CC PLS_CC );
- php_register_variable( "REQUEST_URI", static_variable_buf, track_vars_array ELS_CC PLS_CC );
- }
- }
-
- /* Get and adjust PATH_TRANSLATED to what PHP wants */
- variable_len = ISAPI_SERVER_VAR_BUF_SIZE;
- if ( lpECB->GetServerVariable(lpECB->ConnID, "PATH_TRANSLATED", static_variable_buf, &variable_len) && static_variable_buf[0] ) {
- static_variable_buf[ variable_len - pathinfo_len - 1 ] = '\0';
- php_register_variable( "PATH_TRANSLATED", static_variable_buf, track_vars_array ELS_CC PLS_CC );
- }
-
- /* Bring in the AUTHENTICATION stuff as needed */
- variable_len = ISAPI_SERVER_VAR_BUF_SIZE;
- if ( lpECB->GetServerVariable(lpECB->ConnID, "AUTH_USER", static_variable_buf, &variable_len) && static_variable_buf[0] ) {
- php_register_variable( "PHP_AUTH_USER", static_variable_buf, track_vars_array ELS_CC PLS_CC );
- }
- variable_len = ISAPI_SERVER_VAR_BUF_SIZE;
- if ( lpECB->GetServerVariable(lpECB->ConnID, "AUTH_PASSWORD", static_variable_buf, &variable_len) && static_variable_buf[0] ) {
- php_register_variable( "PHP_AUTH_PW", static_variable_buf, track_vars_array ELS_CC PLS_CC );
- }
- variable_len = ISAPI_SERVER_VAR_BUF_SIZE;
- if ( lpECB->GetServerVariable(lpECB->ConnID, "AUTH_TYPE", static_variable_buf, &variable_len) && static_variable_buf[0] ) {
- php_register_variable( "PHP_AUTH_TYPE", static_variable_buf, track_vars_array ELS_CC PLS_CC );
- }
-
- /* And now, for the SSL variables (if applicable) */
- variable_len = ISAPI_SERVER_VAR_BUF_SIZE;
- if ( lpECB->GetServerVariable(lpECB->ConnID, "CERT_COOKIE", static_variable_buf, &variable_len) && static_variable_buf[0] ) {
- sapi_isapi_register_zeus_ssl_variables( lpECB, track_vars_array ELS_CC PLS_CC );
- }
- /* Copy some of the variables we need to meet Apache specs */
- variable_len = ISAPI_SERVER_VAR_BUF_SIZE;
- if ( lpECB->GetServerVariable(lpECB->ConnID, "SERVER_SOFTWARE", static_variable_buf, &variable_len) && static_variable_buf[0] ) {
- php_register_variable( "SERVER_SIGNATURE", static_variable_buf, track_vars_array ELS_CC PLS_CC );
- }
-}
-#endif
-
-
-static void sapi_isapi_register_server_variables2(char **server_variables, LPEXTENSION_CONTROL_BLOCK lpECB, zval *track_vars_array, char **recorded_values ELS_DC PLS_DC)
-{
- char **p=server_variables;
- DWORD variable_len;
- char static_variable_buf[ISAPI_SERVER_VAR_BUF_SIZE];
- char *variable_buf;
-
- while (*p) {
- variable_len = ISAPI_SERVER_VAR_BUF_SIZE;
- if (lpECB->GetServerVariable(lpECB->ConnID, *p, static_variable_buf, &variable_len)
- && static_variable_buf[0]) {
- php_register_variable(*p, static_variable_buf, track_vars_array ELS_CC PLS_CC);
- if (recorded_values) {
- recorded_values[p-server_variables] = estrndup(static_variable_buf, variable_len);
- }
- } else if (GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
- variable_buf = (char *) emalloc(variable_len);
- if (lpECB->GetServerVariable(lpECB->ConnID, *p, variable_buf, &variable_len)
- && variable_buf[0]) {
- php_register_variable(*p, variable_buf, track_vars_array ELS_CC PLS_CC);
- }
- if (recorded_values) {
- recorded_values[p-server_variables] = variable_buf;
- } else {
- efree(variable_buf);
- }
- }
- p++;
- }
-}
-
-
-static void sapi_isapi_register_server_variables(zval *track_vars_array ELS_DC SLS_DC PLS_DC)
-{
- DWORD variable_len = ISAPI_SERVER_VAR_BUF_SIZE;
- char *variable;
- char *strtok_buf = NULL;
- char *isapi_special_server_variables[NUM_SPECIAL_VARS];
- LPEXTENSION_CONTROL_BLOCK lpECB;
-
- lpECB = (LPEXTENSION_CONTROL_BLOCK) SG(server_context);
-
- /* Register the special ISAPI variables */
- memset(isapi_special_server_variables, 0, sizeof(isapi_special_server_variables));
- sapi_isapi_register_server_variables2(isapi_special_server_variable_names, lpECB, track_vars_array, isapi_special_server_variables ELS_CC PLS_CC);
- if (SG(request_info).cookie_data) {
- php_register_variable("HTTP_COOKIE", SG(request_info).cookie_data, track_vars_array ELS_CC PLS_CC);
- }
-
- /* Register the standard ISAPI variables */
- sapi_isapi_register_server_variables2(isapi_server_variable_names, lpECB, track_vars_array, NULL ELS_CC PLS_CC);
-
- if (isapi_special_server_variables[SPECIAL_VAR_HTTPS]
- && atoi(isapi_special_server_variables[SPECIAL_VAR_HTTPS])) {
- /* Register SSL ISAPI variables */
- sapi_isapi_register_server_variables2(isapi_secure_server_variable_names, lpECB, track_vars_array, NULL ELS_CC PLS_CC);
- }
-
- if (isapi_special_server_variables[SPECIAL_VAR_HTTPS]) {
- efree(isapi_special_server_variables[SPECIAL_VAR_HTTPS]);
- }
-
-
-#ifdef WITH_ZEUS
- sapi_isapi_register_zeus_variables(lpECB, track_vars_array ELS_CC PLS_CC);
-#endif
-
- /* PHP_SELF support */
- if (isapi_special_server_variables[SPECIAL_VAR_PHP_SELF]) {
- php_register_variable("PHP_SELF", isapi_special_server_variables[SPECIAL_VAR_PHP_SELF], track_vars_array ELS_CC PLS_CC);
- efree(isapi_special_server_variables[SPECIAL_VAR_PHP_SELF]);
- }
-
- if (isapi_special_server_variables[SPECIAL_VAR_ALL_HTTP]) {
- /* Register the internal bits of ALL_HTTP */
- variable = php_strtok_r(isapi_special_server_variables[SPECIAL_VAR_ALL_HTTP], "\r\n", &strtok_buf);
- while (variable) {
- char *colon = strchr(variable, ':');
-
- if (colon) {
- char *value = colon+1;
-
- while (*value==' ') {
- value++;
- }
- *colon = 0;
- php_register_variable(variable, value, track_vars_array ELS_CC PLS_CC);
- *colon = ':';
- }
- variable = php_strtok_r(NULL, "\r\n", &strtok_buf);
- }
- efree(isapi_special_server_variables[SPECIAL_VAR_ALL_HTTP]);
- }
-
-#ifdef PHP_WIN32
- {
- HSE_URL_MAPEX_INFO humi;
- DWORD path_len = 2;
- char path[] = "/";
-
- if (lpECB->ServerSupportFunction(lpECB->ConnID, HSE_REQ_MAP_URL_TO_PATH_EX, path, &path_len, (LPDWORD) &humi)) {
- /* Remove trailing \ */
- if (humi.lpszPath[path_len-2] == '\\') {
- humi.lpszPath[path_len-2] = 0;
- }
- php_register_variable("DOCUMENT_ROOT", humi.lpszPath, track_vars_array ELS_CC PLS_CC);
- }
- }
-#endif
-}
-
-
-static sapi_module_struct isapi_sapi_module = {
- "isapi", /* name */
- "ISAPI", /* pretty name */
-
- php_isapi_startup, /* startup */
- php_module_shutdown_wrapper, /* shutdown */
-
- NULL, /* activate */
- NULL, /* deactivate */
-
- sapi_isapi_ub_write, /* unbuffered write */
- NULL, /* flush */
- NULL, /* get uid */
- NULL, /* getenv */
-
- php_error, /* error handler */
-
- sapi_isapi_header_handler, /* header handler */
- sapi_isapi_send_headers, /* send headers handler */
- NULL, /* send header handler */
-
- sapi_isapi_read_post, /* read POST data */
- sapi_isapi_read_cookies, /* read Cookies */
-
- sapi_isapi_register_server_variables, /* register server variables */
- NULL, /* Log message */
-
- NULL, /* Block interruptions */
- NULL, /* Unblock interruptions */
-
- STANDARD_SAPI_MODULE_PROPERTIES
-};
-
-
-BOOL WINAPI GetFilterVersion(PHTTP_FILTER_VERSION pFilterVersion)
-{
- bFilterLoaded = 1;
- pFilterVersion->dwFilterVersion = HTTP_FILTER_REVISION;
- strcpy(pFilterVersion->lpszFilterDesc, isapi_sapi_module.pretty_name);
- pFilterVersion->dwFlags= (SF_NOTIFY_AUTHENTICATION | SF_NOTIFY_PREPROC_HEADERS);
- return TRUE;
-}
-
-
-DWORD WINAPI HttpFilterProc(PHTTP_FILTER_CONTEXT pfc, DWORD notificationType, LPVOID pvNotification)
-{
- SLS_FETCH();
-
- switch (notificationType) {
- case SF_NOTIFY_PREPROC_HEADERS:
- SG(request_info).auth_user = NULL;
- SG(request_info).auth_password = NULL;
- break;
- case SF_NOTIFY_AUTHENTICATION: {
- char *auth_user = ((HTTP_FILTER_AUTHENT *) pvNotification)->pszUser;
- char *auth_password = ((HTTP_FILTER_AUTHENT *) pvNotification)->pszPassword;
-
- if (auth_user && auth_user[0]) {
- SG(request_info).auth_user = estrdup(auth_user);
- }
- if (auth_password && auth_password[0]) {
- SG(request_info).auth_password = estrdup(auth_password);
- }
- return SF_STATUS_REQ_HANDLED_NOTIFICATION;
- }
- break;
- }
- return SF_STATUS_REQ_NEXT_NOTIFICATION;
-}
-
-
-static void init_request_info(sapi_globals_struct *sapi_globals, LPEXTENSION_CONTROL_BLOCK lpECB)
-{
- SG(request_info).request_method = lpECB->lpszMethod;
- SG(request_info).query_string = lpECB->lpszQueryString;
- SG(request_info).path_translated = lpECB->lpszPathTranslated;
- SG(request_info).request_uri = lpECB->lpszPathInfo;
- SG(request_info).content_type = lpECB->lpszContentType;
- SG(request_info).content_length = lpECB->cbTotalBytes;
- SG(sapi_headers).http_response_code = 200; /* I think dwHttpStatusCode is invalid at this stage -RL */
- if (!bFilterLoaded) { /* we don't have valid ISAPI Filter information */
- SG(request_info).auth_user = SG(request_info).auth_password = NULL;
- }
-}
-
-
-static void php_isapi_report_exception(char *message, int message_len SLS_DC)
-{
- if (!SG(headers_sent)) {
- HSE_SEND_HEADER_EX_INFO header_info;
- LPEXTENSION_CONTROL_BLOCK lpECB = (LPEXTENSION_CONTROL_BLOCK) SG(server_context);
-
- header_info.pszStatus = "500 Internal Server Error";
- header_info.cchStatus = strlen(header_info.pszStatus);
- header_info.pszHeader = "Content-Type: text/html\r\n\r\n";
- header_info.cchHeader = strlen(header_info.pszHeader);
-
- lpECB->dwHttpStatusCode = 500;
- lpECB->ServerSupportFunction(lpECB->ConnID, HSE_REQ_SEND_RESPONSE_HEADER_EX, &header_info, NULL, NULL);
- SG(headers_sent)=1;
- }
- sapi_isapi_ub_write(message, message_len);
-}
-
-
-BOOL WINAPI GetExtensionVersion(HSE_VERSION_INFO *pVer)
-{
- pVer->dwExtensionVersion = HSE_VERSION;
-#ifdef WITH_ZEUS
- strncpy( pVer->lpszExtensionDesc, isapi_sapi_module.name, HSE_MAX_EXT_DLL_NAME_LEN);
-#else
- lstrcpyn(pVer->lpszExtensionDesc, isapi_sapi_module.name, HSE_MAX_EXT_DLL_NAME_LEN);
-#endif
- return TRUE;
-}
-
-
-static void my_endthread()
-{
-#ifdef PHP_WIN32
- if (bTerminateThreadsOnError) {
- _endthread();
- }
-#endif
-}
-
-#ifdef PHP_WIN32
-/*
- ___except can only call a function, so we have to do this
- to retrieve the pointer.
- */
-BOOL exceptionhandler(LPEXCEPTION_POINTERS *e,LPEXCEPTION_POINTERS ep)
-{
- *e=ep;
- return TRUE;
-}
-#endif
-
-DWORD WINAPI HttpExtensionProc(LPEXTENSION_CONTROL_BLOCK lpECB)
-{
- zend_file_handle file_handle;
- zend_bool stack_overflown=0;
- SLS_FETCH();
- CLS_FETCH();
- ELS_FETCH();
- PLS_FETCH();
-#if !defined (NO_EXCEPTION_HANDLERS) && defined(PHP_WIN32)
- LPEXCEPTION_POINTERS e;
-#endif
-
- if (setjmp(EG(bailout))!=0) {
- php_request_shutdown(NULL);
- return HSE_STATUS_ERROR;
- }
-
-#if !defined (NO_EXCEPTION_HANDLERS)
- __try {
-#endif
- init_request_info(sapi_globals, lpECB);
- SG(server_context) = lpECB;
-
-#ifdef WITH_ZEUS
- /* PATH_TRANSLATED can contain extra PATH_INFO stuff after the
- * file being loaded, so we must use SCRIPT_FILENAME instead
- */
- file_handle.filename = (char *)emalloc( ISAPI_SERVER_VAR_BUF_SIZE );
- file_handle.free_filename = 1;
- {
- DWORD filename_len = ISAPI_SERVER_VAR_BUF_SIZE;
- if( !lpECB->GetServerVariable(lpECB->ConnID, "SCRIPT_FILENAME", file_handle.filename, &filename_len) || file_handle.filename[ 0 ] == '\0' ) {
- /* If we're running on an earlier version of Zeus, this
- * variable won't be present, so fall back to old behaviour.
- */
- efree( file_handle.filename );
- file_handle.filename = sapi_globals->request_info.path_translated;
- file_handle.free_filename = 0;
- }
- }
-#else
- file_handle.filename = sapi_globals->request_info.path_translated;
- file_handle.free_filename = 0;
-#endif
- file_handle.type = ZEND_HANDLE_FILENAME;
- file_handle.opened_path = NULL;
-
- php_request_startup(CLS_C ELS_CC PLS_CC SLS_CC);
- php_execute_script(&file_handle CLS_CC ELS_CC PLS_CC);
- if (SG(request_info).cookie_data) {
- efree(SG(request_info).cookie_data);
- }
-#if !defined (NO_EXCEPTION_HANDLERS)
-#ifdef PHP_WIN32
- } __except(exceptionhandler(&e,GetExceptionInformation())) {
-#else
- } __except(EXCEPTION_EXECUTE_HANDLER) {
-#endif
-#ifdef PHP_WIN32
- char buf[1024];
- if (_exception_code()==EXCEPTION_STACK_OVERFLOW) {
- LPBYTE lpPage;
- static SYSTEM_INFO si;
- static MEMORY_BASIC_INFORMATION mi;
- static DWORD dwOldProtect;
-
- GetSystemInfo(&si);
-
- /* Get page ESP is pointing to */
- _asm mov lpPage, esp;
-
- /* Get stack allocation base */
- VirtualQuery(lpPage, &mi, sizeof(mi));
-
- /* Go to the page below the current page */
- lpPage = (LPBYTE) (mi.BaseAddress) - si.dwPageSize;
-
- /* Free pages below current page */
- if (!VirtualFree(mi.AllocationBase, (LPBYTE)lpPage - (LPBYTE) mi.AllocationBase, MEM_DECOMMIT)) {
- _endthread();
- }
-
- /* Restore the guard page */
- if (!VirtualProtect(lpPage, si.dwPageSize, PAGE_GUARD | PAGE_READWRITE, &dwOldProtect)) {
- _endthread();
- }
-
- CG(unclean_shutdown)=1;
- _snprintf(buf,sizeof(buf)-1,"PHP has encountered a Stack overflow");
- php_isapi_report_exception(buf, strlen(buf) SLS_CC);
- } else if (_exception_code()==EXCEPTION_ACCESS_VIOLATION) {
- _snprintf(buf,sizeof(buf)-1,"PHP has encountered an Access Violation at %p",e->ExceptionRecord->ExceptionAddress);
- php_isapi_report_exception(buf, strlen(buf) SLS_CC);
- my_endthread();
- } else {
- _snprintf(buf,sizeof(buf)-1,"PHP has encountered an Unhandled Exception Code %d at %p",e->ExceptionRecord->ExceptionCode , e->ExceptionRecord->ExceptionAddress);
- php_isapi_report_exception(buf, strlen(buf) SLS_CC);
- my_endthread();
- }
-#endif
- }
- __try {
- php_request_shutdown(NULL);
- } __except(EXCEPTION_EXECUTE_HANDLER) {
- my_endthread();
- }
-#else
- php_request_shutdown(NULL);
-#endif
-
- return HSE_STATUS_SUCCESS;
-}
-
-
-
-__declspec(dllexport) BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
-{
- switch (fdwReason) {
- case DLL_PROCESS_ATTACH:
-#ifdef WITH_ZEUS
- tsrm_startup(128, 1, TSRM_ERROR_LEVEL_CORE, "TSRM.log");
-#else
- tsrm_startup(128, 1, TSRM_ERROR_LEVEL_CORE, "C:\\TSRM.log");
-#endif
- sapi_startup(&isapi_sapi_module);
- if (isapi_sapi_module.startup) {
- isapi_sapi_module.startup(&sapi_module);
- }
- break;
- case DLL_THREAD_ATTACH:
- break;
- case DLL_THREAD_DETACH:
- ts_free_thread();
- break;
- case DLL_PROCESS_DETACH:
- if (isapi_sapi_module.shutdown) {
- isapi_sapi_module.shutdown(&sapi_module);
- }
- tsrm_shutdown();
- break;
- }
- return TRUE;
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/sapi/isapi/php4isapi.def b/sapi/isapi/php4isapi.def
deleted file mode 100644
index 596023ef55..0000000000
--- a/sapi/isapi/php4isapi.def
+++ /dev/null
@@ -1,5 +0,0 @@
-EXPORTS
-HttpFilterProc
-GetFilterVersion
-HttpExtensionProc
-GetExtensionVersion
diff --git a/sapi/isapi/php4isapi.dsp b/sapi/isapi/php4isapi.dsp
deleted file mode 100644
index 7913ec6fad..0000000000
--- a/sapi/isapi/php4isapi.dsp
+++ /dev/null
@@ -1,165 +0,0 @@
-# Microsoft Developer Studio Project File - Name="php4isapi" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=php4isapi - Win32 Debug_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "php4isapi.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "php4isapi.mak" CFG="php4isapi - Win32 Debug_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "php4isapi - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "php4isapi - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "php4isapi - Win32 Release_TS_inline" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "php4isapi - Win32 Release_TSDbg" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "php4isapi - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "..\..\Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PHP4ISAPI_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\..\win32" /I "..\..\Zend" /I "..\.." /I "..\..\main" /I "..\..\TSRM" /D "_DEBUG" /D "COMPILE_LIBZEND" /D ZEND_DEBUG=1 /D "_WINDOWS" /D "_USRDLL" /D "PHP4ISAPI_EXPORTS" /D "MSVC5" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WIN32" /D "_MBCS" /FR /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "_DEBUG"
-# ADD RSC /l 0x40d /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts_debug.lib /nologo /version:4.0 /dll /debug /machine:I386 /nodefaultlib:"libcmt" /pdbtype:sept /libpath:"..\..\Debug_TS"
-
-!ELSEIF "$(CFG)" == "php4isapi - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "..\..\Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PHP4ISAPI_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "...\..\include" /I "..\..\win32" /I "..\..\Zend" /I "..\.." /I "..\..\main" /I "..\..\TSRM" /D "NDEBUG" /D ZEND_DEBUG=0 /D "_WINDOWS" /D "_USRDLL" /D "PHP4ISAPI_EXPORTS" /D "MSVC5" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WIN32" /D "_MBCS" /FR /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "NDEBUG"
-# ADD RSC /l 0x40d /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib wsock32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib /nologo /version:4.0 /dll /machine:I386 /libpath:"..\..\Release_TS"
-
-!ELSEIF "$(CFG)" == "php4isapi - Win32 Release_TS_inline"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "php4isapi___Win32_Release_TS_inline"
-# PROP BASE Intermediate_Dir "php4isapi___Win32_Release_TS_inline"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "..\..\Release_TS_inline"
-# PROP Intermediate_Dir "Release_TS_inline"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "...\..\include" /I "..\..\win32" /I "..\..\Zend" /I "..\.." /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "PHP4ISAPI_EXPORTS" /D "MSVC5" /D "ZTS" /D "WIN32" /D "_MBCS" /D ZEND_DEBUG=0 /FR /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "...\..\include" /I "..\..\win32" /I "..\..\Zend" /I "..\.." /I "..\..\main" /I "..\..\TSRM" /D "NDEBUG" /D ZEND_DEBUG=0 /D "ZEND_WIN32_FORCE_INLINE" /D "_WINDOWS" /D "_USRDLL" /D "PHP4ISAPI_EXPORTS" /D "MSVC5" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WIN32" /D "_MBCS" /FR /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "NDEBUG"
-# ADD RSC /l 0x40d /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib wsock32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib /nologo /dll /machine:I386 /libpath:"..\..\Release_TS"
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib wsock32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib /nologo /version:4.0 /dll /machine:I386 /libpath:"..\..\Release_TS_inline"
-
-!ELSEIF "$(CFG)" == "php4isapi - Win32 Release_TSDbg"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "php4isapi___Win32_Release_TSDbg"
-# PROP BASE Intermediate_Dir "php4isapi___Win32_Release_TSDbg"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "..\..\Release_TSDbg"
-# PROP Intermediate_Dir "Release_TSDbg"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "...\..\include" /I "..\..\win32" /I "..\..\Zend" /I "..\.." /I "..\..\main" /I "..\..\TSRM" /D "NDEBUG" /D ZEND_DEBUG=0 /D "_WINDOWS" /D "_USRDLL" /D "PHP4ISAPI_EXPORTS" /D "MSVC5" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WIN32" /D "_MBCS" /FR /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /Zi /Od /I "...\..\include" /I "..\..\win32" /I "..\..\Zend" /I "..\.." /I "..\..\main" /I "..\..\TSRM" /D "NDEBUG" /D ZEND_DEBUG=0 /D "_WINDOWS" /D "_USRDLL" /D "PHP4ISAPI_EXPORTS" /D "MSVC5" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WIN32" /D "_MBCS" /FR /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "NDEBUG"
-# ADD RSC /l 0x40d /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib wsock32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib /nologo /version:4.0 /dll /machine:I386 /libpath:"..\..\Release_TS"
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib wsock32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib /nologo /version:4.0 /dll /debug /machine:I386 /libpath:"..\..\Release_TSDbg"
-
-!ENDIF
-
-# Begin Target
-
-# Name "php4isapi - Win32 Debug_TS"
-# Name "php4isapi - Win32 Release_TS"
-# Name "php4isapi - Win32 Release_TS_inline"
-# Name "php4isapi - Win32 Release_TSDbg"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\php4isapi.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\php4isapi.def
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# End Group
-# End Target
-# End Project
diff --git a/sapi/isapi/stresstest/notes.txt b/sapi/isapi/stresstest/notes.txt
deleted file mode 100644
index 2bab38dd07..0000000000
--- a/sapi/isapi/stresstest/notes.txt
+++ /dev/null
@@ -1,56 +0,0 @@
-This stress test program is for debugging threading issues with the ISAPI
-module.
-
-2 ways to use it:
-
-1: test any php script file on multiple threads
-2: run the php test scripts bundled with the source code
-
-
-
-GLOBAL SETTINGS
-===============
-
-If you need to set special environement variables, in addition to your
-regular environment, create a file that contains them, one setting per line:
-
-MY_ENV_VAR=XXXXXXXX
-
-This can be used to simulate ISAPI environment variables if need be.
-
-By default, stress test uses 10 threads. To change this, change the define
-NUM_THREADS in stresstest.cpp.
-
-
-
-1: Test any php script file on multiple threads
-===============================================
-
-Create a file that contains a list of php script files, one per line. If
-you need to provide input, place the GET data, or Query String, after the
-filename. File contents would look like:
-
-e:\inetpub\pages\index.php
-e:\inetpub\pages\info.php
-e:\inetpub\pages\test.php a=1&b=2
-
-Run: stresstest L files.txt
-
-
-
-2: Run the php test scripts bundled with the source code
-========================================================
-
-supply the path to the parent of the "tests" directory (expect a couple
-long pauses for a couple of the larger tests)
-
-Run: stresstest T c:\php4-source
-
-
-
-TODO:
-
-* Make more options configurable: number of threads, iterations, etc.
-* Improve stdout output to make it more useful
-* Implement support for SKIPIF
-* Improve speed of CompareFile function (too slow on big files).
diff --git a/sapi/isapi/stresstest/stresstest.cpp b/sapi/isapi/stresstest/stresstest.cpp
deleted file mode 100644
index 846305ac6c..0000000000
--- a/sapi/isapi/stresstest/stresstest.cpp
+++ /dev/null
@@ -1,853 +0,0 @@
-/*
- * ======================================================================= *
- * File: stress .c *
- * stress tester for isapi dll's *
- * based on cgiwrap *
- * ======================================================================= *
- *
-*/
-#define WIN32_LEAN_AND_MEAN
-#include <afx.h>
-#include <afxtempl.h>
-#include <winbase.h>
-#include <winerror.h>
-#include <httpext.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-// These are things that go out in the Response Header
-//
-#define HTTP_VER "HTTP/1.0"
-#define SERVER_VERSION "Http-Srv-Beta2/1.0"
-
-//
-// Simple wrappers for the heap APIS
-//
-#define xmalloc(s) HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,(s))
-#define xfree(s) HeapFree(GetProcessHeap(),0,(s))
-
-//
-// The mandatory exports from the ISAPI DLL
-//
-#define NUM_THREADS 10
-#define ITERATIONS 1
-HANDLE StartNow;
-// quick and dirty environment
-typedef CMapStringToString TEnvironment;
-TEnvironment IsapiEnvironment;
-
-typedef struct _TResults {
- LONG ok;
- LONG bad;
-} TResults;
-
-CStringArray IsapiFileList; // list of filenames
-CStringArray TestNames; // --TEST--
-CStringArray IsapiGetData; // --GET--
-CStringArray IsapiPostData; // --POST--
-CStringArray IsapiMatchData; // --EXPECT--
-CArray<TResults, TResults> Results;
-
-typedef struct _TIsapiContext {
- HANDLE in;
- HANDLE out;
- DWORD tid;
- TEnvironment env;
-} TIsapiContext;
-
-//
-// Prototypes of the functions this sample implements
-//
-extern "C" {
-HINSTANCE hDll;
-typedef BOOL (WINAPI *VersionProc)(HSE_VERSION_INFO *) ;
-typedef DWORD (WINAPI *HttpExtProc)(EXTENSION_CONTROL_BLOCK *);
-BOOL WINAPI FillExtensionControlBlock(EXTENSION_CONTROL_BLOCK *, TIsapiContext *) ;
-BOOL WINAPI GetServerVariable(HCONN, LPSTR, LPVOID, LPDWORD );
-BOOL WINAPI ReadClient(HCONN,LPVOID,LPDWORD);
-BOOL WINAPI WriteClient(HCONN,LPVOID,LPDWORD,DWORD);
-BOOL WINAPI ServerSupportFunction(HCONN,DWORD,LPVOID,LPDWORD,LPDWORD);
-VersionProc IsapiGetExtensionVersion;
-HttpExtProc IsapiHttpExtensionProc;
-HSE_VERSION_INFO version_info;
-}
-
-char * MakeDateStr(VOID);
-char * GetEnv(char *);
-
-
-
-
-DWORD CALLBACK IsapiThread(void *);
-int stress_main(const char *filename,
- const char *arg,
- const char *postfile,
- const char *matchdata);
-
-
-
-BOOL bUseTestFiles = FALSE;
-char temppath[MAX_PATH];
-
-void stripcrlf(char *line)
-{
- DWORD l = strlen(line)-1;
- if (line[l]==10 || line[l]==13) line[l]=0;
- l = strlen(line)-1;
- if (line[l]==10 || line[l]==13) line[l]=0;
-}
-
-#define COMPARE_BUF_SIZE 1024
-
-BOOL CompareFiles(const char*f1, const char*f2)
-{
- FILE *fp1, *fp2;
- bool retval;
- char buf1[COMPARE_BUF_SIZE], buf2[COMPARE_BUF_SIZE];
- int length1, length2;
-
- if ((fp1=fopen(f1, "r"))==NULL) {
- return FALSE;
- }
-
- if ((fp2=fopen(f2, "r"))==NULL) {
- fclose(fp1);
- return FALSE;
- }
-
- retval = TRUE; // success oriented
- while (true) {
- length1 = fread(buf1, 1, sizeof(buf1), fp1);
- length2 = fread(buf2, 1, sizeof(buf2), fp2);
-
- // check for end of file
- if (feof(fp1)) {
- if (!feof(fp2)) {
- retval = FALSE;
- }
- break;
- } else if (feof(fp2)) {
- if (!feof(fp1)) {
- retval = FALSE;
- }
- break;
- }
-
- // compare data
- if (length1!=length2
- || memcmp(buf1, buf2, length1)!=0) {
- retval = FALSE;
- break;
- }
- }
- fclose(fp1);
- fclose(fp2);
-
- return retval;
-}
-
-
-BOOL CompareStringWithFile(const char *filename, const char *str, unsigned int str_length)
-{
- FILE *fp;
- bool retval;
- char buf[COMPARE_BUF_SIZE];
- unsigned int offset=0, readbytes;
-
- if ((fp=fopen(filename, "r"))==NULL) {
- return FALSE;
- }
-
- retval = TRUE; // success oriented
- while (true) {
- readbytes = fread(buf, 1, sizeof(buf), fp);
-
- // check for end of file
- if (feof(fp)) {
- break;
- }
-
- if (offset+readbytes > str_length
- || memcmp(buf, str+offset, readbytes)!=NULL) {
- retval = FALSE;
- break;
- }
- }
- fclose(fp);
-
- return retval;
-}
-
-
-BOOL ReadGlobalEnvironment(const char *environment)
-{
- if (environment) {
- FILE *fp = fopen(environment, "r");
- DWORD i=0;
- if (fp) {
- char line[2048];
- while (fgets(line,sizeof(line)-1,fp)) {
- // file.php arg1 arg2 etc.
- char *p = strchr(line, '=');
- if (p) {
- *p=0;
- IsapiEnvironment[line]=p+1;
- }
- }
- fclose(fp);
- return IsapiEnvironment.GetCount() > 0;
- }
- }
- return FALSE;
-}
-
-BOOL ReadFileList(const char *filelist)
-{
- FILE *fp = fopen(filelist, "r");
- if (!fp) {
- printf("Unable to open %s\r\n", filelist);
- }
- char line[2048];
- int i=0;
- while (fgets(line,sizeof(line)-1,fp)) {
- // file.php arg1 arg2 etc.
- stripcrlf(line);
- if (strlen(line)>3) {
- char *p = strchr(line, ' ');
- if (p) {
- *p = 0;
- // get file
-
- IsapiFileList.Add(line);
- IsapiGetData.Add(p+1);
- } else {
- // just a filename is all
- IsapiFileList.Add(line);
- IsapiGetData.Add("");
- }
- }
-
- // future use
- IsapiPostData.Add("");
- IsapiMatchData.Add("");
- TestNames.Add("");
-
- i++;
- }
- Results.SetSize(TestNames.GetSize());
-
- fclose(fp);
- return IsapiFileList.GetSize() > 0;
-}
-
-void DoThreads() {
-
- if (IsapiFileList.GetSize() == 0) {
- printf("No Files to test\n");
- return;
- }
-
- printf("Starting Threads...\n");
- // loop creating threads
- DWORD tid;
- HANDLE threads[NUM_THREADS];
- for (DWORD i=0; i< NUM_THREADS; i++) {
- threads[i]=CreateThread(NULL, 0, IsapiThread, NULL, CREATE_SUSPENDED, &tid);
- }
- for (i=0; i< NUM_THREADS; i++) {
- if (threads[i]) ResumeThread(threads[i]);
- }
- // wait for threads to finish
- WaitForMultipleObjects(NUM_THREADS, threads, TRUE, INFINITE);
-}
-
-void DoFileList(const char *filelist, const char *environment)
-{
- // read config files
-
- if (!ReadFileList(filelist)) {
- printf("No Files to test!\r\n");
- return;
- }
-
- ReadGlobalEnvironment(environment);
-
- DoThreads();
-}
-
-
-/**
- * ParseTestFile
- * parse a single phpt file and add it to the arrays
- */
-BOOL ParseTestFile(const char *path, const char *fn)
-{
- // parse the test file
- char filename[MAX_PATH];
- _snprintf(filename, sizeof(filename)-1, "%s\\%s", path, fn);
- char line[1024];
- memset(line, 0, sizeof(line));
- CString cTest, cSkipIf, cPost, cGet, cFile, cExpect;
- printf("Reading %s\r\n", filename);
-
- enum state {none, test, skipif, post, get, file, expect} parsestate = none;
-
- FILE *fp = fopen(filename, "r");
- char *tn = _tempnam(temppath,"pht.");
- char *en = _tempnam(temppath,"exp.");
- FILE *ft = fopen(tn, "w+");
- FILE *fe = fopen(en, "w+");
- if (fp && ft && fe) {
- while (fgets(line,sizeof(line)-1,fp)) {
- if (line[0]=='-') {
- if (_strnicmp(line, "--TEST--", 8)==0) {
- parsestate = test;
- continue;
- } else if (_strnicmp(line, "--SKIPIF--", 10)==0) {
- parsestate = skipif;
- continue;
- } else if (_strnicmp(line, "--POST--", 8)==0) {
- parsestate = post;
- continue;
- } else if (_strnicmp(line, "--GET--", 7)==0) {
- parsestate = get;
- continue;
- } else if (_strnicmp(line, "--FILE--", 8)==0) {
- parsestate = file;
- continue;
- } else if (_strnicmp(line, "--EXPECT--", 10)==0) {
- parsestate = expect;
- continue;
- }
- }
- switch (parsestate) {
- case test:
- stripcrlf(line);
- cTest = line;
- break;
- case skipif:
- cSkipIf += line;
- break;
- case post:
- cPost += line;
- break;
- case get:
- cGet += line;
- break;
- case file:
- fputs(line, ft);
- break;
- case expect:
- fputs(line, fe);
- break;
- }
- }
-
- fclose(fp);
- fclose(ft);
- fclose(fe);
-
- if (!cTest.IsEmpty()) {
- IsapiFileList.Add(tn);
- TestNames.Add(cTest);
- IsapiGetData.Add(cGet);
- IsapiPostData.Add(cPost);
- IsapiMatchData.Add(en);
- return TRUE;
- }
- }
- return FALSE;
-}
-
-
-/**
- * GetTestFiles
- * Recurse through the path and subdirectories, parse each phpt file
- */
-BOOL GetTestFiles(const char *path)
-{
- // find all files .phpt under testpath\tests
- char FindPath[MAX_PATH];
- WIN32_FIND_DATA fd;
- memset(&fd, 0, sizeof(WIN32_FIND_DATA));
-
- _snprintf(FindPath, sizeof(FindPath)-1, "%s\\*.*",path);
- HANDLE fh = FindFirstFile(FindPath, &fd);
- if (fh != INVALID_HANDLE_VALUE) {
- do {
- if ((fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) &&
- !strchr(fd.cFileName, '.')) {
- // subdirectory, recurse into it
- char NewFindPath[MAX_PATH];
- _snprintf(NewFindPath, sizeof(NewFindPath)-1, "%s\\%s",path, fd.cFileName);
- GetTestFiles(NewFindPath);
- } else if (strstr(fd.cFileName, ".phpt")) {
- // got test file, parse it now
- if (ParseTestFile(path, fd.cFileName)) {
- printf("Test File Added: %s\\%s\r\n", path, fd.cFileName);
- }
- }
- memset(&fd, 0, sizeof(WIN32_FIND_DATA));
- } while (FindNextFile(fh, &fd) != 0);
- FindClose(fh);
- }
- return IsapiFileList.GetSize() > 0;
-}
-
-void DeleteTempFiles(const char *mask)
-{
- char FindPath[MAX_PATH];
- WIN32_FIND_DATA fd;
- memset(&fd, 0, sizeof(WIN32_FIND_DATA));
-
- _snprintf(FindPath, sizeof(FindPath)-1, "%s\\%s",temppath, mask);
- HANDLE fh = FindFirstFile(FindPath, &fd);
- if (fh != INVALID_HANDLE_VALUE) {
- do {
- char NewFindPath[MAX_PATH];
- _snprintf(NewFindPath, sizeof(NewFindPath)-1, "%s\\%s",temppath, fd.cFileName);
- DeleteFile(NewFindPath);
- memset(&fd, 0, sizeof(WIN32_FIND_DATA));
- } while (FindNextFile(fh, &fd) != 0);
- FindClose(fh);
- }
-}
-
-void DoTestFiles(const char *filelist, const char *environment)
-{
- if (!GetTestFiles(filelist)) {
- printf("No Files to test!\r\n");
- return;
- }
-
- Results.SetSize(IsapiFileList.GetSize());
-
- ReadGlobalEnvironment(environment);
-
- DoThreads();
-
- printf("\r\nRESULTS:\r\n");
- // show results:
- DWORD r = Results.GetSize();
- for (DWORD i=0; i< r; i++) {
- TResults result = Results.GetAt(i);
- printf("%s\r\nOK: %d FAILED: %d\r\n", TestNames.GetAt(i), result.ok, result.bad);
- }
-
- // delete temp files
- printf("Deleting Temp Files\r\n");
- DeleteTempFiles("exp.*");
- DeleteTempFiles("pht.*");
- printf("Done\r\n");
-}
-
-int main(int argc, char* argv[])
-{
- LPVOID lpMsgBuf;
- char *filelist=NULL, *environment=NULL;
-
- if (argc < 3) {
- // look for phpt files in tests
- printf("USAGE: stresstest [L|T] filelist [environment]\r\n");
- return 0;
- } else {
- if (argv[1][0]=='T') bUseTestFiles = TRUE;
- if (argc > 1) filelist = argv[2];
- if (argc > 2) environment = argv[3];
- }
-
- GetTempPath(sizeof(temppath), temppath);
- hDll = LoadLibrary("php4isapi.dll"); // Load our DLL
-
- if (!hDll) {
- FormatMessage(
- FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
- NULL,
- GetLastError(),
- MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
- (LPTSTR) &lpMsgBuf,
- 0,
- NULL
- );
- fprintf(stderr,"Error: Dll 'php4isapi.dll' not found -%d\n%s\n", GetLastError(),lpMsgBuf);
- LocalFree( lpMsgBuf );
- return -1;
- }
-
- //
- // Find the exported functions
-
- IsapiGetExtensionVersion = (VersionProc)GetProcAddress(hDll,"GetExtensionVersion");
- if (!IsapiGetExtensionVersion) {
- fprintf(stderr,"Can't Get Extension Version %d\n",GetLastError());
- return -1;
- }
- IsapiHttpExtensionProc = (HttpExtProc)GetProcAddress(hDll,"HttpExtensionProc");
- if (!IsapiHttpExtensionProc) {
- fprintf(stderr,"Can't Get Extension proc %d\n",GetLastError());
- return -1;
- }
-
- // This should really check if the version information matches what we
- // expect.
- //
- if (!IsapiGetExtensionVersion(&version_info) ) {
- fprintf(stderr,"Fatal: GetExtensionVersion failed\n");
- return -1;
- }
-
- if (bUseTestFiles) {
- char TestPath[MAX_PATH];
- if (filelist != NULL)
- _snprintf(TestPath, sizeof(TestPath)-1, "%s\\tests", filelist);
- else strcpy(TestPath, "tests");
- DoTestFiles(TestPath, environment);
- } else {
- DoFileList(filelist, environment);
- }
-
- // cleanup
-
-
- // We should really free memory (e.g., from GetEnv), but we'll be dead
- // soon enough
-
- FreeLibrary(hDll);
- return 0;
-}
-
-
-DWORD CALLBACK IsapiThread(void *p)
-{
- DWORD filecount = IsapiFileList.GetSize();
-
- for (DWORD j=0; j<ITERATIONS; j++) {
- for (DWORD i=0; i<filecount; i++) {
- // execute each file
- CString testname = TestNames.GetAt(i);
- BOOL ok = FALSE;
- if (stress_main(IsapiFileList.GetAt(i),
- IsapiGetData.GetAt(i),
- IsapiPostData.GetAt(i),
- IsapiMatchData.GetAt(i))) {
- InterlockedIncrement(&Results[i].ok);
- ok = TRUE;
- } else {
- InterlockedIncrement(&Results[i].bad);
- ok = FALSE;
- }
-
- if (testname.IsEmpty()) {
- printf("Thread %d File %s\n", GetCurrentThreadId(), IsapiFileList.GetAt(i));
- } else {
- printf("tid %d: %s %s\n", GetCurrentThreadId(), testname, ok?"OK":"FAIL");
- }
- Sleep(10);
- }
- }
- printf("Thread ending...\n");
- return 0;
-}
-
-/*
- * ======================================================================= *
- * In the startup of this program, we look at our executable name and *
- * replace the ".EXE" with ".DLL" to find the ISAPI DLL we need to load. *
- * This means that the executable need only be given the same "name" as *
- * the DLL to load. There is no recompilation required. *
- * ======================================================================= *
-*/
-BOOL stress_main(const char *filename,
- const char *arg,
- const char *postdata,
- const char *matchdata)
-{
-
- EXTENSION_CONTROL_BLOCK ECB;
- DWORD rc;
- TIsapiContext context;
-
- // open output and input files
- context.tid = GetCurrentThreadId();
- CString fname;
- fname.Format("%08X.out", context.tid);
-
- context.out = CreateFile(fname, GENERIC_WRITE, FILE_SHARE_READ, NULL, CREATE_ALWAYS, 0, NULL);
- if (context.out==INVALID_HANDLE_VALUE) {
- printf("failed to open output file %s\n", fname);
- return 0;
- }
-
- // not using post files
- context.in = INVALID_HANDLE_VALUE;
-
- //
- // Fill the ECB with the necessary information
- //
- if (!FillExtensionControlBlock(&ECB, &context) ) {
- fprintf(stderr,"Fill Ext Block Failed\n");
- return -1;
- }
-
- // check for command line argument,
- // first arg = filename
- // this is added for testing php from command line
-
- context.env.RemoveAll();
- context.env["PATH_TRANSLATED"]= filename;
- context.env["SCRIPT_MAP"]= filename;
- context.env["CONTENT_TYPE"]= "";
- context.env["CONTENT_LENGTH"]= "";
- context.env["QUERY_STRING"]= arg;
- context.env["METHOD"]="GET";
-
- char buf[MAX_PATH];
- if (postdata && *postdata !=0) {
- ECB.cbAvailable = strlen(postdata);
- ECB.cbTotalBytes = ECB.cbAvailable;
- ECB.lpbData = (unsigned char *)postdata;
- context.env["METHOD"]="POST";
-
- _snprintf(buf, sizeof(buf)-1, "%d", ECB.cbTotalBytes);
- context.env["CONTENT_LENGTH"]=buf;
-
- context.env["CONTENT_TYPE"]="application/x-www-form-urlencoded";
- }
- ECB.lpszPathTranslated = strdup(filename);
- ECB.lpszQueryString = strdup(arg);
-
- // Call the DLL
- //
- rc = IsapiHttpExtensionProc(&ECB);
-
- free(ECB.lpszPathTranslated);
- free(ECB.lpszQueryString);
-
- BOOL ok = TRUE;
-
- if (context.out != INVALID_HANDLE_VALUE) CloseHandle(context.out);
-
- // compare the output with the EXPECT section
- if (matchdata && *matchdata != 0) {
- ok = CompareStringWithFile(fname, matchdata, strlen(matchdata));
- }
-
- DeleteFile(fname);
- //if (rc == HSE_STATUS_PENDING) // We will exit in ServerSupportFunction
- // Sleep(INFINITE);
-
- return ok;
-
-}
-//
-// GetServerVariable() is how the DLL calls the main program to figure out
-// the environment variables it needs. This is a required function.
-//
-BOOL WINAPI GetServerVariable(HCONN hConn, LPSTR lpszVariableName,
- LPVOID lpBuffer, LPDWORD lpdwSize){
-
- DWORD rc;
- CString value;
- TIsapiContext *c = (TIsapiContext *)hConn;
- if (!c) return FALSE;
-
- if (IsapiEnvironment.Lookup(lpszVariableName, value)) {
- rc = value.GetLength();
- strncpy((char *)lpBuffer, value, *lpdwSize-1);
- } else if (c->env.Lookup(lpszVariableName, value)) {
- rc = value.GetLength();
- strncpy((char *)lpBuffer, value, *lpdwSize-1);
- } else
- rc = GetEnvironmentVariable(lpszVariableName,(char *)lpBuffer,*lpdwSize) ;
-
- if (!rc) { // return of 0 indicates the variable was not found
- SetLastError(ERROR_NO_DATA);
- return FALSE;
- }
-
- if (rc > *lpdwSize) {
- SetLastError(ERROR_INSUFFICIENT_BUFFER);
- return FALSE;
- }
-
- *lpdwSize =rc + 1 ; // GetEnvironmentVariable does not count the NULL
-
- return TRUE;
-
-}
-//
-// Again, we don't have an HCONN, so we simply wrap ReadClient() to
-// ReadFile on stdin. The semantics of the two functions are the same
-//
-BOOL WINAPI ReadClient(HCONN hConn, LPVOID lpBuffer, LPDWORD lpdwSize) {
- TIsapiContext *c = (TIsapiContext *)hConn;
- if (!c) return FALSE;
-
- if (c->in != INVALID_HANDLE_VALUE)
- return ReadFile(c->in,lpBuffer,(*lpdwSize), lpdwSize,NULL);
-
- return FALSE;
-}
-//
-// ditto for WriteClient()
-//
-BOOL WINAPI WriteClient(HCONN hConn, LPVOID lpBuffer, LPDWORD lpdwSize,
- DWORD dwReserved) {
- TIsapiContext *c = (TIsapiContext *)hConn;
- if (!c) return FALSE;
-
- if (c->out != INVALID_HANDLE_VALUE)
- return WriteFile(c->out,lpBuffer,*lpdwSize, lpdwSize,NULL);
-
- return FALSE;
-}
-//
-// This is a special callback function used by the DLL for certain extra
-// functionality. Look at the API help for details.
-//
-BOOL WINAPI ServerSupportFunction(HCONN hConn, DWORD dwHSERequest,
- LPVOID lpvBuffer, LPDWORD lpdwSize, LPDWORD lpdwDataType){
-
- char *lpszRespBuf;
- char * temp = NULL;
- DWORD dwBytes;
- BOOL bRet;
-
- switch(dwHSERequest) {
- case (HSE_REQ_SEND_RESPONSE_HEADER) :
- lpszRespBuf = (char *)xmalloc(*lpdwSize);//+ 80);//accomodate our header
- if (!lpszRespBuf)
- return FALSE;
- wsprintf(lpszRespBuf,"%s",
- //HTTP_VER,
-
- /* Default response is 200 Ok */
-
- //lpvBuffer?lpvBuffer:"200 Ok",
-
- /* Create a string for the time. */
- //temp=MakeDateStr(),
-
- //SERVER_VERSION,
-
- /* If this exists, it is a pointer to a data buffer to
- be sent. */
- lpdwDataType?(char *)lpdwDataType:NULL);
-
- if (temp) xfree(temp);
-
- dwBytes = strlen(lpszRespBuf);
- bRet = WriteClient(0,lpszRespBuf,&dwBytes,0);
- xfree(lpszRespBuf);
-
- break;
- //
- // A real server would do cleanup here
- case (HSE_REQ_DONE_WITH_SESSION):
- //ExitThread(0);
- break;
-
- //
- // This sends a redirect (temporary) to the client.
- // The header construction is similar to RESPONSE_HEADER above.
- //
- case (HSE_REQ_SEND_URL_REDIRECT_RESP):
- lpszRespBuf = (char *)xmalloc(*lpdwSize +80) ;
- if (!lpszRespBuf)
- return FALSE;
- wsprintf(lpszRespBuf,"%s %s %s\r\n",
- HTTP_VER,
- "302 Moved Temporarily",
- (lpdwSize > 0)?lpvBuffer:0);
- xfree(temp);
- dwBytes = strlen(lpszRespBuf);
- bRet = WriteClient(0,lpszRespBuf,&dwBytes,0);
- xfree(lpszRespBuf);
- break;
- default:
- return FALSE;
- break;
- }
- return bRet;
-
-}
-//
-// Makes a string of the date and time from GetSystemTime().
-// This is in UTC, as required by the HTTP spec.`
-//
-char * MakeDateStr(void){
- SYSTEMTIME systime;
- char *szDate= (char *)xmalloc(64);
-
- char * DaysofWeek[] = {"Sun","Mon","Tue","Wed","Thurs","Fri","Sat"};
- char * Months[] = {"NULL","Jan","Feb","Mar","Apr","May","Jun","Jul","Aug",
- "Sep","Oct","Nov","Dec"};
-
- GetSystemTime(&systime);
-
- wsprintf(szDate,"%s, %d %s %d %d:%d.%d",DaysofWeek[systime.wDayOfWeek],
- systime.wDay,
- Months[systime.wMonth],
- systime.wYear,
- systime.wHour,systime.wMinute,
- systime.wSecond );
-
- return szDate;
-}
-//
-// Fill the ECB up
-//
-BOOL WINAPI FillExtensionControlBlock(EXTENSION_CONTROL_BLOCK *ECB, TIsapiContext *context) {
-
- char * temp;
- ECB->cbSize = sizeof(EXTENSION_CONTROL_BLOCK);
- ECB->dwVersion = MAKELONG(HSE_VERSION_MINOR,HSE_VERSION_MAJOR);
- ECB->ConnID = (void *)context;
- //
- // Pointers to the functions the DLL will call.
- //
- ECB->GetServerVariable = GetServerVariable;
- ECB->ReadClient = ReadClient;
- ECB->WriteClient = WriteClient;
- ECB->ServerSupportFunction = ServerSupportFunction;
-
- //
- // Fill in the standard CGI environment variables
- //
- ECB->lpszMethod = GetEnv("REQUEST_METHOD");
- if (!ECB->lpszMethod) ECB->lpszMethod = "GET";
-
- ECB->lpszQueryString = GetEnv("QUERY_STRING");
- ECB->lpszPathInfo = GetEnv("PATH_INFO");
- ECB->lpszPathTranslated = GetEnv("PATH_TRANSLATED");
- ECB->cbTotalBytes=( (temp=GetEnv("CONTENT_LENGTH")) ? (atoi(temp)): 0);
- ECB->cbAvailable = 0;
- ECB->lpbData = (unsigned char *)"";
- ECB->lpszContentType = GetEnv("CONTENT_TYPE");
- return TRUE;
-
-}
-
-//
-// Works like _getenv(), but uses win32 functions instead.
-//
-char * GetEnv(LPSTR lpszEnvVar) {
-
- char *var,dummy;
- DWORD dwLen;
-
- if (!lpszEnvVar)
- return "";
-
- dwLen =GetEnvironmentVariable(lpszEnvVar,&dummy,1);
-
- if (dwLen == 0)
- return "";
-
- var = (char *)xmalloc(dwLen);
- if (!var)
- return "";
- (void)GetEnvironmentVariable(lpszEnvVar,var,dwLen);
-
- return var;
-}
diff --git a/sapi/isapi/stresstest/stresstest.dsp b/sapi/isapi/stresstest/stresstest.dsp
deleted file mode 100644
index 6099dc4aea..0000000000
--- a/sapi/isapi/stresstest/stresstest.dsp
+++ /dev/null
@@ -1,99 +0,0 @@
-# Microsoft Developer Studio Project File - Name="stresstest" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=stresstest - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "stresstest.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "stresstest.mak" CFG="stresstest - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "stresstest - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "stresstest - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "stresstest - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 2
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "_AFXDLL" /FD /c
-# SUBTRACT CPP /YX /Yc /Yu
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG" /d "_AFXDLL"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 /nologo /subsystem:console /machine:I386
-
-!ELSEIF "$(CFG)" == "stresstest - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 2
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "_AFXDLL" /FD /GZ /c
-# SUBTRACT CPP /YX /Yc /Yu
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG" /d "_AFXDLL"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-
-!ENDIF
-
-# Begin Target
-
-# Name "stresstest - Win32 Release"
-# Name "stresstest - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\stresstest.cpp
-# End Source File
-# End Group
-# Begin Source File
-
-SOURCE=.\notes.txt
-# End Source File
-# End Target
-# End Project
diff --git a/sapi/nsapi/CREDITS b/sapi/nsapi/CREDITS
deleted file mode 100644
index c41a7bf583..0000000000
--- a/sapi/nsapi/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-NSAPI
-Jayakumar Muthukumarasamy
diff --git a/sapi/nsapi/Makefile.in b/sapi/nsapi/Makefile.in
deleted file mode 100644
index 8299911313..0000000000
--- a/sapi/nsapi/Makefile.in
+++ /dev/null
@@ -1,5 +0,0 @@
-
-LTLIBRARY_NAME = libsapi.la
-LTLIBRARY_SOURCES = nsapi.c
-
-include $(top_srcdir)/build/ltlib.mk
diff --git a/sapi/nsapi/config.m4 b/sapi/nsapi/config.m4
deleted file mode 100644
index b03ed8b524..0000000000
--- a/sapi/nsapi/config.m4
+++ /dev/null
@@ -1,37 +0,0 @@
-dnl ## $Id$ -*- sh -*-
-
-AC_MSG_CHECKING(for NSAPI support)
-AC_ARG_WITH(nsapi,
-[ --with-nsapi=DIR Specify path to the installed Netscape],[
- PHP_NSAPI=$withval
-],[
- PHP_NSAPI=no
-])
-AC_MSG_RESULT($PHP_NSAPI)
-
-if test "$PHP_NSAPI" != "no"; then
- if test ! -d $PHP_NSAPI/bin ; then
- AC_MSG_ERROR(Please specify the path to the root of your Netscape server using --with-nsapi=DIR)
- fi
- AC_MSG_CHECKING(for NSAPI include files)
- if test -d $PHP_NSAPI/include ; then
- NSAPI_INCLUDE=$PHP_NSAPI/include
- AC_MSG_RESULT(Netscape-Enterprise/3.x style)
- elif test -d $PHP_NSAPI/plugins/include ; then
- NSAPI_INCLUDE=$PHP_NSAPI/plugins/include
- AC_MSG_RESULT(iPlanet/4.x style)
- else
- AC_MSG_ERROR(Please check you have nsapi.h in either DIR/include or DIR/plugins/include)
- fi
- PHP_ADD_INCLUDE($NSAPI_INCLUDE)
- PHP_BUILD_THREAD_SAFE
- AC_DEFINE(HAVE_NSAPI,1,[Whether you have a Netscape Server])
- PHP_SAPI=nsapi
- PHP_BUILD_SHARED
- INSTALL_IT="\$(INSTALL) -m 0755 $SAPI_SHARED \$(INSTALL_ROOT)$PHP_NSAPI/bin/"
-fi
-
-
-dnl ## Local Variables:
-dnl ## tab-width: 4
-dnl ## End:
diff --git a/sapi/nsapi/nsapi-readme.txt b/sapi/nsapi/nsapi-readme.txt
deleted file mode 100644
index 2862a44e02..0000000000
--- a/sapi/nsapi/nsapi-readme.txt
+++ /dev/null
@@ -1,65 +0,0 @@
-Configuration of your Netscape or iPlanet Web Server for PHP4
--------------------------------------------------------------
-
-These instructions are targetted at Netscape Enterprise Web Server
-and SUN/Netscape Alliance iPlanet Web Server. On other web servers
-your milage may vary.
-
-Firstly you may need to add some paths to the LD_LIBRARY_PATH
-environment for netscape to find all the shared libs. This is
-best done in the start script for your netscape server.
-Windows users can probably skip this step. The start
-script is located in:
-<path-to-netscape-server>/https-servername/start
-
-netscape config files are located in:
-<path-to-netscape-server>/https-servername/config
-
-add the following line to mime.types
-
-type=magnus-internal/x-httpd-php exts=php
-
-
-Add the following to obj.conf, shlib will vary depending on your OS, for unix it
-will be something like "<path-to-netscape-server>/bin/libphp4.so".
-
-#note place following two lines after mime types init!
-Init fn="load-modules" funcs="php4_init,php4_close,php4_execute,php4_auth_trans" shlib="/php4/nsapiPHP4.dll"
-Init fn=php4_init errorString="Failed to initialize PHP!"
-
-<Object name="default">
-.
-.
-.
-.#NOTE this next line should happen after all 'ObjectType' and before all 'AddLog' lines
-Service fn="php4_execute" type="magnus-internal/x-httpd-php"
-.
-.
-</Object>
-
-
-<Object name="x-httpd-php">
-ObjectType fn="force-type" type="magnus-internal/x-httpd-php"
-Service fn=php4_execute
-</Object>
-
-
-Authentication configuration
-
-PHP authentication cannot be used with any other authentication. ALL AUTHENTICATION IS
-PASSED TO YOUR PHP SCRIPT. To configure PHP Authentication for the entire server, add
-the following line:
-
-<Object name="default">
-AuthTrans fn=php4_auth_trans
-.
-.
-.
-.
-</Object>
-
-To use PHP Authentication on a single directory, add the following:
-
-<Object ppath="d:\path\to\authenticated\dir\*">
-AuthTrans fn=php4_auth_trans
-</Object>
diff --git a/sapi/nsapi/nsapi.c b/sapi/nsapi/nsapi.c
deleted file mode 100644
index 8a57ff41e5..0000000000
--- a/sapi/nsapi/nsapi.c
+++ /dev/null
@@ -1,549 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Jayakumar Muthukumarasamy <jk@kasenna.com> |
- +----------------------------------------------------------------------+
-*/
-
-/*
- * PHP includes
- */
-#define NSAPI 1
-
-#include "php.h"
-#include "php_variables.h"
-#include "ext/standard/info.h"
-#include "php_ini.h"
-#include "php_globals.h"
-#include "SAPI.h"
-#include "php_main.h"
-#include "php_version.h"
-#include "TSRM.h"
-#include "ext/standard/php_standard.h"
-
-/*
- * If neither XP_UNIX not XP_WIN32 is defined, try to guess which one.
- * Ideally, this should be done by the configure script.
- */
-#if !defined(XP_UNIX) && !defined(XP_WIN32)
- #if defined(WIN32)
- #define XP_WIN32
- #else
- #define XP_UNIX
- #endif
-#endif
-
-/*
- * NSAPI includes
- */
-#include "nsapi.h"
-#include "base/pblock.h"
-#include "base/session.h"
-#include "frame/req.h"
-#include "frame/protocol.h" /* protocol_start_response */
-#include "base/util.h" /* is_mozilla, getline */
-#include "frame/log.h" /* log_error */
-
-/*
- * Timeout for net_read(). This should probably go into php.ini
- */
-#define NSAPI_READ_TIMEOUT 60 /* 60 seconds */
-
-#define NSLS_D struct nsapi_request_context *request_context
-#define NSLS_DC , NSLS_D
-#define NSLS_C request_context
-#define NSLS_CC , NSLS_C
-#define NSG(v) (request_context->v)
-
-/*
- * ZTS needs to be defined for NSAPI to work
- */
-#if !defined(ZTS)
- #error "NSAPI module needs ZTS to be defined"
-#endif
-
-/*
- * Structure to encapsulate the NSAPI request in SAPI
- */
-typedef struct nsapi_request_context {
- pblock *pb;
- Session *sn;
- Request *rq;
- int read_post_bytes;
-} nsapi_request_context;
-
-/*
- * Mappings between NSAPI names and environment variables. This
- * mapping was obtained from the sample programs at the iplanet
- * website.
- */
-typedef struct nsapi_equiv {
- const char *env_var;
- const char *nsapi_eq;
-} nsapi_equiv;
-
-static nsapi_equiv nsapi_headers[] = {
- { "CONTENT_LENGTH", "content-length" },
- { "CONTENT_TYPE", "content-type" },
- { "HTTP_ACCEPT", "accept" },
- { "HTTP_ACCEPT_ENCODING", "accept-encoding" },
- { "HTTP_ACCEPT_LANGUAGE", "accept-language" },
- { "HTTP_ACCEPT_CHARSET", "accept-charset" },
- { "HTTP_AUTHORIZATION", "authorization" },
- { "HTTP_COOKIE", "cookie" },
- { "HTTP_IF_MODIFIED_SINCE", "if-modified-since" },
- { "HTTP_REFERER", "referer" },
- { "HTTP_USER_AGENT", "user-agent" },
- { "HTTP_USER_DEFINED", "user-defined" }
-};
-static size_t nsapi_headers_size = sizeof(nsapi_headers)/sizeof(nsapi_headers[0]);
-
-static nsapi_equiv nsapi_reqpb[] = {
- { "QUERY_STRING", "query" },
- { "REQUEST_LINE", "clf-request" },
- { "REQUEST_METHOD", "method" },
- { "SCRIPT_NAME", "uri" },
- { "SERVER_PROTOCOL", "protocol" }
-};
-static size_t nsapi_reqpb_size = sizeof(nsapi_reqpb)/sizeof(nsapi_reqpb[0]);
-
-static nsapi_equiv nsapi_vars[] = {
- { "PATH_INFO", "path-info" },
- { "PATH_TRANSLATED", "path" },
- { "AUTH_TYPE", "auth-type" },
- { "CLIENT_CERT", "auth-cert" },
- { "REMOTE_USER", "auth-user" }
-};
-static size_t nsapi_vars_size = sizeof(nsapi_vars)/sizeof(nsapi_vars[0]);
-
-static nsapi_equiv nsapi_client[] = {
- { "HTTPS_KEYSIZE", "keysize" },
- { "HTTPS_SECRETSIZE", "secret-keysize" },
- { "REMOTE_ADDR", "ip" }
-};
-static size_t nsapi_client_size = sizeof(nsapi_client)/sizeof(nsapi_client[0]);
-
-static int
-sapi_nsapi_ub_write(const char *str, unsigned int str_length)
-{
- int retval;
- nsapi_request_context *rc;
-
- SLS_FETCH();
- rc = (nsapi_request_context *)SG(server_context);
- retval = net_write(rc->sn->csd, (char *)str, str_length);
- if (retval == IO_ERROR /*-1*/ || retval == IO_EOF /*0*/)
- php_handle_aborted_connection();
- return retval;
-}
-
-static int
-sapi_nsapi_header_handler(sapi_header_struct *sapi_header, sapi_headers_struct *sapi_headers SLS_DC)
-{
- char *header_name, *header_content, *p;
- nsapi_request_context *rc = (nsapi_request_context *)SG(server_context);
-
- header_name = sapi_header->header;
- header_content = p = strchr(header_name, ':');
- if (p == NULL) {
- return 0;
- }
-
- *p = 0;
- do {
- header_content++;
- } while (*header_content==' ');
-
- if (!strcasecmp(header_name, "Content-Type")) {
- param_free(pblock_remove("content-type", rc->rq->srvhdrs));
- pblock_nvinsert("content-type", header_content, rc->rq->srvhdrs);
- } else if (!strcasecmp(header_name, "Set-Cookie")) {
- pblock_nvinsert("set-cookie", header_content, rc->rq->srvhdrs);
- } else {
- pblock_nvinsert(header_name, header_content, rc->rq->srvhdrs);
- }
-
- *p = ':'; /* restore '*p' */
-
- efree(sapi_header->header);
-
- return 0; /* don't use the default SAPI mechanism, NSAPI duplicates this functionality */
-}
-
-static int
-sapi_nsapi_send_headers(sapi_headers_struct *sapi_headers SLS_DC)
-{
- int retval;
- nsapi_request_context *rc = (nsapi_request_context *)SG(server_context);
-
- /*
- * We could probably just do this in the header_handler. But, I
- * don't know what the implication of doing it there is.
- */
- if (SG(sapi_headers).send_default_content_type) {
- param_free(pblock_remove("content-type", rc->rq->srvhdrs));
- pblock_nvinsert("content-type", "text/html", rc->rq->srvhdrs);
- }
-
- protocol_status(rc->sn, rc->rq, SG(sapi_headers).http_response_code, NULL);
- retval = protocol_start_response(rc->sn, rc->rq);
- if (retval == REQ_PROCEED || retval == REQ_NOACTION)
- return SAPI_HEADER_SENT_SUCCESSFULLY;
- else
- return SAPI_HEADER_SEND_FAILED;
-}
-
-static int
-sapi_nsapi_read_post(char *buffer, uint count_bytes SLS_DC)
-{
- nsapi_request_context *rc = (nsapi_request_context *)SG(server_context);
- char *read_ptr = buffer, *content_length_str = NULL;
- uint bytes_read = 0;
- int length, content_length = 0;
- netbuf *nbuf = rc->sn->inbuf;
-
- /*
- * Yesss!
- */
- count_bytes = MIN(count_bytes, SG(request_info).content_length-rc->read_post_bytes);
- content_length = SG(request_info).content_length;
-
-#if 0
- /*
- * Determine the content-length. This will tell us the limit we can read.
- */
- content_length_str = pblock_findval("content-length", rc->rq->headers);
- if (content_length_str != NULL) {
- content_length = strtol(content_length_str, 0, 0);
- }
-#endif
-
- if (content_length <= 0)
- return 0;
-
- /*
- * Gobble any pending data in the netbuf.
- */
- length = nbuf->cursize - nbuf->pos;
- length = MIN(count_bytes, length);
- if (length > 0) {
- memcpy(read_ptr, nbuf->inbuf + nbuf->pos, length);
- bytes_read += length;
- read_ptr += length;
- content_length -= length;
- nbuf->pos += length;
- }
-
- /*
- * Read the remaining from the socket.
- */
- while (content_length > 0 && bytes_read < count_bytes) {
- int bytes_to_read = count_bytes - bytes_read;
- if (content_length < bytes_to_read)
- bytes_to_read = content_length;
-
- length = net_read(rc->sn->csd, read_ptr, bytes_to_read, NSAPI_READ_TIMEOUT);
- if (length == IO_ERROR || length == IO_EOF)
- break;
-
- bytes_read += length;
- read_ptr += length;
- content_length -= length;
- }
-
- if ( bytes_read > 0 )
- rc->read_post_bytes += bytes_read;
- return bytes_read;
-}
-
-static char *
-sapi_nsapi_read_cookies(SLS_D)
-{
- char *cookie_string;
- nsapi_request_context *rc = (nsapi_request_context *)SG(server_context);
-
- cookie_string = pblock_findval("cookie", rc->rq->headers);
- return cookie_string;
-}
-
-static void
-sapi_nsapi_register_server_variables(zval *track_vars_array ELS_DC SLS_DC PLS_DC)
-{
- nsapi_request_context *rc = (nsapi_request_context *)SG(server_context);
- size_t i;
- char *value;
- char buf[128];
-
- for (i = 0; i < nsapi_reqpb_size; i++) {
- value = pblock_findval(nsapi_reqpb[i].nsapi_eq, rc->rq->reqpb);
- if (value) {
- php_register_variable( (char *)nsapi_reqpb[i].env_var, value, track_vars_array ELS_CC PLS_CC );
- }
- }
-
- for (i = 0; i < nsapi_headers_size; i++) {
- value = pblock_findval(nsapi_headers[i].nsapi_eq, rc->rq->headers);
- if (value) {
- php_register_variable( (char *)nsapi_headers[i].env_var, value, track_vars_array ELS_CC PLS_CC );
- }
- }
-
- for (i = 0; i < nsapi_vars_size; i++) {
- value = pblock_findval(nsapi_vars[i].nsapi_eq, rc->rq->vars);
- if (value) {
- php_register_variable( (char *)nsapi_vars[i].env_var, value, track_vars_array ELS_CC PLS_CC );
- }
- }
-
- for (i = 0; i < nsapi_client_size; i++) {
- value = pblock_findval(nsapi_client[i].nsapi_eq, rc->sn->client);
- if (value) {
- php_register_variable( (char *)nsapi_client[i].env_var, value, track_vars_array ELS_CC PLS_CC );
- }
- }
-
- value = session_dns(rc->sn);
- if (value) {
- php_register_variable("REMOTE_HOST", value, track_vars_array ELS_CC PLS_CC );
- }
- sprintf(buf, "%d", conf_getglobals()->Vport);
- php_register_variable("SERVER_PORT", buf, track_vars_array ELS_CC PLS_CC );
- php_register_variable("SERVER_NAME", util_hostname(), track_vars_array ELS_CC PLS_CC );
- php_register_variable("SERVER_URL", http_uri2url("", ""), track_vars_array ELS_CC PLS_CC );
- php_register_variable("HTTPS", (security_active ? "ON" : "OFF"), track_vars_array ELS_CC PLS_CC );
-/* php_register_variable("SERVER_SOFTWARE", MAGNUS_VERSION_STRING, track_vars_array ELS_CC PLS_CC ); */
-
- /*
- * Special PHP_SELF variable.
- */
- value = pblock_findval("uri", rc->rq->reqpb);
- if ( value != NULL ) {
- php_register_variable("PHP_SELF", value, track_vars_array ELS_CC PLS_CC );
- }
-}
-
-static void
-nsapi_log_message(char *message)
-{
- SLS_FETCH();
- nsapi_request_context *rc = (nsapi_request_context *)SG(server_context);
- log_error(LOG_INFORM, "PHP_log_message", rc->sn, rc->rq,
- "%s", message);
-}
-
-
-static sapi_module_struct nsapi_sapi_module = {
- "nsapi", /* name */
- "NSAPI", /* pretty name */
-
- php_module_startup, /* startup */
- php_module_shutdown_wrapper, /* shutdown */
-
- NULL, /* activate */
- NULL, /* deactivate */
-
- sapi_nsapi_ub_write, /* unbuffered write */
- NULL, /* flush */
- NULL, /* get uid */
- NULL, /* getenv */
-
- php_error, /* error handler */
-
- sapi_nsapi_header_handler, /* header handler */
- sapi_nsapi_send_headers, /* send headers handler */
- NULL, /* send header handler */
-
- sapi_nsapi_read_post, /* read POST data */
- sapi_nsapi_read_cookies, /* read Cookies */
-
- sapi_nsapi_register_server_variables, /* register server variables */
- nsapi_log_message, /* Log message */
-
- NULL, /* Block interruptions */
- NULL, /* Unblock interruptions */
-
- STANDARD_SAPI_MODULE_PROPERTIES
-};
-
-static char *
-nsapi_strdup(char *str)
-{
- if (str != NULL)
- return STRDUP(str);
- return NULL;
-}
-
-static void
-nsapi_free(void *addr)
-{
- if (addr != NULL)
- FREE(addr);
-}
-
-static void
-nsapi_request_ctor(NSLS_D SLS_DC)
-{
- char *query_string = pblock_findval("query", NSG(rq)->reqpb);
- char *uri = pblock_findval("uri", NSG(rq)->reqpb);
- char *path_info = pblock_findval("path-info", NSG(rq)->vars);
- char *path_translated = pblock_findval("path", NSG(rq)->vars);
- char *request_method = pblock_findval("method", NSG(rq)->reqpb);
- char *content_type = pblock_findval("content-type", NSG(rq)->headers);
- char *content_length = pblock_findval("content-length", NSG(rq)->headers);
-
- if ((path_translated == NULL) && (uri != NULL))
- path_translated = request_translate_uri(uri, NSG(sn));
-
-#if defined(NSAPI_DEBUG)
- log_error(LOG_INFORM, "nsapi_request_ctor", NSG(sn), NSG(rq),
- "query_string = %s, "
- "uri = %s, "
- "path_info = %s, "
- "path_translated = %s, "
- "request_method = %s, "
- "content_type = %s, "
- "content_length = %s",
- query_string,
- uri,
- path_info,
- path_translated,
- request_method,
- content_type,
- content_length);
-#endif
-
- SG(request_info).query_string = nsapi_strdup(query_string);
- SG(request_info).request_uri = nsapi_strdup(uri);
- SG(request_info).request_method = nsapi_strdup(request_method);
- SG(request_info).path_translated = nsapi_strdup(path_translated);
- SG(request_info).content_type = nsapi_strdup(content_type);
- SG(request_info).content_length = (content_length == NULL) ? 0 : strtoul(content_length, 0, 0);
- SG(sapi_headers).http_response_code = 200;
-}
-
-static void
-nsapi_request_dtor(NSLS_D SLS_DC)
-{
- nsapi_free(SG(request_info).query_string);
- nsapi_free(SG(request_info).request_uri);
- nsapi_free(SG(request_info).request_method);
- nsapi_free(SG(request_info).path_translated);
- nsapi_free(SG(request_info).content_type);
-}
-
-int
-nsapi_module_main(NSLS_D SLS_DC)
-{
- int result;
- zend_file_handle file_handle;
-
- CLS_FETCH();
- ELS_FETCH();
- PLS_FETCH();
-
- if (php_request_startup(CLS_C ELS_CC PLS_CC SLS_CC) == FAILURE) {
- return FAILURE;
- }
-
- file_handle.type = ZEND_HANDLE_FILENAME;
- file_handle.filename = SG(request_info).path_translated;
- file_handle.free_filename = 0;
- file_handle.opened_path = NULL;
-
-#if defined(NSAPI_DEBUG)
- log_error(LOG_INFORM, "nsapi_module_main", NSG(sn), NSG(rq),
- "Parsing [%s]", SG(request_info).path_translated);
-#endif
-
- php_execute_script(&file_handle CLS_CC ELS_CC PLS_CC);
- php_request_shutdown(NULL);
-
-#if defined(NSAPI_DEBUG)
- log_error(LOG_INFORM, "nsapi_module_main", NSG(sn), NSG(rq),
- "PHP request finished Ok");
-#endif
- return SUCCESS;
-}
-
-void NSAPI_PUBLIC
-php4_close(void *vparam)
-{
- if (nsapi_sapi_module.shutdown) {
- nsapi_sapi_module.shutdown(&nsapi_sapi_module);
- }
- tsrm_shutdown();
-}
-
-int NSAPI_PUBLIC
-php4_init(pblock *pb, Session *sn, Request *rq)
-{
- php_core_globals *core_globals;
-
- tsrm_startup(1, 1, 0, NULL);
- core_globals = ts_resource(core_globals_id);
-
- sapi_startup(&nsapi_sapi_module);
- nsapi_sapi_module.startup(&nsapi_sapi_module);
-
- log_error(LOG_INFORM, "php4_init", sn, rq, "Initialized PHP Module\n");
- return REQ_PROCEED;
-}
-
-int NSAPI_PUBLIC
-php4_execute(pblock *pb, Session *sn, Request *rq)
-{
- int retval;
- nsapi_request_context *request_context;
-
- SLS_FETCH();
-
- request_context = (nsapi_request_context *)MALLOC(sizeof(nsapi_request_context));
- request_context->pb = pb;
- request_context->sn = sn;
- request_context->rq = rq;
- request_context->read_post_bytes = 0;
-
- SG(server_context) = request_context;
-
- nsapi_request_ctor(NSLS_C SLS_CC);
- retval = nsapi_module_main(NSLS_C SLS_CC);
- nsapi_request_dtor(NSLS_C SLS_CC);
-
- FREE(request_context);
-
- return (retval == SUCCESS) ? REQ_PROCEED : REQ_EXIT;
-}
-
-/*********************************************************
-/ authentication
-/
-/ we have to make a 'fake' authenticator for netscape so it
-/ will pass authentication through to php, and allow us to
-/ check authentication with our scripts.
-/
-/ php4_auth_trans
-/ main function called from netscape server to authenticate
-/ a line in obj.conf:
-/ funcs=php4_auth_trans shlib="path/to/this/phpnsapi.dll"
-/ and:
-/ <Object ppath="path/to/be/authenticated/by/php/*">
-/ AuthTrans fn="php4_auth_trans"
-/*********************************************************/
-int NSAPI_PUBLIC
-php4_auth_trans(pblock * pb, Session * sn, Request * rq)
-{
- /*This is a DO NOTHING function that allows authentication information
- to be passed through to PHP scripts.*/
- return REQ_PROCEED;
-}
diff --git a/sapi/nsapi/php4nsapi.dsp b/sapi/nsapi/php4nsapi.dsp
deleted file mode 100644
index 9b0b8c9a56..0000000000
--- a/sapi/nsapi/php4nsapi.dsp
+++ /dev/null
@@ -1,135 +0,0 @@
-# Microsoft Developer Studio Project File - Name="php4nsapi" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=php4nsapi - Win32 Debug_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "php4nsapi.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "php4nsapi.mak" CFG="php4nsapi - Win32 Debug_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "php4nsapi - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "php4nsapi - Win32 Release_TS_inline" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "php4nsapi - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "php4nsapi - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "php4nsapi___Win32_Release_TS"
-# PROP BASE Intermediate_Dir "php4nsapi___Win32_Release_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "..\..\Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "php4nsapi_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /I "..\..\..\php_build\nsapi30\include\\" /I "..\..\include" /I "..\..\win32" /I "..\..\Zend" /I "..\.." /I "..\..\..\bindlib_w32" /I "..\..\main" /I "..\..\tsrm" /D ZEND_DEBUG=0 /D "NDEBUG" /D "XP_WIN32" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "_WINDOWS" /D "_USRDLL" /D "php4nsapi_EXPORTS" /D "WIN32" /D "_MBCS" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 ns-httpd30.lib php4ts.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /base:"0x62000000" /version:4.0 /dll /machine:I386 /libpath:"..\..\..\php_build\nsapi30\lib\\" /libpath:"..\..\Release_TS" /libpath:"..\..\TSRM\Release_TS" /libpath:"..\..\Zend\Release_TS"
-
-!ELSEIF "$(CFG)" == "php4nsapi - Win32 Release_TS_inline"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "php4nsapi___Win32_Release_TS_inline"
-# PROP BASE Intermediate_Dir "php4nsapi___Win32_Release_TS_inline"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "..\..\Release_TS_inline"
-# PROP Intermediate_Dir "Release_TS_inline"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "php4nsapi_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /I "..\..\..\php_build\nsapi30\include\\" /I "..\..\include" /I "..\..\win32" /I "..\..\Zend" /I "..\.." /I "..\..\..\bindlib_w32" /I "..\..\main" /I "..\..\tsrm" /D ZEND_DEBUG=0 /D "ZEND_WIN32_FORCE_INLINE" /D "NDEBUG" /D "XP_WIN32" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "_WINDOWS" /D "_USRDLL" /D "php4nsapi_EXPORTS" /D "WIN32" /D "_MBCS" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 ns-httpd30.lib php4ts.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /base:"0x62000000" /version:4.0 /dll /machine:I386 /libpath:"..\..\..\php_build\nsapi30\lib\\" /libpath:"..\..\Release_TS_inline" /libpath:"..\..\TSRM\Release_TS_inline" /libpath:"..\..\Zend\Release_TS_inline"
-
-!ELSEIF "$(CFG)" == "php4nsapi - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "php4nsapi___Win32_Debug_TS"
-# PROP BASE Intermediate_Dir "php4nsapi___Win32_Debug_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "..\..\Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "php4nsapi_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "." /I "..\..\..\php_build\nsapi30\include\\" /I "..\..\include" /I "..\..\win32" /I "..\..\Zend" /I "..\.." /I "..\..\..\bindlib_w32" /I "..\..\main" /I "..\..\tsrm" /D "_Debug_TS" /D ZEND_DEBUG=1 /D "_DEBUG" /D "XP_WIN32" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "_WINDOWS" /D "_USRDLL" /D "php4nsapi_EXPORTS" /D "WIN32" /D "_MBCS" /FR /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 ns-httpd30.lib php4ts_debug.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /base:"0x62000000" /version:4.0 /dll /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\php_build\nsapi30\lib\\" /libpath:"..\..\Debug_TS" /libpath:"..\..\TSRM\Debug_TS" /libpath:"..\..\Zend\Debug_TS"
-
-!ENDIF
-
-# Begin Target
-
-# Name "php4nsapi - Win32 Release_TS"
-# Name "php4nsapi - Win32 Release_TS_inline"
-# Name "php4nsapi - Win32 Debug_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\nsapi.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/sapi/phttpd/CREDITS b/sapi/phttpd/CREDITS
deleted file mode 100644
index 134cc54825..0000000000
--- a/sapi/phttpd/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-phttpd
-Thies C. Arntzen
diff --git a/sapi/phttpd/Makefile.in b/sapi/phttpd/Makefile.in
deleted file mode 100644
index 3fa62790f1..0000000000
--- a/sapi/phttpd/Makefile.in
+++ /dev/null
@@ -1,5 +0,0 @@
-
-LTLIBRARY_NAME = libsapi.la
-LTLIBRARY_SOURCES = phttpd.c
-
-include $(top_srcdir)/build/ltlib.mk
diff --git a/sapi/phttpd/README b/sapi/phttpd/README
deleted file mode 100644
index cdb6f7c381..0000000000
--- a/sapi/phttpd/README
+++ /dev/null
@@ -1,5 +0,0 @@
-phttpd sapi module.
-
-THIS IS BY NO MEANS COMPLETE NOR USABLE RIGHT NOW!
-
-thies@thieso.net 03.01.2000
diff --git a/sapi/phttpd/config.m4 b/sapi/phttpd/config.m4
deleted file mode 100644
index 038fbc8e8a..0000000000
--- a/sapi/phttpd/config.m4
+++ /dev/null
@@ -1,24 +0,0 @@
-dnl ## $Id$ -*- sh -*-
-
-RESULT=no
-AC_MSG_CHECKING(for PHTTPD support)
-AC_ARG_WITH(phttpd,
-[ --with-phttpd=DIR],
-[
- if test ! -d $withval ; then
- AC_MSG_ERROR(You did not specify a directory)
- fi
- PHP_BUILD_THREAD_SAFE
- PHTTPD_DIR=$withval
- PHP_ADD_INCLUDE($PHTTPD_DIR/include)
- AC_DEFINE(HAVE_PHTTPD,1,[Whether you have phttpd])
- PHP_SAPI=phttpd
- PHP_BUILD_SHARED
- INSTALL_IT="\$(INSTALL) -m 0755 $SAPI_SHARED \$(INSTALL_ROOT)$PHTTPD_DIR/modules/"
- RESULT=yes
-])
-AC_MSG_RESULT($RESULT)
-
-dnl ## Local Variables:
-dnl ## tab-width: 4
-dnl ## End:
diff --git a/sapi/phttpd/php.sym b/sapi/phttpd/php.sym
deleted file mode 100644
index f10b883a99..0000000000
--- a/sapi/phttpd/php.sym
+++ /dev/null
@@ -1,4 +0,0 @@
-pm_init
-pm_exit
-pm_request
-
diff --git a/sapi/phttpd/php_phttpd.h b/sapi/phttpd/php_phttpd.h
deleted file mode 100644
index 09b7a5cb11..0000000000
--- a/sapi/phttpd/php_phttpd.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Thies C. Arntzen <thies@thieso.net> |
- +----------------------------------------------------------------------+
-*/
-
-#ifndef PHP_PHTTPD_H
-#define PHP_PHTTPD_H
-
-#include <phttpd.h>
-
-#endif
diff --git a/sapi/phttpd/phttpd.c b/sapi/phttpd/phttpd.c
deleted file mode 100644
index 7bcce209df..0000000000
--- a/sapi/phttpd/phttpd.c
+++ /dev/null
@@ -1,322 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Thies C. Arntzen <thies@thieso.net> |
- | Based on aolserver SAPI by Sascha Schumann <sascha@schumann.cx> |
- +----------------------------------------------------------------------+
-*/
-
-#include "php.h"
-#include "SAPI.h"
-#include "php_main.h"
-
-#ifdef HAVE_PHTTPD
-
-#include "ext/standard/info.h"
-
-#ifndef ZTS
-#error PHTTPD module is only useable in thread-safe mode
-#endif
-
-#include "php_phttpd.h"
-
-typedef struct {
- struct connectioninfo *cip;
- struct stat sb;
-} phttpd_globals_struct;
-
-static int ph_globals_id;
-
-#define PHLS_D phttpd_globals_struct *ph_context
-#define PHLS_DC , PHLS_D
-#define PHLS_C ph_context
-#define PHLS_CC , PHLS_C
-#define PHG(v) (ph_context->v)
-#define PHLS_FETCH() phttpd_globals_struct *ph_context = ts_resource(ph_globals_id)
-
-static int
-php_phttpd_startup(sapi_module_struct *sapi_module)
-{
-/*
- if(php_module_startup(sapi_module) == FAILURE
- || zend_startup_module(&php_aolserver_module) == FAILURE) {
-*/
- fprintf(stderr,"***php_phttpd_startup\n");
-
- if (php_module_startup(sapi_module)) {
- return FAILURE;
- } else {
- return SUCCESS;
- }
-}
-
-static int
-php_phttpd_sapi_ub_write(const char *str, uint str_length)
-{
- int sent_bytes;
- PHLS_FETCH();
-
- sent_bytes = fd_write(PHG(cip)->fd,str,str_length);
-
- if (sent_bytes == -1) {
- php_handle_aborted_connection();
- }
-
- return sent_bytes;
-}
-
-static int
-php_phttpd_sapi_header_handler(sapi_header_struct *sapi_header, sapi_headers_struct *sapi_headers SLS_DC)
-{
- char *header_name, *header_content;
- char *p;
- PHLS_FETCH();
-
- http_sendheaders(PHG(cip)->fd,PHG(cip), SG(sapi_headers).http_response_code, NULL);
-
- header_name = sapi_header->header;
- header_content = p = strchr(header_name, ':');
-
- if (p) {
- *p = '\0';
- do {
- header_content++;
- } while (*header_content == ' ');
-
- fd_printf(PHG(cip)->fd,"%s: %s\n",header_name,header_content);
-
- *p = ':';
- }
-
- sapi_free_header(sapi_header);
-
- return 0;
-}
-
-static int
-php_phttpd_sapi_send_headers(sapi_headers_struct *sapi_headers SLS_DC)
-{
- PHLS_FETCH();
-
- if (SG(sapi_headers).send_default_content_type) {
- fd_printf(PHG(cip)->fd,"Content-Type: text/html\n");
- }
-
- fd_putc('\n', PHG(cip)->fd);
-
- return SAPI_HEADER_SENT_SUCCESSFULLY;
-}
-
-static char *
-php_phttpd_sapi_read_cookies(SLS_D)
-{
-
-/*
- int i;
- char *http_cookie = NULL;
- NSLS_FETCH();
-
- i = Ns_SetIFind(NSG(conn->headers), "cookie");
- if(i != -1) {
- http_cookie = Ns_SetValue(NSG(conn->headers), i);
- }
-
- return http_cookie;
-*/
- fprintf(stderr,"***php_phttpd_sapi_read_cookies\n");
-
- return 0;
-}
-
-static int
-php_phttpd_sapi_read_post(char *buf, uint count_bytes SLS_DC)
-{
-/*
- uint max_read;
- uint total_read = 0;
- NSLS_FETCH();
-
- max_read = MIN(NSG(data_avail), count_bytes);
-
- total_read = Ns_ConnRead(NSG(conn), buf, max_read);
-
- if(total_read == NS_ERROR) {
- total_read = -1;
- } else {
- NSG(data_avail) -= total_read;
- }
-
- return total_read;
-*/
- fprintf(stderr,"***php_phttpd_sapi_read_post\n");
- return 0;
-}
-
-static sapi_module_struct phttpd_sapi_module = {
- "phttpd",
- "PHTTPD",
-
- php_phttpd_startup, /* startup */
- php_module_shutdown_wrapper, /* shutdown */
-
- NULL, /* activate */
- NULL, /* deactivate */
-
- php_phttpd_sapi_ub_write, /* unbuffered write */
- NULL, /* flush */
- NULL, /* get uid */
- NULL, /* getenv */
-
- php_error, /* error handler */
-
- php_phttpd_sapi_header_handler, /* header handler */
- php_phttpd_sapi_send_headers, /* send headers handler */
- NULL, /* send header handler */
-
- php_phttpd_sapi_read_post, /* read POST data */
- php_phttpd_sapi_read_cookies, /* read Cookies */
-
- NULL, /* register server variables */
- NULL, /* Log message */
-
- NULL, /* Block interruptions */
- NULL, /* Unblock interruptions */
-
- STANDARD_SAPI_MODULE_PROPERTIES
-};
-
-static void
-php_phttpd_request_ctor(PHLS_D SLS_DC)
-{
- memset(&SG(request_info),0,sizeof(sapi_globals_struct)); /* pfusch! */
-
- SG(request_info).query_string = PHG(cip)->hip->request;
- SG(request_info).request_method = PHG(cip)->hip->method;
- SG(request_info).path_translated = malloc(MAXPATHLEN);
- SG(sapi_headers).http_response_code = 200;
- if (url_expand(PHG(cip)->hip->url, SG(request_info).path_translated, MAXPATHLEN, &PHG(sb), NULL, NULL) == NULL) {
- /* handle error */
- }
-
-#if 0
- char *server;
- Ns_DString ds;
- char *root;
- int index;
- char *tmp;
-
- server = Ns_ConnServer(NSG(conn));
-
- Ns_DStringInit(&ds);
- Ns_UrlToFile(&ds, server, NSG(conn->request->url));
-
- /* path_translated is the absolute path to the file */
- SG(request_info).path_translated = strdup(Ns_DStringValue(&ds));
- Ns_DStringFree(&ds);
- root = Ns_PageRoot(server);
- SG(request_info).request_uri = SG(request_info).path_translated + strlen(root);
- SG(request_info).content_length = Ns_ConnContentLength(NSG(conn));
- index = Ns_SetIFind(NSG(conn)->headers, "content-type");
- SG(request_info).content_type = index == -1 ? NULL :
- Ns_SetValue(NSG(conn)->headers, index);
-
- tmp = Ns_ConnAuthUser(NSG(conn));
- if(tmp) {
- tmp = estrdup(tmp);
- }
- SG(request_info).auth_user = tmp;
-
- tmp = Ns_ConnAuthPasswd(NSG(conn));
- if(tmp) {
- tmp = estrdup(tmp);
- }
- SG(request_info).auth_password = tmp;
-
- NSG(data_avail) = SG(request_info).content_length;
-#endif
-}
-
-static void
-php_phttpd_request_dtor(PHLS_D SLS_DC)
-{
- free(SG(request_info).path_translated);
-}
-
-
-int php_doit(PHLS_D SLS_DC)
-{
- struct stat sb;
- zend_file_handle file_handle;
- struct httpinfo *hip = PHG(cip)->hip;
-
- CLS_FETCH();
- ELS_FETCH();
- PLS_FETCH();
-
- if (php_request_startup(CLS_C ELS_CC PLS_CC SLS_CC) == FAILURE) {
- return -1;
- }
-
- file_handle.type = ZEND_HANDLE_FILENAME;
- file_handle.filename = SG(request_info).path_translated;
- file_handle.free_filename = 0;
-
-/*
- php_phttpd_hash_environment(PHLS_C CLS_CC ELS_CC PLS_CC SLS_CC);
-*/
- php_execute_script(&file_handle CLS_CC ELS_CC PLS_CC);
- php_request_shutdown(NULL);
-
- return SG(sapi_headers).http_response_code;
-}
-
-int pm_init(const char **argv)
-{
- tsrm_startup(1, 1, 0, NULL);
- sapi_startup(&phttpd_sapi_module);
- phttpd_sapi_module.startup(&phttpd_sapi_module);
-
- ph_globals_id = ts_allocate_id(sizeof(phttpd_globals_struct), NULL, NULL);
-
- return 0;
-}
-
-void pm_exit(void)
-{
- fprintf(stderr,"***pm_exit\n");
-}
-
-int pm_request(struct connectioninfo *cip)
-{
- struct httpinfo *hip = cip->hip;
- int status;
- PHLS_FETCH();
- SLS_FETCH();
-
- if (strcasecmp(hip->method, "GET") == 0 ||
- strcasecmp(hip->method, "HEAD") == 0 ||
- strcasecmp(hip->method, "POST") == 0) {
- PHG(cip) = cip;
-
- php_phttpd_request_ctor(PHLS_C SLS_CC);
- status = php_doit(PHLS_C SLS_CC);
- php_phttpd_request_dtor(PHLS_C SLS_CC);
-
- return status;
- } else {
- return -2;
- }
-}
-
-#endif
diff --git a/sapi/pi3web/CREDITS b/sapi/pi3web/CREDITS
deleted file mode 100644
index c4541f89da..0000000000
--- a/sapi/pi3web/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-pi3web
-Holger Zimmermann
diff --git a/sapi/pi3web/Makefile.in b/sapi/pi3web/Makefile.in
deleted file mode 100644
index 0195beb789..0000000000
--- a/sapi/pi3web/Makefile.in
+++ /dev/null
@@ -1,5 +0,0 @@
-
-LTLIBRARY_NAME = libsapi.la
-LTLIBRARY_SOURCES = pi3web_sapi.c
-
-include $(top_srcdir)/build/ltlib.mk
diff --git a/sapi/pi3web/README b/sapi/pi3web/README
deleted file mode 100644
index 8d7e9dc274..0000000000
--- a/sapi/pi3web/README
+++ /dev/null
@@ -1,50 +0,0 @@
-PHP4 Module
-==========
-This module requires PHP4 as thread safe shared library. Have a look
-into the INSTALL file which accompanies that distribution.
-
-If you distribute this software bundled with the PHP software in source
-or binary form, then you must adhere to the PHP copyright conditions -
-the terms are reasonable.
-
-You should have checked out and built the PHP4 source package from the
-PHP CVS tree into the Pi3Web source directory called 'PHP4' first. Then
-build PHP4 as Pi3Web module and after that build the Pi3Web PHP4 wrapper:
-
-1. Checkout PHP4
-================
-cvs -d :pserver:cvsread@cvs.php.net:/repository login
-The required password is phpfi
-
-cvs -z3 -d :pserver:cvsread@cvs.php.net:/repository co php4
-
-You must also checkout the TSRM and the ZEND module from the ZEND cvs tree
-into the PHP4 root directory
-
-cvs -d :pserver:cvsread@cvs.zend.com:/repository login
-The required password is zend
-
-cvs -z3 -d :pserver:cvsread@cvs.zend.com:/repository co Zend TSRM
-
-2. Build PHP4
-=============
-2.1 POSIX
----------
-cd ./php4
-./buildconf
-./configure --with-pi3web
-make
-
-2.2 Win32
----------
-other required downloads from the php website
- - bison 1.25
- - bindlib32
- - number4.tar.gz
-nmake php4dllts.mak
-
-3. Build Pi3Web PHP4 wrapper
-============================
-Run make in the Pi3Web /Source/PHP4 directory.
-
-For further information refer to http://www.php.net/version4/
diff --git a/sapi/pi3web/config.m4 b/sapi/pi3web/config.m4
deleted file mode 100644
index eb729f75d7..0000000000
--- a/sapi/pi3web/config.m4
+++ /dev/null
@@ -1,24 +0,0 @@
-PHP_ARG_WITH(pi3web,for Pi3Web Support,
-[ --with-pi3web=DIR Build PHP as a module for use with Pi3Web.])
-
-if test "$PHP_PI3WEB" != "no"; then
- if test "$PHP_PI3WEB" = "yes"; then
- PI3PATH=../.. # the default
- else
- PI3PATH=$PHP_PI3WEB
- fi
- test -f "$PI3PATH/PiAPI/PiAPI.h" || AC_MSG_ERROR(Unable to find PiAPI.h in $PI3PATH/PiAPI)
- PHP_BUILD_THREAD_SAFE
- AC_DEFINE(WITH_PI3WEB,1,[whether you want Pi3Web support])
- PHP_ADD_INCLUDE($PI3PATH/PiAPI)
- PHP_ADD_INCLUDE($PI3PATH/Pi2API)
- PHP_ADD_INCLUDE($PI3PATH/Pi3API)
- PHP_ADD_INCLUDE($PI3PATH/PHP4)
- PHP_SAPI=pi3web
- PHP_BUILD_SHARED
- INSTALL_IT="\$(SHELL) \$(srcdir)/install-sh -m 0755 $SAPI_SHARED \$(INSTALL_ROOT)$PI3PATH/bin/"
-fi
-
-dnl ## Local Variables:
-dnl ## tab-width: 4
-dnl ## End:
diff --git a/sapi/pi3web/php.sym b/sapi/pi3web/php.sym
deleted file mode 100644
index e69de29bb2..0000000000
--- a/sapi/pi3web/php.sym
+++ /dev/null
diff --git a/sapi/pi3web/php4pi3web.dsp b/sapi/pi3web/php4pi3web.dsp
deleted file mode 100644
index ec1c2806a3..0000000000
--- a/sapi/pi3web/php4pi3web.dsp
+++ /dev/null
@@ -1,136 +0,0 @@
-# Microsoft Developer Studio Project File - Name="php4pi3web" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=php4pi3web - Win32 Debug_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "php4pi3web.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "php4pi3web.mak" CFG="php4pi3web - Win32 Debug_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "php4pi3web - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "php4pi3web - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "php4pi3web - Win32 Release_TS_inline" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "php4pi3web - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "..\..\Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "php4pi3web_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /GX /ZI /Od /I "...\..\include" /I "..\..\win32" /I "..\..\Zend" /I "..\.." /I "..\..\main" /I "..\..\TSRM" /D "_DEBUG" /D ZEND_DEBUG=1 /D "_WINDOWS" /D "_USRDLL" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WIN32" /D "_MBCS" /FR /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "_DEBUG"
-# ADD RSC /l 0x40d /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 php4ts_debug.lib kernel32.lib user32.lib gdi32.lib wsock32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib PiAPI.lib Pi2API.lib Pi3API.lib /nologo /version:4.0 /dll /debug /machine:I386 /nodefaultlib:"libcmt" /nodefaultlib:"libc" /pdbtype:sept /libpath:"..\..\Debug_TS"
-
-!ELSEIF "$(CFG)" == "php4pi3web - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "..\..\Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "php4pi3web_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "...\..\include" /I "..\..\win32" /I "..\..\Zend" /I "..\.." /I "..\..\main" /I "..\..\TSRM" /D "NDEBUG" /D ZEND_DEBUG=0 /D "_WINDOWS" /D "_USRDLL" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WIN32" /D "_MBCS" /FR /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 php4ts.lib kernel32.lib user32.lib gdi32.lib wsock32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib PiAPI.lib Pi2API.lib Pi3API.lib /nologo /version:4.0 /dll /machine:I386 /nodefaultlib:"libc.lib" /nodefaultlib:"libcmt.lib" /libpath:"..\..\Release_TS"
-
-!ELSEIF "$(CFG)" == "php4pi3web - Win32 Release_TS_inline"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "php4pi3web___Win32_Release_TS_inline"
-# PROP BASE Intermediate_Dir "php4pi3web___Win32_Release_TS_inline"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "..\..\Release_TS_inline"
-# PROP Intermediate_Dir "Release_TS_inline"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I ".." /I "..\main" /I "..\regex" /I "..\..\bindlib_w32" /I "..\Zend" /I "..\TSRM" /I "..\ext\mysql\libmysql" /I "..\..\..\PiAPI" /I "..\..\..\Pi2API" /I "..\..\..\Pi3API" /D "NDEBUG" /D ZEND_DEBUG=0 /D "_WINDOWS" /D "_USRDLL" /D "PHP4DLLTS_EXPORTS" /D "PHP_EXPORTS" /D "LIBZEND_EXPORTS" /D "TSRM_EXPORTS" /D "SAPI_EXPORTS" /D "MSVC5" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WIN32" /D "_MBCS" /FR /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "...\..\include" /I "..\..\win32" /I "..\..\Zend" /I "..\.." /I "..\..\main" /I "..\..\TSRM" /D "NDEBUG" /D ZEND_DEBUG=0 /D "ZEND_WIN32_FORCE_INLINE" /D "_WINDOWS" /D "_USRDLL" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WIN32" /D "_MBCS" /FR /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib wsock32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ZendTS.lib TSRM.lib resolv.lib libmysql.lib PiAPI.lib Pi2API.lib Pi3API.lib /nologo /version:4.0 /dll /machine:I386 /nodefaultlib:"libc.lib" /nodefaultlib:"libcmt.lib" /out:"..\Release_TS\php4ts.dll" /libpath:"..\TSRM\Release_TS" /libpath:"..\Zend\Release_TS" /libpath:"..\..\bindlib_w32\Release" /libpath:"..\ext\mysql\libmysql\Release_TS" /libpath:"Release_TS" /libpath:"..\..\..\PiAPI" /libpath:"..\..\..\Pi2API" /libpath:"..\..\..\Pi3API"
-# ADD LINK32 php4ts.lib kernel32.lib user32.lib gdi32.lib wsock32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib PiAPI.lib Pi2API.lib Pi3API.lib /nologo /version:4.0 /dll /machine:I386 /nodefaultlib:"libc.lib" /nodefaultlib:"libcmt.lib" /libpath:"..\..\Release_TS_inline"
-
-!ENDIF
-
-# Begin Target
-
-# Name "php4pi3web - Win32 Debug_TS"
-# Name "php4pi3web - Win32 Release_TS"
-# Name "php4pi3web - Win32 Release_TS_inline"
-# Begin Group "Source Files"
-
-# PROP Default_Filter ".c"
-# Begin Source File
-
-SOURCE=.\pi3web_sapi.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter ".h"
-# Begin Source File
-
-SOURCE=.\pi3web_sapi.h
-# End Source File
-# End Group
-# End Target
-# End Project
diff --git a/sapi/pi3web/pi3web_sapi.c b/sapi/pi3web/pi3web_sapi.c
deleted file mode 100644
index 9a1d9234d5..0000000000
--- a/sapi/pi3web/pi3web_sapi.c
+++ /dev/null
@@ -1,451 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Pi3Web version 2.0 |
- +----------------------------------------------------------------------+
- | This file is committed by the Pi3 development group. |
- | (pi3web.sourceforge.net) |
- | |
- | Author: Holger Zimmermann (zimpel@users.sourceforge.net) |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#include "pi3web_sapi.h"
-#include "php.h"
-#include "php_main.h"
-#include "SAPI.h"
-#include "php_globals.h"
-#include "ext/standard/info.h"
-#include "zend_highlight.h"
-#include "zend_indent.h"
-#include "ext/standard/basic_functions.h"
-#include "TSRM/TSRM.h"
-#include "PiAPI.h"
-#include "Pi3API.h"
-
-#define MAX_STATUS_LENGTH sizeof("xxxx LONGEST STATUS DESCRIPTION")
-#define PI3WEB_SERVER_VAR_BUF_SIZE 1024
-#define PI3WEB_POST_DATA_BUF 1024
-
-int IWasLoaded=0;
-
-static char *pi3web_server_variables[] = {
- "ALL_HTTP",
- "AUTH_TYPE",
- "CONTENT_LENGTH",
- "CONTENT_TYPE",
- "GATEWAY_INTERFACE",
- "PATH_INFO",
- "PATH_TRANSLATED",
- "QUERY_STRING",
- "REQUEST_METHOD",
- "REMOTE_ADDR",
- "REMOTE_HOST",
- "REMOTE_USER",
- "SCRIPT_NAME",
- "SERVER_NAME",
- "SERVER_PORT",
- "SERVER_PROTOCOL",
- "SERVER_SOFTWARE",
- NULL
-};
-
-
-static void php_info_pi3web(ZEND_MODULE_INFO_FUNC_ARGS)
-{
- char **p = pi3web_server_variables;
- char variable_buf[PI3WEB_SERVER_VAR_BUF_SIZE];
- DWORD variable_len;
- LPCONTROL_BLOCK lpCB;
- SLS_FETCH();
-
- lpCB = (LPCONTROL_BLOCK) SG(server_context);
-
- PUTS("<table border=0 cellpadding=3 cellspacing=1 width=600 align=center>\n");
- PUTS("<tr><th colspan=2 bgcolor=\"" PHP_HEADER_COLOR "\">Pi3Web Server Information</th></tr>\n");
- php_info_print_table_header(2, "Information Field", "Value");
- php_info_print_table_row(2, "Pi3Web SAPI module version", "$Id$");
- php_info_print_table_row(2, "Server Name Stamp", HTTPCore_getServerStamp());
- snprintf(variable_buf, 511, "%d", HTTPCore_debugEnabled());
- php_info_print_table_row(2, "Debug Enabled", variable_buf);
- PIPlatform_getCurrentDirectory( variable_buf, PI3WEB_SERVER_VAR_BUF_SIZE);
- php_info_print_table_row(2, "Current Path", variable_buf);
- if (lpCB->GetServerVariable(lpCB->ConnID, "SERVER_NAME", variable_buf, &variable_len)
- && variable_buf[0]) {
- php_info_print_table_row(2, "Main Virtual Hostname", variable_buf);
- };
- snprintf(variable_buf, 511, "%d", PIPlatform_getProcessId());
- php_info_print_table_row(2, "Server PID", variable_buf);
- php_info_print_table_row(2, "Server Platform", PIPlatform_getDescription());
-
- PUTS("</table><BR>");
-
- PUTS("<table border=0 cellpadding=3 cellspacing=1 width=600 align=center>\n");
- PUTS("<tr><th colspan=2 bgcolor=\"" PHP_HEADER_COLOR "\">HTTP Request Information</th></tr>\n");
- php_info_print_table_row(2, "HTTP Request Line", lpCB->lpszReq);
- PUTS("<tr><th colspan=2 bgcolor=\"" PHP_HEADER_COLOR "\">HTTP Headers</th></tr>\n");
- php_info_print_table_header(2, "Server Variable", "Value");
- while (*p) {
- variable_len = PI3WEB_SERVER_VAR_BUF_SIZE;
- if (lpCB->GetServerVariable(lpCB->ConnID, *p, variable_buf, &variable_len)
- && variable_buf[0]) {
- php_info_print_table_row(2, *p, variable_buf);
- } else if (PIPlatform_getLastError() == PIAPI_EINVAL) {
- char *tmp_variable_buf;
-
- tmp_variable_buf = (char *) emalloc(variable_len);
- if (lpCB->GetServerVariable(lpCB->ConnID, *p, tmp_variable_buf, &variable_len)
- && variable_buf[0]) {
- php_info_print_table_row(2, *p, tmp_variable_buf);
- }
- efree(tmp_variable_buf);
- }
- p++;
- }
-
- PUTS("</table>");
-}
-
-
-static zend_module_entry php_pi3web_module = {
- "PI3WEB",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- php_info_pi3web,
- STANDARD_MODULE_PROPERTIES
-};
-
-
-static int zend_pi3web_ub_write(const char *str, uint str_length)
-{
- DWORD num_bytes = str_length;
- LPCONTROL_BLOCK cb;
- SLS_FETCH();
-
- cb = (LPCONTROL_BLOCK) SG(server_context);
-
- if ( !IWasLoaded ) return 0;
- cb->WriteClient(cb->ConnID, (char *) str, &num_bytes, 0 );
-
- if (num_bytes != str_length)
- php_handle_aborted_connection();
- return num_bytes;
-}
-
-
-static int sapi_pi3web_header_handler(sapi_header_struct *sapi_header, sapi_headers_struct *sapi_headers SLS_DC)
-{
- return SAPI_HEADER_ADD;
-}
-
-
-
-static void accumulate_header_length(sapi_header_struct *sapi_header, uint *total_length)
-{
- *total_length += sapi_header->header_len+2;
-}
-
-
-static void concat_header(sapi_header_struct *sapi_header, char **combined_headers_ptr)
-{
- memcpy(*combined_headers_ptr, sapi_header->header, sapi_header->header_len);
- *combined_headers_ptr += sapi_header->header_len;
- **combined_headers_ptr = '\r';
- (*combined_headers_ptr)++;
- **combined_headers_ptr = '\n';
- (*combined_headers_ptr)++;
-}
-
-
-static int sapi_pi3web_send_headers(sapi_headers_struct *sapi_headers SLS_DC)
-{
- uint total_length = 2; /* account for the trailing \r\n */
- char *combined_headers, *combined_headers_ptr;
- LPCONTROL_BLOCK lpCB = (LPCONTROL_BLOCK) SG(server_context);
- sapi_header_struct default_content_type;
- PLS_FETCH();
-
- if ( !IWasLoaded ) return SAPI_HEADER_SENT_SUCCESSFULLY;
-
-
- if (SG(sapi_headers).send_default_content_type) {
- sapi_get_default_content_type_header(&default_content_type SLS_CC);
- accumulate_header_length(&default_content_type, (void *) &total_length);
- }
- zend_llist_apply_with_argument(&SG(sapi_headers).headers, (void (*)(void *, void *)) accumulate_header_length, (void *) &total_length);
-
- /* Generate headers */
- combined_headers = (char *) emalloc(total_length+1);
- combined_headers_ptr = combined_headers;
- if (SG(sapi_headers).send_default_content_type) {
- concat_header(&default_content_type, (void *) &combined_headers_ptr);
- sapi_free_header(&default_content_type); /* we no longer need it */
- }
- zend_llist_apply_with_argument(&SG(sapi_headers).headers, (void (*)(void *, void *)) concat_header, (void *) &combined_headers_ptr);
- *combined_headers_ptr++ = '\r';
- *combined_headers_ptr++ = '\n';
- *combined_headers_ptr = 0;
-
- lpCB->dwHttpStatusCode = SG(sapi_headers).http_response_code;
- lpCB->SendHeaderFunction(lpCB->ConnID, &total_length, (LPDWORD) combined_headers);
-
- efree(combined_headers);
- if (SG(sapi_headers).http_status_line) {
- efree(SG(sapi_headers).http_status_line);
- }
- return SAPI_HEADER_SENT_SUCCESSFULLY;
-}
-
-
-static int php_pi3web_startup(sapi_module_struct *sapi_module)
-{
- if (php_module_startup(sapi_module)==FAILURE
- || zend_register_module(&php_pi3web_module)==FAILURE) {
- return FAILURE;
- } else {
- return SUCCESS;
- }
-}
-
-
-static int sapi_pi3web_read_post(char *buffer, uint count_bytes SLS_DC)
-{
- LPCONTROL_BLOCK lpCB = (LPCONTROL_BLOCK) SG(server_context);
- DWORD read_from_buf=0;
- DWORD read_from_input=0;
- DWORD total_read=0;
-
- if (SG(read_post_bytes) < lpCB->cbAvailable) {
- read_from_buf = MIN(lpCB->cbAvailable-SG(read_post_bytes), count_bytes);
- memcpy(buffer, lpCB->lpbData+SG(read_post_bytes), read_from_buf);
- total_read += read_from_buf;
- }
- if (read_from_buf<count_bytes
- && (SG(read_post_bytes)+read_from_buf) < lpCB->cbTotalBytes) {
- DWORD cbRead=0, cbSize;
-
- read_from_input = MIN(count_bytes-read_from_buf, lpCB->cbTotalBytes-SG(read_post_bytes)-read_from_buf);
- while (cbRead < read_from_input) {
- cbSize = read_from_input - cbRead;
- if (!lpCB->ReadClient(lpCB->ConnID, buffer+read_from_buf+cbRead, &cbSize) || cbSize==0) {
- break;
- }
- cbRead += cbSize;
- }
- total_read += cbRead;
- }
- SG(read_post_bytes) += total_read;
- return total_read;
-}
-
-
-static char *sapi_pi3web_read_cookies(SLS_D)
-{
- LPCONTROL_BLOCK lpCB = (LPCONTROL_BLOCK) SG(server_context);
- char variable_buf[PI3WEB_SERVER_VAR_BUF_SIZE];
- DWORD variable_len = PI3WEB_SERVER_VAR_BUF_SIZE;
-
- if (lpCB->GetServerVariable(lpCB->ConnID, "HTTP_COOKIE", variable_buf, &variable_len)) {
- return estrndup(variable_buf, variable_len);
- } else if (PIPlatform_getLastError()==PIAPI_EINVAL) {
- char *tmp_variable_buf = (char *) emalloc(variable_len+1);
-
- if (lpCB->GetServerVariable(lpCB->ConnID, "HTTP_COOKIE", tmp_variable_buf, &variable_len)) {
- tmp_variable_buf[variable_len] = 0;
- return tmp_variable_buf;
- } else {
- efree(tmp_variable_buf);
- }
- }
- return NULL;
-}
-
-
-static sapi_module_struct pi3web_sapi_module = {
- "pi3web", /* name */
- "PI3WEB", /* pretty name */
-
- php_pi3web_startup, /* startup */
- php_module_shutdown_wrapper, /* shutdown */
- NULL, /* activate */
- NULL, /* deactivate */
- zend_pi3web_ub_write, /* unbuffered write */
- NULL, /* flush */
- NULL, /* get uid */
- NULL, /* getenv */
- php_error, /* error handler */
- sapi_pi3web_header_handler, /* header handler */
- sapi_pi3web_send_headers, /* send headers handler */
- NULL, /* send header handler */
- sapi_pi3web_read_post, /* read POST data */
- sapi_pi3web_read_cookies, /* read Cookies */
- NULL, /* register server variables */
- NULL, /* Log message */
- NULL, /* Block interruptions */
- NULL, /* Unblock interruptions */
-
- STANDARD_SAPI_MODULE_PROPERTIES
-};
-
-
-static void init_request_info(sapi_globals_struct *sapi_globals, LPCONTROL_BLOCK lpCB)
-{
- char *path_end = strrchr(lpCB->lpszFileName, PHP_DIR_SEPARATOR);
- if ( path_end ) *path_end = PHP_DIR_SEPARATOR;
-
- SG(server_context) = lpCB;
- SG(request_info).request_method = lpCB->lpszMethod;
- SG(request_info).query_string = lpCB->lpszQueryString;
- SG(request_info).path_translated = lpCB->lpszPathTranslated;
- SG(request_info).request_uri = lpCB->lpszUri;
- SG(request_info).content_type = lpCB->lpszContentType;
- SG(request_info).content_length = lpCB->cbTotalBytes;
- SG(request_info).auth_user = lpCB->lpszUser;
- SG(request_info).auth_password = lpCB->lpszPassword;
- SG(sapi_headers).http_response_code = 200;
-}
-
-static void hash_pi3web_variables(ELS_D SLS_DC)
-{
- char static_variable_buf[PI3WEB_SERVER_VAR_BUF_SIZE];
- char *variable_buf;
- DWORD variable_len = PI3WEB_SERVER_VAR_BUF_SIZE;
- char *variable;
- char *strtok_buf = NULL;
- LPCONTROL_BLOCK lpCB;
-
- lpCB = (LPCONTROL_BLOCK) SG(server_context);
-
- if (lpCB->GetServerVariable(lpCB->ConnID, "ALL_HTTP", static_variable_buf, &variable_len)) {
- variable_buf = static_variable_buf;
- } else {
- if (PIPlatform_getLastError()==PIAPI_EINVAL) {
- variable_buf = (char *) emalloc(variable_len);
- if (!lpCB->GetServerVariable(lpCB->ConnID, "ALL_HTTP", variable_buf, &variable_len)) {
- efree(variable_buf);
- return;
- }
- } else {
- return;
- }
- }
- variable = php_strtok_r(variable_buf, "\r\n", &strtok_buf);
- while (variable) {
- char *colon = strchr(variable, ':');
-
- if (colon) {
- char *value = colon+1;
- zval *entry;
- ALLOC_ZVAL(entry);
-
- while (*value==' ') {
- value++;
- }
- *colon = 0;
- INIT_PZVAL(entry);
- entry->value.str.len = strlen(value);
- entry->value.str.val = estrndup(value, entry->value.str.len);
- entry->type = IS_STRING;
- zend_hash_add(&EG(symbol_table), variable, strlen(variable)+1, &entry, sizeof(zval *), NULL);
- *colon = ':';
- }
- variable = php_strtok_r(NULL, "\r\n", &strtok_buf);
- }
- if (variable_buf!=static_variable_buf) {
- efree(variable_buf);
- }
-}
-
-
-DWORD PHP4_wrapper(LPCONTROL_BLOCK lpCB)
-{
- zend_file_handle file_handle;
- SLS_FETCH();
- CLS_FETCH();
- ELS_FETCH();
- PLS_FETCH();
-
- if (setjmp( EG(bailout)) != 0 ) return PIAPI_ERROR;
-
- file_handle.filename = lpCB->lpszFileName;
- file_handle.free_filename = 0;
- file_handle.type = ZEND_HANDLE_FILENAME;
- file_handle.opened_path = NULL;
-
- CG(extended_info) = 0;
- init_request_info(sapi_globals, lpCB);
- php_request_startup(CLS_C ELS_CC PLS_CC SLS_CC);
-
- hash_pi3web_variables(ELS_C SLS_CC);
-
- switch ( lpCB->dwBehavior ) {
- case PHP_MODE_STANDARD:
- php_execute_script( &file_handle CLS_CC ELS_CC PLS_CC );
- break;
- case PHP_MODE_HIGHLIGHT: {
- zend_syntax_highlighter_ini syntax_highlighter_ini;
- if ( open_file_for_scanning( &file_handle CLS_CC ) == SUCCESS ) {
- php_get_highlight_struct( &syntax_highlighter_ini );
- zend_highlight( &syntax_highlighter_ini );
- /* fclose( file_handle.handle.fp ); */
- };
- };
- break;
- case PHP_MODE_INDENT:
- if ( open_file_for_scanning( &file_handle CLS_CC ) == SUCCESS ) {
- zend_indent();
- };
- /* fclose( file_handle.handle.fp ); */
- break;
- }
-
- if (SG(request_info).cookie_data) {
- efree(SG(request_info).cookie_data);
- };
-
- php_request_shutdown(NULL);
- return PIAPI_COMPLETED;
-}
-
-BOOL PHP4_startup() {
- tsrm_startup(1, 1, 0, NULL);
- sapi_startup(&pi3web_sapi_module);
- if (pi3web_sapi_module.startup) {
- pi3web_sapi_module.startup(&pi3web_sapi_module);
- };
- IWasLoaded = 1;
- return IWasLoaded;
-};
-
-BOOL PHP4_shutdown() {
- if (pi3web_sapi_module.shutdown) {
- pi3web_sapi_module.shutdown(&pi3web_sapi_module);
- };
- sapi_shutdown();
- tsrm_shutdown();
- IWasLoaded = 0;
- return !IWasLoaded;
-};
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/sapi/pi3web/pi3web_sapi.h b/sapi/pi3web/pi3web_sapi.h
deleted file mode 100644
index 8ca4392db0..0000000000
--- a/sapi/pi3web/pi3web_sapi.h
+++ /dev/null
@@ -1,95 +0,0 @@
-#ifndef _PI3WEB_SAPI_H_
-#define _PI3WEB_SAPI_H_
-
-#ifdef PHP_WIN32
-# include <windows.h>
-# include <httpext.h>
-# ifdef SAPI_EXPORTS
-# define MODULE_API __declspec(dllexport)
-# else
-# define MODULE_API __declspec(dllimport)
-# endif
-#else
-# define far
-# define MODULE_API
-
- typedef int BOOL;
- typedef void far *LPVOID;
- typedef LPVOID HCONN;
- typedef unsigned long DWORD;
- typedef DWORD far *LPDWORD;
- typedef char CHAR;
- typedef CHAR *LPSTR;
- typedef unsigned char BYTE;
- typedef BYTE far *LPBYTE;
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define PHP_MODE_STANDARD 0
-#define PHP_MODE_HIGHLIGHT 1
-#define PHP_MODE_INDENT 2
-
-//
-// passed to the procedure on a new request
-//
-typedef struct _CONTROL_BLOCK {
- void *pPIHTTP;
- DWORD cbSize; // size of this struct.
- HCONN ConnID; // Context number not to be modified!
- DWORD dwHttpStatusCode; // HTTP Status code
- CHAR lpszLogData[80]; // null terminated log info
-
- LPSTR lpszMethod; // REQUEST_METHOD
- LPSTR lpszQueryString; // QUERY_STRING
- LPSTR lpszPathInfo; // PATH_INFO
- LPSTR lpszPathTranslated; // PATH_TRANSLATED
- LPSTR lpszFileName; // FileName to PHP3 physical file
- LPSTR lpszUri; // The request URI
- LPSTR lpszReq; // The whole HTTP request line
- LPSTR lpszUser; // The authenticated user
- LPSTR lpszPassword; // The authenticated password
-
- DWORD cbTotalBytes; // Total bytes indicated from client
- DWORD cbAvailable; // Available number of bytes
- LPBYTE lpbData; // pointer to cbAvailable bytes
-
- LPSTR lpszContentType; // Content type of client data
- DWORD dwBehavior; // PHP behavior (standard, highlight, intend
-
- BOOL (* GetServerVariable) ( HCONN hConn,
- LPSTR lpszVariableName,
- LPVOID lpvBuffer,
- LPDWORD lpdwSize );
-
- BOOL (* WriteClient) ( HCONN ConnID,
- LPVOID Buffer,
- LPDWORD lpdwBytes,
- DWORD dwReserved );
-
- BOOL (* ReadClient) ( HCONN ConnID,
- LPVOID lpvBuffer,
- LPDWORD lpdwSize );
-
- BOOL (* SendHeaderFunction)( HCONN hConn,
- LPDWORD lpdwSize,
- LPDWORD lpdwDataType );
-
-} CONTROL_BLOCK, *LPCONTROL_BLOCK;
-
-MODULE_API DWORD PHP4_wrapper(LPCONTROL_BLOCK lpCB);
-MODULE_API BOOL PHP4_startup();
-MODULE_API BOOL PHP4_shutdown();
-
-// the following type declaration is for the server side
-typedef DWORD ( * PFN_WRAPPERFUNC )( CONTROL_BLOCK *pCB );
-
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // end definition _PI3WEB_SAPI_H_
diff --git a/sapi/roxen/Makefile.in b/sapi/roxen/Makefile.in
deleted file mode 100644
index c49bf97ead..0000000000
--- a/sapi/roxen/Makefile.in
+++ /dev/null
@@ -1,5 +0,0 @@
-
-LTLIBRARY_NAME = libsapi.la
-LTLIBRARY_SOURCES = roxen.c
-
-include $(top_srcdir)/build/ltlib.mk
diff --git a/sapi/roxen/README b/sapi/roxen/README
deleted file mode 100644
index c6ec30d272..0000000000
--- a/sapi/roxen/README
+++ /dev/null
@@ -1,18 +0,0 @@
-Roxen PHP support. Early version. Don't expect to be able to get it to
-work. Requires Pike 0.7.79 and Roxen 1.4. Anything less won't work.
-
-The module is now thread safe, in a couple of different modes. First
-mode, the default, uses a process global PHP lock in the Roxen
-module. This means that all PHP-requests are serialized (ie only one
-script is executed at any one time). The second option is using ZTS
-(Zend Thread Safe mode). Unless --enable-roxen-zts is specified, this
-won't be used.
-
-This solution now works fine and is recommended. Multiple PHP4
-requests will be run in parallell. The maximum number of parallell
-PHP4-execution is limited to the number of handle threads Roxen is
-started with.
-
-Support for this module is lacking. Please contact Roxen Internet
-Software for support and help. See http://www.roxen.com/company/contact/
-for contact information.
diff --git a/sapi/roxen/TODO b/sapi/roxen/TODO
deleted file mode 100644
index 4ba171accc..0000000000
--- a/sapi/roxen/TODO
+++ /dev/null
@@ -1,33 +0,0 @@
-BUGS:
-
-- fix backtraces
-- exit in PHP exits Roxen
-- POST newline added?
-- Rewriting header handling so that more than one header with the same
- name can be set (most importantly, cookies).
-- Recursive mutex lock problem:
-
- And another error (when trying to include a class)
-
- Recursive mutex locks!
- /Usr/local/pike/7.0.54/lib/modules/PHP4.so.Interpreter:
- run("/home/www/www.tx.pl/news/test.php",mapping[3],modules/scripting/php4.pike.PHPScript(),modules/scripting/php4.pike.PHPScript.done)
- modules/scripting/php4.pike:169: run()
- base_server/roxen.pike:569: handler_thread(3).
-
- And after this every access to any php script (on other virtual sites
- also) ends (of course there is no proper output) with this error:
-
- Php4.Interpreter->run: Tried to run a PHP-script from a PHP
- callback!/usr/local/pike/7.0.54/lib/modules/PHP4.so.Interpreter:
- run("/home/www/biall.com.pl/index.php3",mapping[2],modules/scripting/php4.pike.PHPScript(),modules/scripting/php4.pike.PHPScript.done)
- modules/scripting/php4.pike:169: run()
- base_server/roxen.pike:569: handler_thread(3).
-
-
-ADDITIONS:
-
-- use th_farm
-- change cwd in single threaded mode
-- per-virtual-server configuration
-
diff --git a/sapi/roxen/config.m4 b/sapi/roxen/config.m4
deleted file mode 100644
index 842e0547c9..0000000000
--- a/sapi/roxen/config.m4
+++ /dev/null
@@ -1,58 +0,0 @@
-dnl ## $Id$ -*- sh -*-
-
-RESULT=no
-AC_MSG_CHECKING(for Roxen/Pike support)
-AC_ARG_WITH(roxen,
-[ --with-roxen=DIR Build PHP as a Pike module. DIR is the base Roxen
- directory, normally /usr/local/roxen/server.],
-[
- if test ! -d $withval ; then
- AC_MSG_ERROR(You did not specify a directory)
- fi
- if test -f $withval/bin/roxen; then
- PIKE=$withval/bin/roxen
- elif test -f $withval/bin/pike; then
- PIKE=$withval/bin/pike
- else
- AC_MSG_ERROR(Couldn't find a pike in $withval/bin/)
- fi
- if $PIKE -e 'float v; catch(v = __VERSION__ + (__BUILD__/10000.0)); if(v < 0.7079) exit(1); exit(0);'; then
- PIKE_MODULE_DIR=`$PIKE --show-paths 2>&1| grep '^Module' | sed -e 's/.*: //'`
- PIKE_INCLUDE_DIR=`echo $PIKE_MODULE_DIR | sed -e 's,lib/pike/modules,include/pike,' -e 's,lib/modules,include/pike,'`
- if test -z "$PIKE_INCLUDE_DIR" -o -z "$PIKE_MODULE_DIR"; then
- AC_MSG_ERROR(Failed to figure out Pike module and include directories)
- fi
- else
- AC_MSG_ERROR(Roxen/PHP requires Pike 0.7.79 or newer)
- fi
-
- PHP_ADD_INCLUDE($PIKE_INCLUDE_DIR)
- AC_DEFINE(HAVE_ROXEN,1,[Whether you use Roxen])
- PHP_SAPI=roxen
- PHP_BUILD_SHARED
- INSTALL_IT="\$(INSTALL) -m 0755 $SAPI_SHARED $PIKE_MODULE_DIR/PHP4.so"
- RESULT="yes
- Pike binary used: $PIKE
- Pike include dir: $PIKE_INCLUDE_DIR
- Pike module directory: $PIKE_MODULE_DIR"
- PIKE_INCLUDE_DIR=" -I$PIKE_INCLUDE_DIR "
-])
-AC_MSG_RESULT($RESULT)
-
-if test "$RESULT" != "no" ; then
- RESULT=no
- AC_MSG_CHECKING(if Roxen should use ZTS)
- AC_ARG_ENABLE(roxen-zts,
- [ --enable-roxen-zts Build the Roxen module using Zend Thread Safety.],
- [
- PHP_BUILD_THREAD_SAFE
- AC_DEFINE(ROXEN_USE_ZTS,1,[Whether to use Roxen in ZTS mode])
- RESULT=yes
-
- ])
- AC_MSG_RESULT($RESULT)
-fi
-dnl ## Local Variables:
-dnl ## tab-width: 4
-dnl ## End:
-
diff --git a/sapi/roxen/roxen.c b/sapi/roxen/roxen.c
deleted file mode 100644
index 3aeed484d3..0000000000
--- a/sapi/roxen/roxen.c
+++ /dev/null
@@ -1,739 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: David Hedbor <neotron@php.net> |
- | Based on aolserver SAPI by Sascha Schumann <sascha@schumann.cx> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#include "php.h"
-#ifdef HAVE_ROXEN
-
-#include "php_ini.h"
-#include "php_globals.h"
-#include "SAPI.h"
-#include "php_main.h"
-#include "ext/standard/info.h"
-
-#include "php_version.h"
-
-#ifndef ZTS
-/* Only valid if thread safety is enabled. */
-#undef ROXEN_USE_ZTS
-#endif
-
-
-/* Pike Include Files
- *
- * conflicts with pike avoided by only using long names. Requires a new
- * Pike 0.7 since it was implemented for this interface only.
- *
- */
-#define NO_PIKE_SHORTHAND
-
-#include <fdlib.h>
-#include <program.h>
-#include <pike_types.h>
-#include <interpret.h>
-#include <module_support.h>
-#include <error.h>
-#include <array.h>
-#include <backend.h>
-#include <stralloc.h>
-#include <mapping.h>
-#include <object.h>
-#include <threads.h>
-#include <builtin_functions.h>
-#include <operators.h>
-
-#undef HIDE_GLOBAL_VARIABLES
-#undef REVEAL_GLOBAL_VARIABLES
-#define HIDE_GLOBAL_VARIABLES()
-#define REVEAL_GLOBAL_VARIABLES()
-
-/* php_roxen_request is per-request object storage */
-
-typedef struct
-{
- struct mapping *request_data;
- struct object *my_fd_obj;
- int my_fd;
- char *filename;
-} php_roxen_request;
-
-
-/* Defines to get to the data supplied when the script is started. */
-
-#ifdef ROXEN_USE_ZTS
-
-/* ZTS does work now, but it seems like it's faster using the "serialization"
- * method I previously used. Thus it's not used unless ROXEN_USE_ZTS is defined.
- */
-
-/* Per thread storage area id... */
-static int roxen_globals_id;
-
-# define GET_THIS() php_roxen_request *_request = ts_resource(roxen_globals_id)
-# define THIS _request
-#else
-static php_roxen_request *current_request = NULL;
-
-# define GET_THIS() current_request = ((php_roxen_request *)Pike_fp->current_storage)
-# define THIS current_request
-#endif
-
-/* File descriptor integer. Used to write directly to the FD without
- * passing Pike
- */
-#define MY_FD (THIS->my_fd)
-
-/* FD object. Really a PHPScript object from Pike which implements a couple
- * of functions to handle headers, writing and buffering.
- */
-#define MY_FD_OBJ ((struct object *)(THIS->my_fd_obj))
-
-/* Mapping with data supplied from the calling Roxen module. Contains
- * a mapping with headers, an FD object etc.
- */
-#define REQUEST_DATA ((struct mapping *)(THIS->request_data))
-
-
-#if defined(_REENTRANT) && !defined(ROXEN_USE_ZTS)
-/* Lock used to serialize the PHP execution. If ROXEN_USE_ZTS is defined, we
- * are using the PHP thread safe mechanism instead.
- */
-static PIKE_MUTEX_T roxen_php_execution_lock;
-# define PHP_INIT_LOCK() mt_init(&roxen_php_execution_lock)
-# define PHP_LOCK(X) THREADS_ALLOW();mt_lock(&roxen_php_execution_lock);THREADS_DISALLOW()
-# define PHP_UNLOCK(X) mt_unlock(&roxen_php_execution_lock);
-# define PHP_DESTROY() mt_destroy(&roxen_php_execution_lock)
-#else /* !_REENTRANT */
-# define PHP_INIT_LOCK()
-# define PHP_LOCK(X)
-# define PHP_UNLOCK(X)
-# define PHP_DESTROY()
-#endif /* _REENTRANT */
-
-extern int fd_from_object(struct object *o);
-static unsigned char roxen_php_initialized;
-
-/* This allows calling of pike functions from the PHP callbacks,
- * which requires the Pike interpreter to be locked.
- */
-#define THREAD_SAFE_RUN(COMMAND, what) do {\
- struct thread_state *state;\
- if((state = thread_state_for_id(th_self()))!=NULL) {\
- if(!state->swapped) {\
- COMMAND;\
- } else {\
- mt_lock(&interpreter_lock);\
- SWAP_IN_THREAD(state);\
- COMMAND;\
- SWAP_OUT_THREAD(state);\
- mt_unlock(&interpreter_lock);\
- }\
- }\
-} while(0)
-
-struct program *php_program;
-
-
-/* To avoid executing a PHP script from a PHP callback, which would
- * create a deadlock, a global thread id is used. If the thread calling the
- * php-script is the same as the current thread, it fails.
- */
-static int current_thread = -1;
-
-
-/* Low level header lookup. Basically looks for the named header in the mapping
- * headers in the supplied options mapping.
- */
-
-static INLINE struct svalue *lookup_header(char *headername)
-{
- struct svalue *headers, *value;
- struct pike_string *sind;
-#ifdef ROXEN_USE_ZTS
- GET_THIS();
-#endif
- sind = make_shared_string("env");
- headers = low_mapping_string_lookup(REQUEST_DATA, sind);
- free_string(sind);
- if(!headers || headers->type != PIKE_T_MAPPING) return NULL;
- sind = make_shared_string(headername);
- value = low_mapping_string_lookup(headers->u.mapping, sind);
- free_string(sind);
- if(!value) return NULL;
- return value;
-}
-
-/* Lookup a header in the mapping and return the value as a string, or
- * return the default if it's missing
- */
-INLINE static char *lookup_string_header(char *headername, char *default_value)
-{
- struct svalue *head = NULL;
- THREAD_SAFE_RUN(head = lookup_header(headername), "header lookup");
- if(!head || head->type != PIKE_T_STRING)
- return default_value;
- return head->u.string->str;
-}
-
-/* Lookup a header in the mapping and return the value as if it's an integer
- * and otherwise return the default.
- */
-INLINE static int lookup_integer_header(char *headername, int default_value)
-{
- struct svalue *head = NULL;
- THREAD_SAFE_RUN(head = lookup_header(headername), "header lookup");
- if(!head || head->type != PIKE_T_INT)
- return default_value;
- return head->u.integer;
-}
-
-/*
- * php_roxen_low_ub_write() writes data to the client connection. Might be
- * rewritten to do more direct IO to save CPU and the need to lock the *
- * interpreter for better threading.
- */
-
-static int
-php_roxen_low_ub_write(const char *str, uint str_length) {
- int sent_bytes = 0;
- struct pike_string *to_write = NULL;
-#ifdef ZTS
- PLS_FETCH();
-#endif
-#ifdef ROXEN_USE_ZTS
- GET_THIS();
-#endif
- if(!MY_FD_OBJ->prog) {
- PG(connection_status) = PHP_CONNECTION_ABORTED;
- zend_bailout();
- return -1;
- }
- to_write = make_shared_binary_string(str, str_length);
- push_string(to_write);
- safe_apply(MY_FD_OBJ, "write", 1);
- if(Pike_sp[-1].type == PIKE_T_INT)
- sent_bytes = Pike_sp[-1].u.integer;
- pop_stack();
- if(sent_bytes != str_length) {
- /* This means the connection is closed. Dead. Gone. *sniff* */
- php_handle_aborted_connection();
- }
- return sent_bytes;
-}
-
-/*
- * php_roxen_sapi_ub_write() calls php_roxen_low_ub_write in a Pike thread
- * safe manner.
- */
-
-static int
-php_roxen_sapi_ub_write(const char *str, uint str_length)
-{
-#ifdef ZTS
- PLS_FETCH();
-#endif
-#ifdef ROXEN_USE_ZTS
- GET_THIS();
-#endif
- int sent_bytes = 0, fd = MY_FD;
- if(fd)
- {
- for(sent_bytes=0;sent_bytes < str_length;)
- {
- int written;
- written = fd_write(fd, str + sent_bytes, str_length - sent_bytes);
- if(written < 0)
- {
- switch(errno)
- {
- default:
- /* This means the connection is closed. Dead. Gone. *sniff* */
- PG(connection_status) = PHP_CONNECTION_ABORTED;
- zend_bailout();
- return sent_bytes;
- case EINTR:
- case EWOULDBLOCK:
- continue;
- }
-
- } else {
- sent_bytes += written;
- }
- }
- } else {
- THREAD_SAFE_RUN(sent_bytes = php_roxen_low_ub_write(str, str_length),
- "write");
- }
- return sent_bytes;
-}
-
-/* php_roxen_set_header() sets a header in the header mapping. Called in a
- * thread safe manner from php_roxen_sapi_header_handler.
- */
-static void php_roxen_set_header(char *header_name, char *value, char *p)
-{
- struct svalue hsval;
- struct pike_string *hval, *ind, *hind;
- struct mapping *headermap;
- struct svalue *s_headermap;
-#ifdef ROXEN_USE_ZTS
- GET_THIS();
-#endif
- hval = make_shared_string(value);
- ind = make_shared_string(" _headers");
- hind = make_shared_binary_string(header_name,
- (int)(p - header_name));
-
- s_headermap = low_mapping_string_lookup(REQUEST_DATA, ind);
- if(!s_headermap)
- {
- struct svalue mappie;
- mappie.type = PIKE_T_MAPPING;
- headermap = allocate_mapping(1);
- mappie.u.mapping = headermap;
- mapping_string_insert(REQUEST_DATA, ind, &mappie);
- free_mapping(headermap);
- } else
- headermap = s_headermap->u.mapping;
-
- hsval.type = PIKE_T_STRING;
- hsval.u.string = hval;
- mapping_string_insert(headermap, hind, &hsval);
-
- free_string(hval);
- free_string(ind);
- free_string(hind);
-}
-
-/*
- * php_roxen_sapi_header_handler() sets a HTTP reply header to be
- * sent to the client.
- */
-static int
-php_roxen_sapi_header_handler(sapi_header_struct *sapi_header,
- sapi_headers_struct *sapi_headers SLS_DC)
-{
- char *header_name, *header_content, *p;
- header_name = sapi_header->header;
- header_content = p = strchr(header_name, ':');
-
- if(p) {
- do {
- header_content++;
- } while(*header_content == ' ');
- THREAD_SAFE_RUN(php_roxen_set_header(header_name, header_content, p), "header handler");
- }
- sapi_free_header(sapi_header);
- return 0;
-}
-
-/*
- * php_roxen_sapi_send_headers() flushes the headers to the client.
- * Called before real content is sent by PHP.
- */
-
-static int
-php_roxen_low_send_headers(sapi_headers_struct *sapi_headers SLS_DC)
-{
-#ifdef ZTS
- PLS_FETCH();
-#endif
- struct pike_string *ind;
- struct svalue *s_headermap;
-#ifdef ROXEN_USE_ZTS
- GET_THIS();
-#endif
- if(!MY_FD_OBJ->prog) {
- PG(connection_status) = PHP_CONNECTION_ABORTED;
- zend_bailout();
- return SAPI_HEADER_SEND_FAILED;
- }
- ind = make_shared_string(" _headers");
- s_headermap = low_mapping_string_lookup(REQUEST_DATA, ind);
- free_string(ind);
-
- push_int(SG(sapi_headers).http_response_code);
- if(s_headermap && s_headermap->type == PIKE_T_MAPPING)
- ref_push_mapping(s_headermap->u.mapping);
- else
- push_int(0);
- safe_apply(MY_FD_OBJ, "send_headers", 2);
- pop_stack();
-
- return SAPI_HEADER_SENT_SUCCESSFULLY;
-}
-
-static int
-php_roxen_sapi_send_headers(sapi_headers_struct *sapi_headers SLS_DC)
-{
- int res = 0;
- THREAD_SAFE_RUN(res = php_roxen_low_send_headers(sapi_headers SLS_CC), "send headers");
- return res;
-}
-
-/*
- * php_roxen_sapi_read_post() reads a specified number of bytes from
- * the client. Used for POST/PUT requests.
- */
-
-INLINE static int php_roxen_low_read_post(char *buf, uint count_bytes)
-{
- uint total_read = 0;
-#ifdef ROXEN_USE_ZTS
- GET_THIS();
-#endif
-#ifdef ZTS
- PLS_FETCH();
-#endif
-
- if(!MY_FD_OBJ->prog)
- {
- PG(connection_status) = PHP_CONNECTION_ABORTED;
- zend_bailout();
- return -1;
- }
- push_int(count_bytes);
- safe_apply(MY_FD_OBJ, "read_post", 1);
- if(Pike_sp[-1].type == PIKE_T_STRING) {
- MEMCPY(buf, Pike_sp[-1].u.string->str,
- (total_read = Pike_sp[-1].u.string->len));
- buf[total_read] = '\0';
- } else
- total_read = 0;
- pop_stack();
- return total_read;
-}
-
-static int
-php_roxen_sapi_read_post(char *buf, uint count_bytes SLS_DC)
-{
- uint total_read = 0;
- THREAD_SAFE_RUN(total_read = php_roxen_low_read_post(buf, count_bytes), "read post");
- return total_read;
-}
-
-/*
- * php_roxen_sapi_read_cookies() returns the Cookie header from
- * the HTTP request header
- */
-
-static char *
-php_roxen_sapi_read_cookies(SLS_D)
-{
- char *cookies;
- cookies = lookup_string_header("HTTP_COOKIE", NULL);
- return cookies;
-}
-
-static void php_info_roxen(ZEND_MODULE_INFO_FUNC_ARGS)
-{
- /* char buf[512]; */
- php_info_print_table_start();
- php_info_print_table_row(2, "SAPI module version", "$Id$");
- /* php_info_print_table_row(2, "Build date", Ns_InfoBuildDate());
- php_info_print_table_row(2, "Config file path", Ns_InfoConfigFile());
- php_info_print_table_row(2, "Error Log path", Ns_InfoErrorLog());
- php_info_print_table_row(2, "Installation path", Ns_InfoHomePath());
- php_info_print_table_row(2, "Hostname of server", Ns_InfoHostname());
- php_info_print_table_row(2, "Source code label", Ns_InfoLabel());
- php_info_print_table_row(2, "Server platform", Ns_InfoPlatform());
- snprintf(buf, 511, "%s/%s", Ns_InfoServerName(), Ns_InfoServerVersion());
- php_info_print_table_row(2, "Server version", buf);
- snprintf(buf, 511, "%d day(s), %02d:%02d:%02d",
- uptime / 86400,
- (uptime / 3600) % 24,
- (uptime / 60) % 60,
- uptime % 60);
- php_info_print_table_row(2, "Server uptime", buf);
- */
- php_info_print_table_end();
-}
-
-static zend_module_entry php_roxen_module = {
- "Roxen",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- php_info_roxen,
- STANDARD_MODULE_PROPERTIES
-};
-
-static int php_roxen_startup(sapi_module_struct *sapi_module)
-{
- if(php_module_startup(sapi_module) == FAILURE
- || zend_startup_module(&php_roxen_module) == FAILURE) {
- return FAILURE;
- } else {
- return SUCCESS;
- }
-}
-
-/* this structure is static (as in "it does not change") */
-
-static sapi_module_struct roxen_sapi_module = {
- "roxen",
- "Roxen",
- php_module_startup, /* startup */
- php_module_shutdown_wrapper, /* shutdown */
- NULL, /* activate */
- NULL, /* deactivate */
- php_roxen_sapi_ub_write, /* unbuffered write */
- NULL, /* flush */
- NULL, /* get uid */
- NULL, /* getenv */
- php_error, /* error handler */
- php_roxen_sapi_header_handler, /* header handler */
- php_roxen_sapi_send_headers, /* send headers handler */
- NULL, /* send header handler */
- php_roxen_sapi_read_post, /* read POST data */
- php_roxen_sapi_read_cookies, /* read Cookies */
- NULL, /* register server variables */
- NULL, /* Log message */
- NULL, /* Block interruptions */
- NULL, /* Unblock interruptions */
-
- STANDARD_SAPI_MODULE_PROPERTIES
-};
-
-/*
- * php_roxen_hash_environment() populates the php script environment
- * with a number of variables. HTTP_* variables are created for
- * the HTTP header data, so that a script can access these.
- */
-#define ADD_STRING(name) \
- MAKE_STD_ZVAL(pval); \
- pval->type = IS_STRING; \
- pval->value.str.len = strlen(buf); \
- pval->value.str.val = estrndup(buf, pval->value.str.len); \
- zend_hash_update(&EG(symbol_table), name, sizeof(name), \
- &pval, sizeof(zval *), NULL)
-
-static void
-php_roxen_hash_environment(CLS_D ELS_DC PLS_DC SLS_DC)
-{
- int i;
- char buf[512];
- zval *pval;
- struct svalue *headers;
- struct pike_string *sind;
- struct array *indices;
- struct svalue *ind, *val;
-#ifdef ROXEN_USE_ZTS
- GET_THIS();
-#endif
- sind = make_shared_string("env");
- headers = low_mapping_string_lookup(REQUEST_DATA, sind);
- free_string(sind);
- if(headers && headers->type == PIKE_T_MAPPING) {
- indices = mapping_indices(headers->u.mapping);
- for(i = 0; i < indices->size; i++) {
- ind = &indices->item[i];
- val = low_mapping_lookup(headers->u.mapping, ind);
- if(ind && ind->type == PIKE_T_STRING &&
- val && val->type == PIKE_T_STRING) {
- int buf_len;
- buf_len = MIN(511, ind->u.string->len);
- strncpy(buf, ind->u.string->str, buf_len);
- buf[buf_len] = '\0'; /* Terminate correctly */
- MAKE_STD_ZVAL(pval);
- pval->type = IS_STRING;
- pval->value.str.len = val->u.string->len;
- pval->value.str.val = estrndup(val->u.string->str, pval->value.str.len);
-
- zend_hash_update(&EG(symbol_table), buf, buf_len + 1, &pval, sizeof(zval *), NULL);
- }
- }
- free_array(indices);
- }
-
- /*
- MAKE_STD_ZVAL(pval);
- pval->type = IS_LONG;
- pval->value.lval = Ns_InfoBootTime();
- zend_hash_update(&EG(symbol_table), "SERVER_BOOTTIME", sizeof("SERVER_BOOTTIME"), &pval, sizeof(zval *), NULL);
- */
-}
-
-/*
- * php_roxen_module_main() is called by the per-request handler and
- * "executes" the script
- */
-
-static int php_roxen_module_main(SLS_D)
-{
- int res, len;
- char *dir;
- zend_file_handle file_handle;
-#ifdef ZTS
- CLS_FETCH();
- PLS_FETCH();
- ELS_FETCH();
-#ifdef ROXEN_USE_ZTS
- GET_THIS();
-#endif
-#endif
-
- file_handle.type = ZEND_HANDLE_FILENAME;
- file_handle.filename = THIS->filename;
- file_handle.free_filename = 0;
- file_handle.opened_path = NULL;
-
- THREADS_ALLOW();
- res = php_request_startup(CLS_C ELS_CC PLS_CC SLS_CC);
- THREADS_DISALLOW();
- if(res == FAILURE) {
- return 0;
- }
- php_roxen_hash_environment(CLS_C ELS_CC PLS_CC SLS_CC);
- THREADS_ALLOW();
- php_execute_script(&file_handle CLS_CC ELS_CC PLS_CC);
- php_request_shutdown(NULL);
- THREADS_DISALLOW();
- return 1;
-}
-
-/*
- * The php_roxen_request_handler() is called per request and handles
- * everything for one request.
- */
-
-void f_php_roxen_request_handler(INT32 args)
-{
- struct object *my_fd_obj;
- struct mapping *request_data;
- struct svalue *done_callback, *raw_fd;
- struct pike_string *script, *ind;
- int status = 1;
- SLS_FETCH();
-#ifdef ROXEN_USE_ZTS
- GET_THIS();
-#endif
-
- if(current_thread == th_self())
- error("PHP4.Interpreter->run: Tried to run a PHP-script from a PHP "
- "callback!");
- get_all_args("PHP4.Interpreter->run", args, "%S%m%O%*", &script,
- &request_data, &my_fd_obj, &done_callback);
- if(done_callback->type != PIKE_T_FUNCTION)
- error("PHP4.Interpreter->run: Bad argument 4, expected function.\n");
- PHP_LOCK(THIS); /* Need to lock here or reusing the same object might cause
- * problems in changing stuff in that object */
-#ifndef ROXEN_USE_ZTS
- GET_THIS();
-#endif
- THIS->request_data = request_data;
- THIS->my_fd_obj = my_fd_obj;
- THIS->filename = script->str;
- current_thread = th_self();
- SG(request_info).query_string = lookup_string_header("QUERY_STRING", 0);
- SG(server_context) = (void *)1; /* avoid server_context == NULL */
-
- /* path_translated is apparently the absolute path to the file, not
- the translated PATH_INFO
- */
- SG(request_info).path_translated =
- lookup_string_header("SCRIPT_FILENAME", NULL);
- SG(request_info).request_uri = lookup_string_header("DOCUMENT_URI", NULL);
- if(!SG(request_info).request_uri)
- SG(request_info).request_uri = lookup_string_header("SCRIPT_NAME", NULL);
- SG(request_info).request_method = lookup_string_header("REQUEST_METHOD", "GET");
- SG(request_info).content_length = lookup_integer_header("HTTP_CONTENT_LENGTH", 0);
- SG(request_info).content_type = lookup_string_header("HTTP_CONTENT_TYPE", NULL);
- SG(sapi_headers).http_response_code = 200;
-
- /* FIXME: Check for auth stuff needs to be fixed... */
- SG(request_info).auth_user = NULL;
- SG(request_info).auth_password = NULL;
-
- ind = make_shared_binary_string("my_fd", 5);
- raw_fd = low_mapping_string_lookup(THIS->request_data, ind);
- if(raw_fd && raw_fd->type == PIKE_T_OBJECT)
- {
- int fd = fd_from_object(raw_fd->u.object);
- if(fd == -1)
- error("PHP4.Interpreter->run: my_fd object not open or not an FD.\n");
- THIS->my_fd = fd;
- } else
- THIS->my_fd = 0;
-
- status = php_roxen_module_main(SLS_C);
- current_thread = -1;
-
- apply_svalue(done_callback, 0);
- pop_stack();
- pop_n_elems(args);
- push_int(status);
- PHP_UNLOCK(THIS);
-}
-
-
-/* Clear the object global struct */
-static void clear_struct(struct object *o)
-{
- MEMSET(Pike_fp->current_storage, 0, sizeof(php_roxen_request));
-}
-
-
-/*
- * pike_module_init() is called by Pike once at startup
- *
- * This functions allocates basic structures
- */
-
-void pike_module_init( void )
-{
- if (!roxen_php_initialized) {
-#ifdef ZTS
- tsrm_startup(1, 1, 0, NULL);
-#ifdef ROXEN_USE_ZTS
- roxen_globals_id = ts_allocate_id(sizeof(php_roxen_request), NULL, NULL);
-#endif
-#endif
- sapi_startup(&roxen_sapi_module);
- php_roxen_startup(&roxen_sapi_module);
- roxen_php_initialized = 1;
- PHP_INIT_LOCK();
- }
- start_new_program(); /* Text */
- ADD_STORAGE(php_roxen_request);
- set_init_callback(clear_struct);
- pike_add_function("run", f_php_roxen_request_handler,
- "function(string,mapping,object,function:int)", 0);
- add_program_constant("Interpreter", (php_program = end_program()), 0);
-}
-
-/*
- * pike_module_exit() performs the last steps before the
- * server exists. Shutdowns basic services and frees memory
- */
-
-void pike_module_exit(void)
-{
- roxen_php_initialized = 0;
- roxen_sapi_module.shutdown(&roxen_sapi_module);
- if(php_program) free_program(php_program);
-#ifdef ZTS
- tsrm_shutdown();
-#endif
- PHP_DESTROY();
-}
-#endif
diff --git a/sapi/servlet/CREDITS b/sapi/servlet/CREDITS
deleted file mode 100644
index ae4e83e1e2..0000000000
--- a/sapi/servlet/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-Java Servlet
-Sam Ruby
diff --git a/sapi/servlet/Makefile.in b/sapi/servlet/Makefile.in
deleted file mode 100644
index 940866b7fc..0000000000
--- a/sapi/servlet/Makefile.in
+++ /dev/null
@@ -1,30 +0,0 @@
-
-LTLIBRARY_NAME = libsapi.la
-LTLIBRARY_SOURCES = servlet.c java.c
-LTLIBRARY_DEPENDENCIES = phpsrvlt.jar
-
-EXTRA_CFLAGS = $(JAVA_CFLAGS)
-EXTRA_INCLUDES = $(JAVA_INCLUDE)
-
-include $(top_srcdir)/build/ltlib.mk
-
-java.c : ../../ext/java/java.c
- @cp ../../ext/java/java.c .
-
-phpsrvlt.jar : servlet.java ../../ext/java/reflect.java
- $(mkinstalldirs) net/php
- @echo library=php4>net/php/reflect.properties
- @echo library=php4>net/php/servlet.properties
- @cp formatter.java net/php
- @cp servlet.java net/php
- @cp ../../ext/java/reflect.java net/php
- javac net/php/reflect.java
- @test ! -f reflect.class || mv reflect.class net/php # bug in KJC javac
- javac -classpath .:$(SERVLET_CLASSPATH):$(CLASSPATH) net/php/servlet.java
- @test ! -f servlet.class || mv servlet.class net/php # bug in KJC javac
- javac -classpath .:$(SERVLET_CLASSPATH):$(CLASSPATH) net/php/formatter.java
- @test ! -f formatter.class || mv formatter.class net/php # bug in KJC javac
- $(JAVA_JAR) phpsrvlt.jar net/php/*.class net/php/*.properties
- @rm net/php/servlet.* net/php/reflect.* net/php/formatter.*
- @rmdir net/php
- @rmdir net
diff --git a/sapi/servlet/README b/sapi/servlet/README
deleted file mode 100644
index 1a93186353..0000000000
--- a/sapi/servlet/README
+++ /dev/null
@@ -1,42 +0,0 @@
-What is PHP4 sapi/servlet?
-
- PHP4 sapi/servlet builds upon the mechanism defined by ext/java to enable
- the entire PHP processor to be run as a servlet. The primary advanatage
- of this from a PHP perspective is that web servers which support servlets
- typically take great care in pooling and reusing JVMs.
-
- Notes:
-
- 1) While this code is intended to be able to run on any servlet engine,
- it has only been tested on Apache's Jakarta/tomcat to date. Bug
- reports, success stories and/or patches required to get this code
- to run on other engines would be appreciated.
-
- 2) PHP has a habit of changing the working directory. Sapi/servlet will
- eventually change it back, but while PHP is running the servlet engine
- may not be able to load any classes from the CLASSPATH which are
- specified using a relative directory syntax, or find the work directory
- used for administration and JSP compilation tasks.
-
-Build and execution instructions:
-
- Most of the configuration hassles associated with ext/java are associated
- with starting the JVM, and as such do not apply to sapi/servlet. In
- particular, no updates to php.ini are required on any operating system.
-
- Unix:
- Build:
- ./configure --with-servlet --with-java
- Execute:
- add phpsrvlt.jar to CLASSPATH
- add directory containing libphp4.so to LD_LIBRARY_PATH
- merge/overwrite build/tomcat/examples/WEB-INF/web.xml from sapi/servlet
-
- Win32:
- Build:
- add jdsk (or d:\build\tomcat\classes) to CLASSPATH
- build sapi\servlet\servlet.dsp
- Execute:
- add phpsrvlt.jar to CLASSPATH
- add directory containing php4ts.dll and phpsrvlt.dll to PATH
- merge/overwrite build\tomcat\examples\WEB-INF\web.xml from sapi\servlet
diff --git a/sapi/servlet/config.m4 b/sapi/servlet/config.m4
deleted file mode 100644
index bc0badb53c..0000000000
--- a/sapi/servlet/config.m4
+++ /dev/null
@@ -1,48 +0,0 @@
-# $Id$
-# config.m4 for servlet sapi
-
-AC_MSG_CHECKING(for Servlet support)
-AC_ARG_WITH(servlet,
-[ --with-servlet[=DIR] Include servlet support. DIR is the base install
- directory for the JSDK. This SAPI prereqs the
- java extension must be built as a shared dl.],
-[
- if test "$withval" != "no"; then
-
- if test "$withval" = "yes"; then
- SERVLET_CLASSPATH=.
- else
- if test -f $withval/lib/servlet.jar; then
- SERVLET_CLASSPATH=$withval/lib/servlet.jar
- fi
-
- if test -f $withval/lib/jsdk.jar; then
- SERVLET_CLASSPATH=$withval/lib/jsdk.jar
- fi
-
- if test -d $withval/javax; then
- SERVLET_CLASSPATH=$withval
- fi
-
- if test -z "$SERVLET_CLASSPATH"; then
- AC_MSG_RESULT(no)
- AC_MSG_ERROR(unable to find servlet libraries)
- fi
- fi
-
- AC_DEFINE(SAPI_SERVLET, 1, [Whether you use Servlet])
-
- INSTALL_IT="\$(INSTALL) -m 0755 \$(srcdir)/sapi/servlet/phpsrvlt.jar \$(libdir)"
- INSTALL_IT="$INSTALL_IT; \$(INSTALL) -m 0755 $SAPI_SHARED \$(libdir)"
- PHP_SAPI=servlet
- PHP_BUILD_SHARED
- PHP_BUILD_THREAD_SAFE
- AC_MSG_RESULT(yes)
- else
- AC_MSG_RESULT(no)
- fi
-],[
- AC_MSG_RESULT(no)
-])
-
-PHP_SUBST(SERVLET_CLASSPATH)
diff --git a/sapi/servlet/cookies.php b/sapi/servlet/cookies.php
deleted file mode 100644
index bcc4c40aae..0000000000
--- a/sapi/servlet/cookies.php
+++ /dev/null
@@ -1,41 +0,0 @@
-<html>
-<body bgcolor="white">
-<head>
-<title>Cookies Example</title>
-</head>
-<body>
-<h3>Cookies Example</h3>
-
-<?
- $cookies = $request->cookies;
-
- // print out cookies
-
- if (!current($cookies)) {
- echo "Your browser isn't sending any cookies\n";
- } else {
- echo "Your browser is sending the following cookies:<br>\n";
-
- foreach ($cookies as $cookie) {
- echo "Cookie Name: $cookie->name<br>Cookie value: $cookie->value<br>\n";
- }
- }
-
- // set a cookie
-
- if ($cookieName) {
- $response->addCookie(new Java("javax.servlet.http.Cookie", $cookieName, $cookieValue));
- echo "<p>You just sent the following cookie to your browser:<br>\n";
- echo "Name: $cookieName<br>Value: $cookieValue<P>\n";
- }
-
-?>
-<P>
-Create a cookie to send to your browser<br>
-<form action="<?PHP echo $PHP_SELF ?>" method=POST>
-Name: <input type=text length=20 name=cookieName><br>
-Value: <input type=text length=20 name=cookieValue><br>
-<input type=submit></form>
-</body>
-</html>
-
diff --git a/sapi/servlet/date.php b/sapi/servlet/date.php
deleted file mode 100644
index 1146d31fab..0000000000
--- a/sapi/servlet/date.php
+++ /dev/null
@@ -1,28 +0,0 @@
-<html>
-<!--
- Copyright (c) 1999 The Apache Software Foundation. All rights
- reserved.
--->
-
-<body bgcolor="white">
-<?php $clock=new Java("dates.JspCalendar"); ?>
-
-<font size=4>
-<ul>
-<li> Day of month: is <?php echo $clock->dayOfMonth ?>
-<li> Year: is <?php echo $clock->year ?>
-<li> Month: is <?php echo $clock->month ?>
-<li> Time: is <?php echo $clock->time ?>
-<li> Date: is <?php echo $clock->date ?>
-<li> Day: is <?php echo $clock->day ?>
-<li> Day Of Year: is <?php echo $clock->dayOfYear ?>
-<li> Week Of Year: is <?php echo $clock->weekOfYear ?>
-<li> era: is <?php echo $clock->era ?>
-<li> DST Offset: is <?php echo $clock->dSTOffset ?>
-<li> Zone Offset: is <?php echo $clock->zoneOffset ?>
-</ul>
-</font>
-
-</body>
-</html>
-
diff --git a/sapi/servlet/formatter.java b/sapi/servlet/formatter.java
deleted file mode 100644
index 4827f14e6a..0000000000
--- a/sapi/servlet/formatter.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Sam Ruby (rubys@us.ibm.com) |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-package net.php;
-
-import javax.servlet.*;
-import javax.servlet.http.*;
-
-public class formatter extends servlet {
-
- public void service(HttpServletRequest request,
- HttpServletResponse response)
- throws ServletException
- {
- display_source_mode = true;
- super.service(request, response);
- }
-
-}
diff --git a/sapi/servlet/jinfo.php b/sapi/servlet/jinfo.php
deleted file mode 100644
index f20bbfb27d..0000000000
--- a/sapi/servlet/jinfo.php
+++ /dev/null
@@ -1,5 +0,0 @@
-<?
-
- phpinfo();
-
-?>
diff --git a/sapi/servlet/jver.php b/sapi/servlet/jver.php
deleted file mode 100644
index e5e029c6e4..0000000000
--- a/sapi/servlet/jver.php
+++ /dev/null
@@ -1,17 +0,0 @@
-<html>
-<?
-
- $system = new Java("java.lang.System");
- print "Java version=".$system->getProperty("java.version")." <br>\n";
- print "Java vendor=".$system->getProperty("java.vendor")." <p>\n\n";
- print "OS=".$system->getProperty("os.name")." ".
- $system->getProperty("os.version")." on ".
- $system->getProperty("os.arch")." <br>\n";
-
- $formatter = new Java("java.text.SimpleDateFormat",
- "EEEE, MMMM dd, yyyy 'at' h:mm:ss a zzzz");
-
- print $formatter->format(new Java("java.util.Date"))."\n";
-
-?>
-</html>
diff --git a/sapi/servlet/reqheaders.php b/sapi/servlet/reqheaders.php
deleted file mode 100644
index db04aed3dc..0000000000
--- a/sapi/servlet/reqheaders.php
+++ /dev/null
@@ -1,24 +0,0 @@
-<html>
-<body bgcolor="white">
-<head>
-<title>Request Header Example</title>
-</head>
-<body>
-<h3>Request Header Example</h3>
-<table border=0>
-
-<?php
-
- $e = $request->headerNames;
- while ($e->hasMoreElements()) {
- $name = $e->nextElement();
- $value = $request->getHeader($name);
- print "<tr><td bgcolor=\"#CCCCCC\">$name\n";
- print "</td><td>$value</td></tr>\n";
- }
-
-?>
-
-</table>
-</body>
-</html>
diff --git a/sapi/servlet/reqinfo.php b/sapi/servlet/reqinfo.php
deleted file mode 100644
index 37d453baf9..0000000000
--- a/sapi/servlet/reqinfo.php
+++ /dev/null
@@ -1,29 +0,0 @@
-<html>
-<body>
-<head>
-<title>Request Information Example</title>
-</head>
-<body bgcolor="white">
-<h3>Request Information Example</h3>
-<table border=0><tr><td>
-Method:
-</td><td>
-<?php print $request->method ?>
-</td></tr><tr><td>
-Request URI:
-</td><td>
-<?php print $request->requestURI ?>
-</td></tr><tr><td>
-Protocol:
-</td><td>
-<?php print $request->protocol ?>
-</td></tr><tr><td>
-Path Info:
-</td><td>
-<?php print $request->pathInfo ?>
-</td></tr><tr><td>
-Remote Address:
-</td><td>
-<?php print $request->remoteAddr ?>
-</table>
-
diff --git a/sapi/servlet/reqparams.php b/sapi/servlet/reqparams.php
deleted file mode 100644
index f968b2753d..0000000000
--- a/sapi/servlet/reqparams.php
+++ /dev/null
@@ -1,35 +0,0 @@
-<html>
-<body>
-<head>
-<title>Request Parameters Example</title>
-</head>
-<body bgcolor="white">
-<h3>Request Parameters Example</h3>
-Parameters in this request:<br>
-<?php
- $e = $request->getParameterNames();
-
- if (!$e->hasMoreElements()) {
- echo "No Parameters, Please enter some";
- }
-
- while ($e->hasMoreElements()) {
- $name = $e->nextElement();
- $value = $request->getParameter($name);
- echo "$name = $value<br>\n";
- }
-
-?>
-<P>
-<form action="<?php echo $PHP_SELF ?>" method=POST>
-First Name:
-<input type=text size=20 name=firstname>
-<br>
-Last Name:
-<input type=text size=20 name=lastname>
-<br>
-<input type=submit>
-</form>
-</body>
-</html>
-
diff --git a/sapi/servlet/servlet.c b/sapi/servlet/servlet.c
deleted file mode 100644
index cc5e583c5e..0000000000
--- a/sapi/servlet/servlet.c
+++ /dev/null
@@ -1,423 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Sam Ruby (rubys@us.ibm.com) |
- +----------------------------------------------------------------------+
-*/
-
-#include <jni.h>
-
-#include "php.h"
-#include "php_globals.h"
-
-#include "SAPI.h"
-
-#include <stdio.h>
-#include "php.h"
-#ifdef PHP_WIN32
-#include "win32/time.h"
-#include "win32/signal.h"
-#include <process.h>
-#else
-#include "build-defs.h"
-#endif
-#if HAVE_SYS_TIME_H
-#include <sys/time.h>
-#endif
-#if HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#if HAVE_SIGNAL_H
-#include <signal.h>
-#endif
-#if HAVE_SETLOCALE
-#include <locale.h>
-#endif
-#include "zend.h"
-#include "php_ini.h"
-#include "php_globals.h"
-#include "php_main.h"
-#include "fopen_wrappers.h"
-#include "ext/standard/php_standard.h"
-#include "ext/standard/php_dir.h"
-#ifdef PHP_WIN32
-#include <io.h>
-#include <fcntl.h>
-#include "win32/php_registry.h"
-#endif
-
-#include "zend_compile.h"
-#include "zend_execute.h"
-#include "zend_highlight.h"
-#include "zend_indent.h"
-
-JNIEXPORT void JNICALL Java_net_php_reflect_setEnv
- (JNIEnv *newJenv, jclass self);
-
-typedef struct {
- JNIEnv *jenv;
- jobject servlet;
- char *cookies;
-} servlet_request;
-
-extern zend_module_entry java_module_entry;
-
-static zend_module_entry *additional_php_extensions[] = {
- &java_module_entry
-};
-
-#define EXTCOUNT (sizeof(additional_php_extensions)/sizeof(zend_module_entry *))
-
-/***************************************************************************/
-
-/*
- * JNI convenience utilities
- */
-
-#define SETSTRING(target, source) \
- { const char *UTFString; \
- if (source) { \
- UTFString = (*jenv)->GetStringUTFChars(jenv, source, 0); \
- target = estrdup(UTFString); \
- (*jenv)->ReleaseStringUTFChars(jenv, source, UTFString); \
- } else { \
- target = 0; \
- } }
-
-#define FREESTRING(target) \
- { if (target) { efree(target); target=0; } }
-
-void ThrowIOException (JNIEnv *jenv, char *msg) {
- jclass iox = (*jenv)->FindClass (jenv, "java/io/IOException");
- (*jenv)->ThrowNew (jenv, iox, (msg?msg:"null") );
-}
-
-void ThrowServletException (JNIEnv *jenv, char *msg) {
- jclass sx = (*jenv)->FindClass (jenv, "javax/servlet/ServletException");
- (*jenv)->ThrowNew (jenv, sx, msg);
-}
-
-/***************************************************************************/
-
-/*
- * sapi callbacks
- */
-
-static int sapi_servlet_ub_write(const char *str, uint str_length)
-{
- SLS_FETCH();
- if (!SG(server_context)) {
- fprintf(stderr, str);
- return 0;
- }
-
- {
- JNIEnv *jenv = ((servlet_request*)SG(server_context))->jenv;
- jobject servlet = ((servlet_request*)SG(server_context))->servlet;
-
- jclass servletClass = (*jenv)->GetObjectClass(jenv, servlet);
- jmethodID write = (*jenv)->GetMethodID(jenv, servletClass, "write",
- "(Ljava/lang/String;)V");
- char *copy = malloc(str_length+1);
- jstring arg;
- memcpy(copy, str, str_length);
- copy[str_length] = 0;
- arg=(*jenv)->NewStringUTF(jenv, copy);
- free(copy);
- (*jenv)->CallVoidMethod(jenv, servlet, write, arg);
- (*jenv)->DeleteLocalRef(jenv, arg);
- return str_length;
- }
-}
-
-
-static void sapi_servlet_send_header(sapi_header_struct *sapi_header, void *server_context)
-{
- SLS_FETCH();
- if (!sapi_header) return;
- if (!SG(server_context)) return;
-
- {
- JNIEnv *jenv = ((servlet_request*)SG(server_context))->jenv;
- jobject servlet = ((servlet_request*)SG(server_context))->servlet;
-
- jclass servletClass = (*jenv)->GetObjectClass(jenv, servlet);
- jmethodID header = (*jenv)->GetMethodID(jenv, servletClass, "header",
- "(Ljava/lang/String;)V");
- jstring arg=(*jenv)->NewStringUTF(jenv, sapi_header->header);
- (*jenv)->CallVoidMethod(jenv, servlet, header, arg);
- (*jenv)->DeleteLocalRef(jenv, arg);
- }
-}
-
-
-static int sapi_servlet_read_post(char *buffer, uint count_bytes SLS_DC)
-{
- if (count_bytes == 0) {
- return 0;
- } else {
- JNIEnv *jenv = ((servlet_request*)SG(server_context))->jenv;
- jobject servlet = ((servlet_request*)SG(server_context))->servlet;
-
- jclass servletClass = (*jenv)->GetObjectClass(jenv, servlet);
- jmethodID readPost = (*jenv)->GetMethodID(jenv, servletClass,
- "readPost", "(I)Ljava/lang/String;");
- jstring post = (*jenv)->CallObjectMethod(jenv, servlet, readPost,
- count_bytes);
-
- const char *postAsUTF = (*jenv)->GetStringUTFChars(jenv, post, 0);
- uint read_bytes=(*jenv)->GetStringLength(jenv, post);
- if (read_bytes>count_bytes) read_bytes=count_bytes;
-
- memcpy(buffer, postAsUTF, read_bytes);
- if (read_bytes<count_bytes) buffer[read_bytes]=0;
-
- (*jenv)->ReleaseStringUTFChars(jenv, post, postAsUTF);
-
- return read_bytes;
- }
-}
-
-
-static char *sapi_servlet_read_cookies(SLS_D)
-{
- JNIEnv *jenv = ((servlet_request*)SG(server_context))->jenv;
- jobject servlet = ((servlet_request*)SG(server_context))->servlet;
-
- jclass servletClass = (*jenv)->GetObjectClass(jenv, servlet);
- jmethodID readCookies = (*jenv)->GetMethodID(jenv, servletClass,
- "readCookies", "()Ljava/lang/String;");
- jstring cookies = (*jenv)->CallObjectMethod(jenv, servlet, readCookies);
-
- SETSTRING( ((servlet_request*)SG(server_context))->cookies, cookies);
-
- return ((servlet_request*)SG(server_context))->cookies;
-}
-
-/***************************************************************************/
-
-/*
- * sapi maintenance
- */
-
-static sapi_module_struct servlet_sapi_module = {
- "java_servlet", /* name */
- "Java Servlet", /* pretty name */
-
- php_module_startup, /* startup */
- php_module_shutdown_wrapper, /* shutdown */
-
- NULL, /* activate */
- NULL, /* deactivate */
-
- sapi_servlet_ub_write, /* unbuffered write */
- NULL, /* flush */
- NULL, /* get uid */
- NULL, /* getenv */
-
- php_error, /* error handler */
-
- NULL, /* header handler */
- NULL, /* send headers handler */
- sapi_servlet_send_header, /* send header handler */
-
- sapi_servlet_read_post, /* read POST data */
- sapi_servlet_read_cookies, /* read Cookies */
-
- NULL, /* register server variables */
- NULL, /* Log message */
-
- NULL, /* Block interruptions */
- NULL, /* Unblock interruptions */
-
- STANDARD_SAPI_MODULE_PROPERTIES
-};
-
-
-JNIEXPORT void JNICALL Java_net_php_servlet_startup
- (JNIEnv *jenv, jobject self)
-{
-
-#ifdef ZTS
- tsrm_startup(1, 1, 0, NULL);
-#else
- if (setjmp(EG(bailout))!=0) {
- ThrowServletException(jenv,"bailout");
- return;
- }
-#endif
-
- sapi_startup(&servlet_sapi_module);
-
- if (php_module_startup(&servlet_sapi_module)==FAILURE) {
- ThrowServletException(jenv,"module startup failure");
- return;
- }
-
- if (php_startup_extensions(additional_php_extensions, EXTCOUNT)==FAILURE) {
- ThrowServletException(jenv,"extension startup failure");
- return;
- }
-
-}
-
-
-JNIEXPORT void JNICALL Java_net_php_servlet_shutdown
- (JNIEnv *jenv, jobject self)
-{
- php_module_shutdown();
- php_global_shutdown_extensions(additional_php_extensions, EXTCOUNT);
-#ifdef ZTS
- tsrm_shutdown();
-#endif
- return;
-}
-
-/***************************************************************************/
-
-/*
- * define a Java object to PHP
- */
-
-JNIEXPORT jlong JNICALL Java_net_php_servlet_define
- (JNIEnv *jenv, jobject self, jstring name)
-{
- pval *pzval;
- jlong addr = 0;
- const char *nameAsUTF = (*jenv)->GetStringUTFChars(jenv, name, 0);
- ELS_FETCH();
-
- MAKE_STD_ZVAL(pzval);
- addr = (jlong)(long) pzval;
-
- zend_hash_add(&EG(symbol_table), (char*)nameAsUTF,
- strlen(nameAsUTF)+1, &pzval, sizeof(pval *), NULL);
- (*jenv)->ReleaseStringUTFChars(jenv, name, nameAsUTF);
-
- return addr;
-}
-
-/*
- * execute a script
- */
-
-JNIEXPORT void JNICALL Java_net_php_servlet_send
- (JNIEnv *jenv, jobject self,
- jstring requestMethod, jstring queryString,
- jstring requestURI, jstring pathTranslated,
- jstring contentType, jint contentLength,
- jstring authUser, jboolean display_source_mode)
-{
-
- zend_file_handle file_handle;
-#ifndef VIRTUAL_DIR
- char cwd[MAXPATHLEN];
-#endif
- SLS_FETCH();
- PLS_FETCH();
- CLS_FETCH();
- ELS_FETCH();
-
-#ifdef ZTS
- if (setjmp(EG(bailout))!=0) {
- ThrowServletException(jenv,"bailout");
- return;
- }
-#endif
-
- SG(server_context) = emalloc(sizeof(servlet_request));
- ((servlet_request*)SG(server_context))->jenv=jenv;
- ((servlet_request*)SG(server_context))->servlet=self;
- ((servlet_request*)SG(server_context))->cookies=0;
-
- CG(extended_info) = 0;
-
- /*
- * Initialize the request
- */
- SETSTRING( SG(request_info).auth_user, authUser );
- SETSTRING( SG(request_info).request_method, requestMethod );
- SETSTRING( SG(request_info).query_string, queryString );
- SETSTRING( SG(request_info).request_uri, requestURI );
- SETSTRING( SG(request_info).content_type, contentType );
- SG(sapi_headers).http_response_code = 200;
- SG(request_info).content_length = contentLength;
- SG(request_info).auth_password = NULL;
- if (php_request_startup(CLS_C ELS_CC PLS_CC SLS_CC)==FAILURE) {
- ThrowServletException(jenv,"request startup failure");
- return;
- }
-
- /*
- * Parse the file
- */
- SETSTRING( SG(request_info).path_translated, pathTranslated );
-#ifdef VIRTUAL_DIR
- file_handle.handle.fp = php_fopen_primary_script();
-#else
- /*
- * The java runtime doesn't like the working directory to be
- * changed, so save it and change it back as quickly as possible
- * in the hopes that Java doesn't notice.
- */
- getcwd(cwd,MAXPATHLEN);
- file_handle.handle.fp = php_fopen_primary_script();
- chdir(cwd);
-#endif
- file_handle.filename = SG(request_info).path_translated;
- file_handle.opened_path = NULL;
- file_handle.free_filename = 0;
- file_handle.type = ZEND_HANDLE_FP;
-
- if (!file_handle.handle.fp) {
- php_request_shutdown((void *) 0);
- php_module_shutdown();
- ThrowIOException(jenv,file_handle.filename);
- return;
- }
-
- /*
- * Execute the request
- */
- Java_net_php_reflect_setEnv(jenv, 0);
-
- if (display_source_mode) {
- zend_syntax_highlighter_ini syntax_highlighter_ini;
-
- if (open_file_for_scanning(&file_handle CLS_CC)==SUCCESS) {
- php_get_highlight_struct(&syntax_highlighter_ini);
- sapi_send_headers();
- zend_highlight(&syntax_highlighter_ini);
- }
- } else {
- php_execute_script(&file_handle CLS_CC ELS_CC PLS_CC);
- php_header(); /* Make sure headers have been sent */
- }
-
- /*
- * Clean up
- */
-
- FREESTRING(SG(request_info).request_method);
- FREESTRING(SG(request_info).query_string);
- FREESTRING(SG(request_info).request_uri);
- FREESTRING(SG(request_info).path_translated);
- FREESTRING(SG(request_info).content_type);
- FREESTRING(((servlet_request*)SG(server_context))->cookies);
- efree(SG(server_context));
- SG(server_context)=0;
-
- if (!display_source_mode) php_request_shutdown((void *) 0);
-}
-
diff --git a/sapi/servlet/servlet.dsp b/sapi/servlet/servlet.dsp
deleted file mode 100644
index 9822557540..0000000000
--- a/sapi/servlet/servlet.dsp
+++ /dev/null
@@ -1,290 +0,0 @@
-# Microsoft Developer Studio Project File - Name="servlet" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=servlet - Win32 Debug_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "servlet.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "servlet.mak" CFG="servlet - Win32 Debug_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "servlet - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "servlet - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "servlet - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "servlet - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "servlet - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "..\..\Release"
-# PROP BASE Intermediate_Dir "..\..\Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "..\..\Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "PHP_WIN32" /D "ZEND_WIN32" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\main" /I "$(JAVA_HOME)\include\win32" /I "$(JAVA_HOME)\include" /I "..\..\..\bindlib_w32" /D "NDEBUG" /D ZEND_DEBUG=0 /D "PHP_WIN32" /D "ZEND_WIN32" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "NDEBUG"
-# ADD RSC /l 0x40d /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /version:4.0 /dll /machine:I386 /out:"..\..\Release/phpsrvlt.dll" /libpath:"$(JAVA_HOME)\lib" /libpath:"..\..\Release"
-
-!ELSEIF "$(CFG)" == "servlet - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "..\..\Debug"
-# PROP BASE Intermediate_Dir "..\..\Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "..\..\Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "PHP_WIN32" /D "ZEND_WIN32" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\Zend" /I "..\..\main" /I "$(JAVA_HOME)\include\win32" /I "$(JAVA_HOME)\include" /I "..\..\..\bindlib_w32" /D "_DEBUG" /D ZEND_DEBUG=1 /D "PHP_WIN32" /D "ZEND_WIN32" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL" /FR /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "_DEBUG"
-# ADD RSC /l 0x40d /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /version:4.0 /dll /debug /machine:I386 /out:"..\..\Debug/phpsrvlt.dll" /pdbtype:sept /libpath:"$(JAVA_HOME)\lib" /libpath:"..\..\Debug"
-
-!ELSEIF "$(CFG)" == "servlet - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "..\..\Debug_TS"
-# PROP BASE Intermediate_Dir "..\..\Debug_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "..\..\Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\..\Zend" /I "..\..\main" /I "$(JAVA_HOME)\include\win32" /I "$(JAVA_HOME)\include" /I "..\..\..\bindlib_w32" /D "_DEBUG" /D "PHP_WIN32" /D "ZEND_WIN32" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL" /FR /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\TSRM" /I "..\..\Zend" /I "..\..\main" /I "$(JAVA_HOME)\include\win32" /I "$(JAVA_HOME)\include" /I "..\..\..\bindlib_w32" /D "_DEBUG" /D ZEND_DEBUG=1 /D "PHP_WIN32" /D "ZEND_WIN32" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL" /D "ZTS" /FR /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "_DEBUG"
-# ADD RSC /l 0x40d /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 php4ts_debug.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /version:4.0 /dll /debug /machine:I386 /out:"..\..\Debug_TS/phpsrvlt.dll" /pdbtype:sept /libpath:"$(JAVA_HOME)\lib" /libpath:"..\..\Debug_TS"
-
-!ELSEIF "$(CFG)" == "servlet - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "..\..\Release_TS"
-# PROP BASE Intermediate_Dir "..\..\Release_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "..\..\Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\..\Zend" /I "..\..\main" /I "$(JAVA_HOME)\include\win32" /I "$(JAVA_HOME)\include" /I "..\..\..\bindlib_w32" /D "NDEBUG" /D "PHP_WIN32" /D "ZEND_WIN32" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\TSRM" /I "..\..\Zend" /I "..\..\main" /I "$(JAVA_HOME)\include\win32" /I "$(JAVA_HOME)\include" /I "..\..\..\bindlib_w32" /D "NDEBUG" /D ZEND_DEBUG=0 /D "PHP_WIN32" /D "ZEND_WIN32" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL" /D "ZTS" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "NDEBUG"
-# ADD RSC /l 0x40d /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 php4ts.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /version:4.0 /dll /machine:I386 /out:"..\..\Release_TS/phpsrvlt.dll" /libpath:"$(JAVA_HOME)\lib" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
-
-!ENDIF
-
-# Begin Target
-
-# Name "servlet - Win32 Release"
-# Name "servlet - Win32 Debug"
-# Name "servlet - Win32 Debug_TS"
-# Name "servlet - Win32 Release_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=..\..\ext\java\java.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\servlet.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\..\..\win32\winutil.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# End Group
-# Begin Group "Java Files"
-
-# PROP Default_Filter "java"
-# Begin Source File
-
-SOURCE=.\servlet.java
-
-!IF "$(CFG)" == "servlet - Win32 Release"
-
-USERDEP__SERVL="..\..\ext\java\reflect.java"
-# Begin Custom Build
-OutDir=.\..\..\Release
-InputPath=.\servlet.java
-
-"$(OutDir)\phpsrvlt.jar" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- if not exist net mkdir net
- if not exist net\php mkdir net\php
- copy *.java net\php > nul
- copy ..\..\ext\java\reflect.java net\php > nul
- echo library=phpsrvlt>net/php/reflect.properties
- echo library=phpsrvlt>net/php/servlet.properties
- $(JAVA_HOME)\bin\javac net\php\servlet.java
- $(JAVA_HOME)\bin\javac net\php\reflect.java
- $(JAVA_HOME)\bin\javac net\php\formatter.java
- $(JAVA_HOME)\bin\jar c0f $(OutDir)\phpsrvlt.jar net\php\*.class net\php\*.properties
- erase net\php\servlet.*
- erase net\php\formatter.*
- erase net\php\reflect.*
- rmdir net\php
- rmdir net
-
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "servlet - Win32 Debug"
-
-USERDEP__SERVL="..\..\ext\java\reflect.java"
-# Begin Custom Build
-OutDir=.\..\..\Debug
-InputPath=.\servlet.java
-
-"$(OutDir)\phpsrvlt.jar" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- if not exist net mkdir net
- if not exist net\php mkdir net\php
- copy *.java net\php > nul
- copy ..\..\ext\java\reflect.java net\php > nul
- echo library=phpsrvlt>net/php/reflect.properties
- echo library=phpsrvlt>net/php/servlet.properties
- $(JAVA_HOME)\bin\javac -g net\php\servlet.java
- $(JAVA_HOME)\bin\javac -g net\php\reflect.java
- $(JAVA_HOME)\bin\javac -g net\php\formatter.java
- $(JAVA_HOME)\bin\jar c0f $(OutDir)\phpsrvlt.jar net\php\*.class net\php\*.properties
- erase net\php\servlet.*
- erase net\php\formatter.*
- erase net\php\reflect.*
- rmdir net\php
- rmdir net
-
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "servlet - Win32 Debug_TS"
-
-USERDEP__SERVL="..\..\ext\java\reflect.java"
-# Begin Custom Build
-OutDir=.\..\..\Debug_TS
-InputPath=.\servlet.java
-
-"$(OutDir)\phpsrvlt.jar" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- if not exist net mkdir net
- if not exist net\php mkdir net\php
- copy *.java net\php > nul
- copy ..\..\ext\java\reflect.java net\php > nul
- echo library=phpsrvlt>net/php/reflect.properties
- echo library=phpsrvlt>net/php/servlet.properties
- $(JAVA_HOME)\bin\javac -g net\php\servlet.java
- $(JAVA_HOME)\bin\javac -g net\php\reflect.java
- $(JAVA_HOME)\bin\javac -g net\php\formatter.java
- $(JAVA_HOME)\bin\jar c0f $(OutDir)\phpsrvlt.jar net\php\*.class net\php\*.properties
- erase net\php\servlet.*
- erase net\php\formatter.*
- erase net\php\reflect.*
- rmdir net\php
- rmdir net
-
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "servlet - Win32 Release_TS"
-
-USERDEP__SERVL="..\..\ext\java\reflect.java"
-# Begin Custom Build
-OutDir=.\..\..\Release_TS
-InputPath=.\servlet.java
-
-"$(OutDir)\phpsrvlt.jar" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- if not exist net mkdir net
- if not exist net\php mkdir net\php
- copy *.java net\php > nul
- copy ..\..\ext\java\reflect.java net\php > nul
- echo library=phpsrvlt>net/php/reflect.properties
- echo library=phpsrvlt>net/php/servlet.properties
- $(JAVA_HOME)\bin\javac net\php\servlet.java
- $(JAVA_HOME)\bin\javac net\php\reflect.java
- $(JAVA_HOME)\bin\javac net\php\formatter.java
- $(JAVA_HOME)\bin\jar c0f $(OutDir)\phpsrvlt.jar net\php\*.class net\php\*.properties
- erase net\php\servlet.*
- erase net\php\formatter.*
- erase net\php\reflect.*
- rmdir net\php
- rmdir net
-
-# End Custom Build
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=.\servlet.java
-# End Source File
-# End Group
-# Begin Source File
-
-SOURCE=.\jtest.php
-# End Source File
-# End Target
-# End Project
diff --git a/sapi/servlet/servlet.java b/sapi/servlet/servlet.java
deleted file mode 100644
index 5e6887eaf3..0000000000
--- a/sapi/servlet/servlet.java
+++ /dev/null
@@ -1,188 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Sam Ruby (rubys@us.ibm.com) |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-package net.php;
-
-import java.io.IOException;
-import java.net.URLEncoder;
-import java.util.Enumeration;
-import javax.servlet.*;
-import javax.servlet.http.*;
-
-import java.lang.reflect.Method;
-
-public class servlet extends HttpServlet {
-
- char slash=System.getProperty("file.separator").charAt(0);
- HttpServletRequest request;
- HttpServletResponse response;
- ServletInputStream stream;
-
- static int startup_count = 0;
-
- protected boolean display_source_mode = false;
- private Method addHeader;
-
- /******************************************************************/
- /* native methods */
- /******************************************************************/
-
- public native void startup();
- public native long define(String name);
- public native void send(String requestMethod, String queryString,
- String pathInfo, String pathTranslated,
- String contentType, int contentLength, String authUser,
- boolean display_source_mode);
- public native void shutdown();
-
- /******************************************************************/
- /* sapi callbacks */
- /******************************************************************/
-
- public String readPost(int bytes) {
- String result;
- if (!request.getMethod().equals("POST")) {
- result = request.getQueryString();
- } else {
- Enumeration e = request.getParameterNames();
- result="";
- String concat="";
- while (e.hasMoreElements()) {
- String name = (String)e.nextElement();
- String value = request.getParameter(name);
- result+=concat+name+"="+URLEncoder.encode(value);
- concat="&";
- }
- }
- if (result == null) return "";
- return result;
- }
-
- public String readCookies() {
- reflect.setResult(define("request"), request);
- reflect.setResult(define("response"), response);
- reflect.setResult(define("PHP_SELF"), request.getRequestURI());
- return request.getHeader("cookie");
- }
-
- public void header(String data) {
-
- // try to send the header using the most specific servlet API
- // as possible (some servlet engines will add a content type
- // header unless the setContentType method is called).
- try {
- if (data.startsWith("Content-type: ")) {
- response.setContentType(data.substring(data.indexOf(" ")+1));
- } else if (data.startsWith("Location: ")) {
- response.sendRedirect(data.substring(data.indexOf(" ")+1));
- } else {
- int colon = data.indexOf(": ");
- if (colon > 0) {
- try {
- addHeader.invoke(response, new Object[]
- { data.substring(0,colon), data.substring(colon+2) } );
- } catch (Exception e) {
- e.printStackTrace(System.err);
- }
- } else {
- write(data);
- }
- }
- } catch (IOException e) {
- e.printStackTrace(System.err);
- }
-
- }
-
- public void write(String data) {
- try {
- response.getWriter().print(data);
- } catch (IOException e) {
- e.printStackTrace(System.err);
- }
- }
-
- /******************************************************************/
- /* servlet interface */
- /******************************************************************/
-
- public void init(ServletConfig config) throws ServletException {
- super.init(config);
-
- // first time in, initialize native code
- if (0 == startup_count++) {
- reflect.loadLibrary("servlet");
- startup();
- }
-
- // try to find the addHeader method (added in the servlet API 2.2)
- // otherwise settle for the setHeader method
- try {
- Class c = Class.forName("javax.servlet.http.HttpServletResponse");
- Method method[] = c.getDeclaredMethods();
- for (int i=0; i<method.length; i++) {
- if (method[i].getName().equals("addHeader")) {
- addHeader = method[i];
- break;
- }
- if (method[i].getName().equals("setHeader")) {
- addHeader = method[i];
- }
- }
- } catch (Exception e) {
- e.printStackTrace(System.err);
- }
- }
-
- public void service(HttpServletRequest request,
- HttpServletResponse response,
- String contextPath)
- throws ServletException
- {
- this.request=request;
- this.response=response;
-
- send(request.getMethod(), request.getQueryString(),
- request.getRequestURI(), contextPath,
- request.getContentType(), request.getContentLength(),
- request.getRemoteUser(), display_source_mode);
-
- try {
- if (stream != null) stream.close();
- } catch (IOException e) {
- throw new ServletException(e.toString());
- }
- }
-
- public void service(HttpServletRequest request,
- HttpServletResponse response)
- throws ServletException
- {
- String servletPath=request.getServletPath();
- String contextPath=getServletContext().getRealPath(servletPath);
- service(request, response, contextPath);
- }
-
- public void destroy() {
- if (0 == --startup_count) shutdown();
- super.destroy();
- }
-
-}
diff --git a/sapi/servlet/sessions.php b/sapi/servlet/sessions.php
deleted file mode 100644
index 463b1b5e92..0000000000
--- a/sapi/servlet/sessions.php
+++ /dev/null
@@ -1,60 +0,0 @@
-<html>
-<body bgcolor="white">
-<head>
-<title>Sessions Example</title>
-</head>
-<body>
-<h3>Sessions Example</h3>
-<?php
-
- // print session info
-
- $session = $request->session;
- $created = new Java("java.util.Date", $session->creationTime);
- $accessed = new Java("java.util.Date", $session->lastAccessedTime);
-
- print "Session ID: $session->id<br>\n";
- print "Created: " . $created->toString() . "<br>\n";
- print "Last Accessed: " . $accessed->toString() . "<br>\n";
-
- // set session info if needed
-
- if ($dataName) $session->setAttribute($dataName, $dataValue);
-
- // print session contents
-
- print "<P>\n";
- print "The following data is in your session:<br>\n";
- $e = $session->attributeNames;
- while ($e->hasMoreElements()) {
- $name = $e->nextElement();
- $value = $session->getAttribute($name);
- print "$name = $value<br>\n";
- }
-
-?>
-<P>
-<form action="<?php echo $PHP_SELF ?>" method=POST>
-Name of Session Attribute:
-<input type=text size=20 name=dataName>
-<br>
-Value of Session Attribute:
-<input type=text size=20 name=dataValue>
-<br>
-<input type=submit>
-</form>
-<P>GET based form:<br>
-<form action="<?php echo $PHP_SELF ?>" method=GET>
-Name of Session Attribute:
-<input type=text size=20 name=dataName>
-<br>
-Value of Session Attribute:
-<input type=text size=20 name=dataValue>
-<br>
-<input type=submit>
-</form>
-<p><a href="<?php echo $PHP_SELF ?>?dataName=foo&dataValue=bar" >URL encoded </a>
-</body>
-</html>
-</body>
-</html>
diff --git a/sapi/servlet/web.xml b/sapi/servlet/web.xml
deleted file mode 100644
index 9efa2fd091..0000000000
--- a/sapi/servlet/web.xml
+++ /dev/null
@@ -1,41 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-
-<!DOCTYPE web-app
- PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
- "http://java.sun.com/j2ee/dtds/web-app_2.2.dtd">
-
-<web-app>
- <servlet>
- <servlet-name>
- php
- </servlet-name>
- <servlet-class>
- net.php.servlet
- </servlet-class>
- </servlet>
- <servlet-mapping>
- <servlet-name>
- php
- </servlet-name>
- <url-pattern>
- *.php
- </url-pattern>
- </servlet-mapping>
-
- <servlet>
- <servlet-name>
- php-formatter
- </servlet-name>
- <servlet-class>
- net.php.formatter
- </servlet-class>
- </servlet>
- <servlet-mapping>
- <servlet-name>
- php-formatter
- </servlet-name>
- <url-pattern>
- *.phps
- </url-pattern>
- </servlet-mapping>
-</web-app>
diff --git a/sapi/thttpd/CREDITS b/sapi/thttpd/CREDITS
deleted file mode 100644
index 8f02f36f4f..0000000000
--- a/sapi/thttpd/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-thttpd
-Sascha Schumann
diff --git a/sapi/thttpd/Makefile.in b/sapi/thttpd/Makefile.in
deleted file mode 100644
index a18d0f8d18..0000000000
--- a/sapi/thttpd/Makefile.in
+++ /dev/null
@@ -1,5 +0,0 @@
-
-LTLIBRARY_NAME = libsapi.la
-LTLIBRARY_SOURCES = stub.c
-
-include $(top_srcdir)/build/ltlib.mk
diff --git a/sapi/thttpd/README b/sapi/thttpd/README
deleted file mode 100644
index b46c4dea5c..0000000000
--- a/sapi/thttpd/README
+++ /dev/null
@@ -1,59 +0,0 @@
-README FOR THTTPD MODULE (by Sascha Schumann)
-($Date$)
-
- This is a SAPI module for PHP 4.0 supporting thttpd, the tiny,
- turbo, throttling HTTP server by Jef Poskanzer.
-
- The module contains a patch against version 2.19 of thttpd. The patch
- adds hooks to thttpd to call PHP, if a filename matches *.php. This
- patch will be applied when you install PHP.
-
- This is a functional and stable module (it runs a large application
- like IMP 2.2.0 without any problems). Its original intention was to
- demonstrate the ability of PHP to work in every web server environment.
-
- NOTE: All requests will be serialized. That means, one long running
- script will block all other requests. Choose another web-server,
- if you want to execute arbitrary scripts.
-
-REQUIRED DOWNLOADS
-
- 1. thttpd 2.xx
-
- Full Distribution:
- http://www.acme.com/software/thttpd/
-
- 2. PHP 4.0.x
-
- Download:
- http://www.php.net/
-
- Snapshots from CVS:
- http://snaps.php.net/
-
-
-BUILD INSTRUCTIONS
-
- 1. Extract software packages
-
- $ gunzip -c thttpd-2.xx.tar.gz | tar xf -
- $ gunzip -c php-*.tar.gz | tar xf -
-
- 2. Prepare PHP
-
- $ cd php-*
- $ ./configure \
- --with-thttpd=../thttpd-2.xx \
- <further PHP options>
- $ make install
- $ cd ..
-
- You can see the list of valid PHP options by executing
-
- $ ./configure --help
-
- 3. Configure, compile, install thttpd
-
- Now follow the thttpd instructions. The Makefile template of
- thttpd was changed to automatically use the components
- required by PHP.
diff --git a/sapi/thttpd/config.m4 b/sapi/thttpd/config.m4
deleted file mode 100644
index 81469e825c..0000000000
--- a/sapi/thttpd/config.m4
+++ /dev/null
@@ -1,23 +0,0 @@
-AC_ARG_WITH(thttpd,
-[ --with-thttpd=SRCDIR Build PHP as thttpd module],[
- test -d $withval || AC_MSG_RESULT(thttpd directory does not exist ($withval))
- PHP_EXPAND_PATH($withval, THTTPD)
- PHP_TARGET_RDYNAMIC
- INSTALL_IT="\
- echo 'PHP_LIBS = -L. -lphp4 \$(PHP_LIBS) \$(EXTRA_LIBS)' > $THTTPD/php_makefile; \
- echo 'PHP_LDFLAGS = \$(NATIVE_RPATHS) \$(PHP_LDFLAGS)' >> $THTTPD/php_makefile; \
- echo 'PHP_CFLAGS = \$(COMMON_FLAGS) \$(CFLAGS) \$(CPPFLAGS) \$(EXTRA_CFLAGS)' >> $THTTPD/php_makefile; \
- \$(LN_S) $abs_srcdir/sapi/thttpd/thttpd.c $THTTPD/php_thttpd.c; \
- cp $abs_srcdir/sapi/thttpd/php_thttpd.h $SAPI_STATIC $THTTPD;\
- test -f $THTTPD/php_patched || \
- (cd $THTTPD && patch < $abs_srcdir/sapi/thttpd/thttpd_patch && touch php_patched)"
- PHP_THTTPD="yes, using $THTTPD"
- PHP_ADD_INCLUDE($THTTPD)
- PHP_BUILD_STATIC
- PHP_SAPI=thttpd
-],[
- PHP_THTTPD=no
-])
-
-AC_MSG_CHECKING(for thttpd)
-AC_MSG_RESULT($PHP_THTTPD)
diff --git a/sapi/thttpd/php.sym b/sapi/thttpd/php.sym
deleted file mode 100644
index 2214d3964d..0000000000
--- a/sapi/thttpd/php.sym
+++ /dev/null
@@ -1,3 +0,0 @@
-thttpd_php_request
-thttpd_php_init
-thttpd_php_shutdown
diff --git a/sapi/thttpd/php_thttpd.h b/sapi/thttpd/php_thttpd.h
deleted file mode 100644
index a5ebf13cb2..0000000000
--- a/sapi/thttpd/php_thttpd.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Sascha Schumann <sascha@schumann.cx> |
- +----------------------------------------------------------------------+
-*/
-
-#ifndef PHP_THTTPD_H
-#define PHP_THTTPD_H
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <libhttpd.h>
-
-void thttpd_php_shutdown(void);
-void thttpd_php_init(void);
-off_t thttpd_php_request(httpd_conn *hc);
-
-void thttpd_register_on_close(void (*)(int));
-void thttpd_closed_conn(int fd);
-int thttpd_get_fd(void);
-void thttpd_set_dont_close(void);
-
-#endif
diff --git a/sapi/thttpd/stub.c b/sapi/thttpd/stub.c
deleted file mode 100644
index e69de29bb2..0000000000
--- a/sapi/thttpd/stub.c
+++ /dev/null
diff --git a/sapi/thttpd/thttpd.c b/sapi/thttpd/thttpd.c
deleted file mode 100644
index a47bb1d0c8..0000000000
--- a/sapi/thttpd/thttpd.c
+++ /dev/null
@@ -1,366 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Sascha Schumann <sascha@schumann.cx> |
- +----------------------------------------------------------------------+
-*/
-
-
-#include "php.h"
-#include "SAPI.h"
-#include "php_main.h"
-#include "php_thttpd.h"
-#include "php_variables.h"
-#include "version.h"
-
-#include "ext/standard/php_smart_str.h"
-
-#include <sys/uio.h>
-
-typedef struct {
- httpd_conn *hc;
- int post_off;
- void (*on_close)(int);
-} php_thttpd_globals;
-
-static php_thttpd_globals thttpd_globals;
-
-#define TLS_D
-#define TLS_DC
-#define TLS_C
-#define TLS_CC
-#define TG(v) (thttpd_globals.v)
-#define TLS_FETCH()
-
-static int sapi_thttpd_ub_write(const char *str, uint str_length)
-{
- int n;
- uint sent = 0;
- TLS_FETCH();
-
- while (str_length > 0) {
- n = send(TG(hc)->conn_fd, str, str_length, 0);
-
- if (n == -1 && errno == EPIPE)
- php_handle_aborted_connection();
- if (n == -1 && errno == EAGAIN)
- continue;
- if (n <= 0)
- return n;
-
- TG(hc)->bytes_sent += n;
- str += n;
- sent += n;
- str_length -= n;
- }
-
- return sent;
-}
-
-#define COMBINE_HEADERS 30
-
-static int sapi_thttpd_send_headers(sapi_headers_struct *sapi_headers SLS_DC)
-{
- char buf[1024];
- struct iovec vec[COMBINE_HEADERS];
- int n = 0;
- zend_llist_position pos;
- sapi_header_struct *h;
- size_t len;
-
- if (!SG(sapi_headers).http_status_line) {
- snprintf(buf, 1023, "HTTP/1.0 %d Something\r\n", SG(sapi_headers).http_response_code);
- len = strlen(buf);
- vec[n].iov_base = buf;
- vec[n].iov_len = len;
- } else {
- vec[n].iov_base = SG(sapi_headers).http_status_line;
- len = strlen(vec[n].iov_base);
- vec[n].iov_len = len;
- vec[++n].iov_base = "\r\n";
- vec[n].iov_len = 2;
- len += 2;
- }
- TG(hc)->status = SG(sapi_headers).http_response_code;
- TG(hc)->bytes_sent += len;
- n++;
-
- h = zend_llist_get_first_ex(&sapi_headers->headers, &pos);
- while (h) {
- vec[n].iov_base = h->header;
- vec[n++].iov_len = h->header_len;
- if (n >= COMBINE_HEADERS - 1) {
- if (writev(TG(hc)->conn_fd, vec, n) == -1 && errno == EPIPE)
- php_handle_aborted_connection();
- n = 0;
- }
- vec[n].iov_base = "\r\n";
- vec[n++].iov_len = 2;
-
- h = zend_llist_get_next_ex(&sapi_headers->headers, &pos);
- }
-
- vec[n].iov_base = "\r\n";
- vec[n++].iov_len = 2;
-
- if (n) {
- if (writev(TG(hc)->conn_fd, vec, n) == -1 && errno == EPIPE)
- php_handle_aborted_connection();
- }
-
- return SAPI_HEADER_SENT_SUCCESSFULLY;
-}
-
-static int sapi_thttpd_read_post(char *buffer, uint count_bytes SLS_DC)
-{
- size_t read_bytes = 0, tmp;
- int c;
- TLS_FETCH();
-
- /* to understand this, read cgi_interpose_input() in libhttpd.c */
- c = TG(hc)->read_idx - TG(hc)->checked_idx;
- if (c > 0) {
- read_bytes = MIN(c, count_bytes);
- memcpy(buffer, TG(hc)->read_buf + TG(hc)->checked_idx, read_bytes);
- TG(hc)->checked_idx += read_bytes;
- count_bytes -= read_bytes;
- }
-
- count_bytes = MIN(count_bytes,
- SG(request_info).content_length - SG(read_post_bytes) - TG(post_off));
-
- while (read_bytes < count_bytes) {
- tmp = recv(TG(hc)->conn_fd, buffer + read_bytes,
- count_bytes - read_bytes, 0);
- if (tmp <= 0)
- break;
- read_bytes += tmp;
- }
-
- return read_bytes;
-}
-
-static char *sapi_thttpd_read_cookies(SLS_D)
-{
- TLS_FETCH();
-
- return TG(hc)->cookie;
-}
-
-#define BUF_SIZE 512
-#define ADD_STRING(name) \
- php_register_variable(name, buf, track_vars_array ELS_CC PLS_CC)
-
-static void sapi_thttpd_register_variables(zval *track_vars_array ELS_DC SLS_DC PLS_DC)
-{
- char buf[BUF_SIZE + 1];
- char *p;
- TLS_FETCH();
-
- php_register_variable("PHP_SELF", SG(request_info).request_uri, track_vars_array ELS_CC PLS_CC);
- php_register_variable("SERVER_SOFTWARE", SERVER_SOFTWARE, track_vars_array ELS_CC PLS_CC);
- php_register_variable("GATEWAY_INTERFACE", "CGI/1.1", track_vars_array ELS_CC PLS_CC);
- php_register_variable("REQUEST_METHOD", (char *) SG(request_info).request_method, track_vars_array ELS_CC PLS_CC);
- php_register_variable("REQUEST_URI", SG(request_info).request_uri, track_vars_array ELS_CC PLS_CC);
- php_register_variable("PATH_TRANSLATED", SG(request_info).path_translated, track_vars_array ELS_CC PLS_CC);
-
- p = inet_ntoa(TG(hc)->client_addr.sa_in.sin_addr);
- /* string representation of IPs are never larger than 512 bytes */
- if (p) {
- memcpy(buf, p, strlen(p) + 1);
- ADD_STRING("REMOTE_ADDR");
- ADD_STRING("REMOTE_HOST");
- }
-
- snprintf(buf, BUF_SIZE, "%d", TG(hc)->hs->port);
- ADD_STRING("SERVER_PORT");
-
- snprintf(buf, BUF_SIZE, "/%s", TG(hc)->pathinfo);
- ADD_STRING("PATH_INFO");
-
- snprintf(buf, BUF_SIZE, "/%s", TG(hc)->origfilename);
- ADD_STRING("SCRIPT_NAME");
-
-#define CONDADD(name, field) \
- if (TG(hc)->field[0]) { \
- php_register_variable(#name, TG(hc)->field, track_vars_array ELS_CC PLS_C); \
- }
-
- CONDADD(HTTP_REFERER, referer);
- CONDADD(HTTP_USER_AGENT, useragent);
- CONDADD(HTTP_ACCEPT, accept);
- CONDADD(HTTP_ACCEPT_ENCODING, accepte);
- CONDADD(HTTP_COOKIE, cookie);
- CONDADD(CONTENT_TYPE, contenttype);
- CONDADD(REMOTE_USER, remoteuser);
- CONDADD(SERVER_PROTOCOL, protocol);
-
- if (TG(hc)->contentlength != -1) {
- sprintf(buf, "%ld", (long) TG(hc)->contentlength);
- ADD_STRING("CONTENT_LENGTH");
- }
-
- if (TG(hc)->authorization[0])
- php_register_variable("AUTH_TYPE", "Basic", track_vars_array ELS_CC PLS_C);
-}
-
-static sapi_module_struct thttpd_sapi_module = {
- "thttpd",
- "thttpd",
-
- php_module_startup,
- php_module_shutdown_wrapper,
-
- NULL, /* activate */
- NULL, /* deactivate */
-
- sapi_thttpd_ub_write,
- NULL,
- NULL, /* get uid */
- NULL, /* getenv */
-
- php_error,
-
- NULL,
- sapi_thttpd_send_headers,
- NULL,
- sapi_thttpd_read_post,
- sapi_thttpd_read_cookies,
-
- sapi_thttpd_register_variables,
- NULL, /* Log message */
-
- NULL, /* Block interruptions */
- NULL, /* Unblock interruptions */
-
- STANDARD_SAPI_MODULE_PROPERTIES
-};
-
-static void thttpd_module_main(TLS_D SLS_DC)
-{
- zend_file_handle file_handle;
- CLS_FETCH();
- ELS_FETCH();
- PLS_FETCH();
-
- file_handle.type = ZEND_HANDLE_FILENAME;
- file_handle.filename = SG(request_info).path_translated;
- file_handle.free_filename = 0;
- file_handle.opened_path = NULL;
-
- if (php_request_startup(CLS_C ELS_CC PLS_CC SLS_CC) == FAILURE) {
- return;
- }
-
- php_execute_script(&file_handle CLS_CC ELS_CC PLS_CC);
- php_request_shutdown(NULL);
-}
-
-static void thttpd_request_ctor(TLS_D SLS_DC)
-{
- char buf[1024];
- int offset;
- size_t filename_len;
- size_t cwd_len;
- smart_str s = {0};
-
- SG(request_info).query_string = TG(hc)->query?strdup(TG(hc)->query):NULL;
-
- smart_str_appends_ex(&s, TG(hc)->hs->cwd, 1);
- smart_str_appends_ex(&s, TG(hc)->expnfilename, 1);
- smart_str_0(&s);
- SG(request_info).path_translated = s.c;
-
- s.c = NULL;
- smart_str_appendc_ex(&s, '/', 1);
- smart_str_appends_ex(&s, TG(hc)->origfilename, 1);
- smart_str_0(&s);
- SG(request_info).request_uri = s.c;
- SG(request_info).request_method = httpd_method_str(TG(hc)->method);
- SG(sapi_headers).http_response_code = 200;
- SG(request_info).content_type = TG(hc)->contenttype;
- SG(request_info).content_length = TG(hc)->contentlength;
-
- php_handle_auth_data(TG(hc)->authorization SLS_CC);
-
- TG(post_off) = TG(hc)->read_idx - TG(hc)->checked_idx;
-
- /* avoid feeding \r\n from POST data to SAPI */
- offset = TG(post_off) - SG(request_info).content_length;
-
- if (offset > 0) {
- TG(post_off) -= offset;
- TG(hc)->read_idx -= offset;
- }
-}
-
-static void thttpd_request_dtor(TLS_D SLS_DC)
-{
- if (SG(request_info).query_string)
- free(SG(request_info).query_string);
- free(SG(request_info).request_uri);
- free(SG(request_info).path_translated);
-}
-
-off_t thttpd_php_request(httpd_conn *hc)
-{
- SLS_FETCH();
- TLS_FETCH();
-
- TG(hc) = hc;
- hc->bytes_sent = 0;
-
- thttpd_request_ctor(TLS_C SLS_CC);
-
- thttpd_module_main(TLS_C SLS_CC);
-
- thttpd_request_dtor(TLS_C SLS_CC);
-
- return 0;
-}
-
-void thttpd_register_on_close(void (*arg)(int))
-{
- TG(on_close) = arg;
-}
-
-void thttpd_closed_conn(int fd)
-{
- if (TG(on_close)) TG(on_close)(fd);
-}
-
-int thttpd_get_fd(void)
-{
- return TG(hc)->conn_fd;
-}
-
-void thttpd_set_dont_close(void)
-{
- TG(hc)->file_address = (char *) 1;
-}
-
-void thttpd_php_init(void)
-{
- sapi_startup(&thttpd_sapi_module);
- thttpd_sapi_module.startup(&thttpd_sapi_module);
- SG(server_context) = (void *) 1;
-}
-
-void thttpd_php_shutdown(void)
-{
- if (SG(server_context) != NULL) {
- thttpd_sapi_module.shutdown(&thttpd_sapi_module);
- sapi_shutdown();
- }
-}
diff --git a/sapi/thttpd/thttpd_patch b/sapi/thttpd/thttpd_patch
deleted file mode 100644
index b5ce179ca2..0000000000
--- a/sapi/thttpd/thttpd_patch
+++ /dev/null
@@ -1,137 +0,0 @@
-diff -ur thttpd-2.21/Makefile.in thttpd-2.21-p/Makefile.in
---- thttpd-2.21/Makefile.in Thu Mar 29 20:36:21 2001
-+++ thttpd-2.21-p/Makefile.in Sun Apr 22 15:59:42 2001
-@@ -46,13 +46,15 @@
-
- # You shouldn't need to edit anything below here.
-
-+include php_makefile
-+
- CC = @CC@
- CCOPT = @V_CCOPT@
- DEFS = @DEFS@
- INCLS = -I.
- CFLAGS = $(CCOPT) $(DEFS) $(INCLS)
--LDFLAGS = @LDFLAGS@
--LIBS = @LIBS@
-+LDFLAGS = @LDFLAGS@ $(PHP_LDFLAGS)
-+LIBS = @LIBS@ $(PHP_LIBS)
- NETLIBS = @V_NETLIBS@
- INSTALL = @INSTALL@
-
-@@ -62,7 +64,7 @@
- @rm -f $@
- $(CC) $(CFLAGS) -c $*.c
-
--SRC = thttpd.c libhttpd.c fdwatch.c mmc.c timers.c match.c tdate_parse.c syslog.c
-+SRC = thttpd.c libhttpd.c fdwatch.c mmc.c timers.c match.c tdate_parse.c syslog.c php_thttpd.c
-
- OBJ = $(SRC:.c=.o) @LIBOBJS@
-
-@@ -151,6 +153,9 @@
-
- tags:
- ctags -wtd *.c *.h
-+
-+php_thttpd.o: php_thttpd.c
-+ $(CC) $(PHP_CFLAGS) $(CFLAGS) -c php_thttpd.c
-
- tar:
- @name=`sed -n -e '/SERVER_SOFTWARE/!d' -e 's,.*thttpd/,thttpd-,' -e 's, .*,,p' version.h` ; \
-diff -ur thttpd-2.21/libhttpd.c thttpd-2.21-p/libhttpd.c
---- thttpd-2.21/libhttpd.c Sat Apr 21 02:11:32 2001
-+++ thttpd-2.21-p/libhttpd.c Sun Apr 22 16:01:41 2001
-@@ -85,6 +85,8 @@
- #include "match.h"
- #include "tdate_parse.h"
-
-+#include "php_thttpd.h"
-+
- #ifndef STDIN_FILENO
- #define STDIN_FILENO 0
- #endif
-@@ -243,6 +245,8 @@
- free( (void*) hs->cwd );
- if ( hs->cgi_pattern != (char*) 0 )
- free( (void*) hs->cgi_pattern );
-+ if ( hs->php_pattern != (char*) 0 )
-+ free( (void*) hs->php_pattern );
- if ( hs->charset != (char*) 0 )
- free( (void*) hs->charset );
- if ( hs->url_pattern != (char*) 0 )
-@@ -250,6 +254,7 @@
- if ( hs->local_pattern != (char*) 0 )
- free( (void*) hs->local_pattern );
- free( (void*) hs );
-+ thttpd_php_shutdown();
- }
-
-
-@@ -313,6 +318,7 @@
- }
-
- hs->port = port;
-+ hs->php_pattern = strdup("**.php");
- if ( cgi_pattern == (char*) 0 )
- hs->cgi_pattern = (char*) 0;
- else
-@@ -386,6 +392,8 @@
- return (httpd_server*) 0;
- }
-
-+ thttpd_php_init();
-+
- /* Done initializing. */
- if ( hs->binding_hostname == (char*) 0 )
- syslog( LOG_INFO, "%.80s starting on port %d", SERVER_SOFTWARE, hs->port );
-@@ -2336,7 +2344,10 @@
- {
- make_log_entry( hc, nowP );
-
-- if ( hc->file_address != (char*) 0 )
-+ if ( hc->file_address == (char*) 1 )
-+ {
-+ thttpd_closed_conn(hc->conn_fd);
-+ } else if ( hc->file_address != (char*) 0 )
- {
- mmc_unmap( hc->file_address, &(hc->sb), nowP );
- hc->file_address = (char*) 0;
-@@ -3543,6 +3554,11 @@
- ( hc->sb.st_mode & S_IXOTH ) &&
- match( hc->hs->cgi_pattern, hc->expnfilename ) )
- return cgi( hc );
-+
-+ if ( hc->hs->php_pattern != (char*) 0 &&
-+ match( hc->hs->php_pattern, hc->expnfilename)) {
-+ return thttpd_php_request( hc );
-+ }
-
- /* It's not CGI. If it's executable or there's pathinfo, someone's
- ** trying to either serve or run a non-CGI file as CGI. Either case
-diff -ur thttpd-2.21/libhttpd.h thttpd-2.21-p/libhttpd.h
---- thttpd-2.21/libhttpd.h Fri Apr 13 07:37:17 2001
-+++ thttpd-2.21-p/libhttpd.h Sun Apr 22 15:59:42 2001
-@@ -69,6 +69,7 @@
- char* server_hostname;
- int port;
- char* cgi_pattern;
-+ char* php_pattern;
- char* charset;
- char* cwd;
- int listen4_fd, listen6_fd;
-diff -ur thttpd-2.21/thttpd.c thttpd-2.21-p/thttpd.c
---- thttpd-2.21/thttpd.c Sun Apr 15 18:09:20 2001
-+++ thttpd-2.21-p/thttpd.c Sun Apr 22 15:59:42 2001
-@@ -1392,6 +1392,12 @@
- clear_connection( c, tvP );
- return;
- }
-+ if (hc->file_address == (char *) 1) {
-+ tmr_cancel( c->idle_read_timer );
-+ c->idle_read_timer = (Timer*) 0;
-+ c->wouldblock_delay = 0;
-+ return;
-+ }
- if ( c->bytes_sent >= c->bytes_to_send )
- {
- /* There's nothing to send. */
diff --git a/sapi/tux/CREDITS b/sapi/tux/CREDITS
deleted file mode 100644
index 3b7aa70c01..0000000000
--- a/sapi/tux/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-tux
-Sascha Schumann
diff --git a/sapi/tux/Makefile.in b/sapi/tux/Makefile.in
deleted file mode 100644
index 221f50d8c1..0000000000
--- a/sapi/tux/Makefile.in
+++ /dev/null
@@ -1,5 +0,0 @@
-
-LTLIBRARY_NAME = libsapi.la
-LTLIBRARY_SOURCES = php_tux.c
-
-include $(top_srcdir)/build/ltlib.mk
diff --git a/sapi/tux/README b/sapi/tux/README
deleted file mode 100644
index 167e52f3ca..0000000000
--- a/sapi/tux/README
+++ /dev/null
@@ -1,86 +0,0 @@
-README FOR THE TUX MODULE (by Sascha Schumann)
-($Date$)
-
- This is a SAPI module for the TUX web-server by Ingo Molnar.
-
- The special thing about TUX is that it is integrated into the Linux
- kernel and thus provides high-speed serving of static files.
-
- The web-server provides a user-space API which allows arbitrary
- plug-ins to be made available.
-
- All requests to the PHP userspace module are currently serialized.
-
- This module is of alpha quality. Due to incomplete APIs, HTTP
- authentication and handling of POST requests has not been
- implemented yet.
-
- SECURITY NOTE: PHP will happily run everything under the
- web-root through the parser; so be careful what you put
- there.
-
- Note that requests are served in a chroot'ed environment.
- The initialization of PHP does not take place in the chroot'ed
- environment, so that e.g. /usr/local/lib/php.ini is treated
- as usual.
-
-REQUIRED DOWNLOADS
-
- 1. TUX
-
- http://people.redhat.com/~mingo/TUX-patches/QuickStart-TUX.txt
-
- 2. PHP 4.0.x
-
- Download:
- http://www.php.net/
-
- Snapshots from CVS:
- http://snaps.php.net/
-
-
-BUILD INSTRUCTIONS
-
- 1. Install TUX as outlined in the QuickStart text.
- Create /tux-modules where modules will reside.
-
- 2. Prepare PHP
-
- $ cd php-*
- $ ./configure \
- --with-tux=/tux-modules \
- <further PHP options>
- # make install
-
- You can see the list of valid PHP options by executing
-
- $ ./configure --help
-
- 3. Touch a file in your web-root 'php4.tux'. This will
- cause requests to '/php4.tux' to be redirected to the
- userspace module php4.tux.
-
- 4. Start TUX with something like
-
- # tux -d -t 8 -r /www -m /tux-modules php4.tux
-
- (daemon mode, eight threads, web-root /www, modules in
- /tux-modules, load php4.tux)
-
- BEFORE running this command, the kernel side of TUX has to
- be properly setup.
-
- 5. Try to access
-
- http://yourserver/php4.tux?=PHPB8B5F2A0-3C92-11d3-A3A9-4C7B08C10000
-
- It should display the PHP credits page.
-
- To access a script /foo/bar.php, use
-
- http://yourserver/php4.tux?/foo/bar.php
-
- Parameters can be appended:
-
- http://yourserver/php4.tux?/foo/bar.php&var=value
-
diff --git a/sapi/tux/config.m4 b/sapi/tux/config.m4
deleted file mode 100644
index 7a0ca55de8..0000000000
--- a/sapi/tux/config.m4
+++ /dev/null
@@ -1,15 +0,0 @@
-PHP_TUX=no
-
-AC_ARG_WITH(tux,
-[ --with-tux=MODULEDIR Build PHP as a TUX module (Linux only)],[
- INSTALL_IT="\$(INSTALL) -m 0755 $SAPI_SHARED $withval/php4.tux.so"
- AC_CHECK_HEADERS(tuxmodule.h,[:],[AC_MSG_ERROR([Cannot find tuxmodule.h])])
- PHP_BUILD_SHARED
- PHP_SAPI=tux
- PHP_TUX=yes
-])
-
-AC_MSG_CHECKING(for TUX)
-AC_MSG_RESULT($PHP_TUX)
-
-unset PHP_TUX
diff --git a/sapi/tux/php.sym b/sapi/tux/php.sym
deleted file mode 100644
index b968c5f5a2..0000000000
--- a/sapi/tux/php.sym
+++ /dev/null
@@ -1,2 +0,0 @@
-TUXAPI_handle_events
-TUXAPI_init
diff --git a/sapi/tux/php_tux.c b/sapi/tux/php_tux.c
deleted file mode 100644
index 0b0070228f..0000000000
--- a/sapi/tux/php_tux.c
+++ /dev/null
@@ -1,440 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Sascha Schumann <sascha@schumann.cx> |
- +----------------------------------------------------------------------+
-*/
-
-#include "php.h"
-#include "SAPI.h"
-#include "php_main.h"
-#include "php_variables.h"
-
-#include "ext/standard/php_smart_str.h"
-
-#include "tuxmodule.h"
-
-#include <sys/uio.h>
-
-#if 0
-#include <pthread.h>
-#endif
-
-void tux_closed_conn(int fd);
-
-enum {
- PHP_TUX_BACKGROUND_CONN = 1
-};
-
-typedef struct {
- user_req_t *req;
- void (*on_close)(int);
- int tux_action;
- struct iovec *header_vec;
- int number_vec;
-} php_tux_globals;
-
-static php_tux_globals tux_globals;
-
-#define TLS_D
-#define TLS_DC
-#define TLS_C
-#define TLS_CC
-#define TG(v) (tux_globals.v)
-#define TLS_FETCH()
-
-static int sapi_tux_ub_write(const char *str, uint str_length)
-{
- int n;
- uint sent = 0;
- TLS_FETCH();
-
- /* combine headers and body */
- if (TG(number_vec)) {
- struct iovec *vec = TG(header_vec);
-
- n = TG(number_vec);
- vec[n].iov_base = (void *) str;
- vec[n++].iov_len = str_length;
-
- if (writev(TG(req)->sock, vec, n) == -1 && errno == EPIPE)
- php_handle_aborted_connection();
-
- TG(number_vec) = 0;
- return str_length;
- }
-
- while (str_length > 0) {
- n = send(TG(req)->sock, str, str_length, 0);
-
- if (n == -1 && errno == EPIPE)
- php_handle_aborted_connection();
- if (n == -1 && errno == EAGAIN)
- continue;
- if (n <= 0)
- return n;
-
- TG(req)->bytes_sent += n;
- str += n;
- sent += n;
- str_length -= n;
- }
-
- return sent;
-}
-
-static int sapi_tux_send_headers(sapi_headers_struct *sapi_headers SLS_DC)
-{
- char buf[1024];
- struct iovec *vec;
- int n = 0;
- int max_headers;
- zend_llist_position pos;
- sapi_header_struct *h;
- size_t len;
- char *status_line;
- int locate_cl;
- TLS_FETCH();
-
- max_headers = 30;
- snprintf(buf, 1023, "HTTP/1.1 %d NA\r\n", SG(sapi_headers).http_response_code);
-
- vec = malloc(sizeof(struct iovec) * max_headers);
-
- vec[n].iov_base = strdup(buf);
- vec[n++].iov_len = strlen(buf);
-
- TG(req)->http_status = SG(sapi_headers).http_response_code;
- TG(req)->bytes_sent += len;
-
- if (TG(tux_action) == TUX_ACTION_FINISH_CLOSE_REQ && TG(req)->http_version == HTTP_1_1)
- locate_cl = 1;
- else
- locate_cl = 0;
-
- h = zend_llist_get_first_ex(&sapi_headers->headers, &pos);
- while (h) {
- if (locate_cl
- && strncasecmp(h->header, "Content-length:", sizeof("Content-length:")-1) == 0) {
- TG(tux_action) = TUX_ACTION_FINISH_REQ;
- locate_cl = 0;
- }
-
- vec[n].iov_base = h->header;
- vec[n++].iov_len = h->header_len;
- if (n >= max_headers - 3) {
- max_headers *= 2;
- vec = realloc(vec, sizeof(struct iovec) * max_headers);
- }
- vec[n].iov_base = "\r\n";
- vec[n++].iov_len = 2;
-
- h = zend_llist_get_next_ex(&sapi_headers->headers, &pos);
- }
-
- vec[n].iov_base = "\r\n";
- vec[n++].iov_len = 2;
-
- TG(number_vec) = n;
- TG(header_vec) = vec;
-
-
- return SAPI_HEADER_SENT_SUCCESSFULLY;
-}
-
-static int sapi_tux_read_post(char *buffer, uint count_bytes SLS_DC)
-{
-#if 0
- int amount = 0;
- TLS_FETCH();
-
- TG(req)->objectlen = count_bytes;
- TG(req)->object_addr = buffer;
- if (tux(TUX_ACTION_READ_POST_DATA, TG(req)))
- return 0;
-
- TG(read_post_data) = 1;
-
- return TG(req)->objectlen;
-#else
- return 0;
-#endif
-}
-
-static char *sapi_tux_read_cookies(SLS_D)
-{
- TLS_FETCH();
-
- return TG(req)->cookies;
-}
-
-#define BUF_SIZE 512
-#define ADD_STRING(name) \
- php_register_variable(name, buf, track_vars_array ELS_CC PLS_CC)
-
-static void sapi_tux_register_variables(zval *track_vars_array ELS_DC SLS_DC PLS_DC)
-{
- char buf[BUF_SIZE + 1];
- char *p;
- TLS_FETCH();
-
-
- sprintf(buf, "Server: %s", TUXAPI_version);
- sapi_add_header_ex(buf, strlen(buf), 1, 0);
- php_register_variable("PHP_SELF", SG(request_info).request_uri, track_vars_array ELS_CC PLS_CC);
- php_register_variable("SERVER_SOFTWARE", TUXAPI_version, track_vars_array ELS_CC PLS_CC);
- php_register_variable("GATEWAY_INTERFACE", "CGI/1.1", track_vars_array ELS_CC PLS_CC);
- php_register_variable("REQUEST_METHOD", (char *) SG(request_info).request_method, track_vars_array ELS_CC PLS_CC);
- php_register_variable("DOCUMENT_ROOT", TUXAPI_docroot, track_vars_array ELS_CC PLS_CC);
- php_register_variable("SERVER_NAME", TUXAPI_servername, track_vars_array ELS_CC PLS_CC);
- php_register_variable("REQUEST_URI", SG(request_info).request_uri, track_vars_array ELS_CC PLS_CC);
- php_register_variable("PATH_TRANSLATED", SG(request_info).path_translated, track_vars_array ELS_CC PLS_CC);
-
- p = inet_ntoa(TG(req)->client_host);
- /* string representation of IPs are never larger than 512 bytes */
- if (p) {
- memcpy(buf, p, strlen(p) + 1);
- ADD_STRING("REMOTE_ADDR");
- ADD_STRING("REMOTE_HOST");
- }
-
- sprintf(buf, "%d", CGI_SERVER_PORT(TG(req)));
- ADD_STRING("SERVER_PORT");
-
-#if 0
- snprintf(buf, BUF_SIZE, "/%s", TG(hc)->pathinfo);
- ADD_STRING("PATH_INFO");
-
- snprintf(buf, BUF_SIZE, "/%s", TG(hc)->origfilename);
- ADD_STRING("SCRIPT_NAME");
-#endif
-
-#define CONDADD(name, field) \
- if (TG(req)->field[0]) { \
- php_register_variable(#name, TG(req)->field, track_vars_array ELS_CC PLS_C); \
- }
-
- CONDADD(HTTP_REFERER, referer);
- CONDADD(HTTP_USER_AGENT, user_agent);
- CONDADD(HTTP_ACCEPT, accept);
- CONDADD(HTTP_ACCEPT_ENCODING, accept_encoding);
- CONDADD(HTTP_ACCEPT_LANGUAGE, accept_language);
- CONDADD(HTTP_COOKIE, cookies);
- CONDADD(CONTENT_TYPE, content_type);
-
-#if 0
- if (TG(hc)->contentlength != -1) {
- sprintf(buf, "%ld", (long) TG(hc)->contentlength);
- ADD_STRING("CONTENT_LENGTH");
- }
-#endif
-
-#if 0
- if (TG(hc)->authorization[0])
- php_register_variable("AUTH_TYPE", "Basic", track_vars_array ELS_CC PLS_C);
-#endif
-}
-
-static sapi_module_struct tux_sapi_module = {
- "tux",
- "tux",
-
- php_module_startup,
- php_module_shutdown_wrapper,
-
- NULL, /* activate */
- NULL, /* deactivate */
-
- sapi_tux_ub_write,
- NULL,
- NULL, /* get uid */
- NULL, /* getenv */
-
- php_error,
-
- NULL,
- sapi_tux_send_headers,
- NULL,
- sapi_tux_read_post,
- sapi_tux_read_cookies,
-
- sapi_tux_register_variables,
- NULL, /* Log message */
-
- NULL, /* Block interruptions */
- NULL, /* Unblock interruptions */
-
- STANDARD_SAPI_MODULE_PROPERTIES
-};
-
-static void tux_module_main(TLS_D SLS_DC)
-{
- zend_file_handle file_handle;
- CLS_FETCH();
- ELS_FETCH();
- PLS_FETCH();
-
- file_handle.type = ZEND_HANDLE_FILENAME;
- file_handle.filename = SG(request_info).path_translated;
- file_handle.free_filename = 0;
- file_handle.opened_path = NULL;
-
- if (php_request_startup(CLS_C ELS_CC PLS_CC SLS_CC) == FAILURE) {
- return;
- }
-
- php_execute_script(&file_handle CLS_CC ELS_CC PLS_CC);
- php_request_shutdown(NULL);
-}
-
-static void tux_request_ctor(TLS_D SLS_DC)
-{
- char buf[1024];
- int offset;
- size_t filename_len;
- size_t cwd_len;
- smart_str s = {0};
- char *p;
-
- TG(header_vec) = NULL;
- SG(request_info).query_string = strdup(TG(req)->query);
-
- smart_str_appends_ex(&s, "/", 1);
- smart_str_appends_ex(&s, TG(req)->query, 1);
- smart_str_0(&s);
- p = strchr(s.c, '&');
- if (p)
- *p = '\0';
- SG(request_info).path_translated = s.c;
-
- s.c = NULL;
- smart_str_appendc_ex(&s, '/', 1);
- smart_str_appends_ex(&s, TG(req)->objectname, 1);
- smart_str_0(&s);
- SG(request_info).request_uri = s.c;
- SG(request_info).request_method = CGI_REQUEST_METHOD(TG(req));
- SG(sapi_headers).http_response_code = 200;
- SG(request_info).content_type = TG(req)->content_type;
- SG(request_info).content_length = 0; // TG(req)->contentlength;
-
-#if 0
- php_handle_auth_data(TG(hc)->authorization SLS_CC);
-#endif
-}
-
-static void tux_request_dtor(TLS_D SLS_DC)
-{
- if (TG(header_vec))
- free(TG(header_vec));
- if (SG(request_info).query_string)
- free(SG(request_info).query_string);
- free(SG(request_info).request_uri);
- free(SG(request_info).path_translated);
-}
-
-#if 0
-static void *separate_thread(void *bla)
-{
- int fd;
- int i = 0;
-
- fd = (int) bla;
-
- while (i++ < 5) {
- send(fd, "test<br>\n", 9, 0);
- sleep(1);
- }
-
- tux(TUX_ACTION_CONTINUE_REQ, (user_req_t *) fd);
- /* We HAVE to trigger some event on the fd. Otherwise
- fast_thread won't wake up, so that the eventloop
- won't be entered -> TUX hangs */
- shutdown(fd, 2);
- pthread_exit(NULL);
-}
-#endif
-
-int TUXAPI_handle_events(user_req_t *req)
-{
- SLS_FETCH();
- TLS_FETCH();
-
- if (req->event == PHP_TUX_BACKGROUND_CONN) {
- tux_closed_conn(req->sock);
- return tux(TUX_ACTION_FINISH_CLOSE_REQ, req);
- }
-
- TG(req) = req;
- TG(tux_action) = TUX_ACTION_FINISH_CLOSE_REQ;
-
- tux_request_ctor(TLS_C SLS_CC);
-
- tux_module_main(TLS_C SLS_CC);
-
- tux_request_dtor(TLS_C SLS_CC);
-
- return tux(TG(tux_action), req);
-}
-
-void tux_register_on_close(void (*arg)(int))
-{
- TG(on_close) = arg;
-}
-
-void tux_closed_conn(int fd)
-{
- TLS_FETCH();
-
- if (TG(on_close)) TG(on_close)(fd);
-}
-
-int tux_get_fd(void)
-{
- TLS_FETCH();
-
- return TG(req)->sock;
-}
-
-void tux_set_dont_close(void)
-{
- TLS_FETCH();
-
- TG(req)->event = PHP_TUX_BACKGROUND_CONN;
- tux(TUX_ACTION_POSTPONE_REQ, TG(req));
- TG(tux_action) = TUX_ACTION_EVENTLOOP;
-}
-
-void TUXAPI_init(void)
-{
- sapi_startup(&tux_sapi_module);
- tux_sapi_module.startup(&tux_sapi_module);
- SG(server_context) = (void *) 1;
-}
-
-void doesnotmatter_fini(void)
-{
- if (SG(server_context) != NULL) {
- tux_sapi_module.shutdown(&tux_sapi_module);
- sapi_shutdown();
- }
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
- */
diff --git a/scripts/apache/apconf-conv.sh b/scripts/apache/apconf-conv.sh
deleted file mode 100755
index 6126bdc27d..0000000000
--- a/scripts/apache/apconf-conv.sh
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/bin/sh
-
-if [ "$1" = "" ]; then
- echo "Usage: $0 /somewhere/httpd.conf"
- exit 1
-fi
-
-if [ ! -w $1 ]; then
- echo "You cannot write to $1"
- exit 1
-fi
-
-TMPFILE=tmpfile.$$
-
-awk -f conffix.awk <$1 >$TMPFILE
-
-if [ "$?" != 0 ]; then
- exit 1
-fi
-
-mv -f $1 $1.orig
-mv -f $TMPFILE $1
-exit 0
-
diff --git a/scripts/apache/aphtaccess-conv.sh b/scripts/apache/aphtaccess-conv.sh
deleted file mode 100755
index 1af59d2843..0000000000
--- a/scripts/apache/aphtaccess-conv.sh
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/bin/sh
-
-if [ "$1" = "" ]; then
- echo "Usage: $0 /somewhere/.htaccess"
- exit 1
-fi
-
-if [ ! -w $1 ]; then
- echo "You cannot write to $1"
- exit 1
-fi
-
-TMPFILE=tmpfile.$$
-
-awk -f htaccessfix.awk <$1 >$TMPFILE
-
-if [ "$?" != 0 ]; then
- exit 1
-fi
-
-mv -f $1 $1.orig
-mv -f $TMPFILE $1
-exit 0
-
diff --git a/scripts/apache/conffix.awk b/scripts/apache/conffix.awk
deleted file mode 100644
index 88be6fade7..0000000000
--- a/scripts/apache/conffix.awk
+++ /dev/null
@@ -1,23 +0,0 @@
-# $Id$
-
-/^[ \t]*php3_*/ {
- phpcommand=substr($1,6)
- phpvalue=tolower($2)
- print "<IfModule mod_php3.c>"
- print $0
- print "</IfModule>"
- print "<IfModule mod_php4.c>"
- if (phpvalue=="on") {
- print "php_admin_flag " phpcommand " on"
- } else if (phpvalue=="off") {
- print "php_admin_flag " phpcommand " off"
- } else {
- print "php_admin_value " phpcommand " " substr($0,index($0,$1)+length($1)+1)
- }
- print "</IfModule>"
-}
-
-! /^[ \t]*php3_*/ {
- print $0
-}
-
diff --git a/scripts/apache/htaccessfix.awk b/scripts/apache/htaccessfix.awk
deleted file mode 100644
index 3c784cd335..0000000000
--- a/scripts/apache/htaccessfix.awk
+++ /dev/null
@@ -1,23 +0,0 @@
-# $Id$
-
-/^[ \t]*php3_*/ {
- phpcommand=substr($1,6)
- phpvalue=tolower($2)
- print "<IfModule mod_php3.c>"
- print $0
- print "</IfModule>"
- print "<IfModule mod_php4.c>"
- if (phpvalue=="on") {
- print "php_flag " phpcommand " on"
- } else if (phpvalue=="off") {
- print "php_flag " phpcommand " off"
- } else {
- print "php_value " phpcommand " " substr($0,index($0,$1)+length($1)+1)
- }
- print "</IfModule>"
-}
-
-! /^[ \t]*php3_*/ {
- print $0
-}
-
diff --git a/scripts/config-stubs b/scripts/config-stubs
deleted file mode 100755
index a32e7fc30a..0000000000
--- a/scripts/config-stubs
+++ /dev/null
@@ -1,8 +0,0 @@
-#!/bin/sh
-#
-# $Id$
-
-dir=$1; shift
-for stubfile in $dir/*/config0.m4 $dir/*/config.m4; do
- echo "sinclude($stubfile)"
-done
diff --git a/scripts/conv_proto b/scripts/conv_proto
deleted file mode 100755
index fad9cfaa83..0000000000
--- a/scripts/conv_proto
+++ /dev/null
@@ -1,30 +0,0 @@
-#! /bin/sh
-#
-# do some automatic conversion of prototypes
-#
-
-if test "$1" = "" ; then
- echo "usage: $0 list-of-files"
- exit 1
-fi
-
-tmpfile=`mktemp -q /tmp/asd.XXXXXX`
-
-if test "$?" != "0" ; then
- echo "$0: cannot create temporary file"
- exit 1
-fi
-
-for file in ${1+"$@"} ; do
- echo "working on $file"
- cat $file | \
- sed -e \
- 's/void php3_\(.*\)(INTERNAL_FUNCTION_PARAMETERS)/PHP_FUNCTION(\1)/' \
- -e 's/^extern void /void /' \
- -e 's/^extern PHP_FUNCTION/PHP_FUNCTION/' > $tmpfile
- cp $tmpfile $file
-done
-
-rm -f $tmpfile
-
-exit 0
diff --git a/scripts/conv_z_macros b/scripts/conv_z_macros
deleted file mode 100755
index 3ed9274d97..0000000000
--- a/scripts/conv_z_macros
+++ /dev/null
@@ -1,44 +0,0 @@
-#! /bin/sh
-#
-# +----------------------------------------------------------------------+
-# | PHP version 4.0 |
-# +----------------------------------------------------------------------+
-# | Copyright (c) 1997-2001 The PHP Group |
-# +----------------------------------------------------------------------+
-# | This source file is subject to version 2.02 of the PHP license, |
-# | that is bundled with this package in the file LICENSE, and is |
-# | available at through the world-wide-web at |
-# | http://www.php.net/license/2_02.txt. |
-# | If you did not receive a copy of the PHP license and are unable to |
-# | obtain it through the world-wide-web, please send a note to |
-# | license@php.net so we can mail you a copy immediately. |
-# +----------------------------------------------------------------------+
-# | Authors: Sascha Schumann <sascha@schumann.cx> |
-# +----------------------------------------------------------------------+#
-#
-# $Id$
-
-for i in $@; do
- sed \
- -e 's/(\*\([a-z_][]a-z_\[]*\))->type/Z_TYPE_PP(\1)/g' \
- -e 's/\([a-z_][]a-z_\[]*\)->type/Z_TYPE_P(\1)/g' \
- -e 's/\([a-z_][]a-z_\[]*\)\.type/Z_TYPE(\1)/g' \
- -e 's/(\*\([a-z_][]a-z_\[]*\))->value\.dval/Z_DVAL_PP(\1)/g' \
- -e 's/\([a-z_][]a-z_\[]*\)->value\.dval/Z_DVAL_P(\1)/g' \
- -e 's/\([a-z_][]a-z_\[]*\)\.value\.dval/Z_DVAL(\1)/g' \
- -e 's/(\*\([a-z_][]a-z_\[]*\))->value\.lval/Z_LVAL_PP(\1)/g' \
- -e 's/\([a-z_][]a-z_\[]*\)->value\.lval/Z_LVAL_P(\1)/g' \
- -e 's/\([a-z_][]a-z_\[]*\)\.value\.lval/Z_LVAL(\1)/g' \
- -e 's/(\*\([a-z_][]a-z_\[]*\))->value\.ht/Z_ARRVAL_PP(\1)/g' \
- -e 's/\([a-z_][]a-z_\[]*\)->value\.ht/Z_ARRVAL_P(\1)/g' \
- -e 's/\([a-z_][]a-z_\[]*\)\.value\.ht/Z_ARRVAL(\1)/g' \
- -e 's/(\*\([a-z_][]a-z_\[]*\))->value\.str\.val/Z_STRVAL_PP(\1)/g' \
- -e 's/\([a-z_][]a-z_\[]*\)->value\.str\.val/Z_STRVAL_P(\1)/g' \
- -e 's/\([a-z_][]a-z_\[]*\)\.value\.str\.val/Z_STRVAL(\1)/g' \
- -e 's/(\*\([a-z_][]a-z_\[]*\))->value\.str\.len/Z_STRLEN_PP(\1)/g' \
- -e 's/\([a-z_][]a-z_\[]*\)->value\.str\.len/Z_STRLEN_P(\1)/g' \
- -e 's/\([a-z_][]a-z_\[]*\)\.value\.str\.len/Z_STRLEN(\1)/g' \
- < $i > tmp && cp tmp $i
-done
-
-rm -f tmp
diff --git a/scripts/credits b/scripts/credits
deleted file mode 100755
index 812658b40a..0000000000
--- a/scripts/credits
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/bin/sh
-awkprog='
-BEGIN { FS = "\n"; RS = "" }
-{ print "CREDIT_LINE(\""$1"\",\""$2"\");" }'
-
-for what in ext sapi
-do
- file=ext/standard/credits_$what.h
- cat >$file <<END
-/*
- DO NOT EDIT THIS FILE!
-
- it has been automaticaly created by php4/scripts/credits from
- the information found in the various php4/ext/.../CREDITS and
- php4/sapi/.../CREDITS files
-
- if you want to change an entry you have to edit the appropriate
- CREDITS file instead
-
-*/
-
-END
- awk "$awkprog" $what/*/CREDITS | sort -f >> $file
-done
diff --git a/snapshot b/snapshot
deleted file mode 100755
index f8e13ef9d9..0000000000
--- a/snapshot
+++ /dev/null
@@ -1,7 +0,0 @@
-#! /bin/sh
-
-if test -n "$1"; then
- flags="DISTNAME=$1"
-fi
-
-${MAKE:-make} $flags -f build/build.mk snapshot
diff --git a/stamp-h.in b/stamp-h.in
deleted file mode 100644
index 9788f70238..0000000000
--- a/stamp-h.in
+++ /dev/null
@@ -1 +0,0 @@
-timestamp
diff --git a/strtok_r.c b/strtok_r.c
deleted file mode 100644
index fea43bdead..0000000000
--- a/strtok_r.c
+++ /dev/null
@@ -1,113 +0,0 @@
-#include "php.h"
-
-#ifndef HAVE_STRTOK_R
-
-/*
- * Copyright (c) 1998 Softweyr LLC. All rights reserved.
- *
- * strtok_r, from Berkeley strtok
- * Oct 13, 1998 by Wes Peters <wes@softweyr.com>
- *
- * Copyright (c) 1988, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notices, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notices, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- *
- * This product includes software developed by Softweyr LLC, the
- * University of California, Berkeley, and its contributors.
- *
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY SOFTWEYR LLC, THE REGENTS AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
- * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SOFTWEYR LLC, THE
- * REGENTS, OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
- * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <stddef.h>
-#include <string.h>
-
-char *
-strtok_r(char *s, const char *delim, char **last)
-{
- char *spanp;
- int c, sc;
- char *tok;
-
- if (s == NULL && (s = *last) == NULL)
- {
- return NULL;
- }
-
- /*
- * Skip (span) leading delimiters (s += strspn(s, delim), sort of).
- */
-cont:
- c = *s++;
- for (spanp = (char *)delim; (sc = *spanp++) != 0; )
- {
- if (c == sc)
- {
- goto cont;
- }
- }
-
- if (c == 0) /* no non-delimiter characters */
- {
- *last = NULL;
- return NULL;
- }
- tok = s - 1;
-
- /*
- * Scan token (scan for delimiters: s += strcspn(s, delim), sort of).
- * Note that delim must have one NUL; we stop if we see that, too.
- */
- for (;;)
- {
- c = *s++;
- spanp = (char *)delim;
- do
- {
- if ((sc = *spanp++) == c)
- {
- if (c == 0)
- {
- s = NULL;
- }
- else
- {
- char *w = s - 1;
- *w = '\0';
- }
- *last = s;
- return tok;
- }
- }
- while (sc != 0);
- }
- /* NOTREACHED */
-}
-
-#endif
diff --git a/stub.c b/stub.c
deleted file mode 100644
index 8b13789179..0000000000
--- a/stub.c
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/tests/README b/tests/README
deleted file mode 100755
index 3c739c2fa9..0000000000
--- a/tests/README
+++ /dev/null
@@ -1,60 +0,0 @@
-PHP Regression Tests
-====================
-
-To run the tests, go to the top-level directory and
-run "./php -q run-tests.php".
-
-Without parameters, "run-tests.php" will recursively scan through the
-file tree looking for directories called "tests", and run all the
-tests (.phpt files) within (recursively).
-
-To run tests in a single directory, pass the directory as a parameter:
-"./php -q run-tests.php tests/lang".
-
-To run one or more single tests, pass them as parameters:
-"./php -q run-tests.php tests/lang/015.phpt".
-
-The format of the .phpt files is quite simple. There are 6 possible
-sections. Test, Skipif, Post, Get, File and Expect. The Test section
-contains the description of the test. The Skipif section contains
-code that should print "skip" if this test should be skipped for some
-reason (such as an extension that is not compiled in). The Post
-section contains any post data that the script might need. The Get
-section contains any Get data. Note that both the Post and the Get
-sections need to have this data in url-encoded format. The File
-section contains the actual script and the Expect section is the
-expected output, sans headers. Blank lines are ignored in the
-expected output.
-
-A simple example which takes one argument through the POST method
-and one through the GET and displays these would be:
-
---TEST--
-Simple GET and POST test
---SKIPIF--
---POST--
-a=Hello
---GET--
-b=There
---FILE--
-<?php echo "$a $b">
---EXPECT--
-Hello There
-
-Another simple example that only runs if the PCRE extension is loaded:
-
---TEST--
-Simple Perl regexp test
---SKIPIF--
-<?php if (!extension_loaded("pcre")) print "skip"; ?>
---POST--
---GET--
---FILE--
-<?php
-$str="Hello 42 World";
-if (pcre_match('/^([a-z]+)\s+(\d+)\s+([a-z]+)/i', $str, $matches)) {
- printf("%s %s: %d\n", $matches[1], $matches[3], $matches[2]);
-}
-?>
---EXPECT--
-Hello World: 42
diff --git a/tests/basic/001.phpt b/tests/basic/001.phpt
deleted file mode 100644
index 4cc79613c5..0000000000
--- a/tests/basic/001.phpt
+++ /dev/null
@@ -1,8 +0,0 @@
---TEST--
-Trivial "Hello World" test
---POST--
---GET--
---FILE--
-<?php echo "Hello World"?>
---EXPECT--
-Hello World
diff --git a/tests/basic/002.phpt b/tests/basic/002.phpt
deleted file mode 100644
index d694a201c2..0000000000
--- a/tests/basic/002.phpt
+++ /dev/null
@@ -1,10 +0,0 @@
---TEST--
-Simple POST Method test
---POST--
-a=Hello+World
---GET--
---FILE--
-<?php error_reporting(0);
-echo $a?>
---EXPECT--
-Hello World
diff --git a/tests/basic/003.phpt b/tests/basic/003.phpt
deleted file mode 100644
index c728a79efd..0000000000
--- a/tests/basic/003.phpt
+++ /dev/null
@@ -1,12 +0,0 @@
---TEST--
-GET and POST Method combined
---POST--
-a=Hello+World
---GET--
-b=Hello+Again+World&c=Hi+Mom
---FILE--
-<?php
-error_reporting(0);
-echo "$a $b $c"?>
---EXPECT--
-Hello World Hello Again World Hi Mom
diff --git a/tests/basic/004.phpt b/tests/basic/004.phpt
deleted file mode 100644
index 4e8eb2b2c0..0000000000
--- a/tests/basic/004.phpt
+++ /dev/null
@@ -1,11 +0,0 @@
---TEST--
-Two variables in POST data
---POST--
-a=Hello+World&b=Hello+Again+World
---GET--
---FILE--
-<?php
-error_reporting(0);
-echo "$a $b"?>
---EXPECT--
-Hello World Hello Again World
diff --git a/tests/basic/005.phpt b/tests/basic/005.phpt
deleted file mode 100644
index 9a30c59194..0000000000
--- a/tests/basic/005.phpt
+++ /dev/null
@@ -1,11 +0,0 @@
---TEST--
-Three variables in POST data
---POST--
-a=Hello+World&b=Hello+Again+World&c=1
---GET--
---FILE--
-<?php
-error_reporting(0);
-echo "$a $b $c"?>
---EXPECT--
-Hello World Hello Again World 1
diff --git a/tests/basic/006.phpt b/tests/basic/006.phpt
deleted file mode 100644
index 3b88acc32f..0000000000
--- a/tests/basic/006.phpt
+++ /dev/null
@@ -1,8 +0,0 @@
---TEST--
-Add 3 variables together and print result
---POST--
---GET--
---FILE--
-<?php $a=1; $b=2; $c=3; $d=$a+$b+$c; echo $d?>
---EXPECT--
-6
diff --git a/tests/basic/007.phpt b/tests/basic/007.phpt
deleted file mode 100644
index 90fdc7e545..0000000000
--- a/tests/basic/007.phpt
+++ /dev/null
@@ -1,8 +0,0 @@
---TEST--
-Multiply 3 variables and print result
---POST--
---GET--
---FILE--
-<?php $a=2; $b=4; $c=8; $d=$a*$b*$c; echo $d?>
---EXPECT--
-64
diff --git a/tests/basic/008.phpt b/tests/basic/008.phpt
deleted file mode 100644
index 927bf0e509..0000000000
--- a/tests/basic/008.phpt
+++ /dev/null
@@ -1,8 +0,0 @@
---TEST--
-Divide 3 variables and print result
---POST--
---GET--
---FILE--
-<?php $a=27; $b=3; $c=3; $d=$a/$b/$c; echo $d?>
---EXPECT--
-3
diff --git a/tests/basic/009.phpt b/tests/basic/009.phpt
deleted file mode 100644
index d78b195d0b..0000000000
--- a/tests/basic/009.phpt
+++ /dev/null
@@ -1,8 +0,0 @@
---TEST--
-Subtract 3 variables and print result
---POST--
---GET--
---FILE--
-<?php $a=27; $b=7; $c=10; $d=$a-$b-$c; echo $d?>
---EXPECT--
-10
diff --git a/tests/basic/010.phpt b/tests/basic/010.phpt
deleted file mode 100644
index 4440d99bf8..0000000000
--- a/tests/basic/010.phpt
+++ /dev/null
@@ -1,8 +0,0 @@
---TEST--
-Testing | and & operators
---POST--
---GET--
---FILE--
-<?php $a=8; $b=4; $c=8; echo $a|$b&$c?>
---EXPECT--
-8
diff --git a/tests/basic/011.phpt b/tests/basic/011.phpt
deleted file mode 100644
index 7c2d395b9d..0000000000
--- a/tests/basic/011.phpt
+++ /dev/null
@@ -1,17 +0,0 @@
---TEST--
-Testing $argc and $argv handling
---POST--
---GET--
-ab+cd+ef+123+test
---FILE--
-<?php
- for($i=0;$i<$argc;$i++) {
- echo "$i: ".$argv[$i]."\n";
- }
-?>
---EXPECT--
-0: ab
-1: cd
-2: ef
-3: 123
-4: test
diff --git a/tests/classes/class_example.phpt b/tests/classes/class_example.phpt
deleted file mode 100644
index 8f07c278fc..0000000000
--- a/tests/classes/class_example.phpt
+++ /dev/null
@@ -1,87 +0,0 @@
---TEST--
-Classes general test
---POST--
---GET--
---FILE--
-
-<?php
-
-/* pretty nifty object oriented code! */
-
-class user {
- var $first_name,$family_name,$address,$phone_num;
- function display()
- {
- echo "User information\n";
- echo "----------------\n\n";
- echo "First name:\t ".$this->first_name."\n";
- echo "Family name:\t ".$this->family_name."\n";
- echo "Address:\t ".$this->address."\n";
- echo "Phone:\t\t ".$this->phone_num."\n";
- echo "\n\n";
- }
- function initialize($first_name,$family_name,$address,$phone_num)
- {
- $this->first_name = $first_name;
- $this->family_name = $family_name;
- $this->address = $address;
- $this->phone_num = $phone_num;
- }
-};
-
-
-function test($u)
-{ /* one can pass classes as arguments */
- $u->display();
- $t = $u;
- $t->address = "New address...";
- return $t; /* and also return them as return values */
-}
-
-$user1 = new user;
-$user2 = new user;
-
-$user1->initialize("Zeev","Suraski","Ben Gourion 3, Kiryat Bialik, Israel","+972-4-8713139");
-$user2->initialize("Andi","Gutmans","Haifa, Israel","+972-4-8231621");
-$user1->display();
-$user2->display();
-
-$tmp = test($user2);
-$tmp->display();
-
-?>
---EXPECT--
-User information
-----------------
-
-First name: Zeev
-Family name: Suraski
-Address: Ben Gourion 3, Kiryat Bialik, Israel
-Phone: +972-4-8713139
-
-
-User information
-----------------
-
-First name: Andi
-Family name: Gutmans
-Address: Haifa, Israel
-Phone: +972-4-8231621
-
-
-User information
-----------------
-
-First name: Andi
-Family name: Gutmans
-Address: Haifa, Israel
-Phone: +972-4-8231621
-
-
-User information
-----------------
-
-First name: Andi
-Family name: Gutmans
-Address: New address...
-Phone: +972-4-8231621
diff --git a/tests/classes/inheritance.phpt b/tests/classes/inheritance.phpt
deleted file mode 100644
index 2a2f0f755b..0000000000
--- a/tests/classes/inheritance.phpt
+++ /dev/null
@@ -1,58 +0,0 @@
---TEST--
-Classes inheritance test
---POST--
---GET--
---FILE--
-<?php
-
-/* Inheritance test. Pretty nifty if I do say so myself! */
-
-class foo {
- var $a;
- var $b;
- function display() {
- echo "This is class foo\n";
- echo "a = ".$this->a."\n";
- echo "b = ".$this->b."\n";
- }
- function mul() {
- return $this->a*$this->b;
- }
-};
-
-class bar extends foo {
- var $c;
- function display() { /* alternative display function for class bar */
- echo "This is class bar\n";
- echo "a = ".$this->a."\n";
- echo "b = ".$this->b."\n";
- echo "c = ".$this->c."\n";
- }
-};
-
-
-$foo1 = new foo;
-$foo1->a = 2;
-$foo1->b = 5;
-$foo1->display();
-echo $foo1->mul()."\n";
-
-echo "-----\n";
-
-$bar1 = new bar;
-$bar1->a = 4;
-$bar1->b = 3;
-$bar1->c = 12;
-$bar1->display();
-echo $bar1->mul()."\n";
---EXPECT--
-This is class foo
-a = 2
-b = 5
-10
------
-This is class bar
-a = 4
-b = 3
-c = 12
-12
diff --git a/tests/dirname.phpt b/tests/dirname.phpt
deleted file mode 100644
index c2e1edbe14..0000000000
--- a/tests/dirname.phpt
+++ /dev/null
@@ -1,30 +0,0 @@
---TEST--
-dirname test
---FILE--
-<?php
-
- function check_dirname($path)
- {
- print "dirname($path) == " . dirname($path) . "\n";
- }
-
- check_dirname("/foo/");
- check_dirname("/foo");
- check_dirname("/foo/bar");
- check_dirname("d:\\foo\\bar.inc");
- check_dirname("/");
- check_dirname(".../foo");
- check_dirname("./foo");
- check_dirname("foobar///");
- check_dirname("c:\foo");
-?>
---EXPECT--
-dirname(/foo/) == /
-dirname(/foo) == /
-dirname(/foo/bar) == /foo
-dirname(d:\foo\bar.inc) == .
-dirname(/) == /
-dirname(.../foo) == ...
-dirname(./foo) == .
-dirname(foobar///) == .
-dirname(c:\foo) == .
diff --git a/tests/foo b/tests/foo
deleted file mode 100644
index 125c655b0f..0000000000
--- a/tests/foo
+++ /dev/null
@@ -1,5 +0,0 @@
-a
-b
-@c@
-d
-e
diff --git a/tests/foo2 b/tests/foo2
deleted file mode 100644
index 4cdd41e3dc..0000000000
--- a/tests/foo2
+++ /dev/null
@@ -1,3 +0,0 @@
-<?
-
-print $a->b(12,13)."\n";
diff --git a/tests/foo3 b/tests/foo3
deleted file mode 100644
index 08681b98c2..0000000000
--- a/tests/foo3
+++ /dev/null
@@ -1,43 +0,0 @@
-<?
-
-class foo {
- function foo() {
- print "foo()\n";
- }
- function bar(&$blah, $foobar=7) {
- $foobar += 19;
- }
-
- function hello_world() {
- return "Hello, World!";
- }
-
- function print_string($str) {
- print "$str\n";
- return 666;
- }
- var $foo;
- var $bar="this is a test...";
-};
-
-class bar {
- function foo($a,$b) {
- $a *= 3;
- return $a+$b;
- }
- function bar(&$blah, $foobar=7) {
- $foobar += 19;
- }
-
- var $foo;
- var $bar="this is a test...";
-};
-
-
-$b = new foo;
-$a = $b;
-print $a->print_string($a->hello_world())."\n";
-print $b->print_string($b->hello_world())."\n";
-$a->foo = 5;
-print $a->foo;
-print $a->foo();
diff --git a/tests/foo4 b/tests/foo4
deleted file mode 100644
index 29df84d0e2..0000000000
--- a/tests/foo4
+++ /dev/null
@@ -1,41 +0,0 @@
-<?
-
-class foo {
- function foo($a,$b) {
- $a *= 3;
- return $a+$b;
- }
- function bar(&$blah, $foobar=7) {
- $foobar += 19;
- }
-
- function hello_world() {
- return "Hello, World!";
- }
-
- function print_string($str) {
- print "$str\n";
- return 666;
- }
- var $foo;
- var $bar="this is a test....";
-};
-
-class bar {
- function foo($a,$b) {
- $a *= 3;
- return $a+$b;
- }
- function bar(&$blah, $foobar=7) {
- $foobar += 19;
- }
-
- var $foo;
- var $bar="this is a test...";
-};
-
-
-$b = new foo;
-$a = &$b;
-$b->asd = 5;
-print $b->asd;
diff --git a/tests/func/001.phpt b/tests/func/001.phpt
deleted file mode 100644
index c5553cd8a8..0000000000
--- a/tests/func/001.phpt
+++ /dev/null
@@ -1,8 +0,0 @@
---TEST--
-Strlen() function test
---POST--
---GET--
---FILE--
-<?php echo strlen("abcdef")?>
---EXPECT--
-6
diff --git a/tests/func/002.phpt b/tests/func/002.phpt
deleted file mode 100644
index aa752ee13c..0000000000
--- a/tests/func/002.phpt
+++ /dev/null
@@ -1,22 +0,0 @@
---TEST--
-Static variables in functions
---POST--
---GET--
---FILE--
-<?php
-old_function blah (
- static $hey=0,$yo=0;
-
- echo "hey=".$hey++.", ",$yo--."\n";
-);
-
-blah();
-blah();
-blah();
-if (isset($hey) || isset($yo)) {
- echo "Local variables became global :(\n";
-}
---EXPECT--
-hey=0, 0
-hey=1, -1
-hey=2, -2
diff --git a/tests/func/003.phpt b/tests/func/003.phpt
deleted file mode 100644
index 6f21a34a42..0000000000
--- a/tests/func/003.phpt
+++ /dev/null
@@ -1,289 +0,0 @@
---TEST--
-General function test
---POST--
---GET--
---FILE--
-<?php
-
-old_function a (
- echo "hey\n";
-);
-
-function b($i)
-{
- echo "$i\n";
-}
-
-
-function c($i,$j)
-{
- echo "Counting from $i to $j\n";
- for ($k=$i; $k<=$j; $k++) {
- echo "$k\n";
- }
-}
-
-
-
-a();
-b("blah");
-a();
-b("blah","blah");
-c(7,14);
-
-a();
-
-
-old_function factorial $n (
- if ($n==0 || $n==1) {
- return 1;
- } else {
- return factorial($n-1)*$n;
- }
-);
-
-
-function factorial2($start, $n)
-{
- if ($n<=$start) {
- return $start;
- } else {
- return factorial2($start,$n-1)*$n;
- }
-}
-
-
-for ($k=0; $k<10; $k++) {
- for ($i=0; $i<=10; $i++) {
- $n=factorial($i);
- echo "factorial($i) = $n\n";
- }
-}
-
-
-echo "and now, from a function...\n";
-
-old_function call_fact (
- echo "(it should break at 5...)\n";
- for ($i=0; $i<=10; $i++) {
- if ($i == 5) break;
- $n=factorial($i);
- echo "factorial($i) = $n\n";
- }
-);
-
-old_function return4 ( return 4; );
-old_function return7 ( return 7; );
-
-for ($k=0; $k<10; $k++) {
- call_fact();
-}
-
-echo "------\n";
-$result = factorial(factorial(3));
-echo "$result\n";
-
-$result=factorial2(return4(),return7());
-echo "$result\n";
-
-old_function andi $i, $j (
- for ($k=$i ; $k<=$j ; $k++) {
- if ($k >5) continue;
- echo "$k\n";
- }
-);
-
-andi (3,10);
---EXPECT--
-hey
-blah
-hey
-blah
-Counting from 7 to 14
-7
-8
-9
-10
-11
-12
-13
-14
-hey
-factorial(0) = 1
-factorial(1) = 1
-factorial(2) = 2
-factorial(3) = 6
-factorial(4) = 24
-factorial(5) = 120
-factorial(6) = 720
-factorial(7) = 5040
-factorial(8) = 40320
-factorial(9) = 362880
-factorial(10) = 3628800
-factorial(0) = 1
-factorial(1) = 1
-factorial(2) = 2
-factorial(3) = 6
-factorial(4) = 24
-factorial(5) = 120
-factorial(6) = 720
-factorial(7) = 5040
-factorial(8) = 40320
-factorial(9) = 362880
-factorial(10) = 3628800
-factorial(0) = 1
-factorial(1) = 1
-factorial(2) = 2
-factorial(3) = 6
-factorial(4) = 24
-factorial(5) = 120
-factorial(6) = 720
-factorial(7) = 5040
-factorial(8) = 40320
-factorial(9) = 362880
-factorial(10) = 3628800
-factorial(0) = 1
-factorial(1) = 1
-factorial(2) = 2
-factorial(3) = 6
-factorial(4) = 24
-factorial(5) = 120
-factorial(6) = 720
-factorial(7) = 5040
-factorial(8) = 40320
-factorial(9) = 362880
-factorial(10) = 3628800
-factorial(0) = 1
-factorial(1) = 1
-factorial(2) = 2
-factorial(3) = 6
-factorial(4) = 24
-factorial(5) = 120
-factorial(6) = 720
-factorial(7) = 5040
-factorial(8) = 40320
-factorial(9) = 362880
-factorial(10) = 3628800
-factorial(0) = 1
-factorial(1) = 1
-factorial(2) = 2
-factorial(3) = 6
-factorial(4) = 24
-factorial(5) = 120
-factorial(6) = 720
-factorial(7) = 5040
-factorial(8) = 40320
-factorial(9) = 362880
-factorial(10) = 3628800
-factorial(0) = 1
-factorial(1) = 1
-factorial(2) = 2
-factorial(3) = 6
-factorial(4) = 24
-factorial(5) = 120
-factorial(6) = 720
-factorial(7) = 5040
-factorial(8) = 40320
-factorial(9) = 362880
-factorial(10) = 3628800
-factorial(0) = 1
-factorial(1) = 1
-factorial(2) = 2
-factorial(3) = 6
-factorial(4) = 24
-factorial(5) = 120
-factorial(6) = 720
-factorial(7) = 5040
-factorial(8) = 40320
-factorial(9) = 362880
-factorial(10) = 3628800
-factorial(0) = 1
-factorial(1) = 1
-factorial(2) = 2
-factorial(3) = 6
-factorial(4) = 24
-factorial(5) = 120
-factorial(6) = 720
-factorial(7) = 5040
-factorial(8) = 40320
-factorial(9) = 362880
-factorial(10) = 3628800
-factorial(0) = 1
-factorial(1) = 1
-factorial(2) = 2
-factorial(3) = 6
-factorial(4) = 24
-factorial(5) = 120
-factorial(6) = 720
-factorial(7) = 5040
-factorial(8) = 40320
-factorial(9) = 362880
-factorial(10) = 3628800
-and now, from a function...
-(it should break at 5...)
-factorial(0) = 1
-factorial(1) = 1
-factorial(2) = 2
-factorial(3) = 6
-factorial(4) = 24
-(it should break at 5...)
-factorial(0) = 1
-factorial(1) = 1
-factorial(2) = 2
-factorial(3) = 6
-factorial(4) = 24
-(it should break at 5...)
-factorial(0) = 1
-factorial(1) = 1
-factorial(2) = 2
-factorial(3) = 6
-factorial(4) = 24
-(it should break at 5...)
-factorial(0) = 1
-factorial(1) = 1
-factorial(2) = 2
-factorial(3) = 6
-factorial(4) = 24
-(it should break at 5...)
-factorial(0) = 1
-factorial(1) = 1
-factorial(2) = 2
-factorial(3) = 6
-factorial(4) = 24
-(it should break at 5...)
-factorial(0) = 1
-factorial(1) = 1
-factorial(2) = 2
-factorial(3) = 6
-factorial(4) = 24
-(it should break at 5...)
-factorial(0) = 1
-factorial(1) = 1
-factorial(2) = 2
-factorial(3) = 6
-factorial(4) = 24
-(it should break at 5...)
-factorial(0) = 1
-factorial(1) = 1
-factorial(2) = 2
-factorial(3) = 6
-factorial(4) = 24
-(it should break at 5...)
-factorial(0) = 1
-factorial(1) = 1
-factorial(2) = 2
-factorial(3) = 6
-factorial(4) = 24
-(it should break at 5...)
-factorial(0) = 1
-factorial(1) = 1
-factorial(2) = 2
-factorial(3) = 6
-factorial(4) = 24
-------
-720
-840
-3
-4
-5
-
diff --git a/tests/func/004.phpt b/tests/func/004.phpt
deleted file mode 100644
index 465cb5d2a1..0000000000
--- a/tests/func/004.phpt
+++ /dev/null
@@ -1,65 +0,0 @@
---TEST--
-General function test
---POST--
---GET--
---FILE--
-<?php
-
-echo "Before function declaration...\n";
-
-old_function print_something_multiple_times $something,$times (
- echo "----\nIn function, printing the string \"$something\" $times times\n";
- for ($i=0; $i<$times; $i++) {
- echo "$i) $something\n";
- }
- echo "Done with function...\n-----\n";
-);
-
-old_function some_other_function (
- echo "This is some other function, to ensure more than just one function works fine...\n";
-);
-
-
-echo "After function declaration...\n";
-
-echo "Calling function for the first time...\n";
-print_something_multiple_times("This works!",10);
-echo "Returned from function call...\n";
-
-echo "Calling the function for the second time...\n";
-print_something_multiple_times("This like, really works and stuff...",3);
-echo "Returned from function call...\n";
-
-some_other_function();
-
-?>
---EXPECT--
-
-Before function declaration...
-After function declaration...
-Calling function for the first time...
-----
-In function, printing the string "This works!" 10 times
-0) This works!
-1) This works!
-2) This works!
-3) This works!
-4) This works!
-5) This works!
-6) This works!
-7) This works!
-8) This works!
-9) This works!
-Done with function...
------
-Returned from function call...
-Calling the function for the second time...
-----
-In function, printing the string "This like, really works and stuff..." 3 times
-0) This like, really works and stuff...
-1) This like, really works and stuff...
-2) This like, really works and stuff...
-Done with function...
------
-Returned from function call...
-This is some other function, to ensure more than just one function works fine...
diff --git a/tests/func/005.phpt b/tests/func/005.phpt
deleted file mode 100644
index 4a20786df0..0000000000
--- a/tests/func/005.phpt
+++ /dev/null
@@ -1,22 +0,0 @@
---TEST--
-Testing register_shutdown_function()
---POST--
---GET--
-ab+cd+ef+123+test
---FILE--
-<?php
-
-function foo()
-{
- print "foo";
-}
-
-register_shutdown_function("foo");
-
-print "foo() will be called on shutdown...\n";
-
-?>
---EXPECT--
-foo() will be called on shutdown...
-foo
-
diff --git a/tests/lang/001.phpt b/tests/lang/001.phpt
deleted file mode 100644
index d90e9b8d3d..0000000000
--- a/tests/lang/001.phpt
+++ /dev/null
@@ -1,8 +0,0 @@
---TEST--
-Simple If condition test
---POST--
---GET--
---FILE--
-<?php $a=1; if($a>0) { echo "Yes"; } ?>
---EXPECT--
-Yes
diff --git a/tests/lang/002.phpt b/tests/lang/002.phpt
deleted file mode 100644
index 9197a9762b..0000000000
--- a/tests/lang/002.phpt
+++ /dev/null
@@ -1,12 +0,0 @@
---TEST--
-Simple While Loop Test
---POST--
---GET--
---FILE--
-<?php $a=1;
- while($a<10):
- echo $a;
- $a++;
- endwhile?>
---EXPECT--
-123456789
diff --git a/tests/lang/003.phpt b/tests/lang/003.phpt
deleted file mode 100644
index 23bc99e9f4..0000000000
--- a/tests/lang/003.phpt
+++ /dev/null
@@ -1,19 +0,0 @@
---TEST--
-Simple Switch Test
---POST--
---GET--
---FILE--
-<?php $a=1;
- switch($a):
- case 0;
- echo "bad";
- break;
- case 1;
- echo "good";
- break;
- default;
- echo "bad";
- break;
- endswitch?>
---EXPECT--
-good
diff --git a/tests/lang/004.phpt b/tests/lang/004.phpt
deleted file mode 100644
index be1f98ade5..0000000000
--- a/tests/lang/004.phpt
+++ /dev/null
@@ -1,13 +0,0 @@
---TEST--
-Simple If/Else Test
---POST--
---GET--
---FILE--
-<?php $a=1;
- if($a==0):
- echo "bad";
- else:
- echo "good";
- endif?>
---EXPECT--
-good
diff --git a/tests/lang/005.phpt b/tests/lang/005.phpt
deleted file mode 100644
index ea413769b0..0000000000
--- a/tests/lang/005.phpt
+++ /dev/null
@@ -1,15 +0,0 @@
---TEST--
-Simple If/ElseIf/Else Test
---POST--
---GET--
---FILE--
-<?php $a=1;
- if($a==0):
- echo "bad";
- elseif($a==3):
- echo "bad";
- else:
- echo "good";
- endif?>
---EXPECT--
-good
diff --git a/tests/lang/006.phpt b/tests/lang/006.phpt
deleted file mode 100644
index b0cc9cf0e2..0000000000
--- a/tests/lang/006.phpt
+++ /dev/null
@@ -1,21 +0,0 @@
---TEST--
-Nested If/ElseIf/Else Test
---POST--
---GET--
---FILE--
-<?php $a=1; $b=2;
- if($a==0):
- echo "bad";
- elseif($a==3):
- echo "bad";
- else:
- if($b==1):
- echo "bad";
- elseif($b==2):
- echo "good";
- else:
- echo "bad";
- endif;
- endif?>
---EXPECT--
-good
diff --git a/tests/lang/007.phpt b/tests/lang/007.phpt
deleted file mode 100644
index f0aa61f876..0000000000
--- a/tests/lang/007.phpt
+++ /dev/null
@@ -1,25 +0,0 @@
---TEST--
-Function call with global and static variables
---POST--
---GET--
---FILE--
-<?php error_reporting(0);
- $a = 10;
- function Test()
- {
- static $a=1;
- global $b;
- $c = 1;
- $b = 5;
- echo "$a $b ";
- $a++;
- $c++;
- echo "$a $c ";
- }
- Test();
- echo "$a $b $c ";
- Test();
- echo "$a $b $c ";
- Test()?>
---EXPECT--
-1 5 2 2 10 5 2 5 3 2 10 5 3 5 4 2
diff --git a/tests/lang/008.phpt b/tests/lang/008.phpt
deleted file mode 100644
index 145214cbb4..0000000000
--- a/tests/lang/008.phpt
+++ /dev/null
@@ -1,16 +0,0 @@
---TEST--
-Testing recursive function
---POST--
---GET--
---FILE--
-<?php Function Test()
- {
- static $a=1;
-
- echo "$a ";
- $a++;
- if($a<10): Test(); endif;
- }
- Test()?>
---EXPECT--
-1 2 3 4 5 6 7 8 9
diff --git a/tests/lang/009.phpt b/tests/lang/009.phpt
deleted file mode 100644
index 5498288dcf..0000000000
--- a/tests/lang/009.phpt
+++ /dev/null
@@ -1,11 +0,0 @@
---TEST--
-Testing function parameter passing
---POST--
---GET--
---FILE--
-<?php old_function Test $a,$b (
- echo $a+$b;
- );
- Test(1,2)?>
---EXPECT--
-3
diff --git a/tests/lang/010.phpt b/tests/lang/010.phpt
deleted file mode 100644
index 03def4b112..0000000000
--- a/tests/lang/010.phpt
+++ /dev/null
@@ -1,13 +0,0 @@
---TEST--
-Testing function parameter passing with a return value
---POST--
---GET--
---FILE--
-<?php old_function Test $b (
- $b++;
- return($b);
- );
- $a = Test(1);
- echo $a?>
---EXPECT--
-2
diff --git a/tests/lang/011.phpt b/tests/lang/011.phpt
deleted file mode 100644
index e648623845..0000000000
--- a/tests/lang/011.phpt
+++ /dev/null
@@ -1,25 +0,0 @@
---TEST--
-Testing nested functions
---POST--
---GET--
---FILE--
-<?php
-function F()
-{
- $a = "Hello ";
- return($a);
-}
-
-function G()
-{
- static $myvar = 4;
-
- echo "$myvar ";
- echo F();
- echo "$myvar";
-}
-
-G();
-?>
---EXPECT--
-4 Hello 4
diff --git a/tests/lang/012.phpt b/tests/lang/012.phpt
deleted file mode 100644
index b3c7abbfda..0000000000
--- a/tests/lang/012.phpt
+++ /dev/null
@@ -1,20 +0,0 @@
---TEST--
-Testing stack after early function return
---POST--
---GET--
---FILE--
-<?php
-old_function F (
- if(1):
- return("Hello");
- endif;
-);
-
-$i=0;
-while($i<2):
- echo F();
- $i++;
-endwhile;
-?>
---EXPECT--
-HelloHello
diff --git a/tests/lang/013.phpt b/tests/lang/013.phpt
deleted file mode 100644
index 74a8f197f1..0000000000
--- a/tests/lang/013.phpt
+++ /dev/null
@@ -1,12 +0,0 @@
---TEST--
-Testing eval function
---POST--
---GET--
---FILE--
-<?php
- error_reporting(0);
- $a="echo \"Hello\";";
- eval($a);
-?>
---EXPECT--
-Hello
diff --git a/tests/lang/014.phpt b/tests/lang/014.phpt
deleted file mode 100644
index a03aa47870..0000000000
--- a/tests/lang/014.phpt
+++ /dev/null
@@ -1,15 +0,0 @@
---TEST--
-Testing eval function inside user-defined function
---POST--
---GET--
---FILE--
-<?php
-old_function F $a (
- eval($a);
-);
-
-error_reporting(0);
-F("echo \"Hello\";");
-?>
---EXPECT--
-Hello
diff --git a/tests/lang/015.inc b/tests/lang/015.inc
deleted file mode 100755
index d436a7bb14..0000000000
--- a/tests/lang/015.inc
+++ /dev/null
@@ -1,3 +0,0 @@
-<?php
- echo "Hello";
-?>
diff --git a/tests/lang/015.phpt b/tests/lang/015.phpt
deleted file mode 100644
index e6376067cd..0000000000
--- a/tests/lang/015.phpt
+++ /dev/null
@@ -1,10 +0,0 @@
---TEST--
-Testing include
---POST--
---GET--
---FILE--
-<?php
- include "015.inc";
-?>
---EXPECT--
-Hello
diff --git a/tests/lang/016.inc b/tests/lang/016.inc
deleted file mode 100755
index 7039e3f395..0000000000
--- a/tests/lang/016.inc
+++ /dev/null
@@ -1,5 +0,0 @@
-<?php
- old_function MyFunc $a (
- echo $a;
- );
-?>
diff --git a/tests/lang/016.phpt b/tests/lang/016.phpt
deleted file mode 100644
index 238fc29a61..0000000000
--- a/tests/lang/016.phpt
+++ /dev/null
@@ -1,11 +0,0 @@
---TEST--
-Testing user-defined function in included file
---POST--
---GET--
---FILE--
-<?php
- include "016.inc";
- MyFunc("Hello");
-?>
---EXPECT--
-Hello
diff --git a/tests/lang/017.phpt b/tests/lang/017.phpt
deleted file mode 100644
index 1fc8429a82..0000000000
--- a/tests/lang/017.phpt
+++ /dev/null
@@ -1,18 +0,0 @@
---TEST--
-Testing user-defined function falling out of an If into another
---POST--
---GET--
---FILE--
-<?php $a = 1;
-old_function Test $a (
- if($a<3):
- return(3);
- endif;
-);
-
-if($a < Test($a)):
- echo "$a\n";
- $a++;
-endif?>
---EXPECT--
-1
diff --git a/tests/lang/018.phpt b/tests/lang/018.phpt
deleted file mode 100644
index 8ef867cb62..0000000000
--- a/tests/lang/018.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-eval() test
---POST--
---GET--
---FILE--
-<?php
-
-error_reporting(0);
-
-$message = "echo \"hey\n\";";
-
-for ($i=0; $i<10; $i++) {
- eval($message);
- echo $i."\n";
-}
---EXPECT--
-hey
-0
-hey
-1
-hey
-2
-hey
-3
-hey
-4
-hey
-5
-hey
-6
-hey
-7
-hey
-8
-hey
-9
diff --git a/tests/lang/019.phpt b/tests/lang/019.phpt
deleted file mode 100644
index f8339b94a3..0000000000
--- a/tests/lang/019.phpt
+++ /dev/null
@@ -1,38 +0,0 @@
---TEST--
-eval() test
---POST--
---GET--
---FILE--
-<?php
-
-error_reporting(0);
-
-eval("function test() { echo \"hey, this is a function inside an eval()!\\n\"; }");
-
-$i=0;
-while ($i<10) {
- eval("echo \"hey, this is a regular echo'd eval()\\n\";");
- test();
- $i++;
-}
---EXPECT--
-hey, this is a regular echo'd eval()
-hey, this is a function inside an eval()!
-hey, this is a regular echo'd eval()
-hey, this is a function inside an eval()!
-hey, this is a regular echo'd eval()
-hey, this is a function inside an eval()!
-hey, this is a regular echo'd eval()
-hey, this is a function inside an eval()!
-hey, this is a regular echo'd eval()
-hey, this is a function inside an eval()!
-hey, this is a regular echo'd eval()
-hey, this is a function inside an eval()!
-hey, this is a regular echo'd eval()
-hey, this is a function inside an eval()!
-hey, this is a regular echo'd eval()
-hey, this is a function inside an eval()!
-hey, this is a regular echo'd eval()
-hey, this is a function inside an eval()!
-hey, this is a regular echo'd eval()
-hey, this is a function inside an eval()!
diff --git a/tests/lang/020.phpt b/tests/lang/020.phpt
deleted file mode 100644
index e82ba6c467..0000000000
--- a/tests/lang/020.phpt
+++ /dev/null
@@ -1,78 +0,0 @@
---TEST--
-Switch test 1
---POST--
---GET--
---FILE--
-<?php
-
-$i="abc";
-
-for ($j=0; $j<10; $j++) {
-switch (1) {
- case 1:
- echo "In branch 1\n";
- switch ($i) {
- case "ab":
- echo "This doesn't work... :(\n";
- break;
- case "abcd":
- echo "This works!\n";
- break;
- case "blah":
- echo "Hmmm, no worki\n";
- break;
- default:
- echo "Inner default...\n";
- }
- for ($blah=0; $blah<200; $blah++) {
- if ($blah==100) {
- echo "blah=$blah\n";
- }
- }
- break;
- case 2:
- echo "In branch 2\n";
- break;
- case $i:
- echo "In branch \$i\n";
- break;
- case 4:
- echo "In branch 4\n";
- break;
- default:
- echo "Hi, I'm default\n";
- break;
- }
-}
-?>
---EXPECT--
-In branch 1
-Inner default...
-blah=100
-In branch 1
-Inner default...
-blah=100
-In branch 1
-Inner default...
-blah=100
-In branch 1
-Inner default...
-blah=100
-In branch 1
-Inner default...
-blah=100
-In branch 1
-Inner default...
-blah=100
-In branch 1
-Inner default...
-blah=100
-In branch 1
-Inner default...
-blah=100
-In branch 1
-Inner default...
-blah=100
-In branch 1
-Inner default...
-blah=100
diff --git a/tests/lang/021.phpt b/tests/lang/021.phpt
deleted file mode 100644
index 132ffc20c4..0000000000
--- a/tests/lang/021.phpt
+++ /dev/null
@@ -1,44 +0,0 @@
---TEST--
-Switch test 2
---POST--
---GET--
---FILE--
-<?php
-
-for ($i=0; $i<=5; $i++)
-{
- echo "i=$i\n";
-
- switch($i) {
- case 0:
- echo "In branch 0\n";
- break;
- case 1:
- echo "In branch 1\n";
- break;
- case 2:
- echo "In branch 2\n";
- break;
- case 3:
- echo "In branch 3\n";
- break 2;
- case 4:
- echo "In branch 4\n";
- break;
- default:
- echo "In default\n";
- break;
- }
-}
-echo "hi\n";
-?>
---EXPECT--
-i=0
-In branch 0
-i=1
-In branch 1
-i=2
-In branch 2
-i=3
-In branch 3
-hi
diff --git a/tests/lang/022.phpt b/tests/lang/022.phpt
deleted file mode 100644
index 1465396926..0000000000
--- a/tests/lang/022.phpt
+++ /dev/null
@@ -1,65 +0,0 @@
---TEST--
-Switch test 3
---POST--
---GET--
---FILE--
-<?php
-
-function switchtest ($i, $j)
-{
- switch ($i):
- case 0:
- switch($j) {
- case 0:
- echo "zero";
- break;
- case 1:
- echo "one";
- break;
- default:
- echo $j;
- break;
- }
- echo "\n";
- break;
- default:
- echo "Default taken\n";
- endswitch;
-}
-for ($i=0; $i<3; $i++) {
- for ($k=0; $k<10; $k++) {
- switchtest (0,$k);
- }
-}
-?>
---EXPECT--
-zero
-one
-2
-3
-4
-5
-6
-7
-8
-9
-zero
-one
-2
-3
-4
-5
-6
-7
-8
-9
-zero
-one
-2
-3
-4
-5
-6
-7
-8
-9
diff --git a/tests/lang/023-1.inc b/tests/lang/023-1.inc
deleted file mode 100755
index 8d52e844c9..0000000000
--- a/tests/lang/023-1.inc
+++ /dev/null
@@ -1,356 +0,0 @@
-<html>
-<head>
-<?php
-/* the point of this file is to intensively test various aspects of
- * the parser. right now, each test focuses in one aspect only
- * (e.g. variable aliasing, arithemtic operator, various control
- * structures), while trying to combine code from other parts of the
- * parser as well.
- */
-?>
-
-*** Testing assignments and variable aliasing: ***<br>
-<?php
- /* This test tests assignments to variables using other variables as variable-names */
- $a = "b";
- $$a = "test";
- $$$a = "blah";
- ${$$$a}["associative arrays work too"] = "this is nifty";
-?>
-This should read "blah": <?php echo "$test<br>\n"; ?>
-This should read "this is nifty": <?php echo $blah[$test="associative arrays work too"]."<br>\n"; ?>
-*************************************************<br>
-
-*** Testing integer operators ***<br>
-<?php
- /* test just about any operator possible on $i and $j (ints) */
- $i = 5;
- $j = 3;
-?>
-Correct result - 8: <?php echo $i+$j; ?><br>
-Correct result - 8: <?php echo $i+$j; ?><br>
-Correct result - 2: <?php echo $i-$j; ?><br>
-Correct result - -2: <?php echo $j-$i; ?><br>
-Correct result - 15: <?php echo $i*$j; ?><br>
-Correct result - 15: <?php echo $j*$i; ?><br>
-Correct result - 2: <?php echo $i%$j; ?><br>
-Correct result - 3: <?php echo $j%$i; ?><br>
-*********************************<br>
-
-*** Testing real operators ***<br>
-<?php
- /* test just about any operator possible on $i and $j (floats) */
- $i = 5.0;
- $j = 3.0;
-?>
-Correct result - 8: <?php echo $i+$j; ?><br>
-Correct result - 8: <?php echo $i+$j; ?><br>
-Correct result - 2: <?php echo $i-$j; ?><br>
-Correct result - -2: <?php echo $j-$i; ?><br>
-Correct result - 15: <?php echo $i*$j; ?><br>
-Correct result - 15: <?php echo $j*$i; ?><br>
-Correct result - 2: <?php echo $i%$j; ?><br>
-Correct result - 3: <?php echo $j%$i; ?><br>
-*********************************<br>
-
-*** Testing if/elseif/else control ***<br>
-
-<?php
-/* sick if/elseif/else test by Andi :) */
-$a = 5;
-if ($a == "4") {
- echo "This "." does "." not "." work<br>\n";
-} elseif ($a == "5") {
- echo "This "." works<br>\n";
- $a = 6;
- if ("andi" == ($test = "andi")) {
- echo "this_still_works<br>\n";
- } elseif (1) {
- echo "should_not_print<br>\n";
- } else {
- echo "should_not_print<br>\n";
- }
- if (44 == 43) {
- echo "should_not_print<br>\n";
- } else {
- echo "should_print<br>\n";
- }
-} elseif ($a == 6) {
- echo "this "."broken<br>\n";
- if (0) {
- echo "this_should_not_print<br>\n";
- } else {
- echo "TestingDanglingElse_This_Should_not_print<br>\n";
- }
-} else {
- echo "This "."does "." not"." work<br>\n";
-}
-?>
-
-
-*** Seriously nested if's test ***<br>
-** spelling correction by kluzz **
-<?php
-/* yet another sick if/elseif/else test by Zeev */
-$i=$j=0;
-echo "Only two lines of text should follow:<br>\n";
-if (0) { /* this code is not supposed to be executed */
- echo "hmm, this shouldn't be displayed #1<br>\n";
- $j++;
- if (1) {
- $i
-+=
- $j;
- if (0) {
- $j = ++$i;
- if (1) {
- $j *= $i;
- echo "damn, this shouldn't be displayed<br>\n";
- } else {
- $j /= $i;
- ++$j;
- echo "this shouldn't be displayed either<br>\n";
- }
- } elseif (1) {
- $i++; $j++;
- echo "this isn't supposed to be displayed<br>\n";
- }
- } elseif (0) {
- $i++;
- echo "this definitely shouldn't be displayed<br>\n";
- } else {
- --$j;
- echo "and this too shouldn't be displayed<br>\n";
- while ($j>0) {
- $j--;
- }
- }
-} elseif (2-2) { /* as long as 2-2==0, this isn't supposed to be executed either */
- $i = ++$j;
- echo "hmm, this shouldn't be displayed #2<br>\n";
- if (1) {
- $j = ++$i;
- if (0) {
- $j = $i*2+$j*($i++);
- if (1) {
- $i++;
- echo "damn, this shouldn't be displayed<br>\n";
- } else {
- $j++;
- echo "this shouldn't be displayed either<br>\n";
- }
- } else if (1) {
- ++$j;
- echo "this isn't supposed to be displayed<br>\n";
- }
- } elseif (0) {
- $j++;
- echo "this definitely shouldn't be displayed<br>\n";
- } else {
- $i++;
- echo "and this too shouldn't be displayed<br>\n";
- }
-} else {
- $j=$i++; /* this should set $i to 1, but shouldn't change $j (it's assigned $i's previous values, zero) */
- echo "this should be displayed. should be: \$i=1, \$j=0. is: \$i=$i, \$j=$j<br>\n";
- if (1) {
- $j += ++$i; /* ++$i --> $i==2, $j += 2 --> $j==2 */
- if (0) {
- $j += 40;
- if (1) {
- $i += 50;
- echo "damn, this shouldn't be displayed<br>\n";
- } else {
- $j += 20;
- echo "this shouldn't be displayed either<br>\n";
- }
- } else if (1) {
- $j *= $i; /* $j *= 2 --> $j == 4 */
- echo "this is supposed to be displayed. should be: \$i=2, \$j=4. is: \$i=$i, \$j=$j<br>\n";
- echo "3 loop iterations should follow:<br>\n";
- while ($i<=$j) {
- echo $i++." $j<br>\n";
- }
- }
- } elseif (0) {
- echo "this definitely shouldn't be displayed<br>\n";
- } else {
- echo "and this too shouldn't be displayed<br>\n";
- }
- echo "**********************************<br>\n";
-}
-?>
-
-*** C-style else-if's ***<br>
-<?php
- /* looks like without we even tried, C-style else-if structure works fine! */
- if ($a=0) {
- echo "This shouldn't be displayed<br>\n";
- } else if ($a++) {
- echo "This shouldn't be displayed either<br>\n";
- } else if (--$a) {
- echo "No, this neither<br>\n";
- } else if (++$a) {
- echo "This should be displayed<br>\n";
- } else {
- echo "This shouldn't be displayed at all<br>\n";
- }
-?>
-*************************<br>
-
-*** WHILE tests ***<br>
-<?php
-$i=0;
-$j=20;
-while ($i<(2*$j)) {
- if ($i>$j) {
- echo "$i is greater than $j<br>\n";
- } else if ($i==$j) {
- echo "$i equals $j<br>\n";
- } else {
- echo "$i is smaller than $j<br>\n";
- }
- $i++;
-}
-?>
-*******************<br>
-
-
-*** Nested WHILEs ***<br>
-<?php
-$arr_len=3;
-
-$i=0;
-while ($i<$arr_len) {
- $j=0;
- while ($j<$arr_len) {
- $k=0;
- while ($k<$arr_len) {
- ${"test$i$j"}[$k] = $i+$j+$k;
- $k++;
- }
- $j++;
- }
- $i++;
-}
-
-echo "Each array variable should be equal to the sum of its indices:<br>\n";
-
-$i=0;
-while ($i<$arr_len) {
- $j=0;
- while ($j<$arr_len) {
- $k=0;
- while ($k<$arr_len) {
- echo "\${test$i$j}[$k] = ".${"test$i$j"}[$k]."<br>\n";
- $k++;
- }
- $j++;
- }
- $i++;
-}
-?>
-*********************<br>
-
-*** hash test... ***<br>
-<?php
-/*
-$i=0;
-
-while ($i<10000) {
- $arr[$i]=$i;
- $i++;
-}
-
-$i=0;
-while ($i<10000) {
- echo $arr[$i++]."<br>\n";
-}
-*/
-echo "commented out...";
-?>
-
-**************************<br>
-
-*** Hash resizing test ***<br>
-<?php
-$i = 10;
-$a = 'b';
-while ($i > 0) {
- $a = $a . 'a';
- echo "$a<br>\n";
- $resize[$a] = $i;
- $i--;
-}
-$i = 10;
-$a = 'b';
-while ($i > 0) {
- $a = $a . 'a';
- echo "$a<br>\n";
- echo $resize[$a]."<br>\n";
- $i--;
-}
-?>
-**************************<br>
-
-
-*** break/continue test ***<br>
-<?php
-$i=0;
-
-echo "\$i should go from 0 to 2<br>\n";
-while ($i<5) {
- if ($i>2) {
- break;
- }
- $j=0;
- echo "\$j should go from 3 to 4, and \$q should go from 3 to 4<br>\n";
- while ($j<5) {
- if ($j<=2) {
- $j++;
- continue;
- }
- echo " \$j=$j<br>\n";
- for ($q=0; $q<=10; $q++) {
- if ($q<3) {
- continue;
- }
- if ($q>4) {
- break;
- }
- echo " \$q=$q<br>\n";
- }
- $j++;
- }
- $j=0;
- echo "\$j should go from 0 to 2<br>\n";
- while ($j<5) {
- if ($j>2) {
- $k=0;
- echo "\$k should go from 0 to 2<br>\n";
- while ($k<5) {
- if ($k>2) {
- break 2;
- }
- echo " \$k=$k<br>\n";
- $k++;
- }
- }
- echo " \$j=$j<br>\n";
- $j++;
- }
- echo "\$i=$i<br>\n";
- $i++;
-}
-?>
-***********************<br>
-
-*** Nested file include test ***<br>
-<?php include("023-2.inc"); ?>
-********************************<br>
-
-<?php
-{
- echo "Tests completed.<br>\n"; # testing some PHP style comment...
-}
-?>
diff --git a/tests/lang/023-2.inc b/tests/lang/023-2.inc
deleted file mode 100755
index 6dd1e730f1..0000000000
--- a/tests/lang/023-2.inc
+++ /dev/null
@@ -1,6 +0,0 @@
-<html>
-This is Finish.phtml. This file is supposed to be included
-from regression_test.phtml. This is normal HTML.
-<?php echo "and this is PHP code, 2+2=".(2+2).""; ?>
-
-</html>
diff --git a/tests/lang/023.phpt b/tests/lang/023.phpt
deleted file mode 100644
index 4d7c4d5b5b..0000000000
--- a/tests/lang/023.phpt
+++ /dev/null
@@ -1,256 +0,0 @@
---TEST--
-Regression test
---POST--
---GET--
---FILE--
-PHP Regression Test
-
-<?php
-
-include("023-1.inc");
-
-$wedding_timestamp = mktime(20,0,0,8,31,1997);
-$time_left=$wedding_timestamp-time();
-
-if ($time_left>0) {
- $days = $time_left/(24*3600);
- $time_left -= $days*24*3600;
- $hours = $time_left/3600;
- $time_left -= $hours*3600;
- $minutes = $time_left/60;
- echo "Limor Ullmann is getting married on ".($wedding_date=date("l, F dS, Y",$wedding_timestamp)).",\nwhich is $days days, $hours hours and $minutes minutes from now.\n";
- echo "Her hashed wedding date is $wedding_date.\n";
-} else {
- echo "Limor Ullmann is now Limor Baruch :I\n";
-}
-?>
---EXPECT--
-PHP Regression Test
-
-<html>
-<head>
-
-*** Testing assignments and variable aliasing: ***<br>
-This should read "blah": blah<br>
-This should read "this is nifty": this is nifty<br>
-*************************************************<br>
-
-*** Testing integer operators ***<br>
-Correct result - 8: 8<br>
-Correct result - 8: 8<br>
-Correct result - 2: 2<br>
-Correct result - -2: -2<br>
-Correct result - 15: 15<br>
-Correct result - 15: 15<br>
-Correct result - 2: 2<br>
-Correct result - 3: 3<br>
-*********************************<br>
-
-*** Testing real operators ***<br>
-Correct result - 8: 8<br>
-Correct result - 8: 8<br>
-Correct result - 2: 2<br>
-Correct result - -2: -2<br>
-Correct result - 15: 15<br>
-Correct result - 15: 15<br>
-Correct result - 2: 2<br>
-Correct result - 3: 3<br>
-*********************************<br>
-
-*** Testing if/elseif/else control ***<br>
-
-This works<br>
-this_still_works<br>
-should_print<br>
-
-
-*** Seriously nested if's test ***<br>
-** spelling correction by kluzz **
-Only two lines of text should follow:<br>
-this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0<br>
-this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4<br>
-3 loop iterations should follow:<br>
-2 4<br>
-3 4<br>
-4 4<br>
-**********************************<br>
-
-*** C-style else-if's ***<br>
-This should be displayed<br>
-*************************<br>
-
-*** WHILE tests ***<br>
-0 is smaller than 20<br>
-1 is smaller than 20<br>
-2 is smaller than 20<br>
-3 is smaller than 20<br>
-4 is smaller than 20<br>
-5 is smaller than 20<br>
-6 is smaller than 20<br>
-7 is smaller than 20<br>
-8 is smaller than 20<br>
-9 is smaller than 20<br>
-10 is smaller than 20<br>
-11 is smaller than 20<br>
-12 is smaller than 20<br>
-13 is smaller than 20<br>
-14 is smaller than 20<br>
-15 is smaller than 20<br>
-16 is smaller than 20<br>
-17 is smaller than 20<br>
-18 is smaller than 20<br>
-19 is smaller than 20<br>
-20 equals 20<br>
-21 is greater than 20<br>
-22 is greater than 20<br>
-23 is greater than 20<br>
-24 is greater than 20<br>
-25 is greater than 20<br>
-26 is greater than 20<br>
-27 is greater than 20<br>
-28 is greater than 20<br>
-29 is greater than 20<br>
-30 is greater than 20<br>
-31 is greater than 20<br>
-32 is greater than 20<br>
-33 is greater than 20<br>
-34 is greater than 20<br>
-35 is greater than 20<br>
-36 is greater than 20<br>
-37 is greater than 20<br>
-38 is greater than 20<br>
-39 is greater than 20<br>
-*******************<br>
-
-
-*** Nested WHILEs ***<br>
-Each array variable should be equal to the sum of its indices:<br>
-${test00}[0] = 0<br>
-${test00}[1] = 1<br>
-${test00}[2] = 2<br>
-${test01}[0] = 1<br>
-${test01}[1] = 2<br>
-${test01}[2] = 3<br>
-${test02}[0] = 2<br>
-${test02}[1] = 3<br>
-${test02}[2] = 4<br>
-${test10}[0] = 1<br>
-${test10}[1] = 2<br>
-${test10}[2] = 3<br>
-${test11}[0] = 2<br>
-${test11}[1] = 3<br>
-${test11}[2] = 4<br>
-${test12}[0] = 3<br>
-${test12}[1] = 4<br>
-${test12}[2] = 5<br>
-${test20}[0] = 2<br>
-${test20}[1] = 3<br>
-${test20}[2] = 4<br>
-${test21}[0] = 3<br>
-${test21}[1] = 4<br>
-${test21}[2] = 5<br>
-${test22}[0] = 4<br>
-${test22}[1] = 5<br>
-${test22}[2] = 6<br>
-*********************<br>
-
-*** hash test... ***<br>
-commented out...
-**************************<br>
-
-*** Hash resizing test ***<br>
-ba<br>
-baa<br>
-baaa<br>
-baaaa<br>
-baaaaa<br>
-baaaaaa<br>
-baaaaaaa<br>
-baaaaaaaa<br>
-baaaaaaaaa<br>
-baaaaaaaaaa<br>
-ba<br>
-10<br>
-baa<br>
-9<br>
-baaa<br>
-8<br>
-baaaa<br>
-7<br>
-baaaaa<br>
-6<br>
-baaaaaa<br>
-5<br>
-baaaaaaa<br>
-4<br>
-baaaaaaaa<br>
-3<br>
-baaaaaaaaa<br>
-2<br>
-baaaaaaaaaa<br>
-1<br>
-**************************<br>
-
-
-*** break/continue test ***<br>
-$i should go from 0 to 2<br>
-$j should go from 3 to 4, and $q should go from 3 to 4<br>
- $j=3<br>
- $q=3<br>
- $q=4<br>
- $j=4<br>
- $q=3<br>
- $q=4<br>
-$j should go from 0 to 2<br>
- $j=0<br>
- $j=1<br>
- $j=2<br>
-$k should go from 0 to 2<br>
- $k=0<br>
- $k=1<br>
- $k=2<br>
-$i=0<br>
-$j should go from 3 to 4, and $q should go from 3 to 4<br>
- $j=3<br>
- $q=3<br>
- $q=4<br>
- $j=4<br>
- $q=3<br>
- $q=4<br>
-$j should go from 0 to 2<br>
- $j=0<br>
- $j=1<br>
- $j=2<br>
-$k should go from 0 to 2<br>
- $k=0<br>
- $k=1<br>
- $k=2<br>
-$i=1<br>
-$j should go from 3 to 4, and $q should go from 3 to 4<br>
- $j=3<br>
- $q=3<br>
- $q=4<br>
- $j=4<br>
- $q=3<br>
- $q=4<br>
-$j should go from 0 to 2<br>
- $j=0<br>
- $j=1<br>
- $j=2<br>
-$k should go from 0 to 2<br>
- $k=0<br>
- $k=1<br>
- $k=2<br>
-$i=2<br>
-***********************<br>
-
-*** Nested file include test ***<br>
-<html>
-This is Finish.phtml. This file is supposed to be included
-from regression_test.phtml. This is normal HTML.
-and this is PHP code, 2+2=4
-</html>
-********************************<br>
-
-Tests completed.<br>
-Limor Ullmann is now Limor Baruch :I
diff --git a/tests/lang/024.phpt b/tests/lang/024.phpt
deleted file mode 100644
index 848c5fbea8..0000000000
--- a/tests/lang/024.phpt
+++ /dev/null
@@ -1,11625 +0,0 @@
---TEST--
-Looped regression test (may take a while)
---POST--
---GET--
---FILE--
-<?php
-for ($jdk=0; $jdk<50; $jdk++) {
-?><html>
-<head>
-<?php /* the point of this file is to intensively test various aspects of the parser.
- * right now, each test focuses in one aspect only (e.g. variable aliasing, arithemtic operator,
- * various control structures), while trying to combine code from other parts of the parser as well.
- */
-?>
-*** Testing assignments and variable aliasing: ***
-<?php
- /* This test tests assignments to variables using other variables as variable-names */
- $a = "b";
- $$a = "test";
- $$$a = "blah";
- ${$$$a}["associative arrays work too"] = "this is nifty";
-?>
-This should read "blah": <?php echo "$test\n"; ?>
-This should read "this is nifty": <?php echo $blah[$test="associative arrays work too"]."\n"; ?>
-*************************************************
-
-*** Testing integer operators ***
-<?php
- /* test just about any operator possible on $i and $j (ints) */
- $i = 5;
- $j = 3;
-?>
-Correct result - 8: <?php echo $i+$j; ?>
-
-Correct result - 8: <?php echo $i+$j; ?>
-
-Correct result - 2: <?php echo $i-$j; ?>
-
-Correct result - -2: <?php echo $j-$i; ?>
-
-Correct result - 15: <?php echo $i*$j; ?>
-
-Correct result - 15: <?php echo $j*$i; ?>
-
-Correct result - 2: <?php echo $i%$j; ?>
-
-Correct result - 3: <?php echo $j%$i; ?>
-
-*********************************
-
-*** Testing real operators ***
-<?php
- /* test just about any operator possible on $i and $j (floats) */
- $i = 5.0;
- $j = 3.0;
-?>
-Correct result - 8: <?php echo $i+$j; ?>
-
-Correct result - 8: <?php echo $i+$j; ?>
-
-Correct result - 2: <?php echo $i-$j; ?>
-
-Correct result - -2: <?php echo $j-$i; ?>
-
-Correct result - 15: <?php echo $i*$j; ?>
-
-Correct result - 15: <?php echo $j*$i; ?>
-
-Correct result - 2: <?php echo $i%$j; ?>
-
-Correct result - 3: <?php echo $j%$i; ?>
-
-*********************************
-
-*** Testing if/elseif/else control ***
-
-<?php
-/* sick if/elseif/else test by Andi :) */
-$a = 5;
-if ($a == "4") {
- echo "This "." does "." not "." work\n";
-} elseif ($a == "5") {
- echo "This "." works\n";
- $a = 6;
- if ("andi" == ($test = "andi")) {
- echo "this_still_works\n";
- } elseif (1) {
- echo "should_not_print\n";
- } else {
- echo "should_not_print\n";
- }
- if (44 == 43) {
- echo "should_not_print\n";
- } else {
- echo "should_print\n";
- }
-} elseif ($a == 6) {
- echo "this "."broken\n";
- if (0) {
- echo "this_should_not_print\n";
- } else {
- echo "TestingDanglingElse_This_Should_not_print\n";
- }
-} else {
- echo "This "."does "." not"." work\n";
-}
-?>
-
-
-*** Seriously nested if's test ***
-** spelling correction by kluzz **
-<?php
-/* yet another sick if/elseif/else test by Zeev */
-$i=$j=0;
-echo "Only two lines of text should follow:\n";
-if (0) { /* this code is not supposed to be executed */
- echo "hmm, this shouldn't be displayed #1\n";
- $j++;
- if (1) {
- $i += $j;
- if (0) {
- $j = ++$i;
- if (1) {
- $j *= $i;
- echo "damn, this shouldn't be displayed\n";
- } else {
- $j /= $i;
- ++$j;
- echo "this shouldn't be displayed either\n";
- }
- } elseif (1) {
- $i++; $j++;
- echo "this isn't supposed to be displayed\n";
- }
- } elseif (0) {
- $i++;
- echo "this definitely shouldn't be displayed\n";
- } else {
- --$j;
- echo "and this too shouldn't be displayed\n";
- while ($j>0) {
- $j--;
- }
- }
-} elseif (2-2) { /* as long as 2-2==0, this isn't supposed to be executed either */
- $i = ++$j;
- echo "hmm, this shouldn't be displayed #2\n";
- if (1) {
- $j = ++$i;
- if (0) {
- $j = $i*2+$j*($i++);
- if (1) {
- $i++;
- echo "damn, this shouldn't be displayed\n";
- } else {
- $j++;
- echo "this shouldn't be displayed either\n";
- }
- } else if (1) {
- ++$j;
- echo "this isn't supposed to be displayed\n";
- }
- } elseif (0) {
- $j++;
- echo "this definitely shouldn't be displayed\n";
- } else {
- $i++;
- echo "and this too shouldn't be displayed\n";
- }
-} else {
- $j=$i++; /* this should set $i to 1, but shouldn't change $j (it's assigned $i's previous values, zero) */
- echo "this should be displayed. should be: \$i=1, \$j=0. is: \$i=$i, \$j=$j\n";
- if (1) {
- $j += ++$i; /* ++$i --> $i==2, $j += 2 --> $j==2 */
- if (0) {
- $j += 40;
- if (1) {
- $i += 50;
- echo "damn, this shouldn't be displayed\n";
- } else {
- $j += 20;
- echo "this shouldn't be displayed either\n";
- }
- } else if (1) {
- $j *= $i; /* $j *= 2 --> $j == 4 */
- echo "this is supposed to be displayed. should be: \$i=2, \$j=4. is: \$i=$i, \$j=$j\n";
- echo "3 loop iterations should follow:\n";
- while ($i<=$j) {
- echo $i++." $j\n";
- }
- }
- } elseif (0) {
- echo "this definitely shouldn't be displayed\n";
- } else {
- echo "and this too shouldn't be displayed\n";
- }
- echo "**********************************\n";
-}
-?>
-
-*** C-style else-if's ***
-<?php
- /* looks like without we even tried, C-style else-if structure works fine! */
- if ($a=0) {
- echo "This shouldn't be displayed\n";
- } else if ($a++) {
- echo "This shouldn't be displayed either\n";
- } else if (--$a) {
- echo "No, this neither\n";
- } else if (++$a) {
- echo "This should be displayed\n";
- } else {
- echo "This shouldn't be displayed at all\n";
- }
-?>
-*************************
-
-*** WHILE tests ***
-<?php
-$i=0;
-$j=20;
-while ($i<(2*$j)) {
- if ($i>$j) {
- echo "$i is greater than $j\n";
- } else if ($i==$j) {
- echo "$i equals $j\n";
- } else {
- echo "$i is smaller than $j\n";
- }
- $i++;
-}
-?>
-*******************
-
-
-*** Nested WHILEs ***
-<?php
-$arr_len=3;
-
-$i=0;
-while ($i<$arr_len) {
- $j=0;
- while ($j<$arr_len) {
- $k=0;
- while ($k<$arr_len) {
- ${"test$i$j"}[$k] = $i+$j+$k;
- $k++;
- }
- $j++;
- }
- $i++;
-}
-
-echo "Each array variable should be equal to the sum of its indices:\n";
-
-$i=0;
-while ($i<$arr_len) {
- $j=0;
- while ($j<$arr_len) {
- $k=0;
- while ($k<$arr_len) {
- echo "\${test$i$j}[$k] = ".${"test$i$j"}[$k]."\n";
- $k++;
- }
- $j++;
- }
- $i++;
-}
-?>
-*********************
-
-*** hash test... ***
-<?php
-/*
-$i=0;
-
-while ($i<10000) {
- $arr[$i]=$i;
- $i++;
-}
-
-$i=0;
-while ($i<10000) {
- echo $arr[$i++]."\n";
-}
-*/
-echo "commented out...";
-?>
-
-**************************
-
-*** Hash resizing test ***
-<?php
-$i = 10;
-$a = "b";
-while ($i > 0) {
- $a = $a . "a";
- echo "$a\n";
- $resize[$a] = $i;
- $i--;
-}
-$i = 10;
-$a = "b";
-while ($i > 0) {
- $a = $a . "a";
- echo "$a\n";
- echo $resize[$a]."\n";
- $i--;
-}
-?>
-**************************
-
-
-*** break/continue test ***
-<?php
-$i=0;
-
-echo "\$i should go from 0 to 2\n";
-while ($i<5) {
- if ($i>2) {
- break;
- }
- $j=0;
- echo "\$j should go from 3 to 4, and \$q should go from 3 to 4\n";
- while ($j<5) {
- if ($j<=2) {
- $j++;
- continue;
- }
- echo " \$j=$j\n";
- for ($q=0; $q<=10; $q++) {
- if ($q<3) {
- continue;
- }
- if ($q>4) {
- break;
- }
- echo " \$q=$q\n";
- }
- $j++;
- }
- $j=0;
- echo "\$j should go from 0 to 2\n";
- while ($j<5) {
- if ($j>2) {
- $k=0;
- echo "\$k should go from 0 to 2\n";
- while ($k<5) {
- if ($k>2) {
- break 2;
- }
- echo " \$k=$k\n";
- $k++;
- }
- }
- echo " \$j=$j\n";
- $j++;
- }
- echo "\$i=$i\n";
- $i++;
-}
-?>
-***********************
-
-*** Nested file include test ***
-<?php include("023-2.inc"); ?>
-********************************
-
-<?php
-{
- echo "Tests completed.\n"; # testing some PHP style comment...
-}
-
-} ?>
---EXPECT--
-<html>
-<head>
-*** Testing assignments and variable aliasing: ***
-This should read "blah": blah
-This should read "this is nifty": this is nifty
-*************************************************
-
-*** Testing integer operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing real operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing if/elseif/else control ***
-
-This works
-this_still_works
-should_print
-
-
-*** Seriously nested if's test ***
-** spelling correction by kluzz **
-Only two lines of text should follow:
-this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0
-this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4
-3 loop iterations should follow:
-2 4
-3 4
-4 4
-**********************************
-
-*** C-style else-if's ***
-This should be displayed
-*************************
-
-*** WHILE tests ***
-0 is smaller than 20
-1 is smaller than 20
-2 is smaller than 20
-3 is smaller than 20
-4 is smaller than 20
-5 is smaller than 20
-6 is smaller than 20
-7 is smaller than 20
-8 is smaller than 20
-9 is smaller than 20
-10 is smaller than 20
-11 is smaller than 20
-12 is smaller than 20
-13 is smaller than 20
-14 is smaller than 20
-15 is smaller than 20
-16 is smaller than 20
-17 is smaller than 20
-18 is smaller than 20
-19 is smaller than 20
-20 equals 20
-21 is greater than 20
-22 is greater than 20
-23 is greater than 20
-24 is greater than 20
-25 is greater than 20
-26 is greater than 20
-27 is greater than 20
-28 is greater than 20
-29 is greater than 20
-30 is greater than 20
-31 is greater than 20
-32 is greater than 20
-33 is greater than 20
-34 is greater than 20
-35 is greater than 20
-36 is greater than 20
-37 is greater than 20
-38 is greater than 20
-39 is greater than 20
-*******************
-
-
-*** Nested WHILEs ***
-Each array variable should be equal to the sum of its indices:
-${test00}[0] = 0
-${test00}[1] = 1
-${test00}[2] = 2
-${test01}[0] = 1
-${test01}[1] = 2
-${test01}[2] = 3
-${test02}[0] = 2
-${test02}[1] = 3
-${test02}[2] = 4
-${test10}[0] = 1
-${test10}[1] = 2
-${test10}[2] = 3
-${test11}[0] = 2
-${test11}[1] = 3
-${test11}[2] = 4
-${test12}[0] = 3
-${test12}[1] = 4
-${test12}[2] = 5
-${test20}[0] = 2
-${test20}[1] = 3
-${test20}[2] = 4
-${test21}[0] = 3
-${test21}[1] = 4
-${test21}[2] = 5
-${test22}[0] = 4
-${test22}[1] = 5
-${test22}[2] = 6
-*********************
-
-*** hash test... ***
-commented out...
-**************************
-
-*** Hash resizing test ***
-ba
-baa
-baaa
-baaaa
-baaaaa
-baaaaaa
-baaaaaaa
-baaaaaaaa
-baaaaaaaaa
-baaaaaaaaaa
-ba
-10
-baa
-9
-baaa
-8
-baaaa
-7
-baaaaa
-6
-baaaaaa
-5
-baaaaaaa
-4
-baaaaaaaa
-3
-baaaaaaaaa
-2
-baaaaaaaaaa
-1
-**************************
-
-
-*** break/continue test ***
-$i should go from 0 to 2
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=0
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=1
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=2
-***********************
-
-*** Nested file include test ***
-<html>
-This is Finish.phtml. This file is supposed to be included
-from regression_test.phtml. This is normal HTML.
-and this is PHP code, 2+2=4
-</html>
-********************************
-
-Tests completed.
-<html>
-<head>
-*** Testing assignments and variable aliasing: ***
-This should read "blah": blah
-This should read "this is nifty": this is nifty
-*************************************************
-
-*** Testing integer operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing real operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing if/elseif/else control ***
-
-This works
-this_still_works
-should_print
-
-
-*** Seriously nested if's test ***
-** spelling correction by kluzz **
-Only two lines of text should follow:
-this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0
-this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4
-3 loop iterations should follow:
-2 4
-3 4
-4 4
-**********************************
-
-*** C-style else-if's ***
-This should be displayed
-*************************
-
-*** WHILE tests ***
-0 is smaller than 20
-1 is smaller than 20
-2 is smaller than 20
-3 is smaller than 20
-4 is smaller than 20
-5 is smaller than 20
-6 is smaller than 20
-7 is smaller than 20
-8 is smaller than 20
-9 is smaller than 20
-10 is smaller than 20
-11 is smaller than 20
-12 is smaller than 20
-13 is smaller than 20
-14 is smaller than 20
-15 is smaller than 20
-16 is smaller than 20
-17 is smaller than 20
-18 is smaller than 20
-19 is smaller than 20
-20 equals 20
-21 is greater than 20
-22 is greater than 20
-23 is greater than 20
-24 is greater than 20
-25 is greater than 20
-26 is greater than 20
-27 is greater than 20
-28 is greater than 20
-29 is greater than 20
-30 is greater than 20
-31 is greater than 20
-32 is greater than 20
-33 is greater than 20
-34 is greater than 20
-35 is greater than 20
-36 is greater than 20
-37 is greater than 20
-38 is greater than 20
-39 is greater than 20
-*******************
-
-
-*** Nested WHILEs ***
-Each array variable should be equal to the sum of its indices:
-${test00}[0] = 0
-${test00}[1] = 1
-${test00}[2] = 2
-${test01}[0] = 1
-${test01}[1] = 2
-${test01}[2] = 3
-${test02}[0] = 2
-${test02}[1] = 3
-${test02}[2] = 4
-${test10}[0] = 1
-${test10}[1] = 2
-${test10}[2] = 3
-${test11}[0] = 2
-${test11}[1] = 3
-${test11}[2] = 4
-${test12}[0] = 3
-${test12}[1] = 4
-${test12}[2] = 5
-${test20}[0] = 2
-${test20}[1] = 3
-${test20}[2] = 4
-${test21}[0] = 3
-${test21}[1] = 4
-${test21}[2] = 5
-${test22}[0] = 4
-${test22}[1] = 5
-${test22}[2] = 6
-*********************
-
-*** hash test... ***
-commented out...
-**************************
-
-*** Hash resizing test ***
-ba
-baa
-baaa
-baaaa
-baaaaa
-baaaaaa
-baaaaaaa
-baaaaaaaa
-baaaaaaaaa
-baaaaaaaaaa
-ba
-10
-baa
-9
-baaa
-8
-baaaa
-7
-baaaaa
-6
-baaaaaa
-5
-baaaaaaa
-4
-baaaaaaaa
-3
-baaaaaaaaa
-2
-baaaaaaaaaa
-1
-**************************
-
-
-*** break/continue test ***
-$i should go from 0 to 2
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=0
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=1
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=2
-***********************
-
-*** Nested file include test ***
-<html>
-This is Finish.phtml. This file is supposed to be included
-from regression_test.phtml. This is normal HTML.
-and this is PHP code, 2+2=4
-</html>
-********************************
-
-Tests completed.
-<html>
-<head>
-*** Testing assignments and variable aliasing: ***
-This should read "blah": blah
-This should read "this is nifty": this is nifty
-*************************************************
-
-*** Testing integer operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing real operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing if/elseif/else control ***
-
-This works
-this_still_works
-should_print
-
-
-*** Seriously nested if's test ***
-** spelling correction by kluzz **
-Only two lines of text should follow:
-this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0
-this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4
-3 loop iterations should follow:
-2 4
-3 4
-4 4
-**********************************
-
-*** C-style else-if's ***
-This should be displayed
-*************************
-
-*** WHILE tests ***
-0 is smaller than 20
-1 is smaller than 20
-2 is smaller than 20
-3 is smaller than 20
-4 is smaller than 20
-5 is smaller than 20
-6 is smaller than 20
-7 is smaller than 20
-8 is smaller than 20
-9 is smaller than 20
-10 is smaller than 20
-11 is smaller than 20
-12 is smaller than 20
-13 is smaller than 20
-14 is smaller than 20
-15 is smaller than 20
-16 is smaller than 20
-17 is smaller than 20
-18 is smaller than 20
-19 is smaller than 20
-20 equals 20
-21 is greater than 20
-22 is greater than 20
-23 is greater than 20
-24 is greater than 20
-25 is greater than 20
-26 is greater than 20
-27 is greater than 20
-28 is greater than 20
-29 is greater than 20
-30 is greater than 20
-31 is greater than 20
-32 is greater than 20
-33 is greater than 20
-34 is greater than 20
-35 is greater than 20
-36 is greater than 20
-37 is greater than 20
-38 is greater than 20
-39 is greater than 20
-*******************
-
-
-*** Nested WHILEs ***
-Each array variable should be equal to the sum of its indices:
-${test00}[0] = 0
-${test00}[1] = 1
-${test00}[2] = 2
-${test01}[0] = 1
-${test01}[1] = 2
-${test01}[2] = 3
-${test02}[0] = 2
-${test02}[1] = 3
-${test02}[2] = 4
-${test10}[0] = 1
-${test10}[1] = 2
-${test10}[2] = 3
-${test11}[0] = 2
-${test11}[1] = 3
-${test11}[2] = 4
-${test12}[0] = 3
-${test12}[1] = 4
-${test12}[2] = 5
-${test20}[0] = 2
-${test20}[1] = 3
-${test20}[2] = 4
-${test21}[0] = 3
-${test21}[1] = 4
-${test21}[2] = 5
-${test22}[0] = 4
-${test22}[1] = 5
-${test22}[2] = 6
-*********************
-
-*** hash test... ***
-commented out...
-**************************
-
-*** Hash resizing test ***
-ba
-baa
-baaa
-baaaa
-baaaaa
-baaaaaa
-baaaaaaa
-baaaaaaaa
-baaaaaaaaa
-baaaaaaaaaa
-ba
-10
-baa
-9
-baaa
-8
-baaaa
-7
-baaaaa
-6
-baaaaaa
-5
-baaaaaaa
-4
-baaaaaaaa
-3
-baaaaaaaaa
-2
-baaaaaaaaaa
-1
-**************************
-
-
-*** break/continue test ***
-$i should go from 0 to 2
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=0
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=1
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=2
-***********************
-
-*** Nested file include test ***
-<html>
-This is Finish.phtml. This file is supposed to be included
-from regression_test.phtml. This is normal HTML.
-and this is PHP code, 2+2=4
-</html>
-********************************
-
-Tests completed.
-<html>
-<head>
-*** Testing assignments and variable aliasing: ***
-This should read "blah": blah
-This should read "this is nifty": this is nifty
-*************************************************
-
-*** Testing integer operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing real operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing if/elseif/else control ***
-
-This works
-this_still_works
-should_print
-
-
-*** Seriously nested if's test ***
-** spelling correction by kluzz **
-Only two lines of text should follow:
-this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0
-this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4
-3 loop iterations should follow:
-2 4
-3 4
-4 4
-**********************************
-
-*** C-style else-if's ***
-This should be displayed
-*************************
-
-*** WHILE tests ***
-0 is smaller than 20
-1 is smaller than 20
-2 is smaller than 20
-3 is smaller than 20
-4 is smaller than 20
-5 is smaller than 20
-6 is smaller than 20
-7 is smaller than 20
-8 is smaller than 20
-9 is smaller than 20
-10 is smaller than 20
-11 is smaller than 20
-12 is smaller than 20
-13 is smaller than 20
-14 is smaller than 20
-15 is smaller than 20
-16 is smaller than 20
-17 is smaller than 20
-18 is smaller than 20
-19 is smaller than 20
-20 equals 20
-21 is greater than 20
-22 is greater than 20
-23 is greater than 20
-24 is greater than 20
-25 is greater than 20
-26 is greater than 20
-27 is greater than 20
-28 is greater than 20
-29 is greater than 20
-30 is greater than 20
-31 is greater than 20
-32 is greater than 20
-33 is greater than 20
-34 is greater than 20
-35 is greater than 20
-36 is greater than 20
-37 is greater than 20
-38 is greater than 20
-39 is greater than 20
-*******************
-
-
-*** Nested WHILEs ***
-Each array variable should be equal to the sum of its indices:
-${test00}[0] = 0
-${test00}[1] = 1
-${test00}[2] = 2
-${test01}[0] = 1
-${test01}[1] = 2
-${test01}[2] = 3
-${test02}[0] = 2
-${test02}[1] = 3
-${test02}[2] = 4
-${test10}[0] = 1
-${test10}[1] = 2
-${test10}[2] = 3
-${test11}[0] = 2
-${test11}[1] = 3
-${test11}[2] = 4
-${test12}[0] = 3
-${test12}[1] = 4
-${test12}[2] = 5
-${test20}[0] = 2
-${test20}[1] = 3
-${test20}[2] = 4
-${test21}[0] = 3
-${test21}[1] = 4
-${test21}[2] = 5
-${test22}[0] = 4
-${test22}[1] = 5
-${test22}[2] = 6
-*********************
-
-*** hash test... ***
-commented out...
-**************************
-
-*** Hash resizing test ***
-ba
-baa
-baaa
-baaaa
-baaaaa
-baaaaaa
-baaaaaaa
-baaaaaaaa
-baaaaaaaaa
-baaaaaaaaaa
-ba
-10
-baa
-9
-baaa
-8
-baaaa
-7
-baaaaa
-6
-baaaaaa
-5
-baaaaaaa
-4
-baaaaaaaa
-3
-baaaaaaaaa
-2
-baaaaaaaaaa
-1
-**************************
-
-
-*** break/continue test ***
-$i should go from 0 to 2
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=0
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=1
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=2
-***********************
-
-*** Nested file include test ***
-<html>
-This is Finish.phtml. This file is supposed to be included
-from regression_test.phtml. This is normal HTML.
-and this is PHP code, 2+2=4
-</html>
-********************************
-
-Tests completed.
-<html>
-<head>
-*** Testing assignments and variable aliasing: ***
-This should read "blah": blah
-This should read "this is nifty": this is nifty
-*************************************************
-
-*** Testing integer operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing real operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing if/elseif/else control ***
-
-This works
-this_still_works
-should_print
-
-
-*** Seriously nested if's test ***
-** spelling correction by kluzz **
-Only two lines of text should follow:
-this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0
-this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4
-3 loop iterations should follow:
-2 4
-3 4
-4 4
-**********************************
-
-*** C-style else-if's ***
-This should be displayed
-*************************
-
-*** WHILE tests ***
-0 is smaller than 20
-1 is smaller than 20
-2 is smaller than 20
-3 is smaller than 20
-4 is smaller than 20
-5 is smaller than 20
-6 is smaller than 20
-7 is smaller than 20
-8 is smaller than 20
-9 is smaller than 20
-10 is smaller than 20
-11 is smaller than 20
-12 is smaller than 20
-13 is smaller than 20
-14 is smaller than 20
-15 is smaller than 20
-16 is smaller than 20
-17 is smaller than 20
-18 is smaller than 20
-19 is smaller than 20
-20 equals 20
-21 is greater than 20
-22 is greater than 20
-23 is greater than 20
-24 is greater than 20
-25 is greater than 20
-26 is greater than 20
-27 is greater than 20
-28 is greater than 20
-29 is greater than 20
-30 is greater than 20
-31 is greater than 20
-32 is greater than 20
-33 is greater than 20
-34 is greater than 20
-35 is greater than 20
-36 is greater than 20
-37 is greater than 20
-38 is greater than 20
-39 is greater than 20
-*******************
-
-
-*** Nested WHILEs ***
-Each array variable should be equal to the sum of its indices:
-${test00}[0] = 0
-${test00}[1] = 1
-${test00}[2] = 2
-${test01}[0] = 1
-${test01}[1] = 2
-${test01}[2] = 3
-${test02}[0] = 2
-${test02}[1] = 3
-${test02}[2] = 4
-${test10}[0] = 1
-${test10}[1] = 2
-${test10}[2] = 3
-${test11}[0] = 2
-${test11}[1] = 3
-${test11}[2] = 4
-${test12}[0] = 3
-${test12}[1] = 4
-${test12}[2] = 5
-${test20}[0] = 2
-${test20}[1] = 3
-${test20}[2] = 4
-${test21}[0] = 3
-${test21}[1] = 4
-${test21}[2] = 5
-${test22}[0] = 4
-${test22}[1] = 5
-${test22}[2] = 6
-*********************
-
-*** hash test... ***
-commented out...
-**************************
-
-*** Hash resizing test ***
-ba
-baa
-baaa
-baaaa
-baaaaa
-baaaaaa
-baaaaaaa
-baaaaaaaa
-baaaaaaaaa
-baaaaaaaaaa
-ba
-10
-baa
-9
-baaa
-8
-baaaa
-7
-baaaaa
-6
-baaaaaa
-5
-baaaaaaa
-4
-baaaaaaaa
-3
-baaaaaaaaa
-2
-baaaaaaaaaa
-1
-**************************
-
-
-*** break/continue test ***
-$i should go from 0 to 2
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=0
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=1
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=2
-***********************
-
-*** Nested file include test ***
-<html>
-This is Finish.phtml. This file is supposed to be included
-from regression_test.phtml. This is normal HTML.
-and this is PHP code, 2+2=4
-</html>
-********************************
-
-Tests completed.
-<html>
-<head>
-*** Testing assignments and variable aliasing: ***
-This should read "blah": blah
-This should read "this is nifty": this is nifty
-*************************************************
-
-*** Testing integer operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing real operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing if/elseif/else control ***
-
-This works
-this_still_works
-should_print
-
-
-*** Seriously nested if's test ***
-** spelling correction by kluzz **
-Only two lines of text should follow:
-this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0
-this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4
-3 loop iterations should follow:
-2 4
-3 4
-4 4
-**********************************
-
-*** C-style else-if's ***
-This should be displayed
-*************************
-
-*** WHILE tests ***
-0 is smaller than 20
-1 is smaller than 20
-2 is smaller than 20
-3 is smaller than 20
-4 is smaller than 20
-5 is smaller than 20
-6 is smaller than 20
-7 is smaller than 20
-8 is smaller than 20
-9 is smaller than 20
-10 is smaller than 20
-11 is smaller than 20
-12 is smaller than 20
-13 is smaller than 20
-14 is smaller than 20
-15 is smaller than 20
-16 is smaller than 20
-17 is smaller than 20
-18 is smaller than 20
-19 is smaller than 20
-20 equals 20
-21 is greater than 20
-22 is greater than 20
-23 is greater than 20
-24 is greater than 20
-25 is greater than 20
-26 is greater than 20
-27 is greater than 20
-28 is greater than 20
-29 is greater than 20
-30 is greater than 20
-31 is greater than 20
-32 is greater than 20
-33 is greater than 20
-34 is greater than 20
-35 is greater than 20
-36 is greater than 20
-37 is greater than 20
-38 is greater than 20
-39 is greater than 20
-*******************
-
-
-*** Nested WHILEs ***
-Each array variable should be equal to the sum of its indices:
-${test00}[0] = 0
-${test00}[1] = 1
-${test00}[2] = 2
-${test01}[0] = 1
-${test01}[1] = 2
-${test01}[2] = 3
-${test02}[0] = 2
-${test02}[1] = 3
-${test02}[2] = 4
-${test10}[0] = 1
-${test10}[1] = 2
-${test10}[2] = 3
-${test11}[0] = 2
-${test11}[1] = 3
-${test11}[2] = 4
-${test12}[0] = 3
-${test12}[1] = 4
-${test12}[2] = 5
-${test20}[0] = 2
-${test20}[1] = 3
-${test20}[2] = 4
-${test21}[0] = 3
-${test21}[1] = 4
-${test21}[2] = 5
-${test22}[0] = 4
-${test22}[1] = 5
-${test22}[2] = 6
-*********************
-
-*** hash test... ***
-commented out...
-**************************
-
-*** Hash resizing test ***
-ba
-baa
-baaa
-baaaa
-baaaaa
-baaaaaa
-baaaaaaa
-baaaaaaaa
-baaaaaaaaa
-baaaaaaaaaa
-ba
-10
-baa
-9
-baaa
-8
-baaaa
-7
-baaaaa
-6
-baaaaaa
-5
-baaaaaaa
-4
-baaaaaaaa
-3
-baaaaaaaaa
-2
-baaaaaaaaaa
-1
-**************************
-
-
-*** break/continue test ***
-$i should go from 0 to 2
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=0
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=1
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=2
-***********************
-
-*** Nested file include test ***
-<html>
-This is Finish.phtml. This file is supposed to be included
-from regression_test.phtml. This is normal HTML.
-and this is PHP code, 2+2=4
-</html>
-********************************
-
-Tests completed.
-<html>
-<head>
-*** Testing assignments and variable aliasing: ***
-This should read "blah": blah
-This should read "this is nifty": this is nifty
-*************************************************
-
-*** Testing integer operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing real operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing if/elseif/else control ***
-
-This works
-this_still_works
-should_print
-
-
-*** Seriously nested if's test ***
-** spelling correction by kluzz **
-Only two lines of text should follow:
-this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0
-this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4
-3 loop iterations should follow:
-2 4
-3 4
-4 4
-**********************************
-
-*** C-style else-if's ***
-This should be displayed
-*************************
-
-*** WHILE tests ***
-0 is smaller than 20
-1 is smaller than 20
-2 is smaller than 20
-3 is smaller than 20
-4 is smaller than 20
-5 is smaller than 20
-6 is smaller than 20
-7 is smaller than 20
-8 is smaller than 20
-9 is smaller than 20
-10 is smaller than 20
-11 is smaller than 20
-12 is smaller than 20
-13 is smaller than 20
-14 is smaller than 20
-15 is smaller than 20
-16 is smaller than 20
-17 is smaller than 20
-18 is smaller than 20
-19 is smaller than 20
-20 equals 20
-21 is greater than 20
-22 is greater than 20
-23 is greater than 20
-24 is greater than 20
-25 is greater than 20
-26 is greater than 20
-27 is greater than 20
-28 is greater than 20
-29 is greater than 20
-30 is greater than 20
-31 is greater than 20
-32 is greater than 20
-33 is greater than 20
-34 is greater than 20
-35 is greater than 20
-36 is greater than 20
-37 is greater than 20
-38 is greater than 20
-39 is greater than 20
-*******************
-
-
-*** Nested WHILEs ***
-Each array variable should be equal to the sum of its indices:
-${test00}[0] = 0
-${test00}[1] = 1
-${test00}[2] = 2
-${test01}[0] = 1
-${test01}[1] = 2
-${test01}[2] = 3
-${test02}[0] = 2
-${test02}[1] = 3
-${test02}[2] = 4
-${test10}[0] = 1
-${test10}[1] = 2
-${test10}[2] = 3
-${test11}[0] = 2
-${test11}[1] = 3
-${test11}[2] = 4
-${test12}[0] = 3
-${test12}[1] = 4
-${test12}[2] = 5
-${test20}[0] = 2
-${test20}[1] = 3
-${test20}[2] = 4
-${test21}[0] = 3
-${test21}[1] = 4
-${test21}[2] = 5
-${test22}[0] = 4
-${test22}[1] = 5
-${test22}[2] = 6
-*********************
-
-*** hash test... ***
-commented out...
-**************************
-
-*** Hash resizing test ***
-ba
-baa
-baaa
-baaaa
-baaaaa
-baaaaaa
-baaaaaaa
-baaaaaaaa
-baaaaaaaaa
-baaaaaaaaaa
-ba
-10
-baa
-9
-baaa
-8
-baaaa
-7
-baaaaa
-6
-baaaaaa
-5
-baaaaaaa
-4
-baaaaaaaa
-3
-baaaaaaaaa
-2
-baaaaaaaaaa
-1
-**************************
-
-
-*** break/continue test ***
-$i should go from 0 to 2
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=0
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=1
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=2
-***********************
-
-*** Nested file include test ***
-<html>
-This is Finish.phtml. This file is supposed to be included
-from regression_test.phtml. This is normal HTML.
-and this is PHP code, 2+2=4
-</html>
-********************************
-
-Tests completed.
-<html>
-<head>
-*** Testing assignments and variable aliasing: ***
-This should read "blah": blah
-This should read "this is nifty": this is nifty
-*************************************************
-
-*** Testing integer operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing real operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing if/elseif/else control ***
-
-This works
-this_still_works
-should_print
-
-
-*** Seriously nested if's test ***
-** spelling correction by kluzz **
-Only two lines of text should follow:
-this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0
-this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4
-3 loop iterations should follow:
-2 4
-3 4
-4 4
-**********************************
-
-*** C-style else-if's ***
-This should be displayed
-*************************
-
-*** WHILE tests ***
-0 is smaller than 20
-1 is smaller than 20
-2 is smaller than 20
-3 is smaller than 20
-4 is smaller than 20
-5 is smaller than 20
-6 is smaller than 20
-7 is smaller than 20
-8 is smaller than 20
-9 is smaller than 20
-10 is smaller than 20
-11 is smaller than 20
-12 is smaller than 20
-13 is smaller than 20
-14 is smaller than 20
-15 is smaller than 20
-16 is smaller than 20
-17 is smaller than 20
-18 is smaller than 20
-19 is smaller than 20
-20 equals 20
-21 is greater than 20
-22 is greater than 20
-23 is greater than 20
-24 is greater than 20
-25 is greater than 20
-26 is greater than 20
-27 is greater than 20
-28 is greater than 20
-29 is greater than 20
-30 is greater than 20
-31 is greater than 20
-32 is greater than 20
-33 is greater than 20
-34 is greater than 20
-35 is greater than 20
-36 is greater than 20
-37 is greater than 20
-38 is greater than 20
-39 is greater than 20
-*******************
-
-
-*** Nested WHILEs ***
-Each array variable should be equal to the sum of its indices:
-${test00}[0] = 0
-${test00}[1] = 1
-${test00}[2] = 2
-${test01}[0] = 1
-${test01}[1] = 2
-${test01}[2] = 3
-${test02}[0] = 2
-${test02}[1] = 3
-${test02}[2] = 4
-${test10}[0] = 1
-${test10}[1] = 2
-${test10}[2] = 3
-${test11}[0] = 2
-${test11}[1] = 3
-${test11}[2] = 4
-${test12}[0] = 3
-${test12}[1] = 4
-${test12}[2] = 5
-${test20}[0] = 2
-${test20}[1] = 3
-${test20}[2] = 4
-${test21}[0] = 3
-${test21}[1] = 4
-${test21}[2] = 5
-${test22}[0] = 4
-${test22}[1] = 5
-${test22}[2] = 6
-*********************
-
-*** hash test... ***
-commented out...
-**************************
-
-*** Hash resizing test ***
-ba
-baa
-baaa
-baaaa
-baaaaa
-baaaaaa
-baaaaaaa
-baaaaaaaa
-baaaaaaaaa
-baaaaaaaaaa
-ba
-10
-baa
-9
-baaa
-8
-baaaa
-7
-baaaaa
-6
-baaaaaa
-5
-baaaaaaa
-4
-baaaaaaaa
-3
-baaaaaaaaa
-2
-baaaaaaaaaa
-1
-**************************
-
-
-*** break/continue test ***
-$i should go from 0 to 2
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=0
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=1
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=2
-***********************
-
-*** Nested file include test ***
-<html>
-This is Finish.phtml. This file is supposed to be included
-from regression_test.phtml. This is normal HTML.
-and this is PHP code, 2+2=4
-</html>
-********************************
-
-Tests completed.
-<html>
-<head>
-*** Testing assignments and variable aliasing: ***
-This should read "blah": blah
-This should read "this is nifty": this is nifty
-*************************************************
-
-*** Testing integer operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing real operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing if/elseif/else control ***
-
-This works
-this_still_works
-should_print
-
-
-*** Seriously nested if's test ***
-** spelling correction by kluzz **
-Only two lines of text should follow:
-this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0
-this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4
-3 loop iterations should follow:
-2 4
-3 4
-4 4
-**********************************
-
-*** C-style else-if's ***
-This should be displayed
-*************************
-
-*** WHILE tests ***
-0 is smaller than 20
-1 is smaller than 20
-2 is smaller than 20
-3 is smaller than 20
-4 is smaller than 20
-5 is smaller than 20
-6 is smaller than 20
-7 is smaller than 20
-8 is smaller than 20
-9 is smaller than 20
-10 is smaller than 20
-11 is smaller than 20
-12 is smaller than 20
-13 is smaller than 20
-14 is smaller than 20
-15 is smaller than 20
-16 is smaller than 20
-17 is smaller than 20
-18 is smaller than 20
-19 is smaller than 20
-20 equals 20
-21 is greater than 20
-22 is greater than 20
-23 is greater than 20
-24 is greater than 20
-25 is greater than 20
-26 is greater than 20
-27 is greater than 20
-28 is greater than 20
-29 is greater than 20
-30 is greater than 20
-31 is greater than 20
-32 is greater than 20
-33 is greater than 20
-34 is greater than 20
-35 is greater than 20
-36 is greater than 20
-37 is greater than 20
-38 is greater than 20
-39 is greater than 20
-*******************
-
-
-*** Nested WHILEs ***
-Each array variable should be equal to the sum of its indices:
-${test00}[0] = 0
-${test00}[1] = 1
-${test00}[2] = 2
-${test01}[0] = 1
-${test01}[1] = 2
-${test01}[2] = 3
-${test02}[0] = 2
-${test02}[1] = 3
-${test02}[2] = 4
-${test10}[0] = 1
-${test10}[1] = 2
-${test10}[2] = 3
-${test11}[0] = 2
-${test11}[1] = 3
-${test11}[2] = 4
-${test12}[0] = 3
-${test12}[1] = 4
-${test12}[2] = 5
-${test20}[0] = 2
-${test20}[1] = 3
-${test20}[2] = 4
-${test21}[0] = 3
-${test21}[1] = 4
-${test21}[2] = 5
-${test22}[0] = 4
-${test22}[1] = 5
-${test22}[2] = 6
-*********************
-
-*** hash test... ***
-commented out...
-**************************
-
-*** Hash resizing test ***
-ba
-baa
-baaa
-baaaa
-baaaaa
-baaaaaa
-baaaaaaa
-baaaaaaaa
-baaaaaaaaa
-baaaaaaaaaa
-ba
-10
-baa
-9
-baaa
-8
-baaaa
-7
-baaaaa
-6
-baaaaaa
-5
-baaaaaaa
-4
-baaaaaaaa
-3
-baaaaaaaaa
-2
-baaaaaaaaaa
-1
-**************************
-
-
-*** break/continue test ***
-$i should go from 0 to 2
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=0
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=1
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=2
-***********************
-
-*** Nested file include test ***
-<html>
-This is Finish.phtml. This file is supposed to be included
-from regression_test.phtml. This is normal HTML.
-and this is PHP code, 2+2=4
-</html>
-********************************
-
-Tests completed.
-<html>
-<head>
-*** Testing assignments and variable aliasing: ***
-This should read "blah": blah
-This should read "this is nifty": this is nifty
-*************************************************
-
-*** Testing integer operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing real operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing if/elseif/else control ***
-
-This works
-this_still_works
-should_print
-
-
-*** Seriously nested if's test ***
-** spelling correction by kluzz **
-Only two lines of text should follow:
-this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0
-this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4
-3 loop iterations should follow:
-2 4
-3 4
-4 4
-**********************************
-
-*** C-style else-if's ***
-This should be displayed
-*************************
-
-*** WHILE tests ***
-0 is smaller than 20
-1 is smaller than 20
-2 is smaller than 20
-3 is smaller than 20
-4 is smaller than 20
-5 is smaller than 20
-6 is smaller than 20
-7 is smaller than 20
-8 is smaller than 20
-9 is smaller than 20
-10 is smaller than 20
-11 is smaller than 20
-12 is smaller than 20
-13 is smaller than 20
-14 is smaller than 20
-15 is smaller than 20
-16 is smaller than 20
-17 is smaller than 20
-18 is smaller than 20
-19 is smaller than 20
-20 equals 20
-21 is greater than 20
-22 is greater than 20
-23 is greater than 20
-24 is greater than 20
-25 is greater than 20
-26 is greater than 20
-27 is greater than 20
-28 is greater than 20
-29 is greater than 20
-30 is greater than 20
-31 is greater than 20
-32 is greater than 20
-33 is greater than 20
-34 is greater than 20
-35 is greater than 20
-36 is greater than 20
-37 is greater than 20
-38 is greater than 20
-39 is greater than 20
-*******************
-
-
-*** Nested WHILEs ***
-Each array variable should be equal to the sum of its indices:
-${test00}[0] = 0
-${test00}[1] = 1
-${test00}[2] = 2
-${test01}[0] = 1
-${test01}[1] = 2
-${test01}[2] = 3
-${test02}[0] = 2
-${test02}[1] = 3
-${test02}[2] = 4
-${test10}[0] = 1
-${test10}[1] = 2
-${test10}[2] = 3
-${test11}[0] = 2
-${test11}[1] = 3
-${test11}[2] = 4
-${test12}[0] = 3
-${test12}[1] = 4
-${test12}[2] = 5
-${test20}[0] = 2
-${test20}[1] = 3
-${test20}[2] = 4
-${test21}[0] = 3
-${test21}[1] = 4
-${test21}[2] = 5
-${test22}[0] = 4
-${test22}[1] = 5
-${test22}[2] = 6
-*********************
-
-*** hash test... ***
-commented out...
-**************************
-
-*** Hash resizing test ***
-ba
-baa
-baaa
-baaaa
-baaaaa
-baaaaaa
-baaaaaaa
-baaaaaaaa
-baaaaaaaaa
-baaaaaaaaaa
-ba
-10
-baa
-9
-baaa
-8
-baaaa
-7
-baaaaa
-6
-baaaaaa
-5
-baaaaaaa
-4
-baaaaaaaa
-3
-baaaaaaaaa
-2
-baaaaaaaaaa
-1
-**************************
-
-
-*** break/continue test ***
-$i should go from 0 to 2
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=0
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=1
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=2
-***********************
-
-*** Nested file include test ***
-<html>
-This is Finish.phtml. This file is supposed to be included
-from regression_test.phtml. This is normal HTML.
-and this is PHP code, 2+2=4
-</html>
-********************************
-
-Tests completed.
-<html>
-<head>
-*** Testing assignments and variable aliasing: ***
-This should read "blah": blah
-This should read "this is nifty": this is nifty
-*************************************************
-
-*** Testing integer operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing real operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing if/elseif/else control ***
-
-This works
-this_still_works
-should_print
-
-
-*** Seriously nested if's test ***
-** spelling correction by kluzz **
-Only two lines of text should follow:
-this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0
-this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4
-3 loop iterations should follow:
-2 4
-3 4
-4 4
-**********************************
-
-*** C-style else-if's ***
-This should be displayed
-*************************
-
-*** WHILE tests ***
-0 is smaller than 20
-1 is smaller than 20
-2 is smaller than 20
-3 is smaller than 20
-4 is smaller than 20
-5 is smaller than 20
-6 is smaller than 20
-7 is smaller than 20
-8 is smaller than 20
-9 is smaller than 20
-10 is smaller than 20
-11 is smaller than 20
-12 is smaller than 20
-13 is smaller than 20
-14 is smaller than 20
-15 is smaller than 20
-16 is smaller than 20
-17 is smaller than 20
-18 is smaller than 20
-19 is smaller than 20
-20 equals 20
-21 is greater than 20
-22 is greater than 20
-23 is greater than 20
-24 is greater than 20
-25 is greater than 20
-26 is greater than 20
-27 is greater than 20
-28 is greater than 20
-29 is greater than 20
-30 is greater than 20
-31 is greater than 20
-32 is greater than 20
-33 is greater than 20
-34 is greater than 20
-35 is greater than 20
-36 is greater than 20
-37 is greater than 20
-38 is greater than 20
-39 is greater than 20
-*******************
-
-
-*** Nested WHILEs ***
-Each array variable should be equal to the sum of its indices:
-${test00}[0] = 0
-${test00}[1] = 1
-${test00}[2] = 2
-${test01}[0] = 1
-${test01}[1] = 2
-${test01}[2] = 3
-${test02}[0] = 2
-${test02}[1] = 3
-${test02}[2] = 4
-${test10}[0] = 1
-${test10}[1] = 2
-${test10}[2] = 3
-${test11}[0] = 2
-${test11}[1] = 3
-${test11}[2] = 4
-${test12}[0] = 3
-${test12}[1] = 4
-${test12}[2] = 5
-${test20}[0] = 2
-${test20}[1] = 3
-${test20}[2] = 4
-${test21}[0] = 3
-${test21}[1] = 4
-${test21}[2] = 5
-${test22}[0] = 4
-${test22}[1] = 5
-${test22}[2] = 6
-*********************
-
-*** hash test... ***
-commented out...
-**************************
-
-*** Hash resizing test ***
-ba
-baa
-baaa
-baaaa
-baaaaa
-baaaaaa
-baaaaaaa
-baaaaaaaa
-baaaaaaaaa
-baaaaaaaaaa
-ba
-10
-baa
-9
-baaa
-8
-baaaa
-7
-baaaaa
-6
-baaaaaa
-5
-baaaaaaa
-4
-baaaaaaaa
-3
-baaaaaaaaa
-2
-baaaaaaaaaa
-1
-**************************
-
-
-*** break/continue test ***
-$i should go from 0 to 2
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=0
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=1
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=2
-***********************
-
-*** Nested file include test ***
-<html>
-This is Finish.phtml. This file is supposed to be included
-from regression_test.phtml. This is normal HTML.
-and this is PHP code, 2+2=4
-</html>
-********************************
-
-Tests completed.
-<html>
-<head>
-*** Testing assignments and variable aliasing: ***
-This should read "blah": blah
-This should read "this is nifty": this is nifty
-*************************************************
-
-*** Testing integer operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing real operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing if/elseif/else control ***
-
-This works
-this_still_works
-should_print
-
-
-*** Seriously nested if's test ***
-** spelling correction by kluzz **
-Only two lines of text should follow:
-this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0
-this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4
-3 loop iterations should follow:
-2 4
-3 4
-4 4
-**********************************
-
-*** C-style else-if's ***
-This should be displayed
-*************************
-
-*** WHILE tests ***
-0 is smaller than 20
-1 is smaller than 20
-2 is smaller than 20
-3 is smaller than 20
-4 is smaller than 20
-5 is smaller than 20
-6 is smaller than 20
-7 is smaller than 20
-8 is smaller than 20
-9 is smaller than 20
-10 is smaller than 20
-11 is smaller than 20
-12 is smaller than 20
-13 is smaller than 20
-14 is smaller than 20
-15 is smaller than 20
-16 is smaller than 20
-17 is smaller than 20
-18 is smaller than 20
-19 is smaller than 20
-20 equals 20
-21 is greater than 20
-22 is greater than 20
-23 is greater than 20
-24 is greater than 20
-25 is greater than 20
-26 is greater than 20
-27 is greater than 20
-28 is greater than 20
-29 is greater than 20
-30 is greater than 20
-31 is greater than 20
-32 is greater than 20
-33 is greater than 20
-34 is greater than 20
-35 is greater than 20
-36 is greater than 20
-37 is greater than 20
-38 is greater than 20
-39 is greater than 20
-*******************
-
-
-*** Nested WHILEs ***
-Each array variable should be equal to the sum of its indices:
-${test00}[0] = 0
-${test00}[1] = 1
-${test00}[2] = 2
-${test01}[0] = 1
-${test01}[1] = 2
-${test01}[2] = 3
-${test02}[0] = 2
-${test02}[1] = 3
-${test02}[2] = 4
-${test10}[0] = 1
-${test10}[1] = 2
-${test10}[2] = 3
-${test11}[0] = 2
-${test11}[1] = 3
-${test11}[2] = 4
-${test12}[0] = 3
-${test12}[1] = 4
-${test12}[2] = 5
-${test20}[0] = 2
-${test20}[1] = 3
-${test20}[2] = 4
-${test21}[0] = 3
-${test21}[1] = 4
-${test21}[2] = 5
-${test22}[0] = 4
-${test22}[1] = 5
-${test22}[2] = 6
-*********************
-
-*** hash test... ***
-commented out...
-**************************
-
-*** Hash resizing test ***
-ba
-baa
-baaa
-baaaa
-baaaaa
-baaaaaa
-baaaaaaa
-baaaaaaaa
-baaaaaaaaa
-baaaaaaaaaa
-ba
-10
-baa
-9
-baaa
-8
-baaaa
-7
-baaaaa
-6
-baaaaaa
-5
-baaaaaaa
-4
-baaaaaaaa
-3
-baaaaaaaaa
-2
-baaaaaaaaaa
-1
-**************************
-
-
-*** break/continue test ***
-$i should go from 0 to 2
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=0
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=1
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=2
-***********************
-
-*** Nested file include test ***
-<html>
-This is Finish.phtml. This file is supposed to be included
-from regression_test.phtml. This is normal HTML.
-and this is PHP code, 2+2=4
-</html>
-********************************
-
-Tests completed.
-<html>
-<head>
-*** Testing assignments and variable aliasing: ***
-This should read "blah": blah
-This should read "this is nifty": this is nifty
-*************************************************
-
-*** Testing integer operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing real operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing if/elseif/else control ***
-
-This works
-this_still_works
-should_print
-
-
-*** Seriously nested if's test ***
-** spelling correction by kluzz **
-Only two lines of text should follow:
-this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0
-this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4
-3 loop iterations should follow:
-2 4
-3 4
-4 4
-**********************************
-
-*** C-style else-if's ***
-This should be displayed
-*************************
-
-*** WHILE tests ***
-0 is smaller than 20
-1 is smaller than 20
-2 is smaller than 20
-3 is smaller than 20
-4 is smaller than 20
-5 is smaller than 20
-6 is smaller than 20
-7 is smaller than 20
-8 is smaller than 20
-9 is smaller than 20
-10 is smaller than 20
-11 is smaller than 20
-12 is smaller than 20
-13 is smaller than 20
-14 is smaller than 20
-15 is smaller than 20
-16 is smaller than 20
-17 is smaller than 20
-18 is smaller than 20
-19 is smaller than 20
-20 equals 20
-21 is greater than 20
-22 is greater than 20
-23 is greater than 20
-24 is greater than 20
-25 is greater than 20
-26 is greater than 20
-27 is greater than 20
-28 is greater than 20
-29 is greater than 20
-30 is greater than 20
-31 is greater than 20
-32 is greater than 20
-33 is greater than 20
-34 is greater than 20
-35 is greater than 20
-36 is greater than 20
-37 is greater than 20
-38 is greater than 20
-39 is greater than 20
-*******************
-
-
-*** Nested WHILEs ***
-Each array variable should be equal to the sum of its indices:
-${test00}[0] = 0
-${test00}[1] = 1
-${test00}[2] = 2
-${test01}[0] = 1
-${test01}[1] = 2
-${test01}[2] = 3
-${test02}[0] = 2
-${test02}[1] = 3
-${test02}[2] = 4
-${test10}[0] = 1
-${test10}[1] = 2
-${test10}[2] = 3
-${test11}[0] = 2
-${test11}[1] = 3
-${test11}[2] = 4
-${test12}[0] = 3
-${test12}[1] = 4
-${test12}[2] = 5
-${test20}[0] = 2
-${test20}[1] = 3
-${test20}[2] = 4
-${test21}[0] = 3
-${test21}[1] = 4
-${test21}[2] = 5
-${test22}[0] = 4
-${test22}[1] = 5
-${test22}[2] = 6
-*********************
-
-*** hash test... ***
-commented out...
-**************************
-
-*** Hash resizing test ***
-ba
-baa
-baaa
-baaaa
-baaaaa
-baaaaaa
-baaaaaaa
-baaaaaaaa
-baaaaaaaaa
-baaaaaaaaaa
-ba
-10
-baa
-9
-baaa
-8
-baaaa
-7
-baaaaa
-6
-baaaaaa
-5
-baaaaaaa
-4
-baaaaaaaa
-3
-baaaaaaaaa
-2
-baaaaaaaaaa
-1
-**************************
-
-
-*** break/continue test ***
-$i should go from 0 to 2
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=0
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=1
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=2
-***********************
-
-*** Nested file include test ***
-<html>
-This is Finish.phtml. This file is supposed to be included
-from regression_test.phtml. This is normal HTML.
-and this is PHP code, 2+2=4
-</html>
-********************************
-
-Tests completed.
-<html>
-<head>
-*** Testing assignments and variable aliasing: ***
-This should read "blah": blah
-This should read "this is nifty": this is nifty
-*************************************************
-
-*** Testing integer operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing real operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing if/elseif/else control ***
-
-This works
-this_still_works
-should_print
-
-
-*** Seriously nested if's test ***
-** spelling correction by kluzz **
-Only two lines of text should follow:
-this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0
-this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4
-3 loop iterations should follow:
-2 4
-3 4
-4 4
-**********************************
-
-*** C-style else-if's ***
-This should be displayed
-*************************
-
-*** WHILE tests ***
-0 is smaller than 20
-1 is smaller than 20
-2 is smaller than 20
-3 is smaller than 20
-4 is smaller than 20
-5 is smaller than 20
-6 is smaller than 20
-7 is smaller than 20
-8 is smaller than 20
-9 is smaller than 20
-10 is smaller than 20
-11 is smaller than 20
-12 is smaller than 20
-13 is smaller than 20
-14 is smaller than 20
-15 is smaller than 20
-16 is smaller than 20
-17 is smaller than 20
-18 is smaller than 20
-19 is smaller than 20
-20 equals 20
-21 is greater than 20
-22 is greater than 20
-23 is greater than 20
-24 is greater than 20
-25 is greater than 20
-26 is greater than 20
-27 is greater than 20
-28 is greater than 20
-29 is greater than 20
-30 is greater than 20
-31 is greater than 20
-32 is greater than 20
-33 is greater than 20
-34 is greater than 20
-35 is greater than 20
-36 is greater than 20
-37 is greater than 20
-38 is greater than 20
-39 is greater than 20
-*******************
-
-
-*** Nested WHILEs ***
-Each array variable should be equal to the sum of its indices:
-${test00}[0] = 0
-${test00}[1] = 1
-${test00}[2] = 2
-${test01}[0] = 1
-${test01}[1] = 2
-${test01}[2] = 3
-${test02}[0] = 2
-${test02}[1] = 3
-${test02}[2] = 4
-${test10}[0] = 1
-${test10}[1] = 2
-${test10}[2] = 3
-${test11}[0] = 2
-${test11}[1] = 3
-${test11}[2] = 4
-${test12}[0] = 3
-${test12}[1] = 4
-${test12}[2] = 5
-${test20}[0] = 2
-${test20}[1] = 3
-${test20}[2] = 4
-${test21}[0] = 3
-${test21}[1] = 4
-${test21}[2] = 5
-${test22}[0] = 4
-${test22}[1] = 5
-${test22}[2] = 6
-*********************
-
-*** hash test... ***
-commented out...
-**************************
-
-*** Hash resizing test ***
-ba
-baa
-baaa
-baaaa
-baaaaa
-baaaaaa
-baaaaaaa
-baaaaaaaa
-baaaaaaaaa
-baaaaaaaaaa
-ba
-10
-baa
-9
-baaa
-8
-baaaa
-7
-baaaaa
-6
-baaaaaa
-5
-baaaaaaa
-4
-baaaaaaaa
-3
-baaaaaaaaa
-2
-baaaaaaaaaa
-1
-**************************
-
-
-*** break/continue test ***
-$i should go from 0 to 2
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=0
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=1
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=2
-***********************
-
-*** Nested file include test ***
-<html>
-This is Finish.phtml. This file is supposed to be included
-from regression_test.phtml. This is normal HTML.
-and this is PHP code, 2+2=4
-</html>
-********************************
-
-Tests completed.
-<html>
-<head>
-*** Testing assignments and variable aliasing: ***
-This should read "blah": blah
-This should read "this is nifty": this is nifty
-*************************************************
-
-*** Testing integer operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing real operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing if/elseif/else control ***
-
-This works
-this_still_works
-should_print
-
-
-*** Seriously nested if's test ***
-** spelling correction by kluzz **
-Only two lines of text should follow:
-this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0
-this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4
-3 loop iterations should follow:
-2 4
-3 4
-4 4
-**********************************
-
-*** C-style else-if's ***
-This should be displayed
-*************************
-
-*** WHILE tests ***
-0 is smaller than 20
-1 is smaller than 20
-2 is smaller than 20
-3 is smaller than 20
-4 is smaller than 20
-5 is smaller than 20
-6 is smaller than 20
-7 is smaller than 20
-8 is smaller than 20
-9 is smaller than 20
-10 is smaller than 20
-11 is smaller than 20
-12 is smaller than 20
-13 is smaller than 20
-14 is smaller than 20
-15 is smaller than 20
-16 is smaller than 20
-17 is smaller than 20
-18 is smaller than 20
-19 is smaller than 20
-20 equals 20
-21 is greater than 20
-22 is greater than 20
-23 is greater than 20
-24 is greater than 20
-25 is greater than 20
-26 is greater than 20
-27 is greater than 20
-28 is greater than 20
-29 is greater than 20
-30 is greater than 20
-31 is greater than 20
-32 is greater than 20
-33 is greater than 20
-34 is greater than 20
-35 is greater than 20
-36 is greater than 20
-37 is greater than 20
-38 is greater than 20
-39 is greater than 20
-*******************
-
-
-*** Nested WHILEs ***
-Each array variable should be equal to the sum of its indices:
-${test00}[0] = 0
-${test00}[1] = 1
-${test00}[2] = 2
-${test01}[0] = 1
-${test01}[1] = 2
-${test01}[2] = 3
-${test02}[0] = 2
-${test02}[1] = 3
-${test02}[2] = 4
-${test10}[0] = 1
-${test10}[1] = 2
-${test10}[2] = 3
-${test11}[0] = 2
-${test11}[1] = 3
-${test11}[2] = 4
-${test12}[0] = 3
-${test12}[1] = 4
-${test12}[2] = 5
-${test20}[0] = 2
-${test20}[1] = 3
-${test20}[2] = 4
-${test21}[0] = 3
-${test21}[1] = 4
-${test21}[2] = 5
-${test22}[0] = 4
-${test22}[1] = 5
-${test22}[2] = 6
-*********************
-
-*** hash test... ***
-commented out...
-**************************
-
-*** Hash resizing test ***
-ba
-baa
-baaa
-baaaa
-baaaaa
-baaaaaa
-baaaaaaa
-baaaaaaaa
-baaaaaaaaa
-baaaaaaaaaa
-ba
-10
-baa
-9
-baaa
-8
-baaaa
-7
-baaaaa
-6
-baaaaaa
-5
-baaaaaaa
-4
-baaaaaaaa
-3
-baaaaaaaaa
-2
-baaaaaaaaaa
-1
-**************************
-
-
-*** break/continue test ***
-$i should go from 0 to 2
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=0
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=1
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=2
-***********************
-
-*** Nested file include test ***
-<html>
-This is Finish.phtml. This file is supposed to be included
-from regression_test.phtml. This is normal HTML.
-and this is PHP code, 2+2=4
-</html>
-********************************
-
-Tests completed.
-<html>
-<head>
-*** Testing assignments and variable aliasing: ***
-This should read "blah": blah
-This should read "this is nifty": this is nifty
-*************************************************
-
-*** Testing integer operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing real operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing if/elseif/else control ***
-
-This works
-this_still_works
-should_print
-
-
-*** Seriously nested if's test ***
-** spelling correction by kluzz **
-Only two lines of text should follow:
-this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0
-this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4
-3 loop iterations should follow:
-2 4
-3 4
-4 4
-**********************************
-
-*** C-style else-if's ***
-This should be displayed
-*************************
-
-*** WHILE tests ***
-0 is smaller than 20
-1 is smaller than 20
-2 is smaller than 20
-3 is smaller than 20
-4 is smaller than 20
-5 is smaller than 20
-6 is smaller than 20
-7 is smaller than 20
-8 is smaller than 20
-9 is smaller than 20
-10 is smaller than 20
-11 is smaller than 20
-12 is smaller than 20
-13 is smaller than 20
-14 is smaller than 20
-15 is smaller than 20
-16 is smaller than 20
-17 is smaller than 20
-18 is smaller than 20
-19 is smaller than 20
-20 equals 20
-21 is greater than 20
-22 is greater than 20
-23 is greater than 20
-24 is greater than 20
-25 is greater than 20
-26 is greater than 20
-27 is greater than 20
-28 is greater than 20
-29 is greater than 20
-30 is greater than 20
-31 is greater than 20
-32 is greater than 20
-33 is greater than 20
-34 is greater than 20
-35 is greater than 20
-36 is greater than 20
-37 is greater than 20
-38 is greater than 20
-39 is greater than 20
-*******************
-
-
-*** Nested WHILEs ***
-Each array variable should be equal to the sum of its indices:
-${test00}[0] = 0
-${test00}[1] = 1
-${test00}[2] = 2
-${test01}[0] = 1
-${test01}[1] = 2
-${test01}[2] = 3
-${test02}[0] = 2
-${test02}[1] = 3
-${test02}[2] = 4
-${test10}[0] = 1
-${test10}[1] = 2
-${test10}[2] = 3
-${test11}[0] = 2
-${test11}[1] = 3
-${test11}[2] = 4
-${test12}[0] = 3
-${test12}[1] = 4
-${test12}[2] = 5
-${test20}[0] = 2
-${test20}[1] = 3
-${test20}[2] = 4
-${test21}[0] = 3
-${test21}[1] = 4
-${test21}[2] = 5
-${test22}[0] = 4
-${test22}[1] = 5
-${test22}[2] = 6
-*********************
-
-*** hash test... ***
-commented out...
-**************************
-
-*** Hash resizing test ***
-ba
-baa
-baaa
-baaaa
-baaaaa
-baaaaaa
-baaaaaaa
-baaaaaaaa
-baaaaaaaaa
-baaaaaaaaaa
-ba
-10
-baa
-9
-baaa
-8
-baaaa
-7
-baaaaa
-6
-baaaaaa
-5
-baaaaaaa
-4
-baaaaaaaa
-3
-baaaaaaaaa
-2
-baaaaaaaaaa
-1
-**************************
-
-
-*** break/continue test ***
-$i should go from 0 to 2
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=0
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=1
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=2
-***********************
-
-*** Nested file include test ***
-<html>
-This is Finish.phtml. This file is supposed to be included
-from regression_test.phtml. This is normal HTML.
-and this is PHP code, 2+2=4
-</html>
-********************************
-
-Tests completed.
-<html>
-<head>
-*** Testing assignments and variable aliasing: ***
-This should read "blah": blah
-This should read "this is nifty": this is nifty
-*************************************************
-
-*** Testing integer operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing real operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing if/elseif/else control ***
-
-This works
-this_still_works
-should_print
-
-
-*** Seriously nested if's test ***
-** spelling correction by kluzz **
-Only two lines of text should follow:
-this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0
-this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4
-3 loop iterations should follow:
-2 4
-3 4
-4 4
-**********************************
-
-*** C-style else-if's ***
-This should be displayed
-*************************
-
-*** WHILE tests ***
-0 is smaller than 20
-1 is smaller than 20
-2 is smaller than 20
-3 is smaller than 20
-4 is smaller than 20
-5 is smaller than 20
-6 is smaller than 20
-7 is smaller than 20
-8 is smaller than 20
-9 is smaller than 20
-10 is smaller than 20
-11 is smaller than 20
-12 is smaller than 20
-13 is smaller than 20
-14 is smaller than 20
-15 is smaller than 20
-16 is smaller than 20
-17 is smaller than 20
-18 is smaller than 20
-19 is smaller than 20
-20 equals 20
-21 is greater than 20
-22 is greater than 20
-23 is greater than 20
-24 is greater than 20
-25 is greater than 20
-26 is greater than 20
-27 is greater than 20
-28 is greater than 20
-29 is greater than 20
-30 is greater than 20
-31 is greater than 20
-32 is greater than 20
-33 is greater than 20
-34 is greater than 20
-35 is greater than 20
-36 is greater than 20
-37 is greater than 20
-38 is greater than 20
-39 is greater than 20
-*******************
-
-
-*** Nested WHILEs ***
-Each array variable should be equal to the sum of its indices:
-${test00}[0] = 0
-${test00}[1] = 1
-${test00}[2] = 2
-${test01}[0] = 1
-${test01}[1] = 2
-${test01}[2] = 3
-${test02}[0] = 2
-${test02}[1] = 3
-${test02}[2] = 4
-${test10}[0] = 1
-${test10}[1] = 2
-${test10}[2] = 3
-${test11}[0] = 2
-${test11}[1] = 3
-${test11}[2] = 4
-${test12}[0] = 3
-${test12}[1] = 4
-${test12}[2] = 5
-${test20}[0] = 2
-${test20}[1] = 3
-${test20}[2] = 4
-${test21}[0] = 3
-${test21}[1] = 4
-${test21}[2] = 5
-${test22}[0] = 4
-${test22}[1] = 5
-${test22}[2] = 6
-*********************
-
-*** hash test... ***
-commented out...
-**************************
-
-*** Hash resizing test ***
-ba
-baa
-baaa
-baaaa
-baaaaa
-baaaaaa
-baaaaaaa
-baaaaaaaa
-baaaaaaaaa
-baaaaaaaaaa
-ba
-10
-baa
-9
-baaa
-8
-baaaa
-7
-baaaaa
-6
-baaaaaa
-5
-baaaaaaa
-4
-baaaaaaaa
-3
-baaaaaaaaa
-2
-baaaaaaaaaa
-1
-**************************
-
-
-*** break/continue test ***
-$i should go from 0 to 2
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=0
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=1
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=2
-***********************
-
-*** Nested file include test ***
-<html>
-This is Finish.phtml. This file is supposed to be included
-from regression_test.phtml. This is normal HTML.
-and this is PHP code, 2+2=4
-</html>
-********************************
-
-Tests completed.
-<html>
-<head>
-*** Testing assignments and variable aliasing: ***
-This should read "blah": blah
-This should read "this is nifty": this is nifty
-*************************************************
-
-*** Testing integer operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing real operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing if/elseif/else control ***
-
-This works
-this_still_works
-should_print
-
-
-*** Seriously nested if's test ***
-** spelling correction by kluzz **
-Only two lines of text should follow:
-this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0
-this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4
-3 loop iterations should follow:
-2 4
-3 4
-4 4
-**********************************
-
-*** C-style else-if's ***
-This should be displayed
-*************************
-
-*** WHILE tests ***
-0 is smaller than 20
-1 is smaller than 20
-2 is smaller than 20
-3 is smaller than 20
-4 is smaller than 20
-5 is smaller than 20
-6 is smaller than 20
-7 is smaller than 20
-8 is smaller than 20
-9 is smaller than 20
-10 is smaller than 20
-11 is smaller than 20
-12 is smaller than 20
-13 is smaller than 20
-14 is smaller than 20
-15 is smaller than 20
-16 is smaller than 20
-17 is smaller than 20
-18 is smaller than 20
-19 is smaller than 20
-20 equals 20
-21 is greater than 20
-22 is greater than 20
-23 is greater than 20
-24 is greater than 20
-25 is greater than 20
-26 is greater than 20
-27 is greater than 20
-28 is greater than 20
-29 is greater than 20
-30 is greater than 20
-31 is greater than 20
-32 is greater than 20
-33 is greater than 20
-34 is greater than 20
-35 is greater than 20
-36 is greater than 20
-37 is greater than 20
-38 is greater than 20
-39 is greater than 20
-*******************
-
-
-*** Nested WHILEs ***
-Each array variable should be equal to the sum of its indices:
-${test00}[0] = 0
-${test00}[1] = 1
-${test00}[2] = 2
-${test01}[0] = 1
-${test01}[1] = 2
-${test01}[2] = 3
-${test02}[0] = 2
-${test02}[1] = 3
-${test02}[2] = 4
-${test10}[0] = 1
-${test10}[1] = 2
-${test10}[2] = 3
-${test11}[0] = 2
-${test11}[1] = 3
-${test11}[2] = 4
-${test12}[0] = 3
-${test12}[1] = 4
-${test12}[2] = 5
-${test20}[0] = 2
-${test20}[1] = 3
-${test20}[2] = 4
-${test21}[0] = 3
-${test21}[1] = 4
-${test21}[2] = 5
-${test22}[0] = 4
-${test22}[1] = 5
-${test22}[2] = 6
-*********************
-
-*** hash test... ***
-commented out...
-**************************
-
-*** Hash resizing test ***
-ba
-baa
-baaa
-baaaa
-baaaaa
-baaaaaa
-baaaaaaa
-baaaaaaaa
-baaaaaaaaa
-baaaaaaaaaa
-ba
-10
-baa
-9
-baaa
-8
-baaaa
-7
-baaaaa
-6
-baaaaaa
-5
-baaaaaaa
-4
-baaaaaaaa
-3
-baaaaaaaaa
-2
-baaaaaaaaaa
-1
-**************************
-
-
-*** break/continue test ***
-$i should go from 0 to 2
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=0
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=1
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=2
-***********************
-
-*** Nested file include test ***
-<html>
-This is Finish.phtml. This file is supposed to be included
-from regression_test.phtml. This is normal HTML.
-and this is PHP code, 2+2=4
-</html>
-********************************
-
-Tests completed.
-<html>
-<head>
-*** Testing assignments and variable aliasing: ***
-This should read "blah": blah
-This should read "this is nifty": this is nifty
-*************************************************
-
-*** Testing integer operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing real operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing if/elseif/else control ***
-
-This works
-this_still_works
-should_print
-
-
-*** Seriously nested if's test ***
-** spelling correction by kluzz **
-Only two lines of text should follow:
-this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0
-this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4
-3 loop iterations should follow:
-2 4
-3 4
-4 4
-**********************************
-
-*** C-style else-if's ***
-This should be displayed
-*************************
-
-*** WHILE tests ***
-0 is smaller than 20
-1 is smaller than 20
-2 is smaller than 20
-3 is smaller than 20
-4 is smaller than 20
-5 is smaller than 20
-6 is smaller than 20
-7 is smaller than 20
-8 is smaller than 20
-9 is smaller than 20
-10 is smaller than 20
-11 is smaller than 20
-12 is smaller than 20
-13 is smaller than 20
-14 is smaller than 20
-15 is smaller than 20
-16 is smaller than 20
-17 is smaller than 20
-18 is smaller than 20
-19 is smaller than 20
-20 equals 20
-21 is greater than 20
-22 is greater than 20
-23 is greater than 20
-24 is greater than 20
-25 is greater than 20
-26 is greater than 20
-27 is greater than 20
-28 is greater than 20
-29 is greater than 20
-30 is greater than 20
-31 is greater than 20
-32 is greater than 20
-33 is greater than 20
-34 is greater than 20
-35 is greater than 20
-36 is greater than 20
-37 is greater than 20
-38 is greater than 20
-39 is greater than 20
-*******************
-
-
-*** Nested WHILEs ***
-Each array variable should be equal to the sum of its indices:
-${test00}[0] = 0
-${test00}[1] = 1
-${test00}[2] = 2
-${test01}[0] = 1
-${test01}[1] = 2
-${test01}[2] = 3
-${test02}[0] = 2
-${test02}[1] = 3
-${test02}[2] = 4
-${test10}[0] = 1
-${test10}[1] = 2
-${test10}[2] = 3
-${test11}[0] = 2
-${test11}[1] = 3
-${test11}[2] = 4
-${test12}[0] = 3
-${test12}[1] = 4
-${test12}[2] = 5
-${test20}[0] = 2
-${test20}[1] = 3
-${test20}[2] = 4
-${test21}[0] = 3
-${test21}[1] = 4
-${test21}[2] = 5
-${test22}[0] = 4
-${test22}[1] = 5
-${test22}[2] = 6
-*********************
-
-*** hash test... ***
-commented out...
-**************************
-
-*** Hash resizing test ***
-ba
-baa
-baaa
-baaaa
-baaaaa
-baaaaaa
-baaaaaaa
-baaaaaaaa
-baaaaaaaaa
-baaaaaaaaaa
-ba
-10
-baa
-9
-baaa
-8
-baaaa
-7
-baaaaa
-6
-baaaaaa
-5
-baaaaaaa
-4
-baaaaaaaa
-3
-baaaaaaaaa
-2
-baaaaaaaaaa
-1
-**************************
-
-
-*** break/continue test ***
-$i should go from 0 to 2
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=0
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=1
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=2
-***********************
-
-*** Nested file include test ***
-<html>
-This is Finish.phtml. This file is supposed to be included
-from regression_test.phtml. This is normal HTML.
-and this is PHP code, 2+2=4
-</html>
-********************************
-
-Tests completed.
-<html>
-<head>
-*** Testing assignments and variable aliasing: ***
-This should read "blah": blah
-This should read "this is nifty": this is nifty
-*************************************************
-
-*** Testing integer operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing real operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing if/elseif/else control ***
-
-This works
-this_still_works
-should_print
-
-
-*** Seriously nested if's test ***
-** spelling correction by kluzz **
-Only two lines of text should follow:
-this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0
-this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4
-3 loop iterations should follow:
-2 4
-3 4
-4 4
-**********************************
-
-*** C-style else-if's ***
-This should be displayed
-*************************
-
-*** WHILE tests ***
-0 is smaller than 20
-1 is smaller than 20
-2 is smaller than 20
-3 is smaller than 20
-4 is smaller than 20
-5 is smaller than 20
-6 is smaller than 20
-7 is smaller than 20
-8 is smaller than 20
-9 is smaller than 20
-10 is smaller than 20
-11 is smaller than 20
-12 is smaller than 20
-13 is smaller than 20
-14 is smaller than 20
-15 is smaller than 20
-16 is smaller than 20
-17 is smaller than 20
-18 is smaller than 20
-19 is smaller than 20
-20 equals 20
-21 is greater than 20
-22 is greater than 20
-23 is greater than 20
-24 is greater than 20
-25 is greater than 20
-26 is greater than 20
-27 is greater than 20
-28 is greater than 20
-29 is greater than 20
-30 is greater than 20
-31 is greater than 20
-32 is greater than 20
-33 is greater than 20
-34 is greater than 20
-35 is greater than 20
-36 is greater than 20
-37 is greater than 20
-38 is greater than 20
-39 is greater than 20
-*******************
-
-
-*** Nested WHILEs ***
-Each array variable should be equal to the sum of its indices:
-${test00}[0] = 0
-${test00}[1] = 1
-${test00}[2] = 2
-${test01}[0] = 1
-${test01}[1] = 2
-${test01}[2] = 3
-${test02}[0] = 2
-${test02}[1] = 3
-${test02}[2] = 4
-${test10}[0] = 1
-${test10}[1] = 2
-${test10}[2] = 3
-${test11}[0] = 2
-${test11}[1] = 3
-${test11}[2] = 4
-${test12}[0] = 3
-${test12}[1] = 4
-${test12}[2] = 5
-${test20}[0] = 2
-${test20}[1] = 3
-${test20}[2] = 4
-${test21}[0] = 3
-${test21}[1] = 4
-${test21}[2] = 5
-${test22}[0] = 4
-${test22}[1] = 5
-${test22}[2] = 6
-*********************
-
-*** hash test... ***
-commented out...
-**************************
-
-*** Hash resizing test ***
-ba
-baa
-baaa
-baaaa
-baaaaa
-baaaaaa
-baaaaaaa
-baaaaaaaa
-baaaaaaaaa
-baaaaaaaaaa
-ba
-10
-baa
-9
-baaa
-8
-baaaa
-7
-baaaaa
-6
-baaaaaa
-5
-baaaaaaa
-4
-baaaaaaaa
-3
-baaaaaaaaa
-2
-baaaaaaaaaa
-1
-**************************
-
-
-*** break/continue test ***
-$i should go from 0 to 2
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=0
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=1
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=2
-***********************
-
-*** Nested file include test ***
-<html>
-This is Finish.phtml. This file is supposed to be included
-from regression_test.phtml. This is normal HTML.
-and this is PHP code, 2+2=4
-</html>
-********************************
-
-Tests completed.
-<html>
-<head>
-*** Testing assignments and variable aliasing: ***
-This should read "blah": blah
-This should read "this is nifty": this is nifty
-*************************************************
-
-*** Testing integer operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing real operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing if/elseif/else control ***
-
-This works
-this_still_works
-should_print
-
-
-*** Seriously nested if's test ***
-** spelling correction by kluzz **
-Only two lines of text should follow:
-this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0
-this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4
-3 loop iterations should follow:
-2 4
-3 4
-4 4
-**********************************
-
-*** C-style else-if's ***
-This should be displayed
-*************************
-
-*** WHILE tests ***
-0 is smaller than 20
-1 is smaller than 20
-2 is smaller than 20
-3 is smaller than 20
-4 is smaller than 20
-5 is smaller than 20
-6 is smaller than 20
-7 is smaller than 20
-8 is smaller than 20
-9 is smaller than 20
-10 is smaller than 20
-11 is smaller than 20
-12 is smaller than 20
-13 is smaller than 20
-14 is smaller than 20
-15 is smaller than 20
-16 is smaller than 20
-17 is smaller than 20
-18 is smaller than 20
-19 is smaller than 20
-20 equals 20
-21 is greater than 20
-22 is greater than 20
-23 is greater than 20
-24 is greater than 20
-25 is greater than 20
-26 is greater than 20
-27 is greater than 20
-28 is greater than 20
-29 is greater than 20
-30 is greater than 20
-31 is greater than 20
-32 is greater than 20
-33 is greater than 20
-34 is greater than 20
-35 is greater than 20
-36 is greater than 20
-37 is greater than 20
-38 is greater than 20
-39 is greater than 20
-*******************
-
-
-*** Nested WHILEs ***
-Each array variable should be equal to the sum of its indices:
-${test00}[0] = 0
-${test00}[1] = 1
-${test00}[2] = 2
-${test01}[0] = 1
-${test01}[1] = 2
-${test01}[2] = 3
-${test02}[0] = 2
-${test02}[1] = 3
-${test02}[2] = 4
-${test10}[0] = 1
-${test10}[1] = 2
-${test10}[2] = 3
-${test11}[0] = 2
-${test11}[1] = 3
-${test11}[2] = 4
-${test12}[0] = 3
-${test12}[1] = 4
-${test12}[2] = 5
-${test20}[0] = 2
-${test20}[1] = 3
-${test20}[2] = 4
-${test21}[0] = 3
-${test21}[1] = 4
-${test21}[2] = 5
-${test22}[0] = 4
-${test22}[1] = 5
-${test22}[2] = 6
-*********************
-
-*** hash test... ***
-commented out...
-**************************
-
-*** Hash resizing test ***
-ba
-baa
-baaa
-baaaa
-baaaaa
-baaaaaa
-baaaaaaa
-baaaaaaaa
-baaaaaaaaa
-baaaaaaaaaa
-ba
-10
-baa
-9
-baaa
-8
-baaaa
-7
-baaaaa
-6
-baaaaaa
-5
-baaaaaaa
-4
-baaaaaaaa
-3
-baaaaaaaaa
-2
-baaaaaaaaaa
-1
-**************************
-
-
-*** break/continue test ***
-$i should go from 0 to 2
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=0
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=1
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=2
-***********************
-
-*** Nested file include test ***
-<html>
-This is Finish.phtml. This file is supposed to be included
-from regression_test.phtml. This is normal HTML.
-and this is PHP code, 2+2=4
-</html>
-********************************
-
-Tests completed.
-<html>
-<head>
-*** Testing assignments and variable aliasing: ***
-This should read "blah": blah
-This should read "this is nifty": this is nifty
-*************************************************
-
-*** Testing integer operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing real operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing if/elseif/else control ***
-
-This works
-this_still_works
-should_print
-
-
-*** Seriously nested if's test ***
-** spelling correction by kluzz **
-Only two lines of text should follow:
-this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0
-this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4
-3 loop iterations should follow:
-2 4
-3 4
-4 4
-**********************************
-
-*** C-style else-if's ***
-This should be displayed
-*************************
-
-*** WHILE tests ***
-0 is smaller than 20
-1 is smaller than 20
-2 is smaller than 20
-3 is smaller than 20
-4 is smaller than 20
-5 is smaller than 20
-6 is smaller than 20
-7 is smaller than 20
-8 is smaller than 20
-9 is smaller than 20
-10 is smaller than 20
-11 is smaller than 20
-12 is smaller than 20
-13 is smaller than 20
-14 is smaller than 20
-15 is smaller than 20
-16 is smaller than 20
-17 is smaller than 20
-18 is smaller than 20
-19 is smaller than 20
-20 equals 20
-21 is greater than 20
-22 is greater than 20
-23 is greater than 20
-24 is greater than 20
-25 is greater than 20
-26 is greater than 20
-27 is greater than 20
-28 is greater than 20
-29 is greater than 20
-30 is greater than 20
-31 is greater than 20
-32 is greater than 20
-33 is greater than 20
-34 is greater than 20
-35 is greater than 20
-36 is greater than 20
-37 is greater than 20
-38 is greater than 20
-39 is greater than 20
-*******************
-
-
-*** Nested WHILEs ***
-Each array variable should be equal to the sum of its indices:
-${test00}[0] = 0
-${test00}[1] = 1
-${test00}[2] = 2
-${test01}[0] = 1
-${test01}[1] = 2
-${test01}[2] = 3
-${test02}[0] = 2
-${test02}[1] = 3
-${test02}[2] = 4
-${test10}[0] = 1
-${test10}[1] = 2
-${test10}[2] = 3
-${test11}[0] = 2
-${test11}[1] = 3
-${test11}[2] = 4
-${test12}[0] = 3
-${test12}[1] = 4
-${test12}[2] = 5
-${test20}[0] = 2
-${test20}[1] = 3
-${test20}[2] = 4
-${test21}[0] = 3
-${test21}[1] = 4
-${test21}[2] = 5
-${test22}[0] = 4
-${test22}[1] = 5
-${test22}[2] = 6
-*********************
-
-*** hash test... ***
-commented out...
-**************************
-
-*** Hash resizing test ***
-ba
-baa
-baaa
-baaaa
-baaaaa
-baaaaaa
-baaaaaaa
-baaaaaaaa
-baaaaaaaaa
-baaaaaaaaaa
-ba
-10
-baa
-9
-baaa
-8
-baaaa
-7
-baaaaa
-6
-baaaaaa
-5
-baaaaaaa
-4
-baaaaaaaa
-3
-baaaaaaaaa
-2
-baaaaaaaaaa
-1
-**************************
-
-
-*** break/continue test ***
-$i should go from 0 to 2
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=0
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=1
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=2
-***********************
-
-*** Nested file include test ***
-<html>
-This is Finish.phtml. This file is supposed to be included
-from regression_test.phtml. This is normal HTML.
-and this is PHP code, 2+2=4
-</html>
-********************************
-
-Tests completed.
-<html>
-<head>
-*** Testing assignments and variable aliasing: ***
-This should read "blah": blah
-This should read "this is nifty": this is nifty
-*************************************************
-
-*** Testing integer operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing real operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing if/elseif/else control ***
-
-This works
-this_still_works
-should_print
-
-
-*** Seriously nested if's test ***
-** spelling correction by kluzz **
-Only two lines of text should follow:
-this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0
-this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4
-3 loop iterations should follow:
-2 4
-3 4
-4 4
-**********************************
-
-*** C-style else-if's ***
-This should be displayed
-*************************
-
-*** WHILE tests ***
-0 is smaller than 20
-1 is smaller than 20
-2 is smaller than 20
-3 is smaller than 20
-4 is smaller than 20
-5 is smaller than 20
-6 is smaller than 20
-7 is smaller than 20
-8 is smaller than 20
-9 is smaller than 20
-10 is smaller than 20
-11 is smaller than 20
-12 is smaller than 20
-13 is smaller than 20
-14 is smaller than 20
-15 is smaller than 20
-16 is smaller than 20
-17 is smaller than 20
-18 is smaller than 20
-19 is smaller than 20
-20 equals 20
-21 is greater than 20
-22 is greater than 20
-23 is greater than 20
-24 is greater than 20
-25 is greater than 20
-26 is greater than 20
-27 is greater than 20
-28 is greater than 20
-29 is greater than 20
-30 is greater than 20
-31 is greater than 20
-32 is greater than 20
-33 is greater than 20
-34 is greater than 20
-35 is greater than 20
-36 is greater than 20
-37 is greater than 20
-38 is greater than 20
-39 is greater than 20
-*******************
-
-
-*** Nested WHILEs ***
-Each array variable should be equal to the sum of its indices:
-${test00}[0] = 0
-${test00}[1] = 1
-${test00}[2] = 2
-${test01}[0] = 1
-${test01}[1] = 2
-${test01}[2] = 3
-${test02}[0] = 2
-${test02}[1] = 3
-${test02}[2] = 4
-${test10}[0] = 1
-${test10}[1] = 2
-${test10}[2] = 3
-${test11}[0] = 2
-${test11}[1] = 3
-${test11}[2] = 4
-${test12}[0] = 3
-${test12}[1] = 4
-${test12}[2] = 5
-${test20}[0] = 2
-${test20}[1] = 3
-${test20}[2] = 4
-${test21}[0] = 3
-${test21}[1] = 4
-${test21}[2] = 5
-${test22}[0] = 4
-${test22}[1] = 5
-${test22}[2] = 6
-*********************
-
-*** hash test... ***
-commented out...
-**************************
-
-*** Hash resizing test ***
-ba
-baa
-baaa
-baaaa
-baaaaa
-baaaaaa
-baaaaaaa
-baaaaaaaa
-baaaaaaaaa
-baaaaaaaaaa
-ba
-10
-baa
-9
-baaa
-8
-baaaa
-7
-baaaaa
-6
-baaaaaa
-5
-baaaaaaa
-4
-baaaaaaaa
-3
-baaaaaaaaa
-2
-baaaaaaaaaa
-1
-**************************
-
-
-*** break/continue test ***
-$i should go from 0 to 2
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=0
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=1
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=2
-***********************
-
-*** Nested file include test ***
-<html>
-This is Finish.phtml. This file is supposed to be included
-from regression_test.phtml. This is normal HTML.
-and this is PHP code, 2+2=4
-</html>
-********************************
-
-Tests completed.
-<html>
-<head>
-*** Testing assignments and variable aliasing: ***
-This should read "blah": blah
-This should read "this is nifty": this is nifty
-*************************************************
-
-*** Testing integer operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing real operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing if/elseif/else control ***
-
-This works
-this_still_works
-should_print
-
-
-*** Seriously nested if's test ***
-** spelling correction by kluzz **
-Only two lines of text should follow:
-this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0
-this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4
-3 loop iterations should follow:
-2 4
-3 4
-4 4
-**********************************
-
-*** C-style else-if's ***
-This should be displayed
-*************************
-
-*** WHILE tests ***
-0 is smaller than 20
-1 is smaller than 20
-2 is smaller than 20
-3 is smaller than 20
-4 is smaller than 20
-5 is smaller than 20
-6 is smaller than 20
-7 is smaller than 20
-8 is smaller than 20
-9 is smaller than 20
-10 is smaller than 20
-11 is smaller than 20
-12 is smaller than 20
-13 is smaller than 20
-14 is smaller than 20
-15 is smaller than 20
-16 is smaller than 20
-17 is smaller than 20
-18 is smaller than 20
-19 is smaller than 20
-20 equals 20
-21 is greater than 20
-22 is greater than 20
-23 is greater than 20
-24 is greater than 20
-25 is greater than 20
-26 is greater than 20
-27 is greater than 20
-28 is greater than 20
-29 is greater than 20
-30 is greater than 20
-31 is greater than 20
-32 is greater than 20
-33 is greater than 20
-34 is greater than 20
-35 is greater than 20
-36 is greater than 20
-37 is greater than 20
-38 is greater than 20
-39 is greater than 20
-*******************
-
-
-*** Nested WHILEs ***
-Each array variable should be equal to the sum of its indices:
-${test00}[0] = 0
-${test00}[1] = 1
-${test00}[2] = 2
-${test01}[0] = 1
-${test01}[1] = 2
-${test01}[2] = 3
-${test02}[0] = 2
-${test02}[1] = 3
-${test02}[2] = 4
-${test10}[0] = 1
-${test10}[1] = 2
-${test10}[2] = 3
-${test11}[0] = 2
-${test11}[1] = 3
-${test11}[2] = 4
-${test12}[0] = 3
-${test12}[1] = 4
-${test12}[2] = 5
-${test20}[0] = 2
-${test20}[1] = 3
-${test20}[2] = 4
-${test21}[0] = 3
-${test21}[1] = 4
-${test21}[2] = 5
-${test22}[0] = 4
-${test22}[1] = 5
-${test22}[2] = 6
-*********************
-
-*** hash test... ***
-commented out...
-**************************
-
-*** Hash resizing test ***
-ba
-baa
-baaa
-baaaa
-baaaaa
-baaaaaa
-baaaaaaa
-baaaaaaaa
-baaaaaaaaa
-baaaaaaaaaa
-ba
-10
-baa
-9
-baaa
-8
-baaaa
-7
-baaaaa
-6
-baaaaaa
-5
-baaaaaaa
-4
-baaaaaaaa
-3
-baaaaaaaaa
-2
-baaaaaaaaaa
-1
-**************************
-
-
-*** break/continue test ***
-$i should go from 0 to 2
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=0
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=1
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=2
-***********************
-
-*** Nested file include test ***
-<html>
-This is Finish.phtml. This file is supposed to be included
-from regression_test.phtml. This is normal HTML.
-and this is PHP code, 2+2=4
-</html>
-********************************
-
-Tests completed.
-<html>
-<head>
-*** Testing assignments and variable aliasing: ***
-This should read "blah": blah
-This should read "this is nifty": this is nifty
-*************************************************
-
-*** Testing integer operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing real operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing if/elseif/else control ***
-
-This works
-this_still_works
-should_print
-
-
-*** Seriously nested if's test ***
-** spelling correction by kluzz **
-Only two lines of text should follow:
-this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0
-this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4
-3 loop iterations should follow:
-2 4
-3 4
-4 4
-**********************************
-
-*** C-style else-if's ***
-This should be displayed
-*************************
-
-*** WHILE tests ***
-0 is smaller than 20
-1 is smaller than 20
-2 is smaller than 20
-3 is smaller than 20
-4 is smaller than 20
-5 is smaller than 20
-6 is smaller than 20
-7 is smaller than 20
-8 is smaller than 20
-9 is smaller than 20
-10 is smaller than 20
-11 is smaller than 20
-12 is smaller than 20
-13 is smaller than 20
-14 is smaller than 20
-15 is smaller than 20
-16 is smaller than 20
-17 is smaller than 20
-18 is smaller than 20
-19 is smaller than 20
-20 equals 20
-21 is greater than 20
-22 is greater than 20
-23 is greater than 20
-24 is greater than 20
-25 is greater than 20
-26 is greater than 20
-27 is greater than 20
-28 is greater than 20
-29 is greater than 20
-30 is greater than 20
-31 is greater than 20
-32 is greater than 20
-33 is greater than 20
-34 is greater than 20
-35 is greater than 20
-36 is greater than 20
-37 is greater than 20
-38 is greater than 20
-39 is greater than 20
-*******************
-
-
-*** Nested WHILEs ***
-Each array variable should be equal to the sum of its indices:
-${test00}[0] = 0
-${test00}[1] = 1
-${test00}[2] = 2
-${test01}[0] = 1
-${test01}[1] = 2
-${test01}[2] = 3
-${test02}[0] = 2
-${test02}[1] = 3
-${test02}[2] = 4
-${test10}[0] = 1
-${test10}[1] = 2
-${test10}[2] = 3
-${test11}[0] = 2
-${test11}[1] = 3
-${test11}[2] = 4
-${test12}[0] = 3
-${test12}[1] = 4
-${test12}[2] = 5
-${test20}[0] = 2
-${test20}[1] = 3
-${test20}[2] = 4
-${test21}[0] = 3
-${test21}[1] = 4
-${test21}[2] = 5
-${test22}[0] = 4
-${test22}[1] = 5
-${test22}[2] = 6
-*********************
-
-*** hash test... ***
-commented out...
-**************************
-
-*** Hash resizing test ***
-ba
-baa
-baaa
-baaaa
-baaaaa
-baaaaaa
-baaaaaaa
-baaaaaaaa
-baaaaaaaaa
-baaaaaaaaaa
-ba
-10
-baa
-9
-baaa
-8
-baaaa
-7
-baaaaa
-6
-baaaaaa
-5
-baaaaaaa
-4
-baaaaaaaa
-3
-baaaaaaaaa
-2
-baaaaaaaaaa
-1
-**************************
-
-
-*** break/continue test ***
-$i should go from 0 to 2
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=0
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=1
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=2
-***********************
-
-*** Nested file include test ***
-<html>
-This is Finish.phtml. This file is supposed to be included
-from regression_test.phtml. This is normal HTML.
-and this is PHP code, 2+2=4
-</html>
-********************************
-
-Tests completed.
-<html>
-<head>
-*** Testing assignments and variable aliasing: ***
-This should read "blah": blah
-This should read "this is nifty": this is nifty
-*************************************************
-
-*** Testing integer operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing real operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing if/elseif/else control ***
-
-This works
-this_still_works
-should_print
-
-
-*** Seriously nested if's test ***
-** spelling correction by kluzz **
-Only two lines of text should follow:
-this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0
-this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4
-3 loop iterations should follow:
-2 4
-3 4
-4 4
-**********************************
-
-*** C-style else-if's ***
-This should be displayed
-*************************
-
-*** WHILE tests ***
-0 is smaller than 20
-1 is smaller than 20
-2 is smaller than 20
-3 is smaller than 20
-4 is smaller than 20
-5 is smaller than 20
-6 is smaller than 20
-7 is smaller than 20
-8 is smaller than 20
-9 is smaller than 20
-10 is smaller than 20
-11 is smaller than 20
-12 is smaller than 20
-13 is smaller than 20
-14 is smaller than 20
-15 is smaller than 20
-16 is smaller than 20
-17 is smaller than 20
-18 is smaller than 20
-19 is smaller than 20
-20 equals 20
-21 is greater than 20
-22 is greater than 20
-23 is greater than 20
-24 is greater than 20
-25 is greater than 20
-26 is greater than 20
-27 is greater than 20
-28 is greater than 20
-29 is greater than 20
-30 is greater than 20
-31 is greater than 20
-32 is greater than 20
-33 is greater than 20
-34 is greater than 20
-35 is greater than 20
-36 is greater than 20
-37 is greater than 20
-38 is greater than 20
-39 is greater than 20
-*******************
-
-
-*** Nested WHILEs ***
-Each array variable should be equal to the sum of its indices:
-${test00}[0] = 0
-${test00}[1] = 1
-${test00}[2] = 2
-${test01}[0] = 1
-${test01}[1] = 2
-${test01}[2] = 3
-${test02}[0] = 2
-${test02}[1] = 3
-${test02}[2] = 4
-${test10}[0] = 1
-${test10}[1] = 2
-${test10}[2] = 3
-${test11}[0] = 2
-${test11}[1] = 3
-${test11}[2] = 4
-${test12}[0] = 3
-${test12}[1] = 4
-${test12}[2] = 5
-${test20}[0] = 2
-${test20}[1] = 3
-${test20}[2] = 4
-${test21}[0] = 3
-${test21}[1] = 4
-${test21}[2] = 5
-${test22}[0] = 4
-${test22}[1] = 5
-${test22}[2] = 6
-*********************
-
-*** hash test... ***
-commented out...
-**************************
-
-*** Hash resizing test ***
-ba
-baa
-baaa
-baaaa
-baaaaa
-baaaaaa
-baaaaaaa
-baaaaaaaa
-baaaaaaaaa
-baaaaaaaaaa
-ba
-10
-baa
-9
-baaa
-8
-baaaa
-7
-baaaaa
-6
-baaaaaa
-5
-baaaaaaa
-4
-baaaaaaaa
-3
-baaaaaaaaa
-2
-baaaaaaaaaa
-1
-**************************
-
-
-*** break/continue test ***
-$i should go from 0 to 2
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=0
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=1
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=2
-***********************
-
-*** Nested file include test ***
-<html>
-This is Finish.phtml. This file is supposed to be included
-from regression_test.phtml. This is normal HTML.
-and this is PHP code, 2+2=4
-</html>
-********************************
-
-Tests completed.
-<html>
-<head>
-*** Testing assignments and variable aliasing: ***
-This should read "blah": blah
-This should read "this is nifty": this is nifty
-*************************************************
-
-*** Testing integer operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing real operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing if/elseif/else control ***
-
-This works
-this_still_works
-should_print
-
-
-*** Seriously nested if's test ***
-** spelling correction by kluzz **
-Only two lines of text should follow:
-this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0
-this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4
-3 loop iterations should follow:
-2 4
-3 4
-4 4
-**********************************
-
-*** C-style else-if's ***
-This should be displayed
-*************************
-
-*** WHILE tests ***
-0 is smaller than 20
-1 is smaller than 20
-2 is smaller than 20
-3 is smaller than 20
-4 is smaller than 20
-5 is smaller than 20
-6 is smaller than 20
-7 is smaller than 20
-8 is smaller than 20
-9 is smaller than 20
-10 is smaller than 20
-11 is smaller than 20
-12 is smaller than 20
-13 is smaller than 20
-14 is smaller than 20
-15 is smaller than 20
-16 is smaller than 20
-17 is smaller than 20
-18 is smaller than 20
-19 is smaller than 20
-20 equals 20
-21 is greater than 20
-22 is greater than 20
-23 is greater than 20
-24 is greater than 20
-25 is greater than 20
-26 is greater than 20
-27 is greater than 20
-28 is greater than 20
-29 is greater than 20
-30 is greater than 20
-31 is greater than 20
-32 is greater than 20
-33 is greater than 20
-34 is greater than 20
-35 is greater than 20
-36 is greater than 20
-37 is greater than 20
-38 is greater than 20
-39 is greater than 20
-*******************
-
-
-*** Nested WHILEs ***
-Each array variable should be equal to the sum of its indices:
-${test00}[0] = 0
-${test00}[1] = 1
-${test00}[2] = 2
-${test01}[0] = 1
-${test01}[1] = 2
-${test01}[2] = 3
-${test02}[0] = 2
-${test02}[1] = 3
-${test02}[2] = 4
-${test10}[0] = 1
-${test10}[1] = 2
-${test10}[2] = 3
-${test11}[0] = 2
-${test11}[1] = 3
-${test11}[2] = 4
-${test12}[0] = 3
-${test12}[1] = 4
-${test12}[2] = 5
-${test20}[0] = 2
-${test20}[1] = 3
-${test20}[2] = 4
-${test21}[0] = 3
-${test21}[1] = 4
-${test21}[2] = 5
-${test22}[0] = 4
-${test22}[1] = 5
-${test22}[2] = 6
-*********************
-
-*** hash test... ***
-commented out...
-**************************
-
-*** Hash resizing test ***
-ba
-baa
-baaa
-baaaa
-baaaaa
-baaaaaa
-baaaaaaa
-baaaaaaaa
-baaaaaaaaa
-baaaaaaaaaa
-ba
-10
-baa
-9
-baaa
-8
-baaaa
-7
-baaaaa
-6
-baaaaaa
-5
-baaaaaaa
-4
-baaaaaaaa
-3
-baaaaaaaaa
-2
-baaaaaaaaaa
-1
-**************************
-
-
-*** break/continue test ***
-$i should go from 0 to 2
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=0
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=1
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=2
-***********************
-
-*** Nested file include test ***
-<html>
-This is Finish.phtml. This file is supposed to be included
-from regression_test.phtml. This is normal HTML.
-and this is PHP code, 2+2=4
-</html>
-********************************
-
-Tests completed.
-<html>
-<head>
-*** Testing assignments and variable aliasing: ***
-This should read "blah": blah
-This should read "this is nifty": this is nifty
-*************************************************
-
-*** Testing integer operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing real operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing if/elseif/else control ***
-
-This works
-this_still_works
-should_print
-
-
-*** Seriously nested if's test ***
-** spelling correction by kluzz **
-Only two lines of text should follow:
-this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0
-this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4
-3 loop iterations should follow:
-2 4
-3 4
-4 4
-**********************************
-
-*** C-style else-if's ***
-This should be displayed
-*************************
-
-*** WHILE tests ***
-0 is smaller than 20
-1 is smaller than 20
-2 is smaller than 20
-3 is smaller than 20
-4 is smaller than 20
-5 is smaller than 20
-6 is smaller than 20
-7 is smaller than 20
-8 is smaller than 20
-9 is smaller than 20
-10 is smaller than 20
-11 is smaller than 20
-12 is smaller than 20
-13 is smaller than 20
-14 is smaller than 20
-15 is smaller than 20
-16 is smaller than 20
-17 is smaller than 20
-18 is smaller than 20
-19 is smaller than 20
-20 equals 20
-21 is greater than 20
-22 is greater than 20
-23 is greater than 20
-24 is greater than 20
-25 is greater than 20
-26 is greater than 20
-27 is greater than 20
-28 is greater than 20
-29 is greater than 20
-30 is greater than 20
-31 is greater than 20
-32 is greater than 20
-33 is greater than 20
-34 is greater than 20
-35 is greater than 20
-36 is greater than 20
-37 is greater than 20
-38 is greater than 20
-39 is greater than 20
-*******************
-
-
-*** Nested WHILEs ***
-Each array variable should be equal to the sum of its indices:
-${test00}[0] = 0
-${test00}[1] = 1
-${test00}[2] = 2
-${test01}[0] = 1
-${test01}[1] = 2
-${test01}[2] = 3
-${test02}[0] = 2
-${test02}[1] = 3
-${test02}[2] = 4
-${test10}[0] = 1
-${test10}[1] = 2
-${test10}[2] = 3
-${test11}[0] = 2
-${test11}[1] = 3
-${test11}[2] = 4
-${test12}[0] = 3
-${test12}[1] = 4
-${test12}[2] = 5
-${test20}[0] = 2
-${test20}[1] = 3
-${test20}[2] = 4
-${test21}[0] = 3
-${test21}[1] = 4
-${test21}[2] = 5
-${test22}[0] = 4
-${test22}[1] = 5
-${test22}[2] = 6
-*********************
-
-*** hash test... ***
-commented out...
-**************************
-
-*** Hash resizing test ***
-ba
-baa
-baaa
-baaaa
-baaaaa
-baaaaaa
-baaaaaaa
-baaaaaaaa
-baaaaaaaaa
-baaaaaaaaaa
-ba
-10
-baa
-9
-baaa
-8
-baaaa
-7
-baaaaa
-6
-baaaaaa
-5
-baaaaaaa
-4
-baaaaaaaa
-3
-baaaaaaaaa
-2
-baaaaaaaaaa
-1
-**************************
-
-
-*** break/continue test ***
-$i should go from 0 to 2
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=0
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=1
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=2
-***********************
-
-*** Nested file include test ***
-<html>
-This is Finish.phtml. This file is supposed to be included
-from regression_test.phtml. This is normal HTML.
-and this is PHP code, 2+2=4
-</html>
-********************************
-
-Tests completed.
-<html>
-<head>
-*** Testing assignments and variable aliasing: ***
-This should read "blah": blah
-This should read "this is nifty": this is nifty
-*************************************************
-
-*** Testing integer operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing real operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing if/elseif/else control ***
-
-This works
-this_still_works
-should_print
-
-
-*** Seriously nested if's test ***
-** spelling correction by kluzz **
-Only two lines of text should follow:
-this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0
-this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4
-3 loop iterations should follow:
-2 4
-3 4
-4 4
-**********************************
-
-*** C-style else-if's ***
-This should be displayed
-*************************
-
-*** WHILE tests ***
-0 is smaller than 20
-1 is smaller than 20
-2 is smaller than 20
-3 is smaller than 20
-4 is smaller than 20
-5 is smaller than 20
-6 is smaller than 20
-7 is smaller than 20
-8 is smaller than 20
-9 is smaller than 20
-10 is smaller than 20
-11 is smaller than 20
-12 is smaller than 20
-13 is smaller than 20
-14 is smaller than 20
-15 is smaller than 20
-16 is smaller than 20
-17 is smaller than 20
-18 is smaller than 20
-19 is smaller than 20
-20 equals 20
-21 is greater than 20
-22 is greater than 20
-23 is greater than 20
-24 is greater than 20
-25 is greater than 20
-26 is greater than 20
-27 is greater than 20
-28 is greater than 20
-29 is greater than 20
-30 is greater than 20
-31 is greater than 20
-32 is greater than 20
-33 is greater than 20
-34 is greater than 20
-35 is greater than 20
-36 is greater than 20
-37 is greater than 20
-38 is greater than 20
-39 is greater than 20
-*******************
-
-
-*** Nested WHILEs ***
-Each array variable should be equal to the sum of its indices:
-${test00}[0] = 0
-${test00}[1] = 1
-${test00}[2] = 2
-${test01}[0] = 1
-${test01}[1] = 2
-${test01}[2] = 3
-${test02}[0] = 2
-${test02}[1] = 3
-${test02}[2] = 4
-${test10}[0] = 1
-${test10}[1] = 2
-${test10}[2] = 3
-${test11}[0] = 2
-${test11}[1] = 3
-${test11}[2] = 4
-${test12}[0] = 3
-${test12}[1] = 4
-${test12}[2] = 5
-${test20}[0] = 2
-${test20}[1] = 3
-${test20}[2] = 4
-${test21}[0] = 3
-${test21}[1] = 4
-${test21}[2] = 5
-${test22}[0] = 4
-${test22}[1] = 5
-${test22}[2] = 6
-*********************
-
-*** hash test... ***
-commented out...
-**************************
-
-*** Hash resizing test ***
-ba
-baa
-baaa
-baaaa
-baaaaa
-baaaaaa
-baaaaaaa
-baaaaaaaa
-baaaaaaaaa
-baaaaaaaaaa
-ba
-10
-baa
-9
-baaa
-8
-baaaa
-7
-baaaaa
-6
-baaaaaa
-5
-baaaaaaa
-4
-baaaaaaaa
-3
-baaaaaaaaa
-2
-baaaaaaaaaa
-1
-**************************
-
-
-*** break/continue test ***
-$i should go from 0 to 2
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=0
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=1
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=2
-***********************
-
-*** Nested file include test ***
-<html>
-This is Finish.phtml. This file is supposed to be included
-from regression_test.phtml. This is normal HTML.
-and this is PHP code, 2+2=4
-</html>
-********************************
-
-Tests completed.
-<html>
-<head>
-*** Testing assignments and variable aliasing: ***
-This should read "blah": blah
-This should read "this is nifty": this is nifty
-*************************************************
-
-*** Testing integer operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing real operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing if/elseif/else control ***
-
-This works
-this_still_works
-should_print
-
-
-*** Seriously nested if's test ***
-** spelling correction by kluzz **
-Only two lines of text should follow:
-this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0
-this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4
-3 loop iterations should follow:
-2 4
-3 4
-4 4
-**********************************
-
-*** C-style else-if's ***
-This should be displayed
-*************************
-
-*** WHILE tests ***
-0 is smaller than 20
-1 is smaller than 20
-2 is smaller than 20
-3 is smaller than 20
-4 is smaller than 20
-5 is smaller than 20
-6 is smaller than 20
-7 is smaller than 20
-8 is smaller than 20
-9 is smaller than 20
-10 is smaller than 20
-11 is smaller than 20
-12 is smaller than 20
-13 is smaller than 20
-14 is smaller than 20
-15 is smaller than 20
-16 is smaller than 20
-17 is smaller than 20
-18 is smaller than 20
-19 is smaller than 20
-20 equals 20
-21 is greater than 20
-22 is greater than 20
-23 is greater than 20
-24 is greater than 20
-25 is greater than 20
-26 is greater than 20
-27 is greater than 20
-28 is greater than 20
-29 is greater than 20
-30 is greater than 20
-31 is greater than 20
-32 is greater than 20
-33 is greater than 20
-34 is greater than 20
-35 is greater than 20
-36 is greater than 20
-37 is greater than 20
-38 is greater than 20
-39 is greater than 20
-*******************
-
-
-*** Nested WHILEs ***
-Each array variable should be equal to the sum of its indices:
-${test00}[0] = 0
-${test00}[1] = 1
-${test00}[2] = 2
-${test01}[0] = 1
-${test01}[1] = 2
-${test01}[2] = 3
-${test02}[0] = 2
-${test02}[1] = 3
-${test02}[2] = 4
-${test10}[0] = 1
-${test10}[1] = 2
-${test10}[2] = 3
-${test11}[0] = 2
-${test11}[1] = 3
-${test11}[2] = 4
-${test12}[0] = 3
-${test12}[1] = 4
-${test12}[2] = 5
-${test20}[0] = 2
-${test20}[1] = 3
-${test20}[2] = 4
-${test21}[0] = 3
-${test21}[1] = 4
-${test21}[2] = 5
-${test22}[0] = 4
-${test22}[1] = 5
-${test22}[2] = 6
-*********************
-
-*** hash test... ***
-commented out...
-**************************
-
-*** Hash resizing test ***
-ba
-baa
-baaa
-baaaa
-baaaaa
-baaaaaa
-baaaaaaa
-baaaaaaaa
-baaaaaaaaa
-baaaaaaaaaa
-ba
-10
-baa
-9
-baaa
-8
-baaaa
-7
-baaaaa
-6
-baaaaaa
-5
-baaaaaaa
-4
-baaaaaaaa
-3
-baaaaaaaaa
-2
-baaaaaaaaaa
-1
-**************************
-
-
-*** break/continue test ***
-$i should go from 0 to 2
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=0
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=1
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=2
-***********************
-
-*** Nested file include test ***
-<html>
-This is Finish.phtml. This file is supposed to be included
-from regression_test.phtml. This is normal HTML.
-and this is PHP code, 2+2=4
-</html>
-********************************
-
-Tests completed.
-<html>
-<head>
-*** Testing assignments and variable aliasing: ***
-This should read "blah": blah
-This should read "this is nifty": this is nifty
-*************************************************
-
-*** Testing integer operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing real operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing if/elseif/else control ***
-
-This works
-this_still_works
-should_print
-
-
-*** Seriously nested if's test ***
-** spelling correction by kluzz **
-Only two lines of text should follow:
-this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0
-this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4
-3 loop iterations should follow:
-2 4
-3 4
-4 4
-**********************************
-
-*** C-style else-if's ***
-This should be displayed
-*************************
-
-*** WHILE tests ***
-0 is smaller than 20
-1 is smaller than 20
-2 is smaller than 20
-3 is smaller than 20
-4 is smaller than 20
-5 is smaller than 20
-6 is smaller than 20
-7 is smaller than 20
-8 is smaller than 20
-9 is smaller than 20
-10 is smaller than 20
-11 is smaller than 20
-12 is smaller than 20
-13 is smaller than 20
-14 is smaller than 20
-15 is smaller than 20
-16 is smaller than 20
-17 is smaller than 20
-18 is smaller than 20
-19 is smaller than 20
-20 equals 20
-21 is greater than 20
-22 is greater than 20
-23 is greater than 20
-24 is greater than 20
-25 is greater than 20
-26 is greater than 20
-27 is greater than 20
-28 is greater than 20
-29 is greater than 20
-30 is greater than 20
-31 is greater than 20
-32 is greater than 20
-33 is greater than 20
-34 is greater than 20
-35 is greater than 20
-36 is greater than 20
-37 is greater than 20
-38 is greater than 20
-39 is greater than 20
-*******************
-
-
-*** Nested WHILEs ***
-Each array variable should be equal to the sum of its indices:
-${test00}[0] = 0
-${test00}[1] = 1
-${test00}[2] = 2
-${test01}[0] = 1
-${test01}[1] = 2
-${test01}[2] = 3
-${test02}[0] = 2
-${test02}[1] = 3
-${test02}[2] = 4
-${test10}[0] = 1
-${test10}[1] = 2
-${test10}[2] = 3
-${test11}[0] = 2
-${test11}[1] = 3
-${test11}[2] = 4
-${test12}[0] = 3
-${test12}[1] = 4
-${test12}[2] = 5
-${test20}[0] = 2
-${test20}[1] = 3
-${test20}[2] = 4
-${test21}[0] = 3
-${test21}[1] = 4
-${test21}[2] = 5
-${test22}[0] = 4
-${test22}[1] = 5
-${test22}[2] = 6
-*********************
-
-*** hash test... ***
-commented out...
-**************************
-
-*** Hash resizing test ***
-ba
-baa
-baaa
-baaaa
-baaaaa
-baaaaaa
-baaaaaaa
-baaaaaaaa
-baaaaaaaaa
-baaaaaaaaaa
-ba
-10
-baa
-9
-baaa
-8
-baaaa
-7
-baaaaa
-6
-baaaaaa
-5
-baaaaaaa
-4
-baaaaaaaa
-3
-baaaaaaaaa
-2
-baaaaaaaaaa
-1
-**************************
-
-
-*** break/continue test ***
-$i should go from 0 to 2
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=0
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=1
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=2
-***********************
-
-*** Nested file include test ***
-<html>
-This is Finish.phtml. This file is supposed to be included
-from regression_test.phtml. This is normal HTML.
-and this is PHP code, 2+2=4
-</html>
-********************************
-
-Tests completed.
-<html>
-<head>
-*** Testing assignments and variable aliasing: ***
-This should read "blah": blah
-This should read "this is nifty": this is nifty
-*************************************************
-
-*** Testing integer operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing real operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing if/elseif/else control ***
-
-This works
-this_still_works
-should_print
-
-
-*** Seriously nested if's test ***
-** spelling correction by kluzz **
-Only two lines of text should follow:
-this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0
-this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4
-3 loop iterations should follow:
-2 4
-3 4
-4 4
-**********************************
-
-*** C-style else-if's ***
-This should be displayed
-*************************
-
-*** WHILE tests ***
-0 is smaller than 20
-1 is smaller than 20
-2 is smaller than 20
-3 is smaller than 20
-4 is smaller than 20
-5 is smaller than 20
-6 is smaller than 20
-7 is smaller than 20
-8 is smaller than 20
-9 is smaller than 20
-10 is smaller than 20
-11 is smaller than 20
-12 is smaller than 20
-13 is smaller than 20
-14 is smaller than 20
-15 is smaller than 20
-16 is smaller than 20
-17 is smaller than 20
-18 is smaller than 20
-19 is smaller than 20
-20 equals 20
-21 is greater than 20
-22 is greater than 20
-23 is greater than 20
-24 is greater than 20
-25 is greater than 20
-26 is greater than 20
-27 is greater than 20
-28 is greater than 20
-29 is greater than 20
-30 is greater than 20
-31 is greater than 20
-32 is greater than 20
-33 is greater than 20
-34 is greater than 20
-35 is greater than 20
-36 is greater than 20
-37 is greater than 20
-38 is greater than 20
-39 is greater than 20
-*******************
-
-
-*** Nested WHILEs ***
-Each array variable should be equal to the sum of its indices:
-${test00}[0] = 0
-${test00}[1] = 1
-${test00}[2] = 2
-${test01}[0] = 1
-${test01}[1] = 2
-${test01}[2] = 3
-${test02}[0] = 2
-${test02}[1] = 3
-${test02}[2] = 4
-${test10}[0] = 1
-${test10}[1] = 2
-${test10}[2] = 3
-${test11}[0] = 2
-${test11}[1] = 3
-${test11}[2] = 4
-${test12}[0] = 3
-${test12}[1] = 4
-${test12}[2] = 5
-${test20}[0] = 2
-${test20}[1] = 3
-${test20}[2] = 4
-${test21}[0] = 3
-${test21}[1] = 4
-${test21}[2] = 5
-${test22}[0] = 4
-${test22}[1] = 5
-${test22}[2] = 6
-*********************
-
-*** hash test... ***
-commented out...
-**************************
-
-*** Hash resizing test ***
-ba
-baa
-baaa
-baaaa
-baaaaa
-baaaaaa
-baaaaaaa
-baaaaaaaa
-baaaaaaaaa
-baaaaaaaaaa
-ba
-10
-baa
-9
-baaa
-8
-baaaa
-7
-baaaaa
-6
-baaaaaa
-5
-baaaaaaa
-4
-baaaaaaaa
-3
-baaaaaaaaa
-2
-baaaaaaaaaa
-1
-**************************
-
-
-*** break/continue test ***
-$i should go from 0 to 2
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=0
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=1
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=2
-***********************
-
-*** Nested file include test ***
-<html>
-This is Finish.phtml. This file is supposed to be included
-from regression_test.phtml. This is normal HTML.
-and this is PHP code, 2+2=4
-</html>
-********************************
-
-Tests completed.
-<html>
-<head>
-*** Testing assignments and variable aliasing: ***
-This should read "blah": blah
-This should read "this is nifty": this is nifty
-*************************************************
-
-*** Testing integer operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing real operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing if/elseif/else control ***
-
-This works
-this_still_works
-should_print
-
-
-*** Seriously nested if's test ***
-** spelling correction by kluzz **
-Only two lines of text should follow:
-this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0
-this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4
-3 loop iterations should follow:
-2 4
-3 4
-4 4
-**********************************
-
-*** C-style else-if's ***
-This should be displayed
-*************************
-
-*** WHILE tests ***
-0 is smaller than 20
-1 is smaller than 20
-2 is smaller than 20
-3 is smaller than 20
-4 is smaller than 20
-5 is smaller than 20
-6 is smaller than 20
-7 is smaller than 20
-8 is smaller than 20
-9 is smaller than 20
-10 is smaller than 20
-11 is smaller than 20
-12 is smaller than 20
-13 is smaller than 20
-14 is smaller than 20
-15 is smaller than 20
-16 is smaller than 20
-17 is smaller than 20
-18 is smaller than 20
-19 is smaller than 20
-20 equals 20
-21 is greater than 20
-22 is greater than 20
-23 is greater than 20
-24 is greater than 20
-25 is greater than 20
-26 is greater than 20
-27 is greater than 20
-28 is greater than 20
-29 is greater than 20
-30 is greater than 20
-31 is greater than 20
-32 is greater than 20
-33 is greater than 20
-34 is greater than 20
-35 is greater than 20
-36 is greater than 20
-37 is greater than 20
-38 is greater than 20
-39 is greater than 20
-*******************
-
-
-*** Nested WHILEs ***
-Each array variable should be equal to the sum of its indices:
-${test00}[0] = 0
-${test00}[1] = 1
-${test00}[2] = 2
-${test01}[0] = 1
-${test01}[1] = 2
-${test01}[2] = 3
-${test02}[0] = 2
-${test02}[1] = 3
-${test02}[2] = 4
-${test10}[0] = 1
-${test10}[1] = 2
-${test10}[2] = 3
-${test11}[0] = 2
-${test11}[1] = 3
-${test11}[2] = 4
-${test12}[0] = 3
-${test12}[1] = 4
-${test12}[2] = 5
-${test20}[0] = 2
-${test20}[1] = 3
-${test20}[2] = 4
-${test21}[0] = 3
-${test21}[1] = 4
-${test21}[2] = 5
-${test22}[0] = 4
-${test22}[1] = 5
-${test22}[2] = 6
-*********************
-
-*** hash test... ***
-commented out...
-**************************
-
-*** Hash resizing test ***
-ba
-baa
-baaa
-baaaa
-baaaaa
-baaaaaa
-baaaaaaa
-baaaaaaaa
-baaaaaaaaa
-baaaaaaaaaa
-ba
-10
-baa
-9
-baaa
-8
-baaaa
-7
-baaaaa
-6
-baaaaaa
-5
-baaaaaaa
-4
-baaaaaaaa
-3
-baaaaaaaaa
-2
-baaaaaaaaaa
-1
-**************************
-
-
-*** break/continue test ***
-$i should go from 0 to 2
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=0
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=1
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=2
-***********************
-
-*** Nested file include test ***
-<html>
-This is Finish.phtml. This file is supposed to be included
-from regression_test.phtml. This is normal HTML.
-and this is PHP code, 2+2=4
-</html>
-********************************
-
-Tests completed.
-<html>
-<head>
-*** Testing assignments and variable aliasing: ***
-This should read "blah": blah
-This should read "this is nifty": this is nifty
-*************************************************
-
-*** Testing integer operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing real operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing if/elseif/else control ***
-
-This works
-this_still_works
-should_print
-
-
-*** Seriously nested if's test ***
-** spelling correction by kluzz **
-Only two lines of text should follow:
-this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0
-this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4
-3 loop iterations should follow:
-2 4
-3 4
-4 4
-**********************************
-
-*** C-style else-if's ***
-This should be displayed
-*************************
-
-*** WHILE tests ***
-0 is smaller than 20
-1 is smaller than 20
-2 is smaller than 20
-3 is smaller than 20
-4 is smaller than 20
-5 is smaller than 20
-6 is smaller than 20
-7 is smaller than 20
-8 is smaller than 20
-9 is smaller than 20
-10 is smaller than 20
-11 is smaller than 20
-12 is smaller than 20
-13 is smaller than 20
-14 is smaller than 20
-15 is smaller than 20
-16 is smaller than 20
-17 is smaller than 20
-18 is smaller than 20
-19 is smaller than 20
-20 equals 20
-21 is greater than 20
-22 is greater than 20
-23 is greater than 20
-24 is greater than 20
-25 is greater than 20
-26 is greater than 20
-27 is greater than 20
-28 is greater than 20
-29 is greater than 20
-30 is greater than 20
-31 is greater than 20
-32 is greater than 20
-33 is greater than 20
-34 is greater than 20
-35 is greater than 20
-36 is greater than 20
-37 is greater than 20
-38 is greater than 20
-39 is greater than 20
-*******************
-
-
-*** Nested WHILEs ***
-Each array variable should be equal to the sum of its indices:
-${test00}[0] = 0
-${test00}[1] = 1
-${test00}[2] = 2
-${test01}[0] = 1
-${test01}[1] = 2
-${test01}[2] = 3
-${test02}[0] = 2
-${test02}[1] = 3
-${test02}[2] = 4
-${test10}[0] = 1
-${test10}[1] = 2
-${test10}[2] = 3
-${test11}[0] = 2
-${test11}[1] = 3
-${test11}[2] = 4
-${test12}[0] = 3
-${test12}[1] = 4
-${test12}[2] = 5
-${test20}[0] = 2
-${test20}[1] = 3
-${test20}[2] = 4
-${test21}[0] = 3
-${test21}[1] = 4
-${test21}[2] = 5
-${test22}[0] = 4
-${test22}[1] = 5
-${test22}[2] = 6
-*********************
-
-*** hash test... ***
-commented out...
-**************************
-
-*** Hash resizing test ***
-ba
-baa
-baaa
-baaaa
-baaaaa
-baaaaaa
-baaaaaaa
-baaaaaaaa
-baaaaaaaaa
-baaaaaaaaaa
-ba
-10
-baa
-9
-baaa
-8
-baaaa
-7
-baaaaa
-6
-baaaaaa
-5
-baaaaaaa
-4
-baaaaaaaa
-3
-baaaaaaaaa
-2
-baaaaaaaaaa
-1
-**************************
-
-
-*** break/continue test ***
-$i should go from 0 to 2
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=0
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=1
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=2
-***********************
-
-*** Nested file include test ***
-<html>
-This is Finish.phtml. This file is supposed to be included
-from regression_test.phtml. This is normal HTML.
-and this is PHP code, 2+2=4
-</html>
-********************************
-
-Tests completed.
-<html>
-<head>
-*** Testing assignments and variable aliasing: ***
-This should read "blah": blah
-This should read "this is nifty": this is nifty
-*************************************************
-
-*** Testing integer operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing real operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing if/elseif/else control ***
-
-This works
-this_still_works
-should_print
-
-
-*** Seriously nested if's test ***
-** spelling correction by kluzz **
-Only two lines of text should follow:
-this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0
-this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4
-3 loop iterations should follow:
-2 4
-3 4
-4 4
-**********************************
-
-*** C-style else-if's ***
-This should be displayed
-*************************
-
-*** WHILE tests ***
-0 is smaller than 20
-1 is smaller than 20
-2 is smaller than 20
-3 is smaller than 20
-4 is smaller than 20
-5 is smaller than 20
-6 is smaller than 20
-7 is smaller than 20
-8 is smaller than 20
-9 is smaller than 20
-10 is smaller than 20
-11 is smaller than 20
-12 is smaller than 20
-13 is smaller than 20
-14 is smaller than 20
-15 is smaller than 20
-16 is smaller than 20
-17 is smaller than 20
-18 is smaller than 20
-19 is smaller than 20
-20 equals 20
-21 is greater than 20
-22 is greater than 20
-23 is greater than 20
-24 is greater than 20
-25 is greater than 20
-26 is greater than 20
-27 is greater than 20
-28 is greater than 20
-29 is greater than 20
-30 is greater than 20
-31 is greater than 20
-32 is greater than 20
-33 is greater than 20
-34 is greater than 20
-35 is greater than 20
-36 is greater than 20
-37 is greater than 20
-38 is greater than 20
-39 is greater than 20
-*******************
-
-
-*** Nested WHILEs ***
-Each array variable should be equal to the sum of its indices:
-${test00}[0] = 0
-${test00}[1] = 1
-${test00}[2] = 2
-${test01}[0] = 1
-${test01}[1] = 2
-${test01}[2] = 3
-${test02}[0] = 2
-${test02}[1] = 3
-${test02}[2] = 4
-${test10}[0] = 1
-${test10}[1] = 2
-${test10}[2] = 3
-${test11}[0] = 2
-${test11}[1] = 3
-${test11}[2] = 4
-${test12}[0] = 3
-${test12}[1] = 4
-${test12}[2] = 5
-${test20}[0] = 2
-${test20}[1] = 3
-${test20}[2] = 4
-${test21}[0] = 3
-${test21}[1] = 4
-${test21}[2] = 5
-${test22}[0] = 4
-${test22}[1] = 5
-${test22}[2] = 6
-*********************
-
-*** hash test... ***
-commented out...
-**************************
-
-*** Hash resizing test ***
-ba
-baa
-baaa
-baaaa
-baaaaa
-baaaaaa
-baaaaaaa
-baaaaaaaa
-baaaaaaaaa
-baaaaaaaaaa
-ba
-10
-baa
-9
-baaa
-8
-baaaa
-7
-baaaaa
-6
-baaaaaa
-5
-baaaaaaa
-4
-baaaaaaaa
-3
-baaaaaaaaa
-2
-baaaaaaaaaa
-1
-**************************
-
-
-*** break/continue test ***
-$i should go from 0 to 2
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=0
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=1
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=2
-***********************
-
-*** Nested file include test ***
-<html>
-This is Finish.phtml. This file is supposed to be included
-from regression_test.phtml. This is normal HTML.
-and this is PHP code, 2+2=4
-</html>
-********************************
-
-Tests completed.
-<html>
-<head>
-*** Testing assignments and variable aliasing: ***
-This should read "blah": blah
-This should read "this is nifty": this is nifty
-*************************************************
-
-*** Testing integer operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing real operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing if/elseif/else control ***
-
-This works
-this_still_works
-should_print
-
-
-*** Seriously nested if's test ***
-** spelling correction by kluzz **
-Only two lines of text should follow:
-this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0
-this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4
-3 loop iterations should follow:
-2 4
-3 4
-4 4
-**********************************
-
-*** C-style else-if's ***
-This should be displayed
-*************************
-
-*** WHILE tests ***
-0 is smaller than 20
-1 is smaller than 20
-2 is smaller than 20
-3 is smaller than 20
-4 is smaller than 20
-5 is smaller than 20
-6 is smaller than 20
-7 is smaller than 20
-8 is smaller than 20
-9 is smaller than 20
-10 is smaller than 20
-11 is smaller than 20
-12 is smaller than 20
-13 is smaller than 20
-14 is smaller than 20
-15 is smaller than 20
-16 is smaller than 20
-17 is smaller than 20
-18 is smaller than 20
-19 is smaller than 20
-20 equals 20
-21 is greater than 20
-22 is greater than 20
-23 is greater than 20
-24 is greater than 20
-25 is greater than 20
-26 is greater than 20
-27 is greater than 20
-28 is greater than 20
-29 is greater than 20
-30 is greater than 20
-31 is greater than 20
-32 is greater than 20
-33 is greater than 20
-34 is greater than 20
-35 is greater than 20
-36 is greater than 20
-37 is greater than 20
-38 is greater than 20
-39 is greater than 20
-*******************
-
-
-*** Nested WHILEs ***
-Each array variable should be equal to the sum of its indices:
-${test00}[0] = 0
-${test00}[1] = 1
-${test00}[2] = 2
-${test01}[0] = 1
-${test01}[1] = 2
-${test01}[2] = 3
-${test02}[0] = 2
-${test02}[1] = 3
-${test02}[2] = 4
-${test10}[0] = 1
-${test10}[1] = 2
-${test10}[2] = 3
-${test11}[0] = 2
-${test11}[1] = 3
-${test11}[2] = 4
-${test12}[0] = 3
-${test12}[1] = 4
-${test12}[2] = 5
-${test20}[0] = 2
-${test20}[1] = 3
-${test20}[2] = 4
-${test21}[0] = 3
-${test21}[1] = 4
-${test21}[2] = 5
-${test22}[0] = 4
-${test22}[1] = 5
-${test22}[2] = 6
-*********************
-
-*** hash test... ***
-commented out...
-**************************
-
-*** Hash resizing test ***
-ba
-baa
-baaa
-baaaa
-baaaaa
-baaaaaa
-baaaaaaa
-baaaaaaaa
-baaaaaaaaa
-baaaaaaaaaa
-ba
-10
-baa
-9
-baaa
-8
-baaaa
-7
-baaaaa
-6
-baaaaaa
-5
-baaaaaaa
-4
-baaaaaaaa
-3
-baaaaaaaaa
-2
-baaaaaaaaaa
-1
-**************************
-
-
-*** break/continue test ***
-$i should go from 0 to 2
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=0
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=1
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=2
-***********************
-
-*** Nested file include test ***
-<html>
-This is Finish.phtml. This file is supposed to be included
-from regression_test.phtml. This is normal HTML.
-and this is PHP code, 2+2=4
-</html>
-********************************
-
-Tests completed.
-<html>
-<head>
-*** Testing assignments and variable aliasing: ***
-This should read "blah": blah
-This should read "this is nifty": this is nifty
-*************************************************
-
-*** Testing integer operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing real operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing if/elseif/else control ***
-
-This works
-this_still_works
-should_print
-
-
-*** Seriously nested if's test ***
-** spelling correction by kluzz **
-Only two lines of text should follow:
-this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0
-this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4
-3 loop iterations should follow:
-2 4
-3 4
-4 4
-**********************************
-
-*** C-style else-if's ***
-This should be displayed
-*************************
-
-*** WHILE tests ***
-0 is smaller than 20
-1 is smaller than 20
-2 is smaller than 20
-3 is smaller than 20
-4 is smaller than 20
-5 is smaller than 20
-6 is smaller than 20
-7 is smaller than 20
-8 is smaller than 20
-9 is smaller than 20
-10 is smaller than 20
-11 is smaller than 20
-12 is smaller than 20
-13 is smaller than 20
-14 is smaller than 20
-15 is smaller than 20
-16 is smaller than 20
-17 is smaller than 20
-18 is smaller than 20
-19 is smaller than 20
-20 equals 20
-21 is greater than 20
-22 is greater than 20
-23 is greater than 20
-24 is greater than 20
-25 is greater than 20
-26 is greater than 20
-27 is greater than 20
-28 is greater than 20
-29 is greater than 20
-30 is greater than 20
-31 is greater than 20
-32 is greater than 20
-33 is greater than 20
-34 is greater than 20
-35 is greater than 20
-36 is greater than 20
-37 is greater than 20
-38 is greater than 20
-39 is greater than 20
-*******************
-
-
-*** Nested WHILEs ***
-Each array variable should be equal to the sum of its indices:
-${test00}[0] = 0
-${test00}[1] = 1
-${test00}[2] = 2
-${test01}[0] = 1
-${test01}[1] = 2
-${test01}[2] = 3
-${test02}[0] = 2
-${test02}[1] = 3
-${test02}[2] = 4
-${test10}[0] = 1
-${test10}[1] = 2
-${test10}[2] = 3
-${test11}[0] = 2
-${test11}[1] = 3
-${test11}[2] = 4
-${test12}[0] = 3
-${test12}[1] = 4
-${test12}[2] = 5
-${test20}[0] = 2
-${test20}[1] = 3
-${test20}[2] = 4
-${test21}[0] = 3
-${test21}[1] = 4
-${test21}[2] = 5
-${test22}[0] = 4
-${test22}[1] = 5
-${test22}[2] = 6
-*********************
-
-*** hash test... ***
-commented out...
-**************************
-
-*** Hash resizing test ***
-ba
-baa
-baaa
-baaaa
-baaaaa
-baaaaaa
-baaaaaaa
-baaaaaaaa
-baaaaaaaaa
-baaaaaaaaaa
-ba
-10
-baa
-9
-baaa
-8
-baaaa
-7
-baaaaa
-6
-baaaaaa
-5
-baaaaaaa
-4
-baaaaaaaa
-3
-baaaaaaaaa
-2
-baaaaaaaaaa
-1
-**************************
-
-
-*** break/continue test ***
-$i should go from 0 to 2
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=0
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=1
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=2
-***********************
-
-*** Nested file include test ***
-<html>
-This is Finish.phtml. This file is supposed to be included
-from regression_test.phtml. This is normal HTML.
-and this is PHP code, 2+2=4
-</html>
-********************************
-
-Tests completed.
-<html>
-<head>
-*** Testing assignments and variable aliasing: ***
-This should read "blah": blah
-This should read "this is nifty": this is nifty
-*************************************************
-
-*** Testing integer operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing real operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing if/elseif/else control ***
-
-This works
-this_still_works
-should_print
-
-
-*** Seriously nested if's test ***
-** spelling correction by kluzz **
-Only two lines of text should follow:
-this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0
-this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4
-3 loop iterations should follow:
-2 4
-3 4
-4 4
-**********************************
-
-*** C-style else-if's ***
-This should be displayed
-*************************
-
-*** WHILE tests ***
-0 is smaller than 20
-1 is smaller than 20
-2 is smaller than 20
-3 is smaller than 20
-4 is smaller than 20
-5 is smaller than 20
-6 is smaller than 20
-7 is smaller than 20
-8 is smaller than 20
-9 is smaller than 20
-10 is smaller than 20
-11 is smaller than 20
-12 is smaller than 20
-13 is smaller than 20
-14 is smaller than 20
-15 is smaller than 20
-16 is smaller than 20
-17 is smaller than 20
-18 is smaller than 20
-19 is smaller than 20
-20 equals 20
-21 is greater than 20
-22 is greater than 20
-23 is greater than 20
-24 is greater than 20
-25 is greater than 20
-26 is greater than 20
-27 is greater than 20
-28 is greater than 20
-29 is greater than 20
-30 is greater than 20
-31 is greater than 20
-32 is greater than 20
-33 is greater than 20
-34 is greater than 20
-35 is greater than 20
-36 is greater than 20
-37 is greater than 20
-38 is greater than 20
-39 is greater than 20
-*******************
-
-
-*** Nested WHILEs ***
-Each array variable should be equal to the sum of its indices:
-${test00}[0] = 0
-${test00}[1] = 1
-${test00}[2] = 2
-${test01}[0] = 1
-${test01}[1] = 2
-${test01}[2] = 3
-${test02}[0] = 2
-${test02}[1] = 3
-${test02}[2] = 4
-${test10}[0] = 1
-${test10}[1] = 2
-${test10}[2] = 3
-${test11}[0] = 2
-${test11}[1] = 3
-${test11}[2] = 4
-${test12}[0] = 3
-${test12}[1] = 4
-${test12}[2] = 5
-${test20}[0] = 2
-${test20}[1] = 3
-${test20}[2] = 4
-${test21}[0] = 3
-${test21}[1] = 4
-${test21}[2] = 5
-${test22}[0] = 4
-${test22}[1] = 5
-${test22}[2] = 6
-*********************
-
-*** hash test... ***
-commented out...
-**************************
-
-*** Hash resizing test ***
-ba
-baa
-baaa
-baaaa
-baaaaa
-baaaaaa
-baaaaaaa
-baaaaaaaa
-baaaaaaaaa
-baaaaaaaaaa
-ba
-10
-baa
-9
-baaa
-8
-baaaa
-7
-baaaaa
-6
-baaaaaa
-5
-baaaaaaa
-4
-baaaaaaaa
-3
-baaaaaaaaa
-2
-baaaaaaaaaa
-1
-**************************
-
-
-*** break/continue test ***
-$i should go from 0 to 2
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=0
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=1
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=2
-***********************
-
-*** Nested file include test ***
-<html>
-This is Finish.phtml. This file is supposed to be included
-from regression_test.phtml. This is normal HTML.
-and this is PHP code, 2+2=4
-</html>
-********************************
-
-Tests completed.
-<html>
-<head>
-*** Testing assignments and variable aliasing: ***
-This should read "blah": blah
-This should read "this is nifty": this is nifty
-*************************************************
-
-*** Testing integer operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing real operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing if/elseif/else control ***
-
-This works
-this_still_works
-should_print
-
-
-*** Seriously nested if's test ***
-** spelling correction by kluzz **
-Only two lines of text should follow:
-this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0
-this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4
-3 loop iterations should follow:
-2 4
-3 4
-4 4
-**********************************
-
-*** C-style else-if's ***
-This should be displayed
-*************************
-
-*** WHILE tests ***
-0 is smaller than 20
-1 is smaller than 20
-2 is smaller than 20
-3 is smaller than 20
-4 is smaller than 20
-5 is smaller than 20
-6 is smaller than 20
-7 is smaller than 20
-8 is smaller than 20
-9 is smaller than 20
-10 is smaller than 20
-11 is smaller than 20
-12 is smaller than 20
-13 is smaller than 20
-14 is smaller than 20
-15 is smaller than 20
-16 is smaller than 20
-17 is smaller than 20
-18 is smaller than 20
-19 is smaller than 20
-20 equals 20
-21 is greater than 20
-22 is greater than 20
-23 is greater than 20
-24 is greater than 20
-25 is greater than 20
-26 is greater than 20
-27 is greater than 20
-28 is greater than 20
-29 is greater than 20
-30 is greater than 20
-31 is greater than 20
-32 is greater than 20
-33 is greater than 20
-34 is greater than 20
-35 is greater than 20
-36 is greater than 20
-37 is greater than 20
-38 is greater than 20
-39 is greater than 20
-*******************
-
-
-*** Nested WHILEs ***
-Each array variable should be equal to the sum of its indices:
-${test00}[0] = 0
-${test00}[1] = 1
-${test00}[2] = 2
-${test01}[0] = 1
-${test01}[1] = 2
-${test01}[2] = 3
-${test02}[0] = 2
-${test02}[1] = 3
-${test02}[2] = 4
-${test10}[0] = 1
-${test10}[1] = 2
-${test10}[2] = 3
-${test11}[0] = 2
-${test11}[1] = 3
-${test11}[2] = 4
-${test12}[0] = 3
-${test12}[1] = 4
-${test12}[2] = 5
-${test20}[0] = 2
-${test20}[1] = 3
-${test20}[2] = 4
-${test21}[0] = 3
-${test21}[1] = 4
-${test21}[2] = 5
-${test22}[0] = 4
-${test22}[1] = 5
-${test22}[2] = 6
-*********************
-
-*** hash test... ***
-commented out...
-**************************
-
-*** Hash resizing test ***
-ba
-baa
-baaa
-baaaa
-baaaaa
-baaaaaa
-baaaaaaa
-baaaaaaaa
-baaaaaaaaa
-baaaaaaaaaa
-ba
-10
-baa
-9
-baaa
-8
-baaaa
-7
-baaaaa
-6
-baaaaaa
-5
-baaaaaaa
-4
-baaaaaaaa
-3
-baaaaaaaaa
-2
-baaaaaaaaaa
-1
-**************************
-
-
-*** break/continue test ***
-$i should go from 0 to 2
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=0
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=1
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=2
-***********************
-
-*** Nested file include test ***
-<html>
-This is Finish.phtml. This file is supposed to be included
-from regression_test.phtml. This is normal HTML.
-and this is PHP code, 2+2=4
-</html>
-********************************
-
-Tests completed.
-<html>
-<head>
-*** Testing assignments and variable aliasing: ***
-This should read "blah": blah
-This should read "this is nifty": this is nifty
-*************************************************
-
-*** Testing integer operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing real operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing if/elseif/else control ***
-
-This works
-this_still_works
-should_print
-
-
-*** Seriously nested if's test ***
-** spelling correction by kluzz **
-Only two lines of text should follow:
-this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0
-this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4
-3 loop iterations should follow:
-2 4
-3 4
-4 4
-**********************************
-
-*** C-style else-if's ***
-This should be displayed
-*************************
-
-*** WHILE tests ***
-0 is smaller than 20
-1 is smaller than 20
-2 is smaller than 20
-3 is smaller than 20
-4 is smaller than 20
-5 is smaller than 20
-6 is smaller than 20
-7 is smaller than 20
-8 is smaller than 20
-9 is smaller than 20
-10 is smaller than 20
-11 is smaller than 20
-12 is smaller than 20
-13 is smaller than 20
-14 is smaller than 20
-15 is smaller than 20
-16 is smaller than 20
-17 is smaller than 20
-18 is smaller than 20
-19 is smaller than 20
-20 equals 20
-21 is greater than 20
-22 is greater than 20
-23 is greater than 20
-24 is greater than 20
-25 is greater than 20
-26 is greater than 20
-27 is greater than 20
-28 is greater than 20
-29 is greater than 20
-30 is greater than 20
-31 is greater than 20
-32 is greater than 20
-33 is greater than 20
-34 is greater than 20
-35 is greater than 20
-36 is greater than 20
-37 is greater than 20
-38 is greater than 20
-39 is greater than 20
-*******************
-
-
-*** Nested WHILEs ***
-Each array variable should be equal to the sum of its indices:
-${test00}[0] = 0
-${test00}[1] = 1
-${test00}[2] = 2
-${test01}[0] = 1
-${test01}[1] = 2
-${test01}[2] = 3
-${test02}[0] = 2
-${test02}[1] = 3
-${test02}[2] = 4
-${test10}[0] = 1
-${test10}[1] = 2
-${test10}[2] = 3
-${test11}[0] = 2
-${test11}[1] = 3
-${test11}[2] = 4
-${test12}[0] = 3
-${test12}[1] = 4
-${test12}[2] = 5
-${test20}[0] = 2
-${test20}[1] = 3
-${test20}[2] = 4
-${test21}[0] = 3
-${test21}[1] = 4
-${test21}[2] = 5
-${test22}[0] = 4
-${test22}[1] = 5
-${test22}[2] = 6
-*********************
-
-*** hash test... ***
-commented out...
-**************************
-
-*** Hash resizing test ***
-ba
-baa
-baaa
-baaaa
-baaaaa
-baaaaaa
-baaaaaaa
-baaaaaaaa
-baaaaaaaaa
-baaaaaaaaaa
-ba
-10
-baa
-9
-baaa
-8
-baaaa
-7
-baaaaa
-6
-baaaaaa
-5
-baaaaaaa
-4
-baaaaaaaa
-3
-baaaaaaaaa
-2
-baaaaaaaaaa
-1
-**************************
-
-
-*** break/continue test ***
-$i should go from 0 to 2
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=0
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=1
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=2
-***********************
-
-*** Nested file include test ***
-<html>
-This is Finish.phtml. This file is supposed to be included
-from regression_test.phtml. This is normal HTML.
-and this is PHP code, 2+2=4
-</html>
-********************************
-
-Tests completed.
-<html>
-<head>
-*** Testing assignments and variable aliasing: ***
-This should read "blah": blah
-This should read "this is nifty": this is nifty
-*************************************************
-
-*** Testing integer operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing real operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing if/elseif/else control ***
-
-This works
-this_still_works
-should_print
-
-
-*** Seriously nested if's test ***
-** spelling correction by kluzz **
-Only two lines of text should follow:
-this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0
-this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4
-3 loop iterations should follow:
-2 4
-3 4
-4 4
-**********************************
-
-*** C-style else-if's ***
-This should be displayed
-*************************
-
-*** WHILE tests ***
-0 is smaller than 20
-1 is smaller than 20
-2 is smaller than 20
-3 is smaller than 20
-4 is smaller than 20
-5 is smaller than 20
-6 is smaller than 20
-7 is smaller than 20
-8 is smaller than 20
-9 is smaller than 20
-10 is smaller than 20
-11 is smaller than 20
-12 is smaller than 20
-13 is smaller than 20
-14 is smaller than 20
-15 is smaller than 20
-16 is smaller than 20
-17 is smaller than 20
-18 is smaller than 20
-19 is smaller than 20
-20 equals 20
-21 is greater than 20
-22 is greater than 20
-23 is greater than 20
-24 is greater than 20
-25 is greater than 20
-26 is greater than 20
-27 is greater than 20
-28 is greater than 20
-29 is greater than 20
-30 is greater than 20
-31 is greater than 20
-32 is greater than 20
-33 is greater than 20
-34 is greater than 20
-35 is greater than 20
-36 is greater than 20
-37 is greater than 20
-38 is greater than 20
-39 is greater than 20
-*******************
-
-
-*** Nested WHILEs ***
-Each array variable should be equal to the sum of its indices:
-${test00}[0] = 0
-${test00}[1] = 1
-${test00}[2] = 2
-${test01}[0] = 1
-${test01}[1] = 2
-${test01}[2] = 3
-${test02}[0] = 2
-${test02}[1] = 3
-${test02}[2] = 4
-${test10}[0] = 1
-${test10}[1] = 2
-${test10}[2] = 3
-${test11}[0] = 2
-${test11}[1] = 3
-${test11}[2] = 4
-${test12}[0] = 3
-${test12}[1] = 4
-${test12}[2] = 5
-${test20}[0] = 2
-${test20}[1] = 3
-${test20}[2] = 4
-${test21}[0] = 3
-${test21}[1] = 4
-${test21}[2] = 5
-${test22}[0] = 4
-${test22}[1] = 5
-${test22}[2] = 6
-*********************
-
-*** hash test... ***
-commented out...
-**************************
-
-*** Hash resizing test ***
-ba
-baa
-baaa
-baaaa
-baaaaa
-baaaaaa
-baaaaaaa
-baaaaaaaa
-baaaaaaaaa
-baaaaaaaaaa
-ba
-10
-baa
-9
-baaa
-8
-baaaa
-7
-baaaaa
-6
-baaaaaa
-5
-baaaaaaa
-4
-baaaaaaaa
-3
-baaaaaaaaa
-2
-baaaaaaaaaa
-1
-**************************
-
-
-*** break/continue test ***
-$i should go from 0 to 2
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=0
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=1
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=2
-***********************
-
-*** Nested file include test ***
-<html>
-This is Finish.phtml. This file is supposed to be included
-from regression_test.phtml. This is normal HTML.
-and this is PHP code, 2+2=4
-</html>
-********************************
-
-Tests completed.
-<html>
-<head>
-*** Testing assignments and variable aliasing: ***
-This should read "blah": blah
-This should read "this is nifty": this is nifty
-*************************************************
-
-*** Testing integer operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing real operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing if/elseif/else control ***
-
-This works
-this_still_works
-should_print
-
-
-*** Seriously nested if's test ***
-** spelling correction by kluzz **
-Only two lines of text should follow:
-this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0
-this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4
-3 loop iterations should follow:
-2 4
-3 4
-4 4
-**********************************
-
-*** C-style else-if's ***
-This should be displayed
-*************************
-
-*** WHILE tests ***
-0 is smaller than 20
-1 is smaller than 20
-2 is smaller than 20
-3 is smaller than 20
-4 is smaller than 20
-5 is smaller than 20
-6 is smaller than 20
-7 is smaller than 20
-8 is smaller than 20
-9 is smaller than 20
-10 is smaller than 20
-11 is smaller than 20
-12 is smaller than 20
-13 is smaller than 20
-14 is smaller than 20
-15 is smaller than 20
-16 is smaller than 20
-17 is smaller than 20
-18 is smaller than 20
-19 is smaller than 20
-20 equals 20
-21 is greater than 20
-22 is greater than 20
-23 is greater than 20
-24 is greater than 20
-25 is greater than 20
-26 is greater than 20
-27 is greater than 20
-28 is greater than 20
-29 is greater than 20
-30 is greater than 20
-31 is greater than 20
-32 is greater than 20
-33 is greater than 20
-34 is greater than 20
-35 is greater than 20
-36 is greater than 20
-37 is greater than 20
-38 is greater than 20
-39 is greater than 20
-*******************
-
-
-*** Nested WHILEs ***
-Each array variable should be equal to the sum of its indices:
-${test00}[0] = 0
-${test00}[1] = 1
-${test00}[2] = 2
-${test01}[0] = 1
-${test01}[1] = 2
-${test01}[2] = 3
-${test02}[0] = 2
-${test02}[1] = 3
-${test02}[2] = 4
-${test10}[0] = 1
-${test10}[1] = 2
-${test10}[2] = 3
-${test11}[0] = 2
-${test11}[1] = 3
-${test11}[2] = 4
-${test12}[0] = 3
-${test12}[1] = 4
-${test12}[2] = 5
-${test20}[0] = 2
-${test20}[1] = 3
-${test20}[2] = 4
-${test21}[0] = 3
-${test21}[1] = 4
-${test21}[2] = 5
-${test22}[0] = 4
-${test22}[1] = 5
-${test22}[2] = 6
-*********************
-
-*** hash test... ***
-commented out...
-**************************
-
-*** Hash resizing test ***
-ba
-baa
-baaa
-baaaa
-baaaaa
-baaaaaa
-baaaaaaa
-baaaaaaaa
-baaaaaaaaa
-baaaaaaaaaa
-ba
-10
-baa
-9
-baaa
-8
-baaaa
-7
-baaaaa
-6
-baaaaaa
-5
-baaaaaaa
-4
-baaaaaaaa
-3
-baaaaaaaaa
-2
-baaaaaaaaaa
-1
-**************************
-
-
-*** break/continue test ***
-$i should go from 0 to 2
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=0
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=1
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=2
-***********************
-
-*** Nested file include test ***
-<html>
-This is Finish.phtml. This file is supposed to be included
-from regression_test.phtml. This is normal HTML.
-and this is PHP code, 2+2=4
-</html>
-********************************
-
-Tests completed.
-<html>
-<head>
-*** Testing assignments and variable aliasing: ***
-This should read "blah": blah
-This should read "this is nifty": this is nifty
-*************************************************
-
-*** Testing integer operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing real operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing if/elseif/else control ***
-
-This works
-this_still_works
-should_print
-
-
-*** Seriously nested if's test ***
-** spelling correction by kluzz **
-Only two lines of text should follow:
-this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0
-this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4
-3 loop iterations should follow:
-2 4
-3 4
-4 4
-**********************************
-
-*** C-style else-if's ***
-This should be displayed
-*************************
-
-*** WHILE tests ***
-0 is smaller than 20
-1 is smaller than 20
-2 is smaller than 20
-3 is smaller than 20
-4 is smaller than 20
-5 is smaller than 20
-6 is smaller than 20
-7 is smaller than 20
-8 is smaller than 20
-9 is smaller than 20
-10 is smaller than 20
-11 is smaller than 20
-12 is smaller than 20
-13 is smaller than 20
-14 is smaller than 20
-15 is smaller than 20
-16 is smaller than 20
-17 is smaller than 20
-18 is smaller than 20
-19 is smaller than 20
-20 equals 20
-21 is greater than 20
-22 is greater than 20
-23 is greater than 20
-24 is greater than 20
-25 is greater than 20
-26 is greater than 20
-27 is greater than 20
-28 is greater than 20
-29 is greater than 20
-30 is greater than 20
-31 is greater than 20
-32 is greater than 20
-33 is greater than 20
-34 is greater than 20
-35 is greater than 20
-36 is greater than 20
-37 is greater than 20
-38 is greater than 20
-39 is greater than 20
-*******************
-
-
-*** Nested WHILEs ***
-Each array variable should be equal to the sum of its indices:
-${test00}[0] = 0
-${test00}[1] = 1
-${test00}[2] = 2
-${test01}[0] = 1
-${test01}[1] = 2
-${test01}[2] = 3
-${test02}[0] = 2
-${test02}[1] = 3
-${test02}[2] = 4
-${test10}[0] = 1
-${test10}[1] = 2
-${test10}[2] = 3
-${test11}[0] = 2
-${test11}[1] = 3
-${test11}[2] = 4
-${test12}[0] = 3
-${test12}[1] = 4
-${test12}[2] = 5
-${test20}[0] = 2
-${test20}[1] = 3
-${test20}[2] = 4
-${test21}[0] = 3
-${test21}[1] = 4
-${test21}[2] = 5
-${test22}[0] = 4
-${test22}[1] = 5
-${test22}[2] = 6
-*********************
-
-*** hash test... ***
-commented out...
-**************************
-
-*** Hash resizing test ***
-ba
-baa
-baaa
-baaaa
-baaaaa
-baaaaaa
-baaaaaaa
-baaaaaaaa
-baaaaaaaaa
-baaaaaaaaaa
-ba
-10
-baa
-9
-baaa
-8
-baaaa
-7
-baaaaa
-6
-baaaaaa
-5
-baaaaaaa
-4
-baaaaaaaa
-3
-baaaaaaaaa
-2
-baaaaaaaaaa
-1
-**************************
-
-
-*** break/continue test ***
-$i should go from 0 to 2
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=0
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=1
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=2
-***********************
-
-*** Nested file include test ***
-<html>
-This is Finish.phtml. This file is supposed to be included
-from regression_test.phtml. This is normal HTML.
-and this is PHP code, 2+2=4
-</html>
-********************************
-
-Tests completed.
-<html>
-<head>
-*** Testing assignments and variable aliasing: ***
-This should read "blah": blah
-This should read "this is nifty": this is nifty
-*************************************************
-
-*** Testing integer operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing real operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing if/elseif/else control ***
-
-This works
-this_still_works
-should_print
-
-
-*** Seriously nested if's test ***
-** spelling correction by kluzz **
-Only two lines of text should follow:
-this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0
-this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4
-3 loop iterations should follow:
-2 4
-3 4
-4 4
-**********************************
-
-*** C-style else-if's ***
-This should be displayed
-*************************
-
-*** WHILE tests ***
-0 is smaller than 20
-1 is smaller than 20
-2 is smaller than 20
-3 is smaller than 20
-4 is smaller than 20
-5 is smaller than 20
-6 is smaller than 20
-7 is smaller than 20
-8 is smaller than 20
-9 is smaller than 20
-10 is smaller than 20
-11 is smaller than 20
-12 is smaller than 20
-13 is smaller than 20
-14 is smaller than 20
-15 is smaller than 20
-16 is smaller than 20
-17 is smaller than 20
-18 is smaller than 20
-19 is smaller than 20
-20 equals 20
-21 is greater than 20
-22 is greater than 20
-23 is greater than 20
-24 is greater than 20
-25 is greater than 20
-26 is greater than 20
-27 is greater than 20
-28 is greater than 20
-29 is greater than 20
-30 is greater than 20
-31 is greater than 20
-32 is greater than 20
-33 is greater than 20
-34 is greater than 20
-35 is greater than 20
-36 is greater than 20
-37 is greater than 20
-38 is greater than 20
-39 is greater than 20
-*******************
-
-
-*** Nested WHILEs ***
-Each array variable should be equal to the sum of its indices:
-${test00}[0] = 0
-${test00}[1] = 1
-${test00}[2] = 2
-${test01}[0] = 1
-${test01}[1] = 2
-${test01}[2] = 3
-${test02}[0] = 2
-${test02}[1] = 3
-${test02}[2] = 4
-${test10}[0] = 1
-${test10}[1] = 2
-${test10}[2] = 3
-${test11}[0] = 2
-${test11}[1] = 3
-${test11}[2] = 4
-${test12}[0] = 3
-${test12}[1] = 4
-${test12}[2] = 5
-${test20}[0] = 2
-${test20}[1] = 3
-${test20}[2] = 4
-${test21}[0] = 3
-${test21}[1] = 4
-${test21}[2] = 5
-${test22}[0] = 4
-${test22}[1] = 5
-${test22}[2] = 6
-*********************
-
-*** hash test... ***
-commented out...
-**************************
-
-*** Hash resizing test ***
-ba
-baa
-baaa
-baaaa
-baaaaa
-baaaaaa
-baaaaaaa
-baaaaaaaa
-baaaaaaaaa
-baaaaaaaaaa
-ba
-10
-baa
-9
-baaa
-8
-baaaa
-7
-baaaaa
-6
-baaaaaa
-5
-baaaaaaa
-4
-baaaaaaaa
-3
-baaaaaaaaa
-2
-baaaaaaaaaa
-1
-**************************
-
-
-*** break/continue test ***
-$i should go from 0 to 2
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=0
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=1
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=2
-***********************
-
-*** Nested file include test ***
-<html>
-This is Finish.phtml. This file is supposed to be included
-from regression_test.phtml. This is normal HTML.
-and this is PHP code, 2+2=4
-</html>
-********************************
-
-Tests completed.
-<html>
-<head>
-*** Testing assignments and variable aliasing: ***
-This should read "blah": blah
-This should read "this is nifty": this is nifty
-*************************************************
-
-*** Testing integer operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing real operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing if/elseif/else control ***
-
-This works
-this_still_works
-should_print
-
-
-*** Seriously nested if's test ***
-** spelling correction by kluzz **
-Only two lines of text should follow:
-this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0
-this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4
-3 loop iterations should follow:
-2 4
-3 4
-4 4
-**********************************
-
-*** C-style else-if's ***
-This should be displayed
-*************************
-
-*** WHILE tests ***
-0 is smaller than 20
-1 is smaller than 20
-2 is smaller than 20
-3 is smaller than 20
-4 is smaller than 20
-5 is smaller than 20
-6 is smaller than 20
-7 is smaller than 20
-8 is smaller than 20
-9 is smaller than 20
-10 is smaller than 20
-11 is smaller than 20
-12 is smaller than 20
-13 is smaller than 20
-14 is smaller than 20
-15 is smaller than 20
-16 is smaller than 20
-17 is smaller than 20
-18 is smaller than 20
-19 is smaller than 20
-20 equals 20
-21 is greater than 20
-22 is greater than 20
-23 is greater than 20
-24 is greater than 20
-25 is greater than 20
-26 is greater than 20
-27 is greater than 20
-28 is greater than 20
-29 is greater than 20
-30 is greater than 20
-31 is greater than 20
-32 is greater than 20
-33 is greater than 20
-34 is greater than 20
-35 is greater than 20
-36 is greater than 20
-37 is greater than 20
-38 is greater than 20
-39 is greater than 20
-*******************
-
-
-*** Nested WHILEs ***
-Each array variable should be equal to the sum of its indices:
-${test00}[0] = 0
-${test00}[1] = 1
-${test00}[2] = 2
-${test01}[0] = 1
-${test01}[1] = 2
-${test01}[2] = 3
-${test02}[0] = 2
-${test02}[1] = 3
-${test02}[2] = 4
-${test10}[0] = 1
-${test10}[1] = 2
-${test10}[2] = 3
-${test11}[0] = 2
-${test11}[1] = 3
-${test11}[2] = 4
-${test12}[0] = 3
-${test12}[1] = 4
-${test12}[2] = 5
-${test20}[0] = 2
-${test20}[1] = 3
-${test20}[2] = 4
-${test21}[0] = 3
-${test21}[1] = 4
-${test21}[2] = 5
-${test22}[0] = 4
-${test22}[1] = 5
-${test22}[2] = 6
-*********************
-
-*** hash test... ***
-commented out...
-**************************
-
-*** Hash resizing test ***
-ba
-baa
-baaa
-baaaa
-baaaaa
-baaaaaa
-baaaaaaa
-baaaaaaaa
-baaaaaaaaa
-baaaaaaaaaa
-ba
-10
-baa
-9
-baaa
-8
-baaaa
-7
-baaaaa
-6
-baaaaaa
-5
-baaaaaaa
-4
-baaaaaaaa
-3
-baaaaaaaaa
-2
-baaaaaaaaaa
-1
-**************************
-
-
-*** break/continue test ***
-$i should go from 0 to 2
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=0
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=1
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=2
-***********************
-
-*** Nested file include test ***
-<html>
-This is Finish.phtml. This file is supposed to be included
-from regression_test.phtml. This is normal HTML.
-and this is PHP code, 2+2=4
-</html>
-********************************
-
-Tests completed.
-<html>
-<head>
-*** Testing assignments and variable aliasing: ***
-This should read "blah": blah
-This should read "this is nifty": this is nifty
-*************************************************
-
-*** Testing integer operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing real operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing if/elseif/else control ***
-
-This works
-this_still_works
-should_print
-
-
-*** Seriously nested if's test ***
-** spelling correction by kluzz **
-Only two lines of text should follow:
-this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0
-this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4
-3 loop iterations should follow:
-2 4
-3 4
-4 4
-**********************************
-
-*** C-style else-if's ***
-This should be displayed
-*************************
-
-*** WHILE tests ***
-0 is smaller than 20
-1 is smaller than 20
-2 is smaller than 20
-3 is smaller than 20
-4 is smaller than 20
-5 is smaller than 20
-6 is smaller than 20
-7 is smaller than 20
-8 is smaller than 20
-9 is smaller than 20
-10 is smaller than 20
-11 is smaller than 20
-12 is smaller than 20
-13 is smaller than 20
-14 is smaller than 20
-15 is smaller than 20
-16 is smaller than 20
-17 is smaller than 20
-18 is smaller than 20
-19 is smaller than 20
-20 equals 20
-21 is greater than 20
-22 is greater than 20
-23 is greater than 20
-24 is greater than 20
-25 is greater than 20
-26 is greater than 20
-27 is greater than 20
-28 is greater than 20
-29 is greater than 20
-30 is greater than 20
-31 is greater than 20
-32 is greater than 20
-33 is greater than 20
-34 is greater than 20
-35 is greater than 20
-36 is greater than 20
-37 is greater than 20
-38 is greater than 20
-39 is greater than 20
-*******************
-
-
-*** Nested WHILEs ***
-Each array variable should be equal to the sum of its indices:
-${test00}[0] = 0
-${test00}[1] = 1
-${test00}[2] = 2
-${test01}[0] = 1
-${test01}[1] = 2
-${test01}[2] = 3
-${test02}[0] = 2
-${test02}[1] = 3
-${test02}[2] = 4
-${test10}[0] = 1
-${test10}[1] = 2
-${test10}[2] = 3
-${test11}[0] = 2
-${test11}[1] = 3
-${test11}[2] = 4
-${test12}[0] = 3
-${test12}[1] = 4
-${test12}[2] = 5
-${test20}[0] = 2
-${test20}[1] = 3
-${test20}[2] = 4
-${test21}[0] = 3
-${test21}[1] = 4
-${test21}[2] = 5
-${test22}[0] = 4
-${test22}[1] = 5
-${test22}[2] = 6
-*********************
-
-*** hash test... ***
-commented out...
-**************************
-
-*** Hash resizing test ***
-ba
-baa
-baaa
-baaaa
-baaaaa
-baaaaaa
-baaaaaaa
-baaaaaaaa
-baaaaaaaaa
-baaaaaaaaaa
-ba
-10
-baa
-9
-baaa
-8
-baaaa
-7
-baaaaa
-6
-baaaaaa
-5
-baaaaaaa
-4
-baaaaaaaa
-3
-baaaaaaaaa
-2
-baaaaaaaaaa
-1
-**************************
-
-
-*** break/continue test ***
-$i should go from 0 to 2
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=0
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=1
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=2
-***********************
-
-*** Nested file include test ***
-<html>
-This is Finish.phtml. This file is supposed to be included
-from regression_test.phtml. This is normal HTML.
-and this is PHP code, 2+2=4
-</html>
-********************************
-
-Tests completed.
-<html>
-<head>
-*** Testing assignments and variable aliasing: ***
-This should read "blah": blah
-This should read "this is nifty": this is nifty
-*************************************************
-
-*** Testing integer operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing real operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing if/elseif/else control ***
-
-This works
-this_still_works
-should_print
-
-
-*** Seriously nested if's test ***
-** spelling correction by kluzz **
-Only two lines of text should follow:
-this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0
-this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4
-3 loop iterations should follow:
-2 4
-3 4
-4 4
-**********************************
-
-*** C-style else-if's ***
-This should be displayed
-*************************
-
-*** WHILE tests ***
-0 is smaller than 20
-1 is smaller than 20
-2 is smaller than 20
-3 is smaller than 20
-4 is smaller than 20
-5 is smaller than 20
-6 is smaller than 20
-7 is smaller than 20
-8 is smaller than 20
-9 is smaller than 20
-10 is smaller than 20
-11 is smaller than 20
-12 is smaller than 20
-13 is smaller than 20
-14 is smaller than 20
-15 is smaller than 20
-16 is smaller than 20
-17 is smaller than 20
-18 is smaller than 20
-19 is smaller than 20
-20 equals 20
-21 is greater than 20
-22 is greater than 20
-23 is greater than 20
-24 is greater than 20
-25 is greater than 20
-26 is greater than 20
-27 is greater than 20
-28 is greater than 20
-29 is greater than 20
-30 is greater than 20
-31 is greater than 20
-32 is greater than 20
-33 is greater than 20
-34 is greater than 20
-35 is greater than 20
-36 is greater than 20
-37 is greater than 20
-38 is greater than 20
-39 is greater than 20
-*******************
-
-
-*** Nested WHILEs ***
-Each array variable should be equal to the sum of its indices:
-${test00}[0] = 0
-${test00}[1] = 1
-${test00}[2] = 2
-${test01}[0] = 1
-${test01}[1] = 2
-${test01}[2] = 3
-${test02}[0] = 2
-${test02}[1] = 3
-${test02}[2] = 4
-${test10}[0] = 1
-${test10}[1] = 2
-${test10}[2] = 3
-${test11}[0] = 2
-${test11}[1] = 3
-${test11}[2] = 4
-${test12}[0] = 3
-${test12}[1] = 4
-${test12}[2] = 5
-${test20}[0] = 2
-${test20}[1] = 3
-${test20}[2] = 4
-${test21}[0] = 3
-${test21}[1] = 4
-${test21}[2] = 5
-${test22}[0] = 4
-${test22}[1] = 5
-${test22}[2] = 6
-*********************
-
-*** hash test... ***
-commented out...
-**************************
-
-*** Hash resizing test ***
-ba
-baa
-baaa
-baaaa
-baaaaa
-baaaaaa
-baaaaaaa
-baaaaaaaa
-baaaaaaaaa
-baaaaaaaaaa
-ba
-10
-baa
-9
-baaa
-8
-baaaa
-7
-baaaaa
-6
-baaaaaa
-5
-baaaaaaa
-4
-baaaaaaaa
-3
-baaaaaaaaa
-2
-baaaaaaaaaa
-1
-**************************
-
-
-*** break/continue test ***
-$i should go from 0 to 2
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=0
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=1
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=2
-***********************
-
-*** Nested file include test ***
-<html>
-This is Finish.phtml. This file is supposed to be included
-from regression_test.phtml. This is normal HTML.
-and this is PHP code, 2+2=4
-</html>
-********************************
-
-Tests completed.
-<html>
-<head>
-*** Testing assignments and variable aliasing: ***
-This should read "blah": blah
-This should read "this is nifty": this is nifty
-*************************************************
-
-*** Testing integer operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing real operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing if/elseif/else control ***
-
-This works
-this_still_works
-should_print
-
-
-*** Seriously nested if's test ***
-** spelling correction by kluzz **
-Only two lines of text should follow:
-this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0
-this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4
-3 loop iterations should follow:
-2 4
-3 4
-4 4
-**********************************
-
-*** C-style else-if's ***
-This should be displayed
-*************************
-
-*** WHILE tests ***
-0 is smaller than 20
-1 is smaller than 20
-2 is smaller than 20
-3 is smaller than 20
-4 is smaller than 20
-5 is smaller than 20
-6 is smaller than 20
-7 is smaller than 20
-8 is smaller than 20
-9 is smaller than 20
-10 is smaller than 20
-11 is smaller than 20
-12 is smaller than 20
-13 is smaller than 20
-14 is smaller than 20
-15 is smaller than 20
-16 is smaller than 20
-17 is smaller than 20
-18 is smaller than 20
-19 is smaller than 20
-20 equals 20
-21 is greater than 20
-22 is greater than 20
-23 is greater than 20
-24 is greater than 20
-25 is greater than 20
-26 is greater than 20
-27 is greater than 20
-28 is greater than 20
-29 is greater than 20
-30 is greater than 20
-31 is greater than 20
-32 is greater than 20
-33 is greater than 20
-34 is greater than 20
-35 is greater than 20
-36 is greater than 20
-37 is greater than 20
-38 is greater than 20
-39 is greater than 20
-*******************
-
-
-*** Nested WHILEs ***
-Each array variable should be equal to the sum of its indices:
-${test00}[0] = 0
-${test00}[1] = 1
-${test00}[2] = 2
-${test01}[0] = 1
-${test01}[1] = 2
-${test01}[2] = 3
-${test02}[0] = 2
-${test02}[1] = 3
-${test02}[2] = 4
-${test10}[0] = 1
-${test10}[1] = 2
-${test10}[2] = 3
-${test11}[0] = 2
-${test11}[1] = 3
-${test11}[2] = 4
-${test12}[0] = 3
-${test12}[1] = 4
-${test12}[2] = 5
-${test20}[0] = 2
-${test20}[1] = 3
-${test20}[2] = 4
-${test21}[0] = 3
-${test21}[1] = 4
-${test21}[2] = 5
-${test22}[0] = 4
-${test22}[1] = 5
-${test22}[2] = 6
-*********************
-
-*** hash test... ***
-commented out...
-**************************
-
-*** Hash resizing test ***
-ba
-baa
-baaa
-baaaa
-baaaaa
-baaaaaa
-baaaaaaa
-baaaaaaaa
-baaaaaaaaa
-baaaaaaaaaa
-ba
-10
-baa
-9
-baaa
-8
-baaaa
-7
-baaaaa
-6
-baaaaaa
-5
-baaaaaaa
-4
-baaaaaaaa
-3
-baaaaaaaaa
-2
-baaaaaaaaaa
-1
-**************************
-
-
-*** break/continue test ***
-$i should go from 0 to 2
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=0
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=1
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=2
-***********************
-
-*** Nested file include test ***
-<html>
-This is Finish.phtml. This file is supposed to be included
-from regression_test.phtml. This is normal HTML.
-and this is PHP code, 2+2=4
-</html>
-********************************
-
-Tests completed.
-<html>
-<head>
-*** Testing assignments and variable aliasing: ***
-This should read "blah": blah
-This should read "this is nifty": this is nifty
-*************************************************
-
-*** Testing integer operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing real operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing if/elseif/else control ***
-
-This works
-this_still_works
-should_print
-
-
-*** Seriously nested if's test ***
-** spelling correction by kluzz **
-Only two lines of text should follow:
-this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0
-this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4
-3 loop iterations should follow:
-2 4
-3 4
-4 4
-**********************************
-
-*** C-style else-if's ***
-This should be displayed
-*************************
-
-*** WHILE tests ***
-0 is smaller than 20
-1 is smaller than 20
-2 is smaller than 20
-3 is smaller than 20
-4 is smaller than 20
-5 is smaller than 20
-6 is smaller than 20
-7 is smaller than 20
-8 is smaller than 20
-9 is smaller than 20
-10 is smaller than 20
-11 is smaller than 20
-12 is smaller than 20
-13 is smaller than 20
-14 is smaller than 20
-15 is smaller than 20
-16 is smaller than 20
-17 is smaller than 20
-18 is smaller than 20
-19 is smaller than 20
-20 equals 20
-21 is greater than 20
-22 is greater than 20
-23 is greater than 20
-24 is greater than 20
-25 is greater than 20
-26 is greater than 20
-27 is greater than 20
-28 is greater than 20
-29 is greater than 20
-30 is greater than 20
-31 is greater than 20
-32 is greater than 20
-33 is greater than 20
-34 is greater than 20
-35 is greater than 20
-36 is greater than 20
-37 is greater than 20
-38 is greater than 20
-39 is greater than 20
-*******************
-
-
-*** Nested WHILEs ***
-Each array variable should be equal to the sum of its indices:
-${test00}[0] = 0
-${test00}[1] = 1
-${test00}[2] = 2
-${test01}[0] = 1
-${test01}[1] = 2
-${test01}[2] = 3
-${test02}[0] = 2
-${test02}[1] = 3
-${test02}[2] = 4
-${test10}[0] = 1
-${test10}[1] = 2
-${test10}[2] = 3
-${test11}[0] = 2
-${test11}[1] = 3
-${test11}[2] = 4
-${test12}[0] = 3
-${test12}[1] = 4
-${test12}[2] = 5
-${test20}[0] = 2
-${test20}[1] = 3
-${test20}[2] = 4
-${test21}[0] = 3
-${test21}[1] = 4
-${test21}[2] = 5
-${test22}[0] = 4
-${test22}[1] = 5
-${test22}[2] = 6
-*********************
-
-*** hash test... ***
-commented out...
-**************************
-
-*** Hash resizing test ***
-ba
-baa
-baaa
-baaaa
-baaaaa
-baaaaaa
-baaaaaaa
-baaaaaaaa
-baaaaaaaaa
-baaaaaaaaaa
-ba
-10
-baa
-9
-baaa
-8
-baaaa
-7
-baaaaa
-6
-baaaaaa
-5
-baaaaaaa
-4
-baaaaaaaa
-3
-baaaaaaaaa
-2
-baaaaaaaaaa
-1
-**************************
-
-
-*** break/continue test ***
-$i should go from 0 to 2
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=0
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=1
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=2
-***********************
-
-*** Nested file include test ***
-<html>
-This is Finish.phtml. This file is supposed to be included
-from regression_test.phtml. This is normal HTML.
-and this is PHP code, 2+2=4
-</html>
-********************************
-
-Tests completed.
-<html>
-<head>
-*** Testing assignments and variable aliasing: ***
-This should read "blah": blah
-This should read "this is nifty": this is nifty
-*************************************************
-
-*** Testing integer operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing real operators ***
-Correct result - 8: 8
-Correct result - 8: 8
-Correct result - 2: 2
-Correct result - -2: -2
-Correct result - 15: 15
-Correct result - 15: 15
-Correct result - 2: 2
-Correct result - 3: 3
-*********************************
-
-*** Testing if/elseif/else control ***
-
-This works
-this_still_works
-should_print
-
-
-*** Seriously nested if's test ***
-** spelling correction by kluzz **
-Only two lines of text should follow:
-this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0
-this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4
-3 loop iterations should follow:
-2 4
-3 4
-4 4
-**********************************
-
-*** C-style else-if's ***
-This should be displayed
-*************************
-
-*** WHILE tests ***
-0 is smaller than 20
-1 is smaller than 20
-2 is smaller than 20
-3 is smaller than 20
-4 is smaller than 20
-5 is smaller than 20
-6 is smaller than 20
-7 is smaller than 20
-8 is smaller than 20
-9 is smaller than 20
-10 is smaller than 20
-11 is smaller than 20
-12 is smaller than 20
-13 is smaller than 20
-14 is smaller than 20
-15 is smaller than 20
-16 is smaller than 20
-17 is smaller than 20
-18 is smaller than 20
-19 is smaller than 20
-20 equals 20
-21 is greater than 20
-22 is greater than 20
-23 is greater than 20
-24 is greater than 20
-25 is greater than 20
-26 is greater than 20
-27 is greater than 20
-28 is greater than 20
-29 is greater than 20
-30 is greater than 20
-31 is greater than 20
-32 is greater than 20
-33 is greater than 20
-34 is greater than 20
-35 is greater than 20
-36 is greater than 20
-37 is greater than 20
-38 is greater than 20
-39 is greater than 20
-*******************
-
-
-*** Nested WHILEs ***
-Each array variable should be equal to the sum of its indices:
-${test00}[0] = 0
-${test00}[1] = 1
-${test00}[2] = 2
-${test01}[0] = 1
-${test01}[1] = 2
-${test01}[2] = 3
-${test02}[0] = 2
-${test02}[1] = 3
-${test02}[2] = 4
-${test10}[0] = 1
-${test10}[1] = 2
-${test10}[2] = 3
-${test11}[0] = 2
-${test11}[1] = 3
-${test11}[2] = 4
-${test12}[0] = 3
-${test12}[1] = 4
-${test12}[2] = 5
-${test20}[0] = 2
-${test20}[1] = 3
-${test20}[2] = 4
-${test21}[0] = 3
-${test21}[1] = 4
-${test21}[2] = 5
-${test22}[0] = 4
-${test22}[1] = 5
-${test22}[2] = 6
-*********************
-
-*** hash test... ***
-commented out...
-**************************
-
-*** Hash resizing test ***
-ba
-baa
-baaa
-baaaa
-baaaaa
-baaaaaa
-baaaaaaa
-baaaaaaaa
-baaaaaaaaa
-baaaaaaaaaa
-ba
-10
-baa
-9
-baaa
-8
-baaaa
-7
-baaaaa
-6
-baaaaaa
-5
-baaaaaaa
-4
-baaaaaaaa
-3
-baaaaaaaaa
-2
-baaaaaaaaaa
-1
-**************************
-
-
-*** break/continue test ***
-$i should go from 0 to 2
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=0
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=1
-$j should go from 3 to 4, and $q should go from 3 to 4
- $j=3
- $q=3
- $q=4
- $j=4
- $q=3
- $q=4
-$j should go from 0 to 2
- $j=0
- $j=1
- $j=2
-$k should go from 0 to 2
- $k=0
- $k=1
- $k=2
-$i=2
-***********************
-
-*** Nested file include test ***
-<html>
-This is Finish.phtml. This file is supposed to be included
-from regression_test.phtml. This is normal HTML.
-and this is PHP code, 2+2=4
-</html>
-********************************
-
-Tests completed.
diff --git a/tests/lang/025.phpt b/tests/lang/025.phpt
deleted file mode 100644
index 34e0e8d6f4..0000000000
--- a/tests/lang/025.phpt
+++ /dev/null
@@ -1,540 +0,0 @@
---TEST--
-Mean recursion test
---POST--
---GET--
---FILE--
-<?php
-old_function RekTest $nr (
-
-echo " $nr ";
-
-
-$j=$nr+1;
-while ($j < 10)
-{
- echo " a ";
- RekTest($j);
- $j++;
- echo " b $j ";
-};
-echo "\n";
-
-
-
-);
-
-RekTest(0);
-?>
---EXPECT--
- 0 a 1 a 2 a 3 a 4 a 5 a 6 a 7 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 8 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 7 a 7 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 8 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 6 a 6 a 7 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 8 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 7 a 7 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 8 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 5 a 5 a 6 a 7 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 8 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 7 a 7 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 8 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 6 a 6 a 7 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 8 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 7 a 7 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 8 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 4 a 4 a 5 a 6 a 7 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 8 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 7 a 7 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 8 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 6 a 6 a 7 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 8 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 7 a 7 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 8 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 5 a 5 a 6 a 7 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 8 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 7 a 7 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 8 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 6 a 6 a 7 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 8 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 7 a 7 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 8 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 3 a 3 a 4 a 5 a 6 a 7 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 8 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 7 a 7 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 8 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 6 a 6 a 7 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 8 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 7 a 7 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 8 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 5 a 5 a 6 a 7 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 8 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 7 a 7 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 8 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 6 a 6 a 7 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 8 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 7 a 7 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 8 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 4 a 4 a 5 a 6 a 7 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 8 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 7 a 7 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 8 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 6 a 6 a 7 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 8 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 7 a 7 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 8 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 5 a 5 a 6 a 7 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 8 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 7 a 7 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 8 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 6 a 6 a 7 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 8 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 7 a 7 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 8 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 2 a 2 a 3 a 4 a 5 a 6 a 7 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 8 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 7 a 7 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 8 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 6 a 6 a 7 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 8 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 7 a 7 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 8 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 5 a 5 a 6 a 7 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 8 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 7 a 7 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 8 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 6 a 6 a 7 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 8 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 7 a 7 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 8 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 4 a 4 a 5 a 6 a 7 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 8 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 7 a 7 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 8 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 6 a 6 a 7 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 8 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 7 a 7 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 8 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 5 a 5 a 6 a 7 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 8 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 7 a 7 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 8 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 6 a 6 a 7 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 8 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 7 a 7 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 8 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 3 a 3 a 4 a 5 a 6 a 7 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 8 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 7 a 7 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 8 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 6 a 6 a 7 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 8 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 7 a 7 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 8 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 5 a 5 a 6 a 7 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 8 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 7 a 7 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 8 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 6 a 6 a 7 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 8 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 7 a 7 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 8 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 4 a 4 a 5 a 6 a 7 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 8 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 7 a 7 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 8 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 6 a 6 a 7 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 8 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 7 a 7 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 8 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 5 a 5 a 6 a 7 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 8 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 7 a 7 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 8 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 6 a 6 a 7 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 8 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 7 a 7 a 8 a 9
- b 10
- b 9 a 9
- b 10
- b 8 a 8 a 9
- b 10
- b 9 a 9
- b 10
diff --git a/tests/lang/026.phpt b/tests/lang/026.phpt
deleted file mode 100644
index e201b75638..0000000000
--- a/tests/lang/026.phpt
+++ /dev/null
@@ -1,8 +0,0 @@
---TEST--
-Testing string scanner confirmance
---POST--
---GET--
---FILE--
-<?php echo "\"\t\\'" . '\n\\\'a\\\b\\' ?>
---EXPECT--
-" \'\n\'a\\b\
diff --git a/tests/lang/027.phpt b/tests/lang/027.phpt
deleted file mode 100644
index 5cd44e0fab..0000000000
--- a/tests/lang/027.phpt
+++ /dev/null
@@ -1,14 +0,0 @@
---TEST--
-Testing do-while loop
---POST--
---GET--
---FILE--
-<?php
-$i=3;
-do {
- echo $i;
- $i--;
-} while($i>0);
-?>
---EXPECT--
-321
diff --git a/tests/lang/028.phpt b/tests/lang/028.phpt
deleted file mode 100644
index 4d95960dd3..0000000000
--- a/tests/lang/028.phpt
+++ /dev/null
@@ -1,1060 +0,0 @@
---TEST--
-Testing calling user-level functions from C
---POST--
---GET--
---FILE--
-<?php
-
-error_reporting(1023);
-
-function print_stuff($stuff)
-{
- print $stuff;
-}
-
-
-function still_working()
-{
- return "I'm still alive";
-}
-
-function dafna()
-{
- static $foo = 0;
-
- print "Dafna!\n";
- print call_user_func("still_working")."\n";
- $foo++;
- return (string) $foo;
-}
-
-
-class dafna_class {
- function dafna_class() {
- $this->myname = "Dafna";
- }
- function GetMyName() {
- return $this->myname;
- }
- function SetMyName($name) {
- $this->myname = $name;
- }
-};
-
-for ($i=0; $i<200; $i++):
- print "$i\n";
- call_user_func("dafna");
- call_user_func("print_stuff","Hey there!!\n");
- print "$i\n";
-endfor;
-
-
-$dafna = new dafna_class();
-
-print $name=call_user_func(array(&$dafna,"GetMyName"));
-print "\n";
-
-?>
---EXPECT--
-0
-Dafna!
-I'm still alive
-Hey there!!
-0
-1
-Dafna!
-I'm still alive
-Hey there!!
-1
-2
-Dafna!
-I'm still alive
-Hey there!!
-2
-3
-Dafna!
-I'm still alive
-Hey there!!
-3
-4
-Dafna!
-I'm still alive
-Hey there!!
-4
-5
-Dafna!
-I'm still alive
-Hey there!!
-5
-6
-Dafna!
-I'm still alive
-Hey there!!
-6
-7
-Dafna!
-I'm still alive
-Hey there!!
-7
-8
-Dafna!
-I'm still alive
-Hey there!!
-8
-9
-Dafna!
-I'm still alive
-Hey there!!
-9
-10
-Dafna!
-I'm still alive
-Hey there!!
-10
-11
-Dafna!
-I'm still alive
-Hey there!!
-11
-12
-Dafna!
-I'm still alive
-Hey there!!
-12
-13
-Dafna!
-I'm still alive
-Hey there!!
-13
-14
-Dafna!
-I'm still alive
-Hey there!!
-14
-15
-Dafna!
-I'm still alive
-Hey there!!
-15
-16
-Dafna!
-I'm still alive
-Hey there!!
-16
-17
-Dafna!
-I'm still alive
-Hey there!!
-17
-18
-Dafna!
-I'm still alive
-Hey there!!
-18
-19
-Dafna!
-I'm still alive
-Hey there!!
-19
-20
-Dafna!
-I'm still alive
-Hey there!!
-20
-21
-Dafna!
-I'm still alive
-Hey there!!
-21
-22
-Dafna!
-I'm still alive
-Hey there!!
-22
-23
-Dafna!
-I'm still alive
-Hey there!!
-23
-24
-Dafna!
-I'm still alive
-Hey there!!
-24
-25
-Dafna!
-I'm still alive
-Hey there!!
-25
-26
-Dafna!
-I'm still alive
-Hey there!!
-26
-27
-Dafna!
-I'm still alive
-Hey there!!
-27
-28
-Dafna!
-I'm still alive
-Hey there!!
-28
-29
-Dafna!
-I'm still alive
-Hey there!!
-29
-30
-Dafna!
-I'm still alive
-Hey there!!
-30
-31
-Dafna!
-I'm still alive
-Hey there!!
-31
-32
-Dafna!
-I'm still alive
-Hey there!!
-32
-33
-Dafna!
-I'm still alive
-Hey there!!
-33
-34
-Dafna!
-I'm still alive
-Hey there!!
-34
-35
-Dafna!
-I'm still alive
-Hey there!!
-35
-36
-Dafna!
-I'm still alive
-Hey there!!
-36
-37
-Dafna!
-I'm still alive
-Hey there!!
-37
-38
-Dafna!
-I'm still alive
-Hey there!!
-38
-39
-Dafna!
-I'm still alive
-Hey there!!
-39
-40
-Dafna!
-I'm still alive
-Hey there!!
-40
-41
-Dafna!
-I'm still alive
-Hey there!!
-41
-42
-Dafna!
-I'm still alive
-Hey there!!
-42
-43
-Dafna!
-I'm still alive
-Hey there!!
-43
-44
-Dafna!
-I'm still alive
-Hey there!!
-44
-45
-Dafna!
-I'm still alive
-Hey there!!
-45
-46
-Dafna!
-I'm still alive
-Hey there!!
-46
-47
-Dafna!
-I'm still alive
-Hey there!!
-47
-48
-Dafna!
-I'm still alive
-Hey there!!
-48
-49
-Dafna!
-I'm still alive
-Hey there!!
-49
-50
-Dafna!
-I'm still alive
-Hey there!!
-50
-51
-Dafna!
-I'm still alive
-Hey there!!
-51
-52
-Dafna!
-I'm still alive
-Hey there!!
-52
-53
-Dafna!
-I'm still alive
-Hey there!!
-53
-54
-Dafna!
-I'm still alive
-Hey there!!
-54
-55
-Dafna!
-I'm still alive
-Hey there!!
-55
-56
-Dafna!
-I'm still alive
-Hey there!!
-56
-57
-Dafna!
-I'm still alive
-Hey there!!
-57
-58
-Dafna!
-I'm still alive
-Hey there!!
-58
-59
-Dafna!
-I'm still alive
-Hey there!!
-59
-60
-Dafna!
-I'm still alive
-Hey there!!
-60
-61
-Dafna!
-I'm still alive
-Hey there!!
-61
-62
-Dafna!
-I'm still alive
-Hey there!!
-62
-63
-Dafna!
-I'm still alive
-Hey there!!
-63
-64
-Dafna!
-I'm still alive
-Hey there!!
-64
-65
-Dafna!
-I'm still alive
-Hey there!!
-65
-66
-Dafna!
-I'm still alive
-Hey there!!
-66
-67
-Dafna!
-I'm still alive
-Hey there!!
-67
-68
-Dafna!
-I'm still alive
-Hey there!!
-68
-69
-Dafna!
-I'm still alive
-Hey there!!
-69
-70
-Dafna!
-I'm still alive
-Hey there!!
-70
-71
-Dafna!
-I'm still alive
-Hey there!!
-71
-72
-Dafna!
-I'm still alive
-Hey there!!
-72
-73
-Dafna!
-I'm still alive
-Hey there!!
-73
-74
-Dafna!
-I'm still alive
-Hey there!!
-74
-75
-Dafna!
-I'm still alive
-Hey there!!
-75
-76
-Dafna!
-I'm still alive
-Hey there!!
-76
-77
-Dafna!
-I'm still alive
-Hey there!!
-77
-78
-Dafna!
-I'm still alive
-Hey there!!
-78
-79
-Dafna!
-I'm still alive
-Hey there!!
-79
-80
-Dafna!
-I'm still alive
-Hey there!!
-80
-81
-Dafna!
-I'm still alive
-Hey there!!
-81
-82
-Dafna!
-I'm still alive
-Hey there!!
-82
-83
-Dafna!
-I'm still alive
-Hey there!!
-83
-84
-Dafna!
-I'm still alive
-Hey there!!
-84
-85
-Dafna!
-I'm still alive
-Hey there!!
-85
-86
-Dafna!
-I'm still alive
-Hey there!!
-86
-87
-Dafna!
-I'm still alive
-Hey there!!
-87
-88
-Dafna!
-I'm still alive
-Hey there!!
-88
-89
-Dafna!
-I'm still alive
-Hey there!!
-89
-90
-Dafna!
-I'm still alive
-Hey there!!
-90
-91
-Dafna!
-I'm still alive
-Hey there!!
-91
-92
-Dafna!
-I'm still alive
-Hey there!!
-92
-93
-Dafna!
-I'm still alive
-Hey there!!
-93
-94
-Dafna!
-I'm still alive
-Hey there!!
-94
-95
-Dafna!
-I'm still alive
-Hey there!!
-95
-96
-Dafna!
-I'm still alive
-Hey there!!
-96
-97
-Dafna!
-I'm still alive
-Hey there!!
-97
-98
-Dafna!
-I'm still alive
-Hey there!!
-98
-99
-Dafna!
-I'm still alive
-Hey there!!
-99
-100
-Dafna!
-I'm still alive
-Hey there!!
-100
-101
-Dafna!
-I'm still alive
-Hey there!!
-101
-102
-Dafna!
-I'm still alive
-Hey there!!
-102
-103
-Dafna!
-I'm still alive
-Hey there!!
-103
-104
-Dafna!
-I'm still alive
-Hey there!!
-104
-105
-Dafna!
-I'm still alive
-Hey there!!
-105
-106
-Dafna!
-I'm still alive
-Hey there!!
-106
-107
-Dafna!
-I'm still alive
-Hey there!!
-107
-108
-Dafna!
-I'm still alive
-Hey there!!
-108
-109
-Dafna!
-I'm still alive
-Hey there!!
-109
-110
-Dafna!
-I'm still alive
-Hey there!!
-110
-111
-Dafna!
-I'm still alive
-Hey there!!
-111
-112
-Dafna!
-I'm still alive
-Hey there!!
-112
-113
-Dafna!
-I'm still alive
-Hey there!!
-113
-114
-Dafna!
-I'm still alive
-Hey there!!
-114
-115
-Dafna!
-I'm still alive
-Hey there!!
-115
-116
-Dafna!
-I'm still alive
-Hey there!!
-116
-117
-Dafna!
-I'm still alive
-Hey there!!
-117
-118
-Dafna!
-I'm still alive
-Hey there!!
-118
-119
-Dafna!
-I'm still alive
-Hey there!!
-119
-120
-Dafna!
-I'm still alive
-Hey there!!
-120
-121
-Dafna!
-I'm still alive
-Hey there!!
-121
-122
-Dafna!
-I'm still alive
-Hey there!!
-122
-123
-Dafna!
-I'm still alive
-Hey there!!
-123
-124
-Dafna!
-I'm still alive
-Hey there!!
-124
-125
-Dafna!
-I'm still alive
-Hey there!!
-125
-126
-Dafna!
-I'm still alive
-Hey there!!
-126
-127
-Dafna!
-I'm still alive
-Hey there!!
-127
-128
-Dafna!
-I'm still alive
-Hey there!!
-128
-129
-Dafna!
-I'm still alive
-Hey there!!
-129
-130
-Dafna!
-I'm still alive
-Hey there!!
-130
-131
-Dafna!
-I'm still alive
-Hey there!!
-131
-132
-Dafna!
-I'm still alive
-Hey there!!
-132
-133
-Dafna!
-I'm still alive
-Hey there!!
-133
-134
-Dafna!
-I'm still alive
-Hey there!!
-134
-135
-Dafna!
-I'm still alive
-Hey there!!
-135
-136
-Dafna!
-I'm still alive
-Hey there!!
-136
-137
-Dafna!
-I'm still alive
-Hey there!!
-137
-138
-Dafna!
-I'm still alive
-Hey there!!
-138
-139
-Dafna!
-I'm still alive
-Hey there!!
-139
-140
-Dafna!
-I'm still alive
-Hey there!!
-140
-141
-Dafna!
-I'm still alive
-Hey there!!
-141
-142
-Dafna!
-I'm still alive
-Hey there!!
-142
-143
-Dafna!
-I'm still alive
-Hey there!!
-143
-144
-Dafna!
-I'm still alive
-Hey there!!
-144
-145
-Dafna!
-I'm still alive
-Hey there!!
-145
-146
-Dafna!
-I'm still alive
-Hey there!!
-146
-147
-Dafna!
-I'm still alive
-Hey there!!
-147
-148
-Dafna!
-I'm still alive
-Hey there!!
-148
-149
-Dafna!
-I'm still alive
-Hey there!!
-149
-150
-Dafna!
-I'm still alive
-Hey there!!
-150
-151
-Dafna!
-I'm still alive
-Hey there!!
-151
-152
-Dafna!
-I'm still alive
-Hey there!!
-152
-153
-Dafna!
-I'm still alive
-Hey there!!
-153
-154
-Dafna!
-I'm still alive
-Hey there!!
-154
-155
-Dafna!
-I'm still alive
-Hey there!!
-155
-156
-Dafna!
-I'm still alive
-Hey there!!
-156
-157
-Dafna!
-I'm still alive
-Hey there!!
-157
-158
-Dafna!
-I'm still alive
-Hey there!!
-158
-159
-Dafna!
-I'm still alive
-Hey there!!
-159
-160
-Dafna!
-I'm still alive
-Hey there!!
-160
-161
-Dafna!
-I'm still alive
-Hey there!!
-161
-162
-Dafna!
-I'm still alive
-Hey there!!
-162
-163
-Dafna!
-I'm still alive
-Hey there!!
-163
-164
-Dafna!
-I'm still alive
-Hey there!!
-164
-165
-Dafna!
-I'm still alive
-Hey there!!
-165
-166
-Dafna!
-I'm still alive
-Hey there!!
-166
-167
-Dafna!
-I'm still alive
-Hey there!!
-167
-168
-Dafna!
-I'm still alive
-Hey there!!
-168
-169
-Dafna!
-I'm still alive
-Hey there!!
-169
-170
-Dafna!
-I'm still alive
-Hey there!!
-170
-171
-Dafna!
-I'm still alive
-Hey there!!
-171
-172
-Dafna!
-I'm still alive
-Hey there!!
-172
-173
-Dafna!
-I'm still alive
-Hey there!!
-173
-174
-Dafna!
-I'm still alive
-Hey there!!
-174
-175
-Dafna!
-I'm still alive
-Hey there!!
-175
-176
-Dafna!
-I'm still alive
-Hey there!!
-176
-177
-Dafna!
-I'm still alive
-Hey there!!
-177
-178
-Dafna!
-I'm still alive
-Hey there!!
-178
-179
-Dafna!
-I'm still alive
-Hey there!!
-179
-180
-Dafna!
-I'm still alive
-Hey there!!
-180
-181
-Dafna!
-I'm still alive
-Hey there!!
-181
-182
-Dafna!
-I'm still alive
-Hey there!!
-182
-183
-Dafna!
-I'm still alive
-Hey there!!
-183
-184
-Dafna!
-I'm still alive
-Hey there!!
-184
-185
-Dafna!
-I'm still alive
-Hey there!!
-185
-186
-Dafna!
-I'm still alive
-Hey there!!
-186
-187
-Dafna!
-I'm still alive
-Hey there!!
-187
-188
-Dafna!
-I'm still alive
-Hey there!!
-188
-189
-Dafna!
-I'm still alive
-Hey there!!
-189
-190
-Dafna!
-I'm still alive
-Hey there!!
-190
-191
-Dafna!
-I'm still alive
-Hey there!!
-191
-192
-Dafna!
-I'm still alive
-Hey there!!
-192
-193
-Dafna!
-I'm still alive
-Hey there!!
-193
-194
-Dafna!
-I'm still alive
-Hey there!!
-194
-195
-Dafna!
-I'm still alive
-Hey there!!
-195
-196
-Dafna!
-I'm still alive
-Hey there!!
-196
-197
-Dafna!
-I'm still alive
-Hey there!!
-197
-198
-Dafna!
-I'm still alive
-Hey there!!
-198
-199
-Dafna!
-I'm still alive
-Hey there!!
-199
-Dafna
-
diff --git a/tests/lang/029.phpt b/tests/lang/029.phpt
deleted file mode 100644
index 6226d42880..0000000000
--- a/tests/lang/029.phpt
+++ /dev/null
@@ -1,30 +0,0 @@
---TEST--
-OO Bug Test (Bug #7515)
---POST--
---GET--
---FILE--
-<?php
-class obj {
- function method() {}
- }
-
-function test($o_copy) {
- $o_copy->root->set_in_copied_o=TRUE;
- var_dump($o_copy);?><BR><?php }
-
-$o->root=new obj();
-
-ob_start();
-var_dump($o);
-$x=ob_get_contents();
-ob_end_clean();
-
-$o->root->method();
-
-ob_start();
-var_dump($o);
-$y=ob_get_contents();
-ob_end_clean();
-echo ($x==$y) ? 'success':'failure'; ?>
---EXPECT--
-success
diff --git a/tests/lang/030.phpt b/tests/lang/030.phpt
deleted file mode 100644
index 162997fca9..0000000000
--- a/tests/lang/030.phpt
+++ /dev/null
@@ -1,33 +0,0 @@
---TEST--
-$this in constructor test
---POST--
---GET--
---FILE--
-<?php
-class foo {
- function foo($name) {
- $GLOBALS['List']= &$this;
- $this->Name = $name;
- $GLOBALS['List']->echoName(); }
-
- function echoName() {
- $GLOBALS['names'][]=$this->Name; } }
-
-function &foo2(&$foo) {
- return $foo; }
-
-
-$bar1 =& new foo('constructor');
-$bar1->Name = 'outside';
-$bar1->echoName();
-$List->echoName();
-
-$bar1 =& foo2(new foo('constructor'));
-$bar1->Name = 'outside';
-$bar1->echoName();
-
-$List->echoName();
-
-print ($names==array('constructor','outside','outside','constructor','outside','outside')) ? 'success':'failure'; ?>
---EXPECT--
-success \ No newline at end of file
diff --git a/tests/odbc-display.php b/tests/odbc-display.php
deleted file mode 100644
index f79a854aea..0000000000
--- a/tests/odbc-display.php
+++ /dev/null
@@ -1,19 +0,0 @@
-<?php
- if(($conn = odbc_connect($dsn, $dbuser, $dbpwd))){
- if(($res = odbc_do($conn, "select gif from php_test where id='$id'"))){
- odbc_binmode($res, 0);
- odbc_longreadlen($res, 0);
- if(odbc_fetch_row($res)){
- header("content-type: image/gif");
- odbc_result($res, 1);
- exit;
- }else{
- echo "Error in odbc_fetch_row";
- }
- } else {
- echo "Error in odbc_do";
- }
- } else {
- echo "Error in odbc_connect";
- }
-?>
diff --git a/tests/odbc-t1.php b/tests/odbc-t1.php
deleted file mode 100644
index 90cb97910f..0000000000
--- a/tests/odbc-t1.php
+++ /dev/null
@@ -1,38 +0,0 @@
-<HTML>
-<HEAD>
-<TITLE>Quick &amp; dirty ODBC test</TITLE>
-</HEAD>
-<BODY>
-<H1>ODBC Test 1 - Connection</H1>
-<?php
- if(isset($dbuser)){
- echo "Connecting to $dsn as $dbuser\n<P>";
- $conn = odbc_connect($dsn,$dbuser,$dbpwd);
- if(!$conn){
-?>
-<H2>Error connecting to database! Check DSN, username and password</H2>
-<?php
- }else{
-?>
-<H2>Connection successful</H2>
-<A HREF="odbc-t2.php<?php echo "?dbuser=$dbuser&dsn=$dsn&dbpwd=$dbpwd" ?>">Proceed to next test</A>
-| <A HREF="<?php echo $PHP_SELF ?>">Change login information</A>
-<?php
- }
-} else {
-?>
-<EM>You will need permisson to create tables for the following tests!</EM>
-<form action=odbc-t1.php method=post>
-<table border=0>
-<tr><td>Database (DSN): </td><td><input type=text name=dsn></td></tr>
-<tr><td>User: </td><td><input type=text name=dbuser></td></tr>
-<tr><td>Password: </td><td><input type=password name=dbpwd></td></tr>
-</table>
-<br>
-<input type=submit value=connect>
-
-</form>
-<?php
-} ?>
-</BODY>
-</HTML>
diff --git a/tests/odbc-t2.php b/tests/odbc-t2.php
deleted file mode 100644
index a500b09e8b..0000000000
--- a/tests/odbc-t2.php
+++ /dev/null
@@ -1,82 +0,0 @@
-<HTML>
-<HEAD>
-<TITLE>Quick &amp; dirty ODBC test #2</TITLE>
-</HEAD>
-<BODY>
-<H1>ODBC Test 2 - Create table</H1>
-<?php
- if(isset($dbuser)){
- echo "Connecting to $dsn as $dbuser\n";
- $conn = odbc_connect($dsn,$dbuser,$dbpwd);
- if(!$conn){
-?>
-<H2>Error connecting to database! Check DSN, username and password</H2>
-<?php
- }else{
-?>
-- OK<p>
-Dropping table "php3_test"
-<?php
- Error_Reporting(0);
- $res = odbc_exec($conn,"drop table php_test");
- if($res){
- odbc_free_result($res);
- }
-?>
-- OK<p>
-Create table "php_test"
-<?php
- error_reporting(1);
- $res = odbc_exec($conn, 'create table php_test (a char(16), b integer, c float, d varchar(128))');
- if($res){
- odbc_free_result($res);
-?>
- - OK<p>
-Table Info:<br>
-<table>
- <tr>
- <th>Name</th>
- <th>Type</th>
- <th>Length</th>
- </tr>
-<?php
- $info = odbc_exec($conn,"select * from php_test");
- $numfields = odbc_num_fields($info);
-
- for($i=1; $i<=$numfields; $i++){
-?>
- <tr>
- <td><?php echo odbc_field_name($info, $i) ?></td>
- <td><?php echo odbc_field_type($info, $i) ?></td>
- <td><?php echo odbc_field_len($info,$i) ?></td>
- </tr>
-<?php
- }
-?>
-</table>
-<P>
-<HR width=50%">
-<P>
-<A HREF="odbc-t3.php<?php echo "?dbuser=$dbuser&dsn=$dsn&dbpwd=$dbpwd" ?>">Proceed to next test</A>
-| <A HREF="<?php echo $PHP_SELF; ?>">Change login information</A>
-
-<?php
- }
- }
- } else {
-?>
-
-<form action="odbc-t3.php" method=post>
-<table border=0>
-<tr><td>Database (DSN): </td><td><input type=text name=dsn></td></tr>
-<tr><td>User: </td><td><input type=text name=dbuser></td></tr>
-<tr><td>Password: </td><td><input type=password name=dbpwd></td></tr>
-</table>
-<input type=submit value="Continue">
-</form>
-
-<?php
- }
-?>
-</BODY>
-</HTML>
diff --git a/tests/odbc-t3.php b/tests/odbc-t3.php
deleted file mode 100644
index edfdc658f8..0000000000
--- a/tests/odbc-t3.php
+++ /dev/null
@@ -1,95 +0,0 @@
-<HTML>
-<HEAD>
-<TITLE>Database test #3</TITLE>
-</HEAD>
-<BODY>
-<H1>ODBC Test 3 - Insert records</H1>
-<?php
- if(isset($dbuser)){
- echo "Connecting to $dsn as $dbuser\n";
- $conn = odbc_connect($dsn,$dbuser,$dbpwd);
- if(!$conn){
-?>
-<H2>Error connecting to database! Check DSN, username and password</H2>
-<?php
- }else{
-?>
- - OK<p>
-Clearing table "php_test"
-<?php
- error_reporting(0);
- $res=odbc_exec($conn,"delete from php_test");
- odbc_free_result($res);
- error_reporting(1);
-?>
- - OK<p>
-Inserting into table "php_test"
-<?php
- $sqlfloat = '00.0';
- $sqlint = 1000;
- $stmt = odbc_prepare($conn, "insert into php_test values(?,?,?,?)");
- for($i=1; $i<=5; $i++){
- $values[0] = "test-$i";
- $values[1] = $sqlint + $i;
- $values[2] = $i . $sqlfloat . $i;
- $values[3] = "php - values $i";
- $ret = odbc_execute($stmt, &$values);
- }
- odbc_free_result($stmt);
- $res = odbc_exec($conn, "select count(*) from php_test");
- if($res && (odbc_result($res, 1) == 5)){
- odbc_free_result($res);
-?>
- - OK<p>
-<H3>The table "php_test" should now contain the following values:</H3>
-<table>
- <tr>
- <th>A</th><th>B</th><th>C</th><th>D</th>
- </tr>
- <tr>
- <td>test-1</td><td>1001</td><td>100.01</td><td>php - values 1</td>
- </tr>
- <tr>
- <td>test-2</td><td>1002</td><td>200.02</td><td>php - values 2</td>
- </tr>
- <tr>
- <td>test-3</td><td>1003</td><td>300.03</td><td>php - values 3</td>
- </tr>
- <tr>
- <td>test-4</td><td>1004</td><td>400.04</td><td>php - values 4</td>
- </tr>
- <tr>
- <td>test-5</td><td>1005</td><td>500.05</td><td>php - values 5</td>
- </tr>
-</table>
-
-<H3>Actual contents of table "php_test":</H3>
-<?php
- $res = odbc_exec($conn, "select * from php_test");
- odbc_result_all($res);
- }
-?>
-<p>
- <HR width="50%">
-<p>
-<A HREF="odbc-t4.php?dbuser=<?php echo "$dbuser&dsn=$dsn&dbpwd=$dbpwd" ?>">Proceed to next test</A>
-| <A HREF="<?php echo $PHP_SELF ?>">Change login information</A>
-<?php
- }
- } else {
-?>
-<form action=odbc-t3.php method=post>
-<table border=0>
- <tr><td>Database: </td><td><input type=text name=dsn></td></tr>
- <tr><td>User: </td><td><input type=text name=dbuser></td></tr>
- <tr><td>Password: </td><td><input type=password name=dbpwd></td></tr>
-</table>
-<input type=submit value=connect>
-
-</form>
-<?php
- }
-?>
-</BODY>
-</HTML>
-
diff --git a/tests/odbc-t4.php b/tests/odbc-t4.php
deleted file mode 100644
index 10e8f4b2d9..0000000000
--- a/tests/odbc-t4.php
+++ /dev/null
@@ -1,91 +0,0 @@
-<HTML>
-<HEAD>
-<TITLE>Database test #4</TITLE>
-</HEAD>
-<BODY>
-<H1>ODBC Test 4 - Cursors</H1>
-<em>The following test requires your ODBC driver to support positioned updates</em><p>
-<?php
- if(isset($dbuser)){
- echo "Connecting to $dsn as $dbuser\n";
- $conn = odbc_connect($dsn,$dbuser,$dbpwd);
- if(!$conn){
-?>
-<H2>Error connecting to database! Check DSN, username and password</H2>
-<?php
- }else{
-?>
- - OK<p>
-Updating table "php_test"
-<?php
- odbc_autocommit($conn, 0);
- if(($result = odbc_do($conn, 'select * from php_test where b>1002 for update'))){
- $cursor = odbc_cursor($result);
- if(($upd = odbc_prepare($conn,"update php_test set a=?, b=? where current of $cursor"))){
- while(odbc_fetch_row($result)) {
- $params[0] = odbc_result($result, 1) . "(*)";
- $params[1] = odbc_result($result, 2) + 2000;
- odbc_execute($upd, $params);
- }
- odbc_commit($conn);
- }
- }
- if($result && $upd){
-?>
- - OK<p>
-<H3>The table "php_test" should now contain the following values:</H3>
-<table>
- <tr>
- <th>A</th><th>B</th><th>C</th><th>D</th>
- </tr>
- <tr>
- <td>test-1</td><td>1001</td><td>100.01</td><td>php3 - values 1</td>
- </tr>
- <tr>
- <td>test-2</td><td>1002</td><td>200.02</td><td>php - values 2</td>
- </tr>
- <tr>
- <td>test-3(*)</td><td>3003</td><td>300.03</td><td>php - values 3</td>
- </tr>
- <tr>
- <td>test-4(*)</td><td>3004</td><td>400.04</td><td>php - values 4</td>
- </tr>
- <tr>
- <td>test-5(*)</td><td>3005</td><td>500.05</td><td>php - values 5</td>
- </tr>
- <tr>
- <td colspan=4>
- <small><em><strong>Note:</strong> If you reload this testpage,<br>
- the three last rows will contain different<br>values in columns A and B</em></small>
- </td>
- </tr>
-</table>
-
-<H3>Actual contents of table "php_test":</H3>
-<?php
- $res = odbc_exec($conn,"select * from php_test");
- odbc_result_all($res);
- }else{
- echo "Your driver obviously doesn't support positioned updates\n<p>";
- }
-?>
-<p><HR width="50%"><p>
-<A HREF="odbc-t5.php?dbuser=<?php echo "$dbuser&dsn=$dsn&dbpwd=$dbpwd"; ?>">Proceed to next test</A>
-<?php
- }
-} else {
-?>
-<form action=odbc-t4.php method=post>
-<table border=0>
-<tr><td>Database: </td><td><input type=text name=dsn></td></tr>
-<tr><td>User: </td><td><input type=text name=dbuser></td></tr>
-<tr><td>Password: </td><td><input type=password name=dbpwd></td></tr>
-</table>
-<input type=submit value=connect>
-
-</form>
-<?php
- }
-?>
-</BODY>
-</HTML>
diff --git a/tests/odbc-t5.php b/tests/odbc-t5.php
deleted file mode 100644
index 13af52d222..0000000000
--- a/tests/odbc-t5.php
+++ /dev/null
@@ -1,137 +0,0 @@
-<HTML>
-<HEAD>
-<TITLE>Database test #5</TITLE>
-</HEAD>
-<BODY>
-<H1>ODBC Test 5 - Blobs</H1>
-<?php
- if(!isset($gif1file) && !isset($display) ||
- ($gif1file == "none" && $gif2file == "none"
- && $gif3file == "none")){
-?>
-<H2>Please select the images (gif) you want to put into the database</H2>
-<FORM METHOD="POST" ACTION="<?php echo $PHP_SELF ?>" ENCTYPE="multipart/form-data">
-Image 1: <INPUT TYPE="file" NAME="gif1file" VALUE="" SIZE="48"><P>
-Image 2: <INPUT TYPE="file" NAME="gif2file" VALUE="" SIZE="48"><P>
-Image 3: <INPUT TYPE="file" NAME="gif3file" VALUE="" SIZE="48"><P>
-Blob database type name: <INPUT TYPE="text" NAME="datatype" VALUE="LONG BYTE" SIZE="32">
-<P>
-<INPUT TYPE="hidden" name="dsn" value="<?php echo $dsn ?>">
-<INPUT TYPE="hidden" name="dbuser" value="<?php echo $dbuser ?>">
-<INPUT TYPE="hidden" name="dbpwd" value="<?php echo $dbpwd ?>">
-<INPUT TYPE="submit" VALUE="Send File(s)">
-| <INPUT TYPE="reset" VALUE="reset">
-</FORM>
-</BODY>
-</HTML>
-<?php
- exit;
- }
-
- if(isset($dbuser)){
- echo "Connecting to $dsn as $dbuser\n";
- $conn = odbc_connect($dsn, $dbuser, $dbpwd);
- if(!$conn){
-?>
-<H2>Error connecting to database! Check DSN, username and password</H2>
-<?php
- }else{
-?>
- - OK<p>
-<?php
- if(isset($display)){
- if(($res = odbc_exec($conn, 'select id from php_test'))){
- echo "<H3>Images in database</H3>";
- while(odbc_fetch_into($res, &$imgs)){
- echo "$imgs[0] : <IMG SRC=\"odbc-display.php?id=$imgs[0]&dbuser=$dbuser&dsn=$dsn&dbpwd=$dbpwd\">\n<P>";
- }
- }else{
- echo "Couldn't execute query";
- }
- echo "\n</BODY>\n</HTML>";
- exit;
- }
-?>
-Dropping table "php_test"
-<?php
- Error_Reporting(0);
- $res = odbc_exec($conn, "drop table php_test");
- if($res){
- odbc_free_result($res);
- }
-?>
- - OK<p>
-Creating table "php_test":
-<?php
- $res = odbc_exec($conn, "create table php_test (id char(32), gif $datatype)");
- if($res){
- odbc_free_result($res);
-?>
- - OK<p>
-Table Info:<br>
-<table>
- <tr>
- <th>Name</th>
- <th>Type</th>
- <th>Length</th>
- </tr>
-<?php
- $info = odbc_exec($conn,"select * from php_test");
- $numfields = odbc_num_fields($info);
-
- for($i=1; $i<=$numfields; $i++){
-?>
- <tr>
- <td><?php echo odbc_field_name($info, $i) ?></td>
- <td><?php echo odbc_field_type($info, $i) ?></td>
- <td><?php echo odbc_field_len($info,$i) ?></td>
- </tr>
-<?php
- }
- odbc_free_result($info);
-?>
-</table>
-
-Inserting data:
-<?php
- echo "$gif1file - $gif2file - $gif3file";
-
- odbc_free_result($res);
- $res = odbc_prepare($conn, "insert into php_test values(?,?)");
- if($gif1file != "none"){
- $params[0] = "image1";
- $params[1] = "'$gif1file'";
- odbc_execute($res, $params);
- }
- if($gif2file != "none"){
- $params[0] = "image2";
- $params[1] = "'$gif2file'";
- odbc_execute($res, $params);
- }
- if($gif3file != "none"){
- $params[0] = "image3";
- $params[1] = "'$gif3file'";
- odbc_execute($res, $params);
- }
-?>
- - OK<P>
-<A HREF="<?php echo "$PHP_SELF?display=y&dbuser=$dbuser&dsn=$dsn&dbpwd=$dbpwd" ?>">Display Images</A>
-<?php
- }
- }
- } else {
-?>
-<form action=odbc-t5.php method=post>
-<table border=0>
-<tr><td>Database: </td><td><input type=text name=dsn></td></tr>
-<tr><td>User: </td><td><input type=text name=dbuser></td></tr>
-<tr><td>Password: </td><td><input type=password name=dbpwd></td></tr>
-</table>
-<input type=submit value=connect>
-
-</form>
-<?php
- }
-?>
-</BODY>
-</HTML>
diff --git a/tests/recurse b/tests/recurse
deleted file mode 100644
index 5b8c646f6b..0000000000
--- a/tests/recurse
+++ /dev/null
@@ -1,21 +0,0 @@
-<?
-
-function factorial($n)
-{
- if ($n==0 || $n==1) {
- return 1;
- } else {
- return $n*factorial($n-1);
- }
-}
-
-
-for ($k=0; $k<10; $k++):
-for ($i=0,$sum=0; $i<50; $i++) {
- $sum = $sum+factorial($i);
-}
-endfor;
-
-print "\$sum=$sum\n";
-
-
diff --git a/tests/run.html b/tests/run.html
deleted file mode 100644
index 281e9e57c8..0000000000
--- a/tests/run.html
+++ /dev/null
@@ -1,11 +0,0 @@
-<html>
-<body>
-<form action="run.php" method="POST">
-
-<textarea name="code" cols=50 rows=20>
-</textarea><br>
-<input type="submit" value="Go!">
-</form>
-
-</body>
-</html>
diff --git a/tests/run.php b/tests/run.php
deleted file mode 100644
index a6792b5af7..0000000000
--- a/tests/run.php
+++ /dev/null
@@ -1,17 +0,0 @@
-<?
-if (!isset($code)) {
- exit("No code submitted.");
-}
-?>
-<html>
-<body>
-Executing:<br>
-<?
-highlight_string("<?php \n$code\n?>");
-?>
-<hr width="40%">
-<?
-eval($code);
-?>
-</body>
-</html> \ No newline at end of file
diff --git a/tests/scan_cases b/tests/scan_cases
deleted file mode 100644
index d562230fde..0000000000
--- a/tests/scan_cases
+++ /dev/null
@@ -1,28 +0,0 @@
-# Test file used by testscanf.php. Feel free to add additional cases
-# sscanf test cases. formatted to be slurped and split by explode
-%d|48| valid decimal (positive)
-%d|-98| valid signed decimal (negative)
-%d|56a| integer scan : decimal digit followed by alpha
-%4d|558071|decimal integer with width specification
-%i|-5489|valid signed integer (negative)
-%s| the rain in spain | plain ole string matched with %s
-%10s|jabberwocky| string with width specifier
-%f|289.071| valid float (%f)
-%f|-0.403| valid negative (%f)
-%3f|76.4|Float with width specifier ending at decimal point
-%3f"|789.4|Float with width specifier
-%o|0321|octal with leading 0
-%o|327| valid octal digits
-%o|380| octal scan with octal digit followed by non-octal
-%x|fe| valid hex|
-%x|0xfe| "c" style hex with leading 0x|
-%x|455| hex with all single digits < f
-%x|-98| hex (negative signed int)
-%c|y| single char
-%4c|tulips|Character with width specification (4)
-%e|10e-9| signed floating point with negative exponent
-%e|10e+9| signed floating point with explicit positive exponent
-%e|10e9| signed floating point with positive exponent (no + sign)
-# next we test multiple cases
- %d %i %o %u %x %s %c %e %f %g | 19 84 0666 2000 0xface your x 31e+9 0.912 2.4 |multiple specifiers
-
diff --git a/tests/strings/001.phpt b/tests/strings/001.phpt
deleted file mode 100644
index 4eacb89592..0000000000
--- a/tests/strings/001.phpt
+++ /dev/null
@@ -1,209 +0,0 @@
---TEST--
-String functions
---POST--
---GET--
---FILE--
-<?php
-
-error_reporting(0);
-
-echo "Testing strtok: ";
-
-$str = "testing 1/2\\3";
-$tok1 = strtok($str, " ");
-$tok2 = strtok("/");
-$tok3 = strtok("\\");
-$tok4 = strtok(".");
-if ($tok1 != "testing") {
- echo("failed 1\n");
-} elseif ($tok2 != "1") {
- echo("failed 2\n");
-} elseif ($tok3 != "2") {
- echo("failed 3\n");
-} elseif ($tok4 != "3") {
- echo("failed 4\n");
-} else {
- echo("passed\n");
-}
-
-echo "Testing strstr: ";
-$test = "This is a test";
-$found1 = strstr($test, 32);
-$found2 = strstr($test, "a ");
-if ($found1 != " is a test") {
- echo("failed 1\n");
-} elseif ($found2 != "a test") {
- echo("failed 2\n");
-} else {
- echo("passed\n");
-}
-
-echo "Testing strrchr: ";
-$test = "fola fola blakken";
-$found1 = strrchr($test, "b");
-$found2 = strrchr($test, 102);
-if ($found1 != "blakken") {
- echo("failed 1\n");
-} elseif ($found2 != "fola blakken") {
- echo("failed 2\n");
-}
-else {
- echo("passed\n");
-}
-
-echo "Testing strtoupper: ";
-$test = "abCdEfg";
-$upper = strtoupper($test);
-if ($upper == "ABCDEFG") {
- echo("passed\n");
-} else {
- echo("failed!\n");
-}
-
-echo "Testing strtolower: ";
-$test = "ABcDeFG";
-$lower = strtolower($test);
-if ($lower == "abcdefg") {
- echo("passed\n");
-} else {
- echo("failed!\n");
-}
-
-echo "Testing substr: ";
-$tests = $ok = 0;
-$string = "string12345";
-$tests++; if (substr($string, 2, 10) == "ring12345") { $ok++; }
-$tests++; if (substr($string, 4, 7) == "ng12345") { $ok++; }
-$tests++; if (substr($string, 4) == "ng12345") { $ok++; }
-$tests++; if (substr($string, 10, 2) == "5") { $ok++; }
-$tests++; if (substr($string, 6, 0) == "") { $ok++; }
-$tests++; if (substr($string, -2, 2) == "45") { $ok++; }
-$tests++; if (substr($string, 1, -1) == "tring1234") { $ok++; }
-$tests++; if (substr($string, -1, -2) == "") { $ok++; }
-$tests++; if (substr($string, -3, -2) == "3") { $ok++; }
-
-if ($tests == $ok) {
- echo("passed\n");
-} else {
- echo("failed!\n");
-}
-
-$raw = ' !"#$%&\'()*+,-./0123456789:;<=>?'
- . '@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_'
- . '`abcdefghijklmnopqrstuvwxyz{|}~'
- . "\0";
-
-echo "Testing rawurlencode: ";
-$encoded = rawurlencode($raw);
-$correct = '%20%21%22%23%24%25%26%27%28%29%2A%2B%2C-.%2F0123456789%3A%3B%3C%3D%3E%3F'
- . '%40ABCDEFGHIJKLMNOPQRSTUVWXYZ%5B%5C%5D%5E_'
- . '%60abcdefghijklmnopqrstuvwxyz%7B%7C%7D%7E'
- . '%00';
-if ($encoded == $correct) {
- echo("passed\n");
-} else {
- echo("failed!\n");
-}
-
-echo "Testing rawurldecode: ";
-$decoded = rawurldecode($correct);
-if ($decoded == $raw) {
- echo("passed\n");
-} else {
- echo("failed!\n");
-}
-
-echo "Testing urlencode: ";
-$encoded = urlencode($raw);
-$correct = '+%21%22%23%24%25%26%27%28%29%2A%2B%2C-.%2F0123456789%3A%3B%3C%3D%3E%3F'
- . '%40ABCDEFGHIJKLMNOPQRSTUVWXYZ%5B%5C%5D%5E_'
- . '%60abcdefghijklmnopqrstuvwxyz%7B%7C%7D%7E'
- . '%00';
-if ($encoded == $correct) {
- echo("passed\n");
-} else {
- echo("failed!\n");
-}
-
-echo "Testing urldecode: ";
-$decoded = urldecode($correct);
-if ($decoded == $raw) {
- echo("passed\n");
-} else {
- echo("failed!\n");
-}
-
-echo "Testing quotemeta: ";
-$raw = "a.\\+*?" . chr(91) . "^" . chr(93) . "b\$c";
-$quoted = quotemeta($raw);
-if ($quoted == "a\\.\\\\\\+\\*\\?\\[\\^\\]b\\\$c") {
- echo("passed\n");
-} else {
- echo("failed!\n");
-}
-
-echo "Testing ufirst: ";
-$str = "fahrvergnuegen";
-$uc = ucfirst($str);
-if ($uc == "Fahrvergnuegen") {
- echo("passed\n");
-} else {
- echo("failed!\n");
-}
-
-echo "Testing strtr: ";
-$str = "test abcdefgh";
-$tr = strtr($str, "def", "456");
-if ($tr == "t5st abc456gh") {
- echo("passed\n");
-} else {
- echo("failed!\n");
-}
-
-echo "Testing addslashes: ";
-$str = "\"\\'";
-$as = addslashes($str);
-if ($as == "\\\"\\\\\\'") {
- echo("passed\n");
-} else {
- echo("failed!\n");
-}
-
-echo "Testing stripslashes: ";
-$str = "\$\\'";
-$ss = stripslashes($str);
-if ($ss == "\$'") {
- echo("passed\n");
-} else {
- echo("failed!\n");
-}
-
-
-echo "Testing uniqid: ";
-$str = "prefix";
-$ui1 = uniqid($str);
-$ui2 = uniqid($str);
-if (strlen($ui1) == strlen($ui2) && strlen($ui1) == 19 && $ui1 != $ui2) {
- echo("passed\n");
-} else {
- echo("failed!\n");
-}
-
-?>
---EXPECT--
-Testing strtok: passed
-Testing strstr: passed
-Testing strrchr: passed
-Testing strtoupper: passed
-Testing strtolower: passed
-Testing substr: passed
-Testing rawurlencode: passed
-Testing rawurldecode: passed
-Testing urlencode: passed
-Testing urldecode: passed
-Testing quotemeta: passed
-Testing ufirst: passed
-Testing strtr: passed
-Testing addslashes: passed
-Testing stripslashes: passed
-Testing uniqid: passed
diff --git a/tests/strings/002.phpt b/tests/strings/002.phpt
deleted file mode 100644
index 195d3bd5e5..0000000000
--- a/tests/strings/002.phpt
+++ /dev/null
@@ -1,74 +0,0 @@
---TEST--
-Formatted print functions
---POST--
---GET--
---FILE--
-<?php
-
-error_reporting(0);
-
-printf("printf test 1:%s\n", "simple string");
-printf("printf test 2:%d\n", 42);
-printf("printf test 3:%f\n", 10.0/3);
-printf("printf test 4:%.10f\n", 10.0/3);
-printf("printf test 5:%-10.2f\n", 2.5);
-printf("printf test 6:%-010.2f\n", 2.5);
-printf("printf test 7:%010.2f\n", 2.5);
-printf("printf test 8:<%20s>\n", "foo");
-printf("printf test 9:<%-20s>\n", "bar");
-printf("printf test 10: 123456789012345\n");
-printf("printf test 10:<%15s>\n", "høyesterettsjustitiarius");
-printf("printf test 11: 123456789012345678901234567890\n");
-printf("printf test 11:<%30s>\n", "høyesterettsjustitiarius");
-printf("printf test 12:%5.2f\n", -12.34);
-printf("printf test 13:%5d\n", -12);
-printf("printf test 14:%c\n", 64);
-printf("printf test 15:%b\n", 170);
-printf("printf test 16:%x\n", 170);
-printf("printf test 17:%X\n", 170);
-printf("printf test 18:%16b\n", 170);
-printf("printf test 19:%16x\n", 170);
-printf("printf test 20:%16X\n", 170);
-printf("printf test 21:%016b\n", 170);
-printf("printf test 22:%016x\n", 170);
-printf("printf test 23:%016X\n", 170);
-printf("printf test 24:%.5s\n", "abcdefghij");
-printf("printf test 25:%-2s\n", "gazonk");
-printf("printf test 26:%2\$d %1\$d\n", 1, 2);
-printf("printf test 27:%3\$d %d %d\n", 1, 2, 3);
-printf("printf test 28:%2\$02d %1\$2d\n", 1, 2);
-printf("printf test 29:%2\$-2d %1\$2d\n", 1, 2);
-
-?>
---EXPECT--
-printf test 1:simple string
-printf test 2:42
-printf test 3:3.333333
-printf test 4:3.3333333333
-printf test 5:2.50
-printf test 6:2.50000000000
-printf test 7:0000000002.50
-printf test 8:< foo>
-printf test 9:<bar >
-printf test 10: 123456789012345
-printf test 10:<høyesterettsjustitiarius>
-printf test 11: 123456789012345678901234567890
-printf test 11:< høyesterettsjustitiarius>
-printf test 12: -12.34
-printf test 13: -12
-printf test 14:@
-printf test 15:10101010
-printf test 16:aa
-printf test 17:AA
-printf test 18: 10101010
-printf test 19: aa
-printf test 20: AA
-printf test 21:0000000010101010
-printf test 22:00000000000000aa
-printf test 23:00000000000000AA
-printf test 24:abcde
-printf test 25:gazonk
-printf test 26:2 1
-printf test 27:3 1 2
-printf test 28:02 1
-printf test 29:2 1
diff --git a/tests/strings/003.phpt b/tests/strings/003.phpt
deleted file mode 100644
index f7d754988b..0000000000
--- a/tests/strings/003.phpt
+++ /dev/null
@@ -1,13 +0,0 @@
---TEST--
-HTML entities
---POST--
---GET--
---FILE--
-<?php
-setlocale (LC_CTYPE, "C");
-echo htmlspecialchars ("<>\"&åÄ\n");
-echo htmlentities ("<>\"&åÄ\n");
-?>
---EXPECT--
-&lt;&gt;&quot;&amp;åÄ
-&lt;&gt;&quot;&amp;&aring;&Auml;
diff --git a/tests/test.php4 b/tests/test.php4
deleted file mode 100644
index 7af9a28ebd..0000000000
--- a/tests/test.php4
+++ /dev/null
@@ -1,15 +0,0 @@
-<?
-function blah($a)
-{
- return $a;
-}
-
-return "cool";
-
-
-for ($for=0; $for<=100000;$for++)
-{
-if ("andi" != blah("andi"))
-{
-print "error";}
-}
diff --git a/tests/test.pl b/tests/test.pl
deleted file mode 100644
index 2502cb1298..0000000000
--- a/tests/test.pl
+++ /dev/null
@@ -1,34 +0,0 @@
-<?
-
-$i = 0;
-$j = 1;
-
-for ($k=0; $k<1000000; $k = $k+1) {
- while ($i<10000000) {
- if (($i%"4")<1) {
- $i = $i+"1";
- if ($j%"2") {
- $i = $i * "2";
- }
- } elseif (($i%"4")<2) {
- $i = $i+"2";
- if ($j%"2") {
- $i = $i * "2";
- }
- } elseif (($i%"4")<3) {
- $i = $i+3;
- if ($j%"2") {
- $i = $i * "2";
- }
- } else {
- $i = $i+"4";
- if ($j%"2") {
- $i = $i * "2";
- }
- }
- $j = $j+1;
- }
-}
-print $i;
-print "\n";
-
diff --git a/tests/test_class_inheritance b/tests/test_class_inheritance
deleted file mode 100644
index 3f903e62d1..0000000000
--- a/tests/test_class_inheritance
+++ /dev/null
@@ -1,29 +0,0 @@
-<?
-
-class BaseClass {
- var $class_name = "BaseClass";
-
- function BaseClass($value) {
- print "value is '$value'\n";
- }
- function MyClassName() {
- return $this->class_name;
- }
-};
-
-
-class ChildClass {
- var $class_name = "ChildClass";
-
- function ChildClass($value, $new_value) {
- BaseClass::BaseClass($value);
- print "new value is '$new_value'\n";
- }
- function MyClassName($a_value) {
- return BaseClass::MyClassName()." and the value is '$a_value'";
- }
-};
-
-
-$obj = new ChildClass("Test", "Another test");
-print $obj->MyClassName("not interesting"); \ No newline at end of file
diff --git a/tests/testarray b/tests/testarray
deleted file mode 100644
index bee5cca546..0000000000
--- a/tests/testarray
+++ /dev/null
@@ -1,21 +0,0 @@
-This is a small test....
-<?
-
-/*
- * this is a multiline comment...
- */
-
-for ($j=0; $j<=20; $j++) {
- for ($i[0][0]=0; $i[0][0]<10000; $i[0][0]++) {
- $i[1] += $i[0][0]; // this is a single line comment
- }
-}
-
-/* this is another multi
-line
- comment...******
-/
-*/
-
-print $i[1]."\n";
-
diff --git a/tests/testarray.pl b/tests/testarray.pl
deleted file mode 100644
index 9ec83e184c..0000000000
--- a/tests/testarray.pl
+++ /dev/null
@@ -1,5 +0,0 @@
-for ($i[0][0]=0; $i[0][0]<1000000; $i[0][0]++) {
- $i[1] += $i[0][0];
-}
-
-print $i[1];
diff --git a/tests/testarray2 b/tests/testarray2
deleted file mode 100644
index 91926beaff..0000000000
--- a/tests/testarray2
+++ /dev/null
@@ -1,5 +0,0 @@
-
-<?
-for ($i="aaa"; $i<"bbb\nbbb"; $i++) {
- print $i;
-}
diff --git a/tests/testarray2.pl b/tests/testarray2.pl
deleted file mode 100644
index e72c526d4f..0000000000
--- a/tests/testarray2.pl
+++ /dev/null
@@ -1,3 +0,0 @@
-for ($i="aaa"; $i lt "bbb"; $i++) {
- print "$i\n";
-}
diff --git a/tests/testclassfunc b/tests/testclassfunc
deleted file mode 100644
index 007bf3bd37..0000000000
--- a/tests/testclassfunc
+++ /dev/null
@@ -1,9 +0,0 @@
-<?
-class foo {
- function bar() {
- print "Hey there!\n";
- }
-};
-
-foo::bar();
-
diff --git a/tests/testcom b/tests/testcom
deleted file mode 100644
index 0feb50d1ff..0000000000
--- a/tests/testcom
+++ /dev/null
@@ -1,11 +0,0 @@
-<?
-$word = new COM("word.application") or die("Unable to instanciate Word");
-print "Loaded Word, version {$word->Version}\n";
-$word->Visible = 1;
-$word->Documents->Add();
-$word->Selection->TypeText("This is a test...");
-$word->Quit();
-/*
-$word->Documents[1]->SaveAs("Useless test.doc");
-*/
-?> \ No newline at end of file
diff --git a/tests/testcpdf b/tests/testcpdf
deleted file mode 100644
index a74087d18e..0000000000
--- a/tests/testcpdf
+++ /dev/null
@@ -1,97 +0,0 @@
-<?php
- function draw_text($cpdf, $fontname, $size, $x, $y, $text="") {
- cpdf_begin_text($cpdf);
- cpdf_set_font($cpdf, $fontname, $size, 4);
- if($text == "")
- cpdf_text($cpdf, $fontname." ".$size." Point", $x, $y, 1);
- else
- cpdf_text($cpdf, $text, $x, $y, 1);
- cpdf_end_text($cpdf);
- }
-
- $cpdf = cpdf_open(0);
- cpdf_set_Creator($cpdf, "Creator");
- cpdf_set_Title($cpdf, "Title");
- cpdf_set_Subject($cpdf, "Subject");
- cpdf_set_Keywords($cpdf, "Keyword1, Keyword2");
- cpdf_set_viewer_preferences($cpdf, 1);
-
- cpdf_page_init($cpdf, 1, 0, 600, 400, 1);
- $level1 = cpdf_add_outline($cpdf, 0, 0, 1, 1, "Examples");
- $level2a = cpdf_add_outline($cpdf, $level1, 1, 0, 1, "Text");
- draw_text($cpdf, "Helvetica", 18.0, 50, 330);
- draw_text($cpdf, "Helvetica-Bold", 18.0, 50, 310);
- draw_text($cpdf, "Helvetica-Oblique", 18.0, 50, 290);
- draw_text($cpdf, "Helvetica-BoldOblique", 18.0, 50, 270);
- draw_text($cpdf, "Times-Roman", 18.0, 50, 250);
- draw_text($cpdf, "Times-Bold", 18.0, 50, 230);
- draw_text($cpdf, "Times-Italic", 18.0, 50, 210);
- draw_text($cpdf, "Times-BoldItalic", 18.0, 50, 190);
- draw_text($cpdf, "Courier", 18.0, 50, 170);
- draw_text($cpdf, "Courier-Bold", 18.0, 50, 150);
- draw_text($cpdf, "Courier-Oblique", 18.0, 50, 130);
- draw_text($cpdf, "Courier-BoldOblique", 18.0, 50, 110);
- draw_text($cpdf, "Symbol", 18.0, 50, 90);
- draw_text($cpdf, "ZapfDingbats", 18.0, 50, 70);
-
- cpdf_page_init($cpdf, 2, 0, 400, 400, 1);
- $level2b = cpdf_add_outline($cpdf, $level2a, 0, 0, 2, "Annotations, Hyperlinks");
- cpdf_add_annotation($cpdf, 100, 100, 300, 200, "Annotation", "Text of Annotation");
- draw_text($cpdf, "Helvetica", 12.0, 102, 116, "Click here to go to");
- draw_text($cpdf, "Helvetica", 12.0, 102, 103, "http://localhost");
- cpdf_set_action_url($cpdf, 100, 100, 202, 130, "http://localhost");
-
- cpdf_page_init($cpdf, 3, 0, 400, 600, 1);
- $level2c = cpdf_add_outline($cpdf, $level2b, 0, 0, 3, "Drawing");
- cpdf_rect($cpdf, 100, 100, 90, 90, 1);
- cpdf_stroke($cpdf);
- cpdf_rect($cpdf, 200, 100, 90, 90, 1);
- cpdf_fill_stroke($cpdf);
-
- cpdf_setgray_fill($cpdf, 0.5);
- cpdf_circle($cpdf, 140, 250, 35, 1);
- cpdf_stroke($cpdf);
- cpdf_circle($cpdf, 240, 250, 35, 1);
- cpdf_fill_stroke($cpdf);
-
- cpdf_moveto($cpdf, 300, 100, 1);
- cpdf_lineto($cpdf, 350, 100, 1);
- cpdf_curveto($cpdf, 350, 100, 325, 300, 300, 100, 1);
- cpdf_stroke($cpdf);
-
- cpdf_moveto($cpdf, 400, 100, 1);
- cpdf_lineto($cpdf, 450, 100, 1);
- cpdf_curveto($cpdf, 450, 100, 425, 400, 400, 100, 1);
- cpdf_fill_stroke($cpdf);
-
- cpdf_page_init($cpdf, 4, 0, 400, 600, 1);
- $level2d = cpdf_add_outline($cpdf, $level2c, 0, 0, 4, "Images, Clipping");
- cpdf_import_jpeg($cpdf, "figure.jpg", 50, 50, -10.0, 0.0, 300.0, 0.0, 0.0, 1, 1);
- cpdf_save($cpdf);
- cpdf_newpath($cpdf);
- cpdf_moveto($cpdf, 300, 50);
- cpdf_lineto($cpdf, 450, 50, 1);
- cpdf_curveto($cpdf, 450, 100, 375, 300, 300, 100, 1);
- cpdf_closepath($cpdf);
- cpdf_rect($cpdf, 350, 215, 100, 30);
- cpdf_clip($cpdf);
- cpdf_newpath($cpdf); /* needed because clip doesn't consume path */
- draw_text($cpdf, "Helvetica", 18.0, 250, 130);
- cpdf_import_jpeg($cpdf, "figure.jpg", 300, 50, 0.0, 0.0, 300.0, 0.0, 0.0, 0, 1); /* watch for the second last parameter. It is 0 to disable extra gsave/grestore */
- cpdf_restore($cpdf);
-
- cpdf_page_init($cpdf, 5, 0, 400, 400, 1);
- $level2e = cpdf_add_outline($cpdf, $level2d, 0, 0, 5, "GD Image");
-
- $gdimage = imagecreate(100, 100);
- $color = imagecolorallocate($gdimage, 100, 190, 0);
- $black = imagecolorallocate($gdimage, 0, 0, 0);
- imageline($gdimage, 2, 2, 90, 90, $black);
-
- cpdf_place_inline_image($cpdf, $gdimage, 50, 50, 10.0, 150, 50.0, 1, 1);
- imagedestroy($gdimage);
-
- cpdf_finalize($cpdf);
- cpdf_output_buffer($cpdf);
- cpdf_close($cpdf);
-?>
diff --git a/tests/testcpdfclock b/tests/testcpdfclock
deleted file mode 100644
index c885cc8e09..0000000000
--- a/tests/testcpdfclock
+++ /dev/null
@@ -1,87 +0,0 @@
-<?php
-$pdffilename = "clock.pdf";
-$radius = 200;
-$margin = 20;
-$pagecount = 99;
-
-$pdf = cpdf_open(0);
-cpdf_set_creator($pdf, "pdf_clock.php3");
-cpdf_set_title($pdf, "Analog Clock");
-
-while($pagecount-- > 0) {
- cpdf_page_init($pdf, $pagecount+1, 0, 2 * ($radius + $margin), 2 * ($radius + $margin), 1.0);
-
- cpdf_set_page_animation($pdf, 4, 0.5, 0, 0, 0); /* wipe */
-
- cpdf_translate($pdf, $radius + $margin, $radius + $margin);
- cpdf_save($pdf);
- cpdf_setrgbcolor($pdf, 0.0, 0.0, 1.0);
-
- /* minute strokes */
- cpdf_setlinewidth($pdf, 2.0);
- for ($alpha = 0; $alpha < 360; $alpha += 6)
- {
- cpdf_rotate($pdf, 6.0);
- cpdf_moveto($pdf, $radius, 0.0);
- cpdf_lineto($pdf, $radius-$margin/3, 0.0);
- cpdf_stroke($pdf);
- }
-
- cpdf_restore($pdf);
- cpdf_save($pdf);
-
- /* 5 minute strokes */
- cpdf_setlinewidth($pdf, 3.0);
- for ($alpha = 0; $alpha < 360; $alpha += 30)
- {
- cpdf_rotate($pdf, 30.0);
- cpdf_moveto($pdf, $radius, 0.0);
- cpdf_lineto($pdf, $radius-$margin, 0.0);
- cpdf_stroke($pdf);
- }
-
- $ltime = getdate();
-
- /* draw hour hand */
- cpdf_save($pdf);
- cpdf_rotate($pdf, -(($ltime['minutes']/60.0) + $ltime['hours'] - 3.0) * 30.0);
- cpdf_moveto($pdf, -$radius/10, -$radius/20);
- cpdf_lineto($pdf, $radius/2, 0.0);
- cpdf_lineto($pdf, -$radius/10, $radius/20);
- cpdf_closepath($pdf);
- cpdf_fill($pdf);
- cpdf_restore($pdf);
-
- /* draw minute hand */
- cpdf_save($pdf);
- cpdf_rotate($pdf, -(($ltime['seconds']/60.0) + $ltime['minutes'] - 15.0) * 6.0);
- cpdf_moveto($pdf, -$radius/10, -$radius/20);
- cpdf_lineto($pdf, $radius * 0.8, 0.0);
- cpdf_lineto($pdf, -$radius/10, $radius/20);
- cpdf_closepath($pdf);
- cpdf_fill($pdf);
- cpdf_restore($pdf);
-
- /* draw second hand */
- cpdf_setrgbcolor($pdf, 1.0, 0.0, 0.0);
- cpdf_setlinewidth($pdf, 2);
- cpdf_save($pdf);
- cpdf_rotate($pdf, -(($ltime['seconds'] - 15.0) * 6.0));
- cpdf_moveto($pdf, -$radius/5, 0.0);
- cpdf_lineto($pdf, $radius, 0.0);
- cpdf_stroke($pdf);
- cpdf_restore($pdf);
-
- /* draw little circle at center */
- cpdf_circle($pdf, 0, 0, $radius/30);
- cpdf_fill($pdf);
-
- cpdf_restore($pdf);
-
- cpdf_finalize_page($pdf, $pagecount+1);
-}
-
-cpdf_finalize($pdf);
-cpdf_save_to_file($pdf, $pdffilename);
-$pdf = cpdf_close($pdf);
-?>
diff --git a/tests/testdom b/tests/testdom
deleted file mode 100644
index c7012e0e3c..0000000000
--- a/tests/testdom
+++ /dev/null
@@ -1,73 +0,0 @@
-<?php
-$xmlstr = "<?xml version='1.0' standalone='yes'?>
-<!DOCTYPE chapter SYSTEM '/share/sgml/Norman_Walsh/db3xml10/db3xml10.dtd'
-[ <!ENTITY sp \"spanish\">
-]>
-<!-- lsfj -->
-<chapter language='en'><title language='en'>Title</title>
-<para language='ge'>
-&sp;
-<!-- comment -->
-<informaltable language='&sp;kkk'>
-<tgroup cols='3'>
-<tbody>
-<row><entry>a1</entry><entry morerows='1'>b1</entry><entry>c1</entry></row>
-<row><entry>a2</entry><entry>c2</entry></row>
-<row><entry>a3</entry><entry>b3</entry><entry>c3</entry></row>
-</tbody>
-</tgroup>
-</informaltable>
-</para>
-</chapter> ";
-
-echo "Test 1: accessing single nodes from php\n";
-$dom = xmldoc($xmlstr);
-if(!$dom) {
- echo "Error while parsing the document\n";
- exit;
-}
-
-$children = $dom->childNodes();
-print_r($children);
-
-echo "--------- root\n";
-$rootnode = $dom->documentElement();
-print_r($rootnode);
-
-echo "--------- children of root\n";
-$children = $rootnode->childNodes();
-print_r($children);
-
-// The last node should be identical with the last entry in the children array
-echo "--------- last\n";
-$last = $rootnode->lastChild();
-print_r($last);
-
-// The parent of this last node is the root again
-echo "--------- parent\n";
-$parent = $last->parent();
-print_r($parent);
-
-// The children of this parent are the same children as one above
-echo "--------- children of parent\n";
-$children = $parent->childNodes();
-print_r($children);
-
-echo "--------- creating a new attribute\n";
-$attr = $dom->createAttribute("src", "picture.gif");
-print_r($attr);
-
-$rootnode->setAttributeNode($attr); /* Not implemented */
-$attr = $rootnode->setAttribute("src", "picture.gif");
-$attr = $rootnode->getAttribute("src");
-print_r($attr);
-
-echo "--------- attribute of rootnode\n";
-$attrs = $rootnode->attributes();
-print_r($attrs);
-
-echo "--------- children of an attribute\n";
-$children = $attrs[0]->childNodes();
-print_r($children);
-
-?>
diff --git a/tests/testfe b/tests/testfe
deleted file mode 100644
index ea62760635..0000000000
--- a/tests/testfe
+++ /dev/null
@@ -1,18 +0,0 @@
-<?
-$foo = array(7,"foo",3,array(1,2),4);
-
-for ($i=0; $i<3; $i++):
-
-foreach($a, $foo ) {
- if (gettype($a)=="array") {
- print "Array:\n";
- foreach($b, $a) {
- print "\t$b\n";
- }
- print "End of array.\n";
- } else {
- print "$a\n";
- }
-// print "$a\n";
-}
-endfor;
diff --git a/tests/testfunc b/tests/testfunc
deleted file mode 100644
index fa64be2e6f..0000000000
--- a/tests/testfunc
+++ /dev/null
@@ -1,33 +0,0 @@
-<?
-function foo()
-{
- $i=0;
-
- if ($i) {
- $a = "zeev";
- } else {
- $b = "andi";
- }
-}
-
-function bar()
-{
- foo();
-}
-
-for ($i=0; $i<10; $i++) {
- bar();
-}
-
-
-for ($i=0; $i<10; $i++) {
- bar();
-}
-
-print "Got here.....
-
-";
-
-$a = 7;
-$a = 5;
-print "Got here....\n\n";
diff --git a/tests/testfunc.pl b/tests/testfunc.pl
deleted file mode 100644
index 87864866ff..0000000000
--- a/tests/testfunc.pl
+++ /dev/null
@@ -1,20 +0,0 @@
-sub foo()
-{
- my $i=0;
-
- if ($i) {
- my $a = "zeev";
- } else {
- my $b = "andi";
- }
-}
-
-
-sub bar()
-{
- foo();
-}
-
-for ($i=0; $i<1000000; $i++) {
- bar();
-}
diff --git a/tests/testfunc2 b/tests/testfunc2
deleted file mode 100644
index 42f91f2bae..0000000000
--- a/tests/testfunc2
+++ /dev/null
@@ -1,19 +0,0 @@
-<?
-function foo($i)
-{
- if ($i) {
- $a = "zeev";
- } else {
- $b = "andi";
- }
-}
-
-
-function bar($a)
-{
- foo($a);
-}
-
-for ($i=0; $i<10000; $i=$i+1) {
- bar($i);
-}
diff --git a/tests/testfunc2.pl b/tests/testfunc2.pl
deleted file mode 100644
index 7eeaf92ffb..0000000000
--- a/tests/testfunc2.pl
+++ /dev/null
@@ -1,22 +0,0 @@
-sub foo
-{
- my $i = shift(@_);
-
- if ($i) {
- my $a = "zeev";
- } else {
- my $b = "andi";
- }
-}
-
-
-sub bar
-{
- my $i = shift(@_);
-
- foo($i);
-}
-
-for ($i=0; $i<1000000; $i=$i+1) {
- bar($i);
-}
diff --git a/tests/testfuncref b/tests/testfuncref
deleted file mode 100644
index 217e4d14e0..0000000000
--- a/tests/testfuncref
+++ /dev/null
@@ -1,10 +0,0 @@
-<?
-
-function foobar()
-{
- print "foobar\n";
-}
-
-$foobar = "foobar";
-
-$a = ${"foo"."bar"}();
diff --git a/tests/testhyperwave b/tests/testhyperwave
deleted file mode 100644
index 28bc19d2f9..0000000000
--- a/tests/testhyperwave
+++ /dev/null
@@ -1,235 +0,0 @@
-<?
- $id = 188178; // A plain/text document
- $collid = 169828; // A collection
- $query = "Name=m*"; // Search query for test_9
- $host = "gehtnix";
- $username = "annonymous";
- $password = "";
-
- $connect = hw_connect($host, 418, $username, $password);
- if(hw_error($connect)) {
- echo "ERROR: ".hw_errormsg($connect)."\n";
- exit;
- }
-
- // Set all test to 'yes' if they shall be executed
- $test_1 = "no"; // Get the text document with id $id and output it
- $test_2 = "no"; // Check if id $id is in $collid
- $test_3 = "no"; // Convert object record to object array and back
- $test_4 = "no"; // Get object record of object with id $id
- $test_5 = "no"; // List children of $collid
- $test_6 = "no"; // List parents of $id
- $test_7 = "no"; // Insert a new text document
- $test_8 = "no"; // Remove the just inserted text document
- $test_9 = "no"; // Searching for objects with Name $query
- $test_10= "no"; // Listing all anchors of a document
- $test_11= "no"; // Creates document from file and outputs it.
- $test_12= "yes"; // Creates document from file and outputs it.
-
- /* Lists an object array
- */
- function list_attr($attributes) {
-// var_dump($attributes);
-// return;
- for($i=0; $i<count($attributes); $i++) {
- $key = key($attributes);
- switch($key) {
- case "Title":
- case "Description":
- $title_arr = $attributes[$key];
- $cj = count($title_arr);
- printf("%s = ", $key);
- for($j=0; $j<$cj; $j++) {
- $tkey = key($title_arr);
- switch($tkey) {
- case "en":
- $flagfile = "english.gif";
- break;
- case "ge":
- $flagfile = "german.gif";
- break;
- case "du":
- $flagfile = "dutch.gif";
- break;
- default:
- $flagfile = "europe.gif";
- }
- printf("%s:%s; ", $tkey, $title_arr[$tkey]);
-
- next($title_arr);
- }
- printf("\n");
- break;
- default:
- if(is_array($attributes[$key])) {
- $group_arr = $attributes[$key];
- $cj = count($group_arr);
- for($j=0; $j<$cj; $j++) {
- printf("%s = %s\n", $key, $group_arr[$j]);
- next($group_arr);
- }
- } else {
- printf("%s = %s\n", $key, $attributes[$key]);
- }
-
- }
- next($attributes);
- }
- echo "\n";
- }
-
- // Here come the tests
- if($test_1 == "yes") {
- echo "TEST 1 ----------------------------------------------\n";
- echo "Get the text document with id 0x".dechex($id)."\n";
- $doc = hw_gettext($connect, $id);
- if(hw_error($connect)) {
- echo "ERROR: ".hw_errormsg($connect)."\n";
- exit;
- }
- hw_output_document($doc);
- echo "\n";
- }
-
- if($test_2 == "yes") {
- echo "TEST 2 ----------------------------------------------\n";
- echo "Checking if '$id' (0x".dechex($id).") is in collection '$collid (0x".dechex($collid).")'\n";
- $incoll = hw_incollections($connect, array($id), array($collid), 0);
- if(hw_error($connect)) {
- echo "ERROR: ".hw_errormsg($connect)."\n";
- exit;
- }
- for($i=0; $i<count($incoll); $i++)
- echo $incoll[$i]."\n";
- }
-
- if($test_3 == "yes") {
- echo "TEST 3 ----------------------------------------------\n";
- echo "Convert an object array into an object record\n";
- $objrec = hw_array2objrec(array("Title"=>"ge:Hier der Titel", "Author"=>"Hier der Autor"));
- echo $objrec."\n";
- $objrec .= "\nTitle=en:Here the title";
- echo "Add another title and convert it back to an object array\n";
- $objarr = hw_objrec2array($objrec);
- list_attr($objarr);
- }
-
- if($test_4 == "yes") {
- echo "TEST 4 ----------------------------------------------\n";
- echo "Get the object array of document with id 0x".dechex($id)."\n";
- $objrec = hw_getobject($connect, $id);
- if(hw_error($connect)) {
- echo "ERROR: ".hw_errormsg($connect)."\n";
- exit;
- }
- $objarr = hw_objrec2array($objrec);
- list_attr($objarr);
- }
-
- if($test_5 == "yes") {
- echo "TEST 5 ----------------------------------------------\n";
- echo "List the children of collection 0x".dechex($collid)."\n";
- $children = hw_childrenobj($connect, $collid);
- if(hw_error($connect)) {
- echo "ERROR: ".hw_errormsg($connect)."\n";
- exit;
- }
- $c_children = count($children) - 1;
- for($i=0; $i<$c_children; $i++) {
- $objarr = hw_objrec2array($children[$i]);
- list_attr($objarr);
- }
- list_attr($children[$c_children]);
- }
-
- if($test_6 == "yes") {
- echo "TEST 6 ----------------------------------------------\n";
- echo "List the parents of object 0x".dechex($id)."\n";
- $parents = hw_getparentsobj($connect, $collid);
- if(hw_error($connect)) {
- echo "ERROR: ".hw_errormsg($connect)."\n";
- exit;
- }
- $c_parents = count($parents) - 1;
- for($i=0; $i<$c_parents; $i++) {
- $objarr = hw_objrec2array($parents[$i]);
- list_attr($objarr);
- }
- list_attr($parents[$c_parents]);
- }
-
- if($test_7 == "yes") {
- echo "TEST 7 ----------------------------------------------\n";
- echo "Inserting a new text document into 0x".dechex($collid)."\n";
- $objrec = "Type=Document\nDocumentType=text\nName=HWTest\nTitle=en:Component\nMimeType=text/plain\nAuthor=".$username;
- $contents = "Ein bischen Text";
- $doc = hw_new_document($objrec, $contents, strlen($contents)+1);
- $objid = hw_insertdocument($connect, $collid, $doc);
- if(hw_error($connect)) {
- echo "ERROR: ".hw_errormsg($connect)."\n";
- exit;
- }
- $objrec = hw_getobject($connect, $objid);
- if(hw_error($connect)) {
- echo "ERROR: ".hw_errormsg($connect)."\n";
- exit;
- }
- $objarr = hw_objrec2array($objrec);
- list_attr($objarr);
- }
-
- if($test_8 == "yes") {
- echo "TEST 8 ----------------------------------------------\n";
- echo "Removing text document just inserted\n";
- $kk[0] = (int) $objid;
- hw_mv($connect, $kk, $collid, 0);
- if(hw_error($connect)) {
- echo "ERROR: ".hw_errormsg($connect)."\n";
- exit;
- }
- echo "If the document was really deleted you should see an error now\n";
- $objrec = hw_getobject($connect, $objid);
- if(hw_error($connect)) {
- echo "ERROR: ".hw_errormsg($connect)."\n";
- } else {
- $objarr = hw_objrec2array($objrec);
- list_attr($objarr);
- }
- }
-
- if($test_9 == "yes") {
- echo "TEST 9 ----------------------------------------------\n";
- echo "Searching for objects with $query\n";
- $objrecs = hw_getobjectbyqueryobj($connect, $query, -1);
- $c_objrecs = count($objrecs) - 1;
- echo "$c_objrecs found\n";
- for($i=0; $i<$c_objrecs; $i++) {
- $objarr = hw_objrec2array($objrecs[$i]);
- list_attr($objarr);
- }
- list_attr($objrecs[$c_objrecs]);
- }
-
- if($test_10 == "yes") {
- $anchors = hw_getanchorsobj($connect, $id);
- $countanchors = count($anchors) - 1;
- echo "$countanchors Anchors of Object $id\n";
- for($i=0; $i<$countanchors; $i++) {
- $arr = hw_objrec2array($anchors[$i]);
- list_attr($arr);
- }
- }
-
- if($test_11 == "yes") {
- $doc = hw_new_document_from_file("ObjectRecord", "hw_document.txt");
- hw_output_document($doc);
- }
-
- if($test_12 == "yes") {
- $doc = hw_new_document_from_file("ObjectRecord", "hw_document.txt");
- hw_insertanchors($doc, array("Position=0x2 0x7\nObjectID=0x3\nTAnchor=Src\nDest=0x5"), array("ObjectID=0x5\nName=DestDoc"));
- hw_output_document($doc);
- }
-
- hw_close($connect);
-?>
diff --git a/tests/testinclude b/tests/testinclude
deleted file mode 100644
index 1e9854370d..0000000000
--- a/tests/testinclude
+++ /dev/null
@@ -1,5 +0,0 @@
-<?
-print "Before include....\n";
-$retval = include("testarray");
-print "After include, include returned $retval\n";
-?>
diff --git a/tests/testobj b/tests/testobj
deleted file mode 100644
index 66b003ce9c..0000000000
--- a/tests/testobj
+++ /dev/null
@@ -1,29 +0,0 @@
-<?
-define("endl","\n");
-
-class foobar {
- function foobar() {
- $this->initialized = 1;
- }
-};
-
-class barbara extends foobar {
-
-};
-
-$name = "foobar";
-$foo = new $name; // or die("Unable to construct foobar\n");
-//print $foo->initialized;
-
-$boo = new barbara;
-print get_class($foo).endl;
-print get_parent_class($foo).endl;
-print get_class($boo).endl;
-print get_parent_class($boo).endl;
-print method_exists($foo,"foobar").endl;
-print method_exists($boo,"foobar").endl;
-print method_exists($boo,"barbara").endl;
-//$word = new COm("word.application");
-//$word->visible = true;
-//sleep(5);
-//$word->quit();
diff --git a/tests/testpfpro.php b/tests/testpfpro.php
deleted file mode 100644
index ffb1784bdc..0000000000
--- a/tests/testpfpro.php
+++ /dev/null
@@ -1,39 +0,0 @@
-<?
-
-if (!extension_loaded('pfpro')) {
- die("pfpro module is not compiled in PHP\n");
-}
-
-echo "<pre>\n\n";
-
-echo "Payflow Pro library is version ".pfpro_version()."\n";
-
-pfpro_init();
-
-$transaction = array(USER => 'mylogin',
- PWD => 'mypassword',
- TRXTYPE => 'S',
- TENDER => 'C',
- AMT => 1.50,
- ACCT => '4111111111111111',
- EXPDATE => '0900'
- );
-
-$response = pfpro_process($transaction);
-
-if (!$response) {
- die("Couldn't establish link to signio software.\n");
-}
-
-echo "Signio response code was ".$response[RESULT];
-echo ", which means: ".$response[RESPMSG]."\n";
-
-echo "\nDump of the transaction request ";
-print_r($transaction);
-
-echo "\nDump of the response ";
-print_r($response);
-
-pfpro_cleanup();
-
-?>
diff --git a/tests/testscanf.php b/tests/testscanf.php
deleted file mode 100644
index ad530978c5..0000000000
--- a/tests/testscanf.php
+++ /dev/null
@@ -1,113 +0,0 @@
-<?php
-
-
-function print_value($val,$postfix="<br>") {
- if (is_array($val)) {
- for ($i = 0;$i< count($val);$i++) {
- echo $val[$i] . $postfix;
- }
- } else {
- echo $val . $postfix;
- }
-}
-
-function do_sscanf($string, $format) {
- $s = "sscanf(\"" . $string . ",\"" . $format ."\").";
- echo "$s<br>";
- $s = str_repeat("-", strlen($s));
- echo "$s<br>";
- $output = sscanf($string,$format);
- echo "Result : ";
- print_value( $output );
- echo "$s<br><br>";
-}
-
-
-function run_sscanf_test_cases($filename="scan_cases")
-{
-
- echo "<h3><em><br>Running Test Cases from $filename<br></em></h3>";
- $arr = file($filename);
- for ($i=0;$i < count($arr);$i++) {
- $line_arr = explode("|",$arr[$i]);
-
- $format = $line_arr[0];
- $string = $line_arr[1];
- if (count($arr) > 2) {
- $comment = $line_arr[2];
- } else {
- $comment = "";
- }
- if ( empty($format) || empty($string) ) {
- continue;
- }
- print("<h4>** Case : $comment ******************************</h4>");
- do_sscanf($string,$format);
- }
-}
-
-function simple_tests() {
- echo "Testing sscanf with standard ANSI syntax (values returned by
-reference)-<br>";
- $decimal = -1;
- $string = "";
- $hex = 0;
- $float = 0.0;
- $octal = 0.0;
- $int = -1;
-
- echo "<h3><em><br>Simple Test<br></em></h3>";
- echo "sscanf('10','%d',&\$decimal) <br>";
- echo "<br>BEFORE : <br> decimal = $decimal.";
- $foo = sscanf("10","%d",&$decimal);
- echo "<br>AFTER : <br> decimal = $decimal <br>";
-
-
- echo "<h3><em><br>Simple Test 2<br></em></h3>";
- echo "sscanf(\"ghost 0xface\",\"%s %x\",&\$string, &\$int)<br>";
- echo "<br>BEFORE : <br> string = $string, int = $int<br>";
- $foo = sscanf("ghost 0xface","%s %x",&$string, &$int);
- echo "<br>AFTER : <br> string = $string, int = $int<br>";
- echo " sscan reports : ";
- print_value( $foo,"");
- echo " conversions <br>";
-
- echo "<h3><em><br>Multiple specifiers<br></em></h3>";
- echo "sscanf(\"jabberwocky 1024 0xFF 1.024 644 10\",
- \"%s %d %x %f %o %i\",
- &\$string,&\$decimal,&\$hex,&\$float,&\$octal,&\$int);<br>";
- echo "<br>BEFORE : <br>";
- echo "Decimal = $decimal, String = $string, Hex = $hex<br>";
- echo "Octal = $octal , Float = $float, Int = $int<br>";
- $foo = sscanf( "jabberwocky 1024 0xFF 1.024 644 10",
- "%s %d %x %f %o %i",
- &$string,&$decimal,&$hex,&$float,&$octal,&$int);
- echo "<br>AFTER :<br>";
- echo "decimal = $decimal, string = $string, hex = $hex<br>";
- echo "octal = $octal , float = $float, int = $int<br>";
-
- echo " sscan reports : ";
- print_value( $foo,"");
- echo " conversions <br>";
- echo "----------------------------------------<br>";
-}
-
-
-
-?>
-<html>
- <head>
- <title>Test of sscanf()</title>
- </head>
- <body>
- <strong><h1>Testing sscanf() support in PHP</h1></strong><br>
- <?php
- if (!function_exists('sscanf')) {
- echo "<strong>I'm sorry but sscanf() does not exist !i</strong><br>";
- } else {
- simple_tests();
- run_sscanf_test_cases();
- }
- ?>
- </body>
-</html>
diff --git a/tests/testswf b/tests/testswf
deleted file mode 100644
index e26733237d..0000000000
--- a/tests/testswf
+++ /dev/null
@@ -1,120 +0,0 @@
-<?php
-
-$LINEID=1;
-$LINEDEPTH=50;
-$LINESTEPS=30;
-
-$CIRCLEID=2;
-$CIRCLEDEPT=100;
-
-/* stop playing */
-function stop()
-{
- swf_startdoaction();
- swf_actionStop();
- swf_enddoaction();
-}
-
-/* play stoping */
-function play()
-{
- swf_startdoaction();
- swf_actionPlay();
- swf_enddoaction();
-}
-
-/*
- * demonstrates:
- * defining and placing an object.
- *
- */
-function flipline()
-{
- global $LINESTEPS, $LINEID, $LINEDEPTH;
-
- swf_ortho2(-100.0,100.0,-100.0,100.0);
- swf_defineline($LINEID,-60.0,0.0,60.0,0.0,1.2);
- swf_mulcolor(1.0,1.0,1.0,1.0);
- swf_addcolor(0.0,0.0,0.0,0.0);
- for($i=0; $i<$LINESTEPS; $i++) {
- $p = $i/($LINESTEPS-1.0);
- swf_pushmatrix();
- swf_rotate(60.0*$p,'z');
- swf_translate(20.0+20.0*$p,0.0,0.0);
- swf_rotate(120.0*$p,'z');
- swf_placeobject($LINEID, $LINEDEPTH);
- swf_popmatrix();
- swf_showframe();
- }
- for($i=0; $i<$LINESTEPS; $i++) {
- swf_removeobject($LINEDEPTH);
- if(($i%4) == 0)
- swf_showframe();
- }
- swf_showframe();
-}
-
-/* growblobs follows */
-
-$NBLOBS=8;
-$BLOBSTEPS=20;
-
-/*
- * demonstrates:
- * shape definition
- * placing, and modifying objects.
- *
- */
-function growblobs()
-{
- global $NBLOBS, $BLOBSTEPS, $CIRCLEDEPT, $CIRCLEID;
-
- swf_ortho2(-200.0,200.0,-200.0,200.0);
-
- swf_startshape($CIRCLEID);
- swf_shapefillsolid(0.0,0.0,0.0,1.0);
- swf_shapearc(0.0,0.0,300.0,0.0,360.0);
- swf_endshape();
-
- swf_mulcolor(1.0,1.0,1.0,1.0);
- $startframe = swf_getframe();
- for($j=0; $j<$NBLOBS; $j++) {
- swf_setframe($startframe+2*$j);
- for($i=0; $i<$BLOBSTEPS; $i++) {
- $p = $i/($BLOBSTEPS-1.0);
- swf_pushmatrix();
- swf_scale($p,$p,$p);
- swf_addcolor($p,$p,$p,0.0);
- if($i== 0)
- swf_placeobject($CIRCLEID,$CIRCLEDEPTH+$j);
- else
- swf_modifyobject($CIRCLEDEPTH+$j,MOD_COLOR|MOD_MATRIX);
- swf_popmatrix();
- swf_showframe();
- }
- swf_removeobject($CIRCLEDEPTH+$j);
- }
- swf_showframe();
-}
-
-swf_openfile("test.swf",400.0,400.0,20.0,1.0,1.0,1.0);
-flipline();
-growblobs();
-
-// trytext();
-// makebuttons();
-// stop();
-swf_showframe();
-swf_closefile();
-
-// swf_openfile("images.swf",400.0,400.0,20.0,1.0,1.0,1.0);
-// showimages();
-// brushstrokes();
-// symboltest();
-// stop();
-// swf_showframe();
-// swf_closefile();
-// fprintf(stderr,"wrote images.swf\n");
- exit(0);
-
-?>
diff --git a/win32/README.txt b/win32/README.txt
deleted file mode 100644
index d31118dcab..0000000000
--- a/win32/README.txt
+++ /dev/null
@@ -1,115 +0,0 @@
-PHP 4.0 - Win32 Distribution
-============================
-
-
-Note
-----
-
-PHP 4.0 for Windows comes in two flavours - a CGI executable (php.exe), and an
-ISAPI module (php4isapi.dll). The latter is new to PHP 4.0, and provides
-significantly improved performance and some new functionality. However,
-please note that the ISAPI module is *NOT* yet considered to be production
-quality. The reason for this is that the PHP ISAPI module uses the
-thread-safe version of the PHP code, which is completely new to PHP 4.0, and
-has not yet been tested and pounded enough to be considered completely stable,
-and there are actually a few known bugs. On the other hand, some people have
-reported very good results with the ISAPI module, even though we're not aware
-of anyone actually running it on a production site. In short - your mileage
-may vary; If you need absolute stability, trade the performance of the ISAPI
-module with the stability of the CGI executable.
-
-
-Requirements
-------------
-
-- Windows 95 or later, Windows NT 4.0 or later
-- ISAPI 4.0 compliant Web server required for ISAPI module (tested on IIS 4.0,
- PWS 4.0 IIS 5.0). IIS 3.0 is *NOT* supported; You should download and
- install the Windows NT 4.0 Option Pack with IIS 4.0 if you want native PHP
- support.
-- Windows 95 requires the DCOM update, freely available from:
- http://download.microsoft.com/msdownload/dcom/95/x86/en/dcom95.exe
-
-
-Support
--------
-
-For questions and help with PHP under Windows, your best bet would be the
-PHP-Windows mailing list (php-windows@lists.php.net). To subscribe, send
-an empty message to php-windows-subscribe@lists.php.net.
-
-
-Installation
-------------
-
-Unlike PHP 3, PHP 4 is divided into several components; Even when you use
-PHP in its CGI mode, php.exe is no longer a standalone executable, and relies
-on external DLLs for execution. For this reason, if you install php.exe as
-a handler for your web server, you must make sure that the DLLs in the
-distribution exist in a directory that is in the Windows PATH. The easiest
-way to do it is to copy these DLLs to your SYSTEM (Windows 9x) or SYSTEM32
-(Windows NT) directory, which is under your Windows directory.
-The DLLs that need to be copied are MSVCRT.DLL (it may already exist in there)
-and PHP4TS.DLL.
-
-Installation Notes for IIS 4.0 and 5.0
---------------------------------------
-
-- Install the DLLs as mentioned above.
-- If you wish to change any defaults, copy either the php.ini-dist or
- php.ini-optimized files into your Windows directory, and rename it to
- 'php.ini'. You can then modify any of the directives inside it.
-- Start the Microsoft Management Console (may appear as
- 'Internet Services Manager', either in your Windows NT 4.0 Option Pack
- branch or the Control Panel->Administrative Tools under Windows 2000).
-- Right click on your Web server node (will most probably appear as 'Default
- Web Server'), and select 'Properties'.
-- If you don't want to perform HTTP Authentication using PHP, you can (and
- should) skip this step. Under 'ISAPI Filters', add a new ISAPI filter.
- Use 'PHP' as the filter name, and supply a path to the php4isapi.dll that
- is included in the distribution.
-- Under 'Home Directory', click on the 'Configuration' button. Add a new
- entry to the Application Mappings; Use the path the php4isapi.dll as the
- Executable, supply .php as the extension, leave 'Method exclusions', blank,
- and check the Script engine checkbox.
-- Stop IIS completely (you would have to stop the IIS Administration service
- for that - stopping it through the Management Console isn't good enough;
- You can do it by typing 'net stop iisadmin' on a command prompt).
-- Start IIS again (you can do it by typing 'net start w3svc' on a command
- prompt).
-- Put a .php file under your Web server's document root and check if it works!
-
-
-
-Installation Notes for Microsoft PWS 4.0
-----------------------------------------
-
-- Install the php.ini file and the DLLs as mentioned above.
-- Edit the enclosed PWS-php4.reg file to reflect the location of your
- php4isapi.dll. Forward slashes should be escaped, for example:
-
-[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\w3svc\parameters\Script Map]
-".php"="C:\\Program Files\\PHP\\php4isapi.dll"
-
-- In the PWS Manager, right click on a given directory you want to add PHP
- support to, and select Properties. Check the 'Execute' checkbox, and
- confirm.
-
-At this point, PWS should have built-in PHP support.
-
-
-
-Adding Extensions
------------------
-
-A few pre-compiled extensions are included in this release. You can load them
-by adding a line like the following to your php.ini file:
-extension=path\to\extension\extension_name.dll
-Loading these extensions extends the functionality of PHP to support more
-functions and protocols.
-Note: MySQL support is *built-in* as of PHP 4.0. You don't need to load any
- additional extensions in order to use the MySQL functions.
-
-Good luck,
-
-Zeev <zeev@zend.com>, Andi <andi@zend.com> [June 25, 2000]
diff --git a/win32/Win32_Package.txt b/win32/Win32_Package.txt
deleted file mode 100644
index ed49267869..0000000000
--- a/win32/Win32_Package.txt
+++ /dev/null
@@ -1,19 +0,0 @@
-The Win32 package should include:
-
-Main php.exe
- php4ts.dll
- php4isapi.dll
- MSVCRT.dll
-Bundled Files README.txt
- LICENSE
- php.ini-dist
- php.ini-optimized
- PWS-php4.reg
-Bundled Modules php_calendar.dll Calendar functions
- php_exif.dll EFIF Digital Camera functions
- php_ftp.dll FTP module
- php_imap.dll IMAP module
- php_ldap.dll LDAP module
- php_mssql70.dll MS-SQL 7.0 module
- php_zlib.dll
- \ No newline at end of file
diff --git a/win32/flock.c b/win32/flock.c
deleted file mode 100644
index cc9d409784..0000000000
--- a/win32/flock.c
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Program: Unix compatibility routines
- *
- * Author: Mark Crispin
- * Networks and Distributed Computing
- * Computing & Communications
- * University of Washington
- * Administration Building, AG-44
- * Seattle, WA 98195
- * Internet: MRC@CAC.Washington.EDU
- *
- * Date: 14 September 1996
- * Last Edited: 14 August 1997
- *
- * Copyright 1997 by the University of Washington
- *
- * Permission to use, copy, modify, and distribute this software and its
- * documentation for any purpose and without fee is hereby granted, provided
- * that the above copyright notice appears in all copies and that both the
- * above copyright notice and this permission notice appear in supporting
- * documentation, and that the name of the University of Washington not be
- * used in advertising or publicity pertaining to distribution of the software
- * without specific, written prior permission. This software is made available
- * "as is", and
- * THE UNIVERSITY OF WASHINGTON DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED,
- * WITH REGARD TO THIS SOFTWARE, INCLUDING WITHOUT LIMITATION ALL IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, AND IN
- * NO EVENT SHALL THE UNIVERSITY OF WASHINGTON BE LIABLE FOR ANY SPECIAL,
- * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
- * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, TORT
- * (INCLUDING NEGLIGENCE) OR STRICT LIABILITY, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- */
-
-
-/* DEDICATION
-
- * This file is dedicated to my dog, Unix, also known as Yun-chan and
- * Unix J. Terwilliker Jehosophat Aloysius Monstrosity Animal Beast. Unix
- * passed away at the age of 11 1/2 on September 14, 1996, 12:18 PM PDT, after
- * a two-month bout with cirrhosis of the liver.
- *
- * He was a dear friend, and I miss him terribly.
- *
- * Lift a leg, Yunie. Luv ya forever!!!!
- */
-
-#include <windows.h>
-#include <io.h>
-#include <errno.h>
-#include "flock.h"
-
-int flock(int fd, int op)
-{
- HANDLE hdl = (HANDLE) _get_osfhandle(fd);
- DWORD low = 1, high = 0;
- OVERLAPPED offset =
- {0, 0, 0, 0, NULL};
- if (hdl < 0)
- return -1; /* error in file descriptor */
- /* bug for bug compatible with Unix */
- UnlockFileEx(hdl, 0, low, high, &offset);
- switch (op & ~LOCK_NB) { /* translate to LockFileEx() op */
- case LOCK_EX: /* exclusive */
- if (LockFileEx(hdl, LOCKFILE_EXCLUSIVE_LOCK +
- ((op & LOCK_NB) ? LOCKFILE_FAIL_IMMEDIATELY : 0),
- 0, low, high, &offset))
- return 0;
- break;
- case LOCK_SH: /* shared */
- if (LockFileEx(hdl, ((op & LOCK_NB) ? LOCKFILE_FAIL_IMMEDIATELY : 0),
- 0, low, high, &offset))
- return 0;
- break;
- case LOCK_UN: /* unlock */
- return 0; /* always succeeds */
- default: /* default */
- break;
- }
- errno = EINVAL; /* bad call */
- return -1;
-}
diff --git a/win32/flock.h b/win32/flock.h
deleted file mode 100644
index fe07adf954..0000000000
--- a/win32/flock.h
+++ /dev/null
@@ -1,11 +0,0 @@
-#define fsync _commit
-#define ftruncate chsize
-
-/* For flock() emulation */
-
-#define LOCK_SH 1
-#define LOCK_EX 2
-#define LOCK_NB 4
-#define LOCK_UN 8
-
-extern int flock(int fd, int op);
diff --git a/win32/grp.h b/win32/grp.h
deleted file mode 100644
index e7a99327e2..0000000000
--- a/win32/grp.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/* pwd.h - Try to approximate UN*X's getuser...() functions under MS-DOS.
- Copyright (C) 1990 by Thorsten Ohl, td12@ddagsi3.bitnet
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 1, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
- $Header$
- */
-
-/* This 'implementation' is conjectured from the use of this functions in
- the RCS and BASH distributions. Of course these functions don't do too
- much useful things under MS-DOS, but using them avoids many "#ifdef
- MSDOS" in ported UN*X code ... */
-
-struct group {
- char *gr_name; /* group name */
- char *gr_passwd; /* group password */
- int gr_gid; /* group id */
- char **gr_mem; /* group members */
-};
diff --git a/win32/install.txt b/win32/install.txt
deleted file mode 100644
index 94c37e4c57..0000000000
--- a/win32/install.txt
+++ /dev/null
@@ -1,148 +0,0 @@
-Extensions
-----------
-MySQL, ODBC, FTP, Calendar, BCMath, COM, PCRE, Session, WDDX and XML support is *built-in*.
-You don't need to load any additional extensions in order to use these functions.
-
-
-Folders
--------
-- mibs
-The mibs directory contains support files for SNMP.
-This directory should be moved to DRIVE:\usr\mibs (DRIVE being the drive where PHP is installed.)
-
-- dlls
-Some DLLs that are required for PHP and some extensions. Please copy them to your to your windows/system (Win9.x)
-or winnt/system32 (WinNT, Win2000) directory.
-If you already have these DLLs installed on your system, overwrite them only if something is not working correctly.
-Before overwriting them, it is a good idea to back them or move them to another folder - just in case something goes wrong.
-
-
-Installtion instructions
-------------------------
-
-Apache:
-1. Stop the Apache Webserver.
-Edit the httpd.conf and put in these lines, modified to your environment:
-
-# for the apache module
-LoadModule php4_module c:/php/sapi/php4apache.dll
-AddType application/x-httpd-php .php4
-
-#for the cgi binary (you can use that one compiled with force cgi redirect too)
-ScriptAlias /php4/ "C:/php/"
-Action application/x-httpd-php4 "/php4/php.exe"
-AddType application/x-httpd-php4 .php
-
-2. Unzip the Package to c:\php, now move php4ts.dll to the windows/system(32) directory, overwritte any older file!
-
-3. Copy the php.ini-dist to your sysroot (directory where you installed windows), rename it to php.ini, and
-edit the php.ini to fit your needs.
-
-4. Restart the Apache server.
-
-
-
-Oreilly Wesite Pro:
-1. First make sure that you got atleast Version 2.5
-2. Edit the Server Properties and select the tab "Mapping"
-3. From the List select "Associations" and enter the desired extension (".php") and the path to the cgi exe or the isapi dll
-4. Now select "Content Types" add the same extension ".php" and enter the contenttype:
-cgi wwwserver/shellcgi
-isapi wwwserver/isapi
-
-5. Copy the php.ini-dist to your Systemroot (Directory where you installed windows), rename it to php.ini, and
-edit it to fit your needs.
-6. Edit the php.ini to fit your needs.
-
-
-Xitami:
-1. Copy the php.ini-dist to your Systemroot (Directory where you installed windows), rename it to php.ini, and
-edit it to fit your needs.
-2. Make sure the webserver is running, and point your browser to xitamis admin console (usually http://127.0.0.1/admin), and click on Configuration
-3. Now navigate to the Filters, and put the extension which php should parse (i.e. .php) into the field File extensions (.xxx)
-4. In Filter command or script put the path and name of your php executable i.e. c:\php\php.exe
-5. Press the 'Save' icon
-
-
-IIS 4.0+ (isapi):
-1. Copy the php.ini-dist to your systemroot (the directory where you installed windows), rename it to php.ini, and
-edit it to fit your needs
-2. Start the Microsoft Management Console or the Internet Services Manager, located in your Control Panel
-3. Click on your webserver, and select properties
-4. If you don't want to perform HTTP Authentication using PHP, you can (and should) skip this step. Under ISAPI Filters,
-add a new ISAPI filter. Use PHP as the filter name, and supply a path to the php4isapi.dll
-5. Under Home Directory, click on the Configuration button. Add a new entry to the Application Mappings. Use the path the
-php4isapi.dll as the Executable, supply .php as the extension, leave Method exclusions, blank, and check the Script engine
-checkbox
-6. Stop IIS completely
-7. Start IIS again
-
-
-IIS 4.0+ (CGI)
-1. Copy the php.ini-dist to your systemroot (the directory where you installed windows), rename it to php.ini, and
-edit it to fit your needs
-2. Start the Microsoft Management Console (may appear as 'Internet Services Manager', either in your Windows NT 4.0
-Option Pack branch or the Control Panel->Administrative Tools under Windows 2000).
-3. Right click on your Web server node (will most probably appear as 'Default Web Server'), and select 'Properties'.
-4. Under 'Home Directory', click on the 'Configuration' button. Add a new
-5. entry to the Application Mappings; Use the path to php.exe as the Executable, supply .php as the extension, leave
-'Method exclusions', blank, and check the Script engine checkbox.
-6. Put a .php file under your Web server's document root and check if it works!
-
-
-PWS 4.0+ (isapi):
-1. Copy the php.ini-dist to your systemroot (the directory where you installed windows), rename it to php.ini, and
-edit it to fit your needs
-2. Edit the enclosed PWS-php4isapi.reg (ISAPI interface) or PWS-php4cgi.reg (CGI interface) file to reflect the location of
-your php4isapi.dll / php.exe. Forward slashes should be escaped, for example:
-[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\w3svc\parameters\Script Map] ".php"="C:\\Program Files\\PHP\\php4isapi.dll"
-3. In the PWS Manager, right click on a given directory you want to add PHP support to, and select Properties. Check the 'Execute' checkbox, and confirm.
-
-
-PWS 4.0+ (CGI):
-1. Copy the php.ini-dist to your systemroot (the directory where you installed windows), rename it to php.ini, and
-edit it to fit your needs
-2. Edit the enclosed PWS-php4.reg file to reflect the location of your php.exe. Forward slashes should be escaped,
-for example:
-[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\w3svc\parameters\Script Map] ".php"="C:\\Program Files\\PHP\\php.exe"
-3. In the PWS Manager, right click on a given directory you want to add PHP
-support to, and select Properties. Check the 'Execute' checkbox, and
-confirm.
-4. At this point, PWS should have built-in PHP support.
-
-NETSCAPE SERVERS, PHP as CGI (for Netscape Enterprise Server, iPlanet, perhaps Fastrack..)
-1. Copy the php.ini-dist to your systemroot (the directory where you installed windows), and edit it to fit your needs
-2. Copy php4ts.dll to your systemroot (the directory where you installed windows)
-3. Make a file assocition from the command line (type the 2 following lines)
- assoc .php=PHPScript
- ftype PHPScript=d:\php4\php.exe %1 %*
-4. In the Netscape Enterprise Administration Server create a dummy shellcgi directory and remove it just after
- (this step creates 5 important lines in obj.conf and allow the web server to handle shellcgi scripts)
-5. In the Netscape Enterprise Administration Server create a new mime type
- (Category:type,Content-Type:magnus-internal/shellcgi,File Suffix:php)
-6. Do it for each web server instance you want php to run
-7. More details http://benoit.noss.free.fr/php/install-php.html
-
-
-NETSCAPE SERVERS, PHP as NSAPI (for Netscape Enterprise Server, iPlanet, perhaps Fastrack..)
-1. Copy the php.ini-dist to your systemroot (the directory where you installed windows), and edit it to fit your needs
-2. Copy php4ts.dll to your systemroot (the directory where you installed windows)
-3. Make a file assocition from the command line (type the 2 following lines)
- assoc .php=PHPScript
- ftype PHPScript=d:\php4\php.exe %1 %*
-4. In the Netscape Enterprise Administration Server create a new mime type
- (Category:type,Content-Type:magnus-internal/x-httpd-php,File Suffix:php)
-5. Stop your web service and edit obj.conf
-6.1 At the end of the Init section, place this 2 lines (necessarely after mime type init!)
- Init fn="load-modules" funcs="php4_init,php4_close,php4_execute,php4_auth_trans" shlib="d:/php4/sapi/php4nsapi.dll"
- Init fn="php4_init" errorString="Failed to initialise PHP!"
-6.2 In The < Object name="default" > section, place this line necessarely after all 'ObjectType' and before all 'AddLog' lines!
- Service fn="php4_execute" type="magnus-internal/x-httpd-php"
-6.3 At the end of the file, create a new object called x-httpd-php, by inserting this lines
- <Object name="x-httpd-php">
- ObjectType fn="force-type" type="magnus-internal/x-httpd-php"
- Service fn=php4_execute
- </Object>
-7. Restart your web service and apply changes
-8. Do it for each web server instance you want php to run
-9. More details http://benoit.noss.free.fr/php/install-php4.html \ No newline at end of file
diff --git a/win32/param.h b/win32/param.h
deleted file mode 100644
index 3d0da1e8d3..0000000000
--- a/win32/param.h
+++ /dev/null
@@ -1,16 +0,0 @@
-
-/*****************************************************************************
- * *
- * sys/param.c *
- * *
- * Freely redistributable and modifiable. Use at your own risk. *
- * *
- * Copyright 1994 The Downhill Project *
- * *
- *****************************************************************************/
-#ifndef MAXPATHLEN
-#define MAXPATHLEN _MAX_PATH
-#endif
-#define MAXHOSTNAMELEN 64
-#define howmany(x,y) (((x)+((y)-1))/(y))
-#define roundup(x,y) ((((x)+((y)-1))/(y))*(y))
diff --git a/win32/php4.dsp b/win32/php4.dsp
deleted file mode 100644
index 2ac2aa056a..0000000000
--- a/win32/php4.dsp
+++ /dev/null
@@ -1,134 +0,0 @@
-# Microsoft Developer Studio Project File - Name="php4" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=php4 - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "php4.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "php4.mak" CFG="php4 - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "php4 - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "php4 - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE "php4 - Win32 Release_inline" (based on "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "php4 - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "..\Release"
-# PROP Intermediate_Dir "..\Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I ".." /I "..\main" /I "..\Zend" /I "..\regex\\" /I "..\..\bindlib_w32" /I "..\TSRM" /D "NDEBUG" /D "_CONSOLE" /D ZEND_DEBUG=0 /D "MSVC5" /D "WIN32" /D "_MBCS" /D "ZEND_WIN32" /D "PHP_WIN32" /Fr /FD /c
-# SUBTRACT CPP /YX /Yc /Yu
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 php4nts.lib winmm.lib wsock32.lib netapi32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /version:3.0 /subsystem:console /machine:I386 /nodefaultlib:"libc.lib" /out:"..\Release\php.exe" /libpath:"..\Release"
-
-!ELSEIF "$(CFG)" == "php4 - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "..\Debug"
-# PROP Intermediate_Dir "..\Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I ".." /I "..\main" /I "..\Zend" /I "..\regex\\" /I "..\..\bindlib_w32" /I "..\TSRM" /D "DEBUG" /D "_DEBUG" /D "_CONSOLE" /D ZEND_DEBUG=1 /D "MSVC5" /D "WIN32" /D "_MBCS" /D "ZEND_WIN32" /D "PHP_WIN32" /FR /FD /c
-# SUBTRACT CPP /YX
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /i "c:\include" /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 winmm.lib wsock32.lib netapi32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4nts_debug.lib /nologo /version:3.0 /subsystem:console /debug /machine:I386 /nodefaultlib:"libcd" /nodefaultlib:"libcmt" /out:"..\Debug\php.exe" /pdbtype:sept /libpath:"..\Debug"
-# SUBTRACT LINK32 /pdb:none
-
-!ELSEIF "$(CFG)" == "php4 - Win32 Release_inline"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "php4___Win32_Release_inline"
-# PROP BASE Intermediate_Dir "php4___Win32_Release_inline"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "..\Release_inline"
-# PROP Intermediate_Dir "..\Release_inline"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "Zend" /I "." /I "regex\\" /I "..\bindlib_w32" /D "NDEBUG" /D "MSVC5" /D "_CONSOLE" /D "WIN32" /D "_MBCS" /D ZEND_DEBUG=0 /Fr /FD /c
-# SUBTRACT BASE CPP /YX /Yc /Yu
-# ADD CPP /nologo /MD /W3 /GX /O2 /I ".." /I "..\main" /I "..\Zend" /I "..\regex\\" /I "..\..\bindlib_w32" /I "..\TSRM" /D "NDEBUG" /D "_CONSOLE" /D ZEND_DEBUG=0 /D "ZEND_WIN32_FORCE_INLINE" /D "MSVC5" /D "WIN32" /D "_MBCS" /D "ZEND_WIN32" /D "PHP_WIN32" /Fr /FD /c
-# SUBTRACT CPP /YX /Yc /Yu
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 php4nts.lib winmm.lib wsock32.lib netapi32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /version:3.0 /subsystem:console /machine:I386 /nodefaultlib:"libc.lib" /out:"Release\php.exe" /libpath:"Release"
-# ADD LINK32 php4nts.lib winmm.lib wsock32.lib netapi32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /version:3.0 /subsystem:console /machine:I386 /nodefaultlib:"libc.lib" /out:"..\Release\php.exe" /libpath:"..\Release_inline"
-
-!ENDIF
-
-# Begin Target
-
-# Name "php4 - Win32 Release"
-# Name "php4 - Win32 Debug"
-# Name "php4 - Win32 Release_inline"
-# Begin Group "Source Files"
-
-# PROP Default_Filter ".c"
-# Begin Source File
-
-SOURCE=..\sapi\cgi\cgi_main.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\sapi\cgi\getopt.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter ".h"
-# End Group
-# End Target
-# End Project
diff --git a/win32/php4.dsw b/win32/php4.dsw
deleted file mode 100644
index 25e42c8a46..0000000000
--- a/win32/php4.dsw
+++ /dev/null
@@ -1,89 +0,0 @@
-Microsoft Developer Studio Workspace File, Format Version 6.00
-# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
-
-###############################################################################
-
-Project: "TSRM"=..\TSRM\TSRM.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "Zend"=..\Zend\Zend.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "libmysql"=..\ext\mysql\libmysql\libmysql.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "php4"=.\php4.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name php4dll
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "php4dll"=.\php4dll.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name Zend
- End Project Dependency
- Begin Project Dependency
- Project_Dep_Name libmysql
- End Project Dependency
- Begin Project Dependency
- Project_Dep_Name TSRM
- End Project Dependency
-}}}
-
-###############################################################################
-
-Global:
-
-Package=<5>
-{{{
-}}}
-
-Package=<3>
-{{{
-}}}
-
-###############################################################################
-
diff --git a/win32/php4dll.dsp b/win32/php4dll.dsp
deleted file mode 100644
index 2957f979c9..0000000000
--- a/win32/php4dll.dsp
+++ /dev/null
@@ -1,1683 +0,0 @@
-# Microsoft Developer Studio Project File - Name="php4dll" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=php4dll - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "php4dll.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "php4dll.mak" CFG="php4dll - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "php4dll - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "php4dll - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "php4dll - Win32 Release_inline" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "php4dll - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "..\Debug"
-# PROP Intermediate_Dir "..\Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PHP4DLLTS_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I ".." /I "..\main" /I "..\Zend" /I "..\regex" /I "..\..\bindlib_w32" /I "..\TSRM" /D "_DEBUG" /D "_WINDOWS" /D "_USRDLL" /D "PHP4DLLTS_EXPORTS" /D "PHP_EXPORTS" /D "LIBZEND_EXPORTS" /D "SAPI_EXPORTS" /D "TSRM_EXPORTS" /D ZEND_DEBUG=1 /D "MSVC5" /D "WIN32" /D "_MBCS" /D "ZEND_WIN32" /D "PHP_WIN32" /FR /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "_DEBUG"
-# ADD RSC /l 0x40d /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib wsock32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib Zend.lib resolv.lib libmysql.lib TSRM.lib /nologo /dll /debug /machine:I386 /nodefaultlib:"libcmt" /nodefaultlib:"libc" /nodefaultlib:"libcmtd" /out:"..\Debug\php4nts_debug.dll" /pdbtype:sept /libpath:"..\TSRM\Debug_TS" /libpath:"..\Zend\Debug" /libpath:"..\..\bindlib_w32\Debug" /libpath:"..\ext\mysql\libmysql\Debug"
-
-!ELSEIF "$(CFG)" == "php4dll - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "..\Release"
-# PROP Intermediate_Dir "..\Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PHP4DLLTS_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I ".." /I "..\main" /I "..\Zend" /I "..\regex" /I "..\..\bindlib_w32" /I "..\TSRM" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "PHP4DLL_EXPORTS" /D "PHP_EXPORTS" /D "SAPI_EXPORTS" /D "LIBZEND_EXPORTS" /D ZEND_DEBUG=0 /D "MSVC5" /D "WIN32" /D "_MBCS" /D "ZEND_WIN32" /D "PHP_WIN32" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "NDEBUG"
-# ADD RSC /l 0x40d /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib wsock32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib Zend.lib resolv.lib libmysql.lib /nologo /dll /machine:I386 /nodefaultlib:"libc.lib" /out:"..\Release\php4nts.dll" /libpath:"..\Zend\Release" /libpath:"..\..\bindlib_w32\Release" /libpath:"..\ext\mysql\libmysql\Release"
-
-!ELSEIF "$(CFG)" == "php4dll - Win32 Release_inline"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "php4dll___Win32_Release_inline"
-# PROP BASE Intermediate_Dir "php4dll___Win32_Release_inline"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "..\Release_inline"
-# PROP Intermediate_Dir "..\Release_inline"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "Zend" /I "." /I "regex" /I "..\bindlib_w32" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "PHP4DLLTS_EXPORTS" /D "MSVC5" /D "PHP_EXPORTS" /D "LIBZEND_EXPORTS" /D "SAPI_EXPORTS" /D ZEND_DEBUG=0 /D "TSRM_EXPORTS" /D "WIN32" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "Zend" /I "." /I "regex" /I "..\bindlib_w32" /I "main" /I ".." /I "..\main" /I "..\Zend" /I "..\regex" /I "..\..\bindlib_w32" /I "..\TSRM" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "PHP4DLLTS_EXPORTS" /D "PHP_EXPORTS" /D "LIBZEND_EXPORTS" /D "SAPI_EXPORTS" /D "TSRM_EXPORTS" /D ZEND_DEBUG=0 /D "ZEND_WIN32_FORCE_INLINE" /D "MSVC5" /D "WIN32" /D "_MBCS" /D "ZEND_WIN32" /D "PHP_WIN32" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "NDEBUG"
-# ADD RSC /l 0x40d /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib wsock32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib Zend.lib resolv.lib /nologo /dll /machine:I386 /nodefaultlib:"libc.lib" /out:"Release/php4nts.dll" /libpath:"TSRM\Release" /libpath:"Zend\Release" /libpath:"..\bindlib_w32\Release"
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib wsock32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib Zend.lib resolv.lib libmysql.lib /nologo /dll /machine:I386 /nodefaultlib:"libc.lib" /out:"..\Release\php4nts.dll" /libpath:"..\Zend\Release_inline" /libpath:"..\..\bindlib_w32\Release" /libpath:"..\ext\mysql\libmysql\Release"
-
-!ENDIF
-
-# Begin Target
-
-# Name "php4dll - Win32 Debug"
-# Name "php4dll - Win32 Release"
-# Name "php4dll - Win32 Release_inline"
-# Begin Group "Core"
-
-# PROP Default_Filter ""
-# Begin Group "Source Files"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\ext\standard\cyr_convert.c
-# End Source File
-# Begin Source File
-
-SOURCE="..\main\fopen_wrappers.c"
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\internal_functions_win32.c
-# ADD CPP /I "..\ext\xml\expat\xmlparse" /I "ext\xml\expat\xmltok"
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\main.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\mergesort.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\network.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\output.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\php_content_types.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\php_ini.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\php_logos.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\php_open_temporary_file.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\php_ticks.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\php_variables.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\quot_print.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\reentrancy.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\rfc1867.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\safe_mode.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\SAPI.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\strlcat.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\strlcpy.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\main\config.w32.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\cyr_convert.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\getopt.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\internal_functions_registry.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\logos.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\main.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\output.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\php.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\php3_compat.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\php_content_types.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\php_globals.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\php_ini.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\php_logos.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\php_open_temporary_file.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\php_realpath.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\php_ticks.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\php_variables.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\quot_print.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\rfc1867.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\safe_mode.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\SAPI.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\win95nt.h
-# End Source File
-# End Group
-# End Group
-# Begin Group "Function Modules"
-
-# PROP Default_Filter ""
-# Begin Group "Source Files No. 1"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\ext\standard\array.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\assert.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\base64.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\basic_functions.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\bcmath.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\browscap.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\crc32.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\credits.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\datetime.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\dir.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\dl.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\dns.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\exec.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\file.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\filestat.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\flock_compat.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\formatted_print.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\fsock.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\ftp_fopen_wrapper.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\head.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\html.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\http_fopen_wrapper.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\image.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\incomplete_class.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\info.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\iptc.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\lcg.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\levenshtein.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\link.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\mail.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\math.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\md5.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\metaphone.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\microtime.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\session\mod_files.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\session\mod_user.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\pack.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\pageinfo.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\parsedate.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\php_fopen_wrapper.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\mysql\php_mysql.c
-# ADD CPP /I "..\ext\mysql\libmysql"
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\odbc\php_odbc.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\pcre\php_pcre.c
-
-!IF "$(CFG)" == "php4dll - Win32 Debug"
-
-# ADD CPP /D "STATIC"
-
-!ELSEIF "$(CFG)" == "php4dll - Win32 Release"
-
-!ELSEIF "$(CFG)" == "php4dll - Win32 Release_inline"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\rand.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\reg.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\scanf.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\session\session.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\soundex.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\string.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\strnatcmp.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\syslog.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\type.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\uniqid.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\url.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\url_scanner.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\url_scanner_ex.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\var.c
-# End Source File
-# End Group
-# Begin Group "Header Files No. 1"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\ext\standard\base64.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\basic_functions.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\datetime.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\dl.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\dns.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\exec.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\file.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\flock_compat.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\fsock.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\functions\global.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\head.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\html.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\md5.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\mime.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\session\mod_user.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\pageinfo.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\php_bcmath.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\php_dir.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\php_filestat.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\php_fopen_wrappers.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\ldap\php_ldap.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\php_mail.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\php_metaphone.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\mysql\php_mysql.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\odbc\php_odbc.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\pcre\php_pcre.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\php_string.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\php_syslog.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\functions\phpdir.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\functions\phpmath.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\reg.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\scanf.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\type.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\uniqid.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\url.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\url_scanner.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\url_scanner_ex.h
-# End Source File
-# End Group
-# Begin Group "Regular Expressions"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\regex\regcomp.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\regex\regerror.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\regex\regexec.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\regex\regfree.c
-# End Source File
-# End Group
-# Begin Group "PCRE"
-
-# PROP Default_Filter ""
-# Begin Group "Source Files No. 3"
-
-# PROP Default_Filter ".c"
-# Begin Source File
-
-SOURCE=..\ext\pcre\pcrelib\chartables.c
-
-!IF "$(CFG)" == "php4dll - Win32 Debug"
-
-# ADD CPP /D "STATIC"
-
-!ELSEIF "$(CFG)" == "php4dll - Win32 Release"
-
-!ELSEIF "$(CFG)" == "php4dll - Win32 Release_inline"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\pcre\pcrelib\get.c
-
-!IF "$(CFG)" == "php4dll - Win32 Debug"
-
-# ADD CPP /D "STATIC"
-
-!ELSEIF "$(CFG)" == "php4dll - Win32 Release"
-
-!ELSEIF "$(CFG)" == "php4dll - Win32 Release_inline"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\pcre\pcrelib\maketables.c
-
-!IF "$(CFG)" == "php4dll - Win32 Debug"
-
-# ADD CPP /D "STATIC"
-
-!ELSEIF "$(CFG)" == "php4dll - Win32 Release"
-
-!ELSEIF "$(CFG)" == "php4dll - Win32 Release_inline"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\pcre\pcrelib\pcre.c
-
-!IF "$(CFG)" == "php4dll - Win32 Debug"
-
-# ADD CPP /D "STATIC"
-
-!ELSEIF "$(CFG)" == "php4dll - Win32 Release"
-
-!ELSEIF "$(CFG)" == "php4dll - Win32 Release_inline"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\pcre\pcrelib\study.c
-
-!IF "$(CFG)" == "php4dll - Win32 Debug"
-
-# ADD CPP /D "STATIC"
-
-!ELSEIF "$(CFG)" == "php4dll - Win32 Release"
-
-!ELSEIF "$(CFG)" == "php4dll - Win32 Release_inline"
-
-!ENDIF
-
-# End Source File
-# End Group
-# Begin Group "Header Files No. 3"
-
-# PROP Default_Filter ".h"
-# Begin Source File
-
-SOURCE=..\ext\pcre\pcrelib\internal.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\pcre\pcrelib\pcre.h
-# End Source File
-# End Group
-# End Group
-# Begin Group "XML"
-
-# PROP Default_Filter ""
-# Begin Group "Source Files No. 4"
-
-# PROP Default_Filter ".c"
-# Begin Source File
-
-SOURCE=..\ext\wddx\wddx.c
-# ADD CPP /I "..\ext\xml\expat\xmltok" /I "..\ext\xml\expat\xmlparse"
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\xml\xml.c
-# ADD CPP /I "..\ext\xml\expat\xmltok" /I "..\ext\xml\expat\xmlparse"
-# End Source File
-# End Group
-# Begin Group "Header Files No. 4"
-
-# PROP Default_Filter ".h"
-# Begin Source File
-
-SOURCE=..\ext\xml\php_xml.h
-# End Source File
-# End Group
-# Begin Group "expat"
-
-# PROP Default_Filter ""
-# Begin Group "Source Files No. 5"
-
-# PROP Default_Filter ".c"
-# Begin Source File
-
-SOURCE=..\ext\xml\expat\xmlparse\hashtable.c
-# ADD CPP /I "..\ext\xml\expat\xmltok" /I "..\ext\xml\expat\xmlparse"
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\xml\expat\xmlparse\xmlparse.c
-# ADD CPP /I "..\ext\xml\expat\xmltok" /I "..\ext\xml\expat\xmlparse"
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\xml\expat\xmltok\xmlrole.c
-# ADD CPP /I "..\ext\xml\expat\xmltok" /I "..\ext\xml\expat\xmlparse"
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\xml\expat\xmltok\xmltok.c
-# ADD CPP /I "..\ext\xml\expat\xmltok" /I "..\ext\xml\expat\xmlparse"
-# End Source File
-# End Group
-# Begin Group "Header Files No. 5"
-
-# PROP Default_Filter ".h"
-# Begin Source File
-
-SOURCE=..\ext\xml\expat\xmltok\asciitab.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\xml\expat\xmltok\iasciitab.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\xml\expat\xmltok\latin1tab.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\xml\expat\xmltok\nametab.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\xml\expat\xmltok\utf8tab.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\xml\expat\xmltok\xmldef.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\xml\expat\xmltok\xmlrole.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\xml\expat\xmltok\xmltok.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\xml\expat\xmltok\xmltok_impl.c
-# PROP Exclude_From_Build 1
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\xml\expat\xmltok\xmltok_impl.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\xml\expat\xmltok\xmltok_ns.c
-# PROP Exclude_From_Build 1
-# End Source File
-# End Group
-# End Group
-# End Group
-# Begin Group "FTP"
-
-# PROP Default_Filter ""
-# Begin Group "Source Files No. 6"
-
-# PROP Default_Filter ".c"
-# Begin Source File
-
-SOURCE=..\ext\ftp\ftp.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\ftp\php_ftp.c
-# End Source File
-# End Group
-# Begin Group "Header Files No. 6"
-
-# PROP Default_Filter ".h"
-# Begin Source File
-
-SOURCE=..\ext\ftp\ftp.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\ftp\php_ftp.h
-# End Source File
-# End Group
-# End Group
-# Begin Group "Calendar"
-
-# PROP Default_Filter ""
-# Begin Group "Source Files No. 7"
-
-# PROP Default_Filter ".c"
-# Begin Source File
-
-SOURCE=..\ext\calendar\cal_unix.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\calendar\calendar.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\calendar\dow.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\calendar\easter.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\calendar\french.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\calendar\gregor.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\calendar\jewish.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\calendar\julian.c
-# End Source File
-# End Group
-# Begin Group "Header Files No. 7"
-
-# PROP Default_Filter ".h"
-# Begin Source File
-
-SOURCE=..\ext\calendar\php_calendar.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\calendar\sdncal.h
-# End Source File
-# End Group
-# End Group
-# Begin Group "bcmath"
-
-# PROP Default_Filter ""
-# Begin Group "Source Files No. 8"
-
-# PROP Default_Filter ".c"
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\add.c
-
-!IF "$(CFG)" == "php4dll - Win32 Debug"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug"
-# ADD CPP /I "..\ext\mysql\libmysql" /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dll - Win32 Release"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release"
-# ADD CPP /I "..\ext\mysql\libmysql" /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dll - Win32 Release_inline"
-
-# ADD CPP /I "..\ext\mysql\libmysql" /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\compare.c
-
-!IF "$(CFG)" == "php4dll - Win32 Debug"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug"
-# ADD CPP /I "..\ext\mysql\libmysql" /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dll - Win32 Release"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release"
-# ADD CPP /I "..\ext\mysql\libmysql" /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dll - Win32 Release_inline"
-
-# ADD CPP /I "..\ext\mysql\libmysql" /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\debug.c
-
-!IF "$(CFG)" == "php4dll - Win32 Debug"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug"
-# ADD CPP /I "..\ext\mysql\libmysql" /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dll - Win32 Release"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release"
-# ADD CPP /I "..\ext\mysql\libmysql" /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dll - Win32 Release_inline"
-
-# ADD CPP /I "..\ext\mysql\libmysql" /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\div.c
-
-!IF "$(CFG)" == "php4dll - Win32 Debug"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug"
-# ADD CPP /I "..\ext\mysql\libmysql" /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dll - Win32 Release"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release"
-# ADD CPP /I "..\ext\mysql\libmysql" /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dll - Win32 Release_inline"
-
-# ADD CPP /I "..\ext\mysql\libmysql" /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\divmod.c
-
-!IF "$(CFG)" == "php4dll - Win32 Debug"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug"
-# ADD CPP /I "..\ext\mysql\libmysql" /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dll - Win32 Release"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release"
-# ADD CPP /I "..\ext\mysql\libmysql" /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dll - Win32 Release_inline"
-
-# ADD CPP /I "..\ext\mysql\libmysql" /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\doaddsub.c
-
-!IF "$(CFG)" == "php4dll - Win32 Debug"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug"
-# ADD CPP /I "..\ext\mysql\libmysql" /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dll - Win32 Release"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release"
-# ADD CPP /I "..\ext\mysql\libmysql" /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dll - Win32 Release_inline"
-
-# ADD CPP /I "..\ext\mysql\libmysql" /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\init.c
-
-!IF "$(CFG)" == "php4dll - Win32 Debug"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug"
-# ADD CPP /I "..\ext\mysql\libmysql" /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dll - Win32 Release"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release"
-# ADD CPP /I "..\ext\mysql\libmysql" /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dll - Win32 Release_inline"
-
-# ADD CPP /I "..\ext\mysql\libmysql" /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\int2num.c
-
-!IF "$(CFG)" == "php4dll - Win32 Debug"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug"
-# ADD CPP /I "..\ext\mysql\libmysql" /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dll - Win32 Release"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release"
-# ADD CPP /I "..\ext\mysql\libmysql" /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dll - Win32 Release_inline"
-
-# ADD CPP /I "..\ext\mysql\libmysql" /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\nearzero.c
-
-!IF "$(CFG)" == "php4dll - Win32 Debug"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug"
-# ADD CPP /I "..\ext\mysql\libmysql" /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dll - Win32 Release"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release"
-# ADD CPP /I "..\ext\mysql\libmysql" /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dll - Win32 Release_inline"
-
-# ADD CPP /I "..\ext\mysql\libmysql" /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\neg.c
-
-!IF "$(CFG)" == "php4dll - Win32 Debug"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug"
-# ADD CPP /I "..\ext\mysql\libmysql" /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dll - Win32 Release"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release"
-# ADD CPP /I "..\ext\mysql\libmysql" /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dll - Win32 Release_inline"
-
-# ADD CPP /I "..\ext\mysql\libmysql" /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\num2long.c
-
-!IF "$(CFG)" == "php4dll - Win32 Debug"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug"
-# ADD CPP /I "..\ext\mysql\libmysql" /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dll - Win32 Release"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release"
-# ADD CPP /I "..\ext\mysql\libmysql" /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dll - Win32 Release_inline"
-
-# ADD CPP /I "..\ext\mysql\libmysql" /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\num2str.c
-
-!IF "$(CFG)" == "php4dll - Win32 Debug"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug"
-# ADD CPP /I "..\ext\mysql\libmysql" /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dll - Win32 Release"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release"
-# ADD CPP /I "..\ext\mysql\libmysql" /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dll - Win32 Release_inline"
-
-# ADD CPP /I "..\ext\mysql\libmysql" /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\outofmem.c
-
-!IF "$(CFG)" == "php4dll - Win32 Debug"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug"
-# ADD CPP /I "..\ext\mysql\libmysql" /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dll - Win32 Release"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release"
-# ADD CPP /I "..\ext\mysql\libmysql" /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dll - Win32 Release_inline"
-
-# ADD CPP /I "..\ext\mysql\libmysql" /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\output.c
-
-!IF "$(CFG)" == "php4dll - Win32 Debug"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug"
-# ADD CPP /I "..\ext\mysql\libmysql" /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dll - Win32 Release"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release"
-# ADD CPP /I "..\ext\mysql\libmysql" /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dll - Win32 Release_inline"
-
-# ADD CPP /I "..\ext\mysql\libmysql" /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\raise.c
-
-!IF "$(CFG)" == "php4dll - Win32 Debug"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug"
-# ADD CPP /I "..\ext\mysql\libmysql" /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dll - Win32 Release"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release"
-# ADD CPP /I "..\ext\mysql\libmysql" /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dll - Win32 Release_inline"
-
-# ADD CPP /I "..\ext\mysql\libmysql" /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\raisemod.c
-
-!IF "$(CFG)" == "php4dll - Win32 Debug"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug"
-# ADD CPP /I "..\ext\mysql\libmysql" /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dll - Win32 Release"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release"
-# ADD CPP /I "..\ext\mysql\libmysql" /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dll - Win32 Release_inline"
-
-# ADD CPP /I "..\ext\mysql\libmysql" /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\recmul.c
-
-!IF "$(CFG)" == "php4dll - Win32 Debug"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug"
-# ADD CPP /I "..\ext\mysql\libmysql" /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dll - Win32 Release"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release"
-# ADD CPP /I "..\ext\mysql\libmysql" /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dll - Win32 Release_inline"
-
-# ADD CPP /I "..\ext\mysql\libmysql" /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\rmzero.c
-
-!IF "$(CFG)" == "php4dll - Win32 Debug"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug"
-# ADD CPP /I "..\ext\mysql\libmysql" /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dll - Win32 Release"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release"
-# ADD CPP /I "..\ext\mysql\libmysql" /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dll - Win32 Release_inline"
-
-# ADD CPP /I "..\ext\mysql\libmysql" /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\rt.c
-
-!IF "$(CFG)" == "php4dll - Win32 Debug"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug"
-# ADD CPP /I "..\ext\mysql\libmysql" /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dll - Win32 Release"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release"
-# ADD CPP /I "..\ext\mysql\libmysql" /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dll - Win32 Release_inline"
-
-# ADD CPP /I "..\ext\mysql\libmysql" /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\sqrt.c
-
-!IF "$(CFG)" == "php4dll - Win32 Debug"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug"
-# ADD CPP /I "..\ext\mysql\libmysql" /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dll - Win32 Release"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release"
-# ADD CPP /I "..\ext\mysql\libmysql" /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dll - Win32 Release_inline"
-
-# ADD CPP /I "..\ext\mysql\libmysql" /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\str2num.c
-
-!IF "$(CFG)" == "php4dll - Win32 Debug"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug"
-# ADD CPP /I "..\ext\mysql\libmysql" /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dll - Win32 Release"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release"
-# ADD CPP /I "..\ext\mysql\libmysql" /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dll - Win32 Release_inline"
-
-# ADD CPP /I "..\ext\mysql\libmysql" /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\sub.c
-
-!IF "$(CFG)" == "php4dll - Win32 Debug"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug"
-# ADD CPP /I "..\ext\mysql\libmysql" /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dll - Win32 Release"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release"
-# ADD CPP /I "..\ext\mysql\libmysql" /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dll - Win32 Release_inline"
-
-# ADD CPP /I "..\ext\mysql\libmysql" /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\zero.c
-
-!IF "$(CFG)" == "php4dll - Win32 Debug"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug"
-# ADD CPP /I "..\ext\mysql\libmysql" /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dll - Win32 Release"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release"
-# ADD CPP /I "..\ext\mysql\libmysql" /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dll - Win32 Release_inline"
-
-# ADD CPP /I "..\ext\mysql\libmysql" /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# End Group
-# Begin Group "Header Files No. 8"
-
-# PROP Default_Filter ".h"
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\bcmath.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\config.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\private.h
-# End Source File
-# End Group
-# End Group
-# End Group
-# Begin Group "Win32"
-
-# PROP Default_Filter ""
-# Begin Group "Source Files No. 2"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\ext\com\COM.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\com\conversion.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\win32\pwd.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\win32\readdir.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\win32\registry.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\win32\sendmail.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\win32\time.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\com\VARIANT.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\win32\wfile.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\snmp\winsnmp.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\win32\winutil.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\win32\wsyslog.c
-# End Source File
-# End Group
-# Begin Group "Header Files No. 2"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\ext\com\com.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\com\conversion.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\win32\grp.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\win32\param.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\com\php_COM.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\win32\php_registry.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\com\php_VARIANT.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\win32\pwd.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\win32\readdir.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\win32\sendmail.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\win32\syslog.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\win32\time.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\win32\unistd.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\win32\wfile.h
-# End Source File
-# End Group
-# End Group
-# Begin Group "Parsers"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\ext\standard\parsedate.y
-
-!IF "$(CFG)" == "php4dll - Win32 Debug"
-
-# Begin Custom Build
-InputPath=..\ext\standard\parsedate.y
-
-"..\ext\standard\parsedate.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- cd ..\ext\standard
- bison --output=parsedate.c -v -d parsedate.y
-
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "php4dll - Win32 Release"
-
-# Begin Custom Build
-InputPath=..\ext\standard\parsedate.y
-
-"..\ext\standard\parsedate.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- cd ..\ext\standard
- bison --output=parsedate.c -v -d parsedate.y
-
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "php4dll - Win32 Release_inline"
-
-# Begin Custom Build
-InputPath=..\ext\standard\parsedate.y
-
-"..\ext\standard\parsedate.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- cd ..\ext\standard
- bison --output=parsedate.c -v -d parsedate.y
-
-# End Custom Build
-
-!ENDIF
-
-# End Source File
-# End Group
-# Begin Group "Scanners"
-
-# PROP Default_Filter ""
-# End Group
-# Begin Group "Text Files"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\ChangeLog
-# End Source File
-# Begin Source File
-
-SOURCE=..\LICENSE
-# End Source File
-# End Group
-# End Target
-# End Project
diff --git a/win32/php4dllts.dsp b/win32/php4dllts.dsp
deleted file mode 100644
index 32b01d341f..0000000000
--- a/win32/php4dllts.dsp
+++ /dev/null
@@ -1,2005 +0,0 @@
-# Microsoft Developer Studio Project File - Name="php4dllts" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=php4dllts - Win32 Debug_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "php4dllts.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "php4dllts.mak" CFG="php4dllts - Win32 Debug_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "php4dllts - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "php4dllts - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "php4dllts - Win32 Release_TS_inline" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "php4dllts - Win32 Release_TSDbg" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "php4dllts - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "..\Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PHP4DLLTS_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I ".." /I "..\main" /I "..\regex" /I "..\..\bindlib_w32" /I "..\Zend" /I "..\TSRM" /I "..\ext\mysql\libmysql" /I "..\ext\xml\expat" /D "_DEBUG" /D ZEND_DEBUG=1 /D "_WINDOWS" /D "_USRDLL" /D "PHP4DLLTS_EXPORTS" /D "PHP_EXPORTS" /D "LIBZEND_EXPORTS" /D "TSRM_EXPORTS" /D "SAPI_EXPORTS" /D "MSVC5" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WIN32" /D "_MBCS" /FR /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "_DEBUG"
-# ADD RSC /l 0x40d /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib wsock32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ZendTS.lib TSRM.lib resolv.lib libmysql.lib /nologo /version:4.0 /dll /debug /machine:I386 /nodefaultlib:"libcmt" /nodefaultlib:"libc" /out:"..\Debug_TS\php4ts_debug.dll" /pdbtype:sept /libpath:"..\TSRM\Debug_TS" /libpath:"..\Zend\Debug_TS" /libpath:"..\..\bindlib_w32\Debug" /libpath:"..\ext\mysql\libmysql\Debug_TS" /libpath:"Debug_TS"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "..\Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PHP4DLLTS_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I ".." /I "..\main" /I "..\regex" /I "..\..\bindlib_w32" /I "..\Zend" /I "..\TSRM" /I "..\ext\mysql\libmysql" /I "..\ext\xml\expat" /D "NDEBUG" /D ZEND_DEBUG=0 /D "_WINDOWS" /D "_USRDLL" /D "PHP4DLLTS_EXPORTS" /D "PHP_EXPORTS" /D "LIBZEND_EXPORTS" /D "TSRM_EXPORTS" /D "SAPI_EXPORTS" /D "MSVC5" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WIN32" /D "_MBCS" /FR /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "NDEBUG"
-# ADD RSC /l 0x40d /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib wsock32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ZendTS.lib TSRM.lib resolv.lib libmysql.lib /nologo /version:4.0 /dll /machine:I386 /nodefaultlib:"libc.lib" /nodefaultlib:"libcmt.lib" /out:"..\Release_TS\php4ts.dll" /libpath:"..\TSRM\Release_TS" /libpath:"..\Zend\Release_TS" /libpath:"..\..\bindlib_w32\Release" /libpath:"..\ext\mysql\libmysql\Release_TS" /libpath:"Release_TS"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TS_inline"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "php4dllts___Win32_Release_TS_inline"
-# PROP BASE Intermediate_Dir "php4dllts___Win32_Release_TS_inline"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "..\Release_TS_inline"
-# PROP Intermediate_Dir "Release_TS_inline"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "." /I "regex" /I "..\bindlib_w32" /I "Zend" /I "tsrm" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "PHP4DLLTS_EXPORTS" /D "MSVC5" /D "PHP_EXPORTS" /D "LIBZEND_EXPORTS" /D "TSRM_EXPORTS" /D "SAPI_EXPORTS" /D "ZTS" /D "WIN32" /D "_MBCS" /D ZEND_DEBUG=0 /FR /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I ".." /I "..\main" /I "..\regex" /I "..\..\bindlib_w32" /I "..\Zend" /I "..\TSRM" /I "..\ext\mysql\libmysql" /I "..\ext\xml\expat" /D "NDEBUG" /D ZEND_DEBUG=0 /D "ZEND_WIN32_FORCE_INLINE" /D "_WINDOWS" /D "_USRDLL" /D "PHP4DLLTS_EXPORTS" /D "PHP_EXPORTS" /D "LIBZEND_EXPORTS" /D "TSRM_EXPORTS" /D "SAPI_EXPORTS" /D "MSVC5" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WIN32" /D "_MBCS" /FR /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "NDEBUG"
-# ADD RSC /l 0x40d /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib wsock32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ZendTS.lib TSRM.lib resolv.lib /nologo /dll /machine:I386 /nodefaultlib:"libc.lib" /nodefaultlib:"libcmt.lib" /out:"Release_TS/php4ts.dll" /libpath:"TSRM\Release_TS" /libpath:"Zend\Release_TS" /libpath:"..\bindlib_w32\Release"
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib wsock32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ZendTS.lib TSRM.lib resolv.lib libmysql.lib /nologo /version:4.0 /dll /machine:I386 /nodefaultlib:"libc.lib" /nodefaultlib:"libcmt.lib" /out:"..\Release_TS_inline\php4ts.dll" /libpath:"..\TSRM\Release_TS_inline" /libpath:"..\Zend\Release_TS_inline" /libpath:"..\..\bindlib_w32\Release" /libpath:"..\ext\mysql\libmysql\Release_TS_inline" /libpath:"Release_TS_Inline"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TSDbg"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "php4dllts___Win32_Release_TSDbg"
-# PROP BASE Intermediate_Dir "php4dllts___Win32_Release_TSDbg"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "..\Release_TSDbg"
-# PROP Intermediate_Dir "Release_TSDbg"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I ".." /I "..\main" /I "..\regex" /I "..\..\bindlib_w32" /I "..\Zend" /I "..\TSRM" /I "..\ext\mysql\libmysql" /D "NDEBUG" /D ZEND_DEBUG=0 /D "_WINDOWS" /D "_USRDLL" /D "PHP4DLLTS_EXPORTS" /D "PHP_EXPORTS" /D "LIBZEND_EXPORTS" /D "TSRM_EXPORTS" /D "SAPI_EXPORTS" /D "MSVC5" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WIN32" /D "_MBCS" /FR /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /Zi /Od /I ".." /I "..\main" /I "..\regex" /I "..\..\bindlib_w32" /I "..\Zend" /I "..\TSRM" /I "..\ext\mysql\libmysql" /I "..\ext\xml\expat" /D "NDEBUG" /D ZEND_DEBUG=0 /D "_WINDOWS" /D "_USRDLL" /D "PHP4DLLTS_EXPORTS" /D "PHP_EXPORTS" /D "LIBZEND_EXPORTS" /D "TSRM_EXPORTS" /D "SAPI_EXPORTS" /D "MSVC5" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WIN32" /D "_MBCS" /FR /YX /FD /D /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "NDEBUG"
-# ADD RSC /l 0x40d /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib wsock32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ZendTS.lib TSRM.lib resolv.lib libmysql.lib /nologo /version:4.0 /dll /machine:I386 /nodefaultlib:"libc.lib" /nodefaultlib:"libcmt.lib" /out:"..\Release_TS\php4ts.dll" /libpath:"..\TSRM\Release_TS" /libpath:"..\Zend\Release_TS" /libpath:"..\..\bindlib_w32\Release" /libpath:"..\ext\mysql\libmysql\Release_TS" /libpath:"Release_TS"
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib wsock32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ZendTS.lib TSRM.lib resolv.lib libmysql.lib /nologo /version:4.0 /dll /debug /machine:I386 /nodefaultlib:"libc.lib" /nodefaultlib:"libcmt.lib" /out:"..\Release_TSDbg\php4ts.dll" /libpath:"..\TSRM\Release_TSDbg" /libpath:"..\Zend\Release_TSDbg" /libpath:"..\..\bindlib_w32\Release" /libpath:"..\ext\mysql\libmysql\Release_TSDbg" /libpath:"Release_TSDbg"
-
-!ENDIF
-
-# Begin Target
-
-# Name "php4dllts - Win32 Debug_TS"
-# Name "php4dllts - Win32 Release_TS"
-# Name "php4dllts - Win32 Release_TS_inline"
-# Name "php4dllts - Win32 Release_TSDbg"
-# Begin Group "Core"
-
-# PROP Default_Filter ""
-# Begin Group "Source Files"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\ext\standard\cyr_convert.c
-# End Source File
-# Begin Source File
-
-SOURCE="..\main\fopen_wrappers.c"
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\internal_functions_win32.c
-# ADD CPP /I "..\ext\xml\expat\xmltok" /I "..\ext\xml\expat\xmlparse"
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\main.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\mergesort.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\network.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\php_content_types.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\php_ini.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\php_logos.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\php_open_temporary_file.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\php_ticks.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\php_variables.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\quot_print.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\reentrancy.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\rfc1867.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\safe_mode.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\SAPI.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\strlcat.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\strlcpy.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\main\config.w32.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\cyr_convert.h
-# End Source File
-# Begin Source File
-
-SOURCE="..\main\fopen_wrappers.h"
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\getopt.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\internal_functions_registry.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\logos.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\output.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\php.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\php3_compat.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\php_compat.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\php_content_types.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\php_globals.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\php_ini.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\php_logos.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\php_main.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\php_open_temporary_file.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\php_regex.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\php_variables.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\quot_print.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\rfc1867.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\safe_mode.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\SAPI.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\main\win95nt.h
-# End Source File
-# End Group
-# End Group
-# Begin Group "Function Modules"
-
-# PROP Default_Filter ""
-# Begin Group "Source Files No. 1"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\ext\standard\array.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\assert.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\base64.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\basic_functions.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\bcmath.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\browscap.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\crc32.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\credits.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\crypt.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\datetime.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\dir.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\dl.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\dns.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\exec.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\file.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\filestat.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\flock_compat.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\formatted_print.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\fsock.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\ftp_fopen_wrapper.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\head.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\html.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\http_fopen_wrapper.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\image.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\incomplete_class.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\info.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\iptc.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\lcg.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\levenshtein.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\link.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\mail.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\math.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\md5.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\metaphone.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\microtime.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\session\mod_files.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\session\mod_user.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\output.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\pack.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\pageinfo.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\parsedate.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\php_fopen_wrapper.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\mcal\php_mcal.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\mysql\php_mysql.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\odbc\php_odbc.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\pcre\php_pcre.c
-# ADD CPP /D "STATIC"
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\rand.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\reg.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\scanf.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\session\session.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\soundex.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\string.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\strnatcmp.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\syslog.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\type.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\uniqid.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\url.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\url_scanner.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\url_scanner_ex.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\var.c
-# End Source File
-# End Group
-# Begin Group "Header Files No. 1"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\ext\standard\base64.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\basic_functions.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\datetime.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\dl.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\dns.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\exec.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\file.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\flock_compat.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\fsock.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\functions\global.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\head.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\html.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\info.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\md5.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\session\mod_user.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\number.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\pageinfo.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\php_array.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\php_bcmath.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\php_crypt.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\php_dir.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\php_filestat.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\php_fopen_wrappers.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\php_lcg.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\ldap\php_ldap.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\php_mail.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\mcal\php_mcal.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\mysql\php_mysql.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\odbc\php_odbc.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\php_output.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\pcre\php_pcre.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\session\php_session.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\php_string.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\php_syslog.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\functions\phpdir.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\functions\phpmath.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\reg.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\scanf.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\type.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\uniqid.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\url.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\url_scanner.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\standard\url_scanner_ex.h
-# End Source File
-# End Group
-# Begin Group "PCRE"
-
-# PROP Default_Filter ""
-# Begin Group "Source Files No. 3"
-
-# PROP Default_Filter ".c"
-# Begin Source File
-
-SOURCE=..\ext\pcre\pcrelib\chartables.c
-# ADD CPP /D "STATIC"
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\pcre\pcrelib\get.c
-# ADD CPP /D "STATIC"
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\pcre\pcrelib\maketables.c
-# ADD CPP /D "STATIC"
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\pcre\pcrelib\pcre.c
-# ADD CPP /D "STATIC"
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\pcre\pcrelib\study.c
-# ADD CPP /D "STATIC"
-# End Source File
-# End Group
-# Begin Group "Header Files No. 3"
-
-# PROP Default_Filter ".h"
-# Begin Source File
-
-SOURCE=..\ext\pcre\pcrelib\internal.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\pcre\pcrelib\pcre.h
-# End Source File
-# End Group
-# End Group
-# Begin Group "Regular Expressions"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\regex\regcomp.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\regex\regerror.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\regex\regexec.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\regex\regfree.c
-# End Source File
-# End Group
-# Begin Group "XML"
-
-# PROP Default_Filter ""
-# Begin Group "Source Files No. 4"
-
-# PROP Default_Filter ".c"
-# Begin Source File
-
-SOURCE=..\ext\wddx\wddx.c
-
-!IF "$(CFG)" == "php4dllts - Win32 Debug_TS"
-
-# ADD CPP /I "..\ext\xml\expat\xmlparse" /I "..\ext\xml\expat\xmltok"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TS"
-
-# ADD CPP /I "ext\xml\expat\xmlparse" /I "..\ext\xml\expat\xmltok" /I "..\ext\xml\expat\xmlparse"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TS_inline"
-
-# ADD CPP /I "ext\xml\expat\xmlparse" /I "..\ext\xml\expat\xmltok" /I "..\ext\xml\expat\xmlparse"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TSDbg"
-
-# ADD BASE CPP /I "ext\xml\expat\xmlparse" /I "..\ext\xml\expat\xmltok" /I "..\ext\xml\expat\xmlparse"
-# ADD CPP /I "ext\xml\expat\xmlparse" /I "..\ext\xml\expat\xmltok" /I "..\ext\xml\expat\xmlparse"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\xml\xml.c
-
-!IF "$(CFG)" == "php4dllts - Win32 Debug_TS"
-
-# ADD CPP /I "..\ext\xml\expat\xmlparse" /I "..\ext\xml\expat\xmltok"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TS"
-
-# ADD CPP /I "ext\xml\expat\xmlparse" /I "..\ext\xml\expat\xmltok" /I "..\ext\xml\expat\xmlparse"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TS_inline"
-
-# ADD CPP /I "ext\xml\expat\xmlparse" /I "..\ext\xml\expat\xmltok" /I "..\ext\xml\expat\xmlparse"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TSDbg"
-
-# ADD BASE CPP /I "ext\xml\expat\xmlparse" /I "..\ext\xml\expat\xmltok" /I "..\ext\xml\expat\xmlparse"
-# ADD CPP /I "ext\xml\expat\xmlparse" /I "..\ext\xml\expat\xmltok" /I "..\ext\xml\expat\xmlparse"
-
-!ENDIF
-
-# End Source File
-# End Group
-# Begin Group "Header Files No. 4"
-
-# PROP Default_Filter ".h"
-# Begin Source File
-
-SOURCE=..\ext\wddx\php_wddx.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\wddx\php_wddx_api.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\xml\php_xml.h
-# End Source File
-# End Group
-# End Group
-# Begin Group "FTP"
-
-# PROP Default_Filter ""
-# Begin Group "Source Files No. 6"
-
-# PROP Default_Filter ".c"
-# Begin Source File
-
-SOURCE=..\ext\ftp\ftp.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\ftp\php_ftp.c
-# End Source File
-# End Group
-# Begin Group "Header Files No. 6"
-
-# PROP Default_Filter ".h"
-# Begin Source File
-
-SOURCE=..\ext\ftp\ftp.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\ftp\php_ftp.h
-# End Source File
-# End Group
-# End Group
-# Begin Group "Calendar"
-
-# PROP Default_Filter ""
-# Begin Group "Source Files No. 7"
-
-# PROP Default_Filter ".c"
-# Begin Source File
-
-SOURCE=..\ext\calendar\cal_unix.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\calendar\calendar.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\calendar\dow.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\calendar\easter.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\calendar\french.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\calendar\gregor.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\calendar\jewish.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\calendar\julian.c
-# End Source File
-# End Group
-# Begin Group "Header Files No. 7"
-
-# PROP Default_Filter ".h"
-# Begin Source File
-
-SOURCE=..\ext\calendar\php_calendar.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\calendar\sdncal.h
-# End Source File
-# End Group
-# End Group
-# Begin Group "bcmath"
-
-# PROP Default_Filter ""
-# Begin Group "Source Files No. 8"
-
-# PROP Default_Filter ".c"
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\add.c
-
-!IF "$(CFG)" == "php4dllts - Win32 Debug_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TS_inline"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS_inline"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TSDbg"
-
-# PROP BASE Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD BASE CPP /I "..\ext\bcmath\libbcmath\src"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\compare.c
-
-!IF "$(CFG)" == "php4dllts - Win32 Debug_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TS_inline"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS_inline"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TSDbg"
-
-# PROP BASE Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD BASE CPP /I "..\ext\bcmath\libbcmath\src"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\debug.c
-
-!IF "$(CFG)" == "php4dllts - Win32 Debug_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TS_inline"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS_inline"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TSDbg"
-
-# PROP BASE Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD BASE CPP /I "..\ext\bcmath\libbcmath\src"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\div.c
-
-!IF "$(CFG)" == "php4dllts - Win32 Debug_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TS_inline"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS_inline"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TSDbg"
-
-# PROP BASE Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD BASE CPP /I "..\ext\bcmath\libbcmath\src"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\divmod.c
-
-!IF "$(CFG)" == "php4dllts - Win32 Debug_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TS_inline"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS_inline"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TSDbg"
-
-# PROP BASE Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD BASE CPP /I "..\ext\bcmath\libbcmath\src"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\doaddsub.c
-
-!IF "$(CFG)" == "php4dllts - Win32 Debug_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TS_inline"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS_inline"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TSDbg"
-
-# PROP BASE Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD BASE CPP /I "..\ext\bcmath\libbcmath\src"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\init.c
-
-!IF "$(CFG)" == "php4dllts - Win32 Debug_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TS_inline"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS_inline"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TSDbg"
-
-# PROP BASE Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD BASE CPP /I "..\ext\bcmath\libbcmath\src"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\int2num.c
-
-!IF "$(CFG)" == "php4dllts - Win32 Debug_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TS_inline"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS_inline"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TSDbg"
-
-# PROP BASE Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD BASE CPP /I "..\ext\bcmath\libbcmath\src"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\nearzero.c
-
-!IF "$(CFG)" == "php4dllts - Win32 Debug_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TS_inline"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS_inline"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TSDbg"
-
-# PROP BASE Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD BASE CPP /I "..\ext\bcmath\libbcmath\src"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\neg.c
-
-!IF "$(CFG)" == "php4dllts - Win32 Debug_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TS_inline"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS_inline"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TSDbg"
-
-# PROP BASE Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD BASE CPP /I "..\ext\bcmath\libbcmath\src"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\num2long.c
-
-!IF "$(CFG)" == "php4dllts - Win32 Debug_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TS_inline"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS_inline"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TSDbg"
-
-# PROP BASE Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD BASE CPP /I "..\ext\bcmath\libbcmath\src"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\num2str.c
-
-!IF "$(CFG)" == "php4dllts - Win32 Debug_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TS_inline"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS_inline"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TSDbg"
-
-# PROP BASE Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD BASE CPP /I "..\ext\bcmath\libbcmath\src"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\outofmem.c
-
-!IF "$(CFG)" == "php4dllts - Win32 Debug_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TS_inline"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS_inline"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TSDbg"
-
-# PROP BASE Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD BASE CPP /I "..\ext\bcmath\libbcmath\src"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\output.c
-
-!IF "$(CFG)" == "php4dllts - Win32 Debug_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TS_inline"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS_inline"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TSDbg"
-
-# PROP BASE Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD BASE CPP /I "..\ext\bcmath\libbcmath\src"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\raise.c
-
-!IF "$(CFG)" == "php4dllts - Win32 Debug_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TS_inline"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS_inline"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TSDbg"
-
-# PROP BASE Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD BASE CPP /I "..\ext\bcmath\libbcmath\src"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\raisemod.c
-
-!IF "$(CFG)" == "php4dllts - Win32 Debug_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TS_inline"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS_inline"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TSDbg"
-
-# PROP BASE Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD BASE CPP /I "..\ext\bcmath\libbcmath\src"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\recmul.c
-
-!IF "$(CFG)" == "php4dllts - Win32 Debug_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TS_inline"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS_inline"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TSDbg"
-
-# PROP BASE Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD BASE CPP /I "..\ext\bcmath\libbcmath\src"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\rmzero.c
-
-!IF "$(CFG)" == "php4dllts - Win32 Debug_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TS_inline"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS_inline"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TSDbg"
-
-# PROP BASE Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD BASE CPP /I "..\ext\bcmath\libbcmath\src"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\rt.c
-
-!IF "$(CFG)" == "php4dllts - Win32 Debug_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TS_inline"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS_inline"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TSDbg"
-
-# PROP BASE Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD BASE CPP /I "..\ext\bcmath\libbcmath\src"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\sqrt.c
-
-!IF "$(CFG)" == "php4dllts - Win32 Debug_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TS_inline"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS_inline"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TSDbg"
-
-# PROP BASE Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD BASE CPP /I "..\ext\bcmath\libbcmath\src"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\str2num.c
-
-!IF "$(CFG)" == "php4dllts - Win32 Debug_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TS_inline"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS_inline"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TSDbg"
-
-# PROP BASE Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD BASE CPP /I "..\ext\bcmath\libbcmath\src"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\sub.c
-
-!IF "$(CFG)" == "php4dllts - Win32 Debug_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TS_inline"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS_inline"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TSDbg"
-
-# PROP BASE Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD BASE CPP /I "..\ext\bcmath\libbcmath\src"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\zero.c
-
-!IF "$(CFG)" == "php4dllts - Win32 Debug_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TS_inline"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS_inline"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TSDbg"
-
-# PROP BASE Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# ADD BASE CPP /I "..\ext\bcmath\libbcmath\src"
-# ADD CPP /I "..\ext\bcmath\libbcmath\src"
-
-!ENDIF
-
-# End Source File
-# End Group
-# Begin Group "Header Files No. 8"
-
-# PROP Default_Filter ".h"
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\bcmath.h
-
-!IF "$(CFG)" == "php4dllts - Win32 Debug_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug_TS"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TS_inline"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS_inline"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TSDbg"
-
-# PROP BASE Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\config.h
-
-!IF "$(CFG)" == "php4dllts - Win32 Debug_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug_TS"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TS_inline"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS_inline"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TSDbg"
-
-# PROP BASE Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\bcmath\libbcmath\src\private.h
-
-!IF "$(CFG)" == "php4dllts - Win32 Debug_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Debug_TS"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TS"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TS_inline"
-
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS_inline"
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TSDbg"
-
-# PROP BASE Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-# PROP Intermediate_Dir "ext\bcmath\libbcmath\Release_TS"
-
-!ENDIF
-
-# End Source File
-# End Group
-# End Group
-# End Group
-# Begin Group "Win32"
-
-# PROP Default_Filter ""
-# Begin Group "Source Files No. 2"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\ext\com\COM.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\com\conversion.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\win32\pwd.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\win32\readdir.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\win32\registry.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\win32\sendmail.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\win32\time.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\com\VARIANT.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\win32\wfile.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\snmp\winsnmp.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\win32\winutil.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\win32\wsyslog.c
-# End Source File
-# End Group
-# Begin Group "Header Files No. 2"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\ext\com\com.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\com\conversion.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\win32\grp.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\win32\param.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\com\php_COM.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\win32\php_registry.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\com\php_VARIANT.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\win32\pwd.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\win32\readdir.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\win32\sendmail.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\win32\syslog.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\win32\time.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\win32\unistd.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\win32\wfile.h
-# End Source File
-# End Group
-# End Group
-# Begin Group "Parsers"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\ext\standard\parsedate.y
-
-!IF "$(CFG)" == "php4dllts - Win32 Debug_TS"
-
-# Begin Custom Build
-InputPath=..\ext\standard\parsedate.y
-
-"..\ext\standard\parsedate.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- cd ..\ext\standard
- bison --output=parsedate.c -v -d parsedate.y
-
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TS"
-
-# Begin Custom Build
-InputPath=..\ext\standard\parsedate.y
-
-"..\ext\standard\parsedate.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- cd ..\ext\standard
- bison --output=parsedate.c -v -d parsedate.y
-
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TS_inline"
-
-# Begin Custom Build
-InputPath=..\ext\standard\parsedate.y
-
-"..\ext\standard\parsedate.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- cd ..\ext\standard
- bison --output=parsedate.c -v -d parsedate.y
-
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TSDbg"
-
-# Begin Custom Build
-InputPath=..\ext\standard\parsedate.y
-
-"..\ext\standard\parsedate.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- cd ..\ext\standard
- bison --output=parsedate.c -v -d parsedate.y
-
-# End Custom Build
-
-!ENDIF
-
-# End Source File
-# End Group
-# Begin Group "Scanners"
-
-# PROP Default_Filter ""
-# End Group
-# Begin Group "Text Files"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\ChangeLog
-# End Source File
-# Begin Source File
-
-SOURCE=..\LICENSE
-# End Source File
-# Begin Source File
-
-SOURCE=..\NEWS
-# End Source File
-# Begin Source File
-
-SOURCE="..\php.ini-dist"
-# End Source File
-# Begin Source File
-
-SOURCE="..\php.ini-optimized"
-# End Source File
-# Begin Source File
-
-SOURCE="..\README.CVS-RULES"
-# End Source File
-# Begin Source File
-
-SOURCE=..\TODO
-# End Source File
-# End Group
-# Begin Group "Support"
-
-# PROP Default_Filter ""
-# Begin Group "Expat"
-
-# PROP Default_Filter ""
-# Begin Group "Source Files No. 5"
-
-# PROP Default_Filter ".c"
-# Begin Source File
-
-SOURCE=..\ext\xml\expat\xmlparse.c
-# ADD CPP /D "COMPILED_FROM_DSP"
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\xml\expat\xmlrole.c
-# ADD CPP /D "COMPILED_FROM_DSP"
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\xml\expat\xmltok.c
-# ADD CPP /D "COMPILED_FROM_DSP"
-# End Source File
-# End Group
-# Begin Group "Header Files No. 5"
-
-# PROP Default_Filter ".h"
-# Begin Source File
-
-SOURCE=..\ext\xml\expat\ascii.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\xml\expat\asciitab.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\xml\expat\expat.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\xml\expat\iasciitab.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\xml\expat\latin1tab.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\xml\expat\nametab.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\xml\expat\utf8tab.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\xml\expat\winconfig.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\xml\expat\xmlrole.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\xml\expat\xmltok.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\ext\xml\expat\xmltok_impl.h
-# End Source File
-# End Group
-# End Group
-# End Group
-# End Target
-# End Project
diff --git a/win32/php4ts.dsp b/win32/php4ts.dsp
deleted file mode 100644
index c08426b8da..0000000000
--- a/win32/php4ts.dsp
+++ /dev/null
@@ -1,167 +0,0 @@
-# Microsoft Developer Studio Project File - Name="php4ts" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=php4ts - Win32 Debug_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "php4ts.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "php4ts.mak" CFG="php4ts - Win32 Debug_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "php4ts - Win32 Release_TS" (based on "Win32 (x86) Console Application")
-!MESSAGE "php4ts - Win32 Debug_TS" (based on "Win32 (x86) Console Application")
-!MESSAGE "php4ts - Win32 Release_TS_inline" (based on "Win32 (x86) Console Application")
-!MESSAGE "php4ts - Win32 Release_TSDbg" (based on "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "php4ts - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "..\Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I ".." /I "..\main" /I "..\regex" /I "..\..\bindlib_w32" /I "..\Zend" /I "..\TSRM" /D "NDEBUG" /D ZEND_DEBUG=0 /D "_CONSOLE" /D "MSVC5" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WIN32" /D "_MBCS" /Fr /FD /c
-# SUBTRACT CPP /YX /Yc /Yu
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 php4ts.lib winmm.lib wsock32.lib netapi32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /version:4.0 /subsystem:console /machine:I386 /nodefaultlib:"libc.lib" /out:"..\Release_TS\php.exe" /libpath:"..\Release_TS"
-
-!ELSEIF "$(CFG)" == "php4ts - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "..\Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I ".." /I "..\main" /I "..\regex" /I "..\..\bindlib_w32" /I "..\Zend" /I "..\TSRM" /D "DEBUG" /D "_DEBUG" /D ZEND_DEBUG=1 /D "_CONSOLE" /D "MSVC5" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WIN32" /D "_MBCS" /FR /FD /c
-# SUBTRACT CPP /YX
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /i "c:\include" /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 winmm.lib netapi32.lib wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts_debug.lib /nologo /version:4.0 /subsystem:console /debug /machine:I386 /nodefaultlib:"libcd" /nodefaultlib:"libcmt" /out:"..\Debug_TS\php.exe" /pdbtype:sept /libpath:"..\Debug_TS"
-# SUBTRACT LINK32 /pdb:none
-
-!ELSEIF "$(CFG)" == "php4ts - Win32 Release_TS_inline"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "php4ts___Win32_Release_TS_inline"
-# PROP BASE Intermediate_Dir "php4ts___Win32_Release_TS_inline"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "..\Release_TS_inline"
-# PROP Intermediate_Dir "Release_TS_inline"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "." /I "regex" /I "..\bindlib_w32" /I "Zend" /I "tsrm" /D "NDEBUG" /D "MSVC5" /D "_CONSOLE" /D "ZTS" /D "WIN32" /D "_MBCS" /D ZEND_DEBUG=0 /Fr /FD /c
-# SUBTRACT BASE CPP /YX /Yc /Yu
-# ADD CPP /nologo /MD /W3 /GX /O2 /I ".." /I "..\main" /I "..\regex" /I "..\..\bindlib_w32" /I "..\Zend" /I "..\TSRM" /D "NDEBUG" /D ZEND_DEBUG=0 /D "ZEND_WIN32_FORCE_INLINE" /D "_CONSOLE" /D "MSVC5" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WIN32" /D "_MBCS" /Fr /FD /c
-# SUBTRACT CPP /YX /Yc /Yu
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 php4ts.lib winmm.lib wsock32.lib netapi32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /version:3.0 /subsystem:console /machine:I386 /nodefaultlib:"libc.lib" /out:"Release_TS\php.exe" /libpath:"Release_TS"
-# ADD LINK32 php4ts.lib winmm.lib wsock32.lib netapi32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /version:4.0 /subsystem:console /machine:I386 /nodefaultlib:"libc.lib" /out:"..\Release_TS_inline\php.exe" /libpath:"..\Release_TS_inline"
-
-!ELSEIF "$(CFG)" == "php4ts - Win32 Release_TSDbg"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "php4ts___Win32_Release_TSDbg"
-# PROP BASE Intermediate_Dir "php4ts___Win32_Release_TSDbg"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "..\Release_TSDbg"
-# PROP Intermediate_Dir "Release_TSDbg"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I ".." /I "..\main" /I "..\regex" /I "..\..\bindlib_w32" /I "..\Zend" /I "..\TSRM" /D "NDEBUG" /D ZEND_DEBUG=0 /D "_CONSOLE" /D "MSVC5" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WIN32" /D "_MBCS" /Fr /FD /c
-# SUBTRACT BASE CPP /YX /Yc /Yu
-# ADD CPP /nologo /MD /W3 /GX /Zi /Od /I ".." /I "..\main" /I "..\regex" /I "..\..\bindlib_w32" /I "..\Zend" /I "..\TSRM" /D "NDEBUG" /D ZEND_DEBUG=0 /D "_CONSOLE" /D "MSVC5" /D "ZTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D "WIN32" /D "_MBCS" /Fr /FD /c
-# SUBTRACT CPP /YX /Yc /Yu
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 php4ts.lib winmm.lib wsock32.lib netapi32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /version:4.0 /subsystem:console /machine:I386 /nodefaultlib:"libc.lib" /out:"..\Release_TS\php.exe" /libpath:"..\Release_TS"
-# ADD LINK32 php4ts.lib winmm.lib wsock32.lib netapi32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /version:4.0 /subsystem:console /debug /machine:I386 /nodefaultlib:"libc.lib" /out:"..\Release_TSDbg\php.exe" /libpath:"..\Release_TSDbg"
-
-!ENDIF
-
-# Begin Target
-
-# Name "php4ts - Win32 Release_TS"
-# Name "php4ts - Win32 Debug_TS"
-# Name "php4ts - Win32 Release_TS_inline"
-# Name "php4ts - Win32 Release_TSDbg"
-# Begin Group "Source Files"
-
-# PROP Default_Filter ".c"
-# Begin Source File
-
-SOURCE=..\sapi\cgi\cgi_main.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\sapi\cgi\getopt.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter ".h"
-# Begin Source File
-
-SOURCE=..\sapi\cgi\php_getopt.h
-# End Source File
-# End Group
-# End Target
-# End Project
diff --git a/win32/php4ts.dsw b/win32/php4ts.dsw
deleted file mode 100644
index fb9346c2e4..0000000000
--- a/win32/php4ts.dsw
+++ /dev/null
@@ -1,194 +0,0 @@
-Microsoft Developer Studio Workspace File, Format Version 6.00
-# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
-
-###############################################################################
-
-Project: "TSRM"="..\TSRM\TSRM.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "ZendTS"="..\Zend\ZendTS.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name TSRM
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "libmysql"="..\ext\mysql\libmysql\libmysql.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "php4aolserver"="..\sapi\aolserver\php4aolserver.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name php4dllts
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "php4apache"="..\sapi\apache\php4apache.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name php4dllts
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "php4dllts"=".\php4dllts.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name ZendTS
- End Project Dependency
- Begin Project Dependency
- Project_Dep_Name libmysql
- End Project Dependency
- Begin Project Dependency
- Project_Dep_Name TSRM
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "php4isapi"="..\sapi\isapi\php4isapi.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name php4dllts
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "php4nsapi"="..\sapi\nsapi\php4nsapi.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name php4dllts
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "php4pi3web"="..\sapi\pi3web\php4pi3web.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name php4dllts
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "php4ts"=".\php4ts.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name php4dllts
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "servlet"="..\sapi\servlet\servlet.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "testsuite"=".\testsuite.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name php4ts
- End Project Dependency
-}}}
-
-###############################################################################
-
-Global:
-
-Package=<5>
-{{{
-}}}
-
-Package=<3>
-{{{
-}}}
-
-###############################################################################
-
diff --git a/win32/php5ts.dsw b/win32/php5ts.dsw
deleted file mode 100644
index fb9346c2e4..0000000000
--- a/win32/php5ts.dsw
+++ /dev/null
@@ -1,194 +0,0 @@
-Microsoft Developer Studio Workspace File, Format Version 6.00
-# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
-
-###############################################################################
-
-Project: "TSRM"="..\TSRM\TSRM.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "ZendTS"="..\Zend\ZendTS.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name TSRM
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "libmysql"="..\ext\mysql\libmysql\libmysql.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "php4aolserver"="..\sapi\aolserver\php4aolserver.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name php4dllts
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "php4apache"="..\sapi\apache\php4apache.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name php4dllts
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "php4dllts"=".\php4dllts.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name ZendTS
- End Project Dependency
- Begin Project Dependency
- Project_Dep_Name libmysql
- End Project Dependency
- Begin Project Dependency
- Project_Dep_Name TSRM
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "php4isapi"="..\sapi\isapi\php4isapi.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name php4dllts
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "php4nsapi"="..\sapi\nsapi\php4nsapi.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name php4dllts
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "php4pi3web"="..\sapi\pi3web\php4pi3web.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name php4dllts
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "php4ts"=".\php4ts.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name php4dllts
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "servlet"="..\sapi\servlet\servlet.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "testsuite"=".\testsuite.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name php4ts
- End Project Dependency
-}}}
-
-###############################################################################
-
-Global:
-
-Package=<5>
-{{{
-}}}
-
-Package=<3>
-{{{
-}}}
-
-###############################################################################
-
diff --git a/win32/php_modules.dsw b/win32/php_modules.dsw
deleted file mode 100644
index cdf73c51d3..0000000000
--- a/win32/php_modules.dsw
+++ /dev/null
@@ -1,569 +0,0 @@
-Microsoft Developer Studio Workspace File, Format Version 6.00
-# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
-
-###############################################################################
-
-Project: "bz2"=..\ext\bz2\bz2.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "cpdf"=..\ext\cpdf\cpdf.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "ctype"=..\ext\ctype\ctype.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "curl"=..\ext\curl\curl.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "cybercash"=..\ext\cybercash\cybercash.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "db"=..\ext\db\db.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "dba"=..\ext\dba\dba.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "dbase"=..\ext\dbase\dbase.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "dbx"=..\ext\dbx\dbx.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "domxml"=..\ext\domxml\domxml.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "dotnet"=..\ext\dotnet\dotnet.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "exif"=..\ext\exif\exif.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "fbsql"=..\ext\fbsql\fbsql.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "fdf"=..\ext\fdf\fdf.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "filepro"=..\ext\filepro\filepro.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "gd"=..\ext\gd\gd.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "gettext"=..\ext\gettext\gettext.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "hyperwave"=..\ext\hyperwave\hyperwave.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "iconv"=..\ext\iconv\iconv.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "ifx"=..\ext\informix\ifx.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "iisfunc"=..\ext\iisfunc\iisfunc.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "imap"=..\ext\imap\imap.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "ingres"=..\ext\ingres_ii\ingres.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "interbase"=..\ext\interbase\interbase.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "java"=..\ext\java\java.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "ldap"=..\ext\ldap\ldap.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "mbstring"=..\ext\mbstring\mbstring.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "mcrypt"=..\ext\mcrypt\mcrypt.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "mhash"=..\ext\mhash\mhash.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "ming"=..\ext\ming\ming.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "msql"=..\ext\msql\msql.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "mssql"=..\ext\mssql\mssql.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "notes"=..\ext\notes\notes.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "oci8"=..\ext\oci8\oci8.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "openssl"=..\ext\openssl\openssl.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "oracle"=..\ext\oracle\oracle.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "pdf"=..\ext\pdf\pdf.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "pgsql"=..\ext\pgsql\pgsql.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "printer"=..\ext\printer\printer.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "sablot"=..\ext\sablot\sablot.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "snmp"=..\ext\snmp\snmp.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "sockets"=..\ext\sockets\sockets.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "sybase_ct"=..\ext\sybase_ct\sybase_ct.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "xslt"=..\ext\xslt\xslt.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "yaz"=..\ext\yaz\yaz.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "zlib"=..\ext\zlib\zlib.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Global:
-
-Package=<5>
-{{{
-}}}
-
-Package=<3>
-{{{
-}}}
-
-###############################################################################
-
diff --git a/win32/php_registry.h b/win32/php_registry.h
deleted file mode 100644
index 275d89edd2..0000000000
--- a/win32/php_registry.h
+++ /dev/null
@@ -1,7 +0,0 @@
-#ifndef PHP_REGISTRY_H
-#define PHP_REGISTRY_H
-
-
-void UpdateIniFromRegistry(char *path);
-
-#endif /* PHP_REGISTRY_H */
diff --git a/win32/pwd.c b/win32/pwd.c
deleted file mode 100644
index 73c4b62c95..0000000000
--- a/win32/pwd.c
+++ /dev/null
@@ -1,74 +0,0 @@
-/* pwd.c - Try to approximate UN*X's getuser...() functions under MS-DOS.
- Copyright (C) 1990 by Thorsten Ohl, td12@ddagsi3.bitnet
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 1, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
- $Header$
- */
-
-/* This 'implementation' is conjectured from the use of this functions in
- the RCS and BASH distributions. Of course these functions don't do too
- much useful things under MS-DOS, but using them avoids many "#ifdef
- MSDOS" in ported UN*X code ... */
-
-#include "php.h" /*php specific */
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-#include <lmaccess.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <lmapibuf.h>
-#include "pwd.h"
-#include "grp.h"
-
-#ifndef THREAD_SAFE
-static struct passwd pw; /* should we return a malloc()'d structure */
-#endif
-static char *home_dir = "."; /* we feel (no|every)where at home */
-static char *login_shell = "not command.com!";
-
-struct passwd *getpwnam(char *name)
-{
- return (struct passwd *) 0;
-}
-
-
-char *getlogin()
-{
- static char name[256];
- DWORD dw = 256;
- GetUserName(name, &dw);
- return name;
-}
-
-struct passwd *
- getpwuid(int uid)
-{
- pw.pw_name = getlogin();
- pw.pw_dir = home_dir;
- pw.pw_shell = login_shell;
- pw.pw_uid = 0;
-
- return &pw;
-}
-
-/*
- * Local Variables:
- * mode:C
- * ChangeLog:ChangeLog
- * compile-command:make
- * End:
- */
diff --git a/win32/pwd.h b/win32/pwd.h
deleted file mode 100644
index d1f66859d7..0000000000
--- a/win32/pwd.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/* pwd.h - Try to approximate UN*X's getuser...() functions under MS-DOS.
- Copyright (C) 1990 by Thorsten Ohl, td12@ddagsi3.bitnet
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 1, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
- $Header$
- */
-
-/* This 'implementation' is conjectured from the use of this functions in
- the RCS and BASH distributions. Of course these functions don't do too
- much useful things under MS-DOS, but using them avoids many "#ifdef
- MSDOS" in ported UN*X code ... */
-/*
- #define WIN32_LEAN_AND_MEAN
- #include <windows.h>
- */
-#ifndef PWD_H
-#define PWD_H
-#if 0
-/* This is taken care of in Windows-NT/config.h. */
-typedef int uid_t;
-#endif
-
-struct passwd {
- char *pw_name; /* user name */
- char *pw_passwd; /* encrypted password */
- int pw_uid; /* user uid */
- int pw_gid; /* user gid */
- char *pw_comment; /* comment */
- char *pw_gecos; /* Honeywell login info */
- char *pw_dir; /* home directory */
- char *pw_shell; /* default shell */
-};
-
-extern struct passwd *getpwuid(int);
-extern struct passwd *getpwnam(char *name);
-extern char *getlogin(void);
-#endif
-/*
- * Local Variables:
- * mode:C
- * ChangeLog:ChangeLog
- * compile-command:make
- * End:
- */
diff --git a/win32/pws-php4cgi.reg b/win32/pws-php4cgi.reg
deleted file mode 100644
index 46edc77386..0000000000
--- a/win32/pws-php4cgi.reg
+++ /dev/null
@@ -1,6 +0,0 @@
-REGEDIT4
-
-[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\w3svc\parameters\Script Map]
-".php"="[PUT PATH HERE]\\php.exe"
-
-
diff --git a/win32/pws-php4isapi.reg b/win32/pws-php4isapi.reg
deleted file mode 100644
index 47804a946a..0000000000
--- a/win32/pws-php4isapi.reg
+++ /dev/null
@@ -1,5 +0,0 @@
-REGEDIT4
-
-[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\w3svc\parameters\Script Map]
-".php"="[PUT PATH HERE]\\php4isapi.dll"
-
diff --git a/win32/readdir.c b/win32/readdir.c
deleted file mode 100644
index 8c17ce2b22..0000000000
--- a/win32/readdir.c
+++ /dev/null
@@ -1,140 +0,0 @@
-#include <malloc.h>
-#include <string.h>
-#include <errno.h>
-
-#include "readdir.h"
-#include "php.h"
-
-/**********************************************************************
- * Implement dirent-style opendir/readdir/rewinddir/closedir on Win32
- *
- * Functions defined are opendir(), readdir(), rewinddir() and
- * closedir() with the same prototypes as the normal dirent.h
- * implementation.
- *
- * Does not implement telldir(), seekdir(), or scandir(). The dirent
- * struct is compatible with Unix, except that d_ino is always 1 and
- * d_off is made up as we go along.
- *
- * The DIR typedef is not compatible with Unix.
- **********************************************************************/
-
-DIR *opendir(const char *dir)
-{
- DIR *dp;
- char *filespec;
- long handle;
- int index;
-
- filespec = malloc(strlen(dir) + 2 + 1);
- strcpy(filespec, dir);
- index = strlen(filespec) - 1;
- if (index >= 0 && (filespec[index] == '/' || filespec[index] == '\\'))
- filespec[index] = '\0';
- strcat(filespec, "/*");
-
- dp = (DIR *) malloc(sizeof(DIR));
- dp->offset = 0;
- dp->finished = 0;
- dp->dir = strdup(dir);
-
- if ((handle = _findfirst(filespec, &(dp->fileinfo))) < 0) {
- if (errno == ENOENT)
- dp->finished = 1;
- else
- return NULL;
- }
- dp->handle = handle;
- free(filespec);
-
- return dp;
-}
-
-struct dirent *readdir(DIR *dp)
-{
- if (!dp || dp->finished)
- return NULL;
-
- if (dp->offset != 0) {
- if (_findnext(dp->handle, &(dp->fileinfo)) < 0) {
- dp->finished = 1;
- return NULL;
- }
- }
- dp->offset++;
-
- strlcpy(dp->dent.d_name, dp->fileinfo.name, _MAX_FNAME+1);
- dp->dent.d_ino = 1;
- dp->dent.d_reclen = strlen(dp->dent.d_name);
- dp->dent.d_off = dp->offset;
-
- return &(dp->dent);
-}
-
-int readdir_r(DIR *dp, struct dirent *entry, struct dirent **result)
-{
- if (!dp || dp->finished) {
- *result = NULL;
- return 0;
- }
-
- if (dp->offset != 0) {
- if (_findnext(dp->handle, &(dp->fileinfo)) < 0) {
- dp->finished = 1;
- *result = NULL;
- return 0;
- }
- }
- dp->offset++;
-
- strlcpy(dp->dent.d_name, dp->fileinfo.name, _MAX_FNAME+1);
- dp->dent.d_ino = 1;
- dp->dent.d_reclen = strlen(dp->dent.d_name);
- dp->dent.d_off = dp->offset;
-
- memcpy(entry, &dp->dent, sizeof(*entry));
-
- *result = &dp->dent;
-
- return 0;
-}
-
-int closedir(DIR *dp)
-{
- if (!dp)
- return 0;
- _findclose(dp->handle);
- if (dp->dir)
- free(dp->dir);
- if (dp)
- free(dp);
-
- return 0;
-}
-
-void rewinddir(DIR *dir_Info)
-{
- /* Re-set to the beginning */
- char *filespec;
- long handle;
- int index;
-
- dir_Info->handle = 0;
- dir_Info->offset = 0;
- dir_Info->finished = 0;
-
- filespec = malloc(strlen(dir_Info->dir) + 2 + 1);
- strcpy(filespec, dir_Info->dir);
- index = strlen(filespec) - 1;
- if (index >= 0 && (filespec[index] == '/' || filespec[index] == '\\'))
- filespec[index] = '\0';
- strcat(filespec, "/*");
-
- if ((handle = _findfirst(filespec, &(dir_Info->fileinfo))) < 0) {
- if (errno == ENOENT) {
- dir_Info->finished = 1;
- }
- }
- dir_Info->handle = handle;
- free(filespec);
-}
diff --git a/win32/readdir.h b/win32/readdir.h
deleted file mode 100644
index b0f1ad9e6f..0000000000
--- a/win32/readdir.h
+++ /dev/null
@@ -1,44 +0,0 @@
-#ifndef READDIR_H
-#define READDIR_H
-
-
-/*
- * Structures and types used to implement opendir/readdir/closedir
- * on Windows 95/NT.
- */
-
-#include <io.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/types.h>
-
-
-/* struct dirent - same as Unix */
-
-struct dirent {
- long d_ino; /* inode (always 1 in WIN32) */
- off_t d_off; /* offset to this dirent */
- unsigned short d_reclen; /* length of d_name */
- char d_name[_MAX_FNAME + 1]; /* filename (null terminated) */
-};
-
-
-/* typedef DIR - not the same as Unix */
-typedef struct {
- long handle; /* _findfirst/_findnext handle */
- short offset; /* offset into directory */
- short finished; /* 1 if there are not more files */
- struct _finddata_t fileinfo; /* from _findfirst/_findnext */
- char *dir; /* the dir we are reading */
- struct dirent dent; /* the dirent to return */
-} DIR;
-
-/* Function prototypes */
-DIR *opendir(const char *);
-struct dirent *readdir(DIR *);
-int readdir_r(DIR *, struct dirent *, struct dirent **);
-int closedir(DIR *);
-void rewinddir(DIR *);
-
-
-#endif /* READDIR_H */
diff --git a/win32/registry.c b/win32/registry.c
deleted file mode 100644
index 8ae25011b7..0000000000
--- a/win32/registry.c
+++ /dev/null
@@ -1,89 +0,0 @@
-#include "php.h"
-#include "php_ini.h"
-
-void UpdateIniFromRegistry(char *path)
-{
- char *p, *orig_path;
- HKEY MainKey;
- char *strtok_buf = NULL;
-
- if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\\PHP\\Per Directory Values", 0, KEY_READ, &MainKey)!=ERROR_SUCCESS) {
- return;
- }
-
-
- orig_path = path = estrdup(path);
-
- /* Get rid of C:, if exists */
- p = strchr(path, ':');
- if (p) {
- *p = path[0]; /* replace the colon with the drive letter */
- path = p; /* make path point to the drive letter */
- } else {
- if (path[0] != '\\' && path[0] != '/') {
- char tmp_buf[MAXPATHLEN], *cwd;
- char drive_letter;
-
- /* get current working directory and prepend it to the path */
- if (!VCWD_GETCWD(tmp_buf, MAXPATHLEN)) {
- efree(orig_path);
- return;
- }
- cwd = strchr(tmp_buf, ':');
- if (!cwd) {
- drive_letter = 'C';
- cwd = tmp_buf;
- } else {
- drive_letter = tmp_buf[0];
- cwd++;
- }
- path = (char *) emalloc(2+strlen(cwd)+1+strlen(orig_path)+1);
- sprintf(path, "%c\\%s\\%s", drive_letter, cwd, orig_path);
- efree(orig_path);
- orig_path = path;
- }
- }
-
-
- path = p = php_strtok_r(path, "\\/", &strtok_buf);
-
- while (p) {
- HKEY hKey;
- DWORD lType;
- DWORD values = 0, max_name = 0, max_value = 0, i = 0;
-
- if (p>path) {
- *(p-1) = '\\'; /* restore the slash */
- }
-
- if (RegOpenKeyEx(MainKey, path, 0, KEY_READ, &hKey)!=ERROR_SUCCESS) {
- break;
- }
-
- if(RegQueryInfoKey(hKey, NULL, NULL, NULL, NULL, NULL, NULL, &values, &max_name, &max_value, NULL, NULL) == ERROR_SUCCESS) {
- LPTSTR namebuf = (LPTSTR)emalloc(max_name + 1);
- PBYTE valuebuf = (PBYTE)emalloc(max_value);
-
- while (i < values) {
- DWORD namebuf_len = max_name + 1;
- DWORD valuebuf_len = max_value;
-
- RegEnumValue(hKey, i, namebuf, &namebuf_len, NULL, &lType, valuebuf, &valuebuf_len);
-
- if ((lType == REG_SZ) || (lType == REG_EXPAND_SZ)) {
- zend_alter_ini_entry(namebuf, namebuf_len + 1, valuebuf, valuebuf_len, PHP_INI_PERDIR, PHP_INI_STAGE_ACTIVATE);
- }
-
- i++;
- }
-
- efree(namebuf);
- efree(valuebuf);
- }
-
- RegCloseKey(hKey);
- p = php_strtok_r(NULL, "\\/", &strtok_buf);
- }
- RegCloseKey(MainKey);
- efree(orig_path);
-}
diff --git a/win32/sendmail.c b/win32/sendmail.c
deleted file mode 100644
index 0e3ddb34e8..0000000000
--- a/win32/sendmail.c
+++ /dev/null
@@ -1,545 +0,0 @@
-
-/*
- * PHP Sendmail for Windows.
- *
- * This file is rewriten specificly for PHPFI. Some functionality
- * has been removed (MIME and file attachments). This code was
- * modified from code based on code writen by Jarle Aase.
- *
- * This class is based on the original code by Jarle Aase, see bellow:
- * wSendmail.cpp It has been striped of some functionality to match
- * the requirements of phpfi.
- *
- * Very simple SMTP Send-mail program for sending command-line level
- * emails and CGI-BIN form response for the Windows platform.
- *
- * The complete wSendmail package with source code can be located
- * from http://www.jgaa.com
- *
- */
-
-#include "php.h" /*php specific */
-#include <stdio.h>
-#include <stdlib.h>
-#include <winsock.h>
-#include "time.h"
-#include <string.h>
-#include <malloc.h>
-#include <memory.h>
-#include <winbase.h>
-#include "sendmail.h"
-#include "php_ini.h"
-
-/*
- extern int _daylight;
- extern long _timezone;
- */
-/*enum
- {
- DO_CONNECT = WM_USER +1
- };
- */
-
-static char *days[] =
-{"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"};
-static char *months[] =
-{"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
-
-#ifndef THREAD_SAFE
-char Buffer[MAIL_BUFFER_SIZE];
-
-/* socket related data */
-SOCKET sc;
-WSADATA Data;
-struct hostent *adr;
-SOCKADDR_IN sock_in;
-int WinsockStarted;
-/* values set by the constructor */
-char *AppName;
-char MailHost[HOST_NAME_LEN];
-char LocalHost[HOST_NAME_LEN];
-#endif
-char seps[] = " ,\t\n";
-char *php_mailer = "PHP 4.0 WIN32";
-
-char *get_header(char *h, char *headers);
-
-/* Error messages */
-static char *ErrorMessages[] =
-{
- {"Success"},
- {"Bad arguments from form"},
- {"Unable to open temporary mailfile for read"},
- {"Failed to Start Sockets"},
- {"Failed to Resolve Host"},
- {"Failed to obtain socket handle"},
- {"Failed to Connect"},
- {"Failed to Send"},
- {"Failed to Receive"},
- {"Server Error"},
- {"Failed to resolve the host IP name"},
- {"Out of memory"},
- {"Unknown error"},
- {"Bad Message Contents"},
- {"Bad Message Subject"},
- {"Bad Message destination"},
- {"Bad Message Return Path"},
- {"Bad Mail Host"},
- {"Bad Message File"},
- {"PHP Internal error: php.ini sendmail from variable not set!"}
-};
-
-
-
-/*********************************************************************
-// Name: TSendMail
-// Input: 1) host: Name of the mail host where the SMTP server resides
-// max accepted length of name = 256
-// 2) appname: Name of the application to use in the X-mailer
-// field of the message. if NULL is given the application
-// name is used as given by the GetCommandLine() function
-// max accespted length of name = 100
-// Output: 1) error: Returns the error code if something went wrong or
-// SUCCESS otherwise.
-//
-// See SendText() for additional args!
-//********************************************************************/
-int TSendMail(char *host, int *error,
- char *headers, char *Subject, char *mailTo, char *data)
-{
- int ret;
- char *RPath = NULL;
-
- WinsockStarted = FALSE;
-
- if (host == NULL) {
- *error = BAD_MAIL_HOST;
- return BAD_MAIL_HOST;
- } else if (strlen(host) >= HOST_NAME_LEN) {
- *error = BAD_MAIL_HOST;
- return BAD_MAIL_HOST;
- } else {
- strcpy(MailHost, host);
- }
-
- if (INI_STR("sendmail_from")){
- RPath = estrdup(INI_STR("sendmail_from"));
- } else {
- return 19;
- }
-
- /* attempt to connect with mail host */
- *error = MailConnect();
- if (*error != 0) {
- if(RPath)efree(RPath);
- return *error;
- } else {
- ret = SendText(RPath, Subject, mailTo, data, headers);
- TSMClose();
- if (ret != SUCCESS) {
- *error = ret;
- }
- if(RPath)efree(RPath);
- return ret;
- }
-}
-
-//********************************************************************
-// Name: TSendMail::~TSendMail
-// Input:
-// Output:
-// Description: DESTRUCTOR
-// Author/Date: jcar 20/9/96
-// History:
-//********************************************************************/
-void TSMClose()
-{
- Post("QUIT\r\n");
- Ack();
- /* to guarantee that the cleanup is not made twice and
- compomise the rest of the application if sockets are used
- elesewhere
- */
-
- shutdown(sc, 0);
- closesocket(sc);
-}
-
-
-/*********************************************************************
-// Name: char *GetSMErrorText
-// Input: Error index returned by the menber functions
-// Output: pointer to a string containing the error description
-// Description:
-// Author/Date: jcar 20/9/96
-// History:
-//*******************************************************************/
-char *GetSMErrorText(int index)
-{
-
- if ((index > MAX_ERROR_INDEX) || (index < MIN_ERROR_INDEX))
- return (ErrorMessages[UNKNOWN_ERROR]);
- else
- return (ErrorMessages[index]);
-}
-
-
-/*********************************************************************
-// Name: TSendText
-// Input: 1) RPath: return path of the message
-// Is used to fill the "Return-Path" and the
-// "X-Sender" fields of the message.
-// 2) Subject: Subject field of the message. If NULL is given
-// the subject is set to "No Subject"
-// 3) mailTo: Destination address
-// 4) data: Null terminated string containing the data to be send.
-// Output: Error code or SUCCESS
-// Description:
-// Author/Date: jcar 20/9/96
-// History:
-//*******************************************************************/
-int SendText(char *RPath, char *Subject, char *mailTo, char *data, char *headers)
-{
- int res, i;
- char *p;
- char *tempMailTo, *token, *pos1, *pos2;
-
- /* check for NULL parameters */
- if (data == NULL)
- return (BAD_MSG_CONTENTS);
- if (mailTo == NULL)
- return (BAD_MSG_DESTINATION);
- if (RPath == NULL)
- return (BAD_MSG_RPATH);
-
- /* simple checks for the mailto address */
- /* have ampersand ? */
- if (strchr(mailTo, '@') == NULL)
- return (BAD_MSG_DESTINATION);
-
- sprintf(Buffer, "HELO %s\r\n", LocalHost);
-
- /* in the beggining of the dialog */
- /* attempt reconnect if the first Post fail */
- if ((res = Post(Buffer)) != SUCCESS) {
- MailConnect();
- if ((res = Post(Buffer)) != SUCCESS)
- return (res);
- }
- if ((res = Ack()) != SUCCESS)
- return (res);
-
- sprintf(Buffer, "MAIL FROM:<%s>\r\n", RPath);
- if ((res = Post(Buffer)) != SUCCESS)
- return (res);
- if ((res = Ack()) != SUCCESS)
- return (res);
-
-
- tempMailTo = estrdup(mailTo);
-
- /* Send mail to all rcpt's */
- token = strtok(tempMailTo, ",");
- while(token != NULL)
- {
- sprintf(Buffer, "RCPT TO:<%s>\r\n", token);
- if ((res = Post(Buffer)) != SUCCESS)
- return (res);
- if ((res = Ack()) != SUCCESS)
- return (res);
- token = strtok(NULL, ",");
- }
-
- /* Send mail to all Cc rcpt's */
- efree(tempMailTo);
- if (headers && (pos1 = strstr(headers, "Cc:"))) {
- pos2 = strstr(pos1, "\r\n");
- tempMailTo = estrndup(pos1, pos2-pos1);
-
- token = strtok(tempMailTo, ",");
- while(token != NULL)
- {
- sprintf(Buffer, "RCPT TO:<%s>\r\n", token);
- if ((res = Post(Buffer)) != SUCCESS)
- return (res);
- if ((res = Ack()) != SUCCESS)
- return (res);
- token = strtok(NULL, ",");
- }
- efree(tempMailTo);
- }
-
- if ((res = Post("DATA\r\n")) != SUCCESS)
- return (res);
- if ((res = Ack()) != SUCCESS)
- return (res);
-
-
- /* send message header */
- if (Subject == NULL)
- res = PostHeader(RPath, "No Subject", mailTo, headers);
- else
- res = PostHeader(RPath, Subject, mailTo, headers);
- if (res != SUCCESS)
- return (res);
-
-
- /* send message contents in 1024 chunks */
- if (strlen(data) <= 1024) {
- if ((res = Post(data)) != SUCCESS)
- return (res);
- } else {
- p = data;
- while (1) {
- if (*p == '\0')
- break;
- if (strlen(p) >= 1024)
- i = 1024;
- else
- i = strlen(p);
-
- /* put next chunk in buffer */
- strncpy(Buffer, p, i);
- Buffer[i] = '\0';
- p += i;
-
- /* send chunk */
- if ((res = Post(Buffer)) != SUCCESS)
- return (res);
- }
- }
-
- /*send termination dot */
- if ((res = Post("\r\n.\r\n")) != SUCCESS)
- return (res);
- if ((res = Ack()) != SUCCESS)
- return (res);
-
- return (SUCCESS);
-}
-
-
-
-/*********************************************************************
-// Name: PostHeader
-// Input: 1) return path
-// 2) Subject
-// 3) destination address
-// 4) DoMime flag
-// Output: Error code or Success
-// Description:
-// Author/Date: jcar 20/9/96
-// History:
-//********************************************************************/
-int PostHeader(char *RPath, char *Subject, char *mailTo, char *xheaders)
-{
-
- /* Print message header according to RFC 822 */
- /* Return-path, Received, Date, From, Subject, Sender, To, cc */
-
- time_t tNow = time(NULL);
- struct tm *tm = localtime(&tNow);
- int zoneh = abs(_timezone);
- int zonem, res;
- char *p;
-
- p = Buffer;
- zoneh /= (60 * 60);
- zonem = (abs(_timezone) / 60) - (zoneh * 60);
-
- if(!xheaders || !strstr(xheaders, "Date:")){
- p += sprintf(p, "Date: %s, %02d %s %04d %02d:%02d:%02d %s%02d%02d\r\n",
- days[tm->tm_wday],
- tm->tm_mday,
- months[tm->tm_mon],
- tm->tm_year + 1900,
- tm->tm_hour,
- tm->tm_min,
- tm->tm_sec,
- (_timezone > 0) ? "+" : (_timezone < 0) ? "-" : "",
- zoneh,
- zonem);
- }
-
- if(!xheaders || !strstr(xheaders, "From:")){
- p += sprintf(p, "From: %s\r\n", RPath);
- }
- p += sprintf(p, "Subject: %s\r\n", Subject);
- if(!xheaders || !strstr(xheaders, "To:")){
- p += sprintf(p, "To: %s\r\n", mailTo);
- }
- if(xheaders){
- p += sprintf(p, "%s\r\n", xheaders);
- }
-
- if ((res = Post(Buffer)) != SUCCESS)
- return (res);
-
- if ((res = Post("\r\n")) != SUCCESS)
- return (res);
-
- return (SUCCESS);
-}
-
-
-
-/*********************************************************************
-// Name: MailConnect
-// Input: None
-// Output: None
-// Description: Connect to the mail host and receive the welcome message.
-// Author/Date: jcar 20/9/96
-// History:
-//********************************************************************/
-int MailConnect()
-{
-
- int res;
- short portnum;
-
- /* Create Socket */
- if ((sc = socket(PF_INET, SOCK_STREAM, 0)) == INVALID_SOCKET)
- return (FAILED_TO_OBTAIN_SOCKET_HANDLE);
-
- /* Get our own host name */
- if (gethostname(LocalHost, HOST_NAME_LEN))
- return (FAILED_TO_GET_HOSTNAME);
-
- /* Resolve the servers IP */
- /*
- if (!isdigit(MailHost[0])||!gethostbyname(MailHost))
- {
- return (FAILED_TO_RESOLVE_HOST);
- }
- */
-
- portnum = (short) INI_INT("sendmail_port");
- if (!portnum) {
- portnum = 25;
- }
-
- /* Connect to server */
- sock_in.sin_family = AF_INET;
- sock_in.sin_port = htons(portnum);
- sock_in.sin_addr.S_un.S_addr = GetAddr(MailHost);
-
- if (connect(sc, (LPSOCKADDR) & sock_in, sizeof(sock_in)))
- return (FAILED_TO_CONNECT);
-
- /* receive Server welcome message */
- res = Ack();
- return (res);
-}
-
-
-
-
-
-
-/*********************************************************************
-// Name: Post
-// Input:
-// Output:
-// Description:
-// Author/Date: jcar 20/9/96
-// History:
-//********************************************************************/
-int Post(LPCSTR msg)
-{
- int len = strlen(msg);
- int slen;
- int index = 0;
-
- while (len > 0) {
- if ((slen = send(sc, msg + index, len, 0)) < 1)
- return (FAILED_TO_SEND);
- len -= slen;
- index += slen;
- }
- return (SUCCESS);
-}
-
-
-
-/*********************************************************************
-// Name: Ack
-// Input:
-// Output:
-// Description:
-// Get the response from the server. We only want to know if the
-// last command was successful.
-// Author/Date: jcar 20/9/96
-// History:
-//********************************************************************/
-int Ack()
-{
- static char *buf;
- int rlen;
- int Index = 0;
- int Received = 0;
-
- if (!buf)
- if ((buf = (char *) malloc(1024 * 4)) == NULL)
- return (OUT_OF_MEMORY);
-
- again:
-
- if ((rlen = recv(sc, buf + Index, ((1024 * 4) - 1) - Received, 0)) < 1)
- return (FAILED_TO_RECEIVE);
-
- Received += rlen;
- buf[Received] = 0;
- /*err_msg fprintf(stderr,"Received: (%d bytes) %s", rlen, buf + Index); */
-
- /* Check for newline */
- Index += rlen;
-
- if ((buf[Received - 4] == ' ' && buf[Received - 3] == '-') ||
- (buf[Received - 2] != '\r') || (buf[Received - 1] != '\n'))
- /* err_msg fprintf(stderr,"Incomplete server message. Awaiting CRLF\n"); */
- goto again; /* Incomplete data. Line must be terminated by CRLF
- And not contain a space followed by a '-' */
-
- if (buf[0] > '3')
- return (SMTP_SERVER_ERROR);
-
- return (SUCCESS);
-}
-
-
-/*********************************************************************
-// Name: unsigned long GetAddr (LPSTR szHost)
-// Input:
-// Output:
-// Description: Given a string, it will return an IP address.
-// - first it tries to convert the string directly
-// - if that fails, it tries o resolve it as a hostname
-//
-// WARNING: gethostbyname() is a blocking function
-// Author/Date: jcar 20/9/96
-// History:
-//********************************************************************/
-unsigned long GetAddr(LPSTR szHost)
-{
- LPHOSTENT lpstHost;
- u_long lAddr = INADDR_ANY;
-
- /* check that we have a string */
- if (*szHost) {
-
- /* check for a dotted-IP address string */
- lAddr = inet_addr(szHost);
-
- /* If not an address, then try to resolve it as a hostname */
- if ((lAddr == INADDR_NONE) && (strcmp(szHost, "255.255.255.255"))) {
-
- lpstHost = gethostbyname(szHost);
- if (lpstHost) { /* success */
- lAddr = *((u_long FAR *) (lpstHost->h_addr));
- } else {
- lAddr = INADDR_ANY; /* failure */
- }
- }
- }
- return (lAddr);
-} /* end GetAddr() */
diff --git a/win32/sendmail.h b/win32/sendmail.h
deleted file mode 100644
index 38ac29e5eb..0000000000
--- a/win32/sendmail.h
+++ /dev/null
@@ -1,46 +0,0 @@
-#if !defined(sendmail_h) /* Sentry, use file only if it's not already included. */
-#define sendmail_h
-#include <windows.h>
-
-#define HOST_NAME_LEN 256
-#define MAX_APPNAME_LENGHT 100
-#define MAX_ERROR_INDEX 17
-#define MIN_ERROR_INDEX 0
-#define MAIL_BUFFER_SIZE (1024*4) /* 4k buffer */
-/* Return values */
-#define SUCCESS 0
-#define FAILED_TO_PARSE_ARGUMENTS 1
-#define FAILED_TO_OPEN_MAILFILE 2
-#define FAILED_TO_START_SOCKETS 3
-#define FAILED_TO_RESOLVE_HOST 4
-#define FAILED_TO_OBTAIN_SOCKET_HANDLE 5
-#define FAILED_TO_CONNECT 6
-#define FAILED_TO_SEND 7
-#define FAILED_TO_RECEIVE 8
-#define SMTP_SERVER_ERROR 9
-#define FAILED_TO_GET_HOSTNAME 10
-#define OUT_OF_MEMORY 11
-#define UNKNOWN_ERROR 12
-#define BAD_MSG_CONTENTS 13
-#define BAD_MSG_SUBJECT 14
-#define BAD_MSG_DESTINATION 15
-#define BAD_MSG_RPATH 16
-#define BAD_MAIL_HOST 17
-#define BAD_MSG_FILE 18
-
-
-int TSendMail(char *smtpaddr, int *returnerror,
- char *RPath, char *Subject, char *mailTo, char *data);
-void TSMClose(void);
-int SendText(char *RPath, char *Subject, char *mailTo, char *data, char *headers);
-char *GetSMErrorText(int index);
-
-int MailConnect();
-int PostHeader(char *, char *, char *, char *);
-int Post(LPCSTR);
-int Ack();
-unsigned long GetAddr(LPSTR szHost);
-
-
-
-#endif /* sendmail_h */
diff --git a/win32/signal.h b/win32/signal.h
deleted file mode 100644
index a95b15c102..0000000000
--- a/win32/signal.h
+++ /dev/null
@@ -1,16 +0,0 @@
-/*
-** Change here: if you plan to use your own version of <signal.h>
-** the original "#include <signal.h>" produces an infinite reinclusion
-** of this file, instead of including the standard include-file.
-** Under MS Visual Studio, there are occurences in the source where
-** <signal.h> gets included throughout the PHP4 sources, and this should
-** include THIS file, not the standard one which does not have the
-** additional signals defined below.
-** One way to remove the infinite reinclusion of this file (which is located
-** in ../win32), is to specify the parent directory in which the standard
-** include file is located.
-*/
-#include <../include/signal.h>
-#define SIGALRM 13
-#define SIGVTALRM 26 /* virtual time alarm */
-#define SIGPROF 27 /* profiling time alarm */
diff --git a/win32/syslog.h b/win32/syslog.h
deleted file mode 100644
index ac2651e7e0..0000000000
--- a/win32/syslog.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * This header borrowed from Cygnus GNUwin32 project
- *
- * Modified for use with functions to map syslog
- * calls to EventLog calls on the windows platform
- *
- * much of this is not used, but here for the sake of
- * error free compilation. EventLogs will most likely
- * not behave as syslog does, but may be useful anyway.
- * much of what syslog does can be emulated here, but
- * that will have to be done later.
- */
-
-#ifndef SYSLOG_H
-#define SYSLOG_H
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-
-#define LOG_EMERG 1
-#define LOG_ALERT 1
-#define LOG_CRIT 1
-#define LOG_ERR 4
-#define LOG_WARNING 5
-#define LOG_NOTICE 6
-#define LOG_INFO 6
-#define LOG_DEBUG 6
-
-#define LOG_PRIMASK 0x07
-
-#define LOG_PRI(p) ((p) & LOG_PRIMASK)
-#define LOG_MAKEPRI(fac, pri) (((fac) << 3) | (pri))
-
-#define LOG_KERN (0<<3)
-#define LOG_USER (1<<3)
-#define LOG_MAIL (2<<3)
-#define LOG_DAEMON (3<<3)
-#define LOG_AUTH (4<<3)
-#define LOG_SYSLOG (5<<3)
-#define LOG_LPR (6<<3)
-#define LOG_NEWS (7<<3)
-#define LOG_UUCP (8<<3)
-#define LOG_CRON (9<<3)
-#define LOG_AUTHPRIV (10<<3)
-
-#define LOG_NFACILITIES 10
-#define LOG_FACMASK 0x03f8
-#define LOG_FAC(p) (((p) & LOG_FACMASK) >> 3)
-
-#define LOG_MASK(pri) (1 << (pri))
-#define LOG_UPTO(pri) ((1 << ((pri)+1)) - 1)
-
-/*
- * Option flags for openlog.
- *
- * LOG_ODELAY no longer does anything.
- * LOG_NDELAY is the inverse of what it used to be.
- */
-#define LOG_PID 0x01 /* log the pid with each message */
-#define LOG_CONS 0x02 /* log on the console if errors in sending */
-#define LOG_ODELAY 0x04 /* delay open until first syslog() (default) */
-#define LOG_NDELAY 0x08 /* don't delay open */
-#define LOG_NOWAIT 0x10 /* don't wait for console forks: DEPRECATED */
-#define LOG_PERROR 0x20 /* log to stderr as well */
-
-
-extern void closelog(void);
-extern void openlog(const char *, int, int);
-/* setlogmask not implemented */
-/* extern int setlogmask (int); */
-extern void syslog(int, const char *, ...);
-
-
-#endif /* SYSLOG_H */
diff --git a/win32/testsuite.dsp b/win32/testsuite.dsp
deleted file mode 100644
index 5cd65622f5..0000000000
--- a/win32/testsuite.dsp
+++ /dev/null
@@ -1,150 +0,0 @@
-# Microsoft Developer Studio Project File - Name="testsuite" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Generic Project" 0x010a
-
-CFG=testsuite - Win32 Debug_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "testsuite.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "testsuite.mak" CFG="testsuite - Win32 Debug_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "testsuite - Win32 Release_TS_Inline" (based on "Win32 (x86) Generic Project")
-!MESSAGE "testsuite - Win32 Release_TS" (based on "Win32 (x86) Generic Project")
-!MESSAGE "testsuite - Win32 Release_TSDbg" (based on "Win32 (x86) Generic Project")
-!MESSAGE "testsuite - Win32 Debug_TS" (based on "Win32 (x86) Generic Project")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-MTL=midl.exe
-
-!IF "$(CFG)" == "testsuite - Win32 Release_TS_Inline"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS_Inline"
-# PROP BASE Intermediate_Dir "Release_TS_Inline"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "..\..\Release_TS_Inline"
-# PROP Intermediate_Dir "..\..\"
-# PROP Target_Dir ""
-
-!ELSEIF "$(CFG)" == "testsuite - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "..\..\Release_TS"
-# PROP Intermediate_Dir "..\..\"
-# PROP Target_Dir ""
-
-!ELSEIF "$(CFG)" == "testsuite - Win32 Release_TSDbg"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TSDbg"
-# PROP BASE Intermediate_Dir "Release_TSDbg"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "..\..\Release_TSDbg"
-# PROP Intermediate_Dir "..\..\"
-# PROP Target_Dir ""
-
-!ELSEIF "$(CFG)" == "testsuite - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "..\..\Debug_TS"
-# PROP Intermediate_Dir "..\..\"
-# PROP Target_Dir ""
-
-!ENDIF
-
-# Begin Target
-
-# Name "testsuite - Win32 Release_TS_Inline"
-# Name "testsuite - Win32 Release_TS"
-# Name "testsuite - Win32 Release_TSDbg"
-# Name "testsuite - Win32 Debug_TS"
-# Begin Source File
-
-SOURCE=..\results.txt
-
-!IF "$(CFG)" == "testsuite - Win32 Release_TS_Inline"
-
-# PROP Intermediate_Dir "..\Release_TS_Inline"
-# PROP Ignore_Default_Tool 1
-# Begin Custom Build - Running Testsuite, please wait...
-IntDir=.\..\Release_TS_Inline
-InputPath=..\results.txt
-
-"..\..\results.txt" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- set TOP_BUILDDIR=Release_TS_inline
- set TEST_DIR=tests
- $(IntDir)\php.exe -q ..\run-tests.php > ..\results.txt
-
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "testsuite - Win32 Release_TS"
-
-# PROP Intermediate_Dir "..\Release_TS"
-# PROP Ignore_Default_Tool 1
-# Begin Custom Build - Running Testsuite, please wait...
-IntDir=.\..\Release_TS
-InputPath=..\results.txt
-
-"..\..\results.txt" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- set TOP_BUILDDIR=Release_TS
- set TEST_DIR=tests
- $(IntDir)\php.exe -q ..\run-tests.php > ..\results.txt
-
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "testsuite - Win32 Release_TSDbg"
-
-# PROP Intermediate_Dir "..\Release_TSDbg"
-# PROP Ignore_Default_Tool 1
-# Begin Custom Build - Running Testsuite, please wait...
-IntDir=.\..\Release_TSDbg
-InputPath=..\results.txt
-
-"..\..\results.txt" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- set TOP_BUILDDIR=Release_TSDbg
- set TEST_DIR=tests
- $(IntDir)\php.exe -q ..\run-tests.php > ..\results.txt
-
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "testsuite - Win32 Debug_TS"
-
-# PROP Intermediate_Dir "..\Debug_TS"
-# PROP Exclude_From_Build 1
-
-!ENDIF
-
-# End Source File
-# End Target
-# End Project
diff --git a/win32/time.c b/win32/time.c
deleted file mode 100644
index 710307574d..0000000000
--- a/win32/time.c
+++ /dev/null
@@ -1,242 +0,0 @@
-
-/*****************************************************************************
- * *
- * DH_TIME.C *
- * *
- * Freely redistributable and modifiable. Use at your own risk. *
- * *
- * Copyright 1994 The Downhill Project *
- *
- * Modified by Shane Caraveo for use with PHP
- *
- *****************************************************************************/
-
-/* $Id$ */
-
- /**
- *
- * 04-Feb-2001
- * - Added patch by "Vanhanen, Reijo" <Reijo.Vanhanen@helsoft.fi>
- * Improves accuracy of msec
- */
-
-/* Include stuff ************************************************************ */
-
-#include "time.h"
-#include "unistd.h"
-#include "signal.h"
-#include <winbase.h>
-#include <mmsystem.h>
-#include <errno.h>
-
-int getfilesystemtime(struct timeval *time_Info)
-{
-FILETIME ft;
-__int64 ff;
-
- GetSystemTimeAsFileTime(&ft); /* 100 ns blocks since 01-Jan-1641 */
- /* resolution seems to be 0.01 sec */
- ff = *(__int64*)(&ft);
- time_Info->tv_sec = (int)(ff/(__int64)10000000-(__int64)11644473600);
- time_Info->tv_usec = (int)(ff % 10000000)/10;
- return 0;
-}
-
-
-
-int gettimeofday(struct timeval *time_Info, struct timezone *timezone_Info)
-{
-
- static struct timeval starttime = {0, 0};
- static __int64 lasttime = 0;
- static __int64 freq = 0;
- __int64 timer;
- LARGE_INTEGER li;
- BOOL b;
- double dt;
-
- /* Get the time, if they want it */
- if (time_Info != NULL) {
- if (starttime.tv_sec == 0) {
- b = QueryPerformanceFrequency(&li);
- if (!b) {
- starttime.tv_sec = -1;
- }
- else {
- freq = li.QuadPart;
- b = QueryPerformanceCounter(&li);
- if (!b) {
- starttime.tv_sec = -1;
- }
- else {
- getfilesystemtime(&starttime);
- timer = li.QuadPart;
- dt = (double)timer/freq;
- starttime.tv_usec -= (int)((dt-(int)dt)*1000000);
- if (starttime.tv_usec < 0) {
- starttime.tv_usec += 1000000;
- --starttime.tv_sec;
- }
- starttime.tv_sec -= (int)dt;
- }
- }
- }
- if (starttime.tv_sec > 0) {
- b = QueryPerformanceCounter(&li);
- if (!b) {
- starttime.tv_sec = -1;
- }
- else {
- timer = li.QuadPart;
- if (timer < lasttime) {
- getfilesystemtime(time_Info);
- dt = (double)timer/freq;
- starttime = *time_Info;
- starttime.tv_usec -= (int)((dt-(int)dt)*1000000);
- if (starttime.tv_usec < 0) {
- starttime.tv_usec += 1000000;
- --starttime.tv_sec;
- }
- starttime.tv_sec -= (int)dt;
- }
- else {
- lasttime = timer;
- dt = (double)timer/freq;
- time_Info->tv_sec = starttime.tv_sec + (int)dt;
- time_Info->tv_usec = starttime.tv_usec + (int)((dt-(int)dt)*1000000);
- if (time_Info->tv_usec > 1000000) {
- time_Info->tv_usec -= 1000000;
- ++time_Info->tv_sec;
- }
- }
- }
- }
- if (starttime.tv_sec < 0) {
- getfilesystemtime(time_Info);
- }
-
- }
- /* Get the timezone, if they want it */
- if (timezone_Info != NULL) {
- _tzset();
- timezone_Info->tz_minuteswest = _timezone;
- timezone_Info->tz_dsttime = _daylight;
- }
- /* And return */
- return 0;
-}
-
-
-/* this usleep isnt exactly accurate but should do ok */
-void usleep(unsigned int useconds)
-{
-struct timeval tnow, tthen, t0;
-
- gettimeofday(&tthen, NULL);
- t0 = tthen;
- tthen.tv_usec += useconds;
- while (tthen.tv_usec > 1000000) {
- tthen.tv_usec -= 1000000;
- tthen.tv_sec++;
- }
-
- if (useconds > 10000) {
- useconds -= 10000;
- Sleep(useconds/1000);
- }
-
- while (1) {
- gettimeofday(&tnow, NULL);
- if (tnow.tv_sec > tthen.tv_sec) {
- break;
- }
- if (tnow.tv_sec == tthen.tv_sec) {
- if (tnow.tv_usec > tthen.tv_usec) {
- break;
- }
- }
- }
-}
-
-
-#ifdef HAVE_SETITIMER
-
-
-#ifndef THREAD_SAFE
-unsigned int proftimer, virttimer, realtimer;
-extern LPMSG phpmsg;
-#endif
-
-struct timer_msg {
- int signal;
- unsigned int threadid;
-};
-
-
-LPTIMECALLBACK setitimer_timeout(UINT uTimerID, UINT info, DWORD dwUser, DWORD dw1, DWORD dw2)
-{
- struct timer_msg *msg = (struct timer_msg *) info;
-
- if (msg) {
- raise((int) msg->signal);
- PostThreadMessage(msg->threadid,
- WM_NOTIFY, msg->signal, 0);
- free(msg);
- }
- return 0;
-}
-
-int setitimer(int which, const struct itimerval *value, struct itimerval *ovalue)
-{
- int timeout = value->it_value.tv_sec * 1000 + value->it_value.tv_usec;
- int repeat = TIME_ONESHOT;
-
- /*make sure the message queue is initialized */
- PeekMessage(phpmsg, NULL, WM_USER, WM_USER, PM_NOREMOVE);
- if (timeout > 0) {
- struct timer_msg *msg = malloc(sizeof(struct timer_msg));
- msg->threadid = GetCurrentThreadId();
- if (!ovalue) {
- repeat = TIME_PERIODIC;
- }
- switch (which) {
- case ITIMER_REAL:
- msg->signal = SIGALRM;
- realtimer = timeSetEvent(timeout, 100, (LPTIMECALLBACK) setitimer_timeout, (UINT) msg, repeat);
- break;
- case ITIMER_VIRT:
- msg->signal = SIGVTALRM;
- virttimer = timeSetEvent(timeout, 100, (LPTIMECALLBACK) setitimer_timeout, (UINT) msg, repeat);
- break;
- case ITIMER_PROF:
- msg->signal = SIGPROF;
- proftimer = timeSetEvent(timeout, 100, (LPTIMECALLBACK) setitimer_timeout, (UINT) msg, repeat);
- break;
- default:
- errno = EINVAL;
- return -1;
- break;
- }
- } else {
- switch (which) {
- case ITIMER_REAL:
- timeKillEvent(realtimer);
- break;
- case ITIMER_VIRT:
- timeKillEvent(virttimer);
- break;
- case ITIMER_PROF:
- timeKillEvent(proftimer);
- break;
- default:
- errno = EINVAL;
- return -1;
- break;
- }
- }
-
-
- return 0;
-}
-
-#endif
diff --git a/win32/time.h b/win32/time.h
deleted file mode 100644
index 457d4fa9e0..0000000000
--- a/win32/time.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*****************************************************************************
- * *
- * sys/time.h *
- * *
- * Freely redistributable and modifiable. Use at your own risk. *
- * *
- * Copyright 1994 The Downhill Project *
- *
- * Modified by Shane Caraveo for PHP
- *
- *****************************************************************************/
-#ifndef TIME_H
-#define TIME_H
-
-/* Include stuff ************************************************************ */
-#include <winsock.h>
-#include <time.h>
-
-/* Struct stuff ************************************************************* */
-struct timezone {
- int tz_minuteswest;
- int tz_dsttime;
-};
-
-
-struct itimerval {
- struct timeval it_interval; /* next value */
- struct timeval it_value; /* current value */
-};
-
-#define ITIMER_REAL 0 /*generates sigalrm */
-#define ITIMER_VIRTUAL 1 /*generates sigvtalrm */
-#define ITIMER_VIRT 1 /*generates sigvtalrm */
-#define ITIMER_PROF 2 /*generates sigprof */
-
-/* Prototype stuff ********************************************************** */
-extern int gettimeofday(struct timeval *time_Info, struct timezone *timezone_Info);
-
-/* setitimer operates at 100 millisecond resolution */
-extern int setitimer(int which, const struct itimerval *value,
- struct itimerval *ovalue);
-
-#endif
diff --git a/win32/unistd.h b/win32/unistd.h
deleted file mode 100644
index 5604103ec9..0000000000
--- a/win32/unistd.h
+++ /dev/null
@@ -1 +0,0 @@
-extern void usleep(unsigned int useconds);
diff --git a/win32/wfile.c b/win32/wfile.c
deleted file mode 100644
index 1407d6a32b..0000000000
--- a/win32/wfile.c
+++ /dev/null
@@ -1,17 +0,0 @@
-
-/* Function borrowed from the Downhill Project */
-#include "wfile.h"
-#include "direct.h"
-
-int readlink(char *file_Name, char *buf_Mem, int buf_Size)
-{
- /* See if the file exists */
- if (access(file_Name, X_OK) == -1) {
- errno = ENOENT;
- } else {
- errno = EINVAL;
- }
-
- /* Either way, it's not a link */
- return -1;
-}
diff --git a/win32/wfile.h b/win32/wfile.h
deleted file mode 100644
index 2e79406478..0000000000
--- a/win32/wfile.h
+++ /dev/null
@@ -1,16 +0,0 @@
-#include <io.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-
-#define access _access
-#define X_OK 0
-#ifndef ENOENT
-#define ENOENT 136
-#endif
-#ifndef EINVAL
-#define EINVAL 131
-#endif
-
-int readlink(char *, char *, int);
-int checkroot(char *path);
diff --git a/win32/winutil.c b/win32/winutil.c
deleted file mode 100644
index 8c3cde86e1..0000000000
--- a/win32/winutil.c
+++ /dev/null
@@ -1,21 +0,0 @@
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-#include "winutil.h"
-
-#ifndef THREAD_SAFE
-static char Win_Error_msg[256];
-#endif
-
-char *php_win_err(void)
-{
- FormatMessage(
- FORMAT_MESSAGE_FROM_SYSTEM,
- NULL,
- GetLastError(),
- MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), /* Default language */
- (LPTSTR) Win_Error_msg,
- 256,
- NULL);
-
- return Win_Error_msg;
-}
diff --git a/win32/winutil.h b/win32/winutil.h
deleted file mode 100644
index 9e4feca8a4..0000000000
--- a/win32/winutil.h
+++ /dev/null
@@ -1 +0,0 @@
-extern char *php_win_err(void);
diff --git a/win32/wsyslog.c b/win32/wsyslog.c
deleted file mode 100644
index 7db5156011..0000000000
--- a/win32/wsyslog.c
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * This file modified from sources for imap4 for use
- * in PHP 3
- */
-/*
- * Program: Unix compatibility routines
- *
- * Author: Mark Crispin
- * Networks and Distributed Computing
- * Computing & Communications
- * University of Washington
- * Administration Building, AG-44
- * Seattle, WA 98195
- * Internet: MRC@CAC.Washington.EDU
- *
- * Date: 14 September 1996
- * Last Edited: 22 October 1996
- *
- * Copyright 1996 by the University of Washington
- *
- * Permission to use, copy, modify, and distribute this software and its
- * documentation for any purpose and without fee is hereby granted, provided
- * that the above copyright notice appears in all copies and that both the
- * above copyright notice and this permission notice appear in supporting
- * documentation, and that the name of the University of Washington not be
- * used in advertising or publicity pertaining to distribution of the software
- * without specific, written prior permission. This software is made available
- * "as is", and
- * THE UNIVERSITY OF WASHINGTON DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED,
- * WITH REGARD TO THIS SOFTWARE, INCLUDING WITHOUT LIMITATION ALL IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, AND IN
- * NO EVENT SHALL THE UNIVERSITY OF WASHINGTON BE LIABLE FOR ANY SPECIAL,
- * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
- * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, TORT
- * (INCLUDING NEGLIGENCE) OR STRICT LIABILITY, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- */
-
-
-/* DEDICATION
-
- * This file is dedicated to my dog, Unix, also known as Yun-chan and
- * Unix J. Terwilliker Jehosophat Aloysius Monstrosity Animal Beast. Unix
- * passed away at the age of 11 1/2 on September 14, 1996, 12:18 PM PDT, after
- * a two-month bout with cirrhosis of the liver.
- *
- * He was a dear friend, and I miss him terribly.
- *
- * Lift a leg, Yunie. Luv ya forever!!!!
- */
-
-#include "php.h" /*php specific */
-#include "syslog.h"
-#include <stdio.h>
-#include <fcntl.h>
-#include <process.h>
-
-#ifndef THREAD_SAFE
-static char *loghdr; /* log file header string */
-static HANDLE loghdl = NULL; /* handle of event source */
-#endif
-
-void closelog(void)
-{
- DeregisterEventSource(loghdl);
- efree(loghdr);
-}
-
-/* Emulator for BSD syslog() routine
- * Accepts: priority
- * message
- * parameters
- */
-
-void syslog(int priority, const char *message, ...)
-{
- va_list args;
- LPTSTR strs[2];
- char tmp[1024]; /* callers must be careful not to pop this */
- unsigned short etype;
-
- /* default event source */
- if (!loghdl)
- openlog("c-client", LOG_PID, LOG_MAIL);
- switch (priority) { /* translate UNIX type into NT type */
- case LOG_ALERT:
- etype = EVENTLOG_ERROR_TYPE;
- break;
- case LOG_INFO:
- etype = EVENTLOG_INFORMATION_TYPE;
- break;
- default:
- etype = EVENTLOG_WARNING_TYPE;
- }
- va_start(args, message); /* initialize vararg mechanism */
- vsprintf(tmp, message, args); /* build message */
- strs[0] = loghdr; /* write header */
- strs[1] = tmp; /* then the message */
- /* report the event */
- ReportEvent(loghdl, etype, (unsigned short) priority, 2000, NULL, 2, 0, strs, NULL);
- va_end(args);
-}
-
-
-/* Emulator for BSD openlog() routine
- * Accepts: identity
- * options
- * facility
- */
-
-void openlog(const char *ident, int logopt, int facility)
-{
- char tmp[1024];
-
- if (loghdl) {
- closelog();
- }
- loghdl = RegisterEventSource(NULL, ident);
- sprintf(tmp, (logopt & LOG_PID) ? "%s[%d]" : "%s", ident, getpid());
- loghdr = estrdup(tmp); /* save header for later */
-}